From: support Date: Thu, 13 Oct 2022 15:12:44 +0000 (+0000) Subject: Built motion from commit 6dca1c86.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=b724c9ea67d005bb85b8a7cfd4336773436cfa22;p=motion2.git Built motion from commit 6dca1c86.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 12837bb..347d714 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-10-13T13:41:37.222Z", + "time": "2022-10-13T15:04:39.893Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 826b4e2..e33f6da 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-13T13:41:37.222Z", + "time": "2022-10-13T15:04:39.893Z", "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 48f5fb7..4b2f297 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 _0xc8ed=['jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration'];(function(_0x2bd669,_0x387154){var _0x3f2537=function(_0x604734){while(--_0x604734){_0x2bd669['push'](_0x2bd669['shift']());}};_0x3f2537(++_0x387154);}(_0xc8ed,0x1c4));var _0xdc8e=function(_0x1f708c,_0x351786){_0x1f708c=_0x1f708c-0x0;var _0x35b1ea=_0xc8ed[_0x1f708c];return _0x35b1ea;};'use strict';var Sequelize=require(_0xdc8e('0x0'));module[_0xdc8e('0x1')]={'name':{'type':Sequelize[_0xdc8e('0x2')],'get':function(_0x241173){return this[_0xdc8e('0x3')](_0xdc8e('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xdc8e('0x5'),_0xdc8e('0x6'),'motionbar',_0xdc8e('0x7'),_0xdc8e('0x8'),'browser',_0xdc8e('0x9'),_0xdc8e('0xa')]],'msg':_0xdc8e('0xb')}},'comment':_0xdc8e('0xb')},'data1':{'type':Sequelize[_0xdc8e('0xc')](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[_0xdc8e('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xdc8e('0xc')](0x1000),'comment':_0xdc8e('0xd')},'data4':{'type':Sequelize[_0xdc8e('0xc')](0x1000),'comments':_0xdc8e('0xe')},'data5':{'type':Sequelize[_0xdc8e('0xc')](0x1000),'comments':_0xdc8e('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0xdc8e('0x10')}}; \ No newline at end of file +var _0x3b6d=['exports','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x3b6d,0xd2));var _0xd3b6=function(_0x5ce7d7,_0x304af4){_0x5ce7d7=_0x5ce7d7-0x0;var _0x42a5e0=_0x3b6d[_0x5ce7d7];return _0x42a5e0;};'use strict';var Sequelize=require('sequelize');module[_0xd3b6('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5244ee){return this['getDataValue'](_0xd3b6('0x1'));}},'action':{'type':Sequelize[_0xd3b6('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd3b6('0x3'),'integration',_0xd3b6('0x4'),_0xd3b6('0x5'),_0xd3b6('0x6'),_0xd3b6('0x7'),_0xd3b6('0x8'),_0xd3b6('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xd3b6('0xa')},'data1':{'type':Sequelize[_0xd3b6('0x2')](0x1000),'comment':_0xd3b6('0xb')},'data2':{'type':Sequelize[_0xd3b6('0x2')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xd3b6('0x2')](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[_0xd3b6('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xd3b6('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xd3b6('0xc')},'data7':{'type':Sequelize[_0xd3b6('0xd')],'comments':_0xd3b6('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 43e1cf9..efc1c02 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 _0xdc8d=['then','catch','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','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','sendStatus','offset','limit','undefined','count','status','set','json','apply','reject','save','destroy','end','stack','name','send','update','body','Action','find'];(function(_0x4354d3,_0x59d9b5){var _0x515f78=function(_0x519719){while(--_0x519719){_0x4354d3['push'](_0x4354d3['shift']());}};_0x515f78(++_0x59d9b5);}(_0xdc8d,0xbb));var _0xddc8=function(_0x38514a,_0x3a97c0){_0x38514a=_0x38514a-0x0;var _0x5d68ee=_0xdc8d[_0x38514a];return _0x5d68ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddc8('0x0'));var zipdir=require(_0xddc8('0x1'));var jsonpatch=require(_0xddc8('0x2'));var rp=require('request-promise');var moment=require(_0xddc8('0x3'));var BPromise=require(_0xddc8('0x4'));var Mustache=require('mustache');var util=require(_0xddc8('0x5'));var path=require('path');var sox=require(_0xddc8('0x6'));var csv=require(_0xddc8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddc8('0x8'));var _=require('lodash');var squel=require(_0xddc8('0x9'));var crypto=require('crypto');var jsforce=require(_0xddc8('0xa'));var deskjs=require(_0xddc8('0xb'));var toCsv=require(_0xddc8('0x7'));var querystring=require(_0xddc8('0xc'));var Papa=require(_0xddc8('0xd'));var Redis=require('ioredis');var authService=require(_0xddc8('0xe'));var qs=require(_0xddc8('0xf'));var as=require(_0xddc8('0x10'));var hardwareService=require(_0xddc8('0x11'));var logger=require(_0xddc8('0x12'))(_0xddc8('0x13'));var utils=require(_0xddc8('0x14'));var config=require(_0xddc8('0x15'));var licenseUtil=require(_0xddc8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5580b2,_0x4cd7f5){_0x4cd7f5=_0x4cd7f5||0xcc;return function(_0x2e3063){if(_0x2e3063){return _0x5580b2[_0xddc8('0x17')](_0x4cd7f5);}return _0x5580b2['status'](_0x4cd7f5)['end']();};}function respondWithResult(_0x5681a9,_0xf083e6){_0xf083e6=_0xf083e6||0xc8;return function(_0x3a03f7){if(_0x3a03f7){return _0x5681a9['status'](_0xf083e6)['json'](_0x3a03f7);}};}function respondWithFilteredResult(_0x4be9ad,_0x2a2244){return function(_0x5a79a7){if(_0x5a79a7){var _0x2d461e=typeof _0x2a2244[_0xddc8('0x18')]==='undefined'&&typeof _0x2a2244[_0xddc8('0x19')]===_0xddc8('0x1a');var _0x1feec8=_0x5a79a7[_0xddc8('0x1b')];var _0x522f9f=_0x2d461e?0x0:_0x2a2244[_0xddc8('0x18')];var _0x304adf=_0x2d461e?_0x5a79a7[_0xddc8('0x1b')]:_0x2a2244[_0xddc8('0x18')]+_0x2a2244['limit'];var _0x6d9faa;if(_0x304adf>=_0x1feec8){_0x304adf=_0x1feec8;_0x6d9faa=0xc8;}else{_0x6d9faa=0xce;}_0x4be9ad[_0xddc8('0x1c')](_0x6d9faa);return _0x4be9ad[_0xddc8('0x1d')]('Content-Range',_0x522f9f+'-'+_0x304adf+'/'+_0x1feec8)[_0xddc8('0x1e')](_0x5a79a7);}return null;};}function patchUpdates(_0x1358ce){return function(_0x5a1977){try{jsonpatch[_0xddc8('0x1f')](_0x5a1977,_0x1358ce,!![]);}catch(_0x1f0c25){return BPromise[_0xddc8('0x20')](_0x1f0c25);}return _0x5a1977[_0xddc8('0x21')]();};}function saveUpdates(_0x483522,_0x301fe2){return function(_0x552309){if(_0x552309){return _0x552309['update'](_0x483522)['then'](function(_0x2cfb5c){return _0x2cfb5c;});}return null;};}function removeEntity(_0x1de5f7,_0x188f02){return function(_0xd09779){if(_0xd09779){return _0xd09779[_0xddc8('0x22')]()['then'](function(){_0x1de5f7['status'](0xcc)[_0xddc8('0x23')]();});}};}function handleEntityNotFound(_0x20ac20,_0x30cf43){return function(_0x40407a){if(!_0x40407a){_0x20ac20['sendStatus'](0x194);}return _0x40407a;};}function handleError(_0x2dec27,_0x414ad0){_0x414ad0=_0x414ad0||0x1f4;return function(_0x13ecaf){logger['error'](_0x13ecaf[_0xddc8('0x24')]);if(_0x13ecaf[_0xddc8('0x25')]){delete _0x13ecaf[_0xddc8('0x25')];}_0x2dec27[_0xddc8('0x1c')](_0x414ad0)[_0xddc8('0x26')](_0x13ecaf);};}exports[_0xddc8('0x27')]=function(_0xe9b0ef,_0x3fc739){if(_0xe9b0ef['body']['id']){delete _0xe9b0ef[_0xddc8('0x28')]['id'];}return db[_0xddc8('0x29')][_0xddc8('0x2a')]({'where':{'id':_0xe9b0ef['params']['id']}})['then'](handleEntityNotFound(_0x3fc739,null))['then'](saveUpdates(_0xe9b0ef['body'],null))[_0xddc8('0x2b')](respondWithResult(_0x3fc739,null))[_0xddc8('0x2c')](handleError(_0x3fc739,null));};exports[_0xddc8('0x22')]=function(_0x679cc5,_0x193f2f){return db[_0xddc8('0x29')][_0xddc8('0x2a')]({'where':{'id':_0x679cc5[_0xddc8('0x2d')]['id']}})[_0xddc8('0x2b')](handleEntityNotFound(_0x193f2f,null))[_0xddc8('0x2b')](removeEntity(_0x193f2f,null))['catch'](handleError(_0x193f2f,null));}; \ No newline at end of file +var _0x0804=['zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','reject','update','destroy','name','send','body','Action','find','params','then','catch'];(function(_0x2311dc,_0x3e0d56){var _0x11836c=function(_0xf4cc4d){while(--_0xf4cc4d){_0x2311dc['push'](_0x2311dc['shift']());}};_0x11836c(++_0x3e0d56);}(_0x0804,0x150));var _0x4080=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x0804[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4080('0x0'));var jsonpatch=require(_0x4080('0x1'));var rp=require('request-promise');var moment=require(_0x4080('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4080('0x3'));var util=require(_0x4080('0x4'));var path=require('path');var sox=require(_0x4080('0x5'));var csv=require(_0x4080('0x6'));var ejs=require(_0x4080('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4080('0x8'));var squel=require(_0x4080('0x9'));var crypto=require('crypto');var jsforce=require(_0x4080('0xa'));var deskjs=require(_0x4080('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4080('0xc'));var Papa=require('papaparse');var Redis=require(_0x4080('0xd'));var authService=require(_0x4080('0xe'));var qs=require(_0x4080('0xf'));var as=require(_0x4080('0x10'));var hardwareService=require(_0x4080('0x11'));var logger=require(_0x4080('0x12'))(_0x4080('0x13'));var utils=require(_0x4080('0x14'));var config=require(_0x4080('0x15'));var licenseUtil=require(_0x4080('0x16'));var db=require(_0x4080('0x17'))['db'];function respondWithStatusCode(_0x3f12a8,_0x3e8098){_0x3e8098=_0x3e8098||0xcc;return function(_0x3aef08){if(_0x3aef08){return _0x3f12a8[_0x4080('0x18')](_0x3e8098);}return _0x3f12a8['status'](_0x3e8098)['end']();};}function respondWithResult(_0x572d24,_0x56811b){_0x56811b=_0x56811b||0xc8;return function(_0x37e51d){if(_0x37e51d){return _0x572d24[_0x4080('0x19')](_0x56811b)['json'](_0x37e51d);}};}function respondWithFilteredResult(_0x49326e,_0x28abab){return function(_0x233391){if(_0x233391){var _0x4d0f10=typeof _0x28abab[_0x4080('0x1a')]===_0x4080('0x1b')&&typeof _0x28abab['limit']===_0x4080('0x1b');var _0x37344b=_0x233391[_0x4080('0x1c')];var _0x5c98e2=_0x4d0f10?0x0:_0x28abab[_0x4080('0x1a')];var _0x4adbaa=_0x4d0f10?_0x233391[_0x4080('0x1c')]:_0x28abab[_0x4080('0x1a')]+_0x28abab['limit'];var _0x20ddcd;if(_0x4adbaa>=_0x37344b){_0x4adbaa=_0x37344b;_0x20ddcd=0xc8;}else{_0x20ddcd=0xce;}_0x49326e[_0x4080('0x19')](_0x20ddcd);return _0x49326e['set'](_0x4080('0x1d'),_0x5c98e2+'-'+_0x4adbaa+'/'+_0x37344b)[_0x4080('0x1e')](_0x233391);}return null;};}function patchUpdates(_0x30034b){return function(_0x210e6f){try{jsonpatch['apply'](_0x210e6f,_0x30034b,!![]);}catch(_0x38600d){return BPromise[_0x4080('0x1f')](_0x38600d);}return _0x210e6f['save']();};}function saveUpdates(_0x1a01d1,_0x1130ed){return function(_0x43d8ef){if(_0x43d8ef){return _0x43d8ef[_0x4080('0x20')](_0x1a01d1)['then'](function(_0x5b556f){return _0x5b556f;});}return null;};}function removeEntity(_0x536714,_0x391b38){return function(_0x34ce24){if(_0x34ce24){return _0x34ce24[_0x4080('0x21')]()['then'](function(){_0x536714[_0x4080('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c198d,_0x23f3cf){return function(_0x24c9e7){if(!_0x24c9e7){_0x1c198d[_0x4080('0x18')](0x194);}return _0x24c9e7;};}function handleError(_0x56de50,_0x2c448e){_0x2c448e=_0x2c448e||0x1f4;return function(_0x808934){logger['error'](_0x808934['stack']);if(_0x808934[_0x4080('0x22')]){delete _0x808934[_0x4080('0x22')];}_0x56de50[_0x4080('0x19')](_0x2c448e)[_0x4080('0x23')](_0x808934);};}exports['update']=function(_0x5b44ec,_0x5e1c23){if(_0x5b44ec[_0x4080('0x24')]['id']){delete _0x5b44ec[_0x4080('0x24')]['id'];}return db[_0x4080('0x25')][_0x4080('0x26')]({'where':{'id':_0x5b44ec[_0x4080('0x27')]['id']}})['then'](handleEntityNotFound(_0x5e1c23,null))[_0x4080('0x28')](saveUpdates(_0x5b44ec[_0x4080('0x24')],null))[_0x4080('0x28')](respondWithResult(_0x5e1c23,null))[_0x4080('0x29')](handleError(_0x5e1c23,null));};exports['destroy']=function(_0x3f264b,_0x4aa68d){return db[_0x4080('0x25')][_0x4080('0x26')]({'where':{'id':_0x3f264b[_0x4080('0x27')]['id']}})[_0x4080('0x28')](handleEntityNotFound(_0x4aa68d,null))[_0x4080('0x28')](removeEntity(_0x4aa68d,null))[_0x4080('0x29')](handleError(_0x4aa68d,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 32b5a37..4065ef0 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 _0xffee=['rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11c4fa,_0x3d68f0){var _0x12e9aa=function(_0x417aa1){while(--_0x417aa1){_0x11c4fa['push'](_0x11c4fa['shift']());}};_0x12e9aa(++_0x3d68f0);}(_0xffee,0x131));var _0xeffe=function(_0x430c62,_0x129472){_0x430c62=_0x430c62-0x0;var _0x4ec150=_0xffee[_0x430c62];return _0x4ec150;};'use strict';var _=require(_0xeffe('0x0'));var util=require('util');var logger=require(_0xeffe('0x1'))(_0xeffe('0x2'));var moment=require(_0xeffe('0x3'));var BPromise=require(_0xeffe('0x4'));var rp=require(_0xeffe('0x5'));var fs=require('fs');var path=require(_0xeffe('0x6'));var rimraf=require(_0xeffe('0x7'));var config=require(_0xeffe('0x8'));var attributes=require(_0xeffe('0x9'));module['exports']=function(_0xd870cf,_0x542835){return _0xd870cf['define'](_0xeffe('0xa'),attributes,{'tableName':_0xeffe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ec=['define','Action','tools_actions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x4aabc6,_0x348818){var _0xf26471=function(_0x1416c6){while(--_0x1416c6){_0x4aabc6['push'](_0x4aabc6['shift']());}};_0xf26471(++_0x348818);}(_0xc1ec,0x117));var _0xcc1e=function(_0x58f207,_0x564979){_0x58f207=_0x58f207-0x0;var _0x1c025a=_0xc1ec[_0x58f207];return _0x1c025a;};'use strict';var _=require(_0xcc1e('0x0'));var util=require(_0xcc1e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc1e('0x2'));var BPromise=require(_0xcc1e('0x3'));var rp=require(_0xcc1e('0x4'));var fs=require('fs');var path=require(_0xcc1e('0x5'));var rimraf=require(_0xcc1e('0x6'));var config=require(_0xcc1e('0x7'));var attributes=require(_0xcc1e('0x8'));module['exports']=function(_0x42ca26,_0x37af1d){return _0x42ca26[_0xcc1e('0x9')](_0xcc1e('0xa'),attributes,{'tableName':_0xcc1e('0xb'),'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 46d183d..25cc3d1 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 _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(_0x4e6bd8,_0x3de9c1){var _0x1b5877=function(_0x266955){while(--_0x266955){_0x4e6bd8['push'](_0x4e6bd8['shift']());}};_0x1b5877(++_0x3de9c1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x5fc3[_0x5948dd];return _0xb1f8be;};'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 +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x550f06,_0x47162d){var _0x2c352d=function(_0x1b02b5){while(--_0x1b02b5){_0x550f06['push'](_0x550f06['shift']());}};_0x2c352d(++_0x47162d);}(_0x1261,0x144));var _0x1126=function(_0x20a590,_0x1e8a6d){_0x20a590=_0x20a590-0x0;var _0x2e1b41=_0x1261[_0x20a590];return _0x2e1b41;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2bdb5c6..4dca5f6 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 _0x6f73=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','/:id','isAuthenticated','update'];(function(_0x11df96,_0x549a45){var _0x5d3015=function(_0x52f2f6){while(--_0x52f2f6){_0x11df96['push'](_0x11df96['shift']());}};_0x5d3015(++_0x549a45);}(_0x6f73,0x85));var _0x36f7=function(_0x565ba6,_0x49b8f8){_0x565ba6=_0x565ba6-0x0;var _0xf0f461=_0x6f73[_0x565ba6];return _0xf0f461;};'use strict';var multer=require(_0x36f7('0x0'));var util=require(_0x36f7('0x1'));var path=require('path');var timeout=require(_0x36f7('0x2'));var express=require(_0x36f7('0x3'));var router=express[_0x36f7('0x4')]();var fs_extra=require(_0x36f7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x36f7('0x6'));var controller=require(_0x36f7('0x7'));router['put'](_0x36f7('0x8'),auth[_0x36f7('0x9')](),controller[_0x36f7('0xa')]);router[_0x36f7('0xb')]('/:id',auth[_0x36f7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe972=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','delete','isAuthenticated','exports','multer'];(function(_0x36b59c,_0x4b4c30){var _0x156bbe=function(_0x58d2e9){while(--_0x58d2e9){_0x36b59c['push'](_0x36b59c['shift']());}};_0x156bbe(++_0x4b4c30);}(_0xe972,0x9b));var _0x2e97=function(_0xcdeada,_0x35a8c4){_0xcdeada=_0xcdeada-0x0;var _0x378843=_0xe972[_0xcdeada];return _0x378843;};'use strict';var multer=require(_0x2e97('0x0'));var util=require(_0x2e97('0x1'));var path=require('path');var timeout=require(_0x2e97('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e97('0x3'));var auth=require(_0x2e97('0x4'));var interaction=require(_0x2e97('0x5'));var config=require(_0x2e97('0x6'));var controller=require(_0x2e97('0x7'));router[_0x2e97('0x8')](_0x2e97('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x2e97('0xa')](_0x2e97('0x9'),auth[_0x2e97('0xb')](),controller['destroy']);module[_0x2e97('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 b0d9543..df94f24 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x127f3f,_0x3eb1f4){var _0x1e4c40=function(_0x470300){while(--_0x470300){_0x127f3f['push'](_0x127f3f['shift']());}};_0x1e4c40(++_0x3eb1f4);}(_0x6f47,0xc7));var _0x76f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6f47[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x7da7[_0x3c04ef];return _0x6a3a69;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a66e31b..1842f9d 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 _0xfe53=['runReport','debug','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','index','map','AnalyticCustomReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','SEC_TO_TIME(%s)','operator','field','AnalyticMetric','format','output','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../files/reports','savename','select','countTable','COUNT(*)','run'];(function(_0x244207,_0x2995b8){var _0x7e31c=function(_0x3474e9){while(--_0x3474e9){_0x244207['push'](_0x244207['shift']());}};_0x7e31c(++_0x2995b8);}(_0xfe53,0x146));var _0x3fe5=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xfe53[_0x516927];return _0x30749b;};'use strict';var emlformat=require(_0x3fe5('0x0'));var rimraf=require(_0x3fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fe5('0x2'));var rp=require(_0x3fe5('0x3'));var moment=require(_0x3fe5('0x4'));var BPromise=require(_0x3fe5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3fe5('0x6'));var ejs=require(_0x3fe5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fe5('0x8'));var squel=require(_0x3fe5('0x9'));var crypto=require('crypto');var jsforce=require(_0x3fe5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3fe5('0x6'));var querystring=require(_0x3fe5('0xb'));var Papa=require(_0x3fe5('0xc'));var Redis=require(_0x3fe5('0xd'));var authService=require(_0x3fe5('0xe'));var qs=require(_0x3fe5('0xf'));var as=require(_0x3fe5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fe5('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3fe5('0x12'));var licenseUtil=require(_0x3fe5('0x13'));var db=require(_0x3fe5('0x14'))['db'];var dbH=require(_0x3fe5('0x14'))[_0x3fe5('0x15')];function respondWithStatusCode(_0x595e72,_0x22a3d6){_0x22a3d6=_0x22a3d6||0xcc;return function(_0xd5b83e){if(_0xd5b83e){return _0x595e72['sendStatus'](_0x22a3d6);}return _0x595e72[_0x3fe5('0x16')](_0x22a3d6)['end']();};}function respondWithResult(_0x457988,_0x11e82e){_0x11e82e=_0x11e82e||0xc8;return function(_0x1e82b0){if(_0x1e82b0){return _0x457988[_0x3fe5('0x16')](_0x11e82e)[_0x3fe5('0x17')](_0x1e82b0);}};}function respondWithFilteredResult(_0x3a5622,_0x39b354){return function(_0x3f9409){if(_0x3f9409){var _0x55f58f=typeof _0x39b354[_0x3fe5('0x18')]===_0x3fe5('0x19')&&typeof _0x39b354['limit']==='undefined';var _0xaf6d38=_0x3f9409[_0x3fe5('0x1a')];var _0x517cf3=_0x55f58f?0x0:_0x39b354[_0x3fe5('0x18')];var _0x48bf03=_0x55f58f?_0x3f9409[_0x3fe5('0x1a')]:_0x39b354[_0x3fe5('0x18')]+_0x39b354[_0x3fe5('0x1b')];var _0xc4e55b;if(_0x48bf03>=_0xaf6d38){_0x48bf03=_0xaf6d38;_0xc4e55b=0xc8;}else{_0xc4e55b=0xce;}_0x3a5622['status'](_0xc4e55b);return _0x3a5622[_0x3fe5('0x1c')](_0x3fe5('0x1d'),_0x517cf3+'-'+_0x48bf03+'/'+_0xaf6d38)['json'](_0x3f9409);}return null;};}function patchUpdates(_0x56675c){return function(_0x58a8bc){try{jsonpatch[_0x3fe5('0x1e')](_0x58a8bc,_0x56675c,!![]);}catch(_0x5a39b9){return BPromise['reject'](_0x5a39b9);}return _0x58a8bc['save']();};}function saveUpdates(_0x20827b,_0x23ff20){return function(_0x3b4d0c){if(_0x3b4d0c){return _0x3b4d0c[_0x3fe5('0x1f')](_0x20827b)[_0x3fe5('0x20')](function(_0x37a453){return _0x37a453;});}return null;};}function removeEntity(_0x1ae1ee,_0x4b98c4){return function(_0x19eca8){if(_0x19eca8){return _0x19eca8[_0x3fe5('0x21')]()[_0x3fe5('0x20')](function(){var _0x1b71a8=_0x19eca8['get']({'plain':!![]});var _0x28e2d9='CustomReports';return db['UserProfileResource'][_0x3fe5('0x21')]({'where':{'type':_0x28e2d9,'resourceId':_0x1b71a8['id']}})[_0x3fe5('0x20')](function(){return _0x19eca8;});})[_0x3fe5('0x20')](function(){_0x1ae1ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd081b2,_0x213014){return function(_0x5e010a){if(!_0x5e010a){_0xd081b2[_0x3fe5('0x22')](0x194);}return _0x5e010a;};}function handleError(_0x4d5d74,_0x381eb8){_0x381eb8=_0x381eb8||0x1f4;return function(_0x523c8f){logger['error'](_0x523c8f[_0x3fe5('0x23')]);if(_0x523c8f[_0x3fe5('0x24')]){delete _0x523c8f['name'];}_0x4d5d74[_0x3fe5('0x16')](_0x381eb8)['send'](_0x523c8f);};}exports[_0x3fe5('0x25')]=function(_0x220e2c,_0x160975){var _0x3fda2e={},_0x11cd2b={},_0x5c2694={'count':0x0,'rows':[]};var _0x13314d=_[_0x3fe5('0x26')](db[_0x3fe5('0x27')][_0x3fe5('0x28')],function(_0x4828fb){return{'name':_0x4828fb['fieldName'],'type':_0x4828fb[_0x3fe5('0x29')][_0x3fe5('0x2a')]};});_0x11cd2b[_0x3fe5('0x2b')]=_[_0x3fe5('0x26')](_0x13314d,_0x3fe5('0x24'));_0x11cd2b['query']=_[_0x3fe5('0x2c')](_0x220e2c[_0x3fe5('0x2d')]);_0x11cd2b['filters']=_['intersection'](_0x11cd2b[_0x3fe5('0x2b')],_0x11cd2b['query']);_0x3fda2e[_0x3fe5('0x2e')]=_[_0x3fe5('0x2f')](_0x11cd2b['model'],qs[_0x3fe5('0x30')](_0x220e2c['query'][_0x3fe5('0x30')]));_0x3fda2e[_0x3fe5('0x2e')]=_0x3fda2e['attributes']['length']?_0x3fda2e[_0x3fe5('0x2e')]:_0x11cd2b[_0x3fe5('0x2b')];if(!_0x220e2c[_0x3fe5('0x2d')][_0x3fe5('0x31')](_0x3fe5('0x32'))){_0x3fda2e['limit']=qs[_0x3fe5('0x1b')](_0x220e2c['query'][_0x3fe5('0x1b')]);_0x3fda2e[_0x3fe5('0x18')]=qs[_0x3fe5('0x18')](_0x220e2c['query']['offset']);}_0x3fda2e[_0x3fe5('0x33')]=qs[_0x3fe5('0x34')](_0x220e2c[_0x3fe5('0x2d')][_0x3fe5('0x34')]);_0x3fda2e[_0x3fe5('0x35')]=qs[_0x3fe5('0x36')](_[_0x3fe5('0x37')](_0x220e2c[_0x3fe5('0x2d')],_0x11cd2b[_0x3fe5('0x36')]),_0x13314d);if(_0x220e2c[_0x3fe5('0x2d')][_0x3fe5('0x38')]){_0x3fda2e[_0x3fe5('0x35')]=_[_0x3fe5('0x39')](_0x3fda2e[_0x3fe5('0x35')],{'$or':_[_0x3fe5('0x26')](_0x13314d,function(_0x1d6751){if(_0x1d6751[_0x3fe5('0x29')]!==_0x3fe5('0x3a')){var _0x393af3={};_0x393af3[_0x1d6751[_0x3fe5('0x24')]]={'$like':'%'+_0x220e2c[_0x3fe5('0x2d')][_0x3fe5('0x38')]+'%'};return _0x393af3;}})});}_0x3fda2e=_['merge']({},_0x3fda2e,_0x220e2c[_0x3fe5('0x3b')]);var _0x3b402d={'where':_0x3fda2e[_0x3fe5('0x35')]};return db[_0x3fe5('0x27')][_0x3fe5('0x1a')](_0x3b402d)[_0x3fe5('0x20')](function(_0x948a13){_0x5c2694[_0x3fe5('0x1a')]=_0x948a13;if(_0x220e2c[_0x3fe5('0x2d')][_0x3fe5('0x3c')]){_0x3fda2e[_0x3fe5('0x3d')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x3fda2e);})[_0x3fe5('0x20')](function(_0x1f8345){_0x5c2694[_0x3fe5('0x3e')]=_0x1f8345;return _0x5c2694;})[_0x3fe5('0x20')](respondWithFilteredResult(_0x160975,_0x3fda2e))['catch'](handleError(_0x160975,null));};exports[_0x3fe5('0x3f')]=function(_0x9e532e,_0x1f1385){var _0x229686={'raw':![],'where':{'id':_0x9e532e[_0x3fe5('0x40')]['id']}},_0x3851dd={};_0x3851dd[_0x3fe5('0x2b')]=_[_0x3fe5('0x2c')](db['AnalyticCustomReport'][_0x3fe5('0x28')]);_0x3851dd['query']=_[_0x3fe5('0x2c')](_0x9e532e[_0x3fe5('0x2d')]);_0x3851dd['filters']=_[_0x3fe5('0x2f')](_0x3851dd[_0x3fe5('0x2b')],_0x3851dd['query']);_0x229686[_0x3fe5('0x2e')]=_['intersection'](_0x3851dd[_0x3fe5('0x2b')],qs[_0x3fe5('0x30')](_0x9e532e[_0x3fe5('0x2d')][_0x3fe5('0x30')]));_0x229686[_0x3fe5('0x2e')]=_0x229686['attributes'][_0x3fe5('0x41')]?_0x229686[_0x3fe5('0x2e')]:_0x3851dd[_0x3fe5('0x2b')];if(_0x9e532e[_0x3fe5('0x2d')][_0x3fe5('0x3c')]){_0x229686[_0x3fe5('0x3d')]=[{'all':!![]}];}_0x229686=_[_0x3fe5('0x39')]({},_0x229686,_0x9e532e['options']);return db[_0x3fe5('0x27')][_0x3fe5('0x42')](_0x229686)[_0x3fe5('0x20')](handleEntityNotFound(_0x1f1385,null))[_0x3fe5('0x20')](respondWithResult(_0x1f1385,null))['catch'](handleError(_0x1f1385,null));};exports['create']=function(_0xffa83,_0x524373){return db[_0x3fe5('0x27')][_0x3fe5('0x43')](_0xffa83[_0x3fe5('0x44')],{})['then'](function(_0x33e53d){var _0x1b479d=_0xffa83['user'][_0x3fe5('0x45')]({'plain':!![]});if(!_0x1b479d)throw new Error(_0x3fe5('0x46'));if(_0x1b479d['role']===_0x3fe5('0x47')){var _0x295200=_0x33e53d[_0x3fe5('0x45')]({'plain':!![]});var _0x548a72=_0x3fe5('0x48');return db[_0x3fe5('0x49')][_0x3fe5('0x42')]({'where':{'name':_0x548a72,'userProfileId':_0x1b479d[_0x3fe5('0x4a')]},'raw':!![]})['then'](function(_0x263b74){if(_0x263b74&&_0x263b74[_0x3fe5('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x295200[_0x3fe5('0x24')],'resourceId':_0x295200['id'],'type':_0x3fe5('0x4c'),'sectionId':_0x263b74['id']},{})['then'](function(){return _0x33e53d;});}else{return _0x33e53d;}})['catch'](function(_0x2451b8){logger[_0x3fe5('0x4d')](_0x3fe5('0x4e'),_0x2451b8);throw _0x2451b8;});}return _0x33e53d;})[_0x3fe5('0x20')](respondWithResult(_0x524373,0xc9))[_0x3fe5('0x4f')](handleError(_0x524373,null));};exports[_0x3fe5('0x1f')]=function(_0x216671,_0x31a9d8){if(_0x216671[_0x3fe5('0x44')]['id']){delete _0x216671[_0x3fe5('0x44')]['id'];}return db[_0x3fe5('0x27')][_0x3fe5('0x42')]({'where':{'id':_0x216671['params']['id']}})['then'](handleEntityNotFound(_0x31a9d8,null))['then'](saveUpdates(_0x216671[_0x3fe5('0x44')],null))[_0x3fe5('0x20')](respondWithResult(_0x31a9d8,null))[_0x3fe5('0x4f')](handleError(_0x31a9d8,null));};exports[_0x3fe5('0x21')]=function(_0xd6c261,_0x1c846e){return db[_0x3fe5('0x27')][_0x3fe5('0x42')]({'where':{'id':_0xd6c261[_0x3fe5('0x40')]['id']}})[_0x3fe5('0x20')](handleEntityNotFound(_0x1c846e,null))[_0x3fe5('0x20')](removeEntity(_0x1c846e,null))[_0x3fe5('0x4f')](handleError(_0x1c846e,null));};exports[_0x3fe5('0x50')]=function(_0x2c4be8,_0x38f842){var _0x14110e=0xa;var _0x298528=[_0x3fe5('0x51'),_0x3fe5('0x52'),_0x3fe5('0x53'),_0x3fe5('0x54')];var _0x2431b6={'SUM':_0x3fe5('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3fe5('0x56'),'MAX':_0x3fe5('0x57'),'MIN':_0x3fe5('0x58'),'AVG':_0x3fe5('0x59'),'GROUP_CONCAT':_0x3fe5('0x5a'),'GROUP_CONCAT ASC':_0x3fe5('0x5b'),'GROUP_CONCAT DESC':_0x3fe5('0x5c')};var _0x12e23e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3fe5('0x5d'),'HOUR':_0x3fe5('0x5e'),'ROUND':_0x3fe5('0x5f'),'UNIX_TIMESTAMP':_0x3fe5('0x60')};var _0x150b3b=function(_0x5631db){return!_[_0x3fe5('0x61')]([_0x3fe5('0x62'),_0x3fe5('0x63'),_0x3fe5('0x64'),_0x3fe5('0x65')],_0x5631db);};var _0x41d71d=function(_0x26e221){if(!_0x26e221||!_0x26e221['rules']['length']){return'';}for(var _0xd2a24f='(',_0x5371cc=0x0;_0x5371cc<_0x26e221[_0x3fe5('0x66')][_0x3fe5('0x41')];_0x5371cc+=0x1){_0x5371cc>0x0&&(_0xd2a24f+='\x20'+_0x26e221['operator']+'\x20');_0xd2a24f+=_0x26e221[_0x3fe5('0x66')][_0x5371cc]['group']?_0x41d71d(_0x26e221[_0x3fe5('0x66')][_0x5371cc][_0x3fe5('0x67')]):_0x26e221[_0x3fe5('0x66')][_0x5371cc]['field']+'\x20'+_0x26e221[_0x3fe5('0x66')][_0x5371cc]['condition']+(_0x150b3b(_0x26e221[_0x3fe5('0x66')][_0x5371cc][_0x3fe5('0x68')])?'\x20'+_0x26e221[_0x3fe5('0x66')][_0x5371cc]['value']:'');}return _0xd2a24f+')';};var _0x1ec3c7={'where':{'id':_0x2c4be8[_0x3fe5('0x40')]['id']}},_0xb978fb,_0x18c7e2,_0x4754cb,_0x2394ec,_0x2ba8bb;_0x1ec3c7=_[_0x3fe5('0x39')]({},_0x1ec3c7,_0x2c4be8[_0x3fe5('0x3b')]);return db[_0x3fe5('0x27')][_0x3fe5('0x42')](_0x1ec3c7)[_0x3fe5('0x20')](function(_0x3c2a30){if(_0x3c2a30){_0xb978fb=_0x3c2a30;return _0x3c2a30[_0x3fe5('0x69')]();}return null;})[_0x3fe5('0x20')](function(_0x222ab6){if(_0x222ab6){if(!_0x222ab6[_0x3fe5('0x41')]){throw new db[(_0x3fe5('0x6a'))][(_0x3fe5('0x6b'))](_0x3fe5('0x6c'),0x193);}_0x18c7e2=_0x222ab6;return db['AnalyticMetric'][_0x3fe5('0x6d')]({'raw':!![]});}return null;})[_0x3fe5('0x20')](function(_0x5326f6){if(_0x5326f6){_0x4754cb=_[_0x3fe5('0x6e')](_0x5326f6,'id');var _0x31f57e;var _0x23dec5=squel['select']();_0x23dec5[_0x3fe5('0x6f')](_0xb978fb[_0x3fe5('0x70')]);for(var _0x57f23f=0x0;_0x57f23f<_0x18c7e2['length'];_0x57f23f+=0x1){_0x31f57e=_0x18c7e2[_0x57f23f][_0x3fe5('0x71')]?_0x4754cb[_0x18c7e2[_0x57f23f][_0x3fe5('0x71')]][_0x3fe5('0x72')]:_0x18c7e2[_0x57f23f]['field'];_0x31f57e=_0x18c7e2[_0x57f23f][_0x3fe5('0x73')]?_[_0x3fe5('0x74')](_0x2431b6[_0x18c7e2[_0x57f23f][_0x3fe5('0x73')]],'%s',_0x31f57e):_0x31f57e;_0x31f57e=_0x18c7e2[_0x57f23f]['format']?_[_0x3fe5('0x74')](_0x12e23e[_0x18c7e2[_0x57f23f]['format']],'%s',_0x31f57e):_0x31f57e;if(_0x18c7e2[_0x57f23f][_0x3fe5('0x75')]){_0x23dec5['group'](_0x31f57e);}_0x18c7e2[_0x57f23f][_0x3fe5('0x76')]&&_0x23dec5[_0x3fe5('0x33')](_0x31f57e,_0x18c7e2[_0x57f23f][_0x3fe5('0x76')]===_0x3fe5('0x77')?![]:!![]);_0x23dec5['field'](_0x31f57e,_0x18c7e2[_0x57f23f][_0x3fe5('0x78')]||_0x31f57e);}if(_0xb978fb['joins']){_0xb978fb[_0x3fe5('0x79')]=JSON[_0x3fe5('0x7a')](_0xb978fb[_0x3fe5('0x79')]);for(var _0x42c9fd=0x0;_0x42c9fd<_0xb978fb[_0x3fe5('0x79')][_0x3fe5('0x41')];_0x42c9fd+=0x1){if(_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x29')]&&_[_0x3fe5('0x61')](_0x298528,_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x29')])&&_0xb978fb['joins'][_0x42c9fd][_0x3fe5('0x7b')]&&_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x7c')]&&_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x7d')]){_0x23dec5[_0xb978fb['joins'][_0x42c9fd][_0x3fe5('0x29')]](_0xb978fb[_0x3fe5('0x79')][_0x42c9fd]['foreignTable'],null,util['format'](_0x3fe5('0x7e'),_0xb978fb['table'],_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x7b')],_0xb978fb['joins'][_0x42c9fd]['foreignTable'],_0xb978fb[_0x3fe5('0x79')][_0x42c9fd][_0x3fe5('0x7d')]));}}}if(_0xb978fb['conditions']){_0xb978fb[_0x3fe5('0x7f')]=JSON[_0x3fe5('0x7a')](_0xb978fb['conditions']);_0x23dec5[_0x3fe5('0x35')](_0x41d71d(_0xb978fb[_0x3fe5('0x7f')][_0x3fe5('0x67')]));}_0x2ba8bb=_0x23dec5[_0x3fe5('0x80')]();_0x23dec5[_0x3fe5('0x1b')](_0x14110e);_0x23dec5[_0x3fe5('0x18')](0x0);logger['debug'](_0x3fe5('0x81'),_0x23dec5[_0x3fe5('0x82')]());return dbH['sequelize'][_0x3fe5('0x2d')](_0x23dec5[_0x3fe5('0x82')](),{'type':dbH[_0x3fe5('0x83')][_0x3fe5('0x84')][_0x3fe5('0x85')]});}})[_0x3fe5('0x20')](respondWithResult(_0x38f842,null))[_0x3fe5('0x4f')](handleError(_0x38f842,null));};function runReport(_0x5ee2e9,_0xae1e2a,_0x21f322){var _0x4da436=_0xae1e2a['name'];var _0x412ab4=0xa;var _0x26089c=[_0x3fe5('0x51'),_0x3fe5('0x52'),'right_join','cross_join'];var _0x4084a4={'SUM':_0x3fe5('0x55'),'COUNT':_0x3fe5('0x86'),'COUNT DISTINCT':_0x3fe5('0x56'),'MAX':_0x3fe5('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x3fe5('0x5a'),'GROUP_CONCAT ASC':_0x3fe5('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x108bec={'SEC_TO_TIME':_0x3fe5('0x87'),'DATE':_0x3fe5('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x3fe5('0x5f'),'UNIX_TIMESTAMP':_0x3fe5('0x60')};var _0x1a65da=function(_0x34d679){return!_[_0x3fe5('0x61')](['IS\x20NULL',_0x3fe5('0x63'),'IS\x20EMPTY',_0x3fe5('0x65')],_0x34d679);};var _0x338acb=function(_0x28a74c){if(!_0x28a74c||!_0x28a74c[_0x3fe5('0x66')][_0x3fe5('0x41')]){return'';}for(var _0x196d8e='(',_0x4bdab6=0x0;_0x4bdab6<_0x28a74c[_0x3fe5('0x66')][_0x3fe5('0x41')];_0x4bdab6+=0x1){_0x4bdab6>0x0&&(_0x196d8e+='\x20'+_0x28a74c[_0x3fe5('0x88')]+'\x20');_0x196d8e+=_0x28a74c['rules'][_0x4bdab6][_0x3fe5('0x67')]?_0x338acb(_0x28a74c[_0x3fe5('0x66')][_0x4bdab6]['group']):_0x28a74c[_0x3fe5('0x66')][_0x4bdab6][_0x3fe5('0x89')]+'\x20'+_0x28a74c[_0x3fe5('0x66')][_0x4bdab6][_0x3fe5('0x68')]+(_0x1a65da(_0x28a74c[_0x3fe5('0x66')][_0x4bdab6][_0x3fe5('0x68')])?'\x20'+_0x28a74c['rules'][_0x4bdab6]['value']:'');}return _0x196d8e+')';};var _0x3baf3f={'where':{'id':_0x5ee2e9['id']}},_0x40b390,_0x4c6d11,_0x457584,_0x699ee7,_0x2a2db4;_0x3baf3f=_[_0x3fe5('0x39')]({},_0x3baf3f,_0x21f322);return db['AnalyticCustomReport'][_0x3fe5('0x42')](_0x3baf3f)['then'](function(_0x54ff50){if(_0x54ff50){_0x40b390=_0x54ff50;return _0x54ff50[_0x3fe5('0x69')]();}return null;})[_0x3fe5('0x20')](function(_0x58fef9){if(_0x58fef9){if(!_0x58fef9[_0x3fe5('0x41')]){throw new db[(_0x3fe5('0x6a'))]['ValidationErrorItem'](_0x3fe5('0x6c'),0x193);}_0x4c6d11=_0x58fef9;return db[_0x3fe5('0x8a')][_0x3fe5('0x6d')]({'raw':!![]});}return null;})[_0x3fe5('0x20')](function(_0x3df72c){if(_0x3df72c){_0x457584=_[_0x3fe5('0x6e')](_0x3df72c,'id');var _0x318499;var _0x3c974a=squel['select']();_0x3c974a['from'](_0x40b390['table']);for(var _0x501134=0x0;_0x501134<_0x4c6d11[_0x3fe5('0x41')];_0x501134+=0x1){_0x318499=_0x4c6d11[_0x501134][_0x3fe5('0x71')]?_0x457584[_0x4c6d11[_0x501134][_0x3fe5('0x71')]][_0x3fe5('0x72')]:_0x4c6d11[_0x501134][_0x3fe5('0x89')];_0x318499=_0x4c6d11[_0x501134][_0x3fe5('0x73')]?_[_0x3fe5('0x74')](_0x4084a4[_0x4c6d11[_0x501134][_0x3fe5('0x73')]],'%s',_0x318499):_0x318499;_0x318499=_0x4c6d11[_0x501134]['format']?_[_0x3fe5('0x74')](_0x108bec[_0x4c6d11[_0x501134][_0x3fe5('0x8b')]],'%s',_0x318499):_0x318499;if(_0x4c6d11[_0x501134]['groupBy']){_0x3c974a[_0x3fe5('0x67')](_0x318499);}_0x4c6d11[_0x501134][_0x3fe5('0x76')]&&_0x3c974a[_0x3fe5('0x33')](_0x318499,_0x4c6d11[_0x501134]['orderBy']===_0x3fe5('0x77')?![]:!![]);_0x3c974a[_0x3fe5('0x89')](_0x318499,_0x4c6d11[_0x501134][_0x3fe5('0x78')]||_0x318499);}if(_0x40b390[_0x3fe5('0x79')]){_0x40b390[_0x3fe5('0x79')]=JSON[_0x3fe5('0x7a')](_0x40b390[_0x3fe5('0x79')]);for(var _0x2daaaa=0x0;_0x2daaaa<_0x40b390[_0x3fe5('0x79')][_0x3fe5('0x41')];_0x2daaaa+=0x1){if(_0x40b390[_0x3fe5('0x79')][_0x2daaaa]['type']&&_[_0x3fe5('0x61')](_0x26089c,_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x29')])&&_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x7b')]&&_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x7c')]&&_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x7d')]){_0x3c974a[_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x29')]](_0x40b390[_0x3fe5('0x79')][_0x2daaaa]['foreignTable'],null,util[_0x3fe5('0x8b')](_0x3fe5('0x7e'),_0x40b390[_0x3fe5('0x70')],_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x7b')],_0x40b390[_0x3fe5('0x79')][_0x2daaaa][_0x3fe5('0x7c')],_0x40b390[_0x3fe5('0x79')][_0x2daaaa]['foreignKey']));}}}if(_0x40b390[_0x3fe5('0x7f')]){_0x40b390['conditions']=JSON[_0x3fe5('0x7a')](_0x40b390[_0x3fe5('0x7f')]);_0x3c974a['where'](_0x338acb(_0x40b390[_0x3fe5('0x7f')][_0x3fe5('0x67')]));}_0x2a2db4=_0x3c974a[_0x3fe5('0x80')]();_0x3c974a[_0x3fe5('0x1b')](_0x412ab4);_0x3c974a[_0x3fe5('0x18')](0x0);return;}})['then'](function(){if(_0xae1e2a[_0x3fe5('0x8c')]==='web'){return null;}var _0xdbdb88=_[_0x3fe5('0x39')](_0xae1e2a,{'name':_0xae1e2a['fullPath']||_0xae1e2a['name']||_0x40b390['name'],'basename':_0x4da436,'savename':util[_0x3fe5('0x8b')](_0x3fe5('0x8d'),_0xae1e2a[_0x3fe5('0x24')]||_0x40b390[_0x3fe5('0x24')],require('randomstring')[_0x3fe5('0x8e')](0x4),_0xae1e2a['output']||_0x3fe5('0x8f')),'reportId':_0x40b390['id'],'reportType':_0x3fe5('0x90')});return db[_0x3fe5('0x91')][_0x3fe5('0x43')](_0xdbdb88,{'raw':!![]});})['then'](function(_0x5e20a6){if(_0x40b390[_0x3fe5('0x70')]===_0x3fe5('0x92')){_0x2a2db4['where'](_0x40b390[_0x3fe5('0x70')]+_0x3fe5('0x93'),_0xae1e2a[_0x3fe5('0x94')],_0xae1e2a[_0x3fe5('0x95')]);}else{_0x2a2db4[_0x3fe5('0x35')](_0x40b390[_0x3fe5('0x70')]+_0x3fe5('0x96'),_0xae1e2a[_0x3fe5('0x94')],_0xae1e2a[_0x3fe5('0x95')]);}if(_0x5e20a6){logger[_0x3fe5('0x97')](_0x3fe5('0x98'),_0x2a2db4[_0x3fe5('0x82')]());require(_0x3fe5('0x99'))['fork'](path[_0x3fe5('0x51')](__dirname,'../../components/export/',_0x5e20a6[_0x3fe5('0x8c')]),[_0x5e20a6['id'],_0x2a2db4[_0x3fe5('0x82')](),path[_0x3fe5('0x51')](__dirname,_0x3fe5('0x9a'),_0x5e20a6[_0x3fe5('0x9b')]),_0x4da436]);return _0x5e20a6;}else{var _0x41b937=squel[_0x3fe5('0x9c')]();_0x41b937['from']('('+_0x2a2db4['toString']()+')',_0x3fe5('0x9d'));_0x41b937[_0x3fe5('0x89')](_0x3fe5('0x9e'),'count');_0x2a2db4[_0x3fe5('0x1b')](_0xae1e2a[_0x3fe5('0x1b')]||_0x412ab4);_0x2a2db4['offset'](_0xae1e2a[_0x3fe5('0x18')]||0x0);return dbH[_0x3fe5('0x83')][_0x3fe5('0x2d')](_0x41b937[_0x3fe5('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0x3fe5('0x85')]})[_0x3fe5('0x20')](function(_0x57a356){if(!_0x57a356[_0x3fe5('0x41')]){_0x699ee7=0x0;}else{_0x699ee7=_0x57a356[0x0][_0x3fe5('0x1a')]||0x0;}return dbH['sequelize'][_0x3fe5('0x2d')](_0x2a2db4[_0x3fe5('0x82')](),{'type':dbH['sequelize'][_0x3fe5('0x84')]['SELECT']});})[_0x3fe5('0x20')](function(_0x583ce3){return{'rows':_0x583ce3||[],'count':_0x699ee7};});}});}exports[_0x3fe5('0x9f')]=function(_0x12c750,_0x1ddc27){return runReport(_0x12c750['params'],_0x12c750['query'],_0x12c750[_0x3fe5('0x3b')])['then'](respondWithResult(_0x1ddc27,null))[_0x3fe5('0x4f')](handleError(_0x1ddc27,null));};exports[_0x3fe5('0xa0')]=runReport;exports[_0x3fe5('0x2d')]=function(_0x22d82d,_0x5a5173){var _0x1f9f4c=0xa;var _0x11842f=[_0x3fe5('0x51'),_0x3fe5('0x52'),'right_join','cross_join'];var _0x145f09={'SUM':_0x3fe5('0x55'),'COUNT':_0x3fe5('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3fe5('0x57'),'MIN':'MIN(%s)','AVG':_0x3fe5('0x59'),'GROUP_CONCAT':_0x3fe5('0x5a'),'GROUP_CONCAT ASC':_0x3fe5('0x5b'),'GROUP_CONCAT DESC':_0x3fe5('0x5c')};var _0x3e75d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x3fe5('0x5e'),'ROUND':_0x3fe5('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x40cd79=function(_0x475e90){return!_[_0x3fe5('0x61')]([_0x3fe5('0x62'),_0x3fe5('0x63'),_0x3fe5('0x64'),_0x3fe5('0x65')],_0x475e90);};var _0x4f87df=function(_0x545823){if(!_0x545823||!_0x545823[_0x3fe5('0x66')][_0x3fe5('0x41')]){return'';}for(var _0x2f47f8='(',_0x503b39=0x0;_0x503b39<_0x545823[_0x3fe5('0x66')]['length'];_0x503b39+=0x1){_0x503b39>0x0&&(_0x2f47f8+='\x20'+_0x545823[_0x3fe5('0x88')]+'\x20');_0x2f47f8+=_0x545823['rules'][_0x503b39][_0x3fe5('0x67')]?_0x4f87df(_0x545823[_0x3fe5('0x66')][_0x503b39]['group']):_0x545823[_0x3fe5('0x66')][_0x503b39][_0x3fe5('0x89')]+'\x20'+_0x545823[_0x3fe5('0x66')][_0x503b39][_0x3fe5('0x68')]+(_0x40cd79(_0x545823[_0x3fe5('0x66')][_0x503b39][_0x3fe5('0x68')])?'\x20'+_0x545823[_0x3fe5('0x66')][_0x503b39]['value']:'');}return _0x2f47f8+')';};var _0x4a4a67={'where':{'id':_0x22d82d[_0x3fe5('0x40')]['id']}},_0x20a918,_0xd0dcf,_0x471623,_0x2795a6,_0x33e61c;_0x4a4a67=_['merge']({},_0x4a4a67,_0x22d82d[_0x3fe5('0x3b')]);return db[_0x3fe5('0x27')][_0x3fe5('0x42')](_0x4a4a67)['then'](function(_0x46ace7){if(_0x46ace7){_0x20a918=_0x46ace7;return _0x46ace7[_0x3fe5('0x69')]();}return null;})[_0x3fe5('0x20')](function(_0x1bec7b){if(_0x1bec7b){if(!_0x1bec7b['length']){throw new db[(_0x3fe5('0x6a'))][(_0x3fe5('0x6b'))](_0x3fe5('0x6c'),0x193);}_0xd0dcf=_0x1bec7b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x3fe5('0x20')](function(_0x9cbf8e){if(_0x9cbf8e){_0x471623=_[_0x3fe5('0x6e')](_0x9cbf8e,'id');var _0x530318;var _0xcb59f7=squel[_0x3fe5('0x9c')]();_0xcb59f7['from'](_0x20a918[_0x3fe5('0x70')]);for(var _0x2ba808=0x0;_0x2ba808<_0xd0dcf[_0x3fe5('0x41')];_0x2ba808+=0x1){_0x530318=_0xd0dcf[_0x2ba808][_0x3fe5('0x71')]?_0x471623[_0xd0dcf[_0x2ba808][_0x3fe5('0x71')]][_0x3fe5('0x72')]:_0xd0dcf[_0x2ba808][_0x3fe5('0x89')];_0x530318=_0xd0dcf[_0x2ba808][_0x3fe5('0x73')]?_[_0x3fe5('0x74')](_0x145f09[_0xd0dcf[_0x2ba808]['function']],'%s',_0x530318):_0x530318;_0x530318=_0xd0dcf[_0x2ba808][_0x3fe5('0x8b')]?_[_0x3fe5('0x74')](_0x3e75d2[_0xd0dcf[_0x2ba808][_0x3fe5('0x8b')]],'%s',_0x530318):_0x530318;if(_0xd0dcf[_0x2ba808]['groupBy']){_0xcb59f7['group'](_0x530318);}_0xd0dcf[_0x2ba808]['orderBy']&&_0xcb59f7[_0x3fe5('0x33')](_0x530318,_0xd0dcf[_0x2ba808][_0x3fe5('0x76')]===_0x3fe5('0x77')?![]:!![]);_0xcb59f7[_0x3fe5('0x89')](_0x530318,_0xd0dcf[_0x2ba808]['alias']||_0x530318);}if(_0x20a918[_0x3fe5('0x79')]){_0x20a918[_0x3fe5('0x79')]=JSON[_0x3fe5('0x7a')](_0x20a918[_0x3fe5('0x79')]);for(var _0x3929b6=0x0;_0x3929b6<_0x20a918[_0x3fe5('0x79')][_0x3fe5('0x41')];_0x3929b6+=0x1){if(_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x29')]&&_[_0x3fe5('0x61')](_0x11842f,_0x20a918['joins'][_0x3929b6][_0x3fe5('0x29')])&&_0x20a918['joins'][_0x3929b6]['parentKey']&&_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x7c')]&&_0x20a918[_0x3fe5('0x79')][_0x3929b6]['foreignKey']){_0xcb59f7[_0x20a918['joins'][_0x3929b6][_0x3fe5('0x29')]](_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x7c')],null,util[_0x3fe5('0x8b')]('%s.%s\x20=\x20%s.%s',_0x20a918[_0x3fe5('0x70')],_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x7b')],_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x7c')],_0x20a918[_0x3fe5('0x79')][_0x3929b6][_0x3fe5('0x7d')]));}}}if(_0x20a918[_0x3fe5('0x7f')]){_0x20a918[_0x3fe5('0x7f')]=JSON[_0x3fe5('0x7a')](_0x20a918[_0x3fe5('0x7f')]);_0xcb59f7[_0x3fe5('0x35')](_0x4f87df(_0x20a918[_0x3fe5('0x7f')][_0x3fe5('0x67')]));}_0x33e61c=_0xcb59f7[_0x3fe5('0x80')]();_0xcb59f7[_0x3fe5('0x1b')](_0x1f9f4c);_0xcb59f7[_0x3fe5('0x18')](0x0);logger[_0x3fe5('0xa1')](_0x3fe5('0x81'),_0xcb59f7['toString']());return dbH[_0x3fe5('0x83')][_0x3fe5('0x2d')](_0xcb59f7[_0x3fe5('0x82')](),{'type':dbH[_0x3fe5('0x83')][_0x3fe5('0x84')][_0x3fe5('0x85')]});}})[_0x3fe5('0x20')](function(){return{'sql':_0x33e61c[_0x3fe5('0x82')]()};})['then'](respondWithResult(_0x5a5173,null))[_0x3fe5('0x4f')](handleError(_0x5a5173,null));}; \ No newline at end of file +var _0x9136=['limit','count','set','Content-Range','json','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','status','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','create','error','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','select','metric','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','offset','undefined'];(function(_0xcb20f4,_0x1b4313){var _0x36f3b1=function(_0x18f7d1){while(--_0x18f7d1){_0xcb20f4['push'](_0xcb20f4['shift']());}};_0x36f3b1(++_0x1b4313);}(_0x9136,0x138));var _0x6913=function(_0x371bc3,_0x413268){_0x371bc3=_0x371bc3-0x0;var _0x5002b2=_0x9136[_0x371bc3];return _0x5002b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6913('0x0'));var zipdir=require(_0x6913('0x1'));var jsonpatch=require(_0x6913('0x2'));var rp=require(_0x6913('0x3'));var moment=require(_0x6913('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6913('0x5'));var util=require(_0x6913('0x6'));var path=require('path');var sox=require(_0x6913('0x7'));var csv=require('to-csv');var ejs=require(_0x6913('0x8'));var fs=require('fs');var fs_extra=require(_0x6913('0x9'));var _=require('lodash');var squel=require(_0x6913('0xa'));var crypto=require(_0x6913('0xb'));var jsforce=require(_0x6913('0xc'));var deskjs=require(_0x6913('0xd'));var toCsv=require(_0x6913('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6913('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6913('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6913('0x11'));var logger=require(_0x6913('0x12'))(_0x6913('0x13'));var utils=require(_0x6913('0x14'));var config=require(_0x6913('0x15'));var licenseUtil=require(_0x6913('0x16'));var db=require(_0x6913('0x17'))['db'];var dbH=require('../../mysqldb')[_0x6913('0x18')];function respondWithStatusCode(_0x536d4c,_0x3c0fa9){_0x3c0fa9=_0x3c0fa9||0xcc;return function(_0x1944bd){if(_0x1944bd){return _0x536d4c[_0x6913('0x19')](_0x3c0fa9);}return _0x536d4c['status'](_0x3c0fa9)['end']();};}function respondWithResult(_0x5b6128,_0x4702ce){_0x4702ce=_0x4702ce||0xc8;return function(_0x1774c2){if(_0x1774c2){return _0x5b6128['status'](_0x4702ce)['json'](_0x1774c2);}};}function respondWithFilteredResult(_0x35f7db,_0x1292e7){return function(_0x4c89ae){if(_0x4c89ae){var _0x4e7779=typeof _0x1292e7[_0x6913('0x1a')]===_0x6913('0x1b')&&typeof _0x1292e7[_0x6913('0x1c')]===_0x6913('0x1b');var _0x3564be=_0x4c89ae[_0x6913('0x1d')];var _0x1d1bb1=_0x4e7779?0x0:_0x1292e7[_0x6913('0x1a')];var _0x493183=_0x4e7779?_0x4c89ae[_0x6913('0x1d')]:_0x1292e7[_0x6913('0x1a')]+_0x1292e7[_0x6913('0x1c')];var _0x272914;if(_0x493183>=_0x3564be){_0x493183=_0x3564be;_0x272914=0xc8;}else{_0x272914=0xce;}_0x35f7db['status'](_0x272914);return _0x35f7db[_0x6913('0x1e')](_0x6913('0x1f'),_0x1d1bb1+'-'+_0x493183+'/'+_0x3564be)[_0x6913('0x20')](_0x4c89ae);}return null;};}function patchUpdates(_0x79a955){return function(_0x256029){try{jsonpatch[_0x6913('0x21')](_0x256029,_0x79a955,!![]);}catch(_0x303628){return BPromise[_0x6913('0x22')](_0x303628);}return _0x256029[_0x6913('0x23')]();};}function saveUpdates(_0x10ca15,_0x3bc34f){return function(_0x18748e){if(_0x18748e){return _0x18748e['update'](_0x10ca15)['then'](function(_0x33bb8c){return _0x33bb8c;});}return null;};}function removeEntity(_0x3c9f0a,_0x44e010){return function(_0x321efd){if(_0x321efd){return _0x321efd[_0x6913('0x24')]()[_0x6913('0x25')](function(){var _0x4321f1=_0x321efd[_0x6913('0x26')]({'plain':!![]});var _0x1d7cfc=_0x6913('0x27');return db[_0x6913('0x28')][_0x6913('0x24')]({'where':{'type':_0x1d7cfc,'resourceId':_0x4321f1['id']}})[_0x6913('0x25')](function(){return _0x321efd;});})[_0x6913('0x25')](function(){_0x3c9f0a[_0x6913('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x114d5b,_0x4f59af){return function(_0x161844){if(!_0x161844){_0x114d5b[_0x6913('0x19')](0x194);}return _0x161844;};}function handleError(_0x39bba6,_0xc3b9be){_0xc3b9be=_0xc3b9be||0x1f4;return function(_0x95228b){logger['error'](_0x95228b['stack']);if(_0x95228b[_0x6913('0x2a')]){delete _0x95228b[_0x6913('0x2a')];}_0x39bba6[_0x6913('0x29')](_0xc3b9be)[_0x6913('0x2b')](_0x95228b);};}exports['index']=function(_0x4231c5,_0x3e0001){var _0x3b75c2={},_0x9f7704={},_0x4a73ed={'count':0x0,'rows':[]};var _0x2bbfb3=_[_0x6913('0x2c')](db[_0x6913('0x2d')][_0x6913('0x2e')],function(_0x37fad7){return{'name':_0x37fad7[_0x6913('0x2f')],'type':_0x37fad7[_0x6913('0x30')]['key']};});_0x9f7704[_0x6913('0x31')]=_['map'](_0x2bbfb3,_0x6913('0x2a'));_0x9f7704['query']=_[_0x6913('0x32')](_0x4231c5['query']);_0x9f7704[_0x6913('0x33')]=_[_0x6913('0x34')](_0x9f7704[_0x6913('0x31')],_0x9f7704[_0x6913('0x35')]);_0x3b75c2[_0x6913('0x36')]=_[_0x6913('0x34')](_0x9f7704[_0x6913('0x31')],qs[_0x6913('0x37')](_0x4231c5[_0x6913('0x35')][_0x6913('0x37')]));_0x3b75c2[_0x6913('0x36')]=_0x3b75c2[_0x6913('0x36')][_0x6913('0x38')]?_0x3b75c2['attributes']:_0x9f7704['model'];if(!_0x4231c5['query'][_0x6913('0x39')](_0x6913('0x3a'))){_0x3b75c2[_0x6913('0x1c')]=qs[_0x6913('0x1c')](_0x4231c5[_0x6913('0x35')]['limit']);_0x3b75c2[_0x6913('0x1a')]=qs[_0x6913('0x1a')](_0x4231c5[_0x6913('0x35')][_0x6913('0x1a')]);}_0x3b75c2[_0x6913('0x3b')]=qs[_0x6913('0x3c')](_0x4231c5[_0x6913('0x35')][_0x6913('0x3c')]);_0x3b75c2[_0x6913('0x3d')]=qs[_0x6913('0x33')](_[_0x6913('0x3e')](_0x4231c5['query'],_0x9f7704['filters']),_0x2bbfb3);if(_0x4231c5['query'][_0x6913('0x3f')]){_0x3b75c2[_0x6913('0x3d')]=_[_0x6913('0x40')](_0x3b75c2[_0x6913('0x3d')],{'$or':_['map'](_0x2bbfb3,function(_0x1f984d){if(_0x1f984d[_0x6913('0x30')]!==_0x6913('0x41')){var _0x40013f={};_0x40013f[_0x1f984d[_0x6913('0x2a')]]={'$like':'%'+_0x4231c5[_0x6913('0x35')][_0x6913('0x3f')]+'%'};return _0x40013f;}})});}_0x3b75c2=_[_0x6913('0x40')]({},_0x3b75c2,_0x4231c5['options']);var _0x56e501={'where':_0x3b75c2[_0x6913('0x3d')]};return db[_0x6913('0x2d')][_0x6913('0x1d')](_0x56e501)['then'](function(_0x145226){_0x4a73ed[_0x6913('0x1d')]=_0x145226;if(_0x4231c5[_0x6913('0x35')][_0x6913('0x42')]){_0x3b75c2[_0x6913('0x43')]=[{'all':!![]}];}return db[_0x6913('0x2d')]['findAll'](_0x3b75c2);})[_0x6913('0x25')](function(_0x24bf9c){_0x4a73ed[_0x6913('0x44')]=_0x24bf9c;return _0x4a73ed;})['then'](respondWithFilteredResult(_0x3e0001,_0x3b75c2))[_0x6913('0x45')](handleError(_0x3e0001,null));};exports[_0x6913('0x46')]=function(_0x5ce945,_0x5dfa75){var _0x249598={'raw':![],'where':{'id':_0x5ce945[_0x6913('0x47')]['id']}},_0x2eae09={};_0x2eae09[_0x6913('0x31')]=_[_0x6913('0x32')](db[_0x6913('0x2d')]['rawAttributes']);_0x2eae09['query']=_['keys'](_0x5ce945[_0x6913('0x35')]);_0x2eae09[_0x6913('0x33')]=_[_0x6913('0x34')](_0x2eae09[_0x6913('0x31')],_0x2eae09['query']);_0x249598[_0x6913('0x36')]=_[_0x6913('0x34')](_0x2eae09[_0x6913('0x31')],qs[_0x6913('0x37')](_0x5ce945['query'][_0x6913('0x37')]));_0x249598[_0x6913('0x36')]=_0x249598['attributes'][_0x6913('0x38')]?_0x249598['attributes']:_0x2eae09['model'];if(_0x5ce945[_0x6913('0x35')][_0x6913('0x42')]){_0x249598[_0x6913('0x43')]=[{'all':!![]}];}_0x249598=_[_0x6913('0x40')]({},_0x249598,_0x5ce945[_0x6913('0x48')]);return db['AnalyticCustomReport'][_0x6913('0x49')](_0x249598)[_0x6913('0x25')](handleEntityNotFound(_0x5dfa75,null))[_0x6913('0x25')](respondWithResult(_0x5dfa75,null))[_0x6913('0x45')](handleError(_0x5dfa75,null));};exports['create']=function(_0x1acab2,_0x58412c){return db[_0x6913('0x2d')]['create'](_0x1acab2[_0x6913('0x4a')],{})[_0x6913('0x25')](function(_0x33e3c6){var _0x3b8354=_0x1acab2[_0x6913('0x4b')]['get']({'plain':!![]});if(!_0x3b8354)throw new Error(_0x6913('0x4c'));if(_0x3b8354[_0x6913('0x4d')]===_0x6913('0x4b')){var _0x1bd8bb=_0x33e3c6[_0x6913('0x26')]({'plain':!![]});var _0x35535e=_0x6913('0x4e');return db[_0x6913('0x4f')][_0x6913('0x49')]({'where':{'name':_0x35535e,'userProfileId':_0x3b8354[_0x6913('0x50')]},'raw':!![]})[_0x6913('0x25')](function(_0x25955c){if(_0x25955c&&_0x25955c[_0x6913('0x51')]===0x0){return db[_0x6913('0x28')][_0x6913('0x52')]({'name':_0x1bd8bb[_0x6913('0x2a')],'resourceId':_0x1bd8bb['id'],'type':_0x6913('0x27'),'sectionId':_0x25955c['id']},{})[_0x6913('0x25')](function(){return _0x33e3c6;});}else{return _0x33e3c6;}})[_0x6913('0x45')](function(_0x9e2b77){logger[_0x6913('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9e2b77);throw _0x9e2b77;});}return _0x33e3c6;})[_0x6913('0x25')](respondWithResult(_0x58412c,0xc9))[_0x6913('0x45')](handleError(_0x58412c,null));};exports[_0x6913('0x54')]=function(_0x1aa168,_0x21dba2){if(_0x1aa168['body']['id']){delete _0x1aa168[_0x6913('0x4a')]['id'];}return db[_0x6913('0x2d')][_0x6913('0x49')]({'where':{'id':_0x1aa168['params']['id']}})[_0x6913('0x25')](handleEntityNotFound(_0x21dba2,null))['then'](saveUpdates(_0x1aa168[_0x6913('0x4a')],null))[_0x6913('0x25')](respondWithResult(_0x21dba2,null))[_0x6913('0x45')](handleError(_0x21dba2,null));};exports[_0x6913('0x24')]=function(_0x39ff22,_0x4d715e){return db['AnalyticCustomReport'][_0x6913('0x49')]({'where':{'id':_0x39ff22[_0x6913('0x47')]['id']}})[_0x6913('0x25')](handleEntityNotFound(_0x4d715e,null))[_0x6913('0x25')](removeEntity(_0x4d715e,null))[_0x6913('0x45')](handleError(_0x4d715e,null));};exports[_0x6913('0x55')]=function(_0x2967c7,_0x2b3c83){var _0x2a900b=0xa;var _0x3be128=[_0x6913('0x56'),_0x6913('0x57'),_0x6913('0x58'),_0x6913('0x59')];var _0x15c8a3={'SUM':_0x6913('0x5a'),'COUNT':_0x6913('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6913('0x5c'),'MIN':_0x6913('0x5d'),'AVG':_0x6913('0x5e'),'GROUP_CONCAT':_0x6913('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6913('0x60')};var _0x280e54={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6913('0x61'),'HOUR':_0x6913('0x62'),'ROUND':_0x6913('0x63'),'UNIX_TIMESTAMP':_0x6913('0x64')};var _0x560deb=function(_0x249575){return!_[_0x6913('0x65')]([_0x6913('0x66'),_0x6913('0x67'),_0x6913('0x68'),'IS\x20NOT\x20EMPTY'],_0x249575);};var _0x5999c0=function(_0x66abba){if(!_0x66abba||!_0x66abba[_0x6913('0x69')][_0x6913('0x38')]){return'';}for(var _0x427495='(',_0x17c3f2=0x0;_0x17c3f2<_0x66abba[_0x6913('0x69')][_0x6913('0x38')];_0x17c3f2+=0x1){_0x17c3f2>0x0&&(_0x427495+='\x20'+_0x66abba[_0x6913('0x6a')]+'\x20');_0x427495+=_0x66abba['rules'][_0x17c3f2][_0x6913('0x6b')]?_0x5999c0(_0x66abba[_0x6913('0x69')][_0x17c3f2][_0x6913('0x6b')]):_0x66abba[_0x6913('0x69')][_0x17c3f2]['field']+'\x20'+_0x66abba['rules'][_0x17c3f2][_0x6913('0x6c')]+(_0x560deb(_0x66abba[_0x6913('0x69')][_0x17c3f2][_0x6913('0x6c')])?'\x20'+_0x66abba['rules'][_0x17c3f2][_0x6913('0x6d')]:'');}return _0x427495+')';};var _0x3c53be={'where':{'id':_0x2967c7[_0x6913('0x47')]['id']}},_0x6fff63,_0x3c6565,_0x24cae3,_0x2143d0,_0x46af80;_0x3c53be=_[_0x6913('0x40')]({},_0x3c53be,_0x2967c7[_0x6913('0x48')]);return db[_0x6913('0x2d')][_0x6913('0x49')](_0x3c53be)[_0x6913('0x25')](function(_0x5a6fbe){if(_0x5a6fbe){_0x6fff63=_0x5a6fbe;return _0x5a6fbe[_0x6913('0x6e')]();}return null;})['then'](function(_0x1a260b){if(_0x1a260b){if(!_0x1a260b[_0x6913('0x38')]){throw new db[(_0x6913('0x6f'))][(_0x6913('0x70'))](_0x6913('0x71'),0x193);}_0x3c6565=_0x1a260b;return db[_0x6913('0x72')][_0x6913('0x73')]({'raw':!![]});}return null;})['then'](function(_0x890518){if(_0x890518){_0x24cae3=_[_0x6913('0x74')](_0x890518,'id');var _0x249929;var _0x284960=squel['select']();_0x284960[_0x6913('0x75')](_0x6fff63[_0x6913('0x76')]);for(var _0x51c02a=0x0;_0x51c02a<_0x3c6565[_0x6913('0x38')];_0x51c02a+=0x1){_0x249929=_0x3c6565[_0x51c02a][_0x6913('0x77')]?_0x24cae3[_0x3c6565[_0x51c02a][_0x6913('0x77')]]['metric']:_0x3c6565[_0x51c02a][_0x6913('0x78')];_0x249929=_0x3c6565[_0x51c02a][_0x6913('0x79')]?_[_0x6913('0x7a')](_0x15c8a3[_0x3c6565[_0x51c02a]['function']],'%s',_0x249929):_0x249929;_0x249929=_0x3c6565[_0x51c02a][_0x6913('0x7b')]?_[_0x6913('0x7a')](_0x280e54[_0x3c6565[_0x51c02a][_0x6913('0x7b')]],'%s',_0x249929):_0x249929;if(_0x3c6565[_0x51c02a][_0x6913('0x7c')]){_0x284960[_0x6913('0x6b')](_0x249929);}_0x3c6565[_0x51c02a][_0x6913('0x7d')]&&_0x284960[_0x6913('0x3b')](_0x249929,_0x3c6565[_0x51c02a]['orderBy']===_0x6913('0x7e')?![]:!![]);_0x284960[_0x6913('0x78')](_0x249929,_0x3c6565[_0x51c02a][_0x6913('0x7f')]||_0x249929);}if(_0x6fff63[_0x6913('0x80')]){_0x6fff63[_0x6913('0x80')]=JSON[_0x6913('0x81')](_0x6fff63['joins']);for(var _0x43c990=0x0;_0x43c990<_0x6fff63[_0x6913('0x80')]['length'];_0x43c990+=0x1){if(_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x30')]&&_[_0x6913('0x65')](_0x3be128,_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x30')])&&_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x82')]&&_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x83')]&&_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x84')]){_0x284960[_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x30')]](_0x6fff63['joins'][_0x43c990][_0x6913('0x83')],null,util[_0x6913('0x7b')]('%s.%s\x20=\x20%s.%s',_0x6fff63[_0x6913('0x76')],_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x82')],_0x6fff63[_0x6913('0x80')][_0x43c990][_0x6913('0x83')],_0x6fff63['joins'][_0x43c990]['foreignKey']));}}}if(_0x6fff63[_0x6913('0x85')]){_0x6fff63[_0x6913('0x85')]=JSON[_0x6913('0x81')](_0x6fff63[_0x6913('0x85')]);_0x284960[_0x6913('0x3d')](_0x5999c0(_0x6fff63['conditions']['group']));}_0x46af80=_0x284960[_0x6913('0x86')]();_0x284960['limit'](_0x2a900b);_0x284960['offset'](0x0);logger[_0x6913('0x87')](_0x6913('0x88'),_0x284960[_0x6913('0x89')]());return dbH[_0x6913('0x8a')][_0x6913('0x35')](_0x284960[_0x6913('0x89')](),{'type':dbH[_0x6913('0x8a')]['QueryTypes'][_0x6913('0x8b')]});}})[_0x6913('0x25')](respondWithResult(_0x2b3c83,null))[_0x6913('0x45')](handleError(_0x2b3c83,null));};function runReport(_0x320255,_0x20d93c,_0x54032e){var _0x5608bd=_0x20d93c[_0x6913('0x2a')];var _0x35a924=0xa;var _0x5c35f3=[_0x6913('0x56'),_0x6913('0x57'),'right_join',_0x6913('0x59')];var _0xe014db={'SUM':_0x6913('0x5a'),'COUNT':_0x6913('0x5b'),'COUNT DISTINCT':_0x6913('0x8c'),'MAX':_0x6913('0x5c'),'MIN':'MIN(%s)','AVG':_0x6913('0x5e'),'GROUP_CONCAT':_0x6913('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6913('0x60')};var _0x2a71c7={'SEC_TO_TIME':_0x6913('0x8d'),'DATE':_0x6913('0x61'),'HOUR':_0x6913('0x62'),'ROUND':_0x6913('0x63'),'UNIX_TIMESTAMP':_0x6913('0x64')};var _0x5a9c52=function(_0x169082){return!_['includes']([_0x6913('0x66'),_0x6913('0x67'),'IS\x20EMPTY',_0x6913('0x8e')],_0x169082);};var _0x35b8b8=function(_0x59d3d1){if(!_0x59d3d1||!_0x59d3d1[_0x6913('0x69')][_0x6913('0x38')]){return'';}for(var _0x502da0='(',_0x42271c=0x0;_0x42271c<_0x59d3d1[_0x6913('0x69')][_0x6913('0x38')];_0x42271c+=0x1){_0x42271c>0x0&&(_0x502da0+='\x20'+_0x59d3d1[_0x6913('0x6a')]+'\x20');_0x502da0+=_0x59d3d1['rules'][_0x42271c][_0x6913('0x6b')]?_0x35b8b8(_0x59d3d1[_0x6913('0x69')][_0x42271c][_0x6913('0x6b')]):_0x59d3d1['rules'][_0x42271c]['field']+'\x20'+_0x59d3d1[_0x6913('0x69')][_0x42271c]['condition']+(_0x5a9c52(_0x59d3d1[_0x6913('0x69')][_0x42271c][_0x6913('0x6c')])?'\x20'+_0x59d3d1[_0x6913('0x69')][_0x42271c][_0x6913('0x6d')]:'');}return _0x502da0+')';};var _0x40c791={'where':{'id':_0x320255['id']}},_0x42f9ba,_0x51d978,_0x450889,_0x5b1290,_0x2b2811;_0x40c791=_['merge']({},_0x40c791,_0x54032e);return db[_0x6913('0x2d')]['find'](_0x40c791)[_0x6913('0x25')](function(_0x542fb8){if(_0x542fb8){_0x42f9ba=_0x542fb8;return _0x542fb8[_0x6913('0x6e')]();}return null;})[_0x6913('0x25')](function(_0xb1e98b){if(_0xb1e98b){if(!_0xb1e98b[_0x6913('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0x6913('0x71'),0x193);}_0x51d978=_0xb1e98b;return db[_0x6913('0x72')][_0x6913('0x73')]({'raw':!![]});}return null;})[_0x6913('0x25')](function(_0x349c0){if(_0x349c0){_0x450889=_[_0x6913('0x74')](_0x349c0,'id');var _0x533958;var _0x412fc8=squel[_0x6913('0x8f')]();_0x412fc8[_0x6913('0x75')](_0x42f9ba[_0x6913('0x76')]);for(var _0x3a8d39=0x0;_0x3a8d39<_0x51d978[_0x6913('0x38')];_0x3a8d39+=0x1){_0x533958=_0x51d978[_0x3a8d39]['MetricId']?_0x450889[_0x51d978[_0x3a8d39][_0x6913('0x77')]][_0x6913('0x90')]:_0x51d978[_0x3a8d39]['field'];_0x533958=_0x51d978[_0x3a8d39][_0x6913('0x79')]?_[_0x6913('0x7a')](_0xe014db[_0x51d978[_0x3a8d39][_0x6913('0x79')]],'%s',_0x533958):_0x533958;_0x533958=_0x51d978[_0x3a8d39][_0x6913('0x7b')]?_['replace'](_0x2a71c7[_0x51d978[_0x3a8d39][_0x6913('0x7b')]],'%s',_0x533958):_0x533958;if(_0x51d978[_0x3a8d39][_0x6913('0x7c')]){_0x412fc8[_0x6913('0x6b')](_0x533958);}_0x51d978[_0x3a8d39]['orderBy']&&_0x412fc8['order'](_0x533958,_0x51d978[_0x3a8d39]['orderBy']===_0x6913('0x7e')?![]:!![]);_0x412fc8[_0x6913('0x78')](_0x533958,_0x51d978[_0x3a8d39]['alias']||_0x533958);}if(_0x42f9ba[_0x6913('0x80')]){_0x42f9ba[_0x6913('0x80')]=JSON[_0x6913('0x81')](_0x42f9ba[_0x6913('0x80')]);for(var _0x4b4598=0x0;_0x4b4598<_0x42f9ba[_0x6913('0x80')][_0x6913('0x38')];_0x4b4598+=0x1){if(_0x42f9ba['joins'][_0x4b4598][_0x6913('0x30')]&&_[_0x6913('0x65')](_0x5c35f3,_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x30')])&&_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x82')]&&_0x42f9ba['joins'][_0x4b4598]['foreignTable']&&_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x84')]){_0x412fc8[_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x30')]](_0x42f9ba['joins'][_0x4b4598]['foreignTable'],null,util[_0x6913('0x7b')](_0x6913('0x91'),_0x42f9ba['table'],_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x82')],_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x83')],_0x42f9ba[_0x6913('0x80')][_0x4b4598][_0x6913('0x84')]));}}}if(_0x42f9ba[_0x6913('0x85')]){_0x42f9ba[_0x6913('0x85')]=JSON[_0x6913('0x81')](_0x42f9ba['conditions']);_0x412fc8[_0x6913('0x3d')](_0x35b8b8(_0x42f9ba['conditions']['group']));}_0x2b2811=_0x412fc8[_0x6913('0x86')]();_0x412fc8[_0x6913('0x1c')](_0x35a924);_0x412fc8[_0x6913('0x1a')](0x0);return;}})['then'](function(){if(_0x20d93c[_0x6913('0x92')]===_0x6913('0x93')){return null;}var _0x14f6f5=_[_0x6913('0x40')](_0x20d93c,{'name':_0x20d93c[_0x6913('0x94')]||_0x20d93c[_0x6913('0x2a')]||_0x42f9ba[_0x6913('0x2a')],'basename':_0x5608bd,'savename':util[_0x6913('0x7b')](_0x6913('0x95'),_0x20d93c[_0x6913('0x2a')]||_0x42f9ba[_0x6913('0x2a')],require(_0x6913('0x96'))[_0x6913('0x97')](0x4),_0x20d93c[_0x6913('0x92')]||_0x6913('0x98')),'reportId':_0x42f9ba['id'],'reportType':_0x6913('0x99')});return db[_0x6913('0x9a')]['create'](_0x14f6f5,{'raw':!![]});})[_0x6913('0x25')](function(_0x371139){if(_0x42f9ba[_0x6913('0x76')]===_0x6913('0x9b')){_0x2b2811['where'](_0x42f9ba[_0x6913('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x20d93c[_0x6913('0x9c')],_0x20d93c['endDate']);}else{_0x2b2811[_0x6913('0x3d')](_0x42f9ba['table']+_0x6913('0x9d'),_0x20d93c[_0x6913('0x9c')],_0x20d93c[_0x6913('0x9e')]);}if(_0x371139){logger[_0x6913('0x9f')](_0x6913('0xa0'),_0x2b2811[_0x6913('0x89')]());require(_0x6913('0xa1'))[_0x6913('0xa2')](path['join'](__dirname,_0x6913('0xa3'),_0x371139[_0x6913('0x92')]),[_0x371139['id'],_0x2b2811[_0x6913('0x89')](),path['join'](__dirname,_0x6913('0xa4'),_0x371139[_0x6913('0xa5')]),_0x5608bd]);return _0x371139;}else{var _0x2e72e7=squel[_0x6913('0x8f')]();_0x2e72e7['from']('('+_0x2b2811[_0x6913('0x89')]()+')',_0x6913('0xa6'));_0x2e72e7[_0x6913('0x78')]('COUNT(*)','count');_0x2b2811[_0x6913('0x1c')](_0x20d93c[_0x6913('0x1c')]||_0x35a924);_0x2b2811['offset'](_0x20d93c[_0x6913('0x1a')]||0x0);return dbH[_0x6913('0x8a')][_0x6913('0x35')](_0x2e72e7[_0x6913('0x89')](),{'type':dbH[_0x6913('0x8a')][_0x6913('0xa7')]['SELECT']})[_0x6913('0x25')](function(_0x2cfb66){if(!_0x2cfb66[_0x6913('0x38')]){_0x5b1290=0x0;}else{_0x5b1290=_0x2cfb66[0x0][_0x6913('0x1d')]||0x0;}return dbH['sequelize'][_0x6913('0x35')](_0x2b2811['toString'](),{'type':dbH['sequelize'][_0x6913('0xa7')][_0x6913('0x8b')]});})[_0x6913('0x25')](function(_0x56325f){return{'rows':_0x56325f||[],'count':_0x5b1290};});}});}exports['run']=function(_0x5821f5,_0x1c4133){return runReport(_0x5821f5[_0x6913('0x47')],_0x5821f5[_0x6913('0x35')],_0x5821f5['options'])['then'](respondWithResult(_0x1c4133,null))['catch'](handleError(_0x1c4133,null));};exports[_0x6913('0xa8')]=runReport;exports[_0x6913('0x35')]=function(_0x299745,_0x29265d){var _0x32336d=0xa;var _0x578718=[_0x6913('0x56'),'left_join',_0x6913('0x58'),_0x6913('0x59')];var _0x70db70={'SUM':_0x6913('0x5a'),'COUNT':_0x6913('0x5b'),'COUNT DISTINCT':_0x6913('0x8c'),'MAX':'MAX(%s)','MIN':_0x6913('0x5d'),'AVG':_0x6913('0x5e'),'GROUP_CONCAT':_0x6913('0x5f'),'GROUP_CONCAT ASC':_0x6913('0xa9'),'GROUP_CONCAT DESC':_0x6913('0x60')};var _0x517547={'SEC_TO_TIME':_0x6913('0x8d'),'DATE':_0x6913('0x61'),'HOUR':_0x6913('0x62'),'ROUND':_0x6913('0x63'),'UNIX_TIMESTAMP':_0x6913('0x64')};var _0x44a321=function(_0x5ecd43){return!_[_0x6913('0x65')](['IS\x20NULL',_0x6913('0x67'),'IS\x20EMPTY',_0x6913('0x8e')],_0x5ecd43);};var _0x13698b=function(_0x5afd89){if(!_0x5afd89||!_0x5afd89[_0x6913('0x69')]['length']){return'';}for(var _0x53b9c3='(',_0x42d342=0x0;_0x42d342<_0x5afd89[_0x6913('0x69')][_0x6913('0x38')];_0x42d342+=0x1){_0x42d342>0x0&&(_0x53b9c3+='\x20'+_0x5afd89[_0x6913('0x6a')]+'\x20');_0x53b9c3+=_0x5afd89[_0x6913('0x69')][_0x42d342][_0x6913('0x6b')]?_0x13698b(_0x5afd89[_0x6913('0x69')][_0x42d342][_0x6913('0x6b')]):_0x5afd89['rules'][_0x42d342][_0x6913('0x78')]+'\x20'+_0x5afd89[_0x6913('0x69')][_0x42d342][_0x6913('0x6c')]+(_0x44a321(_0x5afd89[_0x6913('0x69')][_0x42d342]['condition'])?'\x20'+_0x5afd89[_0x6913('0x69')][_0x42d342][_0x6913('0x6d')]:'');}return _0x53b9c3+')';};var _0x5085e9={'where':{'id':_0x299745['params']['id']}},_0x54318b,_0x87cb7f,_0x497d33,_0x4cc5e7,_0x427528;_0x5085e9=_[_0x6913('0x40')]({},_0x5085e9,_0x299745[_0x6913('0x48')]);return db[_0x6913('0x2d')]['find'](_0x5085e9)[_0x6913('0x25')](function(_0x3c6641){if(_0x3c6641){_0x54318b=_0x3c6641;return _0x3c6641[_0x6913('0x6e')]();}return null;})[_0x6913('0x25')](function(_0x19dfd5){if(_0x19dfd5){if(!_0x19dfd5['length']){throw new db['Sequelize'][(_0x6913('0x70'))](_0x6913('0x71'),0x193);}_0x87cb7f=_0x19dfd5;return db[_0x6913('0x72')][_0x6913('0x73')]({'raw':!![]});}return null;})[_0x6913('0x25')](function(_0x563100){if(_0x563100){_0x497d33=_['keyBy'](_0x563100,'id');var _0x2695fa;var _0x565a8f=squel[_0x6913('0x8f')]();_0x565a8f[_0x6913('0x75')](_0x54318b[_0x6913('0x76')]);for(var _0x4e1327=0x0;_0x4e1327<_0x87cb7f[_0x6913('0x38')];_0x4e1327+=0x1){_0x2695fa=_0x87cb7f[_0x4e1327][_0x6913('0x77')]?_0x497d33[_0x87cb7f[_0x4e1327]['MetricId']][_0x6913('0x90')]:_0x87cb7f[_0x4e1327][_0x6913('0x78')];_0x2695fa=_0x87cb7f[_0x4e1327][_0x6913('0x79')]?_['replace'](_0x70db70[_0x87cb7f[_0x4e1327][_0x6913('0x79')]],'%s',_0x2695fa):_0x2695fa;_0x2695fa=_0x87cb7f[_0x4e1327][_0x6913('0x7b')]?_['replace'](_0x517547[_0x87cb7f[_0x4e1327][_0x6913('0x7b')]],'%s',_0x2695fa):_0x2695fa;if(_0x87cb7f[_0x4e1327][_0x6913('0x7c')]){_0x565a8f[_0x6913('0x6b')](_0x2695fa);}_0x87cb7f[_0x4e1327]['orderBy']&&_0x565a8f[_0x6913('0x3b')](_0x2695fa,_0x87cb7f[_0x4e1327][_0x6913('0x7d')]===_0x6913('0x7e')?![]:!![]);_0x565a8f['field'](_0x2695fa,_0x87cb7f[_0x4e1327][_0x6913('0x7f')]||_0x2695fa);}if(_0x54318b['joins']){_0x54318b[_0x6913('0x80')]=JSON[_0x6913('0x81')](_0x54318b[_0x6913('0x80')]);for(var _0x418584=0x0;_0x418584<_0x54318b['joins'][_0x6913('0x38')];_0x418584+=0x1){if(_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x30')]&&_[_0x6913('0x65')](_0x578718,_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x30')])&&_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x82')]&&_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x83')]&&_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x84')]){_0x565a8f[_0x54318b['joins'][_0x418584][_0x6913('0x30')]](_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x83')],null,util[_0x6913('0x7b')]('%s.%s\x20=\x20%s.%s',_0x54318b['table'],_0x54318b[_0x6913('0x80')][_0x418584]['parentKey'],_0x54318b[_0x6913('0x80')][_0x418584]['foreignTable'],_0x54318b[_0x6913('0x80')][_0x418584][_0x6913('0x84')]));}}}if(_0x54318b['conditions']){_0x54318b['conditions']=JSON[_0x6913('0x81')](_0x54318b['conditions']);_0x565a8f[_0x6913('0x3d')](_0x13698b(_0x54318b[_0x6913('0x85')][_0x6913('0x6b')]));}_0x427528=_0x565a8f['clone']();_0x565a8f[_0x6913('0x1c')](_0x32336d);_0x565a8f[_0x6913('0x1a')](0x0);logger[_0x6913('0x87')](_0x6913('0x88'),_0x565a8f['toString']());return dbH[_0x6913('0x8a')][_0x6913('0x35')](_0x565a8f[_0x6913('0x89')](),{'type':dbH['sequelize'][_0x6913('0xa7')][_0x6913('0x8b')]});}})['then'](function(){return{'sql':_0x427528[_0x6913('0x89')]()};})['then'](respondWithResult(_0x29265d,null))[_0x6913('0x45')](handleError(_0x29265d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 06c275c..f5ef24c 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 _0x78c2=['exports','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x78c2,0x1b1));var _0x278c=function(_0x2ce175,_0x10a0d2){_0x2ce175=_0x2ce175-0x0;var _0xbf859c=_0x78c2[_0x2ce175];return _0xbf859c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x278c('0x0'))(_0x278c('0x1'));var moment=require(_0x278c('0x2'));var BPromise=require(_0x278c('0x3'));var rp=require(_0x278c('0x4'));var fs=require('fs');var path=require(_0x278c('0x5'));var rimraf=require('rimraf');var config=require(_0x278c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x278c('0x7')]=function(_0x3afa0e,_0x385b06){return _0x3afa0e[_0x278c('0x8')](_0x278c('0x9'),attributes,{'tableName':_0x278c('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0bf=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0bf,0x105));var _0xff0b=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xf0bf[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xff0b('0x0'));var util=require(_0xff0b('0x1'));var logger=require(_0xff0b('0x2'))(_0xff0b('0x3'));var moment=require('moment');var BPromise=require(_0xff0b('0x4'));var rp=require(_0xff0b('0x5'));var fs=require('fs');var path=require(_0xff0b('0x6'));var rimraf=require(_0xff0b('0x7'));var config=require(_0xff0b('0x8'));var attributes=require(_0xff0b('0x9'));module[_0xff0b('0xa')]=function(_0x2f47dd,_0x4430d9){return _0x2f47dd[_0xff0b('0xb')](_0xff0b('0xc'),attributes,{'tableName':_0xff0b('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index a0e4bdd..34df568 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 _0xf575=['http','request','debug','request\x20sent','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3d7595,_0x23bf60){var _0x163d06=function(_0x2c3a21){while(--_0x2c3a21){_0x3d7595['push'](_0x3d7595['shift']());}};_0x163d06(++_0x23bf60);}(_0xf575,0xf1));var _0x5f57=function(_0x1e3ca5,_0x548838){_0x1e3ca5=_0x1e3ca5-0x0;var _0x3898fc=_0xf575[_0x1e3ca5];return _0x3898fc;};'use strict';var _=require(_0x5f57('0x0'));var util=require(_0x5f57('0x1'));var moment=require(_0x5f57('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f57('0x3'));var fs=require('fs');var Redis=require(_0x5f57('0x4'));var db=require(_0x5f57('0x5'))['db'];var utils=require(_0x5f57('0x6'));var logger=require(_0x5f57('0x7'))(_0x5f57('0x8'));var config=require(_0x5f57('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f57('0xa')][_0x5f57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x145ead,_0x36106d,_0x502118){return new BPromise(function(_0x44f344,_0x54a06c){return client[_0x5f57('0xc')](_0x145ead,_0x502118)['then'](function(_0x2761bd){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x36106d,'request\x20sent');logger[_0x5f57('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x36106d,_0x5f57('0xe'),JSON['stringify'](_0x2761bd));if(_0x2761bd[_0x5f57('0xf')]){if(_0x2761bd['error'][_0x5f57('0x10')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x36106d,_0x2761bd[_0x5f57('0xf')][_0x5f57('0x11')]);return _0x54a06c(_0x2761bd['error'][_0x5f57('0x11')]);}logger[_0x5f57('0xf')](_0x5f57('0x12'),_0x36106d,_0x2761bd[_0x5f57('0xf')]['message']);return _0x44f344(_0x2761bd[_0x5f57('0xf')][_0x5f57('0x11')]);}else{logger[_0x5f57('0x13')](_0x5f57('0x12'),_0x36106d,_0x5f57('0xe'));_0x44f344(_0x2761bd[_0x5f57('0x14')][_0x5f57('0x11')]);}})['catch'](function(_0x3b6512){logger[_0x5f57('0xf')](_0x5f57('0x12'),_0x36106d,_0x3b6512);_0x54a06c(_0x3b6512);});});} \ No newline at end of file +var _0xe7b5=['../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x115a0f,_0x46c0ae){var _0x2b53a0=function(_0x5ad110){while(--_0x5ad110){_0x115a0f['push'](_0x115a0f['shift']());}};_0x2b53a0(++_0x46c0ae);}(_0xe7b5,0xeb));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var moment=require(_0x5e7b('0x2'));var BPromise=require(_0x5e7b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7b('0x4'));var db=require(_0x5e7b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e7b('0x6'))('rpc');var config=require(_0x5e7b('0x7'));var jayson=require(_0x5e7b('0x8'));var client=jayson[_0x5e7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30592b,_0x19d228,_0x572043){return new BPromise(function(_0x289726,_0x3db952){return client[_0x5e7b('0xa')](_0x30592b,_0x572043)[_0x5e7b('0xb')](function(_0x3957ba){logger[_0x5e7b('0xc')](_0x5e7b('0xd'),_0x19d228,_0x5e7b('0xe'));logger['debug'](_0x5e7b('0xf'),_0x19d228,_0x5e7b('0xe'),JSON[_0x5e7b('0x10')](_0x3957ba));if(_0x3957ba['error']){if(_0x3957ba[_0x5e7b('0x11')][_0x5e7b('0x12')]===0x1f4){logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x19d228,_0x3957ba['error']['message']);return _0x3db952(_0x3957ba[_0x5e7b('0x11')][_0x5e7b('0x13')]);}logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x19d228,_0x3957ba[_0x5e7b('0x11')][_0x5e7b('0x13')]);return _0x289726(_0x3957ba['error'][_0x5e7b('0x13')]);}else{logger['info'](_0x5e7b('0xd'),_0x19d228,_0x5e7b('0xe'));_0x289726(_0x3957ba[_0x5e7b('0x14')]['message']);}})[_0x5e7b('0x15')](function(_0x1936e3){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x19d228,_0x1936e3);_0x3db952(_0x1936e3);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d451736..406c05c 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 _0x5b3b=['query','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x194a9d,_0x1b2b7e){var _0x39c13a=function(_0x5429bd){while(--_0x5429bd){_0x194a9d['push'](_0x194a9d['shift']());}};_0x39c13a(++_0x1b2b7e);}(_0x5b3b,0x1d3));var _0xb5b3=function(_0x29fdb7,_0x4f08b3){_0x29fdb7=_0x29fdb7-0x0;var _0x11a098=_0x5b3b[_0x29fdb7];return _0x11a098;};'use strict';var multer=require(_0xb5b3('0x0'));var util=require('util');var path=require(_0xb5b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xb5b3('0x2'));var router=express[_0xb5b3('0x3')]();var fs_extra=require(_0xb5b3('0x4'));var auth=require(_0xb5b3('0x5'));var interaction=require(_0xb5b3('0x6'));var config=require(_0xb5b3('0x7'));var controller=require(_0xb5b3('0x8'));router[_0xb5b3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb5b3('0xa')]);router[_0xb5b3('0x9')](_0xb5b3('0xb'),auth[_0xb5b3('0xc')](),controller[_0xb5b3('0xd')]);router[_0xb5b3('0x9')](_0xb5b3('0xe'),auth[_0xb5b3('0xc')](),controller[_0xb5b3('0xf')]);router[_0xb5b3('0x9')](_0xb5b3('0x10'),auth['isAuthenticated'](),controller[_0xb5b3('0x11')]);router['get'](_0xb5b3('0x12'),auth[_0xb5b3('0xc')](),controller[_0xb5b3('0x13')]);router[_0xb5b3('0x14')]('/',auth[_0xb5b3('0xc')](),controller[_0xb5b3('0x15')]);router[_0xb5b3('0x16')](_0xb5b3('0xb'),auth[_0xb5b3('0xc')](),controller[_0xb5b3('0x17')]);router[_0xb5b3('0x18')](_0xb5b3('0xb'),auth['isAuthenticated'](),controller[_0xb5b3('0x19')]);module[_0xb5b3('0x1a')]=router; \ No newline at end of file +var _0xd82c=['index','get','/:id','preview','/:id/run','run','query','post','create','put','update','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x3e0d64,_0x41399b){var _0xc44ce8=function(_0x36d302){while(--_0x36d302){_0x3e0d64['push'](_0x3e0d64['shift']());}};_0xc44ce8(++_0x41399b);}(_0xd82c,0xd1));var _0xcd82=function(_0x126d54,_0x9d5649){_0x126d54=_0x126d54-0x0;var _0x5eb26c=_0xd82c[_0x126d54];return _0x5eb26c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd82('0x0'));var timeout=require(_0xcd82('0x1'));var express=require(_0xcd82('0x2'));var router=express[_0xcd82('0x3')]();var fs_extra=require(_0xcd82('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcd82('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xcd82('0x6')](),controller[_0xcd82('0x7')]);router[_0xcd82('0x8')](_0xcd82('0x9'),auth[_0xcd82('0x6')](),controller['show']);router[_0xcd82('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0xcd82('0xa')]);router[_0xcd82('0x8')](_0xcd82('0xb'),auth[_0xcd82('0x6')](),controller[_0xcd82('0xc')]);router['get']('/:id/query',auth[_0xcd82('0x6')](),controller[_0xcd82('0xd')]);router[_0xcd82('0xe')]('/',auth[_0xcd82('0x6')](),controller[_0xcd82('0xf')]);router[_0xcd82('0x10')]('/:id',auth[_0xcd82('0x6')](),controller[_0xcd82('0x11')]);router['delete']('/:id',auth[_0xcd82('0x6')](),controller['destroy']);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 eb476fa..a90e77a 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 _0x425d=['sequelize','STRING','TEXT'];(function(_0x44a554,_0x18e60b){var _0x1dde7f=function(_0x461ff8){while(--_0x461ff8){_0x44a554['push'](_0x44a554['shift']());}};_0x1dde7f(++_0x18e60b);}(_0x425d,0x1e0));var _0xd425=function(_0x235ad6,_0x5e4437){_0x235ad6=_0x235ad6-0x0;var _0x2885d9=_0x425d[_0x235ad6];return _0x2885d9;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x1d3647,_0x358d0c){var _0x2bd681=function(_0x1e82b5){while(--_0x1e82b5){_0x1d3647['push'](_0x1d3647['shift']());}};_0x2bd681(++_0x358d0c);}(_0xeff8,0x186));var _0x8eff=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xeff8[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 43e0d76..84ccdff 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x461935,_0xeaeb6e){var _0x1f809f=function(_0x56c009){while(--_0x56c009){_0x461935['push'](_0x461935['shift']());}};_0x1f809f(++_0xeaeb6e);}(_0x4819,0xcd));var _0x9481=function(_0x275d85,_0x5a883e){_0x275d85=_0x275d85-0x0;var _0x3cd754=_0x4819[_0x275d85];return _0x3cd754;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x114211,_0x38ec1d){var _0x1c5440=function(_0x117b08){while(--_0x117b08){_0x114211['push'](_0x114211['shift']());}};_0x1c5440(++_0x38ec1d);}(_0x53ec,0x192));var _0xc53e=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0x53ec[_0x20025e];return _0x4a5ac4;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 83b122a..8d02ce0 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 _0x874c=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3c78cb,_0x1fd4c5){var _0x5efe93=function(_0x192ccc){while(--_0x192ccc){_0x3c78cb['push'](_0x3c78cb['shift']());}};_0x5efe93(++_0x1fd4c5);}(_0x874c,0x184));var _0xc874=function(_0x398d54,_0x1e0366){_0x398d54=_0x398d54-0x0;var _0x2b2526=_0x874c[_0x398d54];return _0x2b2526;};'use strict';var _=require(_0xc874('0x0'));var util=require(_0xc874('0x1'));var logger=require(_0xc874('0x2'))('api');var moment=require(_0xc874('0x3'));var BPromise=require('bluebird');var rp=require(_0xc874('0x4'));var fs=require('fs');var path=require(_0xc874('0x5'));var rimraf=require(_0xc874('0x6'));var config=require(_0xc874('0x7'));var attributes=require(_0xc874('0x8'));module[_0xc874('0x9')]=function(_0x2aabc3,_0x402609){return _0x2aabc3[_0xc874('0xa')](_0xc874('0xb'),attributes,{'tableName':_0xc874('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c89=['lodash','util','moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports'];(function(_0x7e6b82,_0x3fe61c){var _0x55c104=function(_0x2a8535){while(--_0x2a8535){_0x7e6b82['push'](_0x7e6b82['shift']());}};_0x55c104(++_0x3fe61c);}(_0x1c89,0xd8));var _0x91c8=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0x1c89[_0x12a57d];return _0x4b26f6;};'use strict';var _=require(_0x91c8('0x0'));var util=require(_0x91c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x91c8('0x2'));var BPromise=require(_0x91c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x91c8('0x4'));var config=require(_0x91c8('0x5'));var attributes=require(_0x91c8('0x6'));module[_0x91c8('0x7')]=function(_0x21fb1c,_0x67564a){return _0x21fb1c['define']('AnalyticDefaultReport',attributes,{'tableName':_0x91c8('0x8'),'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 04bae2e..9f08a16 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 _0x4201=['../../config/logger','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x573e20,_0x1191f7){var _0x5037e7=function(_0x17f069){while(--_0x17f069){_0x573e20['push'](_0x573e20['shift']());}};_0x5037e7(++_0x1191f7);}(_0x4201,0x9a));var _0x1420=function(_0x4c978c,_0xbd7d69){_0x4c978c=_0x4c978c-0x0;var _0x48db9c=_0x4201[_0x4c978c];return _0x48db9c;};'use strict';var _=require('lodash');var util=require(_0x1420('0x0'));var moment=require('moment');var BPromise=require(_0x1420('0x1'));var rs=require(_0x1420('0x2'));var fs=require('fs');var Redis=require(_0x1420('0x3'));var db=require(_0x1420('0x4'))['db'];var utils=require(_0x1420('0x5'));var logger=require(_0x1420('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1420('0x7'));var client=jayson[_0x1420('0x8')][_0x1420('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf87a70,_0x335738,_0x2bb5f8){return new BPromise(function(_0x5cabec,_0x37b666){return client['request'](_0xf87a70,_0x2bb5f8)[_0x1420('0xa')](function(_0x5ef510){logger[_0x1420('0xb')](_0x1420('0xc'),_0x335738,_0x1420('0xd'));logger[_0x1420('0xe')](_0x1420('0xf'),_0x335738,_0x1420('0xd'),JSON[_0x1420('0x10')](_0x5ef510));if(_0x5ef510[_0x1420('0x11')]){if(_0x5ef510[_0x1420('0x11')][_0x1420('0x12')]===0x1f4){logger['error'](_0x1420('0xc'),_0x335738,_0x5ef510['error'][_0x1420('0x13')]);return _0x37b666(_0x5ef510[_0x1420('0x11')][_0x1420('0x13')]);}logger[_0x1420('0x11')](_0x1420('0xc'),_0x335738,_0x5ef510['error'][_0x1420('0x13')]);return _0x5cabec(_0x5ef510[_0x1420('0x11')][_0x1420('0x13')]);}else{logger[_0x1420('0xb')](_0x1420('0xc'),_0x335738,_0x1420('0xd'));_0x5cabec(_0x5ef510['result'][_0x1420('0x13')]);}})['catch'](function(_0xccd28){logger[_0x1420('0x11')](_0x1420('0xc'),_0x335738,_0xccd28);_0x37b666(_0xccd28);});});} \ No newline at end of file +var _0xd0c0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','moment'];(function(_0x476ff5,_0x3240f5){var _0x26f2d1=function(_0x409093){while(--_0x409093){_0x476ff5['push'](_0x476ff5['shift']());}};_0x26f2d1(++_0x3240f5);}(_0xd0c0,0x1df));var _0x0d0c=function(_0x442fe7,_0x53a4bd){_0x442fe7=_0x442fe7-0x0;var _0x267e76=_0xd0c0[_0x442fe7];return _0x267e76;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d0c('0x0'));var BPromise=require(_0x0d0c('0x1'));var rs=require(_0x0d0c('0x2'));var fs=require('fs');var Redis=require(_0x0d0c('0x3'));var db=require(_0x0d0c('0x4'))['db'];var utils=require(_0x0d0c('0x5'));var logger=require(_0x0d0c('0x6'))(_0x0d0c('0x7'));var config=require(_0x0d0c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d0c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f81a,_0x5bb79b,_0x5be63b){return new BPromise(function(_0x5cccf7,_0x3c9bae){return client['request'](_0x20f81a,_0x5be63b)[_0x0d0c('0xa')](function(_0x1c6e4c){logger[_0x0d0c('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5bb79b,'request\x20sent');logger[_0x0d0c('0xc')](_0x0d0c('0xd'),_0x5bb79b,_0x0d0c('0xe'),JSON[_0x0d0c('0xf')](_0x1c6e4c));if(_0x1c6e4c[_0x0d0c('0x10')]){if(_0x1c6e4c[_0x0d0c('0x10')][_0x0d0c('0x11')]===0x1f4){logger[_0x0d0c('0x10')](_0x0d0c('0x12'),_0x5bb79b,_0x1c6e4c[_0x0d0c('0x10')][_0x0d0c('0x13')]);return _0x3c9bae(_0x1c6e4c['error'][_0x0d0c('0x13')]);}logger[_0x0d0c('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5bb79b,_0x1c6e4c[_0x0d0c('0x10')][_0x0d0c('0x13')]);return _0x5cccf7(_0x1c6e4c['error']['message']);}else{logger[_0x0d0c('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5bb79b,_0x0d0c('0xe'));_0x5cccf7(_0x1c6e4c['result'][_0x0d0c('0x13')]);}})['catch'](function(_0x36717e){logger[_0x0d0c('0x10')](_0x0d0c('0x12'),_0x5bb79b,_0x36717e);_0x3c9bae(_0x36717e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2d673a4..0a6adf1 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 _0x561d=['isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x4cd447,_0x2f047b){var _0xd869b6=function(_0x2d1245){while(--_0x2d1245){_0x4cd447['push'](_0x4cd447['shift']());}};_0xd869b6(++_0x2f047b);}(_0x561d,0x1f1));var _0xd561=function(_0x1478c3,_0x1b85c1){_0x1478c3=_0x1478c3-0x0;var _0x4c4900=_0x561d[_0x1478c3];return _0x4c4900;};'use strict';var multer=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var path=require(_0xd561('0x2'));var timeout=require(_0xd561('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd561('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd561('0x5'));var config=require(_0xd561('0x6'));var controller=require(_0xd561('0x7'));router[_0xd561('0x8')]('/',auth[_0xd561('0x9')](),controller['index']);router[_0xd561('0x8')](_0xd561('0xa'),auth[_0xd561('0x9')](),controller[_0xd561('0xb')]);router[_0xd561('0x8')](_0xd561('0xc'),auth[_0xd561('0x9')](),controller[_0xd561('0xd')]);router['get'](_0xd561('0xe'),auth[_0xd561('0x9')](),controller[_0xd561('0xf')]);router[_0xd561('0x8')](_0xd561('0x10'),auth['isAuthenticated'](),controller[_0xd561('0x11')]);router[_0xd561('0x12')]('/',auth[_0xd561('0x9')](),controller[_0xd561('0x13')]);router[_0xd561('0x14')](_0xd561('0xa'),auth[_0xd561('0x9')](),controller['update']);router[_0xd561('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xd561('0x16')]);module['exports']=router; \ No newline at end of file +var _0x727a=['/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x4498b9,_0x46369){var _0x5db5c6=function(_0x425868){while(--_0x425868){_0x4498b9['push'](_0x4498b9['shift']());}};_0x5db5c6(++_0x46369);}(_0x727a,0x95));var _0xa727=function(_0x44d6e7,_0xba3d1c){_0x44d6e7=_0x44d6e7-0x0;var _0x13df55=_0x727a[_0x44d6e7];return _0x13df55;};'use strict';var multer=require(_0xa727('0x0'));var util=require(_0xa727('0x1'));var path=require(_0xa727('0x2'));var timeout=require(_0xa727('0x3'));var express=require(_0xa727('0x4'));var router=express[_0xa727('0x5')]();var fs_extra=require(_0xa727('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa727('0x7'));var config=require(_0xa727('0x8'));var controller=require(_0xa727('0x9'));router[_0xa727('0xa')]('/',auth[_0xa727('0xb')](),controller[_0xa727('0xc')]);router[_0xa727('0xa')](_0xa727('0xd'),auth[_0xa727('0xb')](),controller[_0xa727('0xe')]);router[_0xa727('0xa')](_0xa727('0xf'),auth[_0xa727('0xb')](),controller[_0xa727('0x10')]);router[_0xa727('0xa')](_0xa727('0x11'),auth[_0xa727('0xb')](),controller['run']);router[_0xa727('0xa')](_0xa727('0x12'),auth[_0xa727('0xb')](),controller[_0xa727('0x13')]);router[_0xa727('0x14')]('/',auth[_0xa727('0xb')](),controller[_0xa727('0x15')]);router[_0xa727('0x16')](_0xa727('0xd'),auth[_0xa727('0xb')](),controller[_0xa727('0x17')]);router[_0xa727('0x18')](_0xa727('0xd'),auth[_0xa727('0xb')](),controller[_0xa727('0x19')]);module[_0xa727('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 990965e..de94a76 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 _0x500c=['UNSIGNED','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','scheduled','manual'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x500c,0x8d));var _0xc500=function(_0x59c5b5,_0x4be69d){_0x59c5b5=_0x59c5b5-0x0;var _0x5f1787=_0x500c[_0x59c5b5];return _0x5f1787;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xc500('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0xc500('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0xc500('0x1')]('csv',_0xc500('0x2'),_0xc500('0x3')),'allowNull':![],'defaultValue':_0xc500('0x4')},'savename':{'type':Sequelize[_0xc500('0x0')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc500('0x5')]},'endDate':{'type':Sequelize[_0xc500('0x5')]},'status':{'type':Sequelize[_0xc500('0x0')],'defaultValue':_0xc500('0x6')},'type':{'type':Sequelize['ENUM']('manual',_0xc500('0x7')),'allowNull':![],'defaultValue':_0xc500('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc500('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x311d=['INTEGER','UNSIGNED','sequelize','moment','csv','pdf','xlsx','STRING','DATE','Loading','ENUM','manual','scheduled'];(function(_0x8cf7f3,_0x512510){var _0x2a9c72=function(_0x1682ba){while(--_0x1682ba){_0x8cf7f3['push'](_0x8cf7f3['shift']());}};_0x2a9c72(++_0x512510);}(_0x311d,0x120));var _0xd311=function(_0x238504,_0x2acd03){_0x238504=_0x238504-0x0;var _0x1e627f=_0x311d[_0x238504];return _0x1e627f;};'use strict';var Sequelize=require(_0xd311('0x0'));var moment=require(_0xd311('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd311('0x2'),_0xd311('0x3'),_0xd311('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd311('0x5')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd311('0x6')]},'endDate':{'type':Sequelize[_0xd311('0x6')]},'status':{'type':Sequelize[_0xd311('0x5')],'defaultValue':_0xd311('0x7')},'type':{'type':Sequelize[_0xd311('0x8')](_0xd311('0x9'),_0xd311('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd311('0xb')](0xb)[_0xd311('0xc')]},'reportType':{'type':Sequelize[_0xd311('0x5')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c3a5c69..a2f67cd 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 _0x4196=['server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','ExtractedReports','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','params','download','basename','savename','output','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root'];(function(_0x296363,_0x23a01c){var _0xae8db0=function(_0x247cb7){while(--_0x247cb7){_0x296363['push'](_0x296363['shift']());}};_0xae8db0(++_0x23a01c);}(_0x4196,0x12f));var _0x6419=function(_0x8d065b,_0x4c6115){_0x8d065b=_0x8d065b-0x0;var _0x1244e3=_0x4196[_0x8d065b];return _0x1244e3;};'use strict';var emlformat=require(_0x6419('0x0'));var rimraf=require(_0x6419('0x1'));var zipdir=require(_0x6419('0x2'));var jsonpatch=require(_0x6419('0x3'));var rp=require(_0x6419('0x4'));var moment=require(_0x6419('0x5'));var BPromise=require(_0x6419('0x6'));var Mustache=require(_0x6419('0x7'));var util=require(_0x6419('0x8'));var path=require(_0x6419('0x9'));var sox=require(_0x6419('0xa'));var csv=require(_0x6419('0xb'));var ejs=require(_0x6419('0xc'));var fs=require('fs');var fs_extra=require(_0x6419('0xd'));var _=require(_0x6419('0xe'));var squel=require(_0x6419('0xf'));var crypto=require(_0x6419('0x10'));var jsforce=require(_0x6419('0x11'));var deskjs=require(_0x6419('0x12'));var toCsv=require(_0x6419('0xb'));var querystring=require(_0x6419('0x13'));var Papa=require(_0x6419('0x14'));var Redis=require(_0x6419('0x15'));var authService=require(_0x6419('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x6419('0x17'));var hardwareService=require(_0x6419('0x18'));var logger=require('../../config/logger')(_0x6419('0x19'));var utils=require('../../config/utils');var config=require(_0x6419('0x1a'));var licenseUtil=require(_0x6419('0x1b'));var db=require(_0x6419('0x1c'))['db'];function respondWithStatusCode(_0x405bca,_0x141176){_0x141176=_0x141176||0xcc;return function(_0x206484){if(_0x206484){return _0x405bca[_0x6419('0x1d')](_0x141176);}return _0x405bca['status'](_0x141176)['end']();};}function respondWithResult(_0x48fe26,_0x45c3a0){_0x45c3a0=_0x45c3a0||0xc8;return function(_0x37f085){if(_0x37f085){return _0x48fe26[_0x6419('0x1e')](_0x45c3a0)[_0x6419('0x1f')](_0x37f085);}};}function respondWithFilteredResult(_0x5c3486,_0x1cba5e){return function(_0x5d5304){if(_0x5d5304){var _0x59098f=typeof _0x1cba5e[_0x6419('0x20')]===_0x6419('0x21')&&typeof _0x1cba5e[_0x6419('0x22')]==='undefined';var _0x1effb6=_0x5d5304['count'];var _0x260bbe=_0x59098f?0x0:_0x1cba5e[_0x6419('0x20')];var _0x517d89=_0x59098f?_0x5d5304[_0x6419('0x23')]:_0x1cba5e[_0x6419('0x20')]+_0x1cba5e[_0x6419('0x22')];var _0x29146e;if(_0x517d89>=_0x1effb6){_0x517d89=_0x1effb6;_0x29146e=0xc8;}else{_0x29146e=0xce;}_0x5c3486['status'](_0x29146e);return _0x5c3486[_0x6419('0x24')](_0x6419('0x25'),_0x260bbe+'-'+_0x517d89+'/'+_0x1effb6)[_0x6419('0x1f')](_0x5d5304);}return null;};}function patchUpdates(_0x2ef5bd){return function(_0x198a09){try{jsonpatch[_0x6419('0x26')](_0x198a09,_0x2ef5bd,!![]);}catch(_0x5472db){return BPromise[_0x6419('0x27')](_0x5472db);}return _0x198a09['save']();};}function saveUpdates(_0x19c1b9,_0x547c43){return function(_0x4c0be4){if(_0x4c0be4){return _0x4c0be4[_0x6419('0x28')](_0x19c1b9)[_0x6419('0x29')](function(_0x491572){return _0x491572;});}return null;};}function removeEntity(_0x687412,_0x20d3dc){return function(_0x5a2335){if(_0x5a2335){return _0x5a2335[_0x6419('0x2a')]()[_0x6419('0x29')](function(){var _0x1468ef=_0x5a2335['get']({'plain':!![]});var _0x258f5b=_0x6419('0x2b');return db['UserProfileResource'][_0x6419('0x2a')]({'where':{'type':_0x258f5b,'resourceId':_0x1468ef['id']}})[_0x6419('0x29')](function(){return _0x5a2335;});})[_0x6419('0x29')](function(){_0x687412[_0x6419('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e22ae,_0x593ce1){return function(_0x3c48a2){if(!_0x3c48a2){_0x2e22ae[_0x6419('0x1d')](0x194);}return _0x3c48a2;};}function handleError(_0x596234,_0x18e866){_0x18e866=_0x18e866||0x1f4;return function(_0x4283d5){logger[_0x6419('0x2c')](_0x4283d5['stack']);if(_0x4283d5[_0x6419('0x2d')]){delete _0x4283d5['name'];}_0x596234[_0x6419('0x1e')](_0x18e866)[_0x6419('0x2e')](_0x4283d5);};}exports[_0x6419('0x2f')]=function(_0x2ae9f1,_0x2d92d4){var _0x27c763={},_0x2a60be={},_0x32b943={'count':0x0,'rows':[]};var _0xdc6b89=_[_0x6419('0x30')](db[_0x6419('0x31')][_0x6419('0x32')],function(_0x54b3fc){return{'name':_0x54b3fc['fieldName'],'type':_0x54b3fc[_0x6419('0x33')]['key']};});_0x2a60be[_0x6419('0x34')]=_['map'](_0xdc6b89,_0x6419('0x2d'));_0x2a60be['query']=_[_0x6419('0x35')](_0x2ae9f1[_0x6419('0x36')]);_0x2a60be['filters']=_[_0x6419('0x37')](_0x2a60be[_0x6419('0x34')],_0x2a60be[_0x6419('0x36')]);_0x27c763[_0x6419('0x38')]=_[_0x6419('0x37')](_0x2a60be[_0x6419('0x34')],qs[_0x6419('0x39')](_0x2ae9f1['query'][_0x6419('0x39')]));_0x27c763[_0x6419('0x38')]=_0x27c763[_0x6419('0x38')][_0x6419('0x3a')]?_0x27c763[_0x6419('0x38')]:_0x2a60be[_0x6419('0x34')];if(!_0x2ae9f1[_0x6419('0x36')]['hasOwnProperty'](_0x6419('0x3b'))){_0x27c763[_0x6419('0x22')]=qs['limit'](_0x2ae9f1[_0x6419('0x36')][_0x6419('0x22')]);_0x27c763[_0x6419('0x20')]=qs['offset'](_0x2ae9f1[_0x6419('0x36')]['offset']);}_0x27c763[_0x6419('0x3c')]=qs[_0x6419('0x3d')](_0x2ae9f1[_0x6419('0x36')]['sort']);_0x27c763[_0x6419('0x3e')]=qs[_0x6419('0x3f')](_[_0x6419('0x40')](_0x2ae9f1['query'],_0x2a60be[_0x6419('0x3f')]),_0xdc6b89);if(_0x2ae9f1[_0x6419('0x36')][_0x6419('0x41')]){_0x27c763[_0x6419('0x3e')]=_[_0x6419('0x42')](_0x27c763[_0x6419('0x3e')],{'$or':_[_0x6419('0x30')](_0xdc6b89,function(_0x2ebb9f){if(_0x2ebb9f[_0x6419('0x33')]!==_0x6419('0x43')){var _0x152187={};_0x152187[_0x2ebb9f[_0x6419('0x2d')]]={'$like':'%'+_0x2ae9f1['query'][_0x6419('0x41')]+'%'};return _0x152187;}})});}_0x27c763=_['merge']({},_0x27c763,_0x2ae9f1[_0x6419('0x44')]);var _0x3cc8b4={'where':_0x27c763[_0x6419('0x3e')]};return db[_0x6419('0x31')][_0x6419('0x23')](_0x3cc8b4)[_0x6419('0x29')](function(_0x503c8d){_0x32b943['count']=_0x503c8d;if(_0x2ae9f1[_0x6419('0x36')][_0x6419('0x45')]){_0x27c763[_0x6419('0x46')]=[{'all':!![]}];}return db[_0x6419('0x31')][_0x6419('0x47')](_0x27c763);})[_0x6419('0x29')](function(_0xb8a0fd){_0x32b943[_0x6419('0x48')]=_0xb8a0fd;return _0x32b943;})['then'](respondWithFilteredResult(_0x2d92d4,_0x27c763))[_0x6419('0x49')](handleError(_0x2d92d4,null));};exports[_0x6419('0x4a')]=function(_0x5832c0,_0x4f0ff3){var _0x5d92c5={'raw':!![],'where':{'id':_0x5832c0['params']['id']}},_0x3bc34d={};_0x3bc34d[_0x6419('0x34')]=_[_0x6419('0x35')](db['AnalyticExtractedReport'][_0x6419('0x32')]);_0x3bc34d[_0x6419('0x36')]=_[_0x6419('0x35')](_0x5832c0[_0x6419('0x36')]);_0x3bc34d[_0x6419('0x3f')]=_[_0x6419('0x37')](_0x3bc34d[_0x6419('0x34')],_0x3bc34d['query']);_0x5d92c5['attributes']=_[_0x6419('0x37')](_0x3bc34d[_0x6419('0x34')],qs[_0x6419('0x39')](_0x5832c0[_0x6419('0x36')][_0x6419('0x39')]));_0x5d92c5[_0x6419('0x38')]=_0x5d92c5['attributes'][_0x6419('0x3a')]?_0x5d92c5[_0x6419('0x38')]:_0x3bc34d['model'];if(_0x5832c0[_0x6419('0x36')][_0x6419('0x45')]){_0x5d92c5[_0x6419('0x46')]=[{'all':!![]}];}_0x5d92c5=_[_0x6419('0x42')]({},_0x5d92c5,_0x5832c0['options']);return db['AnalyticExtractedReport']['find'](_0x5d92c5)[_0x6419('0x29')](handleEntityNotFound(_0x4f0ff3,null))[_0x6419('0x29')](respondWithResult(_0x4f0ff3,null))[_0x6419('0x49')](handleError(_0x4f0ff3,null));};exports[_0x6419('0x4b')]=function(_0x5314a8,_0x1a21d5){return db[_0x6419('0x31')][_0x6419('0x4b')](_0x5314a8['body'],{})[_0x6419('0x29')](function(_0x4f438d){var _0x3d7cb2=_0x5314a8[_0x6419('0x4c')][_0x6419('0x4d')]({'plain':!![]});if(!_0x3d7cb2)throw new Error(_0x6419('0x4e'));if(_0x3d7cb2[_0x6419('0x4f')]===_0x6419('0x4c')){var _0xa557c3=_0x4f438d[_0x6419('0x4d')]({'plain':!![]});var _0x265f8d=_0x6419('0x2b');return db[_0x6419('0x50')][_0x6419('0x51')]({'where':{'name':_0x265f8d,'userProfileId':_0x3d7cb2[_0x6419('0x52')]},'raw':!![]})['then'](function(_0x112221){if(_0x112221&&_0x112221[_0x6419('0x53')]===0x0){return db[_0x6419('0x54')][_0x6419('0x4b')]({'name':_0xa557c3[_0x6419('0x2d')],'resourceId':_0xa557c3['id'],'type':_0x112221[_0x6419('0x2d')],'sectionId':_0x112221['id']},{})[_0x6419('0x29')](function(){return _0x4f438d;});}else{return _0x4f438d;}})[_0x6419('0x49')](function(_0x53a9f6){logger[_0x6419('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53a9f6);throw _0x53a9f6;});}return _0x4f438d;})[_0x6419('0x29')](respondWithResult(_0x1a21d5,0xc9))[_0x6419('0x49')](handleError(_0x1a21d5,null));};exports[_0x6419('0x28')]=function(_0x523a87,_0x1e1668){if(_0x523a87[_0x6419('0x55')]['id']){delete _0x523a87['body']['id'];}return db[_0x6419('0x31')]['find']({'where':{'id':_0x523a87['params']['id']}})['then'](handleEntityNotFound(_0x1e1668,null))[_0x6419('0x29')](saveUpdates(_0x523a87['body'],null))[_0x6419('0x29')](respondWithResult(_0x1e1668,null))[_0x6419('0x49')](handleError(_0x1e1668,null));};exports['destroy']=function(_0x4c7d9f,_0x57295f){return db[_0x6419('0x31')][_0x6419('0x51')]({'where':{'id':_0x4c7d9f[_0x6419('0x56')]['id']}})[_0x6419('0x29')](handleEntityNotFound(_0x57295f,null))[_0x6419('0x29')](removeEntity(_0x57295f,null))['catch'](handleError(_0x57295f,null));};exports[_0x6419('0x57')]=function(_0x1956db,_0x3bf3cc,_0x5e2cdb){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1956db[_0x6419('0x56')]['id']},'attributes':[_0x6419('0x2d'),_0x6419('0x58'),_0x6419('0x59'),_0x6419('0x5a')],'raw':!![]})[_0x6419('0x29')](handleEntityNotFound(_0x3bf3cc,null))[_0x6419('0x29')](function(_0x31755b){if(_0x31755b){if(!fs['existsSync'](path[_0x6419('0x5b')](config['root'],'server/files/reports',_0x31755b[_0x6419('0x59')]))){throw new db[(_0x6419('0x5c'))][(_0x6419('0x5d'))](_0x6419('0x5e'));}if(_0x1956db[_0x6419('0x36')][_0x6419('0x5f')]){return _0x3bf3cc[_0x6419('0x1d')](0xc8);}return _0x3bf3cc[_0x6419('0x57')](path[_0x6419('0x5b')](config[_0x6419('0x60')],_0x6419('0x61'),_0x31755b['savename']),util[_0x6419('0x62')](_0x6419('0x63'),_0x31755b['basename']||_0x31755b[_0x6419('0x2d')],_0x31755b['output']['toLowerCase']()));}})['catch'](handleError(_0x3bf3cc,null));}; \ No newline at end of file +var _0x1a1d=['query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','AnalyticExtractedReport','include','rows','show','includeAll','find','catch','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','status','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model'];(function(_0x1a8ece,_0x455fa9){var _0x4054ac=function(_0x56a673){while(--_0x56a673){_0x1a8ece['push'](_0x1a8ece['shift']());}};_0x4054ac(++_0x455fa9);}(_0x1a1d,0x162));var _0xd1a1=function(_0x4128da,_0x28312e){_0x4128da=_0x4128da-0x0;var _0x265cfa=_0x1a1d[_0x4128da];return _0x265cfa;};'use strict';var emlformat=require(_0xd1a1('0x0'));var rimraf=require(_0xd1a1('0x1'));var zipdir=require(_0xd1a1('0x2'));var jsonpatch=require(_0xd1a1('0x3'));var rp=require(_0xd1a1('0x4'));var moment=require(_0xd1a1('0x5'));var BPromise=require(_0xd1a1('0x6'));var Mustache=require(_0xd1a1('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd1a1('0x8'));var csv=require('to-csv');var ejs=require(_0xd1a1('0x9'));var fs=require('fs');var fs_extra=require(_0xd1a1('0xa'));var _=require(_0xd1a1('0xb'));var squel=require('squel');var crypto=require(_0xd1a1('0xc'));var jsforce=require(_0xd1a1('0xd'));var deskjs=require(_0xd1a1('0xe'));var toCsv=require(_0xd1a1('0xf'));var querystring=require(_0xd1a1('0x10'));var Papa=require(_0xd1a1('0x11'));var Redis=require(_0xd1a1('0x12'));var authService=require(_0xd1a1('0x13'));var qs=require(_0xd1a1('0x14'));var as=require(_0xd1a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1a1('0x16'))(_0xd1a1('0x17'));var utils=require(_0xd1a1('0x18'));var config=require(_0xd1a1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1a1('0x1a'))['db'];function respondWithStatusCode(_0x396390,_0x1a43d9){_0x1a43d9=_0x1a43d9||0xcc;return function(_0x17c9f5){if(_0x17c9f5){return _0x396390['sendStatus'](_0x1a43d9);}return _0x396390['status'](_0x1a43d9)[_0xd1a1('0x1b')]();};}function respondWithResult(_0x457980,_0x3734b3){_0x3734b3=_0x3734b3||0xc8;return function(_0xe08061){if(_0xe08061){return _0x457980['status'](_0x3734b3)['json'](_0xe08061);}};}function respondWithFilteredResult(_0x320eef,_0x5368f8){return function(_0xc60c22){if(_0xc60c22){var _0x4b9d5f=typeof _0x5368f8[_0xd1a1('0x1c')]===_0xd1a1('0x1d')&&typeof _0x5368f8[_0xd1a1('0x1e')]==='undefined';var _0x2fc8b9=_0xc60c22[_0xd1a1('0x1f')];var _0x2be5bb=_0x4b9d5f?0x0:_0x5368f8['offset'];var _0x2a5c7a=_0x4b9d5f?_0xc60c22[_0xd1a1('0x1f')]:_0x5368f8['offset']+_0x5368f8[_0xd1a1('0x1e')];var _0x1bab5f;if(_0x2a5c7a>=_0x2fc8b9){_0x2a5c7a=_0x2fc8b9;_0x1bab5f=0xc8;}else{_0x1bab5f=0xce;}_0x320eef['status'](_0x1bab5f);return _0x320eef[_0xd1a1('0x20')](_0xd1a1('0x21'),_0x2be5bb+'-'+_0x2a5c7a+'/'+_0x2fc8b9)[_0xd1a1('0x22')](_0xc60c22);}return null;};}function patchUpdates(_0x126b42){return function(_0x116e49){try{jsonpatch[_0xd1a1('0x23')](_0x116e49,_0x126b42,!![]);}catch(_0x4e7dde){return BPromise[_0xd1a1('0x24')](_0x4e7dde);}return _0x116e49[_0xd1a1('0x25')]();};}function saveUpdates(_0x4766f4,_0x5cc555){return function(_0xf2fcd6){if(_0xf2fcd6){return _0xf2fcd6[_0xd1a1('0x26')](_0x4766f4)[_0xd1a1('0x27')](function(_0x31fd21){return _0x31fd21;});}return null;};}function removeEntity(_0x11e3bd,_0x2a318c){return function(_0xecefc0){if(_0xecefc0){return _0xecefc0[_0xd1a1('0x28')]()['then'](function(){var _0x5d22a0=_0xecefc0['get']({'plain':!![]});var _0x11c0b6='ExtractedReports';return db[_0xd1a1('0x29')][_0xd1a1('0x28')]({'where':{'type':_0x11c0b6,'resourceId':_0x5d22a0['id']}})[_0xd1a1('0x27')](function(){return _0xecefc0;});})[_0xd1a1('0x27')](function(){_0x11e3bd[_0xd1a1('0x2a')](0xcc)[_0xd1a1('0x1b')]();});}};}function handleEntityNotFound(_0xdced9,_0x11f705){return function(_0x7d81e7){if(!_0x7d81e7){_0xdced9[_0xd1a1('0x2b')](0x194);}return _0x7d81e7;};}function handleError(_0x2dcbcb,_0xb2496){_0xb2496=_0xb2496||0x1f4;return function(_0x1cdc5f){logger[_0xd1a1('0x2c')](_0x1cdc5f[_0xd1a1('0x2d')]);if(_0x1cdc5f[_0xd1a1('0x2e')]){delete _0x1cdc5f[_0xd1a1('0x2e')];}_0x2dcbcb[_0xd1a1('0x2a')](_0xb2496)[_0xd1a1('0x2f')](_0x1cdc5f);};}exports[_0xd1a1('0x30')]=function(_0x5121ad,_0x401634){var _0x4237a7={},_0x14c3ac={},_0x4fbac9={'count':0x0,'rows':[]};var _0x183bcd=_[_0xd1a1('0x31')](db['AnalyticExtractedReport'][_0xd1a1('0x32')],function(_0x609c1){return{'name':_0x609c1[_0xd1a1('0x33')],'type':_0x609c1[_0xd1a1('0x34')]['key']};});_0x14c3ac[_0xd1a1('0x35')]=_['map'](_0x183bcd,_0xd1a1('0x2e'));_0x14c3ac[_0xd1a1('0x36')]=_[_0xd1a1('0x37')](_0x5121ad[_0xd1a1('0x36')]);_0x14c3ac['filters']=_['intersection'](_0x14c3ac[_0xd1a1('0x35')],_0x14c3ac['query']);_0x4237a7[_0xd1a1('0x38')]=_[_0xd1a1('0x39')](_0x14c3ac['model'],qs['fields'](_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x3a')]));_0x4237a7[_0xd1a1('0x38')]=_0x4237a7[_0xd1a1('0x38')][_0xd1a1('0x3b')]?_0x4237a7['attributes']:_0x14c3ac[_0xd1a1('0x35')];if(!_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x3c')]('nolimit')){_0x4237a7[_0xd1a1('0x1e')]=qs['limit'](_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x1e')]);_0x4237a7[_0xd1a1('0x1c')]=qs[_0xd1a1('0x1c')](_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x1c')]);}_0x4237a7[_0xd1a1('0x3d')]=qs[_0xd1a1('0x3e')](_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x3e')]);_0x4237a7['where']=qs[_0xd1a1('0x3f')](_[_0xd1a1('0x40')](_0x5121ad[_0xd1a1('0x36')],_0x14c3ac[_0xd1a1('0x3f')]),_0x183bcd);if(_0x5121ad[_0xd1a1('0x36')][_0xd1a1('0x41')]){_0x4237a7[_0xd1a1('0x42')]=_[_0xd1a1('0x43')](_0x4237a7[_0xd1a1('0x42')],{'$or':_[_0xd1a1('0x31')](_0x183bcd,function(_0x55548c){if(_0x55548c['type']!==_0xd1a1('0x44')){var _0x22a54b={};_0x22a54b[_0x55548c['name']]={'$like':'%'+_0x5121ad[_0xd1a1('0x36')]['filter']+'%'};return _0x22a54b;}})});}_0x4237a7=_[_0xd1a1('0x43')]({},_0x4237a7,_0x5121ad[_0xd1a1('0x45')]);var _0x3d0efb={'where':_0x4237a7['where']};return db[_0xd1a1('0x46')][_0xd1a1('0x1f')](_0x3d0efb)[_0xd1a1('0x27')](function(_0x1a1b02){_0x4fbac9[_0xd1a1('0x1f')]=_0x1a1b02;if(_0x5121ad['query']['includeAll']){_0x4237a7[_0xd1a1('0x47')]=[{'all':!![]}];}return db[_0xd1a1('0x46')]['findAll'](_0x4237a7);})[_0xd1a1('0x27')](function(_0x35133a){_0x4fbac9[_0xd1a1('0x48')]=_0x35133a;return _0x4fbac9;})[_0xd1a1('0x27')](respondWithFilteredResult(_0x401634,_0x4237a7))['catch'](handleError(_0x401634,null));};exports[_0xd1a1('0x49')]=function(_0x293b34,_0x4947bf){var _0x1419b8={'raw':!![],'where':{'id':_0x293b34['params']['id']}},_0x15ff62={};_0x15ff62[_0xd1a1('0x35')]=_[_0xd1a1('0x37')](db[_0xd1a1('0x46')][_0xd1a1('0x32')]);_0x15ff62['query']=_[_0xd1a1('0x37')](_0x293b34[_0xd1a1('0x36')]);_0x15ff62[_0xd1a1('0x3f')]=_[_0xd1a1('0x39')](_0x15ff62['model'],_0x15ff62['query']);_0x1419b8[_0xd1a1('0x38')]=_[_0xd1a1('0x39')](_0x15ff62[_0xd1a1('0x35')],qs[_0xd1a1('0x3a')](_0x293b34[_0xd1a1('0x36')][_0xd1a1('0x3a')]));_0x1419b8['attributes']=_0x1419b8[_0xd1a1('0x38')][_0xd1a1('0x3b')]?_0x1419b8[_0xd1a1('0x38')]:_0x15ff62[_0xd1a1('0x35')];if(_0x293b34[_0xd1a1('0x36')][_0xd1a1('0x4a')]){_0x1419b8[_0xd1a1('0x47')]=[{'all':!![]}];}_0x1419b8=_['merge']({},_0x1419b8,_0x293b34['options']);return db[_0xd1a1('0x46')][_0xd1a1('0x4b')](_0x1419b8)[_0xd1a1('0x27')](handleEntityNotFound(_0x4947bf,null))[_0xd1a1('0x27')](respondWithResult(_0x4947bf,null))[_0xd1a1('0x4c')](handleError(_0x4947bf,null));};exports['create']=function(_0x343b84,_0x5a4f1e){return db[_0xd1a1('0x46')]['create'](_0x343b84[_0xd1a1('0x4d')],{})[_0xd1a1('0x27')](function(_0x2716ae){var _0x34cfe5=_0x343b84['user'][_0xd1a1('0x4e')]({'plain':!![]});if(!_0x34cfe5)throw new Error(_0xd1a1('0x4f'));if(_0x34cfe5['role']===_0xd1a1('0x50')){var _0x484594=_0x2716ae[_0xd1a1('0x4e')]({'plain':!![]});var _0x1227be='ExtractedReports';return db[_0xd1a1('0x51')][_0xd1a1('0x4b')]({'where':{'name':_0x1227be,'userProfileId':_0x34cfe5[_0xd1a1('0x52')]},'raw':!![]})[_0xd1a1('0x27')](function(_0x30ac27){if(_0x30ac27&&_0x30ac27[_0xd1a1('0x53')]===0x0){return db[_0xd1a1('0x29')][_0xd1a1('0x54')]({'name':_0x484594[_0xd1a1('0x2e')],'resourceId':_0x484594['id'],'type':_0x30ac27[_0xd1a1('0x2e')],'sectionId':_0x30ac27['id']},{})['then'](function(){return _0x2716ae;});}else{return _0x2716ae;}})[_0xd1a1('0x4c')](function(_0x4efb34){logger[_0xd1a1('0x2c')](_0xd1a1('0x55'),_0x4efb34);throw _0x4efb34;});}return _0x2716ae;})[_0xd1a1('0x27')](respondWithResult(_0x5a4f1e,0xc9))['catch'](handleError(_0x5a4f1e,null));};exports[_0xd1a1('0x26')]=function(_0x47d93a,_0x451f69){if(_0x47d93a[_0xd1a1('0x4d')]['id']){delete _0x47d93a[_0xd1a1('0x4d')]['id'];}return db[_0xd1a1('0x46')][_0xd1a1('0x4b')]({'where':{'id':_0x47d93a['params']['id']}})[_0xd1a1('0x27')](handleEntityNotFound(_0x451f69,null))[_0xd1a1('0x27')](saveUpdates(_0x47d93a[_0xd1a1('0x4d')],null))[_0xd1a1('0x27')](respondWithResult(_0x451f69,null))[_0xd1a1('0x4c')](handleError(_0x451f69,null));};exports[_0xd1a1('0x28')]=function(_0x5e3446,_0x453c94){return db[_0xd1a1('0x46')]['find']({'where':{'id':_0x5e3446[_0xd1a1('0x56')]['id']}})[_0xd1a1('0x27')](handleEntityNotFound(_0x453c94,null))[_0xd1a1('0x27')](removeEntity(_0x453c94,null))['catch'](handleError(_0x453c94,null));};exports['download']=function(_0x3de162,_0x48ea98,_0x45589e){return db[_0xd1a1('0x46')]['find']({'where':{'id':_0x3de162['params']['id']},'attributes':[_0xd1a1('0x2e'),_0xd1a1('0x57'),_0xd1a1('0x58'),_0xd1a1('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x48ea98,null))['then'](function(_0x193a51){if(_0x193a51){if(!fs[_0xd1a1('0x5a')](path[_0xd1a1('0x5b')](config[_0xd1a1('0x5c')],_0xd1a1('0x5d'),_0x193a51[_0xd1a1('0x58')]))){throw new db[(_0xd1a1('0x5e'))][(_0xd1a1('0x5f'))](_0xd1a1('0x60'));}if(_0x3de162[_0xd1a1('0x36')][_0xd1a1('0x61')]){return _0x48ea98[_0xd1a1('0x2b')](0xc8);}return _0x48ea98[_0xd1a1('0x62')](path[_0xd1a1('0x5b')](config[_0xd1a1('0x5c')],_0xd1a1('0x5d'),_0x193a51[_0xd1a1('0x58')]),util[_0xd1a1('0x63')](_0xd1a1('0x64'),_0x193a51[_0xd1a1('0x57')]||_0x193a51[_0xd1a1('0x2e')],_0x193a51[_0xd1a1('0x59')][_0xd1a1('0x65')]()));}})[_0xd1a1('0x4c')](handleError(_0x48ea98,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7b6569c..7d3699e 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 _0x8931=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x8931,0xd7));var _0x1893=function(_0x4dd585,_0x185434){_0x4dd585=_0x4dd585-0x0;var _0x426a25=_0x8931[_0x4dd585];return _0x426a25;};'use strict';var _=require(_0x1893('0x0'));var util=require('util');var logger=require(_0x1893('0x1'))(_0x1893('0x2'));var moment=require(_0x1893('0x3'));var BPromise=require(_0x1893('0x4'));var rp=require(_0x1893('0x5'));var fs=require('fs');var path=require(_0x1893('0x6'));var rimraf=require(_0x1893('0x7'));var config=require(_0x1893('0x8'));var attributes=require(_0x1893('0x9'));module[_0x1893('0xa')]=function(_0x49821c,_0x150126){return _0x49821c[_0x1893('0xb')](_0x1893('0xc'),attributes,{'tableName':_0x1893('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9175=['bluebird','request-promise','path','rimraf','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x2472e9,_0x22c4d9){var _0x31fa16=function(_0x10496a){while(--_0x10496a){_0x2472e9['push'](_0x2472e9['shift']());}};_0x31fa16(++_0x22c4d9);}(_0x9175,0x8b));var _0x5917=function(_0x26f2a0,_0x421b26){_0x26f2a0=_0x26f2a0-0x0;var _0x2f8f6e=_0x9175[_0x26f2a0];return _0x2f8f6e;};'use strict';var _=require(_0x5917('0x0'));var util=require(_0x5917('0x1'));var logger=require(_0x5917('0x2'))(_0x5917('0x3'));var moment=require(_0x5917('0x4'));var BPromise=require(_0x5917('0x5'));var rp=require(_0x5917('0x6'));var fs=require('fs');var path=require(_0x5917('0x7'));var rimraf=require(_0x5917('0x8'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x29cf72,_0x51e5c2){return _0x29cf72[_0x5917('0x9')](_0x5917('0xa'),attributes,{'tableName':_0x5917('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index f54cbd7..5df1113 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 _0xd9ee=['code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x437b14,_0xcf17d4){var _0x1ad24e=function(_0x44b236){while(--_0x44b236){_0x437b14['push'](_0x437b14['shift']());}};_0x1ad24e(++_0xcf17d4);}(_0xd9ee,0x9f));var _0xed9e=function(_0x273735,_0x1bab2a){_0x273735=_0x273735-0x0;var _0x556e6a=_0xd9ee[_0x273735];return _0x556e6a;};'use strict';var _=require(_0xed9e('0x0'));var util=require('util');var moment=require(_0xed9e('0x1'));var BPromise=require('bluebird');var rs=require(_0xed9e('0x2'));var fs=require('fs');var Redis=require(_0xed9e('0x3'));var db=require(_0xed9e('0x4'))['db'];var utils=require(_0xed9e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xed9e('0x6'));var client=jayson[_0xed9e('0x7')][_0xed9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48167a,_0x12e175,_0x19413e){return new BPromise(function(_0x581399,_0x4f84c5){return client[_0xed9e('0x9')](_0x48167a,_0x19413e)[_0xed9e('0xa')](function(_0x330d13){logger['info'](_0xed9e('0xb'),_0x12e175,_0xed9e('0xc'));logger[_0xed9e('0xd')](_0xed9e('0xe'),_0x12e175,_0xed9e('0xc'),JSON[_0xed9e('0xf')](_0x330d13));if(_0x330d13[_0xed9e('0x10')]){if(_0x330d13[_0xed9e('0x10')][_0xed9e('0x11')]===0x1f4){logger[_0xed9e('0x10')](_0xed9e('0xb'),_0x12e175,_0x330d13[_0xed9e('0x10')][_0xed9e('0x12')]);return _0x4f84c5(_0x330d13['error'][_0xed9e('0x12')]);}logger[_0xed9e('0x10')](_0xed9e('0xb'),_0x12e175,_0x330d13[_0xed9e('0x10')][_0xed9e('0x12')]);return _0x581399(_0x330d13['error'][_0xed9e('0x12')]);}else{logger[_0xed9e('0x13')](_0xed9e('0xb'),_0x12e175,'request\x20sent');_0x581399(_0x330d13[_0xed9e('0x14')][_0xed9e('0x12')]);}})[_0xed9e('0x15')](function(_0x5a2a2c){logger['error'](_0xed9e('0xb'),_0x12e175,_0x5a2a2c);_0x4f84c5(_0x5a2a2c);});});} \ No newline at end of file +var _0x5bd4=['../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5bd4,0x163));var _0x45bd=function(_0x1528bd,_0x1877c0){_0x1528bd=_0x1528bd-0x0;var _0x487532=_0x5bd4[_0x1528bd];return _0x487532;};'use strict';var _=require(_0x45bd('0x0'));var util=require(_0x45bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45bd('0x3'))['db'];var utils=require(_0x45bd('0x4'));var logger=require(_0x45bd('0x5'))('rpc');var config=require(_0x45bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x45bd('0x7')][_0x45bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ad32d,_0x3321c5,_0x30725c){return new BPromise(function(_0x4c867d,_0x54411b){return client['request'](_0x5ad32d,_0x30725c)[_0x45bd('0x9')](function(_0x219771){logger[_0x45bd('0xa')](_0x45bd('0xb'),_0x3321c5,'request\x20sent');logger[_0x45bd('0xc')](_0x45bd('0xd'),_0x3321c5,_0x45bd('0xe'),JSON[_0x45bd('0xf')](_0x219771));if(_0x219771[_0x45bd('0x10')]){if(_0x219771['error'][_0x45bd('0x11')]===0x1f4){logger[_0x45bd('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3321c5,_0x219771['error'][_0x45bd('0x12')]);return _0x54411b(_0x219771[_0x45bd('0x10')][_0x45bd('0x12')]);}logger[_0x45bd('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3321c5,_0x219771[_0x45bd('0x10')][_0x45bd('0x12')]);return _0x4c867d(_0x219771[_0x45bd('0x10')]['message']);}else{logger[_0x45bd('0xa')](_0x45bd('0xb'),_0x3321c5,_0x45bd('0xe'));_0x4c867d(_0x219771['result'][_0x45bd('0x12')]);}})['catch'](function(_0x477a6c){logger[_0x45bd('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3321c5,_0x477a6c);_0x54411b(_0x477a6c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 13da06a..75a8d8d 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 _0xce4d=['../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fb6e9,_0x171e19){var _0x2cd8a4=function(_0x1b8186){while(--_0x1b8186){_0x2fb6e9['push'](_0x2fb6e9['shift']());}};_0x2cd8a4(++_0x171e19);}(_0xce4d,0x1c1));var _0xdce4=function(_0x2e8b3c,_0x55d919){_0x2e8b3c=_0x2e8b3c-0x0;var _0x4c0db3=_0xce4d[_0x2e8b3c];return _0x4c0db3;};'use strict';var multer=require(_0xdce4('0x0'));var util=require('util');var path=require(_0xdce4('0x1'));var timeout=require(_0xdce4('0x2'));var express=require('express');var router=express[_0xdce4('0x3')]();var fs_extra=require(_0xdce4('0x4'));var auth=require(_0xdce4('0x5'));var interaction=require(_0xdce4('0x6'));var config=require(_0xdce4('0x7'));var controller=require(_0xdce4('0x8'));router[_0xdce4('0x9')]('/',auth[_0xdce4('0xa')](),controller['index']);router[_0xdce4('0x9')](_0xdce4('0xb'),auth[_0xdce4('0xa')](),controller['show']);router[_0xdce4('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xdce4('0xc')]);router[_0xdce4('0xd')]('/',auth['isAuthenticated'](),controller[_0xdce4('0xe')]);router['put'](_0xdce4('0xb'),auth['isAuthenticated'](),controller[_0xdce4('0xf')]);router[_0xdce4('0x10')](_0xdce4('0xb'),auth[_0xdce4('0xa')](),controller[_0xdce4('0x11')]);module[_0xdce4('0x12')]=router; \ No newline at end of file +var _0x223a=['/:id','show','/:id/download','download','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x240ce8,_0x221fed){var _0x27b9aa=function(_0x1d7ba8){while(--_0x1d7ba8){_0x240ce8['push'](_0x240ce8['shift']());}};_0x27b9aa(++_0x221fed);}(_0x223a,0x169));var _0xa223=function(_0x2ad3c4,_0x876bc2){_0x2ad3c4=_0x2ad3c4-0x0;var _0x169809=_0x223a[_0x2ad3c4];return _0x169809;};'use strict';var multer=require(_0xa223('0x0'));var util=require(_0xa223('0x1'));var path=require('path');var timeout=require(_0xa223('0x2'));var express=require(_0xa223('0x3'));var router=express[_0xa223('0x4')]();var fs_extra=require(_0xa223('0x5'));var auth=require(_0xa223('0x6'));var interaction=require(_0xa223('0x7'));var config=require(_0xa223('0x8'));var controller=require(_0xa223('0x9'));router[_0xa223('0xa')]('/',auth[_0xa223('0xb')](),controller[_0xa223('0xc')]);router[_0xa223('0xa')](_0xa223('0xd'),auth['isAuthenticated'](),controller[_0xa223('0xe')]);router['get'](_0xa223('0xf'),auth[_0xa223('0xb')](),controller[_0xa223('0x10')]);router[_0xa223('0x11')]('/',auth['isAuthenticated'](),controller[_0xa223('0x12')]);router[_0xa223('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa223('0x14')]);router[_0xa223('0x15')]('/:id',auth[_0xa223('0xb')](),controller['destroy']);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 0d758f7..fc6e6fb 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 _0x6859=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4a4f76,_0x2d5197){var _0x38e238=function(_0x4441d6){while(--_0x4441d6){_0x4a4f76['push'](_0x4a4f76['shift']());}};_0x38e238(++_0x2d5197);}(_0x6859,0x7d));var _0x9685=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x6859[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0x9685('0x0'));module[_0x9685('0x1')]={'field':{'type':Sequelize[_0x9685('0x2')]},'alias':{'type':Sequelize[_0x9685('0x3')]},'function':{'type':Sequelize[_0x9685('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9685('0x3')]},'custom':{'type':Sequelize[_0x9685('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x34aa=['STRING','BOOLEAN','exports'];(function(_0x24c53d,_0x1b0e1a){var _0x5438f8=function(_0x10b107){while(--_0x10b107){_0x24c53d['push'](_0x24c53d['shift']());}};_0x5438f8(++_0x1b0e1a);}(_0x34aa,0x197));var _0xa34a=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x34aa[_0x15a634];return _0xf4f7a0;};'use strict';var Sequelize=require('sequelize');module[_0xa34a('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xa34a('0x1')]},'format':{'type':Sequelize[_0xa34a('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa34a('0x1')]},'custom':{'type':Sequelize[_0xa34a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 59e2242..860a719 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 _0x150d=['desk.js','to-csv','querystring','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','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','AnalyticFieldReport','fieldName','type','key','map','keys','filters','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','rows','catch','show','params','intersection','includeAll','include','find','create','body','bulkCreate','bulkDestroy','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto'];(function(_0x186bb5,_0x5f494c){var _0x2e167a=function(_0x5bfb1){while(--_0x5bfb1){_0x186bb5['push'](_0x186bb5['shift']());}};_0x2e167a(++_0x5f494c);}(_0x150d,0x1d9));var _0xd150=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x150d[_0xc82d1a];return _0x32fad2;};'use strict';var emlformat=require(_0xd150('0x0'));var rimraf=require(_0xd150('0x1'));var zipdir=require(_0xd150('0x2'));var jsonpatch=require(_0xd150('0x3'));var rp=require(_0xd150('0x4'));var moment=require(_0xd150('0x5'));var BPromise=require(_0xd150('0x6'));var Mustache=require(_0xd150('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd150('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd150('0x9'));var _=require(_0xd150('0xa'));var squel=require(_0xd150('0xb'));var crypto=require(_0xd150('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd150('0xd'));var toCsv=require(_0xd150('0xe'));var querystring=require(_0xd150('0xf'));var Papa=require(_0xd150('0x10'));var Redis=require(_0xd150('0x11'));var authService=require(_0xd150('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd150('0x13'));var hardwareService=require(_0xd150('0x14'));var logger=require(_0xd150('0x15'))(_0xd150('0x16'));var utils=require(_0xd150('0x17'));var config=require(_0xd150('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd150('0x19'))['db'];function respondWithStatusCode(_0x170cb1,_0x4bdb85){_0x4bdb85=_0x4bdb85||0xcc;return function(_0x18ee63){if(_0x18ee63){return _0x170cb1[_0xd150('0x1a')](_0x4bdb85);}return _0x170cb1[_0xd150('0x1b')](_0x4bdb85)[_0xd150('0x1c')]();};}function respondWithResult(_0x20e974,_0x55fdf2){_0x55fdf2=_0x55fdf2||0xc8;return function(_0x39e634){if(_0x39e634){return _0x20e974['status'](_0x55fdf2)[_0xd150('0x1d')](_0x39e634);}};}function respondWithFilteredResult(_0x408829,_0x3cabf8){return function(_0x5024de){if(_0x5024de){var _0x5cc437=typeof _0x3cabf8[_0xd150('0x1e')]===_0xd150('0x1f')&&typeof _0x3cabf8[_0xd150('0x20')]===_0xd150('0x1f');var _0x30af0c=_0x5024de[_0xd150('0x21')];var _0x510339=_0x5cc437?0x0:_0x3cabf8[_0xd150('0x1e')];var _0x3e2c10=_0x5cc437?_0x5024de[_0xd150('0x21')]:_0x3cabf8['offset']+_0x3cabf8[_0xd150('0x20')];var _0x5a9c65;if(_0x3e2c10>=_0x30af0c){_0x3e2c10=_0x30af0c;_0x5a9c65=0xc8;}else{_0x5a9c65=0xce;}_0x408829[_0xd150('0x1b')](_0x5a9c65);return _0x408829['set'](_0xd150('0x22'),_0x510339+'-'+_0x3e2c10+'/'+_0x30af0c)[_0xd150('0x1d')](_0x5024de);}return null;};}function patchUpdates(_0x33b53e){return function(_0x5a673b){try{jsonpatch[_0xd150('0x23')](_0x5a673b,_0x33b53e,!![]);}catch(_0x186c22){return BPromise[_0xd150('0x24')](_0x186c22);}return _0x5a673b[_0xd150('0x25')]();};}function saveUpdates(_0x2506fc,_0x2c8742){return function(_0x5cff7e){if(_0x5cff7e){return _0x5cff7e[_0xd150('0x26')](_0x2506fc)[_0xd150('0x27')](function(_0xb14f69){return _0xb14f69;});}return null;};}function removeEntity(_0x588794,_0x12cafe){return function(_0x69ce7d){if(_0x69ce7d){return _0x69ce7d[_0xd150('0x28')]()[_0xd150('0x27')](function(){_0x588794[_0xd150('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1383d5,_0x5f4670){return function(_0x1f5cf8){if(!_0x1f5cf8){_0x1383d5['sendStatus'](0x194);}return _0x1f5cf8;};}function handleError(_0x4bb930,_0x316465){_0x316465=_0x316465||0x1f4;return function(_0x58fd8b){logger['error'](_0x58fd8b[_0xd150('0x29')]);if(_0x58fd8b['name']){delete _0x58fd8b[_0xd150('0x2a')];}_0x4bb930[_0xd150('0x1b')](_0x316465)[_0xd150('0x2b')](_0x58fd8b);};}exports['index']=function(_0x4a95c1,_0x574c15){var _0x587d1a={},_0x189d88={},_0x2eddd1={'count':0x0,'rows':[]};var _0x9882fa=_['map'](db[_0xd150('0x2c')]['rawAttributes'],function(_0x174a8d){return{'name':_0x174a8d[_0xd150('0x2d')],'type':_0x174a8d[_0xd150('0x2e')][_0xd150('0x2f')]};});_0x189d88['model']=_[_0xd150('0x30')](_0x9882fa,_0xd150('0x2a'));_0x189d88['query']=_[_0xd150('0x31')](_0x4a95c1['query']);_0x189d88[_0xd150('0x32')]=_['intersection'](_0x189d88[_0xd150('0x33')],_0x189d88['query']);_0x587d1a['attributes']=_['intersection'](_0x189d88[_0xd150('0x33')],qs[_0xd150('0x34')](_0x4a95c1[_0xd150('0x35')][_0xd150('0x34')]));_0x587d1a['attributes']=_0x587d1a[_0xd150('0x36')][_0xd150('0x37')]?_0x587d1a[_0xd150('0x36')]:_0x189d88[_0xd150('0x33')];if(!_0x4a95c1[_0xd150('0x35')][_0xd150('0x38')](_0xd150('0x39'))){_0x587d1a[_0xd150('0x20')]=qs['limit'](_0x4a95c1['query'][_0xd150('0x20')]);_0x587d1a[_0xd150('0x1e')]=qs[_0xd150('0x1e')](_0x4a95c1[_0xd150('0x35')][_0xd150('0x1e')]);}_0x587d1a[_0xd150('0x3a')]=qs[_0xd150('0x3b')](_0x4a95c1[_0xd150('0x35')][_0xd150('0x3b')]);_0x587d1a[_0xd150('0x3c')]=qs[_0xd150('0x32')](_[_0xd150('0x3d')](_0x4a95c1[_0xd150('0x35')],_0x189d88[_0xd150('0x32')]),_0x9882fa);if(_0x4a95c1[_0xd150('0x35')]['filter']){_0x587d1a[_0xd150('0x3c')]=_[_0xd150('0x3e')](_0x587d1a[_0xd150('0x3c')],{'$or':_[_0xd150('0x30')](_0x9882fa,function(_0x379b88){if(_0x379b88[_0xd150('0x2e')]!=='VIRTUAL'){var _0x556c32={};_0x556c32[_0x379b88[_0xd150('0x2a')]]={'$like':'%'+_0x4a95c1[_0xd150('0x35')]['filter']+'%'};return _0x556c32;}})});}_0x587d1a=_[_0xd150('0x3e')]({},_0x587d1a,_0x4a95c1[_0xd150('0x3f')]);var _0x2e41fc={'where':_0x587d1a[_0xd150('0x3c')]};return db['AnalyticFieldReport']['count'](_0x2e41fc)[_0xd150('0x27')](function(_0x1fa600){_0x2eddd1['count']=_0x1fa600;if(_0x4a95c1['query']['includeAll']){_0x587d1a['include']=[{'all':!![]}];}return db[_0xd150('0x2c')]['findAll'](_0x587d1a);})[_0xd150('0x27')](function(_0x3e134f){_0x2eddd1[_0xd150('0x40')]=_0x3e134f;return _0x2eddd1;})[_0xd150('0x27')](respondWithFilteredResult(_0x574c15,_0x587d1a))[_0xd150('0x41')](handleError(_0x574c15,null));};exports[_0xd150('0x42')]=function(_0x3dce65,_0x55dfcc){var _0x3a0d0b={'raw':![],'where':{'id':_0x3dce65[_0xd150('0x43')]['id']}},_0x2377e7={};_0x2377e7['model']=_[_0xd150('0x31')](db[_0xd150('0x2c')]['rawAttributes']);_0x2377e7[_0xd150('0x35')]=_[_0xd150('0x31')](_0x3dce65['query']);_0x2377e7[_0xd150('0x32')]=_[_0xd150('0x44')](_0x2377e7['model'],_0x2377e7[_0xd150('0x35')]);_0x3a0d0b['attributes']=_[_0xd150('0x44')](_0x2377e7[_0xd150('0x33')],qs['fields'](_0x3dce65[_0xd150('0x35')][_0xd150('0x34')]));_0x3a0d0b[_0xd150('0x36')]=_0x3a0d0b[_0xd150('0x36')][_0xd150('0x37')]?_0x3a0d0b['attributes']:_0x2377e7['model'];if(_0x3dce65[_0xd150('0x35')][_0xd150('0x45')]){_0x3a0d0b[_0xd150('0x46')]=[{'all':!![]}];}_0x3a0d0b=_[_0xd150('0x3e')]({},_0x3a0d0b,_0x3dce65[_0xd150('0x3f')]);return db[_0xd150('0x2c')][_0xd150('0x47')](_0x3a0d0b)[_0xd150('0x27')](handleEntityNotFound(_0x55dfcc,null))[_0xd150('0x27')](respondWithResult(_0x55dfcc,null))[_0xd150('0x41')](handleError(_0x55dfcc,null));};exports[_0xd150('0x48')]=function(_0x54dbda,_0x4f25d1){return db[_0xd150('0x2c')][_0xd150('0x48')](_0x54dbda[_0xd150('0x49')],{})[_0xd150('0x27')](respondWithResult(_0x4f25d1,0xc9))[_0xd150('0x41')](handleError(_0x4f25d1,null));};exports['bulkCreate']=function(_0x2b384,_0x1f4f5b){return db[_0xd150('0x2c')][_0xd150('0x4a')](_0x2b384['body'],{'raw':![],'individualHooks':!![]})[_0xd150('0x27')](respondWithResult(_0x1f4f5b,0xc9))[_0xd150('0x41')](handleError(_0x1f4f5b,null));};exports[_0xd150('0x26')]=function(_0x40ac85,_0x260df2){if(_0x40ac85['body']['id']){delete _0x40ac85[_0xd150('0x49')]['id'];}return db[_0xd150('0x2c')]['find']({'where':{'id':_0x40ac85[_0xd150('0x43')]['id']}})['then'](handleEntityNotFound(_0x260df2,null))[_0xd150('0x27')](saveUpdates(_0x40ac85['body'],null))['then'](respondWithResult(_0x260df2,null))[_0xd150('0x41')](handleError(_0x260df2,null));};exports['destroy']=function(_0x5612b8,_0x5ea158){return db[_0xd150('0x2c')][_0xd150('0x47')]({'where':{'id':_0x5612b8[_0xd150('0x43')]['id']}})[_0xd150('0x27')](handleEntityNotFound(_0x5ea158,null))[_0xd150('0x27')](removeEntity(_0x5ea158,null))[_0xd150('0x41')](handleError(_0x5ea158,null));};exports[_0xd150('0x4b')]=function(_0x323574,_0x38d73a){return db[_0xd150('0x2c')][_0xd150('0x28')]({'where':{'id':_0x323574[_0xd150('0x35')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xd150('0x27')](respondWithResult(_0x38d73a,0xcc))[_0xd150('0x41')](handleError(_0x38d73a,null));};exports['addFields']=function(_0x39d236,_0x6c6a40,_0x408692){return db['AnalyticCustomReport'][_0xd150('0x4c')]({'where':{'id':_0x39d236[_0xd150('0x43')]['id']}})[_0xd150('0x27')](handleEntityNotFound(_0x6c6a40,null))['then'](function(_0x64a496){if(_0x64a496){return db[_0xd150('0x4d')][_0xd150('0x4e')](function(_0x1ccdea){return db['AnalyticFieldReport'][_0xd150('0x28')]({'where':{'CustomReportId':_0x39d236[_0xd150('0x43')]['id']},'transaction':_0x1ccdea})[_0xd150('0x27')](function(_0x28f0df){var _0x4d8d4a=_['map'](_0x39d236[_0xd150('0x49')],function(_0xb4b500){delete _0xb4b500['id'];_0xb4b500[_0xd150('0x4f')]=_0x39d236[_0xd150('0x43')]['id'];return _0xb4b500;});return db[_0xd150('0x2c')][_0xd150('0x4a')](_0x4d8d4a,{'transaction':_0x1ccdea});});})[_0xd150('0x27')](function(){return db[_0xd150('0x2c')][_0xd150('0x50')]({'where':{'CustomReportId':_0x39d236[_0xd150('0x43')]['id']}});});}})['then'](respondWithResult(_0x6c6a40,null))[_0xd150('0x41')](handleError(_0x6c6a40,null));}; \ No newline at end of file +var _0x166b=['bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','params','sequelize','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','include','find','create','body'];(function(_0x4c724a,_0x881ded){var _0x5bc1c0=function(_0x387600){while(--_0x387600){_0x4c724a['push'](_0x4c724a['shift']());}};_0x5bc1c0(++_0x881ded);}(_0x166b,0x198));var _0xb166=function(_0xaf0090,_0x20c43f){_0xaf0090=_0xaf0090-0x0;var _0x572d06=_0x166b[_0xaf0090];return _0x572d06;};'use strict';var emlformat=require(_0xb166('0x0'));var rimraf=require(_0xb166('0x1'));var zipdir=require(_0xb166('0x2'));var jsonpatch=require(_0xb166('0x3'));var rp=require(_0xb166('0x4'));var moment=require(_0xb166('0x5'));var BPromise=require(_0xb166('0x6'));var Mustache=require('mustache');var util=require(_0xb166('0x7'));var path=require(_0xb166('0x8'));var sox=require('sox');var csv=require(_0xb166('0x9'));var ejs=require(_0xb166('0xa'));var fs=require('fs');var fs_extra=require(_0xb166('0xb'));var _=require(_0xb166('0xc'));var squel=require(_0xb166('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb166('0xe'));var toCsv=require(_0xb166('0x9'));var querystring=require(_0xb166('0xf'));var Papa=require(_0xb166('0x10'));var Redis=require('ioredis');var authService=require(_0xb166('0x11'));var qs=require(_0xb166('0x12'));var as=require(_0xb166('0x13'));var hardwareService=require(_0xb166('0x14'));var logger=require('../../config/logger')(_0xb166('0x15'));var utils=require(_0xb166('0x16'));var config=require(_0xb166('0x17'));var licenseUtil=require(_0xb166('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d4c0,_0x50325c){_0x50325c=_0x50325c||0xcc;return function(_0x1ab6bd){if(_0x1ab6bd){return _0x56d4c0[_0xb166('0x19')](_0x50325c);}return _0x56d4c0['status'](_0x50325c)[_0xb166('0x1a')]();};}function respondWithResult(_0x42a87f,_0xcfdb4b){_0xcfdb4b=_0xcfdb4b||0xc8;return function(_0x2e38b6){if(_0x2e38b6){return _0x42a87f[_0xb166('0x1b')](_0xcfdb4b)['json'](_0x2e38b6);}};}function respondWithFilteredResult(_0x411252,_0x347277){return function(_0x381934){if(_0x381934){var _0x56f5d3=typeof _0x347277[_0xb166('0x1c')]===_0xb166('0x1d')&&typeof _0x347277[_0xb166('0x1e')]===_0xb166('0x1d');var _0x68f2f4=_0x381934[_0xb166('0x1f')];var _0x312876=_0x56f5d3?0x0:_0x347277['offset'];var _0x1611fb=_0x56f5d3?_0x381934[_0xb166('0x1f')]:_0x347277[_0xb166('0x1c')]+_0x347277[_0xb166('0x1e')];var _0x177d9f;if(_0x1611fb>=_0x68f2f4){_0x1611fb=_0x68f2f4;_0x177d9f=0xc8;}else{_0x177d9f=0xce;}_0x411252[_0xb166('0x1b')](_0x177d9f);return _0x411252[_0xb166('0x20')](_0xb166('0x21'),_0x312876+'-'+_0x1611fb+'/'+_0x68f2f4)[_0xb166('0x22')](_0x381934);}return null;};}function patchUpdates(_0x4cccf2){return function(_0x9d9cc9){try{jsonpatch[_0xb166('0x23')](_0x9d9cc9,_0x4cccf2,!![]);}catch(_0x194a39){return BPromise['reject'](_0x194a39);}return _0x9d9cc9[_0xb166('0x24')]();};}function saveUpdates(_0x559f9a,_0x449baf){return function(_0x2e9c9d){if(_0x2e9c9d){return _0x2e9c9d[_0xb166('0x25')](_0x559f9a)['then'](function(_0x3b3689){return _0x3b3689;});}return null;};}function removeEntity(_0x5e9a96,_0x35038c){return function(_0x86e18e){if(_0x86e18e){return _0x86e18e[_0xb166('0x26')]()[_0xb166('0x27')](function(){_0x5e9a96['status'](0xcc)[_0xb166('0x1a')]();});}};}function handleEntityNotFound(_0x4927d0,_0x2b3151){return function(_0x5b388c){if(!_0x5b388c){_0x4927d0[_0xb166('0x19')](0x194);}return _0x5b388c;};}function handleError(_0x431ed5,_0x3cb7ea){_0x3cb7ea=_0x3cb7ea||0x1f4;return function(_0x56fd92){logger[_0xb166('0x28')](_0x56fd92['stack']);if(_0x56fd92[_0xb166('0x29')]){delete _0x56fd92['name'];}_0x431ed5[_0xb166('0x1b')](_0x3cb7ea)[_0xb166('0x2a')](_0x56fd92);};}exports[_0xb166('0x2b')]=function(_0x379d43,_0x2009be){var _0x54949d={},_0x54b139={},_0x4bff7d={'count':0x0,'rows':[]};var _0x1dd113=_[_0xb166('0x2c')](db[_0xb166('0x2d')][_0xb166('0x2e')],function(_0x516b72){return{'name':_0x516b72['fieldName'],'type':_0x516b72[_0xb166('0x2f')][_0xb166('0x30')]};});_0x54b139[_0xb166('0x31')]=_[_0xb166('0x2c')](_0x1dd113,_0xb166('0x29'));_0x54b139[_0xb166('0x32')]=_[_0xb166('0x33')](_0x379d43[_0xb166('0x32')]);_0x54b139[_0xb166('0x34')]=_[_0xb166('0x35')](_0x54b139[_0xb166('0x31')],_0x54b139[_0xb166('0x32')]);_0x54949d[_0xb166('0x36')]=_[_0xb166('0x35')](_0x54b139[_0xb166('0x31')],qs[_0xb166('0x37')](_0x379d43[_0xb166('0x32')]['fields']));_0x54949d[_0xb166('0x36')]=_0x54949d[_0xb166('0x36')][_0xb166('0x38')]?_0x54949d[_0xb166('0x36')]:_0x54b139[_0xb166('0x31')];if(!_0x379d43[_0xb166('0x32')]['hasOwnProperty'](_0xb166('0x39'))){_0x54949d['limit']=qs['limit'](_0x379d43[_0xb166('0x32')]['limit']);_0x54949d[_0xb166('0x1c')]=qs[_0xb166('0x1c')](_0x379d43['query'][_0xb166('0x1c')]);}_0x54949d[_0xb166('0x3a')]=qs[_0xb166('0x3b')](_0x379d43[_0xb166('0x32')][_0xb166('0x3b')]);_0x54949d['where']=qs[_0xb166('0x34')](_[_0xb166('0x3c')](_0x379d43['query'],_0x54b139[_0xb166('0x34')]),_0x1dd113);if(_0x379d43[_0xb166('0x32')][_0xb166('0x3d')]){_0x54949d[_0xb166('0x3e')]=_[_0xb166('0x3f')](_0x54949d[_0xb166('0x3e')],{'$or':_[_0xb166('0x2c')](_0x1dd113,function(_0x5d53a0){if(_0x5d53a0[_0xb166('0x2f')]!==_0xb166('0x40')){var _0x44fef5={};_0x44fef5[_0x5d53a0['name']]={'$like':'%'+_0x379d43[_0xb166('0x32')][_0xb166('0x3d')]+'%'};return _0x44fef5;}})});}_0x54949d=_[_0xb166('0x3f')]({},_0x54949d,_0x379d43['options']);var _0x3c614e={'where':_0x54949d['where']};return db[_0xb166('0x2d')]['count'](_0x3c614e)[_0xb166('0x27')](function(_0x220ce8){_0x4bff7d[_0xb166('0x1f')]=_0x220ce8;if(_0x379d43[_0xb166('0x32')][_0xb166('0x41')]){_0x54949d['include']=[{'all':!![]}];}return db[_0xb166('0x2d')]['findAll'](_0x54949d);})[_0xb166('0x27')](function(_0x319927){_0x4bff7d[_0xb166('0x42')]=_0x319927;return _0x4bff7d;})[_0xb166('0x27')](respondWithFilteredResult(_0x2009be,_0x54949d))[_0xb166('0x43')](handleError(_0x2009be,null));};exports['show']=function(_0x29dca3,_0x39e493){var _0x57a371={'raw':![],'where':{'id':_0x29dca3['params']['id']}},_0x533eea={};_0x533eea['model']=_[_0xb166('0x33')](db['AnalyticFieldReport'][_0xb166('0x2e')]);_0x533eea[_0xb166('0x32')]=_['keys'](_0x29dca3[_0xb166('0x32')]);_0x533eea[_0xb166('0x34')]=_[_0xb166('0x35')](_0x533eea[_0xb166('0x31')],_0x533eea['query']);_0x57a371[_0xb166('0x36')]=_['intersection'](_0x533eea[_0xb166('0x31')],qs[_0xb166('0x37')](_0x29dca3[_0xb166('0x32')][_0xb166('0x37')]));_0x57a371[_0xb166('0x36')]=_0x57a371[_0xb166('0x36')][_0xb166('0x38')]?_0x57a371['attributes']:_0x533eea[_0xb166('0x31')];if(_0x29dca3[_0xb166('0x32')][_0xb166('0x41')]){_0x57a371[_0xb166('0x44')]=[{'all':!![]}];}_0x57a371=_[_0xb166('0x3f')]({},_0x57a371,_0x29dca3['options']);return db['AnalyticFieldReport'][_0xb166('0x45')](_0x57a371)['then'](handleEntityNotFound(_0x39e493,null))[_0xb166('0x27')](respondWithResult(_0x39e493,null))['catch'](handleError(_0x39e493,null));};exports['create']=function(_0x3edd79,_0x36ab58){return db[_0xb166('0x2d')][_0xb166('0x46')](_0x3edd79[_0xb166('0x47')],{})['then'](respondWithResult(_0x36ab58,0xc9))[_0xb166('0x43')](handleError(_0x36ab58,null));};exports[_0xb166('0x48')]=function(_0x2306aa,_0x311a7e){return db[_0xb166('0x2d')]['bulkCreate'](_0x2306aa[_0xb166('0x47')],{'raw':![],'individualHooks':!![]})[_0xb166('0x27')](respondWithResult(_0x311a7e,0xc9))[_0xb166('0x43')](handleError(_0x311a7e,null));};exports[_0xb166('0x25')]=function(_0x18004f,_0x519f09){if(_0x18004f[_0xb166('0x47')]['id']){delete _0x18004f[_0xb166('0x47')]['id'];}return db['AnalyticFieldReport'][_0xb166('0x45')]({'where':{'id':_0x18004f['params']['id']}})['then'](handleEntityNotFound(_0x519f09,null))[_0xb166('0x27')](saveUpdates(_0x18004f['body'],null))['then'](respondWithResult(_0x519f09,null))[_0xb166('0x43')](handleError(_0x519f09,null));};exports[_0xb166('0x26')]=function(_0xd0793a,_0x31abdc){return db[_0xb166('0x2d')]['find']({'where':{'id':_0xd0793a['params']['id']}})[_0xb166('0x27')](handleEntityNotFound(_0x31abdc,null))[_0xb166('0x27')](removeEntity(_0x31abdc,null))[_0xb166('0x43')](handleError(_0x31abdc,null));};exports[_0xb166('0x49')]=function(_0x48b479,_0x221176){return db[_0xb166('0x2d')][_0xb166('0x26')]({'where':{'id':_0x48b479[_0xb166('0x32')][_0xb166('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xb166('0x27')](respondWithResult(_0x221176,0xcc))[_0xb166('0x43')](handleError(_0x221176,null));};exports[_0xb166('0x4b')]=function(_0x50faa1,_0x4b531b,_0x599118){return db[_0xb166('0x4c')]['findOne']({'where':{'id':_0x50faa1[_0xb166('0x4d')]['id']}})[_0xb166('0x27')](handleEntityNotFound(_0x4b531b,null))['then'](function(_0xa87c48){if(_0xa87c48){return db[_0xb166('0x4e')]['transaction'](function(_0x566cda){return db[_0xb166('0x2d')][_0xb166('0x26')]({'where':{'CustomReportId':_0x50faa1[_0xb166('0x4d')]['id']},'transaction':_0x566cda})['then'](function(_0x5a61bc){var _0xf1d9a0=_[_0xb166('0x2c')](_0x50faa1[_0xb166('0x47')],function(_0x936b7f){delete _0x936b7f['id'];_0x936b7f['CustomReportId']=_0x50faa1[_0xb166('0x4d')]['id'];return _0x936b7f;});return db['AnalyticFieldReport'][_0xb166('0x48')](_0xf1d9a0,{'transaction':_0x566cda});});})[_0xb166('0x27')](function(){return db[_0xb166('0x2d')][_0xb166('0x4f')]({'where':{'CustomReportId':_0x50faa1['params']['id']}});});}})[_0xb166('0x27')](respondWithResult(_0x4b531b,null))[_0xb166('0x43')](handleError(_0x4b531b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6649c64..7ad170a 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 _0x1189=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x47f937,_0x48a7d9){var _0x2b180f=function(_0x58ab68){while(--_0x58ab68){_0x47f937['push'](_0x47f937['shift']());}};_0x2b180f(++_0x48a7d9);}(_0x1189,0xbf));var _0x9118=function(_0x36aa86,_0xd8faa6){_0x36aa86=_0x36aa86-0x0;var _0x3a4e7d=_0x1189[_0x36aa86];return _0x3a4e7d;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))(_0x9118('0x3'));var moment=require('moment');var BPromise=require(_0x9118('0x4'));var rp=require(_0x9118('0x5'));var fs=require('fs');var path=require(_0x9118('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9118('0x7'));module['exports']=function(_0x210a3d,_0x2ca95b){return _0x210a3d[_0x9118('0x8')](_0x9118('0x9'),attributes,{'tableName':_0x9118('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684b=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_fields','lodash','../../config/logger','moment','bluebird'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x684b,0x15c));var _0xb684=function(_0x2f408a,_0x2f9e24){_0x2f408a=_0x2f408a-0x0;var _0x18df0a=_0x684b[_0x2f408a];return _0x18df0a;};'use strict';var _=require(_0xb684('0x0'));var util=require('util');var logger=require(_0xb684('0x1'))('api');var moment=require(_0xb684('0x2'));var BPromise=require(_0xb684('0x3'));var rp=require(_0xb684('0x4'));var fs=require('fs');var path=require(_0xb684('0x5'));var rimraf=require(_0xb684('0x6'));var config=require(_0xb684('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xb684('0x8')]=function(_0x2d3bc1,_0x384d3c){return _0x2d3bc1[_0xb684('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xb684('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 2380577..6e7061c 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 _0x4141=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4141,0x121));var _0x1414=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4141[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1414('0x0'));var util=require(_0x1414('0x1'));var moment=require(_0x1414('0x2'));var BPromise=require(_0x1414('0x3'));var rs=require(_0x1414('0x4'));var fs=require('fs');var Redis=require(_0x1414('0x5'));var db=require(_0x1414('0x6'))['db'];var utils=require(_0x1414('0x7'));var logger=require(_0x1414('0x8'))(_0x1414('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1414('0xa')][_0x1414('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0e278,_0x5a41b8,_0x4868a4){return new BPromise(function(_0x189f44,_0x939c87){return client[_0x1414('0xc')](_0xa0e278,_0x4868a4)['then'](function(_0x1acf9e){logger[_0x1414('0xd')](_0x1414('0xe'),_0x5a41b8,_0x1414('0xf'));logger['debug'](_0x1414('0x10'),_0x5a41b8,_0x1414('0xf'),JSON['stringify'](_0x1acf9e));if(_0x1acf9e[_0x1414('0x11')]){if(_0x1acf9e[_0x1414('0x11')][_0x1414('0x12')]===0x1f4){logger[_0x1414('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a41b8,_0x1acf9e['error']['message']);return _0x939c87(_0x1acf9e[_0x1414('0x11')][_0x1414('0x13')]);}logger[_0x1414('0x11')](_0x1414('0xe'),_0x5a41b8,_0x1acf9e[_0x1414('0x11')][_0x1414('0x13')]);return _0x189f44(_0x1acf9e[_0x1414('0x11')]['message']);}else{logger['info'](_0x1414('0xe'),_0x5a41b8,_0x1414('0xf'));_0x189f44(_0x1acf9e['result'][_0x1414('0x13')]);}})[_0x1414('0x14')](function(_0x398a30){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5a41b8,_0x398a30);_0x939c87(_0x398a30);});});} \ No newline at end of file +var _0x7198=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x48099d,_0x3abf72){var _0x1b626c=function(_0x4a14dc){while(--_0x4a14dc){_0x48099d['push'](_0x48099d['shift']());}};_0x1b626c(++_0x3abf72);}(_0x7198,0x117));var _0x8719=function(_0x39c698,_0x80e220){_0x39c698=_0x39c698-0x0;var _0x162ef3=_0x7198[_0x39c698];return _0x162ef3;};'use strict';var _=require('lodash');var util=require(_0x8719('0x0'));var moment=require(_0x8719('0x1'));var BPromise=require(_0x8719('0x2'));var rs=require(_0x8719('0x3'));var fs=require('fs');var Redis=require(_0x8719('0x4'));var db=require(_0x8719('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8719('0x6'))(_0x8719('0x7'));var config=require(_0x8719('0x8'));var jayson=require(_0x8719('0x9'));var client=jayson[_0x8719('0xa')][_0x8719('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42c458,_0x4d9842,_0x3af00c){return new BPromise(function(_0x3ce949,_0x3c8a9a){return client[_0x8719('0xc')](_0x42c458,_0x3af00c)['then'](function(_0x9d0002){logger[_0x8719('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4d9842,_0x8719('0xe'));logger[_0x8719('0xf')](_0x8719('0x10'),_0x4d9842,_0x8719('0xe'),JSON['stringify'](_0x9d0002));if(_0x9d0002['error']){if(_0x9d0002[_0x8719('0x11')][_0x8719('0x12')]===0x1f4){logger[_0x8719('0x11')](_0x8719('0x13'),_0x4d9842,_0x9d0002[_0x8719('0x11')]['message']);return _0x3c8a9a(_0x9d0002[_0x8719('0x11')][_0x8719('0x14')]);}logger[_0x8719('0x11')](_0x8719('0x13'),_0x4d9842,_0x9d0002[_0x8719('0x11')][_0x8719('0x14')]);return _0x3ce949(_0x9d0002[_0x8719('0x11')]['message']);}else{logger[_0x8719('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4d9842,_0x8719('0xe'));_0x3ce949(_0x9d0002['result'][_0x8719('0x14')]);}})[_0x8719('0x15')](function(_0x43dee1){logger['error'](_0x8719('0x13'),_0x4d9842,_0x43dee1);_0x3c8a9a(_0x43dee1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e8ff9fc..f90ee83 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(_0x1d0343,_0x472470){var _0xeba613=function(_0x241b24){while(--_0x241b24){_0x1d0343['push'](_0x1d0343['shift']());}};_0xeba613(++_0x472470);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x57d373,_0x58b6e7){var _0x145d11=function(_0x1d517a){while(--_0x1d517a){_0x57d373['push'](_0x57d373['shift']());}};_0x145d11(++_0x58b6e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 3c0e467..a13525a 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 _0xd1f1=['sequelize','exports','STRING','name'];(function(_0x382f3d,_0x16200f){var _0x4b174a=function(_0x3f0390){while(--_0x3f0390){_0x382f3d['push'](_0x382f3d['shift']());}};_0x4b174a(++_0x16200f);}(_0xd1f1,0x84));var _0x1d1f=function(_0x2f1ee0,_0x4ca1f4){_0x2f1ee0=_0x2f1ee0-0x0;var _0x576314=_0xd1f1[_0x2f1ee0];return _0x576314;};'use strict';var Sequelize=require(_0x1d1f('0x0'));module[_0x1d1f('0x1')]={'name':{'type':Sequelize[_0x1d1f('0x2')],'allowNull':![],'unique':_0x1d1f('0x3')},'table':{'type':Sequelize[_0x1d1f('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x1d1f('0x2')]}}; \ No newline at end of file +var _0xbca8=['sequelize','exports','STRING','name'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xbca8,0xcc));var _0x8bca=function(_0x3c4705,_0x558ac2){_0x3c4705=_0x3c4705-0x0;var _0x255fac=_0xbca8[_0x3c4705];return _0x255fac;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')],'allowNull':![],'unique':_0x8bca('0x3')},'table':{'type':Sequelize[_0x8bca('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fa57758..e5ec2d0 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 _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x3dedad,_0x435b1f){var _0x5470ba=function(_0x9268c4){while(--_0x9268c4){_0x3dedad['push'](_0x3dedad['shift']());}};_0x5470ba(++_0x435b1f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x33cde3,_0x578b72){_0x33cde3=_0x33cde3-0x0;var _0x97660d=_0x9c5a[_0x33cde3];return _0x97660d;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x121b90,_0x229c8b){var _0x51ab77=function(_0x1f73c1){while(--_0x1f73c1){_0x121b90['push'](_0x121b90['shift']());}};_0x51ab77(++_0x229c8b);}(_0x8ef6,0xf2));var _0x68ef=function(_0xf86c5b,_0x14ba1f){_0xf86c5b=_0xf86c5b-0x0;var _0x558af2=_0x8ef6[_0xf86c5b];return _0x558af2;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8ebb2c4..bb4136c 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 _0x5581=['AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes'];(function(_0xdb5036,_0x914c61){var _0x58fb12=function(_0x5deae1){while(--_0x5deae1){_0xdb5036['push'](_0xdb5036['shift']());}};_0x58fb12(++_0x914c61);}(_0x5581,0x115));var _0x1558=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x5581[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x1558('0x0'));var util=require('util');var logger=require(_0x1558('0x1'))(_0x1558('0x2'));var moment=require(_0x1558('0x3'));var BPromise=require(_0x1558('0x4'));var rp=require(_0x1558('0x5'));var fs=require('fs');var path=require(_0x1558('0x6'));var rimraf=require('rimraf');var config=require(_0x1558('0x7'));var attributes=require(_0x1558('0x8'));module['exports']=function(_0x24c333,_0xcaef09){return _0x24c333['define'](_0x1558('0x9'),attributes,{'tableName':_0x1558('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bd7=['analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x2a710d,_0x82c4ff){var _0x217bb9=function(_0x1144bf){while(--_0x1144bf){_0x2a710d['push'](_0x2a710d['shift']());}};_0x217bb9(++_0x82c4ff);}(_0x5bd7,0x12a));var _0x75bd=function(_0x276986,_0x58a02e){_0x276986=_0x276986-0x0;var _0x1b9e9e=_0x5bd7[_0x276986];return _0x1b9e9e;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var logger=require(_0x75bd('0x1'))(_0x75bd('0x2'));var moment=require('moment');var BPromise=require(_0x75bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bd('0x4'));var rimraf=require(_0x75bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bd('0x6'));module[_0x75bd('0x7')]=function(_0x2aaa6a,_0x47c9c7){return _0x2aaa6a[_0x75bd('0x8')](_0x75bd('0x9'),attributes,{'tableName':_0x75bd('0xa'),'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 6a1a6ef..82e22e0 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 _0xf6d3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf6d3,0xe3));var _0x3f6d=function(_0x597430,_0xffac5c){_0x597430=_0x597430-0x0;var _0x8b07d7=_0xf6d3[_0x597430];return _0x8b07d7;};'use strict';var _=require(_0x3f6d('0x0'));var util=require(_0x3f6d('0x1'));var moment=require('moment');var BPromise=require(_0x3f6d('0x2'));var rs=require(_0x3f6d('0x3'));var fs=require('fs');var Redis=require(_0x3f6d('0x4'));var db=require(_0x3f6d('0x5'))['db'];var utils=require(_0x3f6d('0x6'));var logger=require(_0x3f6d('0x7'))('rpc');var config=require(_0x3f6d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ecae2,_0x285d24,_0x8d8030){return new BPromise(function(_0x1da466,_0x1db2db){return client[_0x3f6d('0xa')](_0x3ecae2,_0x8d8030)[_0x3f6d('0xb')](function(_0xc986b8){logger[_0x3f6d('0xc')](_0x3f6d('0xd'),_0x285d24,_0x3f6d('0xe'));logger[_0x3f6d('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x285d24,_0x3f6d('0xe'),JSON['stringify'](_0xc986b8));if(_0xc986b8[_0x3f6d('0x10')]){if(_0xc986b8[_0x3f6d('0x10')][_0x3f6d('0x11')]===0x1f4){logger[_0x3f6d('0x10')](_0x3f6d('0xd'),_0x285d24,_0xc986b8[_0x3f6d('0x10')][_0x3f6d('0x12')]);return _0x1db2db(_0xc986b8[_0x3f6d('0x10')][_0x3f6d('0x12')]);}logger['error'](_0x3f6d('0xd'),_0x285d24,_0xc986b8[_0x3f6d('0x10')][_0x3f6d('0x12')]);return _0x1da466(_0xc986b8['error'][_0x3f6d('0x12')]);}else{logger[_0x3f6d('0xc')](_0x3f6d('0xd'),_0x285d24,_0x3f6d('0xe'));_0x1da466(_0xc986b8[_0x3f6d('0x13')]['message']);}})[_0x3f6d('0x14')](function(_0x4447c7){logger[_0x3f6d('0x10')](_0x3f6d('0xd'),_0x285d24,_0x4447c7);_0x1db2db(_0x4447c7);});});} \ No newline at end of file +var _0x6fba=['error','code','AnalyticMetric,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x38567b,_0x32ba4e){var _0x2ebec5=function(_0x207708){while(--_0x207708){_0x38567b['push'](_0x38567b['shift']());}};_0x2ebec5(++_0x32ba4e);}(_0x6fba,0x1ea));var _0xa6fb=function(_0xb50359,_0x1e297e){_0xb50359=_0xb50359-0x0;var _0x432b27=_0x6fba[_0xb50359];return _0x432b27;};'use strict';var _=require('lodash');var util=require(_0xa6fb('0x0'));var moment=require(_0xa6fb('0x1'));var BPromise=require(_0xa6fb('0x2'));var rs=require(_0xa6fb('0x3'));var fs=require('fs');var Redis=require(_0xa6fb('0x4'));var db=require(_0xa6fb('0x5'))['db'];var utils=require(_0xa6fb('0x6'));var logger=require(_0xa6fb('0x7'))(_0xa6fb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6fb('0x9')][_0xa6fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d80f7,_0x330316,_0xd80915){return new BPromise(function(_0x27db86,_0x165ad2){return client[_0xa6fb('0xb')](_0x4d80f7,_0xd80915)[_0xa6fb('0xc')](function(_0x4ef218){logger[_0xa6fb('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x330316,'request\x20sent');logger['debug'](_0xa6fb('0xe'),_0x330316,'request\x20sent',JSON[_0xa6fb('0xf')](_0x4ef218));if(_0x4ef218[_0xa6fb('0x10')]){if(_0x4ef218[_0xa6fb('0x10')][_0xa6fb('0x11')]===0x1f4){logger[_0xa6fb('0x10')](_0xa6fb('0x12'),_0x330316,_0x4ef218[_0xa6fb('0x10')][_0xa6fb('0x13')]);return _0x165ad2(_0x4ef218['error'][_0xa6fb('0x13')]);}logger[_0xa6fb('0x10')](_0xa6fb('0x12'),_0x330316,_0x4ef218[_0xa6fb('0x10')]['message']);return _0x27db86(_0x4ef218[_0xa6fb('0x10')][_0xa6fb('0x13')]);}else{logger[_0xa6fb('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x330316,_0xa6fb('0x14'));_0x27db86(_0x4ef218[_0xa6fb('0x15')][_0xa6fb('0x13')]);}})[_0xa6fb('0x16')](function(_0x250389){logger['error'](_0xa6fb('0x12'),_0x330316,_0x250389);_0x165ad2(_0x250389);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 52fb422..b3f2d10 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 _0xa1f6=['isAuthenticated','index','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xa1f6[_0x28509b];return _0x1e0b6;};'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('./analyticMetric.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['post']('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xb')]);router[_0x6a1f('0xc')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller['update']);router[_0x6a1f('0xd')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd7c3=['./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bf9ba,_0x4d2e4d){var _0x560821=function(_0xfc069d){while(--_0xfc069d){_0x1bf9ba['push'](_0x1bf9ba['shift']());}};_0x560821(++_0x4d2e4d);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x3bd04f,_0x51d608){_0x3bd04f=_0x3bd04f-0x0;var _0x5dd40f=_0xd7c3[_0x3bd04f];return _0x5dd40f;};'use strict';var multer=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var path=require(_0x3d7c('0x2'));var timeout=require(_0x3d7c('0x3'));var express=require(_0x3d7c('0x4'));var router=express[_0x3d7c('0x5')]();var fs_extra=require(_0x3d7c('0x6'));var auth=require(_0x3d7c('0x7'));var interaction=require(_0x3d7c('0x8'));var config=require('../../config/environment');var controller=require(_0x3d7c('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d7c('0xa')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0xd')]);router[_0x3d7c('0xe')]('/',auth[_0x3d7c('0xc')](),controller[_0x3d7c('0xf')]);router[_0x3d7c('0x10')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0x11')]);router[_0x3d7c('0x12')](_0x3d7c('0xb'),auth[_0x3d7c('0xc')](),controller[_0x3d7c('0x13')]);module[_0x3d7c('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 41e44c9..5583223 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 _0x6de8=['exports'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0x6de8,0x126));var _0x86de=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x6de8[_0x289a67];return _0x572b49;};'use strict';var Sequelize=require('sequelize');module[_0x86de('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x59ae=['sequelize','exports'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x59ae,0x132));var _0xe59a=function(_0x2a2d5c,_0x3c3d36){_0x2a2d5c=_0x2a2d5c-0x0;var _0x45509a=_0x59ae[_0x2a2d5c];return _0x45509a;};'use strict';var Sequelize=require(_0xe59a('0x0'));module[_0xe59a('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 c57a6f0..f7dd23c 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 _0xaa23=['nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','body','rimraf','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x21c283,_0x4f748a){var _0x25bc0d=function(_0x293b59){while(--_0x293b59){_0x21c283['push'](_0x21c283['shift']());}};_0x25bc0d(++_0x4f748a);}(_0xaa23,0x165));var _0x3aa2=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0xaa23[_0x34e46d];return _0x1cc6aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3aa2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3aa2('0x1'));var Mustache=require('mustache');var util=require(_0x3aa2('0x2'));var path=require(_0x3aa2('0x3'));var sox=require(_0x3aa2('0x4'));var csv=require(_0x3aa2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3aa2('0x6'));var _=require(_0x3aa2('0x7'));var squel=require(_0x3aa2('0x8'));var crypto=require('crypto');var jsforce=require(_0x3aa2('0x9'));var deskjs=require(_0x3aa2('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3aa2('0xb'));var Papa=require(_0x3aa2('0xc'));var Redis=require(_0x3aa2('0xd'));var authService=require(_0x3aa2('0xe'));var qs=require(_0x3aa2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3aa2('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3aa2('0x11'));var config=require(_0x3aa2('0x12'));var licenseUtil=require(_0x3aa2('0x13'));var db=require(_0x3aa2('0x14'))['db'];function respondWithStatusCode(_0x58da8a,_0x34530d){_0x34530d=_0x34530d||0xcc;return function(_0x9830b3){if(_0x9830b3){return _0x58da8a[_0x3aa2('0x15')](_0x34530d);}return _0x58da8a[_0x3aa2('0x16')](_0x34530d)[_0x3aa2('0x17')]();};}function respondWithResult(_0xb0c8b6,_0x29cf0d){_0x29cf0d=_0x29cf0d||0xc8;return function(_0x2f40f4){if(_0x2f40f4){return _0xb0c8b6[_0x3aa2('0x16')](_0x29cf0d)['json'](_0x2f40f4);}};}function respondWithFilteredResult(_0x483536,_0x372207){return function(_0x43167d){if(_0x43167d){var _0x2ea162=typeof _0x372207[_0x3aa2('0x18')]===_0x3aa2('0x19')&&typeof _0x372207['limit']===_0x3aa2('0x19');var _0x550939=_0x43167d[_0x3aa2('0x1a')];var _0x4c6eae=_0x2ea162?0x0:_0x372207[_0x3aa2('0x18')];var _0x2bba01=_0x2ea162?_0x43167d[_0x3aa2('0x1a')]:_0x372207[_0x3aa2('0x18')]+_0x372207[_0x3aa2('0x1b')];var _0xd2ba6b;if(_0x2bba01>=_0x550939){_0x2bba01=_0x550939;_0xd2ba6b=0xc8;}else{_0xd2ba6b=0xce;}_0x483536[_0x3aa2('0x16')](_0xd2ba6b);return _0x483536['set'](_0x3aa2('0x1c'),_0x4c6eae+'-'+_0x2bba01+'/'+_0x550939)['json'](_0x43167d);}return null;};}function patchUpdates(_0x43a00f){return function(_0x356856){try{jsonpatch['apply'](_0x356856,_0x43a00f,!![]);}catch(_0x3c80ac){return BPromise[_0x3aa2('0x1d')](_0x3c80ac);}return _0x356856[_0x3aa2('0x1e')]();};}function saveUpdates(_0x2ce340,_0x28b1b0){return function(_0x22bb98){if(_0x22bb98){return _0x22bb98[_0x3aa2('0x1f')](_0x2ce340)[_0x3aa2('0x20')](function(_0x98f4b){return _0x98f4b;});}return null;};}function removeEntity(_0x4e3f4a,_0x28b05c){return function(_0x2a9d5d){if(_0x2a9d5d){return _0x2a9d5d['destroy']()[_0x3aa2('0x20')](function(){_0x4e3f4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x351a42,_0x13e3a0){return function(_0x407550){if(!_0x407550){_0x351a42[_0x3aa2('0x15')](0x194);}return _0x407550;};}function handleError(_0x4706f0,_0x25c1f7){_0x25c1f7=_0x25c1f7||0x1f4;return function(_0x85ea51){logger[_0x3aa2('0x21')](_0x85ea51[_0x3aa2('0x22')]);if(_0x85ea51[_0x3aa2('0x23')]){delete _0x85ea51[_0x3aa2('0x23')];}_0x4706f0[_0x3aa2('0x16')](_0x25c1f7)[_0x3aa2('0x24')](_0x85ea51);};}exports[_0x3aa2('0x25')]=function(_0x4b901d,_0x1feb9e){var _0x35c6ce={},_0x161c61={},_0x49d371={'count':0x0,'rows':[]};var _0x357fdc=_['map'](db[_0x3aa2('0x26')][_0x3aa2('0x27')],function(_0x258638){return{'name':_0x258638['fieldName'],'type':_0x258638[_0x3aa2('0x28')][_0x3aa2('0x29')]};});_0x161c61[_0x3aa2('0x2a')]=_[_0x3aa2('0x2b')](_0x357fdc,'name');_0x161c61[_0x3aa2('0x2c')]=_[_0x3aa2('0x2d')](_0x4b901d[_0x3aa2('0x2c')]);_0x161c61['filters']=_['intersection'](_0x161c61[_0x3aa2('0x2a')],_0x161c61[_0x3aa2('0x2c')]);_0x35c6ce[_0x3aa2('0x2e')]=_[_0x3aa2('0x2f')](_0x161c61['model'],qs[_0x3aa2('0x30')](_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x30')]));_0x35c6ce['attributes']=_0x35c6ce[_0x3aa2('0x2e')][_0x3aa2('0x31')]?_0x35c6ce[_0x3aa2('0x2e')]:_0x161c61[_0x3aa2('0x2a')];if(!_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x32')](_0x3aa2('0x33'))){_0x35c6ce[_0x3aa2('0x1b')]=qs['limit'](_0x4b901d[_0x3aa2('0x2c')]['limit']);_0x35c6ce[_0x3aa2('0x18')]=qs[_0x3aa2('0x18')](_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x18')]);}_0x35c6ce[_0x3aa2('0x34')]=qs[_0x3aa2('0x35')](_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x35')]);_0x35c6ce[_0x3aa2('0x36')]=qs[_0x3aa2('0x37')](_['pick'](_0x4b901d[_0x3aa2('0x2c')],_0x161c61[_0x3aa2('0x37')]),_0x357fdc);if(_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x38')]){_0x35c6ce[_0x3aa2('0x36')]=_['merge'](_0x35c6ce['where'],{'$or':_['map'](_0x357fdc,function(_0x5771e9){if(_0x5771e9[_0x3aa2('0x28')]!==_0x3aa2('0x39')){var _0x104527={};_0x104527[_0x5771e9[_0x3aa2('0x23')]]={'$like':'%'+_0x4b901d[_0x3aa2('0x2c')][_0x3aa2('0x38')]+'%'};return _0x104527;}})});}_0x35c6ce=_[_0x3aa2('0x3a')]({},_0x35c6ce,_0x4b901d[_0x3aa2('0x3b')]);var _0x3b3f6e={'where':_0x35c6ce[_0x3aa2('0x36')]};return db[_0x3aa2('0x26')][_0x3aa2('0x1a')](_0x3b3f6e)['then'](function(_0x55fb27){_0x49d371[_0x3aa2('0x1a')]=_0x55fb27;if(_0x4b901d[_0x3aa2('0x2c')]['includeAll']){_0x35c6ce[_0x3aa2('0x3c')]=[{'all':!![]}];}return db[_0x3aa2('0x26')]['findAll'](_0x35c6ce);})[_0x3aa2('0x20')](function(_0x50786a){_0x49d371[_0x3aa2('0x3d')]=_0x50786a;return _0x49d371;})[_0x3aa2('0x20')](respondWithFilteredResult(_0x1feb9e,_0x35c6ce))[_0x3aa2('0x3e')](handleError(_0x1feb9e,null));};exports[_0x3aa2('0x3f')]=function(_0x5a722b,_0x4c8bf8){var _0x285058={'raw':!![],'where':{'id':_0x5a722b[_0x3aa2('0x40')]['id']}},_0x10f4cf={};_0x10f4cf[_0x3aa2('0x2a')]=_[_0x3aa2('0x2d')](db[_0x3aa2('0x26')][_0x3aa2('0x27')]);_0x10f4cf[_0x3aa2('0x2c')]=_[_0x3aa2('0x2d')](_0x5a722b[_0x3aa2('0x2c')]);_0x10f4cf['filters']=_[_0x3aa2('0x2f')](_0x10f4cf[_0x3aa2('0x2a')],_0x10f4cf[_0x3aa2('0x2c')]);_0x285058['attributes']=_['intersection'](_0x10f4cf[_0x3aa2('0x2a')],qs['fields'](_0x5a722b[_0x3aa2('0x2c')][_0x3aa2('0x30')]));_0x285058[_0x3aa2('0x2e')]=_0x285058[_0x3aa2('0x2e')][_0x3aa2('0x31')]?_0x285058[_0x3aa2('0x2e')]:_0x10f4cf[_0x3aa2('0x2a')];if(_0x5a722b[_0x3aa2('0x2c')][_0x3aa2('0x41')]){_0x285058[_0x3aa2('0x3c')]=[{'all':!![]}];}_0x285058=_['merge']({},_0x285058,_0x5a722b['options']);return db[_0x3aa2('0x26')][_0x3aa2('0x42')](_0x285058)[_0x3aa2('0x20')](handleEntityNotFound(_0x4c8bf8,null))['then'](respondWithResult(_0x4c8bf8,null))['catch'](handleError(_0x4c8bf8,null));};exports['create']=function(_0x1ffcdf,_0x23b5d9){return db['AnalyticTreeReport']['create'](_0x1ffcdf[_0x3aa2('0x43')],{})[_0x3aa2('0x20')](respondWithResult(_0x23b5d9,0xc9))['catch'](handleError(_0x23b5d9,null));};exports[_0x3aa2('0x1f')]=function(_0x430410,_0x3a5e8e){if(_0x430410[_0x3aa2('0x43')]['id']){delete _0x430410[_0x3aa2('0x43')]['id'];}return db[_0x3aa2('0x26')]['find']({'where':{'id':_0x430410[_0x3aa2('0x40')]['id']}})[_0x3aa2('0x20')](handleEntityNotFound(_0x3a5e8e,null))[_0x3aa2('0x20')](saveUpdates(_0x430410[_0x3aa2('0x43')],null))[_0x3aa2('0x20')](respondWithResult(_0x3a5e8e,null))[_0x3aa2('0x3e')](handleError(_0x3a5e8e,null));};exports['destroy']=function(_0x3e91bd,_0x538a05){return db[_0x3aa2('0x26')][_0x3aa2('0x42')]({'where':{'id':_0x3e91bd['params']['id']}})[_0x3aa2('0x20')](handleEntityNotFound(_0x538a05,null))[_0x3aa2('0x20')](removeEntity(_0x538a05,null))[_0x3aa2('0x3e')](handleError(_0x538a05,null));}; \ No newline at end of file +var _0x1ebf=['body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','pick','where','merge','filter','options','includeAll','catch','params','keys','include','find','create'];(function(_0x402951,_0x49e5e1){var _0x6c8aab=function(_0xfde8ff){while(--_0xfde8ff){_0x402951['push'](_0x402951['shift']());}};_0x6c8aab(++_0x49e5e1);}(_0x1ebf,0x16e));var _0xf1eb=function(_0x342bce,_0x746aa){_0x342bce=_0x342bce-0x0;var _0x53e4f7=_0x1ebf[_0x342bce];return _0x53e4f7;};'use strict';var emlformat=require(_0xf1eb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1eb('0x1'));var rp=require(_0xf1eb('0x2'));var moment=require(_0xf1eb('0x3'));var BPromise=require(_0xf1eb('0x4'));var Mustache=require(_0xf1eb('0x5'));var util=require(_0xf1eb('0x6'));var path=require(_0xf1eb('0x7'));var sox=require(_0xf1eb('0x8'));var csv=require(_0xf1eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1eb('0xa'));var squel=require(_0xf1eb('0xb'));var crypto=require(_0xf1eb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf1eb('0xd'));var toCsv=require(_0xf1eb('0x9'));var querystring=require(_0xf1eb('0xe'));var Papa=require(_0xf1eb('0xf'));var Redis=require(_0xf1eb('0x10'));var authService=require(_0xf1eb('0x11'));var qs=require(_0xf1eb('0x12'));var as=require(_0xf1eb('0x13'));var hardwareService=require(_0xf1eb('0x14'));var logger=require(_0xf1eb('0x15'))(_0xf1eb('0x16'));var utils=require(_0xf1eb('0x17'));var config=require(_0xf1eb('0x18'));var licenseUtil=require(_0xf1eb('0x19'));var db=require(_0xf1eb('0x1a'))['db'];function respondWithStatusCode(_0x2aa5cc,_0x5e6f88){_0x5e6f88=_0x5e6f88||0xcc;return function(_0x4f518c){if(_0x4f518c){return _0x2aa5cc[_0xf1eb('0x1b')](_0x5e6f88);}return _0x2aa5cc['status'](_0x5e6f88)[_0xf1eb('0x1c')]();};}function respondWithResult(_0x4bcf89,_0x49d710){_0x49d710=_0x49d710||0xc8;return function(_0x2dd607){if(_0x2dd607){return _0x4bcf89['status'](_0x49d710)[_0xf1eb('0x1d')](_0x2dd607);}};}function respondWithFilteredResult(_0x5e8dd2,_0x41ed68){return function(_0x24bd04){if(_0x24bd04){var _0xd125fa=typeof _0x41ed68[_0xf1eb('0x1e')]===_0xf1eb('0x1f')&&typeof _0x41ed68[_0xf1eb('0x20')]==='undefined';var _0x370606=_0x24bd04[_0xf1eb('0x21')];var _0x232804=_0xd125fa?0x0:_0x41ed68['offset'];var _0x2aa181=_0xd125fa?_0x24bd04['count']:_0x41ed68[_0xf1eb('0x1e')]+_0x41ed68[_0xf1eb('0x20')];var _0x36f869;if(_0x2aa181>=_0x370606){_0x2aa181=_0x370606;_0x36f869=0xc8;}else{_0x36f869=0xce;}_0x5e8dd2[_0xf1eb('0x22')](_0x36f869);return _0x5e8dd2['set'](_0xf1eb('0x23'),_0x232804+'-'+_0x2aa181+'/'+_0x370606)['json'](_0x24bd04);}return null;};}function patchUpdates(_0x4a1edc){return function(_0x163d28){try{jsonpatch[_0xf1eb('0x24')](_0x163d28,_0x4a1edc,!![]);}catch(_0x54e333){return BPromise[_0xf1eb('0x25')](_0x54e333);}return _0x163d28['save']();};}function saveUpdates(_0xd3eca5,_0x3ada40){return function(_0x4b8191){if(_0x4b8191){return _0x4b8191['update'](_0xd3eca5)[_0xf1eb('0x26')](function(_0x5a4bb9){return _0x5a4bb9;});}return null;};}function removeEntity(_0x317c58,_0x1f95fb){return function(_0x2160d8){if(_0x2160d8){return _0x2160d8[_0xf1eb('0x27')]()[_0xf1eb('0x26')](function(){_0x317c58[_0xf1eb('0x22')](0xcc)[_0xf1eb('0x1c')]();});}};}function handleEntityNotFound(_0x26c949,_0x2cc384){return function(_0x4f10e7){if(!_0x4f10e7){_0x26c949[_0xf1eb('0x1b')](0x194);}return _0x4f10e7;};}function handleError(_0x303c84,_0x479a12){_0x479a12=_0x479a12||0x1f4;return function(_0x3b0126){logger[_0xf1eb('0x28')](_0x3b0126[_0xf1eb('0x29')]);if(_0x3b0126[_0xf1eb('0x2a')]){delete _0x3b0126[_0xf1eb('0x2a')];}_0x303c84['status'](_0x479a12)[_0xf1eb('0x2b')](_0x3b0126);};}exports[_0xf1eb('0x2c')]=function(_0x1520da,_0x2c2d20){var _0x416ef6={},_0x3bf7d6={},_0x4ffa0c={'count':0x0,'rows':[]};var _0x4a9f33=_[_0xf1eb('0x2d')](db[_0xf1eb('0x2e')][_0xf1eb('0x2f')],function(_0x491c46){return{'name':_0x491c46[_0xf1eb('0x30')],'type':_0x491c46[_0xf1eb('0x31')][_0xf1eb('0x32')]};});_0x3bf7d6['model']=_[_0xf1eb('0x2d')](_0x4a9f33,_0xf1eb('0x2a'));_0x3bf7d6[_0xf1eb('0x33')]=_['keys'](_0x1520da['query']);_0x3bf7d6[_0xf1eb('0x34')]=_['intersection'](_0x3bf7d6['model'],_0x3bf7d6[_0xf1eb('0x33')]);_0x416ef6[_0xf1eb('0x35')]=_[_0xf1eb('0x36')](_0x3bf7d6[_0xf1eb('0x37')],qs['fields'](_0x1520da[_0xf1eb('0x33')][_0xf1eb('0x38')]));_0x416ef6['attributes']=_0x416ef6[_0xf1eb('0x35')][_0xf1eb('0x39')]?_0x416ef6[_0xf1eb('0x35')]:_0x3bf7d6[_0xf1eb('0x37')];if(!_0x1520da[_0xf1eb('0x33')][_0xf1eb('0x3a')]('nolimit')){_0x416ef6[_0xf1eb('0x20')]=qs[_0xf1eb('0x20')](_0x1520da[_0xf1eb('0x33')]['limit']);_0x416ef6[_0xf1eb('0x1e')]=qs[_0xf1eb('0x1e')](_0x1520da['query'][_0xf1eb('0x1e')]);}_0x416ef6['order']=qs[_0xf1eb('0x3b')](_0x1520da[_0xf1eb('0x33')][_0xf1eb('0x3b')]);_0x416ef6['where']=qs[_0xf1eb('0x34')](_[_0xf1eb('0x3c')](_0x1520da['query'],_0x3bf7d6['filters']),_0x4a9f33);if(_0x1520da[_0xf1eb('0x33')]['filter']){_0x416ef6[_0xf1eb('0x3d')]=_[_0xf1eb('0x3e')](_0x416ef6[_0xf1eb('0x3d')],{'$or':_[_0xf1eb('0x2d')](_0x4a9f33,function(_0x1fe773){if(_0x1fe773[_0xf1eb('0x31')]!=='VIRTUAL'){var _0x40a2cb={};_0x40a2cb[_0x1fe773[_0xf1eb('0x2a')]]={'$like':'%'+_0x1520da[_0xf1eb('0x33')][_0xf1eb('0x3f')]+'%'};return _0x40a2cb;}})});}_0x416ef6=_[_0xf1eb('0x3e')]({},_0x416ef6,_0x1520da[_0xf1eb('0x40')]);var _0x2e4a03={'where':_0x416ef6[_0xf1eb('0x3d')]};return db['AnalyticTreeReport'][_0xf1eb('0x21')](_0x2e4a03)['then'](function(_0x23fc93){_0x4ffa0c[_0xf1eb('0x21')]=_0x23fc93;if(_0x1520da[_0xf1eb('0x33')][_0xf1eb('0x41')]){_0x416ef6['include']=[{'all':!![]}];}return db[_0xf1eb('0x2e')]['findAll'](_0x416ef6);})[_0xf1eb('0x26')](function(_0x3541cf){_0x4ffa0c['rows']=_0x3541cf;return _0x4ffa0c;})[_0xf1eb('0x26')](respondWithFilteredResult(_0x2c2d20,_0x416ef6))[_0xf1eb('0x42')](handleError(_0x2c2d20,null));};exports['show']=function(_0x126cd8,_0x5d40d8){var _0x1d2e36={'raw':!![],'where':{'id':_0x126cd8[_0xf1eb('0x43')]['id']}},_0x40e4ce={};_0x40e4ce['model']=_['keys'](db[_0xf1eb('0x2e')]['rawAttributes']);_0x40e4ce['query']=_[_0xf1eb('0x44')](_0x126cd8['query']);_0x40e4ce[_0xf1eb('0x34')]=_['intersection'](_0x40e4ce['model'],_0x40e4ce[_0xf1eb('0x33')]);_0x1d2e36['attributes']=_[_0xf1eb('0x36')](_0x40e4ce[_0xf1eb('0x37')],qs[_0xf1eb('0x38')](_0x126cd8[_0xf1eb('0x33')][_0xf1eb('0x38')]));_0x1d2e36[_0xf1eb('0x35')]=_0x1d2e36[_0xf1eb('0x35')]['length']?_0x1d2e36[_0xf1eb('0x35')]:_0x40e4ce['model'];if(_0x126cd8['query'][_0xf1eb('0x41')]){_0x1d2e36[_0xf1eb('0x45')]=[{'all':!![]}];}_0x1d2e36=_['merge']({},_0x1d2e36,_0x126cd8[_0xf1eb('0x40')]);return db['AnalyticTreeReport'][_0xf1eb('0x46')](_0x1d2e36)['then'](handleEntityNotFound(_0x5d40d8,null))[_0xf1eb('0x26')](respondWithResult(_0x5d40d8,null))['catch'](handleError(_0x5d40d8,null));};exports[_0xf1eb('0x47')]=function(_0x1eec20,_0x41b19b){return db[_0xf1eb('0x2e')][_0xf1eb('0x47')](_0x1eec20[_0xf1eb('0x48')],{})[_0xf1eb('0x26')](respondWithResult(_0x41b19b,0xc9))[_0xf1eb('0x42')](handleError(_0x41b19b,null));};exports['update']=function(_0x1e822d,_0x399c38){if(_0x1e822d[_0xf1eb('0x48')]['id']){delete _0x1e822d[_0xf1eb('0x48')]['id'];}return db[_0xf1eb('0x2e')][_0xf1eb('0x46')]({'where':{'id':_0x1e822d[_0xf1eb('0x43')]['id']}})[_0xf1eb('0x26')](handleEntityNotFound(_0x399c38,null))['then'](saveUpdates(_0x1e822d[_0xf1eb('0x48')],null))[_0xf1eb('0x26')](respondWithResult(_0x399c38,null))[_0xf1eb('0x42')](handleError(_0x399c38,null));};exports[_0xf1eb('0x27')]=function(_0x568339,_0x2be065){return db[_0xf1eb('0x2e')][_0xf1eb('0x46')]({'where':{'id':_0x568339['params']['id']}})[_0xf1eb('0x26')](handleEntityNotFound(_0x2be065,null))[_0xf1eb('0x26')](removeEntity(_0x2be065,null))[_0xf1eb('0x42')](handleError(_0x2be065,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 63ae6e0..77795d6 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 _0xe7cf=['request-promise','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird'];(function(_0x233f5a,_0x6dc40c){var _0x23531e=function(_0x4bf560){while(--_0x4bf560){_0x233f5a['push'](_0x233f5a['shift']());}};_0x23531e(++_0x6dc40c);}(_0xe7cf,0x13a));var _0xfe7c=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0xe7cf[_0x458ed6];return _0xa5dfd9;};'use strict';var _=require('lodash');var util=require(_0xfe7c('0x0'));var logger=require(_0xfe7c('0x1'))(_0xfe7c('0x2'));var moment=require(_0xfe7c('0x3'));var BPromise=require(_0xfe7c('0x4'));var rp=require(_0xfe7c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe7c('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe7c('0x7'));module[_0xfe7c('0x8')]=function(_0x4e7c96,_0x302d5a){return _0x4e7c96[_0xfe7c('0x9')](_0xfe7c('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd78=['moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api'];(function(_0x450178,_0x345f80){var _0x7ccf19=function(_0x50803b){while(--_0x50803b){_0x450178['push'](_0x450178['shift']());}};_0x7ccf19(++_0x345f80);}(_0xfd78,0x165));var _0x8fd7=function(_0x146f34,_0x415049){_0x146f34=_0x146f34-0x0;var _0x3a5a9a=_0xfd78[_0x146f34];return _0x3a5a9a;};'use strict';var _=require(_0x8fd7('0x0'));var util=require('util');var logger=require(_0x8fd7('0x1'))(_0x8fd7('0x2'));var moment=require(_0x8fd7('0x3'));var BPromise=require(_0x8fd7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fd7('0x5'));var rimraf=require(_0x8fd7('0x6'));var config=require(_0x8fd7('0x7'));var attributes=require(_0x8fd7('0x8'));module['exports']=function(_0x5c6d8d,_0x192159){return _0x5c6d8d[_0x8fd7('0x9')](_0x8fd7('0xa'),attributes,{'tableName':_0x8fd7('0xb'),'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 1cd631a..39009cf 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x627a78,_0x1ef671){var _0x59c479=function(_0x12909a){while(--_0x12909a){_0x627a78['push'](_0x627a78['shift']());}};_0x59c479(++_0x1ef671);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a9cc1,_0x5ce0a6){_0x2a9cc1=_0x2a9cc1-0x0;var _0x3f2a35=_0x5f2f[_0x2a9cc1];return _0x3f2a35;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1c9ee5,_0x1c6e8b){var _0x2edc21=function(_0x5b5ea1){while(--_0x5b5ea1){_0x1c9ee5['push'](_0x1c9ee5['shift']());}};_0x2edc21(++_0x1c6e8b);}(_0x1261,0x144));var _0x1126=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0x1261[_0x15f27e];return _0x18da4f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c496715..f1331dc 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 _0x0d8a=['exports','multer','connect-timeout','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','put','/:id','delete'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x0d8a,0xf1));var _0xa0d8=function(_0x20ecd8,_0x18dde6){_0x20ecd8=_0x20ecd8-0x0;var _0x5c2824=_0x0d8a[_0x20ecd8];return _0x5c2824;};'use strict';var multer=require(_0xa0d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa0d8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0d8('0x2'));var controller=require(_0xa0d8('0x3'));router['get']('/',auth[_0xa0d8('0x4')](),controller[_0xa0d8('0x5')]);router[_0xa0d8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa0d8('0x7')]);router['post']('/',auth[_0xa0d8('0x4')](),controller['create']);router[_0xa0d8('0x8')](_0xa0d8('0x9'),auth[_0xa0d8('0x4')](),controller['update']);router[_0xa0d8('0xa')]('/:id',auth[_0xa0d8('0x4')](),controller['destroy']);module[_0xa0d8('0xb')]=router; \ No newline at end of file +var _0xf3d2=['destroy','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x340f49,_0xec45c5){var _0xd5cd44=function(_0x32e242){while(--_0x32e242){_0x340f49['push'](_0x340f49['shift']());}};_0xd5cd44(++_0xec45c5);}(_0xf3d2,0xab));var _0x2f3d=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xf3d2[_0x3e32a8];return _0x2997b0;};'use strict';var multer=require('multer');var util=require(_0x2f3d('0x0'));var path=require(_0x2f3d('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f3d('0x2'));var router=express['Router']();var fs_extra=require(_0x2f3d('0x3'));var auth=require(_0x2f3d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2f3d('0x5'));var controller=require(_0x2f3d('0x6'));router[_0x2f3d('0x7')]('/',auth[_0x2f3d('0x8')](),controller[_0x2f3d('0x9')]);router[_0x2f3d('0x7')](_0x2f3d('0xa'),auth[_0x2f3d('0x8')](),controller[_0x2f3d('0xb')]);router[_0x2f3d('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f3d('0xd')]);router['put'](_0x2f3d('0xa'),auth['isAuthenticated'](),controller[_0x2f3d('0xe')]);router[_0x2f3d('0xf')](_0x2f3d('0xa'),auth['isAuthenticated'](),controller[_0x2f3d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 573cb2b..bff7e28 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 _0x25b0=['exports','STRING','sequelize'];(function(_0x9553a2,_0x5424d9){var _0x3e398c=function(_0x5e0e68){while(--_0x5e0e68){_0x9553a2['push'](_0x9553a2['shift']());}};_0x3e398c(++_0x5424d9);}(_0x25b0,0x140));var _0x025b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x25b0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x025b('0x0'));module[_0x025b('0x1')]={'name':{'type':Sequelize[_0x025b('0x2')]},'basename':{'type':Sequelize[_0x025b('0x2')]},'type':{'type':Sequelize[_0x025b('0x2')]}}; \ No newline at end of file +var _0x238f=['sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x238f,0xa5));var _0xf238=function(_0x6bb392,_0x4bc05e){_0x6bb392=_0x6bb392-0x0;var _0x2cf8e2=_0x238f[_0x6bb392];return _0x2cf8e2;};'use strict';var Sequelize=require(_0xf238('0x0'));module[_0xf238('0x1')]={'name':{'type':Sequelize[_0xf238('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf238('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c9afb92..d05cbfc 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 _0xa508=['json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','Attachment','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0xa508,0x8f));var _0x8a50=function(_0x2fcf27,_0x2b79ba){_0x2fcf27=_0x2fcf27-0x0;var _0x5f0fb0=_0xa508[_0x2fcf27];return _0x5f0fb0;};'use strict';var emlformat=require(_0x8a50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a50('0x1'));var jsonpatch=require(_0x8a50('0x2'));var rp=require('request-promise');var moment=require(_0x8a50('0x3'));var BPromise=require(_0x8a50('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a50('0x5'));var sox=require(_0x8a50('0x6'));var csv=require('to-csv');var ejs=require(_0x8a50('0x7'));var fs=require('fs');var fs_extra=require(_0x8a50('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a50('0x9'));var deskjs=require(_0x8a50('0xa'));var toCsv=require(_0x8a50('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a50('0xc'));var authService=require(_0x8a50('0xd'));var qs=require(_0x8a50('0xe'));var as=require(_0x8a50('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a50('0x10'))(_0x8a50('0x11'));var utils=require(_0x8a50('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a50('0x13'))['db'];function respondWithStatusCode(_0x1a1d33,_0x409050){_0x409050=_0x409050||0xcc;return function(_0x25d377){if(_0x25d377){return _0x1a1d33[_0x8a50('0x14')](_0x409050);}return _0x1a1d33[_0x8a50('0x15')](_0x409050)[_0x8a50('0x16')]();};}function respondWithResult(_0x3daa46,_0x161eb5){_0x161eb5=_0x161eb5||0xc8;return function(_0x171f2f){if(_0x171f2f){return _0x3daa46['status'](_0x161eb5)[_0x8a50('0x17')](_0x171f2f);}};}function respondWithFilteredResult(_0x410341,_0x1c4ee1){return function(_0x45654f){if(_0x45654f){var _0x2ca268=typeof _0x1c4ee1[_0x8a50('0x18')]===_0x8a50('0x19')&&typeof _0x1c4ee1[_0x8a50('0x1a')]===_0x8a50('0x19');var _0xb8d6cd=_0x45654f['count'];var _0x55a70a=_0x2ca268?0x0:_0x1c4ee1[_0x8a50('0x18')];var _0x34ccec=_0x2ca268?_0x45654f[_0x8a50('0x1b')]:_0x1c4ee1[_0x8a50('0x18')]+_0x1c4ee1[_0x8a50('0x1a')];var _0x318fc9;if(_0x34ccec>=_0xb8d6cd){_0x34ccec=_0xb8d6cd;_0x318fc9=0xc8;}else{_0x318fc9=0xce;}_0x410341[_0x8a50('0x15')](_0x318fc9);return _0x410341['set'](_0x8a50('0x1c'),_0x55a70a+'-'+_0x34ccec+'/'+_0xb8d6cd)[_0x8a50('0x17')](_0x45654f);}return null;};}function patchUpdates(_0x1a95ea){return function(_0x19bf97){try{jsonpatch[_0x8a50('0x1d')](_0x19bf97,_0x1a95ea,!![]);}catch(_0x3a0db2){return BPromise['reject'](_0x3a0db2);}return _0x19bf97[_0x8a50('0x1e')]();};}function saveUpdates(_0x28a8bc,_0x5d20f2){return function(_0x1c6139){if(_0x1c6139){return _0x1c6139[_0x8a50('0x1f')](_0x28a8bc)[_0x8a50('0x20')](function(_0x5955e8){return _0x5955e8;});}return null;};}function removeEntity(_0x3d6f82,_0x2ff9e0){return function(_0x1250f9){if(_0x1250f9){return _0x1250f9[_0x8a50('0x21')]()[_0x8a50('0x20')](function(){_0x3d6f82[_0x8a50('0x15')](0xcc)[_0x8a50('0x16')]();});}};}function handleEntityNotFound(_0x251203,_0x7db50b){return function(_0xe5c9ab){if(!_0xe5c9ab){_0x251203[_0x8a50('0x14')](0x194);}return _0xe5c9ab;};}function handleError(_0x5acfe2,_0x33c377){_0x33c377=_0x33c377||0x1f4;return function(_0x409a36){logger['error'](_0x409a36['stack']);if(_0x409a36[_0x8a50('0x22')]){delete _0x409a36[_0x8a50('0x22')];}_0x5acfe2['status'](_0x33c377)[_0x8a50('0x23')](_0x409a36);};}exports[_0x8a50('0x24')]=function(_0x36fe98,_0x1c994e){var _0x292cb6={},_0x2bbdfa={},_0x41d6ec={'count':0x0,'rows':[]};var _0x2a4da4=_['map'](db[_0x8a50('0x25')][_0x8a50('0x26')],function(_0x52a057){return{'name':_0x52a057[_0x8a50('0x27')],'type':_0x52a057[_0x8a50('0x28')][_0x8a50('0x29')]};});_0x2bbdfa['model']=_[_0x8a50('0x2a')](_0x2a4da4,_0x8a50('0x22'));_0x2bbdfa['query']=_['keys'](_0x36fe98[_0x8a50('0x2b')]);_0x2bbdfa['filters']=_[_0x8a50('0x2c')](_0x2bbdfa[_0x8a50('0x2d')],_0x2bbdfa[_0x8a50('0x2b')]);_0x292cb6['attributes']=_[_0x8a50('0x2c')](_0x2bbdfa[_0x8a50('0x2d')],qs['fields'](_0x36fe98['query'][_0x8a50('0x2e')]));_0x292cb6['attributes']=_0x292cb6['attributes'][_0x8a50('0x2f')]?_0x292cb6[_0x8a50('0x30')]:_0x2bbdfa['model'];if(!_0x36fe98['query'][_0x8a50('0x31')]('nolimit')){_0x292cb6[_0x8a50('0x1a')]=qs[_0x8a50('0x1a')](_0x36fe98[_0x8a50('0x2b')][_0x8a50('0x1a')]);_0x292cb6[_0x8a50('0x18')]=qs[_0x8a50('0x18')](_0x36fe98['query']['offset']);}_0x292cb6[_0x8a50('0x32')]=qs['sort'](_0x36fe98[_0x8a50('0x2b')][_0x8a50('0x33')]);_0x292cb6['where']=qs[_0x8a50('0x34')](_[_0x8a50('0x35')](_0x36fe98[_0x8a50('0x2b')],_0x2bbdfa[_0x8a50('0x34')]),_0x2a4da4);if(_0x36fe98[_0x8a50('0x2b')][_0x8a50('0x36')]){_0x292cb6[_0x8a50('0x37')]=_[_0x8a50('0x38')](_0x292cb6[_0x8a50('0x37')],{'$or':_[_0x8a50('0x2a')](_0x2a4da4,function(_0xc68ad2){if(_0xc68ad2[_0x8a50('0x28')]!==_0x8a50('0x39')){var _0x583587={};_0x583587[_0xc68ad2[_0x8a50('0x22')]]={'$like':'%'+_0x36fe98[_0x8a50('0x2b')][_0x8a50('0x36')]+'%'};return _0x583587;}})});}_0x292cb6=_['merge']({},_0x292cb6,_0x36fe98[_0x8a50('0x3a')]);var _0x2eb861={'where':_0x292cb6['where']};return db[_0x8a50('0x25')][_0x8a50('0x1b')](_0x2eb861)[_0x8a50('0x20')](function(_0x15993e){_0x41d6ec[_0x8a50('0x1b')]=_0x15993e;if(_0x36fe98[_0x8a50('0x2b')][_0x8a50('0x3b')]){_0x292cb6[_0x8a50('0x3c')]=[{'all':!![]}];}return db[_0x8a50('0x25')]['findAll'](_0x292cb6);})[_0x8a50('0x20')](function(_0x277d5a){_0x41d6ec[_0x8a50('0x3d')]=_0x277d5a;return _0x41d6ec;})[_0x8a50('0x20')](respondWithFilteredResult(_0x1c994e,_0x292cb6))[_0x8a50('0x3e')](handleError(_0x1c994e,null));};exports[_0x8a50('0x3f')]=function(_0x5919ed,_0x19dc38){var _0x51c066={'raw':!![],'where':{'id':_0x5919ed[_0x8a50('0x40')]['id']}},_0x225378={};_0x225378[_0x8a50('0x2d')]=_[_0x8a50('0x41')](db[_0x8a50('0x25')]['rawAttributes']);_0x225378['query']=_[_0x8a50('0x41')](_0x5919ed[_0x8a50('0x2b')]);_0x225378['filters']=_[_0x8a50('0x2c')](_0x225378[_0x8a50('0x2d')],_0x225378[_0x8a50('0x2b')]);_0x51c066['attributes']=_[_0x8a50('0x2c')](_0x225378[_0x8a50('0x2d')],qs[_0x8a50('0x2e')](_0x5919ed[_0x8a50('0x2b')][_0x8a50('0x2e')]));_0x51c066[_0x8a50('0x30')]=_0x51c066[_0x8a50('0x30')]['length']?_0x51c066[_0x8a50('0x30')]:_0x225378[_0x8a50('0x2d')];if(_0x5919ed[_0x8a50('0x2b')][_0x8a50('0x3b')]){_0x51c066[_0x8a50('0x3c')]=[{'all':!![]}];}_0x51c066=_[_0x8a50('0x38')]({},_0x51c066,_0x5919ed['options']);return db[_0x8a50('0x25')][_0x8a50('0x42')](_0x51c066)['then'](handleEntityNotFound(_0x19dc38,null))[_0x8a50('0x20')](respondWithResult(_0x19dc38,null))[_0x8a50('0x3e')](handleError(_0x19dc38,null));};exports['clone']=function(_0x5f288d,_0x41892c){var _0xe027e6={'where':{'id':_0x5f288d[_0x8a50('0x40')]['id']}},_0xfbd7f6={};_0xfbd7f6['model']=_[_0x8a50('0x41')](db[_0x8a50('0x25')][_0x8a50('0x26')]);_0xe027e6[_0x8a50('0x30')]=_[_0x8a50('0x2c')](_0xfbd7f6[_0x8a50('0x2d')],qs[_0x8a50('0x2e')](_0x5f288d[_0x8a50('0x2b')][_0x8a50('0x2e')]));_0xe027e6[_0x8a50('0x30')]=_0xe027e6[_0x8a50('0x30')][_0x8a50('0x2f')]?_0xe027e6[_0x8a50('0x30')]:_0xfbd7f6['model'];if(_0x5f288d[_0x8a50('0x2b')][_0x8a50('0x3b')]){_0xe027e6[_0x8a50('0x3c')]=[{'all':!![]}];}_0xe027e6=_[_0x8a50('0x38')]({},_0xe027e6,_0x5f288d[_0x8a50('0x3a')]);return db[_0x8a50('0x25')][_0x8a50('0x42')](_0xe027e6)[_0x8a50('0x20')](handleEntityNotFound(_0x41892c,null))[_0x8a50('0x20')](function(_0xede329){if(_0xede329){var _0x780b7b=_0xede329[_0x8a50('0x43')]({'plain':!![]});_0x780b7b=qs[_0x8a50('0x44')](_0x780b7b,['id',_0x8a50('0x45'),_0x8a50('0x46')]);_0x5f288d[_0x8a50('0x47')]=_['omit'](_0x5f288d['body'],['id',_0x8a50('0x45'),'updatedAt']);return db[_0x8a50('0x25')][_0x8a50('0x48')](_[_0x8a50('0x38')](_0x780b7b,_0x5f288d[_0x8a50('0x47')]),{'include':_0x5f288d[_0x8a50('0x2b')][_0x8a50('0x3b')]?[{'all':!![]}]:undefined});}})[_0x8a50('0x20')](respondWithResult(_0x41892c,0xc9))[_0x8a50('0x3e')](handleError(_0x41892c,null));};exports[_0x8a50('0x1f')]=function(_0x330c04,_0x5141ba){if(_0x330c04[_0x8a50('0x47')]['id']){delete _0x330c04['body']['id'];}return db[_0x8a50('0x25')][_0x8a50('0x42')]({'where':{'id':_0x330c04[_0x8a50('0x40')]['id']}})[_0x8a50('0x20')](handleEntityNotFound(_0x5141ba,null))['then'](saveUpdates(_0x330c04[_0x8a50('0x47')],null))['then'](respondWithResult(_0x5141ba,null))[_0x8a50('0x3e')](handleError(_0x5141ba,null));};exports[_0x8a50('0x21')]=function(_0x1f0282,_0x26b084){return db['Attachment'][_0x8a50('0x42')]({'where':{'id':_0x1f0282[_0x8a50('0x40')]['id']}})[_0x8a50('0x20')](handleEntityNotFound(_0x26b084,null))['then'](removeEntity(_0x26b084,null))[_0x8a50('0x3e')](handleError(_0x26b084,null));};exports[_0x8a50('0x48')]=function(_0x5db12b,_0x1c7b5c,_0x3873ea){_0x5db12b[_0x8a50('0x47')][_0x8a50('0x22')]=_0x5db12b[_0x8a50('0x49')][_0x8a50('0x4a')];_0x5db12b[_0x8a50('0x47')][_0x8a50('0x4b')]=_0x5db12b[_0x8a50('0x49')][_0x8a50('0x4c')];_0x5db12b[_0x8a50('0x47')][_0x8a50('0x28')]=_0x5db12b['file']['mimetype'];return db[_0x8a50('0x25')][_0x8a50('0x48')](_0x5db12b[_0x8a50('0x47')])['then'](respondWithResult(_0x1c7b5c,0xc9))[_0x8a50('0x3e')](handleError(_0x1c7b5c,null));};exports['download']=function(_0x241a2c,_0x3b7d23,_0xbe4738){return db[_0x8a50('0x25')][_0x8a50('0x4d')]({'where':{'id':_0x241a2c[_0x8a50('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3b7d23,null))[_0x8a50('0x20')](function(_0x2b21a9){if(_0x2b21a9){var _0x20f3eb=_0x2b21a9[_0x8a50('0x4e')]!==null;var _0x42b730=path[_0x8a50('0x4f')](config[_0x8a50('0x50')],_0x8a50('0x51'));if(_0x20f3eb){_0x42b730=path[_0x8a50('0x4f')](_0x42b730,_0x8a50('0x52'));}var _0x2eb40a=path[_0x8a50('0x4f')](_0x42b730,_0x2b21a9['basename']);return _0x3b7d23['download'](_0x2eb40a);}})[_0x8a50('0x3e')](handleError(_0x3b7d23,null));}; \ No newline at end of file +var _0xf91a=['stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','clone','get','omit','body','createdAt','updatedAt','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x466e89,_0x237ae3){var _0x580986=function(_0x1ca46d){while(--_0x1ca46d){_0x466e89['push'](_0x466e89['shift']());}};_0x580986(++_0x237ae3);}(_0xf91a,0x155));var _0xaf91=function(_0x5e63c9,_0x252353){_0x5e63c9=_0x5e63c9-0x0;var _0x38878f=_0xf91a[_0x5e63c9];return _0x38878f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf91('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf91('0x1'));var rp=require(_0xaf91('0x2'));var moment=require(_0xaf91('0x3'));var BPromise=require(_0xaf91('0x4'));var Mustache=require(_0xaf91('0x5'));var util=require(_0xaf91('0x6'));var path=require(_0xaf91('0x7'));var sox=require(_0xaf91('0x8'));var csv=require('to-csv');var ejs=require(_0xaf91('0x9'));var fs=require('fs');var fs_extra=require(_0xaf91('0xa'));var _=require(_0xaf91('0xb'));var squel=require(_0xaf91('0xc'));var crypto=require(_0xaf91('0xd'));var jsforce=require(_0xaf91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf91('0xf'));var querystring=require(_0xaf91('0x10'));var Papa=require(_0xaf91('0x11'));var Redis=require(_0xaf91('0x12'));var authService=require(_0xaf91('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaf91('0x14'));var hardwareService=require(_0xaf91('0x15'));var logger=require(_0xaf91('0x16'))(_0xaf91('0x17'));var utils=require(_0xaf91('0x18'));var config=require(_0xaf91('0x19'));var licenseUtil=require(_0xaf91('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42c08e,_0x44bcd7){_0x44bcd7=_0x44bcd7||0xcc;return function(_0x263c54){if(_0x263c54){return _0x42c08e['sendStatus'](_0x44bcd7);}return _0x42c08e[_0xaf91('0x1b')](_0x44bcd7)[_0xaf91('0x1c')]();};}function respondWithResult(_0x2d913d,_0x3af7dc){_0x3af7dc=_0x3af7dc||0xc8;return function(_0x2f4814){if(_0x2f4814){return _0x2d913d[_0xaf91('0x1b')](_0x3af7dc)[_0xaf91('0x1d')](_0x2f4814);}};}function respondWithFilteredResult(_0x28db0d,_0x28a77d){return function(_0x24ce71){if(_0x24ce71){var _0x3270e8=typeof _0x28a77d[_0xaf91('0x1e')]===_0xaf91('0x1f')&&typeof _0x28a77d['limit']===_0xaf91('0x1f');var _0x42d670=_0x24ce71[_0xaf91('0x20')];var _0x4b9a2b=_0x3270e8?0x0:_0x28a77d[_0xaf91('0x1e')];var _0x4411c7=_0x3270e8?_0x24ce71['count']:_0x28a77d[_0xaf91('0x1e')]+_0x28a77d['limit'];var _0x4e758d;if(_0x4411c7>=_0x42d670){_0x4411c7=_0x42d670;_0x4e758d=0xc8;}else{_0x4e758d=0xce;}_0x28db0d[_0xaf91('0x1b')](_0x4e758d);return _0x28db0d[_0xaf91('0x21')](_0xaf91('0x22'),_0x4b9a2b+'-'+_0x4411c7+'/'+_0x42d670)[_0xaf91('0x1d')](_0x24ce71);}return null;};}function patchUpdates(_0x19e28b){return function(_0x4d045b){try{jsonpatch[_0xaf91('0x23')](_0x4d045b,_0x19e28b,!![]);}catch(_0x3a71a2){return BPromise[_0xaf91('0x24')](_0x3a71a2);}return _0x4d045b[_0xaf91('0x25')]();};}function saveUpdates(_0x7d3d41,_0x1f3b93){return function(_0xc55759){if(_0xc55759){return _0xc55759[_0xaf91('0x26')](_0x7d3d41)[_0xaf91('0x27')](function(_0x5163c9){return _0x5163c9;});}return null;};}function removeEntity(_0x4df8fd,_0x2e1904){return function(_0x24337d){if(_0x24337d){return _0x24337d[_0xaf91('0x28')]()[_0xaf91('0x27')](function(){_0x4df8fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b27e8,_0x253528){return function(_0x2a353d){if(!_0x2a353d){_0x2b27e8[_0xaf91('0x29')](0x194);}return _0x2a353d;};}function handleError(_0x5e8de7,_0x3deb43){_0x3deb43=_0x3deb43||0x1f4;return function(_0x40ac7f){logger[_0xaf91('0x2a')](_0x40ac7f[_0xaf91('0x2b')]);if(_0x40ac7f[_0xaf91('0x2c')]){delete _0x40ac7f[_0xaf91('0x2c')];}_0x5e8de7[_0xaf91('0x1b')](_0x3deb43)[_0xaf91('0x2d')](_0x40ac7f);};}exports[_0xaf91('0x2e')]=function(_0x4aff87,_0x1cb6f2){var _0x10e3fb={},_0x45e113={},_0x44e12a={'count':0x0,'rows':[]};var _0x2eba50=_[_0xaf91('0x2f')](db[_0xaf91('0x30')][_0xaf91('0x31')],function(_0x5f4124){return{'name':_0x5f4124[_0xaf91('0x32')],'type':_0x5f4124['type'][_0xaf91('0x33')]};});_0x45e113[_0xaf91('0x34')]=_[_0xaf91('0x2f')](_0x2eba50,_0xaf91('0x2c'));_0x45e113[_0xaf91('0x35')]=_[_0xaf91('0x36')](_0x4aff87['query']);_0x45e113[_0xaf91('0x37')]=_[_0xaf91('0x38')](_0x45e113[_0xaf91('0x34')],_0x45e113[_0xaf91('0x35')]);_0x10e3fb[_0xaf91('0x39')]=_[_0xaf91('0x38')](_0x45e113['model'],qs[_0xaf91('0x3a')](_0x4aff87[_0xaf91('0x35')][_0xaf91('0x3a')]));_0x10e3fb[_0xaf91('0x39')]=_0x10e3fb[_0xaf91('0x39')][_0xaf91('0x3b')]?_0x10e3fb[_0xaf91('0x39')]:_0x45e113['model'];if(!_0x4aff87[_0xaf91('0x35')][_0xaf91('0x3c')](_0xaf91('0x3d'))){_0x10e3fb['limit']=qs[_0xaf91('0x3e')](_0x4aff87[_0xaf91('0x35')]['limit']);_0x10e3fb[_0xaf91('0x1e')]=qs[_0xaf91('0x1e')](_0x4aff87[_0xaf91('0x35')][_0xaf91('0x1e')]);}_0x10e3fb[_0xaf91('0x3f')]=qs[_0xaf91('0x40')](_0x4aff87[_0xaf91('0x35')][_0xaf91('0x40')]);_0x10e3fb[_0xaf91('0x41')]=qs[_0xaf91('0x37')](_[_0xaf91('0x42')](_0x4aff87[_0xaf91('0x35')],_0x45e113[_0xaf91('0x37')]),_0x2eba50);if(_0x4aff87['query'][_0xaf91('0x43')]){_0x10e3fb['where']=_[_0xaf91('0x44')](_0x10e3fb[_0xaf91('0x41')],{'$or':_[_0xaf91('0x2f')](_0x2eba50,function(_0x1130e1){if(_0x1130e1[_0xaf91('0x45')]!=='VIRTUAL'){var _0xf7f705={};_0xf7f705[_0x1130e1[_0xaf91('0x2c')]]={'$like':'%'+_0x4aff87[_0xaf91('0x35')]['filter']+'%'};return _0xf7f705;}})});}_0x10e3fb=_[_0xaf91('0x44')]({},_0x10e3fb,_0x4aff87[_0xaf91('0x46')]);var _0x3dfc78={'where':_0x10e3fb['where']};return db[_0xaf91('0x30')][_0xaf91('0x20')](_0x3dfc78)[_0xaf91('0x27')](function(_0x472ed4){_0x44e12a['count']=_0x472ed4;if(_0x4aff87['query'][_0xaf91('0x47')]){_0x10e3fb[_0xaf91('0x48')]=[{'all':!![]}];}return db[_0xaf91('0x30')][_0xaf91('0x49')](_0x10e3fb);})[_0xaf91('0x27')](function(_0x238d63){_0x44e12a[_0xaf91('0x4a')]=_0x238d63;return _0x44e12a;})[_0xaf91('0x27')](respondWithFilteredResult(_0x1cb6f2,_0x10e3fb))['catch'](handleError(_0x1cb6f2,null));};exports[_0xaf91('0x4b')]=function(_0x4c53b8,_0x160c8e){var _0x33d027={'raw':!![],'where':{'id':_0x4c53b8[_0xaf91('0x4c')]['id']}},_0x28d078={};_0x28d078[_0xaf91('0x34')]=_[_0xaf91('0x36')](db[_0xaf91('0x30')][_0xaf91('0x31')]);_0x28d078[_0xaf91('0x35')]=_[_0xaf91('0x36')](_0x4c53b8['query']);_0x28d078[_0xaf91('0x37')]=_[_0xaf91('0x38')](_0x28d078[_0xaf91('0x34')],_0x28d078['query']);_0x33d027[_0xaf91('0x39')]=_['intersection'](_0x28d078['model'],qs['fields'](_0x4c53b8[_0xaf91('0x35')]['fields']));_0x33d027[_0xaf91('0x39')]=_0x33d027[_0xaf91('0x39')]['length']?_0x33d027[_0xaf91('0x39')]:_0x28d078['model'];if(_0x4c53b8[_0xaf91('0x35')][_0xaf91('0x47')]){_0x33d027[_0xaf91('0x48')]=[{'all':!![]}];}_0x33d027=_['merge']({},_0x33d027,_0x4c53b8[_0xaf91('0x46')]);return db[_0xaf91('0x30')][_0xaf91('0x4d')](_0x33d027)[_0xaf91('0x27')](handleEntityNotFound(_0x160c8e,null))[_0xaf91('0x27')](respondWithResult(_0x160c8e,null))[_0xaf91('0x4e')](handleError(_0x160c8e,null));};exports[_0xaf91('0x4f')]=function(_0x195c66,_0x59babd){var _0x96853f={'where':{'id':_0x195c66[_0xaf91('0x4c')]['id']}},_0x2a502d={};_0x2a502d[_0xaf91('0x34')]=_[_0xaf91('0x36')](db[_0xaf91('0x30')][_0xaf91('0x31')]);_0x96853f[_0xaf91('0x39')]=_[_0xaf91('0x38')](_0x2a502d[_0xaf91('0x34')],qs['fields'](_0x195c66[_0xaf91('0x35')][_0xaf91('0x3a')]));_0x96853f[_0xaf91('0x39')]=_0x96853f['attributes'][_0xaf91('0x3b')]?_0x96853f[_0xaf91('0x39')]:_0x2a502d[_0xaf91('0x34')];if(_0x195c66[_0xaf91('0x35')][_0xaf91('0x47')]){_0x96853f[_0xaf91('0x48')]=[{'all':!![]}];}_0x96853f=_['merge']({},_0x96853f,_0x195c66['options']);return db[_0xaf91('0x30')]['find'](_0x96853f)[_0xaf91('0x27')](handleEntityNotFound(_0x59babd,null))['then'](function(_0x4175df){if(_0x4175df){var _0x3ff74f=_0x4175df[_0xaf91('0x50')]({'plain':!![]});_0x3ff74f=qs[_0xaf91('0x51')](_0x3ff74f,['id','createdAt','updatedAt']);_0x195c66[_0xaf91('0x52')]=_[_0xaf91('0x51')](_0x195c66[_0xaf91('0x52')],['id',_0xaf91('0x53'),_0xaf91('0x54')]);return db[_0xaf91('0x30')][_0xaf91('0x55')](_[_0xaf91('0x44')](_0x3ff74f,_0x195c66[_0xaf91('0x52')]),{'include':_0x195c66[_0xaf91('0x35')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xaf91('0x27')](respondWithResult(_0x59babd,0xc9))[_0xaf91('0x4e')](handleError(_0x59babd,null));};exports[_0xaf91('0x26')]=function(_0x235370,_0x14c4f7){if(_0x235370[_0xaf91('0x52')]['id']){delete _0x235370[_0xaf91('0x52')]['id'];}return db[_0xaf91('0x30')][_0xaf91('0x4d')]({'where':{'id':_0x235370[_0xaf91('0x4c')]['id']}})[_0xaf91('0x27')](handleEntityNotFound(_0x14c4f7,null))[_0xaf91('0x27')](saveUpdates(_0x235370[_0xaf91('0x52')],null))[_0xaf91('0x27')](respondWithResult(_0x14c4f7,null))['catch'](handleError(_0x14c4f7,null));};exports[_0xaf91('0x28')]=function(_0x4c3bc8,_0x2ab281){return db[_0xaf91('0x30')][_0xaf91('0x4d')]({'where':{'id':_0x4c3bc8['params']['id']}})[_0xaf91('0x27')](handleEntityNotFound(_0x2ab281,null))[_0xaf91('0x27')](removeEntity(_0x2ab281,null))[_0xaf91('0x4e')](handleError(_0x2ab281,null));};exports[_0xaf91('0x55')]=function(_0x4c39a8,_0x2f36c7,_0x13600d){_0x4c39a8[_0xaf91('0x52')][_0xaf91('0x2c')]=_0x4c39a8[_0xaf91('0x56')][_0xaf91('0x57')];_0x4c39a8[_0xaf91('0x52')][_0xaf91('0x58')]=_0x4c39a8['file']['filename'];_0x4c39a8[_0xaf91('0x52')]['type']=_0x4c39a8[_0xaf91('0x56')][_0xaf91('0x59')];return db[_0xaf91('0x30')][_0xaf91('0x55')](_0x4c39a8[_0xaf91('0x52')])[_0xaf91('0x27')](respondWithResult(_0x2f36c7,0xc9))['catch'](handleError(_0x2f36c7,null));};exports[_0xaf91('0x5a')]=function(_0x15f1ae,_0x4c49b2,_0x42d014){return db[_0xaf91('0x30')][_0xaf91('0x5b')]({'where':{'id':_0x15f1ae['params']['id']},'raw':!![]})[_0xaf91('0x27')](handleEntityNotFound(_0x4c49b2,null))[_0xaf91('0x27')](function(_0x7edea6){if(_0x7edea6){var _0x54f632=_0x7edea6[_0xaf91('0x5c')]!==null;var _0xd153d5=path['join'](config[_0xaf91('0x5d')],'server/files/attachments/');if(_0x54f632){_0xd153d5=path[_0xaf91('0x5e')](_0xd153d5,_0xaf91('0x5f'));}var _0x1302fd=path[_0xaf91('0x5e')](_0xd153d5,_0x7edea6[_0xaf91('0x58')]);return _0x4c49b2[_0xaf91('0x5a')](_0x1302fd);}})['catch'](handleError(_0x4c49b2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a49a097..b316884 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 _0x964b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x1ed922,_0x34830d){var _0x282899=function(_0x458b67){while(--_0x458b67){_0x1ed922['push'](_0x1ed922['shift']());}};_0x282899(++_0x34830d);}(_0x964b,0xc2));var _0xb964=function(_0x55d70d,_0x5a40cb){_0x55d70d=_0x55d70d-0x0;var _0x471f38=_0x964b[_0x55d70d];return _0x471f38;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require(_0xb964('0x5'));var fs=require('fs');var path=require(_0xb964('0x6'));var rimraf=require(_0xb964('0x7'));var config=require(_0xb964('0x8'));var attributes=require(_0xb964('0x9'));module[_0xb964('0xa')]=function(_0x13c8f8,_0x52b48b){return _0x13c8f8[_0xb964('0xb')](_0xb964('0xc'),attributes,{'tableName':_0xb964('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5094=['../../config/environment','./attachment.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xd07e81,_0x1ccacd){var _0x379364=function(_0x8f8eec){while(--_0x8f8eec){_0xd07e81['push'](_0xd07e81['shift']());}};_0x379364(++_0x1ccacd);}(_0x5094,0x1a8));var _0x4509=function(_0x5b1b21,_0x26c3e8){_0x5b1b21=_0x5b1b21-0x0;var _0x4e0d1a=_0x5094[_0x5b1b21];return _0x4e0d1a;};'use strict';var _=require(_0x4509('0x0'));var util=require(_0x4509('0x1'));var logger=require('../../config/logger')(_0x4509('0x2'));var moment=require(_0x4509('0x3'));var BPromise=require(_0x4509('0x4'));var rp=require(_0x4509('0x5'));var fs=require('fs');var path=require(_0x4509('0x6'));var rimraf=require(_0x4509('0x7'));var config=require(_0x4509('0x8'));var attributes=require(_0x4509('0x9'));module[_0x4509('0xa')]=function(_0xbb02c0,_0x407bb8){return _0xbb02c0[_0x4509('0xb')]('Attachment',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 a2dcaa9..e962738 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 _0x559a=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4ed5e6,_0x366905){var _0x4249f9=function(_0x505fbe){while(--_0x505fbe){_0x4ed5e6['push'](_0x4ed5e6['shift']());}};_0x4249f9(++_0x366905);}(_0x559a,0xb3));var _0xa559=function(_0x31220a,_0x153982){_0x31220a=_0x31220a-0x0;var _0x334907=_0x559a[_0x31220a];return _0x334907;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});}exports[_0xa559('0x16')]=function(_0x163405){var _0xd21ebf=this;return new Promise(function(_0x1a4c42,_0x16f090){return db[_0xa559('0x17')][_0xa559('0x18')](_0x163405[_0xa559('0x19')],{'raw':_0x163405[_0xa559('0x1a')]?_0x163405['options']['raw']===undefined?!![]:![]:!![]})[_0xa559('0xb')](function(_0x3aa532){logger['info'](_0xa559('0x16'),_0x163405);logger[_0xa559('0xf')](_0xa559('0x16'),_0x163405,JSON[_0xa559('0x10')](_0x3aa532));_0x1a4c42(_0x3aa532);})[_0xa559('0x15')](function(_0x2dd8cf){logger['error'](_0xa559('0x16'),_0x2dd8cf['message'],_0x163405);_0x16f090(_0xd21ebf[_0xa559('0x11')](0x1f4,_0x2dd8cf[_0xa559('0x13')]));});});}; \ No newline at end of file +var _0xde50=['randomstring','ioredis','../../config/utils','rpc','http','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird'];(function(_0x1b2627,_0x234fbd){var _0x4cb0a4=function(_0x253f71){while(--_0x253f71){_0x1b2627['push'](_0x1b2627['shift']());}};_0x4cb0a4(++_0x234fbd);}(_0xde50,0x140));var _0x0de5=function(_0xdaf978,_0x3772a2){_0xdaf978=_0xdaf978-0x0;var _0x2b15e0=_0xde50[_0xdaf978];return _0x2b15e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0de5('0x0'));var BPromise=require(_0x0de5('0x1'));var rs=require(_0x0de5('0x2'));var fs=require('fs');var Redis=require(_0x0de5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de5('0x4'));var logger=require('../../config/logger')(_0x0de5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0de5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2714e3,_0x2a5d94,_0x57410e){return new BPromise(function(_0xe3ac44,_0x4d5f0e){return client['request'](_0x2714e3,_0x57410e)['then'](function(_0x396293){logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,'request\x20sent');logger[_0x0de5('0x9')](_0x0de5('0xa'),_0x2a5d94,'request\x20sent',JSON[_0x0de5('0xb')](_0x396293));if(_0x396293[_0x0de5('0xc')]){if(_0x396293[_0x0de5('0xc')]['code']===0x1f4){logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);return _0x4d5f0e(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293['error']['message']);return _0xe3ac44(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}else{logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,_0x0de5('0xe'));_0xe3ac44(_0x396293[_0x0de5('0xf')]['message']);}})[_0x0de5('0x10')](function(_0xeb58e1){logger[_0x0de5('0xc')](_0x0de5('0x8'),_0x2a5d94,_0xeb58e1);_0x4d5f0e(_0xeb58e1);});});}exports[_0x0de5('0x11')]=function(_0x2860e8){var _0x58ce66=this;return new Promise(function(_0x21e4b6,_0x48ba4e){return db[_0x0de5('0x12')][_0x0de5('0x13')](_0x2860e8[_0x0de5('0x14')],{'raw':_0x2860e8[_0x0de5('0x15')]?_0x2860e8['options'][_0x0de5('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2a2abc){logger[_0x0de5('0x7')](_0x0de5('0x11'),_0x2860e8);logger['debug'](_0x0de5('0x11'),_0x2860e8,JSON[_0x0de5('0xb')](_0x2a2abc));_0x21e4b6(_0x2a2abc);})[_0x0de5('0x10')](function(_0x224745){logger['error'](_0x0de5('0x11'),_0x224745['message'],_0x2860e8);_0x48ba4e(_0x58ce66[_0x0de5('0xc')](0x1f4,_0x224745[_0x0de5('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 087f678..6fd1c71 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x497bf4,_0x1446d6){var _0x2185c0=function(_0x4f79e8){while(--_0x4f79e8){_0x497bf4['push'](_0x497bf4['shift']());}};_0x2185c0(++_0x1446d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdeece,_0x9a85f7){_0xdeece=_0xdeece-0x0;var _0x3ee945=_0x5f2f[_0xdeece];return _0x3ee945;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x3bcffb,_0x2317da){var _0x157bad=function(_0x17e9c9){while(--_0x17e9c9){_0x3bcffb['push'](_0x3bcffb['shift']());}};_0x157bad(++_0x2317da);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55b9f2,_0x2cc49a){_0x55b9f2=_0x55b9f2-0x0;var _0x2d8b05=_0x5f2f[_0x55b9f2];return _0x2d8b05;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0e7289b..b72ebd6 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 _0xb76f=['then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','role','blocked','online','admin','blockedAt','minutes','clearBlockUser','getLicense','catch','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport-local','Strategy','activedirectory2','bluebird','../../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','findOne','adSsoEnabled','blockDuration'];(function(_0x46f571,_0x249aa9){var _0x5b08ae=function(_0x12abb2){while(--_0x12abb2){_0x46f571['push'](_0x46f571['shift']());}};_0x5b08ae(++_0x249aa9);}(_0xb76f,0x94));var _0xfb76=function(_0x3e78df,_0x9be1d5){_0x3e78df=_0x3e78df-0x0;var _0x2db8f8=_0xb76f[_0x3e78df];return _0x2db8f8;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xfb76('0x0'))[_0xfb76('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xfb76('0x2'));var BPromise=require(_0xfb76('0x3'));var util=require('util');var db=require(_0xfb76('0x4'))['db'];var authService=require(_0xfb76('0x5'));var utils=require(_0xfb76('0x6'));var config=require(_0xfb76('0x7'));var logger=require(_0xfb76('0x8'))(_0xfb76('0x9'));function isActiveDirectoryConfigured(_0x5216aa){var _0x2ae776=![];if(typeof _0x5216aa[_0xfb76('0xa')]!==_0xfb76('0xb')){_0x2ae776=_0x5216aa['activedirectory'][_0xfb76('0xc')]&&_0x5216aa[_0xfb76('0xa')][_0xfb76('0xd')]&&_0x5216aa[_0xfb76('0xa')][_0xfb76('0xe')];}return _0x2ae776;}function adAuthenticate(_0x2246c7,_0x53f439,_0x4dfada){return new BPromise(function(_0x4c3f13,_0x333f03){try{var _0x613854=new ActiveDirectory(_0x2246c7);_0x613854[_0xfb76('0xf')](_0x53f439,_0x4dfada,function(_0x3ff56a,_0x2b45bb){if(_0x3ff56a){logger[_0xfb76('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x53f439,util[_0xfb76('0x11')](_0x3ff56a,{'showHidden':![],'depth':null}));_0x333f03(_0xfb76('0x12'));}else if(!_0x2b45bb){logger[_0xfb76('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x53f439);_0x333f03(_0xfb76('0x12'));}else{_0x4c3f13(_0x2b45bb);}});}catch(_0x56cbab){_0x333f03(_0x56cbab);}});}function ActiveDirectoryAuthenticate(_0x104834,_0x2155cd,_0x441e1c,_0x4f249f){var _0x54c7d3,_0x5af4e7;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xfb76('0x13'),_0x2155cd);return _0x4f249f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xfb76('0x14')][_0xfb76('0x15')]({'where':{'id':0x1},'attributes':[_0xfb76('0x16'),_0xfb76('0x17')],'raw':!![]})[_0xfb76('0x18')](function(_0x35b75a){_0x54c7d3=_0x35b75a;if(!_0x54c7d3['adSsoEnabled']){logger[_0xfb76('0x10')](_0xfb76('0x19'),_0x2155cd);throw new Error(_0xfb76('0x12'));}return _0x104834[_0xfb76('0x15')]({'attributes':['id',_0xfb76('0x1a'),'password','salt',_0xfb76('0x1b'),'disabled',_0xfb76('0x1c'),'blockedAt',_0xfb76('0x1d')],'where':{'name':_0x2155cd,'role':{'$or':[_0xfb76('0x1e'),'user','agent']},'adSsoEnabled':!![]}});})[_0xfb76('0x18')](function(_0x349cef){if(!_0x349cef||_0x349cef&&_0x349cef[_0xfb76('0x1a')]!==_0x2155cd){throw new Error(_0xfb76('0x12'));}_0x5af4e7=_0x349cef;var _0x2c47bb=_0x5af4e7[_0xfb76('0x1a')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config['activedirectory'],_0x2c47bb,_0x441e1c);})['then'](function(_0x3e2e93){if(_0x5af4e7['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x54c7d3[_0xfb76('0x17')]>0x0){if(_0x5af4e7['blocked']){if(moment(_0x5af4e7[_0xfb76('0x1f')])['add'](_0x54c7d3['blockDuration'],_0xfb76('0x20'))>moment()){throw new Error(_0xfb76('0x12'));}return utils[_0xfb76('0x21')](_0x5af4e7,0x0,![],null)['then'](function(){return utils[_0xfb76('0x22')](_0x5af4e7);})[_0xfb76('0x18')](function(){return _0x4f249f(null,_0x5af4e7);});}else{return utils[_0xfb76('0x22')](_0x5af4e7)[_0xfb76('0x18')](function(){return _0x4f249f(null,_0x5af4e7);});}}else{return utils[_0xfb76('0x22')](_0x5af4e7)[_0xfb76('0x18')](function(){return _0x4f249f(null,_0x5af4e7);});}})[_0xfb76('0x23')](function(_0x1dbd36){return _0x4f249f(null,![],_0x1dbd36);});}function handleError(_0x7ff865,_0x1977b2,_0x236e46){return _0x7ff865['status'](_0x1977b2||0x1f4)['send']({'message':_0x236e46?_0x236e46[_0xfb76('0x24')]||_0x236e46:''});}exports[_0xfb76('0x25')]=function(_0x2bc520,_0x40ceef,_0x5f2230){passport[_0xfb76('0xf')](_0xfb76('0x26'),function(_0x1c7ad3,_0xab168c,_0x372d75){var _0x2c6bf2=_0x1c7ad3||_0x372d75;if(_0x2c6bf2){return handleError(_0x40ceef,0x191,_0x2c6bf2);}if(!_0xab168c){return handleError(_0x40ceef,0x194,{'message':_0xfb76('0x27')});}else{var _0x2a950f={'payload':{'id':_0xab168c['id'],'role':_0xab168c[_0xfb76('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xfb76('0x28')](_0x2a950f)[_0xfb76('0x18')](function(_0x45ca6d){_0x40ceef['json']({'id':_0xab168c['id'],'token':_0x45ca6d,'statusCall':'','isAlreadyLogged':_0xab168c[_0xfb76('0x1d')]});});}})(_0x2bc520,_0x40ceef,_0x5f2230);};passport[_0xfb76('0x29')](_0xfb76('0x26'),new LocalStrategy({'usernameField':_0xfb76('0x1a'),'passwordField':'password'},function(_0x1f6b2d,_0x452777,_0x151c6d){return ActiveDirectoryAuthenticate(db[_0xfb76('0x2a')],_0x1f6b2d,_0x452777,_0x151c6d);})); \ No newline at end of file +var _0x3ae7=['error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','disabled','blocked','blockedAt','online','admin','user','agent','then','name','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','role','signToken','json','use','User','passport','passport-local','Strategy','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','activedirectory','domain','authenticate'];(function(_0x15d3be,_0x5e81f1){var _0x21afca=function(_0x43f32d){while(--_0x43f32d){_0x15d3be['push'](_0x15d3be['shift']());}};_0x21afca(++_0x5e81f1);}(_0x3ae7,0x1e4));var _0x73ae=function(_0x4a8e8,_0x2c6004){_0x4a8e8=_0x4a8e8-0x0;var _0x56528f=_0x3ae7[_0x4a8e8];return _0x56528f;};'use strict';var passport=require(_0x73ae('0x0'));var LocalStrategy=require(_0x73ae('0x1'))[_0x73ae('0x2')];var moment=require(_0x73ae('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x73ae('0x4'));var util=require('util');var db=require(_0x73ae('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x73ae('0x6'));var config=require(_0x73ae('0x7'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0xd95e74){var _0x17784e=![];if(typeof _0xd95e74[_0x73ae('0x8')]!=='undefined'){_0x17784e=_0xd95e74['activedirectory']['baseDN']&&_0xd95e74[_0x73ae('0x8')]['url']&&_0xd95e74[_0x73ae('0x8')][_0x73ae('0x9')];}return _0x17784e;}function adAuthenticate(_0x2931b0,_0x4049ed,_0x335df2){return new BPromise(function(_0x18bd5f,_0xa6f5ca){try{var _0x3b1492=new ActiveDirectory(_0x2931b0);_0x3b1492[_0x73ae('0xa')](_0x4049ed,_0x335df2,function(_0x371dfe,_0x358feb){if(_0x371dfe){logger[_0x73ae('0xb')]('Error\x20authenticate\x20%s:\x20%s',_0x4049ed,util[_0x73ae('0xc')](_0x371dfe,{'showHidden':![],'depth':null}));_0xa6f5ca(_0x73ae('0xd'));}else if(!_0x358feb){logger['error'](_0x73ae('0xe'),_0x4049ed);_0xa6f5ca(_0x73ae('0xd'));}else{_0x18bd5f(_0x358feb);}});}catch(_0xf74ec0){_0xa6f5ca(_0xf74ec0);}});}function ActiveDirectoryAuthenticate(_0x55b327,_0x1ead7c,_0x1cf05c,_0x3ea32a){var _0x32699a,_0x417030;if(!isActiveDirectoryConfigured(config)){logger[_0x73ae('0xb')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x1ead7c);return _0x3ea32a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x73ae('0xf')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x73ae('0x10')],'raw':!![]})['then'](function(_0x43bd33){_0x32699a=_0x43bd33;if(!_0x32699a[_0x73ae('0x11')]){logger[_0x73ae('0xb')](_0x73ae('0x12'),_0x1ead7c);throw new Error(_0x73ae('0xd'));}return _0x55b327['findOne']({'attributes':['id','name',_0x73ae('0x13'),_0x73ae('0x14'),'role',_0x73ae('0x15'),_0x73ae('0x16'),_0x73ae('0x17'),_0x73ae('0x18')],'where':{'name':_0x1ead7c,'role':{'$or':[_0x73ae('0x19'),_0x73ae('0x1a'),_0x73ae('0x1b')]},'adSsoEnabled':!![]}});})[_0x73ae('0x1c')](function(_0x2ff41c){if(!_0x2ff41c||_0x2ff41c&&_0x2ff41c[_0x73ae('0x1d')]!==_0x1ead7c){throw new Error(_0x73ae('0xd'));}_0x417030=_0x2ff41c;var _0x3b8bee=_0x417030[_0x73ae('0x1d')]+'@'+config[_0x73ae('0x8')][_0x73ae('0x9')];return adAuthenticate(config['activedirectory'],_0x3b8bee,_0x1cf05c);})['then'](function(_0x586380){if(_0x417030['disabled']){throw new Error(_0x73ae('0xd'));}if(_0x32699a[_0x73ae('0x10')]>0x0){if(_0x417030[_0x73ae('0x16')]){if(moment(_0x417030[_0x73ae('0x17')])[_0x73ae('0x1e')](_0x32699a['blockDuration'],_0x73ae('0x1f'))>moment()){throw new Error(_0x73ae('0xd'));}return utils[_0x73ae('0x20')](_0x417030,0x0,![],null)[_0x73ae('0x1c')](function(){return utils[_0x73ae('0x21')](_0x417030);})[_0x73ae('0x1c')](function(){return _0x3ea32a(null,_0x417030);});}else{return utils[_0x73ae('0x21')](_0x417030)[_0x73ae('0x1c')](function(){return _0x3ea32a(null,_0x417030);});}}else{return utils['getLicense'](_0x417030)[_0x73ae('0x1c')](function(){return _0x3ea32a(null,_0x417030);});}})[_0x73ae('0x22')](function(_0x2170ae){return _0x3ea32a(null,![],_0x2170ae);});}function handleError(_0x5687d7,_0x2b276b,_0x1f09e1){return _0x5687d7[_0x73ae('0x23')](_0x2b276b||0x1f4)[_0x73ae('0x24')]({'message':_0x1f09e1?_0x1f09e1[_0x73ae('0x25')]||_0x1f09e1:''});}exports[_0x73ae('0x26')]=function(_0x254a07,_0x3fbb1f,_0x3b0d75){passport[_0x73ae('0xa')](_0x73ae('0x27'),function(_0xcd5b27,_0x5dafcf,_0x1d5170){var _0x537a64=_0xcd5b27||_0x1d5170;if(_0x537a64){return handleError(_0x3fbb1f,0x191,_0x537a64);}if(!_0x5dafcf){return handleError(_0x3fbb1f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x107d75={'payload':{'id':_0x5dafcf['id'],'role':_0x5dafcf[_0x73ae('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0x73ae('0x29')](_0x107d75)[_0x73ae('0x1c')](function(_0xf8ce51){_0x3fbb1f[_0x73ae('0x2a')]({'id':_0x5dafcf['id'],'token':_0xf8ce51,'statusCall':'','isAlreadyLogged':_0x5dafcf[_0x73ae('0x18')]});});}})(_0x254a07,_0x3fbb1f,_0x3b0d75);};passport[_0x73ae('0x2b')](_0x73ae('0x27'),new LocalStrategy({'usernameField':_0x73ae('0x1d'),'passwordField':_0x73ae('0x13')},function(_0x3c0dea,_0x1978e2,_0x14c49e){return ActiveDirectoryAuthenticate(db[_0x73ae('0x2c')],_0x3c0dea,_0x1978e2,_0x14c49e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a008a2e..d5a8347 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 _0x73b0=['express','Router','post','login','exports'];(function(_0x490b47,_0x4dc33f){var _0x554703=function(_0x557c3a){while(--_0x557c3a){_0x490b47['push'](_0x490b47['shift']());}};_0x554703(++_0x4dc33f);}(_0x73b0,0xd2));var _0x073b=function(_0x480eb7,_0x2546cf){_0x480eb7=_0x480eb7-0x0;var _0x5aee29=_0x73b0[_0x480eb7];return _0x5aee29;};'use strict';var express=require(_0x073b('0x0'));var router=express[_0x073b('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x073b('0x2')]('/',controller[_0x073b('0x3')]);module[_0x073b('0x4')]=router; \ No newline at end of file +var _0x95bb=['exports','express','Router','login'];(function(_0x272e18,_0x75e43c){var _0x572ca9=function(_0xf2b51a){while(--_0xf2b51a){_0x272e18['push'](_0x272e18['shift']());}};_0x572ca9(++_0x75e43c);}(_0x95bb,0x18d));var _0xb95b=function(_0x41a011,_0x23dcef){_0x41a011=_0x41a011-0x0;var _0x3553c8=_0x95bb[_0x41a011];return _0x3553c8;};'use strict';var express=require(_0xb95b('0x0'));var router=express[_0xb95b('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xb95b('0x2')]);module[_0xb95b('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index aabed0a..14e2507 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 _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(_0x1ae639,_0x97624a){var _0x1e472d=function(_0xd04f6f){while(--_0xd04f6f){_0x1ae639['push'](_0x1ae639['shift']());}};_0x1e472d(++_0x97624a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 +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(_0x277f05,_0x5a7774){var _0x52cf27=function(_0x3d4553){while(--_0x3d4553){_0x277f05['push'](_0x277f05['shift']());}};_0x52cf27(++_0x5a7774);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 bb0588c..90dfc31 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 _0xe1e8=['get','login','/callback','callback','isMiddleware','exports','express','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x42afde,_0x377195){var _0x5e9990=function(_0x157ea9){while(--_0x157ea9){_0x42afde['push'](_0x42afde['shift']());}};_0x5e9990(++_0x377195);}(_0xe1e8,0xba));var _0x8e1e=function(_0x352f69,_0xb0cf44){_0x352f69=_0x352f69-0x0;var _0x5d5cfc=_0xe1e8[_0x352f69];return _0x5d5cfc;};'use strict';var express=require(_0x8e1e('0x0'));var passport=require('passport');var router=express[_0x8e1e('0x1')]();var controller=require(_0x8e1e('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x8e1e('0x3'));router[_0x8e1e('0x4')]('/',controller[_0x8e1e('0x5')]);router[_0x8e1e('0x4')](_0x8e1e('0x6'),controller[_0x8e1e('0x7')],authService[_0x8e1e('0x8')],userController[_0x8e1e('0x5')],authService['setTokenCookie']);module[_0x8e1e('0x9')]=router; \ No newline at end of file +var _0xecc0=['../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','express','passport','Router'];(function(_0x4ee097,_0x33a051){var _0x120fda=function(_0x52bb87){while(--_0x52bb87){_0x4ee097['push'](_0x4ee097['shift']());}};_0x120fda(++_0x33a051);}(_0xecc0,0x9d));var _0x0ecc=function(_0x2c8735,_0x27684e){_0x2c8735=_0x2c8735-0x0;var _0x416b72=_0xecc0[_0x2c8735];return _0x416b72;};'use strict';var express=require(_0x0ecc('0x0'));var passport=require(_0x0ecc('0x1'));var router=express[_0x0ecc('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x0ecc('0x3'));var authService=require(_0x0ecc('0x4'));router['get']('/',controller[_0x0ecc('0x5')]);router[_0x0ecc('0x6')](_0x0ecc('0x7'),controller[_0x0ecc('0x8')],authService[_0x0ecc('0x9')],userController[_0x0ecc('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 64b6770..2c95d76 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 _0x00b4=['getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','save','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser'];(function(_0x3029ac,_0x6fb135){var _0x221da5=function(_0x3dc293){while(--_0x3dc293){_0x3029ac['push'](_0x3029ac['shift']());}};_0x221da5(++_0x6fb135);}(_0x00b4,0x1c0));var _0x400b=function(_0x17b77e,_0x5dee5d){_0x17b77e=_0x17b77e-0x0;var _0x34d015=_0x00b4[_0x17b77e];return _0x34d015;};'use strict';var util=require(_0x400b('0x0'));var passport=require('passport');var LocalStrategy=require(_0x400b('0x1'))[_0x400b('0x2')];var jayson=require(_0x400b('0x3'));var _=require(_0x400b('0x4'));var rs=require(_0x400b('0x5'));var moment=require('moment');var db=require(_0x400b('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x400b('0x7'));var client=jayson['client'][_0x400b('0x8')]({'port':0x232b});function localAuthenticate(_0x5230d3,_0x451a22,_0x2bee08,_0x5d7d98){var _0x864e89,_0x5381a9;return db[_0x400b('0x9')][_0x400b('0xa')]({'where':{'id':0x1},'attributes':[_0x400b('0xb'),_0x400b('0xc')],'raw':!![]})[_0x400b('0xd')](function(_0x6a9628){_0x864e89=_0x6a9628;return _0x5230d3[_0x400b('0xa')]({'attributes':['id',_0x400b('0xe'),_0x400b('0xf'),'salt','role',_0x400b('0x10'),'blocked',_0x400b('0x11'),_0x400b('0x12')],'where':{'name':_0x451a22,'role':{'$or':['admin',_0x400b('0x13'),_0x400b('0x14')]}}});})[_0x400b('0xd')](function(_0x3171b8){if(!_0x3171b8||_0x3171b8&&_0x3171b8[_0x400b('0xe')]!==_0x451a22){throw new Error(_0x400b('0x15'));}else{_0x5381a9=_0x3171b8;return _0x5381a9;}})['then'](function(){_0x5381a9['authenticate'](_0x2bee08,function(_0x48bba3,_0x1f05c6){var _0x220598=_0x5381a9[_0x400b('0x12')]+0x1;if(_0x48bba3){return _0x5d7d98(_0x48bba3);}else if(!_0x1f05c6){if(_0x5381a9[_0x400b('0x10')]){return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}else if(_0x864e89[_0x400b('0xb')]>0x0){if(_0x5381a9[_0x400b('0x16')]){if(_0x864e89['blockDuration']>0x0){if(moment(_0x5381a9[_0x400b('0x11')])[_0x400b('0x17')](_0x864e89['blockDuration'],_0x400b('0x18'))>moment()){return _0x5d7d98(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x400b('0x19')](_0x5381a9,_0x220598,![],null)['then'](function(){return _0x5d7d98(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}}else{if(_0x220598>=_0x864e89[_0x400b('0xb')]){return utils[_0x400b('0x19')](_0x5381a9,0x0,!![],moment())[_0x400b('0xd')](function(){return _0x5d7d98(null,![],{'message':_0x400b('0x15')});});}else{return utils[_0x400b('0x19')](_0x5381a9,_0x220598,![],null)[_0x400b('0xd')](function(){return _0x5d7d98(null,![],{'message':_0x400b('0x15')});});}}}else{return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}}else{if(_0x5381a9[_0x400b('0x10')]){return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}else if(_0x864e89[_0x400b('0xb')]>0x0){if(_0x5381a9['blocked']){if(_0x864e89[_0x400b('0xc')]>0x0){if(moment(_0x5381a9[_0x400b('0x11')])[_0x400b('0x17')](_0x864e89['blockDuration'],_0x400b('0x18'))>moment()){return _0x5d7d98(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x400b('0x19')](_0x5381a9,0x0,![],null)[_0x400b('0xd')](function(){return utils[_0x400b('0x1a')](_0x5381a9);})['then'](function(){return _0x5d7d98(null,_0x5381a9);});}}else{return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}}else{return utils['clearBlockUser'](_0x5381a9,0x0,![],null)[_0x400b('0xd')](function(){return utils[_0x400b('0x1a')](_0x5381a9);})['then'](function(){return _0x5d7d98(null,_0x5381a9);})[_0x400b('0x1b')](function(_0x25e1e9){return _0x5d7d98(null,![],_0x25e1e9);});}}else{if(_0x5381a9[_0x400b('0x16')]){return _0x5d7d98(null,![],{'message':_0x400b('0x15')});}else{return utils['getLicense'](_0x5381a9)[_0x400b('0xd')](function(){return _0x5d7d98(null,_0x5381a9);});}}}});})[_0x400b('0x1b')](function(_0x1c5f80){return _0x5d7d98(null,![],_0x1c5f80);});}function sendServiceMail(_0x1b480d){return db[_0x400b('0x1c')][_0x400b('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x400b('0xe'),_0x400b('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x400b('0x1f'),'include':[{'model':db[_0x400b('0x20')],'as':_0x400b('0x20')}]}]})[_0x400b('0xd')](function(_0x480bea){if(!_0x480bea){throw new Error(_0x400b('0x21'));}var _0x387fd4=_0x480bea[_0x400b('0x22')]();var _0x127e2b={'account':_0x387fd4,'message':_[_0x400b('0x23')]({'from':util['format'](_0x400b('0x24'),_0x480bea['name'],_0x480bea[_0x400b('0x1e')]||_0x480bea['Smtp'][_0x400b('0x13')])},_0x1b480d)};return client[_0x400b('0x25')](_0x400b('0x26'),_0x127e2b);})[_0x400b('0xd')](function(_0x29f845){if(_0x29f845[_0x400b('0x27')]){throw new Error(util[_0x400b('0x28')](_0x400b('0x29'),_0x29f845[_0x400b('0x27')]['message']||JSON[_0x400b('0x2a')](_0x29f845[_0x400b('0x27')])));}return!![];});}function handleError(_0x519a,_0x5cc997,_0x2afb7b){return _0x519a['status'](_0x5cc997||0x1f4)[_0x400b('0x2b')]({'message':_0x2afb7b?_0x2afb7b[_0x400b('0x2c')]||_0x2afb7b:''});}exports['login']=function(_0x589e66,_0x3bd829,_0x39ddcb){passport[_0x400b('0x2d')](_0x400b('0x2e'),function(_0x2eb82a,_0x548172,_0x3d1fe2){var _0x5be208=_0x2eb82a||_0x3d1fe2;if(_0x5be208){return handleError(_0x3bd829,0x191,_0x5be208);}if(!_0x548172){return handleError(_0x3bd829,0x194,{'message':_0x400b('0x2f')});}else{var _0x4f064d={'payload':{'id':_0x548172['id'],'role':_0x548172[_0x400b('0x30')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f064d)[_0x400b('0xd')](function(_0x5d6d92){_0x3bd829[_0x400b('0x31')]({'id':_0x548172['id'],'token':_0x5d6d92,'statusCall':'','isAlreadyLogged':_0x548172[_0x400b('0x32')]});});}})(_0x589e66,_0x3bd829,_0x39ddcb);};exports[_0x400b('0x33')]=function(_0x66857a,_0x4d9863){if(!_0x66857a[_0x400b('0x34')][_0x400b('0x1e')]){return handleError(_0x4d9863,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1cfacf=rs[_0x400b('0x35')]();_0x66857a['body'][_0x400b('0x1e')]=_0x66857a[_0x400b('0x34')][_0x400b('0x1e')][_0x400b('0x36')]()[_0x400b('0x37')]();var _0x31b43f;return db[_0x400b('0x9')][_0x400b('0xa')]({'where':{'id':0x1},'attributes':[_0x400b('0xb'),_0x400b('0xc')],'raw':!![]})[_0x400b('0xd')](function(_0x19cb77){_0x31b43f=_0x19cb77;return db[_0x400b('0x38')][_0x400b('0x1d')]({'where':{'email':_0x66857a['body'][_0x400b('0x1e')]}});})[_0x400b('0xd')](function(_0x5612a1){if(!_0x5612a1){throw new Error(_0x400b('0x39'));}if(_0x5612a1[_0x400b('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5612a1['blocked']){if(moment(_0x5612a1[_0x400b('0x11')])[_0x400b('0x17')](_0x31b43f[_0x400b('0xc')],_0x400b('0x18'))>moment()){throw new Error(_0x400b('0x3a'));}else{_0x5612a1[_0x400b('0x16')]=![];_0x5612a1[_0x400b('0x11')]=null;}}_0x5612a1[_0x400b('0x3b')]=_0x1cfacf;_0x5612a1[_0x400b('0x3c')]=Date[_0x400b('0x3d')]()+0x36ee80;return _0x5612a1['save']();})[_0x400b('0xd')](function(){return sendServiceMail({'to':_0x66857a[_0x400b('0x34')][_0x400b('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x400b('0x3e')+_0x400b('0x3f')+'https://'+_0x66857a['headers'][_0x400b('0x40')]+_0x400b('0x41')+_0x1cfacf+'\x0a\x0a'+_0x400b('0x42')});})[_0x400b('0xd')](function(){_0x4d9863[_0x400b('0x43')](0xc8)[_0x400b('0x2b')]({'message':'Reset\x20Email\x20sent!'});})[_0x400b('0x1b')](function(_0x5efd64){return handleError(_0x4d9863,0x1f4,_0x5efd64);});};exports['reset']=function(_0x4a6bfe,_0x14eb2a){return db['User'][_0x400b('0x1d')]({'where':{'resetPasswordToken':_0x4a6bfe[_0x400b('0x44')][_0x400b('0x45')],'resetPasswordExpires':{'$gt':Date[_0x400b('0x3d')]()}}})[_0x400b('0xd')](function(_0x5067ab){if(!_0x5067ab){throw new Error(_0x400b('0x46'));}return db[_0x400b('0x9')][_0x400b('0xa')]({'attributes':['id',_0x400b('0x47'),_0x400b('0x48'),'passwordHistoryLimit']})[_0x400b('0xd')](function(_0x2b2767){if(_0x2b2767[_0x400b('0x47')])authService['validatePasswordPattern'](_0x4a6bfe['body'][_0x400b('0xf')]);if(!_0x2b2767[_0x400b('0x48')]||!_0x5067ab[_0x400b('0x49')])return _0x5067ab;authService[_0x400b('0x4a')](_0x4a6bfe[_0x400b('0x34')]['password'],_0x5067ab[_0x400b('0x49')],_0x2b2767[_0x400b('0x4b')]);return _0x5067ab;})[_0x400b('0xd')](function(){_0x5067ab[_0x400b('0xf')]=_0x4a6bfe[_0x400b('0x34')]['password'];_0x5067ab[_0x400b('0x3b')]=null;_0x5067ab[_0x400b('0x3c')]=null;return _0x5067ab[_0x400b('0x4c')]();});})[_0x400b('0xd')](function(){_0x14eb2a[_0x400b('0x43')](0xc8)['send']({'message':_0x400b('0x4d')});})[_0x400b('0x1b')](function(_0x3a9e17){return handleError(_0x14eb2a,0x1f4,_0x3a9e17);});};passport[_0x400b('0x4e')](_0x400b('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x400b('0xf')},function(_0xaf5ae9,_0x41692b,_0x12a063){return localAuthenticate(db[_0x400b('0x38')],_0xaf5ae9,_0x41692b,_0x12a063);})); \ No newline at end of file +var _0xa589=['find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa589,0x17b));var _0x9a58=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0xa589[_0x2f4d7f];return _0x147ba1;};'use strict';var util=require('util');var passport=require(_0x9a58('0x0'));var LocalStrategy=require(_0x9a58('0x1'))[_0x9a58('0x2')];var jayson=require('jayson/promise');var _=require(_0x9a58('0x3'));var rs=require(_0x9a58('0x4'));var moment=require(_0x9a58('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x9a58('0x6'));var utils=require(_0x9a58('0x7'));var client=jayson[_0x9a58('0x8')][_0x9a58('0x9')]({'port':0x232b});function localAuthenticate(_0x4e9096,_0x272ded,_0x35ce11,_0x22c574){var _0x34ce69,_0x12e1f3;return db[_0x9a58('0xa')][_0x9a58('0xb')]({'where':{'id':0x1},'attributes':[_0x9a58('0xc'),'blockDuration'],'raw':!![]})[_0x9a58('0xd')](function(_0xdb8deb){_0x34ce69=_0xdb8deb;return _0x4e9096['findOne']({'attributes':['id',_0x9a58('0xe'),'password','salt','role',_0x9a58('0xf'),_0x9a58('0x10'),_0x9a58('0x11'),_0x9a58('0x12')],'where':{'name':_0x272ded,'role':{'$or':[_0x9a58('0x13'),_0x9a58('0x14'),_0x9a58('0x15')]}}});})[_0x9a58('0xd')](function(_0x3be7d7){if(!_0x3be7d7||_0x3be7d7&&_0x3be7d7['name']!==_0x272ded){throw new Error(_0x9a58('0x16'));}else{_0x12e1f3=_0x3be7d7;return _0x12e1f3;}})[_0x9a58('0xd')](function(){_0x12e1f3[_0x9a58('0x17')](_0x35ce11,function(_0x57ec4d,_0x1f7fe6){var _0x4941ae=_0x12e1f3[_0x9a58('0x12')]+0x1;if(_0x57ec4d){return _0x22c574(_0x57ec4d);}else if(!_0x1f7fe6){if(_0x12e1f3['disabled']){return _0x22c574(null,![],{'message':_0x9a58('0x16')});}else if(_0x34ce69[_0x9a58('0xc')]>0x0){if(_0x12e1f3[_0x9a58('0x10')]){if(_0x34ce69['blockDuration']>0x0){if(moment(_0x12e1f3[_0x9a58('0x11')])[_0x9a58('0x18')](_0x34ce69[_0x9a58('0x19')],_0x9a58('0x1a'))>moment()){return _0x22c574(null,![],{'message':_0x9a58('0x16')});}else{return utils[_0x9a58('0x1b')](_0x12e1f3,_0x4941ae,![],null)[_0x9a58('0xd')](function(){return _0x22c574(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x22c574(null,![],{'message':_0x9a58('0x16')});}}else{if(_0x4941ae>=_0x34ce69[_0x9a58('0xc')]){return utils['clearBlockUser'](_0x12e1f3,0x0,!![],moment())[_0x9a58('0xd')](function(){return _0x22c574(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x9a58('0x1b')](_0x12e1f3,_0x4941ae,![],null)[_0x9a58('0xd')](function(){return _0x22c574(null,![],{'message':_0x9a58('0x16')});});}}}else{return _0x22c574(null,![],{'message':_0x9a58('0x16')});}}else{if(_0x12e1f3[_0x9a58('0xf')]){return _0x22c574(null,![],{'message':_0x9a58('0x16')});}else if(_0x34ce69['allowedLoginAttempts']>0x0){if(_0x12e1f3[_0x9a58('0x10')]){if(_0x34ce69[_0x9a58('0x19')]>0x0){if(moment(_0x12e1f3[_0x9a58('0x11')])['add'](_0x34ce69[_0x9a58('0x19')],'minutes')>moment()){return _0x22c574(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x12e1f3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x12e1f3);})[_0x9a58('0xd')](function(){return _0x22c574(null,_0x12e1f3);});}}else{return _0x22c574(null,![],{'message':_0x9a58('0x16')});}}else{return utils[_0x9a58('0x1b')](_0x12e1f3,0x0,![],null)[_0x9a58('0xd')](function(){return utils['getLicense'](_0x12e1f3);})['then'](function(){return _0x22c574(null,_0x12e1f3);})['catch'](function(_0x1db40a){return _0x22c574(null,![],_0x1db40a);});}}else{if(_0x12e1f3[_0x9a58('0x10')]){return _0x22c574(null,![],{'message':_0x9a58('0x16')});}else{return utils[_0x9a58('0x1c')](_0x12e1f3)[_0x9a58('0xd')](function(){return _0x22c574(null,_0x12e1f3);});}}}});})[_0x9a58('0x1d')](function(_0x1a7faf){return _0x22c574(null,![],_0x1a7faf);});}function sendServiceMail(_0x4b9293){return db[_0x9a58('0x1e')][_0x9a58('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x9a58('0xe'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x9a58('0x20'),'include':[{'model':db[_0x9a58('0x21')],'as':'CloudProvider'}]}]})[_0x9a58('0xd')](function(_0xa75e7b){if(!_0xa75e7b){throw new Error(_0x9a58('0x22'));}var _0x3ffdbc=_0xa75e7b[_0x9a58('0x23')]();var _0x33701c={'account':_0x3ffdbc,'message':_[_0x9a58('0x24')]({'from':util[_0x9a58('0x25')](_0x9a58('0x26'),_0xa75e7b['name'],_0xa75e7b[_0x9a58('0x27')]||_0xa75e7b[_0x9a58('0x20')][_0x9a58('0x14')])},_0x4b9293)};return client[_0x9a58('0x28')](_0x9a58('0x29'),_0x33701c);})[_0x9a58('0xd')](function(_0x13200e){if(_0x13200e[_0x9a58('0x2a')]){throw new Error(util[_0x9a58('0x25')](_0x9a58('0x2b'),_0x13200e[_0x9a58('0x2a')][_0x9a58('0x2c')]||JSON[_0x9a58('0x2d')](_0x13200e[_0x9a58('0x2a')])));}return!![];});}function handleError(_0x50ab64,_0x3329aa,_0xbef655){return _0x50ab64[_0x9a58('0x2e')](_0x3329aa||0x1f4)[_0x9a58('0x2f')]({'message':_0xbef655?_0xbef655[_0x9a58('0x2c')]||_0xbef655:''});}exports[_0x9a58('0x30')]=function(_0x5885de,_0x34e472,_0x4909ba){passport[_0x9a58('0x17')](_0x9a58('0x31'),function(_0x3673b3,_0x375b74,_0x1a3578){var _0x3c4207=_0x3673b3||_0x1a3578;if(_0x3c4207){return handleError(_0x34e472,0x191,_0x3c4207);}if(!_0x375b74){return handleError(_0x34e472,0x194,{'message':_0x9a58('0x32')});}else{var _0x37e4bc={'payload':{'id':_0x375b74['id'],'role':_0x375b74['role']},'options':{'expiresIn':0x15180}};return authService[_0x9a58('0x33')](_0x37e4bc)[_0x9a58('0xd')](function(_0x18b789){_0x34e472[_0x9a58('0x34')]({'id':_0x375b74['id'],'token':_0x18b789,'statusCall':'','isAlreadyLogged':_0x375b74[_0x9a58('0x35')]});});}})(_0x5885de,_0x34e472,_0x4909ba);};exports['forgot']=function(_0x3129fe,_0x278f93){if(!_0x3129fe[_0x9a58('0x36')]['email']){return handleError(_0x278f93,0x1f4,{'message':_0x9a58('0x37')});}var _0x448c37=rs['generate']();_0x3129fe[_0x9a58('0x36')][_0x9a58('0x27')]=_0x3129fe['body'][_0x9a58('0x27')][_0x9a58('0x38')]()['toLowerCase']();var _0x75ea72;return db[_0x9a58('0xa')][_0x9a58('0xb')]({'where':{'id':0x1},'attributes':[_0x9a58('0xc'),_0x9a58('0x19')],'raw':!![]})['then'](function(_0x3504c8){_0x75ea72=_0x3504c8;return db[_0x9a58('0x39')]['find']({'where':{'email':_0x3129fe[_0x9a58('0x36')][_0x9a58('0x27')]}});})[_0x9a58('0xd')](function(_0x3a9a58){if(!_0x3a9a58){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3a9a58[_0x9a58('0xf')]){throw new Error(_0x9a58('0x3a'));}if(_0x3a9a58['blocked']){if(moment(_0x3a9a58[_0x9a58('0x11')])[_0x9a58('0x18')](_0x75ea72[_0x9a58('0x19')],'minutes')>moment()){throw new Error(_0x9a58('0x3b'));}else{_0x3a9a58['blocked']=![];_0x3a9a58['blockedAt']=null;}}_0x3a9a58[_0x9a58('0x3c')]=_0x448c37;_0x3a9a58[_0x9a58('0x3d')]=Date[_0x9a58('0x3e')]()+0x36ee80;return _0x3a9a58['save']();})[_0x9a58('0xd')](function(){return sendServiceMail({'to':_0x3129fe[_0x9a58('0x36')][_0x9a58('0x27')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x9a58('0x3f')+_0x9a58('0x40')+_0x9a58('0x41')+_0x3129fe['headers'][_0x9a58('0x42')]+_0x9a58('0x43')+_0x448c37+'\x0a\x0a'+_0x9a58('0x44')});})[_0x9a58('0xd')](function(){_0x278f93[_0x9a58('0x2e')](0xc8)[_0x9a58('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0x9a58('0x1d')](function(_0x24e695){return handleError(_0x278f93,0x1f4,_0x24e695);});};exports[_0x9a58('0x45')]=function(_0x161a01,_0x169c38){return db['User'][_0x9a58('0x1f')]({'where':{'resetPasswordToken':_0x161a01[_0x9a58('0x46')][_0x9a58('0x47')],'resetPasswordExpires':{'$gt':Date[_0x9a58('0x3e')]()}}})[_0x9a58('0xd')](function(_0x2f3e89){if(!_0x2f3e89){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x9a58('0xa')][_0x9a58('0xb')]({'attributes':['id','securePassword',_0x9a58('0x48'),_0x9a58('0x49')]})[_0x9a58('0xd')](function(_0x45475f){if(_0x45475f[_0x9a58('0x4a')])authService[_0x9a58('0x4b')](_0x161a01[_0x9a58('0x36')][_0x9a58('0x4c')]);if(!_0x45475f[_0x9a58('0x48')]||!_0x2f3e89[_0x9a58('0x4d')])return _0x2f3e89;authService[_0x9a58('0x4e')](_0x161a01[_0x9a58('0x36')][_0x9a58('0x4c')],_0x2f3e89['previousPasswords'],_0x45475f[_0x9a58('0x49')]);return _0x2f3e89;})['then'](function(){_0x2f3e89[_0x9a58('0x4c')]=_0x161a01['body'][_0x9a58('0x4c')];_0x2f3e89[_0x9a58('0x3c')]=null;_0x2f3e89['resetPasswordExpires']=null;return _0x2f3e89[_0x9a58('0x4f')]();});})[_0x9a58('0xd')](function(){_0x169c38[_0x9a58('0x2e')](0xc8)[_0x9a58('0x2f')]({'message':_0x9a58('0x50')});})[_0x9a58('0x1d')](function(_0x41914c){return handleError(_0x169c38,0x1f4,_0x41914c);});};passport[_0x9a58('0x51')](_0x9a58('0x31'),new LocalStrategy({'usernameField':_0x9a58('0xe'),'passwordField':_0x9a58('0x4c')},function(_0x4ad1fb,_0x37061b,_0x20739d){return localAuthenticate(db['User'],_0x4ad1fb,_0x37061b,_0x20739d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f696677..e16c90c 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 _0x7deb=['/reset/:token','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x2c8350,_0x5126ed){var _0x4d5530=function(_0x42b164){while(--_0x42b164){_0x2c8350['push'](_0x2c8350['shift']());}};_0x4d5530(++_0x5126ed);}(_0x7deb,0xca));var _0xb7de=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x7deb[_0x3da707];return _0x342ee7;};'use strict';var express=require(_0xb7de('0x0'));var router=express[_0xb7de('0x1')]();var controller=require(_0xb7de('0x2'));router[_0xb7de('0x3')]('/',controller[_0xb7de('0x4')]);router['post']('/forgot',controller[_0xb7de('0x5')]);router[_0xb7de('0x3')](_0xb7de('0x6'),controller['reset']);module[_0xb7de('0x7')]=router; \ No newline at end of file +var _0xff03=['forgot','reset','exports','Router','./authLocal.controller','post','login','/forgot'];(function(_0x3fe497,_0x5f299f){var _0x46f039=function(_0x188a69){while(--_0x188a69){_0x3fe497['push'](_0x3fe497['shift']());}};_0x46f039(++_0x5f299f);}(_0xff03,0xcb));var _0x3ff0=function(_0x5420c8,_0x56915d){_0x5420c8=_0x5420c8-0x0;var _0x5068ba=_0xff03[_0x5420c8];return _0x5068ba;};'use strict';var express=require('express');var router=express[_0x3ff0('0x0')]();var controller=require(_0x3ff0('0x1'));router[_0x3ff0('0x2')]('/',controller[_0x3ff0('0x3')]);router['post'](_0x3ff0('0x4'),controller[_0x3ff0('0x5')]);router['post']('/reset/:token',controller[_0x3ff0('0x6')]);module[_0x3ff0('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8989bfc..64e3d82 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 _0xef4b=['sequelize','exports','STRING','INTEGER'];(function(_0x2ff1e1,_0x1f5d39){var _0xcdae4f=function(_0x3781b2){while(--_0x3781b2){_0x2ff1e1['push'](_0x2ff1e1['shift']());}};_0xcdae4f(++_0x1f5d39);}(_0xef4b,0xc8));var _0xbef4=function(_0x1808b2,_0x35f5a6){_0x1808b2=_0x1808b2-0x0;var _0x498147=_0xef4b[_0x1808b2];return _0x498147;};'use strict';var Sequelize=require(_0xbef4('0x0'));module[_0xbef4('0x1')]={'name':{'type':Sequelize[_0xbef4('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xbef4('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbef4('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5926=['sequelize','STRING','BOOLEAN'];(function(_0x3e01b8,_0x2e5717){var _0x5d4fdf=function(_0x21b4f5){while(--_0x21b4f5){_0x3e01b8['push'](_0x3e01b8['shift']());}};_0x5d4fdf(++_0x2e5717);}(_0x5926,0x90));var _0x6592=function(_0x57ad0b,_0x5aa20e){_0x57ad0b=_0x57ad0b-0x0;var _0x31ee65=_0x5926[_0x57ad0b];return _0x31ee65;};'use strict';var Sequelize=require(_0x6592('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x6592('0x1')]},'description':{'type':Sequelize[_0x6592('0x1')]},'status':{'type':Sequelize[_0x6592('0x2')],'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 d970b0a..d828280 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 _0xf341=['map','Automation','rawAttributes','fieldName','type','key','model','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','query','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','intersection','find','catch','create','body','Condition','ids','omit','findOne','getConditions','Action','addActions','getActions','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','name','send','index'];(function(_0x389d85,_0x2a7b2d){var _0x2e39cb=function(_0x3b7eab){while(--_0x3b7eab){_0x389d85['push'](_0x389d85['shift']());}};_0x2e39cb(++_0x2a7b2d);}(_0xf341,0xcb));var _0x1f34=function(_0x57df09,_0x2ae59f){_0x57df09=_0x57df09-0x0;var _0x59dbf0=_0xf341[_0x57df09];return _0x59dbf0;};'use strict';var emlformat=require(_0x1f34('0x0'));var rimraf=require(_0x1f34('0x1'));var zipdir=require(_0x1f34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f34('0x3'));var util=require(_0x1f34('0x4'));var path=require(_0x1f34('0x5'));var sox=require(_0x1f34('0x6'));var csv=require(_0x1f34('0x7'));var ejs=require(_0x1f34('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f34('0x9'));var squel=require(_0x1f34('0xa'));var crypto=require(_0x1f34('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1f34('0xc'));var toCsv=require(_0x1f34('0x7'));var querystring=require(_0x1f34('0xd'));var Papa=require(_0x1f34('0xe'));var Redis=require(_0x1f34('0xf'));var authService=require(_0x1f34('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f34('0x11'));var logger=require(_0x1f34('0x12'))(_0x1f34('0x13'));var utils=require('../../config/utils');var config=require(_0x1f34('0x14'));var licenseUtil=require(_0x1f34('0x15'));var db=require(_0x1f34('0x16'))['db'];function respondWithStatusCode(_0x46b7e3,_0x932767){_0x932767=_0x932767||0xcc;return function(_0x564c85){if(_0x564c85){return _0x46b7e3[_0x1f34('0x17')](_0x932767);}return _0x46b7e3[_0x1f34('0x18')](_0x932767)['end']();};}function respondWithResult(_0x121242,_0x258f8a){_0x258f8a=_0x258f8a||0xc8;return function(_0x3d4179){if(_0x3d4179){return _0x121242[_0x1f34('0x18')](_0x258f8a)[_0x1f34('0x19')](_0x3d4179);}};}function respondWithFilteredResult(_0x18292a,_0x13265a){return function(_0x3527db){if(_0x3527db){var _0x4910a1=typeof _0x13265a[_0x1f34('0x1a')]===_0x1f34('0x1b')&&typeof _0x13265a[_0x1f34('0x1c')]===_0x1f34('0x1b');var _0x3278ff=_0x3527db[_0x1f34('0x1d')];var _0x18ee1a=_0x4910a1?0x0:_0x13265a['offset'];var _0x545db9=_0x4910a1?_0x3527db[_0x1f34('0x1d')]:_0x13265a[_0x1f34('0x1a')]+_0x13265a['limit'];var _0x4d48b5;if(_0x545db9>=_0x3278ff){_0x545db9=_0x3278ff;_0x4d48b5=0xc8;}else{_0x4d48b5=0xce;}_0x18292a['status'](_0x4d48b5);return _0x18292a['set'](_0x1f34('0x1e'),_0x18ee1a+'-'+_0x545db9+'/'+_0x3278ff)[_0x1f34('0x19')](_0x3527db);}return null;};}function patchUpdates(_0x1a5ce7){return function(_0x26a633){try{jsonpatch['apply'](_0x26a633,_0x1a5ce7,!![]);}catch(_0x396849){return BPromise[_0x1f34('0x1f')](_0x396849);}return _0x26a633[_0x1f34('0x20')]();};}function saveUpdates(_0x35a99f,_0x2542a3){return function(_0x32a76f){if(_0x32a76f){return _0x32a76f[_0x1f34('0x21')](_0x35a99f)['then'](function(_0x19bbaf){return _0x19bbaf;});}return null;};}function removeEntity(_0x28e439,_0x294da7){return function(_0x49ec9e){if(_0x49ec9e){return _0x49ec9e[_0x1f34('0x22')]()[_0x1f34('0x23')](function(){_0x28e439['status'](0xcc)[_0x1f34('0x24')]();});}};}function handleEntityNotFound(_0x51478a,_0x303c65){return function(_0x5e978b){if(!_0x5e978b){_0x51478a[_0x1f34('0x17')](0x194);}return _0x5e978b;};}function handleError(_0x47c0bf,_0x4519a8){_0x4519a8=_0x4519a8||0x1f4;return function(_0x491667){logger['error'](_0x491667['stack']);if(_0x491667[_0x1f34('0x25')]){delete _0x491667[_0x1f34('0x25')];}_0x47c0bf[_0x1f34('0x18')](_0x4519a8)[_0x1f34('0x26')](_0x491667);};}exports[_0x1f34('0x27')]=function(_0x29e9fd,_0x329ef2){var _0x1e2dc7={},_0x561638={},_0x411e4a={'count':0x0,'rows':[]};var _0x1a9dda=_[_0x1f34('0x28')](db[_0x1f34('0x29')][_0x1f34('0x2a')],function(_0x1e70e4){return{'name':_0x1e70e4[_0x1f34('0x2b')],'type':_0x1e70e4[_0x1f34('0x2c')][_0x1f34('0x2d')]};});_0x561638[_0x1f34('0x2e')]=_[_0x1f34('0x28')](_0x1a9dda,_0x1f34('0x25'));_0x561638['query']=_[_0x1f34('0x2f')](_0x29e9fd['query']);_0x561638[_0x1f34('0x30')]=_['intersection'](_0x561638[_0x1f34('0x2e')],_0x561638['query']);_0x1e2dc7['attributes']=_['intersection'](_0x561638[_0x1f34('0x2e')],qs[_0x1f34('0x31')](_0x29e9fd['query']['fields']));_0x1e2dc7[_0x1f34('0x32')]=_0x1e2dc7[_0x1f34('0x32')][_0x1f34('0x33')]?_0x1e2dc7[_0x1f34('0x32')]:_0x561638['model'];if(!_0x29e9fd['query'][_0x1f34('0x34')](_0x1f34('0x35'))){_0x1e2dc7[_0x1f34('0x1c')]=qs[_0x1f34('0x1c')](_0x29e9fd['query'][_0x1f34('0x1c')]);_0x1e2dc7[_0x1f34('0x1a')]=qs[_0x1f34('0x1a')](_0x29e9fd[_0x1f34('0x36')][_0x1f34('0x1a')]);}_0x1e2dc7[_0x1f34('0x37')]=qs[_0x1f34('0x38')](_0x29e9fd[_0x1f34('0x36')][_0x1f34('0x38')]);_0x1e2dc7[_0x1f34('0x39')]=qs[_0x1f34('0x30')](_[_0x1f34('0x3a')](_0x29e9fd[_0x1f34('0x36')],_0x561638[_0x1f34('0x30')]),_0x1a9dda);if(_0x29e9fd[_0x1f34('0x36')]['filter']){_0x1e2dc7[_0x1f34('0x39')]=_[_0x1f34('0x3b')](_0x1e2dc7['where'],{'$or':_[_0x1f34('0x28')](_0x1a9dda,function(_0x3c3249){if(_0x3c3249[_0x1f34('0x2c')]!==_0x1f34('0x3c')){var _0x346225={};_0x346225[_0x3c3249[_0x1f34('0x25')]]={'$like':'%'+_0x29e9fd[_0x1f34('0x36')][_0x1f34('0x3d')]+'%'};return _0x346225;}})});}_0x1e2dc7=_[_0x1f34('0x3b')]({},_0x1e2dc7,_0x29e9fd[_0x1f34('0x3e')]);var _0x4771c1={'where':_0x1e2dc7[_0x1f34('0x39')]};return db['Automation'][_0x1f34('0x1d')](_0x4771c1)[_0x1f34('0x23')](function(_0x57b1f7){_0x411e4a[_0x1f34('0x1d')]=_0x57b1f7;if(_0x29e9fd[_0x1f34('0x36')][_0x1f34('0x3f')]){_0x1e2dc7[_0x1f34('0x40')]=[{'all':!![]}];}return db[_0x1f34('0x29')][_0x1f34('0x41')](_0x1e2dc7);})[_0x1f34('0x23')](function(_0x1e3e29){_0x411e4a['rows']=_0x1e3e29;return _0x411e4a;})['then'](respondWithFilteredResult(_0x329ef2,_0x1e2dc7))['catch'](handleError(_0x329ef2,null));};exports[_0x1f34('0x42')]=function(_0x47ffe8,_0x42aa5c){var _0x217f4f={'raw':![],'where':{'id':_0x47ffe8[_0x1f34('0x43')]['id']}},_0x430cee={};_0x430cee[_0x1f34('0x2e')]=_[_0x1f34('0x2f')](db[_0x1f34('0x29')][_0x1f34('0x2a')]);_0x430cee['query']=_[_0x1f34('0x2f')](_0x47ffe8[_0x1f34('0x36')]);_0x430cee[_0x1f34('0x30')]=_[_0x1f34('0x44')](_0x430cee['model'],_0x430cee['query']);_0x217f4f[_0x1f34('0x32')]=_[_0x1f34('0x44')](_0x430cee[_0x1f34('0x2e')],qs['fields'](_0x47ffe8['query'][_0x1f34('0x31')]));_0x217f4f[_0x1f34('0x32')]=_0x217f4f[_0x1f34('0x32')][_0x1f34('0x33')]?_0x217f4f['attributes']:_0x430cee['model'];if(_0x47ffe8[_0x1f34('0x36')][_0x1f34('0x3f')]){_0x217f4f[_0x1f34('0x40')]=[{'all':!![]}];}_0x217f4f=_[_0x1f34('0x3b')]({},_0x217f4f,_0x47ffe8[_0x1f34('0x3e')]);return db['Automation'][_0x1f34('0x45')](_0x217f4f)['then'](handleEntityNotFound(_0x42aa5c,null))[_0x1f34('0x23')](respondWithResult(_0x42aa5c,null))[_0x1f34('0x46')](handleError(_0x42aa5c,null));};exports[_0x1f34('0x47')]=function(_0x3c43a3,_0x5f0b05){return db[_0x1f34('0x29')]['create'](_0x3c43a3[_0x1f34('0x48')],{})['then'](respondWithResult(_0x5f0b05,0xc9))[_0x1f34('0x46')](handleError(_0x5f0b05,null));};exports[_0x1f34('0x21')]=function(_0x21e2b0,_0x2ff51d){if(_0x21e2b0[_0x1f34('0x48')]['id']){delete _0x21e2b0[_0x1f34('0x48')]['id'];}return db[_0x1f34('0x29')][_0x1f34('0x45')]({'where':{'id':_0x21e2b0['params']['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x2ff51d,null))[_0x1f34('0x23')](saveUpdates(_0x21e2b0['body'],null))[_0x1f34('0x23')](respondWithResult(_0x2ff51d,null))[_0x1f34('0x46')](handleError(_0x2ff51d,null));};exports[_0x1f34('0x22')]=function(_0x11d611,_0x518b9f){return db[_0x1f34('0x29')][_0x1f34('0x45')]({'where':{'id':_0x11d611[_0x1f34('0x43')]['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x518b9f,null))[_0x1f34('0x23')](removeEntity(_0x518b9f,null))[_0x1f34('0x46')](handleError(_0x518b9f,null));};exports['addConditions']=function(_0x195638,_0x7ee1d0,_0x2e38ce){return db[_0x1f34('0x49')][_0x1f34('0x45')]({'where':{'id':_0x195638[_0x1f34('0x43')]['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x7ee1d0,null))[_0x1f34('0x23')](function(_0x3b00cd){if(_0x3b00cd){return _0x3b00cd['addConditions'](_0x195638['body'][_0x1f34('0x4a')],_[_0x1f34('0x4b')](_0x195638[_0x1f34('0x48')],[_0x1f34('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x7ee1d0,null))['catch'](handleError(_0x7ee1d0,null));};exports['getConditions']=function(_0x19d996,_0x5a9500,_0x1b9163){var _0x487276={};var _0x2be4ad={};var _0x529cbb;var _0x1ddb9d;return db[_0x1f34('0x29')][_0x1f34('0x4c')]({'where':{'id':_0x19d996[_0x1f34('0x43')]['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x5a9500,null))['then'](function(_0x5c045c){if(_0x5c045c){_0x529cbb=_0x5c045c;_0x2be4ad[_0x1f34('0x2e')]=_[_0x1f34('0x2f')](db[_0x1f34('0x49')]['rawAttributes']);_0x2be4ad[_0x1f34('0x36')]=_[_0x1f34('0x2f')](_0x19d996[_0x1f34('0x36')]);_0x2be4ad[_0x1f34('0x30')]=_[_0x1f34('0x44')](_0x2be4ad[_0x1f34('0x2e')],_0x2be4ad[_0x1f34('0x36')]);_0x487276[_0x1f34('0x32')]=_[_0x1f34('0x44')](_0x2be4ad[_0x1f34('0x2e')],qs[_0x1f34('0x31')](_0x19d996[_0x1f34('0x36')][_0x1f34('0x31')]));_0x487276[_0x1f34('0x32')]=_0x487276[_0x1f34('0x32')][_0x1f34('0x33')]?_0x487276[_0x1f34('0x32')]:_0x2be4ad[_0x1f34('0x2e')];_0x487276[_0x1f34('0x37')]=qs['sort'](_0x19d996['query'][_0x1f34('0x38')]);_0x487276[_0x1f34('0x39')]=qs['filters'](_[_0x1f34('0x3a')](_0x19d996[_0x1f34('0x36')],_0x2be4ad[_0x1f34('0x30')]));if(_0x19d996[_0x1f34('0x36')][_0x1f34('0x3d')]){_0x487276[_0x1f34('0x39')]=_[_0x1f34('0x3b')](_0x487276['where'],{'$or':_[_0x1f34('0x28')](_0x487276[_0x1f34('0x32')],function(_0x567bff){var _0x487724={};_0x487724[_0x567bff]={'$like':'%'+_0x19d996[_0x1f34('0x36')][_0x1f34('0x3d')]+'%'};return _0x487724;})});}_0x487276=_[_0x1f34('0x3b')]({},_0x487276,_0x19d996['options']);return _0x529cbb[_0x1f34('0x4d')](_0x487276);}})[_0x1f34('0x23')](function(_0x56b520){if(_0x56b520){_0x1ddb9d=_0x56b520[_0x1f34('0x33')];if(!_0x19d996[_0x1f34('0x36')][_0x1f34('0x34')](_0x1f34('0x35'))){_0x487276[_0x1f34('0x1c')]=qs[_0x1f34('0x1c')](_0x19d996[_0x1f34('0x36')]['limit']);_0x487276[_0x1f34('0x1a')]=qs[_0x1f34('0x1a')](_0x19d996[_0x1f34('0x36')][_0x1f34('0x1a')]);}return _0x529cbb[_0x1f34('0x4d')](_0x487276);}})[_0x1f34('0x23')](function(_0x350b97){if(_0x350b97){return _0x350b97?{'count':_0x1ddb9d,'rows':_0x350b97}:null;}})['then'](respondWithResult(_0x5a9500,null))['catch'](handleError(_0x5a9500,null));};exports['addActions']=function(_0x20e990,_0x36524a,_0x3c7a90){return db[_0x1f34('0x4e')][_0x1f34('0x45')]({'where':{'id':_0x20e990[_0x1f34('0x43')]['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x36524a,null))[_0x1f34('0x23')](function(_0x12175f){if(_0x12175f){return _0x12175f[_0x1f34('0x4f')](_0x20e990[_0x1f34('0x48')]['ids'],_['omit'](_0x20e990[_0x1f34('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x36524a,null))['catch'](handleError(_0x36524a,null));};exports['getActions']=function(_0x41f31d,_0x2639ca,_0x4fd592){var _0x56d121={};var _0xc42a78={};var _0x542bc9;var _0x2224a2;return db[_0x1f34('0x29')][_0x1f34('0x4c')]({'where':{'id':_0x41f31d['params']['id']}})[_0x1f34('0x23')](handleEntityNotFound(_0x2639ca,null))[_0x1f34('0x23')](function(_0x19d45f){if(_0x19d45f){_0x542bc9=_0x19d45f;_0xc42a78[_0x1f34('0x2e')]=_['keys'](db[_0x1f34('0x4e')][_0x1f34('0x2a')]);_0xc42a78['query']=_[_0x1f34('0x2f')](_0x41f31d[_0x1f34('0x36')]);_0xc42a78[_0x1f34('0x30')]=_[_0x1f34('0x44')](_0xc42a78[_0x1f34('0x2e')],_0xc42a78[_0x1f34('0x36')]);_0x56d121[_0x1f34('0x32')]=_[_0x1f34('0x44')](_0xc42a78[_0x1f34('0x2e')],qs[_0x1f34('0x31')](_0x41f31d[_0x1f34('0x36')]['fields']));_0x56d121[_0x1f34('0x32')]=_0x56d121['attributes'][_0x1f34('0x33')]?_0x56d121[_0x1f34('0x32')]:_0xc42a78[_0x1f34('0x2e')];_0x56d121['order']=qs[_0x1f34('0x38')](_0x41f31d[_0x1f34('0x36')]['sort']);_0x56d121[_0x1f34('0x39')]=qs[_0x1f34('0x30')](_['pick'](_0x41f31d[_0x1f34('0x36')],_0xc42a78[_0x1f34('0x30')]));if(_0x41f31d['query'][_0x1f34('0x3d')]){_0x56d121[_0x1f34('0x39')]=_[_0x1f34('0x3b')](_0x56d121[_0x1f34('0x39')],{'$or':_[_0x1f34('0x28')](_0x56d121[_0x1f34('0x32')],function(_0x9ac485){var _0x39b52c={};_0x39b52c[_0x9ac485]={'$like':'%'+_0x41f31d['query'][_0x1f34('0x3d')]+'%'};return _0x39b52c;})});}_0x56d121=_[_0x1f34('0x3b')]({},_0x56d121,_0x41f31d[_0x1f34('0x3e')]);return _0x542bc9['getActions'](_0x56d121);}})[_0x1f34('0x23')](function(_0x49d64c){if(_0x49d64c){_0x2224a2=_0x49d64c[_0x1f34('0x33')];if(!_0x41f31d['query'][_0x1f34('0x34')](_0x1f34('0x35'))){_0x56d121[_0x1f34('0x1c')]=qs[_0x1f34('0x1c')](_0x41f31d[_0x1f34('0x36')][_0x1f34('0x1c')]);_0x56d121[_0x1f34('0x1a')]=qs[_0x1f34('0x1a')](_0x41f31d[_0x1f34('0x36')]['offset']);}return _0x542bc9[_0x1f34('0x50')](_0x56d121);}})['then'](function(_0xbc2d12){if(_0xbc2d12){return _0xbc2d12?{'count':_0x2224a2,'rows':_0xbc2d12}:null;}})['then'](respondWithResult(_0x2639ca,null))[_0x1f34('0x46')](handleError(_0x2639ca,null));}; \ No newline at end of file +var _0x918a=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','error','stack','name','map','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x918a,0x188));var _0xa918=function(_0x34b02a,_0xc897da){_0x34b02a=_0x34b02a-0x0;var _0x393178=_0x918a[_0x34b02a];return _0x393178;};'use strict';var emlformat=require(_0xa918('0x0'));var rimraf=require(_0xa918('0x1'));var zipdir=require(_0xa918('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa918('0x3'));var moment=require(_0xa918('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa918('0x5'));var util=require(_0xa918('0x6'));var path=require(_0xa918('0x7'));var sox=require(_0xa918('0x8'));var csv=require(_0xa918('0x9'));var ejs=require(_0xa918('0xa'));var fs=require('fs');var fs_extra=require(_0xa918('0xb'));var _=require(_0xa918('0xc'));var squel=require(_0xa918('0xd'));var crypto=require('crypto');var jsforce=require(_0xa918('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa918('0x9'));var querystring=require(_0xa918('0xf'));var Papa=require(_0xa918('0x10'));var Redis=require(_0xa918('0x11'));var authService=require(_0xa918('0x12'));var qs=require(_0xa918('0x13'));var as=require(_0xa918('0x14'));var hardwareService=require(_0xa918('0x15'));var logger=require(_0xa918('0x16'))('api');var utils=require(_0xa918('0x17'));var config=require(_0xa918('0x18'));var licenseUtil=require(_0xa918('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3522d3,_0x2d78c5){_0x2d78c5=_0x2d78c5||0xcc;return function(_0x473ed7){if(_0x473ed7){return _0x3522d3[_0xa918('0x1a')](_0x2d78c5);}return _0x3522d3[_0xa918('0x1b')](_0x2d78c5)[_0xa918('0x1c')]();};}function respondWithResult(_0x1a1e15,_0x53be22){_0x53be22=_0x53be22||0xc8;return function(_0x5e04ae){if(_0x5e04ae){return _0x1a1e15[_0xa918('0x1b')](_0x53be22)[_0xa918('0x1d')](_0x5e04ae);}};}function respondWithFilteredResult(_0x1e4087,_0x4afcc9){return function(_0x5918c8){if(_0x5918c8){var _0x11e523=typeof _0x4afcc9[_0xa918('0x1e')]==='undefined'&&typeof _0x4afcc9[_0xa918('0x1f')]===_0xa918('0x20');var _0x5a2201=_0x5918c8[_0xa918('0x21')];var _0x57d606=_0x11e523?0x0:_0x4afcc9[_0xa918('0x1e')];var _0x3727c7=_0x11e523?_0x5918c8[_0xa918('0x21')]:_0x4afcc9[_0xa918('0x1e')]+_0x4afcc9['limit'];var _0x1bb312;if(_0x3727c7>=_0x5a2201){_0x3727c7=_0x5a2201;_0x1bb312=0xc8;}else{_0x1bb312=0xce;}_0x1e4087['status'](_0x1bb312);return _0x1e4087['set'](_0xa918('0x22'),_0x57d606+'-'+_0x3727c7+'/'+_0x5a2201)['json'](_0x5918c8);}return null;};}function patchUpdates(_0x51c49d){return function(_0x1d2023){try{jsonpatch['apply'](_0x1d2023,_0x51c49d,!![]);}catch(_0x1679c9){return BPromise[_0xa918('0x23')](_0x1679c9);}return _0x1d2023['save']();};}function saveUpdates(_0x2adf9e,_0x4b0e81){return function(_0x5658b2){if(_0x5658b2){return _0x5658b2[_0xa918('0x24')](_0x2adf9e)[_0xa918('0x25')](function(_0xbabcaf){return _0xbabcaf;});}return null;};}function removeEntity(_0x135b70,_0x7f8c0){return function(_0x53fc90){if(_0x53fc90){return _0x53fc90['destroy']()['then'](function(){_0x135b70[_0xa918('0x1b')](0xcc)[_0xa918('0x1c')]();});}};}function handleEntityNotFound(_0x62416,_0x11f677){return function(_0xa4e3c2){if(!_0xa4e3c2){_0x62416[_0xa918('0x1a')](0x194);}return _0xa4e3c2;};}function handleError(_0x5ce113,_0x1aa8be){_0x1aa8be=_0x1aa8be||0x1f4;return function(_0x193208){logger[_0xa918('0x26')](_0x193208[_0xa918('0x27')]);if(_0x193208['name']){delete _0x193208[_0xa918('0x28')];}_0x5ce113[_0xa918('0x1b')](_0x1aa8be)['send'](_0x193208);};}exports['index']=function(_0x38beed,_0x1f250c){var _0x9acf74={},_0x1cf2f0={},_0x1a87c4={'count':0x0,'rows':[]};var _0x43a2b2=_[_0xa918('0x29')](db['Automation']['rawAttributes'],function(_0x3c874b){return{'name':_0x3c874b['fieldName'],'type':_0x3c874b['type'][_0xa918('0x2a')]};});_0x1cf2f0['model']=_[_0xa918('0x29')](_0x43a2b2,_0xa918('0x28'));_0x1cf2f0['query']=_[_0xa918('0x2b')](_0x38beed[_0xa918('0x2c')]);_0x1cf2f0[_0xa918('0x2d')]=_[_0xa918('0x2e')](_0x1cf2f0[_0xa918('0x2f')],_0x1cf2f0['query']);_0x9acf74[_0xa918('0x30')]=_['intersection'](_0x1cf2f0[_0xa918('0x2f')],qs[_0xa918('0x31')](_0x38beed['query'][_0xa918('0x31')]));_0x9acf74[_0xa918('0x30')]=_0x9acf74[_0xa918('0x30')][_0xa918('0x32')]?_0x9acf74[_0xa918('0x30')]:_0x1cf2f0['model'];if(!_0x38beed[_0xa918('0x2c')][_0xa918('0x33')](_0xa918('0x34'))){_0x9acf74[_0xa918('0x1f')]=qs[_0xa918('0x1f')](_0x38beed[_0xa918('0x2c')][_0xa918('0x1f')]);_0x9acf74[_0xa918('0x1e')]=qs[_0xa918('0x1e')](_0x38beed[_0xa918('0x2c')][_0xa918('0x1e')]);}_0x9acf74[_0xa918('0x35')]=qs[_0xa918('0x36')](_0x38beed[_0xa918('0x2c')][_0xa918('0x36')]);_0x9acf74[_0xa918('0x37')]=qs[_0xa918('0x2d')](_[_0xa918('0x38')](_0x38beed[_0xa918('0x2c')],_0x1cf2f0['filters']),_0x43a2b2);if(_0x38beed[_0xa918('0x2c')][_0xa918('0x39')]){_0x9acf74[_0xa918('0x37')]=_[_0xa918('0x3a')](_0x9acf74['where'],{'$or':_[_0xa918('0x29')](_0x43a2b2,function(_0x49524a){if(_0x49524a['type']!==_0xa918('0x3b')){var _0x500f23={};_0x500f23[_0x49524a['name']]={'$like':'%'+_0x38beed['query'][_0xa918('0x39')]+'%'};return _0x500f23;}})});}_0x9acf74=_[_0xa918('0x3a')]({},_0x9acf74,_0x38beed[_0xa918('0x3c')]);var _0x38d5f9={'where':_0x9acf74[_0xa918('0x37')]};return db[_0xa918('0x3d')][_0xa918('0x21')](_0x38d5f9)[_0xa918('0x25')](function(_0xbc317e){_0x1a87c4[_0xa918('0x21')]=_0xbc317e;if(_0x38beed[_0xa918('0x2c')]['includeAll']){_0x9acf74[_0xa918('0x3e')]=[{'all':!![]}];}return db[_0xa918('0x3d')][_0xa918('0x3f')](_0x9acf74);})[_0xa918('0x25')](function(_0x385113){_0x1a87c4[_0xa918('0x40')]=_0x385113;return _0x1a87c4;})['then'](respondWithFilteredResult(_0x1f250c,_0x9acf74))[_0xa918('0x41')](handleError(_0x1f250c,null));};exports[_0xa918('0x42')]=function(_0x310995,_0x18a154){var _0x32a754={'raw':![],'where':{'id':_0x310995[_0xa918('0x43')]['id']}},_0x5730b5={};_0x5730b5['model']=_['keys'](db[_0xa918('0x3d')][_0xa918('0x44')]);_0x5730b5[_0xa918('0x2c')]=_[_0xa918('0x2b')](_0x310995['query']);_0x5730b5[_0xa918('0x2d')]=_['intersection'](_0x5730b5['model'],_0x5730b5[_0xa918('0x2c')]);_0x32a754[_0xa918('0x30')]=_[_0xa918('0x2e')](_0x5730b5['model'],qs[_0xa918('0x31')](_0x310995['query'][_0xa918('0x31')]));_0x32a754['attributes']=_0x32a754[_0xa918('0x30')][_0xa918('0x32')]?_0x32a754[_0xa918('0x30')]:_0x5730b5[_0xa918('0x2f')];if(_0x310995['query'][_0xa918('0x45')]){_0x32a754[_0xa918('0x3e')]=[{'all':!![]}];}_0x32a754=_[_0xa918('0x3a')]({},_0x32a754,_0x310995[_0xa918('0x3c')]);return db['Automation'][_0xa918('0x46')](_0x32a754)['then'](handleEntityNotFound(_0x18a154,null))[_0xa918('0x25')](respondWithResult(_0x18a154,null))[_0xa918('0x41')](handleError(_0x18a154,null));};exports[_0xa918('0x47')]=function(_0x1e4a7c,_0x387e0d){return db['Automation']['create'](_0x1e4a7c[_0xa918('0x48')],{})['then'](respondWithResult(_0x387e0d,0xc9))[_0xa918('0x41')](handleError(_0x387e0d,null));};exports['update']=function(_0xdb44f9,_0x45d981){if(_0xdb44f9[_0xa918('0x48')]['id']){delete _0xdb44f9[_0xa918('0x48')]['id'];}return db[_0xa918('0x3d')][_0xa918('0x46')]({'where':{'id':_0xdb44f9[_0xa918('0x43')]['id']}})[_0xa918('0x25')](handleEntityNotFound(_0x45d981,null))[_0xa918('0x25')](saveUpdates(_0xdb44f9[_0xa918('0x48')],null))[_0xa918('0x25')](respondWithResult(_0x45d981,null))[_0xa918('0x41')](handleError(_0x45d981,null));};exports[_0xa918('0x49')]=function(_0x551b06,_0x2fbd96){return db[_0xa918('0x3d')][_0xa918('0x46')]({'where':{'id':_0x551b06['params']['id']}})[_0xa918('0x25')](handleEntityNotFound(_0x2fbd96,null))['then'](removeEntity(_0x2fbd96,null))[_0xa918('0x41')](handleError(_0x2fbd96,null));};exports[_0xa918('0x4a')]=function(_0x23f78a,_0xe4b37a,_0xd05143){return db[_0xa918('0x4b')][_0xa918('0x46')]({'where':{'id':_0x23f78a['params']['id']}})[_0xa918('0x25')](handleEntityNotFound(_0xe4b37a,null))[_0xa918('0x25')](function(_0xc17901){if(_0xc17901){return _0xc17901[_0xa918('0x4a')](_0x23f78a[_0xa918('0x48')][_0xa918('0x4c')],_[_0xa918('0x4d')](_0x23f78a[_0xa918('0x48')],['ids','id'])||{});}})[_0xa918('0x25')](respondWithResult(_0xe4b37a,null))[_0xa918('0x41')](handleError(_0xe4b37a,null));};exports[_0xa918('0x4e')]=function(_0x214ffc,_0x514f2d,_0x5116cb){var _0x122802={};var _0x56610c={};var _0x4f3a8c;var _0x2c8d58;return db['Automation'][_0xa918('0x4f')]({'where':{'id':_0x214ffc[_0xa918('0x43')]['id']}})[_0xa918('0x25')](handleEntityNotFound(_0x514f2d,null))[_0xa918('0x25')](function(_0x514186){if(_0x514186){_0x4f3a8c=_0x514186;_0x56610c[_0xa918('0x2f')]=_['keys'](db[_0xa918('0x4b')]['rawAttributes']);_0x56610c['query']=_[_0xa918('0x2b')](_0x214ffc[_0xa918('0x2c')]);_0x56610c[_0xa918('0x2d')]=_[_0xa918('0x2e')](_0x56610c[_0xa918('0x2f')],_0x56610c[_0xa918('0x2c')]);_0x122802[_0xa918('0x30')]=_[_0xa918('0x2e')](_0x56610c[_0xa918('0x2f')],qs[_0xa918('0x31')](_0x214ffc[_0xa918('0x2c')][_0xa918('0x31')]));_0x122802['attributes']=_0x122802['attributes'][_0xa918('0x32')]?_0x122802[_0xa918('0x30')]:_0x56610c[_0xa918('0x2f')];_0x122802[_0xa918('0x35')]=qs['sort'](_0x214ffc[_0xa918('0x2c')][_0xa918('0x36')]);_0x122802['where']=qs[_0xa918('0x2d')](_['pick'](_0x214ffc[_0xa918('0x2c')],_0x56610c[_0xa918('0x2d')]));if(_0x214ffc['query'][_0xa918('0x39')]){_0x122802['where']=_[_0xa918('0x3a')](_0x122802[_0xa918('0x37')],{'$or':_[_0xa918('0x29')](_0x122802[_0xa918('0x30')],function(_0xb21ad6){var _0x147e21={};_0x147e21[_0xb21ad6]={'$like':'%'+_0x214ffc['query'][_0xa918('0x39')]+'%'};return _0x147e21;})});}_0x122802=_[_0xa918('0x3a')]({},_0x122802,_0x214ffc[_0xa918('0x3c')]);return _0x4f3a8c['getConditions'](_0x122802);}})['then'](function(_0x3327bd){if(_0x3327bd){_0x2c8d58=_0x3327bd[_0xa918('0x32')];if(!_0x214ffc[_0xa918('0x2c')]['hasOwnProperty'](_0xa918('0x34'))){_0x122802['limit']=qs['limit'](_0x214ffc[_0xa918('0x2c')][_0xa918('0x1f')]);_0x122802['offset']=qs[_0xa918('0x1e')](_0x214ffc[_0xa918('0x2c')][_0xa918('0x1e')]);}return _0x4f3a8c[_0xa918('0x4e')](_0x122802);}})[_0xa918('0x25')](function(_0x2f8aa0){if(_0x2f8aa0){return _0x2f8aa0?{'count':_0x2c8d58,'rows':_0x2f8aa0}:null;}})['then'](respondWithResult(_0x514f2d,null))[_0xa918('0x41')](handleError(_0x514f2d,null));};exports[_0xa918('0x50')]=function(_0x41f627,_0x4d6a6e,_0x2a391f){return db[_0xa918('0x51')][_0xa918('0x46')]({'where':{'id':_0x41f627[_0xa918('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d6a6e,null))['then'](function(_0x5d398a){if(_0x5d398a){return _0x5d398a[_0xa918('0x50')](_0x41f627[_0xa918('0x48')]['ids'],_[_0xa918('0x4d')](_0x41f627['body'],[_0xa918('0x4c'),'id'])||{});}})[_0xa918('0x25')](respondWithResult(_0x4d6a6e,null))['catch'](handleError(_0x4d6a6e,null));};exports[_0xa918('0x52')]=function(_0x1ba386,_0x4fb4d6,_0x44bd18){var _0x52de3f={};var _0x83ecdc={};var _0x3fa30e;var _0x1639ff;return db[_0xa918('0x3d')]['findOne']({'where':{'id':_0x1ba386[_0xa918('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fb4d6,null))[_0xa918('0x25')](function(_0x27d4af){if(_0x27d4af){_0x3fa30e=_0x27d4af;_0x83ecdc['model']=_[_0xa918('0x2b')](db['Action'][_0xa918('0x44')]);_0x83ecdc[_0xa918('0x2c')]=_['keys'](_0x1ba386[_0xa918('0x2c')]);_0x83ecdc['filters']=_[_0xa918('0x2e')](_0x83ecdc['model'],_0x83ecdc['query']);_0x52de3f[_0xa918('0x30')]=_['intersection'](_0x83ecdc['model'],qs[_0xa918('0x31')](_0x1ba386[_0xa918('0x2c')][_0xa918('0x31')]));_0x52de3f[_0xa918('0x30')]=_0x52de3f[_0xa918('0x30')][_0xa918('0x32')]?_0x52de3f['attributes']:_0x83ecdc['model'];_0x52de3f[_0xa918('0x35')]=qs[_0xa918('0x36')](_0x1ba386[_0xa918('0x2c')][_0xa918('0x36')]);_0x52de3f[_0xa918('0x37')]=qs[_0xa918('0x2d')](_[_0xa918('0x38')](_0x1ba386[_0xa918('0x2c')],_0x83ecdc[_0xa918('0x2d')]));if(_0x1ba386[_0xa918('0x2c')][_0xa918('0x39')]){_0x52de3f[_0xa918('0x37')]=_[_0xa918('0x3a')](_0x52de3f[_0xa918('0x37')],{'$or':_[_0xa918('0x29')](_0x52de3f[_0xa918('0x30')],function(_0x2dd290){var _0x43e661={};_0x43e661[_0x2dd290]={'$like':'%'+_0x1ba386[_0xa918('0x2c')][_0xa918('0x39')]+'%'};return _0x43e661;})});}_0x52de3f=_[_0xa918('0x3a')]({},_0x52de3f,_0x1ba386[_0xa918('0x3c')]);return _0x3fa30e[_0xa918('0x52')](_0x52de3f);}})[_0xa918('0x25')](function(_0x5ef3b0){if(_0x5ef3b0){_0x1639ff=_0x5ef3b0['length'];if(!_0x1ba386[_0xa918('0x2c')][_0xa918('0x33')](_0xa918('0x34'))){_0x52de3f[_0xa918('0x1f')]=qs[_0xa918('0x1f')](_0x1ba386[_0xa918('0x2c')]['limit']);_0x52de3f['offset']=qs['offset'](_0x1ba386[_0xa918('0x2c')][_0xa918('0x1e')]);}return _0x3fa30e[_0xa918('0x52')](_0x52de3f);}})[_0xa918('0x25')](function(_0x212af2){if(_0x212af2){return _0x212af2?{'count':_0x1639ff,'rows':_0x212af2}:null;}})[_0xa918('0x25')](respondWithResult(_0x4fb4d6,null))[_0xa918('0x41')](handleError(_0x4fb4d6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dfb6391..4d5fd98 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 _0xeb60=['lodash','util','moment','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xeb60,0x1a0));var _0x0eb6=function(_0x1bfa0f,_0x2b36d3){_0x1bfa0f=_0x1bfa0f-0x0;var _0x4c727f=_0xeb60[_0x1bfa0f];return _0x4c727f;};'use strict';var _=require(_0x0eb6('0x0'));var util=require(_0x0eb6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0eb6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0eb6('0x3'));var config=require('../../config/environment');var attributes=require(_0x0eb6('0x4'));module[_0x0eb6('0x5')]=function(_0x3cc298,_0x59ea31){return _0x3cc298[_0x0eb6('0x6')](_0x0eb6('0x7'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8095=['lodash','util','moment','path','define','Automation','tools_automations'];(function(_0x494f6f,_0x180cbd){var _0x117ae3=function(_0x4488e2){while(--_0x4488e2){_0x494f6f['push'](_0x494f6f['shift']());}};_0x117ae3(++_0x180cbd);}(_0x8095,0x15e));var _0x5809=function(_0x46b77b,_0x413e47){_0x46b77b=_0x46b77b-0x0;var _0x4e56ab=_0x8095[_0x46b77b];return _0x4e56ab;};'use strict';var _=require(_0x5809('0x0'));var util=require(_0x5809('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5809('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5809('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x290769,_0x3155eb){return _0x290769[_0x5809('0x4')](_0x5809('0x5'),attributes,{'tableName':_0x5809('0x6'),'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 0447c6d..a028889 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 _0x30fc=['Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3cae79,_0x56281c){var _0x3465be=function(_0x3110a7){while(--_0x3110a7){_0x3cae79['push'](_0x3cae79['shift']());}};_0x3465be(++_0x56281c);}(_0x30fc,0x64));var _0xc30f=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x30fc[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require(_0xc30f('0x4'));var db=require(_0xc30f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc30f('0x6'))(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var jayson=require(_0xc30f('0x9'));var client=jayson[_0xc30f('0xa')][_0xc30f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c174,_0x23528c,_0x325a64){return new BPromise(function(_0x33a769,_0x3d2167){return client[_0xc30f('0xc')](_0x54c174,_0x325a64)[_0xc30f('0xd')](function(_0x436059){logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,'request\x20sent');logger[_0xc30f('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x23528c,_0xc30f('0x11'),JSON[_0xc30f('0x12')](_0x436059));if(_0x436059[_0xc30f('0x13')]){if(_0x436059[_0xc30f('0x13')][_0xc30f('0x14')]===0x1f4){logger[_0xc30f('0x13')]('Automation,\x20%s,\x20%s',_0x23528c,_0x436059['error'][_0xc30f('0x15')]);return _0x3d2167(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}logger[_0xc30f('0x13')]('Automation,\x20%s,\x20%s',_0x23528c,_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);return _0x33a769(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}else{logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,_0xc30f('0x11'));_0x33a769(_0x436059['result']['message']);}})[_0xc30f('0x16')](function(_0x1b02c5){logger[_0xc30f('0x13')](_0xc30f('0xf'),_0x23528c,_0x1b02c5);_0x3d2167(_0x1b02c5);});});} \ No newline at end of file +var _0xc664=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var moment=require('moment');var BPromise=require(_0x4c66('0x2'));var rs=require(_0x4c66('0x3'));var fs=require('fs');var Redis=require(_0x4c66('0x4'));var db=require(_0x4c66('0x5'))['db'];var utils=require(_0x4c66('0x6'));var logger=require('../../config/logger')(_0x4c66('0x7'));var config=require(_0x4c66('0x8'));var jayson=require(_0x4c66('0x9'));var client=jayson[_0x4c66('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14ceba,_0x3528ee,_0x406aec){return new BPromise(function(_0x47fb8e,_0x4aa737){return client[_0x4c66('0xb')](_0x14ceba,_0x406aec)[_0x4c66('0xc')](function(_0xb870a5){logger[_0x4c66('0xd')]('Automation,\x20%s,\x20%s',_0x3528ee,_0x4c66('0xe'));logger[_0x4c66('0xf')](_0x4c66('0x10'),_0x3528ee,_0x4c66('0xe'),JSON[_0x4c66('0x11')](_0xb870a5));if(_0xb870a5[_0x4c66('0x12')]){if(_0xb870a5[_0x4c66('0x12')][_0x4c66('0x13')]===0x1f4){logger[_0x4c66('0x12')]('Automation,\x20%s,\x20%s',_0x3528ee,_0xb870a5['error']['message']);return _0x4aa737(_0xb870a5['error'][_0x4c66('0x14')]);}logger[_0x4c66('0x12')](_0x4c66('0x15'),_0x3528ee,_0xb870a5[_0x4c66('0x12')][_0x4c66('0x14')]);return _0x47fb8e(_0xb870a5[_0x4c66('0x12')][_0x4c66('0x14')]);}else{logger[_0x4c66('0xd')](_0x4c66('0x15'),_0x3528ee,_0x4c66('0xe'));_0x47fb8e(_0xb870a5[_0x4c66('0x16')][_0x4c66('0x14')]);}})[_0x4c66('0x17')](function(_0x144982){logger[_0x4c66('0x12')]('Automation,\x20%s,\x20%s',_0x3528ee,_0x144982);_0x4aa737(_0x144982);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index eb9fd0a..6e99453 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 _0x9ca8=['isAuthenticated','index','/:id','/:id/conditions','/:id/actions','post','create','addConditions','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x9ca8,0x123));var _0x89ca=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x9ca8[_0x3cb6dc];return _0x47ec89;};'use strict';var multer=require('multer');var util=require(_0x89ca('0x0'));var path=require('path');var timeout=require(_0x89ca('0x1'));var express=require(_0x89ca('0x2'));var router=express[_0x89ca('0x3')]();var fs_extra=require(_0x89ca('0x4'));var auth=require(_0x89ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89ca('0x6'));var controller=require(_0x89ca('0x7'));router[_0x89ca('0x8')]('/',auth[_0x89ca('0x9')](),controller[_0x89ca('0xa')]);router[_0x89ca('0x8')](_0x89ca('0xb'),auth[_0x89ca('0x9')](),controller['show']);router['get'](_0x89ca('0xc'),auth['isAuthenticated'](),controller['getConditions']);router[_0x89ca('0x8')](_0x89ca('0xd'),auth[_0x89ca('0x9')](),controller['getActions']);router[_0x89ca('0xe')]('/',auth[_0x89ca('0x9')](),controller[_0x89ca('0xf')]);router[_0x89ca('0xe')](_0x89ca('0xc'),auth[_0x89ca('0x9')](),controller[_0x89ca('0x10')]);router[_0x89ca('0xe')](_0x89ca('0xd'),auth[_0x89ca('0x9')](),controller['addActions']);router['put'](_0x89ca('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x89ca('0x11')](_0x89ca('0xb'),auth[_0x89ca('0x9')](),controller[_0x89ca('0x12')]);module[_0x89ca('0x13')]=router; \ No newline at end of file +var _0x92e0=['isAuthenticated','getConditions','post','addConditions','/:id/actions','addActions','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id'];(function(_0xa7bbae,_0x268932){var _0x2d5bdf=function(_0x3feddd){while(--_0x3feddd){_0xa7bbae['push'](_0xa7bbae['shift']());}};_0x2d5bdf(++_0x268932);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x092e('0x0'));var util=require('util');var path=require(_0x092e('0x1'));var timeout=require(_0x092e('0x2'));var express=require(_0x092e('0x3'));var router=express[_0x092e('0x4')]();var fs_extra=require(_0x092e('0x5'));var auth=require(_0x092e('0x6'));var interaction=require(_0x092e('0x7'));var config=require(_0x092e('0x8'));var controller=require(_0x092e('0x9'));router[_0x092e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x092e('0xa')](_0x092e('0xb'),auth[_0x092e('0xc')](),controller['show']);router[_0x092e('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x092e('0xd')]);router[_0x092e('0xa')]('/:id/actions',auth[_0x092e('0xc')](),controller['getActions']);router['post']('/',auth[_0x092e('0xc')](),controller['create']);router[_0x092e('0xe')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x092e('0xf')]);router['post'](_0x092e('0x10'),auth[_0x092e('0xc')](),controller[_0x092e('0x11')]);router[_0x092e('0x12')](_0x092e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x092e('0x13')](_0x092e('0xb'),auth['isAuthenticated'](),controller[_0x092e('0x14')]);module[_0x092e('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index b6ed0c4..8e3e35a 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 _0xdb28=['#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','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)'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xdb28,0x106));var _0x8db2=function(_0x53edfb,_0x1f6cef){_0x53edfb=_0x53edfb-0x0;var _0x24ec51=_0xdb28[_0x53edfb];return _0x24ec51;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8db2('0x4')),'allowNull':![],'defaultValue':_0x8db2('0x4')},'description':{'type':Sequelize[_0x8db2('0x2')]},'active':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':0x0,'comment':_0x8db2('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8db2('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8db2('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8db2('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8db2('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8db2('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'comment':_0x8db2('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8db2('0xe')},'dialTimezone':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':_0x8db2('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x8db2('0x10')](_0x8db2('0x11'),_0x8db2('0x12'),_0x8db2('0x13')),'defaultValue':_0x8db2('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8db2('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x8db2('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8db2('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8db2('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8db2('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8db2('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8db2('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8db2('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8db2('0x9')](0x9)[_0x8db2('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8db2('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8db2('0x10')]('DESC',_0x8db2('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8db2('0x1c')},'dialCutDigit':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8db2('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8db2('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8db2('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8db2('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8db2('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x8db2('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8db2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8db2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8db2('0x9')](0x5)[_0x8db2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8db2('0x23')}}; \ No newline at end of file +var _0x9ee6=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x4d2a06,_0x540d6e){var _0x139f1b=function(_0x253c39){while(--_0x253c39){_0x4d2a06['push'](_0x4d2a06['shift']());}};_0x139f1b(++_0x540d6e);}(_0x9ee6,0x84));var _0x69ee=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0x9ee6[_0x4179e2];return _0x24cb50;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x69ee('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x69ee('0x3')](_0x69ee('0x4')),'allowNull':![],'defaultValue':_0x69ee('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x69ee('0x5')],'defaultValue':0x0,'comment':_0x69ee('0x6')},'limitCalls':{'type':Sequelize[_0x69ee('0x7')](0x4)[_0x69ee('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x69ee('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x69ee('0xa')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x69ee('0xa')]},'dialOriginateTimeout':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x69ee('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x69ee('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x69ee('0x7')](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'comment':_0x69ee('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x69ee('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x69ee('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x69ee('0x3')](_0x69ee('0x13'),_0x69ee('0x14'),_0x69ee('0x15')),'defaultValue':_0x69ee('0x13')},'dialAMDActive':{'type':Sequelize[_0x69ee('0x5')],'defaultValue':0x0,'comment':_0x69ee('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x69ee('0x7')](0x9)[_0x69ee('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x69ee('0x17')},'dialAMDGreeting':{'type':Sequelize[_0x69ee('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x69ee('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x69ee('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x69ee('0x7')](0x9)[_0x69ee('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x69ee('0x19')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x69ee('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x69ee('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x69ee('0x7')](0x9)[_0x69ee('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x69ee('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x69ee('0x7')](0x9)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x69ee('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x69ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x69ee('0x7')](0x9)[_0x69ee('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x69ee('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x69ee('0x3')]('DESC',_0x69ee('0x1e')),'defaultValue':_0x69ee('0x1f')},'dialPrefix':{'type':Sequelize[_0x69ee('0xa')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x69ee('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x69ee('0x20')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x69ee('0x7')](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x69ee('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x69ee('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x69ee('0x7')](0x5)[_0x69ee('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x69ee('0x7')](0x3)[_0x69ee('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x69ee('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x69ee('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x69ee('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 51493ed..eee81ef 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 _0xcb49=['findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','IvrCampaigns','end','error','stack','name','send','index','map','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','merge','filter','includeAll','include','Campaign','findAll','catch','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmHopper','hasOwnProperty','pick','CampaignId','rows','getHopperHistories'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xcb49,0x156));var _0x9cb4=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xcb49[_0x421e36];return _0x20b3e3;};'use strict';var emlformat=require(_0x9cb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9cb4('0x1'));var jsonpatch=require(_0x9cb4('0x2'));var rp=require(_0x9cb4('0x3'));var moment=require(_0x9cb4('0x4'));var BPromise=require(_0x9cb4('0x5'));var Mustache=require(_0x9cb4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9cb4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cb4('0x8'));var squel=require('squel');var crypto=require(_0x9cb4('0x9'));var jsforce=require(_0x9cb4('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9cb4('0xb'));var Papa=require('papaparse');var Redis=require(_0x9cb4('0xc'));var authService=require(_0x9cb4('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cb4('0xe'));var logger=require(_0x9cb4('0xf'))(_0x9cb4('0x10'));var utils=require(_0x9cb4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9cb4('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465871,_0x411902){_0x411902=_0x411902||0xcc;return function(_0x243f61){if(_0x243f61){return _0x465871[_0x9cb4('0x13')](_0x411902);}return _0x465871[_0x9cb4('0x14')](_0x411902)['end']();};}function respondWithResult(_0x2ce130,_0x22b994){_0x22b994=_0x22b994||0xc8;return function(_0x47f68b){if(_0x47f68b){return _0x2ce130[_0x9cb4('0x14')](_0x22b994)['json'](_0x47f68b);}};}function respondWithFilteredResult(_0x57daf1,_0xf169bf){return function(_0x1a9245){if(_0x1a9245){var _0x33c673=typeof _0xf169bf[_0x9cb4('0x15')]==='undefined'&&typeof _0xf169bf[_0x9cb4('0x16')]===_0x9cb4('0x17');var _0x35c0eb=_0x1a9245[_0x9cb4('0x18')];var _0x520165=_0x33c673?0x0:_0xf169bf[_0x9cb4('0x15')];var _0x461430=_0x33c673?_0x1a9245[_0x9cb4('0x18')]:_0xf169bf['offset']+_0xf169bf['limit'];var _0x1ef211;if(_0x461430>=_0x35c0eb){_0x461430=_0x35c0eb;_0x1ef211=0xc8;}else{_0x1ef211=0xce;}_0x57daf1['status'](_0x1ef211);return _0x57daf1[_0x9cb4('0x19')]('Content-Range',_0x520165+'-'+_0x461430+'/'+_0x35c0eb)[_0x9cb4('0x1a')](_0x1a9245);}return null;};}function patchUpdates(_0x5b90d4){return function(_0x37ee39){try{jsonpatch[_0x9cb4('0x1b')](_0x37ee39,_0x5b90d4,!![]);}catch(_0x28ca7b){return BPromise[_0x9cb4('0x1c')](_0x28ca7b);}return _0x37ee39[_0x9cb4('0x1d')]();};}function saveUpdates(_0xe4fdb7,_0x5eafaf){return function(_0x25f263){if(_0x25f263){return _0x25f263[_0x9cb4('0x1e')](_0xe4fdb7)[_0x9cb4('0x1f')](function(_0x38be6d){return _0x38be6d;});}return null;};}function removeEntity(_0x18b4c1,_0x2d9c06){return function(_0x3f9437){if(_0x3f9437){return _0x3f9437[_0x9cb4('0x20')]()[_0x9cb4('0x1f')](function(){var _0x1a6c1e=_0x3f9437['get']({'plain':!![]});var _0x9abb58=_0x9cb4('0x21');return db['UserProfileResource'][_0x9cb4('0x20')]({'where':{'type':_0x9abb58,'resourceId':_0x1a6c1e['id']}})[_0x9cb4('0x1f')](function(){return _0x3f9437;});})[_0x9cb4('0x1f')](function(){_0x18b4c1['status'](0xcc)[_0x9cb4('0x22')]();});}};}function handleEntityNotFound(_0x2b7894,_0x4f0e2f){return function(_0xc17d4b){if(!_0xc17d4b){_0x2b7894[_0x9cb4('0x13')](0x194);}return _0xc17d4b;};}function handleError(_0x33526b,_0x27e7a0){_0x27e7a0=_0x27e7a0||0x1f4;return function(_0x286714){logger[_0x9cb4('0x23')](_0x286714[_0x9cb4('0x24')]);if(_0x286714[_0x9cb4('0x25')]){delete _0x286714['name'];}_0x33526b['status'](_0x27e7a0)[_0x9cb4('0x26')](_0x286714);};}exports[_0x9cb4('0x27')]=function(_0x8959e2,_0x5529f7){var _0x2ddfef={},_0x1f5671={},_0x3d47aa={'count':0x0,'rows':[]};var _0xc2be0a=_[_0x9cb4('0x28')](db['Campaign']['rawAttributes'],function(_0x4f79e5){return{'name':_0x4f79e5[_0x9cb4('0x29')],'type':_0x4f79e5[_0x9cb4('0x2a')][_0x9cb4('0x2b')]};});_0x1f5671['model']=_[_0x9cb4('0x28')](_0xc2be0a,'name');_0x1f5671['query']=_[_0x9cb4('0x2c')](_0x8959e2['query']);_0x1f5671[_0x9cb4('0x2d')]=_[_0x9cb4('0x2e')](_0x1f5671[_0x9cb4('0x2f')],_0x1f5671[_0x9cb4('0x30')]);_0x2ddfef[_0x9cb4('0x31')]=_[_0x9cb4('0x2e')](_0x1f5671[_0x9cb4('0x2f')],qs[_0x9cb4('0x32')](_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x32')]));_0x2ddfef[_0x9cb4('0x31')]=_0x2ddfef[_0x9cb4('0x31')][_0x9cb4('0x33')]?_0x2ddfef[_0x9cb4('0x31')]:_0x1f5671[_0x9cb4('0x2f')];if(!_0x8959e2['query']['hasOwnProperty'](_0x9cb4('0x34'))){_0x2ddfef[_0x9cb4('0x16')]=qs['limit'](_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x2ddfef[_0x9cb4('0x15')]=qs[_0x9cb4('0x15')](_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x15')]);}_0x2ddfef[_0x9cb4('0x35')]=qs[_0x9cb4('0x36')](_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x36')]);_0x2ddfef[_0x9cb4('0x37')]=qs['filters'](_['pick'](_0x8959e2[_0x9cb4('0x30')],_0x1f5671[_0x9cb4('0x2d')]),_0xc2be0a);if(_0x8959e2['query']['filter']){_0x2ddfef[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x2ddfef[_0x9cb4('0x37')],{'$or':_['map'](_0xc2be0a,function(_0x3290c9){if(_0x3290c9['type']!=='VIRTUAL'){var _0x370ed4={};_0x370ed4[_0x3290c9[_0x9cb4('0x25')]]={'$like':'%'+_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x39')]+'%'};return _0x370ed4;}})});}_0x2ddfef=_[_0x9cb4('0x38')]({},_0x2ddfef,_0x8959e2['options']);var _0x128dc6={'where':_0x2ddfef['where']};return db['Campaign'][_0x9cb4('0x18')](_0x128dc6)['then'](function(_0x8154ba){_0x3d47aa['count']=_0x8154ba;if(_0x8959e2[_0x9cb4('0x30')][_0x9cb4('0x3a')]){_0x2ddfef[_0x9cb4('0x3b')]=[{'all':!![]}];}return db[_0x9cb4('0x3c')][_0x9cb4('0x3d')](_0x2ddfef);})[_0x9cb4('0x1f')](function(_0x259e2d){_0x3d47aa['rows']=_0x259e2d;return _0x3d47aa;})['then'](respondWithFilteredResult(_0x5529f7,_0x2ddfef))[_0x9cb4('0x3e')](handleError(_0x5529f7,null));};exports['show']=function(_0x45c87a,_0x4181af){var _0x2122ce={'raw':![],'where':{'id':_0x45c87a[_0x9cb4('0x3f')]['id']}},_0x17c3c0={};_0x17c3c0['model']=_[_0x9cb4('0x2c')](db[_0x9cb4('0x3c')][_0x9cb4('0x40')]);_0x17c3c0['query']=_[_0x9cb4('0x2c')](_0x45c87a[_0x9cb4('0x30')]);_0x17c3c0[_0x9cb4('0x2d')]=_[_0x9cb4('0x2e')](_0x17c3c0[_0x9cb4('0x2f')],_0x17c3c0[_0x9cb4('0x30')]);_0x2122ce['attributes']=_['intersection'](_0x17c3c0['model'],qs[_0x9cb4('0x32')](_0x45c87a['query'][_0x9cb4('0x32')]));_0x2122ce[_0x9cb4('0x31')]=_0x2122ce[_0x9cb4('0x31')]['length']?_0x2122ce['attributes']:_0x17c3c0[_0x9cb4('0x2f')];if(_0x45c87a['query']['includeAll']){_0x2122ce['include']=[{'all':!![]}];}_0x2122ce=_[_0x9cb4('0x38')]({},_0x2122ce,_0x45c87a[_0x9cb4('0x41')]);return db[_0x9cb4('0x3c')][_0x9cb4('0x42')](_0x2122ce)[_0x9cb4('0x1f')](handleEntityNotFound(_0x4181af,null))[_0x9cb4('0x1f')](respondWithResult(_0x4181af,null))[_0x9cb4('0x3e')](handleError(_0x4181af,null));};exports[_0x9cb4('0x43')]=function(_0x2b89e8,_0x2537b5){return db['Campaign'][_0x9cb4('0x43')](_0x2b89e8[_0x9cb4('0x44')],{})[_0x9cb4('0x1f')](function(_0x5a3591){var _0x18cb75=_0x2b89e8[_0x9cb4('0x45')][_0x9cb4('0x46')]({'plain':!![]});if(!_0x18cb75)throw new Error(_0x9cb4('0x47'));if(_0x18cb75[_0x9cb4('0x48')]==='user'){var _0x2b7add=_0x5a3591['get']({'plain':!![]});var _0xb1bd11=_0x9cb4('0x21');return db[_0x9cb4('0x49')][_0x9cb4('0x42')]({'where':{'name':_0xb1bd11,'userProfileId':_0x18cb75[_0x9cb4('0x4a')]},'raw':!![]})['then'](function(_0x6f6fc8){if(_0x6f6fc8&&_0x6f6fc8[_0x9cb4('0x4b')]===0x0){return db[_0x9cb4('0x4c')][_0x9cb4('0x43')]({'name':_0x2b7add[_0x9cb4('0x25')],'resourceId':_0x2b7add['id'],'type':_0x6f6fc8[_0x9cb4('0x25')],'sectionId':_0x6f6fc8['id']},{})['then'](function(){return _0x5a3591;});}else{return _0x5a3591;}})['catch'](function(_0x416deb){logger[_0x9cb4('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x416deb);throw _0x416deb;});}return _0x5a3591;})[_0x9cb4('0x1f')](respondWithResult(_0x2537b5,0xc9))[_0x9cb4('0x3e')](handleError(_0x2537b5,null));};exports[_0x9cb4('0x4d')]=function(_0x1c48a6,_0x459dd3){var _0x2bb706={'where':{'id':_0x1c48a6[_0x9cb4('0x3f')]['id']}},_0x47dc70={};_0x47dc70['model']=_[_0x9cb4('0x2c')](db['Campaign'][_0x9cb4('0x40')]);_0x2bb706[_0x9cb4('0x31')]=_[_0x9cb4('0x2e')](_0x47dc70['model'],qs['fields'](_0x1c48a6[_0x9cb4('0x30')]['fields']));_0x2bb706[_0x9cb4('0x31')]=_0x2bb706[_0x9cb4('0x31')][_0x9cb4('0x33')]?_0x2bb706[_0x9cb4('0x31')]:_0x47dc70[_0x9cb4('0x2f')];if(_0x1c48a6['query']['includeAll']){_0x2bb706[_0x9cb4('0x3b')]=[{'all':!![]}];}_0x2bb706=_[_0x9cb4('0x38')]({},_0x2bb706,_0x1c48a6[_0x9cb4('0x41')]);return db[_0x9cb4('0x3c')][_0x9cb4('0x42')](_0x2bb706)['then'](handleEntityNotFound(_0x459dd3,null))['then'](function(_0x4e779f){if(_0x4e779f){var _0x1c6dec=_0x4e779f[_0x9cb4('0x46')]({'plain':!![]});_0x1c6dec=qs[_0x9cb4('0x4e')](_0x1c6dec,['id','createdAt','updatedAt']);_0x1c48a6[_0x9cb4('0x44')]=_[_0x9cb4('0x4e')](_0x1c48a6[_0x9cb4('0x44')],['id','createdAt',_0x9cb4('0x4f')]);return db[_0x9cb4('0x3c')]['create'](_[_0x9cb4('0x38')](_0x1c6dec,_0x1c48a6[_0x9cb4('0x44')]),{'include':_0x1c48a6[_0x9cb4('0x30')][_0x9cb4('0x3a')]?[{'all':!![]}]:undefined})[_0x9cb4('0x1f')](function(_0x1ec64c){var _0x258b48=_0x1c48a6[_0x9cb4('0x45')][_0x9cb4('0x46')]({'plain':!![]});if(!_0x258b48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x258b48[_0x9cb4('0x48')]===_0x9cb4('0x45')){var _0x4efbaa=_0x1ec64c['get']({'plain':!![]});var _0x177bab=_0x9cb4('0x21');return db[_0x9cb4('0x49')]['find']({'where':{'name':_0x177bab,'userProfileId':_0x258b48[_0x9cb4('0x4a')]},'raw':!![]})[_0x9cb4('0x1f')](function(_0x504c9a){if(_0x504c9a&&_0x504c9a[_0x9cb4('0x4b')]===0x0){return db[_0x9cb4('0x4c')][_0x9cb4('0x43')]({'name':_0x4efbaa[_0x9cb4('0x25')],'resourceId':_0x4efbaa['id'],'type':_0x504c9a[_0x9cb4('0x25')],'sectionId':_0x504c9a['id']},{})['then'](function(){return _0x1ec64c;});}else{return _0x1ec64c;}})['catch'](function(_0x3d9d55){logger['error'](_0x9cb4('0x50'),_0x3d9d55);throw _0x3d9d55;});}return _0x1ec64c;});}})[_0x9cb4('0x1f')](respondWithResult(_0x459dd3,0xc9))[_0x9cb4('0x3e')](handleError(_0x459dd3,null));};exports[_0x9cb4('0x1e')]=function(_0x4a92f3,_0x1fd9e6){if(_0x4a92f3[_0x9cb4('0x44')]['id']){delete _0x4a92f3[_0x9cb4('0x44')]['id'];}return db[_0x9cb4('0x3c')][_0x9cb4('0x42')]({'where':{'id':_0x4a92f3[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x1fd9e6,null))[_0x9cb4('0x1f')](saveUpdates(_0x4a92f3[_0x9cb4('0x44')],null))[_0x9cb4('0x1f')](respondWithResult(_0x1fd9e6,null))['catch'](handleError(_0x1fd9e6,null));};exports[_0x9cb4('0x20')]=function(_0x2b7989,_0x21ae91){return db[_0x9cb4('0x3c')]['find']({'where':{'id':_0x2b7989[_0x9cb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21ae91,null))[_0x9cb4('0x1f')](removeEntity(_0x21ae91,null))[_0x9cb4('0x3e')](handleError(_0x21ae91,null));};exports['getHoppers']=function(_0x3a5015,_0x50d853,_0x253d28){var _0x2941df={'raw':!![],'where':{}};var _0x5dfbd1={};var _0x40af33={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3a5015[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x50d853,null))['then'](function(_0x47d96d){if(_0x47d96d){_0x5dfbd1[_0x9cb4('0x2f')]=_[_0x9cb4('0x2c')](db[_0x9cb4('0x51')]['rawAttributes']);_0x5dfbd1[_0x9cb4('0x30')]=_[_0x9cb4('0x2c')](_0x3a5015[_0x9cb4('0x30')]);_0x5dfbd1[_0x9cb4('0x2d')]=_[_0x9cb4('0x2e')](_0x5dfbd1[_0x9cb4('0x2f')],_0x5dfbd1[_0x9cb4('0x30')]);_0x2941df[_0x9cb4('0x31')]=_[_0x9cb4('0x2e')](_0x5dfbd1[_0x9cb4('0x2f')],qs[_0x9cb4('0x32')](_0x3a5015[_0x9cb4('0x30')]['fields']));_0x2941df[_0x9cb4('0x31')]=_0x2941df['attributes']['length']?_0x2941df[_0x9cb4('0x31')]:_0x5dfbd1[_0x9cb4('0x2f')];if(!_0x3a5015[_0x9cb4('0x30')][_0x9cb4('0x52')](_0x9cb4('0x34'))){_0x2941df[_0x9cb4('0x16')]=qs[_0x9cb4('0x16')](_0x3a5015[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x2941df['offset']=qs[_0x9cb4('0x15')](_0x3a5015[_0x9cb4('0x30')][_0x9cb4('0x15')]);}_0x2941df['order']=qs[_0x9cb4('0x36')](_0x3a5015[_0x9cb4('0x30')][_0x9cb4('0x36')]);_0x2941df[_0x9cb4('0x37')]=qs[_0x9cb4('0x2d')](_[_0x9cb4('0x53')](_0x3a5015[_0x9cb4('0x30')],_0x5dfbd1[_0x9cb4('0x2d')]));_0x2941df['where'][_0x9cb4('0x54')]=_0x47d96d['id'];if(_0x3a5015['query']['filter']){_0x2941df[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x2941df['where'],{'$or':_[_0x9cb4('0x28')](_0x2941df[_0x9cb4('0x31')],function(_0x22507c){var _0xcba21={};_0xcba21[_0x22507c]={'$like':'%'+_0x3a5015['query'][_0x9cb4('0x39')]+'%'};return _0xcba21;})});}_0x2941df=_[_0x9cb4('0x38')]({},_0x2941df,_0x3a5015[_0x9cb4('0x41')]);return db[_0x9cb4('0x51')][_0x9cb4('0x18')]({'where':_0x2941df[_0x9cb4('0x37')]})[_0x9cb4('0x1f')](function(_0x59a5f8){_0x40af33[_0x9cb4('0x18')]=_0x59a5f8;if(_0x3a5015[_0x9cb4('0x30')][_0x9cb4('0x3a')]){_0x2941df[_0x9cb4('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x9cb4('0x3d')](_0x2941df);})[_0x9cb4('0x1f')](function(_0x56af1c){_0x40af33[_0x9cb4('0x55')]=_0x56af1c;return _0x40af33;});}})[_0x9cb4('0x1f')](respondWithFilteredResult(_0x50d853,_0x2941df))[_0x9cb4('0x3e')](handleError(_0x50d853,null));};exports[_0x9cb4('0x56')]=function(_0x37db01,_0x1e693f,_0x303046){var _0x59d3b5={'raw':!![],'where':{}};var _0x25de0e={};var _0x384559={'count':0x0,'rows':[]};return db[_0x9cb4('0x3c')][_0x9cb4('0x57')]({'where':{'id':_0x37db01[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x1e693f,null))[_0x9cb4('0x1f')](function(_0x389c41){if(_0x389c41){_0x25de0e['model']=_[_0x9cb4('0x2c')](db[_0x9cb4('0x58')][_0x9cb4('0x40')]);_0x25de0e[_0x9cb4('0x30')]=_[_0x9cb4('0x2c')](_0x37db01[_0x9cb4('0x30')]);_0x25de0e[_0x9cb4('0x2d')]=_[_0x9cb4('0x2e')](_0x25de0e[_0x9cb4('0x2f')],_0x25de0e['query']);_0x59d3b5[_0x9cb4('0x31')]=_[_0x9cb4('0x2e')](_0x25de0e[_0x9cb4('0x2f')],qs[_0x9cb4('0x32')](_0x37db01[_0x9cb4('0x30')][_0x9cb4('0x32')]));_0x59d3b5[_0x9cb4('0x31')]=_0x59d3b5[_0x9cb4('0x31')]['length']?_0x59d3b5[_0x9cb4('0x31')]:_0x25de0e[_0x9cb4('0x2f')];if(!_0x37db01[_0x9cb4('0x30')][_0x9cb4('0x52')](_0x9cb4('0x34'))){_0x59d3b5[_0x9cb4('0x16')]=qs[_0x9cb4('0x16')](_0x37db01[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x59d3b5[_0x9cb4('0x15')]=qs[_0x9cb4('0x15')](_0x37db01[_0x9cb4('0x30')]['offset']);}_0x59d3b5[_0x9cb4('0x35')]=qs['sort'](_0x37db01[_0x9cb4('0x30')][_0x9cb4('0x36')]);_0x59d3b5[_0x9cb4('0x37')]=qs[_0x9cb4('0x2d')](_['pick'](_0x37db01[_0x9cb4('0x30')],_0x25de0e[_0x9cb4('0x2d')]));_0x59d3b5[_0x9cb4('0x37')][_0x9cb4('0x54')]=_0x389c41['id'];if(_0x37db01[_0x9cb4('0x30')]['filter']){_0x59d3b5[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x59d3b5[_0x9cb4('0x37')],{'$or':_['map'](_0x59d3b5['attributes'],function(_0x515d73){var _0x496ab0={};_0x496ab0[_0x515d73]={'$like':'%'+_0x37db01['query'][_0x9cb4('0x39')]+'%'};return _0x496ab0;})});}_0x59d3b5=_['merge']({},_0x59d3b5,_0x37db01[_0x9cb4('0x41')]);return db[_0x9cb4('0x58')][_0x9cb4('0x18')]({'where':_0x59d3b5[_0x9cb4('0x37')]})[_0x9cb4('0x1f')](function(_0x269ca2){_0x384559[_0x9cb4('0x18')]=_0x269ca2;if(_0x37db01[_0x9cb4('0x30')][_0x9cb4('0x3a')]){_0x59d3b5[_0x9cb4('0x3b')]=[{'all':!![]}];}return db[_0x9cb4('0x58')][_0x9cb4('0x3d')](_0x59d3b5);})[_0x9cb4('0x1f')](function(_0x187dd3){_0x384559[_0x9cb4('0x55')]=_0x187dd3;return _0x384559;});}})['then'](respondWithFilteredResult(_0x1e693f,_0x59d3b5))[_0x9cb4('0x3e')](handleError(_0x1e693f,null));};exports['getHopperFinals']=function(_0x3016f5,_0x316263,_0x516ac7){var _0x4be60b={'raw':!![],'where':{}};var _0x241b59={};var _0x347211={'count':0x0,'rows':[]};return db[_0x9cb4('0x3c')][_0x9cb4('0x57')]({'where':{'id':_0x3016f5[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x316263,null))[_0x9cb4('0x1f')](function(_0xf5abe8){if(_0xf5abe8){_0x241b59[_0x9cb4('0x2f')]=_[_0x9cb4('0x2c')](db[_0x9cb4('0x59')][_0x9cb4('0x40')]);_0x241b59[_0x9cb4('0x30')]=_['keys'](_0x3016f5[_0x9cb4('0x30')]);_0x241b59[_0x9cb4('0x2d')]=_[_0x9cb4('0x2e')](_0x241b59['model'],_0x241b59[_0x9cb4('0x30')]);_0x4be60b['attributes']=_['intersection'](_0x241b59[_0x9cb4('0x2f')],qs['fields'](_0x3016f5[_0x9cb4('0x30')][_0x9cb4('0x32')]));_0x4be60b[_0x9cb4('0x31')]=_0x4be60b[_0x9cb4('0x31')][_0x9cb4('0x33')]?_0x4be60b['attributes']:_0x241b59[_0x9cb4('0x2f')];if(!_0x3016f5[_0x9cb4('0x30')][_0x9cb4('0x52')](_0x9cb4('0x34'))){_0x4be60b[_0x9cb4('0x16')]=qs['limit'](_0x3016f5[_0x9cb4('0x30')]['limit']);_0x4be60b[_0x9cb4('0x15')]=qs[_0x9cb4('0x15')](_0x3016f5['query'][_0x9cb4('0x15')]);}_0x4be60b['order']=qs[_0x9cb4('0x36')](_0x3016f5['query'][_0x9cb4('0x36')]);_0x4be60b[_0x9cb4('0x37')]=qs['filters'](_[_0x9cb4('0x53')](_0x3016f5[_0x9cb4('0x30')],_0x241b59[_0x9cb4('0x2d')]));_0x4be60b['where'][_0x9cb4('0x54')]=_0xf5abe8['id'];if(_0x3016f5[_0x9cb4('0x30')][_0x9cb4('0x39')]){_0x4be60b[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x4be60b[_0x9cb4('0x37')],{'$or':_['map'](_0x4be60b[_0x9cb4('0x31')],function(_0x2c7aa0){var _0x17a45d={};_0x17a45d[_0x2c7aa0]={'$like':'%'+_0x3016f5[_0x9cb4('0x30')][_0x9cb4('0x39')]+'%'};return _0x17a45d;})});}_0x4be60b=_[_0x9cb4('0x38')]({},_0x4be60b,_0x3016f5[_0x9cb4('0x41')]);return db[_0x9cb4('0x59')]['count']({'where':_0x4be60b[_0x9cb4('0x37')]})[_0x9cb4('0x1f')](function(_0x1dd074){_0x347211[_0x9cb4('0x18')]=_0x1dd074;if(_0x3016f5[_0x9cb4('0x30')][_0x9cb4('0x3a')]){_0x4be60b[_0x9cb4('0x3b')]=[{'all':!![]}];}return db[_0x9cb4('0x59')][_0x9cb4('0x3d')](_0x4be60b);})['then'](function(_0x2198f7){_0x347211[_0x9cb4('0x55')]=_0x2198f7;return _0x347211;});}})[_0x9cb4('0x1f')](respondWithFilteredResult(_0x316263,_0x4be60b))[_0x9cb4('0x3e')](handleError(_0x316263,null));};exports[_0x9cb4('0x5a')]=function(_0x56d56d,_0x2148ad,_0x53f4eb){var _0x555aea={'raw':!![],'where':{}};var _0x205f78={};var _0x17b469={'count':0x0,'rows':[]};return db[_0x9cb4('0x3c')][_0x9cb4('0x57')]({'where':{'id':_0x56d56d[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x2148ad,null))[_0x9cb4('0x1f')](function(_0x4a8c68){if(_0x4a8c68){_0x205f78[_0x9cb4('0x2f')]=_[_0x9cb4('0x2c')](db[_0x9cb4('0x5b')]['rawAttributes']);_0x205f78['query']=_['keys'](_0x56d56d[_0x9cb4('0x30')]);_0x205f78[_0x9cb4('0x2d')]=_['intersection'](_0x205f78['model'],_0x205f78[_0x9cb4('0x30')]);_0x555aea['attributes']=_[_0x9cb4('0x2e')](_0x205f78[_0x9cb4('0x2f')],qs[_0x9cb4('0x32')](_0x56d56d[_0x9cb4('0x30')][_0x9cb4('0x32')]));_0x555aea[_0x9cb4('0x31')]=_0x555aea[_0x9cb4('0x31')][_0x9cb4('0x33')]?_0x555aea[_0x9cb4('0x31')]:_0x205f78[_0x9cb4('0x2f')];if(!_0x56d56d[_0x9cb4('0x30')]['hasOwnProperty']('nolimit')){_0x555aea[_0x9cb4('0x16')]=qs['limit'](_0x56d56d[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x555aea[_0x9cb4('0x15')]=qs['offset'](_0x56d56d[_0x9cb4('0x30')][_0x9cb4('0x15')]);}_0x555aea[_0x9cb4('0x35')]=qs[_0x9cb4('0x36')](_0x56d56d[_0x9cb4('0x30')][_0x9cb4('0x36')]);_0x555aea[_0x9cb4('0x37')]=qs[_0x9cb4('0x2d')](_[_0x9cb4('0x53')](_0x56d56d[_0x9cb4('0x30')],_0x205f78[_0x9cb4('0x2d')]));_0x555aea[_0x9cb4('0x37')]['CampaignId']=_0x4a8c68['id'];if(_0x56d56d['query']['filter']){_0x555aea[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x555aea[_0x9cb4('0x37')],{'$or':_[_0x9cb4('0x28')](_0x555aea[_0x9cb4('0x31')],function(_0x57ef36){var _0x2a0e6c={};_0x2a0e6c[_0x57ef36]={'$like':'%'+_0x56d56d['query'][_0x9cb4('0x39')]+'%'};return _0x2a0e6c;})});}_0x555aea=_[_0x9cb4('0x38')]({},_0x555aea,_0x56d56d[_0x9cb4('0x41')]);return db[_0x9cb4('0x5b')]['count']({'where':_0x555aea[_0x9cb4('0x37')]})['then'](function(_0x54bf52){_0x17b469[_0x9cb4('0x18')]=_0x54bf52;if(_0x56d56d[_0x9cb4('0x30')]['includeAll']){_0x555aea[_0x9cb4('0x3b')]=[{'all':!![]}];}return db[_0x9cb4('0x5b')][_0x9cb4('0x3d')](_0x555aea);})[_0x9cb4('0x1f')](function(_0x58a5d5){_0x17b469[_0x9cb4('0x55')]=_0x58a5d5;return _0x17b469;});}})[_0x9cb4('0x1f')](respondWithFilteredResult(_0x2148ad,_0x555aea))[_0x9cb4('0x3e')](handleError(_0x2148ad,null));};exports['getLists']=function(_0x3c8fc6,_0x572ad0,_0x58903a){var _0x5d61c1={};var _0x2b16c7={};var _0x31d43d;var _0x7aaaec;return db[_0x9cb4('0x3c')][_0x9cb4('0x57')]({'where':{'id':_0x3c8fc6[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x572ad0,null))[_0x9cb4('0x1f')](function(_0x5770a2){if(_0x5770a2){_0x31d43d=_0x5770a2;_0x2b16c7[_0x9cb4('0x2f')]=_[_0x9cb4('0x2c')](db['CmList'][_0x9cb4('0x40')]);_0x2b16c7[_0x9cb4('0x30')]=_['keys'](_0x3c8fc6['query']);_0x2b16c7['filters']=_[_0x9cb4('0x2e')](_0x2b16c7['model'],_0x2b16c7['query']);_0x5d61c1[_0x9cb4('0x31')]=_['intersection'](_0x2b16c7[_0x9cb4('0x2f')],qs['fields'](_0x3c8fc6[_0x9cb4('0x30')][_0x9cb4('0x32')]));_0x5d61c1['attributes']=_0x5d61c1[_0x9cb4('0x31')]['length']?_0x5d61c1[_0x9cb4('0x31')]:_0x2b16c7[_0x9cb4('0x2f')];_0x5d61c1['order']=qs['sort'](_0x3c8fc6['query'][_0x9cb4('0x36')]);_0x5d61c1['where']=qs[_0x9cb4('0x2d')](_[_0x9cb4('0x53')](_0x3c8fc6[_0x9cb4('0x30')],_0x2b16c7['filters']));if(_0x3c8fc6[_0x9cb4('0x30')][_0x9cb4('0x39')]){_0x5d61c1['where']=_[_0x9cb4('0x38')](_0x5d61c1[_0x9cb4('0x37')],{'$or':_[_0x9cb4('0x28')](_0x5d61c1[_0x9cb4('0x31')],function(_0x4cfa33){var _0x17f8c1={};_0x17f8c1[_0x4cfa33]={'$like':'%'+_0x3c8fc6['query']['filter']+'%'};return _0x17f8c1;})});}_0x5d61c1=_['merge']({},_0x5d61c1,_0x3c8fc6[_0x9cb4('0x41')]);return _0x31d43d[_0x9cb4('0x5c')](_0x5d61c1);}})[_0x9cb4('0x1f')](function(_0x30c736){if(_0x30c736){_0x7aaaec=_0x30c736[_0x9cb4('0x33')];if(!_0x3c8fc6[_0x9cb4('0x30')][_0x9cb4('0x52')](_0x9cb4('0x34'))){_0x5d61c1[_0x9cb4('0x16')]=qs['limit'](_0x3c8fc6[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x5d61c1['offset']=qs['offset'](_0x3c8fc6['query'][_0x9cb4('0x15')]);}return _0x31d43d[_0x9cb4('0x5c')](_0x5d61c1);}})[_0x9cb4('0x1f')](function(_0x4d4dd2){if(_0x4d4dd2){return _0x4d4dd2?{'count':_0x7aaaec,'rows':_0x4d4dd2}:null;}})[_0x9cb4('0x1f')](respondWithResult(_0x572ad0,null))[_0x9cb4('0x3e')](handleError(_0x572ad0,null));};exports['addLists']=function(_0x4b0520,_0x13dd92,_0x3fb2a6){var _0x861838,_0x5b3863;var _0x25c554=[];var _0x2188ef=moment()[_0x9cb4('0x5d')](_0x9cb4('0x5e'));return db[_0x9cb4('0x3c')]['find']({'where':{'id':_0x4b0520['params']['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x13dd92,null))['then'](function(_0x2f1edd){if(_0x2f1edd){_0x5b3863=_0x2f1edd;return _0x2f1edd[_0x9cb4('0x5f')](_0x4b0520[_0x9cb4('0x44')]['ids'],_[_0x9cb4('0x4e')](_0x4b0520[_0x9cb4('0x44')],[_0x9cb4('0x60'),'id'])||{});}return null;})[_0x9cb4('0x61')](function(_0x1954a2){var _0x5bcda0;var _0x5d81ee;_0x861838=_0x1954a2||[];var _0x239c84=[];if(_0x1954a2){for(var _0x443fb1=0x0;_0x443fb1<_0x1954a2[_0x9cb4('0x33')];_0x443fb1+=0x1){var _0x2a6b2f=_0x1954a2[_0x443fb1][_0x9cb4('0x46')]({'plain':!![]});_0x5b3863[_0x9cb4('0x62')]=_0x4b0520[_0x9cb4('0x44')]['dialCheckDuplicateType']?_0x4b0520[_0x9cb4('0x44')][_0x9cb4('0x62')]:_0x5b3863[_0x9cb4('0x62')];switch(_0x5b3863[_0x9cb4('0x62')]){case _0x9cb4('0x63'):_0x5bcda0=squel[_0x9cb4('0x64')]()['into'](_0x9cb4('0x65'))[_0x9cb4('0x66')]([_0x9cb4('0x67'),_0x9cb4('0x68'),_0x9cb4('0x69'),_0x9cb4('0x6a'),_0x9cb4('0x54'),_0x9cb4('0x6b'),_0x9cb4('0x4f')],squel['select']()[_0x9cb4('0x6c')](_0x9cb4('0x67'),_0x9cb4('0x67'))['field'](_0x9cb4('0x6d'),_0x9cb4('0x68'))['field']('id','ContactId')[_0x9cb4('0x6c')](_0x2a6b2f[_0x9cb4('0x6e')][_0x9cb4('0x6f')](),_0x9cb4('0x6a'))[_0x9cb4('0x6c')](_0x4b0520[_0x9cb4('0x3f')]['id']['toString'](),'CampaignId')[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x6b'))['field']('\x27'+_0x2188ef+'\x27',_0x9cb4('0x4f'))['from'](_0x9cb4('0x70'))['where'](_0x9cb4('0x71'))['where'](_0x9cb4('0x72'),_0x2a6b2f[_0x9cb4('0x6e')][_0x9cb4('0x6f')]())[_0x9cb4('0x37')](_0x9cb4('0x73'))[_0x9cb4('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9cb4('0x74')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x9cb4('0x75')](_0x9cb4('0x76'))[_0x9cb4('0x37')](_0x9cb4('0x77'),_0x4b0520[_0x9cb4('0x3f')]['id']['toString']()))['where'](_0x9cb4('0x78'),squel[_0x9cb4('0x74')]()[_0x9cb4('0x6c')](_0x9cb4('0x79'))[_0x9cb4('0x75')]('cm_hopper')['where'](_0x9cb4('0x77'),_0x4b0520[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')]())))[_0x9cb4('0x6f')]();break;case _0x9cb4('0x7a'):_0x5bcda0=squel[_0x9cb4('0x64')]()[_0x9cb4('0x7b')](_0x9cb4('0x65'))[_0x9cb4('0x66')](['phone','scheduledAt','ContactId','ListId',_0x9cb4('0x54'),'createdAt',_0x9cb4('0x4f')],squel[_0x9cb4('0x74')]()[_0x9cb4('0x6c')](_0x9cb4('0x67'),_0x9cb4('0x67'))[_0x9cb4('0x6c')](_0x9cb4('0x6d'),'scheduledAt')[_0x9cb4('0x6c')]('id','ContactId')[_0x9cb4('0x6c')](_0x2a6b2f[_0x9cb4('0x6e')]['toString'](),_0x9cb4('0x6a'))['field'](_0x4b0520[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')](),_0x9cb4('0x54'))[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x6b'))[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x4f'))[_0x9cb4('0x75')](_0x9cb4('0x70'))[_0x9cb4('0x37')](_0x9cb4('0x71'))['where']('ListId\x20=\x20?',_0x2a6b2f[_0x9cb4('0x6e')][_0x9cb4('0x6f')]())[_0x9cb4('0x37')](_0x9cb4('0x73'))[_0x9cb4('0x37')](_0x9cb4('0x78'),squel[_0x9cb4('0x74')]()[_0x9cb4('0x6c')](_0x9cb4('0x79'))[_0x9cb4('0x75')](_0x9cb4('0x65'))[_0x9cb4('0x37')](_0x9cb4('0x77'),_0x4b0520[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')]())))['toString']();break;default:_0x5bcda0=squel[_0x9cb4('0x64')]()[_0x9cb4('0x7b')](_0x9cb4('0x65'))['fromQuery'](['phone',_0x9cb4('0x68'),'ContactId',_0x9cb4('0x6a'),_0x9cb4('0x54'),_0x9cb4('0x6b'),'updatedAt'],squel[_0x9cb4('0x74')]()['field']('phone','phone')['field']('NOW()',_0x9cb4('0x68'))[_0x9cb4('0x6c')]('id',_0x9cb4('0x69'))['field'](_0x2a6b2f['CmListId'][_0x9cb4('0x6f')](),_0x9cb4('0x6a'))[_0x9cb4('0x6c')](_0x4b0520[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')](),'CampaignId')[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x6b'))[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x4f'))['from']('cm_contacts')[_0x9cb4('0x37')](_0x9cb4('0x71'))[_0x9cb4('0x37')](_0x9cb4('0x72'),_0x2a6b2f['CmListId'][_0x9cb4('0x6f')]())[_0x9cb4('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0x9cb4('0x6f')]();}_0x5d81ee=squel[_0x9cb4('0x64')]()[_0x9cb4('0x7b')](_0x9cb4('0x7c'))['fromQuery']([_0x9cb4('0x7d'),_0x9cb4('0x68'),_0x9cb4('0x67'),_0x9cb4('0x7e'),'createdAt','updatedAt'],squel[_0x9cb4('0x74')]()[_0x9cb4('0x6c')](_0x9cb4('0x7f'),'id')[_0x9cb4('0x6c')](_0x9cb4('0x6d'),_0x9cb4('0x68'))[_0x9cb4('0x6c')](_0x9cb4('0x80'),'phone')['field'](_0x9cb4('0x81'),_0x9cb4('0x7e'))[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27',_0x9cb4('0x6b'))[_0x9cb4('0x6c')]('\x27'+_0x2188ef+'\x27','updatedAt')[_0x9cb4('0x75')](_0x9cb4('0x82'),'ci')['join'](_0x9cb4('0x65'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x9cb4('0x37')](_0x9cb4('0x83'),_0x2a6b2f[_0x9cb4('0x6e')][_0x9cb4('0x6f')]())[_0x9cb4('0x37')](_0x9cb4('0x84'),_0x4b0520[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')]())[_0x9cb4('0x37')](_0x9cb4('0x85'),_0x2188ef))[_0x9cb4('0x6f')]();_0x239c84[_0x9cb4('0x86')](db[_0x9cb4('0x87')][_0x9cb4('0x30')](_0x5bcda0));_0x25c554[_0x9cb4('0x86')](db[_0x9cb4('0x87')][_0x9cb4('0x30')](_0x5d81ee));}return BPromise[_0x9cb4('0x88')](_0x239c84);}})['then'](function(){return BPromise['all'](_0x25c554);})[_0x9cb4('0x1f')](function(){return _0x861838;})[_0x9cb4('0x1f')](respondWithResult(_0x13dd92,null))['catch'](handleError(_0x13dd92,null));};exports[_0x9cb4('0x89')]=function(_0x3638ad,_0x865972,_0x27df73){return db[_0x9cb4('0x3c')][_0x9cb4('0x42')]({'where':{'id':_0x3638ad[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x865972,null))['then'](function(_0xa55e0a){if(_0xa55e0a){return _0xa55e0a[_0x9cb4('0x89')](_0x3638ad[_0x9cb4('0x30')][_0x9cb4('0x60')]);}})['then'](function(_0x372a77){if(_0x372a77){return db[_0x9cb4('0x51')]['destroy']({'where':{'ListId':_0x3638ad['query'][_0x9cb4('0x60')],'CampaignId':_0x3638ad[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](function(){return _0x372a77;});}})[_0x9cb4('0x1f')](respondWithStatusCode(_0x865972,null))[_0x9cb4('0x3e')](handleError(_0x865972,null));};exports[_0x9cb4('0x8a')]=function(_0x2d0eff,_0xdb342,_0x4535cb){var _0x138ad5={};var _0x57ab0d={};var _0x25f630;var _0x44f089;return db[_0x9cb4('0x3c')][_0x9cb4('0x57')]({'where':{'id':_0x2d0eff['params']['id']}})['then'](handleEntityNotFound(_0xdb342,null))['then'](function(_0x5a8560){if(_0x5a8560){_0x25f630=_0x5a8560;_0x57ab0d[_0x9cb4('0x2f')]=_[_0x9cb4('0x2c')](db[_0x9cb4('0x8b')][_0x9cb4('0x40')]);_0x57ab0d[_0x9cb4('0x30')]=_[_0x9cb4('0x2c')](_0x2d0eff[_0x9cb4('0x30')]);_0x57ab0d[_0x9cb4('0x2d')]=_['intersection'](_0x57ab0d[_0x9cb4('0x2f')],_0x57ab0d['query']);_0x138ad5[_0x9cb4('0x31')]=_[_0x9cb4('0x2e')](_0x57ab0d[_0x9cb4('0x2f')],qs[_0x9cb4('0x32')](_0x2d0eff['query']['fields']));_0x138ad5[_0x9cb4('0x31')]=_0x138ad5[_0x9cb4('0x31')][_0x9cb4('0x33')]?_0x138ad5[_0x9cb4('0x31')]:_0x57ab0d[_0x9cb4('0x2f')];_0x138ad5[_0x9cb4('0x35')]=qs[_0x9cb4('0x36')](_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x36')]);_0x138ad5[_0x9cb4('0x37')]=qs[_0x9cb4('0x2d')](_['pick'](_0x2d0eff[_0x9cb4('0x30')],_0x57ab0d['filters']));if(_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x39')]){_0x138ad5[_0x9cb4('0x37')]=_[_0x9cb4('0x38')](_0x138ad5[_0x9cb4('0x37')],{'$or':_[_0x9cb4('0x28')](_0x138ad5['attributes'],function(_0x58e43c){var _0x370bcd={};_0x370bcd[_0x58e43c]={'$like':'%'+_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x39')]+'%'};return _0x370bcd;})});}_0x138ad5=_[_0x9cb4('0x38')]({},_0x138ad5,_0x2d0eff['options']);return _0x25f630[_0x9cb4('0x8a')](_0x138ad5);}})['then'](function(_0x5a575a){if(_0x5a575a){_0x44f089=_0x5a575a[_0x9cb4('0x33')];if(!_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x52')](_0x9cb4('0x34'))){_0x138ad5[_0x9cb4('0x16')]=qs['limit'](_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x16')]);_0x138ad5[_0x9cb4('0x15')]=qs['offset'](_0x2d0eff[_0x9cb4('0x30')][_0x9cb4('0x15')]);}return _0x25f630[_0x9cb4('0x8a')](_0x138ad5);}})[_0x9cb4('0x1f')](function(_0x24fb89){if(_0x24fb89){return _0x24fb89?{'count':_0x44f089,'rows':_0x24fb89}:null;}})[_0x9cb4('0x1f')](respondWithResult(_0xdb342,null))[_0x9cb4('0x3e')](handleError(_0xdb342,null));};exports['addBlackLists']=function(_0x503c55,_0x3874af,_0x1872ed){var _0xe9a8c,_0x3cf5a1;var _0x46b6f3=[];var _0x201de4=moment()[_0x9cb4('0x5d')](_0x9cb4('0x5e'));return db['Campaign'][_0x9cb4('0x42')]({'where':{'id':_0x503c55[_0x9cb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3874af,null))[_0x9cb4('0x1f')](function(_0x16b4b7){if(_0x16b4b7){_0x3cf5a1=_0x16b4b7;return _0x16b4b7[_0x9cb4('0x8c')](_0x503c55[_0x9cb4('0x44')][_0x9cb4('0x60')],_[_0x9cb4('0x4e')](_0x503c55['body'],[_0x9cb4('0x60'),'id'])||{});}return null;})[_0x9cb4('0x61')](function(_0x47268a){var _0x377160;var _0x55fd5a;_0xe9a8c=_0x47268a||[];var _0x174901=[];if(_0x47268a){for(var _0x3f9630=0x0;_0x3f9630<_0x47268a[_0x9cb4('0x33')];_0x3f9630+=0x1){var _0x3055e7=_0x47268a[_0x3f9630][_0x9cb4('0x46')]({'plain':!![]});_0x377160=squel[_0x9cb4('0x64')]()[_0x9cb4('0x7b')](_0x9cb4('0x8d'))['fromQuery']([_0x9cb4('0x67'),_0x9cb4('0x69'),_0x9cb4('0x6a'),'CampaignId',_0x9cb4('0x6b'),_0x9cb4('0x4f')],squel[_0x9cb4('0x74')]()[_0x9cb4('0x6c')](_0x9cb4('0x67'),_0x9cb4('0x67'))[_0x9cb4('0x6c')]('id',_0x9cb4('0x69'))['field'](_0x3055e7['CmListId'][_0x9cb4('0x6f')](),_0x9cb4('0x6a'))[_0x9cb4('0x6c')](_0x503c55[_0x9cb4('0x3f')]['id'][_0x9cb4('0x6f')](),_0x9cb4('0x54'))[_0x9cb4('0x6c')](_0x9cb4('0x6d'),_0x9cb4('0x6b'))[_0x9cb4('0x6c')](_0x9cb4('0x6d'),_0x9cb4('0x4f'))[_0x9cb4('0x75')](_0x9cb4('0x70'))['where']('deletedAt\x20IS\x20NULL')[_0x9cb4('0x37')](_0x9cb4('0x72'),_0x3055e7[_0x9cb4('0x6e')][_0x9cb4('0x6f')]())[_0x9cb4('0x37')](_0x9cb4('0x73')))[_0x9cb4('0x6f')]();_0x174901[_0x9cb4('0x86')](db[_0x9cb4('0x87')][_0x9cb4('0x30')](_0x377160));}return BPromise[_0x9cb4('0x88')](_0x174901);}})[_0x9cb4('0x1f')](function(){return _0xe9a8c;})[_0x9cb4('0x1f')](respondWithResult(_0x3874af,null))[_0x9cb4('0x3e')](handleError(_0x3874af,null));};exports['removeBlackLists']=function(_0x20c5bd,_0x5e7325,_0x13f7a9){return db[_0x9cb4('0x3c')][_0x9cb4('0x42')]({'where':{'id':_0x20c5bd[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](handleEntityNotFound(_0x5e7325,null))[_0x9cb4('0x1f')](function(_0x30fea4){if(_0x30fea4){return _0x30fea4[_0x9cb4('0x8e')](_0x20c5bd[_0x9cb4('0x30')][_0x9cb4('0x60')]);}})[_0x9cb4('0x1f')](function(_0x3f3190){if(_0x3f3190){return db['CmHopperBlack'][_0x9cb4('0x20')]({'where':{'ListId':_0x20c5bd['query'][_0x9cb4('0x60')],'CampaignId':_0x20c5bd[_0x9cb4('0x3f')]['id']}})[_0x9cb4('0x1f')](function(){return _0x3f3190;});}})['then'](respondWithStatusCode(_0x5e7325,null))[_0x9cb4('0x3e')](handleError(_0x5e7325,null));}; \ No newline at end of file +var _0x3eae=['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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','end','error','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','order','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x215e4e,_0x206bbb){var _0x4b47d4=function(_0x5827d9){while(--_0x5827d9){_0x215e4e['push'](_0x215e4e['shift']());}};_0x4b47d4(++_0x206bbb);}(_0x3eae,0x126));var _0xe3ea=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x3eae[_0x414655];return _0x237884;};'use strict';var emlformat=require(_0xe3ea('0x0'));var rimraf=require(_0xe3ea('0x1'));var zipdir=require(_0xe3ea('0x2'));var jsonpatch=require(_0xe3ea('0x3'));var rp=require('request-promise');var moment=require(_0xe3ea('0x4'));var BPromise=require(_0xe3ea('0x5'));var Mustache=require('mustache');var util=require(_0xe3ea('0x6'));var path=require(_0xe3ea('0x7'));var sox=require(_0xe3ea('0x8'));var csv=require('to-csv');var ejs=require(_0xe3ea('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ea('0xa'));var _=require(_0xe3ea('0xb'));var squel=require(_0xe3ea('0xc'));var crypto=require(_0xe3ea('0xd'));var jsforce=require(_0xe3ea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe3ea('0xf'));var querystring=require(_0xe3ea('0x10'));var Papa=require('papaparse');var Redis=require(_0xe3ea('0x11'));var authService=require(_0xe3ea('0x12'));var qs=require(_0xe3ea('0x13'));var as=require(_0xe3ea('0x14'));var hardwareService=require(_0xe3ea('0x15'));var logger=require('../../config/logger')(_0xe3ea('0x16'));var utils=require(_0xe3ea('0x17'));var config=require(_0xe3ea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3ea('0x19'))['db'];function respondWithStatusCode(_0x3fa991,_0x470912){_0x470912=_0x470912||0xcc;return function(_0x1312e0){if(_0x1312e0){return _0x3fa991[_0xe3ea('0x1a')](_0x470912);}return _0x3fa991[_0xe3ea('0x1b')](_0x470912)['end']();};}function respondWithResult(_0x544dfe,_0x1701d3){_0x1701d3=_0x1701d3||0xc8;return function(_0x335689){if(_0x335689){return _0x544dfe[_0xe3ea('0x1b')](_0x1701d3)[_0xe3ea('0x1c')](_0x335689);}};}function respondWithFilteredResult(_0x45ba02,_0x4ac0ea){return function(_0x4c92b2){if(_0x4c92b2){var _0x27885e=typeof _0x4ac0ea[_0xe3ea('0x1d')]==='undefined'&&typeof _0x4ac0ea[_0xe3ea('0x1e')]===_0xe3ea('0x1f');var _0x4af35e=_0x4c92b2['count'];var _0x2af916=_0x27885e?0x0:_0x4ac0ea[_0xe3ea('0x1d')];var _0x417b88=_0x27885e?_0x4c92b2[_0xe3ea('0x20')]:_0x4ac0ea[_0xe3ea('0x1d')]+_0x4ac0ea[_0xe3ea('0x1e')];var _0x4d611a;if(_0x417b88>=_0x4af35e){_0x417b88=_0x4af35e;_0x4d611a=0xc8;}else{_0x4d611a=0xce;}_0x45ba02['status'](_0x4d611a);return _0x45ba02[_0xe3ea('0x21')]('Content-Range',_0x2af916+'-'+_0x417b88+'/'+_0x4af35e)['json'](_0x4c92b2);}return null;};}function patchUpdates(_0xcbb4db){return function(_0xe8e88){try{jsonpatch[_0xe3ea('0x22')](_0xe8e88,_0xcbb4db,!![]);}catch(_0x181720){return BPromise[_0xe3ea('0x23')](_0x181720);}return _0xe8e88[_0xe3ea('0x24')]();};}function saveUpdates(_0x161c0e,_0x2f763b){return function(_0x342192){if(_0x342192){return _0x342192[_0xe3ea('0x25')](_0x161c0e)[_0xe3ea('0x26')](function(_0x37be78){return _0x37be78;});}return null;};}function removeEntity(_0x196fac,_0x580da3){return function(_0x3f728c){if(_0x3f728c){return _0x3f728c[_0xe3ea('0x27')]()[_0xe3ea('0x26')](function(){var _0x21082d=_0x3f728c[_0xe3ea('0x28')]({'plain':!![]});var _0x3c7131=_0xe3ea('0x29');return db['UserProfileResource'][_0xe3ea('0x27')]({'where':{'type':_0x3c7131,'resourceId':_0x21082d['id']}})[_0xe3ea('0x26')](function(){return _0x3f728c;});})['then'](function(){_0x196fac[_0xe3ea('0x1b')](0xcc)[_0xe3ea('0x2a')]();});}};}function handleEntityNotFound(_0x218dcb,_0x30c2be){return function(_0x54bc71){if(!_0x54bc71){_0x218dcb['sendStatus'](0x194);}return _0x54bc71;};}function handleError(_0x3e9c65,_0x4df0aa){_0x4df0aa=_0x4df0aa||0x1f4;return function(_0x3032b1){logger[_0xe3ea('0x2b')](_0x3032b1[_0xe3ea('0x2c')]);if(_0x3032b1['name']){delete _0x3032b1[_0xe3ea('0x2d')];}_0x3e9c65['status'](_0x4df0aa)[_0xe3ea('0x2e')](_0x3032b1);};}exports[_0xe3ea('0x2f')]=function(_0x45a01b,_0x530948){var _0x451cfe={},_0x56be4a={},_0x264e44={'count':0x0,'rows':[]};var _0x1f4685=_[_0xe3ea('0x30')](db[_0xe3ea('0x31')]['rawAttributes'],function(_0x4bf1fa){return{'name':_0x4bf1fa[_0xe3ea('0x32')],'type':_0x4bf1fa[_0xe3ea('0x33')][_0xe3ea('0x34')]};});_0x56be4a[_0xe3ea('0x35')]=_[_0xe3ea('0x30')](_0x1f4685,'name');_0x56be4a[_0xe3ea('0x36')]=_['keys'](_0x45a01b['query']);_0x56be4a[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x56be4a['model'],_0x56be4a['query']);_0x451cfe[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x56be4a[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x45a01b[_0xe3ea('0x36')][_0xe3ea('0x3a')]));_0x451cfe['attributes']=_0x451cfe[_0xe3ea('0x39')][_0xe3ea('0x3b')]?_0x451cfe[_0xe3ea('0x39')]:_0x56be4a[_0xe3ea('0x35')];if(!_0x45a01b[_0xe3ea('0x36')][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x451cfe[_0xe3ea('0x1e')]=qs[_0xe3ea('0x1e')](_0x45a01b[_0xe3ea('0x36')][_0xe3ea('0x1e')]);_0x451cfe[_0xe3ea('0x1d')]=qs[_0xe3ea('0x1d')](_0x45a01b[_0xe3ea('0x36')]['offset']);}_0x451cfe['order']=qs[_0xe3ea('0x3e')](_0x45a01b[_0xe3ea('0x36')][_0xe3ea('0x3e')]);_0x451cfe['where']=qs[_0xe3ea('0x37')](_[_0xe3ea('0x3f')](_0x45a01b[_0xe3ea('0x36')],_0x56be4a[_0xe3ea('0x37')]),_0x1f4685);if(_0x45a01b[_0xe3ea('0x36')]['filter']){_0x451cfe[_0xe3ea('0x40')]=_['merge'](_0x451cfe['where'],{'$or':_[_0xe3ea('0x30')](_0x1f4685,function(_0xc675ce){if(_0xc675ce[_0xe3ea('0x33')]!==_0xe3ea('0x41')){var _0x235a64={};_0x235a64[_0xc675ce[_0xe3ea('0x2d')]]={'$like':'%'+_0x45a01b[_0xe3ea('0x36')][_0xe3ea('0x42')]+'%'};return _0x235a64;}})});}_0x451cfe=_['merge']({},_0x451cfe,_0x45a01b['options']);var _0x2f5533={'where':_0x451cfe[_0xe3ea('0x40')]};return db[_0xe3ea('0x31')]['count'](_0x2f5533)[_0xe3ea('0x26')](function(_0x58df4e){_0x264e44[_0xe3ea('0x20')]=_0x58df4e;if(_0x45a01b[_0xe3ea('0x36')]['includeAll']){_0x451cfe['include']=[{'all':!![]}];}return db[_0xe3ea('0x31')][_0xe3ea('0x43')](_0x451cfe);})[_0xe3ea('0x26')](function(_0x5d18ec){_0x264e44[_0xe3ea('0x44')]=_0x5d18ec;return _0x264e44;})['then'](respondWithFilteredResult(_0x530948,_0x451cfe))[_0xe3ea('0x45')](handleError(_0x530948,null));};exports[_0xe3ea('0x46')]=function(_0x4c3f20,_0x34fd9c){var _0x536d73={'raw':![],'where':{'id':_0x4c3f20[_0xe3ea('0x47')]['id']}},_0x4fa668={};_0x4fa668[_0xe3ea('0x35')]=_[_0xe3ea('0x48')](db[_0xe3ea('0x31')][_0xe3ea('0x49')]);_0x4fa668[_0xe3ea('0x36')]=_[_0xe3ea('0x48')](_0x4c3f20['query']);_0x4fa668[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x4fa668['model'],_0x4fa668[_0xe3ea('0x36')]);_0x536d73[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x4fa668[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x4c3f20['query'][_0xe3ea('0x3a')]));_0x536d73[_0xe3ea('0x39')]=_0x536d73[_0xe3ea('0x39')]['length']?_0x536d73['attributes']:_0x4fa668['model'];if(_0x4c3f20[_0xe3ea('0x36')][_0xe3ea('0x4a')]){_0x536d73['include']=[{'all':!![]}];}_0x536d73=_[_0xe3ea('0x4b')]({},_0x536d73,_0x4c3f20[_0xe3ea('0x4c')]);return db[_0xe3ea('0x31')][_0xe3ea('0x4d')](_0x536d73)[_0xe3ea('0x26')](handleEntityNotFound(_0x34fd9c,null))[_0xe3ea('0x26')](respondWithResult(_0x34fd9c,null))['catch'](handleError(_0x34fd9c,null));};exports[_0xe3ea('0x4e')]=function(_0x4d71a9,_0x3b9e62){return db['Campaign'][_0xe3ea('0x4e')](_0x4d71a9[_0xe3ea('0x4f')],{})['then'](function(_0xb69b73){var _0x3263ea=_0x4d71a9[_0xe3ea('0x50')][_0xe3ea('0x28')]({'plain':!![]});if(!_0x3263ea)throw new Error(_0xe3ea('0x51'));if(_0x3263ea[_0xe3ea('0x52')]===_0xe3ea('0x50')){var _0x41c1a7=_0xb69b73[_0xe3ea('0x28')]({'plain':!![]});var _0x4008e6=_0xe3ea('0x29');return db[_0xe3ea('0x53')][_0xe3ea('0x4d')]({'where':{'name':_0x4008e6,'userProfileId':_0x3263ea['userProfileId']},'raw':!![]})[_0xe3ea('0x26')](function(_0x348939){if(_0x348939&&_0x348939['autoAssociation']===0x0){return db[_0xe3ea('0x54')][_0xe3ea('0x4e')]({'name':_0x41c1a7[_0xe3ea('0x2d')],'resourceId':_0x41c1a7['id'],'type':_0x348939[_0xe3ea('0x2d')],'sectionId':_0x348939['id']},{})[_0xe3ea('0x26')](function(){return _0xb69b73;});}else{return _0xb69b73;}})[_0xe3ea('0x45')](function(_0x2a39fa){logger['error'](_0xe3ea('0x55'),_0x2a39fa);throw _0x2a39fa;});}return _0xb69b73;})[_0xe3ea('0x26')](respondWithResult(_0x3b9e62,0xc9))[_0xe3ea('0x45')](handleError(_0x3b9e62,null));};exports[_0xe3ea('0x56')]=function(_0x3ff403,_0x11cef2){var _0x29b170={'where':{'id':_0x3ff403[_0xe3ea('0x47')]['id']}},_0x3742ab={};_0x3742ab['model']=_['keys'](db[_0xe3ea('0x31')][_0xe3ea('0x49')]);_0x29b170[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x3742ab[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x3ff403[_0xe3ea('0x36')][_0xe3ea('0x3a')]));_0x29b170[_0xe3ea('0x39')]=_0x29b170['attributes'][_0xe3ea('0x3b')]?_0x29b170[_0xe3ea('0x39')]:_0x3742ab[_0xe3ea('0x35')];if(_0x3ff403['query'][_0xe3ea('0x4a')]){_0x29b170[_0xe3ea('0x57')]=[{'all':!![]}];}_0x29b170=_['merge']({},_0x29b170,_0x3ff403[_0xe3ea('0x4c')]);return db[_0xe3ea('0x31')][_0xe3ea('0x4d')](_0x29b170)[_0xe3ea('0x26')](handleEntityNotFound(_0x11cef2,null))['then'](function(_0xf41294){if(_0xf41294){var _0x21240c=_0xf41294[_0xe3ea('0x28')]({'plain':!![]});_0x21240c=qs[_0xe3ea('0x58')](_0x21240c,['id','createdAt','updatedAt']);_0x3ff403[_0xe3ea('0x4f')]=_[_0xe3ea('0x58')](_0x3ff403[_0xe3ea('0x4f')],['id',_0xe3ea('0x59'),_0xe3ea('0x5a')]);return db[_0xe3ea('0x31')][_0xe3ea('0x4e')](_['merge'](_0x21240c,_0x3ff403['body']),{'include':_0x3ff403[_0xe3ea('0x36')][_0xe3ea('0x4a')]?[{'all':!![]}]:undefined})[_0xe3ea('0x26')](function(_0x28121f){var _0x5abbd9=_0x3ff403[_0xe3ea('0x50')][_0xe3ea('0x28')]({'plain':!![]});if(!_0x5abbd9)throw new Error(_0xe3ea('0x51'));if(_0x5abbd9['role']===_0xe3ea('0x50')){var _0x1e9f1e=_0x28121f['get']({'plain':!![]});var _0x4df5ac='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x4df5ac,'userProfileId':_0x5abbd9[_0xe3ea('0x5b')]},'raw':!![]})[_0xe3ea('0x26')](function(_0x3d14be){if(_0x3d14be&&_0x3d14be[_0xe3ea('0x5c')]===0x0){return db[_0xe3ea('0x54')]['create']({'name':_0x1e9f1e[_0xe3ea('0x2d')],'resourceId':_0x1e9f1e['id'],'type':_0x3d14be['name'],'sectionId':_0x3d14be['id']},{})[_0xe3ea('0x26')](function(){return _0x28121f;});}else{return _0x28121f;}})[_0xe3ea('0x45')](function(_0x53dd48){logger[_0xe3ea('0x2b')](_0xe3ea('0x55'),_0x53dd48);throw _0x53dd48;});}return _0x28121f;});}})['then'](respondWithResult(_0x11cef2,0xc9))[_0xe3ea('0x45')](handleError(_0x11cef2,null));};exports[_0xe3ea('0x25')]=function(_0x3179e4,_0x5a7222){if(_0x3179e4[_0xe3ea('0x4f')]['id']){delete _0x3179e4[_0xe3ea('0x4f')]['id'];}return db[_0xe3ea('0x31')][_0xe3ea('0x4d')]({'where':{'id':_0x3179e4[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x5a7222,null))[_0xe3ea('0x26')](saveUpdates(_0x3179e4[_0xe3ea('0x4f')],null))[_0xe3ea('0x26')](respondWithResult(_0x5a7222,null))[_0xe3ea('0x45')](handleError(_0x5a7222,null));};exports['destroy']=function(_0x33d7f8,_0x137ade){return db[_0xe3ea('0x31')][_0xe3ea('0x4d')]({'where':{'id':_0x33d7f8[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x137ade,null))[_0xe3ea('0x26')](removeEntity(_0x137ade,null))[_0xe3ea('0x45')](handleError(_0x137ade,null));};exports[_0xe3ea('0x5d')]=function(_0x30d733,_0x4a7882,_0x372ff5){var _0x3007a5={'raw':!![],'where':{}};var _0x4cb1c3={};var _0x4b9b1a={'count':0x0,'rows':[]};return db[_0xe3ea('0x31')][_0xe3ea('0x5e')]({'where':{'id':_0x30d733[_0xe3ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a7882,null))[_0xe3ea('0x26')](function(_0x460cd3){if(_0x460cd3){_0x4cb1c3[_0xe3ea('0x35')]=_['keys'](db[_0xe3ea('0x5f')][_0xe3ea('0x49')]);_0x4cb1c3['query']=_['keys'](_0x30d733[_0xe3ea('0x36')]);_0x4cb1c3[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x4cb1c3[_0xe3ea('0x35')],_0x4cb1c3[_0xe3ea('0x36')]);_0x3007a5[_0xe3ea('0x39')]=_['intersection'](_0x4cb1c3['model'],qs[_0xe3ea('0x3a')](_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x3a')]));_0x3007a5[_0xe3ea('0x39')]=_0x3007a5[_0xe3ea('0x39')][_0xe3ea('0x3b')]?_0x3007a5[_0xe3ea('0x39')]:_0x4cb1c3[_0xe3ea('0x35')];if(!_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x3007a5[_0xe3ea('0x1e')]=qs[_0xe3ea('0x1e')](_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x1e')]);_0x3007a5[_0xe3ea('0x1d')]=qs[_0xe3ea('0x1d')](_0x30d733['query'][_0xe3ea('0x1d')]);}_0x3007a5[_0xe3ea('0x60')]=qs[_0xe3ea('0x3e')](_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x3e')]);_0x3007a5[_0xe3ea('0x40')]=qs[_0xe3ea('0x37')](_['pick'](_0x30d733['query'],_0x4cb1c3[_0xe3ea('0x37')]));_0x3007a5[_0xe3ea('0x40')]['CampaignId']=_0x460cd3['id'];if(_0x30d733['query'][_0xe3ea('0x42')]){_0x3007a5[_0xe3ea('0x40')]=_['merge'](_0x3007a5['where'],{'$or':_['map'](_0x3007a5[_0xe3ea('0x39')],function(_0x3cabcb){var _0x4ccee8={};_0x4ccee8[_0x3cabcb]={'$like':'%'+_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x42')]+'%'};return _0x4ccee8;})});}_0x3007a5=_[_0xe3ea('0x4b')]({},_0x3007a5,_0x30d733['options']);return db[_0xe3ea('0x5f')][_0xe3ea('0x20')]({'where':_0x3007a5[_0xe3ea('0x40')]})['then'](function(_0x506491){_0x4b9b1a[_0xe3ea('0x20')]=_0x506491;if(_0x30d733[_0xe3ea('0x36')][_0xe3ea('0x4a')]){_0x3007a5['include']=[{'all':!![]}];}return db[_0xe3ea('0x5f')][_0xe3ea('0x43')](_0x3007a5);})[_0xe3ea('0x26')](function(_0x49143d){_0x4b9b1a['rows']=_0x49143d;return _0x4b9b1a;});}})[_0xe3ea('0x26')](respondWithFilteredResult(_0x4a7882,_0x3007a5))[_0xe3ea('0x45')](handleError(_0x4a7882,null));};exports['getHopperHistories']=function(_0x35f1fe,_0x1c2c03,_0x30ab5b){var _0x1967c3={'raw':!![],'where':{}};var _0x39280c={};var _0x38117c={'count':0x0,'rows':[]};return db['Campaign'][_0xe3ea('0x5e')]({'where':{'id':_0x35f1fe[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x1c2c03,null))[_0xe3ea('0x26')](function(_0x4db7ae){if(_0x4db7ae){_0x39280c['model']=_['keys'](db[_0xe3ea('0x61')][_0xe3ea('0x49')]);_0x39280c['query']=_[_0xe3ea('0x48')](_0x35f1fe[_0xe3ea('0x36')]);_0x39280c['filters']=_[_0xe3ea('0x38')](_0x39280c[_0xe3ea('0x35')],_0x39280c[_0xe3ea('0x36')]);_0x1967c3[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x39280c['model'],qs[_0xe3ea('0x3a')](_0x35f1fe['query'][_0xe3ea('0x3a')]));_0x1967c3[_0xe3ea('0x39')]=_0x1967c3[_0xe3ea('0x39')][_0xe3ea('0x3b')]?_0x1967c3[_0xe3ea('0x39')]:_0x39280c[_0xe3ea('0x35')];if(!_0x35f1fe['query'][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x1967c3[_0xe3ea('0x1e')]=qs[_0xe3ea('0x1e')](_0x35f1fe[_0xe3ea('0x36')]['limit']);_0x1967c3[_0xe3ea('0x1d')]=qs[_0xe3ea('0x1d')](_0x35f1fe[_0xe3ea('0x36')][_0xe3ea('0x1d')]);}_0x1967c3[_0xe3ea('0x60')]=qs[_0xe3ea('0x3e')](_0x35f1fe[_0xe3ea('0x36')][_0xe3ea('0x3e')]);_0x1967c3[_0xe3ea('0x40')]=qs[_0xe3ea('0x37')](_[_0xe3ea('0x3f')](_0x35f1fe[_0xe3ea('0x36')],_0x39280c['filters']));_0x1967c3['where'][_0xe3ea('0x62')]=_0x4db7ae['id'];if(_0x35f1fe[_0xe3ea('0x36')][_0xe3ea('0x42')]){_0x1967c3[_0xe3ea('0x40')]=_[_0xe3ea('0x4b')](_0x1967c3[_0xe3ea('0x40')],{'$or':_['map'](_0x1967c3[_0xe3ea('0x39')],function(_0x436b03){var _0x9c714e={};_0x9c714e[_0x436b03]={'$like':'%'+_0x35f1fe['query']['filter']+'%'};return _0x9c714e;})});}_0x1967c3=_['merge']({},_0x1967c3,_0x35f1fe[_0xe3ea('0x4c')]);return db[_0xe3ea('0x61')][_0xe3ea('0x20')]({'where':_0x1967c3[_0xe3ea('0x40')]})[_0xe3ea('0x26')](function(_0x543de9){_0x38117c['count']=_0x543de9;if(_0x35f1fe[_0xe3ea('0x36')][_0xe3ea('0x4a')]){_0x1967c3[_0xe3ea('0x57')]=[{'all':!![]}];}return db[_0xe3ea('0x61')][_0xe3ea('0x43')](_0x1967c3);})[_0xe3ea('0x26')](function(_0x321baf){_0x38117c['rows']=_0x321baf;return _0x38117c;});}})[_0xe3ea('0x26')](respondWithFilteredResult(_0x1c2c03,_0x1967c3))[_0xe3ea('0x45')](handleError(_0x1c2c03,null));};exports[_0xe3ea('0x63')]=function(_0x4d3930,_0x564260,_0x46a6b7){var _0x2cd60d={'raw':!![],'where':{}};var _0xbcb4aa={};var _0x18a22e={'count':0x0,'rows':[]};return db['Campaign'][_0xe3ea('0x5e')]({'where':{'id':_0x4d3930['params']['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x564260,null))[_0xe3ea('0x26')](function(_0x61e7e3){if(_0x61e7e3){_0xbcb4aa[_0xe3ea('0x35')]=_[_0xe3ea('0x48')](db['CmHopperFinal'][_0xe3ea('0x49')]);_0xbcb4aa[_0xe3ea('0x36')]=_['keys'](_0x4d3930['query']);_0xbcb4aa[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0xbcb4aa[_0xe3ea('0x35')],_0xbcb4aa[_0xe3ea('0x36')]);_0x2cd60d[_0xe3ea('0x39')]=_['intersection'](_0xbcb4aa[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x4d3930[_0xe3ea('0x36')]['fields']));_0x2cd60d[_0xe3ea('0x39')]=_0x2cd60d[_0xe3ea('0x39')][_0xe3ea('0x3b')]?_0x2cd60d['attributes']:_0xbcb4aa[_0xe3ea('0x35')];if(!_0x4d3930[_0xe3ea('0x36')][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x2cd60d[_0xe3ea('0x1e')]=qs[_0xe3ea('0x1e')](_0x4d3930[_0xe3ea('0x36')][_0xe3ea('0x1e')]);_0x2cd60d['offset']=qs['offset'](_0x4d3930[_0xe3ea('0x36')][_0xe3ea('0x1d')]);}_0x2cd60d[_0xe3ea('0x60')]=qs[_0xe3ea('0x3e')](_0x4d3930[_0xe3ea('0x36')][_0xe3ea('0x3e')]);_0x2cd60d['where']=qs[_0xe3ea('0x37')](_[_0xe3ea('0x3f')](_0x4d3930[_0xe3ea('0x36')],_0xbcb4aa[_0xe3ea('0x37')]));_0x2cd60d[_0xe3ea('0x40')][_0xe3ea('0x62')]=_0x61e7e3['id'];if(_0x4d3930[_0xe3ea('0x36')]['filter']){_0x2cd60d[_0xe3ea('0x40')]=_['merge'](_0x2cd60d[_0xe3ea('0x40')],{'$or':_[_0xe3ea('0x30')](_0x2cd60d[_0xe3ea('0x39')],function(_0x3883a3){var _0xe5b3b1={};_0xe5b3b1[_0x3883a3]={'$like':'%'+_0x4d3930[_0xe3ea('0x36')][_0xe3ea('0x42')]+'%'};return _0xe5b3b1;})});}_0x2cd60d=_[_0xe3ea('0x4b')]({},_0x2cd60d,_0x4d3930['options']);return db[_0xe3ea('0x64')][_0xe3ea('0x20')]({'where':_0x2cd60d[_0xe3ea('0x40')]})[_0xe3ea('0x26')](function(_0x558bc6){_0x18a22e[_0xe3ea('0x20')]=_0x558bc6;if(_0x4d3930['query']['includeAll']){_0x2cd60d['include']=[{'all':!![]}];}return db[_0xe3ea('0x64')]['findAll'](_0x2cd60d);})[_0xe3ea('0x26')](function(_0x16682e){_0x18a22e[_0xe3ea('0x44')]=_0x16682e;return _0x18a22e;});}})[_0xe3ea('0x26')](respondWithFilteredResult(_0x564260,_0x2cd60d))['catch'](handleError(_0x564260,null));};exports['getHopperBlacks']=function(_0x20f5d4,_0x40ed34,_0x2fbf5b){var _0x387ee0={'raw':!![],'where':{}};var _0x209619={};var _0x533b7a={'count':0x0,'rows':[]};return db[_0xe3ea('0x31')][_0xe3ea('0x5e')]({'where':{'id':_0x20f5d4['params']['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x40ed34,null))[_0xe3ea('0x26')](function(_0x58abe9){if(_0x58abe9){_0x209619[_0xe3ea('0x35')]=_[_0xe3ea('0x48')](db[_0xe3ea('0x65')]['rawAttributes']);_0x209619[_0xe3ea('0x36')]=_[_0xe3ea('0x48')](_0x20f5d4[_0xe3ea('0x36')]);_0x209619[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x209619[_0xe3ea('0x35')],_0x209619['query']);_0x387ee0[_0xe3ea('0x39')]=_['intersection'](_0x209619['model'],qs[_0xe3ea('0x3a')](_0x20f5d4[_0xe3ea('0x36')]['fields']));_0x387ee0[_0xe3ea('0x39')]=_0x387ee0['attributes']['length']?_0x387ee0[_0xe3ea('0x39')]:_0x209619[_0xe3ea('0x35')];if(!_0x20f5d4[_0xe3ea('0x36')][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x387ee0[_0xe3ea('0x1e')]=qs['limit'](_0x20f5d4[_0xe3ea('0x36')]['limit']);_0x387ee0['offset']=qs[_0xe3ea('0x1d')](_0x20f5d4[_0xe3ea('0x36')]['offset']);}_0x387ee0[_0xe3ea('0x60')]=qs[_0xe3ea('0x3e')](_0x20f5d4[_0xe3ea('0x36')][_0xe3ea('0x3e')]);_0x387ee0[_0xe3ea('0x40')]=qs[_0xe3ea('0x37')](_[_0xe3ea('0x3f')](_0x20f5d4[_0xe3ea('0x36')],_0x209619[_0xe3ea('0x37')]));_0x387ee0['where'][_0xe3ea('0x62')]=_0x58abe9['id'];if(_0x20f5d4[_0xe3ea('0x36')][_0xe3ea('0x42')]){_0x387ee0['where']=_[_0xe3ea('0x4b')](_0x387ee0[_0xe3ea('0x40')],{'$or':_[_0xe3ea('0x30')](_0x387ee0['attributes'],function(_0x1c1beb){var _0x1ca25a={};_0x1ca25a[_0x1c1beb]={'$like':'%'+_0x20f5d4['query'][_0xe3ea('0x42')]+'%'};return _0x1ca25a;})});}_0x387ee0=_[_0xe3ea('0x4b')]({},_0x387ee0,_0x20f5d4[_0xe3ea('0x4c')]);return db[_0xe3ea('0x65')][_0xe3ea('0x20')]({'where':_0x387ee0[_0xe3ea('0x40')]})[_0xe3ea('0x26')](function(_0x1593d6){_0x533b7a[_0xe3ea('0x20')]=_0x1593d6;if(_0x20f5d4['query'][_0xe3ea('0x4a')]){_0x387ee0[_0xe3ea('0x57')]=[{'all':!![]}];}return db[_0xe3ea('0x65')]['findAll'](_0x387ee0);})[_0xe3ea('0x26')](function(_0x282704){_0x533b7a['rows']=_0x282704;return _0x533b7a;});}})['then'](respondWithFilteredResult(_0x40ed34,_0x387ee0))[_0xe3ea('0x45')](handleError(_0x40ed34,null));};exports['getLists']=function(_0x39caa1,_0x12c535,_0x3a5714){var _0xc35d6b={};var _0x57dd4f={};var _0x51d77d;var _0x290da5;return db['Campaign']['findOne']({'where':{'id':_0x39caa1[_0xe3ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x12c535,null))['then'](function(_0x48cf3c){if(_0x48cf3c){_0x51d77d=_0x48cf3c;_0x57dd4f[_0xe3ea('0x35')]=_[_0xe3ea('0x48')](db['CmList'][_0xe3ea('0x49')]);_0x57dd4f[_0xe3ea('0x36')]=_[_0xe3ea('0x48')](_0x39caa1[_0xe3ea('0x36')]);_0x57dd4f['filters']=_[_0xe3ea('0x38')](_0x57dd4f[_0xe3ea('0x35')],_0x57dd4f['query']);_0xc35d6b['attributes']=_[_0xe3ea('0x38')](_0x57dd4f[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x3a')]));_0xc35d6b[_0xe3ea('0x39')]=_0xc35d6b['attributes'][_0xe3ea('0x3b')]?_0xc35d6b['attributes']:_0x57dd4f[_0xe3ea('0x35')];_0xc35d6b[_0xe3ea('0x60')]=qs[_0xe3ea('0x3e')](_0x39caa1['query'][_0xe3ea('0x3e')]);_0xc35d6b[_0xe3ea('0x40')]=qs[_0xe3ea('0x37')](_[_0xe3ea('0x3f')](_0x39caa1[_0xe3ea('0x36')],_0x57dd4f[_0xe3ea('0x37')]));if(_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x42')]){_0xc35d6b[_0xe3ea('0x40')]=_[_0xe3ea('0x4b')](_0xc35d6b['where'],{'$or':_[_0xe3ea('0x30')](_0xc35d6b[_0xe3ea('0x39')],function(_0x2e879d){var _0x4ccb19={};_0x4ccb19[_0x2e879d]={'$like':'%'+_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x42')]+'%'};return _0x4ccb19;})});}_0xc35d6b=_[_0xe3ea('0x4b')]({},_0xc35d6b,_0x39caa1[_0xe3ea('0x4c')]);return _0x51d77d[_0xe3ea('0x66')](_0xc35d6b);}})[_0xe3ea('0x26')](function(_0x1055bf){if(_0x1055bf){_0x290da5=_0x1055bf['length'];if(!_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0xc35d6b['limit']=qs['limit'](_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x1e')]);_0xc35d6b[_0xe3ea('0x1d')]=qs[_0xe3ea('0x1d')](_0x39caa1[_0xe3ea('0x36')][_0xe3ea('0x1d')]);}return _0x51d77d[_0xe3ea('0x66')](_0xc35d6b);}})[_0xe3ea('0x26')](function(_0x58fe2a){if(_0x58fe2a){return _0x58fe2a?{'count':_0x290da5,'rows':_0x58fe2a}:null;}})[_0xe3ea('0x26')](respondWithResult(_0x12c535,null))['catch'](handleError(_0x12c535,null));};exports[_0xe3ea('0x67')]=function(_0x3133d6,_0x598f7f,_0x17e1dd){var _0x1111c2,_0xed7ad6;var _0x59608d=[];var _0x12ebfa=moment()[_0xe3ea('0x68')](_0xe3ea('0x69'));return db['Campaign'][_0xe3ea('0x4d')]({'where':{'id':_0x3133d6[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x598f7f,null))[_0xe3ea('0x26')](function(_0xe64320){if(_0xe64320){_0xed7ad6=_0xe64320;return _0xe64320['addLists'](_0x3133d6[_0xe3ea('0x4f')][_0xe3ea('0x6a')],_[_0xe3ea('0x58')](_0x3133d6[_0xe3ea('0x4f')],[_0xe3ea('0x6a'),'id'])||{});}return null;})['spread'](function(_0x85858f){var _0x2f7b94;var _0x56dd91;_0x1111c2=_0x85858f||[];var _0x23da49=[];if(_0x85858f){for(var _0xbf2267=0x0;_0xbf2267<_0x85858f['length'];_0xbf2267+=0x1){var _0x15fc1b=_0x85858f[_0xbf2267]['get']({'plain':!![]});_0xed7ad6[_0xe3ea('0x6b')]=_0x3133d6[_0xe3ea('0x4f')]['dialCheckDuplicateType']?_0x3133d6[_0xe3ea('0x4f')][_0xe3ea('0x6b')]:_0xed7ad6[_0xe3ea('0x6b')];switch(_0xed7ad6[_0xe3ea('0x6b')]){case _0xe3ea('0x6c'):_0x2f7b94=squel['insert']()[_0xe3ea('0x6d')]('cm_hopper')[_0xe3ea('0x6e')]([_0xe3ea('0x6f'),_0xe3ea('0x70'),_0xe3ea('0x71'),_0xe3ea('0x72'),_0xe3ea('0x62'),'createdAt',_0xe3ea('0x5a')],squel[_0xe3ea('0x73')]()[_0xe3ea('0x74')](_0xe3ea('0x6f'),'phone')[_0xe3ea('0x74')](_0xe3ea('0x75'),_0xe3ea('0x70'))[_0xe3ea('0x74')]('id','ContactId')[_0xe3ea('0x74')](_0x15fc1b[_0xe3ea('0x76')]['toString'](),_0xe3ea('0x72'))[_0xe3ea('0x74')](_0x3133d6['params']['id'][_0xe3ea('0x77')](),_0xe3ea('0x62'))[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x59'))[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x5a'))[_0xe3ea('0x78')](_0xe3ea('0x79'))[_0xe3ea('0x40')](_0xe3ea('0x7a'))[_0xe3ea('0x40')](_0xe3ea('0x7b'),_0x15fc1b['CmListId'][_0xe3ea('0x77')]())['where'](_0xe3ea('0x7c'))[_0xe3ea('0x40')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe3ea('0x74')]('COALESCE(calleridnum,\x27\x27)')[_0xe3ea('0x78')](_0xe3ea('0x7d'))[_0xe3ea('0x40')](_0xe3ea('0x7e'),_0x3133d6[_0xe3ea('0x47')]['id']['toString']()))['where'](_0xe3ea('0x7f'),squel[_0xe3ea('0x73')]()[_0xe3ea('0x74')](_0xe3ea('0x80'))[_0xe3ea('0x78')](_0xe3ea('0x81'))[_0xe3ea('0x40')]('CampaignId\x20=\x20?',_0x3133d6[_0xe3ea('0x47')]['id']['toString']())))[_0xe3ea('0x77')]();break;case _0xe3ea('0x82'):_0x2f7b94=squel[_0xe3ea('0x83')]()[_0xe3ea('0x6d')](_0xe3ea('0x81'))[_0xe3ea('0x6e')]([_0xe3ea('0x6f'),'scheduledAt','ContactId',_0xe3ea('0x72'),_0xe3ea('0x62'),_0xe3ea('0x59'),_0xe3ea('0x5a')],squel[_0xe3ea('0x73')]()[_0xe3ea('0x74')](_0xe3ea('0x6f'),_0xe3ea('0x6f'))[_0xe3ea('0x74')]('NOW()',_0xe3ea('0x70'))[_0xe3ea('0x74')]('id','ContactId')[_0xe3ea('0x74')](_0x15fc1b['CmListId'][_0xe3ea('0x77')](),_0xe3ea('0x72'))[_0xe3ea('0x74')](_0x3133d6[_0xe3ea('0x47')]['id'][_0xe3ea('0x77')](),'CampaignId')[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x59'))[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x5a'))['from'](_0xe3ea('0x79'))['where'](_0xe3ea('0x7a'))[_0xe3ea('0x40')]('ListId\x20=\x20?',_0x15fc1b[_0xe3ea('0x76')][_0xe3ea('0x77')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe3ea('0x40')](_0xe3ea('0x7f'),squel[_0xe3ea('0x73')]()[_0xe3ea('0x74')](_0xe3ea('0x80'))[_0xe3ea('0x78')](_0xe3ea('0x81'))[_0xe3ea('0x40')](_0xe3ea('0x7e'),_0x3133d6[_0xe3ea('0x47')]['id'][_0xe3ea('0x77')]())))[_0xe3ea('0x77')]();break;default:_0x2f7b94=squel[_0xe3ea('0x83')]()[_0xe3ea('0x6d')](_0xe3ea('0x81'))['fromQuery']([_0xe3ea('0x6f'),_0xe3ea('0x70'),_0xe3ea('0x71'),_0xe3ea('0x72'),_0xe3ea('0x62'),_0xe3ea('0x59'),'updatedAt'],squel['select']()[_0xe3ea('0x74')](_0xe3ea('0x6f'),_0xe3ea('0x6f'))[_0xe3ea('0x74')]('NOW()','scheduledAt')['field']('id',_0xe3ea('0x71'))['field'](_0x15fc1b[_0xe3ea('0x76')][_0xe3ea('0x77')](),_0xe3ea('0x72'))[_0xe3ea('0x74')](_0x3133d6[_0xe3ea('0x47')]['id']['toString'](),'CampaignId')[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x59'))[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x5a'))['from'](_0xe3ea('0x79'))[_0xe3ea('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0xe3ea('0x7b'),_0x15fc1b['CmListId'][_0xe3ea('0x77')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xe3ea('0x77')]();}_0x56dd91=squel[_0xe3ea('0x83')]()[_0xe3ea('0x6d')](_0xe3ea('0x84'))[_0xe3ea('0x6e')]([_0xe3ea('0x85'),_0xe3ea('0x70'),'phone',_0xe3ea('0x86'),_0xe3ea('0x59'),_0xe3ea('0x5a')],squel['select']()['field'](_0xe3ea('0x87'),'id')[_0xe3ea('0x74')](_0xe3ea('0x75'),_0xe3ea('0x70'))[_0xe3ea('0x74')](_0xe3ea('0x88'),_0xe3ea('0x6f'))['field']('ci.OrderBY','OrderBy')[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27','createdAt')[_0xe3ea('0x74')]('\x27'+_0x12ebfa+'\x27',_0xe3ea('0x5a'))[_0xe3ea('0x78')]('cm_contact_has_items','ci')[_0xe3ea('0x89')](_0xe3ea('0x81'),'h',_0xe3ea('0x8a'))['where'](_0xe3ea('0x8b'),_0x15fc1b[_0xe3ea('0x76')][_0xe3ea('0x77')]())[_0xe3ea('0x40')](_0xe3ea('0x8c'),_0x3133d6[_0xe3ea('0x47')]['id']['toString']())['where'](_0xe3ea('0x8d'),_0x12ebfa))[_0xe3ea('0x77')]();_0x23da49[_0xe3ea('0x8e')](db[_0xe3ea('0x8f')][_0xe3ea('0x36')](_0x2f7b94));_0x59608d[_0xe3ea('0x8e')](db[_0xe3ea('0x8f')][_0xe3ea('0x36')](_0x56dd91));}return BPromise['all'](_0x23da49);}})[_0xe3ea('0x26')](function(){return BPromise['all'](_0x59608d);})['then'](function(){return _0x1111c2;})[_0xe3ea('0x26')](respondWithResult(_0x598f7f,null))[_0xe3ea('0x45')](handleError(_0x598f7f,null));};exports['removeLists']=function(_0xae0b7b,_0x45baef,_0x3cc76d){return db[_0xe3ea('0x31')][_0xe3ea('0x4d')]({'where':{'id':_0xae0b7b[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x45baef,null))[_0xe3ea('0x26')](function(_0x49ca06){if(_0x49ca06){return _0x49ca06[_0xe3ea('0x90')](_0xae0b7b['query']['ids']);}})[_0xe3ea('0x26')](function(_0x4540ac){if(_0x4540ac){return db[_0xe3ea('0x5f')][_0xe3ea('0x27')]({'where':{'ListId':_0xae0b7b[_0xe3ea('0x36')][_0xe3ea('0x6a')],'CampaignId':_0xae0b7b[_0xe3ea('0x47')]['id']}})['then'](function(){return _0x4540ac;});}})['then'](respondWithStatusCode(_0x45baef,null))[_0xe3ea('0x45')](handleError(_0x45baef,null));};exports[_0xe3ea('0x91')]=function(_0x4285b9,_0x1fe9a2,_0x3a8692){var _0x517d14={};var _0x164414={};var _0x5f4e3b;var _0x416aec;return db[_0xe3ea('0x31')]['findOne']({'where':{'id':_0x4285b9[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x1fe9a2,null))['then'](function(_0x3af8c4){if(_0x3af8c4){_0x5f4e3b=_0x3af8c4;_0x164414['model']=_['keys'](db[_0xe3ea('0x92')]['rawAttributes']);_0x164414[_0xe3ea('0x36')]=_[_0xe3ea('0x48')](_0x4285b9[_0xe3ea('0x36')]);_0x164414[_0xe3ea('0x37')]=_['intersection'](_0x164414[_0xe3ea('0x35')],_0x164414['query']);_0x517d14[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x164414[_0xe3ea('0x35')],qs[_0xe3ea('0x3a')](_0x4285b9['query']['fields']));_0x517d14[_0xe3ea('0x39')]=_0x517d14[_0xe3ea('0x39')][_0xe3ea('0x3b')]?_0x517d14[_0xe3ea('0x39')]:_0x164414[_0xe3ea('0x35')];_0x517d14[_0xe3ea('0x60')]=qs['sort'](_0x4285b9['query'][_0xe3ea('0x3e')]);_0x517d14[_0xe3ea('0x40')]=qs[_0xe3ea('0x37')](_['pick'](_0x4285b9['query'],_0x164414['filters']));if(_0x4285b9['query'][_0xe3ea('0x42')]){_0x517d14[_0xe3ea('0x40')]=_['merge'](_0x517d14['where'],{'$or':_['map'](_0x517d14[_0xe3ea('0x39')],function(_0x101c4b){var _0x16ae9b={};_0x16ae9b[_0x101c4b]={'$like':'%'+_0x4285b9[_0xe3ea('0x36')]['filter']+'%'};return _0x16ae9b;})});}_0x517d14=_['merge']({},_0x517d14,_0x4285b9['options']);return _0x5f4e3b[_0xe3ea('0x91')](_0x517d14);}})[_0xe3ea('0x26')](function(_0x5cc331){if(_0x5cc331){_0x416aec=_0x5cc331[_0xe3ea('0x3b')];if(!_0x4285b9['query'][_0xe3ea('0x3c')](_0xe3ea('0x3d'))){_0x517d14['limit']=qs[_0xe3ea('0x1e')](_0x4285b9[_0xe3ea('0x36')]['limit']);_0x517d14[_0xe3ea('0x1d')]=qs[_0xe3ea('0x1d')](_0x4285b9[_0xe3ea('0x36')]['offset']);}return _0x5f4e3b['getBlackLists'](_0x517d14);}})[_0xe3ea('0x26')](function(_0x36b7ca){if(_0x36b7ca){return _0x36b7ca?{'count':_0x416aec,'rows':_0x36b7ca}:null;}})['then'](respondWithResult(_0x1fe9a2,null))[_0xe3ea('0x45')](handleError(_0x1fe9a2,null));};exports[_0xe3ea('0x93')]=function(_0x34eca8,_0x3f56cb,_0x301e2c){var _0x4aed51,_0x1e0a47;var _0x9a9cf3=[];var _0x3dc00d=moment()['format'](_0xe3ea('0x69'));return db[_0xe3ea('0x31')][_0xe3ea('0x4d')]({'where':{'id':_0x34eca8[_0xe3ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f56cb,null))['then'](function(_0x3f1343){if(_0x3f1343){_0x1e0a47=_0x3f1343;return _0x3f1343[_0xe3ea('0x93')](_0x34eca8['body'][_0xe3ea('0x6a')],_[_0xe3ea('0x58')](_0x34eca8[_0xe3ea('0x4f')],['ids','id'])||{});}return null;})['spread'](function(_0x528119){var _0x1ab70a;var _0x149b90;_0x4aed51=_0x528119||[];var _0x25b4f5=[];if(_0x528119){for(var _0x3ff4c8=0x0;_0x3ff4c8<_0x528119[_0xe3ea('0x3b')];_0x3ff4c8+=0x1){var _0x56b4a6=_0x528119[_0x3ff4c8][_0xe3ea('0x28')]({'plain':!![]});_0x1ab70a=squel[_0xe3ea('0x83')]()['into']('cm_hopper_black')[_0xe3ea('0x6e')]([_0xe3ea('0x6f'),_0xe3ea('0x71'),_0xe3ea('0x72'),_0xe3ea('0x62'),'createdAt',_0xe3ea('0x5a')],squel[_0xe3ea('0x73')]()[_0xe3ea('0x74')](_0xe3ea('0x6f'),_0xe3ea('0x6f'))[_0xe3ea('0x74')]('id',_0xe3ea('0x71'))[_0xe3ea('0x74')](_0x56b4a6[_0xe3ea('0x76')][_0xe3ea('0x77')](),_0xe3ea('0x72'))[_0xe3ea('0x74')](_0x34eca8['params']['id'][_0xe3ea('0x77')](),'CampaignId')[_0xe3ea('0x74')](_0xe3ea('0x75'),_0xe3ea('0x59'))[_0xe3ea('0x74')](_0xe3ea('0x75'),_0xe3ea('0x5a'))[_0xe3ea('0x78')](_0xe3ea('0x79'))[_0xe3ea('0x40')](_0xe3ea('0x7a'))[_0xe3ea('0x40')](_0xe3ea('0x7b'),_0x56b4a6[_0xe3ea('0x76')]['toString']())[_0xe3ea('0x40')](_0xe3ea('0x7c')))[_0xe3ea('0x77')]();_0x25b4f5[_0xe3ea('0x8e')](db['sequelize'][_0xe3ea('0x36')](_0x1ab70a));}return BPromise[_0xe3ea('0x94')](_0x25b4f5);}})[_0xe3ea('0x26')](function(){return _0x4aed51;})['then'](respondWithResult(_0x3f56cb,null))[_0xe3ea('0x45')](handleError(_0x3f56cb,null));};exports['removeBlackLists']=function(_0x61286c,_0x27fd11,_0x434651){return db['Campaign']['find']({'where':{'id':_0x61286c[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x27fd11,null))[_0xe3ea('0x26')](function(_0x42bb21){if(_0x42bb21){return _0x42bb21[_0xe3ea('0x95')](_0x61286c['query'][_0xe3ea('0x6a')]);}})['then'](function(_0x5b3f71){if(_0x5b3f71){return db[_0xe3ea('0x65')][_0xe3ea('0x27')]({'where':{'ListId':_0x61286c[_0xe3ea('0x36')][_0xe3ea('0x6a')],'CampaignId':_0x61286c[_0xe3ea('0x47')]['id']}})[_0xe3ea('0x26')](function(){return _0x5b3f71;});}})[_0xe3ea('0x26')](respondWithStatusCode(_0x27fd11,null))[_0xe3ea('0x45')](handleError(_0x27fd11,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0ccb757..1ea2e66 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1e2de4,_0x22d700){var _0x4a5929=function(_0x5acb56){while(--_0x5acb56){_0x1e2de4['push'](_0x1e2de4['shift']());}};_0x4a5929(++_0x22d700);}(_0x7a54,0x106));var _0x47a5=function(_0x12263a,_0x5f944f){_0x12263a=_0x12263a-0x0;var _0x1fb3b8=_0x7a54[_0x12263a];return _0x1fb3b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x422344,_0x276567){var _0x20efc8=function(_0x275ce9){while(--_0x275ce9){_0x422344['push'](_0x422344['shift']());}};_0x20efc8(++_0x276567);}(_0x7a54,0x106));var _0x47a5=function(_0x109162,_0x87f933){_0x109162=_0x109162-0x0;var _0x3c619c=_0x7a54[_0x109162];return _0x3c619c;};'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 cc90a59..190b29b 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 _0xfc4c=['util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','info','Campaign,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','then','lodash'];(function(_0x416d19,_0x26f9c4){var _0x5b5788=function(_0x34350a){while(--_0x34350a){_0x416d19['push'](_0x416d19['shift']());}};_0x5b5788(++_0x26f9c4);}(_0xfc4c,0xca));var _0xcfc4=function(_0x37a4ef,_0x499eb0){_0x37a4ef=_0x37a4ef-0x0;var _0x534207=_0xfc4c[_0x37a4ef];return _0x534207;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfc4('0x3'));var fs=require('fs');var Redis=require(_0xcfc4('0x4'));var db=require(_0xcfc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfc4('0x6'));var config=require(_0xcfc4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53486d,_0x560b1c,_0x4578f4){return new BPromise(function(_0x520566,_0x13b9f6){return client['request'](_0x53486d,_0x4578f4)['then'](function(_0x49b787){logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,'request\x20sent');logger[_0xcfc4('0xb')]('Campaign,\x20%s,\x20%s,\x20%s',_0x560b1c,'request\x20sent',JSON[_0xcfc4('0xc')](_0x49b787));if(_0x49b787[_0xcfc4('0xd')]){if(_0x49b787[_0xcfc4('0xd')][_0xcfc4('0xe')]===0x1f4){logger[_0xcfc4('0xd')]('Campaign,\x20%s,\x20%s',_0x560b1c,_0x49b787[_0xcfc4('0xd')]['message']);return _0x13b9f6(_0x49b787[_0xcfc4('0xd')]['message']);}logger[_0xcfc4('0xd')]('Campaign,\x20%s,\x20%s',_0x560b1c,_0x49b787['error'][_0xcfc4('0xf')]);return _0x520566(_0x49b787[_0xcfc4('0xd')]['message']);}else{logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,_0xcfc4('0x10'));_0x520566(_0x49b787['result']['message']);}})[_0xcfc4('0x11')](function(_0x47db36){logger['error']('Campaign,\x20%s,\x20%s',_0x560b1c,_0x47db36);_0x13b9f6(_0x47db36);});});}exports[_0xcfc4('0x12')]=function(_0x52cd7b){var _0x472694=this;return new Promise(function(_0x19887b,_0x5ac260){return db[_0xcfc4('0x13')][_0xcfc4('0x14')]({'raw':_0x52cd7b[_0xcfc4('0x15')]?_0x52cd7b['options'][_0xcfc4('0x16')]===undefined?!![]:![]:!![],'where':_0x52cd7b[_0xcfc4('0x15')]?_0x52cd7b[_0xcfc4('0x15')]['where']||null:null,'attributes':_0x52cd7b[_0xcfc4('0x15')]?_0x52cd7b[_0xcfc4('0x15')][_0xcfc4('0x17')]||null:null,'limit':_0x52cd7b[_0xcfc4('0x15')]?_0x52cd7b[_0xcfc4('0x15')][_0xcfc4('0x18')]||null:null,'include':_0x52cd7b[_0xcfc4('0x15')]?_0x52cd7b[_0xcfc4('0x15')][_0xcfc4('0x19')]?_[_0xcfc4('0x1a')](_0x52cd7b[_0xcfc4('0x15')]['include'],function(_0x393d09){return{'model':db[_0x393d09[_0xcfc4('0x1b')]],'as':_0x393d09['as'],'attributes':_0x393d09[_0xcfc4('0x17')],'include':_0x393d09['include']?_[_0xcfc4('0x1a')](_0x393d09['include'],function(_0x10aa76){return{'model':db[_0x10aa76[_0xcfc4('0x1b')]],'as':_0x10aa76['as'],'attributes':_0x10aa76[_0xcfc4('0x17')],'include':_0x10aa76[_0xcfc4('0x19')]?_[_0xcfc4('0x1a')](_0x10aa76[_0xcfc4('0x19')],function(_0x4fdb59){return{'model':db[_0x4fdb59[_0xcfc4('0x1b')]],'as':_0x4fdb59['as'],'attributes':_0x4fdb59[_0xcfc4('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcfc4('0x1c')](function(_0x1495db){logger[_0xcfc4('0x9')]('GetCampaign',_0x52cd7b);logger[_0xcfc4('0xb')](_0xcfc4('0x12'),_0x52cd7b,JSON[_0xcfc4('0xc')](_0x1495db));_0x19887b(_0x1495db);})[_0xcfc4('0x11')](function(_0x59dd2d){logger['error']('GetCampaign',_0x59dd2d[_0xcfc4('0xf')],_0x52cd7b);_0x5ac260(_0x472694[_0xcfc4('0xd')](0x1f4,_0x59dd2d[_0xcfc4('0xf')]));});});}; \ No newline at end of file +var _0x8ccb=['GetCampaign','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','request\x20sent','result','Campaign','options','raw','where','attributes','limit','include','map','model'];(function(_0x4d4af4,_0x3e0c8c){var _0x22f9db=function(_0x25763a){while(--_0x25763a){_0x4d4af4['push'](_0x4d4af4['shift']());}};_0x22f9db(++_0x3e0c8c);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x8ccb[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('Campaign,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('Campaign,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});}exports['GetCampaign']=function(_0x2ac4cc){var _0x259708=this;return new Promise(function(_0x2b7130,_0x3e1ba7){return db[_0xb8cc('0x13')]['findAll']({'raw':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x15')]===undefined?!![]:![]:!![],'where':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x16')]||null:null,'attributes':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x17')]||null:null,'limit':_0x2ac4cc['options']?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x18')]||null:null,'include':_0x2ac4cc[_0xb8cc('0x14')]?_0x2ac4cc[_0xb8cc('0x14')][_0xb8cc('0x19')]?_[_0xb8cc('0x1a')](_0x2ac4cc[_0xb8cc('0x14')]['include'],function(_0x50aa38){return{'model':db[_0x50aa38[_0xb8cc('0x1b')]],'as':_0x50aa38['as'],'attributes':_0x50aa38['attributes'],'include':_0x50aa38[_0xb8cc('0x19')]?_['map'](_0x50aa38[_0xb8cc('0x19')],function(_0xbb1918){return{'model':db[_0xbb1918[_0xb8cc('0x1b')]],'as':_0xbb1918['as'],'attributes':_0xbb1918[_0xb8cc('0x17')],'include':_0xbb1918['include']?_[_0xb8cc('0x1a')](_0xbb1918[_0xb8cc('0x19')],function(_0x400de6){return{'model':db[_0x400de6[_0xb8cc('0x1b')]],'as':_0x400de6['as'],'attributes':_0x400de6[_0xb8cc('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50ed6f){logger[_0xb8cc('0xb')](_0xb8cc('0x1c'),_0x2ac4cc);logger['debug'](_0xb8cc('0x1c'),_0x2ac4cc,JSON['stringify'](_0x50ed6f));_0x2b7130(_0x50ed6f);})[_0xb8cc('0x1d')](function(_0x2634a4){logger[_0xb8cc('0xe')](_0xb8cc('0x1c'),_0x2634a4['message'],_0x2ac4cc);_0x3e1ba7(_0x259708[_0xb8cc('0xe')](0x1f4,_0x2634a4[_0xb8cc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e6af627..40a1411 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 _0xf14b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf14b,0xdd));var _0xbf14=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0xf14b[_0x1d5a32];return _0x361ca0;};'use strict';var multer=require(_0xbf14('0x0'));var util=require(_0xbf14('0x1'));var path=require(_0xbf14('0x2'));var timeout=require(_0xbf14('0x3'));var express=require(_0xbf14('0x4'));var router=express[_0xbf14('0x5')]();var fs_extra=require(_0xbf14('0x6'));var auth=require(_0xbf14('0x7'));var interaction=require(_0xbf14('0x8'));var config=require(_0xbf14('0x9'));var controller=require('./campaign.controller');router[_0xbf14('0xa')]('/',auth[_0xbf14('0xb')](),controller[_0xbf14('0xc')]);router[_0xbf14('0xa')](_0xbf14('0xd'),auth[_0xbf14('0xb')](),controller[_0xbf14('0xe')]);router['get'](_0xbf14('0xf'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x10')]);router['get']('/:id/hopper_histories',auth[_0xbf14('0xb')](),controller[_0xbf14('0x11')]);router[_0xbf14('0xa')](_0xbf14('0x12'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x13')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xbf14('0x14')]);router[_0xbf14('0xa')](_0xbf14('0x15'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x16')]);router[_0xbf14('0xa')](_0xbf14('0x17'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x18')]);router[_0xbf14('0x19')]('/',auth['isAuthenticated'](),controller[_0xbf14('0x1a')]);router[_0xbf14('0x19')](_0xbf14('0x1b'),auth['isAuthenticated'](),controller[_0xbf14('0x1c')]);router[_0xbf14('0x19')]('/:id/lists',auth[_0xbf14('0xb')](),controller[_0xbf14('0x1d')]);router[_0xbf14('0x19')](_0xbf14('0x17'),auth['isAuthenticated'](),controller[_0xbf14('0x1e')]);router[_0xbf14('0x1f')](_0xbf14('0xd'),auth['isAuthenticated'](),controller[_0xbf14('0x20')]);router[_0xbf14('0x21')](_0xbf14('0xd'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x22')]);router[_0xbf14('0x21')]('/:id/lists',auth[_0xbf14('0xb')](),controller['removeLists']);router[_0xbf14('0x21')](_0xbf14('0x17'),auth[_0xbf14('0xb')](),controller[_0xbf14('0x23')]);module[_0xbf14('0x24')]=router; \ No newline at end of file +var _0xf33f=['addLists','addBlackLists','put','update','delete','destroy','removeLists','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperBlacks','/:id/lists','/:id/blacklists','post','/:id/clone','clone'];(function(_0x1c7bd0,_0x2b9e52){var _0x5de853=function(_0x5bbc45){while(--_0x5bbc45){_0x1c7bd0['push'](_0x1c7bd0['shift']());}};_0x5de853(++_0x2b9e52);}(_0xf33f,0x13d));var _0xff33=function(_0x37371d,_0x2f0c46){_0x37371d=_0x37371d-0x0;var _0x279daa=_0xf33f[_0x37371d];return _0x279daa;};'use strict';var multer=require(_0xff33('0x0'));var util=require(_0xff33('0x1'));var path=require(_0xff33('0x2'));var timeout=require(_0xff33('0x3'));var express=require('express');var router=express[_0xff33('0x4')]();var fs_extra=require(_0xff33('0x5'));var auth=require(_0xff33('0x6'));var interaction=require(_0xff33('0x7'));var config=require(_0xff33('0x8'));var controller=require(_0xff33('0x9'));router[_0xff33('0xa')]('/',auth[_0xff33('0xb')](),controller[_0xff33('0xc')]);router['get'](_0xff33('0xd'),auth[_0xff33('0xb')](),controller[_0xff33('0xe')]);router[_0xff33('0xa')](_0xff33('0xf'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xff33('0xa')](_0xff33('0x10'),auth['isAuthenticated'](),controller[_0xff33('0x11')]);router[_0xff33('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xff33('0xb')](),controller[_0xff33('0x12')]);router[_0xff33('0xa')](_0xff33('0x13'),auth[_0xff33('0xb')](),controller['getLists']);router[_0xff33('0xa')](_0xff33('0x14'),auth[_0xff33('0xb')](),controller['getBlackLists']);router[_0xff33('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff33('0x15')](_0xff33('0x16'),auth['isAuthenticated'](),controller[_0xff33('0x17')]);router[_0xff33('0x15')]('/:id/lists',auth[_0xff33('0xb')](),controller[_0xff33('0x18')]);router[_0xff33('0x15')](_0xff33('0x14'),auth['isAuthenticated'](),controller[_0xff33('0x19')]);router[_0xff33('0x1a')](_0xff33('0xd'),auth[_0xff33('0xb')](),controller[_0xff33('0x1b')]);router[_0xff33('0x1c')](_0xff33('0xd'),auth[_0xff33('0xb')](),controller[_0xff33('0x1d')]);router['delete'](_0xff33('0x13'),auth[_0xff33('0xb')](),controller[_0xff33('0x1e')]);router[_0xff33('0x1c')](_0xff33('0x14'),auth[_0xff33('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4ad7ff4..416b823 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 _0x9780=['medium','VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x467856,_0x87b18d){var _0x272113=function(_0x455b81){while(--_0x455b81){_0x467856['push'](_0x467856['shift']());}};_0x272113(++_0x87b18d);}(_0x9780,0x10c));var _0x0978=function(_0x1761f0,_0x27fe8b){_0x1761f0=_0x1761f0-0x0;var _0x371d9f=_0x9780[_0x1761f0];return _0x371d9f;};'use strict';var Sequelize=require(_0x0978('0x0'));module[_0x0978('0x1')]={'key':{'type':Sequelize[_0x0978('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0978('0x3')],'length':_0x0978('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x0978('0x2')]},'name':{'type':Sequelize[_0x0978('0x5')],'get':function(){return this[_0x0978('0x6')](_0x0978('0x7'));}}}; \ No newline at end of file +var _0xd2e2=['medium','sequelize','exports','STRING','TEXT'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd2e2,0x1d2));var _0x2d2e=function(_0x524d9d,_0xf645eb){_0x524d9d=_0x524d9d-0x0;var _0x141f65=_0xd2e2[_0x524d9d];return _0x141f65;};'use strict';var Sequelize=require(_0x2d2e('0x0'));module[_0x2d2e('0x1')]={'key':{'type':Sequelize[_0x2d2e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2d2e('0x3')],'length':_0x2d2e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2d2e('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b79488e..ffba27a 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 _0xff74=['limit','count','set','Content-Range','reject','then','CannedAnswers','destroy','end','sendStatus','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xff74,0x1e4));var _0x4ff7=function(_0x12aa66,_0x2d35c1){_0x12aa66=_0x12aa66-0x0;var _0x53dfe9=_0xff74[_0x12aa66];return _0x53dfe9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ff7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ff7('0x1'));var moment=require('moment');var BPromise=require(_0x4ff7('0x2'));var Mustache=require(_0x4ff7('0x3'));var util=require('util');var path=require(_0x4ff7('0x4'));var sox=require(_0x4ff7('0x5'));var csv=require('to-csv');var ejs=require(_0x4ff7('0x6'));var fs=require('fs');var fs_extra=require(_0x4ff7('0x7'));var _=require('lodash');var squel=require(_0x4ff7('0x8'));var crypto=require('crypto');var jsforce=require(_0x4ff7('0x9'));var deskjs=require(_0x4ff7('0xa'));var toCsv=require(_0x4ff7('0xb'));var querystring=require(_0x4ff7('0xc'));var Papa=require(_0x4ff7('0xd'));var Redis=require('ioredis');var authService=require(_0x4ff7('0xe'));var qs=require(_0x4ff7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ff7('0x10'));var logger=require('../../config/logger')(_0x4ff7('0x11'));var utils=require(_0x4ff7('0x12'));var config=require(_0x4ff7('0x13'));var licenseUtil=require(_0x4ff7('0x14'));var db=require(_0x4ff7('0x15'))['db'];function respondWithStatusCode(_0xb61da,_0x28c7ee){_0x28c7ee=_0x28c7ee||0xcc;return function(_0x321b3b){if(_0x321b3b){return _0xb61da['sendStatus'](_0x28c7ee);}return _0xb61da[_0x4ff7('0x16')](_0x28c7ee)['end']();};}function respondWithResult(_0xc9631,_0x15f4f3){_0x15f4f3=_0x15f4f3||0xc8;return function(_0x30cd88){if(_0x30cd88){return _0xc9631['status'](_0x15f4f3)[_0x4ff7('0x17')](_0x30cd88);}};}function respondWithFilteredResult(_0x332d6b,_0x33c3e9){return function(_0x2faf2f){if(_0x2faf2f){var _0x37e1bf=typeof _0x33c3e9[_0x4ff7('0x18')]===_0x4ff7('0x19')&&typeof _0x33c3e9[_0x4ff7('0x1a')]==='undefined';var _0x1ee871=_0x2faf2f['count'];var _0x595e02=_0x37e1bf?0x0:_0x33c3e9[_0x4ff7('0x18')];var _0x29bd8a=_0x37e1bf?_0x2faf2f[_0x4ff7('0x1b')]:_0x33c3e9[_0x4ff7('0x18')]+_0x33c3e9[_0x4ff7('0x1a')];var _0x24537b;if(_0x29bd8a>=_0x1ee871){_0x29bd8a=_0x1ee871;_0x24537b=0xc8;}else{_0x24537b=0xce;}_0x332d6b[_0x4ff7('0x16')](_0x24537b);return _0x332d6b[_0x4ff7('0x1c')](_0x4ff7('0x1d'),_0x595e02+'-'+_0x29bd8a+'/'+_0x1ee871)[_0x4ff7('0x17')](_0x2faf2f);}return null;};}function patchUpdates(_0x2e4a8f){return function(_0xf9affb){try{jsonpatch['apply'](_0xf9affb,_0x2e4a8f,!![]);}catch(_0x343fc6){return BPromise[_0x4ff7('0x1e')](_0x343fc6);}return _0xf9affb['save']();};}function saveUpdates(_0x5ed333,_0x1064e7){return function(_0x57970d){if(_0x57970d){return _0x57970d['update'](_0x5ed333)['then'](function(_0x54fedb){return _0x54fedb;});}return null;};}function removeEntity(_0x359a22,_0x3f36e6){return function(_0xd02daa){if(_0xd02daa){return _0xd02daa['destroy']()[_0x4ff7('0x1f')](function(){var _0x37ee40=_0xd02daa['get']({'plain':!![]});var _0x4e5c96=_0x4ff7('0x20');return db['UserProfileResource'][_0x4ff7('0x21')]({'where':{'type':_0x4e5c96,'resourceId':_0x37ee40['id']}})[_0x4ff7('0x1f')](function(){return _0xd02daa;});})[_0x4ff7('0x1f')](function(){_0x359a22[_0x4ff7('0x16')](0xcc)[_0x4ff7('0x22')]();});}};}function handleEntityNotFound(_0x2a6829,_0x56ca99){return function(_0x137180){if(!_0x137180){_0x2a6829[_0x4ff7('0x23')](0x194);}return _0x137180;};}function handleError(_0x50df4d,_0x5b0394){_0x5b0394=_0x5b0394||0x1f4;return function(_0x25ecbf){logger[_0x4ff7('0x24')](_0x25ecbf[_0x4ff7('0x25')]);if(_0x25ecbf[_0x4ff7('0x26')]){delete _0x25ecbf[_0x4ff7('0x26')];}_0x50df4d['status'](_0x5b0394)[_0x4ff7('0x27')](_0x25ecbf);};}exports['index']=function(_0x4c6aaa,_0x5a4fe3){var _0x1f717b={},_0x37f855={},_0x4c72fc={'count':0x0,'rows':[]};var _0x4ebb4f=_[_0x4ff7('0x28')](db[_0x4ff7('0x29')][_0x4ff7('0x2a')],function(_0x59b552){return{'name':_0x59b552[_0x4ff7('0x2b')],'type':_0x59b552[_0x4ff7('0x2c')][_0x4ff7('0x2d')]};});_0x37f855[_0x4ff7('0x2e')]=_[_0x4ff7('0x28')](_0x4ebb4f,_0x4ff7('0x26'));_0x37f855[_0x4ff7('0x2f')]=_[_0x4ff7('0x30')](_0x4c6aaa[_0x4ff7('0x2f')]);_0x37f855[_0x4ff7('0x31')]=_['intersection'](_0x37f855[_0x4ff7('0x2e')],_0x37f855['query']);_0x1f717b[_0x4ff7('0x32')]=_[_0x4ff7('0x33')](_0x37f855[_0x4ff7('0x2e')],qs[_0x4ff7('0x34')](_0x4c6aaa[_0x4ff7('0x2f')][_0x4ff7('0x34')]));_0x1f717b[_0x4ff7('0x32')]=_0x1f717b['attributes']['length']?_0x1f717b[_0x4ff7('0x32')]:_0x37f855[_0x4ff7('0x2e')];if(!_0x4c6aaa['query'][_0x4ff7('0x35')]('nolimit')){_0x1f717b['limit']=qs[_0x4ff7('0x1a')](_0x4c6aaa[_0x4ff7('0x2f')]['limit']);_0x1f717b[_0x4ff7('0x18')]=qs['offset'](_0x4c6aaa['query'][_0x4ff7('0x18')]);}_0x1f717b[_0x4ff7('0x36')]=qs[_0x4ff7('0x37')](_0x4c6aaa['query'][_0x4ff7('0x37')]);_0x1f717b[_0x4ff7('0x38')]=qs[_0x4ff7('0x31')](_['pick'](_0x4c6aaa[_0x4ff7('0x2f')],_0x37f855['filters']),_0x4ebb4f);if(_0x4c6aaa[_0x4ff7('0x2f')][_0x4ff7('0x39')]){_0x1f717b[_0x4ff7('0x38')]=_[_0x4ff7('0x3a')](_0x1f717b[_0x4ff7('0x38')],{'$or':[{'key':{'$like':'%'+_0x4c6aaa[_0x4ff7('0x2f')][_0x4ff7('0x39')]+'%'}},{'value':{'$like':'%'+_0x4c6aaa[_0x4ff7('0x2f')][_0x4ff7('0x39')]+'%'}}]});}_0x1f717b=_[_0x4ff7('0x3a')]({},_0x1f717b,_0x4c6aaa[_0x4ff7('0x3b')]);var _0x1e9cd9={'where':_0x1f717b[_0x4ff7('0x38')]};return db['CannedAnswer'][_0x4ff7('0x1b')](_0x1e9cd9)[_0x4ff7('0x1f')](function(_0x319314){_0x4c72fc[_0x4ff7('0x1b')]=_0x319314;if(_0x4c6aaa[_0x4ff7('0x2f')][_0x4ff7('0x3c')]){_0x1f717b[_0x4ff7('0x3d')]=[{'all':!![]}];}return db[_0x4ff7('0x29')][_0x4ff7('0x3e')](_0x1f717b);})[_0x4ff7('0x1f')](function(_0x297047){_0x4c72fc[_0x4ff7('0x3f')]=_0x297047;return _0x4c72fc;})[_0x4ff7('0x1f')](respondWithFilteredResult(_0x5a4fe3,_0x1f717b))[_0x4ff7('0x40')](handleError(_0x5a4fe3,null));};exports[_0x4ff7('0x41')]=function(_0x42ce8d,_0x4884e4){var _0x28653d={'raw':!![],'where':{'id':_0x42ce8d[_0x4ff7('0x42')]['id']}},_0x2ae320={};_0x2ae320['model']=_[_0x4ff7('0x30')](db[_0x4ff7('0x29')][_0x4ff7('0x2a')]);_0x2ae320['query']=_['keys'](_0x42ce8d[_0x4ff7('0x2f')]);_0x2ae320['filters']=_[_0x4ff7('0x33')](_0x2ae320[_0x4ff7('0x2e')],_0x2ae320[_0x4ff7('0x2f')]);_0x28653d['attributes']=_[_0x4ff7('0x33')](_0x2ae320['model'],qs[_0x4ff7('0x34')](_0x42ce8d[_0x4ff7('0x2f')]['fields']));_0x28653d[_0x4ff7('0x32')]=_0x28653d[_0x4ff7('0x32')][_0x4ff7('0x43')]?_0x28653d[_0x4ff7('0x32')]:_0x2ae320['model'];if(_0x42ce8d[_0x4ff7('0x2f')][_0x4ff7('0x3c')]){_0x28653d[_0x4ff7('0x3d')]=[{'all':!![]}];}_0x28653d=_[_0x4ff7('0x3a')]({},_0x28653d,_0x42ce8d[_0x4ff7('0x3b')]);return db[_0x4ff7('0x29')][_0x4ff7('0x44')](_0x28653d)['then'](handleEntityNotFound(_0x4884e4,null))[_0x4ff7('0x1f')](respondWithResult(_0x4884e4,null))[_0x4ff7('0x40')](handleError(_0x4884e4,null));};exports[_0x4ff7('0x45')]=function(_0x4381d8,_0x501afd){if(_0x4381d8[_0x4ff7('0x46')]['id']){delete _0x4381d8[_0x4ff7('0x46')]['id'];}return db[_0x4ff7('0x29')][_0x4ff7('0x44')]({'where':{'id':_0x4381d8[_0x4ff7('0x42')]['id']}})[_0x4ff7('0x1f')](handleEntityNotFound(_0x501afd,null))[_0x4ff7('0x1f')](saveUpdates(_0x4381d8[_0x4ff7('0x46')],null))[_0x4ff7('0x1f')](respondWithResult(_0x501afd,null))['catch'](handleError(_0x501afd,null));};exports[_0x4ff7('0x21')]=function(_0x108d97,_0x1e4564){return db[_0x4ff7('0x29')][_0x4ff7('0x44')]({'where':{'id':_0x108d97[_0x4ff7('0x42')]['id']}})[_0x4ff7('0x1f')](handleEntityNotFound(_0x1e4564,null))[_0x4ff7('0x1f')](removeEntity(_0x1e4564,null))['catch'](handleError(_0x1e4564,null));};exports[_0x4ff7('0x47')]=function(_0x5c066f,_0x2976da){var _0x7166ad={'key':_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x2d')]};if(_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x48')]){_0x7166ad['MailAccountId']=_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x48')];}else if(_0x5c066f[_0x4ff7('0x46')]['SmsAccountId']){_0x7166ad['SmsAccountId']=_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x49')];}else if(_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x4a')]){_0x7166ad[_0x4ff7('0x4a')]=_0x5c066f[_0x4ff7('0x46')]['OpenchannelAccountId'];}else if(_0x5c066f[_0x4ff7('0x46')][_0x4ff7('0x4b')]){_0x7166ad[_0x4ff7('0x4b')]=_0x5c066f['body'][_0x4ff7('0x4b')];}return db['CannedAnswer'][_0x4ff7('0x44')]({'where':_0x7166ad})[_0x4ff7('0x1f')](function(_0x5702ac){if(_0x5702ac){throw new db[(_0x4ff7('0x4c'))][(_0x4ff7('0x4d'))](_0x4ff7('0x4e'));}return db[_0x4ff7('0x29')][_0x4ff7('0x47')](_0x5c066f[_0x4ff7('0x46')]);})[_0x4ff7('0x1f')](function(_0x149b6f){var _0x49f1cd=_0x5c066f['user'][_0x4ff7('0x4f')]({'plain':!![]});if(!_0x49f1cd)throw new Error(_0x4ff7('0x50'));if(_0x49f1cd['role']===_0x4ff7('0x51')){var _0x5effdd=_0x149b6f[_0x4ff7('0x4f')]({'plain':!![]});return db[_0x4ff7('0x52')][_0x4ff7('0x44')]({'where':{'name':_0x4ff7('0x20'),'userProfileId':_0x49f1cd['userProfileId']},'raw':!![]})[_0x4ff7('0x1f')](function(_0x53dfdd){if(_0x53dfdd&&_0x53dfdd[_0x4ff7('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5effdd['name'],'resourceId':_0x5effdd['id'],'type':_0x53dfdd[_0x4ff7('0x26')],'sectionId':_0x53dfdd['id']},{})['then'](function(){return _0x149b6f;});}else{return _0x149b6f;}})['catch'](function(_0x58d172){logger[_0x4ff7('0x24')](_0x4ff7('0x54'),_0x58d172);throw _0x58d172;});}return _0x149b6f;})['then'](respondWithResult(_0x2976da,0xc9))['catch'](handleError(_0x2976da,null));}; \ No newline at end of file +var _0x85e3=['set','json','apply','reject','save','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit'];(function(_0x6d21a1,_0x5edd09){var _0x1551f2=function(_0x34bd63){while(--_0x34bd63){_0x6d21a1['push'](_0x6d21a1['shift']());}};_0x1551f2(++_0x5edd09);}(_0x85e3,0x91));var _0x385e=function(_0x5d136f,_0x3f0c95){_0x5d136f=_0x5d136f-0x0;var _0x56c7e4=_0x85e3[_0x5d136f];return _0x56c7e4;};'use strict';var emlformat=require(_0x385e('0x0'));var rimraf=require(_0x385e('0x1'));var zipdir=require(_0x385e('0x2'));var jsonpatch=require(_0x385e('0x3'));var rp=require(_0x385e('0x4'));var moment=require(_0x385e('0x5'));var BPromise=require(_0x385e('0x6'));var Mustache=require(_0x385e('0x7'));var util=require(_0x385e('0x8'));var path=require(_0x385e('0x9'));var sox=require(_0x385e('0xa'));var csv=require(_0x385e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x385e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x385e('0xd'));var deskjs=require(_0x385e('0xe'));var toCsv=require(_0x385e('0xb'));var querystring=require(_0x385e('0xf'));var Papa=require(_0x385e('0x10'));var Redis=require(_0x385e('0x11'));var authService=require(_0x385e('0x12'));var qs=require(_0x385e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x385e('0x14'))(_0x385e('0x15'));var utils=require('../../config/utils');var config=require(_0x385e('0x16'));var licenseUtil=require(_0x385e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576a26,_0x301500){_0x301500=_0x301500||0xcc;return function(_0x535013){if(_0x535013){return _0x576a26[_0x385e('0x18')](_0x301500);}return _0x576a26[_0x385e('0x19')](_0x301500)[_0x385e('0x1a')]();};}function respondWithResult(_0x29e828,_0xaa2f8f){_0xaa2f8f=_0xaa2f8f||0xc8;return function(_0x1834d7){if(_0x1834d7){return _0x29e828[_0x385e('0x19')](_0xaa2f8f)['json'](_0x1834d7);}};}function respondWithFilteredResult(_0x550309,_0x13a2f0){return function(_0x5bb84c){if(_0x5bb84c){var _0x19e541=typeof _0x13a2f0['offset']===_0x385e('0x1b')&&typeof _0x13a2f0['limit']===_0x385e('0x1b');var _0x2454b2=_0x5bb84c[_0x385e('0x1c')];var _0x2acf8a=_0x19e541?0x0:_0x13a2f0['offset'];var _0x4ee494=_0x19e541?_0x5bb84c[_0x385e('0x1c')]:_0x13a2f0[_0x385e('0x1d')]+_0x13a2f0[_0x385e('0x1e')];var _0x31c2de;if(_0x4ee494>=_0x2454b2){_0x4ee494=_0x2454b2;_0x31c2de=0xc8;}else{_0x31c2de=0xce;}_0x550309['status'](_0x31c2de);return _0x550309[_0x385e('0x1f')]('Content-Range',_0x2acf8a+'-'+_0x4ee494+'/'+_0x2454b2)[_0x385e('0x20')](_0x5bb84c);}return null;};}function patchUpdates(_0x2fd289){return function(_0x4fbe34){try{jsonpatch[_0x385e('0x21')](_0x4fbe34,_0x2fd289,!![]);}catch(_0x385489){return BPromise[_0x385e('0x22')](_0x385489);}return _0x4fbe34[_0x385e('0x23')]();};}function saveUpdates(_0x12bf89,_0x542905){return function(_0x3ce845){if(_0x3ce845){return _0x3ce845['update'](_0x12bf89)['then'](function(_0x3b5528){return _0x3b5528;});}return null;};}function removeEntity(_0x465f78,_0x36ef94){return function(_0x3f0520){if(_0x3f0520){return _0x3f0520[_0x385e('0x24')]()[_0x385e('0x25')](function(){var _0x53588e=_0x3f0520[_0x385e('0x26')]({'plain':!![]});var _0x6d5978=_0x385e('0x27');return db[_0x385e('0x28')][_0x385e('0x24')]({'where':{'type':_0x6d5978,'resourceId':_0x53588e['id']}})[_0x385e('0x25')](function(){return _0x3f0520;});})[_0x385e('0x25')](function(){_0x465f78[_0x385e('0x19')](0xcc)[_0x385e('0x1a')]();});}};}function handleEntityNotFound(_0x2ca29a,_0x2ca57){return function(_0x450460){if(!_0x450460){_0x2ca29a[_0x385e('0x18')](0x194);}return _0x450460;};}function handleError(_0x274e11,_0x49e949){_0x49e949=_0x49e949||0x1f4;return function(_0x339709){logger[_0x385e('0x29')](_0x339709[_0x385e('0x2a')]);if(_0x339709[_0x385e('0x2b')]){delete _0x339709['name'];}_0x274e11[_0x385e('0x19')](_0x49e949)[_0x385e('0x2c')](_0x339709);};}exports[_0x385e('0x2d')]=function(_0x3ebc8f,_0xb8e22e){var _0x58a05e={},_0x59e44c={},_0x889f6e={'count':0x0,'rows':[]};var _0x3413a2=_[_0x385e('0x2e')](db[_0x385e('0x2f')][_0x385e('0x30')],function(_0x5cac25){return{'name':_0x5cac25[_0x385e('0x31')],'type':_0x5cac25['type']['key']};});_0x59e44c[_0x385e('0x32')]=_['map'](_0x3413a2,_0x385e('0x2b'));_0x59e44c[_0x385e('0x33')]=_[_0x385e('0x34')](_0x3ebc8f['query']);_0x59e44c[_0x385e('0x35')]=_['intersection'](_0x59e44c[_0x385e('0x32')],_0x59e44c[_0x385e('0x33')]);_0x58a05e[_0x385e('0x36')]=_[_0x385e('0x37')](_0x59e44c[_0x385e('0x32')],qs['fields'](_0x3ebc8f[_0x385e('0x33')][_0x385e('0x38')]));_0x58a05e[_0x385e('0x36')]=_0x58a05e[_0x385e('0x36')][_0x385e('0x39')]?_0x58a05e[_0x385e('0x36')]:_0x59e44c[_0x385e('0x32')];if(!_0x3ebc8f[_0x385e('0x33')][_0x385e('0x3a')](_0x385e('0x3b'))){_0x58a05e['limit']=qs[_0x385e('0x1e')](_0x3ebc8f['query']['limit']);_0x58a05e[_0x385e('0x1d')]=qs[_0x385e('0x1d')](_0x3ebc8f[_0x385e('0x33')][_0x385e('0x1d')]);}_0x58a05e['order']=qs[_0x385e('0x3c')](_0x3ebc8f[_0x385e('0x33')][_0x385e('0x3c')]);_0x58a05e[_0x385e('0x3d')]=qs[_0x385e('0x35')](_[_0x385e('0x3e')](_0x3ebc8f['query'],_0x59e44c[_0x385e('0x35')]),_0x3413a2);if(_0x3ebc8f['query'][_0x385e('0x3f')]){_0x58a05e['where']=_['merge'](_0x58a05e[_0x385e('0x3d')],{'$or':[{'key':{'$like':'%'+_0x3ebc8f[_0x385e('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x3ebc8f[_0x385e('0x33')]['filter']+'%'}}]});}_0x58a05e=_[_0x385e('0x40')]({},_0x58a05e,_0x3ebc8f[_0x385e('0x41')]);var _0x129cf9={'where':_0x58a05e['where']};return db[_0x385e('0x2f')]['count'](_0x129cf9)[_0x385e('0x25')](function(_0x31698d){_0x889f6e[_0x385e('0x1c')]=_0x31698d;if(_0x3ebc8f['query'][_0x385e('0x42')]){_0x58a05e[_0x385e('0x43')]=[{'all':!![]}];}return db[_0x385e('0x2f')][_0x385e('0x44')](_0x58a05e);})['then'](function(_0x494c5e){_0x889f6e[_0x385e('0x45')]=_0x494c5e;return _0x889f6e;})[_0x385e('0x25')](respondWithFilteredResult(_0xb8e22e,_0x58a05e))['catch'](handleError(_0xb8e22e,null));};exports['show']=function(_0x19548a,_0x553af9){var _0x3502d7={'raw':!![],'where':{'id':_0x19548a[_0x385e('0x46')]['id']}},_0x269c69={};_0x269c69['model']=_[_0x385e('0x34')](db[_0x385e('0x2f')][_0x385e('0x30')]);_0x269c69[_0x385e('0x33')]=_['keys'](_0x19548a['query']);_0x269c69[_0x385e('0x35')]=_[_0x385e('0x37')](_0x269c69[_0x385e('0x32')],_0x269c69[_0x385e('0x33')]);_0x3502d7['attributes']=_[_0x385e('0x37')](_0x269c69['model'],qs[_0x385e('0x38')](_0x19548a[_0x385e('0x33')]['fields']));_0x3502d7['attributes']=_0x3502d7[_0x385e('0x36')][_0x385e('0x39')]?_0x3502d7[_0x385e('0x36')]:_0x269c69[_0x385e('0x32')];if(_0x19548a[_0x385e('0x33')][_0x385e('0x42')]){_0x3502d7[_0x385e('0x43')]=[{'all':!![]}];}_0x3502d7=_[_0x385e('0x40')]({},_0x3502d7,_0x19548a['options']);return db[_0x385e('0x2f')][_0x385e('0x47')](_0x3502d7)[_0x385e('0x25')](handleEntityNotFound(_0x553af9,null))[_0x385e('0x25')](respondWithResult(_0x553af9,null))[_0x385e('0x48')](handleError(_0x553af9,null));};exports[_0x385e('0x49')]=function(_0x5ca954,_0xe91692){if(_0x5ca954['body']['id']){delete _0x5ca954[_0x385e('0x4a')]['id'];}return db['CannedAnswer'][_0x385e('0x47')]({'where':{'id':_0x5ca954[_0x385e('0x46')]['id']}})[_0x385e('0x25')](handleEntityNotFound(_0xe91692,null))[_0x385e('0x25')](saveUpdates(_0x5ca954[_0x385e('0x4a')],null))[_0x385e('0x25')](respondWithResult(_0xe91692,null))[_0x385e('0x48')](handleError(_0xe91692,null));};exports['destroy']=function(_0x2dca7f,_0x457d97){return db[_0x385e('0x2f')][_0x385e('0x47')]({'where':{'id':_0x2dca7f[_0x385e('0x46')]['id']}})['then'](handleEntityNotFound(_0x457d97,null))[_0x385e('0x25')](removeEntity(_0x457d97,null))['catch'](handleError(_0x457d97,null));};exports[_0x385e('0x4b')]=function(_0x5266db,_0x3e20c8){var _0x55456e={'key':_0x5266db['body'][_0x385e('0x4c')]};if(_0x5266db[_0x385e('0x4a')][_0x385e('0x4d')]){_0x55456e['MailAccountId']=_0x5266db[_0x385e('0x4a')][_0x385e('0x4d')];}else if(_0x5266db['body']['SmsAccountId']){_0x55456e[_0x385e('0x4e')]=_0x5266db[_0x385e('0x4a')]['SmsAccountId'];}else if(_0x5266db['body'][_0x385e('0x4f')]){_0x55456e[_0x385e('0x4f')]=_0x5266db[_0x385e('0x4a')][_0x385e('0x4f')];}else if(_0x5266db['body'][_0x385e('0x50')]){_0x55456e[_0x385e('0x50')]=_0x5266db['body'][_0x385e('0x50')];}return db[_0x385e('0x2f')][_0x385e('0x47')]({'where':_0x55456e})[_0x385e('0x25')](function(_0xdab304){if(_0xdab304){throw new db['Sequelize']['ValidationError'](_0x385e('0x51'));}return db[_0x385e('0x2f')]['create'](_0x5266db[_0x385e('0x4a')]);})['then'](function(_0x220d38){var _0x3b76bb=_0x5266db[_0x385e('0x52')][_0x385e('0x26')]({'plain':!![]});if(!_0x3b76bb)throw new Error(_0x385e('0x53'));if(_0x3b76bb[_0x385e('0x54')]==='user'){var _0x10ccb4=_0x220d38[_0x385e('0x26')]({'plain':!![]});return db[_0x385e('0x55')][_0x385e('0x47')]({'where':{'name':_0x385e('0x27'),'userProfileId':_0x3b76bb[_0x385e('0x56')]},'raw':!![]})[_0x385e('0x25')](function(_0x5d75f0){if(_0x5d75f0&&_0x5d75f0['autoAssociation']===0x0){return db[_0x385e('0x28')][_0x385e('0x4b')]({'name':_0x10ccb4[_0x385e('0x2b')],'resourceId':_0x10ccb4['id'],'type':_0x5d75f0['name'],'sectionId':_0x5d75f0['id']},{})['then'](function(){return _0x220d38;});}else{return _0x220d38;}})['catch'](function(_0x2cc624){logger[_0x385e('0x29')](_0x385e('0x57'),_0x2cc624);throw _0x2cc624;});}return _0x220d38;})[_0x385e('0x25')](respondWithResult(_0x3e20c8,0xc9))['catch'](handleError(_0x3e20c8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 92790fc..598f5a0 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 _0x3cab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','utf8mb4_unicode_ci'];(function(_0x280aec,_0xfa1614){var _0x443a19=function(_0x369720){while(--_0x369720){_0x280aec['push'](_0x280aec['shift']());}};_0x443a19(++_0xfa1614);}(_0x3cab,0x1bc));var _0xb3ca=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x3cab[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require(_0xb3ca('0x0'));var util=require(_0xb3ca('0x1'));var logger=require(_0xb3ca('0x2'))(_0xb3ca('0x3'));var moment=require(_0xb3ca('0x4'));var BPromise=require(_0xb3ca('0x5'));var rp=require(_0xb3ca('0x6'));var fs=require('fs');var path=require(_0xb3ca('0x7'));var rimraf=require('rimraf');var config=require(_0xb3ca('0x8'));var attributes=require(_0xb3ca('0x9'));module[_0xb3ca('0xa')]=function(_0x462312,_0x327f7f){return _0x462312['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb3ca('0xb')});}; \ No newline at end of file +var _0xc5bd=['tools_canned_answers','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x4b484f,_0xac18d){var _0x39c8e7=function(_0x5b4822){while(--_0x5b4822){_0x4b484f['push'](_0x4b484f['shift']());}};_0x39c8e7(++_0xac18d);}(_0xc5bd,0xc1));var _0xdc5b=function(_0x3686f2,_0x37205f){_0x3686f2=_0x3686f2-0x0;var _0x4edf4a=_0xc5bd[_0x3686f2];return _0x4edf4a;};'use strict';var _=require(_0xdc5b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdc5b('0x1'));var moment=require(_0xdc5b('0x2'));var BPromise=require(_0xdc5b('0x3'));var rp=require(_0xdc5b('0x4'));var fs=require('fs');var path=require(_0xdc5b('0x5'));var rimraf=require('rimraf');var config=require(_0xdc5b('0x6'));var attributes=require(_0xdc5b('0x7'));module[_0xdc5b('0x8')]=function(_0x417f84,_0x2159a1){return _0x417f84[_0xdc5b('0x9')](_0xdc5b('0xa'),attributes,{'tableName':_0xdc5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 ac9397a..56eb117 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(_0xbeafa0,_0x3ce883){var _0xd26056=function(_0x2dbc5a){while(--_0x2dbc5a){_0xbeafa0['push'](_0xbeafa0['shift']());}};_0xd26056(++_0x3ce883);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x1a5ad0,_0x52029d){var _0x113de4=function(_0x4c7973){while(--_0x4c7973){_0x1a5ad0['push'](_0x1a5ad0['shift']());}};_0x113de4(++_0x52029d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 3f91a20..3a0557a 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 _0x035b=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x42d000,_0xe5ff9d){var _0x34955b=function(_0xa94dc6){while(--_0xa94dc6){_0x42d000['push'](_0x42d000['shift']());}};_0x34955b(++_0xe5ff9d);}(_0x035b,0x11d));var _0xb035=function(_0x42c92d,_0x183b56){_0x42c92d=_0x42c92d-0x0;var _0x5de097=_0x035b[_0x42c92d];return _0x5de097;};'use strict';var multer=require(_0xb035('0x0'));var util=require(_0xb035('0x1'));var path=require(_0xb035('0x2'));var timeout=require('connect-timeout');var express=require(_0xb035('0x3'));var router=express[_0xb035('0x4')]();var fs_extra=require(_0xb035('0x5'));var auth=require(_0xb035('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb035('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xb035('0x8')](),controller[_0xb035('0x9')]);router[_0xb035('0xa')](_0xb035('0xb'),auth[_0xb035('0x8')](),controller[_0xb035('0xc')]);router[_0xb035('0xd')]('/',auth['isAuthenticated'](),controller[_0xb035('0xe')]);router[_0xb035('0xf')](_0xb035('0xb'),auth[_0xb035('0x8')](),controller[_0xb035('0x10')]);router[_0xb035('0x11')](_0xb035('0xb'),auth[_0xb035('0x8')](),controller[_0xb035('0x12')]);module[_0xb035('0x13')]=router; \ No newline at end of file +var _0x0e18=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout','express','fs-extra'];(function(_0x4603b4,_0xb3ba9f){var _0x29607b=function(_0x409818){while(--_0x409818){_0x4603b4['push'](_0x4603b4['shift']());}};_0x29607b(++_0xb3ba9f);}(_0x0e18,0x164));var _0x80e1=function(_0x284e7e,_0x1675c1){_0x284e7e=_0x284e7e-0x0;var _0x2c5fa6=_0x0e18[_0x284e7e];return _0x2c5fa6;};'use strict';var multer=require(_0x80e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x80e1('0x1'));var express=require(_0x80e1('0x2'));var router=express['Router']();var fs_extra=require(_0x80e1('0x3'));var auth=require(_0x80e1('0x4'));var interaction=require(_0x80e1('0x5'));var config=require(_0x80e1('0x6'));var controller=require(_0x80e1('0x7'));router[_0x80e1('0x8')]('/',auth[_0x80e1('0x9')](),controller[_0x80e1('0xa')]);router['get'](_0x80e1('0xb'),auth[_0x80e1('0x9')](),controller[_0x80e1('0xc')]);router[_0x80e1('0xd')]('/',auth[_0x80e1('0x9')](),controller['create']);router[_0x80e1('0xe')](_0x80e1('0xb'),auth['isAuthenticated'](),controller[_0x80e1('0xf')]);router[_0x80e1('0x10')](_0x80e1('0xb'),auth[_0x80e1('0x9')](),controller[_0x80e1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d8be32b..2f129fa 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 _0x01bb=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x1e9467,_0x2c8f00){var _0x2ff9e0=function(_0x1a5be8){while(--_0x1a5be8){_0x1e9467['push'](_0x1e9467['shift']());}};_0x2ff9e0(++_0x2c8f00);}(_0x01bb,0x171));var _0xb01b=function(_0x24ba3d,_0x45c8be){_0x24ba3d=_0x24ba3d-0x0;var _0x21ea8e=_0x01bb[_0x24ba3d];return _0x21ea8e;};'use strict';var Sequelize=require(_0xb01b('0x0'));module[_0xb01b('0x1')]={'calldate':{'type':Sequelize[_0xb01b('0x2')],'allowNull':![],'defaultValue':_0xb01b('0x3')},'clid':{'type':Sequelize[_0xb01b('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xb01b('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb01b('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb01b('0x4')]},'duration':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb01b('0x4')]},'amaflags':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb01b('0x4')]},'userfield':{'type':Sequelize[_0xb01b('0x4')]},'uniqueid':{'type':Sequelize[_0xb01b('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xb01b('0x4')]},'peeraccount':{'type':Sequelize[_0xb01b('0x4')]},'type':{'type':Sequelize[_0xb01b('0x4')]},'tag':{'type':Sequelize[_0xb01b('0x4')]}}; \ No newline at end of file +var _0xea1a=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xea1a,0x158));var _0xaea1=function(_0x369799,_0x2ae723){_0x369799=_0x369799-0x0;var _0x1bcd73=_0xea1a[_0x369799];return _0x1bcd73;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'calldate':{'type':Sequelize[_0xaea1('0x2')],'allowNull':![],'defaultValue':_0xaea1('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xaea1('0x4')]},'dst':{'type':Sequelize[_0xaea1('0x4')]},'dcontext':{'type':Sequelize[_0xaea1('0x4')]},'channel':{'type':Sequelize[_0xaea1('0x4')]},'dstchannel':{'type':Sequelize[_0xaea1('0x4')]},'lastapp':{'type':Sequelize[_0xaea1('0x4')]},'lastdata':{'type':Sequelize[_0xaea1('0x4')]},'duration':{'type':Sequelize[_0xaea1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaea1('0x4')]},'amaflags':{'type':Sequelize[_0xaea1('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaea1('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaea1('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xaea1('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xaea1('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 02011cd..ec7067e 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 _0xa3e6=['offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Cdr','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x50a135,_0xb52816){var _0x50dc88=function(_0x1927f1){while(--_0x1927f1){_0x50a135['push'](_0x50a135['shift']());}};_0x50dc88(++_0xb52816);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x229107,_0x49a4e3){_0x229107=_0x229107-0x0;var _0x537417=_0xa3e6[_0x229107];return _0x537417;};'use strict';var emlformat=require(_0x6a3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a3e('0x2'));var moment=require(_0x6a3e('0x3'));var BPromise=require(_0x6a3e('0x4'));var Mustache=require('mustache');var util=require(_0x6a3e('0x5'));var path=require('path');var sox=require(_0x6a3e('0x6'));var csv=require(_0x6a3e('0x7'));var ejs=require(_0x6a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a3e('0x9'));var _=require(_0x6a3e('0xa'));var squel=require('squel');var crypto=require(_0x6a3e('0xb'));var jsforce=require(_0x6a3e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a3e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a3e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6a3e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a3e('0x10'))(_0x6a3e('0x11'));var utils=require(_0x6a3e('0x12'));var config=require(_0x6a3e('0x13'));var licenseUtil=require(_0x6a3e('0x14'));var db=require(_0x6a3e('0x15'))['db'];function respondWithStatusCode(_0x4a3a97,_0x27e169){_0x27e169=_0x27e169||0xcc;return function(_0x385c29){if(_0x385c29){return _0x4a3a97[_0x6a3e('0x16')](_0x27e169);}return _0x4a3a97[_0x6a3e('0x17')](_0x27e169)[_0x6a3e('0x18')]();};}function respondWithResult(_0x31aefa,_0x222f7c){_0x222f7c=_0x222f7c||0xc8;return function(_0x4bd05f){if(_0x4bd05f){return _0x31aefa[_0x6a3e('0x17')](_0x222f7c)[_0x6a3e('0x19')](_0x4bd05f);}};}function respondWithFilteredResult(_0x8ed74b,_0x2a62a8){return function(_0x500ccd){if(_0x500ccd){var _0x462b8d=typeof _0x2a62a8[_0x6a3e('0x1a')]==='undefined'&&typeof _0x2a62a8['limit']==='undefined';var _0x58b221=_0x500ccd['count'];var _0x3693a2=_0x462b8d?0x0:_0x2a62a8[_0x6a3e('0x1a')];var _0x31a190=_0x462b8d?_0x500ccd[_0x6a3e('0x1b')]:_0x2a62a8[_0x6a3e('0x1a')]+_0x2a62a8[_0x6a3e('0x1c')];var _0x1d6ccc;if(_0x31a190>=_0x58b221){_0x31a190=_0x58b221;_0x1d6ccc=0xc8;}else{_0x1d6ccc=0xce;}_0x8ed74b[_0x6a3e('0x17')](_0x1d6ccc);return _0x8ed74b['set'](_0x6a3e('0x1d'),_0x3693a2+'-'+_0x31a190+'/'+_0x58b221)['json'](_0x500ccd);}return null;};}function patchUpdates(_0xc0452f){return function(_0x5ae73b){try{jsonpatch[_0x6a3e('0x1e')](_0x5ae73b,_0xc0452f,!![]);}catch(_0x131d80){return BPromise[_0x6a3e('0x1f')](_0x131d80);}return _0x5ae73b[_0x6a3e('0x20')]();};}function saveUpdates(_0x58721c,_0x4f7507){return function(_0x215ac1){if(_0x215ac1){return _0x215ac1[_0x6a3e('0x21')](_0x58721c)[_0x6a3e('0x22')](function(_0x4687d0){return _0x4687d0;});}return null;};}function removeEntity(_0x4e5a25,_0x1ae966){return function(_0x21b5aa){if(_0x21b5aa){return _0x21b5aa[_0x6a3e('0x23')]()[_0x6a3e('0x22')](function(){_0x4e5a25[_0x6a3e('0x17')](0xcc)[_0x6a3e('0x18')]();});}};}function handleEntityNotFound(_0x359460,_0x83e681){return function(_0x25fc14){if(!_0x25fc14){_0x359460[_0x6a3e('0x16')](0x194);}return _0x25fc14;};}function handleError(_0x5b1ed9,_0x4ec834){_0x4ec834=_0x4ec834||0x1f4;return function(_0x150992){logger[_0x6a3e('0x24')](_0x150992[_0x6a3e('0x25')]);if(_0x150992[_0x6a3e('0x26')]){delete _0x150992[_0x6a3e('0x26')];}_0x5b1ed9[_0x6a3e('0x17')](_0x4ec834)[_0x6a3e('0x27')](_0x150992);};}exports[_0x6a3e('0x28')]=function(_0xd87198,_0x436169){var _0x3a831b={},_0x508a55={},_0x4eec67={'count':0x0,'rows':[]};var _0x2a2b2a=_['map'](db[_0x6a3e('0x29')]['rawAttributes'],function(_0x553fc5){return{'name':_0x553fc5[_0x6a3e('0x2a')],'type':_0x553fc5[_0x6a3e('0x2b')]['key']};});_0x508a55['model']=_[_0x6a3e('0x2c')](_0x2a2b2a,_0x6a3e('0x26'));_0x508a55[_0x6a3e('0x2d')]=_[_0x6a3e('0x2e')](_0xd87198['query']);_0x508a55['filters']=_[_0x6a3e('0x2f')](_0x508a55[_0x6a3e('0x30')],_0x508a55[_0x6a3e('0x2d')]);_0x3a831b[_0x6a3e('0x31')]=_['intersection'](_0x508a55[_0x6a3e('0x30')],qs[_0x6a3e('0x32')](_0xd87198['query']['fields']));_0x3a831b['attributes']=_0x3a831b[_0x6a3e('0x31')][_0x6a3e('0x33')]?_0x3a831b[_0x6a3e('0x31')]:_0x508a55[_0x6a3e('0x30')];if(!_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x34')](_0x6a3e('0x35'))){_0x3a831b[_0x6a3e('0x1c')]=qs[_0x6a3e('0x1c')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x1c')]);_0x3a831b[_0x6a3e('0x1a')]=qs[_0x6a3e('0x1a')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x1a')]);}_0x3a831b['order']=qs[_0x6a3e('0x36')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x36')]);_0x3a831b['where']=qs[_0x6a3e('0x37')](_[_0x6a3e('0x38')](_0xd87198['query'],_0x508a55[_0x6a3e('0x37')]),_0x2a2b2a);if(_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x39')]){_0x3a831b['where']=_[_0x6a3e('0x3a')](_0x3a831b[_0x6a3e('0x3b')],{'$or':_[_0x6a3e('0x2c')](_0x2a2b2a,function(_0x3e604c){if(_0x3e604c[_0x6a3e('0x2b')]!==_0x6a3e('0x3c')){var _0x5f4ff5={};_0x5f4ff5[_0x3e604c[_0x6a3e('0x26')]]={'$like':'%'+_0xd87198['query']['filter']+'%'};return _0x5f4ff5;}})});}_0x3a831b=_['merge']({},_0x3a831b,_0xd87198[_0x6a3e('0x3d')]);var _0x4bb1ba={'where':_0x3a831b[_0x6a3e('0x3b')]};return db[_0x6a3e('0x29')][_0x6a3e('0x1b')](_0x4bb1ba)[_0x6a3e('0x22')](function(_0xca83d2){_0x4eec67[_0x6a3e('0x1b')]=_0xca83d2;if(_0xd87198['query']['includeAll']){_0x3a831b[_0x6a3e('0x3e')]=[{'all':!![]}];}return db[_0x6a3e('0x29')][_0x6a3e('0x3f')](_0x3a831b);})[_0x6a3e('0x22')](function(_0x1dd524){_0x4eec67['rows']=_0x1dd524;return _0x4eec67;})[_0x6a3e('0x22')](respondWithFilteredResult(_0x436169,_0x3a831b))[_0x6a3e('0x40')](handleError(_0x436169,null));};exports['show']=function(_0x35c927,_0x417f8a){var _0x35c836={'raw':!![],'where':{'id':_0x35c927[_0x6a3e('0x41')]['id']}},_0x53ad48={};_0x53ad48[_0x6a3e('0x30')]=_[_0x6a3e('0x2e')](db[_0x6a3e('0x29')][_0x6a3e('0x42')]);_0x53ad48[_0x6a3e('0x2d')]=_['keys'](_0x35c927[_0x6a3e('0x2d')]);_0x53ad48[_0x6a3e('0x37')]=_[_0x6a3e('0x2f')](_0x53ad48['model'],_0x53ad48[_0x6a3e('0x2d')]);_0x35c836['attributes']=_['intersection'](_0x53ad48[_0x6a3e('0x30')],qs[_0x6a3e('0x32')](_0x35c927[_0x6a3e('0x2d')]['fields']));_0x35c836['attributes']=_0x35c836[_0x6a3e('0x31')][_0x6a3e('0x33')]?_0x35c836[_0x6a3e('0x31')]:_0x53ad48[_0x6a3e('0x30')];if(_0x35c927[_0x6a3e('0x2d')][_0x6a3e('0x43')]){_0x35c836['include']=[{'all':!![]}];}_0x35c836=_[_0x6a3e('0x3a')]({},_0x35c836,_0x35c927[_0x6a3e('0x3d')]);return db[_0x6a3e('0x29')][_0x6a3e('0x44')](_0x35c836)[_0x6a3e('0x22')](handleEntityNotFound(_0x417f8a,null))[_0x6a3e('0x22')](respondWithResult(_0x417f8a,null))[_0x6a3e('0x40')](handleError(_0x417f8a,null));};exports[_0x6a3e('0x45')]=function(_0x2d0685,_0x4d36e2){return db[_0x6a3e('0x29')][_0x6a3e('0x45')](_0x2d0685['body'],{})[_0x6a3e('0x22')](respondWithResult(_0x4d36e2,0xc9))['catch'](handleError(_0x4d36e2,null));};exports[_0x6a3e('0x21')]=function(_0x10cd8e,_0x28a3e9){if(_0x10cd8e['body']['id']){delete _0x10cd8e[_0x6a3e('0x46')]['id'];}return db[_0x6a3e('0x29')]['find']({'where':{'id':_0x10cd8e['params']['id']}})['then'](handleEntityNotFound(_0x28a3e9,null))[_0x6a3e('0x22')](saveUpdates(_0x10cd8e[_0x6a3e('0x46')],null))[_0x6a3e('0x22')](respondWithResult(_0x28a3e9,null))[_0x6a3e('0x40')](handleError(_0x28a3e9,null));};exports[_0x6a3e('0x23')]=function(_0x448e46,_0x404473){return db[_0x6a3e('0x29')][_0x6a3e('0x44')]({'where':{'id':_0x448e46[_0x6a3e('0x41')]['id']}})[_0x6a3e('0x22')](handleEntityNotFound(_0x404473,null))['then'](removeEntity(_0x404473,null))[_0x6a3e('0x40')](handleError(_0x404473,null));};exports[_0x6a3e('0x47')]=function(_0x3fabf8,_0x21ba7b){return db[_0x6a3e('0x29')]['describe']()[_0x6a3e('0x22')](respondWithResult(_0x21ba7b,null))['catch'](handleError(_0x21ba7b,null));}; \ No newline at end of file +var _0xae24=['destroy','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','findAll','catch','params','rawAttributes','fields','length','includeAll','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then'];(function(_0x3755be,_0x31d4e7){var _0x7996af=function(_0x1524a5){while(--_0x1524a5){_0x3755be['push'](_0x3755be['shift']());}};_0x7996af(++_0x31d4e7);}(_0xae24,0x182));var _0x4ae2=function(_0x5aa226,_0x75f26c){_0x5aa226=_0x5aa226-0x0;var _0x537fc3=_0xae24[_0x5aa226];return _0x537fc3;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24'));_0x4e7741[_0x4ae2('0x2d')]=_[_0x4ae2('0x2e')](_0x57a377[_0x4ae2('0x2d')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2d')]);_0x3e2666[_0x4ae2('0x31')]=_[_0x4ae2('0x30')](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2d')]['fields']));_0x3e2666[_0x4ae2('0x31')]=_0x3e2666[_0x4ae2('0x31')]['length']?_0x3e2666[_0x4ae2('0x31')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377[_0x4ae2('0x2d')][_0x4ae2('0x32')]('nolimit')){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2d')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2d')][_0x4ae2('0x18')]);}_0x3e2666[_0x4ae2('0x33')]=qs['sort'](_0x57a377[_0x4ae2('0x2d')]['sort']);_0x3e2666[_0x4ae2('0x34')]=qs[_0x4ae2('0x2f')](_[_0x4ae2('0x35')](_0x57a377[_0x4ae2('0x2d')],_0x4e7741[_0x4ae2('0x2f')]),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2d')]['filter']){_0x3e2666[_0x4ae2('0x34')]=_[_0x4ae2('0x36')](_0x3e2666[_0x4ae2('0x34')],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x49baf9){if(_0x49baf9[_0x4ae2('0x2a')]!==_0x4ae2('0x37')){var _0x2f0d83={};_0x2f0d83[_0x49baf9[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2d')][_0x4ae2('0x38')]+'%'};return _0x2f0d83;}})});}_0x3e2666=_[_0x4ae2('0x36')]({},_0x3e2666,_0x57a377[_0x4ae2('0x39')]);var _0x1d5888={'where':_0x3e2666[_0x4ae2('0x34')]};return db[_0x4ae2('0x28')]['count'](_0x1d5888)[_0x4ae2('0x21')](function(_0x3f0b3f){_0x554cff[_0x4ae2('0x1b')]=_0x3f0b3f;if(_0x57a377[_0x4ae2('0x2d')]['includeAll']){_0x3e2666['include']=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x3a')](_0x3e2666);})[_0x4ae2('0x21')](function(_0x3cdf23){_0x554cff['rows']=_0x3cdf23;return _0x554cff;})[_0x4ae2('0x21')](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x3b')](handleError(_0x5ec1fd,null));};exports['show']=function(_0x230030,_0x2a85eb){var _0x11a5d9={'raw':!![],'where':{'id':_0x230030[_0x4ae2('0x3c')]['id']}},_0x5a9126={};_0x5a9126[_0x4ae2('0x2c')]=_[_0x4ae2('0x2e')](db[_0x4ae2('0x28')][_0x4ae2('0x3d')]);_0x5a9126[_0x4ae2('0x2d')]=_[_0x4ae2('0x2e')](_0x230030[_0x4ae2('0x2d')]);_0x5a9126['filters']=_[_0x4ae2('0x30')](_0x5a9126[_0x4ae2('0x2c')],_0x5a9126['query']);_0x11a5d9[_0x4ae2('0x31')]=_[_0x4ae2('0x30')](_0x5a9126['model'],qs[_0x4ae2('0x3e')](_0x230030[_0x4ae2('0x2d')]['fields']));_0x11a5d9[_0x4ae2('0x31')]=_0x11a5d9[_0x4ae2('0x31')][_0x4ae2('0x3f')]?_0x11a5d9['attributes']:_0x5a9126['model'];if(_0x230030[_0x4ae2('0x2d')][_0x4ae2('0x40')]){_0x11a5d9[_0x4ae2('0x41')]=[{'all':!![]}];}_0x11a5d9=_[_0x4ae2('0x36')]({},_0x11a5d9,_0x230030['options']);return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x11a5d9)[_0x4ae2('0x21')](handleEntityNotFound(_0x2a85eb,null))['then'](respondWithResult(_0x2a85eb,null))[_0x4ae2('0x3b')](handleError(_0x2a85eb,null));};exports[_0x4ae2('0x43')]=function(_0x443548,_0x4e9b6e){return db[_0x4ae2('0x28')][_0x4ae2('0x43')](_0x443548[_0x4ae2('0x44')],{})[_0x4ae2('0x21')](respondWithResult(_0x4e9b6e,0xc9))[_0x4ae2('0x3b')](handleError(_0x4e9b6e,null));};exports[_0x4ae2('0x20')]=function(_0x7f288e,_0x2fe532){if(_0x7f288e[_0x4ae2('0x44')]['id']){delete _0x7f288e[_0x4ae2('0x44')]['id'];}return db['Cdr'][_0x4ae2('0x42')]({'where':{'id':_0x7f288e[_0x4ae2('0x3c')]['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0x2fe532,null))[_0x4ae2('0x21')](saveUpdates(_0x7f288e[_0x4ae2('0x44')],null))[_0x4ae2('0x21')](respondWithResult(_0x2fe532,null))[_0x4ae2('0x3b')](handleError(_0x2fe532,null));};exports[_0x4ae2('0x22')]=function(_0x4ffe8d,_0xe58384){return db[_0x4ae2('0x28')]['find']({'where':{'id':_0x4ffe8d[_0x4ae2('0x3c')]['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xe58384,null))['then'](removeEntity(_0xe58384,null))[_0x4ae2('0x3b')](handleError(_0xe58384,null));};exports['describe']=function(_0x426d29,_0x5e1c80){return db[_0x4ae2('0x28')][_0x4ae2('0x45')]()[_0x4ae2('0x21')](respondWithResult(_0x5e1c80,null))[_0x4ae2('0x3b')](handleError(_0x5e1c80,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 289065c..3b999ac 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x243f9a,_0x19e8da){var _0x35c86a=function(_0x3bc288){while(--_0x3bc288){_0x243f9a['push'](_0x243f9a['shift']());}};_0x35c86a(++_0x19e8da);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3d6f7a,_0x3da829){var _0x8ac6e7=function(_0x47d1c4){while(--_0x47d1c4){_0x3d6f7a['push'](_0x3d6f7a['shift']());}};_0x8ac6e7(++_0x3da829);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 9f7db2b..1e79d9d 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 _0x0a42=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1021c6,_0x56ecb0){var _0x20a561=function(_0x1f6a74){while(--_0x1f6a74){_0x1021c6['push'](_0x1021c6['shift']());}};_0x20a561(++_0x56ecb0);}(_0x0a42,0x13d));var _0x20a4=function(_0xfb7bc0,_0x44ef58){_0xfb7bc0=_0xfb7bc0-0x0;var _0x40b7ee=_0x0a42[_0xfb7bc0];return _0x40b7ee;};'use strict';var _=require('lodash');var util=require(_0x20a4('0x0'));var moment=require(_0x20a4('0x1'));var BPromise=require(_0x20a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20a4('0x3'))['db'];var utils=require(_0x20a4('0x4'));var logger=require(_0x20a4('0x5'))(_0x20a4('0x6'));var config=require(_0x20a4('0x7'));var jayson=require(_0x20a4('0x8'));var client=jayson['client'][_0x20a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb9528a,_0x3984eb,_0xd6c2cf){return new BPromise(function(_0x7133ed,_0x37f408){return client[_0x20a4('0xa')](_0xb9528a,_0xd6c2cf)['then'](function(_0x6ae005){logger['info'](_0x20a4('0xb'),_0x3984eb,_0x20a4('0xc'));logger[_0x20a4('0xd')](_0x20a4('0xe'),_0x3984eb,'request\x20sent',JSON[_0x20a4('0xf')](_0x6ae005));if(_0x6ae005['error']){if(_0x6ae005[_0x20a4('0x10')][_0x20a4('0x11')]===0x1f4){logger[_0x20a4('0x10')](_0x20a4('0xb'),_0x3984eb,_0x6ae005[_0x20a4('0x10')][_0x20a4('0x12')]);return _0x37f408(_0x6ae005[_0x20a4('0x10')]['message']);}logger[_0x20a4('0x10')]('Cdr,\x20%s,\x20%s',_0x3984eb,_0x6ae005[_0x20a4('0x10')][_0x20a4('0x12')]);return _0x7133ed(_0x6ae005[_0x20a4('0x10')][_0x20a4('0x12')]);}else{logger[_0x20a4('0x13')]('Cdr,\x20%s,\x20%s',_0x3984eb,'request\x20sent');_0x7133ed(_0x6ae005[_0x20a4('0x14')][_0x20a4('0x12')]);}})[_0x20a4('0x15')](function(_0x91ed5){logger[_0x20a4('0x10')](_0x20a4('0xb'),_0x3984eb,_0x91ed5);_0x37f408(_0x91ed5);});});} \ No newline at end of file +var _0x2184=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x2184,0xd2));var _0x4218=function(_0x26b76e,_0x10c9c1){_0x26b76e=_0x26b76e-0x0;var _0x37cb0e=_0x2184[_0x26b76e];return _0x37cb0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4218('0x0'));var BPromise=require('bluebird');var rs=require(_0x4218('0x1'));var fs=require('fs');var Redis=require(_0x4218('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4218('0x3'));var logger=require(_0x4218('0x4'))(_0x4218('0x5'));var config=require(_0x4218('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4218('0x7')][_0x4218('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48d4d4,_0x1411c5,_0x2796bd){return new BPromise(function(_0x39372c,_0x49a8ae){return client[_0x4218('0x9')](_0x48d4d4,_0x2796bd)[_0x4218('0xa')](function(_0xd7d2c){logger[_0x4218('0xb')](_0x4218('0xc'),_0x1411c5,_0x4218('0xd'));logger[_0x4218('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1411c5,_0x4218('0xd'),JSON[_0x4218('0xf')](_0xd7d2c));if(_0xd7d2c[_0x4218('0x10')]){if(_0xd7d2c[_0x4218('0x10')][_0x4218('0x11')]===0x1f4){logger[_0x4218('0x10')](_0x4218('0xc'),_0x1411c5,_0xd7d2c[_0x4218('0x10')]['message']);return _0x49a8ae(_0xd7d2c['error'][_0x4218('0x12')]);}logger[_0x4218('0x10')]('Cdr,\x20%s,\x20%s',_0x1411c5,_0xd7d2c[_0x4218('0x10')]['message']);return _0x39372c(_0xd7d2c['error'][_0x4218('0x12')]);}else{logger[_0x4218('0xb')]('Cdr,\x20%s,\x20%s',_0x1411c5,'request\x20sent');_0x39372c(_0xd7d2c[_0x4218('0x13')][_0x4218('0x12')]);}})[_0x4218('0x14')](function(_0x3733b6){logger[_0x4218('0x10')](_0x4218('0xc'),_0x1411c5,_0x3733b6);_0x49a8ae(_0x3733b6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3e99dba..ff64abb 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(_0x4879f7,_0x33749d){var _0x41771a=function(_0x456a6a){while(--_0x456a6a){_0x4879f7['push'](_0x4879f7['shift']());}};_0x41771a(++_0x33749d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x11356d,_0x26feca){var _0x128ee9=function(_0x621ae2){while(--_0x621ae2){_0x11356d['push'](_0x11356d['shift']());}};_0x128ee9(++_0x26feca);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0xb10b[_0x1c97c8];return _0x2c096d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e26919f..c4e3d29 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 _0x473a=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xb73200,_0x4344df){var _0x1dec72=function(_0x190bde){while(--_0x190bde){_0xb73200['push'](_0xb73200['shift']());}};_0x1dec72(++_0x4344df);}(_0x473a,0x1b9));var _0xa473=function(_0x2ff5b0,_0x4cfb33){_0x2ff5b0=_0x2ff5b0-0x0;var _0x5a86cc=_0x473a[_0x2ff5b0];return _0x5a86cc;};'use strict';var Sequelize=require(_0xa473('0x0'));module[_0xa473('0x1')]={'priority':{'type':Sequelize[_0xa473('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa473('0x3')],'allowNull':![],'defaultValue':_0xa473('0x4')},'appdata':{'type':Sequelize[_0xa473('0x5')]()},'description':{'type':Sequelize[_0xa473('0x3')]},'interval':{'type':Sequelize[_0xa473('0x3')],'defaultValue':_0xa473('0x6')}}; \ No newline at end of file +var _0xc005=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xc005,0x9d));var _0x5c00=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xc005[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require(_0x5c00('0x0'));module[_0x5c00('0x1')]={'priority':{'type':Sequelize[_0x5c00('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5c00('0x3')],'allowNull':![],'defaultValue':_0x5c00('0x4')},'appdata':{'type':Sequelize[_0x5c00('0x5')]()},'description':{'type':Sequelize[_0x5c00('0x3')]},'interval':{'type':Sequelize[_0x5c00('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ff1ef51..ad2f23a 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 _0xb677=['merge','ChatApplication','find','catch','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include'];(function(_0x438945,_0x51ddc8){var _0x19f72e=function(_0x45a262){while(--_0x45a262){_0x438945['push'](_0x438945['shift']());}};_0x19f72e(++_0x51ddc8);}(_0xb677,0x119));var _0x7b67=function(_0x4aeb7,_0x596e86){_0x4aeb7=_0x4aeb7-0x0;var _0x891d62=_0xb677[_0x4aeb7];return _0x891d62;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b67('0x1'));var jsonpatch=require(_0x7b67('0x2'));var rp=require(_0x7b67('0x3'));var moment=require(_0x7b67('0x4'));var BPromise=require(_0x7b67('0x5'));var Mustache=require(_0x7b67('0x6'));var util=require(_0x7b67('0x7'));var path=require(_0x7b67('0x8'));var sox=require('sox');var csv=require(_0x7b67('0x9'));var ejs=require(_0x7b67('0xa'));var fs=require('fs');var fs_extra=require(_0x7b67('0xb'));var _=require(_0x7b67('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7b67('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b67('0xf'));var authService=require(_0x7b67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b67('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b67('0x12'))(_0x7b67('0x13'));var utils=require(_0x7b67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b402,_0x454df4){_0x454df4=_0x454df4||0xcc;return function(_0x1e17fc){if(_0x1e17fc){return _0x25b402[_0x7b67('0x15')](_0x454df4);}return _0x25b402[_0x7b67('0x16')](_0x454df4)[_0x7b67('0x17')]();};}function respondWithResult(_0x4f15f5,_0x37eb7a){_0x37eb7a=_0x37eb7a||0xc8;return function(_0x473d10){if(_0x473d10){return _0x4f15f5[_0x7b67('0x16')](_0x37eb7a)[_0x7b67('0x18')](_0x473d10);}};}function respondWithFilteredResult(_0x377208,_0x309f1c){return function(_0x1861d1){if(_0x1861d1){var _0xf99987=typeof _0x309f1c['offset']===_0x7b67('0x19')&&typeof _0x309f1c[_0x7b67('0x1a')]===_0x7b67('0x19');var _0x41e23d=_0x1861d1[_0x7b67('0x1b')];var _0x18d9da=_0xf99987?0x0:_0x309f1c['offset'];var _0x33f462=_0xf99987?_0x1861d1[_0x7b67('0x1b')]:_0x309f1c[_0x7b67('0x1c')]+_0x309f1c[_0x7b67('0x1a')];var _0x4732dc;if(_0x33f462>=_0x41e23d){_0x33f462=_0x41e23d;_0x4732dc=0xc8;}else{_0x4732dc=0xce;}_0x377208[_0x7b67('0x16')](_0x4732dc);return _0x377208[_0x7b67('0x1d')](_0x7b67('0x1e'),_0x18d9da+'-'+_0x33f462+'/'+_0x41e23d)[_0x7b67('0x18')](_0x1861d1);}return null;};}function patchUpdates(_0x8f1cbe){return function(_0x5ddb36){try{jsonpatch[_0x7b67('0x1f')](_0x5ddb36,_0x8f1cbe,!![]);}catch(_0x16bc9b){return BPromise['reject'](_0x16bc9b);}return _0x5ddb36['save']();};}function saveUpdates(_0x48cd2e,_0x48944a){return function(_0x44b951){if(_0x44b951){return _0x44b951[_0x7b67('0x20')](_0x48cd2e)[_0x7b67('0x21')](function(_0x3042fe){return _0x3042fe;});}return null;};}function removeEntity(_0x2c3f11,_0x56b952){return function(_0x3b4fea){if(_0x3b4fea){return _0x3b4fea[_0x7b67('0x22')]()[_0x7b67('0x21')](function(){_0x2c3f11[_0x7b67('0x16')](0xcc)[_0x7b67('0x17')]();});}};}function handleEntityNotFound(_0x3e9630,_0x2b6da7){return function(_0x50e71c){if(!_0x50e71c){_0x3e9630[_0x7b67('0x15')](0x194);}return _0x50e71c;};}function handleError(_0x4b29e0,_0x45da6b){_0x45da6b=_0x45da6b||0x1f4;return function(_0x2f1e62){logger[_0x7b67('0x23')](_0x2f1e62[_0x7b67('0x24')]);if(_0x2f1e62['name']){delete _0x2f1e62[_0x7b67('0x25')];}_0x4b29e0[_0x7b67('0x16')](_0x45da6b)[_0x7b67('0x26')](_0x2f1e62);};}exports['show']=function(_0x5e35c9,_0x5ac43f){var _0x8649ec={'raw':!![],'where':{'id':_0x5e35c9['params']['id']}},_0x4bd8b7={};_0x4bd8b7[_0x7b67('0x27')]=_[_0x7b67('0x28')](db['ChatApplication'][_0x7b67('0x29')]);_0x4bd8b7['query']=_['keys'](_0x5e35c9[_0x7b67('0x2a')]);_0x4bd8b7[_0x7b67('0x2b')]=_[_0x7b67('0x2c')](_0x4bd8b7[_0x7b67('0x27')],_0x4bd8b7[_0x7b67('0x2a')]);_0x8649ec[_0x7b67('0x2d')]=_[_0x7b67('0x2c')](_0x4bd8b7[_0x7b67('0x27')],qs[_0x7b67('0x2e')](_0x5e35c9[_0x7b67('0x2a')][_0x7b67('0x2e')]));_0x8649ec[_0x7b67('0x2d')]=_0x8649ec[_0x7b67('0x2d')][_0x7b67('0x2f')]?_0x8649ec[_0x7b67('0x2d')]:_0x4bd8b7[_0x7b67('0x27')];if(_0x5e35c9[_0x7b67('0x2a')]['includeAll']){_0x8649ec[_0x7b67('0x30')]=[{'all':!![]}];}_0x8649ec=_[_0x7b67('0x31')]({},_0x8649ec,_0x5e35c9['options']);return db[_0x7b67('0x32')][_0x7b67('0x33')](_0x8649ec)[_0x7b67('0x21')](handleEntityNotFound(_0x5ac43f,null))[_0x7b67('0x21')](respondWithResult(_0x5ac43f,null))[_0x7b67('0x34')](handleError(_0x5ac43f,null));};exports[_0x7b67('0x20')]=function(_0x30fa40,_0x3a9bc9){if(_0x30fa40[_0x7b67('0x35')]['id']){delete _0x30fa40[_0x7b67('0x35')]['id'];}return db[_0x7b67('0x32')][_0x7b67('0x33')]({'where':{'id':_0x30fa40[_0x7b67('0x36')]['id']}})['then'](handleEntityNotFound(_0x3a9bc9,null))[_0x7b67('0x21')](saveUpdates(_0x30fa40[_0x7b67('0x35')],null))[_0x7b67('0x21')](respondWithResult(_0x3a9bc9,null))[_0x7b67('0x34')](handleError(_0x3a9bc9,null));};exports['destroy']=function(_0xc080e4,_0x17fe14){return db[_0x7b67('0x32')][_0x7b67('0x33')]({'where':{'id':_0xc080e4[_0x7b67('0x36')]['id']}})['then'](handleEntityNotFound(_0x17fe14,null))[_0x7b67('0x21')](removeEntity(_0x17fe14,null))[_0x7b67('0x34')](handleError(_0x17fe14,null));}; \ No newline at end of file +var _0x9147=['util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x563a8e,_0x4dd781){var _0x45baa0=function(_0x36fbf9){while(--_0x36fbf9){_0x563a8e['push'](_0x563a8e['shift']());}};_0x45baa0(++_0x4dd781);}(_0x9147,0x7b));var _0x7914=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9147[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7914('0x0'));var rimraf=require(_0x7914('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7914('0x2'));var rp=require('request-promise');var moment=require(_0x7914('0x3'));var BPromise=require(_0x7914('0x4'));var Mustache=require('mustache');var util=require(_0x7914('0x5'));var path=require(_0x7914('0x6'));var sox=require(_0x7914('0x7'));var csv=require('to-csv');var ejs=require(_0x7914('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7914('0x9'));var squel=require('squel');var crypto=require(_0x7914('0xa'));var jsforce=require(_0x7914('0xb'));var deskjs=require(_0x7914('0xc'));var toCsv=require(_0x7914('0xd'));var querystring=require(_0x7914('0xe'));var Papa=require(_0x7914('0xf'));var Redis=require(_0x7914('0x10'));var authService=require(_0x7914('0x11'));var qs=require(_0x7914('0x12'));var as=require(_0x7914('0x13'));var hardwareService=require(_0x7914('0x14'));var logger=require(_0x7914('0x15'))(_0x7914('0x16'));var utils=require(_0x7914('0x17'));var config=require(_0x7914('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7914('0x19'))['db'];function respondWithStatusCode(_0x29050a,_0x1c47ad){_0x1c47ad=_0x1c47ad||0xcc;return function(_0x1e6768){if(_0x1e6768){return _0x29050a[_0x7914('0x1a')](_0x1c47ad);}return _0x29050a['status'](_0x1c47ad)[_0x7914('0x1b')]();};}function respondWithResult(_0x30d365,_0x2dd5a1){_0x2dd5a1=_0x2dd5a1||0xc8;return function(_0x5a8574){if(_0x5a8574){return _0x30d365[_0x7914('0x1c')](_0x2dd5a1)['json'](_0x5a8574);}};}function respondWithFilteredResult(_0xc2acd1,_0x12a59b){return function(_0x57e5b1){if(_0x57e5b1){var _0x1bc814=typeof _0x12a59b[_0x7914('0x1d')]===_0x7914('0x1e')&&typeof _0x12a59b[_0x7914('0x1f')]===_0x7914('0x1e');var _0x4cb627=_0x57e5b1[_0x7914('0x20')];var _0x438a91=_0x1bc814?0x0:_0x12a59b[_0x7914('0x1d')];var _0x305923=_0x1bc814?_0x57e5b1['count']:_0x12a59b['offset']+_0x12a59b[_0x7914('0x1f')];var _0x5098c3;if(_0x305923>=_0x4cb627){_0x305923=_0x4cb627;_0x5098c3=0xc8;}else{_0x5098c3=0xce;}_0xc2acd1[_0x7914('0x1c')](_0x5098c3);return _0xc2acd1[_0x7914('0x21')](_0x7914('0x22'),_0x438a91+'-'+_0x305923+'/'+_0x4cb627)[_0x7914('0x23')](_0x57e5b1);}return null;};}function patchUpdates(_0xfe14de){return function(_0x585898){try{jsonpatch[_0x7914('0x24')](_0x585898,_0xfe14de,!![]);}catch(_0xca996f){return BPromise[_0x7914('0x25')](_0xca996f);}return _0x585898[_0x7914('0x26')]();};}function saveUpdates(_0x552d24,_0x46da43){return function(_0xbc979){if(_0xbc979){return _0xbc979['update'](_0x552d24)[_0x7914('0x27')](function(_0x7777f9){return _0x7777f9;});}return null;};}function removeEntity(_0x1fb96b,_0x138aa0){return function(_0x5ce556){if(_0x5ce556){return _0x5ce556['destroy']()['then'](function(){_0x1fb96b[_0x7914('0x1c')](0xcc)[_0x7914('0x1b')]();});}};}function handleEntityNotFound(_0x76084c,_0x3aef36){return function(_0x483824){if(!_0x483824){_0x76084c[_0x7914('0x1a')](0x194);}return _0x483824;};}function handleError(_0x1154fa,_0xb3fc3e){_0xb3fc3e=_0xb3fc3e||0x1f4;return function(_0x1bcd29){logger[_0x7914('0x28')](_0x1bcd29[_0x7914('0x29')]);if(_0x1bcd29[_0x7914('0x2a')]){delete _0x1bcd29[_0x7914('0x2a')];}_0x1154fa['status'](_0xb3fc3e)[_0x7914('0x2b')](_0x1bcd29);};}exports[_0x7914('0x2c')]=function(_0x40fcaf,_0x2dfcf7){var _0x4988a4={'raw':!![],'where':{'id':_0x40fcaf[_0x7914('0x2d')]['id']}},_0x241feb={};_0x241feb[_0x7914('0x2e')]=_['keys'](db[_0x7914('0x2f')][_0x7914('0x30')]);_0x241feb[_0x7914('0x31')]=_[_0x7914('0x32')](_0x40fcaf[_0x7914('0x31')]);_0x241feb[_0x7914('0x33')]=_['intersection'](_0x241feb[_0x7914('0x2e')],_0x241feb['query']);_0x4988a4['attributes']=_[_0x7914('0x34')](_0x241feb[_0x7914('0x2e')],qs[_0x7914('0x35')](_0x40fcaf[_0x7914('0x31')][_0x7914('0x35')]));_0x4988a4['attributes']=_0x4988a4[_0x7914('0x36')][_0x7914('0x37')]?_0x4988a4[_0x7914('0x36')]:_0x241feb['model'];if(_0x40fcaf[_0x7914('0x31')][_0x7914('0x38')]){_0x4988a4[_0x7914('0x39')]=[{'all':!![]}];}_0x4988a4=_[_0x7914('0x3a')]({},_0x4988a4,_0x40fcaf[_0x7914('0x3b')]);return db[_0x7914('0x2f')][_0x7914('0x3c')](_0x4988a4)['then'](handleEntityNotFound(_0x2dfcf7,null))[_0x7914('0x27')](respondWithResult(_0x2dfcf7,null))[_0x7914('0x3d')](handleError(_0x2dfcf7,null));};exports[_0x7914('0x3e')]=function(_0x3aff0e,_0x1a5674){if(_0x3aff0e[_0x7914('0x3f')]['id']){delete _0x3aff0e[_0x7914('0x3f')]['id'];}return db['ChatApplication'][_0x7914('0x3c')]({'where':{'id':_0x3aff0e['params']['id']}})[_0x7914('0x27')](handleEntityNotFound(_0x1a5674,null))[_0x7914('0x27')](saveUpdates(_0x3aff0e[_0x7914('0x3f')],null))[_0x7914('0x27')](respondWithResult(_0x1a5674,null))[_0x7914('0x3d')](handleError(_0x1a5674,null));};exports['destroy']=function(_0x1019b0,_0x123d79){return db[_0x7914('0x2f')][_0x7914('0x3c')]({'where':{'id':_0x1019b0[_0x7914('0x2d')]['id']}})['then'](handleEntityNotFound(_0x123d79,null))[_0x7914('0x27')](removeEntity(_0x123d79,null))[_0x7914('0x3d')](handleError(_0x123d79,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 50bb07e..fca4099 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 _0x8cec=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x51e5bd,_0x3c2cf1){var _0x250aed=function(_0x17120c){while(--_0x17120c){_0x51e5bd['push'](_0x51e5bd['shift']());}};_0x250aed(++_0x3c2cf1);}(_0x8cec,0x104));var _0xc8ce=function(_0x5135ba,_0x5049bb){_0x5135ba=_0x5135ba-0x0;var _0x2dd42c=_0x8cec[_0x5135ba];return _0x2dd42c;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8ce('0xc'),'collate':_0xc8ce('0xd')});}; \ No newline at end of file +var _0x280f=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x175290,_0x42e572){var _0x52bd78=function(_0xea7cc7){while(--_0xea7cc7){_0x175290['push'](_0x175290['shift']());}};_0x52bd78(++_0x42e572);}(_0x280f,0xe2));var _0xf280=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x280f[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0xf280('0x0'));var util=require('util');var logger=require(_0xf280('0x1'))(_0xf280('0x2'));var moment=require(_0xf280('0x3'));var BPromise=require(_0xf280('0x4'));var rp=require(_0xf280('0x5'));var fs=require('fs');var path=require(_0xf280('0x6'));var rimraf=require(_0xf280('0x7'));var config=require('../../config/environment');var attributes=require(_0xf280('0x8'));module[_0xf280('0x9')]=function(_0x23925d,_0x34eef7){return _0x23925d[_0xf280('0xa')]('ChatApplication',attributes,{'tableName':_0xf280('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf280('0xc'),'collate':_0xf280('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index bccd897..073241f 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 _0x9be4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x516c1f,_0x2aa7eb){var _0x9c709d=function(_0x41665c){while(--_0x41665c){_0x516c1f['push'](_0x516c1f['shift']());}};_0x9c709d(++_0x2aa7eb);}(_0x9be4,0x9b));var _0x49be=function(_0x3c8ead,_0xb3b3ef){_0x3c8ead=_0x3c8ead-0x0;var _0x3db404=_0x9be4[_0x3c8ead];return _0x3db404;};'use strict';var _=require(_0x49be('0x0'));var util=require(_0x49be('0x1'));var moment=require(_0x49be('0x2'));var BPromise=require('bluebird');var rs=require(_0x49be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49be('0x4'))['db'];var utils=require(_0x49be('0x5'));var logger=require(_0x49be('0x6'))(_0x49be('0x7'));var config=require(_0x49be('0x8'));var jayson=require(_0x49be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xad6d9b,_0x4a5498,_0xca0bc0){return new BPromise(function(_0x30723d,_0x459c1e){return client[_0x49be('0xa')](_0xad6d9b,_0xca0bc0)['then'](function(_0x26853f){logger['info'](_0x49be('0xb'),_0x4a5498,_0x49be('0xc'));logger['debug'](_0x49be('0xd'),_0x4a5498,_0x49be('0xc'),JSON[_0x49be('0xe')](_0x26853f));if(_0x26853f[_0x49be('0xf')]){if(_0x26853f[_0x49be('0xf')][_0x49be('0x10')]===0x1f4){logger[_0x49be('0xf')](_0x49be('0xb'),_0x4a5498,_0x26853f[_0x49be('0xf')][_0x49be('0x11')]);return _0x459c1e(_0x26853f['error']['message']);}logger[_0x49be('0xf')](_0x49be('0xb'),_0x4a5498,_0x26853f[_0x49be('0xf')][_0x49be('0x11')]);return _0x30723d(_0x26853f[_0x49be('0xf')][_0x49be('0x11')]);}else{logger[_0x49be('0x12')](_0x49be('0xb'),_0x4a5498,_0x49be('0xc'));_0x30723d(_0x26853f[_0x49be('0x13')]['message']);}})['catch'](function(_0x4135e0){logger[_0x49be('0xf')](_0x49be('0xb'),_0x4a5498,_0x4135e0);_0x459c1e(_0x4135e0);});});} \ No newline at end of file +var _0x3b3b=['message','info','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3b3b,0x1bc));var _0xb3b3=function(_0x17bd9d,_0x518dcf){_0x17bd9d=_0x17bd9d-0x0;var _0x1aad9b=_0x3b3b[_0x17bd9d];return _0x1aad9b;};'use strict';var _=require(_0xb3b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3b3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3b3('0x2'));var db=require(_0xb3b3('0x3'))['db'];var utils=require(_0xb3b3('0x4'));var logger=require(_0xb3b3('0x5'))(_0xb3b3('0x6'));var config=require(_0xb3b3('0x7'));var jayson=require(_0xb3b3('0x8'));var client=jayson[_0xb3b3('0x9')][_0xb3b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x118f2d,_0x35daad,_0x20fb7c){return new BPromise(function(_0x5b31cd,_0x319478){return client[_0xb3b3('0xb')](_0x118f2d,_0x20fb7c)[_0xb3b3('0xc')](function(_0x888ad5){logger['info']('ChatApplication,\x20%s,\x20%s',_0x35daad,_0xb3b3('0xd'));logger['debug'](_0xb3b3('0xe'),_0x35daad,_0xb3b3('0xd'),JSON['stringify'](_0x888ad5));if(_0x888ad5[_0xb3b3('0xf')]){if(_0x888ad5['error'][_0xb3b3('0x10')]===0x1f4){logger[_0xb3b3('0xf')](_0xb3b3('0x11'),_0x35daad,_0x888ad5[_0xb3b3('0xf')][_0xb3b3('0x12')]);return _0x319478(_0x888ad5[_0xb3b3('0xf')][_0xb3b3('0x12')]);}logger[_0xb3b3('0xf')]('ChatApplication,\x20%s,\x20%s',_0x35daad,_0x888ad5[_0xb3b3('0xf')]['message']);return _0x5b31cd(_0x888ad5[_0xb3b3('0xf')][_0xb3b3('0x12')]);}else{logger[_0xb3b3('0x13')]('ChatApplication,\x20%s,\x20%s',_0x35daad,_0xb3b3('0xd'));_0x5b31cd(_0x888ad5['result'][_0xb3b3('0x12')]);}})[_0xb3b3('0x14')](function(_0x110c53){logger[_0xb3b3('0xf')]('ChatApplication,\x20%s,\x20%s',_0x35daad,_0x110c53);_0x319478(_0x110c53);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f48abb4..7cb10b0 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 _0x1bfe=['get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1bfe,0x1d4));var _0xe1bf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1bfe[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xe1bf('0x0'));var util=require(_0xe1bf('0x1'));var path=require('path');var timeout=require(_0xe1bf('0x2'));var express=require(_0xe1bf('0x3'));var router=express[_0xe1bf('0x4')]();var fs_extra=require(_0xe1bf('0x5'));var auth=require(_0xe1bf('0x6'));var interaction=require(_0xe1bf('0x7'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xe1bf('0x8')](_0xe1bf('0x9'),auth[_0xe1bf('0xa')](),controller[_0xe1bf('0xb')]);router[_0xe1bf('0xc')](_0xe1bf('0x9'),auth[_0xe1bf('0xa')](),controller[_0xe1bf('0xd')]);router[_0xe1bf('0xe')](_0xe1bf('0x9'),auth[_0xe1bf('0xa')](),controller[_0xe1bf('0xf')]);module[_0xe1bf('0x10')]=router; \ No newline at end of file +var _0x05bf=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','destroy'];(function(_0x4e314f,_0xfe7dee){var _0x15f4d7=function(_0x34cee9){while(--_0x34cee9){_0x4e314f['push'](_0x4e314f['shift']());}};_0x15f4d7(++_0xfe7dee);}(_0x05bf,0x1e1));var _0xf05b=function(_0x22041b,_0x15a8b0){_0x22041b=_0x22041b-0x0;var _0x4fa12b=_0x05bf[_0x22041b];return _0x4fa12b;};'use strict';var multer=require(_0xf05b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf05b('0x1'));var express=require(_0xf05b('0x2'));var router=express[_0xf05b('0x3')]();var fs_extra=require(_0xf05b('0x4'));var auth=require(_0xf05b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf05b('0x6'));var controller=require(_0xf05b('0x7'));router['get'](_0xf05b('0x8'),auth[_0xf05b('0x9')](),controller[_0xf05b('0xa')]);router[_0xf05b('0xb')](_0xf05b('0x8'),auth[_0xf05b('0x9')](),controller['update']);router[_0xf05b('0xc')]('/:id',auth[_0xf05b('0x9')](),controller[_0xf05b('0xd')]);module[_0xf05b('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 86b124c..addb9ae 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 _0xb0b3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x36fecd,_0x116aa6){var _0x3cad6d=function(_0x82aa09){while(--_0x82aa09){_0x36fecd['push'](_0x36fecd['shift']());}};_0x3cad6d(++_0x116aa6);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x23732e,_0x47989b){_0x23732e=_0x23732e-0x0;var _0x28ca3d=_0xb0b3[_0x23732e];return _0x28ca3d;};'use strict';var Sequelize=require(_0x3b0b('0x0'));module[_0x3b0b('0x1')]={'name':{'type':Sequelize[_0x3b0b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3b0b('0x2')]},'write':{'type':Sequelize[_0x3b0b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2a8b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4b3803,_0x5c7ff3){var _0x2f7d0f=function(_0x192c4a){while(--_0x192c4a){_0x4b3803['push'](_0x4b3803['shift']());}};_0x2f7d0f(++_0x5c7ff3);}(_0x2a8b,0x10a));var _0xb2a8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2a8b[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0xb2a8('0x0'));module[_0xb2a8('0x1')]={'name':{'type':Sequelize[_0xb2a8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb2a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index e150516..8cb0957 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 _0x0526=['addMembers','ids','omit','getMembers','findOne','User','pick','hasOwnProperty','addMessage','ChatGroupId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','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/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','keys','create','body','find','params','describe','ChatInternalMessage','user','toInteger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0526,0x18b));var _0x6052=function(_0x312b01,_0x1b5f53){_0x312b01=_0x312b01-0x0;var _0x50734e=_0x0526[_0x312b01];return _0x50734e;};'use strict';var emlformat=require(_0x6052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6052('0x1'));var jsonpatch=require(_0x6052('0x2'));var rp=require(_0x6052('0x3'));var moment=require(_0x6052('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6052('0x5'));var util=require(_0x6052('0x6'));var path=require(_0x6052('0x7'));var sox=require('sox');var csv=require(_0x6052('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6052('0x9'));var _=require('lodash');var squel=require(_0x6052('0xa'));var crypto=require(_0x6052('0xb'));var jsforce=require(_0x6052('0xc'));var deskjs=require(_0x6052('0xd'));var toCsv=require(_0x6052('0x8'));var querystring=require('querystring');var Papa=require(_0x6052('0xe'));var Redis=require(_0x6052('0xf'));var authService=require(_0x6052('0x10'));var qs=require(_0x6052('0x11'));var as=require(_0x6052('0x12'));var hardwareService=require(_0x6052('0x13'));var logger=require(_0x6052('0x14'))(_0x6052('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6052('0x16'));var db=require(_0x6052('0x17'))['db'];config[_0x6052('0x18')]=_[_0x6052('0x19')](config['redis'],{'host':_0x6052('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6052('0x18')]));require(_0x6052('0x1b'))[_0x6052('0x1c')](socket);function respondWithStatusCode(_0x19a209,_0x20fead){_0x20fead=_0x20fead||0xcc;return function(_0x1d4ede){if(_0x1d4ede){return _0x19a209[_0x6052('0x1d')](_0x20fead);}return _0x19a209[_0x6052('0x1e')](_0x20fead)[_0x6052('0x1f')]();};}function respondWithResult(_0x3a7806,_0x1347e1){_0x1347e1=_0x1347e1||0xc8;return function(_0xb232d){if(_0xb232d){return _0x3a7806[_0x6052('0x1e')](_0x1347e1)[_0x6052('0x20')](_0xb232d);}};}function respondWithFilteredResult(_0x183085,_0x13cb9c){return function(_0x1ce033){if(_0x1ce033){var _0x587cb1=typeof _0x13cb9c[_0x6052('0x21')]===_0x6052('0x22')&&typeof _0x13cb9c[_0x6052('0x23')]===_0x6052('0x22');var _0x3a58e0=_0x1ce033[_0x6052('0x24')];var _0x1b6dde=_0x587cb1?0x0:_0x13cb9c[_0x6052('0x21')];var _0x4dfb5a=_0x587cb1?_0x1ce033[_0x6052('0x24')]:_0x13cb9c[_0x6052('0x21')]+_0x13cb9c[_0x6052('0x23')];var _0x10ac80;if(_0x4dfb5a>=_0x3a58e0){_0x4dfb5a=_0x3a58e0;_0x10ac80=0xc8;}else{_0x10ac80=0xce;}_0x183085[_0x6052('0x1e')](_0x10ac80);return _0x183085[_0x6052('0x25')](_0x6052('0x26'),_0x1b6dde+'-'+_0x4dfb5a+'/'+_0x3a58e0)['json'](_0x1ce033);}return null;};}function patchUpdates(_0x1bb77e){return function(_0x2e3e12){try{jsonpatch[_0x6052('0x27')](_0x2e3e12,_0x1bb77e,!![]);}catch(_0xa6f68){return BPromise['reject'](_0xa6f68);}return _0x2e3e12[_0x6052('0x28')]();};}function saveUpdates(_0x1f5e5d,_0x4a87a1){return function(_0x3320ed){if(_0x3320ed){return _0x3320ed[_0x6052('0x29')](_0x1f5e5d)[_0x6052('0x2a')](function(_0x36fd6a){return _0x36fd6a;});}return null;};}function removeEntity(_0x291dfe,_0x59d82d){return function(_0x1ad233){if(_0x1ad233){return _0x1ad233[_0x6052('0x2b')]()[_0x6052('0x2a')](function(){_0x291dfe[_0x6052('0x1e')](0xcc)[_0x6052('0x1f')]();});}};}function handleEntityNotFound(_0x34399a,_0x799d71){return function(_0x56d32d){if(!_0x56d32d){_0x34399a[_0x6052('0x1d')](0x194);}return _0x56d32d;};}function handleError(_0x5d3171,_0x177300){_0x177300=_0x177300||0x1f4;return function(_0x496db4){logger['error'](_0x496db4[_0x6052('0x2c')]);if(_0x496db4['name']){delete _0x496db4[_0x6052('0x2d')];}_0x5d3171['status'](_0x177300)[_0x6052('0x2e')](_0x496db4);};}exports[_0x6052('0x2f')]=function(_0x480bea,_0x1ba0db){var _0x4f0a1a={},_0x4b1faa={},_0x16f5e4={'count':0x0,'rows':[]};var _0x2620b9=_[_0x6052('0x30')](db[_0x6052('0x31')][_0x6052('0x32')],function(_0x341b23){return{'name':_0x341b23['fieldName'],'type':_0x341b23[_0x6052('0x33')][_0x6052('0x34')]};});_0x4b1faa[_0x6052('0x35')]=_['map'](_0x2620b9,_0x6052('0x2d'));_0x4b1faa['query']=_['keys'](_0x480bea[_0x6052('0x36')]);_0x4b1faa[_0x6052('0x37')]=_[_0x6052('0x38')](_0x4b1faa[_0x6052('0x35')],_0x4b1faa[_0x6052('0x36')]);_0x4f0a1a[_0x6052('0x39')]=_[_0x6052('0x38')](_0x4b1faa[_0x6052('0x35')],qs[_0x6052('0x3a')](_0x480bea[_0x6052('0x36')][_0x6052('0x3a')]));_0x4f0a1a[_0x6052('0x39')]=_0x4f0a1a[_0x6052('0x39')][_0x6052('0x3b')]?_0x4f0a1a['attributes']:_0x4b1faa[_0x6052('0x35')];if(!_0x480bea['query']['hasOwnProperty']('nolimit')){_0x4f0a1a[_0x6052('0x23')]=qs[_0x6052('0x23')](_0x480bea[_0x6052('0x36')][_0x6052('0x23')]);_0x4f0a1a[_0x6052('0x21')]=qs[_0x6052('0x21')](_0x480bea[_0x6052('0x36')][_0x6052('0x21')]);}_0x4f0a1a[_0x6052('0x3c')]=qs[_0x6052('0x3d')](_0x480bea[_0x6052('0x36')]['sort']);_0x4f0a1a[_0x6052('0x3e')]=qs[_0x6052('0x37')](_['pick'](_0x480bea[_0x6052('0x36')],_0x4b1faa[_0x6052('0x37')]),_0x2620b9);if(_0x480bea[_0x6052('0x36')][_0x6052('0x3f')]){_0x4f0a1a[_0x6052('0x3e')]=_[_0x6052('0x40')](_0x4f0a1a[_0x6052('0x3e')],{'$or':_[_0x6052('0x30')](_0x2620b9,function(_0x50ff64){if(_0x50ff64[_0x6052('0x33')]!==_0x6052('0x41')){var _0x901e7a={};_0x901e7a[_0x50ff64[_0x6052('0x2d')]]={'$like':'%'+_0x480bea[_0x6052('0x36')][_0x6052('0x3f')]+'%'};return _0x901e7a;}})});}_0x4f0a1a=_['merge']({},_0x4f0a1a,_0x480bea[_0x6052('0x42')]);var _0x43948b={'where':_0x4f0a1a['where']};return db[_0x6052('0x31')][_0x6052('0x24')](_0x43948b)['then'](function(_0xda7b6){_0x16f5e4['count']=_0xda7b6;if(_0x480bea[_0x6052('0x36')][_0x6052('0x43')]){_0x4f0a1a[_0x6052('0x44')]=[{'all':!![]}];}return db[_0x6052('0x31')]['findAll'](_0x4f0a1a);})[_0x6052('0x2a')](function(_0x492d72){_0x16f5e4['rows']=_0x492d72;return _0x16f5e4;})[_0x6052('0x2a')](respondWithFilteredResult(_0x1ba0db,_0x4f0a1a))[_0x6052('0x45')](handleError(_0x1ba0db,null));};exports[_0x6052('0x46')]=function(_0x2113f6,_0x96c50e){var _0x14ce9e={'raw':!![],'where':{'id':_0x2113f6['params']['id']}},_0x57e6b3={};_0x57e6b3[_0x6052('0x35')]=_[_0x6052('0x47')](db[_0x6052('0x31')][_0x6052('0x32')]);_0x57e6b3[_0x6052('0x36')]=_[_0x6052('0x47')](_0x2113f6['query']);_0x57e6b3[_0x6052('0x37')]=_['intersection'](_0x57e6b3['model'],_0x57e6b3[_0x6052('0x36')]);_0x14ce9e[_0x6052('0x39')]=_['intersection'](_0x57e6b3['model'],qs[_0x6052('0x3a')](_0x2113f6['query']['fields']));_0x14ce9e[_0x6052('0x39')]=_0x14ce9e[_0x6052('0x39')][_0x6052('0x3b')]?_0x14ce9e[_0x6052('0x39')]:_0x57e6b3[_0x6052('0x35')];if(_0x2113f6[_0x6052('0x36')]['includeAll']){_0x14ce9e['include']=[{'all':!![]}];}_0x14ce9e=_[_0x6052('0x40')]({},_0x14ce9e,_0x2113f6[_0x6052('0x42')]);return db[_0x6052('0x31')]['find'](_0x14ce9e)[_0x6052('0x2a')](handleEntityNotFound(_0x96c50e,null))[_0x6052('0x2a')](respondWithResult(_0x96c50e,null))['catch'](handleError(_0x96c50e,null));};exports[_0x6052('0x48')]=function(_0x120b51,_0x357f6a){return db[_0x6052('0x31')][_0x6052('0x48')](_0x120b51[_0x6052('0x49')],{})['then'](respondWithResult(_0x357f6a,0xc9))[_0x6052('0x45')](handleError(_0x357f6a,null));};exports[_0x6052('0x29')]=function(_0x18a574,_0x57ab9d){if(_0x18a574[_0x6052('0x49')]['id']){delete _0x18a574['body']['id'];}return db[_0x6052('0x31')][_0x6052('0x4a')]({'where':{'id':_0x18a574[_0x6052('0x4b')]['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x57ab9d,null))[_0x6052('0x2a')](saveUpdates(_0x18a574['body'],null))[_0x6052('0x2a')](respondWithResult(_0x57ab9d,null))['catch'](handleError(_0x57ab9d,null));};exports['destroy']=function(_0x218c04,_0x18ea07){return db[_0x6052('0x31')]['find']({'where':{'id':_0x218c04[_0x6052('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18ea07,null))[_0x6052('0x2a')](removeEntity(_0x18ea07,null))[_0x6052('0x45')](handleError(_0x18ea07,null));};exports[_0x6052('0x4c')]=function(_0x113708,_0x74b614){return db['ChatGroup']['describe']()[_0x6052('0x2a')](respondWithResult(_0x74b614,null))[_0x6052('0x45')](handleError(_0x74b614,null));};exports['getUnread']=function(_0x4527df,_0x1e2a43,_0xca240b){return db[_0x6052('0x4d')][_0x6052('0x24')]({'where':{'ChatGroupId':_0x4527df[_0x6052('0x4b')]['id'],'ToId':_0x4527df[_0x6052('0x4e')]['id'],'read':![]}})[_0x6052('0x2a')](function(_0x471dda){return{'id':_[_0x6052('0x4f')](_0x4527df[_0x6052('0x4b')]['id']),'count':_0x471dda};})[_0x6052('0x2a')](respondWithResult(_0x1e2a43,null))[_0x6052('0x45')](handleError(_0x1e2a43,null));};exports['addMembers']=function(_0x2c2173,_0x4b88f9,_0x2c37b1){return db[_0x6052('0x31')][_0x6052('0x4a')]({'where':{'id':_0x2c2173['params']['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x4b88f9,null))[_0x6052('0x2a')](function(_0x1a6835){if(_0x1a6835){return _0x1a6835[_0x6052('0x50')](_0x2c2173[_0x6052('0x49')][_0x6052('0x51')],_[_0x6052('0x52')](_0x2c2173[_0x6052('0x49')],['ids','id'])||{});}})[_0x6052('0x2a')](respondWithResult(_0x4b88f9,null))[_0x6052('0x45')](handleError(_0x4b88f9,null));};exports[_0x6052('0x53')]=function(_0x1a62ee,_0x4ff1ec,_0x201640){var _0x10583a={};var _0x4afb4e={};var _0x594bcb;var _0x3737c1;return db[_0x6052('0x31')][_0x6052('0x54')]({'where':{'id':_0x1a62ee['params']['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x4ff1ec,null))['then'](function(_0x9190a2){if(_0x9190a2){_0x594bcb=_0x9190a2;_0x4afb4e[_0x6052('0x35')]=_[_0x6052('0x47')](db[_0x6052('0x55')]['rawAttributes']);_0x4afb4e[_0x6052('0x36')]=_[_0x6052('0x47')](_0x1a62ee[_0x6052('0x36')]);_0x4afb4e[_0x6052('0x37')]=_[_0x6052('0x38')](_0x4afb4e[_0x6052('0x35')],_0x4afb4e[_0x6052('0x36')]);_0x10583a[_0x6052('0x39')]=_[_0x6052('0x38')](_0x4afb4e['model'],qs['fields'](_0x1a62ee[_0x6052('0x36')][_0x6052('0x3a')]));_0x10583a[_0x6052('0x39')]=_0x10583a[_0x6052('0x39')]['length']?_0x10583a[_0x6052('0x39')]:_0x4afb4e[_0x6052('0x35')];_0x10583a['order']=qs[_0x6052('0x3d')](_0x1a62ee[_0x6052('0x36')]['sort']);_0x10583a[_0x6052('0x3e')]=qs[_0x6052('0x37')](_[_0x6052('0x56')](_0x1a62ee[_0x6052('0x36')],_0x4afb4e[_0x6052('0x37')]));if(_0x1a62ee['query']['filter']){_0x10583a['where']=_['merge'](_0x10583a[_0x6052('0x3e')],{'$or':_['map'](_0x10583a[_0x6052('0x39')],function(_0x2bb7bc){var _0x4baf2d={};_0x4baf2d[_0x2bb7bc]={'$like':'%'+_0x1a62ee[_0x6052('0x36')][_0x6052('0x3f')]+'%'};return _0x4baf2d;})});}_0x10583a=_[_0x6052('0x40')]({},_0x10583a,_0x1a62ee[_0x6052('0x42')]);return _0x594bcb['getMembers'](_0x10583a);}})[_0x6052('0x2a')](function(_0x23797e){if(_0x23797e){_0x3737c1=_0x23797e[_0x6052('0x3b')];if(!_0x1a62ee['query'][_0x6052('0x57')]('nolimit')){_0x10583a[_0x6052('0x23')]=qs[_0x6052('0x23')](_0x1a62ee[_0x6052('0x36')][_0x6052('0x23')]);_0x10583a['offset']=qs[_0x6052('0x21')](_0x1a62ee[_0x6052('0x36')][_0x6052('0x21')]);}return _0x594bcb[_0x6052('0x53')](_0x10583a);}})[_0x6052('0x2a')](function(_0x48b202){if(_0x48b202){return _0x48b202?{'count':_0x3737c1,'rows':_0x48b202}:null;}})[_0x6052('0x2a')](respondWithResult(_0x4ff1ec,null))[_0x6052('0x45')](handleError(_0x4ff1ec,null));};exports['removeMembers']=function(_0x48bc75,_0x1cb979,_0x2ac38d){return db[_0x6052('0x31')][_0x6052('0x4a')]({'where':{'id':_0x48bc75[_0x6052('0x4b')]['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x1cb979,null))[_0x6052('0x2a')](function(_0x2fa597){if(_0x2fa597){return _0x2fa597['removeMembers'](_0x48bc75[_0x6052('0x36')][_0x6052('0x51')]);}})[_0x6052('0x2a')](respondWithStatusCode(_0x1cb979,null))[_0x6052('0x45')](handleError(_0x1cb979,null));};exports[_0x6052('0x58')]=function(_0x2feb2b,_0x88a207,_0x4601f3){if(_0x2feb2b[_0x6052('0x49')]['id']){delete _0x2feb2b[_0x6052('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2feb2b[_0x6052('0x4b')]['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x88a207,null))['then'](function(_0xfe4ce2){if(_0xfe4ce2){_0x2feb2b[_0x6052('0x49')][_0x6052('0x59')]=_0xfe4ce2['id'];return db['ChatInternalMessage'][_0x6052('0x48')](_0x2feb2b[_0x6052('0x49')]);}})['then'](respondWithResult(_0x88a207,null))[_0x6052('0x45')](handleError(_0x88a207,null));};exports['getMessages']=function(_0x134088,_0x5e7b7f,_0x328875){var _0x41cfac={};var _0x28ab7e={};var _0x32841b;var _0xc9b330;return db[_0x6052('0x31')]['findOne']({'where':{'id':_0x134088[_0x6052('0x4b')]['id']}})[_0x6052('0x2a')](handleEntityNotFound(_0x5e7b7f,null))['then'](function(_0x3e70c8){if(_0x3e70c8){_0x32841b=_0x3e70c8;_0x28ab7e[_0x6052('0x35')]=_[_0x6052('0x47')](db[_0x6052('0x4d')][_0x6052('0x32')]);_0x28ab7e['query']=_[_0x6052('0x47')](_0x134088[_0x6052('0x36')]);_0x28ab7e[_0x6052('0x37')]=_[_0x6052('0x38')](_0x28ab7e[_0x6052('0x35')],_0x28ab7e[_0x6052('0x36')]);_0x41cfac['attributes']=_['intersection'](_0x28ab7e['model'],qs[_0x6052('0x3a')](_0x134088['query'][_0x6052('0x3a')]));_0x41cfac[_0x6052('0x39')]=_0x41cfac['attributes'][_0x6052('0x3b')]?_0x41cfac[_0x6052('0x39')]:_0x28ab7e[_0x6052('0x35')];_0x41cfac[_0x6052('0x3c')]=qs[_0x6052('0x3d')](_0x134088[_0x6052('0x36')][_0x6052('0x3d')]);_0x41cfac[_0x6052('0x3e')]=qs[_0x6052('0x37')](_[_0x6052('0x56')](_0x134088[_0x6052('0x36')],_0x28ab7e[_0x6052('0x37')]));if(_0x134088[_0x6052('0x36')][_0x6052('0x3f')]){_0x41cfac[_0x6052('0x3e')]=_['merge'](_0x41cfac[_0x6052('0x3e')],{'$or':_[_0x6052('0x30')](_0x41cfac[_0x6052('0x39')],function(_0x162ab1){var _0xb858d1={};_0xb858d1[_0x162ab1]={'$like':'%'+_0x134088[_0x6052('0x36')][_0x6052('0x3f')]+'%'};return _0xb858d1;})});}if(_0x134088[_0x6052('0x36')][_0x6052('0x5a')]){var _0x5a95e9=_0x134088[_0x6052('0x36')][_0x6052('0x5a')][_0x6052('0x5b')](',');var _0x2ebbda={};_0x2ebbda[_0x5a95e9[0x0]]={'$gte':moment(_0x5a95e9[0x1])['format'](_0x6052('0x5c'))};_0x41cfac[_0x6052('0x3e')]=_[_0x6052('0x40')](_0x41cfac[_0x6052('0x3e')],_0x2ebbda);}_0x41cfac=_[_0x6052('0x40')]({},_0x41cfac,_0x134088[_0x6052('0x42')]);return _0x32841b[_0x6052('0x5d')](_0x41cfac);}})[_0x6052('0x2a')](function(_0x2e3691){if(_0x2e3691){_0xc9b330=_0x2e3691['length'];if(!_0x134088[_0x6052('0x36')][_0x6052('0x57')](_0x6052('0x5e'))){_0x41cfac[_0x6052('0x23')]=qs[_0x6052('0x23')](_0x134088[_0x6052('0x36')][_0x6052('0x23')]);_0x41cfac[_0x6052('0x21')]=qs[_0x6052('0x21')](_0x134088[_0x6052('0x36')]['offset']);}return _0x32841b[_0x6052('0x5d')](_0x41cfac);}})[_0x6052('0x2a')](function(_0x37d01d){if(_0x37d01d){return _0x37d01d?{'count':_0xc9b330,'rows':_0x37d01d}:null;}})['then'](respondWithResult(_0x5e7b7f,null))[_0x6052('0x45')](handleError(_0x5e7b7f,null));}; \ No newline at end of file +var _0xbc5a=['bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./chatGroup.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','destroy','then','end','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','getMessages','$gte','format','zip-dir','fast-json-patch','moment'];(function(_0xd7823b,_0x5da4e8){var _0x3229ee=function(_0x2b3ea2){while(--_0x2b3ea2){_0xd7823b['push'](_0xd7823b['shift']());}};_0x3229ee(++_0x5da4e8);}(_0xbc5a,0x1d3));var _0xabc5=function(_0x5d10c2,_0x4b0a49){_0x5d10c2=_0x5d10c2-0x0;var _0x57c7c4=_0xbc5a[_0x5d10c2];return _0x57c7c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xabc5('0x0'));var jsonpatch=require(_0xabc5('0x1'));var rp=require('request-promise');var moment=require(_0xabc5('0x2'));var BPromise=require(_0xabc5('0x3'));var Mustache=require(_0xabc5('0x4'));var util=require('util');var path=require(_0xabc5('0x5'));var sox=require(_0xabc5('0x6'));var csv=require('to-csv');var ejs=require(_0xabc5('0x7'));var fs=require('fs');var fs_extra=require(_0xabc5('0x8'));var _=require('lodash');var squel=require(_0xabc5('0x9'));var crypto=require(_0xabc5('0xa'));var jsforce=require(_0xabc5('0xb'));var deskjs=require(_0xabc5('0xc'));var toCsv=require(_0xabc5('0xd'));var querystring=require(_0xabc5('0xe'));var Papa=require(_0xabc5('0xf'));var Redis=require(_0xabc5('0x10'));var authService=require(_0xabc5('0x11'));var qs=require(_0xabc5('0x12'));var as=require(_0xabc5('0x13'));var hardwareService=require(_0xabc5('0x14'));var logger=require(_0xabc5('0x15'))(_0xabc5('0x16'));var utils=require(_0xabc5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xabc5('0x18'));var db=require(_0xabc5('0x19'))['db'];config[_0xabc5('0x1a')]=_['defaults'](config[_0xabc5('0x1a')],{'host':_0xabc5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabc5('0x1a')]));require(_0xabc5('0x1c'))[_0xabc5('0x1d')](socket);function respondWithStatusCode(_0x4d896d,_0x3090c3){_0x3090c3=_0x3090c3||0xcc;return function(_0x4a0ffc){if(_0x4a0ffc){return _0x4d896d[_0xabc5('0x1e')](_0x3090c3);}return _0x4d896d['status'](_0x3090c3)['end']();};}function respondWithResult(_0x22eca5,_0x5db277){_0x5db277=_0x5db277||0xc8;return function(_0x123d10){if(_0x123d10){return _0x22eca5[_0xabc5('0x1f')](_0x5db277)[_0xabc5('0x20')](_0x123d10);}};}function respondWithFilteredResult(_0x36f824,_0x560d11){return function(_0x3be089){if(_0x3be089){var _0x2e1bec=typeof _0x560d11[_0xabc5('0x21')]==='undefined'&&typeof _0x560d11[_0xabc5('0x22')]===_0xabc5('0x23');var _0x24fe0a=_0x3be089['count'];var _0x2d2391=_0x2e1bec?0x0:_0x560d11['offset'];var _0xf20e28=_0x2e1bec?_0x3be089[_0xabc5('0x24')]:_0x560d11[_0xabc5('0x21')]+_0x560d11[_0xabc5('0x22')];var _0x51ef01;if(_0xf20e28>=_0x24fe0a){_0xf20e28=_0x24fe0a;_0x51ef01=0xc8;}else{_0x51ef01=0xce;}_0x36f824['status'](_0x51ef01);return _0x36f824[_0xabc5('0x25')](_0xabc5('0x26'),_0x2d2391+'-'+_0xf20e28+'/'+_0x24fe0a)[_0xabc5('0x20')](_0x3be089);}return null;};}function patchUpdates(_0x29edff){return function(_0x1b52ae){try{jsonpatch[_0xabc5('0x27')](_0x1b52ae,_0x29edff,!![]);}catch(_0x21e2ac){return BPromise['reject'](_0x21e2ac);}return _0x1b52ae['save']();};}function saveUpdates(_0x11097a,_0x3614b3){return function(_0x512192){if(_0x512192){return _0x512192['update'](_0x11097a)['then'](function(_0x41ac85){return _0x41ac85;});}return null;};}function removeEntity(_0x2fefb6,_0x76327f){return function(_0x4884d4){if(_0x4884d4){return _0x4884d4[_0xabc5('0x28')]()[_0xabc5('0x29')](function(){_0x2fefb6[_0xabc5('0x1f')](0xcc)[_0xabc5('0x2a')]();});}};}function handleEntityNotFound(_0x4528cd,_0x561e0a){return function(_0x4979a0){if(!_0x4979a0){_0x4528cd[_0xabc5('0x1e')](0x194);}return _0x4979a0;};}function handleError(_0x564af0,_0x9d6c27){_0x9d6c27=_0x9d6c27||0x1f4;return function(_0x829771){logger[_0xabc5('0x2b')](_0x829771[_0xabc5('0x2c')]);if(_0x829771[_0xabc5('0x2d')]){delete _0x829771['name'];}_0x564af0[_0xabc5('0x1f')](_0x9d6c27)['send'](_0x829771);};}exports[_0xabc5('0x2e')]=function(_0x8be813,_0x37342e){var _0x1b5c12={},_0x54e2fd={},_0x326dbe={'count':0x0,'rows':[]};var _0x51be3e=_[_0xabc5('0x2f')](db['ChatGroup']['rawAttributes'],function(_0x429fe6){return{'name':_0x429fe6['fieldName'],'type':_0x429fe6[_0xabc5('0x30')][_0xabc5('0x31')]};});_0x54e2fd[_0xabc5('0x32')]=_[_0xabc5('0x2f')](_0x51be3e,'name');_0x54e2fd[_0xabc5('0x33')]=_[_0xabc5('0x34')](_0x8be813['query']);_0x54e2fd[_0xabc5('0x35')]=_[_0xabc5('0x36')](_0x54e2fd['model'],_0x54e2fd['query']);_0x1b5c12[_0xabc5('0x37')]=_[_0xabc5('0x36')](_0x54e2fd[_0xabc5('0x32')],qs[_0xabc5('0x38')](_0x8be813[_0xabc5('0x33')]['fields']));_0x1b5c12['attributes']=_0x1b5c12[_0xabc5('0x37')][_0xabc5('0x39')]?_0x1b5c12[_0xabc5('0x37')]:_0x54e2fd['model'];if(!_0x8be813[_0xabc5('0x33')][_0xabc5('0x3a')](_0xabc5('0x3b'))){_0x1b5c12[_0xabc5('0x22')]=qs['limit'](_0x8be813[_0xabc5('0x33')][_0xabc5('0x22')]);_0x1b5c12[_0xabc5('0x21')]=qs[_0xabc5('0x21')](_0x8be813[_0xabc5('0x33')][_0xabc5('0x21')]);}_0x1b5c12[_0xabc5('0x3c')]=qs['sort'](_0x8be813[_0xabc5('0x33')][_0xabc5('0x3d')]);_0x1b5c12[_0xabc5('0x3e')]=qs[_0xabc5('0x35')](_[_0xabc5('0x3f')](_0x8be813[_0xabc5('0x33')],_0x54e2fd['filters']),_0x51be3e);if(_0x8be813[_0xabc5('0x33')][_0xabc5('0x40')]){_0x1b5c12[_0xabc5('0x3e')]=_[_0xabc5('0x41')](_0x1b5c12[_0xabc5('0x3e')],{'$or':_[_0xabc5('0x2f')](_0x51be3e,function(_0x362534){if(_0x362534[_0xabc5('0x30')]!==_0xabc5('0x42')){var _0x42b6ed={};_0x42b6ed[_0x362534[_0xabc5('0x2d')]]={'$like':'%'+_0x8be813['query'][_0xabc5('0x40')]+'%'};return _0x42b6ed;}})});}_0x1b5c12=_[_0xabc5('0x41')]({},_0x1b5c12,_0x8be813[_0xabc5('0x43')]);var _0x21c89f={'where':_0x1b5c12['where']};return db[_0xabc5('0x44')][_0xabc5('0x24')](_0x21c89f)[_0xabc5('0x29')](function(_0x26746f){_0x326dbe['count']=_0x26746f;if(_0x8be813[_0xabc5('0x33')]['includeAll']){_0x1b5c12[_0xabc5('0x45')]=[{'all':!![]}];}return db[_0xabc5('0x44')][_0xabc5('0x46')](_0x1b5c12);})[_0xabc5('0x29')](function(_0x2938c8){_0x326dbe['rows']=_0x2938c8;return _0x326dbe;})[_0xabc5('0x29')](respondWithFilteredResult(_0x37342e,_0x1b5c12))[_0xabc5('0x47')](handleError(_0x37342e,null));};exports[_0xabc5('0x48')]=function(_0x1805f8,_0x5df7a0){var _0x5a2b7c={'raw':!![],'where':{'id':_0x1805f8[_0xabc5('0x49')]['id']}},_0x3377a6={};_0x3377a6['model']=_[_0xabc5('0x34')](db[_0xabc5('0x44')][_0xabc5('0x4a')]);_0x3377a6[_0xabc5('0x33')]=_[_0xabc5('0x34')](_0x1805f8[_0xabc5('0x33')]);_0x3377a6[_0xabc5('0x35')]=_[_0xabc5('0x36')](_0x3377a6[_0xabc5('0x32')],_0x3377a6[_0xabc5('0x33')]);_0x5a2b7c[_0xabc5('0x37')]=_[_0xabc5('0x36')](_0x3377a6['model'],qs[_0xabc5('0x38')](_0x1805f8['query'][_0xabc5('0x38')]));_0x5a2b7c[_0xabc5('0x37')]=_0x5a2b7c[_0xabc5('0x37')]['length']?_0x5a2b7c[_0xabc5('0x37')]:_0x3377a6[_0xabc5('0x32')];if(_0x1805f8[_0xabc5('0x33')][_0xabc5('0x4b')]){_0x5a2b7c['include']=[{'all':!![]}];}_0x5a2b7c=_[_0xabc5('0x41')]({},_0x5a2b7c,_0x1805f8['options']);return db['ChatGroup'][_0xabc5('0x4c')](_0x5a2b7c)[_0xabc5('0x29')](handleEntityNotFound(_0x5df7a0,null))['then'](respondWithResult(_0x5df7a0,null))['catch'](handleError(_0x5df7a0,null));};exports[_0xabc5('0x4d')]=function(_0x2725a1,_0x8f85fb){return db[_0xabc5('0x44')][_0xabc5('0x4d')](_0x2725a1['body'],{})[_0xabc5('0x29')](respondWithResult(_0x8f85fb,0xc9))[_0xabc5('0x47')](handleError(_0x8f85fb,null));};exports[_0xabc5('0x4e')]=function(_0x5acc2f,_0x23376a){if(_0x5acc2f[_0xabc5('0x4f')]['id']){delete _0x5acc2f[_0xabc5('0x4f')]['id'];}return db[_0xabc5('0x44')][_0xabc5('0x4c')]({'where':{'id':_0x5acc2f['params']['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x23376a,null))[_0xabc5('0x29')](saveUpdates(_0x5acc2f[_0xabc5('0x4f')],null))[_0xabc5('0x29')](respondWithResult(_0x23376a,null))['catch'](handleError(_0x23376a,null));};exports[_0xabc5('0x28')]=function(_0x50bec3,_0x334ca5){return db[_0xabc5('0x44')]['find']({'where':{'id':_0x50bec3[_0xabc5('0x49')]['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x334ca5,null))[_0xabc5('0x29')](removeEntity(_0x334ca5,null))[_0xabc5('0x47')](handleError(_0x334ca5,null));};exports[_0xabc5('0x50')]=function(_0x5c6b6b,_0x2a0213){return db[_0xabc5('0x44')][_0xabc5('0x50')]()[_0xabc5('0x29')](respondWithResult(_0x2a0213,null))[_0xabc5('0x47')](handleError(_0x2a0213,null));};exports[_0xabc5('0x51')]=function(_0x230a2e,_0x1feafc,_0x228da4){return db[_0xabc5('0x52')][_0xabc5('0x24')]({'where':{'ChatGroupId':_0x230a2e[_0xabc5('0x49')]['id'],'ToId':_0x230a2e['user']['id'],'read':![]}})[_0xabc5('0x29')](function(_0x42a0bb){return{'id':_[_0xabc5('0x53')](_0x230a2e['params']['id']),'count':_0x42a0bb};})['then'](respondWithResult(_0x1feafc,null))['catch'](handleError(_0x1feafc,null));};exports['addMembers']=function(_0x18087a,_0x5916bd,_0x562309){return db['ChatGroup'][_0xabc5('0x4c')]({'where':{'id':_0x18087a[_0xabc5('0x49')]['id']}})['then'](handleEntityNotFound(_0x5916bd,null))['then'](function(_0x4824fa){if(_0x4824fa){return _0x4824fa[_0xabc5('0x54')](_0x18087a[_0xabc5('0x4f')][_0xabc5('0x55')],_['omit'](_0x18087a['body'],[_0xabc5('0x55'),'id'])||{});}})[_0xabc5('0x29')](respondWithResult(_0x5916bd,null))[_0xabc5('0x47')](handleError(_0x5916bd,null));};exports[_0xabc5('0x56')]=function(_0x51f8ad,_0x1b3589,_0x504065){var _0x2b0eda={};var _0x5e715b={};var _0x58fa82;var _0xfa454b;return db[_0xabc5('0x44')][_0xabc5('0x57')]({'where':{'id':_0x51f8ad[_0xabc5('0x49')]['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x1b3589,null))['then'](function(_0x403151){if(_0x403151){_0x58fa82=_0x403151;_0x5e715b[_0xabc5('0x32')]=_[_0xabc5('0x34')](db[_0xabc5('0x58')]['rawAttributes']);_0x5e715b['query']=_[_0xabc5('0x34')](_0x51f8ad['query']);_0x5e715b[_0xabc5('0x35')]=_[_0xabc5('0x36')](_0x5e715b[_0xabc5('0x32')],_0x5e715b[_0xabc5('0x33')]);_0x2b0eda[_0xabc5('0x37')]=_[_0xabc5('0x36')](_0x5e715b[_0xabc5('0x32')],qs[_0xabc5('0x38')](_0x51f8ad[_0xabc5('0x33')]['fields']));_0x2b0eda['attributes']=_0x2b0eda[_0xabc5('0x37')][_0xabc5('0x39')]?_0x2b0eda['attributes']:_0x5e715b['model'];_0x2b0eda[_0xabc5('0x3c')]=qs[_0xabc5('0x3d')](_0x51f8ad[_0xabc5('0x33')]['sort']);_0x2b0eda['where']=qs[_0xabc5('0x35')](_[_0xabc5('0x3f')](_0x51f8ad[_0xabc5('0x33')],_0x5e715b[_0xabc5('0x35')]));if(_0x51f8ad[_0xabc5('0x33')]['filter']){_0x2b0eda[_0xabc5('0x3e')]=_['merge'](_0x2b0eda[_0xabc5('0x3e')],{'$or':_[_0xabc5('0x2f')](_0x2b0eda[_0xabc5('0x37')],function(_0x3a3386){var _0x142e4b={};_0x142e4b[_0x3a3386]={'$like':'%'+_0x51f8ad[_0xabc5('0x33')][_0xabc5('0x40')]+'%'};return _0x142e4b;})});}_0x2b0eda=_[_0xabc5('0x41')]({},_0x2b0eda,_0x51f8ad[_0xabc5('0x43')]);return _0x58fa82['getMembers'](_0x2b0eda);}})[_0xabc5('0x29')](function(_0x3960a7){if(_0x3960a7){_0xfa454b=_0x3960a7[_0xabc5('0x39')];if(!_0x51f8ad[_0xabc5('0x33')]['hasOwnProperty'](_0xabc5('0x3b'))){_0x2b0eda['limit']=qs[_0xabc5('0x22')](_0x51f8ad[_0xabc5('0x33')]['limit']);_0x2b0eda['offset']=qs[_0xabc5('0x21')](_0x51f8ad['query'][_0xabc5('0x21')]);}return _0x58fa82['getMembers'](_0x2b0eda);}})[_0xabc5('0x29')](function(_0x419000){if(_0x419000){return _0x419000?{'count':_0xfa454b,'rows':_0x419000}:null;}})[_0xabc5('0x29')](respondWithResult(_0x1b3589,null))[_0xabc5('0x47')](handleError(_0x1b3589,null));};exports[_0xabc5('0x59')]=function(_0x514dd5,_0x204884,_0x4b6fef){return db[_0xabc5('0x44')][_0xabc5('0x4c')]({'where':{'id':_0x514dd5[_0xabc5('0x49')]['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x204884,null))[_0xabc5('0x29')](function(_0x5608c9){if(_0x5608c9){return _0x5608c9[_0xabc5('0x59')](_0x514dd5[_0xabc5('0x33')][_0xabc5('0x55')]);}})[_0xabc5('0x29')](respondWithStatusCode(_0x204884,null))[_0xabc5('0x47')](handleError(_0x204884,null));};exports[_0xabc5('0x5a')]=function(_0x1352a9,_0x523209,_0x1910e4){if(_0x1352a9[_0xabc5('0x4f')]['id']){delete _0x1352a9[_0xabc5('0x4f')]['id'];}return db[_0xabc5('0x44')][_0xabc5('0x4c')]({'where':{'id':_0x1352a9[_0xabc5('0x49')]['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x523209,null))[_0xabc5('0x29')](function(_0x2efba7){if(_0x2efba7){_0x1352a9[_0xabc5('0x4f')]['ChatGroupId']=_0x2efba7['id'];return db[_0xabc5('0x52')][_0xabc5('0x4d')](_0x1352a9['body']);}})[_0xabc5('0x29')](respondWithResult(_0x523209,null))[_0xabc5('0x47')](handleError(_0x523209,null));};exports[_0xabc5('0x5b')]=function(_0xcab2d8,_0x2d9fad,_0x4e5b58){var _0x40bd9d={};var _0x1f3f59={};var _0x1a41f2;var _0x239635;return db['ChatGroup']['findOne']({'where':{'id':_0xcab2d8['params']['id']}})[_0xabc5('0x29')](handleEntityNotFound(_0x2d9fad,null))[_0xabc5('0x29')](function(_0x1a3d55){if(_0x1a3d55){_0x1a41f2=_0x1a3d55;_0x1f3f59[_0xabc5('0x32')]=_[_0xabc5('0x34')](db['ChatInternalMessage'][_0xabc5('0x4a')]);_0x1f3f59[_0xabc5('0x33')]=_[_0xabc5('0x34')](_0xcab2d8[_0xabc5('0x33')]);_0x1f3f59[_0xabc5('0x35')]=_[_0xabc5('0x36')](_0x1f3f59['model'],_0x1f3f59['query']);_0x40bd9d['attributes']=_['intersection'](_0x1f3f59[_0xabc5('0x32')],qs[_0xabc5('0x38')](_0xcab2d8['query'][_0xabc5('0x38')]));_0x40bd9d[_0xabc5('0x37')]=_0x40bd9d[_0xabc5('0x37')][_0xabc5('0x39')]?_0x40bd9d[_0xabc5('0x37')]:_0x1f3f59['model'];_0x40bd9d['order']=qs[_0xabc5('0x3d')](_0xcab2d8[_0xabc5('0x33')][_0xabc5('0x3d')]);_0x40bd9d[_0xabc5('0x3e')]=qs[_0xabc5('0x35')](_[_0xabc5('0x3f')](_0xcab2d8[_0xabc5('0x33')],_0x1f3f59['filters']));if(_0xcab2d8['query'][_0xabc5('0x40')]){_0x40bd9d['where']=_[_0xabc5('0x41')](_0x40bd9d[_0xabc5('0x3e')],{'$or':_['map'](_0x40bd9d[_0xabc5('0x37')],function(_0x40f3f0){var _0x49a8d6={};_0x49a8d6[_0x40f3f0]={'$like':'%'+_0xcab2d8['query'][_0xabc5('0x40')]+'%'};return _0x49a8d6;})});}if(_0xcab2d8[_0xabc5('0x33')]['$gte']){var _0x15aae6=_0xcab2d8[_0xabc5('0x33')][_0xabc5('0x5c')]['split'](',');var _0x4187f1={};_0x4187f1[_0x15aae6[0x0]]={'$gte':moment(_0x15aae6[0x1])[_0xabc5('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x40bd9d[_0xabc5('0x3e')]=_[_0xabc5('0x41')](_0x40bd9d[_0xabc5('0x3e')],_0x4187f1);}_0x40bd9d=_['merge']({},_0x40bd9d,_0xcab2d8['options']);return _0x1a41f2[_0xabc5('0x5b')](_0x40bd9d);}})[_0xabc5('0x29')](function(_0x8a1a24){if(_0x8a1a24){_0x239635=_0x8a1a24['length'];if(!_0xcab2d8[_0xabc5('0x33')][_0xabc5('0x3a')](_0xabc5('0x3b'))){_0x40bd9d[_0xabc5('0x22')]=qs[_0xabc5('0x22')](_0xcab2d8[_0xabc5('0x33')][_0xabc5('0x22')]);_0x40bd9d[_0xabc5('0x21')]=qs[_0xabc5('0x21')](_0xcab2d8[_0xabc5('0x33')][_0xabc5('0x21')]);}return _0x1a41f2[_0xabc5('0x5b')](_0x40bd9d);}})[_0xabc5('0x29')](function(_0x4ed50d){if(_0x4ed50d){return _0x4ed50d?{'count':_0x239635,'rows':_0x4ed50d}:null;}})['then'](respondWithResult(_0x2d9fad,null))['catch'](handleError(_0x2d9fad,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e8718ba..e9753a5 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 _0xeeb4=['events','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x44aeb3,_0x56e4bb){var _0x5bc8dd=function(_0x3b749e){while(--_0x3b749e){_0x44aeb3['push'](_0x44aeb3['shift']());}};_0x5bc8dd(++_0x56e4bb);}(_0xeeb4,0x1f1));var _0x4eeb=function(_0x258c1c,_0x1e2696){_0x258c1c=_0x258c1c-0x0;var _0x4ac65f=_0xeeb4[_0x258c1c];return _0x4ac65f;};'use strict';var EventEmitter=require(_0x4eeb('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4eeb('0x1')](0x0);var events={'afterCreate':_0x4eeb('0x2'),'afterUpdate':_0x4eeb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44afd4){return function(_0xc14d71,_0x23e194,_0x32f49d){ChatGroupEvents[_0x4eeb('0x4')](_0x44afd4+':'+_0xc14d71['id'],_0xc14d71);ChatGroupEvents[_0x4eeb('0x4')](_0x44afd4,_0xc14d71);_0x32f49d(null);};}for(var e in events){if(events[_0x4eeb('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x4eeb('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x7782=['ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x33b2a4,_0xdb7db0){var _0x51b7ad=function(_0x4a5bb2){while(--_0x4a5bb2){_0x33b2a4['push'](_0x33b2a4['shift']());}};_0x51b7ad(++_0xdb7db0);}(_0x7782,0x134));var _0x2778=function(_0x360cad,_0x54285f){_0x360cad=_0x360cad-0x0;var _0xd9a0ba=_0x7782[_0x360cad];return _0xd9a0ba;};'use strict';var EventEmitter=require(_0x2778('0x0'));var ChatGroup=require(_0x2778('0x1'))['db'][_0x2778('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2778('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2778('0x4'),'afterDestroy':_0x2778('0x5')};function emitEvent(_0x450524){return function(_0x1d8bd8,_0x124b71,_0x45ccda){ChatGroupEvents[_0x2778('0x6')](_0x450524+':'+_0x1d8bd8['id'],_0x1d8bd8);ChatGroupEvents[_0x2778('0x6')](_0x450524,_0x1d8bd8);_0x45ccda(null);};}for(var e in events){if(events[_0x2778('0x7')](e)){var event=events[e];ChatGroup[_0x2778('0x8')](e,emitEvent(event));}}module[_0x2778('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 408bc63..c2b7935 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 _0x82ee=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x82ee,0xdb));var _0xe82e=function(_0x5a444d,_0xff2d5){_0x5a444d=_0x5a444d-0x0;var _0x1140e9=_0x82ee[_0x5a444d];return _0x1140e9;};'use strict';var _=require(_0xe82e('0x0'));var util=require('util');var logger=require(_0xe82e('0x1'))('api');var moment=require(_0xe82e('0x2'));var BPromise=require(_0xe82e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe82e('0x4'));var config=require(_0xe82e('0x5'));var attributes=require(_0xe82e('0x6'));module[_0xe82e('0x7')]=function(_0x139991,_0x1553c8){return _0x139991[_0xe82e('0x8')](_0xe82e('0x9'),attributes,{'tableName':_0xe82e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7737=['./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe485c4,_0x3d0f36){var _0x24cb58=function(_0x492673){while(--_0x492673){_0xe485c4['push'](_0xe485c4['shift']());}};_0x24cb58(++_0x3d0f36);}(_0x7737,0x1f2));var _0x7773=function(_0x7b8b47,_0x274711){_0x7b8b47=_0x7b8b47-0x0;var _0x5b3c2a=_0x7737[_0x7b8b47];return _0x5b3c2a;};'use strict';var _=require(_0x7773('0x0'));var util=require(_0x7773('0x1'));var logger=require(_0x7773('0x2'))('api');var moment=require(_0x7773('0x3'));var BPromise=require(_0x7773('0x4'));var rp=require(_0x7773('0x5'));var fs=require('fs');var path=require(_0x7773('0x6'));var rimraf=require(_0x7773('0x7'));var config=require(_0x7773('0x8'));var attributes=require(_0x7773('0x9'));module[_0x7773('0xa')]=function(_0xf883ad,_0x3012e9){return _0xf883ad[_0x7773('0xb')](_0x7773('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 59cb91c..9e5b926 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 _0x2e78=['request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatGroup,\x20%s,\x20%s'];(function(_0x46e4fd,_0x88bd23){var _0x365075=function(_0x3fa0ec){while(--_0x3fa0ec){_0x46e4fd['push'](_0x46e4fd['shift']());}};_0x365075(++_0x88bd23);}(_0x2e78,0xab));var _0x82e7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2e78[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x82e7('0x0'));var util=require(_0x82e7('0x1'));var moment=require(_0x82e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x82e7('0x3'));var fs=require('fs');var Redis=require(_0x82e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82e7('0x5'));var logger=require('../../config/logger')(_0x82e7('0x6'));var config=require(_0x82e7('0x7'));var jayson=require(_0x82e7('0x8'));var client=jayson[_0x82e7('0x9')][_0x82e7('0xa')]({'port':0x232a});config[_0x82e7('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x82e7('0xc'))(new Redis(config[_0x82e7('0xb')]));require(_0x82e7('0xd'))[_0x82e7('0xe')](socket);function respondWithRpcPromise(_0xba46f6,_0x359c45,_0x5c8b9e){return new BPromise(function(_0x22d49a,_0x4eb759){return client[_0x82e7('0xf')](_0xba46f6,_0x5c8b9e)[_0x82e7('0x10')](function(_0x4e0855){logger['info']('ChatGroup,\x20%s,\x20%s',_0x359c45,'request\x20sent');logger[_0x82e7('0x11')](_0x82e7('0x12'),_0x359c45,'request\x20sent',JSON[_0x82e7('0x13')](_0x4e0855));if(_0x4e0855['error']){if(_0x4e0855[_0x82e7('0x14')][_0x82e7('0x15')]===0x1f4){logger[_0x82e7('0x14')]('ChatGroup,\x20%s,\x20%s',_0x359c45,_0x4e0855[_0x82e7('0x14')]['message']);return _0x4eb759(_0x4e0855['error'][_0x82e7('0x16')]);}logger[_0x82e7('0x14')]('ChatGroup,\x20%s,\x20%s',_0x359c45,_0x4e0855[_0x82e7('0x14')][_0x82e7('0x16')]);return _0x22d49a(_0x4e0855[_0x82e7('0x14')][_0x82e7('0x16')]);}else{logger[_0x82e7('0x17')](_0x82e7('0x18'),_0x359c45,_0x82e7('0x19'));_0x22d49a(_0x4e0855[_0x82e7('0x1a')][_0x82e7('0x16')]);}})[_0x82e7('0x1b')](function(_0x5bbc4b){logger[_0x82e7('0x14')](_0x82e7('0x18'),_0x359c45,_0x5bbc4b);_0x4eb759(_0x5bbc4b);});});} \ No newline at end of file +var _0x39a9=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x1b231d,_0x2e6d98){var _0x41b34c=function(_0x4d406e){while(--_0x4d406e){_0x1b231d['push'](_0x1b231d['shift']());}};_0x41b34c(++_0x2e6d98);}(_0x39a9,0x1d0));var _0x939a=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x39a9[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var moment=require(_0x939a('0x2'));var BPromise=require(_0x939a('0x3'));var rs=require(_0x939a('0x4'));var fs=require('fs');var Redis=require(_0x939a('0x5'));var db=require(_0x939a('0x6'))['db'];var utils=require(_0x939a('0x7'));var logger=require(_0x939a('0x8'))(_0x939a('0x9'));var config=require(_0x939a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x939a('0xb')][_0x939a('0xc')]({'port':0x232a});config[_0x939a('0xd')]=_[_0x939a('0xe')](config[_0x939a('0xd')],{'host':_0x939a('0xf'),'port':0x18eb});var socket=require(_0x939a('0x10'))(new Redis(config[_0x939a('0xd')]));require('./chatGroup.socket')[_0x939a('0x11')](socket);function respondWithRpcPromise(_0x19e985,_0x27fc39,_0x5e81d6){return new BPromise(function(_0x11d9db,_0x41bb74){return client[_0x939a('0x12')](_0x19e985,_0x5e81d6)['then'](function(_0x3032c4){logger[_0x939a('0x13')](_0x939a('0x14'),_0x27fc39,'request\x20sent');logger['debug'](_0x939a('0x15'),_0x27fc39,_0x939a('0x16'),JSON[_0x939a('0x17')](_0x3032c4));if(_0x3032c4['error']){if(_0x3032c4[_0x939a('0x18')][_0x939a('0x19')]===0x1f4){logger[_0x939a('0x18')](_0x939a('0x14'),_0x27fc39,_0x3032c4[_0x939a('0x18')][_0x939a('0x1a')]);return _0x41bb74(_0x3032c4[_0x939a('0x18')]['message']);}logger[_0x939a('0x18')]('ChatGroup,\x20%s,\x20%s',_0x27fc39,_0x3032c4[_0x939a('0x18')]['message']);return _0x11d9db(_0x3032c4[_0x939a('0x18')][_0x939a('0x1a')]);}else{logger[_0x939a('0x13')](_0x939a('0x14'),_0x27fc39,'request\x20sent');_0x11d9db(_0x3032c4['result'][_0x939a('0x1a')]);}})['catch'](function(_0x5648d5){logger[_0x939a('0x18')](_0x939a('0x14'),_0x27fc39,_0x5648d5);_0x41bb74(_0x5648d5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 377e4a8..e93e29b 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 _0x52d6=['remove','update','removeListener','length','chatGroup:','./chatGroup.events','save'];(function(_0x219824,_0x300659){var _0x182994=function(_0x1fce9f){while(--_0x1fce9f){_0x219824['push'](_0x219824['shift']());}};_0x182994(++_0x300659);}(_0x52d6,0x1da));var _0x652d=function(_0x5a449f,_0x1b39db){_0x5a449f=_0x5a449f-0x0;var _0x12a4d5=_0x52d6[_0x5a449f];return _0x12a4d5;};'use strict';var ChatGroupEvents=require(_0x652d('0x0'));var events=[_0x652d('0x1'),_0x652d('0x2'),_0x652d('0x3')];function createListener(_0x50b90d,_0x21bcc9){return function(_0x58b876){_0x21bcc9['emit'](_0x50b90d,_0x58b876);};}function removeListener(_0x17d2f3,_0x248623){return function(){ChatGroupEvents[_0x652d('0x4')](_0x17d2f3,_0x248623);};}exports['register']=function(_0x5dbd73){for(var _0x4432c7=0x0,_0x4b41fe=events[_0x652d('0x5')];_0x4432c7<_0x4b41fe;_0x4432c7++){var _0x4fdd67=events[_0x4432c7];var _0x171afa=createListener(_0x652d('0x6')+_0x4fdd67,_0x5dbd73);ChatGroupEvents['on'](_0x4fdd67,_0x171afa);}}; \ No newline at end of file +var _0xb9cc=['update','emit','removeListener','chatGroup:','./chatGroup.events','save','remove'];(function(_0x5a7fdb,_0x529eb3){var _0x5205c2=function(_0x113e55){while(--_0x113e55){_0x5a7fdb['push'](_0x5a7fdb['shift']());}};_0x5205c2(++_0x529eb3);}(_0xb9cc,0xdd));var _0xcb9c=function(_0x56dd19,_0x22a622){_0x56dd19=_0x56dd19-0x0;var _0x5655fe=_0xb9cc[_0x56dd19];return _0x5655fe;};'use strict';var ChatGroupEvents=require(_0xcb9c('0x0'));var events=[_0xcb9c('0x1'),_0xcb9c('0x2'),_0xcb9c('0x3')];function createListener(_0x49b344,_0x3eecea){return function(_0x229aca){_0x3eecea[_0xcb9c('0x4')](_0x49b344,_0x229aca);};}function removeListener(_0x220bda,_0x351a4b){return function(){ChatGroupEvents[_0xcb9c('0x5')](_0x220bda,_0x351a4b);};}exports['register']=function(_0x7107fb){for(var _0x498ef2=0x0,_0xc6a03f=events['length'];_0x498ef2<_0xc6a03f;_0x498ef2++){var _0x5a7bcf=events[_0x498ef2];var _0x490b5b=createListener(_0xcb9c('0x6')+_0x5a7bcf,_0x7107fb);ChatGroupEvents['on'](_0x5a7bcf,_0x490b5b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9758cda..2cf4710 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 _0xffe7=['./chatGroup.controller','isAuthenticated','get','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','addMessage','put','/:id','update','destroy','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x376597,_0x3ded84){var _0x4d47d1=function(_0x1fffb1){while(--_0x1fffb1){_0x376597['push'](_0x376597['shift']());}};_0x4d47d1(++_0x3ded84);}(_0xffe7,0x1e7));var _0x7ffe=function(_0x1a9f68,_0x14497e){_0x1a9f68=_0x1a9f68-0x0;var _0x293c7b=_0xffe7[_0x1a9f68];return _0x293c7b;};'use strict';var multer=require(_0x7ffe('0x0'));var util=require(_0x7ffe('0x1'));var path=require(_0x7ffe('0x2'));var timeout=require(_0x7ffe('0x3'));var express=require(_0x7ffe('0x4'));var router=express[_0x7ffe('0x5')]();var fs_extra=require(_0x7ffe('0x6'));var auth=require(_0x7ffe('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7ffe('0x8'));var controller=require(_0x7ffe('0x9'));router['get']('/',auth[_0x7ffe('0xa')](),controller['index']);router[_0x7ffe('0xb')](_0x7ffe('0xc'),auth[_0x7ffe('0xa')](),controller[_0x7ffe('0xd')]);router['get']('/:id',auth[_0x7ffe('0xa')](),controller[_0x7ffe('0xe')]);router[_0x7ffe('0xb')](_0x7ffe('0xf'),auth['isAuthenticated'](),controller[_0x7ffe('0x10')]);router[_0x7ffe('0xb')](_0x7ffe('0x11'),auth[_0x7ffe('0xa')](),controller['getMembers']);router['get']('/:id/messages',auth[_0x7ffe('0xa')](),controller[_0x7ffe('0x12')]);router[_0x7ffe('0x13')]('/',auth[_0x7ffe('0xa')](),controller[_0x7ffe('0x14')]);router[_0x7ffe('0x13')](_0x7ffe('0x11'),auth['isAuthenticated'](),controller[_0x7ffe('0x15')]);router[_0x7ffe('0x13')](_0x7ffe('0x16'),auth[_0x7ffe('0xa')](),controller[_0x7ffe('0x17')]);router[_0x7ffe('0x18')](_0x7ffe('0x19'),auth['isAuthenticated'](),controller[_0x7ffe('0x1a')]);router['delete'](_0x7ffe('0x19'),auth[_0x7ffe('0xa')](),controller[_0x7ffe('0x1b')]);router[_0x7ffe('0x1c')](_0x7ffe('0x11'),auth[_0x7ffe('0xa')](),controller[_0x7ffe('0x1d')]);module[_0x7ffe('0x1e')]=router; \ No newline at end of file +var _0x8dd5=['getMembers','/:id/messages','create','post','/:id/members','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','get','/:id','isAuthenticated','/:id/unread','getUnread'];(function(_0x387651,_0x1704ba){var _0x291aa0=function(_0x545bb6){while(--_0x545bb6){_0x387651['push'](_0x387651['shift']());}};_0x291aa0(++_0x1704ba);}(_0x8dd5,0x1ac));var _0x58dd=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x8dd5[_0x20a558];return _0x53d3f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x58dd('0x0'));var timeout=require(_0x58dd('0x1'));var express=require(_0x58dd('0x2'));var router=express['Router']();var fs_extra=require(_0x58dd('0x3'));var auth=require(_0x58dd('0x4'));var interaction=require(_0x58dd('0x5'));var config=require('../../config/environment');var controller=require(_0x58dd('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x58dd('0x7')]);router[_0x58dd('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x58dd('0x8')](_0x58dd('0x9'),auth[_0x58dd('0xa')](),controller['show']);router[_0x58dd('0x8')](_0x58dd('0xb'),auth[_0x58dd('0xa')](),controller[_0x58dd('0xc')]);router[_0x58dd('0x8')]('/:id/members',auth[_0x58dd('0xa')](),controller[_0x58dd('0xd')]);router[_0x58dd('0x8')](_0x58dd('0xe'),auth[_0x58dd('0xa')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x58dd('0xf')]);router[_0x58dd('0x10')](_0x58dd('0x11'),auth[_0x58dd('0xa')](),controller['addMembers']);router['post'](_0x58dd('0xe'),auth[_0x58dd('0xa')](),controller['addMessage']);router['put']('/:id',auth[_0x58dd('0xa')](),controller[_0x58dd('0x12')]);router['delete']('/:id',auth[_0x58dd('0xa')](),controller[_0x58dd('0x13')]);router['delete'](_0x58dd('0x11'),auth[_0x58dd('0xa')](),controller['removeMembers']);module[_0x58dd('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4a54bf3..a3e9e25 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 _0xa902=['BOOLEAN','INTEGER','ENUM','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x4432b5,_0x2bd03f){var _0x1cecdf=function(_0x14154e){while(--_0x14154e){_0x4432b5['push'](_0x4432b5['shift']());}};_0x1cecdf(++_0x2bd03f);}(_0xa902,0x8d));var _0x2a90=function(_0x4f0dd8,_0x299400){_0x4f0dd8=_0x4f0dd8-0x0;var _0x48f875=_0xa902[_0x4f0dd8];return _0x48f875;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'closed':{'type':Sequelize[_0x2a90('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2a90('0x3')]},'ratingType':{'type':Sequelize[_0x2a90('0x4')]('star',_0x2a90('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x2a90('0x6')]},'mailTranscript':{'type':Sequelize[_0x2a90('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2a90('0x8')]},'disposition':{'type':Sequelize[_0x2a90('0x7')]},'secondDisposition':{'type':Sequelize[_0x2a90('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2a90('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2a90('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2a90('0x7')]},'deviceModel':{'type':Sequelize[_0x2a90('0x7')]},'deviceVendor':{'type':Sequelize[_0x2a90('0x7')]},'deviceType':{'type':Sequelize[_0x2a90('0x7')]},'referer':{'type':Sequelize[_0x2a90('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2a90('0x6')](_0x2a90('0x9'))},'read1stAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2a90('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2a90('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x2a90('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7be1=['ENUM','star','thumb','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x7be1,0x165));var _0x17be=function(_0x11fe8d,_0x19aba4){_0x11fe8d=_0x11fe8d-0x0;var _0x356099=_0x7be1[_0x11fe8d];return _0x356099;};'use strict';var Sequelize=require(_0x17be('0x0'));module[_0x17be('0x1')]={'closed':{'type':Sequelize[_0x17be('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x17be('0x3')](_0x17be('0x4'),_0x17be('0x5')),'defaultValue':_0x17be('0x4')},'ratingMessage':{'type':Sequelize[_0x17be('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x17be('0x7')]},'secondDisposition':{'type':Sequelize[_0x17be('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x17be('0x7')]},'browserName':{'type':Sequelize[_0x17be('0x7')]},'browserVersion':{'type':Sequelize[_0x17be('0x7')]},'osName':{'type':Sequelize[_0x17be('0x7')]},'osVersion':{'type':Sequelize[_0x17be('0x7')]},'deviceModel':{'type':Sequelize[_0x17be('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x17be('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x17be('0x7')]},'formData':{'type':Sequelize[_0x17be('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x17be('0x8')]},'lastMsgAt':{'type':Sequelize[_0x17be('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x17be('0x3')]('in',_0x17be('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x17be('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x17be('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9d79cd8..5685c65 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 _0x2975=['filter','map','$gte','rows','options','includeAgent','push','spread','Tag','color','emit','removeTags','unix','toString','files','tmp','server','attachments','transcript-%d-%s.zip','lastName','read','Account','Owner','Chat','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','update','destroy','stack','name','send','render','contact','agent','interaction','account','ChatInteraction','rawAttributes','key','getOptions','findAll','user','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','type','mimetype','attachmentDownload','closed','Attachment','attachId','ChatOfflineMessageId','server/files/attachments/','offline-chat/','join','basename','download','close','mailTranscript','root','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsiteId','ContactId','Messages','Visitor','website_alias','%s%d','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','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','nolimit','order','sort','where','pick','ChatInteractionId'];(function(_0x5303a2,_0x49716b){var _0x448ac5=function(_0xff8c40){while(--_0xff8c40){_0x5303a2['push'](_0x5303a2['shift']());}};_0x448ac5(++_0x49716b);}(_0x2975,0x1c7));var _0x5297=function(_0x143619,_0x45d113){_0x143619=_0x143619-0x0;var _0x8e5ebe=_0x2975[_0x143619];return _0x8e5ebe;};'use strict';var rimraf=require(_0x5297('0x0'));var zipdir=require(_0x5297('0x1'));var rp=require(_0x5297('0x2'));var moment=require('moment');var BPromise=require(_0x5297('0x3'));var Mustache=require(_0x5297('0x4'));var util=require(_0x5297('0x5'));var path=require(_0x5297('0x6'));var ejs=require(_0x5297('0x7'));var fs=require('fs');var _=require(_0x5297('0x8'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x5297('0x9'));var logger=require(_0x5297('0xa'))(_0x5297('0xb'));var config=require(_0x5297('0xc'));var db=require(_0x5297('0xd'))['db'];config[_0x5297('0xe')]=_['defaults'](config[_0x5297('0xe')],{'host':_0x5297('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5297('0xe')]));require('./chatInteraction.socket')[_0x5297('0x10')](socket);var jayson=require(_0x5297('0x11'));var client=jayson[_0x5297('0x12')][_0x5297('0x13')]({'port':0x232b});var client9004=jayson['client'][_0x5297('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x42770b,_0x8ab6a8,_0xf905a4,_0xb7903b){return new BPromise(function(_0x517110,_0x4c5ba7){var _0x5cc371=_0xb7903b||client;return _0x5cc371[_0x5297('0x14')](_0x42770b,_0xf905a4)[_0x5297('0x15')](function(_0x10df5a){logger[_0x5297('0x16')](_0x5297('0x17'),_0x8ab6a8,_0x5297('0x18'));logger[_0x5297('0x19')](_0x5297('0x1a'),_0x8ab6a8,_0x5297('0x18'),JSON[_0x5297('0x1b')](_0x10df5a));if(_0x10df5a[_0x5297('0x1c')]){if(_0x10df5a[_0x5297('0x1c')][_0x5297('0x1d')]===0x1f4){logger[_0x5297('0x1c')](_0x5297('0x17'),_0x8ab6a8,_0x10df5a[_0x5297('0x1c')]['message']);return _0x4c5ba7(_0x10df5a[_0x5297('0x1c')][_0x5297('0x1e')]);}logger[_0x5297('0x1c')](_0x5297('0x17'),_0x8ab6a8,_0x10df5a[_0x5297('0x1c')][_0x5297('0x1e')]);return _0x517110(_0x10df5a[_0x5297('0x1c')]['message']);}else{logger['info'](_0x5297('0x17'),_0x8ab6a8,'request\x20sent');_0x517110(_0x10df5a[_0x5297('0x1f')][_0x5297('0x1e')]);}})[_0x5297('0x20')](function(_0x3a1fec){logger[_0x5297('0x1c')](_0x5297('0x17'),_0x8ab6a8,_0x3a1fec);_0x4c5ba7(_0x3a1fec);});});}function respondWithStatusCode(_0x2b7821,_0x595f15){_0x595f15=_0x595f15||0xcc;return function(_0x535612){if(_0x535612){return _0x2b7821[_0x5297('0x21')](_0x595f15);}return _0x2b7821[_0x5297('0x22')](_0x595f15)[_0x5297('0x23')]();};}function respondWithResult(_0x3cfdb4,_0x4e7f36){_0x4e7f36=_0x4e7f36||0xc8;return function(_0x31e6e9){if(_0x31e6e9){return _0x3cfdb4[_0x5297('0x22')](_0x4e7f36)[_0x5297('0x24')](_0x31e6e9);}};}function respondWithFilteredResult(_0x202e34,_0x2055bb){return function(_0x47c2b7){if(_0x47c2b7){var _0x4371de=typeof _0x2055bb['offset']==='undefined'&&typeof _0x2055bb['limit']===_0x5297('0x25');var _0x271af4=_0x47c2b7[_0x5297('0x26')];var _0x14f389=_0x4371de?0x0:_0x2055bb[_0x5297('0x27')];var _0x4ba8f9=_0x4371de?_0x47c2b7['count']:_0x2055bb[_0x5297('0x27')]+_0x2055bb[_0x5297('0x28')];var _0x3c1ab0;if(_0x4ba8f9>=_0x271af4){_0x4ba8f9=_0x271af4;_0x3c1ab0=0xc8;}else{_0x3c1ab0=0xce;}_0x202e34[_0x5297('0x22')](_0x3c1ab0);return _0x202e34[_0x5297('0x29')]('Content-Range',_0x14f389+'-'+_0x4ba8f9+'/'+_0x271af4)[_0x5297('0x24')](_0x47c2b7);}return null;};}function saveUpdates(_0x41760d){return function(_0x45982d){if(_0x45982d){return _0x45982d[_0x5297('0x2a')](_0x41760d)[_0x5297('0x15')](function(_0x5d9025){return _0x5d9025;});}return null;};}function removeEntity(_0x397b33){return function(_0x1afbe9){if(_0x1afbe9){return _0x1afbe9[_0x5297('0x2b')]()[_0x5297('0x15')](function(){_0x397b33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x225ec4){return function(_0x4efe9c){if(!_0x4efe9c){_0x225ec4[_0x5297('0x21')](0x194);}return _0x4efe9c;};}function handleError(_0x5c2d16,_0x478619){_0x478619=_0x478619||0x1f4;return function(_0x4d909f){logger[_0x5297('0x1c')](_0x4d909f[_0x5297('0x2c')]);if(_0x4d909f['name']){delete _0x4d909f[_0x5297('0x2d')];}_0x5c2d16['status'](_0x478619)[_0x5297('0x2e')](_0x4d909f);};}function getMustacheRender(_0x54616c,_0x4f420a){return Mustache[_0x5297('0x2f')](_0x54616c,_['merge'](_0x4f420a['body'],{'contact':_0x4f420a[_0x5297('0x30')],'message':_0x4f420a[_0x5297('0x1e')],'agent':_0x4f420a[_0x5297('0x31')],'interaction':_0x4f420a[_0x5297('0x32')],'account':_0x4f420a[_0x5297('0x33')]}))||'';}exports['index']=function(_0x1d065b,_0x5a3683){var _0x30dbca={};var _0x3bda6e=_['map'](db[_0x5297('0x34')][_0x5297('0x35')],function(_0x3f285c){return{'name':_0x3f285c['fieldName'],'type':_0x3f285c['type'][_0x5297('0x36')]};});_0x30dbca=qs[_0x5297('0x37')](_0x3bda6e,_0x1d065b);return interaction[_0x5297('0x38')]('chat',_0x1d065b['query'],_0x1d065b[_0x5297('0x39')],_0x30dbca,_0x3bda6e)[_0x5297('0x15')](respondWithFilteredResult(_0x5a3683,_0x30dbca))[_0x5297('0x20')](handleError(_0x5a3683,null));};exports['show']=function(_0x350f31,_0x14d5d8){var _0x3ade06={'raw':![],'where':{'id':_0x350f31[_0x5297('0x3a')]['id']}},_0x12afce={};_0x12afce[_0x5297('0x3b')]=_[_0x5297('0x3c')](db[_0x5297('0x34')][_0x5297('0x35')]);_0x12afce[_0x5297('0x3d')]=_[_0x5297('0x3c')](_0x350f31[_0x5297('0x3d')]);_0x12afce[_0x5297('0x3e')]=_[_0x5297('0x3f')](_0x12afce['model'],_0x12afce[_0x5297('0x3d')]);_0x3ade06[_0x5297('0x40')]=_[_0x5297('0x3f')](_0x12afce['model'],qs[_0x5297('0x41')](_0x350f31[_0x5297('0x3d')][_0x5297('0x41')]));_0x3ade06['attributes']=_0x3ade06[_0x5297('0x40')][_0x5297('0x42')]?_0x3ade06['attributes']:_0x12afce['model'];if(_0x350f31['query'][_0x5297('0x43')]){_0x3ade06[_0x5297('0x44')]=[{'all':!![]}];}_0x3ade06=_[_0x5297('0x45')]({},_0x3ade06,_0x350f31['options']);return db[_0x5297('0x34')][_0x5297('0x46')](_0x3ade06)[_0x5297('0x15')](handleEntityNotFound(_0x14d5d8,null))[_0x5297('0x15')](respondWithResult(_0x14d5d8,null))[_0x5297('0x20')](handleError(_0x14d5d8,null));};exports[_0x5297('0x47')]=function(_0x358abb,_0x471f9e){return db[_0x5297('0x34')][_0x5297('0x47')](_0x358abb[_0x5297('0x48')],{})[_0x5297('0x15')](respondWithResult(_0x471f9e,0xc9))['catch'](handleError(_0x471f9e,null));};exports['update']=function(_0x3b035b,_0x1f310a){if(_0x3b035b['body']['id']){delete _0x3b035b[_0x5297('0x48')]['id'];}return db['ChatInteraction'][_0x5297('0x46')]({'where':{'id':_0x3b035b[_0x5297('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1f310a,null))[_0x5297('0x15')](saveUpdates(_0x3b035b[_0x5297('0x48')],null))[_0x5297('0x15')](respondWithResult(_0x1f310a,null))[_0x5297('0x20')](handleError(_0x1f310a,null));};exports[_0x5297('0x2b')]=function(_0xffeae,_0x31abe8){return db[_0x5297('0x34')]['find']({'where':{'id':_0xffeae[_0x5297('0x3a')]['id']}})[_0x5297('0x15')](handleEntityNotFound(_0x31abe8,null))['then'](removeEntity(_0x31abe8,null))[_0x5297('0x20')](handleError(_0x31abe8,null));};exports['describe']=function(_0x50e8c7,_0x384052){return db[_0x5297('0x34')][_0x5297('0x49')]()['then'](respondWithResult(_0x384052,null))[_0x5297('0x20')](handleError(_0x384052,null));};exports['createVidaooSession']=function(_0x4f8023,_0x314d8a){var _0x8caaae=_0x4f8023[_0x5297('0x3a')]['id'];var _0x45b167;var _0x350345;var _0xebbcaf;return db[_0x5297('0x34')][_0x5297('0x4a')]({'where':{'id':_0x8caaae}})['then'](function(_0x16ee6b){_0x45b167=_0x16ee6b;return db[_0x5297('0x4b')][_0x5297('0x4a')]({'where':{'id':_0x16ee6b['ChatWebsiteId']},'attributes':['id',_0x5297('0x4c'),'vidaooEscalation',_0x5297('0x4d'),_0x5297('0x4e'),_0x5297('0x4f')],'raw':!![]});})[_0x5297('0x15')](function(_0x255cb8){if(_0x255cb8&&_0x255cb8[_0x5297('0x4c')]&&_0x255cb8[_0x5297('0x50')]){_0x350345=_0x255cb8;var _0x3b4814={'interaction':{'id':_0x8caaae},'agent':{'id':_0x4f8023[_0x5297('0x39')]['id'],'name':_0x4f8023[_0x5297('0x39')]['name'],'fullname':_0x4f8023[_0x5297('0x39')][_0x5297('0x51')],'email':_0x4f8023[_0x5297('0x39')][_0x5297('0x52')]},'contact':_0x4f8023[_0x5297('0x48')][_0x5297('0x30')],'account':_0x4f8023['body'][_0x5297('0x33')]};var _0x220dd2={'rejectUnauthorized':![],'method':_0x5297('0x53'),'url':_0x5297('0x54'),'headers':{'X-APIKEY':_0x255cb8[_0x5297('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f8023[_0x5297('0x39')][_0x5297('0x52')]],'buttons':null,'topic':_0x350345[_0x5297('0x4d')],'note':_['isNull'](_0x350345[_0x5297('0x4e')])?null:getMustacheRender(_0x350345[_0x5297('0x4e')],_0x3b4814),'metadata':null},'redirect':_0x5297('0x55'),'json':!![]};try{if(!_[_0x5297('0x56')](_0x350345['vidaooMetadata'])){var _0xe9e1d2=getMustacheRender(_0x350345[_0x5297('0x4f')],_0x3b4814);var _0x25f0a3=JSON[_0x5297('0x57')](_0xe9e1d2);_0x220dd2[_0x5297('0x48')][_0x5297('0x58')]=_0x25f0a3;}}catch(_0x49da91){throw new db[(_0x5297('0x59'))][(_0x5297('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x220dd2);}else{throw new db[(_0x5297('0x59'))][(_0x5297('0x5a'))](_0x5297('0x5b'));}})[_0x5297('0x15')](function(_0x353d5d){_0xebbcaf=_0x353d5d;if(_0xebbcaf['id']){var _0x2607b5={'body':_0xebbcaf['join_url'],'ChatWebsiteId':_0x350345['id'],'ChatInteractionId':_0x45b167['id'],'direction':_0x5297('0x5c'),'UserId':_0x4f8023[_0x5297('0x39')]['id']};return db[_0x5297('0x5d')][_0x5297('0x47')](_0x2607b5,{});}else{throw new db[(_0x5297('0x59'))][(_0x5297('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5297('0x15')](function(){return _0x45b167[_0x5297('0x5e')]({'vidaooSessionId':_0xebbcaf['id']});})['then'](respondWithResult(_0x314d8a,null))['catch'](handleError(_0x314d8a,null));};exports[_0x5297('0x5f')]=function(_0x30deb8,_0x52726f){if(_0x30deb8[_0x5297('0x48')]['id']){delete _0x30deb8[_0x5297('0x48')]['id'];}return db[_0x5297('0x34')][_0x5297('0x46')]({'where':{'id':_0x30deb8[_0x5297('0x3a')]['id']},'include':[{'model':db[_0x5297('0x60')],'as':_0x5297('0x61')}]})[_0x5297('0x15')](handleEntityNotFound(_0x52726f,null))[_0x5297('0x15')](saveUpdates(_0x30deb8[_0x5297('0x48')],null))['then'](respondWithResult(_0x52726f,null))[_0x5297('0x20')](handleError(_0x52726f,null));};exports['abandon']=function(_0x331cfd,_0x180e5e){if(_0x331cfd[_0x5297('0x48')]['id']){delete _0x331cfd['body']['id'];}return db[_0x5297('0x34')]['find']({'where':{'id':_0x331cfd[_0x5297('0x3a')]['id']}})[_0x5297('0x15')](function(_0x2fb6f9){if(!_0x2fb6f9){logger['error'](_0x5297('0x62'),_0x5297('0x63'),0x194,_0x5297('0x64'));_0x180e5e['sendStatus'](0x194);}else{if(_0x2fb6f9[_0x5297('0x65')]){throw new db[(_0x5297('0x59'))][(_0x5297('0x5a'))](_0x5297('0x66'));}}return _0x2fb6f9;})[_0x5297('0x15')](function(_0x38c403){if(_0x38c403){return _0x38c403[_0x5297('0x2a')]({'closed':_0x331cfd[_0x5297('0x48')]['closed'],'disposition':_0x331cfd['body'][_0x5297('0x67')]})[_0x5297('0x15')](function(_0x236995){return _0x236995;});}})[_0x5297('0x15')](function(){return respondWithRpcPromise(_0x5297('0x68'),_0x5297('0x63'),_0x331cfd['body'],client9004);})[_0x5297('0x15')](respondWithResult(_0x180e5e,null))[_0x5297('0x20')](handleError(_0x180e5e,null));};exports[_0x5297('0x69')]=function(_0x368efa,_0x3e2283){_0x368efa[_0x5297('0x48')][_0x5297('0x2d')]=_0x368efa[_0x5297('0x6a')][_0x5297('0x6b')];_0x368efa[_0x5297('0x48')]['basename']=_0x368efa['file']['filename'];_0x368efa[_0x5297('0x48')][_0x5297('0x6c')]=_0x368efa[_0x5297('0x6a')][_0x5297('0x6d')];return db['Attachment'][_0x5297('0x47')](_0x368efa[_0x5297('0x48')])[_0x5297('0x15')](respondWithResult(_0x3e2283,0xc9))['catch'](handleError(_0x3e2283,null));};exports[_0x5297('0x6e')]=function(_0x3edc6e,_0x15c0ad){return db[_0x5297('0x34')][_0x5297('0x4a')]({'where':{'id':_0x3edc6e[_0x5297('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x15c0ad,null))[_0x5297('0x15')](function(_0xbfa74){if(_0xbfa74){if(_0xbfa74[_0x5297('0x6f')]){return _0x15c0ad[_0x5297('0x22')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x5297('0x70')]['findOne']({'where':{'id':_0x3edc6e['query'][_0x5297('0x71')]},'raw':!![]})[_0x5297('0x15')](handleEntityNotFound(_0x15c0ad,null));}})[_0x5297('0x15')](function(_0x38c9f3){if(_0x38c9f3){var _0x2c4c2b=_0x38c9f3[_0x5297('0x72')]!==null;var _0x1248be=path['join'](config['root'],_0x5297('0x73'));if(_0x2c4c2b){_0x1248be=path['join'](_0x1248be,_0x5297('0x74'));}var _0x45aa1a=path[_0x5297('0x75')](_0x1248be,_0x38c9f3[_0x5297('0x76')]);return _0x15c0ad[_0x5297('0x77')](_0x45aa1a);}})['catch'](handleError(_0x15c0ad,null));};exports[_0x5297('0x78')]=function(_0x2d9613,_0x4ca5cb){var _0x2016b6=null;var _0x196ede=null;var _0x14e5ca=null;if(_0x2d9613[_0x5297('0x48')]['id']){delete _0x2d9613[_0x5297('0x48')]['id'];}if(_0x2d9613[_0x5297('0x48')][_0x5297('0x79')]){_0x14e5ca=path['join'](config[_0x5297('0x7a')],'server/files/chat/upload/',util[_0x5297('0x7b')](_0x5297('0x7c'),Date[_0x5297('0x7d')]()));_0x2d9613[_0x5297('0x48')][_0x5297('0x7e')]=_0x14e5ca;}return db[_0x5297('0x34')]['find']({'where':{'id':_0x2d9613['params']['id']},'include':[{'model':db[_0x5297('0x5d')],'as':'Messages','include':[{'model':db[_0x5297('0x7f')],'as':_0x5297('0x7f')}]}]})[_0x5297('0x15')](handleEntityNotFound(_0x4ca5cb,null))[_0x5297('0x15')](saveUpdates(_0x2d9613[_0x5297('0x48')],null))[_0x5297('0x15')](function(_0x371b7b){if(_0x371b7b){_0x2016b6=_0x371b7b;return db[_0x5297('0x4b')][_0x5297('0x46')]({'where':{'id':_0x2016b6[_0x5297('0x80')]}});}})[_0x5297('0x15')](function(_0xe49aaa){if(_0xe49aaa){_0x196ede=_0xe49aaa;return db[_0x5297('0x60')][_0x5297('0x46')]({'where':{'id':_0x2016b6[_0x5297('0x81')]}});}})[_0x5297('0x15')](function(_0xeaa6a3){if(_0xeaa6a3){if(_0x14e5ca){var _0x8a9697=null;for(var _0x2d0512=0x1;_0x2d0512<_0x2016b6[_0x5297('0x82')][_0x5297('0x42')];++_0x2d0512){_0x8a9697=_0x2016b6['Messages'][_0x2d0512];var _0x2498cc=_0x8a9697[_0x5297('0x65')]?util[_0x5297('0x7b')]('%s%d',_0x196ede['agentAlias'],_0x8a9697[_0x5297('0x65')]):'System';var _0x3a28e4=_0x2d9613[_0x5297('0x48')]['customer']||util[_0x5297('0x7b')]('%s%d',_0x5297('0x83'),_0x8a9697['ContactId']);switch(_0x196ede['agentIdentifier']){case _0x5297('0x84'):_0x2498cc=_0x8a9697[_0x5297('0x65')]?util['format'](_0x5297('0x85'),_0x196ede[_0x5297('0x86')],_0x8a9697[_0x5297('0x65')]):_0x5297('0x87');break;case _0x5297('0x88'):_0x2498cc=_0x8a9697['UserId']?_0x8a9697['User'][_0x5297('0x89')]||_0x8a9697[_0x5297('0x7f')][_0x5297('0x51')]:_0x5297('0x87');break;case'agent_fullname':_0x2498cc=_0x8a9697[_0x5297('0x65')]?_0x8a9697[_0x5297('0x7f')]['fullname']:_0x5297('0x87');break;default:_0x2498cc=_0x8a9697['UserId']?util[_0x5297('0x7b')](_0x5297('0x85'),_0x196ede[_0x5297('0x86')],_0x8a9697[_0x5297('0x65')]):_0x5297('0x87');}var _0x782cb5=util[_0x5297('0x7b')](_0x5297('0x8a'),moment(_0x8a9697['createdAt'])['format'](_0x5297('0x8b')),_0x8a9697[_0x5297('0x8c')]==='in'?_0x3a28e4:_0x2498cc,_0x8a9697['body']);if(!_0x8a9697[_0x5297('0x8d')]){fs['appendFileSync'](_0x14e5ca,_0x782cb5);}}return db[_0x5297('0x8e')][_0x5297('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x5297('0x8f')],'as':_0x5297('0x90'),'raw':!![],'include':[{'model':db[_0x5297('0x91')],'as':_0x5297('0x91'),'raw':!![]}]}]});}}})[_0x5297('0x15')](function(_0x133ebe){if(!_0x133ebe||!_0x133ebe[_0x5297('0x90')]||!_0x2d9613['body'])return _0x2016b6;var _0xd96f21=_0x133ebe[_0x5297('0x92')]();return respondWithRpcPromise('SendMail',_0x5297('0x93'),{'account':_0xd96f21,'message':{'from':util[_0x5297('0x7b')](_0x5297('0x94'),_0x133ebe[_0x5297('0x2d')],_0x133ebe[_0x5297('0x52')]||_0x133ebe[_0x5297('0x90')][_0x5297('0x39')]),'to':_0x2d9613['body'][_0x5297('0x79')],'subject':_0x5297('0x95'),'text':util[_0x5297('0x7b')](_0x5297('0x96'),_0x2d9613['body']['mailTranscript']),'attachments':[{'path':_0x14e5ca}]}})['then'](function(){return _0x2016b6;})[_0x5297('0x20')](function(_0x4dd7d1){logger[_0x5297('0x1c')](_0x4dd7d1);});})[_0x5297('0x15')](respondWithStatusCode(_0x4ca5cb,0xc8))[_0x5297('0x20')](handleError(_0x4ca5cb,null));};exports[_0x5297('0x97')]=function(_0x3d0fd4,_0xf41871){return db[_0x5297('0x5d')][_0x5297('0x46')]({'where':{'id':_0x3d0fd4[_0x5297('0x3a')]['id']}})[_0x5297('0x15')](handleEntityNotFound(_0xf41871,null))[_0x5297('0x15')](function(_0x5b056b){if(_0x5b056b){return _0x5b056b[_0x5297('0x97')](_0x3d0fd4['body']['ids'],_['omit'](_0x3d0fd4[_0x5297('0x48')],[_0x5297('0x98'),'id'])||{});}})[_0x5297('0x15')](respondWithResult(_0xf41871,null))[_0x5297('0x20')](handleError(_0xf41871,null));};exports[_0x5297('0x99')]=function(_0xffff2e,_0x245a2e){var _0x61664d={'raw':![],'where':{}};var _0x57a5ca={};var _0x182c19={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0xffff2e[_0x5297('0x3a')]['id']}})['then'](handleEntityNotFound(_0x245a2e,null))[_0x5297('0x15')](function(_0x44fee3){if(_0x44fee3){_0x57a5ca['model']=_[_0x5297('0x3c')](db['ChatMessage']['rawAttributes']);_0x57a5ca[_0x5297('0x3d')]=_[_0x5297('0x3c')](_0xffff2e[_0x5297('0x3d')]);_0x57a5ca['filters']=_[_0x5297('0x3f')](_0x57a5ca[_0x5297('0x3b')],_0x57a5ca['query']);_0x61664d[_0x5297('0x40')]=_[_0x5297('0x3f')](_0x57a5ca['model'],qs[_0x5297('0x41')](_0xffff2e[_0x5297('0x3d')][_0x5297('0x41')]));_0x61664d[_0x5297('0x40')]=_0x61664d['attributes'][_0x5297('0x42')]?_0x61664d[_0x5297('0x40')]:_0x57a5ca[_0x5297('0x3b')];if(!_0xffff2e[_0x5297('0x3d')]['hasOwnProperty'](_0x5297('0x9a'))){_0x61664d[_0x5297('0x28')]=qs[_0x5297('0x28')](_0xffff2e['query'][_0x5297('0x28')]);_0x61664d[_0x5297('0x27')]=qs[_0x5297('0x27')](_0xffff2e[_0x5297('0x3d')][_0x5297('0x27')]);}_0x61664d[_0x5297('0x9b')]=qs[_0x5297('0x9c')](_0xffff2e['query'][_0x5297('0x9c')]);_0x61664d[_0x5297('0x9d')]=qs[_0x5297('0x3e')](_[_0x5297('0x9e')](_0xffff2e[_0x5297('0x3d')],_0x57a5ca[_0x5297('0x3e')]));_0x61664d['where'][_0x5297('0x9f')]=_0x44fee3['id'];if(_0xffff2e[_0x5297('0x3d')][_0x5297('0xa0')]){_0x61664d[_0x5297('0x9d')]=_['merge'](_0x61664d['where'],{'$or':_[_0x5297('0xa1')](_0x61664d[_0x5297('0x40')],function(_0x2af30e){var _0x4fff88={};_0x4fff88[_0x2af30e]={'$like':'%'+_0xffff2e[_0x5297('0x3d')][_0x5297('0xa0')]+'%'};return _0x4fff88;})});}if(_0xffff2e[_0x5297('0x3d')][_0x5297('0xa2')]){var _0x3c66cb=_0xffff2e[_0x5297('0x3d')][_0x5297('0xa2')]['split'](',');var _0x3e78cf={};_0x3e78cf[_0x3c66cb[0x0]]={'$gte':moment(_0x3c66cb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x61664d['where']=_[_0x5297('0x45')](_0x61664d['where'],_0x3e78cf);}_0x61664d=_[_0x5297('0x45')]({},_0x61664d,_0xffff2e['options']);return db[_0x5297('0x5d')][_0x5297('0x26')]({'where':_0x61664d[_0x5297('0x9d')]})['then'](function(_0x58f608){_0x182c19[_0x5297('0x26')]=_0x58f608;if(_0xffff2e['query'][_0x5297('0x43')]){_0x61664d[_0x5297('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x5297('0x38')](_0x61664d);})[_0x5297('0x15')](function(_0xedce0f){_0x182c19[_0x5297('0xa3')]=_0xedce0f;return _0x182c19;});}})[_0x5297('0x15')](respondWithFilteredResult(_0x245a2e,_0x61664d))['catch'](handleError(_0x245a2e,null));};exports['getMyMessages']=function(_0x347151,_0x37ee31){var _0x1f0199={'where':{}},_0x4087f5={},_0x46b322={'count':0x0,'rows':[]};return db[_0x5297('0x34')][_0x5297('0x4a')]({'where':{'id':_0x347151['params']['id']}})[_0x5297('0x15')](handleEntityNotFound(_0x37ee31,null))[_0x5297('0x15')](function(_0x2a7c30){if(_0x2a7c30){_0x4087f5[_0x5297('0x3b')]=_[_0x5297('0x3c')](db[_0x5297('0x5d')][_0x5297('0x35')]);_0x4087f5[_0x5297('0x3d')]=_[_0x5297('0x3c')](_0x347151[_0x5297('0x3d')]);_0x4087f5[_0x5297('0x3e')]=_[_0x5297('0x3f')](_0x4087f5[_0x5297('0x3b')],_0x4087f5[_0x5297('0x3d')]);_0x1f0199[_0x5297('0x40')]=_[_0x5297('0x3f')](_0x4087f5['model'],qs[_0x5297('0x41')](_0x347151[_0x5297('0x3d')]['fields']));_0x1f0199[_0x5297('0x40')]=_0x1f0199[_0x5297('0x40')][_0x5297('0x42')]?_0x1f0199[_0x5297('0x40')]:_0x4087f5[_0x5297('0x3b')];if(!_0x347151[_0x5297('0x3d')]['hasOwnProperty'](_0x5297('0x9a'))){_0x1f0199[_0x5297('0x28')]=qs[_0x5297('0x28')](_0x347151[_0x5297('0x3d')][_0x5297('0x28')]);_0x1f0199[_0x5297('0x27')]=qs[_0x5297('0x27')](_0x347151[_0x5297('0x3d')][_0x5297('0x27')]);}_0x1f0199[_0x5297('0x9b')]=qs['sort'](_0x347151['query'][_0x5297('0x9c')]);_0x1f0199[_0x5297('0x9d')]=qs[_0x5297('0x3e')](_['pick'](_0x347151['query'],_0x4087f5[_0x5297('0x3e')]));_0x1f0199[_0x5297('0x9d')][_0x5297('0x9f')]=_0x2a7c30['id'];if(_0x347151[_0x5297('0x3d')][_0x5297('0xa0')]){_0x1f0199[_0x5297('0x9d')]=_[_0x5297('0x45')](_0x1f0199[_0x5297('0x9d')],{'$or':_['map'](_0x1f0199[_0x5297('0x40')],function(_0xf432dd){var _0x3cbe80={};_0x3cbe80[_0xf432dd]={'$like':'%'+_0x347151[_0x5297('0x3d')][_0x5297('0xa0')]+'%'};return _0x3cbe80;})});}_0x1f0199[_0x5297('0x9d')][_0x5297('0x8d')]=![];if(_0x347151[_0x5297('0x3d')]['id']){_0x1f0199[_0x5297('0x9d')]['id']={'$gt':_0x347151[_0x5297('0x3d')]['id']};}_0x1f0199=_[_0x5297('0x45')]({},_0x1f0199,_0x347151[_0x5297('0xa4')]);return db[_0x5297('0x5d')][_0x5297('0x26')]({'where':_0x1f0199[_0x5297('0x9d')]})[_0x5297('0x15')](function(_0x1e7e83){_0x46b322[_0x5297('0x26')]=_0x1e7e83;_0x1f0199['include']=[];if(_0x347151[_0x5297('0x3d')][_0x5297('0xa5')]){_0x1f0199[_0x5297('0x44')][_0x5297('0xa6')]({'model':db[_0x5297('0x7f')],'as':_0x5297('0x7f'),'attributes':['id',_0x5297('0x51'),'alias']});}if(_0x347151['query'][_0x5297('0x43')]){_0x1f0199[_0x5297('0x44')]=[{'all':!![]}];}return db[_0x5297('0x5d')][_0x5297('0x38')](_0x1f0199);})[_0x5297('0x15')](function(_0x3ce509){_0x46b322[_0x5297('0xa3')]=_0x3ce509;return _0x46b322;});}})[_0x5297('0x15')](respondWithFilteredResult(_0x37ee31,_0x1f0199))[_0x5297('0x20')](handleError(_0x37ee31,null));};exports['addTags']=function(_0x57ee25,_0x562531){return db[_0x5297('0x34')][_0x5297('0x46')]({'where':{'id':_0x57ee25[_0x5297('0x3a')]['id']}})['then'](handleEntityNotFound(_0x562531,null))[_0x5297('0x15')](function(_0x1b9b96){if(_0x1b9b96){return _0x1b9b96['setTags'](_0x57ee25[_0x5297('0x48')][_0x5297('0x98')],_['omit'](_0x57ee25['body'],['ids','id'])||{})[_0x5297('0xa7')](function(){return db[_0x5297('0xa8')][_0x5297('0x38')]({'attributes':['id','name',_0x5297('0xa9')],'where':{'id':_0x57ee25[_0x5297('0x48')][_0x5297('0x98')]}});})[_0x5297('0x15')](function(_0x2bfea0){socket[_0x5297('0xaa')]('chatInteractionTags:save',{'id':Number(_0x57ee25[_0x5297('0x3a')]['id']),'tags':_0x2bfea0||[]});return{'id':Number(_0x57ee25[_0x5297('0x3a')]['id']),'tags':_0x2bfea0||[]};});}})[_0x5297('0x15')](respondWithResult(_0x562531,null))[_0x5297('0x20')](handleError(_0x562531,null));};exports['removeTags']=function(_0x1421d2,_0x3393aa){return db[_0x5297('0x34')][_0x5297('0x46')]({'where':{'id':_0x1421d2['params']['id']}})[_0x5297('0x15')](handleEntityNotFound(_0x3393aa,null))[_0x5297('0x15')](function(_0x390937){if(_0x390937){return _0x390937[_0x5297('0xab')](_0x1421d2[_0x5297('0x3d')][_0x5297('0x98')]);}})[_0x5297('0x15')](respondWithStatusCode(_0x3393aa,null))[_0x5297('0x20')](handleError(_0x3393aa,null));};exports[_0x5297('0x77')]=function(_0x495dd2,_0x400789){var _0x2831a7=moment()[_0x5297('0xac')]()[_0x5297('0xad')]();var _0x1e6f8c=path[_0x5297('0x75')](config['root'],'server',_0x5297('0xae'),_0x5297('0xaf'));var _0x57f3a3=path[_0x5297('0x75')](config['root'],_0x5297('0xb0'),_0x5297('0xae'),_0x5297('0xb1'));var _0x2d4b67=path[_0x5297('0x75')](_0x1e6f8c,_0x2831a7);var _0x51e432=util[_0x5297('0x7b')](_0x5297('0xb2'),_0x495dd2['params']['id'],_0x2831a7);var _0x53b64b=path[_0x5297('0x75')](_0x1e6f8c,_0x51e432);var _0x141c86=[];_0x141c86[_0x5297('0xa6')]({'model':db[_0x5297('0x7f')],'as':_0x5297('0x7f'),'attributes':['id',_0x5297('0x51')],'raw':!![]});_0x141c86[_0x5297('0xa6')]({'model':db['CmContact'],'as':_0x5297('0x61'),'attributes':['id','firstName',_0x5297('0xb3')],'raw':!![]});if(_0x495dd2[_0x5297('0x3d')][_0x5297('0xb1')]){_0x141c86['push']({'model':db[_0x5297('0x70')],'as':_0x5297('0x70'),'raw':!![]});}var _0x133ffa=[{'model':db['ChatMessage'],'as':_0x5297('0x82'),'attributes':['id','body','createdAt',_0x5297('0x8c'),_0x5297('0x8d'),_0x5297('0xb4')],'include':_0x141c86}];_0x133ffa[_0x5297('0xa6')]({'model':db[_0x5297('0x4b')],'as':_0x5297('0xb5'),'attributes':['id',_0x5297('0x2d')]});_0x133ffa[_0x5297('0xa6')]({'model':db[_0x5297('0x7f')],'as':_0x5297('0xb6'),'attributes':['id','fullname']});return db[_0x5297('0x34')][_0x5297('0x46')]({'where':{'id':_0x495dd2['params']['id']},'include':_0x133ffa})[_0x5297('0x15')](handleEntityNotFound(_0x400789,null))['then'](function(_0x378c8f){if(_0x378c8f){var _0x544b3e=_0x378c8f['get']({'plain':!![]});fs['mkdirSync'](_0x2d4b67);var _0xad150a={'channel':_0x5297('0xb7'),'account':_0x544b3e[_0x5297('0xb5')][_0x5297('0x2d')],'agent':_0x544b3e[_0x5297('0xb6')]?_0x544b3e[_0x5297('0xb6')][_0x5297('0x51')]:_0x5297('0xb8'),'createdAt':moment(_0x544b3e[_0x5297('0xb9')])[_0x5297('0x7b')](_0x5297('0xba'))[_0x5297('0xad')](),'closedAt':_0x544b3e[_0x5297('0x6f')]?moment(_0x544b3e[_0x5297('0xbb')])['format'](_0x5297('0xba'))['toString']():'','disposition':_0x544b3e[_0x5297('0x67')],'chatInfo':{'browser':_0x544b3e[_0x5297('0xbc')],'os':_0x544b3e['osName'],'referer':_0x544b3e[_0x5297('0xbd')],'customerIp':_0x544b3e[_0x5297('0xbe')],'customerPort':_0x544b3e[_0x5297('0xbf')]?_0x544b3e[_0x5297('0xbf')]:_0x5297('0xb8')},'messages':_(_0x544b3e[_0x5297('0x82')])[_0x5297('0xc0')]()[_0x5297('0xa0')]({'secret':![]})[_0x5297('0xa1')](function(_0xfb47ce){if(_0xfb47ce[_0x5297('0x70')]){var _0x485edb=path[_0x5297('0x75')](_0x57f3a3,_0xfb47ce[_0x5297('0x70')]['basename']);if(fs[_0x5297('0xc1')](_0x485edb)){fs[_0x5297('0xc2')](_0x485edb)[_0x5297('0xc3')](fs[_0x5297('0xc4')](path['join'](_0x2d4b67,_0xfb47ce[_0x5297('0x70')]['basename'])));}}return{'date':moment(_0xfb47ce['createdAt'])[_0x5297('0x7b')](_0x5297('0xba'))[_0x5297('0xad')](),'sender':_0xfb47ce[_0x5297('0x8c')]===_0x5297('0x5c')?_0xfb47ce[_0x5297('0x7f')]?_0xfb47ce[_0x5297('0x7f')]['fullname']:_0x5297('0x87'):_0xfb47ce[_0x5297('0x61')][_0x5297('0xc5')]+(_0xfb47ce['Contact'][_0x5297('0xb3')]?'\x20'+_0xfb47ce[_0x5297('0x61')]['lastName']:''),'body':_0xfb47ce[_0x5297('0x70')]?_0xfb47ce[_0x5297('0x70')][_0x5297('0x76')]:_0xfb47ce[_0x5297('0x48')],'direction':_0xfb47ce['direction']===_0x5297('0x5c')?'A':'C','secret':_0xfb47ce[_0x5297('0x8d')],'read':_0xfb47ce['read'],'attachment':_0xfb47ce['Attachment']};})[_0x5297('0xc6')]()};return ejs[_0x5297('0xc7')](path['join'](config[_0x5297('0x7a')],_0x5297('0xb0'),'views',_0x5297('0xc8')),{'interaction':_0xad150a})['then'](function(_0x555cf1){var _0x44f3e9=path['join'](_0x2d4b67,_0x5297('0xc9')+_0x544b3e['id']+'-'+_0x2831a7+_0x5297('0xca'));var _0x35572a={'path':_0x44f3e9,'channel':_0x5297('0xb7'),'interactionId':_0x544b3e['id']};return pdf['createPdfFromHTML'](_0x555cf1,_0x35572a);})[_0x5297('0x15')](function(){return new Promise(function(_0x3cc729,_0x482690){zipdir(_0x2d4b67,{'saveTo':_0x53b64b},function(_0x593859,_0x960586){if(_0x593859)return _0x482690(_0x593859);return _0x3cc729(_0x960586);});})['then'](function(){return new BPromise(function(_0x5108d3,_0x134928){rimraf(_0x2d4b67,function(_0x553e90){if(_0x553e90)_0x134928(_0x553e90);return _0x5108d3();});});})[_0x5297('0x15')](function(){return _0x400789[_0x5297('0x77')](_0x53b64b,_0x51e432,function(_0x16c9c8){if(_0x16c9c8){logger[_0x5297('0x1c')](_0x5297('0xcb'),_0x16c9c8);}else{fs[_0x5297('0xcc')](_0x53b64b);}});});});}else{return _0x400789['sendStatus'](0xc8);}})[_0x5297('0x20')](handleError(_0x400789,null));}; \ No newline at end of file +var _0x22eb=['jayson/promise','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','set','update','then','end','stack','render','body','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','query','user','catch','model','keys','filters','attributes','intersection','fields','includeAll','include','options','params','destroy','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','fullname','email','contact','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','attachmentUpload','name','file','originalname','filename','attachmentDownload','closed','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','length','%s%d','agentAlias','System','Visitor','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','order','sort','where','pick','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','hasOwnProperty','ChatInteractionId','includeAgent','addTags','spread','Tag','findAll','color','emit','removeTags','server','files','attachments','transcript-%d-%s.zip','push','firstName','read','Account','Owner','mkdirSync','N.A.','toString','closedAt','osName','customerIp','customerPort','existsSync','createReadStream','createWriteStream','Contact','lastName','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register'];(function(_0x84fdd8,_0x187bac){var _0x59ab14=function(_0x31dfa2){while(--_0x31dfa2){_0x84fdd8['push'](_0x84fdd8['shift']());}};_0x59ab14(++_0x187bac);}(_0x22eb,0xb7));var _0xb22e=function(_0x3bc3b7,_0x4f12c7){_0x3bc3b7=_0x3bc3b7-0x0;var _0x4127d8=_0x22eb[_0x3bc3b7];return _0x4127d8;};'use strict';var rimraf=require(_0xb22e('0x0'));var zipdir=require(_0xb22e('0x1'));var rp=require(_0xb22e('0x2'));var moment=require('moment');var BPromise=require(_0xb22e('0x3'));var Mustache=require(_0xb22e('0x4'));var util=require(_0xb22e('0x5'));var path=require(_0xb22e('0x6'));var ejs=require(_0xb22e('0x7'));var fs=require('fs');var _=require(_0xb22e('0x8'));var Redis=require(_0xb22e('0x9'));var interaction=require(_0xb22e('0xa'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb22e('0xb'));var logger=require('../../config/logger')(_0xb22e('0xc'));var config=require(_0xb22e('0xd'));var db=require(_0xb22e('0xe'))['db'];config[_0xb22e('0xf')]=_['defaults'](config[_0xb22e('0xf')],{'host':_0xb22e('0x10'),'port':0x18eb});var socket=require(_0xb22e('0x11'))(new Redis(config[_0xb22e('0xf')]));require('./chatInteraction.socket')[_0xb22e('0x12')](socket);var jayson=require(_0xb22e('0x13'));var client=jayson[_0xb22e('0x14')][_0xb22e('0x15')]({'port':0x232b});var client9004=jayson[_0xb22e('0x14')][_0xb22e('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4e1677,_0x3792ec,_0x233be5,_0x120590){return new BPromise(function(_0x9d04ae,_0x2a3c3b){var _0x2a4d4b=_0x120590||client;return _0x2a4d4b[_0xb22e('0x16')](_0x4e1677,_0x233be5)['then'](function(_0x33e426){logger[_0xb22e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x3792ec,_0xb22e('0x18'));logger[_0xb22e('0x19')](_0xb22e('0x1a'),_0x3792ec,'request\x20sent',JSON['stringify'](_0x33e426));if(_0x33e426[_0xb22e('0x1b')]){if(_0x33e426[_0xb22e('0x1b')][_0xb22e('0x1c')]===0x1f4){logger[_0xb22e('0x1b')](_0xb22e('0x1d'),_0x3792ec,_0x33e426[_0xb22e('0x1b')][_0xb22e('0x1e')]);return _0x2a3c3b(_0x33e426[_0xb22e('0x1b')][_0xb22e('0x1e')]);}logger[_0xb22e('0x1b')](_0xb22e('0x1d'),_0x3792ec,_0x33e426[_0xb22e('0x1b')]['message']);return _0x9d04ae(_0x33e426['error']['message']);}else{logger[_0xb22e('0x17')](_0xb22e('0x1d'),_0x3792ec,_0xb22e('0x18'));_0x9d04ae(_0x33e426[_0xb22e('0x1f')][_0xb22e('0x1e')]);}})['catch'](function(_0x3617ab){logger[_0xb22e('0x1b')](_0xb22e('0x1d'),_0x3792ec,_0x3617ab);_0x2a3c3b(_0x3617ab);});});}function respondWithStatusCode(_0x3b6ac0,_0x2b3b5e){_0x2b3b5e=_0x2b3b5e||0xcc;return function(_0xe5244a){if(_0xe5244a){return _0x3b6ac0[_0xb22e('0x20')](_0x2b3b5e);}return _0x3b6ac0[_0xb22e('0x21')](_0x2b3b5e)['end']();};}function respondWithResult(_0x30e7be,_0x46cd37){_0x46cd37=_0x46cd37||0xc8;return function(_0x3e9d1e){if(_0x3e9d1e){return _0x30e7be['status'](_0x46cd37)[_0xb22e('0x22')](_0x3e9d1e);}};}function respondWithFilteredResult(_0x46e80b,_0x4fd053){return function(_0xca303f){if(_0xca303f){var _0x2acf40=typeof _0x4fd053[_0xb22e('0x23')]==='undefined'&&typeof _0x4fd053[_0xb22e('0x24')]===_0xb22e('0x25');var _0xaa8894=_0xca303f[_0xb22e('0x26')];var _0x4f7a93=_0x2acf40?0x0:_0x4fd053[_0xb22e('0x23')];var _0x4e67c3=_0x2acf40?_0xca303f[_0xb22e('0x26')]:_0x4fd053[_0xb22e('0x23')]+_0x4fd053[_0xb22e('0x24')];var _0x1fb61;if(_0x4e67c3>=_0xaa8894){_0x4e67c3=_0xaa8894;_0x1fb61=0xc8;}else{_0x1fb61=0xce;}_0x46e80b[_0xb22e('0x21')](_0x1fb61);return _0x46e80b[_0xb22e('0x27')]('Content-Range',_0x4f7a93+'-'+_0x4e67c3+'/'+_0xaa8894)[_0xb22e('0x22')](_0xca303f);}return null;};}function saveUpdates(_0x4074fe){return function(_0x1dbcec){if(_0x1dbcec){return _0x1dbcec[_0xb22e('0x28')](_0x4074fe)[_0xb22e('0x29')](function(_0x454342){return _0x454342;});}return null;};}function removeEntity(_0x52b853){return function(_0x2c1061){if(_0x2c1061){return _0x2c1061['destroy']()['then'](function(){_0x52b853[_0xb22e('0x21')](0xcc)[_0xb22e('0x2a')]();});}};}function handleEntityNotFound(_0x5080de){return function(_0x1aa966){if(!_0x1aa966){_0x5080de[_0xb22e('0x20')](0x194);}return _0x1aa966;};}function handleError(_0x4a86da,_0x28b083){_0x28b083=_0x28b083||0x1f4;return function(_0x449319){logger[_0xb22e('0x1b')](_0x449319[_0xb22e('0x2b')]);if(_0x449319['name']){delete _0x449319['name'];}_0x4a86da['status'](_0x28b083)['send'](_0x449319);};}function getMustacheRender(_0x59ccb7,_0x31a273){return Mustache[_0xb22e('0x2c')](_0x59ccb7,_['merge'](_0x31a273[_0xb22e('0x2d')],{'contact':_0x31a273['contact'],'message':_0x31a273[_0xb22e('0x1e')],'agent':_0x31a273[_0xb22e('0x2e')],'interaction':_0x31a273[_0xb22e('0x2f')],'account':_0x31a273['account']}))||'';}exports[_0xb22e('0x30')]=function(_0x32e583,_0x2fefdb){var _0x4d6774={};var _0x1310bf=_[_0xb22e('0x31')](db[_0xb22e('0x32')][_0xb22e('0x33')],function(_0xe321f5){return{'name':_0xe321f5[_0xb22e('0x34')],'type':_0xe321f5[_0xb22e('0x35')][_0xb22e('0x36')]};});_0x4d6774=qs['getOptions'](_0x1310bf,_0x32e583);return interaction['findAll']('chat',_0x32e583[_0xb22e('0x37')],_0x32e583[_0xb22e('0x38')],_0x4d6774,_0x1310bf)['then'](respondWithFilteredResult(_0x2fefdb,_0x4d6774))[_0xb22e('0x39')](handleError(_0x2fefdb,null));};exports['show']=function(_0x48a8f7,_0x510276){var _0x142645={'raw':![],'where':{'id':_0x48a8f7['params']['id']}},_0x1b7c55={};_0x1b7c55[_0xb22e('0x3a')]=_[_0xb22e('0x3b')](db[_0xb22e('0x32')]['rawAttributes']);_0x1b7c55[_0xb22e('0x37')]=_[_0xb22e('0x3b')](_0x48a8f7[_0xb22e('0x37')]);_0x1b7c55[_0xb22e('0x3c')]=_['intersection'](_0x1b7c55[_0xb22e('0x3a')],_0x1b7c55[_0xb22e('0x37')]);_0x142645[_0xb22e('0x3d')]=_[_0xb22e('0x3e')](_0x1b7c55['model'],qs[_0xb22e('0x3f')](_0x48a8f7[_0xb22e('0x37')][_0xb22e('0x3f')]));_0x142645[_0xb22e('0x3d')]=_0x142645['attributes']['length']?_0x142645[_0xb22e('0x3d')]:_0x1b7c55[_0xb22e('0x3a')];if(_0x48a8f7[_0xb22e('0x37')][_0xb22e('0x40')]){_0x142645[_0xb22e('0x41')]=[{'all':!![]}];}_0x142645=_['merge']({},_0x142645,_0x48a8f7[_0xb22e('0x42')]);return db[_0xb22e('0x32')]['find'](_0x142645)[_0xb22e('0x29')](handleEntityNotFound(_0x510276,null))[_0xb22e('0x29')](respondWithResult(_0x510276,null))[_0xb22e('0x39')](handleError(_0x510276,null));};exports['create']=function(_0x22cea7,_0x44f8ad){return db['ChatInteraction']['create'](_0x22cea7[_0xb22e('0x2d')],{})[_0xb22e('0x29')](respondWithResult(_0x44f8ad,0xc9))[_0xb22e('0x39')](handleError(_0x44f8ad,null));};exports['update']=function(_0x4bb9d2,_0x17da81){if(_0x4bb9d2[_0xb22e('0x2d')]['id']){delete _0x4bb9d2[_0xb22e('0x2d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4bb9d2[_0xb22e('0x43')]['id']}})[_0xb22e('0x29')](handleEntityNotFound(_0x17da81,null))['then'](saveUpdates(_0x4bb9d2[_0xb22e('0x2d')],null))[_0xb22e('0x29')](respondWithResult(_0x17da81,null))[_0xb22e('0x39')](handleError(_0x17da81,null));};exports[_0xb22e('0x44')]=function(_0x642d12,_0x14a292){return db['ChatInteraction'][_0xb22e('0x45')]({'where':{'id':_0x642d12[_0xb22e('0x43')]['id']}})['then'](handleEntityNotFound(_0x14a292,null))['then'](removeEntity(_0x14a292,null))[_0xb22e('0x39')](handleError(_0x14a292,null));};exports[_0xb22e('0x46')]=function(_0x45115c,_0x48b4a8){return db[_0xb22e('0x32')][_0xb22e('0x46')]()[_0xb22e('0x29')](respondWithResult(_0x48b4a8,null))[_0xb22e('0x39')](handleError(_0x48b4a8,null));};exports[_0xb22e('0x47')]=function(_0x34a77d,_0x597802){var _0xf4fcf2=_0x34a77d['params']['id'];var _0x3f7d3b;var _0x16d751;var _0x523fab;return db[_0xb22e('0x32')][_0xb22e('0x48')]({'where':{'id':_0xf4fcf2}})[_0xb22e('0x29')](function(_0x254c0d){_0x3f7d3b=_0x254c0d;return db[_0xb22e('0x49')][_0xb22e('0x48')]({'where':{'id':_0x254c0d[_0xb22e('0x4a')]},'attributes':['id',_0xb22e('0x4b'),'vidaooEscalation',_0xb22e('0x4c'),'vidaooNote',_0xb22e('0x4d')],'raw':!![]});})[_0xb22e('0x29')](function(_0x2b5cf7){if(_0x2b5cf7&&_0x2b5cf7['vidaooApiKey']&&_0x2b5cf7[_0xb22e('0x4e')]){_0x16d751=_0x2b5cf7;var _0x5415ab={'interaction':{'id':_0xf4fcf2},'agent':{'id':_0x34a77d[_0xb22e('0x38')]['id'],'name':_0x34a77d['user']['name'],'fullname':_0x34a77d[_0xb22e('0x38')][_0xb22e('0x4f')],'email':_0x34a77d[_0xb22e('0x38')][_0xb22e('0x50')]},'contact':_0x34a77d['body'][_0xb22e('0x51')],'account':_0x34a77d[_0xb22e('0x2d')]['account']};var _0x12f19c={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2b5cf7['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34a77d[_0xb22e('0x38')]['email']],'buttons':null,'topic':_0x16d751[_0xb22e('0x4c')],'note':_[_0xb22e('0x52')](_0x16d751[_0xb22e('0x53')])?null:getMustacheRender(_0x16d751[_0xb22e('0x53')],_0x5415ab),'metadata':null},'redirect':_0xb22e('0x54'),'json':!![]};try{if(!_[_0xb22e('0x52')](_0x16d751[_0xb22e('0x4d')])){var _0x8ca2a7=getMustacheRender(_0x16d751[_0xb22e('0x4d')],_0x5415ab);var _0x5c3dba=JSON[_0xb22e('0x55')](_0x8ca2a7);_0x12f19c['body'][_0xb22e('0x56')]=_0x5c3dba;}}catch(_0x1988b6){throw new db[(_0xb22e('0x57'))][(_0xb22e('0x58'))](_0xb22e('0x59'));}return rp(_0x12f19c);}else{throw new db[(_0xb22e('0x57'))][(_0xb22e('0x58'))](_0xb22e('0x5a'));}})[_0xb22e('0x29')](function(_0x3ae25e){_0x523fab=_0x3ae25e;if(_0x523fab['id']){var _0x237e7a={'body':_0x523fab[_0xb22e('0x5b')],'ChatWebsiteId':_0x16d751['id'],'ChatInteractionId':_0x3f7d3b['id'],'direction':_0xb22e('0x5c'),'UserId':_0x34a77d[_0xb22e('0x38')]['id']};return db[_0xb22e('0x5d')][_0xb22e('0x5e')](_0x237e7a,{});}else{throw new db[(_0xb22e('0x57'))]['ValidationError'](_0xb22e('0x5f'));}})[_0xb22e('0x29')](function(){return _0x3f7d3b[_0xb22e('0x60')]({'vidaooSessionId':_0x523fab['id']});})[_0xb22e('0x29')](respondWithResult(_0x597802,null))[_0xb22e('0x39')](handleError(_0x597802,null));};exports[_0xb22e('0x61')]=function(_0x1479f0,_0x124810){if(_0x1479f0[_0xb22e('0x2d')]['id']){delete _0x1479f0['body']['id'];}return db[_0xb22e('0x32')][_0xb22e('0x45')]({'where':{'id':_0x1479f0[_0xb22e('0x43')]['id']},'include':[{'model':db[_0xb22e('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x124810,null))[_0xb22e('0x29')](saveUpdates(_0x1479f0[_0xb22e('0x2d')],null))[_0xb22e('0x29')](respondWithResult(_0x124810,null))[_0xb22e('0x39')](handleError(_0x124810,null));};exports[_0xb22e('0x63')]=function(_0x66d54c,_0x238c16){if(_0x66d54c[_0xb22e('0x2d')]['id']){delete _0x66d54c[_0xb22e('0x2d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x66d54c['params']['id']}})[_0xb22e('0x29')](function(_0xc889f2){if(!_0xc889f2){logger[_0xb22e('0x1b')](_0xb22e('0x64'),'abandon',0x194,_0xb22e('0x65'));_0x238c16[_0xb22e('0x20')](0x194);}else{if(_0xc889f2[_0xb22e('0x66')]){throw new db[(_0xb22e('0x57'))][(_0xb22e('0x58'))](_0xb22e('0x67'));}}return _0xc889f2;})['then'](function(_0x51abaf){if(_0x51abaf){return _0x51abaf[_0xb22e('0x28')]({'closed':_0x66d54c[_0xb22e('0x2d')]['closed'],'disposition':_0x66d54c[_0xb22e('0x2d')]['disposition']})[_0xb22e('0x29')](function(_0x1d9606){return _0x1d9606;});}})[_0xb22e('0x29')](function(){return respondWithRpcPromise('AbandonInteraction',_0xb22e('0x63'),_0x66d54c[_0xb22e('0x2d')],client9004);})[_0xb22e('0x29')](respondWithResult(_0x238c16,null))[_0xb22e('0x39')](handleError(_0x238c16,null));};exports[_0xb22e('0x68')]=function(_0x1a105b,_0x175c13){_0x1a105b[_0xb22e('0x2d')][_0xb22e('0x69')]=_0x1a105b[_0xb22e('0x6a')][_0xb22e('0x6b')];_0x1a105b[_0xb22e('0x2d')]['basename']=_0x1a105b['file'][_0xb22e('0x6c')];_0x1a105b['body'][_0xb22e('0x35')]=_0x1a105b[_0xb22e('0x6a')]['mimetype'];return db['Attachment'][_0xb22e('0x5e')](_0x1a105b['body'])[_0xb22e('0x29')](respondWithResult(_0x175c13,0xc9))[_0xb22e('0x39')](handleError(_0x175c13,null));};exports[_0xb22e('0x6d')]=function(_0x34d8bf,_0x250e8a){return db[_0xb22e('0x32')][_0xb22e('0x48')]({'where':{'id':_0x34d8bf[_0xb22e('0x43')]['id']},'raw':!![]})[_0xb22e('0x29')](handleEntityNotFound(_0x250e8a,null))[_0xb22e('0x29')](function(_0x9b6b8a){if(_0x9b6b8a){if(_0x9b6b8a[_0xb22e('0x6e')]){return _0x250e8a[_0xb22e('0x21')](0x193)[_0xb22e('0x22')]({'status':0x193,'message':'Unauthorized'});}return db[_0xb22e('0x6f')][_0xb22e('0x48')]({'where':{'id':_0x34d8bf['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x250e8a,null));}})['then'](function(_0xf2e878){if(_0xf2e878){var _0x5928de=_0xf2e878[_0xb22e('0x70')]!==null;var _0x575db4=path[_0xb22e('0x71')](config[_0xb22e('0x72')],_0xb22e('0x73'));if(_0x5928de){_0x575db4=path[_0xb22e('0x71')](_0x575db4,_0xb22e('0x74'));}var _0x578769=path[_0xb22e('0x71')](_0x575db4,_0xf2e878[_0xb22e('0x75')]);return _0x250e8a[_0xb22e('0x76')](_0x578769);}})[_0xb22e('0x39')](handleError(_0x250e8a,null));};exports[_0xb22e('0x77')]=function(_0x1216b8,_0x52c365){var _0x184ba3=null;var _0xc281af=null;var _0x568015=null;if(_0x1216b8[_0xb22e('0x2d')]['id']){delete _0x1216b8['body']['id'];}if(_0x1216b8[_0xb22e('0x2d')]['mailTranscript']){_0x568015=path[_0xb22e('0x71')](config[_0xb22e('0x72')],'server/files/chat/upload/',util[_0xb22e('0x78')](_0xb22e('0x79'),Date[_0xb22e('0x7a')]()));_0x1216b8[_0xb22e('0x2d')][_0xb22e('0x7b')]=_0x568015;}return db['ChatInteraction']['find']({'where':{'id':_0x1216b8[_0xb22e('0x43')]['id']},'include':[{'model':db[_0xb22e('0x5d')],'as':'Messages','include':[{'model':db[_0xb22e('0x7c')],'as':'User'}]}]})[_0xb22e('0x29')](handleEntityNotFound(_0x52c365,null))[_0xb22e('0x29')](saveUpdates(_0x1216b8[_0xb22e('0x2d')],null))[_0xb22e('0x29')](function(_0x2e3c8b){if(_0x2e3c8b){_0x184ba3=_0x2e3c8b;return db[_0xb22e('0x49')][_0xb22e('0x45')]({'where':{'id':_0x184ba3['ChatWebsiteId']}});}})[_0xb22e('0x29')](function(_0x589c67){if(_0x589c67){_0xc281af=_0x589c67;return db[_0xb22e('0x62')]['find']({'where':{'id':_0x184ba3[_0xb22e('0x7d')]}});}})[_0xb22e('0x29')](function(_0x2fd219){if(_0x2fd219){if(_0x568015){var _0x549916=null;for(var _0x2c77ad=0x1;_0x2c77ad<_0x184ba3[_0xb22e('0x7e')][_0xb22e('0x7f')];++_0x2c77ad){_0x549916=_0x184ba3['Messages'][_0x2c77ad];var _0x4cd9d1=_0x549916['UserId']?util[_0xb22e('0x78')](_0xb22e('0x80'),_0xc281af[_0xb22e('0x81')],_0x549916['UserId']):_0xb22e('0x82');var _0x313151=_0x1216b8[_0xb22e('0x2d')]['customer']||util[_0xb22e('0x78')](_0xb22e('0x80'),_0xb22e('0x83'),_0x549916[_0xb22e('0x7d')]);switch(_0xc281af['agentIdentifier']){case _0xb22e('0x84'):_0x4cd9d1=_0x549916[_0xb22e('0x66')]?util[_0xb22e('0x78')](_0xb22e('0x80'),_0xc281af[_0xb22e('0x81')],_0x549916['UserId']):'System';break;case _0xb22e('0x85'):_0x4cd9d1=_0x549916[_0xb22e('0x66')]?_0x549916[_0xb22e('0x7c')][_0xb22e('0x86')]||_0x549916['User'][_0xb22e('0x4f')]:'System';break;case'agent_fullname':_0x4cd9d1=_0x549916['UserId']?_0x549916[_0xb22e('0x7c')]['fullname']:_0xb22e('0x82');break;default:_0x4cd9d1=_0x549916[_0xb22e('0x66')]?util[_0xb22e('0x78')](_0xb22e('0x80'),_0xc281af['agentAlias'],_0x549916[_0xb22e('0x66')]):_0xb22e('0x82');}var _0x457def=util[_0xb22e('0x78')](_0xb22e('0x87'),moment(_0x549916[_0xb22e('0x88')])['format'](_0xb22e('0x89')),_0x549916[_0xb22e('0x8a')]==='in'?_0x313151:_0x4cd9d1,_0x549916['body']);if(!_0x549916[_0xb22e('0x8b')]){fs[_0xb22e('0x8c')](_0x568015,_0x457def);}}return db[_0xb22e('0x8d')][_0xb22e('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xb22e('0x8e')],'as':_0xb22e('0x8f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb22e('0x90'),'raw':!![]}]}]});}}})['then'](function(_0x52b316){if(!_0x52b316||!_0x52b316['Smtp']||!_0x1216b8['body'])return _0x184ba3;var _0x149b14=_0x52b316[_0xb22e('0x91')]();return respondWithRpcPromise(_0xb22e('0x92'),_0xb22e('0x93'),{'account':_0x149b14,'message':{'from':util['format'](_0xb22e('0x94'),_0x52b316['name'],_0x52b316[_0xb22e('0x50')]||_0x52b316[_0xb22e('0x8f')][_0xb22e('0x38')]),'to':_0x1216b8[_0xb22e('0x2d')][_0xb22e('0x95')],'subject':'Mail\x20Transcript','text':util[_0xb22e('0x78')](_0xb22e('0x96'),_0x1216b8[_0xb22e('0x2d')][_0xb22e('0x95')]),'attachments':[{'path':_0x568015}]}})[_0xb22e('0x29')](function(){return _0x184ba3;})[_0xb22e('0x39')](function(_0xe9d3e0){logger[_0xb22e('0x1b')](_0xe9d3e0);});})[_0xb22e('0x29')](respondWithStatusCode(_0x52c365,0xc8))[_0xb22e('0x39')](handleError(_0x52c365,null));};exports[_0xb22e('0x97')]=function(_0x244905,_0x381b56){return db['ChatMessage'][_0xb22e('0x45')]({'where':{'id':_0x244905[_0xb22e('0x43')]['id']}})[_0xb22e('0x29')](handleEntityNotFound(_0x381b56,null))['then'](function(_0x5e0e65){if(_0x5e0e65){return _0x5e0e65[_0xb22e('0x97')](_0x244905[_0xb22e('0x2d')][_0xb22e('0x98')],_['omit'](_0x244905[_0xb22e('0x2d')],['ids','id'])||{});}})['then'](respondWithResult(_0x381b56,null))['catch'](handleError(_0x381b56,null));};exports['getMessages']=function(_0xfbe8f0,_0x3bb1b7){var _0x5c27d9={'raw':![],'where':{}};var _0x38d422={};var _0x58cd4a={'count':0x0,'rows':[]};return db[_0xb22e('0x32')]['findOne']({'where':{'id':_0xfbe8f0['params']['id']}})['then'](handleEntityNotFound(_0x3bb1b7,null))[_0xb22e('0x29')](function(_0x3f02c5){if(_0x3f02c5){_0x38d422[_0xb22e('0x3a')]=_[_0xb22e('0x3b')](db[_0xb22e('0x5d')][_0xb22e('0x33')]);_0x38d422[_0xb22e('0x37')]=_['keys'](_0xfbe8f0[_0xb22e('0x37')]);_0x38d422[_0xb22e('0x3c')]=_[_0xb22e('0x3e')](_0x38d422[_0xb22e('0x3a')],_0x38d422[_0xb22e('0x37')]);_0x5c27d9[_0xb22e('0x3d')]=_[_0xb22e('0x3e')](_0x38d422[_0xb22e('0x3a')],qs[_0xb22e('0x3f')](_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0x3f')]));_0x5c27d9['attributes']=_0x5c27d9[_0xb22e('0x3d')][_0xb22e('0x7f')]?_0x5c27d9[_0xb22e('0x3d')]:_0x38d422['model'];if(!_0xfbe8f0[_0xb22e('0x37')]['hasOwnProperty'](_0xb22e('0x99'))){_0x5c27d9['limit']=qs[_0xb22e('0x24')](_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0x24')]);_0x5c27d9[_0xb22e('0x23')]=qs[_0xb22e('0x23')](_0xfbe8f0['query'][_0xb22e('0x23')]);}_0x5c27d9[_0xb22e('0x9a')]=qs[_0xb22e('0x9b')](_0xfbe8f0[_0xb22e('0x37')]['sort']);_0x5c27d9[_0xb22e('0x9c')]=qs[_0xb22e('0x3c')](_[_0xb22e('0x9d')](_0xfbe8f0['query'],_0x38d422[_0xb22e('0x3c')]));_0x5c27d9[_0xb22e('0x9c')]['ChatInteractionId']=_0x3f02c5['id'];if(_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0x9e')]){_0x5c27d9[_0xb22e('0x9c')]=_[_0xb22e('0x9f')](_0x5c27d9[_0xb22e('0x9c')],{'$or':_[_0xb22e('0x31')](_0x5c27d9[_0xb22e('0x3d')],function(_0x36a14c){var _0x1b980f={};_0x1b980f[_0x36a14c]={'$like':'%'+_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0x9e')]+'%'};return _0x1b980f;})});}if(_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0xa0')]){var _0x46cd39=_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0xa0')][_0xb22e('0xa1')](',');var _0x1ed602={};_0x1ed602[_0x46cd39[0x0]]={'$gte':moment(_0x46cd39[0x1])[_0xb22e('0x78')](_0xb22e('0xa2'))};_0x5c27d9['where']=_[_0xb22e('0x9f')](_0x5c27d9[_0xb22e('0x9c')],_0x1ed602);}_0x5c27d9=_['merge']({},_0x5c27d9,_0xfbe8f0['options']);return db[_0xb22e('0x5d')]['count']({'where':_0x5c27d9[_0xb22e('0x9c')]})[_0xb22e('0x29')](function(_0x4295b1){_0x58cd4a['count']=_0x4295b1;if(_0xfbe8f0[_0xb22e('0x37')][_0xb22e('0x40')]){_0x5c27d9[_0xb22e('0x41')]=[{'all':!![]}];}return db[_0xb22e('0x5d')]['findAll'](_0x5c27d9);})['then'](function(_0x5a3cac){_0x58cd4a[_0xb22e('0xa3')]=_0x5a3cac;return _0x58cd4a;});}})[_0xb22e('0x29')](respondWithFilteredResult(_0x3bb1b7,_0x5c27d9))['catch'](handleError(_0x3bb1b7,null));};exports['getMyMessages']=function(_0x43ce7d,_0x3d4e44){var _0x5a1322={'where':{}},_0x4cdca8={},_0x3b9912={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb22e('0x48')]({'where':{'id':_0x43ce7d[_0xb22e('0x43')]['id']}})[_0xb22e('0x29')](handleEntityNotFound(_0x3d4e44,null))[_0xb22e('0x29')](function(_0x409671){if(_0x409671){_0x4cdca8['model']=_[_0xb22e('0x3b')](db['ChatMessage'][_0xb22e('0x33')]);_0x4cdca8[_0xb22e('0x37')]=_[_0xb22e('0x3b')](_0x43ce7d[_0xb22e('0x37')]);_0x4cdca8[_0xb22e('0x3c')]=_[_0xb22e('0x3e')](_0x4cdca8[_0xb22e('0x3a')],_0x4cdca8[_0xb22e('0x37')]);_0x5a1322[_0xb22e('0x3d')]=_[_0xb22e('0x3e')](_0x4cdca8[_0xb22e('0x3a')],qs[_0xb22e('0x3f')](_0x43ce7d['query']['fields']));_0x5a1322['attributes']=_0x5a1322[_0xb22e('0x3d')][_0xb22e('0x7f')]?_0x5a1322[_0xb22e('0x3d')]:_0x4cdca8[_0xb22e('0x3a')];if(!_0x43ce7d['query'][_0xb22e('0xa4')](_0xb22e('0x99'))){_0x5a1322[_0xb22e('0x24')]=qs[_0xb22e('0x24')](_0x43ce7d[_0xb22e('0x37')][_0xb22e('0x24')]);_0x5a1322[_0xb22e('0x23')]=qs[_0xb22e('0x23')](_0x43ce7d[_0xb22e('0x37')][_0xb22e('0x23')]);}_0x5a1322['order']=qs['sort'](_0x43ce7d[_0xb22e('0x37')]['sort']);_0x5a1322[_0xb22e('0x9c')]=qs[_0xb22e('0x3c')](_[_0xb22e('0x9d')](_0x43ce7d[_0xb22e('0x37')],_0x4cdca8[_0xb22e('0x3c')]));_0x5a1322['where'][_0xb22e('0xa5')]=_0x409671['id'];if(_0x43ce7d[_0xb22e('0x37')][_0xb22e('0x9e')]){_0x5a1322[_0xb22e('0x9c')]=_[_0xb22e('0x9f')](_0x5a1322['where'],{'$or':_[_0xb22e('0x31')](_0x5a1322[_0xb22e('0x3d')],function(_0x4b6e8a){var _0x3522bd={};_0x3522bd[_0x4b6e8a]={'$like':'%'+_0x43ce7d[_0xb22e('0x37')][_0xb22e('0x9e')]+'%'};return _0x3522bd;})});}_0x5a1322[_0xb22e('0x9c')]['secret']=![];if(_0x43ce7d[_0xb22e('0x37')]['id']){_0x5a1322['where']['id']={'$gt':_0x43ce7d[_0xb22e('0x37')]['id']};}_0x5a1322=_[_0xb22e('0x9f')]({},_0x5a1322,_0x43ce7d[_0xb22e('0x42')]);return db['ChatMessage']['count']({'where':_0x5a1322[_0xb22e('0x9c')]})[_0xb22e('0x29')](function(_0x345e9a){_0x3b9912[_0xb22e('0x26')]=_0x345e9a;_0x5a1322[_0xb22e('0x41')]=[];if(_0x43ce7d[_0xb22e('0x37')][_0xb22e('0xa6')]){_0x5a1322[_0xb22e('0x41')]['push']({'model':db['User'],'as':_0xb22e('0x7c'),'attributes':['id','fullname',_0xb22e('0x86')]});}if(_0x43ce7d[_0xb22e('0x37')][_0xb22e('0x40')]){_0x5a1322[_0xb22e('0x41')]=[{'all':!![]}];}return db[_0xb22e('0x5d')]['findAll'](_0x5a1322);})[_0xb22e('0x29')](function(_0x3e603f){_0x3b9912[_0xb22e('0xa3')]=_0x3e603f;return _0x3b9912;});}})[_0xb22e('0x29')](respondWithFilteredResult(_0x3d4e44,_0x5a1322))[_0xb22e('0x39')](handleError(_0x3d4e44,null));};exports[_0xb22e('0xa7')]=function(_0x3ddaea,_0x33df70){return db[_0xb22e('0x32')][_0xb22e('0x45')]({'where':{'id':_0x3ddaea[_0xb22e('0x43')]['id']}})['then'](handleEntityNotFound(_0x33df70,null))[_0xb22e('0x29')](function(_0x526b72){if(_0x526b72){return _0x526b72['setTags'](_0x3ddaea['body']['ids'],_['omit'](_0x3ddaea[_0xb22e('0x2d')],[_0xb22e('0x98'),'id'])||{})[_0xb22e('0xa8')](function(){return db[_0xb22e('0xa9')][_0xb22e('0xaa')]({'attributes':['id',_0xb22e('0x69'),_0xb22e('0xab')],'where':{'id':_0x3ddaea[_0xb22e('0x2d')][_0xb22e('0x98')]}});})[_0xb22e('0x29')](function(_0x29e30e){socket[_0xb22e('0xac')]('chatInteractionTags:save',{'id':Number(_0x3ddaea[_0xb22e('0x43')]['id']),'tags':_0x29e30e||[]});return{'id':Number(_0x3ddaea['params']['id']),'tags':_0x29e30e||[]};});}})['then'](respondWithResult(_0x33df70,null))['catch'](handleError(_0x33df70,null));};exports[_0xb22e('0xad')]=function(_0x7b2461,_0x2a6386){return db[_0xb22e('0x32')][_0xb22e('0x45')]({'where':{'id':_0x7b2461['params']['id']}})[_0xb22e('0x29')](handleEntityNotFound(_0x2a6386,null))[_0xb22e('0x29')](function(_0x2344f4){if(_0x2344f4){return _0x2344f4[_0xb22e('0xad')](_0x7b2461[_0xb22e('0x37')][_0xb22e('0x98')]);}})[_0xb22e('0x29')](respondWithStatusCode(_0x2a6386,null))[_0xb22e('0x39')](handleError(_0x2a6386,null));};exports[_0xb22e('0x76')]=function(_0x4b6902,_0x367382){var _0x271e98=moment()['unix']()['toString']();var _0x48ed5a=path['join'](config[_0xb22e('0x72')],_0xb22e('0xae'),_0xb22e('0xaf'),'tmp');var _0xae1e00=path[_0xb22e('0x71')](config[_0xb22e('0x72')],_0xb22e('0xae'),_0xb22e('0xaf'),_0xb22e('0xb0'));var _0x1d99cd=path['join'](_0x48ed5a,_0x271e98);var _0x45391e=util[_0xb22e('0x78')](_0xb22e('0xb1'),_0x4b6902['params']['id'],_0x271e98);var _0x3ca3a=path['join'](_0x48ed5a,_0x45391e);var _0x482af0=[];_0x482af0['push']({'model':db[_0xb22e('0x7c')],'as':_0xb22e('0x7c'),'attributes':['id',_0xb22e('0x4f')],'raw':!![]});_0x482af0[_0xb22e('0xb2')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xb22e('0xb3'),'lastName'],'raw':!![]});if(_0x4b6902['query'][_0xb22e('0xb0')]){_0x482af0[_0xb22e('0xb2')]({'model':db[_0xb22e('0x6f')],'as':_0xb22e('0x6f'),'raw':!![]});}var _0x460fc5=[{'model':db[_0xb22e('0x5d')],'as':_0xb22e('0x7e'),'attributes':['id',_0xb22e('0x2d'),'createdAt',_0xb22e('0x8a'),'secret',_0xb22e('0xb4')],'include':_0x482af0}];_0x460fc5[_0xb22e('0xb2')]({'model':db[_0xb22e('0x49')],'as':_0xb22e('0xb5'),'attributes':['id',_0xb22e('0x69')]});_0x460fc5[_0xb22e('0xb2')]({'model':db[_0xb22e('0x7c')],'as':_0xb22e('0xb6'),'attributes':['id',_0xb22e('0x4f')]});return db['ChatInteraction']['find']({'where':{'id':_0x4b6902[_0xb22e('0x43')]['id']},'include':_0x460fc5})['then'](handleEntityNotFound(_0x367382,null))[_0xb22e('0x29')](function(_0x4feb0c){if(_0x4feb0c){var _0x10cb34=_0x4feb0c['get']({'plain':!![]});fs[_0xb22e('0xb7')](_0x1d99cd);var _0x3e0ed7={'channel':'Chat','account':_0x10cb34['Account']['name'],'agent':_0x10cb34[_0xb22e('0xb6')]?_0x10cb34[_0xb22e('0xb6')]['fullname']:_0xb22e('0xb8'),'createdAt':moment(_0x10cb34[_0xb22e('0x88')])[_0xb22e('0x78')](_0xb22e('0xa2'))[_0xb22e('0xb9')](),'closedAt':_0x10cb34[_0xb22e('0x6e')]?moment(_0x10cb34[_0xb22e('0xba')])[_0xb22e('0x78')](_0xb22e('0xa2'))[_0xb22e('0xb9')]():'','disposition':_0x10cb34['disposition'],'chatInfo':{'browser':_0x10cb34['browserName'],'os':_0x10cb34[_0xb22e('0xbb')],'referer':_0x10cb34['referer'],'customerIp':_0x10cb34[_0xb22e('0xbc')],'customerPort':_0x10cb34['customerPort']?_0x10cb34[_0xb22e('0xbd')]:_0xb22e('0xb8')},'messages':_(_0x10cb34[_0xb22e('0x7e')])['tail']()[_0xb22e('0x9e')]({'secret':![]})[_0xb22e('0x31')](function(_0x5fadb6){if(_0x5fadb6[_0xb22e('0x6f')]){var _0xa9c005=path['join'](_0xae1e00,_0x5fadb6[_0xb22e('0x6f')]['basename']);if(fs[_0xb22e('0xbe')](_0xa9c005)){fs[_0xb22e('0xbf')](_0xa9c005)['pipe'](fs[_0xb22e('0xc0')](path[_0xb22e('0x71')](_0x1d99cd,_0x5fadb6[_0xb22e('0x6f')]['basename'])));}}return{'date':moment(_0x5fadb6[_0xb22e('0x88')])['format'](_0xb22e('0xa2'))[_0xb22e('0xb9')](),'sender':_0x5fadb6['direction']===_0xb22e('0x5c')?_0x5fadb6['User']?_0x5fadb6[_0xb22e('0x7c')][_0xb22e('0x4f')]:_0xb22e('0x82'):_0x5fadb6['Contact']['firstName']+(_0x5fadb6[_0xb22e('0xc1')][_0xb22e('0xc2')]?'\x20'+_0x5fadb6[_0xb22e('0xc1')][_0xb22e('0xc2')]:''),'body':_0x5fadb6[_0xb22e('0x6f')]?_0x5fadb6[_0xb22e('0x6f')]['basename']:_0x5fadb6[_0xb22e('0x2d')],'direction':_0x5fadb6[_0xb22e('0x8a')]==='out'?'A':'C','secret':_0x5fadb6[_0xb22e('0x8b')],'read':_0x5fadb6[_0xb22e('0xb4')],'attachment':_0x5fadb6[_0xb22e('0x6f')]};})[_0xb22e('0xc3')]()};return ejs[_0xb22e('0xc4')](path['join'](config[_0xb22e('0x72')],_0xb22e('0xae'),'views','downloadInteraction.ejs'),{'interaction':_0x3e0ed7})[_0xb22e('0x29')](function(_0x58266b){var _0x4d39c7=path[_0xb22e('0x71')](_0x1d99cd,_0xb22e('0xc5')+_0x10cb34['id']+'-'+_0x271e98+_0xb22e('0xc6'));var _0x4b43e2={'path':_0x4d39c7,'channel':'Chat','interactionId':_0x10cb34['id']};return pdf[_0xb22e('0xc7')](_0x58266b,_0x4b43e2);})['then'](function(){return new Promise(function(_0x3973d5,_0x12d3c5){zipdir(_0x1d99cd,{'saveTo':_0x3ca3a},function(_0xaaa65c,_0x2928ad){if(_0xaaa65c)return _0x12d3c5(_0xaaa65c);return _0x3973d5(_0x2928ad);});})[_0xb22e('0x29')](function(){return new BPromise(function(_0x2174f0,_0x229c0e){rimraf(_0x1d99cd,function(_0x3e3f61){if(_0x3e3f61)_0x229c0e(_0x3e3f61);return _0x2174f0();});});})[_0xb22e('0x29')](function(){return _0x367382[_0xb22e('0x76')](_0x3ca3a,_0x45391e,function(_0x1718fc){if(_0x1718fc){logger[_0xb22e('0x1b')](_0xb22e('0xc8'),_0x1718fc);}else{fs[_0xb22e('0xc9')](_0x3ca3a);}});});});}else{return _0x367382[_0xb22e('0x20')](0xc8);}})[_0xb22e('0x39')](handleError(_0x367382,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5f9529d..f48ccd3 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 _0x844a=['unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','map','findAll','then'];(function(_0x2a0d34,_0x41aaee){var _0x5dd1aa=function(_0x283087){while(--_0x283087){_0x2a0d34['push'](_0x2a0d34['shift']());}};_0x5dd1aa(++_0x41aaee);}(_0x844a,0x116));var _0xa844=function(_0x37635e,_0x556f60){_0x37635e=_0x37635e-0x0;var _0x1486b0=_0x844a[_0x37635e];return _0x1486b0;};'use strict';var EventEmitter=require(_0xa844('0x0'));var ChatInteraction=require(_0xa844('0x1'))['db'][_0xa844('0x2')];var ChatMessage=require(_0xa844('0x1'))['db'][_0xa844('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa844('0x4')](0x0);var events={'afterCreate':_0xa844('0x5'),'afterUpdate':_0xa844('0x6'),'afterDestroy':'remove'};function emitEvent(_0x307274){return function(_0x2d8620,_0x2f3d3a,_0x56d716){_0x2d8620['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x354697){_0x2d8620['setDataValue']('Users',_0x354697[_0xa844('0x7')](function(_0x42e7cc){return{'id':_0x42e7cc['id']};}));return ChatMessage[_0xa844('0x8')]({'where':{'ChatInteractionId':_0x2d8620['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa844('0x9')](function(_0x4c063b){_0x2d8620['setDataValue'](_0xa844('0xa'),_0x4c063b[_0xa844('0xb')]);ChatInteractionEvents['emit'](_0x307274+':'+_0x2d8620['id'],_0x2d8620);ChatInteractionEvents[_0xa844('0xc')](_0x307274,_0x2d8620);_0x56d716(null);})['catch'](_0x56d716(null));};}for(var e in events){if(events[_0xa844('0xd')](e)){var event=events[e];ChatInteraction[_0xa844('0xe')](e,emitEvent(event));}}module[_0xa844('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xf052=['getUsers','then','setDataValue','Users','map','findAll','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove'];(function(_0x33a750,_0x23e437){var _0x36de2c=function(_0x4f81e9){while(--_0x4f81e9){_0x33a750['push'](_0x33a750['shift']());}};_0x36de2c(++_0x23e437);}(_0xf052,0x169));var _0x2f05=function(_0x2aa87d,_0x1aa073){_0x2aa87d=_0x2aa87d-0x0;var _0x3a1812=_0xf052[_0x2aa87d];return _0x3a1812;};'use strict';var EventEmitter=require(_0x2f05('0x0'));var ChatInteraction=require(_0x2f05('0x1'))['db'][_0x2f05('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x2f05('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2f05('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f05('0x5'),'afterDestroy':_0x2f05('0x6')};function emitEvent(_0x44ca1f){return function(_0x2974e3,_0x10744f,_0x13869a){_0x2974e3[_0x2f05('0x7')]({'attributes':['id'],'raw':!![]})[_0x2f05('0x8')](function(_0x4394b9){_0x2974e3[_0x2f05('0x9')](_0x2f05('0xa'),_0x4394b9[_0x2f05('0xb')](function(_0x10b273){return{'id':_0x10b273['id']};}));return ChatMessage[_0x2f05('0xc')]({'where':{'ChatInteractionId':_0x2974e3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2f05('0x8')](function(_0x4f67eb){_0x2974e3['setDataValue']('unreadMessages',_0x4f67eb['length']);ChatInteractionEvents[_0x2f05('0xd')](_0x44ca1f+':'+_0x2974e3['id'],_0x2974e3);ChatInteractionEvents[_0x2f05('0xd')](_0x44ca1f,_0x2974e3);_0x13869a(null);})[_0x2f05('0xe')](_0x13869a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x2f05('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8236e09..83265a4 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 _0x3df5=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x44f9ae,_0x27f80a){var _0x7fcd7=function(_0x41cfe6){while(--_0x41cfe6){_0x44f9ae['push'](_0x44f9ae['shift']());}};_0x7fcd7(++_0x27f80a);}(_0x3df5,0x159));var _0x53df=function(_0x2d40b9,_0x2aa430){_0x2d40b9=_0x2d40b9-0x0;var _0x118c40=_0x3df5[_0x2d40b9];return _0x118c40;};'use strict';var _=require(_0x53df('0x0'));var util=require(_0x53df('0x1'));var logger=require(_0x53df('0x2'))(_0x53df('0x3'));var moment=require(_0x53df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x53df('0x5'));var attributes=require(_0x53df('0x6'));module[_0x53df('0x7')]=function(_0x20966d,_0x168357){return _0x20966d['define'](_0x53df('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21698f,_0x5388fa,_0x1a1868){if(_0x21698f['changed'](_0x53df('0x9'))){_0x21698f[_0x53df('0xa')]=moment()['format'](_0x53df('0xb'));}_0x1a1868(null,_0x21698f);}},'charset':_0x53df('0xc'),'collate':_0x53df('0xd')});}; \ No newline at end of file +var _0x086f=['closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','define','chat_interactions','changed','closed'];(function(_0x127074,_0x3bd855){var _0x4c9463=function(_0xf337a6){while(--_0xf337a6){_0x127074['push'](_0x127074['shift']());}};_0x4c9463(++_0x3bd855);}(_0x086f,0x17b));var _0xf086=function(_0x2f7004,_0x247a56){_0x2f7004=_0x2f7004-0x0;var _0x4a2c4c=_0x086f[_0x2f7004];return _0x4a2c4c;};'use strict';var _=require(_0xf086('0x0'));var util=require(_0xf086('0x1'));var logger=require(_0xf086('0x2'))(_0xf086('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf086('0x4'));var fs=require('fs');var path=require(_0xf086('0x5'));var rimraf=require(_0xf086('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x6239b4,_0x17e67c){return _0x6239b4[_0xf086('0x7')]('ChatInteraction',attributes,{'tableName':_0xf086('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b77c2,_0x491519,_0x3eab7e){if(_0x1b77c2[_0xf086('0x9')](_0xf086('0xa'))){_0x1b77c2[_0xf086('0xb')]=moment()['format'](_0xf086('0xc'));}_0x3eab7e(null,_0x1b77c2);}},'charset':_0xf086('0xd'),'collate':_0xf086('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6f940ba..5daa53c 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 _0x646a=['body','options','raw','where','attributes','limit','debug','addTags','ids','omit','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','UpdateChatInteraction','ChatInteraction','update'];(function(_0x4d9767,_0x4a0490){var _0x43bab4=function(_0x140682){while(--_0x140682){_0x4d9767['push'](_0x4d9767['shift']());}};_0x43bab4(++_0x4a0490);}(_0x646a,0xd4));var _0xa646=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x646a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa646('0x0'));var util=require(_0xa646('0x1'));var moment=require(_0xa646('0x2'));var BPromise=require(_0xa646('0x3'));var rs=require(_0xa646('0x4'));var fs=require('fs');var Redis=require(_0xa646('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa646('0x6'));var logger=require(_0xa646('0x7'))('rpc');var config=require(_0xa646('0x8'));var jayson=require(_0xa646('0x9'));var client=jayson[_0xa646('0xa')][_0xa646('0xb')]({'port':0x232a});config[_0xa646('0xc')]=_[_0xa646('0xd')](config[_0xa646('0xc')],{'host':_0xa646('0xe'),'port':0x18eb});var socket=require(_0xa646('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xa646('0x10')](socket);function respondWithRpcPromise(_0x24633c,_0xddb1f8,_0x44bab9){return new BPromise(function(_0x5eef5d,_0x440433){return client['request'](_0x24633c,_0x44bab9)[_0xa646('0x11')](function(_0x21c64b){logger['info'](_0xa646('0x12'),_0xddb1f8,'request\x20sent');logger['debug'](_0xa646('0x13'),_0xddb1f8,_0xa646('0x14'),JSON[_0xa646('0x15')](_0x21c64b));if(_0x21c64b[_0xa646('0x16')]){if(_0x21c64b[_0xa646('0x16')]['code']===0x1f4){logger[_0xa646('0x16')](_0xa646('0x12'),_0xddb1f8,_0x21c64b[_0xa646('0x16')]['message']);return _0x440433(_0x21c64b['error']['message']);}logger[_0xa646('0x16')](_0xa646('0x12'),_0xddb1f8,_0x21c64b['error'][_0xa646('0x17')]);return _0x5eef5d(_0x21c64b[_0xa646('0x16')][_0xa646('0x17')]);}else{logger[_0xa646('0x18')](_0xa646('0x12'),_0xddb1f8,'request\x20sent');_0x5eef5d(_0x21c64b['result'][_0xa646('0x17')]);}})['catch'](function(_0x4bd409){logger[_0xa646('0x16')]('ChatInteraction,\x20%s,\x20%s',_0xddb1f8,_0x4bd409);_0x440433(_0x4bd409);});});}exports[_0xa646('0x19')]=function(_0x5066db){var _0x3407d8=this;return new Promise(function(_0x21eee8,_0x59efac){return db[_0xa646('0x1a')][_0xa646('0x1b')](_0x5066db[_0xa646('0x1c')],{'raw':_0x5066db['options']?_0x5066db[_0xa646('0x1d')][_0xa646('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5066db[_0xa646('0x1d')]?_0x5066db['options'][_0xa646('0x1f')]||null:null,'attributes':_0x5066db[_0xa646('0x1d')]?_0x5066db['options'][_0xa646('0x20')]||null:null,'limit':_0x5066db[_0xa646('0x1d')]?_0x5066db['options'][_0xa646('0x21')]||null:null})[_0xa646('0x11')](function(_0x4ae873){logger[_0xa646('0x18')](_0xa646('0x19'),_0x5066db);logger[_0xa646('0x22')](_0xa646('0x19'),_0x5066db,JSON[_0xa646('0x15')](_0x4ae873));_0x21eee8(_0x4ae873);})['catch'](function(_0x270419){logger[_0xa646('0x16')](_0xa646('0x19'),_0x270419[_0xa646('0x17')],_0x5066db);_0x59efac(_0x3407d8[_0xa646('0x16')](0x1f4,_0x270419[_0xa646('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x5cd92c){return new Promise(function(_0x4a3463,_0x61552c){return db[_0xa646('0x1a')]['find']({'where':_0x5cd92c['options']?_0x5cd92c[_0xa646('0x1d')][_0xa646('0x1f')]||null:null})[_0xa646('0x11')](function(_0x1253ea){if(_0x1253ea){return _0x1253ea[_0xa646('0x23')](_0x5cd92c['body'][_0xa646('0x24')],_[_0xa646('0x25')](_0x5cd92c[_0xa646('0x1c')],[_0xa646('0x24'),'id'])||{});}})['spread'](function(_0x3b66a6){logger['info']('AddTags',_0x5cd92c);logger[_0xa646('0x22')](_0xa646('0x26'),_0x5cd92c,JSON[_0xa646('0x15')](_0x3b66a6));_0x4a3463(_0x3b66a6);})[_0xa646('0x27')](function(_0x5df30c){logger[_0xa646('0x16')]('AddTags',_0x5df30c['message'],_0x5cd92c);_0x61552c(_this[_0xa646('0x16')](0x1f4,_0x5df30c[_0xa646('0x17')]));});});}; \ No newline at end of file +var _0xc9f3=['ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateChatInteraction','options','raw','where','attributes','info','debug','AddTagsToChatInteraction','ChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s'];(function(_0xb99bf8,_0x8eb729){var _0x102498=function(_0x153573){while(--_0x153573){_0xb99bf8['push'](_0xb99bf8['shift']());}};_0x102498(++_0x8eb729);}(_0xc9f3,0x101));var _0x3c9f=function(_0x27ff1e,_0x54d492){_0x27ff1e=_0x27ff1e-0x0;var _0x267326=_0xc9f3[_0x27ff1e];return _0x267326;};'use strict';var _=require(_0x3c9f('0x0'));var util=require('util');var moment=require(_0x3c9f('0x1'));var BPromise=require(_0x3c9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c9f('0x3'));var db=require(_0x3c9f('0x4'))['db'];var utils=require(_0x3c9f('0x5'));var logger=require(_0x3c9f('0x6'))(_0x3c9f('0x7'));var config=require(_0x3c9f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c9f('0x9')][_0x3c9f('0xa')]({'port':0x232a});config[_0x3c9f('0xb')]=_[_0x3c9f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c9f('0xb')]));require(_0x3c9f('0xd'))['register'](socket);function respondWithRpcPromise(_0x10badd,_0x5434ec,_0x2982e4){return new BPromise(function(_0x3eac73,_0x13df03){return client['request'](_0x10badd,_0x2982e4)[_0x3c9f('0xe')](function(_0x2513c0){logger['info'](_0x3c9f('0xf'),_0x5434ec,'request\x20sent');logger['debug'](_0x3c9f('0x10'),_0x5434ec,_0x3c9f('0x11'),JSON[_0x3c9f('0x12')](_0x2513c0));if(_0x2513c0['error']){if(_0x2513c0['error'][_0x3c9f('0x13')]===0x1f4){logger[_0x3c9f('0x14')](_0x3c9f('0xf'),_0x5434ec,_0x2513c0[_0x3c9f('0x14')]['message']);return _0x13df03(_0x2513c0['error'][_0x3c9f('0x15')]);}logger[_0x3c9f('0x14')](_0x3c9f('0xf'),_0x5434ec,_0x2513c0[_0x3c9f('0x14')]['message']);return _0x3eac73(_0x2513c0['error'][_0x3c9f('0x15')]);}else{logger['info'](_0x3c9f('0xf'),_0x5434ec,'request\x20sent');_0x3eac73(_0x2513c0[_0x3c9f('0x16')]['message']);}})[_0x3c9f('0x17')](function(_0x537aef){logger[_0x3c9f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5434ec,_0x537aef);_0x13df03(_0x537aef);});});}exports[_0x3c9f('0x18')]=function(_0x4a4354){var _0x2c2562=this;return new Promise(function(_0x1c6ff3,_0x4812b1){return db['ChatInteraction']['update'](_0x4a4354['body'],{'raw':_0x4a4354[_0x3c9f('0x19')]?_0x4a4354[_0x3c9f('0x19')][_0x3c9f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a4354['options']?_0x4a4354[_0x3c9f('0x19')][_0x3c9f('0x1b')]||null:null,'attributes':_0x4a4354[_0x3c9f('0x19')]?_0x4a4354[_0x3c9f('0x19')][_0x3c9f('0x1c')]||null:null,'limit':_0x4a4354[_0x3c9f('0x19')]?_0x4a4354[_0x3c9f('0x19')]['limit']||null:null})[_0x3c9f('0xe')](function(_0x323e81){logger[_0x3c9f('0x1d')](_0x3c9f('0x18'),_0x4a4354);logger[_0x3c9f('0x1e')](_0x3c9f('0x18'),_0x4a4354,JSON['stringify'](_0x323e81));_0x1c6ff3(_0x323e81);})[_0x3c9f('0x17')](function(_0x4c9826){logger[_0x3c9f('0x14')]('UpdateChatInteraction',_0x4c9826[_0x3c9f('0x15')],_0x4a4354);_0x4812b1(_0x2c2562[_0x3c9f('0x14')](0x1f4,_0x4c9826[_0x3c9f('0x15')]));});});};exports[_0x3c9f('0x1f')]=function(_0x42fcf2){return new Promise(function(_0x1abc65,_0x4b78f3){return db[_0x3c9f('0x20')]['find']({'where':_0x42fcf2[_0x3c9f('0x19')]?_0x42fcf2['options'][_0x3c9f('0x1b')]||null:null})[_0x3c9f('0xe')](function(_0x4f8f8a){if(_0x4f8f8a){return _0x4f8f8a[_0x3c9f('0x21')](_0x42fcf2[_0x3c9f('0x22')][_0x3c9f('0x23')],_[_0x3c9f('0x24')](_0x42fcf2[_0x3c9f('0x22')],[_0x3c9f('0x23'),'id'])||{});}})[_0x3c9f('0x25')](function(_0x227b4e){logger['info'](_0x3c9f('0x26'),_0x42fcf2);logger[_0x3c9f('0x1e')]('AddTags',_0x42fcf2,JSON[_0x3c9f('0x12')](_0x227b4e));_0x1abc65(_0x227b4e);})[_0x3c9f('0x17')](function(_0x5145a3){logger[_0x3c9f('0x14')]('AddTags',_0x5145a3[_0x3c9f('0x15')],_0x42fcf2);_0x4b78f3(_this['error'](0x1f4,_0x5145a3[_0x3c9f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5b6e2e9..3945103 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 _0x666b=['emit','register','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x4c2ad3,_0x5d5b68){var _0x2723bc=function(_0x64a073){while(--_0x64a073){_0x4c2ad3['push'](_0x4c2ad3['shift']());}};_0x2723bc(++_0x5d5b68);}(_0x666b,0x129));var _0xb666=function(_0x30add5,_0x6dfba2){_0x30add5=_0x30add5-0x0;var _0x2b5904=_0x666b[_0x30add5];return _0x2b5904;};'use strict';var ChatInteractionEvents=require(_0xb666('0x0'));var events=[_0xb666('0x1'),_0xb666('0x2'),_0xb666('0x3')];function createListener(_0x1fa7a8,_0x4fefb0){return function(_0x5eb0f5){_0x4fefb0[_0xb666('0x4')](_0x1fa7a8,_0x5eb0f5);};}function removeListener(_0x3e0b02,_0x2860d9){return function(){ChatInteractionEvents['removeListener'](_0x3e0b02,_0x2860d9);};}exports[_0xb666('0x5')]=function(_0x2dc0d2){for(var _0xd987a2=0x0,_0xea61a6=events['length'];_0xd987a2<_0xea61a6;_0xd987a2++){var _0x2a78c1=events[_0xd987a2];var _0xafa6fb=createListener(_0xb666('0x6')+_0x2a78c1,_0x2dc0d2);ChatInteractionEvents['on'](_0x2a78c1,_0xafa6fb);}}; \ No newline at end of file +var _0xe566=['length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x530df4,_0x1eb32d){var _0x5aed62=function(_0x398598){while(--_0x398598){_0x530df4['push'](_0x530df4['shift']());}};_0x5aed62(++_0x1eb32d);}(_0xe566,0x170));var _0x6e56=function(_0xa3e7f1,_0x426c18){_0xa3e7f1=_0xa3e7f1-0x0;var _0x4b877c=_0xe566[_0xa3e7f1];return _0x4b877c;};'use strict';var ChatInteractionEvents=require(_0x6e56('0x0'));var events=[_0x6e56('0x1'),_0x6e56('0x2'),_0x6e56('0x3')];function createListener(_0x5a3ac9,_0x1767d4){return function(_0x2a038e){_0x1767d4['emit'](_0x5a3ac9,_0x2a038e);};}function removeListener(_0x5cd320,_0x36e2b1){return function(){ChatInteractionEvents['removeListener'](_0x5cd320,_0x36e2b1);};}exports['register']=function(_0x4ab21d){for(var _0x1f56f1=0x0,_0x558283=events[_0x6e56('0x4')];_0x1f56f1<_0x558283;_0x1f56f1++){var _0x2126da=events[_0x1f56f1];var _0x4f5668=createListener(_0x6e56('0x5')+_0x2126da,_0x4ab21d);ChatInteractionEvents['on'](_0x2126da,_0x4f5668);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 77c4f53..43b540e 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 _0x3a65=['diskStorage','join','format','replace','single','file','attachmentUpload','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession'];(function(_0x115fdd,_0x1abca6){var _0x3a5270=function(_0x20571f){while(--_0x20571f){_0x115fdd['push'](_0x115fdd['shift']());}};_0x3a5270(++_0x1abca6);}(_0x3a65,0xee));var _0x53a6=function(_0x3f0f1f,_0x327cb4){_0x3f0f1f=_0x3f0f1f-0x0;var _0x1e5de6=_0x3a65[_0x3f0f1f];return _0x1e5de6;};'use strict';var multer=require(_0x53a6('0x0'));var util=require(_0x53a6('0x1'));var path=require(_0x53a6('0x2'));var timeout=require(_0x53a6('0x3'));var express=require(_0x53a6('0x4'));var router=express['Router']();var fs_extra=require(_0x53a6('0x5'));var auth=require(_0x53a6('0x6'));var interaction=require(_0x53a6('0x7'));var config=require(_0x53a6('0x8'));var controller=require(_0x53a6('0x9'));router[_0x53a6('0xa')]('/',auth[_0x53a6('0xb')](),controller[_0x53a6('0xc')]);router['get']('/describe',auth[_0x53a6('0xb')](),controller[_0x53a6('0xd')]);router[_0x53a6('0xa')](_0x53a6('0xe'),auth[_0x53a6('0xf')](),controller['show']);router[_0x53a6('0xa')](_0x53a6('0x10'),auth[_0x53a6('0xf')](),controller[_0x53a6('0x11')]);router['get'](_0x53a6('0x12'),auth[_0x53a6('0xb')](),controller[_0x53a6('0x13')]);router[_0x53a6('0xa')](_0x53a6('0x14'),auth[_0x53a6('0xf')](),controller['getMyMessages']);router[_0x53a6('0xa')](_0x53a6('0x15'),auth[_0x53a6('0xb')](),controller[_0x53a6('0x16')]);router[_0x53a6('0x17')]('/',auth[_0x53a6('0xb')](),controller[_0x53a6('0x18')]);router[_0x53a6('0x17')](_0x53a6('0x19'),auth[_0x53a6('0xb')](),controller[_0x53a6('0x1a')]);var upload=multer({'storage':multer[_0x53a6('0x1b')]({'destination':function(_0x3bd931,_0x2781f3,_0x4705d0){_0x4705d0(null,path[_0x53a6('0x1c')](config['root'],'server/files/attachments/'));},'filename':function(_0x1a80d2,_0x2be374,_0x55d761){_0x55d761(null,util[_0x53a6('0x1d')]('%s-%s',Date['now'](),_0x2be374['originalname'][_0x53a6('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x53a6('0x17')]('/:id/attachment_upload',upload[_0x53a6('0x1f')](_0x53a6('0x20')),controller[_0x53a6('0x21')]);router[_0x53a6('0x17')](_0x53a6('0x12'),auth[_0x53a6('0xf')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x53a6('0xb')](),interaction[_0x53a6('0x22')](_0x53a6('0x23'),_0x53a6('0x24')),controller[_0x53a6('0x25')]);router[_0x53a6('0x26')](_0x53a6('0xe'),auth[_0x53a6('0xb')](),interaction[_0x53a6('0x22')](_0x53a6('0x23'),_0x53a6('0x27')),controller[_0x53a6('0x28')]);router['put'](_0x53a6('0x29'),controller[_0x53a6('0x2a')]);router[_0x53a6('0x26')](_0x53a6('0x2b'),auth[_0x53a6('0xf')](),controller[_0x53a6('0x2c')]);router[_0x53a6('0x26')](_0x53a6('0x2d'),controller[_0x53a6('0x2e')]);router[_0x53a6('0x2f')](_0x53a6('0xe'),auth[_0x53a6('0xb')](),interaction[_0x53a6('0x22')](_0x53a6('0x23'),_0x53a6('0x30')),controller[_0x53a6('0x31')]);router['delete'](_0x53a6('0x32'),auth['isAuthenticated'](),controller[_0x53a6('0x33')]);module[_0x53a6('0x34')]=router; \ No newline at end of file +var _0x50d7=['/:id/vidaoo','createVidaooSession','diskStorage','join','root','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50d7,0x114));var _0x750d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x50d7[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x750d('0x0'));var util=require(_0x750d('0x1'));var path=require(_0x750d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x750d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x750d('0x4'));var config=require('../../config/environment');var controller=require(_0x750d('0x5'));router[_0x750d('0x6')]('/',auth[_0x750d('0x7')](),controller[_0x750d('0x8')]);router[_0x750d('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x750d('0x6')](_0x750d('0x9'),auth[_0x750d('0xa')](),controller[_0x750d('0xb')]);router['get']('/:id/attachment_download',auth[_0x750d('0xa')](),controller[_0x750d('0xc')]);router[_0x750d('0x6')]('/:id/messages',auth[_0x750d('0x7')](),controller['getMessages']);router['get'](_0x750d('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x750d('0xe')]);router['get'](_0x750d('0xf'),auth['isAuthenticated'](),controller[_0x750d('0x10')]);router['post']('/',auth[_0x750d('0x7')](),controller['create']);router[_0x750d('0x11')](_0x750d('0x12'),auth[_0x750d('0x7')](),controller[_0x750d('0x13')]);var upload=multer({'storage':multer[_0x750d('0x14')]({'destination':function(_0x5c44e4,_0x336409,_0x27623b){_0x27623b(null,path[_0x750d('0x15')](config[_0x750d('0x16')],'server/files/attachments/'));},'filename':function(_0x376a02,_0x309ef3,_0x155a47){_0x155a47(null,util['format'](_0x750d('0x17'),Date['now'](),_0x309ef3[_0x750d('0x18')][_0x750d('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x750d('0x11')](_0x750d('0x1a'),upload[_0x750d('0x1b')](_0x750d('0x1c')),controller[_0x750d('0x1d')]);router[_0x750d('0x11')]('/:id/messages',auth[_0x750d('0xa')](),controller[_0x750d('0x1e')]);router[_0x750d('0x11')](_0x750d('0x1f'),auth[_0x750d('0x7')](),interaction['tracked'](_0x750d('0x20'),_0x750d('0x21')),controller[_0x750d('0x22')]);router[_0x750d('0x23')](_0x750d('0x9'),auth[_0x750d('0x7')](),interaction['tracked'](_0x750d('0x20'),_0x750d('0x24')),controller[_0x750d('0x25')]);router['put'](_0x750d('0x26'),controller[_0x750d('0x27')]);router[_0x750d('0x23')](_0x750d('0x28'),auth['isChatInteractionAuthorized'](),controller[_0x750d('0x29')]);router[_0x750d('0x23')](_0x750d('0x2a'),controller['close']);router[_0x750d('0x2b')]('/:id',auth['isAuthenticated'](),interaction[_0x750d('0x2c')](_0x750d('0x20'),_0x750d('0x2d')),controller[_0x750d('0x2e')]);router[_0x750d('0x2b')]('/:id/tags',auth[_0x750d('0x7')](),controller[_0x750d('0x2f')]);module[_0x750d('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 cab170a..3869130 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 _0x82f0=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x82f0,0x72));var _0x082f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x82f0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x082f('0x0'));module[_0x082f('0x1')]={'body':{'type':Sequelize[_0x082f('0x2')](_0x082f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x082f('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x082f('0x5')]}}; \ No newline at end of file +var _0xb57b=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xb57b,0x17c));var _0xbb57=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xb57b[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xbb57('0x0'));module[_0xbb57('0x1')]={'body':{'type':Sequelize[_0xbb57('0x2')](_0xbb57('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbb57('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xbb57('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4f4ad4b..56df9b1 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 _0x3789=['UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','sort','where','pick','filter','merge','options','include','rows','catch','params','find','create','body','describe','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2f3f96,_0x1c0d73){var _0x51f17b=function(_0x3300af){while(--_0x3300af){_0x2f3f96['push'](_0x2f3f96['shift']());}};_0x51f17b(++_0x1c0d73);}(_0x3789,0x7d));var _0x9378=function(_0x18c612,_0x59b9e4){_0x18c612=_0x18c612-0x0;var _0x1c3d83=_0x3789[_0x18c612];return _0x1c3d83;};'use strict';var emlformat=require(_0x9378('0x0'));var rimraf=require(_0x9378('0x1'));var zipdir=require(_0x9378('0x2'));var jsonpatch=require(_0x9378('0x3'));var rp=require('request-promise');var moment=require(_0x9378('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9378('0x5'));var util=require(_0x9378('0x6'));var path=require('path');var sox=require(_0x9378('0x7'));var csv=require(_0x9378('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9378('0x9'));var _=require(_0x9378('0xa'));var squel=require(_0x9378('0xb'));var crypto=require(_0x9378('0xc'));var jsforce=require(_0x9378('0xd'));var deskjs=require(_0x9378('0xe'));var toCsv=require(_0x9378('0x8'));var querystring=require(_0x9378('0xf'));var Papa=require(_0x9378('0x10'));var Redis=require(_0x9378('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9378('0x12'));var logger=require('../../config/logger')(_0x9378('0x13'));var utils=require(_0x9378('0x14'));var config=require(_0x9378('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9378('0x16'))['db'];config['redis']=_[_0x9378('0x17')](config[_0x9378('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9378('0x19'))(new Redis(config[_0x9378('0x18')]));require(_0x9378('0x1a'))[_0x9378('0x1b')](socket);function respondWithStatusCode(_0x1e85bc,_0x411773){_0x411773=_0x411773||0xcc;return function(_0x2d726f){if(_0x2d726f){return _0x1e85bc[_0x9378('0x1c')](_0x411773);}return _0x1e85bc['status'](_0x411773)[_0x9378('0x1d')]();};}function respondWithResult(_0x318f49,_0xea40e0){_0xea40e0=_0xea40e0||0xc8;return function(_0x4318c8){if(_0x4318c8){return _0x318f49['status'](_0xea40e0)[_0x9378('0x1e')](_0x4318c8);}};}function respondWithFilteredResult(_0x29ac3c,_0x5ee91a){return function(_0x2f2ab3){if(_0x2f2ab3){var _0x58fbdf=typeof _0x5ee91a[_0x9378('0x1f')]===_0x9378('0x20')&&typeof _0x5ee91a[_0x9378('0x21')]===_0x9378('0x20');var _0x30af3d=_0x2f2ab3[_0x9378('0x22')];var _0x105161=_0x58fbdf?0x0:_0x5ee91a['offset'];var _0x4bee3e=_0x58fbdf?_0x2f2ab3[_0x9378('0x22')]:_0x5ee91a['offset']+_0x5ee91a['limit'];var _0x5aa924;if(_0x4bee3e>=_0x30af3d){_0x4bee3e=_0x30af3d;_0x5aa924=0xc8;}else{_0x5aa924=0xce;}_0x29ac3c[_0x9378('0x23')](_0x5aa924);return _0x29ac3c[_0x9378('0x24')](_0x9378('0x25'),_0x105161+'-'+_0x4bee3e+'/'+_0x30af3d)[_0x9378('0x1e')](_0x2f2ab3);}return null;};}function patchUpdates(_0x3fc6e9){return function(_0x1b9747){try{jsonpatch[_0x9378('0x26')](_0x1b9747,_0x3fc6e9,!![]);}catch(_0x456491){return BPromise[_0x9378('0x27')](_0x456491);}return _0x1b9747['save']();};}function saveUpdates(_0x49d6bc,_0x47fa3c){return function(_0x1d8b07){if(_0x1d8b07){return _0x1d8b07[_0x9378('0x28')](_0x49d6bc)[_0x9378('0x29')](function(_0x5f2347){return _0x5f2347;});}return null;};}function removeEntity(_0x5983c9,_0x4a0c14){return function(_0x4285e1){if(_0x4285e1){return _0x4285e1[_0x9378('0x2a')]()[_0x9378('0x29')](function(){_0x5983c9[_0x9378('0x23')](0xcc)[_0x9378('0x1d')]();});}};}function handleEntityNotFound(_0x3f3be3,_0x507c80){return function(_0xcf2774){if(!_0xcf2774){_0x3f3be3[_0x9378('0x1c')](0x194);}return _0xcf2774;};}function handleError(_0x421fdb,_0x2a0754){_0x2a0754=_0x2a0754||0x1f4;return function(_0x6dadb6){logger[_0x9378('0x2b')](_0x6dadb6[_0x9378('0x2c')]);if(_0x6dadb6[_0x9378('0x2d')]){delete _0x6dadb6[_0x9378('0x2d')];}_0x421fdb['status'](_0x2a0754)[_0x9378('0x2e')](_0x6dadb6);};}exports[_0x9378('0x2f')]=function(_0x14fad0,_0x3e855b){var _0x5aa7eb={},_0x4a3b72={},_0x521c08={'count':0x0,'rows':[]};var _0x3dec3c=_[_0x9378('0x30')](db[_0x9378('0x31')][_0x9378('0x32')],function(_0x472909){return{'name':_0x472909[_0x9378('0x33')],'type':_0x472909[_0x9378('0x34')][_0x9378('0x35')]};});_0x4a3b72[_0x9378('0x36')]=_[_0x9378('0x30')](_0x3dec3c,_0x9378('0x2d'));_0x4a3b72['query']=_[_0x9378('0x37')](_0x14fad0['query']);_0x4a3b72[_0x9378('0x38')]=_[_0x9378('0x39')](_0x4a3b72[_0x9378('0x36')],_0x4a3b72['query']);_0x5aa7eb['attributes']=_[_0x9378('0x39')](_0x4a3b72['model'],qs[_0x9378('0x3a')](_0x14fad0['query'][_0x9378('0x3a')]));_0x5aa7eb[_0x9378('0x3b')]=_0x5aa7eb[_0x9378('0x3b')][_0x9378('0x3c')]?_0x5aa7eb[_0x9378('0x3b')]:_0x4a3b72[_0x9378('0x36')];if(!_0x14fad0['query'][_0x9378('0x3d')](_0x9378('0x3e'))){_0x5aa7eb[_0x9378('0x21')]=qs[_0x9378('0x21')](_0x14fad0[_0x9378('0x3f')][_0x9378('0x21')]);_0x5aa7eb['offset']=qs[_0x9378('0x1f')](_0x14fad0[_0x9378('0x3f')][_0x9378('0x1f')]);}_0x5aa7eb['order']=qs[_0x9378('0x40')](_0x14fad0[_0x9378('0x3f')][_0x9378('0x40')]);_0x5aa7eb[_0x9378('0x41')]=qs[_0x9378('0x38')](_[_0x9378('0x42')](_0x14fad0[_0x9378('0x3f')],_0x4a3b72[_0x9378('0x38')]),_0x3dec3c);if(_0x14fad0[_0x9378('0x3f')][_0x9378('0x43')]){_0x5aa7eb[_0x9378('0x41')]=_[_0x9378('0x44')](_0x5aa7eb['where'],{'$or':_[_0x9378('0x30')](_0x3dec3c,function(_0x3817c4){if(_0x3817c4['type']!=='VIRTUAL'){var _0x547f94={};_0x547f94[_0x3817c4[_0x9378('0x2d')]]={'$like':'%'+_0x14fad0[_0x9378('0x3f')][_0x9378('0x43')]+'%'};return _0x547f94;}})});}_0x5aa7eb=_[_0x9378('0x44')]({},_0x5aa7eb,_0x14fad0[_0x9378('0x45')]);var _0x2f038b={'where':_0x5aa7eb[_0x9378('0x41')]};return db[_0x9378('0x31')]['count'](_0x2f038b)[_0x9378('0x29')](function(_0x5caae0){_0x521c08['count']=_0x5caae0;if(_0x14fad0[_0x9378('0x3f')]['includeAll']){_0x5aa7eb[_0x9378('0x46')]=[{'all':!![]}];}return db[_0x9378('0x31')]['findAll'](_0x5aa7eb);})[_0x9378('0x29')](function(_0x57a050){_0x521c08[_0x9378('0x47')]=_0x57a050;return _0x521c08;})[_0x9378('0x29')](respondWithFilteredResult(_0x3e855b,_0x5aa7eb))[_0x9378('0x48')](handleError(_0x3e855b,null));};exports['show']=function(_0x339e93,_0x86cf1f){var _0xe71abc={'raw':!![],'where':{'id':_0x339e93[_0x9378('0x49')]['id']}},_0x3b420f={};_0x3b420f[_0x9378('0x36')]=_[_0x9378('0x37')](db[_0x9378('0x31')][_0x9378('0x32')]);_0x3b420f['query']=_[_0x9378('0x37')](_0x339e93['query']);_0x3b420f[_0x9378('0x38')]=_[_0x9378('0x39')](_0x3b420f['model'],_0x3b420f[_0x9378('0x3f')]);_0xe71abc[_0x9378('0x3b')]=_[_0x9378('0x39')](_0x3b420f[_0x9378('0x36')],qs[_0x9378('0x3a')](_0x339e93[_0x9378('0x3f')][_0x9378('0x3a')]));_0xe71abc[_0x9378('0x3b')]=_0xe71abc['attributes']['length']?_0xe71abc[_0x9378('0x3b')]:_0x3b420f[_0x9378('0x36')];if(_0x339e93['query']['includeAll']){_0xe71abc[_0x9378('0x46')]=[{'all':!![]}];}_0xe71abc=_[_0x9378('0x44')]({},_0xe71abc,_0x339e93['options']);return db[_0x9378('0x31')][_0x9378('0x4a')](_0xe71abc)['then'](handleEntityNotFound(_0x86cf1f,null))[_0x9378('0x29')](respondWithResult(_0x86cf1f,null))['catch'](handleError(_0x86cf1f,null));};exports[_0x9378('0x4b')]=function(_0x21c262,_0x548f5e){return db[_0x9378('0x31')]['create'](_0x21c262[_0x9378('0x4c')],{})[_0x9378('0x29')](respondWithResult(_0x548f5e,0xc9))[_0x9378('0x48')](handleError(_0x548f5e,null));};exports[_0x9378('0x28')]=function(_0x25ed6b,_0x183a91){if(_0x25ed6b[_0x9378('0x4c')]['id']){delete _0x25ed6b[_0x9378('0x4c')]['id'];}return db[_0x9378('0x31')][_0x9378('0x4a')]({'where':{'id':_0x25ed6b[_0x9378('0x49')]['id']}})[_0x9378('0x29')](handleEntityNotFound(_0x183a91,null))[_0x9378('0x29')](saveUpdates(_0x25ed6b[_0x9378('0x4c')],null))[_0x9378('0x29')](respondWithResult(_0x183a91,null))[_0x9378('0x48')](handleError(_0x183a91,null));};exports[_0x9378('0x2a')]=function(_0x4c9c05,_0x79bded){return db['ChatInternalMessage'][_0x9378('0x4a')]({'where':{'id':_0x4c9c05[_0x9378('0x49')]['id']}})[_0x9378('0x29')](handleEntityNotFound(_0x79bded,null))[_0x9378('0x29')](removeEntity(_0x79bded,null))[_0x9378('0x48')](handleError(_0x79bded,null));};exports[_0x9378('0x4d')]=function(_0x469a4c,_0x498b26){return db[_0x9378('0x31')][_0x9378('0x4d')]()[_0x9378('0x29')](respondWithResult(_0x498b26,null))[_0x9378('0x48')](handleError(_0x498b26,null));};function wrapUser(_0xabc1e0){return function(_0x72ed42){var _0x30cd0f=_0xabc1e0['get']({'plain':!![]});_0x30cd0f['messages']=[];if(_0x72ed42){_0x30cd0f[_0x9378('0x4e')]=_0x72ed42[_0x9378('0x4f')];_0x30cd0f['lastMessage']=_0x72ed42;}else{_0x30cd0f[_0x9378('0x4e')]=moment(0x0)[_0x9378('0x50')](_0x9378('0x51'));_0x30cd0f[_0x9378('0x52')]={};}return _0x30cd0f;};}exports[_0x9378('0x53')]=function(_0x2fc4cf,_0x1bfe41,_0x643dce){var _0x4bb1db=[];return db[_0x9378('0x54')][_0x9378('0x55')]({'where':{'role':[_0x9378('0x56'),_0x9378('0x57'),_0x9378('0x58')]},'attributes':['id',_0x9378('0x59'),_0x9378('0x2d'),_0x9378('0x5a'),_0x9378('0x5b'),_0x9378('0x5c'),_0x9378('0x5d'),_0x9378('0x5e'),'allowmessenger',_0x9378('0x5f')],'order':qs[_0x9378('0x40')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x9378('0x60'),'attributes':['id','name',_0x9378('0x34')],'through':{'attributes':[]}}]})[_0x9378('0x29')](function(_0xede5cf){if(_0xede5cf){var _0x19c310=_0x2fc4cf[_0x9378('0x58')][_0x9378('0x61')]({'plain':!![]});if(!_0x19c310)throw new Error(_0x9378('0x62'));if(_0x19c310[_0x9378('0x5a')]===_0x9378('0x58')){return db[_0x9378('0x63')][_0x9378('0x4a')]({'where':{'name':_0x9378('0x64'),'userProfileId':_0x19c310[_0x9378('0x65')]},'raw':!![]})[_0x9378('0x29')](function(_0x4823fc){if(_0x4823fc){if(_0x4823fc['autoAssociation']===0x0){return db[_0x9378('0x66')]['findAll']({'where':{'sectionId':_0x4823fc['id']},'raw':!![]})[_0x9378('0x29')](function(_0x28a5e7){var _0x434fc9=[];if(_[_0x9378('0x67')](_0x28a5e7)){_0x434fc9=_[_0x9378('0x43')](_0xede5cf,function(_0x5c474a){if(_0x5c474a[_0x9378('0x5a')]!==_0x9378('0x56')){return _0x5c474a;}});return _0x434fc9;}else{for(var _0x4a5804=0x0;_0x4a5804<_0xede5cf['length'];_0x4a5804++){var _0xad7b39=_0xede5cf[_0x4a5804];if(_0xad7b39[_0x9378('0x5a')]==='agent'){var _0x7c5111=_[_0x9378('0x4a')](_0x28a5e7,function(_0x3ebc74){return _0x3ebc74[_0x9378('0x68')]===_0xad7b39['id'];});if(_0x7c5111)_0x434fc9[_0x9378('0x69')](_0xad7b39);}else{_0x434fc9[_0x9378('0x69')](_0xad7b39);}}return _0x434fc9;}});}else{return _0xede5cf;}}else{var _0x3475fb=_[_0x9378('0x43')](_0xede5cf,function(_0x388370){if(_0x388370[_0x9378('0x5a')]!==_0x9378('0x56')){return _0x388370;}});return _0x3475fb;}});}else{return _0xede5cf;}}})[_0x9378('0x29')](function(_0x39a4d9){var _0x5e8f85=[];if(_0x39a4d9){_0x4bb1db=_0x39a4d9;for(var _0x39782d=0x0;_0x39782d<_0x39a4d9[_0x9378('0x3c')];_0x39782d+=0x1){_0x4bb1db[_0x39782d][_0x9378('0x6a')]=[];_0x5e8f85[_0x9378('0x69')](db[_0x9378('0x31')][_0x9378('0x4a')]({'where':{'FromId':[_0x2fc4cf['user']['id'],_0x39a4d9[_0x39782d]['id']],'ToId':[_0x2fc4cf[_0x9378('0x58')]['id'],_0x39a4d9[_0x39782d]['id']],'ChatGroupId':null},'attributes':['id',_0x9378('0x4f'),_0x9378('0x6b'),_0x9378('0x6c'),_0x9378('0x6d'),_0x9378('0x4c')],'order':qs[_0x9378('0x40')](_0x9378('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9378('0x29')](wrapUser(_0x39a4d9[_0x39782d])));}return BPromise[_0x9378('0x6f')](_0x5e8f85);}return[];})[_0x9378('0x29')](function(_0x93ea40){return{'rows':_0x93ea40,'count':_0x93ea40[_0x9378('0x3c')]};})[_0x9378('0x29')](respondWithResult(_0x1bfe41,null))[_0x9378('0x48')](handleError(_0x1bfe41,null));}; \ No newline at end of file +var _0xa8d4=['fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','end','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','eml-format','zip-dir','moment','bluebird','mustache','util','sox','ejs'];(function(_0x46760b,_0x8f72d3){var _0x1e632c=function(_0x337312){while(--_0x337312){_0x46760b['push'](_0x46760b['shift']());}};_0x1e632c(++_0x8f72d3);}(_0xa8d4,0x145));var _0x4a8d=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xa8d4[_0x9be28f];return _0xa9f52d;};'use strict';var emlformat=require(_0x4a8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a8d('0x2'));var BPromise=require(_0x4a8d('0x3'));var Mustache=require(_0x4a8d('0x4'));var util=require(_0x4a8d('0x5'));var path=require('path');var sox=require(_0x4a8d('0x6'));var csv=require('to-csv');var ejs=require(_0x4a8d('0x7'));var fs=require('fs');var fs_extra=require(_0x4a8d('0x8'));var _=require(_0x4a8d('0x9'));var squel=require(_0x4a8d('0xa'));var crypto=require(_0x4a8d('0xb'));var jsforce=require(_0x4a8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4a8d('0xd'));var querystring=require(_0x4a8d('0xe'));var Papa=require(_0x4a8d('0xf'));var Redis=require(_0x4a8d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4a8d('0x11'));var as=require(_0x4a8d('0x12'));var hardwareService=require(_0x4a8d('0x13'));var logger=require(_0x4a8d('0x14'))(_0x4a8d('0x15'));var utils=require(_0x4a8d('0x16'));var config=require(_0x4a8d('0x17'));var licenseUtil=require(_0x4a8d('0x18'));var db=require(_0x4a8d('0x19'))['db'];config['redis']=_['defaults'](config[_0x4a8d('0x1a')],{'host':_0x4a8d('0x1b'),'port':0x18eb});var socket=require(_0x4a8d('0x1c'))(new Redis(config[_0x4a8d('0x1a')]));require(_0x4a8d('0x1d'))[_0x4a8d('0x1e')](socket);function respondWithStatusCode(_0x2f0453,_0xc405da){_0xc405da=_0xc405da||0xcc;return function(_0x163ca1){if(_0x163ca1){return _0x2f0453[_0x4a8d('0x1f')](_0xc405da);}return _0x2f0453[_0x4a8d('0x20')](_0xc405da)['end']();};}function respondWithResult(_0xe30a44,_0x4e2a6c){_0x4e2a6c=_0x4e2a6c||0xc8;return function(_0x361360){if(_0x361360){return _0xe30a44['status'](_0x4e2a6c)[_0x4a8d('0x21')](_0x361360);}};}function respondWithFilteredResult(_0x20e77a,_0x45cd9b){return function(_0x56245d){if(_0x56245d){var _0x4b0492=typeof _0x45cd9b[_0x4a8d('0x22')]===_0x4a8d('0x23')&&typeof _0x45cd9b[_0x4a8d('0x24')]==='undefined';var _0xd5680c=_0x56245d[_0x4a8d('0x25')];var _0x3a3fdf=_0x4b0492?0x0:_0x45cd9b[_0x4a8d('0x22')];var _0x5c02af=_0x4b0492?_0x56245d['count']:_0x45cd9b[_0x4a8d('0x22')]+_0x45cd9b[_0x4a8d('0x24')];var _0x74aab3;if(_0x5c02af>=_0xd5680c){_0x5c02af=_0xd5680c;_0x74aab3=0xc8;}else{_0x74aab3=0xce;}_0x20e77a['status'](_0x74aab3);return _0x20e77a[_0x4a8d('0x26')]('Content-Range',_0x3a3fdf+'-'+_0x5c02af+'/'+_0xd5680c)['json'](_0x56245d);}return null;};}function patchUpdates(_0x1675ff){return function(_0x33a592){try{jsonpatch[_0x4a8d('0x27')](_0x33a592,_0x1675ff,!![]);}catch(_0x4d889d){return BPromise['reject'](_0x4d889d);}return _0x33a592['save']();};}function saveUpdates(_0x1a6797,_0x185a80){return function(_0x55ba52){if(_0x55ba52){return _0x55ba52[_0x4a8d('0x28')](_0x1a6797)[_0x4a8d('0x29')](function(_0x383156){return _0x383156;});}return null;};}function removeEntity(_0x33c0d5,_0x303347){return function(_0xe74964){if(_0xe74964){return _0xe74964['destroy']()[_0x4a8d('0x29')](function(){_0x33c0d5[_0x4a8d('0x20')](0xcc)[_0x4a8d('0x2a')]();});}};}function handleEntityNotFound(_0x537784,_0x39c3b7){return function(_0x433b27){if(!_0x433b27){_0x537784['sendStatus'](0x194);}return _0x433b27;};}function handleError(_0x327cfc,_0x3f468b){_0x3f468b=_0x3f468b||0x1f4;return function(_0xe9cc35){logger['error'](_0xe9cc35[_0x4a8d('0x2b')]);if(_0xe9cc35[_0x4a8d('0x2c')]){delete _0xe9cc35[_0x4a8d('0x2c')];}_0x327cfc[_0x4a8d('0x20')](_0x3f468b)[_0x4a8d('0x2d')](_0xe9cc35);};}exports[_0x4a8d('0x2e')]=function(_0x2634ad,_0x1da09){var _0x489042={},_0x8bac1d={},_0x2fb848={'count':0x0,'rows':[]};var _0x5ef3ce=_['map'](db[_0x4a8d('0x2f')][_0x4a8d('0x30')],function(_0x95f5){return{'name':_0x95f5[_0x4a8d('0x31')],'type':_0x95f5[_0x4a8d('0x32')][_0x4a8d('0x33')]};});_0x8bac1d['model']=_[_0x4a8d('0x34')](_0x5ef3ce,_0x4a8d('0x2c'));_0x8bac1d[_0x4a8d('0x35')]=_['keys'](_0x2634ad[_0x4a8d('0x35')]);_0x8bac1d[_0x4a8d('0x36')]=_[_0x4a8d('0x37')](_0x8bac1d[_0x4a8d('0x38')],_0x8bac1d[_0x4a8d('0x35')]);_0x489042[_0x4a8d('0x39')]=_[_0x4a8d('0x37')](_0x8bac1d[_0x4a8d('0x38')],qs[_0x4a8d('0x3a')](_0x2634ad[_0x4a8d('0x35')]['fields']));_0x489042['attributes']=_0x489042['attributes']['length']?_0x489042[_0x4a8d('0x39')]:_0x8bac1d[_0x4a8d('0x38')];if(!_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x3b')]('nolimit')){_0x489042['limit']=qs['limit'](_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x24')]);_0x489042[_0x4a8d('0x22')]=qs['offset'](_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x22')]);}_0x489042[_0x4a8d('0x3c')]=qs[_0x4a8d('0x3d')](_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x3d')]);_0x489042[_0x4a8d('0x3e')]=qs[_0x4a8d('0x36')](_[_0x4a8d('0x3f')](_0x2634ad[_0x4a8d('0x35')],_0x8bac1d[_0x4a8d('0x36')]),_0x5ef3ce);if(_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x40')]){_0x489042[_0x4a8d('0x3e')]=_[_0x4a8d('0x41')](_0x489042[_0x4a8d('0x3e')],{'$or':_['map'](_0x5ef3ce,function(_0x354cba){if(_0x354cba['type']!==_0x4a8d('0x42')){var _0x252d47={};_0x252d47[_0x354cba['name']]={'$like':'%'+_0x2634ad[_0x4a8d('0x35')]['filter']+'%'};return _0x252d47;}})});}_0x489042=_[_0x4a8d('0x41')]({},_0x489042,_0x2634ad[_0x4a8d('0x43')]);var _0x1a7b1a={'where':_0x489042[_0x4a8d('0x3e')]};return db[_0x4a8d('0x2f')]['count'](_0x1a7b1a)[_0x4a8d('0x29')](function(_0x50eb3f){_0x2fb848[_0x4a8d('0x25')]=_0x50eb3f;if(_0x2634ad[_0x4a8d('0x35')][_0x4a8d('0x44')]){_0x489042[_0x4a8d('0x45')]=[{'all':!![]}];}return db[_0x4a8d('0x2f')][_0x4a8d('0x46')](_0x489042);})[_0x4a8d('0x29')](function(_0x2a94de){_0x2fb848[_0x4a8d('0x47')]=_0x2a94de;return _0x2fb848;})[_0x4a8d('0x29')](respondWithFilteredResult(_0x1da09,_0x489042))[_0x4a8d('0x48')](handleError(_0x1da09,null));};exports[_0x4a8d('0x49')]=function(_0x31b20d,_0x1d9459){var _0x41b5f9={'raw':!![],'where':{'id':_0x31b20d['params']['id']}},_0x51015d={};_0x51015d[_0x4a8d('0x38')]=_[_0x4a8d('0x4a')](db['ChatInternalMessage'][_0x4a8d('0x30')]);_0x51015d[_0x4a8d('0x35')]=_[_0x4a8d('0x4a')](_0x31b20d[_0x4a8d('0x35')]);_0x51015d[_0x4a8d('0x36')]=_[_0x4a8d('0x37')](_0x51015d[_0x4a8d('0x38')],_0x51015d[_0x4a8d('0x35')]);_0x41b5f9['attributes']=_[_0x4a8d('0x37')](_0x51015d[_0x4a8d('0x38')],qs[_0x4a8d('0x3a')](_0x31b20d[_0x4a8d('0x35')][_0x4a8d('0x3a')]));_0x41b5f9[_0x4a8d('0x39')]=_0x41b5f9[_0x4a8d('0x39')][_0x4a8d('0x4b')]?_0x41b5f9['attributes']:_0x51015d['model'];if(_0x31b20d['query'][_0x4a8d('0x44')]){_0x41b5f9['include']=[{'all':!![]}];}_0x41b5f9=_[_0x4a8d('0x41')]({},_0x41b5f9,_0x31b20d['options']);return db[_0x4a8d('0x2f')][_0x4a8d('0x4c')](_0x41b5f9)[_0x4a8d('0x29')](handleEntityNotFound(_0x1d9459,null))['then'](respondWithResult(_0x1d9459,null))[_0x4a8d('0x48')](handleError(_0x1d9459,null));};exports[_0x4a8d('0x4d')]=function(_0xee17d3,_0x726bae){return db[_0x4a8d('0x2f')][_0x4a8d('0x4d')](_0xee17d3[_0x4a8d('0x4e')],{})[_0x4a8d('0x29')](respondWithResult(_0x726bae,0xc9))[_0x4a8d('0x48')](handleError(_0x726bae,null));};exports[_0x4a8d('0x28')]=function(_0x4964aa,_0x1a6698){if(_0x4964aa[_0x4a8d('0x4e')]['id']){delete _0x4964aa[_0x4a8d('0x4e')]['id'];}return db[_0x4a8d('0x2f')][_0x4a8d('0x4c')]({'where':{'id':_0x4964aa['params']['id']}})['then'](handleEntityNotFound(_0x1a6698,null))[_0x4a8d('0x29')](saveUpdates(_0x4964aa['body'],null))[_0x4a8d('0x29')](respondWithResult(_0x1a6698,null))['catch'](handleError(_0x1a6698,null));};exports['destroy']=function(_0x5ab2b1,_0x20313a){return db['ChatInternalMessage'][_0x4a8d('0x4c')]({'where':{'id':_0x5ab2b1[_0x4a8d('0x4f')]['id']}})[_0x4a8d('0x29')](handleEntityNotFound(_0x20313a,null))['then'](removeEntity(_0x20313a,null))[_0x4a8d('0x48')](handleError(_0x20313a,null));};exports[_0x4a8d('0x50')]=function(_0x323846,_0x2cbd6b){return db[_0x4a8d('0x2f')]['describe']()[_0x4a8d('0x29')](respondWithResult(_0x2cbd6b,null))[_0x4a8d('0x48')](handleError(_0x2cbd6b,null));};function wrapUser(_0x49427d){return function(_0x583883){var _0x3e03ef=_0x49427d[_0x4a8d('0x51')]({'plain':!![]});_0x3e03ef[_0x4a8d('0x52')]=[];if(_0x583883){_0x3e03ef['lastMessageAt']=_0x583883[_0x4a8d('0x53')];_0x3e03ef[_0x4a8d('0x54')]=_0x583883;}else{_0x3e03ef[_0x4a8d('0x55')]=moment(0x0)[_0x4a8d('0x56')](_0x4a8d('0x57'));_0x3e03ef['lastMessage']={};}return _0x3e03ef;};}exports[_0x4a8d('0x58')]=function(_0x6c5817,_0x49e090,_0x342a49){var _0x2222ac=[];return db['User']['findAll']({'where':{'role':[_0x4a8d('0x59'),'admin',_0x4a8d('0x5a')]},'attributes':['id',_0x4a8d('0x5b'),'name',_0x4a8d('0x5c'),_0x4a8d('0x5d'),_0x4a8d('0x5e'),'online',_0x4a8d('0x5f'),_0x4a8d('0x60'),_0x4a8d('0x61')],'order':qs[_0x4a8d('0x3d')](_0x4a8d('0x62')),'include':[{'model':db[_0x4a8d('0x63')],'as':_0x4a8d('0x64'),'attributes':['id',_0x4a8d('0x2c'),_0x4a8d('0x32')],'through':{'attributes':[]}}]})[_0x4a8d('0x29')](function(_0x1722f5){if(_0x1722f5){var _0x57fb80=_0x6c5817[_0x4a8d('0x5a')][_0x4a8d('0x51')]({'plain':!![]});if(!_0x57fb80)throw new Error(_0x4a8d('0x65'));if(_0x57fb80[_0x4a8d('0x5c')]===_0x4a8d('0x5a')){return db[_0x4a8d('0x66')][_0x4a8d('0x4c')]({'where':{'name':_0x4a8d('0x67'),'userProfileId':_0x57fb80['userProfileId']},'raw':!![]})[_0x4a8d('0x29')](function(_0x2b7314){if(_0x2b7314){if(_0x2b7314['autoAssociation']===0x0){return db[_0x4a8d('0x68')]['findAll']({'where':{'sectionId':_0x2b7314['id']},'raw':!![]})[_0x4a8d('0x29')](function(_0x14d618){var _0x1c2c29=[];if(_[_0x4a8d('0x69')](_0x14d618)){_0x1c2c29=_[_0x4a8d('0x40')](_0x1722f5,function(_0x308caa){if(_0x308caa['role']!==_0x4a8d('0x59')){return _0x308caa;}});return _0x1c2c29;}else{for(var _0x94807d=0x0;_0x94807d<_0x1722f5[_0x4a8d('0x4b')];_0x94807d++){var _0x521e02=_0x1722f5[_0x94807d];if(_0x521e02[_0x4a8d('0x5c')]===_0x4a8d('0x59')){var _0x19a276=_[_0x4a8d('0x4c')](_0x14d618,function(_0x5355d4){return _0x5355d4[_0x4a8d('0x6a')]===_0x521e02['id'];});if(_0x19a276)_0x1c2c29[_0x4a8d('0x6b')](_0x521e02);}else{_0x1c2c29[_0x4a8d('0x6b')](_0x521e02);}}return _0x1c2c29;}});}else{return _0x1722f5;}}else{var _0x4f8b4a=_[_0x4a8d('0x40')](_0x1722f5,function(_0xf279ee){if(_0xf279ee[_0x4a8d('0x5c')]!=='agent'){return _0xf279ee;}});return _0x4f8b4a;}});}else{return _0x1722f5;}}})['then'](function(_0x4c90f0){var _0x5a8ee8=[];if(_0x4c90f0){_0x2222ac=_0x4c90f0;for(var _0x3a7aa2=0x0;_0x3a7aa2<_0x4c90f0[_0x4a8d('0x4b')];_0x3a7aa2+=0x1){_0x2222ac[_0x3a7aa2][_0x4a8d('0x52')]=[];_0x5a8ee8[_0x4a8d('0x6b')](db[_0x4a8d('0x2f')][_0x4a8d('0x4c')]({'where':{'FromId':[_0x6c5817[_0x4a8d('0x5a')]['id'],_0x4c90f0[_0x3a7aa2]['id']],'ToId':[_0x6c5817['user']['id'],_0x4c90f0[_0x3a7aa2]['id']],'ChatGroupId':null},'attributes':['id',_0x4a8d('0x53'),_0x4a8d('0x6c'),'ToId',_0x4a8d('0x6d'),_0x4a8d('0x4e')],'order':qs[_0x4a8d('0x3d')](_0x4a8d('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4a8d('0x29')](wrapUser(_0x4c90f0[_0x3a7aa2])));}return BPromise['all'](_0x5a8ee8);}return[];})[_0x4a8d('0x29')](function(_0x450519){return{'rows':_0x450519,'count':_0x450519[_0x4a8d('0x4b')]};})[_0x4a8d('0x29')](respondWithResult(_0x49e090,null))[_0x4a8d('0x48')](handleError(_0x49e090,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c2a83ed..436a0df 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 _0x4ea0=['events','../../mysqldb','ChatInternalMessage','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ea0,0x1c7));var _0x04ea=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x4ea0[_0x190ff6];return _0x5356d2;};'use strict';var EventEmitter=require(_0x04ea('0x0'));var ChatInternalMessage=require(_0x04ea('0x1'))['db'][_0x04ea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x04ea('0x3'),'afterUpdate':_0x04ea('0x4'),'afterDestroy':_0x04ea('0x5')};function emitEvent(_0x5c0d47){return function(_0x208c50,_0x4e988c,_0x223c46){ChatInternalMessageEvents['emit'](_0x5c0d47+':'+_0x208c50['id'],_0x208c50);ChatInternalMessageEvents[_0x04ea('0x6')](_0x5c0d47,_0x208c50);_0x223c46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x57d4=['remove','emit','hasOwnProperty','exports','ChatInternalMessage','setMaxListeners'];(function(_0x48bd63,_0x5f8e86){var _0x4eaade=function(_0x5cf196){while(--_0x5cf196){_0x48bd63['push'](_0x48bd63['shift']());}};_0x4eaade(++_0x5f8e86);}(_0x57d4,0x130));var _0x457d=function(_0x2c88cb,_0x5cd141){_0x2c88cb=_0x2c88cb-0x0;var _0x4703b7=_0x57d4[_0x2c88cb];return _0x4703b7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x457d('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x457d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x457d('0x2')};function emitEvent(_0x592e30){return function(_0x2c21d6,_0x472a03,_0x846aa7){ChatInternalMessageEvents['emit'](_0x592e30+':'+_0x2c21d6['id'],_0x2c21d6);ChatInternalMessageEvents[_0x457d('0x3')](_0x592e30,_0x2c21d6);_0x846aa7(null);};}for(var e in events){if(events[_0x457d('0x4')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x457d('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e2090a6..6b3951c 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 _0xada6=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','moment','request-promise','rimraf','../../config/environment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xada6,0x1d5));var _0x6ada=function(_0x4de416,_0x497025){_0x4de416=_0x4de416-0x0;var _0x40a82e=_0xada6[_0x4de416];return _0x40a82e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6ada('0x0'));var BPromise=require('bluebird');var rp=require(_0x6ada('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ada('0x2'));var config=require(_0x6ada('0x3'));var attributes=require(_0x6ada('0x4'));module[_0x6ada('0x5')]=function(_0x252901,_0x1320ea){return _0x252901[_0x6ada('0x6')](_0x6ada('0x7'),attributes,{'tableName':_0x6ada('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ada('0x9'),'collate':_0x6ada('0xa')});}; \ No newline at end of file +var _0x4c40=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x39fa5a,_0x641751){var _0x231ba6=function(_0x4c0fe5){while(--_0x4c0fe5){_0x39fa5a['push'](_0x39fa5a['shift']());}};_0x231ba6(++_0x641751);}(_0x4c40,0xeb));var _0x04c4=function(_0x48bcb7,_0x482f77){_0x48bcb7=_0x48bcb7-0x0;var _0x3c39a6=_0x4c40[_0x48bcb7];return _0x3c39a6;};'use strict';var _=require(_0x04c4('0x0'));var util=require(_0x04c4('0x1'));var logger=require(_0x04c4('0x2'))(_0x04c4('0x3'));var moment=require(_0x04c4('0x4'));var BPromise=require(_0x04c4('0x5'));var rp=require(_0x04c4('0x6'));var fs=require('fs');var path=require(_0x04c4('0x7'));var rimraf=require(_0x04c4('0x8'));var config=require(_0x04c4('0x9'));var attributes=require(_0x04c4('0xa'));module['exports']=function(_0x546b28,_0x5ee999){return _0x546b28[_0x04c4('0xb')](_0x04c4('0xc'),attributes,{'tableName':_0x04c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x04c4('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1132d62..e2429dc 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 _0xcc92=['info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','register','request','then'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xcc92,0x141));var _0x2cc9=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xcc92[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x2cc9('0x0'));var util=require(_0x2cc9('0x1'));var moment=require(_0x2cc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x2cc9('0x3'));var fs=require('fs');var Redis=require(_0x2cc9('0x4'));var db=require(_0x2cc9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2cc9('0x6'));var config=require(_0x2cc9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cc9('0x8')]['http']({'port':0x232a});config[_0x2cc9('0x9')]=_[_0x2cc9('0xa')](config[_0x2cc9('0x9')],{'host':_0x2cc9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cc9('0x9')]));require('./chatInternalMessage.socket')[_0x2cc9('0xc')](socket);function respondWithRpcPromise(_0xeff44e,_0x59c85c,_0x4ea8c9){return new BPromise(function(_0x1e3624,_0x3a3edc){return client[_0x2cc9('0xd')](_0xeff44e,_0x4ea8c9)[_0x2cc9('0xe')](function(_0x1f7a50){logger[_0x2cc9('0xf')](_0x2cc9('0x10'),_0x59c85c,_0x2cc9('0x11'));logger[_0x2cc9('0x12')](_0x2cc9('0x13'),_0x59c85c,_0x2cc9('0x11'),JSON[_0x2cc9('0x14')](_0x1f7a50));if(_0x1f7a50['error']){if(_0x1f7a50[_0x2cc9('0x15')][_0x2cc9('0x16')]===0x1f4){logger[_0x2cc9('0x15')](_0x2cc9('0x10'),_0x59c85c,_0x1f7a50['error'][_0x2cc9('0x17')]);return _0x3a3edc(_0x1f7a50[_0x2cc9('0x15')][_0x2cc9('0x17')]);}logger[_0x2cc9('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x59c85c,_0x1f7a50[_0x2cc9('0x15')][_0x2cc9('0x17')]);return _0x1e3624(_0x1f7a50[_0x2cc9('0x15')]['message']);}else{logger[_0x2cc9('0xf')](_0x2cc9('0x10'),_0x59c85c,'request\x20sent');_0x1e3624(_0x1f7a50['result'][_0x2cc9('0x17')]);}})['catch'](function(_0x228cf6){logger['error'](_0x2cc9('0x10'),_0x59c85c,_0x228cf6);_0x3a3edc(_0x228cf6);});});} \ No newline at end of file +var _0xf461=['client','http','redis','localhost','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf461,0xba));var _0x1f46=function(_0x325d5a,_0xe51a22){_0x325d5a=_0x325d5a-0x0;var _0x1ffeac=_0xf461[_0x325d5a];return _0x1ffeac;};'use strict';var _=require(_0x1f46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f46('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f46('0x2'))(_0x1f46('0x3'));var config=require(_0x1f46('0x4'));var jayson=require(_0x1f46('0x5'));var client=jayson[_0x1f46('0x6')][_0x1f46('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1f46('0x8')],{'host':_0x1f46('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x1f46('0xa')](socket);function respondWithRpcPromise(_0x316199,_0x3f98dd,_0x10091d){return new BPromise(function(_0x3e60d4,_0x40a9bc){return client[_0x1f46('0xb')](_0x316199,_0x10091d)[_0x1f46('0xc')](function(_0x8c143d){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x3f98dd,_0x1f46('0xd'));logger[_0x1f46('0xe')](_0x1f46('0xf'),_0x3f98dd,_0x1f46('0xd'),JSON[_0x1f46('0x10')](_0x8c143d));if(_0x8c143d['error']){if(_0x8c143d[_0x1f46('0x11')][_0x1f46('0x12')]===0x1f4){logger[_0x1f46('0x11')](_0x1f46('0x13'),_0x3f98dd,_0x8c143d[_0x1f46('0x11')][_0x1f46('0x14')]);return _0x40a9bc(_0x8c143d[_0x1f46('0x11')][_0x1f46('0x14')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x3f98dd,_0x8c143d[_0x1f46('0x11')][_0x1f46('0x14')]);return _0x3e60d4(_0x8c143d['error']['message']);}else{logger[_0x1f46('0x15')](_0x1f46('0x13'),_0x3f98dd,_0x1f46('0xd'));_0x3e60d4(_0x8c143d[_0x1f46('0x16')]['message']);}})[_0x1f46('0x17')](function(_0x36e39c){logger[_0x1f46('0x11')](_0x1f46('0x13'),_0x3f98dd,_0x36e39c);_0x40a9bc(_0x36e39c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 18692f6..94acf8a 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 _0x5be7=['emit','removeListener','length','chatInternalMessage:','save','remove'];(function(_0x562914,_0x5d1db2){var _0x5306ec=function(_0x3a7e87){while(--_0x3a7e87){_0x562914['push'](_0x562914['shift']());}};_0x5306ec(++_0x5d1db2);}(_0x5be7,0xb2));var _0x75be=function(_0xa012f7,_0x44d927){_0xa012f7=_0xa012f7-0x0;var _0x3c7e92=_0x5be7[_0xa012f7];return _0x3c7e92;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x75be('0x0'),_0x75be('0x1'),'update'];function createListener(_0x217ede,_0x2675e4){return function(_0x1ecbeb){_0x2675e4[_0x75be('0x2')](_0x217ede,_0x1ecbeb);};}function removeListener(_0x319708,_0x509f2c){return function(){ChatInternalMessageEvents[_0x75be('0x3')](_0x319708,_0x509f2c);};}exports['register']=function(_0x405736){for(var _0x281918=0x0,_0x44de99=events[_0x75be('0x4')];_0x281918<_0x44de99;_0x281918++){var _0x1e26f4=events[_0x281918];var _0x1959a5=createListener(_0x75be('0x5')+_0x1e26f4,_0x405736);ChatInternalMessageEvents['on'](_0x1e26f4,_0x1959a5);}}; \ No newline at end of file +var _0x87c6=['emit','removeListener','length','./chatInternalMessage.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x87c6,0xdb));var _0x687c=function(_0xbc5a36,_0x1e5aa1){_0xbc5a36=_0xbc5a36-0x0;var _0x43ccf2=_0x87c6[_0xbc5a36];return _0x43ccf2;};'use strict';var ChatInternalMessageEvents=require(_0x687c('0x0'));var events=[_0x687c('0x1'),_0x687c('0x2'),'update'];function createListener(_0x4977a7,_0xf3f687){return function(_0x1adb2b){_0xf3f687[_0x687c('0x3')](_0x4977a7,_0x1adb2b);};}function removeListener(_0x5d5c0c,_0x253da9){return function(){ChatInternalMessageEvents[_0x687c('0x4')](_0x5d5c0c,_0x253da9);};}exports['register']=function(_0x238104){for(var _0x42eca8=0x0,_0x3be413=events[_0x687c('0x5')];_0x42eca8<_0x3be413;_0x42eca8++){var _0xdbc2c9=events[_0x42eca8];var _0x3c2982=createListener('chatInternalMessage:'+_0xdbc2c9,_0x238104);ChatInternalMessageEvents['on'](_0xdbc2c9,_0x3c2982);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b05c195..9c21466 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 _0xf759=['path','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','multer','util'];(function(_0x197ee4,_0xe37cf3){var _0x311891=function(_0x2fe664){while(--_0x2fe664){_0x197ee4['push'](_0x197ee4['shift']());}};_0x311891(++_0xe37cf3);}(_0xf759,0x11b));var _0x9f75=function(_0x524ca0,_0x3252cd){_0x524ca0=_0x524ca0-0x0;var _0x265bdc=_0xf759[_0x524ca0];return _0x265bdc;};'use strict';var multer=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var path=require(_0x9f75('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f75('0x3'));var interaction=require(_0x9f75('0x4'));var config=require('../../config/environment');var controller=require(_0x9f75('0x5'));router[_0x9f75('0x6')]('/',auth[_0x9f75('0x7')](),controller[_0x9f75('0x8')]);router[_0x9f75('0x6')](_0x9f75('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x9f75('0x6')]('/users',auth[_0x9f75('0x7')](),controller['getUsers']);router[_0x9f75('0x6')](_0x9f75('0xa'),auth['isAuthenticated'](),controller[_0x9f75('0xb')]);router['post']('/',auth[_0x9f75('0x7')](),controller[_0x9f75('0xc')]);router[_0x9f75('0xd')](_0x9f75('0xa'),controller['update']);router[_0x9f75('0xe')](_0x9f75('0xa'),auth[_0x9f75('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc874=['post','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0xc874,0x10e));var _0x4c87=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc874[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x4c87('0x0'));var util=require(_0x4c87('0x1'));var path=require('path');var timeout=require(_0x4c87('0x2'));var express=require(_0x4c87('0x3'));var router=express['Router']();var fs_extra=require(_0x4c87('0x4'));var auth=require(_0x4c87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c87('0x6'));var controller=require(_0x4c87('0x7'));router[_0x4c87('0x8')]('/',auth[_0x4c87('0x9')](),controller[_0x4c87('0xa')]);router['get']('/describe',auth[_0x4c87('0x9')](),controller[_0x4c87('0xb')]);router[_0x4c87('0x8')](_0x4c87('0xc'),auth[_0x4c87('0x9')](),controller[_0x4c87('0xd')]);router[_0x4c87('0x8')](_0x4c87('0xe'),auth[_0x4c87('0x9')](),controller[_0x4c87('0xf')]);router[_0x4c87('0x10')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x11')]);router[_0x4c87('0x12')](_0x4c87('0xe'),controller[_0x4c87('0x13')]);router['delete'](_0x4c87('0xe'),auth['isAuthenticated'](),controller[_0x4c87('0x14')]);module[_0x4c87('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 a13335d..3b36865 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 _0xd4f4=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x259aaf,_0x5dbec1){var _0x366663=function(_0x24a61a){while(--_0x24a61a){_0x259aaf['push'](_0x259aaf['shift']());}};_0x366663(++_0x5dbec1);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x230dad,_0x23f4fa){_0x230dad=_0x230dad-0x0;var _0xa632ca=_0xd4f4[_0x230dad];return _0xa632ca;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'body':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d4f('0x5')]('in',_0x4d4f('0x6')),'defaultValue':_0x4d4f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d4f('0x7')]},'providerName':{'type':Sequelize[_0x4d4f('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x93e6=['BOOLEAN','out','DATE','TEXT','sequelize','medium'];(function(_0x4aa7eb,_0x5d3857){var _0x97cbb9=function(_0x410d6e){while(--_0x410d6e){_0x4aa7eb['push'](_0x4aa7eb['shift']());}};_0x97cbb9(++_0x5d3857);}(_0x93e6,0x11e));var _0x693e=function(_0xa92ea7,_0x47d6c2){_0xa92ea7=_0xa92ea7-0x0;var _0x2441ff=_0x93e6[_0xa92ea7];return _0x2441ff;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x693e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x693e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x693e('0x3')),'defaultValue':_0x693e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x693e('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x693e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 2601f00..6957df4 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 _0x76c9=['model','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','intersection','length','include','create','body','destroy','describe','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','find','update','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','parse','chat','ChatInteractionId','role','RejectMessage','rejectMessage','QueryTypes','fullname','event','rejectmessage','formData','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','keys','query'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x76c9,0x1de));var _0x976c=function(_0xb42193,_0x2ad6d9){_0xb42193=_0xb42193-0x0;var _0xc55acd=_0x76c9[_0xb42193];return _0xc55acd;};'use strict';var emlformat=require(_0x976c('0x0'));var rimraf=require(_0x976c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x976c('0x2'));var rp=require('request-promise');var moment=require(_0x976c('0x3'));var BPromise=require(_0x976c('0x4'));var Mustache=require(_0x976c('0x5'));var util=require(_0x976c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x976c('0x7'));var ejs=require(_0x976c('0x8'));var fs=require('fs');var fs_extra=require(_0x976c('0x9'));var _=require(_0x976c('0xa'));var squel=require(_0x976c('0xb'));var crypto=require(_0x976c('0xc'));var jsforce=require(_0x976c('0xd'));var deskjs=require(_0x976c('0xe'));var toCsv=require(_0x976c('0x7'));var querystring=require(_0x976c('0xf'));var Papa=require('papaparse');var Redis=require(_0x976c('0x10'));var authService=require(_0x976c('0x11'));var qs=require(_0x976c('0x12'));var as=require(_0x976c('0x13'));var hardwareService=require(_0x976c('0x14'));var logger=require(_0x976c('0x15'))(_0x976c('0x16'));var utils=require('../../config/utils');var config=require(_0x976c('0x17'));var licenseUtil=require(_0x976c('0x18'));var db=require(_0x976c('0x19'))['db'];config[_0x976c('0x1a')]=_[_0x976c('0x1b')](config[_0x976c('0x1a')],{'host':_0x976c('0x1c'),'port':0x18eb});var socket=require(_0x976c('0x1d'))(new Redis(config[_0x976c('0x1a')]));require(_0x976c('0x1e'))[_0x976c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x976c('0x20')][_0x976c('0x21')]({'port':0x232c});var client9002=jayson[_0x976c('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb56c2b,_0x37b795,_0x157d3a,_0x152027){return new BPromise(function(_0x221e8c,_0x38b0a0){var _0x5c1fd3=_0x152027||client;return _0x5c1fd3['request'](_0xb56c2b,_0x157d3a)[_0x976c('0x22')](function(_0x1829fc){logger[_0x976c('0x23')](_0x976c('0x24'),_0x37b795,_0x976c('0x25'));logger[_0x976c('0x26')](_0x976c('0x27'),_0x37b795,_0x976c('0x25'),JSON[_0x976c('0x28')](_0x1829fc));if(_0x1829fc[_0x976c('0x29')]){if(_0x1829fc['error'][_0x976c('0x2a')]===0x1f4){logger[_0x976c('0x29')](_0x976c('0x24'),_0x37b795,_0x1829fc['error'][_0x976c('0x2b')]);return _0x38b0a0(_0x1829fc[_0x976c('0x29')][_0x976c('0x2b')]);}logger['error'](_0x976c('0x24'),_0x37b795,_0x1829fc[_0x976c('0x29')][_0x976c('0x2b')]);return _0x221e8c(_0x1829fc['error'][_0x976c('0x2b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x37b795,'request\x20sent');_0x221e8c(_0x1829fc[_0x976c('0x2c')]['message']);}})[_0x976c('0x2d')](function(_0x434e0d){logger[_0x976c('0x29')](_0x976c('0x24'),_0x37b795,_0x434e0d);_0x38b0a0(_0x434e0d);});});}function respondWithStatusCode(_0x57a6c6,_0x466e0d){_0x466e0d=_0x466e0d||0xcc;return function(_0x4915ae){if(_0x4915ae){return _0x57a6c6[_0x976c('0x2e')](_0x466e0d);}return _0x57a6c6[_0x976c('0x2f')](_0x466e0d)[_0x976c('0x30')]();};}function respondWithResult(_0x7b7ba1,_0x401c9f){_0x401c9f=_0x401c9f||0xc8;return function(_0x2357b6){if(_0x2357b6){return _0x7b7ba1[_0x976c('0x2f')](_0x401c9f)[_0x976c('0x31')](_0x2357b6);}};}function respondWithFilteredResult(_0xbabcd3,_0x3dc3ba){return function(_0x4f26da){if(_0x4f26da){var _0x5ac8ab=typeof _0x3dc3ba[_0x976c('0x32')]===_0x976c('0x33')&&typeof _0x3dc3ba['limit']==='undefined';var _0x3591f1=_0x4f26da[_0x976c('0x34')];var _0xbb4264=_0x5ac8ab?0x0:_0x3dc3ba[_0x976c('0x32')];var _0x13ccd4=_0x5ac8ab?_0x4f26da[_0x976c('0x34')]:_0x3dc3ba[_0x976c('0x32')]+_0x3dc3ba[_0x976c('0x35')];var _0x80cb60;if(_0x13ccd4>=_0x3591f1){_0x13ccd4=_0x3591f1;_0x80cb60=0xc8;}else{_0x80cb60=0xce;}_0xbabcd3[_0x976c('0x2f')](_0x80cb60);return _0xbabcd3[_0x976c('0x36')](_0x976c('0x37'),_0xbb4264+'-'+_0x13ccd4+'/'+_0x3591f1)[_0x976c('0x31')](_0x4f26da);}return null;};}function patchUpdates(_0x23c5cb){return function(_0x57971d){try{jsonpatch[_0x976c('0x38')](_0x57971d,_0x23c5cb,!![]);}catch(_0x26ef2c){return BPromise['reject'](_0x26ef2c);}return _0x57971d[_0x976c('0x39')]();};}function saveUpdates(_0x5741b6,_0x977e71){return function(_0x3f62d1){if(_0x3f62d1){return _0x3f62d1['update'](_0x5741b6)[_0x976c('0x22')](function(_0x28e1de){return _0x28e1de;});}return null;};}function removeEntity(_0x1d8f9a,_0xba9df3){return function(_0x17b288){if(_0x17b288){return _0x17b288['destroy']()[_0x976c('0x22')](function(){_0x1d8f9a[_0x976c('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36af1b,_0x5e89d9){return function(_0x285bcc){if(!_0x285bcc){_0x36af1b[_0x976c('0x2e')](0x194);}return _0x285bcc;};}function handleError(_0x246a6a,_0x49c6b5){_0x49c6b5=_0x49c6b5||0x1f4;return function(_0x1e988a){logger[_0x976c('0x29')](_0x1e988a[_0x976c('0x3a')]);if(_0x1e988a['name']){delete _0x1e988a[_0x976c('0x3b')];}_0x246a6a[_0x976c('0x2f')](_0x49c6b5)[_0x976c('0x3c')](_0x1e988a);};}exports[_0x976c('0x3d')]=function(_0x4c28a9,_0x4a78b0){var _0x231107={},_0x57d8e1={},_0x57afaa={'count':0x0,'rows':[]};var _0x25eb6d=_[_0x976c('0x3e')](db[_0x976c('0x3f')][_0x976c('0x40')],function(_0x3a1492){return{'name':_0x3a1492[_0x976c('0x41')],'type':_0x3a1492[_0x976c('0x42')][_0x976c('0x43')]};});_0x57d8e1['model']=_[_0x976c('0x3e')](_0x25eb6d,'name');_0x57d8e1['query']=_[_0x976c('0x44')](_0x4c28a9[_0x976c('0x45')]);_0x57d8e1['filters']=_['intersection'](_0x57d8e1['model'],_0x57d8e1['query']);_0x231107['attributes']=_['intersection'](_0x57d8e1[_0x976c('0x46')],qs[_0x976c('0x47')](_0x4c28a9[_0x976c('0x45')][_0x976c('0x47')]));_0x231107[_0x976c('0x48')]=_0x231107[_0x976c('0x48')]['length']?_0x231107[_0x976c('0x48')]:_0x57d8e1['model'];if(!_0x4c28a9[_0x976c('0x45')][_0x976c('0x49')]('nolimit')){_0x231107['limit']=qs[_0x976c('0x35')](_0x4c28a9[_0x976c('0x45')][_0x976c('0x35')]);_0x231107[_0x976c('0x32')]=qs[_0x976c('0x32')](_0x4c28a9[_0x976c('0x45')][_0x976c('0x32')]);}_0x231107[_0x976c('0x4a')]=qs[_0x976c('0x4b')](_0x4c28a9['query'][_0x976c('0x4b')]);_0x231107[_0x976c('0x4c')]=qs[_0x976c('0x4d')](_[_0x976c('0x4e')](_0x4c28a9[_0x976c('0x45')],_0x57d8e1['filters']),_0x25eb6d);if(_0x4c28a9['query'][_0x976c('0x4f')]){_0x231107['where']=_[_0x976c('0x50')](_0x231107['where'],{'$or':_[_0x976c('0x3e')](_0x25eb6d,function(_0x381606){if(_0x381606[_0x976c('0x42')]!==_0x976c('0x51')){var _0x2d37f4={};_0x2d37f4[_0x381606[_0x976c('0x3b')]]={'$like':'%'+_0x4c28a9[_0x976c('0x45')][_0x976c('0x4f')]+'%'};return _0x2d37f4;}})});}_0x231107=_[_0x976c('0x50')]({},_0x231107,_0x4c28a9[_0x976c('0x52')]);var _0x3b53f3={'where':_0x231107[_0x976c('0x4c')]};return db[_0x976c('0x3f')][_0x976c('0x34')](_0x3b53f3)[_0x976c('0x22')](function(_0x44ec9e){_0x57afaa[_0x976c('0x34')]=_0x44ec9e;if(_0x4c28a9[_0x976c('0x45')][_0x976c('0x53')]){_0x231107['include']=[{'all':!![]}];}return db[_0x976c('0x3f')][_0x976c('0x54')](_0x231107);})[_0x976c('0x22')](function(_0x4aac2e){_0x57afaa['rows']=_0x4aac2e;return _0x57afaa;})[_0x976c('0x22')](respondWithFilteredResult(_0x4a78b0,_0x231107))[_0x976c('0x2d')](handleError(_0x4a78b0,null));};exports[_0x976c('0x55')]=function(_0x2ee0fa,_0x2c9c3a){var _0x5deff6={'raw':!![],'where':{'id':_0x2ee0fa[_0x976c('0x56')]['id']}},_0x4e8aa3={};_0x4e8aa3[_0x976c('0x46')]=_[_0x976c('0x44')](db[_0x976c('0x3f')][_0x976c('0x40')]);_0x4e8aa3['query']=_['keys'](_0x2ee0fa[_0x976c('0x45')]);_0x4e8aa3[_0x976c('0x4d')]=_[_0x976c('0x57')](_0x4e8aa3[_0x976c('0x46')],_0x4e8aa3[_0x976c('0x45')]);_0x5deff6[_0x976c('0x48')]=_[_0x976c('0x57')](_0x4e8aa3['model'],qs[_0x976c('0x47')](_0x2ee0fa['query'][_0x976c('0x47')]));_0x5deff6[_0x976c('0x48')]=_0x5deff6[_0x976c('0x48')][_0x976c('0x58')]?_0x5deff6[_0x976c('0x48')]:_0x4e8aa3[_0x976c('0x46')];if(_0x2ee0fa[_0x976c('0x45')]['includeAll']){_0x5deff6[_0x976c('0x59')]=[{'all':!![]}];}_0x5deff6=_[_0x976c('0x50')]({},_0x5deff6,_0x2ee0fa[_0x976c('0x52')]);return db[_0x976c('0x3f')]['find'](_0x5deff6)[_0x976c('0x22')](handleEntityNotFound(_0x2c9c3a,null))[_0x976c('0x22')](respondWithResult(_0x2c9c3a,null))[_0x976c('0x2d')](handleError(_0x2c9c3a,null));};exports[_0x976c('0x5a')]=function(_0x163212,_0x414f9b){return db[_0x976c('0x3f')]['create'](_0x163212['body'],{})['then'](respondWithResult(_0x414f9b,0xc9))[_0x976c('0x2d')](handleError(_0x414f9b,null));};exports['update']=function(_0x31e33a,_0x255909){if(_0x31e33a[_0x976c('0x5b')]['id']){delete _0x31e33a[_0x976c('0x5b')]['id'];}return db[_0x976c('0x3f')]['find']({'where':{'id':_0x31e33a[_0x976c('0x56')]['id']}})[_0x976c('0x22')](handleEntityNotFound(_0x255909,null))['then'](saveUpdates(_0x31e33a[_0x976c('0x5b')],null))[_0x976c('0x22')](respondWithResult(_0x255909,null))[_0x976c('0x2d')](handleError(_0x255909,null));};exports[_0x976c('0x5c')]=function(_0x26e7bf,_0x50b7e6){return db[_0x976c('0x3f')]['find']({'where':{'id':_0x26e7bf[_0x976c('0x56')]['id']}})[_0x976c('0x22')](handleEntityNotFound(_0x50b7e6,null))[_0x976c('0x22')](removeEntity(_0x50b7e6,null))['catch'](handleError(_0x50b7e6,null));};exports[_0x976c('0x5d')]=function(_0x55a16a,_0x42a305){return db[_0x976c('0x3f')][_0x976c('0x5d')]()['then'](respondWithResult(_0x42a305,null))[_0x976c('0x2d')](handleError(_0x42a305,null));};var interaction_log=require(_0x976c('0x15'))(_0x976c('0x5e'));exports['accept']=function(_0x577a2f,_0x2cf036,_0x5acf2f){var _0x311f7b={'agent':{},'channel':'chat'};if(_0x577a2f[_0x976c('0x5b')]['id']){delete _0x577a2f[_0x976c('0x5b')]['id'];}_0x577a2f[_0x976c('0x5b')][_0x976c('0x5f')]=!![];_0x577a2f['body'][_0x976c('0x60')]=moment()[_0x976c('0x61')](_0x976c('0x62'));_0x577a2f[_0x976c('0x5b')][_0x976c('0x63')]=_0x577a2f[_0x976c('0x5b')][_0x976c('0x63')]||_0x577a2f[_0x976c('0x64')]['id'];_0x311f7b[_0x976c('0x65')]['id']=_0x577a2f[_0x976c('0x5b')][_0x976c('0x63')];return db['ChatMessage']['find']({'where':{'id':_0x577a2f[_0x976c('0x56')]['id'],'UserId':null}})[_0x976c('0x22')](handleEntityNotFound(_0x2cf036,null))[_0x976c('0x22')](saveUpdates(_0x577a2f[_0x976c('0x5b')],null))['then'](function(_0x496c2c){if(_0x496c2c){_0x311f7b[_0x976c('0x2b')]=_0x496c2c[_0x976c('0x66')]({'plain':!![]});return db[_0x976c('0x67')][_0x976c('0x68')]({'where':{'id':_0x496c2c['ChatInteractionId']}});}return null;})[_0x976c('0x22')](handleEntityNotFound(_0x2cf036,null))[_0x976c('0x22')](function(_0x7d5087){if(_0x7d5087){return _0x7d5087[_0x976c('0x69')]({'UserId':_0x577a2f[_0x976c('0x5b')]['UserId'],'read1stAt':_[_0x976c('0x6a')](_0x7d5087[_0x976c('0x6b')])?moment()[_0x976c('0x61')](_0x976c('0x62')):undefined});}return null;})[_0x976c('0x22')](function(_0x5620d9){if(_0x5620d9){_0x311f7b['interaction']=_0x5620d9['get']({'plain':!![]});interaction_log[_0x976c('0x23')](_0x976c('0x6c'),_0x577a2f[_0x976c('0x64')]['id'],_0x577a2f[_0x976c('0x64')][_0x976c('0x3b')],_0x577a2f[_0x976c('0x64')]['role'],_0x311f7b[_0x976c('0x6d')]['id'],_0x577a2f[_0x976c('0x5b')]?JSON[_0x976c('0x28')](_0x577a2f[_0x976c('0x5b')]):_0x976c('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x311f7b);}return null;})[_0x976c('0x22')](function(_0x59b264){var _0x89e0fa=_0x976c('0x6f')+_0x59b264[_0x976c('0x2b')][_0x976c('0x70')];return db[_0x976c('0x71')]['query'](_0x89e0fa,{'type':db['Sequelize']['QueryTypes'][_0x976c('0x72')],'raw':!![]})[_0x976c('0x22')](function(_0x563f2d){return _0x563f2d;});})['then'](function(_0x260517){if(_0x260517){_0x311f7b[_0x976c('0x2b')][_0x976c('0x73')]=_0x260517[0x0];if(!_0x577a2f[_0x976c('0x5b')][_0x976c('0x63')])return;return db[_0x976c('0x74')][_0x976c('0x68')]({'where':{'id':_0x577a2f[_0x976c('0x5b')][_0x976c('0x63')],'role':_0x976c('0x65')},'attributes':['id',_0x976c('0x3b'),'fullname','email',_0x976c('0x75')],'raw':!![]});}return null;})[_0x976c('0x22')](function(_0x31607b){if(!_0x31607b)return null;_0x311f7b[_0x976c('0x2b')]['agent']=_0x31607b;return _0x311f7b;})['then'](function(_0x5ce2bf){if(_0x5ce2bf){if(_0x577a2f[_0x976c('0x5b')][_0x976c('0x76')]){_0x311f7b[_0x976c('0x2b')][_0x976c('0x77')]=util[_0x976c('0x61')](_0x976c('0x78'),_0x577a2f['user'][_0x976c('0x3b')]);_0x311f7b[_0x976c('0x2b')][_0x976c('0x79')]=_0x311f7b[_0x976c('0x79')];_0x311f7b[_0x976c('0x2b')][_0x976c('0x7a')]=_0x311f7b['channel'];_0x311f7b[_0x976c('0x2b')]['event']=_0x976c('0x7b');return respondWithRpcPromise(_0x976c('0x7c'),_0x976c('0x7c'),{'event':_0x976c('0x7d'),'message':_[_0x976c('0x50')](_0x311f7b['message'],JSON[_0x976c('0x7e')](_0x311f7b[_0x976c('0x6d')]['formData']))},client9002)[_0x976c('0x22')](function(){return _0x311f7b;});}return _0x311f7b;}return null;})[_0x976c('0x22')](respondWithResult(_0x2cf036,null))[_0x976c('0x2d')](handleError(_0x2cf036,null));};var interaction_log=require(_0x976c('0x15'))(_0x976c('0x5e'));exports['reject']=function(_0xe53dd4,_0x52bd30,_0x23f3a3){var _0x254bb2={'agent':{},'channel':_0x976c('0x7f')};if(_0xe53dd4[_0x976c('0x5b')]['id']){delete _0xe53dd4[_0x976c('0x5b')]['id'];}_0xe53dd4[_0x976c('0x5b')][_0x976c('0x63')]=_0xe53dd4[_0x976c('0x5b')][_0x976c('0x63')]||_0xe53dd4[_0x976c('0x64')]['id'];_0x254bb2[_0x976c('0x65')]['id']=_0xe53dd4[_0x976c('0x5b')][_0x976c('0x63')];return db[_0x976c('0x3f')][_0x976c('0x68')]({'where':{'id':_0xe53dd4[_0x976c('0x56')]['id'],'UserId':null}})[_0x976c('0x22')](handleEntityNotFound(_0x52bd30,null))['then'](function(_0x156351){if(_0x156351){_0x254bb2[_0x976c('0x2b')]=_0x156351[_0x976c('0x66')]({'plain':!![]});return db[_0x976c('0x67')]['find']({'where':{'id':_0x156351[_0x976c('0x80')]}});}return null;})[_0x976c('0x22')](handleEntityNotFound(_0x52bd30,null))['then'](function(_0x3eba2a){if(_0x3eba2a){_0x254bb2[_0x976c('0x6d')]=_0x3eba2a[_0x976c('0x66')]({'plain':!![]});interaction_log[_0x976c('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe53dd4[_0x976c('0x64')]['id'],_0xe53dd4[_0x976c('0x64')][_0x976c('0x3b')],_0xe53dd4[_0x976c('0x64')][_0x976c('0x81')],_0x254bb2[_0x976c('0x6d')]['id'],_0xe53dd4[_0x976c('0x5b')]?JSON['stringify'](_0xe53dd4[_0x976c('0x5b')]):_0x976c('0x6e'));return respondWithRpcPromise(_0x976c('0x82'),_0x976c('0x83'),_0x254bb2);}return null;})['then'](function(_0x3f6ab4){var _0xf01b46=_0x976c('0x6f')+_0x3f6ab4[_0x976c('0x2b')][_0x976c('0x70')];return db['sequelize'][_0x976c('0x45')](_0xf01b46,{'type':db['Sequelize'][_0x976c('0x84')][_0x976c('0x72')],'raw':!![]})[_0x976c('0x22')](function(_0x1d75f1){return _0x1d75f1;});})[_0x976c('0x22')](function(_0x19d4ca){if(_0x19d4ca){_0x254bb2[_0x976c('0x2b')][_0x976c('0x73')]=_0x19d4ca[0x0];if(!_0xe53dd4[_0x976c('0x5b')][_0x976c('0x63')])return;return db[_0x976c('0x74')][_0x976c('0x68')]({'where':{'id':_0xe53dd4[_0x976c('0x5b')][_0x976c('0x63')],'role':_0x976c('0x65')},'attributes':['id',_0x976c('0x3b'),_0x976c('0x85'),'email',_0x976c('0x75')],'raw':!![]});}return null;})[_0x976c('0x22')](function(_0x4ddd1c){if(!_0x4ddd1c)return null;_0x254bb2['message'][_0x976c('0x65')]=_0x4ddd1c;return _0x254bb2;})[_0x976c('0x22')](function(_0x5b483a){if(_0x5b483a){_0x5b483a['message'][_0x976c('0x77')]=util[_0x976c('0x61')]('SIP/%s',_0xe53dd4[_0x976c('0x64')][_0x976c('0x3b')]);_0x5b483a[_0x976c('0x2b')][_0x976c('0x79')]=_0x254bb2[_0x976c('0x79')];_0x5b483a[_0x976c('0x2b')][_0x976c('0x7a')]=_0x254bb2[_0x976c('0x79')];_0x5b483a[_0x976c('0x2b')][_0x976c('0x86')]='reject';respondWithRpcPromise('EventManager',_0x976c('0x7c'),{'event':_0x976c('0x87'),'message':_[_0x976c('0x50')](_0x254bb2['message'],JSON['parse'](_0x254bb2[_0x976c('0x6d')][_0x976c('0x88')]))},client9002);return _0x254bb2;}return null;})['then'](respondWithResult(_0x52bd30,null))[_0x976c('0x2d')](handleError(_0x52bd30,null));}; \ No newline at end of file +var _0x8b98=['get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./chatMessage.socket','jayson/promise','client','then','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','set','reject','update','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','destroy','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent'];(function(_0x45542e,_0xf51a9f){var _0x447b10=function(_0x7a7d53){while(--_0x7a7d53){_0x45542e['push'](_0x45542e['shift']());}};_0x447b10(++_0xf51a9f);}(_0x8b98,0x1a4));var _0x88b9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8b98[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x88b9('0x0'));var rimraf=require(_0x88b9('0x1'));var zipdir=require(_0x88b9('0x2'));var jsonpatch=require(_0x88b9('0x3'));var rp=require(_0x88b9('0x4'));var moment=require(_0x88b9('0x5'));var BPromise=require(_0x88b9('0x6'));var Mustache=require('mustache');var util=require(_0x88b9('0x7'));var path=require(_0x88b9('0x8'));var sox=require(_0x88b9('0x9'));var csv=require('to-csv');var ejs=require(_0x88b9('0xa'));var fs=require('fs');var fs_extra=require(_0x88b9('0xb'));var _=require(_0x88b9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x88b9('0xd'));var querystring=require(_0x88b9('0xe'));var Papa=require(_0x88b9('0xf'));var Redis=require(_0x88b9('0x10'));var authService=require(_0x88b9('0x11'));var qs=require(_0x88b9('0x12'));var as=require(_0x88b9('0x13'));var hardwareService=require(_0x88b9('0x14'));var logger=require(_0x88b9('0x15'))(_0x88b9('0x16'));var utils=require(_0x88b9('0x17'));var config=require(_0x88b9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x88b9('0x19'))['db'];config['redis']=_[_0x88b9('0x1a')](config[_0x88b9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88b9('0x1b')]));require(_0x88b9('0x1c'))['register'](socket);var jayson=require(_0x88b9('0x1d'));var client=jayson[_0x88b9('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x88b9('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2387,_0x24cb81,_0x2db9e1,_0x3cae8d){return new BPromise(function(_0x2f39da,_0x18a078){var _0xd596d2=_0x3cae8d||client;return _0xd596d2['request'](_0x5f2387,_0x2db9e1)[_0x88b9('0x1f')](function(_0x36e28d){logger['info']('ChatMessage,\x20%s,\x20%s',_0x24cb81,'request\x20sent');logger[_0x88b9('0x20')](_0x88b9('0x21'),_0x24cb81,_0x88b9('0x22'),JSON[_0x88b9('0x23')](_0x36e28d));if(_0x36e28d[_0x88b9('0x24')]){if(_0x36e28d[_0x88b9('0x24')][_0x88b9('0x25')]===0x1f4){logger[_0x88b9('0x24')](_0x88b9('0x26'),_0x24cb81,_0x36e28d[_0x88b9('0x24')][_0x88b9('0x27')]);return _0x18a078(_0x36e28d[_0x88b9('0x24')][_0x88b9('0x27')]);}logger[_0x88b9('0x24')](_0x88b9('0x26'),_0x24cb81,_0x36e28d['error']['message']);return _0x2f39da(_0x36e28d[_0x88b9('0x24')][_0x88b9('0x27')]);}else{logger[_0x88b9('0x28')](_0x88b9('0x26'),_0x24cb81,_0x88b9('0x22'));_0x2f39da(_0x36e28d[_0x88b9('0x29')][_0x88b9('0x27')]);}})[_0x88b9('0x2a')](function(_0x3d0d54){logger[_0x88b9('0x24')](_0x88b9('0x26'),_0x24cb81,_0x3d0d54);_0x18a078(_0x3d0d54);});});}function respondWithStatusCode(_0x3c080c,_0x4db6fa){_0x4db6fa=_0x4db6fa||0xcc;return function(_0x3da1fa){if(_0x3da1fa){return _0x3c080c[_0x88b9('0x2b')](_0x4db6fa);}return _0x3c080c['status'](_0x4db6fa)[_0x88b9('0x2c')]();};}function respondWithResult(_0x124f5e,_0x320cc6){_0x320cc6=_0x320cc6||0xc8;return function(_0x510504){if(_0x510504){return _0x124f5e[_0x88b9('0x2d')](_0x320cc6)[_0x88b9('0x2e')](_0x510504);}};}function respondWithFilteredResult(_0x2e20d4,_0x5d1def){return function(_0x1552a5){if(_0x1552a5){var _0x34727c=typeof _0x5d1def['offset']==='undefined'&&typeof _0x5d1def[_0x88b9('0x2f')]===_0x88b9('0x30');var _0x3149a6=_0x1552a5[_0x88b9('0x31')];var _0x3485a7=_0x34727c?0x0:_0x5d1def[_0x88b9('0x32')];var _0x3b96f0=_0x34727c?_0x1552a5[_0x88b9('0x31')]:_0x5d1def[_0x88b9('0x32')]+_0x5d1def[_0x88b9('0x2f')];var _0x2690f2;if(_0x3b96f0>=_0x3149a6){_0x3b96f0=_0x3149a6;_0x2690f2=0xc8;}else{_0x2690f2=0xce;}_0x2e20d4[_0x88b9('0x2d')](_0x2690f2);return _0x2e20d4[_0x88b9('0x33')]('Content-Range',_0x3485a7+'-'+_0x3b96f0+'/'+_0x3149a6)[_0x88b9('0x2e')](_0x1552a5);}return null;};}function patchUpdates(_0x56b827){return function(_0x67c19f){try{jsonpatch['apply'](_0x67c19f,_0x56b827,!![]);}catch(_0x140f0b){return BPromise[_0x88b9('0x34')](_0x140f0b);}return _0x67c19f['save']();};}function saveUpdates(_0x366dc6,_0x4987f9){return function(_0x1da781){if(_0x1da781){return _0x1da781[_0x88b9('0x35')](_0x366dc6)['then'](function(_0x5053a0){return _0x5053a0;});}return null;};}function removeEntity(_0xb69621,_0x2860ac){return function(_0x1674a3){if(_0x1674a3){return _0x1674a3['destroy']()['then'](function(){_0xb69621['status'](0xcc)[_0x88b9('0x2c')]();});}};}function handleEntityNotFound(_0x27e958,_0x4fb340){return function(_0x586543){if(!_0x586543){_0x27e958[_0x88b9('0x2b')](0x194);}return _0x586543;};}function handleError(_0x476780,_0x435ef6){_0x435ef6=_0x435ef6||0x1f4;return function(_0x54537d){logger['error'](_0x54537d[_0x88b9('0x36')]);if(_0x54537d[_0x88b9('0x37')]){delete _0x54537d[_0x88b9('0x37')];}_0x476780['status'](_0x435ef6)[_0x88b9('0x38')](_0x54537d);};}exports[_0x88b9('0x39')]=function(_0x2b9d52,_0x37c9e0){var _0x2605c2={},_0x514350={},_0x52646f={'count':0x0,'rows':[]};var _0x17247e=_['map'](db[_0x88b9('0x3a')][_0x88b9('0x3b')],function(_0x3a6d43){return{'name':_0x3a6d43[_0x88b9('0x3c')],'type':_0x3a6d43[_0x88b9('0x3d')]['key']};});_0x514350['model']=_[_0x88b9('0x3e')](_0x17247e,_0x88b9('0x37'));_0x514350[_0x88b9('0x3f')]=_[_0x88b9('0x40')](_0x2b9d52[_0x88b9('0x3f')]);_0x514350[_0x88b9('0x41')]=_['intersection'](_0x514350[_0x88b9('0x42')],_0x514350[_0x88b9('0x3f')]);_0x2605c2[_0x88b9('0x43')]=_[_0x88b9('0x44')](_0x514350[_0x88b9('0x42')],qs['fields'](_0x2b9d52[_0x88b9('0x3f')][_0x88b9('0x45')]));_0x2605c2[_0x88b9('0x43')]=_0x2605c2['attributes'][_0x88b9('0x46')]?_0x2605c2[_0x88b9('0x43')]:_0x514350[_0x88b9('0x42')];if(!_0x2b9d52[_0x88b9('0x3f')]['hasOwnProperty']('nolimit')){_0x2605c2[_0x88b9('0x2f')]=qs[_0x88b9('0x2f')](_0x2b9d52[_0x88b9('0x3f')][_0x88b9('0x2f')]);_0x2605c2[_0x88b9('0x32')]=qs[_0x88b9('0x32')](_0x2b9d52[_0x88b9('0x3f')][_0x88b9('0x32')]);}_0x2605c2['order']=qs[_0x88b9('0x47')](_0x2b9d52[_0x88b9('0x3f')][_0x88b9('0x47')]);_0x2605c2[_0x88b9('0x48')]=qs[_0x88b9('0x41')](_['pick'](_0x2b9d52[_0x88b9('0x3f')],_0x514350[_0x88b9('0x41')]),_0x17247e);if(_0x2b9d52[_0x88b9('0x3f')]['filter']){_0x2605c2[_0x88b9('0x48')]=_[_0x88b9('0x49')](_0x2605c2[_0x88b9('0x48')],{'$or':_[_0x88b9('0x3e')](_0x17247e,function(_0x48ebc8){if(_0x48ebc8['type']!==_0x88b9('0x4a')){var _0xd9385a={};_0xd9385a[_0x48ebc8[_0x88b9('0x37')]]={'$like':'%'+_0x2b9d52[_0x88b9('0x3f')]['filter']+'%'};return _0xd9385a;}})});}_0x2605c2=_['merge']({},_0x2605c2,_0x2b9d52[_0x88b9('0x4b')]);var _0x2344e9={'where':_0x2605c2[_0x88b9('0x48')]};return db[_0x88b9('0x3a')][_0x88b9('0x31')](_0x2344e9)[_0x88b9('0x1f')](function(_0x1908e8){_0x52646f[_0x88b9('0x31')]=_0x1908e8;if(_0x2b9d52[_0x88b9('0x3f')][_0x88b9('0x4c')]){_0x2605c2[_0x88b9('0x4d')]=[{'all':!![]}];}return db[_0x88b9('0x3a')]['findAll'](_0x2605c2);})[_0x88b9('0x1f')](function(_0x30d152){_0x52646f[_0x88b9('0x4e')]=_0x30d152;return _0x52646f;})[_0x88b9('0x1f')](respondWithFilteredResult(_0x37c9e0,_0x2605c2))[_0x88b9('0x2a')](handleError(_0x37c9e0,null));};exports[_0x88b9('0x4f')]=function(_0x23e4ca,_0x4eabf1){var _0x2bb1f9={'raw':!![],'where':{'id':_0x23e4ca['params']['id']}},_0x49a40c={};_0x49a40c['model']=_[_0x88b9('0x40')](db[_0x88b9('0x3a')]['rawAttributes']);_0x49a40c['query']=_[_0x88b9('0x40')](_0x23e4ca[_0x88b9('0x3f')]);_0x49a40c[_0x88b9('0x41')]=_[_0x88b9('0x44')](_0x49a40c[_0x88b9('0x42')],_0x49a40c[_0x88b9('0x3f')]);_0x2bb1f9['attributes']=_[_0x88b9('0x44')](_0x49a40c['model'],qs[_0x88b9('0x45')](_0x23e4ca['query'][_0x88b9('0x45')]));_0x2bb1f9[_0x88b9('0x43')]=_0x2bb1f9['attributes']['length']?_0x2bb1f9[_0x88b9('0x43')]:_0x49a40c[_0x88b9('0x42')];if(_0x23e4ca[_0x88b9('0x3f')]['includeAll']){_0x2bb1f9['include']=[{'all':!![]}];}_0x2bb1f9=_['merge']({},_0x2bb1f9,_0x23e4ca[_0x88b9('0x4b')]);return db[_0x88b9('0x3a')][_0x88b9('0x50')](_0x2bb1f9)[_0x88b9('0x1f')](handleEntityNotFound(_0x4eabf1,null))[_0x88b9('0x1f')](respondWithResult(_0x4eabf1,null))[_0x88b9('0x2a')](handleError(_0x4eabf1,null));};exports[_0x88b9('0x51')]=function(_0x2ff80f,_0x269d97){return db[_0x88b9('0x3a')][_0x88b9('0x51')](_0x2ff80f[_0x88b9('0x52')],{})[_0x88b9('0x1f')](respondWithResult(_0x269d97,0xc9))[_0x88b9('0x2a')](handleError(_0x269d97,null));};exports[_0x88b9('0x35')]=function(_0x4fd9ea,_0x5e223b){if(_0x4fd9ea['body']['id']){delete _0x4fd9ea[_0x88b9('0x52')]['id'];}return db[_0x88b9('0x3a')][_0x88b9('0x50')]({'where':{'id':_0x4fd9ea['params']['id']}})['then'](handleEntityNotFound(_0x5e223b,null))[_0x88b9('0x1f')](saveUpdates(_0x4fd9ea[_0x88b9('0x52')],null))[_0x88b9('0x1f')](respondWithResult(_0x5e223b,null))[_0x88b9('0x2a')](handleError(_0x5e223b,null));};exports[_0x88b9('0x53')]=function(_0x5c865e,_0x2f5764){return db['ChatMessage'][_0x88b9('0x50')]({'where':{'id':_0x5c865e[_0x88b9('0x54')]['id']}})[_0x88b9('0x1f')](handleEntityNotFound(_0x2f5764,null))[_0x88b9('0x1f')](removeEntity(_0x2f5764,null))['catch'](handleError(_0x2f5764,null));};exports[_0x88b9('0x55')]=function(_0xfb7618,_0x509a90){return db[_0x88b9('0x3a')]['describe']()[_0x88b9('0x1f')](respondWithResult(_0x509a90,null))['catch'](handleError(_0x509a90,null));};var interaction_log=require(_0x88b9('0x15'))(_0x88b9('0x56'));exports[_0x88b9('0x57')]=function(_0x2c5cd8,_0xfee436,_0x443b2f){var _0x4934e5={'agent':{},'channel':_0x88b9('0x58')};if(_0x2c5cd8[_0x88b9('0x52')]['id']){delete _0x2c5cd8[_0x88b9('0x52')]['id'];}_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x59')]=!![];_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5a')]=moment()[_0x88b9('0x5b')](_0x88b9('0x5c'));_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')]=_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')]||_0x2c5cd8[_0x88b9('0x5e')]['id'];_0x4934e5[_0x88b9('0x5f')]['id']=_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')];return db[_0x88b9('0x3a')]['find']({'where':{'id':_0x2c5cd8[_0x88b9('0x54')]['id'],'UserId':null}})[_0x88b9('0x1f')](handleEntityNotFound(_0xfee436,null))[_0x88b9('0x1f')](saveUpdates(_0x2c5cd8['body'],null))[_0x88b9('0x1f')](function(_0x345613){if(_0x345613){_0x4934e5[_0x88b9('0x27')]=_0x345613[_0x88b9('0x60')]({'plain':!![]});return db[_0x88b9('0x61')][_0x88b9('0x50')]({'where':{'id':_0x345613[_0x88b9('0x62')]}});}return null;})['then'](handleEntityNotFound(_0xfee436,null))[_0x88b9('0x1f')](function(_0x446434){if(_0x446434){return _0x446434[_0x88b9('0x35')]({'UserId':_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')],'read1stAt':_['isNil'](_0x446434[_0x88b9('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x88b9('0x1f')](function(_0x521022){if(_0x521022){_0x4934e5[_0x88b9('0x64')]=_0x521022[_0x88b9('0x60')]({'plain':!![]});interaction_log[_0x88b9('0x28')](_0x88b9('0x65'),_0x2c5cd8[_0x88b9('0x5e')]['id'],_0x2c5cd8[_0x88b9('0x5e')]['name'],_0x2c5cd8[_0x88b9('0x5e')][_0x88b9('0x66')],_0x4934e5[_0x88b9('0x64')]['id'],_0x2c5cd8[_0x88b9('0x52')]?JSON[_0x88b9('0x23')](_0x2c5cd8[_0x88b9('0x52')]):_0x88b9('0x67'));return respondWithRpcPromise(_0x88b9('0x68'),'acceptMessage',_0x4934e5);}return null;})[_0x88b9('0x1f')](function(_0x48a237){var _0x42e182=_0x88b9('0x69')+_0x48a237[_0x88b9('0x27')][_0x88b9('0x6a')];return db['sequelize'][_0x88b9('0x3f')](_0x42e182,{'type':db['Sequelize'][_0x88b9('0x6b')][_0x88b9('0x6c')],'raw':!![]})[_0x88b9('0x1f')](function(_0x2a3704){return _0x2a3704;});})['then'](function(_0x20b622){if(_0x20b622){_0x4934e5[_0x88b9('0x27')][_0x88b9('0x6d')]=_0x20b622[0x0];if(!_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')])return;return db[_0x88b9('0x6e')][_0x88b9('0x50')]({'where':{'id':_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x5d')],'role':_0x88b9('0x5f')},'attributes':['id',_0x88b9('0x37'),_0x88b9('0x6f'),_0x88b9('0x70'),_0x88b9('0x71')],'raw':!![]});}return null;})[_0x88b9('0x1f')](function(_0x552923){if(!_0x552923)return null;_0x4934e5[_0x88b9('0x27')][_0x88b9('0x5f')]=_0x552923;return _0x4934e5;})[_0x88b9('0x1f')](function(_0x19c193){if(_0x19c193){if(_0x2c5cd8[_0x88b9('0x52')][_0x88b9('0x72')]){_0x4934e5[_0x88b9('0x27')][_0x88b9('0x73')]=util[_0x88b9('0x5b')](_0x88b9('0x74'),_0x2c5cd8[_0x88b9('0x5e')][_0x88b9('0x37')]);_0x4934e5[_0x88b9('0x27')][_0x88b9('0x75')]=_0x4934e5['channel'];_0x4934e5['message']['motionChannel']=_0x4934e5['channel'];_0x4934e5[_0x88b9('0x27')][_0x88b9('0x76')]=_0x88b9('0x57');return respondWithRpcPromise(_0x88b9('0x77'),_0x88b9('0x77'),{'event':_0x88b9('0x78'),'message':_[_0x88b9('0x49')](_0x4934e5[_0x88b9('0x27')],JSON[_0x88b9('0x79')](_0x4934e5['interaction'][_0x88b9('0x7a')]))},client9002)[_0x88b9('0x1f')](function(){return _0x4934e5;});}return _0x4934e5;}return null;})[_0x88b9('0x1f')](respondWithResult(_0xfee436,null))[_0x88b9('0x2a')](handleError(_0xfee436,null));};var interaction_log=require(_0x88b9('0x15'))(_0x88b9('0x56'));exports[_0x88b9('0x34')]=function(_0x410e83,_0x3d551a,_0x57eb16){var _0x2fc887={'agent':{},'channel':_0x88b9('0x58')};if(_0x410e83['body']['id']){delete _0x410e83[_0x88b9('0x52')]['id'];}_0x410e83['body']['UserId']=_0x410e83[_0x88b9('0x52')][_0x88b9('0x5d')]||_0x410e83[_0x88b9('0x5e')]['id'];_0x2fc887[_0x88b9('0x5f')]['id']=_0x410e83[_0x88b9('0x52')][_0x88b9('0x5d')];return db[_0x88b9('0x3a')][_0x88b9('0x50')]({'where':{'id':_0x410e83['params']['id'],'UserId':null}})[_0x88b9('0x1f')](handleEntityNotFound(_0x3d551a,null))['then'](function(_0x1ae77c){if(_0x1ae77c){_0x2fc887[_0x88b9('0x27')]=_0x1ae77c[_0x88b9('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1ae77c['ChatInteractionId']}});}return null;})[_0x88b9('0x1f')](handleEntityNotFound(_0x3d551a,null))[_0x88b9('0x1f')](function(_0x5411cd){if(_0x5411cd){_0x2fc887[_0x88b9('0x64')]=_0x5411cd[_0x88b9('0x60')]({'plain':!![]});interaction_log[_0x88b9('0x28')](_0x88b9('0x7b'),_0x410e83[_0x88b9('0x5e')]['id'],_0x410e83[_0x88b9('0x5e')][_0x88b9('0x37')],_0x410e83['user'][_0x88b9('0x66')],_0x2fc887[_0x88b9('0x64')]['id'],_0x410e83[_0x88b9('0x52')]?JSON[_0x88b9('0x23')](_0x410e83[_0x88b9('0x52')]):_0x88b9('0x67'));return respondWithRpcPromise(_0x88b9('0x7c'),_0x88b9('0x7d'),_0x2fc887);}return null;})[_0x88b9('0x1f')](function(_0x2c7d18){var _0xf06a07=_0x88b9('0x69')+_0x2c7d18['message'][_0x88b9('0x6a')];return db['sequelize'][_0x88b9('0x3f')](_0xf06a07,{'type':db[_0x88b9('0x7e')][_0x88b9('0x6b')][_0x88b9('0x6c')],'raw':!![]})[_0x88b9('0x1f')](function(_0xe8eae2){return _0xe8eae2;});})['then'](function(_0x13f5d9){if(_0x13f5d9){_0x2fc887[_0x88b9('0x27')][_0x88b9('0x6d')]=_0x13f5d9[0x0];if(!_0x410e83[_0x88b9('0x52')]['UserId'])return;return db[_0x88b9('0x6e')]['find']({'where':{'id':_0x410e83[_0x88b9('0x52')][_0x88b9('0x5d')],'role':_0x88b9('0x5f')},'attributes':['id',_0x88b9('0x37'),'fullname','email',_0x88b9('0x71')],'raw':!![]});}return null;})[_0x88b9('0x1f')](function(_0x2d196){if(!_0x2d196)return null;_0x2fc887[_0x88b9('0x27')][_0x88b9('0x5f')]=_0x2d196;return _0x2fc887;})[_0x88b9('0x1f')](function(_0x4c398e){if(_0x4c398e){_0x4c398e[_0x88b9('0x27')][_0x88b9('0x73')]=util[_0x88b9('0x5b')](_0x88b9('0x74'),_0x410e83[_0x88b9('0x5e')][_0x88b9('0x37')]);_0x4c398e['message'][_0x88b9('0x75')]=_0x2fc887['channel'];_0x4c398e[_0x88b9('0x27')][_0x88b9('0x7f')]=_0x2fc887['channel'];_0x4c398e['message']['event']=_0x88b9('0x34');respondWithRpcPromise('EventManager',_0x88b9('0x77'),{'event':_0x88b9('0x80'),'message':_[_0x88b9('0x49')](_0x2fc887[_0x88b9('0x27')],JSON['parse'](_0x2fc887[_0x88b9('0x64')][_0x88b9('0x7a')]))},client9002);return _0x2fc887;}return null;})[_0x88b9('0x1f')](respondWithResult(_0x3d551a,null))[_0x88b9('0x2a')](handleError(_0x3d551a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d47f49c..f53cf63 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 _0xb03a=['setMaxListeners','save','update','remove','emit','exports','../../mysqldb','ChatMessage'];(function(_0x3e806a,_0xa4b9fa){var _0x477105=function(_0x119821){while(--_0x119821){_0x3e806a['push'](_0x3e806a['shift']());}};_0x477105(++_0xa4b9fa);}(_0xb03a,0xae));var _0xab03=function(_0x4ac904,_0x220b19){_0x4ac904=_0x4ac904-0x0;var _0x342680=_0xb03a[_0x4ac904];return _0x342680;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xab03('0x0'))['db'][_0xab03('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab03('0x2')](0x0);var events={'afterCreate':_0xab03('0x3'),'afterUpdate':_0xab03('0x4'),'afterDestroy':_0xab03('0x5')};function emitEvent(_0x40a8d6){return function(_0x19b437,_0x364174,_0x58c264){ChatMessageEvents[_0xab03('0x6')](_0x40a8d6+':'+_0x19b437['id'],_0x19b437);ChatMessageEvents[_0xab03('0x6')](_0x40a8d6,_0x19b437);_0x58c264(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xab03('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x610a=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','update','emit'];(function(_0x48dad1,_0x4da5b5){var _0x2a0f28=function(_0x38a073){while(--_0x38a073){_0x48dad1['push'](_0x48dad1['shift']());}};_0x2a0f28(++_0x4da5b5);}(_0x610a,0x12f));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa610('0x0'));var ChatMessage=require(_0xa610('0x1'))['db'][_0xa610('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa610('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2504b0){return function(_0x59645a,_0x24e9eb,_0x158f3a){ChatMessageEvents[_0xa610('0x4')](_0x2504b0+':'+_0x59645a['id'],_0x59645a);ChatMessageEvents[_0xa610('0x4')](_0x2504b0,_0x59645a);_0x158f3a(null);};}for(var e in events){if(events[_0xa610('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa610('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 4fb85ac..484ac0b 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 _0x0c10=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0x0c10,0xf0));var _0x00c1=function(_0x5d8084,_0x1947e9){_0x5d8084=_0x5d8084-0x0;var _0x4c0147=_0x0c10[_0x5d8084];return _0x4c0147;};'use strict';var _=require('lodash');var util=require(_0x00c1('0x0'));var logger=require(_0x00c1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x00c1('0x2'));var rp=require(_0x00c1('0x3'));var fs=require('fs');var path=require(_0x00c1('0x4'));var rimraf=require(_0x00c1('0x5'));var config=require(_0x00c1('0x6'));var attributes=require(_0x00c1('0x7'));module[_0x00c1('0x8')]=function(_0x358109,_0x5b3287){return _0x358109[_0x00c1('0x9')](_0x00c1('0xa'),attributes,{'tableName':_0x00c1('0xb'),'paranoid':![],'indexes':[{'name':_0x00c1('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26bdfe,_0x455554,_0x518d82){var _0x3225d7=_0x358109[_0x00c1('0xd')];var _0x51d3d4=_0x26bdfe[_0x00c1('0xe')]({'plain':!![]});if(_0x51d3d4[_0x00c1('0xf')][_0x00c1('0x10')]()==='in'||_0x51d3d4['direction'][_0x00c1('0x10')]()===_0x00c1('0x11')&&!_0x51d3d4[_0x00c1('0x12')]&&!_[_0x00c1('0x13')](_0x51d3d4[_0x00c1('0x14')])){_0x3225d7[_0x00c1('0x15')][_0x00c1('0x16')]({'where':{'id':_0x51d3d4[_0x00c1('0x17')]}})[_0x00c1('0x18')](function(_0x437040){if(_0x437040){_0x437040['update']({'lastMsgAt':_0x51d3d4[_0x00c1('0x19')],'lastMsgDirection':_0x51d3d4[_0x00c1('0xf')][_0x00c1('0x10')]()});}})[_0x00c1('0x1a')](function(_0x24e489){console[_0x00c1('0x1b')](_0x24e489);});}_0x518d82();}},'charset':_0x00c1('0x1c'),'collate':_0x00c1('0x1d')});}; \ No newline at end of file +var _0x3f32=['./chatMessage.attributes','exports','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x152e48,_0x25f775){var _0x30b1a4=function(_0x5dcbf3){while(--_0x5dcbf3){_0x152e48['push'](_0x152e48['shift']());}};_0x30b1a4(++_0x25f775);}(_0x3f32,0x160));var _0x23f3=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x3f32[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x23f3('0x0'));var util=require(_0x23f3('0x1'));var logger=require(_0x23f3('0x2'))('api');var moment=require(_0x23f3('0x3'));var BPromise=require(_0x23f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23f3('0x5'));var rimraf=require(_0x23f3('0x6'));var config=require(_0x23f3('0x7'));var attributes=require(_0x23f3('0x8'));module[_0x23f3('0x9')]=function(_0xdb2c19,_0x20ba9d){return _0xdb2c19[_0x23f3('0xa')](_0x23f3('0xb'),attributes,{'tableName':_0x23f3('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x23f3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x113d8c,_0x2af775,_0x2ca94b){var _0x1111e8=_0xdb2c19[_0x23f3('0xe')];var _0x1fdea5=_0x113d8c[_0x23f3('0xf')]({'plain':!![]});if(_0x1fdea5[_0x23f3('0x10')]['toLowerCase']()==='in'||_0x1fdea5[_0x23f3('0x10')]['toLowerCase']()===_0x23f3('0x11')&&!_0x1fdea5[_0x23f3('0x12')]&&!_['isNil'](_0x1fdea5[_0x23f3('0x13')])){_0x1111e8[_0x23f3('0x14')][_0x23f3('0x15')]({'where':{'id':_0x1fdea5[_0x23f3('0x16')]}})['then'](function(_0x4035c4){if(_0x4035c4){_0x4035c4[_0x23f3('0x17')]({'lastMsgAt':_0x1fdea5[_0x23f3('0x18')],'lastMsgDirection':_0x1fdea5[_0x23f3('0x10')][_0x23f3('0x19')]()});}})[_0x23f3('0x1a')](function(_0x536006){console[_0x23f3('0x1b')](_0x536006);});}_0x2ca94b();}},'charset':_0x23f3('0x1c'),'collate':_0x23f3('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0dd19da..04495d0 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 _0x20e1=['request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','ChatMessage','create','body','options','raw','then','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x20e1,0x9b));var _0x120e=function(_0x4a010b,_0x3523b3){_0x4a010b=_0x4a010b-0x0;var _0xe0b19b=_0x20e1[_0x4a010b];return _0xe0b19b;};'use strict';var _=require(_0x120e('0x0'));var util=require(_0x120e('0x1'));var moment=require(_0x120e('0x2'));var BPromise=require(_0x120e('0x3'));var rs=require(_0x120e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x120e('0x5'));var logger=require(_0x120e('0x6'))(_0x120e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x120e('0x8')][_0x120e('0x9')]({'port':0x232a});config[_0x120e('0xa')]=_[_0x120e('0xb')](config[_0x120e('0xa')],{'host':_0x120e('0xc'),'port':0x18eb});var socket=require(_0x120e('0xd'))(new Redis(config[_0x120e('0xa')]));require('./chatMessage.socket')[_0x120e('0xe')](socket);function respondWithRpcPromise(_0xc50d3,_0x4f59ce,_0x53400c){return new BPromise(function(_0x188a10,_0x27076f){return client[_0x120e('0xf')](_0xc50d3,_0x53400c)['then'](function(_0x3b7560){logger[_0x120e('0x10')]('ChatMessage,\x20%s,\x20%s',_0x4f59ce,_0x120e('0x11'));logger[_0x120e('0x12')](_0x120e('0x13'),_0x4f59ce,_0x120e('0x11'),JSON[_0x120e('0x14')](_0x3b7560));if(_0x3b7560[_0x120e('0x15')]){if(_0x3b7560['error'][_0x120e('0x16')]===0x1f4){logger[_0x120e('0x15')]('ChatMessage,\x20%s,\x20%s',_0x4f59ce,_0x3b7560[_0x120e('0x15')][_0x120e('0x17')]);return _0x27076f(_0x3b7560['error'][_0x120e('0x17')]);}logger[_0x120e('0x15')](_0x120e('0x18'),_0x4f59ce,_0x3b7560['error'][_0x120e('0x17')]);return _0x188a10(_0x3b7560[_0x120e('0x15')][_0x120e('0x17')]);}else{logger[_0x120e('0x10')](_0x120e('0x18'),_0x4f59ce,_0x120e('0x11'));_0x188a10(_0x3b7560[_0x120e('0x19')][_0x120e('0x17')]);}})[_0x120e('0x1a')](function(_0x3fa941){logger[_0x120e('0x15')](_0x120e('0x18'),_0x4f59ce,_0x3fa941);_0x27076f(_0x3fa941);});});}exports['CreateChatMessage']=function(_0x4e2d27){var _0x44233d=this;return new Promise(function(_0x4ae22a,_0x390c5d){return db[_0x120e('0x1b')][_0x120e('0x1c')](_0x4e2d27[_0x120e('0x1d')],{'raw':_0x4e2d27['options']?_0x4e2d27[_0x120e('0x1e')][_0x120e('0x1f')]===undefined?!![]:![]:!![]})[_0x120e('0x20')](function(_0x2cff52){logger['info']('CreateChatMessage',_0x4e2d27);logger[_0x120e('0x12')](_0x120e('0x21'),_0x4e2d27,JSON[_0x120e('0x14')](_0x2cff52));_0x4ae22a(_0x2cff52);})[_0x120e('0x1a')](function(_0x57d5b8){logger[_0x120e('0x15')](_0x120e('0x21'),_0x57d5b8[_0x120e('0x17')],_0x4e2d27);_0x390c5d(_0x44233d[_0x120e('0x15')](0x1f4,_0x57d5b8[_0x120e('0x17')]));});});}; \ No newline at end of file +var _0x8b70=['raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','./chatMessage.socket','register','then','info','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b70,0x1c2));var _0x08b7=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x8b70[_0x81dcac];return _0xc7803b;};'use strict';var _=require(_0x08b7('0x0'));var util=require(_0x08b7('0x1'));var moment=require(_0x08b7('0x2'));var BPromise=require(_0x08b7('0x3'));var rs=require(_0x08b7('0x4'));var fs=require('fs');var Redis=require(_0x08b7('0x5'));var db=require(_0x08b7('0x6'))['db'];var utils=require(_0x08b7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x08b7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x08b7('0x9')]['http']({'port':0x232a});config[_0x08b7('0xa')]=_[_0x08b7('0xb')](config[_0x08b7('0xa')],{'host':_0x08b7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08b7('0xa')]));require(_0x08b7('0xd'))[_0x08b7('0xe')](socket);function respondWithRpcPromise(_0x46553d,_0x2aca8c,_0x470291){return new BPromise(function(_0x3bccaf,_0x31cf24){return client['request'](_0x46553d,_0x470291)[_0x08b7('0xf')](function(_0x305782){logger[_0x08b7('0x10')]('ChatMessage,\x20%s,\x20%s',_0x2aca8c,_0x08b7('0x11'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2aca8c,_0x08b7('0x11'),JSON[_0x08b7('0x12')](_0x305782));if(_0x305782[_0x08b7('0x13')]){if(_0x305782[_0x08b7('0x13')][_0x08b7('0x14')]===0x1f4){logger[_0x08b7('0x13')](_0x08b7('0x15'),_0x2aca8c,_0x305782[_0x08b7('0x13')][_0x08b7('0x16')]);return _0x31cf24(_0x305782[_0x08b7('0x13')][_0x08b7('0x16')]);}logger[_0x08b7('0x13')](_0x08b7('0x15'),_0x2aca8c,_0x305782[_0x08b7('0x13')][_0x08b7('0x16')]);return _0x3bccaf(_0x305782[_0x08b7('0x13')]['message']);}else{logger[_0x08b7('0x10')](_0x08b7('0x15'),_0x2aca8c,_0x08b7('0x11'));_0x3bccaf(_0x305782[_0x08b7('0x17')][_0x08b7('0x16')]);}})[_0x08b7('0x18')](function(_0x52c392){logger[_0x08b7('0x13')](_0x08b7('0x15'),_0x2aca8c,_0x52c392);_0x31cf24(_0x52c392);});});}exports[_0x08b7('0x19')]=function(_0x3ec61b){var _0x3a77b8=this;return new Promise(function(_0x4ded1a,_0x1dd31a){return db[_0x08b7('0x1a')][_0x08b7('0x1b')](_0x3ec61b[_0x08b7('0x1c')],{'raw':_0x3ec61b[_0x08b7('0x1d')]?_0x3ec61b[_0x08b7('0x1d')][_0x08b7('0x1e')]===undefined?!![]:![]:!![]})[_0x08b7('0xf')](function(_0x26c43e){logger['info'](_0x08b7('0x19'),_0x3ec61b);logger[_0x08b7('0x1f')]('CreateChatMessage',_0x3ec61b,JSON[_0x08b7('0x12')](_0x26c43e));_0x4ded1a(_0x26c43e);})['catch'](function(_0x29988f){logger[_0x08b7('0x13')](_0x08b7('0x19'),_0x29988f['message'],_0x3ec61b);_0x1dd31a(_0x3a77b8[_0x08b7('0x13')](0x1f4,_0x29988f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 45f3d8d..a53cd44 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 _0x826a=['update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x378ea6,_0x36818e){var _0x601e23=function(_0x9375db){while(--_0x9375db){_0x378ea6['push'](_0x378ea6['shift']());}};_0x601e23(++_0x36818e);}(_0x826a,0x1aa));var _0xa826=function(_0xbe92e8,_0x336106){_0xbe92e8=_0xbe92e8-0x0;var _0x5d49d1=_0x826a[_0xbe92e8];return _0x5d49d1;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa826('0x0'),'remove',_0xa826('0x1')];function createListener(_0x50c70e,_0x376d53){return function(_0x19ba11){_0x376d53[_0xa826('0x2')](_0x50c70e,_0x19ba11);};}function removeListener(_0x34e1ad,_0x5372ab){return function(){ChatMessageEvents[_0xa826('0x3')](_0x34e1ad,_0x5372ab);};}exports[_0xa826('0x4')]=function(_0x3929d4){for(var _0x34327b=0x0,_0x45154f=events[_0xa826('0x5')];_0x34327b<_0x45154f;_0x34327b++){var _0x4339f9=events[_0x34327b];var _0x14c2ba=createListener(_0xa826('0x6')+_0x4339f9,_0x3929d4);ChatMessageEvents['on'](_0x4339f9,_0x14c2ba);}}; \ No newline at end of file +var _0x5ad3=['register','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x5ad3[_0x152678];return _0x311a9;};'use strict';var ChatMessageEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatMessageEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatMessageEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 48f60dc..c450e8c 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 _0x4906=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','/:id','update','accept','/:id/reject','delete','destroy'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4906,0xbe));var _0x6490=function(_0x3ce300,_0x3cfe99){_0x3ce300=_0x3ce300-0x0;var _0xb2a9f2=_0x4906[_0x3ce300];return _0xb2a9f2;};'use strict';var multer=require(_0x6490('0x0'));var util=require(_0x6490('0x1'));var path=require(_0x6490('0x2'));var timeout=require(_0x6490('0x3'));var express=require('express');var router=express[_0x6490('0x4')]();var fs_extra=require(_0x6490('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6490('0x6'));var config=require('../../config/environment');var controller=require(_0x6490('0x7'));router[_0x6490('0x8')]('/',auth['isAuthenticated'](),controller[_0x6490('0x9')]);router[_0x6490('0x8')](_0x6490('0xa'),auth[_0x6490('0xb')](),controller[_0x6490('0xc')]);router[_0x6490('0x8')]('/:id',auth[_0x6490('0xb')](),controller[_0x6490('0xd')]);router[_0x6490('0xe')]('/',auth[_0x6490('0xb')](),interaction[_0x6490('0xf')](_0x6490('0x10'),_0x6490('0x11')),controller[_0x6490('0x12')]);router[_0x6490('0x13')](_0x6490('0x14'),controller[_0x6490('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x6490('0x16')]);router[_0x6490('0x13')](_0x6490('0x17'),auth[_0x6490('0xb')](),controller['reject']);router[_0x6490('0x18')]('/:id',auth[_0x6490('0xb')](),controller[_0x6490('0x19')]);module[_0x6490('0x1a')]=router; \ No newline at end of file +var _0xce82=['path','connect-timeout','express','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','/describe','/:id','show','chat','chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xce82,0x82));var _0x2ce8=function(_0x26aa3e,_0x2b65d3){_0x26aa3e=_0x26aa3e-0x0;var _0x5a4755=_0xce82[_0x26aa3e];return _0x5a4755;};'use strict';var multer=require(_0x2ce8('0x0'));var util=require(_0x2ce8('0x1'));var path=require(_0x2ce8('0x2'));var timeout=require(_0x2ce8('0x3'));var express=require(_0x2ce8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2ce8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2ce8('0x6'));router[_0x2ce8('0x7')]('/',auth[_0x2ce8('0x8')](),controller['index']);router[_0x2ce8('0x7')](_0x2ce8('0x9'),auth[_0x2ce8('0x8')](),controller['describe']);router[_0x2ce8('0x7')](_0x2ce8('0xa'),auth['isAuthenticated'](),controller[_0x2ce8('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x2ce8('0xc'),_0x2ce8('0xd')),controller[_0x2ce8('0xe')]);router['put'](_0x2ce8('0xa'),controller[_0x2ce8('0xf')]);router[_0x2ce8('0x10')](_0x2ce8('0x11'),auth[_0x2ce8('0x8')](),controller['accept']);router['put'](_0x2ce8('0x12'),auth[_0x2ce8('0x8')](),controller[_0x2ce8('0x13')]);router['delete'](_0x2ce8('0xa'),auth[_0x2ce8('0x8')](),controller[_0x2ce8('0x14')]);module[_0x2ce8('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 13a6ea0..9e1360a 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x4a3650,_0x41569c){var _0x34c712=function(_0x5ee572){while(--_0x5ee572){_0x4a3650['push'](_0x4a3650['shift']());}};_0x34c712(++_0x41569c);}(_0xdb28,0x106));var _0x8db2=function(_0x2a57d1,_0x11c4b1){_0x2a57d1=_0x2a57d1-0x0;var _0x1316b8=_0xdb28[_0x2a57d1];return _0x1316b8;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x4a715c,_0x57165f){var _0x168cfe=function(_0x3ad3ab){while(--_0x3ad3ab){_0x4a715c['push'](_0x4a715c['shift']());}};_0x168cfe(++_0x57165f);}(_0x2032,0xd9));var _0x2203=function(_0x2eaed0,_0x279127){_0x2eaed0=_0x2eaed0-0x0;var _0xa472d0=_0x2032[_0x2eaed0];return _0xa472d0;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 39c65d9..781c755 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(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x7a54,0x106));var _0x47a5=function(_0x2dc55a,_0x517166){_0x2dc55a=_0x2dc55a-0x0;var _0x44fb20=_0x7a54[_0x2dc55a];return _0x44fb20;};'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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x2a3696,_0x4c4c97){_0x2a3696=_0x2a3696-0x0;var _0x345208=_0x7a54[_0x2a3696];return _0x345208;};'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 4ed2bff..166e5c5 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 _0xfd4c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x22f790,_0x14be30){var _0x54a889=function(_0x3f4dbc){while(--_0x3f4dbc){_0x22f790['push'](_0x22f790['shift']());}};_0x54a889(++_0x14be30);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x3115f8,_0x22f2b8){_0x3115f8=_0x3115f8-0x0;var _0x3ac562=_0xfd4c[_0x3115f8];return _0x3ac562;};'use strict';var EventEmitter=require(_0xcfd4('0x0'));var ChatOfflineMessage=require(_0xcfd4('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xcfd4('0x2')](0x0);var events={'afterCreate':_0xcfd4('0x3'),'afterUpdate':_0xcfd4('0x4'),'afterDestroy':_0xcfd4('0x5')};function emitEvent(_0x1b3dc3){return function(_0x4f780c,_0xacc03c,_0x2f7e8b){ChatOfflineMessageEvents[_0xcfd4('0x6')](_0x1b3dc3+':'+_0x4f780c['id'],_0x4f780c);ChatOfflineMessageEvents[_0xcfd4('0x6')](_0x1b3dc3,_0x4f780c);_0x2f7e8b(null);};}for(var e in events){if(events[_0xcfd4('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xcfd4('0x8')](e,emitEvent(event));}}module[_0xcfd4('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7ebb=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x7ebb,0x161));var _0xb7eb=function(_0x5bdb83,_0x3605de){_0x5bdb83=_0x5bdb83-0x0;var _0x1986bb=_0x7ebb[_0x5bdb83];return _0x1986bb;};'use strict';var EventEmitter=require(_0xb7eb('0x0'));var ChatOfflineMessage=require(_0xb7eb('0x1'))['db'][_0xb7eb('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb7eb('0x3')](0x0);var events={'afterCreate':_0xb7eb('0x4'),'afterUpdate':_0xb7eb('0x5'),'afterDestroy':_0xb7eb('0x6')};function emitEvent(_0x544428){return function(_0x2d63cf,_0x2b664d,_0x28a59f){ChatOfflineMessageEvents[_0xb7eb('0x7')](_0x544428+':'+_0x2d63cf['id'],_0x2d63cf);ChatOfflineMessageEvents[_0xb7eb('0x7')](_0x544428,_0x2d63cf);_0x28a59f(null);};}for(var e in events){if(events[_0xb7eb('0x8')](e)){var event=events[e];ChatOfflineMessage[_0xb7eb('0x9')](e,emitEvent(event));}}module[_0xb7eb('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4786160..dee1452 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 _0x5d8a=['./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x558e6f,_0x9f9bf2){var _0x3963d2=function(_0x1ebb10){while(--_0x1ebb10){_0x558e6f['push'](_0x558e6f['shift']());}};_0x3963d2(++_0x9f9bf2);}(_0x5d8a,0x1c7));var _0xa5d8=function(_0x208c3d,_0x98456e){_0x208c3d=_0x208c3d-0x0;var _0x465437=_0x5d8a[_0x208c3d];return _0x465437;};'use strict';var attributes=require(_0xa5d8('0x0'));module[_0xa5d8('0x1')]=function(_0x11d915){return _0x11d915['define']('ChatOfflineMessage',attributes,{'tableName':_0xa5d8('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5d8('0x3'),'collate':_0xa5d8('0x4')});}; \ No newline at end of file +var _0x2968=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0xbf1875,_0x34b144){var _0x2e598b=function(_0xd104ec){while(--_0xd104ec){_0xbf1875['push'](_0xbf1875['shift']());}};_0x2e598b(++_0x34b144);}(_0x2968,0x19e));var _0x8296=function(_0x12b74e,_0x1f0d54){_0x12b74e=_0x12b74e-0x0;var _0x511e55=_0x2968[_0x12b74e];return _0x511e55;};'use strict';var attributes=require(_0x8296('0x0'));module[_0x8296('0x1')]=function(_0x1af581){return _0x1af581[_0x8296('0x2')](_0x8296('0x3'),attributes,{'tableName':_0x8296('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8296('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a5af9f7..fbf2113 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 _0x0d6a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x299c3e,_0x501381){var _0x3ca85f=function(_0x27bb14){while(--_0x27bb14){_0x299c3e['push'](_0x299c3e['shift']());}};_0x3ca85f(++_0x501381);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0d6a[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var moment=require('moment');var BPromise=require(_0xa0d6('0x2'));var rs=require(_0xa0d6('0x3'));var fs=require('fs');var Redis=require(_0xa0d6('0x4'));var db=require(_0xa0d6('0x5'))['db'];var utils=require(_0xa0d6('0x6'));var logger=require(_0xa0d6('0x7'))(_0xa0d6('0x8'));var config=require(_0xa0d6('0x9'));var jayson=require(_0xa0d6('0xa'));var client=jayson[_0xa0d6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14dbe7,_0x382f7f,_0xba6194){return new BPromise(function(_0x11f5f9,_0x228a57){return client['request'](_0x14dbe7,_0xba6194)[_0xa0d6('0xc')](function(_0x54c2bc){logger[_0xa0d6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x382f7f,_0xa0d6('0xe'));logger['debug'](_0xa0d6('0xf'),_0x382f7f,_0xa0d6('0xe'),JSON[_0xa0d6('0x10')](_0x54c2bc));if(_0x54c2bc[_0xa0d6('0x11')]){if(_0x54c2bc[_0xa0d6('0x11')][_0xa0d6('0x12')]===0x1f4){logger['error'](_0xa0d6('0x13'),_0x382f7f,_0x54c2bc[_0xa0d6('0x11')][_0xa0d6('0x14')]);return _0x228a57(_0x54c2bc['error'][_0xa0d6('0x14')]);}logger[_0xa0d6('0x11')](_0xa0d6('0x13'),_0x382f7f,_0x54c2bc[_0xa0d6('0x11')][_0xa0d6('0x14')]);return _0x11f5f9(_0x54c2bc[_0xa0d6('0x11')][_0xa0d6('0x14')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x382f7f,_0xa0d6('0xe'));_0x11f5f9(_0x54c2bc[_0xa0d6('0x15')][_0xa0d6('0x14')]);}})[_0xa0d6('0x16')](function(_0x1e8b82){logger[_0xa0d6('0x11')](_0xa0d6('0x13'),_0x382f7f,_0x1e8b82);_0x228a57(_0x1e8b82);});});} \ No newline at end of file +var _0x6b13=['jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x6b13,0xd0));var _0x36b1=function(_0x3f7982,_0x24c737){_0x3f7982=_0x3f7982-0x0;var _0x4e6a0d=_0x6b13[_0x3f7982];return _0x4e6a0d;};'use strict';var _=require('lodash');var util=require(_0x36b1('0x0'));var moment=require(_0x36b1('0x1'));var BPromise=require(_0x36b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36b1('0x3'));var db=require(_0x36b1('0x4'))['db'];var utils=require(_0x36b1('0x5'));var logger=require(_0x36b1('0x6'))(_0x36b1('0x7'));var config=require('../../config/environment');var jayson=require(_0x36b1('0x8'));var client=jayson[_0x36b1('0x9')][_0x36b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44e7b8,_0x3ff1d7,_0x11a9df){return new BPromise(function(_0x4964ef,_0x44b19b){return client[_0x36b1('0xb')](_0x44e7b8,_0x11a9df)[_0x36b1('0xc')](function(_0x5999fa){logger[_0x36b1('0xd')](_0x36b1('0xe'),_0x3ff1d7,_0x36b1('0xf'));logger[_0x36b1('0x10')](_0x36b1('0x11'),_0x3ff1d7,_0x36b1('0xf'),JSON[_0x36b1('0x12')](_0x5999fa));if(_0x5999fa['error']){if(_0x5999fa[_0x36b1('0x13')][_0x36b1('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3ff1d7,_0x5999fa[_0x36b1('0x13')][_0x36b1('0x15')]);return _0x44b19b(_0x5999fa[_0x36b1('0x13')]['message']);}logger[_0x36b1('0x13')](_0x36b1('0xe'),_0x3ff1d7,_0x5999fa['error']['message']);return _0x4964ef(_0x5999fa['error']['message']);}else{logger[_0x36b1('0xd')](_0x36b1('0xe'),_0x3ff1d7,_0x36b1('0xf'));_0x4964ef(_0x5999fa[_0x36b1('0x16')][_0x36b1('0x15')]);}})[_0x36b1('0x17')](function(_0x5828be){logger[_0x36b1('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3ff1d7,_0x5828be);_0x44b19b(_0x5828be);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7de0c6e..bee6168 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 _0xa90d=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xa90d,0x7f));var _0xda90=function(_0x17ce0b,_0x40fb10){_0x17ce0b=_0x17ce0b-0x0;var _0x1fbef3=_0xa90d[_0x17ce0b];return _0x1fbef3;};'use strict';var multer=require(_0xda90('0x0'));var util=require('util');var path=require(_0xda90('0x1'));var timeout=require(_0xda90('0x2'));var express=require(_0xda90('0x3'));var router=express['Router']();var fs_extra=require(_0xda90('0x4'));var auth=require(_0xda90('0x5'));var interaction=require(_0xda90('0x6'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xda90('0x7')]('/',auth[_0xda90('0x8')](),controller[_0xda90('0x9')]);router['get']('/describe',auth[_0xda90('0x8')](),controller['describe']);router[_0xda90('0x7')](_0xda90('0xa'),auth['isAuthenticated'](),controller[_0xda90('0xb')]);router[_0xda90('0xc')]('/',auth[_0xda90('0x8')](),controller[_0xda90('0xd')]);router[_0xda90('0xe')](_0xda90('0xa'),auth['isAuthenticated'](),controller[_0xda90('0xf')]);router[_0xda90('0x10')](_0xda90('0xa'),auth[_0xda90('0x8')](),controller[_0xda90('0x11')]);module[_0xda90('0x12')]=router; \ No newline at end of file +var _0x6831=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','describe','get','/:id','post','put','update','delete'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6831,0x92));var _0x1683=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6831[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1683('0x0'));var timeout=require('connect-timeout');var express=require(_0x1683('0x1'));var router=express[_0x1683('0x2')]();var fs_extra=require(_0x1683('0x3'));var auth=require(_0x1683('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1683('0x5'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x1683('0x6')](),controller['index']);router['get']('/describe',auth[_0x1683('0x6')](),controller[_0x1683('0x7')]);router[_0x1683('0x8')](_0x1683('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1683('0xa')]('/',auth[_0x1683('0x6')](),controller['create']);router[_0x1683('0xb')]('/:id',auth[_0x1683('0x6')](),controller[_0x1683('0xc')]);router[_0x1683('0xd')]('/:id',auth[_0x1683('0x6')](),controller[_0x1683('0xe')]);module[_0x1683('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1f5a899..d0ef845 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 _0x4efd=['timeout','sequelize','ENUM','mouseOver'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x4efd,0xbd));var _0xd4ef=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x4efd[_0xe8129c];return _0x709fc5;};'use strict';var Sequelize=require(_0xd4ef('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd4ef('0x1')](_0xd4ef('0x2'),_0xd4ef('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x33a3=['INTEGER','sequelize','STRING','mouseOver'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x33a3,0x9d));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x333a('0x0'));module['exports']={'name':{'type':Sequelize[_0x333a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0x333a('0x2')},'selector':{'type':Sequelize[_0x333a('0x1')]},'timeout':{'type':Sequelize[_0x333a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8bc7975..a4ec0be 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 _0x861a=['../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','filters','intersection','query','fields','attributes','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x798923,_0x3f3fd4){var _0x5b8cc3=function(_0x2aa105){while(--_0x2aa105){_0x798923['push'](_0x798923['shift']());}};_0x5b8cc3(++_0x3f3fd4);}(_0x861a,0x194));var _0xa861=function(_0x419065,_0x18ee93){_0x419065=_0x419065-0x0;var _0x4ef044=_0x861a[_0x419065];return _0x4ef044;};'use strict';var emlformat=require(_0xa861('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa861('0x1'));var jsonpatch=require(_0xa861('0x2'));var rp=require(_0xa861('0x3'));var moment=require(_0xa861('0x4'));var BPromise=require(_0xa861('0x5'));var Mustache=require(_0xa861('0x6'));var util=require('util');var path=require(_0xa861('0x7'));var sox=require(_0xa861('0x8'));var csv=require(_0xa861('0x9'));var ejs=require(_0xa861('0xa'));var fs=require('fs');var fs_extra=require(_0xa861('0xb'));var _=require('lodash');var squel=require(_0xa861('0xc'));var crypto=require(_0xa861('0xd'));var jsforce=require(_0xa861('0xe'));var deskjs=require(_0xa861('0xf'));var toCsv=require(_0xa861('0x9'));var querystring=require(_0xa861('0x10'));var Papa=require(_0xa861('0x11'));var Redis=require(_0xa861('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa861('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa861('0x14'));var utils=require(_0xa861('0x15'));var config=require(_0xa861('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa861('0x17'))['db'];function respondWithStatusCode(_0xf01095,_0x44c425){_0x44c425=_0x44c425||0xcc;return function(_0x35f59b){if(_0x35f59b){return _0xf01095[_0xa861('0x18')](_0x44c425);}return _0xf01095['status'](_0x44c425)['end']();};}function respondWithResult(_0x8b05bd,_0x4df9aa){_0x4df9aa=_0x4df9aa||0xc8;return function(_0x4a7f27){if(_0x4a7f27){return _0x8b05bd[_0xa861('0x19')](_0x4df9aa)[_0xa861('0x1a')](_0x4a7f27);}};}function respondWithFilteredResult(_0x405e23,_0xb5ce78){return function(_0x4792d3){if(_0x4792d3){var _0x2e69c1=typeof _0xb5ce78['offset']==='undefined'&&typeof _0xb5ce78[_0xa861('0x1b')]===_0xa861('0x1c');var _0x18c897=_0x4792d3['count'];var _0xc85eb3=_0x2e69c1?0x0:_0xb5ce78[_0xa861('0x1d')];var _0x2cbdae=_0x2e69c1?_0x4792d3[_0xa861('0x1e')]:_0xb5ce78[_0xa861('0x1d')]+_0xb5ce78['limit'];var _0x20e465;if(_0x2cbdae>=_0x18c897){_0x2cbdae=_0x18c897;_0x20e465=0xc8;}else{_0x20e465=0xce;}_0x405e23[_0xa861('0x19')](_0x20e465);return _0x405e23[_0xa861('0x1f')](_0xa861('0x20'),_0xc85eb3+'-'+_0x2cbdae+'/'+_0x18c897)[_0xa861('0x1a')](_0x4792d3);}return null;};}function patchUpdates(_0x52ca65){return function(_0x398e49){try{jsonpatch[_0xa861('0x21')](_0x398e49,_0x52ca65,!![]);}catch(_0x2437ad){return BPromise['reject'](_0x2437ad);}return _0x398e49[_0xa861('0x22')]();};}function saveUpdates(_0x353299,_0x58270d){return function(_0x24e305){if(_0x24e305){return _0x24e305[_0xa861('0x23')](_0x353299)[_0xa861('0x24')](function(_0x53d561){return _0x53d561;});}return null;};}function removeEntity(_0x3fd022,_0x225d1f){return function(_0x59bc73){if(_0x59bc73){return _0x59bc73[_0xa861('0x25')]()[_0xa861('0x24')](function(){_0x3fd022['status'](0xcc)[_0xa861('0x26')]();});}};}function handleEntityNotFound(_0x133c81,_0x1653a1){return function(_0x598b72){if(!_0x598b72){_0x133c81[_0xa861('0x18')](0x194);}return _0x598b72;};}function handleError(_0x358915,_0x364589){_0x364589=_0x364589||0x1f4;return function(_0x2176d3){logger[_0xa861('0x27')](_0x2176d3[_0xa861('0x28')]);if(_0x2176d3[_0xa861('0x29')]){delete _0x2176d3['name'];}_0x358915[_0xa861('0x19')](_0x364589)[_0xa861('0x2a')](_0x2176d3);};}exports[_0xa861('0x2b')]=function(_0x58a58c,_0x332f41){var _0x27d3fd={'raw':!![],'where':{'id':_0x58a58c[_0xa861('0x2c')]['id']}},_0x332fad={};_0x332fad[_0xa861('0x2d')]=_[_0xa861('0x2e')](db['ChatProactiveAction']['rawAttributes']);_0x332fad['query']=_[_0xa861('0x2e')](_0x58a58c['query']);_0x332fad[_0xa861('0x2f')]=_[_0xa861('0x30')](_0x332fad[_0xa861('0x2d')],_0x332fad[_0xa861('0x31')]);_0x27d3fd['attributes']=_[_0xa861('0x30')](_0x332fad[_0xa861('0x2d')],qs[_0xa861('0x32')](_0x58a58c[_0xa861('0x31')]['fields']));_0x27d3fd[_0xa861('0x33')]=_0x27d3fd['attributes'][_0xa861('0x34')]?_0x27d3fd[_0xa861('0x33')]:_0x332fad[_0xa861('0x2d')];if(_0x58a58c[_0xa861('0x31')][_0xa861('0x35')]){_0x27d3fd[_0xa861('0x36')]=[{'all':!![]}];}_0x27d3fd=_['merge']({},_0x27d3fd,_0x58a58c[_0xa861('0x37')]);return db[_0xa861('0x38')][_0xa861('0x39')](_0x27d3fd)[_0xa861('0x24')](handleEntityNotFound(_0x332f41,null))[_0xa861('0x24')](respondWithResult(_0x332f41,null))[_0xa861('0x3a')](handleError(_0x332f41,null));};exports[_0xa861('0x3b')]=function(_0xe49c5d,_0x23fd41){return db[_0xa861('0x38')][_0xa861('0x3b')](_0xe49c5d[_0xa861('0x3c')],{})[_0xa861('0x24')](respondWithResult(_0x23fd41,0xc9))[_0xa861('0x3a')](handleError(_0x23fd41,null));};exports[_0xa861('0x23')]=function(_0x1416c1,_0xd8b83e){if(_0x1416c1[_0xa861('0x3c')]['id']){delete _0x1416c1[_0xa861('0x3c')]['id'];}return db['ChatProactiveAction'][_0xa861('0x39')]({'where':{'id':_0x1416c1[_0xa861('0x2c')]['id']}})['then'](handleEntityNotFound(_0xd8b83e,null))[_0xa861('0x24')](saveUpdates(_0x1416c1[_0xa861('0x3c')],null))[_0xa861('0x24')](respondWithResult(_0xd8b83e,null))[_0xa861('0x3a')](handleError(_0xd8b83e,null));};exports[_0xa861('0x25')]=function(_0x4ca347,_0x32d495){return db[_0xa861('0x38')][_0xa861('0x39')]({'where':{'id':_0x4ca347[_0xa861('0x2c')]['id']}})['then'](handleEntityNotFound(_0x32d495,null))[_0xa861('0x24')](removeEntity(_0x32d495,null))[_0xa861('0x3a')](handleError(_0x32d495,null));}; \ No newline at end of file +var _0xa1f6=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv'];(function(_0x5da75a,_0x588bc4){var _0x3a5efe=function(_0x275328){while(--_0x275328){_0x5da75a['push'](_0x5da75a['shift']());}};_0x3a5efe(++_0x588bc4);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xa1f6[_0x261522];return _0x98a25a;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require(_0x6a1f('0x2'));var jsonpatch=require(_0x6a1f('0x3'));var rp=require(_0x6a1f('0x4'));var moment=require(_0x6a1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a1f('0x6'));var ejs=require(_0x6a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x8'));var _=require(_0x6a1f('0x9'));var squel=require(_0x6a1f('0xa'));var crypto=require(_0x6a1f('0xb'));var jsforce=require(_0x6a1f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a1f('0x6'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a1f('0x11'));var hardwareService=require(_0x6a1f('0x12'));var logger=require(_0x6a1f('0x13'))(_0x6a1f('0x14'));var utils=require('../../config/utils');var config=require(_0x6a1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1f('0x16'))['db'];function respondWithStatusCode(_0x17edb6,_0x2a4e94){_0x2a4e94=_0x2a4e94||0xcc;return function(_0x442576){if(_0x442576){return _0x17edb6[_0x6a1f('0x17')](_0x2a4e94);}return _0x17edb6[_0x6a1f('0x18')](_0x2a4e94)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8c3a36,_0x1918c6){_0x1918c6=_0x1918c6||0xc8;return function(_0x27d8f8){if(_0x27d8f8){return _0x8c3a36[_0x6a1f('0x18')](_0x1918c6)[_0x6a1f('0x1a')](_0x27d8f8);}};}function respondWithFilteredResult(_0x253305,_0x2677c1){return function(_0x14ecec){if(_0x14ecec){var _0x11ee0e=typeof _0x2677c1[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x2677c1[_0x6a1f('0x1d')]==='undefined';var _0x392ccb=_0x14ecec[_0x6a1f('0x1e')];var _0x1ccbed=_0x11ee0e?0x0:_0x2677c1[_0x6a1f('0x1b')];var _0x21d268=_0x11ee0e?_0x14ecec[_0x6a1f('0x1e')]:_0x2677c1[_0x6a1f('0x1b')]+_0x2677c1[_0x6a1f('0x1d')];var _0x5cb044;if(_0x21d268>=_0x392ccb){_0x21d268=_0x392ccb;_0x5cb044=0xc8;}else{_0x5cb044=0xce;}_0x253305[_0x6a1f('0x18')](_0x5cb044);return _0x253305['set'](_0x6a1f('0x1f'),_0x1ccbed+'-'+_0x21d268+'/'+_0x392ccb)[_0x6a1f('0x1a')](_0x14ecec);}return null;};}function patchUpdates(_0x3c7ed0){return function(_0x1b5856){try{jsonpatch[_0x6a1f('0x20')](_0x1b5856,_0x3c7ed0,!![]);}catch(_0x4eae7f){return BPromise[_0x6a1f('0x21')](_0x4eae7f);}return _0x1b5856[_0x6a1f('0x22')]();};}function saveUpdates(_0xa43cd5,_0x1be0c3){return function(_0x312e75){if(_0x312e75){return _0x312e75[_0x6a1f('0x23')](_0xa43cd5)[_0x6a1f('0x24')](function(_0x2736ab){return _0x2736ab;});}return null;};}function removeEntity(_0x53229b,_0x1eb146){return function(_0x3d953d){if(_0x3d953d){return _0x3d953d['destroy']()['then'](function(){_0x53229b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea158,_0x5e6013){return function(_0x5abe40){if(!_0x5abe40){_0x3ea158[_0x6a1f('0x17')](0x194);}return _0x5abe40;};}function handleError(_0x286d1d,_0x2b53ca){_0x2b53ca=_0x2b53ca||0x1f4;return function(_0x1e8db8){logger[_0x6a1f('0x25')](_0x1e8db8[_0x6a1f('0x26')]);if(_0x1e8db8[_0x6a1f('0x27')]){delete _0x1e8db8[_0x6a1f('0x27')];}_0x286d1d['status'](_0x2b53ca)[_0x6a1f('0x28')](_0x1e8db8);};}exports[_0x6a1f('0x29')]=function(_0x3f0730,_0x574d80){var _0x1e951c={'raw':!![],'where':{'id':_0x3f0730[_0x6a1f('0x2a')]['id']}},_0x155c58={};_0x155c58[_0x6a1f('0x2b')]=_[_0x6a1f('0x2c')](db[_0x6a1f('0x2d')][_0x6a1f('0x2e')]);_0x155c58['query']=_['keys'](_0x3f0730[_0x6a1f('0x2f')]);_0x155c58[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x155c58[_0x6a1f('0x2b')],_0x155c58[_0x6a1f('0x2f')]);_0x1e951c[_0x6a1f('0x32')]=_[_0x6a1f('0x31')](_0x155c58['model'],qs[_0x6a1f('0x33')](_0x3f0730[_0x6a1f('0x2f')]['fields']));_0x1e951c[_0x6a1f('0x32')]=_0x1e951c[_0x6a1f('0x32')][_0x6a1f('0x34')]?_0x1e951c['attributes']:_0x155c58['model'];if(_0x3f0730[_0x6a1f('0x2f')][_0x6a1f('0x35')]){_0x1e951c[_0x6a1f('0x36')]=[{'all':!![]}];}_0x1e951c=_['merge']({},_0x1e951c,_0x3f0730['options']);return db[_0x6a1f('0x2d')][_0x6a1f('0x37')](_0x1e951c)[_0x6a1f('0x24')](handleEntityNotFound(_0x574d80,null))[_0x6a1f('0x24')](respondWithResult(_0x574d80,null))[_0x6a1f('0x38')](handleError(_0x574d80,null));};exports[_0x6a1f('0x39')]=function(_0x1ac8cf,_0x5dfc6f){return db[_0x6a1f('0x2d')]['create'](_0x1ac8cf[_0x6a1f('0x3a')],{})[_0x6a1f('0x24')](respondWithResult(_0x5dfc6f,0xc9))['catch'](handleError(_0x5dfc6f,null));};exports[_0x6a1f('0x23')]=function(_0x72ec84,_0x49065f){if(_0x72ec84[_0x6a1f('0x3a')]['id']){delete _0x72ec84['body']['id'];}return db[_0x6a1f('0x2d')]['find']({'where':{'id':_0x72ec84[_0x6a1f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x49065f,null))[_0x6a1f('0x24')](saveUpdates(_0x72ec84[_0x6a1f('0x3a')],null))['then'](respondWithResult(_0x49065f,null))[_0x6a1f('0x38')](handleError(_0x49065f,null));};exports[_0x6a1f('0x3b')]=function(_0x5ec8cb,_0x5beb28){return db[_0x6a1f('0x2d')][_0x6a1f('0x37')]({'where':{'id':_0x5ec8cb[_0x6a1f('0x2a')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x5beb28,null))[_0x6a1f('0x24')](removeEntity(_0x5beb28,null))[_0x6a1f('0x38')](handleError(_0x5beb28,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 92a6b0a..dcd35dd 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 _0xacf2=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xacf2,0xcc));var _0x2acf=function(_0x3c2efd,_0x405f28){_0x3c2efd=_0x3c2efd-0x0;var _0x433b01=_0xacf2[_0x3c2efd];return _0x433b01;};'use strict';var _=require(_0x2acf('0x0'));var util=require(_0x2acf('0x1'));var logger=require(_0x2acf('0x2'))(_0x2acf('0x3'));var moment=require(_0x2acf('0x4'));var BPromise=require(_0x2acf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2acf('0x6'));var rimraf=require('rimraf');var config=require(_0x2acf('0x7'));var attributes=require(_0x2acf('0x8'));module[_0x2acf('0x9')]=function(_0x2bab77,_0x20b6c9){return _0x2bab77['define'](_0x2acf('0xa'),attributes,{'tableName':_0x2acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9404=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5e21c1,_0x40d43a){var _0x5cb6f1=function(_0x58cec0){while(--_0x58cec0){_0x5e21c1['push'](_0x5e21c1['shift']());}};_0x5cb6f1(++_0x40d43a);}(_0x9404,0xd9));var _0x4940=function(_0x4575e1,_0x9a3579){_0x4575e1=_0x4575e1-0x0;var _0xb478e1=_0x9404[_0x4575e1];return _0xb478e1;};'use strict';var _=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var logger=require(_0x4940('0x2'))(_0x4940('0x3'));var moment=require(_0x4940('0x4'));var BPromise=require(_0x4940('0x5'));var rp=require(_0x4940('0x6'));var fs=require('fs');var path=require(_0x4940('0x7'));var rimraf=require(_0x4940('0x8'));var config=require(_0x4940('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0x4940('0xa')]=function(_0x549370,_0x14e0c1){return _0x549370['define']('ChatProactiveAction',attributes,{'tableName':_0x4940('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 50a07aa..e12ab0f 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 _0x8eb8=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','error','code','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x2e4481,_0xd520da){var _0x2d29c9=function(_0x1012aa){while(--_0x1012aa){_0x2e4481['push'](_0x2e4481['shift']());}};_0x2d29c9(++_0xd520da);}(_0x8eb8,0xc9));var _0x88eb=function(_0x32fc67,_0x8b24e6){_0x32fc67=_0x32fc67-0x0;var _0xca5341=_0x8eb8[_0x32fc67];return _0xca5341;};'use strict';var _=require(_0x88eb('0x0'));var util=require(_0x88eb('0x1'));var moment=require(_0x88eb('0x2'));var BPromise=require(_0x88eb('0x3'));var rs=require(_0x88eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x88eb('0x5'))('rpc');var config=require(_0x88eb('0x6'));var jayson=require(_0x88eb('0x7'));var client=jayson[_0x88eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84659f,_0x1ad8ce,_0x3e52e7){return new BPromise(function(_0x1025f7,_0x4784b1){return client[_0x88eb('0x9')](_0x84659f,_0x3e52e7)['then'](function(_0x2fc1df){logger[_0x88eb('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x1ad8ce,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1ad8ce,_0x88eb('0xb'),JSON['stringify'](_0x2fc1df));if(_0x2fc1df[_0x88eb('0xc')]){if(_0x2fc1df[_0x88eb('0xc')][_0x88eb('0xd')]===0x1f4){logger[_0x88eb('0xc')](_0x88eb('0xe'),_0x1ad8ce,_0x2fc1df[_0x88eb('0xc')][_0x88eb('0xf')]);return _0x4784b1(_0x2fc1df[_0x88eb('0xc')][_0x88eb('0xf')]);}logger[_0x88eb('0xc')](_0x88eb('0xe'),_0x1ad8ce,_0x2fc1df[_0x88eb('0xc')]['message']);return _0x1025f7(_0x2fc1df[_0x88eb('0xc')][_0x88eb('0xf')]);}else{logger['info'](_0x88eb('0xe'),_0x1ad8ce,'request\x20sent');_0x1025f7(_0x2fc1df[_0x88eb('0x10')][_0x88eb('0xf')]);}})[_0x88eb('0x11')](function(_0x13e0c0){logger[_0x88eb('0xc')](_0x88eb('0xe'),_0x1ad8ce,_0x13e0c0);_0x4784b1(_0x13e0c0);});});} \ No newline at end of file +var _0xce3f=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xce3f,0x170));var _0xfce3=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xce3f[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xfce3('0x0'));var util=require(_0xfce3('0x1'));var moment=require(_0xfce3('0x2'));var BPromise=require('bluebird');var rs=require(_0xfce3('0x3'));var fs=require('fs');var Redis=require(_0xfce3('0x4'));var db=require(_0xfce3('0x5'))['db'];var utils=require(_0xfce3('0x6'));var logger=require(_0xfce3('0x7'))('rpc');var config=require(_0xfce3('0x8'));var jayson=require(_0xfce3('0x9'));var client=jayson[_0xfce3('0xa')][_0xfce3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da248,_0x25edba,_0x51da69){return new BPromise(function(_0xa9a368,_0x58baac){return client[_0xfce3('0xc')](_0x2da248,_0x51da69)[_0xfce3('0xd')](function(_0x5cf7b2){logger['info'](_0xfce3('0xe'),_0x25edba,_0xfce3('0xf'));logger['debug'](_0xfce3('0x10'),_0x25edba,'request\x20sent',JSON[_0xfce3('0x11')](_0x5cf7b2));if(_0x5cf7b2[_0xfce3('0x12')]){if(_0x5cf7b2[_0xfce3('0x12')][_0xfce3('0x13')]===0x1f4){logger[_0xfce3('0x12')](_0xfce3('0xe'),_0x25edba,_0x5cf7b2[_0xfce3('0x12')][_0xfce3('0x14')]);return _0x58baac(_0x5cf7b2[_0xfce3('0x12')][_0xfce3('0x14')]);}logger[_0xfce3('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x25edba,_0x5cf7b2[_0xfce3('0x12')][_0xfce3('0x14')]);return _0xa9a368(_0x5cf7b2[_0xfce3('0x12')][_0xfce3('0x14')]);}else{logger[_0xfce3('0x15')](_0xfce3('0xe'),_0x25edba,_0xfce3('0xf'));_0xa9a368(_0x5cf7b2[_0xfce3('0x16')]['message']);}})[_0xfce3('0x17')](function(_0x480e9e){logger[_0xfce3('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x25edba,_0x480e9e);_0x58baac(_0x480e9e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 36f5aa5..be9b53c 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 _0xdc97=['get','/:id','show','create','put','isAuthenticated','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x40adf9,_0x4157de){var _0x51b1ec=function(_0x4acf19){while(--_0x4acf19){_0x40adf9['push'](_0x40adf9['shift']());}};_0x51b1ec(++_0x4157de);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1c996e,_0x2933f4){_0x1c996e=_0x1c996e-0x0;var _0x567c6b=_0xdc97[_0x1c996e];return _0x567c6b;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')](_0x7dc9('0x9'),auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7dc9('0xb')]);router[_0x7dc9('0xc')](_0x7dc9('0x9'),auth[_0x7dc9('0xd')](),controller[_0x7dc9('0xe')]);router['delete'](_0x7dc9('0x9'),auth[_0x7dc9('0xd')](),controller[_0x7dc9('0xf')]);module[_0x7dc9('0x10')]=router; \ No newline at end of file +var _0x425d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x425d,0x1e0));var _0xd425=function(_0x495707,_0x2d72eb){_0x495707=_0x495707-0x0;var _0x269dc4=_0x425d[_0x495707];return _0x269dc4;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0xc')]);router[_0xd425('0xd')]('/',auth['isAuthenticated'](),controller[_0xd425('0xe')]);router[_0xd425('0xf')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x10')]);router[_0xd425('0x11')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x12')]);module[_0xd425('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 515bdea..d3aff01 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 _0xafb1=['roundrobin','sequelize','name','STRING','rrmemory'];(function(_0x47c0a5,_0x21fb53){var _0x50878c=function(_0xa930){while(--_0xa930){_0x47c0a5['push'](_0x47c0a5['shift']());}};_0x50878c(++_0x21fb53);}(_0xafb1,0x1cd));var _0x1afb=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xafb1[_0x10d670];return _0x20d6f8;};'use strict';var Sequelize=require(_0x1afb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1afb('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1afb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1afb('0x3'),'beepall',_0x1afb('0x4'))}}; \ No newline at end of file +var _0xdee6=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2e2b00,_0x167bad){var _0x28b207=function(_0x10aa97){while(--_0x10aa97){_0x2e2b00['push'](_0x2e2b00['shift']());}};_0x28b207(++_0x167bad);}(_0xdee6,0xf1));var _0x6dee=function(_0x3dff97,_0x171b0b){_0x3dff97=_0x3dff97-0x0;var _0x17708f=_0xdee6[_0x3dff97];return _0x17708f;};'use strict';var Sequelize=require(_0x6dee('0x0'));module[_0x6dee('0x1')]={'name':{'type':Sequelize[_0x6dee('0x2')],'unique':_0x6dee('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6dee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6dee('0x5')](_0x6dee('0x6'),_0x6dee('0x7'),_0x6dee('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c1209e4..e5d182d 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 _0x7cd2=['%s/%s','getTeams','Team','order','sort','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','select','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','value','removeTeams','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','nolimit','bluebird','util','ioredis','../../components/parsers/qs','api','defaults','redis','localhost','./chatQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','name','send','index','map','type','key','getOptions','where','ChatQueue','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format'];(function(_0x34ecb6,_0x5ee425){var _0xce47f7=function(_0x40818a){while(--_0x40818a){_0x34ecb6['push'](_0x34ecb6['shift']());}};_0xce47f7(++_0x5ee425);}(_0x7cd2,0x107));var _0x27cd=function(_0x34ef0c,_0x354b30){_0x34ef0c=_0x34ef0c-0x0;var _0x21e732=_0x7cd2[_0x34ef0c];return _0x21e732;};'use strict';var BPromise=require(_0x27cd('0x0'));var util=require(_0x27cd('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x27cd('0x2'));var qs=require(_0x27cd('0x3'));var logger=require('../../config/logger')(_0x27cd('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x27cd('0x5')](config[_0x27cd('0x6')],{'host':_0x27cd('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27cd('0x6')]));require(_0x27cd('0x8'))[_0x27cd('0x9')](socket);function respondWithStatusCode(_0x46f4ce,_0x1a4ae2){_0x1a4ae2=_0x1a4ae2||0xcc;return function(_0x309829){if(_0x309829){return _0x46f4ce['sendStatus'](_0x1a4ae2);}return _0x46f4ce[_0x27cd('0xa')](_0x1a4ae2)[_0x27cd('0xb')]();};}function respondWithResult(_0x2266cc,_0x18c9cd){_0x18c9cd=_0x18c9cd||0xc8;return function(_0x5a5825){if(_0x5a5825){return _0x2266cc[_0x27cd('0xa')](_0x18c9cd)[_0x27cd('0xc')](_0x5a5825);}};}function respondWithFilteredResult(_0x47b440,_0x56ac75){return function(_0x567369){if(_0x567369){var _0x4b140e=typeof _0x56ac75[_0x27cd('0xd')]===_0x27cd('0xe')&&typeof _0x56ac75[_0x27cd('0xf')]===_0x27cd('0xe');var _0x51a7df=_0x567369[_0x27cd('0x10')];var _0x4e20b5=_0x4b140e?0x0:_0x56ac75[_0x27cd('0xd')];var _0xfc507c=_0x4b140e?_0x567369[_0x27cd('0x10')]:_0x56ac75['offset']+_0x56ac75[_0x27cd('0xf')];var _0x3d23c8;if(_0xfc507c>=_0x51a7df){_0xfc507c=_0x51a7df;_0x3d23c8=0xc8;}else{_0x3d23c8=0xce;}_0x47b440[_0x27cd('0xa')](_0x3d23c8);return _0x47b440[_0x27cd('0x11')](_0x27cd('0x12'),_0x4e20b5+'-'+_0xfc507c+'/'+_0x51a7df)[_0x27cd('0xc')](_0x567369);}return null;};}function saveUpdates(_0x52af15){return function(_0x5b3d13){if(_0x5b3d13){return _0x5b3d13[_0x27cd('0x13')](_0x52af15)[_0x27cd('0x14')](function(_0x362703){return _0x362703;});}return null;};}function removeEntity(_0x13c0ef){return function(_0x4560c3){if(_0x4560c3){return _0x4560c3[_0x27cd('0x15')]()[_0x27cd('0x14')](function(){var _0x443133=_0x4560c3[_0x27cd('0x16')]({'plain':!![]});var _0xd6b861=_0x27cd('0x17');return db[_0x27cd('0x18')][_0x27cd('0x15')]({'where':{'type':_0xd6b861,'resourceId':_0x443133['id']}})[_0x27cd('0x14')](function(){return _0x4560c3;});})[_0x27cd('0x14')](function(){_0x13c0ef['status'](0xcc)[_0x27cd('0xb')]();});}};}function handleEntityNotFound(_0x4f3703){return function(_0x2e9543){if(!_0x2e9543){_0x4f3703['sendStatus'](0x194);}return _0x2e9543;};}function handleError(_0x5c0e77,_0x1f41cb){_0x1f41cb=_0x1f41cb||0x1f4;return function(_0x10c58d){logger['error'](_0x10c58d['stack']);if(_0x10c58d[_0x27cd('0x19')]){delete _0x10c58d[_0x27cd('0x19')];}_0x5c0e77[_0x27cd('0xa')](_0x1f41cb)[_0x27cd('0x1a')](_0x10c58d);};}exports[_0x27cd('0x1b')]=function(_0x56be21,_0x4bc0b2){var _0x9193de={};var _0x121bd4={'count':0x0,'rows':[]};var _0x30afbb=_[_0x27cd('0x1c')](db['ChatQueue']['rawAttributes'],function(_0x2f4c12){return{'name':_0x2f4c12['fieldName'],'type':_0x2f4c12[_0x27cd('0x1d')][_0x27cd('0x1e')]};});_0x9193de=qs[_0x27cd('0x1f')](_0x30afbb,_0x56be21);var _0x1be40b={'where':_0x9193de[_0x27cd('0x20')]};return db[_0x27cd('0x21')][_0x27cd('0x10')](_0x1be40b)[_0x27cd('0x14')](function(_0x165a6f){_0x121bd4[_0x27cd('0x10')]=_0x165a6f;_0x9193de[_0x27cd('0x22')]=qs[_0x27cd('0x22')](_0x56be21[_0x27cd('0x23')]);return db[_0x27cd('0x21')][_0x27cd('0x24')](_0x9193de);})[_0x27cd('0x14')](function(_0x2ca4ae){_0x121bd4[_0x27cd('0x25')]=_0x2ca4ae;return _0x121bd4;})[_0x27cd('0x14')](respondWithFilteredResult(_0x4bc0b2,_0x9193de))[_0x27cd('0x26')](handleError(_0x4bc0b2,null));};exports[_0x27cd('0x27')]=function(_0x1bbeea,_0x24ae00){var _0x5d267b={'raw':!![],'where':{'id':_0x1bbeea[_0x27cd('0x28')]['id']}},_0x4d576b={};_0x4d576b[_0x27cd('0x29')]=_[_0x27cd('0x2a')](db['ChatQueue'][_0x27cd('0x2b')]);_0x4d576b[_0x27cd('0x23')]=_[_0x27cd('0x2a')](_0x1bbeea[_0x27cd('0x23')]);_0x4d576b[_0x27cd('0x2c')]=_['intersection'](_0x4d576b[_0x27cd('0x29')],_0x4d576b[_0x27cd('0x23')]);_0x5d267b[_0x27cd('0x2d')]=_[_0x27cd('0x2e')](_0x4d576b[_0x27cd('0x29')],qs[_0x27cd('0x2f')](_0x1bbeea[_0x27cd('0x23')]['fields']));_0x5d267b[_0x27cd('0x2d')]=_0x5d267b[_0x27cd('0x2d')][_0x27cd('0x30')]?_0x5d267b[_0x27cd('0x2d')]:_0x4d576b[_0x27cd('0x29')];if(_0x1bbeea['query']['includeAll']){_0x5d267b[_0x27cd('0x22')]=[{'all':!![]}];}_0x5d267b=_[_0x27cd('0x31')]({},_0x5d267b,_0x1bbeea[_0x27cd('0x32')]);return db['ChatQueue'][_0x27cd('0x33')](_0x5d267b)[_0x27cd('0x14')](handleEntityNotFound(_0x24ae00,null))[_0x27cd('0x14')](respondWithResult(_0x24ae00,null))[_0x27cd('0x26')](handleError(_0x24ae00,null));};exports['create']=function(_0x5247a7,_0x4e8432){return db[_0x27cd('0x21')]['create'](_0x5247a7[_0x27cd('0x34')],{})[_0x27cd('0x14')](function(_0x37d6fd){var _0x22fe16=_0x5247a7[_0x27cd('0x35')]['get']({'plain':!![]});if(!_0x22fe16)throw new Error(_0x27cd('0x36'));if(_0x22fe16[_0x27cd('0x37')]===_0x27cd('0x35')){var _0x5058ae=_0x37d6fd[_0x27cd('0x16')]({'plain':!![]});var _0x21c491='ChatQueues';return db['UserProfileSection'][_0x27cd('0x33')]({'where':{'name':_0x21c491,'userProfileId':_0x22fe16[_0x27cd('0x38')]},'raw':!![]})['then'](function(_0x358588){if(_0x358588&&_0x358588[_0x27cd('0x39')]===0x0){return db[_0x27cd('0x18')]['create']({'name':_0x5058ae[_0x27cd('0x19')],'resourceId':_0x5058ae['id'],'type':_0x358588[_0x27cd('0x19')],'sectionId':_0x358588['id']},{})[_0x27cd('0x14')](function(){return _0x37d6fd;});}else{return _0x37d6fd;}})[_0x27cd('0x26')](function(_0x574f73){logger['error'](_0x27cd('0x3a'),_0x574f73);throw _0x574f73;});}return _0x37d6fd;})[_0x27cd('0x14')](respondWithResult(_0x4e8432,0xc9))['catch'](handleError(_0x4e8432,null));};exports[_0x27cd('0x13')]=function(_0x9b0907,_0x39f5e6){if(_0x9b0907[_0x27cd('0x34')]['id']){delete _0x9b0907[_0x27cd('0x34')]['id'];}return db['ChatQueue'][_0x27cd('0x33')]({'where':{'id':_0x9b0907['params']['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0x39f5e6,null))[_0x27cd('0x14')](saveUpdates(_0x9b0907[_0x27cd('0x34')],null))[_0x27cd('0x14')](respondWithResult(_0x39f5e6,null))[_0x27cd('0x26')](handleError(_0x39f5e6,null));};exports[_0x27cd('0x15')]=function(_0x64da3,_0x52a593){return db[_0x27cd('0x21')][_0x27cd('0x33')]({'where':{'id':_0x64da3[_0x27cd('0x28')]['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0x52a593,null))[_0x27cd('0x14')](removeEntity(_0x52a593,null))[_0x27cd('0x26')](handleError(_0x52a593,null));};exports[_0x27cd('0x3b')]=function(_0x28203c,_0x152c44){return db[_0x27cd('0x21')][_0x27cd('0x3b')]()[_0x27cd('0x14')](respondWithResult(_0x152c44,null))[_0x27cd('0x26')](handleError(_0x152c44,null));};exports[_0x27cd('0x3c')]=function(_0xf990e4,_0xf054d2){var _0x10a449={'raw':!![],'where':{}},_0x2a904={},_0x4dbb61;return db['ChatQueue'][_0x27cd('0x3d')]({'where':{'id':_0xf990e4[_0x27cd('0x28')]['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0xf054d2,null))[_0x27cd('0x14')](function(_0x46c2f9){if(_0x46c2f9){_0x4dbb61=_0x46c2f9[_0x27cd('0x16')]({'plain':!![]});_0x2a904['model']=_[_0x27cd('0x2a')](db[_0x27cd('0x3e')][_0x27cd('0x2b')]);_0x2a904[_0x27cd('0x23')]=_['keys'](_0xf990e4['query']);_0x2a904[_0x27cd('0x2c')]=_['intersection'](_0x2a904[_0x27cd('0x29')],_0x2a904[_0x27cd('0x23')]);_0x10a449[_0x27cd('0x2d')]=_[_0x27cd('0x2e')](_0x2a904[_0x27cd('0x29')],qs[_0x27cd('0x2f')](_0xf990e4[_0x27cd('0x23')]['fields']));_0x10a449[_0x27cd('0x2d')]=_0x10a449[_0x27cd('0x2d')]['length']?_0x10a449[_0x27cd('0x2d')]:_0x2a904[_0x27cd('0x29')];if(!_0xf990e4['query'][_0x27cd('0x3f')]('nolimit')){_0x10a449[_0x27cd('0xf')]=qs[_0x27cd('0xf')](_0xf990e4[_0x27cd('0x23')]['limit']);_0x10a449[_0x27cd('0xd')]=qs[_0x27cd('0xd')](_0xf990e4[_0x27cd('0x23')]['offset']);}_0x10a449['order']=qs['sort'](_0xf990e4[_0x27cd('0x23')]['sort']);_0x10a449['where']=qs[_0x27cd('0x2c')](_[_0x27cd('0x40')](_0xf990e4[_0x27cd('0x23')],_0x2a904[_0x27cd('0x2c')]));_0x10a449[_0x27cd('0x20')]['ChatQueueId']=_0x46c2f9['id'];if(_0xf990e4[_0x27cd('0x23')][_0x27cd('0x41')]){_0x10a449['where']=_[_0x27cd('0x31')](_0x10a449[_0x27cd('0x20')],{'$or':_[_0x27cd('0x1c')](_0x10a449['attributes'],function(_0xda7f03){var _0x5c1895={};_0x5c1895[_0xda7f03]={'$like':'%'+_0xf990e4['query'][_0x27cd('0x41')]+'%'};return _0x5c1895;})});}_0x10a449=_[_0x27cd('0x31')]({},_0x10a449,_0xf990e4[_0x27cd('0x32')]);return db[_0x27cd('0x3e')][_0x27cd('0x24')](_0x10a449);}})[_0x27cd('0x14')](function(_0x4382c9){if(_0x4382c9){return db[_0x27cd('0x42')][_0x27cd('0x43')]({'where':{'id':_[_0x27cd('0x1c')](_0x4382c9,'UserId'),'role':_0x27cd('0x44')},'attributes':['id',_0x27cd('0x19'),_0x27cd('0x45'),_0x27cd('0x46'),_0x27cd('0x47')]});}})[_0x27cd('0x14')](function(_0x11a91c){if(_0x11a91c){return{'count':_0x11a91c[_0x27cd('0x10')],'rows':_[_0x27cd('0x1c')](_0x11a91c['rows'],function(_0x29d76d){return{'membername':_0x29d76d[_0x27cd('0x19')],'UserId':_0x29d76d['id'],'queue_name':_0x4dbb61['name'],'ChatQueueId':_0x4dbb61['id'],'interface':util[_0x27cd('0x48')](_0x27cd('0x49'),'SIP',_0x29d76d['name']),'penalty':0x0,'paused':_0x29d76d[_0x27cd('0x45')],'createdAt':_0x29d76d[_0x27cd('0x47')],'updatedAt':_0x29d76d[_0x27cd('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x27cd('0x14')](respondWithFilteredResult(_0xf054d2,_0x10a449))[_0x27cd('0x26')](handleError(_0xf054d2,null));};exports[_0x27cd('0x4a')]=function(_0x199606,_0x469e32){var _0x2e5398={};var _0x15c2a8={};var _0x208866;var _0xefc301;return db[_0x27cd('0x21')][_0x27cd('0x3d')]({'where':{'id':_0x199606[_0x27cd('0x28')]['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0x469e32,null))[_0x27cd('0x14')](function(_0x3778c0){if(_0x3778c0){_0x208866=_0x3778c0;_0x15c2a8[_0x27cd('0x29')]=_[_0x27cd('0x2a')](db[_0x27cd('0x4b')][_0x27cd('0x2b')]);_0x15c2a8[_0x27cd('0x23')]=_[_0x27cd('0x2a')](_0x199606[_0x27cd('0x23')]);_0x15c2a8['filters']=_['intersection'](_0x15c2a8[_0x27cd('0x29')],_0x15c2a8[_0x27cd('0x23')]);_0x2e5398[_0x27cd('0x2d')]=_[_0x27cd('0x2e')](_0x15c2a8[_0x27cd('0x29')],qs[_0x27cd('0x2f')](_0x199606['query'][_0x27cd('0x2f')]));_0x2e5398[_0x27cd('0x2d')]=_0x2e5398['attributes'][_0x27cd('0x30')]?_0x2e5398[_0x27cd('0x2d')]:_0x15c2a8[_0x27cd('0x29')];_0x2e5398[_0x27cd('0x4c')]=qs[_0x27cd('0x4d')](_0x199606[_0x27cd('0x23')][_0x27cd('0x4d')]);_0x2e5398[_0x27cd('0x20')]=qs[_0x27cd('0x2c')](_[_0x27cd('0x40')](_0x199606[_0x27cd('0x23')],_0x15c2a8[_0x27cd('0x2c')]));if(_0x199606['query']['filter']){_0x2e5398[_0x27cd('0x20')]=_['merge'](_0x2e5398[_0x27cd('0x20')],{'$or':_[_0x27cd('0x1c')](_0x2e5398[_0x27cd('0x2d')],function(_0x5d3ee8){var _0x48535a={};_0x48535a[_0x5d3ee8]={'$like':'%'+_0x199606[_0x27cd('0x23')]['filter']+'%'};return _0x48535a;})});}_0x2e5398=_[_0x27cd('0x31')]({},_0x2e5398,_0x199606[_0x27cd('0x32')]);return _0x208866[_0x27cd('0x4a')](_0x2e5398);}})[_0x27cd('0x14')](function(_0x5eaab4){if(_0x5eaab4){_0xefc301=_0x5eaab4[_0x27cd('0x30')];if(!_0x199606[_0x27cd('0x23')]['hasOwnProperty']('nolimit')){_0x2e5398[_0x27cd('0xf')]=qs['limit'](_0x199606[_0x27cd('0x23')][_0x27cd('0xf')]);_0x2e5398['offset']=qs[_0x27cd('0xd')](_0x199606['query'][_0x27cd('0xd')]);}return _0x208866['getTeams'](_0x2e5398);}})[_0x27cd('0x14')](function(_0x1d5c4c){if(_0x1d5c4c){return _0x1d5c4c?{'count':_0xefc301,'rows':_0x1d5c4c}:null;}})[_0x27cd('0x14')](respondWithResult(_0x469e32,null))['catch'](handleError(_0x469e32,null));};exports['addTeams']=function(_0x4ef199,_0xddd182){var _0x577540=_0x4ef199[_0x27cd('0x34')][_0x27cd('0x4e')];return db[_0x27cd('0x4b')]['findAll']({'where':{'id':_0x577540},'attributes':['id'],'include':[{'model':db[_0x27cd('0x42')],'as':_0x27cd('0x4f'),'attributes':['id','name',_0x27cd('0x50'),'voicePause',_0x27cd('0x51')],'raw':!![]}]})['then'](function(_0x5207fc){if(_0x5207fc){var _0x43466b=_[_0x27cd('0x52')](_0x5207fc,function(_0x232060){var _0x103cf9=_0x232060[_0x27cd('0x16')]({'plain':!![]});return _0x103cf9[_0x27cd('0x4f')];});return db[_0x27cd('0x21')]['find']({'where':{'id':_0x4ef199[_0x27cd('0x28')]['id']}})[_0x27cd('0x14')](function(_0xf96a57){return db[_0x27cd('0x53')][_0x27cd('0x54')](function(_0x49c287){return _0xf96a57[_0x27cd('0x55')](_0x577540,{'transaction':_0x49c287})[_0x27cd('0x14')](function(){return BPromise[_0x27cd('0x56')](_0x43466b,function(_0x2df54f){return db[_0x27cd('0x3e')]['findOrCreate']({'where':{'UserId':_0x2df54f['id'],'ChatQueueId':_0x4ef199[_0x27cd('0x28')]['id']},'transaction':_0x49c287});});})[_0x27cd('0x14')](function(){_0x43466b[_0x27cd('0x57')](function(_0x3b0055){socket[_0x27cd('0x58')]('userChatQueue:save',{'UserId':_0x3b0055['id'],'ChatQueueId':_0xf96a57['id']});});});});});}})['then'](respondWithStatusCode(_0xddd182,null))['catch'](handleError(_0xddd182,null));};exports['removeTeams']=function(_0x3cee66,_0x225676){return db['Team']['findAll']({'where':{'id':_0x3cee66['query'][_0x27cd('0x4e')]},'attributes':['id'],'include':[{'model':db[_0x27cd('0x42')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x27cd('0x14')](handleEntityNotFound(_0x225676,null))[_0x27cd('0x14')](function(_0x584c48){var _0x2559aa=_[_0x27cd('0x1c')](_0x584c48,'id');var _0x4efb91=[];var _0x2bc126=[];var _0x3c147b=squel[_0x27cd('0x59')]();_0x3c147b['field']('tq.TeamId')[_0x27cd('0x5a')](_0x27cd('0x5b'),'tq')[_0x27cd('0x5c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x27cd('0x20')](_0x27cd('0x5d'),_0x3cee66[_0x27cd('0x28')]['id']);for(var _0x2c875=0x0;_0x2c875<_0x584c48[_0x27cd('0x30')];_0x2c875+=0x1){let _0x11b0b8=_0x584c48[_0x2c875];for(var _0x415c0c=0x0;_0x415c0c<_0x11b0b8[_0x27cd('0x4f')][_0x27cd('0x30')];_0x415c0c+=0x1){let _0x3935e9=_0x11b0b8['Agents'][_0x415c0c];var _0x4a0d3c=_0x3c147b[_0x27cd('0x5e')]();_0x4a0d3c[_0x27cd('0x20')](_0x27cd('0x5f'),_0x3935e9['id']);_0x2bc126[_0x27cd('0x60')](db['sequelize'][_0x27cd('0x23')](_0x4a0d3c[_0x27cd('0x61')](),{'type':db[_0x27cd('0x53')]['QueryTypes']['SELECT']})[_0x27cd('0x14')](function(_0x4cdb20){if(_0x4cdb20[_0x27cd('0x30')]===0x1){return _0x3935e9['id'];}else{var _0x5264c0=_[_0x27cd('0x62')](_['map'](_0x4cdb20,'TeamId'),function(_0x539eea){return _[_0x27cd('0x63')](_0x2559aa,_0x539eea);});if(_0x5264c0){return _0x3935e9['id'];}}}));}}return BPromise[_0x27cd('0x64')](_0x2bc126)[_0x27cd('0x14')](function(_0x39b7fe){_0x4efb91=_(_0x4efb91)[_0x27cd('0x65')](_0x39b7fe)['compact']()[_0x27cd('0x66')]();return db[_0x27cd('0x21')][_0x27cd('0x33')]({'where':{'id':_0x3cee66['params']['id']}})[_0x27cd('0x14')](function(_0x2bf3ad){return db['sequelize'][_0x27cd('0x54')](function(_0x2e1c61){return _0x2bf3ad[_0x27cd('0x67')](_0x3cee66[_0x27cd('0x23')][_0x27cd('0x4e')],{'transaction':_0x2e1c61})[_0x27cd('0x14')](function(){if(!_['isEmpty'](_0x4efb91)){return _0x2bf3ad[_0x27cd('0x68')](_0x4efb91,{'transaction':_0x2e1c61});}})[_0x27cd('0x14')](function(){_0x4efb91[_0x27cd('0x57')](function(_0x391e5e){socket[_0x27cd('0x58')]('userChatQueue:remove',{'UserId':_0x391e5e,'ChatQueueId':_0x2bf3ad['id']});});});});});});})[_0x27cd('0x14')](respondWithStatusCode(_0x225676,null))[_0x27cd('0x26')](handleError(_0x225676,null));};exports['addAgents']=function(_0x3afccb,_0x1ad269){return db['ChatQueue'][_0x27cd('0x33')]({'where':{'id':_0x3afccb[_0x27cd('0x28')]['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0x1ad269,null))[_0x27cd('0x14')](function(_0x53b848){if(_0x53b848){return _0x53b848[_0x27cd('0x69')](_0x3afccb[_0x27cd('0x34')][_0x27cd('0x4e')],_[_0x27cd('0x6a')](_0x3afccb['body'],[_0x27cd('0x4e'),'id'])||{})[_0x27cd('0x6b')](function(_0x189854){for(var _0x12b719=0x0;_0x12b719<_0x3afccb[_0x27cd('0x34')][_0x27cd('0x4e')][_0x27cd('0x30')];_0x12b719+=0x1){socket[_0x27cd('0x58')]('userChatQueue:save',{'UserId':Number(_0x3afccb['body']['ids'][_0x12b719]),'ChatQueueId':Number(_0x3afccb[_0x27cd('0x28')]['id'])});}return _0x189854;});}})[_0x27cd('0x14')](respondWithResult(_0x1ad269,null))[_0x27cd('0x26')](handleError(_0x1ad269,null));};exports[_0x27cd('0x68')]=function(_0x30467d,_0x104e0b){return db[_0x27cd('0x21')]['find']({'where':{'id':_0x30467d[_0x27cd('0x28')]['id']}})['then'](handleEntityNotFound(_0x104e0b,null))[_0x27cd('0x14')](function(_0x11c0ed){if(_0x11c0ed){return _0x11c0ed[_0x27cd('0x68')](_0x30467d[_0x27cd('0x23')]['ids'])[_0x27cd('0x14')](function(){if(_[_0x27cd('0x6c')](_0x30467d[_0x27cd('0x23')][_0x27cd('0x4e')])){for(var _0x3e4c1b=0x0;_0x3e4c1b<_0x30467d['query']['ids'][_0x27cd('0x30')];_0x3e4c1b+=0x1){socket[_0x27cd('0x58')](_0x27cd('0x6d'),{'UserId':Number(_0x30467d['query'][_0x27cd('0x4e')][_0x3e4c1b]),'ChatQueueId':Number(_0x30467d[_0x27cd('0x28')]['id'])});}}else{socket['emit'](_0x27cd('0x6d'),{'UserId':Number(_0x30467d['query']['ids']),'ChatQueueId':Number(_0x30467d[_0x27cd('0x28')]['id'])});}});}})[_0x27cd('0x14')](respondWithStatusCode(_0x104e0b,null))[_0x27cd('0x26')](handleError(_0x104e0b,null));};exports[_0x27cd('0x6e')]=function(_0x6f62e6,_0x42f5a6){var _0x46bc61={};var _0x7b0e61={};var _0x4622a1;var _0x4c5f61;return db[_0x27cd('0x21')][_0x27cd('0x3d')]({'where':{'id':_0x6f62e6['params']['id']}})[_0x27cd('0x14')](handleEntityNotFound(_0x42f5a6,null))['then'](function(_0xdcba05){if(_0xdcba05){_0x4622a1=_0xdcba05;_0x7b0e61[_0x27cd('0x29')]=_[_0x27cd('0x2a')](db[_0x27cd('0x42')][_0x27cd('0x2b')]);_0x7b0e61[_0x27cd('0x23')]=_[_0x27cd('0x2a')](_0x6f62e6[_0x27cd('0x23')]);_0x7b0e61['filters']=_[_0x27cd('0x2e')](_0x7b0e61[_0x27cd('0x29')],_0x7b0e61[_0x27cd('0x23')]);_0x46bc61[_0x27cd('0x2d')]=_['intersection'](_0x7b0e61[_0x27cd('0x29')],qs[_0x27cd('0x2f')](_0x6f62e6[_0x27cd('0x23')][_0x27cd('0x2f')]));_0x46bc61[_0x27cd('0x2d')]=_0x46bc61[_0x27cd('0x2d')]['length']?_0x46bc61[_0x27cd('0x2d')]:_0x7b0e61['model'];_0x46bc61[_0x27cd('0x4c')]=qs['sort'](_0x6f62e6[_0x27cd('0x23')][_0x27cd('0x4d')]);_0x46bc61[_0x27cd('0x20')]=qs[_0x27cd('0x2c')](_[_0x27cd('0x40')](_0x6f62e6['query'],_0x7b0e61[_0x27cd('0x2c')]));if(_0x6f62e6[_0x27cd('0x23')][_0x27cd('0x41')]){_0x46bc61['where']=_[_0x27cd('0x31')](_0x46bc61[_0x27cd('0x20')],{'$or':_[_0x27cd('0x1c')](_0x46bc61[_0x27cd('0x2d')],function(_0x299fdb){var _0x109f71={};_0x109f71[_0x299fdb]={'$like':'%'+_0x6f62e6[_0x27cd('0x23')]['filter']+'%'};return _0x109f71;})});}_0x46bc61=_[_0x27cd('0x31')]({},_0x46bc61,_0x6f62e6[_0x27cd('0x32')]);return _0x4622a1[_0x27cd('0x6e')](_0x46bc61);}})['then'](function(_0x1794f5){if(_0x1794f5){_0x4c5f61=_0x1794f5[_0x27cd('0x30')];if(!_0x6f62e6[_0x27cd('0x23')]['hasOwnProperty'](_0x27cd('0x6f'))){_0x46bc61[_0x27cd('0xf')]=qs[_0x27cd('0xf')](_0x6f62e6[_0x27cd('0x23')][_0x27cd('0xf')]);_0x46bc61['offset']=qs[_0x27cd('0xd')](_0x6f62e6['query'][_0x27cd('0xd')]);}return _0x4622a1[_0x27cd('0x6e')](_0x46bc61);}})[_0x27cd('0x14')](function(_0x5b994c){if(_0x5b994c){return _0x5b994c?{'count':_0x4c5f61,'rows':_0x5b994c}:null;}})[_0x27cd('0x14')](respondWithResult(_0x42f5a6,null))[_0x27cd('0x26')](handleError(_0x42f5a6,null));}; \ No newline at end of file +var _0x8386=['send','index','map','rawAttributes','fieldName','key','getOptions','where','ChatQueue','include','findAll','rows','show','params','model','query','keys','filters','intersection','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','UserChatQueue','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','UserProfileResource','end','error'];(function(_0x442409,_0x2e37c6){var _0x58718f=function(_0x5647ae){while(--_0x5647ae){_0x442409['push'](_0x442409['shift']());}};_0x58718f(++_0x2e37c6);}(_0x8386,0x1e7));var _0x6838=function(_0x4ca001,_0x2b049c){_0x4ca001=_0x4ca001-0x0;var _0x429381=_0x8386[_0x4ca001];return _0x429381;};'use strict';var BPromise=require(_0x6838('0x0'));var util=require(_0x6838('0x1'));var _=require(_0x6838('0x2'));var squel=require('squel');var Redis=require(_0x6838('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x6838('0x4'))(_0x6838('0x5'));var config=require(_0x6838('0x6'));var db=require(_0x6838('0x7'))['db'];config[_0x6838('0x8')]=_[_0x6838('0x9')](config[_0x6838('0x8')],{'host':_0x6838('0xa'),'port':0x18eb});var socket=require(_0x6838('0xb'))(new Redis(config['redis']));require(_0x6838('0xc'))[_0x6838('0xd')](socket);function respondWithStatusCode(_0x4a8b0d,_0x43f239){_0x43f239=_0x43f239||0xcc;return function(_0x4f2b2b){if(_0x4f2b2b){return _0x4a8b0d[_0x6838('0xe')](_0x43f239);}return _0x4a8b0d[_0x6838('0xf')](_0x43f239)['end']();};}function respondWithResult(_0x55d587,_0x6c30c8){_0x6c30c8=_0x6c30c8||0xc8;return function(_0x20cdba){if(_0x20cdba){return _0x55d587[_0x6838('0xf')](_0x6c30c8)[_0x6838('0x10')](_0x20cdba);}};}function respondWithFilteredResult(_0x382af9,_0x382b04){return function(_0x2708f8){if(_0x2708f8){var _0x373fdf=typeof _0x382b04[_0x6838('0x11')]==='undefined'&&typeof _0x382b04['limit']===_0x6838('0x12');var _0x40bb94=_0x2708f8[_0x6838('0x13')];var _0x18107c=_0x373fdf?0x0:_0x382b04[_0x6838('0x11')];var _0x87994f=_0x373fdf?_0x2708f8[_0x6838('0x13')]:_0x382b04[_0x6838('0x11')]+_0x382b04[_0x6838('0x14')];var _0x325c06;if(_0x87994f>=_0x40bb94){_0x87994f=_0x40bb94;_0x325c06=0xc8;}else{_0x325c06=0xce;}_0x382af9['status'](_0x325c06);return _0x382af9[_0x6838('0x15')](_0x6838('0x16'),_0x18107c+'-'+_0x87994f+'/'+_0x40bb94)['json'](_0x2708f8);}return null;};}function saveUpdates(_0x40716e){return function(_0x425ca0){if(_0x425ca0){return _0x425ca0[_0x6838('0x17')](_0x40716e)[_0x6838('0x18')](function(_0x2182c4){return _0x2182c4;});}return null;};}function removeEntity(_0x2e343a){return function(_0x5f07fc){if(_0x5f07fc){return _0x5f07fc['destroy']()[_0x6838('0x18')](function(){var _0x552c0f=_0x5f07fc[_0x6838('0x19')]({'plain':!![]});var _0x3bfde8='ChatQueues';return db[_0x6838('0x1a')]['destroy']({'where':{'type':_0x3bfde8,'resourceId':_0x552c0f['id']}})[_0x6838('0x18')](function(){return _0x5f07fc;});})[_0x6838('0x18')](function(){_0x2e343a[_0x6838('0xf')](0xcc)[_0x6838('0x1b')]();});}};}function handleEntityNotFound(_0xe5eee2){return function(_0x3f9531){if(!_0x3f9531){_0xe5eee2['sendStatus'](0x194);}return _0x3f9531;};}function handleError(_0x446303,_0x1c8d5c){_0x1c8d5c=_0x1c8d5c||0x1f4;return function(_0x5bf17d){logger[_0x6838('0x1c')](_0x5bf17d['stack']);if(_0x5bf17d['name']){delete _0x5bf17d['name'];}_0x446303[_0x6838('0xf')](_0x1c8d5c)[_0x6838('0x1d')](_0x5bf17d);};}exports[_0x6838('0x1e')]=function(_0x374b53,_0xd73a51){var _0x9d9dc={};var _0x20d8b9={'count':0x0,'rows':[]};var _0xdd153d=_[_0x6838('0x1f')](db['ChatQueue'][_0x6838('0x20')],function(_0x5110a8){return{'name':_0x5110a8[_0x6838('0x21')],'type':_0x5110a8['type'][_0x6838('0x22')]};});_0x9d9dc=qs[_0x6838('0x23')](_0xdd153d,_0x374b53);var _0x233313={'where':_0x9d9dc[_0x6838('0x24')]};return db[_0x6838('0x25')][_0x6838('0x13')](_0x233313)[_0x6838('0x18')](function(_0x370a41){_0x20d8b9['count']=_0x370a41;_0x9d9dc[_0x6838('0x26')]=qs[_0x6838('0x26')](_0x374b53['query']);return db[_0x6838('0x25')][_0x6838('0x27')](_0x9d9dc);})[_0x6838('0x18')](function(_0x26231d){_0x20d8b9[_0x6838('0x28')]=_0x26231d;return _0x20d8b9;})[_0x6838('0x18')](respondWithFilteredResult(_0xd73a51,_0x9d9dc))['catch'](handleError(_0xd73a51,null));};exports[_0x6838('0x29')]=function(_0x1b7ee9,_0x202aed){var _0xedd0b7={'raw':!![],'where':{'id':_0x1b7ee9[_0x6838('0x2a')]['id']}},_0x2d79b7={};_0x2d79b7[_0x6838('0x2b')]=_['keys'](db['ChatQueue'][_0x6838('0x20')]);_0x2d79b7[_0x6838('0x2c')]=_[_0x6838('0x2d')](_0x1b7ee9[_0x6838('0x2c')]);_0x2d79b7[_0x6838('0x2e')]=_[_0x6838('0x2f')](_0x2d79b7['model'],_0x2d79b7['query']);_0xedd0b7['attributes']=_[_0x6838('0x2f')](_0x2d79b7['model'],qs['fields'](_0x1b7ee9[_0x6838('0x2c')][_0x6838('0x30')]));_0xedd0b7[_0x6838('0x31')]=_0xedd0b7[_0x6838('0x31')][_0x6838('0x32')]?_0xedd0b7[_0x6838('0x31')]:_0x2d79b7[_0x6838('0x2b')];if(_0x1b7ee9['query']['includeAll']){_0xedd0b7[_0x6838('0x26')]=[{'all':!![]}];}_0xedd0b7=_[_0x6838('0x33')]({},_0xedd0b7,_0x1b7ee9[_0x6838('0x34')]);return db[_0x6838('0x25')][_0x6838('0x35')](_0xedd0b7)[_0x6838('0x18')](handleEntityNotFound(_0x202aed,null))[_0x6838('0x18')](respondWithResult(_0x202aed,null))['catch'](handleError(_0x202aed,null));};exports[_0x6838('0x36')]=function(_0x14145a,_0x3c944a){return db['ChatQueue'][_0x6838('0x36')](_0x14145a[_0x6838('0x37')],{})[_0x6838('0x18')](function(_0x3d7a02){var _0x12b2b7=_0x14145a[_0x6838('0x38')]['get']({'plain':!![]});if(!_0x12b2b7)throw new Error(_0x6838('0x39'));if(_0x12b2b7[_0x6838('0x3a')]===_0x6838('0x38')){var _0x15fed5=_0x3d7a02[_0x6838('0x19')]({'plain':!![]});var _0x496521='ChatQueues';return db[_0x6838('0x3b')][_0x6838('0x35')]({'where':{'name':_0x496521,'userProfileId':_0x12b2b7[_0x6838('0x3c')]},'raw':!![]})[_0x6838('0x18')](function(_0x2a838e){if(_0x2a838e&&_0x2a838e[_0x6838('0x3d')]===0x0){return db[_0x6838('0x1a')][_0x6838('0x36')]({'name':_0x15fed5[_0x6838('0x3e')],'resourceId':_0x15fed5['id'],'type':_0x2a838e[_0x6838('0x3e')],'sectionId':_0x2a838e['id']},{})[_0x6838('0x18')](function(){return _0x3d7a02;});}else{return _0x3d7a02;}})[_0x6838('0x3f')](function(_0x4971eb){logger[_0x6838('0x1c')](_0x6838('0x40'),_0x4971eb);throw _0x4971eb;});}return _0x3d7a02;})[_0x6838('0x18')](respondWithResult(_0x3c944a,0xc9))[_0x6838('0x3f')](handleError(_0x3c944a,null));};exports[_0x6838('0x17')]=function(_0x3dde4b,_0x2fc728){if(_0x3dde4b[_0x6838('0x37')]['id']){delete _0x3dde4b[_0x6838('0x37')]['id'];}return db[_0x6838('0x25')][_0x6838('0x35')]({'where':{'id':_0x3dde4b[_0x6838('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2fc728,null))[_0x6838('0x18')](saveUpdates(_0x3dde4b[_0x6838('0x37')],null))['then'](respondWithResult(_0x2fc728,null))[_0x6838('0x3f')](handleError(_0x2fc728,null));};exports[_0x6838('0x41')]=function(_0x20b5e3,_0x4374fc){return db[_0x6838('0x25')][_0x6838('0x35')]({'where':{'id':_0x20b5e3[_0x6838('0x2a')]['id']}})[_0x6838('0x18')](handleEntityNotFound(_0x4374fc,null))['then'](removeEntity(_0x4374fc,null))[_0x6838('0x3f')](handleError(_0x4374fc,null));};exports[_0x6838('0x42')]=function(_0x2b538d,_0x5c07c6){return db[_0x6838('0x25')][_0x6838('0x42')]()[_0x6838('0x18')](respondWithResult(_0x5c07c6,null))[_0x6838('0x3f')](handleError(_0x5c07c6,null));};exports[_0x6838('0x43')]=function(_0x490240,_0x5cee27){var _0x193bd0={'raw':!![],'where':{}},_0x40ab0d={},_0x38af80;return db[_0x6838('0x25')][_0x6838('0x44')]({'where':{'id':_0x490240['params']['id']}})[_0x6838('0x18')](handleEntityNotFound(_0x5cee27,null))[_0x6838('0x18')](function(_0x493dd7){if(_0x493dd7){_0x38af80=_0x493dd7['get']({'plain':!![]});_0x40ab0d[_0x6838('0x2b')]=_[_0x6838('0x2d')](db['UserChatQueue'][_0x6838('0x20')]);_0x40ab0d['query']=_['keys'](_0x490240[_0x6838('0x2c')]);_0x40ab0d[_0x6838('0x2e')]=_[_0x6838('0x2f')](_0x40ab0d['model'],_0x40ab0d[_0x6838('0x2c')]);_0x193bd0[_0x6838('0x31')]=_['intersection'](_0x40ab0d[_0x6838('0x2b')],qs[_0x6838('0x30')](_0x490240[_0x6838('0x2c')][_0x6838('0x30')]));_0x193bd0[_0x6838('0x31')]=_0x193bd0['attributes']['length']?_0x193bd0[_0x6838('0x31')]:_0x40ab0d[_0x6838('0x2b')];if(!_0x490240['query'][_0x6838('0x45')](_0x6838('0x46'))){_0x193bd0['limit']=qs[_0x6838('0x14')](_0x490240['query'][_0x6838('0x14')]);_0x193bd0[_0x6838('0x11')]=qs[_0x6838('0x11')](_0x490240[_0x6838('0x2c')][_0x6838('0x11')]);}_0x193bd0[_0x6838('0x47')]=qs[_0x6838('0x48')](_0x490240[_0x6838('0x2c')]['sort']);_0x193bd0[_0x6838('0x24')]=qs[_0x6838('0x2e')](_[_0x6838('0x49')](_0x490240[_0x6838('0x2c')],_0x40ab0d['filters']));_0x193bd0['where'][_0x6838('0x4a')]=_0x493dd7['id'];if(_0x490240[_0x6838('0x2c')][_0x6838('0x4b')]){_0x193bd0[_0x6838('0x24')]=_[_0x6838('0x33')](_0x193bd0[_0x6838('0x24')],{'$or':_[_0x6838('0x1f')](_0x193bd0[_0x6838('0x31')],function(_0x24138a){var _0x58f3b5={};_0x58f3b5[_0x24138a]={'$like':'%'+_0x490240[_0x6838('0x2c')][_0x6838('0x4b')]+'%'};return _0x58f3b5;})});}_0x193bd0=_[_0x6838('0x33')]({},_0x193bd0,_0x490240[_0x6838('0x34')]);return db['UserChatQueue']['findAll'](_0x193bd0);}})[_0x6838('0x18')](function(_0x521b16){if(_0x521b16){return db[_0x6838('0x4c')][_0x6838('0x4d')]({'where':{'id':_[_0x6838('0x1f')](_0x521b16,_0x6838('0x4e')),'role':_0x6838('0x4f')},'attributes':['id',_0x6838('0x3e'),'chatPause',_0x6838('0x50'),'createdAt']});}})[_0x6838('0x18')](function(_0x2e0a28){if(_0x2e0a28){return{'count':_0x2e0a28[_0x6838('0x13')],'rows':_['map'](_0x2e0a28['rows'],function(_0x3da6d3){return{'membername':_0x3da6d3[_0x6838('0x3e')],'UserId':_0x3da6d3['id'],'queue_name':_0x38af80['name'],'ChatQueueId':_0x38af80['id'],'interface':util[_0x6838('0x51')](_0x6838('0x52'),_0x6838('0x53'),_0x3da6d3['name']),'penalty':0x0,'paused':_0x3da6d3['chatPause'],'createdAt':_0x3da6d3[_0x6838('0x54')],'updatedAt':_0x3da6d3[_0x6838('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6838('0x18')](respondWithFilteredResult(_0x5cee27,_0x193bd0))[_0x6838('0x3f')](handleError(_0x5cee27,null));};exports[_0x6838('0x55')]=function(_0x4a3713,_0x21ddbf){var _0x1b8ccb={};var _0x10cf17={};var _0x3513e6;var _0x338f8d;return db[_0x6838('0x25')][_0x6838('0x44')]({'where':{'id':_0x4a3713[_0x6838('0x2a')]['id']}})['then'](handleEntityNotFound(_0x21ddbf,null))['then'](function(_0x43efec){if(_0x43efec){_0x3513e6=_0x43efec;_0x10cf17['model']=_['keys'](db[_0x6838('0x56')][_0x6838('0x20')]);_0x10cf17[_0x6838('0x2c')]=_[_0x6838('0x2d')](_0x4a3713[_0x6838('0x2c')]);_0x10cf17[_0x6838('0x2e')]=_[_0x6838('0x2f')](_0x10cf17[_0x6838('0x2b')],_0x10cf17['query']);_0x1b8ccb[_0x6838('0x31')]=_[_0x6838('0x2f')](_0x10cf17[_0x6838('0x2b')],qs[_0x6838('0x30')](_0x4a3713[_0x6838('0x2c')][_0x6838('0x30')]));_0x1b8ccb['attributes']=_0x1b8ccb[_0x6838('0x31')][_0x6838('0x32')]?_0x1b8ccb[_0x6838('0x31')]:_0x10cf17['model'];_0x1b8ccb[_0x6838('0x47')]=qs[_0x6838('0x48')](_0x4a3713[_0x6838('0x2c')][_0x6838('0x48')]);_0x1b8ccb[_0x6838('0x24')]=qs['filters'](_[_0x6838('0x49')](_0x4a3713[_0x6838('0x2c')],_0x10cf17[_0x6838('0x2e')]));if(_0x4a3713[_0x6838('0x2c')][_0x6838('0x4b')]){_0x1b8ccb[_0x6838('0x24')]=_[_0x6838('0x33')](_0x1b8ccb[_0x6838('0x24')],{'$or':_[_0x6838('0x1f')](_0x1b8ccb[_0x6838('0x31')],function(_0x3803cf){var _0x1f67ab={};_0x1f67ab[_0x3803cf]={'$like':'%'+_0x4a3713[_0x6838('0x2c')]['filter']+'%'};return _0x1f67ab;})});}_0x1b8ccb=_['merge']({},_0x1b8ccb,_0x4a3713[_0x6838('0x34')]);return _0x3513e6[_0x6838('0x55')](_0x1b8ccb);}})[_0x6838('0x18')](function(_0x3be88c){if(_0x3be88c){_0x338f8d=_0x3be88c[_0x6838('0x32')];if(!_0x4a3713[_0x6838('0x2c')][_0x6838('0x45')]('nolimit')){_0x1b8ccb[_0x6838('0x14')]=qs[_0x6838('0x14')](_0x4a3713[_0x6838('0x2c')][_0x6838('0x14')]);_0x1b8ccb[_0x6838('0x11')]=qs[_0x6838('0x11')](_0x4a3713[_0x6838('0x2c')][_0x6838('0x11')]);}return _0x3513e6[_0x6838('0x55')](_0x1b8ccb);}})[_0x6838('0x18')](function(_0x5cd875){if(_0x5cd875){return _0x5cd875?{'count':_0x338f8d,'rows':_0x5cd875}:null;}})[_0x6838('0x18')](respondWithResult(_0x21ddbf,null))[_0x6838('0x3f')](handleError(_0x21ddbf,null));};exports[_0x6838('0x57')]=function(_0x22b406,_0x19ad4e){var _0x415948=_0x22b406[_0x6838('0x37')][_0x6838('0x58')];return db[_0x6838('0x56')][_0x6838('0x27')]({'where':{'id':_0x415948},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6838('0x59'),'attributes':['id','name',_0x6838('0x5a'),_0x6838('0x5b'),'interface'],'raw':!![]}]})[_0x6838('0x18')](function(_0x2b9332){if(_0x2b9332){var _0x216de9=_[_0x6838('0x5c')](_0x2b9332,function(_0x2a2469){var _0x15b286=_0x2a2469[_0x6838('0x19')]({'plain':!![]});return _0x15b286[_0x6838('0x59')];});return db[_0x6838('0x25')]['find']({'where':{'id':_0x22b406['params']['id']}})[_0x6838('0x18')](function(_0x107266){return db[_0x6838('0x5d')][_0x6838('0x5e')](function(_0x1829ab){return _0x107266['addTeams'](_0x415948,{'transaction':_0x1829ab})[_0x6838('0x18')](function(){return BPromise[_0x6838('0x5f')](_0x216de9,function(_0x5aefa4){return db[_0x6838('0x60')][_0x6838('0x61')]({'where':{'UserId':_0x5aefa4['id'],'ChatQueueId':_0x22b406[_0x6838('0x2a')]['id']},'transaction':_0x1829ab});});})['then'](function(){_0x216de9[_0x6838('0x62')](function(_0x100d00){socket['emit'](_0x6838('0x63'),{'UserId':_0x100d00['id'],'ChatQueueId':_0x107266['id']});});});});});}})[_0x6838('0x18')](respondWithStatusCode(_0x19ad4e,null))[_0x6838('0x3f')](handleError(_0x19ad4e,null));};exports[_0x6838('0x64')]=function(_0x227306,_0x431925){return db[_0x6838('0x56')][_0x6838('0x27')]({'where':{'id':_0x227306[_0x6838('0x2c')][_0x6838('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6838('0x59'),'attributes':['id'],'raw':!![]}]})[_0x6838('0x18')](handleEntityNotFound(_0x431925,null))[_0x6838('0x18')](function(_0xddd43a){var _0x48393e=_[_0x6838('0x1f')](_0xddd43a,'id');var _0x2e4b82=[];var _0x14bfd1=[];var _0x48acf2=squel[_0x6838('0x65')]();_0x48acf2[_0x6838('0x66')]('tq.TeamId')[_0x6838('0x67')](_0x6838('0x68'),'tq')[_0x6838('0x69')](_0x6838('0x6a'),'ut',_0x6838('0x6b'))[_0x6838('0x24')](_0x6838('0x6c'),_0x227306[_0x6838('0x2a')]['id']);for(var _0x162d2c=0x0;_0x162d2c<_0xddd43a[_0x6838('0x32')];_0x162d2c+=0x1){let _0x3a8477=_0xddd43a[_0x162d2c];for(var _0x535287=0x0;_0x535287<_0x3a8477[_0x6838('0x59')]['length'];_0x535287+=0x1){let _0x390eab=_0x3a8477[_0x6838('0x59')][_0x535287];var _0x504d74=_0x48acf2['clone']();_0x504d74[_0x6838('0x24')](_0x6838('0x6d'),_0x390eab['id']);_0x14bfd1[_0x6838('0x6e')](db['sequelize'][_0x6838('0x2c')](_0x504d74[_0x6838('0x6f')](),{'type':db[_0x6838('0x5d')][_0x6838('0x70')][_0x6838('0x71')]})['then'](function(_0x51616d){if(_0x51616d[_0x6838('0x32')]===0x1){return _0x390eab['id'];}else{var _0x4baa42=_[_0x6838('0x72')](_[_0x6838('0x1f')](_0x51616d,_0x6838('0x73')),function(_0x4e6238){return _[_0x6838('0x74')](_0x48393e,_0x4e6238);});if(_0x4baa42){return _0x390eab['id'];}}}));}}return BPromise['all'](_0x14bfd1)[_0x6838('0x18')](function(_0x2bf308){_0x2e4b82=_(_0x2e4b82)[_0x6838('0x75')](_0x2bf308)[_0x6838('0x76')]()[_0x6838('0x77')]();return db[_0x6838('0x25')][_0x6838('0x35')]({'where':{'id':_0x227306[_0x6838('0x2a')]['id']}})[_0x6838('0x18')](function(_0x306fe2){return db[_0x6838('0x5d')][_0x6838('0x5e')](function(_0xdcc116){return _0x306fe2[_0x6838('0x64')](_0x227306[_0x6838('0x2c')][_0x6838('0x58')],{'transaction':_0xdcc116})[_0x6838('0x18')](function(){if(!_[_0x6838('0x78')](_0x2e4b82)){return _0x306fe2[_0x6838('0x79')](_0x2e4b82,{'transaction':_0xdcc116});}})['then'](function(){_0x2e4b82['forEach'](function(_0x17c76a){socket['emit'](_0x6838('0x7a'),{'UserId':_0x17c76a,'ChatQueueId':_0x306fe2['id']});});});});});});})['then'](respondWithStatusCode(_0x431925,null))[_0x6838('0x3f')](handleError(_0x431925,null));};exports[_0x6838('0x7b')]=function(_0x325073,_0x443f57){return db['ChatQueue'][_0x6838('0x35')]({'where':{'id':_0x325073[_0x6838('0x2a')]['id']}})[_0x6838('0x18')](handleEntityNotFound(_0x443f57,null))[_0x6838('0x18')](function(_0xe9127d){if(_0xe9127d){return _0xe9127d[_0x6838('0x7b')](_0x325073['body'][_0x6838('0x58')],_[_0x6838('0x7c')](_0x325073[_0x6838('0x37')],[_0x6838('0x58'),'id'])||{})[_0x6838('0x7d')](function(_0xec810b){for(var _0x3aa68e=0x0;_0x3aa68e<_0x325073[_0x6838('0x37')][_0x6838('0x58')][_0x6838('0x32')];_0x3aa68e+=0x1){socket[_0x6838('0x7e')](_0x6838('0x63'),{'UserId':Number(_0x325073[_0x6838('0x37')]['ids'][_0x3aa68e]),'ChatQueueId':Number(_0x325073[_0x6838('0x2a')]['id'])});}return _0xec810b;});}})['then'](respondWithResult(_0x443f57,null))[_0x6838('0x3f')](handleError(_0x443f57,null));};exports[_0x6838('0x79')]=function(_0x2a1859,_0x6830b8){return db[_0x6838('0x25')]['find']({'where':{'id':_0x2a1859[_0x6838('0x2a')]['id']}})[_0x6838('0x18')](handleEntityNotFound(_0x6830b8,null))[_0x6838('0x18')](function(_0x1f13b2){if(_0x1f13b2){return _0x1f13b2[_0x6838('0x79')](_0x2a1859[_0x6838('0x2c')][_0x6838('0x58')])[_0x6838('0x18')](function(){if(_[_0x6838('0x7f')](_0x2a1859[_0x6838('0x2c')]['ids'])){for(var _0x2b03d8=0x0;_0x2b03d8<_0x2a1859[_0x6838('0x2c')][_0x6838('0x58')][_0x6838('0x32')];_0x2b03d8+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x2a1859[_0x6838('0x2c')][_0x6838('0x58')][_0x2b03d8]),'ChatQueueId':Number(_0x2a1859[_0x6838('0x2a')]['id'])});}}else{socket[_0x6838('0x7e')](_0x6838('0x7a'),{'UserId':Number(_0x2a1859[_0x6838('0x2c')][_0x6838('0x58')]),'ChatQueueId':Number(_0x2a1859[_0x6838('0x2a')]['id'])});}});}})[_0x6838('0x18')](respondWithStatusCode(_0x6830b8,null))[_0x6838('0x3f')](handleError(_0x6830b8,null));};exports[_0x6838('0x80')]=function(_0x18e961,_0x17d3db){var _0x1c1c4d={};var _0xd96b14={};var _0x45e7e4;var _0x5642bc;return db['ChatQueue'][_0x6838('0x44')]({'where':{'id':_0x18e961[_0x6838('0x2a')]['id']}})['then'](handleEntityNotFound(_0x17d3db,null))[_0x6838('0x18')](function(_0x74c59c){if(_0x74c59c){_0x45e7e4=_0x74c59c;_0xd96b14[_0x6838('0x2b')]=_['keys'](db['User'][_0x6838('0x20')]);_0xd96b14['query']=_['keys'](_0x18e961[_0x6838('0x2c')]);_0xd96b14['filters']=_[_0x6838('0x2f')](_0xd96b14[_0x6838('0x2b')],_0xd96b14[_0x6838('0x2c')]);_0x1c1c4d[_0x6838('0x31')]=_[_0x6838('0x2f')](_0xd96b14['model'],qs[_0x6838('0x30')](_0x18e961[_0x6838('0x2c')]['fields']));_0x1c1c4d['attributes']=_0x1c1c4d[_0x6838('0x31')][_0x6838('0x32')]?_0x1c1c4d[_0x6838('0x31')]:_0xd96b14[_0x6838('0x2b')];_0x1c1c4d[_0x6838('0x47')]=qs[_0x6838('0x48')](_0x18e961[_0x6838('0x2c')][_0x6838('0x48')]);_0x1c1c4d['where']=qs[_0x6838('0x2e')](_['pick'](_0x18e961[_0x6838('0x2c')],_0xd96b14['filters']));if(_0x18e961['query']['filter']){_0x1c1c4d[_0x6838('0x24')]=_[_0x6838('0x33')](_0x1c1c4d[_0x6838('0x24')],{'$or':_[_0x6838('0x1f')](_0x1c1c4d[_0x6838('0x31')],function(_0x43be09){var _0x3ef902={};_0x3ef902[_0x43be09]={'$like':'%'+_0x18e961['query'][_0x6838('0x4b')]+'%'};return _0x3ef902;})});}_0x1c1c4d=_['merge']({},_0x1c1c4d,_0x18e961[_0x6838('0x34')]);return _0x45e7e4[_0x6838('0x80')](_0x1c1c4d);}})['then'](function(_0x31ef4f){if(_0x31ef4f){_0x5642bc=_0x31ef4f[_0x6838('0x32')];if(!_0x18e961[_0x6838('0x2c')]['hasOwnProperty'](_0x6838('0x46'))){_0x1c1c4d[_0x6838('0x14')]=qs[_0x6838('0x14')](_0x18e961[_0x6838('0x2c')][_0x6838('0x14')]);_0x1c1c4d['offset']=qs[_0x6838('0x11')](_0x18e961[_0x6838('0x2c')][_0x6838('0x11')]);}return _0x45e7e4[_0x6838('0x80')](_0x1c1c4d);}})[_0x6838('0x18')](function(_0x366042){if(_0x366042){return _0x366042?{'count':_0x5642bc,'rows':_0x366042}:null;}})['then'](respondWithResult(_0x17d3db,null))[_0x6838('0x3f')](handleError(_0x17d3db,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e00ab5a..964458d 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 _0xe9b5=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xe9b5,0x1e6));var _0x5e9b=function(_0x14e193,_0x476c13){_0x14e193=_0x14e193-0x0;var _0x53892e=_0xe9b5[_0x14e193];return _0x53892e;};'use strict';var EventEmitter=require(_0x5e9b('0x0'));var ChatQueue=require(_0x5e9b('0x1'))['db'][_0x5e9b('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5e9b('0x3')](0x0);var events={'afterCreate':_0x5e9b('0x4'),'afterUpdate':_0x5e9b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ce917){return function(_0x1da942,_0x59da16,_0xf50f8d){ChatQueueEvents['emit'](_0x2ce917+':'+_0x1da942['id'],_0x1da942);ChatQueueEvents['emit'](_0x2ce917,_0x1da942);_0xf50f8d(null);};}for(var e in events){if(events[_0x5e9b('0x6')](e)){var event=events[e];ChatQueue[_0x5e9b('0x7')](e,emitEvent(event));}}module[_0x5e9b('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xfe1e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5d9a28,_0x1bf0bf){var _0x1a0fcd=function(_0x44a228){while(--_0x44a228){_0x5d9a28['push'](_0x5d9a28['shift']());}};_0x1a0fcd(++_0x1bf0bf);}(_0xfe1e,0xe3));var _0xefe1=function(_0x4bf6a3,_0x38dcca){_0x4bf6a3=_0x4bf6a3-0x0;var _0x4368cb=_0xfe1e[_0x4bf6a3];return _0x4368cb;};'use strict';var EventEmitter=require(_0xefe1('0x0'));var ChatQueue=require(_0xefe1('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xefe1('0x2')](0x0);var events={'afterCreate':_0xefe1('0x3'),'afterUpdate':_0xefe1('0x4'),'afterDestroy':_0xefe1('0x5')};function emitEvent(_0x2eb593){return function(_0xa86d7a,_0x1f8a0a,_0x580ea2){ChatQueueEvents[_0xefe1('0x6')](_0x2eb593+':'+_0xa86d7a['id'],_0xa86d7a);ChatQueueEvents['emit'](_0x2eb593,_0xa86d7a);_0x580ea2(null);};}for(var e in events){if(events[_0xefe1('0x7')](e)){var event=events[e];ChatQueue[_0xefe1('0x8')](e,emitEvent(event));}}module[_0xefe1('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3a07861..7c2b068 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 _0x1e72=['ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./chatQueue.attributes','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1e72,0x1b9));var _0x21e7=function(_0x5264df,_0x4ed625){_0x5264df=_0x5264df-0x0;var _0x38335e=_0x1e72[_0x5264df];return _0x38335e;};'use strict';var _=require(_0x21e7('0x0'));var util=require(_0x21e7('0x1'));var logger=require(_0x21e7('0x2'))(_0x21e7('0x3'));var moment=require(_0x21e7('0x4'));var BPromise=require(_0x21e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x21e7('0x6'));var config=require('../../config/environment');var attributes=require(_0x21e7('0x7'));module[_0x21e7('0x8')]=function(_0x1a8e3e,_0x5a332a){return _0x1a8e3e['define'](_0x21e7('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x50e0,0x131));var _0x050e=function(_0x3935e1,_0x1e9d11){_0x3935e1=_0x3935e1-0x0;var _0x189e84=_0x50e0[_0x3935e1];return _0x189e84;};'use strict';var _=require(_0x050e('0x0'));var util=require(_0x050e('0x1'));var logger=require(_0x050e('0x2'))(_0x050e('0x3'));var moment=require(_0x050e('0x4'));var BPromise=require(_0x050e('0x5'));var rp=require(_0x050e('0x6'));var fs=require('fs');var path=require(_0x050e('0x7'));var rimraf=require(_0x050e('0x8'));var config=require(_0x050e('0x9'));var attributes=require(_0x050e('0xa'));module['exports']=function(_0x464c61,_0x10b8b5){return _0x464c61[_0x050e('0xb')](_0x050e('0xc'),attributes,{'tableName':_0x050e('0xd'),'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 c860a08..a06a9a1 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 _0x3306=['error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','include','map','model','debug','find','raw','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3306,0x107));var _0x6330=function(_0x112ad6,_0x1f1479){_0x112ad6=_0x112ad6-0x0;var _0x2e6412=_0x3306[_0x112ad6];return _0x2e6412;};'use strict';var _=require(_0x6330('0x0'));var util=require(_0x6330('0x1'));var moment=require(_0x6330('0x2'));var BPromise=require(_0x6330('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6330('0x4'));var db=require(_0x6330('0x5'))['db'];var utils=require(_0x6330('0x6'));var logger=require(_0x6330('0x7'))(_0x6330('0x8'));var config=require('../../config/environment');var jayson=require(_0x6330('0x9'));var client=jayson[_0x6330('0xa')][_0x6330('0xb')]({'port':0x232a});config[_0x6330('0xc')]=_[_0x6330('0xd')](config[_0x6330('0xc')],{'host':_0x6330('0xe'),'port':0x18eb});var socket=require(_0x6330('0xf'))(new Redis(config[_0x6330('0xc')]));require(_0x6330('0x10'))['register'](socket);function respondWithRpcPromise(_0x38bf84,_0x5e9d91,_0x2def1b){return new BPromise(function(_0x26ce0e,_0x20ff17){return client[_0x6330('0x11')](_0x38bf84,_0x2def1b)[_0x6330('0x12')](function(_0x1ad5c9){logger[_0x6330('0x13')](_0x6330('0x14'),_0x5e9d91,'request\x20sent');logger['debug'](_0x6330('0x15'),_0x5e9d91,_0x6330('0x16'),JSON[_0x6330('0x17')](_0x1ad5c9));if(_0x1ad5c9[_0x6330('0x18')]){if(_0x1ad5c9[_0x6330('0x18')]['code']===0x1f4){logger[_0x6330('0x18')](_0x6330('0x14'),_0x5e9d91,_0x1ad5c9[_0x6330('0x18')][_0x6330('0x19')]);return _0x20ff17(_0x1ad5c9['error']['message']);}logger[_0x6330('0x18')](_0x6330('0x14'),_0x5e9d91,_0x1ad5c9[_0x6330('0x18')]['message']);return _0x26ce0e(_0x1ad5c9[_0x6330('0x18')][_0x6330('0x19')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5e9d91,_0x6330('0x16'));_0x26ce0e(_0x1ad5c9[_0x6330('0x1a')][_0x6330('0x19')]);}})[_0x6330('0x1b')](function(_0x2c8e54){logger[_0x6330('0x18')](_0x6330('0x14'),_0x5e9d91,_0x2c8e54);_0x20ff17(_0x2c8e54);});});}exports[_0x6330('0x1c')]=function(_0x1080e9){var _0x421785=this;return new Promise(function(_0x55790e,_0x1fdc20){return db[_0x6330('0x1d')][_0x6330('0x1e')]({'raw':_0x1080e9[_0x6330('0x1f')]?_0x1080e9[_0x6330('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1080e9[_0x6330('0x1f')]?_0x1080e9[_0x6330('0x1f')][_0x6330('0x20')]||null:null,'attributes':_0x1080e9[_0x6330('0x1f')]?_0x1080e9[_0x6330('0x1f')][_0x6330('0x21')]||null:null,'limit':_0x1080e9['options']?_0x1080e9['options']['limit']||null:null,'include':_0x1080e9[_0x6330('0x1f')]?_0x1080e9[_0x6330('0x1f')][_0x6330('0x22')]?_[_0x6330('0x23')](_0x1080e9['options'][_0x6330('0x22')],function(_0x25aa25){return{'model':db[_0x25aa25[_0x6330('0x24')]],'as':_0x25aa25['as'],'attributes':_0x25aa25[_0x6330('0x21')],'include':_0x25aa25[_0x6330('0x22')]?_['map'](_0x25aa25['include'],function(_0x255861){return{'model':db[_0x255861[_0x6330('0x24')]],'as':_0x255861['as'],'attributes':_0x255861[_0x6330('0x21')],'include':_0x255861['include']?_[_0x6330('0x23')](_0x255861[_0x6330('0x22')],function(_0x325037){return{'model':db[_0x325037[_0x6330('0x24')]],'as':_0x325037['as'],'attributes':_0x325037['attributes']};}):[]};}):[]};}):[]:[]})[_0x6330('0x12')](function(_0x50ab51){logger[_0x6330('0x13')](_0x6330('0x1c'),_0x1080e9);logger[_0x6330('0x25')](_0x6330('0x1c'),_0x1080e9,JSON['stringify'](_0x50ab51));_0x55790e(_0x50ab51);})[_0x6330('0x1b')](function(_0x26a76e){logger[_0x6330('0x18')](_0x6330('0x1c'),_0x26a76e[_0x6330('0x19')],_0x1080e9);_0x1fdc20(_0x421785['error'](0x1f4,_0x26a76e[_0x6330('0x19')]));});});};exports['ShowChatQueue']=function(_0xaaf11d){var _0x5d01b3=this;return new Promise(function(_0x1ccca0,_0x4e9a28){return db['ChatQueue'][_0x6330('0x26')]({'raw':_0xaaf11d[_0x6330('0x1f')]?_0xaaf11d[_0x6330('0x1f')][_0x6330('0x27')]===undefined?!![]:![]:!![],'where':_0xaaf11d[_0x6330('0x1f')]?_0xaaf11d[_0x6330('0x1f')][_0x6330('0x20')]||null:null,'attributes':_0xaaf11d[_0x6330('0x1f')]?_0xaaf11d[_0x6330('0x1f')][_0x6330('0x21')]||null:null,'include':_0xaaf11d[_0x6330('0x1f')]?_0xaaf11d[_0x6330('0x1f')]['include']?_[_0x6330('0x23')](_0xaaf11d['options'][_0x6330('0x22')],function(_0x129175){return{'model':db[_0x129175[_0x6330('0x24')]],'as':_0x129175['as'],'attributes':_0x129175[_0x6330('0x21')],'include':_0x129175[_0x6330('0x22')]?_[_0x6330('0x23')](_0x129175[_0x6330('0x22')],function(_0x41be8f){return{'model':db[_0x41be8f[_0x6330('0x24')]],'as':_0x41be8f['as'],'attributes':_0x41be8f[_0x6330('0x21')],'include':_0x41be8f['include']?_[_0x6330('0x23')](_0x41be8f[_0x6330('0x22')],function(_0x4a4d30){return{'model':db[_0x4a4d30['model']],'as':_0x4a4d30['as'],'attributes':_0x4a4d30[_0x6330('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33354b){logger[_0x6330('0x13')](_0x6330('0x28'),_0xaaf11d);logger[_0x6330('0x25')](_0x6330('0x28'),_0xaaf11d,JSON[_0x6330('0x17')](_0x33354b));_0x1ccca0(_0x33354b);})[_0x6330('0x1b')](function(_0x30a44a){logger['error'](_0x6330('0x28'),_0x30a44a[_0x6330('0x19')],_0xaaf11d);_0x4e9a28(_0x5d01b3[_0x6330('0x18')](0x1f4,_0x30a44a['message']));});});}; \ No newline at end of file +var _0x1e7b=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','limit','include','map','attributes','model','GetChatQueue','debug','ShowChatQueue','ChatQueue','find','where'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x1e7b,0x12d));var _0xb1e7=function(_0x23e337,_0x1e3c57){_0x23e337=_0x23e337-0x0;var _0x45facf=_0x1e7b[_0x23e337];return _0x45facf;};'use strict';var _=require(_0xb1e7('0x0'));var util=require(_0xb1e7('0x1'));var moment=require('moment');var BPromise=require(_0xb1e7('0x2'));var rs=require(_0xb1e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1e7('0x4'))['db'];var utils=require(_0xb1e7('0x5'));var logger=require(_0xb1e7('0x6'))(_0xb1e7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1e7('0x8'));var client=jayson[_0xb1e7('0x9')][_0xb1e7('0xa')]({'port':0x232a});config[_0xb1e7('0xb')]=_[_0xb1e7('0xc')](config['redis'],{'host':_0xb1e7('0xd'),'port':0x18eb});var socket=require(_0xb1e7('0xe'))(new Redis(config[_0xb1e7('0xb')]));require(_0xb1e7('0xf'))[_0xb1e7('0x10')](socket);function respondWithRpcPromise(_0x1c27e8,_0x842e0a,_0x400ad9){return new BPromise(function(_0x13af76,_0x2521e9){return client[_0xb1e7('0x11')](_0x1c27e8,_0x400ad9)[_0xb1e7('0x12')](function(_0xc7eea1){logger[_0xb1e7('0x13')](_0xb1e7('0x14'),_0x842e0a,'request\x20sent');logger['debug'](_0xb1e7('0x15'),_0x842e0a,_0xb1e7('0x16'),JSON[_0xb1e7('0x17')](_0xc7eea1));if(_0xc7eea1['error']){if(_0xc7eea1[_0xb1e7('0x18')][_0xb1e7('0x19')]===0x1f4){logger[_0xb1e7('0x18')]('ChatQueue,\x20%s,\x20%s',_0x842e0a,_0xc7eea1[_0xb1e7('0x18')][_0xb1e7('0x1a')]);return _0x2521e9(_0xc7eea1[_0xb1e7('0x18')]['message']);}logger[_0xb1e7('0x18')](_0xb1e7('0x14'),_0x842e0a,_0xc7eea1[_0xb1e7('0x18')][_0xb1e7('0x1a')]);return _0x13af76(_0xc7eea1[_0xb1e7('0x18')][_0xb1e7('0x1a')]);}else{logger[_0xb1e7('0x13')](_0xb1e7('0x14'),_0x842e0a,_0xb1e7('0x16'));_0x13af76(_0xc7eea1[_0xb1e7('0x1b')][_0xb1e7('0x1a')]);}})[_0xb1e7('0x1c')](function(_0xa1ddc){logger[_0xb1e7('0x18')](_0xb1e7('0x14'),_0x842e0a,_0xa1ddc);_0x2521e9(_0xa1ddc);});});}exports['GetChatQueue']=function(_0x30f3d2){var _0x39b2d8=this;return new Promise(function(_0x51b0e3,_0x2fbd93){return db['ChatQueue'][_0xb1e7('0x1d')]({'raw':_0x30f3d2[_0xb1e7('0x1e')]?_0x30f3d2[_0xb1e7('0x1e')][_0xb1e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x30f3d2[_0xb1e7('0x1e')]?_0x30f3d2[_0xb1e7('0x1e')]['where']||null:null,'attributes':_0x30f3d2[_0xb1e7('0x1e')]?_0x30f3d2[_0xb1e7('0x1e')]['attributes']||null:null,'limit':_0x30f3d2['options']?_0x30f3d2[_0xb1e7('0x1e')][_0xb1e7('0x20')]||null:null,'include':_0x30f3d2[_0xb1e7('0x1e')]?_0x30f3d2['options'][_0xb1e7('0x21')]?_[_0xb1e7('0x22')](_0x30f3d2[_0xb1e7('0x1e')][_0xb1e7('0x21')],function(_0x5ada06){return{'model':db[_0x5ada06['model']],'as':_0x5ada06['as'],'attributes':_0x5ada06[_0xb1e7('0x23')],'include':_0x5ada06['include']?_[_0xb1e7('0x22')](_0x5ada06[_0xb1e7('0x21')],function(_0x2bc953){return{'model':db[_0x2bc953[_0xb1e7('0x24')]],'as':_0x2bc953['as'],'attributes':_0x2bc953[_0xb1e7('0x23')],'include':_0x2bc953[_0xb1e7('0x21')]?_[_0xb1e7('0x22')](_0x2bc953[_0xb1e7('0x21')],function(_0x290633){return{'model':db[_0x290633[_0xb1e7('0x24')]],'as':_0x290633['as'],'attributes':_0x290633[_0xb1e7('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb1e7('0x12')](function(_0x2a0ede){logger['info'](_0xb1e7('0x25'),_0x30f3d2);logger[_0xb1e7('0x26')](_0xb1e7('0x25'),_0x30f3d2,JSON[_0xb1e7('0x17')](_0x2a0ede));_0x51b0e3(_0x2a0ede);})['catch'](function(_0x357984){logger['error']('GetChatQueue',_0x357984[_0xb1e7('0x1a')],_0x30f3d2);_0x2fbd93(_0x39b2d8[_0xb1e7('0x18')](0x1f4,_0x357984[_0xb1e7('0x1a')]));});});};exports[_0xb1e7('0x27')]=function(_0x1f3fe8){var _0x556837=this;return new Promise(function(_0x50d432,_0x4ef31e){return db[_0xb1e7('0x28')][_0xb1e7('0x29')]({'raw':_0x1f3fe8[_0xb1e7('0x1e')]?_0x1f3fe8[_0xb1e7('0x1e')][_0xb1e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f3fe8['options']?_0x1f3fe8[_0xb1e7('0x1e')][_0xb1e7('0x2a')]||null:null,'attributes':_0x1f3fe8[_0xb1e7('0x1e')]?_0x1f3fe8[_0xb1e7('0x1e')][_0xb1e7('0x23')]||null:null,'include':_0x1f3fe8['options']?_0x1f3fe8['options'][_0xb1e7('0x21')]?_[_0xb1e7('0x22')](_0x1f3fe8[_0xb1e7('0x1e')]['include'],function(_0xe9df78){return{'model':db[_0xe9df78[_0xb1e7('0x24')]],'as':_0xe9df78['as'],'attributes':_0xe9df78[_0xb1e7('0x23')],'include':_0xe9df78[_0xb1e7('0x21')]?_[_0xb1e7('0x22')](_0xe9df78['include'],function(_0x1fa43d){return{'model':db[_0x1fa43d[_0xb1e7('0x24')]],'as':_0x1fa43d['as'],'attributes':_0x1fa43d[_0xb1e7('0x23')],'include':_0x1fa43d[_0xb1e7('0x21')]?_[_0xb1e7('0x22')](_0x1fa43d[_0xb1e7('0x21')],function(_0x70bf72){return{'model':db[_0x70bf72[_0xb1e7('0x24')]],'as':_0x70bf72['as'],'attributes':_0x70bf72['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1e7('0x12')](function(_0x86624){logger['info'](_0xb1e7('0x27'),_0x1f3fe8);logger[_0xb1e7('0x26')](_0xb1e7('0x27'),_0x1f3fe8,JSON[_0xb1e7('0x17')](_0x86624));_0x50d432(_0x86624);})[_0xb1e7('0x1c')](function(_0x40cb93){logger['error']('ShowChatQueue',_0x40cb93[_0xb1e7('0x1a')],_0x1f3fe8);_0x4ef31e(_0x556837[_0xb1e7('0x18')](0x1f4,_0x40cb93['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6d86853..1fb10fc 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 _0x4d9e=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x4c012a,_0xf39ef4){var _0x5b6088=function(_0x5b6ded){while(--_0x5b6ded){_0x4c012a['push'](_0x4c012a['shift']());}};_0x5b6088(++_0xf39ef4);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3b5240,_0x22e3c1){_0x3b5240=_0x3b5240-0x0;var _0x92a90c=_0x4d9e[_0x3b5240];return _0x92a90c;};'use strict';var ChatQueueEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatQueueEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatQueueEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file +var _0x34e8=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x34e8,0x12c));var _0x834e=function(_0x58b1b0,_0x27d317){_0x58b1b0=_0x58b1b0-0x0;var _0x52246c=_0x34e8[_0x58b1b0];return _0x52246c;};'use strict';var ChatQueueEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){ChatQueueEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);ChatQueueEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ce0407c..dc3d608 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x384c82,_0x18c8e9){_0x384c82=_0x384c82-0x0;var _0x3dd7fb=_0x3e74[_0x384c82];return _0x3dd7fb;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x5fc3,0xa8));var _0x35fc=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x5fc3[_0x592d48];return _0x5d789e;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 6d71ec2..7773634 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 _0x61eb=['exports','STRING','DATE','moment','sequelize'];(function(_0x5e647c,_0x2a2890){var _0x1f9724=function(_0x18ca2a){while(--_0x18ca2a){_0x5e647c['push'](_0x5e647c['shift']());}};_0x1f9724(++_0x2a2890);}(_0x61eb,0x14d));var _0xb61e=function(_0x355814,_0x29403b){_0x355814=_0x355814-0x0;var _0x9b6c5d=_0x61eb[_0x355814];return _0x9b6c5d;};'use strict';var moment=require(_0xb61e('0x0'));var Sequelize=require(_0xb61e('0x1'));module[_0xb61e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb61e('0x3')]},'joinAt':{'type':Sequelize[_0xb61e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb61e('0x4')]},'reason':{'type':Sequelize[_0xb61e('0x3')]}}; \ No newline at end of file +var _0xd33e=['exports','STRING','DATE','moment'];(function(_0x378fe1,_0x3fd068){var _0x2ac3db=function(_0x5297c5){while(--_0x5297c5){_0x378fe1['push'](_0x378fe1['shift']());}};_0x2ac3db(++_0x3fd068);}(_0xd33e,0x1b7));var _0xed33=function(_0x4ffee4,_0x1db54d){_0x4ffee4=_0x4ffee4-0x0;var _0x5e9fe4=_0xd33e[_0x4ffee4];return _0x5e9fe4;};'use strict';var moment=require(_0xed33('0x0'));var Sequelize=require('sequelize');module[_0xed33('0x1')]={'uniqueid':{'type':Sequelize[_0xed33('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xed33('0x2')]},'joinAt':{'type':Sequelize[_0xed33('0x3')]},'leaveAt':{'type':Sequelize[_0xed33('0x3')]},'acceptAt':{'type':Sequelize[_0xed33('0x3')]},'exitAt':{'type':Sequelize[_0xed33('0x3')]},'reason':{'type':Sequelize[_0xed33('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e6a879e..a05af2b 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 _0xfcbe=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','ChatQueueReport','rows','catch','show','params','includeAll','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x57de4c,_0x3ee219){var _0x3089b4=function(_0x1a65dd){while(--_0x1a65dd){_0x57de4c['push'](_0x57de4c['shift']());}};_0x3089b4(++_0x3ee219);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x577dd2,_0x2643e1){_0x577dd2=_0x577dd2-0x0;var _0x445004=_0xfcbe[_0x577dd2];return _0x445004;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefcb('0x0'));var zipdir=require(_0xefcb('0x1'));var jsonpatch=require(_0xefcb('0x2'));var rp=require(_0xefcb('0x3'));var moment=require(_0xefcb('0x4'));var BPromise=require(_0xefcb('0x5'));var Mustache=require('mustache');var util=require(_0xefcb('0x6'));var path=require(_0xefcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefcb('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xefcb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefcb('0xa'));var toCsv=require(_0xefcb('0xb'));var querystring=require(_0xefcb('0xc'));var Papa=require('papaparse');var Redis=require(_0xefcb('0xd'));var authService=require(_0xefcb('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefcb('0xf'));var logger=require(_0xefcb('0x10'))(_0xefcb('0x11'));var utils=require(_0xefcb('0x12'));var config=require(_0xefcb('0x13'));var licenseUtil=require(_0xefcb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x92bb0c,_0x163012){_0x163012=_0x163012||0xcc;return function(_0x2c77dd){if(_0x2c77dd){return _0x92bb0c[_0xefcb('0x15')](_0x163012);}return _0x92bb0c[_0xefcb('0x16')](_0x163012)['end']();};}function respondWithResult(_0x585355,_0x24ac43){_0x24ac43=_0x24ac43||0xc8;return function(_0xd13e37){if(_0xd13e37){return _0x585355['status'](_0x24ac43)[_0xefcb('0x17')](_0xd13e37);}};}function respondWithFilteredResult(_0x565c13,_0x3946ef){return function(_0x565fae){if(_0x565fae){var _0x172816=typeof _0x3946ef[_0xefcb('0x18')]===_0xefcb('0x19')&&typeof _0x3946ef[_0xefcb('0x1a')]===_0xefcb('0x19');var _0x13d883=_0x565fae['count'];var _0x15fbec=_0x172816?0x0:_0x3946ef[_0xefcb('0x18')];var _0xe922c7=_0x172816?_0x565fae[_0xefcb('0x1b')]:_0x3946ef[_0xefcb('0x18')]+_0x3946ef[_0xefcb('0x1a')];var _0x3a3ffe;if(_0xe922c7>=_0x13d883){_0xe922c7=_0x13d883;_0x3a3ffe=0xc8;}else{_0x3a3ffe=0xce;}_0x565c13['status'](_0x3a3ffe);return _0x565c13[_0xefcb('0x1c')](_0xefcb('0x1d'),_0x15fbec+'-'+_0xe922c7+'/'+_0x13d883)['json'](_0x565fae);}return null;};}function patchUpdates(_0x12a93f){return function(_0x51c2e){try{jsonpatch[_0xefcb('0x1e')](_0x51c2e,_0x12a93f,!![]);}catch(_0x2b0be0){return BPromise[_0xefcb('0x1f')](_0x2b0be0);}return _0x51c2e['save']();};}function saveUpdates(_0x10c662,_0x33641c){return function(_0x2ab79d){if(_0x2ab79d){return _0x2ab79d[_0xefcb('0x20')](_0x10c662)[_0xefcb('0x21')](function(_0x345629){return _0x345629;});}return null;};}function removeEntity(_0x129817,_0x2a74f6){return function(_0x52e7dd){if(_0x52e7dd){return _0x52e7dd['destroy']()['then'](function(){_0x129817[_0xefcb('0x16')](0xcc)[_0xefcb('0x22')]();});}};}function handleEntityNotFound(_0x457ff6,_0x1717b7){return function(_0x20f51f){if(!_0x20f51f){_0x457ff6[_0xefcb('0x15')](0x194);}return _0x20f51f;};}function handleError(_0x22e2c6,_0x52ce86){_0x52ce86=_0x52ce86||0x1f4;return function(_0x3029d1){logger[_0xefcb('0x23')](_0x3029d1[_0xefcb('0x24')]);if(_0x3029d1[_0xefcb('0x25')]){delete _0x3029d1[_0xefcb('0x25')];}_0x22e2c6[_0xefcb('0x16')](_0x52ce86)[_0xefcb('0x26')](_0x3029d1);};}exports[_0xefcb('0x27')]=function(_0x1c7ee1,_0xe2c2c8){var _0x124546={},_0x160782={},_0xccac33={'count':0x0,'rows':[]};var _0x43fb58=_[_0xefcb('0x28')](db['ChatQueueReport'][_0xefcb('0x29')],function(_0x3995cc){return{'name':_0x3995cc[_0xefcb('0x2a')],'type':_0x3995cc[_0xefcb('0x2b')][_0xefcb('0x2c')]};});_0x160782[_0xefcb('0x2d')]=_[_0xefcb('0x28')](_0x43fb58,'name');_0x160782['query']=_[_0xefcb('0x2e')](_0x1c7ee1[_0xefcb('0x2f')]);_0x160782['filters']=_[_0xefcb('0x30')](_0x160782[_0xefcb('0x2d')],_0x160782[_0xefcb('0x2f')]);_0x124546['attributes']=_[_0xefcb('0x30')](_0x160782[_0xefcb('0x2d')],qs[_0xefcb('0x31')](_0x1c7ee1['query']['fields']));_0x124546['attributes']=_0x124546['attributes'][_0xefcb('0x32')]?_0x124546[_0xefcb('0x33')]:_0x160782[_0xefcb('0x2d')];if(!_0x1c7ee1[_0xefcb('0x2f')][_0xefcb('0x34')](_0xefcb('0x35'))){_0x124546[_0xefcb('0x1a')]=qs[_0xefcb('0x1a')](_0x1c7ee1[_0xefcb('0x2f')][_0xefcb('0x1a')]);_0x124546[_0xefcb('0x18')]=qs[_0xefcb('0x18')](_0x1c7ee1[_0xefcb('0x2f')][_0xefcb('0x18')]);}_0x124546[_0xefcb('0x36')]=qs[_0xefcb('0x37')](_0x1c7ee1['query'][_0xefcb('0x37')]);_0x124546[_0xefcb('0x38')]=qs[_0xefcb('0x39')](_[_0xefcb('0x3a')](_0x1c7ee1['query'],_0x160782[_0xefcb('0x39')]),_0x43fb58);if(_0x1c7ee1['query'][_0xefcb('0x3b')]){_0x124546[_0xefcb('0x38')]=_[_0xefcb('0x3c')](_0x124546[_0xefcb('0x38')],{'$or':_['map'](_0x43fb58,function(_0x167dac){if(_0x167dac[_0xefcb('0x2b')]!==_0xefcb('0x3d')){var _0x5ba923={};_0x5ba923[_0x167dac[_0xefcb('0x25')]]={'$like':'%'+_0x1c7ee1[_0xefcb('0x2f')][_0xefcb('0x3b')]+'%'};return _0x5ba923;}})});}_0x124546=_['merge']({},_0x124546,_0x1c7ee1['options']);var _0x183bbd={'where':_0x124546['where']};return db['ChatQueueReport'][_0xefcb('0x1b')](_0x183bbd)[_0xefcb('0x21')](function(_0x2b354a){_0xccac33['count']=_0x2b354a;if(_0x1c7ee1['query']['includeAll']){_0x124546[_0xefcb('0x3e')]=[{'all':!![]}];}return db[_0xefcb('0x3f')]['findAll'](_0x124546);})[_0xefcb('0x21')](function(_0x5ae48d){_0xccac33[_0xefcb('0x40')]=_0x5ae48d;return _0xccac33;})[_0xefcb('0x21')](respondWithFilteredResult(_0xe2c2c8,_0x124546))[_0xefcb('0x41')](handleError(_0xe2c2c8,null));};exports[_0xefcb('0x42')]=function(_0x35d208,_0x5619d1){var _0x594207={'raw':!![],'where':{'id':_0x35d208[_0xefcb('0x43')]['id']}},_0x13dc1b={};_0x13dc1b['model']=_['keys'](db['ChatQueueReport'][_0xefcb('0x29')]);_0x13dc1b[_0xefcb('0x2f')]=_['keys'](_0x35d208[_0xefcb('0x2f')]);_0x13dc1b['filters']=_[_0xefcb('0x30')](_0x13dc1b[_0xefcb('0x2d')],_0x13dc1b[_0xefcb('0x2f')]);_0x594207[_0xefcb('0x33')]=_[_0xefcb('0x30')](_0x13dc1b['model'],qs[_0xefcb('0x31')](_0x35d208['query'][_0xefcb('0x31')]));_0x594207['attributes']=_0x594207[_0xefcb('0x33')]['length']?_0x594207[_0xefcb('0x33')]:_0x13dc1b['model'];if(_0x35d208[_0xefcb('0x2f')][_0xefcb('0x44')]){_0x594207[_0xefcb('0x3e')]=[{'all':!![]}];}_0x594207=_[_0xefcb('0x3c')]({},_0x594207,_0x35d208[_0xefcb('0x45')]);return db[_0xefcb('0x3f')]['find'](_0x594207)[_0xefcb('0x21')](handleEntityNotFound(_0x5619d1,null))['then'](respondWithResult(_0x5619d1,null))[_0xefcb('0x41')](handleError(_0x5619d1,null));};exports[_0xefcb('0x46')]=function(_0x3f990e,_0x32b0a2){return db[_0xefcb('0x3f')][_0xefcb('0x46')](_0x3f990e['body'],{})[_0xefcb('0x21')](respondWithResult(_0x32b0a2,0xc9))[_0xefcb('0x41')](handleError(_0x32b0a2,null));};exports[_0xefcb('0x20')]=function(_0x53c7d6,_0x4bdcc0){if(_0x53c7d6[_0xefcb('0x47')]['id']){delete _0x53c7d6[_0xefcb('0x47')]['id'];}return db['ChatQueueReport'][_0xefcb('0x48')]({'where':{'id':_0x53c7d6[_0xefcb('0x43')]['id']}})[_0xefcb('0x21')](handleEntityNotFound(_0x4bdcc0,null))[_0xefcb('0x21')](saveUpdates(_0x53c7d6[_0xefcb('0x47')],null))[_0xefcb('0x21')](respondWithResult(_0x4bdcc0,null))['catch'](handleError(_0x4bdcc0,null));};exports[_0xefcb('0x49')]=function(_0x42a580,_0x363284){return db[_0xefcb('0x3f')][_0xefcb('0x48')]({'where':{'id':_0x42a580[_0xefcb('0x43')]['id']}})[_0xefcb('0x21')](handleEntityNotFound(_0x363284,null))['then'](removeEntity(_0x363284,null))[_0xefcb('0x41')](handleError(_0x363284,null));};exports[_0xefcb('0x4a')]=function(_0x369833,_0x447bd8){return db[_0xefcb('0x3f')][_0xefcb('0x4a')]()[_0xefcb('0x21')](respondWithResult(_0x447bd8,null))[_0xefcb('0x41')](handleError(_0x447bd8,null));}; \ No newline at end of file +var _0xf0f4=['find','create','catch','body','destroy','describe','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','ChatQueueReport','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x25c61b,_0xfe829e){var _0x2a6b3f=function(_0x5de7b2){while(--_0x5de7b2){_0x25c61b['push'](_0x25c61b['shift']());}};_0x2a6b3f(++_0xfe829e);}(_0xf0f4,0x182));var _0x4f0f=function(_0x33a543,_0x2737fb){_0x33a543=_0x33a543-0x0;var _0x2778ba=_0xf0f4[_0x33a543];return _0x2778ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f0f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f0f('0x1'));var moment=require(_0x4f0f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f0f('0x3'));var util=require(_0x4f0f('0x4'));var path=require(_0x4f0f('0x5'));var sox=require(_0x4f0f('0x6'));var csv=require(_0x4f0f('0x7'));var ejs=require(_0x4f0f('0x8'));var fs=require('fs');var fs_extra=require(_0x4f0f('0x9'));var _=require('lodash');var squel=require(_0x4f0f('0xa'));var crypto=require(_0x4f0f('0xb'));var jsforce=require(_0x4f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f0f('0x7'));var querystring=require(_0x4f0f('0xd'));var Papa=require(_0x4f0f('0xe'));var Redis=require(_0x4f0f('0xf'));var authService=require(_0x4f0f('0x10'));var qs=require(_0x4f0f('0x11'));var as=require(_0x4f0f('0x12'));var hardwareService=require(_0x4f0f('0x13'));var logger=require('../../config/logger')(_0x4f0f('0x14'));var utils=require(_0x4f0f('0x15'));var config=require(_0x4f0f('0x16'));var licenseUtil=require(_0x4f0f('0x17'));var db=require(_0x4f0f('0x18'))['db'];function respondWithStatusCode(_0x1a1b94,_0x123845){_0x123845=_0x123845||0xcc;return function(_0x11749b){if(_0x11749b){return _0x1a1b94[_0x4f0f('0x19')](_0x123845);}return _0x1a1b94[_0x4f0f('0x1a')](_0x123845)[_0x4f0f('0x1b')]();};}function respondWithResult(_0x4e1e26,_0xebecc0){_0xebecc0=_0xebecc0||0xc8;return function(_0x447238){if(_0x447238){return _0x4e1e26[_0x4f0f('0x1a')](_0xebecc0)[_0x4f0f('0x1c')](_0x447238);}};}function respondWithFilteredResult(_0x51a713,_0xd9ad12){return function(_0x46d7cf){if(_0x46d7cf){var _0x5783=typeof _0xd9ad12[_0x4f0f('0x1d')]===_0x4f0f('0x1e')&&typeof _0xd9ad12['limit']===_0x4f0f('0x1e');var _0x1942cf=_0x46d7cf[_0x4f0f('0x1f')];var _0x566049=_0x5783?0x0:_0xd9ad12[_0x4f0f('0x1d')];var _0x86186f=_0x5783?_0x46d7cf[_0x4f0f('0x1f')]:_0xd9ad12['offset']+_0xd9ad12[_0x4f0f('0x20')];var _0x2455f9;if(_0x86186f>=_0x1942cf){_0x86186f=_0x1942cf;_0x2455f9=0xc8;}else{_0x2455f9=0xce;}_0x51a713[_0x4f0f('0x1a')](_0x2455f9);return _0x51a713[_0x4f0f('0x21')](_0x4f0f('0x22'),_0x566049+'-'+_0x86186f+'/'+_0x1942cf)[_0x4f0f('0x1c')](_0x46d7cf);}return null;};}function patchUpdates(_0x537074){return function(_0x276387){try{jsonpatch['apply'](_0x276387,_0x537074,!![]);}catch(_0x3a6f22){return BPromise[_0x4f0f('0x23')](_0x3a6f22);}return _0x276387['save']();};}function saveUpdates(_0x4e4b28,_0x1bdfb4){return function(_0x55d318){if(_0x55d318){return _0x55d318[_0x4f0f('0x24')](_0x4e4b28)[_0x4f0f('0x25')](function(_0x18abde){return _0x18abde;});}return null;};}function removeEntity(_0x17f10c,_0x454720){return function(_0x17a9e9){if(_0x17a9e9){return _0x17a9e9['destroy']()[_0x4f0f('0x25')](function(){_0x17f10c[_0x4f0f('0x1a')](0xcc)[_0x4f0f('0x1b')]();});}};}function handleEntityNotFound(_0x3bc77d,_0xe969c7){return function(_0x3e6b72){if(!_0x3e6b72){_0x3bc77d[_0x4f0f('0x19')](0x194);}return _0x3e6b72;};}function handleError(_0x419986,_0x17cf17){_0x17cf17=_0x17cf17||0x1f4;return function(_0xb20be9){logger[_0x4f0f('0x26')](_0xb20be9[_0x4f0f('0x27')]);if(_0xb20be9[_0x4f0f('0x28')]){delete _0xb20be9['name'];}_0x419986[_0x4f0f('0x1a')](_0x17cf17)[_0x4f0f('0x29')](_0xb20be9);};}exports[_0x4f0f('0x2a')]=function(_0x58ec43,_0xa8a240){var _0x4e5f0d={},_0x449788={},_0x1f4e1d={'count':0x0,'rows':[]};var _0x5ada54=_['map'](db[_0x4f0f('0x2b')]['rawAttributes'],function(_0x1a005e){return{'name':_0x1a005e[_0x4f0f('0x2c')],'type':_0x1a005e['type'][_0x4f0f('0x2d')]};});_0x449788[_0x4f0f('0x2e')]=_[_0x4f0f('0x2f')](_0x5ada54,_0x4f0f('0x28'));_0x449788['query']=_[_0x4f0f('0x30')](_0x58ec43[_0x4f0f('0x31')]);_0x449788[_0x4f0f('0x32')]=_[_0x4f0f('0x33')](_0x449788['model'],_0x449788[_0x4f0f('0x31')]);_0x4e5f0d[_0x4f0f('0x34')]=_[_0x4f0f('0x33')](_0x449788['model'],qs[_0x4f0f('0x35')](_0x58ec43[_0x4f0f('0x31')]['fields']));_0x4e5f0d[_0x4f0f('0x34')]=_0x4e5f0d[_0x4f0f('0x34')][_0x4f0f('0x36')]?_0x4e5f0d[_0x4f0f('0x34')]:_0x449788['model'];if(!_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x37')](_0x4f0f('0x38'))){_0x4e5f0d[_0x4f0f('0x20')]=qs[_0x4f0f('0x20')](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x20')]);_0x4e5f0d[_0x4f0f('0x1d')]=qs['offset'](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x1d')]);}_0x4e5f0d[_0x4f0f('0x39')]=qs[_0x4f0f('0x3a')](_0x58ec43[_0x4f0f('0x31')][_0x4f0f('0x3a')]);_0x4e5f0d[_0x4f0f('0x3b')]=qs['filters'](_[_0x4f0f('0x3c')](_0x58ec43[_0x4f0f('0x31')],_0x449788[_0x4f0f('0x32')]),_0x5ada54);if(_0x58ec43['query'][_0x4f0f('0x3d')]){_0x4e5f0d['where']=_[_0x4f0f('0x3e')](_0x4e5f0d['where'],{'$or':_[_0x4f0f('0x2f')](_0x5ada54,function(_0x27b5bf){if(_0x27b5bf['type']!==_0x4f0f('0x3f')){var _0x2d58b0={};_0x2d58b0[_0x27b5bf[_0x4f0f('0x28')]]={'$like':'%'+_0x58ec43['query'][_0x4f0f('0x3d')]+'%'};return _0x2d58b0;}})});}_0x4e5f0d=_[_0x4f0f('0x3e')]({},_0x4e5f0d,_0x58ec43[_0x4f0f('0x40')]);var _0x1b91d7={'where':_0x4e5f0d[_0x4f0f('0x3b')]};return db[_0x4f0f('0x2b')][_0x4f0f('0x1f')](_0x1b91d7)[_0x4f0f('0x25')](function(_0x2659b0){_0x1f4e1d[_0x4f0f('0x1f')]=_0x2659b0;if(_0x58ec43[_0x4f0f('0x31')]['includeAll']){_0x4e5f0d[_0x4f0f('0x41')]=[{'all':!![]}];}return db[_0x4f0f('0x2b')][_0x4f0f('0x42')](_0x4e5f0d);})[_0x4f0f('0x25')](function(_0x419cb4){_0x1f4e1d[_0x4f0f('0x43')]=_0x419cb4;return _0x1f4e1d;})[_0x4f0f('0x25')](respondWithFilteredResult(_0xa8a240,_0x4e5f0d))['catch'](handleError(_0xa8a240,null));};exports[_0x4f0f('0x44')]=function(_0x2e30d6,_0x1d8017){var _0x2bf0b3={'raw':!![],'where':{'id':_0x2e30d6[_0x4f0f('0x45')]['id']}},_0x1744f9={};_0x1744f9['model']=_[_0x4f0f('0x30')](db[_0x4f0f('0x2b')]['rawAttributes']);_0x1744f9['query']=_[_0x4f0f('0x30')](_0x2e30d6[_0x4f0f('0x31')]);_0x1744f9[_0x4f0f('0x32')]=_['intersection'](_0x1744f9[_0x4f0f('0x2e')],_0x1744f9['query']);_0x2bf0b3['attributes']=_[_0x4f0f('0x33')](_0x1744f9[_0x4f0f('0x2e')],qs[_0x4f0f('0x35')](_0x2e30d6[_0x4f0f('0x31')][_0x4f0f('0x35')]));_0x2bf0b3[_0x4f0f('0x34')]=_0x2bf0b3['attributes']['length']?_0x2bf0b3[_0x4f0f('0x34')]:_0x1744f9[_0x4f0f('0x2e')];if(_0x2e30d6[_0x4f0f('0x31')]['includeAll']){_0x2bf0b3[_0x4f0f('0x41')]=[{'all':!![]}];}_0x2bf0b3=_[_0x4f0f('0x3e')]({},_0x2bf0b3,_0x2e30d6[_0x4f0f('0x40')]);return db['ChatQueueReport'][_0x4f0f('0x46')](_0x2bf0b3)['then'](handleEntityNotFound(_0x1d8017,null))[_0x4f0f('0x25')](respondWithResult(_0x1d8017,null))['catch'](handleError(_0x1d8017,null));};exports[_0x4f0f('0x47')]=function(_0x3f2c6e,_0x2b0d3e){return db[_0x4f0f('0x2b')][_0x4f0f('0x47')](_0x3f2c6e['body'],{})['then'](respondWithResult(_0x2b0d3e,0xc9))[_0x4f0f('0x48')](handleError(_0x2b0d3e,null));};exports['update']=function(_0x12e587,_0x32d298){if(_0x12e587[_0x4f0f('0x49')]['id']){delete _0x12e587[_0x4f0f('0x49')]['id'];}return db[_0x4f0f('0x2b')][_0x4f0f('0x46')]({'where':{'id':_0x12e587[_0x4f0f('0x45')]['id']}})[_0x4f0f('0x25')](handleEntityNotFound(_0x32d298,null))['then'](saveUpdates(_0x12e587[_0x4f0f('0x49')],null))[_0x4f0f('0x25')](respondWithResult(_0x32d298,null))[_0x4f0f('0x48')](handleError(_0x32d298,null));};exports[_0x4f0f('0x4a')]=function(_0x355517,_0x3262a6){return db[_0x4f0f('0x2b')][_0x4f0f('0x46')]({'where':{'id':_0x355517[_0x4f0f('0x45')]['id']}})[_0x4f0f('0x25')](handleEntityNotFound(_0x3262a6,null))['then'](removeEntity(_0x3262a6,null))[_0x4f0f('0x48')](handleError(_0x3262a6,null));};exports['describe']=function(_0x3909c0,_0x36d13a){return db['ChatQueueReport'][_0x4f0f('0x4b')]()[_0x4f0f('0x25')](respondWithResult(_0x36d13a,null))[_0x4f0f('0x48')](handleError(_0x36d13a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0c7742e..dee1a6c 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x4c34d8,_0x383073){var _0x4c21df=function(_0x36150e){while(--_0x36150e){_0x4c34d8['push'](_0x4c34d8['shift']());}};_0x4c21df(++_0x383073);}(_0xe706,0xa3));var _0x6e70=function(_0xd6db21,_0x1d08f3){_0xd6db21=_0xd6db21-0x0;var _0x3b96a0=_0xe706[_0xd6db21];return _0x3b96a0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 57a3cde..bf18c62 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 _0x397a=['options','raw','UpdateChatQueueReport','ChatQueueReport','update','attributes','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','body'];(function(_0x5e75af,_0x3095f4){var _0xb5d271=function(_0x43155f){while(--_0x43155f){_0x5e75af['push'](_0x5e75af['shift']());}};_0xb5d271(++_0x3095f4);}(_0x397a,0x1b9));var _0xa397=function(_0x7f38f1,_0x5f10e4){_0x7f38f1=_0x7f38f1-0x0;var _0xf7aec5=_0x397a[_0x7f38f1];return _0xf7aec5;};'use strict';var _=require(_0xa397('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa397('0x1'));var rs=require(_0xa397('0x2'));var fs=require('fs');var Redis=require(_0xa397('0x3'));var db=require(_0xa397('0x4'))['db'];var utils=require(_0xa397('0x5'));var logger=require(_0xa397('0x6'))(_0xa397('0x7'));var config=require(_0xa397('0x8'));var jayson=require(_0xa397('0x9'));var client=jayson[_0xa397('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca07d,_0x4b2863,_0x3e9c24){return new BPromise(function(_0x2c8f90,_0x285d10){return client[_0xa397('0xb')](_0x4ca07d,_0x3e9c24)[_0xa397('0xc')](function(_0x38dada){logger[_0xa397('0xd')](_0xa397('0xe'),_0x4b2863,_0xa397('0xf'));logger['debug'](_0xa397('0x10'),_0x4b2863,'request\x20sent',JSON[_0xa397('0x11')](_0x38dada));if(_0x38dada[_0xa397('0x12')]){if(_0x38dada[_0xa397('0x12')]['code']===0x1f4){logger[_0xa397('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4b2863,_0x38dada[_0xa397('0x12')]['message']);return _0x285d10(_0x38dada[_0xa397('0x12')][_0xa397('0x13')]);}logger[_0xa397('0x12')](_0xa397('0xe'),_0x4b2863,_0x38dada[_0xa397('0x12')][_0xa397('0x13')]);return _0x2c8f90(_0x38dada['error'][_0xa397('0x13')]);}else{logger[_0xa397('0xd')](_0xa397('0xe'),_0x4b2863,_0xa397('0xf'));_0x2c8f90(_0x38dada[_0xa397('0x14')][_0xa397('0x13')]);}})[_0xa397('0x15')](function(_0xf868c3){logger[_0xa397('0x12')](_0xa397('0xe'),_0x4b2863,_0xf868c3);_0x285d10(_0xf868c3);});});}exports[_0xa397('0x16')]=function(_0x239172){var _0x57e55d=this;return new Promise(function(_0x217f44,_0x2bd065){return db['ChatQueueReport']['create'](_0x239172[_0xa397('0x17')],{'raw':_0x239172[_0xa397('0x18')]?_0x239172['options'][_0xa397('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x39b373){logger['info'](_0xa397('0x16'),_0x239172);logger['debug']('CreateChatQueueReport',_0x239172,JSON[_0xa397('0x11')](_0x39b373));_0x217f44(_0x39b373);})[_0xa397('0x15')](function(_0x47ed89){logger[_0xa397('0x12')](_0xa397('0x16'),_0x47ed89[_0xa397('0x13')],_0x239172);_0x2bd065(_0x57e55d[_0xa397('0x12')](0x1f4,_0x47ed89[_0xa397('0x13')]));});});};exports[_0xa397('0x1a')]=function(_0x377ecc){var _0x5de296=this;return new Promise(function(_0x4c16c9,_0x5d3e23){return db[_0xa397('0x1b')][_0xa397('0x1c')](_0x377ecc[_0xa397('0x17')],{'raw':_0x377ecc[_0xa397('0x18')]?_0x377ecc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x377ecc[_0xa397('0x18')]?_0x377ecc[_0xa397('0x18')]['where']||null:null,'attributes':_0x377ecc[_0xa397('0x18')]?_0x377ecc[_0xa397('0x18')][_0xa397('0x1d')]||null:null,'limit':_0x377ecc['options']?_0x377ecc[_0xa397('0x18')]['limit']||null:null})[_0xa397('0xc')](function(_0x227be4){logger[_0xa397('0xd')](_0xa397('0x1a'),_0x377ecc);logger[_0xa397('0x1e')]('UpdateChatQueueReport',_0x377ecc,JSON[_0xa397('0x11')](_0x227be4));_0x4c16c9(_0x227be4);})[_0xa397('0x15')](function(_0x55762c){logger[_0xa397('0x12')]('UpdateChatQueueReport',_0x55762c[_0xa397('0x13')],_0x377ecc);_0x5d3e23(_0x5de296[_0xa397('0x12')](0x1f4,_0x55762c[_0xa397('0x13')]));});});}; \ No newline at end of file +var _0x7113=['stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','info','debug','catch','UpdateChatQueueReport','update','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x401974,_0x10b6ea){var _0x38b6c7=function(_0xb05ad6){while(--_0xb05ad6){_0x401974['push'](_0x401974['shift']());}};_0x38b6c7(++_0x10b6ea);}(_0x7113,0x19e));var _0x3711=function(_0x4681f4,_0xf1477c){_0x4681f4=_0x4681f4-0x0;var _0xf6db13=_0x7113[_0x4681f4];return _0xf6db13;};'use strict';var _=require(_0x3711('0x0'));var util=require(_0x3711('0x1'));var moment=require(_0x3711('0x2'));var BPromise=require('bluebird');var rs=require(_0x3711('0x3'));var fs=require('fs');var Redis=require(_0x3711('0x4'));var db=require(_0x3711('0x5'))['db'];var utils=require(_0x3711('0x6'));var logger=require(_0x3711('0x7'))(_0x3711('0x8'));var config=require(_0x3711('0x9'));var jayson=require(_0x3711('0xa'));var client=jayson[_0x3711('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5302,_0x1cc4ba,_0x319855){return new BPromise(function(_0x1221fb,_0x27b0be){return client['request'](_0x3a5302,_0x319855)[_0x3711('0xc')](function(_0x5f0806){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1cc4ba,_0x3711('0xd'));logger['debug'](_0x3711('0xe'),_0x1cc4ba,_0x3711('0xd'),JSON[_0x3711('0xf')](_0x5f0806));if(_0x5f0806['error']){if(_0x5f0806[_0x3711('0x10')][_0x3711('0x11')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1cc4ba,_0x5f0806[_0x3711('0x10')][_0x3711('0x12')]);return _0x27b0be(_0x5f0806[_0x3711('0x10')][_0x3711('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1cc4ba,_0x5f0806[_0x3711('0x10')]['message']);return _0x1221fb(_0x5f0806['error']['message']);}else{logger['info'](_0x3711('0x13'),_0x1cc4ba,_0x3711('0xd'));_0x1221fb(_0x5f0806[_0x3711('0x14')]['message']);}})['catch'](function(_0x8e9042){logger[_0x3711('0x10')](_0x3711('0x13'),_0x1cc4ba,_0x8e9042);_0x27b0be(_0x8e9042);});});}exports[_0x3711('0x15')]=function(_0x3a3bf6){var _0x27238d=this;return new Promise(function(_0x55eaa2,_0x166303){return db[_0x3711('0x16')]['create'](_0x3a3bf6[_0x3711('0x17')],{'raw':_0x3a3bf6[_0x3711('0x18')]?_0x3a3bf6[_0x3711('0x18')][_0x3711('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xe1afda){logger[_0x3711('0x1a')](_0x3711('0x15'),_0x3a3bf6);logger[_0x3711('0x1b')](_0x3711('0x15'),_0x3a3bf6,JSON[_0x3711('0xf')](_0xe1afda));_0x55eaa2(_0xe1afda);})[_0x3711('0x1c')](function(_0x4739b3){logger[_0x3711('0x10')](_0x3711('0x15'),_0x4739b3[_0x3711('0x12')],_0x3a3bf6);_0x166303(_0x27238d[_0x3711('0x10')](0x1f4,_0x4739b3['message']));});});};exports[_0x3711('0x1d')]=function(_0x1f6b7c){var _0x670182=this;return new Promise(function(_0x344abc,_0x48236f){return db[_0x3711('0x16')][_0x3711('0x1e')](_0x1f6b7c[_0x3711('0x17')],{'raw':_0x1f6b7c['options']?_0x1f6b7c[_0x3711('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f6b7c['options']?_0x1f6b7c[_0x3711('0x18')]['where']||null:null,'attributes':_0x1f6b7c[_0x3711('0x18')]?_0x1f6b7c[_0x3711('0x18')][_0x3711('0x1f')]||null:null,'limit':_0x1f6b7c['options']?_0x1f6b7c['options'][_0x3711('0x20')]||null:null})[_0x3711('0xc')](function(_0xc4ade7){logger[_0x3711('0x1a')](_0x3711('0x1d'),_0x1f6b7c);logger[_0x3711('0x1b')](_0x3711('0x1d'),_0x1f6b7c,JSON[_0x3711('0xf')](_0xc4ade7));_0x344abc(_0xc4ade7);})[_0x3711('0x1c')](function(_0xf5b9ac){logger['error'](_0x3711('0x1d'),_0xf5b9ac[_0x3711('0x12')],_0x1f6b7c);_0x48236f(_0x670182['error'](0x1f4,_0xf5b9ac[_0x3711('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 25d898e..a889718 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 _0xb5bb=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy'];(function(_0x4a489f,_0x5402ab){var _0x4a4137=function(_0x4e35f3){while(--_0x4e35f3){_0x4a489f['push'](_0x4a489f['shift']());}};_0x4a4137(++_0x5402ab);}(_0xb5bb,0x1cd));var _0xbb5b=function(_0x5131d6,_0x7d0af2){_0x5131d6=_0x5131d6-0x0;var _0xde5e11=_0xb5bb[_0x5131d6];return _0xde5e11;};'use strict';var multer=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var path=require(_0xbb5b('0x2'));var timeout=require(_0xbb5b('0x3'));var express=require(_0xbb5b('0x4'));var router=express[_0xbb5b('0x5')]();var fs_extra=require(_0xbb5b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb5b('0x7'));var controller=require(_0xbb5b('0x8'));router[_0xbb5b('0x9')]('/',auth[_0xbb5b('0xa')](),controller[_0xbb5b('0xb')]);router[_0xbb5b('0x9')](_0xbb5b('0xc'),auth[_0xbb5b('0xa')](),controller['describe']);router[_0xbb5b('0x9')](_0xbb5b('0xd'),auth[_0xbb5b('0xa')](),controller[_0xbb5b('0xe')]);router[_0xbb5b('0xf')]('/',auth[_0xbb5b('0xa')](),controller[_0xbb5b('0x10')]);router['put'](_0xbb5b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbb5b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbb5b('0x12')]);module[_0xbb5b('0x13')]=router; \ No newline at end of file +var _0xcf2a=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','util','connect-timeout','express','Router','../../components/auth/service','./chatQueueReport.controller'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0xcf2a,0xd2));var _0xacf2=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xcf2a[_0x2b91c5];return _0xbd5531;};'use strict';var multer=require('multer');var util=require(_0xacf2('0x0'));var path=require('path');var timeout=require(_0xacf2('0x1'));var express=require(_0xacf2('0x2'));var router=express[_0xacf2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xacf2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xacf2('0x5'));router[_0xacf2('0x6')]('/',auth[_0xacf2('0x7')](),controller[_0xacf2('0x8')]);router[_0xacf2('0x6')](_0xacf2('0x9'),auth[_0xacf2('0x7')](),controller[_0xacf2('0xa')]);router[_0xacf2('0x6')]('/:id',auth[_0xacf2('0x7')](),controller[_0xacf2('0xb')]);router[_0xacf2('0xc')]('/',auth[_0xacf2('0x7')](),controller[_0xacf2('0xd')]);router[_0xacf2('0xe')](_0xacf2('0xf'),auth[_0xacf2('0x7')](),controller[_0xacf2('0x10')]);router[_0xacf2('0x11')](_0xacf2('0xf'),auth[_0xacf2('0x7')](),controller['destroy']);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 c5b3b7e..848046d 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x24a43a,_0xc7767c){var _0x4afb06=function(_0x6c8806){while(--_0x6c8806){_0x24a43a['push'](_0x24a43a['shift']());}};_0x4afb06(++_0xc7767c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b4c52,_0x387ec2){_0x4b4c52=_0x4b4c52-0x0;var _0x4d0dec=_0xedd9[_0x4b4c52];return _0x4d0dec;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5287a5,_0x3ff0ad){var _0x158a73=function(_0x351f02){while(--_0x351f02){_0x5287a5['push'](_0x5287a5['shift']());}};_0x158a73(++_0x3ff0ad);}(_0x54ef,0x112));var _0xf54e=function(_0x41cd58,_0x41a9a8){_0x41cd58=_0x41cd58-0x0;var _0x5b8e70=_0x54ef[_0x41cd58];return _0x5b8e70;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c4f796d..55908fc 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 _0x8ae9=['bluebird','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','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','send','index','map','rawAttributes','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','find','catch','create','update','body','params','describe','eml-format','rimraf','moment'];(function(_0x525ca2,_0x2fb2b8){var _0x3fa129=function(_0x14a150){while(--_0x14a150){_0x525ca2['push'](_0x525ca2['shift']());}};_0x3fa129(++_0x2fb2b8);}(_0x8ae9,0x179));var _0x98ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ae9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x98ae('0x0'));var rimraf=require(_0x98ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x98ae('0x2'));var BPromise=require(_0x98ae('0x3'));var Mustache=require(_0x98ae('0x4'));var util=require('util');var path=require('path');var sox=require(_0x98ae('0x5'));var csv=require(_0x98ae('0x6'));var ejs=require(_0x98ae('0x7'));var fs=require('fs');var fs_extra=require(_0x98ae('0x8'));var _=require('lodash');var squel=require(_0x98ae('0x9'));var crypto=require(_0x98ae('0xa'));var jsforce=require(_0x98ae('0xb'));var deskjs=require(_0x98ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x98ae('0xd'));var Papa=require(_0x98ae('0xe'));var Redis=require(_0x98ae('0xf'));var authService=require(_0x98ae('0x10'));var qs=require(_0x98ae('0x11'));var as=require(_0x98ae('0x12'));var hardwareService=require(_0x98ae('0x13'));var logger=require(_0x98ae('0x14'))(_0x98ae('0x15'));var utils=require('../../config/utils');var config=require(_0x98ae('0x16'));var licenseUtil=require(_0x98ae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c85a2,_0x1637d7){_0x1637d7=_0x1637d7||0xcc;return function(_0x1e4575){if(_0x1e4575){return _0x1c85a2[_0x98ae('0x18')](_0x1637d7);}return _0x1c85a2['status'](_0x1637d7)[_0x98ae('0x19')]();};}function respondWithResult(_0x4431f4,_0x5bc227){_0x5bc227=_0x5bc227||0xc8;return function(_0x42fbbf){if(_0x42fbbf){return _0x4431f4[_0x98ae('0x1a')](_0x5bc227)[_0x98ae('0x1b')](_0x42fbbf);}};}function respondWithFilteredResult(_0x5e7578,_0x3d3861){return function(_0x53604e){if(_0x53604e){var _0x3476f1=typeof _0x3d3861['offset']==='undefined'&&typeof _0x3d3861[_0x98ae('0x1c')]===_0x98ae('0x1d');var _0x1b6e20=_0x53604e[_0x98ae('0x1e')];var _0x47cfdc=_0x3476f1?0x0:_0x3d3861[_0x98ae('0x1f')];var _0x56cf48=_0x3476f1?_0x53604e[_0x98ae('0x1e')]:_0x3d3861[_0x98ae('0x1f')]+_0x3d3861[_0x98ae('0x1c')];var _0x4804f5;if(_0x56cf48>=_0x1b6e20){_0x56cf48=_0x1b6e20;_0x4804f5=0xc8;}else{_0x4804f5=0xce;}_0x5e7578['status'](_0x4804f5);return _0x5e7578[_0x98ae('0x20')](_0x98ae('0x21'),_0x47cfdc+'-'+_0x56cf48+'/'+_0x1b6e20)[_0x98ae('0x1b')](_0x53604e);}return null;};}function patchUpdates(_0x521314){return function(_0x828d9){try{jsonpatch[_0x98ae('0x22')](_0x828d9,_0x521314,!![]);}catch(_0x29bb80){return BPromise['reject'](_0x29bb80);}return _0x828d9[_0x98ae('0x23')]();};}function saveUpdates(_0x4721dd,_0x198491){return function(_0x54b7fd){if(_0x54b7fd){return _0x54b7fd['update'](_0x4721dd)[_0x98ae('0x24')](function(_0x6b7ee0){return _0x6b7ee0;});}return null;};}function removeEntity(_0x455449,_0x47efeb){return function(_0x122d22){if(_0x122d22){return _0x122d22[_0x98ae('0x25')]()[_0x98ae('0x24')](function(){_0x455449['status'](0xcc)[_0x98ae('0x19')]();});}};}function handleEntityNotFound(_0x1c46da,_0x4aa449){return function(_0x59146a){if(!_0x59146a){_0x1c46da['sendStatus'](0x194);}return _0x59146a;};}function handleError(_0x587ca8,_0x3f308e){_0x3f308e=_0x3f308e||0x1f4;return function(_0x1b96d8){logger[_0x98ae('0x26')](_0x1b96d8[_0x98ae('0x27')]);if(_0x1b96d8['name']){delete _0x1b96d8['name'];}_0x587ca8[_0x98ae('0x1a')](_0x3f308e)[_0x98ae('0x28')](_0x1b96d8);};}exports[_0x98ae('0x29')]=function(_0x45a0e3,_0xd42fa){var _0xc2a637={},_0x2c43f0={},_0x25f782={'count':0x0,'rows':[]};var _0x4560ae=_[_0x98ae('0x2a')](db['ChatTransferReport'][_0x98ae('0x2b')],function(_0x239d35){return{'name':_0x239d35['fieldName'],'type':_0x239d35['type'][_0x98ae('0x2c')]};});_0x2c43f0[_0x98ae('0x2d')]=_[_0x98ae('0x2a')](_0x4560ae,_0x98ae('0x2e'));_0x2c43f0[_0x98ae('0x2f')]=_[_0x98ae('0x30')](_0x45a0e3[_0x98ae('0x2f')]);_0x2c43f0[_0x98ae('0x31')]=_['intersection'](_0x2c43f0[_0x98ae('0x2d')],_0x2c43f0[_0x98ae('0x2f')]);_0xc2a637[_0x98ae('0x32')]=_[_0x98ae('0x33')](_0x2c43f0[_0x98ae('0x2d')],qs[_0x98ae('0x34')](_0x45a0e3['query'][_0x98ae('0x34')]));_0xc2a637[_0x98ae('0x32')]=_0xc2a637[_0x98ae('0x32')][_0x98ae('0x35')]?_0xc2a637['attributes']:_0x2c43f0[_0x98ae('0x2d')];if(!_0x45a0e3['query'][_0x98ae('0x36')](_0x98ae('0x37'))){_0xc2a637['limit']=qs[_0x98ae('0x1c')](_0x45a0e3[_0x98ae('0x2f')]['limit']);_0xc2a637[_0x98ae('0x1f')]=qs[_0x98ae('0x1f')](_0x45a0e3['query'][_0x98ae('0x1f')]);}_0xc2a637[_0x98ae('0x38')]=qs[_0x98ae('0x39')](_0x45a0e3[_0x98ae('0x2f')][_0x98ae('0x39')]);_0xc2a637[_0x98ae('0x3a')]=qs[_0x98ae('0x31')](_['pick'](_0x45a0e3[_0x98ae('0x2f')],_0x2c43f0[_0x98ae('0x31')]),_0x4560ae);if(_0x45a0e3['query'][_0x98ae('0x3b')]){_0xc2a637['where']=_[_0x98ae('0x3c')](_0xc2a637[_0x98ae('0x3a')],{'$or':_[_0x98ae('0x2a')](_0x4560ae,function(_0xe0e73e){if(_0xe0e73e[_0x98ae('0x3d')]!==_0x98ae('0x3e')){var _0x333e0f={};_0x333e0f[_0xe0e73e[_0x98ae('0x2e')]]={'$like':'%'+_0x45a0e3[_0x98ae('0x2f')][_0x98ae('0x3b')]+'%'};return _0x333e0f;}})});}_0xc2a637=_['merge']({},_0xc2a637,_0x45a0e3[_0x98ae('0x3f')]);var _0x11da84={'where':_0xc2a637['where']};return db[_0x98ae('0x40')]['count'](_0x11da84)[_0x98ae('0x24')](function(_0x597d8f){_0x25f782[_0x98ae('0x1e')]=_0x597d8f;if(_0x45a0e3['query'][_0x98ae('0x41')]){_0xc2a637[_0x98ae('0x42')]=[{'all':!![]}];}return db[_0x98ae('0x40')][_0x98ae('0x43')](_0xc2a637);})['then'](function(_0x3ddf84){_0x25f782[_0x98ae('0x44')]=_0x3ddf84;return _0x25f782;})['then'](respondWithFilteredResult(_0xd42fa,_0xc2a637))['catch'](handleError(_0xd42fa,null));};exports['show']=function(_0x51af6e,_0x39f94b){var _0x39293b={'raw':!![],'where':{'id':_0x51af6e['params']['id']}},_0x363cb0={};_0x363cb0[_0x98ae('0x2d')]=_['keys'](db[_0x98ae('0x40')][_0x98ae('0x2b')]);_0x363cb0[_0x98ae('0x2f')]=_[_0x98ae('0x30')](_0x51af6e[_0x98ae('0x2f')]);_0x363cb0[_0x98ae('0x31')]=_['intersection'](_0x363cb0[_0x98ae('0x2d')],_0x363cb0['query']);_0x39293b[_0x98ae('0x32')]=_[_0x98ae('0x33')](_0x363cb0['model'],qs[_0x98ae('0x34')](_0x51af6e[_0x98ae('0x2f')][_0x98ae('0x34')]));_0x39293b[_0x98ae('0x32')]=_0x39293b[_0x98ae('0x32')][_0x98ae('0x35')]?_0x39293b[_0x98ae('0x32')]:_0x363cb0[_0x98ae('0x2d')];if(_0x51af6e[_0x98ae('0x2f')][_0x98ae('0x41')]){_0x39293b[_0x98ae('0x42')]=[{'all':!![]}];}_0x39293b=_['merge']({},_0x39293b,_0x51af6e[_0x98ae('0x3f')]);return db['ChatTransferReport'][_0x98ae('0x45')](_0x39293b)[_0x98ae('0x24')](handleEntityNotFound(_0x39f94b,null))[_0x98ae('0x24')](respondWithResult(_0x39f94b,null))[_0x98ae('0x46')](handleError(_0x39f94b,null));};exports[_0x98ae('0x47')]=function(_0x2e7b9e,_0x2ed29a){return db['ChatTransferReport'][_0x98ae('0x47')](_0x2e7b9e['body'],{})['then'](respondWithResult(_0x2ed29a,0xc9))[_0x98ae('0x46')](handleError(_0x2ed29a,null));};exports[_0x98ae('0x48')]=function(_0x52a33c,_0x2b76b0){if(_0x52a33c[_0x98ae('0x49')]['id']){delete _0x52a33c[_0x98ae('0x49')]['id'];}return db[_0x98ae('0x40')][_0x98ae('0x45')]({'where':{'id':_0x52a33c['params']['id']}})[_0x98ae('0x24')](handleEntityNotFound(_0x2b76b0,null))['then'](saveUpdates(_0x52a33c[_0x98ae('0x49')],null))[_0x98ae('0x24')](respondWithResult(_0x2b76b0,null))[_0x98ae('0x46')](handleError(_0x2b76b0,null));};exports[_0x98ae('0x25')]=function(_0x2f3173,_0xa4e569){return db[_0x98ae('0x40')][_0x98ae('0x45')]({'where':{'id':_0x2f3173[_0x98ae('0x4a')]['id']}})[_0x98ae('0x24')](handleEntityNotFound(_0xa4e569,null))[_0x98ae('0x24')](removeEntity(_0xa4e569,null))[_0x98ae('0x46')](handleError(_0xa4e569,null));};exports['describe']=function(_0x1bfa95,_0x4dae2c){return db[_0x98ae('0x40')][_0x98ae('0x4b')]()[_0x98ae('0x24')](respondWithResult(_0x4dae2c,null))[_0x98ae('0x46')](handleError(_0x4dae2c,null));}; \ No newline at end of file +var _0x195e=['hasOwnProperty','order','sort','filters','pick','merge','VIRTUAL','name','filter','where','catch','show','includeAll','include','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length'];(function(_0x44dbea,_0x1db45d){var _0x47c705=function(_0x1622b4){while(--_0x1622b4){_0x44dbea['push'](_0x44dbea['shift']());}};_0x47c705(++_0x1db45d);}(_0x195e,0xf2));var _0xe195=function(_0x4be30e,_0x5e98b9){_0x4be30e=_0x4be30e-0x0;var _0x37e375=_0x195e[_0x4be30e];return _0x37e375;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe195('0x0'));var zipdir=require(_0xe195('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe195('0x2'));var moment=require('moment');var BPromise=require(_0xe195('0x3'));var Mustache=require(_0xe195('0x4'));var util=require(_0xe195('0x5'));var path=require('path');var sox=require(_0xe195('0x6'));var csv=require('to-csv');var ejs=require(_0xe195('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0x8'));var squel=require(_0xe195('0x9'));var crypto=require(_0xe195('0xa'));var jsforce=require(_0xe195('0xb'));var deskjs=require(_0xe195('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe195('0xd'));var Papa=require(_0xe195('0xe'));var Redis=require(_0xe195('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe195('0x10'));var as=require(_0xe195('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x12'))('api');var utils=require(_0xe195('0x13'));var config=require(_0xe195('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe195('0x15'))['db'];function respondWithStatusCode(_0xb6142f,_0x332c43){_0x332c43=_0x332c43||0xcc;return function(_0x258b02){if(_0x258b02){return _0xb6142f['sendStatus'](_0x332c43);}return _0xb6142f[_0xe195('0x16')](_0x332c43)[_0xe195('0x17')]();};}function respondWithResult(_0x7331dd,_0x1b7cd5){_0x1b7cd5=_0x1b7cd5||0xc8;return function(_0x28dc85){if(_0x28dc85){return _0x7331dd[_0xe195('0x16')](_0x1b7cd5)[_0xe195('0x18')](_0x28dc85);}};}function respondWithFilteredResult(_0x420481,_0x12df12){return function(_0x234152){if(_0x234152){var _0x496580=typeof _0x12df12[_0xe195('0x19')]===_0xe195('0x1a')&&typeof _0x12df12['limit']===_0xe195('0x1a');var _0xc7dc28=_0x234152['count'];var _0x4e5299=_0x496580?0x0:_0x12df12[_0xe195('0x19')];var _0x428f68=_0x496580?_0x234152[_0xe195('0x1b')]:_0x12df12['offset']+_0x12df12[_0xe195('0x1c')];var _0x44a53f;if(_0x428f68>=_0xc7dc28){_0x428f68=_0xc7dc28;_0x44a53f=0xc8;}else{_0x44a53f=0xce;}_0x420481[_0xe195('0x16')](_0x44a53f);return _0x420481[_0xe195('0x1d')](_0xe195('0x1e'),_0x4e5299+'-'+_0x428f68+'/'+_0xc7dc28)[_0xe195('0x18')](_0x234152);}return null;};}function patchUpdates(_0x2c3a77){return function(_0x32e9b5){try{jsonpatch[_0xe195('0x1f')](_0x32e9b5,_0x2c3a77,!![]);}catch(_0x684d78){return BPromise[_0xe195('0x20')](_0x684d78);}return _0x32e9b5[_0xe195('0x21')]();};}function saveUpdates(_0x52ae8d,_0x289c67){return function(_0xd8c662){if(_0xd8c662){return _0xd8c662[_0xe195('0x22')](_0x52ae8d)[_0xe195('0x23')](function(_0x3bb32c){return _0x3bb32c;});}return null;};}function removeEntity(_0x297e6d,_0x468021){return function(_0x4e72c8){if(_0x4e72c8){return _0x4e72c8[_0xe195('0x24')]()['then'](function(){_0x297e6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aa58,_0x121e52){return function(_0x50bfdd){if(!_0x50bfdd){_0x38aa58[_0xe195('0x25')](0x194);}return _0x50bfdd;};}function handleError(_0x13e130,_0x4a0b47){_0x4a0b47=_0x4a0b47||0x1f4;return function(_0x2fc75d){logger[_0xe195('0x26')](_0x2fc75d[_0xe195('0x27')]);if(_0x2fc75d['name']){delete _0x2fc75d['name'];}_0x13e130[_0xe195('0x16')](_0x4a0b47)['send'](_0x2fc75d);};}exports[_0xe195('0x28')]=function(_0x36aac3,_0x3c3a11){var _0xb3a8cd={},_0x102770={},_0x12a736={'count':0x0,'rows':[]};var _0x8bec4f=_[_0xe195('0x29')](db[_0xe195('0x2a')][_0xe195('0x2b')],function(_0x4c6a8c){return{'name':_0x4c6a8c[_0xe195('0x2c')],'type':_0x4c6a8c[_0xe195('0x2d')][_0xe195('0x2e')]};});_0x102770['model']=_[_0xe195('0x29')](_0x8bec4f,'name');_0x102770['query']=_[_0xe195('0x2f')](_0x36aac3[_0xe195('0x30')]);_0x102770['filters']=_[_0xe195('0x31')](_0x102770[_0xe195('0x32')],_0x102770[_0xe195('0x30')]);_0xb3a8cd['attributes']=_[_0xe195('0x31')](_0x102770['model'],qs[_0xe195('0x33')](_0x36aac3['query'][_0xe195('0x33')]));_0xb3a8cd[_0xe195('0x34')]=_0xb3a8cd[_0xe195('0x34')][_0xe195('0x35')]?_0xb3a8cd['attributes']:_0x102770[_0xe195('0x32')];if(!_0x36aac3[_0xe195('0x30')][_0xe195('0x36')]('nolimit')){_0xb3a8cd['limit']=qs[_0xe195('0x1c')](_0x36aac3[_0xe195('0x30')][_0xe195('0x1c')]);_0xb3a8cd['offset']=qs[_0xe195('0x19')](_0x36aac3[_0xe195('0x30')][_0xe195('0x19')]);}_0xb3a8cd[_0xe195('0x37')]=qs[_0xe195('0x38')](_0x36aac3[_0xe195('0x30')]['sort']);_0xb3a8cd['where']=qs[_0xe195('0x39')](_[_0xe195('0x3a')](_0x36aac3['query'],_0x102770[_0xe195('0x39')]),_0x8bec4f);if(_0x36aac3[_0xe195('0x30')]['filter']){_0xb3a8cd['where']=_[_0xe195('0x3b')](_0xb3a8cd['where'],{'$or':_[_0xe195('0x29')](_0x8bec4f,function(_0x2c6576){if(_0x2c6576['type']!==_0xe195('0x3c')){var _0x433dc2={};_0x433dc2[_0x2c6576[_0xe195('0x3d')]]={'$like':'%'+_0x36aac3['query'][_0xe195('0x3e')]+'%'};return _0x433dc2;}})});}_0xb3a8cd=_[_0xe195('0x3b')]({},_0xb3a8cd,_0x36aac3['options']);var _0x2d68d8={'where':_0xb3a8cd[_0xe195('0x3f')]};return db['ChatTransferReport'][_0xe195('0x1b')](_0x2d68d8)['then'](function(_0x2a5f23){_0x12a736[_0xe195('0x1b')]=_0x2a5f23;if(_0x36aac3[_0xe195('0x30')]['includeAll']){_0xb3a8cd['include']=[{'all':!![]}];}return db[_0xe195('0x2a')]['findAll'](_0xb3a8cd);})[_0xe195('0x23')](function(_0x4139f0){_0x12a736['rows']=_0x4139f0;return _0x12a736;})[_0xe195('0x23')](respondWithFilteredResult(_0x3c3a11,_0xb3a8cd))[_0xe195('0x40')](handleError(_0x3c3a11,null));};exports[_0xe195('0x41')]=function(_0x138e97,_0x4f6be4){var _0x471b32={'raw':!![],'where':{'id':_0x138e97['params']['id']}},_0x712cfa={};_0x712cfa[_0xe195('0x32')]=_['keys'](db[_0xe195('0x2a')][_0xe195('0x2b')]);_0x712cfa['query']=_[_0xe195('0x2f')](_0x138e97[_0xe195('0x30')]);_0x712cfa['filters']=_['intersection'](_0x712cfa['model'],_0x712cfa[_0xe195('0x30')]);_0x471b32[_0xe195('0x34')]=_[_0xe195('0x31')](_0x712cfa[_0xe195('0x32')],qs['fields'](_0x138e97[_0xe195('0x30')]['fields']));_0x471b32[_0xe195('0x34')]=_0x471b32[_0xe195('0x34')][_0xe195('0x35')]?_0x471b32[_0xe195('0x34')]:_0x712cfa['model'];if(_0x138e97[_0xe195('0x30')][_0xe195('0x42')]){_0x471b32[_0xe195('0x43')]=[{'all':!![]}];}_0x471b32=_[_0xe195('0x3b')]({},_0x471b32,_0x138e97[_0xe195('0x44')]);return db[_0xe195('0x2a')][_0xe195('0x45')](_0x471b32)['then'](handleEntityNotFound(_0x4f6be4,null))['then'](respondWithResult(_0x4f6be4,null))[_0xe195('0x40')](handleError(_0x4f6be4,null));};exports['create']=function(_0xb92e3c,_0x4cb542){return db[_0xe195('0x2a')][_0xe195('0x46')](_0xb92e3c['body'],{})['then'](respondWithResult(_0x4cb542,0xc9))['catch'](handleError(_0x4cb542,null));};exports['update']=function(_0x109411,_0x4bba5e){if(_0x109411[_0xe195('0x47')]['id']){delete _0x109411[_0xe195('0x47')]['id'];}return db['ChatTransferReport'][_0xe195('0x45')]({'where':{'id':_0x109411[_0xe195('0x48')]['id']}})[_0xe195('0x23')](handleEntityNotFound(_0x4bba5e,null))[_0xe195('0x23')](saveUpdates(_0x109411[_0xe195('0x47')],null))[_0xe195('0x23')](respondWithResult(_0x4bba5e,null))['catch'](handleError(_0x4bba5e,null));};exports[_0xe195('0x24')]=function(_0x3aebf7,_0x2e032d){return db['ChatTransferReport'][_0xe195('0x45')]({'where':{'id':_0x3aebf7[_0xe195('0x48')]['id']}})[_0xe195('0x23')](handleEntityNotFound(_0x2e032d,null))[_0xe195('0x23')](removeEntity(_0x2e032d,null))[_0xe195('0x40')](handleError(_0x2e032d,null));};exports['describe']=function(_0x537a0b,_0x32a144){return db['ChatTransferReport'][_0xe195('0x49')]()['then'](respondWithResult(_0x32a144,null))[_0xe195('0x40')](handleError(_0x32a144,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ca6daac..f6e3dfb 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 _0xc3b1=['request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4291b9,_0x52f3bd){var _0x1ab77a=function(_0x2b30bd){while(--_0x2b30bd){_0x4291b9['push'](_0x4291b9['shift']());}};_0x1ab77a(++_0x52f3bd);}(_0xc3b1,0x158));var _0x1c3b=function(_0x279b83,_0x1eeb64){_0x279b83=_0x279b83-0x0;var _0x3696be=_0xc3b1[_0x279b83];return _0x3696be;};'use strict';var _=require(_0x1c3b('0x0'));var util=require(_0x1c3b('0x1'));var logger=require(_0x1c3b('0x2'))(_0x1c3b('0x3'));var moment=require(_0x1c3b('0x4'));var BPromise=require(_0x1c3b('0x5'));var rp=require(_0x1c3b('0x6'));var fs=require('fs');var path=require(_0x1c3b('0x7'));var rimraf=require('rimraf');var config=require(_0x1c3b('0x8'));var attributes=require(_0x1c3b('0x9'));module[_0x1c3b('0xa')]=function(_0x83c234,_0x1ba6b){return _0x83c234[_0x1c3b('0xb')]('ChatTransferReport',attributes,{'tableName':_0x1c3b('0xc'),'paranoid':![],'indexes':[{'name':_0x1c3b('0xd'),'fields':[_0x1c3b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc83=['bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment'];(function(_0x44a72f,_0x7de5b3){var _0x56ff98=function(_0x398574){while(--_0x398574){_0x44a72f['push'](_0x44a72f['shift']());}};_0x56ff98(++_0x7de5b3);}(_0xcc83,0x1d8));var _0x3cc8=function(_0x69936b,_0x98c9f2){_0x69936b=_0x69936b-0x0;var _0x5c91c9=_0xcc83[_0x69936b];return _0x5c91c9;};'use strict';var _=require(_0x3cc8('0x0'));var util=require(_0x3cc8('0x1'));var logger=require('../../config/logger')(_0x3cc8('0x2'));var moment=require(_0x3cc8('0x3'));var BPromise=require(_0x3cc8('0x4'));var rp=require(_0x3cc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cc8('0x6'));var config=require(_0x3cc8('0x7'));var attributes=require(_0x3cc8('0x8'));module[_0x3cc8('0x9')]=function(_0x35979d,_0x442fd1){return _0x35979d[_0x3cc8('0xa')](_0x3cc8('0xb'),attributes,{'tableName':_0x3cc8('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3cc8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d00581b..dd17ffc 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 _0x691c=['rpc','../../config/environment','jayson/promise','client','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x691c,0xc3));var _0xc691=function(_0x79ef34,_0x42d1a1){_0x79ef34=_0x79ef34-0x0;var _0x43d708=_0x691c[_0x79ef34];return _0x43d708;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc691('0x0'));var BPromise=require(_0xc691('0x1'));var rs=require(_0xc691('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc691('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc691('0x4'))(_0xc691('0x5'));var config=require(_0xc691('0x6'));var jayson=require(_0xc691('0x7'));var client=jayson[_0xc691('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39e413,_0x209ba9,_0x2bf1b7){return new BPromise(function(_0x1e119e,_0x3f0a25){return client['request'](_0x39e413,_0x2bf1b7)[_0xc691('0x9')](function(_0x359ba9){logger['info'](_0xc691('0xa'),_0x209ba9,'request\x20sent');logger[_0xc691('0xb')](_0xc691('0xc'),_0x209ba9,_0xc691('0xd'),JSON['stringify'](_0x359ba9));if(_0x359ba9[_0xc691('0xe')]){if(_0x359ba9[_0xc691('0xe')][_0xc691('0xf')]===0x1f4){logger[_0xc691('0xe')](_0xc691('0xa'),_0x209ba9,_0x359ba9[_0xc691('0xe')][_0xc691('0x10')]);return _0x3f0a25(_0x359ba9[_0xc691('0xe')]['message']);}logger[_0xc691('0xe')](_0xc691('0xa'),_0x209ba9,_0x359ba9[_0xc691('0xe')][_0xc691('0x10')]);return _0x1e119e(_0x359ba9['error']['message']);}else{logger[_0xc691('0x11')](_0xc691('0xa'),_0x209ba9,'request\x20sent');_0x1e119e(_0x359ba9[_0xc691('0x12')]['message']);}})[_0xc691('0x13')](function(_0x5adf80){logger[_0xc691('0xe')](_0xc691('0xa'),_0x209ba9,_0x5adf80);_0x3f0a25(_0x5adf80);});});} \ No newline at end of file +var _0x694d=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x694d,0xba));var _0xd694=function(_0x92a846,_0x45ee42){_0x92a846=_0x92a846-0x0;var _0x1d39cb=_0x694d[_0x92a846];return _0x1d39cb;};'use strict';var _=require('lodash');var util=require(_0xd694('0x0'));var moment=require('moment');var BPromise=require(_0xd694('0x1'));var rs=require(_0xd694('0x2'));var fs=require('fs');var Redis=require(_0xd694('0x3'));var db=require(_0xd694('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd694('0x5'))('rpc');var config=require(_0xd694('0x6'));var jayson=require(_0xd694('0x7'));var client=jayson[_0xd694('0x8')][_0xd694('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272a87,_0x40f131,_0x54766a){return new BPromise(function(_0x350992,_0x2346af){return client[_0xd694('0xa')](_0x272a87,_0x54766a)['then'](function(_0x1a7215){logger['info'](_0xd694('0xb'),_0x40f131,_0xd694('0xc'));logger[_0xd694('0xd')](_0xd694('0xe'),_0x40f131,_0xd694('0xc'),JSON['stringify'](_0x1a7215));if(_0x1a7215[_0xd694('0xf')]){if(_0x1a7215[_0xd694('0xf')][_0xd694('0x10')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x40f131,_0x1a7215[_0xd694('0xf')][_0xd694('0x11')]);return _0x2346af(_0x1a7215[_0xd694('0xf')]['message']);}logger[_0xd694('0xf')](_0xd694('0xb'),_0x40f131,_0x1a7215[_0xd694('0xf')][_0xd694('0x11')]);return _0x350992(_0x1a7215[_0xd694('0xf')][_0xd694('0x11')]);}else{logger[_0xd694('0x12')](_0xd694('0xb'),_0x40f131,_0xd694('0xc'));_0x350992(_0x1a7215[_0xd694('0x13')]['message']);}})[_0xd694('0x14')](function(_0x2db9a0){logger[_0xd694('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x40f131,_0x2db9a0);_0x2346af(_0x2db9a0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0b0d196..634f5f4 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 _0x3e53=['/describe','describe','/:id','post','create','put','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x3e53,0xd4));var _0x33e5=function(_0x1e1c0d,_0x419274){_0x1e1c0d=_0x1e1c0d-0x0;var _0x34c723=_0x3e53[_0x1e1c0d];return _0x34c723;};'use strict';var multer=require(_0x33e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33e5('0x1'));var express=require(_0x33e5('0x2'));var router=express['Router']();var fs_extra=require(_0x33e5('0x3'));var auth=require(_0x33e5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x33e5('0x5'));var controller=require('./chatTransferReport.controller');router[_0x33e5('0x6')]('/',auth[_0x33e5('0x7')](),controller[_0x33e5('0x8')]);router[_0x33e5('0x6')](_0x33e5('0x9'),auth[_0x33e5('0x7')](),controller[_0x33e5('0xa')]);router[_0x33e5('0x6')](_0x33e5('0xb'),auth[_0x33e5('0x7')](),controller['show']);router[_0x33e5('0xc')]('/',auth[_0x33e5('0x7')](),controller[_0x33e5('0xd')]);router[_0x33e5('0xe')](_0x33e5('0xb'),auth[_0x33e5('0x7')](),controller[_0x33e5('0xf')]);router['delete'](_0x33e5('0xb'),auth[_0x33e5('0x7')](),controller['destroy']);module[_0x33e5('0x10')]=router; \ No newline at end of file +var _0xf6c7=['../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x19acb3,_0x561ce3){var _0x5cc4de=function(_0x33e6a9){while(--_0x33e6a9){_0x19acb3['push'](_0x19acb3['shift']());}};_0x5cc4de(++_0x561ce3);}(_0xf6c7,0xea));var _0x7f6c=function(_0x5b3233,_0x9b356e){_0x5b3233=_0x5b3233-0x0;var _0x541848=_0xf6c7[_0x5b3233];return _0x541848;};'use strict';var multer=require(_0x7f6c('0x0'));var util=require(_0x7f6c('0x1'));var path=require(_0x7f6c('0x2'));var timeout=require(_0x7f6c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7f6c('0x4'));var interaction=require(_0x7f6c('0x5'));var config=require(_0x7f6c('0x6'));var controller=require(_0x7f6c('0x7'));router['get']('/',auth[_0x7f6c('0x8')](),controller[_0x7f6c('0x9')]);router[_0x7f6c('0xa')](_0x7f6c('0xb'),auth[_0x7f6c('0x8')](),controller['describe']);router['get'](_0x7f6c('0xc'),auth[_0x7f6c('0x8')](),controller[_0x7f6c('0xd')]);router[_0x7f6c('0xe')]('/',auth[_0x7f6c('0x8')](),controller[_0x7f6c('0xf')]);router[_0x7f6c('0x10')](_0x7f6c('0xc'),auth[_0x7f6c('0x8')](),controller[_0x7f6c('0x11')]);router['delete'](_0x7f6c('0xc'),auth[_0x7f6c('0x8')](),controller[_0x7f6c('0x12')]);module[_0x7f6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0db3c47..04549b4 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 _0x22fb=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','TEXT','stringify','input','name','text','getDataValue','parse','setDataValue','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address'];(function(_0x21dfb7,_0x35ece2){var _0x49303c=function(_0xb99328){while(--_0xb99328){_0x21dfb7['push'](_0x21dfb7['shift']());}};_0x49303c(++_0x35ece2);}(_0x22fb,0x192));var _0xb22f=function(_0x367fa3,_0x515fb1){_0x367fa3=_0x367fa3-0x0;var _0x49b581=_0x22fb[_0x367fa3];return _0x49b581;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb22f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'unique':_0xb22f('0x2')},'description':{'type':Sequelize[_0xb22f('0x1')]},'mapKey':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x3')},'key':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x4')},'customerAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb22f('0x1')]},'animation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xc')},'header_offline':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xd')},'download_transcript':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xf')},'noteTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x10')},'closingMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'skipMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x12')},'ratingType':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'variable':null,'config':{'placeholder':_0xb22f('0x17'),'type':_0xb22f('0x18'),'required':!![]},'props':{'title':_0xb22f('0x17'),'helpText':''}},{'type':_0xb22f('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb22f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb22f('0x19')]('onlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')]('onlineForm')):{};},'set':function(_0x4687f2){return this[_0xb22f('0x1b')]('onlineForm',JSON[_0xb22f('0x15')](_0x4687f2));}},'offlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'props':{'title':_0xb22f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb22f('0x3'),'type':_0xb22f('0x3')},'variable':null},{'type':_0xb22f('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb22f('0x19')]('offlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')](_0xb22f('0x1d'))):{};},'set':function(_0x413575){return this[_0xb22f('0x1b')]('offlineForm',JSON['stringify'](_0x413575));}},'token':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return rs[_0xb22f('0x1e')]();}},'autoclose':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb22f('0x1')]},'forwardOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x1f')},'waitingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x21')},'enableUnmanagedNote':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x22')},'skipUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'sendUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return _0xb22f('0x23');}},'notificationSound':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb22f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x25')},'verticalAlignment':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x26')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb22f('0x1')]},'customerAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showCustomerAvatar':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xb22f('0x14')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb22f('0x7')],'comment':_0xb22f('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb22f('0x29'),'set':function(_0x2d265c){if(!_0x2d265c)this[_0xb22f('0x1b')]('mandatoryDispositionPauseId',null);this[_0xb22f('0x1b')](_0xb22f('0x2a'),_0x2d265c);}},'vidaooEscalation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb22f('0x1')]},'vidaooTopic':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x2b')},'vidaooNote':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return _0xb22f('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf4eb=['squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','text','name','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','address','email','STRING','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x19db65,_0x542112){var _0x5ce1fe=function(_0xe9496b){while(--_0xe9496b){_0x19db65['push'](_0x19db65['shift']());}};_0x5ce1fe(++_0x542112);}(_0xf4eb,0xec));var _0xbf4e=function(_0x409039,_0x49e370){_0x409039=_0x409039-0x0;var _0x340755=_0xf4eb[_0x409039];return _0x340755;};'use strict';var Sequelize=require(_0xbf4e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbf4e('0x1')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x2')},'mapKeyOffline':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2')},'key':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x4')},'customerAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbf4e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbf4e('0x3')]},'animation':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xbf4e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xc')},'download_transcript':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0xf')},'noteTitle':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x12')},'conditionAgreement':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x13')},'ratingType':{'type':Sequelize[_0xbf4e('0x14')](_0xbf4e('0x15'),_0xbf4e('0x16')),'defaultValue':_0xbf4e('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':function(){return JSON[_0xbf4e('0x18')]({'items':[{'type':_0xbf4e('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xbf4e('0x1a'),'required':!![]},'props':{'title':_0xbf4e('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xbf4e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xbf4e('0x2'),'type':_0xbf4e('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbf4e('0x1c')](_0xbf4e('0x1d'))?JSON['parse'](this[_0xbf4e('0x1c')](_0xbf4e('0x1d'))):{};},'set':function(_0x3d6863){return this['setDataValue'](_0xbf4e('0x1d'),JSON['stringify'](_0x3d6863));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xbf4e('0x18')]({'items':[{'type':'input','props':{'title':_0xbf4e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xbf4e('0x2'),'type':_0xbf4e('0x2')},'variable':null},{'type':_0xbf4e('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0xbf4e('0x1f'),'helpText':_0xbf4e('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xbf4e('0x1c')]('offlineForm')?JSON[_0xbf4e('0x21')](this['getDataValue'](_0xbf4e('0x22'))):{};},'set':function(_0x1421e1){return this[_0xbf4e('0x23')]('offlineForm',JSON[_0xbf4e('0x18')](_0x1421e1));}},'token':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':function(){return rs[_0xbf4e('0x24')]();}},'autoclose':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbf4e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x25')},'waitingMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbf4e('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x27')},'enableCustomerAttachment':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbf4e('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':function(){return _0xbf4e('0x28');}},'notificationSound':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x29')},'verticalAlignment':{'type':Sequelize[_0xbf4e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2a')},'messagesAlignment':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2b')},'defaultTitle':{'type':Sequelize[_0xbf4e('0x3')]},'customerAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':_0xbf4e('0x2d')},'systemAvatar':{'type':Sequelize[_0xbf4e('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf4e('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![],'comment':_0xbf4e('0x2e'),'set':function(_0x3aa308){if(!_0x3aa308)this[_0xbf4e('0x23')]('mandatoryDispositionPauseId',null);this[_0xbf4e('0x23')](_0xbf4e('0x2f'),_0x3aa308);}},'vidaooEscalation':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbf4e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':_0xbf4e('0x30')},'vidaooNote':{'type':Sequelize[_0xbf4e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xbf4e('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbf4e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 343c0a1..1bc20bc 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 _0x8664=['isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmContact','Contacts','DESC','ChatApplication','Applications','List','account','list','orderBy','applications','priority','defaults','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','autoclose','push','close','unmanaged','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','attachments','basename','openNewInteraction','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','readFileSync','origin','remote','remoteAddress','replace','alignment','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','url','redis','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatWebsites','stack','name','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','ChatWebsite','findAll','rows','catch','show','params','includeAll','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x8664,0xb6));var _0x4866=function(_0x3b7998,_0x30087c){_0x3b7998=_0x3b7998-0x0;var _0x46f5f3=_0x8664[_0x3b7998];return _0x46f5f3;};'use strict';var BPromise=require(_0x4866('0x0'));var Mustache=require(_0x4866('0x1'));var util=require('util');var path=require(_0x4866('0x2'));var ejs=require(_0x4866('0x3'));var fs=require('fs');var fs_extra=require(_0x4866('0x4'));var _=require('lodash');var querystring=require(_0x4866('0x5'));var Redis=require(_0x4866('0x6'));var qs=require(_0x4866('0x7'));var logger=require('../../config/logger')(_0x4866('0x8'));var config=require(_0x4866('0x9'));var url=require(_0x4866('0xa'));var db=require('../../mysqldb')['db'];config[_0x4866('0xb')]=_['defaults'](config[_0x4866('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4866('0xb')]));require('./chatWebsite.socket')[_0x4866('0xc')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x4866('0xd')][_0x4866('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x4866('0xe')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x4866('0xd')]['http']({'port':0x2329});function respondWithRpcPromise(_0x4d005c,_0x48077b,_0x3c811e,_0x1a3403){return new BPromise(function(_0x86b59d,_0x6a84a9){var _0x18ea2c=_0x1a3403||client;return _0x18ea2c[_0x4866('0xf')](_0x4d005c,_0x3c811e)['then'](function(_0x5889db){logger[_0x4866('0x10')](_0x4866('0x11'),_0x48077b,_0x4866('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x48077b,_0x4866('0x12'),JSON[_0x4866('0x13')](_0x5889db));if(_0x5889db[_0x4866('0x14')]){if(_0x5889db[_0x4866('0x14')][_0x4866('0x15')]===0x1f4){logger[_0x4866('0x14')](_0x4866('0x11'),_0x48077b,_0x5889db['error'][_0x4866('0x16')]);return _0x6a84a9(_0x5889db[_0x4866('0x14')]['message']);}logger[_0x4866('0x14')](_0x4866('0x11'),_0x48077b,_0x5889db[_0x4866('0x14')][_0x4866('0x16')]);return _0x86b59d(_0x5889db['error'][_0x4866('0x16')]);}else{logger[_0x4866('0x10')](_0x4866('0x11'),_0x48077b,_0x4866('0x12'));_0x86b59d(_0x5889db[_0x4866('0x17')][_0x4866('0x16')]);}})['catch'](function(_0x3368a6){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x48077b,_0x3368a6);_0x6a84a9(_0x3368a6);});});}function respondWithStatusCode(_0x5649e1,_0x2110d4){_0x2110d4=_0x2110d4||0xcc;return function(_0x67f148){if(_0x67f148){return _0x5649e1[_0x4866('0x18')](_0x2110d4);}return _0x5649e1['status'](_0x2110d4)[_0x4866('0x19')]();};}function respondWithResult(_0x1d4527,_0x15c9cf){_0x15c9cf=_0x15c9cf||0xc8;return function(_0x4db85e){if(_0x4db85e){return _0x1d4527[_0x4866('0x1a')](_0x15c9cf)[_0x4866('0x1b')](_0x4db85e);}};}function respondWithFilteredResult(_0x49c10a,_0x399be9){return function(_0x4b60af){if(_0x4b60af){var _0x2d6800=typeof _0x399be9[_0x4866('0x1c')]===_0x4866('0x1d')&&typeof _0x399be9[_0x4866('0x1e')]===_0x4866('0x1d');var _0x54bf30=_0x4b60af[_0x4866('0x1f')];var _0x185576=_0x2d6800?0x0:_0x399be9[_0x4866('0x1c')];var _0x4b37cf=_0x2d6800?_0x4b60af[_0x4866('0x1f')]:_0x399be9[_0x4866('0x1c')]+_0x399be9['limit'];var _0x3c53d8;if(_0x4b37cf>=_0x54bf30){_0x4b37cf=_0x54bf30;_0x3c53d8=0xc8;}else{_0x3c53d8=0xce;}_0x49c10a[_0x4866('0x1a')](_0x3c53d8);return _0x49c10a[_0x4866('0x20')](_0x4866('0x21'),_0x185576+'-'+_0x4b37cf+'/'+_0x54bf30)[_0x4866('0x1b')](_0x4b60af);}return null;};}function saveUpdates(_0x4060fe){return function(_0x324c4d){if(_0x324c4d){return _0x324c4d[_0x4866('0x22')](_0x4060fe)[_0x4866('0x23')](function(_0x14e0cb){return _0x14e0cb;});}return null;};}function removeEntity(_0x3999e4){return function(_0x50d365){if(_0x50d365){return _0x50d365[_0x4866('0x24')]()[_0x4866('0x23')](function(){var _0x5318ec=_0x50d365[_0x4866('0x25')]({'plain':!![]});var _0x18ef43=_0x4866('0x26');return db['UserProfileResource'][_0x4866('0x24')]({'where':{'type':_0x18ef43,'resourceId':_0x5318ec['id']}})[_0x4866('0x23')](function(){return _0x50d365;});})[_0x4866('0x23')](function(){_0x3999e4[_0x4866('0x1a')](0xcc)[_0x4866('0x19')]();});}};}function handleEntityNotFound(_0x2e96f2){return function(_0x41511d){if(!_0x41511d){_0x2e96f2[_0x4866('0x18')](0x194);}return _0x41511d;};}function handleError(_0x1ec5b8,_0x1491e9){_0x1491e9=_0x1491e9||0x1f4;return function(_0x44d2b3){logger[_0x4866('0x14')](_0x44d2b3[_0x4866('0x27')]);if(_0x44d2b3[_0x4866('0x28')]){delete _0x44d2b3['name'];}_0x1ec5b8[_0x4866('0x1a')](_0x1491e9)['send'](_0x44d2b3);};}exports['index']=function(_0x249416,_0x2a30de){var _0x4aee5d={'include':[{'model':db[_0x4866('0x29')],'as':'mandatoryDispositionPause'}]},_0x27cbd1={},_0x391d2b={'count':0x0,'rows':[]};var _0x1dd600=_['map'](db['ChatWebsite'][_0x4866('0x2a')],function(_0xa2ea4f){return{'name':_0xa2ea4f[_0x4866('0x2b')],'type':_0xa2ea4f[_0x4866('0x2c')]['key']};});_0x27cbd1[_0x4866('0x2d')]=_[_0x4866('0x2e')](_0x1dd600,_0x4866('0x28'));_0x27cbd1[_0x4866('0x2f')]=_[_0x4866('0x30')](_0x249416[_0x4866('0x2f')]);_0x27cbd1[_0x4866('0x31')]=_[_0x4866('0x32')](_0x27cbd1[_0x4866('0x2d')],_0x27cbd1[_0x4866('0x2f')]);_0x4aee5d[_0x4866('0x33')]=_[_0x4866('0x32')](_0x27cbd1[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x249416[_0x4866('0x2f')][_0x4866('0x34')]));_0x4aee5d[_0x4866('0x33')]=_0x4aee5d[_0x4866('0x33')][_0x4866('0x35')]?_0x4aee5d[_0x4866('0x33')]:_0x27cbd1[_0x4866('0x2d')];if(!_0x249416['query'][_0x4866('0x36')]('nolimit')){_0x4aee5d[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x249416[_0x4866('0x2f')][_0x4866('0x1e')]);_0x4aee5d[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x249416[_0x4866('0x2f')][_0x4866('0x1c')]);}_0x4aee5d[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x249416[_0x4866('0x2f')]['sort']);_0x4aee5d['where']=qs['filters'](_['pick'](_0x249416[_0x4866('0x2f')],_0x27cbd1[_0x4866('0x31')]),_0x1dd600);if(_0x249416[_0x4866('0x2f')][_0x4866('0x39')]){_0x4aee5d[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x4aee5d[_0x4866('0x3a')],{'$or':_[_0x4866('0x2e')](_0x1dd600,function(_0x4aeaa0){if(_0x4aeaa0[_0x4866('0x2c')]!==_0x4866('0x3c')){var _0x48dbfd={};_0x48dbfd[_0x4aeaa0[_0x4866('0x28')]]={'$like':'%'+_0x249416[_0x4866('0x2f')][_0x4866('0x39')]+'%'};return _0x48dbfd;}})});}_0x4aee5d=_[_0x4866('0x3b')]({},_0x4aee5d,_0x249416[_0x4866('0x3d')]);var _0x1e0cce={'where':_0x4aee5d['where']};return db['ChatWebsite'][_0x4866('0x1f')](_0x1e0cce)[_0x4866('0x23')](function(_0x29df23){_0x391d2b[_0x4866('0x1f')]=_0x29df23;if(_0x249416[_0x4866('0x2f')]['includeAll']){_0x4aee5d[_0x4866('0x3e')]=[{'all':!![]}];}return db[_0x4866('0x3f')][_0x4866('0x40')](_0x4aee5d);})['then'](function(_0x1e7810){_0x391d2b[_0x4866('0x41')]=_0x1e7810;return _0x391d2b;})[_0x4866('0x23')](respondWithFilteredResult(_0x2a30de,_0x4aee5d))[_0x4866('0x42')](handleError(_0x2a30de,null));};exports[_0x4866('0x43')]=function(_0x24f9cd,_0x1219e0){var _0x1aaf24={'raw':![],'where':{'id':_0x24f9cd[_0x4866('0x44')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5e67c4={};_0x5e67c4[_0x4866('0x2d')]=_[_0x4866('0x30')](db[_0x4866('0x3f')][_0x4866('0x2a')]);_0x5e67c4['query']=_[_0x4866('0x30')](_0x24f9cd['query']);_0x5e67c4[_0x4866('0x31')]=_[_0x4866('0x32')](_0x5e67c4['model'],_0x5e67c4[_0x4866('0x2f')]);_0x1aaf24[_0x4866('0x33')]=_[_0x4866('0x32')](_0x5e67c4[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x24f9cd[_0x4866('0x2f')][_0x4866('0x34')]));_0x1aaf24[_0x4866('0x33')]=_0x1aaf24[_0x4866('0x33')][_0x4866('0x35')]?_0x1aaf24[_0x4866('0x33')]:_0x5e67c4['model'];if(_0x24f9cd[_0x4866('0x2f')][_0x4866('0x45')]){_0x1aaf24[_0x4866('0x3e')]=[{'all':!![]}];}_0x1aaf24=_[_0x4866('0x3b')]({},_0x1aaf24,_0x24f9cd[_0x4866('0x3d')]);return db[_0x4866('0x3f')][_0x4866('0x46')](_0x1aaf24)[_0x4866('0x23')](handleEntityNotFound(_0x1219e0,null))[_0x4866('0x23')](respondWithResult(_0x1219e0,null))[_0x4866('0x42')](handleError(_0x1219e0,null));};exports[_0x4866('0x47')]=function(_0x4b8878,_0x50853b){return db['ChatWebsite'][_0x4866('0x47')](_0x4b8878['body'],{})[_0x4866('0x23')](function(_0x3940d9){var _0x51d6ec=_0x4b8878[_0x4866('0x48')][_0x4866('0x25')]({'plain':!![]});if(!_0x51d6ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51d6ec[_0x4866('0x49')]===_0x4866('0x48')){var _0x861972=_0x3940d9[_0x4866('0x25')]({'plain':!![]});var _0x276b95=_0x4866('0x26');return db['UserProfileSection'][_0x4866('0x46')]({'where':{'name':_0x276b95,'userProfileId':_0x51d6ec['userProfileId']},'raw':!![]})[_0x4866('0x23')](function(_0x4c2ef0){if(_0x4c2ef0&&_0x4c2ef0[_0x4866('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x861972['name'],'resourceId':_0x861972['id'],'type':_0x4c2ef0['name'],'sectionId':_0x4c2ef0['id']},{})['then'](function(){return _0x3940d9;});}else{return _0x3940d9;}})[_0x4866('0x42')](function(_0x472847){logger['error'](_0x4866('0x4b'),_0x472847);throw _0x472847;});}return _0x3940d9;})[_0x4866('0x23')](respondWithResult(_0x50853b,0xc9))['catch'](handleError(_0x50853b,null));};exports['update']=function(_0x499a92,_0x367684){if(_0x499a92[_0x4866('0x4c')]['id']){delete _0x499a92['body']['id'];}return db[_0x4866('0x3f')]['find']({'where':{'id':_0x499a92['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4866('0x23')](handleEntityNotFound(_0x367684,null))[_0x4866('0x23')](saveUpdates(_0x499a92['body'],null))[_0x4866('0x23')](respondWithResult(_0x367684,null))[_0x4866('0x42')](handleError(_0x367684,null));};exports[_0x4866('0x24')]=function(_0x3562fe,_0x318478){return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x3562fe['params']['id']}})['then'](handleEntityNotFound(_0x318478,null))[_0x4866('0x23')](removeEntity(_0x318478,null))[_0x4866('0x42')](handleError(_0x318478,null));};exports[_0x4866('0x4d')]=function(_0x233fd6,_0x892bb2){return db[_0x4866('0x3f')][_0x4866('0x4d')]()['then'](respondWithResult(_0x892bb2,null))[_0x4866('0x42')](handleError(_0x892bb2,null));};exports[_0x4866('0x4e')]=function(_0x4c12c5,_0x583096){if(_0x4c12c5['body']['id']){delete _0x4c12c5[_0x4866('0x4c')]['id'];}return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x4c12c5[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x583096,null))[_0x4866('0x23')](function(_0x1c2983){if(_0x1c2983){_0x4c12c5[_0x4866('0x4c')]['ChatWebsiteId']=_0x1c2983['id'];return db[_0x4866('0x4f')]['create'](_0x4c12c5[_0x4866('0x4c')]);}})['then'](respondWithResult(_0x583096,null))[_0x4866('0x42')](handleError(_0x583096,null));};exports[_0x4866('0x50')]=function(_0x453429,_0x1d58de){var _0x133a86={'raw':![],'where':{}};var _0x975267={};var _0x3fe43c={'count':0x0,'rows':[]};return db[_0x4866('0x3f')][_0x4866('0x51')]({'where':{'id':_0x453429[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x1d58de,null))[_0x4866('0x23')](function(_0x4b8e68){if(_0x4b8e68){_0x975267['model']=_[_0x4866('0x30')](db[_0x4866('0x4f')]['rawAttributes']);_0x975267['query']=_['keys'](_0x453429[_0x4866('0x2f')]);_0x975267['filters']=_[_0x4866('0x32')](_0x975267['model'],_0x975267[_0x4866('0x2f')]);_0x133a86[_0x4866('0x33')]=_[_0x4866('0x32')](_0x975267[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x453429[_0x4866('0x2f')]['fields']));_0x133a86[_0x4866('0x33')]=_0x133a86[_0x4866('0x33')][_0x4866('0x35')]?_0x133a86[_0x4866('0x33')]:_0x975267[_0x4866('0x2d')];if(!_0x453429[_0x4866('0x2f')][_0x4866('0x36')]('nolimit')){_0x133a86[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x453429[_0x4866('0x2f')]['limit']);_0x133a86['offset']=qs[_0x4866('0x1c')](_0x453429[_0x4866('0x2f')][_0x4866('0x1c')]);}_0x133a86[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x453429[_0x4866('0x2f')]['sort']);_0x133a86[_0x4866('0x3a')]=qs[_0x4866('0x31')](_[_0x4866('0x52')](_0x453429[_0x4866('0x2f')],_0x975267[_0x4866('0x31')]));_0x133a86[_0x4866('0x3a')][_0x4866('0x53')]=_0x4b8e68['id'];if(_0x453429[_0x4866('0x2f')][_0x4866('0x39')]){_0x133a86[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x133a86[_0x4866('0x3a')],{'$or':_[_0x4866('0x2e')](_0x133a86['attributes'],function(_0x4d508d){var _0xbc6a63={};_0xbc6a63[_0x4d508d]={'$like':'%'+_0x453429['query'][_0x4866('0x39')]+'%'};return _0xbc6a63;})});}_0x133a86=_[_0x4866('0x3b')]({},_0x133a86,_0x453429[_0x4866('0x3d')]);return db[_0x4866('0x4f')]['count']({'where':_0x133a86[_0x4866('0x3a')]})[_0x4866('0x23')](function(_0x433859){_0x3fe43c[_0x4866('0x1f')]=_0x433859;if(_0x453429[_0x4866('0x2f')][_0x4866('0x45')]){_0x133a86[_0x4866('0x3e')]=[{'all':!![]}];}return db[_0x4866('0x4f')]['findAll'](_0x133a86);})[_0x4866('0x23')](function(_0x3ae8d5){_0x3fe43c[_0x4866('0x41')]=_0x3ae8d5;return _0x3fe43c;});}})['then'](respondWithFilteredResult(_0x1d58de,_0x133a86))[_0x4866('0x42')](handleError(_0x1d58de,null));};exports['removeDispositions']=function(_0x7431cd,_0x35f907){return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x7431cd['params']['id']}})['then'](handleEntityNotFound(_0x35f907,null))[_0x4866('0x23')](function(_0x4ed755){if(_0x4ed755){return _0x4ed755[_0x4866('0x54')](_0x7431cd['query'][_0x4866('0x55')]);}})['then'](respondWithStatusCode(_0x35f907,null))[_0x4866('0x42')](handleError(_0x35f907,null));};exports[_0x4866('0x56')]=function(_0x4d2d05,_0x46f3db){if(_0x4d2d05[_0x4866('0x4c')]['id']){delete _0x4d2d05[_0x4866('0x4c')]['id'];}return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x4d2d05[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x46f3db,null))[_0x4866('0x23')](function(_0x270c7f){if(_0x270c7f){_0x4d2d05['body']['ChatWebsiteId']=_0x270c7f['id'];return db[_0x4866('0x57')]['create'](_0x4d2d05[_0x4866('0x4c')]);}})[_0x4866('0x23')](respondWithResult(_0x46f3db,null))['catch'](handleError(_0x46f3db,null));};exports[_0x4866('0x58')]=function(_0x44a8bf,_0x316f7e){var _0x14b8c7={'raw':![],'where':{}};var _0x3ca0c7={};var _0x41cff9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4866('0x51')]({'where':{'id':_0x44a8bf[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x316f7e,null))[_0x4866('0x23')](function(_0x12e652){if(_0x12e652){_0x3ca0c7[_0x4866('0x2d')]=_[_0x4866('0x30')](db[_0x4866('0x57')][_0x4866('0x2a')]);_0x3ca0c7['query']=_[_0x4866('0x30')](_0x44a8bf['query']);_0x3ca0c7[_0x4866('0x31')]=_[_0x4866('0x32')](_0x3ca0c7['model'],_0x3ca0c7[_0x4866('0x2f')]);_0x14b8c7[_0x4866('0x33')]=_[_0x4866('0x32')](_0x3ca0c7['model'],qs[_0x4866('0x34')](_0x44a8bf[_0x4866('0x2f')][_0x4866('0x34')]));_0x14b8c7['attributes']=_0x14b8c7[_0x4866('0x33')]['length']?_0x14b8c7['attributes']:_0x3ca0c7[_0x4866('0x2d')];if(!_0x44a8bf[_0x4866('0x2f')][_0x4866('0x36')](_0x4866('0x59'))){_0x14b8c7[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x44a8bf[_0x4866('0x2f')][_0x4866('0x1e')]);_0x14b8c7[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x44a8bf[_0x4866('0x2f')][_0x4866('0x1c')]);}_0x14b8c7[_0x4866('0x37')]=qs['sort'](_0x44a8bf[_0x4866('0x2f')][_0x4866('0x38')]);_0x14b8c7['where']=qs[_0x4866('0x31')](_[_0x4866('0x52')](_0x44a8bf[_0x4866('0x2f')],_0x3ca0c7[_0x4866('0x31')]));_0x14b8c7[_0x4866('0x3a')][_0x4866('0x53')]=_0x12e652['id'];if(_0x44a8bf['query'][_0x4866('0x39')]){_0x14b8c7[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x14b8c7['where'],{'$or':_[_0x4866('0x2e')](_0x14b8c7[_0x4866('0x33')],function(_0x2afaab){var _0x2344a8={};_0x2344a8[_0x2afaab]={'$like':'%'+_0x44a8bf[_0x4866('0x2f')][_0x4866('0x39')]+'%'};return _0x2344a8;})});}_0x14b8c7=_[_0x4866('0x3b')]({},_0x14b8c7,_0x44a8bf['options']);return db[_0x4866('0x57')]['count']({'where':_0x14b8c7[_0x4866('0x3a')]})[_0x4866('0x23')](function(_0x538c41){_0x41cff9[_0x4866('0x1f')]=_0x538c41;if(_0x44a8bf[_0x4866('0x2f')][_0x4866('0x45')]){_0x14b8c7[_0x4866('0x3e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x14b8c7);})['then'](function(_0x5759d1){_0x41cff9['rows']=_0x5759d1;return _0x41cff9;});}})[_0x4866('0x23')](respondWithFilteredResult(_0x316f7e,_0x14b8c7))[_0x4866('0x42')](handleError(_0x316f7e,null));};exports[_0x4866('0x5a')]=function(_0x3a2e21,_0x2f9058){return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x3a2e21['params']['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x2f9058,null))[_0x4866('0x23')](function(_0x7e8378){if(_0x7e8378){return _0x7e8378[_0x4866('0x5a')](_0x3a2e21[_0x4866('0x2f')][_0x4866('0x55')]);}})[_0x4866('0x23')](respondWithStatusCode(_0x2f9058,null))[_0x4866('0x42')](handleError(_0x2f9058,null));};exports[_0x4866('0x5b')]=function(_0x21ab1a,_0x407ee2){_0x21ab1a[_0x4866('0x4c')][_0x4866('0x5c')]=_0x21ab1a[_0x4866('0x5d')][_0x4866('0x5e')];return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x21ab1a['params']['id']}})['then'](handleEntityNotFound(_0x407ee2,null))[_0x4866('0x23')](saveUpdates(_0x21ab1a[_0x4866('0x4c')],null))[_0x4866('0x23')](respondWithResult(_0x407ee2,null))[_0x4866('0x42')](handleError(_0x407ee2,null));};exports['addAvatar']=function(_0x160667,_0x3096e1){_0x160667['body'][_0x4866('0x5f')]=_0x160667[_0x4866('0x5d')]['filename'];return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x160667[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x3096e1,null))[_0x4866('0x23')](saveUpdates(_0x160667['body'],null))[_0x4866('0x23')](respondWithResult(_0x3096e1,null))['catch'](handleError(_0x3096e1,null));};exports[_0x4866('0x60')]=function(_0x56c84e,_0x693922){_0x56c84e[_0x4866('0x4c')]['customerAvatar']=_0x56c84e[_0x4866('0x5d')]['filename'];return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x56c84e[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x693922,null))[_0x4866('0x23')](saveUpdates(_0x56c84e[_0x4866('0x4c')],null))[_0x4866('0x23')](respondWithResult(_0x693922,null))[_0x4866('0x42')](handleError(_0x693922,null));};exports['addSystemAvatar']=function(_0x3eb0d0,_0x49cb29){_0x3eb0d0[_0x4866('0x4c')][_0x4866('0x61')]=_0x3eb0d0[_0x4866('0x5d')][_0x4866('0x5e')];return db[_0x4866('0x3f')]['find']({'where':{'id':_0x3eb0d0['params']['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x49cb29,null))[_0x4866('0x23')](saveUpdates(_0x3eb0d0[_0x4866('0x4c')],null))[_0x4866('0x23')](respondWithResult(_0x49cb29,null))['catch'](handleError(_0x49cb29,null));};exports[_0x4866('0x62')]=function(_0xf4edfa,_0x1c0487){var _0x37ab49=path['join'](config[_0x4866('0x63')],'server/files/images/logos/default_logo.svg');var _0x8a2b2e={'where':{'id':_0xf4edfa[_0x4866('0x44')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1ada6f=![];return require(_0x4866('0x64'))[_0x4866('0x65')]()[_0x4866('0x23')](function(_0x590e03){if(_0x590e03){_0x1ada6f=_0x590e03[_0x4866('0x66')];}})['then'](function(){return db[_0x4866('0x3f')][_0x4866('0x46')](_0x8a2b2e);})[_0x4866('0x23')](handleEntityNotFound(_0x1c0487,null))[_0x4866('0x23')](function(_0x3708a0){if(_0x3708a0){if(!_[_0x4866('0x67')](_0x3708a0['sitepic'])){if(fs[_0x4866('0x68')](path['join'](config[_0x4866('0x63')],'server/files/images/logos/',_0x3708a0[_0x4866('0x5c')]))&&_0x1ada6f){_0x37ab49=path[_0x4866('0x69')](config['root'],_0x4866('0x6a'),_0x3708a0[_0x4866('0x5c')]);}}return _0x1c0487[_0x4866('0x6b')](_0x37ab49);}})[_0x4866('0x42')](handleError(_0x1c0487,null));};exports[_0x4866('0x6c')]=function(_0x184295,_0x44ebdd){var _0xc0a499=path[_0x4866('0x69')](config[_0x4866('0x63')],_0x4866('0x6d'));var _0x44af44={'where':{'id':_0x184295[_0x4866('0x44')]['id']},'attributes':['id',_0x4866('0x5f')],'raw':!![]};return db[_0x4866('0x3f')]['find'](_0x44af44)['then'](handleEntityNotFound(_0x44ebdd,null))[_0x4866('0x23')](function(_0x1b4500){if(_0x1b4500){if(!_['isNil'](_0x1b4500[_0x4866('0x5f')])){if(fs[_0x4866('0x68')](path[_0x4866('0x69')](config[_0x4866('0x63')],_0x4866('0x6e'),_0x1b4500[_0x4866('0x5f')]))){_0xc0a499=path['join'](config['root'],_0x4866('0x6e'),_0x1b4500[_0x4866('0x5f')]);}}return _0x44ebdd['download'](_0xc0a499);}})[_0x4866('0x42')](handleError(_0x44ebdd,null));};exports['getCustomerAvatar']=function(_0x41f6e6,_0x4b7042){var _0xd1d3cf=path[_0x4866('0x69')](config['root'],_0x4866('0x6f'));var _0x503e7a={'where':{'id':_0x41f6e6['params']['id']},'attributes':['id',_0x4866('0x70'),_0x4866('0x71')],'raw':!![]};return db[_0x4866('0x3f')][_0x4866('0x46')](_0x503e7a)['then'](handleEntityNotFound(_0x4b7042,null))[_0x4866('0x23')](function(_0x2606ef){if(_0x2606ef){if(!_[_0x4866('0x67')](_0x2606ef[_0x4866('0x70')])){if(fs[_0x4866('0x68')](path[_0x4866('0x69')](config['root'],_0x4866('0x6e'),_0x2606ef[_0x4866('0x70')]))&&_0x2606ef['showCustomerAvatar']){_0xd1d3cf=path[_0x4866('0x69')](config[_0x4866('0x63')],_0x4866('0x6e'),_0x2606ef['customerAvatar']);}}return _0x4b7042[_0x4866('0x6b')](_0xd1d3cf);}})[_0x4866('0x42')](handleError(_0x4b7042,null));};exports[_0x4866('0x72')]=function(_0x2bb5f6,_0x23f0f8){var _0x1bd267=path[_0x4866('0x69')](config[_0x4866('0x63')],_0x4866('0x73'));var _0x2fa9eb={'where':{'id':_0x2bb5f6['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x4866('0x3f')]['find'](_0x2fa9eb)[_0x4866('0x23')](handleEntityNotFound(_0x23f0f8,null))[_0x4866('0x23')](function(_0x316215){if(_0x316215){if(!_[_0x4866('0x67')](_0x316215['systemAvatar'])){if(fs[_0x4866('0x68')](path['join'](config[_0x4866('0x63')],_0x4866('0x6e'),_0x316215[_0x4866('0x61')]))){_0x1bd267=path[_0x4866('0x69')](config[_0x4866('0x63')],_0x4866('0x6e'),_0x316215[_0x4866('0x61')]);}}return _0x23f0f8[_0x4866('0x6b')](_0x1bd267);}})[_0x4866('0x42')](handleError(_0x23f0f8,null));};exports[_0x4866('0x74')]=function(_0x2434dd,_0x4febf7){var _0x66645b=require(_0x4866('0x75'));var _0x55e412=new _0x66645b();var _0x3d20e4=_0x55e412[_0x4866('0x76')](_0x2434dd[_0x4866('0x77')][_0x4866('0x78')])[_0x4866('0x79')]();var _0x3c634f={'body':_0x2434dd['body'],'channel':'chat'};var _0x5a1043=[];var _0x279cb3=[];var _0x51572c={};var _0x1a291b=![];return db['CmContact'][_0x4866('0x4d')]()[_0x4866('0x23')](function(_0x2de7c2){if(!_0x2de7c2){throw new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x7c'));}_0x5a1043=_[_0x4866('0x7d')](_['keys'](_0x2de7c2),['createdAt','updatedAt']);_0x279cb3=_[_0x4866('0x7d')](_[_0x4866('0x30')](_0x2de7c2),[_0x4866('0x7e'),_0x4866('0x7f'),_0x4866('0x80'),_0x4866('0x81')]);if(_0x2434dd['body']['id']){delete _0x2434dd[_0x4866('0x4c')]['id'];}if(_['isNil'](_0x2434dd['body']['from'])){throw new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x82'));}if(_['isNil'](_0x2434dd[_0x4866('0x4c')][_0x4866('0x4c')])||_0x2434dd[_0x4866('0x4c')][_0x4866('0x4c')]===''){throw new db[(_0x4866('0x7a'))]['ValidationError'](_0x4866('0x83'));}if(_[_0x4866('0x67')](_0x2434dd['body'][_0x4866('0x84')])){throw new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x85')+_0x279cb3);}if(!_[_0x4866('0x86')](_0x279cb3,_0x2434dd[_0x4866('0x4c')][_0x4866('0x84')])){throw new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x87')+_0x279cb3);}_0x51572c[_0x2434dd[_0x4866('0x4c')][_0x4866('0x84')]]=_0x2434dd[_0x4866('0x4c')][_0x4866('0x88')];})['then'](function(){return db[_0x4866('0x3f')]['find']({'where':{'id':_0x2434dd[_0x4866('0x44')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4866('0x89')],'as':_0x4866('0x8a'),'where':_0x51572c,'limit':0x1,'order':[[_0x4866('0x7f'),_0x4866('0x8b')]]}]},{'model':db[_0x4866('0x8c')],'as':_0x4866('0x8d')}]});})[_0x4866('0x23')](handleEntityNotFound(_0x4febf7,null))[_0x4866('0x23')](function(_0x399f45){if(_0x399f45&&_0x399f45[_0x4866('0x8e')]){_0x3c634f[_0x4866('0x8f')]=_0x399f45;_0x3c634f['applications']=_0x399f45[_0x4866('0x8d')];_0x3c634f[_0x4866('0x90')]=_0x399f45[_0x4866('0x8e')];_0x3c634f['applications']=_[_0x4866('0x91')](_0x3c634f[_0x4866('0x92')],[_0x4866('0x93')],['asc']);if(_0x3c634f[_0x4866('0x8f')]['Applications']){delete _0x3c634f[_0x4866('0x8f')][_0x4866('0x8d')];}if(_0x3c634f['account'][_0x4866('0x8e')]&&_0x3c634f['account'][_0x4866('0x8e')][_0x4866('0x8a')]['length']){return _0x3c634f[_0x4866('0x8f')][_0x4866('0x8e')][_0x4866('0x8a')][0x0];}var _0x4aa42c=_[_0x4866('0x94')](_0x2434dd[_0x4866('0x4c')],{'firstName':_0x2434dd[_0x4866('0x4c')][_0x4866('0x88')],'ListId':_0x399f45['ListId']});_0x4aa42c[_0x2434dd[_0x4866('0x4c')][_0x4866('0x84')]]=_0x2434dd[_0x4866('0x4c')]['from'];return db['CmContact'][_0x4866('0x47')](_0x4aa42c,{'fields':_0x5a1043,'raw':!![]});}})[_0x4866('0x23')](handleEntityNotFound(_0x4febf7,null))[_0x4866('0x23')](function(_0x5593d){_0x3c634f[_0x4866('0x95')]=_0x5593d;var _0x4157cf=_0x2434dd[_0x4866('0x4c')][_0x4866('0x96')];if(_0x2434dd[_0x4866('0x77')][_0x4866('0x97')]){_0x4157cf=_0x2434dd['headers'][_0x4866('0x97')];}else if(_0x2434dd[_0x4866('0x77')]['x-forwarded-for']){_0x4157cf=_[_0x4866('0x98')](_0x2434dd[_0x4866('0x77')][_0x4866('0x99')][_0x4866('0x9a')](','));}if(_0x5593d){var _0x17ee53={'ContactId':_0x5593d['id'],'ChatWebsiteId':_0x2434dd[_0x4866('0x44')]['id'],'from':(_0x5593d[_0x4866('0x9b')]||'')+'\x20'+(_0x5593d['lastName']||''),'customerIp':_0x4157cf,'customerPort':_0x2434dd['headers']['x-real-port']?_0x2434dd[_0x4866('0x77')][_0x4866('0x9c')]:null,'referer':_0x2434dd[_0x4866('0x4c')][_0x4866('0x9d')],'browserName':_0x3d20e4[_0x4866('0x9e')]['name']&&_0x3d20e4[_0x4866('0x9e')][_0x4866('0x9f')]?util[_0x4866('0xa0')]('%s\x20%s',_0x3d20e4[_0x4866('0x9e')][_0x4866('0x28')],_0x3d20e4[_0x4866('0x9e')][_0x4866('0x9f')]):_0x4866('0xa1'),'browserVersion':_0x3d20e4[_0x4866('0x9e')][_0x4866('0x9f')]||_0x4866('0xa1'),'osName':util['format'](_0x4866('0xa2'),_0x3d20e4['os']['name'],_0x3d20e4['os'][_0x4866('0x9f')]),'osVersion':_0x3d20e4['os'][_0x4866('0x9f')],'deviceModel':_0x3d20e4[_0x4866('0xa3')][_0x4866('0x2d')]&&_0x3d20e4[_0x4866('0xa3')][_0x4866('0xa4')]?util[_0x4866('0xa0')](_0x4866('0xa5'),_0x3d20e4[_0x4866('0xa3')][_0x4866('0x2d')],_0x3d20e4['device']['vendor'],_0x3d20e4[_0x4866('0xa3')][_0x4866('0x2c')]):null,'deviceVendor':_0x3d20e4[_0x4866('0xa3')][_0x4866('0xa4')],'deviceType':_0x3d20e4[_0x4866('0xa3')][_0x4866('0x2c')],'formData':JSON['stringify'](_0x2434dd[_0x4866('0x4c')])};var _0x2208ab={'ChatWebsiteId':_0x2434dd[_0x4866('0x44')]['id'],'closed':![]};if(_0x2434dd['body'][_0x4866('0xa6')]){_0x2208ab[_0x4866('0xa6')]=_0x2434dd[_0x4866('0x4c')][_0x4866('0xa6')];return db[_0x4866('0xa7')]['find']({'where':_0x2208ab})['then'](function(_0x50d337){if(_0x50d337){return[_0x50d337,![]];}_0x17ee53[_0x4866('0xa6')]=_0x2434dd[_0x4866('0x4c')][_0x4866('0xa6')];_0x17ee53['externalUrl']=_0x2434dd[_0x4866('0x4c')][_0x4866('0xa8')];return db[_0x4866('0xa7')][_0x4866('0x47')](_0x17ee53)['then'](function(_0x250ebe){return[_0x250ebe,!![]];});});}_0x2208ab[_0x4866('0xa9')]=_0x5593d['id'];if(_0x2434dd[_0x4866('0x4c')][_0x4866('0xaa')]&&_0x2434dd[_0x4866('0x4c')][_0x4866('0xaa')]['id']){_0x2208ab['id']=_0x2434dd[_0x4866('0x4c')][_0x4866('0xaa')]['id'];return db[_0x4866('0xa7')][_0x4866('0x46')]({'where':_0x2208ab})[_0x4866('0x23')](function(_0x32071c){if(_0x32071c){return[_0x32071c,![]];}return db[_0x4866('0xa7')][_0x4866('0x47')](_0x17ee53)[_0x4866('0x23')](function(_0x5d9f3b){return[_0x5d9f3b,!![]];});});}return db[_0x4866('0xa7')]['create'](_0x17ee53)[_0x4866('0x23')](function(_0xf00195){return[_0xf00195,!![]];});}})[_0x4866('0xab')](function(_0x549bd4,_0x388666){if(_0x549bd4){_0x1a291b=_0x388666;if(!_0x388666){var _0x5c67e5={'from':(_0x3c634f[_0x4866('0x95')][_0x4866('0x9b')]||'')+'\x20'+(_0x3c634f[_0x4866('0x95')][_0x4866('0xac')]||'')};if(_0x2434dd[_0x4866('0x4c')]['threadId']&&_0x2434dd[_0x4866('0x4c')][_0x4866('0xad')]&&_0x2434dd[_0x4866('0x4c')][_0x4866('0xa6')]!=_0x2434dd[_0x4866('0x4c')][_0x4866('0xad')]){_0x5c67e5['threadId']=_0x2434dd[_0x4866('0x4c')]['messageId'];}return _0x549bd4[_0x4866('0x22')](_0x5c67e5);}else{return _0x549bd4;}}})[_0x4866('0x23')](function(_0x2f69c8){_0x3c634f['interaction']=_0x2f69c8[_0x4866('0x25')]({'plain':!![]});_0x3c634f[_0x4866('0xaa')]['created']=_0x1a291b;if(_0x3c634f[_0x4866('0xaa')]['created']){if(_0x3c634f[_0x4866('0x8f')][_0x4866('0xae')]){_0x3c634f[_0x4866('0x92')][_0x4866('0xaf')]({'id':0x0,'priority':_0x3c634f[_0x4866('0x92')][_0x4866('0x35')]+0x1,'app':_0x4866('0xb0'),'appdata':_0x4866('0xb1'),'interval':'*,*,*,*'});}}return db[_0x4866('0xb2')][_0x4866('0x47')]({'body':_0x2434dd['body']['body'],'ChatWebsiteId':_0x2434dd[_0x4866('0x44')]['id'],'ChatInteractionId':_0x2f69c8['id'],'direction':'in','ContactId':_0x3c634f[_0x4866('0x95')]['id'],'AttachmentId':_0x2434dd[_0x4866('0x4c')]['AttachmentId']});})[_0x4866('0x23')](function(_0x369b23){_0x3c634f['message']=_0x369b23;if(_0x3c634f[_0x4866('0xaa')][_0x4866('0xb3')]){return db[_0x4866('0xb4')][_0x4866('0x46')]({'attributes':['id',_0x4866('0x28')],'where':{'id':_0x3c634f[_0x4866('0xaa')][_0x4866('0xb3')]}})[_0x4866('0x23')](function(_0x4de984){if(_0x4de984){_0x3c634f['applications'][_0x4866('0xb5')]({'id':0x0,'priority':0x0,'app':_0x4866('0xb6'),'appdata':_0x4de984['name']+','+(_0x3c634f[_0x4866('0x8f')][_0x4866('0xb7')]||0xa),'interval':_0x4866('0xb8')});_0x3c634f[_0x4866('0xb9')]=!![];}return respondWithRpcPromise(_0x4866('0xba'),'startRouting',_0x3c634f);});}return respondWithRpcPromise(_0x4866('0xba'),'startRouting',_0x3c634f);})['then'](function(_0x452c08){respondWithRpcPromise('EventManager','EventManager',{'event':_0x4866('0x74'),'message':_0x452c08},client9002);return _0x452c08;})['then'](respondWithResult(_0x4febf7,null))[_0x4866('0x42')](handleError(_0x4febf7,null));};exports['offline']=function(_0x5cf873,_0x1acb00){var _0x4cae76,_0x153964,_0x5b327a;var _0x393a85=[];var _0x32b970={};var _0x34da31=_0x5cf873[_0x4866('0xbb')]||[];var _0x2d5aba=[];var _0x463a31;return db[_0x4866('0x89')][_0x4866('0x4d')]()['then'](function(_0x229388){if(!_0x229388){throw new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))]('no\x20available\x20attributes');}_0x393a85=_[_0x4866('0x7d')](_[_0x4866('0x30')](_0x229388),[_0x4866('0x7e'),_0x4866('0x7f'),_0x4866('0x80'),_0x4866('0x81')]);if(_0x5cf873[_0x4866('0x4c')]['id']){delete _0x5cf873[_0x4866('0x4c')]['id'];}if(_['isNil'](_0x5cf873[_0x4866('0x4c')]['from'])){throw _0x1acb00[_0x4866('0x1a')](0x1f4)[_0x4866('0xbc')](new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x82')));}if(_['isNil'](_0x5cf873['body']['body'])||_0x5cf873[_0x4866('0x4c')][_0x4866('0x4c')]===''){throw _0x1acb00[_0x4866('0x1a')](0x1f4)[_0x4866('0xbc')](new db[(_0x4866('0x7a'))][(_0x4866('0x7b'))](_0x4866('0x83')));}if(_[_0x4866('0x67')](_0x5cf873[_0x4866('0x4c')][_0x4866('0xbd')])){throw _0x1acb00[_0x4866('0x1a')](0x1f4)[_0x4866('0xbc')](new db['Sequelize'][(_0x4866('0x7b'))](_0x4866('0xbe')+_0x393a85));}if(!_[_0x4866('0x86')](_0x393a85,_0x5cf873[_0x4866('0x4c')][_0x4866('0xbd')])){throw _0x1acb00[_0x4866('0x1a')](0x1f4)['send'](new db['Sequelize'][(_0x4866('0x7b'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x393a85));}_0x32b970[_0x5cf873[_0x4866('0x4c')][_0x4866('0xbd')]]=_0x5cf873[_0x4866('0x4c')][_0x4866('0x88')];})[_0x4866('0x23')](function(){return db[_0x4866('0x3f')]['find']({'where':{'id':_0x5cf873[_0x4866('0x44')]['id']},'include':[{'model':db[_0x4866('0xbf')],'as':_0x4866('0x8e')},{'model':db[_0x4866('0xc0')],'as':_0x4866('0xc0')}]});})[_0x4866('0x23')](handleEntityNotFound(_0x1acb00,null))[_0x4866('0x23')](function(_0x12b7a1){if(_0x12b7a1&&_0x12b7a1[_0x4866('0x8e')]){_0x153964=_0x12b7a1;var _0x476e8a=_[_0x4866('0x94')](_0x5cf873[_0x4866('0x4c')],{'firstName':_0x5cf873[_0x4866('0x4c')][_0x4866('0x88')],'phone':_0x5cf873[_0x4866('0x4c')][_0x4866('0x88')],'ListId':_0x12b7a1['ListId']});_0x476e8a[_0x5cf873[_0x4866('0x4c')][_0x4866('0xbd')]]=_0x5cf873[_0x4866('0x4c')][_0x4866('0x88')];return db[_0x4866('0x89')][_0x4866('0xc1')]({'where':_0x32b970,'defaults':_0x476e8a});}})[_0x4866('0xab')](function(_0x35ae57){if(_0x35ae57){_0x5b327a=_0x35ae57;var _0x52f37a=fs['readFileSync'](path[_0x4866('0x69')](config[_0x4866('0x63')],'server/files/templates/chatOfflineMessage.ejs'),_0x4866('0xc2'));var _0x82101b=ejs[_0x4866('0xc3')](_0x52f37a,{'body':_[_0x4866('0xc4')](_0x5cf873[_0x4866('0x4c')][_0x4866('0x4c')]),'bodyTitle':_0x153964['offlineMessageBody']});return db[_0x4866('0xc5')][_0x4866('0x47')]({'body':_0x82101b,'plainBody':htmlToText[_0x4866('0xc6')](_0x82101b),'ContactId':_0x35ae57['id'],'ChatWebsiteId':_0x153964['id']});}})['then'](function(_0x2458ca){_0x463a31=_0x2458ca;if(_0x34da31[_0x4866('0x35')]){var _0x39e1bd=_0x34da31['map'](function(_0x6ad3df){return{'name':_0x6ad3df[_0x4866('0xc7')],'basename':_0x6ad3df[_0x4866('0x5e')],'type':_0x6ad3df[_0x4866('0xc8')],'ChatOfflineMessageId':_0x2458ca['id']};});_0x2d5aba=_0x39e1bd[_0x4866('0x2e')](_0x3804ae=>{var _0x3d9840={'filename':_0x3804ae['name'],'path':path['join'](config[_0x4866('0x63')],'server',_0x4866('0xbb'),_0x4866('0xc9'),'offline-chat',_0x3804ae[_0x4866('0xca')])};return _0x3d9840;});if(!_0x153964[_0x4866('0xcb')]){return db['sequelize'][_0x4866('0xcc')](function(_0x3093f5){return db['Attachment'][_0x4866('0xcd')](_0x39e1bd,{'transaction':_0x3093f5});});}}})['then'](function(){if(_0x463a31){_0x4cae76=_0x463a31;return db[_0x4866('0xc0')][_0x4866('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0x4866('0xce')],'as':_0x4866('0xcf'),'raw':!![],'include':[{'model':db[_0x4866('0xd0')],'as':_0x4866('0xd0'),'raw':!![]}]}]});}})[_0x4866('0x23')](function(_0x480b3f){if(_0x480b3f&&_0x480b3f[_0x4866('0xcf')]&&_0x153964['forwardOffline']&&_0x153964['forwardOfflineAddress']){var _0x241f96=_0x480b3f[_0x4866('0xd1')]();return respondWithRpcPromise(_0x4866('0xd2'),_0x4866('0xd3'),{'account':_0x241f96,'message':{'from':util['format'](_0x4866('0xd4'),_0x480b3f['name'],_0x480b3f['email']||_0x480b3f[_0x4866('0xcf')][_0x4866('0x48')]),'to':_0x153964['forwardOfflineAddress'],'subject':_0x153964['offlineMessageSubject'],'html':_0x4cae76[_0x4866('0x4c')],'attachments':_0x2d5aba}},client9003)[_0x4866('0x23')](function(){return _0x4cae76;})[_0x4866('0x42')](function(_0x13b180){logger[_0x4866('0x14')](_0x13b180);});}})[_0x4866('0x23')](function(){if(_0x153964&&_0x153964[_0x4866('0xcb')]&&_0x153964[_0x4866('0xd5')]){var _0x47946e=[];if(_0x34da31[_0x4866('0x35')]){_0x47946e=_0x34da31[_0x4866('0x2e')](function(_0x43d5c9){return{'name':_0x43d5c9['originalname'],'basename':_0x43d5c9['filename'],'type':_0x43d5c9[_0x4866('0xc8')],'ChatOfflineMessageId':_0x463a31['id']};});}var _0x22f623;if(!_[_0x4866('0x67')](_0x153964[_0x4866('0xd6')])){var _0x22785d=_['map'](_0x5cf873['body'],function(_0x57d19c){return _0x57d19c;});var _0x3d164f=_[_0x4866('0xd7')](_0x22785d)[0x0];var _0x21d02a=_[_0x4866('0xd8')](_0x3d164f,function(_0x417183){return _0x417183;});_0x22f623=_0x21d02a[0x1][_0x153964[_0x4866('0xd6')]];}var _0x1e563f={'from':_0x5b327a[_0x4866('0xd9')],'firstName':_0x5b327a['firstName'],'lastName':_0x5b327a['lastName'],'mapKey':_0x4866('0xd9'),'message':{'from':_0x5b327a[_0x4866('0xd9')],'to':_0x153964[_0x4866('0xc0')][_0x4866('0xd9')],'cc':'','subject':_[_0x4866('0x67')](_0x22f623)?_0x153964[_0x4866('0xda')]:_0x22f623,'messageId':'','sentAt':new Date(),'attach':_0x47946e[_0x4866('0x35')],'attachments':_0x47946e,'originChannel':_0x4866('0xdb'),'ChatWebsiteId':_0x153964['id'],'ChatOfflineMessageId':_0x4cae76['id'],'originTo':_0x153964[_0x4866('0xc0')][_0x4866('0xd9')]},'body':_0x4cae76[_0x4866('0x4c')]};var _0x2e525a={'account':{'id':_0x153964[_0x4866('0xd5')]},'body':_0x1e563f,'log':_0x4866('0xdc')};return respondWithRpcPromise('NotifyMailAccount',_0x4866('0xdd'),_0x2e525a,client9001)['then'](function(){return _0x4cae76;})[_0x4866('0x42')](function(_0xcb5e59){logger['error'](_0xcb5e59);});}return;})['then'](function(){if(_0x4cae76){return _0x4cae76;}})[_0x4866('0x23')](respondWithResult(_0x1acb00,null))[_0x4866('0x42')](function(_0x4b1080){logger[_0x4866('0x14')](_0x4866('0x42'),_0x4b1080);for(var _0x44af95 of _0x34da31){var _0x48f0f7=path[_0x4866('0x69')](config['root'],_0x4866('0xde'),_0x4866('0xbb'),_0x4866('0xc9'),'offline-chat',_0x44af95['filename']);fs_extra['remove'](_0x48f0f7)[_0x4866('0x42')](function(_0x23236d){logger[_0x4866('0x14')](_0x4866('0xdf'),_0x48f0f7,_0x23236d);});}});};exports[_0x4866('0xe0')]=function(_0x12836b,_0x116c0c){return db['ChatInteraction']['find']({'where':{'id':_0x12836b[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x116c0c,null))[_0x4866('0x23')](function(_0xc33d89){if(_0xc33d89){return _0xc33d89['addInteraction'](_0x12836b[_0x4866('0x4c')][_0x4866('0x55')],_[_0x4866('0xe1')](_0x12836b[_0x4866('0x4c')],[_0x4866('0x55'),'id'])||{});}})['then'](respondWithResult(_0x116c0c,null))[_0x4866('0x42')](handleError(_0x116c0c,null));};exports[_0x4866('0xe2')]=function(_0x59a1d8,_0x6e7c04){var _0x59fe84={'raw':![],'where':{}};var _0x44d241={};var _0x55ddc0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4866('0x51')]({'where':{'id':_0x59a1d8[_0x4866('0x44')]['id']}})['then'](handleEntityNotFound(_0x6e7c04,null))[_0x4866('0x23')](function(_0xbf39c3){if(_0xbf39c3){_0x44d241[_0x4866('0x2d')]=_['keys'](db[_0x4866('0xa7')][_0x4866('0x2a')]);_0x44d241[_0x4866('0x2f')]=_['keys'](_0x59a1d8[_0x4866('0x2f')]);_0x44d241[_0x4866('0x31')]=_['intersection'](_0x44d241['model'],_0x44d241['query']);_0x59fe84[_0x4866('0x33')]=_['intersection'](_0x44d241[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x59a1d8['query']['fields']));_0x59fe84[_0x4866('0x33')]=_0x59fe84[_0x4866('0x33')][_0x4866('0x35')]?_0x59fe84[_0x4866('0x33')]:_0x44d241['model'];if(!_0x59a1d8[_0x4866('0x2f')]['hasOwnProperty']('nolimit')){_0x59fe84[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x59a1d8[_0x4866('0x2f')][_0x4866('0x1e')]);_0x59fe84[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x59a1d8[_0x4866('0x2f')][_0x4866('0x1c')]);}_0x59fe84[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x59a1d8[_0x4866('0x2f')][_0x4866('0x38')]);_0x59fe84[_0x4866('0x3a')]=qs['filters'](_['pick'](_0x59a1d8[_0x4866('0x2f')],_0x44d241[_0x4866('0x31')]));_0x59fe84[_0x4866('0x3a')][_0x4866('0x53')]=_0xbf39c3['id'];if(_0x59a1d8[_0x4866('0x2f')][_0x4866('0x39')]){_0x59fe84[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x59fe84['where'],{'$or':_[_0x4866('0x2e')](_0x59fe84[_0x4866('0x33')],function(_0x101ea4){var _0xf164d3={};_0xf164d3[_0x101ea4]={'$like':'%'+_0x59a1d8[_0x4866('0x2f')][_0x4866('0x39')]+'%'};return _0xf164d3;})});}_0x59fe84=_[_0x4866('0x3b')]({},_0x59fe84,_0x59a1d8[_0x4866('0x3d')]);return db[_0x4866('0xa7')][_0x4866('0x1f')]({'where':_0x59fe84['where']})[_0x4866('0x23')](function(_0x5c83d5){_0x55ddc0[_0x4866('0x1f')]=_0x5c83d5;if(_0x59a1d8['query']['includeAll']){_0x59fe84[_0x4866('0x3e')]=[{'model':db[_0x4866('0x89')],'as':_0x4866('0xe3'),'required':![]},{'model':db['User'],'as':_0x4866('0xe4'),'attributes':[_0x4866('0x28'),_0x4866('0xe5'),_0x4866('0xe6')],'required':![]},{'model':db['Tag'],'as':_0x4866('0xe7'),'attributes':['id',_0x4866('0x28'),_0x4866('0xe8')],'where':_0x59a1d8['query'][_0x4866('0xe9')]?{'id':_0x59a1d8[_0x4866('0x2f')][_0x4866('0xe9')]}:undefined,'required':_0x59a1d8[_0x4866('0x2f')]['tag']?!![]:![]}];}return db[_0x4866('0xa7')]['findAll'](_0x59fe84);})[_0x4866('0x23')](function(_0x1f82d0){_0x55ddc0['rows']=_0x1f82d0;return _0x55ddc0;});}})[_0x4866('0x23')](respondWithFilteredResult(_0x6e7c04,_0x59fe84))[_0x4866('0x42')](handleError(_0x6e7c04,null));};function iftimePromise(_0x358507,_0x543139){return respondWithRpcPromise('Command',_0x4866('0xea'),{'command':_0x543139[_0x4866('0xeb')]?util[_0x4866('0xa0')](_0x4866('0xec'),_0x358507[_0x4866('0xed')],_0x543139[_0x4866('0xeb')]):util[_0x4866('0xa0')](_0x4866('0xee'),_0x358507[_0x4866('0xed')])},client9002)[_0x4866('0x23')](function(_0x276342){var _0x2157bf=_0x276342&&_0x276342[_0x4866('0xef')](_0x4866('0xf0'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x543139['id'],_0x358507['id'],_0x358507['interval'],_0x2157bf?_0x4866('0xf1'):_0x4866('0xf2'),_0x543139[_0x4866('0xeb')]?_0x543139['timezone']:_0x4866('0xf3'));return _0x2157bf;})[_0x4866('0x42')](function(_0x243da9){logger[_0x4866('0x14')](_0x4866('0xf4'),_0x543139['id'],_0x358507['id'],_0x358507['interval'],util[_0x4866('0xf5')](_0x243da9,{'showHidden':![],'depth':null}),_0x543139[_0x4866('0xeb')]?_0x543139[_0x4866('0xeb')]:'No\x20timezone');return![];});}exports[_0x4866('0xea')]=function(_0x4abf7d,_0x539185){var _0x4812c1=0x0;var _0x50341a=0x0;var _0x325c3d=![];var _0x2f4bff;var _0x16f3f6;return db[_0x4866('0x3f')]['find']({'where':{'id':_0x4abf7d['params']['id']},'include':[{'model':db[_0x4866('0xf6')],'as':_0x4866('0xf6'),'include':[{'model':db[_0x4866('0xf6')],'as':_0x4866('0xf7'),'attributes':['id',_0x4866('0xed')],'raw':!![]}]}]})[_0x4866('0x23')](handleEntityNotFound(_0x539185,null))[_0x4866('0x23')](function(_0x1b7cfa){if(_0x1b7cfa){_0x2f4bff=_0x1b7cfa;return _0x1b7cfa[_0x4866('0xf8')]({'raw':!![]});}})[_0x4866('0x23')](function(_0x23799a){if(_0x2f4bff){if(_0x23799a){_0x16f3f6=_0x23799a;}}return require(_0x4866('0x64'))[_0x4866('0x65')]();})[_0x4866('0x23')](function(_0x13f7d0){if(_0x13f7d0){_0x50341a=_0x13f7d0[_0x4866('0xf9')];_0x325c3d=_0x13f7d0[_0x4866('0x66')];}})[_0x4866('0x23')](function(){return db[_0x4866('0xa7')]['count']({'where':{'closed':![]}});})[_0x4866('0x23')](function(_0x4469aa){_0x4812c1=_0x4469aa;if(_0x50341a&&_0x4469aa>_0x50341a){return db[_0x4866('0xfa')][_0x4866('0x51')]({'where':{'id':0x1}})[_0x4866('0x23')](function(_0x2f35ef){if(_0x2f35ef){_0x2f35ef[_0x4866('0xfb')](_0x4866('0xfc'));}});}})[_0x4866('0x23')](function(){if(_0x2f4bff['Interval']&&_0x2f4bff['Interval'][_0x4866('0xf7')]){var _0x5c3119=[];for(var _0x2db1be=0x0;_0x2db1be<_0x2f4bff[_0x4866('0xf6')][_0x4866('0xf7')][_0x4866('0x35')];_0x2db1be++){var _0x8d1883=_0x2f4bff[_0x4866('0xf6')]['Intervals'][_0x2db1be][_0x4866('0x25')]({'plain':!![]});_0x5c3119[_0x4866('0xaf')](iftimePromise(_0x8d1883,_0x2f4bff));}return BPromise[_0x4866('0xfd')](_0x5c3119)[_0x4866('0x23')](function(_0x198fce){return _['some'](_0x198fce);});}else{return!![];}})['then'](function(_0x4cc7a5){var _0x186aa6=fs[_0x4866('0xfe')](path[_0x4866('0x69')](config[_0x4866('0x63')],'server/files/chat/iframe.ejs'),_0x4866('0xc2'));var _0x859ecf=new url['URL'](_0x2f4bff['address'])[_0x4866('0xff')];var _0x32848d='3.2.0';var _0x77cf20=![];var _0x4f3efb={'chatVersion':_0x32848d,'chatWebsiteAddressOrigin':_0x859ecf,'remote':_0x2f4bff[_0x4866('0x100')],'query':querystring['stringify'](_[_0x4866('0x3b')](_0x2f4bff['get']({'plain':!![]}),{'customerIp':_0x4abf7d[_0x4866('0x77')][_0x4866('0x99')]||_0x4abf7d[_0x4866('0x77')]['x-real-ip']||_0x4abf7d['connection'][_0x4866('0x101')]||_0x4abf7d['ip'],'referer':_0x4abf7d['headers'][_0x4866('0x9d')],'openedInteractions':_0x4812c1,'maxInteractions':_0x50341a,'virtual':_0x325c3d[_0x4866('0xf9')],'online':_0x4cc7a5,'custom':_0x325c3d}))[_0x4866('0x102')](/'/g,'\x5c\x27')};_0x539185[_0x4866('0xbc')](ejs[_0x4866('0xc3')](Mustache[_0x4866('0xc3')](_0x186aa6,_0x4f3efb),{'proactiveActions':_0x16f3f6,'alignment':_0x2f4bff[_0x4866('0x103')],'verticalAlignment':_0x2f4bff['verticalAlignment'],'div_color':_0x2f4bff['color'],'labelText':_0x2f4bff['labelText'],'text_color':_0x2f4bff[_0x4866('0x104')],'text_button_color':_0x2f4bff[_0x4866('0x105')],'button_color':_0x2f4bff[_0x4866('0x106')],'background_color':_0x2f4bff['backgroundColor'],'hideWhenOffline':_0x2f4bff[_0x4866('0x107')],'intervalId':_0x2f4bff['IntervalId'],'isDevelopment':_0x77cf20,'chatVersion':_0x32848d}));})[_0x4866('0x42')](handleError(_0x539185,null));};exports[_0x4866('0x108')]=function(_0x2f92b6,_0x2bd4ec){var _0x57d717=_0x2f92b6[_0x4866('0x44')]['id'];var _0x1f3694=_0x2f92b6['body'];var _0x58c6a1=0xc8;var _0x1b1a42=null;return db[_0x4866('0x109')]['transaction']({'isolationLevel':db[_0x4866('0x109')][_0x4866('0x10a')][_0x4866('0x10b')]['READ_COMMITTED']},function(_0x291ee8){return db[_0x4866('0x3f')][_0x4866('0x51')]({'where':{'id':_0x57d717},'transaction':_0x291ee8})[_0x4866('0x23')](function(_0x12738f){if(_0x12738f){return db[_0x4866('0x8c')][_0x4866('0x24')]({'where':{'ChatWebsiteId':_0x57d717},'transaction':_0x291ee8})['then'](function(){var _0x124a3f=_[_0x4866('0x2e')](_0x1f3694,function(_0x4ab085){_0x4ab085[_0x4866('0x53')]=_0x57d717;return _0x4ab085;});return db[_0x4866('0x8c')][_0x4866('0xcd')](_0x124a3f,{'transaction':_0x291ee8});});}else{_0x58c6a1=0x194;_0x1b1a42=[];}});})[_0x4866('0x23')](function(){if(_0x58c6a1!==0x194){return db[_0x4866('0x8c')][_0x4866('0x10c')]({'where':{'ChatWebsiteId':_0x57d717},'order':_0x4866('0x93')})['then'](function(_0x5c78ba){_0x1b1a42=_0x5c78ba;});}})[_0x4866('0x42')](function(_0x4c3888){_0x58c6a1=0x1f4;logger[_0x4866('0x14')](_0x4c3888[_0x4866('0x27')]);if(_0x4c3888[_0x4866('0x28')]){delete _0x4c3888['name'];}_0x1b1a42=_0x4c3888;})[_0x4866('0x10d')](function(){if(_0x1b1a42===null){_0x2bd4ec['sendStatus'](_0x58c6a1);}else{if(_0x58c6a1===0x1f4){_0x2bd4ec[_0x4866('0x1a')](_0x58c6a1)[_0x4866('0xbc')](_0x1b1a42);}else{_0x2bd4ec[_0x4866('0x1a')](_0x58c6a1)['json'](_0x1b1a42);}}});};exports['getApplications']=function(_0x631094,_0x3e4214){var _0x53b553={};var _0x230abb={};var _0x5b2bbc;var _0x5b784e;return db[_0x4866('0x3f')]['findOne']({'where':{'id':_0x631094[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x3e4214,null))['then'](function(_0x583c41){if(_0x583c41){_0x5b2bbc=_0x583c41;_0x230abb[_0x4866('0x2d')]=_['keys'](db[_0x4866('0x8c')]['rawAttributes']);_0x230abb[_0x4866('0x2f')]=_[_0x4866('0x30')](_0x631094[_0x4866('0x2f')]);_0x230abb[_0x4866('0x31')]=_[_0x4866('0x32')](_0x230abb['model'],_0x230abb[_0x4866('0x2f')]);_0x53b553[_0x4866('0x33')]=_[_0x4866('0x32')](_0x230abb[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x631094['query'][_0x4866('0x34')]));_0x53b553['attributes']=_0x53b553[_0x4866('0x33')][_0x4866('0x35')]?_0x53b553[_0x4866('0x33')]:_0x230abb[_0x4866('0x2d')];_0x53b553[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x631094[_0x4866('0x2f')]['sort']);_0x53b553['where']=qs[_0x4866('0x31')](_['pick'](_0x631094['query'],_0x230abb['filters']));if(_0x631094['query'][_0x4866('0x39')]){_0x53b553[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x53b553[_0x4866('0x3a')],{'$or':_['map'](_0x53b553[_0x4866('0x33')],function(_0x312489){var _0x8de531={};_0x8de531[_0x312489]={'$like':'%'+_0x631094[_0x4866('0x2f')]['filter']+'%'};return _0x8de531;})});}_0x53b553=_[_0x4866('0x3b')]({},_0x53b553,_0x631094[_0x4866('0x3d')]);return _0x5b2bbc[_0x4866('0x10e')](_0x53b553);}})['then'](function(_0xacdfd4){if(_0xacdfd4){_0x5b784e=_0xacdfd4[_0x4866('0x35')];if(!_0x631094[_0x4866('0x2f')]['hasOwnProperty'](_0x4866('0x59'))){_0x53b553[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x631094[_0x4866('0x2f')][_0x4866('0x1e')]);_0x53b553['offset']=qs['offset'](_0x631094[_0x4866('0x2f')][_0x4866('0x1c')]);}return _0x5b2bbc[_0x4866('0x10e')](_0x53b553);}})[_0x4866('0x23')](function(_0x307b26){if(_0x307b26){return _0x307b26?{'count':_0x5b784e,'rows':_0x307b26}:null;}})[_0x4866('0x23')](respondWithResult(_0x3e4214,null))[_0x4866('0x42')](handleError(_0x3e4214,null));};exports['addProactiveActions']=function(_0x5e7c90,_0x50801c){return db['chatProactiveAction'][_0x4866('0x46')]({'where':{'id':_0x5e7c90[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x50801c,null))[_0x4866('0x23')](function(_0x1fbb07){if(_0x1fbb07){return _0x1fbb07['addProactiveActions'](_0x5e7c90[_0x4866('0x4c')][_0x4866('0x55')],_[_0x4866('0xe1')](_0x5e7c90[_0x4866('0x4c')],[_0x4866('0x55'),'id'])||{});}})['then'](respondWithResult(_0x50801c,null))[_0x4866('0x42')](handleError(_0x50801c,null));};exports[_0x4866('0xf8')]=function(_0x4f68b8,_0x46f399){var _0x5caeca={};var _0x23ca41={};var _0x4c599c;var _0xad0308;return db['ChatWebsite'][_0x4866('0x51')]({'where':{'id':_0x4f68b8[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x46f399,null))[_0x4866('0x23')](function(_0x51e2ee){if(_0x51e2ee){_0x4c599c=_0x51e2ee;_0x23ca41[_0x4866('0x2d')]=_[_0x4866('0x30')](db[_0x4866('0x10f')][_0x4866('0x2a')]);_0x23ca41[_0x4866('0x2f')]=_[_0x4866('0x30')](_0x4f68b8[_0x4866('0x2f')]);_0x23ca41['filters']=_[_0x4866('0x32')](_0x23ca41[_0x4866('0x2d')],_0x23ca41[_0x4866('0x2f')]);_0x5caeca[_0x4866('0x33')]=_[_0x4866('0x32')](_0x23ca41[_0x4866('0x2d')],qs[_0x4866('0x34')](_0x4f68b8['query'][_0x4866('0x34')]));_0x5caeca[_0x4866('0x33')]=_0x5caeca[_0x4866('0x33')][_0x4866('0x35')]?_0x5caeca[_0x4866('0x33')]:_0x23ca41['model'];_0x5caeca['order']=qs[_0x4866('0x38')](_0x4f68b8[_0x4866('0x2f')]['sort']);_0x5caeca[_0x4866('0x3a')]=qs['filters'](_[_0x4866('0x52')](_0x4f68b8[_0x4866('0x2f')],_0x23ca41['filters']));if(_0x4f68b8[_0x4866('0x2f')][_0x4866('0x39')]){_0x5caeca[_0x4866('0x3a')]=_[_0x4866('0x3b')](_0x5caeca[_0x4866('0x3a')],{'$or':_[_0x4866('0x2e')](_0x5caeca[_0x4866('0x33')],function(_0x397424){var _0x5611a8={};_0x5611a8[_0x397424]={'$like':'%'+_0x4f68b8['query'][_0x4866('0x39')]+'%'};return _0x5611a8;})});}_0x5caeca=_[_0x4866('0x3b')]({},_0x5caeca,_0x4f68b8[_0x4866('0x3d')]);return _0x4c599c[_0x4866('0xf8')](_0x5caeca);}})['then'](function(_0x16a8ef){if(_0x16a8ef){_0xad0308=_0x16a8ef[_0x4866('0x35')];if(!_0x4f68b8[_0x4866('0x2f')][_0x4866('0x36')](_0x4866('0x59'))){_0x5caeca['limit']=qs[_0x4866('0x1e')](_0x4f68b8['query']['limit']);_0x5caeca['offset']=qs[_0x4866('0x1c')](_0x4f68b8[_0x4866('0x2f')]['offset']);}return _0x4c599c[_0x4866('0xf8')](_0x5caeca);}})['then'](function(_0x3b4821){if(_0x3b4821){return _0x3b4821?{'count':_0xad0308,'rows':_0x3b4821}:null;}})['then'](respondWithResult(_0x46f399,null))[_0x4866('0x42')](handleError(_0x46f399,null));};exports[_0x4866('0x110')]=function(_0x1c0cd9,_0x1e071b){var _0x47edb7=_0x1c0cd9['query']['online']==='false'?_0x4866('0x111'):_0x4866('0x112');return db[_0x4866('0x3f')]['find']({'attributes':['id',_0x47edb7],'where':{'id':_0x1c0cd9[_0x4866('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e071b,null))[_0x4866('0x23')](function(_0x10406a){if(_0x10406a){var _0x175903=_0x10406a[_0x47edb7];var _0x2f6074=_0x175903&&_0x175903[_0x4866('0x113')]?_0x175903[_0x4866('0x113')]:[];_0x1e071b['send']({'fromKey':_['isNil'](_0x175903[_0x4866('0x114')])?undefined:_0x175903[_0x4866('0x114')],'count':_0x2f6074[_0x4866('0x35')],'rows':_0x2f6074});}})[_0x4866('0x42')](handleError(_0x1e071b,null));};exports['getOfflineMessages']=function(_0x2a24aa,_0x44931a){var _0x4605d1={'raw':![],'where':{}};var _0x34ee81={};var _0x355643={'count':0x0,'rows':[]};return db[_0x4866('0x3f')]['findOne']({'where':{'id':_0x2a24aa[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x44931a,null))['then'](function(_0xf7ae36){if(_0xf7ae36){_0x34ee81[_0x4866('0x2d')]=_[_0x4866('0x30')](db['ChatOfflineMessage'][_0x4866('0x2a')]);_0x34ee81[_0x4866('0x2f')]=_[_0x4866('0x30')](_0x2a24aa[_0x4866('0x2f')]);_0x34ee81[_0x4866('0x31')]=_[_0x4866('0x32')](_0x34ee81[_0x4866('0x2d')],_0x34ee81[_0x4866('0x2f')]);_0x4605d1[_0x4866('0x33')]=_[_0x4866('0x32')](_0x34ee81[_0x4866('0x2d')],qs['fields'](_0x2a24aa['query'][_0x4866('0x34')]));_0x4605d1[_0x4866('0x33')]=_0x4605d1['attributes']['length']?_0x4605d1[_0x4866('0x33')]:_0x34ee81['model'];if(!_0x2a24aa['query'][_0x4866('0x36')]('nolimit')){_0x4605d1[_0x4866('0x1e')]=qs['limit'](_0x2a24aa[_0x4866('0x2f')][_0x4866('0x1e')]);_0x4605d1[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x2a24aa[_0x4866('0x2f')]['offset']);}_0x4605d1[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x2a24aa[_0x4866('0x2f')]['sort']);_0x4605d1[_0x4866('0x3a')]=qs[_0x4866('0x31')](_[_0x4866('0x52')](_0x2a24aa[_0x4866('0x2f')],_0x34ee81[_0x4866('0x31')]));_0x4605d1[_0x4866('0x3a')][_0x4866('0x53')]=_0xf7ae36['id'];if(_0x2a24aa[_0x4866('0x2f')][_0x4866('0x39')]){_0x4605d1['where']=_['merge'](_0x4605d1[_0x4866('0x3a')],{'$or':_['map'](_0x4605d1['attributes'],function(_0x5065fd){var _0x56845a={};_0x56845a[_0x5065fd]={'$like':'%'+_0x2a24aa[_0x4866('0x2f')][_0x4866('0x39')]+'%'};return _0x56845a;})});}_0x4605d1=_[_0x4866('0x3b')]({},_0x4605d1,_0x2a24aa[_0x4866('0x3d')]);return db[_0x4866('0xc5')][_0x4866('0x1f')]({'where':_0x4605d1[_0x4866('0x3a')]})[_0x4866('0x23')](function(_0x5268ac){_0x355643[_0x4866('0x1f')]=_0x5268ac;if(_0x2a24aa['query'][_0x4866('0x45')]){_0x4605d1[_0x4866('0x3e')]=[{'all':!![]}];}else{_0x4605d1[_0x4866('0x3e')]=[{'model':db[_0x4866('0x89')],'as':_0x4866('0xe3'),'required':![]},{'model':db[_0x4866('0x115')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x4605d1);})[_0x4866('0x23')](function(_0x3a8a81){_0x355643[_0x4866('0x41')]=_0x3a8a81;return _0x355643;});}})['then'](respondWithFilteredResult(_0x44931a,_0x4605d1))[_0x4866('0x42')](handleError(_0x44931a,null));};exports[_0x4866('0x116')]=function(_0x422833,_0x584eb4){return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x422833[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0x584eb4,null))[_0x4866('0x23')](function(_0x4c8b44){if(_0x4c8b44){return _0x4c8b44[_0x4866('0x116')](_0x422833['body'][_0x4866('0x55')],_[_0x4866('0xe1')](_0x422833[_0x4866('0x4c')],[_0x4866('0x55'),'id'])||{})[_0x4866('0xab')](function(_0x10272d){for(var _0x1a9535=0x0;_0x1a9535<_0x422833[_0x4866('0x4c')][_0x4866('0x55')][_0x4866('0x35')];_0x1a9535+=0x1){socket[_0x4866('0x117')](_0x4866('0x118'),{'UserId':Number(_0x422833['body'][_0x4866('0x55')][_0x1a9535]),'ChatWebsiteId':Number(_0x422833[_0x4866('0x44')]['id'])});}return _0x10272d;});}})[_0x4866('0x23')](respondWithResult(_0x584eb4,null))[_0x4866('0x42')](handleError(_0x584eb4,null));};exports[_0x4866('0x119')]=function(_0x22ff04,_0x35414f){return db[_0x4866('0x3f')][_0x4866('0x46')]({'where':{'id':_0x22ff04[_0x4866('0x44')]['id']}})['then'](handleEntityNotFound(_0x35414f,null))[_0x4866('0x23')](function(_0x3a5266){if(_0x3a5266){return _0x3a5266[_0x4866('0x119')](_0x22ff04['query'][_0x4866('0x55')])[_0x4866('0x23')](function(){if(_[_0x4866('0x11a')](_0x22ff04[_0x4866('0x2f')][_0x4866('0x55')])){for(var _0x4fc06e=0x0;_0x4fc06e<_0x22ff04['query'][_0x4866('0x55')][_0x4866('0x35')];_0x4fc06e+=0x1){socket[_0x4866('0x117')](_0x4866('0x11b'),{'UserId':Number(_0x22ff04[_0x4866('0x2f')][_0x4866('0x55')][_0x4fc06e]),'ChatWebsiteId':Number(_0x22ff04[_0x4866('0x44')]['id'])});}}else{socket[_0x4866('0x117')]('userChatWebsite:remove',{'UserId':Number(_0x22ff04['query'][_0x4866('0x55')]),'ChatWebsiteId':Number(_0x22ff04['params']['id'])});}});}})[_0x4866('0x23')](respondWithStatusCode(_0x35414f,null))[_0x4866('0x42')](handleError(_0x35414f,null));};exports[_0x4866('0x11c')]=function(_0x51bc5b,_0xa8f531){var _0x302747={};var _0x51f25c={};var _0x5db1f2;var _0x6abcf9;return db[_0x4866('0x3f')][_0x4866('0x51')]({'where':{'id':_0x51bc5b[_0x4866('0x44')]['id']}})[_0x4866('0x23')](handleEntityNotFound(_0xa8f531,null))[_0x4866('0x23')](function(_0x461d74){if(_0x461d74){_0x5db1f2=_0x461d74;_0x51f25c['model']=_['keys'](db['User'][_0x4866('0x2a')]);_0x51f25c['query']=_[_0x4866('0x30')](_0x51bc5b[_0x4866('0x2f')]);_0x51f25c['filters']=_[_0x4866('0x32')](_0x51f25c[_0x4866('0x2d')],_0x51f25c[_0x4866('0x2f')]);_0x302747[_0x4866('0x33')]=_[_0x4866('0x32')](_0x51f25c['model'],qs['fields'](_0x51bc5b[_0x4866('0x2f')][_0x4866('0x34')]));_0x302747[_0x4866('0x33')]=_0x302747[_0x4866('0x33')][_0x4866('0x35')]?_0x302747[_0x4866('0x33')]:_0x51f25c[_0x4866('0x2d')];_0x302747[_0x4866('0x37')]=qs[_0x4866('0x38')](_0x51bc5b[_0x4866('0x2f')]['sort']);_0x302747[_0x4866('0x3a')]=qs[_0x4866('0x31')](_[_0x4866('0x52')](_0x51bc5b[_0x4866('0x2f')],_0x51f25c[_0x4866('0x31')]));if(_0x51bc5b[_0x4866('0x2f')][_0x4866('0x39')]){_0x302747[_0x4866('0x3a')]=_['merge'](_0x302747[_0x4866('0x3a')],{'$or':_['map'](_0x302747['attributes'],function(_0x9be3be){var _0x23e27e={};_0x23e27e[_0x9be3be]={'$like':'%'+_0x51bc5b['query'][_0x4866('0x39')]+'%'};return _0x23e27e;})});}_0x302747=_['merge']({},_0x302747,_0x51bc5b[_0x4866('0x3d')]);return _0x5db1f2[_0x4866('0x11c')](_0x302747);}})[_0x4866('0x23')](function(_0x383ee9){if(_0x383ee9){_0x6abcf9=_0x383ee9[_0x4866('0x35')];if(!_0x51bc5b[_0x4866('0x2f')]['hasOwnProperty'](_0x4866('0x59'))){_0x302747[_0x4866('0x1e')]=qs[_0x4866('0x1e')](_0x51bc5b[_0x4866('0x2f')][_0x4866('0x1e')]);_0x302747['offset']=qs[_0x4866('0x1c')](_0x51bc5b[_0x4866('0x2f')][_0x4866('0x1c')]);}return _0x5db1f2['getAgents'](_0x302747);}})[_0x4866('0x23')](function(_0x3b93d9){if(_0x3b93d9){return _0x3b93d9?{'count':_0x6abcf9,'rows':_0x3b93d9}:null;}})[_0x4866('0x23')](respondWithResult(_0xa8f531,null))[_0x4866('0x42')](handleError(_0xa8f531,null));}; \ No newline at end of file +var _0x111c=['internal','Tag','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','timezone','No\x20timezone','inspect','getProactiveActions','virtual','License','chatLicenseExceeded','Interval','Intervals','all','some','readFileSync','URL','address','origin','3.2.0','x-real-ip','connection','remoteAddress','replace','verticalAlignment','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','get','ChatWebsites','stack','name','send','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','find','create','body','UserProfileSection','UserProfileResource','Pause','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','getAnswers','findOne','findAll','removeAnswers','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','join','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','CmContact','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','Contacts','contact','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','version','unknown','device','%s\x20%s\x20%s','vendor','type','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','filename','mimetype','attachments','offline-chat','basename','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','email','Smtp','user','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','server','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x111c,0x162));var _0xc111=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x111c[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0xc111('0x0'));var Mustache=require(_0xc111('0x1'));var util=require('util');var path=require(_0xc111('0x2'));var ejs=require(_0xc111('0x3'));var fs=require('fs');var fs_extra=require(_0xc111('0x4'));var _=require(_0xc111('0x5'));var querystring=require(_0xc111('0x6'));var Redis=require('ioredis');var qs=require(_0xc111('0x7'));var logger=require('../../config/logger')(_0xc111('0x8'));var config=require(_0xc111('0x9'));var url=require(_0xc111('0xa'));var db=require(_0xc111('0xb'))['db'];config['redis']=_[_0xc111('0xc')](config[_0xc111('0xd')],{'host':_0xc111('0xe'),'port':0x18eb});var socket=require(_0xc111('0xf'))(new Redis(config[_0xc111('0xd')]));require(_0xc111('0x10'))[_0xc111('0x11')](socket);var htmlToText=require(_0xc111('0x12'));var jayson=require(_0xc111('0x13'));var client=jayson[_0xc111('0x14')][_0xc111('0x15')]({'port':0x232c});var client9002=jayson[_0xc111('0x14')][_0xc111('0x15')]({'port':0x232a});var client9003=jayson['client'][_0xc111('0x15')]({'port':0x232b});var client9001=jayson[_0xc111('0x14')][_0xc111('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x25db91,_0x26a8c3,_0x1ab6aa,_0x3ea9a7){return new BPromise(function(_0x13be22,_0x5c1206){var _0x4e1c1f=_0x3ea9a7||client;return _0x4e1c1f['request'](_0x25db91,_0x1ab6aa)[_0xc111('0x16')](function(_0x3469c9){logger[_0xc111('0x17')](_0xc111('0x18'),_0x26a8c3,_0xc111('0x19'));logger[_0xc111('0x1a')](_0xc111('0x1b'),_0x26a8c3,_0xc111('0x19'),JSON['stringify'](_0x3469c9));if(_0x3469c9[_0xc111('0x1c')]){if(_0x3469c9[_0xc111('0x1c')]['code']===0x1f4){logger[_0xc111('0x1c')](_0xc111('0x18'),_0x26a8c3,_0x3469c9[_0xc111('0x1c')][_0xc111('0x1d')]);return _0x5c1206(_0x3469c9['error'][_0xc111('0x1d')]);}logger[_0xc111('0x1c')](_0xc111('0x18'),_0x26a8c3,_0x3469c9[_0xc111('0x1c')]['message']);return _0x13be22(_0x3469c9['error'][_0xc111('0x1d')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x26a8c3,_0xc111('0x19'));_0x13be22(_0x3469c9[_0xc111('0x1e')]['message']);}})[_0xc111('0x1f')](function(_0x9bb9f4){logger[_0xc111('0x1c')](_0xc111('0x18'),_0x26a8c3,_0x9bb9f4);_0x5c1206(_0x9bb9f4);});});}function respondWithStatusCode(_0x52d7ee,_0x3ef248){_0x3ef248=_0x3ef248||0xcc;return function(_0x2b2ae6){if(_0x2b2ae6){return _0x52d7ee[_0xc111('0x20')](_0x3ef248);}return _0x52d7ee[_0xc111('0x21')](_0x3ef248)[_0xc111('0x22')]();};}function respondWithResult(_0x484f10,_0x304e5c){_0x304e5c=_0x304e5c||0xc8;return function(_0x57aadb){if(_0x57aadb){return _0x484f10[_0xc111('0x21')](_0x304e5c)[_0xc111('0x23')](_0x57aadb);}};}function respondWithFilteredResult(_0x3ed95d,_0x51efab){return function(_0x5c624e){if(_0x5c624e){var _0x51219b=typeof _0x51efab[_0xc111('0x24')]===_0xc111('0x25')&&typeof _0x51efab[_0xc111('0x26')]===_0xc111('0x25');var _0x4d2c5b=_0x5c624e[_0xc111('0x27')];var _0x1b0fa3=_0x51219b?0x0:_0x51efab['offset'];var _0x5d4bb9=_0x51219b?_0x5c624e[_0xc111('0x27')]:_0x51efab[_0xc111('0x24')]+_0x51efab[_0xc111('0x26')];var _0x64d761;if(_0x5d4bb9>=_0x4d2c5b){_0x5d4bb9=_0x4d2c5b;_0x64d761=0xc8;}else{_0x64d761=0xce;}_0x3ed95d['status'](_0x64d761);return _0x3ed95d['set']('Content-Range',_0x1b0fa3+'-'+_0x5d4bb9+'/'+_0x4d2c5b)[_0xc111('0x23')](_0x5c624e);}return null;};}function saveUpdates(_0x866f65){return function(_0x59c3b4){if(_0x59c3b4){return _0x59c3b4[_0xc111('0x28')](_0x866f65)[_0xc111('0x16')](function(_0x9b4426){return _0x9b4426;});}return null;};}function removeEntity(_0x534238){return function(_0x43f332){if(_0x43f332){return _0x43f332[_0xc111('0x29')]()['then'](function(){var _0x5c35ba=_0x43f332[_0xc111('0x2a')]({'plain':!![]});var _0x2f692a=_0xc111('0x2b');return db['UserProfileResource'][_0xc111('0x29')]({'where':{'type':_0x2f692a,'resourceId':_0x5c35ba['id']}})[_0xc111('0x16')](function(){return _0x43f332;});})[_0xc111('0x16')](function(){_0x534238[_0xc111('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e899){return function(_0x47081d){if(!_0x47081d){_0x29e899[_0xc111('0x20')](0x194);}return _0x47081d;};}function handleError(_0x58350d,_0x13d8ae){_0x13d8ae=_0x13d8ae||0x1f4;return function(_0x23dc3c){logger['error'](_0x23dc3c[_0xc111('0x2c')]);if(_0x23dc3c[_0xc111('0x2d')]){delete _0x23dc3c[_0xc111('0x2d')];}_0x58350d[_0xc111('0x21')](_0x13d8ae)[_0xc111('0x2e')](_0x23dc3c);};}exports['index']=function(_0x4334fb,_0x56f82d){var _0x35a920={'include':[{'model':db['Pause'],'as':_0xc111('0x2f')}]},_0x57b507={},_0x103a3b={'count':0x0,'rows':[]};var _0xd281db=_[_0xc111('0x30')](db[_0xc111('0x31')][_0xc111('0x32')],function(_0x394395){return{'name':_0x394395['fieldName'],'type':_0x394395['type'][_0xc111('0x33')]};});_0x57b507[_0xc111('0x34')]=_[_0xc111('0x30')](_0xd281db,_0xc111('0x2d'));_0x57b507[_0xc111('0x35')]=_[_0xc111('0x36')](_0x4334fb[_0xc111('0x35')]);_0x57b507[_0xc111('0x37')]=_[_0xc111('0x38')](_0x57b507[_0xc111('0x34')],_0x57b507['query']);_0x35a920[_0xc111('0x39')]=_['intersection'](_0x57b507[_0xc111('0x34')],qs[_0xc111('0x3a')](_0x4334fb[_0xc111('0x35')][_0xc111('0x3a')]));_0x35a920[_0xc111('0x39')]=_0x35a920[_0xc111('0x39')][_0xc111('0x3b')]?_0x35a920['attributes']:_0x57b507[_0xc111('0x34')];if(!_0x4334fb[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x35a920[_0xc111('0x26')]=qs[_0xc111('0x26')](_0x4334fb[_0xc111('0x35')]['limit']);_0x35a920[_0xc111('0x24')]=qs[_0xc111('0x24')](_0x4334fb[_0xc111('0x35')]['offset']);}_0x35a920[_0xc111('0x3e')]=qs[_0xc111('0x3f')](_0x4334fb['query'][_0xc111('0x3f')]);_0x35a920['where']=qs['filters'](_[_0xc111('0x40')](_0x4334fb[_0xc111('0x35')],_0x57b507[_0xc111('0x37')]),_0xd281db);if(_0x4334fb[_0xc111('0x35')][_0xc111('0x41')]){_0x35a920['where']=_['merge'](_0x35a920[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0xd281db,function(_0x305ca1){if(_0x305ca1['type']!==_0xc111('0x43')){var _0x4e2926={};_0x4e2926[_0x305ca1[_0xc111('0x2d')]]={'$like':'%'+_0x4334fb['query'][_0xc111('0x41')]+'%'};return _0x4e2926;}})});}_0x35a920=_[_0xc111('0x44')]({},_0x35a920,_0x4334fb[_0xc111('0x45')]);var _0xd0e9f8={'where':_0x35a920[_0xc111('0x42')]};return db[_0xc111('0x31')][_0xc111('0x27')](_0xd0e9f8)[_0xc111('0x16')](function(_0x26f596){_0x103a3b[_0xc111('0x27')]=_0x26f596;if(_0x4334fb[_0xc111('0x35')][_0xc111('0x46')]){_0x35a920[_0xc111('0x47')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x35a920);})['then'](function(_0x6d9fff){_0x103a3b[_0xc111('0x48')]=_0x6d9fff;return _0x103a3b;})[_0xc111('0x16')](respondWithFilteredResult(_0x56f82d,_0x35a920))[_0xc111('0x1f')](handleError(_0x56f82d,null));};exports['show']=function(_0x4099f6,_0x2eb36){var _0x2ead74={'raw':![],'where':{'id':_0x4099f6['params']['id']},'include':[{'model':db['Pause'],'as':_0xc111('0x2f')}]},_0x49ceed={};_0x49ceed['model']=_[_0xc111('0x36')](db[_0xc111('0x31')][_0xc111('0x32')]);_0x49ceed[_0xc111('0x35')]=_[_0xc111('0x36')](_0x4099f6['query']);_0x49ceed[_0xc111('0x37')]=_[_0xc111('0x38')](_0x49ceed[_0xc111('0x34')],_0x49ceed['query']);_0x2ead74[_0xc111('0x39')]=_[_0xc111('0x38')](_0x49ceed[_0xc111('0x34')],qs['fields'](_0x4099f6[_0xc111('0x35')][_0xc111('0x3a')]));_0x2ead74['attributes']=_0x2ead74[_0xc111('0x39')][_0xc111('0x3b')]?_0x2ead74['attributes']:_0x49ceed['model'];if(_0x4099f6[_0xc111('0x35')][_0xc111('0x46')]){_0x2ead74[_0xc111('0x47')]=[{'all':!![]}];}_0x2ead74=_[_0xc111('0x44')]({},_0x2ead74,_0x4099f6[_0xc111('0x45')]);return db['ChatWebsite'][_0xc111('0x49')](_0x2ead74)[_0xc111('0x16')](handleEntityNotFound(_0x2eb36,null))[_0xc111('0x16')](respondWithResult(_0x2eb36,null))[_0xc111('0x1f')](handleError(_0x2eb36,null));};exports[_0xc111('0x4a')]=function(_0x186489,_0x109420){return db[_0xc111('0x31')][_0xc111('0x4a')](_0x186489[_0xc111('0x4b')],{})[_0xc111('0x16')](function(_0x3ce16a){var _0x522be7=_0x186489['user']['get']({'plain':!![]});if(!_0x522be7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x522be7['role']==='user'){var _0x89c649=_0x3ce16a[_0xc111('0x2a')]({'plain':!![]});var _0x564cbf='ChatWebsites';return db[_0xc111('0x4c')][_0xc111('0x49')]({'where':{'name':_0x564cbf,'userProfileId':_0x522be7['userProfileId']},'raw':!![]})[_0xc111('0x16')](function(_0x56d580){if(_0x56d580&&_0x56d580['autoAssociation']===0x0){return db[_0xc111('0x4d')][_0xc111('0x4a')]({'name':_0x89c649['name'],'resourceId':_0x89c649['id'],'type':_0x56d580[_0xc111('0x2d')],'sectionId':_0x56d580['id']},{})[_0xc111('0x16')](function(){return _0x3ce16a;});}else{return _0x3ce16a;}})['catch'](function(_0x5e6d9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e6d9e);throw _0x5e6d9e;});}return _0x3ce16a;})[_0xc111('0x16')](respondWithResult(_0x109420,0xc9))[_0xc111('0x1f')](handleError(_0x109420,null));};exports['update']=function(_0x524045,_0x489e3c){if(_0x524045[_0xc111('0x4b')]['id']){delete _0x524045[_0xc111('0x4b')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x524045['params']['id']},'include':[{'model':db[_0xc111('0x4e')],'as':_0xc111('0x2f')}]})[_0xc111('0x16')](handleEntityNotFound(_0x489e3c,null))[_0xc111('0x16')](saveUpdates(_0x524045['body'],null))[_0xc111('0x16')](respondWithResult(_0x489e3c,null))[_0xc111('0x1f')](handleError(_0x489e3c,null));};exports[_0xc111('0x29')]=function(_0x2d7e8c,_0x1b6171){return db[_0xc111('0x31')]['find']({'where':{'id':_0x2d7e8c[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x1b6171,null))[_0xc111('0x16')](removeEntity(_0x1b6171,null))['catch'](handleError(_0x1b6171,null));};exports[_0xc111('0x50')]=function(_0x2fbbc,_0x385a2a){return db[_0xc111('0x31')][_0xc111('0x50')]()['then'](respondWithResult(_0x385a2a,null))[_0xc111('0x1f')](handleError(_0x385a2a,null));};exports[_0xc111('0x51')]=function(_0x40d9bf,_0x549c60){if(_0x40d9bf[_0xc111('0x4b')]['id']){delete _0x40d9bf[_0xc111('0x4b')]['id'];}return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0x40d9bf[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x549c60,null))[_0xc111('0x16')](function(_0x1e5ddf){if(_0x1e5ddf){_0x40d9bf['body'][_0xc111('0x52')]=_0x1e5ddf['id'];return db[_0xc111('0x53')][_0xc111('0x4a')](_0x40d9bf['body']);}})[_0xc111('0x16')](respondWithResult(_0x549c60,null))['catch'](handleError(_0x549c60,null));};exports[_0xc111('0x54')]=function(_0x1bcac3,_0x3f9892){var _0x14c4af={'raw':![],'where':{}};var _0x5e7574={};var _0x5a2e69={'count':0x0,'rows':[]};return db[_0xc111('0x31')]['findOne']({'where':{'id':_0x1bcac3[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x3f9892,null))[_0xc111('0x16')](function(_0x529add){if(_0x529add){_0x5e7574[_0xc111('0x34')]=_['keys'](db[_0xc111('0x53')][_0xc111('0x32')]);_0x5e7574['query']=_[_0xc111('0x36')](_0x1bcac3['query']);_0x5e7574[_0xc111('0x37')]=_[_0xc111('0x38')](_0x5e7574[_0xc111('0x34')],_0x5e7574[_0xc111('0x35')]);_0x14c4af[_0xc111('0x39')]=_[_0xc111('0x38')](_0x5e7574[_0xc111('0x34')],qs[_0xc111('0x3a')](_0x1bcac3['query'][_0xc111('0x3a')]));_0x14c4af[_0xc111('0x39')]=_0x14c4af[_0xc111('0x39')]['length']?_0x14c4af['attributes']:_0x5e7574[_0xc111('0x34')];if(!_0x1bcac3[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x14c4af['limit']=qs[_0xc111('0x26')](_0x1bcac3[_0xc111('0x35')]['limit']);_0x14c4af[_0xc111('0x24')]=qs[_0xc111('0x24')](_0x1bcac3[_0xc111('0x35')][_0xc111('0x24')]);}_0x14c4af['order']=qs[_0xc111('0x3f')](_0x1bcac3[_0xc111('0x35')]['sort']);_0x14c4af['where']=qs[_0xc111('0x37')](_[_0xc111('0x40')](_0x1bcac3['query'],_0x5e7574[_0xc111('0x37')]));_0x14c4af[_0xc111('0x42')][_0xc111('0x52')]=_0x529add['id'];if(_0x1bcac3['query']['filter']){_0x14c4af[_0xc111('0x42')]=_['merge'](_0x14c4af[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0x14c4af['attributes'],function(_0x100387){var _0x1311f6={};_0x1311f6[_0x100387]={'$like':'%'+_0x1bcac3[_0xc111('0x35')][_0xc111('0x41')]+'%'};return _0x1311f6;})});}_0x14c4af=_[_0xc111('0x44')]({},_0x14c4af,_0x1bcac3[_0xc111('0x45')]);return db[_0xc111('0x53')][_0xc111('0x27')]({'where':_0x14c4af['where']})[_0xc111('0x16')](function(_0x111af3){_0x5a2e69[_0xc111('0x27')]=_0x111af3;if(_0x1bcac3[_0xc111('0x35')][_0xc111('0x46')]){_0x14c4af[_0xc111('0x47')]=[{'all':!![]}];}return db[_0xc111('0x53')]['findAll'](_0x14c4af);})[_0xc111('0x16')](function(_0x52ffb3){_0x5a2e69[_0xc111('0x48')]=_0x52ffb3;return _0x5a2e69;});}})[_0xc111('0x16')](respondWithFilteredResult(_0x3f9892,_0x14c4af))[_0xc111('0x1f')](handleError(_0x3f9892,null));};exports[_0xc111('0x55')]=function(_0x2b5482,_0x2a3814){return db[_0xc111('0x31')]['find']({'where':{'id':_0x2b5482[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x2a3814,null))['then'](function(_0xee1bcc){if(_0xee1bcc){return _0xee1bcc[_0xc111('0x55')](_0x2b5482['query'][_0xc111('0x56')]);}})[_0xc111('0x16')](respondWithStatusCode(_0x2a3814,null))[_0xc111('0x1f')](handleError(_0x2a3814,null));};exports['addAnswer']=function(_0x33406b,_0x159c96){if(_0x33406b[_0xc111('0x4b')]['id']){delete _0x33406b[_0xc111('0x4b')]['id'];}return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0x33406b[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x159c96,null))[_0xc111('0x16')](function(_0x3cb21d){if(_0x3cb21d){_0x33406b[_0xc111('0x4b')][_0xc111('0x52')]=_0x3cb21d['id'];return db['CannedAnswer'][_0xc111('0x4a')](_0x33406b[_0xc111('0x4b')]);}})['then'](respondWithResult(_0x159c96,null))[_0xc111('0x1f')](handleError(_0x159c96,null));};exports[_0xc111('0x57')]=function(_0x11a984,_0x5c6a87){var _0x58f1e5={'raw':![],'where':{}};var _0x14bfef={};var _0x51c68d={'count':0x0,'rows':[]};return db[_0xc111('0x31')][_0xc111('0x58')]({'where':{'id':_0x11a984[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x5c6a87,null))[_0xc111('0x16')](function(_0x3aef6d){if(_0x3aef6d){_0x14bfef[_0xc111('0x34')]=_[_0xc111('0x36')](db['CannedAnswer'][_0xc111('0x32')]);_0x14bfef[_0xc111('0x35')]=_[_0xc111('0x36')](_0x11a984[_0xc111('0x35')]);_0x14bfef[_0xc111('0x37')]=_['intersection'](_0x14bfef['model'],_0x14bfef[_0xc111('0x35')]);_0x58f1e5[_0xc111('0x39')]=_[_0xc111('0x38')](_0x14bfef[_0xc111('0x34')],qs['fields'](_0x11a984['query'][_0xc111('0x3a')]));_0x58f1e5[_0xc111('0x39')]=_0x58f1e5[_0xc111('0x39')][_0xc111('0x3b')]?_0x58f1e5[_0xc111('0x39')]:_0x14bfef[_0xc111('0x34')];if(!_0x11a984[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x58f1e5['limit']=qs[_0xc111('0x26')](_0x11a984[_0xc111('0x35')][_0xc111('0x26')]);_0x58f1e5['offset']=qs[_0xc111('0x24')](_0x11a984[_0xc111('0x35')][_0xc111('0x24')]);}_0x58f1e5['order']=qs[_0xc111('0x3f')](_0x11a984[_0xc111('0x35')][_0xc111('0x3f')]);_0x58f1e5[_0xc111('0x42')]=qs['filters'](_[_0xc111('0x40')](_0x11a984[_0xc111('0x35')],_0x14bfef[_0xc111('0x37')]));_0x58f1e5[_0xc111('0x42')][_0xc111('0x52')]=_0x3aef6d['id'];if(_0x11a984[_0xc111('0x35')][_0xc111('0x41')]){_0x58f1e5[_0xc111('0x42')]=_[_0xc111('0x44')](_0x58f1e5[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0x58f1e5[_0xc111('0x39')],function(_0x345f0f){var _0x489992={};_0x489992[_0x345f0f]={'$like':'%'+_0x11a984[_0xc111('0x35')]['filter']+'%'};return _0x489992;})});}_0x58f1e5=_['merge']({},_0x58f1e5,_0x11a984[_0xc111('0x45')]);return db['CannedAnswer'][_0xc111('0x27')]({'where':_0x58f1e5[_0xc111('0x42')]})[_0xc111('0x16')](function(_0x3d654d){_0x51c68d[_0xc111('0x27')]=_0x3d654d;if(_0x11a984[_0xc111('0x35')][_0xc111('0x46')]){_0x58f1e5[_0xc111('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc111('0x59')](_0x58f1e5);})[_0xc111('0x16')](function(_0x409659){_0x51c68d[_0xc111('0x48')]=_0x409659;return _0x51c68d;});}})[_0xc111('0x16')](respondWithFilteredResult(_0x5c6a87,_0x58f1e5))['catch'](handleError(_0x5c6a87,null));};exports[_0xc111('0x5a')]=function(_0xa3465f,_0x8a98a8){return db[_0xc111('0x31')]['find']({'where':{'id':_0xa3465f[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x8a98a8,null))['then'](function(_0x3aa3c4){if(_0x3aa3c4){return _0x3aa3c4[_0xc111('0x5a')](_0xa3465f[_0xc111('0x35')]['ids']);}})[_0xc111('0x16')](respondWithStatusCode(_0x8a98a8,null))[_0xc111('0x1f')](handleError(_0x8a98a8,null));};exports['addLogo']=function(_0xb77b7e,_0x11ff9e){_0xb77b7e['body']['sitepic']=_0xb77b7e[_0xc111('0x5b')]['filename'];return db[_0xc111('0x31')]['find']({'where':{'id':_0xb77b7e['params']['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x11ff9e,null))[_0xc111('0x16')](saveUpdates(_0xb77b7e[_0xc111('0x4b')],null))['then'](respondWithResult(_0x11ff9e,null))[_0xc111('0x1f')](handleError(_0x11ff9e,null));};exports[_0xc111('0x5c')]=function(_0x8bcb7a,_0x1d43aa){_0x8bcb7a['body'][_0xc111('0x5d')]=_0x8bcb7a[_0xc111('0x5b')]['filename'];return db[_0xc111('0x31')]['find']({'where':{'id':_0x8bcb7a['params']['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x1d43aa,null))['then'](saveUpdates(_0x8bcb7a[_0xc111('0x4b')],null))[_0xc111('0x16')](respondWithResult(_0x1d43aa,null))['catch'](handleError(_0x1d43aa,null));};exports[_0xc111('0x5e')]=function(_0x586e7d,_0x5974ff){_0x586e7d[_0xc111('0x4b')][_0xc111('0x5f')]=_0x586e7d[_0xc111('0x5b')]['filename'];return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0x586e7d[_0xc111('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5974ff,null))[_0xc111('0x16')](saveUpdates(_0x586e7d[_0xc111('0x4b')],null))[_0xc111('0x16')](respondWithResult(_0x5974ff,null))[_0xc111('0x1f')](handleError(_0x5974ff,null));};exports[_0xc111('0x60')]=function(_0x980b74,_0x5e904e){_0x980b74['body'][_0xc111('0x61')]=_0x980b74[_0xc111('0x5b')]['filename'];return db[_0xc111('0x31')]['find']({'where':{'id':_0x980b74[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x5e904e,null))[_0xc111('0x16')](saveUpdates(_0x980b74[_0xc111('0x4b')],null))[_0xc111('0x16')](respondWithResult(_0x5e904e,null))[_0xc111('0x1f')](handleError(_0x5e904e,null));};exports['getLogo']=function(_0x2490a8,_0x995a15){var _0x18f68b=path['join'](config[_0xc111('0x62')],_0xc111('0x63'));var _0x3ebd52={'where':{'id':_0x2490a8[_0xc111('0x4f')]['id']},'attributes':['id',_0xc111('0x64')],'raw':!![]};var _0x29872c=![];return require(_0xc111('0x65'))[_0xc111('0x66')]()[_0xc111('0x16')](function(_0x1dc61f){if(_0x1dc61f){_0x29872c=_0x1dc61f[_0xc111('0x67')];}})[_0xc111('0x16')](function(){return db[_0xc111('0x31')][_0xc111('0x49')](_0x3ebd52);})['then'](handleEntityNotFound(_0x995a15,null))[_0xc111('0x16')](function(_0x4db436){if(_0x4db436){if(!_[_0xc111('0x68')](_0x4db436[_0xc111('0x64')])){if(fs['existsSync'](path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0x6a'),_0x4db436[_0xc111('0x64')]))&&_0x29872c){_0x18f68b=path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0x6a'),_0x4db436['sitepic']);}}return _0x995a15[_0xc111('0x6b')](_0x18f68b);}})['catch'](handleError(_0x995a15,null));};exports[_0xc111('0x6c')]=function(_0x1dc0ba,_0x2a1de7){var _0x3b903b=path['join'](config[_0xc111('0x62')],'server/files/images/avatars/default_avatar.png');var _0x35e3d8={'where':{'id':_0x1dc0ba['params']['id']},'attributes':['id',_0xc111('0x5d')],'raw':!![]};return db[_0xc111('0x31')][_0xc111('0x49')](_0x35e3d8)['then'](handleEntityNotFound(_0x2a1de7,null))[_0xc111('0x16')](function(_0x154d49){if(_0x154d49){if(!_['isNil'](_0x154d49[_0xc111('0x5d')])){if(fs[_0xc111('0x6d')](path[_0xc111('0x69')](config[_0xc111('0x62')],'server/files/images/avatars/',_0x154d49[_0xc111('0x5d')]))){_0x3b903b=path['join'](config[_0xc111('0x62')],_0xc111('0x6e'),_0x154d49['agentAvatar']);}}return _0x2a1de7['download'](_0x3b903b);}})[_0xc111('0x1f')](handleError(_0x2a1de7,null));};exports[_0xc111('0x6f')]=function(_0x59b450,_0x1957bd){var _0x468cad=path[_0xc111('0x69')](config[_0xc111('0x62')],'server/files/images/avatars/customer_avatar.png');var _0x51a980={'where':{'id':_0x59b450[_0xc111('0x4f')]['id']},'attributes':['id',_0xc111('0x5f'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc111('0x49')](_0x51a980)[_0xc111('0x16')](handleEntityNotFound(_0x1957bd,null))[_0xc111('0x16')](function(_0xc25a86){if(_0xc25a86){if(!_[_0xc111('0x68')](_0xc25a86[_0xc111('0x5f')])){if(fs[_0xc111('0x6d')](path[_0xc111('0x69')](config['root'],'server/files/images/avatars/',_0xc25a86[_0xc111('0x5f')]))&&_0xc25a86[_0xc111('0x70')]){_0x468cad=path[_0xc111('0x69')](config[_0xc111('0x62')],'server/files/images/avatars/',_0xc25a86[_0xc111('0x5f')]);}}return _0x1957bd[_0xc111('0x6b')](_0x468cad);}})[_0xc111('0x1f')](handleError(_0x1957bd,null));};exports['getSystemAvatar']=function(_0x526fcc,_0x28fd01){var _0x34d0b6=path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0x71'));var _0x2efc30={'where':{'id':_0x526fcc['params']['id']},'attributes':['id',_0xc111('0x61')],'raw':!![]};return db[_0xc111('0x31')][_0xc111('0x49')](_0x2efc30)[_0xc111('0x16')](handleEntityNotFound(_0x28fd01,null))['then'](function(_0x5f8091){if(_0x5f8091){if(!_['isNil'](_0x5f8091[_0xc111('0x61')])){if(fs[_0xc111('0x6d')](path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0x6e'),_0x5f8091[_0xc111('0x61')]))){_0x34d0b6=path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0x6e'),_0x5f8091[_0xc111('0x61')]);}}return _0x28fd01['download'](_0x34d0b6);}})[_0xc111('0x1f')](handleError(_0x28fd01,null));};exports[_0xc111('0x72')]=function(_0x149299,_0x19a573){var _0x351157=require(_0xc111('0x73'));var _0x4df410=new _0x351157();var _0x3378b7=_0x4df410[_0xc111('0x74')](_0x149299[_0xc111('0x75')][_0xc111('0x76')])[_0xc111('0x77')]();var _0x377a88={'body':_0x149299[_0xc111('0x4b')],'channel':_0xc111('0x78')};var _0x4f4ea7=[];var _0x3ab21a=[];var _0x1d17f5={};var _0x18589f=![];return db['CmContact'][_0xc111('0x50')]()[_0xc111('0x16')](function(_0x506d23){if(!_0x506d23){throw new db['Sequelize'][(_0xc111('0x79'))](_0xc111('0x7a'));}_0x4f4ea7=_[_0xc111('0x7b')](_[_0xc111('0x36')](_0x506d23),[_0xc111('0x7c'),_0xc111('0x7d')]);_0x3ab21a=_[_0xc111('0x7b')](_[_0xc111('0x36')](_0x506d23),[_0xc111('0x7c'),'updatedAt',_0xc111('0x7e'),_0xc111('0x7f')]);if(_0x149299[_0xc111('0x4b')]['id']){delete _0x149299[_0xc111('0x4b')]['id'];}if(_[_0xc111('0x68')](_0x149299['body'][_0xc111('0x80')])){throw new db['Sequelize'][(_0xc111('0x79'))](_0xc111('0x81'));}if(_[_0xc111('0x68')](_0x149299[_0xc111('0x4b')][_0xc111('0x4b')])||_0x149299[_0xc111('0x4b')][_0xc111('0x4b')]===''){throw new db[(_0xc111('0x82'))][(_0xc111('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc111('0x68')](_0x149299[_0xc111('0x4b')]['mapKey'])){throw new db[(_0xc111('0x82'))][(_0xc111('0x79'))](_0xc111('0x83')+_0x3ab21a);}if(!_[_0xc111('0x84')](_0x3ab21a,_0x149299['body'][_0xc111('0x85')])){throw new db['Sequelize'][(_0xc111('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ab21a);}_0x1d17f5[_0x149299[_0xc111('0x4b')]['mapKey']]=_0x149299[_0xc111('0x4b')][_0xc111('0x80')];})[_0xc111('0x16')](function(){return db['ChatWebsite'][_0xc111('0x49')]({'where':{'id':_0x149299[_0xc111('0x4f')]['id']},'include':[{'model':db[_0xc111('0x86')],'as':_0xc111('0x87'),'include':[{'model':db[_0xc111('0x88')],'as':'Contacts','where':_0x1d17f5,'limit':0x1,'order':[[_0xc111('0x7d'),_0xc111('0x89')]]}]},{'model':db[_0xc111('0x8a')],'as':_0xc111('0x8b')}]});})[_0xc111('0x16')](handleEntityNotFound(_0x19a573,null))[_0xc111('0x16')](function(_0x310daa){if(_0x310daa&&_0x310daa[_0xc111('0x87')]){_0x377a88[_0xc111('0x8c')]=_0x310daa;_0x377a88[_0xc111('0x8d')]=_0x310daa[_0xc111('0x8b')];_0x377a88['list']=_0x310daa[_0xc111('0x87')];_0x377a88[_0xc111('0x8d')]=_[_0xc111('0x8e')](_0x377a88[_0xc111('0x8d')],[_0xc111('0x8f')],[_0xc111('0x90')]);if(_0x377a88[_0xc111('0x8c')][_0xc111('0x8b')]){delete _0x377a88[_0xc111('0x8c')][_0xc111('0x8b')];}if(_0x377a88[_0xc111('0x8c')][_0xc111('0x87')]&&_0x377a88[_0xc111('0x8c')]['List'][_0xc111('0x91')]['length']){return _0x377a88[_0xc111('0x8c')]['List'][_0xc111('0x91')][0x0];}var _0x5e1416=_[_0xc111('0xc')](_0x149299[_0xc111('0x4b')],{'firstName':_0x149299[_0xc111('0x4b')]['from'],'ListId':_0x310daa[_0xc111('0x7f')]});_0x5e1416[_0x149299['body'][_0xc111('0x85')]]=_0x149299[_0xc111('0x4b')][_0xc111('0x80')];return db[_0xc111('0x88')]['create'](_0x5e1416,{'fields':_0x4f4ea7,'raw':!![]});}})['then'](handleEntityNotFound(_0x19a573,null))[_0xc111('0x16')](function(_0xb6afb3){_0x377a88[_0xc111('0x92')]=_0xb6afb3;var _0x503f74=_0x149299['body']['customerIp'];if(_0x149299['headers'][_0xc111('0x93')]){_0x503f74=_0x149299['headers'][_0xc111('0x93')];}else if(_0x149299[_0xc111('0x75')][_0xc111('0x94')]){_0x503f74=_['first'](_0x149299['headers'][_0xc111('0x94')]['split'](','));}if(_0xb6afb3){var _0x442a3f={'ContactId':_0xb6afb3['id'],'ChatWebsiteId':_0x149299[_0xc111('0x4f')]['id'],'from':(_0xb6afb3[_0xc111('0x95')]||'')+'\x20'+(_0xb6afb3[_0xc111('0x96')]||''),'customerIp':_0x503f74,'customerPort':_0x149299['headers']['x-real-port']?_0x149299[_0xc111('0x75')][_0xc111('0x97')]:null,'referer':_0x149299[_0xc111('0x4b')][_0xc111('0x98')],'browserName':_0x3378b7[_0xc111('0x99')][_0xc111('0x2d')]&&_0x3378b7[_0xc111('0x99')]['version']?util[_0xc111('0x9a')]('%s\x20%s',_0x3378b7[_0xc111('0x99')]['name'],_0x3378b7[_0xc111('0x99')][_0xc111('0x9b')]):_0xc111('0x9c'),'browserVersion':_0x3378b7['browser'][_0xc111('0x9b')]||_0xc111('0x9c'),'osName':util[_0xc111('0x9a')]('%s\x20%s',_0x3378b7['os'][_0xc111('0x2d')],_0x3378b7['os'][_0xc111('0x9b')]),'osVersion':_0x3378b7['os'][_0xc111('0x9b')],'deviceModel':_0x3378b7[_0xc111('0x9d')]['model']&&_0x3378b7['device']['vendor']?util[_0xc111('0x9a')](_0xc111('0x9e'),_0x3378b7[_0xc111('0x9d')][_0xc111('0x34')],_0x3378b7[_0xc111('0x9d')][_0xc111('0x9f')],_0x3378b7['device'][_0xc111('0xa0')]):null,'deviceVendor':_0x3378b7[_0xc111('0x9d')][_0xc111('0x9f')],'deviceType':_0x3378b7[_0xc111('0x9d')][_0xc111('0xa0')],'formData':JSON[_0xc111('0xa1')](_0x149299[_0xc111('0x4b')])};var _0x2cbca0={'ChatWebsiteId':_0x149299[_0xc111('0x4f')]['id'],'closed':![]};if(_0x149299[_0xc111('0x4b')][_0xc111('0xa2')]){_0x2cbca0[_0xc111('0xa2')]=_0x149299[_0xc111('0x4b')][_0xc111('0xa2')];return db[_0xc111('0xa3')]['find']({'where':_0x2cbca0})[_0xc111('0x16')](function(_0xbd317d){if(_0xbd317d){return[_0xbd317d,![]];}_0x442a3f[_0xc111('0xa2')]=_0x149299[_0xc111('0x4b')][_0xc111('0xa2')];_0x442a3f[_0xc111('0xa4')]=_0x149299['body'][_0xc111('0xa4')];return db['ChatInteraction'][_0xc111('0x4a')](_0x442a3f)[_0xc111('0x16')](function(_0x27178a){return[_0x27178a,!![]];});});}_0x2cbca0[_0xc111('0xa5')]=_0xb6afb3['id'];if(_0x149299[_0xc111('0x4b')][_0xc111('0xa6')]&&_0x149299['body']['interaction']['id']){_0x2cbca0['id']=_0x149299[_0xc111('0x4b')][_0xc111('0xa6')]['id'];return db[_0xc111('0xa3')][_0xc111('0x49')]({'where':_0x2cbca0})[_0xc111('0x16')](function(_0x326b45){if(_0x326b45){return[_0x326b45,![]];}return db['ChatInteraction'][_0xc111('0x4a')](_0x442a3f)[_0xc111('0x16')](function(_0xd45761){return[_0xd45761,!![]];});});}return db[_0xc111('0xa3')][_0xc111('0x4a')](_0x442a3f)['then'](function(_0x273c46){return[_0x273c46,!![]];});}})[_0xc111('0xa7')](function(_0x1e85e9,_0x56f92a){if(_0x1e85e9){_0x18589f=_0x56f92a;if(!_0x56f92a){var _0x2c9736={'from':(_0x377a88[_0xc111('0x92')][_0xc111('0x95')]||'')+'\x20'+(_0x377a88[_0xc111('0x92')]['lastName']||'')};if(_0x149299['body']['threadId']&&_0x149299[_0xc111('0x4b')]['messageId']&&_0x149299[_0xc111('0x4b')][_0xc111('0xa2')]!=_0x149299[_0xc111('0x4b')]['messageId']){_0x2c9736[_0xc111('0xa2')]=_0x149299[_0xc111('0x4b')][_0xc111('0xa8')];}return _0x1e85e9[_0xc111('0x28')](_0x2c9736);}else{return _0x1e85e9;}}})[_0xc111('0x16')](function(_0x11e7f2){_0x377a88['interaction']=_0x11e7f2['get']({'plain':!![]});_0x377a88[_0xc111('0xa6')][_0xc111('0xa9')]=_0x18589f;if(_0x377a88[_0xc111('0xa6')][_0xc111('0xa9')]){if(_0x377a88[_0xc111('0x8c')][_0xc111('0xaa')]){_0x377a88['applications'][_0xc111('0xab')]({'id':0x0,'priority':_0x377a88[_0xc111('0x8d')][_0xc111('0x3b')]+0x1,'app':_0xc111('0xac'),'appdata':'unmanaged','interval':_0xc111('0xad')});}}return db[_0xc111('0xae')]['create']({'body':_0x149299[_0xc111('0x4b')][_0xc111('0x4b')],'ChatWebsiteId':_0x149299['params']['id'],'ChatInteractionId':_0x11e7f2['id'],'direction':'in','ContactId':_0x377a88[_0xc111('0x92')]['id'],'AttachmentId':_0x149299['body']['AttachmentId']});})['then'](function(_0x2fdfc7){_0x377a88[_0xc111('0x1d')]=_0x2fdfc7;if(_0x377a88[_0xc111('0xa6')]['UserId']){return db[_0xc111('0xaf')][_0xc111('0x49')]({'attributes':['id',_0xc111('0x2d')],'where':{'id':_0x377a88[_0xc111('0xa6')][_0xc111('0xb0')]}})[_0xc111('0x16')](function(_0x5b6e4d){if(_0x5b6e4d){_0x377a88['applications'][_0xc111('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5b6e4d[_0xc111('0x2d')]+','+(_0x377a88['account'][_0xc111('0xb2')]||0xa),'interval':'*,*,*,*'});_0x377a88[_0xc111('0xb3')]=!![];}return respondWithRpcPromise(_0xc111('0xb4'),'startRouting',_0x377a88);});}return respondWithRpcPromise(_0xc111('0xb4'),_0xc111('0xb5'),_0x377a88);})['then'](function(_0x3b21fc){respondWithRpcPromise('EventManager',_0xc111('0xb6'),{'event':'notify','message':_0x3b21fc},client9002);return _0x3b21fc;})['then'](respondWithResult(_0x19a573,null))[_0xc111('0x1f')](handleError(_0x19a573,null));};exports[_0xc111('0xb7')]=function(_0x3ef85d,_0x4b4798){var _0x48e8fb,_0x413798,_0x3b0b13;var _0x41cf65=[];var _0x17a2d3={};var _0x41bab8=_0x3ef85d[_0xc111('0xb8')]||[];var _0x52405f=[];var _0x5cd28f;return db[_0xc111('0x88')][_0xc111('0x50')]()['then'](function(_0x2586f8){if(!_0x2586f8){throw new db[(_0xc111('0x82'))][(_0xc111('0x79'))](_0xc111('0x7a'));}_0x41cf65=_[_0xc111('0x7b')](_['keys'](_0x2586f8),[_0xc111('0x7c'),_0xc111('0x7d'),_0xc111('0x7e'),_0xc111('0x7f')]);if(_0x3ef85d[_0xc111('0x4b')]['id']){delete _0x3ef85d['body']['id'];}if(_['isNil'](_0x3ef85d[_0xc111('0x4b')][_0xc111('0x80')])){throw _0x4b4798[_0xc111('0x21')](0x1f4)[_0xc111('0x2e')](new db[(_0xc111('0x82'))][(_0xc111('0x79'))](_0xc111('0x81')));}if(_[_0xc111('0x68')](_0x3ef85d[_0xc111('0x4b')][_0xc111('0x4b')])||_0x3ef85d['body'][_0xc111('0x4b')]===''){throw _0x4b4798['status'](0x1f4)[_0xc111('0x2e')](new db[(_0xc111('0x82'))][(_0xc111('0x79'))](_0xc111('0xb9')));}if(_['isNil'](_0x3ef85d[_0xc111('0x4b')][_0xc111('0xba')])){throw _0x4b4798[_0xc111('0x21')](0x1f4)[_0xc111('0x2e')](new db['Sequelize'][(_0xc111('0x79'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41cf65));}if(!_['includes'](_0x41cf65,_0x3ef85d[_0xc111('0x4b')][_0xc111('0xba')])){throw _0x4b4798[_0xc111('0x21')](0x1f4)[_0xc111('0x2e')](new db[(_0xc111('0x82'))][(_0xc111('0x79'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41cf65));}_0x17a2d3[_0x3ef85d[_0xc111('0x4b')][_0xc111('0xba')]]=_0x3ef85d[_0xc111('0x4b')]['from'];})[_0xc111('0x16')](function(){return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0x3ef85d[_0xc111('0x4f')]['id']},'include':[{'model':db['CmList'],'as':_0xc111('0x87')},{'model':db[_0xc111('0xbb')],'as':'MailAccount'}]});})[_0xc111('0x16')](handleEntityNotFound(_0x4b4798,null))[_0xc111('0x16')](function(_0xe11f49){if(_0xe11f49&&_0xe11f49['List']){_0x413798=_0xe11f49;var _0x10be3c=_['defaults'](_0x3ef85d[_0xc111('0x4b')],{'firstName':_0x3ef85d[_0xc111('0x4b')][_0xc111('0x80')],'phone':_0x3ef85d[_0xc111('0x4b')][_0xc111('0x80')],'ListId':_0xe11f49[_0xc111('0x7f')]});_0x10be3c[_0x3ef85d[_0xc111('0x4b')]['mapKeyOffline']]=_0x3ef85d[_0xc111('0x4b')][_0xc111('0x80')];return db['CmContact'][_0xc111('0xbc')]({'where':_0x17a2d3,'defaults':_0x10be3c});}})[_0xc111('0xa7')](function(_0x1ea352){if(_0x1ea352){_0x3b0b13=_0x1ea352;var _0x45d1ac=fs['readFileSync'](path[_0xc111('0x69')](config['root'],_0xc111('0xbd')),_0xc111('0xbe'));var _0xc6bc96=ejs[_0xc111('0xbf')](_0x45d1ac,{'body':_[_0xc111('0xc0')](_0x3ef85d[_0xc111('0x4b')][_0xc111('0x4b')]),'bodyTitle':_0x413798['offlineMessageBody']});return db[_0xc111('0xc1')][_0xc111('0x4a')]({'body':_0xc6bc96,'plainBody':htmlToText[_0xc111('0xc2')](_0xc6bc96),'ContactId':_0x1ea352['id'],'ChatWebsiteId':_0x413798['id']});}})[_0xc111('0x16')](function(_0x10cf55){_0x5cd28f=_0x10cf55;if(_0x41bab8['length']){var _0x13bc6a=_0x41bab8['map'](function(_0x307941){return{'name':_0x307941[_0xc111('0xc3')],'basename':_0x307941[_0xc111('0xc4')],'type':_0x307941[_0xc111('0xc5')],'ChatOfflineMessageId':_0x10cf55['id']};});_0x52405f=_0x13bc6a[_0xc111('0x30')](_0x4b17a2=>{var _0x193a43={'filename':_0x4b17a2[_0xc111('0x2d')],'path':path['join'](config[_0xc111('0x62')],'server','files',_0xc111('0xc6'),_0xc111('0xc7'),_0x4b17a2[_0xc111('0xc8')])};return _0x193a43;});if(!_0x413798['openNewInteraction']){return db['sequelize'][_0xc111('0xc9')](function(_0x5f3193){return db[_0xc111('0xca')][_0xc111('0xcb')](_0x13bc6a,{'transaction':_0x5f3193});});}}})[_0xc111('0x16')](function(){if(_0x5cd28f){_0x48e8fb=_0x5cd28f;return db['MailAccount'][_0xc111('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc111('0xcc')],'as':_0xc111('0xcc'),'raw':!![]}]}]});}})[_0xc111('0x16')](function(_0x45df3a){if(_0x45df3a&&_0x45df3a['Smtp']&&_0x413798[_0xc111('0xcd')]&&_0x413798[_0xc111('0xce')]){var _0x29a32b=_0x45df3a[_0xc111('0xcf')]();return respondWithRpcPromise(_0xc111('0xd0'),'sendMail',{'account':_0x29a32b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x45df3a[_0xc111('0x2d')],_0x45df3a[_0xc111('0xd1')]||_0x45df3a[_0xc111('0xd2')][_0xc111('0xd3')]),'to':_0x413798[_0xc111('0xce')],'subject':_0x413798[_0xc111('0xd4')],'html':_0x48e8fb[_0xc111('0x4b')],'attachments':_0x52405f}},client9003)[_0xc111('0x16')](function(){return _0x48e8fb;})['catch'](function(_0x31dbcf){logger[_0xc111('0x1c')](_0x31dbcf);});}})[_0xc111('0x16')](function(){if(_0x413798&&_0x413798[_0xc111('0xd5')]&&_0x413798[_0xc111('0xd6')]){var _0x287896=[];if(_0x41bab8['length']){_0x287896=_0x41bab8['map'](function(_0x4e51e5){return{'name':_0x4e51e5[_0xc111('0xc3')],'basename':_0x4e51e5[_0xc111('0xc4')],'type':_0x4e51e5[_0xc111('0xc5')],'ChatOfflineMessageId':_0x5cd28f['id']};});}var _0x1cb410;if(!_[_0xc111('0x68')](_0x413798[_0xc111('0xd7')])){var _0x4e6e83=_['map'](_0x3ef85d[_0xc111('0x4b')],function(_0x121dbb){return _0x121dbb;});var _0x22d022=_[_0xc111('0xd8')](_0x4e6e83)[0x0];var _0x1f4fa8=_['mapValues'](_0x22d022,function(_0x401428){return _0x401428;});_0x1cb410=_0x1f4fa8[0x1][_0x413798[_0xc111('0xd7')]];}var _0x5b8c37={'from':_0x3b0b13['email'],'firstName':_0x3b0b13['firstName'],'lastName':_0x3b0b13[_0xc111('0x96')],'mapKey':_0xc111('0xd1'),'message':{'from':_0x3b0b13[_0xc111('0xd1')],'to':_0x413798[_0xc111('0xbb')][_0xc111('0xd1')],'cc':'','subject':_[_0xc111('0x68')](_0x1cb410)?_0x413798[_0xc111('0xd4')]:_0x1cb410,'messageId':'','sentAt':new Date(),'attach':_0x287896[_0xc111('0x3b')],'attachments':_0x287896,'originChannel':_0xc111('0xd9'),'ChatWebsiteId':_0x413798['id'],'ChatOfflineMessageId':_0x48e8fb['id'],'originTo':_0x413798[_0xc111('0xbb')][_0xc111('0xd1')]},'body':_0x48e8fb['body']};var _0x4ae422={'account':{'id':_0x413798['MailAccountId']},'body':_0x5b8c37,'log':_0xc111('0xda')};return respondWithRpcPromise('NotifyMailAccount',_0xc111('0xdb'),_0x4ae422,client9001)[_0xc111('0x16')](function(){return _0x48e8fb;})[_0xc111('0x1f')](function(_0x2c2cf2){logger[_0xc111('0x1c')](_0x2c2cf2);});}return;})[_0xc111('0x16')](function(){if(_0x48e8fb){return _0x48e8fb;}})[_0xc111('0x16')](respondWithResult(_0x4b4798,null))[_0xc111('0x1f')](function(_0x309a9c){logger[_0xc111('0x1c')](_0xc111('0x1f'),_0x309a9c);for(var _0x2182d0 of _0x41bab8){var _0x27bf6d=path[_0xc111('0x69')](config[_0xc111('0x62')],_0xc111('0xdc'),_0xc111('0xb8'),_0xc111('0xc6'),'offline-chat',_0x2182d0[_0xc111('0xc4')]);fs_extra[_0xc111('0xdd')](_0x27bf6d)[_0xc111('0x1f')](function(_0x332355){logger[_0xc111('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x27bf6d,_0x332355);});}});};exports[_0xc111('0xde')]=function(_0x4dab1e,_0x1a8d20){return db['ChatInteraction'][_0xc111('0x49')]({'where':{'id':_0x4dab1e[_0xc111('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a8d20,null))[_0xc111('0x16')](function(_0xde0d18){if(_0xde0d18){return _0xde0d18[_0xc111('0xde')](_0x4dab1e['body']['ids'],_[_0xc111('0xdf')](_0x4dab1e[_0xc111('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x1a8d20,null))['catch'](handleError(_0x1a8d20,null));};exports[_0xc111('0xe0')]=function(_0x40e23f,_0x3441e2){var _0x36b957={'raw':![],'where':{}};var _0x1d7e5e={};var _0x2ec692={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc111('0x58')]({'where':{'id':_0x40e23f[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x3441e2,null))[_0xc111('0x16')](function(_0xe9aa76){if(_0xe9aa76){_0x1d7e5e[_0xc111('0x34')]=_[_0xc111('0x36')](db[_0xc111('0xa3')][_0xc111('0x32')]);_0x1d7e5e[_0xc111('0x35')]=_['keys'](_0x40e23f[_0xc111('0x35')]);_0x1d7e5e[_0xc111('0x37')]=_['intersection'](_0x1d7e5e['model'],_0x1d7e5e[_0xc111('0x35')]);_0x36b957[_0xc111('0x39')]=_[_0xc111('0x38')](_0x1d7e5e['model'],qs[_0xc111('0x3a')](_0x40e23f[_0xc111('0x35')]['fields']));_0x36b957[_0xc111('0x39')]=_0x36b957['attributes'][_0xc111('0x3b')]?_0x36b957['attributes']:_0x1d7e5e[_0xc111('0x34')];if(!_0x40e23f[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x36b957['limit']=qs[_0xc111('0x26')](_0x40e23f[_0xc111('0x35')][_0xc111('0x26')]);_0x36b957[_0xc111('0x24')]=qs[_0xc111('0x24')](_0x40e23f[_0xc111('0x35')]['offset']);}_0x36b957[_0xc111('0x3e')]=qs[_0xc111('0x3f')](_0x40e23f[_0xc111('0x35')][_0xc111('0x3f')]);_0x36b957['where']=qs[_0xc111('0x37')](_[_0xc111('0x40')](_0x40e23f[_0xc111('0x35')],_0x1d7e5e['filters']));_0x36b957[_0xc111('0x42')]['ChatWebsiteId']=_0xe9aa76['id'];if(_0x40e23f['query'][_0xc111('0x41')]){_0x36b957[_0xc111('0x42')]=_[_0xc111('0x44')](_0x36b957['where'],{'$or':_[_0xc111('0x30')](_0x36b957['attributes'],function(_0x341fee){var _0x3fb9e7={};_0x3fb9e7[_0x341fee]={'$like':'%'+_0x40e23f[_0xc111('0x35')][_0xc111('0x41')]+'%'};return _0x3fb9e7;})});}_0x36b957=_[_0xc111('0x44')]({},_0x36b957,_0x40e23f[_0xc111('0x45')]);return db['ChatInteraction']['count']({'where':_0x36b957[_0xc111('0x42')]})[_0xc111('0x16')](function(_0x1ead05){_0x2ec692[_0xc111('0x27')]=_0x1ead05;if(_0x40e23f[_0xc111('0x35')][_0xc111('0x46')]){_0x36b957[_0xc111('0x47')]=[{'model':db[_0xc111('0x88')],'as':_0xc111('0xe1'),'required':![]},{'model':db['User'],'as':_0xc111('0xe2'),'attributes':['name',_0xc111('0xe3'),_0xc111('0xe4')],'required':![]},{'model':db[_0xc111('0xe5')],'as':_0xc111('0xe6'),'attributes':['id',_0xc111('0x2d'),_0xc111('0xe7')],'where':_0x40e23f[_0xc111('0x35')][_0xc111('0xe8')]?{'id':_0x40e23f[_0xc111('0x35')]['tag']}:undefined,'required':_0x40e23f['query']['tag']?!![]:![]}];}return db[_0xc111('0xa3')][_0xc111('0x59')](_0x36b957);})[_0xc111('0x16')](function(_0x20c872){_0x2ec692['rows']=_0x20c872;return _0x2ec692;});}})[_0xc111('0x16')](respondWithFilteredResult(_0x3441e2,_0x36b957))[_0xc111('0x1f')](handleError(_0x3441e2,null));};function iftimePromise(_0x5b7a64,_0x2df09a){return respondWithRpcPromise('Command',_0xc111('0xe9'),{'command':_0x2df09a['timezone']?util[_0xc111('0x9a')](_0xc111('0xea'),_0x5b7a64[_0xc111('0xeb')],_0x2df09a['timezone']):util[_0xc111('0x9a')](_0xc111('0xec'),_0x5b7a64['interval'])},client9002)[_0xc111('0x16')](function(_0x455c46){var _0x5b82be=_0x455c46&&_0x455c46[_0xc111('0xed')]('true')>=0x0?!![]:![];logger[_0xc111('0x17')](_0xc111('0xee'),_0x2df09a['id'],_0x5b7a64['id'],_0x5b7a64[_0xc111('0xeb')],_0x5b82be?_0xc111('0xef'):'OFFLINE',_0x2df09a[_0xc111('0xf0')]?_0x2df09a['timezone']:_0xc111('0xf1'));return _0x5b82be;})[_0xc111('0x1f')](function(_0x979a8b){logger[_0xc111('0x1c')](_0xc111('0xee'),_0x2df09a['id'],_0x5b7a64['id'],_0x5b7a64[_0xc111('0xeb')],util[_0xc111('0xf2')](_0x979a8b,{'showHidden':![],'depth':null}),_0x2df09a[_0xc111('0xf0')]?_0x2df09a[_0xc111('0xf0')]:_0xc111('0xf1'));return![];});}exports[_0xc111('0xe9')]=function(_0x37b9fd,_0x867a16){var _0x22f61c=0x0;var _0x31708d=0x0;var _0x365479=![];var _0x3aa662;var _0x1e1af3;return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0x37b9fd[_0xc111('0x4f')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xc111('0xeb')],'raw':!![]}]}]})[_0xc111('0x16')](handleEntityNotFound(_0x867a16,null))['then'](function(_0x3fe7e4){if(_0x3fe7e4){_0x3aa662=_0x3fe7e4;return _0x3fe7e4[_0xc111('0xf3')]({'raw':!![]});}})[_0xc111('0x16')](function(_0x137d28){if(_0x3aa662){if(_0x137d28){_0x1e1af3=_0x137d28;}}return require(_0xc111('0x65'))[_0xc111('0x66')]();})[_0xc111('0x16')](function(_0x44e5b9){if(_0x44e5b9){_0x31708d=_0x44e5b9[_0xc111('0xf4')];_0x365479=_0x44e5b9['custom'];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xc111('0x16')](function(_0x2d648a){_0x22f61c=_0x2d648a;if(_0x31708d&&_0x2d648a>_0x31708d){return db[_0xc111('0xf5')]['findOne']({'where':{'id':0x1}})[_0xc111('0x16')](function(_0x554532){if(_0x554532){_0x554532['increment'](_0xc111('0xf6'));}});}})[_0xc111('0x16')](function(){if(_0x3aa662[_0xc111('0xf7')]&&_0x3aa662[_0xc111('0xf7')]['Intervals']){var _0xfd1329=[];for(var _0xd42fd5=0x0;_0xd42fd5<_0x3aa662[_0xc111('0xf7')]['Intervals'][_0xc111('0x3b')];_0xd42fd5++){var _0x4c0ccc=_0x3aa662[_0xc111('0xf7')][_0xc111('0xf8')][_0xd42fd5]['get']({'plain':!![]});_0xfd1329[_0xc111('0xab')](iftimePromise(_0x4c0ccc,_0x3aa662));}return BPromise[_0xc111('0xf9')](_0xfd1329)[_0xc111('0x16')](function(_0x38299c){return _[_0xc111('0xfa')](_0x38299c);});}else{return!![];}})[_0xc111('0x16')](function(_0x4f8ae4){var _0x16ae8e=fs[_0xc111('0xfb')](path[_0xc111('0x69')](config[_0xc111('0x62')],'server/files/chat/iframe.ejs'),'utf8');var _0xa10f9b=new url[(_0xc111('0xfc'))](_0x3aa662[_0xc111('0xfd')])[_0xc111('0xfe')];var _0x16576d=_0xc111('0xff');var _0x101096=![];var _0xdc5e97={'chatVersion':_0x16576d,'chatWebsiteAddressOrigin':_0xa10f9b,'remote':_0x3aa662['remote'],'query':querystring[_0xc111('0xa1')](_['merge'](_0x3aa662[_0xc111('0x2a')]({'plain':!![]}),{'customerIp':_0x37b9fd[_0xc111('0x75')][_0xc111('0x94')]||_0x37b9fd['headers'][_0xc111('0x100')]||_0x37b9fd[_0xc111('0x101')][_0xc111('0x102')]||_0x37b9fd['ip'],'referer':_0x37b9fd['headers'][_0xc111('0x98')],'openedInteractions':_0x22f61c,'maxInteractions':_0x31708d,'virtual':_0x365479[_0xc111('0xf4')],'online':_0x4f8ae4,'custom':_0x365479}))[_0xc111('0x103')](/'/g,'\x5c\x27')};_0x867a16[_0xc111('0x2e')](ejs[_0xc111('0xbf')](Mustache['render'](_0x16ae8e,_0xdc5e97),{'proactiveActions':_0x1e1af3,'alignment':_0x3aa662['alignment'],'verticalAlignment':_0x3aa662[_0xc111('0x104')],'div_color':_0x3aa662[_0xc111('0xe7')],'labelText':_0x3aa662['labelText'],'text_color':_0x3aa662[_0xc111('0x105')],'text_button_color':_0x3aa662[_0xc111('0x106')],'button_color':_0x3aa662[_0xc111('0x107')],'background_color':_0x3aa662['backgroundColor'],'hideWhenOffline':_0x3aa662[_0xc111('0x108')],'intervalId':_0x3aa662[_0xc111('0x109')],'isDevelopment':_0x101096,'chatVersion':_0x16576d}));})[_0xc111('0x1f')](handleError(_0x867a16,null));};exports[_0xc111('0x10a')]=function(_0x4e1f32,_0x33093e){var _0x25bcc2=_0x4e1f32[_0xc111('0x4f')]['id'];var _0x4c9f6c=_0x4e1f32[_0xc111('0x4b')];var _0x5ecc2e=0xc8;var _0x5a0fb6=null;return db[_0xc111('0x10b')][_0xc111('0xc9')]({'isolationLevel':db[_0xc111('0x10b')][_0xc111('0x10c')][_0xc111('0x10d')][_0xc111('0x10e')]},function(_0x3dd7cc){return db[_0xc111('0x31')][_0xc111('0x58')]({'where':{'id':_0x25bcc2},'transaction':_0x3dd7cc})[_0xc111('0x16')](function(_0x306584){if(_0x306584){return db['ChatApplication'][_0xc111('0x29')]({'where':{'ChatWebsiteId':_0x25bcc2},'transaction':_0x3dd7cc})[_0xc111('0x16')](function(){var _0x12d29e=_[_0xc111('0x30')](_0x4c9f6c,function(_0xc942bc){_0xc942bc[_0xc111('0x52')]=_0x25bcc2;return _0xc942bc;});return db[_0xc111('0x8a')][_0xc111('0xcb')](_0x12d29e,{'transaction':_0x3dd7cc});});}else{_0x5ecc2e=0x194;_0x5a0fb6=[];}});})[_0xc111('0x16')](function(){if(_0x5ecc2e!==0x194){return db[_0xc111('0x8a')][_0xc111('0x10f')]({'where':{'ChatWebsiteId':_0x25bcc2},'order':_0xc111('0x8f')})[_0xc111('0x16')](function(_0x24ff1f){_0x5a0fb6=_0x24ff1f;});}})[_0xc111('0x1f')](function(_0x332ee4){_0x5ecc2e=0x1f4;logger[_0xc111('0x1c')](_0x332ee4[_0xc111('0x2c')]);if(_0x332ee4['name']){delete _0x332ee4[_0xc111('0x2d')];}_0x5a0fb6=_0x332ee4;})[_0xc111('0x110')](function(){if(_0x5a0fb6===null){_0x33093e['sendStatus'](_0x5ecc2e);}else{if(_0x5ecc2e===0x1f4){_0x33093e[_0xc111('0x21')](_0x5ecc2e)[_0xc111('0x2e')](_0x5a0fb6);}else{_0x33093e[_0xc111('0x21')](_0x5ecc2e)[_0xc111('0x23')](_0x5a0fb6);}}});};exports[_0xc111('0x111')]=function(_0x577756,_0x3362f){var _0x1800fa={};var _0x1e5a70={};var _0x22068d;var _0x463bf4;return db['ChatWebsite'][_0xc111('0x58')]({'where':{'id':_0x577756['params']['id']}})['then'](handleEntityNotFound(_0x3362f,null))[_0xc111('0x16')](function(_0x531f6c){if(_0x531f6c){_0x22068d=_0x531f6c;_0x1e5a70[_0xc111('0x34')]=_[_0xc111('0x36')](db[_0xc111('0x8a')][_0xc111('0x32')]);_0x1e5a70[_0xc111('0x35')]=_[_0xc111('0x36')](_0x577756[_0xc111('0x35')]);_0x1e5a70[_0xc111('0x37')]=_['intersection'](_0x1e5a70[_0xc111('0x34')],_0x1e5a70[_0xc111('0x35')]);_0x1800fa[_0xc111('0x39')]=_[_0xc111('0x38')](_0x1e5a70[_0xc111('0x34')],qs[_0xc111('0x3a')](_0x577756[_0xc111('0x35')][_0xc111('0x3a')]));_0x1800fa[_0xc111('0x39')]=_0x1800fa['attributes'][_0xc111('0x3b')]?_0x1800fa[_0xc111('0x39')]:_0x1e5a70[_0xc111('0x34')];_0x1800fa[_0xc111('0x3e')]=qs['sort'](_0x577756[_0xc111('0x35')][_0xc111('0x3f')]);_0x1800fa[_0xc111('0x42')]=qs[_0xc111('0x37')](_[_0xc111('0x40')](_0x577756[_0xc111('0x35')],_0x1e5a70['filters']));if(_0x577756['query'][_0xc111('0x41')]){_0x1800fa[_0xc111('0x42')]=_[_0xc111('0x44')](_0x1800fa[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0x1800fa['attributes'],function(_0x49ba8a){var _0x137f9c={};_0x137f9c[_0x49ba8a]={'$like':'%'+_0x577756[_0xc111('0x35')][_0xc111('0x41')]+'%'};return _0x137f9c;})});}_0x1800fa=_[_0xc111('0x44')]({},_0x1800fa,_0x577756['options']);return _0x22068d['getApplications'](_0x1800fa);}})[_0xc111('0x16')](function(_0x4a1688){if(_0x4a1688){_0x463bf4=_0x4a1688[_0xc111('0x3b')];if(!_0x577756[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x1800fa[_0xc111('0x26')]=qs[_0xc111('0x26')](_0x577756[_0xc111('0x35')]['limit']);_0x1800fa['offset']=qs['offset'](_0x577756[_0xc111('0x35')][_0xc111('0x24')]);}return _0x22068d[_0xc111('0x111')](_0x1800fa);}})[_0xc111('0x16')](function(_0x550745){if(_0x550745){return _0x550745?{'count':_0x463bf4,'rows':_0x550745}:null;}})[_0xc111('0x16')](respondWithResult(_0x3362f,null))[_0xc111('0x1f')](handleError(_0x3362f,null));};exports[_0xc111('0x112')]=function(_0x581d8f,_0x34cb82){return db[_0xc111('0x113')][_0xc111('0x49')]({'where':{'id':_0x581d8f[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x34cb82,null))[_0xc111('0x16')](function(_0xcc2acf){if(_0xcc2acf){return _0xcc2acf[_0xc111('0x112')](_0x581d8f[_0xc111('0x4b')][_0xc111('0x56')],_[_0xc111('0xdf')](_0x581d8f['body'],['ids','id'])||{});}})[_0xc111('0x16')](respondWithResult(_0x34cb82,null))[_0xc111('0x1f')](handleError(_0x34cb82,null));};exports[_0xc111('0xf3')]=function(_0xa7caf0,_0xa25616){var _0x30fc2c={};var _0x1e7417={};var _0x592858;var _0xe01e10;return db[_0xc111('0x31')][_0xc111('0x58')]({'where':{'id':_0xa7caf0[_0xc111('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa25616,null))[_0xc111('0x16')](function(_0x2ae219){if(_0x2ae219){_0x592858=_0x2ae219;_0x1e7417['model']=_[_0xc111('0x36')](db[_0xc111('0x114')][_0xc111('0x32')]);_0x1e7417[_0xc111('0x35')]=_[_0xc111('0x36')](_0xa7caf0[_0xc111('0x35')]);_0x1e7417[_0xc111('0x37')]=_[_0xc111('0x38')](_0x1e7417[_0xc111('0x34')],_0x1e7417[_0xc111('0x35')]);_0x30fc2c[_0xc111('0x39')]=_[_0xc111('0x38')](_0x1e7417['model'],qs[_0xc111('0x3a')](_0xa7caf0[_0xc111('0x35')][_0xc111('0x3a')]));_0x30fc2c[_0xc111('0x39')]=_0x30fc2c[_0xc111('0x39')][_0xc111('0x3b')]?_0x30fc2c[_0xc111('0x39')]:_0x1e7417[_0xc111('0x34')];_0x30fc2c['order']=qs['sort'](_0xa7caf0['query'][_0xc111('0x3f')]);_0x30fc2c[_0xc111('0x42')]=qs[_0xc111('0x37')](_['pick'](_0xa7caf0[_0xc111('0x35')],_0x1e7417[_0xc111('0x37')]));if(_0xa7caf0[_0xc111('0x35')][_0xc111('0x41')]){_0x30fc2c[_0xc111('0x42')]=_[_0xc111('0x44')](_0x30fc2c[_0xc111('0x42')],{'$or':_['map'](_0x30fc2c[_0xc111('0x39')],function(_0x1abe06){var _0x19becb={};_0x19becb[_0x1abe06]={'$like':'%'+_0xa7caf0['query'][_0xc111('0x41')]+'%'};return _0x19becb;})});}_0x30fc2c=_['merge']({},_0x30fc2c,_0xa7caf0['options']);return _0x592858[_0xc111('0xf3')](_0x30fc2c);}})[_0xc111('0x16')](function(_0x338d27){if(_0x338d27){_0xe01e10=_0x338d27[_0xc111('0x3b')];if(!_0xa7caf0[_0xc111('0x35')]['hasOwnProperty'](_0xc111('0x3d'))){_0x30fc2c[_0xc111('0x26')]=qs[_0xc111('0x26')](_0xa7caf0[_0xc111('0x35')][_0xc111('0x26')]);_0x30fc2c[_0xc111('0x24')]=qs[_0xc111('0x24')](_0xa7caf0[_0xc111('0x35')][_0xc111('0x24')]);}return _0x592858['getProactiveActions'](_0x30fc2c);}})['then'](function(_0x1f629f){if(_0x1f629f){return _0x1f629f?{'count':_0xe01e10,'rows':_0x1f629f}:null;}})['then'](respondWithResult(_0xa25616,null))[_0xc111('0x1f')](handleError(_0xa25616,null));};exports['getFields']=function(_0x4ad580,_0x469c42){var _0xe21edf=_0x4ad580[_0xc111('0x35')][_0xc111('0x115')]===_0xc111('0x116')?'offlineForm':_0xc111('0x117');return db[_0xc111('0x31')][_0xc111('0x49')]({'attributes':['id',_0xe21edf],'where':{'id':_0x4ad580['params']['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x469c42,null))['then'](function(_0x35ec02){if(_0x35ec02){var _0x55b745=_0x35ec02[_0xe21edf];var _0x1a186e=_0x55b745&&_0x55b745[_0xc111('0x118')]?_0x55b745[_0xc111('0x118')]:[];_0x469c42[_0xc111('0x2e')]({'fromKey':_[_0xc111('0x68')](_0x55b745[_0xc111('0x119')])?undefined:_0x55b745[_0xc111('0x119')],'count':_0x1a186e['length'],'rows':_0x1a186e});}})[_0xc111('0x1f')](handleError(_0x469c42,null));};exports[_0xc111('0x11a')]=function(_0x3409bd,_0x33c8ae){var _0x1a9439={'raw':![],'where':{}};var _0x3ca826={};var _0x29633b={'count':0x0,'rows':[]};return db[_0xc111('0x31')][_0xc111('0x58')]({'where':{'id':_0x3409bd[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x33c8ae,null))[_0xc111('0x16')](function(_0x10418f){if(_0x10418f){_0x3ca826[_0xc111('0x34')]=_[_0xc111('0x36')](db['ChatOfflineMessage'][_0xc111('0x32')]);_0x3ca826[_0xc111('0x35')]=_[_0xc111('0x36')](_0x3409bd['query']);_0x3ca826[_0xc111('0x37')]=_[_0xc111('0x38')](_0x3ca826[_0xc111('0x34')],_0x3ca826['query']);_0x1a9439[_0xc111('0x39')]=_['intersection'](_0x3ca826[_0xc111('0x34')],qs[_0xc111('0x3a')](_0x3409bd['query'][_0xc111('0x3a')]));_0x1a9439[_0xc111('0x39')]=_0x1a9439[_0xc111('0x39')][_0xc111('0x3b')]?_0x1a9439['attributes']:_0x3ca826[_0xc111('0x34')];if(!_0x3409bd['query'][_0xc111('0x3c')]('nolimit')){_0x1a9439[_0xc111('0x26')]=qs[_0xc111('0x26')](_0x3409bd[_0xc111('0x35')]['limit']);_0x1a9439[_0xc111('0x24')]=qs[_0xc111('0x24')](_0x3409bd['query'][_0xc111('0x24')]);}_0x1a9439['order']=qs[_0xc111('0x3f')](_0x3409bd[_0xc111('0x35')][_0xc111('0x3f')]);_0x1a9439['where']=qs['filters'](_['pick'](_0x3409bd[_0xc111('0x35')],_0x3ca826[_0xc111('0x37')]));_0x1a9439[_0xc111('0x42')][_0xc111('0x52')]=_0x10418f['id'];if(_0x3409bd['query']['filter']){_0x1a9439[_0xc111('0x42')]=_[_0xc111('0x44')](_0x1a9439[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0x1a9439[_0xc111('0x39')],function(_0x52ec5a){var _0x2a9650={};_0x2a9650[_0x52ec5a]={'$like':'%'+_0x3409bd['query'][_0xc111('0x41')]+'%'};return _0x2a9650;})});}_0x1a9439=_['merge']({},_0x1a9439,_0x3409bd[_0xc111('0x45')]);return db['ChatOfflineMessage'][_0xc111('0x27')]({'where':_0x1a9439['where']})[_0xc111('0x16')](function(_0x1119ee){_0x29633b[_0xc111('0x27')]=_0x1119ee;if(_0x3409bd['query'][_0xc111('0x46')]){_0x1a9439['include']=[{'all':!![]}];}else{_0x1a9439['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xc111('0xca')],'as':_0xc111('0x11b'),'required':![]}];}return db[_0xc111('0xc1')][_0xc111('0x59')](_0x1a9439);})[_0xc111('0x16')](function(_0x567ac3){_0x29633b['rows']=_0x567ac3;return _0x29633b;});}})[_0xc111('0x16')](respondWithFilteredResult(_0x33c8ae,_0x1a9439))[_0xc111('0x1f')](handleError(_0x33c8ae,null));};exports[_0xc111('0x11c')]=function(_0x4bd3e3,_0x123f4b){return db['ChatWebsite'][_0xc111('0x49')]({'where':{'id':_0x4bd3e3['params']['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x123f4b,null))['then'](function(_0x1fc271){if(_0x1fc271){return _0x1fc271[_0xc111('0x11c')](_0x4bd3e3['body'][_0xc111('0x56')],_[_0xc111('0xdf')](_0x4bd3e3[_0xc111('0x4b')],[_0xc111('0x56'),'id'])||{})['spread'](function(_0x1e1c53){for(var _0x2a751f=0x0;_0x2a751f<_0x4bd3e3[_0xc111('0x4b')][_0xc111('0x56')]['length'];_0x2a751f+=0x1){socket['emit'](_0xc111('0x11d'),{'UserId':Number(_0x4bd3e3['body']['ids'][_0x2a751f]),'ChatWebsiteId':Number(_0x4bd3e3[_0xc111('0x4f')]['id'])});}return _0x1e1c53;});}})[_0xc111('0x16')](respondWithResult(_0x123f4b,null))[_0xc111('0x1f')](handleError(_0x123f4b,null));};exports[_0xc111('0x11e')]=function(_0xb48ef3,_0x4a02a3){return db[_0xc111('0x31')][_0xc111('0x49')]({'where':{'id':_0xb48ef3[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x4a02a3,null))['then'](function(_0x4168bd){if(_0x4168bd){return _0x4168bd[_0xc111('0x11e')](_0xb48ef3['query']['ids'])[_0xc111('0x16')](function(){if(_[_0xc111('0x11f')](_0xb48ef3[_0xc111('0x35')][_0xc111('0x56')])){for(var _0x33ab85=0x0;_0x33ab85<_0xb48ef3[_0xc111('0x35')][_0xc111('0x56')][_0xc111('0x3b')];_0x33ab85+=0x1){socket['emit'](_0xc111('0x120'),{'UserId':Number(_0xb48ef3[_0xc111('0x35')]['ids'][_0x33ab85]),'ChatWebsiteId':Number(_0xb48ef3[_0xc111('0x4f')]['id'])});}}else{socket[_0xc111('0x121')](_0xc111('0x120'),{'UserId':Number(_0xb48ef3[_0xc111('0x35')][_0xc111('0x56')]),'ChatWebsiteId':Number(_0xb48ef3[_0xc111('0x4f')]['id'])});}});}})[_0xc111('0x16')](respondWithStatusCode(_0x4a02a3,null))[_0xc111('0x1f')](handleError(_0x4a02a3,null));};exports[_0xc111('0x122')]=function(_0x431ce8,_0x3bd838){var _0x14c706={};var _0x137546={};var _0x337c56;var _0x2ccbb8;return db['ChatWebsite']['findOne']({'where':{'id':_0x431ce8[_0xc111('0x4f')]['id']}})[_0xc111('0x16')](handleEntityNotFound(_0x3bd838,null))['then'](function(_0x152235){if(_0x152235){_0x337c56=_0x152235;_0x137546['model']=_[_0xc111('0x36')](db[_0xc111('0xaf')][_0xc111('0x32')]);_0x137546[_0xc111('0x35')]=_[_0xc111('0x36')](_0x431ce8[_0xc111('0x35')]);_0x137546['filters']=_[_0xc111('0x38')](_0x137546[_0xc111('0x34')],_0x137546[_0xc111('0x35')]);_0x14c706[_0xc111('0x39')]=_[_0xc111('0x38')](_0x137546[_0xc111('0x34')],qs[_0xc111('0x3a')](_0x431ce8['query'][_0xc111('0x3a')]));_0x14c706[_0xc111('0x39')]=_0x14c706['attributes'][_0xc111('0x3b')]?_0x14c706[_0xc111('0x39')]:_0x137546[_0xc111('0x34')];_0x14c706[_0xc111('0x3e')]=qs[_0xc111('0x3f')](_0x431ce8[_0xc111('0x35')]['sort']);_0x14c706[_0xc111('0x42')]=qs[_0xc111('0x37')](_[_0xc111('0x40')](_0x431ce8[_0xc111('0x35')],_0x137546['filters']));if(_0x431ce8['query'][_0xc111('0x41')]){_0x14c706[_0xc111('0x42')]=_[_0xc111('0x44')](_0x14c706[_0xc111('0x42')],{'$or':_[_0xc111('0x30')](_0x14c706[_0xc111('0x39')],function(_0x28beaa){var _0x9e9fef={};_0x9e9fef[_0x28beaa]={'$like':'%'+_0x431ce8[_0xc111('0x35')][_0xc111('0x41')]+'%'};return _0x9e9fef;})});}_0x14c706=_['merge']({},_0x14c706,_0x431ce8[_0xc111('0x45')]);return _0x337c56['getAgents'](_0x14c706);}})[_0xc111('0x16')](function(_0x47ed20){if(_0x47ed20){_0x2ccbb8=_0x47ed20[_0xc111('0x3b')];if(!_0x431ce8[_0xc111('0x35')][_0xc111('0x3c')](_0xc111('0x3d'))){_0x14c706['limit']=qs[_0xc111('0x26')](_0x431ce8[_0xc111('0x35')][_0xc111('0x26')]);_0x14c706[_0xc111('0x24')]=qs[_0xc111('0x24')](_0x431ce8['query'][_0xc111('0x24')]);}return _0x337c56[_0xc111('0x122')](_0x14c706);}})[_0xc111('0x16')](function(_0xdf70fa){if(_0xdf70fa){return _0xdf70fa?{'count':_0x2ccbb8,'rows':_0xdf70fa}:null;}})[_0xc111('0x16')](respondWithResult(_0x3bd838,null))[_0xc111('0x1f')](handleError(_0x3bd838,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e4b03d0..7cc3570 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 _0x089f=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x5a99e3,_0x500b2e){var _0x5d7124=function(_0x4bbbcb){while(--_0x4bbbcb){_0x5a99e3['push'](_0x5a99e3['shift']());}};_0x5d7124(++_0x500b2e);}(_0x089f,0x1c7));var _0xf089=function(_0x5d7371,_0x4c175d){_0x5d7371=_0x5d7371-0x0;var _0x320906=_0x089f[_0x5d7371];return _0x320906;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xf089('0x0'))['db'][_0xf089('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf089('0x2')](0x0);var events={'afterCreate':_0xf089('0x3'),'afterUpdate':_0xf089('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b7602){return function(_0x3195ed,_0x250428,_0x5ea026){ChatWebsiteEvents[_0xf089('0x5')](_0x2b7602+':'+_0x3195ed['id'],_0x3195ed);ChatWebsiteEvents[_0xf089('0x5')](_0x2b7602,_0x3195ed);_0x5ea026(null);};}for(var e in events){if(events[_0xf089('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xf089('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc6ab=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0xc6ab,0x96));var _0xbc6a=function(_0x57d1d0,_0x1d6171){_0x57d1d0=_0x57d1d0-0x0;var _0x18b6b2=_0xc6ab[_0x57d1d0];return _0x18b6b2;};'use strict';var EventEmitter=require(_0xbc6a('0x0'));var ChatWebsite=require(_0xbc6a('0x1'))['db'][_0xbc6a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbc6a('0x3')](0x0);var events={'afterCreate':_0xbc6a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xbf9d02){return function(_0x1c351c,_0x3808e0,_0x3f7109){ChatWebsiteEvents[_0xbc6a('0x5')](_0xbf9d02+':'+_0x1c351c['id'],_0x1c351c);ChatWebsiteEvents['emit'](_0xbf9d02,_0x1c351c);_0x3f7109(null);};}for(var e in events){if(events[_0xbc6a('0x6')](e)){var event=events[e];ChatWebsite[_0xbc6a('0x7')](e,emitEvent(event));}}module[_0xbc6a('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9b8ef58..3709017 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 _0x02cc=['../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4044f9,_0x4f2f51){var _0x3cfbda=function(_0x23ac21){while(--_0x23ac21){_0x4044f9['push'](_0x4044f9['shift']());}};_0x3cfbda(++_0x4f2f51);}(_0x02cc,0xe2));var _0xc02c=function(_0x3c6c7e,_0x412212){_0x3c6c7e=_0x3c6c7e-0x0;var _0x14a775=_0x02cc[_0x3c6c7e];return _0x14a775;};'use strict';var _=require(_0xc02c('0x0'));var util=require(_0xc02c('0x1'));var logger=require(_0xc02c('0x2'))(_0xc02c('0x3'));var moment=require(_0xc02c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc02c('0x5'));var fs=require('fs');var path=require(_0xc02c('0x6'));var rimraf=require(_0xc02c('0x7'));var config=require(_0xc02c('0x8'));var attributes=require(_0xc02c('0x9'));module[_0xc02c('0xa')]=function(_0x5b6147,_0x5cc69b){return _0x5b6147[_0xc02c('0xb')]('ChatWebsite',attributes,{'tableName':_0xc02c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x475e=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites'];(function(_0xcf6b4d,_0x39a1c9){var _0x2073a9=function(_0x2932c6){while(--_0x2932c6){_0xcf6b4d['push'](_0xcf6b4d['shift']());}};_0x2073a9(++_0x39a1c9);}(_0x475e,0x1b0));var _0xe475=function(_0x7c439f,_0x33e90f){_0x7c439f=_0x7c439f-0x0;var _0x4ebaf1=_0x475e[_0x7c439f];return _0x4ebaf1;};'use strict';var _=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var logger=require(_0xe475('0x2'))(_0xe475('0x3'));var moment=require(_0xe475('0x4'));var BPromise=require('bluebird');var rp=require(_0xe475('0x5'));var fs=require('fs');var path=require(_0xe475('0x6'));var rimraf=require(_0xe475('0x7'));var config=require(_0xe475('0x8'));var attributes=require(_0xe475('0x9'));module[_0xe475('0xa')]=function(_0x47d0b2,_0x370138){return _0x47d0b2['define']('ChatWebsite',attributes,{'tableName':_0xe475('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 c8667de..dae9279 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 _0x0c67=['debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x3215c0,_0x459616){var _0x238271=function(_0x42e3a8){while(--_0x42e3a8){_0x3215c0['push'](_0x3215c0['shift']());}};_0x238271(++_0x459616);}(_0x0c67,0xca));var _0x70c6=function(_0x54b958,_0xa85521){_0x54b958=_0x54b958-0x0;var _0x634508=_0x0c67[_0x54b958];return _0x634508;};'use strict';var _=require(_0x70c6('0x0'));var util=require(_0x70c6('0x1'));var moment=require(_0x70c6('0x2'));var BPromise=require(_0x70c6('0x3'));var rs=require(_0x70c6('0x4'));var fs=require('fs');var Redis=require(_0x70c6('0x5'));var db=require(_0x70c6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x70c6('0x7'))('rpc');var config=require(_0x70c6('0x8'));var jayson=require(_0x70c6('0x9'));var client=jayson[_0x70c6('0xa')][_0x70c6('0xb')]({'port':0x232a});config[_0x70c6('0xc')]=_[_0x70c6('0xd')](config[_0x70c6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x70c6('0xe'))(new Redis(config[_0x70c6('0xc')]));require(_0x70c6('0xf'))[_0x70c6('0x10')](socket);function respondWithRpcPromise(_0x23d00b,_0x1b6511,_0xd55457){return new BPromise(function(_0x4fd066,_0x279bb5){return client[_0x70c6('0x11')](_0x23d00b,_0xd55457)[_0x70c6('0x12')](function(_0x38f209){logger[_0x70c6('0x13')](_0x70c6('0x14'),_0x1b6511,_0x70c6('0x15'));logger[_0x70c6('0x16')](_0x70c6('0x17'),_0x1b6511,_0x70c6('0x15'),JSON[_0x70c6('0x18')](_0x38f209));if(_0x38f209[_0x70c6('0x19')]){if(_0x38f209[_0x70c6('0x19')]['code']===0x1f4){logger[_0x70c6('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1b6511,_0x38f209['error'][_0x70c6('0x1a')]);return _0x279bb5(_0x38f209['error']['message']);}logger[_0x70c6('0x19')](_0x70c6('0x14'),_0x1b6511,_0x38f209[_0x70c6('0x19')][_0x70c6('0x1a')]);return _0x4fd066(_0x38f209[_0x70c6('0x19')][_0x70c6('0x1a')]);}else{logger['info'](_0x70c6('0x14'),_0x1b6511,_0x70c6('0x15'));_0x4fd066(_0x38f209['result'][_0x70c6('0x1a')]);}})[_0x70c6('0x1b')](function(_0x233e43){logger['error'](_0x70c6('0x14'),_0x1b6511,_0x233e43);_0x279bb5(_0x233e43);});});} \ No newline at end of file +var _0xd210=['code','message','info','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x28c643,_0x439dcf){var _0x2973b2=function(_0x7212f0){while(--_0x7212f0){_0x28c643['push'](_0x28c643['shift']());}};_0x2973b2(++_0x439dcf);}(_0xd210,0xb3));var _0x0d21=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xd210[_0x46111d];return _0xe82586;};'use strict';var _=require('lodash');var util=require(_0x0d21('0x0'));var moment=require(_0x0d21('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d21('0x2'))['db'];var utils=require(_0x0d21('0x3'));var logger=require(_0x0d21('0x4'))(_0x0d21('0x5'));var config=require(_0x0d21('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0d21('0x7')]({'port':0x232a});config[_0x0d21('0x8')]=_[_0x0d21('0x9')](config[_0x0d21('0x8')],{'host':_0x0d21('0xa'),'port':0x18eb});var socket=require(_0x0d21('0xb'))(new Redis(config[_0x0d21('0x8')]));require('./chatWebsite.socket')[_0x0d21('0xc')](socket);function respondWithRpcPromise(_0x87282b,_0x22be6d,_0x4c4486){return new BPromise(function(_0x2bebd3,_0x420173){return client[_0x0d21('0xd')](_0x87282b,_0x4c4486)[_0x0d21('0xe')](function(_0x364881){logger['info'](_0x0d21('0xf'),_0x22be6d,_0x0d21('0x10'));logger[_0x0d21('0x11')](_0x0d21('0x12'),_0x22be6d,'request\x20sent',JSON[_0x0d21('0x13')](_0x364881));if(_0x364881[_0x0d21('0x14')]){if(_0x364881['error'][_0x0d21('0x15')]===0x1f4){logger[_0x0d21('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x22be6d,_0x364881[_0x0d21('0x14')]['message']);return _0x420173(_0x364881[_0x0d21('0x14')][_0x0d21('0x16')]);}logger[_0x0d21('0x14')](_0x0d21('0xf'),_0x22be6d,_0x364881[_0x0d21('0x14')][_0x0d21('0x16')]);return _0x2bebd3(_0x364881[_0x0d21('0x14')]['message']);}else{logger[_0x0d21('0x17')](_0x0d21('0xf'),_0x22be6d,'request\x20sent');_0x2bebd3(_0x364881['result'][_0x0d21('0x16')]);}})[_0x0d21('0x18')](function(_0x2ae747){logger[_0x0d21('0x14')](_0x0d21('0xf'),_0x22be6d,_0x2ae747);_0x420173(_0x2ae747);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d232a92..f811c5b 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 _0x5ece=['emit','removeListener','register','length','chatWebsite:','save','remove','update'];(function(_0x398644,_0x3f740c){var _0x296320=function(_0x2f01f2){while(--_0x2f01f2){_0x398644['push'](_0x398644['shift']());}};_0x296320(++_0x3f740c);}(_0x5ece,0x1c5));var _0xe5ec=function(_0x56c658,_0x4edbaf){_0x56c658=_0x56c658-0x0;var _0x3a880b=_0x5ece[_0x56c658];return _0x3a880b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe5ec('0x0'),_0xe5ec('0x1'),_0xe5ec('0x2')];function createListener(_0x2be0d2,_0x3e0d17){return function(_0x1eaab7){_0x3e0d17[_0xe5ec('0x3')](_0x2be0d2,_0x1eaab7);};}function removeListener(_0x4e88d2,_0x103acd){return function(){ChatWebsiteEvents[_0xe5ec('0x4')](_0x4e88d2,_0x103acd);};}exports[_0xe5ec('0x5')]=function(_0x4f6566){for(var _0x37b5f4=0x0,_0x407254=events[_0xe5ec('0x6')];_0x37b5f4<_0x407254;_0x37b5f4++){var _0x54117b=events[_0x37b5f4];var _0x200411=createListener(_0xe5ec('0x7')+_0x54117b,_0x4f6566);ChatWebsiteEvents['on'](_0x54117b,_0x200411);}}; \ No newline at end of file +var _0x4f64=['./chatWebsite.events','remove','update','emit','removeListener','length'];(function(_0xd1a9e6,_0x4bc61b){var _0x8948a5=function(_0x5bba4c){while(--_0x5bba4c){_0xd1a9e6['push'](_0xd1a9e6['shift']());}};_0x8948a5(++_0x4bc61b);}(_0x4f64,0x16e));var _0x44f6=function(_0x5ea9e4,_0x234fdc){_0x5ea9e4=_0x5ea9e4-0x0;var _0x38fff0=_0x4f64[_0x5ea9e4];return _0x38fff0;};'use strict';var ChatWebsiteEvents=require(_0x44f6('0x0'));var events=['save',_0x44f6('0x1'),_0x44f6('0x2')];function createListener(_0x5d3fc4,_0x3a184a){return function(_0x5bdef6){_0x3a184a[_0x44f6('0x3')](_0x5d3fc4,_0x5bdef6);};}function removeListener(_0x2f3c,_0x267aa4){return function(){ChatWebsiteEvents[_0x44f6('0x4')](_0x2f3c,_0x267aa4);};}exports['register']=function(_0x3abdb3){for(var _0x2f4eb1=0x0,_0x257828=events[_0x44f6('0x5')];_0x2f4eb1<_0x257828;_0x2f4eb1++){var _0x46228a=events[_0x2f4eb1];var _0x44fa70=createListener('chatWebsite:'+_0x46228a,_0x3abdb3);ChatWebsiteEvents['on'](_0x46228a,_0x44fa70);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c466b04..2a0a133 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 _0xa302=['getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','diskStorage','join','root','server/files/images/logos/','%s-%s','single','file','addLogo','server/files/images/avatars/','format','now','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions'];(function(_0x13b74e,_0x375707){var _0x56863c=function(_0x1ffd60){while(--_0x1ffd60){_0x13b74e['push'](_0x13b74e['shift']());}};_0x56863c(++_0x375707);}(_0xa302,0xc6));var _0x2a30=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa302[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x2a30('0x0'));var util=require('util');var path=require(_0x2a30('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a30('0x2')]();var fs_extra=require(_0x2a30('0x3'));var auth=require(_0x2a30('0x4'));var interaction=require(_0x2a30('0x5'));var config=require(_0x2a30('0x6'));var controller=require('./chatWebsite.controller');router[_0x2a30('0x7')]('/',auth[_0x2a30('0x8')](),controller[_0x2a30('0x9')]);router[_0x2a30('0x7')](_0x2a30('0xa'),auth[_0x2a30('0x8')](),controller[_0x2a30('0xb')]);router[_0x2a30('0x7')](_0x2a30('0xc'),auth[_0x2a30('0x8')](),controller[_0x2a30('0xd')]);router['get'](_0x2a30('0xe'),auth[_0x2a30('0x8')](),controller[_0x2a30('0xf')]);router[_0x2a30('0x7')]('/:id/canned_answers',auth[_0x2a30('0x8')](),controller['getAnswers']);router[_0x2a30('0x7')](_0x2a30('0x10'),controller[_0x2a30('0x11')]);router[_0x2a30('0x7')](_0x2a30('0x12'),controller[_0x2a30('0x13')]);router[_0x2a30('0x7')](_0x2a30('0x14'),controller[_0x2a30('0x15')]);router[_0x2a30('0x7')](_0x2a30('0x16'),controller[_0x2a30('0x17')]);router['get'](_0x2a30('0x18'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x19')]);router[_0x2a30('0x7')](_0x2a30('0x1a'),controller[_0x2a30('0x1b')]);router[_0x2a30('0x7')](_0x2a30('0x1c'),auth[_0x2a30('0x8')](),controller['getApplications']);router[_0x2a30('0x7')](_0x2a30('0x1d'),auth['isAuthenticated'](),controller[_0x2a30('0x1e')]);router[_0x2a30('0x7')](_0x2a30('0x1f'),controller[_0x2a30('0x20')]);router['get'](_0x2a30('0x21'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x22')]);router[_0x2a30('0x7')](_0x2a30('0x23'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x24')]);router[_0x2a30('0x25')]('/',auth[_0x2a30('0x8')](),controller[_0x2a30('0x26')]);router[_0x2a30('0x25')](_0x2a30('0xe'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x27')]);router[_0x2a30('0x25')](_0x2a30('0x28'),auth[_0x2a30('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2a30('0x29')]({'destination':function(_0x2eb31b,_0x5ed3db,_0x2517dc){_0x2517dc(null,path[_0x2a30('0x2a')](config[_0x2a30('0x2b')],_0x2a30('0x2c')));},'filename':function(_0x4913d3,_0x2482c5,_0x4ebf1f){_0x4ebf1f(null,util['format'](_0x2a30('0x2d'),Date['now'](),_0x2482c5['originalname']));}})});router[_0x2a30('0x25')](_0x2a30('0x10'),upload[_0x2a30('0x2e')](_0x2a30('0x2f')),controller[_0x2a30('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22aa85,_0x4b7c0d,_0x2534d8){_0x2534d8(null,path[_0x2a30('0x2a')](config[_0x2a30('0x2b')],_0x2a30('0x31')));},'filename':function(_0x884dc4,_0x430623,_0x5aa595){_0x5aa595(null,util[_0x2a30('0x32')](_0x2a30('0x2d'),Date[_0x2a30('0x33')](),_0x430623[_0x2a30('0x34')]));}})});router[_0x2a30('0x25')](_0x2a30('0x12'),upload[_0x2a30('0x2e')]('file'),controller[_0x2a30('0x35')]);var upload=multer({'storage':multer[_0x2a30('0x29')]({'destination':function(_0x39fd65,_0x59ed54,_0x42426d){_0x42426d(null,path[_0x2a30('0x2a')](config[_0x2a30('0x2b')],_0x2a30('0x31')));},'filename':function(_0x4a189c,_0x56efa3,_0x4d3603){_0x4d3603(null,util[_0x2a30('0x32')]('%s-%s',Date[_0x2a30('0x33')](),_0x56efa3[_0x2a30('0x34')]));}})});router[_0x2a30('0x25')](_0x2a30('0x14'),upload['single'](_0x2a30('0x2f')),controller[_0x2a30('0x36')]);var upload=multer({'storage':multer[_0x2a30('0x29')]({'destination':function(_0x413d79,_0x371b67,_0x253231){_0x253231(null,path['join'](config[_0x2a30('0x2b')],_0x2a30('0x31')));},'filename':function(_0x4d4748,_0xc55fee,_0x11019c){_0x11019c(null,util[_0x2a30('0x32')](_0x2a30('0x2d'),Date[_0x2a30('0x33')](),_0xc55fee[_0x2a30('0x34')]));}})});router[_0x2a30('0x25')]('/:id/system_avatar',upload[_0x2a30('0x2e')](_0x2a30('0x2f')),controller[_0x2a30('0x37')]);router[_0x2a30('0x25')](_0x2a30('0x38'),controller[_0x2a30('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0x2a30('0x29')]({'destination':function(_0x5d4f38,_0x2b1bae,_0x2e8293){const _0x32769e=path[_0x2a30('0x2a')](config[_0x2a30('0x2b')],_0x2a30('0x3a'),_0x2a30('0x3b'),_0x2a30('0x3c'));fs_extra['ensureDir'](_0x32769e,function(){_0x2e8293(null,_0x32769e);});},'filename':function(_0x4b4b11,_0x281703,_0x5f1670){const _0x226207=_0x281703['originalname'][_0x2a30('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f1ad4=path[_0x2a30('0x3e')](_0x226207);const _0x29d136=Date[_0x2a30('0x33')]()+'-'+_0x226207['replace'](_0x2f1ad4,'')+_0x2f1ad4;_0x5f1670(null,_0x29d136);}})});router[_0x2a30('0x25')](_0x2a30('0x3f'),offlineUploadMulter[_0x2a30('0x40')](),controller[_0x2a30('0x41')]);router[_0x2a30('0x25')]('/:id/interactions',auth[_0x2a30('0x8')](),controller[_0x2a30('0x42')]);router[_0x2a30('0x25')](_0x2a30('0x1c'),auth[_0x2a30('0x8')](),controller['addApplications']);router[_0x2a30('0x25')](_0x2a30('0x1d'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x43')]);router[_0x2a30('0x25')](_0x2a30('0x23'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x44')]);router[_0x2a30('0x45')](_0x2a30('0xc'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x46')]);router[_0x2a30('0x47')](_0x2a30('0xc'),auth[_0x2a30('0x8')](),controller[_0x2a30('0x48')]);router[_0x2a30('0x47')]('/:id/dispositions',auth[_0x2a30('0x8')](),controller[_0x2a30('0x49')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2a30('0x47')](_0x2a30('0x23'),auth['isAuthenticated'](),controller[_0x2a30('0x4a')]);module[_0x2a30('0x4b')]=router; \ No newline at end of file +var _0x08cd=['/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','join','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','/describe','isAuthenticated','get','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar'];(function(_0x19fea1,_0xd3e74f){var _0x447bae=function(_0x4d4b0f){while(--_0x4d4b0f){_0x19fea1['push'](_0x19fea1['shift']());}};_0x447bae(++_0xd3e74f);}(_0x08cd,0x1d5));var _0xd08c=function(_0x519109,_0x19f3fe){_0x519109=_0x519109-0x0;var _0x180260=_0x08cd[_0x519109];return _0x180260;};'use strict';var multer=require('multer');var util=require(_0xd08c('0x0'));var path=require(_0xd08c('0x1'));var timeout=require(_0xd08c('0x2'));var express=require(_0xd08c('0x3'));var router=express[_0xd08c('0x4')]();var fs_extra=require(_0xd08c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd08c('0x6'));var config=require('../../config/environment');var controller=require(_0xd08c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd08c('0x8'),auth[_0xd08c('0x9')](),controller['describe']);router[_0xd08c('0xa')](_0xd08c('0xb'),auth[_0xd08c('0x9')](),controller['show']);router[_0xd08c('0xa')]('/:id/dispositions',auth[_0xd08c('0x9')](),controller[_0xd08c('0xc')]);router[_0xd08c('0xa')](_0xd08c('0xd'),auth[_0xd08c('0x9')](),controller[_0xd08c('0xe')]);router[_0xd08c('0xa')](_0xd08c('0xf'),controller[_0xd08c('0x10')]);router[_0xd08c('0xa')](_0xd08c('0x11'),controller['getAvatar']);router[_0xd08c('0xa')](_0xd08c('0x12'),controller[_0xd08c('0x13')]);router[_0xd08c('0xa')](_0xd08c('0x14'),controller['getSystemAvatar']);router['get'](_0xd08c('0x15'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x16')]);router[_0xd08c('0xa')](_0xd08c('0x17'),controller[_0xd08c('0x18')]);router['get'](_0xd08c('0x19'),auth[_0xd08c('0x9')](),controller['getApplications']);router['get'](_0xd08c('0x1a'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x1b')]);router['get'](_0xd08c('0x1c'),controller[_0xd08c('0x1d')]);router[_0xd08c('0xa')](_0xd08c('0x1e'),auth[_0xd08c('0x9')](),controller['getOfflineMessages']);router[_0xd08c('0xa')](_0xd08c('0x1f'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x20')]);router[_0xd08c('0x21')]('/',auth['isAuthenticated'](),controller[_0xd08c('0x22')]);router[_0xd08c('0x21')](_0xd08c('0x23'),auth[_0xd08c('0x9')](),controller['addDisposition']);router[_0xd08c('0x21')]('/:id/canned_answers',auth[_0xd08c('0x9')](),controller[_0xd08c('0x24')]);var upload=multer({'storage':multer[_0xd08c('0x25')]({'destination':function(_0x26fa99,_0x15f3e4,_0x3b7815){_0x3b7815(null,path['join'](config[_0xd08c('0x26')],_0xd08c('0x27')));},'filename':function(_0x567cb0,_0x594a26,_0x291d18){_0x291d18(null,util[_0xd08c('0x28')](_0xd08c('0x29'),Date[_0xd08c('0x2a')](),_0x594a26[_0xd08c('0x2b')]));}})});router[_0xd08c('0x21')]('/:id/logo',upload[_0xd08c('0x2c')](_0xd08c('0x2d')),controller[_0xd08c('0x2e')]);var upload=multer({'storage':multer[_0xd08c('0x25')]({'destination':function(_0x8f35f4,_0x1651e0,_0x3aa1dc){_0x3aa1dc(null,path['join'](config[_0xd08c('0x26')],_0xd08c('0x2f')));},'filename':function(_0x2b1f63,_0x23b022,_0x43afd1){_0x43afd1(null,util[_0xd08c('0x28')]('%s-%s',Date['now'](),_0x23b022['originalname']));}})});router[_0xd08c('0x21')](_0xd08c('0x11'),upload[_0xd08c('0x2c')]('file'),controller[_0xd08c('0x30')]);var upload=multer({'storage':multer[_0xd08c('0x25')]({'destination':function(_0x4412ff,_0x3463b6,_0x591860){_0x591860(null,path[_0xd08c('0x31')](config[_0xd08c('0x26')],_0xd08c('0x2f')));},'filename':function(_0x2f3f83,_0x3f4749,_0x5ce243){_0x5ce243(null,util[_0xd08c('0x28')]('%s-%s',Date[_0xd08c('0x2a')](),_0x3f4749[_0xd08c('0x2b')]));}})});router['post'](_0xd08c('0x12'),upload[_0xd08c('0x2c')](_0xd08c('0x2d')),controller[_0xd08c('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x287d10,_0x4c17f2,_0x4c074b){_0x4c074b(null,path[_0xd08c('0x31')](config[_0xd08c('0x26')],'server/files/images/avatars/'));},'filename':function(_0xd70628,_0x4724a8,_0x13f059){_0x13f059(null,util[_0xd08c('0x28')](_0xd08c('0x29'),Date['now'](),_0x4724a8[_0xd08c('0x2b')]));}})});router[_0xd08c('0x21')](_0xd08c('0x14'),upload[_0xd08c('0x2c')](_0xd08c('0x2d')),controller[_0xd08c('0x33')]);router[_0xd08c('0x21')]('/:id/notify',controller[_0xd08c('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xd08c('0x25')]({'destination':function(_0x57292f,_0xb1e671,_0x4cb37e){const _0x543742=path[_0xd08c('0x31')](config[_0xd08c('0x26')],_0xd08c('0x35'),_0xd08c('0x36'),_0xd08c('0x37'));fs_extra[_0xd08c('0x38')](_0x543742,function(){_0x4cb37e(null,_0x543742);});},'filename':function(_0x6183d0,_0x55c0b5,_0x4486c7){const _0x174457=_0x55c0b5[_0xd08c('0x2b')][_0xd08c('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f24fa=path[_0xd08c('0x3a')](_0x174457);const _0x4bf365=Date[_0xd08c('0x2a')]()+'-'+_0x174457[_0xd08c('0x39')](_0x2f24fa,'')+_0x2f24fa;_0x4486c7(null,_0x4bf365);}})});router['post'](_0xd08c('0x3b'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0xd08c('0x15'),auth[_0xd08c('0x9')](),controller['addInteraction']);router[_0xd08c('0x21')](_0xd08c('0x19'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x3c')]);router[_0xd08c('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xd08c('0x3d')]);router['post'](_0xd08c('0x1f'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x3e')]);router[_0xd08c('0x3f')]('/:id',auth[_0xd08c('0x9')](),controller[_0xd08c('0x40')]);router[_0xd08c('0x41')](_0xd08c('0xb'),auth['isAuthenticated'](),controller[_0xd08c('0x42')]);router[_0xd08c('0x41')](_0xd08c('0x23'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd08c('0x41')](_0xd08c('0xd'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x43')]);router[_0xd08c('0x41')](_0xd08c('0x1f'),auth[_0xd08c('0x9')](),controller[_0xd08c('0x44')]);module[_0xd08c('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c32c7fb..f2ffc08 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 _0x354c=['production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','env'];(function(_0x9662d0,_0x35783f){var _0x4125bc=function(_0x5ee25f){while(--_0x5ee25f){_0x9662d0['push'](_0x9662d0['shift']());}};_0x4125bc(++_0x35783f);}(_0x354c,0xf7));var _0xc354=function(_0x5e2e7b,_0x161076){_0x5e2e7b=_0x5e2e7b-0x0;var _0x295bdc=_0x354c[_0x5e2e7b];return _0x295bdc;};var beaverLogger=require(_0xc354('0x0'));var express=require(_0xc354('0x1'));var auth=require('../components/auth/service');var config=require(_0xc354('0x2'));var router=express[_0xc354('0x3')]();var isProduction=config[_0xc354('0x4')]===_0xc354('0x5')||![];function clientSideLogs(_0x3fec89,_0x582b94,_0xcccf5d){var _0x360bfd=_0x3fec89[_0xc354('0x6')]['get'](_0xc354('0x7'));if(!_0x360bfd){throw new Error(_0xc354('0x8'));}return beaverLogger[_0xc354('0x9')]({'uri':_0xc354('0xa'),'logger':_0x360bfd,'enableCors':!isProduction})(_0x3fec89,_0x582b94,_0xcccf5d);}router[_0xc354('0xb')](auth[_0xc354('0xc')](),clientSideLogs);module[_0xc354('0xd')]=router; \ No newline at end of file +var _0xe11c=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe11c,0x113));var _0xce11=function(_0x4524b4,_0x27707f){_0x4524b4=_0x4524b4-0x0;var _0x39ebf7=_0xe11c[_0x4524b4];return _0x39ebf7;};var beaverLogger=require(_0xce11('0x0'));var express=require(_0xce11('0x1'));var auth=require(_0xce11('0x2'));var config=require('../config/environment');var router=express[_0xce11('0x3')]();var isProduction=config[_0xce11('0x4')]===_0xce11('0x5')||![];function clientSideLogs(_0x1a8a48,_0x57dd42,_0x2793b1){var _0x13333c=_0x1a8a48[_0xce11('0x6')]['get'](_0xce11('0x7'));if(!_0x13333c){throw new Error(_0xce11('0x8'));}return beaverLogger[_0xce11('0x9')]({'uri':_0xce11('0xa'),'logger':_0x13333c,'enableCors':!isProduction})(_0x1a8a48,_0x57dd42,_0x2793b1);}router['use'](auth[_0xce11('0xb')](),clientSideLogs);module[_0xce11('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 26bf364..d741ed0 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 _0xec0e=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x1fb0b9,_0x41a7d3){var _0x36ed20=function(_0x5521e5){while(--_0x5521e5){_0x1fb0b9['push'](_0x1fb0b9['shift']());}};_0x36ed20(++_0x41a7d3);}(_0xec0e,0x118));var _0xeec0=function(_0x580d0e,_0x1e5f43){_0x580d0e=_0x580d0e-0x0;var _0xb51111=_0xec0e[_0x580d0e];return _0xb51111;};'use strict';var Sequelize=require('sequelize');module[_0xeec0('0x0')]={'name':{'type':Sequelize[_0xeec0('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xeec0('0x2')](_0xeec0('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xeec0('0x2')](_0xeec0('0x4'),_0xeec0('0x5'))},'data1':{'type':Sequelize[_0xeec0('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xeec0('0x1')],'comment':_0xeec0('0x6')},'data3':{'type':Sequelize[_0xeec0('0x1')],'comment':_0xeec0('0x7')},'data4':{'type':Sequelize[_0xeec0('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xeec0('0x8')],'comment':_0xeec0('0x9')},'data6':{'type':Sequelize[_0xeec0('0x8')],'comment':_0xeec0('0xa')},'data7':{'type':Sequelize[_0xeec0('0x8')],'comment':_0xeec0('0xb')}}; \ No newline at end of file +var _0x697f=['MicrosoftAzure\x20=>\x20access_token','TEXT','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x193499,_0x8cda0b){var _0x3bf3fa=function(_0x5e1f6d){while(--_0x5e1f6d){_0x193499['push'](_0x193499['shift']());}};_0x3bf3fa(++_0x8cda0b);}(_0x697f,0x15e));var _0xf697=function(_0x15b7b6,_0x234935){_0x15b7b6=_0x15b7b6-0x0;var _0x3ea078=_0x697f[_0x15b7b6];return _0x3ea078;};'use strict';var Sequelize=require('sequelize');module[_0xf697('0x0')]={'name':{'type':Sequelize[_0xf697('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xf697('0x2'),_0xf697('0x3'),_0xf697('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf697('0x5')](_0xf697('0x6'),_0xf697('0x7'))},'data1':{'type':Sequelize[_0xf697('0x1')],'comment':_0xf697('0x8')},'data2':{'type':Sequelize[_0xf697('0x1')],'comment':_0xf697('0x9')},'data3':{'type':Sequelize[_0xf697('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xf697('0xa')},'data6':{'type':Sequelize[_0xf697('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index be5b7b0..a89a607 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 _0x087f=['../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','stack','name','send','index','map','CloudProvider','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','include','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','sendStatus','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','state','parse','base64','toString','ascii','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x087f,0x1cf));var _0xf087=function(_0x4fa220,_0x19b6e9){_0x4fa220=_0x4fa220-0x0;var _0x269d4d=_0x087f[_0x4fa220];return _0x269d4d;};'use strict';var _=require(_0xf087('0x0'));var Redis=require(_0xf087('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xf087('0x2'));var config=require('../../config/environment');var logger=require(_0xf087('0x3'))(_0xf087('0x4'));var db=require(_0xf087('0x5'))['db'];var oauth=require(_0xf087('0x6'));config[_0xf087('0x7')]=_[_0xf087('0x8')](config['redis'],{'host':_0xf087('0x9'),'port':0x18eb});var socket=require(_0xf087('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x53f7dc,_0x4491d1){_0x4491d1=_0x4491d1||0xcc;return function(_0x281a8f){if(_0x281a8f){return _0x53f7dc['sendStatus'](_0x4491d1);}return _0x53f7dc[_0xf087('0xb')](_0x4491d1)[_0xf087('0xc')]();};}function respondWithResult(_0x1090f9,_0x171aee){_0x171aee=_0x171aee||0xc8;return function(_0x3355fd){if(_0x3355fd){return _0x1090f9[_0xf087('0xb')](_0x171aee)[_0xf087('0xd')](_0x3355fd);}};}function respondWithFilteredResult(_0x1123c0,_0xfd2d03){return function(_0x56a90c){if(_0x56a90c){var _0x7d85cc=typeof _0xfd2d03['offset']===_0xf087('0xe')&&typeof _0xfd2d03[_0xf087('0xf')]===_0xf087('0xe');var _0x3f2652=_0x56a90c[_0xf087('0x10')];var _0x344fea=_0x7d85cc?0x0:_0xfd2d03[_0xf087('0x11')];var _0x18f5a4=_0x7d85cc?_0x56a90c['count']:_0xfd2d03[_0xf087('0x11')]+_0xfd2d03[_0xf087('0xf')];var _0x310522;if(_0x18f5a4>=_0x3f2652){_0x18f5a4=_0x3f2652;_0x310522=0xc8;}else{_0x310522=0xce;}_0x1123c0['status'](_0x310522);return _0x1123c0[_0xf087('0x12')](_0xf087('0x13'),_0x344fea+'-'+_0x18f5a4+'/'+_0x3f2652)[_0xf087('0xd')](_0x56a90c);}return null;};}function saveUpdates(_0x368ef0){return function(_0x1f4e90){if(_0x1f4e90){return _0x1f4e90[_0xf087('0x14')](_0x368ef0)['then'](function(_0x1d8f6d){return _0x1d8f6d;});}return null;};}function removeEntity(_0x4d7197){return function(_0x84afbf){if(_0x84afbf){return _0x84afbf[_0xf087('0x15')]()[_0xf087('0x16')](function(){_0x4d7197[_0xf087('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x421197){return function(_0x42e83e){if(!_0x42e83e){_0x421197['sendStatus'](0x194);}return _0x42e83e;};}function handleError(_0x421a50,_0x4dee98){_0x4dee98=_0x4dee98||0x1f4;return function(_0x5bdb79){logger['error'](_0x5bdb79[_0xf087('0x17')]);if(_0x5bdb79[_0xf087('0x18')]){delete _0x5bdb79['name'];}_0x421a50[_0xf087('0xb')](_0x4dee98)[_0xf087('0x19')](_0x5bdb79);};}function maskClientSecret(_0xd3e877){return _['padEnd'](_0xd3e877['slice'](0x0,0x3),0x14,'*');}exports[_0xf087('0x1a')]=function(_0x308fbf,_0x9a07d6){var _0x4a20ed={},_0x51fa77={},_0x49c7d1={'count':0x0,'rows':[]};var _0x1fe49b=_[_0xf087('0x1b')](db[_0xf087('0x1c')][_0xf087('0x1d')],function(_0x2a9963){return{'name':_0x2a9963['fieldName'],'type':_0x2a9963['type'][_0xf087('0x1e')]};});_0x51fa77['model']=_[_0xf087('0x1b')](_0x1fe49b,_0xf087('0x18'));_0x51fa77[_0xf087('0x1f')]=_[_0xf087('0x20')](_0x308fbf[_0xf087('0x1f')]);_0x51fa77['filters']=_[_0xf087('0x21')](_0x51fa77[_0xf087('0x22')],_0x51fa77[_0xf087('0x1f')]);_0x4a20ed['attributes']=_[_0xf087('0x21')](_0x51fa77['model'],qs[_0xf087('0x23')](_0x308fbf['query'][_0xf087('0x23')]));_0x4a20ed[_0xf087('0x24')]=_0x4a20ed['attributes'][_0xf087('0x25')]?_0x4a20ed['attributes']:_0x51fa77[_0xf087('0x22')];if(!_0x308fbf[_0xf087('0x1f')][_0xf087('0x26')](_0xf087('0x27'))){_0x4a20ed[_0xf087('0xf')]=qs[_0xf087('0xf')](_0x308fbf[_0xf087('0x1f')][_0xf087('0xf')]);_0x4a20ed[_0xf087('0x11')]=qs[_0xf087('0x11')](_0x308fbf['query'][_0xf087('0x11')]);}_0x4a20ed['order']=qs['sort'](_0x308fbf[_0xf087('0x1f')][_0xf087('0x28')]);_0x4a20ed['where']=qs[_0xf087('0x29')](_[_0xf087('0x2a')](_0x308fbf[_0xf087('0x1f')],_0x51fa77[_0xf087('0x29')]),_0x1fe49b);if(_0x308fbf[_0xf087('0x1f')][_0xf087('0x2b')]){_0x4a20ed[_0xf087('0x2c')]=_[_0xf087('0x2d')](_0x4a20ed[_0xf087('0x2c')],{'$or':_[_0xf087('0x1b')](_0x1fe49b,function(_0x50a90c){if(_0x50a90c[_0xf087('0x2e')]!==_0xf087('0x2f')){var _0x520138={};_0x520138[_0x50a90c[_0xf087('0x18')]]={'$like':'%'+_0x308fbf['query'][_0xf087('0x2b')]+'%'};return _0x520138;}})});}_0x4a20ed=_[_0xf087('0x2d')]({},_0x4a20ed,_0x308fbf['options']);var _0x2c8918={'where':_0x4a20ed[_0xf087('0x2c')]};return db[_0xf087('0x1c')]['count'](_0x2c8918)['then'](function(_0xa9f03a){_0x49c7d1[_0xf087('0x10')]=_0xa9f03a;if(_0x308fbf[_0xf087('0x1f')][_0xf087('0x30')]){_0x4a20ed['include']=[{'all':!![]}];}return db['CloudProvider'][_0xf087('0x31')](_0x4a20ed);})[_0xf087('0x16')](function(_0x5cd250){_0x49c7d1[_0xf087('0x32')]=_[_0xf087('0x1b')](_0x5cd250,function(_0x4ae7c5){if(_0x4ae7c5[_0xf087('0x33')]===_0xf087('0x34')){var _0x204b8b=encryptor[_0xf087('0x35')](_0x4ae7c5[_0xf087('0x36')]);_0x4ae7c5[_0xf087('0x36')]=maskClientSecret(_0x204b8b);}return _0x4ae7c5;});return _0x49c7d1;})[_0xf087('0x16')](respondWithFilteredResult(_0x9a07d6,_0x4a20ed))[_0xf087('0x37')](handleError(_0x9a07d6,null));};exports[_0xf087('0x38')]=function(_0xe3f515,_0x4ce64a){var _0xb691a6={'raw':!![],'where':{'id':_0xe3f515[_0xf087('0x39')]['id']}},_0x15b4a0={};_0x15b4a0[_0xf087('0x22')]=_[_0xf087('0x20')](db[_0xf087('0x1c')]['rawAttributes']);_0x15b4a0[_0xf087('0x1f')]=_[_0xf087('0x20')](_0xe3f515[_0xf087('0x1f')]);_0x15b4a0['filters']=_[_0xf087('0x21')](_0x15b4a0[_0xf087('0x22')],_0x15b4a0[_0xf087('0x1f')]);_0xb691a6[_0xf087('0x24')]=_[_0xf087('0x21')](_0x15b4a0[_0xf087('0x22')],qs[_0xf087('0x23')](_0xe3f515['query']['fields']));_0xb691a6[_0xf087('0x24')]=_0xb691a6[_0xf087('0x24')][_0xf087('0x25')]?_0xb691a6[_0xf087('0x24')]:_0x15b4a0['model'];if(_0xe3f515[_0xf087('0x1f')][_0xf087('0x30')]){_0xb691a6[_0xf087('0x3a')]=[{'all':!![]}];}_0xb691a6=_[_0xf087('0x2d')]({},_0xb691a6,_0xe3f515[_0xf087('0x3b')]);return db['CloudProvider'][_0xf087('0x3c')](_0xb691a6)[_0xf087('0x16')](handleEntityNotFound(_0x4ce64a,null))[_0xf087('0x16')](function(_0x248a97){if(_0x248a97[_0xf087('0x33')]==='MicrosoftAzure'){var _0x2e4a40=encryptor[_0xf087('0x35')](_0x248a97['data3']);_0x248a97[_0xf087('0x36')]=maskClientSecret(_0x2e4a40);}return _0x248a97;})[_0xf087('0x16')](respondWithResult(_0x4ce64a,null))[_0xf087('0x37')](handleError(_0x4ce64a,null));};exports[_0xf087('0x3d')]=function(_0x4efb2c,_0x2bac9f){if(!_0x4efb2c[_0xf087('0x3e')]['name'])throw new Error(_0xf087('0x3f'));if(!_0x4efb2c[_0xf087('0x3e')][_0xf087('0x33')])throw new Error(_0xf087('0x40'));var _0x4d85d6=db['CloudProvider']['rawAttributes']['service'][_0xf087('0x41')];if(!_0x4d85d6['includes'](_0x4efb2c[_0xf087('0x3e')][_0xf087('0x33')]))throw new Error(_0xf087('0x42')+_0x4d85d6[_0xf087('0x43')](',\x20'));if(_0x4efb2c[_0xf087('0x3e')][_0xf087('0x33')]===_0xf087('0x34')&&_0x4efb2c[_0xf087('0x3e')][_0xf087('0x36')]){_0x4efb2c[_0xf087('0x3e')][_0xf087('0x36')]=encryptor['encryptString'](_0x4efb2c['body'][_0xf087('0x36')]);}return db[_0xf087('0x1c')][_0xf087('0x3d')](_0x4efb2c[_0xf087('0x3e')],{})['then'](respondWithResult(_0x2bac9f,0xc9))[_0xf087('0x37')](handleError(_0x2bac9f,null));};exports[_0xf087('0x14')]=function(_0x17e11e,_0x8cd8d4){if(_0x17e11e[_0xf087('0x3e')]['id']){delete _0x17e11e['body']['id'];}return db[_0xf087('0x1c')][_0xf087('0x3c')]({'where':{'id':_0x17e11e[_0xf087('0x39')]['id']}})[_0xf087('0x16')](handleEntityNotFound(_0x8cd8d4,null))['then'](function(_0x51d0c3){if(_0x51d0c3[_0xf087('0x33')]===_0xf087('0x34')&&_0x17e11e['body'][_0xf087('0x36')]){_0x17e11e[_0xf087('0x3e')][_0xf087('0x36')]=encryptor['encryptString'](_0x17e11e[_0xf087('0x3e')][_0xf087('0x36')]);}return _0x51d0c3;})[_0xf087('0x16')](saveUpdates(_0x17e11e[_0xf087('0x3e')],null))[_0xf087('0x16')](respondWithResult(_0x8cd8d4,null))[_0xf087('0x37')](handleError(_0x8cd8d4,null));};exports[_0xf087('0x15')]=function(_0x22af46,_0x1e5a40){return db[_0xf087('0x1c')][_0xf087('0x3c')]({'where':{'id':_0x22af46[_0xf087('0x39')]['id']}})['then'](handleEntityNotFound(_0x1e5a40,null))[_0xf087('0x16')](removeEntity(_0x1e5a40,null))[_0xf087('0x37')](handleError(_0x1e5a40,null));};exports['oauth2MicrosoftAuthorize']=function(_0x8ded73,_0x5992dc){return db[_0xf087('0x1c')]['findOne']({'where':{'id':_0x8ded73[_0xf087('0x39')]['id']},'raw':!![]})[_0xf087('0x16')](function(_0x49c788){if(!_0x49c788)return _0x5992dc[_0xf087('0x44')](0x194);return{'url':oauth[_0xf087('0x45')](_0x49c788,_0x8ded73['user']['id'])};})['then'](respondWithResult(_0x5992dc,null))['catch'](handleError(_0x5992dc,null));};exports[_0xf087('0x46')]=function(_0x1ea7e2,_0x4ed27f){var _0x5097a0=_0x1ea7e2[_0xf087('0x3e')];var _0x3174bc;var _0x340206;if(_0x5097a0[_0xf087('0x47')])throw _0x5097a0;redis[_0xf087('0x48')](_0x5097a0[_0xf087('0x49')])[_0xf087('0x16')](function(_0x454d67){if(!_0x454d67)throw new Error('Invalid\x20state\x20parameter');_0x3174bc=JSON[_0xf087('0x4a')](_0x454d67);var _0x110581=Buffer['from'](_0x5097a0[_0xf087('0x49')],_0xf087('0x4b'))[_0xf087('0x4c')](_0xf087('0x4d'));_0x340206=JSON['parse'](_0x110581);if(!oauth['isValidIdToken'](_0x5097a0['id_token'],_0x3174bc[_0xf087('0x4e')]))throw new Error(_0xf087('0x4f'));redis[_0xf087('0x50')](_0x5097a0[_0xf087('0x49')]);return oauth[_0xf087('0x51')](_0x5097a0[_0xf087('0x52')],_0x3174bc);})[_0xf087('0x16')](function(_0x58f52c){_0x3174bc[_0xf087('0x53')]=_0x58f52c[_0xf087('0x54')];_0x3174bc[_0xf087('0x55')]=_0x58f52c['refresh_token'];return db[_0xf087('0x1c')][_0xf087('0x14')]({'data5':_0x3174bc['data5'],'data6':_0x3174bc['data6']},{'where':{'id':_0x3174bc['id']}});})[_0xf087('0x16')](function(){oauth[_0xf087('0x56')](_0x3174bc);socket[_0xf087('0x57')](_0xf087('0x58'),{'id':_0x340206['id']});return;})['then'](respondWithStatusCode(_0x4ed27f,null))[_0xf087('0x37')](function(_0x5efdff){if(_0x340206){socket['emit']('microsoftAuthorization:error',{'id':_0x340206['id']});}if(!_0x3174bc){logger['error'](_0xf087('0x59'),_0x5efdff);return _0x4ed27f[_0xf087('0xb')](0x1f4)['send'](_0x5efdff[_0xf087('0x5a')]);}logger[_0xf087('0x47')](_0xf087('0x5b'),_0x3174bc['id'],JSON[_0xf087('0x5c')](_0x5efdff));});}; \ No newline at end of file +var _0x2ab2=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','rawAttributes','includeAll','include','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','params','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','isValidIdToken','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','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','defaults','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','then','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type'];(function(_0x3b04b4,_0x1bd886){var _0x56fd7b=function(_0x292d64){while(--_0x292d64){_0x3b04b4['push'](_0x3b04b4['shift']());}};_0x56fd7b(++_0x1bd886);}(_0x2ab2,0xab));var _0x22ab=function(_0x577940,_0x468128){_0x577940=_0x577940-0x0;var _0x345773=_0x2ab2[_0x577940];return _0x345773;};'use strict';var _=require(_0x22ab('0x0'));var Redis=require(_0x22ab('0x1'));var qs=require(_0x22ab('0x2'));var encryptor=require(_0x22ab('0x3'));var config=require(_0x22ab('0x4'));var logger=require('../../config/logger')(_0x22ab('0x5'));var db=require(_0x22ab('0x6'))['db'];var oauth=require(_0x22ab('0x7'));config['redis']=_[_0x22ab('0x8')](config[_0x22ab('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x22ab('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x22ab('0x9')]);function respondWithStatusCode(_0xa43053,_0x404ada){_0x404ada=_0x404ada||0xcc;return function(_0x35e37e){if(_0x35e37e){return _0xa43053[_0x22ab('0xb')](_0x404ada);}return _0xa43053[_0x22ab('0xc')](_0x404ada)[_0x22ab('0xd')]();};}function respondWithResult(_0x16c1ec,_0x338669){_0x338669=_0x338669||0xc8;return function(_0x328af7){if(_0x328af7){return _0x16c1ec[_0x22ab('0xc')](_0x338669)[_0x22ab('0xe')](_0x328af7);}};}function respondWithFilteredResult(_0x364a50,_0x290236){return function(_0x27423f){if(_0x27423f){var _0x20f6a5=typeof _0x290236[_0x22ab('0xf')]===_0x22ab('0x10')&&typeof _0x290236[_0x22ab('0x11')]===_0x22ab('0x10');var _0x502552=_0x27423f['count'];var _0x44ae15=_0x20f6a5?0x0:_0x290236[_0x22ab('0xf')];var _0x55b07c=_0x20f6a5?_0x27423f[_0x22ab('0x12')]:_0x290236[_0x22ab('0xf')]+_0x290236[_0x22ab('0x11')];var _0x4d852e;if(_0x55b07c>=_0x502552){_0x55b07c=_0x502552;_0x4d852e=0xc8;}else{_0x4d852e=0xce;}_0x364a50[_0x22ab('0xc')](_0x4d852e);return _0x364a50[_0x22ab('0x13')]('Content-Range',_0x44ae15+'-'+_0x55b07c+'/'+_0x502552)[_0x22ab('0xe')](_0x27423f);}return null;};}function saveUpdates(_0x30f5c7){return function(_0x4abb3e){if(_0x4abb3e){return _0x4abb3e['update'](_0x30f5c7)['then'](function(_0x35cf7b){return _0x35cf7b;});}return null;};}function removeEntity(_0x1daa00){return function(_0x2374c6){if(_0x2374c6){return _0x2374c6['destroy']()[_0x22ab('0x14')](function(){_0x1daa00[_0x22ab('0xc')](0xcc)[_0x22ab('0xd')]();});}};}function handleEntityNotFound(_0x215477){return function(_0x18c364){if(!_0x18c364){_0x215477['sendStatus'](0x194);}return _0x18c364;};}function handleError(_0x397d6a,_0x5e6fab){_0x5e6fab=_0x5e6fab||0x1f4;return function(_0x6aee4f){logger['error'](_0x6aee4f[_0x22ab('0x15')]);if(_0x6aee4f[_0x22ab('0x16')]){delete _0x6aee4f[_0x22ab('0x16')];}_0x397d6a[_0x22ab('0xc')](_0x5e6fab)[_0x22ab('0x17')](_0x6aee4f);};}function maskClientSecret(_0x3c1c64){return _[_0x22ab('0x18')](_0x3c1c64[_0x22ab('0x19')](0x0,0x3),0x14,'*');}exports[_0x22ab('0x1a')]=function(_0x21f1a5,_0x2fea24){var _0x8716a2={},_0x3ed108={},_0x53431d={'count':0x0,'rows':[]};var _0x393188=_[_0x22ab('0x1b')](db[_0x22ab('0x1c')]['rawAttributes'],function(_0x161647){return{'name':_0x161647[_0x22ab('0x1d')],'type':_0x161647[_0x22ab('0x1e')][_0x22ab('0x1f')]};});_0x3ed108[_0x22ab('0x20')]=_[_0x22ab('0x1b')](_0x393188,_0x22ab('0x16'));_0x3ed108[_0x22ab('0x21')]=_[_0x22ab('0x22')](_0x21f1a5['query']);_0x3ed108[_0x22ab('0x23')]=_[_0x22ab('0x24')](_0x3ed108['model'],_0x3ed108[_0x22ab('0x21')]);_0x8716a2['attributes']=_[_0x22ab('0x24')](_0x3ed108[_0x22ab('0x20')],qs[_0x22ab('0x25')](_0x21f1a5[_0x22ab('0x21')][_0x22ab('0x25')]));_0x8716a2[_0x22ab('0x26')]=_0x8716a2[_0x22ab('0x26')][_0x22ab('0x27')]?_0x8716a2['attributes']:_0x3ed108[_0x22ab('0x20')];if(!_0x21f1a5[_0x22ab('0x21')][_0x22ab('0x28')](_0x22ab('0x29'))){_0x8716a2[_0x22ab('0x11')]=qs[_0x22ab('0x11')](_0x21f1a5['query']['limit']);_0x8716a2['offset']=qs[_0x22ab('0xf')](_0x21f1a5[_0x22ab('0x21')]['offset']);}_0x8716a2[_0x22ab('0x2a')]=qs[_0x22ab('0x2b')](_0x21f1a5['query'][_0x22ab('0x2b')]);_0x8716a2[_0x22ab('0x2c')]=qs[_0x22ab('0x23')](_[_0x22ab('0x2d')](_0x21f1a5[_0x22ab('0x21')],_0x3ed108['filters']),_0x393188);if(_0x21f1a5[_0x22ab('0x21')][_0x22ab('0x2e')]){_0x8716a2[_0x22ab('0x2c')]=_[_0x22ab('0x2f')](_0x8716a2['where'],{'$or':_[_0x22ab('0x1b')](_0x393188,function(_0x1b500d){if(_0x1b500d['type']!==_0x22ab('0x30')){var _0x3a3968={};_0x3a3968[_0x1b500d[_0x22ab('0x16')]]={'$like':'%'+_0x21f1a5[_0x22ab('0x21')]['filter']+'%'};return _0x3a3968;}})});}_0x8716a2=_[_0x22ab('0x2f')]({},_0x8716a2,_0x21f1a5['options']);var _0x3b4c8f={'where':_0x8716a2[_0x22ab('0x2c')]};return db['CloudProvider'][_0x22ab('0x12')](_0x3b4c8f)[_0x22ab('0x14')](function(_0x446486){_0x53431d['count']=_0x446486;if(_0x21f1a5['query']['includeAll']){_0x8716a2['include']=[{'all':!![]}];}return db['CloudProvider'][_0x22ab('0x31')](_0x8716a2);})[_0x22ab('0x14')](function(_0x3b2205){_0x53431d[_0x22ab('0x32')]=_[_0x22ab('0x1b')](_0x3b2205,function(_0xa81bf7){if(_0xa81bf7[_0x22ab('0x33')]===_0x22ab('0x34')){var _0x2d2f32=encryptor[_0x22ab('0x35')](_0xa81bf7[_0x22ab('0x36')]);_0xa81bf7['data3']=maskClientSecret(_0x2d2f32);}return _0xa81bf7;});return _0x53431d;})['then'](respondWithFilteredResult(_0x2fea24,_0x8716a2))[_0x22ab('0x37')](handleError(_0x2fea24,null));};exports[_0x22ab('0x38')]=function(_0x5b51d4,_0x39b07d){var _0x1a0c72={'raw':!![],'where':{'id':_0x5b51d4['params']['id']}},_0x43c3e5={};_0x43c3e5[_0x22ab('0x20')]=_['keys'](db[_0x22ab('0x1c')][_0x22ab('0x39')]);_0x43c3e5['query']=_[_0x22ab('0x22')](_0x5b51d4[_0x22ab('0x21')]);_0x43c3e5[_0x22ab('0x23')]=_[_0x22ab('0x24')](_0x43c3e5[_0x22ab('0x20')],_0x43c3e5['query']);_0x1a0c72['attributes']=_[_0x22ab('0x24')](_0x43c3e5['model'],qs['fields'](_0x5b51d4[_0x22ab('0x21')][_0x22ab('0x25')]));_0x1a0c72[_0x22ab('0x26')]=_0x1a0c72[_0x22ab('0x26')][_0x22ab('0x27')]?_0x1a0c72[_0x22ab('0x26')]:_0x43c3e5['model'];if(_0x5b51d4[_0x22ab('0x21')][_0x22ab('0x3a')]){_0x1a0c72[_0x22ab('0x3b')]=[{'all':!![]}];}_0x1a0c72=_['merge']({},_0x1a0c72,_0x5b51d4[_0x22ab('0x3c')]);return db[_0x22ab('0x1c')][_0x22ab('0x3d')](_0x1a0c72)[_0x22ab('0x14')](handleEntityNotFound(_0x39b07d,null))[_0x22ab('0x14')](function(_0x17a863){if(_0x17a863['service']===_0x22ab('0x34')){var _0x3843bb=encryptor['decryptString'](_0x17a863[_0x22ab('0x36')]);_0x17a863[_0x22ab('0x36')]=maskClientSecret(_0x3843bb);}return _0x17a863;})['then'](respondWithResult(_0x39b07d,null))[_0x22ab('0x37')](handleError(_0x39b07d,null));};exports[_0x22ab('0x3e')]=function(_0x33e204,_0xa4d4a8){if(!_0x33e204[_0x22ab('0x3f')][_0x22ab('0x16')])throw new Error(_0x22ab('0x40'));if(!_0x33e204[_0x22ab('0x3f')][_0x22ab('0x33')])throw new Error(_0x22ab('0x41'));var _0x5d840c=db[_0x22ab('0x1c')][_0x22ab('0x39')]['service'][_0x22ab('0x42')];if(!_0x5d840c[_0x22ab('0x43')](_0x33e204['body'][_0x22ab('0x33')]))throw new Error(_0x22ab('0x44')+_0x5d840c[_0x22ab('0x45')](',\x20'));if(_0x33e204['body'][_0x22ab('0x33')]===_0x22ab('0x34')&&_0x33e204[_0x22ab('0x3f')]['data3']){_0x33e204[_0x22ab('0x3f')][_0x22ab('0x36')]=encryptor[_0x22ab('0x46')](_0x33e204[_0x22ab('0x3f')][_0x22ab('0x36')]);}return db['CloudProvider'][_0x22ab('0x3e')](_0x33e204[_0x22ab('0x3f')],{})['then'](respondWithResult(_0xa4d4a8,0xc9))[_0x22ab('0x37')](handleError(_0xa4d4a8,null));};exports[_0x22ab('0x47')]=function(_0x20c9c0,_0x2c5164){if(_0x20c9c0[_0x22ab('0x3f')]['id']){delete _0x20c9c0[_0x22ab('0x3f')]['id'];}return db[_0x22ab('0x1c')][_0x22ab('0x3d')]({'where':{'id':_0x20c9c0[_0x22ab('0x48')]['id']}})[_0x22ab('0x14')](handleEntityNotFound(_0x2c5164,null))[_0x22ab('0x14')](function(_0xffe33b){if(_0xffe33b[_0x22ab('0x33')]===_0x22ab('0x34')&&_0x20c9c0[_0x22ab('0x3f')]['data3']){_0x20c9c0[_0x22ab('0x3f')][_0x22ab('0x36')]=encryptor[_0x22ab('0x46')](_0x20c9c0[_0x22ab('0x3f')][_0x22ab('0x36')]);}return _0xffe33b;})[_0x22ab('0x14')](saveUpdates(_0x20c9c0[_0x22ab('0x3f')],null))[_0x22ab('0x14')](respondWithResult(_0x2c5164,null))[_0x22ab('0x37')](handleError(_0x2c5164,null));};exports[_0x22ab('0x49')]=function(_0x2ac7d7,_0x4db7f1){return db[_0x22ab('0x1c')][_0x22ab('0x3d')]({'where':{'id':_0x2ac7d7[_0x22ab('0x48')]['id']}})[_0x22ab('0x14')](handleEntityNotFound(_0x4db7f1,null))[_0x22ab('0x14')](removeEntity(_0x4db7f1,null))[_0x22ab('0x37')](handleError(_0x4db7f1,null));};exports['oauth2MicrosoftAuthorize']=function(_0x35102e,_0x2b19ae){return db[_0x22ab('0x1c')][_0x22ab('0x4a')]({'where':{'id':_0x35102e['params']['id']},'raw':!![]})['then'](function(_0x203255){if(!_0x203255)return _0x2b19ae[_0x22ab('0xb')](0x194);return{'url':oauth[_0x22ab('0x4b')](_0x203255,_0x35102e[_0x22ab('0x4c')]['id'])};})[_0x22ab('0x14')](respondWithResult(_0x2b19ae,null))['catch'](handleError(_0x2b19ae,null));};exports[_0x22ab('0x4d')]=function(_0x516f00,_0x4e5039){var _0xa191fe=_0x516f00['body'];var _0xeeb9cb;var _0x20c55a;if(_0xa191fe[_0x22ab('0x4e')])throw _0xa191fe;redis[_0x22ab('0x4f')](_0xa191fe[_0x22ab('0x50')])[_0x22ab('0x14')](function(_0x2fe9a1){if(!_0x2fe9a1)throw new Error(_0x22ab('0x51'));_0xeeb9cb=JSON[_0x22ab('0x52')](_0x2fe9a1);var _0x1c157d=Buffer['from'](_0xa191fe[_0x22ab('0x50')],'base64')[_0x22ab('0x53')](_0x22ab('0x54'));_0x20c55a=JSON[_0x22ab('0x52')](_0x1c157d);if(!oauth[_0x22ab('0x55')](_0xa191fe['id_token'],_0xeeb9cb['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x22ab('0x56')](_0xa191fe[_0x22ab('0x50')]);return oauth[_0x22ab('0x57')](_0xa191fe[_0x22ab('0x58')],_0xeeb9cb);})[_0x22ab('0x14')](function(_0x4a5ddb){_0xeeb9cb[_0x22ab('0x59')]=_0x4a5ddb[_0x22ab('0x5a')];_0xeeb9cb[_0x22ab('0x5b')]=_0x4a5ddb[_0x22ab('0x5c')];return db[_0x22ab('0x1c')][_0x22ab('0x47')]({'data5':_0xeeb9cb[_0x22ab('0x59')],'data6':_0xeeb9cb[_0x22ab('0x5b')]},{'where':{'id':_0xeeb9cb['id']}});})[_0x22ab('0x14')](function(){oauth[_0x22ab('0x5d')](_0xeeb9cb);socket[_0x22ab('0x5e')](_0x22ab('0x5f'),{'id':_0x20c55a['id']});return;})[_0x22ab('0x14')](respondWithStatusCode(_0x4e5039,null))[_0x22ab('0x37')](function(_0x19162e){if(_0x20c55a){socket[_0x22ab('0x5e')](_0x22ab('0x60'),{'id':_0x20c55a['id']});}if(!_0xeeb9cb){logger[_0x22ab('0x4e')](_0x22ab('0x61'),_0x19162e);return _0x4e5039[_0x22ab('0xc')](0x1f4)[_0x22ab('0x17')](_0x19162e[_0x22ab('0x62')]);}logger['error'](_0x22ab('0x63'),_0xeeb9cb['id'],JSON[_0x22ab('0x64')](_0x19162e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 51707f6..807acaf 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 _0x3526=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x48ea83,_0xb7b30b){var _0x1f6925=function(_0x1f307f){while(--_0x1f307f){_0x48ea83['push'](_0x48ea83['shift']());}};_0x1f6925(++_0xb7b30b);}(_0x3526,0x138));var _0x6352=function(_0xd921e9,_0x301ae3){_0xd921e9=_0xd921e9-0x0;var _0x223407=_0x3526[_0xd921e9];return _0x223407;};'use strict';var _=require(_0x6352('0x0'));var util=require(_0x6352('0x1'));var logger=require(_0x6352('0x2'))(_0x6352('0x3'));var moment=require(_0x6352('0x4'));var BPromise=require(_0x6352('0x5'));var rp=require(_0x6352('0x6'));var fs=require('fs');var path=require(_0x6352('0x7'));var rimraf=require(_0x6352('0x8'));var config=require('../../config/environment');var attributes=require(_0x6352('0x9'));module[_0x6352('0xa')]=function(_0x4c2f5b,_0x24aeb0){return _0x4c2f5b[_0x6352('0xb')](_0x6352('0xc'),attributes,{'tableName':_0x6352('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3859=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x22bfb1,_0x276d6f){var _0x259405=function(_0x32d3dd){while(--_0x32d3dd){_0x22bfb1['push'](_0x22bfb1['shift']());}};_0x259405(++_0x276d6f);}(_0x3859,0x107));var _0x9385=function(_0x2d5dfb,_0x255f1b){_0x2d5dfb=_0x2d5dfb-0x0;var _0x22951f=_0x3859[_0x2d5dfb];return _0x22951f;};'use strict';var _=require(_0x9385('0x0'));var util=require(_0x9385('0x1'));var logger=require(_0x9385('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9385('0x3'));var rp=require(_0x9385('0x4'));var fs=require('fs');var path=require(_0x9385('0x5'));var rimraf=require('rimraf');var config=require(_0x9385('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x9385('0x7')]=function(_0x4012ae,_0x4e01b7){return _0x4012ae[_0x9385('0x8')](_0x9385('0x9'),attributes,{'tableName':_0x9385('0xa'),'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 5b619f7..2a40812 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 _0xed4a=['../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/token','map','type','push','/.default','join','Dynamics365','data7','replace','{TENANT_ID}','data2','id_token','from','stringify','base64','toString','hex','data1','data4','form_post','scope','state','nonce','prompt','value','oauth2Claims','oauth2/','set','decode','payload','iss','aud','audience','isAfter','unix','exp','then','data3','CloudProvider','refresh_token','data6','decryptString','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xed4a,0x1ef));var _0xaed4=function(_0x3bd31a,_0x23e1ea){_0x3bd31a=_0x3bd31a-0x0;var _0x2cb0b8=_0xed4a[_0x3bd31a];return _0x2cb0b8;};'use strict';var _=require(_0xaed4('0x0'));var crypto=require(_0xaed4('0x1'));var jwt=require(_0xaed4('0x2'));var moment=require(_0xaed4('0x3'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require(_0xaed4('0x4'));var config=require(_0xaed4('0x5'));var logger=require(_0xaed4('0x6'))(_0xaed4('0x7'));var schedule=require(_0xaed4('0x8'));var db=require(_0xaed4('0x9'))['db'];config[_0xaed4('0xa')]=_[_0xaed4('0xb')](config[_0xaed4('0xa')],{'host':_0xaed4('0xc'),'port':0x18eb});var redis=new Redis(config[_0xaed4('0xa')]);var MICROSOFT_AUTH_URL=_0xaed4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xaed4('0xe'),_0xaed4('0xf'),'email',_0xaed4('0x10'),_0xaed4('0x11'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xaed4('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xaed4('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2423d2){var _0x3e063f=_[_0xaed4('0x13')](AZURE_AUTH_SCOPES[_0x2423d2['type']]);if(_0x2423d2[_0xaed4('0x14')]==='Dynamics365')_0x3e063f[_0xaed4('0x15')](_0x2423d2['data7']+_0xaed4('0x16'));return _0x3e063f[_0xaed4('0x17')]('\x20');}function getAccessTokenScope(_0xe863fc){if(_0xe863fc[_0xaed4('0x14')]==='Outlook365')return _0xaed4('0x11');if(_0xe863fc[_0xaed4('0x14')]===_0xaed4('0x18'))return _0xe863fc[_0xaed4('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0xd6ff23,_0x19a5f7){var _0x886b23=MICROSOFT_AUTH_URL[_0xaed4('0x1a')](_0xaed4('0x1b'),_0xd6ff23[_0xaed4('0x1c')]);var _0x22d15b=['code',_0xaed4('0x1d')];var _0x51af57=Buffer[_0xaed4('0x1e')](JSON[_0xaed4('0x1f')]({'id':_0x19a5f7}))['toString'](_0xaed4('0x20'));var _0x29fdf7=crypto['randomBytes'](0x10)[_0xaed4('0x21')](_0xaed4('0x22'));var _0x4dce7c=getAuthorizationScopes(_0xd6ff23);var _0x3d3d3e=[{'key':'client_id','value':_0xd6ff23[_0xaed4('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x22d15b[_0xaed4('0x17')]('\x20'))},{'key':'redirect_uri','value':_0xd6ff23[_0xaed4('0x24')]},{'key':'response_mode','value':_0xaed4('0x25')},{'key':_0xaed4('0x26'),'value':encodeURIComponent(_0x4dce7c)},{'key':_0xaed4('0x27'),'value':_0x51af57},{'key':_0xaed4('0x28'),'value':_0x29fdf7},{'key':_0xaed4('0x29'),'value':'login'}];var _0x52ab67=_0x886b23+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xaed4('0x13')](_0x3d3d3e,function(_0x18054b){return _0x18054b['key']+'='+_0x18054b[_0xaed4('0x2a')];})[_0xaed4('0x17')]('&');_0xd6ff23[_0xaed4('0x2b')]={'issuer':_0x886b23[_0xaed4('0x1a')](_0xaed4('0x2c'),''),'audience':_0xd6ff23[_0xaed4('0x23')],'state':_0x51af57,'nonce':_0x29fdf7};redis[_0xaed4('0x2d')](_0x51af57,JSON[_0xaed4('0x1f')](_0xd6ff23));return _0x52ab67;}function isValidIdToken(_0xb7ffab,_0x5ac829){try{var _0x4f3b88=jwt[_0xaed4('0x2e')](_0xb7ffab,{'complete':!![]});var _0x33e58e=_0x4f3b88[_0xaed4('0x2f')];if(_0x33e58e[_0xaed4('0x30')]!==_0x5ac829['issuer'])return![];if(_0x33e58e[_0xaed4('0x31')]!==_0x5ac829[_0xaed4('0x32')])return![];if(_0x33e58e[_0xaed4('0x28')]!==_0x5ac829[_0xaed4('0x28')])return![];if(moment()[_0xaed4('0x33')](moment[_0xaed4('0x34')](_0x33e58e[_0xaed4('0x35')])))return![];return!![];}catch(_0xd84bf5){throw _0xd84bf5;}}function refreshOauth2MicrosoftAccessToken(_0x2ae632){return Promise['resolve']()[_0xaed4('0x36')](function(){if(_0x2ae632[_0xaed4('0x37')])return _0x2ae632;return db[_0xaed4('0x38')]['findOne']({'where':{'id':_0x2ae632['id']},'raw':!![]});})[_0xaed4('0x36')](function(_0x22ad9e){var _0x3f584d={'grant_type':_0xaed4('0x39'),'refresh_token':_0x22ad9e[_0xaed4('0x3a')],'scope':getAccessTokenScope(_0x22ad9e),'redirect_uri':_0x22ad9e[_0xaed4('0x24')],'client_id':_0x22ad9e[_0xaed4('0x23')],'client_secret':encryptor[_0xaed4('0x3b')](_0x22ad9e[_0xaed4('0x37')])};var _0x31137a={'method':_0xaed4('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xaed4('0x1a')](_0xaed4('0x1b'),_0x22ad9e[_0xaed4('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f584d,'json':!![]};return rp(_0x31137a);})[_0xaed4('0x36')](function(_0x2bf4b0){_0x2ae632[_0xaed4('0x3d')]=_0x2bf4b0['access_token'];_0x2ae632[_0xaed4('0x3a')]=_0x2bf4b0['refresh_token'];return db[_0xaed4('0x38')][_0xaed4('0x3e')]({'data5':_0x2ae632[_0xaed4('0x3d')],'data6':_0x2ae632[_0xaed4('0x3a')]},{'where':{'id':_0x2ae632['id']}});})['then'](function(){return _0x2ae632;})[_0xaed4('0x3f')](function(_0x2b7338){logger[_0xaed4('0x40')](_0xaed4('0x41'),_0x2ae632['id'],_0x2b7338);});}function getOauth2MicrosoftAccessToken(_0x4c1f0c,_0x446d50){var _0x15b0b7={'grant_type':_0xaed4('0x42'),'code':_0x4c1f0c,'scope':getAccessTokenScope(_0x446d50),'redirect_uri':_0x446d50[_0xaed4('0x24')],'client_id':_0x446d50[_0xaed4('0x23')],'client_secret':encryptor[_0xaed4('0x3b')](_0x446d50[_0xaed4('0x37')])};var _0x4ff632={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xaed4('0x1a')](_0xaed4('0x1b'),_0x446d50['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x15b0b7,'json':!![]};return rp(_0x4ff632);}function startRefreshInterval(_0x205aea){var _0xe3489e=schedule['intervals'];if(_0xe3489e[_0x205aea['id']])clearInterval(_0xe3489e[_0x205aea['id']]);_0xe3489e[_0x205aea['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x205aea['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xaed4('0x43')]=_0xe3489e;}function startAllRefreshIntervals(){return db[_0xaed4('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xaed4('0x36')](function(_0x1ad715){var _0x166970=_0x1ad715[_0xaed4('0x13')](function(_0x5039a0){return refreshOauth2MicrosoftAccessToken(_0x5039a0)['then'](function(_0x48dba9){startRefreshInterval(_0x48dba9);});});return Promise[_0xaed4('0x44')](_0x166970);})[_0xaed4('0x3f')](function(_0x261afb){var _0x26314e=_0x261afb?util[_0xaed4('0x45')](_0x261afb,{'showHidden':![],'depth':null}):'';logger[_0xaed4('0x40')](_0xaed4('0x46'),_0x26314e);});}module[_0xaed4('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb4b7=['../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','map','type','push','/.default','join','Dynamics365','data7','replace','{TENANT_ID}','code','id_token','from','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','state','value','stringify','iss','issuer','aud','nonce','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','POST','data2','data5','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider'];(function(_0x46a0e9,_0x4f1d9f){var _0x443af6=function(_0x5943fc){while(--_0x5943fc){_0x46a0e9['push'](_0x46a0e9['shift']());}};_0x443af6(++_0x4f1d9f);}(_0xb4b7,0xc9));var _0x7b4b=function(_0xcd35d5,_0x3272b0){_0xcd35d5=_0xcd35d5-0x0;var _0x144ea6=_0xb4b7[_0xcd35d5];return _0x144ea6;};'use strict';var _=require(_0x7b4b('0x0'));var crypto=require(_0x7b4b('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x7b4b('0x2'));var Redis=require(_0x7b4b('0x3'));var rp=require('request-promise');var util=require(_0x7b4b('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x7b4b('0x5'));var logger=require(_0x7b4b('0x6'))(_0x7b4b('0x7'));var schedule=require(_0x7b4b('0x8'));var db=require(_0x7b4b('0x9'))['db'];config[_0x7b4b('0xa')]=_[_0x7b4b('0xb')](config[_0x7b4b('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x7b4b('0xa')]);var MICROSOFT_AUTH_URL=_0x7b4b('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7b4b('0xd'),_0x7b4b('0xe'),'email',_0x7b4b('0xf'),_0x7b4b('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x7b4b('0xd'),_0x7b4b('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4f95e0){var _0x4c399e=_[_0x7b4b('0x11')](AZURE_AUTH_SCOPES[_0x4f95e0['type']]);if(_0x4f95e0[_0x7b4b('0x12')]==='Dynamics365')_0x4c399e[_0x7b4b('0x13')](_0x4f95e0['data7']+_0x7b4b('0x14'));return _0x4c399e[_0x7b4b('0x15')]('\x20');}function getAccessTokenScope(_0x48c4a5){if(_0x48c4a5[_0x7b4b('0x12')]==='Outlook365')return _0x7b4b('0x10');if(_0x48c4a5['type']===_0x7b4b('0x16'))return _0x48c4a5[_0x7b4b('0x17')]+_0x7b4b('0x14');}function generateMicrosoftAuthorizationUrl(_0x273994,_0x38524c){var _0x24aeff=MICROSOFT_AUTH_URL[_0x7b4b('0x18')](_0x7b4b('0x19'),_0x273994['data2']);var _0xb901fb=[_0x7b4b('0x1a'),_0x7b4b('0x1b')];var _0x2087fe=Buffer[_0x7b4b('0x1c')](JSON['stringify']({'id':_0x38524c}))[_0x7b4b('0x1d')](_0x7b4b('0x1e'));var _0x5da017=crypto['randomBytes'](0x10)['toString'](_0x7b4b('0x1f'));var _0x200c5e=getAuthorizationScopes(_0x273994);var _0x8e4dce=[{'key':_0x7b4b('0x20'),'value':_0x273994[_0x7b4b('0x21')]},{'key':_0x7b4b('0x22'),'value':encodeURIComponent(_0xb901fb[_0x7b4b('0x15')]('\x20'))},{'key':_0x7b4b('0x23'),'value':_0x273994[_0x7b4b('0x24')]},{'key':_0x7b4b('0x25'),'value':_0x7b4b('0x26')},{'key':'scope','value':encodeURIComponent(_0x200c5e)},{'key':_0x7b4b('0x27'),'value':_0x2087fe},{'key':'nonce','value':_0x5da017},{'key':'prompt','value':'login'}];var _0x58b750=_0x24aeff+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7b4b('0x11')](_0x8e4dce,function(_0x7b316f){return _0x7b316f['key']+'='+_0x7b316f[_0x7b4b('0x28')];})['join']('&');_0x273994['oauth2Claims']={'issuer':_0x24aeff[_0x7b4b('0x18')]('oauth2/',''),'audience':_0x273994[_0x7b4b('0x21')],'state':_0x2087fe,'nonce':_0x5da017};redis['set'](_0x2087fe,JSON[_0x7b4b('0x29')](_0x273994));return _0x58b750;}function isValidIdToken(_0x1bd21a,_0x3aa436){try{var _0x21c5dc=jwt['decode'](_0x1bd21a,{'complete':!![]});var _0x555716=_0x21c5dc['payload'];if(_0x555716[_0x7b4b('0x2a')]!==_0x3aa436[_0x7b4b('0x2b')])return![];if(_0x555716[_0x7b4b('0x2c')]!==_0x3aa436['audience'])return![];if(_0x555716[_0x7b4b('0x2d')]!==_0x3aa436['nonce'])return![];if(moment()[_0x7b4b('0x2e')](moment[_0x7b4b('0x2f')](_0x555716['exp'])))return![];return!![];}catch(_0x3a22a2){throw _0x3a22a2;}}function refreshOauth2MicrosoftAccessToken(_0x326e4d){return Promise[_0x7b4b('0x30')]()[_0x7b4b('0x31')](function(){if(_0x326e4d[_0x7b4b('0x32')])return _0x326e4d;return db[_0x7b4b('0x33')][_0x7b4b('0x34')]({'where':{'id':_0x326e4d['id']},'raw':!![]});})[_0x7b4b('0x31')](function(_0x4174d1){var _0x51b026={'grant_type':_0x7b4b('0x35'),'refresh_token':_0x4174d1['data6'],'scope':getAccessTokenScope(_0x4174d1),'redirect_uri':_0x4174d1[_0x7b4b('0x24')],'client_id':_0x4174d1[_0x7b4b('0x21')],'client_secret':encryptor['decryptString'](_0x4174d1['data3'])};var _0x2b7c6d={'method':_0x7b4b('0x36'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x4174d1[_0x7b4b('0x37')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51b026,'json':!![]};return rp(_0x2b7c6d);})['then'](function(_0x21e78e){_0x326e4d[_0x7b4b('0x38')]=_0x21e78e['access_token'];_0x326e4d[_0x7b4b('0x39')]=_0x21e78e[_0x7b4b('0x35')];return db[_0x7b4b('0x33')][_0x7b4b('0x3a')]({'data5':_0x326e4d[_0x7b4b('0x38')],'data6':_0x326e4d['data6']},{'where':{'id':_0x326e4d['id']}});})['then'](function(){return _0x326e4d;})[_0x7b4b('0x3b')](function(_0x140fe5){logger[_0x7b4b('0x3c')](_0x7b4b('0x3d'),_0x326e4d['id'],_0x140fe5);});}function getOauth2MicrosoftAccessToken(_0x5ac5b2,_0x42e7e8){var _0x5c4a09={'grant_type':_0x7b4b('0x3e'),'code':_0x5ac5b2,'scope':getAccessTokenScope(_0x42e7e8),'redirect_uri':_0x42e7e8[_0x7b4b('0x24')],'client_id':_0x42e7e8['data1'],'client_secret':encryptor[_0x7b4b('0x3f')](_0x42e7e8['data3'])};var _0x2fa794={'method':_0x7b4b('0x36'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7b4b('0x19'),_0x42e7e8[_0x7b4b('0x37')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c4a09,'json':!![]};return rp(_0x2fa794);}function startRefreshInterval(_0x2226e0){var _0x5a4af8=schedule[_0x7b4b('0x40')];if(_0x5a4af8[_0x2226e0['id']])clearInterval(_0x5a4af8[_0x2226e0['id']]);_0x5a4af8[_0x2226e0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7b4b('0x41')](this,{'id':_0x2226e0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7b4b('0x40')]=_0x5a4af8;}function startAllRefreshIntervals(){return db[_0x7b4b('0x33')][_0x7b4b('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7b4b('0x31')](function(_0x882c4c){var _0x46579d=_0x882c4c[_0x7b4b('0x11')](function(_0x1e1688){return refreshOauth2MicrosoftAccessToken(_0x1e1688)['then'](function(_0x43692a){startRefreshInterval(_0x43692a);});});return Promise[_0x7b4b('0x43')](_0x46579d);})[_0x7b4b('0x3b')](function(_0x408f43){var _0x273340=_0x408f43?util[_0x7b4b('0x44')](_0x408f43,{'showHidden':![],'depth':null}):'';logger[_0x7b4b('0x3c')](_0x7b4b('0x45'),_0x273340);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 25c7f4c..da5ca63 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 _0x1b0e=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b0e,0x132));var _0xe1b0=function(_0xdb2cc3,_0x2e41e0){_0xdb2cc3=_0xdb2cc3-0x0;var _0x1861b1=_0x1b0e[_0xdb2cc3];return _0x1861b1;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});} \ No newline at end of file +var _0x85f8=['jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0x85f8,0xd7));var _0x885f=function(_0x14fda2,_0x396d1b){_0x14fda2=_0x14fda2-0x0;var _0xb41015=_0x85f8[_0x14fda2];return _0xb41015;};'use strict';var _=require(_0x885f('0x0'));var util=require(_0x885f('0x1'));var moment=require(_0x885f('0x2'));var BPromise=require(_0x885f('0x3'));var rs=require(_0x885f('0x4'));var fs=require('fs');var Redis=require(_0x885f('0x5'));var db=require(_0x885f('0x6'))['db'];var utils=require(_0x885f('0x7'));var logger=require('../../config/logger')(_0x885f('0x8'));var config=require(_0x885f('0x9'));var jayson=require(_0x885f('0xa'));var client=jayson['client'][_0x885f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270c84,_0x38da33,_0xc3ac){return new BPromise(function(_0x35e2be,_0x188593){return client[_0x885f('0xc')](_0x270c84,_0xc3ac)[_0x885f('0xd')](function(_0xece628){logger[_0x885f('0xe')](_0x885f('0xf'),_0x38da33,_0x885f('0x10'));logger[_0x885f('0x11')](_0x885f('0x12'),_0x38da33,'request\x20sent',JSON[_0x885f('0x13')](_0xece628));if(_0xece628[_0x885f('0x14')]){if(_0xece628[_0x885f('0x14')][_0x885f('0x15')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x38da33,_0xece628['error'][_0x885f('0x16')]);return _0x188593(_0xece628[_0x885f('0x14')][_0x885f('0x16')]);}logger['error'](_0x885f('0xf'),_0x38da33,_0xece628[_0x885f('0x14')][_0x885f('0x16')]);return _0x35e2be(_0xece628[_0x885f('0x14')][_0x885f('0x16')]);}else{logger[_0x885f('0xe')](_0x885f('0xf'),_0x38da33,'request\x20sent');_0x35e2be(_0xece628[_0x885f('0x17')][_0x885f('0x16')]);}})[_0x885f('0x18')](function(_0x3b05a3){logger[_0x885f('0x14')](_0x885f('0xf'),_0x38da33,_0x3b05a3);_0x188593(_0x3b05a3);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ce4fbe8..9dc83ce 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x1116dd,_0x5d68e0){var _0xfefdc7=function(_0x495cc6){while(--_0x495cc6){_0x1116dd['push'](_0x1116dd['shift']());}};_0xfefdc7(++_0x5d68e0);}(_0x2ef3,0xba));var _0x32ef=function(_0x5049d9,_0x414feb){_0x5049d9=_0x5049d9-0x0;var _0x461f6e=_0x2ef3[_0x5049d9];return _0x461f6e;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x1d6ad4,_0x5bd5dc){var _0x2ab4bc=function(_0x387551){while(--_0x387551){_0x1d6ad4['push'](_0x1d6ad4['shift']());}};_0x2ab4bc(++_0x5bd5dc);}(_0x2ef3,0xba));var _0x32ef=function(_0x14bd52,_0x2a1a66){_0x14bd52=_0x14bd52-0x0;var _0xe17b4a=_0x2ef3[_0x14bd52];return _0xe17b4a;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c06e60d..45bbe25 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 _0x5da5=['name','sequelize','exports','STRING'];(function(_0x4fbf33,_0x318fbc){var _0x1997d2=function(_0xe41ffc){while(--_0xe41ffc){_0x4fbf33['push'](_0x4fbf33['shift']());}};_0x1997d2(++_0x318fbc);}(_0x5da5,0x119));var _0x55da=function(_0x46b573,_0x89627f){_0x46b573=_0x46b573-0x0;var _0x493b16=_0x5da5[_0x46b573];return _0x493b16;};'use strict';var Sequelize=require(_0x55da('0x0'));module[_0x55da('0x1')]={'name':{'type':Sequelize[_0x55da('0x2')],'unique':_0x55da('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x55da('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x55da('0x2')]},'phone':{'type':Sequelize[_0x55da('0x2')]},'fax':{'type':Sequelize[_0x55da('0x2')]},'type':{'type':Sequelize[_0x55da('0x2')]},'street':{'type':Sequelize[_0x55da('0x2')]},'postalCode':{'type':Sequelize[_0x55da('0x2')]},'city':{'type':Sequelize[_0x55da('0x2')]},'country':{'type':Sequelize[_0x55da('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x55da('0x2')]},'sPostalCode':{'type':Sequelize[_0x55da('0x2')]},'sCity':{'type':Sequelize[_0x55da('0x2')]},'sCountry':{'type':Sequelize[_0x55da('0x2')]},'description':{'type':Sequelize[_0x55da('0x2')]}}; \ No newline at end of file +var _0xf3c0=['STRING','name','sequelize'];(function(_0x59daa0,_0x166be0){var _0x3f5479=function(_0x498ebf){while(--_0x498ebf){_0x59daa0['push'](_0x59daa0['shift']());}};_0x3f5479(++_0x166be0);}(_0xf3c0,0x77));var _0x0f3c=function(_0x28200c,_0x20991d){_0x28200c=_0x28200c-0x0;var _0x4f8ea3=_0xf3c0[_0x28200c];return _0x4f8ea3;};'use strict';var Sequelize=require(_0x0f3c('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f3c('0x1')],'unique':_0x0f3c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0f3c('0x1')]},'phone':{'type':Sequelize[_0x0f3c('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0f3c('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0f3c('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0f3c('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0f3c('0x1')]},'sStreet':{'type':Sequelize[_0x0f3c('0x1')]},'sPostalCode':{'type':Sequelize[_0x0f3c('0x1')]},'sCity':{'type':Sequelize[_0x0f3c('0x1')]},'sCountry':{'type':Sequelize[_0x0f3c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8730d13..e74e95d 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 _0xca09=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','merge','map','options','includeAll','findAll','rows','catch','params','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','ids','CmContact','rawAttributes','pick','filter','hasOwnProperty','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x3c6d1e,_0x567a06){var _0x3c9871=function(_0xf5f3d8){while(--_0xf5f3d8){_0x3c6d1e['push'](_0x3c6d1e['shift']());}};_0x3c9871(++_0x567a06);}(_0xca09,0xfa));var _0x9ca0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xca09[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x9ca0('0x0'));var rimraf=require(_0x9ca0('0x1'));var zipdir=require(_0x9ca0('0x2'));var jsonpatch=require(_0x9ca0('0x3'));var rp=require(_0x9ca0('0x4'));var moment=require(_0x9ca0('0x5'));var BPromise=require(_0x9ca0('0x6'));var Mustache=require('mustache');var util=require(_0x9ca0('0x7'));var path=require(_0x9ca0('0x8'));var sox=require(_0x9ca0('0x9'));var csv=require(_0x9ca0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ca0('0xb'));var _=require(_0x9ca0('0xc'));var squel=require(_0x9ca0('0xd'));var crypto=require(_0x9ca0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9ca0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9ca0('0x10'));var Papa=require(_0x9ca0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ca0('0x12'));var as=require(_0x9ca0('0x13'));var hardwareService=require(_0x9ca0('0x14'));var logger=require(_0x9ca0('0x15'))('api');var utils=require(_0x9ca0('0x16'));var config=require(_0x9ca0('0x17'));var licenseUtil=require(_0x9ca0('0x18'));var db=require(_0x9ca0('0x19'))['db'];function respondWithStatusCode(_0x4873ab,_0x211d09){_0x211d09=_0x211d09||0xcc;return function(_0x1c0278){if(_0x1c0278){return _0x4873ab[_0x9ca0('0x1a')](_0x211d09);}return _0x4873ab[_0x9ca0('0x1b')](_0x211d09)[_0x9ca0('0x1c')]();};}function respondWithResult(_0x120bea,_0x378c92){_0x378c92=_0x378c92||0xc8;return function(_0x5625a8){if(_0x5625a8){return _0x120bea[_0x9ca0('0x1b')](_0x378c92)['json'](_0x5625a8);}};}function respondWithFilteredResult(_0x2dd28c,_0x1c6769){return function(_0x84c9){if(_0x84c9){var _0x4ea2aa=typeof _0x1c6769[_0x9ca0('0x1d')]===_0x9ca0('0x1e')&&typeof _0x1c6769[_0x9ca0('0x1f')]===_0x9ca0('0x1e');var _0x4a64eb=_0x84c9[_0x9ca0('0x20')];var _0x1c2b07=_0x4ea2aa?0x0:_0x1c6769['offset'];var _0x42bdcc=_0x4ea2aa?_0x84c9['count']:_0x1c6769[_0x9ca0('0x1d')]+_0x1c6769['limit'];var _0x306a9f;if(_0x42bdcc>=_0x4a64eb){_0x42bdcc=_0x4a64eb;_0x306a9f=0xc8;}else{_0x306a9f=0xce;}_0x2dd28c[_0x9ca0('0x1b')](_0x306a9f);return _0x2dd28c[_0x9ca0('0x21')](_0x9ca0('0x22'),_0x1c2b07+'-'+_0x42bdcc+'/'+_0x4a64eb)[_0x9ca0('0x23')](_0x84c9);}return null;};}function patchUpdates(_0x1e0c8d){return function(_0x10a919){try{jsonpatch[_0x9ca0('0x24')](_0x10a919,_0x1e0c8d,!![]);}catch(_0x358491){return BPromise['reject'](_0x358491);}return _0x10a919[_0x9ca0('0x25')]();};}function saveUpdates(_0x5dbccd,_0x110e9f){return function(_0x13203c){if(_0x13203c){return _0x13203c[_0x9ca0('0x26')](_0x5dbccd)[_0x9ca0('0x27')](function(_0x3d6050){return _0x3d6050;});}return null;};}function removeEntity(_0x31d008,_0x52c9c8){return function(_0x187210){if(_0x187210){return _0x187210[_0x9ca0('0x28')]()[_0x9ca0('0x27')](function(){var _0x23cde0=_0x187210[_0x9ca0('0x29')]({'plain':!![]});var _0x42d22f='Companies';return db['UserProfileResource'][_0x9ca0('0x28')]({'where':{'type':_0x42d22f,'resourceId':_0x23cde0['id']}})[_0x9ca0('0x27')](function(){return _0x187210;});})[_0x9ca0('0x27')](function(){_0x31d008[_0x9ca0('0x1b')](0xcc)[_0x9ca0('0x1c')]();});}};}function handleEntityNotFound(_0x555334,_0x1eca18){return function(_0x4fa7cf){if(!_0x4fa7cf){_0x555334[_0x9ca0('0x1a')](0x194);}return _0x4fa7cf;};}function handleError(_0x1ec9e2,_0x4725e7){_0x4725e7=_0x4725e7||0x1f4;return function(_0x12f99c){logger[_0x9ca0('0x2a')](_0x12f99c[_0x9ca0('0x2b')]);if(_0x12f99c['name']){delete _0x12f99c[_0x9ca0('0x2c')];}_0x1ec9e2['status'](_0x4725e7)[_0x9ca0('0x2d')](_0x12f99c);};}exports[_0x9ca0('0x2e')]=function(_0x10de85,_0x311cf7){var _0x480c48={},_0x4ee5ac={},_0x8e0a3b={'count':0x0,'rows':[]};return db[_0x9ca0('0x2f')][_0x9ca0('0x30')]()[_0x9ca0('0x27')](function(_0x33fc86){_0x4ee5ac[_0x9ca0('0x31')]=_[_0x9ca0('0x32')](_0x33fc86);_0x4ee5ac[_0x9ca0('0x33')]=_['keys'](_0x10de85['query']);_0x4ee5ac[_0x9ca0('0x34')]=_[_0x9ca0('0x35')](_0x4ee5ac[_0x9ca0('0x31')],_0x4ee5ac[_0x9ca0('0x33')]);_0x480c48['attributes']=_[_0x9ca0('0x35')](_0x4ee5ac[_0x9ca0('0x31')],qs['fields'](_0x10de85[_0x9ca0('0x33')]['fields']));_0x480c48[_0x9ca0('0x36')]=_0x480c48[_0x9ca0('0x36')][_0x9ca0('0x37')]?_0x480c48[_0x9ca0('0x36')]:_0x4ee5ac[_0x9ca0('0x31')];if(!_0x10de85[_0x9ca0('0x33')]['hasOwnProperty'](_0x9ca0('0x38'))){_0x480c48['limit']=qs[_0x9ca0('0x1f')](_0x10de85[_0x9ca0('0x33')][_0x9ca0('0x1f')]);_0x480c48[_0x9ca0('0x1d')]=qs['offset'](_0x10de85[_0x9ca0('0x33')][_0x9ca0('0x1d')]);}_0x480c48[_0x9ca0('0x39')]=qs[_0x9ca0('0x3a')](_0x10de85[_0x9ca0('0x33')][_0x9ca0('0x3a')]);_0x480c48[_0x9ca0('0x3b')]=qs[_0x9ca0('0x34')](_['pick'](_0x10de85[_0x9ca0('0x33')],_0x4ee5ac[_0x9ca0('0x34')]),_0x33fc86);if(_0x10de85['query']['filter']){_0x480c48[_0x9ca0('0x3b')]=_[_0x9ca0('0x3c')](_0x480c48[_0x9ca0('0x3b')],{'$or':_[_0x9ca0('0x3d')](_0x480c48[_0x9ca0('0x36')],function(_0x1e7f19){var _0x1bd9ea={};_0x1bd9ea[_0x1e7f19]={'$like':'%'+_0x10de85[_0x9ca0('0x33')]['filter']+'%'};return _0x1bd9ea;})});}_0x480c48=_[_0x9ca0('0x3c')]({},_0x480c48,_0x10de85[_0x9ca0('0x3e')]);var _0x5c3899={'where':_0x480c48[_0x9ca0('0x3b')]};return db[_0x9ca0('0x2f')]['count'](_0x5c3899)[_0x9ca0('0x27')](function(_0x26ef47){_0x8e0a3b[_0x9ca0('0x20')]=_0x26ef47;if(_0x10de85['query'][_0x9ca0('0x3f')]){_0x480c48['include']=[{'all':!![]}];}return db['CmCompany'][_0x9ca0('0x40')](_0x480c48);})['then'](function(_0x470bbd){_0x8e0a3b[_0x9ca0('0x41')]=_0x470bbd;return _0x8e0a3b;})[_0x9ca0('0x27')](respondWithFilteredResult(_0x311cf7,_0x480c48))[_0x9ca0('0x42')](handleError(_0x311cf7,null));})[_0x9ca0('0x42')](handleError(_0x311cf7,null));};exports['show']=function(_0x891a22,_0x29ba16){var _0x295326={'raw':![],'where':{'id':_0x891a22[_0x9ca0('0x43')]['id']}},_0x1ad9d8={};_0x1ad9d8[_0x9ca0('0x31')]=_[_0x9ca0('0x32')](db[_0x9ca0('0x2f')]['rawAttributes']);_0x1ad9d8[_0x9ca0('0x33')]=_[_0x9ca0('0x32')](_0x891a22[_0x9ca0('0x33')]);_0x1ad9d8[_0x9ca0('0x34')]=_[_0x9ca0('0x35')](_0x1ad9d8['model'],_0x1ad9d8[_0x9ca0('0x33')]);_0x295326[_0x9ca0('0x36')]=_[_0x9ca0('0x35')](_0x1ad9d8[_0x9ca0('0x31')],qs[_0x9ca0('0x44')](_0x891a22[_0x9ca0('0x33')]['fields']));_0x295326[_0x9ca0('0x36')]=_0x295326['attributes'][_0x9ca0('0x37')]?_0x295326[_0x9ca0('0x36')]:_0x1ad9d8[_0x9ca0('0x31')];if(_0x891a22['query'][_0x9ca0('0x3f')]){_0x295326[_0x9ca0('0x45')]=[{'all':!![]}];}_0x295326=_[_0x9ca0('0x3c')]({},_0x295326,_0x891a22[_0x9ca0('0x3e')]);return db['CmCompany'][_0x9ca0('0x46')](_0x295326)[_0x9ca0('0x27')](handleEntityNotFound(_0x29ba16,null))[_0x9ca0('0x27')](respondWithResult(_0x29ba16,null))['catch'](handleError(_0x29ba16,null));};exports[_0x9ca0('0x47')]=function(_0x57305d,_0x87f9d3){return db[_0x9ca0('0x2f')]['create'](_0x57305d['body'],{})[_0x9ca0('0x27')](function(_0x5b09fb){var _0x56715d=_0x57305d[_0x9ca0('0x48')][_0x9ca0('0x29')]({'plain':!![]});if(!_0x56715d)throw new Error(_0x9ca0('0x49'));if(_0x56715d['role']==='user'){var _0x2fed34=_0x5b09fb[_0x9ca0('0x29')]({'plain':!![]});var _0xc5ba41=_0x9ca0('0x4a');return db[_0x9ca0('0x4b')][_0x9ca0('0x46')]({'where':{'name':_0xc5ba41,'userProfileId':_0x56715d['userProfileId']},'raw':!![]})[_0x9ca0('0x27')](function(_0x1d2a9e){if(_0x1d2a9e&&_0x1d2a9e[_0x9ca0('0x4c')]===0x0){return db[_0x9ca0('0x4d')]['create']({'name':_0x2fed34[_0x9ca0('0x2c')],'resourceId':_0x2fed34['id'],'type':_0x1d2a9e[_0x9ca0('0x2c')],'sectionId':_0x1d2a9e['id']},{})[_0x9ca0('0x27')](function(){return _0x5b09fb;});}else{return _0x5b09fb;}})['catch'](function(_0x5d75b4){logger[_0x9ca0('0x2a')](_0x9ca0('0x4e'),_0x5d75b4);throw _0x5d75b4;});}return _0x5b09fb;})[_0x9ca0('0x27')](respondWithResult(_0x87f9d3,0xc9))['catch'](handleError(_0x87f9d3,null));};exports[_0x9ca0('0x26')]=function(_0x37bf01,_0x59d8aa){if(_0x37bf01[_0x9ca0('0x4f')]['id']){delete _0x37bf01['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x37bf01[_0x9ca0('0x43')]['id']}})['then'](handleEntityNotFound(_0x59d8aa,null))['then'](saveUpdates(_0x37bf01[_0x9ca0('0x4f')],null))[_0x9ca0('0x27')](respondWithResult(_0x59d8aa,null))[_0x9ca0('0x42')](handleError(_0x59d8aa,null));};exports[_0x9ca0('0x28')]=function(_0x36196a,_0x4978a6){return db[_0x9ca0('0x2f')][_0x9ca0('0x46')]({'where':{'id':_0x36196a[_0x9ca0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4978a6,null))[_0x9ca0('0x27')](removeEntity(_0x4978a6,null))[_0x9ca0('0x42')](handleError(_0x4978a6,null));};exports[_0x9ca0('0x30')]=function(_0x574e68,_0x29b71d){return db[_0x9ca0('0x2f')][_0x9ca0('0x30')]()[_0x9ca0('0x27')](respondWithResult(_0x29b71d,null))['catch'](handleError(_0x29b71d,null));};exports['addContacts']=function(_0x89ab38,_0x941b59,_0x4f7736){return db['CmContact'][_0x9ca0('0x46')]({'where':{'id':_0x89ab38[_0x9ca0('0x43')]['id']}})[_0x9ca0('0x27')](handleEntityNotFound(_0x941b59,null))[_0x9ca0('0x27')](function(_0x2c8b07){if(_0x2c8b07){return _0x2c8b07['addContacts'](_0x89ab38[_0x9ca0('0x4f')][_0x9ca0('0x50')],_['omit'](_0x89ab38['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x941b59,null))[_0x9ca0('0x42')](handleError(_0x941b59,null));};exports['getContacts']=function(_0x49bb3f,_0x134f1e,_0x1dd7e9){var _0x3ca861={};var _0x4afee6={};var _0x54fc01;var _0x12aa00;return db['CmCompany']['findOne']({'where':{'id':_0x49bb3f[_0x9ca0('0x43')]['id']}})[_0x9ca0('0x27')](handleEntityNotFound(_0x134f1e,null))['then'](function(_0x1c5fcf){if(_0x1c5fcf){_0x54fc01=_0x1c5fcf;_0x4afee6[_0x9ca0('0x31')]=_['keys'](db[_0x9ca0('0x51')][_0x9ca0('0x52')]);_0x4afee6[_0x9ca0('0x33')]=_[_0x9ca0('0x32')](_0x49bb3f[_0x9ca0('0x33')]);_0x4afee6[_0x9ca0('0x34')]=_[_0x9ca0('0x35')](_0x4afee6[_0x9ca0('0x31')],_0x4afee6[_0x9ca0('0x33')]);_0x3ca861[_0x9ca0('0x36')]=_[_0x9ca0('0x35')](_0x4afee6[_0x9ca0('0x31')],qs['fields'](_0x49bb3f[_0x9ca0('0x33')][_0x9ca0('0x44')]));_0x3ca861[_0x9ca0('0x36')]=_0x3ca861['attributes'][_0x9ca0('0x37')]?_0x3ca861['attributes']:_0x4afee6['model'];_0x3ca861[_0x9ca0('0x39')]=qs[_0x9ca0('0x3a')](_0x49bb3f[_0x9ca0('0x33')]['sort']);_0x3ca861['where']=qs['filters'](_[_0x9ca0('0x53')](_0x49bb3f['query'],_0x4afee6[_0x9ca0('0x34')]));if(_0x49bb3f[_0x9ca0('0x33')][_0x9ca0('0x54')]){_0x3ca861[_0x9ca0('0x3b')]=_[_0x9ca0('0x3c')](_0x3ca861[_0x9ca0('0x3b')],{'$or':_[_0x9ca0('0x3d')](_0x3ca861[_0x9ca0('0x36')],function(_0x51d8b0){var _0x4a09ed={};_0x4a09ed[_0x51d8b0]={'$like':'%'+_0x49bb3f[_0x9ca0('0x33')][_0x9ca0('0x54')]+'%'};return _0x4a09ed;})});}_0x3ca861=_['merge']({},_0x3ca861,_0x49bb3f[_0x9ca0('0x3e')]);return _0x54fc01['getContacts'](_0x3ca861);}})[_0x9ca0('0x27')](function(_0x11e123){if(_0x11e123){_0x12aa00=_0x11e123[_0x9ca0('0x37')];if(!_0x49bb3f['query'][_0x9ca0('0x55')](_0x9ca0('0x38'))){_0x3ca861[_0x9ca0('0x1f')]=qs[_0x9ca0('0x1f')](_0x49bb3f[_0x9ca0('0x33')]['limit']);_0x3ca861[_0x9ca0('0x1d')]=qs[_0x9ca0('0x1d')](_0x49bb3f[_0x9ca0('0x33')][_0x9ca0('0x1d')]);}return _0x54fc01[_0x9ca0('0x56')](_0x3ca861);}})[_0x9ca0('0x27')](function(_0x3ae238){if(_0x3ae238){return _0x3ae238?{'count':_0x12aa00,'rows':_0x3ae238}:null;}})['then'](respondWithResult(_0x134f1e,null))['catch'](handleError(_0x134f1e,null));}; \ No newline at end of file +var _0xadf3=['reject','save','update','then','destroy','get','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','ids','omit','getContacts','findOne','CmContact','nolimit','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x1614aa,_0x15f8c6){var _0x11e4bf=function(_0x2dab9f){while(--_0x2dab9f){_0x1614aa['push'](_0x1614aa['shift']());}};_0x11e4bf(++_0x15f8c6);}(_0xadf3,0x186));var _0x3adf=function(_0x2d1d55,_0x2381a6){_0x2d1d55=_0x2d1d55-0x0;var _0x1b52f3=_0xadf3[_0x2d1d55];return _0x1b52f3;};'use strict';var emlformat=require(_0x3adf('0x0'));var rimraf=require(_0x3adf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3adf('0x2'));var rp=require('request-promise');var moment=require(_0x3adf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3adf('0x4'));var util=require(_0x3adf('0x5'));var path=require('path');var sox=require(_0x3adf('0x6'));var csv=require('to-csv');var ejs=require(_0x3adf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3adf('0x8'));var squel=require(_0x3adf('0x9'));var crypto=require(_0x3adf('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3adf('0xb'));var querystring=require(_0x3adf('0xc'));var Papa=require(_0x3adf('0xd'));var Redis=require(_0x3adf('0xe'));var authService=require(_0x3adf('0xf'));var qs=require(_0x3adf('0x10'));var as=require(_0x3adf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3adf('0x12'));var utils=require(_0x3adf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3adf('0x14'));var db=require(_0x3adf('0x15'))['db'];function respondWithStatusCode(_0x819ecb,_0x36392a){_0x36392a=_0x36392a||0xcc;return function(_0x208dd2){if(_0x208dd2){return _0x819ecb[_0x3adf('0x16')](_0x36392a);}return _0x819ecb[_0x3adf('0x17')](_0x36392a)[_0x3adf('0x18')]();};}function respondWithResult(_0x236236,_0x41cea2){_0x41cea2=_0x41cea2||0xc8;return function(_0x21c768){if(_0x21c768){return _0x236236[_0x3adf('0x17')](_0x41cea2)[_0x3adf('0x19')](_0x21c768);}};}function respondWithFilteredResult(_0x275da1,_0x46ed9e){return function(_0x4519c3){if(_0x4519c3){var _0x3ffe80=typeof _0x46ed9e['offset']===_0x3adf('0x1a')&&typeof _0x46ed9e[_0x3adf('0x1b')]===_0x3adf('0x1a');var _0x1ff416=_0x4519c3[_0x3adf('0x1c')];var _0x2a6ecd=_0x3ffe80?0x0:_0x46ed9e[_0x3adf('0x1d')];var _0x4ea3fd=_0x3ffe80?_0x4519c3['count']:_0x46ed9e[_0x3adf('0x1d')]+_0x46ed9e[_0x3adf('0x1b')];var _0xddac02;if(_0x4ea3fd>=_0x1ff416){_0x4ea3fd=_0x1ff416;_0xddac02=0xc8;}else{_0xddac02=0xce;}_0x275da1['status'](_0xddac02);return _0x275da1['set']('Content-Range',_0x2a6ecd+'-'+_0x4ea3fd+'/'+_0x1ff416)[_0x3adf('0x19')](_0x4519c3);}return null;};}function patchUpdates(_0x1ac072){return function(_0xd9c34a){try{jsonpatch['apply'](_0xd9c34a,_0x1ac072,!![]);}catch(_0x4754ab){return BPromise[_0x3adf('0x1e')](_0x4754ab);}return _0xd9c34a[_0x3adf('0x1f')]();};}function saveUpdates(_0xa5e38d,_0x9f2da0){return function(_0x140058){if(_0x140058){return _0x140058[_0x3adf('0x20')](_0xa5e38d)[_0x3adf('0x21')](function(_0xe84270){return _0xe84270;});}return null;};}function removeEntity(_0x177b60,_0x383448){return function(_0x134956){if(_0x134956){return _0x134956[_0x3adf('0x22')]()[_0x3adf('0x21')](function(){var _0x51f296=_0x134956[_0x3adf('0x23')]({'plain':!![]});var _0x156141='Companies';return db['UserProfileResource'][_0x3adf('0x22')]({'where':{'type':_0x156141,'resourceId':_0x51f296['id']}})[_0x3adf('0x21')](function(){return _0x134956;});})[_0x3adf('0x21')](function(){_0x177b60[_0x3adf('0x17')](0xcc)[_0x3adf('0x18')]();});}};}function handleEntityNotFound(_0x3c093e,_0x25751e){return function(_0x2b132c){if(!_0x2b132c){_0x3c093e[_0x3adf('0x16')](0x194);}return _0x2b132c;};}function handleError(_0x228385,_0x385609){_0x385609=_0x385609||0x1f4;return function(_0x5b3601){logger[_0x3adf('0x24')](_0x5b3601[_0x3adf('0x25')]);if(_0x5b3601[_0x3adf('0x26')]){delete _0x5b3601[_0x3adf('0x26')];}_0x228385[_0x3adf('0x17')](_0x385609)[_0x3adf('0x27')](_0x5b3601);};}exports[_0x3adf('0x28')]=function(_0xc38fb5,_0x3500da){var _0x30d556={},_0x4f25ef={},_0x57a7d2={'count':0x0,'rows':[]};return db[_0x3adf('0x29')][_0x3adf('0x2a')]()['then'](function(_0x183902){_0x4f25ef[_0x3adf('0x2b')]=_[_0x3adf('0x2c')](_0x183902);_0x4f25ef[_0x3adf('0x2d')]=_[_0x3adf('0x2c')](_0xc38fb5[_0x3adf('0x2d')]);_0x4f25ef[_0x3adf('0x2e')]=_['intersection'](_0x4f25ef[_0x3adf('0x2b')],_0x4f25ef[_0x3adf('0x2d')]);_0x30d556[_0x3adf('0x2f')]=_[_0x3adf('0x30')](_0x4f25ef['model'],qs['fields'](_0xc38fb5[_0x3adf('0x2d')][_0x3adf('0x31')]));_0x30d556['attributes']=_0x30d556[_0x3adf('0x2f')][_0x3adf('0x32')]?_0x30d556[_0x3adf('0x2f')]:_0x4f25ef[_0x3adf('0x2b')];if(!_0xc38fb5[_0x3adf('0x2d')]['hasOwnProperty']('nolimit')){_0x30d556['limit']=qs[_0x3adf('0x1b')](_0xc38fb5[_0x3adf('0x2d')][_0x3adf('0x1b')]);_0x30d556[_0x3adf('0x1d')]=qs[_0x3adf('0x1d')](_0xc38fb5[_0x3adf('0x2d')]['offset']);}_0x30d556[_0x3adf('0x33')]=qs[_0x3adf('0x34')](_0xc38fb5[_0x3adf('0x2d')][_0x3adf('0x34')]);_0x30d556[_0x3adf('0x35')]=qs[_0x3adf('0x2e')](_[_0x3adf('0x36')](_0xc38fb5[_0x3adf('0x2d')],_0x4f25ef[_0x3adf('0x2e')]),_0x183902);if(_0xc38fb5[_0x3adf('0x2d')][_0x3adf('0x37')]){_0x30d556[_0x3adf('0x35')]=_[_0x3adf('0x38')](_0x30d556[_0x3adf('0x35')],{'$or':_[_0x3adf('0x39')](_0x30d556[_0x3adf('0x2f')],function(_0x5bcf9c){var _0x2b50c9={};_0x2b50c9[_0x5bcf9c]={'$like':'%'+_0xc38fb5['query']['filter']+'%'};return _0x2b50c9;})});}_0x30d556=_[_0x3adf('0x38')]({},_0x30d556,_0xc38fb5[_0x3adf('0x3a')]);var _0xb282c={'where':_0x30d556['where']};return db[_0x3adf('0x29')][_0x3adf('0x1c')](_0xb282c)[_0x3adf('0x21')](function(_0x145b3e){_0x57a7d2['count']=_0x145b3e;if(_0xc38fb5[_0x3adf('0x2d')][_0x3adf('0x3b')]){_0x30d556[_0x3adf('0x3c')]=[{'all':!![]}];}return db[_0x3adf('0x29')][_0x3adf('0x3d')](_0x30d556);})[_0x3adf('0x21')](function(_0x47bf21){_0x57a7d2[_0x3adf('0x3e')]=_0x47bf21;return _0x57a7d2;})[_0x3adf('0x21')](respondWithFilteredResult(_0x3500da,_0x30d556))['catch'](handleError(_0x3500da,null));})[_0x3adf('0x3f')](handleError(_0x3500da,null));};exports[_0x3adf('0x40')]=function(_0x3500b3,_0x1dbfd0){var _0x1b6df5={'raw':![],'where':{'id':_0x3500b3[_0x3adf('0x41')]['id']}},_0x2437f5={};_0x2437f5[_0x3adf('0x2b')]=_[_0x3adf('0x2c')](db[_0x3adf('0x29')][_0x3adf('0x42')]);_0x2437f5[_0x3adf('0x2d')]=_['keys'](_0x3500b3[_0x3adf('0x2d')]);_0x2437f5[_0x3adf('0x2e')]=_[_0x3adf('0x30')](_0x2437f5[_0x3adf('0x2b')],_0x2437f5[_0x3adf('0x2d')]);_0x1b6df5[_0x3adf('0x2f')]=_[_0x3adf('0x30')](_0x2437f5[_0x3adf('0x2b')],qs[_0x3adf('0x31')](_0x3500b3[_0x3adf('0x2d')][_0x3adf('0x31')]));_0x1b6df5[_0x3adf('0x2f')]=_0x1b6df5[_0x3adf('0x2f')]['length']?_0x1b6df5[_0x3adf('0x2f')]:_0x2437f5[_0x3adf('0x2b')];if(_0x3500b3[_0x3adf('0x2d')][_0x3adf('0x3b')]){_0x1b6df5[_0x3adf('0x3c')]=[{'all':!![]}];}_0x1b6df5=_[_0x3adf('0x38')]({},_0x1b6df5,_0x3500b3[_0x3adf('0x3a')]);return db[_0x3adf('0x29')]['find'](_0x1b6df5)['then'](handleEntityNotFound(_0x1dbfd0,null))[_0x3adf('0x21')](respondWithResult(_0x1dbfd0,null))['catch'](handleError(_0x1dbfd0,null));};exports[_0x3adf('0x43')]=function(_0x2c426f,_0x28f07f){return db[_0x3adf('0x29')][_0x3adf('0x43')](_0x2c426f[_0x3adf('0x44')],{})['then'](function(_0x4a20df){var _0x46ce99=_0x2c426f['user'][_0x3adf('0x23')]({'plain':!![]});if(!_0x46ce99)throw new Error(_0x3adf('0x45'));if(_0x46ce99['role']===_0x3adf('0x46')){var _0x53d1b8=_0x4a20df[_0x3adf('0x23')]({'plain':!![]});var _0x4b2633=_0x3adf('0x47');return db[_0x3adf('0x48')]['find']({'where':{'name':_0x4b2633,'userProfileId':_0x46ce99[_0x3adf('0x49')]},'raw':!![]})[_0x3adf('0x21')](function(_0x246fb7){if(_0x246fb7&&_0x246fb7[_0x3adf('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x53d1b8[_0x3adf('0x26')],'resourceId':_0x53d1b8['id'],'type':_0x246fb7[_0x3adf('0x26')],'sectionId':_0x246fb7['id']},{})[_0x3adf('0x21')](function(){return _0x4a20df;});}else{return _0x4a20df;}})[_0x3adf('0x3f')](function(_0x12d306){logger['error'](_0x3adf('0x4b'),_0x12d306);throw _0x12d306;});}return _0x4a20df;})[_0x3adf('0x21')](respondWithResult(_0x28f07f,0xc9))[_0x3adf('0x3f')](handleError(_0x28f07f,null));};exports[_0x3adf('0x20')]=function(_0x24e2a1,_0x5eab31){if(_0x24e2a1[_0x3adf('0x44')]['id']){delete _0x24e2a1[_0x3adf('0x44')]['id'];}return db[_0x3adf('0x29')]['find']({'where':{'id':_0x24e2a1[_0x3adf('0x41')]['id']}})[_0x3adf('0x21')](handleEntityNotFound(_0x5eab31,null))[_0x3adf('0x21')](saveUpdates(_0x24e2a1[_0x3adf('0x44')],null))[_0x3adf('0x21')](respondWithResult(_0x5eab31,null))[_0x3adf('0x3f')](handleError(_0x5eab31,null));};exports[_0x3adf('0x22')]=function(_0x3b2fe5,_0x3c59c1){return db[_0x3adf('0x29')][_0x3adf('0x4c')]({'where':{'id':_0x3b2fe5['params']['id']}})[_0x3adf('0x21')](handleEntityNotFound(_0x3c59c1,null))[_0x3adf('0x21')](removeEntity(_0x3c59c1,null))['catch'](handleError(_0x3c59c1,null));};exports[_0x3adf('0x2a')]=function(_0xed1a2e,_0x1b6a28){return db[_0x3adf('0x29')][_0x3adf('0x2a')]()[_0x3adf('0x21')](respondWithResult(_0x1b6a28,null))[_0x3adf('0x3f')](handleError(_0x1b6a28,null));};exports[_0x3adf('0x4d')]=function(_0x4b9650,_0x14e942,_0x48c59d){return db['CmContact'][_0x3adf('0x4c')]({'where':{'id':_0x4b9650[_0x3adf('0x41')]['id']}})[_0x3adf('0x21')](handleEntityNotFound(_0x14e942,null))[_0x3adf('0x21')](function(_0x118f1c){if(_0x118f1c){return _0x118f1c[_0x3adf('0x4d')](_0x4b9650[_0x3adf('0x44')][_0x3adf('0x4e')],_[_0x3adf('0x4f')](_0x4b9650[_0x3adf('0x44')],['ids','id'])||{});}})['then'](respondWithResult(_0x14e942,null))[_0x3adf('0x3f')](handleError(_0x14e942,null));};exports[_0x3adf('0x50')]=function(_0x9d4dcf,_0x21a8fe,_0x455efe){var _0x544208={};var _0x54773c={};var _0x38a899;var _0xf14a1;return db[_0x3adf('0x29')][_0x3adf('0x51')]({'where':{'id':_0x9d4dcf[_0x3adf('0x41')]['id']}})['then'](handleEntityNotFound(_0x21a8fe,null))[_0x3adf('0x21')](function(_0x4ce790){if(_0x4ce790){_0x38a899=_0x4ce790;_0x54773c[_0x3adf('0x2b')]=_[_0x3adf('0x2c')](db[_0x3adf('0x52')][_0x3adf('0x42')]);_0x54773c[_0x3adf('0x2d')]=_['keys'](_0x9d4dcf[_0x3adf('0x2d')]);_0x54773c['filters']=_[_0x3adf('0x30')](_0x54773c['model'],_0x54773c['query']);_0x544208[_0x3adf('0x2f')]=_[_0x3adf('0x30')](_0x54773c[_0x3adf('0x2b')],qs['fields'](_0x9d4dcf[_0x3adf('0x2d')]['fields']));_0x544208[_0x3adf('0x2f')]=_0x544208['attributes'][_0x3adf('0x32')]?_0x544208['attributes']:_0x54773c[_0x3adf('0x2b')];_0x544208[_0x3adf('0x33')]=qs[_0x3adf('0x34')](_0x9d4dcf['query'][_0x3adf('0x34')]);_0x544208[_0x3adf('0x35')]=qs[_0x3adf('0x2e')](_[_0x3adf('0x36')](_0x9d4dcf[_0x3adf('0x2d')],_0x54773c[_0x3adf('0x2e')]));if(_0x9d4dcf[_0x3adf('0x2d')][_0x3adf('0x37')]){_0x544208[_0x3adf('0x35')]=_[_0x3adf('0x38')](_0x544208['where'],{'$or':_[_0x3adf('0x39')](_0x544208[_0x3adf('0x2f')],function(_0x4f4e82){var _0x1617cd={};_0x1617cd[_0x4f4e82]={'$like':'%'+_0x9d4dcf['query'][_0x3adf('0x37')]+'%'};return _0x1617cd;})});}_0x544208=_['merge']({},_0x544208,_0x9d4dcf[_0x3adf('0x3a')]);return _0x38a899['getContacts'](_0x544208);}})['then'](function(_0x40b8b2){if(_0x40b8b2){_0xf14a1=_0x40b8b2[_0x3adf('0x32')];if(!_0x9d4dcf['query']['hasOwnProperty'](_0x3adf('0x53'))){_0x544208[_0x3adf('0x1b')]=qs[_0x3adf('0x1b')](_0x9d4dcf[_0x3adf('0x2d')][_0x3adf('0x1b')]);_0x544208[_0x3adf('0x1d')]=qs[_0x3adf('0x1d')](_0x9d4dcf[_0x3adf('0x2d')][_0x3adf('0x1d')]);}return _0x38a899[_0x3adf('0x50')](_0x544208);}})[_0x3adf('0x21')](function(_0xa7b9ca){if(_0xa7b9ca){return _0xa7b9ca?{'count':_0xf14a1,'rows':_0xa7b9ca}:null;}})[_0x3adf('0x21')](respondWithResult(_0x21a8fe,null))['catch'](handleError(_0x21a8fe,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7b0bbcc..4736aba 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 _0x0676=['./cmCompany.attributes','exports','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0676,0xa8));var _0x6067=function(_0x253709,_0x4d2971){_0x253709=_0x253709-0x0;var _0x339a00=_0x0676[_0x253709];return _0x339a00;};'use strict';var _=require(_0x6067('0x0'));var util=require('util');var logger=require(_0x6067('0x1'))(_0x6067('0x2'));var moment=require(_0x6067('0x3'));var BPromise=require(_0x6067('0x4'));var rp=require(_0x6067('0x5'));var fs=require('fs');var path=require(_0x6067('0x6'));var rimraf=require('rimraf');var config=require(_0x6067('0x7'));var attributes=require(_0x6067('0x8'));module[_0x6067('0x9')]=function(_0x19ba51,_0x12e4d1){return _0x19ba51['define']('CmCompany',attributes,{'tableName':_0x6067('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3abf=['rimraf','./cmCompany.attributes','CmCompany','cm_companies','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x3abf,0x162));var _0xf3ab=function(_0x567c75,_0x4d1e21){_0x567c75=_0x567c75-0x0;var _0x1eed54=_0x3abf[_0x567c75];return _0x1eed54;};'use strict';var _=require(_0xf3ab('0x0'));var util=require(_0xf3ab('0x1'));var logger=require(_0xf3ab('0x2'))('api');var moment=require(_0xf3ab('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3ab('0x4'));var fs=require('fs');var path=require(_0xf3ab('0x5'));var rimraf=require(_0xf3ab('0x6'));var config=require('../../config/environment');var attributes=require(_0xf3ab('0x7'));module['exports']=function(_0x4b6476,_0x40d667){return _0x4b6476['define'](_0xf3ab('0x8'),attributes,{'tableName':_0xf3ab('0x9'),'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 bbac788..04fe44c 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 _0xc744=['stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0xd3eee0,_0x158bc2){var _0x449aa2=function(_0xdc4490){while(--_0xdc4490){_0xd3eee0['push'](_0xd3eee0['shift']());}};_0x449aa2(++_0x158bc2);}(_0xc744,0x1bb));var _0x4c74=function(_0x55d608,_0x2e9858){_0x55d608=_0x55d608-0x0;var _0x27ff79=_0xc744[_0x55d608];return _0x27ff79;};'use strict';var _=require(_0x4c74('0x0'));var util=require(_0x4c74('0x1'));var moment=require(_0x4c74('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c74('0x3'));var fs=require('fs');var Redis=require(_0x4c74('0x4'));var db=require(_0x4c74('0x5'))['db'];var utils=require(_0x4c74('0x6'));var logger=require(_0x4c74('0x7'))(_0x4c74('0x8'));var config=require(_0x4c74('0x9'));var jayson=require(_0x4c74('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f468a,_0x26da0e,_0x348393){return new BPromise(function(_0x106f33,_0x3facea){return client[_0x4c74('0xb')](_0x2f468a,_0x348393)[_0x4c74('0xc')](function(_0x3b0a09){logger[_0x4c74('0xd')]('CmCompany,\x20%s,\x20%s',_0x26da0e,_0x4c74('0xe'));logger[_0x4c74('0xf')](_0x4c74('0x10'),_0x26da0e,_0x4c74('0xe'),JSON[_0x4c74('0x11')](_0x3b0a09));if(_0x3b0a09[_0x4c74('0x12')]){if(_0x3b0a09[_0x4c74('0x12')]['code']===0x1f4){logger['error'](_0x4c74('0x13'),_0x26da0e,_0x3b0a09[_0x4c74('0x12')][_0x4c74('0x14')]);return _0x3facea(_0x3b0a09[_0x4c74('0x12')][_0x4c74('0x14')]);}logger[_0x4c74('0x12')](_0x4c74('0x13'),_0x26da0e,_0x3b0a09[_0x4c74('0x12')][_0x4c74('0x14')]);return _0x106f33(_0x3b0a09[_0x4c74('0x12')][_0x4c74('0x14')]);}else{logger[_0x4c74('0xd')](_0x4c74('0x13'),_0x26da0e,'request\x20sent');_0x106f33(_0x3b0a09[_0x4c74('0x15')][_0x4c74('0x14')]);}})[_0x4c74('0x16')](function(_0x880a1a){logger[_0x4c74('0x12')](_0x4c74('0x13'),_0x26da0e,_0x880a1a);_0x3facea(_0x880a1a);});});} \ No newline at end of file +var _0x02a3=['moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x58032b,_0x573897){var _0x2a4028=function(_0x2a179e){while(--_0x2a179e){_0x58032b['push'](_0x58032b['shift']());}};_0x2a4028(++_0x573897);}(_0x02a3,0xc4));var _0x302a=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x02a3[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x302a('0x0'));var util=require(_0x302a('0x1'));var moment=require(_0x302a('0x2'));var BPromise=require(_0x302a('0x3'));var rs=require(_0x302a('0x4'));var fs=require('fs');var Redis=require(_0x302a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x302a('0x6'));var jayson=require(_0x302a('0x7'));var client=jayson[_0x302a('0x8')][_0x302a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x413a03,_0x359a47,_0x2d2e9f){return new BPromise(function(_0x1caafb,_0x2a8596){return client['request'](_0x413a03,_0x2d2e9f)[_0x302a('0xa')](function(_0x1623bb){logger[_0x302a('0xb')](_0x302a('0xc'),_0x359a47,_0x302a('0xd'));logger[_0x302a('0xe')](_0x302a('0xf'),_0x359a47,_0x302a('0xd'),JSON[_0x302a('0x10')](_0x1623bb));if(_0x1623bb[_0x302a('0x11')]){if(_0x1623bb[_0x302a('0x11')][_0x302a('0x12')]===0x1f4){logger[_0x302a('0x11')](_0x302a('0xc'),_0x359a47,_0x1623bb[_0x302a('0x11')][_0x302a('0x13')]);return _0x2a8596(_0x1623bb[_0x302a('0x11')]['message']);}logger[_0x302a('0x11')](_0x302a('0xc'),_0x359a47,_0x1623bb[_0x302a('0x11')][_0x302a('0x13')]);return _0x1caafb(_0x1623bb[_0x302a('0x11')][_0x302a('0x13')]);}else{logger[_0x302a('0xb')](_0x302a('0xc'),_0x359a47,_0x302a('0xd'));_0x1caafb(_0x1623bb[_0x302a('0x14')][_0x302a('0x13')]);}})[_0x302a('0x15')](function(_0x2687c5){logger[_0x302a('0x11')](_0x302a('0xc'),_0x359a47,_0x2687c5);_0x2a8596(_0x2687c5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 26ffa84..a18c9d1 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 _0x3087=['isAuthenticated','describe','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./cmCompany.controller','get','index','/describe'];(function(_0x5357c8,_0x3e6423){var _0x5e3a96=function(_0x1964df){while(--_0x1964df){_0x5357c8['push'](_0x5357c8['shift']());}};_0x5e3a96(++_0x3e6423);}(_0x3087,0xd1));var _0x7308=function(_0x3e8deb,_0x314616){_0x3e8deb=_0x3e8deb-0x0;var _0x5a23f7=_0x3087[_0x3e8deb];return _0x5a23f7;};'use strict';var multer=require(_0x7308('0x0'));var util=require(_0x7308('0x1'));var path=require('path');var timeout=require(_0x7308('0x2'));var express=require(_0x7308('0x3'));var router=express[_0x7308('0x4')]();var fs_extra=require(_0x7308('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7308('0x6'));var controller=require(_0x7308('0x7'));router[_0x7308('0x8')]('/',auth['isAuthenticated'](),controller[_0x7308('0x9')]);router[_0x7308('0x8')](_0x7308('0xa'),auth[_0x7308('0xb')](),controller[_0x7308('0xc')]);router[_0x7308('0x8')]('/:id',auth[_0x7308('0xb')](),controller['show']);router[_0x7308('0x8')](_0x7308('0xd'),auth[_0x7308('0xb')](),controller[_0x7308('0xe')]);router[_0x7308('0xf')]('/',auth[_0x7308('0xb')](),controller[_0x7308('0x10')]);router[_0x7308('0xf')](_0x7308('0xd'),auth[_0x7308('0xb')](),controller[_0x7308('0x11')]);router[_0x7308('0x12')](_0x7308('0x13'),auth[_0x7308('0xb')](),controller[_0x7308('0x14')]);router['delete'](_0x7308('0x13'),auth[_0x7308('0xb')](),controller[_0x7308('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0cd1=['addContacts','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','getContacts','post','create'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0cd1,0x131));var _0x10cd=function(_0x44ceee,_0x2a5e28){_0x44ceee=_0x44ceee-0x0;var _0x1a065c=_0x0cd1[_0x44ceee];return _0x1a065c;};'use strict';var multer=require('multer');var util=require(_0x10cd('0x0'));var path=require(_0x10cd('0x1'));var timeout=require(_0x10cd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10cd('0x3'));var auth=require(_0x10cd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x10cd('0x5'));var controller=require('./cmCompany.controller');router[_0x10cd('0x6')]('/',auth['isAuthenticated'](),controller[_0x10cd('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x10cd('0x8')]);router[_0x10cd('0x6')](_0x10cd('0x9'),auth[_0x10cd('0xa')](),controller[_0x10cd('0xb')]);router[_0x10cd('0x6')]('/:id/contacts',auth[_0x10cd('0xa')](),controller[_0x10cd('0xc')]);router[_0x10cd('0xd')]('/',auth[_0x10cd('0xa')](),controller[_0x10cd('0xe')]);router[_0x10cd('0xd')]('/:id/contacts',auth[_0x10cd('0xa')](),controller[_0x10cd('0xf')]);router[_0x10cd('0x10')](_0x10cd('0x9'),auth[_0x10cd('0xa')](),controller['update']);router[_0x10cd('0x11')](_0x10cd('0x9'),auth[_0x10cd('0xa')](),controller[_0x10cd('0x12')]);module[_0x10cd('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ed9a246..c8749c9 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 _0xa3cc=['UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x3a0853,_0x2c5f2a){var _0x51d3ce=function(_0x5f199e){while(--_0x5f199e){_0x3a0853['push'](_0x3a0853['shift']());}};_0x51d3ce(++_0x2c5f2a);}(_0xa3cc,0x14b));var _0xca3c=function(_0x231032,_0x1c6cf7){_0x231032=_0x231032-0x0;var _0x574762=_0xa3cc[_0x231032];return _0x574762;};'use strict';var _=require('lodash');var Sequelize=require(_0xca3c('0x0'));module[_0xca3c('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xca3c('0x2')]},'street':{'type':Sequelize[_0xca3c('0x2')]},'postalCode':{'type':Sequelize[_0xca3c('0x2')]},'city':{'type':Sequelize[_0xca3c('0x2')]},'country':{'type':Sequelize[_0xca3c('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca3c('0x3')]},'phone':{'type':Sequelize[_0xca3c('0x2')]},'mobile':{'type':Sequelize[_0xca3c('0x2')]},'fax':{'type':Sequelize[_0xca3c('0x2')]},'email':{'type':Sequelize[_0xca3c('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xca3c('0x2')]},'fb_data':{'type':Sequelize[_0xca3c('0x2')]},'twitter':{'type':Sequelize[_0xca3c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xca3c('0x2')]},'viber':{'type':Sequelize[_0xca3c('0x2')]},'line':{'type':Sequelize[_0xca3c('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xca3c('0x2')]},'UserId':{'type':Sequelize[_0xca3c('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xca3c('0x4')](0x2)[_0xca3c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xca3c('0x6')],'defaultValue':Sequelize[_0xca3c('0x7')]},'dialTimezone':{'type':Sequelize[_0xca3c('0x2')]},'utcOffset':{'type':Sequelize[_0xca3c('0x4')]}}; \ No newline at end of file +var _0xc789=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0xc789,0x1ef));var _0x9c78=function(_0x40693f,_0x31791c){_0x40693f=_0x40693f-0x0;var _0x772542=_0xc789[_0x40693f];return _0x772542;};'use strict';var _=require(_0x9c78('0x0'));var Sequelize=require('sequelize');module[_0x9c78('0x1')]={'firstName':{'type':Sequelize[_0x9c78('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9c78('0x2')]},'city':{'type':Sequelize[_0x9c78('0x2')]},'country':{'type':Sequelize[_0x9c78('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9c78('0x2')]},'description':{'type':Sequelize[_0x9c78('0x3')]},'phone':{'type':Sequelize[_0x9c78('0x2')]},'mobile':{'type':Sequelize[_0x9c78('0x2')]},'fax':{'type':Sequelize[_0x9c78('0x2')]},'email':{'type':Sequelize[_0x9c78('0x2')]},'url':{'type':Sequelize[_0x9c78('0x2')]},'facebook':{'type':Sequelize[_0x9c78('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9c78('0x2')]},'skype':{'type':Sequelize[_0x9c78('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9c78('0x2')]},'line':{'type':Sequelize[_0x9c78('0x2')]},'wechat':{'type':Sequelize[_0x9c78('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x9c78('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x9c78('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9c78('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9c78('0x6')],'defaultValue':Sequelize[_0x9c78('0x7')]},'dialTimezone':{'type':Sequelize[_0x9c78('0x2')]},'utcOffset':{'type':Sequelize[_0x9c78('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e19a224..60ebdf3 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 _0x70a7=['ListId','spread','contact','show','find','Tag','Tags','name','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','where','omit','map','format','cf_%d','table','cm_contacts','setFields','params','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','sort','pick','filter','ids','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','CmHopperId','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','nolimit','order','options','includeAll','include','getHopperHistories','rows','getHopperFinals','CmHopperFinal','ContactId','JscriptySessionReport','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','binding','firstName','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','agent','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','value','slice','bluebird','path','lodash','papaparse','ioredis','api','../../config/environment','../../config/environment/shared','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','status','set','update','destroy','then','end','sendStatus','stack','send','index','describe','getOptions','findAll','query','user','CmContact','catch','tags','keys','length','cf_','columnName','displayName','CmCustomField','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','WhatsappMessage','create','dialTimezone','isNil','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','$or','push'];(function(_0x3ec0e9,_0x1ea265){var _0x1af168=function(_0x4490c7){while(--_0x4490c7){_0x3ec0e9['push'](_0x3ec0e9['shift']());}};_0x1af168(++_0x1ea265);}(_0x70a7,0x9d));var _0x770a=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x70a7[_0x28aea5];return _0x6a55f9;};'use strict';var moment=require('moment');var BPromise=require(_0x770a('0x0'));var util=require('util');var path=require(_0x770a('0x1'));var fs=require('fs');var _=require(_0x770a('0x2'));var squel=require('squel');var Papa=require(_0x770a('0x3'));var Redis=require(_0x770a('0x4'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x770a('0x5'));var config=require(_0x770a('0x6'));var shared=require(_0x770a('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x770a('0x8')],{'host':_0x770a('0x9'),'port':0x18eb});var socket=require(_0x770a('0xa'))(new Redis(config[_0x770a('0x8')]));require(_0x770a('0xb'))[_0x770a('0xc')](socket);function respondWithResult(_0x452c6b,_0x1de33c){_0x1de33c=_0x1de33c||0xc8;return function(_0x190552){if(_0x190552){return _0x452c6b['status'](_0x1de33c)[_0x770a('0xd')](_0x190552);}};}function respondWithFilteredResult(_0x736eee,_0x100127){return function(_0xa3066){if(_0xa3066){var _0x1415d4=typeof _0x100127[_0x770a('0xe')]===_0x770a('0xf')&&typeof _0x100127[_0x770a('0x10')]===_0x770a('0xf');var _0x304c50=_0xa3066[_0x770a('0x11')];var _0x5c6b53=_0x1415d4?0x0:_0x100127[_0x770a('0xe')];var _0xd2388e=_0x1415d4?_0xa3066[_0x770a('0x11')]:_0x100127['offset']+_0x100127['limit'];var _0x1510b2;if(_0xd2388e>=_0x304c50){_0xd2388e=_0x304c50;_0x1510b2=0xc8;}else{_0x1510b2=0xce;}_0x736eee[_0x770a('0x12')](_0x1510b2);return _0x736eee[_0x770a('0x13')]('Content-Range',_0x5c6b53+'-'+_0xd2388e+'/'+_0x304c50)[_0x770a('0xd')](_0xa3066);}return null;};}function saveUpdates(_0x55dc5e){return function(_0x26ce22){if(_0x26ce22){return _0x26ce22[_0x770a('0x14')](_0x55dc5e)['then'](function(_0x486824){return _0x486824;});}return null;};}function removeEntity(_0x47ec62){return function(_0x57d73e){if(_0x57d73e){return _0x57d73e[_0x770a('0x15')]()[_0x770a('0x16')](function(){_0x47ec62[_0x770a('0x12')](0xcc)[_0x770a('0x17')]();});}};}function handleEntityNotFound(_0x15f89b){return function(_0x22e990){if(!_0x22e990){_0x15f89b[_0x770a('0x18')](0x194);}return _0x22e990;};}function handleError(_0x4b27a3,_0x2cbf49){_0x2cbf49=_0x2cbf49||0x1f4;return function(_0x168016){logger['error'](_0x168016[_0x770a('0x19')]);if(_0x168016['name']){delete _0x168016['name'];}_0x4b27a3[_0x770a('0x12')](_0x2cbf49)[_0x770a('0x1a')](_0x168016);};}exports[_0x770a('0x1b')]=function(_0x388b65,_0x89e54a){var _0x14d8aa={};return contacts[_0x770a('0x1c')]()['then'](function(_0x9f02ed){_0x14d8aa=qs[_0x770a('0x1d')](_0x9f02ed,_0x388b65);return contacts[_0x770a('0x1e')](_0x388b65[_0x770a('0x1f')],_0x388b65[_0x770a('0x20')],_0x14d8aa,_0x9f02ed);})['then'](respondWithFilteredResult(_0x89e54a,_0x14d8aa))['catch'](handleError(_0x89e54a,null));};exports[_0x770a('0x15')]=function(_0x5a1af1,_0x3b3c03){return db[_0x770a('0x21')]['find']({'where':{'id':_0x5a1af1['params']['id']}})[_0x770a('0x16')](handleEntityNotFound(_0x3b3c03,null))[_0x770a('0x16')](removeEntity(_0x3b3c03,null))[_0x770a('0x22')](handleError(_0x3b3c03,null));};exports[_0x770a('0x1c')]=function(_0x38f035,_0x6646fc){return db[_0x770a('0x21')][_0x770a('0x1c')]()[_0x770a('0x16')](function(_0x3eb00d){delete _0x3eb00d[_0x770a('0x23')];for(var _0x44f3a0=0x0;_0x44f3a00x0){return new Promise(function(_0xabfafe){var _0x53e7d9=[];for(var _0x73bf48=0x0;_0x73bf48<_0x3d0552['length'];_0x73bf48++){_0x53e7d9[_0x770a('0x58')](insertAdditionalPhones(_0x3d0552[_0x73bf48][_0x770a('0x5b')],_0x3d0552[_0x73bf48][_0x770a('0x53')]));}Promise['all'](_0x53e7d9)[_0x770a('0x16')](function(){_0xabfafe(0x1);});})[_0x770a('0x16')](function(){return{'success':_0x1a04a8,'failure':_0x44ef4e,'duplicates':_0x326587};});}else{return{'success':_0x1a04a8,'failure':_0x44ef4e,'duplicates':_0x326587};}}})[_0x770a('0x16')](respondWithResult(_0x37b835,0xc9))[_0x770a('0x22')](handleError(_0x37b835,null));};exports[_0x770a('0x5c')]=function(_0x50f892,_0x37e8bb){var _0x4bd0c6;return db[_0x770a('0x21')]['describe']()['then'](function(_0x415db4){return db[_0x770a('0x21')][_0x770a('0x5d')]({'where':{'id':_0x50f892['params']['id']},'include':[{'model':db[_0x770a('0x5e')],'as':_0x770a('0x5f'),'attributes':['id',_0x770a('0x60'),_0x770a('0x61')],'required':_0x50f892[_0x770a('0x1f')][_0x770a('0x62')]?!![]:![]},{'model':db[_0x770a('0x44')],'as':_0x770a('0x63'),'where':{'CmContactId':_0x50f892['params']['id']},'required':![],'include':[{'model':db[_0x770a('0x64')],'as':_0x770a('0x65')}]}],'order':[db[_0x770a('0x66')][_0x770a('0x67')](_0x770a('0x68'))],'attributes':_[_0x770a('0x24')](_0x415db4)});})[_0x770a('0x16')](function(_0x335499){if(!_[_0x770a('0x50')](_0x335499)){_0x4bd0c6=_0x335499['get']({'plain':!![]});var _0xa2c8c4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x335499&&_0x335499['ListId']){if(_0x335499['ListId']){_0xa2c8c4[_0x770a('0x69')]['$and'][_0x770a('0x58')]({'ListId':{'$ne':_0x335499['ListId']}});}}return db['CmCustomField'][_0x770a('0x1e')](_0xa2c8c4);}})[_0x770a('0x16')](function(_0x123a28){if(!_[_0x770a('0x50')](_0x123a28)){return _[_0x770a('0x6a')](_0x4bd0c6,_[_0x770a('0x6b')](_0x123a28,function(_0x349b6b){return util[_0x770a('0x6c')](_0x770a('0x6d'),_0x349b6b['id']);}));}})['then'](handleEntityNotFound(_0x37e8bb,null))[_0x770a('0x16')](respondWithResult(_0x37e8bb,null))['catch'](handleError(_0x37e8bb,null));};exports[_0x770a('0x14')]=function(_0x1682ab,_0x41da39){var _0x53f509;if(_0x1682ab[_0x770a('0x33')]['id']){delete _0x1682ab[_0x770a('0x33')]['id'];}if(!_[_0x770a('0x50')](_0x1682ab['body']['dialTimezone'])){var _0x4900f2=_0x1682ab[_0x770a('0x33')][_0x770a('0x4f')];if(!_[_0x770a('0x50')](shared[_0x770a('0x52')][_0x4900f2]))_0x1682ab[_0x770a('0x33')]['utcOffset']=shared[_0x770a('0x52')][_0x4900f2]['utcOffset'];}return db[_0x770a('0x21')][_0x770a('0x5d')]({'where':{'id':_0x1682ab['params']['id']}})[_0x770a('0x16')](handleEntityNotFound(_0x41da39,null))[_0x770a('0x16')](saveUpdates(_0x1682ab[_0x770a('0x33')],null))[_0x770a('0x16')](function(_0x190c4){_0x53f509=_0x190c4;var _0x49d921={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x190c4&&_0x190c4[_0x770a('0x59')]){if(_0x190c4[_0x770a('0x59')]){_0x49d921[_0x770a('0x69')]['$and'][_0x770a('0x58')]({'ListId':{'$ne':_0x190c4[_0x770a('0x59')]}});}}return db[_0x770a('0x29')][_0x770a('0x1e')](_0x49d921);})[_0x770a('0x16')](function(_0x4eda90){if(_0x4eda90){return _[_0x770a('0x6a')](_['pickBy'](_0x1682ab[_0x770a('0x33')],function(_0x5985c3,_0xf4b030){return _['startsWith'](_0xf4b030,_0x770a('0x26'));}),_['map'](_0x4eda90,function(_0x3f5c4d){return util[_0x770a('0x6c')]('cf_%d',_0x3f5c4d['id']);}));}})[_0x770a('0x16')](function(_0xf2e967){if(_0xf2e967&&!_['isEmpty'](_0xf2e967)){var _0x25a17a=squel[_0x770a('0x14')]()[_0x770a('0x6e')](_0x770a('0x6f'))[_0x770a('0x70')](_0xf2e967)[_0x770a('0x69')]('id\x20=\x20?',_0x1682ab[_0x770a('0x71')]['id'])['toParam']();return db['sequelize']['query'](_0x25a17a[_0x770a('0x72')],{'replacements':_0x25a17a['values']});}})['then'](function(){if(_0x1682ab['body'][_0x770a('0x73')]&&_0x53f509){return db[_0x770a('0x3a')][_0x770a('0x14')]({'phone':_0x1682ab[_0x770a('0x33')][_0x770a('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x53f509['id']}});}})['then'](function(){return _0x53f509;})[_0x770a('0x16')](respondWithResult(_0x41da39,null))[_0x770a('0x22')](handleError(_0x41da39,null));};exports[_0x770a('0x74')]=function(_0x4e081e,_0x223c48){var _0x4d8176={};var _0x1673a7={};var _0x5063fd;var _0x28069e;return db[_0x770a('0x21')][_0x770a('0x75')]({'where':{'id':_0x4e081e['params']['id']}})[_0x770a('0x16')](handleEntityNotFound(_0x223c48,null))[_0x770a('0x16')](function(_0x2499a2){if(_0x2499a2){_0x5063fd=_0x2499a2;_0x1673a7[_0x770a('0x76')]=_[_0x770a('0x24')](db[_0x770a('0x5e')][_0x770a('0x77')]);_0x1673a7[_0x770a('0x1f')]=_[_0x770a('0x24')](_0x4e081e[_0x770a('0x1f')]);_0x1673a7[_0x770a('0x78')]=_[_0x770a('0x79')](_0x1673a7[_0x770a('0x76')],_0x1673a7[_0x770a('0x1f')]);_0x4d8176[_0x770a('0x7a')]=_[_0x770a('0x79')](_0x1673a7[_0x770a('0x76')],qs['fields'](_0x4e081e['query'][_0x770a('0x7b')]));_0x4d8176[_0x770a('0x7a')]=_0x4d8176['attributes'][_0x770a('0x25')]?_0x4d8176[_0x770a('0x7a')]:_0x1673a7[_0x770a('0x76')];_0x4d8176['order']=qs[_0x770a('0x7c')](_0x4e081e[_0x770a('0x1f')][_0x770a('0x7c')]);_0x4d8176[_0x770a('0x69')]=qs['filters'](_[_0x770a('0x7d')](_0x4e081e[_0x770a('0x1f')],_0x1673a7[_0x770a('0x78')]));if(_0x4e081e[_0x770a('0x1f')][_0x770a('0x7e')]){_0x4d8176[_0x770a('0x69')]=_[_0x770a('0x32')](_0x4d8176[_0x770a('0x69')],{'$or':_[_0x770a('0x6b')](_0x4d8176['attributes'],function(_0x29e7b0){var _0x413923={};_0x413923[_0x29e7b0]={'$like':'%'+_0x4e081e[_0x770a('0x1f')][_0x770a('0x7e')]+'%'};return _0x413923;})});}_0x4d8176=_[_0x770a('0x32')]({},_0x4d8176,_0x4e081e['options']);return _0x5063fd[_0x770a('0x74')](_0x4d8176);}})['then'](function(_0x26dfbb){if(_0x26dfbb){_0x28069e=_0x26dfbb[_0x770a('0x25')];if(!_0x4e081e['query'][_0x770a('0x31')]('nolimit')){_0x4d8176[_0x770a('0x10')]=qs[_0x770a('0x10')](_0x4e081e['query'][_0x770a('0x10')]);_0x4d8176[_0x770a('0xe')]=qs[_0x770a('0xe')](_0x4e081e[_0x770a('0x1f')]['offset']);}return _0x5063fd['getTags'](_0x4d8176);}})[_0x770a('0x16')](function(_0x304bb2){if(_0x304bb2){return _0x304bb2?{'count':_0x28069e,'rows':_0x304bb2}:null;}})['then'](respondWithResult(_0x223c48,null))[_0x770a('0x22')](handleError(_0x223c48,null));};exports['setTags']=function(_0x5e6412,_0x1b99ba){if(_0x5e6412[_0x770a('0x33')]['id']){delete _0x5e6412[_0x770a('0x33')]['id'];}return db[_0x770a('0x21')][_0x770a('0x75')]({'where':{'id':_0x5e6412[_0x770a('0x71')]['id']}})[_0x770a('0x16')](handleEntityNotFound(_0x1b99ba,null))[_0x770a('0x16')](function(_0x70bd29){if(_0x70bd29){return _0x70bd29['setTags'](_0x5e6412[_0x770a('0x33')][_0x770a('0x7f')]||[]);}return null;})[_0x770a('0x16')](respondWithResult(_0x1b99ba,null))[_0x770a('0x22')](handleError(_0x1b99ba,null));};exports['setAdditionalPhones']=function(_0x3ae8c6,_0x165898){var _0x3ad4a8=[];_0x3ad4a8[_0x770a('0x58')](addAdditionalPhones(_0x3ae8c6[_0x770a('0x33')]));Promise[_0x770a('0x80')](_0x3ad4a8)[_0x770a('0x16')](function(){_0x3ad4a8=[];_0x3ad4a8[_0x770a('0x58')](deleteCmHopperPhones(_0x3ae8c6[_0x770a('0x33')]['id']));_0x3ad4a8[_0x770a('0x58')](addCmHopperPhones(_0x3ae8c6[_0x770a('0x33')]['id']));Promise[_0x770a('0x80')](_0x3ad4a8)[_0x770a('0x16')](function(){return[0x1];})[_0x770a('0x16')](respondWithResult(_0x165898,null));});};function addAdditionalPhones(_0x375ab8){var _0x37cfdf;return new Promise(function(_0x460040){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x375ab8['id']}})[_0x770a('0x16')](function(){db[_0x770a('0x64')][_0x770a('0x1e')]({'raw':!![],'attributes':['id',_0x770a('0x81')]})[_0x770a('0x16')](function(_0x5c116f){var _0x229481=[];for(var _0x8c929f=0x0;_0x8c929f<_0x375ab8[_0x770a('0x82')][_0x770a('0x25')];_0x8c929f++){var _0x537a6a=_0x375ab8[_0x770a('0x83')]?_['isNil'](_0x375ab8[_0x770a('0x83')][_0x8c929f])?'':_0x375ab8['item_types'][_0x8c929f]:_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x84')]?_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x84')]:'';var _0x144462=_[_0x770a('0x50')](_0x375ab8['items'][_0x8c929f]['description'])?'':_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x85')];var _0x2d078e=_0x537a6a+':'+_0x375ab8['items'][_0x8c929f][_0x770a('0x73')]+'§'+_0x144462;if(_[_0x770a('0x50')](_0x37cfdf))_0x37cfdf=_0x2d078e;else _0x37cfdf+=';'+_0x2d078e;var _0x46cd88=null;var _0x3eb044=null;if(_0x375ab8[_0x770a('0x83')]){if(!_[_0x770a('0x50')](_0x375ab8[_0x770a('0x83')][_0x8c929f])){_0x3eb044=_['find'](_0x5c116f,function(_0x42e1a8){return _0x42e1a8['id']===_0x375ab8[_0x770a('0x83')][_0x8c929f];});if(!_[_0x770a('0x50')](_0x3eb044)){_0x46cd88=_0x3eb044[_0x770a('0x81')];}}}else{if(!_[_0x770a('0x50')](_0x375ab8[_0x770a('0x82')][_0x8c929f])){_0x3eb044=_['find'](_0x5c116f,function(_0x4c951c){return _0x4c951c['id']===_0x375ab8['items'][_0x8c929f][_0x770a('0x84')];});if(!_[_0x770a('0x50')](_0x3eb044)){_0x46cd88=_0x8c929f;}}}if(_['isNil'](_0x46cd88)){_0x46cd88=0x64;}_0x229481[_0x770a('0x58')](addAdditionalPhone(_0x375ab8['id'],_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x73')],_0x375ab8[_0x770a('0x83')]?_[_0x770a('0x50')](_0x375ab8['item_types'][_0x8c929f])?null:_0x375ab8[_0x770a('0x83')][_0x8c929f]:_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x84')]?_0x375ab8[_0x770a('0x82')][_0x8c929f][_0x770a('0x84')]:null,_0x46cd88,_0x144462));}Promise[_0x770a('0x80')](_0x229481)[_0x770a('0x16')](function(){db['CmContact'][_0x770a('0x14')]({'AdditionalPhones':_0x37cfdf},{'where':{'id':_0x375ab8['id']}})['then'](function(){_0x460040(0x1);});});});});});}function addAdditionalPhone(_0x6a68ed,_0x418bb6,_0x884381,_0x369523,_0x2995c1){return db[_0x770a('0x44')][_0x770a('0x5d')]({'where':{'CmContactId':_0x6a68ed,'item':_0x418bb6}})[_0x770a('0x16')](function(_0x49f17c){if(_0x49f17c)logger['info'](_0x770a('0x86'),_0x49f17c);else{db[_0x770a('0x44')][_0x770a('0x4e')]({'CmContactId':_0x6a68ed,'item':_0x418bb6,'ItemTypeId':_0x884381,'OrderBy':_0x369523,'ItemClass':_0x770a('0x87'),'description':_0x2995c1});}});}function deleteCmHopperPhones(_0x200087){return new Promise(function(_0x5be3db){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x200087}})['then'](function(_0x1ea75c){db[_0x770a('0x88')][_0x770a('0x15')]({'where':{'CmHopperId':{'$in':_[_0x770a('0x6b')](_0x1ea75c,'id')}}});})[_0x770a('0x16')](function(){_0x5be3db(0x1);});});}function addCmHopperPhones(_0x2d3387){return new Promise(function(_0xc8f733){return db[_0x770a('0x3a')][_0x770a('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2d3387}})[_0x770a('0x16')](function(_0x5b3a4c){var _0x3bce99=[];_[_0x770a('0x6b')](_0x5b3a4c,function(_0xb92a5f){_0x3bce99['push'](createCmHopperPhone(_0x2d3387,_0xb92a5f['id']));});Promise[_0x770a('0x80')](_0x3bce99)[_0x770a('0x16')](function(){_0xc8f733(0x1);});});});}function createCmHopperPhone(_0x151614,_0x52613f){return new Promise(function(_0x5499bf){db[_0x770a('0x44')][_0x770a('0x1e')]({'raw':!![],'attributes':[_0x770a('0x89'),_0x770a('0x81')],'where':{'CmContactId':_0x151614,'ItemClass':_0x770a('0x87')},'include':[{'model':db[_0x770a('0x64')],'attributes':[_0x770a('0x81')],'as':'ItemType'}],'order':[_0x770a('0x81'),db[_0x770a('0x66')]['literal']('`ItemType`.OrderBy')]})['then'](function(_0x1b47b6){var _0x3c4ef5=0x1;var _0x16a9f6=_['map'](_0x1b47b6,function(_0x2e7894){_0x2e7894[_0x770a('0x8a')]=_0x52613f;_0x2e7894[_0x770a('0x73')]=_0x2e7894['item'];_0x2e7894['OrderBy']=_0x3c4ef5;delete _0x2e7894['ItemType.OrderBy'];_0x3c4ef5=_0x3c4ef5+0x1;return _0x2e7894;});return db[_0x770a('0x88')][_0x770a('0x54')](_0x16a9f6,{});})['then'](function(){_0x5499bf(0x1);});});}function insertAdditionalPhones(_0x37f861,_0x488db){return new Promise(function(_0x1d4e7a){var _0x498ff4=[];for(var _0x5ece15=0x0;_0x5ece15<_0x488db[_0x770a('0x25')];_0x5ece15++){var _0x58207b=_0x488db[_0x5ece15];_0x498ff4['push'](parseContactItemType(_0x58207b));}Promise[_0x770a('0x80')](_0x498ff4)['then'](function(){var _0x245021={'id':_0x37f861['id'],'items':_0x488db};return addAdditionalPhones(_0x245021)[_0x770a('0x16')](function(){return addCmHopperPhones(_0x37f861['id']);});})[_0x770a('0x16')](function(){_0x1d4e7a(_0x37f861);});});}function parseContactItemType(_0x50cdbf){return new Promise(function(_0xd06add){if(_0x50cdbf['hasOwnProperty'](_0x770a('0x84'))){_0xd06add(_0x50cdbf);}else{return db[_0x770a('0x64')][_0x770a('0x5d')]({'where':{'name':_0x50cdbf[_0x770a('0x65')]}})['then'](function(_0x411da4){if(_[_0x770a('0x50')](_0x411da4))_0x50cdbf[_0x770a('0x84')]=null;else _0x50cdbf[_0x770a('0x84')]=_0x411da4['id'];_0xd06add(_0x50cdbf);});}});}exports[_0x770a('0x8b')]=function(_0x43c9a2,_0x2e35bc){return db[_0x770a('0x44')][_0x770a('0x1e')]({'raw':!![],'where':{'CmContactId':_0x43c9a2[_0x770a('0x71')]['id'],'ItemClass':_0x770a('0x87')},'include':[{'model':db[_0x770a('0x64')],'as':_0x770a('0x65')}],'order':[['OrderBy'],[db['sequelize'][_0x770a('0x67')](_0x770a('0x8c'))]]})['then'](function(_0x32ec8d){return _0x32ec8d;})[_0x770a('0x16')](respondWithResult(_0x2e35bc,null))['catch'](handleError(_0x2e35bc,null));};exports[_0x770a('0x8d')]=function(_0x288020,_0x22069e){return db[_0x770a('0x44')][_0x770a('0x1e')]({'raw':!![],'where':{'CmContactId':_0x288020['body'][_0x770a('0x8e')]}})['then'](function(_0x572f5c){var _0x321fb1=_['map'](_0x572f5c,function(_0x542ed6){_0x542ed6['CmContactId']=_0x288020[_0x770a('0x33')]['toContactId'];return _0x542ed6;});return db[_0x770a('0x44')][_0x770a('0x54')](_0x321fb1,{});})[_0x770a('0x16')](function(){return addCmHopperPhones(_0x288020['body'][_0x770a('0x8f')]);})[_0x770a('0x16')](function(){return['ok'];})[_0x770a('0x16')](respondWithResult(_0x22069e,null))[_0x770a('0x22')](handleError(_0x22069e,null));};exports[_0x770a('0x90')]=function(_0x508d3f,_0xdfe566){var _0x22f85f=[];_0x22f85f[_0x770a('0x58')](createCmHopperPhone(_0x508d3f[_0x770a('0x33')]['id'],_0x508d3f['body'][_0x770a('0x91')]));Promise[_0x770a('0x80')](_0x22f85f)[_0x770a('0x16')](function(){return[0x1];})[_0x770a('0x16')](respondWithResult(_0xdfe566,null));};exports['getHoppers']=function(_0x1305fb,_0x544a95){var _0x2a2dff={'raw':![],'where':{}};var _0x360e09={};var _0x167ab6={'count':0x0,'rows':[]};return db[_0x770a('0x21')][_0x770a('0x75')]({'where':{'id':_0x1305fb[_0x770a('0x71')]['id']}})[_0x770a('0x16')](handleEntityNotFound(_0x544a95,null))['then'](function(_0x3a54c7){if(_0x3a54c7){_0x360e09[_0x770a('0x76')]=_[_0x770a('0x24')](db[_0x770a('0x3a')][_0x770a('0x77')]);_0x360e09[_0x770a('0x1f')]=_[_0x770a('0x24')](_0x1305fb[_0x770a('0x1f')]);_0x360e09[_0x770a('0x78')]=_[_0x770a('0x79')](_0x360e09[_0x770a('0x76')],_0x360e09[_0x770a('0x1f')]);_0x2a2dff['attributes']=_[_0x770a('0x79')](_0x360e09[_0x770a('0x76')],qs[_0x770a('0x7b')](_0x1305fb[_0x770a('0x1f')][_0x770a('0x7b')]));_0x2a2dff[_0x770a('0x7a')]=_0x2a2dff[_0x770a('0x7a')]['length']?_0x2a2dff['attributes']:_0x360e09[_0x770a('0x76')];if(!_0x1305fb[_0x770a('0x1f')][_0x770a('0x31')](_0x770a('0x92'))){_0x2a2dff[_0x770a('0x10')]=qs[_0x770a('0x10')](_0x1305fb[_0x770a('0x1f')][_0x770a('0x10')]);_0x2a2dff['offset']=qs[_0x770a('0xe')](_0x1305fb[_0x770a('0x1f')][_0x770a('0xe')]);}_0x2a2dff[_0x770a('0x93')]=qs['sort'](_0x1305fb[_0x770a('0x1f')][_0x770a('0x7c')]);_0x2a2dff[_0x770a('0x69')]=qs[_0x770a('0x78')](_['pick'](_0x1305fb[_0x770a('0x1f')],_0x360e09['filters']));_0x2a2dff[_0x770a('0x69')]['ContactId']=_0x3a54c7['id'];if(_0x1305fb[_0x770a('0x1f')]['filter']){_0x2a2dff[_0x770a('0x69')]=_['merge'](_0x2a2dff['where'],{'$or':_[_0x770a('0x6b')](_0x2a2dff[_0x770a('0x7a')],function(_0x1a73eb){var _0x55bb30={};_0x55bb30[_0x1a73eb]={'$like':'%'+_0x1305fb['query']['filter']+'%'};return _0x55bb30;})});}_0x2a2dff=_[_0x770a('0x32')]({},_0x2a2dff,_0x1305fb[_0x770a('0x94')]);return db[_0x770a('0x3a')][_0x770a('0x11')]({'where':_0x2a2dff[_0x770a('0x69')]})[_0x770a('0x16')](function(_0x107bf0){_0x167ab6['count']=_0x107bf0;if(_0x1305fb['query'][_0x770a('0x95')]){_0x2a2dff[_0x770a('0x96')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2a2dff);})[_0x770a('0x16')](function(_0x489de3){_0x167ab6['rows']=_0x489de3;return _0x167ab6;});}})[_0x770a('0x16')](respondWithFilteredResult(_0x544a95,_0x2a2dff))[_0x770a('0x22')](handleError(_0x544a95,null));};exports[_0x770a('0x97')]=function(_0x1e817a,_0x462bcc){var _0x1d16c2={'raw':!![],'where':{}};var _0x4a7d23={};var _0xcd0b68={'count':0x0,'rows':[]};return db['CmContact'][_0x770a('0x75')]({'where':{'id':_0x1e817a[_0x770a('0x71')]['id']}})['then'](handleEntityNotFound(_0x462bcc,null))['then'](function(_0x36f4d5){if(_0x36f4d5){_0x4a7d23[_0x770a('0x76')]=_['keys'](db[_0x770a('0x45')]['rawAttributes']);_0x4a7d23[_0x770a('0x1f')]=_['keys'](_0x1e817a[_0x770a('0x1f')]);_0x4a7d23['filters']=_['intersection'](_0x4a7d23[_0x770a('0x76')],_0x4a7d23['query']);_0x1d16c2[_0x770a('0x7a')]=_[_0x770a('0x79')](_0x4a7d23[_0x770a('0x76')],qs[_0x770a('0x7b')](_0x1e817a[_0x770a('0x1f')]['fields']));_0x1d16c2[_0x770a('0x7a')]=_0x1d16c2[_0x770a('0x7a')][_0x770a('0x25')]?_0x1d16c2[_0x770a('0x7a')]:_0x4a7d23[_0x770a('0x76')];if(!_0x1e817a[_0x770a('0x1f')][_0x770a('0x31')](_0x770a('0x92'))){_0x1d16c2[_0x770a('0x10')]=qs[_0x770a('0x10')](_0x1e817a[_0x770a('0x1f')][_0x770a('0x10')]);_0x1d16c2['offset']=qs[_0x770a('0xe')](_0x1e817a['query'][_0x770a('0xe')]);}_0x1d16c2[_0x770a('0x93')]=qs[_0x770a('0x7c')](_0x1e817a[_0x770a('0x1f')][_0x770a('0x7c')]);_0x1d16c2[_0x770a('0x69')]=qs[_0x770a('0x78')](_[_0x770a('0x7d')](_0x1e817a[_0x770a('0x1f')],_0x4a7d23['filters']));_0x1d16c2['where']['ContactId']=_0x36f4d5['id'];if(_0x1e817a[_0x770a('0x1f')]['filter']){_0x1d16c2[_0x770a('0x69')]=_['merge'](_0x1d16c2[_0x770a('0x69')],{'$or':_[_0x770a('0x6b')](_0x1d16c2[_0x770a('0x7a')],function(_0x52cde2){var _0x34ecde={};_0x34ecde[_0x52cde2]={'$like':'%'+_0x1e817a[_0x770a('0x1f')][_0x770a('0x7e')]+'%'};return _0x34ecde;})});}_0x1d16c2=_['merge']({},_0x1d16c2,_0x1e817a['options']);return db[_0x770a('0x45')]['count']({'where':_0x1d16c2['where']})[_0x770a('0x16')](function(_0x1c6f60){_0xcd0b68['count']=_0x1c6f60;if(_0x1e817a[_0x770a('0x1f')][_0x770a('0x95')]){_0x1d16c2['include']=[{'all':!![]}];}return db[_0x770a('0x45')][_0x770a('0x1e')](_0x1d16c2);})[_0x770a('0x16')](function(_0x54e5e6){_0xcd0b68[_0x770a('0x98')]=_0x54e5e6;return _0xcd0b68;});}})[_0x770a('0x16')](respondWithFilteredResult(_0x462bcc,_0x1d16c2))['catch'](handleError(_0x462bcc,null));};exports[_0x770a('0x99')]=function(_0x20591e,_0x4815ff){var _0x324568={'raw':!![],'where':{}};var _0x39fd81={};var _0x37c61b={'count':0x0,'rows':[]};return db[_0x770a('0x21')][_0x770a('0x75')]({'where':{'id':_0x20591e[_0x770a('0x71')]['id']}})['then'](handleEntityNotFound(_0x4815ff,null))[_0x770a('0x16')](function(_0xa4592d){if(_0xa4592d){_0x39fd81[_0x770a('0x76')]=_[_0x770a('0x24')](db[_0x770a('0x9a')][_0x770a('0x77')]);_0x39fd81[_0x770a('0x1f')]=_[_0x770a('0x24')](_0x20591e[_0x770a('0x1f')]);_0x39fd81[_0x770a('0x78')]=_[_0x770a('0x79')](_0x39fd81[_0x770a('0x76')],_0x39fd81[_0x770a('0x1f')]);_0x324568[_0x770a('0x7a')]=_[_0x770a('0x79')](_0x39fd81['model'],qs[_0x770a('0x7b')](_0x20591e[_0x770a('0x1f')]['fields']));_0x324568[_0x770a('0x7a')]=_0x324568[_0x770a('0x7a')][_0x770a('0x25')]?_0x324568[_0x770a('0x7a')]:_0x39fd81[_0x770a('0x76')];if(!_0x20591e['query']['hasOwnProperty']('nolimit')){_0x324568[_0x770a('0x10')]=qs[_0x770a('0x10')](_0x20591e[_0x770a('0x1f')][_0x770a('0x10')]);_0x324568['offset']=qs[_0x770a('0xe')](_0x20591e[_0x770a('0x1f')][_0x770a('0xe')]);}_0x324568[_0x770a('0x93')]=qs[_0x770a('0x7c')](_0x20591e[_0x770a('0x1f')]['sort']);_0x324568[_0x770a('0x69')]=qs[_0x770a('0x78')](_[_0x770a('0x7d')](_0x20591e['query'],_0x39fd81[_0x770a('0x78')]));_0x324568[_0x770a('0x69')][_0x770a('0x9b')]=_0xa4592d['id'];if(_0x20591e[_0x770a('0x1f')]['filter']){_0x324568[_0x770a('0x69')]=_['merge'](_0x324568['where'],{'$or':_[_0x770a('0x6b')](_0x324568[_0x770a('0x7a')],function(_0x58b3d1){var _0x2f65f2={};_0x2f65f2[_0x58b3d1]={'$like':'%'+_0x20591e[_0x770a('0x1f')][_0x770a('0x7e')]+'%'};return _0x2f65f2;})});}_0x324568=_[_0x770a('0x32')]({},_0x324568,_0x20591e[_0x770a('0x94')]);return db[_0x770a('0x9a')][_0x770a('0x11')]({'where':_0x324568[_0x770a('0x69')]})[_0x770a('0x16')](function(_0x162a1a){_0x37c61b[_0x770a('0x11')]=_0x162a1a;if(_0x20591e[_0x770a('0x1f')][_0x770a('0x95')]){_0x324568[_0x770a('0x96')]=[{'all':!![]}];}return db[_0x770a('0x9a')]['findAll'](_0x324568);})['then'](function(_0x554a70){_0x37c61b[_0x770a('0x98')]=_0x554a70;return _0x37c61b;});}})['then'](respondWithFilteredResult(_0x4815ff,_0x324568))[_0x770a('0x22')](handleError(_0x4815ff,null));};exports['getJscriptySessions']=function(_0x3f6c4c,_0x362574){var _0xd483c6={'raw':!![],'where':{}};var _0x4eec53={};var _0x3f9032={'count':0x0,'rows':[]};return db[_0x770a('0x21')]['findOne']({'where':{'id':_0x3f6c4c[_0x770a('0x71')]['id']}})['then'](handleEntityNotFound(_0x362574,null))[_0x770a('0x16')](function(_0x1f701a){if(_0x1f701a){_0x4eec53[_0x770a('0x76')]=_['keys'](db[_0x770a('0x9c')]['rawAttributes']);_0x4eec53[_0x770a('0x1f')]=_[_0x770a('0x24')](_0x3f6c4c['query']);_0x4eec53[_0x770a('0x78')]=_[_0x770a('0x79')](_0x4eec53[_0x770a('0x76')],_0x4eec53[_0x770a('0x1f')]);_0xd483c6[_0x770a('0x7a')]=_[_0x770a('0x79')](_0x4eec53['model'],qs[_0x770a('0x7b')](_0x3f6c4c[_0x770a('0x1f')]['fields']));_0xd483c6[_0x770a('0x7a')]=_0xd483c6[_0x770a('0x7a')][_0x770a('0x25')]?_0xd483c6[_0x770a('0x7a')]:_0x4eec53[_0x770a('0x76')];if(!_0x3f6c4c[_0x770a('0x1f')]['hasOwnProperty'](_0x770a('0x92'))){_0xd483c6['limit']=qs[_0x770a('0x10')](_0x3f6c4c[_0x770a('0x1f')][_0x770a('0x10')]);_0xd483c6[_0x770a('0xe')]=qs[_0x770a('0xe')](_0x3f6c4c[_0x770a('0x1f')][_0x770a('0xe')]);}_0xd483c6[_0x770a('0x93')]=qs[_0x770a('0x7c')](_0x3f6c4c[_0x770a('0x1f')][_0x770a('0x7c')]);_0xd483c6[_0x770a('0x69')]=qs['filters'](_[_0x770a('0x7d')](_0x3f6c4c[_0x770a('0x1f')],_0x4eec53[_0x770a('0x78')]));_0xd483c6[_0x770a('0x69')][_0x770a('0x9b')]=_0x1f701a['id'];if(_0x3f6c4c[_0x770a('0x1f')]['filter']){_0xd483c6[_0x770a('0x69')]=_[_0x770a('0x32')](_0xd483c6['where'],{'$or':_['map'](_0xd483c6[_0x770a('0x7a')],function(_0x52cb09){var _0x1f0e78={};_0x1f0e78[_0x52cb09]={'$like':'%'+_0x3f6c4c[_0x770a('0x1f')]['filter']+'%'};return _0x1f0e78;})});}_0xd483c6=_['merge']({},_0xd483c6,_0x3f6c4c[_0x770a('0x94')]);return db['JscriptySessionReport']['count']({'where':_0xd483c6[_0x770a('0x69')]})[_0x770a('0x16')](function(_0x2585a4){_0x3f9032[_0x770a('0x11')]=_0x2585a4;if(_0x3f6c4c[_0x770a('0x1f')][_0x770a('0x95')]){_0xd483c6[_0x770a('0x96')]=[{'all':!![]}];}return db[_0x770a('0x9c')][_0x770a('0x1e')](_0xd483c6);})[_0x770a('0x16')](function(_0x53e167){_0x3f9032[_0x770a('0x98')]=_0x53e167;return _0x3f9032;});}})[_0x770a('0x16')](respondWithFilteredResult(_0x362574,_0xd483c6))[_0x770a('0x22')](handleError(_0x362574,null));};exports['uploadCsv']=function(_0x5782ba,_0x12d83e){try{if(!_0x5782ba['body']['ListId']){throw new Error(_0x770a('0x9d'));}if(!_0x5782ba[_0x770a('0x33')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x5782ba['body'][_0x770a('0x9e')]){throw new Error(_0x770a('0x9f'));}if(!_0x5782ba[_0x770a('0x33')][_0x770a('0xa0')]){throw new Error(_0x770a('0xa1'));}var _0x33eadc=_0x5782ba[_0x770a('0x33')][_0x770a('0xa2')][_0x770a('0xa3')](',');var _0x365aa3=_0x5782ba[_0x770a('0x33')]['binding_values'][_0x770a('0xa3')](',');if(!_0x33eadc[_0x770a('0x25')]||!_0x365aa3['length']||_0x33eadc[_0x770a('0x25')]!==_0x365aa3[_0x770a('0x25')]){throw new Error(_0x770a('0xa4'));}_0x5782ba[_0x770a('0x33')]['fields']=_[_0x770a('0xa5')](_0x33eadc,_0x365aa3);if(!_0x5782ba[_0x770a('0x33')][_0x770a('0x7b')][_0x770a('0x73')]){throw new Error(_0x770a('0xa6'));}if(!_0x5782ba[_0x770a('0x33')]['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0xb28901=path[_0x770a('0x38')](config[_0x770a('0xa7')],'server/files/tmp',_0x5782ba[_0x770a('0xa8')][_0x770a('0xa9')]);fs[_0x770a('0xaa')](_0xb28901,parseInt('0777',0x8));var _0x1cd658=require('child_process')[_0x770a('0xab')](path[_0x770a('0x38')](__dirname,'../../components/import/cm/csv'),[_0xb28901,_0x5782ba[_0x770a('0x33')][_0x770a('0xa2')],_0x5782ba[_0x770a('0x33')][_0x770a('0x9e')],_0x5782ba[_0x770a('0x33')]['ListId'],_0x5782ba['body'][_0x770a('0xac')],_0x5782ba['body']['duplicates'],_0x5782ba['body'][_0x770a('0xa0')]]);return _0x12d83e['status'](0xc8)[_0x770a('0xd')]({'message':_0x770a('0xad'),'pid':_0x1cd658[_0x770a('0xae')]});}catch(_0x122e5b){return _0x12d83e[_0x770a('0x12')](0x1f4)[_0x770a('0x1a')](_0x122e5b);}};exports[_0x770a('0xaf')]=function(_0x3824c3,_0x359837){var _0x2b340d=fs[_0x770a('0xb0')](_0x3824c3[_0x770a('0xa8')][_0x770a('0x1')]);Papa[_0x770a('0xb1')](_0x2b340d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x344435){return _0x359837[_0x770a('0x12')](0xc8)[_0x770a('0xd')]({'file':_0x3824c3[_0x770a('0xa8')],'fields':_0x344435['meta'][_0x770a('0x7b')]});}});};exports[_0x770a('0xb2')]=function(_0x2bec40,_0x1f8546){return db[_0x770a('0xb3')][_0x770a('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x770a('0x16')](function(_0x2228e6){var _0x1da85b=![];if(!_0x2bec40[_0x770a('0x33')]['ListId']){throw new Error(_0x770a('0x9d'));}if(!_0x2bec40[_0x770a('0x33')][_0x770a('0xb4')]['phone']){throw new Error(_0x770a('0xa6'));}if(!_0x2bec40['body'][_0x770a('0xb4')][_0x770a('0xb5')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x2bec40[_0x770a('0x33')][_0x770a('0xa0')]){throw new Error(_0x770a('0xa1'));}var _0x544762=require(_0x770a('0xb6'))[_0x770a('0xab')](path[_0x770a('0x38')](__dirname,_0x770a('0xb7')),[_0x2bec40[_0x770a('0x71')]['id'],JSON[_0x770a('0xb8')](_0x2bec40[_0x770a('0x33')]),JSON['stringify'](_0x2228e6)]);_0x544762['on']('message',function(){_0x1da85b=!![];return _0x1f8546['status'](0xc8)[_0x770a('0xd')]({'message':_0x770a('0xb9'),'pid':_0x544762[_0x770a('0xae')]});});_0x544762['on'](_0x770a('0xba'),function(_0x186aa5){if(_0x186aa5&&!_0x1da85b){return _0x1f8546['status'](0x1f4)[_0x770a('0xd')]({'message':_0x770a('0xbb'),'pid':_0x544762[_0x770a('0xae')]});}});})[_0x770a('0x22')](handleError(_0x1f8546,null));};exports['importUpdates']=function(_0x31531e,_0x4290e3){return db[_0x770a('0xb3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x770a('0xbc')}})[_0x770a('0x16')](function(_0x3489bb){var _0x1fae34=![];if(!_0x31531e[_0x770a('0x33')][_0x770a('0x59')]){throw new Error(_0x770a('0x9d'));}if(!_0x31531e[_0x770a('0x33')][_0x770a('0xb4')][_0x770a('0x73')]){throw new Error(_0x770a('0xa6'));}if(!_0x31531e[_0x770a('0x33')][_0x770a('0xb4')]['firstName']){throw new Error(_0x770a('0xbd'));}if(!_0x31531e['body'][_0x770a('0xa0')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2a2a35=require('child_process')[_0x770a('0xab')](path['join'](__dirname,_0x770a('0xbe')),[_0x31531e['params']['id'],JSON[_0x770a('0xb8')](_0x31531e[_0x770a('0x33')]),JSON[_0x770a('0xb8')](_0x3489bb)]);_0x2a2a35['on']('message',function(){_0x1fae34=!![];return _0x4290e3[_0x770a('0x12')](0xc8)['json']({'message':_0x770a('0xb9'),'pid':_0x2a2a35[_0x770a('0xae')]});});_0x2a2a35['on'](_0x770a('0xba'),function(_0x1ce991){if(_0x1ce991&&!_0x1fae34){return _0x4290e3[_0x770a('0x12')](0x1f4)['json']({'message':_0x770a('0xbb'),'pid':_0x2a2a35['pid']});}});})['catch'](handleError(_0x4290e3,null));};exports[_0x770a('0xbf')]=function(_0x2da26a,_0x10bf36){var _0xc80d3c=[_0x770a('0xc0'),_0x770a('0xc1'),'sms',_0x770a('0xc2'),'fax',_0x770a('0xc3'),_0x770a('0xc4')];var _0x545661={'offset':0x0,'order':qs['sort'](_0x770a('0xc5'))},_0x28d107={'count':0x0,'rows':[]};Promise[_0x770a('0xc6')]()['then'](function(){if(_0x2da26a[_0x770a('0x1f')][_0x770a('0xc7')]){if(!_['includes'](_0xc80d3c,_0x2da26a['query'][_0x770a('0xc7')][_0x770a('0xc8')]())){throw new Error(_0x770a('0xc9'));}_0xc80d3c=[_0x2da26a[_0x770a('0x1f')][_0x770a('0xc7')][_0x770a('0xc8')]()];}if(_0x2da26a['query'][_0x770a('0xca')]){try{var _0x4279b2=JSON[_0x770a('0xb1')](_0x2da26a[_0x770a('0x1f')][_0x770a('0xca')]);if(!moment(_0x4279b2[_0x770a('0x34')])[_0x770a('0xcb')]()){throw new Error(_0x770a('0xcc'));}if(!moment(_0x4279b2['to'])[_0x770a('0xcb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x1897af){throw new Error(_0x770a('0xcd'));}}if(!_0x2da26a['query'][_0x770a('0x31')](_0x770a('0x92'))){_0x545661[_0x770a('0x10')]=qs[_0x770a('0x10')](_0x2da26a[_0x770a('0x1f')][_0x770a('0x10')]||0xa);_0x545661['offset']=qs[_0x770a('0xe')](_0x2da26a['query'][_0x770a('0xe')]);}var _0x392a03=_0xc80d3c[_0x770a('0x6b')](function(_0x300015){if(_0x300015===_0x770a('0xc4')){var _0x1a3c9b={'attributes':['id',_0x770a('0xce'),'type',_0x770a('0xcf'),'destination',_0x770a('0xd0'),_0x770a('0xd1'),_0x770a('0xd2'),_0x770a('0xd3'),_0x770a('0xd4'),_0x770a('0xd5'),_0x770a('0xd6'),_0x770a('0xd7'),_0x770a('0xd8'),'UserId'],'where':{'ContactId':_0x2da26a[_0x770a('0x71')]['id']},'include':[{'model':db[_0x770a('0xb3')],'as':_0x770a('0xb3'),'attributes':['id',_0x770a('0x60'),_0x770a('0xd9'),_0x770a('0x2a')]}],'order':[[_0x770a('0xd5'),_0x770a('0xda')]]};if(_0x2da26a[_0x770a('0x1f')][_0x770a('0xca')]){_0x1a3c9b['where'][_0x770a('0xd5')]={'$gte':_0x4279b2[_0x770a('0x34')],'$lte':_0x4279b2['to']};}return db[_0x770a('0x47')][_0x770a('0xdb')](_0x1a3c9b)[_0x770a('0x16')](function(_0x3d515c){_0x28d107[_0x770a('0x11')]+=_0x3d515c['count'];return _['map'](_0x3d515c[_0x770a('0x98')],function(_0x2a84b3){var _0x21be40=_0x2a84b3['get']({'plain':!![]});_0x21be40['channel']=_0x300015;if(_0x21be40[_0x770a('0xb3')]){_0x21be40[_0x770a('0xb3')]={'id':_0x21be40[_0x770a('0xb3')]['id'],'name':_0x21be40[_0x770a('0xb3')][_0x770a('0x60')],'fullname':_0x21be40[_0x770a('0xb3')][_0x770a('0xd9')],'alias':_0x21be40[_0x770a('0xb3')][_0x770a('0x2a')]};}return _0x21be40;});});}else{var _0x50f317=_[_0x770a('0xdc')](_0x300015)+(_0x300015===_0x770a('0xc1')?_0x770a('0xdd'):'Account');var _0x3270cc={'attributes':['id',_0x770a('0xde'),_0x770a('0xdf'),_0x770a('0xd5'),'note',_0x770a('0xe0'),_0x770a('0xe1'),_0x770a('0xe2'),'UserId',_0x50f317+'Id'],'where':{'ContactId':_0x2da26a[_0x770a('0x71')]['id']},'include':[{'model':db[_0x50f317],'as':_0x770a('0xe3'),'attributes':['id','name',_0x770a('0xe4')]},{'model':db[_0x770a('0xb3')],'as':_0x770a('0xe5'),'attributes':['id','name',_0x770a('0xd9')]},{'model':db[_0x770a('0x5e')],'as':_0x770a('0x5f'),'attributes':['id','name',_0x770a('0x61')],'through':{'attributes':[]}}],'order':[['createdAt',_0x770a('0xda')]]};if(_0x2da26a['query'][_0x770a('0xca')]){_0x3270cc[_0x770a('0x69')]['createdAt']={'$gte':_0x4279b2['from'],'$lte':_0x4279b2['to']};}switch(_0x300015){case'chat':_0x3270cc[_0x770a('0x7a')]['push']('browserName',_0x770a('0xe6'),_0x770a('0xe7'),_0x770a('0xe8'),_0x770a('0xe9'),_0x770a('0xea'),_0x770a('0xeb'),_0x770a('0xec'),_0x770a('0xed'));break;case'mail':_0x3270cc[_0x770a('0x7a')]['push'](_0x770a('0xee'),_0x770a('0xef'));break;case _0x770a('0xc2'):_0x3270cc['attributes'][_0x770a('0x58')](_0x770a('0xf0'),_0x770a('0xf1'));break;}return db[_['startCase'](_0x300015)+_0x770a('0xf2')]['findAndCountAll'](_0x3270cc)[_0x770a('0x16')](function(_0x3c8a87){_0x28d107['count']+=_0x3c8a87['count'];return _[_0x770a('0x6b')](_0x3c8a87[_0x770a('0x98')],function(_0x27cef9){var _0x4309ad=_0x27cef9['get']({'plain':!![]});_0x4309ad[_0x770a('0xc7')]=_0x300015;if(_0x4309ad[_0x770a('0xe5')]){_0x4309ad[_0x770a('0xe5')]={'id':_0x4309ad[_0x770a('0xe5')]['id'],'name':_0x4309ad[_0x770a('0xe5')][_0x770a('0x60')],'fullname':_0x4309ad[_0x770a('0xe5')]['fullname']};}return _0x4309ad;});});}});return Promise[_0x770a('0x80')](_0x392a03);})['then'](function(_0x5b59d1){return _(_0x5b59d1)['flatten']()[_0x770a('0xf3')](_0x770a('0xd5'))['reverse']()[_0x770a('0xf4')]();})['then'](function(_0xbb6db6){_0x28d107['rows']=_0x545661['limit']?_0xbb6db6[_0x770a('0xf5')](_0x545661[_0x770a('0xe')],_0x545661['offset']+_0x545661[_0x770a('0x10')]):_0xbb6db6;return _0x28d107;})['then'](respondWithFilteredResult(_0x10bf36,_0x545661))[_0x770a('0x22')](handleError(_0x10bf36,null));}; \ No newline at end of file +var _0xe940=['CmContact','find','params','describe','tags','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','custom','type','values','info','hasOwnProperty','merge','body','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopperBlack','create','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','join','isNil','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','contact','all','show','Tag','Tags','color','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','omit','map','format','dialTimezone','$and','cf_%d','isEmpty','id\x20=\x20?','toParam','sequelize','text','phone','CmHopper','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','nolimit','getTags','setTags','findOne','ids','setAdditionalPhones','item_types','items','ItemTypeId','description','OrderBy','PHONE','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','options','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','server/files/tmp','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','file','import','User','agent','binding','firstName','fork','../../components/import/cm/csv2','message','pid','error\x20child\x20process','importUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','chat','fax','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','callerid','starttime','endtime','duration','userDisposition','userThirdDisposition','UserId','fullname','createdAt','alias','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','Owner','DESC','customerIp','customerPort','deviceModel','ratingType','ratingValue','referer','subject','substatus','openchannel','sortBy','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','sendStatus','error','name','send','index','getOptions','findAll','query','user','catch'];(function(_0x5674fc,_0x2b623b){var _0x2444a5=function(_0x19774c){while(--_0x19774c){_0x5674fc['push'](_0x5674fc['shift']());}};_0x2444a5(++_0x2b623b);}(_0xe940,0x1c9));var _0x0e94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe940[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x0e94('0x0'));var BPromise=require(_0x0e94('0x1'));var util=require(_0x0e94('0x2'));var path=require(_0x0e94('0x3'));var fs=require('fs');var _=require(_0x0e94('0x4'));var squel=require(_0x0e94('0x5'));var Papa=require(_0x0e94('0x6'));var Redis=require(_0x0e94('0x7'));var contacts=require(_0x0e94('0x8'));var qs=require(_0x0e94('0x9'));var logger=require(_0x0e94('0xa'))('api');var config=require(_0x0e94('0xb'));var shared=require(_0x0e94('0xc'));var db=require(_0x0e94('0xd'))['db'];config[_0x0e94('0xe')]=_[_0x0e94('0xf')](config[_0x0e94('0xe')],{'host':_0x0e94('0x10'),'port':0x18eb});var socket=require(_0x0e94('0x11'))(new Redis(config[_0x0e94('0xe')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x18bb77,_0x51e123){_0x51e123=_0x51e123||0xc8;return function(_0x307c08){if(_0x307c08){return _0x18bb77[_0x0e94('0x12')](_0x51e123)[_0x0e94('0x13')](_0x307c08);}};}function respondWithFilteredResult(_0x2caa37,_0x168f1b){return function(_0x50e5cd){if(_0x50e5cd){var _0x11d605=typeof _0x168f1b[_0x0e94('0x14')]===_0x0e94('0x15')&&typeof _0x168f1b[_0x0e94('0x16')]===_0x0e94('0x15');var _0x32b2aa=_0x50e5cd[_0x0e94('0x17')];var _0x575753=_0x11d605?0x0:_0x168f1b[_0x0e94('0x14')];var _0x524df0=_0x11d605?_0x50e5cd['count']:_0x168f1b[_0x0e94('0x14')]+_0x168f1b[_0x0e94('0x16')];var _0x5d99b1;if(_0x524df0>=_0x32b2aa){_0x524df0=_0x32b2aa;_0x5d99b1=0xc8;}else{_0x5d99b1=0xce;}_0x2caa37['status'](_0x5d99b1);return _0x2caa37[_0x0e94('0x18')](_0x0e94('0x19'),_0x575753+'-'+_0x524df0+'/'+_0x32b2aa)['json'](_0x50e5cd);}return null;};}function saveUpdates(_0x49c432){return function(_0x225776){if(_0x225776){return _0x225776['update'](_0x49c432)['then'](function(_0x4d0877){return _0x4d0877;});}return null;};}function removeEntity(_0x5df724){return function(_0x4a31bb){if(_0x4a31bb){return _0x4a31bb[_0x0e94('0x1a')]()[_0x0e94('0x1b')](function(){_0x5df724[_0x0e94('0x12')](0xcc)[_0x0e94('0x1c')]();});}};}function handleEntityNotFound(_0x355133){return function(_0x3986f7){if(!_0x3986f7){_0x355133[_0x0e94('0x1d')](0x194);}return _0x3986f7;};}function handleError(_0x19d2be,_0x6b4402){_0x6b4402=_0x6b4402||0x1f4;return function(_0x2f58ee){logger[_0x0e94('0x1e')](_0x2f58ee['stack']);if(_0x2f58ee[_0x0e94('0x1f')]){delete _0x2f58ee[_0x0e94('0x1f')];}_0x19d2be[_0x0e94('0x12')](_0x6b4402)[_0x0e94('0x20')](_0x2f58ee);};}exports[_0x0e94('0x21')]=function(_0x41d30c,_0x387563){var _0x3ac424={};return contacts['describe']()[_0x0e94('0x1b')](function(_0x599b2c){_0x3ac424=qs[_0x0e94('0x22')](_0x599b2c,_0x41d30c);return contacts[_0x0e94('0x23')](_0x41d30c[_0x0e94('0x24')],_0x41d30c[_0x0e94('0x25')],_0x3ac424,_0x599b2c);})[_0x0e94('0x1b')](respondWithFilteredResult(_0x387563,_0x3ac424))[_0x0e94('0x26')](handleError(_0x387563,null));};exports[_0x0e94('0x1a')]=function(_0x3a263f,_0x5d77c5){return db[_0x0e94('0x27')][_0x0e94('0x28')]({'where':{'id':_0x3a263f[_0x0e94('0x29')]['id']}})[_0x0e94('0x1b')](handleEntityNotFound(_0x5d77c5,null))[_0x0e94('0x1b')](removeEntity(_0x5d77c5,null))[_0x0e94('0x26')](handleError(_0x5d77c5,null));};exports[_0x0e94('0x2a')]=function(_0x3ea6ad,_0x2fa75d){return db[_0x0e94('0x27')]['describe']()[_0x0e94('0x1b')](function(_0x5aea28){delete _0x5aea28[_0x0e94('0x2b')];for(var _0xadd6dc=0x0;_0xadd6dc0x0){return new Promise(function(_0x56b762){var _0x151821=[];for(var _0xe94bd5=0x0;_0xe94bd5<_0x29ccb1[_0x0e94('0x2d')];_0xe94bd5++){_0x151821[_0x0e94('0x5e')](insertAdditionalPhones(_0x29ccb1[_0xe94bd5][_0x0e94('0x62')],_0x29ccb1[_0xe94bd5][_0x0e94('0x59')]));}Promise[_0x0e94('0x63')](_0x151821)[_0x0e94('0x1b')](function(){_0x56b762(0x1);});})[_0x0e94('0x1b')](function(){return{'success':_0x53ad5c,'failure':_0x26ffe2,'duplicates':_0x128269};});}else{return{'success':_0x53ad5c,'failure':_0x26ffe2,'duplicates':_0x128269};}}})['then'](respondWithResult(_0x209872,0xc9))[_0x0e94('0x26')](handleError(_0x209872,null));};exports[_0x0e94('0x64')]=function(_0x35d191,_0x1ddf03){var _0x42245c;return db[_0x0e94('0x27')][_0x0e94('0x2a')]()[_0x0e94('0x1b')](function(_0x3be7af){return db[_0x0e94('0x27')]['find']({'where':{'id':_0x35d191[_0x0e94('0x29')]['id']},'include':[{'model':db[_0x0e94('0x65')],'as':_0x0e94('0x66'),'attributes':['id',_0x0e94('0x1f'),_0x0e94('0x67')],'required':_0x35d191[_0x0e94('0x24')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0e94('0x68'),'where':{'CmContactId':_0x35d191[_0x0e94('0x29')]['id']},'required':![],'include':[{'model':db[_0x0e94('0x69')],'as':_0x0e94('0x6a')}]}],'order':[db['sequelize'][_0x0e94('0x6b')](_0x0e94('0x6c'))],'attributes':_['keys'](_0x3be7af)});})['then'](function(_0xc51bb7){if(!_[_0x0e94('0x56')](_0xc51bb7)){_0x42245c=_0xc51bb7[_0x0e94('0x3c')]({'plain':!![]});var _0x398c89={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xc51bb7&&_0xc51bb7[_0x0e94('0x5f')]){if(_0xc51bb7[_0x0e94('0x5f')]){_0x398c89['where']['$and']['push']({'ListId':{'$ne':_0xc51bb7['ListId']}});}}return db['CmCustomField'][_0x0e94('0x23')](_0x398c89);}})[_0x0e94('0x1b')](function(_0x122781){if(!_[_0x0e94('0x56')](_0x122781)){return _[_0x0e94('0x6d')](_0x42245c,_[_0x0e94('0x6e')](_0x122781,function(_0x200154){return util[_0x0e94('0x6f')]('cf_%d',_0x200154['id']);}));}})[_0x0e94('0x1b')](handleEntityNotFound(_0x1ddf03,null))['then'](respondWithResult(_0x1ddf03,null))[_0x0e94('0x26')](handleError(_0x1ddf03,null));};exports[_0x0e94('0x42')]=function(_0x3e9847,_0x130d98){var _0x28f991;if(_0x3e9847['body']['id']){delete _0x3e9847[_0x0e94('0x3a')]['id'];}if(!_['isNil'](_0x3e9847[_0x0e94('0x3a')][_0x0e94('0x70')])){var _0x4376e8=_0x3e9847[_0x0e94('0x3a')][_0x0e94('0x70')];if(!_[_0x0e94('0x56')](shared[_0x0e94('0x58')][_0x4376e8]))_0x3e9847[_0x0e94('0x3a')][_0x0e94('0x57')]=shared[_0x0e94('0x58')][_0x4376e8][_0x0e94('0x57')];}return db[_0x0e94('0x27')][_0x0e94('0x28')]({'where':{'id':_0x3e9847['params']['id']}})[_0x0e94('0x1b')](handleEntityNotFound(_0x130d98,null))[_0x0e94('0x1b')](saveUpdates(_0x3e9847['body'],null))[_0x0e94('0x1b')](function(_0x13ef69){_0x28f991=_0x13ef69;var _0x52d703={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x13ef69&&_0x13ef69[_0x0e94('0x5f')]){if(_0x13ef69[_0x0e94('0x5f')]){_0x52d703[_0x0e94('0x5d')][_0x0e94('0x71')][_0x0e94('0x5e')]({'ListId':{'$ne':_0x13ef69['ListId']}});}}return db[_0x0e94('0x32')][_0x0e94('0x23')](_0x52d703);})[_0x0e94('0x1b')](function(_0x32aec0){if(_0x32aec0){return _[_0x0e94('0x6d')](_['pickBy'](_0x3e9847[_0x0e94('0x3a')],function(_0x503481,_0x4353df){return _[_0x0e94('0x2e')](_0x4353df,'cf_');}),_['map'](_0x32aec0,function(_0x21724d){return util[_0x0e94('0x6f')](_0x0e94('0x72'),_0x21724d['id']);}));}})['then'](function(_0x477740){if(_0x477740&&!_[_0x0e94('0x73')](_0x477740)){var _0x2a5e06=squel[_0x0e94('0x42')]()['table']('cm_contacts')['setFields'](_0x477740)[_0x0e94('0x5d')](_0x0e94('0x74'),_0x3e9847[_0x0e94('0x29')]['id'])[_0x0e94('0x75')]();return db[_0x0e94('0x76')][_0x0e94('0x24')](_0x2a5e06[_0x0e94('0x77')],{'replacements':_0x2a5e06['values']});}})[_0x0e94('0x1b')](function(){if(_0x3e9847[_0x0e94('0x3a')][_0x0e94('0x78')]&&_0x28f991){return db[_0x0e94('0x79')][_0x0e94('0x42')]({'phone':_0x3e9847['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x28f991['id']}});}})[_0x0e94('0x1b')](function(){return _0x28f991;})[_0x0e94('0x1b')](respondWithResult(_0x130d98,null))[_0x0e94('0x26')](handleError(_0x130d98,null));};exports['getTags']=function(_0x2ab979,_0x2ade41){var _0xcb6986={};var _0xc44249={};var _0x15236a;var _0x38c1d7;return db[_0x0e94('0x27')]['findOne']({'where':{'id':_0x2ab979[_0x0e94('0x29')]['id']}})['then'](handleEntityNotFound(_0x2ade41,null))[_0x0e94('0x1b')](function(_0x2699b8){if(_0x2699b8){_0x15236a=_0x2699b8;_0xc44249[_0x0e94('0x7a')]=_['keys'](db[_0x0e94('0x65')][_0x0e94('0x7b')]);_0xc44249['query']=_['keys'](_0x2ab979[_0x0e94('0x24')]);_0xc44249[_0x0e94('0x7c')]=_[_0x0e94('0x7d')](_0xc44249[_0x0e94('0x7a')],_0xc44249['query']);_0xcb6986[_0x0e94('0x7e')]=_[_0x0e94('0x7d')](_0xc44249[_0x0e94('0x7a')],qs[_0x0e94('0x7f')](_0x2ab979[_0x0e94('0x24')][_0x0e94('0x7f')]));_0xcb6986[_0x0e94('0x7e')]=_0xcb6986[_0x0e94('0x7e')][_0x0e94('0x2d')]?_0xcb6986[_0x0e94('0x7e')]:_0xc44249[_0x0e94('0x7a')];_0xcb6986[_0x0e94('0x80')]=qs[_0x0e94('0x81')](_0x2ab979[_0x0e94('0x24')][_0x0e94('0x81')]);_0xcb6986[_0x0e94('0x5d')]=qs[_0x0e94('0x7c')](_[_0x0e94('0x82')](_0x2ab979[_0x0e94('0x24')],_0xc44249[_0x0e94('0x7c')]));if(_0x2ab979[_0x0e94('0x24')][_0x0e94('0x83')]){_0xcb6986[_0x0e94('0x5d')]=_['merge'](_0xcb6986[_0x0e94('0x5d')],{'$or':_[_0x0e94('0x6e')](_0xcb6986[_0x0e94('0x7e')],function(_0x120b45){var _0xa6a9de={};_0xa6a9de[_0x120b45]={'$like':'%'+_0x2ab979['query'][_0x0e94('0x83')]+'%'};return _0xa6a9de;})});}_0xcb6986=_[_0x0e94('0x39')]({},_0xcb6986,_0x2ab979['options']);return _0x15236a['getTags'](_0xcb6986);}})[_0x0e94('0x1b')](function(_0x3f7d24){if(_0x3f7d24){_0x38c1d7=_0x3f7d24[_0x0e94('0x2d')];if(!_0x2ab979[_0x0e94('0x24')][_0x0e94('0x38')](_0x0e94('0x84'))){_0xcb6986[_0x0e94('0x16')]=qs['limit'](_0x2ab979[_0x0e94('0x24')][_0x0e94('0x16')]);_0xcb6986[_0x0e94('0x14')]=qs[_0x0e94('0x14')](_0x2ab979[_0x0e94('0x24')][_0x0e94('0x14')]);}return _0x15236a[_0x0e94('0x85')](_0xcb6986);}})[_0x0e94('0x1b')](function(_0x11f41d){if(_0x11f41d){return _0x11f41d?{'count':_0x38c1d7,'rows':_0x11f41d}:null;}})[_0x0e94('0x1b')](respondWithResult(_0x2ade41,null))[_0x0e94('0x26')](handleError(_0x2ade41,null));};exports[_0x0e94('0x86')]=function(_0x3e2931,_0xbc61a8){if(_0x3e2931[_0x0e94('0x3a')]['id']){delete _0x3e2931[_0x0e94('0x3a')]['id'];}return db['CmContact'][_0x0e94('0x87')]({'where':{'id':_0x3e2931[_0x0e94('0x29')]['id']}})['then'](handleEntityNotFound(_0xbc61a8,null))[_0x0e94('0x1b')](function(_0x3138ed){if(_0x3138ed){return _0x3138ed[_0x0e94('0x86')](_0x3e2931[_0x0e94('0x3a')][_0x0e94('0x88')]||[]);}return null;})[_0x0e94('0x1b')](respondWithResult(_0xbc61a8,null))['catch'](handleError(_0xbc61a8,null));};exports[_0x0e94('0x89')]=function(_0x314c8c,_0x5f0a26){var _0x37e6a8=[];_0x37e6a8[_0x0e94('0x5e')](addAdditionalPhones(_0x314c8c[_0x0e94('0x3a')]));Promise[_0x0e94('0x63')](_0x37e6a8)[_0x0e94('0x1b')](function(){_0x37e6a8=[];_0x37e6a8[_0x0e94('0x5e')](deleteCmHopperPhones(_0x314c8c['body']['id']));_0x37e6a8['push'](addCmHopperPhones(_0x314c8c[_0x0e94('0x3a')]['id']));Promise[_0x0e94('0x63')](_0x37e6a8)[_0x0e94('0x1b')](function(){return[0x1];})['then'](respondWithResult(_0x5f0a26,null));});};function addAdditionalPhones(_0x48112f){var _0x56d0b0;return new Promise(function(_0x16a7c0){return db[_0x0e94('0x4c')][_0x0e94('0x1a')]({'where':{'CmContactId':_0x48112f['id']}})[_0x0e94('0x1b')](function(){db[_0x0e94('0x69')][_0x0e94('0x23')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x12c3e6){var _0x2e06f3=[];for(var _0x2d082a=0x0;_0x2d082a<_0x48112f['items'][_0x0e94('0x2d')];_0x2d082a++){var _0xa807cb=_0x48112f[_0x0e94('0x8a')]?_[_0x0e94('0x56')](_0x48112f[_0x0e94('0x8a')][_0x2d082a])?'':_0x48112f[_0x0e94('0x8a')][_0x2d082a]:_0x48112f[_0x0e94('0x8b')][_0x2d082a][_0x0e94('0x8c')]?_0x48112f['items'][_0x2d082a]['ItemTypeId']:'';var _0x526102=_[_0x0e94('0x56')](_0x48112f[_0x0e94('0x8b')][_0x2d082a]['description'])?'':_0x48112f[_0x0e94('0x8b')][_0x2d082a][_0x0e94('0x8d')];var _0x317e49=_0xa807cb+':'+_0x48112f['items'][_0x2d082a][_0x0e94('0x78')]+'§'+_0x526102;if(_['isNil'](_0x56d0b0))_0x56d0b0=_0x317e49;else _0x56d0b0+=';'+_0x317e49;var _0x32efa5=null;var _0x281710=null;if(_0x48112f[_0x0e94('0x8a')]){if(!_['isNil'](_0x48112f[_0x0e94('0x8a')][_0x2d082a])){_0x281710=_[_0x0e94('0x28')](_0x12c3e6,function(_0x176bb4){return _0x176bb4['id']===_0x48112f['item_types'][_0x2d082a];});if(!_[_0x0e94('0x56')](_0x281710)){_0x32efa5=_0x281710['OrderBy'];}}}else{if(!_[_0x0e94('0x56')](_0x48112f['items'][_0x2d082a])){_0x281710=_['find'](_0x12c3e6,function(_0x84e387){return _0x84e387['id']===_0x48112f[_0x0e94('0x8b')][_0x2d082a]['ItemTypeId'];});if(!_[_0x0e94('0x56')](_0x281710)){_0x32efa5=_0x2d082a;}}}if(_[_0x0e94('0x56')](_0x32efa5)){_0x32efa5=0x64;}_0x2e06f3[_0x0e94('0x5e')](addAdditionalPhone(_0x48112f['id'],_0x48112f['items'][_0x2d082a][_0x0e94('0x78')],_0x48112f[_0x0e94('0x8a')]?_[_0x0e94('0x56')](_0x48112f[_0x0e94('0x8a')][_0x2d082a])?null:_0x48112f[_0x0e94('0x8a')][_0x2d082a]:_0x48112f[_0x0e94('0x8b')][_0x2d082a]['ItemTypeId']?_0x48112f['items'][_0x2d082a][_0x0e94('0x8c')]:null,_0x32efa5,_0x526102));}Promise[_0x0e94('0x63')](_0x2e06f3)['then'](function(){db['CmContact']['update']({'AdditionalPhones':_0x56d0b0},{'where':{'id':_0x48112f['id']}})[_0x0e94('0x1b')](function(){_0x16a7c0(0x1);});});});});});}function addAdditionalPhone(_0x3ae32c,_0x41888a,_0x5c876a,_0x7ee7ec,_0x4f92f7){return db[_0x0e94('0x4c')][_0x0e94('0x28')]({'where':{'CmContactId':_0x3ae32c,'item':_0x41888a}})[_0x0e94('0x1b')](function(_0x354e09){if(_0x354e09)logger[_0x0e94('0x37')]('contact\x20phone\x20exists',_0x354e09);else{db[_0x0e94('0x4c')][_0x0e94('0x41')]({'CmContactId':_0x3ae32c,'item':_0x41888a,'ItemTypeId':_0x5c876a,'OrderBy':_0x7ee7ec,'ItemClass':'PHONE','description':_0x4f92f7});}});}function deleteCmHopperPhones(_0x43728c){return new Promise(function(_0x5df180){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x43728c}})[_0x0e94('0x1b')](function(_0x4a4021){db['CmHopperAdditionalPhone'][_0x0e94('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x0e94('0x6e')](_0x4a4021,'id')}}});})['then'](function(){_0x5df180(0x1);});});}function addCmHopperPhones(_0x2287e8){return new Promise(function(_0xe66882){return db['CmHopper'][_0x0e94('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2287e8}})[_0x0e94('0x1b')](function(_0x2f9ba5){var _0x8cf1a9=[];_[_0x0e94('0x6e')](_0x2f9ba5,function(_0x4ae9a3){_0x8cf1a9[_0x0e94('0x5e')](createCmHopperPhone(_0x2287e8,_0x4ae9a3['id']));});Promise[_0x0e94('0x63')](_0x8cf1a9)[_0x0e94('0x1b')](function(){_0xe66882(0x1);});});});}function createCmHopperPhone(_0x37e9ce,_0x46acfd){return new Promise(function(_0x372bb7){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':['item',_0x0e94('0x8e')],'where':{'CmContactId':_0x37e9ce,'ItemClass':_0x0e94('0x8f')},'include':[{'model':db[_0x0e94('0x69')],'attributes':[_0x0e94('0x8e')],'as':_0x0e94('0x6a')}],'order':[_0x0e94('0x8e'),db['sequelize'][_0x0e94('0x6b')](_0x0e94('0x90'))]})['then'](function(_0x1aceba){var _0x2d60ef=0x1;var _0x5ed0ed=_[_0x0e94('0x6e')](_0x1aceba,function(_0x4c9997){_0x4c9997[_0x0e94('0x91')]=_0x46acfd;_0x4c9997['phone']=_0x4c9997[_0x0e94('0x92')];_0x4c9997[_0x0e94('0x8e')]=_0x2d60ef;delete _0x4c9997[_0x0e94('0x93')];_0x2d60ef=_0x2d60ef+0x1;return _0x4c9997;});return db[_0x0e94('0x94')][_0x0e94('0x5a')](_0x5ed0ed,{});})[_0x0e94('0x1b')](function(){_0x372bb7(0x1);});});}function insertAdditionalPhones(_0x1b285e,_0x218a60){return new Promise(function(_0x118fbe){var _0x515aa5=[];for(var _0x1a8bc7=0x0;_0x1a8bc7<_0x218a60[_0x0e94('0x2d')];_0x1a8bc7++){var _0x717c63=_0x218a60[_0x1a8bc7];_0x515aa5[_0x0e94('0x5e')](parseContactItemType(_0x717c63));}Promise['all'](_0x515aa5)[_0x0e94('0x1b')](function(){var _0x231694={'id':_0x1b285e['id'],'items':_0x218a60};return addAdditionalPhones(_0x231694)['then'](function(){return addCmHopperPhones(_0x1b285e['id']);});})[_0x0e94('0x1b')](function(){_0x118fbe(_0x1b285e);});});}function parseContactItemType(_0x275d09){return new Promise(function(_0x488932){if(_0x275d09['hasOwnProperty'](_0x0e94('0x8c'))){_0x488932(_0x275d09);}else{return db[_0x0e94('0x69')]['find']({'where':{'name':_0x275d09[_0x0e94('0x6a')]}})[_0x0e94('0x1b')](function(_0x3b6569){if(_[_0x0e94('0x56')](_0x3b6569))_0x275d09[_0x0e94('0x8c')]=null;else _0x275d09['ItemTypeId']=_0x3b6569['id'];_0x488932(_0x275d09);});}});}exports[_0x0e94('0x95')]=function(_0x1ca689,_0x1173c0){return db[_0x0e94('0x4c')][_0x0e94('0x23')]({'raw':!![],'where':{'CmContactId':_0x1ca689[_0x0e94('0x29')]['id'],'ItemClass':_0x0e94('0x8f')},'include':[{'model':db[_0x0e94('0x69')],'as':'ItemType'}],'order':[[_0x0e94('0x8e')],[db[_0x0e94('0x76')]['literal'](_0x0e94('0x90'))]]})[_0x0e94('0x1b')](function(_0x301d0b){return _0x301d0b;})[_0x0e94('0x1b')](respondWithResult(_0x1173c0,null))[_0x0e94('0x26')](handleError(_0x1173c0,null));};exports[_0x0e94('0x96')]=function(_0x9c017e,_0x34ae64){return db[_0x0e94('0x4c')][_0x0e94('0x23')]({'raw':!![],'where':{'CmContactId':_0x9c017e['body'][_0x0e94('0x97')]}})[_0x0e94('0x1b')](function(_0x62fb31){var _0x5754c2=_[_0x0e94('0x6e')](_0x62fb31,function(_0x1c4f9f){_0x1c4f9f[_0x0e94('0x98')]=_0x9c017e[_0x0e94('0x3a')]['toContactId'];return _0x1c4f9f;});return db[_0x0e94('0x4c')][_0x0e94('0x5a')](_0x5754c2,{});})[_0x0e94('0x1b')](function(){return addCmHopperPhones(_0x9c017e[_0x0e94('0x3a')]['toContactId']);})['then'](function(){return['ok'];})[_0x0e94('0x1b')](respondWithResult(_0x34ae64,null))[_0x0e94('0x26')](handleError(_0x34ae64,null));};exports[_0x0e94('0x99')]=function(_0xbe3615,_0x16b330){var _0x3cefbf=[];_0x3cefbf[_0x0e94('0x5e')](createCmHopperPhone(_0xbe3615[_0x0e94('0x3a')]['id'],_0xbe3615['body'][_0x0e94('0x9a')]));Promise[_0x0e94('0x63')](_0x3cefbf)[_0x0e94('0x1b')](function(){return[0x1];})['then'](respondWithResult(_0x16b330,null));};exports[_0x0e94('0x9b')]=function(_0x4ddaad,_0x539a06){var _0x50e47a={'raw':![],'where':{}};var _0x526138={};var _0x561e15={'count':0x0,'rows':[]};return db[_0x0e94('0x27')][_0x0e94('0x87')]({'where':{'id':_0x4ddaad[_0x0e94('0x29')]['id']}})[_0x0e94('0x1b')](handleEntityNotFound(_0x539a06,null))[_0x0e94('0x1b')](function(_0x3b3138){if(_0x3b3138){_0x526138[_0x0e94('0x7a')]=_[_0x0e94('0x2c')](db[_0x0e94('0x79')][_0x0e94('0x7b')]);_0x526138[_0x0e94('0x24')]=_[_0x0e94('0x2c')](_0x4ddaad[_0x0e94('0x24')]);_0x526138['filters']=_[_0x0e94('0x7d')](_0x526138[_0x0e94('0x7a')],_0x526138[_0x0e94('0x24')]);_0x50e47a[_0x0e94('0x7e')]=_[_0x0e94('0x7d')](_0x526138[_0x0e94('0x7a')],qs['fields'](_0x4ddaad[_0x0e94('0x24')]['fields']));_0x50e47a['attributes']=_0x50e47a[_0x0e94('0x7e')][_0x0e94('0x2d')]?_0x50e47a[_0x0e94('0x7e')]:_0x526138[_0x0e94('0x7a')];if(!_0x4ddaad[_0x0e94('0x24')][_0x0e94('0x38')](_0x0e94('0x84'))){_0x50e47a['limit']=qs['limit'](_0x4ddaad['query'][_0x0e94('0x16')]);_0x50e47a[_0x0e94('0x14')]=qs[_0x0e94('0x14')](_0x4ddaad['query'][_0x0e94('0x14')]);}_0x50e47a[_0x0e94('0x80')]=qs[_0x0e94('0x81')](_0x4ddaad[_0x0e94('0x24')][_0x0e94('0x81')]);_0x50e47a[_0x0e94('0x5d')]=qs[_0x0e94('0x7c')](_['pick'](_0x4ddaad[_0x0e94('0x24')],_0x526138[_0x0e94('0x7c')]));_0x50e47a[_0x0e94('0x5d')][_0x0e94('0x9c')]=_0x3b3138['id'];if(_0x4ddaad[_0x0e94('0x24')][_0x0e94('0x83')]){_0x50e47a[_0x0e94('0x5d')]=_['merge'](_0x50e47a[_0x0e94('0x5d')],{'$or':_['map'](_0x50e47a[_0x0e94('0x7e')],function(_0x11b37d){var _0x2e838b={};_0x2e838b[_0x11b37d]={'$like':'%'+_0x4ddaad[_0x0e94('0x24')][_0x0e94('0x83')]+'%'};return _0x2e838b;})});}_0x50e47a=_['merge']({},_0x50e47a,_0x4ddaad['options']);return db['CmHopper'][_0x0e94('0x17')]({'where':_0x50e47a['where']})[_0x0e94('0x1b')](function(_0x53264c){_0x561e15[_0x0e94('0x17')]=_0x53264c;if(_0x4ddaad[_0x0e94('0x24')][_0x0e94('0x9d')]){_0x50e47a[_0x0e94('0x9e')]=[{'all':!![]}];}return db[_0x0e94('0x79')][_0x0e94('0x23')](_0x50e47a);})[_0x0e94('0x1b')](function(_0x6998ec){_0x561e15[_0x0e94('0x9f')]=_0x6998ec;return _0x561e15;});}})[_0x0e94('0x1b')](respondWithFilteredResult(_0x539a06,_0x50e47a))[_0x0e94('0x26')](handleError(_0x539a06,null));};exports[_0x0e94('0xa0')]=function(_0x21e828,_0x39136){var _0x43b7b0={'raw':!![],'where':{}};var _0x50883a={};var _0x11dd33={'count':0x0,'rows':[]};return db[_0x0e94('0x27')][_0x0e94('0x87')]({'where':{'id':_0x21e828['params']['id']}})['then'](handleEntityNotFound(_0x39136,null))[_0x0e94('0x1b')](function(_0x2a4773){if(_0x2a4773){_0x50883a[_0x0e94('0x7a')]=_['keys'](db[_0x0e94('0xa1')][_0x0e94('0x7b')]);_0x50883a[_0x0e94('0x24')]=_[_0x0e94('0x2c')](_0x21e828[_0x0e94('0x24')]);_0x50883a[_0x0e94('0x7c')]=_[_0x0e94('0x7d')](_0x50883a[_0x0e94('0x7a')],_0x50883a['query']);_0x43b7b0[_0x0e94('0x7e')]=_['intersection'](_0x50883a[_0x0e94('0x7a')],qs[_0x0e94('0x7f')](_0x21e828[_0x0e94('0x24')][_0x0e94('0x7f')]));_0x43b7b0['attributes']=_0x43b7b0[_0x0e94('0x7e')][_0x0e94('0x2d')]?_0x43b7b0[_0x0e94('0x7e')]:_0x50883a[_0x0e94('0x7a')];if(!_0x21e828[_0x0e94('0x24')][_0x0e94('0x38')](_0x0e94('0x84'))){_0x43b7b0[_0x0e94('0x16')]=qs[_0x0e94('0x16')](_0x21e828[_0x0e94('0x24')][_0x0e94('0x16')]);_0x43b7b0[_0x0e94('0x14')]=qs[_0x0e94('0x14')](_0x21e828[_0x0e94('0x24')][_0x0e94('0x14')]);}_0x43b7b0[_0x0e94('0x80')]=qs[_0x0e94('0x81')](_0x21e828['query'][_0x0e94('0x81')]);_0x43b7b0[_0x0e94('0x5d')]=qs['filters'](_[_0x0e94('0x82')](_0x21e828['query'],_0x50883a[_0x0e94('0x7c')]));_0x43b7b0['where']['ContactId']=_0x2a4773['id'];if(_0x21e828[_0x0e94('0x24')][_0x0e94('0x83')]){_0x43b7b0[_0x0e94('0x5d')]=_[_0x0e94('0x39')](_0x43b7b0[_0x0e94('0x5d')],{'$or':_['map'](_0x43b7b0[_0x0e94('0x7e')],function(_0x18b779){var _0x50995d={};_0x50995d[_0x18b779]={'$like':'%'+_0x21e828['query'][_0x0e94('0x83')]+'%'};return _0x50995d;})});}_0x43b7b0=_[_0x0e94('0x39')]({},_0x43b7b0,_0x21e828[_0x0e94('0xa2')]);return db[_0x0e94('0xa1')][_0x0e94('0x17')]({'where':_0x43b7b0[_0x0e94('0x5d')]})[_0x0e94('0x1b')](function(_0x5552a3){_0x11dd33[_0x0e94('0x17')]=_0x5552a3;if(_0x21e828[_0x0e94('0x24')]['includeAll']){_0x43b7b0[_0x0e94('0x9e')]=[{'all':!![]}];}return db[_0x0e94('0xa1')][_0x0e94('0x23')](_0x43b7b0);})[_0x0e94('0x1b')](function(_0x5cffbd){_0x11dd33[_0x0e94('0x9f')]=_0x5cffbd;return _0x11dd33;});}})['then'](respondWithFilteredResult(_0x39136,_0x43b7b0))[_0x0e94('0x26')](handleError(_0x39136,null));};exports[_0x0e94('0xa3')]=function(_0x1b94b8,_0x3911cd){var _0x30a3c8={'raw':!![],'where':{}};var _0x3c9549={};var _0x31b719={'count':0x0,'rows':[]};return db[_0x0e94('0x27')][_0x0e94('0x87')]({'where':{'id':_0x1b94b8[_0x0e94('0x29')]['id']}})[_0x0e94('0x1b')](handleEntityNotFound(_0x3911cd,null))[_0x0e94('0x1b')](function(_0x23f6cd){if(_0x23f6cd){_0x3c9549[_0x0e94('0x7a')]=_['keys'](db['CmHopperFinal'][_0x0e94('0x7b')]);_0x3c9549[_0x0e94('0x24')]=_[_0x0e94('0x2c')](_0x1b94b8[_0x0e94('0x24')]);_0x3c9549[_0x0e94('0x7c')]=_[_0x0e94('0x7d')](_0x3c9549[_0x0e94('0x7a')],_0x3c9549[_0x0e94('0x24')]);_0x30a3c8[_0x0e94('0x7e')]=_[_0x0e94('0x7d')](_0x3c9549['model'],qs[_0x0e94('0x7f')](_0x1b94b8[_0x0e94('0x24')]['fields']));_0x30a3c8[_0x0e94('0x7e')]=_0x30a3c8[_0x0e94('0x7e')][_0x0e94('0x2d')]?_0x30a3c8[_0x0e94('0x7e')]:_0x3c9549['model'];if(!_0x1b94b8[_0x0e94('0x24')][_0x0e94('0x38')](_0x0e94('0x84'))){_0x30a3c8['limit']=qs[_0x0e94('0x16')](_0x1b94b8['query']['limit']);_0x30a3c8[_0x0e94('0x14')]=qs[_0x0e94('0x14')](_0x1b94b8['query'][_0x0e94('0x14')]);}_0x30a3c8['order']=qs[_0x0e94('0x81')](_0x1b94b8[_0x0e94('0x24')][_0x0e94('0x81')]);_0x30a3c8['where']=qs[_0x0e94('0x7c')](_[_0x0e94('0x82')](_0x1b94b8[_0x0e94('0x24')],_0x3c9549[_0x0e94('0x7c')]));_0x30a3c8[_0x0e94('0x5d')]['ContactId']=_0x23f6cd['id'];if(_0x1b94b8[_0x0e94('0x24')][_0x0e94('0x83')]){_0x30a3c8[_0x0e94('0x5d')]=_[_0x0e94('0x39')](_0x30a3c8[_0x0e94('0x5d')],{'$or':_[_0x0e94('0x6e')](_0x30a3c8[_0x0e94('0x7e')],function(_0x71b37f){var _0x3f7c7b={};_0x3f7c7b[_0x71b37f]={'$like':'%'+_0x1b94b8[_0x0e94('0x24')][_0x0e94('0x83')]+'%'};return _0x3f7c7b;})});}_0x30a3c8=_[_0x0e94('0x39')]({},_0x30a3c8,_0x1b94b8['options']);return db[_0x0e94('0x4d')][_0x0e94('0x17')]({'where':_0x30a3c8['where']})[_0x0e94('0x1b')](function(_0x5216e0){_0x31b719['count']=_0x5216e0;if(_0x1b94b8[_0x0e94('0x24')][_0x0e94('0x9d')]){_0x30a3c8[_0x0e94('0x9e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0e94('0x23')](_0x30a3c8);})[_0x0e94('0x1b')](function(_0x1510ba){_0x31b719[_0x0e94('0x9f')]=_0x1510ba;return _0x31b719;});}})['then'](respondWithFilteredResult(_0x3911cd,_0x30a3c8))[_0x0e94('0x26')](handleError(_0x3911cd,null));};exports[_0x0e94('0xa4')]=function(_0x225258,_0x19eae4){var _0x58b6e9={'raw':!![],'where':{}};var _0x53f960={};var _0x4e6a5f={'count':0x0,'rows':[]};return db[_0x0e94('0x27')]['findOne']({'where':{'id':_0x225258[_0x0e94('0x29')]['id']}})[_0x0e94('0x1b')](handleEntityNotFound(_0x19eae4,null))[_0x0e94('0x1b')](function(_0x3edf6a){if(_0x3edf6a){_0x53f960['model']=_[_0x0e94('0x2c')](db[_0x0e94('0x52')][_0x0e94('0x7b')]);_0x53f960['query']=_[_0x0e94('0x2c')](_0x225258[_0x0e94('0x24')]);_0x53f960[_0x0e94('0x7c')]=_[_0x0e94('0x7d')](_0x53f960[_0x0e94('0x7a')],_0x53f960[_0x0e94('0x24')]);_0x58b6e9[_0x0e94('0x7e')]=_[_0x0e94('0x7d')](_0x53f960[_0x0e94('0x7a')],qs['fields'](_0x225258[_0x0e94('0x24')][_0x0e94('0x7f')]));_0x58b6e9[_0x0e94('0x7e')]=_0x58b6e9[_0x0e94('0x7e')][_0x0e94('0x2d')]?_0x58b6e9['attributes']:_0x53f960[_0x0e94('0x7a')];if(!_0x225258[_0x0e94('0x24')][_0x0e94('0x38')](_0x0e94('0x84'))){_0x58b6e9[_0x0e94('0x16')]=qs[_0x0e94('0x16')](_0x225258[_0x0e94('0x24')][_0x0e94('0x16')]);_0x58b6e9[_0x0e94('0x14')]=qs[_0x0e94('0x14')](_0x225258[_0x0e94('0x24')][_0x0e94('0x14')]);}_0x58b6e9['order']=qs[_0x0e94('0x81')](_0x225258[_0x0e94('0x24')][_0x0e94('0x81')]);_0x58b6e9[_0x0e94('0x5d')]=qs[_0x0e94('0x7c')](_[_0x0e94('0x82')](_0x225258[_0x0e94('0x24')],_0x53f960['filters']));_0x58b6e9['where'][_0x0e94('0x9c')]=_0x3edf6a['id'];if(_0x225258[_0x0e94('0x24')][_0x0e94('0x83')]){_0x58b6e9[_0x0e94('0x5d')]=_['merge'](_0x58b6e9[_0x0e94('0x5d')],{'$or':_[_0x0e94('0x6e')](_0x58b6e9[_0x0e94('0x7e')],function(_0x418bd7){var _0x2ae220={};_0x2ae220[_0x418bd7]={'$like':'%'+_0x225258[_0x0e94('0x24')]['filter']+'%'};return _0x2ae220;})});}_0x58b6e9=_[_0x0e94('0x39')]({},_0x58b6e9,_0x225258[_0x0e94('0xa2')]);return db['JscriptySessionReport']['count']({'where':_0x58b6e9['where']})[_0x0e94('0x1b')](function(_0xb3afa8){_0x4e6a5f[_0x0e94('0x17')]=_0xb3afa8;if(_0x225258[_0x0e94('0x24')][_0x0e94('0x9d')]){_0x58b6e9[_0x0e94('0x9e')]=[{'all':!![]}];}return db[_0x0e94('0x52')][_0x0e94('0x23')](_0x58b6e9);})[_0x0e94('0x1b')](function(_0x585363){_0x4e6a5f['rows']=_0x585363;return _0x4e6a5f;});}})[_0x0e94('0x1b')](respondWithFilteredResult(_0x19eae4,_0x58b6e9))[_0x0e94('0x26')](handleError(_0x19eae4,null));};exports[_0x0e94('0xa5')]=function(_0x5a7f2b,_0x319236){try{if(!_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0x5f')]){throw new Error(_0x0e94('0xa6'));}if(!_0x5a7f2b['body'][_0x0e94('0xa7')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xa8')]){throw new Error(_0x0e94('0xa9'));}if(!_0x5a7f2b['body'][_0x0e94('0xaa')]){throw new Error(_0x0e94('0xab'));}var _0x61eac0=_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xa7')][_0x0e94('0xac')](',');var _0x45d17=_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xa8')][_0x0e94('0xac')](',');if(!_0x61eac0[_0x0e94('0x2d')]||!_0x45d17['length']||_0x61eac0[_0x0e94('0x2d')]!==_0x45d17[_0x0e94('0x2d')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0x7f')]=_[_0x0e94('0xad')](_0x61eac0,_0x45d17);if(!_0x5a7f2b['body'][_0x0e94('0x7f')][_0x0e94('0x78')]){throw new Error(_0x0e94('0xae'));}if(!_0x5a7f2b['body']['fields']['firstName']){throw new Error(_0x0e94('0xaf'));}var _0x1bda29=path[_0x0e94('0x55')](config['root'],_0x0e94('0xb0'),_0x5a7f2b['file'][_0x0e94('0xb1')]);fs[_0x0e94('0xb2')](_0x1bda29,parseInt(_0x0e94('0xb3'),0x8));var _0x2386b0=require(_0x0e94('0xb4'))['fork'](path['join'](__dirname,_0x0e94('0xb5')),[_0x1bda29,_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xa7')],_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xa8')],_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0x5f')],_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xb6')],_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0x5c')],_0x5a7f2b[_0x0e94('0x3a')][_0x0e94('0xaa')]]);return _0x319236[_0x0e94('0x12')](0xc8)[_0x0e94('0x13')]({'message':_0x0e94('0xb7'),'pid':_0x2386b0['pid']});}catch(_0x458bb4){return _0x319236[_0x0e94('0x12')](0x1f4)['send'](_0x458bb4);}};exports[_0x0e94('0xb8')]=function(_0x4c294d,_0x2ec6ea){var _0x46600d=fs[_0x0e94('0xb9')](_0x4c294d['file'][_0x0e94('0x3')]);Papa[_0x0e94('0xba')](_0x46600d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3bfa61){return _0x2ec6ea[_0x0e94('0x12')](0xc8)[_0x0e94('0x13')]({'file':_0x4c294d[_0x0e94('0xbb')],'fields':_0x3bfa61['meta']['fields']});}});};exports[_0x0e94('0xbc')]=function(_0x54ec06,_0x559543){return db[_0x0e94('0xbd')][_0x0e94('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0e94('0xbe')}})[_0x0e94('0x1b')](function(_0x4c9a65){var _0x3d9886=![];if(!_0x54ec06[_0x0e94('0x3a')][_0x0e94('0x5f')]){throw new Error(_0x0e94('0xa6'));}if(!_0x54ec06[_0x0e94('0x3a')][_0x0e94('0xbf')][_0x0e94('0x78')]){throw new Error(_0x0e94('0xae'));}if(!_0x54ec06[_0x0e94('0x3a')][_0x0e94('0xbf')][_0x0e94('0xc0')]){throw new Error(_0x0e94('0xaf'));}if(!_0x54ec06[_0x0e94('0x3a')]['socket_timestamp']){throw new Error(_0x0e94('0xab'));}var _0x14a28f=require('child_process')[_0x0e94('0xc1')](path['join'](__dirname,_0x0e94('0xc2')),[_0x54ec06[_0x0e94('0x29')]['id'],JSON['stringify'](_0x54ec06['body']),JSON['stringify'](_0x4c9a65)]);_0x14a28f['on'](_0x0e94('0xc3'),function(){_0x3d9886=!![];return _0x559543[_0x0e94('0x12')](0xc8)[_0x0e94('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x14a28f[_0x0e94('0xc4')]});});_0x14a28f['on']('exit',function(_0x3bcc19){if(_0x3bcc19&&!_0x3d9886){return _0x559543[_0x0e94('0x12')](0x1f4)[_0x0e94('0x13')]({'message':_0x0e94('0xc5'),'pid':_0x14a28f[_0x0e94('0xc4')]});}});})[_0x0e94('0x26')](handleError(_0x559543,null));};exports[_0x0e94('0xc6')]=function(_0x26a515,_0x3120e2){return db[_0x0e94('0xbd')][_0x0e94('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0e94('0x1b')](function(_0x3fd47f){var _0x3ba7f1=![];if(!_0x26a515['body'][_0x0e94('0x5f')]){throw new Error(_0x0e94('0xa6'));}if(!_0x26a515[_0x0e94('0x3a')][_0x0e94('0xbf')][_0x0e94('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x26a515[_0x0e94('0x3a')][_0x0e94('0xbf')][_0x0e94('0xc0')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x26a515['body']['socket_timestamp']){throw new Error(_0x0e94('0xab'));}var _0x3af6d0=require(_0x0e94('0xb4'))[_0x0e94('0xc1')](path[_0x0e94('0x55')](__dirname,'../../components/import/cm/csvUpdates'),[_0x26a515[_0x0e94('0x29')]['id'],JSON['stringify'](_0x26a515[_0x0e94('0x3a')]),JSON['stringify'](_0x3fd47f)]);_0x3af6d0['on'](_0x0e94('0xc3'),function(){_0x3ba7f1=!![];return _0x3120e2[_0x0e94('0x12')](0xc8)[_0x0e94('0x13')]({'message':_0x0e94('0xc7'),'pid':_0x3af6d0[_0x0e94('0xc4')]});});_0x3af6d0['on']('exit',function(_0x1115fb){if(_0x1115fb&&!_0x3ba7f1){return _0x3120e2[_0x0e94('0x12')](0x1f4)[_0x0e94('0x13')]({'message':'error\x20child\x20process','pid':_0x3af6d0[_0x0e94('0xc4')]});}});})[_0x0e94('0x26')](handleError(_0x3120e2,null));};exports[_0x0e94('0xc8')]=function(_0x220204,_0x42e72b){var _0x11771f=[_0x0e94('0xc9'),_0x0e94('0xca'),'sms','openchannel',_0x0e94('0xcb'),'whatsapp','voice'];var _0x1f6e89={'offset':0x0,'order':qs[_0x0e94('0x81')]('-createdAt')},_0x420d93={'count':0x0,'rows':[]};Promise[_0x0e94('0xcc')]()[_0x0e94('0x1b')](function(){if(_0x220204[_0x0e94('0x24')][_0x0e94('0xcd')]){if(!_[_0x0e94('0xce')](_0x11771f,_0x220204['query'][_0x0e94('0xcd')][_0x0e94('0xcf')]())){throw new Error(_0x0e94('0xd0'));}_0x11771f=[_0x220204[_0x0e94('0x24')][_0x0e94('0xcd')]['toLowerCase']()];}if(_0x220204[_0x0e94('0x24')][_0x0e94('0xd1')]){try{var _0x7b9778=JSON['parse'](_0x220204['query'][_0x0e94('0xd1')]);if(!moment(_0x7b9778[_0x0e94('0x3b')])[_0x0e94('0xd2')]()){throw new Error(_0x0e94('0xd3'));}if(!moment(_0x7b9778['to'])[_0x0e94('0xd2')]()){throw new Error(_0x0e94('0xd4'));}}catch(_0x30905a){throw new Error(_0x0e94('0xd5'));}}if(!_0x220204[_0x0e94('0x24')]['hasOwnProperty'](_0x0e94('0x84'))){_0x1f6e89[_0x0e94('0x16')]=qs['limit'](_0x220204[_0x0e94('0x24')][_0x0e94('0x16')]||0xa);_0x1f6e89['offset']=qs['offset'](_0x220204['query'][_0x0e94('0x14')]);}var _0xda481f=_0x11771f['map'](function(_0xbdad14){if(_0xbdad14===_0x0e94('0xd6')){var _0x4b2877={'attributes':['id',_0x0e94('0xd7'),'type','source','destination',_0x0e94('0xd8'),_0x0e94('0xd9'),_0x0e94('0xda'),_0x0e94('0xdb'),'note','createdAt',_0x0e94('0xdc'),'userSecondDisposition',_0x0e94('0xdd'),_0x0e94('0xde')],'where':{'ContactId':_0x220204[_0x0e94('0x29')]['id']},'include':[{'model':db[_0x0e94('0xbd')],'as':_0x0e94('0xbd'),'attributes':['id',_0x0e94('0x1f'),_0x0e94('0xdf'),'alias']}],'order':[[_0x0e94('0xe0'),'DESC']]};if(_0x220204[_0x0e94('0x24')]['range']){_0x4b2877[_0x0e94('0x5d')][_0x0e94('0xe0')]={'$gte':_0x7b9778['from'],'$lte':_0x7b9778['to']};}return db[_0x0e94('0x4e')]['findAndCountAll'](_0x4b2877)[_0x0e94('0x1b')](function(_0x3dfec3){_0x420d93[_0x0e94('0x17')]+=_0x3dfec3[_0x0e94('0x17')];return _[_0x0e94('0x6e')](_0x3dfec3['rows'],function(_0x2def31){var _0x23dd03=_0x2def31[_0x0e94('0x3c')]({'plain':!![]});_0x23dd03[_0x0e94('0xcd')]=_0xbdad14;if(_0x23dd03[_0x0e94('0xbd')]){_0x23dd03[_0x0e94('0xbd')]={'id':_0x23dd03[_0x0e94('0xbd')]['id'],'name':_0x23dd03[_0x0e94('0xbd')][_0x0e94('0x1f')],'fullname':_0x23dd03[_0x0e94('0xbd')][_0x0e94('0xdf')],'alias':_0x23dd03['User'][_0x0e94('0xe1')]};}return _0x23dd03;});});}else{var _0x197413=_[_0x0e94('0xe2')](_0xbdad14)+(_0xbdad14===_0x0e94('0xca')?_0x0e94('0xe3'):_0x0e94('0xe4'));var _0x33f08a={'attributes':['id',_0x0e94('0xe5'),_0x0e94('0xe6'),_0x0e94('0xe0'),_0x0e94('0xe7'),_0x0e94('0xe8'),_0x0e94('0xe9'),'thirdDisposition',_0x0e94('0xde'),_0x197413+'Id'],'where':{'ContactId':_0x220204['params']['id']},'include':[{'model':db[_0x197413],'as':'Account','attributes':['id',_0x0e94('0x1f'),'key']},{'model':db[_0x0e94('0xbd')],'as':_0x0e94('0xea'),'attributes':['id',_0x0e94('0x1f'),'fullname']},{'model':db[_0x0e94('0x65')],'as':_0x0e94('0x66'),'attributes':['id',_0x0e94('0x1f'),'color'],'through':{'attributes':[]}}],'order':[[_0x0e94('0xe0'),_0x0e94('0xeb')]]};if(_0x220204['query'][_0x0e94('0xd1')]){_0x33f08a['where'][_0x0e94('0xe0')]={'$gte':_0x7b9778[_0x0e94('0x3b')],'$lte':_0x7b9778['to']};}switch(_0xbdad14){case _0x0e94('0xca'):_0x33f08a[_0x0e94('0x7e')]['push']('browserName',_0x0e94('0xec'),_0x0e94('0xed'),_0x0e94('0xee'),'osName','ratingMessage',_0x0e94('0xef'),_0x0e94('0xf0'),_0x0e94('0xf1'));break;case _0x0e94('0xc9'):_0x33f08a[_0x0e94('0x7e')][_0x0e94('0x5e')](_0x0e94('0xf2'),_0x0e94('0xf3'));break;case _0x0e94('0xf4'):_0x33f08a[_0x0e94('0x7e')][_0x0e94('0x5e')]('externalUrl','threadId');break;}return db[_[_0x0e94('0xe2')](_0xbdad14)+'Interaction']['findAndCountAll'](_0x33f08a)[_0x0e94('0x1b')](function(_0x21a159){_0x420d93[_0x0e94('0x17')]+=_0x21a159[_0x0e94('0x17')];return _[_0x0e94('0x6e')](_0x21a159[_0x0e94('0x9f')],function(_0x4a10fb){var _0x7a9dc7=_0x4a10fb[_0x0e94('0x3c')]({'plain':!![]});_0x7a9dc7[_0x0e94('0xcd')]=_0xbdad14;if(_0x7a9dc7[_0x0e94('0xea')]){_0x7a9dc7[_0x0e94('0xea')]={'id':_0x7a9dc7['Owner']['id'],'name':_0x7a9dc7['Owner'][_0x0e94('0x1f')],'fullname':_0x7a9dc7[_0x0e94('0xea')][_0x0e94('0xdf')]};}return _0x7a9dc7;});});}});return Promise[_0x0e94('0x63')](_0xda481f);})['then'](function(_0x4d062a){return _(_0x4d062a)['flatten']()[_0x0e94('0xf5')]('createdAt')['reverse']()[_0x0e94('0xf6')]();})[_0x0e94('0x1b')](function(_0x13a550){_0x420d93[_0x0e94('0x9f')]=_0x1f6e89['limit']?_0x13a550[_0x0e94('0xf7')](_0x1f6e89[_0x0e94('0x14')],_0x1f6e89[_0x0e94('0x14')]+_0x1f6e89[_0x0e94('0x16')]):_0x13a550;return _0x420d93;})[_0x0e94('0x1b')](respondWithFilteredResult(_0x42e72b,_0x1f6e89))['catch'](handleError(_0x42e72b,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 18e5d98..2a59370 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 _0xd8d0=['save','remove','emit','hook','exports','../../mysqldb','CmContact','setMaxListeners'];(function(_0x69384e,_0x9d747b){var _0x2e2847=function(_0x55bf0a){while(--_0x55bf0a){_0x69384e['push'](_0x69384e['shift']());}};_0x2e2847(++_0x9d747b);}(_0xd8d0,0x195));var _0x0d8d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xd8d0[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x0d8d('0x0'))['db'][_0x0d8d('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0d8d('0x2')](0x0);var events={'afterCreate':_0x0d8d('0x3'),'afterUpdate':'update','afterDestroy':_0x0d8d('0x4')};function emitEvent(_0x4d636c){return function(_0x38b4dc,_0xd43ed2,_0x1fdc0a){CmContactEvents[_0x0d8d('0x5')](_0x4d636c+':'+_0x38b4dc['id'],_0x38b4dc);CmContactEvents['emit'](_0x4d636c,_0x38b4dc);_0x1fdc0a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x0d8d('0x6')](e,emitEvent(event));}}module[_0x0d8d('0x7')]=CmContactEvents; \ No newline at end of file +var _0xc5f2=['remove','emit','hook','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5f2,0xa3));var _0x2c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2c5f('0x0'));var CmContact=require(_0x2c5f('0x1'))['db'][_0x2c5f('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2c5f('0x3')](0x0);var events={'afterCreate':_0x2c5f('0x4'),'afterUpdate':'update','afterDestroy':_0x2c5f('0x5')};function emitEvent(_0x2bff22){return function(_0x544f29,_0x1471fa,_0x2b0a02){CmContactEvents[_0x2c5f('0x6')](_0x2bff22+':'+_0x544f29['id'],_0x544f29);CmContactEvents[_0x2c5f('0x6')](_0x2bff22,_0x544f29);_0x2b0a02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x2c5f('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c41603c..d808f15 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 _0xcb3d=['rimraf','../../config/environment','../../config/environment/shared','exports','define','phone','fti_cm_contacts','firstName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','inspect','format','isNil','dialTimezone','findOne','timezones','utcOffset','scheduledat','add','minutes','YYYY-MM-DD\x20HH:mm:ss','then','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','ret','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','afterCreate','Campaign','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','message','List\x20not\x20found','VoiceQueueId','push','[CmContact][afterDestroy][Error]','lodash','util','api','moment','request-promise'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xcb3d,0x1f3));var _0xdcb3=function(_0x326cfb,_0x10261c){_0x326cfb=_0x326cfb-0x0;var _0x25c642=_0xcb3d[_0x326cfb];return _0x25c642;};'use strict';var _=require(_0xdcb3('0x0'));var util=require(_0xdcb3('0x1'));var logger=require('../../config/logger')(_0xdcb3('0x2'));var moment=require(_0xdcb3('0x3'));var BPromise=require('bluebird');var rp=require(_0xdcb3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcb3('0x5'));var config=require(_0xdcb3('0x6'));var shared=require(_0xdcb3('0x7'));var attributes=require('./cmContact.attributes');module[_0xdcb3('0x8')]=function(_0x3fc56e,_0x135af7){return _0x3fc56e[_0xdcb3('0x9')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xdcb3('0xa')]},{'name':_0xdcb3('0xb'),'fields':[_0xdcb3('0xc'),'lastName','phone',_0xdcb3('0xd'),_0xdcb3('0xe'),_0xdcb3('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdcb3('0x10'),'collate':_0xdcb3('0x11'),'hooks':{'afterCreate':function(_0x419ae9,_0xdc495e,_0x38c799){var _0x119143=_0x3fc56e[_0xdcb3('0x12')];var _0x191f0c=_0x419ae9[_0xdcb3('0x13')]({'plain':!![]});function _0x5becde(){return function(_0x373aa5){logger[_0xdcb3('0x14')]('cmContact','afterCreate',util[_0xdcb3('0x15')](_0x373aa5,{'showHidden':![],'depth':null}));};}function _0x2bba80(_0x206c46,_0x50a949){var _0x5d5ea5=_0x50a949['scheduledat']?_0x50a949['scheduledat']:moment()[_0xdcb3('0x16')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4eb2d2,_0x3dc2cc){if(_[_0xdcb3('0x17')](_0x50a949[_0xdcb3('0x18')])){_0x4eb2d2({'ret':_0x5d5ea5});}else{_0x119143['VoiceQueue'][_0xdcb3('0x19')]({'where':{'id':_0x206c46['id']}})['then'](function(_0x3e44a4){if(!_['isNil'](_0x3e44a4)){var _0x139d45=_0x3e44a4[_0xdcb3('0x18')];if(!_[_0xdcb3('0x17')](_0x139d45)){var _0x37b5f6=shared[_0xdcb3('0x1a')];var _0x22e9b0=_0x37b5f6[_0x139d45];var _0x4c9e91=_0x37b5f6[_0x50a949[_0xdcb3('0x18')]];if(!_[_0xdcb3('0x17')](_0x22e9b0)&&!_['isNil'](_0x4c9e91)){var _0x4ab2fe=_0x22e9b0['utcOffset']-_0x4c9e91[_0xdcb3('0x1b')];_0x5d5ea5=_0x50a949[_0xdcb3('0x1c')]?_0x50a949[_0xdcb3('0x1c')]:moment();var _0x36bc1c=moment(_0x5d5ea5)[_0xdcb3('0x1d')](_0x4ab2fe,_0xdcb3('0x1e'));_0x4eb2d2({'ret':_0x36bc1c[_0xdcb3('0x16')](_0xdcb3('0x1f'))});}else _0x4eb2d2({'ret':_0x5d5ea5});}else _0x4eb2d2({'ret':_0x5d5ea5});}else{_0x4eb2d2({'ret':_0x5d5ea5});}});}});return 0xa;}var _0x32bfdb=function(_0x2cd3dc){return new BPromise(function(_0xd562c6,_0x22e176){_0x2bba80(_0x2cd3dc,_0x191f0c)[_0xdcb3('0x20')](function(_0x4b0493){_0x191f0c[_0xdcb3('0x1c')]=_0x4b0493['ret'];_0x119143[_0xdcb3('0x21')][_0xdcb3('0x19')]({'where':{'phone':_0x191f0c[_0xdcb3('0xa')],'VoiceQueueId':_0x2cd3dc['id']}})[_0xdcb3('0x20')](function(_0x381ef3){if(!_['isNil'](_0x381ef3)){throw new Error(_0xdcb3('0x22')+_0x191f0c[_0xdcb3('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x2cd3dc['id']);}return _0x119143[_0xdcb3('0x21')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'priority':_0x191f0c['priority']?_0x191f0c[_0xdcb3('0x25')]:0x2,'scheduledat':_0x191f0c[_0xdcb3('0x1c')]?_0x191f0c[_0xdcb3('0x1c')]:moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')),'callback':_0x191f0c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c[_0xdcb3('0x26')]:undefined,'callbackat':_0x191f0c[_0xdcb3('0x26')]?moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')):undefined,'VoiceQueueId':_0x2cd3dc['id']});})[_0xdcb3('0x27')](function(_0x1c8578){_0x22e176(_0x1c8578);});});});};var _0x5b3ef1=function(_0x9a3fcf){return new BPromise(function(_0x27a749,_0x5c1cbc){_0x2bba80(_0x9a3fcf,_0x191f0c)[_0xdcb3('0x20')](function(_0x5bfa78){_0x191f0c[_0xdcb3('0x1c')]=_0x5bfa78[_0xdcb3('0x28')];_0x119143[_0xdcb3('0x21')][_0xdcb3('0x19')]({'where':{'phone':_0x191f0c[_0xdcb3('0xa')],'VoiceQueueId':_0x9a3fcf['id']}})[_0xdcb3('0x20')](function(_0x19e6ad){if(!_[_0xdcb3('0x17')](_0x19e6ad)){throw new Error(_0xdcb3('0x22')+_0x191f0c[_0xdcb3('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x9a3fcf['id']);}return _0x119143[_0xdcb3('0x29')][_0xdcb3('0x19')]({'where':{'calleridnum':_0x191f0c[_0xdcb3('0xa')],'VoiceQueueId':_0x9a3fcf['id']}});})[_0xdcb3('0x20')](function(_0x30c9d9){if(!_['isNil'](_0x30c9d9)){throw new Error(_0xdcb3('0x2a')+_0x191f0c[_0xdcb3('0xa')]+_0xdcb3('0x2b')+_0x9a3fcf['id']);}return _0x119143[_0xdcb3('0x21')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'priority':_0x191f0c[_0xdcb3('0x25')]?_0x191f0c[_0xdcb3('0x25')]:0x2,'scheduledat':_0x191f0c['scheduledat']?_0x191f0c[_0xdcb3('0x1c')]:moment()['format'](_0xdcb3('0x1f')),'callback':_0x191f0c[_0xdcb3('0x26')]?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c[_0xdcb3('0x26')]:undefined,'callbackat':_0x191f0c[_0xdcb3('0x26')]?moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')):undefined,'VoiceQueueId':_0x9a3fcf['id']});})[_0xdcb3('0x27')](function(_0x384a3c){_0x5c1cbc(_0x384a3c);});});});};function _0x35cd00(){return function(_0x3fa2fd){logger[_0xdcb3('0x14')](_0xdcb3('0x2c'),_0xdcb3('0x2d'),util[_0xdcb3('0x15')](_0x3fa2fd,{'showHidden':![],'depth':null}));};}function _0x4cf04e(_0x543dfc,_0x44eb9e){var _0x45638e=_0x44eb9e['scheduledat']?_0x44eb9e['scheduledat']:moment()[_0xdcb3('0x16')](_0xdcb3('0x1f'));return new BPromise(function(_0x30b5a1,_0x3e187d){if(_['isNil'](_0x44eb9e[_0xdcb3('0x18')])){_0x30b5a1({'ret':_0x45638e});}else{_0x119143[_0xdcb3('0x2e')][_0xdcb3('0x19')]({'where':{'id':_0x543dfc['id']}})[_0xdcb3('0x20')](function(_0x1a938b){if(!_[_0xdcb3('0x17')](_0x1a938b)){var _0x4bf804=_0x1a938b[_0xdcb3('0x18')];if(!_[_0xdcb3('0x17')](_0x4bf804)){var _0x2e198a=shared[_0xdcb3('0x1a')];var _0x42b8e2=_0x2e198a[_0x4bf804];var _0x2ef584=_0x2e198a[_0x44eb9e[_0xdcb3('0x18')]];if(!_[_0xdcb3('0x17')](_0x42b8e2)&&!_['isNil'](_0x2ef584)){var _0x3ee904=_0x42b8e2['utcOffset']-_0x2ef584[_0xdcb3('0x1b')];_0x45638e=_0x44eb9e['scheduledat']?_0x44eb9e[_0xdcb3('0x1c')]:moment();var _0xc74ed1=moment(_0x45638e)[_0xdcb3('0x1d')](_0x3ee904,_0xdcb3('0x1e'));_0x30b5a1({'ret':_0xc74ed1[_0xdcb3('0x16')](_0xdcb3('0x1f'))});}else _0x30b5a1({'ret':_0x45638e});}else _0x30b5a1({'ret':_0x45638e});}else{_0x30b5a1({'ret':_0x45638e});}});}});return 0xa;}var _0x4dcaf8=function(_0x251976){return new BPromise(function(_0xe79fcb,_0x25b291){_0x4cf04e(_0x251976,_0x191f0c)[_0xdcb3('0x20')](function(_0xd904d0){_0x191f0c[_0xdcb3('0x1c')]=_0xd904d0[_0xdcb3('0x28')];_0x119143[_0xdcb3('0x21')][_0xdcb3('0x19')]({'where':{'phone':_0x191f0c['phone'],'CampaignId':_0x251976['id']}})['then'](function(_0x5e8a66){if(!_[_0xdcb3('0x17')](_0x5e8a66)){throw new Error(_0xdcb3('0x22')+_0x191f0c[_0xdcb3('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x251976['id']);}return _0x119143['CmHopper'][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'priority':_0x191f0c[_0xdcb3('0x25')]?_0x191f0c[_0xdcb3('0x25')]:0x2,'scheduledat':_0x191f0c['scheduledat']?_0x191f0c[_0xdcb3('0x1c')]:moment()[_0xdcb3('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x191f0c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c[_0xdcb3('0x26')]:undefined,'callbackat':_0x191f0c['callbackUniqueid']?moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')):undefined,'CampaignId':_0x251976['id']});})[_0xdcb3('0x27')](function(_0x3527b1){_0x25b291(_0x3527b1);});});});};var _0x4d36f9=function(_0x310251){return new BPromise(function(_0x59c24c,_0x4d8f47){_0x4cf04e(_0x310251,_0x191f0c)['then'](function(_0x3308f0){_0x191f0c[_0xdcb3('0x1c')]=_0x3308f0[_0xdcb3('0x28')];_0x119143[_0xdcb3('0x21')][_0xdcb3('0x19')]({'where':{'phone':_0x191f0c[_0xdcb3('0xa')],'CampaignId':_0x310251['id']}})[_0xdcb3('0x20')](function(_0x5dbbee){if(!_[_0xdcb3('0x17')](_0x5dbbee)){throw new Error('cmContact,\x20afterCreate\x20'+_0x191f0c[_0xdcb3('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x310251['id']);}return _0x119143[_0xdcb3('0x29')][_0xdcb3('0x19')]({'where':{'calleridnum':_0x191f0c[_0xdcb3('0xa')],'CampaignId':_0x310251['id']}});})[_0xdcb3('0x20')](function(_0x4e9be4){if(!_[_0xdcb3('0x17')](_0x4e9be4)){throw new Error(_0xdcb3('0x2a')+_0x191f0c['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x310251['id']);}return _0x119143[_0xdcb3('0x21')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c['ListId'],'priority':_0x191f0c[_0xdcb3('0x25')]?_0x191f0c['priority']:0x2,'scheduledat':_0x191f0c[_0xdcb3('0x1c')]?_0x191f0c['scheduledat']:moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')),'callback':_0x191f0c[_0xdcb3('0x26')]?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c[_0xdcb3('0x26')]:undefined,'callbackat':_0x191f0c[_0xdcb3('0x26')]?moment()['format'](_0xdcb3('0x1f')):undefined,'CampaignId':_0x310251['id']});})[_0xdcb3('0x27')](function(_0x171d67){_0x4d8f47(_0x171d67);});});});};if(_0x191f0c[_0xdcb3('0x24')]){_0x119143[_0xdcb3('0x2f')][_0xdcb3('0x30')]({'where':{'type':_0xdcb3('0x31')},'attributes':['id',_0xdcb3('0x32'),_0xdcb3('0x18')],'include':[{'model':_0x119143[_0xdcb3('0x33')],'as':_0xdcb3('0x34'),'where':{'id':_0x191f0c[_0xdcb3('0x24')]}}]})[_0xdcb3('0x20')](function(_0x262eb5){if(_0x262eb5){var _0x1619bb=[];for(var _0x2f99c3=0x0,_0x1a3ae8;_0x2f99c3<_0x262eb5[_0xdcb3('0x35')];_0x2f99c3+=0x1){_0x1a3ae8=_0x262eb5[_0x2f99c3]['get']({'plain':!![]});switch(_0x1a3ae8[_0xdcb3('0x32')]){case _0xdcb3('0x36'):_0x5b3ef1(_0x1a3ae8)[_0xdcb3('0x27')](_0x5becde());break;case _0xdcb3('0x37'):_0x32bfdb(_0x1a3ae8)['catch'](_0x5becde());break;default:_0x4cf04e(_0x1a3ae8,_0x191f0c)[_0xdcb3('0x20')](function(_0x11bf9f){_0x191f0c[_0xdcb3('0x1c')]=_0x11bf9f['ret'];_0x119143[_0xdcb3('0x21')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'scheduledat':_0x191f0c['scheduledat']?_0x191f0c[_0xdcb3('0x1c')]:moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')),'priority':_0x191f0c[_0xdcb3('0x25')]?_0x191f0c[_0xdcb3('0x25')]:0x2,'callback':_0x191f0c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c[_0xdcb3('0x26')]:undefined,'callbackat':_0x191f0c[_0xdcb3('0x26')]?moment()[_0xdcb3('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1a3ae8['id']})['catch'](_0x5becde());});}}}})[_0xdcb3('0x20')](function(){return _0x119143[_0xdcb3('0x2f')][_0xdcb3('0x30')]({'where':{'type':_0xdcb3('0x31')},'attributes':['id'],'include':[{'model':_0x119143[_0xdcb3('0x33')],'as':_0xdcb3('0x38'),'where':{'id':_0x191f0c['ListId']}}]})[_0xdcb3('0x20')](function(_0x588b76){if(_0x588b76){var _0x16b633=[];for(var _0x3dff29=0x0,_0x333cfa;_0x3dff29<_0x588b76[_0xdcb3('0x35')];_0x3dff29+=0x1){_0x333cfa=_0x588b76[_0x3dff29][_0xdcb3('0x13')]({'plain':!![]});_0x119143[_0xdcb3('0x39')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'VoiceQueueId':_0x333cfa['id']})[_0xdcb3('0x27')](function(_0x3074e7){logger['error']('cmContact,\x20%s,\x20%s',_0xdcb3('0x2d'),_0x3074e7[_0xdcb3('0x3a')]);});}}});})[_0xdcb3('0x20')](function(){return _0x119143['Campaign'][_0xdcb3('0x30')]({'attributes':['id',_0xdcb3('0x32'),_0xdcb3('0x18')],'include':[{'model':_0x119143[_0xdcb3('0x33')],'as':_0xdcb3('0x34'),'where':{'id':_0x191f0c[_0xdcb3('0x24')]}}]})[_0xdcb3('0x20')](function(_0x5ddd20){if(_0x5ddd20){var _0x2f2450=[];for(var _0x12a5fc=0x0,_0x595fc4;_0x12a5fc<_0x5ddd20[_0xdcb3('0x35')];_0x12a5fc+=0x1){_0x595fc4=_0x5ddd20[_0x12a5fc][_0xdcb3('0x13')]({'plain':!![]});switch(_0x595fc4['dialCheckDuplicateType']){case _0xdcb3('0x36'):_0x4d36f9(_0x595fc4)[_0xdcb3('0x27')](_0x35cd00());break;case'onlyIfOpen':_0x4dcaf8(_0x595fc4)[_0xdcb3('0x27')](_0x35cd00());break;default:_0x119143[_0xdcb3('0x21')][_0xdcb3('0x23')]({'phone':_0x191f0c['phone'],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'scheduledat':_0x191f0c[_0xdcb3('0x1c')]?_0x191f0c[_0xdcb3('0x1c')]:moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')),'priority':_0x191f0c['priority']?_0x191f0c[_0xdcb3('0x25')]:0x2,'callback':_0x191f0c[_0xdcb3('0x26')]?!![]:![],'callbackuniqueid':_0x191f0c[_0xdcb3('0x26')]?_0x191f0c['callbackUniqueid']:undefined,'callbackat':_0x191f0c[_0xdcb3('0x26')]?moment()[_0xdcb3('0x16')](_0xdcb3('0x1f')):undefined,'CampaignId':_0x595fc4['id']})[_0xdcb3('0x27')](_0x35cd00());}}}});})[_0xdcb3('0x20')](function(){return _0x119143[_0xdcb3('0x2e')][_0xdcb3('0x30')]({'attributes':['id'],'include':[{'model':_0x119143[_0xdcb3('0x33')],'as':_0xdcb3('0x38'),'where':{'id':_0x191f0c[_0xdcb3('0x24')]}}]})[_0xdcb3('0x20')](function(_0x35f053){if(_0x35f053){var _0x4d6003=[];for(var _0x1b6adc=0x0,_0x4ba729;_0x1b6adc<_0x35f053[_0xdcb3('0x35')];_0x1b6adc+=0x1){_0x4ba729=_0x35f053[_0x1b6adc][_0xdcb3('0x13')]({'plain':!![]});_0x119143[_0xdcb3('0x39')][_0xdcb3('0x23')]({'phone':_0x191f0c[_0xdcb3('0xa')],'ContactId':_0x191f0c['id'],'ListId':_0x191f0c[_0xdcb3('0x24')],'CampaignId':_0x4ba729['id']})[_0xdcb3('0x27')](function(_0x2aaad9){logger[_0xdcb3('0x14')]('cmContact,\x20%s,\x20%s',_0xdcb3('0x2d'),_0x2aaad9[_0xdcb3('0x3a')]);});}}});})[_0xdcb3('0x20')](function(){_0x38c799();})[_0xdcb3('0x27')](function(_0xfe7890){logger[_0xdcb3('0x14')]('cmContact,\x20%s,\x20%s',_0xdcb3('0x2d'),_0xfe7890[_0xdcb3('0x3a')]);_0x38c799(_0xfe7890);});}else{_0x38c799(new Error(_0xdcb3('0x3b')));}},'afterDestroy':function(_0xcbfb9d,_0x40128a,_0x3953b9){var _0x7ad584=_0x3fc56e[_0xdcb3('0x12')];var _0x9a94b5=_0xcbfb9d[_0xdcb3('0x13')]({'plain':!![]});return _0x7ad584['CmHopper'][_0xdcb3('0x30')]({'raw':!![],'where':{'ListId':_0x9a94b5['ListId'],'ContactId':_0x9a94b5['id']}})[_0xdcb3('0x20')](function(_0x4c8361){if(!_['isEmpty'](_0x4c8361)){var _0x3313ee=[];for(var _0x1e4add=0x0;_0x1e4add<_0x4c8361['length'];_0x1e4add+=0x1){var _0x17bb19=_0x7ad584[_0xdcb3('0x21')]['destroy']({'where':{'ListId':_0x4c8361[_0x1e4add][_0xdcb3('0x24')],'ContactId':_0x4c8361[_0x1e4add]['ContactId'],'VoiceQueueId':_0x4c8361[_0x1e4add][_0xdcb3('0x3c')],'CampaignId':_0x4c8361[_0x1e4add]['CampaignId']}});_0x3313ee[_0xdcb3('0x3d')](_0x17bb19);}return BPromise['all'](_0x3313ee);}})[_0xdcb3('0x20')](function(_0x4a6c39){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xdcb3('0x15')](_0x4a6c39,{'showHidden':![],'depth':null}));_0x3953b9();})[_0xdcb3('0x27')](function(_0x3fb2fd){logger[_0xdcb3('0x14')](_0xdcb3('0x3e'),util['inspect'](_0x3fb2fd,{'showHidden':![],'depth':null}));_0x3953b9(_0x3fb2fd);});}}});}; \ No newline at end of file +var _0x0691=['email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','timezones','utcOffset','add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','length','findAll','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','message','onlyIfOpen','List\x20not\x20found','models','isEmpty','destroy','ContactId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax'];(function(_0x1985ce,_0x3fda7e){var _0x21b38b=function(_0x1f5587){while(--_0x1f5587){_0x1985ce['push'](_0x1985ce['shift']());}};_0x21b38b(++_0x3fda7e);}(_0x0691,0x125));var _0x1069=function(_0x5f34c0,_0x51a32d){_0x5f34c0=_0x5f34c0-0x0;var _0x3aa812=_0x0691[_0x5f34c0];return _0x3aa812;};'use strict';var _=require(_0x1069('0x0'));var util=require(_0x1069('0x1'));var logger=require('../../config/logger')(_0x1069('0x2'));var moment=require(_0x1069('0x3'));var BPromise=require(_0x1069('0x4'));var rp=require(_0x1069('0x5'));var fs=require('fs');var path=require(_0x1069('0x6'));var rimraf=require(_0x1069('0x7'));var config=require(_0x1069('0x8'));var shared=require(_0x1069('0x9'));var attributes=require(_0x1069('0xa'));module[_0x1069('0xb')]=function(_0x59d921,_0x4069f7){return _0x59d921['define'](_0x1069('0xc'),attributes,{'tableName':_0x1069('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1069('0xe')]},{'name':_0x1069('0xf'),'fields':[_0x1069('0x10'),'lastName',_0x1069('0xe'),_0x1069('0x11'),_0x1069('0x12'),_0x1069('0x13')],'type':_0x1069('0x14')}],'timestamps':!![],'charset':_0x1069('0x15'),'collate':_0x1069('0x16'),'hooks':{'afterCreate':function(_0x434ded,_0x3d845c,_0x40f846){var _0x38ab41=_0x59d921['models'];var _0xc3825c=_0x434ded[_0x1069('0x17')]({'plain':!![]});function _0xe67b5a(){return function(_0x663c52){logger['error'](_0x1069('0x18'),_0x1069('0x19'),util[_0x1069('0x1a')](_0x663c52,{'showHidden':![],'depth':null}));};}function _0x384292(_0x2112f6,_0x43981d){var _0x1255d2=_0x43981d[_0x1069('0x1b')]?_0x43981d[_0x1069('0x1b')]:moment()[_0x1069('0x1c')](_0x1069('0x1d'));return new BPromise(function(_0x157909,_0x46a991){if(_['isNil'](_0x43981d[_0x1069('0x1e')])){_0x157909({'ret':_0x1255d2});}else{_0x38ab41['VoiceQueue'][_0x1069('0x1f')]({'where':{'id':_0x2112f6['id']}})[_0x1069('0x20')](function(_0x521094){if(!_[_0x1069('0x21')](_0x521094)){var _0x2cf93d=_0x521094[_0x1069('0x1e')];if(!_['isNil'](_0x2cf93d)){var _0x1370a1=shared[_0x1069('0x22')];var _0x4a015e=_0x1370a1[_0x2cf93d];var _0x3cc730=_0x1370a1[_0x43981d[_0x1069('0x1e')]];if(!_['isNil'](_0x4a015e)&&!_['isNil'](_0x3cc730)){var _0x52391f=_0x4a015e[_0x1069('0x23')]-_0x3cc730['utcOffset'];_0x1255d2=_0x43981d['scheduledat']?_0x43981d[_0x1069('0x1b')]:moment();var _0x5e0eff=moment(_0x1255d2)[_0x1069('0x24')](_0x52391f,_0x1069('0x25'));_0x157909({'ret':_0x5e0eff[_0x1069('0x1c')](_0x1069('0x1d'))});}else _0x157909({'ret':_0x1255d2});}else _0x157909({'ret':_0x1255d2});}else{_0x157909({'ret':_0x1255d2});}});}});return 0xa;}var _0x109639=function(_0x147454){return new BPromise(function(_0x3ca2e2,_0x5870ce){_0x384292(_0x147454,_0xc3825c)['then'](function(_0x56bea5){_0xc3825c[_0x1069('0x1b')]=_0x56bea5[_0x1069('0x26')];_0x38ab41[_0x1069('0x27')][_0x1069('0x1f')]({'where':{'phone':_0xc3825c[_0x1069('0xe')],'VoiceQueueId':_0x147454['id']}})[_0x1069('0x20')](function(_0x28bf30){if(!_[_0x1069('0x21')](_0x28bf30)){throw new Error('cmContact,\x20afterCreate\x20'+_0xc3825c[_0x1069('0xe')]+_0x1069('0x28')+_0x147454['id']);}return _0x38ab41['CmHopper']['create']({'phone':_0xc3825c['phone'],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'priority':_0xc3825c[_0x1069('0x2a')]?_0xc3825c[_0x1069('0x2a')]:0x2,'scheduledat':_0xc3825c[_0x1069('0x1b')]?_0xc3825c[_0x1069('0x1b')]:moment()[_0x1069('0x1c')](_0x1069('0x1d')),'callback':_0xc3825c[_0x1069('0x2b')]?!![]:![],'callbackuniqueid':_0xc3825c[_0x1069('0x2b')]?_0xc3825c[_0x1069('0x2b')]:undefined,'callbackat':_0xc3825c[_0x1069('0x2b')]?moment()[_0x1069('0x1c')](_0x1069('0x1d')):undefined,'VoiceQueueId':_0x147454['id']});})[_0x1069('0x2c')](function(_0x419c4a){_0x5870ce(_0x419c4a);});});});};var _0xed7516=function(_0xb3a064){return new BPromise(function(_0x1d63d4,_0x28914b){_0x384292(_0xb3a064,_0xc3825c)[_0x1069('0x20')](function(_0x250168){_0xc3825c[_0x1069('0x1b')]=_0x250168[_0x1069('0x26')];_0x38ab41[_0x1069('0x27')][_0x1069('0x1f')]({'where':{'phone':_0xc3825c[_0x1069('0xe')],'VoiceQueueId':_0xb3a064['id']}})[_0x1069('0x20')](function(_0x5f400b){if(!_[_0x1069('0x21')](_0x5f400b)){throw new Error(_0x1069('0x2d')+_0xc3825c['phone']+_0x1069('0x2e')+_0xb3a064['id']);}return _0x38ab41[_0x1069('0x2f')][_0x1069('0x1f')]({'where':{'calleridnum':_0xc3825c[_0x1069('0xe')],'VoiceQueueId':_0xb3a064['id']}});})[_0x1069('0x20')](function(_0x138c3a){if(!_[_0x1069('0x21')](_0x138c3a)){throw new Error(_0x1069('0x30')+_0xc3825c[_0x1069('0xe')]+_0x1069('0x31')+_0xb3a064['id']);}return _0x38ab41[_0x1069('0x27')][_0x1069('0x32')]({'phone':_0xc3825c['phone'],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'priority':_0xc3825c[_0x1069('0x2a')]?_0xc3825c[_0x1069('0x2a')]:0x2,'scheduledat':_0xc3825c[_0x1069('0x1b')]?_0xc3825c['scheduledat']:moment()[_0x1069('0x1c')](_0x1069('0x1d')),'callback':_0xc3825c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xc3825c[_0x1069('0x2b')]?_0xc3825c[_0x1069('0x2b')]:undefined,'callbackat':_0xc3825c['callbackUniqueid']?moment()[_0x1069('0x1c')](_0x1069('0x1d')):undefined,'VoiceQueueId':_0xb3a064['id']});})['catch'](function(_0x498c25){_0x28914b(_0x498c25);});});});};function _0x319ec3(){return function(_0x4b1d67){logger['error'](_0x1069('0x18'),_0x1069('0x19'),util[_0x1069('0x1a')](_0x4b1d67,{'showHidden':![],'depth':null}));};}function _0x2ac1fc(_0x414b66,_0x1c42d6){var _0x5e02cf=_0x1c42d6[_0x1069('0x1b')]?_0x1c42d6['scheduledat']:moment()[_0x1069('0x1c')](_0x1069('0x1d'));return new BPromise(function(_0x4c9c7c,_0x30d681){if(_[_0x1069('0x21')](_0x1c42d6['dialTimezone'])){_0x4c9c7c({'ret':_0x5e02cf});}else{_0x38ab41[_0x1069('0x33')][_0x1069('0x1f')]({'where':{'id':_0x414b66['id']}})[_0x1069('0x20')](function(_0xd8acac){if(!_[_0x1069('0x21')](_0xd8acac)){var _0x3c0bd4=_0xd8acac[_0x1069('0x1e')];if(!_[_0x1069('0x21')](_0x3c0bd4)){var _0x13c938=shared[_0x1069('0x22')];var _0x7982d8=_0x13c938[_0x3c0bd4];var _0x916ca5=_0x13c938[_0x1c42d6[_0x1069('0x1e')]];if(!_[_0x1069('0x21')](_0x7982d8)&&!_[_0x1069('0x21')](_0x916ca5)){var _0x22adf1=_0x7982d8[_0x1069('0x23')]-_0x916ca5[_0x1069('0x23')];_0x5e02cf=_0x1c42d6[_0x1069('0x1b')]?_0x1c42d6['scheduledat']:moment();var _0x311fcc=moment(_0x5e02cf)[_0x1069('0x24')](_0x22adf1,_0x1069('0x25'));_0x4c9c7c({'ret':_0x311fcc[_0x1069('0x1c')](_0x1069('0x1d'))});}else _0x4c9c7c({'ret':_0x5e02cf});}else _0x4c9c7c({'ret':_0x5e02cf});}else{_0x4c9c7c({'ret':_0x5e02cf});}});}});return 0xa;}var _0x48080d=function(_0x10647e){return new BPromise(function(_0x3c1a12,_0x4c5a88){_0x2ac1fc(_0x10647e,_0xc3825c)[_0x1069('0x20')](function(_0x1c364f){_0xc3825c[_0x1069('0x1b')]=_0x1c364f[_0x1069('0x26')];_0x38ab41[_0x1069('0x27')]['findOne']({'where':{'phone':_0xc3825c[_0x1069('0xe')],'CampaignId':_0x10647e['id']}})[_0x1069('0x20')](function(_0x43df86){if(!_[_0x1069('0x21')](_0x43df86)){throw new Error(_0x1069('0x2d')+_0xc3825c[_0x1069('0xe')]+_0x1069('0x34')+_0x10647e['id']);}return _0x38ab41[_0x1069('0x27')]['create']({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'priority':_0xc3825c[_0x1069('0x2a')]?_0xc3825c[_0x1069('0x2a')]:0x2,'scheduledat':_0xc3825c[_0x1069('0x1b')]?_0xc3825c[_0x1069('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xc3825c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xc3825c[_0x1069('0x2b')]?_0xc3825c[_0x1069('0x2b')]:undefined,'callbackat':_0xc3825c['callbackUniqueid']?moment()[_0x1069('0x1c')](_0x1069('0x1d')):undefined,'CampaignId':_0x10647e['id']});})[_0x1069('0x2c')](function(_0x18029d){_0x4c5a88(_0x18029d);});});});};var _0x39c575=function(_0x4ea9cf){return new BPromise(function(_0x648f39,_0x5be60f){_0x2ac1fc(_0x4ea9cf,_0xc3825c)[_0x1069('0x20')](function(_0x11518c){_0xc3825c['scheduledat']=_0x11518c[_0x1069('0x26')];_0x38ab41[_0x1069('0x27')][_0x1069('0x1f')]({'where':{'phone':_0xc3825c[_0x1069('0xe')],'CampaignId':_0x4ea9cf['id']}})[_0x1069('0x20')](function(_0x234258){if(!_[_0x1069('0x21')](_0x234258)){throw new Error(_0x1069('0x2d')+_0xc3825c[_0x1069('0xe')]+_0x1069('0x35')+_0x4ea9cf['id']);}return _0x38ab41[_0x1069('0x2f')][_0x1069('0x1f')]({'where':{'calleridnum':_0xc3825c[_0x1069('0xe')],'CampaignId':_0x4ea9cf['id']}});})[_0x1069('0x20')](function(_0x590c17){if(!_[_0x1069('0x21')](_0x590c17)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xc3825c[_0x1069('0xe')]+_0x1069('0x36')+_0x4ea9cf['id']);}return _0x38ab41['CmHopper'][_0x1069('0x32')]({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'priority':_0xc3825c['priority']?_0xc3825c[_0x1069('0x2a')]:0x2,'scheduledat':_0xc3825c['scheduledat']?_0xc3825c['scheduledat']:moment()[_0x1069('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xc3825c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xc3825c[_0x1069('0x2b')]?_0xc3825c['callbackUniqueid']:undefined,'callbackat':_0xc3825c['callbackUniqueid']?moment()[_0x1069('0x1c')](_0x1069('0x1d')):undefined,'CampaignId':_0x4ea9cf['id']});})[_0x1069('0x2c')](function(_0x3c246e){_0x5be60f(_0x3c246e);});});});};if(_0xc3825c[_0x1069('0x29')]){_0x38ab41[_0x1069('0x37')]['findAll']({'where':{'type':_0x1069('0x38')},'attributes':['id',_0x1069('0x39'),'dialTimezone'],'include':[{'model':_0x38ab41[_0x1069('0x3a')],'as':_0x1069('0x3b'),'where':{'id':_0xc3825c[_0x1069('0x29')]}}]})[_0x1069('0x20')](function(_0xa7384e){if(_0xa7384e){var _0x929a77=[];for(var _0x1902b7=0x0,_0x2342d3;_0x1902b7<_0xa7384e[_0x1069('0x3c')];_0x1902b7+=0x1){_0x2342d3=_0xa7384e[_0x1902b7]['get']({'plain':!![]});switch(_0x2342d3[_0x1069('0x39')]){case'always':_0xed7516(_0x2342d3)[_0x1069('0x2c')](_0xe67b5a());break;case'onlyIfOpen':_0x109639(_0x2342d3)[_0x1069('0x2c')](_0xe67b5a());break;default:_0x2ac1fc(_0x2342d3,_0xc3825c)[_0x1069('0x20')](function(_0x108d80){_0xc3825c['scheduledat']=_0x108d80[_0x1069('0x26')];_0x38ab41[_0x1069('0x27')][_0x1069('0x32')]({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c['ListId'],'scheduledat':_0xc3825c[_0x1069('0x1b')]?_0xc3825c[_0x1069('0x1b')]:moment()[_0x1069('0x1c')](_0x1069('0x1d')),'priority':_0xc3825c[_0x1069('0x2a')]?_0xc3825c['priority']:0x2,'callback':_0xc3825c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xc3825c['callbackUniqueid']?_0xc3825c['callbackUniqueid']:undefined,'callbackat':_0xc3825c[_0x1069('0x2b')]?moment()[_0x1069('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2342d3['id']})[_0x1069('0x2c')](_0xe67b5a());});}}}})['then'](function(){return _0x38ab41[_0x1069('0x37')][_0x1069('0x3d')]({'where':{'type':_0x1069('0x38')},'attributes':['id'],'include':[{'model':_0x38ab41['CmList'],'as':_0x1069('0x3e'),'where':{'id':_0xc3825c[_0x1069('0x29')]}}]})[_0x1069('0x20')](function(_0x35685f){if(_0x35685f){var _0x15e127=[];for(var _0xadda79=0x0,_0x5055e8;_0xadda79<_0x35685f[_0x1069('0x3c')];_0xadda79+=0x1){_0x5055e8=_0x35685f[_0xadda79][_0x1069('0x17')]({'plain':!![]});_0x38ab41[_0x1069('0x3f')]['create']({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'VoiceQueueId':_0x5055e8['id']})[_0x1069('0x2c')](function(_0x21d333){logger[_0x1069('0x40')](_0x1069('0x41'),_0x1069('0x19'),_0x21d333[_0x1069('0x42')]);});}}});})['then'](function(){return _0x38ab41[_0x1069('0x33')][_0x1069('0x3d')]({'attributes':['id',_0x1069('0x39'),_0x1069('0x1e')],'include':[{'model':_0x38ab41[_0x1069('0x3a')],'as':_0x1069('0x3b'),'where':{'id':_0xc3825c[_0x1069('0x29')]}}]})[_0x1069('0x20')](function(_0x5635d2){if(_0x5635d2){var _0x338e2c=[];for(var _0x4461cd=0x0,_0x4924a5;_0x4461cd<_0x5635d2[_0x1069('0x3c')];_0x4461cd+=0x1){_0x4924a5=_0x5635d2[_0x4461cd][_0x1069('0x17')]({'plain':!![]});switch(_0x4924a5['dialCheckDuplicateType']){case'always':_0x39c575(_0x4924a5)[_0x1069('0x2c')](_0x319ec3());break;case _0x1069('0x43'):_0x48080d(_0x4924a5)[_0x1069('0x2c')](_0x319ec3());break;default:_0x38ab41[_0x1069('0x27')]['create']({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c[_0x1069('0x29')],'scheduledat':_0xc3825c[_0x1069('0x1b')]?_0xc3825c[_0x1069('0x1b')]:moment()[_0x1069('0x1c')](_0x1069('0x1d')),'priority':_0xc3825c[_0x1069('0x2a')]?_0xc3825c[_0x1069('0x2a')]:0x2,'callback':_0xc3825c[_0x1069('0x2b')]?!![]:![],'callbackuniqueid':_0xc3825c[_0x1069('0x2b')]?_0xc3825c['callbackUniqueid']:undefined,'callbackat':_0xc3825c[_0x1069('0x2b')]?moment()[_0x1069('0x1c')](_0x1069('0x1d')):undefined,'CampaignId':_0x4924a5['id']})['catch'](_0x319ec3());}}}});})['then'](function(){return _0x38ab41[_0x1069('0x33')][_0x1069('0x3d')]({'attributes':['id'],'include':[{'model':_0x38ab41[_0x1069('0x3a')],'as':'BlackLists','where':{'id':_0xc3825c[_0x1069('0x29')]}}]})['then'](function(_0x41985c){if(_0x41985c){var _0x9bd1b5=[];for(var _0x146fe4=0x0,_0x3ebcd4;_0x146fe4<_0x41985c[_0x1069('0x3c')];_0x146fe4+=0x1){_0x3ebcd4=_0x41985c[_0x146fe4][_0x1069('0x17')]({'plain':!![]});_0x38ab41['CmHopperBlack'][_0x1069('0x32')]({'phone':_0xc3825c[_0x1069('0xe')],'ContactId':_0xc3825c['id'],'ListId':_0xc3825c['ListId'],'CampaignId':_0x3ebcd4['id']})[_0x1069('0x2c')](function(_0x1bf86e){logger[_0x1069('0x40')](_0x1069('0x41'),_0x1069('0x19'),_0x1bf86e[_0x1069('0x42')]);});}}});})['then'](function(){_0x40f846();})[_0x1069('0x2c')](function(_0x3e9052){logger[_0x1069('0x40')]('cmContact,\x20%s,\x20%s',_0x1069('0x19'),_0x3e9052[_0x1069('0x42')]);_0x40f846(_0x3e9052);});}else{_0x40f846(new Error(_0x1069('0x44')));}},'afterDestroy':function(_0xe7751c,_0x1deba3,_0x96c3b4){var _0x4679c0=_0x59d921[_0x1069('0x45')];var _0xacc9a3=_0xe7751c['get']({'plain':!![]});return _0x4679c0[_0x1069('0x27')][_0x1069('0x3d')]({'raw':!![],'where':{'ListId':_0xacc9a3[_0x1069('0x29')],'ContactId':_0xacc9a3['id']}})['then'](function(_0x2eda39){if(!_[_0x1069('0x46')](_0x2eda39)){var _0x48a4c9=[];for(var _0x485f77=0x0;_0x485f77<_0x2eda39[_0x1069('0x3c')];_0x485f77+=0x1){var _0x401be5=_0x4679c0[_0x1069('0x27')][_0x1069('0x47')]({'where':{'ListId':_0x2eda39[_0x485f77]['ListId'],'ContactId':_0x2eda39[_0x485f77][_0x1069('0x48')],'VoiceQueueId':_0x2eda39[_0x485f77]['VoiceQueueId'],'CampaignId':_0x2eda39[_0x485f77][_0x1069('0x49')]}});_0x48a4c9[_0x1069('0x4a')](_0x401be5);}return BPromise[_0x1069('0x4b')](_0x48a4c9);}})[_0x1069('0x20')](function(_0x5a29a5){logger['info'](_0x1069('0x4c'),util[_0x1069('0x1a')](_0x5a29a5,{'showHidden':![],'depth':null}));_0x96c3b4();})[_0x1069('0x2c')](function(_0x41d538){logger[_0x1069('0x40')](_0x1069('0x4d'),util[_0x1069('0x1a')](_0x41d538,{'showHidden':![],'depth':null}));_0x96c3b4(_0x41d538);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b0daa26..18b6c6a 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(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x40c32a,_0x2284dc){var _0x50ea93=function(_0x56b36f){while(--_0x56b36f){_0x40c32a['push'](_0x40c32a['shift']());}};_0x50ea93(++_0x2284dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 23d5926..b997797 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 _0x2557=['STRING','PHONE','sequelize','INTEGER'];(function(_0x16cc89,_0x2aeeda){var _0x398421=function(_0xb0ae89){while(--_0xb0ae89){_0x16cc89['push'](_0x16cc89['shift']());}};_0x398421(++_0x2aeeda);}(_0x2557,0x11e));var _0x7255=function(_0x5e6216,_0x59412b){_0x5e6216=_0x5e6216-0x0;var _0x5037f0=_0x2557[_0x5e6216];return _0x5037f0;};'use strict';var Sequelize=require(_0x7255('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x7255('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7255('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7255('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7255('0x2')],'defaultValue':_0x7255('0x3')},'OrderBy':{'type':Sequelize[_0x7255('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x7119=['STRING','PHONE','INTEGER','exports'];(function(_0x499eb3,_0x179e0){var _0x14a6c6=function(_0xf8ab9e){while(--_0xf8ab9e){_0x499eb3['push'](_0x499eb3['shift']());}};_0x14a6c6(++_0x179e0);}(_0x7119,0x1c7));var _0x9711=function(_0xc5e02a,_0xd9da3c){_0xc5e02a=_0xc5e02a-0x0;var _0xbeca77=_0x7119[_0xc5e02a];return _0xbeca77;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9711('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9711('0x1')],'defaultValue':_0x9711('0x2')},'OrderBy':{'type':Sequelize[_0x9711('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x9711('0x1')],'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 913f768..a746c48 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 _0xab2e=['name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','error','stack'];(function(_0x2db160,_0x3dcb23){var _0x1f1542=function(_0x55e24c){while(--_0x55e24c){_0x2db160['push'](_0x2db160['shift']());}};_0x1f1542(++_0x3dcb23);}(_0xab2e,0x112));var _0xeab2=function(_0x2d1017,_0x27236f){_0x2d1017=_0x2d1017-0x0;var _0x140e85=_0xab2e[_0x2d1017];return _0x140e85;};'use strict';var emlformat=require(_0xeab2('0x0'));var rimraf=require(_0xeab2('0x1'));var zipdir=require(_0xeab2('0x2'));var jsonpatch=require(_0xeab2('0x3'));var rp=require(_0xeab2('0x4'));var moment=require(_0xeab2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeab2('0x6'));var path=require(_0xeab2('0x7'));var sox=require('sox');var csv=require(_0xeab2('0x8'));var ejs=require(_0xeab2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeab2('0xa'));var squel=require(_0xeab2('0xb'));var crypto=require(_0xeab2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeab2('0xd'));var Redis=require(_0xeab2('0xe'));var authService=require(_0xeab2('0xf'));var qs=require(_0xeab2('0x10'));var as=require(_0xeab2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeab2('0x12'));var db=require(_0xeab2('0x13'))['db'];function respondWithStatusCode(_0x1a90ec,_0x1f64ee){_0x1f64ee=_0x1f64ee||0xcc;return function(_0x28da55){if(_0x28da55){return _0x1a90ec[_0xeab2('0x14')](_0x1f64ee);}return _0x1a90ec[_0xeab2('0x15')](_0x1f64ee)[_0xeab2('0x16')]();};}function respondWithResult(_0x15c906,_0x5bb444){_0x5bb444=_0x5bb444||0xc8;return function(_0x5afc4f){if(_0x5afc4f){return _0x15c906[_0xeab2('0x15')](_0x5bb444)[_0xeab2('0x17')](_0x5afc4f);}};}function respondWithFilteredResult(_0x8cebe6,_0xbfd2d0){return function(_0x3f93fb){if(_0x3f93fb){var _0x5872cf=typeof _0xbfd2d0[_0xeab2('0x18')]==='undefined'&&typeof _0xbfd2d0[_0xeab2('0x19')]===_0xeab2('0x1a');var _0x253fee=_0x3f93fb[_0xeab2('0x1b')];var _0x4023b6=_0x5872cf?0x0:_0xbfd2d0['offset'];var _0x12f10b=_0x5872cf?_0x3f93fb['count']:_0xbfd2d0['offset']+_0xbfd2d0[_0xeab2('0x19')];var _0x115784;if(_0x12f10b>=_0x253fee){_0x12f10b=_0x253fee;_0x115784=0xc8;}else{_0x115784=0xce;}_0x8cebe6[_0xeab2('0x15')](_0x115784);return _0x8cebe6['set'](_0xeab2('0x1c'),_0x4023b6+'-'+_0x12f10b+'/'+_0x253fee)[_0xeab2('0x17')](_0x3f93fb);}return null;};}function patchUpdates(_0x3e91e5){return function(_0xc8a5c4){try{jsonpatch[_0xeab2('0x1d')](_0xc8a5c4,_0x3e91e5,!![]);}catch(_0x104257){return BPromise[_0xeab2('0x1e')](_0x104257);}return _0xc8a5c4[_0xeab2('0x1f')]();};}function saveUpdates(_0x333495,_0x2acb06){return function(_0x7b5d27){if(_0x7b5d27){return _0x7b5d27[_0xeab2('0x20')](_0x333495)['then'](function(_0x5b84a6){return _0x5b84a6;});}return null;};}function removeEntity(_0x1e74bb,_0x1b77f6){return function(_0x10aa39){if(_0x10aa39){return _0x10aa39[_0xeab2('0x21')]()[_0xeab2('0x22')](function(){var _0x5988ef=_0x10aa39[_0xeab2('0x23')]({'plain':!![]});var _0x5b99ad='CmContactHasItems';return db['UserProfileResource']['destroy']({'where':{'type':_0x5b99ad,'resourceId':_0x5988ef['id']}})['then'](function(){return _0x10aa39;});})[_0xeab2('0x22')](function(){_0x1e74bb['status'](0xcc)[_0xeab2('0x16')]();});}};}function handleEntityNotFound(_0x3aa59f,_0x4de156){return function(_0x4dbde5){if(!_0x4dbde5){_0x3aa59f[_0xeab2('0x14')](0x194);}return _0x4dbde5;};}function handleError(_0x5a7e1d,_0xd99781){_0xd99781=_0xd99781||0x1f4;return function(_0x4e79dd){logger[_0xeab2('0x24')](_0x4e79dd[_0xeab2('0x25')]);if(_0x4e79dd[_0xeab2('0x26')]){delete _0x4e79dd[_0xeab2('0x26')];}_0x5a7e1d[_0xeab2('0x15')](_0xd99781)[_0xeab2('0x27')](_0x4e79dd);};}exports['index']=function(_0x55eba1,_0x4a4b4d){var _0x391496={},_0x48dd7c={},_0x3826d3={'count':0x0,'rows':[]};var _0x46b758=_[_0xeab2('0x28')](db['CmContactHasItem'][_0xeab2('0x29')],function(_0x235728){return{'name':_0x235728[_0xeab2('0x2a')],'type':_0x235728['type'][_0xeab2('0x2b')]};});_0x48dd7c[_0xeab2('0x2c')]=_['map'](_0x46b758,_0xeab2('0x26'));_0x48dd7c[_0xeab2('0x2d')]=_[_0xeab2('0x2e')](_0x55eba1[_0xeab2('0x2d')]);_0x48dd7c['filters']=_[_0xeab2('0x2f')](_0x48dd7c[_0xeab2('0x2c')],_0x48dd7c['query']);_0x391496[_0xeab2('0x30')]=_['intersection'](_0x48dd7c[_0xeab2('0x2c')],qs['fields'](_0x55eba1['query'][_0xeab2('0x31')]));_0x391496['attributes']=_0x391496['attributes'][_0xeab2('0x32')]?_0x391496[_0xeab2('0x30')]:_0x48dd7c[_0xeab2('0x2c')];if(!_0x55eba1['query'][_0xeab2('0x33')](_0xeab2('0x34'))){_0x391496[_0xeab2('0x19')]=qs[_0xeab2('0x19')](_0x55eba1[_0xeab2('0x2d')][_0xeab2('0x19')]);_0x391496[_0xeab2('0x18')]=qs[_0xeab2('0x18')](_0x55eba1['query'][_0xeab2('0x18')]);}_0x391496['order']=qs[_0xeab2('0x35')](_0x55eba1[_0xeab2('0x2d')][_0xeab2('0x35')]);_0x391496[_0xeab2('0x36')]=qs[_0xeab2('0x37')](_[_0xeab2('0x38')](_0x55eba1[_0xeab2('0x2d')],_0x48dd7c[_0xeab2('0x37')]),_0x46b758);if(_0x55eba1[_0xeab2('0x2d')][_0xeab2('0x39')]){_0x391496[_0xeab2('0x36')]=_[_0xeab2('0x3a')](_0x391496[_0xeab2('0x36')],{'$or':_['map'](_0x46b758,function(_0x30d4cf){if(_0x30d4cf['type']!=='VIRTUAL'){var _0xe22480={};_0xe22480[_0x30d4cf['name']]={'$like':'%'+_0x55eba1[_0xeab2('0x2d')]['filter']+'%'};return _0xe22480;}})});}_0x391496=_['merge']({},_0x391496,_0x55eba1[_0xeab2('0x3b')]);var _0x2b3c50={'where':_0x391496[_0xeab2('0x36')]};return db[_0xeab2('0x3c')]['count'](_0x2b3c50)[_0xeab2('0x22')](function(_0x2d1a8d){_0x3826d3['count']=_0x2d1a8d;if(_0x55eba1[_0xeab2('0x2d')][_0xeab2('0x3d')]){_0x391496[_0xeab2('0x3e')]=[{'all':!![]}];}return db[_0xeab2('0x3c')][_0xeab2('0x3f')](_0x391496);})['then'](function(_0x1ea603){_0x3826d3[_0xeab2('0x40')]=_0x1ea603;return _0x3826d3;})[_0xeab2('0x22')](respondWithFilteredResult(_0x4a4b4d,_0x391496))[_0xeab2('0x41')](handleError(_0x4a4b4d,null));};exports[_0xeab2('0x42')]=function(_0xbc83d0,_0x1cdcab){var _0x303bf0={'raw':!![],'where':{'id':_0xbc83d0[_0xeab2('0x43')]['id']}},_0x41b2cc={};_0x41b2cc['model']=_[_0xeab2('0x2e')](db[_0xeab2('0x3c')][_0xeab2('0x29')]);_0x41b2cc[_0xeab2('0x2d')]=_[_0xeab2('0x2e')](_0xbc83d0[_0xeab2('0x2d')]);_0x41b2cc[_0xeab2('0x37')]=_[_0xeab2('0x2f')](_0x41b2cc[_0xeab2('0x2c')],_0x41b2cc['query']);_0x303bf0[_0xeab2('0x30')]=_['intersection'](_0x41b2cc[_0xeab2('0x2c')],qs[_0xeab2('0x31')](_0xbc83d0['query'][_0xeab2('0x31')]));_0x303bf0[_0xeab2('0x30')]=_0x303bf0[_0xeab2('0x30')][_0xeab2('0x32')]?_0x303bf0[_0xeab2('0x30')]:_0x41b2cc[_0xeab2('0x2c')];if(_0xbc83d0['query'][_0xeab2('0x3d')]){_0x303bf0[_0xeab2('0x3e')]=[{'all':!![]}];}_0x303bf0=_['merge']({},_0x303bf0,_0xbc83d0[_0xeab2('0x3b')]);return db[_0xeab2('0x3c')][_0xeab2('0x44')](_0x303bf0)[_0xeab2('0x22')](handleEntityNotFound(_0x1cdcab,null))[_0xeab2('0x22')](respondWithResult(_0x1cdcab,null))['catch'](handleError(_0x1cdcab,null));};exports[_0xeab2('0x45')]=function(_0x4feb08,_0xd9e3d5){return db['CmContactHasItem']['create'](_0x4feb08[_0xeab2('0x46')],{})[_0xeab2('0x22')](function(_0x45aa29){var _0x442bc5=_0x4feb08[_0xeab2('0x47')][_0xeab2('0x23')]({'plain':!![]});if(!_0x442bc5)throw new Error(_0xeab2('0x48'));if(_0x442bc5[_0xeab2('0x49')]===_0xeab2('0x47')){var _0x301b9c=_0x45aa29[_0xeab2('0x23')]({'plain':!![]});var _0x5d23de='CmContactHasItems';return db[_0xeab2('0x4a')][_0xeab2('0x44')]({'where':{'name':_0x5d23de,'userProfileId':_0x442bc5[_0xeab2('0x4b')]},'raw':!![]})[_0xeab2('0x22')](function(_0x3ee303){if(_0x3ee303&&_0x3ee303[_0xeab2('0x4c')]===0x0){return db[_0xeab2('0x4d')][_0xeab2('0x45')]({'name':_0x301b9c[_0xeab2('0x26')],'resourceId':_0x301b9c['id'],'type':_0x3ee303[_0xeab2('0x26')],'sectionId':_0x3ee303['id']},{})[_0xeab2('0x22')](function(){return _0x45aa29;});}else{return _0x45aa29;}})['catch'](function(_0x28ed0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28ed0f);throw _0x28ed0f;});}return _0x45aa29;})[_0xeab2('0x22')](respondWithResult(_0xd9e3d5,0xc9))[_0xeab2('0x41')](handleError(_0xd9e3d5,null));};exports[_0xeab2('0x20')]=function(_0x55bba2,_0x4339e4){if(_0x55bba2['body']['id']){delete _0x55bba2[_0xeab2('0x46')]['id'];}return db[_0xeab2('0x3c')][_0xeab2('0x44')]({'where':{'id':_0x55bba2[_0xeab2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4339e4,null))[_0xeab2('0x22')](saveUpdates(_0x55bba2['body'],null))['then'](respondWithResult(_0x4339e4,null))['catch'](handleError(_0x4339e4,null));};exports[_0xeab2('0x21')]=function(_0x13f628,_0x14b523){return db[_0xeab2('0x3c')]['find']({'where':{'id':_0x13f628[_0xeab2('0x43')]['id']}})[_0xeab2('0x22')](handleEntityNotFound(_0x14b523,null))[_0xeab2('0x22')](removeEntity(_0x14b523,null))['catch'](handleError(_0x14b523,null));}; \ No newline at end of file +var _0x4d31=['pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d31,0x15a));var _0x14d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d31[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x14d3('0x0'));var rimraf=require(_0x14d3('0x1'));var zipdir=require(_0x14d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14d3('0x3'));var moment=require(_0x14d3('0x4'));var BPromise=require(_0x14d3('0x5'));var Mustache=require(_0x14d3('0x6'));var util=require(_0x14d3('0x7'));var path=require(_0x14d3('0x8'));var sox=require('sox');var csv=require(_0x14d3('0x9'));var ejs=require(_0x14d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14d3('0xb'));var squel=require(_0x14d3('0xc'));var crypto=require('crypto');var jsforce=require(_0x14d3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x14d3('0x9'));var querystring=require(_0x14d3('0xe'));var Papa=require(_0x14d3('0xf'));var Redis=require(_0x14d3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14d3('0x11'));var logger=require(_0x14d3('0x12'))(_0x14d3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14d3('0x14'))['db'];function respondWithStatusCode(_0x5acda4,_0x1f11bc){_0x1f11bc=_0x1f11bc||0xcc;return function(_0x3bc954){if(_0x3bc954){return _0x5acda4[_0x14d3('0x15')](_0x1f11bc);}return _0x5acda4[_0x14d3('0x16')](_0x1f11bc)[_0x14d3('0x17')]();};}function respondWithResult(_0xc5ef94,_0x2a9e3d){_0x2a9e3d=_0x2a9e3d||0xc8;return function(_0x12b6d4){if(_0x12b6d4){return _0xc5ef94[_0x14d3('0x16')](_0x2a9e3d)['json'](_0x12b6d4);}};}function respondWithFilteredResult(_0x2c6cfc,_0xd775a8){return function(_0x157c98){if(_0x157c98){var _0x4f5014=typeof _0xd775a8['offset']===_0x14d3('0x18')&&typeof _0xd775a8['limit']==='undefined';var _0x42929b=_0x157c98[_0x14d3('0x19')];var _0x518419=_0x4f5014?0x0:_0xd775a8[_0x14d3('0x1a')];var _0x463180=_0x4f5014?_0x157c98[_0x14d3('0x19')]:_0xd775a8[_0x14d3('0x1a')]+_0xd775a8[_0x14d3('0x1b')];var _0x861eff;if(_0x463180>=_0x42929b){_0x463180=_0x42929b;_0x861eff=0xc8;}else{_0x861eff=0xce;}_0x2c6cfc[_0x14d3('0x16')](_0x861eff);return _0x2c6cfc[_0x14d3('0x1c')](_0x14d3('0x1d'),_0x518419+'-'+_0x463180+'/'+_0x42929b)[_0x14d3('0x1e')](_0x157c98);}return null;};}function patchUpdates(_0x44d6ec){return function(_0x57fc6e){try{jsonpatch[_0x14d3('0x1f')](_0x57fc6e,_0x44d6ec,!![]);}catch(_0x34855a){return BPromise[_0x14d3('0x20')](_0x34855a);}return _0x57fc6e[_0x14d3('0x21')]();};}function saveUpdates(_0x2e4774,_0x4b66ba){return function(_0xf2cbc4){if(_0xf2cbc4){return _0xf2cbc4[_0x14d3('0x22')](_0x2e4774)[_0x14d3('0x23')](function(_0x429b8b){return _0x429b8b;});}return null;};}function removeEntity(_0x554c50,_0x1dca6e){return function(_0x1028b5){if(_0x1028b5){return _0x1028b5[_0x14d3('0x24')]()[_0x14d3('0x23')](function(){var _0x452850=_0x1028b5[_0x14d3('0x25')]({'plain':!![]});var _0xe213fe=_0x14d3('0x26');return db[_0x14d3('0x27')][_0x14d3('0x24')]({'where':{'type':_0xe213fe,'resourceId':_0x452850['id']}})[_0x14d3('0x23')](function(){return _0x1028b5;});})[_0x14d3('0x23')](function(){_0x554c50['status'](0xcc)[_0x14d3('0x17')]();});}};}function handleEntityNotFound(_0x103fd2,_0x1b5d8b){return function(_0x54bd35){if(!_0x54bd35){_0x103fd2[_0x14d3('0x15')](0x194);}return _0x54bd35;};}function handleError(_0x2c04bf,_0x4a378d){_0x4a378d=_0x4a378d||0x1f4;return function(_0x539778){logger[_0x14d3('0x28')](_0x539778[_0x14d3('0x29')]);if(_0x539778[_0x14d3('0x2a')]){delete _0x539778['name'];}_0x2c04bf[_0x14d3('0x16')](_0x4a378d)['send'](_0x539778);};}exports[_0x14d3('0x2b')]=function(_0x4469b7,_0xdadef3){var _0x49b41f={},_0x5a532b={},_0x3dea8d={'count':0x0,'rows':[]};var _0x28d13b=_[_0x14d3('0x2c')](db[_0x14d3('0x2d')][_0x14d3('0x2e')],function(_0x21e329){return{'name':_0x21e329[_0x14d3('0x2f')],'type':_0x21e329[_0x14d3('0x30')]['key']};});_0x5a532b[_0x14d3('0x31')]=_['map'](_0x28d13b,_0x14d3('0x2a'));_0x5a532b[_0x14d3('0x32')]=_['keys'](_0x4469b7[_0x14d3('0x32')]);_0x5a532b['filters']=_[_0x14d3('0x33')](_0x5a532b[_0x14d3('0x31')],_0x5a532b[_0x14d3('0x32')]);_0x49b41f['attributes']=_[_0x14d3('0x33')](_0x5a532b[_0x14d3('0x31')],qs[_0x14d3('0x34')](_0x4469b7[_0x14d3('0x32')][_0x14d3('0x34')]));_0x49b41f[_0x14d3('0x35')]=_0x49b41f[_0x14d3('0x35')][_0x14d3('0x36')]?_0x49b41f['attributes']:_0x5a532b[_0x14d3('0x31')];if(!_0x4469b7[_0x14d3('0x32')][_0x14d3('0x37')]('nolimit')){_0x49b41f[_0x14d3('0x1b')]=qs['limit'](_0x4469b7[_0x14d3('0x32')][_0x14d3('0x1b')]);_0x49b41f['offset']=qs['offset'](_0x4469b7[_0x14d3('0x32')][_0x14d3('0x1a')]);}_0x49b41f[_0x14d3('0x38')]=qs[_0x14d3('0x39')](_0x4469b7['query']['sort']);_0x49b41f[_0x14d3('0x3a')]=qs['filters'](_[_0x14d3('0x3b')](_0x4469b7[_0x14d3('0x32')],_0x5a532b[_0x14d3('0x3c')]),_0x28d13b);if(_0x4469b7['query'][_0x14d3('0x3d')]){_0x49b41f['where']=_[_0x14d3('0x3e')](_0x49b41f['where'],{'$or':_[_0x14d3('0x2c')](_0x28d13b,function(_0x36ea00){if(_0x36ea00[_0x14d3('0x30')]!==_0x14d3('0x3f')){var _0x60267a={};_0x60267a[_0x36ea00['name']]={'$like':'%'+_0x4469b7[_0x14d3('0x32')]['filter']+'%'};return _0x60267a;}})});}_0x49b41f=_[_0x14d3('0x3e')]({},_0x49b41f,_0x4469b7[_0x14d3('0x40')]);var _0x153f76={'where':_0x49b41f[_0x14d3('0x3a')]};return db['CmContactHasItem'][_0x14d3('0x19')](_0x153f76)[_0x14d3('0x23')](function(_0x1b70c3){_0x3dea8d[_0x14d3('0x19')]=_0x1b70c3;if(_0x4469b7[_0x14d3('0x32')][_0x14d3('0x41')]){_0x49b41f[_0x14d3('0x42')]=[{'all':!![]}];}return db[_0x14d3('0x2d')][_0x14d3('0x43')](_0x49b41f);})[_0x14d3('0x23')](function(_0x29930f){_0x3dea8d[_0x14d3('0x44')]=_0x29930f;return _0x3dea8d;})[_0x14d3('0x23')](respondWithFilteredResult(_0xdadef3,_0x49b41f))[_0x14d3('0x45')](handleError(_0xdadef3,null));};exports[_0x14d3('0x46')]=function(_0x58fe2b,_0x2513b7){var _0x476be6={'raw':!![],'where':{'id':_0x58fe2b[_0x14d3('0x47')]['id']}},_0x2c6325={};_0x2c6325[_0x14d3('0x31')]=_[_0x14d3('0x48')](db['CmContactHasItem'][_0x14d3('0x2e')]);_0x2c6325[_0x14d3('0x32')]=_[_0x14d3('0x48')](_0x58fe2b[_0x14d3('0x32')]);_0x2c6325[_0x14d3('0x3c')]=_[_0x14d3('0x33')](_0x2c6325[_0x14d3('0x31')],_0x2c6325['query']);_0x476be6[_0x14d3('0x35')]=_[_0x14d3('0x33')](_0x2c6325['model'],qs[_0x14d3('0x34')](_0x58fe2b[_0x14d3('0x32')][_0x14d3('0x34')]));_0x476be6[_0x14d3('0x35')]=_0x476be6[_0x14d3('0x35')][_0x14d3('0x36')]?_0x476be6[_0x14d3('0x35')]:_0x2c6325[_0x14d3('0x31')];if(_0x58fe2b[_0x14d3('0x32')][_0x14d3('0x41')]){_0x476be6['include']=[{'all':!![]}];}_0x476be6=_[_0x14d3('0x3e')]({},_0x476be6,_0x58fe2b[_0x14d3('0x40')]);return db[_0x14d3('0x2d')][_0x14d3('0x49')](_0x476be6)[_0x14d3('0x23')](handleEntityNotFound(_0x2513b7,null))[_0x14d3('0x23')](respondWithResult(_0x2513b7,null))[_0x14d3('0x45')](handleError(_0x2513b7,null));};exports[_0x14d3('0x4a')]=function(_0x597cfc,_0x8a210b){return db[_0x14d3('0x2d')][_0x14d3('0x4a')](_0x597cfc[_0x14d3('0x4b')],{})[_0x14d3('0x23')](function(_0x29dca6){var _0x16016f=_0x597cfc[_0x14d3('0x4c')]['get']({'plain':!![]});if(!_0x16016f)throw new Error(_0x14d3('0x4d'));if(_0x16016f['role']===_0x14d3('0x4c')){var _0x578f71=_0x29dca6[_0x14d3('0x25')]({'plain':!![]});var _0xea0d28=_0x14d3('0x26');return db[_0x14d3('0x4e')]['find']({'where':{'name':_0xea0d28,'userProfileId':_0x16016f[_0x14d3('0x4f')]},'raw':!![]})[_0x14d3('0x23')](function(_0x4825c1){if(_0x4825c1&&_0x4825c1['autoAssociation']===0x0){return db[_0x14d3('0x27')]['create']({'name':_0x578f71[_0x14d3('0x2a')],'resourceId':_0x578f71['id'],'type':_0x4825c1[_0x14d3('0x2a')],'sectionId':_0x4825c1['id']},{})[_0x14d3('0x23')](function(){return _0x29dca6;});}else{return _0x29dca6;}})[_0x14d3('0x45')](function(_0x2762ec){logger['error'](_0x14d3('0x50'),_0x2762ec);throw _0x2762ec;});}return _0x29dca6;})[_0x14d3('0x23')](respondWithResult(_0x8a210b,0xc9))[_0x14d3('0x45')](handleError(_0x8a210b,null));};exports[_0x14d3('0x22')]=function(_0x39da61,_0x1998a7){if(_0x39da61[_0x14d3('0x4b')]['id']){delete _0x39da61[_0x14d3('0x4b')]['id'];}return db[_0x14d3('0x2d')][_0x14d3('0x49')]({'where':{'id':_0x39da61['params']['id']}})[_0x14d3('0x23')](handleEntityNotFound(_0x1998a7,null))[_0x14d3('0x23')](saveUpdates(_0x39da61[_0x14d3('0x4b')],null))[_0x14d3('0x23')](respondWithResult(_0x1998a7,null))[_0x14d3('0x45')](handleError(_0x1998a7,null));};exports[_0x14d3('0x24')]=function(_0x25d833,_0x58778c){return db[_0x14d3('0x2d')][_0x14d3('0x49')]({'where':{'id':_0x25d833[_0x14d3('0x47')]['id']}})[_0x14d3('0x23')](handleEntityNotFound(_0x58778c,null))[_0x14d3('0x23')](removeEntity(_0x58778c,null))[_0x14d3('0x45')](handleError(_0x58778c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4d69129..cb7e89e 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 _0xbf8d=['lodash','util','api','moment','bluebird','request-promise','./cmContactHasItem.attributes','define','CmContactHasItem'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0xbf8d,0xf3));var _0xdbf8=function(_0x53dc56,_0x2b0c7d){_0x53dc56=_0x53dc56-0x0;var _0xb6e10a=_0xbf8d[_0x53dc56];return _0xb6e10a;};'use strict';var _=require(_0xdbf8('0x0'));var util=require(_0xdbf8('0x1'));var logger=require('../../config/logger')(_0xdbf8('0x2'));var moment=require(_0xdbf8('0x3'));var BPromise=require(_0xdbf8('0x4'));var rp=require(_0xdbf8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdbf8('0x6'));module['exports']=function(_0x5933a4,_0x4c8158){return _0x5933a4[_0xdbf8('0x7')](_0xdbf8('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x855c=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ecba1,_0xee4fd0){var _0x150d19=function(_0x3449b4){while(--_0x3449b4){_0x4ecba1['push'](_0x4ecba1['shift']());}};_0x150d19(++_0xee4fd0);}(_0x855c,0x65));var _0xc855=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x855c[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xc855('0x0'));var util=require(_0xc855('0x1'));var logger=require(_0xc855('0x2'))(_0xc855('0x3'));var moment=require('moment');var BPromise=require(_0xc855('0x4'));var rp=require(_0xc855('0x5'));var fs=require('fs');var path=require(_0xc855('0x6'));var rimraf=require(_0xc855('0x7'));var config=require(_0xc855('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0xc855('0x9')]=function(_0x26d7b7,_0x4463e9){return _0x26d7b7['define']('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9e8ce57..21f9689 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 _0x924e=['jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x507d23,_0x3f2b99){var _0x3eb3f8=function(_0x25753d){while(--_0x25753d){_0x507d23['push'](_0x507d23['shift']());}};_0x3eb3f8(++_0x3f2b99);}(_0x924e,0x1c1));var _0xe924=function(_0xbde02c,_0x2af450){_0xbde02c=_0xbde02c-0x0;var _0x54421a=_0x924e[_0xbde02c];return _0x54421a;};'use strict';var _=require('lodash');var util=require(_0xe924('0x0'));var moment=require('moment');var BPromise=require(_0xe924('0x1'));var rs=require(_0xe924('0x2'));var fs=require('fs');var Redis=require(_0xe924('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe924('0x4'));var logger=require(_0xe924('0x5'))(_0xe924('0x6'));var config=require('../../config/environment');var jayson=require(_0xe924('0x7'));var client=jayson[_0xe924('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2deeb4,_0x25d1fe,_0x3fe02c){return new BPromise(function(_0x159497,_0x24e146){return client[_0xe924('0x9')](_0x2deeb4,_0x3fe02c)[_0xe924('0xa')](function(_0x4507f2){logger[_0xe924('0xb')](_0xe924('0xc'),_0x25d1fe,_0xe924('0xd'));logger[_0xe924('0xe')](_0xe924('0xf'),_0x25d1fe,_0xe924('0xd'),JSON['stringify'](_0x4507f2));if(_0x4507f2[_0xe924('0x10')]){if(_0x4507f2[_0xe924('0x10')][_0xe924('0x11')]===0x1f4){logger[_0xe924('0x10')](_0xe924('0xc'),_0x25d1fe,_0x4507f2['error'][_0xe924('0x12')]);return _0x24e146(_0x4507f2[_0xe924('0x10')]['message']);}logger['error'](_0xe924('0xc'),_0x25d1fe,_0x4507f2[_0xe924('0x10')][_0xe924('0x12')]);return _0x159497(_0x4507f2['error'][_0xe924('0x12')]);}else{logger[_0xe924('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x25d1fe,'request\x20sent');_0x159497(_0x4507f2['result'][_0xe924('0x12')]);}})['catch'](function(_0x19bd15){logger[_0xe924('0x10')](_0xe924('0xc'),_0x25d1fe,_0x19bd15);_0x24e146(_0x19bd15);});});} \ No newline at end of file +var _0xedf1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util','bluebird'];(function(_0x4e6b4f,_0x115923){var _0xb52296=function(_0x2c8765){while(--_0x2c8765){_0x4e6b4f['push'](_0x4e6b4f['shift']());}};_0xb52296(++_0x115923);}(_0xedf1,0x10b));var _0x1edf=function(_0x3ff6bf,_0x25d056){_0x3ff6bf=_0x3ff6bf-0x0;var _0x287dc6=_0xedf1[_0x3ff6bf];return _0x287dc6;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require(_0x1edf('0x2'));var rs=require(_0x1edf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1edf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34d858,_0x354d10,_0x35e5e9){return new BPromise(function(_0x3918cf,_0x2541ab){return client['request'](_0x34d858,_0x35e5e9)[_0x1edf('0x9')](function(_0x34ce64){logger['info'](_0x1edf('0xa'),_0x354d10,_0x1edf('0xb'));logger[_0x1edf('0xc')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x354d10,_0x1edf('0xb'),JSON['stringify'](_0x34ce64));if(_0x34ce64['error']){if(_0x34ce64[_0x1edf('0xd')][_0x1edf('0xe')]===0x1f4){logger[_0x1edf('0xd')](_0x1edf('0xa'),_0x354d10,_0x34ce64['error'][_0x1edf('0xf')]);return _0x2541ab(_0x34ce64[_0x1edf('0xd')]['message']);}logger['error'](_0x1edf('0xa'),_0x354d10,_0x34ce64[_0x1edf('0xd')][_0x1edf('0xf')]);return _0x3918cf(_0x34ce64[_0x1edf('0xd')][_0x1edf('0xf')]);}else{logger[_0x1edf('0x10')](_0x1edf('0xa'),_0x354d10,_0x1edf('0xb'));_0x3918cf(_0x34ce64['result'][_0x1edf('0xf')]);}})[_0x1edf('0x11')](function(_0x17c89d){logger[_0x1edf('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x354d10,_0x17c89d);_0x2541ab(_0x17c89d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6c77774..b56be8d 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 _0x84a1=['fs-extra','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x84a1,0x172));var _0x184a=function(_0x92fbe0,_0x4f7749){_0x92fbe0=_0x92fbe0-0x0;var _0xd03f8f=_0x84a1[_0x92fbe0];return _0xd03f8f;};'use strict';var multer=require('multer');var util=require(_0x184a('0x0'));var path=require('path');var timeout=require(_0x184a('0x1'));var express=require(_0x184a('0x2'));var router=express[_0x184a('0x3')]();var fs_extra=require(_0x184a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x184a('0x5'));router['get']('/',auth[_0x184a('0x6')](),controller[_0x184a('0x7')]);router[_0x184a('0x8')](_0x184a('0x9'),auth['isAuthenticated'](),controller[_0x184a('0xa')]);router['post']('/',auth[_0x184a('0x6')](),controller[_0x184a('0xb')]);router[_0x184a('0xc')](_0x184a('0x9'),auth['isAuthenticated'](),controller[_0x184a('0xd')]);router[_0x184a('0xe')](_0x184a('0x9'),auth[_0x184a('0x6')](),controller[_0x184a('0xf')]);module[_0x184a('0x10')]=router; \ No newline at end of file +var _0x24f0=['post','destroy','exports','connect-timeout','express','Router','./cmContactHasItem.controller','get','isAuthenticated','index','/:id'];(function(_0x3e28dd,_0xb875fb){var _0x2161c1=function(_0x34a50){while(--_0x34a50){_0x3e28dd['push'](_0x3e28dd['shift']());}};_0x2161c1(++_0xb875fb);}(_0x24f0,0xbe));var _0x024f=function(_0x902048,_0x13029d){_0x902048=_0x902048-0x0;var _0x170b4b=_0x24f0[_0x902048];return _0x170b4b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x024f('0x0'));var express=require(_0x024f('0x1'));var router=express[_0x024f('0x2')]();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(_0x024f('0x3'));router[_0x024f('0x4')]('/',auth[_0x024f('0x5')](),controller[_0x024f('0x6')]);router[_0x024f('0x4')](_0x024f('0x7'),auth[_0x024f('0x5')](),controller['show']);router[_0x024f('0x8')]('/',auth[_0x024f('0x5')](),controller['create']);router['put'](_0x024f('0x7'),auth[_0x024f('0x5')](),controller['update']);router['delete'](_0x024f('0x7'),auth['isAuthenticated'](),controller[_0x024f('0x9')]);module[_0x024f('0xa')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8678f51..0dd903a 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 _0x2bc6=['setDataValue','name','TEXT','long','parse','isArray','stringify','values','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x4176ff,_0x44c7ed){var _0x407b05=function(_0x4d06db){while(--_0x4d06db){_0x4176ff['push'](_0x4176ff['shift']());}};_0x407b05(++_0x44c7ed);}(_0x2bc6,0x1c4));var _0x62bc=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0x2bc6[_0x369534];return _0x524bf9;};'use strict';var Sequelize=require(_0x62bc('0x0'));var _=require(_0x62bc('0x1'));module[_0x62bc('0x2')]={'name':{'type':Sequelize[_0x62bc('0x3')],'get':function(_0x3937ce){return this[_0x62bc('0x4')](_0x62bc('0x5'));}},'alias':{'type':Sequelize[_0x62bc('0x6')],'allowNull':![],'set':function(_0xc3311a){this[_0x62bc('0x7')](_0x62bc('0x5'),_0xc3311a?_0xc3311a:this[_0x62bc('0x4')](_0x62bc('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x62bc('0x9')](_0x62bc('0xa')),'get':function(){if(this[_0x62bc('0x4')]('type')==='select'){return JSON[_0x62bc('0xb')](this[_0x62bc('0x4')]('values'));}else{return this[_0x62bc('0x4')]('values');}},'set':function(_0x4e1c6b){if(Array[_0x62bc('0xc')](_0x4e1c6b)){this['setDataValue']('values',JSON[_0x62bc('0xd')](_0x4e1c6b));}else{this[_0x62bc('0x7')](_0x62bc('0xe'),_0x4e1c6b);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x62bc('0xf')](_0x62bc('0x10'))}}; \ No newline at end of file +var _0x18ca=['sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0x18ca,0x90));var _0xa18c=function(_0x4d7e75,_0x35fb13){_0x4d7e75=_0x4d7e75-0x0;var _0x10a3d6=_0x18ca[_0x4d7e75];return _0x10a3d6;};'use strict';var Sequelize=require(_0xa18c('0x0'));var _=require('lodash');module[_0xa18c('0x1')]={'name':{'type':Sequelize[_0xa18c('0x2')],'get':function(_0x4df63d){return this[_0xa18c('0x3')](_0xa18c('0x4'));}},'alias':{'type':Sequelize[_0xa18c('0x5')],'allowNull':![],'set':function(_0x190745){this[_0xa18c('0x6')](_0xa18c('0x4'),_0x190745?_0x190745:this['getDataValue'](_0xa18c('0x7')));}},'type':{'type':Sequelize[_0xa18c('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xa18c('0x8')](_0xa18c('0x9')),'get':function(){if(this[_0xa18c('0x3')](_0xa18c('0xa'))===_0xa18c('0xb')){return JSON[_0xa18c('0xc')](this[_0xa18c('0x3')](_0xa18c('0xd')));}else{return this['getDataValue'](_0xa18c('0xd'));}},'set':function(_0x21658e){if(Array[_0xa18c('0xe')](_0x21658e)){this[_0xa18c('0x6')](_0xa18c('0xd'),JSON[_0xa18c('0xf')](_0x21658e));}else{this['setDataValue'](_0xa18c('0xd'),_0x21658e);}}},'required':{'type':Sequelize[_0xa18c('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa18c('0x11')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5470e0f..d75f156 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 _0x530e=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','CmCustomField','include','rows','catch','show','params','merge','find','body','create','sequelize','Sequelize','INTEGER','defaultValue','queryInterface','format','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x1c2aa5,_0x3dbadf){var _0x3a6e9e=function(_0x30551e){while(--_0x30551e){_0x1c2aa5['push'](_0x1c2aa5['shift']());}};_0x3a6e9e(++_0x3dbadf);}(_0x530e,0x86));var _0xe530=function(_0x5f37c2,_0x2e575d){_0x5f37c2=_0x5f37c2-0x0;var _0x424fb4=_0x530e[_0x5f37c2];return _0x424fb4;};'use strict';var emlformat=require(_0xe530('0x0'));var rimraf=require(_0xe530('0x1'));var zipdir=require(_0xe530('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe530('0x3'));var BPromise=require(_0xe530('0x4'));var Mustache=require('mustache');var util=require(_0xe530('0x5'));var path=require(_0xe530('0x6'));var sox=require(_0xe530('0x7'));var csv=require(_0xe530('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe530('0x9'));var _=require(_0xe530('0xa'));var squel=require(_0xe530('0xb'));var crypto=require('crypto');var jsforce=require(_0xe530('0xc'));var deskjs=require(_0xe530('0xd'));var toCsv=require(_0xe530('0x8'));var querystring=require('querystring');var Papa=require(_0xe530('0xe'));var Redis=require(_0xe530('0xf'));var authService=require(_0xe530('0x10'));var qs=require(_0xe530('0x11'));var as=require(_0xe530('0x12'));var hardwareService=require(_0xe530('0x13'));var logger=require('../../config/logger')(_0xe530('0x14'));var utils=require(_0xe530('0x15'));var config=require(_0xe530('0x16'));var licenseUtil=require(_0xe530('0x17'));var db=require(_0xe530('0x18'))['db'];function respondWithStatusCode(_0x3daa6f,_0x45e34f){_0x45e34f=_0x45e34f||0xcc;return function(_0x39a778){if(_0x39a778){return _0x3daa6f[_0xe530('0x19')](_0x45e34f);}return _0x3daa6f[_0xe530('0x1a')](_0x45e34f)[_0xe530('0x1b')]();};}function respondWithResult(_0x1bb699,_0x3fc201){_0x3fc201=_0x3fc201||0xc8;return function(_0x226edc){if(_0x226edc){return _0x1bb699[_0xe530('0x1a')](_0x3fc201)[_0xe530('0x1c')](_0x226edc);}};}function respondWithFilteredResult(_0x3c284d,_0x414644){return function(_0x179134){if(_0x179134){var _0x238c91=typeof _0x414644['offset']===_0xe530('0x1d')&&typeof _0x414644[_0xe530('0x1e')]===_0xe530('0x1d');var _0x41d5c7=_0x179134[_0xe530('0x1f')];var _0x2f18b5=_0x238c91?0x0:_0x414644[_0xe530('0x20')];var _0x4f2bf4=_0x238c91?_0x179134[_0xe530('0x1f')]:_0x414644['offset']+_0x414644[_0xe530('0x1e')];var _0x439af5;if(_0x4f2bf4>=_0x41d5c7){_0x4f2bf4=_0x41d5c7;_0x439af5=0xc8;}else{_0x439af5=0xce;}_0x3c284d['status'](_0x439af5);return _0x3c284d['set'](_0xe530('0x21'),_0x2f18b5+'-'+_0x4f2bf4+'/'+_0x41d5c7)[_0xe530('0x1c')](_0x179134);}return null;};}function patchUpdates(_0x15aae3){return function(_0x2a7088){try{jsonpatch[_0xe530('0x22')](_0x2a7088,_0x15aae3,!![]);}catch(_0x2ba4ce){return BPromise[_0xe530('0x23')](_0x2ba4ce);}return _0x2a7088[_0xe530('0x24')]();};}function saveUpdates(_0x12d82a,_0x247e12){return function(_0x221b85){if(_0x221b85){return _0x221b85[_0xe530('0x25')](_0x12d82a)[_0xe530('0x26')](function(_0x2c7c37){return _0x2c7c37;});}return null;};}function removeEntity(_0x4d1adb,_0x9d25c6){return function(_0x200582){if(_0x200582){return _0x200582[_0xe530('0x27')]()[_0xe530('0x26')](function(){_0x4d1adb[_0xe530('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e0e29,_0x119216){return function(_0xacef5){if(!_0xacef5){_0x2e0e29[_0xe530('0x19')](0x194);}return _0xacef5;};}function handleError(_0x2be6f,_0x3a1e5d){_0x3a1e5d=_0x3a1e5d||0x1f4;return function(_0x5a1667){logger['error'](_0x5a1667[_0xe530('0x28')]);if(_0x5a1667['name']){delete _0x5a1667[_0xe530('0x29')];}_0x2be6f[_0xe530('0x1a')](_0x3a1e5d)[_0xe530('0x2a')](_0x5a1667);};}exports[_0xe530('0x2b')]=function(_0x5ae32a,_0xa2504){var _0x39c33b={},_0xc2a662={},_0x35e959={'count':0x0,'rows':[]};var _0x27d694=_[_0xe530('0x2c')](db['CmCustomField'][_0xe530('0x2d')],function(_0xb2b8b6){return{'name':_0xb2b8b6[_0xe530('0x2e')],'type':_0xb2b8b6[_0xe530('0x2f')][_0xe530('0x30')]};});_0xc2a662[_0xe530('0x31')]=_[_0xe530('0x32')](_[_0xe530('0x2c')](_0x27d694,_0xe530('0x29')),[_0xe530('0x29')]);_0xc2a662['query']=_[_0xe530('0x33')](_0x5ae32a[_0xe530('0x34')]);_0xc2a662['filters']=_['intersection'](_0xc2a662[_0xe530('0x31')],_0xc2a662[_0xe530('0x34')]);_0x39c33b[_0xe530('0x35')]=_[_0xe530('0x36')](_0xc2a662[_0xe530('0x31')],qs[_0xe530('0x37')](_0x5ae32a[_0xe530('0x34')][_0xe530('0x37')]));_0x39c33b['attributes']=_0x39c33b[_0xe530('0x35')][_0xe530('0x38')]?_0x39c33b[_0xe530('0x35')]:_0xc2a662[_0xe530('0x31')];if(!_0x5ae32a[_0xe530('0x34')][_0xe530('0x39')](_0xe530('0x3a'))){_0x39c33b[_0xe530('0x1e')]=qs[_0xe530('0x1e')](_0x5ae32a[_0xe530('0x34')][_0xe530('0x1e')]);_0x39c33b[_0xe530('0x20')]=qs[_0xe530('0x20')](_0x5ae32a[_0xe530('0x34')][_0xe530('0x20')]);}_0x39c33b[_0xe530('0x3b')]=qs[_0xe530('0x3c')](_0x5ae32a[_0xe530('0x34')][_0xe530('0x3c')]);_0x39c33b[_0xe530('0x3d')]=qs[_0xe530('0x3e')](_[_0xe530('0x3f')](_0x5ae32a[_0xe530('0x34')],_0xc2a662[_0xe530('0x3e')]),_0x27d694);if(_0x5ae32a[_0xe530('0x34')][_0xe530('0x40')]){_0x39c33b[_0xe530('0x3d')]=_['merge'](_0x39c33b[_0xe530('0x3d')],{'$or':_[_0xe530('0x2c')](_0x27d694,function(_0x5cdf99){if(_0x5cdf99[_0xe530('0x2f')]!=='VIRTUAL'){var _0x3b325d={};_0x3b325d[_0x5cdf99[_0xe530('0x29')]]={'$like':'%'+_0x5ae32a[_0xe530('0x34')][_0xe530('0x40')]+'%'};return _0x3b325d;}})});}_0x39c33b=_['merge']({},_0x39c33b,_0x5ae32a[_0xe530('0x41')]);var _0x33c394={'where':_0x39c33b[_0xe530('0x3d')]};return db[_0xe530('0x42')]['count'](_0x33c394)['then'](function(_0x510873){_0x35e959[_0xe530('0x1f')]=_0x510873;if(_0x5ae32a[_0xe530('0x34')]['includeAll']){_0x39c33b[_0xe530('0x43')]=[{'all':!![]}];}return db[_0xe530('0x42')]['findAll'](_0x39c33b);})['then'](function(_0xf8f070){_0x35e959[_0xe530('0x44')]=_0xf8f070;return _0x35e959;})[_0xe530('0x26')](respondWithFilteredResult(_0xa2504,_0x39c33b))[_0xe530('0x45')](handleError(_0xa2504,null));};exports[_0xe530('0x46')]=function(_0x11ff95,_0x4d4106){var _0x11bc9c={'raw':!![],'where':{'id':_0x11ff95[_0xe530('0x47')]['id']}},_0x3f7863={};_0x3f7863['model']=_[_0xe530('0x33')](db[_0xe530('0x42')][_0xe530('0x2d')]);_0x3f7863[_0xe530('0x34')]=_['keys'](_0x11ff95[_0xe530('0x34')]);_0x3f7863[_0xe530('0x3e')]=_[_0xe530('0x36')](_0x3f7863[_0xe530('0x31')],_0x3f7863[_0xe530('0x34')]);_0x11bc9c[_0xe530('0x35')]=_[_0xe530('0x36')](_0x3f7863[_0xe530('0x31')],qs[_0xe530('0x37')](_0x11ff95[_0xe530('0x34')][_0xe530('0x37')]));_0x11bc9c[_0xe530('0x35')]=_0x11bc9c[_0xe530('0x35')]['length']?_0x11bc9c[_0xe530('0x35')]:_0x3f7863['model'];if(_0x11ff95[_0xe530('0x34')]['includeAll']){_0x11bc9c['include']=[{'all':!![]}];}_0x11bc9c=_[_0xe530('0x48')]({},_0x11bc9c,_0x11ff95[_0xe530('0x41')]);return db[_0xe530('0x42')][_0xe530('0x49')](_0x11bc9c)[_0xe530('0x26')](handleEntityNotFound(_0x4d4106,null))[_0xe530('0x26')](respondWithResult(_0x4d4106,null))[_0xe530('0x45')](handleError(_0x4d4106,null));};exports['update']=function(_0x4c18cc,_0xdf8795){if(_0x4c18cc[_0xe530('0x4a')]['id']){delete _0x4c18cc[_0xe530('0x4a')]['id'];}return db[_0xe530('0x42')][_0xe530('0x49')]({'where':{'id':_0x4c18cc[_0xe530('0x47')]['id']}})[_0xe530('0x26')](handleEntityNotFound(_0xdf8795,null))[_0xe530('0x26')](saveUpdates(_0x4c18cc[_0xe530('0x4a')],null))[_0xe530('0x26')](respondWithResult(_0xdf8795,null))[_0xe530('0x45')](handleError(_0xdf8795,null));};exports[_0xe530('0x27')]=function(_0x5403ef,_0x5b6b02){return db[_0xe530('0x42')][_0xe530('0x49')]({'where':{'id':_0x5403ef['params']['id']}})[_0xe530('0x26')](handleEntityNotFound(_0x5b6b02,null))['then'](removeEntity(_0x5b6b02,null))[_0xe530('0x45')](handleError(_0x5b6b02,null));};exports[_0xe530('0x4b')]=function(_0x40be3a,_0x523794){var _0x8c676a;return db[_0xe530('0x4c')]['transaction'](function(_0x2ac962){return db[_0xe530('0x42')]['create'](_0x40be3a[_0xe530('0x4a')],{'transaction':_0x2ac962})[_0xe530('0x26')](function(_0x81b81c){_0x8c676a=_0x81b81c;var _0x50196f={'type':db[_0xe530('0x4d')]['TEXT'],'transaction':_0x2ac962};switch(_0x40be3a['body']['type']){case'text':_0x50196f[_0xe530('0x2f')]=db[_0xe530('0x4d')]['TEXT'];break;case'number':_0x50196f['type']=db[_0xe530('0x4d')][_0xe530('0x4e')];break;case'switch':_0x50196f[_0xe530('0x2f')]=db[_0xe530('0x4d')]['BOOLEAN'];_0x50196f[_0xe530('0x4f')]=![];break;default:}return db[_0xe530('0x4c')][_0xe530('0x50')]['addColumn']('cm_contacts',util[_0xe530('0x51')]('cf_%d',_0x8c676a['id']),_0x50196f);})[_0xe530('0x26')](function(){return _0x8c676a;});})[_0xe530('0x26')](respondWithResult(_0x523794,0xc9))[_0xe530('0x45')](handleError(_0x523794,null));}; \ No newline at end of file +var _0xd978=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name','send','CmCustomField','rawAttributes','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','update','body','find','destroy','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x786cad,_0x2cb916){var _0xc8ca5f=function(_0x49768a){while(--_0x49768a){_0x786cad['push'](_0x786cad['shift']());}};_0xc8ca5f(++_0x2cb916);}(_0xd978,0x1b1));var _0x8d97=function(_0x2f4db3,_0x6b109d){_0x2f4db3=_0x2f4db3-0x0;var _0x39ce3e=_0xd978[_0x2f4db3];return _0x39ce3e;};'use strict';var emlformat=require(_0x8d97('0x0'));var rimraf=require(_0x8d97('0x1'));var zipdir=require(_0x8d97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d97('0x3'));var moment=require('moment');var BPromise=require(_0x8d97('0x4'));var Mustache=require(_0x8d97('0x5'));var util=require(_0x8d97('0x6'));var path=require(_0x8d97('0x7'));var sox=require(_0x8d97('0x8'));var csv=require(_0x8d97('0x9'));var ejs=require(_0x8d97('0xa'));var fs=require('fs');var fs_extra=require(_0x8d97('0xb'));var _=require(_0x8d97('0xc'));var squel=require(_0x8d97('0xd'));var crypto=require('crypto');var jsforce=require(_0x8d97('0xe'));var deskjs=require(_0x8d97('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8d97('0x10'));var Papa=require('papaparse');var Redis=require(_0x8d97('0x11'));var authService=require(_0x8d97('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8d97('0x13'));var hardwareService=require(_0x8d97('0x14'));var logger=require(_0x8d97('0x15'))(_0x8d97('0x16'));var utils=require(_0x8d97('0x17'));var config=require(_0x8d97('0x18'));var licenseUtil=require(_0x8d97('0x19'));var db=require(_0x8d97('0x1a'))['db'];function respondWithStatusCode(_0x1be9d3,_0xd111b0){_0xd111b0=_0xd111b0||0xcc;return function(_0xed2b18){if(_0xed2b18){return _0x1be9d3[_0x8d97('0x1b')](_0xd111b0);}return _0x1be9d3[_0x8d97('0x1c')](_0xd111b0)['end']();};}function respondWithResult(_0x11ec6b,_0x2bfd25){_0x2bfd25=_0x2bfd25||0xc8;return function(_0x17838b){if(_0x17838b){return _0x11ec6b[_0x8d97('0x1c')](_0x2bfd25)[_0x8d97('0x1d')](_0x17838b);}};}function respondWithFilteredResult(_0x2e3148,_0x251916){return function(_0x539bf3){if(_0x539bf3){var _0x416a8b=typeof _0x251916[_0x8d97('0x1e')]===_0x8d97('0x1f')&&typeof _0x251916[_0x8d97('0x20')]===_0x8d97('0x1f');var _0x3996a9=_0x539bf3[_0x8d97('0x21')];var _0x5a0d9b=_0x416a8b?0x0:_0x251916[_0x8d97('0x1e')];var _0x4293bd=_0x416a8b?_0x539bf3['count']:_0x251916[_0x8d97('0x1e')]+_0x251916[_0x8d97('0x20')];var _0x5e4589;if(_0x4293bd>=_0x3996a9){_0x4293bd=_0x3996a9;_0x5e4589=0xc8;}else{_0x5e4589=0xce;}_0x2e3148[_0x8d97('0x1c')](_0x5e4589);return _0x2e3148[_0x8d97('0x22')](_0x8d97('0x23'),_0x5a0d9b+'-'+_0x4293bd+'/'+_0x3996a9)[_0x8d97('0x1d')](_0x539bf3);}return null;};}function patchUpdates(_0x19feb0){return function(_0x3b7a46){try{jsonpatch[_0x8d97('0x24')](_0x3b7a46,_0x19feb0,!![]);}catch(_0x3fe3a1){return BPromise[_0x8d97('0x25')](_0x3fe3a1);}return _0x3b7a46['save']();};}function saveUpdates(_0x542528,_0x35e2b8){return function(_0x557a5c){if(_0x557a5c){return _0x557a5c['update'](_0x542528)[_0x8d97('0x26')](function(_0x4d1d88){return _0x4d1d88;});}return null;};}function removeEntity(_0x5dbd83,_0x4cbf04){return function(_0x263c9b){if(_0x263c9b){return _0x263c9b['destroy']()[_0x8d97('0x26')](function(){_0x5dbd83[_0x8d97('0x1c')](0xcc)[_0x8d97('0x27')]();});}};}function handleEntityNotFound(_0x38348c,_0x14ff59){return function(_0x46aa97){if(!_0x46aa97){_0x38348c[_0x8d97('0x1b')](0x194);}return _0x46aa97;};}function handleError(_0x3d2f01,_0x2a0540){_0x2a0540=_0x2a0540||0x1f4;return function(_0x560945){logger[_0x8d97('0x28')](_0x560945[_0x8d97('0x29')]);if(_0x560945[_0x8d97('0x2a')]){delete _0x560945[_0x8d97('0x2a')];}_0x3d2f01[_0x8d97('0x1c')](_0x2a0540)[_0x8d97('0x2b')](_0x560945);};}exports['index']=function(_0x482044,_0x3f54ce){var _0x2bdb15={},_0x2bcb7e={},_0x5eb763={'count':0x0,'rows':[]};var _0x255b16=_['map'](db[_0x8d97('0x2c')][_0x8d97('0x2d')],function(_0x32c1a0){return{'name':_0x32c1a0['fieldName'],'type':_0x32c1a0['type']['key']};});_0x2bcb7e['model']=_[_0x8d97('0x2e')](_[_0x8d97('0x2f')](_0x255b16,_0x8d97('0x2a')),[_0x8d97('0x2a')]);_0x2bcb7e[_0x8d97('0x30')]=_[_0x8d97('0x31')](_0x482044[_0x8d97('0x30')]);_0x2bcb7e[_0x8d97('0x32')]=_[_0x8d97('0x33')](_0x2bcb7e[_0x8d97('0x34')],_0x2bcb7e[_0x8d97('0x30')]);_0x2bdb15[_0x8d97('0x35')]=_[_0x8d97('0x33')](_0x2bcb7e[_0x8d97('0x34')],qs[_0x8d97('0x36')](_0x482044[_0x8d97('0x30')][_0x8d97('0x36')]));_0x2bdb15[_0x8d97('0x35')]=_0x2bdb15[_0x8d97('0x35')]['length']?_0x2bdb15[_0x8d97('0x35')]:_0x2bcb7e[_0x8d97('0x34')];if(!_0x482044[_0x8d97('0x30')][_0x8d97('0x37')](_0x8d97('0x38'))){_0x2bdb15[_0x8d97('0x20')]=qs[_0x8d97('0x20')](_0x482044[_0x8d97('0x30')][_0x8d97('0x20')]);_0x2bdb15[_0x8d97('0x1e')]=qs[_0x8d97('0x1e')](_0x482044[_0x8d97('0x30')][_0x8d97('0x1e')]);}_0x2bdb15['order']=qs[_0x8d97('0x39')](_0x482044[_0x8d97('0x30')][_0x8d97('0x39')]);_0x2bdb15[_0x8d97('0x3a')]=qs['filters'](_[_0x8d97('0x3b')](_0x482044[_0x8d97('0x30')],_0x2bcb7e[_0x8d97('0x32')]),_0x255b16);if(_0x482044[_0x8d97('0x30')][_0x8d97('0x3c')]){_0x2bdb15[_0x8d97('0x3a')]=_[_0x8d97('0x3d')](_0x2bdb15[_0x8d97('0x3a')],{'$or':_[_0x8d97('0x2f')](_0x255b16,function(_0x1c4d5f){if(_0x1c4d5f[_0x8d97('0x3e')]!=='VIRTUAL'){var _0x8af248={};_0x8af248[_0x1c4d5f[_0x8d97('0x2a')]]={'$like':'%'+_0x482044[_0x8d97('0x30')][_0x8d97('0x3c')]+'%'};return _0x8af248;}})});}_0x2bdb15=_['merge']({},_0x2bdb15,_0x482044[_0x8d97('0x3f')]);var _0x49d74b={'where':_0x2bdb15[_0x8d97('0x3a')]};return db['CmCustomField']['count'](_0x49d74b)[_0x8d97('0x26')](function(_0x15abd9){_0x5eb763[_0x8d97('0x21')]=_0x15abd9;if(_0x482044[_0x8d97('0x30')][_0x8d97('0x40')]){_0x2bdb15[_0x8d97('0x41')]=[{'all':!![]}];}return db[_0x8d97('0x2c')][_0x8d97('0x42')](_0x2bdb15);})['then'](function(_0x162f61){_0x5eb763[_0x8d97('0x43')]=_0x162f61;return _0x5eb763;})['then'](respondWithFilteredResult(_0x3f54ce,_0x2bdb15))[_0x8d97('0x44')](handleError(_0x3f54ce,null));};exports[_0x8d97('0x45')]=function(_0x2d2934,_0x3bdecb){var _0x4368ac={'raw':!![],'where':{'id':_0x2d2934[_0x8d97('0x46')]['id']}},_0x46be2a={};_0x46be2a[_0x8d97('0x34')]=_[_0x8d97('0x31')](db[_0x8d97('0x2c')]['rawAttributes']);_0x46be2a[_0x8d97('0x30')]=_[_0x8d97('0x31')](_0x2d2934[_0x8d97('0x30')]);_0x46be2a[_0x8d97('0x32')]=_['intersection'](_0x46be2a[_0x8d97('0x34')],_0x46be2a[_0x8d97('0x30')]);_0x4368ac[_0x8d97('0x35')]=_[_0x8d97('0x33')](_0x46be2a[_0x8d97('0x34')],qs[_0x8d97('0x36')](_0x2d2934[_0x8d97('0x30')][_0x8d97('0x36')]));_0x4368ac[_0x8d97('0x35')]=_0x4368ac[_0x8d97('0x35')][_0x8d97('0x47')]?_0x4368ac[_0x8d97('0x35')]:_0x46be2a['model'];if(_0x2d2934['query'][_0x8d97('0x40')]){_0x4368ac[_0x8d97('0x41')]=[{'all':!![]}];}_0x4368ac=_['merge']({},_0x4368ac,_0x2d2934['options']);return db[_0x8d97('0x2c')]['find'](_0x4368ac)[_0x8d97('0x26')](handleEntityNotFound(_0x3bdecb,null))[_0x8d97('0x26')](respondWithResult(_0x3bdecb,null))['catch'](handleError(_0x3bdecb,null));};exports[_0x8d97('0x48')]=function(_0x3cf4b1,_0x641dd9){if(_0x3cf4b1[_0x8d97('0x49')]['id']){delete _0x3cf4b1['body']['id'];}return db['CmCustomField'][_0x8d97('0x4a')]({'where':{'id':_0x3cf4b1['params']['id']}})['then'](handleEntityNotFound(_0x641dd9,null))[_0x8d97('0x26')](saveUpdates(_0x3cf4b1[_0x8d97('0x49')],null))[_0x8d97('0x26')](respondWithResult(_0x641dd9,null))['catch'](handleError(_0x641dd9,null));};exports[_0x8d97('0x4b')]=function(_0x927dca,_0x2389ec){return db['CmCustomField'][_0x8d97('0x4a')]({'where':{'id':_0x927dca[_0x8d97('0x46')]['id']}})[_0x8d97('0x26')](handleEntityNotFound(_0x2389ec,null))[_0x8d97('0x26')](removeEntity(_0x2389ec,null))['catch'](handleError(_0x2389ec,null));};exports[_0x8d97('0x4c')]=function(_0x3f1eac,_0x57a9ee){var _0x138eab;return db['sequelize'][_0x8d97('0x4d')](function(_0xad0cd){return db[_0x8d97('0x2c')][_0x8d97('0x4c')](_0x3f1eac[_0x8d97('0x49')],{'transaction':_0xad0cd})[_0x8d97('0x26')](function(_0x3971a2){_0x138eab=_0x3971a2;var _0x5250cd={'type':db[_0x8d97('0x4e')][_0x8d97('0x4f')],'transaction':_0xad0cd};switch(_0x3f1eac['body'][_0x8d97('0x3e')]){case _0x8d97('0x50'):_0x5250cd[_0x8d97('0x3e')]=db[_0x8d97('0x4e')]['TEXT'];break;case _0x8d97('0x51'):_0x5250cd[_0x8d97('0x3e')]=db[_0x8d97('0x4e')][_0x8d97('0x52')];break;case _0x8d97('0x53'):_0x5250cd[_0x8d97('0x3e')]=db[_0x8d97('0x4e')][_0x8d97('0x54')];_0x5250cd[_0x8d97('0x55')]=![];break;default:}return db[_0x8d97('0x56')][_0x8d97('0x57')][_0x8d97('0x58')]('cm_contacts',util[_0x8d97('0x59')](_0x8d97('0x5a'),_0x138eab['id']),_0x5250cd);})[_0x8d97('0x26')](function(){return _0x138eab;});})[_0x8d97('0x26')](respondWithResult(_0x57a9ee,0xc9))[_0x8d97('0x44')](handleError(_0x57a9ee,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2441827..138ff6f 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 _0x25d6=['request-promise','path','rimraf','./cmCustomField.attributes','exports','CmCustomField','lodash','util','api','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x25d6,0x150));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x625d('0x0'));var util=require(_0x625d('0x1'));var logger=require('../../config/logger')(_0x625d('0x2'));var moment=require(_0x625d('0x3'));var BPromise=require(_0x625d('0x4'));var rp=require(_0x625d('0x5'));var fs=require('fs');var path=require(_0x625d('0x6'));var rimraf=require(_0x625d('0x7'));var config=require('../../config/environment');var attributes=require(_0x625d('0x8'));module[_0x625d('0x9')]=function(_0x3530bd,_0x2b55f2){return _0x3530bd['define'](_0x625d('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c47=['moment','bluebird','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x0c47,0xfa));var _0x70c4=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x0c47[_0x5519a9];return _0x32f2cc;};'use strict';var _=require(_0x70c4('0x0'));var util=require(_0x70c4('0x1'));var logger=require(_0x70c4('0x2'))('api');var moment=require(_0x70c4('0x3'));var BPromise=require(_0x70c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70c4('0x5'));var rimraf=require('rimraf');var config=require(_0x70c4('0x6'));var attributes=require(_0x70c4('0x7'));module['exports']=function(_0x350ad2,_0x378675){return _0x350ad2[_0x70c4('0x8')](_0x70c4('0x9'),attributes,{'tableName':_0x70c4('0xa'),'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 4e4d6b4..206108c 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 _0x6628=['jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x50da70,_0x5c8d64){var _0x1500fd=function(_0x5a3ddb){while(--_0x5a3ddb){_0x50da70['push'](_0x50da70['shift']());}};_0x1500fd(++_0x5c8d64);}(_0x6628,0x11c));var _0x8662=function(_0x1b110a,_0x5b6af4){_0x1b110a=_0x1b110a-0x0;var _0x293ecc=_0x6628[_0x1b110a];return _0x293ecc;};'use strict';var _=require(_0x8662('0x0'));var util=require(_0x8662('0x1'));var moment=require(_0x8662('0x2'));var BPromise=require(_0x8662('0x3'));var rs=require(_0x8662('0x4'));var fs=require('fs');var Redis=require(_0x8662('0x5'));var db=require(_0x8662('0x6'))['db'];var utils=require(_0x8662('0x7'));var logger=require('../../config/logger')(_0x8662('0x8'));var config=require(_0x8662('0x9'));var jayson=require(_0x8662('0xa'));var client=jayson[_0x8662('0xb')][_0x8662('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b4cf6,_0x12af7c,_0x281333){return new BPromise(function(_0xc1f8e7,_0x4837fb){return client[_0x8662('0xd')](_0x3b4cf6,_0x281333)[_0x8662('0xe')](function(_0x1580ee){logger['info'](_0x8662('0xf'),_0x12af7c,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x12af7c,'request\x20sent',JSON[_0x8662('0x10')](_0x1580ee));if(_0x1580ee[_0x8662('0x11')]){if(_0x1580ee[_0x8662('0x11')]['code']===0x1f4){logger[_0x8662('0x11')](_0x8662('0xf'),_0x12af7c,_0x1580ee['error']['message']);return _0x4837fb(_0x1580ee[_0x8662('0x11')][_0x8662('0x12')]);}logger[_0x8662('0x11')](_0x8662('0xf'),_0x12af7c,_0x1580ee[_0x8662('0x11')][_0x8662('0x12')]);return _0xc1f8e7(_0x1580ee[_0x8662('0x11')][_0x8662('0x12')]);}else{logger[_0x8662('0x13')](_0x8662('0xf'),_0x12af7c,_0x8662('0x14'));_0xc1f8e7(_0x1580ee['result'][_0x8662('0x12')]);}})['catch'](function(_0x218b4f){logger[_0x8662('0x11')](_0x8662('0xf'),_0x12af7c,_0x218b4f);_0x4837fb(_0x218b4f);});});} \ No newline at end of file +var _0x8a51=['request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x2fb03f,_0x57bbf3){var _0x1fc83a=function(_0xcfc094){while(--_0xcfc094){_0x2fb03f['push'](_0x2fb03f['shift']());}};_0x1fc83a(++_0x57bbf3);}(_0x8a51,0x1da));var _0x18a5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8a51[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x18a5('0x0'));var util=require(_0x18a5('0x1'));var moment=require(_0x18a5('0x2'));var BPromise=require(_0x18a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18a5('0x4'))['db'];var utils=require(_0x18a5('0x5'));var logger=require(_0x18a5('0x6'))(_0x18a5('0x7'));var config=require(_0x18a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4063,_0x24cb70,_0x1eac67){return new BPromise(function(_0xb27529,_0x359831){return client[_0x18a5('0xa')](_0x3f4063,_0x1eac67)[_0x18a5('0xb')](function(_0x40b385){logger[_0x18a5('0xc')](_0x18a5('0xd'),_0x24cb70,'request\x20sent');logger[_0x18a5('0xe')](_0x18a5('0xf'),_0x24cb70,'request\x20sent',JSON[_0x18a5('0x10')](_0x40b385));if(_0x40b385[_0x18a5('0x11')]){if(_0x40b385[_0x18a5('0x11')][_0x18a5('0x12')]===0x1f4){logger[_0x18a5('0x11')]('CmCustomField,\x20%s,\x20%s',_0x24cb70,_0x40b385[_0x18a5('0x11')][_0x18a5('0x13')]);return _0x359831(_0x40b385['error'][_0x18a5('0x13')]);}logger[_0x18a5('0x11')](_0x18a5('0xd'),_0x24cb70,_0x40b385[_0x18a5('0x11')]['message']);return _0xb27529(_0x40b385['error'][_0x18a5('0x13')]);}else{logger[_0x18a5('0xc')]('CmCustomField,\x20%s,\x20%s',_0x24cb70,'request\x20sent');_0xb27529(_0x40b385[_0x18a5('0x14')][_0x18a5('0x13')]);}})[_0x18a5('0x15')](function(_0x285501){logger[_0x18a5('0x11')](_0x18a5('0xd'),_0x24cb70,_0x285501);_0x359831(_0x285501);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b1e3100..37f4cb8 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 _0x31af=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x45856f,_0x18d771){var _0x5174e1=function(_0x3c53a0){while(--_0x3c53a0){_0x45856f['push'](_0x45856f['shift']());}};_0x5174e1(++_0x18d771);}(_0x31af,0xde));var _0xf31a=function(_0x4029dc,_0x5c3bf1){_0x4029dc=_0x4029dc-0x0;var _0x4971e0=_0x31af[_0x4029dc];return _0x4971e0;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xd')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xe')]);router['put'](_0xf31a('0xb'),auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0x10')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0x11')]);module[_0xf31a('0x12')]=router; \ No newline at end of file +var _0x869e=['post','create','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','show'];(function(_0x3bc3e0,_0x20f88f){var _0x35201f=function(_0x4865aa){while(--_0x4865aa){_0x3bc3e0['push'](_0x3bc3e0['shift']());}};_0x35201f(++_0x20f88f);}(_0x869e,0x15c));var _0xe869=function(_0x26be6e,_0x4bf9f0){_0x26be6e=_0x26be6e-0x0;var _0x66f894=_0x869e[_0x26be6e];return _0x66f894;};'use strict';var multer=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var path=require(_0xe869('0x2'));var timeout=require('connect-timeout');var express=require(_0xe869('0x3'));var router=express[_0xe869('0x4')]();var fs_extra=require(_0xe869('0x5'));var auth=require(_0xe869('0x6'));var interaction=require(_0xe869('0x7'));var config=require('../../config/environment');var controller=require(_0xe869('0x8'));router[_0xe869('0x9')]('/',auth[_0xe869('0xa')](),controller[_0xe869('0xb')]);router['get']('/:id',auth[_0xe869('0xa')](),controller[_0xe869('0xc')]);router[_0xe869('0xd')]('/',auth[_0xe869('0xa')](),controller[_0xe869('0xe')]);router[_0xe869('0xf')](_0xe869('0x10'),auth[_0xe869('0xa')](),controller['update']);router['delete'](_0xe869('0x10'),auth[_0xe869('0xa')](),controller[_0xe869('0x11')]);module[_0xe869('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 10cfdf2..b240a45 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 _0x8bdc=['contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bdc,0x1d7));var _0xc8bd=function(_0x5aac1f,_0x42cf47){_0x5aac1f=_0x5aac1f-0x0;var _0x172dfc=_0x8bdc[_0x5aac1f];return _0x172dfc;};'use strict';var moment=require(_0xc8bd('0x0'));var Sequelize=require('sequelize');module[_0xc8bd('0x1')]={'phone':{'type':Sequelize[_0xc8bd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc8bd('0x4')],'defaultValue':moment()[_0xc8bd('0x5')](_0xc8bd('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc8bd('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc8bd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc8bd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc8bd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc8bd('0x4')]},'priority':{'type':Sequelize[_0xc8bd('0x7')](0x2)[_0xc8bd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc8bd('0x7')],'unique':_0xc8bd('0x9')},'ListId':{'type':Sequelize[_0xc8bd('0x7')],'unique':_0xc8bd('0x9')},'UserId':{'type':Sequelize[_0xc8bd('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xc8bd('0x7')],'unique':_0xc8bd('0x9')},'CampaignId':{'type':Sequelize[_0xc8bd('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc8bd('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc8bd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc8bd('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc8bd('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc8bd('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9881=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x298226,_0x3268c1){var _0x40638e=function(_0x6ab21b){while(--_0x6ab21b){_0x298226['push'](_0x298226['shift']());}};_0x40638e(++_0x3268c1);}(_0x9881,0x190));var _0x1988=function(_0xa590cd,_0x15083f){_0xa590cd=_0xa590cd-0x0;var _0xe5a6d5=_0x9881[_0xa590cd];return _0xe5a6d5;};'use strict';var moment=require(_0x1988('0x0'));var Sequelize=require(_0x1988('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1988('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1988('0x3')],'defaultValue':moment()['format'](_0x1988('0x4'))},'countbusyretry':{'type':Sequelize[_0x1988('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1988('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1988('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1988('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1988('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1988('0x3')]},'priority':{'type':Sequelize[_0x1988('0x5')](0x2)[_0x1988('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1988('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1988('0x5')],'unique':_0x1988('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x1988('0x8')},'UserId':{'type':Sequelize[_0x1988('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x1988('0x5')],'unique':_0x1988('0x8')},'CampaignId':{'type':Sequelize[_0x1988('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1988('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1988('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1988('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4638e8c..0d44f7e 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 _0x0309=['destroy','params','VoiceQueueId','CampaignId','Campaign','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','user','getVoiceQueues','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','isEmpty','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','CmList','List','VoiceQueue','Queue','findOne','recallme','Company','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','filters','intersection','model','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','include','findAll','rows','catch','show','keys','includeAll','find','create','body','describe'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x0309,0x165));var _0x9030=function(_0x3115ee,_0x4af3d0){_0x3115ee=_0x3115ee-0x0;var _0x9be658=_0x0309[_0x3115ee];return _0x9be658;};'use strict';var moment=require(_0x9030('0x0'));var _=require('lodash');var qs=require(_0x9030('0x1'));var logger=require('../../config/logger')(_0x9030('0x2'));var shared=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];function respondWithResult(_0x4236be,_0x29e331){_0x29e331=_0x29e331||0xc8;return function(_0x2e6276){if(_0x2e6276){return _0x4236be[_0x9030('0x5')](_0x29e331)['json'](_0x2e6276);}};}function respondWithFilteredResult(_0x5a3334,_0x1c9c7b){return function(_0x105c15){if(_0x105c15){var _0x4f2d84=typeof _0x1c9c7b[_0x9030('0x6')]==='undefined'&&typeof _0x1c9c7b[_0x9030('0x7')]===_0x9030('0x8');var _0x289add=_0x105c15['count'];var _0xe2c28b=_0x4f2d84?0x0:_0x1c9c7b[_0x9030('0x6')];var _0x337b86=_0x4f2d84?_0x105c15['count']:_0x1c9c7b[_0x9030('0x6')]+_0x1c9c7b[_0x9030('0x7')];var _0x24d0f4;if(_0x337b86>=_0x289add){_0x337b86=_0x289add;_0x24d0f4=0xc8;}else{_0x24d0f4=0xce;}_0x5a3334[_0x9030('0x5')](_0x24d0f4);return _0x5a3334[_0x9030('0x9')](_0x9030('0xa'),_0xe2c28b+'-'+_0x337b86+'/'+_0x289add)[_0x9030('0xb')](_0x105c15);}return null;};}function saveUpdates(_0x5ee60f,_0x45e28a){return function(_0x3274c9){if(_0x3274c9){return _0x3274c9[_0x9030('0xc')](_0x5ee60f)[_0x9030('0xd')](function(_0x4e1858){return _0x4e1858;});}return null;};}function handleEntityNotFound(_0x28a505,_0x2dc875){return function(_0x4a7465){if(!_0x4a7465){_0x28a505[_0x9030('0xe')](0x194);}return _0x4a7465;};}function handleError(_0x4d697a,_0x1615ab){_0x1615ab=_0x1615ab||0x1f4;return function(_0x111f3b){logger[_0x9030('0xf')](_0x111f3b[_0x9030('0x10')]);if(_0x111f3b['name']){delete _0x111f3b[_0x9030('0x11')];}_0x4d697a[_0x9030('0x5')](_0x1615ab)[_0x9030('0x12')](_0x111f3b);};}exports[_0x9030('0x13')]=function(_0x319db3,_0x1327ec){var _0x229dcd={},_0x28c035={},_0x1f5474={'count':0x0,'rows':[]};var _0x31e196=_[_0x9030('0x14')](db[_0x9030('0x15')][_0x9030('0x16')],function(_0x243e7d){return{'name':_0x243e7d[_0x9030('0x17')],'type':_0x243e7d[_0x9030('0x18')][_0x9030('0x19')]};});_0x28c035['model']=_['map'](_0x31e196,_0x9030('0x11'));_0x28c035[_0x9030('0x1a')]=_['keys'](_0x319db3[_0x9030('0x1a')]);_0x28c035[_0x9030('0x1b')]=_[_0x9030('0x1c')](_0x28c035[_0x9030('0x1d')],_0x28c035['query']);_0x28c035[_0x9030('0x1b')]=_['concat'](_0x28c035['filters'],[_0x9030('0x1e'),_0x9030('0x1f'),_0x9030('0x20'),'$gte',_0x9030('0x21'),_0x9030('0x22'),_0x9030('0x23'),_0x9030('0x24'),_0x9030('0x25'),'$between',_0x9030('0x26'),_0x9030('0x27'),_0x9030('0x28'),_0x9030('0x29'),_0x9030('0x2a'),_0x9030('0x2b'),_0x9030('0x2c'),_0x9030('0x29'),_0x9030('0x2d'),_0x9030('0x2e'),_0x9030('0x2f'),_0x9030('0x30')]);_0x229dcd[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x28c035['model'],qs[_0x9030('0x32')](_0x319db3['query'][_0x9030('0x32')]));_0x229dcd['attributes']=_0x229dcd[_0x9030('0x31')][_0x9030('0x33')]?_0x229dcd[_0x9030('0x31')]:_0x28c035['model'];if(!_0x319db3[_0x9030('0x1a')][_0x9030('0x34')](_0x9030('0x35'))){_0x229dcd[_0x9030('0x7')]=qs[_0x9030('0x7')](_0x319db3[_0x9030('0x1a')][_0x9030('0x7')]);_0x229dcd[_0x9030('0x6')]=qs[_0x9030('0x6')](_0x319db3[_0x9030('0x1a')][_0x9030('0x6')]);}_0x229dcd[_0x9030('0x36')]=qs[_0x9030('0x37')](_0x319db3[_0x9030('0x1a')][_0x9030('0x37')]);_0x229dcd[_0x9030('0x38')]=qs[_0x9030('0x1b')](_[_0x9030('0x39')](_0x319db3['query'],_0x28c035['filters']),_0x31e196);if(_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]){_0x229dcd['where']=_['merge'](_0x229dcd[_0x9030('0x38')],{'$or':_[_0x9030('0x14')](_0x31e196,function(_0x411077){if(_0x411077[_0x9030('0x18')]!=='VIRTUAL'){var _0xc8123e={};_0xc8123e[_0x411077['name']]={'$like':'%'+_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]+'%'};return _0xc8123e;}})});}_0x229dcd=_['merge']({},_0x229dcd,_0x319db3[_0x9030('0x3b')]);var _0x19c515={'where':_0x229dcd[_0x9030('0x38')]};return db['CmHopper'][_0x9030('0x3c')](_0x19c515)['then'](function(_0x438828){_0x1f5474['count']=_0x438828;if(_0x319db3[_0x9030('0x1a')]['includeAll']){_0x229dcd[_0x9030('0x3d')]=[{'all':!![]}];}return db[_0x9030('0x15')][_0x9030('0x3e')](_0x229dcd);})[_0x9030('0xd')](function(_0x214f66){_0x1f5474[_0x9030('0x3f')]=_0x214f66;return _0x1f5474;})[_0x9030('0xd')](respondWithFilteredResult(_0x1327ec,_0x229dcd))[_0x9030('0x40')](handleError(_0x1327ec,null));};exports[_0x9030('0x41')]=function(_0x5bd1fb,_0x200ec1){var _0x209aca={'raw':!![],'where':{'id':_0x5bd1fb['params']['id']}},_0x1c8e83={};_0x1c8e83[_0x9030('0x1d')]=_[_0x9030('0x42')](db[_0x9030('0x15')][_0x9030('0x16')]);_0x1c8e83['query']=_[_0x9030('0x42')](_0x5bd1fb[_0x9030('0x1a')]);_0x1c8e83[_0x9030('0x1b')]=_['intersection'](_0x1c8e83[_0x9030('0x1d')],_0x1c8e83[_0x9030('0x1a')]);_0x209aca[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x1c8e83[_0x9030('0x1d')],qs['fields'](_0x5bd1fb[_0x9030('0x1a')]['fields']));_0x209aca[_0x9030('0x31')]=_0x209aca[_0x9030('0x31')][_0x9030('0x33')]?_0x209aca[_0x9030('0x31')]:_0x1c8e83[_0x9030('0x1d')];if(_0x5bd1fb[_0x9030('0x1a')][_0x9030('0x43')]){_0x209aca[_0x9030('0x3d')]=[{'all':!![]}];}_0x209aca=_['merge']({},_0x209aca,_0x5bd1fb[_0x9030('0x3b')]);return db[_0x9030('0x15')][_0x9030('0x44')](_0x209aca)[_0x9030('0xd')](handleEntityNotFound(_0x200ec1,null))[_0x9030('0xd')](respondWithResult(_0x200ec1,null))[_0x9030('0x40')](handleError(_0x200ec1,null));};exports[_0x9030('0x45')]=function(_0x1dc8e6,_0x141f97){return db[_0x9030('0x15')][_0x9030('0x45')](_0x1dc8e6[_0x9030('0x46')],{})[_0x9030('0xd')](respondWithResult(_0x141f97,0xc9))[_0x9030('0x40')](handleError(_0x141f97,null));};exports['update']=function(_0x4725e5,_0x2e0283){if(_0x4725e5['body']['id']){delete _0x4725e5[_0x9030('0x46')]['id'];}return db[_0x9030('0x15')][_0x9030('0x44')]({'where':{'id':_0x4725e5['params']['id']}})['then'](handleEntityNotFound(_0x2e0283,null))[_0x9030('0xd')](saveUpdates(_0x4725e5['body'],null))['then'](respondWithResult(_0x2e0283,null))[_0x9030('0x40')](handleError(_0x2e0283,null));};exports[_0x9030('0x47')]=function(_0x2b3e41,_0x1d9b7e){return db['CmHopper'][_0x9030('0x47')]()['then'](respondWithResult(_0x1d9b7e,null))[_0x9030('0x40')](handleError(_0x1d9b7e,null));};exports[_0x9030('0x48')]=function(_0x42c414,_0x513ee4){var _0x119c2d;var _0xf54697=_0x42c414[_0x9030('0x49')]['id'];return db['CmHopper'][_0x9030('0x44')]({'where':{'id':_0x42c414[_0x9030('0x49')]['id']}})['then'](handleEntityNotFound(_0x513ee4,null))[_0x9030('0xd')](function(_0x4efbfc){if(_0x4efbfc){return _0x4efbfc[_0x9030('0x48')]()['then'](function(_0x2a39ad){return _0x2a39ad;});}})[_0x9030('0xd')](function(_0xce1911){_0x119c2d=_0xce1911;if(_0xce1911){if(_0xce1911[_0x9030('0x4a')]||_0xce1911[_0x9030('0x4b')]){return db[_0xce1911[_0x9030('0x4a')]?'VoiceQueue':_0x9030('0x4c')][_0x9030('0x44')]({'where':{'id':_0xce1911[_0x9030('0x4a')]?_0xce1911[_0x9030('0x4a')]:_0xce1911[_0x9030('0x4b')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0xefbcf4){var _0x16c8f6={};if(_0xefbcf4){_[_0x9030('0x4d')](_0x16c8f6,_[_0x9030('0x4e')](_0x119c2d[_0x9030('0x4f')],[_0x9030('0x50'),_0x9030('0x51'),'id']));_0x16c8f6[_0x9030('0x52')]=0x15;_0x16c8f6[_0x9030('0x53')]=_0x9030('0x54');_0x16c8f6[_0x9030('0x55')]=_0xefbcf4[_0x9030('0x11')];_0x16c8f6[_0x9030('0x56')]=_0x42c414['user'][_0x9030('0x11')];_0x16c8f6[_0x9030('0x57')]=_0x42c414['user']['id'];_0x16c8f6['deleted']=!![];_0x16c8f6[_0x9030('0x58')]=moment()[_0x9030('0x59')](_0x9030('0x5a'));_0x16c8f6[_0x9030('0x5b')]=_0x119c2d[_0x9030('0x5c')];_0x16c8f6[_0x9030('0x5d')]=_0x119c2d['VoiceQueueId']?'queue':_0x9030('0x5e');return db[_0x9030('0x5f')][_0x9030('0x44')]({'where':{'id':_0x16c8f6[_0x9030('0x60')]},'attributes':['firstName',_0x9030('0x61')]})[_0x9030('0xd')](function(_0x1ca30b){if(!_[_0x9030('0x62')](_0x513ee4)&&!_[_0x9030('0x62')](_0x1ca30b['firstName'])){_0x16c8f6['calleridname']=_0x1ca30b[_0x9030('0x63')];if(!_[_0x9030('0x62')](_0x1ca30b[_0x9030('0x61')])){_0x16c8f6[_0x9030('0x64')]+='\x20'+_0x1ca30b[_0x9030('0x61')];}}})[_0x9030('0x65')](function(){return db[_0x9030('0x66')][_0x9030('0x45')](_0x16c8f6);});}})[_0x9030('0xd')](function(_0x11f117){return db['CmHopperAdditionalPhone'][_0x9030('0x48')]({'where':{'CmHopperId':_0xf54697}});})[_0x9030('0xd')](function(){return _0x513ee4[_0x9030('0x5')](0xcc)[_0x9030('0x67')]();})[_0x9030('0x40')](handleError(_0x513ee4,null));};exports[_0x9030('0x68')]=function(_0x3012b9,_0x481e34){var _0x498f7c=[];return db[_0x9030('0x5f')][_0x9030('0x47')]()[_0x9030('0xd')](function(_0x44442f){_0x498f7c=_[_0x9030('0x42')](_0x44442f);return _0x3012b9[_0x9030('0x69')][_0x9030('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x9030('0x6b')],'raw':!![]});})['then'](function(_0x1cd8f5){if(_0x1cd8f5&&_0x1cd8f5['length']){return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x303de3){var _0xb4b84e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_[_0x9030('0x14')](_0x1cd8f5,'id')},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x1a6b62={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1cd8f5)[_0x9030('0x3a')]([_0x9030('0x6b'),0x0])[_0x9030('0x14')]('id')[_0x9030('0x6e')]()},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x49bad8={'$or':[_0xb4b84e,_0x1a6b62]};var _0x119835=[];if(_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]&&_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]===_0x9030('0x70')){if(!_['isEmpty'](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$in':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[[_0x9030('0x72'),'ASC'],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]===_0x9030('0x75')?'DESC':_0x9030('0x75')],db[_0x9030('0x6c')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x9030('0x76')](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$notIn':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[['priority',_0x9030('0x77')],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]],db[_0x9030('0x6c')]['literal'](_0x9030('0x78')),['id',_0x9030('0x75')]];}return db[_0x9030('0x15')]['findOne']({'attributes':['id',_0x9030('0x79'),_0x9030('0x5c'),'recallme'],'where':_0x49bad8,'order':_0x119835,'transaction':_0x303de3,'lock':_0x303de3[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x498f7c,'include':[{'model':db[_0x9030('0x7c')],'as':'Company','attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db[_0x9030('0x7f')],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),'dialActive']}]})[_0x9030('0xd')](function(_0x51b73f){if(_0x51b73f){return _0x51b73f[_0x9030('0xc')]({'UserId':_0x3012b9[_0x9030('0x69')]['id']},{'transaction':_0x303de3});}});});}})[_0x9030('0xd')](handleEntityNotFound(_0x481e34,null))[_0x9030('0xd')](respondWithResult(_0x481e34,null))[_0x9030('0x40')](handleError(_0x481e34,null));};exports['getPreviewRecall']=function(_0x53e328,_0x563ead,_0x2148e5){var _0x1c7080=[];var _0x3c0b37=_0x53e328['params']['id'];var _0x1d4058=_0x53e328[_0x9030('0x69')]['id'];return db[_0x9030('0x5f')]['describe']()[_0x9030('0xd')](function(_0x3245ee){_0x1c7080=_[_0x9030('0x42')](_0x3245ee);return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x588042){const _0x2f30b3={'id':_0x3c0b37};return db[_0x9030('0x15')][_0x9030('0x81')]({'attributes':['id','scheduledat',_0x9030('0x82')],'where':_0x2f30b3,'transaction':_0x588042,'lock':_0x588042[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x1c7080,'include':[{'model':db['CmCompany'],'as':_0x9030('0x83'),'attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db['VoiceQueue'],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),_0x9030('0x84')]}]})[_0x9030('0xd')](function(_0x2d3aaf){if(_0x2d3aaf){return _0x2d3aaf['update']({'UserId':_0x1d4058},{'transaction':_0x588042});}});});})[_0x9030('0xd')](handleEntityNotFound(_0x563ead,null))['then'](respondWithResult(_0x563ead,null))[_0x9030('0x40')](handleError(_0x563ead,null));};exports[_0x9030('0x85')]=function(_0x351265,_0x5b4d17){return _0x351265['user'][_0x9030('0x6a')]({'where':{'type':_0x9030('0x86'),'dialActive':!![],'dialMethod':_0x9030('0x87')},'attributes':['id'],'raw':!![]})[_0x9030('0xd')](function(_0x43c2d8){if(_0x43c2d8&&_0x43c2d8[_0x9030('0x33')]){return db[_0x9030('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x43c2d8,'id')},'$or':[{'UserId':null},{'UserId':_0x351265[_0x9030('0x69')]['id']}]}});}return 0x0;})[_0x9030('0xd')](function(_0x1a3fa3){if(!_[_0x9030('0x62')](_0x1a3fa3)&&_[_0x9030('0x88')](_0x1a3fa3)){return _0x5b4d17[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'contacts':_0x1a3fa3});}else{logger[_0x9030('0xf')](_0x9030('0x89'),'getOpenContacts',0x194,_0x9030('0x8a'));_0x5b4d17['sendStatus'](0x194);}})['catch'](handleError(_0x5b4d17,null));};exports['getTimezones']=function(_0x39414f,_0x1f9479){var _0x405e24=shared[_0x9030('0x8b')];var _0x958bf3=[];_[_0x9030('0x14')](_0x405e24,function(_0x55d575){_0x958bf3[_0x9030('0x8c')]({'id':_0x55d575[_0x9030('0x11')],'name':_0x55d575[_0x9030('0x11')],'utcOffset':_0x55d575[_0x9030('0x8d')]});});return _0x1f9479[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'tz':_0x958bf3});};exports[_0x9030('0x8e')]=function(_0x39e215,_0x208a8d){var _0x14528a=shared[_0x9030('0x8b')];var _0x1fad1b={};if(!_[_0x9030('0x62')](_0x14528a[_0x39e215['body']['id']]))_0x1fad1b=_0x14528a[_0x39e215['body']['id']];return _0x208a8d[_0x9030('0x5')](0xc8)[_0x9030('0xb')](_0x1fad1b);}; \ No newline at end of file +var _0xd58c=['format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','Queue','dialActive','getPreviewRecall','transaction','scheduledat','recallme','Company','List','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','error','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','updatedAt','state','deleted','membername','user','UserId','deletedat'];(function(_0x2cf693,_0x5e6bdd){var _0x192190=function(_0x27b1cb){while(--_0x27b1cb){_0x2cf693['push'](_0x2cf693['shift']());}};_0x192190(++_0x5e6bdd);}(_0xd58c,0xb6));var _0xcd58=function(_0x38ed1e,_0x17c77a){_0x38ed1e=_0x38ed1e-0x0;var _0x1e660e=_0xd58c[_0x38ed1e];return _0x1e660e;};'use strict';var moment=require(_0xcd58('0x0'));var _=require(_0xcd58('0x1'));var qs=require(_0xcd58('0x2'));var logger=require('../../config/logger')(_0xcd58('0x3'));var shared=require('../../config/environment');var db=require(_0xcd58('0x4'))['db'];function respondWithResult(_0x4be7d0,_0xe6c68){_0xe6c68=_0xe6c68||0xc8;return function(_0x2a22bd){if(_0x2a22bd){return _0x4be7d0[_0xcd58('0x5')](_0xe6c68)[_0xcd58('0x6')](_0x2a22bd);}};}function respondWithFilteredResult(_0x45bc6f,_0x599c02){return function(_0x546187){if(_0x546187){var _0x3f2c97=typeof _0x599c02[_0xcd58('0x7')]===_0xcd58('0x8')&&typeof _0x599c02[_0xcd58('0x9')]===_0xcd58('0x8');var _0x491d5b=_0x546187[_0xcd58('0xa')];var _0x43732a=_0x3f2c97?0x0:_0x599c02['offset'];var _0x1e6f95=_0x3f2c97?_0x546187['count']:_0x599c02[_0xcd58('0x7')]+_0x599c02[_0xcd58('0x9')];var _0x440cf1;if(_0x1e6f95>=_0x491d5b){_0x1e6f95=_0x491d5b;_0x440cf1=0xc8;}else{_0x440cf1=0xce;}_0x45bc6f['status'](_0x440cf1);return _0x45bc6f[_0xcd58('0xb')]('Content-Range',_0x43732a+'-'+_0x1e6f95+'/'+_0x491d5b)[_0xcd58('0x6')](_0x546187);}return null;};}function saveUpdates(_0x51880c,_0x477d19){return function(_0x42b221){if(_0x42b221){return _0x42b221[_0xcd58('0xc')](_0x51880c)[_0xcd58('0xd')](function(_0x37561b){return _0x37561b;});}return null;};}function handleEntityNotFound(_0x202412,_0xda9091){return function(_0x3376f3){if(!_0x3376f3){_0x202412['sendStatus'](0x194);}return _0x3376f3;};}function handleError(_0x5d0aa3,_0x3ce190){_0x3ce190=_0x3ce190||0x1f4;return function(_0xa225e3){logger[_0xcd58('0xe')](_0xa225e3['stack']);if(_0xa225e3['name']){delete _0xa225e3[_0xcd58('0xf')];}_0x5d0aa3[_0xcd58('0x5')](_0x3ce190)[_0xcd58('0x10')](_0xa225e3);};}exports['index']=function(_0x4e9b76,_0x3686ad){var _0x53ad6a={},_0x21ef20={},_0x39dc9c={'count':0x0,'rows':[]};var _0x2824a6=_[_0xcd58('0x11')](db['CmHopper'][_0xcd58('0x12')],function(_0x49881d){return{'name':_0x49881d['fieldName'],'type':_0x49881d['type'][_0xcd58('0x13')]};});_0x21ef20[_0xcd58('0x14')]=_[_0xcd58('0x11')](_0x2824a6,'name');_0x21ef20[_0xcd58('0x15')]=_[_0xcd58('0x16')](_0x4e9b76['query']);_0x21ef20[_0xcd58('0x17')]=_[_0xcd58('0x18')](_0x21ef20[_0xcd58('0x14')],_0x21ef20['query']);_0x21ef20['filters']=_[_0xcd58('0x19')](_0x21ef20[_0xcd58('0x17')],[_0xcd58('0x1a'),_0xcd58('0x1b'),_0xcd58('0x1c'),_0xcd58('0x1d'),_0xcd58('0x1e'),'$lte','$ne',_0xcd58('0x1f'),_0xcd58('0x20'),'$between',_0xcd58('0x21'),'$in',_0xcd58('0x22'),_0xcd58('0x23'),_0xcd58('0x24'),_0xcd58('0x25'),_0xcd58('0x26'),_0xcd58('0x23'),'$overlap',_0xcd58('0x27'),'$contained',_0xcd58('0x28')]);_0x53ad6a['attributes']=_[_0xcd58('0x18')](_0x21ef20['model'],qs[_0xcd58('0x29')](_0x4e9b76['query'][_0xcd58('0x29')]));_0x53ad6a[_0xcd58('0x2a')]=_0x53ad6a[_0xcd58('0x2a')][_0xcd58('0x2b')]?_0x53ad6a['attributes']:_0x21ef20[_0xcd58('0x14')];if(!_0x4e9b76['query'][_0xcd58('0x2c')](_0xcd58('0x2d'))){_0x53ad6a[_0xcd58('0x9')]=qs[_0xcd58('0x9')](_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x9')]);_0x53ad6a['offset']=qs['offset'](_0x4e9b76[_0xcd58('0x15')]['offset']);}_0x53ad6a['order']=qs[_0xcd58('0x2e')](_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x2e')]);_0x53ad6a[_0xcd58('0x2f')]=qs[_0xcd58('0x17')](_[_0xcd58('0x30')](_0x4e9b76['query'],_0x21ef20['filters']),_0x2824a6);if(_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x31')]){_0x53ad6a[_0xcd58('0x2f')]=_['merge'](_0x53ad6a[_0xcd58('0x2f')],{'$or':_[_0xcd58('0x11')](_0x2824a6,function(_0x6a7872){if(_0x6a7872['type']!=='VIRTUAL'){var _0x3e2e37={};_0x3e2e37[_0x6a7872[_0xcd58('0xf')]]={'$like':'%'+_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x31')]+'%'};return _0x3e2e37;}})});}_0x53ad6a=_[_0xcd58('0x32')]({},_0x53ad6a,_0x4e9b76[_0xcd58('0x33')]);var _0x1fa80f={'where':_0x53ad6a[_0xcd58('0x2f')]};return db[_0xcd58('0x34')][_0xcd58('0xa')](_0x1fa80f)[_0xcd58('0xd')](function(_0x37e840){_0x39dc9c[_0xcd58('0xa')]=_0x37e840;if(_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x35')]){_0x53ad6a[_0xcd58('0x36')]=[{'all':!![]}];}return db[_0xcd58('0x34')][_0xcd58('0x37')](_0x53ad6a);})[_0xcd58('0xd')](function(_0x48c097){_0x39dc9c[_0xcd58('0x38')]=_0x48c097;return _0x39dc9c;})['then'](respondWithFilteredResult(_0x3686ad,_0x53ad6a))[_0xcd58('0x39')](handleError(_0x3686ad,null));};exports[_0xcd58('0x3a')]=function(_0x464158,_0x5d774d){var _0x2e637c={'raw':!![],'where':{'id':_0x464158['params']['id']}},_0x41daa7={};_0x41daa7[_0xcd58('0x14')]=_['keys'](db['CmHopper'][_0xcd58('0x12')]);_0x41daa7['query']=_['keys'](_0x464158[_0xcd58('0x15')]);_0x41daa7[_0xcd58('0x17')]=_[_0xcd58('0x18')](_0x41daa7['model'],_0x41daa7['query']);_0x2e637c[_0xcd58('0x2a')]=_['intersection'](_0x41daa7[_0xcd58('0x14')],qs[_0xcd58('0x29')](_0x464158['query']['fields']));_0x2e637c[_0xcd58('0x2a')]=_0x2e637c[_0xcd58('0x2a')][_0xcd58('0x2b')]?_0x2e637c[_0xcd58('0x2a')]:_0x41daa7[_0xcd58('0x14')];if(_0x464158[_0xcd58('0x15')][_0xcd58('0x35')]){_0x2e637c[_0xcd58('0x36')]=[{'all':!![]}];}_0x2e637c=_[_0xcd58('0x32')]({},_0x2e637c,_0x464158[_0xcd58('0x33')]);return db[_0xcd58('0x34')][_0xcd58('0x3b')](_0x2e637c)[_0xcd58('0xd')](handleEntityNotFound(_0x5d774d,null))['then'](respondWithResult(_0x5d774d,null))[_0xcd58('0x39')](handleError(_0x5d774d,null));};exports[_0xcd58('0x3c')]=function(_0x415772,_0x4cb1b6){return db[_0xcd58('0x34')][_0xcd58('0x3c')](_0x415772[_0xcd58('0x3d')],{})[_0xcd58('0xd')](respondWithResult(_0x4cb1b6,0xc9))['catch'](handleError(_0x4cb1b6,null));};exports[_0xcd58('0xc')]=function(_0x26dd8f,_0x16be8c){if(_0x26dd8f[_0xcd58('0x3d')]['id']){delete _0x26dd8f[_0xcd58('0x3d')]['id'];}return db[_0xcd58('0x34')][_0xcd58('0x3b')]({'where':{'id':_0x26dd8f[_0xcd58('0x3e')]['id']}})[_0xcd58('0xd')](handleEntityNotFound(_0x16be8c,null))[_0xcd58('0xd')](saveUpdates(_0x26dd8f['body'],null))[_0xcd58('0xd')](respondWithResult(_0x16be8c,null))[_0xcd58('0x39')](handleError(_0x16be8c,null));};exports[_0xcd58('0x3f')]=function(_0x1ead66,_0x2bd4c9){return db[_0xcd58('0x34')][_0xcd58('0x3f')]()[_0xcd58('0xd')](respondWithResult(_0x2bd4c9,null))[_0xcd58('0x39')](handleError(_0x2bd4c9,null));};exports[_0xcd58('0x40')]=function(_0x1416fa,_0x1e39d8){var _0x5589bd;var _0xf01b8d=_0x1416fa[_0xcd58('0x3e')]['id'];return db['CmHopper'][_0xcd58('0x3b')]({'where':{'id':_0x1416fa[_0xcd58('0x3e')]['id']}})[_0xcd58('0xd')](handleEntityNotFound(_0x1e39d8,null))[_0xcd58('0xd')](function(_0x424cfb){if(_0x424cfb){return _0x424cfb[_0xcd58('0x40')]()['then'](function(_0x51735b){return _0x51735b;});}})[_0xcd58('0xd')](function(_0x50aebc){_0x5589bd=_0x50aebc;if(_0x50aebc){if(_0x50aebc[_0xcd58('0x41')]||_0x50aebc[_0xcd58('0x42')]){return db[_0x50aebc[_0xcd58('0x41')]?_0xcd58('0x43'):'Campaign']['find']({'where':{'id':_0x50aebc[_0xcd58('0x41')]?_0x50aebc['VoiceQueueId']:_0x50aebc['CampaignId']},'attributes':['id',_0xcd58('0xf')],'raw':!![]});}}})[_0xcd58('0xd')](function(_0x361422){var _0xc979ce={};if(_0x361422){_['merge'](_0xc979ce,_[_0xcd58('0x44')](_0x5589bd['dataValues'],['createdAt',_0xcd58('0x45'),'id']));_0xc979ce[_0xcd58('0x46')]=0x15;_0xc979ce['statedesc']=_0xcd58('0x47');_0xc979ce['campaign']=_0x361422[_0xcd58('0xf')];_0xc979ce[_0xcd58('0x48')]=_0x1416fa[_0xcd58('0x49')][_0xcd58('0xf')];_0xc979ce[_0xcd58('0x4a')]=_0x1416fa[_0xcd58('0x49')]['id'];_0xc979ce[_0xcd58('0x47')]=!![];_0xc979ce[_0xcd58('0x4b')]=moment()[_0xcd58('0x4c')](_0xcd58('0x4d'));_0xc979ce[_0xcd58('0x4e')]=_0x5589bd[_0xcd58('0x4f')];_0xc979ce['campaigntype']=_0x5589bd[_0xcd58('0x41')]?'queue':_0xcd58('0x50');return db[_0xcd58('0x51')][_0xcd58('0x3b')]({'where':{'id':_0xc979ce[_0xcd58('0x52')]},'attributes':['firstName',_0xcd58('0x53')]})[_0xcd58('0xd')](function(_0x458157){if(!_[_0xcd58('0x54')](_0x1e39d8)&&!_['isNil'](_0x458157['firstName'])){_0xc979ce[_0xcd58('0x55')]=_0x458157[_0xcd58('0x56')];if(!_[_0xcd58('0x54')](_0x458157[_0xcd58('0x53')])){_0xc979ce[_0xcd58('0x55')]+='\x20'+_0x458157[_0xcd58('0x53')];}}})[_0xcd58('0x57')](function(){return db['CmHopperFinal'][_0xcd58('0x3c')](_0xc979ce);});}})[_0xcd58('0xd')](function(_0x98d9b){return db[_0xcd58('0x58')][_0xcd58('0x40')]({'where':{'CmHopperId':_0xf01b8d}});})[_0xcd58('0xd')](function(){return _0x1e39d8[_0xcd58('0x5')](0xcc)[_0xcd58('0x59')]();})[_0xcd58('0x39')](handleError(_0x1e39d8,null));};exports[_0xcd58('0x5a')]=function(_0x11fdd4,_0x1ba71d){var _0x22579f=[];return db[_0xcd58('0x51')][_0xcd58('0x3f')]()[_0xcd58('0xd')](function(_0x11a622){_0x22579f=_['keys'](_0x11a622);return _0x11fdd4[_0xcd58('0x49')][_0xcd58('0x5b')]({'where':{'type':_0xcd58('0x5c'),'dialActive':!![],'dialMethod':_0xcd58('0x5d')},'attributes':['id','dialOrderByScheduledAt',_0xcd58('0x5e')],'raw':!![]});})[_0xcd58('0xd')](function(_0x2cee65){if(_0x2cee65&&_0x2cee65[_0xcd58('0x2b')]){return db[_0xcd58('0x5f')]['transaction'](function(_0xe8c2ea){var _0x343241={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcd58('0x4c')](_0xcd58('0x4d'))},'VoiceQueueId':{'$in':_[_0xcd58('0x11')](_0x2cee65,'id')},'$or':[{'UserId':null},{'UserId':_0x11fdd4[_0xcd58('0x49')]['id']}]};var _0x1bc688={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2cee65)[_0xcd58('0x31')]([_0xcd58('0x5e'),0x0])[_0xcd58('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x11fdd4['user']['id']}]};var _0xb50cd5={'$or':[_0x343241,_0x1bc688]};var _0x39c9c8=[];if(_0x11fdd4[_0xcd58('0x3d')]['direction']&&_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x60')]==='prev'){if(!_[_0xcd58('0x61')](_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')])){_0xb50cd5['id']={'$in':_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')]};}_0x39c9c8=[[_0xcd58('0x63'),_0xcd58('0x64')],[_0xcd58('0x65'),_0x2cee65[0x0]['dialOrderByScheduledAt']==='ASC'?_0xcd58('0x66'):'ASC'],db[_0xcd58('0x5f')]['literal'](_0xcd58('0x67')),['id',_0xcd58('0x66')]];}else{if(!_[_0xcd58('0x61')](_0x11fdd4[_0xcd58('0x3d')]['hopperIds'])){_0xb50cd5['id']={'$notIn':_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')]};}_0x39c9c8=[['priority',_0xcd58('0x66')],[_0xcd58('0x65'),_0x2cee65[0x0][_0xcd58('0x68')]],db[_0xcd58('0x5f')]['literal'](_0xcd58('0x69')),['id',_0xcd58('0x64')]];}return db[_0xcd58('0x34')][_0xcd58('0x6a')]({'attributes':['id','scheduledat',_0xcd58('0x4f'),'recallme'],'where':_0xb50cd5,'order':_0x39c9c8,'transaction':_0xe8c2ea,'lock':_0xe8c2ea[_0xcd58('0x6b')][_0xcd58('0x6c')],'include':[{'model':db[_0xcd58('0x51')],'as':_0xcd58('0x6d'),'attributes':_0x22579f,'include':[{'model':db[_0xcd58('0x6e')],'as':'Company','attributes':['id',_0xcd58('0xf')]}]},{'model':db[_0xcd58('0x6f')],'as':'List','attributes':['id',_0xcd58('0xf')]},{'model':db['VoiceQueue'],'as':_0xcd58('0x70'),'attributes':['id',_0xcd58('0xf'),_0xcd58('0x71')]}]})[_0xcd58('0xd')](function(_0x3f4643){if(_0x3f4643){return _0x3f4643[_0xcd58('0xc')]({'UserId':_0x11fdd4[_0xcd58('0x49')]['id']},{'transaction':_0xe8c2ea});}});});}})['then'](handleEntityNotFound(_0x1ba71d,null))[_0xcd58('0xd')](respondWithResult(_0x1ba71d,null))[_0xcd58('0x39')](handleError(_0x1ba71d,null));};exports[_0xcd58('0x72')]=function(_0xf0ae68,_0x374f9a,_0x4047dd){var _0xf5e38d=[];var _0xf9fcac=_0xf0ae68[_0xcd58('0x3e')]['id'];var _0x312a35=_0xf0ae68[_0xcd58('0x49')]['id'];return db[_0xcd58('0x51')]['describe']()['then'](function(_0xc6e97a){_0xf5e38d=_[_0xcd58('0x16')](_0xc6e97a);return db[_0xcd58('0x5f')][_0xcd58('0x73')](function(_0x202d96){const _0x46dfaa={'id':_0xf9fcac};return db[_0xcd58('0x34')]['findOne']({'attributes':['id',_0xcd58('0x74'),_0xcd58('0x75')],'where':_0x46dfaa,'transaction':_0x202d96,'lock':_0x202d96['LOCK'][_0xcd58('0x6c')],'include':[{'model':db[_0xcd58('0x51')],'as':_0xcd58('0x6d'),'attributes':_0xf5e38d,'include':[{'model':db[_0xcd58('0x6e')],'as':_0xcd58('0x76'),'attributes':['id',_0xcd58('0xf')]}]},{'model':db[_0xcd58('0x6f')],'as':_0xcd58('0x77'),'attributes':['id',_0xcd58('0xf')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xcd58('0xf'),'dialActive']}]})['then'](function(_0x353d9e){if(_0x353d9e){return _0x353d9e['update']({'UserId':_0x312a35},{'transaction':_0x202d96});}});});})[_0xcd58('0xd')](handleEntityNotFound(_0x374f9a,null))[_0xcd58('0xd')](respondWithResult(_0x374f9a,null))[_0xcd58('0x39')](handleError(_0x374f9a,null));};exports[_0xcd58('0x78')]=function(_0x400844,_0x573ed5){return _0x400844['user']['getVoiceQueues']({'where':{'type':_0xcd58('0x5c'),'dialActive':!![],'dialMethod':_0xcd58('0x5d')},'attributes':['id'],'raw':!![]})['then'](function(_0x381ee4){if(_0x381ee4&&_0x381ee4[_0xcd58('0x2b')]){return db[_0xcd58('0x34')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xcd58('0x4d'))},'VoiceQueueId':{'$in':_[_0xcd58('0x11')](_0x381ee4,'id')},'$or':[{'UserId':null},{'UserId':_0x400844[_0xcd58('0x49')]['id']}]}});}return 0x0;})[_0xcd58('0xd')](function(_0x5f3799){if(!_[_0xcd58('0x54')](_0x5f3799)&&_[_0xcd58('0x79')](_0x5f3799)){return _0x573ed5[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')]({'contacts':_0x5f3799});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xcd58('0x78'),0x194,_0xcd58('0x7a'));_0x573ed5[_0xcd58('0x7b')](0x194);}})['catch'](handleError(_0x573ed5,null));};exports[_0xcd58('0x7c')]=function(_0x57cde7,_0x26e93b){var _0x2e92d1=shared[_0xcd58('0x7d')];var _0x10a5cc=[];_[_0xcd58('0x11')](_0x2e92d1,function(_0x155aa7){_0x10a5cc[_0xcd58('0x7e')]({'id':_0x155aa7[_0xcd58('0xf')],'name':_0x155aa7['name'],'utcOffset':_0x155aa7[_0xcd58('0x7f')]});});return _0x26e93b[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')]({'tz':_0x10a5cc});};exports[_0xcd58('0x80')]=function(_0x2c298c,_0x20ee56){var _0x5e21a2=shared[_0xcd58('0x7d')];var _0x257c4e={};if(!_[_0xcd58('0x54')](_0x5e21a2[_0x2c298c[_0xcd58('0x3d')]['id']]))_0x257c4e=_0x5e21a2[_0x2c298c[_0xcd58('0x3d')]['id']];return _0x20ee56[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')](_0x257c4e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a72d115..ab3b105 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 _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x18b3ca,_0x3c97ed){var _0x5a47a9=function(_0x382d0f){while(--_0x382d0f){_0x18b3ca['push'](_0x18b3ca['shift']());}};_0x5a47a9(++_0x3c97ed);}(_0x7c09,0x102));var _0x97c0=function(_0x29c5ec,_0x4f7b12){_0x29c5ec=_0x29c5ec-0x0;var _0x3367b3=_0x7c09[_0x29c5ec];return _0x3367b3;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x2e020c,_0x426e95){var _0x67c30f=function(_0x1dc83e){while(--_0x1dc83e){_0x2e020c['push'](_0x2e020c['shift']());}};_0x67c30f(++_0x426e95);}(_0xafc4,0x69));var _0x4afc=function(_0xdb2c3e,_0x5539cd){_0xdb2c3e=_0xdb2c3e-0x0;var _0x457bd7=_0xafc4[_0xdb2c3e];return _0x457bd7;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c664290..3dda477 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 _0xbbcc=['getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','Contact','User','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','ShowCmHopper','find','error','CreateCmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','destroy','where','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','Agent','name','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','describe','UPDATE','GetContactRecallMe','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC'];(function(_0x28b4f8,_0xea1b69){var _0x1e76b0=function(_0xde88c2){while(--_0xde88c2){_0x28b4f8['push'](_0x28b4f8['shift']());}};_0x1e76b0(++_0xea1b69);}(_0xbbcc,0xf8));var _0xcbbc=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xbbcc[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xcbbc('0x0'));var util=require(_0xcbbc('0x1'));var moment=require(_0xcbbc('0x2'));var BPromise=require(_0xcbbc('0x3'));var db=require(_0xcbbc('0x4'))['db'];var logger=require(_0xcbbc('0x5'))(_0xcbbc('0x6'));exports[_0xcbbc('0x7')]=function(_0x5e0adb){var _0x3e0484=this;return new Promise(function(_0x1ca62d,_0x1c0edc){return db[_0xcbbc('0x8')][_0xcbbc('0x9')]({'raw':_0x5e0adb[_0xcbbc('0xa')]?_0x5e0adb[_0xcbbc('0xa')][_0xcbbc('0xb')]===undefined?!![]:![]:!![],'where':_0x5e0adb[_0xcbbc('0xa')]?_0x5e0adb[_0xcbbc('0xa')]['where']||null:null,'attributes':_0x5e0adb[_0xcbbc('0xa')]?_0x5e0adb[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'limit':_0x5e0adb[_0xcbbc('0xa')]?_0x5e0adb[_0xcbbc('0xa')][_0xcbbc('0xd')]||null:null,'include':_0x5e0adb[_0xcbbc('0xa')]?_0x5e0adb[_0xcbbc('0xa')][_0xcbbc('0xe')]?_['map'](_0x5e0adb['options'][_0xcbbc('0xe')],function(_0x4f866b){return{'model':db[_0x4f866b['model']],'as':_0x4f866b['as'],'attributes':_0x4f866b['attributes'],'include':_0x4f866b[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x4f866b[_0xcbbc('0xe')],function(_0x41d1c6){return{'model':db[_0x41d1c6['model']],'as':_0x41d1c6['as'],'attributes':_0x41d1c6[_0xcbbc('0xc')],'include':_0x41d1c6[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x41d1c6[_0xcbbc('0xe')],function(_0x17a2bb){return{'model':db[_0x17a2bb[_0xcbbc('0x10')]],'as':_0x17a2bb['as'],'attributes':_0x17a2bb[_0xcbbc('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcbbc('0x11')](function(_0x3aa844){logger[_0xcbbc('0x12')]('GetCmHopper',_0x5e0adb);logger[_0xcbbc('0x13')](_0xcbbc('0x7'),_0x5e0adb,JSON[_0xcbbc('0x14')](_0x3aa844));_0x1ca62d(_0x3aa844);})[_0xcbbc('0x15')](function(_0x38f04f){logger['error'](_0xcbbc('0x7'),_0x38f04f[_0xcbbc('0x16')],_0x5e0adb);_0x1c0edc(_0x3e0484['error'](0x1f4,_0x38f04f[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x17')]=function(_0x51f656){var _0x15bf64=this;return new Promise(function(_0x3b7198,_0x140cb5){return db['CmHopper'][_0xcbbc('0x18')]({'raw':_0x51f656[_0xcbbc('0xa')]?_0x51f656[_0xcbbc('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x51f656[_0xcbbc('0xa')]?_0x51f656[_0xcbbc('0xa')]['where']||null:null,'attributes':_0x51f656[_0xcbbc('0xa')]?_0x51f656[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'include':_0x51f656['options']?_0x51f656[_0xcbbc('0xa')][_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x51f656['options'][_0xcbbc('0xe')],function(_0x73d55d){return{'model':db[_0x73d55d[_0xcbbc('0x10')]],'as':_0x73d55d['as'],'attributes':_0x73d55d['attributes'],'include':_0x73d55d['include']?_[_0xcbbc('0xf')](_0x73d55d[_0xcbbc('0xe')],function(_0x484b14){return{'model':db[_0x484b14[_0xcbbc('0x10')]],'as':_0x484b14['as'],'attributes':_0x484b14[_0xcbbc('0xc')],'include':_0x484b14[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x484b14['include'],function(_0x56f0de){return{'model':db[_0x56f0de[_0xcbbc('0x10')]],'as':_0x56f0de['as'],'attributes':_0x56f0de[_0xcbbc('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcbbc('0x11')](function(_0x44ce6b){logger[_0xcbbc('0x12')](_0xcbbc('0x17'),_0x51f656);logger['debug'](_0xcbbc('0x17'),_0x51f656,JSON[_0xcbbc('0x14')](_0x44ce6b));_0x3b7198(_0x44ce6b);})['catch'](function(_0x24b4ae){logger[_0xcbbc('0x19')]('ShowCmHopper',_0x24b4ae[_0xcbbc('0x16')],_0x51f656);_0x140cb5(_0x15bf64[_0xcbbc('0x19')](0x1f4,_0x24b4ae[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x1a')]=function(_0x4bd57c){var _0x484d92=this;return new Promise(function(_0xf74c7d,_0x52ce4b){return db[_0xcbbc('0x8')][_0xcbbc('0x1b')](_0x4bd57c[_0xcbbc('0x1c')],{'raw':_0x4bd57c['options']?_0x4bd57c[_0xcbbc('0xa')][_0xcbbc('0xb')]===undefined?!![]:![]:!![]})[_0xcbbc('0x11')](function(_0x167a82){logger[_0xcbbc('0x12')](_0xcbbc('0x1a'),_0x4bd57c);logger[_0xcbbc('0x13')](_0xcbbc('0x1a'),_0x4bd57c,JSON[_0xcbbc('0x14')](_0x167a82));_0xf74c7d(_0x167a82);})['catch'](function(_0x14acb8){logger[_0xcbbc('0x19')](_0xcbbc('0x1a'),_0x14acb8[_0xcbbc('0x16')],_0x4bd57c);_0x52ce4b(_0x484d92['error'](0x1f4,_0x14acb8[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x1d')]=function(_0x1bf8a1){var _0x5cfd30=this;return new Promise(function(_0x1a16b2,_0x532ba0){return db[_0xcbbc('0x8')][_0xcbbc('0x1e')](_0x1bf8a1[_0xcbbc('0x1c')],{'raw':_0x1bf8a1[_0xcbbc('0xa')]?_0x1bf8a1[_0xcbbc('0xa')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bf8a1[_0xcbbc('0xa')]?_0x1bf8a1[_0xcbbc('0xa')]['where']||null:null,'attributes':_0x1bf8a1[_0xcbbc('0xa')]?_0x1bf8a1[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'limit':_0x1bf8a1[_0xcbbc('0xa')]?_0x1bf8a1[_0xcbbc('0xa')][_0xcbbc('0xd')]||null:null})['then'](function(_0x594793){logger[_0xcbbc('0x12')](_0xcbbc('0x1d'),_0x1bf8a1);logger[_0xcbbc('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1bf8a1['options']['where']),_0x1bf8a1[_0xcbbc('0x1c')][_0xcbbc('0x1f')]);logger[_0xcbbc('0x13')](_0xcbbc('0x1d'),_0x1bf8a1,JSON['stringify'](_0x594793));_0x1a16b2(_0x594793);})['catch'](function(_0x464bd1){logger[_0xcbbc('0x19')](_0xcbbc('0x1d'),_0x464bd1[_0xcbbc('0x16')],_0x1bf8a1);_0x532ba0(_0x5cfd30['error'](0x1f4,_0x464bd1[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x20')]=function(_0x4d2d4b){var _0x161e01=this;return new Promise(function(_0x53b42a,_0x108bd0){return db[_0xcbbc('0x8')][_0xcbbc('0x21')]({'where':_0x4d2d4b['options']?_0x4d2d4b[_0xcbbc('0xa')][_0xcbbc('0x22')]||null:null})[_0xcbbc('0x11')](function(_0x1ec0e8){logger[_0xcbbc('0x12')](_0xcbbc('0x20'),_0x4d2d4b);logger[_0xcbbc('0x13')](_0xcbbc('0x20'),_0x4d2d4b,JSON[_0xcbbc('0x14')](_0x1ec0e8));_0x53b42a(_0x1ec0e8);})[_0xcbbc('0x15')](function(_0x5f46e0){logger[_0xcbbc('0x19')](_0xcbbc('0x20'),_0x5f46e0[_0xcbbc('0x16')],_0x4d2d4b);_0x108bd0(_0x161e01['error'](0x1f4,_0x5f46e0[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x23')]=function(_0x167f90){var _0x181eb7=this;return new Promise(function(_0x261d89,_0x3814c0){return db[_0xcbbc('0x24')]['describe']()[_0xcbbc('0x11')](function(_0x163e4f){return db[_0xcbbc('0x25')][_0xcbbc('0x26')](function(_0x1885d7){return db[_0xcbbc('0x8')][_0xcbbc('0x9')]({'where':_0x167f90[_0xcbbc('0xa')]?_0x167f90[_0xcbbc('0xa')][_0xcbbc('0x22')]||null:null,'attributes':_0x167f90['options']?_0x167f90[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'limit':_0x167f90['options']?_0x167f90[_0xcbbc('0xa')]['limit']||null:null,'order':_0x167f90[_0xcbbc('0xa')]?_0x167f90[_0xcbbc('0xa')][_0xcbbc('0x27')]||null:null,'transaction':_0x1885d7,'lock':_0x1885d7[_0xcbbc('0x28')]['UPDATE'],'include':[{'model':db[_0xcbbc('0x24')],'as':'Contact','attributes':_['keys'](_0x163e4f)},{'model':db['User'],'as':_0xcbbc('0x29'),'attributes':['id',_0xcbbc('0x2a'),'voicePause']}]})[_0xcbbc('0x11')](function(_0x1fd3dc){var _0x2dbb30=[];var _0x1168fa=[];for(var _0x541357=0x0;_0x541357<_0x1fd3dc[_0xcbbc('0x2b')];_0x541357+=0x1){var _0x1132e2=_0x1fd3dc[_0x541357]['UserId'];if(_0x1132e2===null){_0x2dbb30[_0xcbbc('0x2c')](_0x1fd3dc[_0x541357][_0xcbbc('0x1e')](_0x167f90[_0xcbbc('0x1c')],{'transaction':_0x1885d7}));}else if(!_0x1168fa[_0xcbbc('0x2d')](_0x1132e2)){_0x1168fa[_0xcbbc('0x2c')](_0x1132e2);_0x2dbb30[_0xcbbc('0x2c')](_0x1fd3dc[_0x541357]['update'](_0x167f90[_0xcbbc('0x1c')],{'transaction':_0x1885d7}));}}return BPromise[_0xcbbc('0x2e')](_0x2dbb30);});})['then'](function(_0x33a426){logger[_0xcbbc('0x12')](_0xcbbc('0x23'),_0x167f90);if(_0x33a426[_0xcbbc('0x2b')]>0x0){logger[_0xcbbc('0x12')](_0xcbbc('0x2f'),_0x33a426[0x0][_0xcbbc('0x30')]['id'],_0x33a426[0x0]['dataValues'][_0xcbbc('0x31')],_0x33a426[0x0]['dataValues'][_0xcbbc('0x1f')]);}logger[_0xcbbc('0x13')]('GetContactDialer',_0x167f90,JSON[_0xcbbc('0x14')](_0x33a426));_0x261d89(_0x33a426);})[_0xcbbc('0x15')](function(_0x1efeb7){logger[_0xcbbc('0x19')](_0xcbbc('0x23'),_0x1efeb7[_0xcbbc('0x16')],_0x167f90);_0x3814c0(_0x181eb7[_0xcbbc('0x19')](0x1f4,_0x1efeb7[_0xcbbc('0x16')]));});});});};exports[_0xcbbc('0x32')]=function(_0x41544a){var _0x474f84=this;return new Promise(function(_0x97fa47,_0x3119ee){return db[_0xcbbc('0x25')][_0xcbbc('0x26')](function(_0x48b8ef){return db[_0xcbbc('0x33')][_0xcbbc('0x1b')](_0x41544a[_0xcbbc('0x1c')],{'raw':_0x41544a['options']?_0x41544a['options'][_0xcbbc('0xb')]===undefined?!![]:![]:!![],'transaction':_0x48b8ef})['then'](function(){logger['info'](_0xcbbc('0x34'),JSON[_0xcbbc('0x14')](_0x41544a['options']['where']),_0x41544a[_0xcbbc('0xa')]['where']['active']);return db[_0xcbbc('0x8')][_0xcbbc('0x21')]({'where':_0x41544a[_0xcbbc('0xa')]?_0x41544a[_0xcbbc('0xa')][_0xcbbc('0x22')]||null:null,'transaction':_0x48b8ef});});})[_0xcbbc('0x11')](function(_0x15f556){logger['info'](_0xcbbc('0x32'),_0x41544a);logger[_0xcbbc('0x13')](_0xcbbc('0x32'),_0x41544a,JSON[_0xcbbc('0x14')](_0x15f556));_0x97fa47(_0x15f556);})[_0xcbbc('0x15')](function(_0x117a65){logger[_0xcbbc('0x19')](_0xcbbc('0x32'),_0x117a65[_0xcbbc('0x16')],_0x41544a);_0x3119ee(_0x474f84[_0xcbbc('0x19')](0x1f4,_0x117a65[_0xcbbc('0x16')]));});});};exports[_0xcbbc('0x35')]=function(_0x527ecb){var _0x457298=this;return new Promise(function(_0x4e740d,_0x2732cd){return db['CmHopper'][_0xcbbc('0x9')]({'raw':_0x527ecb[_0xcbbc('0xa')]?_0x527ecb[_0xcbbc('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x527ecb[_0xcbbc('0xa')]?_0x527ecb[_0xcbbc('0xa')][_0xcbbc('0x22')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xcbbc('0x25')]['fn']('IF',db[_0xcbbc('0x25')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0xcbbc('0x36'),moment()[_0xcbbc('0x37')](_0xcbbc('0x38')))+_0xcbbc('0x39')))),_0xcbbc('0x3a')]]})['then'](function(_0xbb6b2c){logger[_0xcbbc('0x12')](_0xcbbc('0x35'),_0x527ecb);logger[_0xcbbc('0x13')](_0xcbbc('0x35'),_0x527ecb,JSON[_0xcbbc('0x14')](_0xbb6b2c));_0x4e740d(_0xbb6b2c);})['catch'](function(_0x8d5f3b){logger[_0xcbbc('0x19')]('CountReScheduled',_0x8d5f3b[_0xcbbc('0x16')],_0x527ecb);_0x2732cd(_0x457298[_0xcbbc('0x19')](0x1f4,_0x8d5f3b[_0xcbbc('0x16')]));});});};exports['GetContactRecallMe']=function(_0x16d429){var _0x4ff0ea=this;return new Promise(function(_0x1c4840,_0x48dfa0){return db[_0xcbbc('0x24')][_0xcbbc('0x3b')]()[_0xcbbc('0x11')](function(){return db[_0xcbbc('0x25')]['transaction'](function(_0x1736d2){return db[_0xcbbc('0x8')]['findAll']({'where':_0x16d429[_0xcbbc('0xa')]?_0x16d429[_0xcbbc('0xa')]['where']||null:null,'attributes':_0x16d429[_0xcbbc('0xa')]?_0x16d429[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'limit':0x1,'order':_0x16d429['options']?_0x16d429[_0xcbbc('0xa')][_0xcbbc('0x27')]||null:null,'group':db[_0xcbbc('0x8')]['UserId'],'transaction':_0x1736d2,'lock':_0x1736d2['LOCK'][_0xcbbc('0x3c')],'include':_0x16d429[_0xcbbc('0xa')]?_0x16d429['options'][_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x16d429[_0xcbbc('0xa')]['include'],function(_0x24e641){return{'model':db[_0x24e641[_0xcbbc('0x10')]],'as':_0x24e641['as'],'attributes':_0x24e641[_0xcbbc('0xc')],'include':_0x24e641[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x24e641[_0xcbbc('0xe')],function(_0x44dd7b){return{'model':db[_0x44dd7b[_0xcbbc('0x10')]],'as':_0x44dd7b['as'],'attributes':_0x44dd7b[_0xcbbc('0xc')],'include':_0x44dd7b['include']?_[_0xcbbc('0xf')](_0x44dd7b['include'],function(_0x54aa2e){return{'model':db[_0x54aa2e[_0xcbbc('0x10')]],'as':_0x54aa2e['as'],'attributes':_0x54aa2e[_0xcbbc('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcbbc('0x11')](function(_0x737fd2){var _0x42e4dd=[];for(var _0x518f6c=0x0;_0x518f6c<_0x737fd2[_0xcbbc('0x2b')];_0x518f6c+=0x1){_0x42e4dd[_0xcbbc('0x2c')](_0x737fd2[_0x518f6c][_0xcbbc('0x1e')](_0x16d429[_0xcbbc('0x1c')],{'transaction':_0x1736d2}));}return BPromise['all'](_0x42e4dd);});})[_0xcbbc('0x11')](function(_0x4ba71c){logger['info'](_0xcbbc('0x3d'),_0x16d429);logger['debug'](_0xcbbc('0x3d'),_0x16d429,JSON[_0xcbbc('0x14')](_0x4ba71c));_0x1c4840(_0x4ba71c);})[_0xcbbc('0x15')](function(_0xa3bbf5){logger[_0xcbbc('0x19')](_0xcbbc('0x3d'),_0xa3bbf5[_0xcbbc('0x16')],_0x16d429);_0x48dfa0(_0x4ff0ea[_0xcbbc('0x19')](0x1f4,_0xa3bbf5[_0xcbbc('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x3ee94e){var _0xf11735=this;return new Promise(function(_0x107939,_0x5091b5){db[_0xcbbc('0x24')][_0xcbbc('0x3b')]()[_0xcbbc('0x11')](function(_0x219c91){return db[_0xcbbc('0x8')]['findAll']({'raw':_0x3ee94e[_0xcbbc('0xa')]?_0x3ee94e[_0xcbbc('0xa')][_0xcbbc('0xb')]===undefined?!![]:![]:!![],'where':_0x3ee94e[_0xcbbc('0xa')]?_0x3ee94e[_0xcbbc('0xa')][_0xcbbc('0x22')]||null:null,'attributes':_0x3ee94e[_0xcbbc('0xa')]?_0x3ee94e[_0xcbbc('0xa')][_0xcbbc('0xc')]||null:null,'limit':_0x3ee94e[_0xcbbc('0xa')]?_0x3ee94e['options']['limit']||null:null,'include':_0x3ee94e[_0xcbbc('0xa')]?_0x3ee94e['options']['include']?_[_0xcbbc('0xf')](_0x3ee94e[_0xcbbc('0xa')][_0xcbbc('0xe')],function(_0x4cdbfe){return{'model':db[_0x4cdbfe['model']],'as':_0x4cdbfe['as'],'attributes':_0x4cdbfe['as']==='Contact'?_[_0xcbbc('0x3e')](_0x219c91):_0x4cdbfe[_0xcbbc('0xc')],'include':_0x4cdbfe[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x4cdbfe[_0xcbbc('0xe')],function(_0x1016bd){return{'model':db[_0x1016bd[_0xcbbc('0x10')]],'as':_0x1016bd['as'],'attributes':_0x1016bd[_0xcbbc('0xc')],'include':_0x1016bd[_0xcbbc('0xe')]?_[_0xcbbc('0xf')](_0x1016bd[_0xcbbc('0xe')],function(_0x21589e){return{'model':db[_0x21589e[_0xcbbc('0x10')]],'as':_0x21589e['as'],'attributes':_0x21589e[_0xcbbc('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcbbc('0x11')](function(_0x1df72d){logger['info'](_0xcbbc('0x7'),_0x3ee94e);logger[_0xcbbc('0x13')]('GetCmHopper',_0x3ee94e,JSON[_0xcbbc('0x14')](_0x1df72d));_0x107939(_0x1df72d);})[_0xcbbc('0x15')](function(_0x3f6070){logger['error']('GetCmHopper',_0x3f6070[_0xcbbc('0x16')],_0x3ee94e);_0x5091b5(_0xf11735['error'](0x1f4,_0x3f6070[_0xcbbc('0x16')]));});});});};exports[_0xcbbc('0x3f')]=function(_0x316ac5){var _0xf3594c=this;return new Promise(function(_0x2b22bf,_0x332bf5){return db['CmContact'][_0xcbbc('0x40')]({'raw':!![],'where':{'phone':_0x316ac5[_0xcbbc('0xa')][_0xcbbc('0x22')][_0xcbbc('0x41')]},'attributes':['id',_0xcbbc('0x42')],'order':[['id',_0xcbbc('0x43')]]})[_0xcbbc('0x11')](function(_0x1e2f07){logger[_0xcbbc('0x12')](_0xcbbc('0x44'),_0x316ac5);logger[_0xcbbc('0x13')]('getContactByPhone',_0x316ac5,JSON[_0xcbbc('0x14')](_0x1e2f07));_0x2b22bf(_0x1e2f07);})['catch'](function(_0x65931d){logger['error'](_0xcbbc('0x44'),_0x65931d[_0xcbbc('0x16')],_0x316ac5);_0x332bf5(_0xf3594c[_0xcbbc('0x19')](0x1f4,_0x65931d['message']));});});};exports[_0xcbbc('0x45')]=function(_0x2173d1){var _0x4dd586=this;return new Promise(function(_0xf2b852,_0x3bc64d){return db['sequelize'][_0xcbbc('0x26')](function(_0x25c249){var _0x58e01c=_0x2173d1[_0xcbbc('0xa')]&&_0x2173d1['options'][_0xcbbc('0x22')]?_0x2173d1[_0xcbbc('0xa')][_0xcbbc('0x22')]:{};return db[_0xcbbc('0x8')][_0xcbbc('0x1e')](_0x2173d1[_0xcbbc('0x1c')],{'where':_0x58e01c,'transaction':_0x25c249})[_0xcbbc('0x11')](function(_0x15330c){logger[_0xcbbc('0x12')](_0xcbbc('0x45'),_0x2173d1);logger[_0xcbbc('0x13')]('ResetActiveCalls',_0x2173d1,JSON[_0xcbbc('0x14')](_0x15330c));_0xf2b852(_0x15330c);})[_0xcbbc('0x15')](function(_0x84b857){logger[_0xcbbc('0x19')](_0xcbbc('0x45'),_0x84b857['message'],_0x2173d1);_0x3bc64d(_0x4dd586[_0xcbbc('0x19')](0x1f4,_0x84b857[_0xcbbc('0x16')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x28bcd6){var _0x397078=this;var _0x401e1a=_0x28bcd6[_0xcbbc('0x1c')][_0xcbbc('0x22')][_0xcbbc('0x46')];var _0x1537d6=_0x28bcd6[_0xcbbc('0x1c')][_0xcbbc('0x22')][_0xcbbc('0x47')];var _0x3594ba=_0x28bcd6[_0xcbbc('0x1c')][_0xcbbc('0x22')]['availableAgentsIds'];return new Promise(function(_0x26780e,_0x487369){return db[_0xcbbc('0x8')][_0xcbbc('0x9')]({'where':{'voiceQueueId':{'$in':_0x401e1a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xcbbc('0x25')][_0xcbbc('0x48')](_0xcbbc('0x49')+_0x1537d6+'\x20MINUTE'),'$gt':db['sequelize'][_0xcbbc('0x48')](_0xcbbc('0x4a'))}},'UserId':{'$in':_0x3594ba}},'include':[{'model':db['CmContact'],'as':_0xcbbc('0x4b')},{'model':db[_0xcbbc('0x4c')],'as':'Agent','attributes':['id',_0xcbbc('0x2a'),'voicePause']},{'model':db['CmList'],'as':_0xcbbc('0x4d')}]})[_0xcbbc('0x11')](function(_0x2b0e4f){if(_0x2b0e4f[_0xcbbc('0x2b')]>0x0){return db[_0xcbbc('0x25')][_0xcbbc('0x26')](function(_0x20cbb0){return db[_0xcbbc('0x8')][_0xcbbc('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xcbbc('0x48')](_0xcbbc('0x4a'))},{'where':{'id':{'$in':_[_0xcbbc('0xf')](_0x2b0e4f,'id')}},'transaction':_0x20cbb0})[_0xcbbc('0x11')](function(){_0x26780e(_0x2b0e4f);})[_0xcbbc('0x15')](function(_0x2ce042){logger['error'](_0xcbbc('0x4e'),_0x2ce042[_0xcbbc('0x16')],_0x28bcd6);_0x487369(_0x397078[_0xcbbc('0x19')](0x1f4,_0x2ce042['message']));});})[_0xcbbc('0x15')](function(_0x439adb){logger['error'](_0xcbbc('0x4e'),_0x439adb[_0xcbbc('0x16')],_0x28bcd6);_0x487369(_0x397078[_0xcbbc('0x19')](0x1f4,_0x439adb['message']));});}else{_0x26780e(_0x2b0e4f);}});});}; \ No newline at end of file +var _0x405d=['\x20,\x201,\x20null','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','Contact','voicePause','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','model','attributes','then','info','debug','stringify','catch','error','message','map','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','CmContact','describe','order','UPDATE','keys','User','Agent','name','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1e3d90,_0x1f7db0){var _0x88cbc7=function(_0x29206f){while(--_0x29206f){_0x1e3d90['push'](_0x1e3d90['shift']());}};_0x88cbc7(++_0x1f7db0);}(_0x405d,0x158));var _0xd405=function(_0x47e239,_0x155ed6){_0x47e239=_0x47e239-0x0;var _0x3b449e=_0x405d[_0x47e239];return _0x3b449e;};'use strict';var _=require(_0xd405('0x0'));var util=require(_0xd405('0x1'));var moment=require(_0xd405('0x2'));var BPromise=require(_0xd405('0x3'));var db=require(_0xd405('0x4'))['db'];var logger=require(_0xd405('0x5'))(_0xd405('0x6'));exports[_0xd405('0x7')]=function(_0x3b9b63){var _0x5552b3=this;return new Promise(function(_0x502450,_0x4b64eb){return db[_0xd405('0x8')][_0xd405('0x9')]({'raw':_0x3b9b63['options']?_0x3b9b63[_0xd405('0xa')][_0xd405('0xb')]===undefined?!![]:![]:!![],'where':_0x3b9b63[_0xd405('0xa')]?_0x3b9b63[_0xd405('0xa')][_0xd405('0xc')]||null:null,'attributes':_0x3b9b63[_0xd405('0xa')]?_0x3b9b63[_0xd405('0xa')]['attributes']||null:null,'limit':_0x3b9b63['options']?_0x3b9b63[_0xd405('0xa')][_0xd405('0xd')]||null:null,'include':_0x3b9b63[_0xd405('0xa')]?_0x3b9b63[_0xd405('0xa')]['include']?_['map'](_0x3b9b63['options'][_0xd405('0xe')],function(_0x21f1aa){return{'model':db[_0x21f1aa[_0xd405('0xf')]],'as':_0x21f1aa['as'],'attributes':_0x21f1aa[_0xd405('0x10')],'include':_0x21f1aa[_0xd405('0xe')]?_['map'](_0x21f1aa[_0xd405('0xe')],function(_0x17e3e7){return{'model':db[_0x17e3e7[_0xd405('0xf')]],'as':_0x17e3e7['as'],'attributes':_0x17e3e7[_0xd405('0x10')],'include':_0x17e3e7[_0xd405('0xe')]?_['map'](_0x17e3e7['include'],function(_0x46ebc9){return{'model':db[_0x46ebc9[_0xd405('0xf')]],'as':_0x46ebc9['as'],'attributes':_0x46ebc9[_0xd405('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd405('0x11')](function(_0x8dcea){logger[_0xd405('0x12')]('GetCmHopper',_0x3b9b63);logger[_0xd405('0x13')](_0xd405('0x7'),_0x3b9b63,JSON[_0xd405('0x14')](_0x8dcea));_0x502450(_0x8dcea);})[_0xd405('0x15')](function(_0x1016d6){logger[_0xd405('0x16')](_0xd405('0x7'),_0x1016d6[_0xd405('0x17')],_0x3b9b63);_0x4b64eb(_0x5552b3['error'](0x1f4,_0x1016d6[_0xd405('0x17')]));});});};exports['ShowCmHopper']=function(_0x1abac9){var _0x570087=this;return new Promise(function(_0x5dfc80,_0x4bfa8e){return db[_0xd405('0x8')]['find']({'raw':_0x1abac9[_0xd405('0xa')]?_0x1abac9['options'][_0xd405('0xb')]===undefined?!![]:![]:!![],'where':_0x1abac9['options']?_0x1abac9[_0xd405('0xa')]['where']||null:null,'attributes':_0x1abac9['options']?_0x1abac9[_0xd405('0xa')][_0xd405('0x10')]||null:null,'include':_0x1abac9['options']?_0x1abac9[_0xd405('0xa')]['include']?_['map'](_0x1abac9[_0xd405('0xa')][_0xd405('0xe')],function(_0x1e16e0){return{'model':db[_0x1e16e0[_0xd405('0xf')]],'as':_0x1e16e0['as'],'attributes':_0x1e16e0[_0xd405('0x10')],'include':_0x1e16e0['include']?_[_0xd405('0x18')](_0x1e16e0[_0xd405('0xe')],function(_0x5cb234){return{'model':db[_0x5cb234[_0xd405('0xf')]],'as':_0x5cb234['as'],'attributes':_0x5cb234[_0xd405('0x10')],'include':_0x5cb234[_0xd405('0xe')]?_['map'](_0x5cb234['include'],function(_0x8091ef){return{'model':db[_0x8091ef[_0xd405('0xf')]],'as':_0x8091ef['as'],'attributes':_0x8091ef[_0xd405('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd405('0x11')](function(_0x43f71e){logger[_0xd405('0x12')](_0xd405('0x19'),_0x1abac9);logger[_0xd405('0x13')](_0xd405('0x19'),_0x1abac9,JSON[_0xd405('0x14')](_0x43f71e));_0x5dfc80(_0x43f71e);})[_0xd405('0x15')](function(_0x4a2615){logger[_0xd405('0x16')]('ShowCmHopper',_0x4a2615[_0xd405('0x17')],_0x1abac9);_0x4bfa8e(_0x570087[_0xd405('0x16')](0x1f4,_0x4a2615[_0xd405('0x17')]));});});};exports['CreateCmHopper']=function(_0x26427c){var _0x47bdff=this;return new Promise(function(_0x42eb4a,_0x367e9f){return db[_0xd405('0x8')][_0xd405('0x1a')](_0x26427c[_0xd405('0x1b')],{'raw':_0x26427c[_0xd405('0xa')]?_0x26427c[_0xd405('0xa')]['raw']===undefined?!![]:![]:!![]})[_0xd405('0x11')](function(_0x51ac7a){logger[_0xd405('0x12')](_0xd405('0x1c'),_0x26427c);logger[_0xd405('0x13')](_0xd405('0x1c'),_0x26427c,JSON[_0xd405('0x14')](_0x51ac7a));_0x42eb4a(_0x51ac7a);})[_0xd405('0x15')](function(_0x23fe9f){logger[_0xd405('0x16')](_0xd405('0x1c'),_0x23fe9f[_0xd405('0x17')],_0x26427c);_0x367e9f(_0x47bdff[_0xd405('0x16')](0x1f4,_0x23fe9f[_0xd405('0x17')]));});});};exports[_0xd405('0x1d')]=function(_0x2946f){var _0x5649c6=this;return new Promise(function(_0x4e9af4,_0x1978a7){return db[_0xd405('0x8')][_0xd405('0x1e')](_0x2946f['body'],{'raw':_0x2946f[_0xd405('0xa')]?_0x2946f[_0xd405('0xa')][_0xd405('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2946f['options']?_0x2946f['options'][_0xd405('0xc')]||null:null,'attributes':_0x2946f[_0xd405('0xa')]?_0x2946f[_0xd405('0xa')][_0xd405('0x10')]||null:null,'limit':_0x2946f[_0xd405('0xa')]?_0x2946f[_0xd405('0xa')]['limit']||null:null})[_0xd405('0x11')](function(_0x3910be){logger[_0xd405('0x12')](_0xd405('0x1d'),_0x2946f);logger[_0xd405('0x12')](_0xd405('0x1f'),JSON[_0xd405('0x14')](_0x2946f[_0xd405('0xa')][_0xd405('0xc')]),_0x2946f['body'][_0xd405('0x20')]);logger[_0xd405('0x13')]('UpdateCmHopper',_0x2946f,JSON[_0xd405('0x14')](_0x3910be));_0x4e9af4(_0x3910be);})[_0xd405('0x15')](function(_0x1309ef){logger[_0xd405('0x16')](_0xd405('0x1d'),_0x1309ef[_0xd405('0x17')],_0x2946f);_0x1978a7(_0x5649c6['error'](0x1f4,_0x1309ef[_0xd405('0x17')]));});});};exports['DestroyCmHopper']=function(_0x52bf2b){var _0x52d584=this;return new Promise(function(_0x52c8e4,_0x3a59c2){return db[_0xd405('0x8')][_0xd405('0x21')]({'where':_0x52bf2b['options']?_0x52bf2b[_0xd405('0xa')][_0xd405('0xc')]||null:null})[_0xd405('0x11')](function(_0x27a044){logger[_0xd405('0x12')](_0xd405('0x22'),_0x52bf2b);logger[_0xd405('0x13')]('DestroyCmHopper',_0x52bf2b,JSON[_0xd405('0x14')](_0x27a044));_0x52c8e4(_0x27a044);})[_0xd405('0x15')](function(_0x5587c4){logger[_0xd405('0x16')](_0xd405('0x22'),_0x5587c4['message'],_0x52bf2b);_0x3a59c2(_0x52d584[_0xd405('0x16')](0x1f4,_0x5587c4[_0xd405('0x17')]));});});};exports['GetContactDialer']=function(_0x51343a){var _0x30e7e4=this;return new Promise(function(_0xd3d79,_0x2ff44f){return db[_0xd405('0x23')][_0xd405('0x24')]()[_0xd405('0x11')](function(_0x35113f){return db['sequelize']['transaction'](function(_0x568828){return db[_0xd405('0x8')][_0xd405('0x9')]({'where':_0x51343a[_0xd405('0xa')]?_0x51343a['options'][_0xd405('0xc')]||null:null,'attributes':_0x51343a[_0xd405('0xa')]?_0x51343a[_0xd405('0xa')][_0xd405('0x10')]||null:null,'limit':_0x51343a['options']?_0x51343a[_0xd405('0xa')][_0xd405('0xd')]||null:null,'order':_0x51343a[_0xd405('0xa')]?_0x51343a[_0xd405('0xa')][_0xd405('0x25')]||null:null,'transaction':_0x568828,'lock':_0x568828['LOCK'][_0xd405('0x26')],'include':[{'model':db[_0xd405('0x23')],'as':'Contact','attributes':_[_0xd405('0x27')](_0x35113f)},{'model':db[_0xd405('0x28')],'as':_0xd405('0x29'),'attributes':['id',_0xd405('0x2a'),'voicePause']}]})['then'](function(_0x26e99b){var _0x324107=[];var _0x1e87d7=[];for(var _0x2b21ed=0x0;_0x2b21ed<_0x26e99b[_0xd405('0x2b')];_0x2b21ed+=0x1){var _0x481da5=_0x26e99b[_0x2b21ed][_0xd405('0x2c')];if(_0x481da5===null){_0x324107[_0xd405('0x2d')](_0x26e99b[_0x2b21ed]['update'](_0x51343a[_0xd405('0x1b')],{'transaction':_0x568828}));}else if(!_0x1e87d7['includes'](_0x481da5)){_0x1e87d7[_0xd405('0x2d')](_0x481da5);_0x324107[_0xd405('0x2d')](_0x26e99b[_0x2b21ed][_0xd405('0x1e')](_0x51343a[_0xd405('0x1b')],{'transaction':_0x568828}));}}return BPromise[_0xd405('0x2e')](_0x324107);});})[_0xd405('0x11')](function(_0x532e28){logger['info']('GetContactDialer',_0x51343a);if(_0x532e28[_0xd405('0x2b')]>0x0){logger[_0xd405('0x12')](_0xd405('0x2f'),_0x532e28[0x0]['dataValues']['id'],_0x532e28[0x0][_0xd405('0x30')][_0xd405('0x31')],_0x532e28[0x0][_0xd405('0x30')][_0xd405('0x20')]);}logger[_0xd405('0x13')](_0xd405('0x32'),_0x51343a,JSON['stringify'](_0x532e28));_0xd3d79(_0x532e28);})['catch'](function(_0x33fc93){logger['error'](_0xd405('0x32'),_0x33fc93['message'],_0x51343a);_0x2ff44f(_0x30e7e4[_0xd405('0x16')](0x1f4,_0x33fc93[_0xd405('0x17')]));});});});};exports['MoveContactManagedDialer']=function(_0x19347b){var _0x346b63=this;return new Promise(function(_0x131216,_0x1d9c74){return db[_0xd405('0x33')][_0xd405('0x34')](function(_0xb64cd9){return db[_0xd405('0x35')][_0xd405('0x1a')](_0x19347b[_0xd405('0x1b')],{'raw':_0x19347b[_0xd405('0xa')]?_0x19347b['options'][_0xd405('0xb')]===undefined?!![]:![]:!![],'transaction':_0xb64cd9})[_0xd405('0x11')](function(){logger[_0xd405('0x12')](_0xd405('0x36'),JSON[_0xd405('0x14')](_0x19347b[_0xd405('0xa')][_0xd405('0xc')]),_0x19347b[_0xd405('0xa')][_0xd405('0xc')][_0xd405('0x20')]);return db[_0xd405('0x8')][_0xd405('0x21')]({'where':_0x19347b[_0xd405('0xa')]?_0x19347b[_0xd405('0xa')][_0xd405('0xc')]||null:null,'transaction':_0xb64cd9});});})[_0xd405('0x11')](function(_0x1bedee){logger[_0xd405('0x12')](_0xd405('0x37'),_0x19347b);logger[_0xd405('0x13')](_0xd405('0x37'),_0x19347b,JSON[_0xd405('0x14')](_0x1bedee));_0x131216(_0x1bedee);})[_0xd405('0x15')](function(_0x38c836){logger[_0xd405('0x16')](_0xd405('0x37'),_0x38c836[_0xd405('0x17')],_0x19347b);_0x1d9c74(_0x346b63[_0xd405('0x16')](0x1f4,_0x38c836[_0xd405('0x17')]));});});};exports[_0xd405('0x38')]=function(_0x2bd589){var _0x37b599=this;return new Promise(function(_0x5b1fdd,_0xa88146){return db[_0xd405('0x8')][_0xd405('0x9')]({'raw':_0x2bd589['options']?_0x2bd589[_0xd405('0xa')][_0xd405('0xb')]===undefined?!![]:![]:!![],'where':_0x2bd589[_0xd405('0xa')]?_0x2bd589[_0xd405('0xa')][_0xd405('0xc')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xd405('0x33')]['fn']('IF',db[_0xd405('0x33')]['literal'](_0xd405('0x39')+util[_0xd405('0x3a')](_0xd405('0x3b'),moment()[_0xd405('0x3a')](_0xd405('0x3c')))+_0xd405('0x3d')))),'contactsRescheduled']]})[_0xd405('0x11')](function(_0x54814f){logger[_0xd405('0x12')]('CountReScheduled',_0x2bd589);logger[_0xd405('0x13')](_0xd405('0x38'),_0x2bd589,JSON[_0xd405('0x14')](_0x54814f));_0x5b1fdd(_0x54814f);})['catch'](function(_0x2849eb){logger[_0xd405('0x16')](_0xd405('0x38'),_0x2849eb['message'],_0x2bd589);_0xa88146(_0x37b599['error'](0x1f4,_0x2849eb['message']));});});};exports[_0xd405('0x3e')]=function(_0x901ac4){var _0x28921b=this;return new Promise(function(_0x2682cc,_0x53c4fc){return db[_0xd405('0x23')][_0xd405('0x24')]()['then'](function(){return db[_0xd405('0x33')][_0xd405('0x34')](function(_0x415256){return db[_0xd405('0x8')][_0xd405('0x9')]({'where':_0x901ac4[_0xd405('0xa')]?_0x901ac4['options']['where']||null:null,'attributes':_0x901ac4['options']?_0x901ac4['options'][_0xd405('0x10')]||null:null,'limit':0x1,'order':_0x901ac4[_0xd405('0xa')]?_0x901ac4[_0xd405('0xa')][_0xd405('0x25')]||null:null,'group':db['CmHopper'][_0xd405('0x2c')],'transaction':_0x415256,'lock':_0x415256[_0xd405('0x3f')][_0xd405('0x26')],'include':_0x901ac4[_0xd405('0xa')]?_0x901ac4[_0xd405('0xa')][_0xd405('0xe')]?_[_0xd405('0x18')](_0x901ac4['options'][_0xd405('0xe')],function(_0x33aaa0){return{'model':db[_0x33aaa0[_0xd405('0xf')]],'as':_0x33aaa0['as'],'attributes':_0x33aaa0[_0xd405('0x10')],'include':_0x33aaa0['include']?_['map'](_0x33aaa0[_0xd405('0xe')],function(_0x523d92){return{'model':db[_0x523d92[_0xd405('0xf')]],'as':_0x523d92['as'],'attributes':_0x523d92['attributes'],'include':_0x523d92[_0xd405('0xe')]?_['map'](_0x523d92['include'],function(_0x1fa1c5){return{'model':db[_0x1fa1c5['model']],'as':_0x1fa1c5['as'],'attributes':_0x1fa1c5[_0xd405('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd405('0x11')](function(_0x2f1732){var _0x2b2a47=[];for(var _0x2a321a=0x0;_0x2a321a<_0x2f1732[_0xd405('0x2b')];_0x2a321a+=0x1){_0x2b2a47['push'](_0x2f1732[_0x2a321a]['update'](_0x901ac4[_0xd405('0x1b')],{'transaction':_0x415256}));}return BPromise[_0xd405('0x2e')](_0x2b2a47);});})[_0xd405('0x11')](function(_0x2f8d40){logger[_0xd405('0x12')]('GetContactRecallMe',_0x901ac4);logger[_0xd405('0x13')]('GetContactRecallMe',_0x901ac4,JSON['stringify'](_0x2f8d40));_0x2682cc(_0x2f8d40);})[_0xd405('0x15')](function(_0x1a2b6c){logger[_0xd405('0x16')](_0xd405('0x3e'),_0x1a2b6c['message'],_0x901ac4);_0x53c4fc(_0x28921b['error'](0x1f4,_0x1a2b6c[_0xd405('0x17')]));});});});};exports[_0xd405('0x40')]=function(_0x4f0d00){var _0x511c26=this;return new Promise(function(_0x33865d,_0x47afeb){db[_0xd405('0x23')][_0xd405('0x24')]()[_0xd405('0x11')](function(_0x1f8c5e){return db[_0xd405('0x8')][_0xd405('0x9')]({'raw':_0x4f0d00[_0xd405('0xa')]?_0x4f0d00['options'][_0xd405('0xb')]===undefined?!![]:![]:!![],'where':_0x4f0d00[_0xd405('0xa')]?_0x4f0d00['options']['where']||null:null,'attributes':_0x4f0d00[_0xd405('0xa')]?_0x4f0d00[_0xd405('0xa')]['attributes']||null:null,'limit':_0x4f0d00['options']?_0x4f0d00['options'][_0xd405('0xd')]||null:null,'include':_0x4f0d00['options']?_0x4f0d00[_0xd405('0xa')][_0xd405('0xe')]?_[_0xd405('0x18')](_0x4f0d00['options'][_0xd405('0xe')],function(_0x5ac4f8){return{'model':db[_0x5ac4f8[_0xd405('0xf')]],'as':_0x5ac4f8['as'],'attributes':_0x5ac4f8['as']==='Contact'?_[_0xd405('0x27')](_0x1f8c5e):_0x5ac4f8[_0xd405('0x10')],'include':_0x5ac4f8['include']?_[_0xd405('0x18')](_0x5ac4f8[_0xd405('0xe')],function(_0x48ca3b){return{'model':db[_0x48ca3b['model']],'as':_0x48ca3b['as'],'attributes':_0x48ca3b[_0xd405('0x10')],'include':_0x48ca3b[_0xd405('0xe')]?_['map'](_0x48ca3b[_0xd405('0xe')],function(_0x4f8cda){return{'model':db[_0x4f8cda[_0xd405('0xf')]],'as':_0x4f8cda['as'],'attributes':_0x4f8cda[_0xd405('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a64d4){logger[_0xd405('0x12')]('GetCmHopper',_0x4f0d00);logger['debug'](_0xd405('0x7'),_0x4f0d00,JSON[_0xd405('0x14')](_0x5a64d4));_0x33865d(_0x5a64d4);})[_0xd405('0x15')](function(_0x4e20db){logger['error'](_0xd405('0x7'),_0x4e20db[_0xd405('0x17')],_0x4f0d00);_0x47afeb(_0x511c26['error'](0x1f4,_0x4e20db['message']));});});});};exports[_0xd405('0x41')]=function(_0x106269){var _0x1b9d8f=this;return new Promise(function(_0x144132,_0x34f4ce){return db[_0xd405('0x23')][_0xd405('0x42')]({'raw':!![],'where':{'phone':_0x106269['options'][_0xd405('0xc')][_0xd405('0x43')]},'attributes':['id','dialTimezone'],'order':[['id',_0xd405('0x44')]]})['then'](function(_0x106df7){logger['info'](_0xd405('0x45'),_0x106269);logger['debug']('getContactByPhone',_0x106269,JSON[_0xd405('0x14')](_0x106df7));_0x144132(_0x106df7);})[_0xd405('0x15')](function(_0x4b6cb5){logger['error']('getContactByPhone',_0x4b6cb5['message'],_0x106269);_0x34f4ce(_0x1b9d8f[_0xd405('0x16')](0x1f4,_0x4b6cb5[_0xd405('0x17')]));});});};exports[_0xd405('0x46')]=function(_0x48117c){var _0x55d246=this;return new Promise(function(_0x3d5728,_0x52f01f){return db['sequelize'][_0xd405('0x34')](function(_0x417900){var _0x3a718e=_0x48117c[_0xd405('0xa')]&&_0x48117c[_0xd405('0xa')][_0xd405('0xc')]?_0x48117c[_0xd405('0xa')][_0xd405('0xc')]:{};return db['CmHopper'][_0xd405('0x1e')](_0x48117c[_0xd405('0x1b')],{'where':_0x3a718e,'transaction':_0x417900})[_0xd405('0x11')](function(_0x5dedde){logger[_0xd405('0x12')](_0xd405('0x46'),_0x48117c);logger[_0xd405('0x13')](_0xd405('0x46'),_0x48117c,JSON[_0xd405('0x14')](_0x5dedde));_0x3d5728(_0x5dedde);})[_0xd405('0x15')](function(_0x253c86){logger[_0xd405('0x16')](_0xd405('0x46'),_0x253c86['message'],_0x48117c);_0x52f01f(_0x55d246['error'](0x1f4,_0x253c86[_0xd405('0x17')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x59a65c){var _0x1dcc1e=this;var _0x333dfe=_0x59a65c['body'][_0xd405('0xc')][_0xd405('0x47')];var _0x31cdb9=_0x59a65c[_0xd405('0x1b')][_0xd405('0xc')][_0xd405('0x48')];var _0x3b02b7=_0x59a65c[_0xd405('0x1b')]['where'][_0xd405('0x49')];return new Promise(function(_0x2089f7,_0x2f5f1e){return db[_0xd405('0x8')][_0xd405('0x9')]({'where':{'voiceQueueId':{'$in':_0x333dfe},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd405('0x33')][_0xd405('0x4a')](_0xd405('0x4b')+_0x31cdb9+'\x20MINUTE'),'$gt':db[_0xd405('0x33')][_0xd405('0x4a')](_0xd405('0x4c'))}},'UserId':{'$in':_0x3b02b7}},'include':[{'model':db[_0xd405('0x23')],'as':_0xd405('0x4d')},{'model':db['User'],'as':_0xd405('0x29'),'attributes':['id','name',_0xd405('0x4e')]},{'model':db[_0xd405('0x4f')],'as':'List'}]})[_0xd405('0x11')](function(_0x4c201e){if(_0x4c201e[_0xd405('0x2b')]>0x0){return db[_0xd405('0x33')]['transaction'](function(_0x401bb6){return db['CmHopper'][_0xd405('0x1e')]({'recallmeNotifiedDate':db[_0xd405('0x33')][_0xd405('0x4a')](_0xd405('0x4c'))},{'where':{'id':{'$in':_[_0xd405('0x18')](_0x4c201e,'id')}},'transaction':_0x401bb6})[_0xd405('0x11')](function(){_0x2089f7(_0x4c201e);})[_0xd405('0x15')](function(_0x4889e4){logger[_0xd405('0x16')](_0xd405('0x50'),_0x4889e4[_0xd405('0x17')],_0x59a65c);_0x2f5f1e(_0x1dcc1e[_0xd405('0x16')](0x1f4,_0x4889e4[_0xd405('0x17')]));});})[_0xd405('0x15')](function(_0x5cac5c){logger[_0xd405('0x16')](_0xd405('0x50'),_0x5cac5c[_0xd405('0x17')],_0x59a65c);_0x2f5f1e(_0x1dcc1e[_0xd405('0x16')](0x1f4,_0x5cac5c[_0xd405('0x17')]));});}else{_0x2089f7(_0x4c201e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a1a0b2f..678a285 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 _0xac6c=['exports','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id/previewrecall','getPreviewRecall','create','/preview','getPreview','post','/timezone','put','/:id','update','delete','destroy'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xac6c,0x14b));var _0xcac6=function(_0x3ff3ce,_0x181280){_0x3ff3ce=_0x3ff3ce-0x0;var _0x17af71=_0xac6c[_0x3ff3ce];return _0x17af71;};'use strict';var express=require('express');var router=express[_0xcac6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xcac6('0x1'));router[_0xcac6('0x2')]('/',auth[_0xcac6('0x3')](),controller['index']);router[_0xcac6('0x2')](_0xcac6('0x4'),auth[_0xcac6('0x3')](),controller[_0xcac6('0x5')]);router[_0xcac6('0x2')]('/opencontacts',auth[_0xcac6('0x3')](),controller[_0xcac6('0x6')]);router[_0xcac6('0x2')](_0xcac6('0x7'),auth[_0xcac6('0x3')](),controller[_0xcac6('0x8')]);router[_0xcac6('0x2')]('/:id',auth[_0xcac6('0x3')](),controller['show']);router['get'](_0xcac6('0x9'),auth[_0xcac6('0x3')](),controller[_0xcac6('0xa')]);router['post']('/',auth[_0xcac6('0x3')](),controller[_0xcac6('0xb')]);router['post'](_0xcac6('0xc'),auth[_0xcac6('0x3')](),controller[_0xcac6('0xd')]);router[_0xcac6('0xe')](_0xcac6('0xf'),auth[_0xcac6('0x3')](),controller['getTimezone']);router[_0xcac6('0x10')](_0xcac6('0x11'),auth[_0xcac6('0x3')](),controller[_0xcac6('0x12')]);router[_0xcac6('0x13')](_0xcac6('0x11'),auth[_0xcac6('0x3')](),controller[_0xcac6('0x14')]);module[_0xcac6('0x15')]=router; \ No newline at end of file +var _0x12af=['destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','create','getPreview','/timezone','getTimezone','put','delete'];(function(_0x577d01,_0x1ec928){var _0x58fcc2=function(_0x2be0d5){while(--_0x2be0d5){_0x577d01['push'](_0x577d01['shift']());}};_0x58fcc2(++_0x1ec928);}(_0x12af,0x1e5));var _0xf12a=function(_0x1e90b4,_0x14ce86){_0x1e90b4=_0x1e90b4-0x0;var _0x4d52f8=_0x12af[_0x1e90b4];return _0x4d52f8;};'use strict';var express=require(_0xf12a('0x0'));var router=express[_0xf12a('0x1')]();var auth=require(_0xf12a('0x2'));var controller=require(_0xf12a('0x3'));router[_0xf12a('0x4')]('/',auth['isAuthenticated'](),controller[_0xf12a('0x5')]);router[_0xf12a('0x4')]('/describe',auth[_0xf12a('0x6')](),controller[_0xf12a('0x7')]);router[_0xf12a('0x4')](_0xf12a('0x8'),auth[_0xf12a('0x6')](),controller[_0xf12a('0x9')]);router[_0xf12a('0x4')]('/timezones',auth[_0xf12a('0x6')](),controller[_0xf12a('0xa')]);router[_0xf12a('0x4')](_0xf12a('0xb'),auth[_0xf12a('0x6')](),controller[_0xf12a('0xc')]);router[_0xf12a('0x4')](_0xf12a('0xd'),auth[_0xf12a('0x6')](),controller[_0xf12a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf12a('0xf')]);router['post']('/preview',auth['isAuthenticated'](),controller[_0xf12a('0x10')]);router['post'](_0xf12a('0x11'),auth[_0xf12a('0x6')](),controller[_0xf12a('0x12')]);router[_0xf12a('0x13')](_0xf12a('0xb'),auth[_0xf12a('0x6')](),controller['update']);router[_0xf12a('0x14')](_0xf12a('0xb'),auth[_0xf12a('0x6')](),controller[_0xf12a('0x15')]);module[_0xf12a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index e58650e..7b0c44c 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 _0x0e96=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0e96,0xe3));var _0x60e9=function(_0xcc3e89,_0x2a3774){_0xcc3e89=_0xcc3e89-0x0;var _0x572912=_0x0e96[_0xcc3e89];return _0x572912;};'use strict';var moment=require(_0x60e9('0x0'));var Sequelize=require(_0x60e9('0x1'));module[_0x60e9('0x2')]={'CmHopperId':{'type':Sequelize[_0x60e9('0x3')]},'phone':{'type':Sequelize[_0x60e9('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x60e9('0x5')],'defaultValue':moment()[_0x60e9('0x6')](_0x60e9('0x7'))},'countbusyretry':{'type':Sequelize[_0x60e9('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x60e9('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x60e9('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x60e9('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x60e9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x27ab=['moment','INTEGER','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x27ab,0x192));var _0xb27a=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x27ab[_0x4d8ed9];return _0x1e2140;};'use strict';var moment=require(_0xb27a('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xb27a('0x1')]},'phone':{'type':Sequelize[_0xb27a('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb27a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb27a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb27a('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb27a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb27a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb27a('0x1')],'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 8dce51f..9747187 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 _0x78ec=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','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','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x542654,_0x5eb886){var _0x1b67f7=function(_0x57feaf){while(--_0x57feaf){_0x542654['push'](_0x542654['shift']());}};_0x1b67f7(++_0x5eb886);}(_0x78ec,0x174));var _0xc78e=function(_0x1648a6,_0x2362cc){_0x1648a6=_0x1648a6-0x0;var _0x29af91=_0x78ec[_0x1648a6];return _0x29af91;};'use strict';var emlformat=require(_0xc78e('0x0'));var rimraf=require(_0xc78e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc78e('0x2'));var moment=require(_0xc78e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc78e('0x4'));var path=require('path');var sox=require(_0xc78e('0x5'));var csv=require(_0xc78e('0x6'));var ejs=require(_0xc78e('0x7'));var fs=require('fs');var fs_extra=require(_0xc78e('0x8'));var _=require('lodash');var squel=require(_0xc78e('0x9'));var crypto=require(_0xc78e('0xa'));var jsforce=require(_0xc78e('0xb'));var deskjs=require(_0xc78e('0xc'));var toCsv=require(_0xc78e('0x6'));var querystring=require(_0xc78e('0xd'));var Papa=require(_0xc78e('0xe'));var Redis=require(_0xc78e('0xf'));var authService=require(_0xc78e('0x10'));var qs=require(_0xc78e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc78e('0x12'))(_0xc78e('0x13'));var utils=require(_0xc78e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc78e('0x15'));var db=require(_0xc78e('0x16'))['db'];function respondWithStatusCode(_0x4a64c1,_0x5307a4){_0x5307a4=_0x5307a4||0xcc;return function(_0x100686){if(_0x100686){return _0x4a64c1[_0xc78e('0x17')](_0x5307a4);}return _0x4a64c1['status'](_0x5307a4)[_0xc78e('0x18')]();};}function respondWithResult(_0x3f91e0,_0x30d963){_0x30d963=_0x30d963||0xc8;return function(_0x5af8be){if(_0x5af8be){return _0x3f91e0[_0xc78e('0x19')](_0x30d963)[_0xc78e('0x1a')](_0x5af8be);}};}function respondWithFilteredResult(_0x4f7817,_0x3a9e0f){return function(_0xa23f31){if(_0xa23f31){var _0x2236a3=typeof _0x3a9e0f[_0xc78e('0x1b')]===_0xc78e('0x1c')&&typeof _0x3a9e0f['limit']===_0xc78e('0x1c');var _0x297e8f=_0xa23f31[_0xc78e('0x1d')];var _0x4eaaef=_0x2236a3?0x0:_0x3a9e0f[_0xc78e('0x1b')];var _0x5186d4=_0x2236a3?_0xa23f31['count']:_0x3a9e0f[_0xc78e('0x1b')]+_0x3a9e0f[_0xc78e('0x1e')];var _0x3d9967;if(_0x5186d4>=_0x297e8f){_0x5186d4=_0x297e8f;_0x3d9967=0xc8;}else{_0x3d9967=0xce;}_0x4f7817[_0xc78e('0x19')](_0x3d9967);return _0x4f7817['set'](_0xc78e('0x1f'),_0x4eaaef+'-'+_0x5186d4+'/'+_0x297e8f)['json'](_0xa23f31);}return null;};}function patchUpdates(_0x4293d5){return function(_0x50fa46){try{jsonpatch['apply'](_0x50fa46,_0x4293d5,!![]);}catch(_0x1f4e8d){return BPromise['reject'](_0x1f4e8d);}return _0x50fa46[_0xc78e('0x20')]();};}function saveUpdates(_0xe8195,_0x1bb984){return function(_0x248af6){if(_0x248af6){return _0x248af6[_0xc78e('0x21')](_0xe8195)[_0xc78e('0x22')](function(_0x20387c){return _0x20387c;});}return null;};}function removeEntity(_0x420f97,_0xb70e72){return function(_0x1f0433){if(_0x1f0433){return _0x1f0433[_0xc78e('0x23')]()[_0xc78e('0x22')](function(){var _0x3e8a14=_0x1f0433[_0xc78e('0x24')]({'plain':!![]});var _0x271ded='CmHopperAdditionalPhones';return db[_0xc78e('0x25')]['destroy']({'where':{'type':_0x271ded,'resourceId':_0x3e8a14['id']}})[_0xc78e('0x22')](function(){return _0x1f0433;});})[_0xc78e('0x22')](function(){_0x420f97[_0xc78e('0x19')](0xcc)[_0xc78e('0x18')]();});}};}function handleEntityNotFound(_0x2c7a61,_0x2b8621){return function(_0x1d325b){if(!_0x1d325b){_0x2c7a61[_0xc78e('0x17')](0x194);}return _0x1d325b;};}function handleError(_0x17b7fc,_0x1f921e){_0x1f921e=_0x1f921e||0x1f4;return function(_0x1fbba6){logger[_0xc78e('0x26')](_0x1fbba6[_0xc78e('0x27')]);if(_0x1fbba6[_0xc78e('0x28')]){delete _0x1fbba6['name'];}_0x17b7fc[_0xc78e('0x19')](_0x1f921e)[_0xc78e('0x29')](_0x1fbba6);};}exports['index']=function(_0x2e2bdc,_0x324411){var _0x1f910c={},_0x44b042={},_0x5d4498={'count':0x0,'rows':[]};var _0x41a1a3=_[_0xc78e('0x2a')](db[_0xc78e('0x2b')][_0xc78e('0x2c')],function(_0x446290){return{'name':_0x446290[_0xc78e('0x2d')],'type':_0x446290['type']['key']};});_0x44b042[_0xc78e('0x2e')]=_[_0xc78e('0x2a')](_0x41a1a3,_0xc78e('0x28'));_0x44b042[_0xc78e('0x2f')]=_[_0xc78e('0x30')](_0x2e2bdc[_0xc78e('0x2f')]);_0x44b042[_0xc78e('0x31')]=_[_0xc78e('0x32')](_0x44b042['model'],_0x44b042[_0xc78e('0x2f')]);_0x1f910c['attributes']=_['intersection'](_0x44b042[_0xc78e('0x2e')],qs['fields'](_0x2e2bdc['query'][_0xc78e('0x33')]));_0x1f910c['attributes']=_0x1f910c[_0xc78e('0x34')][_0xc78e('0x35')]?_0x1f910c[_0xc78e('0x34')]:_0x44b042[_0xc78e('0x2e')];if(!_0x2e2bdc[_0xc78e('0x2f')]['hasOwnProperty'](_0xc78e('0x36'))){_0x1f910c['limit']=qs['limit'](_0x2e2bdc[_0xc78e('0x2f')][_0xc78e('0x1e')]);_0x1f910c[_0xc78e('0x1b')]=qs[_0xc78e('0x1b')](_0x2e2bdc[_0xc78e('0x2f')]['offset']);}_0x1f910c[_0xc78e('0x37')]=qs[_0xc78e('0x38')](_0x2e2bdc[_0xc78e('0x2f')]['sort']);_0x1f910c[_0xc78e('0x39')]=qs[_0xc78e('0x31')](_['pick'](_0x2e2bdc[_0xc78e('0x2f')],_0x44b042[_0xc78e('0x31')]),_0x41a1a3);if(_0x2e2bdc[_0xc78e('0x2f')][_0xc78e('0x3a')]){_0x1f910c[_0xc78e('0x39')]=_[_0xc78e('0x3b')](_0x1f910c[_0xc78e('0x39')],{'$or':_[_0xc78e('0x2a')](_0x41a1a3,function(_0x501ca5){if(_0x501ca5['type']!==_0xc78e('0x3c')){var _0x52201f={};_0x52201f[_0x501ca5[_0xc78e('0x28')]]={'$like':'%'+_0x2e2bdc[_0xc78e('0x2f')][_0xc78e('0x3a')]+'%'};return _0x52201f;}})});}_0x1f910c=_[_0xc78e('0x3b')]({},_0x1f910c,_0x2e2bdc[_0xc78e('0x3d')]);var _0x59bc73={'where':_0x1f910c[_0xc78e('0x39')]};return db[_0xc78e('0x2b')][_0xc78e('0x1d')](_0x59bc73)[_0xc78e('0x22')](function(_0x4ae36a){_0x5d4498[_0xc78e('0x1d')]=_0x4ae36a;if(_0x2e2bdc[_0xc78e('0x2f')][_0xc78e('0x3e')]){_0x1f910c['include']=[{'all':!![]}];}return db[_0xc78e('0x2b')]['findAll'](_0x1f910c);})[_0xc78e('0x22')](function(_0x1f5690){_0x5d4498[_0xc78e('0x3f')]=_0x1f5690;return _0x5d4498;})['then'](respondWithFilteredResult(_0x324411,_0x1f910c))[_0xc78e('0x40')](handleError(_0x324411,null));};exports[_0xc78e('0x41')]=function(_0x1539c0,_0x34800b){var _0x51461d={'raw':!![],'where':{'id':_0x1539c0['params']['id']}},_0x1cce57={};_0x1cce57[_0xc78e('0x2e')]=_[_0xc78e('0x30')](db[_0xc78e('0x2b')][_0xc78e('0x2c')]);_0x1cce57[_0xc78e('0x2f')]=_[_0xc78e('0x30')](_0x1539c0[_0xc78e('0x2f')]);_0x1cce57['filters']=_['intersection'](_0x1cce57[_0xc78e('0x2e')],_0x1cce57[_0xc78e('0x2f')]);_0x51461d['attributes']=_[_0xc78e('0x32')](_0x1cce57[_0xc78e('0x2e')],qs[_0xc78e('0x33')](_0x1539c0[_0xc78e('0x2f')][_0xc78e('0x33')]));_0x51461d[_0xc78e('0x34')]=_0x51461d[_0xc78e('0x34')][_0xc78e('0x35')]?_0x51461d[_0xc78e('0x34')]:_0x1cce57[_0xc78e('0x2e')];if(_0x1539c0[_0xc78e('0x2f')][_0xc78e('0x3e')]){_0x51461d['include']=[{'all':!![]}];}_0x51461d=_[_0xc78e('0x3b')]({},_0x51461d,_0x1539c0[_0xc78e('0x3d')]);return db[_0xc78e('0x2b')][_0xc78e('0x42')](_0x51461d)[_0xc78e('0x22')](handleEntityNotFound(_0x34800b,null))[_0xc78e('0x22')](respondWithResult(_0x34800b,null))[_0xc78e('0x40')](handleError(_0x34800b,null));};exports[_0xc78e('0x43')]=function(_0x284c06,_0xe025cf){return db[_0xc78e('0x2b')][_0xc78e('0x43')](_0x284c06[_0xc78e('0x44')],{})['then'](function(_0x3b16aa){var _0x377ebf=_0x284c06[_0xc78e('0x45')][_0xc78e('0x24')]({'plain':!![]});if(!_0x377ebf)throw new Error(_0xc78e('0x46'));if(_0x377ebf[_0xc78e('0x47')]===_0xc78e('0x45')){var _0x5dd778=_0x3b16aa[_0xc78e('0x24')]({'plain':!![]});var _0x475226=_0xc78e('0x48');return db[_0xc78e('0x49')][_0xc78e('0x42')]({'where':{'name':_0x475226,'userProfileId':_0x377ebf[_0xc78e('0x4a')]},'raw':!![]})[_0xc78e('0x22')](function(_0x4f716e){if(_0x4f716e&&_0x4f716e[_0xc78e('0x4b')]===0x0){return db['UserProfileResource'][_0xc78e('0x43')]({'name':_0x5dd778['name'],'resourceId':_0x5dd778['id'],'type':_0x4f716e[_0xc78e('0x28')],'sectionId':_0x4f716e['id']},{})[_0xc78e('0x22')](function(){return _0x3b16aa;});}else{return _0x3b16aa;}})[_0xc78e('0x40')](function(_0x9e20d5){logger[_0xc78e('0x26')](_0xc78e('0x4c'),_0x9e20d5);throw _0x9e20d5;});}return _0x3b16aa;})[_0xc78e('0x22')](respondWithResult(_0xe025cf,0xc9))['catch'](handleError(_0xe025cf,null));};exports[_0xc78e('0x21')]=function(_0x3d1058,_0x3459e9){if(_0x3d1058[_0xc78e('0x44')]['id']){delete _0x3d1058[_0xc78e('0x44')]['id'];}return db[_0xc78e('0x2b')][_0xc78e('0x42')]({'where':{'id':_0x3d1058['params']['id']}})[_0xc78e('0x22')](handleEntityNotFound(_0x3459e9,null))[_0xc78e('0x22')](saveUpdates(_0x3d1058['body'],null))[_0xc78e('0x22')](respondWithResult(_0x3459e9,null))['catch'](handleError(_0x3459e9,null));};exports[_0xc78e('0x23')]=function(_0x516972,_0x2f7c2c){return db['CmHopperAdditionalPhone'][_0xc78e('0x42')]({'where':{'id':_0x516972['params']['id']}})[_0xc78e('0x22')](handleEntityNotFound(_0x2f7c2c,null))['then'](removeEntity(_0x2f7c2c,null))['catch'](handleError(_0x2f7c2c,null));}; \ No newline at end of file +var _0xc806=['UserProfileSection','find','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','UserProfileResource','destroy','then','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones'];(function(_0x397f3a,_0x23884e){var _0x373e50=function(_0x3b302f){while(--_0x3b302f){_0x397f3a['push'](_0x397f3a['shift']());}};_0x373e50(++_0x23884e);}(_0xc806,0x144));var _0x6c80=function(_0x57dbc5,_0x1cc107){_0x57dbc5=_0x57dbc5-0x0;var _0x5d9f24=_0xc806[_0x57dbc5];return _0x5d9f24;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6c80('0x0'));var jsonpatch=require(_0x6c80('0x1'));var rp=require(_0x6c80('0x2'));var moment=require(_0x6c80('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c80('0x4'));var path=require(_0x6c80('0x5'));var sox=require(_0x6c80('0x6'));var csv=require(_0x6c80('0x7'));var ejs=require(_0x6c80('0x8'));var fs=require('fs');var fs_extra=require(_0x6c80('0x9'));var _=require(_0x6c80('0xa'));var squel=require('squel');var crypto=require(_0x6c80('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c80('0xc'));var toCsv=require(_0x6c80('0x7'));var querystring=require(_0x6c80('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c80('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6c80('0xf'));var hardwareService=require(_0x6c80('0x10'));var logger=require('../../config/logger')(_0x6c80('0x11'));var utils=require(_0x6c80('0x12'));var config=require(_0x6c80('0x13'));var licenseUtil=require(_0x6c80('0x14'));var db=require(_0x6c80('0x15'))['db'];function respondWithStatusCode(_0x1dcb5f,_0x20e536){_0x20e536=_0x20e536||0xcc;return function(_0x3a2d4f){if(_0x3a2d4f){return _0x1dcb5f[_0x6c80('0x16')](_0x20e536);}return _0x1dcb5f[_0x6c80('0x17')](_0x20e536)[_0x6c80('0x18')]();};}function respondWithResult(_0x2556f1,_0x5c637d){_0x5c637d=_0x5c637d||0xc8;return function(_0x2ad38f){if(_0x2ad38f){return _0x2556f1[_0x6c80('0x17')](_0x5c637d)[_0x6c80('0x19')](_0x2ad38f);}};}function respondWithFilteredResult(_0x45af91,_0x3548fb){return function(_0x424592){if(_0x424592){var _0x7487f4=typeof _0x3548fb['offset']===_0x6c80('0x1a')&&typeof _0x3548fb[_0x6c80('0x1b')]===_0x6c80('0x1a');var _0x3f2e5a=_0x424592[_0x6c80('0x1c')];var _0x8a8681=_0x7487f4?0x0:_0x3548fb[_0x6c80('0x1d')];var _0x13e950=_0x7487f4?_0x424592[_0x6c80('0x1c')]:_0x3548fb['offset']+_0x3548fb['limit'];var _0x5d9eb4;if(_0x13e950>=_0x3f2e5a){_0x13e950=_0x3f2e5a;_0x5d9eb4=0xc8;}else{_0x5d9eb4=0xce;}_0x45af91[_0x6c80('0x17')](_0x5d9eb4);return _0x45af91[_0x6c80('0x1e')]('Content-Range',_0x8a8681+'-'+_0x13e950+'/'+_0x3f2e5a)[_0x6c80('0x19')](_0x424592);}return null;};}function patchUpdates(_0x187274){return function(_0x273340){try{jsonpatch[_0x6c80('0x1f')](_0x273340,_0x187274,!![]);}catch(_0x40486d){return BPromise[_0x6c80('0x20')](_0x40486d);}return _0x273340[_0x6c80('0x21')]();};}function saveUpdates(_0x4dd227,_0x2196c9){return function(_0xb633ea){if(_0xb633ea){return _0xb633ea[_0x6c80('0x22')](_0x4dd227)['then'](function(_0x4ceda2){return _0x4ceda2;});}return null;};}function removeEntity(_0x234bdb,_0xad331f){return function(_0x3663f9){if(_0x3663f9){return _0x3663f9['destroy']()['then'](function(){var _0x52372d=_0x3663f9['get']({'plain':!![]});var _0x37d081='CmHopperAdditionalPhones';return db[_0x6c80('0x23')][_0x6c80('0x24')]({'where':{'type':_0x37d081,'resourceId':_0x52372d['id']}})[_0x6c80('0x25')](function(){return _0x3663f9;});})['then'](function(){_0x234bdb[_0x6c80('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f82b8,_0x13071){return function(_0x4b11dc){if(!_0x4b11dc){_0x4f82b8[_0x6c80('0x16')](0x194);}return _0x4b11dc;};}function handleError(_0x3e3096,_0x5bf9c6){_0x5bf9c6=_0x5bf9c6||0x1f4;return function(_0x2e83de){logger[_0x6c80('0x26')](_0x2e83de['stack']);if(_0x2e83de[_0x6c80('0x27')]){delete _0x2e83de[_0x6c80('0x27')];}_0x3e3096['status'](_0x5bf9c6)['send'](_0x2e83de);};}exports[_0x6c80('0x28')]=function(_0x3d94f8,_0x5b717f){var _0x1fd658={},_0x1fc270={},_0x22d64e={'count':0x0,'rows':[]};var _0x387ec3=_[_0x6c80('0x29')](db[_0x6c80('0x2a')][_0x6c80('0x2b')],function(_0x1362f4){return{'name':_0x1362f4[_0x6c80('0x2c')],'type':_0x1362f4[_0x6c80('0x2d')][_0x6c80('0x2e')]};});_0x1fc270[_0x6c80('0x2f')]=_['map'](_0x387ec3,_0x6c80('0x27'));_0x1fc270[_0x6c80('0x30')]=_[_0x6c80('0x31')](_0x3d94f8[_0x6c80('0x30')]);_0x1fc270[_0x6c80('0x32')]=_['intersection'](_0x1fc270[_0x6c80('0x2f')],_0x1fc270[_0x6c80('0x30')]);_0x1fd658['attributes']=_['intersection'](_0x1fc270['model'],qs[_0x6c80('0x33')](_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x33')]));_0x1fd658[_0x6c80('0x34')]=_0x1fd658['attributes'][_0x6c80('0x35')]?_0x1fd658['attributes']:_0x1fc270['model'];if(!_0x3d94f8[_0x6c80('0x30')]['hasOwnProperty'](_0x6c80('0x36'))){_0x1fd658['limit']=qs[_0x6c80('0x1b')](_0x3d94f8[_0x6c80('0x30')]['limit']);_0x1fd658[_0x6c80('0x1d')]=qs['offset'](_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x1d')]);}_0x1fd658[_0x6c80('0x37')]=qs[_0x6c80('0x38')](_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x38')]);_0x1fd658[_0x6c80('0x39')]=qs['filters'](_[_0x6c80('0x3a')](_0x3d94f8[_0x6c80('0x30')],_0x1fc270[_0x6c80('0x32')]),_0x387ec3);if(_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x3b')]){_0x1fd658['where']=_[_0x6c80('0x3c')](_0x1fd658['where'],{'$or':_[_0x6c80('0x29')](_0x387ec3,function(_0x5d9034){if(_0x5d9034[_0x6c80('0x2d')]!==_0x6c80('0x3d')){var _0xee0e4={};_0xee0e4[_0x5d9034[_0x6c80('0x27')]]={'$like':'%'+_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x3b')]+'%'};return _0xee0e4;}})});}_0x1fd658=_['merge']({},_0x1fd658,_0x3d94f8[_0x6c80('0x3e')]);var _0x598994={'where':_0x1fd658[_0x6c80('0x39')]};return db[_0x6c80('0x2a')]['count'](_0x598994)[_0x6c80('0x25')](function(_0x343b93){_0x22d64e[_0x6c80('0x1c')]=_0x343b93;if(_0x3d94f8[_0x6c80('0x30')][_0x6c80('0x3f')]){_0x1fd658[_0x6c80('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x1fd658);})[_0x6c80('0x25')](function(_0x2e751f){_0x22d64e[_0x6c80('0x41')]=_0x2e751f;return _0x22d64e;})[_0x6c80('0x25')](respondWithFilteredResult(_0x5b717f,_0x1fd658))[_0x6c80('0x42')](handleError(_0x5b717f,null));};exports[_0x6c80('0x43')]=function(_0x4cc0bf,_0x3437b0){var _0x9af588={'raw':!![],'where':{'id':_0x4cc0bf[_0x6c80('0x44')]['id']}},_0x7fd873={};_0x7fd873[_0x6c80('0x2f')]=_[_0x6c80('0x31')](db[_0x6c80('0x2a')][_0x6c80('0x2b')]);_0x7fd873[_0x6c80('0x30')]=_[_0x6c80('0x31')](_0x4cc0bf[_0x6c80('0x30')]);_0x7fd873[_0x6c80('0x32')]=_['intersection'](_0x7fd873['model'],_0x7fd873[_0x6c80('0x30')]);_0x9af588[_0x6c80('0x34')]=_[_0x6c80('0x45')](_0x7fd873[_0x6c80('0x2f')],qs[_0x6c80('0x33')](_0x4cc0bf[_0x6c80('0x30')][_0x6c80('0x33')]));_0x9af588[_0x6c80('0x34')]=_0x9af588[_0x6c80('0x34')][_0x6c80('0x35')]?_0x9af588[_0x6c80('0x34')]:_0x7fd873[_0x6c80('0x2f')];if(_0x4cc0bf[_0x6c80('0x30')][_0x6c80('0x3f')]){_0x9af588[_0x6c80('0x40')]=[{'all':!![]}];}_0x9af588=_[_0x6c80('0x3c')]({},_0x9af588,_0x4cc0bf[_0x6c80('0x3e')]);return db[_0x6c80('0x2a')]['find'](_0x9af588)[_0x6c80('0x25')](handleEntityNotFound(_0x3437b0,null))[_0x6c80('0x25')](respondWithResult(_0x3437b0,null))['catch'](handleError(_0x3437b0,null));};exports[_0x6c80('0x46')]=function(_0x38b59e,_0x1acbe5){return db['CmHopperAdditionalPhone'][_0x6c80('0x46')](_0x38b59e[_0x6c80('0x47')],{})[_0x6c80('0x25')](function(_0x577701){var _0x4ddcdc=_0x38b59e[_0x6c80('0x48')][_0x6c80('0x49')]({'plain':!![]});if(!_0x4ddcdc)throw new Error(_0x6c80('0x4a'));if(_0x4ddcdc['role']===_0x6c80('0x48')){var _0x4ac80f=_0x577701[_0x6c80('0x49')]({'plain':!![]});var _0xaa8d12=_0x6c80('0x4b');return db[_0x6c80('0x4c')][_0x6c80('0x4d')]({'where':{'name':_0xaa8d12,'userProfileId':_0x4ddcdc[_0x6c80('0x4e')]},'raw':!![]})['then'](function(_0x41c1e3){if(_0x41c1e3&&_0x41c1e3[_0x6c80('0x4f')]===0x0){return db[_0x6c80('0x23')][_0x6c80('0x46')]({'name':_0x4ac80f[_0x6c80('0x27')],'resourceId':_0x4ac80f['id'],'type':_0x41c1e3['name'],'sectionId':_0x41c1e3['id']},{})[_0x6c80('0x25')](function(){return _0x577701;});}else{return _0x577701;}})[_0x6c80('0x42')](function(_0x4766f8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4766f8);throw _0x4766f8;});}return _0x577701;})['then'](respondWithResult(_0x1acbe5,0xc9))[_0x6c80('0x42')](handleError(_0x1acbe5,null));};exports[_0x6c80('0x22')]=function(_0x35f36f,_0x38fac){if(_0x35f36f[_0x6c80('0x47')]['id']){delete _0x35f36f[_0x6c80('0x47')]['id'];}return db[_0x6c80('0x2a')]['find']({'where':{'id':_0x35f36f[_0x6c80('0x44')]['id']}})['then'](handleEntityNotFound(_0x38fac,null))[_0x6c80('0x25')](saveUpdates(_0x35f36f[_0x6c80('0x47')],null))[_0x6c80('0x25')](respondWithResult(_0x38fac,null))[_0x6c80('0x42')](handleError(_0x38fac,null));};exports['destroy']=function(_0x3af1fa,_0xa98cd2){return db[_0x6c80('0x2a')][_0x6c80('0x4d')]({'where':{'id':_0x3af1fa[_0x6c80('0x44')]['id']}})[_0x6c80('0x25')](handleEntityNotFound(_0xa98cd2,null))['then'](removeEntity(_0xa98cd2,null))['catch'](handleError(_0xa98cd2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 2b3aa65..303b60b 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 _0xa37a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa37a,0x103));var _0xaa37=function(_0x257556,_0x31d2a0){_0x257556=_0x257556-0x0;var _0x259a64=_0xa37a[_0x257556];return _0x259a64;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var logger=require(_0xaa37('0x1'))(_0xaa37('0x2'));var moment=require(_0xaa37('0x3'));var BPromise=require(_0xaa37('0x4'));var rp=require(_0xaa37('0x5'));var fs=require('fs');var path=require(_0xaa37('0x6'));var rimraf=require('rimraf');var config=require(_0xaa37('0x7'));var attributes=require(_0xaa37('0x8'));module[_0xaa37('0x9')]=function(_0x3ef290,_0x35a8af){return _0x3ef290[_0xaa37('0xa')](_0xaa37('0xb'),attributes,{'tableName':_0xaa37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc012=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird'];(function(_0x111bab,_0x271498){var _0x5999fa=function(_0x9512f4){while(--_0x9512f4){_0x111bab['push'](_0x111bab['shift']());}};_0x5999fa(++_0x271498);}(_0xc012,0x97));var _0x2c01=function(_0x154f66,_0x116f85){_0x154f66=_0x154f66-0x0;var _0x3f947a=_0xc012[_0x154f66];return _0x3f947a;};'use strict';var _=require(_0x2c01('0x0'));var util=require(_0x2c01('0x1'));var logger=require('../../config/logger')(_0x2c01('0x2'));var moment=require(_0x2c01('0x3'));var BPromise=require(_0x2c01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c01('0x5'));var rimraf=require(_0x2c01('0x6'));var config=require(_0x2c01('0x7'));var attributes=require(_0x2c01('0x8'));module[_0x2c01('0x9')]=function(_0x121886,_0x1aede1){return _0x121886[_0x2c01('0xa')](_0x2c01('0xb'),attributes,{'tableName':_0x2c01('0xc'),'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 6816f7d..8078d12 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 _0xc184=['minutes','phone','createdAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add'];(function(_0x26fb14,_0x6fba65){var _0x5c1eda=function(_0x156eb1){while(--_0x156eb1){_0x26fb14['push'](_0x26fb14['shift']());}};_0x5c1eda(++_0x6fba65);}(_0xc184,0x73));var _0x4c18=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0xc184[_0x5cc51f];return _0x315a2f;};'use strict';var _=require(_0x4c18('0x0'));var util=require(_0x4c18('0x1'));var moment=require(_0x4c18('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c18('0x3'));var fs=require('fs');var Redis=require(_0x4c18('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c18('0x5'))('rpc');var config=require(_0x4c18('0x6'));var jayson=require(_0x4c18('0x7'));var client=jayson[_0x4c18('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x254fa9,_0x3f894e,_0x2e1ef5){return new BPromise(function(_0x2223ae,_0x5b3750){return client[_0x4c18('0x9')](_0x254fa9,_0x2e1ef5)[_0x4c18('0xa')](function(_0xb7e605){logger[_0x4c18('0xb')](_0x4c18('0xc'),_0x3f894e,_0x4c18('0xd'));logger[_0x4c18('0xe')](_0x4c18('0xf'),_0x3f894e,'request\x20sent',JSON['stringify'](_0xb7e605));if(_0xb7e605[_0x4c18('0x10')]){if(_0xb7e605[_0x4c18('0x10')][_0x4c18('0x11')]===0x1f4){logger[_0x4c18('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f894e,_0xb7e605[_0x4c18('0x10')][_0x4c18('0x12')]);return _0x5b3750(_0xb7e605[_0x4c18('0x10')][_0x4c18('0x12')]);}logger[_0x4c18('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f894e,_0xb7e605['error']['message']);return _0x2223ae(_0xb7e605['error'][_0x4c18('0x12')]);}else{logger['info'](_0x4c18('0xc'),_0x3f894e,_0x4c18('0xd'));_0x2223ae(_0xb7e605['result'][_0x4c18('0x12')]);}})[_0x4c18('0x13')](function(_0x3df8ae){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f894e,_0x3df8ae);_0x5b3750(_0x3df8ae);});});}exports[_0x4c18('0x14')]=function(_0x2d41dd){var _0x1e5d87=this;return new Promise(function(_0x959787,_0x45e54a){return db['CmHopper'][_0x4c18('0x15')]({'raw':!![],'where':{'ContactId':_0x2d41dd[_0x4c18('0x16')][_0x4c18('0x17')],'ListId':_0x2d41dd[_0x4c18('0x16')][_0x4c18('0x18')],'VoiceQueueId':_0x2d41dd[_0x4c18('0x16')]['VoiceQueueId']===undefined?null:_0x2d41dd[_0x4c18('0x16')][_0x4c18('0x19')],'CampaignId':_0x2d41dd[_0x4c18('0x16')][_0x4c18('0x1a')]===undefined?null:_0x2d41dd[_0x4c18('0x16')][_0x4c18('0x1a')]}})[_0x4c18('0xa')](function(_0x245248){if(_0x245248!=null){return db[_0x4c18('0x1b')][_0x4c18('0x15')]({'raw':!![],'where':{'CmHopperId':_0x245248['id'],'OrderBy':{'$gt':_0x245248[_0x4c18('0x1c')]}},'order':[[_0x4c18('0x1c'),_0x4c18('0x1d')]]})[_0x4c18('0xa')](function(_0x46699e){var _0x1b51d8=0x0;if(_0x46699e){if(_0x46699e[_0x4c18('0x1e')]+_0x46699e[_0x4c18('0x1f')]+_0x46699e[_0x4c18('0x20')]+_0x46699e[_0x4c18('0x21')]+_0x46699e[_0x4c18('0x22')]+_0x46699e[_0x4c18('0x23')]+_0x46699e[_0x4c18('0x24')]+_0x46699e[_0x4c18('0x25')]<_0x2d41dd['entity']['dialGlobalMaxRetry'])_0x1b51d8=0x1;_0x959787({'additional':_0x1b51d8});}else{return db['CmHopperAdditionalPhone'][_0x4c18('0x15')]({'raw':!![],'where':{'CmHopperId':_0x245248['id']},'order':[[_0x4c18('0x1c'),_0x4c18('0x1d')]]})[_0x4c18('0xa')](function(_0x2c478c){var _0x13ae04=0x0;if(_0x2c478c){if(_0x2c478c[_0x4c18('0x1e')]+_0x2c478c[_0x4c18('0x1f')]+_0x2c478c['countnoanswerretry']+_0x2c478c[_0x4c18('0x21')]+_0x2c478c['countdropretry']+_0x2c478c[_0x4c18('0x23')]+_0x2c478c[_0x4c18('0x24')]+_0x2c478c[_0x4c18('0x25')]<_0x2d41dd[_0x4c18('0x26')][_0x4c18('0x27')])_0x13ae04=0x1;_0x959787({'additional':_0x13ae04});}else{_0x959787({'additional':0x0});}})[_0x4c18('0x13')](function(_0x29f1c9){logger['error'](_0x4c18('0x14'),_0x29f1c9[_0x4c18('0x12')]);_0x45e54a(_0x1e5d87['error'](0x1f4,_0x29f1c9[_0x4c18('0x12')]));});}})[_0x4c18('0x13')](function(_0x1a048e){logger[_0x4c18('0x10')](_0x4c18('0x14'),_0x1a048e[_0x4c18('0x12')]);_0x45e54a(_0x1e5d87[_0x4c18('0x10')](0x1f4,_0x1a048e[_0x4c18('0x12')]));});}else _0x959787({'additional':0x0});});});};exports[_0x4c18('0x28')]=function(_0x5b25d6){var _0x367c4f=this;return new Promise(function(_0x31c96d,_0x287d78){return db[_0x4c18('0x29')][_0x4c18('0x15')]({'raw':!![],'where':{'ContactId':_0x5b25d6['body'][_0x4c18('0x17')],'ListId':_0x5b25d6[_0x4c18('0x16')][_0x4c18('0x18')],'VoiceQueueId':_0x5b25d6['body'][_0x4c18('0x19')]===undefined?null:_0x5b25d6[_0x4c18('0x16')][_0x4c18('0x19')],'CampaignId':_0x5b25d6[_0x4c18('0x16')][_0x4c18('0x1a')]===undefined?null:_0x5b25d6[_0x4c18('0x16')]['CampaignId']}})[_0x4c18('0xa')](function(_0x166c21){if(_0x166c21!=null){return db[_0x4c18('0x1b')][_0x4c18('0x15')]({'raw':!![],'where':{'CmHopperId':_0x166c21['id'],'OrderBy':{'$gte':_0x166c21[_0x4c18('0x1c')]}},'order':[[_0x4c18('0x1c'),_0x4c18('0x1d')]]})['then'](function(_0x226476){if(_0x226476)return activateAdditionalPhone(_0x166c21,_0x5b25d6['body'],_0x226476,_0x5b25d6[_0x4c18('0x2a')],_0x5b25d6[_0x4c18('0x2b')])[_0x4c18('0xa')](function(_0x370d70){_0x31c96d(_0x370d70);});else{return db[_0x4c18('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x166c21['id']},'order':[['OrderBy',_0x4c18('0x1d')]]})['then'](function(_0x33729c){if(_0x33729c)return activateAdditionalPhone(_0x166c21,_0x5b25d6['body'],_0x33729c,_0x5b25d6[_0x4c18('0x2a')],_0x5b25d6[_0x4c18('0x2b')])[_0x4c18('0xa')](function(_0x4b7162){_0x31c96d(_0x4b7162);});else{_0x31c96d({'id':_0x166c21['id'],'phone':''});}})[_0x4c18('0x13')](function(_0x532b2d){logger[_0x4c18('0x10')](_0x4c18('0x14'),_0x532b2d['message']);_0x287d78(_0x367c4f[_0x4c18('0x10')](0x1f4,_0x532b2d['message']));});}})[_0x4c18('0x13')](function(_0x74c05a){logger[_0x4c18('0x10')]('VerifyAdditionalPhones',_0x74c05a[_0x4c18('0x12')]);_0x287d78(_0x367c4f['error'](0x1f4,_0x74c05a[_0x4c18('0x12')]));});}else _0x31c96d(0x1);});});};function activateAdditionalPhone(_0x531c5d,_0x26f739,_0x452f61,_0x1b6d49,_0x215f5b){return new Promise(function(_0x218ab7,_0x4af347){var _0x33ded4;if(_[_0x4c18('0x2c')](_0x452f61[_0x4c18('0x2d')])){_0x452f61[_0x4c18('0x2d')]=moment();}if(moment()>moment(_0x452f61[_0x4c18('0x2d')])){_0x33ded4=moment()[_0x4c18('0x2e')](_0x215f5b||0x3,_0x4c18('0x2f'));}else{if(_0x452f61[_0x4c18('0x1c')]==0x0){_0x33ded4=moment(_0x452f61['scheduledat']);}else{_0x33ded4=moment()[_0x4c18('0x2e')](_0x215f5b||0x3,_0x4c18('0x2f'));}}if(_[_0x4c18('0x2c')](_0x33ded4)){_0x33ded4=moment()[_0x4c18('0x2e')](_0x215f5b||0x3,_0x4c18('0x2f'));}var _0x2ae207={'phone':_0x531c5d[_0x4c18('0x30')],'active':0x0,'OrderBy':_[_0x4c18('0x2c')](_0x531c5d[_0x4c18('0x1c')])?0x0:_0x531c5d[_0x4c18('0x1c')],'scheduledat':moment()[_0x4c18('0x2e')](_0x1b6d49||0x1,'minutes'),'countbusyretry':_0x26f739[_0x4c18('0x1e')],'countcongestionretry':_0x26f739[_0x4c18('0x1f')],'countnoanswerretry':_0x26f739[_0x4c18('0x20')],'countnosuchnumberretry':_0x26f739[_0x4c18('0x21')],'countdropretry':_0x26f739[_0x4c18('0x22')],'countabandonedretry':_0x26f739[_0x4c18('0x23')],'countmachineretry':_0x26f739['countmachineretry'],'countagentrejectretry':_0x26f739[_0x4c18('0x25')],'createdAt':_0x26f739[_0x4c18('0x31')],'updatedAt':_0x26f739['updatedAt']};var _0xbd3236={'CmHopperId':_0x531c5d['id'],'phone':_0x452f61[_0x4c18('0x30')],'active':0x0,'OrderBy':_[_0x4c18('0x2c')](_0x452f61[_0x4c18('0x1c')])?0x0:_0x452f61[_0x4c18('0x1c')],'scheduledat':_0x33ded4,'countbusyretry':_0x452f61[_0x4c18('0x1e')],'countcongestionretry':_0x452f61[_0x4c18('0x1f')],'countnoanswerretry':_0x452f61[_0x4c18('0x20')],'countnosuchnumberretry':_0x452f61[_0x4c18('0x21')],'countdropretry':_0x452f61[_0x4c18('0x22')],'countabandonedretry':_0x452f61[_0x4c18('0x23')],'countmachineretry':_0x452f61['countmachineretry'],'countagentrejectretry':_0x452f61['countagentrejectretry'],'createdAt':_0x452f61[_0x4c18('0x31')],'updatedAt':_0x452f61['updatedAt']};return db[_0x4c18('0x32')][_0x4c18('0x33')](function(_0x301b7d){return db['CmHopperAdditionalPhone'][_0x4c18('0x34')](_0x2ae207,{'where':{'id':_0x452f61['id']}},{'transaction':_0x301b7d})[_0x4c18('0xa')](function(){return db['CmHopper'][_0x4c18('0x34')](_0xbd3236,{'where':{'id':_0x531c5d['id']}},{'transaction':_0x301b7d});});})[_0x4c18('0xa')](function(_0x50b8cd){_0x218ab7({'id':_0x531c5d['id'],'phone':_0x452f61[_0x4c18('0x30')]});})[_0x4c18('0x13')](function(_0x4d7aa4){logger[_0x4c18('0x10')]('activateAdditionalPhone',_0x4d7aa4[_0x4c18('0x12')]);_0x4af347({'error':_0x4d7aa4[_0x4c18('0x12')]});});});}exports[_0x4c18('0x35')]=function(_0x434101){var _0xff9fe5=this;return new Promise(function(_0x5e3a3d,_0x253ad2){return db[_0x4c18('0x29')][_0x4c18('0x34')](_0x434101['body']['field'],{'where':{'id':_0x434101[_0x4c18('0x16')]['id']}})[_0x4c18('0xa')](function(_0x4d60cb){_0x5e3a3d(_0x4d60cb);})['catch'](function(_0x2cc2f){logger[_0x4c18('0x10')](_0x4c18('0x35'),_0x2cc2f['message']);_0x253ad2(_0xff9fe5[_0x4c18('0x10')](0x1f4,_0x2cc2f[_0x4c18('0x12')]));});});}; \ No newline at end of file +var _0xf139=['randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','countagentrejectretry','SwapAdditionalPhones','ContactId','ListId','ASC','waitTime','isNil','scheduledat','add','minutes','countabandonedretry','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird'];(function(_0x5b5513,_0x7f6782){var _0x1839e6=function(_0x2ca590){while(--_0x2ca590){_0x5b5513['push'](_0x5b5513['shift']());}};_0x1839e6(++_0x7f6782);}(_0xf139,0x14d));var _0x9f13=function(_0x12af06,_0x3fbdf3){_0x12af06=_0x12af06-0x0;var _0x4f098f=_0xf139[_0x12af06];return _0x4f098f;};'use strict';var _=require(_0x9f13('0x0'));var util=require(_0x9f13('0x1'));var moment=require('moment');var BPromise=require(_0x9f13('0x2'));var rs=require(_0x9f13('0x3'));var fs=require('fs');var Redis=require(_0x9f13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f13('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9f13('0x6'));var client=jayson[_0x9f13('0x7')][_0x9f13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x726300,_0x6ea50,_0x2c6799){return new BPromise(function(_0xa004ee,_0x26d7a0){return client[_0x9f13('0x9')](_0x726300,_0x2c6799)[_0x9f13('0xa')](function(_0x324825){logger[_0x9f13('0xb')](_0x9f13('0xc'),_0x6ea50,_0x9f13('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x6ea50,_0x9f13('0xd'),JSON[_0x9f13('0xe')](_0x324825));if(_0x324825[_0x9f13('0xf')]){if(_0x324825[_0x9f13('0xf')][_0x9f13('0x10')]===0x1f4){logger[_0x9f13('0xf')](_0x9f13('0xc'),_0x6ea50,_0x324825[_0x9f13('0xf')][_0x9f13('0x11')]);return _0x26d7a0(_0x324825['error'][_0x9f13('0x11')]);}logger[_0x9f13('0xf')](_0x9f13('0xc'),_0x6ea50,_0x324825[_0x9f13('0xf')][_0x9f13('0x11')]);return _0xa004ee(_0x324825['error'][_0x9f13('0x11')]);}else{logger[_0x9f13('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x6ea50,_0x9f13('0xd'));_0xa004ee(_0x324825[_0x9f13('0x12')]['message']);}})[_0x9f13('0x13')](function(_0x342992){logger[_0x9f13('0xf')](_0x9f13('0xc'),_0x6ea50,_0x342992);_0x26d7a0(_0x342992);});});}exports[_0x9f13('0x14')]=function(_0xe5ffe){var _0x3c6a23=this;return new Promise(function(_0xfc5c2f,_0x4f036c){return db[_0x9f13('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0xe5ffe[_0x9f13('0x16')]['ContactId'],'ListId':_0xe5ffe[_0x9f13('0x16')]['ListId'],'VoiceQueueId':_0xe5ffe[_0x9f13('0x16')][_0x9f13('0x17')]===undefined?null:_0xe5ffe[_0x9f13('0x16')][_0x9f13('0x17')],'CampaignId':_0xe5ffe[_0x9f13('0x16')][_0x9f13('0x18')]===undefined?null:_0xe5ffe[_0x9f13('0x16')]['CampaignId']}})[_0x9f13('0xa')](function(_0xd5bf20){if(_0xd5bf20!=null){return db[_0x9f13('0x19')][_0x9f13('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xd5bf20['id'],'OrderBy':{'$gt':_0xd5bf20['OrderBy']}},'order':[[_0x9f13('0x1b'),'ASC']]})[_0x9f13('0xa')](function(_0x30f87a){var _0xab5ede=0x0;if(_0x30f87a){if(_0x30f87a[_0x9f13('0x1c')]+_0x30f87a[_0x9f13('0x1d')]+_0x30f87a[_0x9f13('0x1e')]+_0x30f87a[_0x9f13('0x1f')]+_0x30f87a[_0x9f13('0x20')]+_0x30f87a['countabandonedretry']+_0x30f87a[_0x9f13('0x21')]+_0x30f87a['countagentrejectretry']<_0xe5ffe[_0x9f13('0x22')][_0x9f13('0x23')])_0xab5ede=0x1;_0xfc5c2f({'additional':_0xab5ede});}else{return db[_0x9f13('0x19')][_0x9f13('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xd5bf20['id']},'order':[[_0x9f13('0x1b'),'ASC']]})[_0x9f13('0xa')](function(_0x5ed797){var _0x16006e=0x0;if(_0x5ed797){if(_0x5ed797['countbusyretry']+_0x5ed797[_0x9f13('0x1d')]+_0x5ed797['countnoanswerretry']+_0x5ed797[_0x9f13('0x1f')]+_0x5ed797['countdropretry']+_0x5ed797['countabandonedretry']+_0x5ed797[_0x9f13('0x21')]+_0x5ed797[_0x9f13('0x24')]<_0xe5ffe['entity'][_0x9f13('0x23')])_0x16006e=0x1;_0xfc5c2f({'additional':_0x16006e});}else{_0xfc5c2f({'additional':0x0});}})['catch'](function(_0x5e3dec){logger[_0x9f13('0xf')](_0x9f13('0x14'),_0x5e3dec[_0x9f13('0x11')]);_0x4f036c(_0x3c6a23[_0x9f13('0xf')](0x1f4,_0x5e3dec[_0x9f13('0x11')]));});}})['catch'](function(_0x44affe){logger[_0x9f13('0xf')](_0x9f13('0x14'),_0x44affe[_0x9f13('0x11')]);_0x4f036c(_0x3c6a23[_0x9f13('0xf')](0x1f4,_0x44affe['message']));});}else _0xfc5c2f({'additional':0x0});});});};exports[_0x9f13('0x25')]=function(_0x1cf548){var _0x77c5e9=this;return new Promise(function(_0x2c44e6,_0x2c93df){return db['CmHopper'][_0x9f13('0x1a')]({'raw':!![],'where':{'ContactId':_0x1cf548[_0x9f13('0x16')][_0x9f13('0x26')],'ListId':_0x1cf548[_0x9f13('0x16')][_0x9f13('0x27')],'VoiceQueueId':_0x1cf548[_0x9f13('0x16')][_0x9f13('0x17')]===undefined?null:_0x1cf548[_0x9f13('0x16')][_0x9f13('0x17')],'CampaignId':_0x1cf548['body']['CampaignId']===undefined?null:_0x1cf548[_0x9f13('0x16')][_0x9f13('0x18')]}})[_0x9f13('0xa')](function(_0x230c35){if(_0x230c35!=null){return db[_0x9f13('0x19')][_0x9f13('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x230c35['id'],'OrderBy':{'$gte':_0x230c35['OrderBy']}},'order':[[_0x9f13('0x1b'),_0x9f13('0x28')]]})[_0x9f13('0xa')](function(_0x2cb07c){if(_0x2cb07c)return activateAdditionalPhone(_0x230c35,_0x1cf548[_0x9f13('0x16')],_0x2cb07c,_0x1cf548['duration'],_0x1cf548[_0x9f13('0x29')])[_0x9f13('0xa')](function(_0x3766f1){_0x2c44e6(_0x3766f1);});else{return db[_0x9f13('0x19')][_0x9f13('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x230c35['id']},'order':[[_0x9f13('0x1b'),_0x9f13('0x28')]]})[_0x9f13('0xa')](function(_0x35b4a4){if(_0x35b4a4)return activateAdditionalPhone(_0x230c35,_0x1cf548[_0x9f13('0x16')],_0x35b4a4,_0x1cf548['duration'],_0x1cf548[_0x9f13('0x29')])[_0x9f13('0xa')](function(_0xd49fe6){_0x2c44e6(_0xd49fe6);});else{_0x2c44e6({'id':_0x230c35['id'],'phone':''});}})[_0x9f13('0x13')](function(_0x414ed1){logger[_0x9f13('0xf')](_0x9f13('0x14'),_0x414ed1[_0x9f13('0x11')]);_0x2c93df(_0x77c5e9[_0x9f13('0xf')](0x1f4,_0x414ed1[_0x9f13('0x11')]));});}})[_0x9f13('0x13')](function(_0x457201){logger[_0x9f13('0xf')](_0x9f13('0x14'),_0x457201[_0x9f13('0x11')]);_0x2c93df(_0x77c5e9[_0x9f13('0xf')](0x1f4,_0x457201['message']));});}else _0x2c44e6(0x1);});});};function activateAdditionalPhone(_0x2e46e4,_0x41ff13,_0x1b1b25,_0x4dca8d,_0x38cfcb){return new Promise(function(_0x103333,_0xa44fbf){var _0x9fd534;if(_[_0x9f13('0x2a')](_0x1b1b25[_0x9f13('0x2b')])){_0x1b1b25[_0x9f13('0x2b')]=moment();}if(moment()>moment(_0x1b1b25[_0x9f13('0x2b')])){_0x9fd534=moment()['add'](_0x38cfcb||0x3,'minutes');}else{if(_0x1b1b25[_0x9f13('0x1b')]==0x0){_0x9fd534=moment(_0x1b1b25[_0x9f13('0x2b')]);}else{_0x9fd534=moment()[_0x9f13('0x2c')](_0x38cfcb||0x3,_0x9f13('0x2d'));}}if(_[_0x9f13('0x2a')](_0x9fd534)){_0x9fd534=moment()[_0x9f13('0x2c')](_0x38cfcb||0x3,_0x9f13('0x2d'));}var _0x1d2fad={'phone':_0x2e46e4['phone'],'active':0x0,'OrderBy':_[_0x9f13('0x2a')](_0x2e46e4[_0x9f13('0x1b')])?0x0:_0x2e46e4['OrderBy'],'scheduledat':moment()[_0x9f13('0x2c')](_0x4dca8d||0x1,_0x9f13('0x2d')),'countbusyretry':_0x41ff13['countbusyretry'],'countcongestionretry':_0x41ff13[_0x9f13('0x1d')],'countnoanswerretry':_0x41ff13[_0x9f13('0x1e')],'countnosuchnumberretry':_0x41ff13[_0x9f13('0x1f')],'countdropretry':_0x41ff13[_0x9f13('0x20')],'countabandonedretry':_0x41ff13[_0x9f13('0x2e')],'countmachineretry':_0x41ff13[_0x9f13('0x21')],'countagentrejectretry':_0x41ff13[_0x9f13('0x24')],'createdAt':_0x41ff13[_0x9f13('0x2f')],'updatedAt':_0x41ff13[_0x9f13('0x30')]};var _0x241780={'CmHopperId':_0x2e46e4['id'],'phone':_0x1b1b25[_0x9f13('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x1b1b25[_0x9f13('0x1b')])?0x0:_0x1b1b25[_0x9f13('0x1b')],'scheduledat':_0x9fd534,'countbusyretry':_0x1b1b25[_0x9f13('0x1c')],'countcongestionretry':_0x1b1b25[_0x9f13('0x1d')],'countnoanswerretry':_0x1b1b25[_0x9f13('0x1e')],'countnosuchnumberretry':_0x1b1b25['countnosuchnumberretry'],'countdropretry':_0x1b1b25['countdropretry'],'countabandonedretry':_0x1b1b25[_0x9f13('0x2e')],'countmachineretry':_0x1b1b25[_0x9f13('0x21')],'countagentrejectretry':_0x1b1b25[_0x9f13('0x24')],'createdAt':_0x1b1b25[_0x9f13('0x2f')],'updatedAt':_0x1b1b25['updatedAt']};return db[_0x9f13('0x32')][_0x9f13('0x33')](function(_0x5df110){return db['CmHopperAdditionalPhone']['update'](_0x1d2fad,{'where':{'id':_0x1b1b25['id']}},{'transaction':_0x5df110})[_0x9f13('0xa')](function(){return db['CmHopper'][_0x9f13('0x34')](_0x241780,{'where':{'id':_0x2e46e4['id']}},{'transaction':_0x5df110});});})[_0x9f13('0xa')](function(_0x24d264){_0x103333({'id':_0x2e46e4['id'],'phone':_0x1b1b25['phone']});})[_0x9f13('0x13')](function(_0x5a4713){logger[_0x9f13('0xf')](_0x9f13('0x35'),_0x5a4713['message']);_0xa44fbf({'error':_0x5a4713[_0x9f13('0x11')]});});});}exports[_0x9f13('0x36')]=function(_0x52258a){var _0x22b424=this;return new Promise(function(_0x25359f,_0x4dd406){return db[_0x9f13('0x15')][_0x9f13('0x34')](_0x52258a[_0x9f13('0x16')][_0x9f13('0x37')],{'where':{'id':_0x52258a['body']['id']}})[_0x9f13('0xa')](function(_0x57256c){_0x25359f(_0x57256c);})['catch'](function(_0x573180){logger[_0x9f13('0xf')](_0x9f13('0x36'),_0x573180[_0x9f13('0x11')]);_0x4dd406(_0x22b424[_0x9f13('0xf')](0x1f4,_0x573180[_0x9f13('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b129b4f..ee10396 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 _0xa167=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','./cmHopperAdditionalPhone.controller'];(function(_0x5f4952,_0x1a31f4){var _0x2e54a1=function(_0x1e6f6e){while(--_0x1e6f6e){_0x5f4952['push'](_0x5f4952['shift']());}};_0x2e54a1(++_0x1a31f4);}(_0xa167,0x81));var _0x7a16=function(_0x4635ec,_0x45f234){_0x4635ec=_0x4635ec-0x0;var _0x18bacd=_0xa167[_0x4635ec];return _0x18bacd;};'use strict';var multer=require(_0x7a16('0x0'));var util=require(_0x7a16('0x1'));var path=require(_0x7a16('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a16('0x3'));var router=express[_0x7a16('0x4')]();var fs_extra=require(_0x7a16('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7a16('0x6'));router[_0x7a16('0x7')]('/',auth[_0x7a16('0x8')](),controller[_0x7a16('0x9')]);router[_0x7a16('0x7')](_0x7a16('0xa'),auth['isAuthenticated'](),controller[_0x7a16('0xb')]);router[_0x7a16('0xc')]('/',auth['isAuthenticated'](),controller[_0x7a16('0xd')]);router['put'](_0x7a16('0xa'),auth[_0x7a16('0x8')](),controller[_0x7a16('0xe')]);router['delete'](_0x7a16('0xa'),auth['isAuthenticated'](),controller[_0x7a16('0xf')]);module[_0x7a16('0x10')]=router; \ No newline at end of file +var _0xe266=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','update','delete','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe266,0x174));var _0x6e26=function(_0x11ab31,_0x1d26b8){_0x11ab31=_0x11ab31-0x0;var _0x168d2f=_0xe266[_0x11ab31];return _0x168d2f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6e26('0x0'));var express=require('express');var router=express[_0x6e26('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e26('0x2'));var config=require(_0x6e26('0x3'));var controller=require(_0x6e26('0x4'));router[_0x6e26('0x5')]('/',auth[_0x6e26('0x6')](),controller[_0x6e26('0x7')]);router[_0x6e26('0x5')](_0x6e26('0x8'),auth[_0x6e26('0x6')](),controller['show']);router['post']('/',auth[_0x6e26('0x6')](),controller['create']);router['put'](_0x6e26('0x8'),auth['isAuthenticated'](),controller[_0x6e26('0x9')]);router[_0x6e26('0xa')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e26('0xb')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8614662..dbb9d73 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 _0xb9e3=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb9e3,0xdc));var _0x3b9e=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xb9e3[_0x4c4037];return _0x357862;};'use strict';var moment=require(_0x3b9e('0x0'));var Sequelize=require(_0x3b9e('0x1'));module[_0x3b9e('0x2')]={'phone':{'type':Sequelize[_0x3b9e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3b9e('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3b9e('0x4')],'unique':_0x3b9e('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xf435=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x3fe0ec,_0x5f4f7e){var _0x2bdbfa=function(_0x40d61c){while(--_0x40d61c){_0x3fe0ec['push'](_0x3fe0ec['shift']());}};_0x2bdbfa(++_0x5f4f7e);}(_0xf435,0x174));var _0x5f43=function(_0x242a5c,_0x55cbab){_0x242a5c=_0x242a5c-0x0;var _0x2fc7cf=_0xf435[_0x242a5c];return _0x2fc7cf;};'use strict';var moment=require('moment');var Sequelize=require(_0x5f43('0x0'));module[_0x5f43('0x1')]={'phone':{'type':Sequelize[_0x5f43('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5f43('0x3')],'unique':_0x5f43('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5f43('0x4')},'VoiceQueueId':{'type':Sequelize[_0x5f43('0x3')],'unique':_0x5f43('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3a7c49f..a3b778f 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 _0x9c3b=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','body','destroy'];(function(_0x52b384,_0x3f050e){var _0x487161=function(_0x10a980){while(--_0x10a980){_0x52b384['push'](_0x52b384['shift']());}};_0x487161(++_0x3f050e);}(_0x9c3b,0x1f2));var _0xb9c3=function(_0x290a36,_0x561046){_0x290a36=_0x290a36-0x0;var _0xc59237=_0x9c3b[_0x290a36];return _0xc59237;};'use strict';var emlformat=require(_0xb9c3('0x0'));var rimraf=require(_0xb9c3('0x1'));var zipdir=require(_0xb9c3('0x2'));var jsonpatch=require(_0xb9c3('0x3'));var rp=require(_0xb9c3('0x4'));var moment=require(_0xb9c3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb9c3('0x6'));var path=require(_0xb9c3('0x7'));var sox=require(_0xb9c3('0x8'));var csv=require(_0xb9c3('0x9'));var ejs=require(_0xb9c3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb9c3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9c3('0x9'));var querystring=require(_0xb9c3('0xc'));var Papa=require(_0xb9c3('0xd'));var Redis=require(_0xb9c3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9c3('0xf'));var as=require(_0xb9c3('0x10'));var hardwareService=require(_0xb9c3('0x11'));var logger=require(_0xb9c3('0x12'))(_0xb9c3('0x13'));var utils=require(_0xb9c3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3476,_0x1c7549){_0x1c7549=_0x1c7549||0xcc;return function(_0x315a60){if(_0x315a60){return _0x5c3476[_0xb9c3('0x15')](_0x1c7549);}return _0x5c3476[_0xb9c3('0x16')](_0x1c7549)[_0xb9c3('0x17')]();};}function respondWithResult(_0xf6bd47,_0x3ab367){_0x3ab367=_0x3ab367||0xc8;return function(_0x1d3df5){if(_0x1d3df5){return _0xf6bd47[_0xb9c3('0x16')](_0x3ab367)[_0xb9c3('0x18')](_0x1d3df5);}};}function respondWithFilteredResult(_0x2060f8,_0xa45c64){return function(_0x16e030){if(_0x16e030){var _0x50ae57=typeof _0xa45c64[_0xb9c3('0x19')]===_0xb9c3('0x1a')&&typeof _0xa45c64[_0xb9c3('0x1b')]===_0xb9c3('0x1a');var _0xa22d45=_0x16e030['count'];var _0x117929=_0x50ae57?0x0:_0xa45c64[_0xb9c3('0x19')];var _0x23b493=_0x50ae57?_0x16e030[_0xb9c3('0x1c')]:_0xa45c64[_0xb9c3('0x19')]+_0xa45c64['limit'];var _0x43a79f;if(_0x23b493>=_0xa22d45){_0x23b493=_0xa22d45;_0x43a79f=0xc8;}else{_0x43a79f=0xce;}_0x2060f8[_0xb9c3('0x16')](_0x43a79f);return _0x2060f8[_0xb9c3('0x1d')](_0xb9c3('0x1e'),_0x117929+'-'+_0x23b493+'/'+_0xa22d45)['json'](_0x16e030);}return null;};}function patchUpdates(_0x244a17){return function(_0x4fff68){try{jsonpatch['apply'](_0x4fff68,_0x244a17,!![]);}catch(_0x20b8dc){return BPromise[_0xb9c3('0x1f')](_0x20b8dc);}return _0x4fff68[_0xb9c3('0x20')]();};}function saveUpdates(_0x20935d,_0x532d30){return function(_0x13f309){if(_0x13f309){return _0x13f309[_0xb9c3('0x21')](_0x20935d)[_0xb9c3('0x22')](function(_0x44ac99){return _0x44ac99;});}return null;};}function removeEntity(_0x59b720,_0xd49d47){return function(_0x2ef584){if(_0x2ef584){return _0x2ef584['destroy']()['then'](function(){_0x59b720[_0xb9c3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9eaff,_0x3e22ca){return function(_0x5e9ef4){if(!_0x5e9ef4){_0xa9eaff[_0xb9c3('0x15')](0x194);}return _0x5e9ef4;};}function handleError(_0x5f5ba2,_0x1029c4){_0x1029c4=_0x1029c4||0x1f4;return function(_0x1b68e3){logger[_0xb9c3('0x23')](_0x1b68e3[_0xb9c3('0x24')]);if(_0x1b68e3[_0xb9c3('0x25')]){delete _0x1b68e3[_0xb9c3('0x25')];}_0x5f5ba2['status'](_0x1029c4)[_0xb9c3('0x26')](_0x1b68e3);};}exports[_0xb9c3('0x27')]=function(_0x3c2408,_0x182a6f){var _0x31ece3={},_0x402a20={},_0x311333={'count':0x0,'rows':[]};var _0x96c5c7=_[_0xb9c3('0x28')](db[_0xb9c3('0x29')][_0xb9c3('0x2a')],function(_0x2f719a){return{'name':_0x2f719a['fieldName'],'type':_0x2f719a[_0xb9c3('0x2b')][_0xb9c3('0x2c')]};});_0x402a20[_0xb9c3('0x2d')]=_[_0xb9c3('0x28')](_0x96c5c7,'name');_0x402a20['query']=_[_0xb9c3('0x2e')](_0x3c2408[_0xb9c3('0x2f')]);_0x402a20[_0xb9c3('0x30')]=_[_0xb9c3('0x31')](_0x402a20[_0xb9c3('0x2d')],_0x402a20[_0xb9c3('0x2f')]);_0x31ece3[_0xb9c3('0x32')]=_[_0xb9c3('0x31')](_0x402a20[_0xb9c3('0x2d')],qs[_0xb9c3('0x33')](_0x3c2408[_0xb9c3('0x2f')][_0xb9c3('0x33')]));_0x31ece3[_0xb9c3('0x32')]=_0x31ece3['attributes'][_0xb9c3('0x34')]?_0x31ece3[_0xb9c3('0x32')]:_0x402a20[_0xb9c3('0x2d')];if(!_0x3c2408[_0xb9c3('0x2f')][_0xb9c3('0x35')](_0xb9c3('0x36'))){_0x31ece3[_0xb9c3('0x1b')]=qs[_0xb9c3('0x1b')](_0x3c2408[_0xb9c3('0x2f')][_0xb9c3('0x1b')]);_0x31ece3[_0xb9c3('0x19')]=qs[_0xb9c3('0x19')](_0x3c2408[_0xb9c3('0x2f')]['offset']);}_0x31ece3['order']=qs[_0xb9c3('0x37')](_0x3c2408[_0xb9c3('0x2f')]['sort']);_0x31ece3[_0xb9c3('0x38')]=qs[_0xb9c3('0x30')](_[_0xb9c3('0x39')](_0x3c2408[_0xb9c3('0x2f')],_0x402a20['filters']),_0x96c5c7);if(_0x3c2408[_0xb9c3('0x2f')][_0xb9c3('0x3a')]){_0x31ece3['where']=_[_0xb9c3('0x3b')](_0x31ece3[_0xb9c3('0x38')],{'$or':_['map'](_0x96c5c7,function(_0x2ed214){if(_0x2ed214[_0xb9c3('0x2b')]!==_0xb9c3('0x3c')){var _0x2e407f={};_0x2e407f[_0x2ed214[_0xb9c3('0x25')]]={'$like':'%'+_0x3c2408[_0xb9c3('0x2f')][_0xb9c3('0x3a')]+'%'};return _0x2e407f;}})});}_0x31ece3=_[_0xb9c3('0x3b')]({},_0x31ece3,_0x3c2408[_0xb9c3('0x3d')]);var _0x309367={'where':_0x31ece3[_0xb9c3('0x38')]};return db[_0xb9c3('0x29')][_0xb9c3('0x1c')](_0x309367)['then'](function(_0x112542){_0x311333[_0xb9c3('0x1c')]=_0x112542;if(_0x3c2408[_0xb9c3('0x2f')]['includeAll']){_0x31ece3[_0xb9c3('0x3e')]=[{'all':!![]}];}return db[_0xb9c3('0x29')][_0xb9c3('0x3f')](_0x31ece3);})['then'](function(_0x10065d){_0x311333[_0xb9c3('0x40')]=_0x10065d;return _0x311333;})['then'](respondWithFilteredResult(_0x182a6f,_0x31ece3))[_0xb9c3('0x41')](handleError(_0x182a6f,null));};exports['show']=function(_0x5acfe5,_0x1b8e9d){var _0x11e0ce={'raw':!![],'where':{'id':_0x5acfe5[_0xb9c3('0x42')]['id']}},_0xeec16b={};_0xeec16b[_0xb9c3('0x2d')]=_['keys'](db[_0xb9c3('0x29')][_0xb9c3('0x2a')]);_0xeec16b[_0xb9c3('0x2f')]=_[_0xb9c3('0x2e')](_0x5acfe5[_0xb9c3('0x2f')]);_0xeec16b[_0xb9c3('0x30')]=_[_0xb9c3('0x31')](_0xeec16b[_0xb9c3('0x2d')],_0xeec16b[_0xb9c3('0x2f')]);_0x11e0ce['attributes']=_[_0xb9c3('0x31')](_0xeec16b[_0xb9c3('0x2d')],qs[_0xb9c3('0x33')](_0x5acfe5['query'][_0xb9c3('0x33')]));_0x11e0ce[_0xb9c3('0x32')]=_0x11e0ce['attributes'][_0xb9c3('0x34')]?_0x11e0ce[_0xb9c3('0x32')]:_0xeec16b[_0xb9c3('0x2d')];if(_0x5acfe5['query']['includeAll']){_0x11e0ce['include']=[{'all':!![]}];}_0x11e0ce=_[_0xb9c3('0x3b')]({},_0x11e0ce,_0x5acfe5['options']);return db[_0xb9c3('0x29')][_0xb9c3('0x43')](_0x11e0ce)[_0xb9c3('0x22')](handleEntityNotFound(_0x1b8e9d,null))['then'](respondWithResult(_0x1b8e9d,null))[_0xb9c3('0x41')](handleError(_0x1b8e9d,null));};exports[_0xb9c3('0x21')]=function(_0x30b1d9,_0x506248){if(_0x30b1d9[_0xb9c3('0x44')]['id']){delete _0x30b1d9[_0xb9c3('0x44')]['id'];}return db[_0xb9c3('0x29')][_0xb9c3('0x43')]({'where':{'id':_0x30b1d9['params']['id']}})[_0xb9c3('0x22')](handleEntityNotFound(_0x506248,null))[_0xb9c3('0x22')](saveUpdates(_0x30b1d9[_0xb9c3('0x44')],null))[_0xb9c3('0x22')](respondWithResult(_0x506248,null))[_0xb9c3('0x41')](handleError(_0x506248,null));};exports[_0xb9c3('0x45')]=function(_0x15d81e,_0xa42164){return db[_0xb9c3('0x29')][_0xb9c3('0x43')]({'where':{'id':_0x15d81e['params']['id']}})['then'](handleEntityNotFound(_0xa42164,null))[_0xb9c3('0x22')](removeEntity(_0xa42164,null))[_0xb9c3('0x41')](handleError(_0xa42164,null));};exports[_0xb9c3('0x46')]=function(_0xe82060,_0x4c6a02){return db[_0xb9c3('0x29')][_0xb9c3('0x46')]()['then'](respondWithResult(_0x4c6a02,null))[_0xb9c3('0x41')](handleError(_0x4c6a02,null));}; \ No newline at end of file +var _0x801b=['options','CmHopperBlack','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x26e568,_0x206ab7){var _0x48442c=function(_0x3f9d6e){while(--_0x3f9d6e){_0x26e568['push'](_0x26e568['shift']());}};_0x48442c(++_0x206ab7);}(_0x801b,0xf2));var _0xb801=function(_0x28a4cc,_0x33d8f8){_0x28a4cc=_0x28a4cc-0x0;var _0x12e008=_0x801b[_0x28a4cc];return _0x12e008;};'use strict';var emlformat=require(_0xb801('0x0'));var rimraf=require(_0xb801('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb801('0x2'));var rp=require('request-promise');var moment=require(_0xb801('0x3'));var BPromise=require(_0xb801('0x4'));var Mustache=require(_0xb801('0x5'));var util=require(_0xb801('0x6'));var path=require(_0xb801('0x7'));var sox=require(_0xb801('0x8'));var csv=require(_0xb801('0x9'));var ejs=require(_0xb801('0xa'));var fs=require('fs');var fs_extra=require(_0xb801('0xb'));var _=require(_0xb801('0xc'));var squel=require(_0xb801('0xd'));var crypto=require(_0xb801('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb801('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb801('0x10'));var Papa=require('papaparse');var Redis=require(_0xb801('0x11'));var authService=require(_0xb801('0x12'));var qs=require(_0xb801('0x13'));var as=require(_0xb801('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb801('0x15'))(_0xb801('0x16'));var utils=require(_0xb801('0x17'));var config=require(_0xb801('0x18'));var licenseUtil=require(_0xb801('0x19'));var db=require(_0xb801('0x1a'))['db'];function respondWithStatusCode(_0x2be116,_0xc9d6bb){_0xc9d6bb=_0xc9d6bb||0xcc;return function(_0x35690f){if(_0x35690f){return _0x2be116[_0xb801('0x1b')](_0xc9d6bb);}return _0x2be116['status'](_0xc9d6bb)[_0xb801('0x1c')]();};}function respondWithResult(_0x265cf8,_0x5b9500){_0x5b9500=_0x5b9500||0xc8;return function(_0x27d83e){if(_0x27d83e){return _0x265cf8['status'](_0x5b9500)[_0xb801('0x1d')](_0x27d83e);}};}function respondWithFilteredResult(_0x9c0f08,_0x214873){return function(_0x9932ad){if(_0x9932ad){var _0x47e22b=typeof _0x214873[_0xb801('0x1e')]==='undefined'&&typeof _0x214873[_0xb801('0x1f')]===_0xb801('0x20');var _0x3c67f8=_0x9932ad[_0xb801('0x21')];var _0xeef9b2=_0x47e22b?0x0:_0x214873[_0xb801('0x1e')];var _0x250f76=_0x47e22b?_0x9932ad[_0xb801('0x21')]:_0x214873[_0xb801('0x1e')]+_0x214873[_0xb801('0x1f')];var _0xa10ee6;if(_0x250f76>=_0x3c67f8){_0x250f76=_0x3c67f8;_0xa10ee6=0xc8;}else{_0xa10ee6=0xce;}_0x9c0f08[_0xb801('0x22')](_0xa10ee6);return _0x9c0f08[_0xb801('0x23')]('Content-Range',_0xeef9b2+'-'+_0x250f76+'/'+_0x3c67f8)[_0xb801('0x1d')](_0x9932ad);}return null;};}function patchUpdates(_0x38afd5){return function(_0x3683d3){try{jsonpatch['apply'](_0x3683d3,_0x38afd5,!![]);}catch(_0x176a99){return BPromise[_0xb801('0x24')](_0x176a99);}return _0x3683d3[_0xb801('0x25')]();};}function saveUpdates(_0xe58801,_0x49471a){return function(_0x7b1ea5){if(_0x7b1ea5){return _0x7b1ea5[_0xb801('0x26')](_0xe58801)[_0xb801('0x27')](function(_0x262450){return _0x262450;});}return null;};}function removeEntity(_0x4fa881,_0x1b1c6d){return function(_0x3d54ef){if(_0x3d54ef){return _0x3d54ef[_0xb801('0x28')]()[_0xb801('0x27')](function(){_0x4fa881[_0xb801('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b116,_0x4e8f05){return function(_0x1d9ec1){if(!_0x1d9ec1){_0x25b116[_0xb801('0x1b')](0x194);}return _0x1d9ec1;};}function handleError(_0x35064d,_0x51b825){_0x51b825=_0x51b825||0x1f4;return function(_0x3205c1){logger[_0xb801('0x29')](_0x3205c1['stack']);if(_0x3205c1['name']){delete _0x3205c1[_0xb801('0x2a')];}_0x35064d[_0xb801('0x22')](_0x51b825)[_0xb801('0x2b')](_0x3205c1);};}exports[_0xb801('0x2c')]=function(_0x159e91,_0x3faab0){var _0x5abc46={},_0x3b11ab={},_0x29d41b={'count':0x0,'rows':[]};var _0x3221a6=_[_0xb801('0x2d')](db['CmHopperBlack']['rawAttributes'],function(_0x65fab4){return{'name':_0x65fab4[_0xb801('0x2e')],'type':_0x65fab4[_0xb801('0x2f')][_0xb801('0x30')]};});_0x3b11ab[_0xb801('0x31')]=_[_0xb801('0x2d')](_0x3221a6,_0xb801('0x2a'));_0x3b11ab['query']=_['keys'](_0x159e91[_0xb801('0x32')]);_0x3b11ab[_0xb801('0x33')]=_['intersection'](_0x3b11ab[_0xb801('0x31')],_0x3b11ab[_0xb801('0x32')]);_0x5abc46[_0xb801('0x34')]=_['intersection'](_0x3b11ab[_0xb801('0x31')],qs[_0xb801('0x35')](_0x159e91[_0xb801('0x32')][_0xb801('0x35')]));_0x5abc46[_0xb801('0x34')]=_0x5abc46[_0xb801('0x34')][_0xb801('0x36')]?_0x5abc46[_0xb801('0x34')]:_0x3b11ab[_0xb801('0x31')];if(!_0x159e91[_0xb801('0x32')][_0xb801('0x37')]('nolimit')){_0x5abc46[_0xb801('0x1f')]=qs['limit'](_0x159e91[_0xb801('0x32')]['limit']);_0x5abc46['offset']=qs[_0xb801('0x1e')](_0x159e91[_0xb801('0x32')][_0xb801('0x1e')]);}_0x5abc46[_0xb801('0x38')]=qs[_0xb801('0x39')](_0x159e91[_0xb801('0x32')][_0xb801('0x39')]);_0x5abc46[_0xb801('0x3a')]=qs[_0xb801('0x33')](_[_0xb801('0x3b')](_0x159e91['query'],_0x3b11ab[_0xb801('0x33')]),_0x3221a6);if(_0x159e91['query']['filter']){_0x5abc46[_0xb801('0x3a')]=_['merge'](_0x5abc46[_0xb801('0x3a')],{'$or':_['map'](_0x3221a6,function(_0x4c4f31){if(_0x4c4f31[_0xb801('0x2f')]!=='VIRTUAL'){var _0x4f7696={};_0x4f7696[_0x4c4f31[_0xb801('0x2a')]]={'$like':'%'+_0x159e91[_0xb801('0x32')][_0xb801('0x3c')]+'%'};return _0x4f7696;}})});}_0x5abc46=_[_0xb801('0x3d')]({},_0x5abc46,_0x159e91[_0xb801('0x3e')]);var _0x3e8f69={'where':_0x5abc46['where']};return db[_0xb801('0x3f')][_0xb801('0x21')](_0x3e8f69)[_0xb801('0x27')](function(_0x277554){_0x29d41b[_0xb801('0x21')]=_0x277554;if(_0x159e91[_0xb801('0x32')]['includeAll']){_0x5abc46[_0xb801('0x40')]=[{'all':!![]}];}return db[_0xb801('0x3f')][_0xb801('0x41')](_0x5abc46);})[_0xb801('0x27')](function(_0x361ea0){_0x29d41b[_0xb801('0x42')]=_0x361ea0;return _0x29d41b;})['then'](respondWithFilteredResult(_0x3faab0,_0x5abc46))[_0xb801('0x43')](handleError(_0x3faab0,null));};exports[_0xb801('0x44')]=function(_0x141982,_0x3001db){var _0x511837={'raw':!![],'where':{'id':_0x141982[_0xb801('0x45')]['id']}},_0x196f5a={};_0x196f5a[_0xb801('0x31')]=_[_0xb801('0x46')](db['CmHopperBlack']['rawAttributes']);_0x196f5a[_0xb801('0x32')]=_['keys'](_0x141982[_0xb801('0x32')]);_0x196f5a[_0xb801('0x33')]=_[_0xb801('0x47')](_0x196f5a[_0xb801('0x31')],_0x196f5a[_0xb801('0x32')]);_0x511837[_0xb801('0x34')]=_[_0xb801('0x47')](_0x196f5a[_0xb801('0x31')],qs[_0xb801('0x35')](_0x141982[_0xb801('0x32')]['fields']));_0x511837[_0xb801('0x34')]=_0x511837[_0xb801('0x34')][_0xb801('0x36')]?_0x511837['attributes']:_0x196f5a[_0xb801('0x31')];if(_0x141982[_0xb801('0x32')][_0xb801('0x48')]){_0x511837[_0xb801('0x40')]=[{'all':!![]}];}_0x511837=_['merge']({},_0x511837,_0x141982[_0xb801('0x3e')]);return db[_0xb801('0x3f')][_0xb801('0x49')](_0x511837)[_0xb801('0x27')](handleEntityNotFound(_0x3001db,null))[_0xb801('0x27')](respondWithResult(_0x3001db,null))[_0xb801('0x43')](handleError(_0x3001db,null));};exports[_0xb801('0x26')]=function(_0x1b7139,_0x455b97){if(_0x1b7139[_0xb801('0x4a')]['id']){delete _0x1b7139[_0xb801('0x4a')]['id'];}return db[_0xb801('0x3f')]['find']({'where':{'id':_0x1b7139[_0xb801('0x45')]['id']}})['then'](handleEntityNotFound(_0x455b97,null))['then'](saveUpdates(_0x1b7139[_0xb801('0x4a')],null))[_0xb801('0x27')](respondWithResult(_0x455b97,null))[_0xb801('0x43')](handleError(_0x455b97,null));};exports[_0xb801('0x28')]=function(_0x56fbc0,_0x18802c){return db[_0xb801('0x3f')][_0xb801('0x49')]({'where':{'id':_0x56fbc0[_0xb801('0x45')]['id']}})['then'](handleEntityNotFound(_0x18802c,null))[_0xb801('0x27')](removeEntity(_0x18802c,null))[_0xb801('0x43')](handleError(_0x18802c,null));};exports[_0xb801('0x4b')]=function(_0x1c304b,_0xcc9c97){return db['CmHopperBlack']['describe']()[_0xb801('0x27')](respondWithResult(_0xcc9c97,null))['catch'](handleError(_0xcc9c97,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7500e54..7beb99b 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 _0xa024=['cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack'];(function(_0x13530b,_0x28acd6){var _0x4bc8d2=function(_0x25ccec){while(--_0x25ccec){_0x13530b['push'](_0x13530b['shift']());}};_0x4bc8d2(++_0x28acd6);}(_0xa024,0xaa));var _0x4a02=function(_0x280783,_0x5bfc27){_0x280783=_0x280783-0x0;var _0x823de9=_0xa024[_0x280783];return _0x823de9;};'use strict';var _=require(_0x4a02('0x0'));var util=require('util');var logger=require(_0x4a02('0x1'))(_0x4a02('0x2'));var moment=require(_0x4a02('0x3'));var BPromise=require(_0x4a02('0x4'));var rp=require(_0x4a02('0x5'));var fs=require('fs');var path=require(_0x4a02('0x6'));var rimraf=require(_0x4a02('0x7'));var config=require(_0x4a02('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x4a02('0x9')]=function(_0x48ef6b,_0x157396){return _0x48ef6b[_0x4a02('0xa')](_0x4a02('0xb'),attributes,{'tableName':_0x4a02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65dd=['api','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util','../../config/logger'];(function(_0x1a3edb,_0x111b22){var _0x595525=function(_0x43d5f4){while(--_0x43d5f4){_0x1a3edb['push'](_0x1a3edb['shift']());}};_0x595525(++_0x111b22);}(_0x65dd,0xc4));var _0xd65d=function(_0x2e2185,_0x42e524){_0x2e2185=_0x2e2185-0x0;var _0x1164e1=_0x65dd[_0x2e2185];return _0x1164e1;};'use strict';var _=require('lodash');var util=require(_0xd65d('0x0'));var logger=require(_0xd65d('0x1'))(_0xd65d('0x2'));var moment=require('moment');var BPromise=require(_0xd65d('0x3'));var rp=require(_0xd65d('0x4'));var fs=require('fs');var path=require(_0xd65d('0x5'));var rimraf=require('rimraf');var config=require(_0xd65d('0x6'));var attributes=require(_0xd65d('0x7'));module[_0xd65d('0x8')]=function(_0x5e53cd,_0x1afc43){return _0x5e53cd['define'](_0xd65d('0x9'),attributes,{'tableName':_0xd65d('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 569dadf..7c9c1aa 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 _0xbfe5=['CmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','map','include','model','UpdateCmHopperBlack','update','limit','DestroyCmHopperBlack'];(function(_0x28e127,_0x2f0cf2){var _0x49423c=function(_0x3d44dd){while(--_0x3d44dd){_0x28e127['push'](_0x28e127['shift']());}};_0x49423c(++_0x2f0cf2);}(_0xbfe5,0xca));var _0x5bfe=function(_0x2be30a,_0x11fd33){_0x2be30a=_0x2be30a-0x0;var _0xb0cad0=_0xbfe5[_0x2be30a];return _0xb0cad0;};'use strict';var _=require(_0x5bfe('0x0'));var util=require(_0x5bfe('0x1'));var moment=require(_0x5bfe('0x2'));var BPromise=require(_0x5bfe('0x3'));var rs=require(_0x5bfe('0x4'));var fs=require('fs');var Redis=require(_0x5bfe('0x5'));var db=require(_0x5bfe('0x6'))['db'];var utils=require(_0x5bfe('0x7'));var logger=require(_0x5bfe('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bfe('0x9'));var client=jayson[_0x5bfe('0xa')][_0x5bfe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e8e64,_0x111e0f,_0x22bc0e){return new BPromise(function(_0x13f19c,_0x1c6666){return client[_0x5bfe('0xc')](_0x1e8e64,_0x22bc0e)[_0x5bfe('0xd')](function(_0x138ad3){logger[_0x5bfe('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x111e0f,'request\x20sent');logger[_0x5bfe('0xf')](_0x5bfe('0x10'),_0x111e0f,_0x5bfe('0x11'),JSON[_0x5bfe('0x12')](_0x138ad3));if(_0x138ad3[_0x5bfe('0x13')]){if(_0x138ad3[_0x5bfe('0x13')][_0x5bfe('0x14')]===0x1f4){logger[_0x5bfe('0x13')](_0x5bfe('0x15'),_0x111e0f,_0x138ad3[_0x5bfe('0x13')][_0x5bfe('0x16')]);return _0x1c6666(_0x138ad3[_0x5bfe('0x13')][_0x5bfe('0x16')]);}logger[_0x5bfe('0x13')](_0x5bfe('0x15'),_0x111e0f,_0x138ad3[_0x5bfe('0x13')][_0x5bfe('0x16')]);return _0x13f19c(_0x138ad3[_0x5bfe('0x13')][_0x5bfe('0x16')]);}else{logger[_0x5bfe('0xe')](_0x5bfe('0x15'),_0x111e0f,_0x5bfe('0x11'));_0x13f19c(_0x138ad3[_0x5bfe('0x17')][_0x5bfe('0x16')]);}})[_0x5bfe('0x18')](function(_0x49cb5e){logger[_0x5bfe('0x13')](_0x5bfe('0x15'),_0x111e0f,_0x49cb5e);_0x1c6666(_0x49cb5e);});});}exports[_0x5bfe('0x19')]=function(_0x6df2ef){var _0x389182=this;return new Promise(function(_0x105422,_0x398e4a){return db['CmHopperBlack'][_0x5bfe('0x1a')]({'raw':_0x6df2ef[_0x5bfe('0x1b')]?_0x6df2ef[_0x5bfe('0x1b')][_0x5bfe('0x1c')]===undefined?!![]:![]:!![],'where':_0x6df2ef[_0x5bfe('0x1b')]?_0x6df2ef[_0x5bfe('0x1b')][_0x5bfe('0x1d')]||null:null,'attributes':_0x6df2ef[_0x5bfe('0x1b')]?_0x6df2ef[_0x5bfe('0x1b')][_0x5bfe('0x1e')]||null:null,'limit':_0x6df2ef[_0x5bfe('0x1b')]?_0x6df2ef[_0x5bfe('0x1b')]['limit']||null:null,'include':_0x6df2ef[_0x5bfe('0x1b')]?_0x6df2ef[_0x5bfe('0x1b')]['include']?_[_0x5bfe('0x1f')](_0x6df2ef[_0x5bfe('0x1b')][_0x5bfe('0x20')],function(_0x2a6c77){return{'model':db[_0x2a6c77[_0x5bfe('0x21')]],'as':_0x2a6c77['as'],'attributes':_0x2a6c77[_0x5bfe('0x1e')],'include':_0x2a6c77[_0x5bfe('0x20')]?_[_0x5bfe('0x1f')](_0x2a6c77['include'],function(_0x384aab){return{'model':db[_0x384aab[_0x5bfe('0x21')]],'as':_0x384aab['as'],'attributes':_0x384aab[_0x5bfe('0x1e')],'include':_0x384aab['include']?_['map'](_0x384aab[_0x5bfe('0x20')],function(_0x1d0c65){return{'model':db[_0x1d0c65['model']],'as':_0x1d0c65['as'],'attributes':_0x1d0c65[_0x5bfe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5bfe('0xd')](function(_0x174be5){logger[_0x5bfe('0xe')](_0x5bfe('0x19'),_0x6df2ef);logger[_0x5bfe('0xf')]('GetCmHopperBlack',_0x6df2ef,JSON['stringify'](_0x174be5));_0x105422(_0x174be5);})['catch'](function(_0x178c9e){logger['error'](_0x5bfe('0x19'),_0x178c9e['message'],_0x6df2ef);_0x398e4a(_0x389182['error'](0x1f4,_0x178c9e['message']));});});};exports[_0x5bfe('0x22')]=function(_0x4f59a5){var _0x99a45=this;return new Promise(function(_0x5ca034,_0x55b004){return db['CmHopperBlack'][_0x5bfe('0x23')](_0x4f59a5['body'],{'raw':_0x4f59a5[_0x5bfe('0x1b')]?_0x4f59a5['options'][_0x5bfe('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f59a5['options']?_0x4f59a5[_0x5bfe('0x1b')][_0x5bfe('0x1d')]||null:null,'attributes':_0x4f59a5['options']?_0x4f59a5['options'][_0x5bfe('0x1e')]||null:null,'limit':_0x4f59a5[_0x5bfe('0x1b')]?_0x4f59a5[_0x5bfe('0x1b')][_0x5bfe('0x24')]||null:null})[_0x5bfe('0xd')](function(_0x4da987){logger[_0x5bfe('0xe')](_0x5bfe('0x22'),_0x4f59a5);logger[_0x5bfe('0xf')]('UpdateCmHopperBlack',_0x4f59a5,JSON[_0x5bfe('0x12')](_0x4da987));_0x5ca034(_0x4da987);})['catch'](function(_0x2608f6){logger[_0x5bfe('0x13')](_0x5bfe('0x22'),_0x2608f6[_0x5bfe('0x16')],_0x4f59a5);_0x55b004(_0x99a45[_0x5bfe('0x13')](0x1f4,_0x2608f6[_0x5bfe('0x16')]));});});};exports[_0x5bfe('0x25')]=function(_0x5527b9){var _0x190a46=this;return new Promise(function(_0x483aa,_0x161e1f){return db[_0x5bfe('0x26')][_0x5bfe('0x27')]({'where':_0x5527b9[_0x5bfe('0x1b')]?_0x5527b9['options'][_0x5bfe('0x1d')]||null:null})['then'](function(_0xe41a46){logger[_0x5bfe('0xe')]('DestroyCmHopperBlack',_0x5527b9);logger[_0x5bfe('0xf')](_0x5bfe('0x25'),_0x5527b9,JSON[_0x5bfe('0x12')](_0xe41a46));_0x483aa(_0xe41a46);})['catch'](function(_0x36b5d0){logger['error'](_0x5bfe('0x25'),_0x36b5d0['message'],_0x5527b9);_0x161e1f(_0x190a46[_0x5bfe('0x13')](0x1f4,_0x36b5d0[_0x5bfe('0x16')]));});});}; \ No newline at end of file +var _0x447e=['destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','map','model','include','UpdateCmHopperBlack','update','body','raw','limit','DestroyCmHopperBlack'];(function(_0x25e19b,_0x5135cf){var _0x1055cf=function(_0x3ab6f1){while(--_0x3ab6f1){_0x25e19b['push'](_0x25e19b['shift']());}};_0x1055cf(++_0x5135cf);}(_0x447e,0x1ef));var _0xe447=function(_0x3ef50d,_0x4bb288){_0x3ef50d=_0x3ef50d-0x0;var _0x5b5425=_0x447e[_0x3ef50d];return _0x5b5425;};'use strict';var _=require(_0xe447('0x0'));var util=require(_0xe447('0x1'));var moment=require(_0xe447('0x2'));var BPromise=require(_0xe447('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe447('0x4'));var db=require(_0xe447('0x5'))['db'];var utils=require(_0xe447('0x6'));var logger=require('../../config/logger')(_0xe447('0x7'));var config=require(_0xe447('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe447('0x9')][_0xe447('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x496c1a,_0x94cb9d,_0x46f5b0){return new BPromise(function(_0x540b5d,_0x2491a7){return client['request'](_0x496c1a,_0x46f5b0)[_0xe447('0xb')](function(_0x4ed19f){logger['info'](_0xe447('0xc'),_0x94cb9d,'request\x20sent');logger[_0xe447('0xd')](_0xe447('0xe'),_0x94cb9d,'request\x20sent',JSON[_0xe447('0xf')](_0x4ed19f));if(_0x4ed19f[_0xe447('0x10')]){if(_0x4ed19f[_0xe447('0x10')][_0xe447('0x11')]===0x1f4){logger['error'](_0xe447('0xc'),_0x94cb9d,_0x4ed19f[_0xe447('0x10')]['message']);return _0x2491a7(_0x4ed19f[_0xe447('0x10')][_0xe447('0x12')]);}logger['error'](_0xe447('0xc'),_0x94cb9d,_0x4ed19f[_0xe447('0x10')][_0xe447('0x12')]);return _0x540b5d(_0x4ed19f['error']['message']);}else{logger[_0xe447('0x13')](_0xe447('0xc'),_0x94cb9d,_0xe447('0x14'));_0x540b5d(_0x4ed19f[_0xe447('0x15')]['message']);}})[_0xe447('0x16')](function(_0x3e495e){logger[_0xe447('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x94cb9d,_0x3e495e);_0x2491a7(_0x3e495e);});});}exports[_0xe447('0x17')]=function(_0x42c0fb){var _0x2ccc4c=this;return new Promise(function(_0x4c269b,_0x59f34d){return db[_0xe447('0x18')]['findAll']({'raw':_0x42c0fb[_0xe447('0x19')]?_0x42c0fb[_0xe447('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x42c0fb[_0xe447('0x19')]?_0x42c0fb['options'][_0xe447('0x1a')]||null:null,'attributes':_0x42c0fb['options']?_0x42c0fb[_0xe447('0x19')][_0xe447('0x1b')]||null:null,'limit':_0x42c0fb[_0xe447('0x19')]?_0x42c0fb[_0xe447('0x19')]['limit']||null:null,'include':_0x42c0fb['options']?_0x42c0fb[_0xe447('0x19')]['include']?_[_0xe447('0x1c')](_0x42c0fb[_0xe447('0x19')]['include'],function(_0x2934f9){return{'model':db[_0x2934f9[_0xe447('0x1d')]],'as':_0x2934f9['as'],'attributes':_0x2934f9['attributes'],'include':_0x2934f9['include']?_['map'](_0x2934f9[_0xe447('0x1e')],function(_0x4d3933){return{'model':db[_0x4d3933[_0xe447('0x1d')]],'as':_0x4d3933['as'],'attributes':_0x4d3933[_0xe447('0x1b')],'include':_0x4d3933['include']?_[_0xe447('0x1c')](_0x4d3933[_0xe447('0x1e')],function(_0x38b179){return{'model':db[_0x38b179[_0xe447('0x1d')]],'as':_0x38b179['as'],'attributes':_0x38b179['attributes']};}):[]};}):[]};}):[]:[]})[_0xe447('0xb')](function(_0x1efe29){logger[_0xe447('0x13')](_0xe447('0x17'),_0x42c0fb);logger[_0xe447('0xd')](_0xe447('0x17'),_0x42c0fb,JSON[_0xe447('0xf')](_0x1efe29));_0x4c269b(_0x1efe29);})[_0xe447('0x16')](function(_0x39debe){logger['error'](_0xe447('0x17'),_0x39debe[_0xe447('0x12')],_0x42c0fb);_0x59f34d(_0x2ccc4c[_0xe447('0x10')](0x1f4,_0x39debe[_0xe447('0x12')]));});});};exports[_0xe447('0x1f')]=function(_0x18c91e){var _0x3fe465=this;return new Promise(function(_0x2aa356,_0x4e8391){return db['CmHopperBlack'][_0xe447('0x20')](_0x18c91e[_0xe447('0x21')],{'raw':_0x18c91e['options']?_0x18c91e[_0xe447('0x19')][_0xe447('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18c91e[_0xe447('0x19')]?_0x18c91e[_0xe447('0x19')]['where']||null:null,'attributes':_0x18c91e[_0xe447('0x19')]?_0x18c91e['options'][_0xe447('0x1b')]||null:null,'limit':_0x18c91e[_0xe447('0x19')]?_0x18c91e['options'][_0xe447('0x23')]||null:null})[_0xe447('0xb')](function(_0x27f267){logger[_0xe447('0x13')](_0xe447('0x1f'),_0x18c91e);logger['debug'](_0xe447('0x1f'),_0x18c91e,JSON[_0xe447('0xf')](_0x27f267));_0x2aa356(_0x27f267);})[_0xe447('0x16')](function(_0x1bd7ef){logger['error'](_0xe447('0x1f'),_0x1bd7ef[_0xe447('0x12')],_0x18c91e);_0x4e8391(_0x3fe465[_0xe447('0x10')](0x1f4,_0x1bd7ef[_0xe447('0x12')]));});});};exports[_0xe447('0x24')]=function(_0x4c1742){var _0x32220d=this;return new Promise(function(_0x18946c,_0x2e4687){return db[_0xe447('0x18')][_0xe447('0x25')]({'where':_0x4c1742[_0xe447('0x19')]?_0x4c1742[_0xe447('0x19')][_0xe447('0x1a')]||null:null})['then'](function(_0x527817){logger[_0xe447('0x13')](_0xe447('0x24'),_0x4c1742);logger[_0xe447('0xd')](_0xe447('0x24'),_0x4c1742,JSON[_0xe447('0xf')](_0x527817));_0x18946c(_0x527817);})['catch'](function(_0x5ab881){logger[_0xe447('0x10')](_0xe447('0x24'),_0x5ab881[_0xe447('0x12')],_0x4c1742);_0x2e4687(_0x32220d['error'](0x1f4,_0x5ab881[_0xe447('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c42ae68..d3fa250 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 _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x44a5ee,_0x59881b){var _0xad99e5=function(_0x3f4f5b){while(--_0x3f4f5b){_0x44a5ee['push'](_0x44a5ee['shift']());}};_0xad99e5(++_0x59881b);}(_0xba34,0x119));var _0x4ba3=function(_0xf5ac6,_0x36f0bb){_0xf5ac6=_0xf5ac6-0x0;var _0x21a036=_0xba34[_0xf5ac6];return _0x21a036;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','show','put','/:id','delete','destroy','exports','multer','express'];(function(_0x2033c3,_0x31808e){var _0x3c0dd4=function(_0x1ad585){while(--_0x1ad585){_0x2033c3['push'](_0x2033c3['shift']());}};_0x3c0dd4(++_0x31808e);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x522453,_0x3f05a3){_0x522453=_0x522453-0x0;var _0x1f9be5=_0x0a6b[_0x522453];return _0x1f9be5;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0xc'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ae796e9..7409dee 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 _0x87bd=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','diff','seconds','BOOLEAN'];(function(_0x73b23c,_0x34188d){var _0x2d16dc=function(_0x32a152){while(--_0x32a152){_0x73b23c['push'](_0x73b23c['shift']());}};_0x2d16dc(++_0x34188d);}(_0x87bd,0x17c));var _0xd87b=function(_0x399822,_0x3667ef){_0x399822=_0x399822-0x0;var _0x943381=_0x87bd[_0x399822];return _0x943381;};'use strict';var Sequelize=require(_0xd87b('0x0'));var moment=require(_0xd87b('0x1'));module[_0xd87b('0x2')]={'state':{'type':Sequelize[_0xd87b('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd87b('0x4')]},'scheduledat':{'type':Sequelize[_0xd87b('0x5')]},'countbusyretry':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd87b('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd87b('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd87b('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd87b('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd87b('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd87b('0x4')]},'campaigntype':{'type':Sequelize[_0xd87b('0x4')]},'membername':{'type':Sequelize[_0xd87b('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd87b('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd87b('0x4')]},'dispositionat':{'type':Sequelize[_0xd87b('0x5')],'set':function(_0x13ca90){var _0x458737=this[_0xd87b('0x6')]('endtime');if(_0x458737&&_0x13ca90){this['setDataValue']('followuptime',moment(_0x13ca90)[_0xd87b('0x7')](moment(_0x458737),_0xd87b('0x8')));}}},'amd':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd87b('0x5')]},'callback':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xd87b('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd87b('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd87b('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x876d=['diff','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime'];(function(_0x26c813,_0x2ed444){var _0x10797a=function(_0x1a6d37){while(--_0x1a6d37){_0x26c813['push'](_0x26c813['shift']());}};_0x10797a(++_0x2ed444);}(_0x876d,0xaa));var _0xd876=function(_0x4f68ec,_0x81eb25){_0x4f68ec=_0x4f68ec-0x0;var _0x59d50b=_0x876d[_0x4f68ec];return _0x59d50b;};'use strict';var Sequelize=require(_0xd876('0x0'));var moment=require(_0xd876('0x1'));module[_0xd876('0x2')]={'state':{'type':Sequelize[_0xd876('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd876('0x4')]},'countbusyretry':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd876('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xd876('0x5')]},'originatecalleridname':{'type':Sequelize[_0xd876('0x5')]},'calleridnum':{'type':Sequelize[_0xd876('0x5')]},'calleridname':{'type':Sequelize[_0xd876('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd876('0x4')]},'answertime':{'type':Sequelize[_0xd876('0x4')]},'droptime':{'type':Sequelize[_0xd876('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd876('0x5')]},'campaign':{'type':Sequelize[_0xd876('0x5')]},'campaigntype':{'type':Sequelize[_0xd876('0x5')]},'membername':{'type':Sequelize[_0xd876('0x5')]},'reason':{'type':Sequelize[_0xd876('0x5')]},'disposition':{'type':Sequelize[_0xd876('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd876('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x41e8a0){var _0x255a6e=this[_0xd876('0x6')](_0xd876('0x7'));if(_0x255a6e&&_0x41e8a0){this[_0xd876('0x8')](_0xd876('0x9'),moment(_0x41e8a0)[_0xd876('0xa')](moment(_0x255a6e),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd876('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd876('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd876('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd876('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd876('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd876('0x4')]},'deleted':{'type':Sequelize[_0xd876('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd876('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd876('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd876('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd876('0x3')],'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 e7b821e..ecb2106 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 _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x2b608e,_0x2b9d76){var _0x2aca67=function(_0x1a6ac5){while(--_0x1a6ac5){_0x2b608e['push'](_0x2b608e['shift']());}};_0x2aca67(++_0x2b9d76);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file +var _0xba34=['insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','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','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xba34,0x119));var _0x4ba3=function(_0x56c904,_0x317114){_0x56c904=_0x56c904-0x0;var _0x166420=_0xba34[_0x56c904];return _0x166420;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['describe']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['describe']()[_0x4ba3('0x26')](respondWithResult(_0x1fe115,null))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports[_0x4ba3('0x25')]=function(_0x58648d,_0x47f588){if(_0x58648d[_0x4ba3('0x49')]['uniqueid']){delete _0x58648d[_0x4ba3('0x49')][_0x4ba3('0x4a')];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'uniqueid':_0x58648d[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x47f588,null))['then'](saveUpdates(_0x58648d[_0x4ba3('0x49')],null))[_0x4ba3('0x26')](respondWithResult(_0x47f588,null))['catch'](handleError(_0x47f588,null));};exports[_0x4ba3('0x4c')]=function(_0x12ae6f,_0x156c2d,_0x19d6a3){return db[_0x4ba3('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x12ae6f[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),_0x4ba3('0x53')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4ba3('0x54')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5a')))),_0x4ba3('0x5b')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x156c2d,null))[_0x4ba3('0x26')](respondWithResult(_0x156c2d,null))[_0x4ba3('0x46')](handleError(_0x156c2d,null));};exports[_0x4ba3('0x5d')]=function(_0xf0fd32,_0x4b5289,_0x3d9a7e){return db[_0x4ba3('0x2d')][_0x4ba3('0x44')]({'raw':![],'where':{'CampaignId':_0xf0fd32[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),'noAnswerContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x5e')))),'busyContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5f')))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4ba3('0x5b')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x4b5289,null))['then'](respondWithResult(_0x4b5289,null))[_0x4ba3('0x46')](handleError(_0x4b5289,null));};exports[_0x4ba3('0x60')]=function(_0x5dce8f,_0x37fedb,_0x2ed729){return db[_0x4ba3('0x61')][_0x4ba3('0x48')]({'where':{'id':_0x5dce8f[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x37fedb,null))[_0x4ba3('0x26')](function(_0x329874){var _0x360127;if(_0x329874){_0x360127=squel['insert']()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),_0x4ba3('0x66'),_0x4ba3('0x67'),_0x4ba3('0x68'),_0x4ba3('0x69'),_0x4ba3('0x6a'),_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')]('ANY_VALUE(calleridnum)',_0x4ba3('0x65'))[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')]('ANY_VALUE(ContactId)','ContactId')[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x6f'),_0x4ba3('0x69'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')]('state\x20=\x20?',_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x75')][_0x4ba3('0x74')]())['where'](_0x4ba3('0x76'))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')]('cm_hopper')['where'](_0x4ba3('0x73'),_0x5dce8f['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field']('calleridnum')[_0x4ba3('0x71')](_0x4ba3('0x72'))['where'](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')](_0x4ba3('0x67')))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x360127);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x37fedb,null))['catch'](handleError(_0x37fedb,null));};exports[_0x4ba3('0x7a')]=function(_0x13dbc4,_0x4e334c,_0x39d1d3){return db[_0x4ba3('0x7b')]['find']({'where':{'id':_0x13dbc4['params']['id']}})['then'](handleEntityNotFound(_0x4e334c,null))['then'](function(_0x206e93){var _0x2d57a7;if(_0x206e93){_0x2d57a7=squel[_0x4ba3('0x7c')]()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),'scheduledAt',_0x4ba3('0x67'),'ListId',_0x4ba3('0x7d'),'createdAt',_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x7e'),_0x4ba3('0x65'))['field']('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')](_0x4ba3('0x7f'),_0x4ba3('0x67'))[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x80'),_0x4ba3('0x7d'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x81'),_0x13dbc4['body']['state'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x76'))['where'](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')](_0x4ba3('0x63'))['where'](_0x4ba3('0x82'),_0x13dbc4['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field'](_0x4ba3('0x83'))[_0x4ba3('0x71')]('cm_hopper_final')[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')]('ContactId'))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x2d57a7);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x4e334c,null))['catch'](handleError(_0x4e334c,null));};exports[_0x4ba3('0x84')]=function(_0x38a7a8,_0x5553eb,_0x402ab1){return db[_0x4ba3('0x85')][_0x4ba3('0x86')]({'where':{'VoiceQueueId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x69')],'CampaignId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x7d')],'ContactId':_0x38a7a8[_0x4ba3('0x49')]['ContactId']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5553eb,null))[_0x4ba3('0x26')](function(_0xfb16a6){if(_0xfb16a6){return _0xfb16a6;}return null;})[_0x4ba3('0x26')](respondWithResult(_0x5553eb,null))[_0x4ba3('0x46')](handleError(_0x5553eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6048e90..82c9918 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 _0xd41b=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0xd41b,0x1ec));var _0xbd41=function(_0x3239fd,_0x4ccbce){_0x3239fd=_0x3239fd-0x0;var _0x2844cc=_0xd41b[_0x3239fd];return _0x2844cc;};'use strict';var _=require(_0xbd41('0x0'));var util=require(_0xbd41('0x1'));var logger=require('../../config/logger')(_0xbd41('0x2'));var moment=require(_0xbd41('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd41('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd41('0x5'));var config=require(_0xbd41('0x6'));var attributes=require(_0xbd41('0x7'));module['exports']=function(_0x3c96d4,_0xd09496){return _0x3c96d4[_0xbd41('0x8')](_0xbd41('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xbd41('0xa'),'fields':[_0xbd41('0xa')]},{'name':_0xbd41('0xb'),'fields':[_0xbd41('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6829=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6829,0xd0));var _0x9682=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x6829[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0x9682('0x0'));var logger=require('../../config/logger')(_0x9682('0x1'));var moment=require('moment');var BPromise=require(_0x9682('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9682('0x3'));var rimraf=require(_0x9682('0x4'));var config=require(_0x9682('0x5'));var attributes=require(_0x9682('0x6'));module[_0x9682('0x7')]=function(_0x2a4b74,_0x357c53){return _0x2a4b74['define'](_0x9682('0x8'),attributes,{'tableName':_0x9682('0x9'),'paranoid':![],'indexes':[{'name':_0x9682('0xa'),'fields':['calleridnum']},{'name':_0x9682('0xb'),'fields':[_0x9682('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e536c25..d931838 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2f420b,_0x520cb2){var _0x4e12b9=function(_0x365618){while(--_0x365618){_0x2f420b['push'](_0x2f420b['shift']());}};_0x4e12b9(++_0x520cb2);}(_0xb10b,0x12a));var _0xbb10=function(_0xd63b06,_0x34850f){_0xd63b06=_0xd63b06-0x0;var _0x343035=_0xb10b[_0xd63b06];return _0x343035;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x8fe304,_0x400d67){var _0x58e144=function(_0x56d3db){while(--_0x56d3db){_0x8fe304['push'](_0x8fe304['shift']());}};_0x58e144(++_0x400d67);}(_0x7a54,0x106));var _0x47a5=function(_0x390bd3,_0x4cdbb9){_0x390bd3=_0x390bd3-0x0;var _0x2c8c7a=_0x7a54[_0x390bd3];return _0x2c8c7a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 8b2c000..4aed4d5 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 _0x5d36=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','/describe','isAuthenticated','describe','/:id','show','get','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x3e98c4,_0x4cf3cf){var _0x189026=function(_0x1e2333){while(--_0x1e2333){_0x3e98c4['push'](_0x3e98c4['shift']());}};_0x189026(++_0x4cf3cf);}(_0x5d36,0x11a));var _0x65d3=function(_0x29b929,_0x2a4b10){_0x29b929=_0x29b929-0x0;var _0x3a8ce6=_0x5d36[_0x29b929];return _0x3a8ce6;};'use strict';var multer=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var path=require(_0x65d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65d3('0x3')]();var fs_extra=require(_0x65d3('0x4'));var auth=require(_0x65d3('0x5'));var interaction=require(_0x65d3('0x6'));var config=require(_0x65d3('0x7'));var controller=require(_0x65d3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65d3('0x9')]);router['get'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xc')]);router['get'](_0x65d3('0xd'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xe')]);router['get']('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x65d3('0xf')](_0x65d3('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x65d3('0x11')]('/voice/queue/moveContacts/:id',auth[_0x65d3('0xb')](),controller[_0x65d3('0x12')]);router[_0x65d3('0x11')](_0x65d3('0x13'),auth[_0x65d3('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x65d3('0x11')](_0x65d3('0x14'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x15')]);router['put'](_0x65d3('0xd'),auth[_0x65d3('0xb')](),controller[_0x65d3('0x16')]);module[_0x65d3('0x17')]=router; \ No newline at end of file +var _0x4f34=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','exports','multer'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x4f34,0xae));var _0x44f3=function(_0x2238fa,_0x46243c){_0x2238fa=_0x2238fa-0x0;var _0x8e1006=_0x4f34[_0x2238fa];return _0x8e1006;};'use strict';var multer=require(_0x44f3('0x0'));var util=require(_0x44f3('0x1'));var path=require(_0x44f3('0x2'));var timeout=require(_0x44f3('0x3'));var express=require(_0x44f3('0x4'));var router=express[_0x44f3('0x5')]();var fs_extra=require(_0x44f3('0x6'));var auth=require(_0x44f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x44f3('0x8'));var controller=require(_0x44f3('0x9'));router[_0x44f3('0xa')]('/',auth[_0x44f3('0xb')](),controller[_0x44f3('0xc')]);router[_0x44f3('0xa')]('/describe',auth[_0x44f3('0xb')](),controller['describe']);router[_0x44f3('0xa')](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0xe')]);router[_0x44f3('0xa')](_0x44f3('0xf'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x10')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x44f3('0x11')]);router[_0x44f3('0x12')]('/voice/queue/moveContacts/:id',auth[_0x44f3('0xb')](),controller[_0x44f3('0x13')]);router[_0x44f3('0x12')](_0x44f3('0x14'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x15')]);router[_0x44f3('0x12')]('/checkContactHopper',auth[_0x44f3('0xb')](),controller[_0x44f3('0x16')]);router['put'](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x17')]);module[_0x44f3('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 8c96f92..b1a3630 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 _0xa35e=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xa35e,0x111));var _0xea35=function(_0x908143,_0x381f2a){_0x908143=_0x908143-0x0;var _0x266c46=_0xa35e[_0x908143];return _0x266c46;};'use strict';var Sequelize=require(_0xea35('0x0'));module['exports']={'state':{'type':Sequelize[_0xea35('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xea35('0x2')]},'scheduledat':{'type':Sequelize[_0xea35('0x3')]},'countbusyretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xea35('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xea35('0x2')]},'originatecalleridname':{'type':Sequelize[_0xea35('0x2')]},'calleridnum':{'type':Sequelize[_0xea35('0x2')]},'calleridname':{'type':Sequelize[_0xea35('0x2')]},'starttime':{'type':Sequelize[_0xea35('0x3')]},'responsetime':{'type':Sequelize[_0xea35('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xea35('0x3')]},'endtime':{'type':Sequelize[_0xea35('0x3')]},'ringtime':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xea35('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xea35('0x2')]},'membername':{'type':Sequelize[_0xea35('0x2')]},'reason':{'type':Sequelize[_0xea35('0x2')]},'amd':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea35('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea35('0x3')]},'recallme':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea35('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea35('0x2')]}}; \ No newline at end of file +var _0xb1d2=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0x54d7ac,_0x3f57a6){var _0x64a2ec=function(_0x9f8868){while(--_0x9f8868){_0x54d7ac['push'](_0x54d7ac['shift']());}};_0x64a2ec(++_0x3f57a6);}(_0xb1d2,0x116));var _0x2b1d=function(_0x7a474f,_0x2c1a73){_0x7a474f=_0x7a474f-0x0;var _0x14ae4a=_0xb1d2[_0x7a474f];return _0x14ae4a;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x2b1d('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x2b1d('0x1')]},'scheduledat':{'type':Sequelize[_0x2b1d('0x2')]},'countbusyretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2b1d('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2b1d('0x1')]},'calleridnum':{'type':Sequelize[_0x2b1d('0x1')]},'calleridname':{'type':Sequelize[_0x2b1d('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2b1d('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2b1d('0x1')]},'campaign':{'type':Sequelize[_0x2b1d('0x1')]},'campaigntype':{'type':Sequelize[_0x2b1d('0x1')]},'membername':{'type':Sequelize[_0x2b1d('0x1')]},'reason':{'type':Sequelize[_0x2b1d('0x1')]},'amd':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2b1d('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2b1d('0x2')]},'recallme':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2b1d('0x2')]},'edited':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2b1d('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2b1d('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1dd0fb7..0c728bb 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 _0x0390=['apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','create','body','catch','describe','uniqueid','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x3049c6,_0xc78ffd){var _0x5ebca0=function(_0x386ce2){while(--_0x386ce2){_0x3049c6['push'](_0x3049c6['shift']());}};_0x5ebca0(++_0xc78ffd);}(_0x0390,0x1e5));var _0x0039=function(_0x78b8fe,_0xfa3907){_0x78b8fe=_0x78b8fe-0x0;var _0x546036=_0x0390[_0x78b8fe];return _0x546036;};'use strict';var emlformat=require(_0x0039('0x0'));var rimraf=require(_0x0039('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0039('0x2'));var rp=require(_0x0039('0x3'));var moment=require(_0x0039('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0039('0x5'));var util=require(_0x0039('0x6'));var path=require(_0x0039('0x7'));var sox=require(_0x0039('0x8'));var csv=require('to-csv');var ejs=require(_0x0039('0x9'));var fs=require('fs');var fs_extra=require(_0x0039('0xa'));var _=require(_0x0039('0xb'));var squel=require(_0x0039('0xc'));var crypto=require(_0x0039('0xd'));var jsforce=require(_0x0039('0xe'));var deskjs=require(_0x0039('0xf'));var toCsv=require(_0x0039('0x10'));var querystring=require(_0x0039('0x11'));var Papa=require(_0x0039('0x12'));var Redis=require(_0x0039('0x13'));var authService=require(_0x0039('0x14'));var qs=require(_0x0039('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0039('0x16'));var utils=require('../../config/utils');var config=require(_0x0039('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0039('0x18'))['db'];function respondWithStatusCode(_0x30d8e1,_0x48486c){_0x48486c=_0x48486c||0xcc;return function(_0x2fe536){if(_0x2fe536){return _0x30d8e1['sendStatus'](_0x48486c);}return _0x30d8e1[_0x0039('0x19')](_0x48486c)[_0x0039('0x1a')]();};}function respondWithResult(_0x3ee540,_0x262930){_0x262930=_0x262930||0xc8;return function(_0x4a9fc2){if(_0x4a9fc2){return _0x3ee540[_0x0039('0x19')](_0x262930)[_0x0039('0x1b')](_0x4a9fc2);}};}function respondWithFilteredResult(_0x1386e0,_0x125562){return function(_0x26d993){if(_0x26d993){var _0x31a354=typeof _0x125562[_0x0039('0x1c')]===_0x0039('0x1d')&&typeof _0x125562[_0x0039('0x1e')]===_0x0039('0x1d');var _0x4f3a71=_0x26d993[_0x0039('0x1f')];var _0x453acc=_0x31a354?0x0:_0x125562[_0x0039('0x1c')];var _0x386010=_0x31a354?_0x26d993[_0x0039('0x1f')]:_0x125562[_0x0039('0x1c')]+_0x125562[_0x0039('0x1e')];var _0x1133fa;if(_0x386010>=_0x4f3a71){_0x386010=_0x4f3a71;_0x1133fa=0xc8;}else{_0x1133fa=0xce;}_0x1386e0[_0x0039('0x19')](_0x1133fa);return _0x1386e0['set'](_0x0039('0x20'),_0x453acc+'-'+_0x386010+'/'+_0x4f3a71)[_0x0039('0x1b')](_0x26d993);}return null;};}function patchUpdates(_0x104fc2){return function(_0x2f18b1){try{jsonpatch[_0x0039('0x21')](_0x2f18b1,_0x104fc2,!![]);}catch(_0x360a10){return BPromise[_0x0039('0x22')](_0x360a10);}return _0x2f18b1['save']();};}function saveUpdates(_0x509d1e,_0x311d1e){return function(_0x28b571){if(_0x28b571){return _0x28b571[_0x0039('0x23')](_0x509d1e)[_0x0039('0x24')](function(_0x1407f5){return _0x1407f5;});}return null;};}function removeEntity(_0x22d6eb,_0x4dfa18){return function(_0x25a2b0){if(_0x25a2b0){return _0x25a2b0[_0x0039('0x25')]()['then'](function(){_0x22d6eb[_0x0039('0x19')](0xcc)[_0x0039('0x1a')]();});}};}function handleEntityNotFound(_0xc2be09,_0x44128b){return function(_0x2211b3){if(!_0x2211b3){_0xc2be09[_0x0039('0x26')](0x194);}return _0x2211b3;};}function handleError(_0x33859b,_0x19d5c5){_0x19d5c5=_0x19d5c5||0x1f4;return function(_0x23e92a){logger[_0x0039('0x27')](_0x23e92a[_0x0039('0x28')]);if(_0x23e92a[_0x0039('0x29')]){delete _0x23e92a[_0x0039('0x29')];}_0x33859b[_0x0039('0x19')](_0x19d5c5)[_0x0039('0x2a')](_0x23e92a);};}exports[_0x0039('0x2b')]=function(_0x144a6b,_0x39925d){var _0xa0a002={},_0x14f937={},_0x422c57={'count':0x0,'rows':[]};var _0x5af4b7=_[_0x0039('0x2c')](db[_0x0039('0x2d')][_0x0039('0x2e')],function(_0x47dede){return{'name':_0x47dede['fieldName'],'type':_0x47dede['type'][_0x0039('0x2f')]};});_0x14f937[_0x0039('0x30')]=_[_0x0039('0x2c')](_0x5af4b7,_0x0039('0x29'));_0x14f937['query']=_['keys'](_0x144a6b[_0x0039('0x31')]);_0x14f937[_0x0039('0x32')]=_[_0x0039('0x33')](_0x14f937[_0x0039('0x30')],_0x14f937['query']);_0xa0a002['attributes']=_[_0x0039('0x33')](_0x14f937['model'],qs[_0x0039('0x34')](_0x144a6b[_0x0039('0x31')][_0x0039('0x34')]));_0xa0a002[_0x0039('0x35')]=_0xa0a002[_0x0039('0x35')][_0x0039('0x36')]?_0xa0a002['attributes']:_0x14f937[_0x0039('0x30')];if(!_0x144a6b['query']['hasOwnProperty'](_0x0039('0x37'))){_0xa0a002[_0x0039('0x1e')]=qs[_0x0039('0x1e')](_0x144a6b[_0x0039('0x31')][_0x0039('0x1e')]);_0xa0a002['offset']=qs[_0x0039('0x1c')](_0x144a6b[_0x0039('0x31')][_0x0039('0x1c')]);}_0xa0a002['order']=qs['sort'](_0x144a6b['query']['sort']);_0xa0a002[_0x0039('0x38')]=qs['filters'](_[_0x0039('0x39')](_0x144a6b['query'],_0x14f937[_0x0039('0x32')]),_0x5af4b7);if(_0x144a6b[_0x0039('0x31')][_0x0039('0x3a')]){_0xa0a002[_0x0039('0x38')]=_[_0x0039('0x3b')](_0xa0a002[_0x0039('0x38')],{'$or':_[_0x0039('0x2c')](_0x5af4b7,function(_0x25525f){if(_0x25525f['type']!==_0x0039('0x3c')){var _0x2e861a={};_0x2e861a[_0x25525f[_0x0039('0x29')]]={'$like':'%'+_0x144a6b[_0x0039('0x31')][_0x0039('0x3a')]+'%'};return _0x2e861a;}})});}_0xa0a002=_[_0x0039('0x3b')]({},_0xa0a002,_0x144a6b[_0x0039('0x3d')]);var _0x894640={'where':_0xa0a002['where']};return db[_0x0039('0x2d')][_0x0039('0x1f')](_0x894640)[_0x0039('0x24')](function(_0x52d0fa){_0x422c57[_0x0039('0x1f')]=_0x52d0fa;if(_0x144a6b[_0x0039('0x31')][_0x0039('0x3e')]){_0xa0a002[_0x0039('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0039('0x40')](_0xa0a002);})['then'](function(_0xd96a35){_0x422c57['rows']=_0xd96a35;return _0x422c57;})[_0x0039('0x24')](respondWithFilteredResult(_0x39925d,_0xa0a002))['catch'](handleError(_0x39925d,null));};exports[_0x0039('0x41')]=function(_0xbea41c,_0x44ec6f){var _0x1442c4={'raw':!![],'where':{'id':_0xbea41c[_0x0039('0x42')]['id']}},_0x8a49e9={};_0x8a49e9[_0x0039('0x30')]=_[_0x0039('0x43')](db['CmHopperHistory'][_0x0039('0x2e')]);_0x8a49e9['query']=_['keys'](_0xbea41c['query']);_0x8a49e9[_0x0039('0x32')]=_[_0x0039('0x33')](_0x8a49e9[_0x0039('0x30')],_0x8a49e9[_0x0039('0x31')]);_0x1442c4[_0x0039('0x35')]=_['intersection'](_0x8a49e9['model'],qs[_0x0039('0x34')](_0xbea41c[_0x0039('0x31')][_0x0039('0x34')]));_0x1442c4['attributes']=_0x1442c4[_0x0039('0x35')]['length']?_0x1442c4['attributes']:_0x8a49e9['model'];if(_0xbea41c[_0x0039('0x31')][_0x0039('0x3e')]){_0x1442c4[_0x0039('0x3f')]=[{'all':!![]}];}_0x1442c4=_[_0x0039('0x3b')]({},_0x1442c4,_0xbea41c['options']);return db[_0x0039('0x2d')]['find'](_0x1442c4)[_0x0039('0x24')](handleEntityNotFound(_0x44ec6f,null))['then'](respondWithResult(_0x44ec6f,null))['catch'](handleError(_0x44ec6f,null));};exports['create']=function(_0x1017f8,_0x34b49a){return db['CmHopperHistory'][_0x0039('0x44')](_0x1017f8[_0x0039('0x45')],{})[_0x0039('0x24')](respondWithResult(_0x34b49a,0xc9))[_0x0039('0x46')](handleError(_0x34b49a,null));};exports[_0x0039('0x47')]=function(_0x4d2c2f,_0x42c1f8){return db['CmHopperHistory'][_0x0039('0x47')]()[_0x0039('0x24')](respondWithResult(_0x42c1f8,null))[_0x0039('0x46')](handleError(_0x42c1f8,null));};exports[_0x0039('0x23')]=function(_0x314c7c,_0x37464e){if(_0x314c7c[_0x0039('0x45')][_0x0039('0x48')]){delete _0x314c7c[_0x0039('0x45')][_0x0039('0x48')];}return db[_0x0039('0x2d')][_0x0039('0x49')]({'where':{'uniqueid':_0x314c7c[_0x0039('0x42')]['id']}})['then'](handleEntityNotFound(_0x37464e,null))[_0x0039('0x24')](saveUpdates(_0x314c7c[_0x0039('0x45')],null))[_0x0039('0x24')](respondWithResult(_0x37464e,null))['catch'](handleError(_0x37464e,null));}; \ No newline at end of file +var _0x7398=['mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7398,0x17c));var _0x8739=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x7398[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x8739('0x0'));var rimraf=require(_0x8739('0x1'));var zipdir=require(_0x8739('0x2'));var jsonpatch=require(_0x8739('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8739('0x4'));var Mustache=require(_0x8739('0x5'));var util=require('util');var path=require(_0x8739('0x6'));var sox=require(_0x8739('0x7'));var csv=require(_0x8739('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8739('0x9'));var _=require(_0x8739('0xa'));var squel=require(_0x8739('0xb'));var crypto=require(_0x8739('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8739('0x8'));var querystring=require(_0x8739('0xd'));var Papa=require(_0x8739('0xe'));var Redis=require(_0x8739('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8739('0x10'));var as=require(_0x8739('0x11'));var hardwareService=require(_0x8739('0x12'));var logger=require(_0x8739('0x13'))(_0x8739('0x14'));var utils=require(_0x8739('0x15'));var config=require(_0x8739('0x16'));var licenseUtil=require(_0x8739('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x277eda,_0x593e26){_0x593e26=_0x593e26||0xcc;return function(_0x239c0f){if(_0x239c0f){return _0x277eda[_0x8739('0x18')](_0x593e26);}return _0x277eda['status'](_0x593e26)[_0x8739('0x19')]();};}function respondWithResult(_0x5a078e,_0x2bfd14){_0x2bfd14=_0x2bfd14||0xc8;return function(_0x732098){if(_0x732098){return _0x5a078e[_0x8739('0x1a')](_0x2bfd14)[_0x8739('0x1b')](_0x732098);}};}function respondWithFilteredResult(_0x23b7e2,_0x36a500){return function(_0x4ccb42){if(_0x4ccb42){var _0x26b3a1=typeof _0x36a500[_0x8739('0x1c')]===_0x8739('0x1d')&&typeof _0x36a500[_0x8739('0x1e')]===_0x8739('0x1d');var _0x5d243e=_0x4ccb42[_0x8739('0x1f')];var _0x450181=_0x26b3a1?0x0:_0x36a500[_0x8739('0x1c')];var _0x30963d=_0x26b3a1?_0x4ccb42[_0x8739('0x1f')]:_0x36a500['offset']+_0x36a500[_0x8739('0x1e')];var _0x57071e;if(_0x30963d>=_0x5d243e){_0x30963d=_0x5d243e;_0x57071e=0xc8;}else{_0x57071e=0xce;}_0x23b7e2[_0x8739('0x1a')](_0x57071e);return _0x23b7e2[_0x8739('0x20')](_0x8739('0x21'),_0x450181+'-'+_0x30963d+'/'+_0x5d243e)[_0x8739('0x1b')](_0x4ccb42);}return null;};}function patchUpdates(_0x52a4c1){return function(_0x27763e){try{jsonpatch[_0x8739('0x22')](_0x27763e,_0x52a4c1,!![]);}catch(_0xf83839){return BPromise['reject'](_0xf83839);}return _0x27763e[_0x8739('0x23')]();};}function saveUpdates(_0x549534,_0x43a02b){return function(_0x442379){if(_0x442379){return _0x442379[_0x8739('0x24')](_0x549534)['then'](function(_0x29c663){return _0x29c663;});}return null;};}function removeEntity(_0x2d895c,_0x3623ae){return function(_0x758a7){if(_0x758a7){return _0x758a7[_0x8739('0x25')]()[_0x8739('0x26')](function(){_0x2d895c['status'](0xcc)[_0x8739('0x19')]();});}};}function handleEntityNotFound(_0xdf1f86,_0x5e785f){return function(_0x50ae54){if(!_0x50ae54){_0xdf1f86['sendStatus'](0x194);}return _0x50ae54;};}function handleError(_0x492055,_0x351cc9){_0x351cc9=_0x351cc9||0x1f4;return function(_0x1846b8){logger[_0x8739('0x27')](_0x1846b8[_0x8739('0x28')]);if(_0x1846b8[_0x8739('0x29')]){delete _0x1846b8[_0x8739('0x29')];}_0x492055[_0x8739('0x1a')](_0x351cc9)[_0x8739('0x2a')](_0x1846b8);};}exports[_0x8739('0x2b')]=function(_0x1b05dc,_0x55160e){var _0x2461e6={},_0x1c4c4b={},_0x50b6f4={'count':0x0,'rows':[]};var _0x2468ce=_[_0x8739('0x2c')](db[_0x8739('0x2d')][_0x8739('0x2e')],function(_0x2d761e){return{'name':_0x2d761e['fieldName'],'type':_0x2d761e['type']['key']};});_0x1c4c4b[_0x8739('0x2f')]=_[_0x8739('0x2c')](_0x2468ce,_0x8739('0x29'));_0x1c4c4b[_0x8739('0x30')]=_[_0x8739('0x31')](_0x1b05dc[_0x8739('0x30')]);_0x1c4c4b[_0x8739('0x32')]=_['intersection'](_0x1c4c4b[_0x8739('0x2f')],_0x1c4c4b[_0x8739('0x30')]);_0x2461e6[_0x8739('0x33')]=_[_0x8739('0x34')](_0x1c4c4b[_0x8739('0x2f')],qs[_0x8739('0x35')](_0x1b05dc[_0x8739('0x30')][_0x8739('0x35')]));_0x2461e6[_0x8739('0x33')]=_0x2461e6[_0x8739('0x33')][_0x8739('0x36')]?_0x2461e6[_0x8739('0x33')]:_0x1c4c4b[_0x8739('0x2f')];if(!_0x1b05dc[_0x8739('0x30')][_0x8739('0x37')]('nolimit')){_0x2461e6[_0x8739('0x1e')]=qs['limit'](_0x1b05dc['query']['limit']);_0x2461e6['offset']=qs[_0x8739('0x1c')](_0x1b05dc[_0x8739('0x30')][_0x8739('0x1c')]);}_0x2461e6[_0x8739('0x38')]=qs['sort'](_0x1b05dc['query'][_0x8739('0x39')]);_0x2461e6[_0x8739('0x3a')]=qs['filters'](_[_0x8739('0x3b')](_0x1b05dc[_0x8739('0x30')],_0x1c4c4b[_0x8739('0x32')]),_0x2468ce);if(_0x1b05dc[_0x8739('0x30')][_0x8739('0x3c')]){_0x2461e6['where']=_['merge'](_0x2461e6['where'],{'$or':_[_0x8739('0x2c')](_0x2468ce,function(_0x3365ba){if(_0x3365ba[_0x8739('0x3d')]!==_0x8739('0x3e')){var _0x5290a7={};_0x5290a7[_0x3365ba[_0x8739('0x29')]]={'$like':'%'+_0x1b05dc[_0x8739('0x30')]['filter']+'%'};return _0x5290a7;}})});}_0x2461e6=_[_0x8739('0x3f')]({},_0x2461e6,_0x1b05dc[_0x8739('0x40')]);var _0x35d376={'where':_0x2461e6['where']};return db['CmHopperHistory'][_0x8739('0x1f')](_0x35d376)[_0x8739('0x26')](function(_0x3b0956){_0x50b6f4[_0x8739('0x1f')]=_0x3b0956;if(_0x1b05dc[_0x8739('0x30')][_0x8739('0x41')]){_0x2461e6[_0x8739('0x42')]=[{'all':!![]}];}return db[_0x8739('0x2d')][_0x8739('0x43')](_0x2461e6);})['then'](function(_0x277775){_0x50b6f4[_0x8739('0x44')]=_0x277775;return _0x50b6f4;})[_0x8739('0x26')](respondWithFilteredResult(_0x55160e,_0x2461e6))[_0x8739('0x45')](handleError(_0x55160e,null));};exports[_0x8739('0x46')]=function(_0x1e7986,_0x37da0a){var _0x1d4d99={'raw':!![],'where':{'id':_0x1e7986['params']['id']}},_0x2243af={};_0x2243af[_0x8739('0x2f')]=_[_0x8739('0x31')](db[_0x8739('0x2d')]['rawAttributes']);_0x2243af['query']=_[_0x8739('0x31')](_0x1e7986[_0x8739('0x30')]);_0x2243af[_0x8739('0x32')]=_['intersection'](_0x2243af[_0x8739('0x2f')],_0x2243af[_0x8739('0x30')]);_0x1d4d99[_0x8739('0x33')]=_[_0x8739('0x34')](_0x2243af[_0x8739('0x2f')],qs[_0x8739('0x35')](_0x1e7986['query']['fields']));_0x1d4d99[_0x8739('0x33')]=_0x1d4d99[_0x8739('0x33')][_0x8739('0x36')]?_0x1d4d99[_0x8739('0x33')]:_0x2243af[_0x8739('0x2f')];if(_0x1e7986['query'][_0x8739('0x41')]){_0x1d4d99[_0x8739('0x42')]=[{'all':!![]}];}_0x1d4d99=_[_0x8739('0x3f')]({},_0x1d4d99,_0x1e7986[_0x8739('0x40')]);return db['CmHopperHistory'][_0x8739('0x47')](_0x1d4d99)['then'](handleEntityNotFound(_0x37da0a,null))[_0x8739('0x26')](respondWithResult(_0x37da0a,null))[_0x8739('0x45')](handleError(_0x37da0a,null));};exports['create']=function(_0x1e7104,_0x4f0cf0){return db[_0x8739('0x2d')][_0x8739('0x48')](_0x1e7104[_0x8739('0x49')],{})[_0x8739('0x26')](respondWithResult(_0x4f0cf0,0xc9))['catch'](handleError(_0x4f0cf0,null));};exports[_0x8739('0x4a')]=function(_0x5201c4,_0x556abc){return db['CmHopperHistory'][_0x8739('0x4a')]()['then'](respondWithResult(_0x556abc,null))[_0x8739('0x45')](handleError(_0x556abc,null));};exports[_0x8739('0x24')]=function(_0x3bc50f,_0x1b3a47){if(_0x3bc50f[_0x8739('0x49')][_0x8739('0x4b')]){delete _0x3bc50f[_0x8739('0x49')][_0x8739('0x4b')];}return db[_0x8739('0x2d')][_0x8739('0x47')]({'where':{'uniqueid':_0x3bc50f[_0x8739('0x4c')]['id']}})[_0x8739('0x26')](handleEntityNotFound(_0x1b3a47,null))[_0x8739('0x26')](saveUpdates(_0x3bc50f['body'],null))['then'](respondWithResult(_0x1b3a47,null))['catch'](handleError(_0x1b3a47,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7a34545..1b6badf 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 _0xfb0b=['define','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x5aece9,_0x2bbb9a){var _0x1c46d6=function(_0x1c4f6a){while(--_0x1c4f6a){_0x5aece9['push'](_0x5aece9['shift']());}};_0x1c46d6(++_0x2bbb9a);}(_0xfb0b,0x94));var _0xbfb0=function(_0x312a21,_0x3a14fc){_0x312a21=_0x312a21-0x0;var _0x46ecf6=_0xfb0b[_0x312a21];return _0x46ecf6;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x5'));var config=require('../../config/environment');var attributes=require(_0xbfb0('0x6'));module[_0xbfb0('0x7')]=function(_0x8c7fee,_0x35d657){return _0x8c7fee[_0xbfb0('0x8')](_0xbfb0('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xbfb0('0xa'),'fields':[_0xbfb0('0xa')]},{'name':_0xbfb0('0xb'),'fields':[_0xbfb0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4201=['bluebird','request-promise','path','rimraf','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','api','moment'];(function(_0x543d79,_0xc90aa0){var _0x15ec53=function(_0x4c9ec8){while(--_0x4c9ec8){_0x543d79['push'](_0x543d79['shift']());}};_0x15ec53(++_0xc90aa0);}(_0x4201,0x71));var _0x1420=function(_0x1739ec,_0x297362){_0x1739ec=_0x1739ec-0x0;var _0x5cf0ca=_0x4201[_0x1739ec];return _0x5cf0ca;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var logger=require('../../config/logger')(_0x1420('0x2'));var moment=require(_0x1420('0x3'));var BPromise=require(_0x1420('0x4'));var rp=require(_0x1420('0x5'));var fs=require('fs');var path=require(_0x1420('0x6'));var rimraf=require(_0x1420('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x1420('0x8')]=function(_0x25590c,_0x3ba929){return _0x25590c[_0x1420('0x9')](_0x1420('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x1420('0xb')]},{'name':_0x1420('0xc'),'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 f2010df..4d5e237 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 _0x191a=['`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','sequelize','col','literal','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x191a,0xef));var _0xa191=function(_0x5c544c,_0x39ea34){_0x5c544c=_0x5c544c-0x0;var _0x304800=_0x191a[_0x5c544c];return _0x304800;};'use strict';var _=require(_0xa191('0x0'));var util=require('util');var moment=require(_0xa191('0x1'));var BPromise=require(_0xa191('0x2'));var rs=require(_0xa191('0x3'));var fs=require('fs');var Redis=require(_0xa191('0x4'));var db=require(_0xa191('0x5'))['db'];var utils=require(_0xa191('0x6'));var logger=require(_0xa191('0x7'))(_0xa191('0x8'));var config=require(_0xa191('0x9'));var jayson=require(_0xa191('0xa'));var client=jayson[_0xa191('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae6ee,_0xe1de49,_0x5d340a){return new BPromise(function(_0xfab268,_0x2216ae){return client['request'](_0x3ae6ee,_0x5d340a)[_0xa191('0xc')](function(_0x23f34a){logger[_0xa191('0xd')](_0xa191('0xe'),_0xe1de49,'request\x20sent');logger[_0xa191('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xe1de49,'request\x20sent',JSON[_0xa191('0x10')](_0x23f34a));if(_0x23f34a[_0xa191('0x11')]){if(_0x23f34a[_0xa191('0x11')][_0xa191('0x12')]===0x1f4){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x23f34a[_0xa191('0x11')]['message']);return _0x2216ae(_0x23f34a[_0xa191('0x11')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xe1de49,_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);return _0xfab268(_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);}else{logger['info'](_0xa191('0xe'),_0xe1de49,_0xa191('0x14'));_0xfab268(_0x23f34a['result'][_0xa191('0x13')]);}})[_0xa191('0x15')](function(_0x1c179b){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x1c179b);_0x2216ae(_0x1c179b);});});}exports[_0xa191('0x16')]=function(_0x3c53bd){var _0x2eeaf2=this;return new Promise(function(_0x5d7155,_0x2644dd){return db[_0xa191('0x17')][_0xa191('0x18')](_0x3c53bd['body'],{'raw':_0x3c53bd[_0xa191('0x19')]?_0x3c53bd[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![]})[_0xa191('0xc')](function(_0xe39816){logger['info'](_0xa191('0x16'),_0x3c53bd);logger[_0xa191('0xf')](_0xa191('0x16'),_0x3c53bd,JSON[_0xa191('0x10')](_0xe39816));_0x5d7155(_0xe39816);})[_0xa191('0x15')](function(_0x5f24a7){logger['error'](_0xa191('0x16'),_0x5f24a7[_0xa191('0x13')],_0x3c53bd);_0x2644dd(_0x2eeaf2['error'](0x1f4,_0x5f24a7[_0xa191('0x13')]));});});};exports[_0xa191('0x1b')]=function(_0x2405ce){var _0x346788=this;return new Promise(function(_0x3cbc94,_0x53e8be){return db['CmHopperHistory'][_0xa191('0x1c')]({'raw':_0x2405ce[_0xa191('0x19')]?_0x2405ce[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x2405ce['options']?_0x2405ce['options']['where']||null:null,'attributes':[[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')][_0xa191('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0xa191('0x20')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x22')))),_0xa191('0x23')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x24')))),_0xa191('0x25')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x26'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')](_0xa191('0x27')))),_0xa191('0x28')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x26'),db['sequelize']['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x29')))),_0xa191('0x2a')]]})['then'](function(_0x23fe53){logger[_0xa191('0xd')](_0xa191('0x1b'),_0x2405ce);logger[_0xa191('0xf')](_0xa191('0x1b'),_0x2405ce,JSON['stringify'](_0x23fe53));_0x3cbc94(_0x23fe53);})['catch'](function(_0x605ec4){logger[_0xa191('0x11')](_0xa191('0x1b'),_0x605ec4['message'],_0x2405ce);_0x53e8be(_0x346788[_0xa191('0x11')](0x1f4,_0x605ec4['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5f1900){var _0x3e5b3a=this;return new Promise(function(_0x2c726a,_0x1fa539){return db[_0xa191('0x17')][_0xa191('0x1c')]({'raw':_0x5f1900[_0xa191('0x19')]?_0x5f1900['options'][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f1900['options']?_0x5f1900[_0xa191('0x19')][_0xa191('0x2b')]||null:null,'attributes':[[_0xa191('0x2c'),_0xa191('0x2d')],[db['sequelize']['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa191('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x2f')))),_0xa191('0x30')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x31')))),'outboundAnswerCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x32')))),'outboundCongestionCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x33')))),_0xa191('0x34')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x35')))),_0xa191('0x36')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x37')))),_0xa191('0x38')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x39')))),_0xa191('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x3b')))),_0xa191('0x3c')],[db['sequelize']['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')](_0xa191('0x3d')))),_0xa191('0x3e')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x3f')))),_0xa191('0x40')],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x41')))),_0xa191('0x3e')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x42')))),_0xa191('0x43')]],'group':[_0xa191('0x2c')]})[_0xa191('0xc')](function(_0x3e96b7){logger['info'](_0xa191('0x44'),_0x5f1900);logger[_0xa191('0xf')](_0xa191('0x44'),_0x5f1900,JSON[_0xa191('0x10')](_0x3e96b7));_0x2c726a(_0x3e96b7);})['catch'](function(_0xabcbe2){logger[_0xa191('0x11')](_0xa191('0x44'),_0xabcbe2[_0xa191('0x13')],_0x5f1900);_0x1fa539(_0x3e5b3a['error'](0x1f4,_0xabcbe2[_0xa191('0x13')]));});});};exports[_0xa191('0x45')]=function(_0x438f8f){var _0x5c964b=this;return new Promise(function(_0x42f741,_0x4c92aa){return db[_0xa191('0x17')][_0xa191('0x1c')]({'raw':_0x438f8f['options']?_0x438f8f[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x438f8f[_0xa191('0x19')]?_0x438f8f[_0xa191('0x19')][_0xa191('0x2b')]||null:null,'attributes':[[_0xa191('0x2c'),_0xa191('0x2d')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')][_0xa191('0x1e')]('id')),_0xa191('0x46')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x31')))),_0xa191('0x47')]],'group':[_0xa191('0x2c')]})[_0xa191('0xc')](function(_0x3e9dfa){logger[_0xa191('0xd')](_0xa191('0x45'),_0x438f8f);logger[_0xa191('0xf')](_0xa191('0x45'),_0x438f8f,JSON[_0xa191('0x10')](_0x3e9dfa));_0x42f741(_0x3e9dfa);})[_0xa191('0x15')](function(_0x346f7c){logger['error']('GetCampaignHopperHistory',_0x346f7c[_0xa191('0x13')],_0x438f8f);_0x4c92aa(_0x5c964b[_0xa191('0x11')](0x1f4,_0x346f7c[_0xa191('0x13')]));});});}; \ No newline at end of file +var _0x8ad0=['CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','options','raw','debug','catch','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x126a1b,_0x4fac35){var _0x1f23e1=function(_0x559b87){while(--_0x559b87){_0x126a1b['push'](_0x126a1b['shift']());}};_0x1f23e1(++_0x4fac35);}(_0x8ad0,0xfa));var _0x08ad=function(_0x3c5c68,_0x470080){_0x3c5c68=_0x3c5c68-0x0;var _0x2a208d=_0x8ad0[_0x3c5c68];return _0x2a208d;};'use strict';var _=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var moment=require(_0x08ad('0x2'));var BPromise=require(_0x08ad('0x3'));var rs=require(_0x08ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ad('0x5'))['db'];var utils=require(_0x08ad('0x6'));var logger=require(_0x08ad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08ad('0x8')][_0x08ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c900,_0x5ca4f7,_0x337f42){return new BPromise(function(_0x376b72,_0x5c9d8d){return client['request'](_0x49c900,_0x337f42)[_0x08ad('0xa')](function(_0x121817){logger[_0x08ad('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x08ad('0xc'));logger['debug'](_0x08ad('0xd'),_0x5ca4f7,_0x08ad('0xc'),JSON[_0x08ad('0xe')](_0x121817));if(_0x121817[_0x08ad('0xf')]){if(_0x121817[_0x08ad('0xf')][_0x08ad('0x10')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x121817[_0x08ad('0xf')]['message']);return _0x5c9d8d(_0x121817[_0x08ad('0xf')][_0x08ad('0x11')]);}logger[_0x08ad('0xf')](_0x08ad('0x12'),_0x5ca4f7,_0x121817[_0x08ad('0xf')][_0x08ad('0x11')]);return _0x376b72(_0x121817['error'][_0x08ad('0x11')]);}else{logger['info'](_0x08ad('0x12'),_0x5ca4f7,_0x08ad('0xc'));_0x376b72(_0x121817[_0x08ad('0x13')][_0x08ad('0x11')]);}})['catch'](function(_0x5dc038){logger[_0x08ad('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5ca4f7,_0x5dc038);_0x5c9d8d(_0x5dc038);});});}exports[_0x08ad('0x14')]=function(_0x70dedd){var _0x394cb9=this;return new Promise(function(_0x56ed72,_0x4b5294){return db[_0x08ad('0x15')]['create'](_0x70dedd['body'],{'raw':_0x70dedd[_0x08ad('0x16')]?_0x70dedd[_0x08ad('0x16')][_0x08ad('0x17')]===undefined?!![]:![]:!![]})[_0x08ad('0xa')](function(_0x5255fd){logger['info'](_0x08ad('0x14'),_0x70dedd);logger[_0x08ad('0x18')](_0x08ad('0x14'),_0x70dedd,JSON['stringify'](_0x5255fd));_0x56ed72(_0x5255fd);})[_0x08ad('0x19')](function(_0x58d3b6){logger[_0x08ad('0xf')](_0x08ad('0x14'),_0x58d3b6[_0x08ad('0x11')],_0x70dedd);_0x4b5294(_0x394cb9[_0x08ad('0xf')](0x1f4,_0x58d3b6[_0x08ad('0x11')]));});});};exports['AvgHandleTime']=function(_0x6fbc8f){var _0xe08aac=this;return new Promise(function(_0x44af86,_0x55444f){return db[_0x08ad('0x15')][_0x08ad('0x1a')]({'raw':_0x6fbc8f[_0x08ad('0x16')]?_0x6fbc8f[_0x08ad('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6fbc8f['options']?_0x6fbc8f[_0x08ad('0x16')]['where']||null:null,'attributes':[[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize'][_0x08ad('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x20')))),_0x08ad('0x21')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x08ad('0x1b')]['fn']('AVG',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x08ad('0x22')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x23'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x24')))),_0x08ad('0x25')]]})['then'](function(_0x11a47d){logger['info'](_0x08ad('0x26'),_0x6fbc8f);logger[_0x08ad('0x18')](_0x08ad('0x26'),_0x6fbc8f,JSON[_0x08ad('0xe')](_0x11a47d));_0x44af86(_0x11a47d);})[_0x08ad('0x19')](function(_0x6cfae7){logger['error'](_0x08ad('0x26'),_0x6cfae7[_0x08ad('0x11')],_0x6fbc8f);_0x55444f(_0xe08aac['error'](0x1f4,_0x6cfae7[_0x08ad('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x486538){var _0x196f78=this;return new Promise(function(_0xbc46f2,_0x3b69ee){return db[_0x08ad('0x15')][_0x08ad('0x1a')]({'raw':_0x486538['options']?_0x486538[_0x08ad('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x486538[_0x08ad('0x16')]?_0x486538['options'][_0x08ad('0x27')]||null:null,'attributes':[[_0x08ad('0x28'),_0x08ad('0x29')],[db['sequelize']['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x2a')))),_0x08ad('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')](_0x08ad('0x2c')))),_0x08ad('0x2d')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x2e')))),_0x08ad('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x30')))),'outboundCongestionCallsDay'],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x31')))),_0x08ad('0x32')],[db['sequelize']['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x08ad('0x33')))),_0x08ad('0x34')],[db['sequelize']['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')]['literal'](_0x08ad('0x35')))),_0x08ad('0x36')],[db[_0x08ad('0x1b')]['fn']('COUNT',db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x37')))),_0x08ad('0x38')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x39')))),_0x08ad('0x3a')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x08ad('0x3b')],[db[_0x08ad('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x08ad('0x1e')](_0x08ad('0x3c')))),_0x08ad('0x3d')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x08ad('0x3e')))),_0x08ad('0x3b')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db['sequelize'][_0x08ad('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x08ad('0x28')]})[_0x08ad('0xa')](function(_0x129217){logger[_0x08ad('0xb')](_0x08ad('0x3f'),_0x486538);logger[_0x08ad('0x18')](_0x08ad('0x3f'),_0x486538,JSON[_0x08ad('0xe')](_0x129217));_0xbc46f2(_0x129217);})[_0x08ad('0x19')](function(_0x4b4333){logger[_0x08ad('0xf')]('GetVoiceQueueHopperHistory',_0x4b4333[_0x08ad('0x11')],_0x486538);_0x3b69ee(_0x196f78['error'](0x1f4,_0x4b4333[_0x08ad('0x11')]));});});};exports[_0x08ad('0x40')]=function(_0x201f49){var _0x4e04a0=this;return new Promise(function(_0x350010,_0x57729b){return db['CmHopperHistory'][_0x08ad('0x1a')]({'raw':_0x201f49['options']?_0x201f49['options']['raw']===undefined?!![]:![]:!![],'where':_0x201f49['options']?_0x201f49[_0x08ad('0x16')][_0x08ad('0x27')]||null:null,'attributes':[[_0x08ad('0x28'),_0x08ad('0x29')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['col']('id')),_0x08ad('0x41')],[db[_0x08ad('0x1b')]['fn'](_0x08ad('0x1c'),db[_0x08ad('0x1b')]['fn']('IF',db[_0x08ad('0x1b')][_0x08ad('0x1e')](_0x08ad('0x1f')))),_0x08ad('0x42')]],'group':[_0x08ad('0x28')]})[_0x08ad('0xa')](function(_0x211dc8){logger['info'](_0x08ad('0x40'),_0x201f49);logger[_0x08ad('0x18')](_0x08ad('0x40'),_0x201f49,JSON[_0x08ad('0xe')](_0x211dc8));_0x350010(_0x211dc8);})[_0x08ad('0x19')](function(_0x28a2ec){logger['error'](_0x08ad('0x40'),_0x28a2ec['message'],_0x201f49);_0x57729b(_0x4e04a0[_0x08ad('0xf')](0x1f4,_0x28a2ec[_0x08ad('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4d9c1b7..016155c 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 _0xb149=['/describe','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get'];(function(_0x160f66,_0x56650f){var _0x3a25c0=function(_0x415d69){while(--_0x415d69){_0x160f66['push'](_0x160f66['shift']());}};_0x3a25c0(++_0x56650f);}(_0xb149,0x8c));var _0x9b14=function(_0xc6d32b,_0x608367){_0xc6d32b=_0xc6d32b-0x0;var _0x5d773a=_0xb149[_0xc6d32b];return _0x5d773a;};'use strict';var multer=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var path=require(_0x9b14('0x2'));var timeout=require(_0x9b14('0x3'));var express=require('express');var router=express[_0x9b14('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b14('0x5'));var interaction=require(_0x9b14('0x6'));var config=require(_0x9b14('0x7'));var controller=require(_0x9b14('0x8'));router['get']('/',auth[_0x9b14('0x9')](),controller[_0x9b14('0xa')]);router[_0x9b14('0xb')](_0x9b14('0xc'),auth[_0x9b14('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9b14('0xd')]);router[_0x9b14('0xe')]('/',auth[_0x9b14('0x9')](),controller[_0x9b14('0xf')]);router[_0x9b14('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9b14('0x11')]);module[_0x9b14('0x12')]=router; \ No newline at end of file +var _0xfb72=['post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x5d22d5,_0x184081){var _0x3f685c=function(_0x59c1ac){while(--_0x59c1ac){_0x5d22d5['push'](_0x5d22d5['shift']());}};_0x3f685c(++_0x184081);}(_0xfb72,0xe1));var _0x2fb7=function(_0x32a548,_0x2cbe5a){_0x32a548=_0x32a548-0x0;var _0x2a7d54=_0xfb72[_0x32a548];return _0x2a7d54;};'use strict';var multer=require(_0x2fb7('0x0'));var util=require(_0x2fb7('0x1'));var path=require(_0x2fb7('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb7('0x3'));var router=express[_0x2fb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb7('0x5'));var interaction=require(_0x2fb7('0x6'));var config=require(_0x2fb7('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x2fb7('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fb7('0x9')]);router[_0x2fb7('0x8')](_0x2fb7('0xa'),auth[_0x2fb7('0xb')](),controller[_0x2fb7('0xc')]);router[_0x2fb7('0x8')](_0x2fb7('0xd'),auth['isAuthenticated'](),controller[_0x2fb7('0xe')]);router[_0x2fb7('0xf')]('/',auth['isAuthenticated'](),controller[_0x2fb7('0x10')]);router[_0x2fb7('0x11')](_0x2fb7('0xd'),auth['isAuthenticated'](),controller[_0x2fb7('0x12')]);module[_0x2fb7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 97419f3..6657ceb 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 _0xe79a=['STRING'];(function(_0x554e32,_0x57c2a7){var _0x36bf7a=function(_0x5e4060){while(--_0x5e4060){_0x554e32['push'](_0x554e32['shift']());}};_0x36bf7a(++_0x57c2a7);}(_0xe79a,0x70));var _0xae79=function(_0x42ee1e,_0x3f1a64){_0x42ee1e=_0x42ee1e-0x0;var _0x1e21b8=_0xe79a[_0x42ee1e];return _0x1e21b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae79('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae79('0x0')]},'dialPrefix':{'type':Sequelize[_0xae79('0x0')]}}; \ No newline at end of file +var _0xaced=['sequelize','exports','STRING','name'];(function(_0x4ee9dc,_0x7f5ff9){var _0x51e042=function(_0x551b0e){while(--_0x551b0e){_0x4ee9dc['push'](_0x4ee9dc['shift']());}};_0x51e042(++_0x7f5ff9);}(_0xaced,0x18c));var _0xdace=function(_0x1ad832,_0x1a0f77){_0x1ad832=_0x1ad832-0x0;var _0xb90dbb=_0xaced[_0x1ad832];return _0xb90dbb;};'use strict';var Sequelize=require(_0xdace('0x0'));module[_0xdace('0x1')]={'name':{'type':Sequelize[_0xdace('0x2')],'unique':_0xdace('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdace('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ac1291b..12255d2 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 _0xd0b4=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Disposition','ListId','removeDispositions','addContacts','CmContact','describe','tags','isArray','push','each','ids','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','ContactItemType','OrderBy','alias','select','from','c.deletedAt\x20is\x20null','distinct','c.cf_','field','item','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','format','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','findOne','transaction','Sequelize','TEXT','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','sequelize','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd0b4,0x126));var _0x4d0b=function(_0x2b240a,_0x2c60a0){_0x2b240a=_0x2b240a-0x0;var _0x161731=_0xd0b4[_0x2b240a];return _0x161731;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d0b('0x0'));var zipdir=require(_0x4d0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d0b('0x2'));var BPromise=require(_0x4d0b('0x3'));var Mustache=require(_0x4d0b('0x4'));var util=require('util');var path=require(_0x4d0b('0x5'));var sox=require('sox');var csv=require(_0x4d0b('0x6'));var ejs=require(_0x4d0b('0x7'));var fs=require('fs');var fs_extra=require(_0x4d0b('0x8'));var _=require(_0x4d0b('0x9'));var squel=require(_0x4d0b('0xa'));var crypto=require(_0x4d0b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d0b('0xc'));var toCsv=require(_0x4d0b('0x6'));var querystring=require('querystring');var Papa=require(_0x4d0b('0xd'));var Redis=require(_0x4d0b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4d0b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d0b('0x10'));var logger=require(_0x4d0b('0x11'))(_0x4d0b('0x12'));var utils=require(_0x4d0b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x4d0b('0x14')]=_[_0x4d0b('0x15')](config[_0x4d0b('0x14')],{'host':_0x4d0b('0x16'),'port':0x18eb});var socket=require(_0x4d0b('0x17'))(new Redis(config[_0x4d0b('0x14')]));require(_0x4d0b('0x18'))['register'](socket);function respondWithStatusCode(_0x328211,_0x3cc312){_0x3cc312=_0x3cc312||0xcc;return function(_0x135752){if(_0x135752){return _0x328211['sendStatus'](_0x3cc312);}return _0x328211[_0x4d0b('0x19')](_0x3cc312)[_0x4d0b('0x1a')]();};}function respondWithResult(_0x18fd56,_0x10d4c6){_0x10d4c6=_0x10d4c6||0xc8;return function(_0xebea6b){if(_0xebea6b){return _0x18fd56['status'](_0x10d4c6)['json'](_0xebea6b);}};}function respondWithFilteredResult(_0x4738e5,_0x29360d){return function(_0x214b38){if(_0x214b38){var _0x5b8a7e=typeof _0x29360d[_0x4d0b('0x1b')]===_0x4d0b('0x1c')&&typeof _0x29360d['limit']===_0x4d0b('0x1c');var _0x5c692f=_0x214b38['count'];var _0x8ad66a=_0x5b8a7e?0x0:_0x29360d['offset'];var _0x443896=_0x5b8a7e?_0x214b38[_0x4d0b('0x1d')]:_0x29360d[_0x4d0b('0x1b')]+_0x29360d[_0x4d0b('0x1e')];var _0x3ce6ae;if(_0x443896>=_0x5c692f){_0x443896=_0x5c692f;_0x3ce6ae=0xc8;}else{_0x3ce6ae=0xce;}_0x4738e5[_0x4d0b('0x19')](_0x3ce6ae);return _0x4738e5[_0x4d0b('0x1f')](_0x4d0b('0x20'),_0x8ad66a+'-'+_0x443896+'/'+_0x5c692f)[_0x4d0b('0x21')](_0x214b38);}return null;};}function patchUpdates(_0x4d7f6f){return function(_0x4bb117){try{jsonpatch[_0x4d0b('0x22')](_0x4bb117,_0x4d7f6f,!![]);}catch(_0x40d997){return BPromise[_0x4d0b('0x23')](_0x40d997);}return _0x4bb117['save']();};}function saveUpdates(_0x1d2e05,_0x4c0213){return function(_0x45fc4d){if(_0x45fc4d){return _0x45fc4d[_0x4d0b('0x24')](_0x1d2e05)['then'](function(_0x3ca406){return _0x3ca406;});}return null;};}function removeEntity(_0x135da4,_0x27f570){return function(_0x2741b0){if(_0x2741b0){return _0x2741b0[_0x4d0b('0x25')]()[_0x4d0b('0x26')](function(){var _0x2074b3=_0x2741b0['get']({'plain':!![]});var _0x4df334=_0x4d0b('0x27');return db[_0x4d0b('0x28')][_0x4d0b('0x25')]({'where':{'type':_0x4df334,'resourceId':_0x2074b3['id']}})['then'](function(){return _0x2741b0;});})['then'](function(){_0x135da4['status'](0xcc)[_0x4d0b('0x1a')]();});}};}function handleEntityNotFound(_0x1b491b,_0x1a9520){return function(_0x5a1bf4){if(!_0x5a1bf4){_0x1b491b[_0x4d0b('0x29')](0x194);}return _0x5a1bf4;};}function handleError(_0x42d4ba,_0x2f66b7){_0x2f66b7=_0x2f66b7||0x1f4;return function(_0x5a5b3a){logger[_0x4d0b('0x2a')](_0x5a5b3a[_0x4d0b('0x2b')]);if(_0x5a5b3a[_0x4d0b('0x2c')]){delete _0x5a5b3a[_0x4d0b('0x2c')];}_0x42d4ba['status'](_0x2f66b7)[_0x4d0b('0x2d')](_0x5a5b3a);};}exports[_0x4d0b('0x2e')]=function(_0x51b8b6,_0x324d3c){var _0x4f7d9b={},_0x491994={},_0x15b519={'count':0x0,'rows':[]};var _0x336db9=_['map'](db[_0x4d0b('0x2f')][_0x4d0b('0x30')],function(_0x33a16f){return{'name':_0x33a16f[_0x4d0b('0x31')],'type':_0x33a16f[_0x4d0b('0x32')][_0x4d0b('0x33')]};});_0x491994[_0x4d0b('0x34')]=_[_0x4d0b('0x35')](_0x336db9,_0x4d0b('0x2c'));_0x491994[_0x4d0b('0x36')]=_[_0x4d0b('0x37')](_0x51b8b6[_0x4d0b('0x36')]);_0x491994[_0x4d0b('0x38')]=_[_0x4d0b('0x39')](_0x491994[_0x4d0b('0x34')],_0x491994[_0x4d0b('0x36')]);_0x4f7d9b['attributes']=_['intersection'](_0x491994['model'],qs[_0x4d0b('0x3a')](_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x3a')]));_0x4f7d9b[_0x4d0b('0x3b')]=_0x4f7d9b[_0x4d0b('0x3b')][_0x4d0b('0x3c')]?_0x4f7d9b[_0x4d0b('0x3b')]:_0x491994['model'];if(!_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x3d')](_0x4d0b('0x3e'))){_0x4f7d9b[_0x4d0b('0x1e')]=qs[_0x4d0b('0x1e')](_0x51b8b6['query']['limit']);_0x4f7d9b['offset']=qs[_0x4d0b('0x1b')](_0x51b8b6[_0x4d0b('0x36')]['offset']);}_0x4f7d9b[_0x4d0b('0x3f')]=qs[_0x4d0b('0x40')](_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x40')]);_0x4f7d9b[_0x4d0b('0x41')]=qs[_0x4d0b('0x38')](_[_0x4d0b('0x42')](_0x51b8b6[_0x4d0b('0x36')],_0x491994[_0x4d0b('0x38')]),_0x336db9);if(_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x43')]){_0x4f7d9b[_0x4d0b('0x41')]=_['merge'](_0x4f7d9b[_0x4d0b('0x41')],{'$or':_[_0x4d0b('0x35')](_0x336db9,function(_0x589d4e){if(_0x589d4e[_0x4d0b('0x32')]!==_0x4d0b('0x44')){var _0x20dec8={};_0x20dec8[_0x589d4e[_0x4d0b('0x2c')]]={'$like':'%'+_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x43')]+'%'};return _0x20dec8;}})});}_0x4f7d9b=_[_0x4d0b('0x45')]({},_0x4f7d9b,_0x51b8b6[_0x4d0b('0x46')]);var _0x1e45c3={'where':_0x4f7d9b[_0x4d0b('0x41')]};return db[_0x4d0b('0x2f')][_0x4d0b('0x1d')](_0x1e45c3)[_0x4d0b('0x26')](function(_0x58742a){_0x15b519[_0x4d0b('0x1d')]=_0x58742a;if(_0x51b8b6[_0x4d0b('0x36')][_0x4d0b('0x47')]){_0x4f7d9b[_0x4d0b('0x48')]=[{'all':!![]}];}return db['CmList'][_0x4d0b('0x49')](_0x4f7d9b);})[_0x4d0b('0x26')](function(_0x46cf0a){_0x15b519[_0x4d0b('0x4a')]=_0x46cf0a;return _0x15b519;})[_0x4d0b('0x26')](respondWithFilteredResult(_0x324d3c,_0x4f7d9b))[_0x4d0b('0x4b')](handleError(_0x324d3c,null));};exports['show']=function(_0x1089a0,_0x2ff9bd){var _0x595342={'raw':![],'where':{'id':_0x1089a0[_0x4d0b('0x4c')]['id']}},_0x3adafa={};_0x3adafa[_0x4d0b('0x34')]=_[_0x4d0b('0x37')](db[_0x4d0b('0x2f')]['rawAttributes']);_0x3adafa[_0x4d0b('0x36')]=_[_0x4d0b('0x37')](_0x1089a0['query']);_0x3adafa['filters']=_[_0x4d0b('0x39')](_0x3adafa[_0x4d0b('0x34')],_0x3adafa['query']);_0x595342['attributes']=_['intersection'](_0x3adafa['model'],qs['fields'](_0x1089a0['query'][_0x4d0b('0x3a')]));_0x595342[_0x4d0b('0x3b')]=_0x595342[_0x4d0b('0x3b')]['length']?_0x595342[_0x4d0b('0x3b')]:_0x3adafa[_0x4d0b('0x34')];if(_0x1089a0['query'][_0x4d0b('0x47')]){_0x595342[_0x4d0b('0x48')]=[{'all':!![]}];}_0x595342=_[_0x4d0b('0x45')]({},_0x595342,_0x1089a0['options']);return db[_0x4d0b('0x2f')][_0x4d0b('0x4d')](_0x595342)['then'](handleEntityNotFound(_0x2ff9bd,null))[_0x4d0b('0x26')](respondWithResult(_0x2ff9bd,null))[_0x4d0b('0x4b')](handleError(_0x2ff9bd,null));};exports['create']=function(_0x53273b,_0x268632){return db[_0x4d0b('0x2f')][_0x4d0b('0x4e')](_0x53273b['body'],{})['then'](function(_0x58c397){var _0x4073a2=_0x53273b[_0x4d0b('0x4f')]['get']({'plain':!![]});if(!_0x4073a2)throw new Error(_0x4d0b('0x50'));if(_0x4073a2['role']===_0x4d0b('0x4f')){var _0x403a1e=_0x58c397[_0x4d0b('0x51')]({'plain':!![]});var _0x5aa222=_0x4d0b('0x27');return db[_0x4d0b('0x52')]['find']({'where':{'name':_0x5aa222,'userProfileId':_0x4073a2['userProfileId']},'raw':!![]})['then'](function(_0x18baf2){if(_0x18baf2&&_0x18baf2[_0x4d0b('0x53')]===0x0){return db[_0x4d0b('0x28')][_0x4d0b('0x4e')]({'name':_0x403a1e['name'],'resourceId':_0x403a1e['id'],'type':_0x18baf2[_0x4d0b('0x2c')],'sectionId':_0x18baf2['id']},{})[_0x4d0b('0x26')](function(){return _0x58c397;});}else{return _0x58c397;}})[_0x4d0b('0x4b')](function(_0x5253ef){logger[_0x4d0b('0x2a')](_0x4d0b('0x54'),_0x5253ef);throw _0x5253ef;});}return _0x58c397;})[_0x4d0b('0x26')](respondWithResult(_0x268632,0xc9))[_0x4d0b('0x4b')](handleError(_0x268632,null));};exports['update']=function(_0x5a8a74,_0x575f5a){if(_0x5a8a74[_0x4d0b('0x55')]['id']){delete _0x5a8a74[_0x4d0b('0x55')]['id'];}return db['CmList'][_0x4d0b('0x4d')]({'where':{'id':_0x5a8a74['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x575f5a,null))[_0x4d0b('0x26')](saveUpdates(_0x5a8a74[_0x4d0b('0x55')],null))[_0x4d0b('0x26')](respondWithResult(_0x575f5a,null))[_0x4d0b('0x4b')](handleError(_0x575f5a,null));};exports[_0x4d0b('0x25')]=function(_0x5bf0e1,_0x29a564){return db[_0x4d0b('0x2f')]['find']({'where':{'id':_0x5bf0e1['params']['id']}})['then'](handleEntityNotFound(_0x29a564,null))['then'](removeEntity(_0x29a564,null))[_0x4d0b('0x4b')](handleError(_0x29a564,null));};exports['describe']=function(_0x82ba6,_0xc2fed8){return db[_0x4d0b('0x2f')]['describe']()[_0x4d0b('0x26')](respondWithResult(_0xc2fed8,null))[_0x4d0b('0x4b')](handleError(_0xc2fed8,null));};exports['addDisposition']=function(_0x47042c,_0x4e9ef7,_0x568593){if(_0x47042c[_0x4d0b('0x55')]['id']){delete _0x47042c[_0x4d0b('0x55')]['id'];}return db[_0x4d0b('0x2f')][_0x4d0b('0x4d')]({'where':{'id':_0x47042c['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x4e9ef7,null))['then'](function(_0xc43dbf){if(_0xc43dbf){_0x47042c['body']['ListId']=_0xc43dbf['id'];return db[_0x4d0b('0x56')][_0x4d0b('0x4e')](_0x47042c['body']);}})[_0x4d0b('0x26')](respondWithResult(_0x4e9ef7,null))[_0x4d0b('0x4b')](handleError(_0x4e9ef7,null));};exports['getDispositions']=function(_0x528d6f,_0x13d789,_0x3aa419){var _0x31933c={'raw':![],'where':{}};var _0x3cdd30={};var _0x179cb2={'count':0x0,'rows':[]};return db[_0x4d0b('0x2f')]['findOne']({'where':{'id':_0x528d6f[_0x4d0b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13d789,null))[_0x4d0b('0x26')](function(_0x353e28){if(_0x353e28){_0x3cdd30[_0x4d0b('0x34')]=_[_0x4d0b('0x37')](db[_0x4d0b('0x56')][_0x4d0b('0x30')]);_0x3cdd30[_0x4d0b('0x36')]=_[_0x4d0b('0x37')](_0x528d6f[_0x4d0b('0x36')]);_0x3cdd30[_0x4d0b('0x38')]=_[_0x4d0b('0x39')](_0x3cdd30['model'],_0x3cdd30['query']);_0x31933c[_0x4d0b('0x3b')]=_['intersection'](_0x3cdd30[_0x4d0b('0x34')],qs[_0x4d0b('0x3a')](_0x528d6f[_0x4d0b('0x36')]['fields']));_0x31933c['attributes']=_0x31933c[_0x4d0b('0x3b')]['length']?_0x31933c[_0x4d0b('0x3b')]:_0x3cdd30[_0x4d0b('0x34')];if(!_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x3d')](_0x4d0b('0x3e'))){_0x31933c['limit']=qs[_0x4d0b('0x1e')](_0x528d6f[_0x4d0b('0x36')]['limit']);_0x31933c['offset']=qs[_0x4d0b('0x1b')](_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x1b')]);}_0x31933c['order']=qs[_0x4d0b('0x40')](_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x40')]);_0x31933c[_0x4d0b('0x41')]=qs[_0x4d0b('0x38')](_[_0x4d0b('0x42')](_0x528d6f[_0x4d0b('0x36')],_0x3cdd30['filters']));_0x31933c[_0x4d0b('0x41')][_0x4d0b('0x57')]=_0x353e28['id'];if(_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x43')]){_0x31933c[_0x4d0b('0x41')]=_[_0x4d0b('0x45')](_0x31933c[_0x4d0b('0x41')],{'$or':_['map'](_0x31933c[_0x4d0b('0x3b')],function(_0x1b7109){var _0xfef962={};_0xfef962[_0x1b7109]={'$like':'%'+_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x43')]+'%'};return _0xfef962;})});}_0x31933c=_[_0x4d0b('0x45')]({},_0x31933c,_0x528d6f[_0x4d0b('0x46')]);return db['Disposition']['count']({'where':_0x31933c[_0x4d0b('0x41')]})['then'](function(_0x184069){_0x179cb2['count']=_0x184069;if(_0x528d6f[_0x4d0b('0x36')][_0x4d0b('0x47')]){_0x31933c[_0x4d0b('0x48')]=[{'all':!![]}];}return db[_0x4d0b('0x56')][_0x4d0b('0x49')](_0x31933c);})[_0x4d0b('0x26')](function(_0x3d9360){_0x179cb2[_0x4d0b('0x4a')]=_0x3d9360;return _0x179cb2;});}})[_0x4d0b('0x26')](respondWithFilteredResult(_0x13d789,_0x31933c))[_0x4d0b('0x4b')](handleError(_0x13d789,null));};exports[_0x4d0b('0x58')]=function(_0x2c68f0,_0x2bfd43,_0x2b464d){return db[_0x4d0b('0x2f')]['find']({'where':{'id':_0x2c68f0['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x2bfd43,null))['then'](function(_0x19e0a6){if(_0x19e0a6){return _0x19e0a6[_0x4d0b('0x58')](_0x2c68f0[_0x4d0b('0x36')]['ids']);}})[_0x4d0b('0x26')](respondWithStatusCode(_0x2bfd43,null))[_0x4d0b('0x4b')](handleError(_0x2bfd43,null));};exports[_0x4d0b('0x59')]=function(_0x2b88e7,_0x4f6220,_0x476275){return db[_0x4d0b('0x2f')][_0x4d0b('0x4d')]({'where':{'id':_0x2b88e7[_0x4d0b('0x4c')]['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x4f6220,null))[_0x4d0b('0x26')](function(_0x132122){if(_0x132122){var _0x315d01=[];var _0x26e5d3={'success':[],'errors':[]};return db[_0x4d0b('0x5a')][_0x4d0b('0x5b')]()[_0x4d0b('0x26')](function(_0x4c7e0c){if(_0x2b88e7[_0x4d0b('0x55')][_0x4d0b('0x5c')]&&_[_0x4d0b('0x5d')](_0x2b88e7['body']['tags'])){if(_0x2b88e7[_0x4d0b('0x55')][_0x4d0b('0x5c')][_0x4d0b('0x3c')]){_0x2b88e7[_0x4d0b('0x55')][_0x4d0b('0x5c')]=_0x2b88e7[_0x4d0b('0x55')][_0x4d0b('0x5c')]['join'](';')+';';}else{_0x2b88e7['body']['tags']=null;}}else{_0x2b88e7['body']['tags']=null;}if(_0x2b88e7[_0x4d0b('0x55')]&&_[_0x4d0b('0x5d')](_0x2b88e7[_0x4d0b('0x55')])){for(var _0x2f6984=0x0;_0x2f6984<_0x2b88e7[_0x4d0b('0x55')]['length'];_0x2f6984+=0x1){_0x2b88e7[_0x4d0b('0x55')][_0x2f6984]['ListId']=_0x2b88e7[_0x4d0b('0x4c')]['id'];_0x315d01[_0x4d0b('0x5e')](_0x2b88e7[_0x4d0b('0x55')][_0x2f6984]);}return BPromise[_0x4d0b('0x5f')](_0x315d01,function(_0x1194cf){return db[_0x4d0b('0x5a')]['create'](_['omit'](_0x1194cf,[_0x4d0b('0x60'),'id'])||{},{'fields':_[_0x4d0b('0x37')](_0x4c7e0c),'raw':!![]})[_0x4d0b('0x26')](function(_0x237e3f){_0x26e5d3[_0x4d0b('0x61')][_0x4d0b('0x5e')](_0x237e3f[_0x4d0b('0x62')]);})[_0x4d0b('0x4b')](function(_0x58f582){_0x26e5d3['errors'][_0x4d0b('0x5e')]({'data':_0x1194cf,'error':_0x58f582[_0x4d0b('0x63')]});});})[_0x4d0b('0x26')](function(_0x53fa00){return _0x26e5d3;})[_0x4d0b('0x4b')](function(_0x232212){return _0x232212;});}else{_0x4f6220[_0x4d0b('0x19')](0x190)[_0x4d0b('0x21')]({'message':_0x4d0b('0x64')});}});}})[_0x4d0b('0x26')](respondWithResult(_0x4f6220,null))[_0x4d0b('0x4b')](handleError(_0x4f6220,null));};exports['getContacts']=function(_0x172d49,_0x473bd8,_0x5e60d0){var _0x1bd572;return db[_0x4d0b('0x2f')]['find']({'where':{'id':_0x172d49[_0x4d0b('0x4c')]['id']},'include':[{'model':db[_0x4d0b('0x65')],'as':_0x4d0b('0x66')}]})[_0x4d0b('0x26')](handleEntityNotFound(_0x473bd8,null))[_0x4d0b('0x26')](function(_0x3bc85a){if(_0x3bc85a){_0x1bd572=_0x3bc85a;return db[_0x4d0b('0x5a')][_0x4d0b('0x30')];}})[_0x4d0b('0x26')](function(_0x23fe0a){if(_0x23fe0a){var _0x53341f={};var _0x5ee1aa={};_0x5ee1aa['model']=_[_0x4d0b('0x67')](_[_0x4d0b('0x37')](_0x23fe0a),_['map'](_0x1bd572['CustomFields'],function(_0x1e9451){return util['format'](_0x4d0b('0x68'),_0x1e9451['id']);}));_0x5ee1aa[_0x4d0b('0x36')]=_[_0x4d0b('0x37')](_0x172d49[_0x4d0b('0x36')]);_0x5ee1aa[_0x4d0b('0x38')]=_[_0x4d0b('0x39')](_0x5ee1aa[_0x4d0b('0x34')],_0x5ee1aa['query']);_0x53341f['attributes']=_[_0x4d0b('0x39')](_0x5ee1aa[_0x4d0b('0x34')],qs['fields'](_0x172d49[_0x4d0b('0x36')][_0x4d0b('0x3a')]));_0x53341f['attributes']=_0x53341f[_0x4d0b('0x3b')][_0x4d0b('0x3c')]?_0x53341f[_0x4d0b('0x3b')]:_0x5ee1aa[_0x4d0b('0x34')];if(!_0x172d49[_0x4d0b('0x36')]['hasOwnProperty']('nolimit')){_0x53341f[_0x4d0b('0x1e')]=qs[_0x4d0b('0x1e')](_0x172d49['query'][_0x4d0b('0x1e')]);_0x53341f['offset']=qs['offset'](_0x172d49[_0x4d0b('0x36')]['offset']);}_0x53341f['order']=qs[_0x4d0b('0x40')](_0x172d49['query']['sort']);_0x53341f[_0x4d0b('0x41')]=qs[_0x4d0b('0x38')](_[_0x4d0b('0x42')](_0x172d49[_0x4d0b('0x36')],_0x5ee1aa['filters']));_0x53341f[_0x4d0b('0x69')]=!![];if(_0x172d49[_0x4d0b('0x36')][_0x4d0b('0x43')]){_0x53341f['where']=_[_0x4d0b('0x45')](_0x53341f[_0x4d0b('0x41')],{'$or':_[_0x4d0b('0x35')](_0x53341f[_0x4d0b('0x3b')],function(_0x420a3f){var _0x5f063d={};_0x5f063d[_0x420a3f]={'$like':'%'+_0x172d49['query']['filter']+'%'};return _0x5f063d;})});}_0x53341f=_['merge']({},_0x53341f,_0x172d49[_0x4d0b('0x46')]);return _0x1bd572['getContacts'](_0x53341f);}})[_0x4d0b('0x26')](respondWithResult(_0x473bd8,null))[_0x4d0b('0x4b')](handleError(_0x473bd8,null));};exports['getContactsCsv']=function(_0x436a47,_0x4ca1b6,_0x11cf00){var _0x27eb61;var _0x5d6f9d;var _0x50e7e7;var _0x33cb16=_0x436a47[_0x4d0b('0x4c')]['id'];csv_results=[];return db[_0x4d0b('0x6a')]['findAll']({'attributes':['id',_0x4d0b('0x2c')],'raw':!![],'order':[_0x4d0b('0x6b')]})[_0x4d0b('0x26')](function(_0x72d442){_0x27eb61=_0x72d442;var _0x10d12f=_['keys'](db[_0x4d0b('0x5a')][_0x4d0b('0x30')]);return db['CmCustomField'][_0x4d0b('0x49')]({'raw':!![],'attributes':['id',_0x4d0b('0x6c')]})[_0x4d0b('0x26')](function(_0x25fa52){_0x5d6f9d=_0x25fa52;var _0x537651=squel[_0x4d0b('0x6d')]()[_0x4d0b('0x3a')](_0x10d12f)[_0x4d0b('0x6e')]('cm_contacts','c')[_0x4d0b('0x41')]('c.ListId\x20=\x20?',_0x33cb16)['where'](_0x4d0b('0x6f'))[_0x4d0b('0x70')]();for(var _0x370369=0x0;_0x370369<_0x5d6f9d[_0x4d0b('0x3c')];_0x370369++){_0x537651['field'](_0x4d0b('0x71')+_0x5d6f9d[_0x370369]['id'],'customField_'+_0x5d6f9d[_0x370369][_0x4d0b('0x6c')]);}for(var _0x370369=0x0;_0x370369<_0x27eb61[_0x4d0b('0x3c')];_0x370369++){_0x537651[_0x4d0b('0x72')](squel[_0x4d0b('0x6d')]()[_0x4d0b('0x72')](_0x4d0b('0x73'))[_0x4d0b('0x6e')](_0x4d0b('0x74'))['where']('ItemTypeId\x20=\x20?',_0x27eb61[_0x370369]['id'])['where']('CmContactId\x20=\x20c.id'),_0x4d0b('0x75')+_0x27eb61[_0x370369][_0x4d0b('0x2c')]);_0x537651[_0x4d0b('0x72')](squel[_0x4d0b('0x6d')]()[_0x4d0b('0x72')](_0x4d0b('0x76'))[_0x4d0b('0x6e')](_0x4d0b('0x74'))['where'](_0x4d0b('0x77'),_0x27eb61[_0x370369]['id'])[_0x4d0b('0x41')](_0x4d0b('0x78')),_0x4d0b('0x79')+_0x27eb61[_0x370369][_0x4d0b('0x2c')]);}var _0x4299fc=[];_0x4299fc[_0x4d0b('0x5e')](_0x537651[_0x4d0b('0x7a')]());BPromise[_0x4d0b('0x5f')](_0x4299fc,handleQuery)[_0x4d0b('0x26')](function(_0x34f562){handleQuery(_0x537651[_0x4d0b('0x7a')]());var _0xe4f11b=csv_results[0x0];if(!_[_0x4d0b('0x7b')](_0xe4f11b)){var _0x1c9282=toCsv(_0xe4f11b);var _0x3805b2=Date['now']();fs['writeFileSync'](util[_0x4d0b('0x7c')](_0x4d0b('0x7d'),_0x33cb16,_0x3805b2),_0x1c9282);_0x4ca1b6['setHeader'](_0x4d0b('0x7e'),'attachment;\x20filename='+util[_0x4d0b('0x7c')](_0x4d0b('0x7f'),_0x33cb16,_0x3805b2));_0x4ca1b6[_0x4d0b('0x80')](_0x4d0b('0x81'),_0x4d0b('0x82'));return _0x4ca1b6[_0x4d0b('0x83')](util[_0x4d0b('0x7c')]('/tmp/list_%d_%s.csv',_0x33cb16,_0x3805b2));}else{return _0x4ca1b6[_0x4d0b('0x29')](0xcc);}});});});};exports[_0x4d0b('0x84')]=function(_0x167cc7,_0x76b512,_0x5edc8f){var _0x3398ac;delete _0x167cc7[_0x4d0b('0x55')]['id'];return db[_0x4d0b('0x2f')][_0x4d0b('0x85')]({'where':{'id':_0x167cc7[_0x4d0b('0x4c')]['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x76b512,null))['then'](function(_0x53d624){if(_0x53d624){return db['sequelize'][_0x4d0b('0x86')](function(_0x503ea0){return db['CmCustomField'][_0x4d0b('0x4e')](_0x167cc7[_0x4d0b('0x55')],{'transaction':_0x503ea0})[_0x4d0b('0x26')](function(_0x109a0d){_0x3398ac=_0x109a0d;return _0x53d624['addCustomFields'](_0x109a0d,{'transaction':_0x503ea0});})[_0x4d0b('0x26')](function(){var _0x3dc534={'type':db[_0x4d0b('0x87')][_0x4d0b('0x88')],'transaction':_0x503ea0};switch(_0x167cc7['body'][_0x4d0b('0x32')]){case'text':_0x3dc534[_0x4d0b('0x32')]=db[_0x4d0b('0x87')]['TEXT'];break;case _0x4d0b('0x89'):_0x3dc534[_0x4d0b('0x32')]=db[_0x4d0b('0x87')][_0x4d0b('0x8a')];break;case _0x4d0b('0x8b'):_0x3dc534['type']=db['Sequelize']['BOOLEAN'];_0x3dc534['defaultValue']=![];break;default:}return db['sequelize'][_0x4d0b('0x8c')][_0x4d0b('0x8d')](_0x4d0b('0x8e'),util['format'](_0x4d0b('0x8f'),_0x3398ac['id']),_0x3dc534);})[_0x4d0b('0x26')](function(){return _0x3398ac;});});}})['then'](respondWithResult(_0x76b512,null))[_0x4d0b('0x4b')](handleError(_0x76b512,null));};exports[_0x4d0b('0x90')]=function(_0x10ff7f,_0x227b96,_0x5764bd){var _0x163c38={};var _0x165161={};var _0x5cf7e2;var _0x304584;return db[_0x4d0b('0x2f')][_0x4d0b('0x85')]({'where':{'id':_0x10ff7f['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x227b96,null))[_0x4d0b('0x26')](function(_0x5123f9){if(_0x5123f9){_0x5cf7e2=_0x5123f9;_0x165161[_0x4d0b('0x34')]=_['keys'](db['CmCustomField'][_0x4d0b('0x30')]);_0x165161[_0x4d0b('0x36')]=_['keys'](_0x10ff7f['query']);_0x165161['filters']=_[_0x4d0b('0x39')](_0x165161[_0x4d0b('0x34')],_0x165161[_0x4d0b('0x36')]);_0x163c38['attributes']=_['intersection'](_0x165161[_0x4d0b('0x34')],qs[_0x4d0b('0x3a')](_0x10ff7f['query'][_0x4d0b('0x3a')]));_0x163c38[_0x4d0b('0x3b')]=_0x163c38[_0x4d0b('0x3b')]['length']?_0x163c38['attributes']:_0x165161[_0x4d0b('0x34')];_0x163c38[_0x4d0b('0x3f')]=qs[_0x4d0b('0x40')](_0x10ff7f['query'][_0x4d0b('0x40')]);_0x163c38[_0x4d0b('0x41')]=qs['filters'](_[_0x4d0b('0x42')](_0x10ff7f[_0x4d0b('0x36')],_0x165161[_0x4d0b('0x38')]));_0x163c38[_0x4d0b('0x41')]=_[_0x4d0b('0x45')](_0x163c38[_0x4d0b('0x41')],{'$or':[{'ListId':_0x5123f9['id']},{'ListId':null}]});if(_0x10ff7f['query'][_0x4d0b('0x43')]){_0x163c38[_0x4d0b('0x41')]=_['merge'](_0x163c38['where'],{'$or':_['map'](_0x163c38[_0x4d0b('0x3b')],function(_0x38fb2a){var _0x567f85={};_0x567f85[_0x38fb2a]={'$like':'%'+_0x10ff7f[_0x4d0b('0x36')][_0x4d0b('0x43')]+'%'};return _0x567f85;})});}_0x163c38=_[_0x4d0b('0x45')]({},_0x163c38,_0x10ff7f[_0x4d0b('0x46')]);return db[_0x4d0b('0x65')]['findAndCountAll'](_0x163c38);}})['then'](respondWithResult(_0x227b96,null))['catch'](handleError(_0x227b96,null));};exports[_0x4d0b('0x91')]=function(_0x175ffa,_0x4a9e1b){return db[_0x4d0b('0x65')][_0x4d0b('0x92')]({'where':{'ListId':null}})[_0x4d0b('0x26')](handleEntityNotFound(_0x4a9e1b,null))[_0x4d0b('0x26')](function(_0x1bf470){return _0x1bf470;})[_0x4d0b('0x26')](respondWithResult(_0x4a9e1b,null))[_0x4d0b('0x4b')](handleError(_0x4a9e1b,null));};exports[_0x4d0b('0x93')]=function(_0x4879ce,_0x472a7e,_0x5bbf26){return db[_0x4d0b('0x2f')][_0x4d0b('0x4d')]({'where':{'id':_0x4879ce['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x472a7e,null))[_0x4d0b('0x26')](function(_0x34c12b){if(_0x34c12b){return _0x34c12b[_0x4d0b('0x93')](_0x4879ce[_0x4d0b('0x55')][_0x4d0b('0x60')],_[_0x4d0b('0x94')](_0x4879ce[_0x4d0b('0x55')],[_0x4d0b('0x60'),'id'])||{})[_0x4d0b('0x95')](function(_0x130e3a){for(var _0x5b690b=0x0;_0x5b690b<_0x4879ce[_0x4d0b('0x55')][_0x4d0b('0x60')][_0x4d0b('0x3c')];_0x5b690b+=0x1){socket[_0x4d0b('0x96')](_0x4d0b('0x97'),{'UserId':Number(_0x4879ce[_0x4d0b('0x55')]['ids'][_0x5b690b]),'CmListId':Number(_0x4879ce['params']['id'])});}return _0x130e3a;});}})['then'](respondWithResult(_0x472a7e,null))[_0x4d0b('0x4b')](handleError(_0x472a7e,null));};exports[_0x4d0b('0x98')]=function(_0x520887,_0x2fd74f,_0x1ddfb){return db[_0x4d0b('0x2f')][_0x4d0b('0x4d')]({'where':{'id':_0x520887['params']['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x2fd74f,null))[_0x4d0b('0x26')](function(_0x1dfd69){if(_0x1dfd69){return _0x1dfd69[_0x4d0b('0x98')](_0x520887['query']['ids'])['then'](function(){if(_[_0x4d0b('0x5d')](_0x520887[_0x4d0b('0x36')][_0x4d0b('0x60')])){for(var _0x1de0e2=0x0;_0x1de0e2<_0x520887['query']['ids'][_0x4d0b('0x3c')];_0x1de0e2+=0x1){socket[_0x4d0b('0x96')](_0x4d0b('0x99'),{'UserId':Number(_0x520887[_0x4d0b('0x36')][_0x4d0b('0x60')][_0x1de0e2]),'CmListId':Number(_0x520887[_0x4d0b('0x4c')]['id'])});}}else{socket[_0x4d0b('0x96')](_0x4d0b('0x99'),{'UserId':Number(_0x520887[_0x4d0b('0x36')]['ids']),'CmListId':Number(_0x520887[_0x4d0b('0x4c')]['id'])});}});}})[_0x4d0b('0x26')](respondWithStatusCode(_0x2fd74f,null))[_0x4d0b('0x4b')](handleError(_0x2fd74f,null));};exports[_0x4d0b('0x9a')]=function(_0x29d88e,_0x4e91fc,_0x442aab){var _0x5ec22c={};var _0x2d80ad={};var _0x1ebbbb;var _0x1b7efa;return db[_0x4d0b('0x2f')]['findOne']({'where':{'id':_0x29d88e[_0x4d0b('0x4c')]['id']}})[_0x4d0b('0x26')](handleEntityNotFound(_0x4e91fc,null))['then'](function(_0x23d919){if(_0x23d919){_0x1ebbbb=_0x23d919;_0x2d80ad[_0x4d0b('0x34')]=_[_0x4d0b('0x37')](db[_0x4d0b('0x9b')][_0x4d0b('0x30')]);_0x2d80ad['query']=_[_0x4d0b('0x37')](_0x29d88e['query']);_0x2d80ad[_0x4d0b('0x38')]=_[_0x4d0b('0x39')](_0x2d80ad[_0x4d0b('0x34')],_0x2d80ad[_0x4d0b('0x36')]);_0x5ec22c['attributes']=_[_0x4d0b('0x39')](_0x2d80ad[_0x4d0b('0x34')],qs[_0x4d0b('0x3a')](_0x29d88e['query']['fields']));_0x5ec22c[_0x4d0b('0x3b')]=_0x5ec22c[_0x4d0b('0x3b')]['length']?_0x5ec22c['attributes']:_0x2d80ad[_0x4d0b('0x34')];_0x5ec22c[_0x4d0b('0x3f')]=qs[_0x4d0b('0x40')](_0x29d88e[_0x4d0b('0x36')][_0x4d0b('0x40')]);_0x5ec22c[_0x4d0b('0x41')]=qs[_0x4d0b('0x38')](_[_0x4d0b('0x42')](_0x29d88e[_0x4d0b('0x36')],_0x2d80ad[_0x4d0b('0x38')]));if(_0x29d88e['query'][_0x4d0b('0x43')]){_0x5ec22c[_0x4d0b('0x41')]=_[_0x4d0b('0x45')](_0x5ec22c['where'],{'$or':_['map'](_0x5ec22c[_0x4d0b('0x3b')],function(_0x4d93a4){var _0x31b7fb={};_0x31b7fb[_0x4d93a4]={'$like':'%'+_0x29d88e[_0x4d0b('0x36')][_0x4d0b('0x43')]+'%'};return _0x31b7fb;})});}_0x5ec22c=_[_0x4d0b('0x45')]({},_0x5ec22c,_0x29d88e[_0x4d0b('0x46')]);return _0x1ebbbb[_0x4d0b('0x9a')](_0x5ec22c);}})[_0x4d0b('0x26')](function(_0x9d1bf6){if(_0x9d1bf6){_0x1b7efa=_0x9d1bf6[_0x4d0b('0x3c')];if(!_0x29d88e['query']['hasOwnProperty']('nolimit')){_0x5ec22c['limit']=qs[_0x4d0b('0x1e')](_0x29d88e['query']['limit']);_0x5ec22c[_0x4d0b('0x1b')]=qs['offset'](_0x29d88e[_0x4d0b('0x36')][_0x4d0b('0x1b')]);}return _0x1ebbbb[_0x4d0b('0x9a')](_0x5ec22c);}})[_0x4d0b('0x26')](function(_0x14df31){if(_0x14df31){return _0x14df31?{'count':_0x1b7efa,'rows':_0x14df31}:null;}})[_0x4d0b('0x26')](respondWithResult(_0x4e91fc,null))[_0x4d0b('0x4b')](handleError(_0x4e91fc,null));};function handleQuery(_0x523359){logger['info'](_0x523359);return db[_0x4d0b('0x9c')][_0x4d0b('0x36')](_0x523359)['spread'](function(_0x496cb0){csv_results[_0x4d0b('0x5e')](_0x496cb0);})[_0x4d0b('0x4b')](function(_0x47ad27){logger['error'](_0x47ad27['message']);});} \ No newline at end of file +var _0x8261=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rows','removeDispositions','addContacts','CmContact','tags','join','push','each','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','distinct','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','field','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x8261,0x1df));var _0x1826=function(_0x5c34b4,_0x4eddbb){_0x5c34b4=_0x5c34b4-0x0;var _0x1a8a02=_0x8261[_0x5c34b4];return _0x1a8a02;};'use strict';var emlformat=require(_0x1826('0x0'));var rimraf=require(_0x1826('0x1'));var zipdir=require(_0x1826('0x2'));var jsonpatch=require(_0x1826('0x3'));var rp=require(_0x1826('0x4'));var moment=require(_0x1826('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1826('0x6'));var util=require(_0x1826('0x7'));var path=require(_0x1826('0x8'));var sox=require(_0x1826('0x9'));var csv=require(_0x1826('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1826('0xb'));var _=require('lodash');var squel=require(_0x1826('0xc'));var crypto=require(_0x1826('0xd'));var jsforce=require(_0x1826('0xe'));var deskjs=require(_0x1826('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1826('0x10'));var Papa=require(_0x1826('0x11'));var Redis=require(_0x1826('0x12'));var authService=require(_0x1826('0x13'));var qs=require(_0x1826('0x14'));var as=require(_0x1826('0x15'));var hardwareService=require(_0x1826('0x16'));var logger=require(_0x1826('0x17'))('api');var utils=require(_0x1826('0x18'));var config=require(_0x1826('0x19'));var licenseUtil=require(_0x1826('0x1a'));var db=require(_0x1826('0x1b'))['db'];var csv_results;config[_0x1826('0x1c')]=_['defaults'](config[_0x1826('0x1c')],{'host':_0x1826('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1826('0x1c')]));require('./cmList.socket')[_0x1826('0x1e')](socket);function respondWithStatusCode(_0x196397,_0x9f8635){_0x9f8635=_0x9f8635||0xcc;return function(_0x385c6a){if(_0x385c6a){return _0x196397[_0x1826('0x1f')](_0x9f8635);}return _0x196397[_0x1826('0x20')](_0x9f8635)[_0x1826('0x21')]();};}function respondWithResult(_0x278e3f,_0x4a9b70){_0x4a9b70=_0x4a9b70||0xc8;return function(_0x1ff25c){if(_0x1ff25c){return _0x278e3f['status'](_0x4a9b70)[_0x1826('0x22')](_0x1ff25c);}};}function respondWithFilteredResult(_0x4db90e,_0x5cc433){return function(_0x5329b5){if(_0x5329b5){var _0x39f716=typeof _0x5cc433[_0x1826('0x23')]===_0x1826('0x24')&&typeof _0x5cc433['limit']===_0x1826('0x24');var _0x4c052f=_0x5329b5['count'];var _0x446ebd=_0x39f716?0x0:_0x5cc433[_0x1826('0x23')];var _0x5c3458=_0x39f716?_0x5329b5[_0x1826('0x25')]:_0x5cc433[_0x1826('0x23')]+_0x5cc433[_0x1826('0x26')];var _0xeea31;if(_0x5c3458>=_0x4c052f){_0x5c3458=_0x4c052f;_0xeea31=0xc8;}else{_0xeea31=0xce;}_0x4db90e[_0x1826('0x20')](_0xeea31);return _0x4db90e[_0x1826('0x27')](_0x1826('0x28'),_0x446ebd+'-'+_0x5c3458+'/'+_0x4c052f)[_0x1826('0x22')](_0x5329b5);}return null;};}function patchUpdates(_0x9cc056){return function(_0x3e1000){try{jsonpatch[_0x1826('0x29')](_0x3e1000,_0x9cc056,!![]);}catch(_0x422247){return BPromise[_0x1826('0x2a')](_0x422247);}return _0x3e1000[_0x1826('0x2b')]();};}function saveUpdates(_0x7a6098,_0x3b4ac0){return function(_0x42c103){if(_0x42c103){return _0x42c103[_0x1826('0x2c')](_0x7a6098)['then'](function(_0x12432b){return _0x12432b;});}return null;};}function removeEntity(_0x1f0fef,_0x1ba9df){return function(_0x2b2e77){if(_0x2b2e77){return _0x2b2e77[_0x1826('0x2d')]()[_0x1826('0x2e')](function(){var _0x34c623=_0x2b2e77[_0x1826('0x2f')]({'plain':!![]});var _0x335e46=_0x1826('0x30');return db[_0x1826('0x31')]['destroy']({'where':{'type':_0x335e46,'resourceId':_0x34c623['id']}})['then'](function(){return _0x2b2e77;});})[_0x1826('0x2e')](function(){_0x1f0fef['status'](0xcc)[_0x1826('0x21')]();});}};}function handleEntityNotFound(_0x42d805,_0x3dff05){return function(_0x275ab0){if(!_0x275ab0){_0x42d805[_0x1826('0x1f')](0x194);}return _0x275ab0;};}function handleError(_0x57de9e,_0x382b7b){_0x382b7b=_0x382b7b||0x1f4;return function(_0x3c86bd){logger[_0x1826('0x32')](_0x3c86bd[_0x1826('0x33')]);if(_0x3c86bd[_0x1826('0x34')]){delete _0x3c86bd[_0x1826('0x34')];}_0x57de9e['status'](_0x382b7b)[_0x1826('0x35')](_0x3c86bd);};}exports[_0x1826('0x36')]=function(_0x17e5a6,_0x242e5d){var _0x886109={},_0x3b0a9d={},_0x4b2694={'count':0x0,'rows':[]};var _0x2d0bbd=_['map'](db[_0x1826('0x37')][_0x1826('0x38')],function(_0x9f7d26){return{'name':_0x9f7d26[_0x1826('0x39')],'type':_0x9f7d26[_0x1826('0x3a')]['key']};});_0x3b0a9d[_0x1826('0x3b')]=_[_0x1826('0x3c')](_0x2d0bbd,'name');_0x3b0a9d['query']=_['keys'](_0x17e5a6[_0x1826('0x3d')]);_0x3b0a9d[_0x1826('0x3e')]=_[_0x1826('0x3f')](_0x3b0a9d[_0x1826('0x3b')],_0x3b0a9d[_0x1826('0x3d')]);_0x886109[_0x1826('0x40')]=_[_0x1826('0x3f')](_0x3b0a9d['model'],qs[_0x1826('0x41')](_0x17e5a6['query']['fields']));_0x886109[_0x1826('0x40')]=_0x886109[_0x1826('0x40')][_0x1826('0x42')]?_0x886109['attributes']:_0x3b0a9d['model'];if(!_0x17e5a6[_0x1826('0x3d')][_0x1826('0x43')](_0x1826('0x44'))){_0x886109[_0x1826('0x26')]=qs['limit'](_0x17e5a6[_0x1826('0x3d')]['limit']);_0x886109[_0x1826('0x23')]=qs['offset'](_0x17e5a6[_0x1826('0x3d')][_0x1826('0x23')]);}_0x886109[_0x1826('0x45')]=qs[_0x1826('0x46')](_0x17e5a6[_0x1826('0x3d')][_0x1826('0x46')]);_0x886109[_0x1826('0x47')]=qs[_0x1826('0x3e')](_[_0x1826('0x48')](_0x17e5a6[_0x1826('0x3d')],_0x3b0a9d[_0x1826('0x3e')]),_0x2d0bbd);if(_0x17e5a6['query']['filter']){_0x886109[_0x1826('0x47')]=_[_0x1826('0x49')](_0x886109[_0x1826('0x47')],{'$or':_['map'](_0x2d0bbd,function(_0x395b0f){if(_0x395b0f[_0x1826('0x3a')]!==_0x1826('0x4a')){var _0x47e3e3={};_0x47e3e3[_0x395b0f[_0x1826('0x34')]]={'$like':'%'+_0x17e5a6[_0x1826('0x3d')][_0x1826('0x4b')]+'%'};return _0x47e3e3;}})});}_0x886109=_['merge']({},_0x886109,_0x17e5a6[_0x1826('0x4c')]);var _0x44209b={'where':_0x886109[_0x1826('0x47')]};return db[_0x1826('0x37')][_0x1826('0x25')](_0x44209b)[_0x1826('0x2e')](function(_0x4f788a){_0x4b2694[_0x1826('0x25')]=_0x4f788a;if(_0x17e5a6['query'][_0x1826('0x4d')]){_0x886109['include']=[{'all':!![]}];}return db[_0x1826('0x37')][_0x1826('0x4e')](_0x886109);})[_0x1826('0x2e')](function(_0x5ac514){_0x4b2694['rows']=_0x5ac514;return _0x4b2694;})['then'](respondWithFilteredResult(_0x242e5d,_0x886109))['catch'](handleError(_0x242e5d,null));};exports[_0x1826('0x4f')]=function(_0x453a20,_0x2df1ee){var _0x1c5e36={'raw':![],'where':{'id':_0x453a20[_0x1826('0x50')]['id']}},_0x3f9f80={};_0x3f9f80['model']=_[_0x1826('0x51')](db['CmList'][_0x1826('0x38')]);_0x3f9f80[_0x1826('0x3d')]=_[_0x1826('0x51')](_0x453a20[_0x1826('0x3d')]);_0x3f9f80['filters']=_[_0x1826('0x3f')](_0x3f9f80[_0x1826('0x3b')],_0x3f9f80['query']);_0x1c5e36[_0x1826('0x40')]=_['intersection'](_0x3f9f80[_0x1826('0x3b')],qs[_0x1826('0x41')](_0x453a20[_0x1826('0x3d')]['fields']));_0x1c5e36[_0x1826('0x40')]=_0x1c5e36[_0x1826('0x40')][_0x1826('0x42')]?_0x1c5e36['attributes']:_0x3f9f80[_0x1826('0x3b')];if(_0x453a20['query'][_0x1826('0x4d')]){_0x1c5e36[_0x1826('0x52')]=[{'all':!![]}];}_0x1c5e36=_[_0x1826('0x49')]({},_0x1c5e36,_0x453a20[_0x1826('0x4c')]);return db[_0x1826('0x37')][_0x1826('0x53')](_0x1c5e36)[_0x1826('0x2e')](handleEntityNotFound(_0x2df1ee,null))[_0x1826('0x2e')](respondWithResult(_0x2df1ee,null))['catch'](handleError(_0x2df1ee,null));};exports[_0x1826('0x54')]=function(_0x16e4eb,_0x48531f){return db[_0x1826('0x37')][_0x1826('0x54')](_0x16e4eb['body'],{})['then'](function(_0x24caa2){var _0x3ca09e=_0x16e4eb['user'][_0x1826('0x2f')]({'plain':!![]});if(!_0x3ca09e)throw new Error(_0x1826('0x55'));if(_0x3ca09e[_0x1826('0x56')]==='user'){var _0x20ea34=_0x24caa2[_0x1826('0x2f')]({'plain':!![]});var _0x17829a='Lists';return db[_0x1826('0x57')][_0x1826('0x53')]({'where':{'name':_0x17829a,'userProfileId':_0x3ca09e[_0x1826('0x58')]},'raw':!![]})[_0x1826('0x2e')](function(_0x10a1fc){if(_0x10a1fc&&_0x10a1fc[_0x1826('0x59')]===0x0){return db[_0x1826('0x31')]['create']({'name':_0x20ea34[_0x1826('0x34')],'resourceId':_0x20ea34['id'],'type':_0x10a1fc[_0x1826('0x34')],'sectionId':_0x10a1fc['id']},{})[_0x1826('0x2e')](function(){return _0x24caa2;});}else{return _0x24caa2;}})[_0x1826('0x5a')](function(_0x312988){logger[_0x1826('0x32')](_0x1826('0x5b'),_0x312988);throw _0x312988;});}return _0x24caa2;})['then'](respondWithResult(_0x48531f,0xc9))['catch'](handleError(_0x48531f,null));};exports['update']=function(_0x543174,_0x412e41){if(_0x543174[_0x1826('0x5c')]['id']){delete _0x543174[_0x1826('0x5c')]['id'];}return db[_0x1826('0x37')][_0x1826('0x53')]({'where':{'id':_0x543174[_0x1826('0x50')]['id']}})['then'](handleEntityNotFound(_0x412e41,null))['then'](saveUpdates(_0x543174[_0x1826('0x5c')],null))[_0x1826('0x2e')](respondWithResult(_0x412e41,null))['catch'](handleError(_0x412e41,null));};exports[_0x1826('0x2d')]=function(_0x2bfc59,_0x24c514){return db['CmList']['find']({'where':{'id':_0x2bfc59[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x24c514,null))[_0x1826('0x2e')](removeEntity(_0x24c514,null))['catch'](handleError(_0x24c514,null));};exports['describe']=function(_0x45e783,_0x573114){return db[_0x1826('0x37')][_0x1826('0x5d')]()[_0x1826('0x2e')](respondWithResult(_0x573114,null))['catch'](handleError(_0x573114,null));};exports[_0x1826('0x5e')]=function(_0x3d739e,_0x3b093c,_0x184092){if(_0x3d739e[_0x1826('0x5c')]['id']){delete _0x3d739e[_0x1826('0x5c')]['id'];}return db[_0x1826('0x37')][_0x1826('0x53')]({'where':{'id':_0x3d739e[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x3b093c,null))[_0x1826('0x2e')](function(_0xd53eb){if(_0xd53eb){_0x3d739e[_0x1826('0x5c')][_0x1826('0x5f')]=_0xd53eb['id'];return db[_0x1826('0x60')]['create'](_0x3d739e[_0x1826('0x5c')]);}})[_0x1826('0x2e')](respondWithResult(_0x3b093c,null))[_0x1826('0x5a')](handleError(_0x3b093c,null));};exports[_0x1826('0x61')]=function(_0xcf8843,_0x4368a1,_0x225f31){var _0x139b9e={'raw':![],'where':{}};var _0x3370dc={};var _0x119227={'count':0x0,'rows':[]};return db[_0x1826('0x37')][_0x1826('0x62')]({'where':{'id':_0xcf8843['params']['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x4368a1,null))[_0x1826('0x2e')](function(_0x46b19e){if(_0x46b19e){_0x3370dc[_0x1826('0x3b')]=_['keys'](db[_0x1826('0x60')]['rawAttributes']);_0x3370dc[_0x1826('0x3d')]=_[_0x1826('0x51')](_0xcf8843[_0x1826('0x3d')]);_0x3370dc['filters']=_[_0x1826('0x3f')](_0x3370dc['model'],_0x3370dc[_0x1826('0x3d')]);_0x139b9e[_0x1826('0x40')]=_[_0x1826('0x3f')](_0x3370dc['model'],qs[_0x1826('0x41')](_0xcf8843[_0x1826('0x3d')][_0x1826('0x41')]));_0x139b9e[_0x1826('0x40')]=_0x139b9e['attributes'][_0x1826('0x42')]?_0x139b9e[_0x1826('0x40')]:_0x3370dc[_0x1826('0x3b')];if(!_0xcf8843['query'][_0x1826('0x43')](_0x1826('0x44'))){_0x139b9e[_0x1826('0x26')]=qs[_0x1826('0x26')](_0xcf8843[_0x1826('0x3d')][_0x1826('0x26')]);_0x139b9e[_0x1826('0x23')]=qs[_0x1826('0x23')](_0xcf8843[_0x1826('0x3d')][_0x1826('0x23')]);}_0x139b9e[_0x1826('0x45')]=qs['sort'](_0xcf8843[_0x1826('0x3d')][_0x1826('0x46')]);_0x139b9e[_0x1826('0x47')]=qs[_0x1826('0x3e')](_[_0x1826('0x48')](_0xcf8843[_0x1826('0x3d')],_0x3370dc[_0x1826('0x3e')]));_0x139b9e[_0x1826('0x47')]['ListId']=_0x46b19e['id'];if(_0xcf8843[_0x1826('0x3d')][_0x1826('0x4b')]){_0x139b9e[_0x1826('0x47')]=_['merge'](_0x139b9e[_0x1826('0x47')],{'$or':_[_0x1826('0x3c')](_0x139b9e['attributes'],function(_0x1ba71e){var _0xc82899={};_0xc82899[_0x1ba71e]={'$like':'%'+_0xcf8843[_0x1826('0x3d')][_0x1826('0x4b')]+'%'};return _0xc82899;})});}_0x139b9e=_[_0x1826('0x49')]({},_0x139b9e,_0xcf8843[_0x1826('0x4c')]);return db['Disposition'][_0x1826('0x25')]({'where':_0x139b9e[_0x1826('0x47')]})[_0x1826('0x2e')](function(_0x2a2308){_0x119227[_0x1826('0x25')]=_0x2a2308;if(_0xcf8843['query']['includeAll']){_0x139b9e['include']=[{'all':!![]}];}return db[_0x1826('0x60')]['findAll'](_0x139b9e);})[_0x1826('0x2e')](function(_0x3eeab8){_0x119227[_0x1826('0x63')]=_0x3eeab8;return _0x119227;});}})['then'](respondWithFilteredResult(_0x4368a1,_0x139b9e))[_0x1826('0x5a')](handleError(_0x4368a1,null));};exports[_0x1826('0x64')]=function(_0x31a53d,_0x22e362,_0x5eef96){return db[_0x1826('0x37')][_0x1826('0x53')]({'where':{'id':_0x31a53d[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x22e362,null))[_0x1826('0x2e')](function(_0x486956){if(_0x486956){return _0x486956[_0x1826('0x64')](_0x31a53d[_0x1826('0x3d')]['ids']);}})[_0x1826('0x2e')](respondWithStatusCode(_0x22e362,null))[_0x1826('0x5a')](handleError(_0x22e362,null));};exports[_0x1826('0x65')]=function(_0x184059,_0x36a9b7,_0x40e336){return db[_0x1826('0x37')]['find']({'where':{'id':_0x184059[_0x1826('0x50')]['id']}})['then'](handleEntityNotFound(_0x36a9b7,null))[_0x1826('0x2e')](function(_0x36152f){if(_0x36152f){var _0x15264d=[];var _0x4ff8bd={'success':[],'errors':[]};return db[_0x1826('0x66')][_0x1826('0x5d')]()[_0x1826('0x2e')](function(_0xaa15fd){if(_0x184059[_0x1826('0x5c')]['tags']&&_['isArray'](_0x184059['body'][_0x1826('0x67')])){if(_0x184059[_0x1826('0x5c')]['tags'][_0x1826('0x42')]){_0x184059[_0x1826('0x5c')][_0x1826('0x67')]=_0x184059[_0x1826('0x5c')]['tags'][_0x1826('0x68')](';')+';';}else{_0x184059[_0x1826('0x5c')][_0x1826('0x67')]=null;}}else{_0x184059['body']['tags']=null;}if(_0x184059['body']&&_['isArray'](_0x184059[_0x1826('0x5c')])){for(var _0x4c8909=0x0;_0x4c8909<_0x184059[_0x1826('0x5c')]['length'];_0x4c8909+=0x1){_0x184059[_0x1826('0x5c')][_0x4c8909]['ListId']=_0x184059[_0x1826('0x50')]['id'];_0x15264d[_0x1826('0x69')](_0x184059[_0x1826('0x5c')][_0x4c8909]);}return BPromise[_0x1826('0x6a')](_0x15264d,function(_0x3c58d4){return db[_0x1826('0x66')]['create'](_['omit'](_0x3c58d4,[_0x1826('0x6b'),'id'])||{},{'fields':_[_0x1826('0x51')](_0xaa15fd),'raw':!![]})['then'](function(_0x90dad2){_0x4ff8bd[_0x1826('0x6c')][_0x1826('0x69')](_0x90dad2[_0x1826('0x6d')]);})[_0x1826('0x5a')](function(_0x37fab6){_0x4ff8bd[_0x1826('0x6e')][_0x1826('0x69')]({'data':_0x3c58d4,'error':_0x37fab6[_0x1826('0x6f')]});});})['then'](function(_0x1a70d9){return _0x4ff8bd;})[_0x1826('0x5a')](function(_0xb4e265){return _0xb4e265;});}else{_0x36a9b7['status'](0x190)[_0x1826('0x22')]({'message':_0x1826('0x70')});}});}})[_0x1826('0x2e')](respondWithResult(_0x36a9b7,null))[_0x1826('0x5a')](handleError(_0x36a9b7,null));};exports[_0x1826('0x71')]=function(_0x207247,_0x4cd339,_0x495b15){var _0x1e85f7;return db[_0x1826('0x37')][_0x1826('0x53')]({'where':{'id':_0x207247[_0x1826('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x1826('0x72')}]})[_0x1826('0x2e')](handleEntityNotFound(_0x4cd339,null))[_0x1826('0x2e')](function(_0x43bbda){if(_0x43bbda){_0x1e85f7=_0x43bbda;return db[_0x1826('0x66')][_0x1826('0x38')];}})[_0x1826('0x2e')](function(_0x11a8fe){if(_0x11a8fe){var _0x4ecba2={};var _0x1557bc={};_0x1557bc[_0x1826('0x3b')]=_[_0x1826('0x73')](_['keys'](_0x11a8fe),_[_0x1826('0x3c')](_0x1e85f7[_0x1826('0x72')],function(_0x122a73){return util[_0x1826('0x74')](_0x1826('0x75'),_0x122a73['id']);}));_0x1557bc[_0x1826('0x3d')]=_['keys'](_0x207247['query']);_0x1557bc[_0x1826('0x3e')]=_[_0x1826('0x3f')](_0x1557bc['model'],_0x1557bc[_0x1826('0x3d')]);_0x4ecba2[_0x1826('0x40')]=_[_0x1826('0x3f')](_0x1557bc['model'],qs[_0x1826('0x41')](_0x207247[_0x1826('0x3d')][_0x1826('0x41')]));_0x4ecba2['attributes']=_0x4ecba2[_0x1826('0x40')]['length']?_0x4ecba2[_0x1826('0x40')]:_0x1557bc[_0x1826('0x3b')];if(!_0x207247[_0x1826('0x3d')][_0x1826('0x43')](_0x1826('0x44'))){_0x4ecba2['limit']=qs[_0x1826('0x26')](_0x207247['query'][_0x1826('0x26')]);_0x4ecba2[_0x1826('0x23')]=qs['offset'](_0x207247['query'][_0x1826('0x23')]);}_0x4ecba2[_0x1826('0x45')]=qs['sort'](_0x207247['query'][_0x1826('0x46')]);_0x4ecba2[_0x1826('0x47')]=qs[_0x1826('0x3e')](_['pick'](_0x207247[_0x1826('0x3d')],_0x1557bc['filters']));_0x4ecba2[_0x1826('0x76')]=!![];if(_0x207247['query']['filter']){_0x4ecba2[_0x1826('0x47')]=_[_0x1826('0x49')](_0x4ecba2[_0x1826('0x47')],{'$or':_[_0x1826('0x3c')](_0x4ecba2[_0x1826('0x40')],function(_0xbbd4c4){var _0x455ae2={};_0x455ae2[_0xbbd4c4]={'$like':'%'+_0x207247[_0x1826('0x3d')][_0x1826('0x4b')]+'%'};return _0x455ae2;})});}_0x4ecba2=_[_0x1826('0x49')]({},_0x4ecba2,_0x207247[_0x1826('0x4c')]);return _0x1e85f7['getContacts'](_0x4ecba2);}})[_0x1826('0x2e')](respondWithResult(_0x4cd339,null))[_0x1826('0x5a')](handleError(_0x4cd339,null));};exports[_0x1826('0x77')]=function(_0x51531e,_0x29892a,_0x565d42){var _0x2ec6b1;var _0x4820a0;var _0x57b946;var _0x2575d0=_0x51531e[_0x1826('0x50')]['id'];csv_results=[];return db[_0x1826('0x78')][_0x1826('0x4e')]({'attributes':['id',_0x1826('0x34')],'raw':!![],'order':[_0x1826('0x79')]})[_0x1826('0x2e')](function(_0x2da47e){_0x2ec6b1=_0x2da47e;var _0x158654=_[_0x1826('0x51')](db[_0x1826('0x66')][_0x1826('0x38')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x1826('0x7a')]})['then'](function(_0x2a2484){_0x4820a0=_0x2a2484;var _0x599c2c=squel[_0x1826('0x7b')]()[_0x1826('0x41')](_0x158654)[_0x1826('0x7c')](_0x1826('0x7d'),'c')[_0x1826('0x47')]('c.ListId\x20=\x20?',_0x2575d0)[_0x1826('0x47')]('c.deletedAt\x20is\x20null')[_0x1826('0x7e')]();for(var _0x4446d5=0x0;_0x4446d5<_0x4820a0['length'];_0x4446d5++){_0x599c2c['field']('c.cf_'+_0x4820a0[_0x4446d5]['id'],_0x1826('0x7f')+_0x4820a0[_0x4446d5][_0x1826('0x7a')]);}for(var _0x4446d5=0x0;_0x4446d5<_0x2ec6b1[_0x1826('0x42')];_0x4446d5++){_0x599c2c['field'](squel[_0x1826('0x7b')]()['field'](_0x1826('0x80'))[_0x1826('0x7c')](_0x1826('0x81'))[_0x1826('0x47')](_0x1826('0x82'),_0x2ec6b1[_0x4446d5]['id'])[_0x1826('0x47')](_0x1826('0x83')),_0x1826('0x84')+_0x2ec6b1[_0x4446d5][_0x1826('0x34')]);_0x599c2c[_0x1826('0x85')](squel[_0x1826('0x7b')]()['field'](_0x1826('0x86'))[_0x1826('0x7c')](_0x1826('0x81'))[_0x1826('0x47')](_0x1826('0x82'),_0x2ec6b1[_0x4446d5]['id'])['where'](_0x1826('0x83')),_0x1826('0x87')+_0x2ec6b1[_0x4446d5][_0x1826('0x34')]);}var _0x13e242=[];_0x13e242[_0x1826('0x69')](_0x599c2c['toString']());BPromise[_0x1826('0x6a')](_0x13e242,handleQuery)[_0x1826('0x2e')](function(_0x4b055a){handleQuery(_0x599c2c[_0x1826('0x88')]());var _0x202084=csv_results[0x0];if(!_[_0x1826('0x89')](_0x202084)){var _0x261875=toCsv(_0x202084);var _0x5d1710=Date['now']();fs[_0x1826('0x8a')](util[_0x1826('0x74')](_0x1826('0x8b'),_0x2575d0,_0x5d1710),_0x261875);_0x29892a[_0x1826('0x8c')](_0x1826('0x8d'),'attachment;\x20filename='+util[_0x1826('0x74')](_0x1826('0x8e'),_0x2575d0,_0x5d1710));_0x29892a[_0x1826('0x8c')]('Content-type',_0x1826('0x8f'));return _0x29892a['download'](util[_0x1826('0x74')](_0x1826('0x8b'),_0x2575d0,_0x5d1710));}else{return _0x29892a[_0x1826('0x1f')](0xcc);}});});});};exports[_0x1826('0x90')]=function(_0x5ceec6,_0x52c1a6,_0x524030){var _0xd614d3;delete _0x5ceec6['body']['id'];return db[_0x1826('0x37')]['findOne']({'where':{'id':_0x5ceec6[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x52c1a6,null))[_0x1826('0x2e')](function(_0x38c608){if(_0x38c608){return db[_0x1826('0x91')][_0x1826('0x92')](function(_0x3f5ecd){return db[_0x1826('0x93')][_0x1826('0x54')](_0x5ceec6['body'],{'transaction':_0x3f5ecd})['then'](function(_0x5a2b37){_0xd614d3=_0x5a2b37;return _0x38c608[_0x1826('0x94')](_0x5a2b37,{'transaction':_0x3f5ecd});})[_0x1826('0x2e')](function(){var _0x502947={'type':db[_0x1826('0x95')][_0x1826('0x96')],'transaction':_0x3f5ecd};switch(_0x5ceec6[_0x1826('0x5c')]['type']){case'text':_0x502947[_0x1826('0x3a')]=db[_0x1826('0x95')][_0x1826('0x96')];break;case _0x1826('0x97'):_0x502947[_0x1826('0x3a')]=db[_0x1826('0x95')][_0x1826('0x98')];break;case _0x1826('0x99'):_0x502947[_0x1826('0x3a')]=db[_0x1826('0x95')]['BOOLEAN'];_0x502947['defaultValue']=![];break;default:}return db[_0x1826('0x91')][_0x1826('0x9a')][_0x1826('0x9b')](_0x1826('0x7d'),util['format'](_0x1826('0x9c'),_0xd614d3['id']),_0x502947);})[_0x1826('0x2e')](function(){return _0xd614d3;});});}})[_0x1826('0x2e')](respondWithResult(_0x52c1a6,null))[_0x1826('0x5a')](handleError(_0x52c1a6,null));};exports['getCustomFields']=function(_0x9b49aa,_0x710714,_0x55bb8e){var _0x228c29={};var _0x356de0={};var _0x4663d4;var _0x35ab74;return db[_0x1826('0x37')][_0x1826('0x62')]({'where':{'id':_0x9b49aa['params']['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x710714,null))[_0x1826('0x2e')](function(_0x5e5275){if(_0x5e5275){_0x4663d4=_0x5e5275;_0x356de0['model']=_[_0x1826('0x51')](db['CmCustomField'][_0x1826('0x38')]);_0x356de0[_0x1826('0x3d')]=_['keys'](_0x9b49aa['query']);_0x356de0[_0x1826('0x3e')]=_['intersection'](_0x356de0[_0x1826('0x3b')],_0x356de0[_0x1826('0x3d')]);_0x228c29[_0x1826('0x40')]=_['intersection'](_0x356de0['model'],qs[_0x1826('0x41')](_0x9b49aa[_0x1826('0x3d')][_0x1826('0x41')]));_0x228c29['attributes']=_0x228c29['attributes'][_0x1826('0x42')]?_0x228c29[_0x1826('0x40')]:_0x356de0[_0x1826('0x3b')];_0x228c29[_0x1826('0x45')]=qs[_0x1826('0x46')](_0x9b49aa[_0x1826('0x3d')][_0x1826('0x46')]);_0x228c29[_0x1826('0x47')]=qs['filters'](_['pick'](_0x9b49aa[_0x1826('0x3d')],_0x356de0[_0x1826('0x3e')]));_0x228c29[_0x1826('0x47')]=_[_0x1826('0x49')](_0x228c29['where'],{'$or':[{'ListId':_0x5e5275['id']},{'ListId':null}]});if(_0x9b49aa[_0x1826('0x3d')][_0x1826('0x4b')]){_0x228c29[_0x1826('0x47')]=_[_0x1826('0x49')](_0x228c29[_0x1826('0x47')],{'$or':_[_0x1826('0x3c')](_0x228c29[_0x1826('0x40')],function(_0x51afb3){var _0x830ea={};_0x830ea[_0x51afb3]={'$like':'%'+_0x9b49aa['query'][_0x1826('0x4b')]+'%'};return _0x830ea;})});}_0x228c29=_[_0x1826('0x49')]({},_0x228c29,_0x9b49aa[_0x1826('0x4c')]);return db[_0x1826('0x93')][_0x1826('0x9d')](_0x228c29);}})['then'](respondWithResult(_0x710714,null))[_0x1826('0x5a')](handleError(_0x710714,null));};exports[_0x1826('0x9e')]=function(_0x440cd8,_0x10cb6a){return db[_0x1826('0x93')][_0x1826('0x9d')]({'where':{'ListId':null}})[_0x1826('0x2e')](handleEntityNotFound(_0x10cb6a,null))[_0x1826('0x2e')](function(_0x411d5d){return _0x411d5d;})[_0x1826('0x2e')](respondWithResult(_0x10cb6a,null))[_0x1826('0x5a')](handleError(_0x10cb6a,null));};exports[_0x1826('0x9f')]=function(_0x339602,_0x4685f9,_0x78efb0){return db[_0x1826('0x37')][_0x1826('0x53')]({'where':{'id':_0x339602[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x4685f9,null))[_0x1826('0x2e')](function(_0x8a9499){if(_0x8a9499){return _0x8a9499[_0x1826('0x9f')](_0x339602[_0x1826('0x5c')][_0x1826('0x6b')],_[_0x1826('0xa0')](_0x339602[_0x1826('0x5c')],[_0x1826('0x6b'),'id'])||{})[_0x1826('0xa1')](function(_0x555e79){for(var _0x55393e=0x0;_0x55393e<_0x339602['body'][_0x1826('0x6b')]['length'];_0x55393e+=0x1){socket[_0x1826('0xa2')](_0x1826('0xa3'),{'UserId':Number(_0x339602['body'][_0x1826('0x6b')][_0x55393e]),'CmListId':Number(_0x339602[_0x1826('0x50')]['id'])});}return _0x555e79;});}})[_0x1826('0x2e')](respondWithResult(_0x4685f9,null))[_0x1826('0x5a')](handleError(_0x4685f9,null));};exports['removeAgents']=function(_0x4c56a6,_0x394d3f,_0x132040){return db[_0x1826('0x37')]['find']({'where':{'id':_0x4c56a6[_0x1826('0x50')]['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x394d3f,null))[_0x1826('0x2e')](function(_0x1a5acf){if(_0x1a5acf){return _0x1a5acf[_0x1826('0xa4')](_0x4c56a6[_0x1826('0x3d')][_0x1826('0x6b')])[_0x1826('0x2e')](function(){if(_[_0x1826('0xa5')](_0x4c56a6['query'][_0x1826('0x6b')])){for(var _0x4929e3=0x0;_0x4929e3<_0x4c56a6['query'][_0x1826('0x6b')][_0x1826('0x42')];_0x4929e3+=0x1){socket[_0x1826('0xa2')](_0x1826('0xa6'),{'UserId':Number(_0x4c56a6[_0x1826('0x3d')][_0x1826('0x6b')][_0x4929e3]),'CmListId':Number(_0x4c56a6[_0x1826('0x50')]['id'])});}}else{socket['emit'](_0x1826('0xa6'),{'UserId':Number(_0x4c56a6[_0x1826('0x3d')][_0x1826('0x6b')]),'CmListId':Number(_0x4c56a6[_0x1826('0x50')]['id'])});}});}})[_0x1826('0x2e')](respondWithStatusCode(_0x394d3f,null))[_0x1826('0x5a')](handleError(_0x394d3f,null));};exports[_0x1826('0xa7')]=function(_0x1c6742,_0x26281b,_0x20eb67){var _0x464ee7={};var _0x264be4={};var _0x202be0;var _0x424adc;return db[_0x1826('0x37')][_0x1826('0x62')]({'where':{'id':_0x1c6742['params']['id']}})[_0x1826('0x2e')](handleEntityNotFound(_0x26281b,null))[_0x1826('0x2e')](function(_0x26b58e){if(_0x26b58e){_0x202be0=_0x26b58e;_0x264be4['model']=_[_0x1826('0x51')](db[_0x1826('0xa8')]['rawAttributes']);_0x264be4[_0x1826('0x3d')]=_[_0x1826('0x51')](_0x1c6742[_0x1826('0x3d')]);_0x264be4['filters']=_[_0x1826('0x3f')](_0x264be4[_0x1826('0x3b')],_0x264be4[_0x1826('0x3d')]);_0x464ee7[_0x1826('0x40')]=_['intersection'](_0x264be4['model'],qs[_0x1826('0x41')](_0x1c6742[_0x1826('0x3d')][_0x1826('0x41')]));_0x464ee7['attributes']=_0x464ee7[_0x1826('0x40')]['length']?_0x464ee7['attributes']:_0x264be4[_0x1826('0x3b')];_0x464ee7[_0x1826('0x45')]=qs[_0x1826('0x46')](_0x1c6742[_0x1826('0x3d')][_0x1826('0x46')]);_0x464ee7[_0x1826('0x47')]=qs[_0x1826('0x3e')](_[_0x1826('0x48')](_0x1c6742[_0x1826('0x3d')],_0x264be4[_0x1826('0x3e')]));if(_0x1c6742['query'][_0x1826('0x4b')]){_0x464ee7[_0x1826('0x47')]=_['merge'](_0x464ee7[_0x1826('0x47')],{'$or':_[_0x1826('0x3c')](_0x464ee7[_0x1826('0x40')],function(_0x101898){var _0x32790f={};_0x32790f[_0x101898]={'$like':'%'+_0x1c6742[_0x1826('0x3d')][_0x1826('0x4b')]+'%'};return _0x32790f;})});}_0x464ee7=_[_0x1826('0x49')]({},_0x464ee7,_0x1c6742[_0x1826('0x4c')]);return _0x202be0[_0x1826('0xa7')](_0x464ee7);}})[_0x1826('0x2e')](function(_0x1b2306){if(_0x1b2306){_0x424adc=_0x1b2306[_0x1826('0x42')];if(!_0x1c6742[_0x1826('0x3d')][_0x1826('0x43')](_0x1826('0x44'))){_0x464ee7[_0x1826('0x26')]=qs[_0x1826('0x26')](_0x1c6742[_0x1826('0x3d')][_0x1826('0x26')]);_0x464ee7['offset']=qs[_0x1826('0x23')](_0x1c6742[_0x1826('0x3d')][_0x1826('0x23')]);}return _0x202be0[_0x1826('0xa7')](_0x464ee7);}})[_0x1826('0x2e')](function(_0x142ff6){if(_0x142ff6){return _0x142ff6?{'count':_0x424adc,'rows':_0x142ff6}:null;}})[_0x1826('0x2e')](respondWithResult(_0x26281b,null))['catch'](handleError(_0x26281b,null));};function handleQuery(_0x1a1cdd){logger[_0x1826('0xa9')](_0x1a1cdd);return db['sequelize']['query'](_0x1a1cdd)[_0x1826('0xa1')](function(_0x21e45c){csv_results[_0x1826('0x69')](_0x21e45c);})[_0x1826('0x5a')](function(_0x5687fe){logger[_0x1826('0x32')](_0x5687fe[_0x1826('0x6f')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ce431db..0a623e7 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1d5b68,_0x5540ba){var _0x2501c9=function(_0x29021){while(--_0x29021){_0x1d5b68['push'](_0x1d5b68['shift']());}};_0x2501c9(++_0x5540ba);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0xdb7eb4,_0x36875a){_0xdb7eb4=_0xdb7eb4-0x0;var _0x27f8a7=_0xe14b[_0xdb7eb4];return _0x27f8a7;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b34bf16..62a58da 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 _0xb4e6=['path','rimraf','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b9729,_0x195fff){var _0x23206b=function(_0x3c5950){while(--_0x3c5950){_0x1b9729['push'](_0x1b9729['shift']());}};_0x23206b(++_0x195fff);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xb4e6[_0x39872b];return _0x55fa18;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmList.attributes','define','CmList','cm_lists','../../config/logger','api','moment','bluebird'];(function(_0x5716a3,_0x3a5520){var _0xb38b1a=function(_0x4e00a9){while(--_0x4e00a9){_0x5716a3['push'](_0x5716a3['shift']());}};_0xb38b1a(++_0x3a5520);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 97cc236..74139e5 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 _0x2718=['catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3d0e7d,_0x3263ef){var _0x2eadfa=function(_0x20a124){while(--_0x20a124){_0x3d0e7d['push'](_0x3d0e7d['shift']());}};_0x2eadfa(++_0x3263ef);}(_0x2718,0xfb));var _0x8271=function(_0x8e19a8,_0x5ae9c3){_0x8e19a8=_0x8e19a8-0x0;var _0x1e33af=_0x2718[_0x8e19a8];return _0x1e33af;};'use strict';var _=require(_0x8271('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8271('0x1'));var fs=require('fs');var Redis=require(_0x8271('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8271('0x3'));var logger=require('../../config/logger')(_0x8271('0x4'));var config=require(_0x8271('0x5'));var jayson=require(_0x8271('0x6'));var client=jayson[_0x8271('0x7')][_0x8271('0x8')]({'port':0x232a});config[_0x8271('0x9')]=_[_0x8271('0xa')](config[_0x8271('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8271('0x9')]));require(_0x8271('0xb'))[_0x8271('0xc')](socket);function respondWithRpcPromise(_0x178872,_0x347b73,_0x4ff5a3){return new BPromise(function(_0x499fed,_0x5cd95f){return client[_0x8271('0xd')](_0x178872,_0x4ff5a3)[_0x8271('0xe')](function(_0x31a18e){logger[_0x8271('0xf')](_0x8271('0x10'),_0x347b73,_0x8271('0x11'));logger[_0x8271('0x12')](_0x8271('0x13'),_0x347b73,'request\x20sent',JSON['stringify'](_0x31a18e));if(_0x31a18e[_0x8271('0x14')]){if(_0x31a18e[_0x8271('0x14')][_0x8271('0x15')]===0x1f4){logger[_0x8271('0x14')](_0x8271('0x10'),_0x347b73,_0x31a18e[_0x8271('0x14')][_0x8271('0x16')]);return _0x5cd95f(_0x31a18e[_0x8271('0x14')][_0x8271('0x16')]);}logger[_0x8271('0x14')](_0x8271('0x10'),_0x347b73,_0x31a18e[_0x8271('0x14')][_0x8271('0x16')]);return _0x499fed(_0x31a18e[_0x8271('0x14')]['message']);}else{logger[_0x8271('0xf')](_0x8271('0x10'),_0x347b73,'request\x20sent');_0x499fed(_0x31a18e[_0x8271('0x17')][_0x8271('0x16')]);}})[_0x8271('0x18')](function(_0x40a234){logger[_0x8271('0x14')](_0x8271('0x10'),_0x347b73,_0x40a234);_0x5cd95f(_0x40a234);});});} \ No newline at end of file +var _0x8ec3=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ae342,_0x5a3626){var _0x5e7eb9=function(_0x17c36a){while(--_0x17c36a){_0x5ae342['push'](_0x5ae342['shift']());}};_0x5e7eb9(++_0x5a3626);}(_0x8ec3,0x131));var _0x38ec=function(_0x547c0a,_0x5b0ff9){_0x547c0a=_0x547c0a-0x0;var _0x52eb04=_0x8ec3[_0x547c0a];return _0x52eb04;};'use strict';var _=require('lodash');var util=require(_0x38ec('0x0'));var moment=require(_0x38ec('0x1'));var BPromise=require(_0x38ec('0x2'));var rs=require(_0x38ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38ec('0x4'))['db'];var utils=require(_0x38ec('0x5'));var logger=require(_0x38ec('0x6'))(_0x38ec('0x7'));var config=require(_0x38ec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x38ec('0x9')]({'port':0x232a});config[_0x38ec('0xa')]=_[_0x38ec('0xb')](config[_0x38ec('0xa')],{'host':_0x38ec('0xc'),'port':0x18eb});var socket=require(_0x38ec('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0x38ec('0xe')](socket);function respondWithRpcPromise(_0x3759d9,_0x2344c7,_0x5bcbe1){return new BPromise(function(_0x40508e,_0x3f6639){return client['request'](_0x3759d9,_0x5bcbe1)[_0x38ec('0xf')](function(_0x4abf1b){logger[_0x38ec('0x10')]('CmList,\x20%s,\x20%s',_0x2344c7,_0x38ec('0x11'));logger[_0x38ec('0x12')](_0x38ec('0x13'),_0x2344c7,_0x38ec('0x11'),JSON[_0x38ec('0x14')](_0x4abf1b));if(_0x4abf1b[_0x38ec('0x15')]){if(_0x4abf1b[_0x38ec('0x15')][_0x38ec('0x16')]===0x1f4){logger[_0x38ec('0x15')](_0x38ec('0x17'),_0x2344c7,_0x4abf1b['error']['message']);return _0x3f6639(_0x4abf1b['error']['message']);}logger[_0x38ec('0x15')](_0x38ec('0x17'),_0x2344c7,_0x4abf1b[_0x38ec('0x15')][_0x38ec('0x18')]);return _0x40508e(_0x4abf1b[_0x38ec('0x15')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x2344c7,_0x38ec('0x11'));_0x40508e(_0x4abf1b['result'][_0x38ec('0x18')]);}})[_0x38ec('0x19')](function(_0x12c55b){logger[_0x38ec('0x15')]('CmList,\x20%s,\x20%s',_0x2344c7,_0x12c55b);_0x3f6639(_0x12c55b);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 45668c7..9402c70 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 _0x8e0f=['save','remove','update','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x132cdc,_0x1de44c){_0x132cdc=_0x132cdc-0x0;var _0x28467a=_0x8e0f[_0x132cdc];return _0x28467a;};'use strict';var CmListEvents=require(_0xf8e0('0x0'));var events=[_0xf8e0('0x1'),_0xf8e0('0x2'),_0xf8e0('0x3')];function createListener(_0x38282a,_0x15a893){return function(_0x2ce589){_0x15a893['emit'](_0x38282a,_0x2ce589);};}function removeListener(_0x40d121,_0x4a6acb){return function(){CmListEvents[_0xf8e0('0x4')](_0x40d121,_0x4a6acb);};}exports[_0xf8e0('0x5')]=function(_0x4f3b30){for(var _0x2921b3=0x0,_0x30d044=events[_0xf8e0('0x6')];_0x2921b3<_0x30d044;_0x2921b3++){var _0x202971=events[_0x2921b3];var _0x518aec=createListener(_0xf8e0('0x7')+_0x202971,_0x4f3b30);CmListEvents['on'](_0x202971,_0x518aec);}}; \ No newline at end of file +var _0xf77c=['length','cmList:','remove','update','emit','register'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf77c,0x1a0));var _0xcf77=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0xf77c[_0x5cfb92];return _0x1cd7c2;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xcf77('0x0'),_0xcf77('0x1')];function createListener(_0x303ba9,_0x32b267){return function(_0x3b2730){_0x32b267[_0xcf77('0x2')](_0x303ba9,_0x3b2730);};}function removeListener(_0xeba705,_0x1365e3){return function(){CmListEvents['removeListener'](_0xeba705,_0x1365e3);};}exports[_0xcf77('0x3')]=function(_0xfafc1a){for(var _0xdef53a=0x0,_0x155766=events[_0xcf77('0x4')];_0xdef53a<_0x155766;_0xdef53a++){var _0x35377d=events[_0xdef53a];var _0x56ac86=createListener(_0xcf77('0x5')+_0x35377d,_0xfafc1a);CmListEvents['on'](_0x35377d,_0x56ac86);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 247c960..5cb9f8d 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 _0xa81e=['../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ce9d3,_0x2261f0){var _0x4149bb=function(_0x47fedc){while(--_0x47fedc){_0x2ce9d3['push'](_0x2ce9d3['shift']());}};_0x4149bb(++_0x2261f0);}(_0xa81e,0x13c));var _0xea81=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa81e[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xea81('0x0'));var util=require(_0xea81('0x1'));var path=require(_0xea81('0x2'));var timeout=require('connect-timeout');var express=require(_0xea81('0x3'));var router=express[_0xea81('0x4')]();var fs_extra=require(_0xea81('0x5'));var auth=require(_0xea81('0x6'));var interaction=require(_0xea81('0x7'));var config=require(_0xea81('0x8'));var controller=require(_0xea81('0x9'));router[_0xea81('0xa')]('/',auth[_0xea81('0xb')](),controller[_0xea81('0xc')]);router['get'](_0xea81('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xea81('0xa')](_0xea81('0xe'),auth[_0xea81('0xb')](),controller['getGlobalCustomFields']);router[_0xea81('0xa')](_0xea81('0xf'),auth[_0xea81('0xb')](),controller[_0xea81('0x10')]);router[_0xea81('0xa')](_0xea81('0x11'),auth['isAuthenticated'](),controller[_0xea81('0x12')]);router[_0xea81('0xa')](_0xea81('0x13'),auth['isAuthenticated'](),controller[_0xea81('0x14')]);router[_0xea81('0xa')](_0xea81('0x15'),auth['isAuthenticated'](),controller[_0xea81('0x16')]);router['get'](_0xea81('0x17'),auth[_0xea81('0xb')](),controller['getCustomFields']);router[_0xea81('0xa')](_0xea81('0x18'),auth[_0xea81('0xb')](),controller['getAgents']);router[_0xea81('0x19')]('/',auth[_0xea81('0xb')](),controller['create']);router[_0xea81('0x19')](_0xea81('0x11'),auth[_0xea81('0xb')](),controller[_0xea81('0x1a')]);router[_0xea81('0x19')]('/:id/contacts',auth[_0xea81('0xb')](),controller[_0xea81('0x1b')]);router[_0xea81('0x19')](_0xea81('0x17'),auth['isAuthenticated'](),controller[_0xea81('0x1c')]);router[_0xea81('0x19')](_0xea81('0x18'),auth[_0xea81('0xb')](),controller[_0xea81('0x1d')]);router['put'](_0xea81('0xf'),auth[_0xea81('0xb')](),controller[_0xea81('0x1e')]);router[_0xea81('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0xea81('0x20')]);router['delete'](_0xea81('0x11'),auth[_0xea81('0xb')](),controller[_0xea81('0x21')]);router[_0xea81('0x1f')](_0xea81('0x18'),auth[_0xea81('0xb')](),controller[_0xea81('0x22')]);module[_0xea81('0x23')]=router; \ No newline at end of file +var _0x2e3d=['/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getCustomFields'];(function(_0xbf587,_0x49ad42){var _0x5b4c17=function(_0x5c30bd){while(--_0x5c30bd){_0xbf587['push'](_0xbf587['shift']());}};_0x5b4c17(++_0x49ad42);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x183ed9,_0x181ab3){_0x183ed9=_0x183ed9-0x0;var _0x43e9e9=_0x2e3d[_0x183ed9];return _0x43e9e9;};'use strict';var multer=require(_0xd2e3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd2e3('0x1'));var express=require(_0xd2e3('0x2'));var router=express[_0xd2e3('0x3')]();var fs_extra=require(_0xd2e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd2e3('0x5'));var controller=require('./cmList.controller');router[_0xd2e3('0x6')]('/',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x8')]);router[_0xd2e3('0x6')](_0xd2e3('0x9'),auth[_0xd2e3('0x7')](),controller['describe']);router[_0xd2e3('0x6')](_0xd2e3('0xa'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0xb')]);router[_0xd2e3('0x6')](_0xd2e3('0xc'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0xd')]);router[_0xd2e3('0x6')]('/:id/dispositions',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0xe')]);router['get'](_0xd2e3('0xf'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x10')]);router[_0xd2e3('0x6')](_0xd2e3('0x11'),auth[_0xd2e3('0x7')](),controller['getContactsCsv']);router[_0xd2e3('0x6')]('/:id/fields',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x12')]);router['get'](_0xd2e3('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd2e3('0x14')]('/',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x15')]);router['post']('/:id/dispositions',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x16')]);router[_0xd2e3('0x14')](_0xd2e3('0xf'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x17')]);router[_0xd2e3('0x14')]('/:id/fields',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xd2e3('0x19')]);router[_0xd2e3('0x1a')](_0xd2e3('0xc'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd2e3('0x1c')]('/:id/dispositions',auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x1d')]);router['delete'](_0xd2e3('0x13'),auth[_0xd2e3('0x7')](),controller[_0xd2e3('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7a09942..4a00982 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 _0xafe8=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x137f41,_0x392c30){var _0x3780b3=function(_0x3c5e9b){while(--_0x3c5e9b){_0x137f41['push'](_0x137f41['shift']());}};_0x3780b3(++_0x392c30);}(_0xafe8,0xfc));var _0x8afe=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xafe8[_0x37ffea];return _0x2e2615;};'use strict';var Sequelize=require('sequelize');module[_0x8afe('0x0')]={'name':{'type':Sequelize[_0x8afe('0x1')],'get':function(_0x5d8369){return this[_0x8afe('0x2')](_0x8afe('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x8afe('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8afe('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x18cb=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0xffc654,_0xb04c65){var _0x43770b=function(_0x39f691){while(--_0x39f691){_0xffc654['push'](_0xffc654['shift']());}};_0x43770b(++_0xb04c65);}(_0x18cb,0xce));var _0xb18c=function(_0x4917a9,_0x16027e){_0x4917a9=_0x4917a9-0x0;var _0x2eb77a=_0x18cb[_0x4917a9];return _0x2eb77a;};'use strict';var Sequelize=require(_0xb18c('0x0'));module[_0xb18c('0x1')]={'name':{'type':Sequelize[_0xb18c('0x2')],'get':function(_0x4e25fb){return this[_0xb18c('0x3')](_0xb18c('0x4'));}},'field':{'type':Sequelize[_0xb18c('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xb18c('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xb18c('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index cbb5007..2331af2 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(_0x2ad1de,_0x6715f7){var _0x48f029=function(_0xbd482c){while(--_0xbd482c){_0x2ad1de['push'](_0x2ad1de['shift']());}};_0x48f029(++_0x6715f7);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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(_0x234f83,_0x382b44){var _0x12b4d3=function(_0x1cbadb){while(--_0x1cbadb){_0x234f83['push'](_0x234f83['shift']());}};_0x12b4d3(++_0x382b44);}(_0x7a54,0x106));var _0x47a5=function(_0x2c25f2,_0x289d53){_0x2c25f2=_0x2c25f2-0x0;var _0x532a45=_0x7a54[_0x2c25f2];return _0x532a45;};'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 e935683..5889fa3 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 _0xcfcc=['exports','Condition','tools_conditions','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcfcc,0x16e));var _0xccfc=function(_0x2fadc6,_0xb80f68){_0x2fadc6=_0x2fadc6-0x0;var _0x3c323f=_0xcfcc[_0x2fadc6];return _0x3c323f;};'use strict';var _=require(_0xccfc('0x0'));var util=require('util');var logger=require(_0xccfc('0x1'))('api');var moment=require(_0xccfc('0x2'));var BPromise=require(_0xccfc('0x3'));var rp=require(_0xccfc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccfc('0x5'));var config=require(_0xccfc('0x6'));var attributes=require(_0xccfc('0x7'));module[_0xccfc('0x8')]=function(_0x4aacdc,_0x28b1ba){return _0x4aacdc['define'](_0xccfc('0x9'),attributes,{'tableName':_0xccfc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dda=['path','rimraf','./condition.attributes','define','Condition','lodash','util','api','moment','request-promise'];(function(_0x511252,_0x175253){var _0x1b1c57=function(_0x2a92af){while(--_0x2a92af){_0x511252['push'](_0x511252['shift']());}};_0x1b1c57(++_0x175253);}(_0x3dda,0x13b));var _0xa3dd=function(_0xd58ee8,_0x2ecdc0){_0xd58ee8=_0xd58ee8-0x0;var _0x13c09f=_0x3dda[_0xd58ee8];return _0x13c09f;};'use strict';var _=require(_0xa3dd('0x0'));var util=require(_0xa3dd('0x1'));var logger=require('../../config/logger')(_0xa3dd('0x2'));var moment=require(_0xa3dd('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3dd('0x4'));var fs=require('fs');var path=require(_0xa3dd('0x5'));var rimraf=require(_0xa3dd('0x6'));var config=require('../../config/environment');var attributes=require(_0xa3dd('0x7'));module['exports']=function(_0x2c85be,_0xf9023e){return _0x2c85be[_0xa3dd('0x8')](_0xa3dd('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 9193f1e..df17dbc 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 _0x7bbb=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x7bbb,0x163));var _0xb7bb=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7bbb[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xb7bb('0x0'));var util=require(_0xb7bb('0x1'));var moment=require(_0xb7bb('0x2'));var BPromise=require(_0xb7bb('0x3'));var rs=require(_0xb7bb('0x4'));var fs=require('fs');var Redis=require(_0xb7bb('0x5'));var db=require(_0xb7bb('0x6'))['db'];var utils=require(_0xb7bb('0x7'));var logger=require(_0xb7bb('0x8'))(_0xb7bb('0x9'));var config=require(_0xb7bb('0xa'));var jayson=require(_0xb7bb('0xb'));var client=jayson[_0xb7bb('0xc')][_0xb7bb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x152a40,_0x18f831,_0x48e825){return new BPromise(function(_0x4fa996,_0x2b2778){return client[_0xb7bb('0xe')](_0x152a40,_0x48e825)['then'](function(_0x314908){logger[_0xb7bb('0xf')]('Condition,\x20%s,\x20%s',_0x18f831,'request\x20sent');logger[_0xb7bb('0x10')](_0xb7bb('0x11'),_0x18f831,_0xb7bb('0x12'),JSON[_0xb7bb('0x13')](_0x314908));if(_0x314908[_0xb7bb('0x14')]){if(_0x314908['error'][_0xb7bb('0x15')]===0x1f4){logger['error'](_0xb7bb('0x16'),_0x18f831,_0x314908[_0xb7bb('0x14')][_0xb7bb('0x17')]);return _0x2b2778(_0x314908[_0xb7bb('0x14')][_0xb7bb('0x17')]);}logger['error']('Condition,\x20%s,\x20%s',_0x18f831,_0x314908[_0xb7bb('0x14')][_0xb7bb('0x17')]);return _0x4fa996(_0x314908[_0xb7bb('0x14')][_0xb7bb('0x17')]);}else{logger[_0xb7bb('0xf')]('Condition,\x20%s,\x20%s',_0x18f831,_0xb7bb('0x12'));_0x4fa996(_0x314908[_0xb7bb('0x18')][_0xb7bb('0x17')]);}})[_0xb7bb('0x19')](function(_0x3936e2){logger[_0xb7bb('0x14')](_0xb7bb('0x16'),_0x18f831,_0x3936e2);_0x2b2778(_0x3936e2);});});} \ No newline at end of file +var _0xe319=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x483cdd,_0x3fb225){var _0xce11bf=function(_0x37ee03){while(--_0x37ee03){_0x483cdd['push'](_0x483cdd['shift']());}};_0xce11bf(++_0x3fb225);}(_0xe319,0x196));var _0x9e31=function(_0x3e6ab1,_0x48100e){_0x3e6ab1=_0x3e6ab1-0x0;var _0x149d4c=_0xe319[_0x3e6ab1];return _0x149d4c;};'use strict';var _=require('lodash');var util=require(_0x9e31('0x0'));var moment=require(_0x9e31('0x1'));var BPromise=require(_0x9e31('0x2'));var rs=require(_0x9e31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e31('0x4'));var config=require(_0x9e31('0x5'));var jayson=require(_0x9e31('0x6'));var client=jayson[_0x9e31('0x7')][_0x9e31('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59bf43,_0x31bce9,_0x2159db){return new BPromise(function(_0x2c6963,_0xf7297a){return client[_0x9e31('0x9')](_0x59bf43,_0x2159db)['then'](function(_0x2b15ae){logger[_0x9e31('0xa')](_0x9e31('0xb'),_0x31bce9,_0x9e31('0xc'));logger[_0x9e31('0xd')](_0x9e31('0xe'),_0x31bce9,_0x9e31('0xc'),JSON[_0x9e31('0xf')](_0x2b15ae));if(_0x2b15ae['error']){if(_0x2b15ae[_0x9e31('0x10')][_0x9e31('0x11')]===0x1f4){logger[_0x9e31('0x10')](_0x9e31('0xb'),_0x31bce9,_0x2b15ae[_0x9e31('0x10')][_0x9e31('0x12')]);return _0xf7297a(_0x2b15ae[_0x9e31('0x10')][_0x9e31('0x12')]);}logger[_0x9e31('0x10')](_0x9e31('0xb'),_0x31bce9,_0x2b15ae['error'][_0x9e31('0x12')]);return _0x2c6963(_0x2b15ae[_0x9e31('0x10')][_0x9e31('0x12')]);}else{logger[_0x9e31('0xa')](_0x9e31('0xb'),_0x31bce9,_0x9e31('0xc'));_0x2c6963(_0x2b15ae[_0x9e31('0x13')][_0x9e31('0x12')]);}})[_0x9e31('0x14')](function(_0x4f60f4){logger[_0x9e31('0x10')](_0x9e31('0xb'),_0x31bce9,_0x4f60f4);_0xf7297a(_0x4f60f4);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c03cd25..01b174e 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 _0xc4f1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path'];(function(_0x5c7e3a,_0x5f2dba){var _0x521689=function(_0x4f9b79){while(--_0x4f9b79){_0x5c7e3a['push'](_0x5c7e3a['shift']());}};_0x521689(++_0x5f2dba);}(_0xc4f1,0x8a));var _0x1c4f=function(_0x39340a,_0x533d5a){_0x39340a=_0x39340a-0x0;var _0x27fa75=_0xc4f1[_0x39340a];return _0x27fa75;};'use strict';var multer=require(_0x1c4f('0x0'));var util=require('util');var path=require(_0x1c4f('0x1'));var timeout=require(_0x1c4f('0x2'));var express=require(_0x1c4f('0x3'));var router=express[_0x1c4f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c4f('0x5'));var interaction=require(_0x1c4f('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x1c4f('0x7')](_0x1c4f('0x8'),auth[_0x1c4f('0x9')](),controller[_0x1c4f('0xa')]);router[_0x1c4f('0xb')](_0x1c4f('0x8'),auth[_0x1c4f('0x9')](),controller[_0x1c4f('0xc')]);module[_0x1c4f('0xd')]=router; \ No newline at end of file +var _0x047f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x047f,0x1b5));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf047('0x0'));var util=require(_0xf047('0x1'));var path=require(_0xf047('0x2'));var timeout=require(_0xf047('0x3'));var express=require(_0xf047('0x4'));var router=express[_0xf047('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf047('0x6'));var interaction=require(_0xf047('0x7'));var config=require(_0xf047('0x8'));var controller=require(_0xf047('0x9'));router[_0xf047('0xa')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller['update']);router['delete'](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0xd')]);module[_0xf047('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 921128b..a3495bc 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 _0xb223=['name','INTEGER','STRING','sequelize','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb223,0x157));var _0x3b22=function(_0x18855a,_0x5ac810){_0x18855a=_0x18855a-0x0;var _0x2af66a=_0xb223[_0x18855a];return _0x2af66a;};'use strict';var Sequelize=require(_0x3b22('0x0'));module[_0x3b22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b22('0x2')},'OrderBy':{'type':Sequelize[_0x3b22('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3b22('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x1293=['INTEGER','STRING','exports'];(function(_0x2e4136,_0x3eca4c){var _0x5e7d84=function(_0x245756){while(--_0x245756){_0x2e4136['push'](_0x2e4136['shift']());}};_0x5e7d84(++_0x3eca4c);}(_0x1293,0x77));var _0x3129=function(_0x48d007,_0x446953){_0x48d007=_0x48d007-0x0;var _0x412d80=_0x1293[_0x48d007];return _0x412d80;};'use strict';var Sequelize=require('sequelize');module[_0x3129('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x3129('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3129('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6378ebc..dfe318c 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 _0x1a37=['includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x1a37,0xb4));var _0x71a3=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x1a37[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){var _0xb9c195=_0x5f33c5[_0x71a3('0x26')]({'plain':!![]});var _0xb0f3aa='ContactItemTypes';return db[_0x71a3('0x27')][_0x71a3('0x25')]({'where':{'type':_0xb0f3aa,'resourceId':_0xb9c195['id']}})['then'](function(){return _0x5f33c5;});})[_0x71a3('0x24')](function(){_0x452bc4['status'](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3b6,_0x211ea8){return function(_0x35b5c7){if(!_0x35b5c7){_0x2fd3b6[_0x71a3('0x18')](0x194);}return _0x35b5c7;};}function handleError(_0x314439,_0x2317ec){_0x2317ec=_0x2317ec||0x1f4;return function(_0x242b85){logger[_0x71a3('0x28')](_0x242b85[_0x71a3('0x29')]);if(_0x242b85[_0x71a3('0x2a')]){delete _0x242b85[_0x71a3('0x2a')];}_0x314439['status'](_0x2317ec)[_0x71a3('0x2b')](_0x242b85);};}exports[_0x71a3('0x2c')]=function(_0x334db0,_0x23ae85){var _0x4a750c={},_0x18a8fe={},_0x216d84={'count':0x0,'rows':[]};var _0x45d13d=_[_0x71a3('0x2d')](db[_0x71a3('0x2e')][_0x71a3('0x2f')],function(_0x1d09bd){return{'name':_0x1d09bd['fieldName'],'type':_0x1d09bd[_0x71a3('0x30')][_0x71a3('0x31')]};});_0x18a8fe[_0x71a3('0x32')]=_[_0x71a3('0x2d')](_0x45d13d,_0x71a3('0x2a'));_0x18a8fe[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x334db0[_0x71a3('0x33')]);_0x18a8fe[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x18a8fe[_0x71a3('0x32')],_0x18a8fe[_0x71a3('0x33')]);_0x4a750c[_0x71a3('0x37')]=_['intersection'](_0x18a8fe['model'],qs[_0x71a3('0x38')](_0x334db0[_0x71a3('0x33')]['fields']));_0x4a750c[_0x71a3('0x37')]=_0x4a750c[_0x71a3('0x37')]['length']?_0x4a750c[_0x71a3('0x37')]:_0x18a8fe[_0x71a3('0x32')];if(!_0x334db0[_0x71a3('0x33')][_0x71a3('0x39')](_0x71a3('0x3a'))){_0x4a750c[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x334db0['query'][_0x71a3('0x1d')]);_0x4a750c[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x334db0['query'][_0x71a3('0x1b')]);}_0x4a750c[_0x71a3('0x3b')]=qs[_0x71a3('0x3c')](_0x334db0[_0x71a3('0x33')][_0x71a3('0x3c')]);_0x4a750c['where']=qs['filters'](_[_0x71a3('0x3d')](_0x334db0[_0x71a3('0x33')],_0x18a8fe[_0x71a3('0x35')]),_0x45d13d);if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]){_0x4a750c['where']=_[_0x71a3('0x3f')](_0x4a750c[_0x71a3('0x40')],{'$or':_[_0x71a3('0x2d')](_0x45d13d,function(_0x58b833){if(_0x58b833[_0x71a3('0x30')]!=='VIRTUAL'){var _0x3edeff={};_0x3edeff[_0x58b833[_0x71a3('0x2a')]]={'$like':'%'+_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]+'%'};return _0x3edeff;}})});}_0x4a750c=_[_0x71a3('0x3f')]({},_0x4a750c,_0x334db0[_0x71a3('0x41')]);var _0x468ca4={'where':_0x4a750c[_0x71a3('0x40')]};return db[_0x71a3('0x2e')][_0x71a3('0x1e')](_0x468ca4)['then'](function(_0xa49846){_0x216d84['count']=_0xa49846;if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x42')]){_0x4a750c[_0x71a3('0x43')]=[{'all':!![]}];}return db[_0x71a3('0x2e')]['findAll'](_0x4a750c);})[_0x71a3('0x24')](function(_0x4b4fde){_0x216d84['rows']=_0x4b4fde;return _0x216d84;})[_0x71a3('0x24')](respondWithFilteredResult(_0x23ae85,_0x4a750c))[_0x71a3('0x44')](handleError(_0x23ae85,null));};exports[_0x71a3('0x45')]=function(_0x1dc34b,_0x519242){var _0x248a04={'raw':!![],'where':{'id':_0x1dc34b[_0x71a3('0x46')]['id']}},_0x615c6f={};_0x615c6f[_0x71a3('0x32')]=_[_0x71a3('0x34')](db[_0x71a3('0x2e')][_0x71a3('0x2f')]);_0x615c6f[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x1dc34b[_0x71a3('0x33')]);_0x615c6f[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x615c6f[_0x71a3('0x32')],_0x615c6f[_0x71a3('0x33')]);_0x248a04[_0x71a3('0x37')]=_[_0x71a3('0x36')](_0x615c6f['model'],qs[_0x71a3('0x38')](_0x1dc34b[_0x71a3('0x33')]['fields']));_0x248a04[_0x71a3('0x37')]=_0x248a04[_0x71a3('0x37')][_0x71a3('0x47')]?_0x248a04[_0x71a3('0x37')]:_0x615c6f[_0x71a3('0x32')];if(_0x1dc34b['query']['includeAll']){_0x248a04[_0x71a3('0x43')]=[{'all':!![]}];}_0x248a04=_[_0x71a3('0x3f')]({},_0x248a04,_0x1dc34b['options']);return db[_0x71a3('0x2e')][_0x71a3('0x48')](_0x248a04)[_0x71a3('0x24')](handleEntityNotFound(_0x519242,null))[_0x71a3('0x24')](respondWithResult(_0x519242,null))[_0x71a3('0x44')](handleError(_0x519242,null));};exports[_0x71a3('0x49')]=function(_0x501a62,_0x1c9ba6){return db['ContactItemType'][_0x71a3('0x49')](_0x501a62[_0x71a3('0x4a')],{})[_0x71a3('0x24')](function(_0x2f3f19){var _0x32e313=_0x501a62['user'][_0x71a3('0x26')]({'plain':!![]});if(!_0x32e313)throw new Error(_0x71a3('0x4b'));if(_0x32e313[_0x71a3('0x4c')]==='user'){var _0x6c34=_0x2f3f19['get']({'plain':!![]});var _0x278e11=_0x71a3('0x4d');return db['UserProfileSection'][_0x71a3('0x48')]({'where':{'name':_0x278e11,'userProfileId':_0x32e313[_0x71a3('0x4e')]},'raw':!![]})[_0x71a3('0x24')](function(_0x384f38){if(_0x384f38&&_0x384f38[_0x71a3('0x4f')]===0x0){return db[_0x71a3('0x27')][_0x71a3('0x49')]({'name':_0x6c34['name'],'resourceId':_0x6c34['id'],'type':_0x384f38[_0x71a3('0x2a')],'sectionId':_0x384f38['id']},{})['then'](function(){return _0x2f3f19;});}else{return _0x2f3f19;}})[_0x71a3('0x44')](function(_0x480e90){logger[_0x71a3('0x28')](_0x71a3('0x50'),_0x480e90);throw _0x480e90;});}return _0x2f3f19;})[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,0xc9))[_0x71a3('0x44')](handleError(_0x1c9ba6,null));};exports['update']=function(_0x54b80f,_0x1e13ae){if(_0x54b80f[_0x71a3('0x4a')]['id']){delete _0x54b80f[_0x71a3('0x4a')]['id'];}return db[_0x71a3('0x2e')]['find']({'where':{'id':_0x54b80f['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1e13ae,null))[_0x71a3('0x24')](saveUpdates(_0x54b80f[_0x71a3('0x4a')],null))[_0x71a3('0x24')](respondWithResult(_0x1e13ae,null))[_0x71a3('0x44')](handleError(_0x1e13ae,null));};exports['destroy']=function(_0x421b6a,_0x3379cb){return db[_0x71a3('0x2e')][_0x71a3('0x48')]({'where':{'id':_0x421b6a[_0x71a3('0x46')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x3379cb,null))[_0x71a3('0x24')](db[_0x71a3('0x51')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x421b6a[_0x71a3('0x46')]['id']}}))[_0x71a3('0x24')](removeEntity(_0x3379cb,null))[_0x71a3('0x44')](handleError(_0x3379cb,null));}; \ No newline at end of file +var _0x430c=['merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContactHasItem','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','get','ContactItemTypes','error','name','index','map','ContactItemType','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x430c,0x1a1));var _0xc430=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x430c[_0xf26d40];return _0x50b68c;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){var _0x48f67a=_0x4efecd[_0xc430('0x20')]({'plain':!![]});var _0x59c498=_0xc430('0x21');return db['UserProfileResource'][_0xc430('0x1f')]({'where':{'type':_0x59c498,'resourceId':_0x48f67a['id']}})[_0xc430('0x1e')](function(){return _0x4efecd;});})['then'](function(){_0x23425d[_0xc430('0x15')](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x2c0422,_0x44833e){return function(_0x285407){if(!_0x285407){_0x2c0422['sendStatus'](0x194);}return _0x285407;};}function handleError(_0x2ccc13,_0x1a9512){_0x1a9512=_0x1a9512||0x1f4;return function(_0x1c1da9){logger[_0xc430('0x22')](_0x1c1da9['stack']);if(_0x1c1da9[_0xc430('0x23')]){delete _0x1c1da9['name'];}_0x2ccc13[_0xc430('0x15')](_0x1a9512)['send'](_0x1c1da9);};}exports[_0xc430('0x24')]=function(_0x1045c0,_0xfc8767){var _0x3d7ccf={},_0x49977b={},_0x17c975={'count':0x0,'rows':[]};var _0x2a85aa=_[_0xc430('0x25')](db[_0xc430('0x26')]['rawAttributes'],function(_0xfcc12c){return{'name':_0xfcc12c[_0xc430('0x27')],'type':_0xfcc12c['type'][_0xc430('0x28')]};});_0x49977b['model']=_['map'](_0x2a85aa,_0xc430('0x23'));_0x49977b[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1045c0[_0xc430('0x29')]);_0x49977b[_0xc430('0x2b')]=_[_0xc430('0x2c')](_0x49977b[_0xc430('0x2d')],_0x49977b[_0xc430('0x29')]);_0x3d7ccf['attributes']=_[_0xc430('0x2c')](_0x49977b['model'],qs[_0xc430('0x2e')](_0x1045c0[_0xc430('0x29')][_0xc430('0x2e')]));_0x3d7ccf[_0xc430('0x2f')]=_0x3d7ccf['attributes'][_0xc430('0x30')]?_0x3d7ccf['attributes']:_0x49977b['model'];if(!_0x1045c0[_0xc430('0x29')][_0xc430('0x31')]('nolimit')){_0x3d7ccf[_0xc430('0x18')]=qs[_0xc430('0x18')](_0x1045c0[_0xc430('0x29')][_0xc430('0x18')]);_0x3d7ccf[_0xc430('0x1a')]=qs[_0xc430('0x1a')](_0x1045c0[_0xc430('0x29')][_0xc430('0x1a')]);}_0x3d7ccf[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1045c0[_0xc430('0x29')][_0xc430('0x33')]);_0x3d7ccf[_0xc430('0x34')]=qs[_0xc430('0x2b')](_[_0xc430('0x35')](_0x1045c0['query'],_0x49977b[_0xc430('0x2b')]),_0x2a85aa);if(_0x1045c0[_0xc430('0x29')][_0xc430('0x36')]){_0x3d7ccf[_0xc430('0x34')]=_['merge'](_0x3d7ccf[_0xc430('0x34')],{'$or':_[_0xc430('0x25')](_0x2a85aa,function(_0x13ac85){if(_0x13ac85[_0xc430('0x37')]!==_0xc430('0x38')){var _0x393f49={};_0x393f49[_0x13ac85['name']]={'$like':'%'+_0x1045c0[_0xc430('0x29')][_0xc430('0x36')]+'%'};return _0x393f49;}})});}_0x3d7ccf=_[_0xc430('0x39')]({},_0x3d7ccf,_0x1045c0[_0xc430('0x3a')]);var _0x1d156c={'where':_0x3d7ccf[_0xc430('0x34')]};return db[_0xc430('0x26')][_0xc430('0x1b')](_0x1d156c)[_0xc430('0x1e')](function(_0x4174d2){_0x17c975[_0xc430('0x1b')]=_0x4174d2;if(_0x1045c0[_0xc430('0x29')][_0xc430('0x3b')]){_0x3d7ccf[_0xc430('0x3c')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x3d7ccf);})['then'](function(_0x262063){_0x17c975[_0xc430('0x3d')]=_0x262063;return _0x17c975;})[_0xc430('0x1e')](respondWithFilteredResult(_0xfc8767,_0x3d7ccf))[_0xc430('0x3e')](handleError(_0xfc8767,null));};exports[_0xc430('0x3f')]=function(_0x3bfb23,_0x26cc86){var _0x270667={'raw':!![],'where':{'id':_0x3bfb23[_0xc430('0x40')]['id']}},_0x2d3473={};_0x2d3473[_0xc430('0x2d')]=_[_0xc430('0x2a')](db[_0xc430('0x26')][_0xc430('0x41')]);_0x2d3473[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x3bfb23['query']);_0x2d3473[_0xc430('0x2b')]=_[_0xc430('0x2c')](_0x2d3473[_0xc430('0x2d')],_0x2d3473[_0xc430('0x29')]);_0x270667[_0xc430('0x2f')]=_[_0xc430('0x2c')](_0x2d3473[_0xc430('0x2d')],qs[_0xc430('0x2e')](_0x3bfb23['query'][_0xc430('0x2e')]));_0x270667['attributes']=_0x270667[_0xc430('0x2f')][_0xc430('0x30')]?_0x270667['attributes']:_0x2d3473['model'];if(_0x3bfb23[_0xc430('0x29')]['includeAll']){_0x270667['include']=[{'all':!![]}];}_0x270667=_[_0xc430('0x39')]({},_0x270667,_0x3bfb23['options']);return db[_0xc430('0x26')][_0xc430('0x42')](_0x270667)[_0xc430('0x1e')](handleEntityNotFound(_0x26cc86,null))['then'](respondWithResult(_0x26cc86,null))[_0xc430('0x3e')](handleError(_0x26cc86,null));};exports[_0xc430('0x43')]=function(_0x19e563,_0x549400){return db[_0xc430('0x26')][_0xc430('0x43')](_0x19e563[_0xc430('0x44')],{})[_0xc430('0x1e')](function(_0x636374){var _0x3b85f6=_0x19e563[_0xc430('0x45')]['get']({'plain':!![]});if(!_0x3b85f6)throw new Error(_0xc430('0x46'));if(_0x3b85f6[_0xc430('0x47')]===_0xc430('0x45')){var _0x4e9aff=_0x636374[_0xc430('0x20')]({'plain':!![]});var _0x4178d7=_0xc430('0x21');return db[_0xc430('0x48')]['find']({'where':{'name':_0x4178d7,'userProfileId':_0x3b85f6[_0xc430('0x49')]},'raw':!![]})['then'](function(_0x110566){if(_0x110566&&_0x110566[_0xc430('0x4a')]===0x0){return db[_0xc430('0x4b')][_0xc430('0x43')]({'name':_0x4e9aff[_0xc430('0x23')],'resourceId':_0x4e9aff['id'],'type':_0x110566[_0xc430('0x23')],'sectionId':_0x110566['id']},{})['then'](function(){return _0x636374;});}else{return _0x636374;}})[_0xc430('0x3e')](function(_0x654bed){logger['error'](_0xc430('0x4c'),_0x654bed);throw _0x654bed;});}return _0x636374;})[_0xc430('0x1e')](respondWithResult(_0x549400,0xc9))[_0xc430('0x3e')](handleError(_0x549400,null));};exports[_0xc430('0x4d')]=function(_0x5e361a,_0x23f2e9){if(_0x5e361a['body']['id']){delete _0x5e361a[_0xc430('0x44')]['id'];}return db[_0xc430('0x26')][_0xc430('0x42')]({'where':{'id':_0x5e361a[_0xc430('0x40')]['id']}})['then'](handleEntityNotFound(_0x23f2e9,null))[_0xc430('0x1e')](saveUpdates(_0x5e361a[_0xc430('0x44')],null))['then'](respondWithResult(_0x23f2e9,null))['catch'](handleError(_0x23f2e9,null));};exports[_0xc430('0x1f')]=function(_0x274760,_0x2d3e0b){return db[_0xc430('0x26')][_0xc430('0x42')]({'where':{'id':_0x274760[_0xc430('0x40')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x2d3e0b,null))['then'](db[_0xc430('0x4e')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x274760[_0xc430('0x40')]['id']}}))[_0xc430('0x1e')](removeEntity(_0x2d3e0b,null))[_0xc430('0x3e')](handleError(_0x2d3e0b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1511bf3..a621fc7 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 _0xac51=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','util'];(function(_0x748eb7,_0x1ce52b){var _0x2d7e18=function(_0x2a587d){while(--_0x2a587d){_0x748eb7['push'](_0x748eb7['shift']());}};_0x2d7e18(++_0x1ce52b);}(_0xac51,0x12a));var _0x1ac5=function(_0x24eb16,_0x23f718){_0x24eb16=_0x24eb16-0x0;var _0x33aefe=_0xac51[_0x24eb16];return _0x33aefe;};'use strict';var _=require('lodash');var util=require(_0x1ac5('0x0'));var logger=require(_0x1ac5('0x1'))(_0x1ac5('0x2'));var moment=require(_0x1ac5('0x3'));var BPromise=require(_0x1ac5('0x4'));var rp=require(_0x1ac5('0x5'));var fs=require('fs');var path=require(_0x1ac5('0x6'));var rimraf=require(_0x1ac5('0x7'));var config=require(_0x1ac5('0x8'));var attributes=require(_0x1ac5('0x9'));module[_0x1ac5('0xa')]=function(_0xa7dadb,_0x31409b){return _0xa7dadb['define'](_0x1ac5('0xb'),attributes,{'tableName':_0x1ac5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba73=['bluebird','request-promise','path','../../config/environment','exports','define','tools_contact_item_types','../../config/logger','moment'];(function(_0x2d1539,_0x45e01b){var _0x1b0778=function(_0x241a77){while(--_0x241a77){_0x2d1539['push'](_0x2d1539['shift']());}};_0x1b0778(++_0x45e01b);}(_0xba73,0x7c));var _0x3ba7=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xba73[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ba7('0x0'))('api');var moment=require(_0x3ba7('0x1'));var BPromise=require(_0x3ba7('0x2'));var rp=require(_0x3ba7('0x3'));var fs=require('fs');var path=require(_0x3ba7('0x4'));var rimraf=require('rimraf');var config=require(_0x3ba7('0x5'));var attributes=require('./contactItemType.attributes');module[_0x3ba7('0x6')]=function(_0x5a0616,_0x1baef1){return _0x5a0616[_0x3ba7('0x7')]('ContactItemType',attributes,{'tableName':_0x3ba7('0x8'),'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 9598075..d80c806 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 _0xbbec=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','ContactItemType,\x20%s,\x20%s'];(function(_0x1ea1be,_0x3a97b8){var _0x84f949=function(_0x334ba1){while(--_0x334ba1){_0x1ea1be['push'](_0x1ea1be['shift']());}};_0x84f949(++_0x3a97b8);}(_0xbbec,0x85));var _0xcbbe=function(_0xa170ef,_0x46a71d){_0xa170ef=_0xa170ef-0x0;var _0x37890c=_0xbbec[_0xa170ef];return _0x37890c;};'use strict';var _=require(_0xcbbe('0x0'));var util=require(_0xcbbe('0x1'));var moment=require(_0xcbbe('0x2'));var BPromise=require(_0xcbbe('0x3'));var rs=require(_0xcbbe('0x4'));var fs=require('fs');var Redis=require(_0xcbbe('0x5'));var db=require(_0xcbbe('0x6'))['db'];var utils=require(_0xcbbe('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcbbe('0x8'));var jayson=require(_0xcbbe('0x9'));var client=jayson[_0xcbbe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe622d6,_0x2d8cb3,_0x419c8b){return new BPromise(function(_0x5449db,_0x205388){return client[_0xcbbe('0xb')](_0xe622d6,_0x419c8b)[_0xcbbe('0xc')](function(_0x64ad23){logger['info'](_0xcbbe('0xd'),_0x2d8cb3,_0xcbbe('0xe'));logger[_0xcbbe('0xf')](_0xcbbe('0x10'),_0x2d8cb3,_0xcbbe('0xe'),JSON['stringify'](_0x64ad23));if(_0x64ad23[_0xcbbe('0x11')]){if(_0x64ad23[_0xcbbe('0x11')]['code']===0x1f4){logger[_0xcbbe('0x11')]('ContactItemType,\x20%s,\x20%s',_0x2d8cb3,_0x64ad23[_0xcbbe('0x11')][_0xcbbe('0x12')]);return _0x205388(_0x64ad23[_0xcbbe('0x11')][_0xcbbe('0x12')]);}logger[_0xcbbe('0x11')](_0xcbbe('0xd'),_0x2d8cb3,_0x64ad23[_0xcbbe('0x11')]['message']);return _0x5449db(_0x64ad23[_0xcbbe('0x11')][_0xcbbe('0x12')]);}else{logger[_0xcbbe('0x13')](_0xcbbe('0xd'),_0x2d8cb3,_0xcbbe('0xe'));_0x5449db(_0x64ad23[_0xcbbe('0x14')][_0xcbbe('0x12')]);}})['catch'](function(_0x28d00f){logger[_0xcbbe('0x11')]('ContactItemType,\x20%s,\x20%s',_0x2d8cb3,_0x28d00f);_0x205388(_0x28d00f);});});} \ No newline at end of file +var _0xeaef=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s,\x20%s','error','ContactItemType,\x20%s,\x20%s','message','request\x20sent','catch','lodash'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xeaef,0xfb));var _0xfeae=function(_0x145bce,_0x421215){_0x145bce=_0x145bce-0x0;var _0x4be832=_0xeaef[_0x145bce];return _0x4be832;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var moment=require(_0xfeae('0x2'));var BPromise=require(_0xfeae('0x3'));var rs=require(_0xfeae('0x4'));var fs=require('fs');var Redis=require(_0xfeae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeae('0x6'));var logger=require(_0xfeae('0x7'))(_0xfeae('0x8'));var config=require('../../config/environment');var jayson=require(_0xfeae('0x9'));var client=jayson[_0xfeae('0xa')][_0xfeae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4571f8,_0x402236,_0x587a6d){return new BPromise(function(_0x5dcb74,_0x542013){return client[_0xfeae('0xc')](_0x4571f8,_0x587a6d)[_0xfeae('0xd')](function(_0x2b1af2){logger[_0xfeae('0xe')]('ContactItemType,\x20%s,\x20%s',_0x402236,'request\x20sent');logger['debug'](_0xfeae('0xf'),_0x402236,'request\x20sent',JSON['stringify'](_0x2b1af2));if(_0x2b1af2[_0xfeae('0x10')]){if(_0x2b1af2['error']['code']===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x402236,_0x2b1af2[_0xfeae('0x10')]['message']);return _0x542013(_0x2b1af2[_0xfeae('0x10')]['message']);}logger['error'](_0xfeae('0x11'),_0x402236,_0x2b1af2[_0xfeae('0x10')][_0xfeae('0x12')]);return _0x5dcb74(_0x2b1af2['error'][_0xfeae('0x12')]);}else{logger[_0xfeae('0xe')](_0xfeae('0x11'),_0x402236,_0xfeae('0x13'));_0x5dcb74(_0x2b1af2['result'][_0xfeae('0x12')]);}})[_0xfeae('0x14')](function(_0xe58c84){logger[_0xfeae('0x10')](_0xfeae('0x11'),_0x402236,_0xe58c84);_0x542013(_0xe58c84);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6188b13..8ce4450 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 _0xd240=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','util'];(function(_0xbc86d5,_0x2339d5){var _0x233f75=function(_0x3e9abf){while(--_0x3e9abf){_0xbc86d5['push'](_0xbc86d5['shift']());}};_0x233f75(++_0x2339d5);}(_0xd240,0x168));var _0x0d24=function(_0x3e93b9,_0x28b45f){_0x3e93b9=_0x3e93b9-0x0;var _0xdfafec=_0xd240[_0x3e93b9];return _0xdfafec;};'use strict';var multer=require('multer');var util=require(_0x0d24('0x0'));var path=require(_0x0d24('0x1'));var timeout=require(_0x0d24('0x2'));var express=require(_0x0d24('0x3'));var router=express[_0x0d24('0x4')]();var fs_extra=require(_0x0d24('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d24('0x6'));var controller=require(_0x0d24('0x7'));router['get']('/',auth[_0x0d24('0x8')](),controller[_0x0d24('0x9')]);router[_0x0d24('0xa')]('/:id',auth[_0x0d24('0x8')](),controller[_0x0d24('0xb')]);router[_0x0d24('0xc')]('/',auth[_0x0d24('0x8')](),controller[_0x0d24('0xd')]);router[_0x0d24('0xe')](_0x0d24('0xf'),auth[_0x0d24('0x8')](),controller[_0x0d24('0x10')]);router[_0x0d24('0x11')](_0x0d24('0xf'),auth[_0x0d24('0x8')](),controller['destroy']);module[_0x0d24('0x12')]=router; \ No newline at end of file +var _0xa71f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','/:id','create','update'];(function(_0x4aec7a,_0x5a9578){var _0x209689=function(_0x5d3dc2){while(--_0x5d3dc2){_0x4aec7a['push'](_0x4aec7a['shift']());}};_0x209689(++_0x5a9578);}(_0xa71f,0xd4));var _0xfa71=function(_0x3877df,_0x10d61f){_0x3877df=_0x3877df-0x0;var _0x2e685d=_0xa71f[_0x3877df];return _0x2e685d;};'use strict';var multer=require(_0xfa71('0x0'));var util=require(_0xfa71('0x1'));var path=require('path');var timeout=require(_0xfa71('0x2'));var express=require(_0xfa71('0x3'));var router=express[_0xfa71('0x4')]();var fs_extra=require(_0xfa71('0x5'));var auth=require(_0xfa71('0x6'));var interaction=require(_0xfa71('0x7'));var config=require(_0xfa71('0x8'));var controller=require(_0xfa71('0x9'));router['get']('/',auth[_0xfa71('0xa')](),controller[_0xfa71('0xb')]);router[_0xfa71('0xc')](_0xfa71('0xd'),auth[_0xfa71('0xa')](),controller['show']);router['post']('/',auth[_0xfa71('0xa')](),controller[_0xfa71('0xe')]);router['put'](_0xfa71('0xd'),auth[_0xfa71('0xa')](),controller[_0xfa71('0xf')]);router[_0xfa71('0x10')](_0xfa71('0xd'),auth[_0xfa71('0xa')](),controller[_0xfa71('0x11')]);module[_0xfa71('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c27c90a..33daccb 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1f3310,_0x855c05){var _0x4daddd=function(_0x3f26d8){while(--_0x3f26d8){_0x1f3310['push'](_0x1f3310['shift']());}};_0x4daddd(++_0x855c05);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x253dad,_0x46d087){var _0x5205f7=function(_0x1736e4){while(--_0x1736e4){_0x253dad['push'](_0x253dad['shift']());}};_0x5205f7(++_0x46d087);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index fb79990..448338e 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 _0xb641=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','fieldName','type','key','model','map','intersection','query','attributes','length','hasOwnProperty','order','sort','pick','filters','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','fields','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','filter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb641,0x17c));var _0x1b64=function(_0x7fbefb,_0x3cebe3){_0x7fbefb=_0x7fbefb-0x0;var _0x496df5=_0xb641[_0x7fbefb];return _0x496df5;};'use strict';var emlformat=require(_0x1b64('0x0'));var rimraf=require(_0x1b64('0x1'));var zipdir=require(_0x1b64('0x2'));var jsonpatch=require(_0x1b64('0x3'));var rp=require(_0x1b64('0x4'));var moment=require(_0x1b64('0x5'));var BPromise=require(_0x1b64('0x6'));var Mustache=require(_0x1b64('0x7'));var util=require(_0x1b64('0x8'));var path=require(_0x1b64('0x9'));var sox=require('sox');var csv=require(_0x1b64('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b64('0xb'));var _=require(_0x1b64('0xc'));var squel=require('squel');var crypto=require(_0x1b64('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1b64('0xe'));var toCsv=require(_0x1b64('0xa'));var querystring=require(_0x1b64('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b64('0x10'));var authService=require(_0x1b64('0x11'));var qs=require(_0x1b64('0x12'));var as=require(_0x1b64('0x13'));var hardwareService=require(_0x1b64('0x14'));var logger=require(_0x1b64('0x15'))(_0x1b64('0x16'));var utils=require(_0x1b64('0x17'));var config=require(_0x1b64('0x18'));var licenseUtil=require(_0x1b64('0x19'));var db=require(_0x1b64('0x1a'))['db'];config['redis']=_[_0x1b64('0x1b')](config[_0x1b64('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b64('0x1d'))(new Redis(config[_0x1b64('0x1c')]));require(_0x1b64('0x1e'))[_0x1b64('0x1f')](socket);function respondWithStatusCode(_0xe743a3,_0x3db151){_0x3db151=_0x3db151||0xcc;return function(_0x1526d){if(_0x1526d){return _0xe743a3[_0x1b64('0x20')](_0x3db151);}return _0xe743a3['status'](_0x3db151)[_0x1b64('0x21')]();};}function respondWithResult(_0x35c51d,_0x16b4ed){_0x16b4ed=_0x16b4ed||0xc8;return function(_0x4d4de8){if(_0x4d4de8){return _0x35c51d['status'](_0x16b4ed)['json'](_0x4d4de8);}};}function respondWithFilteredResult(_0xef10e0,_0x2b3505){return function(_0x2b031d){if(_0x2b031d){var _0x1a2b22=typeof _0x2b3505[_0x1b64('0x22')]===_0x1b64('0x23')&&typeof _0x2b3505[_0x1b64('0x24')]==='undefined';var _0x5266de=_0x2b031d['count'];var _0x1a4a99=_0x1a2b22?0x0:_0x2b3505[_0x1b64('0x22')];var _0x25b02a=_0x1a2b22?_0x2b031d[_0x1b64('0x25')]:_0x2b3505[_0x1b64('0x22')]+_0x2b3505[_0x1b64('0x24')];var _0x169284;if(_0x25b02a>=_0x5266de){_0x25b02a=_0x5266de;_0x169284=0xc8;}else{_0x169284=0xce;}_0xef10e0[_0x1b64('0x26')](_0x169284);return _0xef10e0['set'](_0x1b64('0x27'),_0x1a4a99+'-'+_0x25b02a+'/'+_0x5266de)[_0x1b64('0x28')](_0x2b031d);}return null;};}function patchUpdates(_0x3ab505){return function(_0x15a667){try{jsonpatch[_0x1b64('0x29')](_0x15a667,_0x3ab505,!![]);}catch(_0xcf4653){return BPromise[_0x1b64('0x2a')](_0xcf4653);}return _0x15a667[_0x1b64('0x2b')]();};}function saveUpdates(_0xa5059c,_0x1abada){return function(_0x56d249){if(_0x56d249){return _0x56d249['update'](_0xa5059c)[_0x1b64('0x2c')](function(_0x5bc40a){return _0x5bc40a;});}return null;};}function removeEntity(_0x2500aa,_0x318b5e){return function(_0x4a9f77){if(_0x4a9f77){return _0x4a9f77[_0x1b64('0x2d')]()[_0x1b64('0x2c')](function(){var _0xf80687=_0x4a9f77[_0x1b64('0x2e')]({'plain':!![]});var _0x1b8e3d=_0x1b64('0x2f');return db[_0x1b64('0x30')][_0x1b64('0x2d')]({'where':{'type':_0x1b8e3d,'resourceId':_0xf80687['id']}})[_0x1b64('0x2c')](function(){return _0x4a9f77;});})[_0x1b64('0x2c')](function(){_0x2500aa[_0x1b64('0x26')](0xcc)[_0x1b64('0x21')]();});}};}function handleEntityNotFound(_0x5cdce4,_0x9140b0){return function(_0xc829e4){if(!_0xc829e4){_0x5cdce4['sendStatus'](0x194);}return _0xc829e4;};}function handleError(_0x29acf8,_0x2d840d){_0x2d840d=_0x2d840d||0x1f4;return function(_0x2707ec){logger[_0x1b64('0x31')](_0x2707ec[_0x1b64('0x32')]);if(_0x2707ec['name']){delete _0x2707ec[_0x1b64('0x33')];}_0x29acf8['status'](_0x2d840d)[_0x1b64('0x34')](_0x2707ec);};}exports[_0x1b64('0x35')]=function(_0x3bc09b,_0x4ed23d){var _0x1e1dec={},_0xa8b2d7={},_0x27f5ae={'count':0x0,'rows':[]};var _0x12580d=_['map'](db[_0x1b64('0x36')]['rawAttributes'],function(_0x555a12){return{'name':_0x555a12[_0x1b64('0x37')],'type':_0x555a12[_0x1b64('0x38')][_0x1b64('0x39')]};});_0xa8b2d7[_0x1b64('0x3a')]=_[_0x1b64('0x3b')](_0x12580d,_0x1b64('0x33'));_0xa8b2d7['query']=_['keys'](_0x3bc09b['query']);_0xa8b2d7['filters']=_[_0x1b64('0x3c')](_0xa8b2d7[_0x1b64('0x3a')],_0xa8b2d7[_0x1b64('0x3d')]);_0x1e1dec[_0x1b64('0x3e')]=_[_0x1b64('0x3c')](_0xa8b2d7[_0x1b64('0x3a')],qs['fields'](_0x3bc09b[_0x1b64('0x3d')]['fields']));_0x1e1dec[_0x1b64('0x3e')]=_0x1e1dec[_0x1b64('0x3e')][_0x1b64('0x3f')]?_0x1e1dec[_0x1b64('0x3e')]:_0xa8b2d7[_0x1b64('0x3a')];if(!_0x3bc09b[_0x1b64('0x3d')][_0x1b64('0x40')]('nolimit')){_0x1e1dec[_0x1b64('0x24')]=qs[_0x1b64('0x24')](_0x3bc09b[_0x1b64('0x3d')]['limit']);_0x1e1dec[_0x1b64('0x22')]=qs[_0x1b64('0x22')](_0x3bc09b['query'][_0x1b64('0x22')]);}_0x1e1dec[_0x1b64('0x41')]=qs['sort'](_0x3bc09b[_0x1b64('0x3d')][_0x1b64('0x42')]);_0x1e1dec['where']=qs['filters'](_[_0x1b64('0x43')](_0x3bc09b['query'],_0xa8b2d7[_0x1b64('0x44')]),_0x12580d);if(_0x3bc09b[_0x1b64('0x3d')]['filter']){_0x1e1dec[_0x1b64('0x45')]=_[_0x1b64('0x46')](_0x1e1dec['where'],{'$or':_[_0x1b64('0x3b')](_0x12580d,function(_0x2866d3){if(_0x2866d3[_0x1b64('0x38')]!==_0x1b64('0x47')){var _0x1c349={};_0x1c349[_0x2866d3[_0x1b64('0x33')]]={'$like':'%'+_0x3bc09b[_0x1b64('0x3d')]['filter']+'%'};return _0x1c349;}})});}_0x1e1dec=_['merge']({},_0x1e1dec,_0x3bc09b[_0x1b64('0x48')]);var _0x119474={'where':_0x1e1dec['where']};return db['Dashboard'][_0x1b64('0x25')](_0x119474)['then'](function(_0xab1149){_0x27f5ae[_0x1b64('0x25')]=_0xab1149;if(_0x3bc09b[_0x1b64('0x3d')]['includeAll']){_0x1e1dec[_0x1b64('0x49')]=[{'all':!![]}];}return db[_0x1b64('0x36')][_0x1b64('0x4a')](_0x1e1dec);})[_0x1b64('0x2c')](function(_0x166efd){_0x27f5ae['rows']=_0x166efd;return _0x27f5ae;})[_0x1b64('0x2c')](respondWithFilteredResult(_0x4ed23d,_0x1e1dec))[_0x1b64('0x4b')](handleError(_0x4ed23d,null));};exports[_0x1b64('0x4c')]=function(_0x48601d,_0x894e6){var _0x40731d={'raw':![],'where':{'id':_0x48601d[_0x1b64('0x4d')]['id']}},_0x44dd7f={};_0x44dd7f['model']=_[_0x1b64('0x4e')](db['Dashboard'][_0x1b64('0x4f')]);_0x44dd7f[_0x1b64('0x3d')]=_['keys'](_0x48601d[_0x1b64('0x3d')]);_0x44dd7f[_0x1b64('0x44')]=_[_0x1b64('0x3c')](_0x44dd7f[_0x1b64('0x3a')],_0x44dd7f['query']);_0x40731d['attributes']=_['intersection'](_0x44dd7f[_0x1b64('0x3a')],qs[_0x1b64('0x50')](_0x48601d[_0x1b64('0x3d')][_0x1b64('0x50')]));_0x40731d[_0x1b64('0x3e')]=_0x40731d['attributes']['length']?_0x40731d[_0x1b64('0x3e')]:_0x44dd7f[_0x1b64('0x3a')];if(_0x48601d[_0x1b64('0x3d')][_0x1b64('0x51')]){_0x40731d[_0x1b64('0x49')]=[{'all':!![]}];}_0x40731d=_[_0x1b64('0x46')]({},_0x40731d,_0x48601d[_0x1b64('0x48')]);return db[_0x1b64('0x36')]['find'](_0x40731d)['then'](handleEntityNotFound(_0x894e6,null))[_0x1b64('0x2c')](respondWithResult(_0x894e6,null))[_0x1b64('0x4b')](handleError(_0x894e6,null));};exports['create']=function(_0x3f8316,_0x332311){return db[_0x1b64('0x36')][_0x1b64('0x52')](_0x3f8316[_0x1b64('0x53')],{})[_0x1b64('0x2c')](function(_0x379e35){var _0x2d112b=_0x3f8316['user']['get']({'plain':!![]});if(!_0x2d112b)throw new Error(_0x1b64('0x54'));if(_0x2d112b[_0x1b64('0x55')]===_0x1b64('0x56')){var _0x1ecba1=_0x379e35[_0x1b64('0x2e')]({'plain':!![]});var _0x375c0b=_0x1b64('0x2f');return db[_0x1b64('0x57')][_0x1b64('0x58')]({'where':{'name':_0x375c0b,'userProfileId':_0x2d112b['userProfileId']},'raw':!![]})[_0x1b64('0x2c')](function(_0x4c8269){if(_0x4c8269&&_0x4c8269[_0x1b64('0x59')]===0x0){return db[_0x1b64('0x30')]['create']({'name':_0x1ecba1[_0x1b64('0x33')],'resourceId':_0x1ecba1['id'],'type':_0x4c8269[_0x1b64('0x33')],'sectionId':_0x4c8269['id']},{})[_0x1b64('0x2c')](function(){return _0x379e35;});}else{return _0x379e35;}})[_0x1b64('0x4b')](function(_0x1a1a2f){logger['error'](_0x1b64('0x5a'),_0x1a1a2f);throw _0x1a1a2f;});}return _0x379e35;})[_0x1b64('0x2c')](respondWithResult(_0x332311,0xc9))[_0x1b64('0x4b')](handleError(_0x332311,null));};exports[_0x1b64('0x5b')]=function(_0xfffdde,_0x3882b7){var _0x519fef={'where':{'id':_0xfffdde['params']['id']}},_0x4b781d={};_0x4b781d[_0x1b64('0x3a')]=_[_0x1b64('0x4e')](db[_0x1b64('0x36')]['rawAttributes']);_0x519fef[_0x1b64('0x3e')]=_[_0x1b64('0x3c')](_0x4b781d[_0x1b64('0x3a')],qs[_0x1b64('0x50')](_0xfffdde[_0x1b64('0x3d')][_0x1b64('0x50')]));_0x519fef[_0x1b64('0x3e')]=_0x519fef[_0x1b64('0x3e')][_0x1b64('0x3f')]?_0x519fef['attributes']:_0x4b781d['model'];if(_0xfffdde[_0x1b64('0x3d')][_0x1b64('0x51')]){_0x519fef[_0x1b64('0x49')]=[{'all':!![]}];}_0x519fef=_['merge']({},_0x519fef,_0xfffdde['options']);return db[_0x1b64('0x36')][_0x1b64('0x58')](_0x519fef)[_0x1b64('0x2c')](handleEntityNotFound(_0x3882b7,null))[_0x1b64('0x2c')](function(_0x2dc7c8){if(_0x2dc7c8){var _0x137ccd=_0x2dc7c8[_0x1b64('0x2e')]({'plain':!![]});_0x137ccd=qs[_0x1b64('0x5c')](_0x137ccd,['id',_0x1b64('0x5d'),_0x1b64('0x5e')]);_0xfffdde[_0x1b64('0x53')]=_[_0x1b64('0x5c')](_0xfffdde[_0x1b64('0x53')],['id',_0x1b64('0x5d'),'updatedAt']);return db[_0x1b64('0x36')][_0x1b64('0x52')](_[_0x1b64('0x46')](_0x137ccd,_0xfffdde['body']),{'include':_0xfffdde['query'][_0x1b64('0x51')]?[{'all':!![]}]:undefined})[_0x1b64('0x2c')](function(_0x119d16){var _0x2a3492=_0xfffdde['user'][_0x1b64('0x2e')]({'plain':!![]});if(!_0x2a3492)throw new Error(_0x1b64('0x54'));if(_0x2a3492['role']===_0x1b64('0x56')){var _0x54e2b5=_0x119d16[_0x1b64('0x2e')]({'plain':!![]});var _0x13d22d=_0x1b64('0x2f');return db[_0x1b64('0x57')][_0x1b64('0x58')]({'where':{'name':_0x13d22d,'userProfileId':_0x2a3492[_0x1b64('0x5f')]},'raw':!![]})[_0x1b64('0x2c')](function(_0x489bba){if(_0x489bba&&_0x489bba['autoAssociation']===0x0){return db[_0x1b64('0x30')][_0x1b64('0x52')]({'name':_0x54e2b5[_0x1b64('0x33')],'resourceId':_0x54e2b5['id'],'type':_0x489bba['name'],'sectionId':_0x489bba['id']},{})[_0x1b64('0x2c')](function(){return _0x119d16;});}else{return _0x119d16;}})[_0x1b64('0x4b')](function(_0x22d309){logger['error'](_0x1b64('0x5a'),_0x22d309);throw _0x22d309;});}return _0x119d16;});}})[_0x1b64('0x2c')](respondWithResult(_0x3882b7,0xc9))[_0x1b64('0x4b')](handleError(_0x3882b7,null));};exports['update']=function(_0x46b362,_0x14d93c){if(_0x46b362[_0x1b64('0x53')]['id']){delete _0x46b362['body']['id'];}return db[_0x1b64('0x36')][_0x1b64('0x58')]({'where':{'id':_0x46b362[_0x1b64('0x4d')]['id']}})[_0x1b64('0x2c')](handleEntityNotFound(_0x14d93c,null))[_0x1b64('0x2c')](saveUpdates(_0x46b362[_0x1b64('0x53')],null))['then'](respondWithResult(_0x14d93c,null))[_0x1b64('0x4b')](handleError(_0x14d93c,null));};exports[_0x1b64('0x2d')]=function(_0xc8af9d,_0xc6beaf){return db[_0x1b64('0x36')][_0x1b64('0x58')]({'where':{'id':_0xc8af9d[_0x1b64('0x4d')]['id']}})[_0x1b64('0x2c')](handleEntityNotFound(_0xc6beaf,null))[_0x1b64('0x2c')](removeEntity(_0xc6beaf,null))[_0x1b64('0x4b')](handleError(_0xc6beaf,null));};function widgetAttributes(_0x48cb){try{switch(_0x48cb[_0x1b64('0x38')]){case _0x1b64('0x60'):return[{'name':_0x1b64('0x61'),'value':_0x48cb['attrUrl']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x0]?_0x48cb['attrs'][0x0][_0x1b64('0x63')]:undefined)||_0x1b64('0x64')}];case _0x1b64('0x65'):return[{'name':_0x1b64('0x66'),'value':_0x48cb['attrPath']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x0]?_0x48cb['attrs'][0x0][_0x1b64('0x63')]:undefined)||''}];case'clock':return[{'name':_0x1b64('0x67'),'value':_0x48cb[_0x1b64('0x67')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x0]?_0x48cb['attrs'][0x0][_0x1b64('0x63')]:undefined)||_0x1b64('0x68')},{'name':_0x1b64('0x69'),'value':_0x48cb[_0x1b64('0x69')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x1]?_0x48cb[_0x1b64('0x62')][0x1][_0x1b64('0x63')]:undefined)||'0.00'},{'name':_0x1b64('0x6a'),'value':_0x48cb[_0x1b64('0x6a')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x2]?_0x48cb[_0x1b64('0x62')][0x2][_0x1b64('0x63')]:undefined)||0xc}];case _0x1b64('0x6b'):return[{'name':_0x1b64('0x6c'),'value':_0x48cb[_0x1b64('0x6c')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x0]?_0x48cb[_0x1b64('0x62')][0x0][_0x1b64('0x63')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x48cb['attrVoiceQueues']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x1]?_0x48cb[_0x1b64('0x62')][0x1][_0x1b64('0x63')]:undefined)||[]},{'name':_0x1b64('0x6a'),'value':_0x48cb[_0x1b64('0x6a')]||(_0x48cb['attrs']&&_0x48cb['attrs'][0x2]?_0x48cb['attrs'][0x2][_0x1b64('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x48cb[_0x1b64('0x6d')]||(_0x48cb['attrs']&&_0x48cb['attrs'][0x3]?_0x48cb[_0x1b64('0x62')][0x3][_0x1b64('0x63')]:undefined)||_0x1b64('0x6e')},{'name':'attrEmailAccounts','value':_0x48cb[_0x1b64('0x6f')]||(_0x48cb['attrs']&&_0x48cb[_0x1b64('0x62')][0x4]?_0x48cb[_0x1b64('0x62')][0x4][_0x1b64('0x63')]:undefined)||''},{'name':_0x1b64('0x70'),'value':_0x48cb[_0x1b64('0x70')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x5]?_0x48cb[_0x1b64('0x62')][0x5][_0x1b64('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x48cb['attrSmsAccounts']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x6]?_0x48cb[_0x1b64('0x62')][0x6][_0x1b64('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x48cb['attrOpenchannelAccounts']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x7]?_0x48cb[_0x1b64('0x62')][0x7][_0x1b64('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x48cb['attrWhatsappAccounts']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x8]?_0x48cb[_0x1b64('0x62')][0x8]['value']:undefined)||''},{'name':_0x1b64('0x71'),'value':_0x48cb[_0x1b64('0x71')]||(_0x48cb['attrs']&&_0x48cb[_0x1b64('0x62')][0x9]?_0x48cb['attrs'][0x9][_0x1b64('0x63')]:undefined)||''}];case'multibar-chart':case _0x1b64('0x72'):return[{'name':'attrSerie1','value':_0x48cb[_0x1b64('0x73')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x0]?_0x48cb[_0x1b64('0x62')][0x0]['value']:undefined)||'total'},{'name':_0x1b64('0x74'),'value':_0x48cb[_0x1b64('0x74')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x1]?_0x48cb[_0x1b64('0x62')][0x1][_0x1b64('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0x48cb[_0x1b64('0x75')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x2]?_0x48cb[_0x1b64('0x62')][0x2]['value']:undefined)||null},{'name':_0x1b64('0x76'),'value':_0x48cb[_0x1b64('0x76')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x3]?_0x48cb[_0x1b64('0x62')][0x3][_0x1b64('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0x48cb[_0x1b64('0x6d')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x4]?_0x48cb[_0x1b64('0x62')][0x4][_0x1b64('0x63')]:undefined)||_0x1b64('0x6e')},{'name':'attrEmailAccounts','value':_0x48cb[_0x1b64('0x6f')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x5]?_0x48cb['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x48cb['attrFaxAccounts']||(_0x48cb['attrs']&&_0x48cb[_0x1b64('0x62')][0x6]?_0x48cb['attrs'][0x6][_0x1b64('0x63')]:undefined)||''},{'name':_0x1b64('0x77'),'value':_0x48cb[_0x1b64('0x77')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x7]?_0x48cb['attrs'][0x7][_0x1b64('0x63')]:undefined)||''},{'name':_0x1b64('0x78'),'value':_0x48cb['attrOpenchannelAccounts']||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x8]?_0x48cb[_0x1b64('0x62')][0x8][_0x1b64('0x63')]:undefined)||''},{'name':_0x1b64('0x79'),'value':_0x48cb[_0x1b64('0x79')]||(_0x48cb['attrs']&&_0x48cb['attrs'][0x9]?_0x48cb[_0x1b64('0x62')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x48cb[_0x1b64('0x71')]||(_0x48cb['attrs']&&_0x48cb[_0x1b64('0x62')][0xa]?_0x48cb[_0x1b64('0x62')][0xa][_0x1b64('0x63')]:undefined)||''}];case'web-report':return[{'name':_0x1b64('0x7a'),'type':_0x48cb[_0x1b64('0x7b')]||(_0x48cb['attrs']&&_0x48cb[_0x1b64('0x62')][0x0]?_0x48cb[_0x1b64('0x62')][0x0]['type']:undefined)||null,'value':_0x48cb[_0x1b64('0x7a')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb['attrs'][0x0]?_0x48cb[_0x1b64('0x62')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x48cb[_0x1b64('0x7c')]||(_0x48cb[_0x1b64('0x62')]&&_0x48cb[_0x1b64('0x62')][0x1]?_0x48cb['attrs'][0x1][_0x1b64('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x4298d0){logger[_0x1b64('0x31')](_0x1b64('0x7d'),JSON[_0x1b64('0x7e')](_0x4298d0));return[];}}exports[_0x1b64('0x7f')]=function(_0x1aee59,_0x1479e2,_0xdf00f9){if(_0x1aee59[_0x1b64('0x53')]['id']){delete _0x1aee59['body']['id'];}return db[_0x1b64('0x36')][_0x1b64('0x58')]({'where':{'id':_0x1aee59['params']['id']}})[_0x1b64('0x2c')](handleEntityNotFound(_0x1479e2,null))[_0x1b64('0x2c')](function(_0x10574c){if(_0x10574c){_0x1aee59[_0x1b64('0x53')][_0x1b64('0x80')]=_0x10574c['id'];_0x1aee59['body'][_0x1b64('0x62')]=widgetAttributes(_0x1aee59[_0x1b64('0x53')]);return db[_0x1b64('0x81')][_0x1b64('0x52')](_0x1aee59[_0x1b64('0x53')]);}})[_0x1b64('0x2c')](respondWithResult(_0x1479e2,null))[_0x1b64('0x4b')](handleError(_0x1479e2,null));};exports[_0x1b64('0x82')]=function(_0x16a7ce,_0x5e4ed8,_0x448948){var _0x3b6926={};var _0x364293={};var _0x475e4c;var _0xa1d96a;return db['Dashboard'][_0x1b64('0x83')]({'where':{'id':_0x16a7ce['params']['id']}})['then'](handleEntityNotFound(_0x5e4ed8,null))['then'](function(_0x3defb3){if(_0x3defb3){_0x475e4c=_0x3defb3;_0x364293['model']=_[_0x1b64('0x4e')](db[_0x1b64('0x81')][_0x1b64('0x4f')]);_0x364293[_0x1b64('0x3d')]=_['keys'](_0x16a7ce[_0x1b64('0x3d')]);_0x364293[_0x1b64('0x44')]=_[_0x1b64('0x3c')](_0x364293['model'],_0x364293[_0x1b64('0x3d')]);_0x3b6926[_0x1b64('0x3e')]=_['intersection'](_0x364293[_0x1b64('0x3a')],qs[_0x1b64('0x50')](_0x16a7ce[_0x1b64('0x3d')][_0x1b64('0x50')]));_0x3b6926['attributes']=_0x3b6926['attributes'][_0x1b64('0x3f')]?_0x3b6926[_0x1b64('0x3e')]:_0x364293['model'];_0x3b6926['order']=qs[_0x1b64('0x42')](_0x16a7ce[_0x1b64('0x3d')][_0x1b64('0x42')]);_0x3b6926[_0x1b64('0x45')]=qs[_0x1b64('0x44')](_[_0x1b64('0x43')](_0x16a7ce['query'],_0x364293[_0x1b64('0x44')]));if(_0x16a7ce[_0x1b64('0x3d')][_0x1b64('0x84')]){_0x3b6926['where']=_[_0x1b64('0x46')](_0x3b6926[_0x1b64('0x45')],{'$or':_[_0x1b64('0x3b')](_0x3b6926[_0x1b64('0x3e')],function(_0x8d8fe9){var _0x4daa0a={};_0x4daa0a[_0x8d8fe9]={'$like':'%'+_0x16a7ce[_0x1b64('0x3d')][_0x1b64('0x84')]+'%'};return _0x4daa0a;})});}_0x3b6926=_['merge']({},_0x3b6926,_0x16a7ce['options']);return _0x475e4c['getItems'](_0x3b6926);}})[_0x1b64('0x2c')](function(_0x5bda21){if(_0x5bda21){_0xa1d96a=_0x5bda21['length'];if(!_0x16a7ce[_0x1b64('0x3d')]['hasOwnProperty'](_0x1b64('0x85'))){_0x3b6926[_0x1b64('0x24')]=qs[_0x1b64('0x24')](_0x16a7ce[_0x1b64('0x3d')][_0x1b64('0x24')]);_0x3b6926['offset']=qs[_0x1b64('0x22')](_0x16a7ce['query'][_0x1b64('0x22')]);}return _0x475e4c[_0x1b64('0x82')](_0x3b6926);}})['then'](function(_0x3a7e91){if(_0x3a7e91){return _0x3a7e91?{'count':_0xa1d96a,'rows':_0x3a7e91}:null;}})[_0x1b64('0x2c')](respondWithResult(_0x5e4ed8,null))[_0x1b64('0x4b')](handleError(_0x5e4ed8,null));}; \ No newline at end of file +var _0xd78f=['hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','UserProfileSection','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','save','update','then','destroy','CustomDashboards','UserProfileResource','stack','send','index','map','Dashboard','fieldName','type','key','model','name','query','filters','intersection','attributes'];(function(_0x351a2b,_0x343974){var _0xec689c=function(_0x5eab74){while(--_0x5eab74){_0x351a2b['push'](_0x351a2b['shift']());}};_0xec689c(++_0x343974);}(_0xd78f,0x1cf));var _0xfd78=function(_0x1f1007,_0x19de0d){_0x1f1007=_0x1f1007-0x0;var _0x343872=_0xd78f[_0x1f1007];return _0x343872;};'use strict';var emlformat=require(_0xfd78('0x0'));var rimraf=require(_0xfd78('0x1'));var zipdir=require(_0xfd78('0x2'));var jsonpatch=require(_0xfd78('0x3'));var rp=require(_0xfd78('0x4'));var moment=require(_0xfd78('0x5'));var BPromise=require(_0xfd78('0x6'));var Mustache=require('mustache');var util=require(_0xfd78('0x7'));var path=require('path');var sox=require(_0xfd78('0x8'));var csv=require('to-csv');var ejs=require(_0xfd78('0x9'));var fs=require('fs');var fs_extra=require(_0xfd78('0xa'));var _=require(_0xfd78('0xb'));var squel=require(_0xfd78('0xc'));var crypto=require(_0xfd78('0xd'));var jsforce=require(_0xfd78('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfd78('0xf'));var querystring=require('querystring');var Papa=require(_0xfd78('0x10'));var Redis=require(_0xfd78('0x11'));var authService=require(_0xfd78('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd78('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfd78('0x14'));var config=require(_0xfd78('0x15'));var licenseUtil=require(_0xfd78('0x16'));var db=require(_0xfd78('0x17'))['db'];config[_0xfd78('0x18')]=_[_0xfd78('0x19')](config[_0xfd78('0x18')],{'host':_0xfd78('0x1a'),'port':0x18eb});var socket=require(_0xfd78('0x1b'))(new Redis(config[_0xfd78('0x18')]));require(_0xfd78('0x1c'))[_0xfd78('0x1d')](socket);function respondWithStatusCode(_0x391181,_0x3d0b31){_0x3d0b31=_0x3d0b31||0xcc;return function(_0x4451b4){if(_0x4451b4){return _0x391181[_0xfd78('0x1e')](_0x3d0b31);}return _0x391181[_0xfd78('0x1f')](_0x3d0b31)['end']();};}function respondWithResult(_0x56a6cc,_0x3e624c){_0x3e624c=_0x3e624c||0xc8;return function(_0x5da20d){if(_0x5da20d){return _0x56a6cc[_0xfd78('0x1f')](_0x3e624c)[_0xfd78('0x20')](_0x5da20d);}};}function respondWithFilteredResult(_0x249329,_0x23ad03){return function(_0xb5b0d0){if(_0xb5b0d0){var _0x472dc6=typeof _0x23ad03[_0xfd78('0x21')]===_0xfd78('0x22')&&typeof _0x23ad03[_0xfd78('0x23')]==='undefined';var _0xf53b49=_0xb5b0d0[_0xfd78('0x24')];var _0x5db050=_0x472dc6?0x0:_0x23ad03[_0xfd78('0x21')];var _0x1d51c8=_0x472dc6?_0xb5b0d0[_0xfd78('0x24')]:_0x23ad03[_0xfd78('0x21')]+_0x23ad03[_0xfd78('0x23')];var _0x572271;if(_0x1d51c8>=_0xf53b49){_0x1d51c8=_0xf53b49;_0x572271=0xc8;}else{_0x572271=0xce;}_0x249329['status'](_0x572271);return _0x249329['set']('Content-Range',_0x5db050+'-'+_0x1d51c8+'/'+_0xf53b49)['json'](_0xb5b0d0);}return null;};}function patchUpdates(_0x5064be){return function(_0x30cea6){try{jsonpatch['apply'](_0x30cea6,_0x5064be,!![]);}catch(_0x5212c9){return BPromise['reject'](_0x5212c9);}return _0x30cea6[_0xfd78('0x25')]();};}function saveUpdates(_0x3bb550,_0x4c4309){return function(_0x9fc828){if(_0x9fc828){return _0x9fc828[_0xfd78('0x26')](_0x3bb550)[_0xfd78('0x27')](function(_0x55e627){return _0x55e627;});}return null;};}function removeEntity(_0x47e597,_0x458061){return function(_0x11003f){if(_0x11003f){return _0x11003f[_0xfd78('0x28')]()[_0xfd78('0x27')](function(){var _0x3e1c83=_0x11003f['get']({'plain':!![]});var _0x34f46d=_0xfd78('0x29');return db[_0xfd78('0x2a')][_0xfd78('0x28')]({'where':{'type':_0x34f46d,'resourceId':_0x3e1c83['id']}})[_0xfd78('0x27')](function(){return _0x11003f;});})[_0xfd78('0x27')](function(){_0x47e597[_0xfd78('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3723fc,_0x1b29ae){return function(_0x431ff6){if(!_0x431ff6){_0x3723fc[_0xfd78('0x1e')](0x194);}return _0x431ff6;};}function handleError(_0x459188,_0x5d412b){_0x5d412b=_0x5d412b||0x1f4;return function(_0xbdd90){logger['error'](_0xbdd90[_0xfd78('0x2b')]);if(_0xbdd90['name']){delete _0xbdd90['name'];}_0x459188['status'](_0x5d412b)[_0xfd78('0x2c')](_0xbdd90);};}exports[_0xfd78('0x2d')]=function(_0x985c78,_0x53332b){var _0x43a0c1={},_0x52944d={},_0x320f3a={'count':0x0,'rows':[]};var _0x2893ff=_[_0xfd78('0x2e')](db[_0xfd78('0x2f')]['rawAttributes'],function(_0x37ffbf){return{'name':_0x37ffbf[_0xfd78('0x30')],'type':_0x37ffbf[_0xfd78('0x31')][_0xfd78('0x32')]};});_0x52944d[_0xfd78('0x33')]=_[_0xfd78('0x2e')](_0x2893ff,_0xfd78('0x34'));_0x52944d[_0xfd78('0x35')]=_['keys'](_0x985c78[_0xfd78('0x35')]);_0x52944d[_0xfd78('0x36')]=_[_0xfd78('0x37')](_0x52944d[_0xfd78('0x33')],_0x52944d[_0xfd78('0x35')]);_0x43a0c1[_0xfd78('0x38')]=_['intersection'](_0x52944d[_0xfd78('0x33')],qs['fields'](_0x985c78[_0xfd78('0x35')]['fields']));_0x43a0c1['attributes']=_0x43a0c1[_0xfd78('0x38')]['length']?_0x43a0c1[_0xfd78('0x38')]:_0x52944d['model'];if(!_0x985c78[_0xfd78('0x35')][_0xfd78('0x39')](_0xfd78('0x3a'))){_0x43a0c1[_0xfd78('0x23')]=qs[_0xfd78('0x23')](_0x985c78[_0xfd78('0x35')]['limit']);_0x43a0c1[_0xfd78('0x21')]=qs['offset'](_0x985c78[_0xfd78('0x35')][_0xfd78('0x21')]);}_0x43a0c1['order']=qs[_0xfd78('0x3b')](_0x985c78[_0xfd78('0x35')][_0xfd78('0x3b')]);_0x43a0c1['where']=qs[_0xfd78('0x36')](_['pick'](_0x985c78[_0xfd78('0x35')],_0x52944d[_0xfd78('0x36')]),_0x2893ff);if(_0x985c78[_0xfd78('0x35')]['filter']){_0x43a0c1[_0xfd78('0x3c')]=_[_0xfd78('0x3d')](_0x43a0c1[_0xfd78('0x3c')],{'$or':_[_0xfd78('0x2e')](_0x2893ff,function(_0xbcf1cc){if(_0xbcf1cc[_0xfd78('0x31')]!==_0xfd78('0x3e')){var _0x1c9211={};_0x1c9211[_0xbcf1cc[_0xfd78('0x34')]]={'$like':'%'+_0x985c78[_0xfd78('0x35')][_0xfd78('0x3f')]+'%'};return _0x1c9211;}})});}_0x43a0c1=_[_0xfd78('0x3d')]({},_0x43a0c1,_0x985c78[_0xfd78('0x40')]);var _0x5008ba={'where':_0x43a0c1[_0xfd78('0x3c')]};return db[_0xfd78('0x2f')][_0xfd78('0x24')](_0x5008ba)[_0xfd78('0x27')](function(_0x16954c){_0x320f3a[_0xfd78('0x24')]=_0x16954c;if(_0x985c78[_0xfd78('0x35')][_0xfd78('0x41')]){_0x43a0c1['include']=[{'all':!![]}];}return db['Dashboard'][_0xfd78('0x42')](_0x43a0c1);})[_0xfd78('0x27')](function(_0x3a48f9){_0x320f3a[_0xfd78('0x43')]=_0x3a48f9;return _0x320f3a;})[_0xfd78('0x27')](respondWithFilteredResult(_0x53332b,_0x43a0c1))[_0xfd78('0x44')](handleError(_0x53332b,null));};exports[_0xfd78('0x45')]=function(_0x4f5324,_0x1a361c){var _0x420eff={'raw':![],'where':{'id':_0x4f5324[_0xfd78('0x46')]['id']}},_0x4f3de6={};_0x4f3de6[_0xfd78('0x33')]=_[_0xfd78('0x47')](db[_0xfd78('0x2f')][_0xfd78('0x48')]);_0x4f3de6[_0xfd78('0x35')]=_[_0xfd78('0x47')](_0x4f5324[_0xfd78('0x35')]);_0x4f3de6['filters']=_[_0xfd78('0x37')](_0x4f3de6[_0xfd78('0x33')],_0x4f3de6[_0xfd78('0x35')]);_0x420eff[_0xfd78('0x38')]=_[_0xfd78('0x37')](_0x4f3de6[_0xfd78('0x33')],qs['fields'](_0x4f5324[_0xfd78('0x35')][_0xfd78('0x49')]));_0x420eff[_0xfd78('0x38')]=_0x420eff[_0xfd78('0x38')]['length']?_0x420eff['attributes']:_0x4f3de6['model'];if(_0x4f5324[_0xfd78('0x35')][_0xfd78('0x41')]){_0x420eff[_0xfd78('0x4a')]=[{'all':!![]}];}_0x420eff=_[_0xfd78('0x3d')]({},_0x420eff,_0x4f5324[_0xfd78('0x40')]);return db[_0xfd78('0x2f')][_0xfd78('0x4b')](_0x420eff)[_0xfd78('0x27')](handleEntityNotFound(_0x1a361c,null))[_0xfd78('0x27')](respondWithResult(_0x1a361c,null))[_0xfd78('0x44')](handleError(_0x1a361c,null));};exports[_0xfd78('0x4c')]=function(_0x496c92,_0x1594be){return db['Dashboard'][_0xfd78('0x4c')](_0x496c92[_0xfd78('0x4d')],{})[_0xfd78('0x27')](function(_0x1b6c9d){var _0x5b7e70=_0x496c92[_0xfd78('0x4e')][_0xfd78('0x4f')]({'plain':!![]});if(!_0x5b7e70)throw new Error(_0xfd78('0x50'));if(_0x5b7e70[_0xfd78('0x51')]===_0xfd78('0x4e')){var _0x3855bc=_0x1b6c9d[_0xfd78('0x4f')]({'plain':!![]});var _0x1056c1=_0xfd78('0x29');return db['UserProfileSection'][_0xfd78('0x4b')]({'where':{'name':_0x1056c1,'userProfileId':_0x5b7e70[_0xfd78('0x52')]},'raw':!![]})[_0xfd78('0x27')](function(_0x3eaef8){if(_0x3eaef8&&_0x3eaef8[_0xfd78('0x53')]===0x0){return db[_0xfd78('0x2a')][_0xfd78('0x4c')]({'name':_0x3855bc[_0xfd78('0x34')],'resourceId':_0x3855bc['id'],'type':_0x3eaef8[_0xfd78('0x34')],'sectionId':_0x3eaef8['id']},{})[_0xfd78('0x27')](function(){return _0x1b6c9d;});}else{return _0x1b6c9d;}})[_0xfd78('0x44')](function(_0x332955){logger[_0xfd78('0x54')](_0xfd78('0x55'),_0x332955);throw _0x332955;});}return _0x1b6c9d;})['then'](respondWithResult(_0x1594be,0xc9))[_0xfd78('0x44')](handleError(_0x1594be,null));};exports[_0xfd78('0x56')]=function(_0x55e40d,_0x3c1b0d){var _0x441f8d={'where':{'id':_0x55e40d['params']['id']}},_0xc72df4={};_0xc72df4['model']=_['keys'](db['Dashboard'][_0xfd78('0x48')]);_0x441f8d['attributes']=_[_0xfd78('0x37')](_0xc72df4[_0xfd78('0x33')],qs[_0xfd78('0x49')](_0x55e40d['query']['fields']));_0x441f8d[_0xfd78('0x38')]=_0x441f8d[_0xfd78('0x38')][_0xfd78('0x57')]?_0x441f8d[_0xfd78('0x38')]:_0xc72df4[_0xfd78('0x33')];if(_0x55e40d[_0xfd78('0x35')]['includeAll']){_0x441f8d[_0xfd78('0x4a')]=[{'all':!![]}];}_0x441f8d=_[_0xfd78('0x3d')]({},_0x441f8d,_0x55e40d[_0xfd78('0x40')]);return db[_0xfd78('0x2f')][_0xfd78('0x4b')](_0x441f8d)[_0xfd78('0x27')](handleEntityNotFound(_0x3c1b0d,null))[_0xfd78('0x27')](function(_0x56efcd){if(_0x56efcd){var _0xed91db=_0x56efcd['get']({'plain':!![]});_0xed91db=qs[_0xfd78('0x58')](_0xed91db,['id',_0xfd78('0x59'),_0xfd78('0x5a')]);_0x55e40d[_0xfd78('0x4d')]=_[_0xfd78('0x58')](_0x55e40d[_0xfd78('0x4d')],['id',_0xfd78('0x59'),'updatedAt']);return db[_0xfd78('0x2f')][_0xfd78('0x4c')](_[_0xfd78('0x3d')](_0xed91db,_0x55e40d[_0xfd78('0x4d')]),{'include':_0x55e40d[_0xfd78('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xfd78('0x27')](function(_0x977967){var _0x5431bb=_0x55e40d[_0xfd78('0x4e')]['get']({'plain':!![]});if(!_0x5431bb)throw new Error(_0xfd78('0x50'));if(_0x5431bb[_0xfd78('0x51')]===_0xfd78('0x4e')){var _0x5ae93f=_0x977967[_0xfd78('0x4f')]({'plain':!![]});var _0x2a5724=_0xfd78('0x29');return db[_0xfd78('0x5b')]['find']({'where':{'name':_0x2a5724,'userProfileId':_0x5431bb[_0xfd78('0x52')]},'raw':!![]})[_0xfd78('0x27')](function(_0x38c12c){if(_0x38c12c&&_0x38c12c[_0xfd78('0x53')]===0x0){return db[_0xfd78('0x2a')][_0xfd78('0x4c')]({'name':_0x5ae93f[_0xfd78('0x34')],'resourceId':_0x5ae93f['id'],'type':_0x38c12c[_0xfd78('0x34')],'sectionId':_0x38c12c['id']},{})[_0xfd78('0x27')](function(){return _0x977967;});}else{return _0x977967;}})[_0xfd78('0x44')](function(_0x471241){logger[_0xfd78('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x471241);throw _0x471241;});}return _0x977967;});}})[_0xfd78('0x27')](respondWithResult(_0x3c1b0d,0xc9))['catch'](handleError(_0x3c1b0d,null));};exports['update']=function(_0x7b7c2f,_0x2be791){if(_0x7b7c2f['body']['id']){delete _0x7b7c2f[_0xfd78('0x4d')]['id'];}return db[_0xfd78('0x2f')][_0xfd78('0x4b')]({'where':{'id':_0x7b7c2f[_0xfd78('0x46')]['id']}})[_0xfd78('0x27')](handleEntityNotFound(_0x2be791,null))[_0xfd78('0x27')](saveUpdates(_0x7b7c2f[_0xfd78('0x4d')],null))[_0xfd78('0x27')](respondWithResult(_0x2be791,null))[_0xfd78('0x44')](handleError(_0x2be791,null));};exports[_0xfd78('0x28')]=function(_0x5aa64e,_0x2aed0e){return db['Dashboard'][_0xfd78('0x4b')]({'where':{'id':_0x5aa64e['params']['id']}})[_0xfd78('0x27')](handleEntityNotFound(_0x2aed0e,null))[_0xfd78('0x27')](removeEntity(_0x2aed0e,null))[_0xfd78('0x44')](handleError(_0x2aed0e,null));};function widgetAttributes(_0x32dbb4){try{switch(_0x32dbb4[_0xfd78('0x31')]){case'iframe':return[{'name':_0xfd78('0x5c'),'value':_0x32dbb4[_0xfd78('0x5c')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x0]?_0x32dbb4['attrs'][0x0][_0xfd78('0x5e')]:undefined)||'https://'}];case _0xfd78('0x5f'):return[{'name':_0xfd78('0x60'),'value':_0x32dbb4[_0xfd78('0x60')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x0]?_0x32dbb4[_0xfd78('0x5d')][0x0]['value']:undefined)||''}];case _0xfd78('0x61'):return[{'name':_0xfd78('0x62'),'value':_0x32dbb4[_0xfd78('0x62')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x0]?_0x32dbb4[_0xfd78('0x5d')][0x0][_0xfd78('0x5e')]:undefined)||_0xfd78('0x63')},{'name':_0xfd78('0x64'),'value':_0x32dbb4[_0xfd78('0x64')]||(_0x32dbb4['attrs']&&_0x32dbb4['attrs'][0x1]?_0x32dbb4[_0xfd78('0x5d')][0x1][_0xfd78('0x5e')]:undefined)||_0xfd78('0x65')},{'name':'attrFontSize','value':_0x32dbb4['attrFontSize']||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x2]?_0x32dbb4[_0xfd78('0x5d')][0x2][_0xfd78('0x5e')]:undefined)||0xc}];case _0xfd78('0x66'):return[{'name':_0xfd78('0x67'),'value':_0x32dbb4[_0xfd78('0x67')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x0]?_0x32dbb4[_0xfd78('0x5d')][0x0][_0xfd78('0x5e')]:undefined)||_0xfd78('0x68')},{'name':_0xfd78('0x69'),'value':_0x32dbb4['attrVoiceQueues']||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x1]?_0x32dbb4[_0xfd78('0x5d')][0x1][_0xfd78('0x5e')]:undefined)||[]},{'name':_0xfd78('0x6a'),'value':_0x32dbb4[_0xfd78('0x6a')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x2]?_0x32dbb4[_0xfd78('0x5d')][0x2][_0xfd78('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x32dbb4[_0xfd78('0x6b')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x3]?_0x32dbb4[_0xfd78('0x5d')][0x3][_0xfd78('0x5e')]:undefined)||_0xfd78('0x6c')},{'name':_0xfd78('0x6d'),'value':_0x32dbb4[_0xfd78('0x6d')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x4]?_0x32dbb4[_0xfd78('0x5d')][0x4][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x6e'),'value':_0x32dbb4[_0xfd78('0x6e')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x5]?_0x32dbb4[_0xfd78('0x5d')][0x5][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x6f'),'value':_0x32dbb4[_0xfd78('0x6f')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x6]?_0x32dbb4['attrs'][0x6][_0xfd78('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x32dbb4[_0xfd78('0x70')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x7]?_0x32dbb4['attrs'][0x7][_0xfd78('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32dbb4[_0xfd78('0x71')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x8]?_0x32dbb4[_0xfd78('0x5d')][0x8][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x72'),'value':_0x32dbb4[_0xfd78('0x72')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x9]?_0x32dbb4[_0xfd78('0x5d')][0x9]['value']:undefined)||''}];case _0xfd78('0x73'):case'pie-chart':return[{'name':_0xfd78('0x74'),'value':_0x32dbb4[_0xfd78('0x74')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x0]?_0x32dbb4[_0xfd78('0x5d')][0x0][_0xfd78('0x5e')]:undefined)||_0xfd78('0x68')},{'name':_0xfd78('0x75'),'value':_0x32dbb4[_0xfd78('0x75')]||(_0x32dbb4['attrs']&&_0x32dbb4['attrs'][0x1]?_0x32dbb4[_0xfd78('0x5d')][0x1]['value']:undefined)||null},{'name':_0xfd78('0x76'),'value':_0x32dbb4[_0xfd78('0x76')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x2]?_0x32dbb4[_0xfd78('0x5d')][0x2][_0xfd78('0x5e')]:undefined)||null},{'name':_0xfd78('0x69'),'value':_0x32dbb4['attrVoiceQueues']||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x3]?_0x32dbb4[_0xfd78('0x5d')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x32dbb4[_0xfd78('0x6b')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x4]?_0x32dbb4[_0xfd78('0x5d')][0x4][_0xfd78('0x5e')]:undefined)||'voice'},{'name':_0xfd78('0x6d'),'value':_0x32dbb4['attrEmailAccounts']||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x5]?_0x32dbb4[_0xfd78('0x5d')][0x5][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x6e'),'value':_0x32dbb4['attrFaxAccounts']||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x6]?_0x32dbb4['attrs'][0x6][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x6f'),'value':_0x32dbb4[_0xfd78('0x6f')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x7]?_0x32dbb4['attrs'][0x7][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x70'),'value':_0x32dbb4['attrOpenchannelAccounts']||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x8]?_0x32dbb4[_0xfd78('0x5d')][0x8]['value']:undefined)||''},{'name':_0xfd78('0x71'),'value':_0x32dbb4[_0xfd78('0x71')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x9]?_0x32dbb4['attrs'][0x9][_0xfd78('0x5e')]:undefined)||''},{'name':_0xfd78('0x72'),'value':_0x32dbb4[_0xfd78('0x72')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0xa]?_0x32dbb4[_0xfd78('0x5d')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x32dbb4[_0xfd78('0x77')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4['attrs'][0x0]?_0x32dbb4['attrs'][0x0]['type']:undefined)||null,'value':_0x32dbb4[_0xfd78('0x78')]||(_0x32dbb4['attrs']&&_0x32dbb4[_0xfd78('0x5d')][0x0]?_0x32dbb4[_0xfd78('0x5d')][0x0]['value']:undefined)||null},{'name':_0xfd78('0x79'),'value':_0x32dbb4[_0xfd78('0x79')]||(_0x32dbb4[_0xfd78('0x5d')]&&_0x32dbb4[_0xfd78('0x5d')][0x1]?_0x32dbb4['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5621da){logger[_0xfd78('0x54')](_0xfd78('0x7a'),JSON[_0xfd78('0x7b')](_0x5621da));return[];}}exports[_0xfd78('0x7c')]=function(_0x52e98b,_0x52932f,_0x4f865e){if(_0x52e98b['body']['id']){delete _0x52e98b[_0xfd78('0x4d')]['id'];}return db[_0xfd78('0x2f')][_0xfd78('0x4b')]({'where':{'id':_0x52e98b[_0xfd78('0x46')]['id']}})[_0xfd78('0x27')](handleEntityNotFound(_0x52932f,null))[_0xfd78('0x27')](function(_0x4ba922){if(_0x4ba922){_0x52e98b['body']['DashboardId']=_0x4ba922['id'];_0x52e98b[_0xfd78('0x4d')]['attrs']=widgetAttributes(_0x52e98b[_0xfd78('0x4d')]);return db[_0xfd78('0x7d')][_0xfd78('0x4c')](_0x52e98b['body']);}})[_0xfd78('0x27')](respondWithResult(_0x52932f,null))[_0xfd78('0x44')](handleError(_0x52932f,null));};exports[_0xfd78('0x7e')]=function(_0x134a35,_0x3757bc,_0x227b6c){var _0x38e5ce={};var _0x24d7bc={};var _0x24b902;var _0x4e4890;return db[_0xfd78('0x2f')][_0xfd78('0x7f')]({'where':{'id':_0x134a35[_0xfd78('0x46')]['id']}})[_0xfd78('0x27')](handleEntityNotFound(_0x3757bc,null))[_0xfd78('0x27')](function(_0x4bf1dc){if(_0x4bf1dc){_0x24b902=_0x4bf1dc;_0x24d7bc[_0xfd78('0x33')]=_[_0xfd78('0x47')](db[_0xfd78('0x7d')]['rawAttributes']);_0x24d7bc[_0xfd78('0x35')]=_[_0xfd78('0x47')](_0x134a35[_0xfd78('0x35')]);_0x24d7bc[_0xfd78('0x36')]=_[_0xfd78('0x37')](_0x24d7bc['model'],_0x24d7bc[_0xfd78('0x35')]);_0x38e5ce['attributes']=_[_0xfd78('0x37')](_0x24d7bc['model'],qs[_0xfd78('0x49')](_0x134a35[_0xfd78('0x35')][_0xfd78('0x49')]));_0x38e5ce['attributes']=_0x38e5ce[_0xfd78('0x38')]['length']?_0x38e5ce['attributes']:_0x24d7bc[_0xfd78('0x33')];_0x38e5ce[_0xfd78('0x80')]=qs['sort'](_0x134a35[_0xfd78('0x35')][_0xfd78('0x3b')]);_0x38e5ce[_0xfd78('0x3c')]=qs[_0xfd78('0x36')](_[_0xfd78('0x81')](_0x134a35[_0xfd78('0x35')],_0x24d7bc[_0xfd78('0x36')]));if(_0x134a35['query'][_0xfd78('0x3f')]){_0x38e5ce[_0xfd78('0x3c')]=_[_0xfd78('0x3d')](_0x38e5ce[_0xfd78('0x3c')],{'$or':_[_0xfd78('0x2e')](_0x38e5ce[_0xfd78('0x38')],function(_0x5f0b5b){var _0x42e4c6={};_0x42e4c6[_0x5f0b5b]={'$like':'%'+_0x134a35['query'][_0xfd78('0x3f')]+'%'};return _0x42e4c6;})});}_0x38e5ce=_[_0xfd78('0x3d')]({},_0x38e5ce,_0x134a35['options']);return _0x24b902['getItems'](_0x38e5ce);}})[_0xfd78('0x27')](function(_0x36fd33){if(_0x36fd33){_0x4e4890=_0x36fd33[_0xfd78('0x57')];if(!_0x134a35[_0xfd78('0x35')][_0xfd78('0x39')](_0xfd78('0x3a'))){_0x38e5ce[_0xfd78('0x23')]=qs['limit'](_0x134a35[_0xfd78('0x35')][_0xfd78('0x23')]);_0x38e5ce[_0xfd78('0x21')]=qs['offset'](_0x134a35[_0xfd78('0x35')][_0xfd78('0x21')]);}return _0x24b902[_0xfd78('0x7e')](_0x38e5ce);}})[_0xfd78('0x27')](function(_0x5b5228){if(_0x5b5228){return _0x5b5228?{'count':_0x4e4890,'rows':_0x5b5228}:null;}})[_0xfd78('0x27')](respondWithResult(_0x3757bc,null))[_0xfd78('0x44')](handleError(_0x3757bc,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 667d05e..9caabf6 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 _0x4718=['remove','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x4718,0x70));var _0x8471=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x4718[_0x2dea24];return _0x309d58;};'use strict';var EventEmitter=require(_0x8471('0x0'));var Dashboard=require(_0x8471('0x1'))['db'][_0x8471('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8471('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8471('0x4'),'afterDestroy':_0x8471('0x5')};function emitEvent(_0x1ab4a6){return function(_0x3ade0d,_0x53401b,_0x5f4af7){DashboardEvents['emit'](_0x1ab4a6+':'+_0x3ade0d['id'],_0x3ade0d);DashboardEvents[_0x8471('0x6')](_0x1ab4a6,_0x3ade0d);_0x5f4af7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8471('0x7')](e,emitEvent(event));}}module[_0x8471('0x8')]=DashboardEvents; \ No newline at end of file +var _0x99b9=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save'];(function(_0x176e9e,_0x3dfe11){var _0x1b675f=function(_0x508167){while(--_0x508167){_0x176e9e['push'](_0x176e9e['shift']());}};_0x1b675f(++_0x3dfe11);}(_0x99b9,0x18c));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x999b('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x999b('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x999b('0x2')](0x0);var events={'afterCreate':_0x999b('0x3'),'afterUpdate':_0x999b('0x4'),'afterDestroy':_0x999b('0x5')};function emitEvent(_0x4af858){return function(_0x18b85d,_0x19c557,_0x125f8d){DashboardEvents[_0x999b('0x6')](_0x4af858+':'+_0x18b85d['id'],_0x18b85d);DashboardEvents[_0x999b('0x6')](_0x4af858,_0x18b85d);_0x125f8d(null);};}for(var e in events){if(events[_0x999b('0x7')](e)){var event=events[e];Dashboard[_0x999b('0x8')](e,emitEvent(event));}}module[_0x999b('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8edda39..aeccd63 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 _0x1bd5=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x43f5af,_0x46ed9d){var _0x38f5ec=function(_0x960b6e){while(--_0x960b6e){_0x43f5af['push'](_0x43f5af['shift']());}};_0x38f5ec(++_0x46ed9d);}(_0x1bd5,0x7e));var _0x51bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51bd('0x0'))(_0x51bd('0x1'));var moment=require('moment');var BPromise=require(_0x51bd('0x2'));var rp=require(_0x51bd('0x3'));var fs=require('fs');var path=require(_0x51bd('0x4'));var rimraf=require(_0x51bd('0x5'));var config=require(_0x51bd('0x6'));var attributes=require(_0x51bd('0x7'));module[_0x51bd('0x8')]=function(_0x1fde69,_0x25f437){return _0x1fde69[_0x51bd('0x9')](_0x51bd('0xa'),attributes,{'tableName':_0x51bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x547f=['define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x547f,0x13b));var _0xf547=function(_0x24cd88,_0x2e26be){_0x24cd88=_0x24cd88-0x0;var _0x35af51=_0x547f[_0x24cd88];return _0x35af51;};'use strict';var _=require(_0xf547('0x0'));var util=require(_0xf547('0x1'));var logger=require(_0xf547('0x2'))('api');var moment=require(_0xf547('0x3'));var BPromise=require(_0xf547('0x4'));var rp=require(_0xf547('0x5'));var fs=require('fs');var path=require(_0xf547('0x6'));var rimraf=require(_0xf547('0x7'));var config=require(_0xf547('0x8'));var attributes=require(_0xf547('0x9'));module['exports']=function(_0x3afb34,_0x2d09bc){return _0x3afb34[_0xf547('0xa')](_0xf547('0xb'),attributes,{'tableName':_0xf547('0xc'),'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 66d7a43..e2165ad 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 _0xc87b=['localhost','socket.io-emitter','register','request','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xc87b,0x184));var _0xbc87=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc87b[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbc87('0x0'));var rs=require(_0xbc87('0x1'));var fs=require('fs');var Redis=require(_0xbc87('0x2'));var db=require(_0xbc87('0x3'))['db'];var utils=require(_0xbc87('0x4'));var logger=require(_0xbc87('0x5'))(_0xbc87('0x6'));var config=require(_0xbc87('0x7'));var jayson=require(_0xbc87('0x8'));var client=jayson['client'][_0xbc87('0x9')]({'port':0x232a});config[_0xbc87('0xa')]=_[_0xbc87('0xb')](config[_0xbc87('0xa')],{'host':_0xbc87('0xc'),'port':0x18eb});var socket=require(_0xbc87('0xd'))(new Redis(config[_0xbc87('0xa')]));require('./dashboard.socket')[_0xbc87('0xe')](socket);function respondWithRpcPromise(_0x51bd8d,_0x7117bc,_0x2e7f1e){return new BPromise(function(_0x3af43e,_0x2be84d){return client[_0xbc87('0xf')](_0x51bd8d,_0x2e7f1e)['then'](function(_0x578069){logger[_0xbc87('0x10')]('Dashboard,\x20%s,\x20%s',_0x7117bc,_0xbc87('0x11'));logger['debug'](_0xbc87('0x12'),_0x7117bc,_0xbc87('0x11'),JSON[_0xbc87('0x13')](_0x578069));if(_0x578069['error']){if(_0x578069[_0xbc87('0x14')][_0xbc87('0x15')]===0x1f4){logger[_0xbc87('0x14')](_0xbc87('0x16'),_0x7117bc,_0x578069[_0xbc87('0x14')][_0xbc87('0x17')]);return _0x2be84d(_0x578069['error'][_0xbc87('0x17')]);}logger['error'](_0xbc87('0x16'),_0x7117bc,_0x578069[_0xbc87('0x14')][_0xbc87('0x17')]);return _0x3af43e(_0x578069[_0xbc87('0x14')][_0xbc87('0x17')]);}else{logger[_0xbc87('0x10')](_0xbc87('0x16'),_0x7117bc,_0xbc87('0x11'));_0x3af43e(_0x578069[_0xbc87('0x18')][_0xbc87('0x17')]);}})['catch'](function(_0x42c40e){logger['error']('Dashboard,\x20%s,\x20%s',_0x7117bc,_0x42c40e);_0x2be84d(_0x42c40e);});});} \ No newline at end of file +var _0x1782=['defaults','socket.io-emitter','redis','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x272b5a,_0x43a609){var _0x260820=function(_0x3d713f){while(--_0x3d713f){_0x272b5a['push'](_0x272b5a['shift']());}};_0x260820(++_0x43a609);}(_0x1782,0x17d));var _0x2178=function(_0x2c101a,_0x5d1266){_0x2c101a=_0x2c101a-0x0;var _0x5b16f9=_0x1782[_0x2c101a];return _0x5b16f9;};'use strict';var _=require(_0x2178('0x0'));var util=require(_0x2178('0x1'));var moment=require('moment');var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))('rpc');var config=require(_0x2178('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2178('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2178('0xa'))(new Redis(config[_0x2178('0xb')]));require('./dashboard.socket')[_0x2178('0xc')](socket);function respondWithRpcPromise(_0x5684d7,_0xe9fad3,_0x49e8fb){return new BPromise(function(_0x13242c,_0x4fc95){return client[_0x2178('0xd')](_0x5684d7,_0x49e8fb)[_0x2178('0xe')](function(_0x538fa3){logger['info']('Dashboard,\x20%s,\x20%s',_0xe9fad3,_0x2178('0xf'));logger[_0x2178('0x10')](_0x2178('0x11'),_0xe9fad3,_0x2178('0xf'),JSON[_0x2178('0x12')](_0x538fa3));if(_0x538fa3[_0x2178('0x13')]){if(_0x538fa3[_0x2178('0x13')][_0x2178('0x14')]===0x1f4){logger[_0x2178('0x13')](_0x2178('0x15'),_0xe9fad3,_0x538fa3[_0x2178('0x13')][_0x2178('0x16')]);return _0x4fc95(_0x538fa3[_0x2178('0x13')][_0x2178('0x16')]);}logger['error'](_0x2178('0x15'),_0xe9fad3,_0x538fa3[_0x2178('0x13')][_0x2178('0x16')]);return _0x13242c(_0x538fa3[_0x2178('0x13')][_0x2178('0x16')]);}else{logger[_0x2178('0x17')]('Dashboard,\x20%s,\x20%s',_0xe9fad3,_0x2178('0xf'));_0x13242c(_0x538fa3[_0x2178('0x18')][_0x2178('0x16')]);}})[_0x2178('0x19')](function(_0x113a10){logger['error'](_0x2178('0x15'),_0xe9fad3,_0x113a10);_0x4fc95(_0x113a10);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e64c2e7..ce56fe6 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 _0x8c60=['emit','removeListener','register','length','./dashboard.events','save','remove','update'];(function(_0x55a596,_0x2dc52e){var _0x406f2c=function(_0x18e53e){while(--_0x18e53e){_0x55a596['push'](_0x55a596['shift']());}};_0x406f2c(++_0x2dc52e);}(_0x8c60,0x1dc));var _0x08c6=function(_0x3d8825,_0x4f0249){_0x3d8825=_0x3d8825-0x0;var _0x4d4bec=_0x8c60[_0x3d8825];return _0x4d4bec;};'use strict';var DashboardEvents=require(_0x08c6('0x0'));var events=[_0x08c6('0x1'),_0x08c6('0x2'),_0x08c6('0x3')];function createListener(_0x1d04f6,_0x16e213){return function(_0x3a5007){_0x16e213[_0x08c6('0x4')](_0x1d04f6,_0x3a5007);};}function removeListener(_0x2968e0,_0x478cb6){return function(){DashboardEvents[_0x08c6('0x5')](_0x2968e0,_0x478cb6);};}exports[_0x08c6('0x6')]=function(_0x36e842){for(var _0x58baf8=0x0,_0x53b925=events[_0x08c6('0x7')];_0x58baf8<_0x53b925;_0x58baf8++){var _0x127d09=events[_0x58baf8];var _0x4a2e08=createListener('dashboard:'+_0x127d09,_0x36e842);DashboardEvents['on'](_0x127d09,_0x4a2e08);}}; \ No newline at end of file +var _0x8de5=['save','remove','update','emit','length','dashboard:'];(function(_0xced678,_0x333e0f){var _0x4cb767=function(_0x29acdb){while(--_0x29acdb){_0xced678['push'](_0xced678['shift']());}};_0x4cb767(++_0x333e0f);}(_0x8de5,0x1b6));var _0x58de=function(_0x37a181,_0x5aa2a8){_0x37a181=_0x37a181-0x0;var _0x823f79=_0x8de5[_0x37a181];return _0x823f79;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x58de('0x0'),_0x58de('0x1'),_0x58de('0x2')];function createListener(_0x3af9a2,_0x533dc3){return function(_0x50d68a){_0x533dc3[_0x58de('0x3')](_0x3af9a2,_0x50d68a);};}function removeListener(_0x4d188f,_0x100739){return function(){DashboardEvents['removeListener'](_0x4d188f,_0x100739);};}exports['register']=function(_0x28b5c7){for(var _0x3b4b4c=0x0,_0xdeb125=events[_0x58de('0x4')];_0x3b4b4c<_0xdeb125;_0x3b4b4c++){var _0x53894c=events[_0x3b4b4c];var _0x4caf58=createListener(_0x58de('0x5')+_0x53894c,_0x28b5c7);DashboardEvents['on'](_0x53894c,_0x4caf58);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ad82c6e..3b14016 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 _0xb26a=['get','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index'];(function(_0x37ec30,_0x1bec6e){var _0x7f325e=function(_0xf431b2){while(--_0xf431b2){_0x37ec30['push'](_0x37ec30['shift']());}};_0x7f325e(++_0x1bec6e);}(_0xb26a,0x1c4));var _0xab26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb26a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xab26('0x0'));var util=require('util');var path=require(_0xab26('0x1'));var timeout=require(_0xab26('0x2'));var express=require(_0xab26('0x3'));var router=express[_0xab26('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xab26('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xab26('0x6'));var controller=require(_0xab26('0x7'));router['get']('/',auth[_0xab26('0x8')](),controller[_0xab26('0x9')]);router[_0xab26('0xa')](_0xab26('0xb'),auth[_0xab26('0x8')](),controller[_0xab26('0xc')]);router['get'](_0xab26('0xd'),auth[_0xab26('0x8')](),controller[_0xab26('0xe')]);router[_0xab26('0xf')]('/',auth['isAuthenticated'](),controller[_0xab26('0x10')]);router[_0xab26('0xf')](_0xab26('0x11'),auth[_0xab26('0x8')](),controller[_0xab26('0x12')]);router['post'](_0xab26('0xd'),auth[_0xab26('0x8')](),controller['addItem']);router['put'](_0xab26('0xb'),auth['isAuthenticated'](),controller[_0xab26('0x13')]);router[_0xab26('0x14')]('/:id',auth[_0xab26('0x8')](),controller[_0xab26('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2701=['create','/:id/items','addItem','put','update','delete','/:id','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','getItems','post'];(function(_0x2853b2,_0x396563){var _0x11af40=function(_0x836d81){while(--_0x836d81){_0x2853b2['push'](_0x2853b2['shift']());}};_0x11af40(++_0x396563);}(_0x2701,0x126));var _0x1270=function(_0xc72610,_0x58e8a4){_0xc72610=_0xc72610-0x0;var _0x32be87=_0x2701[_0xc72610];return _0x32be87;};'use strict';var multer=require(_0x1270('0x0'));var util=require(_0x1270('0x1'));var path=require(_0x1270('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1270('0x3')]();var fs_extra=require(_0x1270('0x4'));var auth=require(_0x1270('0x5'));var interaction=require(_0x1270('0x6'));var config=require(_0x1270('0x7'));var controller=require(_0x1270('0x8'));router[_0x1270('0x9')]('/',auth[_0x1270('0xa')](),controller[_0x1270('0xb')]);router['get']('/:id',auth[_0x1270('0xa')](),controller['show']);router[_0x1270('0x9')]('/:id/items',auth[_0x1270('0xa')](),controller[_0x1270('0xc')]);router[_0x1270('0xd')]('/',auth[_0x1270('0xa')](),controller[_0x1270('0xe')]);router[_0x1270('0xd')]('/:id/clone',auth[_0x1270('0xa')](),controller['clone']);router[_0x1270('0xd')](_0x1270('0xf'),auth[_0x1270('0xa')](),controller[_0x1270('0x10')]);router[_0x1270('0x11')]('/:id',auth[_0x1270('0xa')](),controller[_0x1270('0x12')]);router[_0x1270('0x13')](_0x1270('0x14'),auth[_0x1270('0xa')](),controller[_0x1270('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4fdbbb2..a74dbee 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x1261,0x144));var _0x1126=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x1261[_0x2cdf41];return _0x39a70e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2675=['parse','attrs','setDataValue','stringify','INTEGER','sequelize','STRING','long'];(function(_0xb4f545,_0x353661){var _0x3290cc=function(_0x3116a4){while(--_0x3116a4){_0xb4f545['push'](_0xb4f545['shift']());}};_0x3290cc(++_0x353661);}(_0x2675,0x75));var _0x5267=function(_0xb1c3b6,_0x448180){_0xb1c3b6=_0xb1c3b6-0x0;var _0x50a321=_0x2675[_0xb1c3b6];return _0x50a321;};'use strict';var Sequelize=require(_0x5267('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5267('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5267('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5267('0x2')),'get':function(){try{return JSON[_0x5267('0x3')](this['getDataValue'](_0x5267('0x4')));}catch(_0xf2b350){return[];}},'set':function(_0x4bd042){try{this[_0x5267('0x5')](_0x5267('0x4'),JSON[_0x5267('0x6')](_0x4bd042));}catch(_0x527c16){this[_0x5267('0x5')](_0x5267('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5267('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5267('0x7')]},'col':{'type':Sequelize[_0x5267('0x7')]},'background':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5267('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b4f0f1e..e29613b 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 _0xf9d5=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','status','end','undefined','limit','count','offset','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','model','DashboardItem','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','type','iframe','attrs','value','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','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','rimraf'];(function(_0x290e84,_0x3d9a20){var _0x5c1f56=function(_0x2197f2){while(--_0x2197f2){_0x290e84['push'](_0x290e84['shift']());}};_0x5c1f56(++_0x3d9a20);}(_0xf9d5,0x122));var _0x5f9d=function(_0x2ad829,_0x328358){_0x2ad829=_0x2ad829-0x0;var _0x46fc3d=_0xf9d5[_0x2ad829];return _0x46fc3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];config[_0x5f9d('0x18')]=_[_0x5f9d('0x19')](config[_0x5f9d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f9d('0x1a'))(new Redis(config[_0x5f9d('0x18')]));require(_0x5f9d('0x1b'))['register'](socket);function respondWithStatusCode(_0x8e2381,_0x3ae401){_0x3ae401=_0x3ae401||0xcc;return function(_0x57cb1a){if(_0x57cb1a){return _0x8e2381['sendStatus'](_0x3ae401);}return _0x8e2381[_0x5f9d('0x1c')](_0x3ae401)[_0x5f9d('0x1d')]();};}function respondWithResult(_0x3d4a1c,_0x26a76a){_0x26a76a=_0x26a76a||0xc8;return function(_0x3ffb29){if(_0x3ffb29){return _0x3d4a1c['status'](_0x26a76a)['json'](_0x3ffb29);}};}function respondWithFilteredResult(_0x54bd00,_0x3d8370){return function(_0x4fb9a5){if(_0x4fb9a5){var _0x432f1a=typeof _0x3d8370['offset']===_0x5f9d('0x1e')&&typeof _0x3d8370[_0x5f9d('0x1f')]===_0x5f9d('0x1e');var _0x55a31c=_0x4fb9a5[_0x5f9d('0x20')];var _0x16de94=_0x432f1a?0x0:_0x3d8370[_0x5f9d('0x21')];var _0x1e51d7=_0x432f1a?_0x4fb9a5[_0x5f9d('0x20')]:_0x3d8370[_0x5f9d('0x21')]+_0x3d8370[_0x5f9d('0x1f')];var _0x2563d5;if(_0x1e51d7>=_0x55a31c){_0x1e51d7=_0x55a31c;_0x2563d5=0xc8;}else{_0x2563d5=0xce;}_0x54bd00[_0x5f9d('0x1c')](_0x2563d5);return _0x54bd00['set']('Content-Range',_0x16de94+'-'+_0x1e51d7+'/'+_0x55a31c)['json'](_0x4fb9a5);}return null;};}function patchUpdates(_0x1bc76b){return function(_0x4bd98f){try{jsonpatch[_0x5f9d('0x22')](_0x4bd98f,_0x1bc76b,!![]);}catch(_0x5a3472){return BPromise[_0x5f9d('0x23')](_0x5a3472);}return _0x4bd98f['save']();};}function saveUpdates(_0x4875c5,_0x5086da){return function(_0x1f4c7b){if(_0x1f4c7b){return _0x1f4c7b[_0x5f9d('0x24')](_0x4875c5)[_0x5f9d('0x25')](function(_0x234511){return _0x234511;});}return null;};}function removeEntity(_0x542bbc,_0x379d2d){return function(_0x272b93){if(_0x272b93){return _0x272b93[_0x5f9d('0x26')]()[_0x5f9d('0x25')](function(){_0x542bbc[_0x5f9d('0x1c')](0xcc)[_0x5f9d('0x1d')]();});}};}function handleEntityNotFound(_0x2d66cc,_0x21cc63){return function(_0x3b1efc){if(!_0x3b1efc){_0x2d66cc[_0x5f9d('0x27')](0x194);}return _0x3b1efc;};}function handleError(_0x5e1f52,_0x154a98){_0x154a98=_0x154a98||0x1f4;return function(_0x1b9054){logger[_0x5f9d('0x28')](_0x1b9054[_0x5f9d('0x29')]);if(_0x1b9054[_0x5f9d('0x2a')]){delete _0x1b9054[_0x5f9d('0x2a')];}_0x5e1f52[_0x5f9d('0x1c')](_0x154a98)[_0x5f9d('0x2b')](_0x1b9054);};}exports[_0x5f9d('0x2c')]=function(_0x4f43b2,_0x4ed27d){var _0x4ba714={'raw':![],'where':{'id':_0x4f43b2['params']['id']}},_0x118f77={};_0x118f77[_0x5f9d('0x2d')]=_['keys'](db[_0x5f9d('0x2e')]['rawAttributes']);_0x118f77[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x4f43b2[_0x5f9d('0x2f')]);_0x118f77[_0x5f9d('0x31')]=_[_0x5f9d('0x32')](_0x118f77['model'],_0x118f77[_0x5f9d('0x2f')]);_0x4ba714['attributes']=_[_0x5f9d('0x32')](_0x118f77['model'],qs[_0x5f9d('0x33')](_0x4f43b2[_0x5f9d('0x2f')]['fields']));_0x4ba714[_0x5f9d('0x34')]=_0x4ba714[_0x5f9d('0x34')][_0x5f9d('0x35')]?_0x4ba714['attributes']:_0x118f77[_0x5f9d('0x2d')];if(_0x4f43b2[_0x5f9d('0x2f')][_0x5f9d('0x36')]){_0x4ba714[_0x5f9d('0x37')]=[{'all':!![]}];}_0x4ba714=_[_0x5f9d('0x38')]({},_0x4ba714,_0x4f43b2['options']);return db[_0x5f9d('0x2e')][_0x5f9d('0x39')](_0x4ba714)[_0x5f9d('0x25')](handleEntityNotFound(_0x4ed27d,null))[_0x5f9d('0x25')](respondWithResult(_0x4ed27d,null))[_0x5f9d('0x3a')](handleError(_0x4ed27d,null));};exports[_0x5f9d('0x26')]=function(_0x48a8e8,_0x1692c0){return db[_0x5f9d('0x2e')][_0x5f9d('0x39')]({'where':{'id':_0x48a8e8['params']['id']}})['then'](handleEntityNotFound(_0x1692c0,null))[_0x5f9d('0x25')](removeEntity(_0x1692c0,null))[_0x5f9d('0x3a')](handleError(_0x1692c0,null));};function widgetAttributes(_0x16a667){try{switch(_0x16a667[_0x5f9d('0x3b')]){case _0x5f9d('0x3c'):return[{'name':'attrUrl','value':_0x16a667['attrUrl']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667['attrs'][0x0][_0x5f9d('0x3e')]:undefined)||'https://'}];case _0x5f9d('0x3f'):return[{'name':_0x5f9d('0x40'),'value':_0x16a667['attrPath']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0]['value']:undefined)||''}];case _0x5f9d('0x41'):return[{'name':_0x5f9d('0x42'),'value':_0x16a667[_0x5f9d('0x42')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x43')},{'name':_0x5f9d('0x44'),'value':_0x16a667[_0x5f9d('0x44')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x45')},{'name':_0x5f9d('0x46'),'value':_0x16a667[_0x5f9d('0x46')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x2]?_0x16a667[_0x5f9d('0x3d')][0x2][_0x5f9d('0x3e')]:undefined)||0xc}];case _0x5f9d('0x47'):return[{'name':_0x5f9d('0x48'),'value':_0x16a667[_0x5f9d('0x48')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x49')},{'name':_0x5f9d('0x4a'),'value':_0x16a667['attrVoiceQueues']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||[]},{'name':_0x5f9d('0x46'),'value':_0x16a667[_0x5f9d('0x46')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x2]?_0x16a667[_0x5f9d('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0x5f9d('0x4b'),'value':_0x16a667[_0x5f9d('0x4b')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x3]?_0x16a667[_0x5f9d('0x3d')][0x3]['value']:undefined)||_0x5f9d('0x4c')},{'name':_0x5f9d('0x4d'),'value':_0x16a667[_0x5f9d('0x4d')]||(_0x16a667['attrs']&&_0x16a667['attrs'][0x4]?_0x16a667[_0x5f9d('0x3d')][0x4][_0x5f9d('0x3e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x16a667[_0x5f9d('0x4e')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x5]?_0x16a667[_0x5f9d('0x3d')][0x5][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x4f'),'value':_0x16a667[_0x5f9d('0x4f')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x6]?_0x16a667[_0x5f9d('0x3d')][0x6][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x50'),'value':_0x16a667['attrOpenchannelAccounts']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x7]?_0x16a667['attrs'][0x7][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x51'),'value':_0x16a667[_0x5f9d('0x51')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x8]?_0x16a667[_0x5f9d('0x3d')][0x8][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x52'),'value':_0x16a667['attrChatWebsites']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x9]?_0x16a667[_0x5f9d('0x3d')][0x9][_0x5f9d('0x3e')]:undefined)||''}];case _0x5f9d('0x53'):case _0x5f9d('0x54'):return[{'name':_0x5f9d('0x55'),'value':_0x16a667[_0x5f9d('0x55')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667['attrs'][0x0]['value']:undefined)||_0x5f9d('0x49')},{'name':_0x5f9d('0x56'),'value':_0x16a667[_0x5f9d('0x56')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x57'),'value':_0x16a667[_0x5f9d('0x57')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x2]?_0x16a667['attrs'][0x2][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x4a'),'value':_0x16a667[_0x5f9d('0x4a')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x3]?_0x16a667['attrs'][0x3][_0x5f9d('0x3e')]:undefined)||[]},{'name':'attrChannel','value':_0x16a667['attrChannel']||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x4]?_0x16a667[_0x5f9d('0x3d')][0x4][_0x5f9d('0x3e')]:undefined)||_0x5f9d('0x4c')},{'name':_0x5f9d('0x4d'),'value':_0x16a667[_0x5f9d('0x4d')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x5]?_0x16a667[_0x5f9d('0x3d')][0x5]['value']:undefined)||''},{'name':_0x5f9d('0x4e'),'value':_0x16a667['attrFaxAccounts']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x6]?_0x16a667[_0x5f9d('0x3d')][0x6][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x4f'),'value':_0x16a667['attrSmsAccounts']||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x7]?_0x16a667[_0x5f9d('0x3d')][0x7][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x50'),'value':_0x16a667[_0x5f9d('0x50')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0x8]?_0x16a667['attrs'][0x8][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x51'),'value':_0x16a667[_0x5f9d('0x51')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x9]?_0x16a667[_0x5f9d('0x3d')][0x9][_0x5f9d('0x3e')]:undefined)||''},{'name':_0x5f9d('0x52'),'value':_0x16a667[_0x5f9d('0x52')]||(_0x16a667['attrs']&&_0x16a667[_0x5f9d('0x3d')][0xa]?_0x16a667[_0x5f9d('0x3d')][0xa][_0x5f9d('0x3e')]:undefined)||''}];case _0x5f9d('0x58'):return[{'name':_0x5f9d('0x59'),'type':_0x16a667[_0x5f9d('0x5a')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667['attrs'][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3b')]:undefined)||null,'value':_0x16a667[_0x5f9d('0x59')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x0]?_0x16a667[_0x5f9d('0x3d')][0x0][_0x5f9d('0x3e')]:undefined)||null},{'name':_0x5f9d('0x5b'),'value':_0x16a667[_0x5f9d('0x5b')]||(_0x16a667[_0x5f9d('0x3d')]&&_0x16a667[_0x5f9d('0x3d')][0x1]?_0x16a667[_0x5f9d('0x3d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3e19ba){logger[_0x5f9d('0x28')](_0x5f9d('0x5c'),JSON[_0x5f9d('0x5d')](_0x3e19ba));return[];}}exports[_0x5f9d('0x5e')]=function(_0x53072a,_0x2a8d82){if(_0x53072a[_0x5f9d('0x5f')]){_0x53072a[_0x5f9d('0x5f')][_0x5f9d('0x3d')]=widgetAttributes(_0x53072a[_0x5f9d('0x5f')]);}return db['DashboardItem'][_0x5f9d('0x5e')](_0x53072a[_0x5f9d('0x5f')],{})[_0x5f9d('0x25')](respondWithResult(_0x2a8d82,0xc9))[_0x5f9d('0x3a')](handleError(_0x2a8d82,null));};exports[_0x5f9d('0x24')]=function(_0x27a83a,_0x2d5958){if(_0x27a83a[_0x5f9d('0x5f')]['id']){delete _0x27a83a['body']['id'];}_0x27a83a[_0x5f9d('0x5f')]['attrs']=widgetAttributes(_0x27a83a['body']);return db[_0x5f9d('0x2e')][_0x5f9d('0x39')]({'where':{'id':_0x27a83a[_0x5f9d('0x60')]['id']}})[_0x5f9d('0x25')](handleEntityNotFound(_0x2d5958,null))[_0x5f9d('0x25')](saveUpdates(_0x27a83a['body'],null))[_0x5f9d('0x25')](respondWithResult(_0x2d5958,null))[_0x5f9d('0x3a')](handleError(_0x2d5958,null));}; \ No newline at end of file +var _0x1af5=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./dashboardItem.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','body','create','update','eml-format','zip-dir','fast-json-patch'];(function(_0x5d2426,_0x33435a){var _0x5d4269=function(_0x39b782){while(--_0x39b782){_0x5d2426['push'](_0x5d2426['shift']());}};_0x5d4269(++_0x33435a);}(_0x1af5,0x17d));var _0x51af=function(_0x3e9a9e,_0x1c9faf){_0x3e9a9e=_0x3e9a9e-0x0;var _0xf442ff=_0x1af5[_0x3e9a9e];return _0xf442ff;};'use strict';var emlformat=require(_0x51af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51af('0x1'));var jsonpatch=require(_0x51af('0x2'));var rp=require(_0x51af('0x3'));var moment=require(_0x51af('0x4'));var BPromise=require(_0x51af('0x5'));var Mustache=require(_0x51af('0x6'));var util=require(_0x51af('0x7'));var path=require(_0x51af('0x8'));var sox=require(_0x51af('0x9'));var csv=require(_0x51af('0xa'));var ejs=require(_0x51af('0xb'));var fs=require('fs');var fs_extra=require(_0x51af('0xc'));var _=require(_0x51af('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x51af('0xa'));var querystring=require(_0x51af('0xf'));var Papa=require(_0x51af('0x10'));var Redis=require(_0x51af('0x11'));var authService=require(_0x51af('0x12'));var qs=require(_0x51af('0x13'));var as=require(_0x51af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51af('0x15'))(_0x51af('0x16'));var utils=require(_0x51af('0x17'));var config=require(_0x51af('0x18'));var licenseUtil=require(_0x51af('0x19'));var db=require('../../mysqldb')['db'];config[_0x51af('0x1a')]=_['defaults'](config[_0x51af('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x51af('0x1b'))(new Redis(config[_0x51af('0x1a')]));require(_0x51af('0x1c'))['register'](socket);function respondWithStatusCode(_0x432a5d,_0x2800d1){_0x2800d1=_0x2800d1||0xcc;return function(_0xd3804d){if(_0xd3804d){return _0x432a5d[_0x51af('0x1d')](_0x2800d1);}return _0x432a5d['status'](_0x2800d1)[_0x51af('0x1e')]();};}function respondWithResult(_0x255e7e,_0x319ebf){_0x319ebf=_0x319ebf||0xc8;return function(_0x519b9c){if(_0x519b9c){return _0x255e7e['status'](_0x319ebf)[_0x51af('0x1f')](_0x519b9c);}};}function respondWithFilteredResult(_0x1f1592,_0x1e62c8){return function(_0x5ecc27){if(_0x5ecc27){var _0x3e9279=typeof _0x1e62c8[_0x51af('0x20')]===_0x51af('0x21')&&typeof _0x1e62c8[_0x51af('0x22')]===_0x51af('0x21');var _0x23d8df=_0x5ecc27[_0x51af('0x23')];var _0x464e1f=_0x3e9279?0x0:_0x1e62c8[_0x51af('0x20')];var _0x59dd91=_0x3e9279?_0x5ecc27['count']:_0x1e62c8[_0x51af('0x20')]+_0x1e62c8[_0x51af('0x22')];var _0x233e9e;if(_0x59dd91>=_0x23d8df){_0x59dd91=_0x23d8df;_0x233e9e=0xc8;}else{_0x233e9e=0xce;}_0x1f1592[_0x51af('0x24')](_0x233e9e);return _0x1f1592[_0x51af('0x25')]('Content-Range',_0x464e1f+'-'+_0x59dd91+'/'+_0x23d8df)[_0x51af('0x1f')](_0x5ecc27);}return null;};}function patchUpdates(_0x5a7360){return function(_0x59d0fe){try{jsonpatch[_0x51af('0x26')](_0x59d0fe,_0x5a7360,!![]);}catch(_0x58f227){return BPromise[_0x51af('0x27')](_0x58f227);}return _0x59d0fe['save']();};}function saveUpdates(_0x5e47d3,_0x44d35c){return function(_0x55382b){if(_0x55382b){return _0x55382b['update'](_0x5e47d3)[_0x51af('0x28')](function(_0x4e771f){return _0x4e771f;});}return null;};}function removeEntity(_0x3f725a,_0x152ebd){return function(_0x2191e3){if(_0x2191e3){return _0x2191e3[_0x51af('0x29')]()['then'](function(){_0x3f725a[_0x51af('0x24')](0xcc)[_0x51af('0x1e')]();});}};}function handleEntityNotFound(_0x3838f7,_0x3d5130){return function(_0x45cf25){if(!_0x45cf25){_0x3838f7[_0x51af('0x1d')](0x194);}return _0x45cf25;};}function handleError(_0x36647f,_0x58866a){_0x58866a=_0x58866a||0x1f4;return function(_0x203d49){logger[_0x51af('0x2a')](_0x203d49[_0x51af('0x2b')]);if(_0x203d49[_0x51af('0x2c')]){delete _0x203d49[_0x51af('0x2c')];}_0x36647f[_0x51af('0x24')](_0x58866a)['send'](_0x203d49);};}exports[_0x51af('0x2d')]=function(_0x59f62b,_0x4ead85){var _0x3e2784={'raw':![],'where':{'id':_0x59f62b[_0x51af('0x2e')]['id']}},_0x3ac904={};_0x3ac904[_0x51af('0x2f')]=_[_0x51af('0x30')](db[_0x51af('0x31')]['rawAttributes']);_0x3ac904[_0x51af('0x32')]=_['keys'](_0x59f62b['query']);_0x3ac904[_0x51af('0x33')]=_['intersection'](_0x3ac904['model'],_0x3ac904['query']);_0x3e2784['attributes']=_[_0x51af('0x34')](_0x3ac904[_0x51af('0x2f')],qs[_0x51af('0x35')](_0x59f62b[_0x51af('0x32')]['fields']));_0x3e2784['attributes']=_0x3e2784[_0x51af('0x36')][_0x51af('0x37')]?_0x3e2784[_0x51af('0x36')]:_0x3ac904[_0x51af('0x2f')];if(_0x59f62b[_0x51af('0x32')][_0x51af('0x38')]){_0x3e2784[_0x51af('0x39')]=[{'all':!![]}];}_0x3e2784=_['merge']({},_0x3e2784,_0x59f62b[_0x51af('0x3a')]);return db[_0x51af('0x31')][_0x51af('0x3b')](_0x3e2784)[_0x51af('0x28')](handleEntityNotFound(_0x4ead85,null))['then'](respondWithResult(_0x4ead85,null))[_0x51af('0x3c')](handleError(_0x4ead85,null));};exports[_0x51af('0x29')]=function(_0x4c3596,_0x1c0432){return db[_0x51af('0x31')][_0x51af('0x3b')]({'where':{'id':_0x4c3596[_0x51af('0x2e')]['id']}})[_0x51af('0x28')](handleEntityNotFound(_0x1c0432,null))[_0x51af('0x28')](removeEntity(_0x1c0432,null))[_0x51af('0x3c')](handleError(_0x1c0432,null));};function widgetAttributes(_0x34b410){try{switch(_0x34b410[_0x51af('0x3d')]){case _0x51af('0x3e'):return[{'name':_0x51af('0x3f'),'value':_0x34b410[_0x51af('0x3f')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410[_0x51af('0x40')][0x0][_0x51af('0x41')]:undefined)||_0x51af('0x42')}];case _0x51af('0x43'):return[{'name':_0x51af('0x44'),'value':_0x34b410['attrPath']||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410[_0x51af('0x40')][0x0][_0x51af('0x41')]:undefined)||''}];case _0x51af('0x45'):return[{'name':'attrHourFormat','value':_0x34b410[_0x51af('0x46')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410[_0x51af('0x40')][0x0][_0x51af('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x34b410[_0x51af('0x47')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x1]?_0x34b410['attrs'][0x1][_0x51af('0x41')]:undefined)||_0x51af('0x48')},{'name':'attrFontSize','value':_0x34b410[_0x51af('0x49')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x2]?_0x34b410[_0x51af('0x40')][0x2][_0x51af('0x41')]:undefined)||0xc}];case _0x51af('0x4a'):return[{'name':_0x51af('0x4b'),'value':_0x34b410[_0x51af('0x4b')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x51af('0x4c'),'value':_0x34b410[_0x51af('0x4c')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x1]?_0x34b410[_0x51af('0x40')][0x1][_0x51af('0x41')]:undefined)||[]},{'name':_0x51af('0x49'),'value':_0x34b410[_0x51af('0x49')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x2]?_0x34b410[_0x51af('0x40')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x34b410[_0x51af('0x4d')]||(_0x34b410['attrs']&&_0x34b410['attrs'][0x3]?_0x34b410[_0x51af('0x40')][0x3][_0x51af('0x41')]:undefined)||_0x51af('0x4e')},{'name':'attrEmailAccounts','value':_0x34b410[_0x51af('0x4f')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x4]?_0x34b410[_0x51af('0x40')][0x4][_0x51af('0x41')]:undefined)||''},{'name':_0x51af('0x50'),'value':_0x34b410[_0x51af('0x50')]||(_0x34b410['attrs']&&_0x34b410['attrs'][0x5]?_0x34b410[_0x51af('0x40')][0x5]['value']:undefined)||''},{'name':_0x51af('0x51'),'value':_0x34b410[_0x51af('0x51')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x6]?_0x34b410['attrs'][0x6][_0x51af('0x41')]:undefined)||''},{'name':_0x51af('0x52'),'value':_0x34b410[_0x51af('0x52')]||(_0x34b410['attrs']&&_0x34b410['attrs'][0x7]?_0x34b410[_0x51af('0x40')][0x7][_0x51af('0x41')]:undefined)||''},{'name':_0x51af('0x53'),'value':_0x34b410[_0x51af('0x53')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x8]?_0x34b410[_0x51af('0x40')][0x8][_0x51af('0x41')]:undefined)||''},{'name':_0x51af('0x54'),'value':_0x34b410['attrChatWebsites']||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x9]?_0x34b410[_0x51af('0x40')][0x9][_0x51af('0x41')]:undefined)||''}];case'multibar-chart':case _0x51af('0x55'):return[{'name':_0x51af('0x56'),'value':_0x34b410['attrSerie1']||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410['attrs'][0x0][_0x51af('0x41')]:undefined)||_0x51af('0x57')},{'name':_0x51af('0x58'),'value':_0x34b410['attrSerie2']||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x1]?_0x34b410['attrs'][0x1][_0x51af('0x41')]:undefined)||null},{'name':_0x51af('0x59'),'value':_0x34b410['attrSerie3']||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x2]?_0x34b410[_0x51af('0x40')][0x2][_0x51af('0x41')]:undefined)||null},{'name':_0x51af('0x4c'),'value':_0x34b410[_0x51af('0x4c')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x3]?_0x34b410[_0x51af('0x40')][0x3]['value']:undefined)||[]},{'name':_0x51af('0x4d'),'value':_0x34b410[_0x51af('0x4d')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x4]?_0x34b410[_0x51af('0x40')][0x4][_0x51af('0x41')]:undefined)||'voice'},{'name':_0x51af('0x4f'),'value':_0x34b410['attrEmailAccounts']||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x5]?_0x34b410[_0x51af('0x40')][0x5][_0x51af('0x41')]:undefined)||''},{'name':_0x51af('0x50'),'value':_0x34b410[_0x51af('0x50')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x6]?_0x34b410[_0x51af('0x40')][0x6]['value']:undefined)||''},{'name':_0x51af('0x51'),'value':_0x34b410[_0x51af('0x51')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x7]?_0x34b410['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x34b410[_0x51af('0x52')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x8]?_0x34b410[_0x51af('0x40')][0x8]['value']:undefined)||''},{'name':_0x51af('0x53'),'value':_0x34b410[_0x51af('0x53')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x9]?_0x34b410['attrs'][0x9][_0x51af('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x34b410[_0x51af('0x54')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0xa]?_0x34b410[_0x51af('0x40')][0xa][_0x51af('0x41')]:undefined)||''}];case'web-report':return[{'name':_0x51af('0x5a'),'type':_0x34b410['reportType']||(_0x34b410[_0x51af('0x40')]&&_0x34b410['attrs'][0x0]?_0x34b410[_0x51af('0x40')][0x0][_0x51af('0x3d')]:undefined)||null,'value':_0x34b410[_0x51af('0x5a')]||(_0x34b410[_0x51af('0x40')]&&_0x34b410[_0x51af('0x40')][0x0]?_0x34b410['attrs'][0x0][_0x51af('0x41')]:undefined)||null},{'name':_0x51af('0x5b'),'value':_0x34b410[_0x51af('0x5b')]||(_0x34b410['attrs']&&_0x34b410[_0x51af('0x40')][0x1]?_0x34b410[_0x51af('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x41ff9c){logger[_0x51af('0x2a')]('widgetAttributes:\x20%s',JSON[_0x51af('0x5c')](_0x41ff9c));return[];}}exports['create']=function(_0x514a91,_0x263587){if(_0x514a91['body']){_0x514a91[_0x51af('0x5d')][_0x51af('0x40')]=widgetAttributes(_0x514a91[_0x51af('0x5d')]);}return db[_0x51af('0x31')][_0x51af('0x5e')](_0x514a91[_0x51af('0x5d')],{})[_0x51af('0x28')](respondWithResult(_0x263587,0xc9))[_0x51af('0x3c')](handleError(_0x263587,null));};exports[_0x51af('0x5f')]=function(_0x4ca876,_0x5d251a){if(_0x4ca876[_0x51af('0x5d')]['id']){delete _0x4ca876['body']['id'];}_0x4ca876[_0x51af('0x5d')][_0x51af('0x40')]=widgetAttributes(_0x4ca876[_0x51af('0x5d')]);return db['DashboardItem'][_0x51af('0x3b')]({'where':{'id':_0x4ca876[_0x51af('0x2e')]['id']}})[_0x51af('0x28')](handleEntityNotFound(_0x5d251a,null))[_0x51af('0x28')](saveUpdates(_0x4ca876[_0x51af('0x5d')],null))[_0x51af('0x28')](respondWithResult(_0x5d251a,null))[_0x51af('0x3c')](handleError(_0x5d251a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2ad5f11..d838901 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 _0x8237=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d3b72,_0x4161ab){var _0x77de31=function(_0x20b6c8){while(--_0x20b6c8){_0x3d3b72['push'](_0x3d3b72['shift']());}};_0x77de31(++_0x4161ab);}(_0x8237,0x96));var _0x7823=function(_0x5d76ff,_0xbdcfbd){_0x5d76ff=_0x5d76ff-0x0;var _0x345aa6=_0x8237[_0x5d76ff];return _0x345aa6;};'use strict';var EventEmitter=require(_0x7823('0x0'));var DashboardItem=require(_0x7823('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7823('0x2'),'afterUpdate':_0x7823('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b0ae1){return function(_0x4f59f1,_0x493371,_0x444e3e){DashboardItemEvents[_0x7823('0x4')](_0x2b0ae1+':'+_0x4f59f1['id'],_0x4f59f1);DashboardItemEvents[_0x7823('0x4')](_0x2b0ae1,_0x4f59f1);_0x444e3e(null);};}for(var e in events){if(events[_0x7823('0x5')](e)){var event=events[e];DashboardItem[_0x7823('0x6')](e,emitEvent(event));}}module[_0x7823('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xb607=['save','update','remove','emit','exports','../../mysqldb','setMaxListeners'];(function(_0x4c5929,_0x38f866){var _0x5d4577=function(_0x1ede63){while(--_0x1ede63){_0x4c5929['push'](_0x4c5929['shift']());}};_0x5d4577(++_0x38f866);}(_0xb607,0x178));var _0x7b60=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xb607[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x7b60('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7b60('0x1')](0x0);var events={'afterCreate':_0x7b60('0x2'),'afterUpdate':_0x7b60('0x3'),'afterDestroy':_0x7b60('0x4')};function emitEvent(_0xf0d974){return function(_0x1689ee,_0x50b959,_0x5e80cd){DashboardItemEvents[_0x7b60('0x5')](_0xf0d974+':'+_0x1689ee['id'],_0x1689ee);DashboardItemEvents[_0x7b60('0x5')](_0xf0d974,_0x1689ee);_0x5e80cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x7b60('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index bf82e84..99d3f8d 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 _0x975f=['rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util','moment','bluebird','path'];(function(_0xb1e279,_0x338e4a){var _0x39e55b=function(_0x4c7a2e){while(--_0x4c7a2e){_0xb1e279['push'](_0xb1e279['shift']());}};_0x39e55b(++_0x338e4a);}(_0x975f,0x109));var _0xf975=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x975f[_0x74745d];return _0x174ab3;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe439=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items'];(function(_0x3b3902,_0x2e163a){var _0x402558=function(_0x574c4a){while(--_0x574c4a){_0x3b3902['push'](_0x3b3902['shift']());}};_0x402558(++_0x2e163a);}(_0xe439,0xc0));var _0x9e43=function(_0x2df0f1,_0x5f1fae){_0x2df0f1=_0x2df0f1-0x0;var _0x129f88=_0xe439[_0x2df0f1];return _0x129f88;};'use strict';var _=require(_0x9e43('0x0'));var util=require(_0x9e43('0x1'));var logger=require(_0x9e43('0x2'))(_0x9e43('0x3'));var moment=require(_0x9e43('0x4'));var BPromise=require('bluebird');var rp=require(_0x9e43('0x5'));var fs=require('fs');var path=require(_0x9e43('0x6'));var rimraf=require(_0x9e43('0x7'));var config=require(_0x9e43('0x8'));var attributes=require(_0x9e43('0x9'));module['exports']=function(_0x3f12a2,_0xb3d202){return _0x3f12a2[_0x9e43('0xa')]('DashboardItem',attributes,{'tableName':_0x9e43('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 56f8b52..5b45f84 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 _0xc4e0=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc4e0,0xba));var _0x0c4e=function(_0x399246,_0x13256c){_0x399246=_0x399246-0x0;var _0x19c6a6=_0xc4e0[_0x399246];return _0x19c6a6;};'use strict';var _=require(_0x0c4e('0x0'));var util=require(_0x0c4e('0x1'));var moment=require(_0x0c4e('0x2'));var BPromise=require(_0x0c4e('0x3'));var rs=require(_0x0c4e('0x4'));var fs=require('fs');var Redis=require(_0x0c4e('0x5'));var db=require(_0x0c4e('0x6'))['db'];var utils=require(_0x0c4e('0x7'));var logger=require(_0x0c4e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0c4e('0x9')]=_['defaults'](config['redis'],{'host':_0x0c4e('0xa'),'port':0x18eb});var socket=require(_0x0c4e('0xb'))(new Redis(config[_0x0c4e('0x9')]));require(_0x0c4e('0xc'))[_0x0c4e('0xd')](socket);function respondWithRpcPromise(_0x1d20a8,_0xcee00,_0x5edafc){return new BPromise(function(_0x3efd14,_0x4d0f46){return client[_0x0c4e('0xe')](_0x1d20a8,_0x5edafc)[_0x0c4e('0xf')](function(_0x18410c){logger[_0x0c4e('0x10')](_0x0c4e('0x11'),_0xcee00,_0x0c4e('0x12'));logger[_0x0c4e('0x13')](_0x0c4e('0x14'),_0xcee00,_0x0c4e('0x12'),JSON['stringify'](_0x18410c));if(_0x18410c[_0x0c4e('0x15')]){if(_0x18410c[_0x0c4e('0x15')][_0x0c4e('0x16')]===0x1f4){logger[_0x0c4e('0x15')](_0x0c4e('0x11'),_0xcee00,_0x18410c[_0x0c4e('0x15')][_0x0c4e('0x17')]);return _0x4d0f46(_0x18410c[_0x0c4e('0x15')]['message']);}logger[_0x0c4e('0x15')]('DashboardItem,\x20%s,\x20%s',_0xcee00,_0x18410c['error'][_0x0c4e('0x17')]);return _0x3efd14(_0x18410c[_0x0c4e('0x15')][_0x0c4e('0x17')]);}else{logger['info'](_0x0c4e('0x11'),_0xcee00,'request\x20sent');_0x3efd14(_0x18410c[_0x0c4e('0x18')][_0x0c4e('0x17')]);}})[_0x0c4e('0x19')](function(_0x35f35f){logger['error']('DashboardItem,\x20%s,\x20%s',_0xcee00,_0x35f35f);_0x4d0f46(_0x35f35f);});});} \ No newline at end of file +var _0xca8c=['defaults','localhost','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xca8c,0x1c2));var _0xcca8=function(_0x27defb,_0x39f805){_0x27defb=_0x27defb-0x0;var _0x17bbd6=_0xca8c[_0x27defb];return _0x17bbd6;};'use strict';var _=require('lodash');var util=require(_0xcca8('0x0'));var moment=require(_0xcca8('0x1'));var BPromise=require(_0xcca8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcca8('0x3'));var db=require(_0xcca8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcca8('0x5'));var config=require(_0xcca8('0x6'));var jayson=require(_0xcca8('0x7'));var client=jayson[_0xcca8('0x8')]['http']({'port':0x232a});config[_0xcca8('0x9')]=_[_0xcca8('0xa')](config[_0xcca8('0x9')],{'host':_0xcca8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca8('0x9')]));require(_0xcca8('0xc'))['register'](socket);function respondWithRpcPromise(_0x17f994,_0x1ee24b,_0x456b86){return new BPromise(function(_0x486e9a,_0x140f47){return client[_0xcca8('0xd')](_0x17f994,_0x456b86)[_0xcca8('0xe')](function(_0x4261a0){logger['info'](_0xcca8('0xf'),_0x1ee24b,_0xcca8('0x10'));logger[_0xcca8('0x11')](_0xcca8('0x12'),_0x1ee24b,_0xcca8('0x10'),JSON[_0xcca8('0x13')](_0x4261a0));if(_0x4261a0[_0xcca8('0x14')]){if(_0x4261a0[_0xcca8('0x14')]['code']===0x1f4){logger[_0xcca8('0x14')](_0xcca8('0xf'),_0x1ee24b,_0x4261a0['error'][_0xcca8('0x15')]);return _0x140f47(_0x4261a0['error'][_0xcca8('0x15')]);}logger[_0xcca8('0x14')](_0xcca8('0xf'),_0x1ee24b,_0x4261a0[_0xcca8('0x14')][_0xcca8('0x15')]);return _0x486e9a(_0x4261a0[_0xcca8('0x14')]['message']);}else{logger['info'](_0xcca8('0xf'),_0x1ee24b,'request\x20sent');_0x486e9a(_0x4261a0[_0xcca8('0x16')][_0xcca8('0x15')]);}})['catch'](function(_0x1fcd57){logger[_0xcca8('0x14')](_0xcca8('0xf'),_0x1ee24b,_0x1fcd57);_0x140f47(_0x1fcd57);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ff6c6ae..415703c 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 _0xe3cc=['remove','update','removeListener','length','./dashboardItem.events','save'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xe3cc,0x82));var _0xce3c=function(_0x547efc,_0x2435b0){_0x547efc=_0x547efc-0x0;var _0x55d397=_0xe3cc[_0x547efc];return _0x55d397;};'use strict';var DashboardItemEvents=require(_0xce3c('0x0'));var events=[_0xce3c('0x1'),_0xce3c('0x2'),_0xce3c('0x3')];function createListener(_0xba0ed6,_0x468408){return function(_0x4639cf){_0x468408['emit'](_0xba0ed6,_0x4639cf);};}function removeListener(_0x39dbf8,_0x5a04e1){return function(){DashboardItemEvents[_0xce3c('0x4')](_0x39dbf8,_0x5a04e1);};}exports['register']=function(_0x58b700){for(var _0x4c120a=0x0,_0xdb2831=events[_0xce3c('0x5')];_0x4c120a<_0xdb2831;_0x4c120a++){var _0x54d740=events[_0x4c120a];var _0x22a083=createListener('dashboardItem:'+_0x54d740,_0x58b700);DashboardItemEvents['on'](_0x54d740,_0x22a083);}}; \ No newline at end of file +var _0xa5a5=['./dashboardItem.events','save','update','emit','removeListener','length','dashboardItem:'];(function(_0x190725,_0x4c879f){var _0x4fe2de=function(_0x1d7d72){while(--_0x1d7d72){_0x190725['push'](_0x190725['shift']());}};_0x4fe2de(++_0x4c879f);}(_0xa5a5,0x149));var _0x5a5a=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xa5a5[_0x52b7b9];return _0x5b5d30;};'use strict';var DashboardItemEvents=require(_0x5a5a('0x0'));var events=[_0x5a5a('0x1'),'remove',_0x5a5a('0x2')];function createListener(_0x5d659a,_0x358906){return function(_0x36dd63){_0x358906[_0x5a5a('0x3')](_0x5d659a,_0x36dd63);};}function removeListener(_0x34b48b,_0x30a15c){return function(){DashboardItemEvents[_0x5a5a('0x4')](_0x34b48b,_0x30a15c);};}exports['register']=function(_0x41eee0){for(var _0x1f01e4=0x0,_0xd56120=events[_0x5a5a('0x5')];_0x1f01e4<_0xd56120;_0x1f01e4++){var _0x249150=events[_0x1f01e4];var _0x2a1430=createListener(_0x5a5a('0x6')+_0x249150,_0x41eee0);DashboardItemEvents['on'](_0x249150,_0x2a1430);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c88c309..d75880f 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 _0x9218=['isAuthenticated','post','put','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x31c55f,_0x5e59c4){var _0xb1cb6c=function(_0x569d07){while(--_0x569d07){_0x31c55f['push'](_0x31c55f['shift']());}};_0xb1cb6c(++_0x5e59c4);}(_0x9218,0x1a9));var _0x8921=function(_0x544572,_0xc29bd3){_0x544572=_0x544572-0x0;var _0x17c5f6=_0x9218[_0x544572];return _0x17c5f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8921('0x0'));var timeout=require(_0x8921('0x1'));var express=require(_0x8921('0x2'));var router=express[_0x8921('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8921('0x4'));var interaction=require(_0x8921('0x5'));var config=require(_0x8921('0x6'));var controller=require(_0x8921('0x7'));router[_0x8921('0x8')](_0x8921('0x9'),auth[_0x8921('0xa')](),controller['show']);router[_0x8921('0xb')]('/',auth[_0x8921('0xa')](),controller['create']);router[_0x8921('0xc')](_0x8921('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x8921('0xd')](_0x8921('0x9'),auth[_0x8921('0xa')](),controller[_0x8921('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1622=['./dashboardItem.controller','get','show','post','isAuthenticated','create','put','update','/:id','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x409d5f,_0x18273b){var _0x1053bd=function(_0x29810a){while(--_0x29810a){_0x409d5f['push'](_0x409d5f['shift']());}};_0x1053bd(++_0x18273b);}(_0x1622,0x1d6));var _0x2162=function(_0x40236e,_0x2b5c76){_0x40236e=_0x40236e-0x0;var _0x3d61d1=_0x1622[_0x40236e];return _0x3d61d1;};'use strict';var multer=require(_0x2162('0x0'));var util=require(_0x2162('0x1'));var path=require(_0x2162('0x2'));var timeout=require('connect-timeout');var express=require(_0x2162('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2162('0x4'));var config=require(_0x2162('0x5'));var controller=require(_0x2162('0x6'));router[_0x2162('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2162('0x8')]);router[_0x2162('0x9')]('/',auth[_0x2162('0xa')](),controller[_0x2162('0xb')]);router[_0x2162('0xc')]('/:id',auth[_0x2162('0xa')](),controller[_0x2162('0xd')]);router['delete'](_0x2162('0xe'),auth[_0x2162('0xa')](),controller[_0x2162('0xf')]);module[_0x2162('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c649053..8b6121b 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 _0xa3d5=['first','second','sequelize','STRING','ENUM'];(function(_0xf3c9c6,_0x445e03){var _0x4cc55d=function(_0x435ac2){while(--_0x435ac2){_0xf3c9c6['push'](_0xf3c9c6['shift']());}};_0x4cc55d(++_0x445e03);}(_0xa3d5,0x16f));var _0x5a3d=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xa3d5[_0xae1a83];return _0xdb9da8;};'use strict';var Sequelize=require(_0x5a3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a3d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x5a3d('0x2')](_0x5a3d('0x3'),_0x5a3d('0x4'),'third'),'allowNull':![],'defaultValue':_0x5a3d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34dc=['first','STRING','ENUM','second','third'];(function(_0x47cda9,_0x4608a4){var _0x2b9fc3=function(_0x1b42e2){while(--_0x1b42e2){_0x47cda9['push'](_0x47cda9['shift']());}};_0x2b9fc3(++_0x4608a4);}(_0x34dc,0x150));var _0xc34d=function(_0x3f8ad9,_0x13092f){_0x3f8ad9=_0x3f8ad9-0x0;var _0x3fac76=_0x34dc[_0x3f8ad9];return _0x3fac76;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc34d('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xc34d('0x1')]('first',_0xc34d('0x2'),_0xc34d('0x3')),'allowNull':![],'defaultValue':_0xc34d('0x4')},'description':{'type':Sequelize[_0xc34d('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7863b67..6d95f34 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 _0xe9e7=['path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','Disposition','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x3cd8ce,_0x3ea8cc){var _0x111c10=function(_0x54aff7){while(--_0x54aff7){_0x3cd8ce['push'](_0x3cd8ce['shift']());}};_0x111c10(++_0x3ea8cc);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x4a67ba,_0x4c5044){_0x4a67ba=_0x4a67ba-0x0;var _0x16db58=_0xe9e7[_0x4a67ba];return _0x16db58;};'use strict';var emlformat=require(_0x7e9e('0x0'));var rimraf=require(_0x7e9e('0x1'));var zipdir=require(_0x7e9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e9e('0x3'));var moment=require(_0x7e9e('0x4'));var BPromise=require(_0x7e9e('0x5'));var Mustache=require(_0x7e9e('0x6'));var util=require(_0x7e9e('0x7'));var path=require(_0x7e9e('0x8'));var sox=require(_0x7e9e('0x9'));var csv=require('to-csv');var ejs=require(_0x7e9e('0xa'));var fs=require('fs');var fs_extra=require(_0x7e9e('0xb'));var _=require(_0x7e9e('0xc'));var squel=require('squel');var crypto=require(_0x7e9e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e9e('0xe'));var toCsv=require(_0x7e9e('0xf'));var querystring=require(_0x7e9e('0x10'));var Papa=require(_0x7e9e('0x11'));var Redis=require(_0x7e9e('0x12'));var authService=require(_0x7e9e('0x13'));var qs=require(_0x7e9e('0x14'));var as=require(_0x7e9e('0x15'));var hardwareService=require(_0x7e9e('0x16'));var logger=require(_0x7e9e('0x17'))(_0x7e9e('0x18'));var utils=require(_0x7e9e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5db58,_0x356d5c){_0x356d5c=_0x356d5c||0xcc;return function(_0x245c50){if(_0x245c50){return _0xa5db58[_0x7e9e('0x1a')](_0x356d5c);}return _0xa5db58['status'](_0x356d5c)['end']();};}function respondWithResult(_0x2d8de4,_0x46f30d){_0x46f30d=_0x46f30d||0xc8;return function(_0x1b59d1){if(_0x1b59d1){return _0x2d8de4[_0x7e9e('0x1b')](_0x46f30d)[_0x7e9e('0x1c')](_0x1b59d1);}};}function respondWithFilteredResult(_0x89bb24,_0x2cf803){return function(_0x5bf42b){if(_0x5bf42b){var _0x428312=typeof _0x2cf803['offset']===_0x7e9e('0x1d')&&typeof _0x2cf803[_0x7e9e('0x1e')]===_0x7e9e('0x1d');var _0x1d973c=_0x5bf42b[_0x7e9e('0x1f')];var _0x11f414=_0x428312?0x0:_0x2cf803[_0x7e9e('0x20')];var _0x5a2a77=_0x428312?_0x5bf42b[_0x7e9e('0x1f')]:_0x2cf803[_0x7e9e('0x20')]+_0x2cf803['limit'];var _0x52358b;if(_0x5a2a77>=_0x1d973c){_0x5a2a77=_0x1d973c;_0x52358b=0xc8;}else{_0x52358b=0xce;}_0x89bb24[_0x7e9e('0x1b')](_0x52358b);return _0x89bb24['set']('Content-Range',_0x11f414+'-'+_0x5a2a77+'/'+_0x1d973c)[_0x7e9e('0x1c')](_0x5bf42b);}return null;};}function patchUpdates(_0x5f554d){return function(_0x35914e){try{jsonpatch[_0x7e9e('0x21')](_0x35914e,_0x5f554d,!![]);}catch(_0x2654d3){return BPromise[_0x7e9e('0x22')](_0x2654d3);}return _0x35914e[_0x7e9e('0x23')]();};}function saveUpdates(_0x206062,_0x18c975){return function(_0x5206df){if(_0x5206df){return _0x5206df[_0x7e9e('0x24')](_0x206062)[_0x7e9e('0x25')](function(_0x1dc4c9){return _0x1dc4c9;});}return null;};}function removeEntity(_0x46bc6c,_0x523e5f){return function(_0x15bb40){if(_0x15bb40){return _0x15bb40[_0x7e9e('0x26')]()[_0x7e9e('0x25')](function(){var _0x166265=_0x15bb40[_0x7e9e('0x27')]({'plain':!![]});var _0xeaa799=_0x7e9e('0x28');return db['UserProfileResource'][_0x7e9e('0x26')]({'where':{'type':_0xeaa799,'resourceId':_0x166265['id']}})[_0x7e9e('0x25')](function(){return _0x15bb40;});})[_0x7e9e('0x25')](function(){_0x46bc6c[_0x7e9e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b61b4,_0x3f6655){return function(_0x1e7ece){if(!_0x1e7ece){_0x1b61b4[_0x7e9e('0x1a')](0x194);}return _0x1e7ece;};}function handleError(_0x4a2a1c,_0x398025){_0x398025=_0x398025||0x1f4;return function(_0x5da39e){logger[_0x7e9e('0x29')](_0x5da39e[_0x7e9e('0x2a')]);if(_0x5da39e[_0x7e9e('0x2b')]){delete _0x5da39e[_0x7e9e('0x2b')];}_0x4a2a1c[_0x7e9e('0x1b')](_0x398025)[_0x7e9e('0x2c')](_0x5da39e);};}exports[_0x7e9e('0x2d')]=function(_0x25774c,_0x52634e){var _0x5c33e1={},_0x2d9c81={},_0x5ee992={'count':0x0,'rows':[]};var _0x947df5=_[_0x7e9e('0x2e')](db['Disposition']['rawAttributes'],function(_0xa3aa21){return{'name':_0xa3aa21[_0x7e9e('0x2f')],'type':_0xa3aa21['type']['key']};});_0x2d9c81[_0x7e9e('0x30')]=_['map'](_0x947df5,_0x7e9e('0x2b'));_0x2d9c81[_0x7e9e('0x31')]=_['keys'](_0x25774c[_0x7e9e('0x31')]);_0x2d9c81[_0x7e9e('0x32')]=_['intersection'](_0x2d9c81[_0x7e9e('0x30')],_0x2d9c81[_0x7e9e('0x31')]);_0x5c33e1[_0x7e9e('0x33')]=_[_0x7e9e('0x34')](_0x2d9c81['model'],qs[_0x7e9e('0x35')](_0x25774c['query'][_0x7e9e('0x35')]));_0x5c33e1[_0x7e9e('0x33')]=_0x5c33e1[_0x7e9e('0x33')][_0x7e9e('0x36')]?_0x5c33e1[_0x7e9e('0x33')]:_0x2d9c81[_0x7e9e('0x30')];if(!_0x25774c['query'][_0x7e9e('0x37')]('nolimit')){_0x5c33e1[_0x7e9e('0x1e')]=qs[_0x7e9e('0x1e')](_0x25774c[_0x7e9e('0x31')]['limit']);_0x5c33e1['offset']=qs['offset'](_0x25774c[_0x7e9e('0x31')][_0x7e9e('0x20')]);}_0x5c33e1[_0x7e9e('0x38')]=qs[_0x7e9e('0x39')](_0x25774c['query'][_0x7e9e('0x39')]);_0x5c33e1['where']=qs['filters'](_[_0x7e9e('0x3a')](_0x25774c[_0x7e9e('0x31')],_0x2d9c81[_0x7e9e('0x32')]),_0x947df5);if(_0x25774c['query'][_0x7e9e('0x3b')]){_0x5c33e1[_0x7e9e('0x3c')]=_[_0x7e9e('0x3d')](_0x5c33e1['where'],{'$or':_[_0x7e9e('0x2e')](_0x947df5,function(_0x12571e){if(_0x12571e[_0x7e9e('0x3e')]!==_0x7e9e('0x3f')){var _0x80ac45={};_0x80ac45[_0x12571e['name']]={'$like':'%'+_0x25774c['query'][_0x7e9e('0x3b')]+'%'};return _0x80ac45;}})});}_0x5c33e1=_[_0x7e9e('0x3d')]({},_0x5c33e1,_0x25774c['options']);var _0xa3dde8={'where':_0x5c33e1[_0x7e9e('0x3c')]};return db[_0x7e9e('0x40')][_0x7e9e('0x1f')](_0xa3dde8)['then'](function(_0x11af9f){_0x5ee992[_0x7e9e('0x1f')]=_0x11af9f;if(_0x25774c['query'][_0x7e9e('0x41')]){_0x5c33e1[_0x7e9e('0x42')]=[{'all':!![]}];}return db[_0x7e9e('0x40')][_0x7e9e('0x43')](_0x5c33e1);})['then'](function(_0x5337a8){_0x5ee992[_0x7e9e('0x44')]=_0x5337a8;return _0x5ee992;})[_0x7e9e('0x25')](respondWithFilteredResult(_0x52634e,_0x5c33e1))[_0x7e9e('0x45')](handleError(_0x52634e,null));};exports[_0x7e9e('0x46')]=function(_0x54a160,_0x68bb1f){var _0x10bdab={'raw':!![],'where':{'id':_0x54a160[_0x7e9e('0x47')]['id']}},_0x123e6f={};_0x123e6f['model']=_['keys'](db['Disposition'][_0x7e9e('0x48')]);_0x123e6f[_0x7e9e('0x31')]=_[_0x7e9e('0x49')](_0x54a160[_0x7e9e('0x31')]);_0x123e6f[_0x7e9e('0x32')]=_[_0x7e9e('0x34')](_0x123e6f[_0x7e9e('0x30')],_0x123e6f['query']);_0x10bdab[_0x7e9e('0x33')]=_[_0x7e9e('0x34')](_0x123e6f[_0x7e9e('0x30')],qs['fields'](_0x54a160['query'][_0x7e9e('0x35')]));_0x10bdab[_0x7e9e('0x33')]=_0x10bdab[_0x7e9e('0x33')][_0x7e9e('0x36')]?_0x10bdab[_0x7e9e('0x33')]:_0x123e6f[_0x7e9e('0x30')];if(_0x54a160[_0x7e9e('0x31')][_0x7e9e('0x41')]){_0x10bdab[_0x7e9e('0x42')]=[{'all':!![]}];}_0x10bdab=_[_0x7e9e('0x3d')]({},_0x10bdab,_0x54a160[_0x7e9e('0x4a')]);return db[_0x7e9e('0x40')][_0x7e9e('0x4b')](_0x10bdab)['then'](handleEntityNotFound(_0x68bb1f,null))[_0x7e9e('0x25')](respondWithResult(_0x68bb1f,null))[_0x7e9e('0x45')](handleError(_0x68bb1f,null));};exports[_0x7e9e('0x4c')]=function(_0x26dc29,_0x284750){return db[_0x7e9e('0x40')][_0x7e9e('0x4c')](_0x26dc29[_0x7e9e('0x4d')],{})[_0x7e9e('0x25')](function(_0x328ddd){var _0x4cdcb4=_0x26dc29[_0x7e9e('0x4e')][_0x7e9e('0x27')]({'plain':!![]});if(!_0x4cdcb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cdcb4[_0x7e9e('0x4f')]===_0x7e9e('0x4e')){var _0x23f476=_0x328ddd[_0x7e9e('0x27')]({'plain':!![]});var _0x3071ec=_0x7e9e('0x28');return db[_0x7e9e('0x50')][_0x7e9e('0x4b')]({'where':{'name':_0x3071ec,'userProfileId':_0x4cdcb4[_0x7e9e('0x51')]},'raw':!![]})[_0x7e9e('0x25')](function(_0x7f419){if(_0x7f419&&_0x7f419['autoAssociation']===0x0){return db[_0x7e9e('0x52')][_0x7e9e('0x4c')]({'name':_0x23f476[_0x7e9e('0x2b')],'resourceId':_0x23f476['id'],'type':_0x7f419['name'],'sectionId':_0x7f419['id']},{})[_0x7e9e('0x25')](function(){return _0x328ddd;});}else{return _0x328ddd;}})[_0x7e9e('0x45')](function(_0x117fa8){logger[_0x7e9e('0x29')](_0x7e9e('0x53'),_0x117fa8);throw _0x117fa8;});}return _0x328ddd;})[_0x7e9e('0x25')](respondWithResult(_0x284750,0xc9))[_0x7e9e('0x45')](handleError(_0x284750,null));};exports[_0x7e9e('0x24')]=function(_0x344884,_0x1b6447){if(_0x344884[_0x7e9e('0x4d')]['id']){delete _0x344884[_0x7e9e('0x4d')]['id'];}return db['Disposition'][_0x7e9e('0x4b')]({'where':{'id':_0x344884[_0x7e9e('0x47')]['id']}})[_0x7e9e('0x25')](handleEntityNotFound(_0x1b6447,null))[_0x7e9e('0x25')](saveUpdates(_0x344884[_0x7e9e('0x4d')],null))[_0x7e9e('0x25')](respondWithResult(_0x1b6447,null))[_0x7e9e('0x45')](handleError(_0x1b6447,null));};exports['destroy']=function(_0x37cf6b,_0x5cf176){return db['Disposition'][_0x7e9e('0x4b')]({'where':{'id':_0x37cf6b[_0x7e9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cf176,null))[_0x7e9e('0x25')](removeEntity(_0x5cf176,null))[_0x7e9e('0x45')](handleError(_0x5cf176,null));}; \ No newline at end of file +var _0x7827=['options','include','findAll','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','index','map','Disposition','fieldName','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x4d6308,_0xbc081e){var _0x1231eb=function(_0x20ca9d){while(--_0x20ca9d){_0x4d6308['push'](_0x4d6308['shift']());}};_0x1231eb(++_0xbc081e);}(_0x7827,0x19d));var _0x7782=function(_0x5a8d2c,_0x725a3){_0x5a8d2c=_0x5a8d2c-0x0;var _0x2086dc=_0x7827[_0x5a8d2c];return _0x2086dc;};'use strict';var emlformat=require(_0x7782('0x0'));var rimraf=require(_0x7782('0x1'));var zipdir=require(_0x7782('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7782('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7782('0x4'));var util=require(_0x7782('0x5'));var path=require(_0x7782('0x6'));var sox=require(_0x7782('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7782('0x8'));var _=require(_0x7782('0x9'));var squel=require(_0x7782('0xa'));var crypto=require(_0x7782('0xb'));var jsforce=require(_0x7782('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7782('0xd'));var querystring=require('querystring');var Papa=require(_0x7782('0xe'));var Redis=require(_0x7782('0xf'));var authService=require(_0x7782('0x10'));var qs=require(_0x7782('0x11'));var as=require(_0x7782('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7782('0x13'));var config=require(_0x7782('0x14'));var licenseUtil=require(_0x7782('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaeb20e,_0x518b66){_0x518b66=_0x518b66||0xcc;return function(_0x235ff5){if(_0x235ff5){return _0xaeb20e['sendStatus'](_0x518b66);}return _0xaeb20e[_0x7782('0x16')](_0x518b66)[_0x7782('0x17')]();};}function respondWithResult(_0x22af83,_0x26b5f8){_0x26b5f8=_0x26b5f8||0xc8;return function(_0x3c5e3c){if(_0x3c5e3c){return _0x22af83[_0x7782('0x16')](_0x26b5f8)[_0x7782('0x18')](_0x3c5e3c);}};}function respondWithFilteredResult(_0x32a4a9,_0x5221a7){return function(_0x2965fd){if(_0x2965fd){var _0x3466db=typeof _0x5221a7[_0x7782('0x19')]===_0x7782('0x1a')&&typeof _0x5221a7[_0x7782('0x1b')]===_0x7782('0x1a');var _0x2026f6=_0x2965fd[_0x7782('0x1c')];var _0xa43aa5=_0x3466db?0x0:_0x5221a7['offset'];var _0x4224df=_0x3466db?_0x2965fd[_0x7782('0x1c')]:_0x5221a7[_0x7782('0x19')]+_0x5221a7[_0x7782('0x1b')];var _0x47e342;if(_0x4224df>=_0x2026f6){_0x4224df=_0x2026f6;_0x47e342=0xc8;}else{_0x47e342=0xce;}_0x32a4a9['status'](_0x47e342);return _0x32a4a9[_0x7782('0x1d')](_0x7782('0x1e'),_0xa43aa5+'-'+_0x4224df+'/'+_0x2026f6)['json'](_0x2965fd);}return null;};}function patchUpdates(_0x3c726b){return function(_0x5d25bd){try{jsonpatch[_0x7782('0x1f')](_0x5d25bd,_0x3c726b,!![]);}catch(_0xd9ab2b){return BPromise[_0x7782('0x20')](_0xd9ab2b);}return _0x5d25bd[_0x7782('0x21')]();};}function saveUpdates(_0x5f26f6,_0x3b6cf2){return function(_0xe67316){if(_0xe67316){return _0xe67316[_0x7782('0x22')](_0x5f26f6)['then'](function(_0x41f2a7){return _0x41f2a7;});}return null;};}function removeEntity(_0x580a7d,_0x5c48ee){return function(_0x1789fb){if(_0x1789fb){return _0x1789fb[_0x7782('0x23')]()[_0x7782('0x24')](function(){var _0x5a79c4=_0x1789fb[_0x7782('0x25')]({'plain':!![]});var _0x31ba38='Dispositions';return db[_0x7782('0x26')][_0x7782('0x23')]({'where':{'type':_0x31ba38,'resourceId':_0x5a79c4['id']}})['then'](function(){return _0x1789fb;});})['then'](function(){_0x580a7d[_0x7782('0x16')](0xcc)[_0x7782('0x17')]();});}};}function handleEntityNotFound(_0x35f010,_0x5aa72b){return function(_0x106a25){if(!_0x106a25){_0x35f010['sendStatus'](0x194);}return _0x106a25;};}function handleError(_0x23ed3b,_0x515beb){_0x515beb=_0x515beb||0x1f4;return function(_0x4d073d){logger[_0x7782('0x27')](_0x4d073d['stack']);if(_0x4d073d[_0x7782('0x28')]){delete _0x4d073d['name'];}_0x23ed3b[_0x7782('0x16')](_0x515beb)['send'](_0x4d073d);};}exports[_0x7782('0x29')]=function(_0x6080c4,_0x5be461){var _0x4517e9={},_0x3e95eb={},_0x24f133={'count':0x0,'rows':[]};var _0x18b451=_[_0x7782('0x2a')](db[_0x7782('0x2b')]['rawAttributes'],function(_0x245f13){return{'name':_0x245f13[_0x7782('0x2c')],'type':_0x245f13['type']['key']};});_0x3e95eb[_0x7782('0x2d')]=_[_0x7782('0x2a')](_0x18b451,_0x7782('0x28'));_0x3e95eb[_0x7782('0x2e')]=_[_0x7782('0x2f')](_0x6080c4[_0x7782('0x2e')]);_0x3e95eb[_0x7782('0x30')]=_[_0x7782('0x31')](_0x3e95eb['model'],_0x3e95eb[_0x7782('0x2e')]);_0x4517e9['attributes']=_[_0x7782('0x31')](_0x3e95eb[_0x7782('0x2d')],qs[_0x7782('0x32')](_0x6080c4[_0x7782('0x2e')][_0x7782('0x32')]));_0x4517e9['attributes']=_0x4517e9['attributes'][_0x7782('0x33')]?_0x4517e9[_0x7782('0x34')]:_0x3e95eb[_0x7782('0x2d')];if(!_0x6080c4[_0x7782('0x2e')]['hasOwnProperty'](_0x7782('0x35'))){_0x4517e9['limit']=qs[_0x7782('0x1b')](_0x6080c4[_0x7782('0x2e')][_0x7782('0x1b')]);_0x4517e9[_0x7782('0x19')]=qs[_0x7782('0x19')](_0x6080c4[_0x7782('0x2e')]['offset']);}_0x4517e9[_0x7782('0x36')]=qs['sort'](_0x6080c4[_0x7782('0x2e')][_0x7782('0x37')]);_0x4517e9[_0x7782('0x38')]=qs[_0x7782('0x30')](_[_0x7782('0x39')](_0x6080c4[_0x7782('0x2e')],_0x3e95eb[_0x7782('0x30')]),_0x18b451);if(_0x6080c4['query'][_0x7782('0x3a')]){_0x4517e9[_0x7782('0x38')]=_[_0x7782('0x3b')](_0x4517e9['where'],{'$or':_[_0x7782('0x2a')](_0x18b451,function(_0x442f68){if(_0x442f68[_0x7782('0x3c')]!=='VIRTUAL'){var _0x54bc05={};_0x54bc05[_0x442f68[_0x7782('0x28')]]={'$like':'%'+_0x6080c4[_0x7782('0x2e')][_0x7782('0x3a')]+'%'};return _0x54bc05;}})});}_0x4517e9=_[_0x7782('0x3b')]({},_0x4517e9,_0x6080c4[_0x7782('0x3d')]);var _0x5f5cfb={'where':_0x4517e9[_0x7782('0x38')]};return db['Disposition'][_0x7782('0x1c')](_0x5f5cfb)[_0x7782('0x24')](function(_0x37cedc){_0x24f133[_0x7782('0x1c')]=_0x37cedc;if(_0x6080c4[_0x7782('0x2e')]['includeAll']){_0x4517e9[_0x7782('0x3e')]=[{'all':!![]}];}return db[_0x7782('0x2b')][_0x7782('0x3f')](_0x4517e9);})[_0x7782('0x24')](function(_0x158afb){_0x24f133['rows']=_0x158afb;return _0x24f133;})[_0x7782('0x24')](respondWithFilteredResult(_0x5be461,_0x4517e9))['catch'](handleError(_0x5be461,null));};exports[_0x7782('0x40')]=function(_0x19fee2,_0x408f75){var _0x56a212={'raw':!![],'where':{'id':_0x19fee2[_0x7782('0x41')]['id']}},_0x53c332={};_0x53c332[_0x7782('0x2d')]=_[_0x7782('0x2f')](db[_0x7782('0x2b')][_0x7782('0x42')]);_0x53c332['query']=_[_0x7782('0x2f')](_0x19fee2['query']);_0x53c332[_0x7782('0x30')]=_[_0x7782('0x31')](_0x53c332[_0x7782('0x2d')],_0x53c332[_0x7782('0x2e')]);_0x56a212[_0x7782('0x34')]=_['intersection'](_0x53c332[_0x7782('0x2d')],qs[_0x7782('0x32')](_0x19fee2[_0x7782('0x2e')][_0x7782('0x32')]));_0x56a212[_0x7782('0x34')]=_0x56a212[_0x7782('0x34')][_0x7782('0x33')]?_0x56a212[_0x7782('0x34')]:_0x53c332[_0x7782('0x2d')];if(_0x19fee2[_0x7782('0x2e')][_0x7782('0x43')]){_0x56a212[_0x7782('0x3e')]=[{'all':!![]}];}_0x56a212=_[_0x7782('0x3b')]({},_0x56a212,_0x19fee2['options']);return db['Disposition'][_0x7782('0x44')](_0x56a212)['then'](handleEntityNotFound(_0x408f75,null))[_0x7782('0x24')](respondWithResult(_0x408f75,null))[_0x7782('0x45')](handleError(_0x408f75,null));};exports['create']=function(_0x352338,_0x1ab708){return db[_0x7782('0x2b')][_0x7782('0x46')](_0x352338[_0x7782('0x47')],{})[_0x7782('0x24')](function(_0x3edca4){var _0x3343a1=_0x352338[_0x7782('0x48')][_0x7782('0x25')]({'plain':!![]});if(!_0x3343a1)throw new Error(_0x7782('0x49'));if(_0x3343a1[_0x7782('0x4a')]==='user'){var _0x2c6714=_0x3edca4['get']({'plain':!![]});var _0xd99b63=_0x7782('0x4b');return db[_0x7782('0x4c')][_0x7782('0x44')]({'where':{'name':_0xd99b63,'userProfileId':_0x3343a1[_0x7782('0x4d')]},'raw':!![]})['then'](function(_0x2853a2){if(_0x2853a2&&_0x2853a2['autoAssociation']===0x0){return db[_0x7782('0x26')][_0x7782('0x46')]({'name':_0x2c6714['name'],'resourceId':_0x2c6714['id'],'type':_0x2853a2[_0x7782('0x28')],'sectionId':_0x2853a2['id']},{})[_0x7782('0x24')](function(){return _0x3edca4;});}else{return _0x3edca4;}})[_0x7782('0x45')](function(_0x450542){logger[_0x7782('0x27')](_0x7782('0x4e'),_0x450542);throw _0x450542;});}return _0x3edca4;})[_0x7782('0x24')](respondWithResult(_0x1ab708,0xc9))[_0x7782('0x45')](handleError(_0x1ab708,null));};exports[_0x7782('0x22')]=function(_0x2fe326,_0x3a14ae){if(_0x2fe326['body']['id']){delete _0x2fe326['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x2fe326['params']['id']}})[_0x7782('0x24')](handleEntityNotFound(_0x3a14ae,null))[_0x7782('0x24')](saveUpdates(_0x2fe326['body'],null))['then'](respondWithResult(_0x3a14ae,null))[_0x7782('0x45')](handleError(_0x3a14ae,null));};exports[_0x7782('0x23')]=function(_0x25329d,_0x478d8e){return db[_0x7782('0x2b')][_0x7782('0x44')]({'where':{'id':_0x25329d['params']['id']}})[_0x7782('0x24')](handleEntityNotFound(_0x478d8e,null))['then'](removeEntity(_0x478d8e,null))[_0x7782('0x45')](handleError(_0x478d8e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ffe66f5..9cd9f78 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 _0x87aa=['OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Disposition','name','name_mail','name_sms','SmsAccountId','FaxAccountId','name_openchannel'];(function(_0x7a3bfe,_0x41fc9e){var _0x3829e4=function(_0x39685c){while(--_0x39685c){_0x7a3bfe['push'](_0x7a3bfe['shift']());}};_0x3829e4(++_0x41fc9e);}(_0x87aa,0x16a));var _0xa87a=function(_0x1eced4,_0xc5070f){_0x1eced4=_0x1eced4-0x0;var _0x1a91e5=_0x87aa[_0x1eced4];return _0x1a91e5;};'use strict';var _=require(_0xa87a('0x0'));var util=require(_0xa87a('0x1'));var logger=require(_0xa87a('0x2'))(_0xa87a('0x3'));var moment=require(_0xa87a('0x4'));var BPromise=require(_0xa87a('0x5'));var rp=require(_0xa87a('0x6'));var fs=require('fs');var path=require(_0xa87a('0x7'));var rimraf=require('rimraf');var config=require(_0xa87a('0x8'));var attributes=require('./disposition.attributes');module[_0xa87a('0x9')]=function(_0x123fd5,_0x164e31){return _0x123fd5[_0xa87a('0xa')](_0xa87a('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xa87a('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xa87a('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0xa87a('0xd'),'fields':[_0xa87a('0xc'),'MailAccountId']},{'unique':!![],'name':_0xa87a('0xe'),'fields':[_0xa87a('0xc'),_0xa87a('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0xa87a('0xc'),_0xa87a('0x10')]},{'unique':!![],'name':_0xa87a('0x11'),'fields':[_0xa87a('0xc'),_0xa87a('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xa87a('0xc'),_0xa87a('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdb5=['../../config/logger','api','moment','request-promise','../../config/environment','./disposition.attributes','exports','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util'];(function(_0x399a2a,_0x5125cb){var _0x3d2ac5=function(_0x206a6a){while(--_0x206a6a){_0x399a2a['push'](_0x399a2a['shift']());}};_0x3d2ac5(++_0x5125cb);}(_0xcdb5,0xfb));var _0x5cdb=function(_0x494b7f,_0x353334){_0x494b7f=_0x494b7f-0x0;var _0x37daf9=_0xcdb5[_0x494b7f];return _0x37daf9;};'use strict';var _=require(_0x5cdb('0x0'));var util=require(_0x5cdb('0x1'));var logger=require(_0x5cdb('0x2'))(_0x5cdb('0x3'));var moment=require(_0x5cdb('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cdb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5cdb('0x6'));var attributes=require(_0x5cdb('0x7'));module[_0x5cdb('0x8')]=function(_0x440f55,_0x55f5c5){return _0x440f55['define'](_0x5cdb('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5cdb('0xa'),'fields':[_0x5cdb('0xb'),_0x5cdb('0xc')]},{'unique':!![],'name':_0x5cdb('0xd'),'fields':[_0x5cdb('0xb'),_0x5cdb('0xe')]},{'unique':!![],'name':_0x5cdb('0xf'),'fields':[_0x5cdb('0xb'),_0x5cdb('0x10')]},{'unique':!![],'name':_0x5cdb('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x5cdb('0x12'),'fields':['name',_0x5cdb('0x13')]},{'unique':!![],'name':_0x5cdb('0x14'),'fields':['name',_0x5cdb('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x5cdb('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b7632a1..de8c7bf 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(_0xe780b,_0x57b6a1){var _0x8c810e=function(_0x3892ed){while(--_0x3892ed){_0xe780b['push'](_0xe780b['shift']());}};_0x8c810e(++_0x57b6a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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(_0x2314ca,_0xb480cc){var _0x2fe271=function(_0x30ee34){while(--_0x30ee34){_0x2314ca['push'](_0x2314ca['shift']());}};_0x2fe271(++_0xb480cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 bc26223..c397f02 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 _0x3a8e=['/:id','show','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xdc2aae,_0x3b9fcb){var _0x5b4ca5=function(_0x10e8a4){while(--_0x10e8a4){_0xdc2aae['push'](_0xdc2aae['shift']());}};_0x5b4ca5(++_0x3b9fcb);}(_0x3a8e,0x128));var _0xe3a8=function(_0x12a024,_0x5e97e3){_0x12a024=_0x12a024-0x0;var _0x36efad=_0x3a8e[_0x12a024];return _0x36efad;};'use strict';var multer=require(_0xe3a8('0x0'));var util=require(_0xe3a8('0x1'));var path=require(_0xe3a8('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3a8('0x3'));var router=express['Router']();var fs_extra=require(_0xe3a8('0x4'));var auth=require(_0xe3a8('0x5'));var interaction=require(_0xe3a8('0x6'));var config=require(_0xe3a8('0x7'));var controller=require('./disposition.controller');router[_0xe3a8('0x8')]('/',auth[_0xe3a8('0x9')](),controller['index']);router[_0xe3a8('0x8')](_0xe3a8('0xa'),auth[_0xe3a8('0x9')](),controller[_0xe3a8('0xb')]);router['post']('/',auth[_0xe3a8('0x9')](),controller[_0xe3a8('0xc')]);router[_0xe3a8('0xd')]('/:id',auth[_0xe3a8('0x9')](),controller[_0xe3a8('0xe')]);router[_0xe3a8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe3a8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x29e8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x563413,_0x213eff){var _0x1ddc7b=function(_0x14c4dd){while(--_0x14c4dd){_0x563413['push'](_0x563413['shift']());}};_0x1ddc7b(++_0x213eff);}(_0x29e8,0xc3));var _0x829e=function(_0x20ea13,_0x34c357){_0x20ea13=_0x20ea13-0x0;var _0x48c9e3=_0x29e8[_0x20ea13];return _0x48c9e3;};'use strict';var multer=require(_0x829e('0x0'));var util=require(_0x829e('0x1'));var path=require(_0x829e('0x2'));var timeout=require(_0x829e('0x3'));var express=require(_0x829e('0x4'));var router=express[_0x829e('0x5')]();var fs_extra=require(_0x829e('0x6'));var auth=require(_0x829e('0x7'));var interaction=require(_0x829e('0x8'));var config=require('../../config/environment');var controller=require(_0x829e('0x9'));router[_0x829e('0xa')]('/',auth[_0x829e('0xb')](),controller[_0x829e('0xc')]);router[_0x829e('0xa')]('/:id',auth[_0x829e('0xb')](),controller['show']);router[_0x829e('0xd')]('/',auth[_0x829e('0xb')](),controller[_0x829e('0xe')]);router[_0x829e('0xf')](_0x829e('0x10'),auth[_0x829e('0xb')](),controller[_0x829e('0x11')]);router[_0x829e('0x12')]('/:id',auth[_0x829e('0xb')](),controller[_0x829e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8b8f218..2dc880b 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 _0x46c9=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x473e3f,_0x2f0947){var _0x59399b=function(_0x26dece){while(--_0x26dece){_0x473e3f['push'](_0x473e3f['shift']());}};_0x59399b(++_0x2f0947);}(_0x46c9,0xaa));var _0x946c=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0x46c9[_0x43e2e4];return _0x1b71d0;};'use strict';var Sequelize=require(_0x946c('0x0'));module[_0x946c('0x1')]={'name':{'type':Sequelize[_0x946c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x946c('0x2')]},'ecm':{'type':Sequelize[_0x946c('0x3')]('yes','no'),'defaultValue':_0x946c('0x4')},'headerinfo':{'type':Sequelize[_0x946c('0x2')],'defaultValue':_0x946c('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x946c('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x946c('0x7'),_0x946c('0x8'),_0x946c('0x9'),'9600',_0x946c('0xa'),_0x946c('0xb')),'defaultValue':_0x946c('0x8')},'maxrate':{'type':Sequelize[_0x946c('0x3')](_0x946c('0x7'),_0x946c('0x8'),_0x946c('0x9'),'9600','12000',_0x946c('0xb')),'defaultValue':_0x946c('0xb')},'modem':{'type':Sequelize[_0x946c('0x2')],'defaultValue':_0x946c('0xc')},'gateway':{'type':Sequelize[_0x946c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x946c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x946c('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x946c('0x3')](_0x946c('0xe'),_0x946c('0xf'),_0x946c('0x10'),_0x946c('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x946c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x946c('0x12');}},'notificationSound':{'type':Sequelize[_0x946c('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x946c('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x946c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x946c('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x946c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x946c('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x946c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x946c('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x946c('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x29627){if(!_0x29627)this['setDataValue'](_0x946c('0x15'),null);this[_0x946c('0x16')](_0x946c('0x17'),_0x29627);}}}; \ No newline at end of file +var _0x9fe9=['mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','12000','14400','2400','4800','v17,v27,v29','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x228e29,_0x3edaea){var _0x4b6faf=function(_0x3420d8){while(--_0x3420d8){_0x228e29['push'](_0x228e29['shift']());}};_0x4b6faf(++_0x3edaea);}(_0x9fe9,0x1e1));var _0x99fe=function(_0x205835,_0xeb5fe){_0x205835=_0x205835-0x0;var _0x73ae34=_0x9fe9[_0x205835];return _0x73ae34;};'use strict';var Sequelize=require('sequelize');module[_0x99fe('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x99fe('0x1')]},'ecm':{'type':Sequelize[_0x99fe('0x2')](_0x99fe('0x3'),'no'),'defaultValue':_0x99fe('0x3')},'headerinfo':{'type':Sequelize[_0x99fe('0x1')],'defaultValue':_0x99fe('0x4')},'localstationid':{'type':Sequelize[_0x99fe('0x1')],'unique':_0x99fe('0x5')},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x99fe('0x6'),_0x99fe('0x7'),_0x99fe('0x8'),_0x99fe('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x99fe('0x2')](_0x99fe('0xa'),_0x99fe('0xb'),_0x99fe('0x6'),_0x99fe('0x7'),'12000',_0x99fe('0x9')),'defaultValue':_0x99fe('0x9')},'modem':{'type':Sequelize[_0x99fe('0x1')],'defaultValue':_0x99fe('0xc')},'gateway':{'type':Sequelize[_0x99fe('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x99fe('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x99fe('0x2')]('SIP',_0x99fe('0xd'),'DADHI',_0x99fe('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x99fe('0xf')],'defaultValue':function(){return _0x99fe('0x10');}},'notificationSound':{'type':Sequelize[_0x99fe('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99fe('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99fe('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x99fe('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99fe('0x12')],'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':_0x99fe('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x99fe('0x11')],'defaultValue':![],'comment':_0x99fe('0x14'),'set':function(_0x656d02){if(!_0x656d02)this[_0x99fe('0x15')](_0x99fe('0x16'),null);this['setDataValue'](_0x99fe('0x17'),_0x656d02);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a008ed4..38ae7c3 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 _0x4656=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','undefined','limit','count','offset','Content-Range','json','save','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','query','keys','filters','attributes','intersection','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','FaxAccount','include','findAll','rows','params','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','Disposition','getDispositions','nolimit','order','FaxAccountId','map','options','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','FaxApplication','getApplications','context','from-voip-provider','exten','app','system','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','bulkCreate','tech','key','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x546278,_0x9c3521){var _0x3f0647=function(_0x136acf){while(--_0x136acf){_0x546278['push'](_0x546278['shift']());}};_0x3f0647(++_0x9c3521);}(_0x4656,0xbd));var _0x6465=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x4656[_0x324012];return _0x435cf2;};'use strict';var emlformat=require(_0x6465('0x0'));var rimraf=require(_0x6465('0x1'));var zipdir=require(_0x6465('0x2'));var jsonpatch=require(_0x6465('0x3'));var rp=require(_0x6465('0x4'));var moment=require(_0x6465('0x5'));var BPromise=require(_0x6465('0x6'));var Mustache=require(_0x6465('0x7'));var util=require('util');var path=require(_0x6465('0x8'));var sox=require(_0x6465('0x9'));var csv=require(_0x6465('0xa'));var ejs=require(_0x6465('0xb'));var fs=require('fs');var fs_extra=require(_0x6465('0xc'));var _=require(_0x6465('0xd'));var squel=require('squel');var crypto=require(_0x6465('0xe'));var jsforce=require(_0x6465('0xf'));var deskjs=require(_0x6465('0x10'));var toCsv=require(_0x6465('0xa'));var querystring=require(_0x6465('0x11'));var Papa=require(_0x6465('0x12'));var Redis=require(_0x6465('0x13'));var authService=require(_0x6465('0x14'));var qs=require(_0x6465('0x15'));var as=require(_0x6465('0x16'));var hardwareService=require(_0x6465('0x17'));var logger=require(_0x6465('0x18'))(_0x6465('0x19'));var utils=require('../../config/utils');var config=require(_0x6465('0x1a'));var licenseUtil=require(_0x6465('0x1b'));var db=require(_0x6465('0x1c'))['db'];config[_0x6465('0x1d')]=_['defaults'](config[_0x6465('0x1d')],{'host':_0x6465('0x1e'),'port':0x18eb});var socket=require(_0x6465('0x1f'))(new Redis(config['redis']));require(_0x6465('0x20'))[_0x6465('0x21')](socket);var jayson=require(_0x6465('0x22'));var client=jayson['client'][_0x6465('0x23')]({'port':0x232c});var client9002=jayson[_0x6465('0x24')][_0x6465('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xb2c611,_0x12d686,_0x4b847e,_0x3e97cf){return new BPromise(function(_0x1420f8,_0x330e9a){var _0xeff1d0=_0x3e97cf||client;return _0xeff1d0['request'](_0xb2c611,_0x4b847e)[_0x6465('0x25')](function(_0x3816db){logger[_0x6465('0x26')](_0x6465('0x27'),_0x12d686,_0x6465('0x28'));logger[_0x6465('0x29')](_0x6465('0x2a'),_0x12d686,_0x6465('0x28'),JSON[_0x6465('0x2b')](_0x3816db));if(_0x3816db['error']){if(_0x3816db[_0x6465('0x2c')]['code']===0x1f4){logger[_0x6465('0x2c')](_0x6465('0x27'),_0x12d686,_0x3816db['error'][_0x6465('0x2d')]);return _0x330e9a(_0x3816db[_0x6465('0x2c')][_0x6465('0x2d')]);}logger[_0x6465('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x12d686,_0x3816db[_0x6465('0x2c')]['message']);return _0x1420f8(_0x3816db[_0x6465('0x2c')][_0x6465('0x2d')]);}else{logger['info'](_0x6465('0x27'),_0x12d686,_0x6465('0x28'));_0x1420f8(_0x3816db[_0x6465('0x2e')][_0x6465('0x2d')]);}})[_0x6465('0x2f')](function(_0x59262c){logger[_0x6465('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x12d686,_0x59262c);_0x330e9a(_0x59262c);});});}function respondWithStatusCode(_0x480618,_0x3c60f2){_0x3c60f2=_0x3c60f2||0xcc;return function(_0x139c4c){if(_0x139c4c){return _0x480618[_0x6465('0x30')](_0x3c60f2);}return _0x480618[_0x6465('0x31')](_0x3c60f2)['end']();};}function respondWithResult(_0xdcf64e,_0xc8a09f){_0xc8a09f=_0xc8a09f||0xc8;return function(_0x38619f){if(_0x38619f){return _0xdcf64e[_0x6465('0x31')](_0xc8a09f)['json'](_0x38619f);}};}function respondWithFilteredResult(_0x28d5b9,_0x46c263){return function(_0x14cbcb){if(_0x14cbcb){var _0x5e3ade=typeof _0x46c263['offset']===_0x6465('0x32')&&typeof _0x46c263[_0x6465('0x33')]===_0x6465('0x32');var _0x5bc83d=_0x14cbcb[_0x6465('0x34')];var _0x1de916=_0x5e3ade?0x0:_0x46c263[_0x6465('0x35')];var _0x43684a=_0x5e3ade?_0x14cbcb['count']:_0x46c263['offset']+_0x46c263[_0x6465('0x33')];var _0x294dd9;if(_0x43684a>=_0x5bc83d){_0x43684a=_0x5bc83d;_0x294dd9=0xc8;}else{_0x294dd9=0xce;}_0x28d5b9[_0x6465('0x31')](_0x294dd9);return _0x28d5b9['set'](_0x6465('0x36'),_0x1de916+'-'+_0x43684a+'/'+_0x5bc83d)[_0x6465('0x37')](_0x14cbcb);}return null;};}function patchUpdates(_0x2963d){return function(_0x51768c){try{jsonpatch['apply'](_0x51768c,_0x2963d,!![]);}catch(_0x11f134){return BPromise['reject'](_0x11f134);}return _0x51768c[_0x6465('0x38')]();};}function saveUpdates(_0x579716,_0x56de20){return function(_0x5604db){if(_0x5604db){return _0x5604db[_0x6465('0x39')](_0x579716)[_0x6465('0x25')](function(_0x2bb8e1){return _0x2bb8e1;});}return null;};}function removeEntity(_0x148abf,_0x3e02fb){return function(_0x519fe3){if(_0x519fe3){return _0x519fe3[_0x6465('0x3a')]()[_0x6465('0x25')](function(){var _0x2307f1=_0x519fe3[_0x6465('0x3b')]({'plain':!![]});var _0x2c0d35=_0x6465('0x3c');return db[_0x6465('0x3d')][_0x6465('0x3a')]({'where':{'type':_0x2c0d35,'resourceId':_0x2307f1['id']}})[_0x6465('0x25')](function(){return _0x519fe3;});})['then'](function(){_0x148abf[_0x6465('0x31')](0xcc)[_0x6465('0x3e')]();});}};}function handleEntityNotFound(_0x4f48c8,_0x2c8f4b){return function(_0x1911dd){if(!_0x1911dd){_0x4f48c8[_0x6465('0x30')](0x194);}return _0x1911dd;};}function handleError(_0x46ddaf,_0x1a903b){_0x1a903b=_0x1a903b||0x1f4;return function(_0x355bf9){logger['error'](_0x355bf9[_0x6465('0x3f')]);if(_0x355bf9[_0x6465('0x40')]){delete _0x355bf9['name'];}_0x46ddaf[_0x6465('0x31')](_0x1a903b)[_0x6465('0x41')](_0x355bf9);};}exports[_0x6465('0x42')]=function(_0x426de4,_0x55f8bb){var _0x46b759={'include':[{'model':db[_0x6465('0x43')],'as':_0x6465('0x44')}]},_0x51c2a9={},_0x182579={'count':0x0,'rows':[]};var _0x4ef31e=_['map'](db['FaxAccount'][_0x6465('0x45')],function(_0x3ca63e){return{'name':_0x3ca63e['fieldName'],'type':_0x3ca63e[_0x6465('0x46')]['key']};});_0x51c2a9['model']=_['map'](_0x4ef31e,_0x6465('0x40'));_0x51c2a9[_0x6465('0x47')]=_[_0x6465('0x48')](_0x426de4[_0x6465('0x47')]);_0x51c2a9[_0x6465('0x49')]=_['intersection'](_0x51c2a9['model'],_0x51c2a9[_0x6465('0x47')]);_0x46b759[_0x6465('0x4a')]=_[_0x6465('0x4b')](_0x51c2a9[_0x6465('0x4c')],qs['fields'](_0x426de4[_0x6465('0x47')]['fields']));_0x46b759['attributes']=_0x46b759[_0x6465('0x4a')]['length']?_0x46b759[_0x6465('0x4a')]:_0x51c2a9[_0x6465('0x4c')];if(!_0x426de4[_0x6465('0x47')][_0x6465('0x4d')]('nolimit')){_0x46b759['limit']=qs[_0x6465('0x33')](_0x426de4[_0x6465('0x47')]['limit']);_0x46b759[_0x6465('0x35')]=qs[_0x6465('0x35')](_0x426de4[_0x6465('0x47')][_0x6465('0x35')]);}_0x46b759['order']=qs[_0x6465('0x4e')](_0x426de4['query'][_0x6465('0x4e')]);_0x46b759[_0x6465('0x4f')]=qs['filters'](_[_0x6465('0x50')](_0x426de4['query'],_0x51c2a9[_0x6465('0x49')]),_0x4ef31e);if(_0x426de4['query'][_0x6465('0x51')]){_0x46b759[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x46b759[_0x6465('0x4f')],{'$or':_['map'](_0x4ef31e,function(_0x3cb514){if(_0x3cb514[_0x6465('0x46')]!==_0x6465('0x53')){var _0x4f9750={};_0x4f9750[_0x3cb514[_0x6465('0x40')]]={'$like':'%'+_0x426de4[_0x6465('0x47')][_0x6465('0x51')]+'%'};return _0x4f9750;}})});}_0x46b759=_[_0x6465('0x52')]({},_0x46b759,_0x426de4['options']);var _0x29e302={'where':_0x46b759['where']};return db[_0x6465('0x54')][_0x6465('0x34')](_0x29e302)[_0x6465('0x25')](function(_0x53e3b4){_0x182579[_0x6465('0x34')]=_0x53e3b4;if(_0x426de4['query']['includeAll']){_0x46b759[_0x6465('0x55')]=[{'all':!![]}];}return db[_0x6465('0x54')][_0x6465('0x56')](_0x46b759);})[_0x6465('0x25')](function(_0x1bcefe){_0x182579[_0x6465('0x57')]=_0x1bcefe;return _0x182579;})['then'](respondWithFilteredResult(_0x55f8bb,_0x46b759))[_0x6465('0x2f')](handleError(_0x55f8bb,null));};exports['show']=function(_0x134978,_0x23aa29){var _0x2699f4={'raw':![],'where':{'id':_0x134978[_0x6465('0x58')]['id']},'include':[{'model':db[_0x6465('0x43')],'as':_0x6465('0x44')}]},_0x4e2463={};_0x4e2463[_0x6465('0x4c')]=_['keys'](db[_0x6465('0x54')]['rawAttributes']);_0x4e2463['query']=_[_0x6465('0x48')](_0x134978[_0x6465('0x47')]);_0x4e2463[_0x6465('0x49')]=_[_0x6465('0x4b')](_0x4e2463[_0x6465('0x4c')],_0x4e2463[_0x6465('0x47')]);_0x2699f4['attributes']=_[_0x6465('0x4b')](_0x4e2463['model'],qs[_0x6465('0x59')](_0x134978['query'][_0x6465('0x59')]));_0x2699f4[_0x6465('0x4a')]=_0x2699f4[_0x6465('0x4a')][_0x6465('0x5a')]?_0x2699f4[_0x6465('0x4a')]:_0x4e2463['model'];if(_0x134978[_0x6465('0x47')][_0x6465('0x5b')]){_0x2699f4['include']=[{'all':!![]}];}_0x2699f4=_[_0x6465('0x52')]({},_0x2699f4,_0x134978['options']);return db[_0x6465('0x54')][_0x6465('0x5c')](_0x2699f4)[_0x6465('0x25')](handleEntityNotFound(_0x23aa29,null))[_0x6465('0x25')](respondWithResult(_0x23aa29,null))['catch'](handleError(_0x23aa29,null));};exports[_0x6465('0x5d')]=function(_0x7a7999,_0x5a3b19){return db[_0x6465('0x54')][_0x6465('0x5d')](_0x7a7999[_0x6465('0x5e')],{})[_0x6465('0x25')](function(_0x3e7a4f){var _0x44554d=_0x7a7999[_0x6465('0x5f')][_0x6465('0x3b')]({'plain':!![]});if(!_0x44554d)throw new Error(_0x6465('0x60'));if(_0x44554d[_0x6465('0x61')]===_0x6465('0x5f')){var _0x14e635=_0x3e7a4f[_0x6465('0x3b')]({'plain':!![]});var _0x2eb548='FaxAccounts';return db[_0x6465('0x62')]['find']({'where':{'name':_0x2eb548,'userProfileId':_0x44554d[_0x6465('0x63')]},'raw':!![]})['then'](function(_0x507046){if(_0x507046&&_0x507046[_0x6465('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x14e635[_0x6465('0x40')],'resourceId':_0x14e635['id'],'type':_0x507046[_0x6465('0x40')],'sectionId':_0x507046['id']},{})['then'](function(){return _0x3e7a4f;});}else{return _0x3e7a4f;}})[_0x6465('0x2f')](function(_0x384821){logger[_0x6465('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x384821);throw _0x384821;});}return _0x3e7a4f;})[_0x6465('0x25')](respondWithResult(_0x5a3b19,0xc9))[_0x6465('0x2f')](handleError(_0x5a3b19,null));};exports[_0x6465('0x39')]=function(_0x3686c0,_0x5ab474){if(_0x3686c0[_0x6465('0x5e')]['id']){delete _0x3686c0['body']['id'];}return db[_0x6465('0x54')]['find']({'where':{'id':_0x3686c0['params']['id']},'include':[{'model':db['Pause'],'as':_0x6465('0x44')}]})[_0x6465('0x25')](handleEntityNotFound(_0x5ab474,null))[_0x6465('0x25')](saveUpdates(_0x3686c0['body'],null))[_0x6465('0x25')](respondWithResult(_0x5ab474,null))[_0x6465('0x2f')](handleError(_0x5ab474,null));};exports[_0x6465('0x3a')]=function(_0x1a1dd3,_0x4da779){return db[_0x6465('0x54')][_0x6465('0x5c')]({'where':{'id':_0x1a1dd3[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x4da779,null))['then'](removeEntity(_0x4da779,null))['catch'](handleError(_0x4da779,null));};exports[_0x6465('0x65')]=function(_0x4db69a,_0x15ec73){return db[_0x6465('0x54')][_0x6465('0x65')]()[_0x6465('0x25')](respondWithResult(_0x15ec73,null))['catch'](handleError(_0x15ec73,null));};exports['addDisposition']=function(_0xc9156,_0x58af3b,_0x4e9aff){if(_0xc9156[_0x6465('0x5e')]['id']){delete _0xc9156[_0x6465('0x5e')]['id'];}return db[_0x6465('0x54')][_0x6465('0x5c')]({'where':{'id':_0xc9156[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x58af3b,null))[_0x6465('0x25')](function(_0x94c100){if(_0x94c100){_0xc9156[_0x6465('0x5e')]['FaxAccountId']=_0x94c100['id'];return db[_0x6465('0x66')][_0x6465('0x5d')](_0xc9156[_0x6465('0x5e')]);}})[_0x6465('0x25')](respondWithResult(_0x58af3b,null))[_0x6465('0x2f')](handleError(_0x58af3b,null));};exports[_0x6465('0x67')]=function(_0x69a8f8,_0x32d1c2,_0x403031){var _0x168020={'raw':![],'where':{}};var _0x49d3f8={};var _0xe64043={'count':0x0,'rows':[]};return db[_0x6465('0x54')]['findOne']({'where':{'id':_0x69a8f8[_0x6465('0x58')]['id']}})['then'](handleEntityNotFound(_0x32d1c2,null))[_0x6465('0x25')](function(_0x54ebfb){if(_0x54ebfb){_0x49d3f8[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0x66')][_0x6465('0x45')]);_0x49d3f8[_0x6465('0x47')]=_[_0x6465('0x48')](_0x69a8f8['query']);_0x49d3f8[_0x6465('0x49')]=_[_0x6465('0x4b')](_0x49d3f8['model'],_0x49d3f8[_0x6465('0x47')]);_0x168020[_0x6465('0x4a')]=_[_0x6465('0x4b')](_0x49d3f8[_0x6465('0x4c')],qs[_0x6465('0x59')](_0x69a8f8[_0x6465('0x47')][_0x6465('0x59')]));_0x168020[_0x6465('0x4a')]=_0x168020['attributes'][_0x6465('0x5a')]?_0x168020[_0x6465('0x4a')]:_0x49d3f8[_0x6465('0x4c')];if(!_0x69a8f8['query'][_0x6465('0x4d')](_0x6465('0x68'))){_0x168020[_0x6465('0x33')]=qs[_0x6465('0x33')](_0x69a8f8['query'][_0x6465('0x33')]);_0x168020[_0x6465('0x35')]=qs[_0x6465('0x35')](_0x69a8f8[_0x6465('0x47')][_0x6465('0x35')]);}_0x168020[_0x6465('0x69')]=qs[_0x6465('0x4e')](_0x69a8f8['query'][_0x6465('0x4e')]);_0x168020[_0x6465('0x4f')]=qs[_0x6465('0x49')](_[_0x6465('0x50')](_0x69a8f8['query'],_0x49d3f8['filters']));_0x168020[_0x6465('0x4f')][_0x6465('0x6a')]=_0x54ebfb['id'];if(_0x69a8f8['query'][_0x6465('0x51')]){_0x168020[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x168020[_0x6465('0x4f')],{'$or':_[_0x6465('0x6b')](_0x168020[_0x6465('0x4a')],function(_0x1ba5f1){var _0x2e54e6={};_0x2e54e6[_0x1ba5f1]={'$like':'%'+_0x69a8f8[_0x6465('0x47')]['filter']+'%'};return _0x2e54e6;})});}_0x168020=_['merge']({},_0x168020,_0x69a8f8[_0x6465('0x6c')]);return db['Disposition'][_0x6465('0x34')]({'where':_0x168020['where']})[_0x6465('0x25')](function(_0xdc5db6){_0xe64043[_0x6465('0x34')]=_0xdc5db6;if(_0x69a8f8[_0x6465('0x47')][_0x6465('0x5b')]){_0x168020[_0x6465('0x55')]=[{'all':!![]}];}return db[_0x6465('0x66')][_0x6465('0x56')](_0x168020);})['then'](function(_0x243ab3){_0xe64043[_0x6465('0x57')]=_0x243ab3;return _0xe64043;});}})['then'](respondWithFilteredResult(_0x32d1c2,_0x168020))[_0x6465('0x2f')](handleError(_0x32d1c2,null));};exports[_0x6465('0x6d')]=function(_0x2ce8f0,_0x5e1b95,_0x296a1b){return db['FaxAccount'][_0x6465('0x5c')]({'where':{'id':_0x2ce8f0['params']['id']}})['then'](handleEntityNotFound(_0x5e1b95,null))[_0x6465('0x25')](function(_0x5c7ee1){if(_0x5c7ee1){return _0x5c7ee1[_0x6465('0x6d')](_0x2ce8f0[_0x6465('0x47')]['ids']);}})[_0x6465('0x25')](respondWithStatusCode(_0x5e1b95,null))[_0x6465('0x2f')](handleError(_0x5e1b95,null));};exports[_0x6465('0x6e')]=function(_0x32c621,_0x2478b8,_0x433622){if(_0x32c621[_0x6465('0x5e')]['id']){delete _0x32c621[_0x6465('0x5e')]['id'];}return db[_0x6465('0x54')]['find']({'where':{'id':_0x32c621[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x2478b8,null))[_0x6465('0x25')](function(_0x1273a1){if(_0x1273a1){_0x32c621[_0x6465('0x5e')][_0x6465('0x6a')]=_0x1273a1['id'];return db[_0x6465('0x6f')]['create'](_0x32c621[_0x6465('0x5e')]);}})['then'](respondWithResult(_0x2478b8,null))[_0x6465('0x2f')](handleError(_0x2478b8,null));};exports[_0x6465('0x70')]=function(_0x2c6c0d,_0x5ebc1c,_0x23cfb5){var _0x117c18={'raw':![],'where':{}};var _0x409960={};var _0x584799={'count':0x0,'rows':[]};return db[_0x6465('0x54')]['findOne']({'where':{'id':_0x2c6c0d[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x5ebc1c,null))[_0x6465('0x25')](function(_0xc1f5a){if(_0xc1f5a){_0x409960[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0x6f')][_0x6465('0x45')]);_0x409960['query']=_[_0x6465('0x48')](_0x2c6c0d[_0x6465('0x47')]);_0x409960[_0x6465('0x49')]=_[_0x6465('0x4b')](_0x409960[_0x6465('0x4c')],_0x409960['query']);_0x117c18[_0x6465('0x4a')]=_[_0x6465('0x4b')](_0x409960['model'],qs['fields'](_0x2c6c0d['query'][_0x6465('0x59')]));_0x117c18[_0x6465('0x4a')]=_0x117c18[_0x6465('0x4a')][_0x6465('0x5a')]?_0x117c18[_0x6465('0x4a')]:_0x409960['model'];if(!_0x2c6c0d['query'][_0x6465('0x4d')](_0x6465('0x68'))){_0x117c18[_0x6465('0x33')]=qs[_0x6465('0x33')](_0x2c6c0d[_0x6465('0x47')][_0x6465('0x33')]);_0x117c18[_0x6465('0x35')]=qs[_0x6465('0x35')](_0x2c6c0d[_0x6465('0x47')][_0x6465('0x35')]);}_0x117c18[_0x6465('0x69')]=qs[_0x6465('0x4e')](_0x2c6c0d[_0x6465('0x47')][_0x6465('0x4e')]);_0x117c18[_0x6465('0x4f')]=qs[_0x6465('0x49')](_[_0x6465('0x50')](_0x2c6c0d[_0x6465('0x47')],_0x409960['filters']));_0x117c18[_0x6465('0x4f')][_0x6465('0x6a')]=_0xc1f5a['id'];if(_0x2c6c0d[_0x6465('0x47')][_0x6465('0x51')]){_0x117c18[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x117c18[_0x6465('0x4f')],{'$or':_['map'](_0x117c18[_0x6465('0x4a')],function(_0xbe64b9){var _0x440a21={};_0x440a21[_0xbe64b9]={'$like':'%'+_0x2c6c0d['query'][_0x6465('0x51')]+'%'};return _0x440a21;})});}_0x117c18=_[_0x6465('0x52')]({},_0x117c18,_0x2c6c0d[_0x6465('0x6c')]);return db['CannedAnswer'][_0x6465('0x34')]({'where':_0x117c18[_0x6465('0x4f')]})['then'](function(_0x468a9f){_0x584799[_0x6465('0x34')]=_0x468a9f;if(_0x2c6c0d[_0x6465('0x47')][_0x6465('0x5b')]){_0x117c18['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x6465('0x56')](_0x117c18);})[_0x6465('0x25')](function(_0x2f84b2){_0x584799[_0x6465('0x57')]=_0x2f84b2;return _0x584799;});}})[_0x6465('0x25')](respondWithFilteredResult(_0x5ebc1c,_0x117c18))[_0x6465('0x2f')](handleError(_0x5ebc1c,null));};exports[_0x6465('0x71')]=function(_0x332512,_0xc5e772,_0x37b085){return db['FaxAccount'][_0x6465('0x5c')]({'where':{'id':_0x332512[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0xc5e772,null))[_0x6465('0x25')](function(_0x5b9a9a){if(_0x5b9a9a){return _0x5b9a9a[_0x6465('0x71')](_0x332512[_0x6465('0x47')]['ids']);}})[_0x6465('0x25')](respondWithStatusCode(_0xc5e772,null))[_0x6465('0x2f')](handleError(_0xc5e772,null));};exports['addInteraction']=function(_0x5c4d03,_0x5687aa,_0x162c2e){return db['FaxInteraction'][_0x6465('0x5c')]({'where':{'id':_0x5c4d03['params']['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x5687aa,null))[_0x6465('0x25')](function(_0x2a61bb){if(_0x2a61bb){return _0x2a61bb['addInteraction'](_0x5c4d03[_0x6465('0x5e')][_0x6465('0x72')],_[_0x6465('0x73')](_0x5c4d03[_0x6465('0x5e')],[_0x6465('0x72'),'id'])||{});}})[_0x6465('0x25')](respondWithResult(_0x5687aa,null))[_0x6465('0x2f')](handleError(_0x5687aa,null));};exports[_0x6465('0x74')]=function(_0x11cbb9,_0x1105cd,_0x3c7db5){var _0x40a910={'raw':![],'where':{}};var _0x124633={};var _0x8dee4c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x11cbb9[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x1105cd,null))[_0x6465('0x25')](function(_0xf1eb1e){if(_0xf1eb1e){_0x124633[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0x75')][_0x6465('0x45')]);_0x124633[_0x6465('0x47')]=_[_0x6465('0x48')](_0x11cbb9[_0x6465('0x47')]);_0x124633[_0x6465('0x49')]=_[_0x6465('0x4b')](_0x124633[_0x6465('0x4c')],_0x124633[_0x6465('0x47')]);_0x40a910[_0x6465('0x4a')]=_[_0x6465('0x4b')](_0x124633[_0x6465('0x4c')],qs[_0x6465('0x59')](_0x11cbb9[_0x6465('0x47')][_0x6465('0x59')]));_0x40a910[_0x6465('0x4a')]=_0x40a910['attributes'][_0x6465('0x5a')]?_0x40a910[_0x6465('0x4a')]:_0x124633[_0x6465('0x4c')];if(!_0x11cbb9[_0x6465('0x47')][_0x6465('0x4d')](_0x6465('0x68'))){_0x40a910[_0x6465('0x33')]=qs[_0x6465('0x33')](_0x11cbb9[_0x6465('0x47')]['limit']);_0x40a910[_0x6465('0x35')]=qs[_0x6465('0x35')](_0x11cbb9['query'][_0x6465('0x35')]);}_0x40a910[_0x6465('0x69')]=qs[_0x6465('0x4e')](_0x11cbb9[_0x6465('0x47')][_0x6465('0x4e')]);_0x40a910[_0x6465('0x4f')]=qs[_0x6465('0x49')](_['pick'](_0x11cbb9[_0x6465('0x47')],_0x124633[_0x6465('0x49')]));_0x40a910[_0x6465('0x4f')][_0x6465('0x6a')]=_0xf1eb1e['id'];if(_0x11cbb9['query'][_0x6465('0x51')]){_0x40a910[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x40a910[_0x6465('0x4f')],{'$or':_[_0x6465('0x6b')](_0x40a910[_0x6465('0x4a')],function(_0x354631){var _0x1b316f={};_0x1b316f[_0x354631]={'$like':'%'+_0x11cbb9[_0x6465('0x47')][_0x6465('0x51')]+'%'};return _0x1b316f;})});}_0x40a910=_['merge']({},_0x40a910,_0x11cbb9[_0x6465('0x6c')]);return db[_0x6465('0x75')][_0x6465('0x34')]({'where':_0x40a910['where']})['then'](function(_0x15e4f8){_0x8dee4c[_0x6465('0x34')]=_0x15e4f8;if(_0x11cbb9[_0x6465('0x47')][_0x6465('0x5b')]){_0x40a910[_0x6465('0x55')]=[{'model':db['CmContact'],'as':_0x6465('0x76'),'required':![]},{'model':db[_0x6465('0x77')],'as':_0x6465('0x78'),'attributes':['name',_0x6465('0x79'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x6465('0x7a'),'attributes':['id',_0x6465('0x40'),_0x6465('0x7b')],'where':_0x11cbb9[_0x6465('0x47')][_0x6465('0x7c')]?{'id':_0x11cbb9['query'][_0x6465('0x7c')]}:undefined,'required':_0x11cbb9[_0x6465('0x47')][_0x6465('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x6465('0x56')](_0x40a910);})[_0x6465('0x25')](function(_0x379a10){_0x8dee4c['rows']=_0x379a10;return _0x8dee4c;});}})[_0x6465('0x25')](respondWithFilteredResult(_0x1105cd,_0x40a910))[_0x6465('0x2f')](handleError(_0x1105cd,null));};exports['addApplications']=function(_0x56fda7,_0x1440ec){var _0x31d404=_0x56fda7[_0x6465('0x58')]['id'];var _0x46a9f8=_0x56fda7[_0x6465('0x5e')];var _0x2cb7f3=0xc8;var _0x13f531=null;return db[_0x6465('0x7d')][_0x6465('0x7e')]({'isolationLevel':db['sequelize'][_0x6465('0x7f')][_0x6465('0x80')][_0x6465('0x81')]},function(_0x4fafe7){return db[_0x6465('0x54')]['findOne']({'where':{'id':_0x31d404},'transaction':_0x4fafe7})['then'](function(_0x51f031){if(_0x51f031){return db['FaxApplication'][_0x6465('0x3a')]({'where':{'FaxAccountId':_0x31d404},'transaction':_0x4fafe7})['then'](function(){var _0x55c4d1=_[_0x6465('0x6b')](_0x46a9f8,function(_0x2855f3){_0x2855f3[_0x6465('0x6a')]=_0x31d404;return _0x2855f3;});return db['FaxApplication']['bulkCreate'](_0x55c4d1,{'transaction':_0x4fafe7});});}else{_0x2cb7f3=0x194;_0x13f531=[];}});})[_0x6465('0x25')](function(){if(_0x2cb7f3!==0x194){return db['FaxApplication'][_0x6465('0x82')]({'where':{'FaxAccountId':_0x31d404},'order':_0x6465('0x83')})[_0x6465('0x25')](function(_0x22b31e){_0x13f531=_0x22b31e;});}})['catch'](function(_0x2b32ec){_0x2cb7f3=0x1f4;logger[_0x6465('0x2c')](_0x2b32ec[_0x6465('0x3f')]);if(_0x2b32ec['name']){delete _0x2b32ec['name'];}_0x13f531=_0x2b32ec;})['finally'](function(){if(_0x13f531===null){_0x1440ec[_0x6465('0x30')](_0x2cb7f3);}else{if(_0x2cb7f3===0x1f4){_0x1440ec[_0x6465('0x31')](_0x2cb7f3)[_0x6465('0x41')](_0x13f531);}else{_0x1440ec[_0x6465('0x31')](_0x2cb7f3)[_0x6465('0x37')](_0x13f531);}}});};exports['getApplications']=function(_0x357d2a,_0x177228,_0x40659a){var _0x255dc0={};var _0x50a680={};var _0x60ae26;var _0x5792a7;return db[_0x6465('0x54')]['findOne']({'where':{'id':_0x357d2a[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x177228,null))[_0x6465('0x25')](function(_0x384ae5){if(_0x384ae5){_0x60ae26=_0x384ae5;_0x50a680[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0x84')][_0x6465('0x45')]);_0x50a680[_0x6465('0x47')]=_[_0x6465('0x48')](_0x357d2a[_0x6465('0x47')]);_0x50a680[_0x6465('0x49')]=_[_0x6465('0x4b')](_0x50a680[_0x6465('0x4c')],_0x50a680[_0x6465('0x47')]);_0x255dc0[_0x6465('0x4a')]=_[_0x6465('0x4b')](_0x50a680[_0x6465('0x4c')],qs['fields'](_0x357d2a[_0x6465('0x47')]['fields']));_0x255dc0['attributes']=_0x255dc0[_0x6465('0x4a')][_0x6465('0x5a')]?_0x255dc0[_0x6465('0x4a')]:_0x50a680[_0x6465('0x4c')];_0x255dc0[_0x6465('0x69')]=qs[_0x6465('0x4e')](_0x357d2a[_0x6465('0x47')][_0x6465('0x4e')]);_0x255dc0['where']=qs[_0x6465('0x49')](_[_0x6465('0x50')](_0x357d2a[_0x6465('0x47')],_0x50a680[_0x6465('0x49')]));if(_0x357d2a['query'][_0x6465('0x51')]){_0x255dc0[_0x6465('0x4f')]=_['merge'](_0x255dc0[_0x6465('0x4f')],{'$or':_[_0x6465('0x6b')](_0x255dc0['attributes'],function(_0x37ba79){var _0x39fbc4={};_0x39fbc4[_0x37ba79]={'$like':'%'+_0x357d2a[_0x6465('0x47')][_0x6465('0x51')]+'%'};return _0x39fbc4;})});}_0x255dc0=_['merge']({},_0x255dc0,_0x357d2a[_0x6465('0x6c')]);return _0x60ae26[_0x6465('0x85')](_0x255dc0);}})[_0x6465('0x25')](function(_0x33e090){if(_0x33e090){_0x5792a7=_0x33e090['length'];if(!_0x357d2a['query'][_0x6465('0x4d')]('nolimit')){_0x255dc0[_0x6465('0x33')]=qs[_0x6465('0x33')](_0x357d2a[_0x6465('0x47')]['limit']);_0x255dc0['offset']=qs['offset'](_0x357d2a['query'][_0x6465('0x35')]);}return _0x60ae26[_0x6465('0x85')](_0x255dc0);}})[_0x6465('0x25')](function(_0x11c327){if(_0x11c327){return _0x11c327?{'count':_0x5792a7,'rows':_0x11c327}:null;}})[_0x6465('0x25')](respondWithResult(_0x177228,null))[_0x6465('0x2f')](handleError(_0x177228,null));};function Extension(_0xab0d28,_0x2ed41a,_0x6d41b3,_0x389896){this[_0x6465('0x86')]=_0x6465('0x87');this[_0x6465('0x88')]=_0xab0d28['localstationid'];this[_0x6465('0x89')]=_0x389896;this[_0x6465('0x46')]=_0x6465('0x8a');this['description']=_0x6465('0x8b');this[_0x6465('0x6a')]=_0xab0d28['id'];this[_0x6465('0x83')]=_0x2ed41a;this['appdata']=_0x6d41b3;}function createExtensionsReciveFax(_0x159992){var _0x5d5409=0x1;var _0x3f3e9b=[];_0x3f3e9b[_0x6465('0x8c')](new Extension(_0x159992,_0x5d5409,'',_0x6465('0x8d')));_0x5d5409+=0x1;_0x3f3e9b['push'](new Extension(_0x159992,_0x5d5409,_0x6465('0x8e'),_0x6465('0x8f')));_0x5d5409+=0x1;for(var _0x271707 in _0x159992){if(_0x159992[_0x6465('0x4d')](_0x271707)&&(_0x271707===_0x6465('0x90')||_0x271707===_0x6465('0x91')||_0x271707==='gateway'||_0x271707===_0x6465('0x92')||_0x271707===_0x6465('0x93')||_0x271707===_0x6465('0x94')||_0x271707===_0x6465('0x95')||_0x271707===_0x6465('0x96')||_0x271707===_0x6465('0x97'))){_0x3f3e9b[_0x6465('0x8c')](new Extension(_0x159992,_0x5d5409,'FAXOPT('+_0x271707+')='+_0x159992[_0x271707],_0x6465('0x8f')));_0x5d5409+=0x1;}}_0x3f3e9b['push'](new Extension(_0x159992,_0x5d5409,'6','Wait'));_0x5d5409+=0x1;_0x3f3e9b[_0x6465('0x8c')](new Extension(_0x159992,_0x5d5409,_0x6465('0x98'),'ReceiveFax'));_0x5d5409=0x0;return _0x3f3e9b;}exports[_0x6465('0x99')]=function(_0x412dde,_0x4b5116,_0x54383f){var _0x5b8295;return db[_0x6465('0x7d')][_0x6465('0x7e')](function(_0x15b932){return db[_0x6465('0x54')][_0x6465('0x5d')](_0x412dde[_0x6465('0x5e')],{'transaction':_0x15b932})[_0x6465('0x25')](function(_0x2bf98b){_0x5b8295=_0x2bf98b[_0x6465('0x3b')]({'plain':!![]});return db[_0x6465('0x9a')][_0x6465('0x9b')](createExtensionsReciveFax(_0x5b8295),{'transaction':_0x15b932});});})['then'](function(){return _0x5b8295;})['then'](respondWithResult(_0x4b5116,null))[_0x6465('0x2f')](handleError(_0x4b5116,null));};exports['updateAccountApplications']=function(_0x48f0b3,_0x3fe526,_0x1917bc){var _0x4f52d5;return db['sequelize']['transaction'](function(_0x452aa6){return db[_0x6465('0x54')][_0x6465('0x39')](_0x48f0b3['body'],{'where':{'id':_0x48f0b3[_0x6465('0x5e')]['id']},'transaction':_0x452aa6})[_0x6465('0x25')](function(_0x37b003){return db['VoiceExtension'][_0x6465('0x3a')]({'where':{'FaxAccountId':_0x48f0b3[_0x6465('0x5e')]['id']},'transaction':_0x452aa6})[_0x6465('0x25')](function(_0x47058a){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x6465('0x73')](_0x48f0b3[_0x6465('0x5e')],[_0x6465('0x9c'),_0x6465('0x9d'),_0x6465('0x9e'),_0x6465('0x9f'),'TrunkId',_0x6465('0xa0')])),{'transaction':_0x452aa6});});});})['then'](function(){return db[_0x6465('0x54')][_0x6465('0xa1')](_0x48f0b3['body']['id']);})[_0x6465('0x25')](respondWithResult(_0x3fe526,null))[_0x6465('0x2f')](handleError(_0x3fe526,null));};exports[_0x6465('0xa2')]=function(_0x3cf4a8,_0x5b853c,_0x494d4a){var _0x3bef12={'raw':!![],'where':{}};var _0x39a04b={};var _0x1b654c={'count':0x0,'rows':[]};return db[_0x6465('0x54')]['findOne']({'where':{'id':_0x3cf4a8[_0x6465('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b853c,null))[_0x6465('0x25')](function(_0x57c04a){if(_0x57c04a){_0x39a04b[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0xa3')][_0x6465('0x45')]);_0x39a04b['query']=_[_0x6465('0x48')](_0x3cf4a8[_0x6465('0x47')]);_0x39a04b['filters']=_['intersection'](_0x39a04b['model'],_0x39a04b[_0x6465('0x47')]);_0x3bef12['attributes']=_[_0x6465('0x4b')](_0x39a04b[_0x6465('0x4c')],qs['fields'](_0x3cf4a8[_0x6465('0x47')][_0x6465('0x59')]));_0x3bef12['attributes']=_0x3bef12[_0x6465('0x4a')][_0x6465('0x5a')]?_0x3bef12['attributes']:_0x39a04b[_0x6465('0x4c')];if(!_0x3cf4a8['query'][_0x6465('0x4d')](_0x6465('0x68'))){_0x3bef12['limit']=qs[_0x6465('0x33')](_0x3cf4a8[_0x6465('0x47')]['limit']);_0x3bef12[_0x6465('0x35')]=qs[_0x6465('0x35')](_0x3cf4a8[_0x6465('0x47')][_0x6465('0x35')]);}_0x3bef12['order']=qs['sort'](_0x3cf4a8[_0x6465('0x47')][_0x6465('0x4e')]);_0x3bef12[_0x6465('0x4f')]=qs[_0x6465('0x49')](_['pick'](_0x3cf4a8[_0x6465('0x47')],_0x39a04b['filters']));_0x3bef12[_0x6465('0x4f')]['FaxAccountId']=_0x57c04a['id'];if(_0x3cf4a8[_0x6465('0x47')][_0x6465('0x51')]){_0x3bef12[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x3bef12['where'],{'$or':_['map'](_0x3bef12[_0x6465('0x4a')],function(_0x53adff){var _0x1df47c={};_0x1df47c[_0x53adff]={'$like':'%'+_0x3cf4a8[_0x6465('0x47')][_0x6465('0x51')]+'%'};return _0x1df47c;})});}if(_0x3cf4a8[_0x6465('0x47')]['$gte']){var _0x2aceeb=_0x3cf4a8[_0x6465('0x47')][_0x6465('0xa4')][_0x6465('0xa5')](',');var _0x136156={};_0x136156[_0x2aceeb[0x0]]={'$gte':moment(_0x2aceeb[0x1])['format'](_0x6465('0xa6'))};_0x3bef12[_0x6465('0x4f')]=_[_0x6465('0x52')](_0x3bef12[_0x6465('0x4f')],_0x136156);}_0x3bef12=_[_0x6465('0x52')]({},_0x3bef12,_0x3cf4a8[_0x6465('0x6c')]);return db['FaxMessage']['count']({'where':_0x3bef12[_0x6465('0x4f')]})['then'](function(_0x5b7af7){_0x1b654c[_0x6465('0x34')]=_0x5b7af7;if(_0x3cf4a8['query'][_0x6465('0x5b')]){_0x3bef12[_0x6465('0x55')]=[{'all':!![]}];}return db[_0x6465('0xa3')][_0x6465('0x56')](_0x3bef12);})['then'](function(_0x117bb3){_0x1b654c[_0x6465('0x57')]=_0x117bb3;return _0x1b654c;});}})[_0x6465('0x25')](respondWithFilteredResult(_0x5b853c,_0x3bef12))[_0x6465('0x2f')](handleError(_0x5b853c,null));};exports[_0x6465('0x41')]=function(_0x1a6577,_0x26db20,_0xb551f2){var _0x18a6f8,_0x4f4eb8={},_0x38079a;if(_0x1a6577[_0x6465('0x5e')]['to']){_0x38079a=_0x1a6577[_0x6465('0x5e')]['to'][0x0];}return db[_0x6465('0x54')][_0x6465('0x5c')]({'where':{'id':_0x1a6577[_0x6465('0x58')]['id']},'include':[{'model':db[_0x6465('0xa7')],'as':'List','include':[{'model':db[_0x6465('0xa8')],'as':_0x6465('0xa9'),'where':{'fax':_0x38079a},'limit':0x1,'order':[[_0x6465('0x9f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x26db20,null))['then'](function(_0x5946f6){_0x18a6f8=_0x5946f6;if(_0x1a6577['body'][_0x6465('0xaa')]&&_0x1a6577[_0x6465('0x5e')]['attachments']['length']){for(var _0x4f4c3e=0x0;_0x4f4c3e<_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][_0x6465('0x5a')];_0x4f4c3e+=0x1){_0x1a6577['body'][_0x6465('0xaa')][_0x4f4c3e]={'filename':_0x1a6577['body'][_0x6465('0xaa')][_0x4f4c3e]['name'],'id':_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][_0x4f4c3e]['id'],'path':path['join'](config[_0x6465('0xab')],_0x6465('0xac'),_0x1a6577[_0x6465('0x5e')]['attachments'][_0x4f4c3e][_0x6465('0xad')])};}}return respondWithRpcPromise(_0x6465('0xae'),_0x6465('0xae'),{'FaxAccountId':_[_0x6465('0xaf')](_0x1a6577[_0x6465('0x58')]['id'])?undefined:_0x1a6577[_0x6465('0x58')]['id'],'path':_['isNil'](_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0][_0x6465('0x8')])?undefined:_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0][_0x6465('0x8')],'fax':_[_0x6465('0xaf')](_0x1a6577['body']['to'][0x0])?undefined:_0x1a6577[_0x6465('0x5e')]['to'][0x0]},client9002);})[_0x6465('0x25')](function(){if(_0x18a6f8){if(_[_0x6465('0xaf')](_0x1a6577[_0x6465('0x5e')][_0x6465('0xb0')])){_0x1a6577[_0x6465('0x5e')][_0x6465('0xb0')]=util[_0x6465('0xb1')]('\x22%s\x22\x20<%s>',_0x18a6f8['name'],_0x18a6f8[_0x6465('0xb2')]);}if(_0x18a6f8[_0x6465('0xb3')]){if(_0x18a6f8['List'][_0x6465('0xa9')][_0x6465('0x5a')]){return _0x18a6f8[_0x6465('0xb3')]['Contacts'][0x0];}else{return db[_0x6465('0xa8')][_0x6465('0x5d')](_['defaults'](_0x1a6577[_0x6465('0x5e')],{'firstName':_0x1a6577['body']['to'][0x0],'phone':_0x1a6577[_0x6465('0x5e')]['to'][0x0],'fax':_0x1a6577[_0x6465('0x5e')]['to'][0x0],'ListId':_0x18a6f8[_0x6465('0xa0')]}));}}else{throw new Error(_0x6465('0xb4'));}}else{throw new Error(_0x6465('0xb5'));}})[_0x6465('0x25')](function(_0x1e3284){if(_0x1e3284){return db[_0x6465('0x75')][_0x6465('0x5c')]({'where':{'ContactId':_0x1e3284['id'],'closed':![],'FaxAccountId':_0x18a6f8['id']}})[_0x6465('0x25')](function(_0x229953){if(_0x229953){return[_0x229953,![]];}return db[_0x6465('0x75')][_0x6465('0x5d')]({'UserId':_0x1a6577['user']['id'],'ContactId':_0x1e3284['id'],'FaxAccountId':_0x18a6f8['id'],'fax':_0x1a6577[_0x6465('0x5e')]['to'][0x0],'firstMsgDirection':_0x6465('0xb6'),'Messages':[_[_0x6465('0x52')](_0x1a6577[_0x6465('0x5e')],{'read':![],'body':_0x1a6577['body'][_0x6465('0xaa')][0x0][_0x6465('0xb7')],'FaxAccountId':_0x18a6f8['id'],'UserId':_0x1a6577['user']['id'],'ContactId':_0x1e3284['id'],'AttachmentId':_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x6465('0xa3')],'as':'Messages'}]})['then'](function(_0x591971){return[_0x591971,!![]];});});}else{throw new Error(_0x6465('0xb8'));}})[_0x6465('0xb9')](function(_0x4b1763,_0x3d7ac7){if(_0x3d7ac7){return _0x4b1763;}return db[_0x6465('0xa3')][_0x6465('0x5d')]({'direction':_0x6465('0xb6'),'read':![],'body':_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0][_0x6465('0xb7')],'FaxAccountId':_0x18a6f8['id'],'FaxInteractionId':_0x4b1763['id'],'UserId':_0x1a6577['user']['id'],'ContactId':_0x4b1763[_0x6465('0xba')],'AttachmentId':_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0]['id']})[_0x6465('0x25')](function(_0x17f3ad){_0x4b1763[_0x6465('0xbb')]['Messages']=[];_0x4b1763[_0x6465('0xbb')][_0x6465('0xbc')][_0x6465('0x8c')](_0x17f3ad[_0x6465('0xbb')]);return _0x4b1763;});})[_0x6465('0x25')](function(_0x73d31){respondWithRpcPromise(_0x6465('0xbd'),_0x6465('0xbd'),{'FaxAccountId':_[_0x6465('0xaf')](_0x1a6577[_0x6465('0x58')]['id'])?undefined:_0x1a6577[_0x6465('0x58')]['id'],'path':_[_0x6465('0xaf')](_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0]['path'])?undefined:_0x1a6577[_0x6465('0x5e')]['attachments'][0x0]['path'],'fax':_[_0x6465('0xaf')](_0x1a6577['body']['to'][0x0])?undefined:_0x1a6577[_0x6465('0x5e')]['to'][0x0],'AttachmentId':_0x1a6577[_0x6465('0x5e')][_0x6465('0xaa')][0x0]['id']},client9002)[_0x6465('0x25')](function(_0x59599a){logger[_0x6465('0x26')](_0x6465('0xbe'),_0x59599a);})[_0x6465('0x2f')](function(_0x2b8994){logger[_0x6465('0x26')](_0x6465('0xbe'),_0x2b8994);});return _0x73d31;})[_0x6465('0x25')](respondWithResult(_0x26db20,null))[_0x6465('0x2f')](handleError(_0x26db20,null));};exports['addAgents']=function(_0x17ea65,_0x8836c,_0x4b1a0c){return db[_0x6465('0x54')][_0x6465('0x5c')]({'where':{'id':_0x17ea65['params']['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x8836c,null))[_0x6465('0x25')](function(_0x29a047){if(_0x29a047){return _0x29a047[_0x6465('0xbf')](_0x17ea65[_0x6465('0x5e')][_0x6465('0x72')],_['omit'](_0x17ea65['body'],[_0x6465('0x72'),'id'])||{})[_0x6465('0xb9')](function(_0x41aaa0){for(var _0x1f3db9=0x0;_0x1f3db9<_0x17ea65[_0x6465('0x5e')][_0x6465('0x72')][_0x6465('0x5a')];_0x1f3db9+=0x1){socket[_0x6465('0xc0')](_0x6465('0xc1'),{'UserId':Number(_0x17ea65[_0x6465('0x5e')][_0x6465('0x72')][_0x1f3db9]),'FaxAccountId':Number(_0x17ea65['params']['id'])});}return _0x41aaa0;});}})['then'](respondWithResult(_0x8836c,null))[_0x6465('0x2f')](handleError(_0x8836c,null));};exports[_0x6465('0xc2')]=function(_0x18d1e9,_0x2169bd,_0x5c3054){return db[_0x6465('0x54')][_0x6465('0x5c')]({'where':{'id':_0x18d1e9[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x2169bd,null))['then'](function(_0x559a13){if(_0x559a13){return _0x559a13['removeAgents'](_0x18d1e9[_0x6465('0x47')][_0x6465('0x72')])[_0x6465('0x25')](function(){if(_[_0x6465('0xc3')](_0x18d1e9[_0x6465('0x47')]['ids'])){for(var _0x5d4869=0x0;_0x5d4869<_0x18d1e9[_0x6465('0x47')][_0x6465('0x72')]['length'];_0x5d4869+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x18d1e9['query'][_0x6465('0x72')][_0x5d4869]),'FaxAccountId':Number(_0x18d1e9[_0x6465('0x58')]['id'])});}}else{socket[_0x6465('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x18d1e9['query'][_0x6465('0x72')]),'FaxAccountId':Number(_0x18d1e9[_0x6465('0x58')]['id'])});}});}})[_0x6465('0x25')](respondWithStatusCode(_0x2169bd,null))[_0x6465('0x2f')](handleError(_0x2169bd,null));};exports[_0x6465('0xc4')]=function(_0xa96ebb,_0x269297,_0x459940){var _0xcc206c={};var _0x26429b={};var _0x3280ab;var _0x46b408;return db[_0x6465('0x54')]['findOne']({'where':{'id':_0xa96ebb[_0x6465('0x58')]['id']}})[_0x6465('0x25')](handleEntityNotFound(_0x269297,null))[_0x6465('0x25')](function(_0x82dc9){if(_0x82dc9){_0x3280ab=_0x82dc9;_0x26429b[_0x6465('0x4c')]=_[_0x6465('0x48')](db[_0x6465('0x77')][_0x6465('0x45')]);_0x26429b['query']=_['keys'](_0xa96ebb[_0x6465('0x47')]);_0x26429b[_0x6465('0x49')]=_['intersection'](_0x26429b[_0x6465('0x4c')],_0x26429b['query']);_0xcc206c[_0x6465('0x4a')]=_['intersection'](_0x26429b['model'],qs[_0x6465('0x59')](_0xa96ebb['query'][_0x6465('0x59')]));_0xcc206c[_0x6465('0x4a')]=_0xcc206c[_0x6465('0x4a')][_0x6465('0x5a')]?_0xcc206c[_0x6465('0x4a')]:_0x26429b[_0x6465('0x4c')];_0xcc206c[_0x6465('0x69')]=qs[_0x6465('0x4e')](_0xa96ebb[_0x6465('0x47')][_0x6465('0x4e')]);_0xcc206c[_0x6465('0x4f')]=qs['filters'](_[_0x6465('0x50')](_0xa96ebb['query'],_0x26429b[_0x6465('0x49')]));if(_0xa96ebb[_0x6465('0x47')][_0x6465('0x51')]){_0xcc206c[_0x6465('0x4f')]=_[_0x6465('0x52')](_0xcc206c['where'],{'$or':_[_0x6465('0x6b')](_0xcc206c[_0x6465('0x4a')],function(_0x548e38){var _0x4b8aef={};_0x4b8aef[_0x548e38]={'$like':'%'+_0xa96ebb['query'][_0x6465('0x51')]+'%'};return _0x4b8aef;})});}_0xcc206c=_[_0x6465('0x52')]({},_0xcc206c,_0xa96ebb[_0x6465('0x6c')]);return _0x3280ab[_0x6465('0xc4')](_0xcc206c);}})['then'](function(_0x5ec3e1){if(_0x5ec3e1){_0x46b408=_0x5ec3e1[_0x6465('0x5a')];if(!_0xa96ebb[_0x6465('0x47')][_0x6465('0x4d')](_0x6465('0x68'))){_0xcc206c[_0x6465('0x33')]=qs['limit'](_0xa96ebb[_0x6465('0x47')][_0x6465('0x33')]);_0xcc206c['offset']=qs[_0x6465('0x35')](_0xa96ebb[_0x6465('0x47')][_0x6465('0x35')]);}return _0x3280ab[_0x6465('0xc4')](_0xcc206c);}})[_0x6465('0x25')](function(_0x5efa14){if(_0x5efa14){return _0x5efa14?{'count':_0x46b408,'rows':_0x5efa14}:null;}})['then'](respondWithResult(_0x269297,null))[_0x6465('0x2f')](handleError(_0x269297,null));}; \ No newline at end of file +var _0xc019=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','FaxAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','order','filter','removeDispositions','ids','addAnswer','FaxAccountId','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','tag','addApplications','sequelize','ISOLATION_LEVELS','FaxApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','localstationid','app','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','headerinfo','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','transaction','VoiceExtension','tech','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc019,0xb8));var _0x9c01=function(_0x438c82,_0x1b5ed1){_0x438c82=_0x438c82-0x0;var _0x23cecc=_0xc019[_0x438c82];return _0x23cecc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c01('0x0'));var zipdir=require(_0x9c01('0x1'));var jsonpatch=require(_0x9c01('0x2'));var rp=require(_0x9c01('0x3'));var moment=require(_0x9c01('0x4'));var BPromise=require(_0x9c01('0x5'));var Mustache=require(_0x9c01('0x6'));var util=require(_0x9c01('0x7'));var path=require('path');var sox=require(_0x9c01('0x8'));var csv=require(_0x9c01('0x9'));var ejs=require(_0x9c01('0xa'));var fs=require('fs');var fs_extra=require(_0x9c01('0xb'));var _=require(_0x9c01('0xc'));var squel=require(_0x9c01('0xd'));var crypto=require('crypto');var jsforce=require(_0x9c01('0xe'));var deskjs=require(_0x9c01('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9c01('0x10'));var Papa=require(_0x9c01('0x11'));var Redis=require(_0x9c01('0x12'));var authService=require(_0x9c01('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9c01('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c01('0x15'))(_0x9c01('0x16'));var utils=require('../../config/utils');var config=require(_0x9c01('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9c01('0x18')]=_[_0x9c01('0x19')](config[_0x9c01('0x18')],{'host':_0x9c01('0x1a'),'port':0x18eb});var socket=require(_0x9c01('0x1b'))(new Redis(config[_0x9c01('0x18')]));require(_0x9c01('0x1c'))[_0x9c01('0x1d')](socket);var jayson=require(_0x9c01('0x1e'));var client=jayson[_0x9c01('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9c01('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4baedb,_0x106ef8,_0x4733c1,_0x3c1dfc){return new BPromise(function(_0x4508d9,_0x317734){var _0x3340a3=_0x3c1dfc||client;return _0x3340a3[_0x9c01('0x21')](_0x4baedb,_0x4733c1)[_0x9c01('0x22')](function(_0x1f07a3){logger[_0x9c01('0x23')](_0x9c01('0x24'),_0x106ef8,'request\x20sent');logger[_0x9c01('0x25')](_0x9c01('0x26'),_0x106ef8,'request\x20sent',JSON[_0x9c01('0x27')](_0x1f07a3));if(_0x1f07a3[_0x9c01('0x28')]){if(_0x1f07a3[_0x9c01('0x28')]['code']===0x1f4){logger[_0x9c01('0x28')](_0x9c01('0x24'),_0x106ef8,_0x1f07a3[_0x9c01('0x28')][_0x9c01('0x29')]);return _0x317734(_0x1f07a3[_0x9c01('0x28')][_0x9c01('0x29')]);}logger[_0x9c01('0x28')](_0x9c01('0x24'),_0x106ef8,_0x1f07a3['error'][_0x9c01('0x29')]);return _0x4508d9(_0x1f07a3[_0x9c01('0x28')][_0x9c01('0x29')]);}else{logger['info'](_0x9c01('0x24'),_0x106ef8,_0x9c01('0x2a'));_0x4508d9(_0x1f07a3['result'][_0x9c01('0x29')]);}})[_0x9c01('0x2b')](function(_0x5a11bd){logger[_0x9c01('0x28')](_0x9c01('0x24'),_0x106ef8,_0x5a11bd);_0x317734(_0x5a11bd);});});}function respondWithStatusCode(_0x3b2c7e,_0x4cd54c){_0x4cd54c=_0x4cd54c||0xcc;return function(_0x1ec9e2){if(_0x1ec9e2){return _0x3b2c7e['sendStatus'](_0x4cd54c);}return _0x3b2c7e[_0x9c01('0x2c')](_0x4cd54c)[_0x9c01('0x2d')]();};}function respondWithResult(_0x3bcdce,_0x4a5fcf){_0x4a5fcf=_0x4a5fcf||0xc8;return function(_0x4dd0b5){if(_0x4dd0b5){return _0x3bcdce[_0x9c01('0x2c')](_0x4a5fcf)[_0x9c01('0x2e')](_0x4dd0b5);}};}function respondWithFilteredResult(_0x1d4f58,_0x1ea7f7){return function(_0x518eb1){if(_0x518eb1){var _0x2e87a7=typeof _0x1ea7f7['offset']===_0x9c01('0x2f')&&typeof _0x1ea7f7[_0x9c01('0x30')]==='undefined';var _0xd6a26d=_0x518eb1[_0x9c01('0x31')];var _0x43b595=_0x2e87a7?0x0:_0x1ea7f7[_0x9c01('0x32')];var _0x264ed3=_0x2e87a7?_0x518eb1['count']:_0x1ea7f7[_0x9c01('0x32')]+_0x1ea7f7[_0x9c01('0x30')];var _0x3064c9;if(_0x264ed3>=_0xd6a26d){_0x264ed3=_0xd6a26d;_0x3064c9=0xc8;}else{_0x3064c9=0xce;}_0x1d4f58[_0x9c01('0x2c')](_0x3064c9);return _0x1d4f58[_0x9c01('0x33')](_0x9c01('0x34'),_0x43b595+'-'+_0x264ed3+'/'+_0xd6a26d)[_0x9c01('0x2e')](_0x518eb1);}return null;};}function patchUpdates(_0x299913){return function(_0x35dc8b){try{jsonpatch[_0x9c01('0x35')](_0x35dc8b,_0x299913,!![]);}catch(_0x100cbd){return BPromise['reject'](_0x100cbd);}return _0x35dc8b[_0x9c01('0x36')]();};}function saveUpdates(_0x422a9b,_0x192fee){return function(_0x385265){if(_0x385265){return _0x385265[_0x9c01('0x37')](_0x422a9b)[_0x9c01('0x22')](function(_0x44070e){return _0x44070e;});}return null;};}function removeEntity(_0x5865cf,_0x485b07){return function(_0x5a01f2){if(_0x5a01f2){return _0x5a01f2['destroy']()['then'](function(){var _0x60365a=_0x5a01f2['get']({'plain':!![]});var _0x32a97a=_0x9c01('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x32a97a,'resourceId':_0x60365a['id']}})[_0x9c01('0x22')](function(){return _0x5a01f2;});})[_0x9c01('0x22')](function(){_0x5865cf[_0x9c01('0x2c')](0xcc)[_0x9c01('0x2d')]();});}};}function handleEntityNotFound(_0x38e6da,_0x339e83){return function(_0x578c60){if(!_0x578c60){_0x38e6da[_0x9c01('0x39')](0x194);}return _0x578c60;};}function handleError(_0x449a3a,_0x5e4166){_0x5e4166=_0x5e4166||0x1f4;return function(_0xd8d950){logger[_0x9c01('0x28')](_0xd8d950[_0x9c01('0x3a')]);if(_0xd8d950[_0x9c01('0x3b')]){delete _0xd8d950[_0x9c01('0x3b')];}_0x449a3a[_0x9c01('0x2c')](_0x5e4166)[_0x9c01('0x3c')](_0xd8d950);};}exports['index']=function(_0x215010,_0x942a51){var _0x59c314={'include':[{'model':db[_0x9c01('0x3d')],'as':_0x9c01('0x3e')}]},_0x1fbbea={},_0x5f591a={'count':0x0,'rows':[]};var _0x5a133d=_[_0x9c01('0x3f')](db[_0x9c01('0x40')]['rawAttributes'],function(_0x490260){return{'name':_0x490260[_0x9c01('0x41')],'type':_0x490260[_0x9c01('0x42')][_0x9c01('0x43')]};});_0x1fbbea['model']=_['map'](_0x5a133d,_0x9c01('0x3b'));_0x1fbbea[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x215010[_0x9c01('0x44')]);_0x1fbbea[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x1fbbea[_0x9c01('0x48')],_0x1fbbea[_0x9c01('0x44')]);_0x59c314[_0x9c01('0x49')]=_['intersection'](_0x1fbbea[_0x9c01('0x48')],qs['fields'](_0x215010[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x59c314[_0x9c01('0x49')]=_0x59c314[_0x9c01('0x49')][_0x9c01('0x4b')]?_0x59c314[_0x9c01('0x49')]:_0x1fbbea['model'];if(!_0x215010['query'][_0x9c01('0x4c')](_0x9c01('0x4d'))){_0x59c314[_0x9c01('0x30')]=qs[_0x9c01('0x30')](_0x215010[_0x9c01('0x44')][_0x9c01('0x30')]);_0x59c314[_0x9c01('0x32')]=qs[_0x9c01('0x32')](_0x215010[_0x9c01('0x44')][_0x9c01('0x32')]);}_0x59c314['order']=qs['sort'](_0x215010[_0x9c01('0x44')][_0x9c01('0x4e')]);_0x59c314[_0x9c01('0x4f')]=qs['filters'](_[_0x9c01('0x50')](_0x215010[_0x9c01('0x44')],_0x1fbbea[_0x9c01('0x46')]),_0x5a133d);if(_0x215010[_0x9c01('0x44')]['filter']){_0x59c314[_0x9c01('0x4f')]=_['merge'](_0x59c314[_0x9c01('0x4f')],{'$or':_['map'](_0x5a133d,function(_0x644905){if(_0x644905[_0x9c01('0x42')]!==_0x9c01('0x51')){var _0x5c6c98={};_0x5c6c98[_0x644905[_0x9c01('0x3b')]]={'$like':'%'+_0x215010[_0x9c01('0x44')]['filter']+'%'};return _0x5c6c98;}})});}_0x59c314=_[_0x9c01('0x52')]({},_0x59c314,_0x215010[_0x9c01('0x53')]);var _0x21087b={'where':_0x59c314['where']};return db[_0x9c01('0x40')][_0x9c01('0x31')](_0x21087b)[_0x9c01('0x22')](function(_0x590c01){_0x5f591a[_0x9c01('0x31')]=_0x590c01;if(_0x215010['query'][_0x9c01('0x54')]){_0x59c314[_0x9c01('0x55')]=[{'all':!![]}];}return db[_0x9c01('0x40')][_0x9c01('0x56')](_0x59c314);})[_0x9c01('0x22')](function(_0x147172){_0x5f591a[_0x9c01('0x57')]=_0x147172;return _0x5f591a;})[_0x9c01('0x22')](respondWithFilteredResult(_0x942a51,_0x59c314))[_0x9c01('0x2b')](handleError(_0x942a51,null));};exports[_0x9c01('0x58')]=function(_0x1c46bb,_0x30ffef){var _0x135dc8={'raw':![],'where':{'id':_0x1c46bb[_0x9c01('0x59')]['id']},'include':[{'model':db[_0x9c01('0x3d')],'as':_0x9c01('0x3e')}]},_0x3963ac={};_0x3963ac['model']=_[_0x9c01('0x45')](db[_0x9c01('0x40')]['rawAttributes']);_0x3963ac[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x1c46bb[_0x9c01('0x44')]);_0x3963ac[_0x9c01('0x46')]=_['intersection'](_0x3963ac[_0x9c01('0x48')],_0x3963ac['query']);_0x135dc8[_0x9c01('0x49')]=_[_0x9c01('0x47')](_0x3963ac[_0x9c01('0x48')],qs['fields'](_0x1c46bb[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x135dc8[_0x9c01('0x49')]=_0x135dc8['attributes'][_0x9c01('0x4b')]?_0x135dc8[_0x9c01('0x49')]:_0x3963ac[_0x9c01('0x48')];if(_0x1c46bb[_0x9c01('0x44')][_0x9c01('0x54')]){_0x135dc8[_0x9c01('0x55')]=[{'all':!![]}];}_0x135dc8=_[_0x9c01('0x52')]({},_0x135dc8,_0x1c46bb['options']);return db[_0x9c01('0x40')][_0x9c01('0x5a')](_0x135dc8)[_0x9c01('0x22')](handleEntityNotFound(_0x30ffef,null))['then'](respondWithResult(_0x30ffef,null))[_0x9c01('0x2b')](handleError(_0x30ffef,null));};exports[_0x9c01('0x5b')]=function(_0x5708ba,_0x57fe04){return db['FaxAccount'][_0x9c01('0x5b')](_0x5708ba[_0x9c01('0x5c')],{})['then'](function(_0x22966f){var _0x5b53aa=_0x5708ba[_0x9c01('0x5d')]['get']({'plain':!![]});if(!_0x5b53aa)throw new Error(_0x9c01('0x5e'));if(_0x5b53aa['role']===_0x9c01('0x5d')){var _0xd3466f=_0x22966f[_0x9c01('0x5f')]({'plain':!![]});var _0x5cdb24=_0x9c01('0x38');return db[_0x9c01('0x60')]['find']({'where':{'name':_0x5cdb24,'userProfileId':_0x5b53aa[_0x9c01('0x61')]},'raw':!![]})[_0x9c01('0x22')](function(_0x310534){if(_0x310534&&_0x310534[_0x9c01('0x62')]===0x0){return db[_0x9c01('0x63')][_0x9c01('0x5b')]({'name':_0xd3466f[_0x9c01('0x3b')],'resourceId':_0xd3466f['id'],'type':_0x310534[_0x9c01('0x3b')],'sectionId':_0x310534['id']},{})[_0x9c01('0x22')](function(){return _0x22966f;});}else{return _0x22966f;}})[_0x9c01('0x2b')](function(_0x55a291){logger[_0x9c01('0x28')](_0x9c01('0x64'),_0x55a291);throw _0x55a291;});}return _0x22966f;})[_0x9c01('0x22')](respondWithResult(_0x57fe04,0xc9))['catch'](handleError(_0x57fe04,null));};exports['update']=function(_0x530809,_0x2bd345){if(_0x530809[_0x9c01('0x5c')]['id']){delete _0x530809[_0x9c01('0x5c')]['id'];}return db[_0x9c01('0x40')][_0x9c01('0x5a')]({'where':{'id':_0x530809[_0x9c01('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x9c01('0x3e')}]})[_0x9c01('0x22')](handleEntityNotFound(_0x2bd345,null))[_0x9c01('0x22')](saveUpdates(_0x530809[_0x9c01('0x5c')],null))['then'](respondWithResult(_0x2bd345,null))[_0x9c01('0x2b')](handleError(_0x2bd345,null));};exports['destroy']=function(_0x1947d5,_0x5409a7){return db[_0x9c01('0x40')][_0x9c01('0x5a')]({'where':{'id':_0x1947d5[_0x9c01('0x59')]['id']}})['then'](handleEntityNotFound(_0x5409a7,null))[_0x9c01('0x22')](removeEntity(_0x5409a7,null))[_0x9c01('0x2b')](handleError(_0x5409a7,null));};exports[_0x9c01('0x65')]=function(_0x558dcc,_0x3d395e){return db[_0x9c01('0x40')][_0x9c01('0x65')]()[_0x9c01('0x22')](respondWithResult(_0x3d395e,null))[_0x9c01('0x2b')](handleError(_0x3d395e,null));};exports[_0x9c01('0x66')]=function(_0xc6223a,_0x1a3234,_0x343a2b){if(_0xc6223a[_0x9c01('0x5c')]['id']){delete _0xc6223a[_0x9c01('0x5c')]['id'];}return db[_0x9c01('0x40')]['find']({'where':{'id':_0xc6223a[_0x9c01('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a3234,null))[_0x9c01('0x22')](function(_0x4f6a7e){if(_0x4f6a7e){_0xc6223a[_0x9c01('0x5c')]['FaxAccountId']=_0x4f6a7e['id'];return db['Disposition'][_0x9c01('0x5b')](_0xc6223a['body']);}})['then'](respondWithResult(_0x1a3234,null))['catch'](handleError(_0x1a3234,null));};exports[_0x9c01('0x67')]=function(_0x397cd4,_0x22f974,_0x5abe28){var _0x4b261a={'raw':![],'where':{}};var _0x172b7e={};var _0x24a1f3={'count':0x0,'rows':[]};return db[_0x9c01('0x40')][_0x9c01('0x68')]({'where':{'id':_0x397cd4[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x22f974,null))['then'](function(_0x4f3061){if(_0x4f3061){_0x172b7e[_0x9c01('0x48')]=_[_0x9c01('0x45')](db[_0x9c01('0x69')][_0x9c01('0x6a')]);_0x172b7e[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x397cd4['query']);_0x172b7e[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x172b7e[_0x9c01('0x48')],_0x172b7e[_0x9c01('0x44')]);_0x4b261a[_0x9c01('0x49')]=_[_0x9c01('0x47')](_0x172b7e[_0x9c01('0x48')],qs[_0x9c01('0x4a')](_0x397cd4[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x4b261a['attributes']=_0x4b261a[_0x9c01('0x49')][_0x9c01('0x4b')]?_0x4b261a[_0x9c01('0x49')]:_0x172b7e['model'];if(!_0x397cd4[_0x9c01('0x44')][_0x9c01('0x4c')](_0x9c01('0x4d'))){_0x4b261a[_0x9c01('0x30')]=qs['limit'](_0x397cd4[_0x9c01('0x44')][_0x9c01('0x30')]);_0x4b261a[_0x9c01('0x32')]=qs[_0x9c01('0x32')](_0x397cd4[_0x9c01('0x44')][_0x9c01('0x32')]);}_0x4b261a[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x397cd4['query']['sort']);_0x4b261a[_0x9c01('0x4f')]=qs[_0x9c01('0x46')](_[_0x9c01('0x50')](_0x397cd4[_0x9c01('0x44')],_0x172b7e['filters']));_0x4b261a['where']['FaxAccountId']=_0x4f3061['id'];if(_0x397cd4['query'][_0x9c01('0x6c')]){_0x4b261a[_0x9c01('0x4f')]=_['merge'](_0x4b261a[_0x9c01('0x4f')],{'$or':_[_0x9c01('0x3f')](_0x4b261a[_0x9c01('0x49')],function(_0x52d524){var _0x430f3e={};_0x430f3e[_0x52d524]={'$like':'%'+_0x397cd4[_0x9c01('0x44')][_0x9c01('0x6c')]+'%'};return _0x430f3e;})});}_0x4b261a=_[_0x9c01('0x52')]({},_0x4b261a,_0x397cd4[_0x9c01('0x53')]);return db[_0x9c01('0x69')]['count']({'where':_0x4b261a[_0x9c01('0x4f')]})['then'](function(_0x58adc8){_0x24a1f3[_0x9c01('0x31')]=_0x58adc8;if(_0x397cd4[_0x9c01('0x44')]['includeAll']){_0x4b261a['include']=[{'all':!![]}];}return db[_0x9c01('0x69')][_0x9c01('0x56')](_0x4b261a);})['then'](function(_0x2422c6){_0x24a1f3['rows']=_0x2422c6;return _0x24a1f3;});}})[_0x9c01('0x22')](respondWithFilteredResult(_0x22f974,_0x4b261a))['catch'](handleError(_0x22f974,null));};exports[_0x9c01('0x6d')]=function(_0x17a119,_0x43f495,_0x436720){return db[_0x9c01('0x40')][_0x9c01('0x5a')]({'where':{'id':_0x17a119[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x43f495,null))[_0x9c01('0x22')](function(_0x18f429){if(_0x18f429){return _0x18f429['removeDispositions'](_0x17a119['query'][_0x9c01('0x6e')]);}})[_0x9c01('0x22')](respondWithStatusCode(_0x43f495,null))[_0x9c01('0x2b')](handleError(_0x43f495,null));};exports[_0x9c01('0x6f')]=function(_0x190329,_0x4f84e3,_0x2aff76){if(_0x190329['body']['id']){delete _0x190329['body']['id'];}return db['FaxAccount'][_0x9c01('0x5a')]({'where':{'id':_0x190329[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x4f84e3,null))['then'](function(_0x1f8ea8){if(_0x1f8ea8){_0x190329['body'][_0x9c01('0x70')]=_0x1f8ea8['id'];return db['CannedAnswer'][_0x9c01('0x5b')](_0x190329['body']);}})['then'](respondWithResult(_0x4f84e3,null))[_0x9c01('0x2b')](handleError(_0x4f84e3,null));};exports[_0x9c01('0x71')]=function(_0x2c104b,_0x317919,_0x4688a4){var _0x56ee9f={'raw':![],'where':{}};var _0x5315c6={};var _0xa1e17d={'count':0x0,'rows':[]};return db[_0x9c01('0x40')][_0x9c01('0x68')]({'where':{'id':_0x2c104b[_0x9c01('0x59')]['id']}})['then'](handleEntityNotFound(_0x317919,null))['then'](function(_0x466e5b){if(_0x466e5b){_0x5315c6[_0x9c01('0x48')]=_[_0x9c01('0x45')](db[_0x9c01('0x72')][_0x9c01('0x6a')]);_0x5315c6[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x2c104b[_0x9c01('0x44')]);_0x5315c6[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x5315c6[_0x9c01('0x48')],_0x5315c6[_0x9c01('0x44')]);_0x56ee9f[_0x9c01('0x49')]=_[_0x9c01('0x47')](_0x5315c6[_0x9c01('0x48')],qs[_0x9c01('0x4a')](_0x2c104b[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x56ee9f[_0x9c01('0x49')]=_0x56ee9f['attributes'][_0x9c01('0x4b')]?_0x56ee9f[_0x9c01('0x49')]:_0x5315c6['model'];if(!_0x2c104b[_0x9c01('0x44')][_0x9c01('0x4c')]('nolimit')){_0x56ee9f['limit']=qs['limit'](_0x2c104b[_0x9c01('0x44')][_0x9c01('0x30')]);_0x56ee9f[_0x9c01('0x32')]=qs[_0x9c01('0x32')](_0x2c104b['query'][_0x9c01('0x32')]);}_0x56ee9f[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x2c104b[_0x9c01('0x44')][_0x9c01('0x4e')]);_0x56ee9f['where']=qs[_0x9c01('0x46')](_['pick'](_0x2c104b[_0x9c01('0x44')],_0x5315c6[_0x9c01('0x46')]));_0x56ee9f[_0x9c01('0x4f')]['FaxAccountId']=_0x466e5b['id'];if(_0x2c104b[_0x9c01('0x44')][_0x9c01('0x6c')]){_0x56ee9f['where']=_[_0x9c01('0x52')](_0x56ee9f['where'],{'$or':_[_0x9c01('0x3f')](_0x56ee9f[_0x9c01('0x49')],function(_0x530ce5){var _0x3d1ff7={};_0x3d1ff7[_0x530ce5]={'$like':'%'+_0x2c104b['query'][_0x9c01('0x6c')]+'%'};return _0x3d1ff7;})});}_0x56ee9f=_[_0x9c01('0x52')]({},_0x56ee9f,_0x2c104b[_0x9c01('0x53')]);return db[_0x9c01('0x72')][_0x9c01('0x31')]({'where':_0x56ee9f['where']})[_0x9c01('0x22')](function(_0x1277ae){_0xa1e17d['count']=_0x1277ae;if(_0x2c104b[_0x9c01('0x44')][_0x9c01('0x54')]){_0x56ee9f[_0x9c01('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x56ee9f);})[_0x9c01('0x22')](function(_0xd6cdf2){_0xa1e17d['rows']=_0xd6cdf2;return _0xa1e17d;});}})[_0x9c01('0x22')](respondWithFilteredResult(_0x317919,_0x56ee9f))[_0x9c01('0x2b')](handleError(_0x317919,null));};exports[_0x9c01('0x73')]=function(_0x22fb89,_0x2b27ca,_0x4af7f8){return db['FaxAccount']['find']({'where':{'id':_0x22fb89['params']['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x2b27ca,null))[_0x9c01('0x22')](function(_0x1e225b){if(_0x1e225b){return _0x1e225b[_0x9c01('0x73')](_0x22fb89[_0x9c01('0x44')][_0x9c01('0x6e')]);}})[_0x9c01('0x22')](respondWithStatusCode(_0x2b27ca,null))[_0x9c01('0x2b')](handleError(_0x2b27ca,null));};exports[_0x9c01('0x74')]=function(_0x76a049,_0x565ef4,_0x3023df){return db['FaxInteraction'][_0x9c01('0x5a')]({'where':{'id':_0x76a049[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x565ef4,null))[_0x9c01('0x22')](function(_0x133cb2){if(_0x133cb2){return _0x133cb2[_0x9c01('0x74')](_0x76a049[_0x9c01('0x5c')][_0x9c01('0x6e')],_[_0x9c01('0x75')](_0x76a049[_0x9c01('0x5c')],[_0x9c01('0x6e'),'id'])||{});}})[_0x9c01('0x22')](respondWithResult(_0x565ef4,null))[_0x9c01('0x2b')](handleError(_0x565ef4,null));};exports[_0x9c01('0x76')]=function(_0x3d42dd,_0x25cb29,_0x3515dc){var _0x4bceb2={'raw':![],'where':{}};var _0x3d1d7e={};var _0x16a85f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9c01('0x68')]({'where':{'id':_0x3d42dd[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x25cb29,null))[_0x9c01('0x22')](function(_0xc9f467){if(_0xc9f467){_0x3d1d7e[_0x9c01('0x48')]=_[_0x9c01('0x45')](db[_0x9c01('0x77')][_0x9c01('0x6a')]);_0x3d1d7e[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x3d42dd[_0x9c01('0x44')]);_0x3d1d7e[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x3d1d7e[_0x9c01('0x48')],_0x3d1d7e[_0x9c01('0x44')]);_0x4bceb2[_0x9c01('0x49')]=_['intersection'](_0x3d1d7e[_0x9c01('0x48')],qs[_0x9c01('0x4a')](_0x3d42dd[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x4bceb2[_0x9c01('0x49')]=_0x4bceb2[_0x9c01('0x49')]['length']?_0x4bceb2[_0x9c01('0x49')]:_0x3d1d7e[_0x9c01('0x48')];if(!_0x3d42dd['query']['hasOwnProperty'](_0x9c01('0x4d'))){_0x4bceb2['limit']=qs[_0x9c01('0x30')](_0x3d42dd[_0x9c01('0x44')][_0x9c01('0x30')]);_0x4bceb2['offset']=qs['offset'](_0x3d42dd[_0x9c01('0x44')]['offset']);}_0x4bceb2[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x3d42dd[_0x9c01('0x44')]['sort']);_0x4bceb2[_0x9c01('0x4f')]=qs[_0x9c01('0x46')](_[_0x9c01('0x50')](_0x3d42dd[_0x9c01('0x44')],_0x3d1d7e[_0x9c01('0x46')]));_0x4bceb2['where'][_0x9c01('0x70')]=_0xc9f467['id'];if(_0x3d42dd[_0x9c01('0x44')]['filter']){_0x4bceb2['where']=_[_0x9c01('0x52')](_0x4bceb2[_0x9c01('0x4f')],{'$or':_[_0x9c01('0x3f')](_0x4bceb2[_0x9c01('0x49')],function(_0x4c9331){var _0x1d5197={};_0x1d5197[_0x4c9331]={'$like':'%'+_0x3d42dd[_0x9c01('0x44')][_0x9c01('0x6c')]+'%'};return _0x1d5197;})});}_0x4bceb2=_[_0x9c01('0x52')]({},_0x4bceb2,_0x3d42dd[_0x9c01('0x53')]);return db[_0x9c01('0x77')]['count']({'where':_0x4bceb2[_0x9c01('0x4f')]})[_0x9c01('0x22')](function(_0x3a73af){_0x16a85f[_0x9c01('0x31')]=_0x3a73af;if(_0x3d42dd[_0x9c01('0x44')][_0x9c01('0x54')]){_0x4bceb2['include']=[{'model':db[_0x9c01('0x78')],'as':_0x9c01('0x79'),'required':![]},{'model':db[_0x9c01('0x7a')],'as':_0x9c01('0x7b'),'attributes':['name','fullname',_0x9c01('0x7c')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x3d42dd[_0x9c01('0x44')][_0x9c01('0x7d')]?{'id':_0x3d42dd[_0x9c01('0x44')]['tag']}:undefined,'required':_0x3d42dd['query'][_0x9c01('0x7d')]?!![]:![]}];}return db[_0x9c01('0x77')]['findAll'](_0x4bceb2);})[_0x9c01('0x22')](function(_0x6fa1fb){_0x16a85f['rows']=_0x6fa1fb;return _0x16a85f;});}})[_0x9c01('0x22')](respondWithFilteredResult(_0x25cb29,_0x4bceb2))['catch'](handleError(_0x25cb29,null));};exports[_0x9c01('0x7e')]=function(_0x38fa44,_0x22f20d){var _0x500237=_0x38fa44[_0x9c01('0x59')]['id'];var _0x2a629f=_0x38fa44[_0x9c01('0x5c')];var _0x2b8f7c=0xc8;var _0x293535=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x9c01('0x7f')]['Transaction'][_0x9c01('0x80')]['READ_COMMITTED']},function(_0x5bdbda){return db[_0x9c01('0x40')][_0x9c01('0x68')]({'where':{'id':_0x500237},'transaction':_0x5bdbda})[_0x9c01('0x22')](function(_0x25cf79){if(_0x25cf79){return db[_0x9c01('0x81')][_0x9c01('0x82')]({'where':{'FaxAccountId':_0x500237},'transaction':_0x5bdbda})[_0x9c01('0x22')](function(){var _0x28be6f=_[_0x9c01('0x3f')](_0x2a629f,function(_0x15e07c){_0x15e07c[_0x9c01('0x70')]=_0x500237;return _0x15e07c;});return db[_0x9c01('0x81')][_0x9c01('0x83')](_0x28be6f,{'transaction':_0x5bdbda});});}else{_0x2b8f7c=0x194;_0x293535=[];}});})[_0x9c01('0x22')](function(){if(_0x2b8f7c!==0x194){return db[_0x9c01('0x81')][_0x9c01('0x84')]({'where':{'FaxAccountId':_0x500237},'order':_0x9c01('0x85')})[_0x9c01('0x22')](function(_0x303abb){_0x293535=_0x303abb;});}})[_0x9c01('0x2b')](function(_0x51f450){_0x2b8f7c=0x1f4;logger['error'](_0x51f450[_0x9c01('0x3a')]);if(_0x51f450[_0x9c01('0x3b')]){delete _0x51f450[_0x9c01('0x3b')];}_0x293535=_0x51f450;})[_0x9c01('0x86')](function(){if(_0x293535===null){_0x22f20d[_0x9c01('0x39')](_0x2b8f7c);}else{if(_0x2b8f7c===0x1f4){_0x22f20d[_0x9c01('0x2c')](_0x2b8f7c)['send'](_0x293535);}else{_0x22f20d[_0x9c01('0x2c')](_0x2b8f7c)[_0x9c01('0x2e')](_0x293535);}}});};exports[_0x9c01('0x87')]=function(_0x17f6f1,_0x344a92,_0x34c077){var _0x2b2776={};var _0x3207cb={};var _0x2f4e80;var _0x5ceb70;return db[_0x9c01('0x40')][_0x9c01('0x68')]({'where':{'id':_0x17f6f1[_0x9c01('0x59')]['id']}})['then'](handleEntityNotFound(_0x344a92,null))[_0x9c01('0x22')](function(_0x45b0ec){if(_0x45b0ec){_0x2f4e80=_0x45b0ec;_0x3207cb[_0x9c01('0x48')]=_[_0x9c01('0x45')](db['FaxApplication'][_0x9c01('0x6a')]);_0x3207cb[_0x9c01('0x44')]=_['keys'](_0x17f6f1[_0x9c01('0x44')]);_0x3207cb[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x3207cb[_0x9c01('0x48')],_0x3207cb[_0x9c01('0x44')]);_0x2b2776['attributes']=_['intersection'](_0x3207cb[_0x9c01('0x48')],qs[_0x9c01('0x4a')](_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x2b2776[_0x9c01('0x49')]=_0x2b2776[_0x9c01('0x49')][_0x9c01('0x4b')]?_0x2b2776[_0x9c01('0x49')]:_0x3207cb[_0x9c01('0x48')];_0x2b2776[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x4e')]);_0x2b2776[_0x9c01('0x4f')]=qs[_0x9c01('0x46')](_[_0x9c01('0x50')](_0x17f6f1['query'],_0x3207cb[_0x9c01('0x46')]));if(_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x6c')]){_0x2b2776[_0x9c01('0x4f')]=_[_0x9c01('0x52')](_0x2b2776[_0x9c01('0x4f')],{'$or':_[_0x9c01('0x3f')](_0x2b2776[_0x9c01('0x49')],function(_0x4d37c3){var _0x4151dc={};_0x4151dc[_0x4d37c3]={'$like':'%'+_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x6c')]+'%'};return _0x4151dc;})});}_0x2b2776=_[_0x9c01('0x52')]({},_0x2b2776,_0x17f6f1[_0x9c01('0x53')]);return _0x2f4e80[_0x9c01('0x87')](_0x2b2776);}})[_0x9c01('0x22')](function(_0x149b9b){if(_0x149b9b){_0x5ceb70=_0x149b9b[_0x9c01('0x4b')];if(!_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x4c')](_0x9c01('0x4d'))){_0x2b2776[_0x9c01('0x30')]=qs[_0x9c01('0x30')](_0x17f6f1[_0x9c01('0x44')][_0x9c01('0x30')]);_0x2b2776['offset']=qs['offset'](_0x17f6f1[_0x9c01('0x44')]['offset']);}return _0x2f4e80[_0x9c01('0x87')](_0x2b2776);}})['then'](function(_0x660397){if(_0x660397){return _0x660397?{'count':_0x5ceb70,'rows':_0x660397}:null;}})[_0x9c01('0x22')](respondWithResult(_0x344a92,null))['catch'](handleError(_0x344a92,null));};function Extension(_0x11a0cc,_0x1d7c44,_0x377f9b,_0x3ee7f1){this[_0x9c01('0x88')]='from-voip-provider';this[_0x9c01('0x89')]=_0x11a0cc[_0x9c01('0x8a')];this[_0x9c01('0x8b')]=_0x3ee7f1;this[_0x9c01('0x42')]='system';this[_0x9c01('0x8c')]='Fax\x20Extension';this[_0x9c01('0x70')]=_0x11a0cc['id'];this['priority']=_0x1d7c44;this[_0x9c01('0x8d')]=_0x377f9b;}function createExtensionsReciveFax(_0x99af3d){var _0x2323b2=0x1;var _0x1f57bd=[];_0x1f57bd[_0x9c01('0x8e')](new Extension(_0x99af3d,_0x2323b2,'',_0x9c01('0x8f')));_0x2323b2+=0x1;_0x1f57bd['push'](new Extension(_0x99af3d,_0x2323b2,_0x9c01('0x90'),_0x9c01('0x91')));_0x2323b2+=0x1;for(var _0x1af9e3 in _0x99af3d){if(_0x99af3d[_0x9c01('0x4c')](_0x1af9e3)&&(_0x1af9e3==='ecm'||_0x1af9e3===_0x9c01('0x8a')||_0x1af9e3===_0x9c01('0x92')||_0x1af9e3==='faxdetect'||_0x1af9e3===_0x9c01('0x93')||_0x1af9e3==='maxrate'||_0x1af9e3==='minrate'||_0x1af9e3===_0x9c01('0x94')||_0x1af9e3===_0x9c01('0x95'))){_0x1f57bd[_0x9c01('0x8e')](new Extension(_0x99af3d,_0x2323b2,_0x9c01('0x96')+_0x1af9e3+')='+_0x99af3d[_0x1af9e3],_0x9c01('0x91')));_0x2323b2+=0x1;}}_0x1f57bd[_0x9c01('0x8e')](new Extension(_0x99af3d,_0x2323b2,'6',_0x9c01('0x97')));_0x2323b2+=0x1;_0x1f57bd[_0x9c01('0x8e')](new Extension(_0x99af3d,_0x2323b2,_0x9c01('0x98'),_0x9c01('0x99')));_0x2323b2=0x0;return _0x1f57bd;}exports[_0x9c01('0x9a')]=function(_0x3f3753,_0x382c39,_0x898b7d){var _0x1a3bc8;return db[_0x9c01('0x7f')][_0x9c01('0x9b')](function(_0x2cf060){return db[_0x9c01('0x40')][_0x9c01('0x5b')](_0x3f3753[_0x9c01('0x5c')],{'transaction':_0x2cf060})[_0x9c01('0x22')](function(_0x24c026){_0x1a3bc8=_0x24c026[_0x9c01('0x5f')]({'plain':!![]});return db[_0x9c01('0x9c')][_0x9c01('0x83')](createExtensionsReciveFax(_0x1a3bc8),{'transaction':_0x2cf060});});})[_0x9c01('0x22')](function(){return _0x1a3bc8;})[_0x9c01('0x22')](respondWithResult(_0x382c39,null))[_0x9c01('0x2b')](handleError(_0x382c39,null));};exports['updateAccountApplications']=function(_0xac8d06,_0x2ea13a,_0x1d67af){var _0x55ea11;return db[_0x9c01('0x7f')][_0x9c01('0x9b')](function(_0x198405){return db[_0x9c01('0x40')][_0x9c01('0x37')](_0xac8d06[_0x9c01('0x5c')],{'where':{'id':_0xac8d06[_0x9c01('0x5c')]['id']},'transaction':_0x198405})[_0x9c01('0x22')](function(_0x1261ac){return db[_0x9c01('0x9c')][_0x9c01('0x82')]({'where':{'FaxAccountId':_0xac8d06[_0x9c01('0x5c')]['id']},'transaction':_0x198405})[_0x9c01('0x22')](function(_0x1698d6){return db[_0x9c01('0x9c')][_0x9c01('0x83')](createExtensionsReciveFax(_[_0x9c01('0x75')](_0xac8d06[_0x9c01('0x5c')],[_0x9c01('0x9d'),_0x9c01('0x43'),'createdAt',_0x9c01('0x9e'),_0x9c01('0x9f'),_0x9c01('0xa0')])),{'transaction':_0x198405});});});})[_0x9c01('0x22')](function(){return db['FaxAccount']['findById'](_0xac8d06['body']['id']);})['then'](respondWithResult(_0x2ea13a,null))[_0x9c01('0x2b')](handleError(_0x2ea13a,null));};exports[_0x9c01('0xa1')]=function(_0x4ff0da,_0x45e929,_0x90c0ae){var _0x5b04e9={'raw':!![],'where':{}};var _0x3f2428={};var _0x18ad71={'count':0x0,'rows':[]};return db[_0x9c01('0x40')]['findOne']({'where':{'id':_0x4ff0da[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x45e929,null))[_0x9c01('0x22')](function(_0x53d87c){if(_0x53d87c){_0x3f2428[_0x9c01('0x48')]=_[_0x9c01('0x45')](db[_0x9c01('0xa2')][_0x9c01('0x6a')]);_0x3f2428[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x4ff0da['query']);_0x3f2428[_0x9c01('0x46')]=_['intersection'](_0x3f2428[_0x9c01('0x48')],_0x3f2428[_0x9c01('0x44')]);_0x5b04e9[_0x9c01('0x49')]=_[_0x9c01('0x47')](_0x3f2428[_0x9c01('0x48')],qs[_0x9c01('0x4a')](_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x5b04e9[_0x9c01('0x49')]=_0x5b04e9[_0x9c01('0x49')][_0x9c01('0x4b')]?_0x5b04e9[_0x9c01('0x49')]:_0x3f2428[_0x9c01('0x48')];if(!_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x4c')]('nolimit')){_0x5b04e9[_0x9c01('0x30')]=qs[_0x9c01('0x30')](_0x4ff0da[_0x9c01('0x44')]['limit']);_0x5b04e9[_0x9c01('0x32')]=qs[_0x9c01('0x32')](_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x32')]);}_0x5b04e9[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x4e')]);_0x5b04e9[_0x9c01('0x4f')]=qs[_0x9c01('0x46')](_[_0x9c01('0x50')](_0x4ff0da['query'],_0x3f2428['filters']));_0x5b04e9[_0x9c01('0x4f')][_0x9c01('0x70')]=_0x53d87c['id'];if(_0x4ff0da[_0x9c01('0x44')]['filter']){_0x5b04e9[_0x9c01('0x4f')]=_['merge'](_0x5b04e9['where'],{'$or':_[_0x9c01('0x3f')](_0x5b04e9['attributes'],function(_0x199e6b){var _0x36c04a={};_0x36c04a[_0x199e6b]={'$like':'%'+_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x6c')]+'%'};return _0x36c04a;})});}if(_0x4ff0da[_0x9c01('0x44')][_0x9c01('0xa3')]){var _0x362d04=_0x4ff0da[_0x9c01('0x44')][_0x9c01('0xa3')][_0x9c01('0xa4')](',');var _0x52c1fe={};_0x52c1fe[_0x362d04[0x0]]={'$gte':moment(_0x362d04[0x1])[_0x9c01('0xa5')](_0x9c01('0xa6'))};_0x5b04e9[_0x9c01('0x4f')]=_[_0x9c01('0x52')](_0x5b04e9[_0x9c01('0x4f')],_0x52c1fe);}_0x5b04e9=_[_0x9c01('0x52')]({},_0x5b04e9,_0x4ff0da[_0x9c01('0x53')]);return db[_0x9c01('0xa2')][_0x9c01('0x31')]({'where':_0x5b04e9[_0x9c01('0x4f')]})[_0x9c01('0x22')](function(_0x4eaa41){_0x18ad71[_0x9c01('0x31')]=_0x4eaa41;if(_0x4ff0da[_0x9c01('0x44')][_0x9c01('0x54')]){_0x5b04e9[_0x9c01('0x55')]=[{'all':!![]}];}return db[_0x9c01('0xa2')][_0x9c01('0x56')](_0x5b04e9);})[_0x9c01('0x22')](function(_0x1b0cfa){_0x18ad71[_0x9c01('0x57')]=_0x1b0cfa;return _0x18ad71;});}})['then'](respondWithFilteredResult(_0x45e929,_0x5b04e9))[_0x9c01('0x2b')](handleError(_0x45e929,null));};exports[_0x9c01('0x3c')]=function(_0x4707e9,_0x296213,_0x202ac8){var _0x274b96,_0x14f4bd={},_0x4e43ae;if(_0x4707e9[_0x9c01('0x5c')]['to']){_0x4e43ae=_0x4707e9[_0x9c01('0x5c')]['to'][0x0];}return db[_0x9c01('0x40')][_0x9c01('0x5a')]({'where':{'id':_0x4707e9[_0x9c01('0x59')]['id']},'include':[{'model':db[_0x9c01('0xa7')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9c01('0xa8'),'where':{'fax':_0x4e43ae},'limit':0x1,'order':[[_0x9c01('0x9e'),'DESC']]}]}]})[_0x9c01('0x22')](handleEntityNotFound(_0x296213,null))[_0x9c01('0x22')](function(_0x23ca85){_0x274b96=_0x23ca85;if(_0x4707e9['body'][_0x9c01('0xa9')]&&_0x4707e9['body'][_0x9c01('0xa9')][_0x9c01('0x4b')]){for(var _0x3466ad=0x0;_0x3466ad<_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][_0x9c01('0x4b')];_0x3466ad+=0x1){_0x4707e9['body'][_0x9c01('0xa9')][_0x3466ad]={'filename':_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][_0x3466ad]['name'],'id':_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][_0x3466ad]['id'],'path':path[_0x9c01('0xaa')](config[_0x9c01('0xab')],_0x9c01('0xac'),_0x4707e9['body']['attachments'][_0x3466ad]['basename'])};}}return respondWithRpcPromise(_0x9c01('0xad'),_0x9c01('0xad'),{'FaxAccountId':_[_0x9c01('0xae')](_0x4707e9[_0x9c01('0x59')]['id'])?undefined:_0x4707e9[_0x9c01('0x59')]['id'],'path':_['isNil'](_0x4707e9['body'][_0x9c01('0xa9')][0x0][_0x9c01('0xaf')])?undefined:_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][0x0][_0x9c01('0xaf')],'fax':_[_0x9c01('0xae')](_0x4707e9[_0x9c01('0x5c')]['to'][0x0])?undefined:_0x4707e9['body']['to'][0x0]},client9002);})[_0x9c01('0x22')](function(){if(_0x274b96){if(_[_0x9c01('0xae')](_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xb0')])){_0x4707e9['body'][_0x9c01('0xb0')]=util[_0x9c01('0xa5')](_0x9c01('0xb1'),_0x274b96[_0x9c01('0x3b')],_0x274b96[_0x9c01('0xb2')]);}if(_0x274b96[_0x9c01('0xb3')]){if(_0x274b96['List'][_0x9c01('0xa8')][_0x9c01('0x4b')]){return _0x274b96['List'][_0x9c01('0xa8')][0x0];}else{return db['CmContact'][_0x9c01('0x5b')](_[_0x9c01('0x19')](_0x4707e9['body'],{'firstName':_0x4707e9[_0x9c01('0x5c')]['to'][0x0],'phone':_0x4707e9[_0x9c01('0x5c')]['to'][0x0],'fax':_0x4707e9['body']['to'][0x0],'ListId':_0x274b96[_0x9c01('0xa0')]}));}}else{throw new Error(_0x9c01('0xb4'));}}else{throw new Error(_0x9c01('0xb5'));}})['then'](function(_0x2b9fab){if(_0x2b9fab){return db[_0x9c01('0x77')]['find']({'where':{'ContactId':_0x2b9fab['id'],'closed':![],'FaxAccountId':_0x274b96['id']}})[_0x9c01('0x22')](function(_0x6fb6a5){if(_0x6fb6a5){return[_0x6fb6a5,![]];}return db['FaxInteraction'][_0x9c01('0x5b')]({'UserId':_0x4707e9[_0x9c01('0x5d')]['id'],'ContactId':_0x2b9fab['id'],'FaxAccountId':_0x274b96['id'],'fax':_0x4707e9[_0x9c01('0x5c')]['to'][0x0],'firstMsgDirection':_0x9c01('0xb6'),'Messages':[_[_0x9c01('0x52')](_0x4707e9[_0x9c01('0x5c')],{'read':![],'body':_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][0x0][_0x9c01('0xb7')],'FaxAccountId':_0x274b96['id'],'UserId':_0x4707e9[_0x9c01('0x5d')]['id'],'ContactId':_0x2b9fab['id'],'AttachmentId':_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x9c01('0xa2')],'as':'Messages'}]})[_0x9c01('0x22')](function(_0x4176ea){return[_0x4176ea,!![]];});});}else{throw new Error(_0x9c01('0xb8'));}})[_0x9c01('0xb9')](function(_0x2511b3,_0x132bd8){if(_0x132bd8){return _0x2511b3;}return db[_0x9c01('0xa2')][_0x9c01('0x5b')]({'direction':'out','read':![],'body':_0x4707e9['body'][_0x9c01('0xa9')][0x0][_0x9c01('0xb7')],'FaxAccountId':_0x274b96['id'],'FaxInteractionId':_0x2511b3['id'],'UserId':_0x4707e9[_0x9c01('0x5d')]['id'],'ContactId':_0x2511b3['ContactId'],'AttachmentId':_0x4707e9[_0x9c01('0x5c')][_0x9c01('0xa9')][0x0]['id']})[_0x9c01('0x22')](function(_0xbd314){_0x2511b3[_0x9c01('0xba')][_0x9c01('0xbb')]=[];_0x2511b3[_0x9c01('0xba')]['Messages']['push'](_0xbd314['dataValues']);return _0x2511b3;});})['then'](function(_0x582195){respondWithRpcPromise(_0x9c01('0xbc'),'SendFax',{'FaxAccountId':_['isNil'](_0x4707e9[_0x9c01('0x59')]['id'])?undefined:_0x4707e9[_0x9c01('0x59')]['id'],'path':_[_0x9c01('0xae')](_0x4707e9[_0x9c01('0x5c')]['attachments'][0x0][_0x9c01('0xaf')])?undefined:_0x4707e9[_0x9c01('0x5c')]['attachments'][0x0][_0x9c01('0xaf')],'fax':_[_0x9c01('0xae')](_0x4707e9[_0x9c01('0x5c')]['to'][0x0])?undefined:_0x4707e9[_0x9c01('0x5c')]['to'][0x0],'AttachmentId':_0x4707e9[_0x9c01('0x5c')]['attachments'][0x0]['id']},client9002)['then'](function(_0x393e42){logger['info'](_0x9c01('0xbd'),_0x393e42);})[_0x9c01('0x2b')](function(_0x484c96){logger[_0x9c01('0x23')](_0x9c01('0xbd'),_0x484c96);});return _0x582195;})['then'](respondWithResult(_0x296213,null))[_0x9c01('0x2b')](handleError(_0x296213,null));};exports[_0x9c01('0xbe')]=function(_0x5a8b1a,_0x45d0d3,_0x302658){return db['FaxAccount'][_0x9c01('0x5a')]({'where':{'id':_0x5a8b1a['params']['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x45d0d3,null))[_0x9c01('0x22')](function(_0xaeb0b7){if(_0xaeb0b7){return _0xaeb0b7[_0x9c01('0xbe')](_0x5a8b1a[_0x9c01('0x5c')]['ids'],_[_0x9c01('0x75')](_0x5a8b1a['body'],[_0x9c01('0x6e'),'id'])||{})[_0x9c01('0xb9')](function(_0x2a2ac6){for(var _0x245dec=0x0;_0x245dec<_0x5a8b1a[_0x9c01('0x5c')][_0x9c01('0x6e')][_0x9c01('0x4b')];_0x245dec+=0x1){socket['emit'](_0x9c01('0xbf'),{'UserId':Number(_0x5a8b1a['body'][_0x9c01('0x6e')][_0x245dec]),'FaxAccountId':Number(_0x5a8b1a[_0x9c01('0x59')]['id'])});}return _0x2a2ac6;});}})[_0x9c01('0x22')](respondWithResult(_0x45d0d3,null))[_0x9c01('0x2b')](handleError(_0x45d0d3,null));};exports[_0x9c01('0xc0')]=function(_0x29a3f1,_0x37e47b,_0x38f6a1){return db[_0x9c01('0x40')][_0x9c01('0x5a')]({'where':{'id':_0x29a3f1[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x37e47b,null))[_0x9c01('0x22')](function(_0x373580){if(_0x373580){return _0x373580[_0x9c01('0xc0')](_0x29a3f1[_0x9c01('0x44')][_0x9c01('0x6e')])[_0x9c01('0x22')](function(){if(_[_0x9c01('0xc1')](_0x29a3f1[_0x9c01('0x44')][_0x9c01('0x6e')])){for(var _0x4e2a5d=0x0;_0x4e2a5d<_0x29a3f1[_0x9c01('0x44')]['ids'][_0x9c01('0x4b')];_0x4e2a5d+=0x1){socket[_0x9c01('0xc2')](_0x9c01('0xc3'),{'UserId':Number(_0x29a3f1[_0x9c01('0x44')][_0x9c01('0x6e')][_0x4e2a5d]),'FaxAccountId':Number(_0x29a3f1[_0x9c01('0x59')]['id'])});}}else{socket[_0x9c01('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x29a3f1[_0x9c01('0x44')]['ids']),'FaxAccountId':Number(_0x29a3f1[_0x9c01('0x59')]['id'])});}});}})[_0x9c01('0x22')](respondWithStatusCode(_0x37e47b,null))[_0x9c01('0x2b')](handleError(_0x37e47b,null));};exports[_0x9c01('0xc4')]=function(_0x169bde,_0x1bcb82,_0x1d00f3){var _0x40203a={};var _0x2da764={};var _0x4393e3;var _0x525117;return db[_0x9c01('0x40')][_0x9c01('0x68')]({'where':{'id':_0x169bde[_0x9c01('0x59')]['id']}})[_0x9c01('0x22')](handleEntityNotFound(_0x1bcb82,null))[_0x9c01('0x22')](function(_0x2ab78d){if(_0x2ab78d){_0x4393e3=_0x2ab78d;_0x2da764['model']=_['keys'](db['User'][_0x9c01('0x6a')]);_0x2da764[_0x9c01('0x44')]=_[_0x9c01('0x45')](_0x169bde['query']);_0x2da764[_0x9c01('0x46')]=_[_0x9c01('0x47')](_0x2da764[_0x9c01('0x48')],_0x2da764['query']);_0x40203a[_0x9c01('0x49')]=_[_0x9c01('0x47')](_0x2da764['model'],qs[_0x9c01('0x4a')](_0x169bde[_0x9c01('0x44')][_0x9c01('0x4a')]));_0x40203a[_0x9c01('0x49')]=_0x40203a[_0x9c01('0x49')]['length']?_0x40203a['attributes']:_0x2da764[_0x9c01('0x48')];_0x40203a[_0x9c01('0x6b')]=qs[_0x9c01('0x4e')](_0x169bde[_0x9c01('0x44')][_0x9c01('0x4e')]);_0x40203a[_0x9c01('0x4f')]=qs[_0x9c01('0x46')](_[_0x9c01('0x50')](_0x169bde[_0x9c01('0x44')],_0x2da764[_0x9c01('0x46')]));if(_0x169bde['query'][_0x9c01('0x6c')]){_0x40203a[_0x9c01('0x4f')]=_[_0x9c01('0x52')](_0x40203a[_0x9c01('0x4f')],{'$or':_[_0x9c01('0x3f')](_0x40203a[_0x9c01('0x49')],function(_0x4d5a17){var _0x1f0816={};_0x1f0816[_0x4d5a17]={'$like':'%'+_0x169bde['query']['filter']+'%'};return _0x1f0816;})});}_0x40203a=_['merge']({},_0x40203a,_0x169bde[_0x9c01('0x53')]);return _0x4393e3[_0x9c01('0xc4')](_0x40203a);}})[_0x9c01('0x22')](function(_0x26e9f5){if(_0x26e9f5){_0x525117=_0x26e9f5[_0x9c01('0x4b')];if(!_0x169bde[_0x9c01('0x44')][_0x9c01('0x4c')]('nolimit')){_0x40203a['limit']=qs['limit'](_0x169bde[_0x9c01('0x44')]['limit']);_0x40203a[_0x9c01('0x32')]=qs[_0x9c01('0x32')](_0x169bde[_0x9c01('0x44')][_0x9c01('0x32')]);}return _0x4393e3[_0x9c01('0xc4')](_0x40203a);}})[_0x9c01('0x22')](function(_0x322010){if(_0x322010){return _0x322010?{'count':_0x525117,'rows':_0x322010}:null;}})[_0x9c01('0x22')](respondWithResult(_0x1bcb82,null))['catch'](handleError(_0x1bcb82,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index fe4759b..f2c767d 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 _0x7894=['FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x7894,0x170));var _0x4789=function(_0x212020,_0x763252){_0x212020=_0x212020-0x0;var _0x4247d6=_0x7894[_0x212020];return _0x4247d6;};'use strict';var EventEmitter=require(_0x4789('0x0'));var FaxAccount=require(_0x4789('0x1'))['db'][_0x4789('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4789('0x3')](0x0);var events={'afterCreate':_0x4789('0x4'),'afterUpdate':_0x4789('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd4bd76){return function(_0x2b2dd3,_0x4e2393,_0x3394f6){FaxAccountEvents[_0x4789('0x6')](_0xd4bd76+':'+_0x2b2dd3['id'],_0x2b2dd3);FaxAccountEvents[_0x4789('0x6')](_0xd4bd76,_0x2b2dd3);_0x3394f6(null);};}for(var e in events){if(events[_0x4789('0x7')](e)){var event=events[e];FaxAccount[_0x4789('0x8')](e,emitEvent(event));}}module[_0x4789('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xfbba=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x12a215,_0x333692){var _0x32f072=function(_0x1904d6){while(--_0x1904d6){_0x12a215['push'](_0x12a215['shift']());}};_0x32f072(++_0x333692);}(_0xfbba,0x118));var _0xafbb=function(_0x32afef,_0x289d8a){_0x32afef=_0x32afef-0x0;var _0x4f49a4=_0xfbba[_0x32afef];return _0x4f49a4;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xafbb('0x0'))['db'][_0xafbb('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xafbb('0x2')](0x0);var events={'afterCreate':_0xafbb('0x3'),'afterUpdate':_0xafbb('0x4'),'afterDestroy':_0xafbb('0x5')};function emitEvent(_0x265448){return function(_0x2548dc,_0x2b8a71,_0x355362){FaxAccountEvents[_0xafbb('0x6')](_0x265448+':'+_0x2548dc['id'],_0x2548dc);FaxAccountEvents[_0xafbb('0x6')](_0x265448,_0x2548dc);_0x355362(null);};}for(var e in events){if(events[_0xafbb('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bc0cfc1..40208c0 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 _0x7e9b=['util','../../config/logger','api','moment','request-promise','path','rimraf','./faxAccount.attributes','exports','fax_accounts','lodash'];(function(_0x1bf3d9,_0x27fec6){var _0x23fe8e=function(_0x18b86b){while(--_0x18b86b){_0x1bf3d9['push'](_0x1bf3d9['shift']());}};_0x23fe8e(++_0x27fec6);}(_0x7e9b,0x1ac));var _0xb7e9=function(_0x556b03,_0x26d2a9){_0x556b03=_0x556b03-0x0;var _0xdda96a=_0x7e9b[_0x556b03];return _0xdda96a;};'use strict';var _=require(_0xb7e9('0x0'));var util=require(_0xb7e9('0x1'));var logger=require(_0xb7e9('0x2'))(_0xb7e9('0x3'));var moment=require(_0xb7e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xb7e9('0x5'));var fs=require('fs');var path=require(_0xb7e9('0x6'));var rimraf=require(_0xb7e9('0x7'));var config=require('../../config/environment');var attributes=require(_0xb7e9('0x8'));module[_0xb7e9('0x9')]=function(_0xc28c40,_0x1f3321){return _0xc28c40['define']('FaxAccount',attributes,{'tableName':_0xb7e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfee9=['api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','util'];(function(_0x1f9b4f,_0x44f089){var _0x5f1714=function(_0x17968b){while(--_0x17968b){_0x1f9b4f['push'](_0x1f9b4f['shift']());}};_0x5f1714(++_0x44f089);}(_0xfee9,0xc4));var _0x9fee=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfee9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9fee('0x0'));var util=require(_0x9fee('0x1'));var logger=require('../../config/logger')(_0x9fee('0x2'));var moment=require(_0x9fee('0x3'));var BPromise=require(_0x9fee('0x4'));var rp=require(_0x9fee('0x5'));var fs=require('fs');var path=require(_0x9fee('0x6'));var rimraf=require('rimraf');var config=require(_0x9fee('0x7'));var attributes=require(_0x9fee('0x8'));module[_0x9fee('0x9')]=function(_0x3f7e18,_0x49454e){return _0x3f7e18['define']('FaxAccount',attributes,{'tableName':_0x9fee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 709fa9e..5fb6b93 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 _0xe13e=['CompanyId','ListId','from','from\x20is\x20mandatory','isNil','Sequelize','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','FaxAccount','find','account','CmList','List','Contacts','FaxApplication','get','applications','Applications','list','orderBy','length','contact','FaxInteraction','create','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','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','code','message','result','catch','GetFaxAccount','options','raw','where','attributes','limit','include','map','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe13e,0x85));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee13('0x0'));var util=require(_0xee13('0x1'));var moment=require(_0xee13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee13('0x3'));var db=require(_0xee13('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee13('0x5'));var config=require(_0xee13('0x6'));var jayson=require(_0xee13('0x7'));var client=jayson[_0xee13('0x8')]['http']({'port':0x232c});config[_0xee13('0x9')]=_[_0xee13('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xee13('0xb'))(new Redis(config[_0xee13('0x9')]));require(_0xee13('0xc'))[_0xee13('0xd')](socket);function respondWithRpcPromise(_0x532761,_0x22b62c,_0x3d73bb){return new BPromise(function(_0x519359,_0x23f100){return client[_0xee13('0xe')](_0x532761,_0x3d73bb)[_0xee13('0xf')](function(_0x4d53b7){logger[_0xee13('0x10')](_0xee13('0x11'),_0x22b62c,_0xee13('0x12'));logger[_0xee13('0x13')](_0xee13('0x14'),_0x22b62c,_0xee13('0x12'),JSON[_0xee13('0x15')](_0x4d53b7));if(_0x4d53b7[_0xee13('0x16')]){if(_0x4d53b7['error'][_0xee13('0x17')]===0x1f4){logger['error'](_0xee13('0x11'),_0x22b62c,_0x4d53b7[_0xee13('0x16')][_0xee13('0x18')]);return _0x23f100(_0x4d53b7[_0xee13('0x16')][_0xee13('0x18')]);}logger[_0xee13('0x16')](_0xee13('0x11'),_0x22b62c,_0x4d53b7[_0xee13('0x16')][_0xee13('0x18')]);return _0x519359(_0x4d53b7[_0xee13('0x16')]['message']);}else{logger[_0xee13('0x10')](_0xee13('0x11'),_0x22b62c,'request\x20sent');_0x519359(_0x4d53b7[_0xee13('0x19')]['message']);}})[_0xee13('0x1a')](function(_0x5cde4c){logger[_0xee13('0x16')]('FaxAccount,\x20%s,\x20%s',_0x22b62c,_0x5cde4c);_0x23f100(_0x5cde4c);});});}exports[_0xee13('0x1b')]=function(_0x2b0295){var _0x517b80=this;return new Promise(function(_0x41fe86,_0x1e2bbc){return db['FaxAccount']['findAll']({'raw':_0x2b0295['options']?_0x2b0295[_0xee13('0x1c')][_0xee13('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b0295[_0xee13('0x1c')]?_0x2b0295[_0xee13('0x1c')][_0xee13('0x1e')]||null:null,'attributes':_0x2b0295[_0xee13('0x1c')]?_0x2b0295[_0xee13('0x1c')][_0xee13('0x1f')]||null:null,'limit':_0x2b0295[_0xee13('0x1c')]?_0x2b0295[_0xee13('0x1c')][_0xee13('0x20')]||null:null,'include':_0x2b0295[_0xee13('0x1c')]?_0x2b0295['options'][_0xee13('0x21')]?_[_0xee13('0x22')](_0x2b0295[_0xee13('0x1c')]['include'],function(_0x4fa921){return{'model':db[_0x4fa921['model']],'as':_0x4fa921['as'],'attributes':_0x4fa921[_0xee13('0x1f')],'include':_0x4fa921[_0xee13('0x21')]?_['map'](_0x4fa921[_0xee13('0x21')],function(_0x3dfe15){return{'model':db[_0x3dfe15['model']],'as':_0x3dfe15['as'],'attributes':_0x3dfe15[_0xee13('0x1f')],'include':_0x3dfe15[_0xee13('0x21')]?_[_0xee13('0x22')](_0x3dfe15['include'],function(_0x33b303){return{'model':db[_0x33b303['model']],'as':_0x33b303['as'],'attributes':_0x33b303['attributes']};}):[]};}):[]};}):[]:[]})[_0xee13('0xf')](function(_0x92e400){logger[_0xee13('0x10')](_0xee13('0x1b'),_0x2b0295);logger['debug'](_0xee13('0x1b'),_0x2b0295,JSON['stringify'](_0x92e400));_0x41fe86(_0x92e400);})[_0xee13('0x1a')](function(_0x463b33){logger[_0xee13('0x16')](_0xee13('0x1b'),_0x463b33[_0xee13('0x18')],_0x2b0295);_0x1e2bbc(_0x517b80[_0xee13('0x16')](0x1f4,_0x463b33[_0xee13('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x348d4f,_0x693838,_0x503cb0){var _0x2ad551=this;return new Promise(function(_0x57c06f,_0xef6f5e){var _0xb1f20f={'body':_0x348d4f[_0xee13('0x23')],'channel':_0xee13('0x24')};var _0x35284a=[];var _0x2829b6=[];var _0x3049f3={};return db[_0xee13('0x25')][_0xee13('0x26')]()[_0xee13('0xf')](function(_0x58f9a0){if(!_0x58f9a0){throw new db['Sequelize'][(_0xee13('0x27'))](_0xee13('0x28'));}_0x35284a=_['difference'](_[_0xee13('0x29')](_0x58f9a0),[_0xee13('0x2a'),'updatedAt']);_0x2829b6=_[_0xee13('0x2b')](_[_0xee13('0x29')](_0x58f9a0),[_0xee13('0x2a'),_0xee13('0x2c'),_0xee13('0x2d'),_0xee13('0x2e')]);if(_0x348d4f[_0xee13('0x23')]['id']){delete _0x348d4f['body']['id'];}if(_['isNil'](_0x348d4f[_0xee13('0x23')][_0xee13('0x2f')])){throw new db['Sequelize']['ValidationError'](_0xee13('0x30'));}if(_[_0xee13('0x31')](_0x348d4f[_0xee13('0x23')][_0xee13('0x23')])||_0x348d4f[_0xee13('0x23')][_0xee13('0x23')]===''){throw new db[(_0xee13('0x32'))][(_0xee13('0x27'))](_0xee13('0x33'));}if(_[_0xee13('0x31')](_0x348d4f[_0xee13('0x23')]['mapKey'])){throw new db['Sequelize'][(_0xee13('0x27'))](_0xee13('0x34')+_0x2829b6);}if(!_[_0xee13('0x35')](_0x2829b6,_0x348d4f[_0xee13('0x23')][_0xee13('0x36')])){throw new db[(_0xee13('0x32'))][(_0xee13('0x27'))](_0xee13('0x37')+_0x2829b6);}_0x3049f3[_0x348d4f[_0xee13('0x23')][_0xee13('0x36')]]=_0x348d4f[_0xee13('0x23')]['from'];})[_0xee13('0xf')](function(){return db[_0xee13('0x38')][_0xee13('0x39')]({'where':{'id':_0x348d4f[_0xee13('0x3a')]['id']},'include':[{'model':db[_0xee13('0x3b')],'as':_0xee13('0x3c'),'include':[{'model':db[_0xee13('0x25')],'as':_0xee13('0x3d'),'where':_0x3049f3,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xee13('0x3e')],'as':'Applications'}]});})[_0xee13('0xf')](function(_0xeef648){if(_0xeef648&&_0xeef648['List']){var _0x5972fa=_0xeef648[_0xee13('0x3f')]({'plain':!![]});_0xb1f20f[_0xee13('0x3a')]=_0x5972fa;_0xb1f20f[_0xee13('0x40')]=_0x5972fa[_0xee13('0x41')];_0xb1f20f[_0xee13('0x42')]=_0x5972fa['List'];_0xb1f20f['applications']=_[_0xee13('0x43')](_0xb1f20f[_0xee13('0x40')],['priority'],['asc']);if(_0xb1f20f[_0xee13('0x3a')][_0xee13('0x41')]){delete _0xb1f20f[_0xee13('0x3a')][_0xee13('0x41')];}if(_0xb1f20f[_0xee13('0x3a')][_0xee13('0x3c')]&&_0xb1f20f[_0xee13('0x3a')][_0xee13('0x3c')]['Contacts'][_0xee13('0x44')]){return _0xb1f20f['account'][_0xee13('0x3c')][_0xee13('0x3d')][0x0];}var _0x11c99a=_[_0xee13('0xa')](_0x348d4f['body'],{'firstName':_0x348d4f[_0xee13('0x23')]['from'],'ListId':_0x5972fa[_0xee13('0x2e')]});_0x11c99a[_0x348d4f['body'][_0xee13('0x36')]]=_0x348d4f[_0xee13('0x23')]['from'];return db['CmContact']['create'](_0x11c99a,{'fields':_0x35284a,'raw':!![]});}})['then'](function(_0x20edf9){_0xb1f20f[_0xee13('0x45')]=_0x20edf9;if(_0x20edf9){var _0x79d270={'ContactId':_0x20edf9['id'],'FaxAccountId':_0x348d4f[_0xee13('0x3a')]['id'],'fax':_0x20edf9[_0xee13('0x24')]};return db[_0xee13('0x46')][_0xee13('0x39')]({'where':{'ContactId':_0x20edf9['id'],'closed':![],'FaxAccountId':_0x348d4f['account']['id']}})[_0xee13('0xf')](function(_0x43ac54){if(_0x43ac54){return[_0x43ac54,![]];}return db['FaxInteraction'][_0xee13('0x47')](_0x79d270)[_0xee13('0xf')](function(_0x4f5780){return[_0x4f5780,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xee13('0x48')](function(_0x3bf69e,_0x96e6f7){var _0x5880c9=_0x3bf69e['get']({'plain':!![]});if(_0x96e6f7){if(_0xb1f20f[_0xee13('0x3a')][_0xee13('0x49')]){_0xb1f20f[_0xee13('0x40')][_0xee13('0x4a')]({'id':0x0,'priority':_0xb1f20f[_0xee13('0x40')][_0xee13('0x44')]+0x1,'app':_0xee13('0x4b'),'appdata':_0xee13('0x4c'),'interval':'*,*,*,*'});}_0x5880c9[_0xee13('0x4d')]=!![];}else{_0x5880c9[_0xee13('0x4d')]=![];}_0xb1f20f[_0xee13('0x4e')]=_0x5880c9;return db[_0xee13('0x4f')][_0xee13('0x47')]({'body':_0x348d4f[_0xee13('0x23')][_0xee13('0x23')],'FaxAccountId':_0x348d4f[_0xee13('0x3a')]['id'],'FaxInteractionId':_0x3bf69e['id'],'direction':'in','ContactId':_0x3bf69e[_0xee13('0x50')],'AttachmentId':_0x348d4f[_0xee13('0x23')][_0xee13('0x51')]});})[_0xee13('0xf')](function(_0x546882){_0xb1f20f[_0xee13('0x18')]=_0x546882;if(_0xb1f20f['interaction'][_0xee13('0x52')]){return db['User'][_0xee13('0x39')]({'attributes':['id',_0xee13('0x53')],'where':{'id':_0xb1f20f[_0xee13('0x4e')]['UserId']}})[_0xee13('0xf')](function(_0x4ae5f0){if(_0x4ae5f0){_0xb1f20f[_0xee13('0x40')][_0xee13('0x54')]({'id':0x0,'priority':0x0,'app':_0xee13('0x55'),'appdata':_0x4ae5f0['name']+','+(_0xb1f20f[_0xee13('0x3a')][_0xee13('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xee13('0x57'),_0xb1f20f);});}return respondWithRpcPromise(_0xee13('0x58'),'startRouting',_0xb1f20f);})[_0xee13('0xf')](function(_0x5e3c5f){_0x57c06f(_0x5e3c5f);})[_0xee13('0x1a')](function(_0x3080f6){_0xef6f5e(_0x2ad551['error'](0x1f4,_0x3080f6[_0xee13('0x18')]));});});}; \ No newline at end of file +var _0x7e97=['DESC','FaxApplication','get','Applications','list','applications','priority','asc','length','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','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','attributes','limit','include','map','model','GetFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','CompanyId','isNil','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','find','account','List','Contacts'];(function(_0x56ce04,_0x213481){var _0xe23446=function(_0x161deb){while(--_0x161deb){_0x56ce04['push'](_0x56ce04['shift']());}};_0xe23446(++_0x213481);}(_0x7e97,0x181));var _0x77e9=function(_0x537173,_0x21c7ea){_0x537173=_0x537173-0x0;var _0x1b7228=_0x7e97[_0x537173];return _0x1b7228;};'use strict';var _=require(_0x77e9('0x0'));var util=require(_0x77e9('0x1'));var moment=require(_0x77e9('0x2'));var BPromise=require(_0x77e9('0x3'));var rs=require(_0x77e9('0x4'));var fs=require('fs');var Redis=require(_0x77e9('0x5'));var db=require(_0x77e9('0x6'))['db'];var utils=require(_0x77e9('0x7'));var logger=require(_0x77e9('0x8'))(_0x77e9('0x9'));var config=require('../../config/environment');var jayson=require(_0x77e9('0xa'));var client=jayson[_0x77e9('0xb')][_0x77e9('0xc')]({'port':0x232c});config[_0x77e9('0xd')]=_[_0x77e9('0xe')](config[_0x77e9('0xd')],{'host':_0x77e9('0xf'),'port':0x18eb});var socket=require(_0x77e9('0x10'))(new Redis(config['redis']));require(_0x77e9('0x11'))[_0x77e9('0x12')](socket);function respondWithRpcPromise(_0x26c9d1,_0xbadf1f,_0xc0c5f4){return new BPromise(function(_0x2c6e24,_0x348545){return client[_0x77e9('0x13')](_0x26c9d1,_0xc0c5f4)[_0x77e9('0x14')](function(_0x3acb4c){logger[_0x77e9('0x15')](_0x77e9('0x16'),_0xbadf1f,_0x77e9('0x17'));logger[_0x77e9('0x18')](_0x77e9('0x19'),_0xbadf1f,_0x77e9('0x17'),JSON[_0x77e9('0x1a')](_0x3acb4c));if(_0x3acb4c[_0x77e9('0x1b')]){if(_0x3acb4c[_0x77e9('0x1b')]['code']===0x1f4){logger['error'](_0x77e9('0x16'),_0xbadf1f,_0x3acb4c[_0x77e9('0x1b')][_0x77e9('0x1c')]);return _0x348545(_0x3acb4c['error'][_0x77e9('0x1c')]);}logger[_0x77e9('0x1b')](_0x77e9('0x16'),_0xbadf1f,_0x3acb4c[_0x77e9('0x1b')]['message']);return _0x2c6e24(_0x3acb4c[_0x77e9('0x1b')]['message']);}else{logger['info'](_0x77e9('0x16'),_0xbadf1f,'request\x20sent');_0x2c6e24(_0x3acb4c[_0x77e9('0x1d')][_0x77e9('0x1c')]);}})[_0x77e9('0x1e')](function(_0x53d4ce){logger[_0x77e9('0x1b')](_0x77e9('0x16'),_0xbadf1f,_0x53d4ce);_0x348545(_0x53d4ce);});});}exports['GetFaxAccount']=function(_0x3f519e){var _0x487aef=this;return new Promise(function(_0x3fbdb8,_0x23d7c7){return db[_0x77e9('0x1f')][_0x77e9('0x20')]({'raw':_0x3f519e[_0x77e9('0x21')]?_0x3f519e[_0x77e9('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3f519e[_0x77e9('0x21')]?_0x3f519e[_0x77e9('0x21')]['where']||null:null,'attributes':_0x3f519e[_0x77e9('0x21')]?_0x3f519e[_0x77e9('0x21')][_0x77e9('0x22')]||null:null,'limit':_0x3f519e[_0x77e9('0x21')]?_0x3f519e[_0x77e9('0x21')][_0x77e9('0x23')]||null:null,'include':_0x3f519e[_0x77e9('0x21')]?_0x3f519e[_0x77e9('0x21')][_0x77e9('0x24')]?_[_0x77e9('0x25')](_0x3f519e[_0x77e9('0x21')][_0x77e9('0x24')],function(_0x186991){return{'model':db[_0x186991[_0x77e9('0x26')]],'as':_0x186991['as'],'attributes':_0x186991[_0x77e9('0x22')],'include':_0x186991['include']?_['map'](_0x186991['include'],function(_0x54f460){return{'model':db[_0x54f460['model']],'as':_0x54f460['as'],'attributes':_0x54f460[_0x77e9('0x22')],'include':_0x54f460[_0x77e9('0x24')]?_[_0x77e9('0x25')](_0x54f460[_0x77e9('0x24')],function(_0x4fed72){return{'model':db[_0x4fed72[_0x77e9('0x26')]],'as':_0x4fed72['as'],'attributes':_0x4fed72['attributes']};}):[]};}):[]};}):[]:[]})[_0x77e9('0x14')](function(_0x3c5c5e){logger[_0x77e9('0x15')](_0x77e9('0x27'),_0x3f519e);logger[_0x77e9('0x18')](_0x77e9('0x27'),_0x3f519e,JSON[_0x77e9('0x1a')](_0x3c5c5e));_0x3fbdb8(_0x3c5c5e);})[_0x77e9('0x1e')](function(_0x3e3357){logger[_0x77e9('0x1b')](_0x77e9('0x27'),_0x3e3357[_0x77e9('0x1c')],_0x3f519e);_0x23d7c7(_0x487aef[_0x77e9('0x1b')](0x1f4,_0x3e3357[_0x77e9('0x1c')]));});});};exports['NotifyFaxAccount']=function(_0x383ce1,_0x1859a5,_0x200f7f){var _0x38dcd5=this;return new Promise(function(_0x5d53b5,_0x46da44){var _0x3e67e9={'body':_0x383ce1[_0x77e9('0x28')],'channel':_0x77e9('0x29')};var _0x328856=[];var _0x3e09e1=[];var _0x36d2e4={};return db[_0x77e9('0x2a')]['describe']()[_0x77e9('0x14')](function(_0x38b496){if(!_0x38b496){throw new db[(_0x77e9('0x2b'))][(_0x77e9('0x2c'))](_0x77e9('0x2d'));}_0x328856=_['difference'](_[_0x77e9('0x2e')](_0x38b496),['createdAt',_0x77e9('0x2f')]);_0x3e09e1=_['difference'](_[_0x77e9('0x2e')](_0x38b496),['createdAt',_0x77e9('0x2f'),_0x77e9('0x30'),'ListId']);if(_0x383ce1[_0x77e9('0x28')]['id']){delete _0x383ce1[_0x77e9('0x28')]['id'];}if(_[_0x77e9('0x31')](_0x383ce1[_0x77e9('0x28')][_0x77e9('0x32')])){throw new db[(_0x77e9('0x2b'))][(_0x77e9('0x2c'))](_0x77e9('0x33'));}if(_['isNil'](_0x383ce1[_0x77e9('0x28')]['body'])||_0x383ce1[_0x77e9('0x28')][_0x77e9('0x28')]===''){throw new db[(_0x77e9('0x2b'))][(_0x77e9('0x2c'))](_0x77e9('0x34'));}if(_[_0x77e9('0x31')](_0x383ce1[_0x77e9('0x28')][_0x77e9('0x35')])){throw new db[(_0x77e9('0x2b'))][(_0x77e9('0x2c'))](_0x77e9('0x36')+_0x3e09e1);}if(!_['includes'](_0x3e09e1,_0x383ce1['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x77e9('0x37')+_0x3e09e1);}_0x36d2e4[_0x383ce1[_0x77e9('0x28')][_0x77e9('0x35')]]=_0x383ce1[_0x77e9('0x28')][_0x77e9('0x32')];})[_0x77e9('0x14')](function(){return db['FaxAccount'][_0x77e9('0x38')]({'where':{'id':_0x383ce1[_0x77e9('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x77e9('0x3a'),'include':[{'model':db[_0x77e9('0x2a')],'as':_0x77e9('0x3b'),'where':_0x36d2e4,'limit':0x1,'order':[[_0x77e9('0x2f'),_0x77e9('0x3c')]]}]},{'model':db[_0x77e9('0x3d')],'as':'Applications'}]});})[_0x77e9('0x14')](function(_0xcb922d){if(_0xcb922d&&_0xcb922d[_0x77e9('0x3a')]){var _0x5597a5=_0xcb922d[_0x77e9('0x3e')]({'plain':!![]});_0x3e67e9[_0x77e9('0x39')]=_0x5597a5;_0x3e67e9['applications']=_0x5597a5[_0x77e9('0x3f')];_0x3e67e9[_0x77e9('0x40')]=_0x5597a5[_0x77e9('0x3a')];_0x3e67e9[_0x77e9('0x41')]=_['orderBy'](_0x3e67e9[_0x77e9('0x41')],[_0x77e9('0x42')],[_0x77e9('0x43')]);if(_0x3e67e9[_0x77e9('0x39')]['Applications']){delete _0x3e67e9[_0x77e9('0x39')][_0x77e9('0x3f')];}if(_0x3e67e9[_0x77e9('0x39')][_0x77e9('0x3a')]&&_0x3e67e9[_0x77e9('0x39')]['List'][_0x77e9('0x3b')][_0x77e9('0x44')]){return _0x3e67e9[_0x77e9('0x39')]['List'][_0x77e9('0x3b')][0x0];}var _0x70636a=_['defaults'](_0x383ce1[_0x77e9('0x28')],{'firstName':_0x383ce1[_0x77e9('0x28')][_0x77e9('0x32')],'ListId':_0x5597a5[_0x77e9('0x45')]});_0x70636a[_0x383ce1[_0x77e9('0x28')][_0x77e9('0x35')]]=_0x383ce1[_0x77e9('0x28')][_0x77e9('0x32')];return db[_0x77e9('0x2a')]['create'](_0x70636a,{'fields':_0x328856,'raw':!![]});}})[_0x77e9('0x14')](function(_0x545c42){_0x3e67e9[_0x77e9('0x46')]=_0x545c42;if(_0x545c42){var _0x2a3195={'ContactId':_0x545c42['id'],'FaxAccountId':_0x383ce1[_0x77e9('0x39')]['id'],'fax':_0x545c42[_0x77e9('0x29')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x545c42['id'],'closed':![],'FaxAccountId':_0x383ce1['account']['id']}})['then'](function(_0x2f5d02){if(_0x2f5d02){return[_0x2f5d02,![]];}return db[_0x77e9('0x47')][_0x77e9('0x48')](_0x2a3195)[_0x77e9('0x14')](function(_0x1e0b55){return[_0x1e0b55,!![]];});});}else{throw new Error(_0x77e9('0x49'));}})[_0x77e9('0x4a')](function(_0x4c146a,_0x4e4f48){var _0x278e81=_0x4c146a[_0x77e9('0x3e')]({'plain':!![]});if(_0x4e4f48){if(_0x3e67e9[_0x77e9('0x39')][_0x77e9('0x4b')]){_0x3e67e9[_0x77e9('0x41')]['push']({'id':0x0,'priority':_0x3e67e9[_0x77e9('0x41')][_0x77e9('0x44')]+0x1,'app':_0x77e9('0x4c'),'appdata':_0x77e9('0x4d'),'interval':_0x77e9('0x4e')});}_0x278e81[_0x77e9('0x4f')]=!![];}else{_0x278e81['created']=![];}_0x3e67e9[_0x77e9('0x50')]=_0x278e81;return db['FaxMessage']['create']({'body':_0x383ce1['body'][_0x77e9('0x28')],'FaxAccountId':_0x383ce1['account']['id'],'FaxInteractionId':_0x4c146a['id'],'direction':'in','ContactId':_0x4c146a[_0x77e9('0x51')],'AttachmentId':_0x383ce1[_0x77e9('0x28')][_0x77e9('0x52')]});})[_0x77e9('0x14')](function(_0x27fcfd){_0x3e67e9[_0x77e9('0x1c')]=_0x27fcfd;if(_0x3e67e9[_0x77e9('0x50')][_0x77e9('0x53')]){return db[_0x77e9('0x54')][_0x77e9('0x38')]({'attributes':['id','name'],'where':{'id':_0x3e67e9[_0x77e9('0x50')][_0x77e9('0x53')]}})[_0x77e9('0x14')](function(_0x2093e3){if(_0x2093e3){_0x3e67e9[_0x77e9('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x77e9('0x55'),'appdata':_0x2093e3['name']+','+(_0x3e67e9['account'][_0x77e9('0x56')]||0xa),'interval':_0x77e9('0x4e')});}return respondWithRpcPromise(_0x77e9('0x57'),_0x77e9('0x58'),_0x3e67e9);});}return respondWithRpcPromise('Start',_0x77e9('0x58'),_0x3e67e9);})[_0x77e9('0x14')](function(_0x17d3d2){_0x5d53b5(_0x17d3d2);})['catch'](function(_0x97023d){_0x46da44(_0x38dcd5[_0x77e9('0x1b')](0x1f4,_0x97023d[_0x77e9('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8291ae5..7e02972 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 _0xfebd=['emit','removeListener','faxAccount:','./faxAccount.events','save'];(function(_0x2ac980,_0x33829d){var _0x53974d=function(_0x4cd40c){while(--_0x4cd40c){_0x2ac980['push'](_0x2ac980['shift']());}};_0x53974d(++_0x33829d);}(_0xfebd,0x76));var _0xdfeb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfebd[_0x2dafbe];return _0x58a45a;};'use strict';var FaxAccountEvents=require(_0xdfeb('0x0'));var events=[_0xdfeb('0x1'),'remove','update'];function createListener(_0x4414bc,_0x5df20c){return function(_0x404165){_0x5df20c[_0xdfeb('0x2')](_0x4414bc,_0x404165);};}function removeListener(_0x4f794c,_0x5c1561){return function(){FaxAccountEvents[_0xdfeb('0x3')](_0x4f794c,_0x5c1561);};}exports['register']=function(_0x43a6ba){for(var _0x273926=0x0,_0x1d14c9=events['length'];_0x273926<_0x1d14c9;_0x273926++){var _0x116661=events[_0x273926];var _0x474f7f=createListener(_0xdfeb('0x4')+_0x116661,_0x43a6ba);FaxAccountEvents['on'](_0x116661,_0x474f7f);}}; \ No newline at end of file +var _0xeb61=['register','length','faxAccount:','./faxAccount.events','remove','update','removeListener'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xeb61,0x114));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x1eb6('0x0'));var events=['save',_0x1eb6('0x1'),_0x1eb6('0x2')];function createListener(_0x461010,_0x162180){return function(_0x3e8154){_0x162180['emit'](_0x461010,_0x3e8154);};}function removeListener(_0x255881,_0x5378c0){return function(){FaxAccountEvents[_0x1eb6('0x3')](_0x255881,_0x5378c0);};}exports[_0x1eb6('0x4')]=function(_0x1199d1){for(var _0x136785=0x0,_0x37472a=events[_0x1eb6('0x5')];_0x136785<_0x37472a;_0x136785++){var _0xeb05dd=events[_0x136785];var _0x16824e=createListener(_0x1eb6('0x6')+_0xeb05dd,_0x1199d1);FaxAccountEvents['on'](_0xeb05dd,_0x16824e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 994fa54..b4ac25a 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(_0x4c8a5f,_0x53f8da){var _0x190c08=function(_0x37b274){while(--_0x37b274){_0x4c8a5f['push'](_0x4c8a5f['shift']());}};_0x190c08(++_0x53f8da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3d59e7,_0xa22d3d){var _0x18f362=function(_0x5a5b5b){while(--_0x5a5b5b){_0x3d59e7['push'](_0x3d59e7['shift']());}};_0x18f362(++_0xa22d3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 04b2bba..4d8b829 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 _0x489c=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x489c,0xdd));var _0xc489=function(_0x1bd4ea,_0x3c80d8){_0x1bd4ea=_0x1bd4ea-0x0;var _0x2ed321=_0x489c[_0x1bd4ea];return _0x2ed321;};'use strict';var Sequelize=require('sequelize');module[_0xc489('0x0')]={'priority':{'type':Sequelize[_0xc489('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc489('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc489('0x3')]()},'description':{'type':Sequelize[_0xc489('0x2')]},'interval':{'type':Sequelize[_0xc489('0x2')],'defaultValue':_0xc489('0x4')}}; \ No newline at end of file +var _0x3fc8=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x40f28a,_0x5c70f8){var _0x119e21=function(_0x250579){while(--_0x250579){_0x40f28a['push'](_0x40f28a['shift']());}};_0x119e21(++_0x5c70f8);}(_0x3fc8,0x1ab));var _0x83fc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3fc8[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x83fc('0x0'));module[_0x83fc('0x1')]={'priority':{'type':Sequelize[_0x83fc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x83fc('0x3')},'appdata':{'type':Sequelize[_0x83fc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x83fc('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8748aba..4953ffa 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 _0x6c24=['body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','end','name','index','map','rawAttributes','type','key','model','query','keys','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','FaxApplication','include','findAll','rows','catch','show','params','filters','intersection','includeAll','options','create'];(function(_0xa31cbb,_0x3920ac){var _0xa34c42=function(_0x5b387c){while(--_0x5b387c){_0xa31cbb['push'](_0xa31cbb['shift']());}};_0xa34c42(++_0x3920ac);}(_0x6c24,0x16a));var _0x46c2=function(_0x40be02,_0x493b81){_0x40be02=_0x40be02-0x0;var _0x3089d2=_0x6c24[_0x40be02];return _0x3089d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46c2('0x0'));var zipdir=require(_0x46c2('0x1'));var jsonpatch=require(_0x46c2('0x2'));var rp=require(_0x46c2('0x3'));var moment=require(_0x46c2('0x4'));var BPromise=require(_0x46c2('0x5'));var Mustache=require(_0x46c2('0x6'));var util=require('util');var path=require(_0x46c2('0x7'));var sox=require('sox');var csv=require(_0x46c2('0x8'));var ejs=require(_0x46c2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46c2('0xa'));var squel=require(_0x46c2('0xb'));var crypto=require(_0x46c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x46c2('0xd'));var toCsv=require(_0x46c2('0x8'));var querystring=require(_0x46c2('0xe'));var Papa=require(_0x46c2('0xf'));var Redis=require(_0x46c2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x46c2('0x11'));var as=require(_0x46c2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46c2('0x13'))('api');var utils=require(_0x46c2('0x14'));var config=require(_0x46c2('0x15'));var licenseUtil=require(_0x46c2('0x16'));var db=require(_0x46c2('0x17'))['db'];function respondWithStatusCode(_0x293ee3,_0x272fa3){_0x272fa3=_0x272fa3||0xcc;return function(_0x4bcb7c){if(_0x4bcb7c){return _0x293ee3[_0x46c2('0x18')](_0x272fa3);}return _0x293ee3['status'](_0x272fa3)['end']();};}function respondWithResult(_0x11153d,_0x246444){_0x246444=_0x246444||0xc8;return function(_0xceee75){if(_0xceee75){return _0x11153d[_0x46c2('0x19')](_0x246444)[_0x46c2('0x1a')](_0xceee75);}};}function respondWithFilteredResult(_0x180e1e,_0xc96044){return function(_0x589ec2){if(_0x589ec2){var _0xfacfb7=typeof _0xc96044[_0x46c2('0x1b')]==='undefined'&&typeof _0xc96044[_0x46c2('0x1c')]===_0x46c2('0x1d');var _0x41499f=_0x589ec2[_0x46c2('0x1e')];var _0x56a584=_0xfacfb7?0x0:_0xc96044[_0x46c2('0x1b')];var _0x1808c5=_0xfacfb7?_0x589ec2[_0x46c2('0x1e')]:_0xc96044[_0x46c2('0x1b')]+_0xc96044[_0x46c2('0x1c')];var _0x12dd12;if(_0x1808c5>=_0x41499f){_0x1808c5=_0x41499f;_0x12dd12=0xc8;}else{_0x12dd12=0xce;}_0x180e1e[_0x46c2('0x19')](_0x12dd12);return _0x180e1e[_0x46c2('0x1f')]('Content-Range',_0x56a584+'-'+_0x1808c5+'/'+_0x41499f)['json'](_0x589ec2);}return null;};}function patchUpdates(_0x130379){return function(_0x5e13ff){try{jsonpatch[_0x46c2('0x20')](_0x5e13ff,_0x130379,!![]);}catch(_0x4eadd8){return BPromise[_0x46c2('0x21')](_0x4eadd8);}return _0x5e13ff[_0x46c2('0x22')]();};}function saveUpdates(_0x4f1c96,_0x21f7c7){return function(_0x4e256d){if(_0x4e256d){return _0x4e256d[_0x46c2('0x23')](_0x4f1c96)['then'](function(_0x30ff88){return _0x30ff88;});}return null;};}function removeEntity(_0x5052b3,_0x572d4f){return function(_0x23adde){if(_0x23adde){return _0x23adde[_0x46c2('0x24')]()[_0x46c2('0x25')](function(){_0x5052b3[_0x46c2('0x19')](0xcc)[_0x46c2('0x26')]();});}};}function handleEntityNotFound(_0x35e2cc,_0x145c9c){return function(_0xac2440){if(!_0xac2440){_0x35e2cc[_0x46c2('0x18')](0x194);}return _0xac2440;};}function handleError(_0x299f5f,_0x4cf452){_0x4cf452=_0x4cf452||0x1f4;return function(_0x4e75a0){logger['error'](_0x4e75a0['stack']);if(_0x4e75a0[_0x46c2('0x27')]){delete _0x4e75a0[_0x46c2('0x27')];}_0x299f5f[_0x46c2('0x19')](_0x4cf452)['send'](_0x4e75a0);};}exports[_0x46c2('0x28')]=function(_0x570463,_0x39b413){var _0x484f28={},_0x43be38={},_0x548118={'count':0x0,'rows':[]};var _0x1a6bdd=_[_0x46c2('0x29')](db['FaxApplication'][_0x46c2('0x2a')],function(_0x42668a){return{'name':_0x42668a['fieldName'],'type':_0x42668a[_0x46c2('0x2b')][_0x46c2('0x2c')]};});_0x43be38[_0x46c2('0x2d')]=_[_0x46c2('0x29')](_0x1a6bdd,_0x46c2('0x27'));_0x43be38[_0x46c2('0x2e')]=_[_0x46c2('0x2f')](_0x570463[_0x46c2('0x2e')]);_0x43be38['filters']=_['intersection'](_0x43be38[_0x46c2('0x2d')],_0x43be38['query']);_0x484f28[_0x46c2('0x30')]=_['intersection'](_0x43be38[_0x46c2('0x2d')],qs[_0x46c2('0x31')](_0x570463[_0x46c2('0x2e')][_0x46c2('0x31')]));_0x484f28[_0x46c2('0x30')]=_0x484f28[_0x46c2('0x30')][_0x46c2('0x32')]?_0x484f28[_0x46c2('0x30')]:_0x43be38[_0x46c2('0x2d')];if(!_0x570463[_0x46c2('0x2e')]['hasOwnProperty'](_0x46c2('0x33'))){_0x484f28['limit']=qs[_0x46c2('0x1c')](_0x570463[_0x46c2('0x2e')]['limit']);_0x484f28[_0x46c2('0x1b')]=qs['offset'](_0x570463[_0x46c2('0x2e')][_0x46c2('0x1b')]);}_0x484f28[_0x46c2('0x34')]=qs['sort'](_0x570463[_0x46c2('0x2e')]['sort']);_0x484f28[_0x46c2('0x35')]=qs['filters'](_[_0x46c2('0x36')](_0x570463[_0x46c2('0x2e')],_0x43be38['filters']),_0x1a6bdd);if(_0x570463[_0x46c2('0x2e')]['filter']){_0x484f28[_0x46c2('0x35')]=_[_0x46c2('0x37')](_0x484f28[_0x46c2('0x35')],{'$or':_[_0x46c2('0x29')](_0x1a6bdd,function(_0x6f91a9){if(_0x6f91a9[_0x46c2('0x2b')]!==_0x46c2('0x38')){var _0x390dde={};_0x390dde[_0x6f91a9[_0x46c2('0x27')]]={'$like':'%'+_0x570463[_0x46c2('0x2e')][_0x46c2('0x39')]+'%'};return _0x390dde;}})});}_0x484f28=_['merge']({},_0x484f28,_0x570463['options']);var _0x584d3a={'where':_0x484f28[_0x46c2('0x35')]};return db[_0x46c2('0x3a')][_0x46c2('0x1e')](_0x584d3a)[_0x46c2('0x25')](function(_0x1a63d4){_0x548118[_0x46c2('0x1e')]=_0x1a63d4;if(_0x570463[_0x46c2('0x2e')]['includeAll']){_0x484f28[_0x46c2('0x3b')]=[{'all':!![]}];}return db[_0x46c2('0x3a')][_0x46c2('0x3c')](_0x484f28);})[_0x46c2('0x25')](function(_0x52c1d2){_0x548118[_0x46c2('0x3d')]=_0x52c1d2;return _0x548118;})['then'](respondWithFilteredResult(_0x39b413,_0x484f28))[_0x46c2('0x3e')](handleError(_0x39b413,null));};exports[_0x46c2('0x3f')]=function(_0x31f624,_0x2c365b){var _0x1a8619={'raw':!![],'where':{'id':_0x31f624[_0x46c2('0x40')]['id']}},_0x3e360a={};_0x3e360a[_0x46c2('0x2d')]=_['keys'](db[_0x46c2('0x3a')]['rawAttributes']);_0x3e360a['query']=_[_0x46c2('0x2f')](_0x31f624[_0x46c2('0x2e')]);_0x3e360a[_0x46c2('0x41')]=_[_0x46c2('0x42')](_0x3e360a[_0x46c2('0x2d')],_0x3e360a[_0x46c2('0x2e')]);_0x1a8619[_0x46c2('0x30')]=_['intersection'](_0x3e360a[_0x46c2('0x2d')],qs['fields'](_0x31f624[_0x46c2('0x2e')]['fields']));_0x1a8619['attributes']=_0x1a8619[_0x46c2('0x30')][_0x46c2('0x32')]?_0x1a8619[_0x46c2('0x30')]:_0x3e360a[_0x46c2('0x2d')];if(_0x31f624[_0x46c2('0x2e')][_0x46c2('0x43')]){_0x1a8619['include']=[{'all':!![]}];}_0x1a8619=_[_0x46c2('0x37')]({},_0x1a8619,_0x31f624[_0x46c2('0x44')]);return db['FaxApplication']['find'](_0x1a8619)[_0x46c2('0x25')](handleEntityNotFound(_0x2c365b,null))[_0x46c2('0x25')](respondWithResult(_0x2c365b,null))[_0x46c2('0x3e')](handleError(_0x2c365b,null));};exports[_0x46c2('0x45')]=function(_0x249e3c,_0x4e66cf){return db[_0x46c2('0x3a')][_0x46c2('0x45')](_0x249e3c[_0x46c2('0x46')],{})['then'](respondWithResult(_0x4e66cf,0xc9))['catch'](handleError(_0x4e66cf,null));};exports[_0x46c2('0x23')]=function(_0x48adc8,_0x22255e){if(_0x48adc8['body']['id']){delete _0x48adc8[_0x46c2('0x46')]['id'];}return db[_0x46c2('0x3a')]['find']({'where':{'id':_0x48adc8[_0x46c2('0x40')]['id']}})[_0x46c2('0x25')](handleEntityNotFound(_0x22255e,null))[_0x46c2('0x25')](saveUpdates(_0x48adc8['body'],null))[_0x46c2('0x25')](respondWithResult(_0x22255e,null))['catch'](handleError(_0x22255e,null));};exports[_0x46c2('0x24')]=function(_0x360bd8,_0x37015a){return db['FaxApplication'][_0x46c2('0x47')]({'where':{'id':_0x360bd8['params']['id']}})[_0x46c2('0x25')](handleEntityNotFound(_0x37015a,null))['then'](removeEntity(_0x37015a,null))[_0x46c2('0x3e')](handleError(_0x37015a,null));}; \ No newline at end of file +var _0xb0d7=['merge','includeAll','include','findAll','catch','show','params','options','find','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x260b5a,_0x486d31){var _0x2012ff=function(_0x402495){while(--_0x402495){_0x260b5a['push'](_0x260b5a['shift']());}};_0x2012ff(++_0x486d31);}(_0xb0d7,0x9e));var _0x7b0d=function(_0x353c6c,_0x50ee43){_0x353c6c=_0x353c6c-0x0;var _0x521e15=_0xb0d7[_0x353c6c];return _0x521e15;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7b0d('0x0'));var jsonpatch=require(_0x7b0d('0x1'));var rp=require(_0x7b0d('0x2'));var moment=require(_0x7b0d('0x3'));var BPromise=require(_0x7b0d('0x4'));var Mustache=require(_0x7b0d('0x5'));var util=require('util');var path=require(_0x7b0d('0x6'));var sox=require(_0x7b0d('0x7'));var csv=require(_0x7b0d('0x8'));var ejs=require(_0x7b0d('0x9'));var fs=require('fs');var fs_extra=require(_0x7b0d('0xa'));var _=require(_0x7b0d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7b0d('0x8'));var querystring=require(_0x7b0d('0xd'));var Papa=require(_0x7b0d('0xe'));var Redis=require(_0x7b0d('0xf'));var authService=require(_0x7b0d('0x10'));var qs=require(_0x7b0d('0x11'));var as=require(_0x7b0d('0x12'));var hardwareService=require(_0x7b0d('0x13'));var logger=require(_0x7b0d('0x14'))('api');var utils=require(_0x7b0d('0x15'));var config=require(_0x7b0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b0d('0x17'))['db'];function respondWithStatusCode(_0x4bddf4,_0x1c4112){_0x1c4112=_0x1c4112||0xcc;return function(_0x327650){if(_0x327650){return _0x4bddf4[_0x7b0d('0x18')](_0x1c4112);}return _0x4bddf4[_0x7b0d('0x19')](_0x1c4112)[_0x7b0d('0x1a')]();};}function respondWithResult(_0x15ff66,_0x49eaa7){_0x49eaa7=_0x49eaa7||0xc8;return function(_0x57e619){if(_0x57e619){return _0x15ff66[_0x7b0d('0x19')](_0x49eaa7)['json'](_0x57e619);}};}function respondWithFilteredResult(_0x172d3d,_0x4f18f6){return function(_0x32bd24){if(_0x32bd24){var _0x354f00=typeof _0x4f18f6[_0x7b0d('0x1b')]===_0x7b0d('0x1c')&&typeof _0x4f18f6[_0x7b0d('0x1d')]===_0x7b0d('0x1c');var _0x138cf4=_0x32bd24[_0x7b0d('0x1e')];var _0x41e2bd=_0x354f00?0x0:_0x4f18f6[_0x7b0d('0x1b')];var _0x29022a=_0x354f00?_0x32bd24['count']:_0x4f18f6[_0x7b0d('0x1b')]+_0x4f18f6[_0x7b0d('0x1d')];var _0x405018;if(_0x29022a>=_0x138cf4){_0x29022a=_0x138cf4;_0x405018=0xc8;}else{_0x405018=0xce;}_0x172d3d[_0x7b0d('0x19')](_0x405018);return _0x172d3d[_0x7b0d('0x1f')]('Content-Range',_0x41e2bd+'-'+_0x29022a+'/'+_0x138cf4)[_0x7b0d('0x20')](_0x32bd24);}return null;};}function patchUpdates(_0x56d0d7){return function(_0x5814f5){try{jsonpatch['apply'](_0x5814f5,_0x56d0d7,!![]);}catch(_0x3305b6){return BPromise['reject'](_0x3305b6);}return _0x5814f5[_0x7b0d('0x21')]();};}function saveUpdates(_0x325036,_0x55470f){return function(_0x4ec327){if(_0x4ec327){return _0x4ec327['update'](_0x325036)[_0x7b0d('0x22')](function(_0x5203cd){return _0x5203cd;});}return null;};}function removeEntity(_0x319dee,_0xc70175){return function(_0x2f5e03){if(_0x2f5e03){return _0x2f5e03[_0x7b0d('0x23')]()[_0x7b0d('0x22')](function(){_0x319dee['status'](0xcc)[_0x7b0d('0x1a')]();});}};}function handleEntityNotFound(_0x181c1d,_0x937c73){return function(_0x1b1700){if(!_0x1b1700){_0x181c1d[_0x7b0d('0x18')](0x194);}return _0x1b1700;};}function handleError(_0x262443,_0x3d894b){_0x3d894b=_0x3d894b||0x1f4;return function(_0xd1fb86){logger[_0x7b0d('0x24')](_0xd1fb86[_0x7b0d('0x25')]);if(_0xd1fb86[_0x7b0d('0x26')]){delete _0xd1fb86[_0x7b0d('0x26')];}_0x262443['status'](_0x3d894b)[_0x7b0d('0x27')](_0xd1fb86);};}exports[_0x7b0d('0x28')]=function(_0xdbfe61,_0x285e70){var _0x19d72b={},_0x573411={},_0x5f86aa={'count':0x0,'rows':[]};var _0x3a06ce=_[_0x7b0d('0x29')](db[_0x7b0d('0x2a')][_0x7b0d('0x2b')],function(_0x205120){return{'name':_0x205120[_0x7b0d('0x2c')],'type':_0x205120[_0x7b0d('0x2d')][_0x7b0d('0x2e')]};});_0x573411[_0x7b0d('0x2f')]=_[_0x7b0d('0x29')](_0x3a06ce,'name');_0x573411[_0x7b0d('0x30')]=_[_0x7b0d('0x31')](_0xdbfe61[_0x7b0d('0x30')]);_0x573411[_0x7b0d('0x32')]=_[_0x7b0d('0x33')](_0x573411[_0x7b0d('0x2f')],_0x573411[_0x7b0d('0x30')]);_0x19d72b[_0x7b0d('0x34')]=_['intersection'](_0x573411[_0x7b0d('0x2f')],qs[_0x7b0d('0x35')](_0xdbfe61[_0x7b0d('0x30')][_0x7b0d('0x35')]));_0x19d72b['attributes']=_0x19d72b[_0x7b0d('0x34')][_0x7b0d('0x36')]?_0x19d72b['attributes']:_0x573411[_0x7b0d('0x2f')];if(!_0xdbfe61[_0x7b0d('0x30')][_0x7b0d('0x37')]('nolimit')){_0x19d72b[_0x7b0d('0x1d')]=qs[_0x7b0d('0x1d')](_0xdbfe61['query'][_0x7b0d('0x1d')]);_0x19d72b['offset']=qs[_0x7b0d('0x1b')](_0xdbfe61['query'][_0x7b0d('0x1b')]);}_0x19d72b[_0x7b0d('0x38')]=qs[_0x7b0d('0x39')](_0xdbfe61[_0x7b0d('0x30')][_0x7b0d('0x39')]);_0x19d72b['where']=qs[_0x7b0d('0x32')](_[_0x7b0d('0x3a')](_0xdbfe61[_0x7b0d('0x30')],_0x573411[_0x7b0d('0x32')]),_0x3a06ce);if(_0xdbfe61[_0x7b0d('0x30')][_0x7b0d('0x3b')]){_0x19d72b[_0x7b0d('0x3c')]=_[_0x7b0d('0x3d')](_0x19d72b[_0x7b0d('0x3c')],{'$or':_[_0x7b0d('0x29')](_0x3a06ce,function(_0x167b69){if(_0x167b69[_0x7b0d('0x2d')]!=='VIRTUAL'){var _0x14af66={};_0x14af66[_0x167b69[_0x7b0d('0x26')]]={'$like':'%'+_0xdbfe61['query'][_0x7b0d('0x3b')]+'%'};return _0x14af66;}})});}_0x19d72b=_[_0x7b0d('0x3d')]({},_0x19d72b,_0xdbfe61['options']);var _0x38148d={'where':_0x19d72b[_0x7b0d('0x3c')]};return db[_0x7b0d('0x2a')][_0x7b0d('0x1e')](_0x38148d)[_0x7b0d('0x22')](function(_0x7761a){_0x5f86aa[_0x7b0d('0x1e')]=_0x7761a;if(_0xdbfe61[_0x7b0d('0x30')][_0x7b0d('0x3e')]){_0x19d72b[_0x7b0d('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x7b0d('0x40')](_0x19d72b);})['then'](function(_0x3f787d){_0x5f86aa['rows']=_0x3f787d;return _0x5f86aa;})[_0x7b0d('0x22')](respondWithFilteredResult(_0x285e70,_0x19d72b))[_0x7b0d('0x41')](handleError(_0x285e70,null));};exports[_0x7b0d('0x42')]=function(_0x31f596,_0x2f7463){var _0x25a5d8={'raw':!![],'where':{'id':_0x31f596[_0x7b0d('0x43')]['id']}},_0x8686e0={};_0x8686e0['model']=_[_0x7b0d('0x31')](db[_0x7b0d('0x2a')][_0x7b0d('0x2b')]);_0x8686e0[_0x7b0d('0x30')]=_[_0x7b0d('0x31')](_0x31f596[_0x7b0d('0x30')]);_0x8686e0[_0x7b0d('0x32')]=_[_0x7b0d('0x33')](_0x8686e0['model'],_0x8686e0[_0x7b0d('0x30')]);_0x25a5d8[_0x7b0d('0x34')]=_[_0x7b0d('0x33')](_0x8686e0[_0x7b0d('0x2f')],qs['fields'](_0x31f596[_0x7b0d('0x30')][_0x7b0d('0x35')]));_0x25a5d8[_0x7b0d('0x34')]=_0x25a5d8[_0x7b0d('0x34')][_0x7b0d('0x36')]?_0x25a5d8[_0x7b0d('0x34')]:_0x8686e0['model'];if(_0x31f596[_0x7b0d('0x30')][_0x7b0d('0x3e')]){_0x25a5d8[_0x7b0d('0x3f')]=[{'all':!![]}];}_0x25a5d8=_[_0x7b0d('0x3d')]({},_0x25a5d8,_0x31f596[_0x7b0d('0x44')]);return db['FaxApplication'][_0x7b0d('0x45')](_0x25a5d8)['then'](handleEntityNotFound(_0x2f7463,null))['then'](respondWithResult(_0x2f7463,null))[_0x7b0d('0x41')](handleError(_0x2f7463,null));};exports[_0x7b0d('0x46')]=function(_0x2fb08d,_0x5d7508){return db[_0x7b0d('0x2a')][_0x7b0d('0x46')](_0x2fb08d[_0x7b0d('0x47')],{})[_0x7b0d('0x22')](respondWithResult(_0x5d7508,0xc9))['catch'](handleError(_0x5d7508,null));};exports[_0x7b0d('0x48')]=function(_0x3ac860,_0x537074){if(_0x3ac860[_0x7b0d('0x47')]['id']){delete _0x3ac860[_0x7b0d('0x47')]['id'];}return db[_0x7b0d('0x2a')][_0x7b0d('0x45')]({'where':{'id':_0x3ac860[_0x7b0d('0x43')]['id']}})['then'](handleEntityNotFound(_0x537074,null))[_0x7b0d('0x22')](saveUpdates(_0x3ac860['body'],null))[_0x7b0d('0x22')](respondWithResult(_0x537074,null))[_0x7b0d('0x41')](handleError(_0x537074,null));};exports[_0x7b0d('0x23')]=function(_0x31cdcf,_0x44b0ba){return db[_0x7b0d('0x2a')][_0x7b0d('0x45')]({'where':{'id':_0x31cdcf[_0x7b0d('0x43')]['id']}})[_0x7b0d('0x22')](handleEntityNotFound(_0x44b0ba,null))['then'](removeEntity(_0x44b0ba,null))[_0x7b0d('0x41')](handleError(_0x44b0ba,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1e0adab..0daab19 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 _0xc520=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4'];(function(_0xe114c1,_0x2df9df){var _0x330ec3=function(_0x32619e){while(--_0x32619e){_0xe114c1['push'](_0xe114c1['shift']());}};_0x330ec3(++_0x2df9df);}(_0xc520,0x171));var _0x0c52=function(_0x53929e,_0x537d05){_0x53929e=_0x53929e-0x0;var _0x17d419=_0xc520[_0x53929e];return _0x17d419;};'use strict';var _=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var logger=require(_0x0c52('0x2'))(_0x0c52('0x3'));var moment=require(_0x0c52('0x4'));var BPromise=require(_0x0c52('0x5'));var rp=require(_0x0c52('0x6'));var fs=require('fs');var path=require(_0x0c52('0x7'));var rimraf=require(_0x0c52('0x8'));var config=require(_0x0c52('0x9'));var attributes=require(_0x0c52('0xa'));module[_0x0c52('0xb')]=function(_0x51e15e,_0x114bb5){return _0x51e15e['define'](_0x0c52('0xc'),attributes,{'tableName':_0x0c52('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0c52('0xe'),'collate':_0x0c52('0xf')});}; \ No newline at end of file +var _0x60a0=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0x60a0,0x14d));var _0x060a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x060a('0x0'));var util=require(_0x060a('0x1'));var logger=require('../../config/logger')(_0x060a('0x2'));var moment=require(_0x060a('0x3'));var BPromise=require('bluebird');var rp=require(_0x060a('0x4'));var fs=require('fs');var path=require(_0x060a('0x5'));var rimraf=require(_0x060a('0x6'));var config=require(_0x060a('0x7'));var attributes=require(_0x060a('0x8'));module[_0x060a('0x9')]=function(_0x264249,_0x732d49){return _0x264249['define'](_0x060a('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x060a('0xb'),'collate':_0x060a('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 3fd9bae..d56324e 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 _0xf301=['client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf301,0x181));var _0x1f30=function(_0x1a3e89,_0x1ffa63){_0x1a3e89=_0x1a3e89-0x0;var _0xd2d47b=_0xf301[_0x1a3e89];return _0xd2d47b;};'use strict';var _=require(_0x1f30('0x0'));var util=require(_0x1f30('0x1'));var moment=require(_0x1f30('0x2'));var BPromise=require(_0x1f30('0x3'));var rs=require(_0x1f30('0x4'));var fs=require('fs');var Redis=require(_0x1f30('0x5'));var db=require(_0x1f30('0x6'))['db'];var utils=require(_0x1f30('0x7'));var logger=require(_0x1f30('0x8'))(_0x1f30('0x9'));var config=require('../../config/environment');var jayson=require(_0x1f30('0xa'));var client=jayson[_0x1f30('0xb')][_0x1f30('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x362942,_0x176c49,_0x133b53){return new BPromise(function(_0xd51da4,_0x301894){return client['request'](_0x362942,_0x133b53)[_0x1f30('0xd')](function(_0x34be96){logger['info'](_0x1f30('0xe'),_0x176c49,_0x1f30('0xf'));logger[_0x1f30('0x10')](_0x1f30('0x11'),_0x176c49,_0x1f30('0xf'),JSON['stringify'](_0x34be96));if(_0x34be96[_0x1f30('0x12')]){if(_0x34be96['error'][_0x1f30('0x13')]===0x1f4){logger[_0x1f30('0x12')](_0x1f30('0xe'),_0x176c49,_0x34be96['error'][_0x1f30('0x14')]);return _0x301894(_0x34be96[_0x1f30('0x12')][_0x1f30('0x14')]);}logger[_0x1f30('0x12')](_0x1f30('0xe'),_0x176c49,_0x34be96['error'][_0x1f30('0x14')]);return _0xd51da4(_0x34be96[_0x1f30('0x12')][_0x1f30('0x14')]);}else{logger[_0x1f30('0x15')](_0x1f30('0xe'),_0x176c49,_0x1f30('0xf'));_0xd51da4(_0x34be96[_0x1f30('0x16')][_0x1f30('0x14')]);}})[_0x1f30('0x17')](function(_0x25db9c){logger[_0x1f30('0x12')](_0x1f30('0xe'),_0x176c49,_0x25db9c);_0x301894(_0x25db9c);});});}exports['UpdateFaxApplication']=function(_0x4fe7a8){var _0x32c11e=this;return new Promise(function(_0x425548,_0x46dc34){return db['FaxApplication'][_0x1f30('0x18')](_0x4fe7a8[_0x1f30('0x19')],{'raw':_0x4fe7a8[_0x1f30('0x1a')]?_0x4fe7a8[_0x1f30('0x1a')][_0x1f30('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe7a8[_0x1f30('0x1a')]?_0x4fe7a8['options'][_0x1f30('0x1c')]||null:null,'attributes':_0x4fe7a8['options']?_0x4fe7a8[_0x1f30('0x1a')][_0x1f30('0x1d')]||null:null,'limit':_0x4fe7a8[_0x1f30('0x1a')]?_0x4fe7a8['options'][_0x1f30('0x1e')]||null:null})['then'](function(_0x57f4b8){logger[_0x1f30('0x15')](_0x1f30('0x1f'),_0x4fe7a8);logger[_0x1f30('0x10')](_0x1f30('0x1f'),_0x4fe7a8,JSON[_0x1f30('0x20')](_0x57f4b8));_0x425548(_0x57f4b8);})[_0x1f30('0x17')](function(_0x418051){logger[_0x1f30('0x12')](_0x1f30('0x1f'),_0x418051['message'],_0x4fe7a8);_0x46dc34(_0x32c11e['error'](0x1f4,_0x418051[_0x1f30('0x14')]));});});}; \ No newline at end of file +var _0x6ed4=['message','result','catch','UpdateFaxApplication','update','options','raw','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x6ed4,0x99));var _0x46ed=function(_0x30343,_0x408e11){_0x30343=_0x30343-0x0;var _0x197a2e=_0x6ed4[_0x30343];return _0x197a2e;};'use strict';var _=require(_0x46ed('0x0'));var util=require(_0x46ed('0x1'));var moment=require(_0x46ed('0x2'));var BPromise=require(_0x46ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46ed('0x5'));var logger=require(_0x46ed('0x6'))(_0x46ed('0x7'));var config=require(_0x46ed('0x8'));var jayson=require(_0x46ed('0x9'));var client=jayson[_0x46ed('0xa')][_0x46ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x285171,_0x4b1899,_0x3daaf2){return new BPromise(function(_0x228d4a,_0x523d2d){return client['request'](_0x285171,_0x3daaf2)[_0x46ed('0xc')](function(_0x38f781){logger[_0x46ed('0xd')](_0x46ed('0xe'),_0x4b1899,'request\x20sent');logger[_0x46ed('0xf')](_0x46ed('0x10'),_0x4b1899,_0x46ed('0x11'),JSON[_0x46ed('0x12')](_0x38f781));if(_0x38f781[_0x46ed('0x13')]){if(_0x38f781[_0x46ed('0x13')][_0x46ed('0x14')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b1899,_0x38f781[_0x46ed('0x13')][_0x46ed('0x15')]);return _0x523d2d(_0x38f781['error']['message']);}logger[_0x46ed('0x13')]('FaxApplication,\x20%s,\x20%s',_0x4b1899,_0x38f781['error'][_0x46ed('0x15')]);return _0x228d4a(_0x38f781[_0x46ed('0x13')][_0x46ed('0x15')]);}else{logger[_0x46ed('0xd')](_0x46ed('0xe'),_0x4b1899,_0x46ed('0x11'));_0x228d4a(_0x38f781[_0x46ed('0x16')][_0x46ed('0x15')]);}})[_0x46ed('0x17')](function(_0x19d85e){logger[_0x46ed('0x13')]('FaxApplication,\x20%s,\x20%s',_0x4b1899,_0x19d85e);_0x523d2d(_0x19d85e);});});}exports[_0x46ed('0x18')]=function(_0x1fd17e){var _0x44d50a=this;return new Promise(function(_0x53903e,_0x1a5aa2){return db['FaxApplication'][_0x46ed('0x19')](_0x1fd17e['body'],{'raw':_0x1fd17e[_0x46ed('0x1a')]?_0x1fd17e[_0x46ed('0x1a')][_0x46ed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd17e[_0x46ed('0x1a')]?_0x1fd17e[_0x46ed('0x1a')][_0x46ed('0x1c')]||null:null,'attributes':_0x1fd17e[_0x46ed('0x1a')]?_0x1fd17e[_0x46ed('0x1a')]['attributes']||null:null,'limit':_0x1fd17e[_0x46ed('0x1a')]?_0x1fd17e[_0x46ed('0x1a')]['limit']||null:null})[_0x46ed('0xc')](function(_0x26726){logger[_0x46ed('0xd')](_0x46ed('0x18'),_0x1fd17e);logger['debug'](_0x46ed('0x18'),_0x1fd17e,JSON['stringify'](_0x26726));_0x53903e(_0x26726);})[_0x46ed('0x17')](function(_0x8a14df){logger[_0x46ed('0x13')](_0x46ed('0x18'),_0x8a14df[_0x46ed('0x15')],_0x1fd17e);_0x1a5aa2(_0x44d50a['error'](0x1f4,_0x8a14df['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e45d14d..0531596 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 _0x7708=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x33f2db,_0x4ad4fa){var _0x5bb44b=function(_0x3cc4c5){while(--_0x3cc4c5){_0x33f2db['push'](_0x33f2db['shift']());}};_0x5bb44b(++_0x4ad4fa);}(_0x7708,0x188));var _0x8770=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x7708[_0x18b5e8];return _0x25baed;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./faxApplication.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0xa')]('/',auth[_0x8770('0x8')](),controller['create']);router[_0x8770('0xb')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller['update']);router[_0x8770('0xc')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0xd')]);module['exports']=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x163064,_0x15d0d5){var _0x96524d=function(_0x5ec895){while(--_0x5ec895){_0x163064['push'](_0x163064['shift']());}};_0x96524d(++_0x15d0d5);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c92fc23..420d149 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 _0xf323=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xf323,0x8b));var _0x3f32=function(_0x3370f5,_0x110beb){_0x3370f5=_0x3370f5-0x0;var _0x350001=_0xf323[_0x3370f5];return _0x350001;};'use strict';var Sequelize=require(_0x3f32('0x0'));module[_0x3f32('0x1')]={'closed':{'type':Sequelize[_0x3f32('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3f32('0x3')]},'disposition':{'type':Sequelize[_0x3f32('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3f32('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3f32('0x3')]},'fax':{'type':Sequelize[_0x3f32('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f32('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3f32('0x5')]('in',_0x3f32('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x10e6=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x371e19,_0x477a42){var _0x5b5edb=function(_0x519cd5){while(--_0x519cd5){_0x371e19['push'](_0x371e19['shift']());}};_0x5b5edb(++_0x477a42);}(_0x10e6,0xb9));var _0x610e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x10e6[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x610e('0x0'));module[_0x610e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x610e('0x2')]},'disposition':{'type':Sequelize[_0x610e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x610e('0x3')]},'read1stAt':{'type':Sequelize[_0x610e('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x610e('0x4')]('in',_0x610e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x610e('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 3cf9e83..2ce1c3a 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 _0x73fa=['describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','include','addTags','setTags','Tag','removeTags','download','unix','toString','root','server','tmp','join','files','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','unlinkSync','rimraf','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','params'];(function(_0x4384bc,_0x127955){var _0x18e558=function(_0x40e7db){while(--_0x40e7db){_0x4384bc['push'](_0x4384bc['shift']());}};_0x18e558(++_0x127955);}(_0x73fa,0x8e));var _0xa73f=function(_0x1062e3,_0x49349e){_0x1062e3=_0x1062e3-0x0;var _0x92e616=_0x73fa[_0x1062e3];return _0x92e616;};'use strict';var rimraf=require(_0xa73f('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xa73f('0x1'));var util=require(_0xa73f('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xa73f('0x3'));var Redis=require(_0xa73f('0x4'));var interaction=require(_0xa73f('0x5'));var qs=require(_0xa73f('0x6'));var logger=require(_0xa73f('0x7'))(_0xa73f('0x8'));var config=require(_0xa73f('0x9'));var db=require(_0xa73f('0xa'))['db'];config[_0xa73f('0xb')]=_[_0xa73f('0xc')](config[_0xa73f('0xb')],{'host':_0xa73f('0xd'),'port':0x18eb});var socket=require(_0xa73f('0xe'))(new Redis(config[_0xa73f('0xb')]));require('./faxInteraction.socket')[_0xa73f('0xf')](socket);function respondWithStatusCode(_0x1494b1,_0x10757e){_0x10757e=_0x10757e||0xcc;return function(_0x45576d){if(_0x45576d){return _0x1494b1[_0xa73f('0x10')](_0x10757e);}return _0x1494b1[_0xa73f('0x11')](_0x10757e)[_0xa73f('0x12')]();};}function respondWithResult(_0x21ad51,_0x326bc6){_0x326bc6=_0x326bc6||0xc8;return function(_0x47e8aa){if(_0x47e8aa){return _0x21ad51[_0xa73f('0x11')](_0x326bc6)[_0xa73f('0x13')](_0x47e8aa);}};}function respondWithFilteredResult(_0x4efc5e,_0x29c0f0){return function(_0x51b4f2){if(_0x51b4f2){var _0x352262=typeof _0x29c0f0[_0xa73f('0x14')]===_0xa73f('0x15')&&typeof _0x29c0f0[_0xa73f('0x16')]===_0xa73f('0x15');var _0x438317=_0x51b4f2['count'];var _0x1ddf63=_0x352262?0x0:_0x29c0f0[_0xa73f('0x14')];var _0x39e3a6=_0x352262?_0x51b4f2['count']:_0x29c0f0[_0xa73f('0x14')]+_0x29c0f0['limit'];var _0x1354eb;if(_0x39e3a6>=_0x438317){_0x39e3a6=_0x438317;_0x1354eb=0xc8;}else{_0x1354eb=0xce;}_0x4efc5e[_0xa73f('0x11')](_0x1354eb);return _0x4efc5e[_0xa73f('0x17')](_0xa73f('0x18'),_0x1ddf63+'-'+_0x39e3a6+'/'+_0x438317)[_0xa73f('0x13')](_0x51b4f2);}return null;};}function saveUpdates(_0x23e426){return function(_0x55d91f){if(_0x55d91f){return _0x55d91f[_0xa73f('0x19')](_0x23e426)[_0xa73f('0x1a')](function(_0x420094){return _0x420094;});}return null;};}function removeEntity(_0x55befe){return function(_0x27e633){if(_0x27e633){return _0x27e633[_0xa73f('0x1b')]()['then'](function(){_0x55befe[_0xa73f('0x11')](0xcc)[_0xa73f('0x12')]();});}};}function handleEntityNotFound(_0x3facf4){return function(_0x4a4ae0){if(!_0x4a4ae0){_0x3facf4[_0xa73f('0x10')](0x194);}return _0x4a4ae0;};}function handleError(_0x6a1b99,_0x2791ab){_0x2791ab=_0x2791ab||0x1f4;return function(_0x1d66f1){logger['error'](_0x1d66f1[_0xa73f('0x1c')]);if(_0x1d66f1['name']){delete _0x1d66f1[_0xa73f('0x1d')];}_0x6a1b99[_0xa73f('0x11')](_0x2791ab)[_0xa73f('0x1e')](_0x1d66f1);};}exports[_0xa73f('0x1f')]=function(_0x366884,_0x54f08a){var _0x37f111={};var _0x58f5e0=_[_0xa73f('0x20')](db[_0xa73f('0x21')][_0xa73f('0x22')],function(_0x50f31d){return{'name':_0x50f31d[_0xa73f('0x23')],'type':_0x50f31d[_0xa73f('0x24')]['key']};});_0x37f111=qs[_0xa73f('0x25')](_0x58f5e0,_0x366884);return interaction[_0xa73f('0x26')](_0xa73f('0x27'),_0x366884[_0xa73f('0x28')],_0x366884[_0xa73f('0x29')],_0x37f111,_0x58f5e0)[_0xa73f('0x1a')](respondWithFilteredResult(_0x54f08a,_0x37f111))[_0xa73f('0x2a')](handleError(_0x54f08a,null));};exports[_0xa73f('0x2b')]=function(_0x44f3c9,_0x4759f1){var _0x3804d4={'raw':![],'where':{'id':_0x44f3c9['params']['id']}},_0x5bc9c2={};_0x5bc9c2[_0xa73f('0x2c')]=_[_0xa73f('0x2d')](db[_0xa73f('0x21')][_0xa73f('0x22')]);_0x5bc9c2['query']=_['keys'](_0x44f3c9[_0xa73f('0x28')]);_0x5bc9c2[_0xa73f('0x2e')]=_[_0xa73f('0x2f')](_0x5bc9c2['model'],_0x5bc9c2[_0xa73f('0x28')]);_0x3804d4[_0xa73f('0x30')]=_[_0xa73f('0x2f')](_0x5bc9c2['model'],qs['fields'](_0x44f3c9['query'][_0xa73f('0x31')]));_0x3804d4[_0xa73f('0x30')]=_0x3804d4[_0xa73f('0x30')][_0xa73f('0x32')]?_0x3804d4[_0xa73f('0x30')]:_0x5bc9c2[_0xa73f('0x2c')];if(_0x44f3c9[_0xa73f('0x28')][_0xa73f('0x33')]){_0x3804d4['include']=[{'all':!![]}];}_0x3804d4=_[_0xa73f('0x34')]({},_0x3804d4,_0x44f3c9[_0xa73f('0x35')]);return db[_0xa73f('0x21')][_0xa73f('0x36')](_0x3804d4)[_0xa73f('0x1a')](handleEntityNotFound(_0x4759f1,null))['then'](respondWithResult(_0x4759f1,null))[_0xa73f('0x2a')](handleError(_0x4759f1,null));};exports[_0xa73f('0x37')]=function(_0x2984a8,_0x5cd282){return db[_0xa73f('0x21')][_0xa73f('0x37')](_0x2984a8[_0xa73f('0x38')],{})[_0xa73f('0x1a')](respondWithResult(_0x5cd282,0xc9))[_0xa73f('0x2a')](handleError(_0x5cd282,null));};exports[_0xa73f('0x19')]=function(_0x37a412,_0x1fb7d2){if(_0x37a412['body']['id']){delete _0x37a412[_0xa73f('0x38')]['id'];}return db[_0xa73f('0x21')][_0xa73f('0x36')]({'where':{'id':_0x37a412[_0xa73f('0x39')]['id']}})[_0xa73f('0x1a')](handleEntityNotFound(_0x1fb7d2,null))['then'](saveUpdates(_0x37a412[_0xa73f('0x38')],null))[_0xa73f('0x1a')](respondWithResult(_0x1fb7d2,null))[_0xa73f('0x2a')](handleError(_0x1fb7d2,null));};exports[_0xa73f('0x1b')]=function(_0x39292a,_0x127af9){return db[_0xa73f('0x21')]['find']({'where':{'id':_0x39292a[_0xa73f('0x39')]['id']}})['then'](handleEntityNotFound(_0x127af9,null))['then'](removeEntity(_0x127af9,null))[_0xa73f('0x2a')](handleError(_0x127af9,null));};exports['describe']=function(_0x4b0b6d,_0x4fd1a8){return db[_0xa73f('0x21')][_0xa73f('0x3a')]()[_0xa73f('0x1a')](respondWithResult(_0x4fd1a8,null))[_0xa73f('0x2a')](handleError(_0x4fd1a8,null));};exports[_0xa73f('0x3b')]=function(_0xda0561,_0x905430){return db[_0xa73f('0x3c')][_0xa73f('0x36')]({'where':{'id':_0xda0561[_0xa73f('0x39')]['id']}})[_0xa73f('0x1a')](handleEntityNotFound(_0x905430,null))[_0xa73f('0x1a')](function(_0x45e342){if(_0x45e342){return _0x45e342['addMessage'](_0xda0561[_0xa73f('0x38')]['ids'],_['omit'](_0xda0561[_0xa73f('0x38')],[_0xa73f('0x3d'),'id'])||{});}})[_0xa73f('0x1a')](respondWithResult(_0x905430,null))[_0xa73f('0x2a')](handleError(_0x905430,null));};exports['getMessages']=function(_0x39dba9,_0x1d7476){var _0x5c4de2={'raw':![],'where':{}};var _0x127937={};var _0x41a2e6={'count':0x0,'rows':[]};return db[_0xa73f('0x21')][_0xa73f('0x3e')]({'where':{'id':_0x39dba9[_0xa73f('0x39')]['id']}})[_0xa73f('0x1a')](handleEntityNotFound(_0x1d7476,null))[_0xa73f('0x1a')](function(_0x39d640){if(_0x39d640){_0x127937[_0xa73f('0x2c')]=_[_0xa73f('0x2d')](db[_0xa73f('0x3c')][_0xa73f('0x22')]);_0x127937['query']=_[_0xa73f('0x2d')](_0x39dba9[_0xa73f('0x28')]);_0x127937[_0xa73f('0x2e')]=_[_0xa73f('0x2f')](_0x127937[_0xa73f('0x2c')],_0x127937[_0xa73f('0x28')]);_0x5c4de2[_0xa73f('0x30')]=_[_0xa73f('0x2f')](_0x127937[_0xa73f('0x2c')],qs[_0xa73f('0x31')](_0x39dba9[_0xa73f('0x28')][_0xa73f('0x31')]));_0x5c4de2[_0xa73f('0x30')]=_0x5c4de2[_0xa73f('0x30')][_0xa73f('0x32')]?_0x5c4de2[_0xa73f('0x30')]:_0x127937[_0xa73f('0x2c')];if(!_0x39dba9[_0xa73f('0x28')][_0xa73f('0x3f')](_0xa73f('0x40'))){_0x5c4de2[_0xa73f('0x16')]=qs['limit'](_0x39dba9[_0xa73f('0x28')][_0xa73f('0x16')]);_0x5c4de2[_0xa73f('0x14')]=qs[_0xa73f('0x14')](_0x39dba9['query'][_0xa73f('0x14')]);}_0x5c4de2[_0xa73f('0x41')]=qs[_0xa73f('0x42')](_0x39dba9[_0xa73f('0x28')][_0xa73f('0x42')]);_0x5c4de2[_0xa73f('0x43')]=qs[_0xa73f('0x2e')](_['pick'](_0x39dba9[_0xa73f('0x28')],_0x127937[_0xa73f('0x2e')]));_0x5c4de2[_0xa73f('0x43')]['FaxInteractionId']=_0x39d640['id'];if(_0x39dba9['query'][_0xa73f('0x44')]){_0x5c4de2[_0xa73f('0x43')]=_['merge'](_0x5c4de2[_0xa73f('0x43')],{'$or':_[_0xa73f('0x20')](_0x5c4de2[_0xa73f('0x30')],function(_0x899551){var _0x5b025c={};_0x5b025c[_0x899551]={'$like':'%'+_0x39dba9['query'][_0xa73f('0x44')]+'%'};return _0x5b025c;})});}if(_0x39dba9[_0xa73f('0x28')][_0xa73f('0x45')]){var _0x206bc8=_0x39dba9['query'][_0xa73f('0x45')][_0xa73f('0x46')](',');var _0x49b9ea={};_0x49b9ea[_0x206bc8[0x0]]={'$gte':moment(_0x206bc8[0x1])[_0xa73f('0x47')](_0xa73f('0x48'))};_0x5c4de2[_0xa73f('0x43')]=_[_0xa73f('0x34')](_0x5c4de2['where'],_0x49b9ea);}_0x5c4de2=_[_0xa73f('0x34')]({},_0x5c4de2,_0x39dba9['options']);return db['FaxMessage']['count']({'where':_0x5c4de2[_0xa73f('0x43')]})[_0xa73f('0x1a')](function(_0x5e7b2e){_0x41a2e6[_0xa73f('0x49')]=_0x5e7b2e;if(_0x39dba9[_0xa73f('0x28')]['includeAll']){_0x5c4de2[_0xa73f('0x4a')]=[{'all':!![]}];}return db['FaxMessage'][_0xa73f('0x26')](_0x5c4de2);})[_0xa73f('0x1a')](function(_0x432f18){_0x41a2e6['rows']=_0x432f18;return _0x41a2e6;});}})[_0xa73f('0x1a')](respondWithFilteredResult(_0x1d7476,_0x5c4de2))[_0xa73f('0x2a')](handleError(_0x1d7476,null));};exports[_0xa73f('0x4b')]=function(_0x351f31,_0x90a00){return db[_0xa73f('0x21')][_0xa73f('0x36')]({'where':{'id':_0x351f31[_0xa73f('0x39')]['id']}})[_0xa73f('0x1a')](handleEntityNotFound(_0x90a00,null))[_0xa73f('0x1a')](function(_0xab1bd4){if(_0xab1bd4){return _0xab1bd4[_0xa73f('0x4c')](_0x351f31[_0xa73f('0x38')][_0xa73f('0x3d')],_['omit'](_0x351f31[_0xa73f('0x38')],[_0xa73f('0x3d'),'id'])||{})['spread'](function(){return db[_0xa73f('0x4d')][_0xa73f('0x26')]({'attributes':['id',_0xa73f('0x1d'),'color'],'where':{'id':_0x351f31[_0xa73f('0x38')][_0xa73f('0x3d')]}});})[_0xa73f('0x1a')](function(_0x7c4374){socket['emit']('faxInteractionTags:save',{'id':Number(_0x351f31[_0xa73f('0x39')]['id']),'tags':_0x7c4374||[]});return{'id':Number(_0x351f31[_0xa73f('0x39')]['id']),'tags':_0x7c4374||[]};});}})[_0xa73f('0x1a')](respondWithResult(_0x90a00,null))[_0xa73f('0x2a')](handleError(_0x90a00,null));};exports['removeTags']=function(_0x327242,_0x1e40bf){return db[_0xa73f('0x21')][_0xa73f('0x36')]({'where':{'id':_0x327242['params']['id']}})[_0xa73f('0x1a')](handleEntityNotFound(_0x1e40bf,null))[_0xa73f('0x1a')](function(_0x243746){if(_0x243746){return _0x243746[_0xa73f('0x4e')](_0x327242['query'][_0xa73f('0x3d')]);}})[_0xa73f('0x1a')](respondWithStatusCode(_0x1e40bf,null))['catch'](handleError(_0x1e40bf,null));};exports[_0xa73f('0x4f')]=function(_0x224682,_0x24c33b){var _0x50fffe=moment()[_0xa73f('0x50')]()[_0xa73f('0x51')]();var _0x14a3ff=path['join'](config[_0xa73f('0x52')],_0xa73f('0x53'),'files',_0xa73f('0x54'));var _0xb106a7=path[_0xa73f('0x55')](config[_0xa73f('0x52')],_0xa73f('0x53'),_0xa73f('0x56'),'attachments');var _0x3254b5=path['join'](_0x14a3ff,_0x50fffe);var _0x522483=util[_0xa73f('0x47')](_0xa73f('0x57'),_0x224682[_0xa73f('0x39')]['id'],_0x50fffe);var _0xc005a5=path['join'](_0x14a3ff,_0x522483);var _0x3229ed=[];_0x3229ed[_0xa73f('0x58')]({'model':db[_0xa73f('0x59')],'as':_0xa73f('0x59'),'raw':!![]});var _0x4bc522=[{'model':db[_0xa73f('0x3c')],'as':_0xa73f('0x5a'),'attributes':['id',_0xa73f('0x38'),_0xa73f('0x5b')],'include':_0x3229ed}];return db[_0xa73f('0x21')][_0xa73f('0x36')]({'where':{'id':_0x224682[_0xa73f('0x39')]['id']},'include':_0x4bc522})['then'](handleEntityNotFound(_0x24c33b,null))['then'](function(_0x572bd9){if(_0x572bd9&&_0x572bd9['Messages']){var _0x1c2bf1=_0x572bd9[_0xa73f('0x5c')]({'plain':!![]});fs[_0xa73f('0x5d')](_0x3254b5);for(var _0x5a7fa4=0x0;_0x5a7fa4<_0x1c2bf1[_0xa73f('0x5a')][_0xa73f('0x32')];_0x5a7fa4++){var _0x2b4a21=_0x1c2bf1[_0xa73f('0x5a')][_0x5a7fa4][_0xa73f('0x59')];if(_0x2b4a21){var _0x17558a=path[_0xa73f('0x55')](_0xb106a7,_0x2b4a21[_0xa73f('0x5e')]);if(fs[_0xa73f('0x5f')](_0x17558a)){fs[_0xa73f('0x60')](_0x17558a)[_0xa73f('0x61')](fs['createWriteStream'](path[_0xa73f('0x55')](_0x3254b5,_0x2b4a21[_0xa73f('0x5e')])));}}}return BPromise[_0xa73f('0x62')]()[_0xa73f('0x1a')](function(){return new BPromise(function(_0x2f8a3f,_0x55e5d4){zipdir(_0x3254b5,{'saveTo':_0xc005a5},function(_0x54fbd3,_0x47836a){if(_0x54fbd3)return _0x55e5d4(_0x54fbd3);return _0x2f8a3f(_0x47836a);});})[_0xa73f('0x1a')](function(){return new BPromise(function(_0x128347,_0x22d1a6){rimraf(_0x3254b5,function(_0x5b1b13){if(_0x5b1b13)_0x22d1a6(_0x5b1b13);return _0x128347();});});})[_0xa73f('0x1a')](function(){return _0x24c33b[_0xa73f('0x4f')](_0xc005a5,_0x522483,function(_0x442337){if(_0x442337){console['log']('err',_0x442337);}else{fs[_0xa73f('0x63')](_0xc005a5);}});});});}else{return _0x24c33b['sendStatus'](0xc8);}})['catch'](handleError(_0x24c33b,null));}; \ No newline at end of file +var _0x1e9b=['options','create','body','find','describe','addMessage','FaxMessage','ids','omit','findOne','rawAttributes','length','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','rows','spread','Tag','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','err','unlinkSync','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','send','map','fieldName','key','fax','user','catch','show','params','model','keys','FaxInteraction','query','filters','intersection','attributes','fields','includeAll','include'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0x1e9b,0xfd));var _0xb1e9=function(_0x38ca2d,_0x32240f){_0x38ca2d=_0x38ca2d-0x0;var _0x3d8356=_0x1e9b[_0x38ca2d];return _0x3d8356;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb1e9('0x0'));var moment=require(_0xb1e9('0x1'));var BPromise=require(_0xb1e9('0x2'));var util=require(_0xb1e9('0x3'));var path=require(_0xb1e9('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb1e9('0x5'));var qs=require(_0xb1e9('0x6'));var logger=require(_0xb1e9('0x7'))(_0xb1e9('0x8'));var config=require(_0xb1e9('0x9'));var db=require(_0xb1e9('0xa'))['db'];config[_0xb1e9('0xb')]=_[_0xb1e9('0xc')](config[_0xb1e9('0xb')],{'host':_0xb1e9('0xd'),'port':0x18eb});var socket=require(_0xb1e9('0xe'))(new Redis(config['redis']));require(_0xb1e9('0xf'))[_0xb1e9('0x10')](socket);function respondWithStatusCode(_0x12d30e,_0x212687){_0x212687=_0x212687||0xcc;return function(_0x512687){if(_0x512687){return _0x12d30e[_0xb1e9('0x11')](_0x212687);}return _0x12d30e[_0xb1e9('0x12')](_0x212687)[_0xb1e9('0x13')]();};}function respondWithResult(_0x4b0683,_0x2601ba){_0x2601ba=_0x2601ba||0xc8;return function(_0x95efc3){if(_0x95efc3){return _0x4b0683[_0xb1e9('0x12')](_0x2601ba)[_0xb1e9('0x14')](_0x95efc3);}};}function respondWithFilteredResult(_0x1de21f,_0x383d0a){return function(_0xc8424b){if(_0xc8424b){var _0x599bf0=typeof _0x383d0a[_0xb1e9('0x15')]===_0xb1e9('0x16')&&typeof _0x383d0a[_0xb1e9('0x17')]===_0xb1e9('0x16');var _0x13ca79=_0xc8424b[_0xb1e9('0x18')];var _0x2d6162=_0x599bf0?0x0:_0x383d0a['offset'];var _0x364741=_0x599bf0?_0xc8424b[_0xb1e9('0x18')]:_0x383d0a['offset']+_0x383d0a[_0xb1e9('0x17')];var _0x31c43a;if(_0x364741>=_0x13ca79){_0x364741=_0x13ca79;_0x31c43a=0xc8;}else{_0x31c43a=0xce;}_0x1de21f[_0xb1e9('0x12')](_0x31c43a);return _0x1de21f[_0xb1e9('0x19')]('Content-Range',_0x2d6162+'-'+_0x364741+'/'+_0x13ca79)[_0xb1e9('0x14')](_0xc8424b);}return null;};}function saveUpdates(_0x4b9306){return function(_0x325b11){if(_0x325b11){return _0x325b11[_0xb1e9('0x1a')](_0x4b9306)[_0xb1e9('0x1b')](function(_0x88fdfc){return _0x88fdfc;});}return null;};}function removeEntity(_0x4c7672){return function(_0xb5208){if(_0xb5208){return _0xb5208[_0xb1e9('0x1c')]()[_0xb1e9('0x1b')](function(){_0x4c7672[_0xb1e9('0x12')](0xcc)[_0xb1e9('0x13')]();});}};}function handleEntityNotFound(_0xe90f67){return function(_0x3e3a56){if(!_0x3e3a56){_0xe90f67[_0xb1e9('0x11')](0x194);}return _0x3e3a56;};}function handleError(_0x453508,_0x307f38){_0x307f38=_0x307f38||0x1f4;return function(_0xc2850d){logger[_0xb1e9('0x1d')](_0xc2850d['stack']);if(_0xc2850d[_0xb1e9('0x1e')]){delete _0xc2850d[_0xb1e9('0x1e')];}_0x453508[_0xb1e9('0x12')](_0x307f38)[_0xb1e9('0x1f')](_0xc2850d);};}exports['index']=function(_0x46106a,_0x37cd62){var _0x18f18f={};var _0xe664ec=_[_0xb1e9('0x20')](db['FaxInteraction']['rawAttributes'],function(_0x148249){return{'name':_0x148249[_0xb1e9('0x21')],'type':_0x148249['type'][_0xb1e9('0x22')]};});_0x18f18f=qs['getOptions'](_0xe664ec,_0x46106a);return interaction['findAll'](_0xb1e9('0x23'),_0x46106a['query'],_0x46106a[_0xb1e9('0x24')],_0x18f18f,_0xe664ec)['then'](respondWithFilteredResult(_0x37cd62,_0x18f18f))[_0xb1e9('0x25')](handleError(_0x37cd62,null));};exports[_0xb1e9('0x26')]=function(_0x2f0d71,_0x3e294d){var _0x3e4821={'raw':![],'where':{'id':_0x2f0d71[_0xb1e9('0x27')]['id']}},_0x1dfc54={};_0x1dfc54[_0xb1e9('0x28')]=_[_0xb1e9('0x29')](db[_0xb1e9('0x2a')]['rawAttributes']);_0x1dfc54[_0xb1e9('0x2b')]=_[_0xb1e9('0x29')](_0x2f0d71[_0xb1e9('0x2b')]);_0x1dfc54[_0xb1e9('0x2c')]=_[_0xb1e9('0x2d')](_0x1dfc54[_0xb1e9('0x28')],_0x1dfc54[_0xb1e9('0x2b')]);_0x3e4821[_0xb1e9('0x2e')]=_[_0xb1e9('0x2d')](_0x1dfc54[_0xb1e9('0x28')],qs[_0xb1e9('0x2f')](_0x2f0d71['query'][_0xb1e9('0x2f')]));_0x3e4821[_0xb1e9('0x2e')]=_0x3e4821[_0xb1e9('0x2e')]['length']?_0x3e4821[_0xb1e9('0x2e')]:_0x1dfc54[_0xb1e9('0x28')];if(_0x2f0d71[_0xb1e9('0x2b')][_0xb1e9('0x30')]){_0x3e4821[_0xb1e9('0x31')]=[{'all':!![]}];}_0x3e4821=_['merge']({},_0x3e4821,_0x2f0d71[_0xb1e9('0x32')]);return db[_0xb1e9('0x2a')]['find'](_0x3e4821)['then'](handleEntityNotFound(_0x3e294d,null))[_0xb1e9('0x1b')](respondWithResult(_0x3e294d,null))[_0xb1e9('0x25')](handleError(_0x3e294d,null));};exports[_0xb1e9('0x33')]=function(_0x2cf883,_0xff46d){return db[_0xb1e9('0x2a')][_0xb1e9('0x33')](_0x2cf883[_0xb1e9('0x34')],{})[_0xb1e9('0x1b')](respondWithResult(_0xff46d,0xc9))[_0xb1e9('0x25')](handleError(_0xff46d,null));};exports[_0xb1e9('0x1a')]=function(_0x44e85c,_0x3dbd01){if(_0x44e85c[_0xb1e9('0x34')]['id']){delete _0x44e85c[_0xb1e9('0x34')]['id'];}return db[_0xb1e9('0x2a')]['find']({'where':{'id':_0x44e85c['params']['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0x3dbd01,null))['then'](saveUpdates(_0x44e85c[_0xb1e9('0x34')],null))[_0xb1e9('0x1b')](respondWithResult(_0x3dbd01,null))[_0xb1e9('0x25')](handleError(_0x3dbd01,null));};exports[_0xb1e9('0x1c')]=function(_0x587d9c,_0x5a873b){return db[_0xb1e9('0x2a')][_0xb1e9('0x35')]({'where':{'id':_0x587d9c['params']['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0x5a873b,null))[_0xb1e9('0x1b')](removeEntity(_0x5a873b,null))[_0xb1e9('0x25')](handleError(_0x5a873b,null));};exports[_0xb1e9('0x36')]=function(_0x5cda4a,_0x235627){return db[_0xb1e9('0x2a')][_0xb1e9('0x36')]()[_0xb1e9('0x1b')](respondWithResult(_0x235627,null))[_0xb1e9('0x25')](handleError(_0x235627,null));};exports[_0xb1e9('0x37')]=function(_0x482aa0,_0x1bba95){return db[_0xb1e9('0x38')]['find']({'where':{'id':_0x482aa0['params']['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0x1bba95,null))[_0xb1e9('0x1b')](function(_0x304b89){if(_0x304b89){return _0x304b89['addMessage'](_0x482aa0[_0xb1e9('0x34')][_0xb1e9('0x39')],_[_0xb1e9('0x3a')](_0x482aa0[_0xb1e9('0x34')],[_0xb1e9('0x39'),'id'])||{});}})[_0xb1e9('0x1b')](respondWithResult(_0x1bba95,null))[_0xb1e9('0x25')](handleError(_0x1bba95,null));};exports['getMessages']=function(_0x15e699,_0x146235){var _0x31fff5={'raw':![],'where':{}};var _0x440485={};var _0x46997c={'count':0x0,'rows':[]};return db[_0xb1e9('0x2a')][_0xb1e9('0x3b')]({'where':{'id':_0x15e699['params']['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0x146235,null))[_0xb1e9('0x1b')](function(_0x5ed2a4){if(_0x5ed2a4){_0x440485['model']=_['keys'](db[_0xb1e9('0x38')][_0xb1e9('0x3c')]);_0x440485[_0xb1e9('0x2b')]=_[_0xb1e9('0x29')](_0x15e699['query']);_0x440485[_0xb1e9('0x2c')]=_[_0xb1e9('0x2d')](_0x440485[_0xb1e9('0x28')],_0x440485['query']);_0x31fff5[_0xb1e9('0x2e')]=_[_0xb1e9('0x2d')](_0x440485[_0xb1e9('0x28')],qs['fields'](_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x2f')]));_0x31fff5['attributes']=_0x31fff5[_0xb1e9('0x2e')][_0xb1e9('0x3d')]?_0x31fff5[_0xb1e9('0x2e')]:_0x440485[_0xb1e9('0x28')];if(!_0x15e699[_0xb1e9('0x2b')]['hasOwnProperty'](_0xb1e9('0x3e'))){_0x31fff5[_0xb1e9('0x17')]=qs[_0xb1e9('0x17')](_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x17')]);_0x31fff5[_0xb1e9('0x15')]=qs[_0xb1e9('0x15')](_0x15e699['query'][_0xb1e9('0x15')]);}_0x31fff5[_0xb1e9('0x3f')]=qs[_0xb1e9('0x40')](_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x40')]);_0x31fff5[_0xb1e9('0x41')]=qs['filters'](_['pick'](_0x15e699['query'],_0x440485['filters']));_0x31fff5['where'][_0xb1e9('0x42')]=_0x5ed2a4['id'];if(_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x43')]){_0x31fff5['where']=_['merge'](_0x31fff5[_0xb1e9('0x41')],{'$or':_[_0xb1e9('0x20')](_0x31fff5[_0xb1e9('0x2e')],function(_0x3699ed){var _0x2f83ee={};_0x2f83ee[_0x3699ed]={'$like':'%'+_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x43')]+'%'};return _0x2f83ee;})});}if(_0x15e699[_0xb1e9('0x2b')][_0xb1e9('0x44')]){var _0x591502=_0x15e699[_0xb1e9('0x2b')]['$gte'][_0xb1e9('0x45')](',');var _0x5ca53a={};_0x5ca53a[_0x591502[0x0]]={'$gte':moment(_0x591502[0x1])['format'](_0xb1e9('0x46'))};_0x31fff5[_0xb1e9('0x41')]=_[_0xb1e9('0x47')](_0x31fff5['where'],_0x5ca53a);}_0x31fff5=_[_0xb1e9('0x47')]({},_0x31fff5,_0x15e699[_0xb1e9('0x32')]);return db[_0xb1e9('0x38')][_0xb1e9('0x18')]({'where':_0x31fff5['where']})[_0xb1e9('0x1b')](function(_0x5e3fe6){_0x46997c[_0xb1e9('0x18')]=_0x5e3fe6;if(_0x15e699[_0xb1e9('0x2b')]['includeAll']){_0x31fff5['include']=[{'all':!![]}];}return db[_0xb1e9('0x38')][_0xb1e9('0x48')](_0x31fff5);})[_0xb1e9('0x1b')](function(_0x18e138){_0x46997c[_0xb1e9('0x49')]=_0x18e138;return _0x46997c;});}})['then'](respondWithFilteredResult(_0x146235,_0x31fff5))[_0xb1e9('0x25')](handleError(_0x146235,null));};exports['addTags']=function(_0x2c58b1,_0x5d572f){return db['FaxInteraction'][_0xb1e9('0x35')]({'where':{'id':_0x2c58b1[_0xb1e9('0x27')]['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0x5d572f,null))['then'](function(_0x2fd8ab){if(_0x2fd8ab){return _0x2fd8ab['setTags'](_0x2c58b1[_0xb1e9('0x34')][_0xb1e9('0x39')],_[_0xb1e9('0x3a')](_0x2c58b1[_0xb1e9('0x34')],['ids','id'])||{})[_0xb1e9('0x4a')](function(){return db[_0xb1e9('0x4b')][_0xb1e9('0x48')]({'attributes':['id',_0xb1e9('0x1e'),'color'],'where':{'id':_0x2c58b1[_0xb1e9('0x34')]['ids']}});})[_0xb1e9('0x1b')](function(_0xd27525){socket[_0xb1e9('0x4c')](_0xb1e9('0x4d'),{'id':Number(_0x2c58b1[_0xb1e9('0x27')]['id']),'tags':_0xd27525||[]});return{'id':Number(_0x2c58b1[_0xb1e9('0x27')]['id']),'tags':_0xd27525||[]};});}})[_0xb1e9('0x1b')](respondWithResult(_0x5d572f,null))[_0xb1e9('0x25')](handleError(_0x5d572f,null));};exports['removeTags']=function(_0x213e30,_0xc3d6b8){return db[_0xb1e9('0x2a')]['find']({'where':{'id':_0x213e30[_0xb1e9('0x27')]['id']}})[_0xb1e9('0x1b')](handleEntityNotFound(_0xc3d6b8,null))[_0xb1e9('0x1b')](function(_0x1c0728){if(_0x1c0728){return _0x1c0728[_0xb1e9('0x4e')](_0x213e30[_0xb1e9('0x2b')][_0xb1e9('0x39')]);}})[_0xb1e9('0x1b')](respondWithStatusCode(_0xc3d6b8,null))[_0xb1e9('0x25')](handleError(_0xc3d6b8,null));};exports[_0xb1e9('0x4f')]=function(_0xa42282,_0xdef2a4){var _0x4c6d10=moment()[_0xb1e9('0x50')]()[_0xb1e9('0x51')]();var _0x2833f6=path[_0xb1e9('0x52')](config[_0xb1e9('0x53')],_0xb1e9('0x54'),_0xb1e9('0x55'),_0xb1e9('0x56'));var _0x416117=path['join'](config[_0xb1e9('0x53')],_0xb1e9('0x54'),_0xb1e9('0x55'),_0xb1e9('0x57'));var _0x58c883=path[_0xb1e9('0x52')](_0x2833f6,_0x4c6d10);var _0x537d87=util['format'](_0xb1e9('0x58'),_0xa42282['params']['id'],_0x4c6d10);var _0x5ed84b=path[_0xb1e9('0x52')](_0x2833f6,_0x537d87);var _0x1926f7=[];_0x1926f7['push']({'model':db[_0xb1e9('0x59')],'as':'Attachment','raw':!![]});var _0xb6d8a9=[{'model':db['FaxMessage'],'as':_0xb1e9('0x5a'),'attributes':['id',_0xb1e9('0x34'),_0xb1e9('0x5b')],'include':_0x1926f7}];return db['FaxInteraction'][_0xb1e9('0x35')]({'where':{'id':_0xa42282[_0xb1e9('0x27')]['id']},'include':_0xb6d8a9})['then'](handleEntityNotFound(_0xdef2a4,null))[_0xb1e9('0x1b')](function(_0xe3958c){if(_0xe3958c&&_0xe3958c[_0xb1e9('0x5a')]){var _0x49fa47=_0xe3958c[_0xb1e9('0x5c')]({'plain':!![]});fs[_0xb1e9('0x5d')](_0x58c883);for(var _0xdda963=0x0;_0xdda963<_0x49fa47[_0xb1e9('0x5a')][_0xb1e9('0x3d')];_0xdda963++){var _0x3f3d16=_0x49fa47[_0xb1e9('0x5a')][_0xdda963][_0xb1e9('0x59')];if(_0x3f3d16){var _0x23da66=path[_0xb1e9('0x52')](_0x416117,_0x3f3d16[_0xb1e9('0x5e')]);if(fs[_0xb1e9('0x5f')](_0x23da66)){fs['createReadStream'](_0x23da66)[_0xb1e9('0x60')](fs[_0xb1e9('0x61')](path[_0xb1e9('0x52')](_0x58c883,_0x3f3d16['basename'])));}}}return BPromise[_0xb1e9('0x62')]()[_0xb1e9('0x1b')](function(){return new BPromise(function(_0xcdf34,_0x14aa9d){zipdir(_0x58c883,{'saveTo':_0x5ed84b},function(_0x903ede,_0x472563){if(_0x903ede)return _0x14aa9d(_0x903ede);return _0xcdf34(_0x472563);});})['then'](function(){return new BPromise(function(_0x1174f2,_0x49eec4){rimraf(_0x58c883,function(_0x598ea0){if(_0x598ea0)_0x49eec4(_0x598ea0);return _0x1174f2();});});})['then'](function(){return _0xdef2a4[_0xb1e9('0x4f')](_0x5ed84b,_0x537d87,function(_0x43faa6){if(_0x43faa6){console['log'](_0xb1e9('0x63'),_0x43faa6);}else{fs[_0xb1e9('0x64')](_0x5ed84b);}});});});}else{return _0xdef2a4[_0xb1e9('0x11')](0xc8);}})[_0xb1e9('0x25')](handleError(_0xdef2a4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b4a0360..dd221e1 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 _0xd21c=['../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction'];(function(_0x12b400,_0x1c0937){var _0x55543a=function(_0x5d076c){while(--_0x5d076c){_0x12b400['push'](_0x12b400['shift']());}};_0x55543a(++_0x1c0937);}(_0xd21c,0x185));var _0xcd21=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0xd21c[_0x2a7812];return _0x3e1342;};'use strict';var EventEmitter=require(_0xcd21('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xcd21('0x1')];var FaxMessage=require(_0xcd21('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcd21('0x3')](0x0);var events={'afterCreate':_0xcd21('0x4'),'afterUpdate':'update','afterDestroy':_0xcd21('0x5')};function emitEvent(_0x45d98b){return function(_0x2b04af,_0x3222ab,_0xe1a1dd){_0x2b04af[_0xcd21('0x6')]({'attributes':['id'],'raw':!![]})[_0xcd21('0x7')](function(_0x2fb052){_0x2b04af[_0xcd21('0x8')]('Users',_0x2fb052['map'](function(_0x3c562e){return{'id':_0x3c562e['id']};}));return FaxMessage[_0xcd21('0x9')]({'where':{'FaxInteractionId':_0x2b04af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd21('0x7')](function(_0x517aa9){_0x2b04af[_0xcd21('0x8')](_0xcd21('0xa'),_0x517aa9[_0xcd21('0xb')]);FaxInteractionEvents[_0xcd21('0xc')](_0x45d98b+':'+_0x2b04af['id'],_0x2b04af);FaxInteractionEvents['emit'](_0x45d98b,_0x2b04af);_0xe1a1dd(null);})[_0xcd21('0xd')](_0xe1a1dd(null));};}for(var e in events){if(events[_0xcd21('0xe')](e)){var event=events[e];FaxInteraction[_0xcd21('0xf')](e,emitEvent(event));}}module[_0xcd21('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x222f=['setMaxListeners','update','remove','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x3ec28a,_0x141408){var _0x15e81d=function(_0x3ef627){while(--_0x3ef627){_0x3ec28a['push'](_0x3ec28a['shift']());}};_0x15e81d(++_0x141408);}(_0x222f,0xfb));var _0xf222=function(_0x2c8671,_0x56778a){_0x2c8671=_0x2c8671-0x0;var _0x38dc58=_0x222f[_0x2c8671];return _0x38dc58;};'use strict';var EventEmitter=require(_0xf222('0x0'));var FaxInteraction=require(_0xf222('0x1'))['db'][_0xf222('0x2')];var FaxMessage=require(_0xf222('0x1'))['db'][_0xf222('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf222('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf222('0x5'),'afterDestroy':_0xf222('0x6')};function emitEvent(_0x321060){return function(_0x5f1768,_0x5ac77a,_0x43ee18){_0x5f1768['getUsers']({'attributes':['id'],'raw':!![]})[_0xf222('0x7')](function(_0x3d273a){_0x5f1768[_0xf222('0x8')](_0xf222('0x9'),_0x3d273a['map'](function(_0x54034f){return{'id':_0x54034f['id']};}));return FaxMessage[_0xf222('0xa')]({'where':{'FaxInteractionId':_0x5f1768['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf222('0x7')](function(_0x15e2a6){_0x5f1768[_0xf222('0x8')]('unreadMessages',_0x15e2a6[_0xf222('0xb')]);FaxInteractionEvents[_0xf222('0xc')](_0x321060+':'+_0x5f1768['id'],_0x5f1768);FaxInteractionEvents[_0xf222('0xc')](_0x321060,_0x5f1768);_0x43ee18(null);})[_0xf222('0xd')](_0x43ee18(null));};}for(var e in events){if(events[_0xf222('0xe')](e)){var event=events[e];FaxInteraction[_0xf222('0xf')](e,emitEvent(event));}}module[_0xf222('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c1310dc..cb5aae6 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 _0x6d43=['path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closed','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52cdb7,_0xa150f3){var _0x159d2a=function(_0x4df9f7){while(--_0x4df9f7){_0x52cdb7['push'](_0x52cdb7['shift']());}};_0x159d2a(++_0xa150f3);}(_0x6d43,0xe8));var _0x36d4=function(_0x117581,_0x307e77){_0x117581=_0x117581-0x0;var _0x25cfa7=_0x6d43[_0x117581];return _0x25cfa7;};'use strict';var _=require(_0x36d4('0x0'));var util=require(_0x36d4('0x1'));var logger=require(_0x36d4('0x2'))(_0x36d4('0x3'));var moment=require(_0x36d4('0x4'));var BPromise=require(_0x36d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36d4('0x6'));var rimraf=require(_0x36d4('0x7'));var config=require(_0x36d4('0x8'));var attributes=require(_0x36d4('0x9'));module['exports']=function(_0x5983b8,_0x25630a){return _0x5983b8['define'](_0x36d4('0xa'),attributes,{'tableName':_0x36d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58c485,_0x2d3479,_0x4506e3){if(_0x58c485[_0x36d4('0xc')](_0x36d4('0xd'))){_0x58c485['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4506e3(null,_0x58c485);}}});}; \ No newline at end of file +var _0xfda8=['define','fax_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','path','rimraf','./faxInteraction.attributes','exports'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xfda8,0x118));var _0x8fda=function(_0x35b07d,_0x3d0ae7){_0x35b07d=_0x35b07d-0x0;var _0x2868bc=_0xfda8[_0x35b07d];return _0x2868bc;};'use strict';var _=require('lodash');var util=require(_0x8fda('0x0'));var logger=require(_0x8fda('0x1'))(_0x8fda('0x2'));var moment=require(_0x8fda('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fda('0x4'));var rimraf=require(_0x8fda('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fda('0x6'));module[_0x8fda('0x7')]=function(_0x3b510e,_0x46b196){return _0x3b510e[_0x8fda('0x8')]('FaxInteraction',attributes,{'tableName':_0x8fda('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb7cc08,_0x36fb68,_0xf7dee6){if(_0xb7cc08['changed'](_0x8fda('0xa'))){_0xb7cc08['closedAt']=moment()['format'](_0x8fda('0xb'));}_0xf7dee6(null,_0xb7cc08);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b69efa5..ddcc85e 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 _0xcc16=['localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x1bc378,_0x5c520c){var _0x1b93fa=function(_0x4295d7){while(--_0x4295d7){_0x1bc378['push'](_0x1bc378['shift']());}};_0x1b93fa(++_0x5c520c);}(_0xcc16,0x1b4));var _0x6cc1=function(_0x5b1273,_0x3b6ab9){_0x5b1273=_0x5b1273-0x0;var _0x4905d9=_0xcc16[_0x5b1273];return _0x4905d9;};'use strict';var _=require(_0x6cc1('0x0'));var util=require(_0x6cc1('0x1'));var moment=require(_0x6cc1('0x2'));var BPromise=require(_0x6cc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cc1('0x4'));var db=require(_0x6cc1('0x5'))['db'];var utils=require(_0x6cc1('0x6'));var logger=require(_0x6cc1('0x7'))(_0x6cc1('0x8'));var config=require('../../config/environment');var jayson=require(_0x6cc1('0x9'));var client=jayson[_0x6cc1('0xa')][_0x6cc1('0xb')]({'port':0x232a});config[_0x6cc1('0xc')]=_[_0x6cc1('0xd')](config[_0x6cc1('0xc')],{'host':_0x6cc1('0xe'),'port':0x18eb});var socket=require(_0x6cc1('0xf'))(new Redis(config['redis']));require(_0x6cc1('0x10'))[_0x6cc1('0x11')](socket);function respondWithRpcPromise(_0x42c366,_0x1d61ad,_0x3ee409){return new BPromise(function(_0x4bfbf0,_0x1d6e2b){return client[_0x6cc1('0x12')](_0x42c366,_0x3ee409)[_0x6cc1('0x13')](function(_0x4635de){logger[_0x6cc1('0x14')](_0x6cc1('0x15'),_0x1d61ad,'request\x20sent');logger[_0x6cc1('0x16')](_0x6cc1('0x17'),_0x1d61ad,_0x6cc1('0x18'),JSON[_0x6cc1('0x19')](_0x4635de));if(_0x4635de[_0x6cc1('0x1a')]){if(_0x4635de['error'][_0x6cc1('0x1b')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1d61ad,_0x4635de[_0x6cc1('0x1a')][_0x6cc1('0x1c')]);return _0x1d6e2b(_0x4635de['error'][_0x6cc1('0x1c')]);}logger['error'](_0x6cc1('0x15'),_0x1d61ad,_0x4635de[_0x6cc1('0x1a')][_0x6cc1('0x1c')]);return _0x4bfbf0(_0x4635de[_0x6cc1('0x1a')]['message']);}else{logger[_0x6cc1('0x14')](_0x6cc1('0x15'),_0x1d61ad,_0x6cc1('0x18'));_0x4bfbf0(_0x4635de[_0x6cc1('0x1d')]['message']);}})[_0x6cc1('0x1e')](function(_0x4c626e){logger[_0x6cc1('0x1a')](_0x6cc1('0x15'),_0x1d61ad,_0x4c626e);_0x1d6e2b(_0x4c626e);});});}exports['UpdateFaxInteraction']=function(_0x4a648f){var _0x5e73b7=this;return new Promise(function(_0x30d481,_0x173d05){return db[_0x6cc1('0x1f')][_0x6cc1('0x20')](_0x4a648f[_0x6cc1('0x21')],{'raw':_0x4a648f[_0x6cc1('0x22')]?_0x4a648f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a648f['options']?_0x4a648f[_0x6cc1('0x22')][_0x6cc1('0x23')]||null:null,'attributes':_0x4a648f[_0x6cc1('0x22')]?_0x4a648f['options'][_0x6cc1('0x24')]||null:null,'limit':_0x4a648f[_0x6cc1('0x22')]?_0x4a648f['options'][_0x6cc1('0x25')]||null:null})[_0x6cc1('0x13')](function(_0x36fa2c){logger[_0x6cc1('0x14')]('UpdateFaxInteraction',_0x4a648f);logger[_0x6cc1('0x16')]('UpdateFaxInteraction',_0x4a648f,JSON[_0x6cc1('0x19')](_0x36fa2c));_0x30d481(_0x36fa2c);})[_0x6cc1('0x1e')](function(_0x5f05bd){logger[_0x6cc1('0x1a')](_0x6cc1('0x26'),_0x5f05bd['message'],_0x4a648f);_0x173d05(_0x5e73b7[_0x6cc1('0x1a')](0x1f4,_0x5f05bd['message']));});});};exports[_0x6cc1('0x27')]=function(_0x479ace){return new Promise(function(_0x36db8f,_0x3c03eb){return db[_0x6cc1('0x1f')][_0x6cc1('0x28')]({'where':_0x479ace['options']?_0x479ace[_0x6cc1('0x22')][_0x6cc1('0x23')]||null:null})[_0x6cc1('0x13')](function(_0x329336){if(_0x329336){return _0x329336[_0x6cc1('0x29')](_0x479ace[_0x6cc1('0x21')][_0x6cc1('0x2a')],_['omit'](_0x479ace[_0x6cc1('0x21')],['ids','id'])||{});}})[_0x6cc1('0x2b')](function(_0x2f32f2){logger[_0x6cc1('0x14')](_0x6cc1('0x2c'),_0x479ace);logger['debug']('AddTags',_0x479ace,JSON[_0x6cc1('0x19')](_0x2f32f2));_0x36db8f(_0x2f32f2);})[_0x6cc1('0x1e')](function(_0x526111){logger['error'](_0x6cc1('0x2c'),_0x526111[_0x6cc1('0x1c')],_0x479ace);_0x3c03eb(_this[_0x6cc1('0x1a')](0x1f4,_0x526111['message']));});});}; \ No newline at end of file +var _0x544a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','raw','where','limit','AddTagsToFaxInteraction','find','body','omit','ids','spread','AddTags','util','moment'];(function(_0x2b8f2b,_0x3e41ac){var _0x12b3ff=function(_0x179f1f){while(--_0x179f1f){_0x2b8f2b['push'](_0x2b8f2b['shift']());}};_0x12b3ff(++_0x3e41ac);}(_0x544a,0x9e));var _0xa544=function(_0x2d3dba,_0x4981df){_0x2d3dba=_0x2d3dba-0x0;var _0xa6f184=_0x544a[_0x2d3dba];return _0xa6f184;};'use strict';var _=require('lodash');var util=require(_0xa544('0x0'));var moment=require(_0xa544('0x1'));var BPromise=require(_0xa544('0x2'));var rs=require(_0xa544('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa544('0x4'))['db'];var utils=require(_0xa544('0x5'));var logger=require(_0xa544('0x6'))(_0xa544('0x7'));var config=require(_0xa544('0x8'));var jayson=require(_0xa544('0x9'));var client=jayson[_0xa544('0xa')]['http']({'port':0x232a});config[_0xa544('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa544('0xc'))[_0xa544('0xd')](socket);function respondWithRpcPromise(_0x49d5d0,_0x5b04d6,_0x5b0121){return new BPromise(function(_0x42bf40,_0x5805fb){return client[_0xa544('0xe')](_0x49d5d0,_0x5b0121)[_0xa544('0xf')](function(_0x1b9cd7){logger[_0xa544('0x10')](_0xa544('0x11'),_0x5b04d6,_0xa544('0x12'));logger[_0xa544('0x13')](_0xa544('0x14'),_0x5b04d6,_0xa544('0x12'),JSON[_0xa544('0x15')](_0x1b9cd7));if(_0x1b9cd7[_0xa544('0x16')]){if(_0x1b9cd7['error'][_0xa544('0x17')]===0x1f4){logger[_0xa544('0x16')](_0xa544('0x11'),_0x5b04d6,_0x1b9cd7[_0xa544('0x16')][_0xa544('0x18')]);return _0x5805fb(_0x1b9cd7[_0xa544('0x16')][_0xa544('0x18')]);}logger[_0xa544('0x16')](_0xa544('0x11'),_0x5b04d6,_0x1b9cd7[_0xa544('0x16')]['message']);return _0x42bf40(_0x1b9cd7['error']['message']);}else{logger[_0xa544('0x10')](_0xa544('0x11'),_0x5b04d6,_0xa544('0x12'));_0x42bf40(_0x1b9cd7[_0xa544('0x19')][_0xa544('0x18')]);}})[_0xa544('0x1a')](function(_0x4f61e9){logger[_0xa544('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5b04d6,_0x4f61e9);_0x5805fb(_0x4f61e9);});});}exports[_0xa544('0x1b')]=function(_0xac6f1f){var _0x4a3944=this;return new Promise(function(_0x61779a,_0xc91e7e){return db['FaxInteraction'][_0xa544('0x1c')](_0xac6f1f['body'],{'raw':_0xac6f1f[_0xa544('0x1d')]?_0xac6f1f[_0xa544('0x1d')][_0xa544('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xac6f1f[_0xa544('0x1d')]?_0xac6f1f[_0xa544('0x1d')][_0xa544('0x1f')]||null:null,'attributes':_0xac6f1f[_0xa544('0x1d')]?_0xac6f1f[_0xa544('0x1d')]['attributes']||null:null,'limit':_0xac6f1f[_0xa544('0x1d')]?_0xac6f1f[_0xa544('0x1d')][_0xa544('0x20')]||null:null})['then'](function(_0x118538){logger[_0xa544('0x10')](_0xa544('0x1b'),_0xac6f1f);logger['debug'](_0xa544('0x1b'),_0xac6f1f,JSON[_0xa544('0x15')](_0x118538));_0x61779a(_0x118538);})[_0xa544('0x1a')](function(_0x2a0eff){logger['error'](_0xa544('0x1b'),_0x2a0eff[_0xa544('0x18')],_0xac6f1f);_0xc91e7e(_0x4a3944['error'](0x1f4,_0x2a0eff[_0xa544('0x18')]));});});};exports[_0xa544('0x21')]=function(_0x413b4e){return new Promise(function(_0x3aa3e8,_0x4bfe5b){return db['FaxInteraction'][_0xa544('0x22')]({'where':_0x413b4e[_0xa544('0x1d')]?_0x413b4e[_0xa544('0x1d')][_0xa544('0x1f')]||null:null})[_0xa544('0xf')](function(_0x450478){if(_0x450478){return _0x450478['addTags'](_0x413b4e[_0xa544('0x23')]['ids'],_[_0xa544('0x24')](_0x413b4e['body'],[_0xa544('0x25'),'id'])||{});}})[_0xa544('0x26')](function(_0x377503){logger[_0xa544('0x10')](_0xa544('0x27'),_0x413b4e);logger[_0xa544('0x13')](_0xa544('0x27'),_0x413b4e,JSON[_0xa544('0x15')](_0x377503));_0x3aa3e8(_0x377503);})[_0xa544('0x1a')](function(_0x4a8b8f){logger[_0xa544('0x16')]('AddTags',_0x4a8b8f['message'],_0x413b4e);_0x4bfe5b(_this[_0xa544('0x16')](0x1f4,_0x4a8b8f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index cc5b7e5..090bff3 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 _0xf8a8=['length','faxInteraction:','./faxInteraction.events','remove','update','register'];(function(_0x3cb5f1,_0x48c50e){var _0x31d0c9=function(_0x2053a3){while(--_0x2053a3){_0x3cb5f1['push'](_0x3cb5f1['shift']());}};_0x31d0c9(++_0x48c50e);}(_0xf8a8,0x194));var _0x8f8a=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xf8a8[_0x10004e];return _0x5af990;};'use strict';var FaxInteractionEvents=require(_0x8f8a('0x0'));var events=['save',_0x8f8a('0x1'),_0x8f8a('0x2')];function createListener(_0x5b3c29,_0x31c442){return function(_0x12b658){_0x31c442['emit'](_0x5b3c29,_0x12b658);};}function removeListener(_0x3c9d5a,_0x53beaa){return function(){FaxInteractionEvents['removeListener'](_0x3c9d5a,_0x53beaa);};}exports[_0x8f8a('0x3')]=function(_0x25cb46){for(var _0x4ce770=0x0,_0x2693b8=events[_0x8f8a('0x4')];_0x4ce770<_0x2693b8;_0x4ce770++){var _0xa5db16=events[_0x4ce770];var _0x2807eb=createListener(_0x8f8a('0x5')+_0xa5db16,_0x25cb46);FaxInteractionEvents['on'](_0xa5db16,_0x2807eb);}}; \ No newline at end of file +var _0x8fb1=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','update'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x8fb1,0x1b7));var _0x18fb=function(_0x133123,_0x548ca8){_0x133123=_0x133123-0x0;var _0x31e73a=_0x8fb1[_0x133123];return _0x31e73a;};'use strict';var FaxInteractionEvents=require(_0x18fb('0x0'));var events=['save','remove',_0x18fb('0x1')];function createListener(_0xbd1c40,_0x44662e){return function(_0x4eb935){_0x44662e[_0x18fb('0x2')](_0xbd1c40,_0x4eb935);};}function removeListener(_0x281679,_0x2f9303){return function(){FaxInteractionEvents[_0x18fb('0x3')](_0x281679,_0x2f9303);};}exports[_0x18fb('0x4')]=function(_0x10c0fa){for(var _0x4f5ad0=0x0,_0x4a09d5=events[_0x18fb('0x5')];_0x4f5ad0<_0x4a09d5;_0x4f5ad0++){var _0x2e5b00=events[_0x4f5ad0];var _0x42dc6a=createListener(_0x18fb('0x6')+_0x2e5b00,_0x10c0fa);FaxInteractionEvents['on'](_0x2e5b00,_0x42dc6a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 76412df..9bce769 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 _0x4444=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','multer','util'];(function(_0x3490c2,_0x548c5e){var _0x891d41=function(_0x54ed0c){while(--_0x54ed0c){_0x3490c2['push'](_0x3490c2['shift']());}};_0x891d41(++_0x548c5e);}(_0x4444,0xa3));var _0x4444=function(_0x345865,_0x1d878d){_0x345865=_0x345865-0x0;var _0x2e14f4=_0x4444[_0x345865];return _0x2e14f4;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require('path');var timeout=require(_0x4444('0x2'));var express=require(_0x4444('0x3'));var router=express[_0x4444('0x4')]();var fs_extra=require(_0x4444('0x5'));var auth=require(_0x4444('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4444('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4444('0x8')]);router[_0x4444('0x9')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller[_0x4444('0xc')]);router[_0x4444('0x9')]('/:id',auth[_0x4444('0xb')](),controller[_0x4444('0xd')]);router[_0x4444('0x9')](_0x4444('0xe'),auth[_0x4444('0xb')](),controller[_0x4444('0xf')]);router[_0x4444('0x9')](_0x4444('0x10'),auth[_0x4444('0xb')](),controller[_0x4444('0x11')]);router[_0x4444('0x12')]('/',auth[_0x4444('0xb')](),controller['create']);router[_0x4444('0x12')]('/:id/messages',auth[_0x4444('0xb')](),controller[_0x4444('0x13')]);router[_0x4444('0x12')](_0x4444('0x14'),auth['isAuthenticated'](),interaction[_0x4444('0x15')](_0x4444('0x16'),_0x4444('0x17')),controller[_0x4444('0x18')]);router[_0x4444('0x19')](_0x4444('0x1a'),auth[_0x4444('0xb')](),interaction[_0x4444('0x15')](_0x4444('0x16'),_0x4444('0x1b')),controller[_0x4444('0x1c')]);router['delete'](_0x4444('0x1a'),auth[_0x4444('0xb')](),interaction['tracked'](_0x4444('0x16'),_0x4444('0x1d')),controller[_0x4444('0x1e')]);router[_0x4444('0x1f')](_0x4444('0x14'),auth['isAuthenticated'](),controller[_0x4444('0x20')]);module['exports']=router; \ No newline at end of file +var _0xd0d1=['get','isAuthenticated','/describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','fax','tracked','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x219a22,_0x90d412){var _0x4f0954=function(_0x4ecd9e){while(--_0x4ecd9e){_0x219a22['push'](_0x219a22['shift']());}};_0x4f0954(++_0x90d412);}(_0xd0d1,0x1a8));var _0x1d0d=function(_0x522633,_0x3bd351){_0x522633=_0x522633-0x0;var _0x149e35=_0xd0d1[_0x522633];return _0x149e35;};'use strict';var multer=require(_0x1d0d('0x0'));var util=require(_0x1d0d('0x1'));var path=require('path');var timeout=require(_0x1d0d('0x2'));var express=require(_0x1d0d('0x3'));var router=express[_0x1d0d('0x4')]();var fs_extra=require(_0x1d0d('0x5'));var auth=require(_0x1d0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d0d('0x7'));var controller=require('./faxInteraction.controller');router[_0x1d0d('0x8')]('/',auth[_0x1d0d('0x9')](),controller['index']);router[_0x1d0d('0x8')](_0x1d0d('0xa'),auth[_0x1d0d('0x9')](),controller['describe']);router[_0x1d0d('0x8')](_0x1d0d('0xb'),auth[_0x1d0d('0x9')](),controller[_0x1d0d('0xc')]);router['get'](_0x1d0d('0xd'),auth[_0x1d0d('0x9')](),controller['getMessages']);router[_0x1d0d('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x1d0d('0xe')]);router[_0x1d0d('0xf')]('/',auth['isAuthenticated'](),controller[_0x1d0d('0x10')]);router[_0x1d0d('0xf')](_0x1d0d('0xd'),auth[_0x1d0d('0x9')](),controller[_0x1d0d('0x11')]);router[_0x1d0d('0xf')](_0x1d0d('0x12'),auth[_0x1d0d('0x9')](),interaction['tracked'](_0x1d0d('0x13'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0x1d0d('0xb'),auth[_0x1d0d('0x9')](),interaction[_0x1d0d('0x14')](_0x1d0d('0x13'),'faxinteraction:update'),controller[_0x1d0d('0x15')]);router[_0x1d0d('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x1d0d('0x14')](_0x1d0d('0x13'),_0x1d0d('0x17')),controller[_0x1d0d('0x18')]);router[_0x1d0d('0x16')]('/:id/tags',auth[_0x1d0d('0x9')](),controller[_0x1d0d('0x19')]);module[_0x1d0d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3059416..de79c76 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 _0x919e=['BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe919('0x0'));module[_0xe919('0x1')]={'body':{'type':Sequelize[_0xe919('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe919('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe919('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe919('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe919('0x5')]}}; \ No newline at end of file +var _0xf257=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x8ac6f9,_0x31a5a6){var _0x243ed5=function(_0xac099b){while(--_0xac099b){_0x8ac6f9['push'](_0x8ac6f9['shift']());}};_0x243ed5(++_0x31a5a6);}(_0xf257,0x82));var _0x7f25=function(_0x76bab3,_0x9ecc5e){_0x76bab3=_0x76bab3-0x0;var _0x3d584b=_0xf257[_0x76bab3];return _0x3d584b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x7f25('0x0')](_0x7f25('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7f25('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f25('0x3')]('in','out'),'defaultValue':_0x7f25('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7f25('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f25('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a2382ba..24d9bbd 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 _0xdb65=['end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','stack','name','index','rawAttributes','fieldName','type','map','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','find','body','catch','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','FaxInteraction','FaxInteractionId','update','UserId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','SIP/%s','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status'];(function(_0xbb8289,_0x498fae){var _0x35b600=function(_0xb53dbf){while(--_0xb53dbf){_0xbb8289['push'](_0xbb8289['shift']());}};_0x35b600(++_0x498fae);}(_0xdb65,0x66));var _0x5db6=function(_0x398378,_0x54e15e){_0x398378=_0x398378-0x0;var _0x55f1f0=_0xdb65[_0x398378];return _0x55f1f0;};'use strict';var emlformat=require(_0x5db6('0x0'));var rimraf=require(_0x5db6('0x1'));var zipdir=require(_0x5db6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5db6('0x3'));var moment=require(_0x5db6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5db6('0x5'));var util=require('util');var path=require(_0x5db6('0x6'));var sox=require('sox');var csv=require(_0x5db6('0x7'));var ejs=require(_0x5db6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5db6('0x9'));var squel=require(_0x5db6('0xa'));var crypto=require(_0x5db6('0xb'));var jsforce=require(_0x5db6('0xc'));var deskjs=require(_0x5db6('0xd'));var toCsv=require(_0x5db6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5db6('0xe'));var as=require(_0x5db6('0xf'));var hardwareService=require(_0x5db6('0x10'));var logger=require(_0x5db6('0x11'))(_0x5db6('0x12'));var utils=require(_0x5db6('0x13'));var config=require(_0x5db6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5db6('0x15'))['db'];config[_0x5db6('0x16')]=_[_0x5db6('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x5db6('0x18')](socket);var jayson=require(_0x5db6('0x19'));var client=jayson[_0x5db6('0x1a')][_0x5db6('0x1b')]({'port':0x232c});var client9002=jayson[_0x5db6('0x1a')][_0x5db6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5d6e07,_0x5ebaf5,_0x300e4a,_0x5e412f){return new BPromise(function(_0x13fb73,_0x3cae76){var _0x57c11b=_0x5e412f||client;return _0x57c11b[_0x5db6('0x1c')](_0x5d6e07,_0x300e4a)[_0x5db6('0x1d')](function(_0xf66c2){logger[_0x5db6('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x5ebaf5,_0x5db6('0x1f'));logger[_0x5db6('0x20')](_0x5db6('0x21'),_0x5ebaf5,_0x5db6('0x1f'),JSON[_0x5db6('0x22')](_0xf66c2));if(_0xf66c2[_0x5db6('0x23')]){if(_0xf66c2['error'][_0x5db6('0x24')]===0x1f4){logger[_0x5db6('0x23')]('FaxMessage,\x20%s,\x20%s',_0x5ebaf5,_0xf66c2[_0x5db6('0x23')][_0x5db6('0x25')]);return _0x3cae76(_0xf66c2['error'][_0x5db6('0x25')]);}logger[_0x5db6('0x23')]('FaxMessage,\x20%s,\x20%s',_0x5ebaf5,_0xf66c2[_0x5db6('0x23')][_0x5db6('0x25')]);return _0x13fb73(_0xf66c2['error'][_0x5db6('0x25')]);}else{logger[_0x5db6('0x1e')](_0x5db6('0x26'),_0x5ebaf5,'request\x20sent');_0x13fb73(_0xf66c2[_0x5db6('0x27')][_0x5db6('0x25')]);}})['catch'](function(_0x52b0e8){logger[_0x5db6('0x23')](_0x5db6('0x26'),_0x5ebaf5,_0x52b0e8);_0x3cae76(_0x52b0e8);});});}function respondWithStatusCode(_0x1ef4c7,_0x391dc2){_0x391dc2=_0x391dc2||0xcc;return function(_0x2f540d){if(_0x2f540d){return _0x1ef4c7[_0x5db6('0x28')](_0x391dc2);}return _0x1ef4c7[_0x5db6('0x29')](_0x391dc2)[_0x5db6('0x2a')]();};}function respondWithResult(_0x5b00b6,_0x35d74a){_0x35d74a=_0x35d74a||0xc8;return function(_0x3cdc1c){if(_0x3cdc1c){return _0x5b00b6[_0x5db6('0x29')](_0x35d74a)[_0x5db6('0x2b')](_0x3cdc1c);}};}function respondWithFilteredResult(_0x7e12c6,_0x535821){return function(_0x1e2fee){if(_0x1e2fee){var _0x2bb436=typeof _0x535821[_0x5db6('0x2c')]==='undefined'&&typeof _0x535821[_0x5db6('0x2d')]===_0x5db6('0x2e');var _0x576b3d=_0x1e2fee[_0x5db6('0x2f')];var _0xd3446c=_0x2bb436?0x0:_0x535821['offset'];var _0xe3b581=_0x2bb436?_0x1e2fee['count']:_0x535821['offset']+_0x535821['limit'];var _0x355411;if(_0xe3b581>=_0x576b3d){_0xe3b581=_0x576b3d;_0x355411=0xc8;}else{_0x355411=0xce;}_0x7e12c6[_0x5db6('0x29')](_0x355411);return _0x7e12c6['set'](_0x5db6('0x30'),_0xd3446c+'-'+_0xe3b581+'/'+_0x576b3d)['json'](_0x1e2fee);}return null;};}function patchUpdates(_0x23abef){return function(_0x86f8ee){try{jsonpatch[_0x5db6('0x31')](_0x86f8ee,_0x23abef,!![]);}catch(_0x2dec55){return BPromise[_0x5db6('0x32')](_0x2dec55);}return _0x86f8ee[_0x5db6('0x33')]();};}function saveUpdates(_0x153107,_0x4fe978){return function(_0x5868c8){if(_0x5868c8){return _0x5868c8['update'](_0x153107)[_0x5db6('0x1d')](function(_0x3b7421){return _0x3b7421;});}return null;};}function removeEntity(_0x3331a0,_0x4e0624){return function(_0x2a0536){if(_0x2a0536){return _0x2a0536[_0x5db6('0x34')]()[_0x5db6('0x1d')](function(){_0x3331a0[_0x5db6('0x29')](0xcc)[_0x5db6('0x2a')]();});}};}function handleEntityNotFound(_0x51ef52,_0x56e052){return function(_0x3f11c4){if(!_0x3f11c4){_0x51ef52[_0x5db6('0x28')](0x194);}return _0x3f11c4;};}function handleError(_0x486d3a,_0x1cbd2e){_0x1cbd2e=_0x1cbd2e||0x1f4;return function(_0x2a2902){logger[_0x5db6('0x23')](_0x2a2902[_0x5db6('0x35')]);if(_0x2a2902['name']){delete _0x2a2902[_0x5db6('0x36')];}_0x486d3a['status'](_0x1cbd2e)['send'](_0x2a2902);};}exports[_0x5db6('0x37')]=function(_0x752fb4,_0xdb51d){var _0x57219f={},_0x46f142={},_0x5ec474={'count':0x0,'rows':[]};var _0xd9c82a=_['map'](db['FaxMessage'][_0x5db6('0x38')],function(_0x5212af){return{'name':_0x5212af[_0x5db6('0x39')],'type':_0x5212af[_0x5db6('0x3a')]['key']};});_0x46f142['model']=_[_0x5db6('0x3b')](_0xd9c82a,_0x5db6('0x36'));_0x46f142[_0x5db6('0x3c')]=_[_0x5db6('0x3d')](_0x752fb4[_0x5db6('0x3c')]);_0x46f142['filters']=_['intersection'](_0x46f142['model'],_0x46f142[_0x5db6('0x3c')]);_0x57219f[_0x5db6('0x3e')]=_[_0x5db6('0x3f')](_0x46f142['model'],qs['fields'](_0x752fb4['query'][_0x5db6('0x40')]));_0x57219f[_0x5db6('0x3e')]=_0x57219f['attributes'][_0x5db6('0x41')]?_0x57219f[_0x5db6('0x3e')]:_0x46f142[_0x5db6('0x42')];if(!_0x752fb4[_0x5db6('0x3c')][_0x5db6('0x43')](_0x5db6('0x44'))){_0x57219f[_0x5db6('0x2d')]=qs[_0x5db6('0x2d')](_0x752fb4[_0x5db6('0x3c')][_0x5db6('0x2d')]);_0x57219f[_0x5db6('0x2c')]=qs['offset'](_0x752fb4[_0x5db6('0x3c')][_0x5db6('0x2c')]);}_0x57219f['order']=qs['sort'](_0x752fb4[_0x5db6('0x3c')]['sort']);_0x57219f[_0x5db6('0x45')]=qs[_0x5db6('0x46')](_[_0x5db6('0x47')](_0x752fb4[_0x5db6('0x3c')],_0x46f142[_0x5db6('0x46')]),_0xd9c82a);if(_0x752fb4[_0x5db6('0x3c')][_0x5db6('0x48')]){_0x57219f[_0x5db6('0x45')]=_[_0x5db6('0x49')](_0x57219f['where'],{'$or':_['map'](_0xd9c82a,function(_0x2a39a5){if(_0x2a39a5[_0x5db6('0x3a')]!==_0x5db6('0x4a')){var _0x569f34={};_0x569f34[_0x2a39a5[_0x5db6('0x36')]]={'$like':'%'+_0x752fb4[_0x5db6('0x3c')]['filter']+'%'};return _0x569f34;}})});}_0x57219f=_[_0x5db6('0x49')]({},_0x57219f,_0x752fb4[_0x5db6('0x4b')]);var _0x20cac9={'where':_0x57219f[_0x5db6('0x45')]};return db[_0x5db6('0x4c')]['count'](_0x20cac9)[_0x5db6('0x1d')](function(_0x4c0082){_0x5ec474[_0x5db6('0x2f')]=_0x4c0082;if(_0x752fb4[_0x5db6('0x3c')][_0x5db6('0x4d')]){_0x57219f[_0x5db6('0x4e')]=[{'all':!![]}];}return db[_0x5db6('0x4c')][_0x5db6('0x4f')](_0x57219f);})[_0x5db6('0x1d')](function(_0xaf312a){_0x5ec474[_0x5db6('0x50')]=_0xaf312a;return _0x5ec474;})['then'](respondWithFilteredResult(_0xdb51d,_0x57219f))['catch'](handleError(_0xdb51d,null));};exports[_0x5db6('0x51')]=function(_0x59eebf,_0x5b7a2c){var _0xd26c4f={'raw':!![],'where':{'id':_0x59eebf[_0x5db6('0x52')]['id']}},_0x555fea={};_0x555fea['model']=_[_0x5db6('0x3d')](db[_0x5db6('0x4c')][_0x5db6('0x38')]);_0x555fea[_0x5db6('0x3c')]=_['keys'](_0x59eebf[_0x5db6('0x3c')]);_0x555fea[_0x5db6('0x46')]=_[_0x5db6('0x3f')](_0x555fea[_0x5db6('0x42')],_0x555fea[_0x5db6('0x3c')]);_0xd26c4f['attributes']=_[_0x5db6('0x3f')](_0x555fea[_0x5db6('0x42')],qs['fields'](_0x59eebf[_0x5db6('0x3c')][_0x5db6('0x40')]));_0xd26c4f[_0x5db6('0x3e')]=_0xd26c4f[_0x5db6('0x3e')][_0x5db6('0x41')]?_0xd26c4f[_0x5db6('0x3e')]:_0x555fea[_0x5db6('0x42')];if(_0x59eebf[_0x5db6('0x3c')]['includeAll']){_0xd26c4f[_0x5db6('0x4e')]=[{'all':!![]}];}_0xd26c4f=_[_0x5db6('0x49')]({},_0xd26c4f,_0x59eebf['options']);return db[_0x5db6('0x4c')][_0x5db6('0x53')](_0xd26c4f)[_0x5db6('0x1d')](handleEntityNotFound(_0x5b7a2c,null))[_0x5db6('0x1d')](respondWithResult(_0x5b7a2c,null))['catch'](handleError(_0x5b7a2c,null));};exports['update']=function(_0x374f5e,_0x1edc3a){if(_0x374f5e[_0x5db6('0x54')]['id']){delete _0x374f5e['body']['id'];}return db['FaxMessage'][_0x5db6('0x53')]({'where':{'id':_0x374f5e[_0x5db6('0x52')]['id']}})[_0x5db6('0x1d')](handleEntityNotFound(_0x1edc3a,null))[_0x5db6('0x1d')](saveUpdates(_0x374f5e[_0x5db6('0x54')],null))['then'](respondWithResult(_0x1edc3a,null))[_0x5db6('0x55')](handleError(_0x1edc3a,null));};exports[_0x5db6('0x34')]=function(_0x56b49f,_0x543e71){return db[_0x5db6('0x4c')]['find']({'where':{'id':_0x56b49f[_0x5db6('0x52')]['id']}})[_0x5db6('0x1d')](handleEntityNotFound(_0x543e71,null))['then'](removeEntity(_0x543e71,null))[_0x5db6('0x55')](handleError(_0x543e71,null));};exports[_0x5db6('0x56')]=function(_0xd039e3,_0x5f321d){return db[_0x5db6('0x4c')][_0x5db6('0x56')]()[_0x5db6('0x1d')](respondWithResult(_0x5f321d,null))[_0x5db6('0x55')](handleError(_0x5f321d,null));};var interaction_log=require(_0x5db6('0x11'))(_0x5db6('0x57'));exports['accept']=function(_0x3326e0,_0xd98a4e,_0x19693d){var _0xfd1483={'agent':{},'channel':_0x5db6('0x58')};if(_0x3326e0[_0x5db6('0x54')]['id']){delete _0x3326e0[_0x5db6('0x54')]['id'];}_0x3326e0[_0x5db6('0x54')][_0x5db6('0x59')]=!![];_0x3326e0[_0x5db6('0x54')][_0x5db6('0x5a')]=moment()[_0x5db6('0x5b')](_0x5db6('0x5c'));_0x3326e0[_0x5db6('0x54')]['UserId']=_0x3326e0['body']['UserId']||_0x3326e0[_0x5db6('0x5d')]['id'];_0xfd1483[_0x5db6('0x5e')]['id']=_0x3326e0[_0x5db6('0x54')]['UserId'];return db[_0x5db6('0x4c')][_0x5db6('0x53')]({'where':{'id':_0x3326e0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd98a4e,null))[_0x5db6('0x1d')](saveUpdates(_0x3326e0[_0x5db6('0x54')],null))[_0x5db6('0x1d')](function(_0x25274a){if(_0x25274a){_0xfd1483[_0x5db6('0x25')]=_0x25274a['get']({'plain':!![]});return db[_0x5db6('0x5f')][_0x5db6('0x53')]({'where':{'id':_0x25274a[_0x5db6('0x60')]}});}return null;})[_0x5db6('0x1d')](handleEntityNotFound(_0xd98a4e,null))[_0x5db6('0x1d')](function(_0x4d1267){if(_0x4d1267){return _0x4d1267[_0x5db6('0x61')]({'UserId':_0x3326e0[_0x5db6('0x54')][_0x5db6('0x62')],'read1stAt':_[_0x5db6('0x63')](_0x4d1267[_0x5db6('0x64')])?moment()['format'](_0x5db6('0x5c')):undefined});}return null;})[_0x5db6('0x1d')](function(_0x4c968b){if(_0x4c968b){_0xfd1483[_0x5db6('0x65')]=_0x4c968b[_0x5db6('0x66')]({'plain':!![]});interaction_log[_0x5db6('0x1e')](_0x5db6('0x67'),_0x3326e0[_0x5db6('0x5d')]['id'],_0x3326e0[_0x5db6('0x5d')][_0x5db6('0x36')],_0x3326e0[_0x5db6('0x5d')][_0x5db6('0x68')],_0xfd1483[_0x5db6('0x65')]['id'],_0x3326e0[_0x5db6('0x54')]?JSON[_0x5db6('0x22')](_0x3326e0[_0x5db6('0x54')]):'null');return respondWithRpcPromise(_0x5db6('0x69'),_0x5db6('0x6a'),_0xfd1483);}return null;})['then'](function(_0x5a6844){var _0x559cdf=_0x5db6('0x6b')+_0x5a6844[_0x5db6('0x25')][_0x5db6('0x6c')];return db['sequelize'][_0x5db6('0x3c')](_0x559cdf,{'type':db['Sequelize'][_0x5db6('0x6d')][_0x5db6('0x6e')],'raw':!![]})[_0x5db6('0x1d')](function(_0x549319){return _0x549319;});})[_0x5db6('0x1d')](function(_0x179c3d){if(_0x179c3d){_0xfd1483[_0x5db6('0x25')][_0x5db6('0x6f')]=_0x179c3d[0x0];if(!_0x3326e0['body'][_0x5db6('0x62')])return;return db[_0x5db6('0x70')][_0x5db6('0x53')]({'where':{'id':_0x3326e0[_0x5db6('0x54')][_0x5db6('0x62')],'role':_0x5db6('0x5e')},'attributes':['id',_0x5db6('0x36'),_0x5db6('0x71'),_0x5db6('0x72'),_0x5db6('0x73')],'raw':!![]});}return null;})[_0x5db6('0x1d')](function(_0x32d079){if(!_0x32d079)return null;_0xfd1483[_0x5db6('0x25')]['agent']=_0x32d079;return _0xfd1483;})[_0x5db6('0x1d')](function(_0x5d38a1){if(_0x5d38a1){if(_0x3326e0['body'][_0x5db6('0x74')]){_0xfd1483[_0x5db6('0x25')][_0x5db6('0x75')]=util[_0x5db6('0x5b')]('SIP/%s',_0x3326e0[_0x5db6('0x5d')][_0x5db6('0x36')]);_0xfd1483['message'][_0x5db6('0x76')]=_0xfd1483[_0x5db6('0x76')];_0xfd1483[_0x5db6('0x25')][_0x5db6('0x77')]=_0xfd1483[_0x5db6('0x76')];_0xfd1483[_0x5db6('0x25')]['event']=_0x5db6('0x78');return respondWithRpcPromise('EventManager',_0x5db6('0x79'),{'event':_0x5db6('0x7a'),'message':_0xfd1483[_0x5db6('0x25')]},client9002)[_0x5db6('0x1d')](function(){return _0xfd1483;});}return _0xfd1483;}return null;})[_0x5db6('0x1d')](respondWithResult(_0xd98a4e,null))[_0x5db6('0x55')](handleError(_0xd98a4e,null));};var interaction_log=require(_0x5db6('0x11'))(_0x5db6('0x57'));exports['reject']=function(_0x2b9069,_0x4ebb36,_0x4f858f){var _0x27662d={'agent':{},'channel':'fax'};if(_0x2b9069['body']['id']){delete _0x2b9069[_0x5db6('0x54')]['id'];}_0x2b9069[_0x5db6('0x54')][_0x5db6('0x62')]=_0x2b9069[_0x5db6('0x54')][_0x5db6('0x62')]||_0x2b9069[_0x5db6('0x5d')]['id'];_0x27662d[_0x5db6('0x5e')]['id']=_0x2b9069['body'][_0x5db6('0x62')];return db['FaxMessage'][_0x5db6('0x53')]({'where':{'id':_0x2b9069[_0x5db6('0x52')]['id'],'UserId':null}})[_0x5db6('0x1d')](handleEntityNotFound(_0x4ebb36,null))['then'](function(_0x104fa9){if(_0x104fa9){_0x27662d[_0x5db6('0x25')]=_0x104fa9['get']({'plain':!![]});return db[_0x5db6('0x5f')][_0x5db6('0x53')]({'where':{'id':_0x104fa9[_0x5db6('0x60')]}});}return null;})[_0x5db6('0x1d')](handleEntityNotFound(_0x4ebb36,null))[_0x5db6('0x1d')](function(_0x362e11){if(_0x362e11){_0x27662d[_0x5db6('0x65')]=_0x362e11[_0x5db6('0x66')]({'plain':!![]});interaction_log[_0x5db6('0x1e')](_0x5db6('0x7b'),_0x2b9069[_0x5db6('0x5d')]['id'],_0x2b9069[_0x5db6('0x5d')][_0x5db6('0x36')],_0x2b9069[_0x5db6('0x5d')]['role'],_0x27662d[_0x5db6('0x65')]['id'],_0x2b9069[_0x5db6('0x54')]?JSON[_0x5db6('0x22')](_0x2b9069[_0x5db6('0x54')]):_0x5db6('0x7c'));return respondWithRpcPromise(_0x5db6('0x7d'),_0x5db6('0x7e'),_0x27662d);}return null;})[_0x5db6('0x1d')](function(_0x2307bd){var _0x1dcacd=_0x5db6('0x6b')+_0x2307bd[_0x5db6('0x25')][_0x5db6('0x6c')];return db[_0x5db6('0x7f')][_0x5db6('0x3c')](_0x1dcacd,{'type':db['Sequelize'][_0x5db6('0x6d')][_0x5db6('0x6e')],'raw':!![]})[_0x5db6('0x1d')](function(_0x305442){return _0x305442;});})[_0x5db6('0x1d')](function(_0x595463){if(_0x595463){_0x27662d[_0x5db6('0x25')][_0x5db6('0x6f')]=_0x595463[0x0];if(!_0x2b9069['body'][_0x5db6('0x62')])return;return db[_0x5db6('0x70')][_0x5db6('0x53')]({'where':{'id':_0x2b9069[_0x5db6('0x54')][_0x5db6('0x62')],'role':'agent'},'attributes':['id',_0x5db6('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x52c5f2){if(!_0x52c5f2)return null;_0x27662d[_0x5db6('0x25')][_0x5db6('0x5e')]=_0x52c5f2;return _0x27662d;})[_0x5db6('0x1d')](function(_0x271bd7){if(_0x271bd7){_0x271bd7[_0x5db6('0x25')]['interface']=util[_0x5db6('0x5b')](_0x5db6('0x80'),_0x2b9069[_0x5db6('0x5d')][_0x5db6('0x36')]);_0x271bd7['message'][_0x5db6('0x76')]=_0x27662d['channel'];_0x271bd7[_0x5db6('0x25')][_0x5db6('0x77')]=_0x27662d['channel'];_0x271bd7[_0x5db6('0x25')][_0x5db6('0x81')]=_0x5db6('0x32');respondWithRpcPromise(_0x5db6('0x79'),'EventManager',{'event':_0x5db6('0x82'),'message':_0x271bd7['message']},client9002);return _0x27662d;}return null;})['then'](respondWithResult(_0x4ebb36,null))[_0x5db6('0x55')](handleError(_0x4ebb36,null));};exports[_0x5db6('0x83')]=function(_0x299ec8,_0xa06ee8){var _0x4c5a6a;return db[_0x5db6('0x4c')][_0x5db6('0x83')](_0x299ec8[_0x5db6('0x54')],{})[_0x5db6('0x1d')](function(_0x32636d){_0x4c5a6a=_0x32636d;return db[_0x5db6('0x84')][_0x5db6('0x85')]({'where':{'id':_0x4c5a6a[_0x5db6('0x6c')]}});})[_0x5db6('0x1d')](function(_0x30ef24){if(_['isNil'](_0x30ef24)){return;}else{_0x4c5a6a[_0x5db6('0x58')]=_0x30ef24[_0x5db6('0x58')];return db[_0x5db6('0x86')][_0x5db6('0x85')]({'where':{'id':_0x4c5a6a[_0x5db6('0x87')]}});}})[_0x5db6('0x1d')](function(_0x319fbd){return respondWithRpcPromise(_0x5db6('0x88'),_0x5db6('0x88'),{'FaxAccountId':_[_0x5db6('0x63')](_0x299ec8[_0x5db6('0x54')])?undefined:_0x299ec8[_0x5db6('0x54')]['FaxAccountId'],'path':_[_0x5db6('0x63')](_0x319fbd)?undefined:util[_0x5db6('0x5b')](_0x5db6('0x89'),_0x319fbd[_0x5db6('0x8a')]),'fax':_['isNil'](_0x4c5a6a[_0x5db6('0x58')])?undefined:_0x4c5a6a[_0x5db6('0x58')],'AttachmentId':_0x4c5a6a[_0x5db6('0x87')]},client9002);})[_0x5db6('0x1d')](respondWithResult(_0xa06ee8,0xc9))[_0x5db6('0x55')](handleError(_0xa06ee8,null));};exports[_0x5db6('0x8b')]=function(_0x988540,_0x2cb893){var _0x7a5ed3=path[_0x5db6('0x8c')](config[_0x5db6('0x8d')],_0x5db6('0x8e'),_0x5db6('0x8f'),'attachments');return db[_0x5db6('0x4c')][_0x5db6('0x53')]({'where':{'id':_0x988540[_0x5db6('0x52')]['id']},'include':[{'model':db[_0x5db6('0x86')],'as':'Attachment'}]})[_0x5db6('0x1d')](handleEntityNotFound(_0x2cb893,null))[_0x5db6('0x1d')](function(_0x226e4a){if(_0x226e4a){return _0x2cb893[_0x5db6('0x8b')](path[_0x5db6('0x8c')](_0x7a5ed3,_0x226e4a[_0x5db6('0x86')][_0x5db6('0x8a')]));}})['catch'](handleError(_0x2cb893,null));}; \ No newline at end of file +var _0xfb9d=['order','sort','where','pick','type','filter','merge','options','include','findAll','rows','show','length','includeAll','find','body','params','describe','fax-interactions','accept','fax','format','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','agent','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','basename','root','files','attachments','join','eml-format','rimraf','zip-dir','moment','bluebird','util','path','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','nolimit'];(function(_0x30afaf,_0x5b88f5){var _0x2abb82=function(_0x1f36c5){while(--_0x1f36c5){_0x30afaf['push'](_0x30afaf['shift']());}};_0x2abb82(++_0x5b88f5);}(_0xfb9d,0x1e9));var _0xdfb9=function(_0x18173a,_0x50d102){_0x18173a=_0x18173a-0x0;var _0x57545a=_0xfb9d[_0x18173a];return _0x57545a;};'use strict';var emlformat=require(_0xdfb9('0x0'));var rimraf=require(_0xdfb9('0x1'));var zipdir=require(_0xdfb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdfb9('0x3'));var BPromise=require(_0xdfb9('0x4'));var Mustache=require('mustache');var util=require(_0xdfb9('0x5'));var path=require(_0xdfb9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdfb9('0x7'));var fs=require('fs');var fs_extra=require(_0xdfb9('0x8'));var _=require(_0xdfb9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdfb9('0xa'));var querystring=require(_0xdfb9('0xb'));var Papa=require(_0xdfb9('0xc'));var Redis=require(_0xdfb9('0xd'));var authService=require(_0xdfb9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdfb9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfb9('0x10'))(_0xdfb9('0x11'));var utils=require(_0xdfb9('0x12'));var config=require(_0xdfb9('0x13'));var licenseUtil=require(_0xdfb9('0x14'));var db=require(_0xdfb9('0x15'))['db'];config[_0xdfb9('0x16')]=_[_0xdfb9('0x17')](config[_0xdfb9('0x16')],{'host':_0xdfb9('0x18'),'port':0x18eb});var socket=require(_0xdfb9('0x19'))(new Redis(config[_0xdfb9('0x16')]));require(_0xdfb9('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdfb9('0x1b')][_0xdfb9('0x1c')]({'port':0x232c});var client9002=jayson[_0xdfb9('0x1b')][_0xdfb9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f08c1,_0x101e2b,_0x1cba50,_0x23ba17){return new BPromise(function(_0x354609,_0x219692){var _0x48a2a2=_0x23ba17||client;return _0x48a2a2[_0xdfb9('0x1d')](_0x2f08c1,_0x1cba50)[_0xdfb9('0x1e')](function(_0x381071){logger[_0xdfb9('0x1f')](_0xdfb9('0x20'),_0x101e2b,_0xdfb9('0x21'));logger['debug'](_0xdfb9('0x22'),_0x101e2b,'request\x20sent',JSON[_0xdfb9('0x23')](_0x381071));if(_0x381071[_0xdfb9('0x24')]){if(_0x381071[_0xdfb9('0x24')][_0xdfb9('0x25')]===0x1f4){logger[_0xdfb9('0x24')](_0xdfb9('0x20'),_0x101e2b,_0x381071[_0xdfb9('0x24')]['message']);return _0x219692(_0x381071[_0xdfb9('0x24')][_0xdfb9('0x26')]);}logger[_0xdfb9('0x24')](_0xdfb9('0x20'),_0x101e2b,_0x381071[_0xdfb9('0x24')]['message']);return _0x354609(_0x381071['error']['message']);}else{logger['info'](_0xdfb9('0x20'),_0x101e2b,_0xdfb9('0x21'));_0x354609(_0x381071[_0xdfb9('0x27')]['message']);}})[_0xdfb9('0x28')](function(_0x11409c){logger[_0xdfb9('0x24')](_0xdfb9('0x20'),_0x101e2b,_0x11409c);_0x219692(_0x11409c);});});}function respondWithStatusCode(_0x10ca19,_0x3e80cc){_0x3e80cc=_0x3e80cc||0xcc;return function(_0x490746){if(_0x490746){return _0x10ca19[_0xdfb9('0x29')](_0x3e80cc);}return _0x10ca19[_0xdfb9('0x2a')](_0x3e80cc)['end']();};}function respondWithResult(_0x1e3349,_0x1eb52f){_0x1eb52f=_0x1eb52f||0xc8;return function(_0x3f982a){if(_0x3f982a){return _0x1e3349[_0xdfb9('0x2a')](_0x1eb52f)[_0xdfb9('0x2b')](_0x3f982a);}};}function respondWithFilteredResult(_0x3c4a00,_0xbf2b5a){return function(_0x52e238){if(_0x52e238){var _0xc4907=typeof _0xbf2b5a[_0xdfb9('0x2c')]===_0xdfb9('0x2d')&&typeof _0xbf2b5a['limit']===_0xdfb9('0x2d');var _0xba859=_0x52e238['count'];var _0x56f5ca=_0xc4907?0x0:_0xbf2b5a['offset'];var _0x22c11a=_0xc4907?_0x52e238[_0xdfb9('0x2e')]:_0xbf2b5a['offset']+_0xbf2b5a[_0xdfb9('0x2f')];var _0x1c3de1;if(_0x22c11a>=_0xba859){_0x22c11a=_0xba859;_0x1c3de1=0xc8;}else{_0x1c3de1=0xce;}_0x3c4a00['status'](_0x1c3de1);return _0x3c4a00[_0xdfb9('0x30')](_0xdfb9('0x31'),_0x56f5ca+'-'+_0x22c11a+'/'+_0xba859)[_0xdfb9('0x2b')](_0x52e238);}return null;};}function patchUpdates(_0x8844c7){return function(_0x39260f){try{jsonpatch[_0xdfb9('0x32')](_0x39260f,_0x8844c7,!![]);}catch(_0x5d318f){return BPromise[_0xdfb9('0x33')](_0x5d318f);}return _0x39260f[_0xdfb9('0x34')]();};}function saveUpdates(_0x3d6a8d,_0x46d9b3){return function(_0x2266a3){if(_0x2266a3){return _0x2266a3[_0xdfb9('0x35')](_0x3d6a8d)[_0xdfb9('0x1e')](function(_0x1697ec){return _0x1697ec;});}return null;};}function removeEntity(_0x30ebf3,_0x4ec064){return function(_0x36e5a6){if(_0x36e5a6){return _0x36e5a6[_0xdfb9('0x36')]()['then'](function(){_0x30ebf3[_0xdfb9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1706,_0x30502e){return function(_0x4dfda5){if(!_0x4dfda5){_0x2b1706[_0xdfb9('0x29')](0x194);}return _0x4dfda5;};}function handleError(_0x5c2f0a,_0x3b26fc){_0x3b26fc=_0x3b26fc||0x1f4;return function(_0x109f21){logger[_0xdfb9('0x24')](_0x109f21[_0xdfb9('0x37')]);if(_0x109f21[_0xdfb9('0x38')]){delete _0x109f21[_0xdfb9('0x38')];}_0x5c2f0a[_0xdfb9('0x2a')](_0x3b26fc)[_0xdfb9('0x39')](_0x109f21);};}exports[_0xdfb9('0x3a')]=function(_0x66e108,_0x241343){var _0x47d404={},_0x43d44f={},_0x281408={'count':0x0,'rows':[]};var _0x58dd86=_[_0xdfb9('0x3b')](db[_0xdfb9('0x3c')][_0xdfb9('0x3d')],function(_0x55f865){return{'name':_0x55f865['fieldName'],'type':_0x55f865['type'][_0xdfb9('0x3e')]};});_0x43d44f[_0xdfb9('0x3f')]=_[_0xdfb9('0x3b')](_0x58dd86,_0xdfb9('0x38'));_0x43d44f['query']=_[_0xdfb9('0x40')](_0x66e108[_0xdfb9('0x41')]);_0x43d44f[_0xdfb9('0x42')]=_[_0xdfb9('0x43')](_0x43d44f['model'],_0x43d44f[_0xdfb9('0x41')]);_0x47d404[_0xdfb9('0x44')]=_['intersection'](_0x43d44f['model'],qs[_0xdfb9('0x45')](_0x66e108[_0xdfb9('0x41')]['fields']));_0x47d404[_0xdfb9('0x44')]=_0x47d404['attributes']['length']?_0x47d404[_0xdfb9('0x44')]:_0x43d44f['model'];if(!_0x66e108[_0xdfb9('0x41')]['hasOwnProperty'](_0xdfb9('0x46'))){_0x47d404[_0xdfb9('0x2f')]=qs['limit'](_0x66e108[_0xdfb9('0x41')]['limit']);_0x47d404[_0xdfb9('0x2c')]=qs['offset'](_0x66e108['query'][_0xdfb9('0x2c')]);}_0x47d404[_0xdfb9('0x47')]=qs[_0xdfb9('0x48')](_0x66e108[_0xdfb9('0x41')][_0xdfb9('0x48')]);_0x47d404[_0xdfb9('0x49')]=qs[_0xdfb9('0x42')](_[_0xdfb9('0x4a')](_0x66e108[_0xdfb9('0x41')],_0x43d44f[_0xdfb9('0x42')]),_0x58dd86);if(_0x66e108[_0xdfb9('0x41')]['filter']){_0x47d404['where']=_['merge'](_0x47d404[_0xdfb9('0x49')],{'$or':_[_0xdfb9('0x3b')](_0x58dd86,function(_0x573520){if(_0x573520[_0xdfb9('0x4b')]!=='VIRTUAL'){var _0x488a31={};_0x488a31[_0x573520[_0xdfb9('0x38')]]={'$like':'%'+_0x66e108[_0xdfb9('0x41')][_0xdfb9('0x4c')]+'%'};return _0x488a31;}})});}_0x47d404=_[_0xdfb9('0x4d')]({},_0x47d404,_0x66e108[_0xdfb9('0x4e')]);var _0x438908={'where':_0x47d404[_0xdfb9('0x49')]};return db['FaxMessage']['count'](_0x438908)[_0xdfb9('0x1e')](function(_0x35b02a){_0x281408[_0xdfb9('0x2e')]=_0x35b02a;if(_0x66e108[_0xdfb9('0x41')]['includeAll']){_0x47d404[_0xdfb9('0x4f')]=[{'all':!![]}];}return db[_0xdfb9('0x3c')][_0xdfb9('0x50')](_0x47d404);})['then'](function(_0x23f903){_0x281408[_0xdfb9('0x51')]=_0x23f903;return _0x281408;})[_0xdfb9('0x1e')](respondWithFilteredResult(_0x241343,_0x47d404))['catch'](handleError(_0x241343,null));};exports[_0xdfb9('0x52')]=function(_0x3dbc06,_0x49554){var _0x546499={'raw':!![],'where':{'id':_0x3dbc06['params']['id']}},_0x1705f3={};_0x1705f3[_0xdfb9('0x3f')]=_['keys'](db[_0xdfb9('0x3c')][_0xdfb9('0x3d')]);_0x1705f3[_0xdfb9('0x41')]=_['keys'](_0x3dbc06['query']);_0x1705f3['filters']=_[_0xdfb9('0x43')](_0x1705f3[_0xdfb9('0x3f')],_0x1705f3[_0xdfb9('0x41')]);_0x546499[_0xdfb9('0x44')]=_[_0xdfb9('0x43')](_0x1705f3[_0xdfb9('0x3f')],qs['fields'](_0x3dbc06[_0xdfb9('0x41')][_0xdfb9('0x45')]));_0x546499['attributes']=_0x546499[_0xdfb9('0x44')][_0xdfb9('0x53')]?_0x546499[_0xdfb9('0x44')]:_0x1705f3[_0xdfb9('0x3f')];if(_0x3dbc06[_0xdfb9('0x41')][_0xdfb9('0x54')]){_0x546499['include']=[{'all':!![]}];}_0x546499=_[_0xdfb9('0x4d')]({},_0x546499,_0x3dbc06['options']);return db['FaxMessage'][_0xdfb9('0x55')](_0x546499)[_0xdfb9('0x1e')](handleEntityNotFound(_0x49554,null))[_0xdfb9('0x1e')](respondWithResult(_0x49554,null))[_0xdfb9('0x28')](handleError(_0x49554,null));};exports[_0xdfb9('0x35')]=function(_0x1493f8,_0x4b42a4){if(_0x1493f8[_0xdfb9('0x56')]['id']){delete _0x1493f8[_0xdfb9('0x56')]['id'];}return db['FaxMessage'][_0xdfb9('0x55')]({'where':{'id':_0x1493f8[_0xdfb9('0x57')]['id']}})[_0xdfb9('0x1e')](handleEntityNotFound(_0x4b42a4,null))['then'](saveUpdates(_0x1493f8[_0xdfb9('0x56')],null))['then'](respondWithResult(_0x4b42a4,null))[_0xdfb9('0x28')](handleError(_0x4b42a4,null));};exports[_0xdfb9('0x36')]=function(_0x424b67,_0x2f2ceb){return db[_0xdfb9('0x3c')]['find']({'where':{'id':_0x424b67['params']['id']}})[_0xdfb9('0x1e')](handleEntityNotFound(_0x2f2ceb,null))[_0xdfb9('0x1e')](removeEntity(_0x2f2ceb,null))[_0xdfb9('0x28')](handleError(_0x2f2ceb,null));};exports['describe']=function(_0x22d892,_0x48d7e0){return db[_0xdfb9('0x3c')][_0xdfb9('0x58')]()[_0xdfb9('0x1e')](respondWithResult(_0x48d7e0,null))[_0xdfb9('0x28')](handleError(_0x48d7e0,null));};var interaction_log=require(_0xdfb9('0x10'))(_0xdfb9('0x59'));exports[_0xdfb9('0x5a')]=function(_0x521427,_0x34c272,_0x1f7c66){var _0x241dda={'agent':{},'channel':_0xdfb9('0x5b')};if(_0x521427['body']['id']){delete _0x521427['body']['id'];}_0x521427[_0xdfb9('0x56')]['read']=!![];_0x521427['body']['readAt']=moment()[_0xdfb9('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x521427['body'][_0xdfb9('0x5d')]=_0x521427[_0xdfb9('0x56')]['UserId']||_0x521427[_0xdfb9('0x5e')]['id'];_0x241dda['agent']['id']=_0x521427[_0xdfb9('0x56')][_0xdfb9('0x5d')];return db[_0xdfb9('0x3c')][_0xdfb9('0x55')]({'where':{'id':_0x521427['params']['id'],'UserId':null}})[_0xdfb9('0x1e')](handleEntityNotFound(_0x34c272,null))[_0xdfb9('0x1e')](saveUpdates(_0x521427[_0xdfb9('0x56')],null))['then'](function(_0x36f4be){if(_0x36f4be){_0x241dda[_0xdfb9('0x26')]=_0x36f4be[_0xdfb9('0x5f')]({'plain':!![]});return db[_0xdfb9('0x60')]['find']({'where':{'id':_0x36f4be[_0xdfb9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x34c272,null))[_0xdfb9('0x1e')](function(_0x3e5880){if(_0x3e5880){return _0x3e5880[_0xdfb9('0x35')]({'UserId':_0x521427['body'][_0xdfb9('0x5d')],'read1stAt':_[_0xdfb9('0x62')](_0x3e5880[_0xdfb9('0x63')])?moment()[_0xdfb9('0x5c')](_0xdfb9('0x64')):undefined});}return null;})[_0xdfb9('0x1e')](function(_0x2ad2a6){if(_0x2ad2a6){_0x241dda[_0xdfb9('0x65')]=_0x2ad2a6[_0xdfb9('0x5f')]({'plain':!![]});interaction_log['info'](_0xdfb9('0x66'),_0x521427['user']['id'],_0x521427['user'][_0xdfb9('0x38')],_0x521427['user'][_0xdfb9('0x67')],_0x241dda[_0xdfb9('0x65')]['id'],_0x521427[_0xdfb9('0x56')]?JSON[_0xdfb9('0x23')](_0x521427[_0xdfb9('0x56')]):_0xdfb9('0x68'));return respondWithRpcPromise(_0xdfb9('0x69'),'acceptMessage',_0x241dda);}return null;})[_0xdfb9('0x1e')](function(_0x2d1a17){var _0xdb0019=_0xdfb9('0x6a')+_0x2d1a17[_0xdfb9('0x26')][_0xdfb9('0x6b')];return db[_0xdfb9('0x6c')][_0xdfb9('0x41')](_0xdb0019,{'type':db[_0xdfb9('0x6d')][_0xdfb9('0x6e')][_0xdfb9('0x6f')],'raw':!![]})[_0xdfb9('0x1e')](function(_0x1d8be6){return _0x1d8be6;});})[_0xdfb9('0x1e')](function(_0x128c21){if(_0x128c21){_0x241dda['message'][_0xdfb9('0x70')]=_0x128c21[0x0];if(!_0x521427[_0xdfb9('0x56')]['UserId'])return;return db[_0xdfb9('0x71')]['find']({'where':{'id':_0x521427['body']['UserId'],'role':'agent'},'attributes':['id','name',_0xdfb9('0x72'),'email',_0xdfb9('0x73')],'raw':!![]});}return null;})[_0xdfb9('0x1e')](function(_0x4e9ac7){if(!_0x4e9ac7)return null;_0x241dda[_0xdfb9('0x26')][_0xdfb9('0x74')]=_0x4e9ac7;return _0x241dda;})[_0xdfb9('0x1e')](function(_0x3fa2f7){if(_0x3fa2f7){if(_0x521427[_0xdfb9('0x56')][_0xdfb9('0x75')]){_0x241dda[_0xdfb9('0x26')]['interface']=util['format'](_0xdfb9('0x76'),_0x521427[_0xdfb9('0x5e')][_0xdfb9('0x38')]);_0x241dda[_0xdfb9('0x26')]['channel']=_0x241dda[_0xdfb9('0x77')];_0x241dda[_0xdfb9('0x26')][_0xdfb9('0x78')]=_0x241dda[_0xdfb9('0x77')];_0x241dda[_0xdfb9('0x26')][_0xdfb9('0x79')]=_0xdfb9('0x5a');return respondWithRpcPromise('EventManager',_0xdfb9('0x7a'),{'event':_0xdfb9('0x7b'),'message':_0x241dda[_0xdfb9('0x26')]},client9002)[_0xdfb9('0x1e')](function(){return _0x241dda;});}return _0x241dda;}return null;})[_0xdfb9('0x1e')](respondWithResult(_0x34c272,null))[_0xdfb9('0x28')](handleError(_0x34c272,null));};var interaction_log=require(_0xdfb9('0x10'))(_0xdfb9('0x59'));exports['reject']=function(_0x45c2fe,_0x4f3ffe,_0x3b2333){var _0x18151e={'agent':{},'channel':_0xdfb9('0x5b')};if(_0x45c2fe[_0xdfb9('0x56')]['id']){delete _0x45c2fe[_0xdfb9('0x56')]['id'];}_0x45c2fe[_0xdfb9('0x56')][_0xdfb9('0x5d')]=_0x45c2fe['body'][_0xdfb9('0x5d')]||_0x45c2fe['user']['id'];_0x18151e[_0xdfb9('0x74')]['id']=_0x45c2fe[_0xdfb9('0x56')]['UserId'];return db[_0xdfb9('0x3c')][_0xdfb9('0x55')]({'where':{'id':_0x45c2fe['params']['id'],'UserId':null}})[_0xdfb9('0x1e')](handleEntityNotFound(_0x4f3ffe,null))[_0xdfb9('0x1e')](function(_0x229bca){if(_0x229bca){_0x18151e[_0xdfb9('0x26')]=_0x229bca[_0xdfb9('0x5f')]({'plain':!![]});return db[_0xdfb9('0x60')][_0xdfb9('0x55')]({'where':{'id':_0x229bca[_0xdfb9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x4f3ffe,null))[_0xdfb9('0x1e')](function(_0x34584d){if(_0x34584d){_0x18151e[_0xdfb9('0x65')]=_0x34584d['get']({'plain':!![]});interaction_log['info'](_0xdfb9('0x7c'),_0x45c2fe[_0xdfb9('0x5e')]['id'],_0x45c2fe['user'][_0xdfb9('0x38')],_0x45c2fe['user'][_0xdfb9('0x67')],_0x18151e['interaction']['id'],_0x45c2fe[_0xdfb9('0x56')]?JSON[_0xdfb9('0x23')](_0x45c2fe['body']):_0xdfb9('0x68'));return respondWithRpcPromise('RejectMessage',_0xdfb9('0x7d'),_0x18151e);}return null;})['then'](function(_0x3c2a65){var _0x480244='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c2a65[_0xdfb9('0x26')]['ContactId'];return db[_0xdfb9('0x6c')][_0xdfb9('0x41')](_0x480244,{'type':db[_0xdfb9('0x6d')][_0xdfb9('0x6e')][_0xdfb9('0x6f')],'raw':!![]})['then'](function(_0x4a5322){return _0x4a5322;});})[_0xdfb9('0x1e')](function(_0xa1e4e9){if(_0xa1e4e9){_0x18151e[_0xdfb9('0x26')][_0xdfb9('0x70')]=_0xa1e4e9[0x0];if(!_0x45c2fe[_0xdfb9('0x56')][_0xdfb9('0x5d')])return;return db[_0xdfb9('0x71')][_0xdfb9('0x55')]({'where':{'id':_0x45c2fe[_0xdfb9('0x56')][_0xdfb9('0x5d')],'role':_0xdfb9('0x74')},'attributes':['id',_0xdfb9('0x38'),_0xdfb9('0x72'),_0xdfb9('0x7e'),_0xdfb9('0x73')],'raw':!![]});}return null;})[_0xdfb9('0x1e')](function(_0x5c7b69){if(!_0x5c7b69)return null;_0x18151e[_0xdfb9('0x26')]['agent']=_0x5c7b69;return _0x18151e;})[_0xdfb9('0x1e')](function(_0x156b51){if(_0x156b51){_0x156b51[_0xdfb9('0x26')][_0xdfb9('0x7f')]=util[_0xdfb9('0x5c')]('SIP/%s',_0x45c2fe['user'][_0xdfb9('0x38')]);_0x156b51['message'][_0xdfb9('0x77')]=_0x18151e[_0xdfb9('0x77')];_0x156b51[_0xdfb9('0x26')][_0xdfb9('0x78')]=_0x18151e['channel'];_0x156b51['message'][_0xdfb9('0x79')]=_0xdfb9('0x33');respondWithRpcPromise(_0xdfb9('0x7a'),_0xdfb9('0x7a'),{'event':_0xdfb9('0x80'),'message':_0x156b51[_0xdfb9('0x26')]},client9002);return _0x18151e;}return null;})[_0xdfb9('0x1e')](respondWithResult(_0x4f3ffe,null))[_0xdfb9('0x28')](handleError(_0x4f3ffe,null));};exports[_0xdfb9('0x81')]=function(_0x2a63a0,_0x6a2743){var _0xbd9a9;return db['FaxMessage'][_0xdfb9('0x81')](_0x2a63a0[_0xdfb9('0x56')],{})['then'](function(_0x11d287){_0xbd9a9=_0x11d287;return db[_0xdfb9('0x82')][_0xdfb9('0x83')]({'where':{'id':_0xbd9a9[_0xdfb9('0x6b')]}});})[_0xdfb9('0x1e')](function(_0x287acc){if(_[_0xdfb9('0x62')](_0x287acc)){return;}else{_0xbd9a9['fax']=_0x287acc[_0xdfb9('0x5b')];return db[_0xdfb9('0x84')][_0xdfb9('0x83')]({'where':{'id':_0xbd9a9[_0xdfb9('0x85')]}});}})[_0xdfb9('0x1e')](function(_0x50fcfa){return respondWithRpcPromise(_0xdfb9('0x86'),'SendFax',{'FaxAccountId':_[_0xdfb9('0x62')](_0x2a63a0[_0xdfb9('0x56')])?undefined:_0x2a63a0[_0xdfb9('0x56')]['FaxAccountId'],'path':_['isNil'](_0x50fcfa)?undefined:util[_0xdfb9('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x50fcfa[_0xdfb9('0x87')]),'fax':_['isNil'](_0xbd9a9['fax'])?undefined:_0xbd9a9[_0xdfb9('0x5b')],'AttachmentId':_0xbd9a9[_0xdfb9('0x85')]},client9002);})[_0xdfb9('0x1e')](respondWithResult(_0x6a2743,0xc9))[_0xdfb9('0x28')](handleError(_0x6a2743,null));};exports['download']=function(_0x115dac,_0xe928bc){var _0x34a39f=path['join'](config[_0xdfb9('0x88')],'server',_0xdfb9('0x89'),_0xdfb9('0x8a'));return db[_0xdfb9('0x3c')][_0xdfb9('0x55')]({'where':{'id':_0x115dac[_0xdfb9('0x57')]['id']},'include':[{'model':db[_0xdfb9('0x84')],'as':_0xdfb9('0x84')}]})[_0xdfb9('0x1e')](handleEntityNotFound(_0xe928bc,null))[_0xdfb9('0x1e')](function(_0xcd5791){if(_0xcd5791){return _0xe928bc['download'](path[_0xdfb9('0x8b')](_0x34a39f,_0xcd5791[_0xdfb9('0x84')][_0xdfb9('0x87')]));}})['catch'](handleError(_0xe928bc,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a49352a..2a18e69 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 _0x38b8=['exports','events','FaxMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x453e6b,_0x385241){var _0xf3b6cc=function(_0x22da2e){while(--_0x22da2e){_0x453e6b['push'](_0x453e6b['shift']());}};_0xf3b6cc(++_0x385241);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x838b('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x838b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x838b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x838b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x589ced){return function(_0x31bfb6,_0xd8b053,_0x5a3cca){FaxMessageEvents['emit'](_0x589ced+':'+_0x31bfb6['id'],_0x31bfb6);FaxMessageEvents[_0x838b('0x4')](_0x589ced,_0x31bfb6);_0x5a3cca(null);};}for(var e in events){if(events[_0x838b('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x838b('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x794b=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x794b,0x1c2));var _0xb794=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0x794b[_0x32f05c];return _0x4307ed;};'use strict';var EventEmitter=require(_0xb794('0x0'));var FaxMessage=require(_0xb794('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb794('0x2')](0x0);var events={'afterCreate':_0xb794('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf9af2a){return function(_0x241c85,_0x4d00a4,_0x5dc6dc){FaxMessageEvents[_0xb794('0x4')](_0xf9af2a+':'+_0x241c85['id'],_0x241c85);FaxMessageEvents[_0xb794('0x4')](_0xf9af2a,_0x241c85);_0x5dc6dc(null);};}for(var e in events){if(events[_0xb794('0x5')](e)){var event=events[e];FaxMessage[_0xb794('0x6')](e,emitEvent(event));}}module[_0xb794('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 b3403f5..4d4bb8f 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 _0x8bde=['body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x8bde,0x1d0));var _0xe8bd=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8bde[_0x543084];return _0x306a57;};'use strict';var _=require(_0xe8bd('0x0'));var util=require(_0xe8bd('0x1'));var logger=require(_0xe8bd('0x2'))(_0xe8bd('0x3'));var moment=require(_0xe8bd('0x4'));var BPromise=require(_0xe8bd('0x5'));var rp=require(_0xe8bd('0x6'));var fs=require('fs');var path=require(_0xe8bd('0x7'));var rimraf=require(_0xe8bd('0x8'));var config=require(_0xe8bd('0x9'));var attributes=require(_0xe8bd('0xa'));module[_0xe8bd('0xb')]=function(_0x54a114,_0x20a117){return _0x54a114[_0xe8bd('0xc')](_0xe8bd('0xd'),attributes,{'tableName':_0xe8bd('0xe'),'paranoid':![],'indexes':[{'name':_0xe8bd('0xf'),'fields':[_0xe8bd('0x10')],'type':_0xe8bd('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59b963,_0xea8e76,_0x1c1431){var _0x1835bc=_0x54a114[_0xe8bd('0x12')];var _0x10a675=_0x59b963['get']({'plain':!![]});if(_0x10a675[_0xe8bd('0x13')][_0xe8bd('0x14')]()==='in'||_0x10a675['direction'][_0xe8bd('0x14')]()===_0xe8bd('0x15')&&!_0x10a675['secret']&&!_[_0xe8bd('0x16')](_0x10a675[_0xe8bd('0x17')])){_0x1835bc['FaxInteraction'][_0xe8bd('0x18')]({'where':{'id':_0x10a675[_0xe8bd('0x19')]}})['then'](function(_0x32c9a1){if(_0x32c9a1){_0x32c9a1[_0xe8bd('0x1a')]({'lastMsgAt':_0x10a675[_0xe8bd('0x1b')],'lastMsgDirection':_0x10a675[_0xe8bd('0x13')][_0xe8bd('0x14')]()});}})[_0xe8bd('0x1c')](function(_0x1b95ac){console[_0xe8bd('0x1d')](_0x1b95ac);});}_0x1c1431();}},'charset':_0xe8bd('0x1e'),'collate':_0xe8bd('0x1f')});}; \ No newline at end of file +var _0x8396=['FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8396,0x1b1));var _0x6839=function(_0x24e570,_0x6dce0a){_0x24e570=_0x24e570-0x0;var _0x4930ee=_0x8396[_0x24e570];return _0x4930ee;};'use strict';var _=require(_0x6839('0x0'));var util=require(_0x6839('0x1'));var logger=require(_0x6839('0x2'))(_0x6839('0x3'));var moment=require(_0x6839('0x4'));var BPromise=require(_0x6839('0x5'));var rp=require(_0x6839('0x6'));var fs=require('fs');var path=require(_0x6839('0x7'));var rimraf=require(_0x6839('0x8'));var config=require(_0x6839('0x9'));var attributes=require(_0x6839('0xa'));module['exports']=function(_0x575681,_0x224959){return _0x575681[_0x6839('0xb')]('FaxMessage',attributes,{'tableName':_0x6839('0xc'),'paranoid':![],'indexes':[{'name':_0x6839('0xd'),'fields':[_0x6839('0xe')],'type':_0x6839('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x198780,_0xabd2ea,_0x5c0265){var _0x43f58a=_0x575681[_0x6839('0x10')];var _0x941e92=_0x198780[_0x6839('0x11')]({'plain':!![]});if(_0x941e92['direction'][_0x6839('0x12')]()==='in'||_0x941e92['direction'][_0x6839('0x12')]()===_0x6839('0x13')&&!_0x941e92[_0x6839('0x14')]&&!_[_0x6839('0x15')](_0x941e92[_0x6839('0x16')])){_0x43f58a[_0x6839('0x17')]['findOne']({'where':{'id':_0x941e92[_0x6839('0x18')]}})[_0x6839('0x19')](function(_0x95dec){if(_0x95dec){_0x95dec['update']({'lastMsgAt':_0x941e92[_0x6839('0x1a')],'lastMsgDirection':_0x941e92[_0x6839('0x1b')]['toLowerCase']()});}})[_0x6839('0x1c')](function(_0x6f58dc){console[_0x6839('0x1d')](_0x6f58dc);});}_0x5c0265();}},'charset':_0x6839('0x1e'),'collate':_0x6839('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f1f5e31..a03e62b 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x425d,0x1e0));var _0xd425=function(_0x5f3f95,_0x25cc9d){_0x5f3f95=_0x5f3f95-0x0;var _0x2d95b8=_0x425d[_0x5f3f95];return _0x2d95b8;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fd1,0x155));var _0x15fd=function(_0x30a5b6,_0x47bf65){_0x30a5b6=_0x30a5b6-0x0;var _0x516e4e=_0x5fd1[_0x30a5b6];return _0x516e4e;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e654a26..01fff2e 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 _0x1c9b=['emit','removeListener','faxMessage:','remove','update'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x1c9b,0x1cf));var _0xb1c9=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x1c9b[_0x32f6b9];return _0x267d52;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xb1c9('0x0'),_0xb1c9('0x1')];function createListener(_0x3d5373,_0x4df3a7){return function(_0x1675c6){_0x4df3a7[_0xb1c9('0x2')](_0x3d5373,_0x1675c6);};}function removeListener(_0x336e8a,_0x54ca93){return function(){FaxMessageEvents[_0xb1c9('0x3')](_0x336e8a,_0x54ca93);};}exports['register']=function(_0xf686b4){for(var _0x151b6c=0x0,_0x52ca9f=events['length'];_0x151b6c<_0x52ca9f;_0x151b6c++){var _0x493450=events[_0x151b6c];var _0x932b2d=createListener(_0xb1c9('0x4')+_0x493450,_0xf686b4);FaxMessageEvents['on'](_0x493450,_0x932b2d);}}; \ No newline at end of file +var _0x2914=['update','emit','removeListener','register','length','faxMessage:','save','remove'];(function(_0x22cfc9,_0x476c8d){var _0x1495de=function(_0x3afde1){while(--_0x3afde1){_0x22cfc9['push'](_0x22cfc9['shift']());}};_0x1495de(++_0x476c8d);}(_0x2914,0x176));var _0x4291=function(_0x479b3f,_0x141726){_0x479b3f=_0x479b3f-0x0;var _0x386067=_0x2914[_0x479b3f];return _0x386067;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x4291('0x0'),_0x4291('0x1'),_0x4291('0x2')];function createListener(_0x6fc4ee,_0x4976c8){return function(_0x190d2a){_0x4976c8[_0x4291('0x3')](_0x6fc4ee,_0x190d2a);};}function removeListener(_0x16610b,_0xc919a9){return function(){FaxMessageEvents[_0x4291('0x4')](_0x16610b,_0xc919a9);};}exports[_0x4291('0x5')]=function(_0x123f84){for(var _0x3b28fc=0x0,_0x1b4d79=events[_0x4291('0x6')];_0x3b28fc<_0x1b4d79;_0x3b28fc++){var _0x2e6cea=events[_0x3b28fc];var _0x1c5c7c=createListener(_0x4291('0x7')+_0x2e6cea,_0x123f84);FaxMessageEvents['on'](_0x2e6cea,_0x1c5c7c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c486879..0a785d0 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 _0x0713=['../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2f29cb,_0x2c596a){var _0x3e09cc=function(_0x277306){while(--_0x277306){_0x2f29cb['push'](_0x2f29cb['shift']());}};_0x3e09cc(++_0x2c596a);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),interaction[_0x3071('0x11')](_0x3071('0x12'),_0x3071('0x13')),controller[_0x3071('0x14')]);router[_0x3071('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x16')]);router['put'](_0x3071('0x17'),auth[_0x3071('0x9')](),controller['accept']);router[_0x3071('0x15')]('/:id/reject',auth[_0x3071('0x9')](),controller[_0x3071('0x18')]);router[_0x3071('0x19')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x1a')]);module[_0x3071('0x1b')]=router; \ No newline at end of file +var _0x878f=['update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','/:id','/:id/download','isAuthenticated','post','fax','create','put'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x878f,0x173));var _0xf878=function(_0x5ea0c8,_0x232b34){_0x5ea0c8=_0x5ea0c8-0x0;var _0x401c88=_0x878f[_0x5ea0c8];return _0x401c88;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['download']);router[_0xf878('0xf')]('/',auth[_0xf878('0xe')](),interaction['tracked'](_0xf878('0x10'),'faxmessage:create'),controller[_0xf878('0x11')]);router[_0xf878('0x12')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);router[_0xf878('0x12')](_0xf878('0x14'),auth['isAuthenticated'](),controller[_0xf878('0x15')]);router[_0xf878('0x12')](_0xf878('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xf878('0x17')](_0xf878('0xc'),auth[_0xf878('0xe')](),controller[_0xf878('0x18')]);module[_0xf878('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 5262105..d41a8d9 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 _0x34be=['roundrobin','exports','beepall'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x34be,0x139));var _0xe34b=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x34be[_0x295314];return _0x584b0c;};'use strict';var Sequelize=require('sequelize');module[_0xe34b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xe34b('0x1'),_0xe34b('0x2')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd06f=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x32af35,_0x1d4f05){var _0x20119f=function(_0x31842e){while(--_0x31842e){_0x32af35['push'](_0x32af35['shift']());}};_0x20119f(++_0x1d4f05);}(_0xd06f,0x13c));var _0xfd06=function(_0x46dbbf,_0xb75da4){_0x46dbbf=_0x46dbbf-0x0;var _0x596fd6=_0xd06f[_0x46dbbf];return _0x596fd6;};'use strict';var Sequelize=require(_0xfd06('0x0'));module[_0xfd06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd06('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd06('0x3')]},'timeout':{'type':Sequelize[_0xfd06('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd06('0x5')](_0xfd06('0x6'),_0xfd06('0x7'),_0xfd06('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f933077..5ba7380 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 _0x6132=['fields','attributes','merge','create','user','get','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','UserFaxQueue','filters','hasOwnProperty','nolimit','order','sort','filter','options','User','findAndCountAll','map','UserId','agent','updatedAt','createdAt','%s/%s','faxPause','getTeams','findOne','Team','length','pick','addTeams','ids','findAll','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','offset','count','set','update','then','FaxQueues','UserProfileResource','destroy','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','model','keys','intersection'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6132,0x13a));var _0x2613=function(_0x1f8136,_0xdf6a6f){_0x1f8136=_0x1f8136-0x0;var _0x43bc04=_0x6132[_0x1f8136];return _0x43bc04;};'use strict';var BPromise=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var _=require(_0x2613('0x2'));var squel=require(_0x2613('0x3'));var Redis=require('ioredis');var qs=require(_0x2613('0x4'));var logger=require(_0x2613('0x5'))(_0x2613('0x6'));var config=require(_0x2613('0x7'));var db=require('../../mysqldb')['db'];config[_0x2613('0x8')]=_['defaults'](config['redis'],{'host':_0x2613('0x9'),'port':0x18eb});var socket=require(_0x2613('0xa'))(new Redis(config[_0x2613('0x8')]));require(_0x2613('0xb'))[_0x2613('0xc')](socket);function respondWithStatusCode(_0x4b6a40,_0x370d75){_0x370d75=_0x370d75||0xcc;return function(_0x3e8f36){if(_0x3e8f36){return _0x4b6a40[_0x2613('0xd')](_0x370d75);}return _0x4b6a40['status'](_0x370d75)[_0x2613('0xe')]();};}function respondWithResult(_0x12c800,_0x6d4439){_0x6d4439=_0x6d4439||0xc8;return function(_0x37fe48){if(_0x37fe48){return _0x12c800[_0x2613('0xf')](_0x6d4439)[_0x2613('0x10')](_0x37fe48);}};}function respondWithFilteredResult(_0xcc6236,_0xacad3d){return function(_0x41b956){if(_0x41b956){var _0x5d100a=typeof _0xacad3d['offset']===_0x2613('0x11')&&typeof _0xacad3d[_0x2613('0x12')]===_0x2613('0x11');var _0x34cbc4=_0x41b956['count'];var _0x39d9ce=_0x5d100a?0x0:_0xacad3d[_0x2613('0x13')];var _0x45f3c9=_0x5d100a?_0x41b956[_0x2613('0x14')]:_0xacad3d['offset']+_0xacad3d[_0x2613('0x12')];var _0x431b97;if(_0x45f3c9>=_0x34cbc4){_0x45f3c9=_0x34cbc4;_0x431b97=0xc8;}else{_0x431b97=0xce;}_0xcc6236[_0x2613('0xf')](_0x431b97);return _0xcc6236[_0x2613('0x15')]('Content-Range',_0x39d9ce+'-'+_0x45f3c9+'/'+_0x34cbc4)[_0x2613('0x10')](_0x41b956);}return null;};}function saveUpdates(_0x13cdee){return function(_0x4958c2){if(_0x4958c2){return _0x4958c2[_0x2613('0x16')](_0x13cdee)[_0x2613('0x17')](function(_0x207553){return _0x207553;});}return null;};}function removeEntity(_0x247e4c){return function(_0x2954f3){if(_0x2954f3){return _0x2954f3['destroy']()[_0x2613('0x17')](function(){var _0x20877a=_0x2954f3['get']({'plain':!![]});var _0x249263=_0x2613('0x18');return db[_0x2613('0x19')][_0x2613('0x1a')]({'where':{'type':_0x249263,'resourceId':_0x20877a['id']}})['then'](function(){return _0x2954f3;});})[_0x2613('0x17')](function(){_0x247e4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe5da){return function(_0x51a67d){if(!_0x51a67d){_0x1fe5da[_0x2613('0xd')](0x194);}return _0x51a67d;};}function handleError(_0x764f7b,_0x41a764){_0x41a764=_0x41a764||0x1f4;return function(_0x5b3893){logger['error'](_0x5b3893[_0x2613('0x1b')]);if(_0x5b3893[_0x2613('0x1c')]){delete _0x5b3893['name'];}_0x764f7b[_0x2613('0xf')](_0x41a764)[_0x2613('0x1d')](_0x5b3893);};}exports[_0x2613('0x1e')]=function(_0x434c08,_0x28e206){var _0x115f6f={};var _0x16a222={'count':0x0,'rows':[]};var _0xad2c6c=_['map'](db[_0x2613('0x1f')][_0x2613('0x20')],function(_0x19fb11){return{'name':_0x19fb11[_0x2613('0x21')],'type':_0x19fb11[_0x2613('0x22')][_0x2613('0x23')]};});_0x115f6f=qs[_0x2613('0x24')](_0xad2c6c,_0x434c08);var _0x2d43b1={'where':_0x115f6f[_0x2613('0x25')]};return db['FaxQueue'][_0x2613('0x14')](_0x2d43b1)[_0x2613('0x17')](function(_0x465cc8){_0x16a222[_0x2613('0x14')]=_0x465cc8;_0x115f6f[_0x2613('0x26')]=qs[_0x2613('0x26')](_0x434c08[_0x2613('0x27')]);return db[_0x2613('0x1f')]['findAll'](_0x115f6f);})[_0x2613('0x17')](function(_0x151415){_0x16a222[_0x2613('0x28')]=_0x151415;return _0x16a222;})[_0x2613('0x17')](respondWithFilteredResult(_0x28e206,_0x115f6f))[_0x2613('0x29')](handleError(_0x28e206,null));};exports[_0x2613('0x2a')]=function(_0x4d5888,_0x2eefec){var _0x545a14={'raw':!![],'where':{'id':_0x4d5888['params']['id']}},_0x37493c={};_0x37493c[_0x2613('0x2b')]=_['keys'](db[_0x2613('0x1f')][_0x2613('0x20')]);_0x37493c[_0x2613('0x27')]=_[_0x2613('0x2c')](_0x4d5888[_0x2613('0x27')]);_0x37493c['filters']=_[_0x2613('0x2d')](_0x37493c[_0x2613('0x2b')],_0x37493c[_0x2613('0x27')]);_0x545a14['attributes']=_['intersection'](_0x37493c[_0x2613('0x2b')],qs[_0x2613('0x2e')](_0x4d5888[_0x2613('0x27')][_0x2613('0x2e')]));_0x545a14[_0x2613('0x2f')]=_0x545a14[_0x2613('0x2f')]['length']?_0x545a14['attributes']:_0x37493c[_0x2613('0x2b')];if(_0x4d5888['query']['includeAll']){_0x545a14[_0x2613('0x26')]=[{'all':!![]}];}_0x545a14=_[_0x2613('0x30')]({},_0x545a14,_0x4d5888['options']);return db[_0x2613('0x1f')]['find'](_0x545a14)[_0x2613('0x17')](handleEntityNotFound(_0x2eefec,null))[_0x2613('0x17')](respondWithResult(_0x2eefec,null))['catch'](handleError(_0x2eefec,null));};exports['create']=function(_0x4e973a,_0x21440c){return db[_0x2613('0x1f')][_0x2613('0x31')](_0x4e973a['body'],{})[_0x2613('0x17')](function(_0x3e732a){var _0x2f2da3=_0x4e973a[_0x2613('0x32')][_0x2613('0x33')]({'plain':!![]});if(!_0x2f2da3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f2da3['role']===_0x2613('0x32')){var _0x3f49d3=_0x3e732a[_0x2613('0x33')]({'plain':!![]});var _0x4f6b7f='FaxQueues';return db[_0x2613('0x34')][_0x2613('0x35')]({'where':{'name':_0x4f6b7f,'userProfileId':_0x2f2da3[_0x2613('0x36')]},'raw':!![]})['then'](function(_0x584186){if(_0x584186&&_0x584186['autoAssociation']===0x0){return db[_0x2613('0x19')][_0x2613('0x31')]({'name':_0x3f49d3[_0x2613('0x1c')],'resourceId':_0x3f49d3['id'],'type':_0x584186[_0x2613('0x1c')],'sectionId':_0x584186['id']},{})[_0x2613('0x17')](function(){return _0x3e732a;});}else{return _0x3e732a;}})[_0x2613('0x29')](function(_0x235730){logger[_0x2613('0x37')](_0x2613('0x38'),_0x235730);throw _0x235730;});}return _0x3e732a;})[_0x2613('0x17')](respondWithResult(_0x21440c,0xc9))[_0x2613('0x29')](handleError(_0x21440c,null));};exports[_0x2613('0x16')]=function(_0x62ddea,_0x5ec74a){if(_0x62ddea[_0x2613('0x39')]['id']){delete _0x62ddea['body']['id'];}return db[_0x2613('0x1f')][_0x2613('0x35')]({'where':{'id':_0x62ddea[_0x2613('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5ec74a,null))['then'](saveUpdates(_0x62ddea[_0x2613('0x39')],null))[_0x2613('0x17')](respondWithResult(_0x5ec74a,null))[_0x2613('0x29')](handleError(_0x5ec74a,null));};exports[_0x2613('0x1a')]=function(_0x3d63a3,_0x5001d4){return db['FaxQueue']['find']({'where':{'id':_0x3d63a3[_0x2613('0x3a')]['id']}})[_0x2613('0x17')](handleEntityNotFound(_0x5001d4,null))[_0x2613('0x17')](removeEntity(_0x5001d4,null))[_0x2613('0x29')](handleError(_0x5001d4,null));};exports['describe']=function(_0x2c60a4,_0x4d1001){return db[_0x2613('0x1f')]['describe']()['then'](respondWithResult(_0x4d1001,null))[_0x2613('0x29')](handleError(_0x4d1001,null));};exports[_0x2613('0x3b')]=function(_0xfa7b4b,_0x349c2c){var _0x17742f={'raw':!![],'where':{}},_0x1ec3fa={},_0x1f28b9;return db[_0x2613('0x1f')]['findOne']({'where':{'id':_0xfa7b4b[_0x2613('0x3a')]['id']}})['then'](handleEntityNotFound(_0x349c2c,null))['then'](function(_0x1b0069){if(_0x1b0069){_0x1f28b9=_0x1b0069[_0x2613('0x33')]({'plain':!![]});_0x1ec3fa['model']=_[_0x2613('0x2c')](db[_0x2613('0x3c')]['rawAttributes']);_0x1ec3fa[_0x2613('0x27')]=_[_0x2613('0x2c')](_0xfa7b4b['query']);_0x1ec3fa[_0x2613('0x3d')]=_['intersection'](_0x1ec3fa[_0x2613('0x2b')],_0x1ec3fa[_0x2613('0x27')]);_0x17742f[_0x2613('0x2f')]=_['intersection'](_0x1ec3fa[_0x2613('0x2b')],qs['fields'](_0xfa7b4b[_0x2613('0x27')]['fields']));_0x17742f[_0x2613('0x2f')]=_0x17742f[_0x2613('0x2f')]['length']?_0x17742f[_0x2613('0x2f')]:_0x1ec3fa[_0x2613('0x2b')];if(!_0xfa7b4b[_0x2613('0x27')][_0x2613('0x3e')](_0x2613('0x3f'))){_0x17742f[_0x2613('0x12')]=qs['limit'](_0xfa7b4b[_0x2613('0x27')][_0x2613('0x12')]);_0x17742f[_0x2613('0x13')]=qs[_0x2613('0x13')](_0xfa7b4b[_0x2613('0x27')]['offset']);}_0x17742f[_0x2613('0x40')]=qs[_0x2613('0x41')](_0xfa7b4b[_0x2613('0x27')][_0x2613('0x41')]);_0x17742f['where']=qs[_0x2613('0x3d')](_['pick'](_0xfa7b4b[_0x2613('0x27')],_0x1ec3fa[_0x2613('0x3d')]));_0x17742f[_0x2613('0x25')]['FaxQueueId']=_0x1b0069['id'];if(_0xfa7b4b[_0x2613('0x27')]['filter']){_0x17742f[_0x2613('0x25')]=_['merge'](_0x17742f[_0x2613('0x25')],{'$or':_['map'](_0x17742f['attributes'],function(_0x54a11e){var _0x7c7c1d={};_0x7c7c1d[_0x54a11e]={'$like':'%'+_0xfa7b4b[_0x2613('0x27')][_0x2613('0x42')]+'%'};return _0x7c7c1d;})});}_0x17742f=_[_0x2613('0x30')]({},_0x17742f,_0xfa7b4b[_0x2613('0x43')]);return db[_0x2613('0x3c')]['findAll'](_0x17742f);}})[_0x2613('0x17')](function(_0x3b30eb){if(_0x3b30eb){return db[_0x2613('0x44')][_0x2613('0x45')]({'where':{'id':_[_0x2613('0x46')](_0x3b30eb,_0x2613('0x47')),'role':_0x2613('0x48')},'attributes':['id',_0x2613('0x1c'),'faxPause',_0x2613('0x49'),_0x2613('0x4a')]});}})[_0x2613('0x17')](function(_0x860e66){if(_0x860e66){return{'count':_0x860e66[_0x2613('0x14')],'rows':_[_0x2613('0x46')](_0x860e66[_0x2613('0x28')],function(_0x4eeb61){return{'membername':_0x4eeb61[_0x2613('0x1c')],'UserId':_0x4eeb61['id'],'queue_name':_0x1f28b9[_0x2613('0x1c')],'FaxQueueId':_0x1f28b9['id'],'interface':util['format'](_0x2613('0x4b'),'SIP',_0x4eeb61[_0x2613('0x1c')]),'penalty':0x0,'paused':_0x4eeb61[_0x2613('0x4c')],'createdAt':_0x4eeb61[_0x2613('0x4a')],'updatedAt':_0x4eeb61['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2613('0x17')](respondWithFilteredResult(_0x349c2c,_0x17742f))[_0x2613('0x29')](handleError(_0x349c2c,null));};exports[_0x2613('0x4d')]=function(_0x1500be,_0x281fd7){var _0x31e436={};var _0x5c76bc={};var _0x33acb4;var _0x44f321;return db[_0x2613('0x1f')][_0x2613('0x4e')]({'where':{'id':_0x1500be[_0x2613('0x3a')]['id']}})[_0x2613('0x17')](handleEntityNotFound(_0x281fd7,null))[_0x2613('0x17')](function(_0x17b66c){if(_0x17b66c){_0x33acb4=_0x17b66c;_0x5c76bc[_0x2613('0x2b')]=_[_0x2613('0x2c')](db[_0x2613('0x4f')]['rawAttributes']);_0x5c76bc['query']=_[_0x2613('0x2c')](_0x1500be['query']);_0x5c76bc['filters']=_['intersection'](_0x5c76bc[_0x2613('0x2b')],_0x5c76bc[_0x2613('0x27')]);_0x31e436[_0x2613('0x2f')]=_[_0x2613('0x2d')](_0x5c76bc[_0x2613('0x2b')],qs[_0x2613('0x2e')](_0x1500be['query'][_0x2613('0x2e')]));_0x31e436[_0x2613('0x2f')]=_0x31e436['attributes'][_0x2613('0x50')]?_0x31e436['attributes']:_0x5c76bc[_0x2613('0x2b')];_0x31e436['order']=qs[_0x2613('0x41')](_0x1500be[_0x2613('0x27')][_0x2613('0x41')]);_0x31e436[_0x2613('0x25')]=qs[_0x2613('0x3d')](_[_0x2613('0x51')](_0x1500be[_0x2613('0x27')],_0x5c76bc[_0x2613('0x3d')]));if(_0x1500be[_0x2613('0x27')][_0x2613('0x42')]){_0x31e436[_0x2613('0x25')]=_[_0x2613('0x30')](_0x31e436[_0x2613('0x25')],{'$or':_[_0x2613('0x46')](_0x31e436['attributes'],function(_0x23e8bd){var _0x4d0f7b={};_0x4d0f7b[_0x23e8bd]={'$like':'%'+_0x1500be['query'][_0x2613('0x42')]+'%'};return _0x4d0f7b;})});}_0x31e436=_[_0x2613('0x30')]({},_0x31e436,_0x1500be[_0x2613('0x43')]);return _0x33acb4[_0x2613('0x4d')](_0x31e436);}})[_0x2613('0x17')](function(_0x3925f8){if(_0x3925f8){_0x44f321=_0x3925f8[_0x2613('0x50')];if(!_0x1500be[_0x2613('0x27')][_0x2613('0x3e')](_0x2613('0x3f'))){_0x31e436[_0x2613('0x12')]=qs['limit'](_0x1500be[_0x2613('0x27')][_0x2613('0x12')]);_0x31e436['offset']=qs[_0x2613('0x13')](_0x1500be[_0x2613('0x27')][_0x2613('0x13')]);}return _0x33acb4['getTeams'](_0x31e436);}})[_0x2613('0x17')](function(_0x1d7bce){if(_0x1d7bce){return _0x1d7bce?{'count':_0x44f321,'rows':_0x1d7bce}:null;}})[_0x2613('0x17')](respondWithResult(_0x281fd7,null))[_0x2613('0x29')](handleError(_0x281fd7,null));};exports[_0x2613('0x52')]=function(_0x204587,_0x566e0c){var _0x3b5e75=_0x204587['body'][_0x2613('0x53')];return db[_0x2613('0x4f')][_0x2613('0x54')]({'where':{'id':_0x3b5e75},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2613('0x55'),'attributes':['id',_0x2613('0x1c'),_0x2613('0x56'),_0x2613('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x3af603){if(_0x3af603){var _0x21b89b=_[_0x2613('0x58')](_0x3af603,function(_0x1e33fd){var _0x509210=_0x1e33fd[_0x2613('0x33')]({'plain':!![]});return _0x509210[_0x2613('0x55')];});return db[_0x2613('0x1f')]['find']({'where':{'id':_0x204587[_0x2613('0x3a')]['id']}})[_0x2613('0x17')](function(_0x9232ea){return db[_0x2613('0x59')]['transaction'](function(_0x170a87){return _0x9232ea['addTeams'](_0x3b5e75,{'transaction':_0x170a87})['then'](function(){return BPromise[_0x2613('0x5a')](_0x21b89b,function(_0x5505fd){return db[_0x2613('0x3c')][_0x2613('0x5b')]({'where':{'UserId':_0x5505fd['id'],'FaxQueueId':_0x204587[_0x2613('0x3a')]['id']},'transaction':_0x170a87});});})[_0x2613('0x17')](function(){_0x21b89b['forEach'](function(_0x3b116a){socket[_0x2613('0x5c')](_0x2613('0x5d'),{'UserId':_0x3b116a['id'],'FaxQueueId':_0x9232ea['id']});});});});});}})[_0x2613('0x17')](respondWithStatusCode(_0x566e0c,null))[_0x2613('0x29')](handleError(_0x566e0c,null));};exports[_0x2613('0x5e')]=function(_0x26dcbd,_0x7efecf){return db[_0x2613('0x4f')][_0x2613('0x54')]({'where':{'id':_0x26dcbd[_0x2613('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2613('0x44')],'as':_0x2613('0x55'),'attributes':['id'],'raw':!![]}]})[_0x2613('0x17')](handleEntityNotFound(_0x7efecf,null))['then'](function(_0x36e0e6){var _0x537370=_['map'](_0x36e0e6,'id');var _0x16bf96=[];var _0x179e82=[];var _0x12a3e9=squel['select']();_0x12a3e9[_0x2613('0x5f')]('tq.TeamId')[_0x2613('0x60')]('team_has_fax_queues','tq')['join'](_0x2613('0x61'),'ut',_0x2613('0x62'))['where']('FaxQueueId\x20=\x20?',_0x26dcbd[_0x2613('0x3a')]['id']);for(var _0x49bfc1=0x0;_0x49bfc1<_0x36e0e6[_0x2613('0x50')];_0x49bfc1+=0x1){let _0x511877=_0x36e0e6[_0x49bfc1];for(var _0x41ec02=0x0;_0x41ec02<_0x511877[_0x2613('0x55')]['length'];_0x41ec02+=0x1){let _0x39b00b=_0x511877[_0x2613('0x55')][_0x41ec02];var _0x4cba17=_0x12a3e9[_0x2613('0x63')]();_0x4cba17['where'](_0x2613('0x64'),_0x39b00b['id']);_0x179e82[_0x2613('0x65')](db['sequelize']['query'](_0x4cba17[_0x2613('0x66')](),{'type':db[_0x2613('0x59')][_0x2613('0x67')]['SELECT']})[_0x2613('0x17')](function(_0x2e311e){if(_0x2e311e['length']===0x1){return _0x39b00b['id'];}else{var _0x1e1a04=_['every'](_[_0x2613('0x46')](_0x2e311e,_0x2613('0x68')),function(_0x105510){return _[_0x2613('0x69')](_0x537370,_0x105510);});if(_0x1e1a04){return _0x39b00b['id'];}}}));}}return BPromise[_0x2613('0x6a')](_0x179e82)[_0x2613('0x17')](function(_0x1af72c){_0x16bf96=_(_0x16bf96)[_0x2613('0x6b')](_0x1af72c)[_0x2613('0x6c')]()[_0x2613('0x6d')]();return db['FaxQueue'][_0x2613('0x35')]({'where':{'id':_0x26dcbd['params']['id']}})[_0x2613('0x17')](function(_0x5a21a4){return db[_0x2613('0x59')][_0x2613('0x6e')](function(_0x4f0c78){return _0x5a21a4['removeTeams'](_0x26dcbd['query'][_0x2613('0x53')],{'transaction':_0x4f0c78})['then'](function(){if(!_[_0x2613('0x6f')](_0x16bf96)){return _0x5a21a4[_0x2613('0x70')](_0x16bf96,{'transaction':_0x4f0c78});}})[_0x2613('0x17')](function(){_0x16bf96[_0x2613('0x71')](function(_0x517a33){socket[_0x2613('0x5c')]('userFaxQueue:remove',{'UserId':_0x517a33,'FaxQueueId':_0x5a21a4['id']});});});});});});})['then'](respondWithStatusCode(_0x7efecf,null))[_0x2613('0x29')](handleError(_0x7efecf,null));};exports['addAgents']=function(_0x2a99a6,_0x12458b){return db[_0x2613('0x1f')][_0x2613('0x35')]({'where':{'id':_0x2a99a6[_0x2613('0x3a')]['id']}})[_0x2613('0x17')](handleEntityNotFound(_0x12458b,null))[_0x2613('0x17')](function(_0x53b6e5){if(_0x53b6e5){return _0x53b6e5[_0x2613('0x72')](_0x2a99a6[_0x2613('0x39')][_0x2613('0x53')],_[_0x2613('0x73')](_0x2a99a6[_0x2613('0x39')],['ids','id'])||{})[_0x2613('0x74')](function(_0x4fe340){for(var _0x3848de=0x0;_0x3848de<_0x2a99a6[_0x2613('0x39')][_0x2613('0x53')][_0x2613('0x50')];_0x3848de+=0x1){socket[_0x2613('0x5c')]('userFaxQueue:save',{'UserId':Number(_0x2a99a6[_0x2613('0x39')][_0x2613('0x53')][_0x3848de]),'FaxQueueId':Number(_0x2a99a6['params']['id'])});}return _0x4fe340;});}})[_0x2613('0x17')](respondWithResult(_0x12458b,null))[_0x2613('0x29')](handleError(_0x12458b,null));};exports[_0x2613('0x70')]=function(_0x4a8d1d,_0x398872){return db[_0x2613('0x1f')]['find']({'where':{'id':_0x4a8d1d['params']['id']}})[_0x2613('0x17')](handleEntityNotFound(_0x398872,null))[_0x2613('0x17')](function(_0x5b82b3){if(_0x5b82b3){return _0x5b82b3['removeAgents'](_0x4a8d1d['query']['ids'])['then'](function(){if(_[_0x2613('0x75')](_0x4a8d1d[_0x2613('0x27')][_0x2613('0x53')])){for(var _0x18c221=0x0;_0x18c221<_0x4a8d1d[_0x2613('0x27')][_0x2613('0x53')][_0x2613('0x50')];_0x18c221+=0x1){socket[_0x2613('0x5c')](_0x2613('0x76'),{'UserId':Number(_0x4a8d1d['query'][_0x2613('0x53')][_0x18c221]),'FaxQueueId':Number(_0x4a8d1d['params']['id'])});}}else{socket[_0x2613('0x5c')](_0x2613('0x76'),{'UserId':Number(_0x4a8d1d[_0x2613('0x27')][_0x2613('0x53')]),'FaxQueueId':Number(_0x4a8d1d[_0x2613('0x3a')]['id'])});}});}})[_0x2613('0x17')](respondWithStatusCode(_0x398872,null))['catch'](handleError(_0x398872,null));};exports['getAgents']=function(_0x1ffeb9,_0x15979b){var _0x55588b={};var _0x8a4b81={};var _0x27f9d3;var _0x3b60a1;return db[_0x2613('0x1f')][_0x2613('0x4e')]({'where':{'id':_0x1ffeb9[_0x2613('0x3a')]['id']}})[_0x2613('0x17')](handleEntityNotFound(_0x15979b,null))[_0x2613('0x17')](function(_0x45bf11){if(_0x45bf11){_0x27f9d3=_0x45bf11;_0x8a4b81['model']=_[_0x2613('0x2c')](db[_0x2613('0x44')][_0x2613('0x20')]);_0x8a4b81[_0x2613('0x27')]=_[_0x2613('0x2c')](_0x1ffeb9['query']);_0x8a4b81[_0x2613('0x3d')]=_['intersection'](_0x8a4b81[_0x2613('0x2b')],_0x8a4b81['query']);_0x55588b[_0x2613('0x2f')]=_['intersection'](_0x8a4b81['model'],qs[_0x2613('0x2e')](_0x1ffeb9[_0x2613('0x27')]['fields']));_0x55588b[_0x2613('0x2f')]=_0x55588b['attributes'][_0x2613('0x50')]?_0x55588b[_0x2613('0x2f')]:_0x8a4b81[_0x2613('0x2b')];_0x55588b[_0x2613('0x40')]=qs[_0x2613('0x41')](_0x1ffeb9[_0x2613('0x27')]['sort']);_0x55588b['where']=qs['filters'](_[_0x2613('0x51')](_0x1ffeb9[_0x2613('0x27')],_0x8a4b81[_0x2613('0x3d')]));if(_0x1ffeb9[_0x2613('0x27')][_0x2613('0x42')]){_0x55588b[_0x2613('0x25')]=_['merge'](_0x55588b[_0x2613('0x25')],{'$or':_[_0x2613('0x46')](_0x55588b[_0x2613('0x2f')],function(_0x30feba){var _0x4c8d6f={};_0x4c8d6f[_0x30feba]={'$like':'%'+_0x1ffeb9[_0x2613('0x27')][_0x2613('0x42')]+'%'};return _0x4c8d6f;})});}_0x55588b=_[_0x2613('0x30')]({},_0x55588b,_0x1ffeb9[_0x2613('0x43')]);return _0x27f9d3[_0x2613('0x77')](_0x55588b);}})[_0x2613('0x17')](function(_0x18d168){if(_0x18d168){_0x3b60a1=_0x18d168[_0x2613('0x50')];if(!_0x1ffeb9[_0x2613('0x27')][_0x2613('0x3e')](_0x2613('0x3f'))){_0x55588b['limit']=qs[_0x2613('0x12')](_0x1ffeb9[_0x2613('0x27')]['limit']);_0x55588b[_0x2613('0x13')]=qs[_0x2613('0x13')](_0x1ffeb9[_0x2613('0x27')][_0x2613('0x13')]);}return _0x27f9d3[_0x2613('0x77')](_0x55588b);}})['then'](function(_0x58dedc){if(_0x58dedc){return _0x58dedc?{'count':_0x3b60a1,'rows':_0x58dedc}:null;}})[_0x2613('0x17')](respondWithResult(_0x15979b,null))['catch'](handleError(_0x15979b,null));}; \ No newline at end of file +var _0x964b=['addTeams','ids','voicePause','interface','flatMap','each','UserFaxQueue','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Agents','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','end','undefined','count','offset','Content-Range','json','update','then','get','FaxQueues','UserProfileResource','destroy','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','params','keys','filters','intersection','model','attributes','fields','length','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','body','describe','hasOwnProperty','nolimit','limit','order','sort','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','%s/%s','SIP','faxPause','createdAt','getTeams','findOne','Team','pick','filter'];(function(_0xb7202,_0x4aa500){var _0x6488bb=function(_0x27d9ec){while(--_0x27d9ec){_0xb7202['push'](_0xb7202['shift']());}};_0x6488bb(++_0x4aa500);}(_0x964b,0x112));var _0xb964=function(_0xdf0068,_0x2a7326){_0xdf0068=_0xdf0068-0x0;var _0x41b1a3=_0x964b[_0xdf0068];return _0x41b1a3;};'use strict';var BPromise=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var _=require('lodash');var squel=require(_0xb964('0x2'));var Redis=require(_0xb964('0x3'));var qs=require(_0xb964('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xb964('0x5'));var db=require('../../mysqldb')['db'];config[_0xb964('0x6')]=_[_0xb964('0x7')](config[_0xb964('0x6')],{'host':_0xb964('0x8'),'port':0x18eb});var socket=require(_0xb964('0x9'))(new Redis(config[_0xb964('0x6')]));require(_0xb964('0xa'))['register'](socket);function respondWithStatusCode(_0x58e49e,_0x3a3006){_0x3a3006=_0x3a3006||0xcc;return function(_0x505a2f){if(_0x505a2f){return _0x58e49e['sendStatus'](_0x3a3006);}return _0x58e49e[_0xb964('0xb')](_0x3a3006)[_0xb964('0xc')]();};}function respondWithResult(_0x4433a5,_0x38247c){_0x38247c=_0x38247c||0xc8;return function(_0x38bae5){if(_0x38bae5){return _0x4433a5[_0xb964('0xb')](_0x38247c)['json'](_0x38bae5);}};}function respondWithFilteredResult(_0x442595,_0x1b223f){return function(_0x149b5d){if(_0x149b5d){var _0x30c217=typeof _0x1b223f['offset']===_0xb964('0xd')&&typeof _0x1b223f['limit']==='undefined';var _0x3ce73e=_0x149b5d[_0xb964('0xe')];var _0xe111d2=_0x30c217?0x0:_0x1b223f[_0xb964('0xf')];var _0x2eebf3=_0x30c217?_0x149b5d[_0xb964('0xe')]:_0x1b223f[_0xb964('0xf')]+_0x1b223f['limit'];var _0x3f507a;if(_0x2eebf3>=_0x3ce73e){_0x2eebf3=_0x3ce73e;_0x3f507a=0xc8;}else{_0x3f507a=0xce;}_0x442595['status'](_0x3f507a);return _0x442595['set'](_0xb964('0x10'),_0xe111d2+'-'+_0x2eebf3+'/'+_0x3ce73e)[_0xb964('0x11')](_0x149b5d);}return null;};}function saveUpdates(_0x26aa2c){return function(_0x3f6e40){if(_0x3f6e40){return _0x3f6e40[_0xb964('0x12')](_0x26aa2c)[_0xb964('0x13')](function(_0x263276){return _0x263276;});}return null;};}function removeEntity(_0x44d78a){return function(_0x2bd9d5){if(_0x2bd9d5){return _0x2bd9d5['destroy']()['then'](function(){var _0x49a066=_0x2bd9d5[_0xb964('0x14')]({'plain':!![]});var _0x42e78e=_0xb964('0x15');return db[_0xb964('0x16')][_0xb964('0x17')]({'where':{'type':_0x42e78e,'resourceId':_0x49a066['id']}})['then'](function(){return _0x2bd9d5;});})['then'](function(){_0x44d78a['status'](0xcc)[_0xb964('0xc')]();});}};}function handleEntityNotFound(_0x457f43){return function(_0x30d78f){if(!_0x30d78f){_0x457f43['sendStatus'](0x194);}return _0x30d78f;};}function handleError(_0x3cc265,_0x39f423){_0x39f423=_0x39f423||0x1f4;return function(_0x1ba889){logger['error'](_0x1ba889['stack']);if(_0x1ba889[_0xb964('0x18')]){delete _0x1ba889['name'];}_0x3cc265[_0xb964('0xb')](_0x39f423)[_0xb964('0x19')](_0x1ba889);};}exports[_0xb964('0x1a')]=function(_0x446e1b,_0x51257e){var _0x1cecce={};var _0x1d9dcd={'count':0x0,'rows':[]};var _0x2801dd=_[_0xb964('0x1b')](db[_0xb964('0x1c')][_0xb964('0x1d')],function(_0x13d94d){return{'name':_0x13d94d[_0xb964('0x1e')],'type':_0x13d94d[_0xb964('0x1f')]['key']};});_0x1cecce=qs[_0xb964('0x20')](_0x2801dd,_0x446e1b);var _0x273ca4={'where':_0x1cecce[_0xb964('0x21')]};return db[_0xb964('0x1c')][_0xb964('0xe')](_0x273ca4)[_0xb964('0x13')](function(_0x20b89a){_0x1d9dcd['count']=_0x20b89a;_0x1cecce[_0xb964('0x22')]=qs[_0xb964('0x22')](_0x446e1b[_0xb964('0x23')]);return db['FaxQueue'][_0xb964('0x24')](_0x1cecce);})[_0xb964('0x13')](function(_0xa0df8b){_0x1d9dcd[_0xb964('0x25')]=_0xa0df8b;return _0x1d9dcd;})[_0xb964('0x13')](respondWithFilteredResult(_0x51257e,_0x1cecce))[_0xb964('0x26')](handleError(_0x51257e,null));};exports['show']=function(_0x4a0d45,_0x1501d0){var _0x3b38c0={'raw':!![],'where':{'id':_0x4a0d45[_0xb964('0x27')]['id']}},_0x28f0a9={};_0x28f0a9['model']=_[_0xb964('0x28')](db['FaxQueue'][_0xb964('0x1d')]);_0x28f0a9[_0xb964('0x23')]=_['keys'](_0x4a0d45['query']);_0x28f0a9[_0xb964('0x29')]=_[_0xb964('0x2a')](_0x28f0a9[_0xb964('0x2b')],_0x28f0a9[_0xb964('0x23')]);_0x3b38c0[_0xb964('0x2c')]=_[_0xb964('0x2a')](_0x28f0a9['model'],qs['fields'](_0x4a0d45['query'][_0xb964('0x2d')]));_0x3b38c0[_0xb964('0x2c')]=_0x3b38c0[_0xb964('0x2c')][_0xb964('0x2e')]?_0x3b38c0[_0xb964('0x2c')]:_0x28f0a9[_0xb964('0x2b')];if(_0x4a0d45['query']['includeAll']){_0x3b38c0[_0xb964('0x22')]=[{'all':!![]}];}_0x3b38c0=_[_0xb964('0x2f')]({},_0x3b38c0,_0x4a0d45[_0xb964('0x30')]);return db[_0xb964('0x1c')][_0xb964('0x31')](_0x3b38c0)['then'](handleEntityNotFound(_0x1501d0,null))[_0xb964('0x13')](respondWithResult(_0x1501d0,null))[_0xb964('0x26')](handleError(_0x1501d0,null));};exports[_0xb964('0x32')]=function(_0x5f3244,_0x157726){return db[_0xb964('0x1c')][_0xb964('0x32')](_0x5f3244['body'],{})[_0xb964('0x13')](function(_0x575023){var _0x2c6d2f=_0x5f3244['user'][_0xb964('0x14')]({'plain':!![]});if(!_0x2c6d2f)throw new Error(_0xb964('0x33'));if(_0x2c6d2f['role']==='user'){var _0x23a3ec=_0x575023[_0xb964('0x14')]({'plain':!![]});var _0x2f9e6d=_0xb964('0x15');return db[_0xb964('0x34')]['find']({'where':{'name':_0x2f9e6d,'userProfileId':_0x2c6d2f[_0xb964('0x35')]},'raw':!![]})[_0xb964('0x13')](function(_0x27c336){if(_0x27c336&&_0x27c336['autoAssociation']===0x0){return db[_0xb964('0x16')][_0xb964('0x32')]({'name':_0x23a3ec[_0xb964('0x18')],'resourceId':_0x23a3ec['id'],'type':_0x27c336[_0xb964('0x18')],'sectionId':_0x27c336['id']},{})[_0xb964('0x13')](function(){return _0x575023;});}else{return _0x575023;}})['catch'](function(_0xe962f9){logger[_0xb964('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe962f9);throw _0xe962f9;});}return _0x575023;})[_0xb964('0x13')](respondWithResult(_0x157726,0xc9))[_0xb964('0x26')](handleError(_0x157726,null));};exports[_0xb964('0x12')]=function(_0x379b31,_0x4c49c7){if(_0x379b31['body']['id']){delete _0x379b31[_0xb964('0x37')]['id'];}return db[_0xb964('0x1c')][_0xb964('0x31')]({'where':{'id':_0x379b31[_0xb964('0x27')]['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x4c49c7,null))[_0xb964('0x13')](saveUpdates(_0x379b31[_0xb964('0x37')],null))[_0xb964('0x13')](respondWithResult(_0x4c49c7,null))['catch'](handleError(_0x4c49c7,null));};exports[_0xb964('0x17')]=function(_0x481ac0,_0x2335b9){return db[_0xb964('0x1c')][_0xb964('0x31')]({'where':{'id':_0x481ac0['params']['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x2335b9,null))[_0xb964('0x13')](removeEntity(_0x2335b9,null))[_0xb964('0x26')](handleError(_0x2335b9,null));};exports[_0xb964('0x38')]=function(_0x43fcd0,_0x3d6df5){return db[_0xb964('0x1c')][_0xb964('0x38')]()[_0xb964('0x13')](respondWithResult(_0x3d6df5,null))['catch'](handleError(_0x3d6df5,null));};exports['getMembers']=function(_0x4cbdca,_0x12c58f){var _0xe4e024={'raw':!![],'where':{}},_0x4b6eb6={},_0x15cbef;return db[_0xb964('0x1c')]['findOne']({'where':{'id':_0x4cbdca['params']['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x12c58f,null))[_0xb964('0x13')](function(_0x562261){if(_0x562261){_0x15cbef=_0x562261[_0xb964('0x14')]({'plain':!![]});_0x4b6eb6['model']=_[_0xb964('0x28')](db['UserFaxQueue'][_0xb964('0x1d')]);_0x4b6eb6[_0xb964('0x23')]=_[_0xb964('0x28')](_0x4cbdca[_0xb964('0x23')]);_0x4b6eb6[_0xb964('0x29')]=_[_0xb964('0x2a')](_0x4b6eb6[_0xb964('0x2b')],_0x4b6eb6[_0xb964('0x23')]);_0xe4e024['attributes']=_[_0xb964('0x2a')](_0x4b6eb6[_0xb964('0x2b')],qs[_0xb964('0x2d')](_0x4cbdca[_0xb964('0x23')]['fields']));_0xe4e024[_0xb964('0x2c')]=_0xe4e024[_0xb964('0x2c')][_0xb964('0x2e')]?_0xe4e024[_0xb964('0x2c')]:_0x4b6eb6[_0xb964('0x2b')];if(!_0x4cbdca[_0xb964('0x23')][_0xb964('0x39')](_0xb964('0x3a'))){_0xe4e024[_0xb964('0x3b')]=qs[_0xb964('0x3b')](_0x4cbdca[_0xb964('0x23')][_0xb964('0x3b')]);_0xe4e024[_0xb964('0xf')]=qs[_0xb964('0xf')](_0x4cbdca[_0xb964('0x23')]['offset']);}_0xe4e024[_0xb964('0x3c')]=qs['sort'](_0x4cbdca[_0xb964('0x23')][_0xb964('0x3d')]);_0xe4e024[_0xb964('0x21')]=qs[_0xb964('0x29')](_['pick'](_0x4cbdca[_0xb964('0x23')],_0x4b6eb6[_0xb964('0x29')]));_0xe4e024[_0xb964('0x21')][_0xb964('0x3e')]=_0x562261['id'];if(_0x4cbdca[_0xb964('0x23')]['filter']){_0xe4e024['where']=_[_0xb964('0x2f')](_0xe4e024['where'],{'$or':_[_0xb964('0x1b')](_0xe4e024[_0xb964('0x2c')],function(_0x5c329f){var _0x35d9f1={};_0x35d9f1[_0x5c329f]={'$like':'%'+_0x4cbdca[_0xb964('0x23')]['filter']+'%'};return _0x35d9f1;})});}_0xe4e024=_[_0xb964('0x2f')]({},_0xe4e024,_0x4cbdca[_0xb964('0x30')]);return db['UserFaxQueue'][_0xb964('0x24')](_0xe4e024);}})['then'](function(_0x15a5ca){if(_0x15a5ca){return db[_0xb964('0x3f')][_0xb964('0x40')]({'where':{'id':_[_0xb964('0x1b')](_0x15a5ca,_0xb964('0x41')),'role':_0xb964('0x42')},'attributes':['id',_0xb964('0x18'),'faxPause',_0xb964('0x43'),'createdAt']});}})[_0xb964('0x13')](function(_0x584934){if(_0x584934){return{'count':_0x584934[_0xb964('0xe')],'rows':_[_0xb964('0x1b')](_0x584934[_0xb964('0x25')],function(_0x2aa55b){return{'membername':_0x2aa55b[_0xb964('0x18')],'UserId':_0x2aa55b['id'],'queue_name':_0x15cbef[_0xb964('0x18')],'FaxQueueId':_0x15cbef['id'],'interface':util['format'](_0xb964('0x44'),_0xb964('0x45'),_0x2aa55b['name']),'penalty':0x0,'paused':_0x2aa55b[_0xb964('0x46')],'createdAt':_0x2aa55b[_0xb964('0x47')],'updatedAt':_0x2aa55b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb964('0x13')](respondWithFilteredResult(_0x12c58f,_0xe4e024))[_0xb964('0x26')](handleError(_0x12c58f,null));};exports[_0xb964('0x48')]=function(_0x5f0877,_0x299588){var _0x116c9d={};var _0x3840a0={};var _0x146f78;var _0x299fcd;return db[_0xb964('0x1c')][_0xb964('0x49')]({'where':{'id':_0x5f0877[_0xb964('0x27')]['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x299588,null))['then'](function(_0x15e8b2){if(_0x15e8b2){_0x146f78=_0x15e8b2;_0x3840a0['model']=_['keys'](db[_0xb964('0x4a')]['rawAttributes']);_0x3840a0[_0xb964('0x23')]=_[_0xb964('0x28')](_0x5f0877[_0xb964('0x23')]);_0x3840a0['filters']=_[_0xb964('0x2a')](_0x3840a0[_0xb964('0x2b')],_0x3840a0['query']);_0x116c9d[_0xb964('0x2c')]=_[_0xb964('0x2a')](_0x3840a0[_0xb964('0x2b')],qs['fields'](_0x5f0877[_0xb964('0x23')]['fields']));_0x116c9d[_0xb964('0x2c')]=_0x116c9d['attributes'][_0xb964('0x2e')]?_0x116c9d[_0xb964('0x2c')]:_0x3840a0[_0xb964('0x2b')];_0x116c9d[_0xb964('0x3c')]=qs['sort'](_0x5f0877[_0xb964('0x23')]['sort']);_0x116c9d[_0xb964('0x21')]=qs[_0xb964('0x29')](_[_0xb964('0x4b')](_0x5f0877[_0xb964('0x23')],_0x3840a0['filters']));if(_0x5f0877[_0xb964('0x23')][_0xb964('0x4c')]){_0x116c9d[_0xb964('0x21')]=_[_0xb964('0x2f')](_0x116c9d[_0xb964('0x21')],{'$or':_[_0xb964('0x1b')](_0x116c9d[_0xb964('0x2c')],function(_0x302351){var _0x1fdcbd={};_0x1fdcbd[_0x302351]={'$like':'%'+_0x5f0877[_0xb964('0x23')]['filter']+'%'};return _0x1fdcbd;})});}_0x116c9d=_[_0xb964('0x2f')]({},_0x116c9d,_0x5f0877[_0xb964('0x30')]);return _0x146f78[_0xb964('0x48')](_0x116c9d);}})[_0xb964('0x13')](function(_0x289901){if(_0x289901){_0x299fcd=_0x289901[_0xb964('0x2e')];if(!_0x5f0877[_0xb964('0x23')][_0xb964('0x39')](_0xb964('0x3a'))){_0x116c9d[_0xb964('0x3b')]=qs[_0xb964('0x3b')](_0x5f0877['query']['limit']);_0x116c9d[_0xb964('0xf')]=qs[_0xb964('0xf')](_0x5f0877[_0xb964('0x23')]['offset']);}return _0x146f78[_0xb964('0x48')](_0x116c9d);}})['then'](function(_0x338e15){if(_0x338e15){return _0x338e15?{'count':_0x299fcd,'rows':_0x338e15}:null;}})['then'](respondWithResult(_0x299588,null))[_0xb964('0x26')](handleError(_0x299588,null));};exports[_0xb964('0x4d')]=function(_0x61ccb5,_0x2da248){var _0x1c440b=_0x61ccb5['body'][_0xb964('0x4e')];return db['Team']['findAll']({'where':{'id':_0x1c440b},'attributes':['id'],'include':[{'model':db[_0xb964('0x3f')],'as':'Agents','attributes':['id',_0xb964('0x18'),'online',_0xb964('0x4f'),_0xb964('0x50')],'raw':!![]}]})[_0xb964('0x13')](function(_0x169add){if(_0x169add){var _0x4d34f3=_[_0xb964('0x51')](_0x169add,function(_0x217b03){var _0x1f24e5=_0x217b03[_0xb964('0x14')]({'plain':!![]});return _0x1f24e5['Agents'];});return db[_0xb964('0x1c')][_0xb964('0x31')]({'where':{'id':_0x61ccb5['params']['id']}})[_0xb964('0x13')](function(_0x140d70){return db['sequelize']['transaction'](function(_0x2e77c4){return _0x140d70[_0xb964('0x4d')](_0x1c440b,{'transaction':_0x2e77c4})['then'](function(){return BPromise[_0xb964('0x52')](_0x4d34f3,function(_0x2c432e){return db[_0xb964('0x53')][_0xb964('0x54')]({'where':{'UserId':_0x2c432e['id'],'FaxQueueId':_0x61ccb5['params']['id']},'transaction':_0x2e77c4});});})[_0xb964('0x13')](function(){_0x4d34f3[_0xb964('0x55')](function(_0x923ad0){socket[_0xb964('0x56')](_0xb964('0x57'),{'UserId':_0x923ad0['id'],'FaxQueueId':_0x140d70['id']});});});});});}})['then'](respondWithStatusCode(_0x2da248,null))['catch'](handleError(_0x2da248,null));};exports[_0xb964('0x58')]=function(_0x28bc97,_0x28996e){return db[_0xb964('0x4a')][_0xb964('0x24')]({'where':{'id':_0x28bc97[_0xb964('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb964('0x3f')],'as':_0xb964('0x59'),'attributes':['id'],'raw':!![]}]})[_0xb964('0x13')](handleEntityNotFound(_0x28996e,null))[_0xb964('0x13')](function(_0x52171b){var _0x54f8dc=_[_0xb964('0x1b')](_0x52171b,'id');var _0x23e516=[];var _0x12266b=[];var _0x28cba2=squel[_0xb964('0x5a')]();_0x28cba2['field'](_0xb964('0x5b'))[_0xb964('0x5c')](_0xb964('0x5d'),'tq')[_0xb964('0x5e')](_0xb964('0x5f'),'ut',_0xb964('0x60'))[_0xb964('0x21')](_0xb964('0x61'),_0x28bc97[_0xb964('0x27')]['id']);for(var _0x591bad=0x0;_0x591bad<_0x52171b[_0xb964('0x2e')];_0x591bad+=0x1){let _0x279923=_0x52171b[_0x591bad];for(var _0x553b37=0x0;_0x553b37<_0x279923['Agents'][_0xb964('0x2e')];_0x553b37+=0x1){let _0x44f4e3=_0x279923[_0xb964('0x59')][_0x553b37];var _0x3570a8=_0x28cba2[_0xb964('0x62')]();_0x3570a8[_0xb964('0x21')]('ut.UserId\x20=\x20?',_0x44f4e3['id']);_0x12266b['push'](db[_0xb964('0x63')][_0xb964('0x23')](_0x3570a8['toString'](),{'type':db[_0xb964('0x63')][_0xb964('0x64')]['SELECT']})[_0xb964('0x13')](function(_0xfdb425){if(_0xfdb425[_0xb964('0x2e')]===0x1){return _0x44f4e3['id'];}else{var _0x3298ad=_[_0xb964('0x65')](_[_0xb964('0x1b')](_0xfdb425,_0xb964('0x66')),function(_0x41d688){return _[_0xb964('0x67')](_0x54f8dc,_0x41d688);});if(_0x3298ad){return _0x44f4e3['id'];}}}));}}return BPromise[_0xb964('0x68')](_0x12266b)['then'](function(_0x541323){_0x23e516=_(_0x23e516)[_0xb964('0x69')](_0x541323)[_0xb964('0x6a')]()[_0xb964('0x6b')]();return db['FaxQueue']['find']({'where':{'id':_0x28bc97['params']['id']}})[_0xb964('0x13')](function(_0x2ba9e5){return db[_0xb964('0x63')][_0xb964('0x6c')](function(_0x310133){return _0x2ba9e5[_0xb964('0x58')](_0x28bc97['query'][_0xb964('0x4e')],{'transaction':_0x310133})['then'](function(){if(!_[_0xb964('0x6d')](_0x23e516)){return _0x2ba9e5[_0xb964('0x6e')](_0x23e516,{'transaction':_0x310133});}})['then'](function(){_0x23e516[_0xb964('0x55')](function(_0x466f12){socket[_0xb964('0x56')](_0xb964('0x6f'),{'UserId':_0x466f12,'FaxQueueId':_0x2ba9e5['id']});});});});});});})[_0xb964('0x13')](respondWithStatusCode(_0x28996e,null))[_0xb964('0x26')](handleError(_0x28996e,null));};exports[_0xb964('0x70')]=function(_0x15f7a8,_0x1447a2){return db[_0xb964('0x1c')][_0xb964('0x31')]({'where':{'id':_0x15f7a8[_0xb964('0x27')]['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x1447a2,null))['then'](function(_0x12d7c0){if(_0x12d7c0){return _0x12d7c0[_0xb964('0x70')](_0x15f7a8[_0xb964('0x37')][_0xb964('0x4e')],_[_0xb964('0x71')](_0x15f7a8[_0xb964('0x37')],[_0xb964('0x4e'),'id'])||{})[_0xb964('0x72')](function(_0x4f9fd2){for(var _0x5419d3=0x0;_0x5419d3<_0x15f7a8[_0xb964('0x37')][_0xb964('0x4e')]['length'];_0x5419d3+=0x1){socket['emit'](_0xb964('0x57'),{'UserId':Number(_0x15f7a8[_0xb964('0x37')][_0xb964('0x4e')][_0x5419d3]),'FaxQueueId':Number(_0x15f7a8[_0xb964('0x27')]['id'])});}return _0x4f9fd2;});}})[_0xb964('0x13')](respondWithResult(_0x1447a2,null))[_0xb964('0x26')](handleError(_0x1447a2,null));};exports[_0xb964('0x6e')]=function(_0x13816f,_0x34007a){return db['FaxQueue'][_0xb964('0x31')]({'where':{'id':_0x13816f[_0xb964('0x27')]['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x34007a,null))[_0xb964('0x13')](function(_0x2e7ad8){if(_0x2e7ad8){return _0x2e7ad8[_0xb964('0x6e')](_0x13816f['query'][_0xb964('0x4e')])[_0xb964('0x13')](function(){if(_[_0xb964('0x73')](_0x13816f[_0xb964('0x23')]['ids'])){for(var _0x9b630a=0x0;_0x9b630a<_0x13816f[_0xb964('0x23')][_0xb964('0x4e')]['length'];_0x9b630a+=0x1){socket[_0xb964('0x56')](_0xb964('0x6f'),{'UserId':Number(_0x13816f['query']['ids'][_0x9b630a]),'FaxQueueId':Number(_0x13816f[_0xb964('0x27')]['id'])});}}else{socket[_0xb964('0x56')](_0xb964('0x6f'),{'UserId':Number(_0x13816f[_0xb964('0x23')][_0xb964('0x4e')]),'FaxQueueId':Number(_0x13816f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x34007a,null))[_0xb964('0x26')](handleError(_0x34007a,null));};exports['getAgents']=function(_0xdf8915,_0x3c715c){var _0x2ec697={};var _0x55b963={};var _0x5a62ea;var _0x3a5c09;return db[_0xb964('0x1c')][_0xb964('0x49')]({'where':{'id':_0xdf8915[_0xb964('0x27')]['id']}})[_0xb964('0x13')](handleEntityNotFound(_0x3c715c,null))['then'](function(_0x4ce9f2){if(_0x4ce9f2){_0x5a62ea=_0x4ce9f2;_0x55b963[_0xb964('0x2b')]=_[_0xb964('0x28')](db[_0xb964('0x3f')]['rawAttributes']);_0x55b963[_0xb964('0x23')]=_['keys'](_0xdf8915[_0xb964('0x23')]);_0x55b963[_0xb964('0x29')]=_[_0xb964('0x2a')](_0x55b963[_0xb964('0x2b')],_0x55b963['query']);_0x2ec697[_0xb964('0x2c')]=_[_0xb964('0x2a')](_0x55b963[_0xb964('0x2b')],qs['fields'](_0xdf8915[_0xb964('0x23')][_0xb964('0x2d')]));_0x2ec697[_0xb964('0x2c')]=_0x2ec697[_0xb964('0x2c')][_0xb964('0x2e')]?_0x2ec697[_0xb964('0x2c')]:_0x55b963[_0xb964('0x2b')];_0x2ec697[_0xb964('0x3c')]=qs['sort'](_0xdf8915[_0xb964('0x23')]['sort']);_0x2ec697[_0xb964('0x21')]=qs[_0xb964('0x29')](_[_0xb964('0x4b')](_0xdf8915[_0xb964('0x23')],_0x55b963['filters']));if(_0xdf8915[_0xb964('0x23')][_0xb964('0x4c')]){_0x2ec697[_0xb964('0x21')]=_[_0xb964('0x2f')](_0x2ec697['where'],{'$or':_[_0xb964('0x1b')](_0x2ec697[_0xb964('0x2c')],function(_0x5aac67){var _0x2e74ab={};_0x2e74ab[_0x5aac67]={'$like':'%'+_0xdf8915[_0xb964('0x23')][_0xb964('0x4c')]+'%'};return _0x2e74ab;})});}_0x2ec697=_[_0xb964('0x2f')]({},_0x2ec697,_0xdf8915['options']);return _0x5a62ea['getAgents'](_0x2ec697);}})[_0xb964('0x13')](function(_0x1c7ecf){if(_0x1c7ecf){_0x3a5c09=_0x1c7ecf[_0xb964('0x2e')];if(!_0xdf8915[_0xb964('0x23')][_0xb964('0x39')](_0xb964('0x3a'))){_0x2ec697[_0xb964('0x3b')]=qs[_0xb964('0x3b')](_0xdf8915['query'][_0xb964('0x3b')]);_0x2ec697[_0xb964('0xf')]=qs[_0xb964('0xf')](_0xdf8915[_0xb964('0x23')][_0xb964('0xf')]);}return _0x5a62ea[_0xb964('0x74')](_0x2ec697);}})[_0xb964('0x13')](function(_0x212af6){if(_0x212af6){return _0x212af6?{'count':_0x3a5c09,'rows':_0x212af6}:null;}})[_0xb964('0x13')](respondWithResult(_0x3c715c,null))[_0xb964('0x26')](handleError(_0x3c715c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 54a5cb6..882d387 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 _0xba4e=['setMaxListeners','save','update','remove','emit','hook','events','FaxQueue'];(function(_0x1dd8c6,_0x290864){var _0x59d31f=function(_0x487b96){while(--_0x487b96){_0x1dd8c6['push'](_0x1dd8c6['shift']());}};_0x59d31f(++_0x290864);}(_0xba4e,0x1e6));var _0xeba4=function(_0x5d9041,_0x2c23bd){_0x5d9041=_0x5d9041-0x0;var _0x4c1042=_0xba4e[_0x5d9041];return _0x4c1042;};'use strict';var EventEmitter=require(_0xeba4('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xeba4('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xeba4('0x2')](0x0);var events={'afterCreate':_0xeba4('0x3'),'afterUpdate':_0xeba4('0x4'),'afterDestroy':_0xeba4('0x5')};function emitEvent(_0xb33f6e){return function(_0x152b63,_0x305cf5,_0xfbe744){FaxQueueEvents[_0xeba4('0x6')](_0xb33f6e+':'+_0x152b63['id'],_0x152b63);FaxQueueEvents[_0xeba4('0x6')](_0xb33f6e,_0x152b63);_0xfbe744(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xeba4('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xc41a=['exports','../../mysqldb','FaxQueue','save','update','remove','emit','hook'];(function(_0xaeec0d,_0x58696d){var _0xf536b6=function(_0x4b51d3){while(--_0x4b51d3){_0xaeec0d['push'](_0xaeec0d['shift']());}};_0xf536b6(++_0x58696d);}(_0xc41a,0xd9));var _0xac41=function(_0x52913c,_0x4a63f0){_0x52913c=_0x52913c-0x0;var _0x84df7d=_0xc41a[_0x52913c];return _0x84df7d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xac41('0x0'))['db'][_0xac41('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac41('0x2'),'afterUpdate':_0xac41('0x3'),'afterDestroy':_0xac41('0x4')};function emitEvent(_0xced009){return function(_0x193a43,_0x1685e8,_0x2a68b9){FaxQueueEvents[_0xac41('0x5')](_0xced009+':'+_0x193a43['id'],_0x193a43);FaxQueueEvents[_0xac41('0x5')](_0xced009,_0x193a43);_0x2a68b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xac41('0x6')](e,emitEvent(event));}}module[_0xac41('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 862ae54..6f16630 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 _0xdd02=['define','FaxQueue','fax_queues','util','../../config/logger','moment','path','./faxQueue.attributes','exports'];(function(_0x460765,_0x30f733){var _0x22ee7e=function(_0x427d18){while(--_0x427d18){_0x460765['push'](_0x460765['shift']());}};_0x22ee7e(++_0x30f733);}(_0xdd02,0x123));var _0x2dd0=function(_0x123cbb,_0x19346e){_0x123cbb=_0x123cbb-0x0;var _0x441c07=_0xdd02[_0x123cbb];return _0x441c07;};'use strict';var _=require('lodash');var util=require(_0x2dd0('0x0'));var logger=require(_0x2dd0('0x1'))('api');var moment=require(_0x2dd0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dd0('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2dd0('0x4'));module[_0x2dd0('0x5')]=function(_0xc8749e,_0x3d7ed3){return _0xc8749e[_0x2dd0('0x6')](_0x2dd0('0x7'),attributes,{'tableName':_0x2dd0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb077=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb077,0xbd));var _0x7b07=function(_0x1d5acb,_0x22aea6){_0x1d5acb=_0x1d5acb-0x0;var _0x4b85c4=_0xb077[_0x1d5acb];return _0x4b85c4;};'use strict';var _=require(_0x7b07('0x0'));var util=require(_0x7b07('0x1'));var logger=require(_0x7b07('0x2'))(_0x7b07('0x3'));var moment=require('moment');var BPromise=require(_0x7b07('0x4'));var rp=require(_0x7b07('0x5'));var fs=require('fs');var path=require(_0x7b07('0x6'));var rimraf=require(_0x7b07('0x7'));var config=require(_0x7b07('0x8'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x3f073b,_0x2d451b){return _0x3f073b['define'](_0x7b07('0x9'),attributes,{'tableName':_0x7b07('0xa'),'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 9fadc29..d330043 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 _0xe07e=['redis','socket.io-emitter','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','map','model','ShowFaxQueue','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x1318a4,_0xd0efea){var _0x3f4ed9=function(_0x50d29d){while(--_0x50d29d){_0x1318a4['push'](_0x1318a4['shift']());}};_0x3f4ed9(++_0xd0efea);}(_0xe07e,0x1a6));var _0xee07=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xe07e[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0xee07('0x0'));var util=require(_0xee07('0x1'));var moment=require(_0xee07('0x2'));var BPromise=require(_0xee07('0x3'));var rs=require(_0xee07('0x4'));var fs=require('fs');var Redis=require(_0xee07('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee07('0x6'));var logger=require(_0xee07('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee07('0x8'));var client=jayson['client'][_0xee07('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xee07('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xee07('0xb'))(new Redis(config[_0xee07('0xa')]));require(_0xee07('0xc'))['register'](socket);function respondWithRpcPromise(_0x35aae6,_0x323b5a,_0x2357be){return new BPromise(function(_0x54bd40,_0x41d174){return client[_0xee07('0xd')](_0x35aae6,_0x2357be)['then'](function(_0x4cdd58){logger['info'](_0xee07('0xe'),_0x323b5a,_0xee07('0xf'));logger[_0xee07('0x10')](_0xee07('0x11'),_0x323b5a,_0xee07('0xf'),JSON[_0xee07('0x12')](_0x4cdd58));if(_0x4cdd58[_0xee07('0x13')]){if(_0x4cdd58[_0xee07('0x13')][_0xee07('0x14')]===0x1f4){logger['error'](_0xee07('0xe'),_0x323b5a,_0x4cdd58[_0xee07('0x13')][_0xee07('0x15')]);return _0x41d174(_0x4cdd58[_0xee07('0x13')]['message']);}logger[_0xee07('0x13')]('FaxQueue,\x20%s,\x20%s',_0x323b5a,_0x4cdd58[_0xee07('0x13')][_0xee07('0x15')]);return _0x54bd40(_0x4cdd58[_0xee07('0x13')][_0xee07('0x15')]);}else{logger[_0xee07('0x16')](_0xee07('0xe'),_0x323b5a,_0xee07('0xf'));_0x54bd40(_0x4cdd58[_0xee07('0x17')][_0xee07('0x15')]);}})['catch'](function(_0x426baa){logger['error'](_0xee07('0xe'),_0x323b5a,_0x426baa);_0x41d174(_0x426baa);});});}exports[_0xee07('0x18')]=function(_0x54b6f3){var _0x291632=this;return new Promise(function(_0x3ea2f9,_0x4fcda2){return db[_0xee07('0x19')][_0xee07('0x1a')]({'raw':_0x54b6f3[_0xee07('0x1b')]?_0x54b6f3[_0xee07('0x1b')][_0xee07('0x1c')]===undefined?!![]:![]:!![],'where':_0x54b6f3[_0xee07('0x1b')]?_0x54b6f3['options']['where']||null:null,'attributes':_0x54b6f3[_0xee07('0x1b')]?_0x54b6f3['options'][_0xee07('0x1d')]||null:null,'limit':_0x54b6f3[_0xee07('0x1b')]?_0x54b6f3[_0xee07('0x1b')]['limit']||null:null,'include':_0x54b6f3[_0xee07('0x1b')]?_0x54b6f3[_0xee07('0x1b')][_0xee07('0x1e')]?_[_0xee07('0x1f')](_0x54b6f3[_0xee07('0x1b')]['include'],function(_0x204aa9){return{'model':db[_0x204aa9[_0xee07('0x20')]],'as':_0x204aa9['as'],'attributes':_0x204aa9[_0xee07('0x1d')],'include':_0x204aa9[_0xee07('0x1e')]?_[_0xee07('0x1f')](_0x204aa9[_0xee07('0x1e')],function(_0x29a015){return{'model':db[_0x29a015[_0xee07('0x20')]],'as':_0x29a015['as'],'attributes':_0x29a015[_0xee07('0x1d')],'include':_0x29a015[_0xee07('0x1e')]?_[_0xee07('0x1f')](_0x29a015[_0xee07('0x1e')],function(_0x8d05fd){return{'model':db[_0x8d05fd['model']],'as':_0x8d05fd['as'],'attributes':_0x8d05fd[_0xee07('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb718cd){logger['info']('GetFaxQueue',_0x54b6f3);logger['debug'](_0xee07('0x18'),_0x54b6f3,JSON[_0xee07('0x12')](_0xb718cd));_0x3ea2f9(_0xb718cd);})['catch'](function(_0x2e7012){logger[_0xee07('0x13')]('GetFaxQueue',_0x2e7012['message'],_0x54b6f3);_0x4fcda2(_0x291632[_0xee07('0x13')](0x1f4,_0x2e7012[_0xee07('0x15')]));});});};exports[_0xee07('0x21')]=function(_0x19ada9){var _0x5832a0=this;return new Promise(function(_0x2fdbab,_0x1c5677){return db[_0xee07('0x19')]['find']({'raw':_0x19ada9['options']?_0x19ada9[_0xee07('0x1b')][_0xee07('0x1c')]===undefined?!![]:![]:!![],'where':_0x19ada9[_0xee07('0x1b')]?_0x19ada9[_0xee07('0x1b')][_0xee07('0x22')]||null:null,'attributes':_0x19ada9[_0xee07('0x1b')]?_0x19ada9['options'][_0xee07('0x1d')]||null:null,'include':_0x19ada9['options']?_0x19ada9[_0xee07('0x1b')][_0xee07('0x1e')]?_[_0xee07('0x1f')](_0x19ada9[_0xee07('0x1b')][_0xee07('0x1e')],function(_0x1d8401){return{'model':db[_0x1d8401['model']],'as':_0x1d8401['as'],'attributes':_0x1d8401[_0xee07('0x1d')],'include':_0x1d8401[_0xee07('0x1e')]?_['map'](_0x1d8401[_0xee07('0x1e')],function(_0x3b8b14){return{'model':db[_0x3b8b14['model']],'as':_0x3b8b14['as'],'attributes':_0x3b8b14[_0xee07('0x1d')],'include':_0x3b8b14[_0xee07('0x1e')]?_['map'](_0x3b8b14[_0xee07('0x1e')],function(_0x505dea){return{'model':db[_0x505dea['model']],'as':_0x505dea['as'],'attributes':_0x505dea[_0xee07('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xee07('0x23')](function(_0x448dcc){logger[_0xee07('0x16')]('ShowFaxQueue',_0x19ada9);logger[_0xee07('0x10')](_0xee07('0x21'),_0x19ada9,JSON['stringify'](_0x448dcc));_0x2fdbab(_0x448dcc);})['catch'](function(_0x352192){logger[_0xee07('0x13')]('ShowFaxQueue',_0x352192['message'],_0x19ada9);_0x1c5677(_0x5832a0[_0xee07('0x13')](0x1f4,_0x352192[_0xee07('0x15')]));});});}; \ No newline at end of file +var _0x1dc1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','where','attributes','limit','include','model','map','ShowFaxQueue','FaxQueue','find','raw'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x1dc1,0xfc));var _0x11dc=function(_0xe25540,_0x3c38fb){_0xe25540=_0xe25540-0x0;var _0x208c8f=_0x1dc1[_0xe25540];return _0x208c8f;};'use strict';var _=require(_0x11dc('0x0'));var util=require(_0x11dc('0x1'));var moment=require(_0x11dc('0x2'));var BPromise=require(_0x11dc('0x3'));var rs=require(_0x11dc('0x4'));var fs=require('fs');var Redis=require(_0x11dc('0x5'));var db=require(_0x11dc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x11dc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x11dc('0x8'));var client=jayson[_0x11dc('0x9')][_0x11dc('0xa')]({'port':0x232a});config[_0x11dc('0xb')]=_[_0x11dc('0xc')](config[_0x11dc('0xb')],{'host':_0x11dc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11dc('0xe'))[_0x11dc('0xf')](socket);function respondWithRpcPromise(_0x39455f,_0x34771e,_0x3cb1ab){return new BPromise(function(_0x22f0df,_0x2e8ef4){return client[_0x11dc('0x10')](_0x39455f,_0x3cb1ab)[_0x11dc('0x11')](function(_0x222614){logger[_0x11dc('0x12')](_0x11dc('0x13'),_0x34771e,_0x11dc('0x14'));logger[_0x11dc('0x15')](_0x11dc('0x16'),_0x34771e,_0x11dc('0x14'),JSON[_0x11dc('0x17')](_0x222614));if(_0x222614[_0x11dc('0x18')]){if(_0x222614[_0x11dc('0x18')][_0x11dc('0x19')]===0x1f4){logger['error'](_0x11dc('0x13'),_0x34771e,_0x222614[_0x11dc('0x18')][_0x11dc('0x1a')]);return _0x2e8ef4(_0x222614[_0x11dc('0x18')][_0x11dc('0x1a')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x34771e,_0x222614[_0x11dc('0x18')][_0x11dc('0x1a')]);return _0x22f0df(_0x222614[_0x11dc('0x18')][_0x11dc('0x1a')]);}else{logger[_0x11dc('0x12')](_0x11dc('0x13'),_0x34771e,_0x11dc('0x14'));_0x22f0df(_0x222614[_0x11dc('0x1b')][_0x11dc('0x1a')]);}})[_0x11dc('0x1c')](function(_0x5a7ede){logger[_0x11dc('0x18')](_0x11dc('0x13'),_0x34771e,_0x5a7ede);_0x2e8ef4(_0x5a7ede);});});}exports[_0x11dc('0x1d')]=function(_0x3704de){var _0x479c00=this;return new Promise(function(_0x4c6c97,_0x142a8b){return db['FaxQueue'][_0x11dc('0x1e')]({'raw':_0x3704de[_0x11dc('0x1f')]?_0x3704de[_0x11dc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3704de['options']?_0x3704de[_0x11dc('0x1f')][_0x11dc('0x20')]||null:null,'attributes':_0x3704de['options']?_0x3704de[_0x11dc('0x1f')][_0x11dc('0x21')]||null:null,'limit':_0x3704de['options']?_0x3704de['options'][_0x11dc('0x22')]||null:null,'include':_0x3704de['options']?_0x3704de[_0x11dc('0x1f')][_0x11dc('0x23')]?_['map'](_0x3704de[_0x11dc('0x1f')][_0x11dc('0x23')],function(_0x1cd403){return{'model':db[_0x1cd403[_0x11dc('0x24')]],'as':_0x1cd403['as'],'attributes':_0x1cd403['attributes'],'include':_0x1cd403['include']?_[_0x11dc('0x25')](_0x1cd403[_0x11dc('0x23')],function(_0x324de8){return{'model':db[_0x324de8['model']],'as':_0x324de8['as'],'attributes':_0x324de8['attributes'],'include':_0x324de8['include']?_[_0x11dc('0x25')](_0x324de8[_0x11dc('0x23')],function(_0x54bbaf){return{'model':db[_0x54bbaf[_0x11dc('0x24')]],'as':_0x54bbaf['as'],'attributes':_0x54bbaf[_0x11dc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x11dc('0x11')](function(_0x5c8a3c){logger[_0x11dc('0x12')](_0x11dc('0x1d'),_0x3704de);logger['debug'](_0x11dc('0x1d'),_0x3704de,JSON[_0x11dc('0x17')](_0x5c8a3c));_0x4c6c97(_0x5c8a3c);})[_0x11dc('0x1c')](function(_0x36545d){logger[_0x11dc('0x18')](_0x11dc('0x1d'),_0x36545d['message'],_0x3704de);_0x142a8b(_0x479c00[_0x11dc('0x18')](0x1f4,_0x36545d[_0x11dc('0x1a')]));});});};exports[_0x11dc('0x26')]=function(_0x35b6ac){var _0x4e10b5=this;return new Promise(function(_0x1eb05d,_0x57639a){return db[_0x11dc('0x27')][_0x11dc('0x28')]({'raw':_0x35b6ac[_0x11dc('0x1f')]?_0x35b6ac[_0x11dc('0x1f')][_0x11dc('0x29')]===undefined?!![]:![]:!![],'where':_0x35b6ac[_0x11dc('0x1f')]?_0x35b6ac['options'][_0x11dc('0x20')]||null:null,'attributes':_0x35b6ac[_0x11dc('0x1f')]?_0x35b6ac[_0x11dc('0x1f')][_0x11dc('0x21')]||null:null,'include':_0x35b6ac[_0x11dc('0x1f')]?_0x35b6ac['options']['include']?_['map'](_0x35b6ac['options']['include'],function(_0xad15aa){return{'model':db[_0xad15aa[_0x11dc('0x24')]],'as':_0xad15aa['as'],'attributes':_0xad15aa[_0x11dc('0x21')],'include':_0xad15aa[_0x11dc('0x23')]?_[_0x11dc('0x25')](_0xad15aa[_0x11dc('0x23')],function(_0xe66a26){return{'model':db[_0xe66a26[_0x11dc('0x24')]],'as':_0xe66a26['as'],'attributes':_0xe66a26[_0x11dc('0x21')],'include':_0xe66a26[_0x11dc('0x23')]?_[_0x11dc('0x25')](_0xe66a26[_0x11dc('0x23')],function(_0x510b44){return{'model':db[_0x510b44['model']],'as':_0x510b44['as'],'attributes':_0x510b44[_0x11dc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x11dc('0x11')](function(_0x5e6648){logger[_0x11dc('0x12')](_0x11dc('0x26'),_0x35b6ac);logger['debug'](_0x11dc('0x26'),_0x35b6ac,JSON[_0x11dc('0x17')](_0x5e6648));_0x1eb05d(_0x5e6648);})['catch'](function(_0x37ec60){logger[_0x11dc('0x18')](_0x11dc('0x26'),_0x37ec60[_0x11dc('0x1a')],_0x35b6ac);_0x57639a(_0x4e10b5['error'](0x1f4,_0x37ec60[_0x11dc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 86821d9..cca8f46 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 _0xe93a=['register','length','faxQueue:','./faxQueue.events','save'];(function(_0xcfaf9,_0xcdaa3d){var _0x23e581=function(_0x49a009){while(--_0x49a009){_0xcfaf9['push'](_0xcfaf9['shift']());}};_0x23e581(++_0xcdaa3d);}(_0xe93a,0x1a7));var _0xae93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe93a[_0xa464c9];return _0x3d73c4;};'use strict';var FaxQueueEvents=require(_0xae93('0x0'));var events=[_0xae93('0x1'),'remove','update'];function createListener(_0x50b0ef,_0x56e9dc){return function(_0x131864){_0x56e9dc['emit'](_0x50b0ef,_0x131864);};}function removeListener(_0x27ccf2,_0x48fef5){return function(){FaxQueueEvents['removeListener'](_0x27ccf2,_0x48fef5);};}exports[_0xae93('0x2')]=function(_0x49e03a){for(var _0x10b46b=0x0,_0x4d7f88=events[_0xae93('0x3')];_0x10b46b<_0x4d7f88;_0x10b46b++){var _0x574d1c=events[_0x10b46b];var _0x54f5b5=createListener(_0xae93('0x4')+_0x574d1c,_0x49e03a);FaxQueueEvents['on'](_0x574d1c,_0x54f5b5);}}; \ No newline at end of file +var _0x2171=['faxQueue:','save','remove','update','removeListener','register','length'];(function(_0x498d7e,_0x5d4b51){var _0xec429f=function(_0x2d6e5f){while(--_0x2d6e5f){_0x498d7e['push'](_0x498d7e['shift']());}};_0xec429f(++_0x5d4b51);}(_0x2171,0x143));var _0x1217=function(_0x380ef7,_0x385df7){_0x380ef7=_0x380ef7-0x0;var _0x4be299=_0x2171[_0x380ef7];return _0x4be299;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x1217('0x0'),_0x1217('0x1'),_0x1217('0x2')];function createListener(_0x49e4e8,_0x553b57){return function(_0x2f6288){_0x553b57['emit'](_0x49e4e8,_0x2f6288);};}function removeListener(_0x38b8ff,_0x41f787){return function(){FaxQueueEvents[_0x1217('0x3')](_0x38b8ff,_0x41f787);};}exports[_0x1217('0x4')]=function(_0x4eb644){for(var _0xafdf42=0x0,_0x8742bc=events[_0x1217('0x5')];_0xafdf42<_0x8742bc;_0xafdf42++){var _0x5bde7e=events[_0xafdf42];var _0x46474e=createListener(_0x1217('0x6')+_0x5bde7e,_0x4eb644);FaxQueueEvents['on'](_0x5bde7e,_0x46474e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8dff6c6..8ba9a9c 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 _0xe61c=['addAgents','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x2102e1,_0x4ab43a){var _0xc7090f=function(_0x404e7d){while(--_0x404e7d){_0x2102e1['push'](_0x2102e1['shift']());}};_0xc7090f(++_0x4ab43a);}(_0xe61c,0xee));var _0xce61=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe61c[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xce61('0x0'));var util=require('util');var path=require(_0xce61('0x1'));var timeout=require(_0xce61('0x2'));var express=require(_0xce61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce61('0x5'));var controller=require(_0xce61('0x6'));router[_0xce61('0x7')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0x9')]);router[_0xce61('0x7')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0xb')]);router[_0xce61('0x7')](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0xd')]);router[_0xce61('0x7')](_0xce61('0xe'),auth['isAuthenticated'](),controller[_0xce61('0xf')]);router[_0xce61('0x7')]('/:id/teams',auth[_0xce61('0x8')](),controller[_0xce61('0x10')]);router['get'](_0xce61('0x11'),auth['isAuthenticated'](),controller[_0xce61('0x12')]);router[_0xce61('0x13')]('/',auth['isAuthenticated'](),controller[_0xce61('0x14')]);router['post'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x16')]);router[_0xce61('0x13')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x17')]);router['put']('/:id',auth[_0xce61('0x8')](),controller['update']);router['delete'](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0x18')]);router['delete'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x19')]);router[_0xce61('0x1a')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x1b')]);module[_0xce61('0x1c')]=router; \ No newline at end of file +var _0x627e=['addTeams','addAgents','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x4ee388,_0x33dbf7){var _0x1b3b6e=function(_0x338ab4){while(--_0x338ab4){_0x4ee388['push'](_0x4ee388['shift']());}};_0x1b3b6e(++_0x33dbf7);}(_0x627e,0x14a));var _0xe627=function(_0x2618b1,_0x18bc3f){_0x2618b1=_0x2618b1-0x0;var _0x3702e5=_0x627e[_0x2618b1];return _0x3702e5;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xa')](_0xe627('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xe627('0xa')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);router[_0xe627('0xa')](_0xe627('0x11'),auth[_0xe627('0x8')](),controller[_0xe627('0x12')]);router[_0xe627('0x13')]('/',auth['isAuthenticated'](),controller[_0xe627('0x14')]);router[_0xe627('0x13')](_0xe627('0xf'),auth['isAuthenticated'](),controller[_0xe627('0x15')]);router[_0xe627('0x13')](_0xe627('0x11'),auth[_0xe627('0x8')](),controller[_0xe627('0x16')]);router[_0xe627('0x17')](_0xe627('0xd'),auth['isAuthenticated'](),controller[_0xe627('0x18')]);router[_0xe627('0x19')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x1a')]);router[_0xe627('0x19')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller['removeTeams']);router[_0xe627('0x19')]('/:id/users',auth[_0xe627('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 73556cb..232a01b 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 _0x769c=['STRING','DATE','moment','exports'];(function(_0x403bee,_0x1348e5){var _0x12319f=function(_0x39cb5e){while(--_0x39cb5e){_0x403bee['push'](_0x403bee['shift']());}};_0x12319f(++_0x1348e5);}(_0x769c,0x96));var _0xc769=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x769c[_0x413feb];return _0x40ee88;};'use strict';var moment=require(_0xc769('0x0'));var Sequelize=require('sequelize');module[_0xc769('0x1')]={'uniqueid':{'type':Sequelize[_0xc769('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc769('0x3')]},'acceptAt':{'type':Sequelize[_0xc769('0x3')]},'exitAt':{'type':Sequelize[_0xc769('0x3')]},'reason':{'type':Sequelize[_0xc769('0x2')]}}; \ No newline at end of file +var _0xf505=['STRING','DATE','moment','sequelize','exports'];(function(_0x403cd8,_0x2d9921){var _0x5d5aac=function(_0x24b4c2){while(--_0x24b4c2){_0x403cd8['push'](_0x403cd8['shift']());}};_0x5d5aac(++_0x2d9921);}(_0xf505,0x1e7));var _0x5f50=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xf505[_0x4e93a9];return _0x43013c;};'use strict';var moment=require(_0x5f50('0x0'));var Sequelize=require(_0x5f50('0x1'));module[_0x5f50('0x2')]={'uniqueid':{'type':Sequelize[_0x5f50('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5f50('0x3')]},'joinAt':{'type':Sequelize[_0x5f50('0x4')]},'leaveAt':{'type':Sequelize[_0x5f50('0x4')]},'acceptAt':{'type':Sequelize[_0x5f50('0x4')]},'exitAt':{'type':Sequelize[_0x5f50('0x4')]},'reason':{'type':Sequelize[_0x5f50('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a4754c2..69f68cc 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 _0x1da6=['update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x454017,_0x4c2948){var _0x22d946=function(_0x3b9da6){while(--_0x3b9da6){_0x454017['push'](_0x454017['shift']());}};_0x22d946(++_0x4c2948);}(_0x1da6,0x7c));var _0x61da=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0x1da6[_0x2bf5bd];return _0xc810c0;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];function respondWithStatusCode(_0x1eb368,_0x1036e4){_0x1036e4=_0x1036e4||0xcc;return function(_0x43ec70){if(_0x43ec70){return _0x1eb368['sendStatus'](_0x1036e4);}return _0x1eb368[_0x61da('0x1f')](_0x1036e4)[_0x61da('0x20')]();};}function respondWithResult(_0x191033,_0x472abc){_0x472abc=_0x472abc||0xc8;return function(_0x55eef1){if(_0x55eef1){return _0x191033[_0x61da('0x1f')](_0x472abc)['json'](_0x55eef1);}};}function respondWithFilteredResult(_0x21a5fc,_0x6d24b7){return function(_0x4a0aea){if(_0x4a0aea){var _0x53f3a4=typeof _0x6d24b7[_0x61da('0x21')]===_0x61da('0x22')&&typeof _0x6d24b7[_0x61da('0x23')]===_0x61da('0x22');var _0x2ac3aa=_0x4a0aea[_0x61da('0x24')];var _0x505b1c=_0x53f3a4?0x0:_0x6d24b7[_0x61da('0x21')];var _0x34a678=_0x53f3a4?_0x4a0aea[_0x61da('0x24')]:_0x6d24b7[_0x61da('0x21')]+_0x6d24b7['limit'];var _0x1a0e6e;if(_0x34a678>=_0x2ac3aa){_0x34a678=_0x2ac3aa;_0x1a0e6e=0xc8;}else{_0x1a0e6e=0xce;}_0x21a5fc[_0x61da('0x1f')](_0x1a0e6e);return _0x21a5fc[_0x61da('0x25')](_0x61da('0x26'),_0x505b1c+'-'+_0x34a678+'/'+_0x2ac3aa)['json'](_0x4a0aea);}return null;};}function patchUpdates(_0x22b8bc){return function(_0x5c0363){try{jsonpatch[_0x61da('0x27')](_0x5c0363,_0x22b8bc,!![]);}catch(_0x172066){return BPromise[_0x61da('0x28')](_0x172066);}return _0x5c0363[_0x61da('0x29')]();};}function saveUpdates(_0x1868af,_0x129bb0){return function(_0x30c6f8){if(_0x30c6f8){return _0x30c6f8[_0x61da('0x2a')](_0x1868af)[_0x61da('0x2b')](function(_0x325e28){return _0x325e28;});}return null;};}function removeEntity(_0x56f5d2,_0x2c9e83){return function(_0x35550a){if(_0x35550a){return _0x35550a[_0x61da('0x2c')]()[_0x61da('0x2b')](function(){_0x56f5d2[_0x61da('0x1f')](0xcc)[_0x61da('0x20')]();});}};}function handleEntityNotFound(_0x4860d4,_0x2c5d97){return function(_0xe37079){if(!_0xe37079){_0x4860d4[_0x61da('0x2d')](0x194);}return _0xe37079;};}function handleError(_0x100ba1,_0x351241){_0x351241=_0x351241||0x1f4;return function(_0x262e32){logger[_0x61da('0x2e')](_0x262e32[_0x61da('0x2f')]);if(_0x262e32['name']){delete _0x262e32[_0x61da('0x30')];}_0x100ba1[_0x61da('0x1f')](_0x351241)[_0x61da('0x31')](_0x262e32);};}exports[_0x61da('0x32')]=function(_0x52f486,_0x275aa6){var _0x591efe={},_0x2c9a1d={},_0x2cc862={'count':0x0,'rows':[]};var _0x3a31a2=_[_0x61da('0x33')](db[_0x61da('0x34')][_0x61da('0x35')],function(_0xb97400){return{'name':_0xb97400['fieldName'],'type':_0xb97400[_0x61da('0x36')]['key']};});_0x2c9a1d['model']=_[_0x61da('0x33')](_0x3a31a2,_0x61da('0x30'));_0x2c9a1d[_0x61da('0x37')]=_[_0x61da('0x38')](_0x52f486[_0x61da('0x37')]);_0x2c9a1d['filters']=_[_0x61da('0x39')](_0x2c9a1d[_0x61da('0x3a')],_0x2c9a1d[_0x61da('0x37')]);_0x591efe[_0x61da('0x3b')]=_['intersection'](_0x2c9a1d[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x52f486['query'][_0x61da('0x3c')]));_0x591efe['attributes']=_0x591efe['attributes']['length']?_0x591efe['attributes']:_0x2c9a1d['model'];if(!_0x52f486[_0x61da('0x37')][_0x61da('0x3d')](_0x61da('0x3e'))){_0x591efe[_0x61da('0x23')]=qs[_0x61da('0x23')](_0x52f486['query'][_0x61da('0x23')]);_0x591efe[_0x61da('0x21')]=qs[_0x61da('0x21')](_0x52f486['query'][_0x61da('0x21')]);}_0x591efe[_0x61da('0x3f')]=qs[_0x61da('0x40')](_0x52f486['query'][_0x61da('0x40')]);_0x591efe[_0x61da('0x41')]=qs[_0x61da('0x42')](_[_0x61da('0x43')](_0x52f486[_0x61da('0x37')],_0x2c9a1d['filters']),_0x3a31a2);if(_0x52f486[_0x61da('0x37')][_0x61da('0x44')]){_0x591efe[_0x61da('0x41')]=_[_0x61da('0x45')](_0x591efe[_0x61da('0x41')],{'$or':_['map'](_0x3a31a2,function(_0x4e6512){if(_0x4e6512['type']!==_0x61da('0x46')){var _0x278732={};_0x278732[_0x4e6512[_0x61da('0x30')]]={'$like':'%'+_0x52f486[_0x61da('0x37')][_0x61da('0x44')]+'%'};return _0x278732;}})});}_0x591efe=_[_0x61da('0x45')]({},_0x591efe,_0x52f486[_0x61da('0x47')]);var _0x522aeb={'where':_0x591efe[_0x61da('0x41')]};return db[_0x61da('0x34')]['count'](_0x522aeb)[_0x61da('0x2b')](function(_0x1a430f){_0x2cc862[_0x61da('0x24')]=_0x1a430f;if(_0x52f486['query'][_0x61da('0x48')]){_0x591efe['include']=[{'all':!![]}];}return db[_0x61da('0x34')][_0x61da('0x49')](_0x591efe);})[_0x61da('0x2b')](function(_0x40d4a2){_0x2cc862['rows']=_0x40d4a2;return _0x2cc862;})[_0x61da('0x2b')](respondWithFilteredResult(_0x275aa6,_0x591efe))[_0x61da('0x4a')](handleError(_0x275aa6,null));};exports[_0x61da('0x4b')]=function(_0x47e1a5,_0x18e2da){var _0x36d744={'raw':!![],'where':{'id':_0x47e1a5[_0x61da('0x4c')]['id']}},_0x1dd879={};_0x1dd879[_0x61da('0x3a')]=_[_0x61da('0x38')](db['FaxQueueReport'][_0x61da('0x35')]);_0x1dd879[_0x61da('0x37')]=_[_0x61da('0x38')](_0x47e1a5[_0x61da('0x37')]);_0x1dd879[_0x61da('0x42')]=_[_0x61da('0x39')](_0x1dd879[_0x61da('0x3a')],_0x1dd879[_0x61da('0x37')]);_0x36d744['attributes']=_['intersection'](_0x1dd879[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x47e1a5[_0x61da('0x37')][_0x61da('0x3c')]));_0x36d744[_0x61da('0x3b')]=_0x36d744['attributes'][_0x61da('0x4d')]?_0x36d744[_0x61da('0x3b')]:_0x1dd879[_0x61da('0x3a')];if(_0x47e1a5[_0x61da('0x37')][_0x61da('0x48')]){_0x36d744[_0x61da('0x4e')]=[{'all':!![]}];}_0x36d744=_[_0x61da('0x45')]({},_0x36d744,_0x47e1a5[_0x61da('0x47')]);return db[_0x61da('0x34')]['find'](_0x36d744)[_0x61da('0x2b')](handleEntityNotFound(_0x18e2da,null))[_0x61da('0x2b')](respondWithResult(_0x18e2da,null))[_0x61da('0x4a')](handleError(_0x18e2da,null));};exports[_0x61da('0x4f')]=function(_0x5bf90a,_0x1b5ebf){return db[_0x61da('0x34')][_0x61da('0x4f')](_0x5bf90a[_0x61da('0x50')],{})[_0x61da('0x2b')](respondWithResult(_0x1b5ebf,0xc9))['catch'](handleError(_0x1b5ebf,null));};exports[_0x61da('0x2a')]=function(_0x5b3dee,_0x584ddd){if(_0x5b3dee[_0x61da('0x50')]['id']){delete _0x5b3dee[_0x61da('0x50')]['id'];}return db['FaxQueueReport'][_0x61da('0x51')]({'where':{'id':_0x5b3dee[_0x61da('0x4c')]['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x584ddd,null))['then'](saveUpdates(_0x5b3dee[_0x61da('0x50')],null))[_0x61da('0x2b')](respondWithResult(_0x584ddd,null))[_0x61da('0x4a')](handleError(_0x584ddd,null));};exports[_0x61da('0x2c')]=function(_0x4dd6fb,_0x19ec8a){return db['FaxQueueReport'][_0x61da('0x51')]({'where':{'id':_0x4dd6fb['params']['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x19ec8a,null))[_0x61da('0x2b')](removeEntity(_0x19ec8a,null))[_0x61da('0x4a')](handleError(_0x19ec8a,null));};exports[_0x61da('0x52')]=function(_0x47b335,_0xc5c8a6){return db[_0x61da('0x34')][_0x61da('0x52')]()[_0x61da('0x2b')](respondWithResult(_0xc5c8a6,null))[_0x61da('0x4a')](handleError(_0xc5c8a6,null));}; \ No newline at end of file +var _0xa854=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','FaxQueueReport','findAll','rows','catch','show','includeAll','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model'];(function(_0x47c1f9,_0x28cc9a){var _0x309a7f=function(_0x26e1c2){while(--_0x26e1c2){_0x47c1f9['push'](_0x47c1f9['shift']());}};_0x309a7f(++_0x28cc9a);}(_0xa854,0x103));var _0x4a85=function(_0x40645e,_0x50763f){_0x40645e=_0x40645e-0x0;var _0x49e092=_0xa854[_0x40645e];return _0x49e092;};'use strict';var emlformat=require(_0x4a85('0x0'));var rimraf=require(_0x4a85('0x1'));var zipdir=require(_0x4a85('0x2'));var jsonpatch=require(_0x4a85('0x3'));var rp=require(_0x4a85('0x4'));var moment=require('moment');var BPromise=require(_0x4a85('0x5'));var Mustache=require('mustache');var util=require(_0x4a85('0x6'));var path=require('path');var sox=require(_0x4a85('0x7'));var csv=require(_0x4a85('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a85('0x9'));var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0x8'));var querystring=require(_0x4a85('0xd'));var Papa=require(_0x4a85('0xe'));var Redis=require(_0x4a85('0xf'));var authService=require(_0x4a85('0x10'));var qs=require(_0x4a85('0x11'));var as=require(_0x4a85('0x12'));var hardwareService=require(_0x4a85('0x13'));var logger=require('../../config/logger')(_0x4a85('0x14'));var utils=require(_0x4a85('0x15'));var config=require(_0x4a85('0x16'));var licenseUtil=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];function respondWithStatusCode(_0x95669b,_0x108b0d){_0x108b0d=_0x108b0d||0xcc;return function(_0x42088d){if(_0x42088d){return _0x95669b[_0x4a85('0x19')](_0x108b0d);}return _0x95669b['status'](_0x108b0d)[_0x4a85('0x1a')]();};}function respondWithResult(_0x2a2802,_0x454596){_0x454596=_0x454596||0xc8;return function(_0x153d39){if(_0x153d39){return _0x2a2802[_0x4a85('0x1b')](_0x454596)[_0x4a85('0x1c')](_0x153d39);}};}function respondWithFilteredResult(_0x34743a,_0x256a3c){return function(_0x1922cb){if(_0x1922cb){var _0x397f4a=typeof _0x256a3c[_0x4a85('0x1d')]==='undefined'&&typeof _0x256a3c[_0x4a85('0x1e')]===_0x4a85('0x1f');var _0x5c9b9f=_0x1922cb[_0x4a85('0x20')];var _0x159ed0=_0x397f4a?0x0:_0x256a3c[_0x4a85('0x1d')];var _0x50e210=_0x397f4a?_0x1922cb[_0x4a85('0x20')]:_0x256a3c[_0x4a85('0x1d')]+_0x256a3c[_0x4a85('0x1e')];var _0x496b8a;if(_0x50e210>=_0x5c9b9f){_0x50e210=_0x5c9b9f;_0x496b8a=0xc8;}else{_0x496b8a=0xce;}_0x34743a['status'](_0x496b8a);return _0x34743a[_0x4a85('0x21')](_0x4a85('0x22'),_0x159ed0+'-'+_0x50e210+'/'+_0x5c9b9f)[_0x4a85('0x1c')](_0x1922cb);}return null;};}function patchUpdates(_0x2ace62){return function(_0x121379){try{jsonpatch[_0x4a85('0x23')](_0x121379,_0x2ace62,!![]);}catch(_0x382af0){return BPromise[_0x4a85('0x24')](_0x382af0);}return _0x121379['save']();};}function saveUpdates(_0x4f93ba,_0x5cf506){return function(_0x4219a7){if(_0x4219a7){return _0x4219a7[_0x4a85('0x25')](_0x4f93ba)[_0x4a85('0x26')](function(_0x408581){return _0x408581;});}return null;};}function removeEntity(_0x4d3774,_0x154bea){return function(_0x27f9c1){if(_0x27f9c1){return _0x27f9c1[_0x4a85('0x27')]()[_0x4a85('0x26')](function(){_0x4d3774[_0x4a85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1075e2,_0x1a9a8c){return function(_0x1b3f6b){if(!_0x1b3f6b){_0x1075e2[_0x4a85('0x19')](0x194);}return _0x1b3f6b;};}function handleError(_0xab59e0,_0x27cab3){_0x27cab3=_0x27cab3||0x1f4;return function(_0x4a34d5){logger[_0x4a85('0x28')](_0x4a34d5[_0x4a85('0x29')]);if(_0x4a34d5[_0x4a85('0x2a')]){delete _0x4a34d5['name'];}_0xab59e0[_0x4a85('0x1b')](_0x27cab3)['send'](_0x4a34d5);};}exports[_0x4a85('0x2b')]=function(_0x1b91ec,_0x264515){var _0x3ade10={},_0x4596c6={},_0x37095a={'count':0x0,'rows':[]};var _0x25ddd5=_[_0x4a85('0x2c')](db['FaxQueueReport'][_0x4a85('0x2d')],function(_0x4eda22){return{'name':_0x4eda22[_0x4a85('0x2e')],'type':_0x4eda22[_0x4a85('0x2f')]['key']};});_0x4596c6[_0x4a85('0x30')]=_[_0x4a85('0x2c')](_0x25ddd5,_0x4a85('0x2a'));_0x4596c6[_0x4a85('0x31')]=_[_0x4a85('0x32')](_0x1b91ec[_0x4a85('0x31')]);_0x4596c6[_0x4a85('0x33')]=_[_0x4a85('0x34')](_0x4596c6[_0x4a85('0x30')],_0x4596c6[_0x4a85('0x31')]);_0x3ade10[_0x4a85('0x35')]=_[_0x4a85('0x34')](_0x4596c6['model'],qs[_0x4a85('0x36')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x36')]));_0x3ade10[_0x4a85('0x35')]=_0x3ade10['attributes'][_0x4a85('0x37')]?_0x3ade10[_0x4a85('0x35')]:_0x4596c6[_0x4a85('0x30')];if(!_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x38')](_0x4a85('0x39'))){_0x3ade10[_0x4a85('0x1e')]=qs['limit'](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x1e')]);_0x3ade10['offset']=qs[_0x4a85('0x1d')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x1d')]);}_0x3ade10['order']=qs[_0x4a85('0x3a')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x3a')]);_0x3ade10[_0x4a85('0x3b')]=qs[_0x4a85('0x33')](_[_0x4a85('0x3c')](_0x1b91ec[_0x4a85('0x31')],_0x4596c6[_0x4a85('0x33')]),_0x25ddd5);if(_0x1b91ec[_0x4a85('0x31')]['filter']){_0x3ade10[_0x4a85('0x3b')]=_[_0x4a85('0x3d')](_0x3ade10[_0x4a85('0x3b')],{'$or':_['map'](_0x25ddd5,function(_0x3e7e9f){if(_0x3e7e9f['type']!==_0x4a85('0x3e')){var _0x281713={};_0x281713[_0x3e7e9f['name']]={'$like':'%'+_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x3f')]+'%'};return _0x281713;}})});}_0x3ade10=_[_0x4a85('0x3d')]({},_0x3ade10,_0x1b91ec['options']);var _0x48351d={'where':_0x3ade10[_0x4a85('0x3b')]};return db[_0x4a85('0x40')]['count'](_0x48351d)['then'](function(_0x4cde74){_0x37095a[_0x4a85('0x20')]=_0x4cde74;if(_0x1b91ec[_0x4a85('0x31')]['includeAll']){_0x3ade10['include']=[{'all':!![]}];}return db[_0x4a85('0x40')][_0x4a85('0x41')](_0x3ade10);})[_0x4a85('0x26')](function(_0x1b2e49){_0x37095a[_0x4a85('0x42')]=_0x1b2e49;return _0x37095a;})[_0x4a85('0x26')](respondWithFilteredResult(_0x264515,_0x3ade10))[_0x4a85('0x43')](handleError(_0x264515,null));};exports[_0x4a85('0x44')]=function(_0x4ecf67,_0x5b0eb9){var _0x351a1b={'raw':!![],'where':{'id':_0x4ecf67['params']['id']}},_0x49bd4e={};_0x49bd4e[_0x4a85('0x30')]=_[_0x4a85('0x32')](db[_0x4a85('0x40')][_0x4a85('0x2d')]);_0x49bd4e[_0x4a85('0x31')]=_[_0x4a85('0x32')](_0x4ecf67[_0x4a85('0x31')]);_0x49bd4e[_0x4a85('0x33')]=_['intersection'](_0x49bd4e['model'],_0x49bd4e[_0x4a85('0x31')]);_0x351a1b[_0x4a85('0x35')]=_[_0x4a85('0x34')](_0x49bd4e[_0x4a85('0x30')],qs[_0x4a85('0x36')](_0x4ecf67['query']['fields']));_0x351a1b[_0x4a85('0x35')]=_0x351a1b[_0x4a85('0x35')][_0x4a85('0x37')]?_0x351a1b[_0x4a85('0x35')]:_0x49bd4e[_0x4a85('0x30')];if(_0x4ecf67[_0x4a85('0x31')][_0x4a85('0x45')]){_0x351a1b[_0x4a85('0x46')]=[{'all':!![]}];}_0x351a1b=_[_0x4a85('0x3d')]({},_0x351a1b,_0x4ecf67[_0x4a85('0x47')]);return db[_0x4a85('0x40')][_0x4a85('0x48')](_0x351a1b)[_0x4a85('0x26')](handleEntityNotFound(_0x5b0eb9,null))['then'](respondWithResult(_0x5b0eb9,null))[_0x4a85('0x43')](handleError(_0x5b0eb9,null));};exports[_0x4a85('0x49')]=function(_0x1ed775,_0x5b7f9e){return db[_0x4a85('0x40')][_0x4a85('0x49')](_0x1ed775['body'],{})[_0x4a85('0x26')](respondWithResult(_0x5b7f9e,0xc9))[_0x4a85('0x43')](handleError(_0x5b7f9e,null));};exports['update']=function(_0x5cfa99,_0x10b0e1){if(_0x5cfa99['body']['id']){delete _0x5cfa99[_0x4a85('0x4a')]['id'];}return db[_0x4a85('0x40')][_0x4a85('0x48')]({'where':{'id':_0x5cfa99[_0x4a85('0x4b')]['id']}})[_0x4a85('0x26')](handleEntityNotFound(_0x10b0e1,null))[_0x4a85('0x26')](saveUpdates(_0x5cfa99['body'],null))['then'](respondWithResult(_0x10b0e1,null))[_0x4a85('0x43')](handleError(_0x10b0e1,null));};exports[_0x4a85('0x27')]=function(_0x424705,_0xf27adc){return db[_0x4a85('0x40')][_0x4a85('0x48')]({'where':{'id':_0x424705[_0x4a85('0x4b')]['id']}})[_0x4a85('0x26')](handleEntityNotFound(_0xf27adc,null))[_0x4a85('0x26')](removeEntity(_0xf27adc,null))[_0x4a85('0x43')](handleError(_0xf27adc,null));};exports[_0x4a85('0x4c')]=function(_0x17a14e,_0x1b25ca){return db[_0x4a85('0x40')]['describe']()[_0x4a85('0x26')](respondWithResult(_0x1b25ca,null))[_0x4a85('0x43')](handleError(_0x1b25ca,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f444387..0206cd3 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x1ff6d9,_0x519514){var _0x2058ec=function(_0x3f685b){while(--_0x3f685b){_0x1ff6d9['push'](_0x1ff6d9['shift']());}};_0x2058ec(++_0x519514);}(_0x7a54,0x106));var _0x47a5=function(_0x45f925,_0x5f5ae0){_0x45f925=_0x45f925-0x0;var _0x54578f=_0x7a54[_0x45f925];return _0x54578f;};'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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20cfee,_0x388c9c){var _0x5802ab=function(_0x35b6a5){while(--_0x35b6a5){_0x20cfee['push'](_0x20cfee['shift']());}};_0x5802ab(++_0x388c9c);}(_0x4975,0x86));var _0x5497=function(_0x28869d,_0x266a56){_0x28869d=_0x28869d-0x0;var _0x47eb98=_0x4975[_0x28869d];return _0x47eb98;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 10d4340..0a95512 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 _0xe369=['client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','debug','stringify','UpdateFaxQueueReport','update','body','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xbfbfe4,_0x232b2f){var _0x21a43f=function(_0x2dbcd4){while(--_0x2dbcd4){_0xbfbfe4['push'](_0xbfbfe4['shift']());}};_0x21a43f(++_0x232b2f);}(_0xe369,0x1b9));var _0x9e36=function(_0x4e6b24,_0x266775){_0x4e6b24=_0x4e6b24-0x0;var _0x533b0b=_0xe369[_0x4e6b24];return _0x533b0b;};'use strict';var _=require(_0x9e36('0x0'));var util=require(_0x9e36('0x1'));var moment=require('moment');var BPromise=require(_0x9e36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e36('0x3'));var db=require(_0x9e36('0x4'))['db'];var utils=require(_0x9e36('0x5'));var logger=require(_0x9e36('0x6'))(_0x9e36('0x7'));var config=require('../../config/environment');var jayson=require(_0x9e36('0x8'));var client=jayson[_0x9e36('0x9')][_0x9e36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x740a50,_0x47da1b,_0x3e2510){return new BPromise(function(_0x3f2a01,_0xa78562){return client['request'](_0x740a50,_0x3e2510)[_0x9e36('0xb')](function(_0x57e347){logger[_0x9e36('0xc')](_0x9e36('0xd'),_0x47da1b,_0x9e36('0xe'));logger['debug'](_0x9e36('0xf'),_0x47da1b,_0x9e36('0xe'),JSON['stringify'](_0x57e347));if(_0x57e347[_0x9e36('0x10')]){if(_0x57e347[_0x9e36('0x10')]['code']===0x1f4){logger[_0x9e36('0x10')](_0x9e36('0xd'),_0x47da1b,_0x57e347[_0x9e36('0x10')][_0x9e36('0x11')]);return _0xa78562(_0x57e347['error'][_0x9e36('0x11')]);}logger[_0x9e36('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x47da1b,_0x57e347[_0x9e36('0x10')]['message']);return _0x3f2a01(_0x57e347['error'][_0x9e36('0x11')]);}else{logger[_0x9e36('0xc')](_0x9e36('0xd'),_0x47da1b,_0x9e36('0xe'));_0x3f2a01(_0x57e347[_0x9e36('0x12')][_0x9e36('0x11')]);}})[_0x9e36('0x13')](function(_0xac1ad6){logger[_0x9e36('0x10')](_0x9e36('0xd'),_0x47da1b,_0xac1ad6);_0xa78562(_0xac1ad6);});});}exports[_0x9e36('0x14')]=function(_0x19e6b7){var _0x593956=this;return new Promise(function(_0x27d843,_0x497824){return db[_0x9e36('0x15')][_0x9e36('0x16')](_0x19e6b7['body'],{'raw':_0x19e6b7[_0x9e36('0x17')]?_0x19e6b7['options']['raw']===undefined?!![]:![]:!![]})[_0x9e36('0xb')](function(_0x3f6b82){logger[_0x9e36('0xc')](_0x9e36('0x14'),_0x19e6b7);logger[_0x9e36('0x18')]('CreateFaxQueueReport',_0x19e6b7,JSON[_0x9e36('0x19')](_0x3f6b82));_0x27d843(_0x3f6b82);})[_0x9e36('0x13')](function(_0x2e0ac7){logger[_0x9e36('0x10')]('CreateFaxQueueReport',_0x2e0ac7['message'],_0x19e6b7);_0x497824(_0x593956[_0x9e36('0x10')](0x1f4,_0x2e0ac7[_0x9e36('0x11')]));});});};exports[_0x9e36('0x1a')]=function(_0x2783eb){var _0x540595=this;return new Promise(function(_0x30fa7c,_0x158bfe){return db['FaxQueueReport'][_0x9e36('0x1b')](_0x2783eb[_0x9e36('0x1c')],{'raw':_0x2783eb[_0x9e36('0x17')]?_0x2783eb[_0x9e36('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2783eb[_0x9e36('0x17')]?_0x2783eb[_0x9e36('0x17')][_0x9e36('0x1d')]||null:null,'attributes':_0x2783eb[_0x9e36('0x17')]?_0x2783eb[_0x9e36('0x17')]['attributes']||null:null,'limit':_0x2783eb['options']?_0x2783eb['options']['limit']||null:null})[_0x9e36('0xb')](function(_0x2444b1){logger[_0x9e36('0xc')](_0x9e36('0x1a'),_0x2783eb);logger[_0x9e36('0x18')]('UpdateFaxQueueReport',_0x2783eb,JSON[_0x9e36('0x19')](_0x2444b1));_0x30fa7c(_0x2444b1);})['catch'](function(_0x38f163){logger[_0x9e36('0x10')]('UpdateFaxQueueReport',_0x38f163[_0x9e36('0x11')],_0x2783eb);_0x158bfe(_0x540595[_0x9e36('0x10')](0x1f4,_0x38f163[_0x9e36('0x11')]));});});}; \ No newline at end of file +var _0x8902=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','update','where','UpdateFaxQueueReport'];(function(_0x546d1d,_0x563949){var _0x89bcfb=function(_0x1089af){while(--_0x1089af){_0x546d1d['push'](_0x546d1d['shift']());}};_0x89bcfb(++_0x563949);}(_0x8902,0x155));var _0x2890=function(_0x5ed194,_0xd20591){_0x5ed194=_0x5ed194-0x0;var _0x243121=_0x8902[_0x5ed194];return _0x243121;};'use strict';var _=require(_0x2890('0x0'));var util=require(_0x2890('0x1'));var moment=require(_0x2890('0x2'));var BPromise=require('bluebird');var rs=require(_0x2890('0x3'));var fs=require('fs');var Redis=require(_0x2890('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2890('0x5'));var logger=require('../../config/logger')(_0x2890('0x6'));var config=require(_0x2890('0x7'));var jayson=require(_0x2890('0x8'));var client=jayson[_0x2890('0x9')][_0x2890('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x304d35,_0x2306bf,_0x30caba){return new BPromise(function(_0x24aedd,_0x36370d){return client[_0x2890('0xb')](_0x304d35,_0x30caba)['then'](function(_0x1bfefd){logger[_0x2890('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2306bf,'request\x20sent');logger[_0x2890('0xd')](_0x2890('0xe'),_0x2306bf,_0x2890('0xf'),JSON['stringify'](_0x1bfefd));if(_0x1bfefd['error']){if(_0x1bfefd['error']['code']===0x1f4){logger[_0x2890('0x10')](_0x2890('0x11'),_0x2306bf,_0x1bfefd[_0x2890('0x10')][_0x2890('0x12')]);return _0x36370d(_0x1bfefd[_0x2890('0x10')][_0x2890('0x12')]);}logger[_0x2890('0x10')](_0x2890('0x11'),_0x2306bf,_0x1bfefd[_0x2890('0x10')]['message']);return _0x24aedd(_0x1bfefd[_0x2890('0x10')]['message']);}else{logger[_0x2890('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2306bf,_0x2890('0xf'));_0x24aedd(_0x1bfefd['result']['message']);}})[_0x2890('0x13')](function(_0x104899){logger[_0x2890('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2306bf,_0x104899);_0x36370d(_0x104899);});});}exports[_0x2890('0x14')]=function(_0x69cfef){var _0x158cc9=this;return new Promise(function(_0x3c901a,_0x50bbbc){return db[_0x2890('0x15')][_0x2890('0x16')](_0x69cfef[_0x2890('0x17')],{'raw':_0x69cfef['options']?_0x69cfef[_0x2890('0x18')][_0x2890('0x19')]===undefined?!![]:![]:!![]})[_0x2890('0x1a')](function(_0x3ad724){logger[_0x2890('0xc')]('CreateFaxQueueReport',_0x69cfef);logger[_0x2890('0xd')](_0x2890('0x14'),_0x69cfef,JSON[_0x2890('0x1b')](_0x3ad724));_0x3c901a(_0x3ad724);})[_0x2890('0x13')](function(_0x376700){logger[_0x2890('0x10')](_0x2890('0x14'),_0x376700['message'],_0x69cfef);_0x50bbbc(_0x158cc9[_0x2890('0x10')](0x1f4,_0x376700[_0x2890('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x609de3){var _0x242051=this;return new Promise(function(_0x33882c,_0x4b38ae){return db[_0x2890('0x15')][_0x2890('0x1c')](_0x609de3[_0x2890('0x17')],{'raw':_0x609de3[_0x2890('0x18')]?_0x609de3[_0x2890('0x18')][_0x2890('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x609de3['options']?_0x609de3[_0x2890('0x18')][_0x2890('0x1d')]||null:null,'attributes':_0x609de3[_0x2890('0x18')]?_0x609de3[_0x2890('0x18')]['attributes']||null:null,'limit':_0x609de3['options']?_0x609de3['options']['limit']||null:null})[_0x2890('0x1a')](function(_0x221473){logger[_0x2890('0xc')](_0x2890('0x1e'),_0x609de3);logger[_0x2890('0xd')](_0x2890('0x1e'),_0x609de3,JSON['stringify'](_0x221473));_0x33882c(_0x221473);})[_0x2890('0x13')](function(_0x1bf47d){logger[_0x2890('0x10')](_0x2890('0x1e'),_0x1bf47d[_0x2890('0x12')],_0x609de3);_0x4b38ae(_0x242051[_0x2890('0x10')](0x1f4,_0x1bf47d[_0x2890('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index beb8929..baf54bd 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 _0x8250=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x1a6fb4,_0x2175de){var _0x5026b9=function(_0x2e5a1f){while(--_0x2e5a1f){_0x1a6fb4['push'](_0x1a6fb4['shift']());}};_0x5026b9(++_0x2175de);}(_0x8250,0x178));var _0x0825=function(_0x2445e8,_0x57e1c8){_0x2445e8=_0x2445e8-0x0;var _0x4319a6=_0x8250[_0x2445e8];return _0x4319a6;};'use strict';var multer=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var path=require('path');var timeout=require(_0x0825('0x2'));var express=require(_0x0825('0x3'));var router=express[_0x0825('0x4')]();var fs_extra=require(_0x0825('0x5'));var auth=require(_0x0825('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0825('0x7'));var controller=require(_0x0825('0x8'));router[_0x0825('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0825('0x9')](_0x0825('0xa'),auth[_0x0825('0xb')](),controller['describe']);router[_0x0825('0x9')](_0x0825('0xc'),auth[_0x0825('0xb')](),controller[_0x0825('0xd')]);router['post']('/',auth[_0x0825('0xb')](),controller['create']);router[_0x0825('0xe')](_0x0825('0xc'),auth[_0x0825('0xb')](),controller[_0x0825('0xf')]);router[_0x0825('0x10')](_0x0825('0xc'),auth[_0x0825('0xb')](),controller[_0x0825('0x11')]);module[_0x0825('0x12')]=router; \ No newline at end of file +var _0x3211=['index','get','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated'];(function(_0x21a645,_0x20b0dc){var _0x54cdd0=function(_0x259ccf){while(--_0x259ccf){_0x21a645['push'](_0x21a645['shift']());}};_0x54cdd0(++_0x20b0dc);}(_0x3211,0x96));var _0x1321=function(_0xd80294,_0x47dd7d){_0xd80294=_0xd80294-0x0;var _0x58edc2=_0x3211[_0xd80294];return _0x58edc2;};'use strict';var multer=require(_0x1321('0x0'));var util=require(_0x1321('0x1'));var path=require(_0x1321('0x2'));var timeout=require(_0x1321('0x3'));var express=require(_0x1321('0x4'));var router=express['Router']();var fs_extra=require(_0x1321('0x5'));var auth=require(_0x1321('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1321('0x7'));var controller=require(_0x1321('0x8'));router['get']('/',auth[_0x1321('0x9')](),controller[_0x1321('0xa')]);router[_0x1321('0xb')]('/describe',auth[_0x1321('0x9')](),controller[_0x1321('0xc')]);router[_0x1321('0xb')](_0x1321('0xd'),auth[_0x1321('0x9')](),controller[_0x1321('0xe')]);router[_0x1321('0xf')]('/',auth[_0x1321('0x9')](),controller[_0x1321('0x10')]);router[_0x1321('0x11')](_0x1321('0xd'),auth[_0x1321('0x9')](),controller['update']);router['delete']('/:id',auth[_0x1321('0x9')](),controller[_0x1321('0x12')]);module[_0x1321('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 47c6872..7692144 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4c221d,_0x3bc12f){var _0x203a04=function(_0x5a3a2a){while(--_0x5a3a2a){_0x4c221d['push'](_0x4c221d['shift']());}};_0x203a04(++_0x3bc12f);}(_0x008c,0x188));var _0xc008=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x008c[_0x4200e3];return _0x26ac37;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xcff8d1,_0x36bb26){var _0x201167=function(_0x551f42){while(--_0x551f42){_0xcff8d1['push'](_0xcff8d1['shift']());}};_0x201167(++_0x36bb26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5b73fe4..fc00449 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 _0xabb6=['rows','catch','show','keys','length','merge','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','map','FaxTransferReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','findAll'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0xabb6,0xa2));var _0x6abb=function(_0x2cdc7c,_0x18320e){_0x2cdc7c=_0x2cdc7c-0x0;var _0x41e2a1=_0xabb6[_0x2cdc7c];return _0x41e2a1;};'use strict';var emlformat=require(_0x6abb('0x0'));var rimraf=require(_0x6abb('0x1'));var zipdir=require(_0x6abb('0x2'));var jsonpatch=require(_0x6abb('0x3'));var rp=require(_0x6abb('0x4'));var moment=require(_0x6abb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6abb('0x6'));var util=require(_0x6abb('0x7'));var path=require(_0x6abb('0x8'));var sox=require(_0x6abb('0x9'));var csv=require('to-csv');var ejs=require(_0x6abb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6abb('0xb'));var squel=require(_0x6abb('0xc'));var crypto=require(_0x6abb('0xd'));var jsforce=require(_0x6abb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6abb('0xf'));var querystring=require(_0x6abb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6abb('0x11'));var as=require(_0x6abb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6abb('0x13'))(_0x6abb('0x14'));var utils=require(_0x6abb('0x15'));var config=require(_0x6abb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6abb('0x17'))['db'];function respondWithStatusCode(_0x4b290f,_0x5084c9){_0x5084c9=_0x5084c9||0xcc;return function(_0x27fdb4){if(_0x27fdb4){return _0x4b290f[_0x6abb('0x18')](_0x5084c9);}return _0x4b290f[_0x6abb('0x19')](_0x5084c9)['end']();};}function respondWithResult(_0x181c50,_0x75a4c){_0x75a4c=_0x75a4c||0xc8;return function(_0x1ef6ec){if(_0x1ef6ec){return _0x181c50['status'](_0x75a4c)[_0x6abb('0x1a')](_0x1ef6ec);}};}function respondWithFilteredResult(_0xea52bc,_0xfe6685){return function(_0x1c02ba){if(_0x1c02ba){var _0x55801a=typeof _0xfe6685[_0x6abb('0x1b')]===_0x6abb('0x1c')&&typeof _0xfe6685[_0x6abb('0x1d')]===_0x6abb('0x1c');var _0x10d283=_0x1c02ba[_0x6abb('0x1e')];var _0x5a8c32=_0x55801a?0x0:_0xfe6685[_0x6abb('0x1b')];var _0x401f6b=_0x55801a?_0x1c02ba[_0x6abb('0x1e')]:_0xfe6685[_0x6abb('0x1b')]+_0xfe6685[_0x6abb('0x1d')];var _0x47bb50;if(_0x401f6b>=_0x10d283){_0x401f6b=_0x10d283;_0x47bb50=0xc8;}else{_0x47bb50=0xce;}_0xea52bc[_0x6abb('0x19')](_0x47bb50);return _0xea52bc[_0x6abb('0x1f')](_0x6abb('0x20'),_0x5a8c32+'-'+_0x401f6b+'/'+_0x10d283)[_0x6abb('0x1a')](_0x1c02ba);}return null;};}function patchUpdates(_0x3ff805){return function(_0x17f55e){try{jsonpatch[_0x6abb('0x21')](_0x17f55e,_0x3ff805,!![]);}catch(_0x268ce5){return BPromise['reject'](_0x268ce5);}return _0x17f55e[_0x6abb('0x22')]();};}function saveUpdates(_0x3d3c3d,_0x165a8f){return function(_0x30ca39){if(_0x30ca39){return _0x30ca39[_0x6abb('0x23')](_0x3d3c3d)[_0x6abb('0x24')](function(_0x16c3dc){return _0x16c3dc;});}return null;};}function removeEntity(_0x227b63,_0x550392){return function(_0x5d7731){if(_0x5d7731){return _0x5d7731[_0x6abb('0x25')]()['then'](function(){_0x227b63[_0x6abb('0x19')](0xcc)[_0x6abb('0x26')]();});}};}function handleEntityNotFound(_0x36c36f,_0x27f90a){return function(_0x204935){if(!_0x204935){_0x36c36f[_0x6abb('0x18')](0x194);}return _0x204935;};}function handleError(_0x5852b8,_0x50baf6){_0x50baf6=_0x50baf6||0x1f4;return function(_0x2e6163){logger[_0x6abb('0x27')](_0x2e6163[_0x6abb('0x28')]);if(_0x2e6163[_0x6abb('0x29')]){delete _0x2e6163[_0x6abb('0x29')];}_0x5852b8[_0x6abb('0x19')](_0x50baf6)['send'](_0x2e6163);};}exports['index']=function(_0x3338df,_0x428485){var _0x5debf9={},_0x547c00={},_0x51ef29={'count':0x0,'rows':[]};var _0x1c64d3=_[_0x6abb('0x2a')](db[_0x6abb('0x2b')][_0x6abb('0x2c')],function(_0x32d9dc){return{'name':_0x32d9dc[_0x6abb('0x2d')],'type':_0x32d9dc['type']['key']};});_0x547c00[_0x6abb('0x2e')]=_['map'](_0x1c64d3,'name');_0x547c00[_0x6abb('0x2f')]=_['keys'](_0x3338df['query']);_0x547c00[_0x6abb('0x30')]=_[_0x6abb('0x31')](_0x547c00['model'],_0x547c00[_0x6abb('0x2f')]);_0x5debf9['attributes']=_['intersection'](_0x547c00[_0x6abb('0x2e')],qs[_0x6abb('0x32')](_0x3338df[_0x6abb('0x2f')][_0x6abb('0x32')]));_0x5debf9[_0x6abb('0x33')]=_0x5debf9['attributes']['length']?_0x5debf9[_0x6abb('0x33')]:_0x547c00[_0x6abb('0x2e')];if(!_0x3338df[_0x6abb('0x2f')][_0x6abb('0x34')](_0x6abb('0x35'))){_0x5debf9[_0x6abb('0x1d')]=qs[_0x6abb('0x1d')](_0x3338df[_0x6abb('0x2f')][_0x6abb('0x1d')]);_0x5debf9[_0x6abb('0x1b')]=qs[_0x6abb('0x1b')](_0x3338df[_0x6abb('0x2f')][_0x6abb('0x1b')]);}_0x5debf9[_0x6abb('0x36')]=qs[_0x6abb('0x37')](_0x3338df['query'][_0x6abb('0x37')]);_0x5debf9[_0x6abb('0x38')]=qs[_0x6abb('0x30')](_[_0x6abb('0x39')](_0x3338df[_0x6abb('0x2f')],_0x547c00[_0x6abb('0x30')]),_0x1c64d3);if(_0x3338df[_0x6abb('0x2f')][_0x6abb('0x3a')]){_0x5debf9['where']=_['merge'](_0x5debf9['where'],{'$or':_['map'](_0x1c64d3,function(_0xb69de0){if(_0xb69de0[_0x6abb('0x3b')]!==_0x6abb('0x3c')){var _0x9024cc={};_0x9024cc[_0xb69de0[_0x6abb('0x29')]]={'$like':'%'+_0x3338df['query'][_0x6abb('0x3a')]+'%'};return _0x9024cc;}})});}_0x5debf9=_['merge']({},_0x5debf9,_0x3338df['options']);var _0x4f29a6={'where':_0x5debf9['where']};return db[_0x6abb('0x2b')][_0x6abb('0x1e')](_0x4f29a6)[_0x6abb('0x24')](function(_0x1e8b72){_0x51ef29[_0x6abb('0x1e')]=_0x1e8b72;if(_0x3338df[_0x6abb('0x2f')][_0x6abb('0x3d')]){_0x5debf9['include']=[{'all':!![]}];}return db[_0x6abb('0x2b')][_0x6abb('0x3e')](_0x5debf9);})['then'](function(_0x4342e8){_0x51ef29[_0x6abb('0x3f')]=_0x4342e8;return _0x51ef29;})[_0x6abb('0x24')](respondWithFilteredResult(_0x428485,_0x5debf9))[_0x6abb('0x40')](handleError(_0x428485,null));};exports[_0x6abb('0x41')]=function(_0x56dc69,_0x112601){var _0x13076a={'raw':!![],'where':{'id':_0x56dc69['params']['id']}},_0x1fdde8={};_0x1fdde8['model']=_[_0x6abb('0x42')](db[_0x6abb('0x2b')][_0x6abb('0x2c')]);_0x1fdde8[_0x6abb('0x2f')]=_[_0x6abb('0x42')](_0x56dc69[_0x6abb('0x2f')]);_0x1fdde8['filters']=_[_0x6abb('0x31')](_0x1fdde8[_0x6abb('0x2e')],_0x1fdde8['query']);_0x13076a[_0x6abb('0x33')]=_[_0x6abb('0x31')](_0x1fdde8[_0x6abb('0x2e')],qs['fields'](_0x56dc69[_0x6abb('0x2f')][_0x6abb('0x32')]));_0x13076a['attributes']=_0x13076a[_0x6abb('0x33')][_0x6abb('0x43')]?_0x13076a[_0x6abb('0x33')]:_0x1fdde8['model'];if(_0x56dc69['query'][_0x6abb('0x3d')]){_0x13076a['include']=[{'all':!![]}];}_0x13076a=_[_0x6abb('0x44')]({},_0x13076a,_0x56dc69[_0x6abb('0x45')]);return db['FaxTransferReport'][_0x6abb('0x46')](_0x13076a)[_0x6abb('0x24')](handleEntityNotFound(_0x112601,null))[_0x6abb('0x24')](respondWithResult(_0x112601,null))[_0x6abb('0x40')](handleError(_0x112601,null));};exports[_0x6abb('0x47')]=function(_0x523821,_0xaa97d9){return db[_0x6abb('0x2b')]['create'](_0x523821['body'],{})[_0x6abb('0x24')](respondWithResult(_0xaa97d9,0xc9))[_0x6abb('0x40')](handleError(_0xaa97d9,null));};exports[_0x6abb('0x23')]=function(_0x4b42b1,_0x356886){if(_0x4b42b1['body']['id']){delete _0x4b42b1[_0x6abb('0x48')]['id'];}return db[_0x6abb('0x2b')][_0x6abb('0x46')]({'where':{'id':_0x4b42b1[_0x6abb('0x49')]['id']}})[_0x6abb('0x24')](handleEntityNotFound(_0x356886,null))[_0x6abb('0x24')](saveUpdates(_0x4b42b1['body'],null))['then'](respondWithResult(_0x356886,null))['catch'](handleError(_0x356886,null));};exports[_0x6abb('0x25')]=function(_0x1dccea,_0x65c1d1){return db['FaxTransferReport']['find']({'where':{'id':_0x1dccea[_0x6abb('0x49')]['id']}})[_0x6abb('0x24')](handleEntityNotFound(_0x65c1d1,null))[_0x6abb('0x24')](removeEntity(_0x65c1d1,null))[_0x6abb('0x40')](handleError(_0x65c1d1,null));};exports['describe']=function(_0x17e801,_0x41aa40){return db[_0x6abb('0x2b')][_0x6abb('0x4a')]()['then'](respondWithResult(_0x41aa40,null))[_0x6abb('0x40')](handleError(_0x41aa40,null));}; \ No newline at end of file +var _0x75ff=['options','FaxTransferReport','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','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','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','where','filters','filter','merge','type','VIRTUAL'];(function(_0x3a7cac,_0x1db945){var _0x32ca4e=function(_0x52ca66){while(--_0x52ca66){_0x3a7cac['push'](_0x3a7cac['shift']());}};_0x32ca4e(++_0x1db945);}(_0x75ff,0x17f));var _0xf75f=function(_0x527a01,_0x99a1af){_0x527a01=_0x527a01-0x0;var _0x39d696=_0x75ff[_0x527a01];return _0x39d696;};'use strict';var emlformat=require(_0xf75f('0x0'));var rimraf=require(_0xf75f('0x1'));var zipdir=require(_0xf75f('0x2'));var jsonpatch=require(_0xf75f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf75f('0x4'));var Mustache=require(_0xf75f('0x5'));var util=require(_0xf75f('0x6'));var path=require('path');var sox=require(_0xf75f('0x7'));var csv=require('to-csv');var ejs=require(_0xf75f('0x8'));var fs=require('fs');var fs_extra=require(_0xf75f('0x9'));var _=require(_0xf75f('0xa'));var squel=require(_0xf75f('0xb'));var crypto=require(_0xf75f('0xc'));var jsforce=require(_0xf75f('0xd'));var deskjs=require(_0xf75f('0xe'));var toCsv=require(_0xf75f('0xf'));var querystring=require(_0xf75f('0x10'));var Papa=require('papaparse');var Redis=require(_0xf75f('0x11'));var authService=require(_0xf75f('0x12'));var qs=require(_0xf75f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf75f('0x14'));var logger=require('../../config/logger')(_0xf75f('0x15'));var utils=require(_0xf75f('0x16'));var config=require(_0xf75f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x335545,_0xd6411e){_0xd6411e=_0xd6411e||0xcc;return function(_0x2b2cb7){if(_0x2b2cb7){return _0x335545[_0xf75f('0x18')](_0xd6411e);}return _0x335545['status'](_0xd6411e)[_0xf75f('0x19')]();};}function respondWithResult(_0x497b35,_0x903cde){_0x903cde=_0x903cde||0xc8;return function(_0x531359){if(_0x531359){return _0x497b35[_0xf75f('0x1a')](_0x903cde)['json'](_0x531359);}};}function respondWithFilteredResult(_0x158576,_0x10661d){return function(_0x34032f){if(_0x34032f){var _0x36509c=typeof _0x10661d[_0xf75f('0x1b')]===_0xf75f('0x1c')&&typeof _0x10661d[_0xf75f('0x1d')]===_0xf75f('0x1c');var _0x2e6f57=_0x34032f[_0xf75f('0x1e')];var _0x1c6cff=_0x36509c?0x0:_0x10661d[_0xf75f('0x1b')];var _0x50f4d7=_0x36509c?_0x34032f['count']:_0x10661d[_0xf75f('0x1b')]+_0x10661d['limit'];var _0x23b6c5;if(_0x50f4d7>=_0x2e6f57){_0x50f4d7=_0x2e6f57;_0x23b6c5=0xc8;}else{_0x23b6c5=0xce;}_0x158576[_0xf75f('0x1a')](_0x23b6c5);return _0x158576[_0xf75f('0x1f')]('Content-Range',_0x1c6cff+'-'+_0x50f4d7+'/'+_0x2e6f57)[_0xf75f('0x20')](_0x34032f);}return null;};}function patchUpdates(_0x361095){return function(_0x1e1516){try{jsonpatch[_0xf75f('0x21')](_0x1e1516,_0x361095,!![]);}catch(_0x15ff96){return BPromise[_0xf75f('0x22')](_0x15ff96);}return _0x1e1516[_0xf75f('0x23')]();};}function saveUpdates(_0x55f4d9,_0x2980a3){return function(_0x372929){if(_0x372929){return _0x372929[_0xf75f('0x24')](_0x55f4d9)[_0xf75f('0x25')](function(_0x3b03ac){return _0x3b03ac;});}return null;};}function removeEntity(_0x28cf57,_0x3930fc){return function(_0x4f0723){if(_0x4f0723){return _0x4f0723[_0xf75f('0x26')]()[_0xf75f('0x25')](function(){_0x28cf57['status'](0xcc)[_0xf75f('0x19')]();});}};}function handleEntityNotFound(_0x324e7a,_0x2c6bf9){return function(_0x2ab6c1){if(!_0x2ab6c1){_0x324e7a[_0xf75f('0x18')](0x194);}return _0x2ab6c1;};}function handleError(_0x2ed703,_0x416c87){_0x416c87=_0x416c87||0x1f4;return function(_0x27d824){logger['error'](_0x27d824[_0xf75f('0x27')]);if(_0x27d824[_0xf75f('0x28')]){delete _0x27d824['name'];}_0x2ed703[_0xf75f('0x1a')](_0x416c87)[_0xf75f('0x29')](_0x27d824);};}exports[_0xf75f('0x2a')]=function(_0x4d46dd,_0x4a16c8){var _0x236da1={},_0x39ce2d={},_0x17b08c={'count':0x0,'rows':[]};var _0x569b18=_[_0xf75f('0x2b')](db['FaxTransferReport']['rawAttributes'],function(_0x10608d){return{'name':_0x10608d[_0xf75f('0x2c')],'type':_0x10608d['type'][_0xf75f('0x2d')]};});_0x39ce2d['model']=_[_0xf75f('0x2b')](_0x569b18,_0xf75f('0x28'));_0x39ce2d[_0xf75f('0x2e')]=_[_0xf75f('0x2f')](_0x4d46dd[_0xf75f('0x2e')]);_0x39ce2d['filters']=_['intersection'](_0x39ce2d[_0xf75f('0x30')],_0x39ce2d[_0xf75f('0x2e')]);_0x236da1[_0xf75f('0x31')]=_[_0xf75f('0x32')](_0x39ce2d[_0xf75f('0x30')],qs[_0xf75f('0x33')](_0x4d46dd['query'][_0xf75f('0x33')]));_0x236da1[_0xf75f('0x31')]=_0x236da1['attributes'][_0xf75f('0x34')]?_0x236da1[_0xf75f('0x31')]:_0x39ce2d[_0xf75f('0x30')];if(!_0x4d46dd['query']['hasOwnProperty'](_0xf75f('0x35'))){_0x236da1[_0xf75f('0x1d')]=qs[_0xf75f('0x1d')](_0x4d46dd['query'][_0xf75f('0x1d')]);_0x236da1['offset']=qs[_0xf75f('0x1b')](_0x4d46dd['query']['offset']);}_0x236da1[_0xf75f('0x36')]=qs['sort'](_0x4d46dd[_0xf75f('0x2e')]['sort']);_0x236da1[_0xf75f('0x37')]=qs[_0xf75f('0x38')](_['pick'](_0x4d46dd[_0xf75f('0x2e')],_0x39ce2d[_0xf75f('0x38')]),_0x569b18);if(_0x4d46dd[_0xf75f('0x2e')][_0xf75f('0x39')]){_0x236da1[_0xf75f('0x37')]=_[_0xf75f('0x3a')](_0x236da1['where'],{'$or':_['map'](_0x569b18,function(_0x1b32b3){if(_0x1b32b3[_0xf75f('0x3b')]!==_0xf75f('0x3c')){var _0x2f46d6={};_0x2f46d6[_0x1b32b3[_0xf75f('0x28')]]={'$like':'%'+_0x4d46dd[_0xf75f('0x2e')][_0xf75f('0x39')]+'%'};return _0x2f46d6;}})});}_0x236da1=_[_0xf75f('0x3a')]({},_0x236da1,_0x4d46dd[_0xf75f('0x3d')]);var _0x2d63fe={'where':_0x236da1[_0xf75f('0x37')]};return db[_0xf75f('0x3e')][_0xf75f('0x1e')](_0x2d63fe)[_0xf75f('0x25')](function(_0x149dcf){_0x17b08c[_0xf75f('0x1e')]=_0x149dcf;if(_0x4d46dd['query'][_0xf75f('0x3f')]){_0x236da1[_0xf75f('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xf75f('0x41')](_0x236da1);})[_0xf75f('0x25')](function(_0x3d5f5a){_0x17b08c['rows']=_0x3d5f5a;return _0x17b08c;})[_0xf75f('0x25')](respondWithFilteredResult(_0x4a16c8,_0x236da1))[_0xf75f('0x42')](handleError(_0x4a16c8,null));};exports[_0xf75f('0x43')]=function(_0x12450e,_0x3b4224){var _0x4199f7={'raw':!![],'where':{'id':_0x12450e[_0xf75f('0x44')]['id']}},_0x26fdd0={};_0x26fdd0['model']=_[_0xf75f('0x2f')](db[_0xf75f('0x3e')][_0xf75f('0x45')]);_0x26fdd0[_0xf75f('0x2e')]=_[_0xf75f('0x2f')](_0x12450e['query']);_0x26fdd0[_0xf75f('0x38')]=_[_0xf75f('0x32')](_0x26fdd0['model'],_0x26fdd0[_0xf75f('0x2e')]);_0x4199f7[_0xf75f('0x31')]=_[_0xf75f('0x32')](_0x26fdd0[_0xf75f('0x30')],qs[_0xf75f('0x33')](_0x12450e['query']['fields']));_0x4199f7[_0xf75f('0x31')]=_0x4199f7[_0xf75f('0x31')][_0xf75f('0x34')]?_0x4199f7[_0xf75f('0x31')]:_0x26fdd0['model'];if(_0x12450e[_0xf75f('0x2e')][_0xf75f('0x3f')]){_0x4199f7[_0xf75f('0x40')]=[{'all':!![]}];}_0x4199f7=_[_0xf75f('0x3a')]({},_0x4199f7,_0x12450e[_0xf75f('0x3d')]);return db['FaxTransferReport'][_0xf75f('0x46')](_0x4199f7)['then'](handleEntityNotFound(_0x3b4224,null))['then'](respondWithResult(_0x3b4224,null))[_0xf75f('0x42')](handleError(_0x3b4224,null));};exports[_0xf75f('0x47')]=function(_0x17cd46,_0x71d05){return db[_0xf75f('0x3e')][_0xf75f('0x47')](_0x17cd46[_0xf75f('0x48')],{})[_0xf75f('0x25')](respondWithResult(_0x71d05,0xc9))[_0xf75f('0x42')](handleError(_0x71d05,null));};exports[_0xf75f('0x24')]=function(_0x3717b5,_0x33d266){if(_0x3717b5[_0xf75f('0x48')]['id']){delete _0x3717b5[_0xf75f('0x48')]['id'];}return db[_0xf75f('0x3e')][_0xf75f('0x46')]({'where':{'id':_0x3717b5[_0xf75f('0x44')]['id']}})[_0xf75f('0x25')](handleEntityNotFound(_0x33d266,null))[_0xf75f('0x25')](saveUpdates(_0x3717b5[_0xf75f('0x48')],null))[_0xf75f('0x25')](respondWithResult(_0x33d266,null))[_0xf75f('0x42')](handleError(_0x33d266,null));};exports[_0xf75f('0x26')]=function(_0x2355ca,_0x5383ae){return db[_0xf75f('0x3e')][_0xf75f('0x46')]({'where':{'id':_0x2355ca['params']['id']}})[_0xf75f('0x25')](handleEntityNotFound(_0x5383ae,null))['then'](removeEntity(_0x5383ae,null))[_0xf75f('0x42')](handleError(_0x5383ae,null));};exports[_0xf75f('0x49')]=function(_0xd7ed51,_0x434235){return db[_0xf75f('0x3e')]['describe']()[_0xf75f('0x25')](respondWithResult(_0x434235,null))['catch'](handleError(_0x434235,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ffd455e..ef0eaf0 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 _0x6bdd=['define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes','exports'];(function(_0x3dd583,_0x398a95){var _0x1a0657=function(_0x393594){while(--_0x393594){_0x3dd583['push'](_0x3dd583['shift']());}};_0x1a0657(++_0x398a95);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x3a7f8b,_0x7fe06c){_0x3a7f8b=_0x3a7f8b-0x0;var _0x34f066=_0x6bdd[_0x3a7f8b];return _0x34f066;};'use strict';var _=require('lodash');var util=require(_0xd6bd('0x0'));var logger=require(_0xd6bd('0x1'))(_0xd6bd('0x2'));var moment=require(_0xd6bd('0x3'));var BPromise=require(_0xd6bd('0x4'));var rp=require(_0xd6bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6bd('0x6'));var config=require('../../config/environment');var attributes=require(_0xd6bd('0x7'));module[_0xd6bd('0x8')]=function(_0x4f4a05,_0x122321){return _0x4f4a05[_0xd6bd('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xd6bd('0xa'),'fields':[_0xd6bd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c7a=['path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50b056,_0x5857f8){var _0x13c9a9=function(_0x21591d){while(--_0x21591d){_0x50b056['push'](_0x50b056['shift']());}};_0x13c9a9(++_0x5857f8);}(_0x4c7a,0x125));var _0xa4c7=function(_0x22f73a,_0x10c294){_0x22f73a=_0x22f73a-0x0;var _0xe35c13=_0x4c7a[_0x22f73a];return _0xe35c13;};'use strict';var _=require(_0xa4c7('0x0'));var util=require(_0xa4c7('0x1'));var logger=require(_0xa4c7('0x2'))(_0xa4c7('0x3'));var moment=require(_0xa4c7('0x4'));var BPromise=require(_0xa4c7('0x5'));var rp=require(_0xa4c7('0x6'));var fs=require('fs');var path=require(_0xa4c7('0x7'));var rimraf=require('rimraf');var config=require(_0xa4c7('0x8'));var attributes=require(_0xa4c7('0x9'));module[_0xa4c7('0xa')]=function(_0x5ded7d,_0x450e60){return _0x5ded7d[_0xa4c7('0xb')](_0xa4c7('0xc'),attributes,{'tableName':_0xa4c7('0xd'),'paranoid':![],'indexes':[{'name':_0xa4c7('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d63d229..edd440e 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 _0x3be0=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3be0,0xd2));var _0x03be=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x3be0[_0x407461];return _0x2b3ffa;};'use strict';var _=require(_0x03be('0x0'));var util=require(_0x03be('0x1'));var moment=require(_0x03be('0x2'));var BPromise=require(_0x03be('0x3'));var rs=require(_0x03be('0x4'));var fs=require('fs');var Redis=require(_0x03be('0x5'));var db=require(_0x03be('0x6'))['db'];var utils=require(_0x03be('0x7'));var logger=require(_0x03be('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x03be('0x9'));var client=jayson[_0x03be('0xa')][_0x03be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32c2e3,_0x1c0f8c,_0x3d0314){return new BPromise(function(_0x3fe10b,_0x1c511b){return client[_0x03be('0xc')](_0x32c2e3,_0x3d0314)[_0x03be('0xd')](function(_0x8bbe41){logger[_0x03be('0xe')](_0x03be('0xf'),_0x1c0f8c,_0x03be('0x10'));logger[_0x03be('0x11')](_0x03be('0x12'),_0x1c0f8c,'request\x20sent',JSON['stringify'](_0x8bbe41));if(_0x8bbe41['error']){if(_0x8bbe41[_0x03be('0x13')][_0x03be('0x14')]===0x1f4){logger[_0x03be('0x13')](_0x03be('0xf'),_0x1c0f8c,_0x8bbe41[_0x03be('0x13')][_0x03be('0x15')]);return _0x1c511b(_0x8bbe41[_0x03be('0x13')]['message']);}logger[_0x03be('0x13')](_0x03be('0xf'),_0x1c0f8c,_0x8bbe41[_0x03be('0x13')][_0x03be('0x15')]);return _0x3fe10b(_0x8bbe41['error']['message']);}else{logger[_0x03be('0xe')](_0x03be('0xf'),_0x1c0f8c,_0x03be('0x10'));_0x3fe10b(_0x8bbe41['result'][_0x03be('0x15')]);}})[_0x03be('0x16')](function(_0x3226d1){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1c0f8c,_0x3226d1);_0x1c511b(_0x3226d1);});});} \ No newline at end of file +var _0x53b1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14dfd6,_0x392fa4){var _0x36c19a=function(_0x453179){while(--_0x453179){_0x14dfd6['push'](_0x14dfd6['shift']());}};_0x36c19a(++_0x392fa4);}(_0x53b1,0xb2));var _0x153b=function(_0x4212df,_0x3c9dd8){_0x4212df=_0x4212df-0x0;var _0x5e7c23=_0x53b1[_0x4212df];return _0x5e7c23;};'use strict';var _=require(_0x153b('0x0'));var util=require('util');var moment=require(_0x153b('0x1'));var BPromise=require(_0x153b('0x2'));var rs=require(_0x153b('0x3'));var fs=require('fs');var Redis=require(_0x153b('0x4'));var db=require(_0x153b('0x5'))['db'];var utils=require(_0x153b('0x6'));var logger=require(_0x153b('0x7'))(_0x153b('0x8'));var config=require(_0x153b('0x9'));var jayson=require(_0x153b('0xa'));var client=jayson[_0x153b('0xb')][_0x153b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168bdf,_0x4d21b2,_0x427bd1){return new BPromise(function(_0xe755a8,_0x2022f9){return client['request'](_0x168bdf,_0x427bd1)[_0x153b('0xd')](function(_0x47f9c7){logger['info'](_0x153b('0xe'),_0x4d21b2,_0x153b('0xf'));logger[_0x153b('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4d21b2,'request\x20sent',JSON['stringify'](_0x47f9c7));if(_0x47f9c7[_0x153b('0x11')]){if(_0x47f9c7['error'][_0x153b('0x12')]===0x1f4){logger['error'](_0x153b('0xe'),_0x4d21b2,_0x47f9c7[_0x153b('0x11')][_0x153b('0x13')]);return _0x2022f9(_0x47f9c7['error'][_0x153b('0x13')]);}logger['error'](_0x153b('0xe'),_0x4d21b2,_0x47f9c7[_0x153b('0x11')][_0x153b('0x13')]);return _0xe755a8(_0x47f9c7[_0x153b('0x11')][_0x153b('0x13')]);}else{logger[_0x153b('0x14')](_0x153b('0xe'),_0x4d21b2,'request\x20sent');_0xe755a8(_0x47f9c7[_0x153b('0x15')]['message']);}})[_0x153b('0x16')](function(_0xe29a40){logger[_0x153b('0x11')](_0x153b('0xe'),_0x4d21b2,_0xe29a40);_0x2022f9(_0xe29a40);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 80fe190..378ad07 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 _0xdbb6=['update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x48c550,_0x428ac2){var _0x4bf9ee=function(_0x265900){while(--_0x265900){_0x48c550['push'](_0x48c550['shift']());}};_0x4bf9ee(++_0x428ac2);}(_0xdbb6,0x1b3));var _0x6dbb=function(_0x230992,_0x3761fc){_0x230992=_0x230992-0x0;var _0x6c6285=_0xdbb6[_0x230992];return _0x6c6285;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6dbb('0x0'));var timeout=require(_0x6dbb('0x1'));var express=require('express');var router=express[_0x6dbb('0x2')]();var fs_extra=require(_0x6dbb('0x3'));var auth=require(_0x6dbb('0x4'));var interaction=require(_0x6dbb('0x5'));var config=require(_0x6dbb('0x6'));var controller=require(_0x6dbb('0x7'));router[_0x6dbb('0x8')]('/',auth[_0x6dbb('0x9')](),controller['index']);router[_0x6dbb('0x8')](_0x6dbb('0xa'),auth[_0x6dbb('0x9')](),controller[_0x6dbb('0xb')]);router[_0x6dbb('0x8')](_0x6dbb('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6dbb('0x9')](),controller['create']);router['put'](_0x6dbb('0xc'),auth['isAuthenticated'](),controller[_0x6dbb('0xd')]);router['delete']('/:id',auth[_0x6dbb('0x9')](),controller[_0x6dbb('0xe')]);module[_0x6dbb('0xf')]=router; \ No newline at end of file +var _0x98ae=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','/describe','isAuthenticated','get','/:id','show','post','put','update','delete'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0x98ae,0xc0));var _0xe98a=function(_0x4acc15,_0x3a44f9){_0x4acc15=_0x4acc15-0x0;var _0x274256=_0x98ae[_0x4acc15];return _0x274256;};'use strict';var multer=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe98a('0x2'));var router=express[_0xe98a('0x3')]();var fs_extra=require(_0xe98a('0x4'));var auth=require(_0xe98a('0x5'));var interaction=require(_0xe98a('0x6'));var config=require('../../config/environment');var controller=require(_0xe98a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe98a('0x8'),auth[_0xe98a('0x9')](),controller['describe']);router[_0xe98a('0xa')](_0xe98a('0xb'),auth['isAuthenticated'](),controller[_0xe98a('0xc')]);router[_0xe98a('0xd')]('/',auth[_0xe98a('0x9')](),controller['create']);router[_0xe98a('0xe')](_0xe98a('0xb'),auth[_0xe98a('0x9')](),controller[_0xe98a('0xf')]);router[_0xe98a('0x10')](_0xe98a('0xb'),auth[_0xe98a('0x9')](),controller[_0xe98a('0x11')]);module[_0xe98a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3f4aa10..2d8eea5 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 _0x2fce=['express','Router','fs-extra','../../components/auth/service','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x125504,_0x469989){var _0x1cb9a7=function(_0x160bf0){while(--_0x160bf0){_0x125504['push'](_0x125504['shift']());}};_0x1cb9a7(++_0x469989);}(_0x2fce,0x1f4));var _0xe2fc=function(_0x2797ca,_0x2909e8){_0x2797ca=_0x2797ca-0x0;var _0x34533f=_0x2fce[_0x2797ca];return _0x34533f;};'use strict';var multer=require(_0xe2fc('0x0'));var util=require(_0xe2fc('0x1'));var path=require(_0xe2fc('0x2'));var timeout=require(_0xe2fc('0x3'));var express=require(_0xe2fc('0x4'));var router=express[_0xe2fc('0x5')]();var fs_extra=require(_0xe2fc('0x6'));var auth=require(_0xe2fc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xe2fc('0x8')]('/',auth['isAuthenticated'](),controller[_0xe2fc('0x9')]);router[_0xe2fc('0x8')](_0xe2fc('0xa'),auth['isAuthenticated'](),controller[_0xe2fc('0xb')]);router[_0xe2fc('0x8')](_0xe2fc('0xc'),auth[_0xe2fc('0xd')](),controller[_0xe2fc('0xe')]);router['get'](_0xe2fc('0xf'),auth[_0xe2fc('0xd')](),controller[_0xe2fc('0x10')]);router[_0xe2fc('0x11')]('/',auth[_0xe2fc('0xd')](),controller[_0xe2fc('0x12')]);router[_0xe2fc('0x11')](_0xe2fc('0xc'),auth[_0xe2fc('0xd')](),controller[_0xe2fc('0x13')]);router[_0xe2fc('0x14')](_0xe2fc('0xa'),auth['isAuthenticated'](),controller[_0xe2fc('0x15')]);router['delete'](_0xe2fc('0xa'),auth[_0xe2fc('0xd')](),controller[_0xe2fc('0x16')]);module[_0xe2fc('0x17')]=router; \ No newline at end of file +var _0x05e4=['get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','/:id','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index'];(function(_0x6f22cb,_0x198cc3){var _0x57adb5=function(_0x3b9afd){while(--_0x3b9afd){_0x6f22cb['push'](_0x6f22cb['shift']());}};_0x57adb5(++_0x198cc3);}(_0x05e4,0x18e));var _0x405e=function(_0x3a49f3,_0x1765e7){_0x3a49f3=_0x3a49f3-0x0;var _0x1d60ee=_0x05e4[_0x3a49f3];return _0x1d60ee;};'use strict';var multer=require(_0x405e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x405e('0x1'));var express=require(_0x405e('0x2'));var router=express[_0x405e('0x3')]();var fs_extra=require(_0x405e('0x4'));var auth=require(_0x405e('0x5'));var interaction=require(_0x405e('0x6'));var config=require(_0x405e('0x7'));var controller=require(_0x405e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x405e('0x9')]);router[_0x405e('0xa')]('/:id',auth[_0x405e('0xb')](),controller[_0x405e('0xc')]);router[_0x405e('0xa')]('/:id/configurations',auth[_0x405e('0xb')](),controller[_0x405e('0xd')]);router[_0x405e('0xa')](_0x405e('0xe'),auth[_0x405e('0xb')](),controller[_0x405e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x405e('0x10')]);router[_0x405e('0x11')]('/:id/configurations',auth[_0x405e('0xb')](),controller[_0x405e('0x12')]);router[_0x405e('0x13')]('/:id',auth[_0x405e('0xb')](),controller[_0x405e('0x14')]);router[_0x405e('0x15')](_0x405e('0x16'),auth[_0x405e('0xb')](),controller['destroy']);module[_0x405e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 81746b9..9a162d4 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 _0x835e=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x346a42,_0x403da3){var _0x417713=function(_0x61e290){while(--_0x61e290){_0x346a42['push'](_0x346a42['shift']());}};_0x417713(++_0x403da3);}(_0x835e,0x162));var _0xe835=function(_0x22ba49,_0x334ba0){_0x22ba49=_0x22ba49-0x0;var _0x5db17d=_0x835e[_0x22ba49];return _0x5db17d;};'use strict';var Sequelize=require('sequelize');module[_0xe835('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe835('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe835('0x1')]},'authType':{'type':Sequelize[_0xe835('0x2')](_0xe835('0x3')),'defaultValue':_0xe835('0x3')},'password':{'type':Sequelize[_0xe835('0x1')]},'consumerKey':{'type':Sequelize[_0xe835('0x1')]},'consumerSecret':{'type':Sequelize[_0xe835('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xe835('0x1')]},'serverUrl':{'type':Sequelize[_0xe835('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe835('0x2')](_0xe835('0x4'),_0xe835('0x5')),'defaultValue':_0xe835('0x4')}}; \ No newline at end of file +var _0x5ad1=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x16a344,_0x43dc6c){var _0x24f848=function(_0x23c39a){while(--_0x23c39a){_0x16a344['push'](_0x16a344['shift']());}};_0x24f848(++_0x43dc6c);}(_0x5ad1,0x106));var _0x15ad=function(_0x323d0d,_0x1be6e7){_0x323d0d=_0x323d0d-0x0;var _0x473cc2=_0x5ad1[_0x323d0d];return _0x473cc2;};'use strict';var Sequelize=require('sequelize');module[_0x15ad('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x15ad('0x1')]},'username':{'type':Sequelize[_0x15ad('0x1')]},'remoteUri':{'type':Sequelize[_0x15ad('0x1')]},'authType':{'type':Sequelize[_0x15ad('0x2')](_0x15ad('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x15ad('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x15ad('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x15ad('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x15ad('0x2')](_0x15ad('0x4'),_0x15ad('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 05be91a..395bb9d 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 _0x0ca0=['where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','DeskConfiguration','length','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','DeskAccount','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0x0ca0,0x121));var _0x00ca=function(_0x1b35f2,_0x23bc85){_0x1b35f2=_0x1b35f2-0x0;var _0xe62087=_0x0ca0[_0x1b35f2];return _0xe62087;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00ca('0x0'));var zipdir=require(_0x00ca('0x1'));var jsonpatch=require(_0x00ca('0x2'));var rp=require(_0x00ca('0x3'));var moment=require(_0x00ca('0x4'));var BPromise=require(_0x00ca('0x5'));var Mustache=require(_0x00ca('0x6'));var util=require(_0x00ca('0x7'));var path=require('path');var sox=require(_0x00ca('0x8'));var csv=require(_0x00ca('0x9'));var ejs=require(_0x00ca('0xa'));var fs=require('fs');var fs_extra=require(_0x00ca('0xb'));var _=require(_0x00ca('0xc'));var squel=require(_0x00ca('0xd'));var crypto=require(_0x00ca('0xe'));var jsforce=require(_0x00ca('0xf'));var deskjs=require(_0x00ca('0x10'));var toCsv=require(_0x00ca('0x9'));var querystring=require(_0x00ca('0x11'));var Papa=require(_0x00ca('0x12'));var Redis=require(_0x00ca('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x00ca('0x14'));var as=require(_0x00ca('0x15'));var hardwareService=require(_0x00ca('0x16'));var logger=require(_0x00ca('0x17'))('api');var utils=require(_0x00ca('0x18'));var config=require(_0x00ca('0x19'));var licenseUtil=require(_0x00ca('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a8070,_0x57e666){_0x57e666=_0x57e666||0xcc;return function(_0x1d7f78){if(_0x1d7f78){return _0x3a8070[_0x00ca('0x1b')](_0x57e666);}return _0x3a8070[_0x00ca('0x1c')](_0x57e666)['end']();};}function respondWithResult(_0x1be2b1,_0x285287){_0x285287=_0x285287||0xc8;return function(_0x1b87db){if(_0x1b87db){return _0x1be2b1[_0x00ca('0x1c')](_0x285287)[_0x00ca('0x1d')](_0x1b87db);}};}function respondWithFilteredResult(_0x24cce4,_0x4eeb97){return function(_0x31b58d){if(_0x31b58d){var _0x485da7=typeof _0x4eeb97[_0x00ca('0x1e')]===_0x00ca('0x1f')&&typeof _0x4eeb97[_0x00ca('0x20')]===_0x00ca('0x1f');var _0x5afa5b=_0x31b58d[_0x00ca('0x21')];var _0x51e31a=_0x485da7?0x0:_0x4eeb97[_0x00ca('0x1e')];var _0x3fd097=_0x485da7?_0x31b58d[_0x00ca('0x21')]:_0x4eeb97[_0x00ca('0x1e')]+_0x4eeb97[_0x00ca('0x20')];var _0x282a06;if(_0x3fd097>=_0x5afa5b){_0x3fd097=_0x5afa5b;_0x282a06=0xc8;}else{_0x282a06=0xce;}_0x24cce4[_0x00ca('0x1c')](_0x282a06);return _0x24cce4[_0x00ca('0x22')]('Content-Range',_0x51e31a+'-'+_0x3fd097+'/'+_0x5afa5b)[_0x00ca('0x1d')](_0x31b58d);}return null;};}function patchUpdates(_0x260598){return function(_0x58fac6){try{jsonpatch[_0x00ca('0x23')](_0x58fac6,_0x260598,!![]);}catch(_0x237e28){return BPromise[_0x00ca('0x24')](_0x237e28);}return _0x58fac6[_0x00ca('0x25')]();};}function saveUpdates(_0x45fa6b,_0x5ee2a3){return function(_0x199b92){if(_0x199b92){return _0x199b92['update'](_0x45fa6b)['then'](function(_0x1c7e52){return _0x1c7e52;});}return null;};}function removeEntity(_0x13bd91,_0x1637a8){return function(_0x33c302){if(_0x33c302){return _0x33c302[_0x00ca('0x26')]()[_0x00ca('0x27')](function(){_0x13bd91['status'](0xcc)[_0x00ca('0x28')]();});}};}function handleEntityNotFound(_0x390686,_0x241510){return function(_0x5a7b29){if(!_0x5a7b29){_0x390686[_0x00ca('0x1b')](0x194);}return _0x5a7b29;};}function handleError(_0x63f939,_0x13e937){_0x13e937=_0x13e937||0x1f4;return function(_0x5856a2){logger[_0x00ca('0x29')](_0x5856a2[_0x00ca('0x2a')]);if(_0x5856a2[_0x00ca('0x2b')]){delete _0x5856a2[_0x00ca('0x2b')];}_0x63f939[_0x00ca('0x1c')](_0x13e937)[_0x00ca('0x2c')](_0x5856a2);};}exports[_0x00ca('0x2d')]=function(_0x4269f7,_0x23c95c){var _0x35e48a={},_0x53a347={},_0x4b5964={'count':0x0,'rows':[]};var _0x2dea74=_['map'](db[_0x00ca('0x2e')]['rawAttributes'],function(_0x4cddc8){return{'name':_0x4cddc8[_0x00ca('0x2f')],'type':_0x4cddc8['type'][_0x00ca('0x30')]};});_0x53a347[_0x00ca('0x31')]=_[_0x00ca('0x32')](_0x2dea74,_0x00ca('0x2b'));_0x53a347['query']=_[_0x00ca('0x33')](_0x4269f7[_0x00ca('0x34')]);_0x53a347['filters']=_[_0x00ca('0x35')](_0x53a347['model'],_0x53a347[_0x00ca('0x34')]);_0x35e48a[_0x00ca('0x36')]=_[_0x00ca('0x35')](_0x53a347[_0x00ca('0x31')],qs[_0x00ca('0x37')](_0x4269f7[_0x00ca('0x34')][_0x00ca('0x37')]));_0x35e48a[_0x00ca('0x36')]=_0x35e48a[_0x00ca('0x36')]['length']?_0x35e48a['attributes']:_0x53a347[_0x00ca('0x31')];if(!_0x4269f7[_0x00ca('0x34')][_0x00ca('0x38')](_0x00ca('0x39'))){_0x35e48a[_0x00ca('0x20')]=qs[_0x00ca('0x20')](_0x4269f7[_0x00ca('0x34')]['limit']);_0x35e48a['offset']=qs['offset'](_0x4269f7['query'][_0x00ca('0x1e')]);}_0x35e48a[_0x00ca('0x3a')]=qs['sort'](_0x4269f7[_0x00ca('0x34')][_0x00ca('0x3b')]);_0x35e48a['where']=qs[_0x00ca('0x3c')](_[_0x00ca('0x3d')](_0x4269f7[_0x00ca('0x34')],_0x53a347[_0x00ca('0x3c')]),_0x2dea74);if(_0x4269f7[_0x00ca('0x34')]['filter']){_0x35e48a['where']=_['merge'](_0x35e48a[_0x00ca('0x3e')],{'$or':_[_0x00ca('0x32')](_0x2dea74,function(_0x53d707){if(_0x53d707[_0x00ca('0x3f')]!==_0x00ca('0x40')){var _0x12dac1={};_0x12dac1[_0x53d707[_0x00ca('0x2b')]]={'$like':'%'+_0x4269f7[_0x00ca('0x34')]['filter']+'%'};return _0x12dac1;}})});}_0x35e48a=_[_0x00ca('0x41')]({},_0x35e48a,_0x4269f7[_0x00ca('0x42')]);var _0x5ca2a3={'where':_0x35e48a['where']};return db[_0x00ca('0x2e')]['count'](_0x5ca2a3)['then'](function(_0x59edc8){_0x4b5964['count']=_0x59edc8;if(_0x4269f7[_0x00ca('0x34')][_0x00ca('0x43')]){_0x35e48a[_0x00ca('0x44')]=[{'all':!![]}];}return db[_0x00ca('0x2e')][_0x00ca('0x45')](_0x35e48a);})[_0x00ca('0x27')](function(_0x56ea33){_0x4b5964['rows']=_0x56ea33;return _0x4b5964;})[_0x00ca('0x27')](respondWithFilteredResult(_0x23c95c,_0x35e48a))[_0x00ca('0x46')](handleError(_0x23c95c,null));};exports[_0x00ca('0x47')]=function(_0x444d30,_0xed034c){var _0x51317c={'raw':![],'where':{'id':_0x444d30[_0x00ca('0x48')]['id']}},_0x4746a3={};_0x4746a3[_0x00ca('0x31')]=_[_0x00ca('0x33')](db['DeskAccount'][_0x00ca('0x49')]);_0x4746a3[_0x00ca('0x34')]=_[_0x00ca('0x33')](_0x444d30['query']);_0x4746a3['filters']=_[_0x00ca('0x35')](_0x4746a3['model'],_0x4746a3[_0x00ca('0x34')]);_0x51317c[_0x00ca('0x36')]=_[_0x00ca('0x35')](_0x4746a3[_0x00ca('0x31')],qs[_0x00ca('0x37')](_0x444d30[_0x00ca('0x34')][_0x00ca('0x37')]));_0x51317c[_0x00ca('0x36')]=_0x51317c[_0x00ca('0x36')]['length']?_0x51317c[_0x00ca('0x36')]:_0x4746a3[_0x00ca('0x31')];if(_0x444d30[_0x00ca('0x34')][_0x00ca('0x43')]){_0x51317c[_0x00ca('0x44')]=[{'all':!![]}];}_0x51317c=_['merge']({},_0x51317c,_0x444d30[_0x00ca('0x42')]);return db[_0x00ca('0x2e')]['find'](_0x51317c)[_0x00ca('0x27')](handleEntityNotFound(_0xed034c,null))[_0x00ca('0x27')](respondWithResult(_0xed034c,null))['catch'](handleError(_0xed034c,null));};exports[_0x00ca('0x4a')]=function(_0x1f1788,_0x3d318c){return db[_0x00ca('0x2e')]['create'](_0x1f1788[_0x00ca('0x4b')],{})[_0x00ca('0x27')](respondWithResult(_0x3d318c,0xc9))['catch'](handleError(_0x3d318c,null));};exports['update']=function(_0x4c0790,_0x336838){if(_0x4c0790[_0x00ca('0x4b')]['id']){delete _0x4c0790[_0x00ca('0x4b')]['id'];}return db[_0x00ca('0x2e')][_0x00ca('0x4c')]({'where':{'id':_0x4c0790[_0x00ca('0x48')]['id']}})[_0x00ca('0x27')](handleEntityNotFound(_0x336838,null))['then'](saveUpdates(_0x4c0790['body'],null))[_0x00ca('0x27')](respondWithResult(_0x336838,null))[_0x00ca('0x46')](handleError(_0x336838,null));};exports[_0x00ca('0x26')]=function(_0x285b10,_0x22406a){return db[_0x00ca('0x2e')][_0x00ca('0x4c')]({'where':{'id':_0x285b10[_0x00ca('0x48')]['id']}})[_0x00ca('0x27')](handleEntityNotFound(_0x22406a,null))[_0x00ca('0x27')](removeEntity(_0x22406a,null))[_0x00ca('0x46')](handleError(_0x22406a,null));};exports[_0x00ca('0x4d')]=function(_0x4174d2,_0x516a82,_0x57bd88){var _0x5cb07c={};var _0x503698={};var _0x3c0b39;var _0x3eacff;return db['DeskAccount'][_0x00ca('0x4e')]({'where':{'id':_0x4174d2[_0x00ca('0x48')]['id']}})[_0x00ca('0x27')](handleEntityNotFound(_0x516a82,null))[_0x00ca('0x27')](function(_0x3be02d){if(_0x3be02d){_0x3c0b39=_0x3be02d;_0x503698['model']=_['keys'](db[_0x00ca('0x4f')][_0x00ca('0x49')]);_0x503698[_0x00ca('0x34')]=_[_0x00ca('0x33')](_0x4174d2[_0x00ca('0x34')]);_0x503698[_0x00ca('0x3c')]=_[_0x00ca('0x35')](_0x503698[_0x00ca('0x31')],_0x503698[_0x00ca('0x34')]);_0x5cb07c[_0x00ca('0x36')]=_[_0x00ca('0x35')](_0x503698[_0x00ca('0x31')],qs[_0x00ca('0x37')](_0x4174d2[_0x00ca('0x34')][_0x00ca('0x37')]));_0x5cb07c['attributes']=_0x5cb07c[_0x00ca('0x36')][_0x00ca('0x50')]?_0x5cb07c[_0x00ca('0x36')]:_0x503698['model'];_0x5cb07c[_0x00ca('0x3a')]=qs[_0x00ca('0x3b')](_0x4174d2['query'][_0x00ca('0x3b')]);_0x5cb07c[_0x00ca('0x3e')]=qs[_0x00ca('0x3c')](_['pick'](_0x4174d2[_0x00ca('0x34')],_0x503698[_0x00ca('0x3c')]));if(_0x4174d2[_0x00ca('0x34')][_0x00ca('0x51')]){_0x5cb07c['where']=_['merge'](_0x5cb07c[_0x00ca('0x3e')],{'$or':_[_0x00ca('0x32')](_0x5cb07c['attributes'],function(_0x59d268){var _0x2d5106={};_0x2d5106[_0x59d268]={'$like':'%'+_0x4174d2['query'][_0x00ca('0x51')]+'%'};return _0x2d5106;})});}_0x5cb07c=_[_0x00ca('0x41')]({},_0x5cb07c,_0x4174d2['options']);return _0x3c0b39[_0x00ca('0x4d')](_0x5cb07c);}})['then'](function(_0x49dd65){if(_0x49dd65){_0x3eacff=_0x49dd65[_0x00ca('0x50')];if(!_0x4174d2[_0x00ca('0x34')][_0x00ca('0x38')](_0x00ca('0x39'))){_0x5cb07c[_0x00ca('0x20')]=qs[_0x00ca('0x20')](_0x4174d2[_0x00ca('0x34')][_0x00ca('0x20')]);_0x5cb07c[_0x00ca('0x1e')]=qs[_0x00ca('0x1e')](_0x4174d2[_0x00ca('0x34')]['offset']);}return _0x3c0b39[_0x00ca('0x4d')](_0x5cb07c);}})[_0x00ca('0x27')](function(_0x266881){if(_0x266881){return _0x266881?{'count':_0x3eacff,'rows':_0x266881}:null;}})[_0x00ca('0x27')](respondWithResult(_0x516a82,null))[_0x00ca('0x46')](handleError(_0x516a82,null));};exports[_0x00ca('0x52')]=function(_0xab1773,_0x225e81,_0x92bdc8){if(_0xab1773[_0x00ca('0x4b')]['id']){delete _0xab1773[_0x00ca('0x4b')]['id'];}return db['DeskAccount'][_0x00ca('0x4e')]({'where':{'id':_0xab1773['params']['id']}})[_0x00ca('0x27')](handleEntityNotFound(_0x225e81,null))[_0x00ca('0x27')](function(_0x5539a0){if(_0x5539a0){_0xab1773[_0x00ca('0x4b')][_0x00ca('0x53')]=_0x5539a0['id'];_0xab1773['body'][_0x00ca('0x54')]=integrations[_0x00ca('0x55')](_0xab1773[_0x00ca('0x4b')][_0x00ca('0x56')],_0xab1773[_0x00ca('0x4b')][_0x00ca('0x3f')]);_0xab1773[_0x00ca('0x4b')][_0x00ca('0x57')]=integrations[_0x00ca('0x58')](_0xab1773[_0x00ca('0x4b')]['channel'],_0xab1773[_0x00ca('0x4b')][_0x00ca('0x3f')]);return db[_0x00ca('0x4f')][_0x00ca('0x4a')](_0xab1773[_0x00ca('0x4b')],{'include':[{'model':db[_0x00ca('0x59')],'as':'Subjects'},{'model':db[_0x00ca('0x59')],'as':_0x00ca('0x57')}]});}return null;})[_0x00ca('0x27')](respondWithResult(_0x225e81,null))['catch'](handleError(_0x225e81,null));};exports[_0x00ca('0x5a')]=function(_0x4baa17,_0xab4f4,_0x381d97){var _0x3b7515=[{'name':_0x00ca('0x5b'),'label':_0x00ca('0x5b'),'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 _0x4239b0='';return db[_0x00ca('0x2e')]['findOne']({'where':{'id':_0x4baa17[_0x00ca('0x48')]['id']},'attributes':['id',_0x00ca('0x5c'),_0x00ca('0x5d'),_0x00ca('0x5e'),'password',_0x00ca('0x5f'),'consumerSecret','token','tokenSecret']})['then'](handleEntityNotFound(_0xab4f4,null))[_0x00ca('0x27')](function(_0xed2082){if(_0xed2082){_0x4239b0=_0xed2082[_0x00ca('0x5c')];var _0x438177=_0x4239b0[_0x00ca('0x60')](-0x1);if(_0x438177==='/'){_0x4239b0=_0x4239b0[_0x00ca('0x61')](0x0,_0x4239b0[_0x00ca('0x62')](_0x438177));}var _0x484857={'method':_0x00ca('0x63'),'uri':util[_0x00ca('0x64')](_0x00ca('0x65'),_0x4239b0),'headers':{'Content-Type':'application/json','Accept':_0x00ca('0x66')},'json':!![]};if(_0xed2082[_0x00ca('0x5d')]===_0x00ca('0x67')){_0x484857[_0x00ca('0x68')][_0x00ca('0x69')]=util[_0x00ca('0x64')](_0x00ca('0x6a'),new Buffer(util[_0x00ca('0x64')](_0x00ca('0x6b'),_0xed2082[_0x00ca('0x5e')],_0xed2082[_0x00ca('0x6c')]))[_0x00ca('0x6d')]('base64'));}return rp(_0x484857)['then'](function(_0x54bfd4){return _0x3b7515[_0x00ca('0x6e')](_['map'](_0x54bfd4[_0x00ca('0x6f')]['entries'],function(_0x8154a4){return{'id':_0x8154a4['name'],'name':_0x8154a4[_0x00ca('0x2b')],'type':_0x8154a4[_0x00ca('0x3f')],'active':_0x8154a4['active'],'label':_0x8154a4['label'],'custom':!![]};}));});}})[_0x00ca('0x27')](function(_0xbe9197){return{'count':_0xbe9197['length'],'rows':_0xbe9197};})[_0x00ca('0x27')](respondWithResult(_0xab4f4,null))['catch'](function(_0x491550){var _0x4e36c1=_0x4baa17[_0x00ca('0x34')][_0x00ca('0x70')]?0x1f4:_0x491550[_0x00ca('0x71')]||0x1f4;logger[_0x00ca('0x29')](_0x00ca('0x72'),_0x00ca('0x5a'),_0x4e36c1,JSON[_0x00ca('0x73')](_0x491550));delete _0x491550[_0x00ca('0x2b')];if(_0x4e36c1===0x191){_0x4e36c1=0x190;}_0xab4f4[_0x00ca('0x1c')](_0x4e36c1)['send'](_0x4baa17[_0x00ca('0x34')][_0x00ca('0x70')]?{'message':_0x00ca('0x74'),'statusCode':_0x491550['statusCode']}:_0x491550);});}; \ No newline at end of file +var _0xd3af=['moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','DeskAccount','keys','find','create','body','getConfigurations','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','password','toString','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','fast-json-patch'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0xd3af,0x1bf));var _0xfd3a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd3af[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd3a('0x0'));var rp=require('request-promise');var moment=require(_0xfd3a('0x1'));var BPromise=require(_0xfd3a('0x2'));var Mustache=require('mustache');var util=require(_0xfd3a('0x3'));var path=require(_0xfd3a('0x4'));var sox=require('sox');var csv=require(_0xfd3a('0x5'));var ejs=require(_0xfd3a('0x6'));var fs=require('fs');var fs_extra=require(_0xfd3a('0x7'));var _=require(_0xfd3a('0x8'));var squel=require('squel');var crypto=require(_0xfd3a('0x9'));var jsforce=require(_0xfd3a('0xa'));var deskjs=require(_0xfd3a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfd3a('0xc'));var Papa=require(_0xfd3a('0xd'));var Redis=require(_0xfd3a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfd3a('0xf'));var as=require(_0xfd3a('0x10'));var hardwareService=require(_0xfd3a('0x11'));var logger=require(_0xfd3a('0x12'))(_0xfd3a('0x13'));var utils=require(_0xfd3a('0x14'));var config=require(_0xfd3a('0x15'));var licenseUtil=require(_0xfd3a('0x16'));var db=require(_0xfd3a('0x17'))['db'];var integrations=require(_0xfd3a('0x18'));function respondWithStatusCode(_0x1073a6,_0x3fbe74){_0x3fbe74=_0x3fbe74||0xcc;return function(_0x5eb2b4){if(_0x5eb2b4){return _0x1073a6[_0xfd3a('0x19')](_0x3fbe74);}return _0x1073a6[_0xfd3a('0x1a')](_0x3fbe74)['end']();};}function respondWithResult(_0x38d47b,_0x5b0949){_0x5b0949=_0x5b0949||0xc8;return function(_0x571b44){if(_0x571b44){return _0x38d47b[_0xfd3a('0x1a')](_0x5b0949)[_0xfd3a('0x1b')](_0x571b44);}};}function respondWithFilteredResult(_0x59030f,_0x7153ce){return function(_0x431a9c){if(_0x431a9c){var _0x50cb7b=typeof _0x7153ce['offset']===_0xfd3a('0x1c')&&typeof _0x7153ce[_0xfd3a('0x1d')]===_0xfd3a('0x1c');var _0x347021=_0x431a9c[_0xfd3a('0x1e')];var _0x4fe750=_0x50cb7b?0x0:_0x7153ce[_0xfd3a('0x1f')];var _0xf1d16e=_0x50cb7b?_0x431a9c[_0xfd3a('0x1e')]:_0x7153ce[_0xfd3a('0x1f')]+_0x7153ce[_0xfd3a('0x1d')];var _0x590e68;if(_0xf1d16e>=_0x347021){_0xf1d16e=_0x347021;_0x590e68=0xc8;}else{_0x590e68=0xce;}_0x59030f['status'](_0x590e68);return _0x59030f[_0xfd3a('0x20')](_0xfd3a('0x21'),_0x4fe750+'-'+_0xf1d16e+'/'+_0x347021)[_0xfd3a('0x1b')](_0x431a9c);}return null;};}function patchUpdates(_0x26ac13){return function(_0x4f153d){try{jsonpatch['apply'](_0x4f153d,_0x26ac13,!![]);}catch(_0x272df6){return BPromise[_0xfd3a('0x22')](_0x272df6);}return _0x4f153d[_0xfd3a('0x23')]();};}function saveUpdates(_0x462681,_0x106a45){return function(_0x45b534){if(_0x45b534){return _0x45b534[_0xfd3a('0x24')](_0x462681)[_0xfd3a('0x25')](function(_0x18a5ec){return _0x18a5ec;});}return null;};}function removeEntity(_0xd24caa,_0x5fcb67){return function(_0x558900){if(_0x558900){return _0x558900[_0xfd3a('0x26')]()['then'](function(){_0xd24caa['status'](0xcc)[_0xfd3a('0x27')]();});}};}function handleEntityNotFound(_0x53d6ed,_0x49c6bd){return function(_0x10f6d7){if(!_0x10f6d7){_0x53d6ed[_0xfd3a('0x19')](0x194);}return _0x10f6d7;};}function handleError(_0x1209ba,_0x1b4658){_0x1b4658=_0x1b4658||0x1f4;return function(_0x6ff45b){logger[_0xfd3a('0x28')](_0x6ff45b['stack']);if(_0x6ff45b[_0xfd3a('0x29')]){delete _0x6ff45b[_0xfd3a('0x29')];}_0x1209ba[_0xfd3a('0x1a')](_0x1b4658)[_0xfd3a('0x2a')](_0x6ff45b);};}exports[_0xfd3a('0x2b')]=function(_0x2d4df9,_0x3b4850){var _0x533801={},_0x282c39={},_0x2eff32={'count':0x0,'rows':[]};var _0x1f9377=_[_0xfd3a('0x2c')](db['DeskAccount'][_0xfd3a('0x2d')],function(_0x302c8e){return{'name':_0x302c8e[_0xfd3a('0x2e')],'type':_0x302c8e[_0xfd3a('0x2f')][_0xfd3a('0x30')]};});_0x282c39['model']=_[_0xfd3a('0x2c')](_0x1f9377,_0xfd3a('0x29'));_0x282c39[_0xfd3a('0x31')]=_['keys'](_0x2d4df9[_0xfd3a('0x31')]);_0x282c39[_0xfd3a('0x32')]=_[_0xfd3a('0x33')](_0x282c39[_0xfd3a('0x34')],_0x282c39[_0xfd3a('0x31')]);_0x533801[_0xfd3a('0x35')]=_['intersection'](_0x282c39['model'],qs[_0xfd3a('0x36')](_0x2d4df9[_0xfd3a('0x31')][_0xfd3a('0x36')]));_0x533801[_0xfd3a('0x35')]=_0x533801[_0xfd3a('0x35')][_0xfd3a('0x37')]?_0x533801['attributes']:_0x282c39[_0xfd3a('0x34')];if(!_0x2d4df9[_0xfd3a('0x31')]['hasOwnProperty'](_0xfd3a('0x38'))){_0x533801[_0xfd3a('0x1d')]=qs[_0xfd3a('0x1d')](_0x2d4df9[_0xfd3a('0x31')]['limit']);_0x533801[_0xfd3a('0x1f')]=qs[_0xfd3a('0x1f')](_0x2d4df9[_0xfd3a('0x31')]['offset']);}_0x533801['order']=qs[_0xfd3a('0x39')](_0x2d4df9[_0xfd3a('0x31')][_0xfd3a('0x39')]);_0x533801[_0xfd3a('0x3a')]=qs[_0xfd3a('0x32')](_['pick'](_0x2d4df9[_0xfd3a('0x31')],_0x282c39[_0xfd3a('0x32')]),_0x1f9377);if(_0x2d4df9[_0xfd3a('0x31')]['filter']){_0x533801[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0x533801[_0xfd3a('0x3a')],{'$or':_['map'](_0x1f9377,function(_0x1ecc87){if(_0x1ecc87[_0xfd3a('0x2f')]!==_0xfd3a('0x3c')){var _0x4b9cb8={};_0x4b9cb8[_0x1ecc87['name']]={'$like':'%'+_0x2d4df9[_0xfd3a('0x31')][_0xfd3a('0x3d')]+'%'};return _0x4b9cb8;}})});}_0x533801=_[_0xfd3a('0x3b')]({},_0x533801,_0x2d4df9[_0xfd3a('0x3e')]);var _0x3f4777={'where':_0x533801[_0xfd3a('0x3a')]};return db['DeskAccount'][_0xfd3a('0x1e')](_0x3f4777)[_0xfd3a('0x25')](function(_0x2beef2){_0x2eff32['count']=_0x2beef2;if(_0x2d4df9['query'][_0xfd3a('0x3f')]){_0x533801['include']=[{'all':!![]}];}return db['DeskAccount'][_0xfd3a('0x40')](_0x533801);})[_0xfd3a('0x25')](function(_0x43cbca){_0x2eff32[_0xfd3a('0x41')]=_0x43cbca;return _0x2eff32;})['then'](respondWithFilteredResult(_0x3b4850,_0x533801))[_0xfd3a('0x42')](handleError(_0x3b4850,null));};exports[_0xfd3a('0x43')]=function(_0x119fe0,_0x1bf80e){var _0x423d0c={'raw':![],'where':{'id':_0x119fe0[_0xfd3a('0x44')]['id']}},_0xeb403d={};_0xeb403d['model']=_['keys'](db[_0xfd3a('0x45')][_0xfd3a('0x2d')]);_0xeb403d[_0xfd3a('0x31')]=_[_0xfd3a('0x46')](_0x119fe0[_0xfd3a('0x31')]);_0xeb403d[_0xfd3a('0x32')]=_['intersection'](_0xeb403d[_0xfd3a('0x34')],_0xeb403d[_0xfd3a('0x31')]);_0x423d0c['attributes']=_['intersection'](_0xeb403d['model'],qs[_0xfd3a('0x36')](_0x119fe0[_0xfd3a('0x31')][_0xfd3a('0x36')]));_0x423d0c['attributes']=_0x423d0c[_0xfd3a('0x35')][_0xfd3a('0x37')]?_0x423d0c[_0xfd3a('0x35')]:_0xeb403d['model'];if(_0x119fe0[_0xfd3a('0x31')][_0xfd3a('0x3f')]){_0x423d0c['include']=[{'all':!![]}];}_0x423d0c=_['merge']({},_0x423d0c,_0x119fe0['options']);return db[_0xfd3a('0x45')][_0xfd3a('0x47')](_0x423d0c)[_0xfd3a('0x25')](handleEntityNotFound(_0x1bf80e,null))[_0xfd3a('0x25')](respondWithResult(_0x1bf80e,null))[_0xfd3a('0x42')](handleError(_0x1bf80e,null));};exports[_0xfd3a('0x48')]=function(_0x53469f,_0x3db605){return db[_0xfd3a('0x45')]['create'](_0x53469f[_0xfd3a('0x49')],{})[_0xfd3a('0x25')](respondWithResult(_0x3db605,0xc9))['catch'](handleError(_0x3db605,null));};exports[_0xfd3a('0x24')]=function(_0x43d1fe,_0x4bcc81){if(_0x43d1fe['body']['id']){delete _0x43d1fe['body']['id'];}return db[_0xfd3a('0x45')][_0xfd3a('0x47')]({'where':{'id':_0x43d1fe['params']['id']}})[_0xfd3a('0x25')](handleEntityNotFound(_0x4bcc81,null))[_0xfd3a('0x25')](saveUpdates(_0x43d1fe[_0xfd3a('0x49')],null))['then'](respondWithResult(_0x4bcc81,null))['catch'](handleError(_0x4bcc81,null));};exports[_0xfd3a('0x26')]=function(_0x412f6b,_0x2689e3){return db['DeskAccount']['find']({'where':{'id':_0x412f6b['params']['id']}})[_0xfd3a('0x25')](handleEntityNotFound(_0x2689e3,null))[_0xfd3a('0x25')](removeEntity(_0x2689e3,null))['catch'](handleError(_0x2689e3,null));};exports[_0xfd3a('0x4a')]=function(_0x91011e,_0x3e09cc,_0x178f2e){var _0x2a8d54={};var _0xc84570={};var _0xe68c7b;var _0x356637;return db[_0xfd3a('0x45')]['findOne']({'where':{'id':_0x91011e[_0xfd3a('0x44')]['id']}})[_0xfd3a('0x25')](handleEntityNotFound(_0x3e09cc,null))[_0xfd3a('0x25')](function(_0x3d570f){if(_0x3d570f){_0xe68c7b=_0x3d570f;_0xc84570[_0xfd3a('0x34')]=_[_0xfd3a('0x46')](db['DeskConfiguration'][_0xfd3a('0x2d')]);_0xc84570[_0xfd3a('0x31')]=_[_0xfd3a('0x46')](_0x91011e[_0xfd3a('0x31')]);_0xc84570[_0xfd3a('0x32')]=_[_0xfd3a('0x33')](_0xc84570[_0xfd3a('0x34')],_0xc84570['query']);_0x2a8d54['attributes']=_['intersection'](_0xc84570['model'],qs[_0xfd3a('0x36')](_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x36')]));_0x2a8d54['attributes']=_0x2a8d54[_0xfd3a('0x35')][_0xfd3a('0x37')]?_0x2a8d54[_0xfd3a('0x35')]:_0xc84570[_0xfd3a('0x34')];_0x2a8d54['order']=qs[_0xfd3a('0x39')](_0x91011e['query']['sort']);_0x2a8d54[_0xfd3a('0x3a')]=qs['filters'](_[_0xfd3a('0x4b')](_0x91011e[_0xfd3a('0x31')],_0xc84570[_0xfd3a('0x32')]));if(_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x3d')]){_0x2a8d54[_0xfd3a('0x3a')]=_['merge'](_0x2a8d54['where'],{'$or':_[_0xfd3a('0x2c')](_0x2a8d54[_0xfd3a('0x35')],function(_0x1812a9){var _0x31716d={};_0x31716d[_0x1812a9]={'$like':'%'+_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x3d')]+'%'};return _0x31716d;})});}_0x2a8d54=_['merge']({},_0x2a8d54,_0x91011e['options']);return _0xe68c7b['getConfigurations'](_0x2a8d54);}})['then'](function(_0x52ab8b){if(_0x52ab8b){_0x356637=_0x52ab8b['length'];if(!_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x4c')]('nolimit')){_0x2a8d54[_0xfd3a('0x1d')]=qs['limit'](_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x1d')]);_0x2a8d54[_0xfd3a('0x1f')]=qs[_0xfd3a('0x1f')](_0x91011e[_0xfd3a('0x31')][_0xfd3a('0x1f')]);}return _0xe68c7b[_0xfd3a('0x4a')](_0x2a8d54);}})[_0xfd3a('0x25')](function(_0x1b730f){if(_0x1b730f){return _0x1b730f?{'count':_0x356637,'rows':_0x1b730f}:null;}})['then'](respondWithResult(_0x3e09cc,null))[_0xfd3a('0x42')](handleError(_0x3e09cc,null));};exports[_0xfd3a('0x4d')]=function(_0x2bc035,_0x2faa3e,_0x214795){if(_0x2bc035[_0xfd3a('0x49')]['id']){delete _0x2bc035[_0xfd3a('0x49')]['id'];}return db[_0xfd3a('0x45')]['findOne']({'where':{'id':_0x2bc035[_0xfd3a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2faa3e,null))['then'](function(_0x5e067c){if(_0x5e067c){_0x2bc035['body'][_0xfd3a('0x4e')]=_0x5e067c['id'];_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x4f')]=integrations['getSubjects'](_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x50')],_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x2f')]);_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x51')]=integrations[_0xfd3a('0x52')](_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x50')],_0x2bc035[_0xfd3a('0x49')][_0xfd3a('0x2f')]);return db[_0xfd3a('0x53')][_0xfd3a('0x48')](_0x2bc035[_0xfd3a('0x49')],{'include':[{'model':db[_0xfd3a('0x54')],'as':_0xfd3a('0x4f')},{'model':db[_0xfd3a('0x54')],'as':'Descriptions'}]});}return null;})[_0xfd3a('0x25')](respondWithResult(_0x2faa3e,null))[_0xfd3a('0x42')](handleError(_0x2faa3e,null));};exports[_0xfd3a('0x55')]=function(_0x2c08de,_0x17b5aa,_0x59f6d8){var _0x93cd81=[{'name':_0xfd3a('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xc4dff8='';return db['DeskAccount']['findOne']({'where':{'id':_0x2c08de[_0xfd3a('0x44')]['id']},'attributes':['id',_0xfd3a('0x57'),_0xfd3a('0x58'),_0xfd3a('0x59'),'password',_0xfd3a('0x5a'),_0xfd3a('0x5b'),_0xfd3a('0x5c'),_0xfd3a('0x5d')]})[_0xfd3a('0x25')](handleEntityNotFound(_0x17b5aa,null))[_0xfd3a('0x25')](function(_0x22eb1f){if(_0x22eb1f){_0xc4dff8=_0x22eb1f[_0xfd3a('0x57')];var _0x3a984e=_0xc4dff8['slice'](-0x1);if(_0x3a984e==='/'){_0xc4dff8=_0xc4dff8[_0xfd3a('0x5e')](0x0,_0xc4dff8[_0xfd3a('0x5f')](_0x3a984e));}var _0x7dd96={'method':'GET','uri':util['format'](_0xfd3a('0x60'),_0xc4dff8),'headers':{'Content-Type':_0xfd3a('0x61'),'Accept':_0xfd3a('0x61')},'json':!![]};if(_0x22eb1f[_0xfd3a('0x58')]===_0xfd3a('0x62')){_0x7dd96[_0xfd3a('0x63')]['Authorization']=util[_0xfd3a('0x64')](_0xfd3a('0x65'),new Buffer(util[_0xfd3a('0x64')](_0xfd3a('0x66'),_0x22eb1f['username'],_0x22eb1f[_0xfd3a('0x67')]))[_0xfd3a('0x68')]('base64'));}return rp(_0x7dd96)[_0xfd3a('0x25')](function(_0x4f913b){return _0x93cd81['concat'](_[_0xfd3a('0x2c')](_0x4f913b[_0xfd3a('0x69')][_0xfd3a('0x6a')],function(_0x23738c){return{'id':_0x23738c['name'],'name':_0x23738c['name'],'type':_0x23738c[_0xfd3a('0x2f')],'active':_0x23738c[_0xfd3a('0x6b')],'label':_0x23738c[_0xfd3a('0x6c')],'custom':!![]};}));});}})[_0xfd3a('0x25')](function(_0x3de3f6){return{'count':_0x3de3f6[_0xfd3a('0x37')],'rows':_0x3de3f6};})[_0xfd3a('0x25')](respondWithResult(_0x17b5aa,null))[_0xfd3a('0x42')](function(_0x4b8257){var _0x30fb77=_0x2c08de[_0xfd3a('0x31')][_0xfd3a('0x6d')]?0x1f4:_0x4b8257[_0xfd3a('0x6e')]||0x1f4;logger[_0xfd3a('0x28')](_0xfd3a('0x6f'),_0xfd3a('0x55'),_0x30fb77,JSON['stringify'](_0x4b8257));delete _0x4b8257[_0xfd3a('0x29')];if(_0x30fb77===0x191){_0x30fb77=0x190;}_0x17b5aa['status'](_0x30fb77)[_0xfd3a('0x2a')](_0x2c08de[_0xfd3a('0x31')][_0xfd3a('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x4b8257[_0xfd3a('0x6e')]}:_0x4b8257);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2ad3bac..4826ebb 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 _0x04a9=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x04a9,0x1a4));var _0x904a=function(_0x55d528,_0x382d15){_0x55d528=_0x55d528-0x0;var _0x318eea=_0x04a9[_0x55d528];return _0x318eea;};'use strict';var _=require(_0x904a('0x0'));var util=require(_0x904a('0x1'));var logger=require('../../config/logger')(_0x904a('0x2'));var moment=require(_0x904a('0x3'));var BPromise=require(_0x904a('0x4'));var rp=require(_0x904a('0x5'));var fs=require('fs');var path=require(_0x904a('0x6'));var rimraf=require(_0x904a('0x7'));var config=require(_0x904a('0x8'));var attributes=require(_0x904a('0x9'));var integrations=require(_0x904a('0xa'));module['exports']=function(_0x366753,_0x524d65){return _0x366753[_0x904a('0xb')](_0x904a('0xc'),attributes,{'tableName':_0x904a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fa1=['util','api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash'];(function(_0x11a4ef,_0x5790ce){var _0x311fcb=function(_0x4629d1){while(--_0x4629d1){_0x11a4ef['push'](_0x11a4ef['shift']());}};_0x311fcb(++_0x5790ce);}(_0x4fa1,0x1ac));var _0x14fa=function(_0x3b4141,_0x2cdf53){_0x3b4141=_0x3b4141-0x0;var _0x4f4561=_0x4fa1[_0x3b4141];return _0x4f4561;};'use strict';var _=require(_0x14fa('0x0'));var util=require(_0x14fa('0x1'));var logger=require('../../config/logger')(_0x14fa('0x2'));var moment=require(_0x14fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14fa('0x4'));var config=require(_0x14fa('0x5'));var attributes=require(_0x14fa('0x6'));var integrations=require(_0x14fa('0x7'));module[_0x14fa('0x8')]=function(_0x5d86bd,_0x19be61){return _0x5d86bd['define'](_0x14fa('0x9'),attributes,{'tableName':_0x14fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index d61c415..8272735 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 _0x1de8=['include','map','model','attributes','then','DeskAccount','ShowDeskAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetDeskAccount','options','raw','where','limit'];(function(_0x4f450b,_0x22d359){var _0x352b2a=function(_0x1be891){while(--_0x1be891){_0x4f450b['push'](_0x4f450b['shift']());}};_0x352b2a(++_0x22d359);}(_0x1de8,0x17b));var _0x81de=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x1de8[_0x3f9584];return _0x9d54c;};'use strict';var _=require('lodash');var util=require(_0x81de('0x0'));var moment=require('moment');var BPromise=require(_0x81de('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81de('0x2'));var db=require(_0x81de('0x3'))['db'];var utils=require(_0x81de('0x4'));var logger=require(_0x81de('0x5'))('rpc');var config=require(_0x81de('0x6'));var jayson=require(_0x81de('0x7'));var client=jayson[_0x81de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xad337b,_0x5912c2,_0x1d9a46){return new BPromise(function(_0x4c2d0b,_0x3a1b0f){return client['request'](_0xad337b,_0x1d9a46)['then'](function(_0x592b47){logger['info'](_0x81de('0x9'),_0x5912c2,_0x81de('0xa'));logger[_0x81de('0xb')](_0x81de('0xc'),_0x5912c2,_0x81de('0xa'),JSON[_0x81de('0xd')](_0x592b47));if(_0x592b47[_0x81de('0xe')]){if(_0x592b47[_0x81de('0xe')][_0x81de('0xf')]===0x1f4){logger['error'](_0x81de('0x9'),_0x5912c2,_0x592b47[_0x81de('0xe')][_0x81de('0x10')]);return _0x3a1b0f(_0x592b47['error'][_0x81de('0x10')]);}logger[_0x81de('0xe')](_0x81de('0x9'),_0x5912c2,_0x592b47['error'][_0x81de('0x10')]);return _0x4c2d0b(_0x592b47[_0x81de('0xe')]['message']);}else{logger[_0x81de('0x11')](_0x81de('0x9'),_0x5912c2,'request\x20sent');_0x4c2d0b(_0x592b47['result'][_0x81de('0x10')]);}})[_0x81de('0x12')](function(_0x27848b){logger['error'](_0x81de('0x9'),_0x5912c2,_0x27848b);_0x3a1b0f(_0x27848b);});});}exports[_0x81de('0x13')]=function(_0x21d928){var _0x51dd9c=this;return new Promise(function(_0x2c0352,_0x1216c0){return db['DeskAccount']['findAll']({'raw':_0x21d928['options']?_0x21d928[_0x81de('0x14')][_0x81de('0x15')]===undefined?!![]:![]:!![],'where':_0x21d928['options']?_0x21d928[_0x81de('0x14')][_0x81de('0x16')]||null:null,'attributes':_0x21d928['options']?_0x21d928['options']['attributes']||null:null,'limit':_0x21d928['options']?_0x21d928[_0x81de('0x14')][_0x81de('0x17')]||null:null,'include':_0x21d928[_0x81de('0x14')]?_0x21d928[_0x81de('0x14')][_0x81de('0x18')]?_[_0x81de('0x19')](_0x21d928[_0x81de('0x14')][_0x81de('0x18')],function(_0x2c0b27){return{'model':db[_0x2c0b27[_0x81de('0x1a')]],'as':_0x2c0b27['as'],'attributes':_0x2c0b27[_0x81de('0x1b')],'include':_0x2c0b27[_0x81de('0x18')]?_[_0x81de('0x19')](_0x2c0b27[_0x81de('0x18')],function(_0x1bec2d){return{'model':db[_0x1bec2d[_0x81de('0x1a')]],'as':_0x1bec2d['as'],'attributes':_0x1bec2d[_0x81de('0x1b')],'include':_0x1bec2d[_0x81de('0x18')]?_[_0x81de('0x19')](_0x1bec2d[_0x81de('0x18')],function(_0x569651){return{'model':db[_0x569651[_0x81de('0x1a')]],'as':_0x569651['as'],'attributes':_0x569651[_0x81de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81de('0x1c')](function(_0xcffe5a){logger[_0x81de('0x11')](_0x81de('0x13'),_0x21d928);logger[_0x81de('0xb')](_0x81de('0x13'),_0x21d928,JSON[_0x81de('0xd')](_0xcffe5a));_0x2c0352(_0xcffe5a);})['catch'](function(_0x198a57){logger['error'](_0x81de('0x13'),_0x198a57[_0x81de('0x10')],_0x21d928);_0x1216c0(_0x51dd9c[_0x81de('0xe')](0x1f4,_0x198a57['message']));});});};exports['ShowDeskAccount']=function(_0x50128e){var _0x6906b4=this;return new Promise(function(_0x5f25ec,_0x53b025){return db[_0x81de('0x1d')]['find']({'raw':_0x50128e[_0x81de('0x14')]?_0x50128e[_0x81de('0x14')][_0x81de('0x15')]===undefined?!![]:![]:!![],'where':_0x50128e[_0x81de('0x14')]?_0x50128e[_0x81de('0x14')][_0x81de('0x16')]||null:null,'attributes':_0x50128e[_0x81de('0x14')]?_0x50128e[_0x81de('0x14')]['attributes']||null:null,'include':_0x50128e[_0x81de('0x14')]?_0x50128e[_0x81de('0x14')][_0x81de('0x18')]?_['map'](_0x50128e[_0x81de('0x14')][_0x81de('0x18')],function(_0x38a676){return{'model':db[_0x38a676[_0x81de('0x1a')]],'as':_0x38a676['as'],'attributes':_0x38a676[_0x81de('0x1b')],'include':_0x38a676[_0x81de('0x18')]?_[_0x81de('0x19')](_0x38a676['include'],function(_0x16bac3){return{'model':db[_0x16bac3[_0x81de('0x1a')]],'as':_0x16bac3['as'],'attributes':_0x16bac3[_0x81de('0x1b')],'include':_0x16bac3[_0x81de('0x18')]?_[_0x81de('0x19')](_0x16bac3['include'],function(_0x422ed8){return{'model':db[_0x422ed8[_0x81de('0x1a')]],'as':_0x422ed8['as'],'attributes':_0x422ed8[_0x81de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81de('0x1c')](function(_0x98d47){logger[_0x81de('0x11')]('ShowDeskAccount',_0x50128e);logger['debug'](_0x81de('0x1e'),_0x50128e,JSON[_0x81de('0xd')](_0x98d47));_0x5f25ec(_0x98d47);})['catch'](function(_0x4fefc8){logger[_0x81de('0xe')]('ShowDeskAccount',_0x4fefc8[_0x81de('0x10')],_0x50128e);_0x53b025(_0x6906b4['error'](0x1f4,_0x4fefc8[_0x81de('0x10')]));});});}; \ No newline at end of file +var _0xb557=['map','model','GetDeskAccount','stringify','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x3d7e93,_0x21b2e0){var _0x25edc0=function(_0x26781e){while(--_0x26781e){_0x3d7e93['push'](_0x3d7e93['shift']());}};_0x25edc0(++_0x21b2e0);}(_0xb557,0x1ef));var _0x7b55=function(_0x3fe8b3,_0x3c2d14){_0x3fe8b3=_0x3fe8b3-0x0;var _0x21554c=_0xb557[_0x3fe8b3];return _0x21554c;};'use strict';var _=require(_0x7b55('0x0'));var util=require('util');var moment=require(_0x7b55('0x1'));var BPromise=require(_0x7b55('0x2'));var rs=require(_0x7b55('0x3'));var fs=require('fs');var Redis=require(_0x7b55('0x4'));var db=require(_0x7b55('0x5'))['db'];var utils=require(_0x7b55('0x6'));var logger=require(_0x7b55('0x7'))(_0x7b55('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b55('0x9'));var client=jayson['client'][_0x7b55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47bd1a,_0x4d83cb,_0x14617c){return new BPromise(function(_0x18bad1,_0x5e2205){return client[_0x7b55('0xb')](_0x47bd1a,_0x14617c)[_0x7b55('0xc')](function(_0x2aba0a){logger[_0x7b55('0xd')](_0x7b55('0xe'),_0x4d83cb,'request\x20sent');logger[_0x7b55('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4d83cb,_0x7b55('0x10'),JSON['stringify'](_0x2aba0a));if(_0x2aba0a[_0x7b55('0x11')]){if(_0x2aba0a[_0x7b55('0x11')][_0x7b55('0x12')]===0x1f4){logger[_0x7b55('0x11')]('DeskAccount,\x20%s,\x20%s',_0x4d83cb,_0x2aba0a['error'][_0x7b55('0x13')]);return _0x5e2205(_0x2aba0a[_0x7b55('0x11')]['message']);}logger[_0x7b55('0x11')](_0x7b55('0xe'),_0x4d83cb,_0x2aba0a[_0x7b55('0x11')][_0x7b55('0x13')]);return _0x18bad1(_0x2aba0a[_0x7b55('0x11')][_0x7b55('0x13')]);}else{logger['info'](_0x7b55('0xe'),_0x4d83cb,_0x7b55('0x10'));_0x18bad1(_0x2aba0a[_0x7b55('0x14')][_0x7b55('0x13')]);}})[_0x7b55('0x15')](function(_0x55bd98){logger[_0x7b55('0x11')]('DeskAccount,\x20%s,\x20%s',_0x4d83cb,_0x55bd98);_0x5e2205(_0x55bd98);});});}exports['GetDeskAccount']=function(_0x171f15){var _0x3c51f6=this;return new Promise(function(_0x51daa0,_0x278404){return db[_0x7b55('0x16')][_0x7b55('0x17')]({'raw':_0x171f15['options']?_0x171f15[_0x7b55('0x18')][_0x7b55('0x19')]===undefined?!![]:![]:!![],'where':_0x171f15[_0x7b55('0x18')]?_0x171f15[_0x7b55('0x18')][_0x7b55('0x1a')]||null:null,'attributes':_0x171f15[_0x7b55('0x18')]?_0x171f15[_0x7b55('0x18')][_0x7b55('0x1b')]||null:null,'limit':_0x171f15[_0x7b55('0x18')]?_0x171f15[_0x7b55('0x18')][_0x7b55('0x1c')]||null:null,'include':_0x171f15[_0x7b55('0x18')]?_0x171f15[_0x7b55('0x18')][_0x7b55('0x1d')]?_[_0x7b55('0x1e')](_0x171f15[_0x7b55('0x18')][_0x7b55('0x1d')],function(_0x8f3c99){return{'model':db[_0x8f3c99[_0x7b55('0x1f')]],'as':_0x8f3c99['as'],'attributes':_0x8f3c99[_0x7b55('0x1b')],'include':_0x8f3c99['include']?_[_0x7b55('0x1e')](_0x8f3c99[_0x7b55('0x1d')],function(_0x189f99){return{'model':db[_0x189f99['model']],'as':_0x189f99['as'],'attributes':_0x189f99[_0x7b55('0x1b')],'include':_0x189f99['include']?_['map'](_0x189f99[_0x7b55('0x1d')],function(_0x5c750e){return{'model':db[_0x5c750e[_0x7b55('0x1f')]],'as':_0x5c750e['as'],'attributes':_0x5c750e[_0x7b55('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7b55('0xc')](function(_0x46969d){logger['info'](_0x7b55('0x20'),_0x171f15);logger[_0x7b55('0xf')](_0x7b55('0x20'),_0x171f15,JSON[_0x7b55('0x21')](_0x46969d));_0x51daa0(_0x46969d);})[_0x7b55('0x15')](function(_0x29d5dc){logger[_0x7b55('0x11')](_0x7b55('0x20'),_0x29d5dc[_0x7b55('0x13')],_0x171f15);_0x278404(_0x3c51f6[_0x7b55('0x11')](0x1f4,_0x29d5dc[_0x7b55('0x13')]));});});};exports[_0x7b55('0x22')]=function(_0x12f0f2){var _0x94a450=this;return new Promise(function(_0x175bd3,_0xb8c4a8){return db[_0x7b55('0x16')]['find']({'raw':_0x12f0f2[_0x7b55('0x18')]?_0x12f0f2[_0x7b55('0x18')][_0x7b55('0x19')]===undefined?!![]:![]:!![],'where':_0x12f0f2['options']?_0x12f0f2['options']['where']||null:null,'attributes':_0x12f0f2[_0x7b55('0x18')]?_0x12f0f2['options']['attributes']||null:null,'include':_0x12f0f2['options']?_0x12f0f2['options']['include']?_['map'](_0x12f0f2[_0x7b55('0x18')]['include'],function(_0x4707ea){return{'model':db[_0x4707ea['model']],'as':_0x4707ea['as'],'attributes':_0x4707ea[_0x7b55('0x1b')],'include':_0x4707ea[_0x7b55('0x1d')]?_['map'](_0x4707ea['include'],function(_0x57804d){return{'model':db[_0x57804d[_0x7b55('0x1f')]],'as':_0x57804d['as'],'attributes':_0x57804d['attributes'],'include':_0x57804d['include']?_[_0x7b55('0x1e')](_0x57804d['include'],function(_0x2a19f2){return{'model':db[_0x2a19f2['model']],'as':_0x2a19f2['as'],'attributes':_0x2a19f2[_0x7b55('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ad59d){logger[_0x7b55('0xd')](_0x7b55('0x22'),_0x12f0f2);logger[_0x7b55('0xf')](_0x7b55('0x22'),_0x12f0f2,JSON[_0x7b55('0x21')](_0x4ad59d));_0x175bd3(_0x4ad59d);})['catch'](function(_0x262c80){logger['error']('ShowDeskAccount',_0x262c80[_0x7b55('0x13')],_0x12f0f2);_0xb8c4a8(_0x94a450[_0x7b55('0x11')](0x1f4,_0x262c80[_0x7b55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 23b33a8..b6370e0 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x461820,_0x13bbcc){var _0x3b077f=function(_0x15651e){while(--_0x15651e){_0x461820['push'](_0x461820['shift']());}};_0x3b077f(++_0x13bbcc);}(_0x34e8,0x12c));var _0x834e=function(_0x33a4b9,_0x9d767d){_0x33a4b9=_0x33a4b9-0x0;var _0x30c152=_0x34e8[_0x33a4b9];return _0x30c152;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3fbcb8,_0x1e5146){var _0x471757=function(_0x7dc213){while(--_0x7dc213){_0x3fbcb8['push'](_0x3fbcb8['shift']());}};_0x471757(++_0x1e5146);}(_0x34e8,0x12c));var _0x834e=function(_0x391493,_0x2779e2){_0x391493=_0x391493-0x0;var _0x3d4698=_0x34e8[_0x391493];return _0x3d4698;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 52f5dd9..d892317 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 _0x74de=['exports','STRING'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x74de,0xd2));var _0xe74d=function(_0x1c4393,_0x57c2d9){_0x1c4393=_0x1c4393-0x0;var _0x5d26a2=_0x74de[_0x1c4393];return _0x5d26a2;};'use strict';var Sequelize=require('sequelize');module[_0xe74d('0x0')]={'name':{'type':Sequelize[_0xe74d('0x1')]},'description':{'type':Sequelize[_0xe74d('0x1')]}}; \ No newline at end of file +var _0xb441=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb441,0xfa));var _0x1b44=function(_0x307311,_0x15d9c5){_0x307311=_0x307311-0x0;var _0x48c292=_0xb441[_0x307311];return _0x48c292;};'use strict';var Sequelize=require(_0x1b44('0x0'));module[_0x1b44('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1b44('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 175194d..448ada8 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 _0xef15=['getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','findOne','order','pick','getFields','getSubjects','DeskField'];(function(_0x43139e,_0x762629){var _0x2bc838=function(_0x593ec3){while(--_0x593ec3){_0x43139e['push'](_0x43139e['shift']());}};_0x2bc838(++_0x762629);}(_0xef15,0x103));var _0x5ef1=function(_0xb4ec3a,_0x2bace0){_0xb4ec3a=_0xb4ec3a-0x0;var _0x1b83db=_0xef15[_0xb4ec3a];return _0x1b83db;};'use strict';var emlformat=require(_0x5ef1('0x0'));var rimraf=require(_0x5ef1('0x1'));var zipdir=require(_0x5ef1('0x2'));var jsonpatch=require(_0x5ef1('0x3'));var rp=require(_0x5ef1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ef1('0x5'));var util=require(_0x5ef1('0x6'));var path=require('path');var sox=require(_0x5ef1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ef1('0x8'));var _=require('lodash');var squel=require(_0x5ef1('0x9'));var crypto=require(_0x5ef1('0xa'));var jsforce=require(_0x5ef1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ef1('0xc'));var Papa=require(_0x5ef1('0xd'));var Redis=require(_0x5ef1('0xe'));var authService=require(_0x5ef1('0xf'));var qs=require(_0x5ef1('0x10'));var as=require(_0x5ef1('0x11'));var hardwareService=require(_0x5ef1('0x12'));var logger=require('../../config/logger')(_0x5ef1('0x13'));var utils=require(_0x5ef1('0x14'));var config=require(_0x5ef1('0x15'));var licenseUtil=require(_0x5ef1('0x16'));var db=require(_0x5ef1('0x17'))['db'];function respondWithStatusCode(_0x1747d9,_0x3a8aac){_0x3a8aac=_0x3a8aac||0xcc;return function(_0x4ca68b){if(_0x4ca68b){return _0x1747d9[_0x5ef1('0x18')](_0x3a8aac);}return _0x1747d9[_0x5ef1('0x19')](_0x3a8aac)[_0x5ef1('0x1a')]();};}function respondWithResult(_0x4aba85,_0x151ad2){_0x151ad2=_0x151ad2||0xc8;return function(_0x376384){if(_0x376384){return _0x4aba85[_0x5ef1('0x19')](_0x151ad2)[_0x5ef1('0x1b')](_0x376384);}};}function respondWithFilteredResult(_0x4022cb,_0x261293){return function(_0x374d90){if(_0x374d90){var _0x4666ea=typeof _0x261293[_0x5ef1('0x1c')]===_0x5ef1('0x1d')&&typeof _0x261293[_0x5ef1('0x1e')]===_0x5ef1('0x1d');var _0x22271a=_0x374d90[_0x5ef1('0x1f')];var _0x55b5b8=_0x4666ea?0x0:_0x261293[_0x5ef1('0x1c')];var _0x144acb=_0x4666ea?_0x374d90['count']:_0x261293[_0x5ef1('0x1c')]+_0x261293[_0x5ef1('0x1e')];var _0xa0b1d4;if(_0x144acb>=_0x22271a){_0x144acb=_0x22271a;_0xa0b1d4=0xc8;}else{_0xa0b1d4=0xce;}_0x4022cb[_0x5ef1('0x19')](_0xa0b1d4);return _0x4022cb[_0x5ef1('0x20')](_0x5ef1('0x21'),_0x55b5b8+'-'+_0x144acb+'/'+_0x22271a)[_0x5ef1('0x1b')](_0x374d90);}return null;};}function patchUpdates(_0x335b38){return function(_0x5c44ae){try{jsonpatch[_0x5ef1('0x22')](_0x5c44ae,_0x335b38,!![]);}catch(_0x102743){return BPromise[_0x5ef1('0x23')](_0x102743);}return _0x5c44ae[_0x5ef1('0x24')]();};}function saveUpdates(_0x28fb5c,_0x92a760){return function(_0x5114e4){if(_0x5114e4){return _0x5114e4[_0x5ef1('0x25')](_0x28fb5c)['then'](function(_0x5d22e9){return _0x5d22e9;});}return null;};}function removeEntity(_0x52bd1e,_0x202391){return function(_0x128b9d){if(_0x128b9d){return _0x128b9d[_0x5ef1('0x26')]()[_0x5ef1('0x27')](function(){_0x52bd1e[_0x5ef1('0x19')](0xcc)[_0x5ef1('0x1a')]();});}};}function handleEntityNotFound(_0x35fdae,_0x51195c){return function(_0x186de3){if(!_0x186de3){_0x35fdae[_0x5ef1('0x18')](0x194);}return _0x186de3;};}function handleError(_0x52cbe4,_0x51556d){_0x51556d=_0x51556d||0x1f4;return function(_0x2f8e26){logger[_0x5ef1('0x28')](_0x2f8e26['stack']);if(_0x2f8e26[_0x5ef1('0x29')]){delete _0x2f8e26['name'];}_0x52cbe4[_0x5ef1('0x19')](_0x51556d)[_0x5ef1('0x2a')](_0x2f8e26);};}exports['index']=function(_0x30c510,_0x5e080b){var _0x252f15={},_0x2204d0={},_0x2e1dbf={'count':0x0,'rows':[]};var _0x46d1b2=_[_0x5ef1('0x2b')](db[_0x5ef1('0x2c')][_0x5ef1('0x2d')],function(_0x1a163c){return{'name':_0x1a163c[_0x5ef1('0x2e')],'type':_0x1a163c[_0x5ef1('0x2f')][_0x5ef1('0x30')]};});_0x2204d0[_0x5ef1('0x31')]=_[_0x5ef1('0x2b')](_0x46d1b2,_0x5ef1('0x29'));_0x2204d0['query']=_[_0x5ef1('0x32')](_0x30c510['query']);_0x2204d0[_0x5ef1('0x33')]=_[_0x5ef1('0x34')](_0x2204d0[_0x5ef1('0x31')],_0x2204d0[_0x5ef1('0x35')]);_0x252f15[_0x5ef1('0x36')]=_['intersection'](_0x2204d0['model'],qs[_0x5ef1('0x37')](_0x30c510[_0x5ef1('0x35')][_0x5ef1('0x37')]));_0x252f15[_0x5ef1('0x36')]=_0x252f15[_0x5ef1('0x36')][_0x5ef1('0x38')]?_0x252f15[_0x5ef1('0x36')]:_0x2204d0[_0x5ef1('0x31')];if(!_0x30c510['query'][_0x5ef1('0x39')](_0x5ef1('0x3a'))){_0x252f15[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x30c510['query'][_0x5ef1('0x1e')]);_0x252f15[_0x5ef1('0x1c')]=qs['offset'](_0x30c510['query'][_0x5ef1('0x1c')]);}_0x252f15['order']=qs['sort'](_0x30c510[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x252f15[_0x5ef1('0x3c')]=qs['filters'](_['pick'](_0x30c510[_0x5ef1('0x35')],_0x2204d0[_0x5ef1('0x33')]),_0x46d1b2);if(_0x30c510['query']['filter']){_0x252f15[_0x5ef1('0x3c')]=_[_0x5ef1('0x3d')](_0x252f15[_0x5ef1('0x3c')],{'$or':_[_0x5ef1('0x2b')](_0x46d1b2,function(_0x3b21f7){if(_0x3b21f7[_0x5ef1('0x2f')]!==_0x5ef1('0x3e')){var _0x4e845f={};_0x4e845f[_0x3b21f7[_0x5ef1('0x29')]]={'$like':'%'+_0x30c510['query'][_0x5ef1('0x3f')]+'%'};return _0x4e845f;}})});}_0x252f15=_[_0x5ef1('0x3d')]({},_0x252f15,_0x30c510['options']);var _0x551327={'where':_0x252f15[_0x5ef1('0x3c')]};return db[_0x5ef1('0x2c')][_0x5ef1('0x1f')](_0x551327)[_0x5ef1('0x27')](function(_0x49e33a){_0x2e1dbf[_0x5ef1('0x1f')]=_0x49e33a;if(_0x30c510[_0x5ef1('0x35')][_0x5ef1('0x40')]){_0x252f15[_0x5ef1('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5ef1('0x42')](_0x252f15);})['then'](function(_0x49e4fd){_0x2e1dbf[_0x5ef1('0x43')]=_0x49e4fd;return _0x2e1dbf;})['then'](respondWithFilteredResult(_0x5e080b,_0x252f15))['catch'](handleError(_0x5e080b,null));};exports[_0x5ef1('0x44')]=function(_0x4e1e24,_0x2f7d73){var _0x6359d1={'raw':![],'where':{'id':_0x4e1e24[_0x5ef1('0x45')]['id']}},_0x379db8={};_0x379db8[_0x5ef1('0x31')]=_[_0x5ef1('0x32')](db[_0x5ef1('0x2c')][_0x5ef1('0x2d')]);_0x379db8['query']=_[_0x5ef1('0x32')](_0x4e1e24[_0x5ef1('0x35')]);_0x379db8[_0x5ef1('0x33')]=_[_0x5ef1('0x34')](_0x379db8['model'],_0x379db8[_0x5ef1('0x35')]);_0x6359d1[_0x5ef1('0x36')]=_[_0x5ef1('0x34')](_0x379db8['model'],qs[_0x5ef1('0x37')](_0x4e1e24[_0x5ef1('0x35')][_0x5ef1('0x37')]));_0x6359d1[_0x5ef1('0x36')]=_0x6359d1['attributes'][_0x5ef1('0x38')]?_0x6359d1[_0x5ef1('0x36')]:_0x379db8[_0x5ef1('0x31')];if(_0x4e1e24[_0x5ef1('0x35')][_0x5ef1('0x40')]){_0x6359d1['include']=[{'all':!![]}];}_0x6359d1=_[_0x5ef1('0x3d')]({},_0x6359d1,_0x4e1e24[_0x5ef1('0x46')]);return db[_0x5ef1('0x2c')][_0x5ef1('0x47')](_0x6359d1)[_0x5ef1('0x27')](handleEntityNotFound(_0x2f7d73,null))[_0x5ef1('0x27')](respondWithResult(_0x2f7d73,null))[_0x5ef1('0x48')](handleError(_0x2f7d73,null));};exports[_0x5ef1('0x49')]=function(_0x142581,_0x5d8d36){return db[_0x5ef1('0x2c')][_0x5ef1('0x49')](_0x142581[_0x5ef1('0x4a')],{})[_0x5ef1('0x27')](respondWithResult(_0x5d8d36,0xc9))[_0x5ef1('0x48')](handleError(_0x5d8d36,null));};exports[_0x5ef1('0x25')]=function(_0x24ae36,_0x47168c){if(_0x24ae36[_0x5ef1('0x4a')]['id']){delete _0x24ae36['body']['id'];}return db[_0x5ef1('0x2c')][_0x5ef1('0x47')]({'where':{'id':_0x24ae36[_0x5ef1('0x45')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x47168c,null))[_0x5ef1('0x27')](saveUpdates(_0x24ae36[_0x5ef1('0x4a')],null))[_0x5ef1('0x27')](respondWithResult(_0x47168c,null))[_0x5ef1('0x48')](handleError(_0x47168c,null));};exports[_0x5ef1('0x26')]=function(_0x49b16b,_0x57640e){return db[_0x5ef1('0x2c')][_0x5ef1('0x47')]({'where':{'id':_0x49b16b[_0x5ef1('0x45')]['id']}})['then'](handleEntityNotFound(_0x57640e,null))[_0x5ef1('0x27')](removeEntity(_0x57640e,null))[_0x5ef1('0x48')](handleError(_0x57640e,null));};exports['getFields']=function(_0xf36372,_0x478925,_0x21e4b5){var _0x1f7f01={};var _0x98248={};var _0x2f7fa1;var _0x4f0c30;return db[_0x5ef1('0x2c')][_0x5ef1('0x4b')]({'where':{'id':_0xf36372[_0x5ef1('0x45')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x478925,null))[_0x5ef1('0x27')](function(_0x3648ad){if(_0x3648ad){_0x2f7fa1=_0x3648ad;_0x98248['model']=_['keys'](db['DeskField'][_0x5ef1('0x2d')]);_0x98248[_0x5ef1('0x35')]=_['keys'](_0xf36372[_0x5ef1('0x35')]);_0x98248['filters']=_['intersection'](_0x98248['model'],_0x98248['query']);_0x1f7f01[_0x5ef1('0x36')]=_['intersection'](_0x98248['model'],qs[_0x5ef1('0x37')](_0xf36372['query']['fields']));_0x1f7f01['attributes']=_0x1f7f01['attributes']['length']?_0x1f7f01[_0x5ef1('0x36')]:_0x98248[_0x5ef1('0x31')];_0x1f7f01[_0x5ef1('0x4c')]=qs[_0x5ef1('0x3b')](_0xf36372['query'][_0x5ef1('0x3b')]);_0x1f7f01[_0x5ef1('0x3c')]=qs['filters'](_[_0x5ef1('0x4d')](_0xf36372[_0x5ef1('0x35')],_0x98248[_0x5ef1('0x33')]));if(_0xf36372[_0x5ef1('0x35')][_0x5ef1('0x3f')]){_0x1f7f01[_0x5ef1('0x3c')]=_['merge'](_0x1f7f01['where'],{'$or':_['map'](_0x1f7f01[_0x5ef1('0x36')],function(_0x336144){var _0x183855={};_0x183855[_0x336144]={'$like':'%'+_0xf36372[_0x5ef1('0x35')][_0x5ef1('0x3f')]+'%'};return _0x183855;})});}_0x1f7f01=_[_0x5ef1('0x3d')]({},_0x1f7f01,_0xf36372[_0x5ef1('0x46')]);return _0x2f7fa1[_0x5ef1('0x4e')](_0x1f7f01);}})[_0x5ef1('0x27')](function(_0x37280b){if(_0x37280b){_0x4f0c30=_0x37280b[_0x5ef1('0x38')];if(!_0xf36372['query'][_0x5ef1('0x39')](_0x5ef1('0x3a'))){_0x1f7f01[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0xf36372[_0x5ef1('0x35')]['limit']);_0x1f7f01[_0x5ef1('0x1c')]=qs[_0x5ef1('0x1c')](_0xf36372[_0x5ef1('0x35')]['offset']);}return _0x2f7fa1[_0x5ef1('0x4e')](_0x1f7f01);}})[_0x5ef1('0x27')](function(_0x2414d3){if(_0x2414d3){return _0x2414d3?{'count':_0x4f0c30,'rows':_0x2414d3}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x478925,null))['catch'](handleError(_0x478925,null));};exports[_0x5ef1('0x4f')]=function(_0x5e7192,_0x257138,_0xa5040a){var _0x33c8c7={};var _0x4bcb21={};var _0x48810d;var _0x1c60f9;return db[_0x5ef1('0x2c')]['findOne']({'where':{'id':_0x5e7192[_0x5ef1('0x45')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x257138,null))['then'](function(_0x10e38c){if(_0x10e38c){_0x48810d=_0x10e38c;_0x4bcb21['model']=_[_0x5ef1('0x32')](db[_0x5ef1('0x50')]['rawAttributes']);_0x4bcb21[_0x5ef1('0x35')]=_[_0x5ef1('0x32')](_0x5e7192[_0x5ef1('0x35')]);_0x4bcb21[_0x5ef1('0x33')]=_[_0x5ef1('0x34')](_0x4bcb21[_0x5ef1('0x31')],_0x4bcb21[_0x5ef1('0x35')]);_0x33c8c7['attributes']=_[_0x5ef1('0x34')](_0x4bcb21[_0x5ef1('0x31')],qs['fields'](_0x5e7192[_0x5ef1('0x35')]['fields']));_0x33c8c7[_0x5ef1('0x36')]=_0x33c8c7[_0x5ef1('0x36')][_0x5ef1('0x38')]?_0x33c8c7['attributes']:_0x4bcb21[_0x5ef1('0x31')];_0x33c8c7['order']=qs[_0x5ef1('0x3b')](_0x5e7192[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x33c8c7[_0x5ef1('0x3c')]=qs[_0x5ef1('0x33')](_['pick'](_0x5e7192[_0x5ef1('0x35')],_0x4bcb21[_0x5ef1('0x33')]));if(_0x5e7192['query'][_0x5ef1('0x3f')]){_0x33c8c7['where']=_['merge'](_0x33c8c7[_0x5ef1('0x3c')],{'$or':_[_0x5ef1('0x2b')](_0x33c8c7[_0x5ef1('0x36')],function(_0x52f32f){var _0x11f180={};_0x11f180[_0x52f32f]={'$like':'%'+_0x5e7192[_0x5ef1('0x35')][_0x5ef1('0x3f')]+'%'};return _0x11f180;})});}_0x33c8c7=_[_0x5ef1('0x3d')]({},_0x33c8c7,_0x5e7192[_0x5ef1('0x46')]);return _0x48810d[_0x5ef1('0x4f')](_0x33c8c7);}})[_0x5ef1('0x27')](function(_0x55205f){if(_0x55205f){_0x1c60f9=_0x55205f[_0x5ef1('0x38')];if(!_0x5e7192['query'][_0x5ef1('0x39')](_0x5ef1('0x3a'))){_0x33c8c7[_0x5ef1('0x1e')]=qs['limit'](_0x5e7192[_0x5ef1('0x35')][_0x5ef1('0x1e')]);_0x33c8c7[_0x5ef1('0x1c')]=qs['offset'](_0x5e7192[_0x5ef1('0x35')][_0x5ef1('0x1c')]);}return _0x48810d[_0x5ef1('0x4f')](_0x33c8c7);}})[_0x5ef1('0x27')](function(_0x2a7472){if(_0x2a7472){return _0x2a7472?{'count':_0x1c60f9,'rows':_0x2a7472}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x257138,null))[_0x5ef1('0x48')](handleError(_0x257138,null));};exports[_0x5ef1('0x51')]=function(_0x50b4c7,_0x3ec4a7,_0x4cb3ce){var _0x288eae={};var _0x5d2b35={};var _0xd4b204;var _0x5543bd;return db[_0x5ef1('0x2c')]['findOne']({'where':{'id':_0x50b4c7['params']['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x3ec4a7,null))[_0x5ef1('0x27')](function(_0x3dbf80){if(_0x3dbf80){_0xd4b204=_0x3dbf80;_0x5d2b35[_0x5ef1('0x31')]=_[_0x5ef1('0x32')](db[_0x5ef1('0x50')][_0x5ef1('0x2d')]);_0x5d2b35[_0x5ef1('0x35')]=_['keys'](_0x50b4c7['query']);_0x5d2b35[_0x5ef1('0x33')]=_[_0x5ef1('0x34')](_0x5d2b35[_0x5ef1('0x31')],_0x5d2b35[_0x5ef1('0x35')]);_0x288eae[_0x5ef1('0x36')]=_['intersection'](_0x5d2b35['model'],qs[_0x5ef1('0x37')](_0x50b4c7[_0x5ef1('0x35')][_0x5ef1('0x37')]));_0x288eae['attributes']=_0x288eae[_0x5ef1('0x36')]['length']?_0x288eae[_0x5ef1('0x36')]:_0x5d2b35['model'];_0x288eae[_0x5ef1('0x4c')]=qs[_0x5ef1('0x3b')](_0x50b4c7[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x288eae[_0x5ef1('0x3c')]=qs[_0x5ef1('0x33')](_[_0x5ef1('0x4d')](_0x50b4c7[_0x5ef1('0x35')],_0x5d2b35[_0x5ef1('0x33')]));if(_0x50b4c7[_0x5ef1('0x35')]['filter']){_0x288eae['where']=_[_0x5ef1('0x3d')](_0x288eae[_0x5ef1('0x3c')],{'$or':_[_0x5ef1('0x2b')](_0x288eae[_0x5ef1('0x36')],function(_0x216b7f){var _0x39197f={};_0x39197f[_0x216b7f]={'$like':'%'+_0x50b4c7[_0x5ef1('0x35')]['filter']+'%'};return _0x39197f;})});}_0x288eae=_[_0x5ef1('0x3d')]({},_0x288eae,_0x50b4c7[_0x5ef1('0x46')]);return _0xd4b204[_0x5ef1('0x51')](_0x288eae);}})['then'](function(_0x520e93){if(_0x520e93){_0x5543bd=_0x520e93[_0x5ef1('0x38')];if(!_0x50b4c7[_0x5ef1('0x35')]['hasOwnProperty']('nolimit')){_0x288eae[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x50b4c7[_0x5ef1('0x35')][_0x5ef1('0x1e')]);_0x288eae[_0x5ef1('0x1c')]=qs[_0x5ef1('0x1c')](_0x50b4c7[_0x5ef1('0x35')][_0x5ef1('0x1c')]);}return _0xd4b204[_0x5ef1('0x51')](_0x288eae);}})[_0x5ef1('0x27')](function(_0x396322){if(_0x396322){return _0x396322?{'count':_0x5543bd,'rows':_0x396322}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x3ec4a7,null))[_0x5ef1('0x48')](handleError(_0x3ec4a7,null));};exports[_0x5ef1('0x52')]=function(_0x3de977,_0x12fe62,_0x58d81a){var _0x1d5a31={};var _0x2a967c={};var _0x441333;var _0x1b27d1;return db[_0x5ef1('0x2c')]['findOne']({'where':{'id':_0x3de977[_0x5ef1('0x45')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x12fe62,null))[_0x5ef1('0x27')](function(_0x18406a){if(_0x18406a){_0x441333=_0x18406a;_0x2a967c['model']=_[_0x5ef1('0x32')](db[_0x5ef1('0x53')][_0x5ef1('0x2d')]);_0x2a967c['query']=_[_0x5ef1('0x32')](_0x3de977[_0x5ef1('0x35')]);_0x2a967c[_0x5ef1('0x33')]=_[_0x5ef1('0x34')](_0x2a967c['model'],_0x2a967c[_0x5ef1('0x35')]);_0x1d5a31['attributes']=_['intersection'](_0x2a967c['model'],qs[_0x5ef1('0x37')](_0x3de977[_0x5ef1('0x35')][_0x5ef1('0x37')]));_0x1d5a31[_0x5ef1('0x36')]=_0x1d5a31['attributes'][_0x5ef1('0x38')]?_0x1d5a31['attributes']:_0x2a967c[_0x5ef1('0x31')];_0x1d5a31['order']=qs['sort'](_0x3de977[_0x5ef1('0x35')]['sort']);_0x1d5a31[_0x5ef1('0x3c')]=qs[_0x5ef1('0x33')](_[_0x5ef1('0x4d')](_0x3de977[_0x5ef1('0x35')],_0x2a967c[_0x5ef1('0x33')]));if(_0x3de977[_0x5ef1('0x35')][_0x5ef1('0x3f')]){_0x1d5a31['where']=_[_0x5ef1('0x3d')](_0x1d5a31[_0x5ef1('0x3c')],{'$or':_[_0x5ef1('0x2b')](_0x1d5a31['attributes'],function(_0xfc94e7){var _0x2a8f98={};_0x2a8f98[_0xfc94e7]={'$like':'%'+_0x3de977[_0x5ef1('0x35')]['filter']+'%'};return _0x2a8f98;})});}_0x1d5a31=_[_0x5ef1('0x3d')]({},_0x1d5a31,_0x3de977['options']);return _0x441333[_0x5ef1('0x52')](_0x1d5a31);}})[_0x5ef1('0x27')](function(_0x164bfe){if(_0x164bfe){_0x1b27d1=_0x164bfe['length'];if(!_0x3de977[_0x5ef1('0x35')]['hasOwnProperty'](_0x5ef1('0x3a'))){_0x1d5a31[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x3de977[_0x5ef1('0x35')]['limit']);_0x1d5a31[_0x5ef1('0x1c')]=qs[_0x5ef1('0x1c')](_0x3de977[_0x5ef1('0x35')][_0x5ef1('0x1c')]);}return _0x441333['getTags'](_0x1d5a31);}})['then'](function(_0x4872b3){if(_0x4872b3){return _0x4872b3?{'count':_0x1b27d1,'rows':_0x4872b3}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x12fe62,null))[_0x5ef1('0x48')](handleError(_0x12fe62,null));};exports[_0x5ef1('0x54')]=function(_0x256d28,_0x37fd3a,_0xaf2da7){if(_0x256d28[_0x5ef1('0x4a')]['id']){delete _0x256d28[_0x5ef1('0x4a')]['id'];}return db[_0x5ef1('0x2c')][_0x5ef1('0x4b')]({'where':{'id':_0x256d28['params']['id']}})['then'](handleEntityNotFound(_0x37fd3a,null))[_0x5ef1('0x27')](function(_0x1a8dfd){if(_0x1a8dfd){return _0x1a8dfd[_0x5ef1('0x54')](_0x256d28[_0x5ef1('0x4a')]['ids']||[]);}return null;})[_0x5ef1('0x27')](respondWithResult(_0x37fd3a,null))[_0x5ef1('0x48')](handleError(_0x37fd3a,null));}; \ No newline at end of file +var _0xd7fd=['rows','catch','show','params','length','find','create','body','update','getFields','findOne','DeskField','pick','nolimit','getSubjects','options','getDescriptions','getTags','Tag','setTags','ids','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','status','end','json','undefined','count','offset','limit','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','merge','where','includeAll','include','findAll'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd7fd,0xbd));var _0xdd7f=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0xd7fd[_0x553502];return _0x246c37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd7f('0x0'));var zipdir=require(_0xdd7f('0x1'));var jsonpatch=require(_0xdd7f('0x2'));var rp=require('request-promise');var moment=require(_0xdd7f('0x3'));var BPromise=require(_0xdd7f('0x4'));var Mustache=require(_0xdd7f('0x5'));var util=require(_0xdd7f('0x6'));var path=require(_0xdd7f('0x7'));var sox=require(_0xdd7f('0x8'));var csv=require(_0xdd7f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd7f('0xa'));var _=require(_0xdd7f('0xb'));var squel=require(_0xdd7f('0xc'));var crypto=require(_0xdd7f('0xd'));var jsforce=require(_0xdd7f('0xe'));var deskjs=require(_0xdd7f('0xf'));var toCsv=require(_0xdd7f('0x9'));var querystring=require(_0xdd7f('0x10'));var Papa=require(_0xdd7f('0x11'));var Redis=require(_0xdd7f('0x12'));var authService=require(_0xdd7f('0x13'));var qs=require(_0xdd7f('0x14'));var as=require(_0xdd7f('0x15'));var hardwareService=require(_0xdd7f('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(_0xdd7f('0x17'))['db'];function respondWithStatusCode(_0x3875ed,_0x93f0c4){_0x93f0c4=_0x93f0c4||0xcc;return function(_0x54df6c){if(_0x54df6c){return _0x3875ed['sendStatus'](_0x93f0c4);}return _0x3875ed[_0xdd7f('0x18')](_0x93f0c4)[_0xdd7f('0x19')]();};}function respondWithResult(_0x1c3106,_0x50c981){_0x50c981=_0x50c981||0xc8;return function(_0x8dd7a0){if(_0x8dd7a0){return _0x1c3106['status'](_0x50c981)[_0xdd7f('0x1a')](_0x8dd7a0);}};}function respondWithFilteredResult(_0x4b6685,_0x1a42a9){return function(_0x813e13){if(_0x813e13){var _0xe55722=typeof _0x1a42a9['offset']==='undefined'&&typeof _0x1a42a9['limit']===_0xdd7f('0x1b');var _0x1a6c95=_0x813e13[_0xdd7f('0x1c')];var _0x2b9fb6=_0xe55722?0x0:_0x1a42a9[_0xdd7f('0x1d')];var _0x2e8944=_0xe55722?_0x813e13[_0xdd7f('0x1c')]:_0x1a42a9[_0xdd7f('0x1d')]+_0x1a42a9[_0xdd7f('0x1e')];var _0x16e64d;if(_0x2e8944>=_0x1a6c95){_0x2e8944=_0x1a6c95;_0x16e64d=0xc8;}else{_0x16e64d=0xce;}_0x4b6685[_0xdd7f('0x18')](_0x16e64d);return _0x4b6685['set']('Content-Range',_0x2b9fb6+'-'+_0x2e8944+'/'+_0x1a6c95)[_0xdd7f('0x1a')](_0x813e13);}return null;};}function patchUpdates(_0x55e921){return function(_0x1461d9){try{jsonpatch[_0xdd7f('0x1f')](_0x1461d9,_0x55e921,!![]);}catch(_0x1625ac){return BPromise[_0xdd7f('0x20')](_0x1625ac);}return _0x1461d9[_0xdd7f('0x21')]();};}function saveUpdates(_0x44272f,_0x52e8b6){return function(_0x2171ae){if(_0x2171ae){return _0x2171ae['update'](_0x44272f)['then'](function(_0x486229){return _0x486229;});}return null;};}function removeEntity(_0x9f2cd0,_0x459a14){return function(_0x53ea51){if(_0x53ea51){return _0x53ea51[_0xdd7f('0x22')]()[_0xdd7f('0x23')](function(){_0x9f2cd0[_0xdd7f('0x18')](0xcc)[_0xdd7f('0x19')]();});}};}function handleEntityNotFound(_0xb28da4,_0x33ca62){return function(_0x55d23b){if(!_0x55d23b){_0xb28da4[_0xdd7f('0x24')](0x194);}return _0x55d23b;};}function handleError(_0x2024af,_0x3172e9){_0x3172e9=_0x3172e9||0x1f4;return function(_0x3127bd){logger[_0xdd7f('0x25')](_0x3127bd[_0xdd7f('0x26')]);if(_0x3127bd[_0xdd7f('0x27')]){delete _0x3127bd[_0xdd7f('0x27')];}_0x2024af[_0xdd7f('0x18')](_0x3172e9)[_0xdd7f('0x28')](_0x3127bd);};}exports['index']=function(_0x20853e,_0xaf9b15){var _0x159b9e={},_0x2dbb4a={},_0x154b34={'count':0x0,'rows':[]};var _0x5e1b6b=_['map'](db[_0xdd7f('0x29')][_0xdd7f('0x2a')],function(_0x1aea22){return{'name':_0x1aea22[_0xdd7f('0x2b')],'type':_0x1aea22[_0xdd7f('0x2c')][_0xdd7f('0x2d')]};});_0x2dbb4a[_0xdd7f('0x2e')]=_[_0xdd7f('0x2f')](_0x5e1b6b,'name');_0x2dbb4a[_0xdd7f('0x30')]=_[_0xdd7f('0x31')](_0x20853e[_0xdd7f('0x30')]);_0x2dbb4a[_0xdd7f('0x32')]=_['intersection'](_0x2dbb4a[_0xdd7f('0x2e')],_0x2dbb4a['query']);_0x159b9e[_0xdd7f('0x33')]=_[_0xdd7f('0x34')](_0x2dbb4a[_0xdd7f('0x2e')],qs['fields'](_0x20853e[_0xdd7f('0x30')][_0xdd7f('0x35')]));_0x159b9e[_0xdd7f('0x33')]=_0x159b9e[_0xdd7f('0x33')]['length']?_0x159b9e['attributes']:_0x2dbb4a[_0xdd7f('0x2e')];if(!_0x20853e['query'][_0xdd7f('0x36')]('nolimit')){_0x159b9e[_0xdd7f('0x1e')]=qs[_0xdd7f('0x1e')](_0x20853e['query'][_0xdd7f('0x1e')]);_0x159b9e[_0xdd7f('0x1d')]=qs[_0xdd7f('0x1d')](_0x20853e['query'][_0xdd7f('0x1d')]);}_0x159b9e[_0xdd7f('0x37')]=qs[_0xdd7f('0x38')](_0x20853e[_0xdd7f('0x30')][_0xdd7f('0x38')]);_0x159b9e['where']=qs[_0xdd7f('0x32')](_['pick'](_0x20853e[_0xdd7f('0x30')],_0x2dbb4a[_0xdd7f('0x32')]),_0x5e1b6b);if(_0x20853e[_0xdd7f('0x30')][_0xdd7f('0x39')]){_0x159b9e['where']=_[_0xdd7f('0x3a')](_0x159b9e[_0xdd7f('0x3b')],{'$or':_[_0xdd7f('0x2f')](_0x5e1b6b,function(_0x4d60e2){if(_0x4d60e2[_0xdd7f('0x2c')]!=='VIRTUAL'){var _0x5eb51c={};_0x5eb51c[_0x4d60e2[_0xdd7f('0x27')]]={'$like':'%'+_0x20853e[_0xdd7f('0x30')][_0xdd7f('0x39')]+'%'};return _0x5eb51c;}})});}_0x159b9e=_[_0xdd7f('0x3a')]({},_0x159b9e,_0x20853e['options']);var _0x49c939={'where':_0x159b9e[_0xdd7f('0x3b')]};return db['DeskConfiguration'][_0xdd7f('0x1c')](_0x49c939)[_0xdd7f('0x23')](function(_0x3bfa88){_0x154b34[_0xdd7f('0x1c')]=_0x3bfa88;if(_0x20853e[_0xdd7f('0x30')][_0xdd7f('0x3c')]){_0x159b9e[_0xdd7f('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xdd7f('0x3e')](_0x159b9e);})[_0xdd7f('0x23')](function(_0x407e7b){_0x154b34[_0xdd7f('0x3f')]=_0x407e7b;return _0x154b34;})[_0xdd7f('0x23')](respondWithFilteredResult(_0xaf9b15,_0x159b9e))[_0xdd7f('0x40')](handleError(_0xaf9b15,null));};exports[_0xdd7f('0x41')]=function(_0x8cb682,_0x4589b8){var _0x5f29c2={'raw':![],'where':{'id':_0x8cb682[_0xdd7f('0x42')]['id']}},_0x1d52c4={};_0x1d52c4[_0xdd7f('0x2e')]=_[_0xdd7f('0x31')](db[_0xdd7f('0x29')]['rawAttributes']);_0x1d52c4['query']=_[_0xdd7f('0x31')](_0x8cb682[_0xdd7f('0x30')]);_0x1d52c4[_0xdd7f('0x32')]=_[_0xdd7f('0x34')](_0x1d52c4[_0xdd7f('0x2e')],_0x1d52c4[_0xdd7f('0x30')]);_0x5f29c2[_0xdd7f('0x33')]=_[_0xdd7f('0x34')](_0x1d52c4[_0xdd7f('0x2e')],qs[_0xdd7f('0x35')](_0x8cb682[_0xdd7f('0x30')][_0xdd7f('0x35')]));_0x5f29c2[_0xdd7f('0x33')]=_0x5f29c2['attributes'][_0xdd7f('0x43')]?_0x5f29c2[_0xdd7f('0x33')]:_0x1d52c4[_0xdd7f('0x2e')];if(_0x8cb682[_0xdd7f('0x30')][_0xdd7f('0x3c')]){_0x5f29c2[_0xdd7f('0x3d')]=[{'all':!![]}];}_0x5f29c2=_['merge']({},_0x5f29c2,_0x8cb682['options']);return db[_0xdd7f('0x29')][_0xdd7f('0x44')](_0x5f29c2)[_0xdd7f('0x23')](handleEntityNotFound(_0x4589b8,null))[_0xdd7f('0x23')](respondWithResult(_0x4589b8,null))['catch'](handleError(_0x4589b8,null));};exports[_0xdd7f('0x45')]=function(_0x37cba1,_0x3e6708){return db[_0xdd7f('0x29')]['create'](_0x37cba1[_0xdd7f('0x46')],{})[_0xdd7f('0x23')](respondWithResult(_0x3e6708,0xc9))[_0xdd7f('0x40')](handleError(_0x3e6708,null));};exports[_0xdd7f('0x47')]=function(_0x30f664,_0x186353){if(_0x30f664[_0xdd7f('0x46')]['id']){delete _0x30f664[_0xdd7f('0x46')]['id'];}return db[_0xdd7f('0x29')]['find']({'where':{'id':_0x30f664[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x186353,null))[_0xdd7f('0x23')](saveUpdates(_0x30f664[_0xdd7f('0x46')],null))['then'](respondWithResult(_0x186353,null))['catch'](handleError(_0x186353,null));};exports[_0xdd7f('0x22')]=function(_0x135753,_0x3a772a){return db[_0xdd7f('0x29')]['find']({'where':{'id':_0x135753[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x3a772a,null))['then'](removeEntity(_0x3a772a,null))[_0xdd7f('0x40')](handleError(_0x3a772a,null));};exports[_0xdd7f('0x48')]=function(_0x149f02,_0x36db41,_0x20a2d3){var _0x2e45bf={};var _0x5d38a3={};var _0x4f2200;var _0x44fc4f;return db['DeskConfiguration'][_0xdd7f('0x49')]({'where':{'id':_0x149f02[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x36db41,null))[_0xdd7f('0x23')](function(_0x35e8d0){if(_0x35e8d0){_0x4f2200=_0x35e8d0;_0x5d38a3[_0xdd7f('0x2e')]=_[_0xdd7f('0x31')](db[_0xdd7f('0x4a')][_0xdd7f('0x2a')]);_0x5d38a3['query']=_['keys'](_0x149f02[_0xdd7f('0x30')]);_0x5d38a3[_0xdd7f('0x32')]=_[_0xdd7f('0x34')](_0x5d38a3['model'],_0x5d38a3[_0xdd7f('0x30')]);_0x2e45bf[_0xdd7f('0x33')]=_['intersection'](_0x5d38a3[_0xdd7f('0x2e')],qs[_0xdd7f('0x35')](_0x149f02[_0xdd7f('0x30')][_0xdd7f('0x35')]));_0x2e45bf['attributes']=_0x2e45bf['attributes'][_0xdd7f('0x43')]?_0x2e45bf[_0xdd7f('0x33')]:_0x5d38a3[_0xdd7f('0x2e')];_0x2e45bf['order']=qs[_0xdd7f('0x38')](_0x149f02['query'][_0xdd7f('0x38')]);_0x2e45bf[_0xdd7f('0x3b')]=qs[_0xdd7f('0x32')](_[_0xdd7f('0x4b')](_0x149f02[_0xdd7f('0x30')],_0x5d38a3[_0xdd7f('0x32')]));if(_0x149f02[_0xdd7f('0x30')][_0xdd7f('0x39')]){_0x2e45bf[_0xdd7f('0x3b')]=_['merge'](_0x2e45bf['where'],{'$or':_['map'](_0x2e45bf[_0xdd7f('0x33')],function(_0x31869b){var _0x14d54={};_0x14d54[_0x31869b]={'$like':'%'+_0x149f02[_0xdd7f('0x30')]['filter']+'%'};return _0x14d54;})});}_0x2e45bf=_[_0xdd7f('0x3a')]({},_0x2e45bf,_0x149f02['options']);return _0x4f2200['getFields'](_0x2e45bf);}})[_0xdd7f('0x23')](function(_0x5abb7c){if(_0x5abb7c){_0x44fc4f=_0x5abb7c[_0xdd7f('0x43')];if(!_0x149f02[_0xdd7f('0x30')][_0xdd7f('0x36')](_0xdd7f('0x4c'))){_0x2e45bf['limit']=qs[_0xdd7f('0x1e')](_0x149f02[_0xdd7f('0x30')]['limit']);_0x2e45bf[_0xdd7f('0x1d')]=qs[_0xdd7f('0x1d')](_0x149f02[_0xdd7f('0x30')]['offset']);}return _0x4f2200['getFields'](_0x2e45bf);}})['then'](function(_0x47bdad){if(_0x47bdad){return _0x47bdad?{'count':_0x44fc4f,'rows':_0x47bdad}:null;}})['then'](respondWithResult(_0x36db41,null))[_0xdd7f('0x40')](handleError(_0x36db41,null));};exports[_0xdd7f('0x4d')]=function(_0x37d865,_0x11abba,_0x4488cd){var _0x37a4ce={};var _0x202189={};var _0x192bf;var _0x8e110b;return db['DeskConfiguration'][_0xdd7f('0x49')]({'where':{'id':_0x37d865[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x11abba,null))[_0xdd7f('0x23')](function(_0x3b9a32){if(_0x3b9a32){_0x192bf=_0x3b9a32;_0x202189[_0xdd7f('0x2e')]=_['keys'](db[_0xdd7f('0x4a')][_0xdd7f('0x2a')]);_0x202189['query']=_[_0xdd7f('0x31')](_0x37d865[_0xdd7f('0x30')]);_0x202189[_0xdd7f('0x32')]=_['intersection'](_0x202189[_0xdd7f('0x2e')],_0x202189[_0xdd7f('0x30')]);_0x37a4ce[_0xdd7f('0x33')]=_[_0xdd7f('0x34')](_0x202189[_0xdd7f('0x2e')],qs[_0xdd7f('0x35')](_0x37d865[_0xdd7f('0x30')][_0xdd7f('0x35')]));_0x37a4ce[_0xdd7f('0x33')]=_0x37a4ce[_0xdd7f('0x33')][_0xdd7f('0x43')]?_0x37a4ce[_0xdd7f('0x33')]:_0x202189['model'];_0x37a4ce[_0xdd7f('0x37')]=qs[_0xdd7f('0x38')](_0x37d865[_0xdd7f('0x30')][_0xdd7f('0x38')]);_0x37a4ce['where']=qs['filters'](_[_0xdd7f('0x4b')](_0x37d865[_0xdd7f('0x30')],_0x202189['filters']));if(_0x37d865['query']['filter']){_0x37a4ce[_0xdd7f('0x3b')]=_['merge'](_0x37a4ce['where'],{'$or':_[_0xdd7f('0x2f')](_0x37a4ce['attributes'],function(_0x49523c){var _0x2f2115={};_0x2f2115[_0x49523c]={'$like':'%'+_0x37d865['query'][_0xdd7f('0x39')]+'%'};return _0x2f2115;})});}_0x37a4ce=_[_0xdd7f('0x3a')]({},_0x37a4ce,_0x37d865[_0xdd7f('0x4e')]);return _0x192bf[_0xdd7f('0x4d')](_0x37a4ce);}})['then'](function(_0x52f287){if(_0x52f287){_0x8e110b=_0x52f287[_0xdd7f('0x43')];if(!_0x37d865[_0xdd7f('0x30')][_0xdd7f('0x36')](_0xdd7f('0x4c'))){_0x37a4ce[_0xdd7f('0x1e')]=qs[_0xdd7f('0x1e')](_0x37d865[_0xdd7f('0x30')][_0xdd7f('0x1e')]);_0x37a4ce[_0xdd7f('0x1d')]=qs[_0xdd7f('0x1d')](_0x37d865[_0xdd7f('0x30')]['offset']);}return _0x192bf[_0xdd7f('0x4d')](_0x37a4ce);}})['then'](function(_0x21a44c){if(_0x21a44c){return _0x21a44c?{'count':_0x8e110b,'rows':_0x21a44c}:null;}})[_0xdd7f('0x23')](respondWithResult(_0x11abba,null))[_0xdd7f('0x40')](handleError(_0x11abba,null));};exports['getDescriptions']=function(_0x5c9169,_0x33dc10,_0x282be7){var _0xa422c2={};var _0x1de347={};var _0x489e3c;var _0x36a1f3;return db[_0xdd7f('0x29')][_0xdd7f('0x49')]({'where':{'id':_0x5c9169[_0xdd7f('0x42')]['id']}})['then'](handleEntityNotFound(_0x33dc10,null))[_0xdd7f('0x23')](function(_0x128c20){if(_0x128c20){_0x489e3c=_0x128c20;_0x1de347[_0xdd7f('0x2e')]=_[_0xdd7f('0x31')](db['DeskField'][_0xdd7f('0x2a')]);_0x1de347[_0xdd7f('0x30')]=_[_0xdd7f('0x31')](_0x5c9169['query']);_0x1de347[_0xdd7f('0x32')]=_['intersection'](_0x1de347['model'],_0x1de347['query']);_0xa422c2[_0xdd7f('0x33')]=_[_0xdd7f('0x34')](_0x1de347[_0xdd7f('0x2e')],qs[_0xdd7f('0x35')](_0x5c9169[_0xdd7f('0x30')]['fields']));_0xa422c2[_0xdd7f('0x33')]=_0xa422c2['attributes'][_0xdd7f('0x43')]?_0xa422c2[_0xdd7f('0x33')]:_0x1de347['model'];_0xa422c2['order']=qs[_0xdd7f('0x38')](_0x5c9169[_0xdd7f('0x30')]['sort']);_0xa422c2[_0xdd7f('0x3b')]=qs[_0xdd7f('0x32')](_[_0xdd7f('0x4b')](_0x5c9169[_0xdd7f('0x30')],_0x1de347[_0xdd7f('0x32')]));if(_0x5c9169['query'][_0xdd7f('0x39')]){_0xa422c2[_0xdd7f('0x3b')]=_['merge'](_0xa422c2[_0xdd7f('0x3b')],{'$or':_[_0xdd7f('0x2f')](_0xa422c2[_0xdd7f('0x33')],function(_0x88f735){var _0x2b46f2={};_0x2b46f2[_0x88f735]={'$like':'%'+_0x5c9169['query'][_0xdd7f('0x39')]+'%'};return _0x2b46f2;})});}_0xa422c2=_[_0xdd7f('0x3a')]({},_0xa422c2,_0x5c9169[_0xdd7f('0x4e')]);return _0x489e3c[_0xdd7f('0x4f')](_0xa422c2);}})[_0xdd7f('0x23')](function(_0x59289e){if(_0x59289e){_0x36a1f3=_0x59289e[_0xdd7f('0x43')];if(!_0x5c9169['query']['hasOwnProperty'](_0xdd7f('0x4c'))){_0xa422c2[_0xdd7f('0x1e')]=qs[_0xdd7f('0x1e')](_0x5c9169[_0xdd7f('0x30')][_0xdd7f('0x1e')]);_0xa422c2[_0xdd7f('0x1d')]=qs[_0xdd7f('0x1d')](_0x5c9169[_0xdd7f('0x30')][_0xdd7f('0x1d')]);}return _0x489e3c['getDescriptions'](_0xa422c2);}})[_0xdd7f('0x23')](function(_0x31d03b){if(_0x31d03b){return _0x31d03b?{'count':_0x36a1f3,'rows':_0x31d03b}:null;}})['then'](respondWithResult(_0x33dc10,null))['catch'](handleError(_0x33dc10,null));};exports[_0xdd7f('0x50')]=function(_0x51c054,_0x2e2dc3,_0x729bad){var _0x53f97b={};var _0x2c3881={};var _0x223507;var _0xa01fd8;return db[_0xdd7f('0x29')]['findOne']({'where':{'id':_0x51c054['params']['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x2e2dc3,null))[_0xdd7f('0x23')](function(_0xd2dfa9){if(_0xd2dfa9){_0x223507=_0xd2dfa9;_0x2c3881[_0xdd7f('0x2e')]=_[_0xdd7f('0x31')](db[_0xdd7f('0x51')]['rawAttributes']);_0x2c3881[_0xdd7f('0x30')]=_['keys'](_0x51c054[_0xdd7f('0x30')]);_0x2c3881[_0xdd7f('0x32')]=_[_0xdd7f('0x34')](_0x2c3881[_0xdd7f('0x2e')],_0x2c3881[_0xdd7f('0x30')]);_0x53f97b[_0xdd7f('0x33')]=_[_0xdd7f('0x34')](_0x2c3881[_0xdd7f('0x2e')],qs['fields'](_0x51c054[_0xdd7f('0x30')][_0xdd7f('0x35')]));_0x53f97b[_0xdd7f('0x33')]=_0x53f97b[_0xdd7f('0x33')][_0xdd7f('0x43')]?_0x53f97b[_0xdd7f('0x33')]:_0x2c3881[_0xdd7f('0x2e')];_0x53f97b[_0xdd7f('0x37')]=qs['sort'](_0x51c054[_0xdd7f('0x30')]['sort']);_0x53f97b[_0xdd7f('0x3b')]=qs[_0xdd7f('0x32')](_[_0xdd7f('0x4b')](_0x51c054[_0xdd7f('0x30')],_0x2c3881['filters']));if(_0x51c054[_0xdd7f('0x30')][_0xdd7f('0x39')]){_0x53f97b['where']=_['merge'](_0x53f97b[_0xdd7f('0x3b')],{'$or':_[_0xdd7f('0x2f')](_0x53f97b[_0xdd7f('0x33')],function(_0x2d5db0){var _0x58d73d={};_0x58d73d[_0x2d5db0]={'$like':'%'+_0x51c054[_0xdd7f('0x30')]['filter']+'%'};return _0x58d73d;})});}_0x53f97b=_[_0xdd7f('0x3a')]({},_0x53f97b,_0x51c054['options']);return _0x223507['getTags'](_0x53f97b);}})[_0xdd7f('0x23')](function(_0x288519){if(_0x288519){_0xa01fd8=_0x288519[_0xdd7f('0x43')];if(!_0x51c054[_0xdd7f('0x30')][_0xdd7f('0x36')](_0xdd7f('0x4c'))){_0x53f97b[_0xdd7f('0x1e')]=qs[_0xdd7f('0x1e')](_0x51c054['query'][_0xdd7f('0x1e')]);_0x53f97b['offset']=qs[_0xdd7f('0x1d')](_0x51c054[_0xdd7f('0x30')]['offset']);}return _0x223507[_0xdd7f('0x50')](_0x53f97b);}})[_0xdd7f('0x23')](function(_0x3a36af){if(_0x3a36af){return _0x3a36af?{'count':_0xa01fd8,'rows':_0x3a36af}:null;}})[_0xdd7f('0x23')](respondWithResult(_0x2e2dc3,null))[_0xdd7f('0x40')](handleError(_0x2e2dc3,null));};exports['setTags']=function(_0x2f571c,_0x173096,_0x25d60c){if(_0x2f571c[_0xdd7f('0x46')]['id']){delete _0x2f571c[_0xdd7f('0x46')]['id'];}return db[_0xdd7f('0x29')][_0xdd7f('0x49')]({'where':{'id':_0x2f571c[_0xdd7f('0x42')]['id']}})[_0xdd7f('0x23')](handleEntityNotFound(_0x173096,null))[_0xdd7f('0x23')](function(_0x6c500){if(_0x6c500){return _0x6c500[_0xdd7f('0x52')](_0x2f571c[_0xdd7f('0x46')][_0xdd7f('0x53')]||[]);}return null;})[_0xdd7f('0x23')](respondWithResult(_0x173096,null))[_0xdd7f('0x40')](handleError(_0x173096,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b0e1885..684bcb8 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 _0xda5b=['define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xda5b,0x163));var _0xbda5=function(_0x486b88,_0x10faca){_0x486b88=_0x486b88-0x0;var _0x20dee9=_0xda5b[_0x486b88];return _0x20dee9;};'use strict';var _=require(_0xbda5('0x0'));var util=require('util');var logger=require(_0xbda5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbda5('0x2'));var rp=require(_0xbda5('0x3'));var fs=require('fs');var path=require(_0xbda5('0x4'));var rimraf=require(_0xbda5('0x5'));var config=require(_0xbda5('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xbda5('0x7')]=function(_0x31cb6e,_0x5d1bb9){return _0x31cb6e[_0xbda5('0x8')](_0xbda5('0x9'),attributes,{'tableName':_0xbda5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc64=['moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','util','../../config/logger','api'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xdc64,0x1ab));var _0x4dc6=function(_0x414b44,_0x2362e5){_0x414b44=_0x414b44-0x0;var _0x51e2a2=_0xdc64[_0x414b44];return _0x51e2a2;};'use strict';var _=require('lodash');var util=require(_0x4dc6('0x0'));var logger=require(_0x4dc6('0x1'))(_0x4dc6('0x2'));var moment=require(_0x4dc6('0x3'));var BPromise=require(_0x4dc6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dc6('0x5'));var rimraf=require(_0x4dc6('0x6'));var config=require(_0x4dc6('0x7'));var attributes=require(_0x4dc6('0x8'));module['exports']=function(_0x5c43dc,_0x48d4f0){return _0x5c43dc['define'](_0x4dc6('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 7978fec..f840e73 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 _0xa9c7=['error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x442f44,_0x2d9d80){var _0x272d7a=function(_0x26f23c){while(--_0x26f23c){_0x442f44['push'](_0x442f44['shift']());}};_0x272d7a(++_0x2d9d80);}(_0xa9c7,0x148));var _0x7a9c=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0xa9c7[_0x2f6233];return _0x1c9c36;};'use strict';var _=require(_0x7a9c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a9c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a9c('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7a9c('0x4'));var client=jayson[_0x7a9c('0x5')][_0x7a9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x30e3f8,_0x3a0458,_0x91f4c3){return new BPromise(function(_0x337afa,_0x436bb4){return client[_0x7a9c('0x7')](_0x30e3f8,_0x91f4c3)['then'](function(_0x55a880){logger[_0x7a9c('0x8')](_0x7a9c('0x9'),_0x3a0458,'request\x20sent');logger[_0x7a9c('0xa')](_0x7a9c('0xb'),_0x3a0458,_0x7a9c('0xc'),JSON[_0x7a9c('0xd')](_0x55a880));if(_0x55a880[_0x7a9c('0xe')]){if(_0x55a880['error'][_0x7a9c('0xf')]===0x1f4){logger[_0x7a9c('0xe')](_0x7a9c('0x9'),_0x3a0458,_0x55a880[_0x7a9c('0xe')][_0x7a9c('0x10')]);return _0x436bb4(_0x55a880[_0x7a9c('0xe')][_0x7a9c('0x10')]);}logger[_0x7a9c('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x3a0458,_0x55a880[_0x7a9c('0xe')][_0x7a9c('0x10')]);return _0x337afa(_0x55a880[_0x7a9c('0xe')]['message']);}else{logger[_0x7a9c('0x8')](_0x7a9c('0x9'),_0x3a0458,_0x7a9c('0xc'));_0x337afa(_0x55a880[_0x7a9c('0x11')][_0x7a9c('0x10')]);}})[_0x7a9c('0x12')](function(_0x2e1ca4){logger[_0x7a9c('0xe')](_0x7a9c('0x9'),_0x3a0458,_0x2e1ca4);_0x436bb4(_0x2e1ca4);});});} \ No newline at end of file +var _0xd185=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x7285e3,_0x2402a7){var _0x523d9d=function(_0x318384){while(--_0x318384){_0x7285e3['push'](_0x7285e3['shift']());}};_0x523d9d(++_0x2402a7);}(_0xd185,0x92));var _0x5d18=function(_0xb73d2f,_0x1ae248){_0xb73d2f=_0xb73d2f-0x0;var _0x3d7b95=_0xd185[_0xb73d2f];return _0x3d7b95;};'use strict';var _=require(_0x5d18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5d18('0x1'));var rs=require(_0x5d18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d18('0x3'))['db'];var utils=require(_0x5d18('0x4'));var logger=require(_0x5d18('0x5'))(_0x5d18('0x6'));var config=require(_0x5d18('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30063d,_0x2f8b90,_0x1dcdd8){return new BPromise(function(_0x4660cc,_0x570e19){return client['request'](_0x30063d,_0x1dcdd8)[_0x5d18('0x9')](function(_0x57e272){logger[_0x5d18('0xa')](_0x5d18('0xb'),_0x2f8b90,_0x5d18('0xc'));logger[_0x5d18('0xd')](_0x5d18('0xe'),_0x2f8b90,_0x5d18('0xc'),JSON[_0x5d18('0xf')](_0x57e272));if(_0x57e272[_0x5d18('0x10')]){if(_0x57e272[_0x5d18('0x10')][_0x5d18('0x11')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2f8b90,_0x57e272['error'][_0x5d18('0x12')]);return _0x570e19(_0x57e272[_0x5d18('0x10')][_0x5d18('0x12')]);}logger[_0x5d18('0x10')](_0x5d18('0xb'),_0x2f8b90,_0x57e272[_0x5d18('0x10')][_0x5d18('0x12')]);return _0x4660cc(_0x57e272['error'][_0x5d18('0x12')]);}else{logger[_0x5d18('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8b90,_0x5d18('0xc'));_0x4660cc(_0x57e272[_0x5d18('0x13')][_0x5d18('0x12')]);}})['catch'](function(_0x1dde03){logger[_0x5d18('0x10')](_0x5d18('0xb'),_0x2f8b90,_0x1dde03);_0x570e19(_0x1dde03);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f1c6108..2830242 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 _0x838a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','show','create','update','exports','path'];(function(_0x3b4b5f,_0x36b6c2){var _0x5989e5=function(_0x39f372){while(--_0x39f372){_0x3b4b5f['push'](_0x3b4b5f['shift']());}};_0x5989e5(++_0x36b6c2);}(_0x838a,0x65));var _0xa838=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x838a[_0x3522c8];return _0x22f498;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa838('0x0'));var timeout=require(_0xa838('0x1'));var express=require(_0xa838('0x2'));var router=express[_0xa838('0x3')]();var fs_extra=require(_0xa838('0x4'));var auth=require(_0xa838('0x5'));var interaction=require(_0xa838('0x6'));var config=require(_0xa838('0x7'));var controller=require(_0xa838('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa838('0x9')]);router[_0xa838('0xa')](_0xa838('0xb'),auth[_0xa838('0xc')](),controller[_0xa838('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa838('0xe')]);router['put'](_0xa838('0xb'),auth[_0xa838('0xc')](),controller[_0xa838('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa838('0x10')]=router; \ No newline at end of file +var _0xc3c2=['../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0xc3c2,0x1bc));var _0x2c3c=function(_0x30dae9,_0x31f884){_0x30dae9=_0x30dae9-0x0;var _0x39e70f=_0xc3c2[_0x30dae9];return _0x39e70f;};'use strict';var multer=require(_0x2c3c('0x0'));var util=require(_0x2c3c('0x1'));var path=require('path');var timeout=require(_0x2c3c('0x2'));var express=require(_0x2c3c('0x3'));var router=express[_0x2c3c('0x4')]();var fs_extra=require(_0x2c3c('0x5'));var auth=require(_0x2c3c('0x6'));var interaction=require(_0x2c3c('0x7'));var config=require('../../config/environment');var controller=require(_0x2c3c('0x8'));router[_0x2c3c('0x9')]('/',auth[_0x2c3c('0xa')](),controller['index']);router[_0x2c3c('0x9')](_0x2c3c('0xb'),auth[_0x2c3c('0xa')](),controller[_0x2c3c('0xc')]);router['post']('/',auth[_0x2c3c('0xa')](),controller[_0x2c3c('0xd')]);router[_0x2c3c('0xe')](_0x2c3c('0xb'),auth[_0x2c3c('0xa')](),controller['update']);router[_0x2c3c('0xf')](_0x2c3c('0xb'),auth[_0x2c3c('0xa')](),controller[_0x2c3c('0x10')]);module[_0x2c3c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 559b59f..e9afebf 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 _0xa567=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x290df9,_0x5f4d05){var _0x2d7e30=function(_0x4962bb){while(--_0x4962bb){_0x290df9['push'](_0x290df9['shift']());}};_0x2d7e30(++_0x5f4d05);}(_0xa567,0x1a2));var _0x7a56=function(_0xbd4f7,_0x19a34e){_0xbd4f7=_0xbd4f7-0x0;var _0x1a8c9a=_0xa567[_0xbd4f7];return _0x1a8c9a;};'use strict';var Sequelize=require(_0x7a56('0x0'));module[_0x7a56('0x1')]={'type':{'type':Sequelize[_0x7a56('0x2')](_0x7a56('0x3'),'variable',_0x7a56('0x4'),_0x7a56('0x5'),_0x7a56('0x6')),'defaultValue':_0x7a56('0x3')},'content':{'type':Sequelize[_0x7a56('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7a56('0x2')](_0x7a56('0x3'),_0x7a56('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7a56('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7a56('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a56('0x7')]}}; \ No newline at end of file +var _0x3c49=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x47032a,_0x3750d3){var _0x5609ba=function(_0x4428ce){while(--_0x4428ce){_0x47032a['push'](_0x47032a['shift']());}};_0x5609ba(++_0x3750d3);}(_0x3c49,0x1d7));var _0x93c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3c49[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x93c4('0x0'));module['exports']={'type':{'type':Sequelize[_0x93c4('0x1')](_0x93c4('0x2'),_0x93c4('0x3'),_0x93c4('0x4'),_0x93c4('0x5'),_0x93c4('0x6')),'defaultValue':_0x93c4('0x2')},'content':{'type':Sequelize[_0x93c4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x93c4('0x1')](_0x93c4('0x2'),_0x93c4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x93c4('0x7')]},'idField':{'type':Sequelize[_0x93c4('0x7')]},'nameField':{'type':Sequelize[_0x93c4('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x93c4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7591d4b..3ac540c 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 _0x5d0a=['undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x20e6c4,_0x573880){var _0x61fc99=function(_0x1a7f9c){while(--_0x1a7f9c){_0x20e6c4['push'](_0x20e6c4['shift']());}};_0x61fc99(++_0x573880);}(_0x5d0a,0x173));var _0xa5d0=function(_0x1324bc,_0xc78289){_0x1324bc=_0x1324bc-0x0;var _0x87b07b=_0x5d0a[_0x1324bc];return _0x87b07b;};'use strict';var emlformat=require(_0xa5d0('0x0'));var rimraf=require(_0xa5d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5d0('0x2'));var BPromise=require(_0xa5d0('0x3'));var Mustache=require(_0xa5d0('0x4'));var util=require(_0xa5d0('0x5'));var path=require(_0xa5d0('0x6'));var sox=require(_0xa5d0('0x7'));var csv=require(_0xa5d0('0x8'));var ejs=require(_0xa5d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5d0('0xa'));var squel=require('squel');var crypto=require(_0xa5d0('0xb'));var jsforce=require(_0xa5d0('0xc'));var deskjs=require(_0xa5d0('0xd'));var toCsv=require(_0xa5d0('0x8'));var querystring=require(_0xa5d0('0xe'));var Papa=require(_0xa5d0('0xf'));var Redis=require(_0xa5d0('0x10'));var authService=require(_0xa5d0('0x11'));var qs=require(_0xa5d0('0x12'));var as=require(_0xa5d0('0x13'));var hardwareService=require(_0xa5d0('0x14'));var logger=require(_0xa5d0('0x15'))(_0xa5d0('0x16'));var utils=require(_0xa5d0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa5d0('0x18'));var db=require(_0xa5d0('0x19'))['db'];function respondWithStatusCode(_0x24f2ba,_0x1ab066){_0x1ab066=_0x1ab066||0xcc;return function(_0x442b02){if(_0x442b02){return _0x24f2ba[_0xa5d0('0x1a')](_0x1ab066);}return _0x24f2ba[_0xa5d0('0x1b')](_0x1ab066)[_0xa5d0('0x1c')]();};}function respondWithResult(_0x5f0754,_0x3294f0){_0x3294f0=_0x3294f0||0xc8;return function(_0x22dd81){if(_0x22dd81){return _0x5f0754[_0xa5d0('0x1b')](_0x3294f0)['json'](_0x22dd81);}};}function respondWithFilteredResult(_0x30d40f,_0x2749fc){return function(_0x21414f){if(_0x21414f){var _0x1d169f=typeof _0x2749fc['offset']===_0xa5d0('0x1d')&&typeof _0x2749fc[_0xa5d0('0x1e')]===_0xa5d0('0x1d');var _0x4a6037=_0x21414f[_0xa5d0('0x1f')];var _0x30faee=_0x1d169f?0x0:_0x2749fc['offset'];var _0x182617=_0x1d169f?_0x21414f['count']:_0x2749fc[_0xa5d0('0x20')]+_0x2749fc[_0xa5d0('0x1e')];var _0x2a5d18;if(_0x182617>=_0x4a6037){_0x182617=_0x4a6037;_0x2a5d18=0xc8;}else{_0x2a5d18=0xce;}_0x30d40f[_0xa5d0('0x1b')](_0x2a5d18);return _0x30d40f[_0xa5d0('0x21')](_0xa5d0('0x22'),_0x30faee+'-'+_0x182617+'/'+_0x4a6037)[_0xa5d0('0x23')](_0x21414f);}return null;};}function patchUpdates(_0x5d367d){return function(_0x300786){try{jsonpatch[_0xa5d0('0x24')](_0x300786,_0x5d367d,!![]);}catch(_0x26e4df){return BPromise[_0xa5d0('0x25')](_0x26e4df);}return _0x300786[_0xa5d0('0x26')]();};}function saveUpdates(_0x17e1a2,_0x5ecc3b){return function(_0x3fa0e8){if(_0x3fa0e8){return _0x3fa0e8[_0xa5d0('0x27')](_0x17e1a2)[_0xa5d0('0x28')](function(_0x583794){return _0x583794;});}return null;};}function removeEntity(_0x16be23,_0x15327d){return function(_0x599c4c){if(_0x599c4c){return _0x599c4c[_0xa5d0('0x29')]()[_0xa5d0('0x28')](function(){_0x16be23[_0xa5d0('0x1b')](0xcc)[_0xa5d0('0x1c')]();});}};}function handleEntityNotFound(_0x21eaa9,_0x379418){return function(_0x38d76f){if(!_0x38d76f){_0x21eaa9[_0xa5d0('0x1a')](0x194);}return _0x38d76f;};}function handleError(_0x315c98,_0xbc1916){_0xbc1916=_0xbc1916||0x1f4;return function(_0x126aab){logger[_0xa5d0('0x2a')](_0x126aab[_0xa5d0('0x2b')]);if(_0x126aab[_0xa5d0('0x2c')]){delete _0x126aab[_0xa5d0('0x2c')];}_0x315c98['status'](_0xbc1916)[_0xa5d0('0x2d')](_0x126aab);};}exports[_0xa5d0('0x2e')]=function(_0xae9381,_0x4a4ea4){var _0x54557b={},_0x2115e5={},_0x3186e1={'count':0x0,'rows':[]};var _0x1aaaaa=_[_0xa5d0('0x2f')](db[_0xa5d0('0x30')][_0xa5d0('0x31')],function(_0x19f977){return{'name':_0x19f977[_0xa5d0('0x32')],'type':_0x19f977[_0xa5d0('0x33')][_0xa5d0('0x34')]};});_0x2115e5[_0xa5d0('0x35')]=_[_0xa5d0('0x2f')](_0x1aaaaa,_0xa5d0('0x2c'));_0x2115e5['query']=_['keys'](_0xae9381['query']);_0x2115e5[_0xa5d0('0x36')]=_[_0xa5d0('0x37')](_0x2115e5[_0xa5d0('0x35')],_0x2115e5[_0xa5d0('0x38')]);_0x54557b['attributes']=_['intersection'](_0x2115e5[_0xa5d0('0x35')],qs[_0xa5d0('0x39')](_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x39')]));_0x54557b[_0xa5d0('0x3a')]=_0x54557b[_0xa5d0('0x3a')][_0xa5d0('0x3b')]?_0x54557b[_0xa5d0('0x3a')]:_0x2115e5['model'];if(!_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x3c')](_0xa5d0('0x3d'))){_0x54557b[_0xa5d0('0x1e')]=qs['limit'](_0xae9381[_0xa5d0('0x38')]['limit']);_0x54557b[_0xa5d0('0x20')]=qs['offset'](_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x20')]);}_0x54557b['order']=qs[_0xa5d0('0x3e')](_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x3e')]);_0x54557b[_0xa5d0('0x3f')]=qs[_0xa5d0('0x36')](_[_0xa5d0('0x40')](_0xae9381['query'],_0x2115e5['filters']),_0x1aaaaa);if(_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x41')]){_0x54557b[_0xa5d0('0x3f')]=_[_0xa5d0('0x42')](_0x54557b[_0xa5d0('0x3f')],{'$or':_[_0xa5d0('0x2f')](_0x1aaaaa,function(_0x38ae87){if(_0x38ae87[_0xa5d0('0x33')]!==_0xa5d0('0x43')){var _0x15e1b5={};_0x15e1b5[_0x38ae87['name']]={'$like':'%'+_0xae9381[_0xa5d0('0x38')]['filter']+'%'};return _0x15e1b5;}})});}_0x54557b=_[_0xa5d0('0x42')]({},_0x54557b,_0xae9381[_0xa5d0('0x44')]);var _0x7d5ef={'where':_0x54557b[_0xa5d0('0x3f')]};return db['DeskField']['count'](_0x7d5ef)[_0xa5d0('0x28')](function(_0x5d0b53){_0x3186e1[_0xa5d0('0x1f')]=_0x5d0b53;if(_0xae9381[_0xa5d0('0x38')][_0xa5d0('0x45')]){_0x54557b[_0xa5d0('0x46')]=[{'all':!![]}];}return db[_0xa5d0('0x30')][_0xa5d0('0x47')](_0x54557b);})[_0xa5d0('0x28')](function(_0x2fbbd6){_0x3186e1[_0xa5d0('0x48')]=_0x2fbbd6;return _0x3186e1;})[_0xa5d0('0x28')](respondWithFilteredResult(_0x4a4ea4,_0x54557b))[_0xa5d0('0x49')](handleError(_0x4a4ea4,null));};exports[_0xa5d0('0x4a')]=function(_0x57edf9,_0x5e7770){var _0x378df1={'raw':!![],'where':{'id':_0x57edf9[_0xa5d0('0x4b')]['id']}},_0x8f9893={};_0x8f9893[_0xa5d0('0x35')]=_[_0xa5d0('0x4c')](db[_0xa5d0('0x30')][_0xa5d0('0x31')]);_0x8f9893[_0xa5d0('0x38')]=_['keys'](_0x57edf9['query']);_0x8f9893['filters']=_[_0xa5d0('0x37')](_0x8f9893[_0xa5d0('0x35')],_0x8f9893[_0xa5d0('0x38')]);_0x378df1[_0xa5d0('0x3a')]=_[_0xa5d0('0x37')](_0x8f9893[_0xa5d0('0x35')],qs[_0xa5d0('0x39')](_0x57edf9[_0xa5d0('0x38')]['fields']));_0x378df1[_0xa5d0('0x3a')]=_0x378df1[_0xa5d0('0x3a')][_0xa5d0('0x3b')]?_0x378df1[_0xa5d0('0x3a')]:_0x8f9893['model'];if(_0x57edf9['query']['includeAll']){_0x378df1[_0xa5d0('0x46')]=[{'all':!![]}];}_0x378df1=_[_0xa5d0('0x42')]({},_0x378df1,_0x57edf9[_0xa5d0('0x44')]);return db[_0xa5d0('0x30')][_0xa5d0('0x4d')](_0x378df1)[_0xa5d0('0x28')](handleEntityNotFound(_0x5e7770,null))[_0xa5d0('0x28')](respondWithResult(_0x5e7770,null))[_0xa5d0('0x49')](handleError(_0x5e7770,null));};exports['create']=function(_0x508be3,_0x19fc47){return db[_0xa5d0('0x30')][_0xa5d0('0x4e')](_0x508be3['body'],{})[_0xa5d0('0x28')](respondWithResult(_0x19fc47,0xc9))[_0xa5d0('0x49')](handleError(_0x19fc47,null));};exports[_0xa5d0('0x27')]=function(_0x1ee629,_0x3c2bf2){if(_0x1ee629[_0xa5d0('0x4f')]['id']){delete _0x1ee629[_0xa5d0('0x4f')]['id'];}return db['DeskField']['find']({'where':{'id':_0x1ee629['params']['id']}})[_0xa5d0('0x28')](handleEntityNotFound(_0x3c2bf2,null))[_0xa5d0('0x28')](saveUpdates(_0x1ee629[_0xa5d0('0x4f')],null))[_0xa5d0('0x28')](respondWithResult(_0x3c2bf2,null))[_0xa5d0('0x49')](handleError(_0x3c2bf2,null));};exports[_0xa5d0('0x29')]=function(_0x1ca3c5,_0x3218ea){return db[_0xa5d0('0x30')]['find']({'where':{'id':_0x1ca3c5[_0xa5d0('0x4b')]['id']}})[_0xa5d0('0x28')](handleEntityNotFound(_0x3218ea,null))[_0xa5d0('0x28')](removeEntity(_0x3218ea,null))['catch'](handleError(_0x3218ea,null));}; \ No newline at end of file +var _0x8784=['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','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x8784,0x172));var _0x4878=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x8784[_0x5180c3];return _0x55c975;};'use strict';var emlformat=require(_0x4878('0x0'));var rimraf=require(_0x4878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4878('0x2'));var rp=require(_0x4878('0x3'));var moment=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var Mustache=require(_0x4878('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4878('0x7'));var csv=require(_0x4878('0x8'));var ejs=require(_0x4878('0x9'));var fs=require('fs');var fs_extra=require(_0x4878('0xa'));var _=require(_0x4878('0xb'));var squel=require(_0x4878('0xc'));var crypto=require(_0x4878('0xd'));var jsforce=require(_0x4878('0xe'));var deskjs=require(_0x4878('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4878('0x10'));var Papa=require(_0x4878('0x11'));var Redis=require(_0x4878('0x12'));var authService=require(_0x4878('0x13'));var qs=require(_0x4878('0x14'));var as=require(_0x4878('0x15'));var hardwareService=require(_0x4878('0x16'));var logger=require(_0x4878('0x17'))(_0x4878('0x18'));var utils=require(_0x4878('0x19'));var config=require(_0x4878('0x1a'));var licenseUtil=require(_0x4878('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa3b6c,_0x462485){_0x462485=_0x462485||0xcc;return function(_0x188e81){if(_0x188e81){return _0xa3b6c['sendStatus'](_0x462485);}return _0xa3b6c[_0x4878('0x1c')](_0x462485)[_0x4878('0x1d')]();};}function respondWithResult(_0x4f6486,_0x32c5ea){_0x32c5ea=_0x32c5ea||0xc8;return function(_0x5e67cc){if(_0x5e67cc){return _0x4f6486['status'](_0x32c5ea)[_0x4878('0x1e')](_0x5e67cc);}};}function respondWithFilteredResult(_0x41fefd,_0x2b7ccc){return function(_0x297b43){if(_0x297b43){var _0x37a150=typeof _0x2b7ccc['offset']===_0x4878('0x1f')&&typeof _0x2b7ccc[_0x4878('0x20')]==='undefined';var _0x4319a8=_0x297b43['count'];var _0x2c2529=_0x37a150?0x0:_0x2b7ccc['offset'];var _0x5267ff=_0x37a150?_0x297b43[_0x4878('0x21')]:_0x2b7ccc[_0x4878('0x22')]+_0x2b7ccc[_0x4878('0x20')];var _0x3219f7;if(_0x5267ff>=_0x4319a8){_0x5267ff=_0x4319a8;_0x3219f7=0xc8;}else{_0x3219f7=0xce;}_0x41fefd[_0x4878('0x1c')](_0x3219f7);return _0x41fefd['set'](_0x4878('0x23'),_0x2c2529+'-'+_0x5267ff+'/'+_0x4319a8)[_0x4878('0x1e')](_0x297b43);}return null;};}function patchUpdates(_0x35a0e1){return function(_0x436f62){try{jsonpatch[_0x4878('0x24')](_0x436f62,_0x35a0e1,!![]);}catch(_0x3ffa0c){return BPromise['reject'](_0x3ffa0c);}return _0x436f62[_0x4878('0x25')]();};}function saveUpdates(_0x7767d1,_0x3f3f11){return function(_0x5482f5){if(_0x5482f5){return _0x5482f5[_0x4878('0x26')](_0x7767d1)[_0x4878('0x27')](function(_0x57d9b3){return _0x57d9b3;});}return null;};}function removeEntity(_0x21d4d7,_0x10e25d){return function(_0x3b2d57){if(_0x3b2d57){return _0x3b2d57['destroy']()[_0x4878('0x27')](function(){_0x21d4d7[_0x4878('0x1c')](0xcc)[_0x4878('0x1d')]();});}};}function handleEntityNotFound(_0x476ec3,_0x2938f9){return function(_0x5b1222){if(!_0x5b1222){_0x476ec3[_0x4878('0x28')](0x194);}return _0x5b1222;};}function handleError(_0x4458fb,_0x522157){_0x522157=_0x522157||0x1f4;return function(_0x48f8f){logger[_0x4878('0x29')](_0x48f8f[_0x4878('0x2a')]);if(_0x48f8f[_0x4878('0x2b')]){delete _0x48f8f[_0x4878('0x2b')];}_0x4458fb[_0x4878('0x1c')](_0x522157)[_0x4878('0x2c')](_0x48f8f);};}exports[_0x4878('0x2d')]=function(_0xcff66b,_0xe7a731){var _0x3b09f1={},_0x38400b={},_0x1a8da4={'count':0x0,'rows':[]};var _0x480631=_[_0x4878('0x2e')](db[_0x4878('0x2f')]['rawAttributes'],function(_0x4c8f6b){return{'name':_0x4c8f6b[_0x4878('0x30')],'type':_0x4c8f6b[_0x4878('0x31')][_0x4878('0x32')]};});_0x38400b[_0x4878('0x33')]=_[_0x4878('0x2e')](_0x480631,_0x4878('0x2b'));_0x38400b[_0x4878('0x34')]=_['keys'](_0xcff66b[_0x4878('0x34')]);_0x38400b[_0x4878('0x35')]=_[_0x4878('0x36')](_0x38400b[_0x4878('0x33')],_0x38400b[_0x4878('0x34')]);_0x3b09f1['attributes']=_['intersection'](_0x38400b['model'],qs[_0x4878('0x37')](_0xcff66b[_0x4878('0x34')][_0x4878('0x37')]));_0x3b09f1['attributes']=_0x3b09f1[_0x4878('0x38')][_0x4878('0x39')]?_0x3b09f1['attributes']:_0x38400b[_0x4878('0x33')];if(!_0xcff66b['query'][_0x4878('0x3a')]('nolimit')){_0x3b09f1['limit']=qs[_0x4878('0x20')](_0xcff66b['query'][_0x4878('0x20')]);_0x3b09f1[_0x4878('0x22')]=qs['offset'](_0xcff66b[_0x4878('0x34')][_0x4878('0x22')]);}_0x3b09f1['order']=qs[_0x4878('0x3b')](_0xcff66b[_0x4878('0x34')]['sort']);_0x3b09f1[_0x4878('0x3c')]=qs['filters'](_[_0x4878('0x3d')](_0xcff66b[_0x4878('0x34')],_0x38400b[_0x4878('0x35')]),_0x480631);if(_0xcff66b[_0x4878('0x34')]['filter']){_0x3b09f1[_0x4878('0x3c')]=_[_0x4878('0x3e')](_0x3b09f1[_0x4878('0x3c')],{'$or':_[_0x4878('0x2e')](_0x480631,function(_0x5e1709){if(_0x5e1709[_0x4878('0x31')]!=='VIRTUAL'){var _0x1b4380={};_0x1b4380[_0x5e1709[_0x4878('0x2b')]]={'$like':'%'+_0xcff66b['query'][_0x4878('0x3f')]+'%'};return _0x1b4380;}})});}_0x3b09f1=_[_0x4878('0x3e')]({},_0x3b09f1,_0xcff66b[_0x4878('0x40')]);var _0x2a12d3={'where':_0x3b09f1[_0x4878('0x3c')]};return db[_0x4878('0x2f')][_0x4878('0x21')](_0x2a12d3)[_0x4878('0x27')](function(_0x12c15f){_0x1a8da4['count']=_0x12c15f;if(_0xcff66b[_0x4878('0x34')][_0x4878('0x41')]){_0x3b09f1[_0x4878('0x42')]=[{'all':!![]}];}return db[_0x4878('0x2f')][_0x4878('0x43')](_0x3b09f1);})[_0x4878('0x27')](function(_0x286b9f){_0x1a8da4['rows']=_0x286b9f;return _0x1a8da4;})[_0x4878('0x27')](respondWithFilteredResult(_0xe7a731,_0x3b09f1))[_0x4878('0x44')](handleError(_0xe7a731,null));};exports[_0x4878('0x45')]=function(_0x24bda7,_0x1af9fd){var _0xed6918={'raw':!![],'where':{'id':_0x24bda7[_0x4878('0x46')]['id']}},_0x12e555={};_0x12e555[_0x4878('0x33')]=_['keys'](db[_0x4878('0x2f')][_0x4878('0x47')]);_0x12e555['query']=_[_0x4878('0x48')](_0x24bda7[_0x4878('0x34')]);_0x12e555['filters']=_['intersection'](_0x12e555[_0x4878('0x33')],_0x12e555['query']);_0xed6918[_0x4878('0x38')]=_['intersection'](_0x12e555[_0x4878('0x33')],qs[_0x4878('0x37')](_0x24bda7[_0x4878('0x34')][_0x4878('0x37')]));_0xed6918[_0x4878('0x38')]=_0xed6918[_0x4878('0x38')]['length']?_0xed6918['attributes']:_0x12e555[_0x4878('0x33')];if(_0x24bda7[_0x4878('0x34')][_0x4878('0x41')]){_0xed6918[_0x4878('0x42')]=[{'all':!![]}];}_0xed6918=_[_0x4878('0x3e')]({},_0xed6918,_0x24bda7['options']);return db['DeskField'][_0x4878('0x49')](_0xed6918)[_0x4878('0x27')](handleEntityNotFound(_0x1af9fd,null))['then'](respondWithResult(_0x1af9fd,null))['catch'](handleError(_0x1af9fd,null));};exports[_0x4878('0x4a')]=function(_0x3c044b,_0xe69885){return db[_0x4878('0x2f')]['create'](_0x3c044b[_0x4878('0x4b')],{})[_0x4878('0x27')](respondWithResult(_0xe69885,0xc9))[_0x4878('0x44')](handleError(_0xe69885,null));};exports[_0x4878('0x26')]=function(_0x4f1e52,_0x4bf7de){if(_0x4f1e52[_0x4878('0x4b')]['id']){delete _0x4f1e52['body']['id'];}return db[_0x4878('0x2f')][_0x4878('0x49')]({'where':{'id':_0x4f1e52[_0x4878('0x46')]['id']}})[_0x4878('0x27')](handleEntityNotFound(_0x4bf7de,null))[_0x4878('0x27')](saveUpdates(_0x4f1e52[_0x4878('0x4b')],null))[_0x4878('0x27')](respondWithResult(_0x4bf7de,null))[_0x4878('0x44')](handleError(_0x4bf7de,null));};exports[_0x4878('0x4c')]=function(_0x3ed0df,_0xcf2e36){return db[_0x4878('0x2f')]['find']({'where':{'id':_0x3ed0df[_0x4878('0x46')]['id']}})['then'](handleEntityNotFound(_0xcf2e36,null))['then'](removeEntity(_0xcf2e36,null))[_0x4878('0x44')](handleError(_0xcf2e36,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b9fda7c..9dd8d4c 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 _0x5e2f=['rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x49bf06,_0x33ecd4){var _0x2bf334=function(_0x27d40b){while(--_0x27d40b){_0x49bf06['push'](_0x49bf06['shift']());}};_0x2bf334(++_0x33ecd4);}(_0x5e2f,0x90));var _0xf5e2=function(_0x32c0b2,_0x4a6baa){_0x32c0b2=_0x32c0b2-0x0;var _0x967d13=_0x5e2f[_0x32c0b2];return _0x967d13;};'use strict';var _=require(_0xf5e2('0x0'));var util=require(_0xf5e2('0x1'));var logger=require(_0xf5e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf5e2('0x3'));var rp=require(_0xf5e2('0x4'));var fs=require('fs');var path=require(_0xf5e2('0x5'));var rimraf=require(_0xf5e2('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5e2('0x7'));module[_0xf5e2('0x8')]=function(_0x85a1e2,_0x170b1b){return _0x85a1e2[_0xf5e2('0x9')](_0xf5e2('0xa'),attributes,{'tableName':_0xf5e2('0xb'),'paranoid':![],'indexes':[{'name':_0xf5e2('0xc'),'fields':[_0xf5e2('0xd'),_0xf5e2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6089=['rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','idField','lodash','util','api','moment','bluebird','path'];(function(_0x479691,_0x1002be){var _0x32a5c1=function(_0x2753f4){while(--_0x2753f4){_0x479691['push'](_0x479691['shift']());}};_0x32a5c1(++_0x1002be);}(_0x6089,0x132));var _0x9608=function(_0x443a31,_0x2b0ab2){_0x443a31=_0x443a31-0x0;var _0x183477=_0x6089[_0x443a31];return _0x183477;};'use strict';var _=require(_0x9608('0x0'));var util=require(_0x9608('0x1'));var logger=require('../../config/logger')(_0x9608('0x2'));var moment=require(_0x9608('0x3'));var BPromise=require(_0x9608('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9608('0x5'));var rimraf=require(_0x9608('0x6'));var config=require(_0x9608('0x7'));var attributes=require('./intDeskField.attributes');module[_0x9608('0x8')]=function(_0x5415a7,_0x4f51b2){return _0x5415a7[_0x9608('0x9')](_0x9608('0xa'),attributes,{'tableName':_0x9608('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x9608('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 f1b1ea5..98fdefe 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 _0x6ea4=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','DeskField,\x20%s,\x20%s'];(function(_0x4e9691,_0x5d65fd){var _0x2bdb4a=function(_0x3a40f6){while(--_0x3a40f6){_0x4e9691['push'](_0x4e9691['shift']());}};_0x2bdb4a(++_0x5d65fd);}(_0x6ea4,0x117));var _0x46ea=function(_0x4bc2d7,_0x9f0153){_0x4bc2d7=_0x4bc2d7-0x0;var _0x4548dc=_0x6ea4[_0x4bc2d7];return _0x4548dc;};'use strict';var _=require(_0x46ea('0x0'));var util=require(_0x46ea('0x1'));var moment=require(_0x46ea('0x2'));var BPromise=require(_0x46ea('0x3'));var rs=require(_0x46ea('0x4'));var fs=require('fs');var Redis=require(_0x46ea('0x5'));var db=require(_0x46ea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x46ea('0x7'))(_0x46ea('0x8'));var config=require(_0x46ea('0x9'));var jayson=require(_0x46ea('0xa'));var client=jayson[_0x46ea('0xb')][_0x46ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dbe10,_0x3548ef,_0xcc401b){return new BPromise(function(_0x5394c3,_0x3e9a71){return client['request'](_0x2dbe10,_0xcc401b)[_0x46ea('0xd')](function(_0x4e2be2){logger[_0x46ea('0xe')]('DeskField,\x20%s,\x20%s',_0x3548ef,_0x46ea('0xf'));logger[_0x46ea('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3548ef,_0x46ea('0xf'),JSON[_0x46ea('0x11')](_0x4e2be2));if(_0x4e2be2[_0x46ea('0x12')]){if(_0x4e2be2[_0x46ea('0x12')]['code']===0x1f4){logger['error'](_0x46ea('0x13'),_0x3548ef,_0x4e2be2['error'][_0x46ea('0x14')]);return _0x3e9a71(_0x4e2be2[_0x46ea('0x12')]['message']);}logger['error'](_0x46ea('0x13'),_0x3548ef,_0x4e2be2[_0x46ea('0x12')]['message']);return _0x5394c3(_0x4e2be2[_0x46ea('0x12')][_0x46ea('0x14')]);}else{logger[_0x46ea('0xe')](_0x46ea('0x13'),_0x3548ef,'request\x20sent');_0x5394c3(_0x4e2be2[_0x46ea('0x15')]['message']);}})[_0x46ea('0x16')](function(_0xaf067f){logger[_0x46ea('0x12')]('DeskField,\x20%s,\x20%s',_0x3548ef,_0xaf067f);_0x3e9a71(_0xaf067f);});});} \ No newline at end of file +var _0x6e89=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0x6e89,0x95));var _0x96e8=function(_0x4086c4,_0x3258fc){_0x4086c4=_0x4086c4-0x0;var _0x4f68d1=_0x6e89[_0x4086c4];return _0x4f68d1;};'use strict';var _=require(_0x96e8('0x0'));var util=require(_0x96e8('0x1'));var moment=require(_0x96e8('0x2'));var BPromise=require(_0x96e8('0x3'));var rs=require(_0x96e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96e8('0x5'))['db'];var utils=require(_0x96e8('0x6'));var logger=require(_0x96e8('0x7'))('rpc');var config=require(_0x96e8('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14ed2b,_0x2b39c4,_0x3d76bc){return new BPromise(function(_0x40f215,_0x3a03c7){return client[_0x96e8('0x9')](_0x14ed2b,_0x3d76bc)[_0x96e8('0xa')](function(_0x9c1ead){logger[_0x96e8('0xb')]('DeskField,\x20%s,\x20%s',_0x2b39c4,'request\x20sent');logger[_0x96e8('0xc')](_0x96e8('0xd'),_0x2b39c4,'request\x20sent',JSON[_0x96e8('0xe')](_0x9c1ead));if(_0x9c1ead['error']){if(_0x9c1ead[_0x96e8('0xf')][_0x96e8('0x10')]===0x1f4){logger[_0x96e8('0xf')]('DeskField,\x20%s,\x20%s',_0x2b39c4,_0x9c1ead['error']['message']);return _0x3a03c7(_0x9c1ead[_0x96e8('0xf')][_0x96e8('0x11')]);}logger['error'](_0x96e8('0x12'),_0x2b39c4,_0x9c1ead[_0x96e8('0xf')]['message']);return _0x40f215(_0x9c1ead[_0x96e8('0xf')][_0x96e8('0x11')]);}else{logger[_0x96e8('0xb')](_0x96e8('0x12'),_0x2b39c4,_0x96e8('0x13'));_0x40f215(_0x9c1ead[_0x96e8('0x14')][_0x96e8('0x11')]);}})[_0x96e8('0x15')](function(_0x5b7f7a){logger[_0x96e8('0xf')](_0x96e8('0x12'),_0x2b39c4,_0x5b7f7a);_0x3a03c7(_0x5b7f7a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index fef53b0..8d511b7 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 _0xdaac=['getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x480a51,_0x3aecea){var _0x19673b=function(_0x28a612){while(--_0x28a612){_0x480a51['push'](_0x480a51['shift']());}};_0x19673b(++_0x3aecea);}(_0xdaac,0xc1));var _0xcdaa=function(_0x9b4cfb,_0x18e48d){_0x9b4cfb=_0x9b4cfb-0x0;var _0x3d6892=_0xdaac[_0x9b4cfb];return _0x3d6892;};'use strict';var multer=require('multer');var util=require(_0xcdaa('0x0'));var path=require('path');var timeout=require(_0xcdaa('0x1'));var express=require(_0xcdaa('0x2'));var router=express[_0xcdaa('0x3')]();var fs_extra=require(_0xcdaa('0x4'));var auth=require(_0xcdaa('0x5'));var interaction=require(_0xcdaa('0x6'));var config=require('../../config/environment');var controller=require(_0xcdaa('0x7'));router[_0xcdaa('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdaa('0x9')]);router[_0xcdaa('0x8')](_0xcdaa('0xa'),auth[_0xcdaa('0xb')](),controller[_0xcdaa('0xc')]);router[_0xcdaa('0x8')](_0xcdaa('0xd'),auth['isAuthenticated'](),controller[_0xcdaa('0xe')]);router[_0xcdaa('0x8')](_0xcdaa('0xf'),auth[_0xcdaa('0xb')](),controller['getFields']);router[_0xcdaa('0x10')]('/',auth[_0xcdaa('0xb')](),controller[_0xcdaa('0x11')]);router[_0xcdaa('0x10')](_0xcdaa('0xd'),auth[_0xcdaa('0xb')](),controller[_0xcdaa('0x12')]);router[_0xcdaa('0x13')](_0xcdaa('0xa'),auth[_0xcdaa('0xb')](),controller[_0xcdaa('0x14')]);router[_0xcdaa('0x15')]('/:id',auth[_0xcdaa('0xb')](),controller[_0xcdaa('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf470=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x21d1cd,_0x4c151f){var _0x2ddd9d=function(_0x3df260){while(--_0x3df260){_0x21d1cd['push'](_0x21d1cd['shift']());}};_0x2ddd9d(++_0x4c151f);}(_0xf470,0xf8));var _0x0f47=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xf470[_0x35da42];return _0x370035;};'use strict';var multer=require('multer');var util=require(_0x0f47('0x0'));var path=require(_0x0f47('0x1'));var timeout=require(_0x0f47('0x2'));var express=require('express');var router=express[_0x0f47('0x3')]();var fs_extra=require(_0x0f47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0f47('0x5'));var config=require(_0x0f47('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x0f47('0x7')]('/',auth[_0x0f47('0x8')](),controller[_0x0f47('0x9')]);router[_0x0f47('0x7')](_0x0f47('0xa'),auth['isAuthenticated'](),controller[_0x0f47('0xb')]);router[_0x0f47('0x7')](_0x0f47('0xc'),auth[_0x0f47('0x8')](),controller[_0x0f47('0xd')]);router[_0x0f47('0x7')](_0x0f47('0xe'),auth[_0x0f47('0x8')](),controller[_0x0f47('0xf')]);router[_0x0f47('0x10')]('/',auth[_0x0f47('0x8')](),controller['create']);router[_0x0f47('0x10')]('/:id/configurations',auth[_0x0f47('0x8')](),controller[_0x0f47('0x11')]);router[_0x0f47('0x12')](_0x0f47('0xa'),auth[_0x0f47('0x8')](),controller[_0x0f47('0x13')]);router[_0x0f47('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0f47('0x15')]);module[_0x0f47('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b9f35ac..2004646 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 _0x4fd7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x32821f,_0x3f8082){var _0x2520f0=function(_0x57f6f){while(--_0x57f6f){_0x32821f['push'](_0x32821f['shift']());}};_0x2520f0(++_0x3f8082);}(_0x4fd7,0xe6));var _0x74fd=function(_0x523a1f,_0x4dcc23){_0x523a1f=_0x523a1f-0x0;var _0x294bc1=_0x4fd7[_0x523a1f];return _0x294bc1;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'name':{'type':Sequelize[_0x74fd('0x2')]},'username':{'type':Sequelize[_0x74fd('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x74fd('0x2')]},'clientId':{'type':Sequelize[_0x74fd('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x74fd('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x74fd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x975f=['STRING','sequelize'];(function(_0x38a001,_0x115f98){var _0x429027=function(_0x49430e){while(--_0x49430e){_0x38a001['push'](_0x38a001['shift']());}};_0x429027(++_0x115f98);}(_0x975f,0x191));var _0xf975=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x975f[_0x329437];return _0x3789d9;};'use strict';var Sequelize=require(_0xf975('0x0'));module['exports']={'name':{'type':Sequelize[_0xf975('0x1')]},'username':{'type':Sequelize[_0xf975('0x1')]},'password':{'type':Sequelize[_0xf975('0x1')]},'remoteUri':{'type':Sequelize[_0xf975('0x1')]},'tenantId':{'type':Sequelize[_0xf975('0x1')]},'clientId':{'type':Sequelize[_0xf975('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf975('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf975('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 34461ae..282e375 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 _0x25dc=['order','getConfigurations','hasOwnProperty','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','DisplayName','TrueOption','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','undefined','count','status','update','destroy','then','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne'];(function(_0x38b337,_0x1ef7c7){var _0x1e632c=function(_0x4a76fd){while(--_0x4a76fd){_0x38b337['push'](_0x38b337['shift']());}};_0x1e632c(++_0x1ef7c7);}(_0x25dc,0x135));var _0xc25d=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x25dc[_0x367e5b];return _0x4b909e;};'use strict';var rp=require(_0xc25d('0x0'));var util=require(_0xc25d('0x1'));var _=require(_0xc25d('0x2'));var qs=require(_0xc25d('0x3'));var logger=require(_0xc25d('0x4'))(_0xc25d('0x5'));var db=require(_0xc25d('0x6'))['db'];var integrations=require(_0xc25d('0x7'));function respondWithResult(_0x41d797,_0x2cdf09){_0x2cdf09=_0x2cdf09||0xc8;return function(_0x4fe3e7){if(_0x4fe3e7){return _0x41d797['status'](_0x2cdf09)[_0xc25d('0x8')](_0x4fe3e7);}};}function respondWithFilteredResult(_0x15b425,_0x145f45){return function(_0x3e57ba){if(_0x3e57ba){var _0x4c5555=typeof _0x145f45[_0xc25d('0x9')]==='undefined'&&typeof _0x145f45[_0xc25d('0xa')]===_0xc25d('0xb');var _0x6c9339=_0x3e57ba[_0xc25d('0xc')];var _0x24a0dc=_0x4c5555?0x0:_0x145f45[_0xc25d('0x9')];var _0x278edc=_0x4c5555?_0x3e57ba['count']:_0x145f45[_0xc25d('0x9')]+_0x145f45[_0xc25d('0xa')];var _0xd0728d;if(_0x278edc>=_0x6c9339){_0x278edc=_0x6c9339;_0xd0728d=0xc8;}else{_0xd0728d=0xce;}_0x15b425[_0xc25d('0xd')](_0xd0728d);return _0x15b425['set']('Content-Range',_0x24a0dc+'-'+_0x278edc+'/'+_0x6c9339)[_0xc25d('0x8')](_0x3e57ba);}return null;};}function saveUpdates(_0x43164a){return function(_0x50b799){if(_0x50b799){return _0x50b799[_0xc25d('0xe')](_0x43164a)['then'](function(_0x3261ae){return _0x3261ae;});}return null;};}function removeEntity(_0x2077b){return function(_0x3b6325){if(_0x3b6325){return _0x3b6325[_0xc25d('0xf')]()[_0xc25d('0x10')](function(){_0x2077b['status'](0xcc)[_0xc25d('0x11')]();});}};}function handleEntityNotFound(_0x1c6700){return function(_0x554ea2){if(!_0x554ea2){_0x1c6700[_0xc25d('0x12')](0x194);}return _0x554ea2;};}function handleError(_0x4967c8,_0x514c71){_0x514c71=_0x514c71||0x1f4;return function(_0x1fc00a){logger[_0xc25d('0x13')](_0x1fc00a[_0xc25d('0x14')]);if(_0x1fc00a[_0xc25d('0x15')]){delete _0x1fc00a[_0xc25d('0x15')];}_0x4967c8[_0xc25d('0xd')](_0x514c71)['send'](_0x1fc00a);};}exports[_0xc25d('0x16')]=function(_0x17506e,_0x3defc6){var _0x177030={},_0x10ce96={},_0x27de9b={'count':0x0,'rows':[]};var _0x4cd146=_[_0xc25d('0x17')](db[_0xc25d('0x18')][_0xc25d('0x19')],function(_0x4c7869){return{'name':_0x4c7869['fieldName'],'type':_0x4c7869[_0xc25d('0x1a')][_0xc25d('0x1b')]};});_0x10ce96['model']=_[_0xc25d('0x17')](_0x4cd146,_0xc25d('0x15'));_0x10ce96[_0xc25d('0x1c')]=_[_0xc25d('0x1d')](_0x17506e[_0xc25d('0x1c')]);_0x10ce96[_0xc25d('0x1e')]=_[_0xc25d('0x1f')](_0x10ce96[_0xc25d('0x20')],_0x10ce96[_0xc25d('0x1c')]);_0x177030[_0xc25d('0x21')]=_[_0xc25d('0x1f')](_0x10ce96[_0xc25d('0x20')],qs[_0xc25d('0x22')](_0x17506e[_0xc25d('0x1c')][_0xc25d('0x22')]));_0x177030[_0xc25d('0x21')]=_0x177030[_0xc25d('0x21')][_0xc25d('0x23')]?_0x177030['attributes']:_0x10ce96[_0xc25d('0x20')];if(!_0x17506e[_0xc25d('0x1c')]['hasOwnProperty'](_0xc25d('0x24'))){_0x177030[_0xc25d('0xa')]=qs['limit'](_0x17506e['query']['limit']);_0x177030[_0xc25d('0x9')]=qs[_0xc25d('0x9')](_0x17506e[_0xc25d('0x1c')][_0xc25d('0x9')]);}_0x177030['order']=qs[_0xc25d('0x25')](_0x17506e['query']['sort']);_0x177030[_0xc25d('0x26')]=qs[_0xc25d('0x1e')](_[_0xc25d('0x27')](_0x17506e[_0xc25d('0x1c')],_0x10ce96[_0xc25d('0x1e')]),_0x4cd146);if(_0x17506e['query']['filter']){_0x177030['where']=_[_0xc25d('0x28')](_0x177030['where'],{'$or':_[_0xc25d('0x17')](_0x4cd146,function(_0x2b4c84){if(_0x2b4c84[_0xc25d('0x1a')]!==_0xc25d('0x29')){var _0x4da175={};_0x4da175[_0x2b4c84[_0xc25d('0x15')]]={'$like':'%'+_0x17506e[_0xc25d('0x1c')][_0xc25d('0x2a')]+'%'};return _0x4da175;}})});}_0x177030=_[_0xc25d('0x28')]({},_0x177030,_0x17506e[_0xc25d('0x2b')]);var _0x9a58b={'where':_0x177030[_0xc25d('0x26')]};return db['Dynamics365Account'][_0xc25d('0xc')](_0x9a58b)['then'](function(_0x5d8778){_0x27de9b[_0xc25d('0xc')]=_0x5d8778;if(_0x17506e[_0xc25d('0x1c')][_0xc25d('0x2c')]){_0x177030[_0xc25d('0x2d')]=[{'all':!![]}];}return db[_0xc25d('0x18')][_0xc25d('0x2e')](_0x177030);})[_0xc25d('0x10')](function(_0xaf7a89){_0x27de9b[_0xc25d('0x2f')]=_0xaf7a89;return _0x27de9b;})[_0xc25d('0x10')](respondWithFilteredResult(_0x3defc6,_0x177030))[_0xc25d('0x30')](handleError(_0x3defc6,null));};exports[_0xc25d('0x31')]=function(_0xe025c,_0x1182f7){var _0x464ec5={'raw':![],'where':{'id':_0xe025c[_0xc25d('0x32')]['id']}},_0x7dc15={};_0x7dc15['model']=_[_0xc25d('0x1d')](db[_0xc25d('0x18')][_0xc25d('0x19')]);_0x7dc15[_0xc25d('0x1c')]=_[_0xc25d('0x1d')](_0xe025c['query']);_0x7dc15[_0xc25d('0x1e')]=_['intersection'](_0x7dc15[_0xc25d('0x20')],_0x7dc15[_0xc25d('0x1c')]);_0x464ec5['attributes']=_[_0xc25d('0x1f')](_0x7dc15['model'],qs[_0xc25d('0x22')](_0xe025c[_0xc25d('0x1c')][_0xc25d('0x22')]));_0x464ec5[_0xc25d('0x21')]=_0x464ec5[_0xc25d('0x21')][_0xc25d('0x23')]?_0x464ec5['attributes']:_0x7dc15['model'];if(_0xe025c['query'][_0xc25d('0x2c')]){_0x464ec5[_0xc25d('0x2d')]=[{'all':!![]}];}_0x464ec5=_[_0xc25d('0x28')]({},_0x464ec5,_0xe025c[_0xc25d('0x2b')]);return db[_0xc25d('0x18')][_0xc25d('0x33')](_0x464ec5)[_0xc25d('0x10')](handleEntityNotFound(_0x1182f7,null))[_0xc25d('0x10')](respondWithResult(_0x1182f7,null))['catch'](handleError(_0x1182f7,null));};exports[_0xc25d('0x34')]=function(_0x561e47,_0x5daa76){return db[_0xc25d('0x18')][_0xc25d('0x34')](_0x561e47[_0xc25d('0x35')],{})[_0xc25d('0x10')](respondWithResult(_0x5daa76,0xc9))[_0xc25d('0x30')](handleError(_0x5daa76,null));};exports[_0xc25d('0xe')]=function(_0x5c8966,_0x571365){if(_0x5c8966[_0xc25d('0x35')]['id']){delete _0x5c8966[_0xc25d('0x35')]['id'];}return db['Dynamics365Account'][_0xc25d('0x33')]({'where':{'id':_0x5c8966['params']['id']}})['then'](handleEntityNotFound(_0x571365,null))[_0xc25d('0x10')](saveUpdates(_0x5c8966['body'],null))[_0xc25d('0x10')](respondWithResult(_0x571365,null))['catch'](handleError(_0x571365,null));};exports[_0xc25d('0xf')]=function(_0xeb3bbd,_0x509106){return db[_0xc25d('0x18')][_0xc25d('0x33')]({'where':{'id':_0xeb3bbd['params']['id']}})[_0xc25d('0x10')](handleEntityNotFound(_0x509106,null))[_0xc25d('0x10')](removeEntity(_0x509106,null))['catch'](handleError(_0x509106,null));};exports['getConfigurations']=function(_0x5d8ad4,_0x31239c){var _0x4b7e96={};var _0x387f39={};var _0x277912;var _0x4d6a71;return db[_0xc25d('0x18')][_0xc25d('0x36')]({'where':{'id':_0x5d8ad4[_0xc25d('0x32')]['id']}})[_0xc25d('0x10')](handleEntityNotFound(_0x31239c,null))['then'](function(_0x49fedc){if(_0x49fedc){_0x277912=_0x49fedc;_0x387f39['model']=_[_0xc25d('0x1d')](db['Dynamics365Configuration'][_0xc25d('0x19')]);_0x387f39['query']=_[_0xc25d('0x1d')](_0x5d8ad4[_0xc25d('0x1c')]);_0x387f39[_0xc25d('0x1e')]=_[_0xc25d('0x1f')](_0x387f39[_0xc25d('0x20')],_0x387f39['query']);_0x4b7e96[_0xc25d('0x21')]=_[_0xc25d('0x1f')](_0x387f39[_0xc25d('0x20')],qs[_0xc25d('0x22')](_0x5d8ad4[_0xc25d('0x1c')][_0xc25d('0x22')]));_0x4b7e96[_0xc25d('0x21')]=_0x4b7e96[_0xc25d('0x21')]['length']?_0x4b7e96[_0xc25d('0x21')]:_0x387f39[_0xc25d('0x20')];_0x4b7e96[_0xc25d('0x37')]=qs['sort'](_0x5d8ad4[_0xc25d('0x1c')]['sort']);_0x4b7e96[_0xc25d('0x26')]=qs[_0xc25d('0x1e')](_['pick'](_0x5d8ad4['query'],_0x387f39[_0xc25d('0x1e')]));if(_0x5d8ad4[_0xc25d('0x1c')][_0xc25d('0x2a')]){_0x4b7e96[_0xc25d('0x26')]=_[_0xc25d('0x28')](_0x4b7e96[_0xc25d('0x26')],{'$or':_['map'](_0x4b7e96['attributes'],function(_0x13956a){var _0x3c7105={};_0x3c7105[_0x13956a]={'$like':'%'+_0x5d8ad4[_0xc25d('0x1c')][_0xc25d('0x2a')]+'%'};return _0x3c7105;})});}_0x4b7e96=_[_0xc25d('0x28')]({},_0x4b7e96,_0x5d8ad4[_0xc25d('0x2b')]);return _0x277912[_0xc25d('0x38')](_0x4b7e96);}})[_0xc25d('0x10')](function(_0x3cdcdf){if(_0x3cdcdf){_0x4d6a71=_0x3cdcdf[_0xc25d('0x23')];if(!_0x5d8ad4['query'][_0xc25d('0x39')](_0xc25d('0x24'))){_0x4b7e96['limit']=qs[_0xc25d('0xa')](_0x5d8ad4[_0xc25d('0x1c')]['limit']);_0x4b7e96[_0xc25d('0x9')]=qs[_0xc25d('0x9')](_0x5d8ad4[_0xc25d('0x1c')]['offset']);}return _0x277912[_0xc25d('0x38')](_0x4b7e96);}})[_0xc25d('0x10')](function(_0x41f096){if(_0x41f096){return _0x41f096?{'count':_0x4d6a71,'rows':_0x41f096}:null;}})[_0xc25d('0x10')](respondWithResult(_0x31239c,null))[_0xc25d('0x30')](handleError(_0x31239c,null));};exports['addConfiguration']=function(_0x2c8b63,_0x4cb31a){if(_0x2c8b63[_0xc25d('0x35')]['id']){delete _0x2c8b63[_0xc25d('0x35')]['id'];}return db['Dynamics365Account'][_0xc25d('0x36')]({'where':{'id':_0x2c8b63['params']['id']}})[_0xc25d('0x10')](handleEntityNotFound(_0x4cb31a,null))[_0xc25d('0x10')](function(_0x13c124){if(_0x13c124){_0x2c8b63[_0xc25d('0x35')]['AccountId']=_0x13c124['id'];_0x2c8b63[_0xc25d('0x35')][_0xc25d('0x3a')]=integrations['getSubjects'](_0x2c8b63['body'][_0xc25d('0x3b')],_0x2c8b63['body'][_0xc25d('0x1a')]);_0x2c8b63[_0xc25d('0x35')][_0xc25d('0x3c')]=integrations[_0xc25d('0x3d')](_0x2c8b63[_0xc25d('0x35')][_0xc25d('0x3b')],_0x2c8b63['body'][_0xc25d('0x1a')]);return db[_0xc25d('0x3e')][_0xc25d('0x34')](_0x2c8b63[_0xc25d('0x35')],{'include':[{'model':db[_0xc25d('0x3f')],'as':'Subjects'},{'model':db[_0xc25d('0x3f')],'as':_0xc25d('0x3c')}]});}return null;})[_0xc25d('0x10')](respondWithResult(_0x4cb31a,null))[_0xc25d('0x30')](handleError(_0x4cb31a,null));};function sanitizeRemoteUri(_0x4526a4){var _0x32463b=_0x4526a4['slice'](-0x1);if(_0x32463b==='/')return _0x4526a4[_0xc25d('0x40')](0x0,_0x4526a4[_0xc25d('0x41')](_0x32463b));return _0x4526a4;}function getWebApiUrl(_0x11d219){return util['format'](_0xc25d('0x42'),_0x11d219);}exports['getFields']=function(_0x941521,_0x3b392c){var _0x396e12=_0x941521['query']['ticketType'];var _0xc13cc=_0x396e12===_0xc25d('0x43')?_0xc25d('0x44'):_0xc25d('0x45');var _0x2f6f3c='';var _0x34b2b4='';var _0x66509='';var _0x1cedf3='';var _0x28ade8='';var _0x139d0f='';var _0x30d12a='';var _0x1109f8='';var _0x205e96=['title',_0xc25d('0x46'),_0xc25d('0x47'),_0xc25d('0x48'),_0xc25d('0x49'),'subject',_0xc25d('0x4a'),_0xc25d('0x4b'),'directioncode',_0xc25d('0x4c')];var _0x4249d6=[_0xc25d('0x4d'),_0xc25d('0x4e'),'actualserviceunits',_0xc25d('0x4f'),_0xc25d('0x50'),_0xc25d('0x51'),_0xc25d('0x52'),_0xc25d('0x53'),_0xc25d('0x54'),_0xc25d('0x55'),_0xc25d('0x56'),'createdbyyominame','createdon',_0xc25d('0x57'),'createdonbehalfbyyominame',_0xc25d('0x58'),_0xc25d('0x59'),_0xc25d('0x5a'),'emailaddress',_0xc25d('0x5b'),_0xc25d('0x5c'),_0xc25d('0x5d'),_0xc25d('0x5e'),'exchangerate',_0xc25d('0x5f'),'followupby','importsequencenumber',_0xc25d('0x60'),_0xc25d('0x61'),'lastonholdtime',_0xc25d('0x62'),_0xc25d('0x63'),_0xc25d('0x64'),_0xc25d('0x65'),_0xc25d('0x66'),_0xc25d('0x67'),_0xc25d('0x68'),_0xc25d('0x69'),_0xc25d('0x6a'),_0xc25d('0x6b'),'numberofchildincidents',_0xc25d('0x6c'),_0xc25d('0x6d'),_0xc25d('0x6e'),_0xc25d('0x6f'),_0xc25d('0x70'),_0xc25d('0x71'),_0xc25d('0x72'),_0xc25d('0x73'),_0xc25d('0x74'),_0xc25d('0x75'),_0xc25d('0x76'),_0xc25d('0x77'),_0xc25d('0x78'),_0xc25d('0x79'),_0xc25d('0x7a'),'responsiblecontactidyominame',_0xc25d('0x7b'),_0xc25d('0x7c'),'slaname','socialprofileidname','statecode',_0xc25d('0x7d'),'subjectidname',_0xc25d('0x7e'),_0xc25d('0x7f'),_0xc25d('0x80'),_0xc25d('0x81'),_0xc25d('0x82'),'versionnumber'];var _0x197e78=_0x205e96[_0xc25d('0x83')](_0x4249d6);return db[_0xc25d('0x18')]['findOne']({'where':{'id':_0x941521[_0xc25d('0x32')]['id']},'attributes':['id','username','password',_0xc25d('0x84'),'tenantId',_0xc25d('0x85'),_0xc25d('0x86'),_0xc25d('0x87')],'include':[{'model':db[_0xc25d('0x88')],'as':_0xc25d('0x88'),'attributes':['id','data5',_0xc25d('0x89')]}]})[_0xc25d('0x10')](handleEntityNotFound(_0x3b392c,null))[_0xc25d('0x10')](function(_0x4a7680){if(_0x4a7680){if(_0x4a7680[_0xc25d('0x87')]){_0x4a7680[_0xc25d('0x8a')]=_0x4a7680[_0xc25d('0x88')][_0xc25d('0x8b')];_0x1109f8=sanitizeRemoteUri(_0x4a7680['CloudProvider']['data7']);_0x30d12a=getWebApiUrl(_0x1109f8);return _0x4a7680;}_0x1109f8=sanitizeRemoteUri(_0x4a7680[_0xc25d('0x84')]);_0x30d12a=getWebApiUrl(_0x1109f8);var _0x33aa8e={'method':_0xc25d('0x8c'),'uri':_0xc25d('0x8d')+_0x4a7680[_0xc25d('0x8e')]+_0xc25d('0x8f'),'form':{'client_id':_0x4a7680[_0xc25d('0x85')],'resource':_0x1109f8,'username':_0x4a7680[_0xc25d('0x90')],'password':_0x4a7680[_0xc25d('0x91')],'grant_type':'password','client_secret':_0x4a7680['clientSecret']},'json':!![]};return rp(_0x33aa8e);}})[_0xc25d('0x10')](function(_0x522754){_0x139d0f=_0x522754['access_token'];var _0x10c0d9={'method':_0xc25d('0x92'),'uri':encodeURI(_0x30d12a+_0xc25d('0x93')+_0xc13cc+'\x27'),'headers':{'Authorization':_0xc25d('0x94')+_0x139d0f,'If-None-Match':null,'OData-Version':_0xc25d('0x95')},'json':!![]};return rp(_0x10c0d9);})[_0xc25d('0x10')](function(_0x47e9e0){var _0x2716bd=_0x47e9e0[_0xc25d('0x96')][0x0];var _0x1998da=_0x2716bd[_0xc25d('0x97')];var _0x257d39={'method':'GET','uri':_0x30d12a+_0xc25d('0x98')+_0x1998da+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xc25d('0x94')+_0x139d0f,'If-None-Match':null,'OData-Version':_0xc25d('0x95')},'json':!![]};return rp(_0x257d39);})[_0xc25d('0x10')](function(_0x21a717){_0x2f6f3c=_0x21a717;_0x34b2b4=_0x2f6f3c[_0xc25d('0x99')];_0x34b2b4=_['remove'](_0x34b2b4,function(_0xf1637b){return!_0x197e78[_0xc25d('0x9a')](_0xf1637b[_0xc25d('0x9b')]);});var _0x40629c=[];var _0x37482b=[];_0x34b2b4[_0xc25d('0x9c')](function(_0x146b38){if(_0x146b38[_0xc25d('0x9d')]){var _0xbc5aa=_0x146b38[_0xc25d('0x9d')][_0xc25d('0x40')](_0x146b38['@odata.type'][_0xc25d('0x41')]('.')+0x1);if(_0xbc5aa===_0xc25d('0x9e')){_0x40629c['push'](getSelectList(_0x30d12a,_0x396e12,_0x37482b,_0x2f6f3c[_0xc25d('0x97')],_0x146b38['MetadataId'],_0x139d0f));}}});return Promise[_0xc25d('0x9f')](_0x40629c);})['then'](function(_0x2ce051){_0x66509=_0x2ce051[0x0];var _0x5ef6fb=[];var _0xedaea2=[];_0x34b2b4['forEach'](function(_0x3fd05a){if(!_[_0xc25d('0xa0')](_0x3fd05a['@odata.type'])){var _0x3055da=_0x3fd05a['@odata.type'][_0xc25d('0x40')](_0x3fd05a['@odata.type'][_0xc25d('0x41')]('.')+0x1);if(_0x3055da==='BooleanAttributeMetadata'){_0x5ef6fb[_0xc25d('0xa1')](getBooleanList(_0x30d12a,_0x396e12,_0xedaea2,_0x2f6f3c['MetadataId'],_0x3fd05a[_0xc25d('0x97')],_0x139d0f));}}});return Promise[_0xc25d('0x9f')](_0x5ef6fb);})[_0xc25d('0x10')](function(_0x2ac22c){_0x1cedf3=_0x2ac22c[0x0];var _0x2474b4=[];var _0x23d5ac=[];_0x34b2b4[_0xc25d('0x9c')](function(_0x245e55){if(_0x245e55['@odata.type']){var _0x304d38=_0x245e55[_0xc25d('0x9d')]['substring'](_0x245e55[_0xc25d('0x9d')][_0xc25d('0x41')]('.')+0x1);if(_0x304d38===_0xc25d('0xa2')||_0x304d38==='DoubleAttributeMetadata'||_0x304d38===_0xc25d('0xa3')||_0x304d38==='IntegerAttributeMetadata'||_0x304d38===_0xc25d('0xa4')||_0x304d38==='DateTimeAttributeMetadata'||_0x304d38===_0xc25d('0xa5')||_0x304d38===_0xc25d('0xa6')||_0x304d38==='StateAttributeMetadata'||_0x304d38==='DecimalAttributeMetadata'){_0x2474b4[_0xc25d('0xa1')](getInputList(_0x30d12a,_0x396e12,_0x304d38,_0x23d5ac,_0x2f6f3c[_0xc25d('0x97')],_0x245e55['MetadataId'],_0x139d0f));}}});return Promise[_0xc25d('0x9f')](_0x2474b4);})['then'](function(_0x5945e5){_0x28ade8=_0x5945e5[0x0];var _0x136132=_0x66509[_0xc25d('0x83')](_0x1cedf3)[_0xc25d('0x83')](_0x28ade8);var _0xe20510={'count':_0x136132['length'],'rows':_0x136132};return _0xe20510;})['then'](respondWithResult(_0x3b392c,null))[_0xc25d('0x30')](function(_0xb564f8){var _0x56a61a=_0x941521[_0xc25d('0x1c')][_0xc25d('0xa7')]?0x1f4:_0xb564f8['statusCode']||0x1f4;logger[_0xc25d('0x13')](_0xb564f8[_0xc25d('0x14')]);delete _0xb564f8[_0xc25d('0x15')];if(_0x56a61a===0x191){_0x56a61a=0x190;}_0x3b392c[_0xc25d('0xd')](_0x56a61a)['send'](_0x941521[_0xc25d('0x1c')][_0xc25d('0xa7')]?{'message':_0xc25d('0xa8'),'statusCode':_0xb564f8[_0xc25d('0xa9')]}:_0xb564f8);});};function getSelectList(_0x226d52,_0x36a901,_0x283c37,_0x535aa5,_0x4be2f4,_0x2de67c){var _0x4a0b01={'method':'GET','uri':_0x226d52+_0xc25d('0x98')+_0x535aa5+_0xc25d('0xaa')+_0x4be2f4+_0xc25d('0xab')+_0xc25d('0xac'),'headers':{'Authorization':_0xc25d('0x94')+_0x2de67c,'If-None-Match':null,'OData-Version':_0xc25d('0x95')},'json':!![]};return rp(_0x4a0b01)[_0xc25d('0x10')](function(_0x412e18){var _0x7543f2=[];var _0x5af3b9=_0x412e18['OptionSet']['Options'];_0x5af3b9[_0xc25d('0x9c')](function(_0x3873d3){_0x7543f2[_0xc25d('0xa1')]({'name':_0x3873d3[_0xc25d('0xad')][_0xc25d('0xae')][_0xc25d('0xad')],'value':String(_0x3873d3['Value'])});});var _0x59e6c3={'id':_0x36a901+'_'+_0x412e18[_0xc25d('0x9b')],'name':_0x412e18[_0xc25d('0xaf')][_0xc25d('0xae')][_0xc25d('0xad')],'custom':![],'options':_0x7543f2};_0x283c37[_0xc25d('0xa1')](_0x59e6c3);return _0x283c37;});}function getBooleanList(_0x123efe,_0xd8b42,_0x36d5f7,_0x2b4ef0,_0x3831b4,_0x7a5bc3){var _0x46fe01={'method':_0xc25d('0x92'),'uri':_0x123efe+_0xc25d('0x98')+_0x2b4ef0+_0xc25d('0xaa')+_0x3831b4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc25d('0x94')+_0x7a5bc3,'If-None-Match':null,'OData-Version':_0xc25d('0x95')},'json':!![]};return rp(_0x46fe01)[_0xc25d('0x10')](function(_0x4bcadd){var _0x535ac4=[];_0x535ac4[_0xc25d('0xa1')]({'name':_0x4bcadd['OptionSet'][_0xc25d('0xb0')][_0xc25d('0xad')]['UserLocalizedLabel'][_0xc25d('0xad')],'value':'true'},{'name':_0x4bcadd[_0xc25d('0xb1')][_0xc25d('0xb2')][_0xc25d('0xad')][_0xc25d('0xae')]['Label'],'value':_0xc25d('0xb3')});var _0x5b473c={'id':_0xd8b42+'_'+_0x4bcadd[_0xc25d('0x9b')],'name':_0x4bcadd[_0xc25d('0xaf')][_0xc25d('0xae')]['Label'],'custom':![],'options':_0x535ac4};_0x36d5f7[_0xc25d('0xa1')](_0x5b473c);return _0x36d5f7;});}function getInputList(_0x4c2375,_0x18e80a,_0x85b3d9,_0x314ce6,_0x13afca,_0x4b26a9,_0x5a9429){var _0x1f4ffd={'method':_0xc25d('0x92'),'uri':_0x4c2375+'EntityDefinitions('+_0x13afca+')/Attributes('+_0x4b26a9+_0xc25d('0xb4')+_0x85b3d9+_0xc25d('0xb5'),'headers':{'Authorization':_0xc25d('0x94')+_0x5a9429,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1f4ffd)[_0xc25d('0x10')](function(_0x335040){var _0x3ff6e6={'id':_0x18e80a+'_'+_0x335040[_0xc25d('0x9b')],'name':_0x335040[_0xc25d('0xaf')][_0xc25d('0xae')]?_0x335040[_0xc25d('0xaf')][_0xc25d('0xae')][_0xc25d('0xad')]:_0x335040['LogicalName'],'custom':![],'options':[]};_0x314ce6[_0xc25d('0xa1')](_0x3ff6e6);return _0x314ce6;});} \ No newline at end of file +var _0xaf9c=['includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','name','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','show','params','length','options','find','create','body','catch','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','PhoneCall','title','description','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','/oauth2/token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xaf9c,0xe4));var _0xcaf9=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0xaf9c[_0x2b81be];return _0x8ed4a7;};'use strict';var rp=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var _=require(_0xcaf9('0x2'));var qs=require(_0xcaf9('0x3'));var logger=require(_0xcaf9('0x4'))(_0xcaf9('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcaf9('0x6'));function respondWithResult(_0x34cc1d,_0x4b81c2){_0x4b81c2=_0x4b81c2||0xc8;return function(_0x4c6dc2){if(_0x4c6dc2){return _0x34cc1d[_0xcaf9('0x7')](_0x4b81c2)[_0xcaf9('0x8')](_0x4c6dc2);}};}function respondWithFilteredResult(_0x333507,_0x4e3924){return function(_0x3e5fc8){if(_0x3e5fc8){var _0x101cac=typeof _0x4e3924[_0xcaf9('0x9')]===_0xcaf9('0xa')&&typeof _0x4e3924[_0xcaf9('0xb')]===_0xcaf9('0xa');var _0x12d6f0=_0x3e5fc8[_0xcaf9('0xc')];var _0x141fa6=_0x101cac?0x0:_0x4e3924['offset'];var _0x1da2c4=_0x101cac?_0x3e5fc8[_0xcaf9('0xc')]:_0x4e3924[_0xcaf9('0x9')]+_0x4e3924[_0xcaf9('0xb')];var _0x1d7ac3;if(_0x1da2c4>=_0x12d6f0){_0x1da2c4=_0x12d6f0;_0x1d7ac3=0xc8;}else{_0x1d7ac3=0xce;}_0x333507[_0xcaf9('0x7')](_0x1d7ac3);return _0x333507[_0xcaf9('0xd')](_0xcaf9('0xe'),_0x141fa6+'-'+_0x1da2c4+'/'+_0x12d6f0)['json'](_0x3e5fc8);}return null;};}function saveUpdates(_0x1026f4){return function(_0x1b1934){if(_0x1b1934){return _0x1b1934[_0xcaf9('0xf')](_0x1026f4)[_0xcaf9('0x10')](function(_0x50500b){return _0x50500b;});}return null;};}function removeEntity(_0x52d162){return function(_0x775dfa){if(_0x775dfa){return _0x775dfa[_0xcaf9('0x11')]()[_0xcaf9('0x10')](function(){_0x52d162['status'](0xcc)[_0xcaf9('0x12')]();});}};}function handleEntityNotFound(_0x47b9ef){return function(_0x3987a6){if(!_0x3987a6){_0x47b9ef[_0xcaf9('0x13')](0x194);}return _0x3987a6;};}function handleError(_0x1f4401,_0x30e918){_0x30e918=_0x30e918||0x1f4;return function(_0x13dc46){logger[_0xcaf9('0x14')](_0x13dc46['stack']);if(_0x13dc46[_0xcaf9('0x15')]){delete _0x13dc46[_0xcaf9('0x15')];}_0x1f4401[_0xcaf9('0x7')](_0x30e918)['send'](_0x13dc46);};}exports['index']=function(_0x2e6538,_0x36ae19){var _0x43f0e4={},_0x24d8ef={},_0x272af0={'count':0x0,'rows':[]};var _0x57b754=_[_0xcaf9('0x16')](db[_0xcaf9('0x17')][_0xcaf9('0x18')],function(_0x3b14d3){return{'name':_0x3b14d3[_0xcaf9('0x19')],'type':_0x3b14d3['type']['key']};});_0x24d8ef[_0xcaf9('0x1a')]=_[_0xcaf9('0x16')](_0x57b754,_0xcaf9('0x15'));_0x24d8ef[_0xcaf9('0x1b')]=_[_0xcaf9('0x1c')](_0x2e6538[_0xcaf9('0x1b')]);_0x24d8ef['filters']=_[_0xcaf9('0x1d')](_0x24d8ef['model'],_0x24d8ef[_0xcaf9('0x1b')]);_0x43f0e4[_0xcaf9('0x1e')]=_['intersection'](_0x24d8ef[_0xcaf9('0x1a')],qs[_0xcaf9('0x1f')](_0x2e6538[_0xcaf9('0x1b')][_0xcaf9('0x1f')]));_0x43f0e4['attributes']=_0x43f0e4[_0xcaf9('0x1e')]['length']?_0x43f0e4['attributes']:_0x24d8ef[_0xcaf9('0x1a')];if(!_0x2e6538[_0xcaf9('0x1b')]['hasOwnProperty'](_0xcaf9('0x20'))){_0x43f0e4[_0xcaf9('0xb')]=qs[_0xcaf9('0xb')](_0x2e6538[_0xcaf9('0x1b')][_0xcaf9('0xb')]);_0x43f0e4['offset']=qs[_0xcaf9('0x9')](_0x2e6538[_0xcaf9('0x1b')][_0xcaf9('0x9')]);}_0x43f0e4[_0xcaf9('0x21')]=qs[_0xcaf9('0x22')](_0x2e6538['query']['sort']);_0x43f0e4[_0xcaf9('0x23')]=qs[_0xcaf9('0x24')](_[_0xcaf9('0x25')](_0x2e6538[_0xcaf9('0x1b')],_0x24d8ef[_0xcaf9('0x24')]),_0x57b754);if(_0x2e6538['query']['filter']){_0x43f0e4[_0xcaf9('0x23')]=_[_0xcaf9('0x26')](_0x43f0e4[_0xcaf9('0x23')],{'$or':_[_0xcaf9('0x16')](_0x57b754,function(_0x371377){if(_0x371377[_0xcaf9('0x27')]!==_0xcaf9('0x28')){var _0x320a54={};_0x320a54[_0x371377[_0xcaf9('0x15')]]={'$like':'%'+_0x2e6538['query'][_0xcaf9('0x29')]+'%'};return _0x320a54;}})});}_0x43f0e4=_[_0xcaf9('0x26')]({},_0x43f0e4,_0x2e6538['options']);var _0xe0bbfe={'where':_0x43f0e4[_0xcaf9('0x23')]};return db[_0xcaf9('0x17')][_0xcaf9('0xc')](_0xe0bbfe)[_0xcaf9('0x10')](function(_0x3c9f69){_0x272af0[_0xcaf9('0xc')]=_0x3c9f69;if(_0x2e6538[_0xcaf9('0x1b')][_0xcaf9('0x2a')]){_0x43f0e4[_0xcaf9('0x2b')]=[{'all':!![]}];}return db[_0xcaf9('0x17')]['findAll'](_0x43f0e4);})[_0xcaf9('0x10')](function(_0x31a162){_0x272af0[_0xcaf9('0x2c')]=_0x31a162;return _0x272af0;})[_0xcaf9('0x10')](respondWithFilteredResult(_0x36ae19,_0x43f0e4))['catch'](handleError(_0x36ae19,null));};exports[_0xcaf9('0x2d')]=function(_0x586e8d,_0x3de6de){var _0x289d70={'raw':![],'where':{'id':_0x586e8d[_0xcaf9('0x2e')]['id']}},_0x592586={};_0x592586[_0xcaf9('0x1a')]=_[_0xcaf9('0x1c')](db['Dynamics365Account'][_0xcaf9('0x18')]);_0x592586['query']=_[_0xcaf9('0x1c')](_0x586e8d['query']);_0x592586[_0xcaf9('0x24')]=_[_0xcaf9('0x1d')](_0x592586[_0xcaf9('0x1a')],_0x592586['query']);_0x289d70[_0xcaf9('0x1e')]=_[_0xcaf9('0x1d')](_0x592586['model'],qs[_0xcaf9('0x1f')](_0x586e8d[_0xcaf9('0x1b')][_0xcaf9('0x1f')]));_0x289d70['attributes']=_0x289d70['attributes'][_0xcaf9('0x2f')]?_0x289d70[_0xcaf9('0x1e')]:_0x592586['model'];if(_0x586e8d[_0xcaf9('0x1b')]['includeAll']){_0x289d70['include']=[{'all':!![]}];}_0x289d70=_['merge']({},_0x289d70,_0x586e8d[_0xcaf9('0x30')]);return db[_0xcaf9('0x17')][_0xcaf9('0x31')](_0x289d70)['then'](handleEntityNotFound(_0x3de6de,null))[_0xcaf9('0x10')](respondWithResult(_0x3de6de,null))['catch'](handleError(_0x3de6de,null));};exports[_0xcaf9('0x32')]=function(_0x3c4788,_0x3c7079){return db[_0xcaf9('0x17')][_0xcaf9('0x32')](_0x3c4788[_0xcaf9('0x33')],{})['then'](respondWithResult(_0x3c7079,0xc9))[_0xcaf9('0x34')](handleError(_0x3c7079,null));};exports['update']=function(_0x33a1c6,_0x15c9bf){if(_0x33a1c6[_0xcaf9('0x33')]['id']){delete _0x33a1c6[_0xcaf9('0x33')]['id'];}return db[_0xcaf9('0x17')]['find']({'where':{'id':_0x33a1c6[_0xcaf9('0x2e')]['id']}})[_0xcaf9('0x10')](handleEntityNotFound(_0x15c9bf,null))['then'](saveUpdates(_0x33a1c6[_0xcaf9('0x33')],null))['then'](respondWithResult(_0x15c9bf,null))['catch'](handleError(_0x15c9bf,null));};exports[_0xcaf9('0x11')]=function(_0x282aab,_0x3daab0){return db['Dynamics365Account'][_0xcaf9('0x31')]({'where':{'id':_0x282aab[_0xcaf9('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3daab0,null))[_0xcaf9('0x10')](removeEntity(_0x3daab0,null))[_0xcaf9('0x34')](handleError(_0x3daab0,null));};exports[_0xcaf9('0x35')]=function(_0x25d1d2,_0x34f05f){var _0x569686={};var _0x529290={};var _0x8279a5;var _0x5819fd;return db['Dynamics365Account'][_0xcaf9('0x36')]({'where':{'id':_0x25d1d2[_0xcaf9('0x2e')]['id']}})[_0xcaf9('0x10')](handleEntityNotFound(_0x34f05f,null))[_0xcaf9('0x10')](function(_0x3a5273){if(_0x3a5273){_0x8279a5=_0x3a5273;_0x529290['model']=_[_0xcaf9('0x1c')](db[_0xcaf9('0x37')][_0xcaf9('0x18')]);_0x529290[_0xcaf9('0x1b')]=_['keys'](_0x25d1d2['query']);_0x529290[_0xcaf9('0x24')]=_[_0xcaf9('0x1d')](_0x529290[_0xcaf9('0x1a')],_0x529290[_0xcaf9('0x1b')]);_0x569686[_0xcaf9('0x1e')]=_[_0xcaf9('0x1d')](_0x529290[_0xcaf9('0x1a')],qs[_0xcaf9('0x1f')](_0x25d1d2['query']['fields']));_0x569686[_0xcaf9('0x1e')]=_0x569686['attributes'][_0xcaf9('0x2f')]?_0x569686[_0xcaf9('0x1e')]:_0x529290[_0xcaf9('0x1a')];_0x569686[_0xcaf9('0x21')]=qs[_0xcaf9('0x22')](_0x25d1d2[_0xcaf9('0x1b')][_0xcaf9('0x22')]);_0x569686[_0xcaf9('0x23')]=qs['filters'](_[_0xcaf9('0x25')](_0x25d1d2[_0xcaf9('0x1b')],_0x529290[_0xcaf9('0x24')]));if(_0x25d1d2[_0xcaf9('0x1b')]['filter']){_0x569686[_0xcaf9('0x23')]=_[_0xcaf9('0x26')](_0x569686[_0xcaf9('0x23')],{'$or':_[_0xcaf9('0x16')](_0x569686[_0xcaf9('0x1e')],function(_0x1d3e1e){var _0x1844f1={};_0x1844f1[_0x1d3e1e]={'$like':'%'+_0x25d1d2['query'][_0xcaf9('0x29')]+'%'};return _0x1844f1;})});}_0x569686=_[_0xcaf9('0x26')]({},_0x569686,_0x25d1d2['options']);return _0x8279a5['getConfigurations'](_0x569686);}})[_0xcaf9('0x10')](function(_0x7db0e2){if(_0x7db0e2){_0x5819fd=_0x7db0e2['length'];if(!_0x25d1d2['query'][_0xcaf9('0x38')](_0xcaf9('0x20'))){_0x569686['limit']=qs['limit'](_0x25d1d2[_0xcaf9('0x1b')]['limit']);_0x569686[_0xcaf9('0x9')]=qs['offset'](_0x25d1d2[_0xcaf9('0x1b')][_0xcaf9('0x9')]);}return _0x8279a5[_0xcaf9('0x35')](_0x569686);}})[_0xcaf9('0x10')](function(_0x8608e1){if(_0x8608e1){return _0x8608e1?{'count':_0x5819fd,'rows':_0x8608e1}:null;}})[_0xcaf9('0x10')](respondWithResult(_0x34f05f,null))[_0xcaf9('0x34')](handleError(_0x34f05f,null));};exports[_0xcaf9('0x39')]=function(_0x2968ce,_0x2ec9b8){if(_0x2968ce[_0xcaf9('0x33')]['id']){delete _0x2968ce[_0xcaf9('0x33')]['id'];}return db[_0xcaf9('0x17')][_0xcaf9('0x36')]({'where':{'id':_0x2968ce[_0xcaf9('0x2e')]['id']}})[_0xcaf9('0x10')](handleEntityNotFound(_0x2ec9b8,null))[_0xcaf9('0x10')](function(_0x1f7f3a){if(_0x1f7f3a){_0x2968ce[_0xcaf9('0x33')][_0xcaf9('0x3a')]=_0x1f7f3a['id'];_0x2968ce[_0xcaf9('0x33')][_0xcaf9('0x3b')]=integrations[_0xcaf9('0x3c')](_0x2968ce[_0xcaf9('0x33')][_0xcaf9('0x3d')],_0x2968ce[_0xcaf9('0x33')]['type']);_0x2968ce[_0xcaf9('0x33')]['Descriptions']=integrations[_0xcaf9('0x3e')](_0x2968ce[_0xcaf9('0x33')][_0xcaf9('0x3d')],_0x2968ce['body'][_0xcaf9('0x27')]);return db[_0xcaf9('0x37')][_0xcaf9('0x32')](_0x2968ce[_0xcaf9('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0xcaf9('0x3b')},{'model':db[_0xcaf9('0x3f')],'as':_0xcaf9('0x40')}]});}return null;})[_0xcaf9('0x10')](respondWithResult(_0x2ec9b8,null))[_0xcaf9('0x34')](handleError(_0x2ec9b8,null));};function sanitizeRemoteUri(_0x3586e7){var _0x16d889=_0x3586e7[_0xcaf9('0x41')](-0x1);if(_0x16d889==='/')return _0x3586e7[_0xcaf9('0x42')](0x0,_0x3586e7[_0xcaf9('0x43')](_0x16d889));return _0x3586e7;}function getWebApiUrl(_0xe2f2e0){return util['format'](_0xcaf9('0x44'),_0xe2f2e0);}exports[_0xcaf9('0x45')]=function(_0x401ce5,_0x2e15b7){var _0x795626=_0x401ce5['query']['ticketType'];var _0x427a58=_0x795626===_0xcaf9('0x46')?'Incident':_0xcaf9('0x47');var _0x4af5c4='';var _0x55bc7c='';var _0xdafc14='';var _0x31e720='';var _0x54168f='';var _0x195c2f='';var _0x6a7a10='';var _0x52d942='';var _0x28dc64=[_0xcaf9('0x48'),_0xcaf9('0x49'),'customerid',_0xcaf9('0x4a'),'caseorigincode','subject',_0xcaf9('0x4b'),_0xcaf9('0x4c'),_0xcaf9('0x4d'),_0xcaf9('0x4e')];var _0x4a9616=[_0xcaf9('0x4f'),'accountidyominame',_0xcaf9('0x50'),_0xcaf9('0x51'),_0xcaf9('0x52'),_0xcaf9('0x53'),'contractdetailidname',_0xcaf9('0x54'),'createdbyexternalpartyname',_0xcaf9('0x55'),_0xcaf9('0x56'),'createdbyyominame',_0xcaf9('0x57'),_0xcaf9('0x58'),'createdonbehalfbyyominame',_0xcaf9('0x59'),_0xcaf9('0x5a'),_0xcaf9('0x5b'),_0xcaf9('0x5c'),_0xcaf9('0x5d'),_0xcaf9('0x5e'),_0xcaf9('0x5f'),_0xcaf9('0x60'),_0xcaf9('0x61'),_0xcaf9('0x62'),'followupby','importsequencenumber','influencescore',_0xcaf9('0x63'),_0xcaf9('0x64'),_0xcaf9('0x65'),_0xcaf9('0x66'),'modifiedbyexternalpartyyominame',_0xcaf9('0x67'),_0xcaf9('0x68'),_0xcaf9('0x69'),'modifiedonbehalfbyname',_0xcaf9('0x6a'),_0xcaf9('0x6b'),_0xcaf9('0x6c'),_0xcaf9('0x6d'),_0xcaf9('0x6e'),'overriddencreatedon',_0xcaf9('0x6f'),_0xcaf9('0x70'),_0xcaf9('0x71'),_0xcaf9('0x72'),_0xcaf9('0x73'),'primarycontactidyominame',_0xcaf9('0x74'),_0xcaf9('0x75'),_0xcaf9('0x76'),_0xcaf9('0x77'),'resolvebykpiidname',_0xcaf9('0x78'),_0xcaf9('0x79'),_0xcaf9('0x7a'),_0xcaf9('0x7b'),'slainvokedidname',_0xcaf9('0x7c'),'socialprofileidname',_0xcaf9('0x7d'),_0xcaf9('0x7e'),'subjectidname',_0xcaf9('0x7f'),_0xcaf9('0x80'),'transactioncurrencyidname',_0xcaf9('0x81'),_0xcaf9('0x82'),_0xcaf9('0x83')];var _0x3e1a78=_0x28dc64[_0xcaf9('0x84')](_0x4a9616);return db[_0xcaf9('0x17')][_0xcaf9('0x36')]({'where':{'id':_0x401ce5[_0xcaf9('0x2e')]['id']},'attributes':['id',_0xcaf9('0x85'),_0xcaf9('0x86'),'remoteUri',_0xcaf9('0x87'),_0xcaf9('0x88'),_0xcaf9('0x89'),_0xcaf9('0x8a')],'include':[{'model':db[_0xcaf9('0x8b')],'as':_0xcaf9('0x8b'),'attributes':['id',_0xcaf9('0x8c'),_0xcaf9('0x8d')]}]})[_0xcaf9('0x10')](handleEntityNotFound(_0x2e15b7,null))[_0xcaf9('0x10')](function(_0x470f82){if(_0x470f82){if(_0x470f82[_0xcaf9('0x8a')]){_0x470f82[_0xcaf9('0x8e')]=_0x470f82[_0xcaf9('0x8b')][_0xcaf9('0x8c')];_0x52d942=sanitizeRemoteUri(_0x470f82[_0xcaf9('0x8b')]['data7']);_0x6a7a10=getWebApiUrl(_0x52d942);return _0x470f82;}_0x52d942=sanitizeRemoteUri(_0x470f82[_0xcaf9('0x8f')]);_0x6a7a10=getWebApiUrl(_0x52d942);var _0x473c0d={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x470f82[_0xcaf9('0x87')]+_0xcaf9('0x90'),'form':{'client_id':_0x470f82['clientId'],'resource':_0x52d942,'username':_0x470f82[_0xcaf9('0x85')],'password':_0x470f82[_0xcaf9('0x86')],'grant_type':_0xcaf9('0x86'),'client_secret':_0x470f82[_0xcaf9('0x89')]},'json':!![]};return rp(_0x473c0d);}})[_0xcaf9('0x10')](function(_0x3a5a7b){_0x195c2f=_0x3a5a7b[_0xcaf9('0x8e')];var _0x83b643={'method':_0xcaf9('0x91'),'uri':encodeURI(_0x6a7a10+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x427a58+'\x27'),'headers':{'Authorization':_0xcaf9('0x92')+_0x195c2f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x83b643);})[_0xcaf9('0x10')](function(_0x4d59d3){var _0x344762=_0x4d59d3[_0xcaf9('0x93')][0x0];var _0x1cf5a8=_0x344762[_0xcaf9('0x94')];var _0x164fb8={'method':_0xcaf9('0x91'),'uri':_0x6a7a10+_0xcaf9('0x95')+_0x1cf5a8+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xcaf9('0x92')+_0x195c2f,'If-None-Match':null,'OData-Version':_0xcaf9('0x96')},'json':!![]};return rp(_0x164fb8);})[_0xcaf9('0x10')](function(_0x1f4b85){_0x4af5c4=_0x1f4b85;_0x55bc7c=_0x4af5c4[_0xcaf9('0x97')];_0x55bc7c=_['remove'](_0x55bc7c,function(_0x383f6c){return!_0x3e1a78[_0xcaf9('0x98')](_0x383f6c[_0xcaf9('0x99')]);});var _0x421720=[];var _0x31e9c3=[];_0x55bc7c[_0xcaf9('0x9a')](function(_0x25d119){if(_0x25d119[_0xcaf9('0x9b')]){var _0x487ca3=_0x25d119['@odata.type'][_0xcaf9('0x42')](_0x25d119[_0xcaf9('0x9b')][_0xcaf9('0x43')]('.')+0x1);if(_0x487ca3===_0xcaf9('0x9c')){_0x421720['push'](getSelectList(_0x6a7a10,_0x795626,_0x31e9c3,_0x4af5c4[_0xcaf9('0x94')],_0x25d119[_0xcaf9('0x94')],_0x195c2f));}}});return Promise[_0xcaf9('0x9d')](_0x421720);})[_0xcaf9('0x10')](function(_0x36d445){_0xdafc14=_0x36d445[0x0];var _0x28f964=[];var _0x428fbb=[];_0x55bc7c[_0xcaf9('0x9a')](function(_0x4fdd26){if(!_[_0xcaf9('0x9e')](_0x4fdd26[_0xcaf9('0x9b')])){var _0xa8f5e6=_0x4fdd26[_0xcaf9('0x9b')][_0xcaf9('0x42')](_0x4fdd26[_0xcaf9('0x9b')][_0xcaf9('0x43')]('.')+0x1);if(_0xa8f5e6===_0xcaf9('0x9f')){_0x28f964[_0xcaf9('0xa0')](getBooleanList(_0x6a7a10,_0x795626,_0x428fbb,_0x4af5c4[_0xcaf9('0x94')],_0x4fdd26[_0xcaf9('0x94')],_0x195c2f));}}});return Promise['all'](_0x28f964);})['then'](function(_0x3903ed){_0x31e720=_0x3903ed[0x0];var _0x43e3db=[];var _0x327088=[];_0x55bc7c[_0xcaf9('0x9a')](function(_0x305718){if(_0x305718[_0xcaf9('0x9b')]){var _0x2bc89c=_0x305718[_0xcaf9('0x9b')]['substring'](_0x305718[_0xcaf9('0x9b')][_0xcaf9('0x43')]('.')+0x1);if(_0x2bc89c===_0xcaf9('0xa1')||_0x2bc89c===_0xcaf9('0xa2')||_0x2bc89c==='BigIntAttributeMetadata'||_0x2bc89c===_0xcaf9('0xa3')||_0x2bc89c===_0xcaf9('0xa4')||_0x2bc89c===_0xcaf9('0xa5')||_0x2bc89c===_0xcaf9('0xa6')||_0x2bc89c===_0xcaf9('0xa7')||_0x2bc89c===_0xcaf9('0xa8')||_0x2bc89c===_0xcaf9('0xa9')){_0x43e3db[_0xcaf9('0xa0')](getInputList(_0x6a7a10,_0x795626,_0x2bc89c,_0x327088,_0x4af5c4['MetadataId'],_0x305718['MetadataId'],_0x195c2f));}}});return Promise[_0xcaf9('0x9d')](_0x43e3db);})[_0xcaf9('0x10')](function(_0x55e9ff){_0x54168f=_0x55e9ff[0x0];var _0x1fa1d5=_0xdafc14[_0xcaf9('0x84')](_0x31e720)[_0xcaf9('0x84')](_0x54168f);var _0x45e5db={'count':_0x1fa1d5[_0xcaf9('0x2f')],'rows':_0x1fa1d5};return _0x45e5db;})[_0xcaf9('0x10')](respondWithResult(_0x2e15b7,null))[_0xcaf9('0x34')](function(_0x130ac9){var _0x238bc7=_0x401ce5[_0xcaf9('0x1b')]['test']?0x1f4:_0x130ac9[_0xcaf9('0xaa')]||0x1f4;logger['error'](_0x130ac9[_0xcaf9('0xab')]);delete _0x130ac9[_0xcaf9('0x15')];if(_0x238bc7===0x191){_0x238bc7=0x190;}_0x2e15b7[_0xcaf9('0x7')](_0x238bc7)[_0xcaf9('0xac')](_0x401ce5[_0xcaf9('0x1b')][_0xcaf9('0xad')]?{'message':_0xcaf9('0xae'),'statusCode':_0x130ac9[_0xcaf9('0xaa')]}:_0x130ac9);});};function getSelectList(_0x2d764a,_0x3ea457,_0x24d35c,_0x23aec5,_0x4f6938,_0x334680){var _0x25e2d6={'method':'GET','uri':_0x2d764a+_0xcaf9('0x95')+_0x23aec5+_0xcaf9('0xaf')+_0x4f6938+_0xcaf9('0xb0')+_0xcaf9('0xb1'),'headers':{'Authorization':_0xcaf9('0x92')+_0x334680,'If-None-Match':null,'OData-Version':_0xcaf9('0x96')},'json':!![]};return rp(_0x25e2d6)[_0xcaf9('0x10')](function(_0x50c079){var _0x5012c2=[];var _0x362ae6=_0x50c079[_0xcaf9('0xb2')][_0xcaf9('0xb3')];_0x362ae6[_0xcaf9('0x9a')](function(_0x3d5c09){_0x5012c2['push']({'name':_0x3d5c09[_0xcaf9('0xb4')][_0xcaf9('0xb5')][_0xcaf9('0xb4')],'value':String(_0x3d5c09[_0xcaf9('0xb6')])});});var _0x1219cc={'id':_0x3ea457+'_'+_0x50c079[_0xcaf9('0x99')],'name':_0x50c079[_0xcaf9('0xb7')][_0xcaf9('0xb5')][_0xcaf9('0xb4')],'custom':![],'options':_0x5012c2};_0x24d35c['push'](_0x1219cc);return _0x24d35c;});}function getBooleanList(_0x14adb1,_0x54d105,_0x2e61ca,_0x380257,_0x27773e,_0x3c055b){var _0x1e0ecc={'method':'GET','uri':_0x14adb1+_0xcaf9('0x95')+_0x380257+_0xcaf9('0xaf')+_0x27773e+_0xcaf9('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x3c055b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e0ecc)[_0xcaf9('0x10')](function(_0x295e88){var _0x4ac5f8=[];_0x4ac5f8[_0xcaf9('0xa0')]({'name':_0x295e88[_0xcaf9('0xb2')][_0xcaf9('0xb9')]['Label'][_0xcaf9('0xb5')][_0xcaf9('0xb4')],'value':_0xcaf9('0xba')},{'name':_0x295e88[_0xcaf9('0xb2')][_0xcaf9('0xbb')][_0xcaf9('0xb4')][_0xcaf9('0xb5')][_0xcaf9('0xb4')],'value':_0xcaf9('0xbc')});var _0x293182={'id':_0x54d105+'_'+_0x295e88['LogicalName'],'name':_0x295e88[_0xcaf9('0xb7')]['UserLocalizedLabel'][_0xcaf9('0xb4')],'custom':![],'options':_0x4ac5f8};_0x2e61ca['push'](_0x293182);return _0x2e61ca;});}function getInputList(_0x14b5cd,_0x490461,_0x575a44,_0x2b2117,_0x39c35e,_0x20c8d6,_0x5afa0a){var _0x11b38b={'method':_0xcaf9('0x91'),'uri':_0x14b5cd+_0xcaf9('0x95')+_0x39c35e+_0xcaf9('0xaf')+_0x20c8d6+')/Microsoft.Dynamics.CRM.'+_0x575a44+_0xcaf9('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0x5afa0a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11b38b)[_0xcaf9('0x10')](function(_0x325357){var _0x54863c={'id':_0x490461+'_'+_0x325357[_0xcaf9('0x99')],'name':_0x325357['DisplayName']['UserLocalizedLabel']?_0x325357[_0xcaf9('0xb7')][_0xcaf9('0xb5')]['Label']:_0x325357[_0xcaf9('0x99')],'custom':![],'options':[]};_0x2b2117[_0xcaf9('0xa0')](_0x54863c);return _0x2b2117;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3d4a6e7..1f20863 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x1b903b,_0x1b8a87){var _0x129d33=function(_0x140744){while(--_0x140744){_0x1b903b['push'](_0x1b903b['shift']());}};_0x129d33(++_0x1b8a87);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x4937a2,_0x1e7118){var _0x2e8c50=function(_0x249850){while(--_0x249850){_0x4937a2['push'](_0x4937a2['shift']());}};_0x2e8c50(++_0x1e7118);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index fc410a5..c8de751 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 _0x276b=['debug','request\x20sent','stringify','error','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','model','Dynamics365Account','map','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x33777a,_0x523e7a){var _0x472a7d=function(_0x7250ed){while(--_0x7250ed){_0x33777a['push'](_0x33777a['shift']());}};_0x472a7d(++_0x523e7a);}(_0x276b,0x108));var _0xb276=function(_0x4b395a,_0x4409a5){_0x4b395a=_0x4b395a-0x0;var _0x3ac614=_0x276b[_0x4b395a];return _0x3ac614;};'use strict';var _=require(_0xb276('0x0'));var util=require(_0xb276('0x1'));var moment=require(_0xb276('0x2'));var BPromise=require(_0xb276('0x3'));var rs=require(_0xb276('0x4'));var fs=require('fs');var Redis=require(_0xb276('0x5'));var db=require(_0xb276('0x6'))['db'];var utils=require(_0xb276('0x7'));var logger=require('../../config/logger')(_0xb276('0x8'));var config=require(_0xb276('0x9'));var jayson=require(_0xb276('0xa'));var client=jayson[_0xb276('0xb')][_0xb276('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17c3c3,_0xbc5f99,_0xd22dee){return new BPromise(function(_0x9dc313,_0x555101){return client['request'](_0x17c3c3,_0xd22dee)[_0xb276('0xd')](function(_0x56645d){logger[_0xb276('0xe')](_0xb276('0xf'),_0xbc5f99,'request\x20sent');logger[_0xb276('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xbc5f99,_0xb276('0x11'),JSON[_0xb276('0x12')](_0x56645d));if(_0x56645d[_0xb276('0x13')]){if(_0x56645d['error']['code']===0x1f4){logger['error'](_0xb276('0xf'),_0xbc5f99,_0x56645d[_0xb276('0x13')][_0xb276('0x14')]);return _0x555101(_0x56645d[_0xb276('0x13')][_0xb276('0x14')]);}logger['error'](_0xb276('0xf'),_0xbc5f99,_0x56645d[_0xb276('0x13')][_0xb276('0x14')]);return _0x9dc313(_0x56645d[_0xb276('0x13')][_0xb276('0x14')]);}else{logger[_0xb276('0xe')](_0xb276('0xf'),_0xbc5f99,_0xb276('0x11'));_0x9dc313(_0x56645d[_0xb276('0x15')][_0xb276('0x14')]);}})[_0xb276('0x16')](function(_0x4435af){logger['error'](_0xb276('0xf'),_0xbc5f99,_0x4435af);_0x555101(_0x4435af);});});}exports[_0xb276('0x17')]=function(_0x2b965d){var _0x431117=this;return new Promise(function(_0x296f74,_0x5b3ea9){return db['Dynamics365Account'][_0xb276('0x18')]({'raw':_0x2b965d[_0xb276('0x19')]?_0x2b965d[_0xb276('0x19')][_0xb276('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b965d['options']?_0x2b965d[_0xb276('0x19')][_0xb276('0x1b')]||null:null,'attributes':_0x2b965d[_0xb276('0x19')]?_0x2b965d[_0xb276('0x19')][_0xb276('0x1c')]||null:null,'limit':_0x2b965d[_0xb276('0x19')]?_0x2b965d[_0xb276('0x19')][_0xb276('0x1d')]||null:null,'include':_0x2b965d[_0xb276('0x19')]?_0x2b965d[_0xb276('0x19')][_0xb276('0x1e')]?_['map'](_0x2b965d[_0xb276('0x19')][_0xb276('0x1e')],function(_0xb08add){return{'model':db[_0xb08add[_0xb276('0x1f')]],'as':_0xb08add['as'],'attributes':_0xb08add[_0xb276('0x1c')],'include':_0xb08add[_0xb276('0x1e')]?_['map'](_0xb08add[_0xb276('0x1e')],function(_0x55e86d){return{'model':db[_0x55e86d[_0xb276('0x1f')]],'as':_0x55e86d['as'],'attributes':_0x55e86d[_0xb276('0x1c')],'include':_0x55e86d[_0xb276('0x1e')]?_['map'](_0x55e86d[_0xb276('0x1e')],function(_0x30f63d){return{'model':db[_0x30f63d['model']],'as':_0x30f63d['as'],'attributes':_0x30f63d['attributes']};}):[]};}):[]};}):[]:[]})[_0xb276('0xd')](function(_0x41639a){logger['info'](_0xb276('0x17'),_0x2b965d);logger['debug'](_0xb276('0x17'),_0x2b965d,JSON['stringify'](_0x41639a));_0x296f74(_0x41639a);})['catch'](function(_0x2cbef7){logger['error'](_0xb276('0x17'),_0x2cbef7['message'],_0x2b965d);_0x5b3ea9(_0x431117[_0xb276('0x13')](0x1f4,_0x2cbef7[_0xb276('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x11193f){var _0x567102=this;return new Promise(function(_0x50362f,_0x1a5e12){return db[_0xb276('0x20')]['find']({'raw':_0x11193f[_0xb276('0x19')]?_0x11193f[_0xb276('0x19')][_0xb276('0x1a')]===undefined?!![]:![]:!![],'where':_0x11193f['options']?_0x11193f[_0xb276('0x19')]['where']||null:null,'attributes':_0x11193f[_0xb276('0x19')]?_0x11193f[_0xb276('0x19')][_0xb276('0x1c')]||null:null,'include':_0x11193f['options']?_0x11193f[_0xb276('0x19')][_0xb276('0x1e')]?_[_0xb276('0x21')](_0x11193f[_0xb276('0x19')]['include'],function(_0x109de3){return{'model':db[_0x109de3[_0xb276('0x1f')]],'as':_0x109de3['as'],'attributes':_0x109de3[_0xb276('0x1c')],'include':_0x109de3[_0xb276('0x1e')]?_[_0xb276('0x21')](_0x109de3['include'],function(_0x477a02){return{'model':db[_0x477a02[_0xb276('0x1f')]],'as':_0x477a02['as'],'attributes':_0x477a02[_0xb276('0x1c')],'include':_0x477a02[_0xb276('0x1e')]?_['map'](_0x477a02[_0xb276('0x1e')],function(_0x4f54ec){return{'model':db[_0x4f54ec[_0xb276('0x1f')]],'as':_0x4f54ec['as'],'attributes':_0x4f54ec[_0xb276('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb276('0xd')](function(_0x35e208){logger[_0xb276('0xe')]('ShowDynamics365Account',_0x11193f);logger[_0xb276('0x10')](_0xb276('0x22'),_0x11193f,JSON[_0xb276('0x12')](_0x35e208));_0x50362f(_0x35e208);})[_0xb276('0x16')](function(_0x286511){logger[_0xb276('0x13')](_0xb276('0x22'),_0x286511[_0xb276('0x14')],_0x11193f);_0x1a5e12(_0x567102[_0xb276('0x13')](0x1f4,_0x286511['message']));});});}; \ No newline at end of file +var _0xbbc7=['../../config/utils','../../config/logger','rpc','http','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xbbc7,0x7e));var _0x7bbc=function(_0x5f272b,_0x24d559){_0x5f272b=_0x5f272b-0x0;var _0x44e3fb=_0xbbc7[_0x5f272b];return _0x44e3fb;};'use strict';var _=require(_0x7bbc('0x0'));var util=require(_0x7bbc('0x1'));var moment=require(_0x7bbc('0x2'));var BPromise=require(_0x7bbc('0x3'));var rs=require(_0x7bbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bbc('0x5'))['db'];var utils=require(_0x7bbc('0x6'));var logger=require(_0x7bbc('0x7'))(_0x7bbc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7bbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f3e20,_0x2cb42c,_0x54b831){return new BPromise(function(_0x48f438,_0x2b02aa){return client['request'](_0x4f3e20,_0x54b831)[_0x7bbc('0xa')](function(_0x202096){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2cb42c,_0x7bbc('0xb'));logger['debug'](_0x7bbc('0xc'),_0x2cb42c,_0x7bbc('0xb'),JSON[_0x7bbc('0xd')](_0x202096));if(_0x202096['error']){if(_0x202096[_0x7bbc('0xe')][_0x7bbc('0xf')]===0x1f4){logger[_0x7bbc('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x2cb42c,_0x202096[_0x7bbc('0xe')][_0x7bbc('0x10')]);return _0x2b02aa(_0x202096[_0x7bbc('0xe')]['message']);}logger[_0x7bbc('0xe')](_0x7bbc('0x11'),_0x2cb42c,_0x202096[_0x7bbc('0xe')][_0x7bbc('0x10')]);return _0x48f438(_0x202096['error'][_0x7bbc('0x10')]);}else{logger[_0x7bbc('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2cb42c,_0x7bbc('0xb'));_0x48f438(_0x202096['result'][_0x7bbc('0x10')]);}})[_0x7bbc('0x13')](function(_0x8372b){logger[_0x7bbc('0xe')](_0x7bbc('0x11'),_0x2cb42c,_0x8372b);_0x2b02aa(_0x8372b);});});}exports[_0x7bbc('0x14')]=function(_0x42c0ea){var _0x4f4f8a=this;return new Promise(function(_0x3c14d6,_0x101ada){return db[_0x7bbc('0x15')][_0x7bbc('0x16')]({'raw':_0x42c0ea['options']?_0x42c0ea[_0x7bbc('0x17')][_0x7bbc('0x18')]===undefined?!![]:![]:!![],'where':_0x42c0ea[_0x7bbc('0x17')]?_0x42c0ea['options'][_0x7bbc('0x19')]||null:null,'attributes':_0x42c0ea[_0x7bbc('0x17')]?_0x42c0ea['options'][_0x7bbc('0x1a')]||null:null,'limit':_0x42c0ea['options']?_0x42c0ea[_0x7bbc('0x17')][_0x7bbc('0x1b')]||null:null,'include':_0x42c0ea[_0x7bbc('0x17')]?_0x42c0ea[_0x7bbc('0x17')][_0x7bbc('0x1c')]?_[_0x7bbc('0x1d')](_0x42c0ea[_0x7bbc('0x17')][_0x7bbc('0x1c')],function(_0x1569be){return{'model':db[_0x1569be['model']],'as':_0x1569be['as'],'attributes':_0x1569be['attributes'],'include':_0x1569be[_0x7bbc('0x1c')]?_[_0x7bbc('0x1d')](_0x1569be[_0x7bbc('0x1c')],function(_0x10d764){return{'model':db[_0x10d764[_0x7bbc('0x1e')]],'as':_0x10d764['as'],'attributes':_0x10d764[_0x7bbc('0x1a')],'include':_0x10d764[_0x7bbc('0x1c')]?_[_0x7bbc('0x1d')](_0x10d764['include'],function(_0x52ee5c){return{'model':db[_0x52ee5c[_0x7bbc('0x1e')]],'as':_0x52ee5c['as'],'attributes':_0x52ee5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7bbc('0xa')](function(_0x5c7414){logger[_0x7bbc('0x12')](_0x7bbc('0x14'),_0x42c0ea);logger['debug'](_0x7bbc('0x14'),_0x42c0ea,JSON['stringify'](_0x5c7414));_0x3c14d6(_0x5c7414);})[_0x7bbc('0x13')](function(_0x1a4d55){logger['error'](_0x7bbc('0x14'),_0x1a4d55['message'],_0x42c0ea);_0x101ada(_0x4f4f8a[_0x7bbc('0xe')](0x1f4,_0x1a4d55['message']));});});};exports['ShowDynamics365Account']=function(_0x4cb244){var _0x4bdc53=this;return new Promise(function(_0x1bc695,_0x54bd4f){return db[_0x7bbc('0x15')][_0x7bbc('0x1f')]({'raw':_0x4cb244[_0x7bbc('0x17')]?_0x4cb244[_0x7bbc('0x17')][_0x7bbc('0x18')]===undefined?!![]:![]:!![],'where':_0x4cb244[_0x7bbc('0x17')]?_0x4cb244['options'][_0x7bbc('0x19')]||null:null,'attributes':_0x4cb244[_0x7bbc('0x17')]?_0x4cb244[_0x7bbc('0x17')]['attributes']||null:null,'include':_0x4cb244['options']?_0x4cb244[_0x7bbc('0x17')][_0x7bbc('0x1c')]?_[_0x7bbc('0x1d')](_0x4cb244[_0x7bbc('0x17')]['include'],function(_0x2893eb){return{'model':db[_0x2893eb[_0x7bbc('0x1e')]],'as':_0x2893eb['as'],'attributes':_0x2893eb[_0x7bbc('0x1a')],'include':_0x2893eb['include']?_[_0x7bbc('0x1d')](_0x2893eb['include'],function(_0x40be7a){return{'model':db[_0x40be7a[_0x7bbc('0x1e')]],'as':_0x40be7a['as'],'attributes':_0x40be7a[_0x7bbc('0x1a')],'include':_0x40be7a['include']?_[_0x7bbc('0x1d')](_0x40be7a[_0x7bbc('0x1c')],function(_0x3950d6){return{'model':db[_0x3950d6[_0x7bbc('0x1e')]],'as':_0x3950d6['as'],'attributes':_0x3950d6[_0x7bbc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37368b){logger['info'](_0x7bbc('0x20'),_0x4cb244);logger['debug'](_0x7bbc('0x20'),_0x4cb244,JSON[_0x7bbc('0xd')](_0x37368b));_0x1bc695(_0x37368b);})[_0x7bbc('0x13')](function(_0x5b3906){logger[_0x7bbc('0xe')]('ShowDynamics365Account',_0x5b3906[_0x7bbc('0x10')],_0x4cb244);_0x54bd4f(_0x4bdc53['error'](0x1f4,_0x5b3906[_0x7bbc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1069ce2..c7f3b1a 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 _0x80ed=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0xb6e8a1,_0x21a147){var _0x35bc03=function(_0x55f45c){while(--_0x55f45c){_0xb6e8a1['push'](_0xb6e8a1['shift']());}};_0x35bc03(++_0x21a147);}(_0x80ed,0x11c));var _0xd80e=function(_0x121b30,_0x39e368){_0x121b30=_0x121b30-0x0;var _0x228930=_0x80ed[_0x121b30];return _0x228930;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getSubjects']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x14')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x15')]);module[_0xd80e('0x16')]=router; \ No newline at end of file +var _0xf8cd=['/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xf8cd,0xf7));var _0xdf8c=function(_0x4a71d2,_0x5a9c79){_0x4a71d2=_0x4a71d2-0x0;var _0x5f44f9=_0xf8cd[_0x4a71d2];return _0x5f44f9;};'use strict';var multer=require(_0xdf8c('0x0'));var util=require(_0xdf8c('0x1'));var path=require('path');var timeout=require(_0xdf8c('0x2'));var express=require(_0xdf8c('0x3'));var router=express[_0xdf8c('0x4')]();var fs_extra=require(_0xdf8c('0x5'));var auth=require(_0xdf8c('0x6'));var interaction=require(_0xdf8c('0x7'));var config=require(_0xdf8c('0x8'));var controller=require(_0xdf8c('0x9'));router[_0xdf8c('0xa')]('/',auth[_0xdf8c('0xb')](),controller[_0xdf8c('0xc')]);router['get'](_0xdf8c('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdf8c('0xe'),auth[_0xdf8c('0xb')](),controller[_0xdf8c('0xf')]);router['get'](_0xdf8c('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdf8c('0xa')](_0xdf8c('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdf8c('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf8c('0x13')](_0xdf8c('0xd'),auth[_0xdf8c('0xb')](),controller[_0xdf8c('0x14')]);router[_0xdf8c('0x15')]('/:id',auth[_0xdf8c('0xb')](),controller[_0xdf8c('0x16')]);module[_0xdf8c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7ad4f20..4a5d55b 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 _0x99ca=['STRING','ENUM','incident','contact','nothing','BOOLEAN','exports'];(function(_0x420005,_0x27f98f){var _0x2eb6c6=function(_0x1d6bd4){while(--_0x1d6bd4){_0x420005['push'](_0x420005['shift']());}};_0x2eb6c6(++_0x27f98f);}(_0x99ca,0x1f0));var _0xa99c=function(_0x57f8fa,_0x4c805c){_0x57f8fa=_0x57f8fa-0x0;var _0x133851=_0x99ca[_0x57f8fa];return _0x133851;};'use strict';var Sequelize=require('sequelize');module[_0xa99c('0x0')]={'name':{'type':Sequelize[_0xa99c('0x1')]},'description':{'type':Sequelize[_0xa99c('0x1')]},'ticketType':{'type':Sequelize[_0xa99c('0x2')](_0xa99c('0x3'),'phonecall'),'defaultValue':_0xa99c('0x3')},'moduleCreate':{'type':Sequelize[_0xa99c('0x2')](_0xa99c('0x4'),_0xa99c('0x5')),'defaultValue':_0xa99c('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa99c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa99c('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa5a3=['STRING','ENUM','incident','contact','sequelize','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa5a3,0x9a));var _0x3a5a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa5a3[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x3a5a('0x0'));module[_0x3a5a('0x1')]={'name':{'type':Sequelize[_0x3a5a('0x2')]},'description':{'type':Sequelize[_0x3a5a('0x2')]},'ticketType':{'type':Sequelize[_0x3a5a('0x3')](_0x3a5a('0x4'),'phonecall'),'defaultValue':_0x3a5a('0x4')},'moduleCreate':{'type':Sequelize[_0x3a5a('0x3')](_0x3a5a('0x5'),'nothing'),'defaultValue':_0x3a5a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 348892a..6d885a6 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 _0xd6a1=['sox','to-csv','fs-extra','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','end','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','find','create','update','params','body','destroy','getFields','Dynamics365Field','length','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xd6a1,0x1b5));var _0x1d6a=function(_0x5085ea,_0x34714c){_0x5085ea=_0x5085ea-0x0;var _0x1f7a7a=_0xd6a1[_0x5085ea];return _0x1f7a7a;};'use strict';var emlformat=require(_0x1d6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d6a('0x1'));var jsonpatch=require(_0x1d6a('0x2'));var rp=require(_0x1d6a('0x3'));var moment=require(_0x1d6a('0x4'));var BPromise=require(_0x1d6a('0x5'));var Mustache=require('mustache');var util=require(_0x1d6a('0x6'));var path=require('path');var sox=require(_0x1d6a('0x7'));var csv=require(_0x1d6a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d6a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d6a('0x8'));var querystring=require('querystring');var Papa=require(_0x1d6a('0xb'));var Redis=require('ioredis');var authService=require(_0x1d6a('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1d6a('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d6a('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x1d6a('0xf'));var licenseUtil=require(_0x1d6a('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29879c,_0x700b89){_0x700b89=_0x700b89||0xcc;return function(_0x1dbd7b){if(_0x1dbd7b){return _0x29879c[_0x1d6a('0x11')](_0x700b89);}return _0x29879c[_0x1d6a('0x12')](_0x700b89)['end']();};}function respondWithResult(_0x1d093d,_0x81e7aa){_0x81e7aa=_0x81e7aa||0xc8;return function(_0x353d4c){if(_0x353d4c){return _0x1d093d[_0x1d6a('0x12')](_0x81e7aa)[_0x1d6a('0x13')](_0x353d4c);}};}function respondWithFilteredResult(_0x1851ed,_0x4be16d){return function(_0x4169ca){if(_0x4169ca){var _0x22cd9c=typeof _0x4be16d['offset']===_0x1d6a('0x14')&&typeof _0x4be16d[_0x1d6a('0x15')]===_0x1d6a('0x14');var _0x55b465=_0x4169ca[_0x1d6a('0x16')];var _0x36225b=_0x22cd9c?0x0:_0x4be16d[_0x1d6a('0x17')];var _0x5f3a93=_0x22cd9c?_0x4169ca[_0x1d6a('0x16')]:_0x4be16d[_0x1d6a('0x17')]+_0x4be16d[_0x1d6a('0x15')];var _0x4c62bc;if(_0x5f3a93>=_0x55b465){_0x5f3a93=_0x55b465;_0x4c62bc=0xc8;}else{_0x4c62bc=0xce;}_0x1851ed[_0x1d6a('0x12')](_0x4c62bc);return _0x1851ed[_0x1d6a('0x18')](_0x1d6a('0x19'),_0x36225b+'-'+_0x5f3a93+'/'+_0x55b465)[_0x1d6a('0x13')](_0x4169ca);}return null;};}function patchUpdates(_0x4cb95c){return function(_0x12f075){try{jsonpatch[_0x1d6a('0x1a')](_0x12f075,_0x4cb95c,!![]);}catch(_0x363ad8){return BPromise['reject'](_0x363ad8);}return _0x12f075[_0x1d6a('0x1b')]();};}function saveUpdates(_0x2f6225,_0x4e40b9){return function(_0x3695e8){if(_0x3695e8){return _0x3695e8['update'](_0x2f6225)[_0x1d6a('0x1c')](function(_0x29ab37){return _0x29ab37;});}return null;};}function removeEntity(_0x4d896a,_0x1f054b){return function(_0x3b00d9){if(_0x3b00d9){return _0x3b00d9['destroy']()['then'](function(){_0x4d896a['status'](0xcc)[_0x1d6a('0x1d')]();});}};}function handleEntityNotFound(_0x4f7757,_0x16a6dc){return function(_0x1730e7){if(!_0x1730e7){_0x4f7757[_0x1d6a('0x11')](0x194);}return _0x1730e7;};}function handleError(_0x23a364,_0x545611){_0x545611=_0x545611||0x1f4;return function(_0x2f7dd5){logger[_0x1d6a('0x1e')](_0x2f7dd5[_0x1d6a('0x1f')]);if(_0x2f7dd5[_0x1d6a('0x20')]){delete _0x2f7dd5[_0x1d6a('0x20')];}_0x23a364[_0x1d6a('0x12')](_0x545611)[_0x1d6a('0x21')](_0x2f7dd5);};}exports['index']=function(_0x4ecc53,_0x5b6ed6){var _0x51d5e1={},_0x27945c={},_0x51cb3e={'count':0x0,'rows':[]};var _0x4dc39c=_[_0x1d6a('0x22')](db[_0x1d6a('0x23')][_0x1d6a('0x24')],function(_0x47d26b){return{'name':_0x47d26b[_0x1d6a('0x25')],'type':_0x47d26b['type'][_0x1d6a('0x26')]};});_0x27945c[_0x1d6a('0x27')]=_[_0x1d6a('0x22')](_0x4dc39c,_0x1d6a('0x20'));_0x27945c[_0x1d6a('0x28')]=_[_0x1d6a('0x29')](_0x4ecc53['query']);_0x27945c[_0x1d6a('0x2a')]=_[_0x1d6a('0x2b')](_0x27945c[_0x1d6a('0x27')],_0x27945c['query']);_0x51d5e1['attributes']=_[_0x1d6a('0x2b')](_0x27945c[_0x1d6a('0x27')],qs[_0x1d6a('0x2c')](_0x4ecc53['query'][_0x1d6a('0x2c')]));_0x51d5e1[_0x1d6a('0x2d')]=_0x51d5e1[_0x1d6a('0x2d')]['length']?_0x51d5e1['attributes']:_0x27945c[_0x1d6a('0x27')];if(!_0x4ecc53[_0x1d6a('0x28')][_0x1d6a('0x2e')](_0x1d6a('0x2f'))){_0x51d5e1[_0x1d6a('0x15')]=qs['limit'](_0x4ecc53[_0x1d6a('0x28')]['limit']);_0x51d5e1[_0x1d6a('0x17')]=qs['offset'](_0x4ecc53[_0x1d6a('0x28')]['offset']);}_0x51d5e1[_0x1d6a('0x30')]=qs[_0x1d6a('0x31')](_0x4ecc53[_0x1d6a('0x28')][_0x1d6a('0x31')]);_0x51d5e1['where']=qs['filters'](_[_0x1d6a('0x32')](_0x4ecc53[_0x1d6a('0x28')],_0x27945c[_0x1d6a('0x2a')]),_0x4dc39c);if(_0x4ecc53[_0x1d6a('0x28')]['filter']){_0x51d5e1[_0x1d6a('0x33')]=_['merge'](_0x51d5e1[_0x1d6a('0x33')],{'$or':_[_0x1d6a('0x22')](_0x4dc39c,function(_0x12c0ea){if(_0x12c0ea[_0x1d6a('0x34')]!==_0x1d6a('0x35')){var _0x452902={};_0x452902[_0x12c0ea[_0x1d6a('0x20')]]={'$like':'%'+_0x4ecc53['query'][_0x1d6a('0x36')]+'%'};return _0x452902;}})});}_0x51d5e1=_[_0x1d6a('0x37')]({},_0x51d5e1,_0x4ecc53[_0x1d6a('0x38')]);var _0x5ae8a9={'where':_0x51d5e1['where']};return db['Dynamics365Configuration']['count'](_0x5ae8a9)[_0x1d6a('0x1c')](function(_0xc65151){_0x51cb3e[_0x1d6a('0x16')]=_0xc65151;if(_0x4ecc53['query'][_0x1d6a('0x39')]){_0x51d5e1['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x1d6a('0x3a')](_0x51d5e1);})['then'](function(_0x144cab){_0x51cb3e[_0x1d6a('0x3b')]=_0x144cab;return _0x51cb3e;})[_0x1d6a('0x1c')](respondWithFilteredResult(_0x5b6ed6,_0x51d5e1))[_0x1d6a('0x3c')](handleError(_0x5b6ed6,null));};exports[_0x1d6a('0x3d')]=function(_0x46ef22,_0xaf3dfa){var _0x556d58={'raw':![],'where':{'id':_0x46ef22['params']['id']}},_0x40787c={};_0x40787c['model']=_[_0x1d6a('0x29')](db[_0x1d6a('0x23')][_0x1d6a('0x24')]);_0x40787c[_0x1d6a('0x28')]=_[_0x1d6a('0x29')](_0x46ef22['query']);_0x40787c['filters']=_[_0x1d6a('0x2b')](_0x40787c[_0x1d6a('0x27')],_0x40787c[_0x1d6a('0x28')]);_0x556d58['attributes']=_[_0x1d6a('0x2b')](_0x40787c[_0x1d6a('0x27')],qs[_0x1d6a('0x2c')](_0x46ef22[_0x1d6a('0x28')][_0x1d6a('0x2c')]));_0x556d58[_0x1d6a('0x2d')]=_0x556d58[_0x1d6a('0x2d')]['length']?_0x556d58[_0x1d6a('0x2d')]:_0x40787c['model'];if(_0x46ef22[_0x1d6a('0x28')][_0x1d6a('0x39')]){_0x556d58['include']=[{'all':!![]}];}_0x556d58=_[_0x1d6a('0x37')]({},_0x556d58,_0x46ef22[_0x1d6a('0x38')]);return db[_0x1d6a('0x23')][_0x1d6a('0x3e')](_0x556d58)[_0x1d6a('0x1c')](handleEntityNotFound(_0xaf3dfa,null))['then'](respondWithResult(_0xaf3dfa,null))[_0x1d6a('0x3c')](handleError(_0xaf3dfa,null));};exports['create']=function(_0x45cc88,_0x2b0bdb){return db[_0x1d6a('0x23')][_0x1d6a('0x3f')](_0x45cc88['body'],{})['then'](respondWithResult(_0x2b0bdb,0xc9))[_0x1d6a('0x3c')](handleError(_0x2b0bdb,null));};exports[_0x1d6a('0x40')]=function(_0x3a5dde,_0x16cfac){if(_0x3a5dde['body']['id']){delete _0x3a5dde['body']['id'];}return db['Dynamics365Configuration'][_0x1d6a('0x3e')]({'where':{'id':_0x3a5dde[_0x1d6a('0x41')]['id']}})[_0x1d6a('0x1c')](handleEntityNotFound(_0x16cfac,null))[_0x1d6a('0x1c')](saveUpdates(_0x3a5dde[_0x1d6a('0x42')],null))[_0x1d6a('0x1c')](respondWithResult(_0x16cfac,null))['catch'](handleError(_0x16cfac,null));};exports[_0x1d6a('0x43')]=function(_0x168592,_0x2b8432){return db['Dynamics365Configuration'][_0x1d6a('0x3e')]({'where':{'id':_0x168592[_0x1d6a('0x41')]['id']}})[_0x1d6a('0x1c')](handleEntityNotFound(_0x2b8432,null))['then'](removeEntity(_0x2b8432,null))[_0x1d6a('0x3c')](handleError(_0x2b8432,null));};exports[_0x1d6a('0x44')]=function(_0x13f60f,_0x1217b3,_0x15c2c2){var _0x5b07eb={};var _0x58e388={};var _0x5ab047;var _0x2e86c1;return db[_0x1d6a('0x23')]['findOne']({'where':{'id':_0x13f60f['params']['id']}})[_0x1d6a('0x1c')](handleEntityNotFound(_0x1217b3,null))['then'](function(_0x24403c){if(_0x24403c){_0x5ab047=_0x24403c;_0x58e388[_0x1d6a('0x27')]=_['keys'](db[_0x1d6a('0x45')][_0x1d6a('0x24')]);_0x58e388[_0x1d6a('0x28')]=_[_0x1d6a('0x29')](_0x13f60f[_0x1d6a('0x28')]);_0x58e388[_0x1d6a('0x2a')]=_['intersection'](_0x58e388[_0x1d6a('0x27')],_0x58e388['query']);_0x5b07eb[_0x1d6a('0x2d')]=_[_0x1d6a('0x2b')](_0x58e388[_0x1d6a('0x27')],qs[_0x1d6a('0x2c')](_0x13f60f['query'][_0x1d6a('0x2c')]));_0x5b07eb[_0x1d6a('0x2d')]=_0x5b07eb['attributes'][_0x1d6a('0x46')]?_0x5b07eb[_0x1d6a('0x2d')]:_0x58e388[_0x1d6a('0x27')];_0x5b07eb[_0x1d6a('0x30')]=qs[_0x1d6a('0x31')](_0x13f60f[_0x1d6a('0x28')][_0x1d6a('0x31')]);_0x5b07eb['where']=qs['filters'](_[_0x1d6a('0x32')](_0x13f60f[_0x1d6a('0x28')],_0x58e388[_0x1d6a('0x2a')]));if(_0x13f60f[_0x1d6a('0x28')][_0x1d6a('0x36')]){_0x5b07eb[_0x1d6a('0x33')]=_['merge'](_0x5b07eb[_0x1d6a('0x33')],{'$or':_[_0x1d6a('0x22')](_0x5b07eb[_0x1d6a('0x2d')],function(_0x42ebf2){var _0x5a2c6d={};_0x5a2c6d[_0x42ebf2]={'$like':'%'+_0x13f60f[_0x1d6a('0x28')][_0x1d6a('0x36')]+'%'};return _0x5a2c6d;})});}_0x5b07eb=_['merge']({},_0x5b07eb,_0x13f60f[_0x1d6a('0x38')]);return _0x5ab047[_0x1d6a('0x44')](_0x5b07eb);}})['then'](function(_0x363cf9){if(_0x363cf9){_0x2e86c1=_0x363cf9[_0x1d6a('0x46')];if(!_0x13f60f['query'][_0x1d6a('0x2e')](_0x1d6a('0x2f'))){_0x5b07eb[_0x1d6a('0x15')]=qs['limit'](_0x13f60f[_0x1d6a('0x28')]['limit']);_0x5b07eb[_0x1d6a('0x17')]=qs[_0x1d6a('0x17')](_0x13f60f['query']['offset']);}return _0x5ab047[_0x1d6a('0x44')](_0x5b07eb);}})['then'](function(_0x47a4f9){if(_0x47a4f9){return _0x47a4f9?{'count':_0x2e86c1,'rows':_0x47a4f9}:null;}})['then'](respondWithResult(_0x1217b3,null))[_0x1d6a('0x3c')](handleError(_0x1217b3,null));};exports[_0x1d6a('0x47')]=function(_0x4a3971,_0xc1be4f,_0x1357a5){var _0x17317c={};var _0x2cc9ad={};var _0x49f9d8;var _0x469978;return db[_0x1d6a('0x23')][_0x1d6a('0x48')]({'where':{'id':_0x4a3971['params']['id']}})[_0x1d6a('0x1c')](handleEntityNotFound(_0xc1be4f,null))['then'](function(_0x3e957d){if(_0x3e957d){_0x49f9d8=_0x3e957d;_0x2cc9ad['model']=_['keys'](db[_0x1d6a('0x45')][_0x1d6a('0x24')]);_0x2cc9ad[_0x1d6a('0x28')]=_[_0x1d6a('0x29')](_0x4a3971['query']);_0x2cc9ad[_0x1d6a('0x2a')]=_[_0x1d6a('0x2b')](_0x2cc9ad[_0x1d6a('0x27')],_0x2cc9ad[_0x1d6a('0x28')]);_0x17317c['attributes']=_[_0x1d6a('0x2b')](_0x2cc9ad[_0x1d6a('0x27')],qs[_0x1d6a('0x2c')](_0x4a3971[_0x1d6a('0x28')][_0x1d6a('0x2c')]));_0x17317c['attributes']=_0x17317c[_0x1d6a('0x2d')][_0x1d6a('0x46')]?_0x17317c[_0x1d6a('0x2d')]:_0x2cc9ad[_0x1d6a('0x27')];_0x17317c[_0x1d6a('0x30')]=qs[_0x1d6a('0x31')](_0x4a3971[_0x1d6a('0x28')][_0x1d6a('0x31')]);_0x17317c['where']=qs[_0x1d6a('0x2a')](_[_0x1d6a('0x32')](_0x4a3971[_0x1d6a('0x28')],_0x2cc9ad[_0x1d6a('0x2a')]));if(_0x4a3971[_0x1d6a('0x28')][_0x1d6a('0x36')]){_0x17317c[_0x1d6a('0x33')]=_[_0x1d6a('0x37')](_0x17317c[_0x1d6a('0x33')],{'$or':_[_0x1d6a('0x22')](_0x17317c['attributes'],function(_0x1a4f29){var _0x3f73bb={};_0x3f73bb[_0x1a4f29]={'$like':'%'+_0x4a3971[_0x1d6a('0x28')][_0x1d6a('0x36')]+'%'};return _0x3f73bb;})});}_0x17317c=_['merge']({},_0x17317c,_0x4a3971['options']);return _0x49f9d8[_0x1d6a('0x47')](_0x17317c);}})['then'](function(_0x2a618f){if(_0x2a618f){_0x469978=_0x2a618f[_0x1d6a('0x46')];if(!_0x4a3971[_0x1d6a('0x28')][_0x1d6a('0x2e')](_0x1d6a('0x2f'))){_0x17317c[_0x1d6a('0x15')]=qs[_0x1d6a('0x15')](_0x4a3971['query'][_0x1d6a('0x15')]);_0x17317c[_0x1d6a('0x17')]=qs['offset'](_0x4a3971[_0x1d6a('0x28')]['offset']);}return _0x49f9d8[_0x1d6a('0x47')](_0x17317c);}})[_0x1d6a('0x1c')](function(_0x2d24bc){if(_0x2d24bc){return _0x2d24bc?{'count':_0x469978,'rows':_0x2d24bc}:null;}})[_0x1d6a('0x1c')](respondWithResult(_0xc1be4f,null))[_0x1d6a('0x3c')](handleError(_0xc1be4f,null));};exports[_0x1d6a('0x49')]=function(_0x39814c,_0x4c940d,_0x4f5fb3){var _0x26033c={};var _0x31a399={};var _0x5c2747;var _0x538b96;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x39814c['params']['id']}})[_0x1d6a('0x1c')](handleEntityNotFound(_0x4c940d,null))[_0x1d6a('0x1c')](function(_0x137ad7){if(_0x137ad7){_0x5c2747=_0x137ad7;_0x31a399[_0x1d6a('0x27')]=_[_0x1d6a('0x29')](db['Dynamics365Field'][_0x1d6a('0x24')]);_0x31a399[_0x1d6a('0x28')]=_['keys'](_0x39814c[_0x1d6a('0x28')]);_0x31a399[_0x1d6a('0x2a')]=_['intersection'](_0x31a399[_0x1d6a('0x27')],_0x31a399[_0x1d6a('0x28')]);_0x26033c[_0x1d6a('0x2d')]=_['intersection'](_0x31a399[_0x1d6a('0x27')],qs[_0x1d6a('0x2c')](_0x39814c[_0x1d6a('0x28')][_0x1d6a('0x2c')]));_0x26033c[_0x1d6a('0x2d')]=_0x26033c[_0x1d6a('0x2d')][_0x1d6a('0x46')]?_0x26033c[_0x1d6a('0x2d')]:_0x31a399[_0x1d6a('0x27')];_0x26033c[_0x1d6a('0x30')]=qs[_0x1d6a('0x31')](_0x39814c[_0x1d6a('0x28')][_0x1d6a('0x31')]);_0x26033c[_0x1d6a('0x33')]=qs[_0x1d6a('0x2a')](_[_0x1d6a('0x32')](_0x39814c[_0x1d6a('0x28')],_0x31a399['filters']));if(_0x39814c['query'][_0x1d6a('0x36')]){_0x26033c[_0x1d6a('0x33')]=_[_0x1d6a('0x37')](_0x26033c[_0x1d6a('0x33')],{'$or':_[_0x1d6a('0x22')](_0x26033c[_0x1d6a('0x2d')],function(_0x1b1445){var _0x484665={};_0x484665[_0x1b1445]={'$like':'%'+_0x39814c[_0x1d6a('0x28')]['filter']+'%'};return _0x484665;})});}_0x26033c=_[_0x1d6a('0x37')]({},_0x26033c,_0x39814c[_0x1d6a('0x38')]);return _0x5c2747[_0x1d6a('0x49')](_0x26033c);}})[_0x1d6a('0x1c')](function(_0x3b7af8){if(_0x3b7af8){_0x538b96=_0x3b7af8[_0x1d6a('0x46')];if(!_0x39814c['query']['hasOwnProperty'](_0x1d6a('0x2f'))){_0x26033c[_0x1d6a('0x15')]=qs[_0x1d6a('0x15')](_0x39814c[_0x1d6a('0x28')]['limit']);_0x26033c['offset']=qs[_0x1d6a('0x17')](_0x39814c['query'][_0x1d6a('0x17')]);}return _0x5c2747[_0x1d6a('0x49')](_0x26033c);}})['then'](function(_0x2c8986){if(_0x2c8986){return _0x2c8986?{'count':_0x538b96,'rows':_0x2c8986}:null;}})[_0x1d6a('0x1c')](respondWithResult(_0x4c940d,null))['catch'](handleError(_0x4c940d,null));}; \ No newline at end of file +var _0x48d2=['show','length','create','body','update','find','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x48d2,0x150));var _0x248d=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x48d2[_0x245afe];return _0x4eefde;};'use strict';var emlformat=require(_0x248d('0x0'));var rimraf=require(_0x248d('0x1'));var zipdir=require(_0x248d('0x2'));var jsonpatch=require(_0x248d('0x3'));var rp=require(_0x248d('0x4'));var moment=require(_0x248d('0x5'));var BPromise=require(_0x248d('0x6'));var Mustache=require('mustache');var util=require(_0x248d('0x7'));var path=require('path');var sox=require(_0x248d('0x8'));var csv=require(_0x248d('0x9'));var ejs=require(_0x248d('0xa'));var fs=require('fs');var fs_extra=require(_0x248d('0xb'));var _=require(_0x248d('0xc'));var squel=require(_0x248d('0xd'));var crypto=require('crypto');var jsforce=require(_0x248d('0xe'));var deskjs=require(_0x248d('0xf'));var toCsv=require(_0x248d('0x9'));var querystring=require(_0x248d('0x10'));var Papa=require(_0x248d('0x11'));var Redis=require(_0x248d('0x12'));var authService=require(_0x248d('0x13'));var qs=require(_0x248d('0x14'));var as=require(_0x248d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x248d('0x16'))(_0x248d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x248d('0x18'));var db=require(_0x248d('0x19'))['db'];function respondWithStatusCode(_0x429440,_0x3df755){_0x3df755=_0x3df755||0xcc;return function(_0x4a5a44){if(_0x4a5a44){return _0x429440[_0x248d('0x1a')](_0x3df755);}return _0x429440[_0x248d('0x1b')](_0x3df755)[_0x248d('0x1c')]();};}function respondWithResult(_0x5e169c,_0x39cbf4){_0x39cbf4=_0x39cbf4||0xc8;return function(_0x175c18){if(_0x175c18){return _0x5e169c[_0x248d('0x1b')](_0x39cbf4)[_0x248d('0x1d')](_0x175c18);}};}function respondWithFilteredResult(_0x133071,_0x5037f8){return function(_0x38b120){if(_0x38b120){var _0x2caff6=typeof _0x5037f8[_0x248d('0x1e')]==='undefined'&&typeof _0x5037f8[_0x248d('0x1f')]===_0x248d('0x20');var _0xa168a3=_0x38b120[_0x248d('0x21')];var _0x4283cf=_0x2caff6?0x0:_0x5037f8['offset'];var _0x402291=_0x2caff6?_0x38b120['count']:_0x5037f8['offset']+_0x5037f8[_0x248d('0x1f')];var _0x5182d1;if(_0x402291>=_0xa168a3){_0x402291=_0xa168a3;_0x5182d1=0xc8;}else{_0x5182d1=0xce;}_0x133071[_0x248d('0x1b')](_0x5182d1);return _0x133071[_0x248d('0x22')](_0x248d('0x23'),_0x4283cf+'-'+_0x402291+'/'+_0xa168a3)[_0x248d('0x1d')](_0x38b120);}return null;};}function patchUpdates(_0x694a34){return function(_0xe8e135){try{jsonpatch[_0x248d('0x24')](_0xe8e135,_0x694a34,!![]);}catch(_0x476311){return BPromise[_0x248d('0x25')](_0x476311);}return _0xe8e135[_0x248d('0x26')]();};}function saveUpdates(_0x373430,_0x2d0b5a){return function(_0x5c9f07){if(_0x5c9f07){return _0x5c9f07['update'](_0x373430)[_0x248d('0x27')](function(_0x455542){return _0x455542;});}return null;};}function removeEntity(_0x598909,_0x3be45d){return function(_0x194797){if(_0x194797){return _0x194797[_0x248d('0x28')]()[_0x248d('0x27')](function(){_0x598909[_0x248d('0x1b')](0xcc)[_0x248d('0x1c')]();});}};}function handleEntityNotFound(_0xfc01b3,_0x39c2ff){return function(_0x4a1565){if(!_0x4a1565){_0xfc01b3[_0x248d('0x1a')](0x194);}return _0x4a1565;};}function handleError(_0x5d7cbe,_0x134ade){_0x134ade=_0x134ade||0x1f4;return function(_0x2c4824){logger['error'](_0x2c4824['stack']);if(_0x2c4824['name']){delete _0x2c4824[_0x248d('0x29')];}_0x5d7cbe[_0x248d('0x1b')](_0x134ade)['send'](_0x2c4824);};}exports[_0x248d('0x2a')]=function(_0x294d9e,_0x146fd8){var _0xee10f5={},_0xfafbc={},_0x575fb8={'count':0x0,'rows':[]};var _0x6c67dd=_['map'](db[_0x248d('0x2b')][_0x248d('0x2c')],function(_0x187a1b){return{'name':_0x187a1b[_0x248d('0x2d')],'type':_0x187a1b[_0x248d('0x2e')][_0x248d('0x2f')]};});_0xfafbc[_0x248d('0x30')]=_[_0x248d('0x31')](_0x6c67dd,_0x248d('0x29'));_0xfafbc[_0x248d('0x32')]=_[_0x248d('0x33')](_0x294d9e[_0x248d('0x32')]);_0xfafbc[_0x248d('0x34')]=_[_0x248d('0x35')](_0xfafbc[_0x248d('0x30')],_0xfafbc[_0x248d('0x32')]);_0xee10f5[_0x248d('0x36')]=_[_0x248d('0x35')](_0xfafbc[_0x248d('0x30')],qs[_0x248d('0x37')](_0x294d9e[_0x248d('0x32')][_0x248d('0x37')]));_0xee10f5[_0x248d('0x36')]=_0xee10f5['attributes']['length']?_0xee10f5[_0x248d('0x36')]:_0xfafbc[_0x248d('0x30')];if(!_0x294d9e[_0x248d('0x32')][_0x248d('0x38')](_0x248d('0x39'))){_0xee10f5[_0x248d('0x1f')]=qs[_0x248d('0x1f')](_0x294d9e[_0x248d('0x32')][_0x248d('0x1f')]);_0xee10f5[_0x248d('0x1e')]=qs['offset'](_0x294d9e['query'][_0x248d('0x1e')]);}_0xee10f5[_0x248d('0x3a')]=qs['sort'](_0x294d9e[_0x248d('0x32')][_0x248d('0x3b')]);_0xee10f5[_0x248d('0x3c')]=qs[_0x248d('0x34')](_[_0x248d('0x3d')](_0x294d9e['query'],_0xfafbc['filters']),_0x6c67dd);if(_0x294d9e[_0x248d('0x32')][_0x248d('0x3e')]){_0xee10f5[_0x248d('0x3c')]=_[_0x248d('0x3f')](_0xee10f5['where'],{'$or':_[_0x248d('0x31')](_0x6c67dd,function(_0x402f71){if(_0x402f71[_0x248d('0x2e')]!=='VIRTUAL'){var _0x4dd7c5={};_0x4dd7c5[_0x402f71[_0x248d('0x29')]]={'$like':'%'+_0x294d9e[_0x248d('0x32')][_0x248d('0x3e')]+'%'};return _0x4dd7c5;}})});}_0xee10f5=_[_0x248d('0x3f')]({},_0xee10f5,_0x294d9e[_0x248d('0x40')]);var _0x1abe24={'where':_0xee10f5[_0x248d('0x3c')]};return db['Dynamics365Configuration'][_0x248d('0x21')](_0x1abe24)[_0x248d('0x27')](function(_0x1aaa9b){_0x575fb8['count']=_0x1aaa9b;if(_0x294d9e['query'][_0x248d('0x41')]){_0xee10f5[_0x248d('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0xee10f5);})[_0x248d('0x27')](function(_0x3abe79){_0x575fb8[_0x248d('0x43')]=_0x3abe79;return _0x575fb8;})[_0x248d('0x27')](respondWithFilteredResult(_0x146fd8,_0xee10f5))[_0x248d('0x44')](handleError(_0x146fd8,null));};exports[_0x248d('0x45')]=function(_0x112a8f,_0x5b30f8){var _0x4537b1={'raw':![],'where':{'id':_0x112a8f['params']['id']}},_0x1bdb8b={};_0x1bdb8b[_0x248d('0x30')]=_[_0x248d('0x33')](db[_0x248d('0x2b')]['rawAttributes']);_0x1bdb8b['query']=_['keys'](_0x112a8f['query']);_0x1bdb8b[_0x248d('0x34')]=_[_0x248d('0x35')](_0x1bdb8b['model'],_0x1bdb8b[_0x248d('0x32')]);_0x4537b1['attributes']=_[_0x248d('0x35')](_0x1bdb8b[_0x248d('0x30')],qs[_0x248d('0x37')](_0x112a8f['query'][_0x248d('0x37')]));_0x4537b1['attributes']=_0x4537b1['attributes'][_0x248d('0x46')]?_0x4537b1[_0x248d('0x36')]:_0x1bdb8b[_0x248d('0x30')];if(_0x112a8f[_0x248d('0x32')]['includeAll']){_0x4537b1[_0x248d('0x42')]=[{'all':!![]}];}_0x4537b1=_[_0x248d('0x3f')]({},_0x4537b1,_0x112a8f[_0x248d('0x40')]);return db[_0x248d('0x2b')]['find'](_0x4537b1)[_0x248d('0x27')](handleEntityNotFound(_0x5b30f8,null))[_0x248d('0x27')](respondWithResult(_0x5b30f8,null))['catch'](handleError(_0x5b30f8,null));};exports[_0x248d('0x47')]=function(_0xec9bd1,_0xe66628){return db[_0x248d('0x2b')][_0x248d('0x47')](_0xec9bd1[_0x248d('0x48')],{})[_0x248d('0x27')](respondWithResult(_0xe66628,0xc9))['catch'](handleError(_0xe66628,null));};exports[_0x248d('0x49')]=function(_0x2df149,_0x1dee8a){if(_0x2df149[_0x248d('0x48')]['id']){delete _0x2df149[_0x248d('0x48')]['id'];}return db[_0x248d('0x2b')][_0x248d('0x4a')]({'where':{'id':_0x2df149[_0x248d('0x4b')]['id']}})[_0x248d('0x27')](handleEntityNotFound(_0x1dee8a,null))[_0x248d('0x27')](saveUpdates(_0x2df149[_0x248d('0x48')],null))[_0x248d('0x27')](respondWithResult(_0x1dee8a,null))['catch'](handleError(_0x1dee8a,null));};exports[_0x248d('0x28')]=function(_0x4eb7d6,_0x232cab){return db[_0x248d('0x2b')][_0x248d('0x4a')]({'where':{'id':_0x4eb7d6['params']['id']}})[_0x248d('0x27')](handleEntityNotFound(_0x232cab,null))['then'](removeEntity(_0x232cab,null))[_0x248d('0x44')](handleError(_0x232cab,null));};exports[_0x248d('0x4c')]=function(_0x3d469d,_0x5924f9,_0x619db7){var _0x58c7ee={};var _0x1a6860={};var _0x2b6017;var _0x2d9932;return db[_0x248d('0x2b')][_0x248d('0x4d')]({'where':{'id':_0x3d469d['params']['id']}})['then'](handleEntityNotFound(_0x5924f9,null))[_0x248d('0x27')](function(_0xd9487b){if(_0xd9487b){_0x2b6017=_0xd9487b;_0x1a6860[_0x248d('0x30')]=_['keys'](db[_0x248d('0x4e')][_0x248d('0x2c')]);_0x1a6860['query']=_[_0x248d('0x33')](_0x3d469d[_0x248d('0x32')]);_0x1a6860[_0x248d('0x34')]=_[_0x248d('0x35')](_0x1a6860[_0x248d('0x30')],_0x1a6860['query']);_0x58c7ee[_0x248d('0x36')]=_[_0x248d('0x35')](_0x1a6860[_0x248d('0x30')],qs[_0x248d('0x37')](_0x3d469d[_0x248d('0x32')][_0x248d('0x37')]));_0x58c7ee['attributes']=_0x58c7ee[_0x248d('0x36')][_0x248d('0x46')]?_0x58c7ee[_0x248d('0x36')]:_0x1a6860[_0x248d('0x30')];_0x58c7ee[_0x248d('0x3a')]=qs['sort'](_0x3d469d[_0x248d('0x32')][_0x248d('0x3b')]);_0x58c7ee[_0x248d('0x3c')]=qs[_0x248d('0x34')](_[_0x248d('0x3d')](_0x3d469d[_0x248d('0x32')],_0x1a6860[_0x248d('0x34')]));if(_0x3d469d['query'][_0x248d('0x3e')]){_0x58c7ee[_0x248d('0x3c')]=_[_0x248d('0x3f')](_0x58c7ee[_0x248d('0x3c')],{'$or':_[_0x248d('0x31')](_0x58c7ee['attributes'],function(_0x3e2c45){var _0x51c669={};_0x51c669[_0x3e2c45]={'$like':'%'+_0x3d469d[_0x248d('0x32')][_0x248d('0x3e')]+'%'};return _0x51c669;})});}_0x58c7ee=_[_0x248d('0x3f')]({},_0x58c7ee,_0x3d469d['options']);return _0x2b6017['getFields'](_0x58c7ee);}})['then'](function(_0xcf8381){if(_0xcf8381){_0x2d9932=_0xcf8381[_0x248d('0x46')];if(!_0x3d469d[_0x248d('0x32')]['hasOwnProperty'](_0x248d('0x39'))){_0x58c7ee['limit']=qs[_0x248d('0x1f')](_0x3d469d[_0x248d('0x32')]['limit']);_0x58c7ee[_0x248d('0x1e')]=qs[_0x248d('0x1e')](_0x3d469d[_0x248d('0x32')][_0x248d('0x1e')]);}return _0x2b6017['getFields'](_0x58c7ee);}})[_0x248d('0x27')](function(_0x4a9457){if(_0x4a9457){return _0x4a9457?{'count':_0x2d9932,'rows':_0x4a9457}:null;}})[_0x248d('0x27')](respondWithResult(_0x5924f9,null))[_0x248d('0x44')](handleError(_0x5924f9,null));};exports[_0x248d('0x4f')]=function(_0x8066cb,_0x3e7d63,_0x27f7f4){var _0x1528c7={};var _0x54e4d5={};var _0x1ed741;var _0x45e620;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x8066cb[_0x248d('0x4b')]['id']}})[_0x248d('0x27')](handleEntityNotFound(_0x3e7d63,null))[_0x248d('0x27')](function(_0x3a41dc){if(_0x3a41dc){_0x1ed741=_0x3a41dc;_0x54e4d5[_0x248d('0x30')]=_['keys'](db[_0x248d('0x4e')][_0x248d('0x2c')]);_0x54e4d5[_0x248d('0x32')]=_[_0x248d('0x33')](_0x8066cb[_0x248d('0x32')]);_0x54e4d5[_0x248d('0x34')]=_['intersection'](_0x54e4d5['model'],_0x54e4d5[_0x248d('0x32')]);_0x1528c7[_0x248d('0x36')]=_[_0x248d('0x35')](_0x54e4d5[_0x248d('0x30')],qs[_0x248d('0x37')](_0x8066cb[_0x248d('0x32')]['fields']));_0x1528c7[_0x248d('0x36')]=_0x1528c7[_0x248d('0x36')]['length']?_0x1528c7[_0x248d('0x36')]:_0x54e4d5[_0x248d('0x30')];_0x1528c7['order']=qs[_0x248d('0x3b')](_0x8066cb[_0x248d('0x32')][_0x248d('0x3b')]);_0x1528c7[_0x248d('0x3c')]=qs[_0x248d('0x34')](_[_0x248d('0x3d')](_0x8066cb['query'],_0x54e4d5[_0x248d('0x34')]));if(_0x8066cb[_0x248d('0x32')][_0x248d('0x3e')]){_0x1528c7[_0x248d('0x3c')]=_[_0x248d('0x3f')](_0x1528c7['where'],{'$or':_['map'](_0x1528c7[_0x248d('0x36')],function(_0x1c0a61){var _0x1d1ebf={};_0x1d1ebf[_0x1c0a61]={'$like':'%'+_0x8066cb['query']['filter']+'%'};return _0x1d1ebf;})});}_0x1528c7=_[_0x248d('0x3f')]({},_0x1528c7,_0x8066cb['options']);return _0x1ed741[_0x248d('0x4f')](_0x1528c7);}})['then'](function(_0x344abb){if(_0x344abb){_0x45e620=_0x344abb[_0x248d('0x46')];if(!_0x8066cb['query'][_0x248d('0x38')](_0x248d('0x39'))){_0x1528c7[_0x248d('0x1f')]=qs[_0x248d('0x1f')](_0x8066cb[_0x248d('0x32')][_0x248d('0x1f')]);_0x1528c7[_0x248d('0x1e')]=qs[_0x248d('0x1e')](_0x8066cb[_0x248d('0x32')][_0x248d('0x1e')]);}return _0x1ed741[_0x248d('0x4f')](_0x1528c7);}})[_0x248d('0x27')](function(_0x4f9db7){if(_0x4f9db7){return _0x4f9db7?{'count':_0x45e620,'rows':_0x4f9db7}:null;}})[_0x248d('0x27')](respondWithResult(_0x3e7d63,null))[_0x248d('0x44')](handleError(_0x3e7d63,null));};exports['getDescriptions']=function(_0x733f55,_0x528a79,_0x4022d1){var _0x42c9d3={};var _0x208c14={};var _0x7b478a;var _0x296000;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x733f55[_0x248d('0x4b')]['id']}})[_0x248d('0x27')](handleEntityNotFound(_0x528a79,null))[_0x248d('0x27')](function(_0x4fa689){if(_0x4fa689){_0x7b478a=_0x4fa689;_0x208c14[_0x248d('0x30')]=_[_0x248d('0x33')](db['Dynamics365Field'][_0x248d('0x2c')]);_0x208c14[_0x248d('0x32')]=_[_0x248d('0x33')](_0x733f55['query']);_0x208c14[_0x248d('0x34')]=_[_0x248d('0x35')](_0x208c14[_0x248d('0x30')],_0x208c14[_0x248d('0x32')]);_0x42c9d3[_0x248d('0x36')]=_[_0x248d('0x35')](_0x208c14['model'],qs['fields'](_0x733f55['query']['fields']));_0x42c9d3[_0x248d('0x36')]=_0x42c9d3['attributes'][_0x248d('0x46')]?_0x42c9d3[_0x248d('0x36')]:_0x208c14[_0x248d('0x30')];_0x42c9d3[_0x248d('0x3a')]=qs['sort'](_0x733f55[_0x248d('0x32')][_0x248d('0x3b')]);_0x42c9d3[_0x248d('0x3c')]=qs[_0x248d('0x34')](_[_0x248d('0x3d')](_0x733f55[_0x248d('0x32')],_0x208c14['filters']));if(_0x733f55[_0x248d('0x32')][_0x248d('0x3e')]){_0x42c9d3[_0x248d('0x3c')]=_[_0x248d('0x3f')](_0x42c9d3[_0x248d('0x3c')],{'$or':_['map'](_0x42c9d3['attributes'],function(_0x1ad33c){var _0x250e77={};_0x250e77[_0x1ad33c]={'$like':'%'+_0x733f55['query'][_0x248d('0x3e')]+'%'};return _0x250e77;})});}_0x42c9d3=_[_0x248d('0x3f')]({},_0x42c9d3,_0x733f55[_0x248d('0x40')]);return _0x7b478a[_0x248d('0x50')](_0x42c9d3);}})['then'](function(_0x1bc176){if(_0x1bc176){_0x296000=_0x1bc176[_0x248d('0x46')];if(!_0x733f55[_0x248d('0x32')][_0x248d('0x38')]('nolimit')){_0x42c9d3[_0x248d('0x1f')]=qs['limit'](_0x733f55[_0x248d('0x32')][_0x248d('0x1f')]);_0x42c9d3[_0x248d('0x1e')]=qs[_0x248d('0x1e')](_0x733f55[_0x248d('0x32')][_0x248d('0x1e')]);}return _0x7b478a[_0x248d('0x50')](_0x42c9d3);}})[_0x248d('0x27')](function(_0x53716e){if(_0x53716e){return _0x53716e?{'count':_0x296000,'rows':_0x53716e}:null;}})[_0x248d('0x27')](respondWithResult(_0x528a79,null))[_0x248d('0x44')](handleError(_0x528a79,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 75a3c9b..de50c44 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x262727,_0x27cc55){var _0x4cbaff=function(_0x2f96a1){while(--_0x2f96a1){_0x262727['push'](_0x262727['shift']());}};_0x4cbaff(++_0x27cc55);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xb4e6[_0x582d0b];return _0x2e93e1;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9a19,0x114));var _0x99a1=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x9a19[_0x503564];return _0x4be9fd;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index a49c629..24d2f33 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 _0x4631=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4631,0xd2));var _0x1463=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x4631[_0x96f74c];return _0x379222;};'use strict';var _=require(_0x1463('0x0'));var util=require(_0x1463('0x1'));var moment=require(_0x1463('0x2'));var BPromise=require(_0x1463('0x3'));var rs=require(_0x1463('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1463('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1463('0x6'))(_0x1463('0x7'));var config=require(_0x1463('0x8'));var jayson=require(_0x1463('0x9'));var client=jayson['client'][_0x1463('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f8d29,_0x58cf20,_0x3946fd){return new BPromise(function(_0x474db8,_0x1b2ce4){return client[_0x1463('0xb')](_0x4f8d29,_0x3946fd)[_0x1463('0xc')](function(_0x680ae0){logger['info'](_0x1463('0xd'),_0x58cf20,_0x1463('0xe'));logger[_0x1463('0xf')](_0x1463('0x10'),_0x58cf20,_0x1463('0xe'),JSON['stringify'](_0x680ae0));if(_0x680ae0[_0x1463('0x11')]){if(_0x680ae0[_0x1463('0x11')][_0x1463('0x12')]===0x1f4){logger['error'](_0x1463('0xd'),_0x58cf20,_0x680ae0[_0x1463('0x11')]['message']);return _0x1b2ce4(_0x680ae0[_0x1463('0x11')][_0x1463('0x13')]);}logger[_0x1463('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58cf20,_0x680ae0[_0x1463('0x11')][_0x1463('0x13')]);return _0x474db8(_0x680ae0['error']['message']);}else{logger[_0x1463('0x14')](_0x1463('0xd'),_0x58cf20,_0x1463('0xe'));_0x474db8(_0x680ae0[_0x1463('0x15')][_0x1463('0x13')]);}})[_0x1463('0x16')](function(_0x47a15f){logger['error'](_0x1463('0xd'),_0x58cf20,_0x47a15f);_0x1b2ce4(_0x47a15f);});});} \ No newline at end of file +var _0x083c=['../../config/logger','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','ioredis'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x083c,0x1a0));var _0xc083=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x083c[_0x3fcc20];return _0x15d3ce;};'use strict';var _=require(_0xc083('0x0'));var util=require(_0xc083('0x1'));var moment=require('moment');var BPromise=require(_0xc083('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc083('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc083('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc083('0x5')][_0xc083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x336094,_0x13fc43,_0x4de043){return new BPromise(function(_0x5c2906,_0x125118){return client[_0xc083('0x7')](_0x336094,_0x4de043)[_0xc083('0x8')](function(_0x14ca7d){logger['info'](_0xc083('0x9'),_0x13fc43,'request\x20sent');logger[_0xc083('0xa')](_0xc083('0xb'),_0x13fc43,'request\x20sent',JSON[_0xc083('0xc')](_0x14ca7d));if(_0x14ca7d[_0xc083('0xd')]){if(_0x14ca7d[_0xc083('0xd')][_0xc083('0xe')]===0x1f4){logger[_0xc083('0xd')](_0xc083('0x9'),_0x13fc43,_0x14ca7d['error'][_0xc083('0xf')]);return _0x125118(_0x14ca7d[_0xc083('0xd')][_0xc083('0xf')]);}logger[_0xc083('0xd')](_0xc083('0x9'),_0x13fc43,_0x14ca7d[_0xc083('0xd')][_0xc083('0xf')]);return _0x5c2906(_0x14ca7d[_0xc083('0xd')][_0xc083('0xf')]);}else{logger[_0xc083('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x13fc43,_0xc083('0x11'));_0x5c2906(_0x14ca7d[_0xc083('0x12')][_0xc083('0xf')]);}})[_0xc083('0x13')](function(_0x2b6273){logger[_0xc083('0xd')](_0xc083('0x9'),_0x13fc43,_0x2b6273);_0x125118(_0x2b6273);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2c1ccb8..395972c 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 _0x0af2=['./intDynamics365Field.controller','isAuthenticated','get','/:id','show','post','create','put','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e14f7,_0x4210e4){var _0x415088=function(_0x276555){while(--_0x276555){_0x2e14f7['push'](_0x2e14f7['shift']());}};_0x415088(++_0x4210e4);}(_0x0af2,0xa2));var _0x20af=function(_0xe5d4c7,_0x3a7960){_0xe5d4c7=_0xe5d4c7-0x0;var _0x1d6bc4=_0x0af2[_0xe5d4c7];return _0x1d6bc4;};'use strict';var multer=require('multer');var util=require(_0x20af('0x0'));var path=require(_0x20af('0x1'));var timeout=require(_0x20af('0x2'));var express=require('express');var router=express[_0x20af('0x3')]();var fs_extra=require(_0x20af('0x4'));var auth=require(_0x20af('0x5'));var interaction=require(_0x20af('0x6'));var config=require(_0x20af('0x7'));var controller=require(_0x20af('0x8'));router['get']('/',auth[_0x20af('0x9')](),controller['index']);router[_0x20af('0xa')](_0x20af('0xb'),auth[_0x20af('0x9')](),controller[_0x20af('0xc')]);router[_0x20af('0xd')]('/',auth[_0x20af('0x9')](),controller[_0x20af('0xe')]);router[_0x20af('0xf')](_0x20af('0xb'),auth[_0x20af('0x9')](),controller['update']);router[_0x20af('0x10')](_0x20af('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7de4=['post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x37bc96,_0x486494){var _0x1667ab=function(_0x4a460e){while(--_0x4a460e){_0x37bc96['push'](_0x37bc96['shift']());}};_0x1667ab(++_0x486494);}(_0x7de4,0x14b));var _0x47de=function(_0x15ba44,_0x562e45){_0x15ba44=_0x15ba44-0x0;var _0x34a42c=_0x7de4[_0x15ba44];return _0x34a42c;};'use strict';var multer=require('multer');var util=require(_0x47de('0x0'));var path=require('path');var timeout=require(_0x47de('0x1'));var express=require(_0x47de('0x2'));var router=express[_0x47de('0x3')]();var fs_extra=require(_0x47de('0x4'));var auth=require(_0x47de('0x5'));var interaction=require(_0x47de('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x47de('0x7')]('/',auth[_0x47de('0x8')](),controller[_0x47de('0x9')]);router[_0x47de('0x7')]('/:id',auth[_0x47de('0x8')](),controller[_0x47de('0xa')]);router[_0x47de('0xb')]('/',auth[_0x47de('0x8')](),controller[_0x47de('0xc')]);router[_0x47de('0xd')](_0x47de('0xe'),auth[_0x47de('0x8')](),controller[_0x47de('0xf')]);router[_0x47de('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x47de('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index bdc829d..2094a84 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 _0x8eb7=['keyValue','picklist','STRING','variable','customVariable','sequelize','exports','ENUM','string'];(function(_0x2c347a,_0x2b2bcd){var _0x3397bb=function(_0x195d92){while(--_0x195d92){_0x2c347a['push'](_0x2c347a['shift']());}};_0x3397bb(++_0x2b2bcd);}(_0x8eb7,0x1e2));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));module[_0x78eb('0x1')]={'type':{'type':Sequelize[_0x78eb('0x2')](_0x78eb('0x3'),'variable','customVariable',_0x78eb('0x4'),_0x78eb('0x5')),'defaultValue':_0x78eb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x78eb('0x6')]},'keyType':{'type':Sequelize[_0x78eb('0x2')]('string',_0x78eb('0x7'),_0x78eb('0x8'))},'keyContent':{'type':Sequelize[_0x78eb('0x6')]},'idField':{'type':Sequelize[_0x78eb('0x6')]},'nameField':{'type':Sequelize[_0x78eb('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78eb('0x6')]}}; \ No newline at end of file +var _0xdb72=['STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist'];(function(_0x56f592,_0x3de9c5){var _0x27b4cc=function(_0x29a7ad){while(--_0x29a7ad){_0x56f592['push'](_0x56f592['shift']());}};_0x27b4cc(++_0x3de9c5);}(_0xdb72,0xb2));var _0x2db7=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xdb72[_0x53b199];return _0x1ba42d;};'use strict';var Sequelize=require(_0x2db7('0x0'));module[_0x2db7('0x1')]={'type':{'type':Sequelize[_0x2db7('0x2')](_0x2db7('0x3'),'variable',_0x2db7('0x4'),'keyValue',_0x2db7('0x5')),'defaultValue':_0x2db7('0x3')},'content':{'type':Sequelize[_0x2db7('0x6')]},'key':{'type':Sequelize[_0x2db7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2db7('0x3'),'variable',_0x2db7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2db7('0x6')]},'nameField':{'type':Sequelize[_0x2db7('0x6')]},'customField':{'type':Sequelize[_0x2db7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2db7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f99920b..9f08735 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 _0x1a79=['show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x422890,_0x434494){var _0x202cf0=function(_0x10e9f0){while(--_0x10e9f0){_0x422890['push'](_0x422890['shift']());}};_0x202cf0(++_0x434494);}(_0x1a79,0x159));var _0x91a7=function(_0x4c8cc2,_0x22c17c){_0x4c8cc2=_0x4c8cc2-0x0;var _0xcf1186=_0x1a79[_0x4c8cc2];return _0xcf1186;};'use strict';var emlformat=require(_0x91a7('0x0'));var rimraf=require(_0x91a7('0x1'));var zipdir=require(_0x91a7('0x2'));var jsonpatch=require(_0x91a7('0x3'));var rp=require('request-promise');var moment=require(_0x91a7('0x4'));var BPromise=require(_0x91a7('0x5'));var Mustache=require(_0x91a7('0x6'));var util=require('util');var path=require(_0x91a7('0x7'));var sox=require(_0x91a7('0x8'));var csv=require('to-csv');var ejs=require(_0x91a7('0x9'));var fs=require('fs');var fs_extra=require(_0x91a7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x91a7('0xb'));var jsforce=require(_0x91a7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91a7('0xd'));var authService=require(_0x91a7('0xe'));var qs=require(_0x91a7('0xf'));var as=require(_0x91a7('0x10'));var hardwareService=require(_0x91a7('0x11'));var logger=require('../../config/logger')(_0x91a7('0x12'));var utils=require(_0x91a7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x91a7('0x14'));var db=require(_0x91a7('0x15'))['db'];function respondWithStatusCode(_0x46e571,_0x27bc4f){_0x27bc4f=_0x27bc4f||0xcc;return function(_0x17386d){if(_0x17386d){return _0x46e571[_0x91a7('0x16')](_0x27bc4f);}return _0x46e571[_0x91a7('0x17')](_0x27bc4f)[_0x91a7('0x18')]();};}function respondWithResult(_0x2e1dee,_0x34fb0a){_0x34fb0a=_0x34fb0a||0xc8;return function(_0x5aa6c6){if(_0x5aa6c6){return _0x2e1dee[_0x91a7('0x17')](_0x34fb0a)['json'](_0x5aa6c6);}};}function respondWithFilteredResult(_0x2bd68f,_0x30a5bd){return function(_0x297820){if(_0x297820){var _0x190920=typeof _0x30a5bd[_0x91a7('0x19')]===_0x91a7('0x1a')&&typeof _0x30a5bd[_0x91a7('0x1b')]===_0x91a7('0x1a');var _0x3223be=_0x297820[_0x91a7('0x1c')];var _0x43bff1=_0x190920?0x0:_0x30a5bd[_0x91a7('0x19')];var _0x83a319=_0x190920?_0x297820[_0x91a7('0x1c')]:_0x30a5bd[_0x91a7('0x19')]+_0x30a5bd[_0x91a7('0x1b')];var _0x39e5ac;if(_0x83a319>=_0x3223be){_0x83a319=_0x3223be;_0x39e5ac=0xc8;}else{_0x39e5ac=0xce;}_0x2bd68f['status'](_0x39e5ac);return _0x2bd68f[_0x91a7('0x1d')](_0x91a7('0x1e'),_0x43bff1+'-'+_0x83a319+'/'+_0x3223be)[_0x91a7('0x1f')](_0x297820);}return null;};}function patchUpdates(_0x3a7580){return function(_0x3c8dee){try{jsonpatch['apply'](_0x3c8dee,_0x3a7580,!![]);}catch(_0x586532){return BPromise['reject'](_0x586532);}return _0x3c8dee['save']();};}function saveUpdates(_0x5f650f,_0x1fcd6f){return function(_0x4d084c){if(_0x4d084c){return _0x4d084c[_0x91a7('0x20')](_0x5f650f)[_0x91a7('0x21')](function(_0x18e65b){return _0x18e65b;});}return null;};}function removeEntity(_0xb30a0,_0x19b5c2){return function(_0x4f29bc){if(_0x4f29bc){return _0x4f29bc[_0x91a7('0x22')]()[_0x91a7('0x21')](function(){_0xb30a0[_0x91a7('0x17')](0xcc)[_0x91a7('0x18')]();});}};}function handleEntityNotFound(_0xf90b21,_0x47d47b){return function(_0x4e4858){if(!_0x4e4858){_0xf90b21[_0x91a7('0x16')](0x194);}return _0x4e4858;};}function handleError(_0x2bd96a,_0xcd336f){_0xcd336f=_0xcd336f||0x1f4;return function(_0x125a39){logger[_0x91a7('0x23')](_0x125a39['stack']);if(_0x125a39[_0x91a7('0x24')]){delete _0x125a39['name'];}_0x2bd96a[_0x91a7('0x17')](_0xcd336f)['send'](_0x125a39);};}exports[_0x91a7('0x25')]=function(_0x1e2717,_0x22959b){var _0x5d2411={},_0x414158={},_0x4a72bb={'count':0x0,'rows':[]};var _0x48eee0=_[_0x91a7('0x26')](db[_0x91a7('0x27')][_0x91a7('0x28')],function(_0x27a9f0){return{'name':_0x27a9f0['fieldName'],'type':_0x27a9f0[_0x91a7('0x29')][_0x91a7('0x2a')]};});_0x414158[_0x91a7('0x2b')]=_[_0x91a7('0x26')](_0x48eee0,_0x91a7('0x24'));_0x414158[_0x91a7('0x2c')]=_[_0x91a7('0x2d')](_0x1e2717[_0x91a7('0x2c')]);_0x414158[_0x91a7('0x2e')]=_['intersection'](_0x414158[_0x91a7('0x2b')],_0x414158[_0x91a7('0x2c')]);_0x5d2411[_0x91a7('0x2f')]=_[_0x91a7('0x30')](_0x414158[_0x91a7('0x2b')],qs['fields'](_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x31')]));_0x5d2411[_0x91a7('0x2f')]=_0x5d2411['attributes']['length']?_0x5d2411[_0x91a7('0x2f')]:_0x414158[_0x91a7('0x2b')];if(!_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x32')]('nolimit')){_0x5d2411[_0x91a7('0x1b')]=qs['limit'](_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x1b')]);_0x5d2411[_0x91a7('0x19')]=qs[_0x91a7('0x19')](_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x19')]);}_0x5d2411[_0x91a7('0x33')]=qs[_0x91a7('0x34')](_0x1e2717[_0x91a7('0x2c')]['sort']);_0x5d2411[_0x91a7('0x35')]=qs[_0x91a7('0x2e')](_['pick'](_0x1e2717[_0x91a7('0x2c')],_0x414158[_0x91a7('0x2e')]),_0x48eee0);if(_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x36')]){_0x5d2411[_0x91a7('0x35')]=_[_0x91a7('0x37')](_0x5d2411[_0x91a7('0x35')],{'$or':_[_0x91a7('0x26')](_0x48eee0,function(_0x5e8aaa){if(_0x5e8aaa[_0x91a7('0x29')]!==_0x91a7('0x38')){var _0x5cc95b={};_0x5cc95b[_0x5e8aaa[_0x91a7('0x24')]]={'$like':'%'+_0x1e2717[_0x91a7('0x2c')][_0x91a7('0x36')]+'%'};return _0x5cc95b;}})});}_0x5d2411=_[_0x91a7('0x37')]({},_0x5d2411,_0x1e2717[_0x91a7('0x39')]);var _0xd0770a={'where':_0x5d2411[_0x91a7('0x35')]};return db[_0x91a7('0x27')][_0x91a7('0x1c')](_0xd0770a)[_0x91a7('0x21')](function(_0x183cd5){_0x4a72bb['count']=_0x183cd5;if(_0x1e2717['query'][_0x91a7('0x3a')]){_0x5d2411[_0x91a7('0x3b')]=[{'all':!![]}];}return db[_0x91a7('0x27')][_0x91a7('0x3c')](_0x5d2411);})[_0x91a7('0x21')](function(_0x9bb13b){_0x4a72bb[_0x91a7('0x3d')]=_0x9bb13b;return _0x4a72bb;})[_0x91a7('0x21')](respondWithFilteredResult(_0x22959b,_0x5d2411))[_0x91a7('0x3e')](handleError(_0x22959b,null));};exports[_0x91a7('0x3f')]=function(_0x450598,_0x3bda49){var _0x11d5ce={'raw':!![],'where':{'id':_0x450598[_0x91a7('0x40')]['id']}},_0xf25421={};_0xf25421[_0x91a7('0x2b')]=_[_0x91a7('0x2d')](db['Dynamics365Field'][_0x91a7('0x28')]);_0xf25421[_0x91a7('0x2c')]=_[_0x91a7('0x2d')](_0x450598[_0x91a7('0x2c')]);_0xf25421[_0x91a7('0x2e')]=_['intersection'](_0xf25421[_0x91a7('0x2b')],_0xf25421[_0x91a7('0x2c')]);_0x11d5ce[_0x91a7('0x2f')]=_[_0x91a7('0x30')](_0xf25421['model'],qs[_0x91a7('0x31')](_0x450598['query'][_0x91a7('0x31')]));_0x11d5ce[_0x91a7('0x2f')]=_0x11d5ce[_0x91a7('0x2f')]['length']?_0x11d5ce[_0x91a7('0x2f')]:_0xf25421['model'];if(_0x450598[_0x91a7('0x2c')]['includeAll']){_0x11d5ce[_0x91a7('0x3b')]=[{'all':!![]}];}_0x11d5ce=_[_0x91a7('0x37')]({},_0x11d5ce,_0x450598[_0x91a7('0x39')]);return db['Dynamics365Field'][_0x91a7('0x41')](_0x11d5ce)[_0x91a7('0x21')](handleEntityNotFound(_0x3bda49,null))[_0x91a7('0x21')](respondWithResult(_0x3bda49,null))[_0x91a7('0x3e')](handleError(_0x3bda49,null));};exports[_0x91a7('0x42')]=function(_0x25908a,_0x10914e){return db[_0x91a7('0x27')][_0x91a7('0x42')](_0x25908a[_0x91a7('0x43')],{})[_0x91a7('0x21')](respondWithResult(_0x10914e,0xc9))[_0x91a7('0x3e')](handleError(_0x10914e,null));};exports['update']=function(_0x5ca5cd,_0x539fe3){if(_0x5ca5cd[_0x91a7('0x43')]['id']){delete _0x5ca5cd[_0x91a7('0x43')]['id'];}return db[_0x91a7('0x27')][_0x91a7('0x41')]({'where':{'id':_0x5ca5cd[_0x91a7('0x40')]['id']}})[_0x91a7('0x21')](handleEntityNotFound(_0x539fe3,null))[_0x91a7('0x21')](saveUpdates(_0x5ca5cd[_0x91a7('0x43')],null))[_0x91a7('0x21')](respondWithResult(_0x539fe3,null))['catch'](handleError(_0x539fe3,null));};exports[_0x91a7('0x22')]=function(_0x44df93,_0x4cfd36){return db[_0x91a7('0x27')][_0x91a7('0x41')]({'where':{'id':_0x44df93['params']['id']}})[_0x91a7('0x21')](handleEntityNotFound(_0x4cfd36,null))[_0x91a7('0x21')](removeEntity(_0x4cfd36,null))[_0x91a7('0x3e')](handleError(_0x4cfd36,null));}; \ No newline at end of file +var _0xd5f2=['then','destroy','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','Dynamics365Field','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x3ee97d,_0x5ea8a8){var _0xef3d7=function(_0x3b5834){while(--_0x3b5834){_0x3ee97d['push'](_0x3ee97d['shift']());}};_0xef3d7(++_0x5ea8a8);}(_0xd5f2,0x163));var _0x2d5f=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xd5f2[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x2d5f('0x0'));var rimraf=require(_0x2d5f('0x1'));var zipdir=require(_0x2d5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d5f('0x3'));var moment=require(_0x2d5f('0x4'));var BPromise=require(_0x2d5f('0x5'));var Mustache=require(_0x2d5f('0x6'));var util=require('util');var path=require(_0x2d5f('0x7'));var sox=require(_0x2d5f('0x8'));var csv=require(_0x2d5f('0x9'));var ejs=require(_0x2d5f('0xa'));var fs=require('fs');var fs_extra=require(_0x2d5f('0xb'));var _=require('lodash');var squel=require(_0x2d5f('0xc'));var crypto=require(_0x2d5f('0xd'));var jsforce=require(_0x2d5f('0xe'));var deskjs=require(_0x2d5f('0xf'));var toCsv=require(_0x2d5f('0x9'));var querystring=require('querystring');var Papa=require(_0x2d5f('0x10'));var Redis=require(_0x2d5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2d5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d5f('0x13'));var logger=require(_0x2d5f('0x14'))(_0x2d5f('0x15'));var utils=require(_0x2d5f('0x16'));var config=require(_0x2d5f('0x17'));var licenseUtil=require(_0x2d5f('0x18'));var db=require(_0x2d5f('0x19'))['db'];function respondWithStatusCode(_0x215854,_0x8eb63f){_0x8eb63f=_0x8eb63f||0xcc;return function(_0x1ab365){if(_0x1ab365){return _0x215854[_0x2d5f('0x1a')](_0x8eb63f);}return _0x215854[_0x2d5f('0x1b')](_0x8eb63f)[_0x2d5f('0x1c')]();};}function respondWithResult(_0x509b36,_0x51b2a4){_0x51b2a4=_0x51b2a4||0xc8;return function(_0x592d2d){if(_0x592d2d){return _0x509b36[_0x2d5f('0x1b')](_0x51b2a4)[_0x2d5f('0x1d')](_0x592d2d);}};}function respondWithFilteredResult(_0x269385,_0x569575){return function(_0x2a1a78){if(_0x2a1a78){var _0x3a8550=typeof _0x569575['offset']===_0x2d5f('0x1e')&&typeof _0x569575[_0x2d5f('0x1f')]===_0x2d5f('0x1e');var _0x285fa8=_0x2a1a78['count'];var _0x473520=_0x3a8550?0x0:_0x569575['offset'];var _0x31b49f=_0x3a8550?_0x2a1a78[_0x2d5f('0x20')]:_0x569575[_0x2d5f('0x21')]+_0x569575[_0x2d5f('0x1f')];var _0x1e3a04;if(_0x31b49f>=_0x285fa8){_0x31b49f=_0x285fa8;_0x1e3a04=0xc8;}else{_0x1e3a04=0xce;}_0x269385[_0x2d5f('0x1b')](_0x1e3a04);return _0x269385[_0x2d5f('0x22')](_0x2d5f('0x23'),_0x473520+'-'+_0x31b49f+'/'+_0x285fa8)[_0x2d5f('0x1d')](_0x2a1a78);}return null;};}function patchUpdates(_0x1eef22){return function(_0x2ceb42){try{jsonpatch[_0x2d5f('0x24')](_0x2ceb42,_0x1eef22,!![]);}catch(_0x2ca3af){return BPromise[_0x2d5f('0x25')](_0x2ca3af);}return _0x2ceb42[_0x2d5f('0x26')]();};}function saveUpdates(_0x1bb5b3,_0x1e9c14){return function(_0x1a1221){if(_0x1a1221){return _0x1a1221[_0x2d5f('0x27')](_0x1bb5b3)[_0x2d5f('0x28')](function(_0x144c56){return _0x144c56;});}return null;};}function removeEntity(_0x4d6d6c,_0x1643fe){return function(_0x5f3937){if(_0x5f3937){return _0x5f3937[_0x2d5f('0x29')]()[_0x2d5f('0x28')](function(){_0x4d6d6c[_0x2d5f('0x1b')](0xcc)[_0x2d5f('0x1c')]();});}};}function handleEntityNotFound(_0x3f5368,_0x134c21){return function(_0x243630){if(!_0x243630){_0x3f5368[_0x2d5f('0x1a')](0x194);}return _0x243630;};}function handleError(_0x4ea6cf,_0x320c10){_0x320c10=_0x320c10||0x1f4;return function(_0x55cfde){logger[_0x2d5f('0x2a')](_0x55cfde[_0x2d5f('0x2b')]);if(_0x55cfde['name']){delete _0x55cfde['name'];}_0x4ea6cf['status'](_0x320c10)[_0x2d5f('0x2c')](_0x55cfde);};}exports[_0x2d5f('0x2d')]=function(_0x5e522a,_0x25c312){var _0x240f90={},_0x24239c={},_0x1c24c2={'count':0x0,'rows':[]};var _0x386c9a=_[_0x2d5f('0x2e')](db['Dynamics365Field'][_0x2d5f('0x2f')],function(_0xbdbcfc){return{'name':_0xbdbcfc[_0x2d5f('0x30')],'type':_0xbdbcfc['type'][_0x2d5f('0x31')]};});_0x24239c[_0x2d5f('0x32')]=_[_0x2d5f('0x2e')](_0x386c9a,_0x2d5f('0x33'));_0x24239c['query']=_['keys'](_0x5e522a[_0x2d5f('0x34')]);_0x24239c[_0x2d5f('0x35')]=_[_0x2d5f('0x36')](_0x24239c['model'],_0x24239c[_0x2d5f('0x34')]);_0x240f90[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x24239c['model'],qs['fields'](_0x5e522a[_0x2d5f('0x34')][_0x2d5f('0x38')]));_0x240f90[_0x2d5f('0x37')]=_0x240f90[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x240f90[_0x2d5f('0x37')]:_0x24239c[_0x2d5f('0x32')];if(!_0x5e522a[_0x2d5f('0x34')]['hasOwnProperty'](_0x2d5f('0x3a'))){_0x240f90['limit']=qs[_0x2d5f('0x1f')](_0x5e522a[_0x2d5f('0x34')][_0x2d5f('0x1f')]);_0x240f90['offset']=qs[_0x2d5f('0x21')](_0x5e522a[_0x2d5f('0x34')]['offset']);}_0x240f90[_0x2d5f('0x3b')]=qs[_0x2d5f('0x3c')](_0x5e522a[_0x2d5f('0x34')]['sort']);_0x240f90[_0x2d5f('0x3d')]=qs[_0x2d5f('0x35')](_['pick'](_0x5e522a[_0x2d5f('0x34')],_0x24239c[_0x2d5f('0x35')]),_0x386c9a);if(_0x5e522a[_0x2d5f('0x34')][_0x2d5f('0x3e')]){_0x240f90['where']=_[_0x2d5f('0x3f')](_0x240f90[_0x2d5f('0x3d')],{'$or':_[_0x2d5f('0x2e')](_0x386c9a,function(_0xb1ead3){if(_0xb1ead3[_0x2d5f('0x40')]!==_0x2d5f('0x41')){var _0x50b159={};_0x50b159[_0xb1ead3[_0x2d5f('0x33')]]={'$like':'%'+_0x5e522a[_0x2d5f('0x34')]['filter']+'%'};return _0x50b159;}})});}_0x240f90=_['merge']({},_0x240f90,_0x5e522a['options']);var _0x44800c={'where':_0x240f90[_0x2d5f('0x3d')]};return db[_0x2d5f('0x42')][_0x2d5f('0x20')](_0x44800c)[_0x2d5f('0x28')](function(_0x3083e4){_0x1c24c2['count']=_0x3083e4;if(_0x5e522a[_0x2d5f('0x34')][_0x2d5f('0x43')]){_0x240f90[_0x2d5f('0x44')]=[{'all':!![]}];}return db[_0x2d5f('0x42')][_0x2d5f('0x45')](_0x240f90);})[_0x2d5f('0x28')](function(_0x90c182){_0x1c24c2[_0x2d5f('0x46')]=_0x90c182;return _0x1c24c2;})[_0x2d5f('0x28')](respondWithFilteredResult(_0x25c312,_0x240f90))['catch'](handleError(_0x25c312,null));};exports[_0x2d5f('0x47')]=function(_0x592150,_0x1f2c46){var _0x311518={'raw':!![],'where':{'id':_0x592150[_0x2d5f('0x48')]['id']}},_0x3c40a6={};_0x3c40a6[_0x2d5f('0x32')]=_[_0x2d5f('0x49')](db[_0x2d5f('0x42')][_0x2d5f('0x2f')]);_0x3c40a6[_0x2d5f('0x34')]=_[_0x2d5f('0x49')](_0x592150['query']);_0x3c40a6[_0x2d5f('0x35')]=_['intersection'](_0x3c40a6[_0x2d5f('0x32')],_0x3c40a6[_0x2d5f('0x34')]);_0x311518['attributes']=_[_0x2d5f('0x36')](_0x3c40a6['model'],qs[_0x2d5f('0x38')](_0x592150[_0x2d5f('0x34')]['fields']));_0x311518[_0x2d5f('0x37')]=_0x311518[_0x2d5f('0x37')]['length']?_0x311518[_0x2d5f('0x37')]:_0x3c40a6[_0x2d5f('0x32')];if(_0x592150[_0x2d5f('0x34')][_0x2d5f('0x43')]){_0x311518[_0x2d5f('0x44')]=[{'all':!![]}];}_0x311518=_['merge']({},_0x311518,_0x592150[_0x2d5f('0x4a')]);return db[_0x2d5f('0x42')][_0x2d5f('0x4b')](_0x311518)[_0x2d5f('0x28')](handleEntityNotFound(_0x1f2c46,null))[_0x2d5f('0x28')](respondWithResult(_0x1f2c46,null))[_0x2d5f('0x4c')](handleError(_0x1f2c46,null));};exports[_0x2d5f('0x4d')]=function(_0x28762b,_0x2f3385){return db[_0x2d5f('0x42')][_0x2d5f('0x4d')](_0x28762b[_0x2d5f('0x4e')],{})[_0x2d5f('0x28')](respondWithResult(_0x2f3385,0xc9))['catch'](handleError(_0x2f3385,null));};exports[_0x2d5f('0x27')]=function(_0xf0092,_0x45b5fb){if(_0xf0092[_0x2d5f('0x4e')]['id']){delete _0xf0092[_0x2d5f('0x4e')]['id'];}return db[_0x2d5f('0x42')][_0x2d5f('0x4b')]({'where':{'id':_0xf0092['params']['id']}})[_0x2d5f('0x28')](handleEntityNotFound(_0x45b5fb,null))[_0x2d5f('0x28')](saveUpdates(_0xf0092[_0x2d5f('0x4e')],null))[_0x2d5f('0x28')](respondWithResult(_0x45b5fb,null))[_0x2d5f('0x4c')](handleError(_0x45b5fb,null));};exports['destroy']=function(_0x1e80dc,_0x537306){return db[_0x2d5f('0x42')][_0x2d5f('0x4b')]({'where':{'id':_0x1e80dc[_0x2d5f('0x48')]['id']}})['then'](handleEntityNotFound(_0x537306,null))[_0x2d5f('0x28')](removeEntity(_0x537306,null))[_0x2d5f('0x4c')](handleError(_0x537306,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6746632..fff696e 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 _0xa30b=['bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x969e3,_0xb85862){var _0x9b068e=function(_0x42f2ab){while(--_0x42f2ab){_0x969e3['push'](_0x969e3['shift']());}};_0x9b068e(++_0xb85862);}(_0xa30b,0x1c4));var _0xba30=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa30b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xba30('0x0'));var util=require(_0xba30('0x1'));var logger=require(_0xba30('0x2'))('api');var moment=require('moment');var BPromise=require(_0xba30('0x3'));var rp=require(_0xba30('0x4'));var fs=require('fs');var path=require(_0xba30('0x5'));var rimraf=require(_0xba30('0x6'));var config=require('../../config/environment');var attributes=require(_0xba30('0x7'));module[_0xba30('0x8')]=function(_0x2144c5,_0x20b1f9){return _0x2144c5['define'](_0xba30('0x9'),attributes,{'tableName':_0xba30('0xa'),'paranoid':![],'indexes':[{'name':_0xba30('0xb'),'fields':['idField',_0xba30('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc6=['exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes'];(function(_0x460457,_0x272b4b){var _0x1bfe42=function(_0x304fb3){while(--_0x304fb3){_0x460457['push'](_0x460457['shift']());}};_0x1bfe42(++_0x272b4b);}(_0x2bc6,0xd7));var _0x62bc=function(_0x2fcf4d,_0x161ce1){_0x2fcf4d=_0x2fcf4d-0x0;var _0x4a4fc4=_0x2bc6[_0x2fcf4d];return _0x4a4fc4;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))(_0x62bc('0x3'));var moment=require(_0x62bc('0x4'));var BPromise=require(_0x62bc('0x5'));var rp=require(_0x62bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62bc('0x7'));var config=require('../../config/environment');var attributes=require(_0x62bc('0x8'));module[_0x62bc('0x9')]=function(_0x42a1bf,_0x35c7bc){return _0x42a1bf['define'](_0x62bc('0xa'),attributes,{'tableName':_0x62bc('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x62bc('0xc'),_0x62bc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 3801db8..066ae15 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 _0x9c42=['request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x9c42,0x1c3));var _0x29c4=function(_0x411b68,_0x52e768){_0x411b68=_0x411b68-0x0;var _0x41ff90=_0x9c42[_0x411b68];return _0x41ff90;};'use strict';var _=require('lodash');var util=require(_0x29c4('0x0'));var moment=require(_0x29c4('0x1'));var BPromise=require(_0x29c4('0x2'));var rs=require(_0x29c4('0x3'));var fs=require('fs');var Redis=require(_0x29c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29c4('0x5'));var logger=require(_0x29c4('0x6'))(_0x29c4('0x7'));var config=require(_0x29c4('0x8'));var jayson=require(_0x29c4('0x9'));var client=jayson[_0x29c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x234929,_0x45fff0,_0x3f8f7f){return new BPromise(function(_0x2de3d1,_0x5b4c34){return client[_0x29c4('0xb')](_0x234929,_0x3f8f7f)[_0x29c4('0xc')](function(_0x58b978){logger['info'](_0x29c4('0xd'),_0x45fff0,'request\x20sent');logger[_0x29c4('0xe')](_0x29c4('0xf'),_0x45fff0,_0x29c4('0x10'),JSON[_0x29c4('0x11')](_0x58b978));if(_0x58b978[_0x29c4('0x12')]){if(_0x58b978['error'][_0x29c4('0x13')]===0x1f4){logger[_0x29c4('0x12')](_0x29c4('0xd'),_0x45fff0,_0x58b978[_0x29c4('0x12')][_0x29c4('0x14')]);return _0x5b4c34(_0x58b978['error']['message']);}logger['error'](_0x29c4('0xd'),_0x45fff0,_0x58b978[_0x29c4('0x12')]['message']);return _0x2de3d1(_0x58b978['error'][_0x29c4('0x14')]);}else{logger['info'](_0x29c4('0xd'),_0x45fff0,_0x29c4('0x10'));_0x2de3d1(_0x58b978[_0x29c4('0x15')][_0x29c4('0x14')]);}})['catch'](function(_0x2e952c){logger[_0x29c4('0x12')](_0x29c4('0xd'),_0x45fff0,_0x2e952c);_0x5b4c34(_0x2e952c);});});} \ No newline at end of file +var _0xc740=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1a0273,_0x387285){var _0x4f48b9=function(_0x362b2){while(--_0x362b2){_0x1a0273['push'](_0x1a0273['shift']());}};_0x4f48b9(++_0x387285);}(_0xc740,0x1bc));var _0x0c74=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc740[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0c74('0x0'));var rs=require(_0x0c74('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c74('0x2'));var logger=require(_0x0c74('0x3'))(_0x0c74('0x4'));var config=require(_0x0c74('0x5'));var jayson=require(_0x0c74('0x6'));var client=jayson[_0x0c74('0x7')][_0x0c74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a52f8,_0x2b0e46,_0x4d49a1){return new BPromise(function(_0x396ea1,_0x249dc4){return client[_0x0c74('0x9')](_0x3a52f8,_0x4d49a1)[_0x0c74('0xa')](function(_0x5570b0){logger[_0x0c74('0xb')](_0x0c74('0xc'),_0x2b0e46,_0x0c74('0xd'));logger[_0x0c74('0xe')](_0x0c74('0xf'),_0x2b0e46,_0x0c74('0xd'),JSON[_0x0c74('0x10')](_0x5570b0));if(_0x5570b0['error']){if(_0x5570b0[_0x0c74('0x11')]['code']===0x1f4){logger['error'](_0x0c74('0xc'),_0x2b0e46,_0x5570b0[_0x0c74('0x11')]['message']);return _0x249dc4(_0x5570b0['error'][_0x0c74('0x12')]);}logger[_0x0c74('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x2b0e46,_0x5570b0[_0x0c74('0x11')][_0x0c74('0x12')]);return _0x396ea1(_0x5570b0['error']['message']);}else{logger[_0x0c74('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2b0e46,'request\x20sent');_0x396ea1(_0x5570b0['result'][_0x0c74('0x12')]);}})['catch'](function(_0x405e99){logger[_0x0c74('0x11')](_0x0c74('0xc'),_0x2b0e46,_0x405e99);_0x249dc4(_0x405e99);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ed2cf65..424b436 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 _0x2ea0=['/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ea0,0x141));var _0x02ea=function(_0x56dd58,_0xb1287d){_0x56dd58=_0x56dd58-0x0;var _0x103e75=_0x2ea0[_0x56dd58];return _0x103e75;};'use strict';var multer=require(_0x02ea('0x0'));var util=require(_0x02ea('0x1'));var path=require(_0x02ea('0x2'));var timeout=require(_0x02ea('0x3'));var express=require(_0x02ea('0x4'));var router=express[_0x02ea('0x5')]();var fs_extra=require(_0x02ea('0x6'));var auth=require(_0x02ea('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x02ea('0x8'));router[_0x02ea('0x9')]('/',auth[_0x02ea('0xa')](),controller[_0x02ea('0xb')]);router[_0x02ea('0x9')](_0x02ea('0xc'),auth[_0x02ea('0xa')](),controller['show']);router['get'](_0x02ea('0xd'),auth[_0x02ea('0xa')](),controller[_0x02ea('0xe')]);router['get'](_0x02ea('0xf'),auth[_0x02ea('0xa')](),controller[_0x02ea('0x10')]);router[_0x02ea('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x02ea('0x11')]('/:id/configurations',auth[_0x02ea('0xa')](),controller[_0x02ea('0x12')]);router[_0x02ea('0x13')](_0x02ea('0xc'),auth[_0x02ea('0xa')](),controller[_0x02ea('0x14')]);router[_0x02ea('0x15')](_0x02ea('0xc'),auth[_0x02ea('0xa')](),controller[_0x02ea('0x16')]);module[_0x02ea('0x17')]=router; \ No newline at end of file +var _0x82d6=['express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x456352,_0x27ebc6){var _0x4d9e2d=function(_0x2631f0){while(--_0x2631f0){_0x456352['push'](_0x456352['shift']());}};_0x4d9e2d(++_0x27ebc6);}(_0x82d6,0x177));var _0x682d=function(_0x4df236,_0x256657){_0x4df236=_0x4df236-0x0;var _0x27b1a5=_0x82d6[_0x4df236];return _0x27b1a5;};'use strict';var multer=require(_0x682d('0x0'));var util=require(_0x682d('0x1'));var path=require('path');var timeout=require(_0x682d('0x2'));var express=require(_0x682d('0x3'));var router=express['Router']();var fs_extra=require(_0x682d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x682d('0x5'));var config=require(_0x682d('0x6'));var controller=require(_0x682d('0x7'));router[_0x682d('0x8')]('/',auth['isAuthenticated'](),controller[_0x682d('0x9')]);router['get'](_0x682d('0xa'),auth[_0x682d('0xb')](),controller[_0x682d('0xc')]);router['get'](_0x682d('0xd'),auth[_0x682d('0xb')](),controller[_0x682d('0xe')]);router[_0x682d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x682d('0xf')]('/',auth[_0x682d('0xb')](),controller[_0x682d('0x10')]);router[_0x682d('0xf')](_0x682d('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x682d('0x11')](_0x682d('0xa'),auth[_0x682d('0xb')](),controller[_0x682d('0x12')]);router['delete'](_0x682d('0xa'),auth[_0x682d('0xb')](),controller[_0x682d('0x13')]);module[_0x682d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2b885d7..071c711 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 _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','STRING','username','sequelize'];(function(_0x5f4ecc,_0x100353){var _0x989873=function(_0x252686){while(--_0x252686){_0x5f4ecc['push'](_0x5f4ecc['shift']());}};_0x989873(++_0x100353);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53f5bf,_0x275ece){_0x53f5bf=_0x53f5bf-0x0;var _0x9882f1=_0x5f2f[_0x53f5bf];return _0x9882f1;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'apiKey':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2c62a91..3611fad 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 _0xd353=['default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','destroy','find','getConfigurations','FreshdeskConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','group','source','ticket_type','remove'];(function(_0x94b593,_0x1b6960){var _0x27d22f=function(_0x587063){while(--_0x587063){_0x94b593['push'](_0x94b593['shift']());}};_0x27d22f(++_0x1b6960);}(_0xd353,0x7e));var _0x3d35=function(_0x22b496,_0x56e9e9){_0x22b496=_0x22b496-0x0;var _0x308d30=_0xd353[_0x22b496];return _0x308d30;};'use strict';var emlformat=require(_0x3d35('0x0'));var rimraf=require(_0x3d35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d35('0x2'));var rp=require(_0x3d35('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d35('0x4'));var util=require('util');var path=require(_0x3d35('0x5'));var sox=require(_0x3d35('0x6'));var csv=require(_0x3d35('0x7'));var ejs=require(_0x3d35('0x8'));var fs=require('fs');var fs_extra=require(_0x3d35('0x9'));var _=require(_0x3d35('0xa'));var squel=require(_0x3d35('0xb'));var crypto=require('crypto');var jsforce=require(_0x3d35('0xc'));var deskjs=require(_0x3d35('0xd'));var toCsv=require(_0x3d35('0x7'));var querystring=require(_0x3d35('0xe'));var Papa=require(_0x3d35('0xf'));var Redis=require(_0x3d35('0x10'));var authService=require(_0x3d35('0x11'));var qs=require(_0x3d35('0x12'));var as=require(_0x3d35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d35('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x289a28,_0x567e9a){_0x567e9a=_0x567e9a||0xcc;return function(_0x2dceec){if(_0x2dceec){return _0x289a28[_0x3d35('0x15')](_0x567e9a);}return _0x289a28[_0x3d35('0x16')](_0x567e9a)[_0x3d35('0x17')]();};}function respondWithResult(_0x548c84,_0x46b4e8){_0x46b4e8=_0x46b4e8||0xc8;return function(_0x2118cd){if(_0x2118cd){return _0x548c84['status'](_0x46b4e8)[_0x3d35('0x18')](_0x2118cd);}};}function respondWithFilteredResult(_0x1ec3db,_0x5c59a0){return function(_0x2c5e9a){if(_0x2c5e9a){var _0x2f3dfa=typeof _0x5c59a0[_0x3d35('0x19')]===_0x3d35('0x1a')&&typeof _0x5c59a0[_0x3d35('0x1b')]===_0x3d35('0x1a');var _0x57444d=_0x2c5e9a[_0x3d35('0x1c')];var _0x1f06dc=_0x2f3dfa?0x0:_0x5c59a0[_0x3d35('0x19')];var _0x3c452a=_0x2f3dfa?_0x2c5e9a['count']:_0x5c59a0['offset']+_0x5c59a0[_0x3d35('0x1b')];var _0x4ddb8d;if(_0x3c452a>=_0x57444d){_0x3c452a=_0x57444d;_0x4ddb8d=0xc8;}else{_0x4ddb8d=0xce;}_0x1ec3db['status'](_0x4ddb8d);return _0x1ec3db[_0x3d35('0x1d')](_0x3d35('0x1e'),_0x1f06dc+'-'+_0x3c452a+'/'+_0x57444d)[_0x3d35('0x18')](_0x2c5e9a);}return null;};}function patchUpdates(_0x314df6){return function(_0x50d199){try{jsonpatch[_0x3d35('0x1f')](_0x50d199,_0x314df6,!![]);}catch(_0x51445b){return BPromise[_0x3d35('0x20')](_0x51445b);}return _0x50d199[_0x3d35('0x21')]();};}function saveUpdates(_0x446cd8,_0x3f5a61){return function(_0x23c1c8){if(_0x23c1c8){return _0x23c1c8[_0x3d35('0x22')](_0x446cd8)[_0x3d35('0x23')](function(_0x2e62a7){return _0x2e62a7;});}return null;};}function removeEntity(_0xe8fcaa,_0x53945c){return function(_0x5dbaeb){if(_0x5dbaeb){return _0x5dbaeb['destroy']()[_0x3d35('0x23')](function(){_0xe8fcaa[_0x3d35('0x16')](0xcc)[_0x3d35('0x17')]();});}};}function handleEntityNotFound(_0x5ee1f3,_0x2c7ca4){return function(_0x5bbac4){if(!_0x5bbac4){_0x5ee1f3['sendStatus'](0x194);}return _0x5bbac4;};}function handleError(_0x5323b8,_0x5eacc0){_0x5eacc0=_0x5eacc0||0x1f4;return function(_0x5004e2){logger[_0x3d35('0x24')](_0x5004e2[_0x3d35('0x25')]);if(_0x5004e2['name']){delete _0x5004e2['name'];}_0x5323b8['status'](_0x5eacc0)[_0x3d35('0x26')](_0x5004e2);};}exports[_0x3d35('0x27')]=function(_0x381cec,_0x46a63d){var _0x23c62a={},_0x5c6cfe={},_0x9b3b9f={'count':0x0,'rows':[]};var _0x11f7d6=_[_0x3d35('0x28')](db[_0x3d35('0x29')][_0x3d35('0x2a')],function(_0x11c30b){return{'name':_0x11c30b[_0x3d35('0x2b')],'type':_0x11c30b['type']['key']};});_0x5c6cfe[_0x3d35('0x2c')]=_[_0x3d35('0x28')](_0x11f7d6,_0x3d35('0x2d'));_0x5c6cfe[_0x3d35('0x2e')]=_[_0x3d35('0x2f')](_0x381cec[_0x3d35('0x2e')]);_0x5c6cfe[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x5c6cfe[_0x3d35('0x2c')],_0x5c6cfe['query']);_0x23c62a[_0x3d35('0x32')]=_['intersection'](_0x5c6cfe['model'],qs['fields'](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x33')]));_0x23c62a[_0x3d35('0x32')]=_0x23c62a[_0x3d35('0x32')][_0x3d35('0x34')]?_0x23c62a['attributes']:_0x5c6cfe[_0x3d35('0x2c')];if(!_0x381cec['query'][_0x3d35('0x35')](_0x3d35('0x36'))){_0x23c62a[_0x3d35('0x1b')]=qs[_0x3d35('0x1b')](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x1b')]);_0x23c62a[_0x3d35('0x19')]=qs[_0x3d35('0x19')](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x19')]);}_0x23c62a[_0x3d35('0x37')]=qs[_0x3d35('0x38')](_0x381cec[_0x3d35('0x2e')]['sort']);_0x23c62a[_0x3d35('0x39')]=qs['filters'](_[_0x3d35('0x3a')](_0x381cec[_0x3d35('0x2e')],_0x5c6cfe['filters']),_0x11f7d6);if(_0x381cec[_0x3d35('0x2e')]['filter']){_0x23c62a[_0x3d35('0x39')]=_['merge'](_0x23c62a[_0x3d35('0x39')],{'$or':_[_0x3d35('0x28')](_0x11f7d6,function(_0x5a1d64){if(_0x5a1d64['type']!==_0x3d35('0x3b')){var _0x1376f4={};_0x1376f4[_0x5a1d64[_0x3d35('0x2d')]]={'$like':'%'+_0x381cec['query'][_0x3d35('0x3c')]+'%'};return _0x1376f4;}})});}_0x23c62a=_[_0x3d35('0x3d')]({},_0x23c62a,_0x381cec['options']);var _0x1e69e0={'where':_0x23c62a[_0x3d35('0x39')]};return db[_0x3d35('0x29')]['count'](_0x1e69e0)[_0x3d35('0x23')](function(_0x38da1c){_0x9b3b9f[_0x3d35('0x1c')]=_0x38da1c;if(_0x381cec[_0x3d35('0x2e')][_0x3d35('0x3e')]){_0x23c62a[_0x3d35('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x3d35('0x40')](_0x23c62a);})['then'](function(_0x3afc63){_0x9b3b9f[_0x3d35('0x41')]=_0x3afc63;return _0x9b3b9f;})[_0x3d35('0x23')](respondWithFilteredResult(_0x46a63d,_0x23c62a))[_0x3d35('0x42')](handleError(_0x46a63d,null));};exports[_0x3d35('0x43')]=function(_0x9f2156,_0x1198b4){var _0x1d52b4={'raw':![],'where':{'id':_0x9f2156[_0x3d35('0x44')]['id']}},_0xf9f327={};_0xf9f327[_0x3d35('0x2c')]=_[_0x3d35('0x2f')](db[_0x3d35('0x29')][_0x3d35('0x2a')]);_0xf9f327['query']=_[_0x3d35('0x2f')](_0x9f2156[_0x3d35('0x2e')]);_0xf9f327[_0x3d35('0x30')]=_['intersection'](_0xf9f327[_0x3d35('0x2c')],_0xf9f327['query']);_0x1d52b4[_0x3d35('0x32')]=_[_0x3d35('0x31')](_0xf9f327['model'],qs[_0x3d35('0x33')](_0x9f2156[_0x3d35('0x2e')]['fields']));_0x1d52b4[_0x3d35('0x32')]=_0x1d52b4[_0x3d35('0x32')][_0x3d35('0x34')]?_0x1d52b4['attributes']:_0xf9f327[_0x3d35('0x2c')];if(_0x9f2156[_0x3d35('0x2e')][_0x3d35('0x3e')]){_0x1d52b4[_0x3d35('0x3f')]=[{'all':!![]}];}_0x1d52b4=_[_0x3d35('0x3d')]({},_0x1d52b4,_0x9f2156[_0x3d35('0x45')]);return db[_0x3d35('0x29')]['find'](_0x1d52b4)[_0x3d35('0x23')](handleEntityNotFound(_0x1198b4,null))['then'](respondWithResult(_0x1198b4,null))[_0x3d35('0x42')](handleError(_0x1198b4,null));};exports['create']=function(_0x3ea610,_0x2aba01){return db[_0x3d35('0x29')][_0x3d35('0x46')](_0x3ea610[_0x3d35('0x47')],{})[_0x3d35('0x23')](respondWithResult(_0x2aba01,0xc9))[_0x3d35('0x42')](handleError(_0x2aba01,null));};exports[_0x3d35('0x22')]=function(_0x1da2d9,_0x2b3156){if(_0x1da2d9[_0x3d35('0x47')]['id']){delete _0x1da2d9[_0x3d35('0x47')]['id'];}return db[_0x3d35('0x29')]['find']({'where':{'id':_0x1da2d9[_0x3d35('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b3156,null))[_0x3d35('0x23')](saveUpdates(_0x1da2d9[_0x3d35('0x47')],null))[_0x3d35('0x23')](respondWithResult(_0x2b3156,null))['catch'](handleError(_0x2b3156,null));};exports[_0x3d35('0x48')]=function(_0x1ccdf8,_0x5de3b0){return db[_0x3d35('0x29')][_0x3d35('0x49')]({'where':{'id':_0x1ccdf8['params']['id']}})['then'](handleEntityNotFound(_0x5de3b0,null))[_0x3d35('0x23')](removeEntity(_0x5de3b0,null))['catch'](handleError(_0x5de3b0,null));};exports[_0x3d35('0x4a')]=function(_0x5486a5,_0x39a37c,_0xdc728b){var _0xc2613d={};var _0x50b7ff={};var _0x2fee40;var _0x1b9739;return db[_0x3d35('0x29')]['findOne']({'where':{'id':_0x5486a5[_0x3d35('0x44')]['id']}})[_0x3d35('0x23')](handleEntityNotFound(_0x39a37c,null))[_0x3d35('0x23')](function(_0x50875f){if(_0x50875f){_0x2fee40=_0x50875f;_0x50b7ff[_0x3d35('0x2c')]=_[_0x3d35('0x2f')](db[_0x3d35('0x4b')]['rawAttributes']);_0x50b7ff[_0x3d35('0x2e')]=_['keys'](_0x5486a5[_0x3d35('0x2e')]);_0x50b7ff[_0x3d35('0x30')]=_['intersection'](_0x50b7ff[_0x3d35('0x2c')],_0x50b7ff[_0x3d35('0x2e')]);_0xc2613d[_0x3d35('0x32')]=_[_0x3d35('0x31')](_0x50b7ff[_0x3d35('0x2c')],qs[_0x3d35('0x33')](_0x5486a5['query'][_0x3d35('0x33')]));_0xc2613d[_0x3d35('0x32')]=_0xc2613d[_0x3d35('0x32')][_0x3d35('0x34')]?_0xc2613d['attributes']:_0x50b7ff[_0x3d35('0x2c')];_0xc2613d['order']=qs[_0x3d35('0x38')](_0x5486a5['query'][_0x3d35('0x38')]);_0xc2613d[_0x3d35('0x39')]=qs[_0x3d35('0x30')](_[_0x3d35('0x3a')](_0x5486a5[_0x3d35('0x2e')],_0x50b7ff[_0x3d35('0x30')]));if(_0x5486a5[_0x3d35('0x2e')]['filter']){_0xc2613d[_0x3d35('0x39')]=_[_0x3d35('0x3d')](_0xc2613d['where'],{'$or':_[_0x3d35('0x28')](_0xc2613d[_0x3d35('0x32')],function(_0xfb1561){var _0x2cfe1a={};_0x2cfe1a[_0xfb1561]={'$like':'%'+_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x3c')]+'%'};return _0x2cfe1a;})});}_0xc2613d=_[_0x3d35('0x3d')]({},_0xc2613d,_0x5486a5['options']);return _0x2fee40[_0x3d35('0x4a')](_0xc2613d);}})[_0x3d35('0x23')](function(_0x1d96ce){if(_0x1d96ce){_0x1b9739=_0x1d96ce[_0x3d35('0x34')];if(!_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x35')](_0x3d35('0x36'))){_0xc2613d[_0x3d35('0x1b')]=qs[_0x3d35('0x1b')](_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x1b')]);_0xc2613d[_0x3d35('0x19')]=qs[_0x3d35('0x19')](_0x5486a5[_0x3d35('0x2e')]['offset']);}return _0x2fee40[_0x3d35('0x4a')](_0xc2613d);}})[_0x3d35('0x23')](function(_0x48d2b1){if(_0x48d2b1){return _0x48d2b1?{'count':_0x1b9739,'rows':_0x48d2b1}:null;}})[_0x3d35('0x23')](respondWithResult(_0x39a37c,null))[_0x3d35('0x42')](handleError(_0x39a37c,null));};exports['addConfiguration']=function(_0x120ea8,_0x1107c8,_0x3ea56a){if(_0x120ea8[_0x3d35('0x47')]['id']){delete _0x120ea8[_0x3d35('0x47')]['id'];}return db['FreshdeskAccount'][_0x3d35('0x4c')]({'where':{'id':_0x120ea8[_0x3d35('0x44')]['id']}})['then'](handleEntityNotFound(_0x1107c8,null))[_0x3d35('0x23')](function(_0x8c9323){if(_0x8c9323){_0x120ea8['body'][_0x3d35('0x4d')]=_0x8c9323['id'];_0x120ea8[_0x3d35('0x47')][_0x3d35('0x4e')]=integrations[_0x3d35('0x4f')](_0x120ea8[_0x3d35('0x47')][_0x3d35('0x50')],_0x120ea8['body'][_0x3d35('0x51')]);_0x120ea8[_0x3d35('0x47')][_0x3d35('0x52')]=integrations['getDescriptions'](_0x120ea8['body'][_0x3d35('0x50')],_0x120ea8[_0x3d35('0x47')]['type']);return db['FreshdeskConfiguration']['create'](_0x120ea8['body'],{'include':[{'model':db[_0x3d35('0x53')],'as':'Subjects'},{'model':db[_0x3d35('0x53')],'as':_0x3d35('0x52')}]});}return null;})['then'](respondWithResult(_0x1107c8,null))[_0x3d35('0x42')](handleError(_0x1107c8,null));};exports['getFields']=function(_0x2d448c,_0x580368,_0x34d813){var _0x5463c0='';return db['FreshdeskAccount'][_0x3d35('0x4c')]({'where':{'id':_0x2d448c['params']['id']},'attributes':['id',_0x3d35('0x54'),_0x3d35('0x55')]})['then'](handleEntityNotFound(_0x580368,null))['then'](function(_0x1b4e11){if(_0x1b4e11){_0x5463c0=_0x1b4e11[_0x3d35('0x54')];var _0x9af4d8=_0x5463c0[_0x3d35('0x56')](-0x1);if(_0x9af4d8==='/'){_0x5463c0=_0x5463c0[_0x3d35('0x57')](0x0,_0x5463c0[_0x3d35('0x58')](_0x9af4d8));}return rp({'method':_0x3d35('0x59'),'uri':util[_0x3d35('0x5a')](_0x3d35('0x5b'),_0x5463c0,_0x3d35('0x5c')),'headers':{'Authorization':util[_0x3d35('0x5a')](_0x3d35('0x5d'),new Buffer(util[_0x3d35('0x5a')](_0x3d35('0x5e'),_0x1b4e11[_0x3d35('0x55')]))[_0x3d35('0x5f')]('base64'))},'json':!![]});}})[_0x3d35('0x23')](function(_0x5cd5b0){if(_0x5cd5b0){var _0x11c2b2=[_0x3d35('0x60'),_0x3d35('0x61'),_0x3d35('0x62'),_0x3d35('0x63'),'status','priority',_0x3d35('0x64'),_0x3d35('0x65'),_0x3d35('0x66'),_0x3d35('0x64'),'company'];_[_0x3d35('0x67')](_0x5cd5b0,function(_0x485b7b){return _0x11c2b2['includes'](_0x485b7b[_0x3d35('0x2d')])||!_0x485b7b[_0x3d35('0x68')]&&_0x485b7b[_0x3d35('0x51')]!==_0x3d35('0x69')&&_0x485b7b[_0x3d35('0x51')]!==_0x3d35('0x6a');});return{'count':_0x5cd5b0['length'],'rows':_[_0x3d35('0x28')](_0x5cd5b0,function(_0x531c9d){return{'id':_0x531c9d[_0x3d35('0x2d')],'name':_0x531c9d[_0x3d35('0x6b')],'custom':!_0x531c9d[_0x3d35('0x68')],'options':_0x531c9d['choices']?_[_0x3d35('0x28')](_0x531c9d[_0x3d35('0x6c')],function(_0x582e31){return{'name':_[_0x3d35('0x6d')](_0x582e31),'value':_0x582e31};}):[]};})};}})['then'](respondWithResult(_0x580368,null))[_0x3d35('0x42')](function(_0x12df57){var _0xdb3ad2=_0x2d448c['query'][_0x3d35('0x6e')]?0x1f4:_0x12df57[_0x3d35('0x6f')]||0x1f4;logger[_0x3d35('0x24')](_0x3d35('0x70'),_0x3d35('0x71'),_0xdb3ad2,JSON['stringify'](_0x12df57));delete _0x12df57[_0x3d35('0x2d')];if(_0xdb3ad2===0x191){_0xdb3ad2=0x190;}_0x580368[_0x3d35('0x16')](_0xdb3ad2)[_0x3d35('0x26')](_0x2d448c[_0x3d35('0x2e')][_0x3d35('0x6e')]?{'message':_0x3d35('0x72'),'statusCode':_0x12df57['statusCode']}:_0x12df57);});}; \ No newline at end of file +var _0xbf5c=['stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch','show','params','length','includeAll','find','create','body','update','FreshdeskConfiguration','getConfigurations','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','description','priority','group','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','then','destroy','error'];(function(_0x52f387,_0x315559){var _0x39de02=function(_0x348220){while(--_0x348220){_0x52f387['push'](_0x52f387['shift']());}};_0x39de02(++_0x315559);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x5c3db7,_0x3a2586){_0x5c3db7=_0x5c3db7-0x0;var _0x38cc6f=_0xbf5c[_0x5c3db7];return _0x38cc6f;};'use strict';var emlformat=require(_0xcbf5('0x0'));var rimraf=require(_0xcbf5('0x1'));var zipdir=require(_0xcbf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbf5('0x3'));var moment=require(_0xcbf5('0x4'));var BPromise=require(_0xcbf5('0x5'));var Mustache=require('mustache');var util=require(_0xcbf5('0x6'));var path=require(_0xcbf5('0x7'));var sox=require('sox');var csv=require(_0xcbf5('0x8'));var ejs=require(_0xcbf5('0x9'));var fs=require('fs');var fs_extra=require(_0xcbf5('0xa'));var _=require('lodash');var squel=require(_0xcbf5('0xb'));var crypto=require(_0xcbf5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbf5('0x8'));var querystring=require(_0xcbf5('0xd'));var Papa=require(_0xcbf5('0xe'));var Redis=require('ioredis');var authService=require(_0xcbf5('0xf'));var qs=require(_0xcbf5('0x10'));var as=require(_0xcbf5('0x11'));var hardwareService=require(_0xcbf5('0x12'));var logger=require(_0xcbf5('0x13'))(_0xcbf5('0x14'));var utils=require('../../config/utils');var config=require(_0xcbf5('0x15'));var licenseUtil=require(_0xcbf5('0x16'));var db=require(_0xcbf5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e5307,_0x18c2fe){_0x18c2fe=_0x18c2fe||0xcc;return function(_0x528e7c){if(_0x528e7c){return _0x5e5307[_0xcbf5('0x18')](_0x18c2fe);}return _0x5e5307[_0xcbf5('0x19')](_0x18c2fe)[_0xcbf5('0x1a')]();};}function respondWithResult(_0x2e7536,_0x51b1d2){_0x51b1d2=_0x51b1d2||0xc8;return function(_0x48ad3c){if(_0x48ad3c){return _0x2e7536[_0xcbf5('0x19')](_0x51b1d2)['json'](_0x48ad3c);}};}function respondWithFilteredResult(_0x2c58ba,_0x5348ce){return function(_0x4fc535){if(_0x4fc535){var _0x3024ea=typeof _0x5348ce[_0xcbf5('0x1b')]===_0xcbf5('0x1c')&&typeof _0x5348ce[_0xcbf5('0x1d')]===_0xcbf5('0x1c');var _0x4048cf=_0x4fc535[_0xcbf5('0x1e')];var _0x53939d=_0x3024ea?0x0:_0x5348ce[_0xcbf5('0x1b')];var _0x10d573=_0x3024ea?_0x4fc535[_0xcbf5('0x1e')]:_0x5348ce[_0xcbf5('0x1b')]+_0x5348ce[_0xcbf5('0x1d')];var _0x3b3022;if(_0x10d573>=_0x4048cf){_0x10d573=_0x4048cf;_0x3b3022=0xc8;}else{_0x3b3022=0xce;}_0x2c58ba[_0xcbf5('0x19')](_0x3b3022);return _0x2c58ba[_0xcbf5('0x1f')]('Content-Range',_0x53939d+'-'+_0x10d573+'/'+_0x4048cf)[_0xcbf5('0x20')](_0x4fc535);}return null;};}function patchUpdates(_0x4e8874){return function(_0x297b86){try{jsonpatch['apply'](_0x297b86,_0x4e8874,!![]);}catch(_0x9f5e81){return BPromise[_0xcbf5('0x21')](_0x9f5e81);}return _0x297b86[_0xcbf5('0x22')]();};}function saveUpdates(_0xf2360,_0x3e9548){return function(_0x278f30){if(_0x278f30){return _0x278f30['update'](_0xf2360)[_0xcbf5('0x23')](function(_0x5602fd){return _0x5602fd;});}return null;};}function removeEntity(_0x965482,_0x1b59d4){return function(_0x26477c){if(_0x26477c){return _0x26477c[_0xcbf5('0x24')]()['then'](function(){_0x965482[_0xcbf5('0x19')](0xcc)[_0xcbf5('0x1a')]();});}};}function handleEntityNotFound(_0x2aa7c,_0x41d465){return function(_0x1a2635){if(!_0x1a2635){_0x2aa7c[_0xcbf5('0x18')](0x194);}return _0x1a2635;};}function handleError(_0x149b61,_0xe6742){_0xe6742=_0xe6742||0x1f4;return function(_0x5e2f8e){logger[_0xcbf5('0x25')](_0x5e2f8e[_0xcbf5('0x26')]);if(_0x5e2f8e[_0xcbf5('0x27')]){delete _0x5e2f8e[_0xcbf5('0x27')];}_0x149b61[_0xcbf5('0x19')](_0xe6742)['send'](_0x5e2f8e);};}exports[_0xcbf5('0x28')]=function(_0x367eb0,_0x9ce00){var _0x3389a1={},_0x14e61d={},_0x13024d={'count':0x0,'rows':[]};var _0x4b22f3=_[_0xcbf5('0x29')](db[_0xcbf5('0x2a')][_0xcbf5('0x2b')],function(_0xa56ec3){return{'name':_0xa56ec3[_0xcbf5('0x2c')],'type':_0xa56ec3[_0xcbf5('0x2d')][_0xcbf5('0x2e')]};});_0x14e61d['model']=_['map'](_0x4b22f3,_0xcbf5('0x27'));_0x14e61d['query']=_[_0xcbf5('0x2f')](_0x367eb0[_0xcbf5('0x30')]);_0x14e61d[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0x14e61d[_0xcbf5('0x33')],_0x14e61d['query']);_0x3389a1['attributes']=_[_0xcbf5('0x32')](_0x14e61d[_0xcbf5('0x33')],qs[_0xcbf5('0x34')](_0x367eb0[_0xcbf5('0x30')][_0xcbf5('0x34')]));_0x3389a1[_0xcbf5('0x35')]=_0x3389a1[_0xcbf5('0x35')]['length']?_0x3389a1[_0xcbf5('0x35')]:_0x14e61d[_0xcbf5('0x33')];if(!_0x367eb0[_0xcbf5('0x30')][_0xcbf5('0x36')]('nolimit')){_0x3389a1[_0xcbf5('0x1d')]=qs[_0xcbf5('0x1d')](_0x367eb0['query'][_0xcbf5('0x1d')]);_0x3389a1[_0xcbf5('0x1b')]=qs['offset'](_0x367eb0['query'][_0xcbf5('0x1b')]);}_0x3389a1[_0xcbf5('0x37')]=qs[_0xcbf5('0x38')](_0x367eb0[_0xcbf5('0x30')]['sort']);_0x3389a1[_0xcbf5('0x39')]=qs[_0xcbf5('0x31')](_[_0xcbf5('0x3a')](_0x367eb0[_0xcbf5('0x30')],_0x14e61d['filters']),_0x4b22f3);if(_0x367eb0[_0xcbf5('0x30')][_0xcbf5('0x3b')]){_0x3389a1['where']=_['merge'](_0x3389a1[_0xcbf5('0x39')],{'$or':_[_0xcbf5('0x29')](_0x4b22f3,function(_0x4cbcf8){if(_0x4cbcf8[_0xcbf5('0x2d')]!==_0xcbf5('0x3c')){var _0x2b318c={};_0x2b318c[_0x4cbcf8[_0xcbf5('0x27')]]={'$like':'%'+_0x367eb0[_0xcbf5('0x30')]['filter']+'%'};return _0x2b318c;}})});}_0x3389a1=_[_0xcbf5('0x3d')]({},_0x3389a1,_0x367eb0[_0xcbf5('0x3e')]);var _0x5d1d96={'where':_0x3389a1[_0xcbf5('0x39')]};return db['FreshdeskAccount'][_0xcbf5('0x1e')](_0x5d1d96)['then'](function(_0xbbddc9){_0x13024d[_0xcbf5('0x1e')]=_0xbbddc9;if(_0x367eb0[_0xcbf5('0x30')]['includeAll']){_0x3389a1[_0xcbf5('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x3389a1);})['then'](function(_0x3b1847){_0x13024d['rows']=_0x3b1847;return _0x13024d;})['then'](respondWithFilteredResult(_0x9ce00,_0x3389a1))[_0xcbf5('0x40')](handleError(_0x9ce00,null));};exports[_0xcbf5('0x41')]=function(_0x4c106a,_0x222020){var _0x4df47d={'raw':![],'where':{'id':_0x4c106a[_0xcbf5('0x42')]['id']}},_0x3c1fb9={};_0x3c1fb9[_0xcbf5('0x33')]=_[_0xcbf5('0x2f')](db[_0xcbf5('0x2a')][_0xcbf5('0x2b')]);_0x3c1fb9[_0xcbf5('0x30')]=_['keys'](_0x4c106a['query']);_0x3c1fb9['filters']=_[_0xcbf5('0x32')](_0x3c1fb9['model'],_0x3c1fb9[_0xcbf5('0x30')]);_0x4df47d[_0xcbf5('0x35')]=_[_0xcbf5('0x32')](_0x3c1fb9[_0xcbf5('0x33')],qs[_0xcbf5('0x34')](_0x4c106a[_0xcbf5('0x30')][_0xcbf5('0x34')]));_0x4df47d[_0xcbf5('0x35')]=_0x4df47d[_0xcbf5('0x35')][_0xcbf5('0x43')]?_0x4df47d[_0xcbf5('0x35')]:_0x3c1fb9[_0xcbf5('0x33')];if(_0x4c106a[_0xcbf5('0x30')][_0xcbf5('0x44')]){_0x4df47d['include']=[{'all':!![]}];}_0x4df47d=_[_0xcbf5('0x3d')]({},_0x4df47d,_0x4c106a['options']);return db[_0xcbf5('0x2a')][_0xcbf5('0x45')](_0x4df47d)[_0xcbf5('0x23')](handleEntityNotFound(_0x222020,null))[_0xcbf5('0x23')](respondWithResult(_0x222020,null))[_0xcbf5('0x40')](handleError(_0x222020,null));};exports[_0xcbf5('0x46')]=function(_0x3f4020,_0x3db994){return db['FreshdeskAccount']['create'](_0x3f4020[_0xcbf5('0x47')],{})['then'](respondWithResult(_0x3db994,0xc9))['catch'](handleError(_0x3db994,null));};exports[_0xcbf5('0x48')]=function(_0xddb159,_0x372c5d){if(_0xddb159['body']['id']){delete _0xddb159[_0xcbf5('0x47')]['id'];}return db['FreshdeskAccount'][_0xcbf5('0x45')]({'where':{'id':_0xddb159['params']['id']}})[_0xcbf5('0x23')](handleEntityNotFound(_0x372c5d,null))[_0xcbf5('0x23')](saveUpdates(_0xddb159[_0xcbf5('0x47')],null))[_0xcbf5('0x23')](respondWithResult(_0x372c5d,null))[_0xcbf5('0x40')](handleError(_0x372c5d,null));};exports['destroy']=function(_0x36046d,_0xeac2e5){return db[_0xcbf5('0x2a')][_0xcbf5('0x45')]({'where':{'id':_0x36046d['params']['id']}})[_0xcbf5('0x23')](handleEntityNotFound(_0xeac2e5,null))['then'](removeEntity(_0xeac2e5,null))['catch'](handleError(_0xeac2e5,null));};exports['getConfigurations']=function(_0x5c8951,_0x30c38c,_0x5ee439){var _0x1d07e2={};var _0x329536={};var _0x5ada8c;var _0x6c7c11;return db[_0xcbf5('0x2a')]['findOne']({'where':{'id':_0x5c8951[_0xcbf5('0x42')]['id']}})[_0xcbf5('0x23')](handleEntityNotFound(_0x30c38c,null))[_0xcbf5('0x23')](function(_0x5322a6){if(_0x5322a6){_0x5ada8c=_0x5322a6;_0x329536[_0xcbf5('0x33')]=_[_0xcbf5('0x2f')](db[_0xcbf5('0x49')]['rawAttributes']);_0x329536[_0xcbf5('0x30')]=_[_0xcbf5('0x2f')](_0x5c8951['query']);_0x329536[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0x329536[_0xcbf5('0x33')],_0x329536[_0xcbf5('0x30')]);_0x1d07e2[_0xcbf5('0x35')]=_['intersection'](_0x329536['model'],qs[_0xcbf5('0x34')](_0x5c8951['query'][_0xcbf5('0x34')]));_0x1d07e2['attributes']=_0x1d07e2[_0xcbf5('0x35')][_0xcbf5('0x43')]?_0x1d07e2['attributes']:_0x329536[_0xcbf5('0x33')];_0x1d07e2[_0xcbf5('0x37')]=qs['sort'](_0x5c8951[_0xcbf5('0x30')]['sort']);_0x1d07e2[_0xcbf5('0x39')]=qs[_0xcbf5('0x31')](_[_0xcbf5('0x3a')](_0x5c8951['query'],_0x329536['filters']));if(_0x5c8951[_0xcbf5('0x30')][_0xcbf5('0x3b')]){_0x1d07e2[_0xcbf5('0x39')]=_[_0xcbf5('0x3d')](_0x1d07e2[_0xcbf5('0x39')],{'$or':_[_0xcbf5('0x29')](_0x1d07e2[_0xcbf5('0x35')],function(_0x5a6c91){var _0x592572={};_0x592572[_0x5a6c91]={'$like':'%'+_0x5c8951[_0xcbf5('0x30')][_0xcbf5('0x3b')]+'%'};return _0x592572;})});}_0x1d07e2=_[_0xcbf5('0x3d')]({},_0x1d07e2,_0x5c8951[_0xcbf5('0x3e')]);return _0x5ada8c[_0xcbf5('0x4a')](_0x1d07e2);}})[_0xcbf5('0x23')](function(_0x252bb1){if(_0x252bb1){_0x6c7c11=_0x252bb1[_0xcbf5('0x43')];if(!_0x5c8951[_0xcbf5('0x30')][_0xcbf5('0x36')](_0xcbf5('0x4b'))){_0x1d07e2['limit']=qs['limit'](_0x5c8951['query'][_0xcbf5('0x1d')]);_0x1d07e2['offset']=qs['offset'](_0x5c8951['query'][_0xcbf5('0x1b')]);}return _0x5ada8c[_0xcbf5('0x4a')](_0x1d07e2);}})['then'](function(_0x1beffc){if(_0x1beffc){return _0x1beffc?{'count':_0x6c7c11,'rows':_0x1beffc}:null;}})[_0xcbf5('0x23')](respondWithResult(_0x30c38c,null))[_0xcbf5('0x40')](handleError(_0x30c38c,null));};exports['addConfiguration']=function(_0x435de8,_0x3a4bd7,_0x48ddc4){if(_0x435de8[_0xcbf5('0x47')]['id']){delete _0x435de8[_0xcbf5('0x47')]['id'];}return db[_0xcbf5('0x2a')]['findOne']({'where':{'id':_0x435de8['params']['id']}})[_0xcbf5('0x23')](handleEntityNotFound(_0x3a4bd7,null))['then'](function(_0x24e832){if(_0x24e832){_0x435de8[_0xcbf5('0x47')][_0xcbf5('0x4c')]=_0x24e832['id'];_0x435de8['body'][_0xcbf5('0x4d')]=integrations['getSubjects'](_0x435de8[_0xcbf5('0x47')][_0xcbf5('0x4e')],_0x435de8['body'][_0xcbf5('0x2d')]);_0x435de8['body'][_0xcbf5('0x4f')]=integrations[_0xcbf5('0x50')](_0x435de8['body'][_0xcbf5('0x4e')],_0x435de8[_0xcbf5('0x47')][_0xcbf5('0x2d')]);return db['FreshdeskConfiguration'][_0xcbf5('0x46')](_0x435de8[_0xcbf5('0x47')],{'include':[{'model':db[_0xcbf5('0x51')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xcbf5('0x23')](respondWithResult(_0x3a4bd7,null))[_0xcbf5('0x40')](handleError(_0x3a4bd7,null));};exports['getFields']=function(_0x457081,_0x13d744,_0x5da189){var _0x41389e='';return db[_0xcbf5('0x2a')][_0xcbf5('0x52')]({'where':{'id':_0x457081['params']['id']},'attributes':['id',_0xcbf5('0x53'),_0xcbf5('0x54')]})[_0xcbf5('0x23')](handleEntityNotFound(_0x13d744,null))['then'](function(_0x10f6a5){if(_0x10f6a5){_0x41389e=_0x10f6a5['remoteUri'];var _0x2758a4=_0x41389e[_0xcbf5('0x55')](-0x1);if(_0x2758a4==='/'){_0x41389e=_0x41389e[_0xcbf5('0x56')](0x0,_0x41389e[_0xcbf5('0x57')](_0x2758a4));}return rp({'method':'GET','uri':util[_0xcbf5('0x58')](_0xcbf5('0x59'),_0x41389e,_0xcbf5('0x5a')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xcbf5('0x5b'),_0x10f6a5[_0xcbf5('0x54')]))[_0xcbf5('0x5c')]('base64'))},'json':!![]});}})[_0xcbf5('0x23')](function(_0x5d2323){if(_0x5d2323){var _0xb46cc5=['requester','subject',_0xcbf5('0x5d'),_0xcbf5('0x5e'),_0xcbf5('0x19'),_0xcbf5('0x5f'),_0xcbf5('0x60'),'source',_0xcbf5('0x61'),_0xcbf5('0x60'),'company'];_[_0xcbf5('0x62')](_0x5d2323,function(_0x50e8c3){return _0xb46cc5[_0xcbf5('0x63')](_0x50e8c3[_0xcbf5('0x27')])||!_0x50e8c3[_0xcbf5('0x64')]&&_0x50e8c3['type']!=='custom_text'&&_0x50e8c3['type']!==_0xcbf5('0x65');});return{'count':_0x5d2323['length'],'rows':_[_0xcbf5('0x29')](_0x5d2323,function(_0x3aef82){return{'id':_0x3aef82['name'],'name':_0x3aef82[_0xcbf5('0x66')],'custom':!_0x3aef82[_0xcbf5('0x64')],'options':_0x3aef82[_0xcbf5('0x67')]?_[_0xcbf5('0x29')](_0x3aef82[_0xcbf5('0x67')],function(_0x39108a){return{'name':_[_0xcbf5('0x68')](_0x39108a),'value':_0x39108a};}):[]};})};}})['then'](respondWithResult(_0x13d744,null))[_0xcbf5('0x40')](function(_0x30969d){var _0x1a86df=_0x457081[_0xcbf5('0x30')][_0xcbf5('0x69')]?0x1f4:_0x30969d[_0xcbf5('0x6a')]||0x1f4;logger[_0xcbf5('0x25')](_0xcbf5('0x6b'),'getFields',_0x1a86df,JSON[_0xcbf5('0x6c')](_0x30969d));delete _0x30969d['name'];if(_0x1a86df===0x191){_0x1a86df=0x190;}_0x13d744['status'](_0x1a86df)[_0xcbf5('0x6d')](_0x457081[_0xcbf5('0x30')]['test']?{'message':_0xcbf5('0x6e'),'statusCode':_0x30969d[_0xcbf5('0x6a')]}:_0x30969d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 469cdcf..72456cd 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 _0x425a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x4ff863,_0x2fd4c1){var _0x1c05af=function(_0x144826){while(--_0x144826){_0x4ff863['push'](_0x4ff863['shift']());}};_0x1c05af(++_0x2fd4c1);}(_0x425a,0x185));var _0xa425=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x425a[_0x421196];return _0x2738af;};'use strict';var _=require(_0xa425('0x0'));var util=require(_0xa425('0x1'));var logger=require(_0xa425('0x2'))(_0xa425('0x3'));var moment=require(_0xa425('0x4'));var BPromise=require(_0xa425('0x5'));var rp=require(_0xa425('0x6'));var fs=require('fs');var path=require(_0xa425('0x7'));var rimraf=require(_0xa425('0x8'));var config=require(_0xa425('0x9'));var attributes=require(_0xa425('0xa'));var integrations=require(_0xa425('0xb'));module[_0xa425('0xc')]=function(_0x2a82d2,_0x371358){return _0x2a82d2['define'](_0xa425('0xd'),attributes,{'tableName':_0xa425('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc37b=['moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','api'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0xc37b,0x153));var _0xbc37=function(_0x573542,_0x415977){_0x573542=_0x573542-0x0;var _0x27834b=_0xc37b[_0x573542];return _0x27834b;};'use strict';var _=require(_0xbc37('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbc37('0x1'));var moment=require(_0xbc37('0x2'));var BPromise=require(_0xbc37('0x3'));var rp=require(_0xbc37('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc37('0x5'));var attributes=require(_0xbc37('0x6'));var integrations=require(_0xbc37('0x7'));module['exports']=function(_0x5e9c90,_0x2ad00d){return _0x5e9c90[_0xbc37('0x8')](_0xbc37('0x9'),attributes,{'tableName':_0xbc37('0xa'),'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 a82e3bc..b1a115a 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 _0x59d8=['raw','where','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FreshdeskAccount','options','attributes','limit','include','map','model','info','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x2203f3,_0x47f65e){var _0x5825f7=function(_0x13f55c){while(--_0x13f55c){_0x2203f3['push'](_0x2203f3['shift']());}};_0x5825f7(++_0x47f65e);}(_0x59d8,0x119));var _0x859d=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x59d8[_0x25c326];return _0x762452;};'use strict';var _=require(_0x859d('0x0'));var util=require('util');var moment=require(_0x859d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x859d('0x2'));var db=require(_0x859d('0x3'))['db'];var utils=require(_0x859d('0x4'));var logger=require('../../config/logger')(_0x859d('0x5'));var config=require(_0x859d('0x6'));var jayson=require(_0x859d('0x7'));var client=jayson[_0x859d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1e8a,_0x2df167,_0x2f83c5){return new BPromise(function(_0x36e530,_0x1d3bcd){return client[_0x859d('0x9')](_0x2b1e8a,_0x2f83c5)[_0x859d('0xa')](function(_0xe7c328){logger['info'](_0x859d('0xb'),_0x2df167,_0x859d('0xc'));logger[_0x859d('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2df167,_0x859d('0xc'),JSON[_0x859d('0xe')](_0xe7c328));if(_0xe7c328['error']){if(_0xe7c328[_0x859d('0xf')]['code']===0x1f4){logger[_0x859d('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x2df167,_0xe7c328[_0x859d('0xf')]['message']);return _0x1d3bcd(_0xe7c328['error'][_0x859d('0x10')]);}logger[_0x859d('0xf')](_0x859d('0xb'),_0x2df167,_0xe7c328['error'][_0x859d('0x10')]);return _0x36e530(_0xe7c328[_0x859d('0xf')]['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2df167,_0x859d('0xc'));_0x36e530(_0xe7c328[_0x859d('0x11')][_0x859d('0x10')]);}})[_0x859d('0x12')](function(_0x22c0d9){logger[_0x859d('0xf')](_0x859d('0xb'),_0x2df167,_0x22c0d9);_0x1d3bcd(_0x22c0d9);});});}exports['GetFreshdeskAccount']=function(_0xc5d450){var _0x5e6da4=this;return new Promise(function(_0x20a144,_0x34087d){return db[_0x859d('0x13')]['findAll']({'raw':_0xc5d450[_0x859d('0x14')]?_0xc5d450[_0x859d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xc5d450[_0x859d('0x14')]?_0xc5d450['options']['where']||null:null,'attributes':_0xc5d450[_0x859d('0x14')]?_0xc5d450[_0x859d('0x14')][_0x859d('0x15')]||null:null,'limit':_0xc5d450[_0x859d('0x14')]?_0xc5d450['options'][_0x859d('0x16')]||null:null,'include':_0xc5d450[_0x859d('0x14')]?_0xc5d450[_0x859d('0x14')][_0x859d('0x17')]?_[_0x859d('0x18')](_0xc5d450[_0x859d('0x14')]['include'],function(_0x3bc379){return{'model':db[_0x3bc379['model']],'as':_0x3bc379['as'],'attributes':_0x3bc379['attributes'],'include':_0x3bc379[_0x859d('0x17')]?_[_0x859d('0x18')](_0x3bc379[_0x859d('0x17')],function(_0x5ae36f){return{'model':db[_0x5ae36f['model']],'as':_0x5ae36f['as'],'attributes':_0x5ae36f[_0x859d('0x15')],'include':_0x5ae36f[_0x859d('0x17')]?_[_0x859d('0x18')](_0x5ae36f[_0x859d('0x17')],function(_0x15ca13){return{'model':db[_0x15ca13[_0x859d('0x19')]],'as':_0x15ca13['as'],'attributes':_0x15ca13[_0x859d('0x15')]};}):[]};}):[]};}):[]:[]})[_0x859d('0xa')](function(_0xb318e1){logger[_0x859d('0x1a')](_0x859d('0x1b'),_0xc5d450);logger[_0x859d('0xd')]('GetFreshdeskAccount',_0xc5d450,JSON['stringify'](_0xb318e1));_0x20a144(_0xb318e1);})[_0x859d('0x12')](function(_0x1ddac0){logger[_0x859d('0xf')](_0x859d('0x1b'),_0x1ddac0[_0x859d('0x10')],_0xc5d450);_0x34087d(_0x5e6da4[_0x859d('0xf')](0x1f4,_0x1ddac0[_0x859d('0x10')]));});});};exports[_0x859d('0x1c')]=function(_0x22afe4){var _0x2953e4=this;return new Promise(function(_0x1be512,_0x4c57c6){return db[_0x859d('0x13')]['find']({'raw':_0x22afe4['options']?_0x22afe4[_0x859d('0x14')][_0x859d('0x1d')]===undefined?!![]:![]:!![],'where':_0x22afe4[_0x859d('0x14')]?_0x22afe4[_0x859d('0x14')][_0x859d('0x1e')]||null:null,'attributes':_0x22afe4[_0x859d('0x14')]?_0x22afe4['options'][_0x859d('0x15')]||null:null,'include':_0x22afe4[_0x859d('0x14')]?_0x22afe4[_0x859d('0x14')][_0x859d('0x17')]?_['map'](_0x22afe4[_0x859d('0x14')][_0x859d('0x17')],function(_0x58b9ea){return{'model':db[_0x58b9ea[_0x859d('0x19')]],'as':_0x58b9ea['as'],'attributes':_0x58b9ea['attributes'],'include':_0x58b9ea[_0x859d('0x17')]?_[_0x859d('0x18')](_0x58b9ea[_0x859d('0x17')],function(_0x55d9a6){return{'model':db[_0x55d9a6['model']],'as':_0x55d9a6['as'],'attributes':_0x55d9a6['attributes'],'include':_0x55d9a6[_0x859d('0x17')]?_[_0x859d('0x18')](_0x55d9a6['include'],function(_0x4d237f){return{'model':db[_0x4d237f['model']],'as':_0x4d237f['as'],'attributes':_0x4d237f[_0x859d('0x15')]};}):[]};}):[]};}):[]:[]})[_0x859d('0xa')](function(_0x42a523){logger[_0x859d('0x1a')](_0x859d('0x1c'),_0x22afe4);logger[_0x859d('0xd')](_0x859d('0x1c'),_0x22afe4,JSON[_0x859d('0xe')](_0x42a523));_0x1be512(_0x42a523);})[_0x859d('0x12')](function(_0x134ac6){logger[_0x859d('0xf')](_0x859d('0x1c'),_0x134ac6[_0x859d('0x10')],_0x22afe4);_0x4c57c6(_0x2953e4['error'](0x1f4,_0x134ac6[_0x859d('0x10')]));});});}; \ No newline at end of file +var _0x526d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowFreshdeskAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x42eb29,_0x387cd9){var _0xe6953b=function(_0x1b75a9){while(--_0x1b75a9){_0x42eb29['push'](_0x42eb29['shift']());}};_0xe6953b(++_0x387cd9);}(_0x526d,0xce));var _0xd526=function(_0x39f64b,_0x394a2d){_0x39f64b=_0x39f64b-0x0;var _0x353e43=_0x526d[_0x39f64b];return _0x353e43;};'use strict';var _=require(_0xd526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd526('0x1'));var rs=require(_0xd526('0x2'));var fs=require('fs');var Redis=require(_0xd526('0x3'));var db=require(_0xd526('0x4'))['db'];var utils=require(_0xd526('0x5'));var logger=require('../../config/logger')(_0xd526('0x6'));var config=require(_0xd526('0x7'));var jayson=require(_0xd526('0x8'));var client=jayson[_0xd526('0x9')][_0xd526('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3135fb,_0x3087f9,_0xf70857){return new BPromise(function(_0xab346,_0x4eadcd){return client[_0xd526('0xb')](_0x3135fb,_0xf70857)[_0xd526('0xc')](function(_0x36ffac){logger[_0xd526('0xd')](_0xd526('0xe'),_0x3087f9,'request\x20sent');logger['debug'](_0xd526('0xf'),_0x3087f9,_0xd526('0x10'),JSON['stringify'](_0x36ffac));if(_0x36ffac[_0xd526('0x11')]){if(_0x36ffac[_0xd526('0x11')]['code']===0x1f4){logger['error'](_0xd526('0xe'),_0x3087f9,_0x36ffac[_0xd526('0x11')][_0xd526('0x12')]);return _0x4eadcd(_0x36ffac[_0xd526('0x11')]['message']);}logger[_0xd526('0x11')](_0xd526('0xe'),_0x3087f9,_0x36ffac[_0xd526('0x11')][_0xd526('0x12')]);return _0xab346(_0x36ffac[_0xd526('0x11')][_0xd526('0x12')]);}else{logger[_0xd526('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x3087f9,_0xd526('0x10'));_0xab346(_0x36ffac[_0xd526('0x13')][_0xd526('0x12')]);}})[_0xd526('0x14')](function(_0x128cc2){logger[_0xd526('0x11')](_0xd526('0xe'),_0x3087f9,_0x128cc2);_0x4eadcd(_0x128cc2);});});}exports[_0xd526('0x15')]=function(_0x43f93a){var _0xcf9b03=this;return new Promise(function(_0x323d4c,_0x1c1284){return db[_0xd526('0x16')]['findAll']({'raw':_0x43f93a[_0xd526('0x17')]?_0x43f93a[_0xd526('0x17')][_0xd526('0x18')]===undefined?!![]:![]:!![],'where':_0x43f93a[_0xd526('0x17')]?_0x43f93a[_0xd526('0x17')][_0xd526('0x19')]||null:null,'attributes':_0x43f93a['options']?_0x43f93a[_0xd526('0x17')][_0xd526('0x1a')]||null:null,'limit':_0x43f93a[_0xd526('0x17')]?_0x43f93a[_0xd526('0x17')][_0xd526('0x1b')]||null:null,'include':_0x43f93a[_0xd526('0x17')]?_0x43f93a[_0xd526('0x17')][_0xd526('0x1c')]?_[_0xd526('0x1d')](_0x43f93a[_0xd526('0x17')][_0xd526('0x1c')],function(_0x1c808d){return{'model':db[_0x1c808d['model']],'as':_0x1c808d['as'],'attributes':_0x1c808d[_0xd526('0x1a')],'include':_0x1c808d[_0xd526('0x1c')]?_[_0xd526('0x1d')](_0x1c808d[_0xd526('0x1c')],function(_0x586e88){return{'model':db[_0x586e88[_0xd526('0x1e')]],'as':_0x586e88['as'],'attributes':_0x586e88[_0xd526('0x1a')],'include':_0x586e88[_0xd526('0x1c')]?_[_0xd526('0x1d')](_0x586e88['include'],function(_0x5518c6){return{'model':db[_0x5518c6['model']],'as':_0x5518c6['as'],'attributes':_0x5518c6[_0xd526('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd526('0xc')](function(_0x534642){logger['info'](_0xd526('0x15'),_0x43f93a);logger[_0xd526('0x1f')](_0xd526('0x15'),_0x43f93a,JSON[_0xd526('0x20')](_0x534642));_0x323d4c(_0x534642);})['catch'](function(_0x28d74b){logger[_0xd526('0x11')](_0xd526('0x15'),_0x28d74b[_0xd526('0x12')],_0x43f93a);_0x1c1284(_0xcf9b03[_0xd526('0x11')](0x1f4,_0x28d74b[_0xd526('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x42b74b){var _0x3ca843=this;return new Promise(function(_0x56b4ad,_0x55a94c){return db['FreshdeskAccount'][_0xd526('0x21')]({'raw':_0x42b74b[_0xd526('0x17')]?_0x42b74b[_0xd526('0x17')][_0xd526('0x18')]===undefined?!![]:![]:!![],'where':_0x42b74b[_0xd526('0x17')]?_0x42b74b[_0xd526('0x17')]['where']||null:null,'attributes':_0x42b74b[_0xd526('0x17')]?_0x42b74b['options']['attributes']||null:null,'include':_0x42b74b[_0xd526('0x17')]?_0x42b74b[_0xd526('0x17')]['include']?_[_0xd526('0x1d')](_0x42b74b[_0xd526('0x17')][_0xd526('0x1c')],function(_0x2f2d34){return{'model':db[_0x2f2d34[_0xd526('0x1e')]],'as':_0x2f2d34['as'],'attributes':_0x2f2d34[_0xd526('0x1a')],'include':_0x2f2d34['include']?_[_0xd526('0x1d')](_0x2f2d34[_0xd526('0x1c')],function(_0x43c7b8){return{'model':db[_0x43c7b8['model']],'as':_0x43c7b8['as'],'attributes':_0x43c7b8[_0xd526('0x1a')],'include':_0x43c7b8[_0xd526('0x1c')]?_['map'](_0x43c7b8['include'],function(_0x335734){return{'model':db[_0x335734['model']],'as':_0x335734['as'],'attributes':_0x335734[_0xd526('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd526('0xc')](function(_0x236e9a){logger[_0xd526('0xd')](_0xd526('0x22'),_0x42b74b);logger['debug'](_0xd526('0x22'),_0x42b74b,JSON['stringify'](_0x236e9a));_0x56b4ad(_0x236e9a);})[_0xd526('0x14')](function(_0x5c64e4){logger[_0xd526('0x11')](_0xd526('0x22'),_0x5c64e4[_0xd526('0x12')],_0x42b74b);_0x55a94c(_0x3ca843[_0xd526('0x11')](0x1f4,_0x5c64e4[_0xd526('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3f6f252..161c304 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 _0xdcb1=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xdcb1,0x13a));var _0x1dcb=function(_0x37441d,_0x544963){_0x37441d=_0x37441d-0x0;var _0x2f23c3=_0xdcb1[_0x37441d];return _0x2f23c3;};'use strict';var multer=require(_0x1dcb('0x0'));var util=require(_0x1dcb('0x1'));var path=require(_0x1dcb('0x2'));var timeout=require('connect-timeout');var express=require(_0x1dcb('0x3'));var router=express[_0x1dcb('0x4')]();var fs_extra=require(_0x1dcb('0x5'));var auth=require(_0x1dcb('0x6'));var interaction=require(_0x1dcb('0x7'));var config=require('../../config/environment');var controller=require(_0x1dcb('0x8'));router[_0x1dcb('0x9')]('/',auth[_0x1dcb('0xa')](),controller[_0x1dcb('0xb')]);router[_0x1dcb('0x9')](_0x1dcb('0xc'),auth[_0x1dcb('0xa')](),controller[_0x1dcb('0xd')]);router['get'](_0x1dcb('0xe'),auth[_0x1dcb('0xa')](),controller[_0x1dcb('0xf')]);router[_0x1dcb('0x9')](_0x1dcb('0x10'),auth['isAuthenticated'](),controller[_0x1dcb('0x11')]);router[_0x1dcb('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1dcb('0x12')]);router[_0x1dcb('0x9')](_0x1dcb('0x13'),auth['isAuthenticated'](),controller['getTags']);router[_0x1dcb('0x14')]('/',auth[_0x1dcb('0xa')](),controller[_0x1dcb('0x15')]);router[_0x1dcb('0x14')](_0x1dcb('0x13'),auth[_0x1dcb('0xa')](),controller[_0x1dcb('0x16')]);router['put'](_0x1dcb('0xc'),auth[_0x1dcb('0xa')](),controller['update']);router['delete'](_0x1dcb('0xc'),auth[_0x1dcb('0xa')](),controller[_0x1dcb('0x17')]);module[_0x1dcb('0x18')]=router; \ No newline at end of file +var _0xe4da=['create','post','setTags','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x5ccf32,_0x3a0f63){var _0x17015=function(_0x16bb59){while(--_0x16bb59){_0x5ccf32['push'](_0x5ccf32['shift']());}};_0x17015(++_0x3a0f63);}(_0xe4da,0x73));var _0xae4d=function(_0x3b44b9,_0x321aa9){_0x3b44b9=_0x3b44b9-0x0;var _0xeaddfe=_0xe4da[_0x3b44b9];return _0xeaddfe;};'use strict';var multer=require(_0xae4d('0x0'));var util=require('util');var path=require(_0xae4d('0x1'));var timeout=require(_0xae4d('0x2'));var express=require(_0xae4d('0x3'));var router=express[_0xae4d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae4d('0x5'));var config=require(_0xae4d('0x6'));var controller=require(_0xae4d('0x7'));router[_0xae4d('0x8')]('/',auth['isAuthenticated'](),controller[_0xae4d('0x9')]);router[_0xae4d('0x8')](_0xae4d('0xa'),auth[_0xae4d('0xb')](),controller[_0xae4d('0xc')]);router['get'](_0xae4d('0xd'),auth[_0xae4d('0xb')](),controller[_0xae4d('0xe')]);router[_0xae4d('0x8')](_0xae4d('0xf'),auth[_0xae4d('0xb')](),controller[_0xae4d('0x10')]);router[_0xae4d('0x8')](_0xae4d('0x11'),auth[_0xae4d('0xb')](),controller[_0xae4d('0x12')]);router[_0xae4d('0x8')](_0xae4d('0x13'),auth[_0xae4d('0xb')](),controller['getTags']);router['post']('/',auth[_0xae4d('0xb')](),controller[_0xae4d('0x14')]);router[_0xae4d('0x15')]('/:id/tags',auth[_0xae4d('0xb')](),controller[_0xae4d('0x16')]);router[_0xae4d('0x17')](_0xae4d('0xa'),auth[_0xae4d('0xb')](),controller[_0xae4d('0x18')]);router['delete']('/:id',auth[_0xae4d('0xb')](),controller[_0xae4d('0x19')]);module[_0xae4d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2f22b0c..090eca9 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 _0xcb16=['STRING','sequelize','exports'];(function(_0x157732,_0x5e9df6){var _0x5c1803=function(_0x10c48f){while(--_0x10c48f){_0x157732['push'](_0x157732['shift']());}};_0x5c1803(++_0x5e9df6);}(_0xcb16,0x18d));var _0x6cb1=function(_0x5590ad,_0x1c1313){_0x5590ad=_0x5590ad-0x0;var _0x4675f7=_0xcb16[_0x5590ad];return _0x4675f7;};'use strict';var Sequelize=require(_0x6cb1('0x0'));module[_0x6cb1('0x1')]={'name':{'type':Sequelize[_0x6cb1('0x2')]},'description':{'type':Sequelize[_0x6cb1('0x2')]}}; \ No newline at end of file +var _0x91ce=['STRING','sequelize','exports'];(function(_0x3a17d8,_0x13804e){var _0xe6376d=function(_0x3f837e){while(--_0x3f837e){_0x3a17d8['push'](_0x3a17d8['shift']());}};_0xe6376d(++_0x13804e);}(_0x91ce,0x106));var _0xe91c=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x91ce[_0x4d3a2b];return _0xdd32c8;};'use strict';var Sequelize=require(_0xe91c('0x0'));module[_0xe91c('0x1')]={'name':{'type':Sequelize[_0xe91c('0x2')]},'description':{'type':Sequelize[_0xe91c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 794368f..de82b12 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 _0x8fcc=['keys','filters','attributes','model','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','intersection','fields','length','find','create','body','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','name','query'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8fcc,0x79));var _0xc8fc=function(_0x2481dd,_0x233ac0){_0x2481dd=_0x2481dd-0x0;var _0x556fc7=_0x8fcc[_0x2481dd];return _0x556fc7;};'use strict';var emlformat=require(_0xc8fc('0x0'));var rimraf=require(_0xc8fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8fc('0x2'));var rp=require(_0xc8fc('0x3'));var moment=require(_0xc8fc('0x4'));var BPromise=require(_0xc8fc('0x5'));var Mustache=require(_0xc8fc('0x6'));var util=require(_0xc8fc('0x7'));var path=require(_0xc8fc('0x8'));var sox=require(_0xc8fc('0x9'));var csv=require(_0xc8fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8fc('0xb'));var _=require(_0xc8fc('0xc'));var squel=require('squel');var crypto=require(_0xc8fc('0xd'));var jsforce=require(_0xc8fc('0xe'));var deskjs=require(_0xc8fc('0xf'));var toCsv=require(_0xc8fc('0xa'));var querystring=require('querystring');var Papa=require(_0xc8fc('0x10'));var Redis=require('ioredis');var authService=require(_0xc8fc('0x11'));var qs=require(_0xc8fc('0x12'));var as=require(_0xc8fc('0x13'));var hardwareService=require(_0xc8fc('0x14'));var logger=require(_0xc8fc('0x15'))(_0xc8fc('0x16'));var utils=require(_0xc8fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8fc('0x18'));var db=require(_0xc8fc('0x19'))['db'];function respondWithStatusCode(_0xe15193,_0x2ee13d){_0x2ee13d=_0x2ee13d||0xcc;return function(_0x7f3ed0){if(_0x7f3ed0){return _0xe15193[_0xc8fc('0x1a')](_0x2ee13d);}return _0xe15193['status'](_0x2ee13d)[_0xc8fc('0x1b')]();};}function respondWithResult(_0x1498d2,_0x3b5b11){_0x3b5b11=_0x3b5b11||0xc8;return function(_0x202a1f){if(_0x202a1f){return _0x1498d2[_0xc8fc('0x1c')](_0x3b5b11)[_0xc8fc('0x1d')](_0x202a1f);}};}function respondWithFilteredResult(_0x566924,_0x18a538){return function(_0x4eb718){if(_0x4eb718){var _0x5b37bc=typeof _0x18a538[_0xc8fc('0x1e')]===_0xc8fc('0x1f')&&typeof _0x18a538['limit']===_0xc8fc('0x1f');var _0x301887=_0x4eb718[_0xc8fc('0x20')];var _0x28154e=_0x5b37bc?0x0:_0x18a538[_0xc8fc('0x1e')];var _0x2a4a01=_0x5b37bc?_0x4eb718[_0xc8fc('0x20')]:_0x18a538[_0xc8fc('0x1e')]+_0x18a538[_0xc8fc('0x21')];var _0x49f29c;if(_0x2a4a01>=_0x301887){_0x2a4a01=_0x301887;_0x49f29c=0xc8;}else{_0x49f29c=0xce;}_0x566924[_0xc8fc('0x1c')](_0x49f29c);return _0x566924[_0xc8fc('0x22')](_0xc8fc('0x23'),_0x28154e+'-'+_0x2a4a01+'/'+_0x301887)[_0xc8fc('0x1d')](_0x4eb718);}return null;};}function patchUpdates(_0x397ed1){return function(_0x2c6f0e){try{jsonpatch[_0xc8fc('0x24')](_0x2c6f0e,_0x397ed1,!![]);}catch(_0x2bffbe){return BPromise[_0xc8fc('0x25')](_0x2bffbe);}return _0x2c6f0e[_0xc8fc('0x26')]();};}function saveUpdates(_0x48ad52,_0x40e836){return function(_0x1a6c44){if(_0x1a6c44){return _0x1a6c44[_0xc8fc('0x27')](_0x48ad52)[_0xc8fc('0x28')](function(_0x5a3109){return _0x5a3109;});}return null;};}function removeEntity(_0x563c45,_0x330ad6){return function(_0x5457bf){if(_0x5457bf){return _0x5457bf[_0xc8fc('0x29')]()[_0xc8fc('0x28')](function(){_0x563c45[_0xc8fc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3d4e1,_0x116e28){return function(_0x29abac){if(!_0x29abac){_0xf3d4e1[_0xc8fc('0x1a')](0x194);}return _0x29abac;};}function handleError(_0x473e0f,_0x36a64b){_0x36a64b=_0x36a64b||0x1f4;return function(_0x481cd7){logger[_0xc8fc('0x2a')](_0x481cd7[_0xc8fc('0x2b')]);if(_0x481cd7['name']){delete _0x481cd7['name'];}_0x473e0f[_0xc8fc('0x1c')](_0x36a64b)[_0xc8fc('0x2c')](_0x481cd7);};}exports['index']=function(_0x2da4be,_0xcc83a3){var _0x5c2cb6={},_0x50e257={},_0x114a83={'count':0x0,'rows':[]};var _0x5328e8=_[_0xc8fc('0x2d')](db[_0xc8fc('0x2e')][_0xc8fc('0x2f')],function(_0x8bed31){return{'name':_0x8bed31[_0xc8fc('0x30')],'type':_0x8bed31[_0xc8fc('0x31')][_0xc8fc('0x32')]};});_0x50e257['model']=_['map'](_0x5328e8,_0xc8fc('0x33'));_0x50e257[_0xc8fc('0x34')]=_[_0xc8fc('0x35')](_0x2da4be[_0xc8fc('0x34')]);_0x50e257[_0xc8fc('0x36')]=_['intersection'](_0x50e257['model'],_0x50e257[_0xc8fc('0x34')]);_0x5c2cb6[_0xc8fc('0x37')]=_['intersection'](_0x50e257[_0xc8fc('0x38')],qs['fields'](_0x2da4be[_0xc8fc('0x34')]['fields']));_0x5c2cb6[_0xc8fc('0x37')]=_0x5c2cb6['attributes']['length']?_0x5c2cb6[_0xc8fc('0x37')]:_0x50e257[_0xc8fc('0x38')];if(!_0x2da4be['query'][_0xc8fc('0x39')](_0xc8fc('0x3a'))){_0x5c2cb6['limit']=qs[_0xc8fc('0x21')](_0x2da4be[_0xc8fc('0x34')]['limit']);_0x5c2cb6[_0xc8fc('0x1e')]=qs[_0xc8fc('0x1e')](_0x2da4be[_0xc8fc('0x34')]['offset']);}_0x5c2cb6[_0xc8fc('0x3b')]=qs[_0xc8fc('0x3c')](_0x2da4be[_0xc8fc('0x34')][_0xc8fc('0x3c')]);_0x5c2cb6[_0xc8fc('0x3d')]=qs['filters'](_['pick'](_0x2da4be[_0xc8fc('0x34')],_0x50e257[_0xc8fc('0x36')]),_0x5328e8);if(_0x2da4be[_0xc8fc('0x34')]['filter']){_0x5c2cb6[_0xc8fc('0x3d')]=_[_0xc8fc('0x3e')](_0x5c2cb6[_0xc8fc('0x3d')],{'$or':_[_0xc8fc('0x2d')](_0x5328e8,function(_0x3cd1ea){if(_0x3cd1ea[_0xc8fc('0x31')]!==_0xc8fc('0x3f')){var _0x5a9cca={};_0x5a9cca[_0x3cd1ea[_0xc8fc('0x33')]]={'$like':'%'+_0x2da4be[_0xc8fc('0x34')][_0xc8fc('0x40')]+'%'};return _0x5a9cca;}})});}_0x5c2cb6=_['merge']({},_0x5c2cb6,_0x2da4be[_0xc8fc('0x41')]);var _0x3df3bd={'where':_0x5c2cb6['where']};return db[_0xc8fc('0x2e')][_0xc8fc('0x20')](_0x3df3bd)[_0xc8fc('0x28')](function(_0x48fcf){_0x114a83[_0xc8fc('0x20')]=_0x48fcf;if(_0x2da4be[_0xc8fc('0x34')][_0xc8fc('0x42')]){_0x5c2cb6['include']=[{'all':!![]}];}return db[_0xc8fc('0x2e')][_0xc8fc('0x43')](_0x5c2cb6);})[_0xc8fc('0x28')](function(_0x2f7577){_0x114a83[_0xc8fc('0x44')]=_0x2f7577;return _0x114a83;})['then'](respondWithFilteredResult(_0xcc83a3,_0x5c2cb6))[_0xc8fc('0x45')](handleError(_0xcc83a3,null));};exports[_0xc8fc('0x46')]=function(_0x13ef9c,_0x2aa196){var _0x246576={'raw':![],'where':{'id':_0x13ef9c[_0xc8fc('0x47')]['id']}},_0x4082ba={};_0x4082ba[_0xc8fc('0x38')]=_[_0xc8fc('0x35')](db[_0xc8fc('0x2e')][_0xc8fc('0x2f')]);_0x4082ba[_0xc8fc('0x34')]=_[_0xc8fc('0x35')](_0x13ef9c['query']);_0x4082ba[_0xc8fc('0x36')]=_['intersection'](_0x4082ba[_0xc8fc('0x38')],_0x4082ba[_0xc8fc('0x34')]);_0x246576[_0xc8fc('0x37')]=_[_0xc8fc('0x48')](_0x4082ba[_0xc8fc('0x38')],qs[_0xc8fc('0x49')](_0x13ef9c[_0xc8fc('0x34')][_0xc8fc('0x49')]));_0x246576[_0xc8fc('0x37')]=_0x246576['attributes'][_0xc8fc('0x4a')]?_0x246576[_0xc8fc('0x37')]:_0x4082ba[_0xc8fc('0x38')];if(_0x13ef9c[_0xc8fc('0x34')][_0xc8fc('0x42')]){_0x246576['include']=[{'all':!![]}];}_0x246576=_[_0xc8fc('0x3e')]({},_0x246576,_0x13ef9c[_0xc8fc('0x41')]);return db[_0xc8fc('0x2e')][_0xc8fc('0x4b')](_0x246576)[_0xc8fc('0x28')](handleEntityNotFound(_0x2aa196,null))[_0xc8fc('0x28')](respondWithResult(_0x2aa196,null))[_0xc8fc('0x45')](handleError(_0x2aa196,null));};exports[_0xc8fc('0x4c')]=function(_0x4d1f95,_0x1ac33c){return db['FreshdeskConfiguration']['create'](_0x4d1f95[_0xc8fc('0x4d')],{})[_0xc8fc('0x28')](respondWithResult(_0x1ac33c,0xc9))[_0xc8fc('0x45')](handleError(_0x1ac33c,null));};exports[_0xc8fc('0x27')]=function(_0x53d485,_0x57455b){if(_0x53d485[_0xc8fc('0x4d')]['id']){delete _0x53d485['body']['id'];}return db[_0xc8fc('0x2e')][_0xc8fc('0x4b')]({'where':{'id':_0x53d485[_0xc8fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x57455b,null))[_0xc8fc('0x28')](saveUpdates(_0x53d485[_0xc8fc('0x4d')],null))['then'](respondWithResult(_0x57455b,null))['catch'](handleError(_0x57455b,null));};exports['destroy']=function(_0x258b6f,_0x43411d){return db[_0xc8fc('0x2e')]['find']({'where':{'id':_0x258b6f[_0xc8fc('0x47')]['id']}})[_0xc8fc('0x28')](handleEntityNotFound(_0x43411d,null))[_0xc8fc('0x28')](removeEntity(_0x43411d,null))[_0xc8fc('0x45')](handleError(_0x43411d,null));};exports[_0xc8fc('0x4e')]=function(_0x3955c8,_0x2187ac,_0x3ead5e){var _0x554867={};var _0x19f32f={};var _0x2f1f5d;var _0x174d9d;return db['FreshdeskConfiguration'][_0xc8fc('0x4f')]({'where':{'id':_0x3955c8[_0xc8fc('0x47')]['id']}})[_0xc8fc('0x28')](handleEntityNotFound(_0x2187ac,null))[_0xc8fc('0x28')](function(_0x441550){if(_0x441550){_0x2f1f5d=_0x441550;_0x19f32f['model']=_[_0xc8fc('0x35')](db[_0xc8fc('0x50')][_0xc8fc('0x2f')]);_0x19f32f[_0xc8fc('0x34')]=_[_0xc8fc('0x35')](_0x3955c8[_0xc8fc('0x34')]);_0x19f32f[_0xc8fc('0x36')]=_[_0xc8fc('0x48')](_0x19f32f[_0xc8fc('0x38')],_0x19f32f[_0xc8fc('0x34')]);_0x554867[_0xc8fc('0x37')]=_[_0xc8fc('0x48')](_0x19f32f[_0xc8fc('0x38')],qs[_0xc8fc('0x49')](_0x3955c8['query'][_0xc8fc('0x49')]));_0x554867['attributes']=_0x554867[_0xc8fc('0x37')]['length']?_0x554867[_0xc8fc('0x37')]:_0x19f32f[_0xc8fc('0x38')];_0x554867[_0xc8fc('0x3b')]=qs['sort'](_0x3955c8[_0xc8fc('0x34')][_0xc8fc('0x3c')]);_0x554867[_0xc8fc('0x3d')]=qs[_0xc8fc('0x36')](_[_0xc8fc('0x51')](_0x3955c8['query'],_0x19f32f['filters']));if(_0x3955c8['query'][_0xc8fc('0x40')]){_0x554867[_0xc8fc('0x3d')]=_['merge'](_0x554867[_0xc8fc('0x3d')],{'$or':_[_0xc8fc('0x2d')](_0x554867[_0xc8fc('0x37')],function(_0x5dc11b){var _0x3bb7fe={};_0x3bb7fe[_0x5dc11b]={'$like':'%'+_0x3955c8[_0xc8fc('0x34')][_0xc8fc('0x40')]+'%'};return _0x3bb7fe;})});}_0x554867=_['merge']({},_0x554867,_0x3955c8[_0xc8fc('0x41')]);return _0x2f1f5d[_0xc8fc('0x4e')](_0x554867);}})['then'](function(_0x3deb4b){if(_0x3deb4b){_0x174d9d=_0x3deb4b['length'];if(!_0x3955c8[_0xc8fc('0x34')][_0xc8fc('0x39')]('nolimit')){_0x554867[_0xc8fc('0x21')]=qs['limit'](_0x3955c8['query'][_0xc8fc('0x21')]);_0x554867[_0xc8fc('0x1e')]=qs['offset'](_0x3955c8[_0xc8fc('0x34')]['offset']);}return _0x2f1f5d['getFields'](_0x554867);}})['then'](function(_0x41aa0c){if(_0x41aa0c){return _0x41aa0c?{'count':_0x174d9d,'rows':_0x41aa0c}:null;}})['then'](respondWithResult(_0x2187ac,null))[_0xc8fc('0x45')](handleError(_0x2187ac,null));};exports[_0xc8fc('0x52')]=function(_0x8b13b7,_0x253192,_0x5b7a22){var _0x2d97e4={};var _0x35610f={};var _0xcb1380;var _0x111766;return db[_0xc8fc('0x2e')]['findOne']({'where':{'id':_0x8b13b7['params']['id']}})[_0xc8fc('0x28')](handleEntityNotFound(_0x253192,null))['then'](function(_0x231cc0){if(_0x231cc0){_0xcb1380=_0x231cc0;_0x35610f['model']=_[_0xc8fc('0x35')](db[_0xc8fc('0x50')][_0xc8fc('0x2f')]);_0x35610f[_0xc8fc('0x34')]=_[_0xc8fc('0x35')](_0x8b13b7[_0xc8fc('0x34')]);_0x35610f[_0xc8fc('0x36')]=_['intersection'](_0x35610f[_0xc8fc('0x38')],_0x35610f[_0xc8fc('0x34')]);_0x2d97e4[_0xc8fc('0x37')]=_['intersection'](_0x35610f[_0xc8fc('0x38')],qs['fields'](_0x8b13b7['query'][_0xc8fc('0x49')]));_0x2d97e4[_0xc8fc('0x37')]=_0x2d97e4[_0xc8fc('0x37')][_0xc8fc('0x4a')]?_0x2d97e4[_0xc8fc('0x37')]:_0x35610f[_0xc8fc('0x38')];_0x2d97e4[_0xc8fc('0x3b')]=qs[_0xc8fc('0x3c')](_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x3c')]);_0x2d97e4[_0xc8fc('0x3d')]=qs[_0xc8fc('0x36')](_[_0xc8fc('0x51')](_0x8b13b7['query'],_0x35610f[_0xc8fc('0x36')]));if(_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x40')]){_0x2d97e4[_0xc8fc('0x3d')]=_[_0xc8fc('0x3e')](_0x2d97e4[_0xc8fc('0x3d')],{'$or':_['map'](_0x2d97e4[_0xc8fc('0x37')],function(_0x207273){var _0x1c95af={};_0x1c95af[_0x207273]={'$like':'%'+_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x40')]+'%'};return _0x1c95af;})});}_0x2d97e4=_[_0xc8fc('0x3e')]({},_0x2d97e4,_0x8b13b7[_0xc8fc('0x41')]);return _0xcb1380[_0xc8fc('0x52')](_0x2d97e4);}})['then'](function(_0x47ead3){if(_0x47ead3){_0x111766=_0x47ead3[_0xc8fc('0x4a')];if(!_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x39')]('nolimit')){_0x2d97e4['limit']=qs[_0xc8fc('0x21')](_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x21')]);_0x2d97e4[_0xc8fc('0x1e')]=qs[_0xc8fc('0x1e')](_0x8b13b7[_0xc8fc('0x34')][_0xc8fc('0x1e')]);}return _0xcb1380[_0xc8fc('0x52')](_0x2d97e4);}})[_0xc8fc('0x28')](function(_0x9e5f1f){if(_0x9e5f1f){return _0x9e5f1f?{'count':_0x111766,'rows':_0x9e5f1f}:null;}})[_0xc8fc('0x28')](respondWithResult(_0x253192,null))[_0xc8fc('0x45')](handleError(_0x253192,null));};exports['getDescriptions']=function(_0x52b903,_0x12d21e,_0x21253d){var _0x3161a8={};var _0x2e9d82={};var _0x5d2d70;var _0x12af50;return db['FreshdeskConfiguration'][_0xc8fc('0x4f')]({'where':{'id':_0x52b903[_0xc8fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x12d21e,null))[_0xc8fc('0x28')](function(_0x4aa6a7){if(_0x4aa6a7){_0x5d2d70=_0x4aa6a7;_0x2e9d82[_0xc8fc('0x38')]=_['keys'](db['FreshdeskField'][_0xc8fc('0x2f')]);_0x2e9d82['query']=_[_0xc8fc('0x35')](_0x52b903[_0xc8fc('0x34')]);_0x2e9d82[_0xc8fc('0x36')]=_['intersection'](_0x2e9d82[_0xc8fc('0x38')],_0x2e9d82[_0xc8fc('0x34')]);_0x3161a8[_0xc8fc('0x37')]=_['intersection'](_0x2e9d82[_0xc8fc('0x38')],qs[_0xc8fc('0x49')](_0x52b903[_0xc8fc('0x34')][_0xc8fc('0x49')]));_0x3161a8[_0xc8fc('0x37')]=_0x3161a8[_0xc8fc('0x37')][_0xc8fc('0x4a')]?_0x3161a8['attributes']:_0x2e9d82[_0xc8fc('0x38')];_0x3161a8['order']=qs['sort'](_0x52b903['query'][_0xc8fc('0x3c')]);_0x3161a8['where']=qs['filters'](_[_0xc8fc('0x51')](_0x52b903['query'],_0x2e9d82[_0xc8fc('0x36')]));if(_0x52b903['query'][_0xc8fc('0x40')]){_0x3161a8['where']=_[_0xc8fc('0x3e')](_0x3161a8[_0xc8fc('0x3d')],{'$or':_['map'](_0x3161a8[_0xc8fc('0x37')],function(_0x1b3dd9){var _0x1bc337={};_0x1bc337[_0x1b3dd9]={'$like':'%'+_0x52b903[_0xc8fc('0x34')]['filter']+'%'};return _0x1bc337;})});}_0x3161a8=_[_0xc8fc('0x3e')]({},_0x3161a8,_0x52b903[_0xc8fc('0x41')]);return _0x5d2d70[_0xc8fc('0x53')](_0x3161a8);}})[_0xc8fc('0x28')](function(_0x45e2d8){if(_0x45e2d8){_0x12af50=_0x45e2d8[_0xc8fc('0x4a')];if(!_0x52b903[_0xc8fc('0x34')]['hasOwnProperty'](_0xc8fc('0x3a'))){_0x3161a8[_0xc8fc('0x21')]=qs[_0xc8fc('0x21')](_0x52b903[_0xc8fc('0x34')][_0xc8fc('0x21')]);_0x3161a8[_0xc8fc('0x1e')]=qs[_0xc8fc('0x1e')](_0x52b903[_0xc8fc('0x34')]['offset']);}return _0x5d2d70[_0xc8fc('0x53')](_0x3161a8);}})['then'](function(_0x287b8d){if(_0x287b8d){return _0x287b8d?{'count':_0x12af50,'rows':_0x287b8d}:null;}})['then'](respondWithResult(_0x12d21e,null))['catch'](handleError(_0x12d21e,null));};exports['getTags']=function(_0x4bb79d,_0x1686ae,_0x186ad2){var _0x48e838={};var _0x1b0dc3={};var _0x1e151a;var _0x28b90d;return db[_0xc8fc('0x2e')]['findOne']({'where':{'id':_0x4bb79d[_0xc8fc('0x47')]['id']}})[_0xc8fc('0x28')](handleEntityNotFound(_0x1686ae,null))[_0xc8fc('0x28')](function(_0x374ab9){if(_0x374ab9){_0x1e151a=_0x374ab9;_0x1b0dc3[_0xc8fc('0x38')]=_[_0xc8fc('0x35')](db['Tag'][_0xc8fc('0x2f')]);_0x1b0dc3[_0xc8fc('0x34')]=_[_0xc8fc('0x35')](_0x4bb79d[_0xc8fc('0x34')]);_0x1b0dc3[_0xc8fc('0x36')]=_[_0xc8fc('0x48')](_0x1b0dc3[_0xc8fc('0x38')],_0x1b0dc3[_0xc8fc('0x34')]);_0x48e838[_0xc8fc('0x37')]=_['intersection'](_0x1b0dc3[_0xc8fc('0x38')],qs[_0xc8fc('0x49')](_0x4bb79d['query'][_0xc8fc('0x49')]));_0x48e838[_0xc8fc('0x37')]=_0x48e838[_0xc8fc('0x37')][_0xc8fc('0x4a')]?_0x48e838[_0xc8fc('0x37')]:_0x1b0dc3['model'];_0x48e838[_0xc8fc('0x3b')]=qs[_0xc8fc('0x3c')](_0x4bb79d[_0xc8fc('0x34')][_0xc8fc('0x3c')]);_0x48e838[_0xc8fc('0x3d')]=qs['filters'](_[_0xc8fc('0x51')](_0x4bb79d[_0xc8fc('0x34')],_0x1b0dc3[_0xc8fc('0x36')]));if(_0x4bb79d[_0xc8fc('0x34')][_0xc8fc('0x40')]){_0x48e838[_0xc8fc('0x3d')]=_[_0xc8fc('0x3e')](_0x48e838[_0xc8fc('0x3d')],{'$or':_['map'](_0x48e838[_0xc8fc('0x37')],function(_0x5a180a){var _0x2b2ce1={};_0x2b2ce1[_0x5a180a]={'$like':'%'+_0x4bb79d[_0xc8fc('0x34')][_0xc8fc('0x40')]+'%'};return _0x2b2ce1;})});}_0x48e838=_[_0xc8fc('0x3e')]({},_0x48e838,_0x4bb79d[_0xc8fc('0x41')]);return _0x1e151a['getTags'](_0x48e838);}})['then'](function(_0x53b9bc){if(_0x53b9bc){_0x28b90d=_0x53b9bc[_0xc8fc('0x4a')];if(!_0x4bb79d['query'][_0xc8fc('0x39')](_0xc8fc('0x3a'))){_0x48e838[_0xc8fc('0x21')]=qs['limit'](_0x4bb79d['query'][_0xc8fc('0x21')]);_0x48e838[_0xc8fc('0x1e')]=qs[_0xc8fc('0x1e')](_0x4bb79d[_0xc8fc('0x34')]['offset']);}return _0x1e151a[_0xc8fc('0x54')](_0x48e838);}})[_0xc8fc('0x28')](function(_0x3f27f3){if(_0x3f27f3){return _0x3f27f3?{'count':_0x28b90d,'rows':_0x3f27f3}:null;}})['then'](respondWithResult(_0x1686ae,null))['catch'](handleError(_0x1686ae,null));};exports['setTags']=function(_0x21ecb8,_0x355459,_0xb171fa){if(_0x21ecb8[_0xc8fc('0x4d')]['id']){delete _0x21ecb8['body']['id'];}return db[_0xc8fc('0x2e')][_0xc8fc('0x4f')]({'where':{'id':_0x21ecb8[_0xc8fc('0x47')]['id']}})[_0xc8fc('0x28')](handleEntityNotFound(_0x355459,null))[_0xc8fc('0x28')](function(_0x531b6){if(_0x531b6){return _0x531b6[_0xc8fc('0x55')](_0x21ecb8[_0xc8fc('0x4d')][_0xc8fc('0x56')]||[]);}return null;})[_0xc8fc('0x28')](respondWithResult(_0x355459,null))[_0xc8fc('0x45')](handleError(_0x355459,null));}; \ No newline at end of file +var _0x6053=['then','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update'];(function(_0x6e9abf,_0x52e82e){var _0x589f29=function(_0x543490){while(--_0x543490){_0x6e9abf['push'](_0x6e9abf['shift']());}};_0x589f29(++_0x52e82e);}(_0x6053,0x80));var _0x3605=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6053[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3605('0x0'));var rimraf=require(_0x3605('0x1'));var zipdir=require(_0x3605('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3605('0x3'));var moment=require('moment');var BPromise=require(_0x3605('0x4'));var Mustache=require(_0x3605('0x5'));var util=require(_0x3605('0x6'));var path=require(_0x3605('0x7'));var sox=require(_0x3605('0x8'));var csv=require(_0x3605('0x9'));var ejs=require(_0x3605('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3605('0xb'));var squel=require('squel');var crypto=require(_0x3605('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3605('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3605('0xe'));var Papa=require(_0x3605('0xf'));var Redis=require(_0x3605('0x10'));var authService=require(_0x3605('0x11'));var qs=require(_0x3605('0x12'));var as=require(_0x3605('0x13'));var hardwareService=require(_0x3605('0x14'));var logger=require(_0x3605('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3605('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597e30,_0x552b20){_0x552b20=_0x552b20||0xcc;return function(_0x22f471){if(_0x22f471){return _0x597e30[_0x3605('0x17')](_0x552b20);}return _0x597e30['status'](_0x552b20)[_0x3605('0x18')]();};}function respondWithResult(_0x4e0564,_0x574860){_0x574860=_0x574860||0xc8;return function(_0x2cd84f){if(_0x2cd84f){return _0x4e0564[_0x3605('0x19')](_0x574860)[_0x3605('0x1a')](_0x2cd84f);}};}function respondWithFilteredResult(_0x14c79d,_0x4e9887){return function(_0x4120e6){if(_0x4120e6){var _0x58a917=typeof _0x4e9887['offset']===_0x3605('0x1b')&&typeof _0x4e9887[_0x3605('0x1c')]===_0x3605('0x1b');var _0x4ec7c2=_0x4120e6['count'];var _0x9c084f=_0x58a917?0x0:_0x4e9887[_0x3605('0x1d')];var _0x5dbdd8=_0x58a917?_0x4120e6[_0x3605('0x1e')]:_0x4e9887['offset']+_0x4e9887['limit'];var _0x523308;if(_0x5dbdd8>=_0x4ec7c2){_0x5dbdd8=_0x4ec7c2;_0x523308=0xc8;}else{_0x523308=0xce;}_0x14c79d[_0x3605('0x19')](_0x523308);return _0x14c79d[_0x3605('0x1f')](_0x3605('0x20'),_0x9c084f+'-'+_0x5dbdd8+'/'+_0x4ec7c2)[_0x3605('0x1a')](_0x4120e6);}return null;};}function patchUpdates(_0x55793f){return function(_0x2f39d5){try{jsonpatch[_0x3605('0x21')](_0x2f39d5,_0x55793f,!![]);}catch(_0x5eb2da){return BPromise[_0x3605('0x22')](_0x5eb2da);}return _0x2f39d5['save']();};}function saveUpdates(_0x41f9a4,_0x18a1ca){return function(_0x10bf35){if(_0x10bf35){return _0x10bf35[_0x3605('0x23')](_0x41f9a4)[_0x3605('0x24')](function(_0x2150e7){return _0x2150e7;});}return null;};}function removeEntity(_0x127bd0,_0x47960d){return function(_0xd449cc){if(_0xd449cc){return _0xd449cc['destroy']()[_0x3605('0x24')](function(){_0x127bd0[_0x3605('0x19')](0xcc)[_0x3605('0x18')]();});}};}function handleEntityNotFound(_0x581f15,_0x3eeb9b){return function(_0x18c7f6){if(!_0x18c7f6){_0x581f15[_0x3605('0x17')](0x194);}return _0x18c7f6;};}function handleError(_0x4261eb,_0x57d09e){_0x57d09e=_0x57d09e||0x1f4;return function(_0x14ff92){logger['error'](_0x14ff92[_0x3605('0x25')]);if(_0x14ff92[_0x3605('0x26')]){delete _0x14ff92[_0x3605('0x26')];}_0x4261eb[_0x3605('0x19')](_0x57d09e)['send'](_0x14ff92);};}exports[_0x3605('0x27')]=function(_0x3d149f,_0x26ce1d){var _0x55ea82={},_0x28aead={},_0x154a3a={'count':0x0,'rows':[]};var _0x2a709a=_['map'](db[_0x3605('0x28')][_0x3605('0x29')],function(_0x3c0fab){return{'name':_0x3c0fab['fieldName'],'type':_0x3c0fab[_0x3605('0x2a')][_0x3605('0x2b')]};});_0x28aead[_0x3605('0x2c')]=_['map'](_0x2a709a,_0x3605('0x26'));_0x28aead[_0x3605('0x2d')]=_[_0x3605('0x2e')](_0x3d149f[_0x3605('0x2d')]);_0x28aead['filters']=_[_0x3605('0x2f')](_0x28aead['model'],_0x28aead[_0x3605('0x2d')]);_0x55ea82[_0x3605('0x30')]=_[_0x3605('0x2f')](_0x28aead['model'],qs['fields'](_0x3d149f[_0x3605('0x2d')][_0x3605('0x31')]));_0x55ea82[_0x3605('0x30')]=_0x55ea82[_0x3605('0x30')][_0x3605('0x32')]?_0x55ea82[_0x3605('0x30')]:_0x28aead[_0x3605('0x2c')];if(!_0x3d149f[_0x3605('0x2d')][_0x3605('0x33')](_0x3605('0x34'))){_0x55ea82['limit']=qs[_0x3605('0x1c')](_0x3d149f[_0x3605('0x2d')]['limit']);_0x55ea82[_0x3605('0x1d')]=qs[_0x3605('0x1d')](_0x3d149f[_0x3605('0x2d')][_0x3605('0x1d')]);}_0x55ea82[_0x3605('0x35')]=qs[_0x3605('0x36')](_0x3d149f['query'][_0x3605('0x36')]);_0x55ea82[_0x3605('0x37')]=qs[_0x3605('0x38')](_[_0x3605('0x39')](_0x3d149f[_0x3605('0x2d')],_0x28aead[_0x3605('0x38')]),_0x2a709a);if(_0x3d149f[_0x3605('0x2d')][_0x3605('0x3a')]){_0x55ea82[_0x3605('0x37')]=_['merge'](_0x55ea82[_0x3605('0x37')],{'$or':_[_0x3605('0x3b')](_0x2a709a,function(_0xcdf797){if(_0xcdf797['type']!=='VIRTUAL'){var _0x1cfc9b={};_0x1cfc9b[_0xcdf797[_0x3605('0x26')]]={'$like':'%'+_0x3d149f[_0x3605('0x2d')][_0x3605('0x3a')]+'%'};return _0x1cfc9b;}})});}_0x55ea82=_[_0x3605('0x3c')]({},_0x55ea82,_0x3d149f[_0x3605('0x3d')]);var _0x413cfd={'where':_0x55ea82['where']};return db[_0x3605('0x28')][_0x3605('0x1e')](_0x413cfd)[_0x3605('0x24')](function(_0x42aa37){_0x154a3a[_0x3605('0x1e')]=_0x42aa37;if(_0x3d149f[_0x3605('0x2d')][_0x3605('0x3e')]){_0x55ea82['include']=[{'all':!![]}];}return db[_0x3605('0x28')][_0x3605('0x3f')](_0x55ea82);})[_0x3605('0x24')](function(_0x55bd13){_0x154a3a[_0x3605('0x40')]=_0x55bd13;return _0x154a3a;})['then'](respondWithFilteredResult(_0x26ce1d,_0x55ea82))['catch'](handleError(_0x26ce1d,null));};exports[_0x3605('0x41')]=function(_0x5925b1,_0x298c22){var _0x4e3bf1={'raw':![],'where':{'id':_0x5925b1[_0x3605('0x42')]['id']}},_0x3c6991={};_0x3c6991['model']=_['keys'](db[_0x3605('0x28')][_0x3605('0x29')]);_0x3c6991['query']=_[_0x3605('0x2e')](_0x5925b1[_0x3605('0x2d')]);_0x3c6991[_0x3605('0x38')]=_['intersection'](_0x3c6991[_0x3605('0x2c')],_0x3c6991[_0x3605('0x2d')]);_0x4e3bf1[_0x3605('0x30')]=_[_0x3605('0x2f')](_0x3c6991[_0x3605('0x2c')],qs[_0x3605('0x31')](_0x5925b1[_0x3605('0x2d')][_0x3605('0x31')]));_0x4e3bf1['attributes']=_0x4e3bf1[_0x3605('0x30')][_0x3605('0x32')]?_0x4e3bf1[_0x3605('0x30')]:_0x3c6991[_0x3605('0x2c')];if(_0x5925b1[_0x3605('0x2d')][_0x3605('0x3e')]){_0x4e3bf1[_0x3605('0x43')]=[{'all':!![]}];}_0x4e3bf1=_['merge']({},_0x4e3bf1,_0x5925b1[_0x3605('0x3d')]);return db[_0x3605('0x28')][_0x3605('0x44')](_0x4e3bf1)['then'](handleEntityNotFound(_0x298c22,null))['then'](respondWithResult(_0x298c22,null))['catch'](handleError(_0x298c22,null));};exports[_0x3605('0x45')]=function(_0x52d32d,_0x1d6247){return db[_0x3605('0x28')][_0x3605('0x45')](_0x52d32d['body'],{})[_0x3605('0x24')](respondWithResult(_0x1d6247,0xc9))['catch'](handleError(_0x1d6247,null));};exports[_0x3605('0x23')]=function(_0x3e6a18,_0x81018c){if(_0x3e6a18[_0x3605('0x46')]['id']){delete _0x3e6a18[_0x3605('0x46')]['id'];}return db[_0x3605('0x28')][_0x3605('0x44')]({'where':{'id':_0x3e6a18[_0x3605('0x42')]['id']}})[_0x3605('0x24')](handleEntityNotFound(_0x81018c,null))[_0x3605('0x24')](saveUpdates(_0x3e6a18['body'],null))[_0x3605('0x24')](respondWithResult(_0x81018c,null))[_0x3605('0x47')](handleError(_0x81018c,null));};exports[_0x3605('0x48')]=function(_0x34066c,_0x350288){return db[_0x3605('0x28')][_0x3605('0x44')]({'where':{'id':_0x34066c[_0x3605('0x42')]['id']}})[_0x3605('0x24')](handleEntityNotFound(_0x350288,null))['then'](removeEntity(_0x350288,null))[_0x3605('0x47')](handleError(_0x350288,null));};exports[_0x3605('0x49')]=function(_0x1b9afe,_0x1d7c64,_0x1331a7){var _0x220273={};var _0x1d8e50={};var _0x1351dc;var _0x138143;return db[_0x3605('0x28')][_0x3605('0x4a')]({'where':{'id':_0x1b9afe['params']['id']}})[_0x3605('0x24')](handleEntityNotFound(_0x1d7c64,null))[_0x3605('0x24')](function(_0x4b7ab7){if(_0x4b7ab7){_0x1351dc=_0x4b7ab7;_0x1d8e50[_0x3605('0x2c')]=_[_0x3605('0x2e')](db[_0x3605('0x4b')][_0x3605('0x29')]);_0x1d8e50[_0x3605('0x2d')]=_['keys'](_0x1b9afe[_0x3605('0x2d')]);_0x1d8e50['filters']=_['intersection'](_0x1d8e50[_0x3605('0x2c')],_0x1d8e50[_0x3605('0x2d')]);_0x220273[_0x3605('0x30')]=_[_0x3605('0x2f')](_0x1d8e50[_0x3605('0x2c')],qs[_0x3605('0x31')](_0x1b9afe[_0x3605('0x2d')]['fields']));_0x220273[_0x3605('0x30')]=_0x220273[_0x3605('0x30')][_0x3605('0x32')]?_0x220273[_0x3605('0x30')]:_0x1d8e50[_0x3605('0x2c')];_0x220273['order']=qs[_0x3605('0x36')](_0x1b9afe['query']['sort']);_0x220273['where']=qs['filters'](_[_0x3605('0x39')](_0x1b9afe[_0x3605('0x2d')],_0x1d8e50[_0x3605('0x38')]));if(_0x1b9afe['query'][_0x3605('0x3a')]){_0x220273[_0x3605('0x37')]=_[_0x3605('0x3c')](_0x220273['where'],{'$or':_['map'](_0x220273[_0x3605('0x30')],function(_0x3dbafb){var _0x134fac={};_0x134fac[_0x3dbafb]={'$like':'%'+_0x1b9afe[_0x3605('0x2d')][_0x3605('0x3a')]+'%'};return _0x134fac;})});}_0x220273=_['merge']({},_0x220273,_0x1b9afe['options']);return _0x1351dc['getFields'](_0x220273);}})[_0x3605('0x24')](function(_0x471647){if(_0x471647){_0x138143=_0x471647[_0x3605('0x32')];if(!_0x1b9afe[_0x3605('0x2d')]['hasOwnProperty']('nolimit')){_0x220273[_0x3605('0x1c')]=qs[_0x3605('0x1c')](_0x1b9afe[_0x3605('0x2d')]['limit']);_0x220273[_0x3605('0x1d')]=qs[_0x3605('0x1d')](_0x1b9afe['query'][_0x3605('0x1d')]);}return _0x1351dc[_0x3605('0x49')](_0x220273);}})[_0x3605('0x24')](function(_0x1867dd){if(_0x1867dd){return _0x1867dd?{'count':_0x138143,'rows':_0x1867dd}:null;}})[_0x3605('0x24')](respondWithResult(_0x1d7c64,null))[_0x3605('0x47')](handleError(_0x1d7c64,null));};exports[_0x3605('0x4c')]=function(_0x1d0bd7,_0x31aa7c,_0xba4639){var _0x8ac98a={};var _0x30762f={};var _0x5b7822;var _0x54cf56;return db[_0x3605('0x28')][_0x3605('0x4a')]({'where':{'id':_0x1d0bd7[_0x3605('0x42')]['id']}})['then'](handleEntityNotFound(_0x31aa7c,null))['then'](function(_0x57214a){if(_0x57214a){_0x5b7822=_0x57214a;_0x30762f['model']=_['keys'](db[_0x3605('0x4b')][_0x3605('0x29')]);_0x30762f[_0x3605('0x2d')]=_[_0x3605('0x2e')](_0x1d0bd7[_0x3605('0x2d')]);_0x30762f[_0x3605('0x38')]=_[_0x3605('0x2f')](_0x30762f[_0x3605('0x2c')],_0x30762f['query']);_0x8ac98a[_0x3605('0x30')]=_[_0x3605('0x2f')](_0x30762f['model'],qs[_0x3605('0x31')](_0x1d0bd7[_0x3605('0x2d')][_0x3605('0x31')]));_0x8ac98a['attributes']=_0x8ac98a[_0x3605('0x30')]['length']?_0x8ac98a['attributes']:_0x30762f[_0x3605('0x2c')];_0x8ac98a[_0x3605('0x35')]=qs[_0x3605('0x36')](_0x1d0bd7[_0x3605('0x2d')]['sort']);_0x8ac98a['where']=qs[_0x3605('0x38')](_['pick'](_0x1d0bd7['query'],_0x30762f[_0x3605('0x38')]));if(_0x1d0bd7[_0x3605('0x2d')][_0x3605('0x3a')]){_0x8ac98a[_0x3605('0x37')]=_[_0x3605('0x3c')](_0x8ac98a[_0x3605('0x37')],{'$or':_['map'](_0x8ac98a[_0x3605('0x30')],function(_0xc18d0d){var _0x47107d={};_0x47107d[_0xc18d0d]={'$like':'%'+_0x1d0bd7[_0x3605('0x2d')]['filter']+'%'};return _0x47107d;})});}_0x8ac98a=_['merge']({},_0x8ac98a,_0x1d0bd7[_0x3605('0x3d')]);return _0x5b7822['getSubjects'](_0x8ac98a);}})[_0x3605('0x24')](function(_0x45ba8c){if(_0x45ba8c){_0x54cf56=_0x45ba8c[_0x3605('0x32')];if(!_0x1d0bd7['query'][_0x3605('0x33')]('nolimit')){_0x8ac98a[_0x3605('0x1c')]=qs['limit'](_0x1d0bd7[_0x3605('0x2d')][_0x3605('0x1c')]);_0x8ac98a[_0x3605('0x1d')]=qs['offset'](_0x1d0bd7['query'][_0x3605('0x1d')]);}return _0x5b7822['getSubjects'](_0x8ac98a);}})[_0x3605('0x24')](function(_0x3cb5ca){if(_0x3cb5ca){return _0x3cb5ca?{'count':_0x54cf56,'rows':_0x3cb5ca}:null;}})[_0x3605('0x24')](respondWithResult(_0x31aa7c,null))[_0x3605('0x47')](handleError(_0x31aa7c,null));};exports[_0x3605('0x4d')]=function(_0x3c766c,_0x2c77f5,_0x5e53af){var _0xe15b0={};var _0x8800b7={};var _0xda8d74;var _0x2788de;return db['FreshdeskConfiguration'][_0x3605('0x4a')]({'where':{'id':_0x3c766c[_0x3605('0x42')]['id']}})[_0x3605('0x24')](handleEntityNotFound(_0x2c77f5,null))['then'](function(_0x54e7e0){if(_0x54e7e0){_0xda8d74=_0x54e7e0;_0x8800b7[_0x3605('0x2c')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x8800b7[_0x3605('0x2d')]=_[_0x3605('0x2e')](_0x3c766c[_0x3605('0x2d')]);_0x8800b7[_0x3605('0x38')]=_['intersection'](_0x8800b7['model'],_0x8800b7[_0x3605('0x2d')]);_0xe15b0[_0x3605('0x30')]=_[_0x3605('0x2f')](_0x8800b7[_0x3605('0x2c')],qs[_0x3605('0x31')](_0x3c766c[_0x3605('0x2d')][_0x3605('0x31')]));_0xe15b0[_0x3605('0x30')]=_0xe15b0[_0x3605('0x30')][_0x3605('0x32')]?_0xe15b0[_0x3605('0x30')]:_0x8800b7[_0x3605('0x2c')];_0xe15b0[_0x3605('0x35')]=qs[_0x3605('0x36')](_0x3c766c[_0x3605('0x2d')][_0x3605('0x36')]);_0xe15b0[_0x3605('0x37')]=qs[_0x3605('0x38')](_[_0x3605('0x39')](_0x3c766c[_0x3605('0x2d')],_0x8800b7[_0x3605('0x38')]));if(_0x3c766c[_0x3605('0x2d')]['filter']){_0xe15b0['where']=_[_0x3605('0x3c')](_0xe15b0[_0x3605('0x37')],{'$or':_[_0x3605('0x3b')](_0xe15b0[_0x3605('0x30')],function(_0x5d28ec){var _0x177a08={};_0x177a08[_0x5d28ec]={'$like':'%'+_0x3c766c[_0x3605('0x2d')]['filter']+'%'};return _0x177a08;})});}_0xe15b0=_[_0x3605('0x3c')]({},_0xe15b0,_0x3c766c['options']);return _0xda8d74[_0x3605('0x4d')](_0xe15b0);}})[_0x3605('0x24')](function(_0x2321f8){if(_0x2321f8){_0x2788de=_0x2321f8[_0x3605('0x32')];if(!_0x3c766c[_0x3605('0x2d')][_0x3605('0x33')]('nolimit')){_0xe15b0[_0x3605('0x1c')]=qs['limit'](_0x3c766c['query'][_0x3605('0x1c')]);_0xe15b0[_0x3605('0x1d')]=qs[_0x3605('0x1d')](_0x3c766c[_0x3605('0x2d')][_0x3605('0x1d')]);}return _0xda8d74[_0x3605('0x4d')](_0xe15b0);}})[_0x3605('0x24')](function(_0x5ef32f){if(_0x5ef32f){return _0x5ef32f?{'count':_0x2788de,'rows':_0x5ef32f}:null;}})[_0x3605('0x24')](respondWithResult(_0x2c77f5,null))[_0x3605('0x47')](handleError(_0x2c77f5,null));};exports[_0x3605('0x4e')]=function(_0x9e002f,_0x29419e,_0x2e6cce){var _0x165e73={};var _0x12517d={};var _0x5732cf;var _0x2839bc;return db[_0x3605('0x28')][_0x3605('0x4a')]({'where':{'id':_0x9e002f[_0x3605('0x42')]['id']}})['then'](handleEntityNotFound(_0x29419e,null))[_0x3605('0x24')](function(_0x29f727){if(_0x29f727){_0x5732cf=_0x29f727;_0x12517d[_0x3605('0x2c')]=_['keys'](db[_0x3605('0x4f')][_0x3605('0x29')]);_0x12517d[_0x3605('0x2d')]=_['keys'](_0x9e002f[_0x3605('0x2d')]);_0x12517d[_0x3605('0x38')]=_['intersection'](_0x12517d[_0x3605('0x2c')],_0x12517d[_0x3605('0x2d')]);_0x165e73['attributes']=_[_0x3605('0x2f')](_0x12517d[_0x3605('0x2c')],qs['fields'](_0x9e002f[_0x3605('0x2d')][_0x3605('0x31')]));_0x165e73[_0x3605('0x30')]=_0x165e73[_0x3605('0x30')]['length']?_0x165e73[_0x3605('0x30')]:_0x12517d['model'];_0x165e73['order']=qs['sort'](_0x9e002f[_0x3605('0x2d')][_0x3605('0x36')]);_0x165e73[_0x3605('0x37')]=qs[_0x3605('0x38')](_[_0x3605('0x39')](_0x9e002f[_0x3605('0x2d')],_0x12517d['filters']));if(_0x9e002f[_0x3605('0x2d')][_0x3605('0x3a')]){_0x165e73['where']=_[_0x3605('0x3c')](_0x165e73[_0x3605('0x37')],{'$or':_['map'](_0x165e73[_0x3605('0x30')],function(_0x23e9b3){var _0x1726bd={};_0x1726bd[_0x23e9b3]={'$like':'%'+_0x9e002f['query'][_0x3605('0x3a')]+'%'};return _0x1726bd;})});}_0x165e73=_[_0x3605('0x3c')]({},_0x165e73,_0x9e002f[_0x3605('0x3d')]);return _0x5732cf[_0x3605('0x4e')](_0x165e73);}})[_0x3605('0x24')](function(_0x25360e){if(_0x25360e){_0x2839bc=_0x25360e[_0x3605('0x32')];if(!_0x9e002f[_0x3605('0x2d')][_0x3605('0x33')](_0x3605('0x34'))){_0x165e73[_0x3605('0x1c')]=qs[_0x3605('0x1c')](_0x9e002f[_0x3605('0x2d')][_0x3605('0x1c')]);_0x165e73['offset']=qs[_0x3605('0x1d')](_0x9e002f['query'][_0x3605('0x1d')]);}return _0x5732cf[_0x3605('0x4e')](_0x165e73);}})[_0x3605('0x24')](function(_0x3c054f){if(_0x3c054f){return _0x3c054f?{'count':_0x2839bc,'rows':_0x3c054f}:null;}})['then'](respondWithResult(_0x29419e,null))[_0x3605('0x47')](handleError(_0x29419e,null));};exports[_0x3605('0x50')]=function(_0x982b07,_0x1d7761,_0x443cb2){if(_0x982b07[_0x3605('0x46')]['id']){delete _0x982b07[_0x3605('0x46')]['id'];}return db[_0x3605('0x28')][_0x3605('0x4a')]({'where':{'id':_0x982b07[_0x3605('0x42')]['id']}})[_0x3605('0x24')](handleEntityNotFound(_0x1d7761,null))[_0x3605('0x24')](function(_0x3e33c0){if(_0x3e33c0){return _0x3e33c0['setTags'](_0x982b07[_0x3605('0x46')][_0x3605('0x51')]||[]);}return null;})[_0x3605('0x24')](respondWithResult(_0x1d7761,null))['catch'](handleError(_0x1d7761,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9b4d7f8..88efd75 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 _0xd524=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xd524,0x1f3));var _0x4d52=function(_0x27ed99,_0x49d05b){_0x27ed99=_0x27ed99-0x0;var _0x3d0b9a=_0xd524[_0x27ed99];return _0x3d0b9a;};'use strict';var _=require(_0x4d52('0x0'));var util=require('util');var logger=require(_0x4d52('0x1'))(_0x4d52('0x2'));var moment=require(_0x4d52('0x3'));var BPromise=require(_0x4d52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d52('0x5'));var rimraf=require(_0x4d52('0x6'));var config=require(_0x4d52('0x7'));var attributes=require(_0x4d52('0x8'));module[_0x4d52('0x9')]=function(_0x1502c2,_0x2444fc){return _0x1502c2[_0x4d52('0xa')](_0x4d52('0xb'),attributes,{'tableName':_0x4d52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb619=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xb619,0x178));var _0x9b61=function(_0x297f98,_0x230631){_0x297f98=_0x297f98-0x0;var _0x445dca=_0xb619[_0x297f98];return _0x445dca;};'use strict';var _=require('lodash');var util=require(_0x9b61('0x0'));var logger=require(_0x9b61('0x1'))(_0x9b61('0x2'));var moment=require(_0x9b61('0x3'));var BPromise=require(_0x9b61('0x4'));var rp=require(_0x9b61('0x5'));var fs=require('fs');var path=require(_0x9b61('0x6'));var rimraf=require('rimraf');var config=require(_0x9b61('0x7'));var attributes=require(_0x9b61('0x8'));module['exports']=function(_0x5e751b,_0x26cdc4){return _0x5e751b[_0x9b61('0x9')](_0x9b61('0xa'),attributes,{'tableName':_0x9b61('0xb'),'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 56f5b95..1507494 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 _0x2d70=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x56599b,_0x85de17){var _0x31bb05=function(_0x33d5f2){while(--_0x33d5f2){_0x56599b['push'](_0x56599b['shift']());}};_0x31bb05(++_0x85de17);}(_0x2d70,0x1e6));var _0x02d7=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2d70[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x02d7('0x0'));var util=require(_0x02d7('0x1'));var moment=require(_0x02d7('0x2'));var BPromise=require(_0x02d7('0x3'));var rs=require(_0x02d7('0x4'));var fs=require('fs');var Redis=require(_0x02d7('0x5'));var db=require(_0x02d7('0x6'))['db'];var utils=require(_0x02d7('0x7'));var logger=require('../../config/logger')(_0x02d7('0x8'));var config=require(_0x02d7('0x9'));var jayson=require(_0x02d7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26b302,_0x51013a,_0x2cd305){return new BPromise(function(_0xa6cbac,_0xde9a1c){return client[_0x02d7('0xb')](_0x26b302,_0x2cd305)[_0x02d7('0xc')](function(_0x4e2c33){logger['info'](_0x02d7('0xd'),_0x51013a,_0x02d7('0xe'));logger[_0x02d7('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x51013a,_0x02d7('0xe'),JSON[_0x02d7('0x10')](_0x4e2c33));if(_0x4e2c33['error']){if(_0x4e2c33['error'][_0x02d7('0x11')]===0x1f4){logger[_0x02d7('0x12')](_0x02d7('0xd'),_0x51013a,_0x4e2c33[_0x02d7('0x12')][_0x02d7('0x13')]);return _0xde9a1c(_0x4e2c33['error'][_0x02d7('0x13')]);}logger[_0x02d7('0x12')](_0x02d7('0xd'),_0x51013a,_0x4e2c33[_0x02d7('0x12')][_0x02d7('0x13')]);return _0xa6cbac(_0x4e2c33[_0x02d7('0x12')][_0x02d7('0x13')]);}else{logger[_0x02d7('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x51013a,_0x02d7('0xe'));_0xa6cbac(_0x4e2c33[_0x02d7('0x15')][_0x02d7('0x13')]);}})[_0x02d7('0x16')](function(_0x451fb7){logger[_0x02d7('0x12')](_0x02d7('0xd'),_0x51013a,_0x451fb7);_0xde9a1c(_0x451fb7);});});} \ No newline at end of file +var _0x6c41=['request\x20sent','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c41,0x1cf));var _0x16c4=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x6c41[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x16c4('0x0'));var util=require('util');var moment=require(_0x16c4('0x1'));var BPromise=require(_0x16c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16c4('0x3'));var db=require(_0x16c4('0x4'))['db'];var utils=require(_0x16c4('0x5'));var logger=require(_0x16c4('0x6'))(_0x16c4('0x7'));var config=require(_0x16c4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x16c4('0x9')][_0x16c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9dba,_0x93f573,_0x1ea80c){return new BPromise(function(_0x39cefe,_0x506812){return client[_0x16c4('0xb')](_0x4b9dba,_0x1ea80c)[_0x16c4('0xc')](function(_0x539e03){logger[_0x16c4('0xd')](_0x16c4('0xe'),_0x93f573,'request\x20sent');logger[_0x16c4('0xf')](_0x16c4('0x10'),_0x93f573,'request\x20sent',JSON[_0x16c4('0x11')](_0x539e03));if(_0x539e03[_0x16c4('0x12')]){if(_0x539e03[_0x16c4('0x12')][_0x16c4('0x13')]===0x1f4){logger['error'](_0x16c4('0xe'),_0x93f573,_0x539e03[_0x16c4('0x12')][_0x16c4('0x14')]);return _0x506812(_0x539e03['error'][_0x16c4('0x14')]);}logger[_0x16c4('0x12')](_0x16c4('0xe'),_0x93f573,_0x539e03['error'][_0x16c4('0x14')]);return _0x39cefe(_0x539e03[_0x16c4('0x12')][_0x16c4('0x14')]);}else{logger[_0x16c4('0xd')](_0x16c4('0xe'),_0x93f573,_0x16c4('0x15'));_0x39cefe(_0x539e03['result'][_0x16c4('0x14')]);}})['catch'](function(_0x5e3199){logger[_0x16c4('0x12')](_0x16c4('0xe'),_0x93f573,_0x5e3199);_0x506812(_0x5e3199);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ab61574..a94c0ee 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 _0x658f=['put','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x35d823,_0x212793){var _0x518ac5=function(_0x448b7b){while(--_0x448b7b){_0x35d823['push'](_0x35d823['shift']());}};_0x518ac5(++_0x212793);}(_0x658f,0x154));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf658('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf658('0x1'));var router=express['Router']();var fs_extra=require(_0xf658('0x2'));var auth=require(_0xf658('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf658('0x4'));var controller=require(_0xf658('0x5'));router[_0xf658('0x6')]('/',auth[_0xf658('0x7')](),controller[_0xf658('0x8')]);router[_0xf658('0x6')](_0xf658('0x9'),auth[_0xf658('0x7')](),controller['show']);router[_0xf658('0xa')]('/',auth[_0xf658('0x7')](),controller[_0xf658('0xb')]);router[_0xf658('0xc')](_0xf658('0x9'),auth[_0xf658('0x7')](),controller['update']);router[_0xf658('0xd')](_0xf658('0x9'),auth[_0xf658('0x7')](),controller[_0xf658('0xe')]);module[_0xf658('0xf')]=router; \ No newline at end of file +var _0x8b9c=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','express'];(function(_0x1b95a1,_0x529852){var _0x57aef1=function(_0x1cb2fd){while(--_0x1cb2fd){_0x1b95a1['push'](_0x1b95a1['shift']());}};_0x57aef1(++_0x529852);}(_0x8b9c,0x176));var _0xc8b9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8b9c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc8b9('0x0'));var util=require(_0xc8b9('0x1'));var path=require(_0xc8b9('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8b9('0x3'));var router=express['Router']();var fs_extra=require(_0xc8b9('0x4'));var auth=require(_0xc8b9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b9('0x6'));var controller=require(_0xc8b9('0x7'));router[_0xc8b9('0x8')]('/',auth['isAuthenticated'](),controller[_0xc8b9('0x9')]);router[_0xc8b9('0x8')](_0xc8b9('0xa'),auth['isAuthenticated'](),controller[_0xc8b9('0xb')]);router['post']('/',auth[_0xc8b9('0xc')](),controller[_0xc8b9('0xd')]);router[_0xc8b9('0xe')](_0xc8b9('0xa'),auth[_0xc8b9('0xc')](),controller['update']);router[_0xc8b9('0xf')]('/:id',auth[_0xc8b9('0xc')](),controller[_0xc8b9('0x10')]);module[_0xc8b9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1f8fe07..69dc3d7 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 _0x9136=['keyValue','picklist','STRING','ENUM','exports','string','variable','customVariable'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x9136,0x64));var _0x6913=function(_0x35e511,_0x2e5a07){_0x35e511=_0x35e511-0x0;var _0x42c415=_0x9136[_0x35e511];return _0x42c415;};'use strict';var Sequelize=require('sequelize');module[_0x6913('0x0')]={'type':{'type':Sequelize['ENUM'](_0x6913('0x1'),_0x6913('0x2'),_0x6913('0x3'),_0x6913('0x4'),_0x6913('0x5')),'defaultValue':_0x6913('0x1')},'content':{'type':Sequelize[_0x6913('0x6')]},'key':{'type':Sequelize[_0x6913('0x6')]},'keyType':{'type':Sequelize[_0x6913('0x7')](_0x6913('0x1'),'variable',_0x6913('0x3'))},'keyContent':{'type':Sequelize[_0x6913('0x6')]},'idField':{'type':Sequelize[_0x6913('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6913('0x6')]}}; \ No newline at end of file +var _0x056f=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x373845,_0xde4302){var _0x3fa94e=function(_0x12f5c2){while(--_0x12f5c2){_0x373845['push'](_0x373845['shift']());}};_0x3fa94e(++_0xde4302);}(_0x056f,0x125));var _0xf056=function(_0x30c28b,_0x2f5e7c){_0x30c28b=_0x30c28b-0x0;var _0x1fe877=_0x056f[_0x30c28b];return _0x1fe877;};'use strict';var Sequelize=require(_0xf056('0x0'));module[_0xf056('0x1')]={'type':{'type':Sequelize[_0xf056('0x2')]('string',_0xf056('0x3'),'customVariable',_0xf056('0x4'),_0xf056('0x5')),'defaultValue':_0xf056('0x6')},'content':{'type':Sequelize[_0xf056('0x7')]},'key':{'type':Sequelize[_0xf056('0x7')]},'keyType':{'type':Sequelize[_0xf056('0x2')](_0xf056('0x6'),'variable',_0xf056('0x8'))},'keyContent':{'type':Sequelize[_0xf056('0x7')]},'idField':{'type':Sequelize[_0xf056('0x7')]},'nameField':{'type':Sequelize[_0xf056('0x7')]},'customField':{'type':Sequelize[_0xf056('0x9')],'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 9266026..8697701 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 _0xaa88=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','stack','name','send','map','FreshdeskField','fieldName','key'];(function(_0x10b65a,_0x4fee4f){var _0x8ed504=function(_0x35e7ed){while(--_0x35e7ed){_0x10b65a['push'](_0x10b65a['shift']());}};_0x8ed504(++_0x4fee4f);}(_0xaa88,0x137));var _0x8aa8=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xaa88[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['index']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={},_0x385208={},_0x14be8b={'count':0x0,'rows':[]};var _0x39e892=_[_0x8aa8('0x28')](db[_0x8aa8('0x29')]['rawAttributes'],function(_0x267f4c){return{'name':_0x267f4c[_0x8aa8('0x2a')],'type':_0x267f4c['type'][_0x8aa8('0x2b')]};});_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x28')](_0x39e892,'name');_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x4c5c5c[_0x8aa8('0x2d')]);_0x385208[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],_0x385208[_0x8aa8('0x2d')]);_0x5e96c9[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],qs[_0x8aa8('0x32')](_0x4c5c5c['query']['fields']));_0x5e96c9[_0x8aa8('0x31')]=_0x5e96c9[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x5e96c9[_0x8aa8('0x31')]:_0x385208[_0x8aa8('0x2c')];if(!_0x4c5c5c[_0x8aa8('0x2d')]['hasOwnProperty']('nolimit')){_0x5e96c9[_0x8aa8('0x1f')]=qs['limit'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1f')]);_0x5e96c9[_0x8aa8('0x1d')]=qs['offset'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1d')]);}_0x5e96c9[_0x8aa8('0x34')]=qs['sort'](_0x4c5c5c['query'][_0x8aa8('0x35')]);_0x5e96c9[_0x8aa8('0x36')]=qs['filters'](_[_0x8aa8('0x37')](_0x4c5c5c[_0x8aa8('0x2d')],_0x385208['filters']),_0x39e892);if(_0x4c5c5c[_0x8aa8('0x2d')]['filter']){_0x5e96c9['where']=_[_0x8aa8('0x38')](_0x5e96c9['where'],{'$or':_[_0x8aa8('0x28')](_0x39e892,function(_0x944927){if(_0x944927[_0x8aa8('0x39')]!==_0x8aa8('0x3a')){var _0x4ce5e9={};_0x4ce5e9[_0x944927[_0x8aa8('0x26')]]={'$like':'%'+_0x4c5c5c[_0x8aa8('0x2d')]['filter']+'%'};return _0x4ce5e9;}})});}_0x5e96c9=_[_0x8aa8('0x38')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x3b')]);var _0x5ea57a={'where':_0x5e96c9[_0x8aa8('0x36')]};return db[_0x8aa8('0x29')][_0x8aa8('0x20')](_0x5ea57a)[_0x8aa8('0x24')](function(_0x189d53){_0x14be8b[_0x8aa8('0x20')]=_0x189d53;if(_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x3c')]){_0x5e96c9[_0x8aa8('0x3d')]=[{'all':!![]}];}return db[_0x8aa8('0x29')][_0x8aa8('0x3e')](_0x5e96c9);})[_0x8aa8('0x24')](function(_0x17c730){_0x14be8b[_0x8aa8('0x3f')]=_0x17c730;return _0x14be8b;})[_0x8aa8('0x24')](respondWithFilteredResult(_0x10810d,_0x5e96c9))[_0x8aa8('0x40')](handleError(_0x10810d,null));};exports['show']=function(_0x1aade0,_0x5cdba4){var _0x4833c0={'raw':!![],'where':{'id':_0x1aade0[_0x8aa8('0x41')]['id']}},_0x572132={};_0x572132['model']=_['keys'](db[_0x8aa8('0x29')]['rawAttributes']);_0x572132[_0x8aa8('0x2d')]=_['keys'](_0x1aade0['query']);_0x572132[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],_0x572132[_0x8aa8('0x2d')]);_0x4833c0[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],qs['fields'](_0x1aade0[_0x8aa8('0x2d')]['fields']));_0x4833c0[_0x8aa8('0x31')]=_0x4833c0[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x4833c0[_0x8aa8('0x31')]:_0x572132[_0x8aa8('0x2c')];if(_0x1aade0[_0x8aa8('0x2d')]['includeAll']){_0x4833c0['include']=[{'all':!![]}];}_0x4833c0=_[_0x8aa8('0x38')]({},_0x4833c0,_0x1aade0[_0x8aa8('0x3b')]);return db['FreshdeskField'][_0x8aa8('0x42')](_0x4833c0)[_0x8aa8('0x24')](handleEntityNotFound(_0x5cdba4,null))[_0x8aa8('0x24')](respondWithResult(_0x5cdba4,null))['catch'](handleError(_0x5cdba4,null));};exports['create']=function(_0x52c130,_0x4e05e7){return db[_0x8aa8('0x29')][_0x8aa8('0x43')](_0x52c130['body'],{})[_0x8aa8('0x24')](respondWithResult(_0x4e05e7,0xc9))[_0x8aa8('0x40')](handleError(_0x4e05e7,null));};exports[_0x8aa8('0x44')]=function(_0x1aa1b6,_0x20384a){if(_0x1aa1b6[_0x8aa8('0x45')]['id']){delete _0x1aa1b6['body']['id'];}return db['FreshdeskField'][_0x8aa8('0x42')]({'where':{'id':_0x1aa1b6['params']['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x20384a,null))['then'](saveUpdates(_0x1aa1b6[_0x8aa8('0x45')],null))[_0x8aa8('0x24')](respondWithResult(_0x20384a,null))[_0x8aa8('0x40')](handleError(_0x20384a,null));};exports[_0x8aa8('0x46')]=function(_0x36de37,_0x22b35d){return db[_0x8aa8('0x29')][_0x8aa8('0x42')]({'where':{'id':_0x36de37[_0x8aa8('0x41')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x22b35d,null))[_0x8aa8('0x24')](removeEntity(_0x22b35d,null))[_0x8aa8('0x40')](handleError(_0x22b35d,null));}; \ No newline at end of file +var _0xa75b=['filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','offset','limit','undefined','count','set','reject','then','destroy','end','sendStatus','error','index','map','FreshdeskField','rawAttributes','type','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa75b,0x170));var _0xba75=function(_0x55399e,_0x59673c){_0x55399e=_0x55399e-0x0;var _0x2cc973=_0xa75b[_0x55399e];return _0x2cc973;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x23')]();});}};}function handleEntityNotFound(_0xe579fb,_0x5ec733){return function(_0x1caa6){if(!_0x1caa6){_0xe579fb[_0xba75('0x24')](0x194);}return _0x1caa6;};}function handleError(_0x26dd53,_0x37f7c8){_0x37f7c8=_0x37f7c8||0x1f4;return function(_0x35c571){logger[_0xba75('0x25')](_0x35c571['stack']);if(_0x35c571['name']){delete _0x35c571['name'];}_0x26dd53[_0xba75('0x1a')](_0x37f7c8)['send'](_0x35c571);};}exports[_0xba75('0x26')]=function(_0x58ea2d,_0x15b5bc){var _0x1afc1f={},_0x20ac78={},_0x4edc2e={'count':0x0,'rows':[]};var _0x3a1fd3=_[_0xba75('0x27')](db[_0xba75('0x28')][_0xba75('0x29')],function(_0x5d9f78){return{'name':_0x5d9f78['fieldName'],'type':_0x5d9f78[_0xba75('0x2a')]['key']};});_0x20ac78[_0xba75('0x2b')]=_[_0xba75('0x27')](_0x3a1fd3,_0xba75('0x2c'));_0x20ac78[_0xba75('0x2d')]=_['keys'](_0x58ea2d[_0xba75('0x2d')]);_0x20ac78[_0xba75('0x2e')]=_['intersection'](_0x20ac78[_0xba75('0x2b')],_0x20ac78[_0xba75('0x2d')]);_0x1afc1f[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x20ac78['model'],qs[_0xba75('0x31')](_0x58ea2d[_0xba75('0x2d')]['fields']));_0x1afc1f[_0xba75('0x2f')]=_0x1afc1f[_0xba75('0x2f')][_0xba75('0x32')]?_0x1afc1f['attributes']:_0x20ac78[_0xba75('0x2b')];if(!_0x58ea2d[_0xba75('0x2d')][_0xba75('0x33')](_0xba75('0x34'))){_0x1afc1f[_0xba75('0x1c')]=qs[_0xba75('0x1c')](_0x58ea2d[_0xba75('0x2d')]['limit']);_0x1afc1f['offset']=qs[_0xba75('0x1b')](_0x58ea2d[_0xba75('0x2d')][_0xba75('0x1b')]);}_0x1afc1f['order']=qs[_0xba75('0x35')](_0x58ea2d[_0xba75('0x2d')]['sort']);_0x1afc1f['where']=qs[_0xba75('0x2e')](_[_0xba75('0x36')](_0x58ea2d[_0xba75('0x2d')],_0x20ac78[_0xba75('0x2e')]),_0x3a1fd3);if(_0x58ea2d[_0xba75('0x2d')]['filter']){_0x1afc1f['where']=_[_0xba75('0x37')](_0x1afc1f[_0xba75('0x38')],{'$or':_[_0xba75('0x27')](_0x3a1fd3,function(_0x68526f){if(_0x68526f[_0xba75('0x2a')]!==_0xba75('0x39')){var _0x987cc1={};_0x987cc1[_0x68526f['name']]={'$like':'%'+_0x58ea2d[_0xba75('0x2d')][_0xba75('0x3a')]+'%'};return _0x987cc1;}})});}_0x1afc1f=_['merge']({},_0x1afc1f,_0x58ea2d[_0xba75('0x3b')]);var _0x3740bd={'where':_0x1afc1f[_0xba75('0x38')]};return db[_0xba75('0x28')][_0xba75('0x1e')](_0x3740bd)[_0xba75('0x21')](function(_0x20e857){_0x4edc2e['count']=_0x20e857;if(_0x58ea2d[_0xba75('0x2d')]['includeAll']){_0x1afc1f[_0xba75('0x3c')]=[{'all':!![]}];}return db['FreshdeskField'][_0xba75('0x3d')](_0x1afc1f);})[_0xba75('0x21')](function(_0x9c32ad){_0x4edc2e[_0xba75('0x3e')]=_0x9c32ad;return _0x4edc2e;})[_0xba75('0x21')](respondWithFilteredResult(_0x15b5bc,_0x1afc1f))[_0xba75('0x3f')](handleError(_0x15b5bc,null));};exports[_0xba75('0x40')]=function(_0x3f2a91,_0xfd400f){var _0x5c7c7f={'raw':!![],'where':{'id':_0x3f2a91[_0xba75('0x41')]['id']}},_0x30b5f0={};_0x30b5f0['model']=_[_0xba75('0x42')](db[_0xba75('0x28')][_0xba75('0x29')]);_0x30b5f0['query']=_['keys'](_0x3f2a91['query']);_0x30b5f0['filters']=_[_0xba75('0x30')](_0x30b5f0['model'],_0x30b5f0[_0xba75('0x2d')]);_0x5c7c7f[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x30b5f0[_0xba75('0x2b')],qs[_0xba75('0x31')](_0x3f2a91['query']['fields']));_0x5c7c7f[_0xba75('0x2f')]=_0x5c7c7f['attributes'][_0xba75('0x32')]?_0x5c7c7f['attributes']:_0x30b5f0[_0xba75('0x2b')];if(_0x3f2a91[_0xba75('0x2d')][_0xba75('0x43')]){_0x5c7c7f[_0xba75('0x3c')]=[{'all':!![]}];}_0x5c7c7f=_['merge']({},_0x5c7c7f,_0x3f2a91[_0xba75('0x3b')]);return db[_0xba75('0x28')][_0xba75('0x44')](_0x5c7c7f)[_0xba75('0x21')](handleEntityNotFound(_0xfd400f,null))[_0xba75('0x21')](respondWithResult(_0xfd400f,null))[_0xba75('0x3f')](handleError(_0xfd400f,null));};exports[_0xba75('0x45')]=function(_0x2cd995,_0x51cd22){return db[_0xba75('0x28')][_0xba75('0x45')](_0x2cd995[_0xba75('0x46')],{})[_0xba75('0x21')](respondWithResult(_0x51cd22,0xc9))[_0xba75('0x3f')](handleError(_0x51cd22,null));};exports['update']=function(_0x2a1f84,_0x25ae33){if(_0x2a1f84[_0xba75('0x46')]['id']){delete _0x2a1f84[_0xba75('0x46')]['id'];}return db[_0xba75('0x28')][_0xba75('0x44')]({'where':{'id':_0x2a1f84[_0xba75('0x41')]['id']}})['then'](handleEntityNotFound(_0x25ae33,null))[_0xba75('0x21')](saveUpdates(_0x2a1f84[_0xba75('0x46')],null))[_0xba75('0x21')](respondWithResult(_0x25ae33,null))['catch'](handleError(_0x25ae33,null));};exports[_0xba75('0x22')]=function(_0x29b4fc,_0x559f6f){return db['FreshdeskField'][_0xba75('0x44')]({'where':{'id':_0x29b4fc['params']['id']}})['then'](handleEntityNotFound(_0x559f6f,null))[_0xba75('0x21')](removeEntity(_0x559f6f,null))['catch'](handleError(_0x559f6f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 70c12d1..45df482 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 _0x83ed=['FieldId','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x1035eb,_0x4023d7){var _0x35a2db=function(_0x3af4cf){while(--_0x3af4cf){_0x1035eb['push'](_0x1035eb['shift']());}};_0x35a2db(++_0x4023d7);}(_0x83ed,0x85));var _0xd83e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x83ed[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd83e('0x0'));var BPromise=require('bluebird');var rp=require(_0xd83e('0x1'));var fs=require('fs');var path=require(_0xd83e('0x2'));var rimraf=require('rimraf');var config=require(_0xd83e('0x3'));var attributes=require(_0xd83e('0x4'));module[_0xd83e('0x5')]=function(_0x5395ab,_0x61e09d){return _0x5395ab['define'](_0xd83e('0x6'),attributes,{'tableName':_0xd83e('0x7'),'paranoid':![],'indexes':[{'name':_0xd83e('0x8'),'fields':[_0xd83e('0x9'),_0xd83e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf71=['define','FreshdeskField','freshdesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports'];(function(_0x30099b,_0x23dd4f){var _0x4f805b=function(_0x89cb4f){while(--_0x89cb4f){_0x30099b['push'](_0x30099b['shift']());}};_0x4f805b(++_0x23dd4f);}(_0xdf71,0x1d2));var _0x1df7=function(_0x9af652,_0x4de743){_0x9af652=_0x9af652-0x0;var _0x2eb16e=_0xdf71[_0x9af652];return _0x2eb16e;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var logger=require(_0x1df7('0x1'))(_0x1df7('0x2'));var moment=require(_0x1df7('0x3'));var BPromise=require(_0x1df7('0x4'));var rp=require(_0x1df7('0x5'));var fs=require('fs');var path=require(_0x1df7('0x6'));var rimraf=require(_0x1df7('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df7('0x8'));module[_0x1df7('0x9')]=function(_0x4bc4a8,_0x508a68){return _0x4bc4a8[_0x1df7('0xa')](_0x1df7('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x1df7('0xc'),'fields':['idField',_0x1df7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 7300393..a7f8bd1 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 _0x134b=['../../config/logger','../../config/environment','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x134b,0x173));var _0xb134=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x134b[_0x4eafed];return _0x159c85;};'use strict';var _=require('lodash');var util=require(_0xb134('0x0'));var moment=require(_0xb134('0x1'));var BPromise=require(_0xb134('0x2'));var rs=require(_0xb134('0x3'));var fs=require('fs');var Redis=require(_0xb134('0x4'));var db=require(_0xb134('0x5'))['db'];var utils=require(_0xb134('0x6'));var logger=require(_0xb134('0x7'))('rpc');var config=require(_0xb134('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb134('0x9')][_0xb134('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ecb97,_0x21d197,_0x4d8638){return new BPromise(function(_0x15ca74,_0x47b820){return client['request'](_0x2ecb97,_0x4d8638)[_0xb134('0xb')](function(_0xabb8e3){logger[_0xb134('0xc')](_0xb134('0xd'),_0x21d197,_0xb134('0xe'));logger[_0xb134('0xf')](_0xb134('0x10'),_0x21d197,_0xb134('0xe'),JSON[_0xb134('0x11')](_0xabb8e3));if(_0xabb8e3[_0xb134('0x12')]){if(_0xabb8e3[_0xb134('0x12')][_0xb134('0x13')]===0x1f4){logger[_0xb134('0x12')](_0xb134('0xd'),_0x21d197,_0xabb8e3[_0xb134('0x12')][_0xb134('0x14')]);return _0x47b820(_0xabb8e3[_0xb134('0x12')][_0xb134('0x14')]);}logger['error'](_0xb134('0xd'),_0x21d197,_0xabb8e3[_0xb134('0x12')][_0xb134('0x14')]);return _0x15ca74(_0xabb8e3['error'][_0xb134('0x14')]);}else{logger['info'](_0xb134('0xd'),_0x21d197,_0xb134('0xe'));_0x15ca74(_0xabb8e3['result'][_0xb134('0x14')]);}})['catch'](function(_0x3b1eb3){logger[_0xb134('0x12')](_0xb134('0xd'),_0x21d197,_0x3b1eb3);_0x47b820(_0x3b1eb3);});});} \ No newline at end of file +var _0xc754=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4771a0,_0x45be9d){var _0x440d29=function(_0x56a3c0){while(--_0x56a3c0){_0x4771a0['push'](_0x4771a0['shift']());}};_0x440d29(++_0x45be9d);}(_0xc754,0x193));var _0x4c75=function(_0x2edcad,_0x400f53){_0x2edcad=_0x2edcad-0x0;var _0x34653a=_0xc754[_0x2edcad];return _0x34653a;};'use strict';var _=require('lodash');var util=require(_0x4c75('0x0'));var moment=require(_0x4c75('0x1'));var BPromise=require(_0x4c75('0x2'));var rs=require(_0x4c75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c75('0x4'))['db'];var utils=require(_0x4c75('0x5'));var logger=require(_0x4c75('0x6'))(_0x4c75('0x7'));var config=require(_0x4c75('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4c75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x541499,_0x473325,_0xda722d){return new BPromise(function(_0x3f69c4,_0xbfee70){return client[_0x4c75('0xa')](_0x541499,_0xda722d)[_0x4c75('0xb')](function(_0x332611){logger[_0x4c75('0xc')](_0x4c75('0xd'),_0x473325,_0x4c75('0xe'));logger[_0x4c75('0xf')](_0x4c75('0x10'),_0x473325,_0x4c75('0xe'),JSON[_0x4c75('0x11')](_0x332611));if(_0x332611[_0x4c75('0x12')]){if(_0x332611['error'][_0x4c75('0x13')]===0x1f4){logger[_0x4c75('0x12')](_0x4c75('0xd'),_0x473325,_0x332611['error']['message']);return _0xbfee70(_0x332611['error'][_0x4c75('0x14')]);}logger[_0x4c75('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x473325,_0x332611[_0x4c75('0x12')][_0x4c75('0x14')]);return _0x3f69c4(_0x332611[_0x4c75('0x12')]['message']);}else{logger[_0x4c75('0xc')](_0x4c75('0xd'),_0x473325,_0x4c75('0xe'));_0x3f69c4(_0x332611[_0x4c75('0x15')][_0x4c75('0x14')]);}})[_0x4c75('0x16')](function(_0x3c4a6c){logger[_0x4c75('0x12')](_0x4c75('0xd'),_0x473325,_0x3c4a6c);_0xbfee70(_0x3c4a6c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a641d2e..f8ca7c8 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 _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x14f41e,_0x429213){var _0x2b5367=function(_0x43dce6){while(--_0x43dce6){_0x14f41e['push'](_0x14f41e['shift']());}};_0x2b5367(++_0x429213);}(_0xa478,0x136));var _0x8a47=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xa478[_0x2a3c4d];return _0x55c390;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0x3c81=['connect-timeout','express','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','multer','util'];(function(_0x4bfc65,_0x14f4fa){var _0x22f95c=function(_0xaedf0f){while(--_0xaedf0f){_0x4bfc65['push'](_0x4bfc65['shift']());}};_0x22f95c(++_0x14f4fa);}(_0x3c81,0x102));var _0x13c8=function(_0x5ec008,_0x2dedeb){_0x5ec008=_0x5ec008-0x0;var _0x570345=_0x3c81[_0x5ec008];return _0x570345;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x11')]);router['put'](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router[_0x13c8('0x13')]('/:id',auth[_0x13c8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fd5af19..c3700cd 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xadb5,0xad));var _0x5adb=function(_0x56c38f,_0x4e8a6d){_0x56c38f=_0x56c38f-0x0;var _0x4e2094=_0xadb5[_0x56c38f];return _0x4e2094;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2a07=['sequelize','exports','STRING','remoteUri'];(function(_0x30b58,_0x48df3b){var _0x9d210d=function(_0x46fffd){while(--_0x46fffd){_0x30b58['push'](_0x30b58['shift']());}};_0x9d210d(++_0x48df3b);}(_0x2a07,0x74));var _0x72a0=function(_0x95b44e,_0x4af5e1){_0x95b44e=_0x95b44e-0x0;var _0x4d33ea=_0x2a07[_0x95b44e];return _0x4d33ea;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'name':{'type':Sequelize[_0x72a0('0x2')]},'description':{'type':Sequelize[_0x72a0('0x2')]},'username':{'type':Sequelize[_0x72a0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x72a0('0x2')]},'remoteUri':{'type':Sequelize[_0x72a0('0x2')],'unique':_0x72a0('0x3')},'serverUrl':{'type':Sequelize[_0x72a0('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 387de58..8dbf8c6 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 _0x13b5=['pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','findOne','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','length','find','create','body','params','getConfigurations','FreshsalesConfiguration','order'];(function(_0x40edfe,_0x219de5){var _0x1a7876=function(_0x1d3da2){while(--_0x1d3da2){_0x40edfe['push'](_0x40edfe['shift']());}};_0x1a7876(++_0x219de5);}(_0x13b5,0x83));var _0x513b=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x13b5[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x513b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x513b('0x1'));var jsonpatch=require(_0x513b('0x2'));var rp=require(_0x513b('0x3'));var moment=require(_0x513b('0x4'));var BPromise=require(_0x513b('0x5'));var Mustache=require(_0x513b('0x6'));var util=require(_0x513b('0x7'));var path=require(_0x513b('0x8'));var sox=require(_0x513b('0x9'));var csv=require('to-csv');var ejs=require(_0x513b('0xa'));var fs=require('fs');var fs_extra=require(_0x513b('0xb'));var _=require(_0x513b('0xc'));var squel=require(_0x513b('0xd'));var crypto=require(_0x513b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x513b('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x513b('0x10'));var authService=require(_0x513b('0x11'));var qs=require(_0x513b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x513b('0x13'));var logger=require(_0x513b('0x14'))('api');var utils=require(_0x513b('0x15'));var config=require(_0x513b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x513b('0x17'))['db'];var integrations=require(_0x513b('0x18'));function respondWithStatusCode(_0x5da6c5,_0x2fd4d2){_0x2fd4d2=_0x2fd4d2||0xcc;return function(_0x1e3a8d){if(_0x1e3a8d){return _0x5da6c5['sendStatus'](_0x2fd4d2);}return _0x5da6c5[_0x513b('0x19')](_0x2fd4d2)[_0x513b('0x1a')]();};}function respondWithResult(_0x10ca7c,_0x24d665){_0x24d665=_0x24d665||0xc8;return function(_0x1c7f1b){if(_0x1c7f1b){return _0x10ca7c[_0x513b('0x19')](_0x24d665)[_0x513b('0x1b')](_0x1c7f1b);}};}function respondWithFilteredResult(_0xc20b8d,_0x3dd578){return function(_0x462d80){if(_0x462d80){var _0x53bb9c=typeof _0x3dd578['offset']===_0x513b('0x1c')&&typeof _0x3dd578[_0x513b('0x1d')]==='undefined';var _0x3a642c=_0x462d80[_0x513b('0x1e')];var _0x2866a9=_0x53bb9c?0x0:_0x3dd578[_0x513b('0x1f')];var _0x3bfeee=_0x53bb9c?_0x462d80[_0x513b('0x1e')]:_0x3dd578[_0x513b('0x1f')]+_0x3dd578['limit'];var _0x4611d5;if(_0x3bfeee>=_0x3a642c){_0x3bfeee=_0x3a642c;_0x4611d5=0xc8;}else{_0x4611d5=0xce;}_0xc20b8d[_0x513b('0x19')](_0x4611d5);return _0xc20b8d['set'](_0x513b('0x20'),_0x2866a9+'-'+_0x3bfeee+'/'+_0x3a642c)[_0x513b('0x1b')](_0x462d80);}return null;};}function patchUpdates(_0xa47d32){return function(_0xc1019a){try{jsonpatch[_0x513b('0x21')](_0xc1019a,_0xa47d32,!![]);}catch(_0x4e7fb4){return BPromise[_0x513b('0x22')](_0x4e7fb4);}return _0xc1019a[_0x513b('0x23')]();};}function saveUpdates(_0x56bc47,_0x4e9219){return function(_0x42dbaa){if(_0x42dbaa){return _0x42dbaa[_0x513b('0x24')](_0x56bc47)[_0x513b('0x25')](function(_0x884f22){return _0x884f22;});}return null;};}function removeEntity(_0x53e59d,_0x1e9b3b){return function(_0x5c7e03){if(_0x5c7e03){return _0x5c7e03[_0x513b('0x26')]()[_0x513b('0x25')](function(){_0x53e59d[_0x513b('0x19')](0xcc)[_0x513b('0x1a')]();});}};}function handleEntityNotFound(_0x95516e,_0x173ea7){return function(_0x38904c){if(!_0x38904c){_0x95516e[_0x513b('0x27')](0x194);}return _0x38904c;};}function handleError(_0x58138e,_0x596758){_0x596758=_0x596758||0x1f4;return function(_0x295afe){logger[_0x513b('0x28')](_0x295afe[_0x513b('0x29')]);if(_0x295afe[_0x513b('0x2a')]){delete _0x295afe[_0x513b('0x2a')];}_0x58138e[_0x513b('0x19')](_0x596758)[_0x513b('0x2b')](_0x295afe);};}exports[_0x513b('0x2c')]=function(_0x539384,_0x224158){var _0x27c1d2={},_0x88ec5e={},_0x42f2ef={'count':0x0,'rows':[]};var _0x42c8b0=_['map'](db[_0x513b('0x2d')][_0x513b('0x2e')],function(_0x52c064){return{'name':_0x52c064[_0x513b('0x2f')],'type':_0x52c064['type'][_0x513b('0x30')]};});_0x88ec5e[_0x513b('0x31')]=_[_0x513b('0x32')](_0x42c8b0,_0x513b('0x2a'));_0x88ec5e[_0x513b('0x33')]=_[_0x513b('0x34')](_0x539384[_0x513b('0x33')]);_0x88ec5e[_0x513b('0x35')]=_[_0x513b('0x36')](_0x88ec5e['model'],_0x88ec5e[_0x513b('0x33')]);_0x27c1d2[_0x513b('0x37')]=_['intersection'](_0x88ec5e[_0x513b('0x31')],qs[_0x513b('0x38')](_0x539384[_0x513b('0x33')][_0x513b('0x38')]));_0x27c1d2[_0x513b('0x37')]=_0x27c1d2[_0x513b('0x37')]['length']?_0x27c1d2[_0x513b('0x37')]:_0x88ec5e[_0x513b('0x31')];if(!_0x539384['query'][_0x513b('0x39')]('nolimit')){_0x27c1d2['limit']=qs[_0x513b('0x1d')](_0x539384[_0x513b('0x33')][_0x513b('0x1d')]);_0x27c1d2['offset']=qs[_0x513b('0x1f')](_0x539384[_0x513b('0x33')][_0x513b('0x1f')]);}_0x27c1d2['order']=qs[_0x513b('0x3a')](_0x539384[_0x513b('0x33')][_0x513b('0x3a')]);_0x27c1d2[_0x513b('0x3b')]=qs[_0x513b('0x35')](_['pick'](_0x539384[_0x513b('0x33')],_0x88ec5e[_0x513b('0x35')]),_0x42c8b0);if(_0x539384[_0x513b('0x33')][_0x513b('0x3c')]){_0x27c1d2[_0x513b('0x3b')]=_[_0x513b('0x3d')](_0x27c1d2[_0x513b('0x3b')],{'$or':_[_0x513b('0x32')](_0x42c8b0,function(_0x5d3b28){if(_0x5d3b28[_0x513b('0x3e')]!==_0x513b('0x3f')){var _0x4d6126={};_0x4d6126[_0x5d3b28[_0x513b('0x2a')]]={'$like':'%'+_0x539384[_0x513b('0x33')][_0x513b('0x3c')]+'%'};return _0x4d6126;}})});}_0x27c1d2=_[_0x513b('0x3d')]({},_0x27c1d2,_0x539384[_0x513b('0x40')]);var _0x3f6290={'where':_0x27c1d2['where']};return db['FreshsalesAccount'][_0x513b('0x1e')](_0x3f6290)['then'](function(_0x46fa4a){_0x42f2ef[_0x513b('0x1e')]=_0x46fa4a;if(_0x539384[_0x513b('0x33')][_0x513b('0x41')]){_0x27c1d2[_0x513b('0x42')]=[{'all':!![]}];}return db[_0x513b('0x2d')]['findAll'](_0x27c1d2);})[_0x513b('0x25')](function(_0x563f9a){_0x42f2ef['rows']=_0x563f9a;return _0x42f2ef;})['then'](respondWithFilteredResult(_0x224158,_0x27c1d2))[_0x513b('0x43')](handleError(_0x224158,null));};exports[_0x513b('0x44')]=function(_0x526ad7,_0x5ad02b){var _0x1aa137={'raw':![],'where':{'id':_0x526ad7['params']['id']}},_0x31f1e1={};_0x31f1e1['model']=_[_0x513b('0x34')](db[_0x513b('0x2d')]['rawAttributes']);_0x31f1e1[_0x513b('0x33')]=_[_0x513b('0x34')](_0x526ad7[_0x513b('0x33')]);_0x31f1e1['filters']=_[_0x513b('0x36')](_0x31f1e1[_0x513b('0x31')],_0x31f1e1[_0x513b('0x33')]);_0x1aa137[_0x513b('0x37')]=_[_0x513b('0x36')](_0x31f1e1[_0x513b('0x31')],qs[_0x513b('0x38')](_0x526ad7['query'][_0x513b('0x38')]));_0x1aa137[_0x513b('0x37')]=_0x1aa137[_0x513b('0x37')][_0x513b('0x45')]?_0x1aa137[_0x513b('0x37')]:_0x31f1e1[_0x513b('0x31')];if(_0x526ad7[_0x513b('0x33')][_0x513b('0x41')]){_0x1aa137[_0x513b('0x42')]=[{'all':!![]}];}_0x1aa137=_[_0x513b('0x3d')]({},_0x1aa137,_0x526ad7[_0x513b('0x40')]);return db[_0x513b('0x2d')][_0x513b('0x46')](_0x1aa137)['then'](handleEntityNotFound(_0x5ad02b,null))[_0x513b('0x25')](respondWithResult(_0x5ad02b,null))[_0x513b('0x43')](handleError(_0x5ad02b,null));};exports[_0x513b('0x47')]=function(_0x1e9260,_0x47b35a){return db[_0x513b('0x2d')][_0x513b('0x47')](_0x1e9260[_0x513b('0x48')],{})[_0x513b('0x25')](respondWithResult(_0x47b35a,0xc9))[_0x513b('0x43')](handleError(_0x47b35a,null));};exports[_0x513b('0x24')]=function(_0x414977,_0x311eb5){if(_0x414977['body']['id']){delete _0x414977['body']['id'];}return db[_0x513b('0x2d')][_0x513b('0x46')]({'where':{'id':_0x414977[_0x513b('0x49')]['id']}})[_0x513b('0x25')](handleEntityNotFound(_0x311eb5,null))[_0x513b('0x25')](saveUpdates(_0x414977[_0x513b('0x48')],null))['then'](respondWithResult(_0x311eb5,null))['catch'](handleError(_0x311eb5,null));};exports[_0x513b('0x26')]=function(_0xbaa05a,_0x2c9280){return db[_0x513b('0x2d')]['find']({'where':{'id':_0xbaa05a[_0x513b('0x49')]['id']}})[_0x513b('0x25')](handleEntityNotFound(_0x2c9280,null))[_0x513b('0x25')](removeEntity(_0x2c9280,null))[_0x513b('0x43')](handleError(_0x2c9280,null));};exports[_0x513b('0x4a')]=function(_0x4fe95f,_0x9206ed,_0xb4f281){var _0x466c98={};var _0x137f7d={};var _0x1d6f19;var _0x6d0854;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4fe95f[_0x513b('0x49')]['id']}})[_0x513b('0x25')](handleEntityNotFound(_0x9206ed,null))[_0x513b('0x25')](function(_0x9b78ff){if(_0x9b78ff){_0x1d6f19=_0x9b78ff;_0x137f7d['model']=_[_0x513b('0x34')](db[_0x513b('0x4b')][_0x513b('0x2e')]);_0x137f7d[_0x513b('0x33')]=_['keys'](_0x4fe95f[_0x513b('0x33')]);_0x137f7d[_0x513b('0x35')]=_[_0x513b('0x36')](_0x137f7d[_0x513b('0x31')],_0x137f7d['query']);_0x466c98[_0x513b('0x37')]=_['intersection'](_0x137f7d[_0x513b('0x31')],qs['fields'](_0x4fe95f['query'][_0x513b('0x38')]));_0x466c98[_0x513b('0x37')]=_0x466c98[_0x513b('0x37')][_0x513b('0x45')]?_0x466c98['attributes']:_0x137f7d[_0x513b('0x31')];_0x466c98[_0x513b('0x4c')]=qs[_0x513b('0x3a')](_0x4fe95f[_0x513b('0x33')]['sort']);_0x466c98[_0x513b('0x3b')]=qs['filters'](_[_0x513b('0x4d')](_0x4fe95f[_0x513b('0x33')],_0x137f7d[_0x513b('0x35')]));if(_0x4fe95f[_0x513b('0x33')][_0x513b('0x3c')]){_0x466c98[_0x513b('0x3b')]=_[_0x513b('0x3d')](_0x466c98[_0x513b('0x3b')],{'$or':_[_0x513b('0x32')](_0x466c98[_0x513b('0x37')],function(_0x1933a8){var _0x55fa55={};_0x55fa55[_0x1933a8]={'$like':'%'+_0x4fe95f[_0x513b('0x33')][_0x513b('0x3c')]+'%'};return _0x55fa55;})});}_0x466c98=_[_0x513b('0x3d')]({},_0x466c98,_0x4fe95f[_0x513b('0x40')]);return _0x1d6f19['getConfigurations'](_0x466c98);}})[_0x513b('0x25')](function(_0x33e98c){if(_0x33e98c){_0x6d0854=_0x33e98c[_0x513b('0x45')];if(!_0x4fe95f[_0x513b('0x33')]['hasOwnProperty'](_0x513b('0x4e'))){_0x466c98[_0x513b('0x1d')]=qs[_0x513b('0x1d')](_0x4fe95f[_0x513b('0x33')][_0x513b('0x1d')]);_0x466c98[_0x513b('0x1f')]=qs['offset'](_0x4fe95f[_0x513b('0x33')][_0x513b('0x1f')]);}return _0x1d6f19[_0x513b('0x4a')](_0x466c98);}})['then'](function(_0x517df6){if(_0x517df6){return _0x517df6?{'count':_0x6d0854,'rows':_0x517df6}:null;}})[_0x513b('0x25')](respondWithResult(_0x9206ed,null))[_0x513b('0x43')](handleError(_0x9206ed,null));};exports['addConfiguration']=function(_0x205638,_0x246368,_0xadb59b){if(_0x205638[_0x513b('0x48')]['id']){delete _0x205638['body']['id'];}return db[_0x513b('0x2d')]['findOne']({'where':{'id':_0x205638[_0x513b('0x49')]['id']}})[_0x513b('0x25')](handleEntityNotFound(_0x246368,null))[_0x513b('0x25')](function(_0x4896fc){if(_0x4896fc){_0x205638[_0x513b('0x48')][_0x513b('0x4f')]=_0x4896fc['id'];_0x205638[_0x513b('0x48')][_0x513b('0x50')]=integrations[_0x513b('0x51')](_0x205638[_0x513b('0x48')][_0x513b('0x52')],_0x205638[_0x513b('0x48')]['type']);_0x205638['body'][_0x513b('0x53')]=integrations[_0x513b('0x54')](_0x205638[_0x513b('0x48')][_0x513b('0x52')],_0x205638[_0x513b('0x48')][_0x513b('0x3e')]);return db[_0x513b('0x4b')][_0x513b('0x47')](_0x205638[_0x513b('0x48')],{'include':[{'model':db[_0x513b('0x55')],'as':_0x513b('0x50')},{'model':db[_0x513b('0x55')],'as':_0x513b('0x53')}]});}return null;})[_0x513b('0x25')](respondWithResult(_0x246368,null))[_0x513b('0x43')](handleError(_0x246368,null));};exports[_0x513b('0x56')]=function(_0x1a2182,_0x5567c7,_0x5cf15d){var _0x5c60c4='';var _0x20d727='';return db[_0x513b('0x2d')][_0x513b('0x57')]({'where':{'id':_0x1a2182['params']['id']},'attributes':['id',_0x513b('0x58'),_0x513b('0x59'),_0x513b('0x5a')]})['then'](handleEntityNotFound(_0x5567c7,null))['then'](function(_0x466477){if(_0x466477){_0x20d727=_0x466477['username'];_0x5c60c4=_0x466477[_0x513b('0x59')];var _0x5b6188=_0x466477[_0x513b('0x59')][_0x513b('0x5b')](-0x1);if(_0x5b6188==='/'){_0x5c60c4=_0x5c60c4['substring'](0x0,_0x5c60c4[_0x513b('0x5c')](_0x5b6188));}return rp({'method':_0x513b('0x5d'),'uri':util[_0x513b('0x5e')](_0x513b('0x5f'),_0x5c60c4,_0x513b('0x60')),'headers':{'Authorization':'Token\x20token='+_0x466477[_0x513b('0x5a')]},'json':!![]});}})['then'](function(_0x20270a){if(_0x20270a){var _0x298d1d=_0x20270a['users'];var _0x3919df=![];var _0x41a5f7=null;for(_0x41a5f7=0x0;_0x41a5f7<_0x298d1d[_0x513b('0x45')];_0x41a5f7++){if(_0x298d1d[_0x41a5f7][_0x513b('0x61')]===_0x20d727){_0x3919df=!![];}}if(_0x3919df){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x513b('0x62')});}}})[_0x513b('0x25')](respondWithResult(_0x5567c7,null))[_0x513b('0x43')](function(_0x4fbd96){var _0x1fff46=_0x1a2182[_0x513b('0x33')][_0x513b('0x63')]?0x1f4:_0x4fbd96[_0x513b('0x64')]||0x1f4;logger[_0x513b('0x28')](_0x513b('0x65'),'getFields',_0x1fff46,JSON[_0x513b('0x66')](_0x4fbd96));delete _0x4fbd96[_0x513b('0x2a')];if(_0x1fff46===0x191){_0x1fff46=0x190;}_0x5567c7[_0x513b('0x19')](_0x1fff46)['send'](_0x1a2182[_0x513b('0x33')][_0x513b('0x63')]?{'message':_0x513b('0x67'),'statusCode':_0x4fbd96[_0x513b('0x64')]}:_0x4fbd96);});}; \ No newline at end of file +var _0x48be=['then','destroy','error','stack','name','index','FreshsalesAccount','rawAttributes','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x48be,0xb3));var _0xe48b=function(_0x3b3a1a,_0x1c1aba){_0x3b3a1a=_0x3b3a1a-0x0;var _0xc9c33f=_0x48be[_0x3b3a1a];return _0xc9c33f;};'use strict';var emlformat=require(_0xe48b('0x0'));var rimraf=require(_0xe48b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe48b('0x2'));var rp=require(_0xe48b('0x3'));var moment=require(_0xe48b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe48b('0x5'));var util=require(_0xe48b('0x6'));var path=require(_0xe48b('0x7'));var sox=require(_0xe48b('0x8'));var csv=require(_0xe48b('0x9'));var ejs=require(_0xe48b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe48b('0xb'));var squel=require(_0xe48b('0xc'));var crypto=require(_0xe48b('0xd'));var jsforce=require(_0xe48b('0xe'));var deskjs=require(_0xe48b('0xf'));var toCsv=require(_0xe48b('0x9'));var querystring=require(_0xe48b('0x10'));var Papa=require(_0xe48b('0x11'));var Redis=require(_0xe48b('0x12'));var authService=require(_0xe48b('0x13'));var qs=require(_0xe48b('0x14'));var as=require(_0xe48b('0x15'));var hardwareService=require(_0xe48b('0x16'));var logger=require(_0xe48b('0x17'))(_0xe48b('0x18'));var utils=require(_0xe48b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe48b('0x1a'));var db=require(_0xe48b('0x1b'))['db'];var integrations=require(_0xe48b('0x1c'));function respondWithStatusCode(_0x233417,_0x121fd0){_0x121fd0=_0x121fd0||0xcc;return function(_0x25d3a5){if(_0x25d3a5){return _0x233417[_0xe48b('0x1d')](_0x121fd0);}return _0x233417[_0xe48b('0x1e')](_0x121fd0)[_0xe48b('0x1f')]();};}function respondWithResult(_0x5b830f,_0x3b184d){_0x3b184d=_0x3b184d||0xc8;return function(_0x2b2d1b){if(_0x2b2d1b){return _0x5b830f[_0xe48b('0x1e')](_0x3b184d)['json'](_0x2b2d1b);}};}function respondWithFilteredResult(_0x85f09b,_0x5562f9){return function(_0x305f86){if(_0x305f86){var _0x1316d1=typeof _0x5562f9[_0xe48b('0x20')]===_0xe48b('0x21')&&typeof _0x5562f9[_0xe48b('0x22')]===_0xe48b('0x21');var _0x2b6830=_0x305f86[_0xe48b('0x23')];var _0x1de472=_0x1316d1?0x0:_0x5562f9[_0xe48b('0x20')];var _0x21b52c=_0x1316d1?_0x305f86[_0xe48b('0x23')]:_0x5562f9[_0xe48b('0x20')]+_0x5562f9['limit'];var _0x29310c;if(_0x21b52c>=_0x2b6830){_0x21b52c=_0x2b6830;_0x29310c=0xc8;}else{_0x29310c=0xce;}_0x85f09b[_0xe48b('0x1e')](_0x29310c);return _0x85f09b[_0xe48b('0x24')]('Content-Range',_0x1de472+'-'+_0x21b52c+'/'+_0x2b6830)[_0xe48b('0x25')](_0x305f86);}return null;};}function patchUpdates(_0x2dfb4c){return function(_0x249eb3){try{jsonpatch['apply'](_0x249eb3,_0x2dfb4c,!![]);}catch(_0xeaa0d2){return BPromise[_0xe48b('0x26')](_0xeaa0d2);}return _0x249eb3[_0xe48b('0x27')]();};}function saveUpdates(_0x39d898,_0x5d92ea){return function(_0x179b6b){if(_0x179b6b){return _0x179b6b[_0xe48b('0x28')](_0x39d898)[_0xe48b('0x29')](function(_0x46cc6a){return _0x46cc6a;});}return null;};}function removeEntity(_0x2a50d2,_0x478cc5){return function(_0x51f7fd){if(_0x51f7fd){return _0x51f7fd[_0xe48b('0x2a')]()[_0xe48b('0x29')](function(){_0x2a50d2[_0xe48b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ca5e,_0x5b112f){return function(_0x14a8aa){if(!_0x14a8aa){_0x47ca5e[_0xe48b('0x1d')](0x194);}return _0x14a8aa;};}function handleError(_0x106557,_0x34cea8){_0x34cea8=_0x34cea8||0x1f4;return function(_0x22b65e){logger[_0xe48b('0x2b')](_0x22b65e[_0xe48b('0x2c')]);if(_0x22b65e[_0xe48b('0x2d')]){delete _0x22b65e[_0xe48b('0x2d')];}_0x106557[_0xe48b('0x1e')](_0x34cea8)['send'](_0x22b65e);};}exports[_0xe48b('0x2e')]=function(_0x169278,_0x12f894){var _0x201877={},_0x5ced6c={},_0x580cd3={'count':0x0,'rows':[]};var _0x2e242b=_['map'](db[_0xe48b('0x2f')][_0xe48b('0x30')],function(_0x1554f6){return{'name':_0x1554f6['fieldName'],'type':_0x1554f6['type'][_0xe48b('0x31')]};});_0x5ced6c['model']=_['map'](_0x2e242b,_0xe48b('0x2d'));_0x5ced6c[_0xe48b('0x32')]=_[_0xe48b('0x33')](_0x169278[_0xe48b('0x32')]);_0x5ced6c[_0xe48b('0x34')]=_[_0xe48b('0x35')](_0x5ced6c[_0xe48b('0x36')],_0x5ced6c[_0xe48b('0x32')]);_0x201877['attributes']=_['intersection'](_0x5ced6c[_0xe48b('0x36')],qs[_0xe48b('0x37')](_0x169278['query']['fields']));_0x201877['attributes']=_0x201877['attributes'][_0xe48b('0x38')]?_0x201877[_0xe48b('0x39')]:_0x5ced6c[_0xe48b('0x36')];if(!_0x169278[_0xe48b('0x32')][_0xe48b('0x3a')](_0xe48b('0x3b'))){_0x201877[_0xe48b('0x22')]=qs[_0xe48b('0x22')](_0x169278[_0xe48b('0x32')]['limit']);_0x201877[_0xe48b('0x20')]=qs[_0xe48b('0x20')](_0x169278[_0xe48b('0x32')][_0xe48b('0x20')]);}_0x201877[_0xe48b('0x3c')]=qs[_0xe48b('0x3d')](_0x169278[_0xe48b('0x32')]['sort']);_0x201877['where']=qs[_0xe48b('0x34')](_[_0xe48b('0x3e')](_0x169278[_0xe48b('0x32')],_0x5ced6c[_0xe48b('0x34')]),_0x2e242b);if(_0x169278['query'][_0xe48b('0x3f')]){_0x201877[_0xe48b('0x40')]=_[_0xe48b('0x41')](_0x201877['where'],{'$or':_[_0xe48b('0x42')](_0x2e242b,function(_0x3c1fa2){if(_0x3c1fa2['type']!==_0xe48b('0x43')){var _0x4aa3bb={};_0x4aa3bb[_0x3c1fa2[_0xe48b('0x2d')]]={'$like':'%'+_0x169278[_0xe48b('0x32')][_0xe48b('0x3f')]+'%'};return _0x4aa3bb;}})});}_0x201877=_[_0xe48b('0x41')]({},_0x201877,_0x169278[_0xe48b('0x44')]);var _0x132f3a={'where':_0x201877[_0xe48b('0x40')]};return db[_0xe48b('0x2f')][_0xe48b('0x23')](_0x132f3a)[_0xe48b('0x29')](function(_0x4154ca){_0x580cd3[_0xe48b('0x23')]=_0x4154ca;if(_0x169278['query']['includeAll']){_0x201877[_0xe48b('0x45')]=[{'all':!![]}];}return db[_0xe48b('0x2f')][_0xe48b('0x46')](_0x201877);})[_0xe48b('0x29')](function(_0x243472){_0x580cd3[_0xe48b('0x47')]=_0x243472;return _0x580cd3;})[_0xe48b('0x29')](respondWithFilteredResult(_0x12f894,_0x201877))[_0xe48b('0x48')](handleError(_0x12f894,null));};exports[_0xe48b('0x49')]=function(_0x5dc259,_0x61e3b9){var _0x429352={'raw':![],'where':{'id':_0x5dc259[_0xe48b('0x4a')]['id']}},_0x4c5929={};_0x4c5929[_0xe48b('0x36')]=_[_0xe48b('0x33')](db['FreshsalesAccount'][_0xe48b('0x30')]);_0x4c5929[_0xe48b('0x32')]=_['keys'](_0x5dc259['query']);_0x4c5929[_0xe48b('0x34')]=_[_0xe48b('0x35')](_0x4c5929[_0xe48b('0x36')],_0x4c5929[_0xe48b('0x32')]);_0x429352[_0xe48b('0x39')]=_['intersection'](_0x4c5929[_0xe48b('0x36')],qs[_0xe48b('0x37')](_0x5dc259[_0xe48b('0x32')][_0xe48b('0x37')]));_0x429352[_0xe48b('0x39')]=_0x429352[_0xe48b('0x39')][_0xe48b('0x38')]?_0x429352[_0xe48b('0x39')]:_0x4c5929[_0xe48b('0x36')];if(_0x5dc259[_0xe48b('0x32')][_0xe48b('0x4b')]){_0x429352['include']=[{'all':!![]}];}_0x429352=_[_0xe48b('0x41')]({},_0x429352,_0x5dc259[_0xe48b('0x44')]);return db[_0xe48b('0x2f')][_0xe48b('0x4c')](_0x429352)[_0xe48b('0x29')](handleEntityNotFound(_0x61e3b9,null))['then'](respondWithResult(_0x61e3b9,null))[_0xe48b('0x48')](handleError(_0x61e3b9,null));};exports[_0xe48b('0x4d')]=function(_0x4d1f1d,_0x375e38){return db[_0xe48b('0x2f')][_0xe48b('0x4d')](_0x4d1f1d[_0xe48b('0x4e')],{})['then'](respondWithResult(_0x375e38,0xc9))['catch'](handleError(_0x375e38,null));};exports[_0xe48b('0x28')]=function(_0x95978a,_0x59e371){if(_0x95978a[_0xe48b('0x4e')]['id']){delete _0x95978a[_0xe48b('0x4e')]['id'];}return db[_0xe48b('0x2f')][_0xe48b('0x4c')]({'where':{'id':_0x95978a[_0xe48b('0x4a')]['id']}})[_0xe48b('0x29')](handleEntityNotFound(_0x59e371,null))[_0xe48b('0x29')](saveUpdates(_0x95978a[_0xe48b('0x4e')],null))[_0xe48b('0x29')](respondWithResult(_0x59e371,null))['catch'](handleError(_0x59e371,null));};exports[_0xe48b('0x2a')]=function(_0x134271,_0x5cf3a1){return db[_0xe48b('0x2f')][_0xe48b('0x4c')]({'where':{'id':_0x134271['params']['id']}})['then'](handleEntityNotFound(_0x5cf3a1,null))[_0xe48b('0x29')](removeEntity(_0x5cf3a1,null))[_0xe48b('0x48')](handleError(_0x5cf3a1,null));};exports[_0xe48b('0x4f')]=function(_0x377838,_0x387522,_0x186d72){var _0x435b4d={};var _0x2d6626={};var _0x2a15ce;var _0x51cf1e;return db[_0xe48b('0x2f')]['findOne']({'where':{'id':_0x377838[_0xe48b('0x4a')]['id']}})[_0xe48b('0x29')](handleEntityNotFound(_0x387522,null))[_0xe48b('0x29')](function(_0x3eb9ac){if(_0x3eb9ac){_0x2a15ce=_0x3eb9ac;_0x2d6626['model']=_[_0xe48b('0x33')](db['FreshsalesConfiguration'][_0xe48b('0x30')]);_0x2d6626['query']=_[_0xe48b('0x33')](_0x377838[_0xe48b('0x32')]);_0x2d6626['filters']=_[_0xe48b('0x35')](_0x2d6626[_0xe48b('0x36')],_0x2d6626['query']);_0x435b4d['attributes']=_['intersection'](_0x2d6626[_0xe48b('0x36')],qs['fields'](_0x377838['query'][_0xe48b('0x37')]));_0x435b4d[_0xe48b('0x39')]=_0x435b4d[_0xe48b('0x39')]['length']?_0x435b4d[_0xe48b('0x39')]:_0x2d6626['model'];_0x435b4d['order']=qs['sort'](_0x377838[_0xe48b('0x32')][_0xe48b('0x3d')]);_0x435b4d['where']=qs[_0xe48b('0x34')](_[_0xe48b('0x3e')](_0x377838[_0xe48b('0x32')],_0x2d6626[_0xe48b('0x34')]));if(_0x377838[_0xe48b('0x32')][_0xe48b('0x3f')]){_0x435b4d[_0xe48b('0x40')]=_[_0xe48b('0x41')](_0x435b4d[_0xe48b('0x40')],{'$or':_[_0xe48b('0x42')](_0x435b4d['attributes'],function(_0xe7c8da){var _0x1443e6={};_0x1443e6[_0xe7c8da]={'$like':'%'+_0x377838[_0xe48b('0x32')][_0xe48b('0x3f')]+'%'};return _0x1443e6;})});}_0x435b4d=_[_0xe48b('0x41')]({},_0x435b4d,_0x377838[_0xe48b('0x44')]);return _0x2a15ce['getConfigurations'](_0x435b4d);}})['then'](function(_0x4adffe){if(_0x4adffe){_0x51cf1e=_0x4adffe[_0xe48b('0x38')];if(!_0x377838['query']['hasOwnProperty'](_0xe48b('0x3b'))){_0x435b4d['limit']=qs[_0xe48b('0x22')](_0x377838['query'][_0xe48b('0x22')]);_0x435b4d[_0xe48b('0x20')]=qs[_0xe48b('0x20')](_0x377838[_0xe48b('0x32')][_0xe48b('0x20')]);}return _0x2a15ce[_0xe48b('0x4f')](_0x435b4d);}})[_0xe48b('0x29')](function(_0x15f09a){if(_0x15f09a){return _0x15f09a?{'count':_0x51cf1e,'rows':_0x15f09a}:null;}})['then'](respondWithResult(_0x387522,null))[_0xe48b('0x48')](handleError(_0x387522,null));};exports[_0xe48b('0x50')]=function(_0x57976f,_0x5b4652,_0xd4c5e0){if(_0x57976f[_0xe48b('0x4e')]['id']){delete _0x57976f['body']['id'];}return db[_0xe48b('0x2f')][_0xe48b('0x51')]({'where':{'id':_0x57976f[_0xe48b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b4652,null))[_0xe48b('0x29')](function(_0x47eb07){if(_0x47eb07){_0x57976f['body'][_0xe48b('0x52')]=_0x47eb07['id'];_0x57976f[_0xe48b('0x4e')][_0xe48b('0x53')]=integrations[_0xe48b('0x54')](_0x57976f[_0xe48b('0x4e')]['channel'],_0x57976f['body'][_0xe48b('0x55')]);_0x57976f[_0xe48b('0x4e')]['Descriptions']=integrations[_0xe48b('0x56')](_0x57976f[_0xe48b('0x4e')][_0xe48b('0x57')],_0x57976f[_0xe48b('0x4e')][_0xe48b('0x55')]);return db[_0xe48b('0x58')][_0xe48b('0x4d')](_0x57976f[_0xe48b('0x4e')],{'include':[{'model':db['FreshsalesField'],'as':_0xe48b('0x53')},{'model':db[_0xe48b('0x59')],'as':_0xe48b('0x5a')}]});}return null;})[_0xe48b('0x29')](respondWithResult(_0x5b4652,null))[_0xe48b('0x48')](handleError(_0x5b4652,null));};exports[_0xe48b('0x5b')]=function(_0x11545c,_0x4172ab,_0x1db900){var _0x385653='';var _0x28cc70='';return db[_0xe48b('0x2f')][_0xe48b('0x51')]({'where':{'id':_0x11545c[_0xe48b('0x4a')]['id']},'attributes':['id',_0xe48b('0x5c'),_0xe48b('0x5d'),'apiKey']})['then'](handleEntityNotFound(_0x4172ab,null))[_0xe48b('0x29')](function(_0x406ed5){if(_0x406ed5){_0x28cc70=_0x406ed5['username'];_0x385653=_0x406ed5[_0xe48b('0x5d')];var _0x262125=_0x406ed5['remoteUri'][_0xe48b('0x5e')](-0x1);if(_0x262125==='/'){_0x385653=_0x385653[_0xe48b('0x5f')](0x0,_0x385653[_0xe48b('0x60')](_0x262125));}return rp({'method':_0xe48b('0x61'),'uri':util[_0xe48b('0x62')](_0xe48b('0x63'),_0x385653,_0xe48b('0x64')),'headers':{'Authorization':'Token\x20token='+_0x406ed5['apiKey']},'json':!![]});}})[_0xe48b('0x29')](function(_0x304059){if(_0x304059){var _0x354a89=_0x304059[_0xe48b('0x65')];var _0x29805d=![];var _0x17d7d4=null;for(_0x17d7d4=0x0;_0x17d7d4<_0x354a89[_0xe48b('0x38')];_0x17d7d4++){if(_0x354a89[_0x17d7d4][_0xe48b('0x66')]===_0x28cc70){_0x29805d=!![];}}if(_0x29805d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe48b('0x67')});}}})['then'](respondWithResult(_0x4172ab,null))[_0xe48b('0x48')](function(_0xb2c0){var _0x447c45=_0x11545c[_0xe48b('0x32')][_0xe48b('0x68')]?0x1f4:_0xb2c0[_0xe48b('0x69')]||0x1f4;logger[_0xe48b('0x2b')](_0xe48b('0x6a'),'getFields',_0x447c45,JSON[_0xe48b('0x6b')](_0xb2c0));delete _0xb2c0[_0xe48b('0x2d')];if(_0x447c45===0x191){_0x447c45=0x190;}_0x4172ab[_0xe48b('0x1e')](_0x447c45)[_0xe48b('0x6c')](_0x11545c[_0xe48b('0x32')]['test']?{'message':_0xe48b('0x6d'),'statusCode':_0xb2c0[_0xe48b('0x69')]}:_0xb2c0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2b1721d..4acd67c 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 _0x7b84=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7b84,0x17c));var _0x47b8=function(_0x185e5b,_0x410d9d){_0x185e5b=_0x185e5b-0x0;var _0x577698=_0x7b84[_0x185e5b];return _0x577698;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));var integrations=require(_0x47b8('0xa'));module[_0x47b8('0xb')]=function(_0xafe88a,_0x53e656){return _0xafe88a[_0x47b8('0xc')](_0x47b8('0xd'),attributes,{'tableName':_0x47b8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x288efd,_0x86ff6b){var _0x7466bb=function(_0x36d83c){while(--_0x36d83c){_0x288efd['push'](_0x288efd['shift']());}};_0x7466bb(++_0x86ff6b);}(_0x5fab,0x177));var _0xb5fa=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x5fab[_0x53f897];return _0x6879f8;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8f69fa4..f35d489 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 _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x2151b2,_0x15f4d7){var _0x1ff3a7=function(_0x3d427c){while(--_0x3d427c){_0x2151b2['push'](_0x2151b2['shift']());}};_0x1ff3a7(++_0x15f4d7);}(_0x7bd0,0x111));var _0x07bd=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x7bd0[_0x1304c6];return _0x2e6654;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});}; \ No newline at end of file +var _0x5430=['map','model','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include'];(function(_0x418f8d,_0x50baf6){var _0x5016e3=function(_0x1d9024){while(--_0x1d9024){_0x418f8d['push'](_0x418f8d['shift']());}};_0x5016e3(++_0x50baf6);}(_0x5430,0x10c));var _0x0543=function(_0x2be892,_0xcb0348){_0x2be892=_0x2be892-0x0;var _0x24efac=_0x5430[_0x2be892];return _0x24efac;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['findAll']({'raw':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x20b396[_0x0543('0x17')]?_0x20b396['options'][_0x0543('0x19')]||null:null,'attributes':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'limit':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1b')]||null:null,'include':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x20b396['options']['include'],function(_0x59f1b2){return{'model':db[_0x59f1b2[_0x0543('0x1e')]],'as':_0x59f1b2['as'],'attributes':_0x59f1b2[_0x0543('0x1a')],'include':_0x59f1b2[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x59f1b2[_0x0543('0x1c')],function(_0x26e500){return{'model':db[_0x26e500[_0x0543('0x1e')]],'as':_0x26e500['as'],'attributes':_0x26e500[_0x0543('0x1a')],'include':_0x26e500[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x26e500[_0x0543('0x1c')],function(_0x21fc63){return{'model':db[_0x21fc63['model']],'as':_0x21fc63['as'],'attributes':_0x21fc63[_0x0543('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x30ad9e){logger['info'](_0x0543('0x15'),_0x20b396);logger[_0x0543('0xe')](_0x0543('0x15'),_0x20b396,JSON[_0x0543('0xf')](_0x30ad9e));_0x577cf0(_0x30ad9e);})['catch'](function(_0x1732be){logger[_0x0543('0x10')]('GetFreshsalesAccount',_0x1732be['message'],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x1732be[_0x0543('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x3b879b){var _0x2e03d1=this;return new Promise(function(_0x931ccc,_0x2bd6ce){return db[_0x0543('0x16')][_0x0543('0x1f')]({'raw':_0x3b879b[_0x0543('0x17')]?_0x3b879b['options'][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')][_0x0543('0x19')]||null:null,'attributes':_0x3b879b[_0x0543('0x17')]?_0x3b879b[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'include':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')]['include']?_[_0x0543('0x1d')](_0x3b879b[_0x0543('0x17')][_0x0543('0x1c')],function(_0x327027){return{'model':db[_0x327027['model']],'as':_0x327027['as'],'attributes':_0x327027[_0x0543('0x1a')],'include':_0x327027['include']?_[_0x0543('0x1d')](_0x327027[_0x0543('0x1c')],function(_0x3fbf5f){return{'model':db[_0x3fbf5f[_0x0543('0x1e')]],'as':_0x3fbf5f['as'],'attributes':_0x3fbf5f[_0x0543('0x1a')],'include':_0x3fbf5f[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x3fbf5f[_0x0543('0x1c')],function(_0x8ef4d4){return{'model':db[_0x8ef4d4[_0x0543('0x1e')]],'as':_0x8ef4d4['as'],'attributes':_0x8ef4d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x2d76d6){logger['info'](_0x0543('0x20'),_0x3b879b);logger['debug'](_0x0543('0x20'),_0x3b879b,JSON[_0x0543('0xf')](_0x2d76d6));_0x931ccc(_0x2d76d6);})['catch'](function(_0x5e8800){logger[_0x0543('0x10')](_0x0543('0x20'),_0x5e8800['message'],_0x3b879b);_0x2bd6ce(_0x2e03d1[_0x0543('0x10')](0x1f4,_0x5e8800[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8401cf1..dfa22fc 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 _0xca6e=['create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post'];(function(_0x5d6482,_0x1c9b00){var _0x32e681=function(_0x398459){while(--_0x398459){_0x5d6482['push'](_0x5d6482['shift']());}};_0x32e681(++_0x1c9b00);}(_0xca6e,0x118));var _0xeca6=function(_0x46a49b,_0x450178){_0x46a49b=_0x46a49b-0x0;var _0x47c587=_0xca6e[_0x46a49b];return _0x47c587;};'use strict';var multer=require(_0xeca6('0x0'));var util=require('util');var path=require(_0xeca6('0x1'));var timeout=require(_0xeca6('0x2'));var express=require('express');var router=express[_0xeca6('0x3')]();var fs_extra=require(_0xeca6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeca6('0x5'));var config=require(_0xeca6('0x6'));var controller=require(_0xeca6('0x7'));router['get']('/',auth[_0xeca6('0x8')](),controller[_0xeca6('0x9')]);router['get'](_0xeca6('0xa'),auth[_0xeca6('0x8')](),controller['show']);router[_0xeca6('0xb')](_0xeca6('0xc'),auth[_0xeca6('0x8')](),controller[_0xeca6('0xd')]);router[_0xeca6('0xb')](_0xeca6('0xe'),auth[_0xeca6('0x8')](),controller[_0xeca6('0xf')]);router[_0xeca6('0xb')](_0xeca6('0x10'),auth[_0xeca6('0x8')](),controller[_0xeca6('0x11')]);router[_0xeca6('0x12')]('/',auth[_0xeca6('0x8')](),controller[_0xeca6('0x13')]);router[_0xeca6('0x14')]('/:id',auth[_0xeca6('0x8')](),controller[_0xeca6('0x15')]);router[_0xeca6('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x288e=['getFields','post','create','put','delete','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x27026b,_0x31253d){var _0x5d931a=function(_0x57f23c){while(--_0x57f23c){_0x27026b['push'](_0x27026b['shift']());}};_0x5d931a(++_0x31253d);}(_0x288e,0x12d));var _0xe288=function(_0x17c92d,_0x571d35){_0x17c92d=_0x17c92d-0x0;var _0x2f26ba=_0x288e[_0x17c92d];return _0x2f26ba;};'use strict';var multer=require(_0xe288('0x0'));var util=require('util');var path=require(_0xe288('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe288('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe288('0x3'));var config=require(_0xe288('0x4'));var controller=require(_0xe288('0x5'));router[_0xe288('0x6')]('/',auth[_0xe288('0x7')](),controller[_0xe288('0x8')]);router[_0xe288('0x6')](_0xe288('0x9'),auth[_0xe288('0x7')](),controller[_0xe288('0xa')]);router[_0xe288('0x6')]('/:id/subjects',auth[_0xe288('0x7')](),controller['getSubjects']);router[_0xe288('0x6')](_0xe288('0xb'),auth[_0xe288('0x7')](),controller[_0xe288('0xc')]);router[_0xe288('0x6')](_0xe288('0xd'),auth[_0xe288('0x7')](),controller[_0xe288('0xe')]);router[_0xe288('0xf')]('/',auth[_0xe288('0x7')](),controller[_0xe288('0x10')]);router[_0xe288('0x11')](_0xe288('0x9'),auth[_0xe288('0x7')](),controller['update']);router[_0xe288('0x12')](_0xe288('0x9'),auth['isAuthenticated'](),controller[_0xe288('0x13')]);module[_0xe288('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index de37476..26da33d 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 _0xe27f=['STRING','exports'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xe27f,0xd9));var _0xfe27=function(_0x50e689,_0x161e74){_0x50e689=_0x50e689-0x0;var _0x1368dc=_0xe27f[_0x50e689];return _0x1368dc;};'use strict';var Sequelize=require('sequelize');module[_0xfe27('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfe27('0x1')]}}; \ No newline at end of file +var _0x2e61=['sequelize','STRING'];(function(_0x199f47,_0x4adae0){var _0x31a9cb=function(_0x3301dd){while(--_0x3301dd){_0x199f47['push'](_0x199f47['shift']());}};_0x31a9cb(++_0x4adae0);}(_0x2e61,0x1a2));var _0x12e6=function(_0x2c6084,_0x1aea89){_0x2c6084=_0x2c6084-0x0;var _0x56643a=_0x2e61[_0x2c6084];return _0x56643a;};'use strict';var Sequelize=require(_0x12e6('0x0'));module['exports']={'name':{'type':Sequelize[_0x12e6('0x1')]},'description':{'type':Sequelize[_0x12e6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 84dac45..fea41d6 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 _0x9169=['undefined','count','set','apply','reject','save','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','update','body','getSubjects','FreshsalesField','pick','filter','getDescriptions','findOne','getFields','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x466895,_0x43f6c6){var _0x27807c=function(_0x3c9958){while(--_0x3c9958){_0x466895['push'](_0x466895['shift']());}};_0x27807c(++_0x43f6c6);}(_0x9169,0xd3));var _0x9916=function(_0x1ce1e2,_0x50159c){_0x1ce1e2=_0x1ce1e2-0x0;var _0x233fb7=_0x9169[_0x1ce1e2];return _0x233fb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9916('0x0'));var jsonpatch=require(_0x9916('0x1'));var rp=require(_0x9916('0x2'));var moment=require(_0x9916('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9916('0x4'));var util=require('util');var path=require(_0x9916('0x5'));var sox=require(_0x9916('0x6'));var csv=require(_0x9916('0x7'));var ejs=require(_0x9916('0x8'));var fs=require('fs');var fs_extra=require(_0x9916('0x9'));var _=require(_0x9916('0xa'));var squel=require(_0x9916('0xb'));var crypto=require(_0x9916('0xc'));var jsforce=require(_0x9916('0xd'));var deskjs=require(_0x9916('0xe'));var toCsv=require(_0x9916('0x7'));var querystring=require(_0x9916('0xf'));var Papa=require(_0x9916('0x10'));var Redis=require('ioredis');var authService=require(_0x9916('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9916('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9916('0x13'))(_0x9916('0x14'));var utils=require(_0x9916('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9916('0x16'))['db'];function respondWithStatusCode(_0x2c62ed,_0x5c5a9d){_0x5c5a9d=_0x5c5a9d||0xcc;return function(_0x514093){if(_0x514093){return _0x2c62ed[_0x9916('0x17')](_0x5c5a9d);}return _0x2c62ed[_0x9916('0x18')](_0x5c5a9d)[_0x9916('0x19')]();};}function respondWithResult(_0x51ae04,_0x3f7ed5){_0x3f7ed5=_0x3f7ed5||0xc8;return function(_0x3d5b31){if(_0x3d5b31){return _0x51ae04['status'](_0x3f7ed5)[_0x9916('0x1a')](_0x3d5b31);}};}function respondWithFilteredResult(_0x55c9b8,_0xcd7502){return function(_0x5ca1df){if(_0x5ca1df){var _0x2cd2d9=typeof _0xcd7502[_0x9916('0x1b')]==='undefined'&&typeof _0xcd7502[_0x9916('0x1c')]===_0x9916('0x1d');var _0x3893c5=_0x5ca1df[_0x9916('0x1e')];var _0x24cd31=_0x2cd2d9?0x0:_0xcd7502['offset'];var _0x2c500c=_0x2cd2d9?_0x5ca1df[_0x9916('0x1e')]:_0xcd7502['offset']+_0xcd7502[_0x9916('0x1c')];var _0x456f0c;if(_0x2c500c>=_0x3893c5){_0x2c500c=_0x3893c5;_0x456f0c=0xc8;}else{_0x456f0c=0xce;}_0x55c9b8['status'](_0x456f0c);return _0x55c9b8[_0x9916('0x1f')]('Content-Range',_0x24cd31+'-'+_0x2c500c+'/'+_0x3893c5)[_0x9916('0x1a')](_0x5ca1df);}return null;};}function patchUpdates(_0x137866){return function(_0x36fb48){try{jsonpatch[_0x9916('0x20')](_0x36fb48,_0x137866,!![]);}catch(_0x23cf74){return BPromise[_0x9916('0x21')](_0x23cf74);}return _0x36fb48[_0x9916('0x22')]();};}function saveUpdates(_0x42e45b,_0x9ce99f){return function(_0x11a587){if(_0x11a587){return _0x11a587['update'](_0x42e45b)[_0x9916('0x23')](function(_0x5df94e){return _0x5df94e;});}return null;};}function removeEntity(_0x3732ee,_0x4542c3){return function(_0x48e099){if(_0x48e099){return _0x48e099['destroy']()[_0x9916('0x23')](function(){_0x3732ee[_0x9916('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7bc673,_0x3b7dcd){return function(_0x2eba1b){if(!_0x2eba1b){_0x7bc673[_0x9916('0x17')](0x194);}return _0x2eba1b;};}function handleError(_0x2fde39,_0x37fdee){_0x37fdee=_0x37fdee||0x1f4;return function(_0x17fd9e){logger['error'](_0x17fd9e[_0x9916('0x24')]);if(_0x17fd9e[_0x9916('0x25')]){delete _0x17fd9e[_0x9916('0x25')];}_0x2fde39[_0x9916('0x18')](_0x37fdee)[_0x9916('0x26')](_0x17fd9e);};}exports[_0x9916('0x27')]=function(_0x3ed9e0,_0x36d0ab){var _0x4f69ad={},_0x37d27d={},_0x3279b4={'count':0x0,'rows':[]};var _0x26a537=_[_0x9916('0x28')](db[_0x9916('0x29')][_0x9916('0x2a')],function(_0x40aae0){return{'name':_0x40aae0[_0x9916('0x2b')],'type':_0x40aae0[_0x9916('0x2c')][_0x9916('0x2d')]};});_0x37d27d[_0x9916('0x2e')]=_[_0x9916('0x28')](_0x26a537,_0x9916('0x25'));_0x37d27d[_0x9916('0x2f')]=_[_0x9916('0x30')](_0x3ed9e0[_0x9916('0x2f')]);_0x37d27d[_0x9916('0x31')]=_['intersection'](_0x37d27d[_0x9916('0x2e')],_0x37d27d[_0x9916('0x2f')]);_0x4f69ad[_0x9916('0x32')]=_[_0x9916('0x33')](_0x37d27d[_0x9916('0x2e')],qs[_0x9916('0x34')](_0x3ed9e0[_0x9916('0x2f')]['fields']));_0x4f69ad[_0x9916('0x32')]=_0x4f69ad[_0x9916('0x32')][_0x9916('0x35')]?_0x4f69ad['attributes']:_0x37d27d[_0x9916('0x2e')];if(!_0x3ed9e0[_0x9916('0x2f')][_0x9916('0x36')](_0x9916('0x37'))){_0x4f69ad[_0x9916('0x1c')]=qs['limit'](_0x3ed9e0[_0x9916('0x2f')][_0x9916('0x1c')]);_0x4f69ad[_0x9916('0x1b')]=qs[_0x9916('0x1b')](_0x3ed9e0[_0x9916('0x2f')][_0x9916('0x1b')]);}_0x4f69ad[_0x9916('0x38')]=qs[_0x9916('0x39')](_0x3ed9e0[_0x9916('0x2f')]['sort']);_0x4f69ad[_0x9916('0x3a')]=qs[_0x9916('0x31')](_['pick'](_0x3ed9e0['query'],_0x37d27d[_0x9916('0x31')]),_0x26a537);if(_0x3ed9e0[_0x9916('0x2f')]['filter']){_0x4f69ad[_0x9916('0x3a')]=_[_0x9916('0x3b')](_0x4f69ad[_0x9916('0x3a')],{'$or':_[_0x9916('0x28')](_0x26a537,function(_0x15d3a8){if(_0x15d3a8[_0x9916('0x2c')]!==_0x9916('0x3c')){var _0x409a79={};_0x409a79[_0x15d3a8['name']]={'$like':'%'+_0x3ed9e0[_0x9916('0x2f')]['filter']+'%'};return _0x409a79;}})});}_0x4f69ad=_[_0x9916('0x3b')]({},_0x4f69ad,_0x3ed9e0['options']);var _0x223626={'where':_0x4f69ad['where']};return db[_0x9916('0x29')][_0x9916('0x1e')](_0x223626)[_0x9916('0x23')](function(_0x1debcc){_0x3279b4['count']=_0x1debcc;if(_0x3ed9e0['query'][_0x9916('0x3d')]){_0x4f69ad[_0x9916('0x3e')]=[{'all':!![]}];}return db[_0x9916('0x29')][_0x9916('0x3f')](_0x4f69ad);})[_0x9916('0x23')](function(_0x3667cd){_0x3279b4[_0x9916('0x40')]=_0x3667cd;return _0x3279b4;})['then'](respondWithFilteredResult(_0x36d0ab,_0x4f69ad))[_0x9916('0x41')](handleError(_0x36d0ab,null));};exports[_0x9916('0x42')]=function(_0x368431,_0x4b525d){var _0x3dded7={'raw':![],'where':{'id':_0x368431[_0x9916('0x43')]['id']}},_0x5c3ba8={};_0x5c3ba8[_0x9916('0x2e')]=_[_0x9916('0x30')](db[_0x9916('0x29')][_0x9916('0x2a')]);_0x5c3ba8[_0x9916('0x2f')]=_[_0x9916('0x30')](_0x368431[_0x9916('0x2f')]);_0x5c3ba8[_0x9916('0x31')]=_[_0x9916('0x33')](_0x5c3ba8[_0x9916('0x2e')],_0x5c3ba8['query']);_0x3dded7[_0x9916('0x32')]=_[_0x9916('0x33')](_0x5c3ba8[_0x9916('0x2e')],qs['fields'](_0x368431[_0x9916('0x2f')][_0x9916('0x34')]));_0x3dded7[_0x9916('0x32')]=_0x3dded7[_0x9916('0x32')]['length']?_0x3dded7['attributes']:_0x5c3ba8[_0x9916('0x2e')];if(_0x368431[_0x9916('0x2f')][_0x9916('0x3d')]){_0x3dded7[_0x9916('0x3e')]=[{'all':!![]}];}_0x3dded7=_['merge']({},_0x3dded7,_0x368431[_0x9916('0x44')]);return db[_0x9916('0x29')][_0x9916('0x45')](_0x3dded7)['then'](handleEntityNotFound(_0x4b525d,null))[_0x9916('0x23')](respondWithResult(_0x4b525d,null))['catch'](handleError(_0x4b525d,null));};exports['create']=function(_0x61287f,_0x30960a){return db[_0x9916('0x29')][_0x9916('0x46')](_0x61287f['body'],{})['then'](respondWithResult(_0x30960a,0xc9))[_0x9916('0x41')](handleError(_0x30960a,null));};exports[_0x9916('0x47')]=function(_0xa34f8a,_0x1ad085){if(_0xa34f8a[_0x9916('0x48')]['id']){delete _0xa34f8a[_0x9916('0x48')]['id'];}return db[_0x9916('0x29')][_0x9916('0x45')]({'where':{'id':_0xa34f8a['params']['id']}})[_0x9916('0x23')](handleEntityNotFound(_0x1ad085,null))[_0x9916('0x23')](saveUpdates(_0xa34f8a[_0x9916('0x48')],null))[_0x9916('0x23')](respondWithResult(_0x1ad085,null))[_0x9916('0x41')](handleError(_0x1ad085,null));};exports['destroy']=function(_0x3569ef,_0x8d41c3){return db['FreshsalesConfiguration'][_0x9916('0x45')]({'where':{'id':_0x3569ef[_0x9916('0x43')]['id']}})[_0x9916('0x23')](handleEntityNotFound(_0x8d41c3,null))[_0x9916('0x23')](removeEntity(_0x8d41c3,null))[_0x9916('0x41')](handleError(_0x8d41c3,null));};exports[_0x9916('0x49')]=function(_0x414860,_0x316d6d,_0x9d4019){var _0x2ed2d2={};var _0x5526b5={};var _0x64db5;var _0x4cd270;return db[_0x9916('0x29')]['findOne']({'where':{'id':_0x414860[_0x9916('0x43')]['id']}})[_0x9916('0x23')](handleEntityNotFound(_0x316d6d,null))[_0x9916('0x23')](function(_0x3bab7c){if(_0x3bab7c){_0x64db5=_0x3bab7c;_0x5526b5[_0x9916('0x2e')]=_[_0x9916('0x30')](db[_0x9916('0x4a')][_0x9916('0x2a')]);_0x5526b5['query']=_[_0x9916('0x30')](_0x414860[_0x9916('0x2f')]);_0x5526b5['filters']=_['intersection'](_0x5526b5['model'],_0x5526b5['query']);_0x2ed2d2['attributes']=_[_0x9916('0x33')](_0x5526b5[_0x9916('0x2e')],qs[_0x9916('0x34')](_0x414860[_0x9916('0x2f')][_0x9916('0x34')]));_0x2ed2d2[_0x9916('0x32')]=_0x2ed2d2[_0x9916('0x32')][_0x9916('0x35')]?_0x2ed2d2[_0x9916('0x32')]:_0x5526b5[_0x9916('0x2e')];_0x2ed2d2['order']=qs[_0x9916('0x39')](_0x414860[_0x9916('0x2f')][_0x9916('0x39')]);_0x2ed2d2[_0x9916('0x3a')]=qs[_0x9916('0x31')](_[_0x9916('0x4b')](_0x414860[_0x9916('0x2f')],_0x5526b5[_0x9916('0x31')]));if(_0x414860[_0x9916('0x2f')][_0x9916('0x4c')]){_0x2ed2d2[_0x9916('0x3a')]=_[_0x9916('0x3b')](_0x2ed2d2[_0x9916('0x3a')],{'$or':_['map'](_0x2ed2d2[_0x9916('0x32')],function(_0x15aebd){var _0x5edb0b={};_0x5edb0b[_0x15aebd]={'$like':'%'+_0x414860['query'][_0x9916('0x4c')]+'%'};return _0x5edb0b;})});}_0x2ed2d2=_[_0x9916('0x3b')]({},_0x2ed2d2,_0x414860[_0x9916('0x44')]);return _0x64db5[_0x9916('0x49')](_0x2ed2d2);}})[_0x9916('0x23')](function(_0x199e5e){if(_0x199e5e){_0x4cd270=_0x199e5e[_0x9916('0x35')];if(!_0x414860['query'][_0x9916('0x36')](_0x9916('0x37'))){_0x2ed2d2[_0x9916('0x1c')]=qs['limit'](_0x414860[_0x9916('0x2f')][_0x9916('0x1c')]);_0x2ed2d2[_0x9916('0x1b')]=qs[_0x9916('0x1b')](_0x414860[_0x9916('0x2f')][_0x9916('0x1b')]);}return _0x64db5[_0x9916('0x49')](_0x2ed2d2);}})[_0x9916('0x23')](function(_0x2d011b){if(_0x2d011b){return _0x2d011b?{'count':_0x4cd270,'rows':_0x2d011b}:null;}})[_0x9916('0x23')](respondWithResult(_0x316d6d,null))['catch'](handleError(_0x316d6d,null));};exports[_0x9916('0x4d')]=function(_0x187cca,_0x4d7600,_0x25348e){var _0x143826={};var _0x532a96={};var _0x1000a6;var _0x5dcd49;return db['FreshsalesConfiguration'][_0x9916('0x4e')]({'where':{'id':_0x187cca[_0x9916('0x43')]['id']}})[_0x9916('0x23')](handleEntityNotFound(_0x4d7600,null))[_0x9916('0x23')](function(_0x592cce){if(_0x592cce){_0x1000a6=_0x592cce;_0x532a96['model']=_['keys'](db[_0x9916('0x4a')]['rawAttributes']);_0x532a96[_0x9916('0x2f')]=_[_0x9916('0x30')](_0x187cca[_0x9916('0x2f')]);_0x532a96[_0x9916('0x31')]=_[_0x9916('0x33')](_0x532a96['model'],_0x532a96[_0x9916('0x2f')]);_0x143826[_0x9916('0x32')]=_['intersection'](_0x532a96[_0x9916('0x2e')],qs[_0x9916('0x34')](_0x187cca['query'][_0x9916('0x34')]));_0x143826[_0x9916('0x32')]=_0x143826['attributes']['length']?_0x143826['attributes']:_0x532a96['model'];_0x143826['order']=qs[_0x9916('0x39')](_0x187cca[_0x9916('0x2f')][_0x9916('0x39')]);_0x143826[_0x9916('0x3a')]=qs[_0x9916('0x31')](_[_0x9916('0x4b')](_0x187cca['query'],_0x532a96[_0x9916('0x31')]));if(_0x187cca['query'][_0x9916('0x4c')]){_0x143826['where']=_[_0x9916('0x3b')](_0x143826[_0x9916('0x3a')],{'$or':_[_0x9916('0x28')](_0x143826[_0x9916('0x32')],function(_0x4e513b){var _0x1c4a88={};_0x1c4a88[_0x4e513b]={'$like':'%'+_0x187cca[_0x9916('0x2f')][_0x9916('0x4c')]+'%'};return _0x1c4a88;})});}_0x143826=_[_0x9916('0x3b')]({},_0x143826,_0x187cca[_0x9916('0x44')]);return _0x1000a6['getDescriptions'](_0x143826);}})[_0x9916('0x23')](function(_0x20a779){if(_0x20a779){_0x5dcd49=_0x20a779[_0x9916('0x35')];if(!_0x187cca[_0x9916('0x2f')][_0x9916('0x36')](_0x9916('0x37'))){_0x143826[_0x9916('0x1c')]=qs[_0x9916('0x1c')](_0x187cca['query'][_0x9916('0x1c')]);_0x143826[_0x9916('0x1b')]=qs[_0x9916('0x1b')](_0x187cca['query']['offset']);}return _0x1000a6[_0x9916('0x4d')](_0x143826);}})[_0x9916('0x23')](function(_0x495df8){if(_0x495df8){return _0x495df8?{'count':_0x5dcd49,'rows':_0x495df8}:null;}})[_0x9916('0x23')](respondWithResult(_0x4d7600,null))['catch'](handleError(_0x4d7600,null));};exports['getFields']=function(_0x302f93,_0x3d8292,_0x3312c6){var _0x18f0d4={};var _0x5d23f0={};var _0x29e324;var _0x1cf8ef;return db[_0x9916('0x29')][_0x9916('0x4e')]({'where':{'id':_0x302f93[_0x9916('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d8292,null))[_0x9916('0x23')](function(_0x45a90){if(_0x45a90){_0x29e324=_0x45a90;_0x5d23f0['model']=_[_0x9916('0x30')](db[_0x9916('0x4a')]['rawAttributes']);_0x5d23f0[_0x9916('0x2f')]=_[_0x9916('0x30')](_0x302f93[_0x9916('0x2f')]);_0x5d23f0['filters']=_['intersection'](_0x5d23f0['model'],_0x5d23f0[_0x9916('0x2f')]);_0x18f0d4[_0x9916('0x32')]=_[_0x9916('0x33')](_0x5d23f0[_0x9916('0x2e')],qs[_0x9916('0x34')](_0x302f93[_0x9916('0x2f')][_0x9916('0x34')]));_0x18f0d4['attributes']=_0x18f0d4[_0x9916('0x32')]['length']?_0x18f0d4['attributes']:_0x5d23f0['model'];_0x18f0d4[_0x9916('0x38')]=qs[_0x9916('0x39')](_0x302f93[_0x9916('0x2f')][_0x9916('0x39')]);_0x18f0d4[_0x9916('0x3a')]=qs[_0x9916('0x31')](_['pick'](_0x302f93['query'],_0x5d23f0['filters']));if(_0x302f93['query'][_0x9916('0x4c')]){_0x18f0d4[_0x9916('0x3a')]=_['merge'](_0x18f0d4[_0x9916('0x3a')],{'$or':_['map'](_0x18f0d4[_0x9916('0x32')],function(_0x1c6353){var _0x3ad238={};_0x3ad238[_0x1c6353]={'$like':'%'+_0x302f93[_0x9916('0x2f')][_0x9916('0x4c')]+'%'};return _0x3ad238;})});}_0x18f0d4=_[_0x9916('0x3b')]({},_0x18f0d4,_0x302f93['options']);return _0x29e324[_0x9916('0x4f')](_0x18f0d4);}})[_0x9916('0x23')](function(_0x3537ef){if(_0x3537ef){_0x1cf8ef=_0x3537ef[_0x9916('0x35')];if(!_0x302f93[_0x9916('0x2f')]['hasOwnProperty'](_0x9916('0x37'))){_0x18f0d4[_0x9916('0x1c')]=qs[_0x9916('0x1c')](_0x302f93[_0x9916('0x2f')][_0x9916('0x1c')]);_0x18f0d4['offset']=qs[_0x9916('0x1b')](_0x302f93['query']['offset']);}return _0x29e324['getFields'](_0x18f0d4);}})[_0x9916('0x23')](function(_0x10c8aa){if(_0x10c8aa){return _0x10c8aa?{'count':_0x1cf8ef,'rows':_0x10c8aa}:null;}})['then'](respondWithResult(_0x3d8292,null))[_0x9916('0x41')](handleError(_0x3d8292,null));}; \ No newline at end of file +var _0x0cd5=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','findAll','rows','fields','includeAll','include','find','create','body','catch','params','getSubjects','FreshsalesField','length','nolimit','getDescriptions','getFields','findOne'];(function(_0x1902d7,_0x29b24e){var _0x1b8939=function(_0x13566f){while(--_0x13566f){_0x1902d7['push'](_0x1902d7['shift']());}};_0x1b8939(++_0x29b24e);}(_0x0cd5,0xf6));var _0x50cd=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x0cd5[_0x513545];return _0x18b7c5;};'use strict';var emlformat=require(_0x50cd('0x0'));var rimraf=require(_0x50cd('0x1'));var zipdir=require(_0x50cd('0x2'));var jsonpatch=require(_0x50cd('0x3'));var rp=require(_0x50cd('0x4'));var moment=require(_0x50cd('0x5'));var BPromise=require(_0x50cd('0x6'));var Mustache=require(_0x50cd('0x7'));var util=require(_0x50cd('0x8'));var path=require(_0x50cd('0x9'));var sox=require(_0x50cd('0xa'));var csv=require(_0x50cd('0xb'));var ejs=require(_0x50cd('0xc'));var fs=require('fs');var fs_extra=require(_0x50cd('0xd'));var _=require(_0x50cd('0xe'));var squel=require(_0x50cd('0xf'));var crypto=require(_0x50cd('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x50cd('0xb'));var querystring=require('querystring');var Papa=require(_0x50cd('0x11'));var Redis=require(_0x50cd('0x12'));var authService=require(_0x50cd('0x13'));var qs=require(_0x50cd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50cd('0x15'));var logger=require(_0x50cd('0x16'))(_0x50cd('0x17'));var utils=require('../../config/utils');var config=require(_0x50cd('0x18'));var licenseUtil=require(_0x50cd('0x19'));var db=require(_0x50cd('0x1a'))['db'];function respondWithStatusCode(_0x1f590f,_0x5e4fc4){_0x5e4fc4=_0x5e4fc4||0xcc;return function(_0x43a134){if(_0x43a134){return _0x1f590f[_0x50cd('0x1b')](_0x5e4fc4);}return _0x1f590f[_0x50cd('0x1c')](_0x5e4fc4)[_0x50cd('0x1d')]();};}function respondWithResult(_0x3bd23c,_0x24bede){_0x24bede=_0x24bede||0xc8;return function(_0x532355){if(_0x532355){return _0x3bd23c[_0x50cd('0x1c')](_0x24bede)[_0x50cd('0x1e')](_0x532355);}};}function respondWithFilteredResult(_0x53892b,_0xdab547){return function(_0x21f4de){if(_0x21f4de){var _0x100364=typeof _0xdab547[_0x50cd('0x1f')]==='undefined'&&typeof _0xdab547[_0x50cd('0x20')]==='undefined';var _0x131e26=_0x21f4de[_0x50cd('0x21')];var _0x5a75a7=_0x100364?0x0:_0xdab547[_0x50cd('0x1f')];var _0x1cc70b=_0x100364?_0x21f4de[_0x50cd('0x21')]:_0xdab547[_0x50cd('0x1f')]+_0xdab547['limit'];var _0x3e88ff;if(_0x1cc70b>=_0x131e26){_0x1cc70b=_0x131e26;_0x3e88ff=0xc8;}else{_0x3e88ff=0xce;}_0x53892b[_0x50cd('0x1c')](_0x3e88ff);return _0x53892b[_0x50cd('0x22')]('Content-Range',_0x5a75a7+'-'+_0x1cc70b+'/'+_0x131e26)[_0x50cd('0x1e')](_0x21f4de);}return null;};}function patchUpdates(_0x1d0384){return function(_0x14600d){try{jsonpatch[_0x50cd('0x23')](_0x14600d,_0x1d0384,!![]);}catch(_0x1ec015){return BPromise[_0x50cd('0x24')](_0x1ec015);}return _0x14600d['save']();};}function saveUpdates(_0x480929,_0x126c8b){return function(_0x5b6e1e){if(_0x5b6e1e){return _0x5b6e1e[_0x50cd('0x25')](_0x480929)['then'](function(_0x5f3cf2){return _0x5f3cf2;});}return null;};}function removeEntity(_0x497601,_0x53409a){return function(_0x451da0){if(_0x451da0){return _0x451da0[_0x50cd('0x26')]()[_0x50cd('0x27')](function(){_0x497601['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x399c0e,_0x353c0e){return function(_0x37e4af){if(!_0x37e4af){_0x399c0e['sendStatus'](0x194);}return _0x37e4af;};}function handleError(_0x106ba5,_0x1d8a4d){_0x1d8a4d=_0x1d8a4d||0x1f4;return function(_0x42b9ae){logger[_0x50cd('0x28')](_0x42b9ae[_0x50cd('0x29')]);if(_0x42b9ae[_0x50cd('0x2a')]){delete _0x42b9ae[_0x50cd('0x2a')];}_0x106ba5[_0x50cd('0x1c')](_0x1d8a4d)[_0x50cd('0x2b')](_0x42b9ae);};}exports[_0x50cd('0x2c')]=function(_0x3a5b4a,_0x3ce42e){var _0xb74c37={},_0x52dd8d={},_0x1e8a86={'count':0x0,'rows':[]};var _0x7749b5=_[_0x50cd('0x2d')](db[_0x50cd('0x2e')][_0x50cd('0x2f')],function(_0x4f068e){return{'name':_0x4f068e[_0x50cd('0x30')],'type':_0x4f068e[_0x50cd('0x31')]['key']};});_0x52dd8d[_0x50cd('0x32')]=_[_0x50cd('0x2d')](_0x7749b5,_0x50cd('0x2a'));_0x52dd8d[_0x50cd('0x33')]=_[_0x50cd('0x34')](_0x3a5b4a['query']);_0x52dd8d['filters']=_[_0x50cd('0x35')](_0x52dd8d[_0x50cd('0x32')],_0x52dd8d[_0x50cd('0x33')]);_0xb74c37[_0x50cd('0x36')]=_[_0x50cd('0x35')](_0x52dd8d[_0x50cd('0x32')],qs['fields'](_0x3a5b4a[_0x50cd('0x33')]['fields']));_0xb74c37[_0x50cd('0x36')]=_0xb74c37[_0x50cd('0x36')]['length']?_0xb74c37['attributes']:_0x52dd8d[_0x50cd('0x32')];if(!_0x3a5b4a[_0x50cd('0x33')][_0x50cd('0x37')]('nolimit')){_0xb74c37['limit']=qs['limit'](_0x3a5b4a[_0x50cd('0x33')][_0x50cd('0x20')]);_0xb74c37[_0x50cd('0x1f')]=qs[_0x50cd('0x1f')](_0x3a5b4a['query'][_0x50cd('0x1f')]);}_0xb74c37[_0x50cd('0x38')]=qs[_0x50cd('0x39')](_0x3a5b4a[_0x50cd('0x33')][_0x50cd('0x39')]);_0xb74c37[_0x50cd('0x3a')]=qs['filters'](_[_0x50cd('0x3b')](_0x3a5b4a[_0x50cd('0x33')],_0x52dd8d[_0x50cd('0x3c')]),_0x7749b5);if(_0x3a5b4a[_0x50cd('0x33')][_0x50cd('0x3d')]){_0xb74c37['where']=_['merge'](_0xb74c37[_0x50cd('0x3a')],{'$or':_[_0x50cd('0x2d')](_0x7749b5,function(_0x441361){if(_0x441361[_0x50cd('0x31')]!==_0x50cd('0x3e')){var _0x2a0f2d={};_0x2a0f2d[_0x441361[_0x50cd('0x2a')]]={'$like':'%'+_0x3a5b4a['query'][_0x50cd('0x3d')]+'%'};return _0x2a0f2d;}})});}_0xb74c37=_[_0x50cd('0x3f')]({},_0xb74c37,_0x3a5b4a[_0x50cd('0x40')]);var _0x5215c3={'where':_0xb74c37[_0x50cd('0x3a')]};return db[_0x50cd('0x2e')][_0x50cd('0x21')](_0x5215c3)[_0x50cd('0x27')](function(_0x289b1c){_0x1e8a86[_0x50cd('0x21')]=_0x289b1c;if(_0x3a5b4a[_0x50cd('0x33')]['includeAll']){_0xb74c37['include']=[{'all':!![]}];}return db[_0x50cd('0x2e')][_0x50cd('0x41')](_0xb74c37);})[_0x50cd('0x27')](function(_0x47cbf4){_0x1e8a86[_0x50cd('0x42')]=_0x47cbf4;return _0x1e8a86;})[_0x50cd('0x27')](respondWithFilteredResult(_0x3ce42e,_0xb74c37))['catch'](handleError(_0x3ce42e,null));};exports['show']=function(_0x2b04ea,_0xe70ae8){var _0x503bcc={'raw':![],'where':{'id':_0x2b04ea['params']['id']}},_0x13af7b={};_0x13af7b[_0x50cd('0x32')]=_[_0x50cd('0x34')](db[_0x50cd('0x2e')][_0x50cd('0x2f')]);_0x13af7b[_0x50cd('0x33')]=_['keys'](_0x2b04ea['query']);_0x13af7b[_0x50cd('0x3c')]=_[_0x50cd('0x35')](_0x13af7b[_0x50cd('0x32')],_0x13af7b[_0x50cd('0x33')]);_0x503bcc['attributes']=_[_0x50cd('0x35')](_0x13af7b[_0x50cd('0x32')],qs[_0x50cd('0x43')](_0x2b04ea[_0x50cd('0x33')][_0x50cd('0x43')]));_0x503bcc['attributes']=_0x503bcc[_0x50cd('0x36')]['length']?_0x503bcc[_0x50cd('0x36')]:_0x13af7b[_0x50cd('0x32')];if(_0x2b04ea['query'][_0x50cd('0x44')]){_0x503bcc[_0x50cd('0x45')]=[{'all':!![]}];}_0x503bcc=_[_0x50cd('0x3f')]({},_0x503bcc,_0x2b04ea[_0x50cd('0x40')]);return db['FreshsalesConfiguration'][_0x50cd('0x46')](_0x503bcc)[_0x50cd('0x27')](handleEntityNotFound(_0xe70ae8,null))[_0x50cd('0x27')](respondWithResult(_0xe70ae8,null))['catch'](handleError(_0xe70ae8,null));};exports[_0x50cd('0x47')]=function(_0x170af1,_0x275a9d){return db['FreshsalesConfiguration']['create'](_0x170af1[_0x50cd('0x48')],{})[_0x50cd('0x27')](respondWithResult(_0x275a9d,0xc9))[_0x50cd('0x49')](handleError(_0x275a9d,null));};exports[_0x50cd('0x25')]=function(_0x166dde,_0x764bc5){if(_0x166dde['body']['id']){delete _0x166dde[_0x50cd('0x48')]['id'];}return db[_0x50cd('0x2e')][_0x50cd('0x46')]({'where':{'id':_0x166dde['params']['id']}})['then'](handleEntityNotFound(_0x764bc5,null))[_0x50cd('0x27')](saveUpdates(_0x166dde[_0x50cd('0x48')],null))[_0x50cd('0x27')](respondWithResult(_0x764bc5,null))[_0x50cd('0x49')](handleError(_0x764bc5,null));};exports[_0x50cd('0x26')]=function(_0x1dbd3b,_0x430c0d){return db[_0x50cd('0x2e')][_0x50cd('0x46')]({'where':{'id':_0x1dbd3b[_0x50cd('0x4a')]['id']}})[_0x50cd('0x27')](handleEntityNotFound(_0x430c0d,null))[_0x50cd('0x27')](removeEntity(_0x430c0d,null))[_0x50cd('0x49')](handleError(_0x430c0d,null));};exports[_0x50cd('0x4b')]=function(_0x1e6d17,_0xc89836,_0x4c4286){var _0x477800={};var _0x50aeca={};var _0x195ce7;var _0xce3e9a;return db[_0x50cd('0x2e')]['findOne']({'where':{'id':_0x1e6d17[_0x50cd('0x4a')]['id']}})[_0x50cd('0x27')](handleEntityNotFound(_0xc89836,null))[_0x50cd('0x27')](function(_0xdf2989){if(_0xdf2989){_0x195ce7=_0xdf2989;_0x50aeca[_0x50cd('0x32')]=_[_0x50cd('0x34')](db[_0x50cd('0x4c')][_0x50cd('0x2f')]);_0x50aeca[_0x50cd('0x33')]=_['keys'](_0x1e6d17[_0x50cd('0x33')]);_0x50aeca[_0x50cd('0x3c')]=_[_0x50cd('0x35')](_0x50aeca[_0x50cd('0x32')],_0x50aeca[_0x50cd('0x33')]);_0x477800['attributes']=_[_0x50cd('0x35')](_0x50aeca[_0x50cd('0x32')],qs[_0x50cd('0x43')](_0x1e6d17['query'][_0x50cd('0x43')]));_0x477800[_0x50cd('0x36')]=_0x477800['attributes'][_0x50cd('0x4d')]?_0x477800['attributes']:_0x50aeca[_0x50cd('0x32')];_0x477800['order']=qs['sort'](_0x1e6d17[_0x50cd('0x33')][_0x50cd('0x39')]);_0x477800[_0x50cd('0x3a')]=qs['filters'](_[_0x50cd('0x3b')](_0x1e6d17['query'],_0x50aeca[_0x50cd('0x3c')]));if(_0x1e6d17[_0x50cd('0x33')]['filter']){_0x477800[_0x50cd('0x3a')]=_[_0x50cd('0x3f')](_0x477800['where'],{'$or':_[_0x50cd('0x2d')](_0x477800[_0x50cd('0x36')],function(_0x3fd0a7){var _0x48a5fb={};_0x48a5fb[_0x3fd0a7]={'$like':'%'+_0x1e6d17[_0x50cd('0x33')][_0x50cd('0x3d')]+'%'};return _0x48a5fb;})});}_0x477800=_[_0x50cd('0x3f')]({},_0x477800,_0x1e6d17[_0x50cd('0x40')]);return _0x195ce7[_0x50cd('0x4b')](_0x477800);}})['then'](function(_0x1eca49){if(_0x1eca49){_0xce3e9a=_0x1eca49['length'];if(!_0x1e6d17[_0x50cd('0x33')][_0x50cd('0x37')](_0x50cd('0x4e'))){_0x477800[_0x50cd('0x20')]=qs['limit'](_0x1e6d17[_0x50cd('0x33')][_0x50cd('0x20')]);_0x477800[_0x50cd('0x1f')]=qs['offset'](_0x1e6d17[_0x50cd('0x33')]['offset']);}return _0x195ce7[_0x50cd('0x4b')](_0x477800);}})['then'](function(_0x15beb8){if(_0x15beb8){return _0x15beb8?{'count':_0xce3e9a,'rows':_0x15beb8}:null;}})['then'](respondWithResult(_0xc89836,null))['catch'](handleError(_0xc89836,null));};exports[_0x50cd('0x4f')]=function(_0x3d921d,_0x5c5757,_0x3b9427){var _0x3853e5={};var _0x576eaa={};var _0x4a0846;var _0x2c8208;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3d921d[_0x50cd('0x4a')]['id']}})[_0x50cd('0x27')](handleEntityNotFound(_0x5c5757,null))[_0x50cd('0x27')](function(_0x5e858a){if(_0x5e858a){_0x4a0846=_0x5e858a;_0x576eaa['model']=_[_0x50cd('0x34')](db['FreshsalesField']['rawAttributes']);_0x576eaa[_0x50cd('0x33')]=_[_0x50cd('0x34')](_0x3d921d[_0x50cd('0x33')]);_0x576eaa[_0x50cd('0x3c')]=_['intersection'](_0x576eaa[_0x50cd('0x32')],_0x576eaa[_0x50cd('0x33')]);_0x3853e5['attributes']=_[_0x50cd('0x35')](_0x576eaa[_0x50cd('0x32')],qs['fields'](_0x3d921d[_0x50cd('0x33')][_0x50cd('0x43')]));_0x3853e5['attributes']=_0x3853e5[_0x50cd('0x36')]['length']?_0x3853e5[_0x50cd('0x36')]:_0x576eaa[_0x50cd('0x32')];_0x3853e5[_0x50cd('0x38')]=qs[_0x50cd('0x39')](_0x3d921d[_0x50cd('0x33')][_0x50cd('0x39')]);_0x3853e5[_0x50cd('0x3a')]=qs[_0x50cd('0x3c')](_['pick'](_0x3d921d[_0x50cd('0x33')],_0x576eaa[_0x50cd('0x3c')]));if(_0x3d921d[_0x50cd('0x33')]['filter']){_0x3853e5[_0x50cd('0x3a')]=_[_0x50cd('0x3f')](_0x3853e5[_0x50cd('0x3a')],{'$or':_['map'](_0x3853e5['attributes'],function(_0x34ec8e){var _0x24e7ce={};_0x24e7ce[_0x34ec8e]={'$like':'%'+_0x3d921d['query'][_0x50cd('0x3d')]+'%'};return _0x24e7ce;})});}_0x3853e5=_[_0x50cd('0x3f')]({},_0x3853e5,_0x3d921d[_0x50cd('0x40')]);return _0x4a0846[_0x50cd('0x4f')](_0x3853e5);}})['then'](function(_0x181359){if(_0x181359){_0x2c8208=_0x181359[_0x50cd('0x4d')];if(!_0x3d921d[_0x50cd('0x33')][_0x50cd('0x37')](_0x50cd('0x4e'))){_0x3853e5[_0x50cd('0x20')]=qs['limit'](_0x3d921d['query'][_0x50cd('0x20')]);_0x3853e5['offset']=qs[_0x50cd('0x1f')](_0x3d921d[_0x50cd('0x33')]['offset']);}return _0x4a0846[_0x50cd('0x4f')](_0x3853e5);}})[_0x50cd('0x27')](function(_0x28b76e){if(_0x28b76e){return _0x28b76e?{'count':_0x2c8208,'rows':_0x28b76e}:null;}})['then'](respondWithResult(_0x5c5757,null))[_0x50cd('0x49')](handleError(_0x5c5757,null));};exports[_0x50cd('0x50')]=function(_0x4ba5e8,_0x398974,_0x19e2c9){var _0x51c894={};var _0x494a9e={};var _0x23ebfc;var _0x555e52;return db[_0x50cd('0x2e')][_0x50cd('0x51')]({'where':{'id':_0x4ba5e8['params']['id']}})[_0x50cd('0x27')](handleEntityNotFound(_0x398974,null))[_0x50cd('0x27')](function(_0x36e9dc){if(_0x36e9dc){_0x23ebfc=_0x36e9dc;_0x494a9e[_0x50cd('0x32')]=_[_0x50cd('0x34')](db[_0x50cd('0x4c')]['rawAttributes']);_0x494a9e['query']=_[_0x50cd('0x34')](_0x4ba5e8[_0x50cd('0x33')]);_0x494a9e['filters']=_[_0x50cd('0x35')](_0x494a9e[_0x50cd('0x32')],_0x494a9e['query']);_0x51c894[_0x50cd('0x36')]=_['intersection'](_0x494a9e[_0x50cd('0x32')],qs[_0x50cd('0x43')](_0x4ba5e8[_0x50cd('0x33')][_0x50cd('0x43')]));_0x51c894[_0x50cd('0x36')]=_0x51c894[_0x50cd('0x36')][_0x50cd('0x4d')]?_0x51c894['attributes']:_0x494a9e[_0x50cd('0x32')];_0x51c894[_0x50cd('0x38')]=qs['sort'](_0x4ba5e8[_0x50cd('0x33')][_0x50cd('0x39')]);_0x51c894[_0x50cd('0x3a')]=qs[_0x50cd('0x3c')](_[_0x50cd('0x3b')](_0x4ba5e8[_0x50cd('0x33')],_0x494a9e[_0x50cd('0x3c')]));if(_0x4ba5e8['query'][_0x50cd('0x3d')]){_0x51c894[_0x50cd('0x3a')]=_[_0x50cd('0x3f')](_0x51c894[_0x50cd('0x3a')],{'$or':_[_0x50cd('0x2d')](_0x51c894['attributes'],function(_0x4f276d){var _0x5dbec7={};_0x5dbec7[_0x4f276d]={'$like':'%'+_0x4ba5e8[_0x50cd('0x33')][_0x50cd('0x3d')]+'%'};return _0x5dbec7;})});}_0x51c894=_[_0x50cd('0x3f')]({},_0x51c894,_0x4ba5e8[_0x50cd('0x40')]);return _0x23ebfc['getFields'](_0x51c894);}})[_0x50cd('0x27')](function(_0x2ba693){if(_0x2ba693){_0x555e52=_0x2ba693['length'];if(!_0x4ba5e8[_0x50cd('0x33')][_0x50cd('0x37')]('nolimit')){_0x51c894[_0x50cd('0x20')]=qs[_0x50cd('0x20')](_0x4ba5e8[_0x50cd('0x33')]['limit']);_0x51c894[_0x50cd('0x1f')]=qs[_0x50cd('0x1f')](_0x4ba5e8[_0x50cd('0x33')][_0x50cd('0x1f')]);}return _0x23ebfc[_0x50cd('0x50')](_0x51c894);}})[_0x50cd('0x27')](function(_0x2bd8eb){if(_0x2bd8eb){return _0x2bd8eb?{'count':_0x555e52,'rows':_0x2bd8eb}:null;}})['then'](respondWithResult(_0x398974,null))[_0x50cd('0x49')](handleError(_0x398974,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index dde3a28..6277fb0 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 _0x2e96=['define','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2e96,0x13a));var _0x62e9=function(_0x1cac55,_0x414e73){_0x1cac55=_0x1cac55-0x0;var _0x3e269d=_0x2e96[_0x1cac55];return _0x3e269d;};'use strict';var _=require(_0x62e9('0x0'));var util=require(_0x62e9('0x1'));var logger=require(_0x62e9('0x2'))('api');var moment=require(_0x62e9('0x3'));var BPromise=require(_0x62e9('0x4'));var rp=require(_0x62e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62e9('0x6'));var config=require(_0x62e9('0x7'));var attributes=require(_0x62e9('0x8'));module[_0x62e9('0x9')]=function(_0x38114c,_0x503817){return _0x38114c[_0x62e9('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x62e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x786f=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x786f,0x73));var _0xf786=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x786f[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0xf786('0x0'));var util=require(_0xf786('0x1'));var logger=require(_0xf786('0x2'))('api');var moment=require(_0xf786('0x3'));var BPromise=require(_0xf786('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xf786('0x5')]=function(_0x207896,_0x56d7da){return _0x207896['define'](_0xf786('0x6'),attributes,{'tableName':_0xf786('0x7'),'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 cee62e9..5894e7f 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 _0x524b=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x423e15,_0x12b2b2){var _0x184279=function(_0x445a68){while(--_0x445a68){_0x423e15['push'](_0x423e15['shift']());}};_0x184279(++_0x12b2b2);}(_0x524b,0x131));var _0xb524=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x524b[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xb524('0x0'));var moment=require(_0xb524('0x1'));var BPromise=require(_0xb524('0x2'));var rs=require(_0xb524('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb524('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb524('0x5'))(_0xb524('0x6'));var config=require(_0xb524('0x7'));var jayson=require(_0xb524('0x8'));var client=jayson[_0xb524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387771,_0x2ff003,_0x43d17a){return new BPromise(function(_0x1343a7,_0x44b534){return client[_0xb524('0xa')](_0x387771,_0x43d17a)[_0xb524('0xb')](function(_0x340f87){logger[_0xb524('0xc')](_0xb524('0xd'),_0x2ff003,'request\x20sent');logger[_0xb524('0xe')](_0xb524('0xf'),_0x2ff003,_0xb524('0x10'),JSON[_0xb524('0x11')](_0x340f87));if(_0x340f87[_0xb524('0x12')]){if(_0x340f87[_0xb524('0x12')][_0xb524('0x13')]===0x1f4){logger['error'](_0xb524('0xd'),_0x2ff003,_0x340f87[_0xb524('0x12')]['message']);return _0x44b534(_0x340f87[_0xb524('0x12')][_0xb524('0x14')]);}logger[_0xb524('0x12')](_0xb524('0xd'),_0x2ff003,_0x340f87[_0xb524('0x12')][_0xb524('0x14')]);return _0x1343a7(_0x340f87[_0xb524('0x12')][_0xb524('0x14')]);}else{logger[_0xb524('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2ff003,'request\x20sent');_0x1343a7(_0x340f87[_0xb524('0x15')][_0xb524('0x14')]);}})[_0xb524('0x16')](function(_0x3fdf02){logger[_0xb524('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2ff003,_0x3fdf02);_0x44b534(_0x3fdf02);});});} \ No newline at end of file +var _0x3856=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x2db466,_0x228988){var _0x414add=function(_0x2e8823){while(--_0x2e8823){_0x2db466['push'](_0x2db466['shift']());}};_0x414add(++_0x228988);}(_0x3856,0x128));var _0x6385=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x3856[_0x60286b];return _0x5dff69;};'use strict';var _=require(_0x6385('0x0'));var util=require(_0x6385('0x1'));var moment=require(_0x6385('0x2'));var BPromise=require('bluebird');var rs=require(_0x6385('0x3'));var fs=require('fs');var Redis=require(_0x6385('0x4'));var db=require(_0x6385('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6385('0x6'))(_0x6385('0x7'));var config=require(_0x6385('0x8'));var jayson=require(_0x6385('0x9'));var client=jayson['client'][_0x6385('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11717f,_0x39a0cb,_0x4da698){return new BPromise(function(_0x18b10b,_0x3c6207){return client['request'](_0x11717f,_0x4da698)[_0x6385('0xb')](function(_0x28b7ba){logger[_0x6385('0xc')](_0x6385('0xd'),_0x39a0cb,_0x6385('0xe'));logger[_0x6385('0xf')](_0x6385('0x10'),_0x39a0cb,_0x6385('0xe'),JSON[_0x6385('0x11')](_0x28b7ba));if(_0x28b7ba['error']){if(_0x28b7ba[_0x6385('0x12')][_0x6385('0x13')]===0x1f4){logger[_0x6385('0x12')](_0x6385('0xd'),_0x39a0cb,_0x28b7ba[_0x6385('0x12')][_0x6385('0x14')]);return _0x3c6207(_0x28b7ba['error'][_0x6385('0x14')]);}logger[_0x6385('0x12')](_0x6385('0xd'),_0x39a0cb,_0x28b7ba[_0x6385('0x12')]['message']);return _0x18b10b(_0x28b7ba[_0x6385('0x12')][_0x6385('0x14')]);}else{logger[_0x6385('0xc')](_0x6385('0xd'),_0x39a0cb,_0x6385('0xe'));_0x18b10b(_0x28b7ba[_0x6385('0x15')][_0x6385('0x14')]);}})['catch'](function(_0x30d6d5){logger[_0x6385('0x12')](_0x6385('0xd'),_0x39a0cb,_0x30d6d5);_0x3c6207(_0x30d6d5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index fd1bae3..152bd5c 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 _0xef38=['put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0xef38,0x122));var _0x8ef3=function(_0x58def0,_0xb9a4a2){_0x58def0=_0x58def0-0x0;var _0x59ca31=_0xef38[_0x58def0];return _0x59ca31;};'use strict';var multer=require('multer');var util=require(_0x8ef3('0x0'));var path=require(_0x8ef3('0x1'));var timeout=require(_0x8ef3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ef3('0x3'));var auth=require(_0x8ef3('0x4'));var interaction=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var controller=require(_0x8ef3('0x7'));router['get']('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x9')]);router['get'](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xb')]);router[_0x8ef3('0xc')]('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xd')]);router[_0x8ef3('0xe')]('/:id',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xf')]);router[_0x8ef3('0x10')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x11')]);module[_0x8ef3('0x12')]=router; \ No newline at end of file +var _0x6183=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x1fbbf0,_0x333e9d){var _0x550d71=function(_0x47e809){while(--_0x47e809){_0x1fbbf0['push'](_0x1fbbf0['shift']());}};_0x550d71(++_0x333e9d);}(_0x6183,0x19b));var _0x3618=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x6183[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require(_0x3618('0x0'));var path=require(_0x3618('0x1'));var timeout=require(_0x3618('0x2'));var express=require('express');var router=express[_0x3618('0x3')]();var fs_extra=require(_0x3618('0x4'));var auth=require(_0x3618('0x5'));var interaction=require(_0x3618('0x6'));var config=require(_0x3618('0x7'));var controller=require(_0x3618('0x8'));router[_0x3618('0x9')]('/',auth[_0x3618('0xa')](),controller[_0x3618('0xb')]);router[_0x3618('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3618('0xc')]);router[_0x3618('0xd')]('/',auth[_0x3618('0xa')](),controller[_0x3618('0xe')]);router[_0x3618('0xf')](_0x3618('0x10'),auth[_0x3618('0xa')](),controller[_0x3618('0x11')]);router[_0x3618('0x12')](_0x3618('0x10'),auth[_0x3618('0xa')](),controller[_0x3618('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 41f2eab..7967242 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 _0xa58a=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist','STRING'];(function(_0xe5c182,_0x5885b1){var _0x4ed829=function(_0x2feea4){while(--_0x2feea4){_0xe5c182['push'](_0xe5c182['shift']());}};_0x4ed829(++_0x5885b1);}(_0xa58a,0x159));var _0xaa58=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xa58a[_0x2e0443];return _0x52d450;};'use strict';var Sequelize=require(_0xaa58('0x0'));module[_0xaa58('0x1')]={'type':{'type':Sequelize[_0xaa58('0x2')]('string',_0xaa58('0x3'),_0xaa58('0x4'),'keyValue',_0xaa58('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaa58('0x6')]},'key':{'type':Sequelize[_0xaa58('0x6')]},'keyType':{'type':Sequelize[_0xaa58('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaa58('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa58('0x6')]}}; \ No newline at end of file +var _0x7587=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0x7587,0xed));var _0x7758=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7587[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7758('0x0'));module['exports']={'type':{'type':Sequelize[_0x7758('0x1')](_0x7758('0x2'),_0x7758('0x3'),_0x7758('0x4'),'keyValue',_0x7758('0x5')),'defaultValue':_0x7758('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7758('0x6')]},'keyType':{'type':Sequelize[_0x7758('0x1')]('string',_0x7758('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7758('0x6')]},'idField':{'type':Sequelize[_0x7758('0x6')]},'nameField':{'type':Sequelize[_0x7758('0x6')]},'customField':{'type':Sequelize[_0x7758('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7758('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a38edac..51ad8ad 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 _0xc248=['rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','options','include','findAll','rows','catch','params','keys','filters','includeAll','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','map','FreshsalesField'];(function(_0xbe6699,_0x53b702){var _0x4f0a0f=function(_0x549022){while(--_0x549022){_0xbe6699['push'](_0xbe6699['shift']());}};_0x4f0a0f(++_0x53b702);}(_0xc248,0x67));var _0x8c24=function(_0x1e0b8f,_0x3f2c06){_0x1e0b8f=_0x1e0b8f-0x0;var _0x16dff3=_0xc248[_0x1e0b8f];return _0x16dff3;};'use strict';var emlformat=require(_0x8c24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c24('0x1'));var jsonpatch=require(_0x8c24('0x2'));var rp=require(_0x8c24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c24('0x4'));var util=require(_0x8c24('0x5'));var path=require(_0x8c24('0x6'));var sox=require('sox');var csv=require(_0x8c24('0x7'));var ejs=require(_0x8c24('0x8'));var fs=require('fs');var fs_extra=require(_0x8c24('0x9'));var _=require(_0x8c24('0xa'));var squel=require('squel');var crypto=require(_0x8c24('0xb'));var jsforce=require(_0x8c24('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c24('0x7'));var querystring=require(_0x8c24('0xd'));var Papa=require(_0x8c24('0xe'));var Redis=require(_0x8c24('0xf'));var authService=require(_0x8c24('0x10'));var qs=require(_0x8c24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c24('0x12'));var logger=require(_0x8c24('0x13'))(_0x8c24('0x14'));var utils=require(_0x8c24('0x15'));var config=require(_0x8c24('0x16'));var licenseUtil=require(_0x8c24('0x17'));var db=require(_0x8c24('0x18'))['db'];function respondWithStatusCode(_0x28d7b6,_0x259327){_0x259327=_0x259327||0xcc;return function(_0x187b98){if(_0x187b98){return _0x28d7b6['sendStatus'](_0x259327);}return _0x28d7b6[_0x8c24('0x19')](_0x259327)[_0x8c24('0x1a')]();};}function respondWithResult(_0xc8199c,_0x53f8e7){_0x53f8e7=_0x53f8e7||0xc8;return function(_0x511c33){if(_0x511c33){return _0xc8199c[_0x8c24('0x19')](_0x53f8e7)['json'](_0x511c33);}};}function respondWithFilteredResult(_0x3581dd,_0x5758c8){return function(_0x4194c3){if(_0x4194c3){var _0x39b21c=typeof _0x5758c8[_0x8c24('0x1b')]===_0x8c24('0x1c')&&typeof _0x5758c8[_0x8c24('0x1d')]===_0x8c24('0x1c');var _0xdd2e10=_0x4194c3['count'];var _0x312195=_0x39b21c?0x0:_0x5758c8[_0x8c24('0x1b')];var _0x1f4424=_0x39b21c?_0x4194c3[_0x8c24('0x1e')]:_0x5758c8[_0x8c24('0x1b')]+_0x5758c8[_0x8c24('0x1d')];var _0x4b0ebe;if(_0x1f4424>=_0xdd2e10){_0x1f4424=_0xdd2e10;_0x4b0ebe=0xc8;}else{_0x4b0ebe=0xce;}_0x3581dd[_0x8c24('0x19')](_0x4b0ebe);return _0x3581dd[_0x8c24('0x1f')](_0x8c24('0x20'),_0x312195+'-'+_0x1f4424+'/'+_0xdd2e10)[_0x8c24('0x21')](_0x4194c3);}return null;};}function patchUpdates(_0x573578){return function(_0x4c4691){try{jsonpatch['apply'](_0x4c4691,_0x573578,!![]);}catch(_0x1e175d){return BPromise[_0x8c24('0x22')](_0x1e175d);}return _0x4c4691[_0x8c24('0x23')]();};}function saveUpdates(_0x3239ac,_0x1a27c2){return function(_0x3c77d2){if(_0x3c77d2){return _0x3c77d2[_0x8c24('0x24')](_0x3239ac)[_0x8c24('0x25')](function(_0x249e1f){return _0x249e1f;});}return null;};}function removeEntity(_0x18d5f3,_0x3c1248){return function(_0x5e9aa4){if(_0x5e9aa4){return _0x5e9aa4[_0x8c24('0x26')]()[_0x8c24('0x25')](function(){_0x18d5f3[_0x8c24('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b4cf,_0x48eddc){return function(_0x54b191){if(!_0x54b191){_0x40b4cf[_0x8c24('0x27')](0x194);}return _0x54b191;};}function handleError(_0x5e1f1a,_0x44f1a4){_0x44f1a4=_0x44f1a4||0x1f4;return function(_0x2d2e22){logger[_0x8c24('0x28')](_0x2d2e22['stack']);if(_0x2d2e22[_0x8c24('0x29')]){delete _0x2d2e22[_0x8c24('0x29')];}_0x5e1f1a['status'](_0x44f1a4)[_0x8c24('0x2a')](_0x2d2e22);};}exports['index']=function(_0x26c4a3,_0xd84c2b){var _0x43ce41={},_0x5b4d0a={},_0x27eeed={'count':0x0,'rows':[]};var _0x34e0ce=_[_0x8c24('0x2b')](db[_0x8c24('0x2c')][_0x8c24('0x2d')],function(_0x5ffcd2){return{'name':_0x5ffcd2[_0x8c24('0x2e')],'type':_0x5ffcd2['type'][_0x8c24('0x2f')]};});_0x5b4d0a['model']=_[_0x8c24('0x2b')](_0x34e0ce,_0x8c24('0x29'));_0x5b4d0a[_0x8c24('0x30')]=_['keys'](_0x26c4a3['query']);_0x5b4d0a['filters']=_[_0x8c24('0x31')](_0x5b4d0a['model'],_0x5b4d0a[_0x8c24('0x30')]);_0x43ce41[_0x8c24('0x32')]=_[_0x8c24('0x31')](_0x5b4d0a[_0x8c24('0x33')],qs[_0x8c24('0x34')](_0x26c4a3['query']['fields']));_0x43ce41[_0x8c24('0x32')]=_0x43ce41[_0x8c24('0x32')][_0x8c24('0x35')]?_0x43ce41['attributes']:_0x5b4d0a['model'];if(!_0x26c4a3[_0x8c24('0x30')][_0x8c24('0x36')](_0x8c24('0x37'))){_0x43ce41[_0x8c24('0x1d')]=qs[_0x8c24('0x1d')](_0x26c4a3[_0x8c24('0x30')][_0x8c24('0x1d')]);_0x43ce41[_0x8c24('0x1b')]=qs[_0x8c24('0x1b')](_0x26c4a3[_0x8c24('0x30')]['offset']);}_0x43ce41[_0x8c24('0x38')]=qs[_0x8c24('0x39')](_0x26c4a3['query']['sort']);_0x43ce41['where']=qs['filters'](_['pick'](_0x26c4a3[_0x8c24('0x30')],_0x5b4d0a['filters']),_0x34e0ce);if(_0x26c4a3[_0x8c24('0x30')][_0x8c24('0x3a')]){_0x43ce41[_0x8c24('0x3b')]=_['merge'](_0x43ce41[_0x8c24('0x3b')],{'$or':_[_0x8c24('0x2b')](_0x34e0ce,function(_0x3afcd9){if(_0x3afcd9[_0x8c24('0x3c')]!=='VIRTUAL'){var _0xbcf370={};_0xbcf370[_0x3afcd9[_0x8c24('0x29')]]={'$like':'%'+_0x26c4a3['query'][_0x8c24('0x3a')]+'%'};return _0xbcf370;}})});}_0x43ce41=_['merge']({},_0x43ce41,_0x26c4a3[_0x8c24('0x3d')]);var _0x4eea71={'where':_0x43ce41['where']};return db[_0x8c24('0x2c')][_0x8c24('0x1e')](_0x4eea71)[_0x8c24('0x25')](function(_0x362d88){_0x27eeed[_0x8c24('0x1e')]=_0x362d88;if(_0x26c4a3[_0x8c24('0x30')]['includeAll']){_0x43ce41[_0x8c24('0x3e')]=[{'all':!![]}];}return db['FreshsalesField'][_0x8c24('0x3f')](_0x43ce41);})[_0x8c24('0x25')](function(_0x310d3b){_0x27eeed[_0x8c24('0x40')]=_0x310d3b;return _0x27eeed;})['then'](respondWithFilteredResult(_0xd84c2b,_0x43ce41))[_0x8c24('0x41')](handleError(_0xd84c2b,null));};exports['show']=function(_0xd32908,_0x147a02){var _0x24de16={'raw':!![],'where':{'id':_0xd32908[_0x8c24('0x42')]['id']}},_0x250bb2={};_0x250bb2[_0x8c24('0x33')]=_[_0x8c24('0x43')](db['FreshsalesField'][_0x8c24('0x2d')]);_0x250bb2[_0x8c24('0x30')]=_[_0x8c24('0x43')](_0xd32908[_0x8c24('0x30')]);_0x250bb2[_0x8c24('0x44')]=_[_0x8c24('0x31')](_0x250bb2[_0x8c24('0x33')],_0x250bb2[_0x8c24('0x30')]);_0x24de16[_0x8c24('0x32')]=_[_0x8c24('0x31')](_0x250bb2['model'],qs[_0x8c24('0x34')](_0xd32908[_0x8c24('0x30')][_0x8c24('0x34')]));_0x24de16[_0x8c24('0x32')]=_0x24de16[_0x8c24('0x32')][_0x8c24('0x35')]?_0x24de16[_0x8c24('0x32')]:_0x250bb2[_0x8c24('0x33')];if(_0xd32908['query'][_0x8c24('0x45')]){_0x24de16[_0x8c24('0x3e')]=[{'all':!![]}];}_0x24de16=_[_0x8c24('0x46')]({},_0x24de16,_0xd32908[_0x8c24('0x3d')]);return db[_0x8c24('0x2c')][_0x8c24('0x47')](_0x24de16)[_0x8c24('0x25')](handleEntityNotFound(_0x147a02,null))['then'](respondWithResult(_0x147a02,null))[_0x8c24('0x41')](handleError(_0x147a02,null));};exports['create']=function(_0x9fe476,_0x531b08){return db[_0x8c24('0x2c')][_0x8c24('0x48')](_0x9fe476['body'],{})['then'](respondWithResult(_0x531b08,0xc9))['catch'](handleError(_0x531b08,null));};exports['update']=function(_0x2e58ac,_0x2e2115){if(_0x2e58ac[_0x8c24('0x49')]['id']){delete _0x2e58ac[_0x8c24('0x49')]['id'];}return db[_0x8c24('0x2c')][_0x8c24('0x47')]({'where':{'id':_0x2e58ac[_0x8c24('0x42')]['id']}})[_0x8c24('0x25')](handleEntityNotFound(_0x2e2115,null))['then'](saveUpdates(_0x2e58ac[_0x8c24('0x49')],null))[_0x8c24('0x25')](respondWithResult(_0x2e2115,null))[_0x8c24('0x41')](handleError(_0x2e2115,null));};exports[_0x8c24('0x26')]=function(_0x4a9876,_0x36fdb2){return db[_0x8c24('0x2c')][_0x8c24('0x47')]({'where':{'id':_0x4a9876[_0x8c24('0x42')]['id']}})['then'](handleEntityNotFound(_0x36fdb2,null))['then'](removeEntity(_0x36fdb2,null))[_0x8c24('0x41')](handleError(_0x36fdb2,null));}; \ No newline at end of file +var _0x1d56=['limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','filters','intersection','model','query','attributes','fields','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x571d64,_0xc57c3c){var _0xadfff8=function(_0x50862b){while(--_0x50862b){_0x571d64['push'](_0x571d64['shift']());}};_0xadfff8(++_0xc57c3c);}(_0x1d56,0x77));var _0x61d5=function(_0x2e632b,_0x44af93){_0x2e632b=_0x2e632b-0x0;var _0x56b9b9=_0x1d56[_0x2e632b];return _0x56b9b9;};'use strict';var emlformat=require(_0x61d5('0x0'));var rimraf=require(_0x61d5('0x1'));var zipdir=require(_0x61d5('0x2'));var jsonpatch=require(_0x61d5('0x3'));var rp=require('request-promise');var moment=require(_0x61d5('0x4'));var BPromise=require(_0x61d5('0x5'));var Mustache=require(_0x61d5('0x6'));var util=require('util');var path=require(_0x61d5('0x7'));var sox=require(_0x61d5('0x8'));var csv=require('to-csv');var ejs=require(_0x61d5('0x9'));var fs=require('fs');var fs_extra=require(_0x61d5('0xa'));var _=require(_0x61d5('0xb'));var squel=require(_0x61d5('0xc'));var crypto=require(_0x61d5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x61d5('0xe'));var toCsv=require(_0x61d5('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x61d5('0x10'));var as=require(_0x61d5('0x11'));var hardwareService=require(_0x61d5('0x12'));var logger=require(_0x61d5('0x13'))(_0x61d5('0x14'));var utils=require(_0x61d5('0x15'));var config=require(_0x61d5('0x16'));var licenseUtil=require(_0x61d5('0x17'));var db=require(_0x61d5('0x18'))['db'];function respondWithStatusCode(_0x5b338f,_0x4b2ecb){_0x4b2ecb=_0x4b2ecb||0xcc;return function(_0x13954c){if(_0x13954c){return _0x5b338f['sendStatus'](_0x4b2ecb);}return _0x5b338f[_0x61d5('0x19')](_0x4b2ecb)[_0x61d5('0x1a')]();};}function respondWithResult(_0x3b9bd4,_0x1032cf){_0x1032cf=_0x1032cf||0xc8;return function(_0x2eca29){if(_0x2eca29){return _0x3b9bd4[_0x61d5('0x19')](_0x1032cf)[_0x61d5('0x1b')](_0x2eca29);}};}function respondWithFilteredResult(_0x21e28a,_0x4e2c0b){return function(_0x175b9e){if(_0x175b9e){var _0xbd8db8=typeof _0x4e2c0b['offset']===_0x61d5('0x1c')&&typeof _0x4e2c0b[_0x61d5('0x1d')]===_0x61d5('0x1c');var _0x16ab6d=_0x175b9e[_0x61d5('0x1e')];var _0x4a9f7e=_0xbd8db8?0x0:_0x4e2c0b[_0x61d5('0x1f')];var _0x679ad4=_0xbd8db8?_0x175b9e[_0x61d5('0x1e')]:_0x4e2c0b[_0x61d5('0x1f')]+_0x4e2c0b[_0x61d5('0x1d')];var _0x4c2b3e;if(_0x679ad4>=_0x16ab6d){_0x679ad4=_0x16ab6d;_0x4c2b3e=0xc8;}else{_0x4c2b3e=0xce;}_0x21e28a['status'](_0x4c2b3e);return _0x21e28a[_0x61d5('0x20')](_0x61d5('0x21'),_0x4a9f7e+'-'+_0x679ad4+'/'+_0x16ab6d)[_0x61d5('0x1b')](_0x175b9e);}return null;};}function patchUpdates(_0x14cdfd){return function(_0x3ddd1c){try{jsonpatch['apply'](_0x3ddd1c,_0x14cdfd,!![]);}catch(_0x2f463f){return BPromise[_0x61d5('0x22')](_0x2f463f);}return _0x3ddd1c[_0x61d5('0x23')]();};}function saveUpdates(_0x33b8da,_0xa0ce8c){return function(_0x9ae5a0){if(_0x9ae5a0){return _0x9ae5a0['update'](_0x33b8da)[_0x61d5('0x24')](function(_0x4ac98e){return _0x4ac98e;});}return null;};}function removeEntity(_0x22dc8e,_0x4c2074){return function(_0x196903){if(_0x196903){return _0x196903[_0x61d5('0x25')]()['then'](function(){_0x22dc8e['status'](0xcc)[_0x61d5('0x1a')]();});}};}function handleEntityNotFound(_0x25e3a9,_0x86c5c1){return function(_0x44d90e){if(!_0x44d90e){_0x25e3a9[_0x61d5('0x26')](0x194);}return _0x44d90e;};}function handleError(_0x40eb1b,_0x300cf4){_0x300cf4=_0x300cf4||0x1f4;return function(_0x3e6a80){logger['error'](_0x3e6a80[_0x61d5('0x27')]);if(_0x3e6a80[_0x61d5('0x28')]){delete _0x3e6a80[_0x61d5('0x28')];}_0x40eb1b[_0x61d5('0x19')](_0x300cf4)[_0x61d5('0x29')](_0x3e6a80);};}exports[_0x61d5('0x2a')]=function(_0x2bdf63,_0x4a2c28){var _0x1f65f4={},_0x387599={},_0x516035={'count':0x0,'rows':[]};var _0x289001=_[_0x61d5('0x2b')](db[_0x61d5('0x2c')][_0x61d5('0x2d')],function(_0x5e10a0){return{'name':_0x5e10a0[_0x61d5('0x2e')],'type':_0x5e10a0['type'][_0x61d5('0x2f')]};});_0x387599['model']=_[_0x61d5('0x2b')](_0x289001,'name');_0x387599['query']=_['keys'](_0x2bdf63['query']);_0x387599[_0x61d5('0x30')]=_[_0x61d5('0x31')](_0x387599[_0x61d5('0x32')],_0x387599[_0x61d5('0x33')]);_0x1f65f4[_0x61d5('0x34')]=_['intersection'](_0x387599[_0x61d5('0x32')],qs[_0x61d5('0x35')](_0x2bdf63[_0x61d5('0x33')][_0x61d5('0x35')]));_0x1f65f4[_0x61d5('0x34')]=_0x1f65f4['attributes']['length']?_0x1f65f4[_0x61d5('0x34')]:_0x387599['model'];if(!_0x2bdf63[_0x61d5('0x33')]['hasOwnProperty']('nolimit')){_0x1f65f4[_0x61d5('0x1d')]=qs[_0x61d5('0x1d')](_0x2bdf63['query'][_0x61d5('0x1d')]);_0x1f65f4['offset']=qs['offset'](_0x2bdf63[_0x61d5('0x33')][_0x61d5('0x1f')]);}_0x1f65f4[_0x61d5('0x36')]=qs[_0x61d5('0x37')](_0x2bdf63[_0x61d5('0x33')]['sort']);_0x1f65f4['where']=qs['filters'](_[_0x61d5('0x38')](_0x2bdf63[_0x61d5('0x33')],_0x387599[_0x61d5('0x30')]),_0x289001);if(_0x2bdf63[_0x61d5('0x33')]['filter']){_0x1f65f4['where']=_['merge'](_0x1f65f4[_0x61d5('0x39')],{'$or':_[_0x61d5('0x2b')](_0x289001,function(_0x274b46){if(_0x274b46[_0x61d5('0x3a')]!==_0x61d5('0x3b')){var _0x2dddab={};_0x2dddab[_0x274b46['name']]={'$like':'%'+_0x2bdf63[_0x61d5('0x33')][_0x61d5('0x3c')]+'%'};return _0x2dddab;}})});}_0x1f65f4=_[_0x61d5('0x3d')]({},_0x1f65f4,_0x2bdf63[_0x61d5('0x3e')]);var _0x1af2be={'where':_0x1f65f4[_0x61d5('0x39')]};return db['FreshsalesField']['count'](_0x1af2be)[_0x61d5('0x24')](function(_0x20ba9a){_0x516035[_0x61d5('0x1e')]=_0x20ba9a;if(_0x2bdf63[_0x61d5('0x33')][_0x61d5('0x3f')]){_0x1f65f4[_0x61d5('0x40')]=[{'all':!![]}];}return db[_0x61d5('0x2c')][_0x61d5('0x41')](_0x1f65f4);})[_0x61d5('0x24')](function(_0x47480a){_0x516035[_0x61d5('0x42')]=_0x47480a;return _0x516035;})['then'](respondWithFilteredResult(_0x4a2c28,_0x1f65f4))['catch'](handleError(_0x4a2c28,null));};exports['show']=function(_0x21e4a3,_0x1415a1){var _0x252fd4={'raw':!![],'where':{'id':_0x21e4a3[_0x61d5('0x43')]['id']}},_0x3991ac={};_0x3991ac[_0x61d5('0x32')]=_['keys'](db[_0x61d5('0x2c')][_0x61d5('0x2d')]);_0x3991ac[_0x61d5('0x33')]=_[_0x61d5('0x44')](_0x21e4a3[_0x61d5('0x33')]);_0x3991ac['filters']=_[_0x61d5('0x31')](_0x3991ac['model'],_0x3991ac[_0x61d5('0x33')]);_0x252fd4['attributes']=_['intersection'](_0x3991ac['model'],qs[_0x61d5('0x35')](_0x21e4a3[_0x61d5('0x33')][_0x61d5('0x35')]));_0x252fd4[_0x61d5('0x34')]=_0x252fd4['attributes'][_0x61d5('0x45')]?_0x252fd4[_0x61d5('0x34')]:_0x3991ac[_0x61d5('0x32')];if(_0x21e4a3['query'][_0x61d5('0x3f')]){_0x252fd4['include']=[{'all':!![]}];}_0x252fd4=_[_0x61d5('0x3d')]({},_0x252fd4,_0x21e4a3['options']);return db[_0x61d5('0x2c')][_0x61d5('0x46')](_0x252fd4)[_0x61d5('0x24')](handleEntityNotFound(_0x1415a1,null))[_0x61d5('0x24')](respondWithResult(_0x1415a1,null))[_0x61d5('0x47')](handleError(_0x1415a1,null));};exports[_0x61d5('0x48')]=function(_0x4e832a,_0x5cb99c){return db['FreshsalesField'][_0x61d5('0x48')](_0x4e832a[_0x61d5('0x49')],{})[_0x61d5('0x24')](respondWithResult(_0x5cb99c,0xc9))[_0x61d5('0x47')](handleError(_0x5cb99c,null));};exports['update']=function(_0x168e63,_0x4c2e36){if(_0x168e63[_0x61d5('0x49')]['id']){delete _0x168e63['body']['id'];}return db[_0x61d5('0x2c')][_0x61d5('0x46')]({'where':{'id':_0x168e63[_0x61d5('0x43')]['id']}})[_0x61d5('0x24')](handleEntityNotFound(_0x4c2e36,null))[_0x61d5('0x24')](saveUpdates(_0x168e63[_0x61d5('0x49')],null))['then'](respondWithResult(_0x4c2e36,null))[_0x61d5('0x47')](handleError(_0x4c2e36,null));};exports[_0x61d5('0x25')]=function(_0x3da664,_0x163b83){return db['FreshsalesField'][_0x61d5('0x46')]({'where':{'id':_0x3da664['params']['id']}})[_0x61d5('0x24')](handleEntityNotFound(_0x163b83,null))['then'](removeEntity(_0x163b83,null))[_0x61d5('0x47')](handleError(_0x163b83,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f8bd53c..e92df28 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 _0xf4f4=['int_freshsales_fields','freshsales_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FreshsalesField'];(function(_0x5544e1,_0x32afaf){var _0x233c4c=function(_0x228720){while(--_0x228720){_0x5544e1['push'](_0x5544e1['shift']());}};_0x233c4c(++_0x32afaf);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4076c0,_0x4a1b04){_0x4076c0=_0x4076c0-0x0;var _0xee65ab=_0xf4f4[_0x4076c0];return _0xee65ab;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[{'name':_0x4f4f('0xc'),'fields':[_0x4f4f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed03=['util','api','request-promise','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0xed03,0xdc));var _0x3ed0=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xed03[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var logger=require('../../config/logger')(_0x3ed0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3ed0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ed0('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ed0('0x5'));module[_0x3ed0('0x6')]=function(_0x9ef405,_0x39a2a0){return _0x9ef405[_0x3ed0('0x7')](_0x3ed0('0x8'),attributes,{'tableName':_0x3ed0('0x9'),'paranoid':![],'indexes':[{'name':_0x3ed0('0xa'),'fields':[_0x3ed0('0xb'),_0x3ed0('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 4292871..c3a7043 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 _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xacf4,0xe7));var _0x4acf=function(_0x1e0c7d,_0x257eb5){_0x1e0c7d=_0x1e0c7d-0x0;var _0x396921=_0xacf4[_0x1e0c7d];return _0x396921;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file +var _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x2945fb,_0x26a761){var _0x1a1eea=function(_0x567380){while(--_0x567380){_0x2945fb['push'](_0x2945fb['shift']());}};_0x1a1eea(++_0x26a761);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 8d40c5a..103be4c 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(_0x5a3f89,_0x7a0b5e){var _0x35df4e=function(_0xc36692){while(--_0xc36692){_0x5a3f89['push'](_0x5a3f89['shift']());}};_0x35df4e(++_0x7a0b5e);}(_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 +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(_0x43944b,_0x31ee15){var _0x351da8=function(_0x10124e){while(--_0x10124e){_0x43944b['push'](_0x43944b['shift']());}};_0x351da8(++_0x31ee15);}(_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/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 8d4ded6..2ac4732 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 _0xf58a=['integrationTab','newTab','exports','STRING','username'];(function(_0x4c0159,_0x3cc1da){var _0x8476b3=function(_0x569d58){while(--_0x569d58){_0x4c0159['push'](_0x4c0159['shift']());}};_0x8476b3(++_0x3cc1da);}(_0xf58a,0xde));var _0xaf58=function(_0x1da05f,_0x403bb7){_0x1da05f=_0x1da05f-0x0;var _0x345d21=_0xf58a[_0x1da05f];return _0x345d21;};'use strict';var Sequelize=require('sequelize');module[_0xaf58('0x0')]={'name':{'type':Sequelize[_0xaf58('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaf58('0x1')],'unique':_0xaf58('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xaf58('0x1')]},'clientId':{'type':Sequelize[_0xaf58('0x1')]},'clientSecret':{'type':Sequelize[_0xaf58('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xaf58('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaf58('0x3'),_0xaf58('0x4')),'defaultValue':_0xaf58('0x3')}}; \ No newline at end of file +var _0xe651=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x3dfea6,_0x5cd685){var _0x567aca=function(_0x100a5f){while(--_0x100a5f){_0x3dfea6['push'](_0x3dfea6['shift']());}};_0x567aca(++_0x5cd685);}(_0xe651,0x1a5));var _0x1e65=function(_0x278f0e,_0x107e6e){_0x278f0e=_0x278f0e-0x0;var _0x5b8c27=_0xe651[_0x278f0e];return _0x5b8c27;};'use strict';var Sequelize=require(_0x1e65('0x0'));module[_0x1e65('0x1')]={'name':{'type':Sequelize[_0x1e65('0x2')]},'description':{'type':Sequelize[_0x1e65('0x2')]},'username':{'type':Sequelize[_0x1e65('0x2')],'unique':_0x1e65('0x3')},'remoteUri':{'type':Sequelize[_0x1e65('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1e65('0x2')]},'clientSecret':{'type':Sequelize[_0x1e65('0x2')]},'securityToken':{'type':Sequelize[_0x1e65('0x2')]},'serverUrl':{'type':Sequelize[_0x1e65('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1e65('0x4')]('integrationTab','newTab'),'defaultValue':_0x1e65('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5202b43..b5a3082 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 _0x8e81=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','find','create','body','params','destroy','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','getSubjects','channel','Descriptions','SalesforceField','Task','remoteUri','slice','Connection','clientSecret','login','username','password','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x5af741,_0x24c232){var _0x421bda=function(_0x2cacb8){while(--_0x2cacb8){_0x5af741['push'](_0x5af741['shift']());}};_0x421bda(++_0x24c232);}(_0x8e81,0x1d0));var _0x18e8=function(_0x186972,_0x51b630){_0x186972=_0x186972-0x0;var _0x5987cb=_0x8e81[_0x186972];return _0x5987cb;};'use strict';var emlformat=require(_0x18e8('0x0'));var rimraf=require(_0x18e8('0x1'));var zipdir=require(_0x18e8('0x2'));var jsonpatch=require(_0x18e8('0x3'));var rp=require(_0x18e8('0x4'));var moment=require(_0x18e8('0x5'));var BPromise=require(_0x18e8('0x6'));var Mustache=require(_0x18e8('0x7'));var util=require(_0x18e8('0x8'));var path=require(_0x18e8('0x9'));var sox=require(_0x18e8('0xa'));var csv=require(_0x18e8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18e8('0xc'));var _=require(_0x18e8('0xd'));var squel=require(_0x18e8('0xe'));var crypto=require(_0x18e8('0xf'));var jsforce=require(_0x18e8('0x10'));var deskjs=require(_0x18e8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x18e8('0x12'));var Papa=require(_0x18e8('0x13'));var Redis=require(_0x18e8('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x18e8('0x15'));var hardwareService=require(_0x18e8('0x16'));var logger=require(_0x18e8('0x17'))(_0x18e8('0x18'));var utils=require(_0x18e8('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x18e8('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3831a4,_0xe6acbf){_0xe6acbf=_0xe6acbf||0xcc;return function(_0x5bf69e){if(_0x5bf69e){return _0x3831a4[_0x18e8('0x1b')](_0xe6acbf);}return _0x3831a4[_0x18e8('0x1c')](_0xe6acbf)[_0x18e8('0x1d')]();};}function respondWithResult(_0x3c9213,_0x11402f){_0x11402f=_0x11402f||0xc8;return function(_0x2f1deb){if(_0x2f1deb){return _0x3c9213['status'](_0x11402f)[_0x18e8('0x1e')](_0x2f1deb);}};}function respondWithFilteredResult(_0x35ca57,_0x577760){return function(_0x2d7089){if(_0x2d7089){var _0x1cb649=typeof _0x577760['offset']===_0x18e8('0x1f')&&typeof _0x577760[_0x18e8('0x20')]==='undefined';var _0x3745e7=_0x2d7089[_0x18e8('0x21')];var _0x3bc271=_0x1cb649?0x0:_0x577760[_0x18e8('0x22')];var _0xf88e0d=_0x1cb649?_0x2d7089[_0x18e8('0x21')]:_0x577760[_0x18e8('0x22')]+_0x577760['limit'];var _0x3b5c1f;if(_0xf88e0d>=_0x3745e7){_0xf88e0d=_0x3745e7;_0x3b5c1f=0xc8;}else{_0x3b5c1f=0xce;}_0x35ca57[_0x18e8('0x1c')](_0x3b5c1f);return _0x35ca57[_0x18e8('0x23')](_0x18e8('0x24'),_0x3bc271+'-'+_0xf88e0d+'/'+_0x3745e7)['json'](_0x2d7089);}return null;};}function patchUpdates(_0x227f8d){return function(_0x21d060){try{jsonpatch[_0x18e8('0x25')](_0x21d060,_0x227f8d,!![]);}catch(_0x2c34cb){return BPromise[_0x18e8('0x26')](_0x2c34cb);}return _0x21d060['save']();};}function saveUpdates(_0x5bfade,_0x501b98){return function(_0x203990){if(_0x203990){return _0x203990[_0x18e8('0x27')](_0x5bfade)[_0x18e8('0x28')](function(_0x5b64fd){return _0x5b64fd;});}return null;};}function removeEntity(_0x3f0830,_0x4d935b){return function(_0x7127fa){if(_0x7127fa){return _0x7127fa['destroy']()[_0x18e8('0x28')](function(){_0x3f0830[_0x18e8('0x1c')](0xcc)[_0x18e8('0x1d')]();});}};}function handleEntityNotFound(_0x184c9b,_0x26c276){return function(_0x21948b){if(!_0x21948b){_0x184c9b[_0x18e8('0x1b')](0x194);}return _0x21948b;};}function handleError(_0x18f4e0,_0x1f3158){_0x1f3158=_0x1f3158||0x1f4;return function(_0x3857c1){logger[_0x18e8('0x29')](_0x3857c1['stack']);if(_0x3857c1[_0x18e8('0x2a')]){delete _0x3857c1[_0x18e8('0x2a')];}_0x18f4e0[_0x18e8('0x1c')](_0x1f3158)[_0x18e8('0x2b')](_0x3857c1);};}exports[_0x18e8('0x2c')]=function(_0x506f1c,_0x1764c0){var _0x5023c8={},_0x51184a={},_0x5cab16={'count':0x0,'rows':[]};var _0x556a6a=_[_0x18e8('0x2d')](db[_0x18e8('0x2e')][_0x18e8('0x2f')],function(_0x261e06){return{'name':_0x261e06[_0x18e8('0x30')],'type':_0x261e06[_0x18e8('0x31')]['key']};});_0x51184a[_0x18e8('0x32')]=_[_0x18e8('0x2d')](_0x556a6a,_0x18e8('0x2a'));_0x51184a[_0x18e8('0x33')]=_['keys'](_0x506f1c[_0x18e8('0x33')]);_0x51184a[_0x18e8('0x34')]=_[_0x18e8('0x35')](_0x51184a[_0x18e8('0x32')],_0x51184a[_0x18e8('0x33')]);_0x5023c8['attributes']=_[_0x18e8('0x35')](_0x51184a['model'],qs[_0x18e8('0x36')](_0x506f1c[_0x18e8('0x33')]['fields']));_0x5023c8['attributes']=_0x5023c8[_0x18e8('0x37')][_0x18e8('0x38')]?_0x5023c8[_0x18e8('0x37')]:_0x51184a[_0x18e8('0x32')];if(!_0x506f1c[_0x18e8('0x33')]['hasOwnProperty'](_0x18e8('0x39'))){_0x5023c8[_0x18e8('0x20')]=qs[_0x18e8('0x20')](_0x506f1c['query'][_0x18e8('0x20')]);_0x5023c8[_0x18e8('0x22')]=qs['offset'](_0x506f1c[_0x18e8('0x33')][_0x18e8('0x22')]);}_0x5023c8[_0x18e8('0x3a')]=qs[_0x18e8('0x3b')](_0x506f1c['query'][_0x18e8('0x3b')]);_0x5023c8[_0x18e8('0x3c')]=qs[_0x18e8('0x34')](_[_0x18e8('0x3d')](_0x506f1c[_0x18e8('0x33')],_0x51184a[_0x18e8('0x34')]),_0x556a6a);if(_0x506f1c[_0x18e8('0x33')][_0x18e8('0x3e')]){_0x5023c8[_0x18e8('0x3c')]=_[_0x18e8('0x3f')](_0x5023c8[_0x18e8('0x3c')],{'$or':_[_0x18e8('0x2d')](_0x556a6a,function(_0x4cf3d9){if(_0x4cf3d9[_0x18e8('0x31')]!==_0x18e8('0x40')){var _0x1a2d9f={};_0x1a2d9f[_0x4cf3d9[_0x18e8('0x2a')]]={'$like':'%'+_0x506f1c['query'][_0x18e8('0x3e')]+'%'};return _0x1a2d9f;}})});}_0x5023c8=_[_0x18e8('0x3f')]({},_0x5023c8,_0x506f1c[_0x18e8('0x41')]);var _0x3d7859={'where':_0x5023c8[_0x18e8('0x3c')]};return db[_0x18e8('0x2e')][_0x18e8('0x21')](_0x3d7859)['then'](function(_0x386f9f){_0x5cab16[_0x18e8('0x21')]=_0x386f9f;if(_0x506f1c[_0x18e8('0x33')][_0x18e8('0x42')]){_0x5023c8[_0x18e8('0x43')]=[{'all':!![]}];}return db[_0x18e8('0x2e')][_0x18e8('0x44')](_0x5023c8);})[_0x18e8('0x28')](function(_0x2b4a5f){_0x5cab16['rows']=_0x2b4a5f;return _0x5cab16;})[_0x18e8('0x28')](respondWithFilteredResult(_0x1764c0,_0x5023c8))[_0x18e8('0x45')](handleError(_0x1764c0,null));};exports['show']=function(_0x2865e0,_0x5e7ac0){var _0x22fbfa={'raw':![],'where':{'id':_0x2865e0['params']['id']}},_0x41112d={};_0x41112d[_0x18e8('0x32')]=_[_0x18e8('0x46')](db[_0x18e8('0x2e')][_0x18e8('0x2f')]);_0x41112d[_0x18e8('0x33')]=_[_0x18e8('0x46')](_0x2865e0[_0x18e8('0x33')]);_0x41112d['filters']=_['intersection'](_0x41112d[_0x18e8('0x32')],_0x41112d[_0x18e8('0x33')]);_0x22fbfa[_0x18e8('0x37')]=_[_0x18e8('0x35')](_0x41112d['model'],qs['fields'](_0x2865e0[_0x18e8('0x33')]['fields']));_0x22fbfa[_0x18e8('0x37')]=_0x22fbfa['attributes'][_0x18e8('0x38')]?_0x22fbfa['attributes']:_0x41112d[_0x18e8('0x32')];if(_0x2865e0[_0x18e8('0x33')]['includeAll']){_0x22fbfa[_0x18e8('0x43')]=[{'all':!![]}];}_0x22fbfa=_[_0x18e8('0x3f')]({},_0x22fbfa,_0x2865e0[_0x18e8('0x41')]);return db[_0x18e8('0x2e')][_0x18e8('0x47')](_0x22fbfa)['then'](handleEntityNotFound(_0x5e7ac0,null))[_0x18e8('0x28')](respondWithResult(_0x5e7ac0,null))['catch'](handleError(_0x5e7ac0,null));};exports[_0x18e8('0x48')]=function(_0x1322a5,_0x521c47){return db[_0x18e8('0x2e')][_0x18e8('0x48')](_0x1322a5[_0x18e8('0x49')],{})[_0x18e8('0x28')](respondWithResult(_0x521c47,0xc9))['catch'](handleError(_0x521c47,null));};exports[_0x18e8('0x27')]=function(_0x13762f,_0xb8cba2){if(_0x13762f[_0x18e8('0x49')]['id']){delete _0x13762f[_0x18e8('0x49')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x13762f[_0x18e8('0x4a')]['id']}})[_0x18e8('0x28')](handleEntityNotFound(_0xb8cba2,null))['then'](saveUpdates(_0x13762f['body'],null))[_0x18e8('0x28')](respondWithResult(_0xb8cba2,null))['catch'](handleError(_0xb8cba2,null));};exports[_0x18e8('0x4b')]=function(_0x61c8b8,_0x24abfe){return db[_0x18e8('0x2e')][_0x18e8('0x47')]({'where':{'id':_0x61c8b8[_0x18e8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24abfe,null))[_0x18e8('0x28')](removeEntity(_0x24abfe,null))[_0x18e8('0x45')](handleError(_0x24abfe,null));};exports[_0x18e8('0x4c')]=function(_0x2b7a0a,_0x2d3abc,_0x2c05f8){var _0x19a2d0={};var _0x171114={};var _0x43cf76;var _0x5c6d19;return db['SalesforceAccount']['findOne']({'where':{'id':_0x2b7a0a[_0x18e8('0x4a')]['id']}})[_0x18e8('0x28')](handleEntityNotFound(_0x2d3abc,null))[_0x18e8('0x28')](function(_0x486a88){if(_0x486a88){_0x43cf76=_0x486a88;_0x171114[_0x18e8('0x32')]=_[_0x18e8('0x46')](db[_0x18e8('0x4d')][_0x18e8('0x2f')]);_0x171114[_0x18e8('0x33')]=_[_0x18e8('0x46')](_0x2b7a0a['query']);_0x171114['filters']=_['intersection'](_0x171114[_0x18e8('0x32')],_0x171114[_0x18e8('0x33')]);_0x19a2d0[_0x18e8('0x37')]=_['intersection'](_0x171114[_0x18e8('0x32')],qs[_0x18e8('0x36')](_0x2b7a0a['query'][_0x18e8('0x36')]));_0x19a2d0['attributes']=_0x19a2d0[_0x18e8('0x37')][_0x18e8('0x38')]?_0x19a2d0[_0x18e8('0x37')]:_0x171114[_0x18e8('0x32')];_0x19a2d0[_0x18e8('0x3a')]=qs['sort'](_0x2b7a0a[_0x18e8('0x33')]['sort']);_0x19a2d0[_0x18e8('0x3c')]=qs[_0x18e8('0x34')](_['pick'](_0x2b7a0a[_0x18e8('0x33')],_0x171114['filters']));if(_0x2b7a0a['query'][_0x18e8('0x3e')]){_0x19a2d0[_0x18e8('0x3c')]=_['merge'](_0x19a2d0['where'],{'$or':_[_0x18e8('0x2d')](_0x19a2d0['attributes'],function(_0x17cf1e){var _0x597c4e={};_0x597c4e[_0x17cf1e]={'$like':'%'+_0x2b7a0a['query'][_0x18e8('0x3e')]+'%'};return _0x597c4e;})});}_0x19a2d0=_[_0x18e8('0x3f')]({},_0x19a2d0,_0x2b7a0a['options']);return _0x43cf76[_0x18e8('0x4c')](_0x19a2d0);}})['then'](function(_0x4d3fc9){if(_0x4d3fc9){_0x5c6d19=_0x4d3fc9[_0x18e8('0x38')];if(!_0x2b7a0a[_0x18e8('0x33')][_0x18e8('0x4e')](_0x18e8('0x39'))){_0x19a2d0['limit']=qs['limit'](_0x2b7a0a[_0x18e8('0x33')][_0x18e8('0x20')]);_0x19a2d0[_0x18e8('0x22')]=qs['offset'](_0x2b7a0a[_0x18e8('0x33')][_0x18e8('0x22')]);}return _0x43cf76[_0x18e8('0x4c')](_0x19a2d0);}})[_0x18e8('0x28')](function(_0x269d2a){if(_0x269d2a){return _0x269d2a?{'count':_0x5c6d19,'rows':_0x269d2a}:null;}})[_0x18e8('0x28')](respondWithResult(_0x2d3abc,null))['catch'](handleError(_0x2d3abc,null));};exports[_0x18e8('0x4f')]=function(_0x475cd7,_0x6e94f4,_0x1522e3){if(_0x475cd7['body']['id']){delete _0x475cd7['body']['id'];}return db[_0x18e8('0x2e')][_0x18e8('0x50')]({'where':{'id':_0x475cd7[_0x18e8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6e94f4,null))[_0x18e8('0x28')](function(_0x3a05e8){if(_0x3a05e8){_0x475cd7[_0x18e8('0x49')]['AccountId']=_0x3a05e8['id'];_0x475cd7[_0x18e8('0x49')]['Subjects']=integrations[_0x18e8('0x51')](_0x475cd7[_0x18e8('0x49')][_0x18e8('0x52')],_0x475cd7[_0x18e8('0x49')][_0x18e8('0x31')]);_0x475cd7['body'][_0x18e8('0x53')]=integrations['getDescriptions'](_0x475cd7['body']['channel'],_0x475cd7[_0x18e8('0x49')][_0x18e8('0x31')]);return db[_0x18e8('0x4d')][_0x18e8('0x48')](_0x475cd7['body'],{'include':[{'model':db[_0x18e8('0x54')],'as':'Subjects'},{'model':db[_0x18e8('0x54')],'as':'Descriptions'}]});}return null;})[_0x18e8('0x28')](respondWithResult(_0x6e94f4,null))['catch'](handleError(_0x6e94f4,null));};exports['getFields']=function(_0x41facd,_0x559d17,_0x5abe87){var _0x5230e4;var _0xb2d654='';var _0x25a2da=_0x18e8('0x55');return db[_0x18e8('0x2e')]['findOne']({'where':{'id':_0x41facd['params']['id']},'attributes':['id','remoteUri','clientId','clientSecret','username','password','securityToken']})[_0x18e8('0x28')](handleEntityNotFound(_0x559d17,null))['then'](function(_0x3f45f4){if(_0x3f45f4){_0xb2d654=_0x3f45f4[_0x18e8('0x56')];var _0x210fc2=_0xb2d654[_0x18e8('0x57')](-0x1);if(_0x210fc2==='/'){_0xb2d654=_0xb2d654['substring'](0x0,_0xb2d654['lastIndexOf'](_0x210fc2));}_0x5230e4=new jsforce[(_0x18e8('0x58'))]({'oauth2':{'loginUrl':_0xb2d654,'clientId':_0x3f45f4['clientId'],'clientSecret':_0x3f45f4[_0x18e8('0x59')]}});return _0x5230e4[_0x18e8('0x5a')](_0x3f45f4[_0x18e8('0x5b')],_0x3f45f4[_0x18e8('0x5c')]['concat'](_0x3f45f4[_0x18e8('0x5d')]));}})[_0x18e8('0x28')](function(_0x917284){if(_0x917284){if(!_[_0x18e8('0x5e')](_0x41facd[_0x18e8('0x33')][_0x18e8('0x5f')])){_0x25a2da=_0x41facd[_0x18e8('0x33')][_0x18e8('0x5f')];}return _0x5230e4[_0x18e8('0x60')](_0x25a2da)['describe']();}})[_0x18e8('0x28')](function(_0x29940b){var _0x50e9c1=[_0x18e8('0x61'),_0x18e8('0x62'),_0x18e8('0x63'),'IsRecurrence',_0x18e8('0x64'),_0x18e8('0x65')];var _0x263f4b=[_0x18e8('0x66'),_0x18e8('0x67'),_0x18e8('0x68'),_0x18e8('0x69'),'email',_0x18e8('0x6a'),_0x18e8('0x6b')];if(_0x29940b){_[_0x18e8('0x6c')](_0x29940b[_0x18e8('0x36')],function(_0x12dced){return _0x50e9c1[_0x18e8('0x6d')](_0x12dced[_0x18e8('0x2a')])||!_0x263f4b[_0x18e8('0x6d')](_0x12dced['type']);});return{'count':_0x29940b[_0x18e8('0x36')][_0x18e8('0x38')],'rows':_[_0x18e8('0x2d')](_0x29940b['fields'],function(_0x5dfd9a){return{'id':_0x5dfd9a[_0x18e8('0x2a')],'name':_0x5dfd9a[_0x18e8('0x6e')],'custom':_0x5dfd9a[_0x18e8('0x6f')],'options':_0x5dfd9a[_0x18e8('0x70')][_0x18e8('0x38')]>0x0?_[_0x18e8('0x2d')](_0x5dfd9a[_0x18e8('0x70')],function(_0x25c227){return{'name':_0x25c227[_0x18e8('0x6e')],'value':_0x25c227[_0x18e8('0x71')]};}):_0x5dfd9a['type']==_0x18e8('0x69')?[{'name':'True','value':_0x18e8('0x72')},{'name':_0x18e8('0x73'),'value':_0x18e8('0x74')}]:[]};})};}})[_0x18e8('0x28')](respondWithResult(_0x559d17,null))[_0x18e8('0x45')](function(_0x2448ed){var _0x26d8e1=_0x41facd[_0x18e8('0x33')]['test']?0x1f4:_0x2448ed[_0x18e8('0x75')]||0x1f4;logger[_0x18e8('0x29')](_0x18e8('0x76'),_0x18e8('0x77'),_0x26d8e1,JSON[_0x18e8('0x78')](_0x2448ed));delete _0x2448ed[_0x18e8('0x2a')];if(_0x26d8e1===0x191){_0x26d8e1=0x190;}_0x559d17[_0x18e8('0x1c')](_0x26d8e1)[_0x18e8('0x2b')](_0x41facd[_0x18e8('0x33')][_0x18e8('0x79')]?{'message':_0x18e8('0x7a'),'statusCode':_0x2448ed[_0x18e8('0x75')]}:_0x2448ed);});}; \ No newline at end of file +var _0x57e8=['phone','remove','includes','label','custom','picklistValues','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceAccount','fieldName','type','key','keys','query','filters','model','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getConfigurations','SalesforceConfiguration','rawAttributes','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','SalesforceField','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','Connection','login','username','concat','isNil','ticketType','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email'];(function(_0x7ff50b,_0x399dc0){var _0x43e570=function(_0x16b092){while(--_0x16b092){_0x7ff50b['push'](_0x7ff50b['shift']());}};_0x43e570(++_0x399dc0);}(_0x57e8,0x85));var _0x857e=function(_0x40e561,_0x2d2315){_0x40e561=_0x40e561-0x0;var _0x5074b7=_0x57e8[_0x40e561];return _0x5074b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857e('0x0'));var zipdir=require(_0x857e('0x1'));var jsonpatch=require(_0x857e('0x2'));var rp=require(_0x857e('0x3'));var moment=require(_0x857e('0x4'));var BPromise=require(_0x857e('0x5'));var Mustache=require(_0x857e('0x6'));var util=require(_0x857e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x857e('0x8'));var ejs=require(_0x857e('0x9'));var fs=require('fs');var fs_extra=require(_0x857e('0xa'));var _=require('lodash');var squel=require(_0x857e('0xb'));var crypto=require('crypto');var jsforce=require(_0x857e('0xc'));var deskjs=require(_0x857e('0xd'));var toCsv=require(_0x857e('0x8'));var querystring=require(_0x857e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x857e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857e('0x10'));var logger=require('../../config/logger')(_0x857e('0x11'));var utils=require(_0x857e('0x12'));var config=require(_0x857e('0x13'));var licenseUtil=require(_0x857e('0x14'));var db=require(_0x857e('0x15'))['db'];var integrations=require(_0x857e('0x16'));function respondWithStatusCode(_0x59537b,_0x1f89d2){_0x1f89d2=_0x1f89d2||0xcc;return function(_0x531e6f){if(_0x531e6f){return _0x59537b[_0x857e('0x17')](_0x1f89d2);}return _0x59537b[_0x857e('0x18')](_0x1f89d2)[_0x857e('0x19')]();};}function respondWithResult(_0x2308c1,_0x3c2bc7){_0x3c2bc7=_0x3c2bc7||0xc8;return function(_0x56c8c9){if(_0x56c8c9){return _0x2308c1['status'](_0x3c2bc7)['json'](_0x56c8c9);}};}function respondWithFilteredResult(_0x5ad693,_0x97d81a){return function(_0x3a16a0){if(_0x3a16a0){var _0x24d427=typeof _0x97d81a[_0x857e('0x1a')]===_0x857e('0x1b')&&typeof _0x97d81a['limit']===_0x857e('0x1b');var _0x401a3e=_0x3a16a0[_0x857e('0x1c')];var _0x5efa6e=_0x24d427?0x0:_0x97d81a[_0x857e('0x1a')];var _0x97fc29=_0x24d427?_0x3a16a0['count']:_0x97d81a[_0x857e('0x1a')]+_0x97d81a[_0x857e('0x1d')];var _0x604865;if(_0x97fc29>=_0x401a3e){_0x97fc29=_0x401a3e;_0x604865=0xc8;}else{_0x604865=0xce;}_0x5ad693[_0x857e('0x18')](_0x604865);return _0x5ad693[_0x857e('0x1e')](_0x857e('0x1f'),_0x5efa6e+'-'+_0x97fc29+'/'+_0x401a3e)[_0x857e('0x20')](_0x3a16a0);}return null;};}function patchUpdates(_0x5b4534){return function(_0x58f99a){try{jsonpatch[_0x857e('0x21')](_0x58f99a,_0x5b4534,!![]);}catch(_0x6881e4){return BPromise[_0x857e('0x22')](_0x6881e4);}return _0x58f99a[_0x857e('0x23')]();};}function saveUpdates(_0x29940d,_0x23ce58){return function(_0x5d48ff){if(_0x5d48ff){return _0x5d48ff['update'](_0x29940d)[_0x857e('0x24')](function(_0x3d6b7c){return _0x3d6b7c;});}return null;};}function removeEntity(_0x3fef46,_0x420a98){return function(_0x1c7d35){if(_0x1c7d35){return _0x1c7d35[_0x857e('0x25')]()['then'](function(){_0x3fef46['status'](0xcc)[_0x857e('0x19')]();});}};}function handleEntityNotFound(_0xba1b9,_0x161311){return function(_0x53aabb){if(!_0x53aabb){_0xba1b9['sendStatus'](0x194);}return _0x53aabb;};}function handleError(_0x2655a9,_0x1dc09b){_0x1dc09b=_0x1dc09b||0x1f4;return function(_0x446436){logger[_0x857e('0x26')](_0x446436[_0x857e('0x27')]);if(_0x446436[_0x857e('0x28')]){delete _0x446436['name'];}_0x2655a9[_0x857e('0x18')](_0x1dc09b)[_0x857e('0x29')](_0x446436);};}exports['index']=function(_0xcd01e9,_0x29dee2){var _0x22f5b2={},_0x3ef240={},_0x272b40={'count':0x0,'rows':[]};var _0x3c094d=_[_0x857e('0x2a')](db[_0x857e('0x2b')]['rawAttributes'],function(_0x1eaf30){return{'name':_0x1eaf30[_0x857e('0x2c')],'type':_0x1eaf30[_0x857e('0x2d')][_0x857e('0x2e')]};});_0x3ef240['model']=_[_0x857e('0x2a')](_0x3c094d,_0x857e('0x28'));_0x3ef240['query']=_[_0x857e('0x2f')](_0xcd01e9[_0x857e('0x30')]);_0x3ef240[_0x857e('0x31')]=_['intersection'](_0x3ef240[_0x857e('0x32')],_0x3ef240[_0x857e('0x30')]);_0x22f5b2['attributes']=_[_0x857e('0x33')](_0x3ef240[_0x857e('0x32')],qs[_0x857e('0x34')](_0xcd01e9['query'][_0x857e('0x34')]));_0x22f5b2['attributes']=_0x22f5b2['attributes'][_0x857e('0x35')]?_0x22f5b2[_0x857e('0x36')]:_0x3ef240['model'];if(!_0xcd01e9[_0x857e('0x30')]['hasOwnProperty'](_0x857e('0x37'))){_0x22f5b2[_0x857e('0x1d')]=qs['limit'](_0xcd01e9[_0x857e('0x30')][_0x857e('0x1d')]);_0x22f5b2[_0x857e('0x1a')]=qs[_0x857e('0x1a')](_0xcd01e9['query']['offset']);}_0x22f5b2[_0x857e('0x38')]=qs[_0x857e('0x39')](_0xcd01e9['query'][_0x857e('0x39')]);_0x22f5b2[_0x857e('0x3a')]=qs[_0x857e('0x31')](_[_0x857e('0x3b')](_0xcd01e9['query'],_0x3ef240['filters']),_0x3c094d);if(_0xcd01e9[_0x857e('0x30')][_0x857e('0x3c')]){_0x22f5b2[_0x857e('0x3a')]=_[_0x857e('0x3d')](_0x22f5b2[_0x857e('0x3a')],{'$or':_[_0x857e('0x2a')](_0x3c094d,function(_0x4d5732){if(_0x4d5732[_0x857e('0x2d')]!==_0x857e('0x3e')){var _0x5dfaea={};_0x5dfaea[_0x4d5732[_0x857e('0x28')]]={'$like':'%'+_0xcd01e9[_0x857e('0x30')][_0x857e('0x3c')]+'%'};return _0x5dfaea;}})});}_0x22f5b2=_[_0x857e('0x3d')]({},_0x22f5b2,_0xcd01e9[_0x857e('0x3f')]);var _0x144747={'where':_0x22f5b2[_0x857e('0x3a')]};return db[_0x857e('0x2b')]['count'](_0x144747)[_0x857e('0x24')](function(_0x54a072){_0x272b40[_0x857e('0x1c')]=_0x54a072;if(_0xcd01e9[_0x857e('0x30')][_0x857e('0x40')]){_0x22f5b2[_0x857e('0x41')]=[{'all':!![]}];}return db[_0x857e('0x2b')]['findAll'](_0x22f5b2);})[_0x857e('0x24')](function(_0x13f1b9){_0x272b40[_0x857e('0x42')]=_0x13f1b9;return _0x272b40;})[_0x857e('0x24')](respondWithFilteredResult(_0x29dee2,_0x22f5b2))[_0x857e('0x43')](handleError(_0x29dee2,null));};exports[_0x857e('0x44')]=function(_0xf7dbcc,_0x407ff1){var _0x524634={'raw':![],'where':{'id':_0xf7dbcc[_0x857e('0x45')]['id']}},_0x357dcd={};_0x357dcd[_0x857e('0x32')]=_['keys'](db[_0x857e('0x2b')]['rawAttributes']);_0x357dcd[_0x857e('0x30')]=_[_0x857e('0x2f')](_0xf7dbcc[_0x857e('0x30')]);_0x357dcd['filters']=_[_0x857e('0x33')](_0x357dcd[_0x857e('0x32')],_0x357dcd[_0x857e('0x30')]);_0x524634[_0x857e('0x36')]=_[_0x857e('0x33')](_0x357dcd[_0x857e('0x32')],qs[_0x857e('0x34')](_0xf7dbcc['query'][_0x857e('0x34')]));_0x524634[_0x857e('0x36')]=_0x524634[_0x857e('0x36')][_0x857e('0x35')]?_0x524634[_0x857e('0x36')]:_0x357dcd['model'];if(_0xf7dbcc['query']['includeAll']){_0x524634[_0x857e('0x41')]=[{'all':!![]}];}_0x524634=_[_0x857e('0x3d')]({},_0x524634,_0xf7dbcc[_0x857e('0x3f')]);return db[_0x857e('0x2b')][_0x857e('0x46')](_0x524634)[_0x857e('0x24')](handleEntityNotFound(_0x407ff1,null))['then'](respondWithResult(_0x407ff1,null))[_0x857e('0x43')](handleError(_0x407ff1,null));};exports[_0x857e('0x47')]=function(_0x4966d1,_0x4cd4a8){return db[_0x857e('0x2b')][_0x857e('0x47')](_0x4966d1[_0x857e('0x48')],{})[_0x857e('0x24')](respondWithResult(_0x4cd4a8,0xc9))['catch'](handleError(_0x4cd4a8,null));};exports[_0x857e('0x49')]=function(_0x3710f7,_0x3e3078){if(_0x3710f7['body']['id']){delete _0x3710f7[_0x857e('0x48')]['id'];}return db[_0x857e('0x2b')][_0x857e('0x46')]({'where':{'id':_0x3710f7[_0x857e('0x45')]['id']}})[_0x857e('0x24')](handleEntityNotFound(_0x3e3078,null))['then'](saveUpdates(_0x3710f7['body'],null))['then'](respondWithResult(_0x3e3078,null))[_0x857e('0x43')](handleError(_0x3e3078,null));};exports[_0x857e('0x25')]=function(_0xbaca46,_0x52568f){return db['SalesforceAccount'][_0x857e('0x46')]({'where':{'id':_0xbaca46[_0x857e('0x45')]['id']}})['then'](handleEntityNotFound(_0x52568f,null))[_0x857e('0x24')](removeEntity(_0x52568f,null))[_0x857e('0x43')](handleError(_0x52568f,null));};exports[_0x857e('0x4a')]=function(_0x170200,_0x34f952,_0x29fafb){var _0x3f621c={};var _0x43c24c={};var _0x19ed88;var _0x1b9630;return db[_0x857e('0x2b')]['findOne']({'where':{'id':_0x170200['params']['id']}})['then'](handleEntityNotFound(_0x34f952,null))[_0x857e('0x24')](function(_0x3c3016){if(_0x3c3016){_0x19ed88=_0x3c3016;_0x43c24c['model']=_['keys'](db[_0x857e('0x4b')][_0x857e('0x4c')]);_0x43c24c[_0x857e('0x30')]=_[_0x857e('0x2f')](_0x170200[_0x857e('0x30')]);_0x43c24c[_0x857e('0x31')]=_[_0x857e('0x33')](_0x43c24c['model'],_0x43c24c[_0x857e('0x30')]);_0x3f621c[_0x857e('0x36')]=_[_0x857e('0x33')](_0x43c24c['model'],qs[_0x857e('0x34')](_0x170200['query'][_0x857e('0x34')]));_0x3f621c[_0x857e('0x36')]=_0x3f621c[_0x857e('0x36')][_0x857e('0x35')]?_0x3f621c[_0x857e('0x36')]:_0x43c24c[_0x857e('0x32')];_0x3f621c['order']=qs[_0x857e('0x39')](_0x170200[_0x857e('0x30')][_0x857e('0x39')]);_0x3f621c[_0x857e('0x3a')]=qs[_0x857e('0x31')](_['pick'](_0x170200['query'],_0x43c24c['filters']));if(_0x170200[_0x857e('0x30')][_0x857e('0x3c')]){_0x3f621c['where']=_[_0x857e('0x3d')](_0x3f621c[_0x857e('0x3a')],{'$or':_[_0x857e('0x2a')](_0x3f621c['attributes'],function(_0x365315){var _0x391371={};_0x391371[_0x365315]={'$like':'%'+_0x170200['query'][_0x857e('0x3c')]+'%'};return _0x391371;})});}_0x3f621c=_[_0x857e('0x3d')]({},_0x3f621c,_0x170200[_0x857e('0x3f')]);return _0x19ed88['getConfigurations'](_0x3f621c);}})[_0x857e('0x24')](function(_0x655ce1){if(_0x655ce1){_0x1b9630=_0x655ce1['length'];if(!_0x170200[_0x857e('0x30')][_0x857e('0x4d')](_0x857e('0x37'))){_0x3f621c['limit']=qs[_0x857e('0x1d')](_0x170200[_0x857e('0x30')]['limit']);_0x3f621c[_0x857e('0x1a')]=qs[_0x857e('0x1a')](_0x170200['query'][_0x857e('0x1a')]);}return _0x19ed88['getConfigurations'](_0x3f621c);}})['then'](function(_0x2070c8){if(_0x2070c8){return _0x2070c8?{'count':_0x1b9630,'rows':_0x2070c8}:null;}})['then'](respondWithResult(_0x34f952,null))[_0x857e('0x43')](handleError(_0x34f952,null));};exports[_0x857e('0x4e')]=function(_0x46632a,_0x4f5d02,_0x51abc0){if(_0x46632a[_0x857e('0x48')]['id']){delete _0x46632a[_0x857e('0x48')]['id'];}return db[_0x857e('0x2b')][_0x857e('0x4f')]({'where':{'id':_0x46632a[_0x857e('0x45')]['id']}})[_0x857e('0x24')](handleEntityNotFound(_0x4f5d02,null))[_0x857e('0x24')](function(_0x6bd7ed){if(_0x6bd7ed){_0x46632a[_0x857e('0x48')][_0x857e('0x50')]=_0x6bd7ed['id'];_0x46632a['body']['Subjects']=integrations[_0x857e('0x51')](_0x46632a[_0x857e('0x48')]['channel'],_0x46632a['body'][_0x857e('0x2d')]);_0x46632a[_0x857e('0x48')][_0x857e('0x52')]=integrations[_0x857e('0x53')](_0x46632a['body']['channel'],_0x46632a['body']['type']);return db['SalesforceConfiguration'][_0x857e('0x47')](_0x46632a[_0x857e('0x48')],{'include':[{'model':db['SalesforceField'],'as':_0x857e('0x54')},{'model':db[_0x857e('0x55')],'as':_0x857e('0x52')}]});}return null;})[_0x857e('0x24')](respondWithResult(_0x4f5d02,null))['catch'](handleError(_0x4f5d02,null));};exports['getFields']=function(_0x1d9cc1,_0x381dbb,_0x498363){var _0x49fafc;var _0x47857d='';var _0x20ef04=_0x857e('0x56');return db[_0x857e('0x2b')][_0x857e('0x4f')]({'where':{'id':_0x1d9cc1[_0x857e('0x45')]['id']},'attributes':['id',_0x857e('0x57'),_0x857e('0x58'),_0x857e('0x59'),'username',_0x857e('0x5a'),_0x857e('0x5b')]})[_0x857e('0x24')](handleEntityNotFound(_0x381dbb,null))[_0x857e('0x24')](function(_0x3217a7){if(_0x3217a7){_0x47857d=_0x3217a7[_0x857e('0x57')];var _0x3bb118=_0x47857d[_0x857e('0x5c')](-0x1);if(_0x3bb118==='/'){_0x47857d=_0x47857d[_0x857e('0x5d')](0x0,_0x47857d['lastIndexOf'](_0x3bb118));}_0x49fafc=new jsforce[(_0x857e('0x5e'))]({'oauth2':{'loginUrl':_0x47857d,'clientId':_0x3217a7[_0x857e('0x58')],'clientSecret':_0x3217a7[_0x857e('0x59')]}});return _0x49fafc[_0x857e('0x5f')](_0x3217a7[_0x857e('0x60')],_0x3217a7['password'][_0x857e('0x61')](_0x3217a7[_0x857e('0x5b')]));}})[_0x857e('0x24')](function(_0x216969){if(_0x216969){if(!_[_0x857e('0x62')](_0x1d9cc1[_0x857e('0x30')][_0x857e('0x63')])){_0x20ef04=_0x1d9cc1[_0x857e('0x30')][_0x857e('0x63')];}return _0x49fafc['sobject'](_0x20ef04)['describe']();}})['then'](function(_0x5e5295){var _0x11598c=[_0x857e('0x64'),'ActivityDate',_0x857e('0x65'),_0x857e('0x66'),_0x857e('0x67'),_0x857e('0x68')];var _0x114911=[_0x857e('0x69'),'int',_0x857e('0x6a'),_0x857e('0x6b'),_0x857e('0x6c'),'textarea',_0x857e('0x6d')];if(_0x5e5295){_[_0x857e('0x6e')](_0x5e5295['fields'],function(_0x3c5a19){return _0x11598c[_0x857e('0x6f')](_0x3c5a19[_0x857e('0x28')])||!_0x114911[_0x857e('0x6f')](_0x3c5a19['type']);});return{'count':_0x5e5295[_0x857e('0x34')][_0x857e('0x35')],'rows':_[_0x857e('0x2a')](_0x5e5295[_0x857e('0x34')],function(_0x58f2bb){return{'id':_0x58f2bb[_0x857e('0x28')],'name':_0x58f2bb[_0x857e('0x70')],'custom':_0x58f2bb[_0x857e('0x71')],'options':_0x58f2bb[_0x857e('0x72')][_0x857e('0x35')]>0x0?_[_0x857e('0x2a')](_0x58f2bb['picklistValues'],function(_0x206d84){return{'name':_0x206d84[_0x857e('0x70')],'value':_0x206d84['value']};}):_0x58f2bb[_0x857e('0x2d')]==_0x857e('0x6b')?[{'name':'True','value':_0x857e('0x73')},{'name':_0x857e('0x74'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x381dbb,null))['catch'](function(_0x1cb0ca){var _0x371d43=_0x1d9cc1[_0x857e('0x30')]['test']?0x1f4:_0x1cb0ca[_0x857e('0x75')]||0x1f4;logger[_0x857e('0x26')](_0x857e('0x76'),_0x857e('0x77'),_0x371d43,JSON[_0x857e('0x78')](_0x1cb0ca));delete _0x1cb0ca[_0x857e('0x28')];if(_0x371d43===0x191){_0x371d43=0x190;}_0x381dbb['status'](_0x371d43)[_0x857e('0x29')](_0x1d9cc1[_0x857e('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1cb0ca[_0x857e('0x75')]}:_0x1cb0ca);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5ba3562..ae28fab 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 _0xefd6=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5ac5c7,_0x3e5ecd){var _0x1eede1=function(_0x128357){while(--_0x128357){_0x5ac5c7['push'](_0x5ac5c7['shift']());}};_0x1eede1(++_0x3e5ecd);}(_0xefd6,0x126));var _0x6efd=function(_0x63093e,_0x5e8f59){_0x63093e=_0x63093e-0x0;var _0x3ec285=_0xefd6[_0x63093e];return _0x3ec285;};'use strict';var _=require(_0x6efd('0x0'));var util=require(_0x6efd('0x1'));var logger=require(_0x6efd('0x2'))(_0x6efd('0x3'));var moment=require(_0x6efd('0x4'));var BPromise=require('bluebird');var rp=require(_0x6efd('0x5'));var fs=require('fs');var path=require(_0x6efd('0x6'));var rimraf=require(_0x6efd('0x7'));var config=require(_0x6efd('0x8'));var attributes=require(_0x6efd('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3b9894,_0x558f02){return _0x3b9894[_0x6efd('0xa')](_0x6efd('0xb'),attributes,{'tableName':_0x6efd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7623=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7623,0x80));var _0x3762=function(_0x437545,_0x4ab48b){_0x437545=_0x437545-0x0;var _0x408060=_0x7623[_0x437545];return _0x408060;};'use strict';var _=require(_0x3762('0x0'));var util=require(_0x3762('0x1'));var logger=require(_0x3762('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3762('0x3'));var rp=require(_0x3762('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3762('0x5'));var config=require(_0x3762('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x3762('0x7'));module[_0x3762('0x8')]=function(_0x446aac,_0x593672){return _0x446aac['define'](_0x3762('0x9'),attributes,{'tableName':_0x3762('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 d1ee9b5..3db1b11 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 _0x5a44=['raw','where','attributes','limit','include','model','map','then','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options'];(function(_0x2c9937,_0x1a4451){var _0x22ccf7=function(_0x519ae3){while(--_0x519ae3){_0x2c9937['push'](_0x2c9937['shift']());}};_0x22ccf7(++_0x1a4451);}(_0x5a44,0x122));var _0x45a4=function(_0x1a980a,_0x3da070){_0x1a980a=_0x1a980a-0x0;var _0x34371b=_0x5a44[_0x1a980a];return _0x34371b;};'use strict';var _=require(_0x45a4('0x0'));var util=require(_0x45a4('0x1'));var moment=require(_0x45a4('0x2'));var BPromise=require(_0x45a4('0x3'));var rs=require(_0x45a4('0x4'));var fs=require('fs');var Redis=require(_0x45a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x45a4('0x6'));var logger=require(_0x45a4('0x7'))(_0x45a4('0x8'));var config=require(_0x45a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x45a4('0xa')][_0x45a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6cb314,_0x5926e4,_0x10ccde){return new BPromise(function(_0x317882,_0x4078f3){return client[_0x45a4('0xc')](_0x6cb314,_0x10ccde)['then'](function(_0xdb7585){logger[_0x45a4('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x5926e4,_0x45a4('0xe'));logger[_0x45a4('0xf')](_0x45a4('0x10'),_0x5926e4,_0x45a4('0xe'),JSON['stringify'](_0xdb7585));if(_0xdb7585[_0x45a4('0x11')]){if(_0xdb7585['error']['code']===0x1f4){logger[_0x45a4('0x11')](_0x45a4('0x12'),_0x5926e4,_0xdb7585[_0x45a4('0x11')]['message']);return _0x4078f3(_0xdb7585[_0x45a4('0x11')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5926e4,_0xdb7585[_0x45a4('0x11')][_0x45a4('0x13')]);return _0x317882(_0xdb7585[_0x45a4('0x11')]['message']);}else{logger[_0x45a4('0xd')](_0x45a4('0x12'),_0x5926e4,_0x45a4('0xe'));_0x317882(_0xdb7585['result'][_0x45a4('0x13')]);}})[_0x45a4('0x14')](function(_0x23f98e){logger[_0x45a4('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x5926e4,_0x23f98e);_0x4078f3(_0x23f98e);});});}exports[_0x45a4('0x15')]=function(_0x525d7c){var _0x29902d=this;return new Promise(function(_0x1270d6,_0x2aacc1){return db[_0x45a4('0x16')][_0x45a4('0x17')]({'raw':_0x525d7c[_0x45a4('0x18')]?_0x525d7c[_0x45a4('0x18')][_0x45a4('0x19')]===undefined?!![]:![]:!![],'where':_0x525d7c[_0x45a4('0x18')]?_0x525d7c[_0x45a4('0x18')][_0x45a4('0x1a')]||null:null,'attributes':_0x525d7c['options']?_0x525d7c['options'][_0x45a4('0x1b')]||null:null,'limit':_0x525d7c[_0x45a4('0x18')]?_0x525d7c[_0x45a4('0x18')][_0x45a4('0x1c')]||null:null,'include':_0x525d7c[_0x45a4('0x18')]?_0x525d7c['options']['include']?_['map'](_0x525d7c['options'][_0x45a4('0x1d')],function(_0x3d789b){return{'model':db[_0x3d789b[_0x45a4('0x1e')]],'as':_0x3d789b['as'],'attributes':_0x3d789b[_0x45a4('0x1b')],'include':_0x3d789b[_0x45a4('0x1d')]?_[_0x45a4('0x1f')](_0x3d789b['include'],function(_0x34e81a){return{'model':db[_0x34e81a['model']],'as':_0x34e81a['as'],'attributes':_0x34e81a['attributes'],'include':_0x34e81a['include']?_[_0x45a4('0x1f')](_0x34e81a['include'],function(_0x19f697){return{'model':db[_0x19f697[_0x45a4('0x1e')]],'as':_0x19f697['as'],'attributes':_0x19f697[_0x45a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45a4('0x20')](function(_0x1ec48b){logger[_0x45a4('0xd')]('GetSalesforceAccount',_0x525d7c);logger[_0x45a4('0xf')]('GetSalesforceAccount',_0x525d7c,JSON['stringify'](_0x1ec48b));_0x1270d6(_0x1ec48b);})['catch'](function(_0x6e4247){logger[_0x45a4('0x11')](_0x45a4('0x15'),_0x6e4247['message'],_0x525d7c);_0x2aacc1(_0x29902d[_0x45a4('0x11')](0x1f4,_0x6e4247[_0x45a4('0x13')]));});});};exports[_0x45a4('0x21')]=function(_0x542f0f){var _0x4144a5=this;return new Promise(function(_0x1d0d37,_0x21b8c2){return db[_0x45a4('0x16')][_0x45a4('0x22')]({'raw':_0x542f0f[_0x45a4('0x18')]?_0x542f0f[_0x45a4('0x18')][_0x45a4('0x19')]===undefined?!![]:![]:!![],'where':_0x542f0f[_0x45a4('0x18')]?_0x542f0f[_0x45a4('0x18')][_0x45a4('0x1a')]||null:null,'attributes':_0x542f0f[_0x45a4('0x18')]?_0x542f0f['options'][_0x45a4('0x1b')]||null:null,'include':_0x542f0f[_0x45a4('0x18')]?_0x542f0f[_0x45a4('0x18')][_0x45a4('0x1d')]?_['map'](_0x542f0f[_0x45a4('0x18')][_0x45a4('0x1d')],function(_0x1d1509){return{'model':db[_0x1d1509['model']],'as':_0x1d1509['as'],'attributes':_0x1d1509[_0x45a4('0x1b')],'include':_0x1d1509[_0x45a4('0x1d')]?_[_0x45a4('0x1f')](_0x1d1509['include'],function(_0x4969e9){return{'model':db[_0x4969e9[_0x45a4('0x1e')]],'as':_0x4969e9['as'],'attributes':_0x4969e9[_0x45a4('0x1b')],'include':_0x4969e9['include']?_[_0x45a4('0x1f')](_0x4969e9[_0x45a4('0x1d')],function(_0x621a3d){return{'model':db[_0x621a3d[_0x45a4('0x1e')]],'as':_0x621a3d['as'],'attributes':_0x621a3d[_0x45a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45a4('0x20')](function(_0x3dcfa1){logger['info']('ShowSalesforceAccount',_0x542f0f);logger[_0x45a4('0xf')](_0x45a4('0x21'),_0x542f0f,JSON['stringify'](_0x3dcfa1));_0x1d0d37(_0x3dcfa1);})[_0x45a4('0x14')](function(_0xc570ab){logger[_0x45a4('0x11')](_0x45a4('0x21'),_0xc570ab['message'],_0x542f0f);_0x21b8c2(_0x4144a5[_0x45a4('0x11')](0x1f4,_0xc570ab['message']));});});}; \ No newline at end of file +var _0x07f8=['GetSalesforceAccount','ShowSalesforceAccount','raw','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x669efe,_0x3f4cba){var _0x56a23f=function(_0x1fed68){while(--_0x1fed68){_0x669efe['push'](_0x669efe['shift']());}};_0x56a23f(++_0x3f4cba);}(_0x07f8,0x10b));var _0x807f=function(_0x2da656,_0x19fd02){_0x2da656=_0x2da656-0x0;var _0x581d8e=_0x07f8[_0x2da656];return _0x581d8e;};'use strict';var _=require(_0x807f('0x0'));var util=require(_0x807f('0x1'));var moment=require(_0x807f('0x2'));var BPromise=require(_0x807f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x807f('0x4'));var logger=require(_0x807f('0x5'))(_0x807f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x807f('0x7')][_0x807f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f58e1,_0x3f8d95,_0x5874a5){return new BPromise(function(_0x58b3ec,_0x508303){return client[_0x807f('0x9')](_0x5f58e1,_0x5874a5)[_0x807f('0xa')](function(_0xbf53b4){logger[_0x807f('0xb')](_0x807f('0xc'),_0x3f8d95,'request\x20sent');logger[_0x807f('0xd')](_0x807f('0xe'),_0x3f8d95,_0x807f('0xf'),JSON['stringify'](_0xbf53b4));if(_0xbf53b4[_0x807f('0x10')]){if(_0xbf53b4[_0x807f('0x10')][_0x807f('0x11')]===0x1f4){logger['error'](_0x807f('0xc'),_0x3f8d95,_0xbf53b4['error'][_0x807f('0x12')]);return _0x508303(_0xbf53b4['error'][_0x807f('0x12')]);}logger[_0x807f('0x10')](_0x807f('0xc'),_0x3f8d95,_0xbf53b4[_0x807f('0x10')]['message']);return _0x58b3ec(_0xbf53b4['error'][_0x807f('0x12')]);}else{logger[_0x807f('0xb')](_0x807f('0xc'),_0x3f8d95,_0x807f('0xf'));_0x58b3ec(_0xbf53b4[_0x807f('0x13')][_0x807f('0x12')]);}})[_0x807f('0x14')](function(_0x349c23){logger['error'](_0x807f('0xc'),_0x3f8d95,_0x349c23);_0x508303(_0x349c23);});});}exports['GetSalesforceAccount']=function(_0x302dc4){var _0x2c050f=this;return new Promise(function(_0x3b82b1,_0x3106af){return db[_0x807f('0x15')][_0x807f('0x16')]({'raw':_0x302dc4['options']?_0x302dc4[_0x807f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x302dc4[_0x807f('0x17')]?_0x302dc4[_0x807f('0x17')][_0x807f('0x18')]||null:null,'attributes':_0x302dc4[_0x807f('0x17')]?_0x302dc4[_0x807f('0x17')][_0x807f('0x19')]||null:null,'limit':_0x302dc4[_0x807f('0x17')]?_0x302dc4['options'][_0x807f('0x1a')]||null:null,'include':_0x302dc4[_0x807f('0x17')]?_0x302dc4[_0x807f('0x17')][_0x807f('0x1b')]?_['map'](_0x302dc4[_0x807f('0x17')][_0x807f('0x1b')],function(_0x345909){return{'model':db[_0x345909['model']],'as':_0x345909['as'],'attributes':_0x345909[_0x807f('0x19')],'include':_0x345909['include']?_[_0x807f('0x1c')](_0x345909['include'],function(_0x19dde1){return{'model':db[_0x19dde1[_0x807f('0x1d')]],'as':_0x19dde1['as'],'attributes':_0x19dde1[_0x807f('0x19')],'include':_0x19dde1['include']?_[_0x807f('0x1c')](_0x19dde1[_0x807f('0x1b')],function(_0x10c812){return{'model':db[_0x10c812[_0x807f('0x1d')]],'as':_0x10c812['as'],'attributes':_0x10c812[_0x807f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x807f('0xa')](function(_0x5d6055){logger[_0x807f('0xb')]('GetSalesforceAccount',_0x302dc4);logger[_0x807f('0xd')]('GetSalesforceAccount',_0x302dc4,JSON['stringify'](_0x5d6055));_0x3b82b1(_0x5d6055);})[_0x807f('0x14')](function(_0x3cef33){logger[_0x807f('0x10')](_0x807f('0x1e'),_0x3cef33[_0x807f('0x12')],_0x302dc4);_0x3106af(_0x2c050f[_0x807f('0x10')](0x1f4,_0x3cef33[_0x807f('0x12')]));});});};exports[_0x807f('0x1f')]=function(_0x5824ac){var _0x4b3146=this;return new Promise(function(_0x23ba39,_0x1b3968){return db[_0x807f('0x15')]['find']({'raw':_0x5824ac['options']?_0x5824ac[_0x807f('0x17')][_0x807f('0x20')]===undefined?!![]:![]:!![],'where':_0x5824ac['options']?_0x5824ac[_0x807f('0x17')][_0x807f('0x18')]||null:null,'attributes':_0x5824ac[_0x807f('0x17')]?_0x5824ac[_0x807f('0x17')][_0x807f('0x19')]||null:null,'include':_0x5824ac[_0x807f('0x17')]?_0x5824ac['options'][_0x807f('0x1b')]?_['map'](_0x5824ac[_0x807f('0x17')][_0x807f('0x1b')],function(_0x578519){return{'model':db[_0x578519['model']],'as':_0x578519['as'],'attributes':_0x578519[_0x807f('0x19')],'include':_0x578519[_0x807f('0x1b')]?_['map'](_0x578519[_0x807f('0x1b')],function(_0x524b19){return{'model':db[_0x524b19[_0x807f('0x1d')]],'as':_0x524b19['as'],'attributes':_0x524b19[_0x807f('0x19')],'include':_0x524b19[_0x807f('0x1b')]?_[_0x807f('0x1c')](_0x524b19[_0x807f('0x1b')],function(_0x5e4f71){return{'model':db[_0x5e4f71[_0x807f('0x1d')]],'as':_0x5e4f71['as'],'attributes':_0x5e4f71[_0x807f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x807f('0xa')](function(_0x4fe077){logger['info'](_0x807f('0x1f'),_0x5824ac);logger[_0x807f('0xd')](_0x807f('0x1f'),_0x5824ac,JSON['stringify'](_0x4fe077));_0x23ba39(_0x4fe077);})[_0x807f('0x14')](function(_0xe58822){logger[_0x807f('0x10')](_0x807f('0x1f'),_0xe58822[_0x807f('0x12')],_0x5824ac);_0x1b3968(_0x4b3146[_0x807f('0x10')](0x1f4,_0xe58822[_0x807f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6d8f2d9..6ff094f 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x248ade,_0x1762f3){var _0x4a3ed4=function(_0x57eb6b){while(--_0x57eb6b){_0x248ade['push'](_0x248ade['shift']());}};_0x4a3ed4(++_0x1762f3);}(_0x7a54,0x106));var _0x47a5=function(_0x30f281,_0x30c44f){_0x30f281=_0x30f281-0x0;var _0x8a04fd=_0x7a54[_0x30f281];return _0x8a04fd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x0b0e[_0x3f94f9];return _0x46f84f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c878122..04ee1c9 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 _0xa189=['contact_lead','lead','account','contact','sequelize','exports','STRING','ENUM','Task'];(function(_0x354886,_0x54368c){var _0xd5e102=function(_0xad7513){while(--_0xad7513){_0x354886['push'](_0x354886['shift']());}};_0xd5e102(++_0x54368c);}(_0xa189,0x9d));var _0x9a18=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xa189[_0x30d87a];return _0x48f64b;};'use strict';var Sequelize=require(_0x9a18('0x0'));module[_0x9a18('0x1')]={'name':{'type':Sequelize[_0x9a18('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9a18('0x3')](_0x9a18('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9a18('0x3')](_0x9a18('0x5'),'contact',_0x9a18('0x6'),'account_contact_lead',_0x9a18('0x7')),'defaultValue':_0x9a18('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x9a18('0x8'),_0x9a18('0x6'),_0x9a18('0x7')),'defaultValue':_0x9a18('0x6')},'leadId':{'type':Sequelize[_0x9a18('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9a18('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x9a18('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x9a18('0x2')]}}; \ No newline at end of file +var _0x0dfd=['sequelize','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x3375a8,_0x4013b2){var _0x91877f=function(_0x14fa09){while(--_0x14fa09){_0x3375a8['push'](_0x3375a8['shift']());}};_0x91877f(++_0x4013b2);}(_0x0dfd,0x6e));var _0xd0df=function(_0x28822c,_0x46676b){_0x28822c=_0x28822c-0x0;var _0x211465=_0x0dfd[_0x28822c];return _0x211465;};'use strict';var Sequelize=require(_0xd0df('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd0df('0x1')]},'ticketType':{'type':Sequelize[_0xd0df('0x2')](_0xd0df('0x3'),_0xd0df('0x4')),'defaultValue':_0xd0df('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xd0df('0x5'),_0xd0df('0x6'),_0xd0df('0x7'),_0xd0df('0x8'),_0xd0df('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xd0df('0x2')]('nothing',_0xd0df('0x6'),_0xd0df('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xd0df('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xd0df('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8ccb01b..8100017 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 _0x88c6=['type','key','model','map','keys','filters','intersection','query','attributes','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','fields','length','options','create','body','update','find','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','order','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','SalesforceConfiguration','rawAttributes'];(function(_0x26f2c3,_0x346445){var _0x27eeeb=function(_0x3cc95b){while(--_0x3cc95b){_0x26f2c3['push'](_0x26f2c3['shift']());}};_0x27eeeb(++_0x346445);}(_0x88c6,0x163));var _0x688c=function(_0x13a750,_0x16a1ba){_0x13a750=_0x13a750-0x0;var _0x5b064e=_0x88c6[_0x13a750];return _0x5b064e;};'use strict';var emlformat=require(_0x688c('0x0'));var rimraf=require(_0x688c('0x1'));var zipdir=require(_0x688c('0x2'));var jsonpatch=require(_0x688c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x688c('0x4'));var Mustache=require(_0x688c('0x5'));var util=require(_0x688c('0x6'));var path=require('path');var sox=require(_0x688c('0x7'));var csv=require(_0x688c('0x8'));var ejs=require(_0x688c('0x9'));var fs=require('fs');var fs_extra=require(_0x688c('0xa'));var _=require(_0x688c('0xb'));var squel=require(_0x688c('0xc'));var crypto=require('crypto');var jsforce=require(_0x688c('0xd'));var deskjs=require(_0x688c('0xe'));var toCsv=require(_0x688c('0x8'));var querystring=require('querystring');var Papa=require(_0x688c('0xf'));var Redis=require(_0x688c('0x10'));var authService=require(_0x688c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x688c('0x12'));var hardwareService=require(_0x688c('0x13'));var logger=require('../../config/logger')(_0x688c('0x14'));var utils=require(_0x688c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x688c('0x16'));var db=require(_0x688c('0x17'))['db'];function respondWithStatusCode(_0x1b4b75,_0x4b7429){_0x4b7429=_0x4b7429||0xcc;return function(_0x5769e8){if(_0x5769e8){return _0x1b4b75[_0x688c('0x18')](_0x4b7429);}return _0x1b4b75['status'](_0x4b7429)['end']();};}function respondWithResult(_0x2cc54f,_0x567290){_0x567290=_0x567290||0xc8;return function(_0x4b66d3){if(_0x4b66d3){return _0x2cc54f[_0x688c('0x19')](_0x567290)[_0x688c('0x1a')](_0x4b66d3);}};}function respondWithFilteredResult(_0x11933d,_0x197922){return function(_0x485b10){if(_0x485b10){var _0x557ead=typeof _0x197922[_0x688c('0x1b')]===_0x688c('0x1c')&&typeof _0x197922[_0x688c('0x1d')]==='undefined';var _0x268a97=_0x485b10[_0x688c('0x1e')];var _0x3dbfed=_0x557ead?0x0:_0x197922[_0x688c('0x1b')];var _0xb7b5ec=_0x557ead?_0x485b10[_0x688c('0x1e')]:_0x197922[_0x688c('0x1b')]+_0x197922[_0x688c('0x1d')];var _0x250a92;if(_0xb7b5ec>=_0x268a97){_0xb7b5ec=_0x268a97;_0x250a92=0xc8;}else{_0x250a92=0xce;}_0x11933d[_0x688c('0x19')](_0x250a92);return _0x11933d['set'](_0x688c('0x1f'),_0x3dbfed+'-'+_0xb7b5ec+'/'+_0x268a97)[_0x688c('0x1a')](_0x485b10);}return null;};}function patchUpdates(_0x331ee3){return function(_0x2834d4){try{jsonpatch[_0x688c('0x20')](_0x2834d4,_0x331ee3,!![]);}catch(_0x42ad8e){return BPromise[_0x688c('0x21')](_0x42ad8e);}return _0x2834d4[_0x688c('0x22')]();};}function saveUpdates(_0x44180a,_0x4fec56){return function(_0x43a30a){if(_0x43a30a){return _0x43a30a['update'](_0x44180a)['then'](function(_0x13f99e){return _0x13f99e;});}return null;};}function removeEntity(_0x578d09,_0x1a2c97){return function(_0x2150f8){if(_0x2150f8){return _0x2150f8[_0x688c('0x23')]()[_0x688c('0x24')](function(){_0x578d09[_0x688c('0x19')](0xcc)[_0x688c('0x25')]();});}};}function handleEntityNotFound(_0x2b3a11,_0xe7e8a0){return function(_0x133947){if(!_0x133947){_0x2b3a11[_0x688c('0x18')](0x194);}return _0x133947;};}function handleError(_0x24565b,_0x400e1e){_0x400e1e=_0x400e1e||0x1f4;return function(_0x25526b){logger[_0x688c('0x26')](_0x25526b[_0x688c('0x27')]);if(_0x25526b[_0x688c('0x28')]){delete _0x25526b[_0x688c('0x28')];}_0x24565b[_0x688c('0x19')](_0x400e1e)[_0x688c('0x29')](_0x25526b);};}exports[_0x688c('0x2a')]=function(_0x3ed7bb,_0x2f6ef1){var _0x41ffe3={},_0x2dccc3={},_0x550200={'count':0x0,'rows':[]};var _0xa30607=_['map'](db[_0x688c('0x2b')][_0x688c('0x2c')],function(_0x2b2659){return{'name':_0x2b2659['fieldName'],'type':_0x2b2659[_0x688c('0x2d')][_0x688c('0x2e')]};});_0x2dccc3[_0x688c('0x2f')]=_[_0x688c('0x30')](_0xa30607,_0x688c('0x28'));_0x2dccc3['query']=_[_0x688c('0x31')](_0x3ed7bb['query']);_0x2dccc3[_0x688c('0x32')]=_[_0x688c('0x33')](_0x2dccc3[_0x688c('0x2f')],_0x2dccc3[_0x688c('0x34')]);_0x41ffe3['attributes']=_[_0x688c('0x33')](_0x2dccc3[_0x688c('0x2f')],qs['fields'](_0x3ed7bb[_0x688c('0x34')]['fields']));_0x41ffe3[_0x688c('0x35')]=_0x41ffe3[_0x688c('0x35')]['length']?_0x41ffe3[_0x688c('0x35')]:_0x2dccc3['model'];if(!_0x3ed7bb[_0x688c('0x34')]['hasOwnProperty'](_0x688c('0x36'))){_0x41ffe3[_0x688c('0x1d')]=qs[_0x688c('0x1d')](_0x3ed7bb[_0x688c('0x34')][_0x688c('0x1d')]);_0x41ffe3[_0x688c('0x1b')]=qs['offset'](_0x3ed7bb[_0x688c('0x34')][_0x688c('0x1b')]);}_0x41ffe3['order']=qs[_0x688c('0x37')](_0x3ed7bb[_0x688c('0x34')][_0x688c('0x37')]);_0x41ffe3[_0x688c('0x38')]=qs['filters'](_['pick'](_0x3ed7bb[_0x688c('0x34')],_0x2dccc3[_0x688c('0x32')]),_0xa30607);if(_0x3ed7bb[_0x688c('0x34')][_0x688c('0x39')]){_0x41ffe3[_0x688c('0x38')]=_[_0x688c('0x3a')](_0x41ffe3[_0x688c('0x38')],{'$or':_[_0x688c('0x30')](_0xa30607,function(_0x55572a){if(_0x55572a[_0x688c('0x2d')]!==_0x688c('0x3b')){var _0xd8ce59={};_0xd8ce59[_0x55572a['name']]={'$like':'%'+_0x3ed7bb[_0x688c('0x34')][_0x688c('0x39')]+'%'};return _0xd8ce59;}})});}_0x41ffe3=_[_0x688c('0x3a')]({},_0x41ffe3,_0x3ed7bb['options']);var _0x185152={'where':_0x41ffe3['where']};return db[_0x688c('0x2b')][_0x688c('0x1e')](_0x185152)[_0x688c('0x24')](function(_0x458643){_0x550200['count']=_0x458643;if(_0x3ed7bb['query'][_0x688c('0x3c')]){_0x41ffe3[_0x688c('0x3d')]=[{'all':!![]}];}return db[_0x688c('0x2b')]['findAll'](_0x41ffe3);})['then'](function(_0x1d072d){_0x550200['rows']=_0x1d072d;return _0x550200;})[_0x688c('0x24')](respondWithFilteredResult(_0x2f6ef1,_0x41ffe3))[_0x688c('0x3e')](handleError(_0x2f6ef1,null));};exports[_0x688c('0x3f')]=function(_0xddcde8,_0x5b4d51){var _0x49526e={'raw':![],'where':{'id':_0xddcde8[_0x688c('0x40')]['id']}},_0x12b2eb={};_0x12b2eb[_0x688c('0x2f')]=_[_0x688c('0x31')](db[_0x688c('0x2b')][_0x688c('0x2c')]);_0x12b2eb[_0x688c('0x34')]=_[_0x688c('0x31')](_0xddcde8['query']);_0x12b2eb[_0x688c('0x32')]=_['intersection'](_0x12b2eb[_0x688c('0x2f')],_0x12b2eb['query']);_0x49526e['attributes']=_['intersection'](_0x12b2eb[_0x688c('0x2f')],qs[_0x688c('0x41')](_0xddcde8[_0x688c('0x34')][_0x688c('0x41')]));_0x49526e[_0x688c('0x35')]=_0x49526e[_0x688c('0x35')][_0x688c('0x42')]?_0x49526e['attributes']:_0x12b2eb[_0x688c('0x2f')];if(_0xddcde8[_0x688c('0x34')][_0x688c('0x3c')]){_0x49526e[_0x688c('0x3d')]=[{'all':!![]}];}_0x49526e=_[_0x688c('0x3a')]({},_0x49526e,_0xddcde8[_0x688c('0x43')]);return db[_0x688c('0x2b')]['find'](_0x49526e)[_0x688c('0x24')](handleEntityNotFound(_0x5b4d51,null))[_0x688c('0x24')](respondWithResult(_0x5b4d51,null))['catch'](handleError(_0x5b4d51,null));};exports[_0x688c('0x44')]=function(_0x1d57df,_0x348263){return db['SalesforceConfiguration'][_0x688c('0x44')](_0x1d57df[_0x688c('0x45')],{})[_0x688c('0x24')](respondWithResult(_0x348263,0xc9))[_0x688c('0x3e')](handleError(_0x348263,null));};exports[_0x688c('0x46')]=function(_0x213938,_0x2a068b){if(_0x213938[_0x688c('0x45')]['id']){delete _0x213938[_0x688c('0x45')]['id'];}return db['SalesforceConfiguration'][_0x688c('0x47')]({'where':{'id':_0x213938[_0x688c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a068b,null))[_0x688c('0x24')](saveUpdates(_0x213938[_0x688c('0x45')],null))[_0x688c('0x24')](respondWithResult(_0x2a068b,null))[_0x688c('0x3e')](handleError(_0x2a068b,null));};exports['destroy']=function(_0x1dfb58,_0x23f924){return db[_0x688c('0x2b')][_0x688c('0x47')]({'where':{'id':_0x1dfb58[_0x688c('0x40')]['id']}})[_0x688c('0x24')](handleEntityNotFound(_0x23f924,null))[_0x688c('0x24')](removeEntity(_0x23f924,null))[_0x688c('0x3e')](handleError(_0x23f924,null));};exports[_0x688c('0x48')]=function(_0x4dc4eb,_0xb79440,_0x1de657){var _0x1446de={};var _0x47c944={};var _0x33822c;var _0x1ad886;return db[_0x688c('0x2b')][_0x688c('0x49')]({'where':{'id':_0x4dc4eb[_0x688c('0x40')]['id']}})['then'](handleEntityNotFound(_0xb79440,null))[_0x688c('0x24')](function(_0x1824a9){if(_0x1824a9){_0x33822c=_0x1824a9;_0x47c944[_0x688c('0x2f')]=_[_0x688c('0x31')](db[_0x688c('0x4a')][_0x688c('0x2c')]);_0x47c944[_0x688c('0x34')]=_[_0x688c('0x31')](_0x4dc4eb[_0x688c('0x34')]);_0x47c944['filters']=_[_0x688c('0x33')](_0x47c944[_0x688c('0x2f')],_0x47c944[_0x688c('0x34')]);_0x1446de[_0x688c('0x35')]=_[_0x688c('0x33')](_0x47c944[_0x688c('0x2f')],qs['fields'](_0x4dc4eb['query'][_0x688c('0x41')]));_0x1446de['attributes']=_0x1446de[_0x688c('0x35')][_0x688c('0x42')]?_0x1446de[_0x688c('0x35')]:_0x47c944['model'];_0x1446de['order']=qs[_0x688c('0x37')](_0x4dc4eb[_0x688c('0x34')]['sort']);_0x1446de[_0x688c('0x38')]=qs['filters'](_['pick'](_0x4dc4eb[_0x688c('0x34')],_0x47c944['filters']));if(_0x4dc4eb[_0x688c('0x34')][_0x688c('0x39')]){_0x1446de['where']=_['merge'](_0x1446de['where'],{'$or':_['map'](_0x1446de[_0x688c('0x35')],function(_0x36b4b2){var _0x39ff07={};_0x39ff07[_0x36b4b2]={'$like':'%'+_0x4dc4eb[_0x688c('0x34')]['filter']+'%'};return _0x39ff07;})});}_0x1446de=_[_0x688c('0x3a')]({},_0x1446de,_0x4dc4eb['options']);return _0x33822c[_0x688c('0x48')](_0x1446de);}})['then'](function(_0x431c55){if(_0x431c55){_0x1ad886=_0x431c55[_0x688c('0x42')];if(!_0x4dc4eb[_0x688c('0x34')][_0x688c('0x4b')](_0x688c('0x36'))){_0x1446de[_0x688c('0x1d')]=qs[_0x688c('0x1d')](_0x4dc4eb['query'][_0x688c('0x1d')]);_0x1446de[_0x688c('0x1b')]=qs[_0x688c('0x1b')](_0x4dc4eb[_0x688c('0x34')][_0x688c('0x1b')]);}return _0x33822c['getFields'](_0x1446de);}})[_0x688c('0x24')](function(_0x592e40){if(_0x592e40){return _0x592e40?{'count':_0x1ad886,'rows':_0x592e40}:null;}})[_0x688c('0x24')](respondWithResult(_0xb79440,null))[_0x688c('0x3e')](handleError(_0xb79440,null));};exports[_0x688c('0x4c')]=function(_0x25edf5,_0x21bcd5,_0xddbc57){var _0x3bc2ae={};var _0x55ee87={};var _0x308c51;var _0x965b5c;return db[_0x688c('0x2b')]['findOne']({'where':{'id':_0x25edf5[_0x688c('0x40')]['id']}})[_0x688c('0x24')](handleEntityNotFound(_0x21bcd5,null))[_0x688c('0x24')](function(_0x26709a){if(_0x26709a){_0x308c51=_0x26709a;_0x55ee87[_0x688c('0x2f')]=_[_0x688c('0x31')](db[_0x688c('0x4a')]['rawAttributes']);_0x55ee87[_0x688c('0x34')]=_[_0x688c('0x31')](_0x25edf5[_0x688c('0x34')]);_0x55ee87[_0x688c('0x32')]=_[_0x688c('0x33')](_0x55ee87[_0x688c('0x2f')],_0x55ee87[_0x688c('0x34')]);_0x3bc2ae['attributes']=_[_0x688c('0x33')](_0x55ee87['model'],qs[_0x688c('0x41')](_0x25edf5[_0x688c('0x34')][_0x688c('0x41')]));_0x3bc2ae[_0x688c('0x35')]=_0x3bc2ae['attributes'][_0x688c('0x42')]?_0x3bc2ae[_0x688c('0x35')]:_0x55ee87['model'];_0x3bc2ae[_0x688c('0x4d')]=qs['sort'](_0x25edf5[_0x688c('0x34')][_0x688c('0x37')]);_0x3bc2ae[_0x688c('0x38')]=qs[_0x688c('0x32')](_['pick'](_0x25edf5[_0x688c('0x34')],_0x55ee87['filters']));if(_0x25edf5[_0x688c('0x34')][_0x688c('0x39')]){_0x3bc2ae['where']=_[_0x688c('0x3a')](_0x3bc2ae[_0x688c('0x38')],{'$or':_[_0x688c('0x30')](_0x3bc2ae[_0x688c('0x35')],function(_0x517b5e){var _0x4dd9fb={};_0x4dd9fb[_0x517b5e]={'$like':'%'+_0x25edf5['query'][_0x688c('0x39')]+'%'};return _0x4dd9fb;})});}_0x3bc2ae=_[_0x688c('0x3a')]({},_0x3bc2ae,_0x25edf5['options']);return _0x308c51['getSubjects'](_0x3bc2ae);}})['then'](function(_0x527ee2){if(_0x527ee2){_0x965b5c=_0x527ee2['length'];if(!_0x25edf5[_0x688c('0x34')][_0x688c('0x4b')]('nolimit')){_0x3bc2ae['limit']=qs[_0x688c('0x1d')](_0x25edf5[_0x688c('0x34')][_0x688c('0x1d')]);_0x3bc2ae['offset']=qs[_0x688c('0x1b')](_0x25edf5['query'][_0x688c('0x1b')]);}return _0x308c51[_0x688c('0x4c')](_0x3bc2ae);}})[_0x688c('0x24')](function(_0x5307f1){if(_0x5307f1){return _0x5307f1?{'count':_0x965b5c,'rows':_0x5307f1}:null;}})[_0x688c('0x24')](respondWithResult(_0x21bcd5,null))['catch'](handleError(_0x21bcd5,null));};exports[_0x688c('0x4e')]=function(_0x255bc2,_0x29dec7,_0x1e3b1e){var _0x35d504={};var _0x4b9659={};var _0x30f043;var _0x3d9caf;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x255bc2[_0x688c('0x40')]['id']}})[_0x688c('0x24')](handleEntityNotFound(_0x29dec7,null))['then'](function(_0x48302a){if(_0x48302a){_0x30f043=_0x48302a;_0x4b9659[_0x688c('0x2f')]=_[_0x688c('0x31')](db[_0x688c('0x4a')][_0x688c('0x2c')]);_0x4b9659[_0x688c('0x34')]=_['keys'](_0x255bc2[_0x688c('0x34')]);_0x4b9659['filters']=_['intersection'](_0x4b9659['model'],_0x4b9659[_0x688c('0x34')]);_0x35d504[_0x688c('0x35')]=_[_0x688c('0x33')](_0x4b9659[_0x688c('0x2f')],qs[_0x688c('0x41')](_0x255bc2['query'][_0x688c('0x41')]));_0x35d504[_0x688c('0x35')]=_0x35d504[_0x688c('0x35')][_0x688c('0x42')]?_0x35d504['attributes']:_0x4b9659[_0x688c('0x2f')];_0x35d504[_0x688c('0x4d')]=qs[_0x688c('0x37')](_0x255bc2[_0x688c('0x34')][_0x688c('0x37')]);_0x35d504['where']=qs[_0x688c('0x32')](_[_0x688c('0x4f')](_0x255bc2['query'],_0x4b9659[_0x688c('0x32')]));if(_0x255bc2[_0x688c('0x34')]['filter']){_0x35d504['where']=_[_0x688c('0x3a')](_0x35d504[_0x688c('0x38')],{'$or':_['map'](_0x35d504[_0x688c('0x35')],function(_0x9f514d){var _0x551a6a={};_0x551a6a[_0x9f514d]={'$like':'%'+_0x255bc2['query'][_0x688c('0x39')]+'%'};return _0x551a6a;})});}_0x35d504=_[_0x688c('0x3a')]({},_0x35d504,_0x255bc2[_0x688c('0x43')]);return _0x30f043[_0x688c('0x4e')](_0x35d504);}})['then'](function(_0x3261f){if(_0x3261f){_0x3d9caf=_0x3261f[_0x688c('0x42')];if(!_0x255bc2[_0x688c('0x34')][_0x688c('0x4b')](_0x688c('0x36'))){_0x35d504[_0x688c('0x1d')]=qs[_0x688c('0x1d')](_0x255bc2[_0x688c('0x34')][_0x688c('0x1d')]);_0x35d504[_0x688c('0x1b')]=qs[_0x688c('0x1b')](_0x255bc2['query']['offset']);}return _0x30f043[_0x688c('0x4e')](_0x35d504);}})[_0x688c('0x24')](function(_0x4a7bb3){if(_0x4a7bb3){return _0x4a7bb3?{'count':_0x3d9caf,'rows':_0x4a7bb3}:null;}})[_0x688c('0x24')](respondWithResult(_0x29dec7,null))[_0x688c('0x3e')](handleError(_0x29dec7,null));}; \ No newline at end of file +var _0xbd22=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','SalesforceConfiguration','rows','catch','params','keys','find','create','body','getFields','findOne','rawAttributes','filter','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x129b51,_0x5374e1){var _0x4914c5=function(_0xdd154c){while(--_0xdd154c){_0x129b51['push'](_0x129b51['shift']());}};_0x4914c5(++_0x5374e1);}(_0xbd22,0x1dd));var _0x2bd2=function(_0x4ed32f,_0x25aa8e){_0x4ed32f=_0x4ed32f-0x0;var _0x51bd89=_0xbd22[_0x4ed32f];return _0x51bd89;};'use strict';var emlformat=require(_0x2bd2('0x0'));var rimraf=require(_0x2bd2('0x1'));var zipdir=require(_0x2bd2('0x2'));var jsonpatch=require(_0x2bd2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2bd2('0x4'));var Mustache=require(_0x2bd2('0x5'));var util=require(_0x2bd2('0x6'));var path=require(_0x2bd2('0x7'));var sox=require(_0x2bd2('0x8'));var csv=require(_0x2bd2('0x9'));var ejs=require(_0x2bd2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bd2('0xb'));var squel=require(_0x2bd2('0xc'));var crypto=require(_0x2bd2('0xd'));var jsforce=require(_0x2bd2('0xe'));var deskjs=require(_0x2bd2('0xf'));var toCsv=require(_0x2bd2('0x9'));var querystring=require(_0x2bd2('0x10'));var Papa=require(_0x2bd2('0x11'));var Redis=require(_0x2bd2('0x12'));var authService=require(_0x2bd2('0x13'));var qs=require(_0x2bd2('0x14'));var as=require(_0x2bd2('0x15'));var hardwareService=require(_0x2bd2('0x16'));var logger=require(_0x2bd2('0x17'))('api');var utils=require(_0x2bd2('0x18'));var config=require(_0x2bd2('0x19'));var licenseUtil=require(_0x2bd2('0x1a'));var db=require(_0x2bd2('0x1b'))['db'];function respondWithStatusCode(_0x1287a7,_0x29b21a){_0x29b21a=_0x29b21a||0xcc;return function(_0x3efb7e){if(_0x3efb7e){return _0x1287a7['sendStatus'](_0x29b21a);}return _0x1287a7['status'](_0x29b21a)[_0x2bd2('0x1c')]();};}function respondWithResult(_0x3efbf4,_0x2565b3){_0x2565b3=_0x2565b3||0xc8;return function(_0x577421){if(_0x577421){return _0x3efbf4[_0x2bd2('0x1d')](_0x2565b3)[_0x2bd2('0x1e')](_0x577421);}};}function respondWithFilteredResult(_0x12dc28,_0x2d934b){return function(_0x388127){if(_0x388127){var _0x33505f=typeof _0x2d934b['offset']===_0x2bd2('0x1f')&&typeof _0x2d934b[_0x2bd2('0x20')]===_0x2bd2('0x1f');var _0x1852c9=_0x388127['count'];var _0x5b3e70=_0x33505f?0x0:_0x2d934b[_0x2bd2('0x21')];var _0x57d83c=_0x33505f?_0x388127['count']:_0x2d934b[_0x2bd2('0x21')]+_0x2d934b[_0x2bd2('0x20')];var _0x5af89a;if(_0x57d83c>=_0x1852c9){_0x57d83c=_0x1852c9;_0x5af89a=0xc8;}else{_0x5af89a=0xce;}_0x12dc28['status'](_0x5af89a);return _0x12dc28[_0x2bd2('0x22')]('Content-Range',_0x5b3e70+'-'+_0x57d83c+'/'+_0x1852c9)[_0x2bd2('0x1e')](_0x388127);}return null;};}function patchUpdates(_0x3bcb7a){return function(_0x573134){try{jsonpatch[_0x2bd2('0x23')](_0x573134,_0x3bcb7a,!![]);}catch(_0x320942){return BPromise['reject'](_0x320942);}return _0x573134[_0x2bd2('0x24')]();};}function saveUpdates(_0x5709c8,_0xcbe312){return function(_0x5e508a){if(_0x5e508a){return _0x5e508a[_0x2bd2('0x25')](_0x5709c8)[_0x2bd2('0x26')](function(_0x1623f1){return _0x1623f1;});}return null;};}function removeEntity(_0x469c67,_0x1880a1){return function(_0x59c574){if(_0x59c574){return _0x59c574[_0x2bd2('0x27')]()[_0x2bd2('0x26')](function(){_0x469c67[_0x2bd2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275ed6,_0x322321){return function(_0x37e4ff){if(!_0x37e4ff){_0x275ed6[_0x2bd2('0x28')](0x194);}return _0x37e4ff;};}function handleError(_0x4913fd,_0x19947d){_0x19947d=_0x19947d||0x1f4;return function(_0x2af999){logger[_0x2bd2('0x29')](_0x2af999[_0x2bd2('0x2a')]);if(_0x2af999[_0x2bd2('0x2b')]){delete _0x2af999[_0x2bd2('0x2b')];}_0x4913fd[_0x2bd2('0x1d')](_0x19947d)[_0x2bd2('0x2c')](_0x2af999);};}exports[_0x2bd2('0x2d')]=function(_0x355331,_0x583f46){var _0xf5b3d9={},_0x4162b0={},_0x5c5972={'count':0x0,'rows':[]};var _0x113273=_[_0x2bd2('0x2e')](db['SalesforceConfiguration']['rawAttributes'],function(_0x222488){return{'name':_0x222488[_0x2bd2('0x2f')],'type':_0x222488[_0x2bd2('0x30')][_0x2bd2('0x31')]};});_0x4162b0[_0x2bd2('0x32')]=_[_0x2bd2('0x2e')](_0x113273,_0x2bd2('0x2b'));_0x4162b0[_0x2bd2('0x33')]=_['keys'](_0x355331[_0x2bd2('0x33')]);_0x4162b0['filters']=_[_0x2bd2('0x34')](_0x4162b0[_0x2bd2('0x32')],_0x4162b0[_0x2bd2('0x33')]);_0xf5b3d9[_0x2bd2('0x35')]=_[_0x2bd2('0x34')](_0x4162b0[_0x2bd2('0x32')],qs[_0x2bd2('0x36')](_0x355331[_0x2bd2('0x33')]['fields']));_0xf5b3d9[_0x2bd2('0x35')]=_0xf5b3d9[_0x2bd2('0x35')][_0x2bd2('0x37')]?_0xf5b3d9[_0x2bd2('0x35')]:_0x4162b0['model'];if(!_0x355331[_0x2bd2('0x33')][_0x2bd2('0x38')](_0x2bd2('0x39'))){_0xf5b3d9['limit']=qs[_0x2bd2('0x20')](_0x355331[_0x2bd2('0x33')][_0x2bd2('0x20')]);_0xf5b3d9[_0x2bd2('0x21')]=qs[_0x2bd2('0x21')](_0x355331['query'][_0x2bd2('0x21')]);}_0xf5b3d9[_0x2bd2('0x3a')]=qs[_0x2bd2('0x3b')](_0x355331[_0x2bd2('0x33')][_0x2bd2('0x3b')]);_0xf5b3d9[_0x2bd2('0x3c')]=qs[_0x2bd2('0x3d')](_[_0x2bd2('0x3e')](_0x355331[_0x2bd2('0x33')],_0x4162b0['filters']),_0x113273);if(_0x355331[_0x2bd2('0x33')]['filter']){_0xf5b3d9[_0x2bd2('0x3c')]=_[_0x2bd2('0x3f')](_0xf5b3d9[_0x2bd2('0x3c')],{'$or':_['map'](_0x113273,function(_0x9e4dfd){if(_0x9e4dfd[_0x2bd2('0x30')]!==_0x2bd2('0x40')){var _0x11efba={};_0x11efba[_0x9e4dfd[_0x2bd2('0x2b')]]={'$like':'%'+_0x355331[_0x2bd2('0x33')]['filter']+'%'};return _0x11efba;}})});}_0xf5b3d9=_[_0x2bd2('0x3f')]({},_0xf5b3d9,_0x355331[_0x2bd2('0x41')]);var _0x5e04d9={'where':_0xf5b3d9[_0x2bd2('0x3c')]};return db['SalesforceConfiguration'][_0x2bd2('0x42')](_0x5e04d9)[_0x2bd2('0x26')](function(_0x117ec5){_0x5c5972[_0x2bd2('0x42')]=_0x117ec5;if(_0x355331[_0x2bd2('0x33')][_0x2bd2('0x43')]){_0xf5b3d9['include']=[{'all':!![]}];}return db[_0x2bd2('0x44')]['findAll'](_0xf5b3d9);})['then'](function(_0x2f02c1){_0x5c5972[_0x2bd2('0x45')]=_0x2f02c1;return _0x5c5972;})[_0x2bd2('0x26')](respondWithFilteredResult(_0x583f46,_0xf5b3d9))[_0x2bd2('0x46')](handleError(_0x583f46,null));};exports['show']=function(_0x487ae8,_0x568365){var _0x2b4a1e={'raw':![],'where':{'id':_0x487ae8[_0x2bd2('0x47')]['id']}},_0x52cc7b={};_0x52cc7b[_0x2bd2('0x32')]=_['keys'](db[_0x2bd2('0x44')]['rawAttributes']);_0x52cc7b['query']=_[_0x2bd2('0x48')](_0x487ae8[_0x2bd2('0x33')]);_0x52cc7b['filters']=_[_0x2bd2('0x34')](_0x52cc7b[_0x2bd2('0x32')],_0x52cc7b[_0x2bd2('0x33')]);_0x2b4a1e[_0x2bd2('0x35')]=_[_0x2bd2('0x34')](_0x52cc7b[_0x2bd2('0x32')],qs[_0x2bd2('0x36')](_0x487ae8['query'][_0x2bd2('0x36')]));_0x2b4a1e[_0x2bd2('0x35')]=_0x2b4a1e['attributes'][_0x2bd2('0x37')]?_0x2b4a1e[_0x2bd2('0x35')]:_0x52cc7b[_0x2bd2('0x32')];if(_0x487ae8[_0x2bd2('0x33')][_0x2bd2('0x43')]){_0x2b4a1e['include']=[{'all':!![]}];}_0x2b4a1e=_[_0x2bd2('0x3f')]({},_0x2b4a1e,_0x487ae8['options']);return db[_0x2bd2('0x44')][_0x2bd2('0x49')](_0x2b4a1e)[_0x2bd2('0x26')](handleEntityNotFound(_0x568365,null))['then'](respondWithResult(_0x568365,null))[_0x2bd2('0x46')](handleError(_0x568365,null));};exports[_0x2bd2('0x4a')]=function(_0x1b8765,_0x5e5e5a){return db[_0x2bd2('0x44')][_0x2bd2('0x4a')](_0x1b8765['body'],{})[_0x2bd2('0x26')](respondWithResult(_0x5e5e5a,0xc9))[_0x2bd2('0x46')](handleError(_0x5e5e5a,null));};exports[_0x2bd2('0x25')]=function(_0x45a3d4,_0x3de143){if(_0x45a3d4[_0x2bd2('0x4b')]['id']){delete _0x45a3d4[_0x2bd2('0x4b')]['id'];}return db['SalesforceConfiguration'][_0x2bd2('0x49')]({'where':{'id':_0x45a3d4[_0x2bd2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3de143,null))[_0x2bd2('0x26')](saveUpdates(_0x45a3d4[_0x2bd2('0x4b')],null))[_0x2bd2('0x26')](respondWithResult(_0x3de143,null))[_0x2bd2('0x46')](handleError(_0x3de143,null));};exports[_0x2bd2('0x27')]=function(_0x11ed04,_0x4c982b){return db['SalesforceConfiguration']['find']({'where':{'id':_0x11ed04['params']['id']}})['then'](handleEntityNotFound(_0x4c982b,null))[_0x2bd2('0x26')](removeEntity(_0x4c982b,null))['catch'](handleError(_0x4c982b,null));};exports[_0x2bd2('0x4c')]=function(_0x3dfd1e,_0xea5984,_0x52c351){var _0x8fbe36={};var _0x1a500c={};var _0x40188a;var _0x4c1a4a;return db[_0x2bd2('0x44')][_0x2bd2('0x4d')]({'where':{'id':_0x3dfd1e[_0x2bd2('0x47')]['id']}})[_0x2bd2('0x26')](handleEntityNotFound(_0xea5984,null))[_0x2bd2('0x26')](function(_0x206a68){if(_0x206a68){_0x40188a=_0x206a68;_0x1a500c[_0x2bd2('0x32')]=_[_0x2bd2('0x48')](db['SalesforceField'][_0x2bd2('0x4e')]);_0x1a500c['query']=_['keys'](_0x3dfd1e[_0x2bd2('0x33')]);_0x1a500c['filters']=_[_0x2bd2('0x34')](_0x1a500c['model'],_0x1a500c[_0x2bd2('0x33')]);_0x8fbe36[_0x2bd2('0x35')]=_[_0x2bd2('0x34')](_0x1a500c['model'],qs[_0x2bd2('0x36')](_0x3dfd1e[_0x2bd2('0x33')][_0x2bd2('0x36')]));_0x8fbe36[_0x2bd2('0x35')]=_0x8fbe36[_0x2bd2('0x35')][_0x2bd2('0x37')]?_0x8fbe36[_0x2bd2('0x35')]:_0x1a500c[_0x2bd2('0x32')];_0x8fbe36[_0x2bd2('0x3a')]=qs[_0x2bd2('0x3b')](_0x3dfd1e['query'][_0x2bd2('0x3b')]);_0x8fbe36[_0x2bd2('0x3c')]=qs[_0x2bd2('0x3d')](_[_0x2bd2('0x3e')](_0x3dfd1e[_0x2bd2('0x33')],_0x1a500c[_0x2bd2('0x3d')]));if(_0x3dfd1e['query'][_0x2bd2('0x4f')]){_0x8fbe36['where']=_['merge'](_0x8fbe36[_0x2bd2('0x3c')],{'$or':_[_0x2bd2('0x2e')](_0x8fbe36[_0x2bd2('0x35')],function(_0x2580d0){var _0x411a9d={};_0x411a9d[_0x2580d0]={'$like':'%'+_0x3dfd1e[_0x2bd2('0x33')][_0x2bd2('0x4f')]+'%'};return _0x411a9d;})});}_0x8fbe36=_['merge']({},_0x8fbe36,_0x3dfd1e[_0x2bd2('0x41')]);return _0x40188a[_0x2bd2('0x4c')](_0x8fbe36);}})['then'](function(_0xf83b31){if(_0xf83b31){_0x4c1a4a=_0xf83b31['length'];if(!_0x3dfd1e[_0x2bd2('0x33')][_0x2bd2('0x38')](_0x2bd2('0x39'))){_0x8fbe36[_0x2bd2('0x20')]=qs[_0x2bd2('0x20')](_0x3dfd1e['query'][_0x2bd2('0x20')]);_0x8fbe36[_0x2bd2('0x21')]=qs[_0x2bd2('0x21')](_0x3dfd1e[_0x2bd2('0x33')][_0x2bd2('0x21')]);}return _0x40188a[_0x2bd2('0x4c')](_0x8fbe36);}})['then'](function(_0x5284e7){if(_0x5284e7){return _0x5284e7?{'count':_0x4c1a4a,'rows':_0x5284e7}:null;}})[_0x2bd2('0x26')](respondWithResult(_0xea5984,null))[_0x2bd2('0x46')](handleError(_0xea5984,null));};exports[_0x2bd2('0x50')]=function(_0x723f0e,_0x203c82,_0x4a0625){var _0x1d9ff9={};var _0x22b212={};var _0x2b1326;var _0x5e7fa7;return db[_0x2bd2('0x44')]['findOne']({'where':{'id':_0x723f0e[_0x2bd2('0x47')]['id']}})[_0x2bd2('0x26')](handleEntityNotFound(_0x203c82,null))['then'](function(_0x32daa8){if(_0x32daa8){_0x2b1326=_0x32daa8;_0x22b212[_0x2bd2('0x32')]=_[_0x2bd2('0x48')](db[_0x2bd2('0x51')][_0x2bd2('0x4e')]);_0x22b212[_0x2bd2('0x33')]=_[_0x2bd2('0x48')](_0x723f0e[_0x2bd2('0x33')]);_0x22b212[_0x2bd2('0x3d')]=_[_0x2bd2('0x34')](_0x22b212[_0x2bd2('0x32')],_0x22b212['query']);_0x1d9ff9['attributes']=_[_0x2bd2('0x34')](_0x22b212['model'],qs[_0x2bd2('0x36')](_0x723f0e[_0x2bd2('0x33')]['fields']));_0x1d9ff9['attributes']=_0x1d9ff9['attributes'][_0x2bd2('0x37')]?_0x1d9ff9[_0x2bd2('0x35')]:_0x22b212[_0x2bd2('0x32')];_0x1d9ff9[_0x2bd2('0x3a')]=qs[_0x2bd2('0x3b')](_0x723f0e[_0x2bd2('0x33')][_0x2bd2('0x3b')]);_0x1d9ff9[_0x2bd2('0x3c')]=qs[_0x2bd2('0x3d')](_[_0x2bd2('0x3e')](_0x723f0e['query'],_0x22b212[_0x2bd2('0x3d')]));if(_0x723f0e['query'][_0x2bd2('0x4f')]){_0x1d9ff9[_0x2bd2('0x3c')]=_[_0x2bd2('0x3f')](_0x1d9ff9[_0x2bd2('0x3c')],{'$or':_[_0x2bd2('0x2e')](_0x1d9ff9[_0x2bd2('0x35')],function(_0x26e31f){var _0x4975b5={};_0x4975b5[_0x26e31f]={'$like':'%'+_0x723f0e[_0x2bd2('0x33')][_0x2bd2('0x4f')]+'%'};return _0x4975b5;})});}_0x1d9ff9=_[_0x2bd2('0x3f')]({},_0x1d9ff9,_0x723f0e['options']);return _0x2b1326[_0x2bd2('0x50')](_0x1d9ff9);}})[_0x2bd2('0x26')](function(_0x54b74f){if(_0x54b74f){_0x5e7fa7=_0x54b74f[_0x2bd2('0x37')];if(!_0x723f0e[_0x2bd2('0x33')]['hasOwnProperty'](_0x2bd2('0x39'))){_0x1d9ff9[_0x2bd2('0x20')]=qs[_0x2bd2('0x20')](_0x723f0e['query'][_0x2bd2('0x20')]);_0x1d9ff9[_0x2bd2('0x21')]=qs[_0x2bd2('0x21')](_0x723f0e[_0x2bd2('0x33')][_0x2bd2('0x21')]);}return _0x2b1326[_0x2bd2('0x50')](_0x1d9ff9);}})['then'](function(_0x547792){if(_0x547792){return _0x547792?{'count':_0x5e7fa7,'rows':_0x547792}:null;}})[_0x2bd2('0x26')](respondWithResult(_0x203c82,null))['catch'](handleError(_0x203c82,null));};exports['getDescriptions']=function(_0x554bc3,_0x290e6b,_0x2c9988){var _0x2b6b07={};var _0x49bc18={};var _0x5ecb9c;var _0xea6c16;return db[_0x2bd2('0x44')][_0x2bd2('0x4d')]({'where':{'id':_0x554bc3[_0x2bd2('0x47')]['id']}})[_0x2bd2('0x26')](handleEntityNotFound(_0x290e6b,null))[_0x2bd2('0x26')](function(_0x335592){if(_0x335592){_0x5ecb9c=_0x335592;_0x49bc18[_0x2bd2('0x32')]=_[_0x2bd2('0x48')](db[_0x2bd2('0x51')][_0x2bd2('0x4e')]);_0x49bc18[_0x2bd2('0x33')]=_[_0x2bd2('0x48')](_0x554bc3[_0x2bd2('0x33')]);_0x49bc18[_0x2bd2('0x3d')]=_['intersection'](_0x49bc18[_0x2bd2('0x32')],_0x49bc18[_0x2bd2('0x33')]);_0x2b6b07[_0x2bd2('0x35')]=_['intersection'](_0x49bc18[_0x2bd2('0x32')],qs[_0x2bd2('0x36')](_0x554bc3[_0x2bd2('0x33')][_0x2bd2('0x36')]));_0x2b6b07[_0x2bd2('0x35')]=_0x2b6b07['attributes']['length']?_0x2b6b07[_0x2bd2('0x35')]:_0x49bc18['model'];_0x2b6b07[_0x2bd2('0x3a')]=qs[_0x2bd2('0x3b')](_0x554bc3['query'][_0x2bd2('0x3b')]);_0x2b6b07[_0x2bd2('0x3c')]=qs[_0x2bd2('0x3d')](_['pick'](_0x554bc3['query'],_0x49bc18['filters']));if(_0x554bc3[_0x2bd2('0x33')][_0x2bd2('0x4f')]){_0x2b6b07[_0x2bd2('0x3c')]=_[_0x2bd2('0x3f')](_0x2b6b07['where'],{'$or':_['map'](_0x2b6b07[_0x2bd2('0x35')],function(_0x2f604c){var _0x3154c5={};_0x3154c5[_0x2f604c]={'$like':'%'+_0x554bc3[_0x2bd2('0x33')][_0x2bd2('0x4f')]+'%'};return _0x3154c5;})});}_0x2b6b07=_['merge']({},_0x2b6b07,_0x554bc3[_0x2bd2('0x41')]);return _0x5ecb9c[_0x2bd2('0x52')](_0x2b6b07);}})[_0x2bd2('0x26')](function(_0x5dd31d){if(_0x5dd31d){_0xea6c16=_0x5dd31d[_0x2bd2('0x37')];if(!_0x554bc3[_0x2bd2('0x33')][_0x2bd2('0x38')]('nolimit')){_0x2b6b07[_0x2bd2('0x20')]=qs['limit'](_0x554bc3[_0x2bd2('0x33')][_0x2bd2('0x20')]);_0x2b6b07[_0x2bd2('0x21')]=qs[_0x2bd2('0x21')](_0x554bc3['query']['offset']);}return _0x5ecb9c['getDescriptions'](_0x2b6b07);}})[_0x2bd2('0x26')](function(_0x31514c){if(_0x31514c){return _0x31514c?{'count':_0xea6c16,'rows':_0x31514c}:null;}})['then'](respondWithResult(_0x290e6b,null))[_0x2bd2('0x46')](handleError(_0x290e6b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e852740..b658a28 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 _0x373a=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x5a015b,_0x3aa47a){var _0x12db7c=function(_0x2d056f){while(--_0x2d056f){_0x5a015b['push'](_0x5a015b['shift']());}};_0x12db7c(++_0x3aa47a);}(_0x373a,0xba));var _0xa373=function(_0x28c5e4,_0x45a3f9){_0x28c5e4=_0x28c5e4-0x0;var _0x3e9407=_0x373a[_0x28c5e4];return _0x3e9407;};'use strict';var _=require(_0xa373('0x0'));var util=require('util');var logger=require(_0xa373('0x1'))(_0xa373('0x2'));var moment=require(_0xa373('0x3'));var BPromise=require(_0xa373('0x4'));var rp=require(_0xa373('0x5'));var fs=require('fs');var path=require(_0xa373('0x6'));var rimraf=require('rimraf');var config=require(_0xa373('0x7'));var attributes=require(_0xa373('0x8'));module[_0xa373('0x9')]=function(_0x39fb4d,_0x2ae4e6){return _0x39fb4d[_0xa373('0xa')](_0xa373('0xb'),attributes,{'tableName':_0xa373('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d33=['int_salesforce_configurations','util','bluebird','rimraf','./intSalesforceConfiguration.attributes','define'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x4d33,0x19f));var _0x34d3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4d33[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x34d3('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x34d3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x34d3('0x2'));var config=require('../../config/environment');var attributes=require(_0x34d3('0x3'));module['exports']=function(_0xbd6bce,_0xde2ea9){return _0xbd6bce[_0x34d3('0x4')]('SalesforceConfiguration',attributes,{'tableName':_0x34d3('0x5'),'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 c7f45ca..017b387 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 _0xc92f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ea12d,_0x226afb){var _0x5c8abb=function(_0x6d3c7f){while(--_0x6d3c7f){_0x3ea12d['push'](_0x3ea12d['shift']());}};_0x5c8abb(++_0x226afb);}(_0xc92f,0xda));var _0xfc92=function(_0x3c7097,_0x56991e){_0x3c7097=_0x3c7097-0x0;var _0x164b86=_0xc92f[_0x3c7097];return _0x164b86;};'use strict';var _=require('lodash');var util=require(_0xfc92('0x0'));var moment=require(_0xfc92('0x1'));var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require(_0xfc92('0x5'))['db'];var utils=require(_0xfc92('0x6'));var logger=require('../../config/logger')(_0xfc92('0x7'));var config=require(_0xfc92('0x8'));var jayson=require(_0xfc92('0x9'));var client=jayson[_0xfc92('0xa')][_0xfc92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4dd4,_0x515837,_0x5ea0f4){return new BPromise(function(_0x42bed5,_0x4afd90){return client[_0xfc92('0xc')](_0x5d4dd4,_0x5ea0f4)[_0xfc92('0xd')](function(_0x3a8d25){logger[_0xfc92('0xe')](_0xfc92('0xf'),_0x515837,'request\x20sent');logger[_0xfc92('0x10')](_0xfc92('0x11'),_0x515837,_0xfc92('0x12'),JSON[_0xfc92('0x13')](_0x3a8d25));if(_0x3a8d25[_0xfc92('0x14')]){if(_0x3a8d25[_0xfc92('0x14')][_0xfc92('0x15')]===0x1f4){logger[_0xfc92('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x515837,_0x3a8d25[_0xfc92('0x14')][_0xfc92('0x16')]);return _0x4afd90(_0x3a8d25['error']['message']);}logger[_0xfc92('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x515837,_0x3a8d25[_0xfc92('0x14')][_0xfc92('0x16')]);return _0x42bed5(_0x3a8d25['error']['message']);}else{logger['info'](_0xfc92('0xf'),_0x515837,_0xfc92('0x12'));_0x42bed5(_0x3a8d25[_0xfc92('0x17')][_0xfc92('0x16')]);}})[_0xfc92('0x18')](function(_0x43e92d){logger[_0xfc92('0x14')](_0xfc92('0xf'),_0x515837,_0x43e92d);_0x4afd90(_0x43e92d);});});} \ No newline at end of file +var _0x5589=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x5589,0x96));var _0x9558=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5589[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9558('0x0'));var BPromise=require(_0x9558('0x1'));var rs=require(_0x9558('0x2'));var fs=require('fs');var Redis=require(_0x9558('0x3'));var db=require(_0x9558('0x4'))['db'];var utils=require(_0x9558('0x5'));var logger=require(_0x9558('0x6'))(_0x9558('0x7'));var config=require(_0x9558('0x8'));var jayson=require(_0x9558('0x9'));var client=jayson['client'][_0x9558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca877,_0x59987c,_0x21e137){return new BPromise(function(_0x336c5e,_0x4b011a){return client[_0x9558('0xb')](_0x5ca877,_0x21e137)[_0x9558('0xc')](function(_0x5ebad3){logger[_0x9558('0xd')](_0x9558('0xe'),_0x59987c,_0x9558('0xf'));logger[_0x9558('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x59987c,_0x9558('0xf'),JSON[_0x9558('0x11')](_0x5ebad3));if(_0x5ebad3[_0x9558('0x12')]){if(_0x5ebad3[_0x9558('0x12')][_0x9558('0x13')]===0x1f4){logger[_0x9558('0x12')](_0x9558('0xe'),_0x59987c,_0x5ebad3[_0x9558('0x12')]['message']);return _0x4b011a(_0x5ebad3[_0x9558('0x12')][_0x9558('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x59987c,_0x5ebad3['error'][_0x9558('0x14')]);return _0x336c5e(_0x5ebad3[_0x9558('0x12')][_0x9558('0x14')]);}else{logger[_0x9558('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59987c,_0x9558('0xf'));_0x336c5e(_0x5ebad3[_0x9558('0x15')]['message']);}})['catch'](function(_0x4a1db5){logger['error'](_0x9558('0xe'),_0x59987c,_0x4a1db5);_0x4b011a(_0x4a1db5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0eaf1c1..9817df3 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 _0xb3ae=['../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x22382f,_0x5c2e54){var _0x35213b=function(_0x50898d){while(--_0x50898d){_0x22382f['push'](_0x22382f['shift']());}};_0x35213b(++_0x5c2e54);}(_0xb3ae,0x1cf));var _0xeb3a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb3ae[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xeb3a('0x0'));var util=require(_0xeb3a('0x1'));var path=require(_0xeb3a('0x2'));var timeout=require(_0xeb3a('0x3'));var express=require('express');var router=express[_0xeb3a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeb3a('0x5'));var config=require('../../config/environment');var controller=require(_0xeb3a('0x6'));router[_0xeb3a('0x7')]('/',auth[_0xeb3a('0x8')](),controller[_0xeb3a('0x9')]);router['get'](_0xeb3a('0xa'),auth[_0xeb3a('0x8')](),controller[_0xeb3a('0xb')]);router[_0xeb3a('0xc')]('/',auth[_0xeb3a('0x8')](),controller[_0xeb3a('0xd')]);router[_0xeb3a('0xe')](_0xeb3a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xeb3a('0xf')]('/:id',auth[_0xeb3a('0x8')](),controller[_0xeb3a('0x10')]);module[_0xeb3a('0x11')]=router; \ No newline at end of file +var _0xde9d=['create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','/:id','post'];(function(_0x193d1a,_0x249662){var _0x35399a=function(_0x582a52){while(--_0x582a52){_0x193d1a['push'](_0x193d1a['shift']());}};_0x35399a(++_0x249662);}(_0xde9d,0xcb));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var path=require(_0xdde9('0x2'));var timeout=require('connect-timeout');var express=require(_0xdde9('0x3'));var router=express[_0xdde9('0x4')]();var fs_extra=require(_0xdde9('0x5'));var auth=require(_0xdde9('0x6'));var interaction=require(_0xdde9('0x7'));var config=require('../../config/environment');var controller=require(_0xdde9('0x8'));router['get']('/',auth[_0xdde9('0x9')](),controller[_0xdde9('0xa')]);router['get'](_0xdde9('0xb'),auth[_0xdde9('0x9')](),controller['show']);router[_0xdde9('0xc')]('/',auth[_0xdde9('0x9')](),controller[_0xdde9('0xd')]);router[_0xdde9('0xe')](_0xdde9('0xb'),auth[_0xdde9('0x9')](),controller[_0xdde9('0xf')]);router['delete'](_0xdde9('0xb'),auth['isAuthenticated'](),controller[_0xdde9('0x10')]);module[_0xdde9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b6814de..e5b162c 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 _0xc9a6=['sequelize','ENUM','customVariable','keyValue','picklist','STRING','string'];(function(_0x2ea1b6,_0x1b2a39){var _0x1d4316=function(_0x25b9b9){while(--_0x25b9b9){_0x2ea1b6['push'](_0x2ea1b6['shift']());}};_0x1d4316(++_0x1b2a39);}(_0xc9a6,0x1b9));var _0x6c9a=function(_0x3c1a91,_0x12a48b){_0x3c1a91=_0x3c1a91-0x0;var _0x4181e3=_0xc9a6[_0x3c1a91];return _0x4181e3;};'use strict';var Sequelize=require(_0x6c9a('0x0'));module['exports']={'type':{'type':Sequelize[_0x6c9a('0x1')]('string','variable',_0x6c9a('0x2'),_0x6c9a('0x3'),_0x6c9a('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6c9a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6c9a('0x1')](_0x6c9a('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6c9a('0x5')]},'idField':{'type':Sequelize[_0x6c9a('0x5')]},'variableName':{'type':Sequelize[_0x6c9a('0x5')]}}; \ No newline at end of file +var _0xeef1=['keyValue','picklist','STRING','sequelize','exports','string','customVariable'];(function(_0x50f21f,_0x26c387){var _0x42334a=function(_0x420c94){while(--_0x420c94){_0x50f21f['push'](_0x50f21f['shift']());}};_0x42334a(++_0x26c387);}(_0xeef1,0x1d1));var _0x1eef=function(_0x4eed5b,_0x3961d0){_0x4eed5b=_0x4eed5b-0x0;var _0x4e292f=_0xeef1[_0x4eed5b];return _0x4e292f;};'use strict';var Sequelize=require(_0x1eef('0x0'));module[_0x1eef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1eef('0x2'),'variable',_0x1eef('0x3'),_0x1eef('0x4'),_0x1eef('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1eef('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x1eef('0x3'))},'keyContent':{'type':Sequelize[_0x1eef('0x6')]},'idField':{'type':Sequelize['STRING']},'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 fb42559..813edbf 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 _0x57af=['index','map','SalesforceField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57af,0x1a7));var _0xf57a=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x57af[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0xf57a('0x0'));var rimraf=require(_0xf57a('0x1'));var zipdir=require(_0xf57a('0x2'));var jsonpatch=require(_0xf57a('0x3'));var rp=require(_0xf57a('0x4'));var moment=require(_0xf57a('0x5'));var BPromise=require(_0xf57a('0x6'));var Mustache=require(_0xf57a('0x7'));var util=require(_0xf57a('0x8'));var path=require(_0xf57a('0x9'));var sox=require(_0xf57a('0xa'));var csv=require(_0xf57a('0xb'));var ejs=require(_0xf57a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf57a('0xd'));var squel=require(_0xf57a('0xe'));var crypto=require(_0xf57a('0xf'));var jsforce=require(_0xf57a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf57a('0xb'));var querystring=require(_0xf57a('0x11'));var Papa=require(_0xf57a('0x12'));var Redis=require(_0xf57a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf57a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf57a('0x15'));var logger=require('../../config/logger')(_0xf57a('0x16'));var utils=require('../../config/utils');var config=require(_0xf57a('0x17'));var licenseUtil=require(_0xf57a('0x18'));var db=require(_0xf57a('0x19'))['db'];function respondWithStatusCode(_0x4fc79c,_0x32e302){_0x32e302=_0x32e302||0xcc;return function(_0x1a0d8a){if(_0x1a0d8a){return _0x4fc79c['sendStatus'](_0x32e302);}return _0x4fc79c[_0xf57a('0x1a')](_0x32e302)[_0xf57a('0x1b')]();};}function respondWithResult(_0x418055,_0x555292){_0x555292=_0x555292||0xc8;return function(_0x540bc1){if(_0x540bc1){return _0x418055[_0xf57a('0x1a')](_0x555292)[_0xf57a('0x1c')](_0x540bc1);}};}function respondWithFilteredResult(_0x59f091,_0x2b3788){return function(_0x13f93c){if(_0x13f93c){var _0x5d2237=typeof _0x2b3788[_0xf57a('0x1d')]===_0xf57a('0x1e')&&typeof _0x2b3788[_0xf57a('0x1f')]===_0xf57a('0x1e');var _0x15a710=_0x13f93c[_0xf57a('0x20')];var _0x52f86f=_0x5d2237?0x0:_0x2b3788[_0xf57a('0x1d')];var _0x226259=_0x5d2237?_0x13f93c[_0xf57a('0x20')]:_0x2b3788[_0xf57a('0x1d')]+_0x2b3788[_0xf57a('0x1f')];var _0x2c670a;if(_0x226259>=_0x15a710){_0x226259=_0x15a710;_0x2c670a=0xc8;}else{_0x2c670a=0xce;}_0x59f091[_0xf57a('0x1a')](_0x2c670a);return _0x59f091[_0xf57a('0x21')](_0xf57a('0x22'),_0x52f86f+'-'+_0x226259+'/'+_0x15a710)[_0xf57a('0x1c')](_0x13f93c);}return null;};}function patchUpdates(_0xf5065b){return function(_0x40a2db){try{jsonpatch[_0xf57a('0x23')](_0x40a2db,_0xf5065b,!![]);}catch(_0x5a35de){return BPromise[_0xf57a('0x24')](_0x5a35de);}return _0x40a2db[_0xf57a('0x25')]();};}function saveUpdates(_0xadaa38,_0x2077b5){return function(_0xa6e36e){if(_0xa6e36e){return _0xa6e36e[_0xf57a('0x26')](_0xadaa38)[_0xf57a('0x27')](function(_0x2508be){return _0x2508be;});}return null;};}function removeEntity(_0x34c91f,_0x5c1082){return function(_0xc5fd88){if(_0xc5fd88){return _0xc5fd88[_0xf57a('0x28')]()['then'](function(){_0x34c91f['status'](0xcc)[_0xf57a('0x1b')]();});}};}function handleEntityNotFound(_0x9acb82,_0xc942f5){return function(_0x2c7e90){if(!_0x2c7e90){_0x9acb82[_0xf57a('0x29')](0x194);}return _0x2c7e90;};}function handleError(_0x431cf3,_0x25e467){_0x25e467=_0x25e467||0x1f4;return function(_0x4dcfe4){logger[_0xf57a('0x2a')](_0x4dcfe4['stack']);if(_0x4dcfe4[_0xf57a('0x2b')]){delete _0x4dcfe4['name'];}_0x431cf3['status'](_0x25e467)[_0xf57a('0x2c')](_0x4dcfe4);};}exports[_0xf57a('0x2d')]=function(_0x320584,_0xbb6526){var _0x2d6f9d={},_0x45b052={},_0x301b47={'count':0x0,'rows':[]};var _0x1162bb=_[_0xf57a('0x2e')](db[_0xf57a('0x2f')]['rawAttributes'],function(_0x39c68d){return{'name':_0x39c68d[_0xf57a('0x30')],'type':_0x39c68d[_0xf57a('0x31')][_0xf57a('0x32')]};});_0x45b052[_0xf57a('0x33')]=_[_0xf57a('0x2e')](_0x1162bb,_0xf57a('0x2b'));_0x45b052['query']=_[_0xf57a('0x34')](_0x320584[_0xf57a('0x35')]);_0x45b052[_0xf57a('0x36')]=_[_0xf57a('0x37')](_0x45b052[_0xf57a('0x33')],_0x45b052[_0xf57a('0x35')]);_0x2d6f9d[_0xf57a('0x38')]=_[_0xf57a('0x37')](_0x45b052[_0xf57a('0x33')],qs[_0xf57a('0x39')](_0x320584['query'][_0xf57a('0x39')]));_0x2d6f9d[_0xf57a('0x38')]=_0x2d6f9d[_0xf57a('0x38')][_0xf57a('0x3a')]?_0x2d6f9d['attributes']:_0x45b052[_0xf57a('0x33')];if(!_0x320584[_0xf57a('0x35')][_0xf57a('0x3b')](_0xf57a('0x3c'))){_0x2d6f9d[_0xf57a('0x1f')]=qs[_0xf57a('0x1f')](_0x320584[_0xf57a('0x35')]['limit']);_0x2d6f9d['offset']=qs[_0xf57a('0x1d')](_0x320584['query'][_0xf57a('0x1d')]);}_0x2d6f9d['order']=qs[_0xf57a('0x3d')](_0x320584[_0xf57a('0x35')][_0xf57a('0x3d')]);_0x2d6f9d[_0xf57a('0x3e')]=qs[_0xf57a('0x36')](_[_0xf57a('0x3f')](_0x320584['query'],_0x45b052[_0xf57a('0x36')]),_0x1162bb);if(_0x320584[_0xf57a('0x35')][_0xf57a('0x40')]){_0x2d6f9d[_0xf57a('0x3e')]=_[_0xf57a('0x41')](_0x2d6f9d[_0xf57a('0x3e')],{'$or':_['map'](_0x1162bb,function(_0x41dd7f){if(_0x41dd7f[_0xf57a('0x31')]!==_0xf57a('0x42')){var _0x39d17a={};_0x39d17a[_0x41dd7f[_0xf57a('0x2b')]]={'$like':'%'+_0x320584[_0xf57a('0x35')][_0xf57a('0x40')]+'%'};return _0x39d17a;}})});}_0x2d6f9d=_[_0xf57a('0x41')]({},_0x2d6f9d,_0x320584[_0xf57a('0x43')]);var _0x54e60e={'where':_0x2d6f9d[_0xf57a('0x3e')]};return db[_0xf57a('0x2f')][_0xf57a('0x20')](_0x54e60e)[_0xf57a('0x27')](function(_0x55e69e){_0x301b47[_0xf57a('0x20')]=_0x55e69e;if(_0x320584[_0xf57a('0x35')][_0xf57a('0x44')]){_0x2d6f9d[_0xf57a('0x45')]=[{'all':!![]}];}return db[_0xf57a('0x2f')]['findAll'](_0x2d6f9d);})[_0xf57a('0x27')](function(_0x338595){_0x301b47[_0xf57a('0x46')]=_0x338595;return _0x301b47;})['then'](respondWithFilteredResult(_0xbb6526,_0x2d6f9d))[_0xf57a('0x47')](handleError(_0xbb6526,null));};exports[_0xf57a('0x48')]=function(_0x40f6f9,_0x16c4c1){var _0x57b028={'raw':!![],'where':{'id':_0x40f6f9[_0xf57a('0x49')]['id']}},_0x17a8ef={};_0x17a8ef['model']=_[_0xf57a('0x34')](db['SalesforceField'][_0xf57a('0x4a')]);_0x17a8ef['query']=_[_0xf57a('0x34')](_0x40f6f9[_0xf57a('0x35')]);_0x17a8ef[_0xf57a('0x36')]=_[_0xf57a('0x37')](_0x17a8ef[_0xf57a('0x33')],_0x17a8ef[_0xf57a('0x35')]);_0x57b028['attributes']=_[_0xf57a('0x37')](_0x17a8ef[_0xf57a('0x33')],qs['fields'](_0x40f6f9[_0xf57a('0x35')][_0xf57a('0x39')]));_0x57b028[_0xf57a('0x38')]=_0x57b028[_0xf57a('0x38')]['length']?_0x57b028[_0xf57a('0x38')]:_0x17a8ef[_0xf57a('0x33')];if(_0x40f6f9[_0xf57a('0x35')][_0xf57a('0x44')]){_0x57b028[_0xf57a('0x45')]=[{'all':!![]}];}_0x57b028=_['merge']({},_0x57b028,_0x40f6f9[_0xf57a('0x43')]);return db[_0xf57a('0x2f')][_0xf57a('0x4b')](_0x57b028)[_0xf57a('0x27')](handleEntityNotFound(_0x16c4c1,null))['then'](respondWithResult(_0x16c4c1,null))[_0xf57a('0x47')](handleError(_0x16c4c1,null));};exports[_0xf57a('0x4c')]=function(_0x8d6bc7,_0x30fe32){return db[_0xf57a('0x2f')][_0xf57a('0x4c')](_0x8d6bc7[_0xf57a('0x4d')],{})[_0xf57a('0x27')](respondWithResult(_0x30fe32,0xc9))['catch'](handleError(_0x30fe32,null));};exports['update']=function(_0x30a532,_0x287334){if(_0x30a532[_0xf57a('0x4d')]['id']){delete _0x30a532[_0xf57a('0x4d')]['id'];}return db[_0xf57a('0x2f')][_0xf57a('0x4b')]({'where':{'id':_0x30a532['params']['id']}})['then'](handleEntityNotFound(_0x287334,null))[_0xf57a('0x27')](saveUpdates(_0x30a532[_0xf57a('0x4d')],null))['then'](respondWithResult(_0x287334,null))['catch'](handleError(_0x287334,null));};exports[_0xf57a('0x28')]=function(_0x38eb88,_0x3870c9){return db[_0xf57a('0x2f')][_0xf57a('0x4b')]({'where':{'id':_0x38eb88[_0xf57a('0x49')]['id']}})[_0xf57a('0x27')](handleEntityNotFound(_0x3870c9,null))[_0xf57a('0x27')](removeEntity(_0x3870c9,null))[_0xf57a('0x47')](handleError(_0x3870c9,null));}; \ No newline at end of file +var _0x803b=['catch','show','params','keys','intersection','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x803b,0x1c6));var _0xb803=function(_0x55bdd6,_0x1e4b9c){_0x55bdd6=_0x55bdd6-0x0;var _0x43a9a3=_0x803b[_0x55bdd6];return _0x43a9a3;};'use strict';var emlformat=require(_0xb803('0x0'));var rimraf=require(_0xb803('0x1'));var zipdir=require(_0xb803('0x2'));var jsonpatch=require(_0xb803('0x3'));var rp=require('request-promise');var moment=require(_0xb803('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb803('0x5'));var util=require('util');var path=require(_0xb803('0x6'));var sox=require(_0xb803('0x7'));var csv=require(_0xb803('0x8'));var ejs=require(_0xb803('0x9'));var fs=require('fs');var fs_extra=require(_0xb803('0xa'));var _=require(_0xb803('0xb'));var squel=require('squel');var crypto=require(_0xb803('0xc'));var jsforce=require(_0xb803('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb803('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb803('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb803('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb803('0x11'))('api');var utils=require(_0xb803('0x12'));var config=require(_0xb803('0x13'));var licenseUtil=require(_0xb803('0x14'));var db=require(_0xb803('0x15'))['db'];function respondWithStatusCode(_0x1ecf5a,_0x164566){_0x164566=_0x164566||0xcc;return function(_0x555d6c){if(_0x555d6c){return _0x1ecf5a[_0xb803('0x16')](_0x164566);}return _0x1ecf5a[_0xb803('0x17')](_0x164566)['end']();};}function respondWithResult(_0x3e9cf1,_0x3dfebd){_0x3dfebd=_0x3dfebd||0xc8;return function(_0x518a62){if(_0x518a62){return _0x3e9cf1['status'](_0x3dfebd)[_0xb803('0x18')](_0x518a62);}};}function respondWithFilteredResult(_0x24982f,_0x586789){return function(_0x4e75e8){if(_0x4e75e8){var _0x2369b6=typeof _0x586789[_0xb803('0x19')]==='undefined'&&typeof _0x586789[_0xb803('0x1a')]===_0xb803('0x1b');var _0x45ff70=_0x4e75e8[_0xb803('0x1c')];var _0x58ef20=_0x2369b6?0x0:_0x586789['offset'];var _0x590be6=_0x2369b6?_0x4e75e8['count']:_0x586789[_0xb803('0x19')]+_0x586789[_0xb803('0x1a')];var _0xd0b1f9;if(_0x590be6>=_0x45ff70){_0x590be6=_0x45ff70;_0xd0b1f9=0xc8;}else{_0xd0b1f9=0xce;}_0x24982f[_0xb803('0x17')](_0xd0b1f9);return _0x24982f[_0xb803('0x1d')](_0xb803('0x1e'),_0x58ef20+'-'+_0x590be6+'/'+_0x45ff70)[_0xb803('0x18')](_0x4e75e8);}return null;};}function patchUpdates(_0x5efe59){return function(_0x223490){try{jsonpatch[_0xb803('0x1f')](_0x223490,_0x5efe59,!![]);}catch(_0x3b6169){return BPromise['reject'](_0x3b6169);}return _0x223490[_0xb803('0x20')]();};}function saveUpdates(_0x5d7226,_0x3e0d11){return function(_0x4d9c7b){if(_0x4d9c7b){return _0x4d9c7b['update'](_0x5d7226)[_0xb803('0x21')](function(_0x4dc248){return _0x4dc248;});}return null;};}function removeEntity(_0x5d3054,_0x10405e){return function(_0x5794d2){if(_0x5794d2){return _0x5794d2[_0xb803('0x22')]()['then'](function(){_0x5d3054[_0xb803('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15369e,_0x3e5948){return function(_0x143247){if(!_0x143247){_0x15369e[_0xb803('0x16')](0x194);}return _0x143247;};}function handleError(_0x16f655,_0x3119ce){_0x3119ce=_0x3119ce||0x1f4;return function(_0x2bacc9){logger[_0xb803('0x23')](_0x2bacc9['stack']);if(_0x2bacc9[_0xb803('0x24')]){delete _0x2bacc9['name'];}_0x16f655[_0xb803('0x17')](_0x3119ce)[_0xb803('0x25')](_0x2bacc9);};}exports[_0xb803('0x26')]=function(_0x2c1021,_0x4cac85){var _0x18fd7c={},_0x65bba4={},_0x4e7d7d={'count':0x0,'rows':[]};var _0x49776b=_[_0xb803('0x27')](db[_0xb803('0x28')][_0xb803('0x29')],function(_0x4a9657){return{'name':_0x4a9657[_0xb803('0x2a')],'type':_0x4a9657[_0xb803('0x2b')][_0xb803('0x2c')]};});_0x65bba4[_0xb803('0x2d')]=_[_0xb803('0x27')](_0x49776b,_0xb803('0x24'));_0x65bba4[_0xb803('0x2e')]=_['keys'](_0x2c1021[_0xb803('0x2e')]);_0x65bba4[_0xb803('0x2f')]=_['intersection'](_0x65bba4[_0xb803('0x2d')],_0x65bba4[_0xb803('0x2e')]);_0x18fd7c[_0xb803('0x30')]=_['intersection'](_0x65bba4['model'],qs['fields'](_0x2c1021[_0xb803('0x2e')][_0xb803('0x31')]));_0x18fd7c[_0xb803('0x30')]=_0x18fd7c[_0xb803('0x30')][_0xb803('0x32')]?_0x18fd7c['attributes']:_0x65bba4[_0xb803('0x2d')];if(!_0x2c1021['query'][_0xb803('0x33')](_0xb803('0x34'))){_0x18fd7c[_0xb803('0x1a')]=qs['limit'](_0x2c1021[_0xb803('0x2e')][_0xb803('0x1a')]);_0x18fd7c[_0xb803('0x19')]=qs[_0xb803('0x19')](_0x2c1021[_0xb803('0x2e')][_0xb803('0x19')]);}_0x18fd7c[_0xb803('0x35')]=qs[_0xb803('0x36')](_0x2c1021[_0xb803('0x2e')][_0xb803('0x36')]);_0x18fd7c[_0xb803('0x37')]=qs[_0xb803('0x2f')](_[_0xb803('0x38')](_0x2c1021[_0xb803('0x2e')],_0x65bba4[_0xb803('0x2f')]),_0x49776b);if(_0x2c1021['query'][_0xb803('0x39')]){_0x18fd7c[_0xb803('0x37')]=_[_0xb803('0x3a')](_0x18fd7c[_0xb803('0x37')],{'$or':_[_0xb803('0x27')](_0x49776b,function(_0x3111ca){if(_0x3111ca[_0xb803('0x2b')]!==_0xb803('0x3b')){var _0x109f3a={};_0x109f3a[_0x3111ca[_0xb803('0x24')]]={'$like':'%'+_0x2c1021['query'][_0xb803('0x39')]+'%'};return _0x109f3a;}})});}_0x18fd7c=_[_0xb803('0x3a')]({},_0x18fd7c,_0x2c1021['options']);var _0x58a0c8={'where':_0x18fd7c[_0xb803('0x37')]};return db[_0xb803('0x28')][_0xb803('0x1c')](_0x58a0c8)[_0xb803('0x21')](function(_0x1af0c8){_0x4e7d7d[_0xb803('0x1c')]=_0x1af0c8;if(_0x2c1021[_0xb803('0x2e')][_0xb803('0x3c')]){_0x18fd7c[_0xb803('0x3d')]=[{'all':!![]}];}return db['SalesforceField'][_0xb803('0x3e')](_0x18fd7c);})[_0xb803('0x21')](function(_0x1fafe4){_0x4e7d7d[_0xb803('0x3f')]=_0x1fafe4;return _0x4e7d7d;})['then'](respondWithFilteredResult(_0x4cac85,_0x18fd7c))[_0xb803('0x40')](handleError(_0x4cac85,null));};exports[_0xb803('0x41')]=function(_0x1b34e8,_0x259c5a){var _0x3cf14c={'raw':!![],'where':{'id':_0x1b34e8[_0xb803('0x42')]['id']}},_0x12406d={};_0x12406d[_0xb803('0x2d')]=_[_0xb803('0x43')](db['SalesforceField'][_0xb803('0x29')]);_0x12406d[_0xb803('0x2e')]=_['keys'](_0x1b34e8[_0xb803('0x2e')]);_0x12406d[_0xb803('0x2f')]=_['intersection'](_0x12406d['model'],_0x12406d[_0xb803('0x2e')]);_0x3cf14c[_0xb803('0x30')]=_[_0xb803('0x44')](_0x12406d['model'],qs['fields'](_0x1b34e8[_0xb803('0x2e')][_0xb803('0x31')]));_0x3cf14c[_0xb803('0x30')]=_0x3cf14c[_0xb803('0x30')]['length']?_0x3cf14c[_0xb803('0x30')]:_0x12406d[_0xb803('0x2d')];if(_0x1b34e8[_0xb803('0x2e')]['includeAll']){_0x3cf14c[_0xb803('0x3d')]=[{'all':!![]}];}_0x3cf14c=_[_0xb803('0x3a')]({},_0x3cf14c,_0x1b34e8[_0xb803('0x45')]);return db[_0xb803('0x28')][_0xb803('0x46')](_0x3cf14c)[_0xb803('0x21')](handleEntityNotFound(_0x259c5a,null))[_0xb803('0x21')](respondWithResult(_0x259c5a,null))[_0xb803('0x40')](handleError(_0x259c5a,null));};exports[_0xb803('0x47')]=function(_0x12519e,_0x5df149){return db['SalesforceField'][_0xb803('0x47')](_0x12519e[_0xb803('0x48')],{})['then'](respondWithResult(_0x5df149,0xc9))[_0xb803('0x40')](handleError(_0x5df149,null));};exports[_0xb803('0x49')]=function(_0x5c0c7e,_0x55d349){if(_0x5c0c7e['body']['id']){delete _0x5c0c7e[_0xb803('0x48')]['id'];}return db[_0xb803('0x28')][_0xb803('0x46')]({'where':{'id':_0x5c0c7e[_0xb803('0x42')]['id']}})[_0xb803('0x21')](handleEntityNotFound(_0x55d349,null))[_0xb803('0x21')](saveUpdates(_0x5c0c7e[_0xb803('0x48')],null))['then'](respondWithResult(_0x55d349,null))[_0xb803('0x40')](handleError(_0x55d349,null));};exports['destroy']=function(_0x136e11,_0x45c1b2){return db[_0xb803('0x28')][_0xb803('0x46')]({'where':{'id':_0x136e11[_0xb803('0x42')]['id']}})[_0xb803('0x21')](handleEntityNotFound(_0x45c1b2,null))[_0xb803('0x21')](removeEntity(_0x45c1b2,null))[_0xb803('0x40')](handleError(_0x45c1b2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index fbd6a00..4f87574 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 _0x72ed=['path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0x72ed,0x89));var _0xd72e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x72ed[_0xac151d];return _0x111dba;};'use strict';var _=require(_0xd72e('0x0'));var util=require(_0xd72e('0x1'));var logger=require(_0xd72e('0x2'))(_0xd72e('0x3'));var moment=require(_0xd72e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd72e('0x5'));var fs=require('fs');var path=require(_0xd72e('0x6'));var rimraf=require(_0xd72e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd72e('0x8'));module[_0xd72e('0x9')]=function(_0x5221ee,_0x3f566f){return _0x5221ee[_0xd72e('0xa')]('SalesforceField',attributes,{'tableName':_0xd72e('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xd72e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64a7=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField'];(function(_0x2587c4,_0x5e61f3){var _0x4188fb=function(_0x2f60f3){while(--_0x2f60f3){_0x2587c4['push'](_0x2587c4['shift']());}};_0x4188fb(++_0x5e61f3);}(_0x64a7,0x121));var _0x764a=function(_0x23b9a1,_0x4af1dc){_0x23b9a1=_0x23b9a1-0x0;var _0x31ad2d=_0x64a7[_0x23b9a1];return _0x31ad2d;};'use strict';var _=require('lodash');var util=require(_0x764a('0x0'));var logger=require(_0x764a('0x1'))(_0x764a('0x2'));var moment=require(_0x764a('0x3'));var BPromise=require(_0x764a('0x4'));var rp=require(_0x764a('0x5'));var fs=require('fs');var path=require(_0x764a('0x6'));var rimraf=require('rimraf');var config=require(_0x764a('0x7'));var attributes=require(_0x764a('0x8'));module[_0x764a('0x9')]=function(_0x1c7979,_0x3e400a){return _0x1c7979['define'](_0x764a('0xa'),attributes,{'tableName':_0x764a('0xb'),'paranoid':![],'indexes':[{'name':_0x764a('0xc'),'fields':[_0x764a('0xd'),_0x764a('0xe')],'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 4ef0cfc..798fb37 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 _0x43c8=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x43c8,0x10a));var _0x843c=function(_0x201d6a,_0x3d6de5){_0x201d6a=_0x201d6a-0x0;var _0x124669=_0x43c8[_0x201d6a];return _0x124669;};'use strict';var _=require(_0x843c('0x0'));var util=require(_0x843c('0x1'));var moment=require(_0x843c('0x2'));var BPromise=require(_0x843c('0x3'));var rs=require(_0x843c('0x4'));var fs=require('fs');var Redis=require(_0x843c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x843c('0x6'));var logger=require(_0x843c('0x7'))('rpc');var config=require(_0x843c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x843c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c499d,_0x210dbc,_0x2505e1){return new BPromise(function(_0x296554,_0xbbd79d){return client[_0x843c('0xa')](_0x4c499d,_0x2505e1)[_0x843c('0xb')](function(_0x1fcf88){logger[_0x843c('0xc')](_0x843c('0xd'),_0x210dbc,_0x843c('0xe'));logger[_0x843c('0xf')](_0x843c('0x10'),_0x210dbc,_0x843c('0xe'),JSON['stringify'](_0x1fcf88));if(_0x1fcf88['error']){if(_0x1fcf88[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xd'),_0x210dbc,_0x1fcf88['error']['message']);return _0xbbd79d(_0x1fcf88[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xd'),_0x210dbc,_0x1fcf88['error'][_0x843c('0x13')]);return _0x296554(_0x1fcf88[_0x843c('0x11')][_0x843c('0x13')]);}else{logger['info'](_0x843c('0xd'),_0x210dbc,_0x843c('0xe'));_0x296554(_0x1fcf88[_0x843c('0x14')][_0x843c('0x13')]);}})[_0x843c('0x15')](function(_0x464830){logger[_0x843c('0x11')](_0x843c('0xd'),_0x210dbc,_0x464830);_0xbbd79d(_0x464830);});});} \ No newline at end of file +var _0x388d=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','code','error','SalesforceField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x388d,0x107));var _0xd388=function(_0xbaa3c2,_0x55e2c1){_0xbaa3c2=_0xbaa3c2-0x0;var _0x20eb21=_0x388d[_0xbaa3c2];return _0x20eb21;};'use strict';var _=require(_0xd388('0x0'));var util=require(_0xd388('0x1'));var moment=require(_0xd388('0x2'));var BPromise=require(_0xd388('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd388('0x4'));var db=require(_0xd388('0x5'))['db'];var utils=require(_0xd388('0x6'));var logger=require(_0xd388('0x7'))(_0xd388('0x8'));var config=require('../../config/environment');var jayson=require(_0xd388('0x9'));var client=jayson[_0xd388('0xa')][_0xd388('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a7054,_0x2f7e70,_0x357ed2){return new BPromise(function(_0x1e9d74,_0x5d1634){return client['request'](_0x2a7054,_0x357ed2)[_0xd388('0xc')](function(_0x6236fa){logger['info']('SalesforceField,\x20%s,\x20%s',_0x2f7e70,_0xd388('0xd'));logger[_0xd388('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2f7e70,'request\x20sent',JSON['stringify'](_0x6236fa));if(_0x6236fa['error']){if(_0x6236fa['error'][_0xd388('0xf')]===0x1f4){logger[_0xd388('0x10')](_0xd388('0x11'),_0x2f7e70,_0x6236fa[_0xd388('0x10')][_0xd388('0x12')]);return _0x5d1634(_0x6236fa[_0xd388('0x10')]['message']);}logger['error'](_0xd388('0x11'),_0x2f7e70,_0x6236fa[_0xd388('0x10')][_0xd388('0x12')]);return _0x1e9d74(_0x6236fa[_0xd388('0x10')][_0xd388('0x12')]);}else{logger[_0xd388('0x13')](_0xd388('0x11'),_0x2f7e70,_0xd388('0xd'));_0x1e9d74(_0x6236fa[_0xd388('0x14')]['message']);}})[_0xd388('0x15')](function(_0x5da427){logger['error']('SalesforceField,\x20%s,\x20%s',_0x2f7e70,_0x5da427);_0x5d1634(_0x5da427);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cc0ad6e..fcb354d 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 _0x22ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','addConfiguration','put','update','destroy','exports','multer','util','express','Router'];(function(_0x2f7023,_0x1aa399){var _0x2f5e4e=function(_0x1fa5d4){while(--_0x1fa5d4){_0x2f7023['push'](_0x2f7023['shift']());}};_0x2f5e4e(++_0x1aa399);}(_0x22ef,0xd8));var _0xf22e=function(_0x22c543,_0xb4632d){_0x22c543=_0x22c543-0x0;var _0x284b19=_0x22ef[_0x22c543];return _0x284b19;};'use strict';var multer=require(_0xf22e('0x0'));var util=require(_0xf22e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf22e('0x2'));var router=express[_0xf22e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf22e('0x4'));var interaction=require(_0xf22e('0x5'));var config=require(_0xf22e('0x6'));var controller=require(_0xf22e('0x7'));router[_0xf22e('0x8')]('/',auth[_0xf22e('0x9')](),controller[_0xf22e('0xa')]);router[_0xf22e('0x8')](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller[_0xf22e('0xc')]);router[_0xf22e('0x8')](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller['getConfigurations']);router[_0xf22e('0x8')](_0xf22e('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf22e('0xd'),auth[_0xf22e('0x9')](),controller[_0xf22e('0xf')]);router[_0xf22e('0x10')](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller[_0xf22e('0x11')]);router['delete'](_0xf22e('0xb'),auth[_0xf22e('0x9')](),controller[_0xf22e('0x12')]);module[_0xf22e('0x13')]=router; \ No newline at end of file +var _0x46cd=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','/:id','isAuthenticated','/:id/fields','getFields','post'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x46cd,0x181));var _0xd46c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x46cd[_0x556927];return _0x5f1235;};'use strict';var multer=require('multer');var util=require(_0xd46c('0x0'));var path=require(_0xd46c('0x1'));var timeout=require(_0xd46c('0x2'));var express=require('express');var router=express[_0xd46c('0x3')]();var fs_extra=require(_0xd46c('0x4'));var auth=require(_0xd46c('0x5'));var interaction=require(_0xd46c('0x6'));var config=require('../../config/environment');var controller=require(_0xd46c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd46c('0x8')](_0xd46c('0x9'),auth[_0xd46c('0xa')](),controller['show']);router[_0xd46c('0x8')]('/:id/configurations',auth[_0xd46c('0xa')](),controller['getConfigurations']);router[_0xd46c('0x8')](_0xd46c('0xb'),auth[_0xd46c('0xa')](),controller[_0xd46c('0xc')]);router[_0xd46c('0xd')]('/',auth['isAuthenticated'](),controller[_0xd46c('0xe')]);router[_0xd46c('0xd')](_0xd46c('0xf'),auth[_0xd46c('0xa')](),controller[_0xd46c('0x10')]);router[_0xd46c('0x11')](_0xd46c('0x9'),auth[_0xd46c('0xa')](),controller[_0xd46c('0x12')]);router[_0xd46c('0x13')](_0xd46c('0x9'),auth[_0xd46c('0xa')](),controller[_0xd46c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b8af862..a559892 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 _0xb0b7=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1221f4,_0x6ffa86){var _0x5ef5b9=function(_0x20ec48){while(--_0x20ec48){_0x1221f4['push'](_0x1221f4['shift']());}};_0x5ef5b9(++_0x6ffa86);}(_0xb0b7,0x1dc));var _0x7b0b=function(_0x4afb9a,_0x2221a4){_0x4afb9a=_0x4afb9a-0x0;var _0x221c13=_0xb0b7[_0x4afb9a];return _0x221c13;};'use strict';var Sequelize=require(_0x7b0b('0x0'));module[_0x7b0b('0x1')]={'name':{'type':Sequelize[_0x7b0b('0x2')]},'description':{'type':Sequelize[_0x7b0b('0x2')]},'username':{'type':Sequelize[_0x7b0b('0x2')],'unique':_0x7b0b('0x3')},'password':{'type':Sequelize[_0x7b0b('0x2')]},'email':{'type':Sequelize[_0x7b0b('0x2')]},'remoteUri':{'type':Sequelize[_0x7b0b('0x2')],'unique':_0x7b0b('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8935=['username','remoteUri','sequelize','exports','STRING'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x8935,0x93));var _0x5893=function(_0x551e6b,_0x378961){_0x551e6b=_0x551e6b-0x0;var _0x5e35cb=_0x8935[_0x551e6b];return _0x5e35cb;};'use strict';var Sequelize=require(_0x5893('0x0'));module[_0x5893('0x1')]={'name':{'type':Sequelize[_0x5893('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5893('0x2')],'unique':_0x5893('0x3')},'password':{'type':Sequelize[_0x5893('0x2')]},'email':{'type':Sequelize[_0x5893('0x2')]},'remoteUri':{'type':Sequelize[_0x5893('0x2')],'unique':_0x5893('0x4')},'serverUrl':{'type':Sequelize[_0x5893('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index dcc3bb8..cc24493 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 _0x8d3d=['urgency','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','internalType','push','all','TCL:\x20_object','remove','log','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getConfigurations','findOne','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','getFields','made_sla','hold_reason','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','close_code','correlation_display','work_start','assignment_group','description','notify','follow_up','parent_incident','sys_id','contact_type','reopened_by'];(function(_0x3d5859,_0x235c11){var _0x4e94fa=function(_0x4ae203){while(--_0x4ae203){_0x3d5859['push'](_0x3d5859['shift']());}};_0x4e94fa(++_0x235c11);}(_0x8d3d,0xe0));var _0xd8d3=function(_0x163771,_0x32ff4d){_0x163771=_0x163771-0x0;var _0x9e0233=_0x8d3d[_0x163771];return _0x9e0233;};'use strict';var emlformat=require(_0xd8d3('0x0'));var rimraf=require(_0xd8d3('0x1'));var zipdir=require(_0xd8d3('0x2'));var jsonpatch=require(_0xd8d3('0x3'));var rp=require(_0xd8d3('0x4'));var moment=require(_0xd8d3('0x5'));var BPromise=require(_0xd8d3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8d3('0x7'));var sox=require(_0xd8d3('0x8'));var csv=require(_0xd8d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8d3('0xa'));var _=require(_0xd8d3('0xb'));var squel=require(_0xd8d3('0xc'));var crypto=require(_0xd8d3('0xd'));var jsforce=require(_0xd8d3('0xe'));var deskjs=require(_0xd8d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd8d3('0x10'));var Papa=require(_0xd8d3('0x11'));var Redis=require(_0xd8d3('0x12'));var authService=require(_0xd8d3('0x13'));var qs=require(_0xd8d3('0x14'));var as=require(_0xd8d3('0x15'));var hardwareService=require(_0xd8d3('0x16'));var logger=require(_0xd8d3('0x17'))(_0xd8d3('0x18'));var utils=require(_0xd8d3('0x19'));var config=require(_0xd8d3('0x1a'));var licenseUtil=require(_0xd8d3('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd8d3('0x1c'));function respondWithStatusCode(_0x1ec66b,_0x5299b8){_0x5299b8=_0x5299b8||0xcc;return function(_0x20953f){if(_0x20953f){return _0x1ec66b[_0xd8d3('0x1d')](_0x5299b8);}return _0x1ec66b[_0xd8d3('0x1e')](_0x5299b8)[_0xd8d3('0x1f')]();};}function respondWithResult(_0x2fe13c,_0x2213cf){_0x2213cf=_0x2213cf||0xc8;return function(_0x1a2aa7){if(_0x1a2aa7){return _0x2fe13c[_0xd8d3('0x1e')](_0x2213cf)[_0xd8d3('0x20')](_0x1a2aa7);}};}function respondWithFilteredResult(_0x317798,_0x5352e0){return function(_0x2131df){if(_0x2131df){var _0x313032=typeof _0x5352e0[_0xd8d3('0x21')]===_0xd8d3('0x22')&&typeof _0x5352e0[_0xd8d3('0x23')]==='undefined';var _0x45e247=_0x2131df[_0xd8d3('0x24')];var _0x3a1649=_0x313032?0x0:_0x5352e0[_0xd8d3('0x21')];var _0x2d6664=_0x313032?_0x2131df['count']:_0x5352e0[_0xd8d3('0x21')]+_0x5352e0[_0xd8d3('0x23')];var _0x50872b;if(_0x2d6664>=_0x45e247){_0x2d6664=_0x45e247;_0x50872b=0xc8;}else{_0x50872b=0xce;}_0x317798[_0xd8d3('0x1e')](_0x50872b);return _0x317798[_0xd8d3('0x25')](_0xd8d3('0x26'),_0x3a1649+'-'+_0x2d6664+'/'+_0x45e247)[_0xd8d3('0x20')](_0x2131df);}return null;};}function patchUpdates(_0x1eb539){return function(_0x4f2a20){try{jsonpatch[_0xd8d3('0x27')](_0x4f2a20,_0x1eb539,!![]);}catch(_0x2c765d){return BPromise[_0xd8d3('0x28')](_0x2c765d);}return _0x4f2a20[_0xd8d3('0x29')]();};}function saveUpdates(_0x42d5c1,_0x598311){return function(_0x41a7f7){if(_0x41a7f7){return _0x41a7f7[_0xd8d3('0x2a')](_0x42d5c1)[_0xd8d3('0x2b')](function(_0x1a367f){return _0x1a367f;});}return null;};}function removeEntity(_0x38d930,_0x182370){return function(_0x1d5e36){if(_0x1d5e36){return _0x1d5e36[_0xd8d3('0x2c')]()[_0xd8d3('0x2b')](function(){_0x38d930[_0xd8d3('0x1e')](0xcc)[_0xd8d3('0x1f')]();});}};}function handleEntityNotFound(_0x4cc894,_0x5d73a5){return function(_0x123b56){if(!_0x123b56){_0x4cc894['sendStatus'](0x194);}return _0x123b56;};}function handleError(_0x146be5,_0x5cf654){_0x5cf654=_0x5cf654||0x1f4;return function(_0x5ac7f4){logger[_0xd8d3('0x2d')](_0x5ac7f4[_0xd8d3('0x2e')]);if(_0x5ac7f4[_0xd8d3('0x2f')]){delete _0x5ac7f4['name'];}_0x146be5['status'](_0x5cf654)[_0xd8d3('0x30')](_0x5ac7f4);};}exports['index']=function(_0x6bbf7c,_0x19486b){var _0x3c1941={},_0xb41cdf={},_0x50dc12={'count':0x0,'rows':[]};var _0x2e62d4=_[_0xd8d3('0x31')](db[_0xd8d3('0x32')][_0xd8d3('0x33')],function(_0x423c5c){return{'name':_0x423c5c[_0xd8d3('0x34')],'type':_0x423c5c['type']['key']};});_0xb41cdf['model']=_[_0xd8d3('0x31')](_0x2e62d4,_0xd8d3('0x2f'));_0xb41cdf[_0xd8d3('0x35')]=_[_0xd8d3('0x36')](_0x6bbf7c[_0xd8d3('0x35')]);_0xb41cdf['filters']=_['intersection'](_0xb41cdf[_0xd8d3('0x37')],_0xb41cdf[_0xd8d3('0x35')]);_0x3c1941[_0xd8d3('0x38')]=_[_0xd8d3('0x39')](_0xb41cdf[_0xd8d3('0x37')],qs[_0xd8d3('0x3a')](_0x6bbf7c['query'][_0xd8d3('0x3a')]));_0x3c1941[_0xd8d3('0x38')]=_0x3c1941[_0xd8d3('0x38')][_0xd8d3('0x3b')]?_0x3c1941[_0xd8d3('0x38')]:_0xb41cdf['model'];if(!_0x6bbf7c[_0xd8d3('0x35')][_0xd8d3('0x3c')](_0xd8d3('0x3d'))){_0x3c1941['limit']=qs['limit'](_0x6bbf7c[_0xd8d3('0x35')]['limit']);_0x3c1941['offset']=qs[_0xd8d3('0x21')](_0x6bbf7c[_0xd8d3('0x35')][_0xd8d3('0x21')]);}_0x3c1941[_0xd8d3('0x3e')]=qs[_0xd8d3('0x3f')](_0x6bbf7c[_0xd8d3('0x35')][_0xd8d3('0x3f')]);_0x3c1941['where']=qs[_0xd8d3('0x40')](_[_0xd8d3('0x41')](_0x6bbf7c[_0xd8d3('0x35')],_0xb41cdf[_0xd8d3('0x40')]),_0x2e62d4);if(_0x6bbf7c[_0xd8d3('0x35')][_0xd8d3('0x42')]){_0x3c1941[_0xd8d3('0x43')]=_[_0xd8d3('0x44')](_0x3c1941[_0xd8d3('0x43')],{'$or':_[_0xd8d3('0x31')](_0x2e62d4,function(_0x3f1171){if(_0x3f1171[_0xd8d3('0x45')]!==_0xd8d3('0x46')){var _0x4cfd24={};_0x4cfd24[_0x3f1171[_0xd8d3('0x2f')]]={'$like':'%'+_0x6bbf7c[_0xd8d3('0x35')][_0xd8d3('0x42')]+'%'};return _0x4cfd24;}})});}_0x3c1941=_[_0xd8d3('0x44')]({},_0x3c1941,_0x6bbf7c['options']);var _0xc144e1={'where':_0x3c1941[_0xd8d3('0x43')]};return db[_0xd8d3('0x32')][_0xd8d3('0x24')](_0xc144e1)[_0xd8d3('0x2b')](function(_0x23ad33){_0x50dc12['count']=_0x23ad33;if(_0x6bbf7c['query'][_0xd8d3('0x47')]){_0x3c1941[_0xd8d3('0x48')]=[{'all':!![]}];}return db[_0xd8d3('0x32')][_0xd8d3('0x49')](_0x3c1941);})[_0xd8d3('0x2b')](function(_0x1f5d48){_0x50dc12[_0xd8d3('0x4a')]=_0x1f5d48;return _0x50dc12;})[_0xd8d3('0x2b')](respondWithFilteredResult(_0x19486b,_0x3c1941))['catch'](handleError(_0x19486b,null));};exports[_0xd8d3('0x4b')]=function(_0x139e00,_0x2f2bcd){var _0x1dbe62={'raw':![],'where':{'id':_0x139e00[_0xd8d3('0x4c')]['id']}},_0x26e5c8={};_0x26e5c8[_0xd8d3('0x37')]=_[_0xd8d3('0x36')](db[_0xd8d3('0x32')][_0xd8d3('0x33')]);_0x26e5c8[_0xd8d3('0x35')]=_['keys'](_0x139e00['query']);_0x26e5c8[_0xd8d3('0x40')]=_[_0xd8d3('0x39')](_0x26e5c8['model'],_0x26e5c8[_0xd8d3('0x35')]);_0x1dbe62[_0xd8d3('0x38')]=_[_0xd8d3('0x39')](_0x26e5c8[_0xd8d3('0x37')],qs['fields'](_0x139e00[_0xd8d3('0x35')]['fields']));_0x1dbe62[_0xd8d3('0x38')]=_0x1dbe62[_0xd8d3('0x38')][_0xd8d3('0x3b')]?_0x1dbe62['attributes']:_0x26e5c8['model'];if(_0x139e00[_0xd8d3('0x35')][_0xd8d3('0x47')]){_0x1dbe62[_0xd8d3('0x48')]=[{'all':!![]}];}_0x1dbe62=_[_0xd8d3('0x44')]({},_0x1dbe62,_0x139e00[_0xd8d3('0x4d')]);return db['ServicenowAccount'][_0xd8d3('0x4e')](_0x1dbe62)['then'](handleEntityNotFound(_0x2f2bcd,null))[_0xd8d3('0x2b')](respondWithResult(_0x2f2bcd,null))[_0xd8d3('0x4f')](handleError(_0x2f2bcd,null));};exports[_0xd8d3('0x50')]=function(_0x1d32b1,_0x3ca419){return db[_0xd8d3('0x32')][_0xd8d3('0x50')](_0x1d32b1['body'],{})['then'](respondWithResult(_0x3ca419,0xc9))[_0xd8d3('0x4f')](handleError(_0x3ca419,null));};exports['update']=function(_0x204972,_0x58f6d4){if(_0x204972[_0xd8d3('0x51')]['id']){delete _0x204972[_0xd8d3('0x51')]['id'];}return db[_0xd8d3('0x32')][_0xd8d3('0x4e')]({'where':{'id':_0x204972[_0xd8d3('0x4c')]['id']}})[_0xd8d3('0x2b')](handleEntityNotFound(_0x58f6d4,null))[_0xd8d3('0x2b')](saveUpdates(_0x204972[_0xd8d3('0x51')],null))[_0xd8d3('0x2b')](respondWithResult(_0x58f6d4,null))[_0xd8d3('0x4f')](handleError(_0x58f6d4,null));};exports['destroy']=function(_0x5ec1e3,_0x229fa6){return db[_0xd8d3('0x32')][_0xd8d3('0x4e')]({'where':{'id':_0x5ec1e3[_0xd8d3('0x4c')]['id']}})[_0xd8d3('0x2b')](handleEntityNotFound(_0x229fa6,null))[_0xd8d3('0x2b')](removeEntity(_0x229fa6,null))['catch'](handleError(_0x229fa6,null));};exports[_0xd8d3('0x52')]=function(_0x2123d5,_0x39c59e,_0x423b11){var _0x3cf3c0={};var _0x2bdc83={};var _0x4f7d80;var _0x56b414;return db[_0xd8d3('0x32')][_0xd8d3('0x53')]({'where':{'id':_0x2123d5['params']['id']}})[_0xd8d3('0x2b')](handleEntityNotFound(_0x39c59e,null))[_0xd8d3('0x2b')](function(_0x4e480f){if(_0x4e480f){_0x4f7d80=_0x4e480f;_0x2bdc83[_0xd8d3('0x37')]=_[_0xd8d3('0x36')](db['ServicenowConfiguration'][_0xd8d3('0x33')]);_0x2bdc83[_0xd8d3('0x35')]=_[_0xd8d3('0x36')](_0x2123d5['query']);_0x2bdc83[_0xd8d3('0x40')]=_[_0xd8d3('0x39')](_0x2bdc83[_0xd8d3('0x37')],_0x2bdc83[_0xd8d3('0x35')]);_0x3cf3c0[_0xd8d3('0x38')]=_[_0xd8d3('0x39')](_0x2bdc83[_0xd8d3('0x37')],qs[_0xd8d3('0x3a')](_0x2123d5[_0xd8d3('0x35')][_0xd8d3('0x3a')]));_0x3cf3c0[_0xd8d3('0x38')]=_0x3cf3c0[_0xd8d3('0x38')][_0xd8d3('0x3b')]?_0x3cf3c0['attributes']:_0x2bdc83[_0xd8d3('0x37')];_0x3cf3c0[_0xd8d3('0x3e')]=qs[_0xd8d3('0x3f')](_0x2123d5[_0xd8d3('0x35')]['sort']);_0x3cf3c0['where']=qs[_0xd8d3('0x40')](_[_0xd8d3('0x41')](_0x2123d5[_0xd8d3('0x35')],_0x2bdc83['filters']));if(_0x2123d5[_0xd8d3('0x35')][_0xd8d3('0x42')]){_0x3cf3c0[_0xd8d3('0x43')]=_[_0xd8d3('0x44')](_0x3cf3c0[_0xd8d3('0x43')],{'$or':_[_0xd8d3('0x31')](_0x3cf3c0[_0xd8d3('0x38')],function(_0x37cca4){var _0x44a907={};_0x44a907[_0x37cca4]={'$like':'%'+_0x2123d5[_0xd8d3('0x35')][_0xd8d3('0x42')]+'%'};return _0x44a907;})});}_0x3cf3c0=_[_0xd8d3('0x44')]({},_0x3cf3c0,_0x2123d5[_0xd8d3('0x4d')]);return _0x4f7d80['getConfigurations'](_0x3cf3c0);}})[_0xd8d3('0x2b')](function(_0x1fb67e){if(_0x1fb67e){_0x56b414=_0x1fb67e['length'];if(!_0x2123d5[_0xd8d3('0x35')][_0xd8d3('0x3c')](_0xd8d3('0x3d'))){_0x3cf3c0['limit']=qs[_0xd8d3('0x23')](_0x2123d5['query'][_0xd8d3('0x23')]);_0x3cf3c0['offset']=qs[_0xd8d3('0x21')](_0x2123d5[_0xd8d3('0x35')][_0xd8d3('0x21')]);}return _0x4f7d80[_0xd8d3('0x52')](_0x3cf3c0);}})[_0xd8d3('0x2b')](function(_0x185332){if(_0x185332){return _0x185332?{'count':_0x56b414,'rows':_0x185332}:null;}})['then'](respondWithResult(_0x39c59e,null))[_0xd8d3('0x4f')](handleError(_0x39c59e,null));};exports[_0xd8d3('0x54')]=function(_0x41ba30,_0x459c8d,_0x4993fb){if(_0x41ba30[_0xd8d3('0x51')]['id']){delete _0x41ba30[_0xd8d3('0x51')]['id'];}return db[_0xd8d3('0x32')][_0xd8d3('0x53')]({'where':{'id':_0x41ba30[_0xd8d3('0x4c')]['id']}})[_0xd8d3('0x2b')](handleEntityNotFound(_0x459c8d,null))[_0xd8d3('0x2b')](function(_0x1ed022){if(_0x1ed022){_0x41ba30['body']['AccountId']=_0x1ed022['id'];_0x41ba30['body']['Subjects']=integrations[_0xd8d3('0x55')](_0x41ba30[_0xd8d3('0x51')][_0xd8d3('0x56')],_0x41ba30['body'][_0xd8d3('0x45')]);_0x41ba30[_0xd8d3('0x51')][_0xd8d3('0x57')]=integrations[_0xd8d3('0x58')](_0x41ba30[_0xd8d3('0x51')][_0xd8d3('0x56')],_0x41ba30[_0xd8d3('0x51')][_0xd8d3('0x45')]);return db[_0xd8d3('0x59')][_0xd8d3('0x50')](_0x41ba30[_0xd8d3('0x51')],{'include':[{'model':db[_0xd8d3('0x5a')],'as':_0xd8d3('0x5b')},{'model':db[_0xd8d3('0x5a')],'as':_0xd8d3('0x57')}]});}return null;})[_0xd8d3('0x2b')](respondWithResult(_0x459c8d,null))[_0xd8d3('0x4f')](handleError(_0x459c8d,null));};exports[_0xd8d3('0x5c')]=function(_0x40eb56,_0x1774b5,_0x4a9008){var _0x5aa235=[_0xd8d3('0x5d'),_0xd8d3('0x5e'),'knowledge','subcategory','close_code','notify',_0xd8d3('0x5f'),_0xd8d3('0x60'),_0xd8d3('0x61')];var _0x49326c=[_0xd8d3('0x62'),_0xd8d3('0x5d'),_0xd8d3('0x63'),_0xd8d3('0x64'),_0xd8d3('0x65'),_0xd8d3('0x66'),_0xd8d3('0x67'),'hold_reason',_0xd8d3('0x68'),'number',_0xd8d3('0x69'),_0xd8d3('0x6a'),_0xd8d3('0x6b'),_0xd8d3('0x6c'),_0xd8d3('0x6d'),_0xd8d3('0x6e'),_0xd8d3('0x6f'),'sys_created_by',_0xd8d3('0x70'),_0xd8d3('0x3e'),_0xd8d3('0x71'),_0xd8d3('0x72'),'cmdb_ci',_0xd8d3('0x73'),_0xd8d3('0x74'),_0xd8d3('0x75'),_0xd8d3('0x76'),_0xd8d3('0x77'),_0xd8d3('0x78'),_0xd8d3('0x79'),'rfc','time_worked',_0xd8d3('0x7a'),_0xd8d3('0x7b'),_0xd8d3('0x7c'),_0xd8d3('0x7d'),_0xd8d3('0x7e'),_0xd8d3('0x7f'),_0xd8d3('0x80'),'caller_id','approval_set','subcategory','work_notes','short_description',_0xd8d3('0x81'),_0xd8d3('0x82'),'delivery_task',_0xd8d3('0x83'),_0xd8d3('0x84'),'business_stc','additional_assignee_list',_0xd8d3('0x85'),'calendar_duration',_0xd8d3('0x86'),'sys_class_name','close_notes','closed_by',_0xd8d3('0x87'),_0xd8d3('0x88'),_0xd8d3('0x89'),_0xd8d3('0x8a'),_0xd8d3('0x8b'),_0xd8d3('0x5f'),_0xd8d3('0x8c'),'problem_id',_0xd8d3('0x8d'),_0xd8d3('0x8e'),'activity_due',_0xd8d3('0x8f'),'severity',_0xd8d3('0x90'),_0xd8d3('0x91'),'approval',_0xd8d3('0x92'),'due_date',_0xd8d3('0x93'),_0xd8d3('0x94'),_0xd8d3('0x95'),_0xd8d3('0x96'),_0xd8d3('0x97'),'correlation_id','location',_0xd8d3('0x61')];var _0x124144='';var _0x281202='';var _0x214f60=[];var _0x14817e='';var _0x2226a7='';var _0x25ad90=[];var _0x26227b='';var _0x3f7c70='';var _0x6c3e5f={};var _0x287f78='';return db[_0xd8d3('0x32')][_0xd8d3('0x53')]({'where':{'id':_0x40eb56['params']['id']},'attributes':['id',_0xd8d3('0x98'),_0xd8d3('0x99'),_0xd8d3('0x9a'),_0xd8d3('0x9b'),'serverUrl']})[_0xd8d3('0x2b')](handleEntityNotFound(_0x1774b5,null))[_0xd8d3('0x2b')](function(_0x478e73){if(_0x478e73){_0x287f78=_0x478e73[_0xd8d3('0x9b')];var _0xb8c39b=_0x287f78['slice'](-0x1);if(_0xb8c39b==='/'){_0x287f78=_0x287f78['substring'](0x0,_0x287f78[_0xd8d3('0x9c')](_0xb8c39b));}_0x3f7c70=util[_0xd8d3('0x9d')]('%s/api/now/doc/table/schema/',_0x287f78);_0x26227b=util[_0xd8d3('0x9d')](_0xd8d3('0x9e'),_0x287f78);_0x6c3e5f={'user':_0x478e73[_0xd8d3('0x98')],'pass':_0x478e73['password']};var _0x471074={'method':'GET','uri':_0x3f7c70+_0xd8d3('0x9f'),'auth':_0x6c3e5f,'json':!![]};return rp(_0x471074);}})[_0xd8d3('0x2b')](function(_0x1fc0c5){if(_0x1fc0c5[_0xd8d3('0xa0')][_0xd8d3('0x3b')]>0x0){_0x124144=_0x1fc0c5[_0xd8d3('0xa0')];}console['log'](_0xd8d3('0xa1'),_0x124144);_0x25ad90=[];_0x281202=Object['assign']([],_0x124144);_['remove'](_0x281202,function(_0x120064){return!_0x5aa235[_0xd8d3('0xa2')](_0x120064[_0xd8d3('0x2f')]);});_0x281202[_0xd8d3('0xa3')](function(_0x667985){var _0x470033=createFieldObject(_0x26227b,_0x6c3e5f,_0x667985[_0xd8d3('0xa4')],_0x667985['name'],_0x667985['label'],![]);_0x25ad90[_0xd8d3('0xa5')](_0x470033);});return Promise[_0xd8d3('0xa6')](_0x25ad90);})[_0xd8d3('0x2b')](function(_0x283951){_0x214f60=_0x283951;_0x14817e=Object['assign']([],_0x124144);console['log'](_0xd8d3('0xa7'),_0x124144);_[_0xd8d3('0xa8')](_0x14817e,function(_0x13ced5){return _0x49326c[_0xd8d3('0xa2')](_0x13ced5[_0xd8d3('0x2f')]);});console[_0xd8d3('0xa9')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x14817e);_0x25ad90=[];_0x14817e[_0xd8d3('0xa3')](function(_0x172fd6){var _0xe54ec1=createFieldObject(_0x26227b,_0x6c3e5f,_0x172fd6[_0xd8d3('0xa4')],_0x172fd6[_0xd8d3('0x2f')],_0x172fd6[_0xd8d3('0xaa')],!![]);_0x25ad90[_0xd8d3('0xa5')](_0xe54ec1);});return Promise[_0xd8d3('0xa6')](_0x25ad90);})[_0xd8d3('0x2b')](function(_0x2328be){_0x2226a7=_0x2328be;var _0x19b0cd=_0x214f60[_0xd8d3('0xab')](_0x2226a7);return{'count':_0x19b0cd[_0xd8d3('0x3b')],'rows':_0x19b0cd};})[_0xd8d3('0x2b')](respondWithResult(_0x1774b5,null))['catch'](function(_0x57856b){console[_0xd8d3('0xa9')](_0xd8d3('0xac')+_0x57856b);var _0x562856=_0x40eb56[_0xd8d3('0x35')][_0xd8d3('0xad')]?0x1f4:_0x57856b[_0xd8d3('0xae')]||0x1f4;logger['error'](_0x57856b['stack']);delete _0x57856b[_0xd8d3('0x2f')];if(_0x562856===0x191){_0x562856=0x190;}_0x1774b5[_0xd8d3('0x1e')](_0x562856)['send'](_0x40eb56['query'][_0xd8d3('0xad')]?{'message':_0xd8d3('0xaf'),'statusCode':_0x57856b[_0xd8d3('0xae')]}:_0x57856b);});};function createFieldObject(_0x2132eb,_0x33f372,_0x3c4bd1,_0x3c64c9,_0xf11367,_0x186cb1){return new Promise(function(_0x336b14,_0x4cb944){var _0x108a11={'id':_0x3c64c9,'name':_0xf11367,'custom':_0x186cb1};if(_0x3c4bd1==='boolean'){_0x108a11[_0xd8d3('0x4d')]=[{'name':_0xd8d3('0xb0'),'value':'true'},{'name':_0xd8d3('0xb1'),'value':_0xd8d3('0xb2')}];_0x336b14(_0x108a11);}else{var _0x221c4f={'method':_0xd8d3('0xb3'),'uri':_0x2132eb+_0xd8d3('0xb4')+_0x3c64c9,'auth':_0x33f372,'json':!![]};return rp(_0x221c4f)['then'](function(_0x2a5efb){var _0x48ae6a=[];if(_0x2a5efb[_0xd8d3('0xa0')][_0xd8d3('0x3b')]>0x0){_0x2a5efb[_0xd8d3('0xa0')][_0xd8d3('0xa3')](function(_0x22b38e){if(_0x22b38e['inactive']==='false'){var _0x186647={'name':_0x22b38e[_0xd8d3('0xaa')],'value':_0x22b38e[_0xd8d3('0xb5')]};_0x48ae6a[_0xd8d3('0xa5')](_0x186647);}});}_0x108a11[_0xd8d3('0x4d')]=_0x48ae6a;if(_0x108a11[_0xd8d3('0x4d')][_0xd8d3('0x3b')]>0x0){_0x336b14(_0x108a11);}else{if(_0x186cb1==![]){_0x336b14();}else{_0x336b14(_0x108a11);}}});}});} \ No newline at end of file +var _0x4747=['comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','result','incident\x20table\x20objects','remove','includes','internalType','label','push','all','log','TCL:\x20_object','forEach','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','catch','show','merge','find','create','body','params','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','subcategory','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','problem_id','reassignment_count','activity_due','comments','approval'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0x4747,0x196));var _0x7474=function(_0x3cdcfb,_0x161e5c){_0x3cdcfb=_0x3cdcfb-0x0;var _0x59f5da=_0x4747[_0x3cdcfb];return _0x59f5da;};'use strict';var emlformat=require(_0x7474('0x0'));var rimraf=require(_0x7474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7474('0x2'));var rp=require('request-promise');var moment=require(_0x7474('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7474('0x4'));var util=require(_0x7474('0x5'));var path=require(_0x7474('0x6'));var sox=require(_0x7474('0x7'));var csv=require(_0x7474('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7474('0x9'));var squel=require(_0x7474('0xa'));var crypto=require(_0x7474('0xb'));var jsforce=require(_0x7474('0xc'));var deskjs=require(_0x7474('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7474('0xe'));var Papa=require('papaparse');var Redis=require(_0x7474('0xf'));var authService=require(_0x7474('0x10'));var qs=require(_0x7474('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7474('0x12'));var logger=require(_0x7474('0x13'))('api');var utils=require(_0x7474('0x14'));var config=require(_0x7474('0x15'));var licenseUtil=require(_0x7474('0x16'));var db=require(_0x7474('0x17'))['db'];var integrations=require(_0x7474('0x18'));function respondWithStatusCode(_0x55ce1c,_0x3f983f){_0x3f983f=_0x3f983f||0xcc;return function(_0x195a27){if(_0x195a27){return _0x55ce1c[_0x7474('0x19')](_0x3f983f);}return _0x55ce1c[_0x7474('0x1a')](_0x3f983f)[_0x7474('0x1b')]();};}function respondWithResult(_0x89ffa,_0x5b56e3){_0x5b56e3=_0x5b56e3||0xc8;return function(_0x85725e){if(_0x85725e){return _0x89ffa['status'](_0x5b56e3)[_0x7474('0x1c')](_0x85725e);}};}function respondWithFilteredResult(_0x355b76,_0x19674b){return function(_0x401761){if(_0x401761){var _0x706503=typeof _0x19674b['offset']===_0x7474('0x1d')&&typeof _0x19674b[_0x7474('0x1e')]===_0x7474('0x1d');var _0x1abea8=_0x401761[_0x7474('0x1f')];var _0x4caab4=_0x706503?0x0:_0x19674b['offset'];var _0x1c3a3c=_0x706503?_0x401761['count']:_0x19674b[_0x7474('0x20')]+_0x19674b[_0x7474('0x1e')];var _0x15bdec;if(_0x1c3a3c>=_0x1abea8){_0x1c3a3c=_0x1abea8;_0x15bdec=0xc8;}else{_0x15bdec=0xce;}_0x355b76[_0x7474('0x1a')](_0x15bdec);return _0x355b76[_0x7474('0x21')](_0x7474('0x22'),_0x4caab4+'-'+_0x1c3a3c+'/'+_0x1abea8)[_0x7474('0x1c')](_0x401761);}return null;};}function patchUpdates(_0x36f95b){return function(_0x36675d){try{jsonpatch[_0x7474('0x23')](_0x36675d,_0x36f95b,!![]);}catch(_0x71ecfc){return BPromise['reject'](_0x71ecfc);}return _0x36675d['save']();};}function saveUpdates(_0x28b9ad,_0x247c68){return function(_0x1f3e30){if(_0x1f3e30){return _0x1f3e30[_0x7474('0x24')](_0x28b9ad)[_0x7474('0x25')](function(_0x498b07){return _0x498b07;});}return null;};}function removeEntity(_0xcf0485,_0x5bd560){return function(_0x542641){if(_0x542641){return _0x542641[_0x7474('0x26')]()[_0x7474('0x25')](function(){_0xcf0485['status'](0xcc)[_0x7474('0x1b')]();});}};}function handleEntityNotFound(_0x1285f8,_0x5679bb){return function(_0x55991e){if(!_0x55991e){_0x1285f8[_0x7474('0x19')](0x194);}return _0x55991e;};}function handleError(_0x4754f1,_0x70fe7c){_0x70fe7c=_0x70fe7c||0x1f4;return function(_0x1bab42){logger[_0x7474('0x27')](_0x1bab42[_0x7474('0x28')]);if(_0x1bab42[_0x7474('0x29')]){delete _0x1bab42[_0x7474('0x29')];}_0x4754f1['status'](_0x70fe7c)[_0x7474('0x2a')](_0x1bab42);};}exports[_0x7474('0x2b')]=function(_0x76c9e,_0x7d5bf8){var _0x299554={},_0x21d3e5={},_0x343542={'count':0x0,'rows':[]};var _0x32ff18=_[_0x7474('0x2c')](db['ServicenowAccount'][_0x7474('0x2d')],function(_0x40b19c){return{'name':_0x40b19c[_0x7474('0x2e')],'type':_0x40b19c[_0x7474('0x2f')][_0x7474('0x30')]};});_0x21d3e5[_0x7474('0x31')]=_[_0x7474('0x2c')](_0x32ff18,_0x7474('0x29'));_0x21d3e5[_0x7474('0x32')]=_[_0x7474('0x33')](_0x76c9e[_0x7474('0x32')]);_0x21d3e5[_0x7474('0x34')]=_[_0x7474('0x35')](_0x21d3e5['model'],_0x21d3e5['query']);_0x299554[_0x7474('0x36')]=_['intersection'](_0x21d3e5[_0x7474('0x31')],qs[_0x7474('0x37')](_0x76c9e[_0x7474('0x32')][_0x7474('0x37')]));_0x299554[_0x7474('0x36')]=_0x299554[_0x7474('0x36')][_0x7474('0x38')]?_0x299554[_0x7474('0x36')]:_0x21d3e5[_0x7474('0x31')];if(!_0x76c9e[_0x7474('0x32')][_0x7474('0x39')](_0x7474('0x3a'))){_0x299554[_0x7474('0x1e')]=qs[_0x7474('0x1e')](_0x76c9e[_0x7474('0x32')][_0x7474('0x1e')]);_0x299554[_0x7474('0x20')]=qs[_0x7474('0x20')](_0x76c9e[_0x7474('0x32')][_0x7474('0x20')]);}_0x299554['order']=qs[_0x7474('0x3b')](_0x76c9e[_0x7474('0x32')][_0x7474('0x3b')]);_0x299554[_0x7474('0x3c')]=qs[_0x7474('0x34')](_[_0x7474('0x3d')](_0x76c9e[_0x7474('0x32')],_0x21d3e5[_0x7474('0x34')]),_0x32ff18);if(_0x76c9e[_0x7474('0x32')][_0x7474('0x3e')]){_0x299554[_0x7474('0x3c')]=_['merge'](_0x299554[_0x7474('0x3c')],{'$or':_['map'](_0x32ff18,function(_0x1bfc68){if(_0x1bfc68[_0x7474('0x2f')]!==_0x7474('0x3f')){var _0x1554ef={};_0x1554ef[_0x1bfc68[_0x7474('0x29')]]={'$like':'%'+_0x76c9e[_0x7474('0x32')]['filter']+'%'};return _0x1554ef;}})});}_0x299554=_['merge']({},_0x299554,_0x76c9e[_0x7474('0x40')]);var _0x196888={'where':_0x299554[_0x7474('0x3c')]};return db[_0x7474('0x41')][_0x7474('0x1f')](_0x196888)[_0x7474('0x25')](function(_0x37ffc8){_0x343542[_0x7474('0x1f')]=_0x37ffc8;if(_0x76c9e[_0x7474('0x32')][_0x7474('0x42')]){_0x299554['include']=[{'all':!![]}];}return db[_0x7474('0x41')][_0x7474('0x43')](_0x299554);})[_0x7474('0x25')](function(_0x4ff815){_0x343542[_0x7474('0x44')]=_0x4ff815;return _0x343542;})[_0x7474('0x25')](respondWithFilteredResult(_0x7d5bf8,_0x299554))[_0x7474('0x45')](handleError(_0x7d5bf8,null));};exports[_0x7474('0x46')]=function(_0xc07312,_0x101bc9){var _0x3b385f={'raw':![],'where':{'id':_0xc07312['params']['id']}},_0x2fed45={};_0x2fed45[_0x7474('0x31')]=_['keys'](db['ServicenowAccount'][_0x7474('0x2d')]);_0x2fed45[_0x7474('0x32')]=_['keys'](_0xc07312['query']);_0x2fed45[_0x7474('0x34')]=_[_0x7474('0x35')](_0x2fed45['model'],_0x2fed45['query']);_0x3b385f['attributes']=_[_0x7474('0x35')](_0x2fed45[_0x7474('0x31')],qs[_0x7474('0x37')](_0xc07312[_0x7474('0x32')][_0x7474('0x37')]));_0x3b385f[_0x7474('0x36')]=_0x3b385f['attributes']['length']?_0x3b385f[_0x7474('0x36')]:_0x2fed45['model'];if(_0xc07312[_0x7474('0x32')][_0x7474('0x42')]){_0x3b385f['include']=[{'all':!![]}];}_0x3b385f=_[_0x7474('0x47')]({},_0x3b385f,_0xc07312['options']);return db[_0x7474('0x41')][_0x7474('0x48')](_0x3b385f)['then'](handleEntityNotFound(_0x101bc9,null))[_0x7474('0x25')](respondWithResult(_0x101bc9,null))['catch'](handleError(_0x101bc9,null));};exports[_0x7474('0x49')]=function(_0x2b0686,_0x1140ee){return db[_0x7474('0x41')][_0x7474('0x49')](_0x2b0686[_0x7474('0x4a')],{})[_0x7474('0x25')](respondWithResult(_0x1140ee,0xc9))[_0x7474('0x45')](handleError(_0x1140ee,null));};exports[_0x7474('0x24')]=function(_0x12b70b,_0x380112){if(_0x12b70b[_0x7474('0x4a')]['id']){delete _0x12b70b[_0x7474('0x4a')]['id'];}return db[_0x7474('0x41')][_0x7474('0x48')]({'where':{'id':_0x12b70b['params']['id']}})['then'](handleEntityNotFound(_0x380112,null))['then'](saveUpdates(_0x12b70b[_0x7474('0x4a')],null))[_0x7474('0x25')](respondWithResult(_0x380112,null))[_0x7474('0x45')](handleError(_0x380112,null));};exports[_0x7474('0x26')]=function(_0xf30aa9,_0x285279){return db[_0x7474('0x41')][_0x7474('0x48')]({'where':{'id':_0xf30aa9[_0x7474('0x4b')]['id']}})[_0x7474('0x25')](handleEntityNotFound(_0x285279,null))[_0x7474('0x25')](removeEntity(_0x285279,null))['catch'](handleError(_0x285279,null));};exports['getConfigurations']=function(_0x1095ab,_0x59dd78,_0x3be981){var _0x313f72={};var _0x35c790={};var _0x12332a;var _0x5b6262;return db[_0x7474('0x41')]['findOne']({'where':{'id':_0x1095ab[_0x7474('0x4b')]['id']}})[_0x7474('0x25')](handleEntityNotFound(_0x59dd78,null))['then'](function(_0x59b60d){if(_0x59b60d){_0x12332a=_0x59b60d;_0x35c790[_0x7474('0x31')]=_['keys'](db['ServicenowConfiguration'][_0x7474('0x2d')]);_0x35c790[_0x7474('0x32')]=_['keys'](_0x1095ab[_0x7474('0x32')]);_0x35c790['filters']=_[_0x7474('0x35')](_0x35c790[_0x7474('0x31')],_0x35c790[_0x7474('0x32')]);_0x313f72['attributes']=_['intersection'](_0x35c790[_0x7474('0x31')],qs[_0x7474('0x37')](_0x1095ab['query'][_0x7474('0x37')]));_0x313f72[_0x7474('0x36')]=_0x313f72['attributes'][_0x7474('0x38')]?_0x313f72['attributes']:_0x35c790['model'];_0x313f72[_0x7474('0x4c')]=qs[_0x7474('0x3b')](_0x1095ab[_0x7474('0x32')][_0x7474('0x3b')]);_0x313f72[_0x7474('0x3c')]=qs[_0x7474('0x34')](_[_0x7474('0x3d')](_0x1095ab['query'],_0x35c790[_0x7474('0x34')]));if(_0x1095ab[_0x7474('0x32')][_0x7474('0x3e')]){_0x313f72[_0x7474('0x3c')]=_[_0x7474('0x47')](_0x313f72[_0x7474('0x3c')],{'$or':_[_0x7474('0x2c')](_0x313f72[_0x7474('0x36')],function(_0x93f709){var _0x3e1487={};_0x3e1487[_0x93f709]={'$like':'%'+_0x1095ab['query']['filter']+'%'};return _0x3e1487;})});}_0x313f72=_[_0x7474('0x47')]({},_0x313f72,_0x1095ab[_0x7474('0x40')]);return _0x12332a['getConfigurations'](_0x313f72);}})[_0x7474('0x25')](function(_0x3fb157){if(_0x3fb157){_0x5b6262=_0x3fb157['length'];if(!_0x1095ab[_0x7474('0x32')][_0x7474('0x39')](_0x7474('0x3a'))){_0x313f72[_0x7474('0x1e')]=qs['limit'](_0x1095ab['query'][_0x7474('0x1e')]);_0x313f72[_0x7474('0x20')]=qs['offset'](_0x1095ab[_0x7474('0x32')][_0x7474('0x20')]);}return _0x12332a[_0x7474('0x4d')](_0x313f72);}})['then'](function(_0x5d202e){if(_0x5d202e){return _0x5d202e?{'count':_0x5b6262,'rows':_0x5d202e}:null;}})[_0x7474('0x25')](respondWithResult(_0x59dd78,null))['catch'](handleError(_0x59dd78,null));};exports[_0x7474('0x4e')]=function(_0xc1e42d,_0xcdb971,_0x19bd37){if(_0xc1e42d[_0x7474('0x4a')]['id']){delete _0xc1e42d[_0x7474('0x4a')]['id'];}return db[_0x7474('0x41')][_0x7474('0x4f')]({'where':{'id':_0xc1e42d[_0x7474('0x4b')]['id']}})[_0x7474('0x25')](handleEntityNotFound(_0xcdb971,null))['then'](function(_0x1a12d6){if(_0x1a12d6){_0xc1e42d[_0x7474('0x4a')][_0x7474('0x50')]=_0x1a12d6['id'];_0xc1e42d[_0x7474('0x4a')][_0x7474('0x51')]=integrations[_0x7474('0x52')](_0xc1e42d[_0x7474('0x4a')][_0x7474('0x53')],_0xc1e42d[_0x7474('0x4a')][_0x7474('0x2f')]);_0xc1e42d[_0x7474('0x4a')][_0x7474('0x54')]=integrations[_0x7474('0x55')](_0xc1e42d[_0x7474('0x4a')][_0x7474('0x53')],_0xc1e42d[_0x7474('0x4a')][_0x7474('0x2f')]);return db['ServicenowConfiguration'][_0x7474('0x49')](_0xc1e42d[_0x7474('0x4a')],{'include':[{'model':db[_0x7474('0x56')],'as':_0x7474('0x51')},{'model':db[_0x7474('0x56')],'as':'Descriptions'}]});}return null;})[_0x7474('0x25')](respondWithResult(_0xcdb971,null))[_0x7474('0x45')](handleError(_0xcdb971,null));};exports['getFields']=function(_0x55c048,_0x53c0d3,_0x363027){var _0x5dacbe=[_0x7474('0x57'),_0x7474('0x58'),'knowledge',_0x7474('0x59'),'close_code','notify',_0x7474('0x5a'),_0x7474('0x5b'),_0x7474('0x5c')];var _0x2c3125=[_0x7474('0x5d'),_0x7474('0x57'),_0x7474('0x5e'),_0x7474('0x5f'),_0x7474('0x60'),'sys_updated_on',_0x7474('0x61'),_0x7474('0x58'),'approval_history',_0x7474('0x62'),_0x7474('0x63'),_0x7474('0x64'),_0x7474('0x65'),_0x7474('0x66'),_0x7474('0x67'),_0x7474('0x68'),_0x7474('0x69'),_0x7474('0x6a'),'knowledge',_0x7474('0x4c'),_0x7474('0x6b'),_0x7474('0x6c'),'cmdb_ci','delivery_plan',_0x7474('0x6d'),_0x7474('0x6e'),_0x7474('0x6f'),_0x7474('0x70'),_0x7474('0x71'),_0x7474('0x72'),_0x7474('0x73'),_0x7474('0x74'),_0x7474('0x75'),'opened_at',_0x7474('0x76'),'group_list',_0x7474('0x77'),'reopened_time',_0x7474('0x78'),_0x7474('0x79'),_0x7474('0x7a'),_0x7474('0x59'),_0x7474('0x7b'),_0x7474('0x7c'),'close_code',_0x7474('0x7d'),_0x7474('0x7e'),_0x7474('0x7f'),_0x7474('0x80'),_0x7474('0x81'),'additional_assignee_list','description',_0x7474('0x82'),_0x7474('0x83'),_0x7474('0x84'),_0x7474('0x85'),_0x7474('0x86'),_0x7474('0x87'),_0x7474('0x88'),'sys_id',_0x7474('0x89'),'reopened_by',_0x7474('0x5a'),'urgency',_0x7474('0x8a'),'company',_0x7474('0x8b'),_0x7474('0x8c'),'assigned_to',_0x7474('0x5b'),_0x7474('0x8d'),'sla_due',_0x7474('0x8e'),_0x7474('0x8f'),_0x7474('0x90'),_0x7474('0x91'),_0x7474('0x92'),_0x7474('0x93'),_0x7474('0x94'),_0x7474('0x95'),'correlation_id','location','category'];var _0x41fc9f='';var _0x3431b1='';var _0x72ac62=[];var _0x8cdf9e='';var _0x4541b1='';var _0x5255d9=[];var _0xa320ae='';var _0x28cb60='';var _0x2b6a08={};var _0x59c182='';return db[_0x7474('0x41')][_0x7474('0x4f')]({'where':{'id':_0x55c048[_0x7474('0x4b')]['id']},'attributes':['id','username',_0x7474('0x96'),_0x7474('0x97'),_0x7474('0x98'),_0x7474('0x99')]})['then'](handleEntityNotFound(_0x53c0d3,null))['then'](function(_0x401daa){if(_0x401daa){_0x59c182=_0x401daa[_0x7474('0x98')];var _0x537786=_0x59c182[_0x7474('0x9a')](-0x1);if(_0x537786==='/'){_0x59c182=_0x59c182[_0x7474('0x9b')](0x0,_0x59c182[_0x7474('0x9c')](_0x537786));}_0x28cb60=util[_0x7474('0x9d')](_0x7474('0x9e'),_0x59c182);_0xa320ae=util[_0x7474('0x9d')](_0x7474('0x9f'),_0x59c182);_0x2b6a08={'user':_0x401daa[_0x7474('0xa0')],'pass':_0x401daa['password']};var _0xc68e37={'method':_0x7474('0xa1'),'uri':_0x28cb60+'incident?sysparm_display_value=all','auth':_0x2b6a08,'json':!![]};return rp(_0xc68e37);}})[_0x7474('0x25')](function(_0x38cfbc){if(_0x38cfbc[_0x7474('0xa2')]['length']>0x0){_0x41fc9f=_0x38cfbc[_0x7474('0xa2')];}console['log'](_0x7474('0xa3'),_0x41fc9f);_0x5255d9=[];_0x3431b1=Object['assign']([],_0x41fc9f);_[_0x7474('0xa4')](_0x3431b1,function(_0x44ac3f){return!_0x5dacbe[_0x7474('0xa5')](_0x44ac3f[_0x7474('0x29')]);});_0x3431b1['forEach'](function(_0xd6ed8c){var _0x5c07fd=createFieldObject(_0xa320ae,_0x2b6a08,_0xd6ed8c[_0x7474('0xa6')],_0xd6ed8c['name'],_0xd6ed8c[_0x7474('0xa7')],![]);_0x5255d9[_0x7474('0xa8')](_0x5c07fd);});return Promise[_0x7474('0xa9')](_0x5255d9);})[_0x7474('0x25')](function(_0x464bef){_0x72ac62=_0x464bef;_0x8cdf9e=Object['assign']([],_0x41fc9f);console[_0x7474('0xaa')](_0x7474('0xab'),_0x41fc9f);_[_0x7474('0xa4')](_0x8cdf9e,function(_0x55f0f8){return _0x2c3125['includes'](_0x55f0f8['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x8cdf9e);_0x5255d9=[];_0x8cdf9e[_0x7474('0xac')](function(_0x19461c){var _0x488193=createFieldObject(_0xa320ae,_0x2b6a08,_0x19461c[_0x7474('0xa6')],_0x19461c[_0x7474('0x29')],_0x19461c['label'],!![]);_0x5255d9[_0x7474('0xa8')](_0x488193);});return Promise[_0x7474('0xa9')](_0x5255d9);})[_0x7474('0x25')](function(_0x13546e){_0x4541b1=_0x13546e;var _0x223bac=_0x72ac62['concat'](_0x4541b1);return{'count':_0x223bac['length'],'rows':_0x223bac};})[_0x7474('0x25')](respondWithResult(_0x53c0d3,null))[_0x7474('0x45')](function(_0x46a44c){console[_0x7474('0xaa')](_0x7474('0xad')+_0x46a44c);var _0x475132=_0x55c048[_0x7474('0x32')]['test']?0x1f4:_0x46a44c['statusCode']||0x1f4;logger[_0x7474('0x27')](_0x46a44c[_0x7474('0x28')]);delete _0x46a44c[_0x7474('0x29')];if(_0x475132===0x191){_0x475132=0x190;}_0x53c0d3['status'](_0x475132)[_0x7474('0x2a')](_0x55c048[_0x7474('0x32')][_0x7474('0xae')]?{'message':_0x7474('0xaf'),'statusCode':_0x46a44c[_0x7474('0xb0')]}:_0x46a44c);});};function createFieldObject(_0x545aa7,_0x5c30a7,_0x472536,_0xc2527c,_0x4bf9ce,_0x27ac29){return new Promise(function(_0x24ac92,_0x1da681){var _0x165c20={'id':_0xc2527c,'name':_0x4bf9ce,'custom':_0x27ac29};if(_0x472536===_0x7474('0xb1')){_0x165c20['options']=[{'name':_0x7474('0xb2'),'value':'true'},{'name':_0x7474('0xb3'),'value':'false'}];_0x24ac92(_0x165c20);}else{var _0x3ff26d={'method':_0x7474('0xa1'),'uri':_0x545aa7+_0x7474('0xb4')+_0xc2527c,'auth':_0x5c30a7,'json':!![]};return rp(_0x3ff26d)['then'](function(_0x5201c0){var _0xa5e9bb=[];if(_0x5201c0['result']['length']>0x0){_0x5201c0[_0x7474('0xa2')]['forEach'](function(_0x4a56ab){if(_0x4a56ab[_0x7474('0xb5')]===_0x7474('0xb6')){var _0x3621d8={'name':_0x4a56ab[_0x7474('0xa7')],'value':_0x4a56ab['value']};_0xa5e9bb['push'](_0x3621d8);}});}_0x165c20[_0x7474('0x40')]=_0xa5e9bb;if(_0x165c20[_0x7474('0x40')]['length']>0x0){_0x24ac92(_0x165c20);}else{if(_0x27ac29==![]){_0x24ac92();}else{_0x24ac92(_0x165c20);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d50e263..3da71ac 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 _0x90b1=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x90b1,0x1bb));var _0x190b=function(_0x3abf74,_0x295e2d){_0x3abf74=_0x3abf74-0x0;var _0x497281=_0x90b1[_0x3abf74];return _0x497281;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x2a158e,_0xb58352){var _0x1d45b1=function(_0x1bd58f){while(--_0x1bd58f){_0x2a158e['push'](_0x2a158e['shift']());}};_0x1d45b1(++_0xb58352);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x122449,_0x5289a0){_0x122449=_0x122449-0x0;var _0x1b4039=_0x9c5a[_0x122449];return _0x1b4039;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'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 0ffa56a..0b8f7b6 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 _0x8edb=['info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4b17f2,_0x848337){var _0x59eb19=function(_0x50c8e0){while(--_0x50c8e0){_0x4b17f2['push'](_0x4b17f2['shift']());}};_0x59eb19(++_0x848337);}(_0x8edb,0xd0));var _0xb8ed=function(_0x2cea83,_0x259329){_0x2cea83=_0x2cea83-0x0;var _0x242223=_0x8edb[_0x2cea83];return _0x242223;};'use strict';var _=require(_0xb8ed('0x0'));var util=require(_0xb8ed('0x1'));var moment=require(_0xb8ed('0x2'));var BPromise=require(_0xb8ed('0x3'));var rs=require(_0xb8ed('0x4'));var fs=require('fs');var Redis=require(_0xb8ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8ed('0x6'));var logger=require(_0xb8ed('0x7'))('rpc');var config=require(_0xb8ed('0x8'));var jayson=require(_0xb8ed('0x9'));var client=jayson[_0xb8ed('0xa')][_0xb8ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18459d,_0x5ac615,_0x583437){return new BPromise(function(_0x23686f,_0x443d36){return client[_0xb8ed('0xc')](_0x18459d,_0x583437)[_0xb8ed('0xd')](function(_0x41a1b6){logger[_0xb8ed('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5ac615,_0xb8ed('0xf'));logger['debug'](_0xb8ed('0x10'),_0x5ac615,_0xb8ed('0xf'),JSON['stringify'](_0x41a1b6));if(_0x41a1b6[_0xb8ed('0x11')]){if(_0x41a1b6[_0xb8ed('0x11')][_0xb8ed('0x12')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5ac615,_0x41a1b6[_0xb8ed('0x11')][_0xb8ed('0x13')]);return _0x443d36(_0x41a1b6['error'][_0xb8ed('0x13')]);}logger['error'](_0xb8ed('0x14'),_0x5ac615,_0x41a1b6[_0xb8ed('0x11')][_0xb8ed('0x13')]);return _0x23686f(_0x41a1b6[_0xb8ed('0x11')][_0xb8ed('0x13')]);}else{logger[_0xb8ed('0xe')](_0xb8ed('0x14'),_0x5ac615,_0xb8ed('0xf'));_0x23686f(_0x41a1b6[_0xb8ed('0x15')][_0xb8ed('0x13')]);}})[_0xb8ed('0x16')](function(_0xc48919){logger[_0xb8ed('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x5ac615,_0xc48919);_0x443d36(_0xc48919);});});}exports[_0xb8ed('0x17')]=function(_0x2c2442){var _0x1ea687=this;return new Promise(function(_0x11d461,_0x55bf9e){return db[_0xb8ed('0x18')]['findAll']({'raw':_0x2c2442[_0xb8ed('0x19')]?_0x2c2442[_0xb8ed('0x19')][_0xb8ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c2442[_0xb8ed('0x19')]?_0x2c2442[_0xb8ed('0x19')][_0xb8ed('0x1b')]||null:null,'attributes':_0x2c2442[_0xb8ed('0x19')]?_0x2c2442[_0xb8ed('0x19')][_0xb8ed('0x1c')]||null:null,'limit':_0x2c2442[_0xb8ed('0x19')]?_0x2c2442[_0xb8ed('0x19')][_0xb8ed('0x1d')]||null:null,'include':_0x2c2442[_0xb8ed('0x19')]?_0x2c2442['options'][_0xb8ed('0x1e')]?_[_0xb8ed('0x1f')](_0x2c2442[_0xb8ed('0x19')]['include'],function(_0x5198f4){return{'model':db[_0x5198f4[_0xb8ed('0x20')]],'as':_0x5198f4['as'],'attributes':_0x5198f4[_0xb8ed('0x1c')],'include':_0x5198f4[_0xb8ed('0x1e')]?_[_0xb8ed('0x1f')](_0x5198f4[_0xb8ed('0x1e')],function(_0x3841da){return{'model':db[_0x3841da[_0xb8ed('0x20')]],'as':_0x3841da['as'],'attributes':_0x3841da[_0xb8ed('0x1c')],'include':_0x3841da[_0xb8ed('0x1e')]?_['map'](_0x3841da['include'],function(_0x3eb740){return{'model':db[_0x3eb740[_0xb8ed('0x20')]],'as':_0x3eb740['as'],'attributes':_0x3eb740[_0xb8ed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb8ed('0xd')](function(_0x292f55){logger['info'](_0xb8ed('0x17'),_0x2c2442);logger[_0xb8ed('0x21')](_0xb8ed('0x17'),_0x2c2442,JSON[_0xb8ed('0x22')](_0x292f55));_0x11d461(_0x292f55);})['catch'](function(_0x31b586){logger['error']('GetServicenowAccount',_0x31b586[_0xb8ed('0x13')],_0x2c2442);_0x55bf9e(_0x1ea687['error'](0x1f4,_0x31b586[_0xb8ed('0x13')]));});});};exports[_0xb8ed('0x23')]=function(_0x3021f0){var _0x953e37=this;return new Promise(function(_0x25ceee,_0x2f748d){return db[_0xb8ed('0x18')][_0xb8ed('0x24')]({'raw':_0x3021f0['options']?_0x3021f0[_0xb8ed('0x19')][_0xb8ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x3021f0[_0xb8ed('0x19')]?_0x3021f0[_0xb8ed('0x19')][_0xb8ed('0x1b')]||null:null,'attributes':_0x3021f0[_0xb8ed('0x19')]?_0x3021f0[_0xb8ed('0x19')]['attributes']||null:null,'include':_0x3021f0['options']?_0x3021f0['options']['include']?_[_0xb8ed('0x1f')](_0x3021f0['options'][_0xb8ed('0x1e')],function(_0x593e00){return{'model':db[_0x593e00['model']],'as':_0x593e00['as'],'attributes':_0x593e00['attributes'],'include':_0x593e00[_0xb8ed('0x1e')]?_[_0xb8ed('0x1f')](_0x593e00[_0xb8ed('0x1e')],function(_0x18ec3c){return{'model':db[_0x18ec3c['model']],'as':_0x18ec3c['as'],'attributes':_0x18ec3c[_0xb8ed('0x1c')],'include':_0x18ec3c[_0xb8ed('0x1e')]?_['map'](_0x18ec3c[_0xb8ed('0x1e')],function(_0x247408){return{'model':db[_0x247408['model']],'as':_0x247408['as'],'attributes':_0x247408['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8ed('0xd')](function(_0x183e84){logger[_0xb8ed('0xe')](_0xb8ed('0x23'),_0x3021f0);logger[_0xb8ed('0x21')](_0xb8ed('0x23'),_0x3021f0,JSON['stringify'](_0x183e84));_0x25ceee(_0x183e84);})[_0xb8ed('0x16')](function(_0xa26c90){logger[_0xb8ed('0x11')](_0xb8ed('0x23'),_0xa26c90[_0xb8ed('0x13')],_0x3021f0);_0x2f748d(_0x953e37[_0xb8ed('0x11')](0x1f4,_0xa26c90['message']));});});}; \ No newline at end of file +var _0xc66b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','GetServicenowAccount','findAll','raw','options','where','attributes','include','map','model','ShowServicenowAccount','find','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5d5ab2,_0x1d3681){var _0xb8fe37=function(_0x29a76c){while(--_0x29a76c){_0x5d5ab2['push'](_0x5d5ab2['shift']());}};_0xb8fe37(++_0x1d3681);}(_0xc66b,0x15b));var _0xbc66=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xc66b[_0x339129];return _0x1570df;};'use strict';var _=require(_0xbc66('0x0'));var util=require(_0xbc66('0x1'));var moment=require(_0xbc66('0x2'));var BPromise=require(_0xbc66('0x3'));var rs=require(_0xbc66('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc66('0x5'));var logger=require(_0xbc66('0x6'))(_0xbc66('0x7'));var config=require(_0xbc66('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x422024,_0x2f8abe,_0x331f0b){return new BPromise(function(_0x1257af,_0x5aa23f){return client[_0xbc66('0xa')](_0x422024,_0x331f0b)[_0xbc66('0xb')](function(_0x2681b7){logger[_0xbc66('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x2f8abe,'request\x20sent');logger[_0xbc66('0xd')](_0xbc66('0xe'),_0x2f8abe,'request\x20sent',JSON[_0xbc66('0xf')](_0x2681b7));if(_0x2681b7[_0xbc66('0x10')]){if(_0x2681b7[_0xbc66('0x10')][_0xbc66('0x11')]===0x1f4){logger[_0xbc66('0x10')](_0xbc66('0x12'),_0x2f8abe,_0x2681b7[_0xbc66('0x10')]['message']);return _0x5aa23f(_0x2681b7[_0xbc66('0x10')][_0xbc66('0x13')]);}logger[_0xbc66('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2f8abe,_0x2681b7[_0xbc66('0x10')][_0xbc66('0x13')]);return _0x1257af(_0x2681b7[_0xbc66('0x10')]['message']);}else{logger['info'](_0xbc66('0x12'),_0x2f8abe,'request\x20sent');_0x1257af(_0x2681b7['result'][_0xbc66('0x13')]);}})['catch'](function(_0xffa99b){logger[_0xbc66('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2f8abe,_0xffa99b);_0x5aa23f(_0xffa99b);});});}exports[_0xbc66('0x14')]=function(_0x30512e){var _0xdade2d=this;return new Promise(function(_0x413ee4,_0x4dabdf){return db['ServicenowAccount'][_0xbc66('0x15')]({'raw':_0x30512e['options']?_0x30512e['options'][_0xbc66('0x16')]===undefined?!![]:![]:!![],'where':_0x30512e[_0xbc66('0x17')]?_0x30512e['options'][_0xbc66('0x18')]||null:null,'attributes':_0x30512e[_0xbc66('0x17')]?_0x30512e[_0xbc66('0x17')][_0xbc66('0x19')]||null:null,'limit':_0x30512e['options']?_0x30512e[_0xbc66('0x17')]['limit']||null:null,'include':_0x30512e[_0xbc66('0x17')]?_0x30512e[_0xbc66('0x17')][_0xbc66('0x1a')]?_[_0xbc66('0x1b')](_0x30512e[_0xbc66('0x17')][_0xbc66('0x1a')],function(_0x29cab1){return{'model':db[_0x29cab1[_0xbc66('0x1c')]],'as':_0x29cab1['as'],'attributes':_0x29cab1[_0xbc66('0x19')],'include':_0x29cab1[_0xbc66('0x1a')]?_['map'](_0x29cab1[_0xbc66('0x1a')],function(_0x3459a4){return{'model':db[_0x3459a4['model']],'as':_0x3459a4['as'],'attributes':_0x3459a4['attributes'],'include':_0x3459a4['include']?_['map'](_0x3459a4[_0xbc66('0x1a')],function(_0x23addc){return{'model':db[_0x23addc['model']],'as':_0x23addc['as'],'attributes':_0x23addc['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc66('0xb')](function(_0xa812aa){logger['info'](_0xbc66('0x14'),_0x30512e);logger['debug'](_0xbc66('0x14'),_0x30512e,JSON[_0xbc66('0xf')](_0xa812aa));_0x413ee4(_0xa812aa);})['catch'](function(_0x37be87){logger['error'](_0xbc66('0x14'),_0x37be87[_0xbc66('0x13')],_0x30512e);_0x4dabdf(_0xdade2d[_0xbc66('0x10')](0x1f4,_0x37be87[_0xbc66('0x13')]));});});};exports[_0xbc66('0x1d')]=function(_0x14f2d0){var _0xdf99d1=this;return new Promise(function(_0x47f8f4,_0x171815){return db['ServicenowAccount'][_0xbc66('0x1e')]({'raw':_0x14f2d0['options']?_0x14f2d0[_0xbc66('0x17')][_0xbc66('0x16')]===undefined?!![]:![]:!![],'where':_0x14f2d0['options']?_0x14f2d0[_0xbc66('0x17')][_0xbc66('0x18')]||null:null,'attributes':_0x14f2d0[_0xbc66('0x17')]?_0x14f2d0[_0xbc66('0x17')]['attributes']||null:null,'include':_0x14f2d0[_0xbc66('0x17')]?_0x14f2d0[_0xbc66('0x17')][_0xbc66('0x1a')]?_[_0xbc66('0x1b')](_0x14f2d0[_0xbc66('0x17')]['include'],function(_0x491ed1){return{'model':db[_0x491ed1[_0xbc66('0x1c')]],'as':_0x491ed1['as'],'attributes':_0x491ed1[_0xbc66('0x19')],'include':_0x491ed1[_0xbc66('0x1a')]?_[_0xbc66('0x1b')](_0x491ed1['include'],function(_0x57b537){return{'model':db[_0x57b537[_0xbc66('0x1c')]],'as':_0x57b537['as'],'attributes':_0x57b537[_0xbc66('0x19')],'include':_0x57b537[_0xbc66('0x1a')]?_[_0xbc66('0x1b')](_0x57b537['include'],function(_0x827f65){return{'model':db[_0x827f65['model']],'as':_0x827f65['as'],'attributes':_0x827f65[_0xbc66('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbc66('0xb')](function(_0x399d01){logger['info'](_0xbc66('0x1d'),_0x14f2d0);logger[_0xbc66('0xd')](_0xbc66('0x1d'),_0x14f2d0,JSON[_0xbc66('0xf')](_0x399d01));_0x47f8f4(_0x399d01);})[_0xbc66('0x1f')](function(_0x16ea8a){logger[_0xbc66('0x10')](_0xbc66('0x1d'),_0x16ea8a[_0xbc66('0x13')],_0x14f2d0);_0x171815(_0xdf99d1[_0xbc66('0x10')](0x1f4,_0x16ea8a[_0xbc66('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index bf89b2f..528e8fc 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 _0x89f3=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x5794d0,_0x36e79e){var _0x536cf5=function(_0x4c5184){while(--_0x4c5184){_0x5794d0['push'](_0x5794d0['shift']());}};_0x536cf5(++_0x36e79e);}(_0x89f3,0x116));var _0x389f=function(_0x67d25c,_0x43f0f6){_0x67d25c=_0x67d25c-0x0;var _0x21a07d=_0x89f3[_0x67d25c];return _0x21a07d;};'use strict';var multer=require('multer');var util=require(_0x389f('0x0'));var path=require(_0x389f('0x1'));var timeout=require(_0x389f('0x2'));var express=require(_0x389f('0x3'));var router=express[_0x389f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x389f('0x5'));var config=require(_0x389f('0x6'));var controller=require(_0x389f('0x7'));router[_0x389f('0x8')]('/',auth[_0x389f('0x9')](),controller[_0x389f('0xa')]);router[_0x389f('0x8')](_0x389f('0xb'),auth[_0x389f('0x9')](),controller[_0x389f('0xc')]);router['get'](_0x389f('0xd'),auth['isAuthenticated'](),controller[_0x389f('0xe')]);router[_0x389f('0x8')]('/:id/subjects',auth[_0x389f('0x9')](),controller[_0x389f('0xf')]);router[_0x389f('0x8')](_0x389f('0x10'),auth[_0x389f('0x9')](),controller[_0x389f('0x11')]);router[_0x389f('0x12')]('/',auth['isAuthenticated'](),controller[_0x389f('0x13')]);router[_0x389f('0x14')](_0x389f('0xb'),auth[_0x389f('0x9')](),controller[_0x389f('0x15')]);router[_0x389f('0x16')](_0x389f('0xb'),auth['isAuthenticated'](),controller[_0x389f('0x17')]);module[_0x389f('0x18')]=router; \ No newline at end of file +var _0xe784=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','getFields'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xe784,0x77));var _0x4e78=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe784[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x4e78('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e78('0x1'));var express=require(_0x4e78('0x2'));var router=express[_0x4e78('0x3')]();var fs_extra=require(_0x4e78('0x4'));var auth=require(_0x4e78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e78('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x4e78('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e78('0x8')]);router[_0x4e78('0x7')](_0x4e78('0x9'),auth[_0x4e78('0xa')](),controller[_0x4e78('0xb')]);router['get']('/:id/fields',auth[_0x4e78('0xa')](),controller[_0x4e78('0xc')]);router[_0x4e78('0x7')](_0x4e78('0xd'),auth[_0x4e78('0xa')](),controller[_0x4e78('0xe')]);router[_0x4e78('0x7')](_0x4e78('0xf'),auth['isAuthenticated'](),controller[_0x4e78('0x10')]);router[_0x4e78('0x11')]('/',auth[_0x4e78('0xa')](),controller[_0x4e78('0x12')]);router[_0x4e78('0x13')](_0x4e78('0x9'),auth[_0x4e78('0xa')](),controller[_0x4e78('0x14')]);router[_0x4e78('0x15')](_0x4e78('0x9'),auth[_0x4e78('0xa')](),controller['destroy']);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 68c9fdd..17cacdc 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 _0xb55e=['sequelize','exports','STRING'];(function(_0x505602,_0x1ecf95){var _0x251042=function(_0x5df432){while(--_0x5df432){_0x505602['push'](_0x505602['shift']());}};_0x251042(++_0x1ecf95);}(_0xb55e,0x75));var _0xeb55=function(_0x1f8554,_0x5d18c8){_0x1f8554=_0x1f8554-0x0;var _0x1eb9af=_0xb55e[_0x1f8554];return _0x1eb9af;};'use strict';var Sequelize=require(_0xeb55('0x0'));module[_0xeb55('0x1')]={'name':{'type':Sequelize[_0xeb55('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e25=['sequelize','STRING'];(function(_0x3bb557,_0x2d4e15){var _0x5eebcb=function(_0x309c44){while(--_0x309c44){_0x3bb557['push'](_0x3bb557['shift']());}};_0x5eebcb(++_0x2d4e15);}(_0x9e25,0xa0));var _0x59e2=function(_0x197807,_0x59daba){_0x197807=_0x197807-0x0;var _0x129e32=_0x9e25[_0x197807];return _0x129e32;};'use strict';var Sequelize=require(_0x59e2('0x0'));module['exports']={'name':{'type':Sequelize[_0x59e2('0x1')]},'description':{'type':Sequelize[_0x59e2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 01e6571..44e167d 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 _0xec11=['key','model','map','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','rawAttributes','include','options','find','catch','create','body','params','getFields','ServicenowField','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ServicenowConfiguration','fieldName'];(function(_0x5ea911,_0x2a8a79){var _0x34ea74=function(_0x3c6d49){while(--_0x3c6d49){_0x5ea911['push'](_0x5ea911['shift']());}};_0x34ea74(++_0x2a8a79);}(_0xec11,0x121));var _0x1ec1=function(_0x483f0e,_0x58d189){_0x483f0e=_0x483f0e-0x0;var _0x48e0be=_0xec11[_0x483f0e];return _0x48e0be;};'use strict';var emlformat=require(_0x1ec1('0x0'));var rimraf=require(_0x1ec1('0x1'));var zipdir=require(_0x1ec1('0x2'));var jsonpatch=require(_0x1ec1('0x3'));var rp=require('request-promise');var moment=require(_0x1ec1('0x4'));var BPromise=require(_0x1ec1('0x5'));var Mustache=require(_0x1ec1('0x6'));var util=require(_0x1ec1('0x7'));var path=require('path');var sox=require(_0x1ec1('0x8'));var csv=require(_0x1ec1('0x9'));var ejs=require(_0x1ec1('0xa'));var fs=require('fs');var fs_extra=require(_0x1ec1('0xb'));var _=require(_0x1ec1('0xc'));var squel=require('squel');var crypto=require(_0x1ec1('0xd'));var jsforce=require(_0x1ec1('0xe'));var deskjs=require(_0x1ec1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1ec1('0x10'));var Papa=require(_0x1ec1('0x11'));var Redis=require('ioredis');var authService=require(_0x1ec1('0x12'));var qs=require(_0x1ec1('0x13'));var as=require(_0x1ec1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ec1('0x15'))(_0x1ec1('0x16'));var utils=require(_0x1ec1('0x17'));var config=require(_0x1ec1('0x18'));var licenseUtil=require(_0x1ec1('0x19'));var db=require(_0x1ec1('0x1a'))['db'];function respondWithStatusCode(_0x6738fc,_0x227cb9){_0x227cb9=_0x227cb9||0xcc;return function(_0x2499b6){if(_0x2499b6){return _0x6738fc[_0x1ec1('0x1b')](_0x227cb9);}return _0x6738fc[_0x1ec1('0x1c')](_0x227cb9)[_0x1ec1('0x1d')]();};}function respondWithResult(_0x348a0f,_0x1ed60e){_0x1ed60e=_0x1ed60e||0xc8;return function(_0x1b7bad){if(_0x1b7bad){return _0x348a0f[_0x1ec1('0x1c')](_0x1ed60e)[_0x1ec1('0x1e')](_0x1b7bad);}};}function respondWithFilteredResult(_0x464971,_0x514773){return function(_0xbabffd){if(_0xbabffd){var _0x43b73f=typeof _0x514773[_0x1ec1('0x1f')]===_0x1ec1('0x20')&&typeof _0x514773['limit']===_0x1ec1('0x20');var _0x33d28d=_0xbabffd[_0x1ec1('0x21')];var _0x5d7181=_0x43b73f?0x0:_0x514773[_0x1ec1('0x1f')];var _0x10a82d=_0x43b73f?_0xbabffd[_0x1ec1('0x21')]:_0x514773[_0x1ec1('0x1f')]+_0x514773['limit'];var _0x47faa7;if(_0x10a82d>=_0x33d28d){_0x10a82d=_0x33d28d;_0x47faa7=0xc8;}else{_0x47faa7=0xce;}_0x464971[_0x1ec1('0x1c')](_0x47faa7);return _0x464971[_0x1ec1('0x22')](_0x1ec1('0x23'),_0x5d7181+'-'+_0x10a82d+'/'+_0x33d28d)[_0x1ec1('0x1e')](_0xbabffd);}return null;};}function patchUpdates(_0x3f0110){return function(_0x127ee7){try{jsonpatch['apply'](_0x127ee7,_0x3f0110,!![]);}catch(_0x4ae566){return BPromise[_0x1ec1('0x24')](_0x4ae566);}return _0x127ee7[_0x1ec1('0x25')]();};}function saveUpdates(_0x3e78ce,_0x13d0f3){return function(_0xa242ff){if(_0xa242ff){return _0xa242ff[_0x1ec1('0x26')](_0x3e78ce)[_0x1ec1('0x27')](function(_0x639b04){return _0x639b04;});}return null;};}function removeEntity(_0x3971f1,_0x5a0688){return function(_0x232a3c){if(_0x232a3c){return _0x232a3c[_0x1ec1('0x28')]()[_0x1ec1('0x27')](function(){_0x3971f1[_0x1ec1('0x1c')](0xcc)[_0x1ec1('0x1d')]();});}};}function handleEntityNotFound(_0x526256,_0x25bd91){return function(_0x48c338){if(!_0x48c338){_0x526256[_0x1ec1('0x1b')](0x194);}return _0x48c338;};}function handleError(_0x4012f6,_0x44af99){_0x44af99=_0x44af99||0x1f4;return function(_0x3c9d88){logger[_0x1ec1('0x29')](_0x3c9d88[_0x1ec1('0x2a')]);if(_0x3c9d88[_0x1ec1('0x2b')]){delete _0x3c9d88[_0x1ec1('0x2b')];}_0x4012f6[_0x1ec1('0x1c')](_0x44af99)['send'](_0x3c9d88);};}exports[_0x1ec1('0x2c')]=function(_0x4a2220,_0x3f5598){var _0x34fe13={},_0x108c22={},_0x307a57={'count':0x0,'rows':[]};var _0x49f414=_['map'](db[_0x1ec1('0x2d')]['rawAttributes'],function(_0x42116f){return{'name':_0x42116f[_0x1ec1('0x2e')],'type':_0x42116f['type'][_0x1ec1('0x2f')]};});_0x108c22[_0x1ec1('0x30')]=_[_0x1ec1('0x31')](_0x49f414,_0x1ec1('0x2b'));_0x108c22[_0x1ec1('0x32')]=_[_0x1ec1('0x33')](_0x4a2220[_0x1ec1('0x32')]);_0x108c22[_0x1ec1('0x34')]=_['intersection'](_0x108c22[_0x1ec1('0x30')],_0x108c22['query']);_0x34fe13[_0x1ec1('0x35')]=_[_0x1ec1('0x36')](_0x108c22[_0x1ec1('0x30')],qs[_0x1ec1('0x37')](_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x37')]));_0x34fe13[_0x1ec1('0x35')]=_0x34fe13[_0x1ec1('0x35')][_0x1ec1('0x38')]?_0x34fe13[_0x1ec1('0x35')]:_0x108c22[_0x1ec1('0x30')];if(!_0x4a2220[_0x1ec1('0x32')]['hasOwnProperty']('nolimit')){_0x34fe13['limit']=qs[_0x1ec1('0x39')](_0x4a2220['query'][_0x1ec1('0x39')]);_0x34fe13[_0x1ec1('0x1f')]=qs[_0x1ec1('0x1f')](_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x1f')]);}_0x34fe13[_0x1ec1('0x3a')]=qs[_0x1ec1('0x3b')](_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x3b')]);_0x34fe13[_0x1ec1('0x3c')]=qs['filters'](_[_0x1ec1('0x3d')](_0x4a2220[_0x1ec1('0x32')],_0x108c22['filters']),_0x49f414);if(_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x3e')]){_0x34fe13['where']=_[_0x1ec1('0x3f')](_0x34fe13[_0x1ec1('0x3c')],{'$or':_['map'](_0x49f414,function(_0x403b32){if(_0x403b32[_0x1ec1('0x40')]!==_0x1ec1('0x41')){var _0x498910={};_0x498910[_0x403b32['name']]={'$like':'%'+_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x3e')]+'%'};return _0x498910;}})});}_0x34fe13=_[_0x1ec1('0x3f')]({},_0x34fe13,_0x4a2220['options']);var _0x115db0={'where':_0x34fe13['where']};return db[_0x1ec1('0x2d')][_0x1ec1('0x21')](_0x115db0)[_0x1ec1('0x27')](function(_0x2b6d2b){_0x307a57[_0x1ec1('0x21')]=_0x2b6d2b;if(_0x4a2220[_0x1ec1('0x32')][_0x1ec1('0x42')]){_0x34fe13['include']=[{'all':!![]}];}return db[_0x1ec1('0x2d')]['findAll'](_0x34fe13);})['then'](function(_0x220e11){_0x307a57[_0x1ec1('0x43')]=_0x220e11;return _0x307a57;})['then'](respondWithFilteredResult(_0x3f5598,_0x34fe13))['catch'](handleError(_0x3f5598,null));};exports[_0x1ec1('0x44')]=function(_0x436188,_0x5823f1){var _0x4750cf={'raw':![],'where':{'id':_0x436188['params']['id']}},_0x335d0={};_0x335d0[_0x1ec1('0x30')]=_[_0x1ec1('0x33')](db[_0x1ec1('0x2d')][_0x1ec1('0x45')]);_0x335d0[_0x1ec1('0x32')]=_[_0x1ec1('0x33')](_0x436188['query']);_0x335d0['filters']=_['intersection'](_0x335d0[_0x1ec1('0x30')],_0x335d0['query']);_0x4750cf[_0x1ec1('0x35')]=_['intersection'](_0x335d0['model'],qs[_0x1ec1('0x37')](_0x436188[_0x1ec1('0x32')]['fields']));_0x4750cf[_0x1ec1('0x35')]=_0x4750cf[_0x1ec1('0x35')][_0x1ec1('0x38')]?_0x4750cf[_0x1ec1('0x35')]:_0x335d0['model'];if(_0x436188['query'][_0x1ec1('0x42')]){_0x4750cf[_0x1ec1('0x46')]=[{'all':!![]}];}_0x4750cf=_['merge']({},_0x4750cf,_0x436188[_0x1ec1('0x47')]);return db[_0x1ec1('0x2d')][_0x1ec1('0x48')](_0x4750cf)['then'](handleEntityNotFound(_0x5823f1,null))[_0x1ec1('0x27')](respondWithResult(_0x5823f1,null))[_0x1ec1('0x49')](handleError(_0x5823f1,null));};exports[_0x1ec1('0x4a')]=function(_0x1d4e06,_0x336bed){return db[_0x1ec1('0x2d')]['create'](_0x1d4e06[_0x1ec1('0x4b')],{})[_0x1ec1('0x27')](respondWithResult(_0x336bed,0xc9))[_0x1ec1('0x49')](handleError(_0x336bed,null));};exports['update']=function(_0x44e2af,_0xd3eaa5){if(_0x44e2af[_0x1ec1('0x4b')]['id']){delete _0x44e2af[_0x1ec1('0x4b')]['id'];}return db[_0x1ec1('0x2d')][_0x1ec1('0x48')]({'where':{'id':_0x44e2af[_0x1ec1('0x4c')]['id']}})[_0x1ec1('0x27')](handleEntityNotFound(_0xd3eaa5,null))[_0x1ec1('0x27')](saveUpdates(_0x44e2af['body'],null))[_0x1ec1('0x27')](respondWithResult(_0xd3eaa5,null))[_0x1ec1('0x49')](handleError(_0xd3eaa5,null));};exports[_0x1ec1('0x28')]=function(_0x31297d,_0x5c7ea9){return db[_0x1ec1('0x2d')][_0x1ec1('0x48')]({'where':{'id':_0x31297d[_0x1ec1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c7ea9,null))[_0x1ec1('0x27')](removeEntity(_0x5c7ea9,null))[_0x1ec1('0x49')](handleError(_0x5c7ea9,null));};exports[_0x1ec1('0x4d')]=function(_0x33f229,_0x2639d5,_0x23d865){var _0x151759={};var _0x30f823={};var _0x39c4fe;var _0x210948;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x33f229['params']['id']}})['then'](handleEntityNotFound(_0x2639d5,null))[_0x1ec1('0x27')](function(_0x254f1e){if(_0x254f1e){_0x39c4fe=_0x254f1e;_0x30f823['model']=_[_0x1ec1('0x33')](db[_0x1ec1('0x4e')][_0x1ec1('0x45')]);_0x30f823[_0x1ec1('0x32')]=_[_0x1ec1('0x33')](_0x33f229[_0x1ec1('0x32')]);_0x30f823['filters']=_[_0x1ec1('0x36')](_0x30f823[_0x1ec1('0x30')],_0x30f823[_0x1ec1('0x32')]);_0x151759[_0x1ec1('0x35')]=_['intersection'](_0x30f823[_0x1ec1('0x30')],qs[_0x1ec1('0x37')](_0x33f229['query'][_0x1ec1('0x37')]));_0x151759[_0x1ec1('0x35')]=_0x151759[_0x1ec1('0x35')][_0x1ec1('0x38')]?_0x151759[_0x1ec1('0x35')]:_0x30f823['model'];_0x151759[_0x1ec1('0x3a')]=qs[_0x1ec1('0x3b')](_0x33f229['query'][_0x1ec1('0x3b')]);_0x151759['where']=qs['filters'](_[_0x1ec1('0x3d')](_0x33f229[_0x1ec1('0x32')],_0x30f823['filters']));if(_0x33f229[_0x1ec1('0x32')]['filter']){_0x151759[_0x1ec1('0x3c')]=_[_0x1ec1('0x3f')](_0x151759[_0x1ec1('0x3c')],{'$or':_['map'](_0x151759[_0x1ec1('0x35')],function(_0x1fc30e){var _0x361e9a={};_0x361e9a[_0x1fc30e]={'$like':'%'+_0x33f229['query'][_0x1ec1('0x3e')]+'%'};return _0x361e9a;})});}_0x151759=_[_0x1ec1('0x3f')]({},_0x151759,_0x33f229[_0x1ec1('0x47')]);return _0x39c4fe[_0x1ec1('0x4d')](_0x151759);}})[_0x1ec1('0x27')](function(_0x2a49ad){if(_0x2a49ad){_0x210948=_0x2a49ad['length'];if(!_0x33f229[_0x1ec1('0x32')][_0x1ec1('0x4f')](_0x1ec1('0x50'))){_0x151759[_0x1ec1('0x39')]=qs[_0x1ec1('0x39')](_0x33f229['query'][_0x1ec1('0x39')]);_0x151759[_0x1ec1('0x1f')]=qs['offset'](_0x33f229[_0x1ec1('0x32')][_0x1ec1('0x1f')]);}return _0x39c4fe[_0x1ec1('0x4d')](_0x151759);}})[_0x1ec1('0x27')](function(_0x37067d){if(_0x37067d){return _0x37067d?{'count':_0x210948,'rows':_0x37067d}:null;}})[_0x1ec1('0x27')](respondWithResult(_0x2639d5,null))['catch'](handleError(_0x2639d5,null));};exports['getSubjects']=function(_0x3a1b64,_0x15ea02,_0x15f2dc){var _0x18cd1b={};var _0xd05580={};var _0x100ab4;var _0x4e665c;return db[_0x1ec1('0x2d')][_0x1ec1('0x51')]({'where':{'id':_0x3a1b64[_0x1ec1('0x4c')]['id']}})[_0x1ec1('0x27')](handleEntityNotFound(_0x15ea02,null))['then'](function(_0x4af26b){if(_0x4af26b){_0x100ab4=_0x4af26b;_0xd05580[_0x1ec1('0x30')]=_[_0x1ec1('0x33')](db['ServicenowField'][_0x1ec1('0x45')]);_0xd05580[_0x1ec1('0x32')]=_[_0x1ec1('0x33')](_0x3a1b64[_0x1ec1('0x32')]);_0xd05580[_0x1ec1('0x34')]=_[_0x1ec1('0x36')](_0xd05580['model'],_0xd05580[_0x1ec1('0x32')]);_0x18cd1b[_0x1ec1('0x35')]=_[_0x1ec1('0x36')](_0xd05580[_0x1ec1('0x30')],qs[_0x1ec1('0x37')](_0x3a1b64[_0x1ec1('0x32')][_0x1ec1('0x37')]));_0x18cd1b['attributes']=_0x18cd1b['attributes'][_0x1ec1('0x38')]?_0x18cd1b['attributes']:_0xd05580[_0x1ec1('0x30')];_0x18cd1b[_0x1ec1('0x3a')]=qs['sort'](_0x3a1b64[_0x1ec1('0x32')]['sort']);_0x18cd1b[_0x1ec1('0x3c')]=qs[_0x1ec1('0x34')](_[_0x1ec1('0x3d')](_0x3a1b64[_0x1ec1('0x32')],_0xd05580[_0x1ec1('0x34')]));if(_0x3a1b64['query'][_0x1ec1('0x3e')]){_0x18cd1b[_0x1ec1('0x3c')]=_[_0x1ec1('0x3f')](_0x18cd1b[_0x1ec1('0x3c')],{'$or':_[_0x1ec1('0x31')](_0x18cd1b[_0x1ec1('0x35')],function(_0x236652){var _0x35a5c0={};_0x35a5c0[_0x236652]={'$like':'%'+_0x3a1b64[_0x1ec1('0x32')][_0x1ec1('0x3e')]+'%'};return _0x35a5c0;})});}_0x18cd1b=_[_0x1ec1('0x3f')]({},_0x18cd1b,_0x3a1b64[_0x1ec1('0x47')]);return _0x100ab4[_0x1ec1('0x52')](_0x18cd1b);}})[_0x1ec1('0x27')](function(_0x3d99a5){if(_0x3d99a5){_0x4e665c=_0x3d99a5[_0x1ec1('0x38')];if(!_0x3a1b64[_0x1ec1('0x32')][_0x1ec1('0x4f')](_0x1ec1('0x50'))){_0x18cd1b['limit']=qs[_0x1ec1('0x39')](_0x3a1b64['query'][_0x1ec1('0x39')]);_0x18cd1b[_0x1ec1('0x1f')]=qs[_0x1ec1('0x1f')](_0x3a1b64[_0x1ec1('0x32')][_0x1ec1('0x1f')]);}return _0x100ab4[_0x1ec1('0x52')](_0x18cd1b);}})[_0x1ec1('0x27')](function(_0x5602f0){if(_0x5602f0){return _0x5602f0?{'count':_0x4e665c,'rows':_0x5602f0}:null;}})['then'](respondWithResult(_0x15ea02,null))[_0x1ec1('0x49')](handleError(_0x15ea02,null));};exports[_0x1ec1('0x53')]=function(_0x58290e,_0x13ea9c,_0x386ab1){var _0x3a706a={};var _0x2b478a={};var _0xc296f8;var _0x1ad633;return db[_0x1ec1('0x2d')][_0x1ec1('0x51')]({'where':{'id':_0x58290e['params']['id']}})[_0x1ec1('0x27')](handleEntityNotFound(_0x13ea9c,null))[_0x1ec1('0x27')](function(_0x405903){if(_0x405903){_0xc296f8=_0x405903;_0x2b478a[_0x1ec1('0x30')]=_[_0x1ec1('0x33')](db[_0x1ec1('0x4e')][_0x1ec1('0x45')]);_0x2b478a[_0x1ec1('0x32')]=_['keys'](_0x58290e[_0x1ec1('0x32')]);_0x2b478a['filters']=_[_0x1ec1('0x36')](_0x2b478a['model'],_0x2b478a[_0x1ec1('0x32')]);_0x3a706a[_0x1ec1('0x35')]=_[_0x1ec1('0x36')](_0x2b478a['model'],qs['fields'](_0x58290e[_0x1ec1('0x32')][_0x1ec1('0x37')]));_0x3a706a['attributes']=_0x3a706a['attributes'][_0x1ec1('0x38')]?_0x3a706a[_0x1ec1('0x35')]:_0x2b478a['model'];_0x3a706a['order']=qs['sort'](_0x58290e[_0x1ec1('0x32')][_0x1ec1('0x3b')]);_0x3a706a[_0x1ec1('0x3c')]=qs['filters'](_['pick'](_0x58290e[_0x1ec1('0x32')],_0x2b478a['filters']));if(_0x58290e[_0x1ec1('0x32')][_0x1ec1('0x3e')]){_0x3a706a['where']=_[_0x1ec1('0x3f')](_0x3a706a[_0x1ec1('0x3c')],{'$or':_[_0x1ec1('0x31')](_0x3a706a['attributes'],function(_0x1977f1){var _0x496212={};_0x496212[_0x1977f1]={'$like':'%'+_0x58290e[_0x1ec1('0x32')][_0x1ec1('0x3e')]+'%'};return _0x496212;})});}_0x3a706a=_[_0x1ec1('0x3f')]({},_0x3a706a,_0x58290e['options']);return _0xc296f8[_0x1ec1('0x53')](_0x3a706a);}})['then'](function(_0x29ab85){if(_0x29ab85){_0x1ad633=_0x29ab85['length'];if(!_0x58290e[_0x1ec1('0x32')]['hasOwnProperty'](_0x1ec1('0x50'))){_0x3a706a[_0x1ec1('0x39')]=qs[_0x1ec1('0x39')](_0x58290e[_0x1ec1('0x32')][_0x1ec1('0x39')]);_0x3a706a[_0x1ec1('0x1f')]=qs[_0x1ec1('0x1f')](_0x58290e['query']['offset']);}return _0xc296f8[_0x1ec1('0x53')](_0x3a706a);}})[_0x1ec1('0x27')](function(_0x319157){if(_0x319157){return _0x319157?{'count':_0x1ad633,'rows':_0x319157}:null;}})[_0x1ec1('0x27')](respondWithResult(_0x13ea9c,null))[_0x1ec1('0x49')](handleError(_0x13ea9c,null));}; \ No newline at end of file +var _0xd26b=['name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','map','type','VIRTUAL','ServicenowConfiguration','findAll','rows','show','params','includeAll','include','options','find','catch','create','body','update','findOne','ServicenowField','pick','getFields','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack'];(function(_0x18b701,_0x53950b){var _0x282456=function(_0x2281b6){while(--_0x2281b6){_0x18b701['push'](_0x18b701['shift']());}};_0x282456(++_0x53950b);}(_0xd26b,0x7f));var _0xbd26=function(_0x1dc63d,_0x5614aa){_0x1dc63d=_0x1dc63d-0x0;var _0x11635b=_0xd26b[_0x1dc63d];return _0x11635b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd26('0x0'));var zipdir=require(_0xbd26('0x1'));var jsonpatch=require(_0xbd26('0x2'));var rp=require(_0xbd26('0x3'));var moment=require(_0xbd26('0x4'));var BPromise=require(_0xbd26('0x5'));var Mustache=require(_0xbd26('0x6'));var util=require('util');var path=require(_0xbd26('0x7'));var sox=require('sox');var csv=require(_0xbd26('0x8'));var ejs=require(_0xbd26('0x9'));var fs=require('fs');var fs_extra=require(_0xbd26('0xa'));var _=require(_0xbd26('0xb'));var squel=require(_0xbd26('0xc'));var crypto=require(_0xbd26('0xd'));var jsforce=require(_0xbd26('0xe'));var deskjs=require(_0xbd26('0xf'));var toCsv=require(_0xbd26('0x8'));var querystring=require(_0xbd26('0x10'));var Papa=require(_0xbd26('0x11'));var Redis=require(_0xbd26('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbd26('0x13'));var as=require(_0xbd26('0x14'));var hardwareService=require(_0xbd26('0x15'));var logger=require('../../config/logger')(_0xbd26('0x16'));var utils=require(_0xbd26('0x17'));var config=require(_0xbd26('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd26('0x19'))['db'];function respondWithStatusCode(_0x36ba74,_0x4454d9){_0x4454d9=_0x4454d9||0xcc;return function(_0x3c9862){if(_0x3c9862){return _0x36ba74[_0xbd26('0x1a')](_0x4454d9);}return _0x36ba74[_0xbd26('0x1b')](_0x4454d9)[_0xbd26('0x1c')]();};}function respondWithResult(_0x4aa31d,_0x3fe63d){_0x3fe63d=_0x3fe63d||0xc8;return function(_0x26a05b){if(_0x26a05b){return _0x4aa31d[_0xbd26('0x1b')](_0x3fe63d)[_0xbd26('0x1d')](_0x26a05b);}};}function respondWithFilteredResult(_0xa5e715,_0x4ef802){return function(_0x5dcbe0){if(_0x5dcbe0){var _0x45eb12=typeof _0x4ef802[_0xbd26('0x1e')]===_0xbd26('0x1f')&&typeof _0x4ef802['limit']===_0xbd26('0x1f');var _0x20e7d3=_0x5dcbe0['count'];var _0x109412=_0x45eb12?0x0:_0x4ef802[_0xbd26('0x1e')];var _0x3cd708=_0x45eb12?_0x5dcbe0[_0xbd26('0x20')]:_0x4ef802[_0xbd26('0x1e')]+_0x4ef802[_0xbd26('0x21')];var _0x3da60c;if(_0x3cd708>=_0x20e7d3){_0x3cd708=_0x20e7d3;_0x3da60c=0xc8;}else{_0x3da60c=0xce;}_0xa5e715['status'](_0x3da60c);return _0xa5e715['set'](_0xbd26('0x22'),_0x109412+'-'+_0x3cd708+'/'+_0x20e7d3)[_0xbd26('0x1d')](_0x5dcbe0);}return null;};}function patchUpdates(_0x368ace){return function(_0x6f01b6){try{jsonpatch[_0xbd26('0x23')](_0x6f01b6,_0x368ace,!![]);}catch(_0x3be697){return BPromise['reject'](_0x3be697);}return _0x6f01b6[_0xbd26('0x24')]();};}function saveUpdates(_0x2f1062,_0xfe05dd){return function(_0x559ede){if(_0x559ede){return _0x559ede['update'](_0x2f1062)[_0xbd26('0x25')](function(_0x193db9){return _0x193db9;});}return null;};}function removeEntity(_0x256dc7,_0x500ffc){return function(_0x365107){if(_0x365107){return _0x365107[_0xbd26('0x26')]()[_0xbd26('0x25')](function(){_0x256dc7[_0xbd26('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3eb9,_0x3d662a){return function(_0xa4a671){if(!_0xa4a671){_0x3c3eb9[_0xbd26('0x1a')](0x194);}return _0xa4a671;};}function handleError(_0x42b146,_0xee0c4e){_0xee0c4e=_0xee0c4e||0x1f4;return function(_0x4d3941){logger[_0xbd26('0x27')](_0x4d3941[_0xbd26('0x28')]);if(_0x4d3941['name']){delete _0x4d3941[_0xbd26('0x29')];}_0x42b146[_0xbd26('0x1b')](_0xee0c4e)[_0xbd26('0x2a')](_0x4d3941);};}exports[_0xbd26('0x2b')]=function(_0x13bf02,_0x3279db){var _0x36843f={},_0x49262a={},_0x50995f={'count':0x0,'rows':[]};var _0x8d435a=_['map'](db['ServicenowConfiguration'][_0xbd26('0x2c')],function(_0x3d593e){return{'name':_0x3d593e[_0xbd26('0x2d')],'type':_0x3d593e['type'][_0xbd26('0x2e')]};});_0x49262a[_0xbd26('0x2f')]=_['map'](_0x8d435a,_0xbd26('0x29'));_0x49262a[_0xbd26('0x30')]=_[_0xbd26('0x31')](_0x13bf02['query']);_0x49262a[_0xbd26('0x32')]=_['intersection'](_0x49262a[_0xbd26('0x2f')],_0x49262a[_0xbd26('0x30')]);_0x36843f['attributes']=_[_0xbd26('0x33')](_0x49262a[_0xbd26('0x2f')],qs[_0xbd26('0x34')](_0x13bf02[_0xbd26('0x30')][_0xbd26('0x34')]));_0x36843f['attributes']=_0x36843f[_0xbd26('0x35')][_0xbd26('0x36')]?_0x36843f[_0xbd26('0x35')]:_0x49262a['model'];if(!_0x13bf02[_0xbd26('0x30')][_0xbd26('0x37')]('nolimit')){_0x36843f[_0xbd26('0x21')]=qs[_0xbd26('0x21')](_0x13bf02['query']['limit']);_0x36843f[_0xbd26('0x1e')]=qs[_0xbd26('0x1e')](_0x13bf02['query']['offset']);}_0x36843f[_0xbd26('0x38')]=qs[_0xbd26('0x39')](_0x13bf02[_0xbd26('0x30')][_0xbd26('0x39')]);_0x36843f[_0xbd26('0x3a')]=qs['filters'](_['pick'](_0x13bf02[_0xbd26('0x30')],_0x49262a['filters']),_0x8d435a);if(_0x13bf02[_0xbd26('0x30')][_0xbd26('0x3b')]){_0x36843f[_0xbd26('0x3a')]=_[_0xbd26('0x3c')](_0x36843f[_0xbd26('0x3a')],{'$or':_[_0xbd26('0x3d')](_0x8d435a,function(_0x56bce1){if(_0x56bce1[_0xbd26('0x3e')]!==_0xbd26('0x3f')){var _0x126d4d={};_0x126d4d[_0x56bce1[_0xbd26('0x29')]]={'$like':'%'+_0x13bf02[_0xbd26('0x30')]['filter']+'%'};return _0x126d4d;}})});}_0x36843f=_['merge']({},_0x36843f,_0x13bf02['options']);var _0x42388a={'where':_0x36843f[_0xbd26('0x3a')]};return db[_0xbd26('0x40')][_0xbd26('0x20')](_0x42388a)[_0xbd26('0x25')](function(_0x53f1cf){_0x50995f[_0xbd26('0x20')]=_0x53f1cf;if(_0x13bf02[_0xbd26('0x30')]['includeAll']){_0x36843f['include']=[{'all':!![]}];}return db[_0xbd26('0x40')][_0xbd26('0x41')](_0x36843f);})['then'](function(_0x3333a2){_0x50995f[_0xbd26('0x42')]=_0x3333a2;return _0x50995f;})[_0xbd26('0x25')](respondWithFilteredResult(_0x3279db,_0x36843f))['catch'](handleError(_0x3279db,null));};exports[_0xbd26('0x43')]=function(_0x3b122b,_0x496d2d){var _0x4a5f02={'raw':![],'where':{'id':_0x3b122b[_0xbd26('0x44')]['id']}},_0x1c975a={};_0x1c975a[_0xbd26('0x2f')]=_[_0xbd26('0x31')](db[_0xbd26('0x40')][_0xbd26('0x2c')]);_0x1c975a[_0xbd26('0x30')]=_[_0xbd26('0x31')](_0x3b122b[_0xbd26('0x30')]);_0x1c975a[_0xbd26('0x32')]=_['intersection'](_0x1c975a[_0xbd26('0x2f')],_0x1c975a[_0xbd26('0x30')]);_0x4a5f02[_0xbd26('0x35')]=_['intersection'](_0x1c975a[_0xbd26('0x2f')],qs[_0xbd26('0x34')](_0x3b122b[_0xbd26('0x30')][_0xbd26('0x34')]));_0x4a5f02[_0xbd26('0x35')]=_0x4a5f02[_0xbd26('0x35')][_0xbd26('0x36')]?_0x4a5f02[_0xbd26('0x35')]:_0x1c975a['model'];if(_0x3b122b[_0xbd26('0x30')][_0xbd26('0x45')]){_0x4a5f02[_0xbd26('0x46')]=[{'all':!![]}];}_0x4a5f02=_[_0xbd26('0x3c')]({},_0x4a5f02,_0x3b122b[_0xbd26('0x47')]);return db['ServicenowConfiguration'][_0xbd26('0x48')](_0x4a5f02)[_0xbd26('0x25')](handleEntityNotFound(_0x496d2d,null))['then'](respondWithResult(_0x496d2d,null))[_0xbd26('0x49')](handleError(_0x496d2d,null));};exports[_0xbd26('0x4a')]=function(_0x596d79,_0x3dd2ae){return db['ServicenowConfiguration'][_0xbd26('0x4a')](_0x596d79[_0xbd26('0x4b')],{})[_0xbd26('0x25')](respondWithResult(_0x3dd2ae,0xc9))[_0xbd26('0x49')](handleError(_0x3dd2ae,null));};exports[_0xbd26('0x4c')]=function(_0x17ac30,_0x364836){if(_0x17ac30[_0xbd26('0x4b')]['id']){delete _0x17ac30[_0xbd26('0x4b')]['id'];}return db[_0xbd26('0x40')][_0xbd26('0x48')]({'where':{'id':_0x17ac30[_0xbd26('0x44')]['id']}})[_0xbd26('0x25')](handleEntityNotFound(_0x364836,null))[_0xbd26('0x25')](saveUpdates(_0x17ac30['body'],null))[_0xbd26('0x25')](respondWithResult(_0x364836,null))[_0xbd26('0x49')](handleError(_0x364836,null));};exports[_0xbd26('0x26')]=function(_0xd4da91,_0x252b06){return db[_0xbd26('0x40')][_0xbd26('0x48')]({'where':{'id':_0xd4da91[_0xbd26('0x44')]['id']}})[_0xbd26('0x25')](handleEntityNotFound(_0x252b06,null))[_0xbd26('0x25')](removeEntity(_0x252b06,null))['catch'](handleError(_0x252b06,null));};exports['getFields']=function(_0x3e85c7,_0xca50f7,_0x5840fe){var _0x45b0fb={};var _0x1ec896={};var _0x2f553a;var _0x5f4f63;return db['ServicenowConfiguration'][_0xbd26('0x4d')]({'where':{'id':_0x3e85c7['params']['id']}})[_0xbd26('0x25')](handleEntityNotFound(_0xca50f7,null))['then'](function(_0x44cda8){if(_0x44cda8){_0x2f553a=_0x44cda8;_0x1ec896[_0xbd26('0x2f')]=_[_0xbd26('0x31')](db[_0xbd26('0x4e')][_0xbd26('0x2c')]);_0x1ec896[_0xbd26('0x30')]=_['keys'](_0x3e85c7['query']);_0x1ec896[_0xbd26('0x32')]=_[_0xbd26('0x33')](_0x1ec896[_0xbd26('0x2f')],_0x1ec896['query']);_0x45b0fb[_0xbd26('0x35')]=_[_0xbd26('0x33')](_0x1ec896['model'],qs[_0xbd26('0x34')](_0x3e85c7[_0xbd26('0x30')][_0xbd26('0x34')]));_0x45b0fb[_0xbd26('0x35')]=_0x45b0fb[_0xbd26('0x35')][_0xbd26('0x36')]?_0x45b0fb[_0xbd26('0x35')]:_0x1ec896['model'];_0x45b0fb[_0xbd26('0x38')]=qs['sort'](_0x3e85c7['query'][_0xbd26('0x39')]);_0x45b0fb[_0xbd26('0x3a')]=qs[_0xbd26('0x32')](_[_0xbd26('0x4f')](_0x3e85c7['query'],_0x1ec896[_0xbd26('0x32')]));if(_0x3e85c7[_0xbd26('0x30')][_0xbd26('0x3b')]){_0x45b0fb[_0xbd26('0x3a')]=_[_0xbd26('0x3c')](_0x45b0fb[_0xbd26('0x3a')],{'$or':_[_0xbd26('0x3d')](_0x45b0fb[_0xbd26('0x35')],function(_0x54cb21){var _0x508f84={};_0x508f84[_0x54cb21]={'$like':'%'+_0x3e85c7[_0xbd26('0x30')][_0xbd26('0x3b')]+'%'};return _0x508f84;})});}_0x45b0fb=_[_0xbd26('0x3c')]({},_0x45b0fb,_0x3e85c7[_0xbd26('0x47')]);return _0x2f553a[_0xbd26('0x50')](_0x45b0fb);}})['then'](function(_0x44dd6d){if(_0x44dd6d){_0x5f4f63=_0x44dd6d[_0xbd26('0x36')];if(!_0x3e85c7[_0xbd26('0x30')][_0xbd26('0x37')](_0xbd26('0x51'))){_0x45b0fb[_0xbd26('0x21')]=qs['limit'](_0x3e85c7[_0xbd26('0x30')][_0xbd26('0x21')]);_0x45b0fb[_0xbd26('0x1e')]=qs[_0xbd26('0x1e')](_0x3e85c7['query']['offset']);}return _0x2f553a[_0xbd26('0x50')](_0x45b0fb);}})[_0xbd26('0x25')](function(_0x42672c){if(_0x42672c){return _0x42672c?{'count':_0x5f4f63,'rows':_0x42672c}:null;}})[_0xbd26('0x25')](respondWithResult(_0xca50f7,null))[_0xbd26('0x49')](handleError(_0xca50f7,null));};exports[_0xbd26('0x52')]=function(_0x4c9b7c,_0x14b5c7,_0x50af0a){var _0xb2ed65={};var _0x252e0a={};var _0x374222;var _0x551f61;return db['ServicenowConfiguration'][_0xbd26('0x4d')]({'where':{'id':_0x4c9b7c[_0xbd26('0x44')]['id']}})[_0xbd26('0x25')](handleEntityNotFound(_0x14b5c7,null))[_0xbd26('0x25')](function(_0x2117d0){if(_0x2117d0){_0x374222=_0x2117d0;_0x252e0a['model']=_[_0xbd26('0x31')](db[_0xbd26('0x4e')][_0xbd26('0x2c')]);_0x252e0a['query']=_['keys'](_0x4c9b7c[_0xbd26('0x30')]);_0x252e0a[_0xbd26('0x32')]=_[_0xbd26('0x33')](_0x252e0a[_0xbd26('0x2f')],_0x252e0a[_0xbd26('0x30')]);_0xb2ed65[_0xbd26('0x35')]=_[_0xbd26('0x33')](_0x252e0a[_0xbd26('0x2f')],qs[_0xbd26('0x34')](_0x4c9b7c['query']['fields']));_0xb2ed65[_0xbd26('0x35')]=_0xb2ed65[_0xbd26('0x35')][_0xbd26('0x36')]?_0xb2ed65[_0xbd26('0x35')]:_0x252e0a[_0xbd26('0x2f')];_0xb2ed65[_0xbd26('0x38')]=qs[_0xbd26('0x39')](_0x4c9b7c[_0xbd26('0x30')][_0xbd26('0x39')]);_0xb2ed65['where']=qs[_0xbd26('0x32')](_[_0xbd26('0x4f')](_0x4c9b7c[_0xbd26('0x30')],_0x252e0a['filters']));if(_0x4c9b7c[_0xbd26('0x30')][_0xbd26('0x3b')]){_0xb2ed65[_0xbd26('0x3a')]=_[_0xbd26('0x3c')](_0xb2ed65[_0xbd26('0x3a')],{'$or':_[_0xbd26('0x3d')](_0xb2ed65[_0xbd26('0x35')],function(_0x1ed845){var _0x3b24a0={};_0x3b24a0[_0x1ed845]={'$like':'%'+_0x4c9b7c[_0xbd26('0x30')][_0xbd26('0x3b')]+'%'};return _0x3b24a0;})});}_0xb2ed65=_[_0xbd26('0x3c')]({},_0xb2ed65,_0x4c9b7c[_0xbd26('0x47')]);return _0x374222[_0xbd26('0x52')](_0xb2ed65);}})[_0xbd26('0x25')](function(_0x58ef8c){if(_0x58ef8c){_0x551f61=_0x58ef8c[_0xbd26('0x36')];if(!_0x4c9b7c[_0xbd26('0x30')][_0xbd26('0x37')]('nolimit')){_0xb2ed65[_0xbd26('0x21')]=qs[_0xbd26('0x21')](_0x4c9b7c[_0xbd26('0x30')]['limit']);_0xb2ed65[_0xbd26('0x1e')]=qs[_0xbd26('0x1e')](_0x4c9b7c['query']['offset']);}return _0x374222[_0xbd26('0x52')](_0xb2ed65);}})[_0xbd26('0x25')](function(_0x7afad5){if(_0x7afad5){return _0x7afad5?{'count':_0x551f61,'rows':_0x7afad5}:null;}})[_0xbd26('0x25')](respondWithResult(_0x14b5c7,null))['catch'](handleError(_0x14b5c7,null));};exports[_0xbd26('0x53')]=function(_0x1c6233,_0x20dfa2,_0x4b01f9){var _0xa5f96e={};var _0xf37283={};var _0x51ea59;var _0x56cc0a;return db[_0xbd26('0x40')][_0xbd26('0x4d')]({'where':{'id':_0x1c6233[_0xbd26('0x44')]['id']}})['then'](handleEntityNotFound(_0x20dfa2,null))[_0xbd26('0x25')](function(_0x47a275){if(_0x47a275){_0x51ea59=_0x47a275;_0xf37283[_0xbd26('0x2f')]=_[_0xbd26('0x31')](db[_0xbd26('0x4e')][_0xbd26('0x2c')]);_0xf37283['query']=_[_0xbd26('0x31')](_0x1c6233[_0xbd26('0x30')]);_0xf37283[_0xbd26('0x32')]=_['intersection'](_0xf37283[_0xbd26('0x2f')],_0xf37283[_0xbd26('0x30')]);_0xa5f96e[_0xbd26('0x35')]=_[_0xbd26('0x33')](_0xf37283[_0xbd26('0x2f')],qs['fields'](_0x1c6233[_0xbd26('0x30')][_0xbd26('0x34')]));_0xa5f96e[_0xbd26('0x35')]=_0xa5f96e[_0xbd26('0x35')][_0xbd26('0x36')]?_0xa5f96e[_0xbd26('0x35')]:_0xf37283[_0xbd26('0x2f')];_0xa5f96e[_0xbd26('0x38')]=qs[_0xbd26('0x39')](_0x1c6233[_0xbd26('0x30')][_0xbd26('0x39')]);_0xa5f96e[_0xbd26('0x3a')]=qs['filters'](_[_0xbd26('0x4f')](_0x1c6233[_0xbd26('0x30')],_0xf37283['filters']));if(_0x1c6233[_0xbd26('0x30')][_0xbd26('0x3b')]){_0xa5f96e[_0xbd26('0x3a')]=_[_0xbd26('0x3c')](_0xa5f96e[_0xbd26('0x3a')],{'$or':_['map'](_0xa5f96e[_0xbd26('0x35')],function(_0x2cea8d){var _0x146c1a={};_0x146c1a[_0x2cea8d]={'$like':'%'+_0x1c6233['query']['filter']+'%'};return _0x146c1a;})});}_0xa5f96e=_[_0xbd26('0x3c')]({},_0xa5f96e,_0x1c6233['options']);return _0x51ea59['getDescriptions'](_0xa5f96e);}})[_0xbd26('0x25')](function(_0x17485f){if(_0x17485f){_0x56cc0a=_0x17485f[_0xbd26('0x36')];if(!_0x1c6233[_0xbd26('0x30')][_0xbd26('0x37')](_0xbd26('0x51'))){_0xa5f96e[_0xbd26('0x21')]=qs[_0xbd26('0x21')](_0x1c6233[_0xbd26('0x30')][_0xbd26('0x21')]);_0xa5f96e['offset']=qs[_0xbd26('0x1e')](_0x1c6233[_0xbd26('0x30')][_0xbd26('0x1e')]);}return _0x51ea59[_0xbd26('0x53')](_0xa5f96e);}})[_0xbd26('0x25')](function(_0x5eed50){if(_0x5eed50){return _0x5eed50?{'count':_0x56cc0a,'rows':_0x5eed50}:null;}})[_0xbd26('0x25')](respondWithResult(_0x20dfa2,null))[_0xbd26('0x49')](handleError(_0x20dfa2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3076a97..e0d1e29 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 _0x5276=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12db71,_0x4ac41b){var _0x2dacbd=function(_0x5b94c1){while(--_0x5b94c1){_0x12db71['push'](_0x12db71['shift']());}};_0x2dacbd(++_0x4ac41b);}(_0x5276,0x163));var _0x6527=function(_0x5972fe,_0xbbce73){_0x5972fe=_0x5972fe-0x0;var _0x462d2c=_0x5276[_0x5972fe];return _0x462d2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6527('0x0'))(_0x6527('0x1'));var moment=require(_0x6527('0x2'));var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require(_0x6527('0x5'));var rimraf=require(_0x6527('0x6'));var config=require(_0x6527('0x7'));var attributes=require(_0x6527('0x8'));module[_0x6527('0x9')]=function(_0x3deb56,_0x9d7ba2){return _0x3deb56[_0x6527('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x6527('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80c4=['path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x528c69,_0x52020c){var _0x56700e=function(_0x120b4c){while(--_0x120b4c){_0x528c69['push'](_0x528c69['shift']());}};_0x56700e(++_0x52020c);}(_0x80c4,0xa3));var _0x480c=function(_0x28aa7c,_0x149625){_0x28aa7c=_0x28aa7c-0x0;var _0x5e86c3=_0x80c4[_0x28aa7c];return _0x5e86c3;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var logger=require(_0x480c('0x1'))(_0x480c('0x2'));var moment=require(_0x480c('0x3'));var BPromise=require(_0x480c('0x4'));var rp=require(_0x480c('0x5'));var fs=require('fs');var path=require(_0x480c('0x6'));var rimraf=require('rimraf');var config=require(_0x480c('0x7'));var attributes=require(_0x480c('0x8'));module[_0x480c('0x9')]=function(_0x1813b6,_0x9805b5){return _0x1813b6[_0x480c('0xa')](_0x480c('0xb'),attributes,{'tableName':_0x480c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index ffb3c3f..4ae3282 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 _0x9b1a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x91d72b,_0x2b4ad3){var _0xb3c49f=function(_0x22d7c0){while(--_0x22d7c0){_0x91d72b['push'](_0x91d72b['shift']());}};_0xb3c49f(++_0x2b4ad3);}(_0x9b1a,0x66));var _0xa9b1=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x9b1a[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var moment=require(_0xa9b1('0x2'));var BPromise=require(_0xa9b1('0x3'));var rs=require(_0xa9b1('0x4'));var fs=require('fs');var Redis=require(_0xa9b1('0x5'));var db=require(_0xa9b1('0x6'))['db'];var utils=require(_0xa9b1('0x7'));var logger=require(_0xa9b1('0x8'))(_0xa9b1('0x9'));var config=require(_0xa9b1('0xa'));var jayson=require(_0xa9b1('0xb'));var client=jayson[_0xa9b1('0xc')][_0xa9b1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3acf75,_0x2c505e,_0x5f4832){return new BPromise(function(_0x1865a5,_0x361161){return client[_0xa9b1('0xe')](_0x3acf75,_0x5f4832)[_0xa9b1('0xf')](function(_0x40c565){logger[_0xa9b1('0x10')](_0xa9b1('0x11'),_0x2c505e,_0xa9b1('0x12'));logger[_0xa9b1('0x13')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2c505e,_0xa9b1('0x12'),JSON[_0xa9b1('0x14')](_0x40c565));if(_0x40c565[_0xa9b1('0x15')]){if(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x16')]===0x1f4){logger[_0xa9b1('0x15')](_0xa9b1('0x11'),_0x2c505e,_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);return _0x361161(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2c505e,_0x40c565[_0xa9b1('0x15')]['message']);return _0x1865a5(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);}else{logger[_0xa9b1('0x10')](_0xa9b1('0x11'),_0x2c505e,'request\x20sent');_0x1865a5(_0x40c565[_0xa9b1('0x18')][_0xa9b1('0x17')]);}})[_0xa9b1('0x19')](function(_0x406a04){logger[_0xa9b1('0x15')](_0xa9b1('0x11'),_0x2c505e,_0x406a04);_0x361161(_0x406a04);});});} \ No newline at end of file +var _0x1a96=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x10a6c5,_0x3b8168){var _0x79e4b8=function(_0x4699c8){while(--_0x4699c8){_0x10a6c5['push'](_0x10a6c5['shift']());}};_0x79e4b8(++_0x3b8168);}(_0x1a96,0x1a3));var _0x61a9=function(_0x7d1147,_0x93a2f6){_0x7d1147=_0x7d1147-0x0;var _0x53272d=_0x1a96[_0x7d1147];return _0x53272d;};'use strict';var _=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var moment=require(_0x61a9('0x2'));var BPromise=require(_0x61a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61a9('0x4'));var db=require(_0x61a9('0x5'))['db'];var utils=require(_0x61a9('0x6'));var logger=require('../../config/logger')(_0x61a9('0x7'));var config=require(_0x61a9('0x8'));var jayson=require(_0x61a9('0x9'));var client=jayson[_0x61a9('0xa')][_0x61a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x531b19,_0x2b01b0,_0xaf822){return new BPromise(function(_0x2c092a,_0x28932f){return client[_0x61a9('0xc')](_0x531b19,_0xaf822)['then'](function(_0x396992){logger[_0x61a9('0xd')](_0x61a9('0xe'),_0x2b01b0,_0x61a9('0xf'));logger[_0x61a9('0x10')](_0x61a9('0x11'),_0x2b01b0,_0x61a9('0xf'),JSON[_0x61a9('0x12')](_0x396992));if(_0x396992[_0x61a9('0x13')]){if(_0x396992[_0x61a9('0x13')]['code']===0x1f4){logger[_0x61a9('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b01b0,_0x396992[_0x61a9('0x13')][_0x61a9('0x14')]);return _0x28932f(_0x396992[_0x61a9('0x13')][_0x61a9('0x14')]);}logger[_0x61a9('0x13')](_0x61a9('0xe'),_0x2b01b0,_0x396992[_0x61a9('0x13')][_0x61a9('0x14')]);return _0x2c092a(_0x396992[_0x61a9('0x13')][_0x61a9('0x14')]);}else{logger[_0x61a9('0xd')](_0x61a9('0xe'),_0x2b01b0,'request\x20sent');_0x2c092a(_0x396992[_0x61a9('0x15')][_0x61a9('0x14')]);}})[_0x61a9('0x16')](function(_0x53e38d){logger[_0x61a9('0x13')](_0x61a9('0xe'),_0x2b01b0,_0x53e38d);_0x28932f(_0x53e38d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ebbb639..84a1e5f 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 _0xb375=['isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x2e8b77,_0x5d473c){var _0xe01d2b=function(_0x508187){while(--_0x508187){_0x2e8b77['push'](_0x2e8b77['shift']());}};_0xe01d2b(++_0x5d473c);}(_0xb375,0x198));var _0x5b37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb375[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5b37('0x0'));var util=require(_0x5b37('0x1'));var path=require(_0x5b37('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b37('0x3'));var router=express[_0x5b37('0x4')]();var fs_extra=require(_0x5b37('0x5'));var auth=require(_0x5b37('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b37('0x7'));var controller=require(_0x5b37('0x8'));router[_0x5b37('0x9')]('/',auth[_0x5b37('0xa')](),controller[_0x5b37('0xb')]);router[_0x5b37('0x9')]('/:id',auth[_0x5b37('0xa')](),controller['show']);router[_0x5b37('0xc')]('/',auth[_0x5b37('0xa')](),controller[_0x5b37('0xd')]);router[_0x5b37('0xe')](_0x5b37('0xf'),auth['isAuthenticated'](),controller[_0x5b37('0x10')]);router['delete'](_0x5b37('0xf'),auth[_0x5b37('0xa')](),controller[_0x5b37('0x11')]);module[_0x5b37('0x12')]=router; \ No newline at end of file +var _0x7873=['../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x7873,0x73));var _0x3787=function(_0x2ea83b,_0x29bca8){_0x2ea83b=_0x2ea83b-0x0;var _0x17a99e=_0x7873[_0x2ea83b];return _0x17a99e;};'use strict';var multer=require(_0x3787('0x0'));var util=require(_0x3787('0x1'));var path=require('path');var timeout=require(_0x3787('0x2'));var express=require(_0x3787('0x3'));var router=express['Router']();var fs_extra=require(_0x3787('0x4'));var auth=require(_0x3787('0x5'));var interaction=require(_0x3787('0x6'));var config=require('../../config/environment');var controller=require(_0x3787('0x7'));router[_0x3787('0x8')]('/',auth['isAuthenticated'](),controller[_0x3787('0x9')]);router[_0x3787('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3787('0xa')]);router[_0x3787('0xb')]('/',auth[_0x3787('0xc')](),controller[_0x3787('0xd')]);router[_0x3787('0xe')](_0x3787('0xf'),auth[_0x3787('0xc')](),controller[_0x3787('0x10')]);router[_0x3787('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3787('0x12')]);module[_0x3787('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3003791..55b606b 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 _0x1e84=['picklist','STRING','string','customVariable','BOOLEAN','exports','ENUM','variable'];(function(_0x29f9db,_0x5e5419){var _0x54857f=function(_0xc10f8f){while(--_0xc10f8f){_0x29f9db['push'](_0x29f9db['shift']());}};_0x54857f(++_0x5e5419);}(_0x1e84,0x16d));var _0x41e8=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x1e84[_0x2d486b];return _0x4291d1;};'use strict';var Sequelize=require('sequelize');module[_0x41e8('0x0')]={'type':{'type':Sequelize[_0x41e8('0x1')]('string',_0x41e8('0x2'),'customVariable','keyValue',_0x41e8('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x41e8('0x4')]},'key':{'type':Sequelize[_0x41e8('0x4')]},'keyType':{'type':Sequelize[_0x41e8('0x1')](_0x41e8('0x5'),_0x41e8('0x2'),_0x41e8('0x6'))},'keyContent':{'type':Sequelize[_0x41e8('0x4')]},'idField':{'type':Sequelize[_0x41e8('0x4')]},'nameField':{'type':Sequelize[_0x41e8('0x4')]},'customField':{'type':Sequelize[_0x41e8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41e8('0x4')]}}; \ No newline at end of file +var _0x0edb=['customVariable','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x1cd8bb,_0x35629c){var _0x30366a=function(_0x2d6790){while(--_0x2d6790){_0x1cd8bb['push'](_0x1cd8bb['shift']());}};_0x30366a(++_0x35629c);}(_0x0edb,0x76));var _0xb0ed=function(_0x369cfa,_0x325318){_0x369cfa=_0x369cfa-0x0;var _0x2e3871=_0x0edb[_0x369cfa];return _0x2e3871;};'use strict';var Sequelize=require(_0xb0ed('0x0'));module[_0xb0ed('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb0ed('0x2'),_0xb0ed('0x3'),'customVariable',_0xb0ed('0x4'),_0xb0ed('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb0ed('0x6')]},'keyType':{'type':Sequelize[_0xb0ed('0x7')](_0xb0ed('0x2'),_0xb0ed('0x3'),_0xb0ed('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb0ed('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0ed('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0664fb3..6a36532 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 _0x80f4=['stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x4a292e,_0x3367eb){var _0x1c7348=function(_0x4e07da){while(--_0x4e07da){_0x4a292e['push'](_0x4a292e['shift']());}};_0x1c7348(++_0x3367eb);}(_0x80f4,0x156));var _0x480f=function(_0x39b5bd,_0x398098){_0x39b5bd=_0x39b5bd-0x0;var _0x3791cb=_0x80f4[_0x39b5bd];return _0x3791cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x480f('0x0'));var zipdir=require(_0x480f('0x1'));var jsonpatch=require(_0x480f('0x2'));var rp=require(_0x480f('0x3'));var moment=require(_0x480f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x480f('0x5'));var util=require(_0x480f('0x6'));var path=require(_0x480f('0x7'));var sox=require('sox');var csv=require(_0x480f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x480f('0x9'));var _=require(_0x480f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x480f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x480f('0x8'));var querystring=require(_0x480f('0xc'));var Papa=require(_0x480f('0xd'));var Redis=require(_0x480f('0xe'));var authService=require(_0x480f('0xf'));var qs=require(_0x480f('0x10'));var as=require(_0x480f('0x11'));var hardwareService=require(_0x480f('0x12'));var logger=require(_0x480f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x480f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x480f('0x15'))['db'];function respondWithStatusCode(_0x261c69,_0x499e3f){_0x499e3f=_0x499e3f||0xcc;return function(_0x1e119f){if(_0x1e119f){return _0x261c69[_0x480f('0x16')](_0x499e3f);}return _0x261c69[_0x480f('0x17')](_0x499e3f)[_0x480f('0x18')]();};}function respondWithResult(_0x23181e,_0x81c7ee){_0x81c7ee=_0x81c7ee||0xc8;return function(_0x42ac4c){if(_0x42ac4c){return _0x23181e[_0x480f('0x17')](_0x81c7ee)[_0x480f('0x19')](_0x42ac4c);}};}function respondWithFilteredResult(_0x596614,_0x14d900){return function(_0x57bc39){if(_0x57bc39){var _0x59ca8e=typeof _0x14d900['offset']===_0x480f('0x1a')&&typeof _0x14d900[_0x480f('0x1b')]===_0x480f('0x1a');var _0x1605a5=_0x57bc39[_0x480f('0x1c')];var _0x3e1a68=_0x59ca8e?0x0:_0x14d900['offset'];var _0x1d5966=_0x59ca8e?_0x57bc39[_0x480f('0x1c')]:_0x14d900[_0x480f('0x1d')]+_0x14d900[_0x480f('0x1b')];var _0xe2abc4;if(_0x1d5966>=_0x1605a5){_0x1d5966=_0x1605a5;_0xe2abc4=0xc8;}else{_0xe2abc4=0xce;}_0x596614[_0x480f('0x17')](_0xe2abc4);return _0x596614[_0x480f('0x1e')](_0x480f('0x1f'),_0x3e1a68+'-'+_0x1d5966+'/'+_0x1605a5)['json'](_0x57bc39);}return null;};}function patchUpdates(_0x20e857){return function(_0x2a6b04){try{jsonpatch[_0x480f('0x20')](_0x2a6b04,_0x20e857,!![]);}catch(_0x1a04b7){return BPromise['reject'](_0x1a04b7);}return _0x2a6b04[_0x480f('0x21')]();};}function saveUpdates(_0x1f27ce,_0x22e587){return function(_0x1c534f){if(_0x1c534f){return _0x1c534f[_0x480f('0x22')](_0x1f27ce)[_0x480f('0x23')](function(_0x10dc1f){return _0x10dc1f;});}return null;};}function removeEntity(_0x78c5ec,_0x275d6d){return function(_0x48a88f){if(_0x48a88f){return _0x48a88f[_0x480f('0x24')]()[_0x480f('0x23')](function(){_0x78c5ec[_0x480f('0x17')](0xcc)[_0x480f('0x18')]();});}};}function handleEntityNotFound(_0x3734dc,_0x67b830){return function(_0x5ca99f){if(!_0x5ca99f){_0x3734dc[_0x480f('0x16')](0x194);}return _0x5ca99f;};}function handleError(_0x154cfd,_0xf8a571){_0xf8a571=_0xf8a571||0x1f4;return function(_0x2ad3b5){logger[_0x480f('0x25')](_0x2ad3b5[_0x480f('0x26')]);if(_0x2ad3b5[_0x480f('0x27')]){delete _0x2ad3b5['name'];}_0x154cfd['status'](_0xf8a571)[_0x480f('0x28')](_0x2ad3b5);};}exports[_0x480f('0x29')]=function(_0x364917,_0x4b7912){var _0x32fd7c={},_0x19fd91={},_0x1f9398={'count':0x0,'rows':[]};var _0x296dfe=_[_0x480f('0x2a')](db[_0x480f('0x2b')][_0x480f('0x2c')],function(_0x1d89f1){return{'name':_0x1d89f1[_0x480f('0x2d')],'type':_0x1d89f1['type'][_0x480f('0x2e')]};});_0x19fd91[_0x480f('0x2f')]=_[_0x480f('0x2a')](_0x296dfe,_0x480f('0x27'));_0x19fd91[_0x480f('0x30')]=_[_0x480f('0x31')](_0x364917[_0x480f('0x30')]);_0x19fd91[_0x480f('0x32')]=_['intersection'](_0x19fd91['model'],_0x19fd91['query']);_0x32fd7c[_0x480f('0x33')]=_['intersection'](_0x19fd91[_0x480f('0x2f')],qs[_0x480f('0x34')](_0x364917[_0x480f('0x30')][_0x480f('0x34')]));_0x32fd7c[_0x480f('0x33')]=_0x32fd7c[_0x480f('0x33')][_0x480f('0x35')]?_0x32fd7c[_0x480f('0x33')]:_0x19fd91[_0x480f('0x2f')];if(!_0x364917[_0x480f('0x30')][_0x480f('0x36')](_0x480f('0x37'))){_0x32fd7c[_0x480f('0x1b')]=qs[_0x480f('0x1b')](_0x364917['query'][_0x480f('0x1b')]);_0x32fd7c[_0x480f('0x1d')]=qs[_0x480f('0x1d')](_0x364917[_0x480f('0x30')][_0x480f('0x1d')]);}_0x32fd7c[_0x480f('0x38')]=qs['sort'](_0x364917[_0x480f('0x30')][_0x480f('0x39')]);_0x32fd7c[_0x480f('0x3a')]=qs[_0x480f('0x32')](_[_0x480f('0x3b')](_0x364917['query'],_0x19fd91[_0x480f('0x32')]),_0x296dfe);if(_0x364917['query'][_0x480f('0x3c')]){_0x32fd7c['where']=_[_0x480f('0x3d')](_0x32fd7c['where'],{'$or':_['map'](_0x296dfe,function(_0x1f857e){if(_0x1f857e[_0x480f('0x3e')]!==_0x480f('0x3f')){var _0x3cc7ff={};_0x3cc7ff[_0x1f857e[_0x480f('0x27')]]={'$like':'%'+_0x364917[_0x480f('0x30')][_0x480f('0x3c')]+'%'};return _0x3cc7ff;}})});}_0x32fd7c=_[_0x480f('0x3d')]({},_0x32fd7c,_0x364917[_0x480f('0x40')]);var _0xf47180={'where':_0x32fd7c[_0x480f('0x3a')]};return db[_0x480f('0x2b')]['count'](_0xf47180)[_0x480f('0x23')](function(_0x37c909){_0x1f9398[_0x480f('0x1c')]=_0x37c909;if(_0x364917[_0x480f('0x30')]['includeAll']){_0x32fd7c[_0x480f('0x41')]=[{'all':!![]}];}return db[_0x480f('0x2b')][_0x480f('0x42')](_0x32fd7c);})[_0x480f('0x23')](function(_0x2c33da){_0x1f9398[_0x480f('0x43')]=_0x2c33da;return _0x1f9398;})[_0x480f('0x23')](respondWithFilteredResult(_0x4b7912,_0x32fd7c))['catch'](handleError(_0x4b7912,null));};exports[_0x480f('0x44')]=function(_0x4e0d39,_0x2f222b){var _0x3e4dee={'raw':!![],'where':{'id':_0x4e0d39[_0x480f('0x45')]['id']}},_0x51e267={};_0x51e267[_0x480f('0x2f')]=_[_0x480f('0x31')](db[_0x480f('0x2b')]['rawAttributes']);_0x51e267[_0x480f('0x30')]=_[_0x480f('0x31')](_0x4e0d39['query']);_0x51e267[_0x480f('0x32')]=_[_0x480f('0x46')](_0x51e267[_0x480f('0x2f')],_0x51e267[_0x480f('0x30')]);_0x3e4dee['attributes']=_[_0x480f('0x46')](_0x51e267[_0x480f('0x2f')],qs[_0x480f('0x34')](_0x4e0d39[_0x480f('0x30')][_0x480f('0x34')]));_0x3e4dee[_0x480f('0x33')]=_0x3e4dee[_0x480f('0x33')][_0x480f('0x35')]?_0x3e4dee[_0x480f('0x33')]:_0x51e267[_0x480f('0x2f')];if(_0x4e0d39['query'][_0x480f('0x47')]){_0x3e4dee[_0x480f('0x41')]=[{'all':!![]}];}_0x3e4dee=_[_0x480f('0x3d')]({},_0x3e4dee,_0x4e0d39[_0x480f('0x40')]);return db[_0x480f('0x2b')][_0x480f('0x48')](_0x3e4dee)[_0x480f('0x23')](handleEntityNotFound(_0x2f222b,null))[_0x480f('0x23')](respondWithResult(_0x2f222b,null))[_0x480f('0x49')](handleError(_0x2f222b,null));};exports[_0x480f('0x4a')]=function(_0x20f808,_0x4e1307){return db['ServicenowField'][_0x480f('0x4a')](_0x20f808[_0x480f('0x4b')],{})[_0x480f('0x23')](respondWithResult(_0x4e1307,0xc9))[_0x480f('0x49')](handleError(_0x4e1307,null));};exports[_0x480f('0x22')]=function(_0x24857a,_0x1ea737){if(_0x24857a['body']['id']){delete _0x24857a['body']['id'];}return db[_0x480f('0x2b')][_0x480f('0x48')]({'where':{'id':_0x24857a['params']['id']}})[_0x480f('0x23')](handleEntityNotFound(_0x1ea737,null))[_0x480f('0x23')](saveUpdates(_0x24857a[_0x480f('0x4b')],null))[_0x480f('0x23')](respondWithResult(_0x1ea737,null))[_0x480f('0x49')](handleError(_0x1ea737,null));};exports[_0x480f('0x24')]=function(_0x4a144e,_0x3abcb2){return db['ServicenowField'][_0x480f('0x48')]({'where':{'id':_0x4a144e[_0x480f('0x45')]['id']}})[_0x480f('0x23')](handleEntityNotFound(_0x3abcb2,null))[_0x480f('0x23')](removeEntity(_0x3abcb2,null))[_0x480f('0x49')](handleError(_0x3abcb2,null));}; \ No newline at end of file +var _0x0213=['stack','name','index','map','ServicenowField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0213,0x106));var _0x3021=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x0213[_0x45346d];return _0x5ce7ca;};'use strict';var emlformat=require(_0x3021('0x0'));var rimraf=require(_0x3021('0x1'));var zipdir=require(_0x3021('0x2'));var jsonpatch=require(_0x3021('0x3'));var rp=require(_0x3021('0x4'));var moment=require('moment');var BPromise=require(_0x3021('0x5'));var Mustache=require(_0x3021('0x6'));var util=require(_0x3021('0x7'));var path=require(_0x3021('0x8'));var sox=require(_0x3021('0x9'));var csv=require(_0x3021('0xa'));var ejs=require(_0x3021('0xb'));var fs=require('fs');var fs_extra=require(_0x3021('0xc'));var _=require(_0x3021('0xd'));var squel=require(_0x3021('0xe'));var crypto=require('crypto');var jsforce=require(_0x3021('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3021('0xa'));var querystring=require(_0x3021('0x10'));var Papa=require(_0x3021('0x11'));var Redis=require(_0x3021('0x12'));var authService=require(_0x3021('0x13'));var qs=require(_0x3021('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3021('0x15'));var logger=require(_0x3021('0x16'))('api');var utils=require(_0x3021('0x17'));var config=require(_0x3021('0x18'));var licenseUtil=require(_0x3021('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3363,_0x55ba9b){_0x55ba9b=_0x55ba9b||0xcc;return function(_0x113d6a){if(_0x113d6a){return _0x1b3363[_0x3021('0x1a')](_0x55ba9b);}return _0x1b3363[_0x3021('0x1b')](_0x55ba9b)[_0x3021('0x1c')]();};}function respondWithResult(_0x448b63,_0x932a2f){_0x932a2f=_0x932a2f||0xc8;return function(_0x4d4ed6){if(_0x4d4ed6){return _0x448b63[_0x3021('0x1b')](_0x932a2f)['json'](_0x4d4ed6);}};}function respondWithFilteredResult(_0x4aa213,_0x4494ed){return function(_0x50bca2){if(_0x50bca2){var _0x26f662=typeof _0x4494ed['offset']===_0x3021('0x1d')&&typeof _0x4494ed['limit']==='undefined';var _0x412d8b=_0x50bca2[_0x3021('0x1e')];var _0x1c2f67=_0x26f662?0x0:_0x4494ed['offset'];var _0x26ea0a=_0x26f662?_0x50bca2['count']:_0x4494ed[_0x3021('0x1f')]+_0x4494ed[_0x3021('0x20')];var _0x143524;if(_0x26ea0a>=_0x412d8b){_0x26ea0a=_0x412d8b;_0x143524=0xc8;}else{_0x143524=0xce;}_0x4aa213[_0x3021('0x1b')](_0x143524);return _0x4aa213[_0x3021('0x21')](_0x3021('0x22'),_0x1c2f67+'-'+_0x26ea0a+'/'+_0x412d8b)[_0x3021('0x23')](_0x50bca2);}return null;};}function patchUpdates(_0x1465b3){return function(_0x25661e){try{jsonpatch[_0x3021('0x24')](_0x25661e,_0x1465b3,!![]);}catch(_0x5bb93f){return BPromise[_0x3021('0x25')](_0x5bb93f);}return _0x25661e[_0x3021('0x26')]();};}function saveUpdates(_0x422e3f,_0x5ab691){return function(_0x30b854){if(_0x30b854){return _0x30b854['update'](_0x422e3f)['then'](function(_0x561b1d){return _0x561b1d;});}return null;};}function removeEntity(_0x476cae,_0x185d16){return function(_0x3e2d65){if(_0x3e2d65){return _0x3e2d65[_0x3021('0x27')]()[_0x3021('0x28')](function(){_0x476cae[_0x3021('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b94cc,_0x2ecdc9){return function(_0x2b4120){if(!_0x2b4120){_0x5b94cc[_0x3021('0x1a')](0x194);}return _0x2b4120;};}function handleError(_0x2d80a5,_0xf20a2d){_0xf20a2d=_0xf20a2d||0x1f4;return function(_0x52e603){logger[_0x3021('0x29')](_0x52e603[_0x3021('0x2a')]);if(_0x52e603[_0x3021('0x2b')]){delete _0x52e603[_0x3021('0x2b')];}_0x2d80a5[_0x3021('0x1b')](_0xf20a2d)['send'](_0x52e603);};}exports[_0x3021('0x2c')]=function(_0x264b75,_0xe0e5ec){var _0x7c29db={},_0x2c3066={},_0x1f1d3b={'count':0x0,'rows':[]};var _0x5e6a88=_[_0x3021('0x2d')](db[_0x3021('0x2e')]['rawAttributes'],function(_0x5f1c44){return{'name':_0x5f1c44[_0x3021('0x2f')],'type':_0x5f1c44[_0x3021('0x30')][_0x3021('0x31')]};});_0x2c3066['model']=_['map'](_0x5e6a88,'name');_0x2c3066[_0x3021('0x32')]=_[_0x3021('0x33')](_0x264b75[_0x3021('0x32')]);_0x2c3066[_0x3021('0x34')]=_[_0x3021('0x35')](_0x2c3066[_0x3021('0x36')],_0x2c3066[_0x3021('0x32')]);_0x7c29db['attributes']=_[_0x3021('0x35')](_0x2c3066[_0x3021('0x36')],qs['fields'](_0x264b75[_0x3021('0x32')][_0x3021('0x37')]));_0x7c29db[_0x3021('0x38')]=_0x7c29db['attributes']['length']?_0x7c29db[_0x3021('0x38')]:_0x2c3066[_0x3021('0x36')];if(!_0x264b75[_0x3021('0x32')][_0x3021('0x39')](_0x3021('0x3a'))){_0x7c29db[_0x3021('0x20')]=qs[_0x3021('0x20')](_0x264b75[_0x3021('0x32')][_0x3021('0x20')]);_0x7c29db[_0x3021('0x1f')]=qs[_0x3021('0x1f')](_0x264b75[_0x3021('0x32')][_0x3021('0x1f')]);}_0x7c29db['order']=qs[_0x3021('0x3b')](_0x264b75[_0x3021('0x32')][_0x3021('0x3b')]);_0x7c29db['where']=qs[_0x3021('0x34')](_[_0x3021('0x3c')](_0x264b75[_0x3021('0x32')],_0x2c3066[_0x3021('0x34')]),_0x5e6a88);if(_0x264b75[_0x3021('0x32')][_0x3021('0x3d')]){_0x7c29db[_0x3021('0x3e')]=_['merge'](_0x7c29db['where'],{'$or':_[_0x3021('0x2d')](_0x5e6a88,function(_0x2f44d3){if(_0x2f44d3[_0x3021('0x30')]!==_0x3021('0x3f')){var _0x2d3de5={};_0x2d3de5[_0x2f44d3['name']]={'$like':'%'+_0x264b75['query'][_0x3021('0x3d')]+'%'};return _0x2d3de5;}})});}_0x7c29db=_[_0x3021('0x40')]({},_0x7c29db,_0x264b75[_0x3021('0x41')]);var _0xd5b821={'where':_0x7c29db[_0x3021('0x3e')]};return db[_0x3021('0x2e')]['count'](_0xd5b821)[_0x3021('0x28')](function(_0x54149f){_0x1f1d3b[_0x3021('0x1e')]=_0x54149f;if(_0x264b75[_0x3021('0x32')][_0x3021('0x42')]){_0x7c29db[_0x3021('0x43')]=[{'all':!![]}];}return db[_0x3021('0x2e')]['findAll'](_0x7c29db);})[_0x3021('0x28')](function(_0x2f57ce){_0x1f1d3b[_0x3021('0x44')]=_0x2f57ce;return _0x1f1d3b;})['then'](respondWithFilteredResult(_0xe0e5ec,_0x7c29db))[_0x3021('0x45')](handleError(_0xe0e5ec,null));};exports[_0x3021('0x46')]=function(_0x4c414b,_0x2ff7e8){var _0x3b07d7={'raw':!![],'where':{'id':_0x4c414b[_0x3021('0x47')]['id']}},_0xd9eab2={};_0xd9eab2[_0x3021('0x36')]=_['keys'](db[_0x3021('0x2e')][_0x3021('0x48')]);_0xd9eab2['query']=_['keys'](_0x4c414b['query']);_0xd9eab2[_0x3021('0x34')]=_[_0x3021('0x35')](_0xd9eab2[_0x3021('0x36')],_0xd9eab2[_0x3021('0x32')]);_0x3b07d7[_0x3021('0x38')]=_[_0x3021('0x35')](_0xd9eab2[_0x3021('0x36')],qs[_0x3021('0x37')](_0x4c414b[_0x3021('0x32')]['fields']));_0x3b07d7[_0x3021('0x38')]=_0x3b07d7[_0x3021('0x38')]['length']?_0x3b07d7[_0x3021('0x38')]:_0xd9eab2['model'];if(_0x4c414b['query']['includeAll']){_0x3b07d7[_0x3021('0x43')]=[{'all':!![]}];}_0x3b07d7=_[_0x3021('0x40')]({},_0x3b07d7,_0x4c414b[_0x3021('0x41')]);return db[_0x3021('0x2e')]['find'](_0x3b07d7)[_0x3021('0x28')](handleEntityNotFound(_0x2ff7e8,null))[_0x3021('0x28')](respondWithResult(_0x2ff7e8,null))[_0x3021('0x45')](handleError(_0x2ff7e8,null));};exports[_0x3021('0x49')]=function(_0x5f5429,_0x4ee431){return db['ServicenowField'][_0x3021('0x49')](_0x5f5429['body'],{})[_0x3021('0x28')](respondWithResult(_0x4ee431,0xc9))[_0x3021('0x45')](handleError(_0x4ee431,null));};exports['update']=function(_0x5614e7,_0x3ae9f7){if(_0x5614e7[_0x3021('0x4a')]['id']){delete _0x5614e7[_0x3021('0x4a')]['id'];}return db[_0x3021('0x2e')][_0x3021('0x4b')]({'where':{'id':_0x5614e7['params']['id']}})[_0x3021('0x28')](handleEntityNotFound(_0x3ae9f7,null))[_0x3021('0x28')](saveUpdates(_0x5614e7[_0x3021('0x4a')],null))[_0x3021('0x28')](respondWithResult(_0x3ae9f7,null))[_0x3021('0x45')](handleError(_0x3ae9f7,null));};exports['destroy']=function(_0xf6da44,_0x312864){return db[_0x3021('0x2e')][_0x3021('0x4b')]({'where':{'id':_0xf6da44[_0x3021('0x47')]['id']}})['then'](handleEntityNotFound(_0x312864,null))[_0x3021('0x28')](removeEntity(_0x312864,null))[_0x3021('0x45')](handleError(_0x312864,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bfea4df..5815c8a 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 _0x7066=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x5ed695,_0x4bf6bb){var _0x18a87f=function(_0x166bc1){while(--_0x166bc1){_0x5ed695['push'](_0x5ed695['shift']());}};_0x18a87f(++_0x4bf6bb);}(_0x7066,0x13e));var _0x6706=function(_0x134efb,_0x396a5a){_0x134efb=_0x134efb-0x0;var _0x3c73cb=_0x7066[_0x134efb];return _0x3c73cb;};'use strict';var _=require(_0x6706('0x0'));var util=require(_0x6706('0x1'));var logger=require(_0x6706('0x2'))(_0x6706('0x3'));var moment=require(_0x6706('0x4'));var BPromise=require(_0x6706('0x5'));var rp=require(_0x6706('0x6'));var fs=require('fs');var path=require(_0x6706('0x7'));var rimraf=require('rimraf');var config=require(_0x6706('0x8'));var attributes=require(_0x6706('0x9'));module['exports']=function(_0x34636f,_0x128992){return _0x34636f[_0x6706('0xa')](_0x6706('0xb'),attributes,{'tableName':_0x6706('0xc'),'paranoid':![],'indexes':[{'name':_0x6706('0xd'),'fields':[_0x6706('0xe'),_0x6706('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f32=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x0f32,0x1cc));var _0x20f3=function(_0x25e7c8,_0x47a4dd){_0x25e7c8=_0x25e7c8-0x0;var _0x17c2c4=_0x0f32[_0x25e7c8];return _0x17c2c4;};'use strict';var _=require('lodash');var util=require(_0x20f3('0x0'));var logger=require('../../config/logger')(_0x20f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f3('0x2'));var rimraf=require(_0x20f3('0x3'));var config=require(_0x20f3('0x4'));var attributes=require(_0x20f3('0x5'));module[_0x20f3('0x6')]=function(_0x52f3e3,_0x1bd5dc){return _0x52f3e3[_0x20f3('0x7')]('ServicenowField',attributes,{'tableName':_0x20f3('0x8'),'paranoid':![],'indexes':[{'name':_0x20f3('0x9'),'fields':[_0x20f3('0xa'),_0x20f3('0xb')],'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 6ce43a4..21995e4 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37e70f,_0x3e5ab3){var _0x157260=function(_0xf1f5ea){while(--_0xf1f5ea){_0x37e70f['push'](_0x37e70f['shift']());}};_0x157260(++_0x3e5ab3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1f0d91,_0x24b032){_0x1f0d91=_0x1f0d91-0x0;var _0xafee7a=_0xbdb7[_0x1f0d91];return _0xafee7a;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 54c7a20..4d0e144 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(_0xeaaf5e,_0x5bf210){var _0x1a5267=function(_0x5ce63b){while(--_0x5ce63b){_0xeaaf5e['push'](_0xeaaf5e['shift']());}};_0x1a5267(++_0x5bf210);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x39c870,_0x256801){var _0x3db0c2=function(_0x61037f){while(--_0x61037f){_0x39c870['push'](_0x39c870['shift']());}};_0x3db0c2(++_0x256801);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index aaa9513..7bce553 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(_0x4697fc,_0x4c63d0){var _0x5f0e20=function(_0xbceb08){while(--_0xbceb08){_0x4697fc['push'](_0x4697fc['shift']());}};_0x5f0e20(++_0x4c63d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0xf204a7,_0x197c8c){var _0x38a0ee=function(_0x40b45c){while(--_0x40b45c){_0xf204a7['push'](_0xf204a7['shift']());}};_0x38a0ee(++_0x197c8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 c07191b..b324983 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 _0x99bf=['moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','SugarcrmConfiguration','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x505faa,_0x11145c){var _0x3645bc=function(_0x3b2b64){while(--_0x3b2b64){_0x505faa['push'](_0x505faa['shift']());}};_0x3645bc(++_0x11145c);}(_0x99bf,0x72));var _0xf99b=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x99bf[_0x2b9e8a];return _0x520e67;};'use strict';var emlformat=require(_0xf99b('0x0'));var rimraf=require(_0xf99b('0x1'));var zipdir=require(_0xf99b('0x2'));var jsonpatch=require(_0xf99b('0x3'));var rp=require(_0xf99b('0x4'));var moment=require(_0xf99b('0x5'));var BPromise=require(_0xf99b('0x6'));var Mustache=require(_0xf99b('0x7'));var util=require(_0xf99b('0x8'));var path=require(_0xf99b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf99b('0xa'));var _=require(_0xf99b('0xb'));var squel=require(_0xf99b('0xc'));var crypto=require(_0xf99b('0xd'));var jsforce=require(_0xf99b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf99b('0xf'));var Redis=require(_0xf99b('0x10'));var authService=require(_0xf99b('0x11'));var qs=require(_0xf99b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf99b('0x13'));var logger=require(_0xf99b('0x14'))(_0xf99b('0x15'));var utils=require(_0xf99b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf99b('0x17'));var db=require(_0xf99b('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2afc10,_0x5dd6ce){_0x5dd6ce=_0x5dd6ce||0xcc;return function(_0x3358b5){if(_0x3358b5){return _0x2afc10['sendStatus'](_0x5dd6ce);}return _0x2afc10[_0xf99b('0x19')](_0x5dd6ce)[_0xf99b('0x1a')]();};}function respondWithResult(_0x5eb5f3,_0x921a92){_0x921a92=_0x921a92||0xc8;return function(_0x4f15f5){if(_0x4f15f5){return _0x5eb5f3[_0xf99b('0x19')](_0x921a92)[_0xf99b('0x1b')](_0x4f15f5);}};}function respondWithFilteredResult(_0x46395e,_0x38a0d9){return function(_0x1e6110){if(_0x1e6110){var _0x5abcc7=typeof _0x38a0d9[_0xf99b('0x1c')]==='undefined'&&typeof _0x38a0d9[_0xf99b('0x1d')]===_0xf99b('0x1e');var _0x15bb58=_0x1e6110[_0xf99b('0x1f')];var _0x5ade2c=_0x5abcc7?0x0:_0x38a0d9['offset'];var _0x21cd37=_0x5abcc7?_0x1e6110['count']:_0x38a0d9[_0xf99b('0x1c')]+_0x38a0d9['limit'];var _0x119add;if(_0x21cd37>=_0x15bb58){_0x21cd37=_0x15bb58;_0x119add=0xc8;}else{_0x119add=0xce;}_0x46395e[_0xf99b('0x19')](_0x119add);return _0x46395e[_0xf99b('0x20')](_0xf99b('0x21'),_0x5ade2c+'-'+_0x21cd37+'/'+_0x15bb58)[_0xf99b('0x1b')](_0x1e6110);}return null;};}function patchUpdates(_0x262ec7){return function(_0x32c83d){try{jsonpatch[_0xf99b('0x22')](_0x32c83d,_0x262ec7,!![]);}catch(_0x1a02be){return BPromise[_0xf99b('0x23')](_0x1a02be);}return _0x32c83d['save']();};}function saveUpdates(_0x21cd29,_0x36c64d){return function(_0x190513){if(_0x190513){return _0x190513[_0xf99b('0x24')](_0x21cd29)[_0xf99b('0x25')](function(_0x48df70){return _0x48df70;});}return null;};}function removeEntity(_0x5207e4,_0x427cd0){return function(_0x2ff7a1){if(_0x2ff7a1){return _0x2ff7a1[_0xf99b('0x26')]()[_0xf99b('0x25')](function(){_0x5207e4[_0xf99b('0x19')](0xcc)[_0xf99b('0x1a')]();});}};}function handleEntityNotFound(_0x4600a6,_0x26d598){return function(_0x51af84){if(!_0x51af84){_0x4600a6['sendStatus'](0x194);}return _0x51af84;};}function handleError(_0x1e9183,_0x47828e){_0x47828e=_0x47828e||0x1f4;return function(_0x4b2aeb){logger['error'](_0x4b2aeb[_0xf99b('0x27')]);if(_0x4b2aeb[_0xf99b('0x28')]){delete _0x4b2aeb[_0xf99b('0x28')];}_0x1e9183[_0xf99b('0x19')](_0x47828e)[_0xf99b('0x29')](_0x4b2aeb);};}exports[_0xf99b('0x2a')]=function(_0x4e9d8d,_0x200dd1){var _0x4b5e84={},_0x441f08={},_0x59069e={'count':0x0,'rows':[]};var _0x27b634=_[_0xf99b('0x2b')](db[_0xf99b('0x2c')][_0xf99b('0x2d')],function(_0xa9d8b1){return{'name':_0xa9d8b1[_0xf99b('0x2e')],'type':_0xa9d8b1['type'][_0xf99b('0x2f')]};});_0x441f08['model']=_[_0xf99b('0x2b')](_0x27b634,_0xf99b('0x28'));_0x441f08[_0xf99b('0x30')]=_[_0xf99b('0x31')](_0x4e9d8d['query']);_0x441f08[_0xf99b('0x32')]=_[_0xf99b('0x33')](_0x441f08[_0xf99b('0x34')],_0x441f08[_0xf99b('0x30')]);_0x4b5e84[_0xf99b('0x35')]=_[_0xf99b('0x33')](_0x441f08[_0xf99b('0x34')],qs[_0xf99b('0x36')](_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x36')]));_0x4b5e84[_0xf99b('0x35')]=_0x4b5e84[_0xf99b('0x35')][_0xf99b('0x37')]?_0x4b5e84['attributes']:_0x441f08[_0xf99b('0x34')];if(!_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x38')](_0xf99b('0x39'))){_0x4b5e84[_0xf99b('0x1d')]=qs['limit'](_0x4e9d8d['query'][_0xf99b('0x1d')]);_0x4b5e84['offset']=qs[_0xf99b('0x1c')](_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x1c')]);}_0x4b5e84[_0xf99b('0x3a')]=qs[_0xf99b('0x3b')](_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x3b')]);_0x4b5e84[_0xf99b('0x3c')]=qs[_0xf99b('0x32')](_[_0xf99b('0x3d')](_0x4e9d8d[_0xf99b('0x30')],_0x441f08['filters']),_0x27b634);if(_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x3e')]){_0x4b5e84[_0xf99b('0x3c')]=_[_0xf99b('0x3f')](_0x4b5e84['where'],{'$or':_[_0xf99b('0x2b')](_0x27b634,function(_0x3d08c9){if(_0x3d08c9[_0xf99b('0x40')]!=='VIRTUAL'){var _0x5b1141={};_0x5b1141[_0x3d08c9[_0xf99b('0x28')]]={'$like':'%'+_0x4e9d8d[_0xf99b('0x30')]['filter']+'%'};return _0x5b1141;}})});}_0x4b5e84=_[_0xf99b('0x3f')]({},_0x4b5e84,_0x4e9d8d['options']);var _0x488e1e={'where':_0x4b5e84[_0xf99b('0x3c')]};return db[_0xf99b('0x2c')][_0xf99b('0x1f')](_0x488e1e)[_0xf99b('0x25')](function(_0x2f1397){_0x59069e[_0xf99b('0x1f')]=_0x2f1397;if(_0x4e9d8d[_0xf99b('0x30')][_0xf99b('0x41')]){_0x4b5e84['include']=[{'all':!![]}];}return db[_0xf99b('0x2c')][_0xf99b('0x42')](_0x4b5e84);})[_0xf99b('0x25')](function(_0x5c27c4){_0x59069e[_0xf99b('0x43')]=_0x5c27c4;return _0x59069e;})[_0xf99b('0x25')](respondWithFilteredResult(_0x200dd1,_0x4b5e84))['catch'](handleError(_0x200dd1,null));};exports[_0xf99b('0x44')]=function(_0x320932,_0x10033e){var _0xb9aad={'raw':![],'where':{'id':_0x320932[_0xf99b('0x45')]['id']}},_0x42c992={};_0x42c992[_0xf99b('0x34')]=_[_0xf99b('0x31')](db[_0xf99b('0x2c')][_0xf99b('0x2d')]);_0x42c992[_0xf99b('0x30')]=_[_0xf99b('0x31')](_0x320932[_0xf99b('0x30')]);_0x42c992[_0xf99b('0x32')]=_[_0xf99b('0x33')](_0x42c992['model'],_0x42c992[_0xf99b('0x30')]);_0xb9aad[_0xf99b('0x35')]=_[_0xf99b('0x33')](_0x42c992['model'],qs[_0xf99b('0x36')](_0x320932[_0xf99b('0x30')][_0xf99b('0x36')]));_0xb9aad[_0xf99b('0x35')]=_0xb9aad[_0xf99b('0x35')]['length']?_0xb9aad[_0xf99b('0x35')]:_0x42c992[_0xf99b('0x34')];if(_0x320932['query']['includeAll']){_0xb9aad[_0xf99b('0x46')]=[{'all':!![]}];}_0xb9aad=_[_0xf99b('0x3f')]({},_0xb9aad,_0x320932['options']);return db[_0xf99b('0x2c')][_0xf99b('0x47')](_0xb9aad)[_0xf99b('0x25')](handleEntityNotFound(_0x10033e,null))[_0xf99b('0x25')](respondWithResult(_0x10033e,null))[_0xf99b('0x48')](handleError(_0x10033e,null));};exports[_0xf99b('0x49')]=function(_0x493dbb,_0x3cbdd9){return db[_0xf99b('0x2c')][_0xf99b('0x49')](_0x493dbb[_0xf99b('0x4a')],{})['then'](respondWithResult(_0x3cbdd9,0xc9))[_0xf99b('0x48')](handleError(_0x3cbdd9,null));};exports[_0xf99b('0x24')]=function(_0x310bf3,_0xe54504){if(_0x310bf3[_0xf99b('0x4a')]['id']){delete _0x310bf3[_0xf99b('0x4a')]['id'];}return db['SugarcrmAccount'][_0xf99b('0x47')]({'where':{'id':_0x310bf3[_0xf99b('0x45')]['id']}})[_0xf99b('0x25')](handleEntityNotFound(_0xe54504,null))[_0xf99b('0x25')](saveUpdates(_0x310bf3[_0xf99b('0x4a')],null))[_0xf99b('0x25')](respondWithResult(_0xe54504,null))[_0xf99b('0x48')](handleError(_0xe54504,null));};exports[_0xf99b('0x26')]=function(_0x240ffb,_0x28127a){return db[_0xf99b('0x2c')][_0xf99b('0x47')]({'where':{'id':_0x240ffb[_0xf99b('0x45')]['id']}})[_0xf99b('0x25')](handleEntityNotFound(_0x28127a,null))[_0xf99b('0x25')](removeEntity(_0x28127a,null))[_0xf99b('0x48')](handleError(_0x28127a,null));};exports[_0xf99b('0x4b')]=function(_0x5d8d8d,_0x88e1c4,_0x4da6cb){var _0x40d7c5={};var _0x526210={};var _0x53276a;var _0x5ec2c6;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5d8d8d[_0xf99b('0x45')]['id']}})[_0xf99b('0x25')](handleEntityNotFound(_0x88e1c4,null))[_0xf99b('0x25')](function(_0x4a7263){if(_0x4a7263){_0x53276a=_0x4a7263;_0x526210['model']=_['keys'](db[_0xf99b('0x4c')][_0xf99b('0x2d')]);_0x526210[_0xf99b('0x30')]=_[_0xf99b('0x31')](_0x5d8d8d[_0xf99b('0x30')]);_0x526210[_0xf99b('0x32')]=_[_0xf99b('0x33')](_0x526210['model'],_0x526210[_0xf99b('0x30')]);_0x40d7c5[_0xf99b('0x35')]=_[_0xf99b('0x33')](_0x526210[_0xf99b('0x34')],qs[_0xf99b('0x36')](_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x36')]));_0x40d7c5[_0xf99b('0x35')]=_0x40d7c5[_0xf99b('0x35')][_0xf99b('0x37')]?_0x40d7c5[_0xf99b('0x35')]:_0x526210[_0xf99b('0x34')];_0x40d7c5[_0xf99b('0x3a')]=qs['sort'](_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x3b')]);_0x40d7c5[_0xf99b('0x3c')]=qs['filters'](_[_0xf99b('0x3d')](_0x5d8d8d['query'],_0x526210[_0xf99b('0x32')]));if(_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x3e')]){_0x40d7c5[_0xf99b('0x3c')]=_[_0xf99b('0x3f')](_0x40d7c5['where'],{'$or':_[_0xf99b('0x2b')](_0x40d7c5[_0xf99b('0x35')],function(_0x350c17){var _0x2aedad={};_0x2aedad[_0x350c17]={'$like':'%'+_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x3e')]+'%'};return _0x2aedad;})});}_0x40d7c5=_[_0xf99b('0x3f')]({},_0x40d7c5,_0x5d8d8d[_0xf99b('0x4d')]);return _0x53276a['getConfigurations'](_0x40d7c5);}})[_0xf99b('0x25')](function(_0x2a0a6e){if(_0x2a0a6e){_0x5ec2c6=_0x2a0a6e[_0xf99b('0x37')];if(!_0x5d8d8d['query'][_0xf99b('0x38')](_0xf99b('0x39'))){_0x40d7c5[_0xf99b('0x1d')]=qs[_0xf99b('0x1d')](_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x1d')]);_0x40d7c5['offset']=qs['offset'](_0x5d8d8d[_0xf99b('0x30')][_0xf99b('0x1c')]);}return _0x53276a[_0xf99b('0x4b')](_0x40d7c5);}})[_0xf99b('0x25')](function(_0x16b3dc){if(_0x16b3dc){return _0x16b3dc?{'count':_0x5ec2c6,'rows':_0x16b3dc}:null;}})['then'](respondWithResult(_0x88e1c4,null))[_0xf99b('0x48')](handleError(_0x88e1c4,null));};exports[_0xf99b('0x4e')]=function(_0x4a9c83,_0x3d58d6,_0x432b40){if(_0x4a9c83['body']['id']){delete _0x4a9c83[_0xf99b('0x4a')]['id'];}return db['SugarcrmAccount'][_0xf99b('0x4f')]({'where':{'id':_0x4a9c83['params']['id']}})[_0xf99b('0x25')](handleEntityNotFound(_0x3d58d6,null))[_0xf99b('0x25')](function(_0x2a848d){if(_0x2a848d){_0x4a9c83['body'][_0xf99b('0x50')]=_0x2a848d['id'];_0x4a9c83[_0xf99b('0x4a')][_0xf99b('0x51')]=integrations[_0xf99b('0x52')](_0x4a9c83[_0xf99b('0x4a')][_0xf99b('0x53')],_0x4a9c83[_0xf99b('0x4a')]['type']);_0x4a9c83[_0xf99b('0x4a')][_0xf99b('0x54')]=integrations[_0xf99b('0x55')](_0x4a9c83[_0xf99b('0x4a')][_0xf99b('0x53')],_0x4a9c83[_0xf99b('0x4a')]['type']);return db[_0xf99b('0x4c')][_0xf99b('0x49')](_0x4a9c83['body'],{'include':[{'model':db[_0xf99b('0x56')],'as':_0xf99b('0x51')},{'model':db[_0xf99b('0x56')],'as':_0xf99b('0x54')}]});}return null;})[_0xf99b('0x25')](respondWithResult(_0x3d58d6,null))[_0xf99b('0x48')](handleError(_0x3d58d6,null));};exports[_0xf99b('0x57')]=function(_0x264b45,_0x3f1343,_0x1430cd){var _0x963ad2='';var _0x6efe96=['id',_0xf99b('0x28'),'assigned_user_id','created_by',_0xf99b('0x58'),'date_start',_0xf99b('0x59'),_0xf99b('0x5a'),_0xf99b('0x5b'),_0xf99b('0x5c'),'parent_name',_0xf99b('0x5d')];return db[_0xf99b('0x2c')]['findOne']({'where':{'id':_0x264b45[_0xf99b('0x45')]['id']},'attributes':['id',_0xf99b('0x5e'),_0xf99b('0x5f'),'remoteUri']})[_0xf99b('0x25')](handleEntityNotFound(_0x3f1343,null))['then'](function(_0x37cddc){if(_0x37cddc){_0x963ad2=_0x37cddc[_0xf99b('0x60')];var _0x169d6c=_0x963ad2[_0xf99b('0x61')](-0x1);if(_0x169d6c==='/'){_0x963ad2=_0x963ad2[_0xf99b('0x62')](0x0,_0x963ad2[_0xf99b('0x63')](_0x169d6c));}return rp({'method':_0xf99b('0x64'),'uri':util[_0xf99b('0x65')](_0xf99b('0x66'),_0x963ad2,_0xf99b('0x67')),'json':!![],'form':{'method':'login','input_type':_0xf99b('0x68'),'response_type':_0xf99b('0x68'),'rest_data':JSON[_0xf99b('0x69')]({'user_auth':{'user_name':_0x37cddc[_0xf99b('0x5e')],'password':_0x37cddc[_0xf99b('0x5f')],'encryption':_0xf99b('0x6a')},'application':_0xf99b('0x6b')})}});}})[_0xf99b('0x25')](function(_0x20ef26){if(_0x20ef26&&_0x20ef26['name']!==_0xf99b('0x6c')&&_0x20ef26[_0xf99b('0x28')]!==_0xf99b('0x6d')){return rp({'method':_0xf99b('0x64'),'uri':util[_0xf99b('0x65')]('%s%s',_0x963ad2,_0xf99b('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x20ef26['id'],'module_name':_0xf99b('0x6e')})}})[_0xf99b('0x25')](function(_0x1b920e){if(_0x1b920e){var _0x1cc87f=_[_0xf99b('0x6f')](_0x1b920e[_0xf99b('0x70')]);_[_0xf99b('0x71')](_0x1cc87f,function(_0x37f559){return _0x6efe96[_0xf99b('0x72')](_0x37f559[_0xf99b('0x28')]);});return{'count':_0x1cc87f['length'],'rows':_[_0xf99b('0x2b')](_0x1cc87f,function(_0x515093){return{'id':_0x515093['name'],'name':_0x515093[_0xf99b('0x73')],'custom':_['endsWith'](_0x515093[_0xf99b('0x28')],'_c')?!![]:![],'options':_0x515093[_0xf99b('0x4d')]?_['map'](_[_0xf99b('0x6f')](_0x515093[_0xf99b('0x4d')]),function(_0x5358be){return{'name':_0x5358be['value'],'value':_0x5358be['name']};}):[]};})};}})[_0xf99b('0x25')](respondWithResult(_0x3f1343,null))[_0xf99b('0x48')](function(_0x25abc2){var _0xf8d00d=_0x264b45[_0xf99b('0x30')][_0xf99b('0x74')]?0x1f4:_0x25abc2['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf99b('0x57'),_0xf8d00d,JSON[_0xf99b('0x69')](_0x25abc2));delete _0x25abc2['name'];if(_0xf8d00d===0x191){_0xf8d00d=0x190;}_0x3f1343[_0xf99b('0x19')](_0xf8d00d)[_0xf99b('0x29')](_0x264b45[_0xf99b('0x30')][_0xf99b('0x74')]?{'message':_0xf99b('0x75'),'statusCode':_0x25abc2[_0xf99b('0x76')]}:_0x25abc2);});}else{var _0x10df93=0x1f4;_0x3f1343['status'](_0x10df93)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x0160=['limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','stringify','values','module_fields','remove','includes','endsWith','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x0160,0x1bc));var _0x0016=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x0160[_0x133277];return _0x5b4a22;};'use strict';var emlformat=require(_0x0016('0x0'));var rimraf=require(_0x0016('0x1'));var zipdir=require(_0x0016('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0016('0x3'));var moment=require(_0x0016('0x4'));var BPromise=require(_0x0016('0x5'));var Mustache=require('mustache');var util=require(_0x0016('0x6'));var path=require(_0x0016('0x7'));var sox=require(_0x0016('0x8'));var csv=require(_0x0016('0x9'));var ejs=require(_0x0016('0xa'));var fs=require('fs');var fs_extra=require(_0x0016('0xb'));var _=require(_0x0016('0xc'));var squel=require(_0x0016('0xd'));var crypto=require(_0x0016('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0016('0xf'));var toCsv=require(_0x0016('0x9'));var querystring=require(_0x0016('0x10'));var Papa=require('papaparse');var Redis=require(_0x0016('0x11'));var authService=require(_0x0016('0x12'));var qs=require(_0x0016('0x13'));var as=require(_0x0016('0x14'));var hardwareService=require(_0x0016('0x15'));var logger=require(_0x0016('0x16'))(_0x0016('0x17'));var utils=require(_0x0016('0x18'));var config=require(_0x0016('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0016('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x34a7f2,_0x5e53f7){_0x5e53f7=_0x5e53f7||0xcc;return function(_0x15e20f){if(_0x15e20f){return _0x34a7f2[_0x0016('0x1b')](_0x5e53f7);}return _0x34a7f2[_0x0016('0x1c')](_0x5e53f7)[_0x0016('0x1d')]();};}function respondWithResult(_0x39c02a,_0x542525){_0x542525=_0x542525||0xc8;return function(_0x1c5159){if(_0x1c5159){return _0x39c02a[_0x0016('0x1c')](_0x542525)['json'](_0x1c5159);}};}function respondWithFilteredResult(_0x582735,_0x525215){return function(_0xe8a38b){if(_0xe8a38b){var _0x321404=typeof _0x525215[_0x0016('0x1e')]===_0x0016('0x1f')&&typeof _0x525215[_0x0016('0x20')]===_0x0016('0x1f');var _0x4a84e0=_0xe8a38b[_0x0016('0x21')];var _0x5d482c=_0x321404?0x0:_0x525215['offset'];var _0x266b81=_0x321404?_0xe8a38b[_0x0016('0x21')]:_0x525215['offset']+_0x525215[_0x0016('0x20')];var _0x2c60d3;if(_0x266b81>=_0x4a84e0){_0x266b81=_0x4a84e0;_0x2c60d3=0xc8;}else{_0x2c60d3=0xce;}_0x582735[_0x0016('0x1c')](_0x2c60d3);return _0x582735[_0x0016('0x22')]('Content-Range',_0x5d482c+'-'+_0x266b81+'/'+_0x4a84e0)[_0x0016('0x23')](_0xe8a38b);}return null;};}function patchUpdates(_0x339fde){return function(_0x36cc7d){try{jsonpatch[_0x0016('0x24')](_0x36cc7d,_0x339fde,!![]);}catch(_0xbfef3f){return BPromise[_0x0016('0x25')](_0xbfef3f);}return _0x36cc7d[_0x0016('0x26')]();};}function saveUpdates(_0x50021e,_0x45122b){return function(_0x79b54f){if(_0x79b54f){return _0x79b54f[_0x0016('0x27')](_0x50021e)[_0x0016('0x28')](function(_0x36b4d7){return _0x36b4d7;});}return null;};}function removeEntity(_0x583bc5,_0x365acf){return function(_0x7f806c){if(_0x7f806c){return _0x7f806c[_0x0016('0x29')]()[_0x0016('0x28')](function(){_0x583bc5[_0x0016('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4b4f,_0xb8b4f6){return function(_0x487944){if(!_0x487944){_0x5f4b4f[_0x0016('0x1b')](0x194);}return _0x487944;};}function handleError(_0x359e64,_0x5e918f){_0x5e918f=_0x5e918f||0x1f4;return function(_0x27611d){logger[_0x0016('0x2a')](_0x27611d[_0x0016('0x2b')]);if(_0x27611d['name']){delete _0x27611d[_0x0016('0x2c')];}_0x359e64['status'](_0x5e918f)[_0x0016('0x2d')](_0x27611d);};}exports[_0x0016('0x2e')]=function(_0x2cdccf,_0x46c72e){var _0x54cfe3={},_0x5a8b5a={},_0x3f7715={'count':0x0,'rows':[]};var _0x142f6d=_['map'](db[_0x0016('0x2f')][_0x0016('0x30')],function(_0xa31a95){return{'name':_0xa31a95[_0x0016('0x31')],'type':_0xa31a95[_0x0016('0x32')][_0x0016('0x33')]};});_0x5a8b5a['model']=_['map'](_0x142f6d,'name');_0x5a8b5a[_0x0016('0x34')]=_[_0x0016('0x35')](_0x2cdccf[_0x0016('0x34')]);_0x5a8b5a[_0x0016('0x36')]=_[_0x0016('0x37')](_0x5a8b5a[_0x0016('0x38')],_0x5a8b5a[_0x0016('0x34')]);_0x54cfe3[_0x0016('0x39')]=_[_0x0016('0x37')](_0x5a8b5a['model'],qs[_0x0016('0x3a')](_0x2cdccf[_0x0016('0x34')][_0x0016('0x3a')]));_0x54cfe3[_0x0016('0x39')]=_0x54cfe3[_0x0016('0x39')]['length']?_0x54cfe3[_0x0016('0x39')]:_0x5a8b5a[_0x0016('0x38')];if(!_0x2cdccf['query'][_0x0016('0x3b')]('nolimit')){_0x54cfe3[_0x0016('0x20')]=qs['limit'](_0x2cdccf[_0x0016('0x34')][_0x0016('0x20')]);_0x54cfe3['offset']=qs[_0x0016('0x1e')](_0x2cdccf[_0x0016('0x34')][_0x0016('0x1e')]);}_0x54cfe3['order']=qs[_0x0016('0x3c')](_0x2cdccf[_0x0016('0x34')][_0x0016('0x3c')]);_0x54cfe3[_0x0016('0x3d')]=qs['filters'](_[_0x0016('0x3e')](_0x2cdccf[_0x0016('0x34')],_0x5a8b5a[_0x0016('0x36')]),_0x142f6d);if(_0x2cdccf[_0x0016('0x34')][_0x0016('0x3f')]){_0x54cfe3[_0x0016('0x3d')]=_[_0x0016('0x40')](_0x54cfe3[_0x0016('0x3d')],{'$or':_[_0x0016('0x41')](_0x142f6d,function(_0x2c3ed0){if(_0x2c3ed0[_0x0016('0x32')]!=='VIRTUAL'){var _0xbde572={};_0xbde572[_0x2c3ed0[_0x0016('0x2c')]]={'$like':'%'+_0x2cdccf['query'][_0x0016('0x3f')]+'%'};return _0xbde572;}})});}_0x54cfe3=_[_0x0016('0x40')]({},_0x54cfe3,_0x2cdccf[_0x0016('0x42')]);var _0x5caca6={'where':_0x54cfe3['where']};return db['SugarcrmAccount']['count'](_0x5caca6)[_0x0016('0x28')](function(_0x50cd92){_0x3f7715[_0x0016('0x21')]=_0x50cd92;if(_0x2cdccf[_0x0016('0x34')][_0x0016('0x43')]){_0x54cfe3['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x54cfe3);})[_0x0016('0x28')](function(_0x2e1311){_0x3f7715[_0x0016('0x44')]=_0x2e1311;return _0x3f7715;})[_0x0016('0x28')](respondWithFilteredResult(_0x46c72e,_0x54cfe3))['catch'](handleError(_0x46c72e,null));};exports[_0x0016('0x45')]=function(_0x9bb0cd,_0xd461fe){var _0x6b57a3={'raw':![],'where':{'id':_0x9bb0cd[_0x0016('0x46')]['id']}},_0x1e577f={};_0x1e577f['model']=_[_0x0016('0x35')](db[_0x0016('0x2f')][_0x0016('0x30')]);_0x1e577f[_0x0016('0x34')]=_[_0x0016('0x35')](_0x9bb0cd[_0x0016('0x34')]);_0x1e577f[_0x0016('0x36')]=_[_0x0016('0x37')](_0x1e577f['model'],_0x1e577f[_0x0016('0x34')]);_0x6b57a3[_0x0016('0x39')]=_['intersection'](_0x1e577f[_0x0016('0x38')],qs[_0x0016('0x3a')](_0x9bb0cd[_0x0016('0x34')][_0x0016('0x3a')]));_0x6b57a3[_0x0016('0x39')]=_0x6b57a3[_0x0016('0x39')][_0x0016('0x47')]?_0x6b57a3[_0x0016('0x39')]:_0x1e577f['model'];if(_0x9bb0cd['query'][_0x0016('0x43')]){_0x6b57a3['include']=[{'all':!![]}];}_0x6b57a3=_['merge']({},_0x6b57a3,_0x9bb0cd[_0x0016('0x42')]);return db['SugarcrmAccount'][_0x0016('0x48')](_0x6b57a3)[_0x0016('0x28')](handleEntityNotFound(_0xd461fe,null))[_0x0016('0x28')](respondWithResult(_0xd461fe,null))[_0x0016('0x49')](handleError(_0xd461fe,null));};exports['create']=function(_0x162156,_0x2a9a6c){return db[_0x0016('0x2f')][_0x0016('0x4a')](_0x162156[_0x0016('0x4b')],{})[_0x0016('0x28')](respondWithResult(_0x2a9a6c,0xc9))['catch'](handleError(_0x2a9a6c,null));};exports['update']=function(_0x535734,_0x47a10e){if(_0x535734[_0x0016('0x4b')]['id']){delete _0x535734[_0x0016('0x4b')]['id'];}return db['SugarcrmAccount'][_0x0016('0x48')]({'where':{'id':_0x535734['params']['id']}})['then'](handleEntityNotFound(_0x47a10e,null))['then'](saveUpdates(_0x535734[_0x0016('0x4b')],null))[_0x0016('0x28')](respondWithResult(_0x47a10e,null))[_0x0016('0x49')](handleError(_0x47a10e,null));};exports[_0x0016('0x29')]=function(_0x4b35ce,_0x351363){return db[_0x0016('0x2f')][_0x0016('0x48')]({'where':{'id':_0x4b35ce[_0x0016('0x46')]['id']}})[_0x0016('0x28')](handleEntityNotFound(_0x351363,null))[_0x0016('0x28')](removeEntity(_0x351363,null))['catch'](handleError(_0x351363,null));};exports[_0x0016('0x4c')]=function(_0x2649fa,_0x5643b6,_0x40d9f9){var _0x3a7722={};var _0xbd95fb={};var _0x4372b5;var _0x46f6ed;return db[_0x0016('0x2f')][_0x0016('0x4d')]({'where':{'id':_0x2649fa[_0x0016('0x46')]['id']}})[_0x0016('0x28')](handleEntityNotFound(_0x5643b6,null))[_0x0016('0x28')](function(_0x1dc71a){if(_0x1dc71a){_0x4372b5=_0x1dc71a;_0xbd95fb[_0x0016('0x38')]=_[_0x0016('0x35')](db[_0x0016('0x4e')]['rawAttributes']);_0xbd95fb[_0x0016('0x34')]=_[_0x0016('0x35')](_0x2649fa[_0x0016('0x34')]);_0xbd95fb['filters']=_[_0x0016('0x37')](_0xbd95fb['model'],_0xbd95fb[_0x0016('0x34')]);_0x3a7722[_0x0016('0x39')]=_[_0x0016('0x37')](_0xbd95fb[_0x0016('0x38')],qs['fields'](_0x2649fa[_0x0016('0x34')][_0x0016('0x3a')]));_0x3a7722[_0x0016('0x39')]=_0x3a7722['attributes'][_0x0016('0x47')]?_0x3a7722[_0x0016('0x39')]:_0xbd95fb[_0x0016('0x38')];_0x3a7722[_0x0016('0x4f')]=qs[_0x0016('0x3c')](_0x2649fa['query'][_0x0016('0x3c')]);_0x3a7722[_0x0016('0x3d')]=qs[_0x0016('0x36')](_[_0x0016('0x3e')](_0x2649fa[_0x0016('0x34')],_0xbd95fb[_0x0016('0x36')]));if(_0x2649fa['query'][_0x0016('0x3f')]){_0x3a7722['where']=_[_0x0016('0x40')](_0x3a7722[_0x0016('0x3d')],{'$or':_[_0x0016('0x41')](_0x3a7722['attributes'],function(_0xc6afeb){var _0x49464a={};_0x49464a[_0xc6afeb]={'$like':'%'+_0x2649fa[_0x0016('0x34')][_0x0016('0x3f')]+'%'};return _0x49464a;})});}_0x3a7722=_[_0x0016('0x40')]({},_0x3a7722,_0x2649fa[_0x0016('0x42')]);return _0x4372b5[_0x0016('0x4c')](_0x3a7722);}})[_0x0016('0x28')](function(_0x127980){if(_0x127980){_0x46f6ed=_0x127980[_0x0016('0x47')];if(!_0x2649fa[_0x0016('0x34')]['hasOwnProperty'](_0x0016('0x50'))){_0x3a7722[_0x0016('0x20')]=qs[_0x0016('0x20')](_0x2649fa[_0x0016('0x34')]['limit']);_0x3a7722[_0x0016('0x1e')]=qs[_0x0016('0x1e')](_0x2649fa[_0x0016('0x34')]['offset']);}return _0x4372b5[_0x0016('0x4c')](_0x3a7722);}})['then'](function(_0x2644a4){if(_0x2644a4){return _0x2644a4?{'count':_0x46f6ed,'rows':_0x2644a4}:null;}})[_0x0016('0x28')](respondWithResult(_0x5643b6,null))[_0x0016('0x49')](handleError(_0x5643b6,null));};exports[_0x0016('0x51')]=function(_0x3f0d73,_0x4fe52e,_0x3746ff){if(_0x3f0d73[_0x0016('0x4b')]['id']){delete _0x3f0d73[_0x0016('0x4b')]['id'];}return db[_0x0016('0x2f')][_0x0016('0x4d')]({'where':{'id':_0x3f0d73[_0x0016('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fe52e,null))['then'](function(_0x5aeabd){if(_0x5aeabd){_0x3f0d73[_0x0016('0x4b')][_0x0016('0x52')]=_0x5aeabd['id'];_0x3f0d73[_0x0016('0x4b')][_0x0016('0x53')]=integrations[_0x0016('0x54')](_0x3f0d73[_0x0016('0x4b')][_0x0016('0x55')],_0x3f0d73[_0x0016('0x4b')][_0x0016('0x32')]);_0x3f0d73['body'][_0x0016('0x56')]=integrations['getDescriptions'](_0x3f0d73['body'][_0x0016('0x55')],_0x3f0d73[_0x0016('0x4b')][_0x0016('0x32')]);return db[_0x0016('0x4e')][_0x0016('0x4a')](_0x3f0d73[_0x0016('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':_0x0016('0x53')},{'model':db[_0x0016('0x57')],'as':_0x0016('0x56')}]});}return null;})['then'](respondWithResult(_0x4fe52e,null))[_0x0016('0x49')](handleError(_0x4fe52e,null));};exports[_0x0016('0x58')]=function(_0x379130,_0x30dfc5,_0x4f1a4d){var _0x16f120='';var _0x1c6d83=['id',_0x0016('0x2c'),_0x0016('0x59'),'created_by','description',_0x0016('0x5a'),_0x0016('0x5b'),_0x0016('0x5c'),'parent_id',_0x0016('0x5d'),_0x0016('0x5e'),_0x0016('0x5f')];return db[_0x0016('0x2f')][_0x0016('0x4d')]({'where':{'id':_0x379130[_0x0016('0x46')]['id']},'attributes':['id',_0x0016('0x60'),_0x0016('0x61'),_0x0016('0x62')]})[_0x0016('0x28')](handleEntityNotFound(_0x30dfc5,null))['then'](function(_0x46af37){if(_0x46af37){_0x16f120=_0x46af37[_0x0016('0x62')];var _0x3ac35e=_0x16f120[_0x0016('0x63')](-0x1);if(_0x3ac35e==='/'){_0x16f120=_0x16f120[_0x0016('0x64')](0x0,_0x16f120['lastIndexOf'](_0x3ac35e));}return rp({'method':_0x0016('0x65'),'uri':util['format'](_0x0016('0x66'),_0x16f120,_0x0016('0x67')),'json':!![],'form':{'method':'login','input_type':_0x0016('0x68'),'response_type':_0x0016('0x68'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x46af37[_0x0016('0x60')],'password':_0x46af37[_0x0016('0x61')],'encryption':_0x0016('0x69')},'application':_0x0016('0x6a')})}});}})[_0x0016('0x28')](function(_0x154217){if(_0x154217&&_0x154217['name']!==_0x0016('0x6b')&&_0x154217[_0x0016('0x2c')]!==_0x0016('0x6c')){return rp({'method':_0x0016('0x65'),'uri':util[_0x0016('0x6d')](_0x0016('0x66'),_0x16f120,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0016('0x68'),'response_type':_0x0016('0x68'),'rest_data':JSON[_0x0016('0x6e')]({'session':_0x154217['id'],'module_name':'Calls'})}})[_0x0016('0x28')](function(_0x15639a){if(_0x15639a){var _0x372248=_[_0x0016('0x6f')](_0x15639a[_0x0016('0x70')]);_[_0x0016('0x71')](_0x372248,function(_0x1d2f7d){return _0x1c6d83[_0x0016('0x72')](_0x1d2f7d[_0x0016('0x2c')]);});return{'count':_0x372248[_0x0016('0x47')],'rows':_[_0x0016('0x41')](_0x372248,function(_0x122d09){return{'id':_0x122d09[_0x0016('0x2c')],'name':_0x122d09['label'],'custom':_[_0x0016('0x73')](_0x122d09['name'],'_c')?!![]:![],'options':_0x122d09['options']?_['map'](_[_0x0016('0x6f')](_0x122d09[_0x0016('0x42')]),function(_0x14df44){return{'name':_0x14df44['value'],'value':_0x14df44[_0x0016('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x30dfc5,null))[_0x0016('0x49')](function(_0x4ae6f8){var _0x38ea18=_0x379130[_0x0016('0x34')][_0x0016('0x74')]?0x1f4:_0x4ae6f8[_0x0016('0x75')]||0x1f4;logger[_0x0016('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x38ea18,JSON[_0x0016('0x6e')](_0x4ae6f8));delete _0x4ae6f8['name'];if(_0x38ea18===0x191){_0x38ea18=0x190;}_0x30dfc5[_0x0016('0x1c')](_0x38ea18)[_0x0016('0x2d')](_0x379130[_0x0016('0x34')]['test']?{'message':_0x0016('0x76'),'statusCode':_0x4ae6f8[_0x0016('0x75')]}:_0x4ae6f8);});}else{var _0x2adcfb=0x1f4;_0x30dfc5[_0x0016('0x1c')](_0x2adcfb)[_0x0016('0x2d')]({'message':_0x0016('0x76'),'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 fa2235d..2d9204c 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 _0x552c=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5909b8,_0x50b753){var _0x1791c2=function(_0x83bf5e){while(--_0x83bf5e){_0x5909b8['push'](_0x5909b8['shift']());}};_0x1791c2(++_0x50b753);}(_0x552c,0x6f));var _0xc552=function(_0x2ff28d,_0x5d4d8a){_0x2ff28d=_0x2ff28d-0x0;var _0x5efbd9=_0x552c[_0x2ff28d];return _0x5efbd9;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var logger=require('../../config/logger')(_0xc552('0x2'));var moment=require(_0xc552('0x3'));var BPromise=require(_0xc552('0x4'));var rp=require(_0xc552('0x5'));var fs=require('fs');var path=require(_0xc552('0x6'));var rimraf=require(_0xc552('0x7'));var config=require(_0xc552('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xc552('0x9'));module['exports']=function(_0x5ee408,_0x10f38d){return _0x5ee408[_0xc552('0xa')](_0xc552('0xb'),attributes,{'tableName':_0xc552('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0da=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x2bb382,_0x4952cb){var _0x500c5f=function(_0x18a07e){while(--_0x18a07e){_0x2bb382['push'](_0x2bb382['shift']());}};_0x500c5f(++_0x4952cb);}(_0xa0da,0x183));var _0xaa0d=function(_0x40bb35,_0x5b247f){_0x40bb35=_0x40bb35-0x0;var _0x462d4e=_0xa0da[_0x40bb35];return _0x462d4e;};'use strict';var _=require(_0xaa0d('0x0'));var util=require('util');var logger=require(_0xaa0d('0x1'))(_0xaa0d('0x2'));var moment=require(_0xaa0d('0x3'));var BPromise=require(_0xaa0d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa0d('0x5'));var rimraf=require(_0xaa0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa0d('0x7'));var integrations=require(_0xaa0d('0x8'));module['exports']=function(_0x3a207f,_0x2c076b){return _0x3a207f['define'](_0xaa0d('0x9'),attributes,{'tableName':_0xaa0d('0xa'),'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 6ea4c38..8e8d5ee 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 _0x6ece=['util','bluebird','randomstring','ioredis','../../config/environment','client','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','attributes','include','map','model','info','GetSugarcrmAccount','SugarcrmAccount','find','raw','where','ShowSugarcrmAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ece,0x10e));var _0xe6ec=function(_0x3a7b81,_0x46553f){_0x3a7b81=_0x3a7b81-0x0;var _0x2f2309=_0x6ece[_0x3a7b81];return _0x2f2309;};'use strict';var _=require('lodash');var util=require(_0xe6ec('0x0'));var moment=require('moment');var BPromise=require(_0xe6ec('0x1'));var rs=require(_0xe6ec('0x2'));var fs=require('fs');var Redis=require(_0xe6ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe6ec('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xe6ec('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47ed3e,_0x58d699,_0xf4b36d){return new BPromise(function(_0x81f8d9,_0x2757e9){return client['request'](_0x47ed3e,_0xf4b36d)[_0xe6ec('0x6')](function(_0x2c64fd){logger['info'](_0xe6ec('0x7'),_0x58d699,_0xe6ec('0x8'));logger[_0xe6ec('0x9')](_0xe6ec('0xa'),_0x58d699,_0xe6ec('0x8'),JSON[_0xe6ec('0xb')](_0x2c64fd));if(_0x2c64fd['error']){if(_0x2c64fd[_0xe6ec('0xc')][_0xe6ec('0xd')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x58d699,_0x2c64fd[_0xe6ec('0xc')][_0xe6ec('0xe')]);return _0x2757e9(_0x2c64fd[_0xe6ec('0xc')][_0xe6ec('0xe')]);}logger[_0xe6ec('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x58d699,_0x2c64fd['error']['message']);return _0x81f8d9(_0x2c64fd[_0xe6ec('0xc')][_0xe6ec('0xe')]);}else{logger['info'](_0xe6ec('0x7'),_0x58d699,'request\x20sent');_0x81f8d9(_0x2c64fd[_0xe6ec('0xf')][_0xe6ec('0xe')]);}})[_0xe6ec('0x10')](function(_0x432691){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x58d699,_0x432691);_0x2757e9(_0x432691);});});}exports['GetSugarcrmAccount']=function(_0x4c8f2d){var _0x1a09d5=this;return new Promise(function(_0x3a8374,_0x3300d4){return db['SugarcrmAccount'][_0xe6ec('0x11')]({'raw':_0x4c8f2d[_0xe6ec('0x12')]?_0x4c8f2d[_0xe6ec('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x4c8f2d[_0xe6ec('0x12')]?_0x4c8f2d[_0xe6ec('0x12')]['where']||null:null,'attributes':_0x4c8f2d[_0xe6ec('0x12')]?_0x4c8f2d[_0xe6ec('0x12')][_0xe6ec('0x13')]||null:null,'limit':_0x4c8f2d['options']?_0x4c8f2d[_0xe6ec('0x12')]['limit']||null:null,'include':_0x4c8f2d[_0xe6ec('0x12')]?_0x4c8f2d[_0xe6ec('0x12')][_0xe6ec('0x14')]?_[_0xe6ec('0x15')](_0x4c8f2d[_0xe6ec('0x12')][_0xe6ec('0x14')],function(_0x3c6607){return{'model':db[_0x3c6607[_0xe6ec('0x16')]],'as':_0x3c6607['as'],'attributes':_0x3c6607[_0xe6ec('0x13')],'include':_0x3c6607[_0xe6ec('0x14')]?_[_0xe6ec('0x15')](_0x3c6607[_0xe6ec('0x14')],function(_0x112a9b){return{'model':db[_0x112a9b[_0xe6ec('0x16')]],'as':_0x112a9b['as'],'attributes':_0x112a9b[_0xe6ec('0x13')],'include':_0x112a9b['include']?_['map'](_0x112a9b[_0xe6ec('0x14')],function(_0x4b511c){return{'model':db[_0x4b511c['model']],'as':_0x4b511c['as'],'attributes':_0x4b511c[_0xe6ec('0x13')]};}):[]};}):[]};}):[]:[]})[_0xe6ec('0x6')](function(_0x328648){logger[_0xe6ec('0x17')](_0xe6ec('0x18'),_0x4c8f2d);logger[_0xe6ec('0x9')](_0xe6ec('0x18'),_0x4c8f2d,JSON['stringify'](_0x328648));_0x3a8374(_0x328648);})['catch'](function(_0x10a6a4){logger[_0xe6ec('0xc')](_0xe6ec('0x18'),_0x10a6a4['message'],_0x4c8f2d);_0x3300d4(_0x1a09d5[_0xe6ec('0xc')](0x1f4,_0x10a6a4[_0xe6ec('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0x387532){var _0x5e2320=this;return new Promise(function(_0x37e1be,_0x557c20){return db[_0xe6ec('0x19')][_0xe6ec('0x1a')]({'raw':_0x387532[_0xe6ec('0x12')]?_0x387532[_0xe6ec('0x12')][_0xe6ec('0x1b')]===undefined?!![]:![]:!![],'where':_0x387532[_0xe6ec('0x12')]?_0x387532[_0xe6ec('0x12')][_0xe6ec('0x1c')]||null:null,'attributes':_0x387532[_0xe6ec('0x12')]?_0x387532[_0xe6ec('0x12')][_0xe6ec('0x13')]||null:null,'include':_0x387532[_0xe6ec('0x12')]?_0x387532['options'][_0xe6ec('0x14')]?_['map'](_0x387532['options']['include'],function(_0x5947a6){return{'model':db[_0x5947a6['model']],'as':_0x5947a6['as'],'attributes':_0x5947a6[_0xe6ec('0x13')],'include':_0x5947a6[_0xe6ec('0x14')]?_[_0xe6ec('0x15')](_0x5947a6[_0xe6ec('0x14')],function(_0x111396){return{'model':db[_0x111396[_0xe6ec('0x16')]],'as':_0x111396['as'],'attributes':_0x111396['attributes'],'include':_0x111396[_0xe6ec('0x14')]?_[_0xe6ec('0x15')](_0x111396[_0xe6ec('0x14')],function(_0x374bb9){return{'model':db[_0x374bb9[_0xe6ec('0x16')]],'as':_0x374bb9['as'],'attributes':_0x374bb9[_0xe6ec('0x13')]};}):[]};}):[]};}):[]:[]})[_0xe6ec('0x6')](function(_0x56b87a){logger[_0xe6ec('0x17')](_0xe6ec('0x1d'),_0x387532);logger[_0xe6ec('0x9')](_0xe6ec('0x1d'),_0x387532,JSON['stringify'](_0x56b87a));_0x37e1be(_0x56b87a);})['catch'](function(_0x4c7453){logger[_0xe6ec('0xc')]('ShowSugarcrmAccount',_0x4c7453[_0xe6ec('0xe')],_0x387532);_0x557c20(_0x5e2320[_0xe6ec('0xc')](0x1f4,_0x4c7453[_0xe6ec('0xe')]));});});}; \ No newline at end of file +var _0x9f13=['raw','attributes','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','options'];(function(_0x530070,_0x282ad0){var _0xa8fd16=function(_0x4fc906){while(--_0x4fc906){_0x530070['push'](_0x530070['shift']());}};_0xa8fd16(++_0x282ad0);}(_0x9f13,0x119));var _0x39f1=function(_0x59a1d9,_0x181115){_0x59a1d9=_0x59a1d9-0x0;var _0x577f9c=_0x9f13[_0x59a1d9];return _0x577f9c;};'use strict';var _=require(_0x39f1('0x0'));var util=require(_0x39f1('0x1'));var moment=require(_0x39f1('0x2'));var BPromise=require(_0x39f1('0x3'));var rs=require(_0x39f1('0x4'));var fs=require('fs');var Redis=require(_0x39f1('0x5'));var db=require(_0x39f1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x39f1('0x7'))(_0x39f1('0x8'));var config=require(_0x39f1('0x9'));var jayson=require(_0x39f1('0xa'));var client=jayson[_0x39f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x316997,_0x5c6832,_0x2792e3){return new BPromise(function(_0x120f1a,_0x19ed40){return client[_0x39f1('0xc')](_0x316997,_0x2792e3)[_0x39f1('0xd')](function(_0x4fdb3e){logger[_0x39f1('0xe')](_0x39f1('0xf'),_0x5c6832,_0x39f1('0x10'));logger['debug'](_0x39f1('0x11'),_0x5c6832,_0x39f1('0x10'),JSON[_0x39f1('0x12')](_0x4fdb3e));if(_0x4fdb3e['error']){if(_0x4fdb3e[_0x39f1('0x13')][_0x39f1('0x14')]===0x1f4){logger['error'](_0x39f1('0xf'),_0x5c6832,_0x4fdb3e[_0x39f1('0x13')][_0x39f1('0x15')]);return _0x19ed40(_0x4fdb3e[_0x39f1('0x13')][_0x39f1('0x15')]);}logger[_0x39f1('0x13')](_0x39f1('0xf'),_0x5c6832,_0x4fdb3e['error'][_0x39f1('0x15')]);return _0x120f1a(_0x4fdb3e[_0x39f1('0x13')][_0x39f1('0x15')]);}else{logger[_0x39f1('0xe')](_0x39f1('0xf'),_0x5c6832,_0x39f1('0x10'));_0x120f1a(_0x4fdb3e['result'][_0x39f1('0x15')]);}})[_0x39f1('0x16')](function(_0x26534d){logger['error'](_0x39f1('0xf'),_0x5c6832,_0x26534d);_0x19ed40(_0x26534d);});});}exports[_0x39f1('0x17')]=function(_0x2455e1){var _0x132fe6=this;return new Promise(function(_0x19eb1d,_0x172dff){return db['SugarcrmAccount']['findAll']({'raw':_0x2455e1[_0x39f1('0x18')]?_0x2455e1[_0x39f1('0x18')][_0x39f1('0x19')]===undefined?!![]:![]:!![],'where':_0x2455e1[_0x39f1('0x18')]?_0x2455e1[_0x39f1('0x18')]['where']||null:null,'attributes':_0x2455e1[_0x39f1('0x18')]?_0x2455e1[_0x39f1('0x18')][_0x39f1('0x1a')]||null:null,'limit':_0x2455e1[_0x39f1('0x18')]?_0x2455e1[_0x39f1('0x18')]['limit']||null:null,'include':_0x2455e1[_0x39f1('0x18')]?_0x2455e1[_0x39f1('0x18')]['include']?_[_0x39f1('0x1b')](_0x2455e1[_0x39f1('0x18')][_0x39f1('0x1c')],function(_0x57f578){return{'model':db[_0x57f578['model']],'as':_0x57f578['as'],'attributes':_0x57f578[_0x39f1('0x1a')],'include':_0x57f578[_0x39f1('0x1c')]?_[_0x39f1('0x1b')](_0x57f578['include'],function(_0x5eea56){return{'model':db[_0x5eea56[_0x39f1('0x1d')]],'as':_0x5eea56['as'],'attributes':_0x5eea56[_0x39f1('0x1a')],'include':_0x5eea56[_0x39f1('0x1c')]?_[_0x39f1('0x1b')](_0x5eea56[_0x39f1('0x1c')],function(_0x5c7d75){return{'model':db[_0x5c7d75[_0x39f1('0x1d')]],'as':_0x5c7d75['as'],'attributes':_0x5c7d75[_0x39f1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x39f1('0xd')](function(_0x4cdf36){logger['info'](_0x39f1('0x17'),_0x2455e1);logger['debug']('GetSugarcrmAccount',_0x2455e1,JSON['stringify'](_0x4cdf36));_0x19eb1d(_0x4cdf36);})[_0x39f1('0x16')](function(_0x33fcaf){logger[_0x39f1('0x13')]('GetSugarcrmAccount',_0x33fcaf[_0x39f1('0x15')],_0x2455e1);_0x172dff(_0x132fe6[_0x39f1('0x13')](0x1f4,_0x33fcaf[_0x39f1('0x15')]));});});};exports[_0x39f1('0x1e')]=function(_0x3e77a1){var _0x32161f=this;return new Promise(function(_0x1a2774,_0x26318c){return db[_0x39f1('0x1f')][_0x39f1('0x20')]({'raw':_0x3e77a1[_0x39f1('0x18')]?_0x3e77a1[_0x39f1('0x18')][_0x39f1('0x19')]===undefined?!![]:![]:!![],'where':_0x3e77a1[_0x39f1('0x18')]?_0x3e77a1[_0x39f1('0x18')][_0x39f1('0x21')]||null:null,'attributes':_0x3e77a1[_0x39f1('0x18')]?_0x3e77a1['options'][_0x39f1('0x1a')]||null:null,'include':_0x3e77a1[_0x39f1('0x18')]?_0x3e77a1['options'][_0x39f1('0x1c')]?_[_0x39f1('0x1b')](_0x3e77a1['options'][_0x39f1('0x1c')],function(_0x4bcfd8){return{'model':db[_0x4bcfd8[_0x39f1('0x1d')]],'as':_0x4bcfd8['as'],'attributes':_0x4bcfd8[_0x39f1('0x1a')],'include':_0x4bcfd8[_0x39f1('0x1c')]?_[_0x39f1('0x1b')](_0x4bcfd8[_0x39f1('0x1c')],function(_0x37c370){return{'model':db[_0x37c370[_0x39f1('0x1d')]],'as':_0x37c370['as'],'attributes':_0x37c370[_0x39f1('0x1a')],'include':_0x37c370[_0x39f1('0x1c')]?_[_0x39f1('0x1b')](_0x37c370[_0x39f1('0x1c')],function(_0x45620e){return{'model':db[_0x45620e[_0x39f1('0x1d')]],'as':_0x45620e['as'],'attributes':_0x45620e[_0x39f1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x39f1('0xd')](function(_0x545649){logger[_0x39f1('0xe')](_0x39f1('0x1e'),_0x3e77a1);logger['debug']('ShowSugarcrmAccount',_0x3e77a1,JSON[_0x39f1('0x12')](_0x545649));_0x1a2774(_0x545649);})[_0x39f1('0x16')](function(_0x182c03){logger[_0x39f1('0x13')](_0x39f1('0x1e'),_0x182c03[_0x39f1('0x15')],_0x3e77a1);_0x26318c(_0x32161f[_0x39f1('0x13')](0x1f4,_0x182c03['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6a2384d..28abf2c 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 _0x5eb3=['Router','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1ef089,_0x4a9d70){var _0x495bf4=function(_0x279ad0){while(--_0x279ad0){_0x1ef089['push'](_0x1ef089['shift']());}};_0x495bf4(++_0x4a9d70);}(_0x5eb3,0x7f));var _0x35eb=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x5eb3[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x35eb('0x0'));var util=require(_0x35eb('0x1'));var path=require(_0x35eb('0x2'));var timeout=require(_0x35eb('0x3'));var express=require(_0x35eb('0x4'));var router=express[_0x35eb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x35eb('0x6'));var controller=require(_0x35eb('0x7'));router[_0x35eb('0x8')]('/',auth[_0x35eb('0x9')](),controller[_0x35eb('0xa')]);router[_0x35eb('0x8')](_0x35eb('0xb'),auth[_0x35eb('0x9')](),controller[_0x35eb('0xc')]);router[_0x35eb('0x8')](_0x35eb('0xd'),auth['isAuthenticated'](),controller[_0x35eb('0xe')]);router['get'](_0x35eb('0xf'),auth[_0x35eb('0x9')](),controller[_0x35eb('0x10')]);router[_0x35eb('0x8')]('/:id/descriptions',auth[_0x35eb('0x9')](),controller[_0x35eb('0x11')]);router['post']('/',auth[_0x35eb('0x9')](),controller[_0x35eb('0x12')]);router['put'](_0x35eb('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x35eb('0x13')](_0x35eb('0xb'),auth['isAuthenticated'](),controller[_0x35eb('0x14')]);module[_0x35eb('0x15')]=router; \ No newline at end of file +var _0x9986=['/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','path','connect-timeout','express','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','show'];(function(_0x28d3f4,_0x2a26f3){var _0x43596c=function(_0xf2bd88){while(--_0xf2bd88){_0x28d3f4['push'](_0x28d3f4['shift']());}};_0x43596c(++_0x2a26f3);}(_0x9986,0x1d8));var _0x6998=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x9986[_0x386525];return _0x14d015;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6998('0x0'));var timeout=require(_0x6998('0x1'));var express=require(_0x6998('0x2'));var router=express['Router']();var fs_extra=require(_0x6998('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6998('0x4'));var controller=require(_0x6998('0x5'));router[_0x6998('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6998('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6998('0x7')]);router[_0x6998('0x6')](_0x6998('0x8'),auth[_0x6998('0x9')](),controller[_0x6998('0xa')]);router[_0x6998('0x6')]('/:id/subjects',auth[_0x6998('0x9')](),controller[_0x6998('0xb')]);router[_0x6998('0x6')](_0x6998('0xc'),auth[_0x6998('0x9')](),controller[_0x6998('0xd')]);router[_0x6998('0xe')]('/',auth[_0x6998('0x9')](),controller[_0x6998('0xf')]);router[_0x6998('0x10')](_0x6998('0x11'),auth[_0x6998('0x9')](),controller['update']);router[_0x6998('0x12')](_0x6998('0x11'),auth[_0x6998('0x9')](),controller[_0x6998('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6d8e84c..2cf9d13 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 _0x8afd=['exports','STRING','sequelize'];(function(_0xacda32,_0x28c3c1){var _0x1e1232=function(_0x17c855){while(--_0x17c855){_0xacda32['push'](_0xacda32['shift']());}};_0x1e1232(++_0x28c3c1);}(_0x8afd,0x8c));var _0xd8af=function(_0x39b19f,_0x2174ae){_0x39b19f=_0x39b19f-0x0;var _0x430d95=_0x8afd[_0x39b19f];return _0x430d95;};'use strict';var Sequelize=require(_0xd8af('0x0'));module[_0xd8af('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8af('0x2')]}}; \ No newline at end of file +var _0x39e6=['STRING','sequelize'];(function(_0x314b31,_0xce0ec9){var _0x664888=function(_0x41469a){while(--_0x41469a){_0x314b31['push'](_0x314b31['shift']());}};_0x664888(++_0xce0ec9);}(_0x39e6,0x6f));var _0x639e=function(_0x2ccdf1,_0x2a081b){_0x2ccdf1=_0x2ccdf1-0x0;var _0x5923f7=_0x39e6[_0x2ccdf1];return _0x5923f7;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f210c4a..7bc4ffb 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 _0xf871=['VIRTUAL','filter','options','includeAll','findAll','rows','catch','keys','SugarcrmConfiguration','rawAttributes','length','include','find','body','findOne','params','SugarcrmField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x351783,_0x313b94){var _0x506e80=function(_0x257563){while(--_0x257563){_0x351783['push'](_0x351783['shift']());}};_0x506e80(++_0x313b94);}(_0xf871,0xb6));var _0x1f87=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xf871[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x1f87('0x0'));var rimraf=require(_0x1f87('0x1'));var zipdir=require(_0x1f87('0x2'));var jsonpatch=require(_0x1f87('0x3'));var rp=require('request-promise');var moment=require(_0x1f87('0x4'));var BPromise=require(_0x1f87('0x5'));var Mustache=require('mustache');var util=require(_0x1f87('0x6'));var path=require(_0x1f87('0x7'));var sox=require(_0x1f87('0x8'));var csv=require(_0x1f87('0x9'));var ejs=require(_0x1f87('0xa'));var fs=require('fs');var fs_extra=require(_0x1f87('0xb'));var _=require(_0x1f87('0xc'));var squel=require(_0x1f87('0xd'));var crypto=require(_0x1f87('0xe'));var jsforce=require(_0x1f87('0xf'));var deskjs=require(_0x1f87('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f87('0x11'));var Redis=require(_0x1f87('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f87('0x13'));var logger=require(_0x1f87('0x14'))(_0x1f87('0x15'));var utils=require('../../config/utils');var config=require(_0x1f87('0x16'));var licenseUtil=require(_0x1f87('0x17'));var db=require(_0x1f87('0x18'))['db'];function respondWithStatusCode(_0x532367,_0x3fd7bc){_0x3fd7bc=_0x3fd7bc||0xcc;return function(_0x499ceb){if(_0x499ceb){return _0x532367[_0x1f87('0x19')](_0x3fd7bc);}return _0x532367[_0x1f87('0x1a')](_0x3fd7bc)[_0x1f87('0x1b')]();};}function respondWithResult(_0x44fe74,_0x1c7e2){_0x1c7e2=_0x1c7e2||0xc8;return function(_0x43d7ea){if(_0x43d7ea){return _0x44fe74[_0x1f87('0x1a')](_0x1c7e2)[_0x1f87('0x1c')](_0x43d7ea);}};}function respondWithFilteredResult(_0x3b5a91,_0x48d3a8){return function(_0xbb8970){if(_0xbb8970){var _0x102d93=typeof _0x48d3a8['offset']===_0x1f87('0x1d')&&typeof _0x48d3a8[_0x1f87('0x1e')]==='undefined';var _0x460ad3=_0xbb8970[_0x1f87('0x1f')];var _0x5b1232=_0x102d93?0x0:_0x48d3a8[_0x1f87('0x20')];var _0x15326f=_0x102d93?_0xbb8970[_0x1f87('0x1f')]:_0x48d3a8[_0x1f87('0x20')]+_0x48d3a8[_0x1f87('0x1e')];var _0x14d580;if(_0x15326f>=_0x460ad3){_0x15326f=_0x460ad3;_0x14d580=0xc8;}else{_0x14d580=0xce;}_0x3b5a91[_0x1f87('0x1a')](_0x14d580);return _0x3b5a91[_0x1f87('0x21')](_0x1f87('0x22'),_0x5b1232+'-'+_0x15326f+'/'+_0x460ad3)[_0x1f87('0x1c')](_0xbb8970);}return null;};}function patchUpdates(_0x3e5128){return function(_0x5f1256){try{jsonpatch['apply'](_0x5f1256,_0x3e5128,!![]);}catch(_0x32ede6){return BPromise[_0x1f87('0x23')](_0x32ede6);}return _0x5f1256[_0x1f87('0x24')]();};}function saveUpdates(_0x324831,_0x5bd1c5){return function(_0x3cc7e0){if(_0x3cc7e0){return _0x3cc7e0[_0x1f87('0x25')](_0x324831)[_0x1f87('0x26')](function(_0xf28c2d){return _0xf28c2d;});}return null;};}function removeEntity(_0x486a1d,_0x5077aa){return function(_0x339c48){if(_0x339c48){return _0x339c48[_0x1f87('0x27')]()[_0x1f87('0x26')](function(){_0x486a1d[_0x1f87('0x1a')](0xcc)[_0x1f87('0x1b')]();});}};}function handleEntityNotFound(_0xb398fa,_0x1ee16f){return function(_0x21d085){if(!_0x21d085){_0xb398fa[_0x1f87('0x19')](0x194);}return _0x21d085;};}function handleError(_0x46eeb4,_0x1f8f7f){_0x1f8f7f=_0x1f8f7f||0x1f4;return function(_0x5e3a3f){logger[_0x1f87('0x28')](_0x5e3a3f[_0x1f87('0x29')]);if(_0x5e3a3f[_0x1f87('0x2a')]){delete _0x5e3a3f[_0x1f87('0x2a')];}_0x46eeb4[_0x1f87('0x1a')](_0x1f8f7f)[_0x1f87('0x2b')](_0x5e3a3f);};}exports[_0x1f87('0x2c')]=function(_0x367e91,_0x238261){var _0x1c9469={},_0x4516aa={},_0xb50bdf={'count':0x0,'rows':[]};var _0x40570f=_[_0x1f87('0x2d')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x13e1d5){return{'name':_0x13e1d5[_0x1f87('0x2e')],'type':_0x13e1d5[_0x1f87('0x2f')]['key']};});_0x4516aa[_0x1f87('0x30')]=_[_0x1f87('0x2d')](_0x40570f,_0x1f87('0x2a'));_0x4516aa[_0x1f87('0x31')]=_['keys'](_0x367e91[_0x1f87('0x31')]);_0x4516aa[_0x1f87('0x32')]=_[_0x1f87('0x33')](_0x4516aa[_0x1f87('0x30')],_0x4516aa[_0x1f87('0x31')]);_0x1c9469[_0x1f87('0x34')]=_[_0x1f87('0x33')](_0x4516aa['model'],qs[_0x1f87('0x35')](_0x367e91[_0x1f87('0x31')][_0x1f87('0x35')]));_0x1c9469[_0x1f87('0x34')]=_0x1c9469['attributes']['length']?_0x1c9469[_0x1f87('0x34')]:_0x4516aa[_0x1f87('0x30')];if(!_0x367e91[_0x1f87('0x31')][_0x1f87('0x36')](_0x1f87('0x37'))){_0x1c9469[_0x1f87('0x1e')]=qs['limit'](_0x367e91[_0x1f87('0x31')][_0x1f87('0x1e')]);_0x1c9469[_0x1f87('0x20')]=qs[_0x1f87('0x20')](_0x367e91[_0x1f87('0x31')][_0x1f87('0x20')]);}_0x1c9469[_0x1f87('0x38')]=qs[_0x1f87('0x39')](_0x367e91[_0x1f87('0x31')]['sort']);_0x1c9469[_0x1f87('0x3a')]=qs[_0x1f87('0x32')](_[_0x1f87('0x3b')](_0x367e91['query'],_0x4516aa['filters']),_0x40570f);if(_0x367e91[_0x1f87('0x31')]['filter']){_0x1c9469['where']=_[_0x1f87('0x3c')](_0x1c9469[_0x1f87('0x3a')],{'$or':_[_0x1f87('0x2d')](_0x40570f,function(_0x3309f3){if(_0x3309f3['type']!==_0x1f87('0x3d')){var _0xa4dcfb={};_0xa4dcfb[_0x3309f3[_0x1f87('0x2a')]]={'$like':'%'+_0x367e91[_0x1f87('0x31')][_0x1f87('0x3e')]+'%'};return _0xa4dcfb;}})});}_0x1c9469=_[_0x1f87('0x3c')]({},_0x1c9469,_0x367e91[_0x1f87('0x3f')]);var _0x3c5331={'where':_0x1c9469[_0x1f87('0x3a')]};return db['SugarcrmConfiguration'][_0x1f87('0x1f')](_0x3c5331)['then'](function(_0x3e1d51){_0xb50bdf['count']=_0x3e1d51;if(_0x367e91[_0x1f87('0x31')][_0x1f87('0x40')]){_0x1c9469['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1f87('0x41')](_0x1c9469);})['then'](function(_0x34002b){_0xb50bdf[_0x1f87('0x42')]=_0x34002b;return _0xb50bdf;})['then'](respondWithFilteredResult(_0x238261,_0x1c9469))[_0x1f87('0x43')](handleError(_0x238261,null));};exports['show']=function(_0x406b9f,_0x36bede){var _0x1072a5={'raw':![],'where':{'id':_0x406b9f['params']['id']}},_0x2d8185={};_0x2d8185[_0x1f87('0x30')]=_[_0x1f87('0x44')](db[_0x1f87('0x45')][_0x1f87('0x46')]);_0x2d8185[_0x1f87('0x31')]=_[_0x1f87('0x44')](_0x406b9f[_0x1f87('0x31')]);_0x2d8185['filters']=_[_0x1f87('0x33')](_0x2d8185[_0x1f87('0x30')],_0x2d8185[_0x1f87('0x31')]);_0x1072a5[_0x1f87('0x34')]=_[_0x1f87('0x33')](_0x2d8185['model'],qs[_0x1f87('0x35')](_0x406b9f['query'][_0x1f87('0x35')]));_0x1072a5[_0x1f87('0x34')]=_0x1072a5[_0x1f87('0x34')][_0x1f87('0x47')]?_0x1072a5[_0x1f87('0x34')]:_0x2d8185['model'];if(_0x406b9f[_0x1f87('0x31')]['includeAll']){_0x1072a5[_0x1f87('0x48')]=[{'all':!![]}];}_0x1072a5=_['merge']({},_0x1072a5,_0x406b9f[_0x1f87('0x3f')]);return db['SugarcrmConfiguration'][_0x1f87('0x49')](_0x1072a5)[_0x1f87('0x26')](handleEntityNotFound(_0x36bede,null))['then'](respondWithResult(_0x36bede,null))['catch'](handleError(_0x36bede,null));};exports['create']=function(_0x3295d5,_0x2b33f0){return db[_0x1f87('0x45')]['create'](_0x3295d5[_0x1f87('0x4a')],{})[_0x1f87('0x26')](respondWithResult(_0x2b33f0,0xc9))['catch'](handleError(_0x2b33f0,null));};exports[_0x1f87('0x25')]=function(_0x1c3018,_0xb27448){if(_0x1c3018[_0x1f87('0x4a')]['id']){delete _0x1c3018[_0x1f87('0x4a')]['id'];}return db[_0x1f87('0x45')][_0x1f87('0x49')]({'where':{'id':_0x1c3018['params']['id']}})[_0x1f87('0x26')](handleEntityNotFound(_0xb27448,null))['then'](saveUpdates(_0x1c3018['body'],null))[_0x1f87('0x26')](respondWithResult(_0xb27448,null))['catch'](handleError(_0xb27448,null));};exports[_0x1f87('0x27')]=function(_0x393bc1,_0x33f9d7){return db[_0x1f87('0x45')][_0x1f87('0x49')]({'where':{'id':_0x393bc1['params']['id']}})[_0x1f87('0x26')](handleEntityNotFound(_0x33f9d7,null))[_0x1f87('0x26')](removeEntity(_0x33f9d7,null))[_0x1f87('0x43')](handleError(_0x33f9d7,null));};exports['getFields']=function(_0xa45f4b,_0x36fcac,_0x4e1d1d){var _0xb89ef1={};var _0x560051={};var _0x15dc0c;var _0x52ca65;return db[_0x1f87('0x45')][_0x1f87('0x4b')]({'where':{'id':_0xa45f4b[_0x1f87('0x4c')]['id']}})[_0x1f87('0x26')](handleEntityNotFound(_0x36fcac,null))['then'](function(_0x596b60){if(_0x596b60){_0x15dc0c=_0x596b60;_0x560051[_0x1f87('0x30')]=_[_0x1f87('0x44')](db[_0x1f87('0x4d')][_0x1f87('0x46')]);_0x560051['query']=_[_0x1f87('0x44')](_0xa45f4b[_0x1f87('0x31')]);_0x560051['filters']=_[_0x1f87('0x33')](_0x560051[_0x1f87('0x30')],_0x560051[_0x1f87('0x31')]);_0xb89ef1[_0x1f87('0x34')]=_[_0x1f87('0x33')](_0x560051['model'],qs[_0x1f87('0x35')](_0xa45f4b[_0x1f87('0x31')][_0x1f87('0x35')]));_0xb89ef1['attributes']=_0xb89ef1[_0x1f87('0x34')][_0x1f87('0x47')]?_0xb89ef1[_0x1f87('0x34')]:_0x560051[_0x1f87('0x30')];_0xb89ef1[_0x1f87('0x38')]=qs[_0x1f87('0x39')](_0xa45f4b[_0x1f87('0x31')][_0x1f87('0x39')]);_0xb89ef1[_0x1f87('0x3a')]=qs[_0x1f87('0x32')](_['pick'](_0xa45f4b[_0x1f87('0x31')],_0x560051[_0x1f87('0x32')]));if(_0xa45f4b[_0x1f87('0x31')]['filter']){_0xb89ef1[_0x1f87('0x3a')]=_['merge'](_0xb89ef1['where'],{'$or':_[_0x1f87('0x2d')](_0xb89ef1[_0x1f87('0x34')],function(_0x5c7186){var _0x18fdac={};_0x18fdac[_0x5c7186]={'$like':'%'+_0xa45f4b[_0x1f87('0x31')][_0x1f87('0x3e')]+'%'};return _0x18fdac;})});}_0xb89ef1=_['merge']({},_0xb89ef1,_0xa45f4b[_0x1f87('0x3f')]);return _0x15dc0c['getFields'](_0xb89ef1);}})['then'](function(_0x1e5752){if(_0x1e5752){_0x52ca65=_0x1e5752[_0x1f87('0x47')];if(!_0xa45f4b[_0x1f87('0x31')][_0x1f87('0x36')](_0x1f87('0x37'))){_0xb89ef1[_0x1f87('0x1e')]=qs[_0x1f87('0x1e')](_0xa45f4b[_0x1f87('0x31')][_0x1f87('0x1e')]);_0xb89ef1[_0x1f87('0x20')]=qs[_0x1f87('0x20')](_0xa45f4b[_0x1f87('0x31')]['offset']);}return _0x15dc0c[_0x1f87('0x4e')](_0xb89ef1);}})[_0x1f87('0x26')](function(_0x1b52b3){if(_0x1b52b3){return _0x1b52b3?{'count':_0x52ca65,'rows':_0x1b52b3}:null;}})[_0x1f87('0x26')](respondWithResult(_0x36fcac,null))[_0x1f87('0x43')](handleError(_0x36fcac,null));};exports[_0x1f87('0x4f')]=function(_0x441eec,_0x1352dd,_0x59b87b){var _0x5c2c4b={};var _0x4030c5={};var _0x225a0a;var _0xebc3b8;return db[_0x1f87('0x45')][_0x1f87('0x4b')]({'where':{'id':_0x441eec['params']['id']}})[_0x1f87('0x26')](handleEntityNotFound(_0x1352dd,null))['then'](function(_0x16fd0e){if(_0x16fd0e){_0x225a0a=_0x16fd0e;_0x4030c5['model']=_[_0x1f87('0x44')](db[_0x1f87('0x4d')][_0x1f87('0x46')]);_0x4030c5[_0x1f87('0x31')]=_['keys'](_0x441eec[_0x1f87('0x31')]);_0x4030c5[_0x1f87('0x32')]=_[_0x1f87('0x33')](_0x4030c5[_0x1f87('0x30')],_0x4030c5[_0x1f87('0x31')]);_0x5c2c4b['attributes']=_[_0x1f87('0x33')](_0x4030c5[_0x1f87('0x30')],qs[_0x1f87('0x35')](_0x441eec[_0x1f87('0x31')]['fields']));_0x5c2c4b[_0x1f87('0x34')]=_0x5c2c4b[_0x1f87('0x34')]['length']?_0x5c2c4b[_0x1f87('0x34')]:_0x4030c5[_0x1f87('0x30')];_0x5c2c4b[_0x1f87('0x38')]=qs[_0x1f87('0x39')](_0x441eec[_0x1f87('0x31')]['sort']);_0x5c2c4b[_0x1f87('0x3a')]=qs[_0x1f87('0x32')](_[_0x1f87('0x3b')](_0x441eec[_0x1f87('0x31')],_0x4030c5[_0x1f87('0x32')]));if(_0x441eec['query'][_0x1f87('0x3e')]){_0x5c2c4b[_0x1f87('0x3a')]=_[_0x1f87('0x3c')](_0x5c2c4b[_0x1f87('0x3a')],{'$or':_['map'](_0x5c2c4b['attributes'],function(_0x539cd5){var _0x48a54b={};_0x48a54b[_0x539cd5]={'$like':'%'+_0x441eec[_0x1f87('0x31')][_0x1f87('0x3e')]+'%'};return _0x48a54b;})});}_0x5c2c4b=_[_0x1f87('0x3c')]({},_0x5c2c4b,_0x441eec[_0x1f87('0x3f')]);return _0x225a0a['getSubjects'](_0x5c2c4b);}})[_0x1f87('0x26')](function(_0x48fd3e){if(_0x48fd3e){_0xebc3b8=_0x48fd3e['length'];if(!_0x441eec[_0x1f87('0x31')][_0x1f87('0x36')](_0x1f87('0x37'))){_0x5c2c4b[_0x1f87('0x1e')]=qs[_0x1f87('0x1e')](_0x441eec[_0x1f87('0x31')][_0x1f87('0x1e')]);_0x5c2c4b[_0x1f87('0x20')]=qs[_0x1f87('0x20')](_0x441eec[_0x1f87('0x31')][_0x1f87('0x20')]);}return _0x225a0a[_0x1f87('0x4f')](_0x5c2c4b);}})[_0x1f87('0x26')](function(_0x63d671){if(_0x63d671){return _0x63d671?{'count':_0xebc3b8,'rows':_0x63d671}:null;}})[_0x1f87('0x26')](respondWithResult(_0x1352dd,null))[_0x1f87('0x43')](handleError(_0x1352dd,null));};exports[_0x1f87('0x50')]=function(_0x2d9553,_0x8169f0,_0x3d8ba3){var _0x49be5f={};var _0x5abf05={};var _0x222702;var _0x6eefe6;return db[_0x1f87('0x45')][_0x1f87('0x4b')]({'where':{'id':_0x2d9553['params']['id']}})[_0x1f87('0x26')](handleEntityNotFound(_0x8169f0,null))[_0x1f87('0x26')](function(_0x5e2d1e){if(_0x5e2d1e){_0x222702=_0x5e2d1e;_0x5abf05['model']=_[_0x1f87('0x44')](db['SugarcrmField']['rawAttributes']);_0x5abf05['query']=_[_0x1f87('0x44')](_0x2d9553[_0x1f87('0x31')]);_0x5abf05[_0x1f87('0x32')]=_[_0x1f87('0x33')](_0x5abf05[_0x1f87('0x30')],_0x5abf05[_0x1f87('0x31')]);_0x49be5f['attributes']=_[_0x1f87('0x33')](_0x5abf05[_0x1f87('0x30')],qs[_0x1f87('0x35')](_0x2d9553[_0x1f87('0x31')][_0x1f87('0x35')]));_0x49be5f[_0x1f87('0x34')]=_0x49be5f[_0x1f87('0x34')]['length']?_0x49be5f[_0x1f87('0x34')]:_0x5abf05[_0x1f87('0x30')];_0x49be5f['order']=qs[_0x1f87('0x39')](_0x2d9553['query'][_0x1f87('0x39')]);_0x49be5f[_0x1f87('0x3a')]=qs[_0x1f87('0x32')](_['pick'](_0x2d9553[_0x1f87('0x31')],_0x5abf05['filters']));if(_0x2d9553[_0x1f87('0x31')][_0x1f87('0x3e')]){_0x49be5f[_0x1f87('0x3a')]=_['merge'](_0x49be5f[_0x1f87('0x3a')],{'$or':_[_0x1f87('0x2d')](_0x49be5f[_0x1f87('0x34')],function(_0x344dd1){var _0x411f8a={};_0x411f8a[_0x344dd1]={'$like':'%'+_0x2d9553[_0x1f87('0x31')]['filter']+'%'};return _0x411f8a;})});}_0x49be5f=_[_0x1f87('0x3c')]({},_0x49be5f,_0x2d9553[_0x1f87('0x3f')]);return _0x222702[_0x1f87('0x50')](_0x49be5f);}})[_0x1f87('0x26')](function(_0x7a98ff){if(_0x7a98ff){_0x6eefe6=_0x7a98ff[_0x1f87('0x47')];if(!_0x2d9553[_0x1f87('0x31')][_0x1f87('0x36')](_0x1f87('0x37'))){_0x49be5f[_0x1f87('0x1e')]=qs[_0x1f87('0x1e')](_0x2d9553[_0x1f87('0x31')][_0x1f87('0x1e')]);_0x49be5f['offset']=qs[_0x1f87('0x20')](_0x2d9553['query'][_0x1f87('0x20')]);}return _0x222702[_0x1f87('0x50')](_0x49be5f);}})[_0x1f87('0x26')](function(_0x1f0747){if(_0x1f0747){return _0x1f0747?{'count':_0x6eefe6,'rows':_0x1f0747}:null;}})[_0x1f87('0x26')](respondWithResult(_0x8169f0,null))['catch'](handleError(_0x8169f0,null));}; \ No newline at end of file +var _0x1ea2=['util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','create','body','params','SugarcrmField','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5b053d,_0x418493){var _0x316b85=function(_0x58ce5d){while(--_0x58ce5d){_0x5b053d['push'](_0x5b053d['shift']());}};_0x316b85(++_0x418493);}(_0x1ea2,0x9b));var _0x21ea=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x1ea2[_0x2e04ef];return _0x5722b0;};'use strict';var emlformat=require(_0x21ea('0x0'));var rimraf=require(_0x21ea('0x1'));var zipdir=require(_0x21ea('0x2'));var jsonpatch=require(_0x21ea('0x3'));var rp=require('request-promise');var moment=require(_0x21ea('0x4'));var BPromise=require(_0x21ea('0x5'));var Mustache=require(_0x21ea('0x6'));var util=require(_0x21ea('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x21ea('0x8'));var ejs=require(_0x21ea('0x9'));var fs=require('fs');var fs_extra=require(_0x21ea('0xa'));var _=require(_0x21ea('0xb'));var squel=require('squel');var crypto=require(_0x21ea('0xc'));var jsforce=require(_0x21ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x21ea('0x8'));var querystring=require(_0x21ea('0xe'));var Papa=require(_0x21ea('0xf'));var Redis=require('ioredis');var authService=require(_0x21ea('0x10'));var qs=require(_0x21ea('0x11'));var as=require(_0x21ea('0x12'));var hardwareService=require(_0x21ea('0x13'));var logger=require(_0x21ea('0x14'))(_0x21ea('0x15'));var utils=require(_0x21ea('0x16'));var config=require(_0x21ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x21ea('0x18'))['db'];function respondWithStatusCode(_0x45723b,_0x5baad5){_0x5baad5=_0x5baad5||0xcc;return function(_0x787b3a){if(_0x787b3a){return _0x45723b[_0x21ea('0x19')](_0x5baad5);}return _0x45723b['status'](_0x5baad5)[_0x21ea('0x1a')]();};}function respondWithResult(_0x8521d1,_0xe0945b){_0xe0945b=_0xe0945b||0xc8;return function(_0xa01405){if(_0xa01405){return _0x8521d1[_0x21ea('0x1b')](_0xe0945b)[_0x21ea('0x1c')](_0xa01405);}};}function respondWithFilteredResult(_0x2d5e55,_0x2693c4){return function(_0x5125d5){if(_0x5125d5){var _0x3ee2d4=typeof _0x2693c4['offset']==='undefined'&&typeof _0x2693c4[_0x21ea('0x1d')]===_0x21ea('0x1e');var _0x1fe11a=_0x5125d5[_0x21ea('0x1f')];var _0x4988b6=_0x3ee2d4?0x0:_0x2693c4[_0x21ea('0x20')];var _0xd605d6=_0x3ee2d4?_0x5125d5['count']:_0x2693c4['offset']+_0x2693c4['limit'];var _0x5890ad;if(_0xd605d6>=_0x1fe11a){_0xd605d6=_0x1fe11a;_0x5890ad=0xc8;}else{_0x5890ad=0xce;}_0x2d5e55['status'](_0x5890ad);return _0x2d5e55['set'](_0x21ea('0x21'),_0x4988b6+'-'+_0xd605d6+'/'+_0x1fe11a)[_0x21ea('0x1c')](_0x5125d5);}return null;};}function patchUpdates(_0x495dc0){return function(_0x417c5f){try{jsonpatch[_0x21ea('0x22')](_0x417c5f,_0x495dc0,!![]);}catch(_0x62a963){return BPromise[_0x21ea('0x23')](_0x62a963);}return _0x417c5f['save']();};}function saveUpdates(_0x4acecb,_0x33fd25){return function(_0xed1456){if(_0xed1456){return _0xed1456[_0x21ea('0x24')](_0x4acecb)[_0x21ea('0x25')](function(_0x230c4c){return _0x230c4c;});}return null;};}function removeEntity(_0x40a34d,_0x23dbba){return function(_0x351b18){if(_0x351b18){return _0x351b18[_0x21ea('0x26')]()[_0x21ea('0x25')](function(){_0x40a34d[_0x21ea('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270937,_0xb8d5b5){return function(_0x3afa5e){if(!_0x3afa5e){_0x270937[_0x21ea('0x19')](0x194);}return _0x3afa5e;};}function handleError(_0xe1ea3a,_0x3153e6){_0x3153e6=_0x3153e6||0x1f4;return function(_0x2d9be7){logger[_0x21ea('0x27')](_0x2d9be7[_0x21ea('0x28')]);if(_0x2d9be7[_0x21ea('0x29')]){delete _0x2d9be7['name'];}_0xe1ea3a[_0x21ea('0x1b')](_0x3153e6)[_0x21ea('0x2a')](_0x2d9be7);};}exports[_0x21ea('0x2b')]=function(_0x229e74,_0x1af880){var _0x52a9ed={},_0x23e628={},_0x49e0f0={'count':0x0,'rows':[]};var _0x3d18f9=_[_0x21ea('0x2c')](db[_0x21ea('0x2d')][_0x21ea('0x2e')],function(_0x4a46f6){return{'name':_0x4a46f6[_0x21ea('0x2f')],'type':_0x4a46f6[_0x21ea('0x30')][_0x21ea('0x31')]};});_0x23e628[_0x21ea('0x32')]=_[_0x21ea('0x2c')](_0x3d18f9,'name');_0x23e628[_0x21ea('0x33')]=_[_0x21ea('0x34')](_0x229e74[_0x21ea('0x33')]);_0x23e628[_0x21ea('0x35')]=_['intersection'](_0x23e628[_0x21ea('0x32')],_0x23e628[_0x21ea('0x33')]);_0x52a9ed[_0x21ea('0x36')]=_['intersection'](_0x23e628[_0x21ea('0x32')],qs['fields'](_0x229e74[_0x21ea('0x33')][_0x21ea('0x37')]));_0x52a9ed['attributes']=_0x52a9ed[_0x21ea('0x36')][_0x21ea('0x38')]?_0x52a9ed[_0x21ea('0x36')]:_0x23e628[_0x21ea('0x32')];if(!_0x229e74['query']['hasOwnProperty'](_0x21ea('0x39'))){_0x52a9ed[_0x21ea('0x1d')]=qs[_0x21ea('0x1d')](_0x229e74[_0x21ea('0x33')][_0x21ea('0x1d')]);_0x52a9ed[_0x21ea('0x20')]=qs[_0x21ea('0x20')](_0x229e74[_0x21ea('0x33')]['offset']);}_0x52a9ed[_0x21ea('0x3a')]=qs[_0x21ea('0x3b')](_0x229e74['query']['sort']);_0x52a9ed['where']=qs[_0x21ea('0x35')](_[_0x21ea('0x3c')](_0x229e74[_0x21ea('0x33')],_0x23e628[_0x21ea('0x35')]),_0x3d18f9);if(_0x229e74[_0x21ea('0x33')][_0x21ea('0x3d')]){_0x52a9ed['where']=_[_0x21ea('0x3e')](_0x52a9ed[_0x21ea('0x3f')],{'$or':_['map'](_0x3d18f9,function(_0x4ca207){if(_0x4ca207[_0x21ea('0x30')]!==_0x21ea('0x40')){var _0x594a6c={};_0x594a6c[_0x4ca207[_0x21ea('0x29')]]={'$like':'%'+_0x229e74[_0x21ea('0x33')][_0x21ea('0x3d')]+'%'};return _0x594a6c;}})});}_0x52a9ed=_['merge']({},_0x52a9ed,_0x229e74[_0x21ea('0x41')]);var _0xf30233={'where':_0x52a9ed[_0x21ea('0x3f')]};return db[_0x21ea('0x2d')][_0x21ea('0x1f')](_0xf30233)[_0x21ea('0x25')](function(_0x1fc177){_0x49e0f0[_0x21ea('0x1f')]=_0x1fc177;if(_0x229e74['query'][_0x21ea('0x42')]){_0x52a9ed[_0x21ea('0x43')]=[{'all':!![]}];}return db[_0x21ea('0x2d')]['findAll'](_0x52a9ed);})['then'](function(_0x17c614){_0x49e0f0[_0x21ea('0x44')]=_0x17c614;return _0x49e0f0;})[_0x21ea('0x25')](respondWithFilteredResult(_0x1af880,_0x52a9ed))[_0x21ea('0x45')](handleError(_0x1af880,null));};exports[_0x21ea('0x46')]=function(_0x5b1414,_0x312946){var _0x32bff7={'raw':![],'where':{'id':_0x5b1414['params']['id']}},_0x1bc89a={};_0x1bc89a[_0x21ea('0x32')]=_[_0x21ea('0x34')](db[_0x21ea('0x2d')][_0x21ea('0x2e')]);_0x1bc89a[_0x21ea('0x33')]=_[_0x21ea('0x34')](_0x5b1414[_0x21ea('0x33')]);_0x1bc89a[_0x21ea('0x35')]=_[_0x21ea('0x47')](_0x1bc89a[_0x21ea('0x32')],_0x1bc89a[_0x21ea('0x33')]);_0x32bff7['attributes']=_[_0x21ea('0x47')](_0x1bc89a['model'],qs[_0x21ea('0x37')](_0x5b1414[_0x21ea('0x33')][_0x21ea('0x37')]));_0x32bff7['attributes']=_0x32bff7['attributes'][_0x21ea('0x38')]?_0x32bff7[_0x21ea('0x36')]:_0x1bc89a[_0x21ea('0x32')];if(_0x5b1414['query'][_0x21ea('0x42')]){_0x32bff7[_0x21ea('0x43')]=[{'all':!![]}];}_0x32bff7=_['merge']({},_0x32bff7,_0x5b1414['options']);return db[_0x21ea('0x2d')][_0x21ea('0x48')](_0x32bff7)['then'](handleEntityNotFound(_0x312946,null))[_0x21ea('0x25')](respondWithResult(_0x312946,null))[_0x21ea('0x45')](handleError(_0x312946,null));};exports['create']=function(_0x4766ba,_0x2a5969){return db['SugarcrmConfiguration'][_0x21ea('0x49')](_0x4766ba[_0x21ea('0x4a')],{})[_0x21ea('0x25')](respondWithResult(_0x2a5969,0xc9))[_0x21ea('0x45')](handleError(_0x2a5969,null));};exports[_0x21ea('0x24')]=function(_0x511277,_0xead398){if(_0x511277[_0x21ea('0x4a')]['id']){delete _0x511277[_0x21ea('0x4a')]['id'];}return db[_0x21ea('0x2d')][_0x21ea('0x48')]({'where':{'id':_0x511277[_0x21ea('0x4b')]['id']}})[_0x21ea('0x25')](handleEntityNotFound(_0xead398,null))[_0x21ea('0x25')](saveUpdates(_0x511277[_0x21ea('0x4a')],null))[_0x21ea('0x25')](respondWithResult(_0xead398,null))[_0x21ea('0x45')](handleError(_0xead398,null));};exports[_0x21ea('0x26')]=function(_0x2a5328,_0x1af297){return db[_0x21ea('0x2d')][_0x21ea('0x48')]({'where':{'id':_0x2a5328['params']['id']}})[_0x21ea('0x25')](handleEntityNotFound(_0x1af297,null))['then'](removeEntity(_0x1af297,null))[_0x21ea('0x45')](handleError(_0x1af297,null));};exports['getFields']=function(_0x5cb768,_0x7c9e94,_0x64eb13){var _0x52ae84={};var _0x541184={};var _0x49f430;var _0x38caf3;return db[_0x21ea('0x2d')]['findOne']({'where':{'id':_0x5cb768['params']['id']}})[_0x21ea('0x25')](handleEntityNotFound(_0x7c9e94,null))[_0x21ea('0x25')](function(_0x31680f){if(_0x31680f){_0x49f430=_0x31680f;_0x541184[_0x21ea('0x32')]=_[_0x21ea('0x34')](db[_0x21ea('0x4c')][_0x21ea('0x2e')]);_0x541184['query']=_[_0x21ea('0x34')](_0x5cb768[_0x21ea('0x33')]);_0x541184[_0x21ea('0x35')]=_[_0x21ea('0x47')](_0x541184['model'],_0x541184[_0x21ea('0x33')]);_0x52ae84[_0x21ea('0x36')]=_['intersection'](_0x541184[_0x21ea('0x32')],qs[_0x21ea('0x37')](_0x5cb768[_0x21ea('0x33')]['fields']));_0x52ae84['attributes']=_0x52ae84[_0x21ea('0x36')][_0x21ea('0x38')]?_0x52ae84[_0x21ea('0x36')]:_0x541184[_0x21ea('0x32')];_0x52ae84['order']=qs[_0x21ea('0x3b')](_0x5cb768[_0x21ea('0x33')]['sort']);_0x52ae84[_0x21ea('0x3f')]=qs[_0x21ea('0x35')](_[_0x21ea('0x3c')](_0x5cb768[_0x21ea('0x33')],_0x541184[_0x21ea('0x35')]));if(_0x5cb768[_0x21ea('0x33')][_0x21ea('0x3d')]){_0x52ae84[_0x21ea('0x3f')]=_['merge'](_0x52ae84[_0x21ea('0x3f')],{'$or':_[_0x21ea('0x2c')](_0x52ae84[_0x21ea('0x36')],function(_0x4fd588){var _0x1bc096={};_0x1bc096[_0x4fd588]={'$like':'%'+_0x5cb768[_0x21ea('0x33')]['filter']+'%'};return _0x1bc096;})});}_0x52ae84=_['merge']({},_0x52ae84,_0x5cb768['options']);return _0x49f430[_0x21ea('0x4d')](_0x52ae84);}})[_0x21ea('0x25')](function(_0x394ca3){if(_0x394ca3){_0x38caf3=_0x394ca3[_0x21ea('0x38')];if(!_0x5cb768[_0x21ea('0x33')]['hasOwnProperty']('nolimit')){_0x52ae84['limit']=qs[_0x21ea('0x1d')](_0x5cb768[_0x21ea('0x33')][_0x21ea('0x1d')]);_0x52ae84['offset']=qs[_0x21ea('0x20')](_0x5cb768[_0x21ea('0x33')][_0x21ea('0x20')]);}return _0x49f430['getFields'](_0x52ae84);}})['then'](function(_0x2562c3){if(_0x2562c3){return _0x2562c3?{'count':_0x38caf3,'rows':_0x2562c3}:null;}})[_0x21ea('0x25')](respondWithResult(_0x7c9e94,null))[_0x21ea('0x45')](handleError(_0x7c9e94,null));};exports['getSubjects']=function(_0x491ba7,_0x26181b,_0x1c8b84){var _0x5be302={};var _0x561208={};var _0x4e6c08;var _0x2f2731;return db[_0x21ea('0x2d')]['findOne']({'where':{'id':_0x491ba7[_0x21ea('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26181b,null))[_0x21ea('0x25')](function(_0x47ce27){if(_0x47ce27){_0x4e6c08=_0x47ce27;_0x561208[_0x21ea('0x32')]=_[_0x21ea('0x34')](db[_0x21ea('0x4c')][_0x21ea('0x2e')]);_0x561208['query']=_[_0x21ea('0x34')](_0x491ba7[_0x21ea('0x33')]);_0x561208['filters']=_['intersection'](_0x561208['model'],_0x561208[_0x21ea('0x33')]);_0x5be302[_0x21ea('0x36')]=_[_0x21ea('0x47')](_0x561208[_0x21ea('0x32')],qs[_0x21ea('0x37')](_0x491ba7[_0x21ea('0x33')][_0x21ea('0x37')]));_0x5be302[_0x21ea('0x36')]=_0x5be302[_0x21ea('0x36')][_0x21ea('0x38')]?_0x5be302[_0x21ea('0x36')]:_0x561208['model'];_0x5be302[_0x21ea('0x3a')]=qs['sort'](_0x491ba7[_0x21ea('0x33')][_0x21ea('0x3b')]);_0x5be302['where']=qs[_0x21ea('0x35')](_[_0x21ea('0x3c')](_0x491ba7['query'],_0x561208['filters']));if(_0x491ba7[_0x21ea('0x33')][_0x21ea('0x3d')]){_0x5be302[_0x21ea('0x3f')]=_[_0x21ea('0x3e')](_0x5be302[_0x21ea('0x3f')],{'$or':_[_0x21ea('0x2c')](_0x5be302[_0x21ea('0x36')],function(_0x4368bb){var _0x3f698e={};_0x3f698e[_0x4368bb]={'$like':'%'+_0x491ba7[_0x21ea('0x33')]['filter']+'%'};return _0x3f698e;})});}_0x5be302=_['merge']({},_0x5be302,_0x491ba7[_0x21ea('0x41')]);return _0x4e6c08[_0x21ea('0x4e')](_0x5be302);}})['then'](function(_0x190e67){if(_0x190e67){_0x2f2731=_0x190e67['length'];if(!_0x491ba7[_0x21ea('0x33')]['hasOwnProperty'](_0x21ea('0x39'))){_0x5be302['limit']=qs[_0x21ea('0x1d')](_0x491ba7['query'][_0x21ea('0x1d')]);_0x5be302['offset']=qs[_0x21ea('0x20')](_0x491ba7[_0x21ea('0x33')][_0x21ea('0x20')]);}return _0x4e6c08[_0x21ea('0x4e')](_0x5be302);}})[_0x21ea('0x25')](function(_0x3319de){if(_0x3319de){return _0x3319de?{'count':_0x2f2731,'rows':_0x3319de}:null;}})[_0x21ea('0x25')](respondWithResult(_0x26181b,null))[_0x21ea('0x45')](handleError(_0x26181b,null));};exports[_0x21ea('0x4f')]=function(_0x40a783,_0x5dcc40,_0x58b1a2){var _0x32291e={};var _0x37d3e3={};var _0x372307;var _0x3866b3;return db['SugarcrmConfiguration'][_0x21ea('0x50')]({'where':{'id':_0x40a783[_0x21ea('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5dcc40,null))[_0x21ea('0x25')](function(_0x36c70b){if(_0x36c70b){_0x372307=_0x36c70b;_0x37d3e3[_0x21ea('0x32')]=_[_0x21ea('0x34')](db[_0x21ea('0x4c')][_0x21ea('0x2e')]);_0x37d3e3['query']=_[_0x21ea('0x34')](_0x40a783[_0x21ea('0x33')]);_0x37d3e3[_0x21ea('0x35')]=_['intersection'](_0x37d3e3[_0x21ea('0x32')],_0x37d3e3[_0x21ea('0x33')]);_0x32291e[_0x21ea('0x36')]=_[_0x21ea('0x47')](_0x37d3e3['model'],qs[_0x21ea('0x37')](_0x40a783[_0x21ea('0x33')][_0x21ea('0x37')]));_0x32291e['attributes']=_0x32291e[_0x21ea('0x36')]['length']?_0x32291e[_0x21ea('0x36')]:_0x37d3e3['model'];_0x32291e[_0x21ea('0x3a')]=qs[_0x21ea('0x3b')](_0x40a783[_0x21ea('0x33')][_0x21ea('0x3b')]);_0x32291e[_0x21ea('0x3f')]=qs[_0x21ea('0x35')](_[_0x21ea('0x3c')](_0x40a783[_0x21ea('0x33')],_0x37d3e3[_0x21ea('0x35')]));if(_0x40a783[_0x21ea('0x33')]['filter']){_0x32291e[_0x21ea('0x3f')]=_[_0x21ea('0x3e')](_0x32291e[_0x21ea('0x3f')],{'$or':_['map'](_0x32291e[_0x21ea('0x36')],function(_0xb926cf){var _0x2d59a5={};_0x2d59a5[_0xb926cf]={'$like':'%'+_0x40a783[_0x21ea('0x33')][_0x21ea('0x3d')]+'%'};return _0x2d59a5;})});}_0x32291e=_[_0x21ea('0x3e')]({},_0x32291e,_0x40a783[_0x21ea('0x41')]);return _0x372307[_0x21ea('0x4f')](_0x32291e);}})[_0x21ea('0x25')](function(_0xd710f0){if(_0xd710f0){_0x3866b3=_0xd710f0[_0x21ea('0x38')];if(!_0x40a783[_0x21ea('0x33')]['hasOwnProperty'](_0x21ea('0x39'))){_0x32291e[_0x21ea('0x1d')]=qs['limit'](_0x40a783['query']['limit']);_0x32291e[_0x21ea('0x20')]=qs[_0x21ea('0x20')](_0x40a783[_0x21ea('0x33')][_0x21ea('0x20')]);}return _0x372307[_0x21ea('0x4f')](_0x32291e);}})[_0x21ea('0x25')](function(_0x7e699a){if(_0x7e699a){return _0x7e699a?{'count':_0x3866b3,'rows':_0x7e699a}:null;}})[_0x21ea('0x25')](respondWithResult(_0x5dcc40,null))[_0x21ea('0x45')](handleError(_0x5dcc40,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a9f0805..ce83f23 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 _0x1288=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1288,0x1b1));var _0x8128=function(_0x2c50cd,_0x442a0e){_0x2c50cd=_0x2c50cd-0x0;var _0x4936dc=_0x1288[_0x2c50cd];return _0x4936dc;};'use strict';var _=require(_0x8128('0x0'));var util=require(_0x8128('0x1'));var logger=require(_0x8128('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8128('0x3'));var rp=require(_0x8128('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8128('0x5'));var attributes=require(_0x8128('0x6'));module[_0x8128('0x7')]=function(_0x245ab1,_0xcbca7f){return _0x245ab1[_0x8128('0x8')](_0x8128('0x9'),attributes,{'tableName':_0x8128('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47e8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x5056ce,_0x13c897){var _0x27ffcd=function(_0x37bb5d){while(--_0x37bb5d){_0x5056ce['push'](_0x5056ce['shift']());}};_0x27ffcd(++_0x13c897);}(_0x47e8,0x132));var _0x847e=function(_0x3a2798,_0x2e2ec6){_0x3a2798=_0x3a2798-0x0;var _0x2c5a84=_0x47e8[_0x3a2798];return _0x2c5a84;};'use strict';var _=require(_0x847e('0x0'));var util=require(_0x847e('0x1'));var logger=require(_0x847e('0x2'))(_0x847e('0x3'));var moment=require(_0x847e('0x4'));var BPromise=require(_0x847e('0x5'));var rp=require(_0x847e('0x6'));var fs=require('fs');var path=require(_0x847e('0x7'));var rimraf=require(_0x847e('0x8'));var config=require(_0x847e('0x9'));var attributes=require(_0x847e('0xa'));module[_0x847e('0xb')]=function(_0x3d40f4,_0x476ade){return _0x3d40f4['define'](_0x847e('0xc'),attributes,{'tableName':_0x847e('0xd'),'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 4918de8..6367781 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 _0x9530=['SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x4ff0a6,_0x51b545){var _0x119fcc=function(_0x38a255){while(--_0x38a255){_0x4ff0a6['push'](_0x4ff0a6['shift']());}};_0x119fcc(++_0x51b545);}(_0x9530,0x1d6));var _0x0953=function(_0x1a343b,_0x33ed9d){_0x1a343b=_0x1a343b-0x0;var _0x503489=_0x9530[_0x1a343b];return _0x503489;};'use strict';var _=require(_0x0953('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0953('0x1'));var rs=require(_0x0953('0x2'));var fs=require('fs');var Redis=require(_0x0953('0x3'));var db=require(_0x0953('0x4'))['db'];var utils=require(_0x0953('0x5'));var logger=require(_0x0953('0x6'))(_0x0953('0x7'));var config=require(_0x0953('0x8'));var jayson=require(_0x0953('0x9'));var client=jayson['client'][_0x0953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c97e0,_0x42b8ca,_0x4fe723){return new BPromise(function(_0x3d5c7a,_0x1dc576){return client['request'](_0x3c97e0,_0x4fe723)[_0x0953('0xb')](function(_0x2cd509){logger[_0x0953('0xc')](_0x0953('0xd'),_0x42b8ca,'request\x20sent');logger[_0x0953('0xe')](_0x0953('0xf'),_0x42b8ca,_0x0953('0x10'),JSON[_0x0953('0x11')](_0x2cd509));if(_0x2cd509['error']){if(_0x2cd509[_0x0953('0x12')][_0x0953('0x13')]===0x1f4){logger[_0x0953('0x12')](_0x0953('0xd'),_0x42b8ca,_0x2cd509[_0x0953('0x12')]['message']);return _0x1dc576(_0x2cd509[_0x0953('0x12')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x42b8ca,_0x2cd509[_0x0953('0x12')][_0x0953('0x14')]);return _0x3d5c7a(_0x2cd509[_0x0953('0x12')]['message']);}else{logger[_0x0953('0xc')](_0x0953('0xd'),_0x42b8ca,'request\x20sent');_0x3d5c7a(_0x2cd509[_0x0953('0x15')]['message']);}})[_0x0953('0x16')](function(_0x47396d){logger[_0x0953('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42b8ca,_0x47396d);_0x1dc576(_0x47396d);});});} \ No newline at end of file +var _0x15c4=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info'];(function(_0x4fa7f4,_0x427953){var _0x10b1eb=function(_0x53d4db){while(--_0x53d4db){_0x4fa7f4['push'](_0x4fa7f4['shift']());}};_0x10b1eb(++_0x427953);}(_0x15c4,0x68));var _0x415c=function(_0x40a278,_0x249cca){_0x40a278=_0x40a278-0x0;var _0x3a6540=_0x15c4[_0x40a278];return _0x3a6540;};'use strict';var _=require('lodash');var util=require(_0x415c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x415c('0x1'));var fs=require('fs');var Redis=require(_0x415c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x415c('0x3'));var logger=require(_0x415c('0x4'))(_0x415c('0x5'));var config=require(_0x415c('0x6'));var jayson=require(_0x415c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59c552,_0x4ad4f5,_0x3a9912){return new BPromise(function(_0x494bb5,_0x17ff54){return client[_0x415c('0x8')](_0x59c552,_0x3a9912)['then'](function(_0x38c495){logger[_0x415c('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4ad4f5,_0x415c('0xa'));logger[_0x415c('0xb')](_0x415c('0xc'),_0x4ad4f5,_0x415c('0xa'),JSON[_0x415c('0xd')](_0x38c495));if(_0x38c495[_0x415c('0xe')]){if(_0x38c495[_0x415c('0xe')][_0x415c('0xf')]===0x1f4){logger['error'](_0x415c('0x10'),_0x4ad4f5,_0x38c495[_0x415c('0xe')][_0x415c('0x11')]);return _0x17ff54(_0x38c495[_0x415c('0xe')][_0x415c('0x11')]);}logger[_0x415c('0xe')](_0x415c('0x10'),_0x4ad4f5,_0x38c495[_0x415c('0xe')]['message']);return _0x494bb5(_0x38c495[_0x415c('0xe')]['message']);}else{logger[_0x415c('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4ad4f5,_0x415c('0xa'));_0x494bb5(_0x38c495['result'][_0x415c('0x11')]);}})[_0x415c('0x12')](function(_0x5474ed){logger['error'](_0x415c('0x10'),_0x4ad4f5,_0x5474ed);_0x17ff54(_0x5474ed);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6ae75d9..50c4438 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 _0xd76f=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x475861,_0x4c8a2b){var _0x20b41e=function(_0x3c9fb8){while(--_0x3c9fb8){_0x475861['push'](_0x475861['shift']());}};_0x20b41e(++_0x4c8a2b);}(_0xd76f,0x88));var _0xfd76=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0xd76f[_0x2d7226];return _0x59b03f;};'use strict';var multer=require(_0xfd76('0x0'));var util=require(_0xfd76('0x1'));var path=require(_0xfd76('0x2'));var timeout=require(_0xfd76('0x3'));var express=require(_0xfd76('0x4'));var router=express[_0xfd76('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfd76('0x6'));var interaction=require(_0xfd76('0x7'));var config=require(_0xfd76('0x8'));var controller=require(_0xfd76('0x9'));router[_0xfd76('0xa')]('/',auth[_0xfd76('0xb')](),controller[_0xfd76('0xc')]);router[_0xfd76('0xa')](_0xfd76('0xd'),auth['isAuthenticated'](),controller[_0xfd76('0xe')]);router[_0xfd76('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd76('0x10')]);router[_0xfd76('0x11')](_0xfd76('0xd'),auth[_0xfd76('0xb')](),controller['update']);router[_0xfd76('0x12')](_0xfd76('0xd'),auth[_0xfd76('0xb')](),controller[_0xfd76('0x13')]);module[_0xfd76('0x14')]=router; \ No newline at end of file +var _0xcc9c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x406738,_0x3dbc07){var _0x3a76ca=function(_0x3307c7){while(--_0x3307c7){_0x406738['push'](_0x406738['shift']());}};_0x3a76ca(++_0x3dbc07);}(_0xcc9c,0x101));var _0xccc9=function(_0x1aa723,_0x1fa6d8){_0x1aa723=_0x1aa723-0x0;var _0x5e99fa=_0xcc9c[_0x1aa723];return _0x5e99fa;};'use strict';var multer=require(_0xccc9('0x0'));var util=require('util');var path=require(_0xccc9('0x1'));var timeout=require('connect-timeout');var express=require(_0xccc9('0x2'));var router=express[_0xccc9('0x3')]();var fs_extra=require(_0xccc9('0x4'));var auth=require(_0xccc9('0x5'));var interaction=require(_0xccc9('0x6'));var config=require('../../config/environment');var controller=require(_0xccc9('0x7'));router[_0xccc9('0x8')]('/',auth[_0xccc9('0x9')](),controller[_0xccc9('0xa')]);router['get'](_0xccc9('0xb'),auth[_0xccc9('0x9')](),controller[_0xccc9('0xc')]);router[_0xccc9('0xd')]('/',auth[_0xccc9('0x9')](),controller[_0xccc9('0xe')]);router[_0xccc9('0xf')](_0xccc9('0xb'),auth[_0xccc9('0x9')](),controller[_0xccc9('0x10')]);router[_0xccc9('0x11')](_0xccc9('0xb'),auth[_0xccc9('0x9')](),controller[_0xccc9('0x12')]);module[_0xccc9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9387149..98cc0e6 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 _0xf019=['picklist','STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1035ad,_0x18a82a){var _0x70d5c4=function(_0x19e008){while(--_0x19e008){_0x1035ad['push'](_0x1035ad['shift']());}};_0x70d5c4(++_0x18a82a);}(_0xf019,0x102));var _0x9f01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf019[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x9f01('0x0')]={'type':{'type':Sequelize[_0x9f01('0x1')](_0x9f01('0x2'),_0x9f01('0x3'),_0x9f01('0x4'),_0x9f01('0x5'),_0x9f01('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9f01('0x7')]},'keyType':{'type':Sequelize[_0x9f01('0x1')](_0x9f01('0x2'),_0x9f01('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9f01('0x7')]},'idField':{'type':Sequelize[_0x9f01('0x7')]},'nameField':{'type':Sequelize[_0x9f01('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f01('0x7')]}}; \ No newline at end of file +var _0x092c=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist'];(function(_0x1f6dc7,_0x29d6a5){var _0x58ca70=function(_0x18fa70){while(--_0x18fa70){_0x1f6dc7['push'](_0x1f6dc7['shift']());}};_0x58ca70(++_0x29d6a5);}(_0x092c,0x1ce));var _0xc092=function(_0x6886ee,_0x46e7ae){_0x6886ee=_0x6886ee-0x0;var _0x26c043=_0x092c[_0x6886ee];return _0x26c043;};'use strict';var Sequelize=require(_0xc092('0x0'));module[_0xc092('0x1')]={'type':{'type':Sequelize[_0xc092('0x2')]('string',_0xc092('0x3'),'customVariable',_0xc092('0x4'),_0xc092('0x5')),'defaultValue':_0xc092('0x6')},'content':{'type':Sequelize[_0xc092('0x7')]},'key':{'type':Sequelize[_0xc092('0x7')]},'keyType':{'type':Sequelize[_0xc092('0x2')]('string',_0xc092('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc092('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc092('0x7')]},'customField':{'type':Sequelize[_0xc092('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc092('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2c82321..56460e3 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 _0x64cb=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x13b645,_0xdd3b9d){var _0x6c62b1=function(_0x27d213){while(--_0x27d213){_0x13b645['push'](_0x13b645['shift']());}};_0x6c62b1(++_0xdd3b9d);}(_0x64cb,0xd6));var _0xb64c=function(_0x21179d,_0x53b5be){_0x21179d=_0x21179d-0x0;var _0x10a953=_0x64cb[_0x21179d];return _0x10a953;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb64c('0x0'));var zipdir=require(_0xb64c('0x1'));var jsonpatch=require(_0xb64c('0x2'));var rp=require(_0xb64c('0x3'));var moment=require(_0xb64c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb64c('0x5'));var util=require(_0xb64c('0x6'));var path=require('path');var sox=require(_0xb64c('0x7'));var csv=require(_0xb64c('0x8'));var ejs=require(_0xb64c('0x9'));var fs=require('fs');var fs_extra=require(_0xb64c('0xa'));var _=require(_0xb64c('0xb'));var squel=require(_0xb64c('0xc'));var crypto=require(_0xb64c('0xd'));var jsforce=require(_0xb64c('0xe'));var deskjs=require(_0xb64c('0xf'));var toCsv=require(_0xb64c('0x8'));var querystring=require(_0xb64c('0x10'));var Papa=require(_0xb64c('0x11'));var Redis=require(_0xb64c('0x12'));var authService=require(_0xb64c('0x13'));var qs=require(_0xb64c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb64c('0x15'));var logger=require(_0xb64c('0x16'))(_0xb64c('0x17'));var utils=require('../../config/utils');var config=require(_0xb64c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x580ded,_0x543354){_0x543354=_0x543354||0xcc;return function(_0x913372){if(_0x913372){return _0x580ded[_0xb64c('0x19')](_0x543354);}return _0x580ded[_0xb64c('0x1a')](_0x543354)['end']();};}function respondWithResult(_0x1b9ee4,_0x4925a1){_0x4925a1=_0x4925a1||0xc8;return function(_0x28594a){if(_0x28594a){return _0x1b9ee4[_0xb64c('0x1a')](_0x4925a1)[_0xb64c('0x1b')](_0x28594a);}};}function respondWithFilteredResult(_0x1956c8,_0x20cd99){return function(_0xe13c54){if(_0xe13c54){var _0x7c3444=typeof _0x20cd99[_0xb64c('0x1c')]===_0xb64c('0x1d')&&typeof _0x20cd99[_0xb64c('0x1e')]===_0xb64c('0x1d');var _0x218b06=_0xe13c54[_0xb64c('0x1f')];var _0x462981=_0x7c3444?0x0:_0x20cd99[_0xb64c('0x1c')];var _0x33b93d=_0x7c3444?_0xe13c54[_0xb64c('0x1f')]:_0x20cd99[_0xb64c('0x1c')]+_0x20cd99[_0xb64c('0x1e')];var _0x2eb57e;if(_0x33b93d>=_0x218b06){_0x33b93d=_0x218b06;_0x2eb57e=0xc8;}else{_0x2eb57e=0xce;}_0x1956c8['status'](_0x2eb57e);return _0x1956c8['set']('Content-Range',_0x462981+'-'+_0x33b93d+'/'+_0x218b06)[_0xb64c('0x1b')](_0xe13c54);}return null;};}function patchUpdates(_0x283bd7){return function(_0x4bca2a){try{jsonpatch[_0xb64c('0x20')](_0x4bca2a,_0x283bd7,!![]);}catch(_0x2b5ee4){return BPromise['reject'](_0x2b5ee4);}return _0x4bca2a[_0xb64c('0x21')]();};}function saveUpdates(_0xd05f74,_0x3d4e81){return function(_0x483ec7){if(_0x483ec7){return _0x483ec7[_0xb64c('0x22')](_0xd05f74)[_0xb64c('0x23')](function(_0x17ba00){return _0x17ba00;});}return null;};}function removeEntity(_0x5a8938,_0x325ed0){return function(_0x517cc2){if(_0x517cc2){return _0x517cc2[_0xb64c('0x24')]()['then'](function(){_0x5a8938[_0xb64c('0x1a')](0xcc)[_0xb64c('0x25')]();});}};}function handleEntityNotFound(_0x258b8f,_0x28c3ee){return function(_0x1dc5bf){if(!_0x1dc5bf){_0x258b8f['sendStatus'](0x194);}return _0x1dc5bf;};}function handleError(_0x2abbac,_0x3f5bce){_0x3f5bce=_0x3f5bce||0x1f4;return function(_0x14c8a8){logger['error'](_0x14c8a8[_0xb64c('0x26')]);if(_0x14c8a8['name']){delete _0x14c8a8[_0xb64c('0x27')];}_0x2abbac[_0xb64c('0x1a')](_0x3f5bce)['send'](_0x14c8a8);};}exports[_0xb64c('0x28')]=function(_0x4d44a6,_0x197119){var _0x5da5f4={},_0x4ddc2a={},_0x1e4abe={'count':0x0,'rows':[]};var _0x4fdeb5=_[_0xb64c('0x29')](db[_0xb64c('0x2a')][_0xb64c('0x2b')],function(_0x424929){return{'name':_0x424929[_0xb64c('0x2c')],'type':_0x424929[_0xb64c('0x2d')][_0xb64c('0x2e')]};});_0x4ddc2a['model']=_[_0xb64c('0x29')](_0x4fdeb5,'name');_0x4ddc2a['query']=_[_0xb64c('0x2f')](_0x4d44a6[_0xb64c('0x30')]);_0x4ddc2a[_0xb64c('0x31')]=_[_0xb64c('0x32')](_0x4ddc2a[_0xb64c('0x33')],_0x4ddc2a[_0xb64c('0x30')]);_0x5da5f4['attributes']=_[_0xb64c('0x32')](_0x4ddc2a[_0xb64c('0x33')],qs['fields'](_0x4d44a6['query'][_0xb64c('0x34')]));_0x5da5f4['attributes']=_0x5da5f4[_0xb64c('0x35')][_0xb64c('0x36')]?_0x5da5f4['attributes']:_0x4ddc2a[_0xb64c('0x33')];if(!_0x4d44a6[_0xb64c('0x30')][_0xb64c('0x37')](_0xb64c('0x38'))){_0x5da5f4[_0xb64c('0x1e')]=qs[_0xb64c('0x1e')](_0x4d44a6[_0xb64c('0x30')]['limit']);_0x5da5f4['offset']=qs[_0xb64c('0x1c')](_0x4d44a6[_0xb64c('0x30')][_0xb64c('0x1c')]);}_0x5da5f4[_0xb64c('0x39')]=qs[_0xb64c('0x3a')](_0x4d44a6[_0xb64c('0x30')]['sort']);_0x5da5f4[_0xb64c('0x3b')]=qs[_0xb64c('0x31')](_[_0xb64c('0x3c')](_0x4d44a6['query'],_0x4ddc2a[_0xb64c('0x31')]),_0x4fdeb5);if(_0x4d44a6['query'][_0xb64c('0x3d')]){_0x5da5f4[_0xb64c('0x3b')]=_[_0xb64c('0x3e')](_0x5da5f4['where'],{'$or':_[_0xb64c('0x29')](_0x4fdeb5,function(_0x35b470){if(_0x35b470['type']!==_0xb64c('0x3f')){var _0x3db32e={};_0x3db32e[_0x35b470[_0xb64c('0x27')]]={'$like':'%'+_0x4d44a6[_0xb64c('0x30')][_0xb64c('0x3d')]+'%'};return _0x3db32e;}})});}_0x5da5f4=_[_0xb64c('0x3e')]({},_0x5da5f4,_0x4d44a6[_0xb64c('0x40')]);var _0xea33b1={'where':_0x5da5f4[_0xb64c('0x3b')]};return db[_0xb64c('0x2a')][_0xb64c('0x1f')](_0xea33b1)[_0xb64c('0x23')](function(_0x1e3f25){_0x1e4abe[_0xb64c('0x1f')]=_0x1e3f25;if(_0x4d44a6[_0xb64c('0x30')][_0xb64c('0x41')]){_0x5da5f4['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xb64c('0x42')](_0x5da5f4);})[_0xb64c('0x23')](function(_0x1ffcdd){_0x1e4abe[_0xb64c('0x43')]=_0x1ffcdd;return _0x1e4abe;})['then'](respondWithFilteredResult(_0x197119,_0x5da5f4))[_0xb64c('0x44')](handleError(_0x197119,null));};exports[_0xb64c('0x45')]=function(_0x4ff760,_0x50efe9){var _0x335ac8={'raw':!![],'where':{'id':_0x4ff760[_0xb64c('0x46')]['id']}},_0x262c23={};_0x262c23['model']=_[_0xb64c('0x2f')](db[_0xb64c('0x2a')][_0xb64c('0x2b')]);_0x262c23[_0xb64c('0x30')]=_[_0xb64c('0x2f')](_0x4ff760[_0xb64c('0x30')]);_0x262c23[_0xb64c('0x31')]=_['intersection'](_0x262c23['model'],_0x262c23['query']);_0x335ac8['attributes']=_['intersection'](_0x262c23['model'],qs[_0xb64c('0x34')](_0x4ff760[_0xb64c('0x30')][_0xb64c('0x34')]));_0x335ac8['attributes']=_0x335ac8['attributes']['length']?_0x335ac8[_0xb64c('0x35')]:_0x262c23[_0xb64c('0x33')];if(_0x4ff760['query'][_0xb64c('0x41')]){_0x335ac8[_0xb64c('0x47')]=[{'all':!![]}];}_0x335ac8=_[_0xb64c('0x3e')]({},_0x335ac8,_0x4ff760[_0xb64c('0x40')]);return db['SugarcrmField'][_0xb64c('0x48')](_0x335ac8)[_0xb64c('0x23')](handleEntityNotFound(_0x50efe9,null))[_0xb64c('0x23')](respondWithResult(_0x50efe9,null))[_0xb64c('0x44')](handleError(_0x50efe9,null));};exports[_0xb64c('0x49')]=function(_0x19f24d,_0x14ff9c){return db['SugarcrmField'][_0xb64c('0x49')](_0x19f24d[_0xb64c('0x4a')],{})[_0xb64c('0x23')](respondWithResult(_0x14ff9c,0xc9))[_0xb64c('0x44')](handleError(_0x14ff9c,null));};exports[_0xb64c('0x22')]=function(_0x2ec44a,_0x3d5bf5){if(_0x2ec44a['body']['id']){delete _0x2ec44a['body']['id'];}return db[_0xb64c('0x2a')][_0xb64c('0x48')]({'where':{'id':_0x2ec44a[_0xb64c('0x46')]['id']}})[_0xb64c('0x23')](handleEntityNotFound(_0x3d5bf5,null))[_0xb64c('0x23')](saveUpdates(_0x2ec44a[_0xb64c('0x4a')],null))[_0xb64c('0x23')](respondWithResult(_0x3d5bf5,null))[_0xb64c('0x44')](handleError(_0x3d5bf5,null));};exports[_0xb64c('0x24')]=function(_0x4f0ea5,_0xdccf5a){return db[_0xb64c('0x2a')][_0xb64c('0x48')]({'where':{'id':_0x4f0ea5[_0xb64c('0x46')]['id']}})[_0xb64c('0x23')](handleEntityNotFound(_0xdccf5a,null))[_0xb64c('0x23')](removeEntity(_0xdccf5a,null))[_0xb64c('0x44')](handleError(_0xdccf5a,null));}; \ No newline at end of file +var _0x5166=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','stack','send','index','map','SugarcrmField','rawAttributes','fieldName','model','name','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','eml-format','rimraf','zip-dir','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x5166,0x10e));var _0x6516=function(_0x21c087,_0x107952){_0x21c087=_0x21c087-0x0;var _0x2b31a9=_0x5166[_0x21c087];return _0x2b31a9;};'use strict';var emlformat=require(_0x6516('0x0'));var rimraf=require(_0x6516('0x1'));var zipdir=require(_0x6516('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(_0x6516('0x3'));var path=require(_0x6516('0x4'));var sox=require(_0x6516('0x5'));var csv=require(_0x6516('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6516('0x7'));var squel=require(_0x6516('0x8'));var crypto=require('crypto');var jsforce=require(_0x6516('0x9'));var deskjs=require(_0x6516('0xa'));var toCsv=require(_0x6516('0x6'));var querystring=require(_0x6516('0xb'));var Papa=require(_0x6516('0xc'));var Redis=require(_0x6516('0xd'));var authService=require(_0x6516('0xe'));var qs=require(_0x6516('0xf'));var as=require(_0x6516('0x10'));var hardwareService=require(_0x6516('0x11'));var logger=require(_0x6516('0x12'))(_0x6516('0x13'));var utils=require(_0x6516('0x14'));var config=require(_0x6516('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6516('0x16'))['db'];function respondWithStatusCode(_0x39e200,_0x5326af){_0x5326af=_0x5326af||0xcc;return function(_0x182903){if(_0x182903){return _0x39e200['sendStatus'](_0x5326af);}return _0x39e200[_0x6516('0x17')](_0x5326af)[_0x6516('0x18')]();};}function respondWithResult(_0x484553,_0x38361f){_0x38361f=_0x38361f||0xc8;return function(_0x1509b9){if(_0x1509b9){return _0x484553[_0x6516('0x17')](_0x38361f)[_0x6516('0x19')](_0x1509b9);}};}function respondWithFilteredResult(_0x986398,_0x21050a){return function(_0x2b0fc7){if(_0x2b0fc7){var _0x3a3fb5=typeof _0x21050a[_0x6516('0x1a')]==='undefined'&&typeof _0x21050a[_0x6516('0x1b')]===_0x6516('0x1c');var _0xa1709a=_0x2b0fc7[_0x6516('0x1d')];var _0x465c73=_0x3a3fb5?0x0:_0x21050a['offset'];var _0x359f57=_0x3a3fb5?_0x2b0fc7[_0x6516('0x1d')]:_0x21050a[_0x6516('0x1a')]+_0x21050a[_0x6516('0x1b')];var _0x657f9c;if(_0x359f57>=_0xa1709a){_0x359f57=_0xa1709a;_0x657f9c=0xc8;}else{_0x657f9c=0xce;}_0x986398[_0x6516('0x17')](_0x657f9c);return _0x986398[_0x6516('0x1e')]('Content-Range',_0x465c73+'-'+_0x359f57+'/'+_0xa1709a)[_0x6516('0x19')](_0x2b0fc7);}return null;};}function patchUpdates(_0x45fb40){return function(_0x16511e){try{jsonpatch[_0x6516('0x1f')](_0x16511e,_0x45fb40,!![]);}catch(_0x129be5){return BPromise[_0x6516('0x20')](_0x129be5);}return _0x16511e[_0x6516('0x21')]();};}function saveUpdates(_0x4a27e7,_0x76ca03){return function(_0x5e3924){if(_0x5e3924){return _0x5e3924['update'](_0x4a27e7)[_0x6516('0x22')](function(_0x35fa5c){return _0x35fa5c;});}return null;};}function removeEntity(_0x491f22,_0x55c9b7){return function(_0x2855c2){if(_0x2855c2){return _0x2855c2[_0x6516('0x23')]()[_0x6516('0x22')](function(){_0x491f22[_0x6516('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebe09,_0x3ee31e){return function(_0x5180e9){if(!_0x5180e9){_0x3ebe09[_0x6516('0x24')](0x194);}return _0x5180e9;};}function handleError(_0x246f7a,_0x5a444b){_0x5a444b=_0x5a444b||0x1f4;return function(_0x4db655){logger['error'](_0x4db655[_0x6516('0x25')]);if(_0x4db655['name']){delete _0x4db655['name'];}_0x246f7a['status'](_0x5a444b)[_0x6516('0x26')](_0x4db655);};}exports[_0x6516('0x27')]=function(_0x2a5b16,_0x2220aa){var _0x4567f7={},_0x19ceec={},_0xd994c0={'count':0x0,'rows':[]};var _0xd72928=_[_0x6516('0x28')](db[_0x6516('0x29')][_0x6516('0x2a')],function(_0x146a34){return{'name':_0x146a34[_0x6516('0x2b')],'type':_0x146a34['type']['key']};});_0x19ceec[_0x6516('0x2c')]=_[_0x6516('0x28')](_0xd72928,_0x6516('0x2d'));_0x19ceec['query']=_[_0x6516('0x2e')](_0x2a5b16['query']);_0x19ceec[_0x6516('0x2f')]=_['intersection'](_0x19ceec['model'],_0x19ceec[_0x6516('0x30')]);_0x4567f7[_0x6516('0x31')]=_[_0x6516('0x32')](_0x19ceec['model'],qs[_0x6516('0x33')](_0x2a5b16[_0x6516('0x30')][_0x6516('0x33')]));_0x4567f7[_0x6516('0x31')]=_0x4567f7[_0x6516('0x31')][_0x6516('0x34')]?_0x4567f7[_0x6516('0x31')]:_0x19ceec[_0x6516('0x2c')];if(!_0x2a5b16[_0x6516('0x30')]['hasOwnProperty'](_0x6516('0x35'))){_0x4567f7['limit']=qs[_0x6516('0x1b')](_0x2a5b16[_0x6516('0x30')]['limit']);_0x4567f7[_0x6516('0x1a')]=qs[_0x6516('0x1a')](_0x2a5b16[_0x6516('0x30')][_0x6516('0x1a')]);}_0x4567f7['order']=qs[_0x6516('0x36')](_0x2a5b16[_0x6516('0x30')][_0x6516('0x36')]);_0x4567f7['where']=qs[_0x6516('0x2f')](_[_0x6516('0x37')](_0x2a5b16[_0x6516('0x30')],_0x19ceec[_0x6516('0x2f')]),_0xd72928);if(_0x2a5b16[_0x6516('0x30')][_0x6516('0x38')]){_0x4567f7[_0x6516('0x39')]=_[_0x6516('0x3a')](_0x4567f7['where'],{'$or':_['map'](_0xd72928,function(_0x1e637a){if(_0x1e637a['type']!=='VIRTUAL'){var _0x2e7c0f={};_0x2e7c0f[_0x1e637a[_0x6516('0x2d')]]={'$like':'%'+_0x2a5b16[_0x6516('0x30')][_0x6516('0x38')]+'%'};return _0x2e7c0f;}})});}_0x4567f7=_[_0x6516('0x3a')]({},_0x4567f7,_0x2a5b16['options']);var _0x1b859b={'where':_0x4567f7[_0x6516('0x39')]};return db[_0x6516('0x29')]['count'](_0x1b859b)[_0x6516('0x22')](function(_0x214a2c){_0xd994c0[_0x6516('0x1d')]=_0x214a2c;if(_0x2a5b16['query'][_0x6516('0x3b')]){_0x4567f7['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x6516('0x3c')](_0x4567f7);})[_0x6516('0x22')](function(_0x43de51){_0xd994c0[_0x6516('0x3d')]=_0x43de51;return _0xd994c0;})[_0x6516('0x22')](respondWithFilteredResult(_0x2220aa,_0x4567f7))[_0x6516('0x3e')](handleError(_0x2220aa,null));};exports[_0x6516('0x3f')]=function(_0x2d522a,_0x3044fe){var _0x531655={'raw':!![],'where':{'id':_0x2d522a[_0x6516('0x40')]['id']}},_0x3ba2ec={};_0x3ba2ec[_0x6516('0x2c')]=_[_0x6516('0x2e')](db['SugarcrmField'][_0x6516('0x2a')]);_0x3ba2ec[_0x6516('0x30')]=_['keys'](_0x2d522a[_0x6516('0x30')]);_0x3ba2ec[_0x6516('0x2f')]=_[_0x6516('0x32')](_0x3ba2ec[_0x6516('0x2c')],_0x3ba2ec[_0x6516('0x30')]);_0x531655[_0x6516('0x31')]=_['intersection'](_0x3ba2ec[_0x6516('0x2c')],qs[_0x6516('0x33')](_0x2d522a[_0x6516('0x30')][_0x6516('0x33')]));_0x531655[_0x6516('0x31')]=_0x531655[_0x6516('0x31')][_0x6516('0x34')]?_0x531655[_0x6516('0x31')]:_0x3ba2ec[_0x6516('0x2c')];if(_0x2d522a['query'][_0x6516('0x3b')]){_0x531655[_0x6516('0x41')]=[{'all':!![]}];}_0x531655=_[_0x6516('0x3a')]({},_0x531655,_0x2d522a[_0x6516('0x42')]);return db[_0x6516('0x29')]['find'](_0x531655)[_0x6516('0x22')](handleEntityNotFound(_0x3044fe,null))['then'](respondWithResult(_0x3044fe,null))['catch'](handleError(_0x3044fe,null));};exports[_0x6516('0x43')]=function(_0x458783,_0x4f8780){return db[_0x6516('0x29')][_0x6516('0x43')](_0x458783[_0x6516('0x44')],{})[_0x6516('0x22')](respondWithResult(_0x4f8780,0xc9))['catch'](handleError(_0x4f8780,null));};exports[_0x6516('0x45')]=function(_0x172654,_0x1db36c){if(_0x172654['body']['id']){delete _0x172654[_0x6516('0x44')]['id'];}return db['SugarcrmField'][_0x6516('0x46')]({'where':{'id':_0x172654[_0x6516('0x40')]['id']}})['then'](handleEntityNotFound(_0x1db36c,null))[_0x6516('0x22')](saveUpdates(_0x172654[_0x6516('0x44')],null))[_0x6516('0x22')](respondWithResult(_0x1db36c,null))[_0x6516('0x3e')](handleError(_0x1db36c,null));};exports[_0x6516('0x23')]=function(_0x55edd6,_0xb241ee){return db[_0x6516('0x29')][_0x6516('0x46')]({'where':{'id':_0x55edd6[_0x6516('0x40')]['id']}})[_0x6516('0x22')](handleEntityNotFound(_0xb241ee,null))[_0x6516('0x22')](removeEntity(_0xb241ee,null))[_0x6516('0x3e')](handleError(_0xb241ee,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 30ec93d..1f1f6d6 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 _0xb217=['sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xb217,0xe3));var _0x7b21=function(_0x258840,_0x330993){_0x258840=_0x258840-0x0;var _0x1a4ddb=_0xb217[_0x258840];return _0x1a4ddb;};'use strict';var _=require(_0x7b21('0x0'));var util=require(_0x7b21('0x1'));var logger=require(_0x7b21('0x2'))(_0x7b21('0x3'));var moment=require(_0x7b21('0x4'));var BPromise=require(_0x7b21('0x5'));var rp=require(_0x7b21('0x6'));var fs=require('fs');var path=require(_0x7b21('0x7'));var rimraf=require(_0x7b21('0x8'));var config=require(_0x7b21('0x9'));var attributes=require(_0x7b21('0xa'));module['exports']=function(_0x51d6e6,_0x306f48){return _0x51d6e6[_0x7b21('0xb')](_0x7b21('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7b21('0xd'),'fields':[_0x7b21('0xe'),_0x7b21('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x13f4=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x13f4,0xfa));var _0x413f=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0x13f4[_0x1e1020];return _0x464719;};'use strict';var _=require(_0x413f('0x0'));var util=require(_0x413f('0x1'));var logger=require(_0x413f('0x2'))('api');var moment=require(_0x413f('0x3'));var BPromise=require(_0x413f('0x4'));var rp=require(_0x413f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x413f('0x6'));var config=require(_0x413f('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x413f('0x8')]=function(_0x51ee86,_0x2721e6){return _0x51ee86[_0x413f('0x9')]('SugarcrmField',attributes,{'tableName':_0x413f('0xa'),'paranoid':![],'indexes':[{'name':_0x413f('0xb'),'fields':[_0x413f('0xc'),_0x413f('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 9ca3337..6b13de3 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 _0xab3c=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/environment'];(function(_0x5da9e7,_0x9dc511){var _0x266cf5=function(_0x1b1827){while(--_0x1b1827){_0x5da9e7['push'](_0x5da9e7['shift']());}};_0x266cf5(++_0x9dc511);}(_0xab3c,0x8d));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var util=require(_0xcab3('0x1'));var moment=require(_0xcab3('0x2'));var BPromise=require('bluebird');var rs=require(_0xcab3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcab3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcab3('0x5'));var jayson=require(_0xcab3('0x6'));var client=jayson[_0xcab3('0x7')][_0xcab3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x290384,_0x8815b7,_0x6956db){return new BPromise(function(_0x2affd8,_0x16adfb){return client[_0xcab3('0x9')](_0x290384,_0x6956db)[_0xcab3('0xa')](function(_0x7497c6){logger[_0xcab3('0xb')](_0xcab3('0xc'),_0x8815b7,_0xcab3('0xd'));logger[_0xcab3('0xe')](_0xcab3('0xf'),_0x8815b7,_0xcab3('0xd'),JSON[_0xcab3('0x10')](_0x7497c6));if(_0x7497c6[_0xcab3('0x11')]){if(_0x7497c6[_0xcab3('0x11')][_0xcab3('0x12')]===0x1f4){logger[_0xcab3('0x11')](_0xcab3('0xc'),_0x8815b7,_0x7497c6[_0xcab3('0x11')]['message']);return _0x16adfb(_0x7497c6['error'][_0xcab3('0x13')]);}logger[_0xcab3('0x11')](_0xcab3('0xc'),_0x8815b7,_0x7497c6['error'][_0xcab3('0x13')]);return _0x2affd8(_0x7497c6[_0xcab3('0x11')][_0xcab3('0x13')]);}else{logger[_0xcab3('0xb')](_0xcab3('0xc'),_0x8815b7,'request\x20sent');_0x2affd8(_0x7497c6[_0xcab3('0x14')]['message']);}})['catch'](function(_0xdf4aba){logger[_0xcab3('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x8815b7,_0xdf4aba);_0x16adfb(_0xdf4aba);});});} \ No newline at end of file +var _0x0dc9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x42de42,_0x4a40e2){var _0x7f0ee1=function(_0x47e7e8){while(--_0x47e7e8){_0x42de42['push'](_0x42de42['shift']());}};_0x7f0ee1(++_0x4a40e2);}(_0x0dc9,0xb4));var _0x90dc=function(_0x3832f9,_0x59c443){_0x3832f9=_0x3832f9-0x0;var _0x37418c=_0x0dc9[_0x3832f9];return _0x37418c;};'use strict';var _=require(_0x90dc('0x0'));var util=require('util');var moment=require(_0x90dc('0x1'));var BPromise=require('bluebird');var rs=require(_0x90dc('0x2'));var fs=require('fs');var Redis=require(_0x90dc('0x3'));var db=require(_0x90dc('0x4'))['db'];var utils=require(_0x90dc('0x5'));var logger=require('../../config/logger')(_0x90dc('0x6'));var config=require(_0x90dc('0x7'));var jayson=require(_0x90dc('0x8'));var client=jayson[_0x90dc('0x9')][_0x90dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa00428,_0x2497f9,_0x496fc0){return new BPromise(function(_0x1c5160,_0x7061d4){return client[_0x90dc('0xb')](_0xa00428,_0x496fc0)[_0x90dc('0xc')](function(_0x1567b5){logger[_0x90dc('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x2497f9,_0x90dc('0xe'));logger[_0x90dc('0xf')](_0x90dc('0x10'),_0x2497f9,_0x90dc('0xe'),JSON[_0x90dc('0x11')](_0x1567b5));if(_0x1567b5[_0x90dc('0x12')]){if(_0x1567b5[_0x90dc('0x12')]['code']===0x1f4){logger[_0x90dc('0x12')](_0x90dc('0x13'),_0x2497f9,_0x1567b5[_0x90dc('0x12')][_0x90dc('0x14')]);return _0x7061d4(_0x1567b5[_0x90dc('0x12')][_0x90dc('0x14')]);}logger[_0x90dc('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x2497f9,_0x1567b5[_0x90dc('0x12')]['message']);return _0x1c5160(_0x1567b5[_0x90dc('0x12')][_0x90dc('0x14')]);}else{logger['info'](_0x90dc('0x13'),_0x2497f9,_0x90dc('0xe'));_0x1c5160(_0x1567b5[_0x90dc('0x15')][_0x90dc('0x14')]);}})[_0x90dc('0x16')](function(_0x2cb33d){logger[_0x90dc('0x12')](_0x90dc('0x13'),_0x2497f9,_0x2cb33d);_0x7061d4(_0x2cb33d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 3c4cfb8..848e64a 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 _0xa6b3=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','util'];(function(_0x2da8c4,_0x27adda){var _0x3ee006=function(_0x4b9d7c){while(--_0x4b9d7c){_0x2da8c4['push'](_0x2da8c4['shift']());}};_0x3ee006(++_0x27adda);}(_0xa6b3,0x72));var _0x3a6b=function(_0xc6f951,_0x508b35){_0xc6f951=_0xc6f951-0x0;var _0x1f5d33=_0xa6b3[_0xc6f951];return _0x1f5d33;};'use strict';var multer=require('multer');var util=require(_0x3a6b('0x0'));var path=require('path');var timeout=require(_0x3a6b('0x1'));var express=require('express');var router=express[_0x3a6b('0x2')]();var fs_extra=require(_0x3a6b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3a6b('0x4'));var config=require(_0x3a6b('0x5'));var controller=require(_0x3a6b('0x6'));router[_0x3a6b('0x7')]('/',auth[_0x3a6b('0x8')](),controller[_0x3a6b('0x9')]);router['get'](_0x3a6b('0xa'),auth[_0x3a6b('0x8')](),controller[_0x3a6b('0xb')]);router[_0x3a6b('0x7')](_0x3a6b('0xc'),auth['isAuthenticated'](),controller[_0x3a6b('0xd')]);router[_0x3a6b('0x7')](_0x3a6b('0xe'),auth[_0x3a6b('0x8')](),controller['getFields']);router[_0x3a6b('0xf')]('/',auth['isAuthenticated'](),controller[_0x3a6b('0x10')]);router[_0x3a6b('0xf')]('/:id/configurations',auth[_0x3a6b('0x8')](),controller[_0x3a6b('0x11')]);router[_0x3a6b('0x12')](_0x3a6b('0xa'),auth[_0x3a6b('0x8')](),controller[_0x3a6b('0x13')]);router[_0x3a6b('0x14')](_0x3a6b('0xa'),auth[_0x3a6b('0x8')](),controller[_0x3a6b('0x15')]);module[_0x3a6b('0x16')]=router; \ No newline at end of file +var _0x8b30=['index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x8b30,0x1c7));var _0x08b3=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x8b30[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var path=require(_0x08b3('0x2'));var timeout=require(_0x08b3('0x3'));var express=require(_0x08b3('0x4'));var router=express[_0x08b3('0x5')]();var fs_extra=require(_0x08b3('0x6'));var auth=require(_0x08b3('0x7'));var interaction=require(_0x08b3('0x8'));var config=require(_0x08b3('0x9'));var controller=require(_0x08b3('0xa'));router[_0x08b3('0xb')]('/',auth[_0x08b3('0xc')](),controller[_0x08b3('0xd')]);router['get'](_0x08b3('0xe'),auth[_0x08b3('0xc')](),controller[_0x08b3('0xf')]);router[_0x08b3('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x08b3('0x10')]);router[_0x08b3('0xb')](_0x08b3('0x11'),auth[_0x08b3('0xc')](),controller[_0x08b3('0x12')]);router[_0x08b3('0x13')]('/',auth[_0x08b3('0xc')](),controller['create']);router[_0x08b3('0x13')](_0x08b3('0x14'),auth[_0x08b3('0xc')](),controller['addConfiguration']);router[_0x08b3('0x15')](_0x08b3('0xe'),auth[_0x08b3('0xc')](),controller[_0x08b3('0x16')]);router[_0x08b3('0x17')](_0x08b3('0xe'),auth['isAuthenticated'](),controller[_0x08b3('0x18')]);module[_0x08b3('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 775425b..084030a 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 _0x6659=['HelpDesk','sequelize','exports','STRING'];(function(_0x10581e,_0xe95164){var _0x534aaf=function(_0x591cd6){while(--_0x591cd6){_0x10581e['push'](_0x10581e['shift']());}};_0x534aaf(++_0xe95164);}(_0x6659,0xd5));var _0x9665=function(_0xec5bb4,_0x5458c4){_0xec5bb4=_0xec5bb4-0x0;var _0xc1c963=_0x6659[_0xec5bb4];return _0xc1c963;};'use strict';var Sequelize=require(_0x9665('0x0'));module[_0x9665('0x1')]={'name':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9665('0x2')]},'username':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9665('0x2')],'allowNull':![],'defaultValue':_0x9665('0x3')},'remoteUri':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x91e8=['HelpDesk','sequelize','STRING'];(function(_0x38da01,_0x49d519){var _0x373017=function(_0x82c8ee){while(--_0x82c8ee){_0x38da01['push'](_0x38da01['shift']());}};_0x373017(++_0x49d519);}(_0x91e8,0x70));var _0x891e=function(_0x41ec5e,_0x234154){_0x41ec5e=_0x41ec5e-0x0;var _0x143357=_0x91e8[_0x41ec5e];return _0x143357;};'use strict';var Sequelize=require(_0x891e('0x0'));module['exports']={'name':{'type':Sequelize[_0x891e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x891e('0x1')]},'username':{'type':Sequelize[_0x891e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x891e('0x2')},'remoteUri':{'type':Sequelize[_0x891e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x891e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x891e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3f7885b..184022a 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 _0x57e2=['success','POST','result','token','sessionName','autogenerated','owner','remove','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','index','VtigerAccount','rawAttributes','type','map','query','keys','intersection','attributes','model','fields','length','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x57e2,0x100));var _0x257e=function(_0x424a3a,_0x3484de){_0x424a3a=_0x424a3a-0x0;var _0x432a16=_0x57e2[_0x424a3a];return _0x432a16;};'use strict';var emlformat=require(_0x257e('0x0'));var rimraf=require(_0x257e('0x1'));var zipdir=require(_0x257e('0x2'));var jsonpatch=require(_0x257e('0x3'));var rp=require('request-promise');var moment=require(_0x257e('0x4'));var BPromise=require(_0x257e('0x5'));var Mustache=require(_0x257e('0x6'));var util=require(_0x257e('0x7'));var path=require('path');var sox=require(_0x257e('0x8'));var csv=require(_0x257e('0x9'));var ejs=require(_0x257e('0xa'));var fs=require('fs');var fs_extra=require(_0x257e('0xb'));var _=require(_0x257e('0xc'));var squel=require(_0x257e('0xd'));var crypto=require(_0x257e('0xe'));var jsforce=require(_0x257e('0xf'));var deskjs=require(_0x257e('0x10'));var toCsv=require(_0x257e('0x9'));var querystring=require(_0x257e('0x11'));var Papa=require('papaparse');var Redis=require(_0x257e('0x12'));var authService=require(_0x257e('0x13'));var qs=require(_0x257e('0x14'));var as=require(_0x257e('0x15'));var hardwareService=require(_0x257e('0x16'));var logger=require('../../config/logger')(_0x257e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x257e('0x18'));var db=require(_0x257e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1e0bb1,_0x5e0aed){_0x5e0aed=_0x5e0aed||0xcc;return function(_0x66b01f){if(_0x66b01f){return _0x1e0bb1[_0x257e('0x1a')](_0x5e0aed);}return _0x1e0bb1[_0x257e('0x1b')](_0x5e0aed)[_0x257e('0x1c')]();};}function respondWithResult(_0x442d51,_0x3edda3){_0x3edda3=_0x3edda3||0xc8;return function(_0x204954){if(_0x204954){return _0x442d51[_0x257e('0x1b')](_0x3edda3)[_0x257e('0x1d')](_0x204954);}};}function respondWithFilteredResult(_0xce8a52,_0x35a061){return function(_0x5ad423){if(_0x5ad423){var _0x51d16b=typeof _0x35a061['offset']==='undefined'&&typeof _0x35a061[_0x257e('0x1e')]===_0x257e('0x1f');var _0x44d4f9=_0x5ad423[_0x257e('0x20')];var _0x272d2c=_0x51d16b?0x0:_0x35a061[_0x257e('0x21')];var _0x55efee=_0x51d16b?_0x5ad423[_0x257e('0x20')]:_0x35a061[_0x257e('0x21')]+_0x35a061[_0x257e('0x1e')];var _0x37b912;if(_0x55efee>=_0x44d4f9){_0x55efee=_0x44d4f9;_0x37b912=0xc8;}else{_0x37b912=0xce;}_0xce8a52[_0x257e('0x1b')](_0x37b912);return _0xce8a52['set'](_0x257e('0x22'),_0x272d2c+'-'+_0x55efee+'/'+_0x44d4f9)[_0x257e('0x1d')](_0x5ad423);}return null;};}function patchUpdates(_0x1ef0dc){return function(_0x3e962){try{jsonpatch[_0x257e('0x23')](_0x3e962,_0x1ef0dc,!![]);}catch(_0x16473c){return BPromise[_0x257e('0x24')](_0x16473c);}return _0x3e962[_0x257e('0x25')]();};}function saveUpdates(_0x53789a,_0x22b3b2){return function(_0x20fe26){if(_0x20fe26){return _0x20fe26[_0x257e('0x26')](_0x53789a)[_0x257e('0x27')](function(_0x288c07){return _0x288c07;});}return null;};}function removeEntity(_0xd3f47,_0x26dee7){return function(_0x5865d0){if(_0x5865d0){return _0x5865d0[_0x257e('0x28')]()[_0x257e('0x27')](function(){_0xd3f47[_0x257e('0x1b')](0xcc)[_0x257e('0x1c')]();});}};}function handleEntityNotFound(_0x234d4c,_0xb7a337){return function(_0x3ad54a){if(!_0x3ad54a){_0x234d4c[_0x257e('0x1a')](0x194);}return _0x3ad54a;};}function handleError(_0x7a0e8e,_0x251784){_0x251784=_0x251784||0x1f4;return function(_0x455851){logger['error'](_0x455851['stack']);if(_0x455851[_0x257e('0x29')]){delete _0x455851[_0x257e('0x29')];}_0x7a0e8e[_0x257e('0x1b')](_0x251784)['send'](_0x455851);};}exports[_0x257e('0x2a')]=function(_0x14bfab,_0x38aadc){var _0x2b33ad={},_0x3f842d={},_0x3ed492={'count':0x0,'rows':[]};var _0x574656=_['map'](db[_0x257e('0x2b')][_0x257e('0x2c')],function(_0x2d6642){return{'name':_0x2d6642['fieldName'],'type':_0x2d6642[_0x257e('0x2d')]['key']};});_0x3f842d['model']=_[_0x257e('0x2e')](_0x574656,_0x257e('0x29'));_0x3f842d[_0x257e('0x2f')]=_[_0x257e('0x30')](_0x14bfab[_0x257e('0x2f')]);_0x3f842d['filters']=_[_0x257e('0x31')](_0x3f842d['model'],_0x3f842d['query']);_0x2b33ad[_0x257e('0x32')]=_[_0x257e('0x31')](_0x3f842d[_0x257e('0x33')],qs[_0x257e('0x34')](_0x14bfab['query'][_0x257e('0x34')]));_0x2b33ad['attributes']=_0x2b33ad[_0x257e('0x32')][_0x257e('0x35')]?_0x2b33ad[_0x257e('0x32')]:_0x3f842d[_0x257e('0x33')];if(!_0x14bfab[_0x257e('0x2f')]['hasOwnProperty']('nolimit')){_0x2b33ad['limit']=qs['limit'](_0x14bfab['query'][_0x257e('0x1e')]);_0x2b33ad[_0x257e('0x21')]=qs[_0x257e('0x21')](_0x14bfab['query'][_0x257e('0x21')]);}_0x2b33ad['order']=qs[_0x257e('0x36')](_0x14bfab[_0x257e('0x2f')][_0x257e('0x36')]);_0x2b33ad[_0x257e('0x37')]=qs[_0x257e('0x38')](_[_0x257e('0x39')](_0x14bfab[_0x257e('0x2f')],_0x3f842d[_0x257e('0x38')]),_0x574656);if(_0x14bfab[_0x257e('0x2f')][_0x257e('0x3a')]){_0x2b33ad[_0x257e('0x37')]=_['merge'](_0x2b33ad['where'],{'$or':_[_0x257e('0x2e')](_0x574656,function(_0x2895b4){if(_0x2895b4[_0x257e('0x2d')]!==_0x257e('0x3b')){var _0x5645ab={};_0x5645ab[_0x2895b4['name']]={'$like':'%'+_0x14bfab['query']['filter']+'%'};return _0x5645ab;}})});}_0x2b33ad=_[_0x257e('0x3c')]({},_0x2b33ad,_0x14bfab[_0x257e('0x3d')]);var _0x487471={'where':_0x2b33ad[_0x257e('0x37')]};return db[_0x257e('0x2b')][_0x257e('0x20')](_0x487471)['then'](function(_0x188430){_0x3ed492[_0x257e('0x20')]=_0x188430;if(_0x14bfab['query'][_0x257e('0x3e')]){_0x2b33ad[_0x257e('0x3f')]=[{'all':!![]}];}return db[_0x257e('0x2b')]['findAll'](_0x2b33ad);})['then'](function(_0x376cc6){_0x3ed492[_0x257e('0x40')]=_0x376cc6;return _0x3ed492;})[_0x257e('0x27')](respondWithFilteredResult(_0x38aadc,_0x2b33ad))[_0x257e('0x41')](handleError(_0x38aadc,null));};exports['show']=function(_0x132461,_0x5c8304){var _0x238b0c={'raw':![],'where':{'id':_0x132461[_0x257e('0x42')]['id']}},_0x51474c={};_0x51474c[_0x257e('0x33')]=_['keys'](db['VtigerAccount']['rawAttributes']);_0x51474c[_0x257e('0x2f')]=_[_0x257e('0x30')](_0x132461[_0x257e('0x2f')]);_0x51474c[_0x257e('0x38')]=_[_0x257e('0x31')](_0x51474c['model'],_0x51474c[_0x257e('0x2f')]);_0x238b0c[_0x257e('0x32')]=_[_0x257e('0x31')](_0x51474c[_0x257e('0x33')],qs[_0x257e('0x34')](_0x132461[_0x257e('0x2f')][_0x257e('0x34')]));_0x238b0c['attributes']=_0x238b0c[_0x257e('0x32')][_0x257e('0x35')]?_0x238b0c[_0x257e('0x32')]:_0x51474c[_0x257e('0x33')];if(_0x132461[_0x257e('0x2f')][_0x257e('0x3e')]){_0x238b0c[_0x257e('0x3f')]=[{'all':!![]}];}_0x238b0c=_['merge']({},_0x238b0c,_0x132461['options']);return db[_0x257e('0x2b')][_0x257e('0x43')](_0x238b0c)['then'](handleEntityNotFound(_0x5c8304,null))['then'](respondWithResult(_0x5c8304,null))['catch'](handleError(_0x5c8304,null));};exports['create']=function(_0x33ceee,_0x41123d){return db['VtigerAccount'][_0x257e('0x44')](_0x33ceee[_0x257e('0x45')],{})[_0x257e('0x27')](respondWithResult(_0x41123d,0xc9))['catch'](handleError(_0x41123d,null));};exports[_0x257e('0x26')]=function(_0xe144b1,_0x105cca){if(_0xe144b1[_0x257e('0x45')]['id']){delete _0xe144b1[_0x257e('0x45')]['id'];}return db['VtigerAccount'][_0x257e('0x43')]({'where':{'id':_0xe144b1[_0x257e('0x42')]['id']}})['then'](handleEntityNotFound(_0x105cca,null))[_0x257e('0x27')](saveUpdates(_0xe144b1[_0x257e('0x45')],null))['then'](respondWithResult(_0x105cca,null))[_0x257e('0x41')](handleError(_0x105cca,null));};exports['destroy']=function(_0x535895,_0x513005){return db[_0x257e('0x2b')]['find']({'where':{'id':_0x535895[_0x257e('0x42')]['id']}})['then'](handleEntityNotFound(_0x513005,null))[_0x257e('0x27')](removeEntity(_0x513005,null))[_0x257e('0x41')](handleError(_0x513005,null));};exports[_0x257e('0x46')]=function(_0x4c372b,_0x236ab4,_0x1d023b){var _0x4ae83c={};var _0x19af09={};var _0x1be529;var _0x10c29d;return db['VtigerAccount'][_0x257e('0x47')]({'where':{'id':_0x4c372b[_0x257e('0x42')]['id']}})[_0x257e('0x27')](handleEntityNotFound(_0x236ab4,null))['then'](function(_0x52fa2a){if(_0x52fa2a){_0x1be529=_0x52fa2a;_0x19af09[_0x257e('0x33')]=_[_0x257e('0x30')](db[_0x257e('0x48')][_0x257e('0x2c')]);_0x19af09[_0x257e('0x2f')]=_[_0x257e('0x30')](_0x4c372b[_0x257e('0x2f')]);_0x19af09[_0x257e('0x38')]=_[_0x257e('0x31')](_0x19af09[_0x257e('0x33')],_0x19af09[_0x257e('0x2f')]);_0x4ae83c[_0x257e('0x32')]=_[_0x257e('0x31')](_0x19af09[_0x257e('0x33')],qs[_0x257e('0x34')](_0x4c372b[_0x257e('0x2f')][_0x257e('0x34')]));_0x4ae83c[_0x257e('0x32')]=_0x4ae83c['attributes'][_0x257e('0x35')]?_0x4ae83c['attributes']:_0x19af09[_0x257e('0x33')];_0x4ae83c['order']=qs[_0x257e('0x36')](_0x4c372b[_0x257e('0x2f')][_0x257e('0x36')]);_0x4ae83c['where']=qs[_0x257e('0x38')](_['pick'](_0x4c372b[_0x257e('0x2f')],_0x19af09['filters']));if(_0x4c372b[_0x257e('0x2f')][_0x257e('0x3a')]){_0x4ae83c[_0x257e('0x37')]=_[_0x257e('0x3c')](_0x4ae83c['where'],{'$or':_[_0x257e('0x2e')](_0x4ae83c[_0x257e('0x32')],function(_0x3e6c51){var _0x483b3f={};_0x483b3f[_0x3e6c51]={'$like':'%'+_0x4c372b['query'][_0x257e('0x3a')]+'%'};return _0x483b3f;})});}_0x4ae83c=_[_0x257e('0x3c')]({},_0x4ae83c,_0x4c372b[_0x257e('0x3d')]);return _0x1be529[_0x257e('0x46')](_0x4ae83c);}})[_0x257e('0x27')](function(_0x15c001){if(_0x15c001){_0x10c29d=_0x15c001[_0x257e('0x35')];if(!_0x4c372b[_0x257e('0x2f')][_0x257e('0x49')](_0x257e('0x4a'))){_0x4ae83c[_0x257e('0x1e')]=qs[_0x257e('0x1e')](_0x4c372b['query']['limit']);_0x4ae83c[_0x257e('0x21')]=qs['offset'](_0x4c372b[_0x257e('0x2f')]['offset']);}return _0x1be529['getConfigurations'](_0x4ae83c);}})[_0x257e('0x27')](function(_0x44baf4){if(_0x44baf4){return _0x44baf4?{'count':_0x10c29d,'rows':_0x44baf4}:null;}})[_0x257e('0x27')](respondWithResult(_0x236ab4,null))[_0x257e('0x41')](handleError(_0x236ab4,null));};exports[_0x257e('0x4b')]=function(_0x2730b7,_0x1ede3d,_0x1e2506){if(_0x2730b7[_0x257e('0x45')]['id']){delete _0x2730b7['body']['id'];}return db[_0x257e('0x2b')][_0x257e('0x47')]({'where':{'id':_0x2730b7['params']['id']}})[_0x257e('0x27')](handleEntityNotFound(_0x1ede3d,null))[_0x257e('0x27')](function(_0xa49493){if(_0xa49493){_0x2730b7[_0x257e('0x45')][_0x257e('0x4c')]=_0xa49493['id'];_0x2730b7['body']['Subjects']=integrations[_0x257e('0x4d')](_0x2730b7[_0x257e('0x45')][_0x257e('0x4e')],_0x2730b7['body'][_0x257e('0x2d')]);_0x2730b7[_0x257e('0x45')][_0x257e('0x4f')]=integrations['getDescriptions'](_0x2730b7['body'][_0x257e('0x4e')],_0x2730b7[_0x257e('0x45')][_0x257e('0x2d')]);return db[_0x257e('0x48')][_0x257e('0x44')](_0x2730b7['body'],{'include':[{'model':db['VtigerField'],'as':_0x257e('0x50')},{'model':db[_0x257e('0x51')],'as':_0x257e('0x4f')}]});}return null;})[_0x257e('0x27')](respondWithResult(_0x1ede3d,null))[_0x257e('0x41')](handleError(_0x1ede3d,null));};var md5=require(_0x257e('0x52'));exports[_0x257e('0x53')]=function(_0x1b90c5,_0x13f103,_0x3107de){var _0x3529d4=null;var _0x568207=null;var _0x52bc48=null;var _0x1592af=null;var _0x4a4714='';return db['VtigerAccount'][_0x257e('0x47')]({'where':{'id':_0x1b90c5[_0x257e('0x42')]['id']},'attributes':['id','name',_0x257e('0x54'),_0x257e('0x55'),_0x257e('0x56'),_0x257e('0x57'),_0x257e('0x58'),_0x257e('0x59')]})[_0x257e('0x27')](handleEntityNotFound(_0x13f103,null))[_0x257e('0x27')](function(_0x2e71bb){if(_0x2e71bb){_0x3529d4=_0x2e71bb[_0x257e('0x54')];_0x568207=_0x2e71bb['accessKey'];_0x52bc48=_0x2e71bb[_0x257e('0x56')];_0x4a4714=_0x2e71bb[_0x257e('0x57')];var _0x57e606=_0x4a4714['slice'](-0x1);if(_0x57e606==='/'){_0x4a4714=_0x4a4714[_0x257e('0x5a')](0x0,_0x4a4714[_0x257e('0x5b')](_0x57e606));}_0x1592af=util['format'](_0x257e('0x5c'),_0x4a4714);var _0x14adbf={'method':_0x257e('0x5d'),'uri':_0x1592af,'qs':{'operation':_0x257e('0x5e'),'username':_0x2e71bb[_0x257e('0x54')]},'json':!![]};return rp(_0x14adbf);}})[_0x257e('0x27')](function(_0x12c299){if(_0x12c299[_0x257e('0x5f')]){var _0x2085b8={'method':_0x257e('0x60'),'uri':_0x1592af,'form':{'operation':'login','username':_0x3529d4,'accessKey':md5(_0x12c299[_0x257e('0x61')][_0x257e('0x62')]+_0x568207)},'json':!![]};return rp(_0x2085b8);}})['then'](function(_0x4604ff){if(_0x4604ff[_0x257e('0x5f')]){var _0x56074b={'method':_0x257e('0x5d'),'uri':_0x1592af,'qs':{'operation':'describe','username':_0x3529d4,'sessionName':_0x4604ff[_0x257e('0x61')][_0x257e('0x63')],'elementType':_0x52bc48},'json':!![]};return rp(_0x56074b);}})[_0x257e('0x27')](function(_0x28c44c){if(_0x28c44c[_0x257e('0x5f')]){var _0x5328b1=[_0x257e('0x64'),'reference',_0x257e('0x65')];_[_0x257e('0x66')](_0x28c44c[_0x257e('0x61')][_0x257e('0x34')],function(_0x34fefa){return _0x5328b1['includes'](_0x34fefa[_0x257e('0x2d')][_0x257e('0x29')]);});_[_0x257e('0x66')](_0x28c44c[_0x257e('0x61')][_0x257e('0x34')],function(_0x409026){return _0x409026[_0x257e('0x67')]===_0x257e('0x68');});return{'count':_0x28c44c[_0x257e('0x61')]['fields'][_0x257e('0x35')],'rows':_[_0x257e('0x2e')](_0x28c44c[_0x257e('0x61')][_0x257e('0x34')],function(_0x4bbd09){return{'id':_0x4bbd09['name'],'name':_0x4bbd09['label'],'custom':_[_0x257e('0x69')](_0x4bbd09['name'],_0x257e('0x6a'))?!![]:![],'options':_0x4bbd09['type']['name']===_0x257e('0x6b')&&_0x4bbd09['type'][_0x257e('0x6c')]['length']>0x0?_[_0x257e('0x2e')](_0x4bbd09[_0x257e('0x2d')][_0x257e('0x6c')],function(_0x51ff29){return{'name':_0x51ff29[_0x257e('0x6d')],'value':_0x51ff29[_0x257e('0x6e')]};}):[]};})};}})[_0x257e('0x27')](respondWithResult(_0x13f103,null))[_0x257e('0x41')](function(_0x5c9d40){console[_0x257e('0x6f')](_0x257e('0x70')+_0x5c9d40);var _0x520acc=_0x1b90c5[_0x257e('0x2f')][_0x257e('0x71')]?0x1f4:_0x5c9d40[_0x257e('0x72')]||0x1f4;logger['error'](_0x257e('0x73'),_0x257e('0x53'),_0x520acc,JSON['stringify'](_0x5c9d40));delete _0x5c9d40[_0x257e('0x29')];if(_0x520acc===0x191){_0x520acc=0x190;}_0x13f103[_0x257e('0x1b')](_0x520acc)[_0x257e('0x74')](_0x1b90c5[_0x257e('0x2f')][_0x257e('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x5c9d40[_0x257e('0x72')]}:_0x5c9d40);});}; \ No newline at end of file +var _0x8657=['moduleName','remoteUri','serverUrl','accessKey','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','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','undefined','count','offset','limit','set','reject','save','then','stack','name','index','map','VtigerAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','length','create','update','body','find','destroy','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description'];(function(_0x515f3b,_0x18f925){var _0x4e8fb7=function(_0x3b8faf){while(--_0x3b8faf){_0x515f3b['push'](_0x515f3b['shift']());}};_0x4e8fb7(++_0x18f925);}(_0x8657,0x109));var _0x7865=function(_0xcb5d56,_0x588452){_0xcb5d56=_0xcb5d56-0x0;var _0x492689=_0x8657[_0xcb5d56];return _0x492689;};'use strict';var emlformat=require(_0x7865('0x0'));var rimraf=require(_0x7865('0x1'));var zipdir=require(_0x7865('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7865('0x3'));var BPromise=require(_0x7865('0x4'));var Mustache=require(_0x7865('0x5'));var util=require(_0x7865('0x6'));var path=require(_0x7865('0x7'));var sox=require(_0x7865('0x8'));var csv=require(_0x7865('0x9'));var ejs=require(_0x7865('0xa'));var fs=require('fs');var fs_extra=require(_0x7865('0xb'));var _=require('lodash');var squel=require(_0x7865('0xc'));var crypto=require('crypto');var jsforce=require(_0x7865('0xd'));var deskjs=require(_0x7865('0xe'));var toCsv=require(_0x7865('0x9'));var querystring=require(_0x7865('0xf'));var Papa=require('papaparse');var Redis=require(_0x7865('0x10'));var authService=require(_0x7865('0x11'));var qs=require(_0x7865('0x12'));var as=require(_0x7865('0x13'));var hardwareService=require(_0x7865('0x14'));var logger=require(_0x7865('0x15'))(_0x7865('0x16'));var utils=require('../../config/utils');var config=require(_0x7865('0x17'));var licenseUtil=require(_0x7865('0x18'));var db=require(_0x7865('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x359d81,_0x28ec53){_0x28ec53=_0x28ec53||0xcc;return function(_0x59a5c4){if(_0x59a5c4){return _0x359d81[_0x7865('0x1a')](_0x28ec53);}return _0x359d81['status'](_0x28ec53)['end']();};}function respondWithResult(_0x249348,_0x2c1f48){_0x2c1f48=_0x2c1f48||0xc8;return function(_0x351c01){if(_0x351c01){return _0x249348[_0x7865('0x1b')](_0x2c1f48)[_0x7865('0x1c')](_0x351c01);}};}function respondWithFilteredResult(_0xaf6e0a,_0x12ea81){return function(_0x35263a){if(_0x35263a){var _0x4ba7b4=typeof _0x12ea81['offset']===_0x7865('0x1d')&&typeof _0x12ea81['limit']==='undefined';var _0xd0871d=_0x35263a['count'];var _0x5713f5=_0x4ba7b4?0x0:_0x12ea81['offset'];var _0x1a3ca7=_0x4ba7b4?_0x35263a[_0x7865('0x1e')]:_0x12ea81[_0x7865('0x1f')]+_0x12ea81[_0x7865('0x20')];var _0x41c18a;if(_0x1a3ca7>=_0xd0871d){_0x1a3ca7=_0xd0871d;_0x41c18a=0xc8;}else{_0x41c18a=0xce;}_0xaf6e0a[_0x7865('0x1b')](_0x41c18a);return _0xaf6e0a[_0x7865('0x21')]('Content-Range',_0x5713f5+'-'+_0x1a3ca7+'/'+_0xd0871d)[_0x7865('0x1c')](_0x35263a);}return null;};}function patchUpdates(_0x2d7034){return function(_0x819098){try{jsonpatch['apply'](_0x819098,_0x2d7034,!![]);}catch(_0x2e3825){return BPromise[_0x7865('0x22')](_0x2e3825);}return _0x819098[_0x7865('0x23')]();};}function saveUpdates(_0x374063,_0x2e8d84){return function(_0x393ed7){if(_0x393ed7){return _0x393ed7['update'](_0x374063)[_0x7865('0x24')](function(_0x26208d){return _0x26208d;});}return null;};}function removeEntity(_0x76c496,_0x113929){return function(_0x229483){if(_0x229483){return _0x229483['destroy']()['then'](function(){_0x76c496['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e697e,_0x66083e){return function(_0x8fbd49){if(!_0x8fbd49){_0x8e697e[_0x7865('0x1a')](0x194);}return _0x8fbd49;};}function handleError(_0x517c84,_0x3b53a1){_0x3b53a1=_0x3b53a1||0x1f4;return function(_0x36eb8f){logger['error'](_0x36eb8f[_0x7865('0x25')]);if(_0x36eb8f['name']){delete _0x36eb8f[_0x7865('0x26')];}_0x517c84[_0x7865('0x1b')](_0x3b53a1)['send'](_0x36eb8f);};}exports[_0x7865('0x27')]=function(_0x524a4b,_0xbdcf66){var _0x26ca50={},_0x2e2b74={},_0xa6d208={'count':0x0,'rows':[]};var _0x454047=_[_0x7865('0x28')](db[_0x7865('0x29')]['rawAttributes'],function(_0x182e55){return{'name':_0x182e55[_0x7865('0x2a')],'type':_0x182e55[_0x7865('0x2b')][_0x7865('0x2c')]};});_0x2e2b74['model']=_['map'](_0x454047,'name');_0x2e2b74[_0x7865('0x2d')]=_['keys'](_0x524a4b[_0x7865('0x2d')]);_0x2e2b74[_0x7865('0x2e')]=_[_0x7865('0x2f')](_0x2e2b74[_0x7865('0x30')],_0x2e2b74[_0x7865('0x2d')]);_0x26ca50[_0x7865('0x31')]=_[_0x7865('0x2f')](_0x2e2b74['model'],qs[_0x7865('0x32')](_0x524a4b[_0x7865('0x2d')][_0x7865('0x32')]));_0x26ca50[_0x7865('0x31')]=_0x26ca50[_0x7865('0x31')]['length']?_0x26ca50[_0x7865('0x31')]:_0x2e2b74[_0x7865('0x30')];if(!_0x524a4b[_0x7865('0x2d')][_0x7865('0x33')](_0x7865('0x34'))){_0x26ca50[_0x7865('0x20')]=qs[_0x7865('0x20')](_0x524a4b[_0x7865('0x2d')][_0x7865('0x20')]);_0x26ca50[_0x7865('0x1f')]=qs[_0x7865('0x1f')](_0x524a4b[_0x7865('0x2d')]['offset']);}_0x26ca50[_0x7865('0x35')]=qs[_0x7865('0x36')](_0x524a4b[_0x7865('0x2d')][_0x7865('0x36')]);_0x26ca50[_0x7865('0x37')]=qs['filters'](_['pick'](_0x524a4b[_0x7865('0x2d')],_0x2e2b74[_0x7865('0x2e')]),_0x454047);if(_0x524a4b[_0x7865('0x2d')][_0x7865('0x38')]){_0x26ca50['where']=_[_0x7865('0x39')](_0x26ca50[_0x7865('0x37')],{'$or':_['map'](_0x454047,function(_0x2545c2){if(_0x2545c2[_0x7865('0x2b')]!=='VIRTUAL'){var _0xdc12d7={};_0xdc12d7[_0x2545c2['name']]={'$like':'%'+_0x524a4b[_0x7865('0x2d')][_0x7865('0x38')]+'%'};return _0xdc12d7;}})});}_0x26ca50=_[_0x7865('0x39')]({},_0x26ca50,_0x524a4b[_0x7865('0x3a')]);var _0x553a61={'where':_0x26ca50[_0x7865('0x37')]};return db[_0x7865('0x29')][_0x7865('0x1e')](_0x553a61)[_0x7865('0x24')](function(_0x448946){_0xa6d208['count']=_0x448946;if(_0x524a4b['query'][_0x7865('0x3b')]){_0x26ca50[_0x7865('0x3c')]=[{'all':!![]}];}return db[_0x7865('0x29')]['findAll'](_0x26ca50);})['then'](function(_0x362987){_0xa6d208['rows']=_0x362987;return _0xa6d208;})['then'](respondWithFilteredResult(_0xbdcf66,_0x26ca50))[_0x7865('0x3d')](handleError(_0xbdcf66,null));};exports[_0x7865('0x3e')]=function(_0x2cb10f,_0x38ec96){var _0x1a61fa={'raw':![],'where':{'id':_0x2cb10f[_0x7865('0x3f')]['id']}},_0x4b6420={};_0x4b6420[_0x7865('0x30')]=_[_0x7865('0x40')](db['VtigerAccount'][_0x7865('0x41')]);_0x4b6420['query']=_[_0x7865('0x40')](_0x2cb10f[_0x7865('0x2d')]);_0x4b6420['filters']=_['intersection'](_0x4b6420[_0x7865('0x30')],_0x4b6420['query']);_0x1a61fa[_0x7865('0x31')]=_[_0x7865('0x2f')](_0x4b6420[_0x7865('0x30')],qs[_0x7865('0x32')](_0x2cb10f[_0x7865('0x2d')]['fields']));_0x1a61fa['attributes']=_0x1a61fa[_0x7865('0x31')][_0x7865('0x42')]?_0x1a61fa['attributes']:_0x4b6420[_0x7865('0x30')];if(_0x2cb10f[_0x7865('0x2d')]['includeAll']){_0x1a61fa[_0x7865('0x3c')]=[{'all':!![]}];}_0x1a61fa=_[_0x7865('0x39')]({},_0x1a61fa,_0x2cb10f[_0x7865('0x3a')]);return db['VtigerAccount']['find'](_0x1a61fa)[_0x7865('0x24')](handleEntityNotFound(_0x38ec96,null))[_0x7865('0x24')](respondWithResult(_0x38ec96,null))[_0x7865('0x3d')](handleError(_0x38ec96,null));};exports[_0x7865('0x43')]=function(_0x30c2d5,_0x2d8d65){return db['VtigerAccount'][_0x7865('0x43')](_0x30c2d5['body'],{})[_0x7865('0x24')](respondWithResult(_0x2d8d65,0xc9))[_0x7865('0x3d')](handleError(_0x2d8d65,null));};exports[_0x7865('0x44')]=function(_0x2e782a,_0x3ba1d7){if(_0x2e782a['body']['id']){delete _0x2e782a[_0x7865('0x45')]['id'];}return db[_0x7865('0x29')][_0x7865('0x46')]({'where':{'id':_0x2e782a[_0x7865('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ba1d7,null))['then'](saveUpdates(_0x2e782a[_0x7865('0x45')],null))[_0x7865('0x24')](respondWithResult(_0x3ba1d7,null))['catch'](handleError(_0x3ba1d7,null));};exports[_0x7865('0x47')]=function(_0x38c683,_0x5b5617){return db[_0x7865('0x29')][_0x7865('0x46')]({'where':{'id':_0x38c683[_0x7865('0x3f')]['id']}})[_0x7865('0x24')](handleEntityNotFound(_0x5b5617,null))[_0x7865('0x24')](removeEntity(_0x5b5617,null))[_0x7865('0x3d')](handleError(_0x5b5617,null));};exports[_0x7865('0x48')]=function(_0x4fee30,_0x1f0560,_0x773748){var _0x3851e5={};var _0x65853a={};var _0x6e4997;var _0x58c365;return db[_0x7865('0x29')][_0x7865('0x49')]({'where':{'id':_0x4fee30[_0x7865('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1f0560,null))[_0x7865('0x24')](function(_0xad5500){if(_0xad5500){_0x6e4997=_0xad5500;_0x65853a[_0x7865('0x30')]=_[_0x7865('0x40')](db[_0x7865('0x4a')][_0x7865('0x41')]);_0x65853a[_0x7865('0x2d')]=_[_0x7865('0x40')](_0x4fee30[_0x7865('0x2d')]);_0x65853a['filters']=_['intersection'](_0x65853a[_0x7865('0x30')],_0x65853a[_0x7865('0x2d')]);_0x3851e5['attributes']=_['intersection'](_0x65853a[_0x7865('0x30')],qs['fields'](_0x4fee30[_0x7865('0x2d')][_0x7865('0x32')]));_0x3851e5['attributes']=_0x3851e5[_0x7865('0x31')][_0x7865('0x42')]?_0x3851e5[_0x7865('0x31')]:_0x65853a[_0x7865('0x30')];_0x3851e5[_0x7865('0x35')]=qs['sort'](_0x4fee30['query'][_0x7865('0x36')]);_0x3851e5[_0x7865('0x37')]=qs[_0x7865('0x2e')](_[_0x7865('0x4b')](_0x4fee30[_0x7865('0x2d')],_0x65853a[_0x7865('0x2e')]));if(_0x4fee30['query'][_0x7865('0x38')]){_0x3851e5[_0x7865('0x37')]=_[_0x7865('0x39')](_0x3851e5[_0x7865('0x37')],{'$or':_[_0x7865('0x28')](_0x3851e5['attributes'],function(_0x2dcef6){var _0xe0b84b={};_0xe0b84b[_0x2dcef6]={'$like':'%'+_0x4fee30['query']['filter']+'%'};return _0xe0b84b;})});}_0x3851e5=_[_0x7865('0x39')]({},_0x3851e5,_0x4fee30[_0x7865('0x3a')]);return _0x6e4997['getConfigurations'](_0x3851e5);}})['then'](function(_0x5ec5ee){if(_0x5ec5ee){_0x58c365=_0x5ec5ee['length'];if(!_0x4fee30[_0x7865('0x2d')][_0x7865('0x33')](_0x7865('0x34'))){_0x3851e5[_0x7865('0x20')]=qs[_0x7865('0x20')](_0x4fee30[_0x7865('0x2d')][_0x7865('0x20')]);_0x3851e5[_0x7865('0x1f')]=qs['offset'](_0x4fee30['query'][_0x7865('0x1f')]);}return _0x6e4997['getConfigurations'](_0x3851e5);}})[_0x7865('0x24')](function(_0x424f08){if(_0x424f08){return _0x424f08?{'count':_0x58c365,'rows':_0x424f08}:null;}})[_0x7865('0x24')](respondWithResult(_0x1f0560,null))[_0x7865('0x3d')](handleError(_0x1f0560,null));};exports[_0x7865('0x4c')]=function(_0x3287b7,_0x11ec4c,_0x4c0602){if(_0x3287b7['body']['id']){delete _0x3287b7[_0x7865('0x45')]['id'];}return db[_0x7865('0x29')]['findOne']({'where':{'id':_0x3287b7[_0x7865('0x3f')]['id']}})[_0x7865('0x24')](handleEntityNotFound(_0x11ec4c,null))[_0x7865('0x24')](function(_0x4394ab){if(_0x4394ab){_0x3287b7[_0x7865('0x45')]['AccountId']=_0x4394ab['id'];_0x3287b7[_0x7865('0x45')][_0x7865('0x4d')]=integrations[_0x7865('0x4e')](_0x3287b7[_0x7865('0x45')][_0x7865('0x4f')],_0x3287b7[_0x7865('0x45')][_0x7865('0x2b')]);_0x3287b7[_0x7865('0x45')][_0x7865('0x50')]=integrations[_0x7865('0x51')](_0x3287b7[_0x7865('0x45')]['channel'],_0x3287b7[_0x7865('0x45')]['type']);return db[_0x7865('0x4a')]['create'](_0x3287b7['body'],{'include':[{'model':db[_0x7865('0x52')],'as':_0x7865('0x4d')},{'model':db[_0x7865('0x52')],'as':_0x7865('0x50')}]});}return null;})[_0x7865('0x24')](respondWithResult(_0x11ec4c,null))['catch'](handleError(_0x11ec4c,null));};var md5=require('md5');exports[_0x7865('0x53')]=function(_0x53cd69,_0x3ce997,_0x18dc53){var _0x2394b5=null;var _0x4409b7=null;var _0x455e77=null;var _0x57b2f7=null;var _0x2d7dd2='';return db['VtigerAccount'][_0x7865('0x49')]({'where':{'id':_0x53cd69[_0x7865('0x3f')]['id']},'attributes':['id','name',_0x7865('0x54'),_0x7865('0x55'),_0x7865('0x56'),_0x7865('0x57'),_0x7865('0x58'),_0x7865('0x59')]})[_0x7865('0x24')](handleEntityNotFound(_0x3ce997,null))[_0x7865('0x24')](function(_0x5f2425){if(_0x5f2425){_0x2394b5=_0x5f2425['username'];_0x4409b7=_0x5f2425[_0x7865('0x59')];_0x455e77=_0x5f2425['moduleName'];_0x2d7dd2=_0x5f2425[_0x7865('0x57')];var _0x5b72b1=_0x2d7dd2['slice'](-0x1);if(_0x5b72b1==='/'){_0x2d7dd2=_0x2d7dd2['substring'](0x0,_0x2d7dd2['lastIndexOf'](_0x5b72b1));}_0x57b2f7=util['format'](_0x7865('0x5a'),_0x2d7dd2);var _0x899722={'method':_0x7865('0x5b'),'uri':_0x57b2f7,'qs':{'operation':_0x7865('0x5c'),'username':_0x5f2425[_0x7865('0x54')]},'json':!![]};return rp(_0x899722);}})[_0x7865('0x24')](function(_0x43f824){if(_0x43f824[_0x7865('0x5d')]){var _0x49a67c={'method':_0x7865('0x5e'),'uri':_0x57b2f7,'form':{'operation':_0x7865('0x5f'),'username':_0x2394b5,'accessKey':md5(_0x43f824[_0x7865('0x60')][_0x7865('0x61')]+_0x4409b7)},'json':!![]};return rp(_0x49a67c);}})[_0x7865('0x24')](function(_0x4bf81f){if(_0x4bf81f[_0x7865('0x5d')]){var _0x138999={'method':_0x7865('0x5b'),'uri':_0x57b2f7,'qs':{'operation':'describe','username':_0x2394b5,'sessionName':_0x4bf81f[_0x7865('0x60')][_0x7865('0x62')],'elementType':_0x455e77},'json':!![]};return rp(_0x138999);}})[_0x7865('0x24')](function(_0x26e51c){if(_0x26e51c[_0x7865('0x5d')]){var _0x49be6d=['autogenerated',_0x7865('0x63'),_0x7865('0x64')];_[_0x7865('0x65')](_0x26e51c['result'][_0x7865('0x32')],function(_0x1aebe9){return _0x49be6d[_0x7865('0x66')](_0x1aebe9[_0x7865('0x2b')]['name']);});_[_0x7865('0x65')](_0x26e51c[_0x7865('0x60')][_0x7865('0x32')],function(_0x57793b){return _0x57793b[_0x7865('0x67')]===_0x7865('0x68');});return{'count':_0x26e51c[_0x7865('0x60')]['fields']['length'],'rows':_[_0x7865('0x28')](_0x26e51c['result'][_0x7865('0x32')],function(_0x1baff7){return{'id':_0x1baff7[_0x7865('0x26')],'name':_0x1baff7[_0x7865('0x69')],'custom':_[_0x7865('0x6a')](_0x1baff7['name'],_0x7865('0x6b'))?!![]:![],'options':_0x1baff7[_0x7865('0x2b')][_0x7865('0x26')]===_0x7865('0x6c')&&_0x1baff7[_0x7865('0x2b')][_0x7865('0x6d')]['length']>0x0?_[_0x7865('0x28')](_0x1baff7['type'][_0x7865('0x6d')],function(_0x3cb1ec){return{'name':_0x3cb1ec[_0x7865('0x69')],'value':_0x3cb1ec[_0x7865('0x6e')]};}):[]};})};}})[_0x7865('0x24')](respondWithResult(_0x3ce997,null))[_0x7865('0x3d')](function(_0x224aac){console['log'](_0x7865('0x6f')+_0x224aac);var _0x2555c7=_0x53cd69[_0x7865('0x2d')][_0x7865('0x70')]?0x1f4:_0x224aac[_0x7865('0x71')]||0x1f4;logger[_0x7865('0x72')](_0x7865('0x73'),'getFields',_0x2555c7,JSON['stringify'](_0x224aac));delete _0x224aac['name'];if(_0x2555c7===0x191){_0x2555c7=0x190;}_0x3ce997[_0x7865('0x1b')](_0x2555c7)['send'](_0x53cd69['query'][_0x7865('0x70')]?{'message':_0x7865('0x74'),'statusCode':_0x224aac[_0x7865('0x71')]}:_0x224aac);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 65ce14c..b429f48 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 _0xebb4=['VtigerAccount','lodash','util','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x5428e7,_0x3eff50){var _0x5a1f84=function(_0x4d2672){while(--_0x4d2672){_0x5428e7['push'](_0x5428e7['shift']());}};_0x5a1f84(++_0x3eff50);}(_0xebb4,0xbc));var _0x4ebb=function(_0x54b09a,_0x879c92){_0x54b09a=_0x54b09a-0x0;var _0x1f51e1=_0xebb4[_0x54b09a];return _0x1f51e1;};'use strict';var _=require(_0x4ebb('0x0'));var util=require(_0x4ebb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ebb('0x2'));var BPromise=require(_0x4ebb('0x3'));var rp=require(_0x4ebb('0x4'));var fs=require('fs');var path=require(_0x4ebb('0x5'));var rimraf=require('rimraf');var config=require(_0x4ebb('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4ebb('0x7'));module[_0x4ebb('0x8')]=function(_0x6ff6ab,_0x2a7085){return _0x6ff6ab[_0x4ebb('0x9')](_0x4ebb('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd139=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','lodash','util'];(function(_0x1e1a73,_0x1245bb){var _0x1b9a10=function(_0x505957){while(--_0x505957){_0x1e1a73['push'](_0x1e1a73['shift']());}};_0x1b9a10(++_0x1245bb);}(_0xd139,0x115));var _0x9d13=function(_0x36326f,_0x31134b){_0x36326f=_0x36326f-0x0;var _0x2f6def=_0xd139[_0x36326f];return _0x2f6def;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require(_0x9d13('0x2'))(_0x9d13('0x3'));var moment=require('moment');var BPromise=require(_0x9d13('0x4'));var rp=require(_0x9d13('0x5'));var fs=require('fs');var path=require(_0x9d13('0x6'));var rimraf=require(_0x9d13('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9d13('0x8')]=function(_0x5be9f8,_0x477bb5){return _0x5be9f8['define']('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 04093c7..1182b53 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 _0x7af2=['ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw'];(function(_0x3016e6,_0x510a37){var _0x3ed495=function(_0x2dd601){while(--_0x2dd601){_0x3016e6['push'](_0x3016e6['shift']());}};_0x3ed495(++_0x510a37);}(_0x7af2,0x119));var _0x27af=function(_0x5790ab,_0xa4f493){_0x5790ab=_0x5790ab-0x0;var _0xcbbef1=_0x7af2[_0x5790ab];return _0xcbbef1;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});}exports[_0x27af('0x14')]=function(_0x31d702){var _0x5997ae=this;return new Promise(function(_0x4e6e2f,_0x20a6d7){return db[_0x27af('0x15')][_0x27af('0x16')]({'raw':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x18')]||null:null,'attributes':_0x31d702['options']?_0x31d702[_0x27af('0x17')][_0x27af('0x19')]||null:null,'limit':_0x31d702[_0x27af('0x17')]?_0x31d702['options'][_0x27af('0x1a')]||null:null,'include':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x31d702[_0x27af('0x17')][_0x27af('0x1b')],function(_0x35b36d){return{'model':db[_0x35b36d[_0x27af('0x1d')]],'as':_0x35b36d['as'],'attributes':_0x35b36d['attributes'],'include':_0x35b36d['include']?_['map'](_0x35b36d[_0x27af('0x1b')],function(_0x4feaf1){return{'model':db[_0x4feaf1[_0x27af('0x1d')]],'as':_0x4feaf1['as'],'attributes':_0x4feaf1[_0x27af('0x19')],'include':_0x4feaf1['include']?_[_0x27af('0x1c')](_0x4feaf1[_0x27af('0x1b')],function(_0x463e36){return{'model':db[_0x463e36[_0x27af('0x1d')]],'as':_0x463e36['as'],'attributes':_0x463e36[_0x27af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x775d4e){logger['info'](_0x27af('0x14'),_0x31d702);logger[_0x27af('0x1e')](_0x27af('0x14'),_0x31d702,JSON[_0x27af('0x1f')](_0x775d4e));_0x4e6e2f(_0x775d4e);})[_0x27af('0x13')](function(_0xa08dd9){logger[_0x27af('0xf')](_0x27af('0x14'),_0xa08dd9[_0x27af('0x10')],_0x31d702);_0x20a6d7(_0x5997ae[_0x27af('0xf')](0x1f4,_0xa08dd9[_0x27af('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x15e867){var _0x14b2e7=this;return new Promise(function(_0x3800a1,_0x575887){return db[_0x27af('0x15')][_0x27af('0x20')]({'raw':_0x15e867['options']?_0x15e867['options'][_0x27af('0x21')]===undefined?!![]:![]:!![],'where':_0x15e867[_0x27af('0x17')]?_0x15e867['options'][_0x27af('0x18')]||null:null,'attributes':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x19')]||null:null,'include':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x15e867[_0x27af('0x17')][_0x27af('0x1b')],function(_0x13c97d){return{'model':db[_0x13c97d['model']],'as':_0x13c97d['as'],'attributes':_0x13c97d['attributes'],'include':_0x13c97d[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x13c97d['include'],function(_0x2dd799){return{'model':db[_0x2dd799[_0x27af('0x1d')]],'as':_0x2dd799['as'],'attributes':_0x2dd799['attributes'],'include':_0x2dd799[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x2dd799[_0x27af('0x1b')],function(_0x329d06){return{'model':db[_0x329d06[_0x27af('0x1d')]],'as':_0x329d06['as'],'attributes':_0x329d06['attributes']};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x468cea){logger['info']('ShowVtigerAccount',_0x15e867);logger[_0x27af('0x1e')](_0x27af('0x22'),_0x15e867,JSON[_0x27af('0x1f')](_0x468cea));_0x3800a1(_0x468cea);})[_0x27af('0x13')](function(_0x467891){logger[_0x27af('0xf')]('ShowVtigerAccount',_0x467891[_0x27af('0x10')],_0x15e867);_0x575887(_0x14b2e7['error'](0x1f4,_0x467891[_0x27af('0x10')]));});});}; \ No newline at end of file +var _0x7af2=['ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw'];(function(_0x20604c,_0x2434f7){var _0x7907=function(_0xbfb06){while(--_0xbfb06){_0x20604c['push'](_0x20604c['shift']());}};_0x7907(++_0x2434f7);}(_0x7af2,0x119));var _0x27af=function(_0x4e5cfc,_0x4ed9c7){_0x4e5cfc=_0x4e5cfc-0x0;var _0x502c40=_0x7af2[_0x4e5cfc];return _0x502c40;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});}exports[_0x27af('0x14')]=function(_0x31d702){var _0x5997ae=this;return new Promise(function(_0x4e6e2f,_0x20a6d7){return db[_0x27af('0x15')][_0x27af('0x16')]({'raw':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x18')]||null:null,'attributes':_0x31d702['options']?_0x31d702[_0x27af('0x17')][_0x27af('0x19')]||null:null,'limit':_0x31d702[_0x27af('0x17')]?_0x31d702['options'][_0x27af('0x1a')]||null:null,'include':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x31d702[_0x27af('0x17')][_0x27af('0x1b')],function(_0x35b36d){return{'model':db[_0x35b36d[_0x27af('0x1d')]],'as':_0x35b36d['as'],'attributes':_0x35b36d['attributes'],'include':_0x35b36d['include']?_['map'](_0x35b36d[_0x27af('0x1b')],function(_0x4feaf1){return{'model':db[_0x4feaf1[_0x27af('0x1d')]],'as':_0x4feaf1['as'],'attributes':_0x4feaf1[_0x27af('0x19')],'include':_0x4feaf1['include']?_[_0x27af('0x1c')](_0x4feaf1[_0x27af('0x1b')],function(_0x463e36){return{'model':db[_0x463e36[_0x27af('0x1d')]],'as':_0x463e36['as'],'attributes':_0x463e36[_0x27af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x775d4e){logger['info'](_0x27af('0x14'),_0x31d702);logger[_0x27af('0x1e')](_0x27af('0x14'),_0x31d702,JSON[_0x27af('0x1f')](_0x775d4e));_0x4e6e2f(_0x775d4e);})[_0x27af('0x13')](function(_0xa08dd9){logger[_0x27af('0xf')](_0x27af('0x14'),_0xa08dd9[_0x27af('0x10')],_0x31d702);_0x20a6d7(_0x5997ae[_0x27af('0xf')](0x1f4,_0xa08dd9[_0x27af('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x15e867){var _0x14b2e7=this;return new Promise(function(_0x3800a1,_0x575887){return db[_0x27af('0x15')][_0x27af('0x20')]({'raw':_0x15e867['options']?_0x15e867['options'][_0x27af('0x21')]===undefined?!![]:![]:!![],'where':_0x15e867[_0x27af('0x17')]?_0x15e867['options'][_0x27af('0x18')]||null:null,'attributes':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x19')]||null:null,'include':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x15e867[_0x27af('0x17')][_0x27af('0x1b')],function(_0x13c97d){return{'model':db[_0x13c97d['model']],'as':_0x13c97d['as'],'attributes':_0x13c97d['attributes'],'include':_0x13c97d[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x13c97d['include'],function(_0x2dd799){return{'model':db[_0x2dd799[_0x27af('0x1d')]],'as':_0x2dd799['as'],'attributes':_0x2dd799['attributes'],'include':_0x2dd799[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x2dd799[_0x27af('0x1b')],function(_0x329d06){return{'model':db[_0x329d06[_0x27af('0x1d')]],'as':_0x329d06['as'],'attributes':_0x329d06['attributes']};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x468cea){logger['info']('ShowVtigerAccount',_0x15e867);logger[_0x27af('0x1e')](_0x27af('0x22'),_0x15e867,JSON[_0x27af('0x1f')](_0x468cea));_0x3800a1(_0x468cea);})[_0x27af('0x13')](function(_0x467891){logger[_0x27af('0xf')]('ShowVtigerAccount',_0x467891[_0x27af('0x10')],_0x15e867);_0x575887(_0x14b2e7['error'](0x1f4,_0x467891[_0x27af('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a92d4b1..b93e1d5 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 _0xda2a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','post','create','update','delete','util','connect-timeout'];(function(_0x2e9159,_0x4eb135){var _0x170397=function(_0x14b894){while(--_0x14b894){_0x2e9159['push'](_0x2e9159['shift']());}};_0x170397(++_0x4eb135);}(_0xda2a,0xbc));var _0xada2=function(_0x1481a6,_0x343188){_0x1481a6=_0x1481a6-0x0;var _0x19d906=_0xda2a[_0x1481a6];return _0x19d906;};'use strict';var multer=require('multer');var util=require(_0xada2('0x0'));var path=require('path');var timeout=require(_0xada2('0x1'));var express=require(_0xada2('0x2'));var router=express[_0xada2('0x3')]();var fs_extra=require(_0xada2('0x4'));var auth=require(_0xada2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xada2('0x6'));var controller=require(_0xada2('0x7'));router[_0xada2('0x8')]('/',auth[_0xada2('0x9')](),controller[_0xada2('0xa')]);router[_0xada2('0x8')](_0xada2('0xb'),auth[_0xada2('0x9')](),controller[_0xada2('0xc')]);router['get']('/:id/fields',auth[_0xada2('0x9')](),controller[_0xada2('0xd')]);router[_0xada2('0x8')](_0xada2('0xe'),auth[_0xada2('0x9')](),controller['getSubjects']);router[_0xada2('0x8')]('/:id/descriptions',auth[_0xada2('0x9')](),controller['getDescriptions']);router[_0xada2('0xf')]('/',auth[_0xada2('0x9')](),controller[_0xada2('0x10')]);router['put'](_0xada2('0xb'),auth[_0xada2('0x9')](),controller[_0xada2('0x11')]);router[_0xada2('0x12')](_0xada2('0xb'),auth[_0xada2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa31c=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','create','put','/:id','update','delete'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa31c,0x1cd));var _0xca31=function(_0x3ad5e8,_0x49cd96){_0x3ad5e8=_0x3ad5e8-0x0;var _0xdd51a4=_0xa31c[_0x3ad5e8];return _0xdd51a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca31('0x0'));var timeout=require(_0xca31('0x1'));var express=require(_0xca31('0x2'));var router=express[_0xca31('0x3')]();var fs_extra=require(_0xca31('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xca31('0x5'));var config=require('../../config/environment');var controller=require(_0xca31('0x6'));router[_0xca31('0x7')]('/',auth[_0xca31('0x8')](),controller[_0xca31('0x9')]);router[_0xca31('0x7')]('/:id',auth[_0xca31('0x8')](),controller[_0xca31('0xa')]);router[_0xca31('0x7')](_0xca31('0xb'),auth['isAuthenticated'](),controller[_0xca31('0xc')]);router[_0xca31('0x7')]('/:id/subjects',auth[_0xca31('0x8')](),controller[_0xca31('0xd')]);router[_0xca31('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xca31('0x8')](),controller[_0xca31('0xe')]);router[_0xca31('0xf')](_0xca31('0x10'),auth[_0xca31('0x8')](),controller[_0xca31('0x11')]);router[_0xca31('0x12')](_0xca31('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xca31('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index fa1abc1..7d3b585 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 _0xb31b=['STRING','sequelize','exports'];(function(_0x293714,_0x26114a){var _0x34e96a=function(_0x23e4e5){while(--_0x23e4e5){_0x293714['push'](_0x293714['shift']());}};_0x34e96a(++_0x26114a);}(_0xb31b,0x1ae));var _0xbb31=function(_0x15d688,_0x429f18){_0x15d688=_0x15d688-0x0;var _0xc89a7f=_0xb31b[_0x15d688];return _0xc89a7f;};'use strict';var Sequelize=require(_0xbb31('0x0'));module[_0xbb31('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb31('0x2')]}}; \ No newline at end of file +var _0x4bf1=['sequelize','STRING'];(function(_0x139f50,_0x18b9cf){var _0xb5efa9=function(_0x5e097e){while(--_0x5e097e){_0x139f50['push'](_0x139f50['shift']());}};_0xb5efa9(++_0x18b9cf);}(_0x4bf1,0x94));var _0x14bf=function(_0x5e7a73,_0x3f12a8){_0x5e7a73=_0x5e7a73-0x0;var _0x3b3c2c=_0x4bf1[_0x5e7a73];return _0x3b3c2c;};'use strict';var Sequelize=require(_0x14bf('0x0'));module['exports']={'name':{'type':Sequelize[_0x14bf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d837208..fa7f5be 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 _0xe10c=['show','params','rawAttributes','keys','include','find','create','body','findOne','VtigerField','filter','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerConfiguration','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','merge','options','includeAll','rows','catch'];(function(_0x43be76,_0x202d2b){var _0x48d920=function(_0xda865d){while(--_0xda865d){_0x43be76['push'](_0x43be76['shift']());}};_0x48d920(++_0x202d2b);}(_0xe10c,0x153));var _0xce10=function(_0x22d67e,_0x4d46e6){_0x22d67e=_0x22d67e-0x0;var _0x2300b2=_0xe10c[_0x22d67e];return _0x2300b2;};'use strict';var emlformat=require(_0xce10('0x0'));var rimraf=require(_0xce10('0x1'));var zipdir=require(_0xce10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce10('0x3'));var moment=require('moment');var BPromise=require(_0xce10('0x4'));var Mustache=require(_0xce10('0x5'));var util=require(_0xce10('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xce10('0x7'));var ejs=require(_0xce10('0x8'));var fs=require('fs');var fs_extra=require(_0xce10('0x9'));var _=require(_0xce10('0xa'));var squel=require('squel');var crypto=require(_0xce10('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce10('0xc'));var toCsv=require(_0xce10('0x7'));var querystring=require('querystring');var Papa=require(_0xce10('0xd'));var Redis=require('ioredis');var authService=require(_0xce10('0xe'));var qs=require(_0xce10('0xf'));var as=require(_0xce10('0x10'));var hardwareService=require(_0xce10('0x11'));var logger=require(_0xce10('0x12'))(_0xce10('0x13'));var utils=require(_0xce10('0x14'));var config=require(_0xce10('0x15'));var licenseUtil=require(_0xce10('0x16'));var db=require(_0xce10('0x17'))['db'];function respondWithStatusCode(_0x28470b,_0x234382){_0x234382=_0x234382||0xcc;return function(_0x554516){if(_0x554516){return _0x28470b['sendStatus'](_0x234382);}return _0x28470b[_0xce10('0x18')](_0x234382)[_0xce10('0x19')]();};}function respondWithResult(_0x57a532,_0x17be1f){_0x17be1f=_0x17be1f||0xc8;return function(_0x202466){if(_0x202466){return _0x57a532[_0xce10('0x18')](_0x17be1f)[_0xce10('0x1a')](_0x202466);}};}function respondWithFilteredResult(_0x17431a,_0x5db07c){return function(_0x152276){if(_0x152276){var _0x16b7e5=typeof _0x5db07c[_0xce10('0x1b')]===_0xce10('0x1c')&&typeof _0x5db07c[_0xce10('0x1d')]===_0xce10('0x1c');var _0xd73a39=_0x152276[_0xce10('0x1e')];var _0x531cc5=_0x16b7e5?0x0:_0x5db07c[_0xce10('0x1b')];var _0x322e70=_0x16b7e5?_0x152276[_0xce10('0x1e')]:_0x5db07c[_0xce10('0x1b')]+_0x5db07c[_0xce10('0x1d')];var _0x81b75b;if(_0x322e70>=_0xd73a39){_0x322e70=_0xd73a39;_0x81b75b=0xc8;}else{_0x81b75b=0xce;}_0x17431a['status'](_0x81b75b);return _0x17431a[_0xce10('0x1f')](_0xce10('0x20'),_0x531cc5+'-'+_0x322e70+'/'+_0xd73a39)[_0xce10('0x1a')](_0x152276);}return null;};}function patchUpdates(_0x51ef63){return function(_0x2e9182){try{jsonpatch[_0xce10('0x21')](_0x2e9182,_0x51ef63,!![]);}catch(_0x1e8510){return BPromise[_0xce10('0x22')](_0x1e8510);}return _0x2e9182[_0xce10('0x23')]();};}function saveUpdates(_0x3776a2,_0x4552d6){return function(_0x4ed34a){if(_0x4ed34a){return _0x4ed34a[_0xce10('0x24')](_0x3776a2)[_0xce10('0x25')](function(_0x316a6b){return _0x316a6b;});}return null;};}function removeEntity(_0x1ea10d,_0x3f7344){return function(_0x5befd6){if(_0x5befd6){return _0x5befd6[_0xce10('0x26')]()['then'](function(){_0x1ea10d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b9de,_0x104683){return function(_0x428f08){if(!_0x428f08){_0x51b9de[_0xce10('0x27')](0x194);}return _0x428f08;};}function handleError(_0x331641,_0x1d363a){_0x1d363a=_0x1d363a||0x1f4;return function(_0x5a928f){logger[_0xce10('0x28')](_0x5a928f[_0xce10('0x29')]);if(_0x5a928f[_0xce10('0x2a')]){delete _0x5a928f[_0xce10('0x2a')];}_0x331641['status'](_0x1d363a)[_0xce10('0x2b')](_0x5a928f);};}exports[_0xce10('0x2c')]=function(_0x3c1e2e,_0x4ed4a5){var _0x334c29={},_0x2b222d={},_0x1e6129={'count':0x0,'rows':[]};var _0x3f3c5b=_['map'](db[_0xce10('0x2d')]['rawAttributes'],function(_0x50d764){return{'name':_0x50d764[_0xce10('0x2e')],'type':_0x50d764['type'][_0xce10('0x2f')]};});_0x2b222d['model']=_[_0xce10('0x30')](_0x3f3c5b,'name');_0x2b222d[_0xce10('0x31')]=_['keys'](_0x3c1e2e[_0xce10('0x31')]);_0x2b222d[_0xce10('0x32')]=_[_0xce10('0x33')](_0x2b222d[_0xce10('0x34')],_0x2b222d[_0xce10('0x31')]);_0x334c29['attributes']=_['intersection'](_0x2b222d[_0xce10('0x34')],qs[_0xce10('0x35')](_0x3c1e2e[_0xce10('0x31')]['fields']));_0x334c29[_0xce10('0x36')]=_0x334c29['attributes'][_0xce10('0x37')]?_0x334c29[_0xce10('0x36')]:_0x2b222d[_0xce10('0x34')];if(!_0x3c1e2e[_0xce10('0x31')]['hasOwnProperty'](_0xce10('0x38'))){_0x334c29[_0xce10('0x1d')]=qs[_0xce10('0x1d')](_0x3c1e2e[_0xce10('0x31')][_0xce10('0x1d')]);_0x334c29[_0xce10('0x1b')]=qs[_0xce10('0x1b')](_0x3c1e2e[_0xce10('0x31')]['offset']);}_0x334c29[_0xce10('0x39')]=qs[_0xce10('0x3a')](_0x3c1e2e[_0xce10('0x31')][_0xce10('0x3a')]);_0x334c29['where']=qs[_0xce10('0x32')](_[_0xce10('0x3b')](_0x3c1e2e[_0xce10('0x31')],_0x2b222d['filters']),_0x3f3c5b);if(_0x3c1e2e[_0xce10('0x31')]['filter']){_0x334c29[_0xce10('0x3c')]=_[_0xce10('0x3d')](_0x334c29[_0xce10('0x3c')],{'$or':_[_0xce10('0x30')](_0x3f3c5b,function(_0x4f727a){if(_0x4f727a['type']!=='VIRTUAL'){var _0x375a77={};_0x375a77[_0x4f727a['name']]={'$like':'%'+_0x3c1e2e['query']['filter']+'%'};return _0x375a77;}})});}_0x334c29=_['merge']({},_0x334c29,_0x3c1e2e[_0xce10('0x3e')]);var _0x5089e5={'where':_0x334c29[_0xce10('0x3c')]};return db[_0xce10('0x2d')][_0xce10('0x1e')](_0x5089e5)[_0xce10('0x25')](function(_0x5cc92c){_0x1e6129[_0xce10('0x1e')]=_0x5cc92c;if(_0x3c1e2e['query'][_0xce10('0x3f')]){_0x334c29['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x334c29);})['then'](function(_0x6ff695){_0x1e6129[_0xce10('0x40')]=_0x6ff695;return _0x1e6129;})[_0xce10('0x25')](respondWithFilteredResult(_0x4ed4a5,_0x334c29))[_0xce10('0x41')](handleError(_0x4ed4a5,null));};exports[_0xce10('0x42')]=function(_0x5bb200,_0x69adbc){var _0xec06f1={'raw':![],'where':{'id':_0x5bb200[_0xce10('0x43')]['id']}},_0x5436e4={};_0x5436e4['model']=_['keys'](db[_0xce10('0x2d')][_0xce10('0x44')]);_0x5436e4['query']=_[_0xce10('0x45')](_0x5bb200[_0xce10('0x31')]);_0x5436e4[_0xce10('0x32')]=_[_0xce10('0x33')](_0x5436e4['model'],_0x5436e4[_0xce10('0x31')]);_0xec06f1[_0xce10('0x36')]=_[_0xce10('0x33')](_0x5436e4[_0xce10('0x34')],qs[_0xce10('0x35')](_0x5bb200[_0xce10('0x31')][_0xce10('0x35')]));_0xec06f1[_0xce10('0x36')]=_0xec06f1['attributes'][_0xce10('0x37')]?_0xec06f1['attributes']:_0x5436e4[_0xce10('0x34')];if(_0x5bb200['query'][_0xce10('0x3f')]){_0xec06f1[_0xce10('0x46')]=[{'all':!![]}];}_0xec06f1=_['merge']({},_0xec06f1,_0x5bb200[_0xce10('0x3e')]);return db[_0xce10('0x2d')][_0xce10('0x47')](_0xec06f1)['then'](handleEntityNotFound(_0x69adbc,null))[_0xce10('0x25')](respondWithResult(_0x69adbc,null))[_0xce10('0x41')](handleError(_0x69adbc,null));};exports[_0xce10('0x48')]=function(_0x49f1d9,_0x49478c){return db[_0xce10('0x2d')]['create'](_0x49f1d9[_0xce10('0x49')],{})[_0xce10('0x25')](respondWithResult(_0x49478c,0xc9))[_0xce10('0x41')](handleError(_0x49478c,null));};exports[_0xce10('0x24')]=function(_0x31c09a,_0x31da65){if(_0x31c09a[_0xce10('0x49')]['id']){delete _0x31c09a['body']['id'];}return db[_0xce10('0x2d')]['find']({'where':{'id':_0x31c09a['params']['id']}})['then'](handleEntityNotFound(_0x31da65,null))[_0xce10('0x25')](saveUpdates(_0x31c09a[_0xce10('0x49')],null))[_0xce10('0x25')](respondWithResult(_0x31da65,null))['catch'](handleError(_0x31da65,null));};exports[_0xce10('0x26')]=function(_0x38892b,_0x347c91){return db[_0xce10('0x2d')][_0xce10('0x47')]({'where':{'id':_0x38892b[_0xce10('0x43')]['id']}})['then'](handleEntityNotFound(_0x347c91,null))[_0xce10('0x25')](removeEntity(_0x347c91,null))[_0xce10('0x41')](handleError(_0x347c91,null));};exports['getFields']=function(_0x38a127,_0x36485f,_0x117638){var _0x2d9041={};var _0x30f74d={};var _0x39ee78;var _0x3170fd;return db[_0xce10('0x2d')][_0xce10('0x4a')]({'where':{'id':_0x38a127['params']['id']}})[_0xce10('0x25')](handleEntityNotFound(_0x36485f,null))['then'](function(_0x5b25e9){if(_0x5b25e9){_0x39ee78=_0x5b25e9;_0x30f74d[_0xce10('0x34')]=_[_0xce10('0x45')](db[_0xce10('0x4b')][_0xce10('0x44')]);_0x30f74d[_0xce10('0x31')]=_['keys'](_0x38a127[_0xce10('0x31')]);_0x30f74d[_0xce10('0x32')]=_[_0xce10('0x33')](_0x30f74d[_0xce10('0x34')],_0x30f74d[_0xce10('0x31')]);_0x2d9041['attributes']=_[_0xce10('0x33')](_0x30f74d['model'],qs[_0xce10('0x35')](_0x38a127['query']['fields']));_0x2d9041[_0xce10('0x36')]=_0x2d9041[_0xce10('0x36')][_0xce10('0x37')]?_0x2d9041['attributes']:_0x30f74d[_0xce10('0x34')];_0x2d9041[_0xce10('0x39')]=qs[_0xce10('0x3a')](_0x38a127[_0xce10('0x31')][_0xce10('0x3a')]);_0x2d9041['where']=qs[_0xce10('0x32')](_['pick'](_0x38a127[_0xce10('0x31')],_0x30f74d['filters']));if(_0x38a127[_0xce10('0x31')][_0xce10('0x4c')]){_0x2d9041[_0xce10('0x3c')]=_['merge'](_0x2d9041[_0xce10('0x3c')],{'$or':_[_0xce10('0x30')](_0x2d9041[_0xce10('0x36')],function(_0x6f5764){var _0x2520cc={};_0x2520cc[_0x6f5764]={'$like':'%'+_0x38a127[_0xce10('0x31')][_0xce10('0x4c')]+'%'};return _0x2520cc;})});}_0x2d9041=_['merge']({},_0x2d9041,_0x38a127[_0xce10('0x3e')]);return _0x39ee78[_0xce10('0x4d')](_0x2d9041);}})[_0xce10('0x25')](function(_0x266e87){if(_0x266e87){_0x3170fd=_0x266e87[_0xce10('0x37')];if(!_0x38a127[_0xce10('0x31')][_0xce10('0x4e')](_0xce10('0x38'))){_0x2d9041[_0xce10('0x1d')]=qs[_0xce10('0x1d')](_0x38a127['query'][_0xce10('0x1d')]);_0x2d9041[_0xce10('0x1b')]=qs[_0xce10('0x1b')](_0x38a127[_0xce10('0x31')][_0xce10('0x1b')]);}return _0x39ee78[_0xce10('0x4d')](_0x2d9041);}})[_0xce10('0x25')](function(_0xd76089){if(_0xd76089){return _0xd76089?{'count':_0x3170fd,'rows':_0xd76089}:null;}})['then'](respondWithResult(_0x36485f,null))[_0xce10('0x41')](handleError(_0x36485f,null));};exports[_0xce10('0x4f')]=function(_0x5163c7,_0x11e783,_0x39ab95){var _0x54c682={};var _0x4c6b4d={};var _0x590223;var _0x4bab13;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5163c7[_0xce10('0x43')]['id']}})[_0xce10('0x25')](handleEntityNotFound(_0x11e783,null))[_0xce10('0x25')](function(_0x28e688){if(_0x28e688){_0x590223=_0x28e688;_0x4c6b4d[_0xce10('0x34')]=_[_0xce10('0x45')](db[_0xce10('0x4b')][_0xce10('0x44')]);_0x4c6b4d['query']=_[_0xce10('0x45')](_0x5163c7[_0xce10('0x31')]);_0x4c6b4d[_0xce10('0x32')]=_['intersection'](_0x4c6b4d[_0xce10('0x34')],_0x4c6b4d[_0xce10('0x31')]);_0x54c682[_0xce10('0x36')]=_[_0xce10('0x33')](_0x4c6b4d[_0xce10('0x34')],qs[_0xce10('0x35')](_0x5163c7[_0xce10('0x31')][_0xce10('0x35')]));_0x54c682[_0xce10('0x36')]=_0x54c682[_0xce10('0x36')]['length']?_0x54c682['attributes']:_0x4c6b4d['model'];_0x54c682[_0xce10('0x39')]=qs['sort'](_0x5163c7['query'][_0xce10('0x3a')]);_0x54c682['where']=qs[_0xce10('0x32')](_[_0xce10('0x3b')](_0x5163c7['query'],_0x4c6b4d[_0xce10('0x32')]));if(_0x5163c7['query'][_0xce10('0x4c')]){_0x54c682[_0xce10('0x3c')]=_[_0xce10('0x3d')](_0x54c682[_0xce10('0x3c')],{'$or':_[_0xce10('0x30')](_0x54c682['attributes'],function(_0x44f8a0){var _0x3dff29={};_0x3dff29[_0x44f8a0]={'$like':'%'+_0x5163c7[_0xce10('0x31')][_0xce10('0x4c')]+'%'};return _0x3dff29;})});}_0x54c682=_['merge']({},_0x54c682,_0x5163c7[_0xce10('0x3e')]);return _0x590223[_0xce10('0x4f')](_0x54c682);}})[_0xce10('0x25')](function(_0x1f25ad){if(_0x1f25ad){_0x4bab13=_0x1f25ad[_0xce10('0x37')];if(!_0x5163c7[_0xce10('0x31')]['hasOwnProperty']('nolimit')){_0x54c682[_0xce10('0x1d')]=qs['limit'](_0x5163c7[_0xce10('0x31')][_0xce10('0x1d')]);_0x54c682['offset']=qs['offset'](_0x5163c7['query'][_0xce10('0x1b')]);}return _0x590223[_0xce10('0x4f')](_0x54c682);}})[_0xce10('0x25')](function(_0xb6c9c7){if(_0xb6c9c7){return _0xb6c9c7?{'count':_0x4bab13,'rows':_0xb6c9c7}:null;}})[_0xce10('0x25')](respondWithResult(_0x11e783,null))[_0xce10('0x41')](handleError(_0x11e783,null));};exports['getDescriptions']=function(_0x1836ea,_0x125fe4,_0x18656f){var _0x294fae={};var _0x1935de={};var _0x52068f;var _0x4b55e3;return db['VtigerConfiguration'][_0xce10('0x4a')]({'where':{'id':_0x1836ea['params']['id']}})[_0xce10('0x25')](handleEntityNotFound(_0x125fe4,null))[_0xce10('0x25')](function(_0x2f21dc){if(_0x2f21dc){_0x52068f=_0x2f21dc;_0x1935de[_0xce10('0x34')]=_['keys'](db[_0xce10('0x4b')][_0xce10('0x44')]);_0x1935de[_0xce10('0x31')]=_['keys'](_0x1836ea['query']);_0x1935de['filters']=_[_0xce10('0x33')](_0x1935de[_0xce10('0x34')],_0x1935de['query']);_0x294fae[_0xce10('0x36')]=_['intersection'](_0x1935de['model'],qs[_0xce10('0x35')](_0x1836ea['query'][_0xce10('0x35')]));_0x294fae[_0xce10('0x36')]=_0x294fae['attributes']['length']?_0x294fae[_0xce10('0x36')]:_0x1935de[_0xce10('0x34')];_0x294fae[_0xce10('0x39')]=qs['sort'](_0x1836ea[_0xce10('0x31')][_0xce10('0x3a')]);_0x294fae['where']=qs[_0xce10('0x32')](_['pick'](_0x1836ea['query'],_0x1935de[_0xce10('0x32')]));if(_0x1836ea['query']['filter']){_0x294fae[_0xce10('0x3c')]=_[_0xce10('0x3d')](_0x294fae[_0xce10('0x3c')],{'$or':_[_0xce10('0x30')](_0x294fae[_0xce10('0x36')],function(_0x27dc8b){var _0x55102b={};_0x55102b[_0x27dc8b]={'$like':'%'+_0x1836ea[_0xce10('0x31')][_0xce10('0x4c')]+'%'};return _0x55102b;})});}_0x294fae=_[_0xce10('0x3d')]({},_0x294fae,_0x1836ea['options']);return _0x52068f['getDescriptions'](_0x294fae);}})[_0xce10('0x25')](function(_0x52aaac){if(_0x52aaac){_0x4b55e3=_0x52aaac[_0xce10('0x37')];if(!_0x1836ea[_0xce10('0x31')][_0xce10('0x4e')](_0xce10('0x38'))){_0x294fae['limit']=qs['limit'](_0x1836ea[_0xce10('0x31')][_0xce10('0x1d')]);_0x294fae['offset']=qs['offset'](_0x1836ea[_0xce10('0x31')][_0xce10('0x1b')]);}return _0x52068f[_0xce10('0x50')](_0x294fae);}})[_0xce10('0x25')](function(_0x16ecfe){if(_0x16ecfe){return _0x16ecfe?{'count':_0x4b55e3,'rows':_0x16ecfe}:null;}})[_0xce10('0x25')](respondWithResult(_0x125fe4,null))[_0xce10('0x41')](handleError(_0x125fe4,null));}; \ No newline at end of file +var _0x19c2=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VtigerConfiguration','findAll','show','find','catch','create','body','params','destroy','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions'];(function(_0x4ccf7f,_0x161ffd){var _0x1953f0=function(_0xfd2ca6){while(--_0xfd2ca6){_0x4ccf7f['push'](_0x4ccf7f['shift']());}};_0x1953f0(++_0x161ffd);}(_0x19c2,0x186));var _0x219c=function(_0x108b66,_0x37db88){_0x108b66=_0x108b66-0x0;var _0x3ed76=_0x19c2[_0x108b66];return _0x3ed76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x219c('0x0'));var zipdir=require(_0x219c('0x1'));var jsonpatch=require(_0x219c('0x2'));var rp=require(_0x219c('0x3'));var moment=require(_0x219c('0x4'));var BPromise=require(_0x219c('0x5'));var Mustache=require(_0x219c('0x6'));var util=require('util');var path=require(_0x219c('0x7'));var sox=require('sox');var csv=require(_0x219c('0x8'));var ejs=require(_0x219c('0x9'));var fs=require('fs');var fs_extra=require(_0x219c('0xa'));var _=require(_0x219c('0xb'));var squel=require(_0x219c('0xc'));var crypto=require(_0x219c('0xd'));var jsforce=require(_0x219c('0xe'));var deskjs=require(_0x219c('0xf'));var toCsv=require(_0x219c('0x8'));var querystring=require('querystring');var Papa=require(_0x219c('0x10'));var Redis=require(_0x219c('0x11'));var authService=require(_0x219c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x219c('0x13'));var hardwareService=require(_0x219c('0x14'));var logger=require(_0x219c('0x15'))(_0x219c('0x16'));var utils=require('../../config/utils');var config=require(_0x219c('0x17'));var licenseUtil=require(_0x219c('0x18'));var db=require(_0x219c('0x19'))['db'];function respondWithStatusCode(_0xd5ca0c,_0x10ebea){_0x10ebea=_0x10ebea||0xcc;return function(_0xd09e96){if(_0xd09e96){return _0xd5ca0c[_0x219c('0x1a')](_0x10ebea);}return _0xd5ca0c[_0x219c('0x1b')](_0x10ebea)[_0x219c('0x1c')]();};}function respondWithResult(_0x3dd0ab,_0x548d3b){_0x548d3b=_0x548d3b||0xc8;return function(_0x38cd1c){if(_0x38cd1c){return _0x3dd0ab[_0x219c('0x1b')](_0x548d3b)[_0x219c('0x1d')](_0x38cd1c);}};}function respondWithFilteredResult(_0x47ac67,_0x5bc2d8){return function(_0x12090c){if(_0x12090c){var _0x45fb08=typeof _0x5bc2d8[_0x219c('0x1e')]===_0x219c('0x1f')&&typeof _0x5bc2d8[_0x219c('0x20')]===_0x219c('0x1f');var _0x23297e=_0x12090c['count'];var _0x42c045=_0x45fb08?0x0:_0x5bc2d8[_0x219c('0x1e')];var _0x218f9a=_0x45fb08?_0x12090c[_0x219c('0x21')]:_0x5bc2d8[_0x219c('0x1e')]+_0x5bc2d8['limit'];var _0x4554e3;if(_0x218f9a>=_0x23297e){_0x218f9a=_0x23297e;_0x4554e3=0xc8;}else{_0x4554e3=0xce;}_0x47ac67['status'](_0x4554e3);return _0x47ac67['set']('Content-Range',_0x42c045+'-'+_0x218f9a+'/'+_0x23297e)[_0x219c('0x1d')](_0x12090c);}return null;};}function patchUpdates(_0x2e1d0f){return function(_0x131ae3){try{jsonpatch[_0x219c('0x22')](_0x131ae3,_0x2e1d0f,!![]);}catch(_0x5c37df){return BPromise['reject'](_0x5c37df);}return _0x131ae3['save']();};}function saveUpdates(_0xab7775,_0x5e937e){return function(_0x3ddefd){if(_0x3ddefd){return _0x3ddefd[_0x219c('0x23')](_0xab7775)[_0x219c('0x24')](function(_0x29df8d){return _0x29df8d;});}return null;};}function removeEntity(_0x253c1d,_0x5277ad){return function(_0x46f78b){if(_0x46f78b){return _0x46f78b['destroy']()[_0x219c('0x24')](function(){_0x253c1d['status'](0xcc)[_0x219c('0x1c')]();});}};}function handleEntityNotFound(_0x4c3ba0,_0x4b588c){return function(_0x5ea986){if(!_0x5ea986){_0x4c3ba0['sendStatus'](0x194);}return _0x5ea986;};}function handleError(_0x182d3e,_0x1062f8){_0x1062f8=_0x1062f8||0x1f4;return function(_0xa61ae){logger[_0x219c('0x25')](_0xa61ae[_0x219c('0x26')]);if(_0xa61ae[_0x219c('0x27')]){delete _0xa61ae[_0x219c('0x27')];}_0x182d3e['status'](_0x1062f8)[_0x219c('0x28')](_0xa61ae);};}exports[_0x219c('0x29')]=function(_0x3f5e5e,_0x2d58bf){var _0x1bb9ff={},_0x219193={},_0x419519={'count':0x0,'rows':[]};var _0x243834=_[_0x219c('0x2a')](db['VtigerConfiguration'][_0x219c('0x2b')],function(_0x5560b3){return{'name':_0x5560b3[_0x219c('0x2c')],'type':_0x5560b3['type']['key']};});_0x219193[_0x219c('0x2d')]=_[_0x219c('0x2a')](_0x243834,'name');_0x219193[_0x219c('0x2e')]=_[_0x219c('0x2f')](_0x3f5e5e[_0x219c('0x2e')]);_0x219193[_0x219c('0x30')]=_[_0x219c('0x31')](_0x219193['model'],_0x219193[_0x219c('0x2e')]);_0x1bb9ff[_0x219c('0x32')]=_['intersection'](_0x219193[_0x219c('0x2d')],qs[_0x219c('0x33')](_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x33')]));_0x1bb9ff[_0x219c('0x32')]=_0x1bb9ff[_0x219c('0x32')][_0x219c('0x34')]?_0x1bb9ff['attributes']:_0x219193['model'];if(!_0x3f5e5e['query'][_0x219c('0x35')](_0x219c('0x36'))){_0x1bb9ff[_0x219c('0x20')]=qs['limit'](_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x20')]);_0x1bb9ff[_0x219c('0x1e')]=qs[_0x219c('0x1e')](_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x1e')]);}_0x1bb9ff['order']=qs['sort'](_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x37')]);_0x1bb9ff[_0x219c('0x38')]=qs[_0x219c('0x30')](_['pick'](_0x3f5e5e[_0x219c('0x2e')],_0x219193['filters']),_0x243834);if(_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x39')]){_0x1bb9ff[_0x219c('0x38')]=_[_0x219c('0x3a')](_0x1bb9ff[_0x219c('0x38')],{'$or':_['map'](_0x243834,function(_0x5cfee2){if(_0x5cfee2['type']!==_0x219c('0x3b')){var _0x432011={};_0x432011[_0x5cfee2['name']]={'$like':'%'+_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x39')]+'%'};return _0x432011;}})});}_0x1bb9ff=_[_0x219c('0x3a')]({},_0x1bb9ff,_0x3f5e5e[_0x219c('0x3c')]);var _0x6ae220={'where':_0x1bb9ff[_0x219c('0x38')]};return db['VtigerConfiguration'][_0x219c('0x21')](_0x6ae220)['then'](function(_0x230944){_0x419519['count']=_0x230944;if(_0x3f5e5e[_0x219c('0x2e')][_0x219c('0x3d')]){_0x1bb9ff[_0x219c('0x3e')]=[{'all':!![]}];}return db[_0x219c('0x3f')][_0x219c('0x40')](_0x1bb9ff);})[_0x219c('0x24')](function(_0x4dc69b){_0x419519['rows']=_0x4dc69b;return _0x419519;})[_0x219c('0x24')](respondWithFilteredResult(_0x2d58bf,_0x1bb9ff))['catch'](handleError(_0x2d58bf,null));};exports[_0x219c('0x41')]=function(_0x51cd2b,_0x7e5836){var _0x5dced3={'raw':![],'where':{'id':_0x51cd2b['params']['id']}},_0x2a3b53={};_0x2a3b53[_0x219c('0x2d')]=_[_0x219c('0x2f')](db[_0x219c('0x3f')][_0x219c('0x2b')]);_0x2a3b53[_0x219c('0x2e')]=_['keys'](_0x51cd2b[_0x219c('0x2e')]);_0x2a3b53[_0x219c('0x30')]=_[_0x219c('0x31')](_0x2a3b53[_0x219c('0x2d')],_0x2a3b53[_0x219c('0x2e')]);_0x5dced3['attributes']=_['intersection'](_0x2a3b53[_0x219c('0x2d')],qs[_0x219c('0x33')](_0x51cd2b[_0x219c('0x2e')][_0x219c('0x33')]));_0x5dced3['attributes']=_0x5dced3[_0x219c('0x32')][_0x219c('0x34')]?_0x5dced3[_0x219c('0x32')]:_0x2a3b53[_0x219c('0x2d')];if(_0x51cd2b[_0x219c('0x2e')][_0x219c('0x3d')]){_0x5dced3[_0x219c('0x3e')]=[{'all':!![]}];}_0x5dced3=_['merge']({},_0x5dced3,_0x51cd2b['options']);return db['VtigerConfiguration'][_0x219c('0x42')](_0x5dced3)[_0x219c('0x24')](handleEntityNotFound(_0x7e5836,null))[_0x219c('0x24')](respondWithResult(_0x7e5836,null))[_0x219c('0x43')](handleError(_0x7e5836,null));};exports[_0x219c('0x44')]=function(_0x15f098,_0x2393fe){return db[_0x219c('0x3f')][_0x219c('0x44')](_0x15f098[_0x219c('0x45')],{})['then'](respondWithResult(_0x2393fe,0xc9))[_0x219c('0x43')](handleError(_0x2393fe,null));};exports[_0x219c('0x23')]=function(_0x5f4648,_0x322303){if(_0x5f4648[_0x219c('0x45')]['id']){delete _0x5f4648[_0x219c('0x45')]['id'];}return db[_0x219c('0x3f')]['find']({'where':{'id':_0x5f4648[_0x219c('0x46')]['id']}})[_0x219c('0x24')](handleEntityNotFound(_0x322303,null))[_0x219c('0x24')](saveUpdates(_0x5f4648[_0x219c('0x45')],null))['then'](respondWithResult(_0x322303,null))[_0x219c('0x43')](handleError(_0x322303,null));};exports[_0x219c('0x47')]=function(_0x2a5c0d,_0x17ba94){return db['VtigerConfiguration'][_0x219c('0x42')]({'where':{'id':_0x2a5c0d[_0x219c('0x46')]['id']}})[_0x219c('0x24')](handleEntityNotFound(_0x17ba94,null))['then'](removeEntity(_0x17ba94,null))[_0x219c('0x43')](handleError(_0x17ba94,null));};exports[_0x219c('0x48')]=function(_0x477eaf,_0x125391,_0x1252ec){var _0x6d7b13={};var _0x5b2ab4={};var _0x3e7c43;var _0x50312c;return db[_0x219c('0x3f')][_0x219c('0x49')]({'where':{'id':_0x477eaf[_0x219c('0x46')]['id']}})[_0x219c('0x24')](handleEntityNotFound(_0x125391,null))[_0x219c('0x24')](function(_0x2149e9){if(_0x2149e9){_0x3e7c43=_0x2149e9;_0x5b2ab4[_0x219c('0x2d')]=_[_0x219c('0x2f')](db['VtigerField'][_0x219c('0x2b')]);_0x5b2ab4[_0x219c('0x2e')]=_[_0x219c('0x2f')](_0x477eaf[_0x219c('0x2e')]);_0x5b2ab4[_0x219c('0x30')]=_[_0x219c('0x31')](_0x5b2ab4[_0x219c('0x2d')],_0x5b2ab4['query']);_0x6d7b13[_0x219c('0x32')]=_['intersection'](_0x5b2ab4['model'],qs['fields'](_0x477eaf[_0x219c('0x2e')][_0x219c('0x33')]));_0x6d7b13[_0x219c('0x32')]=_0x6d7b13[_0x219c('0x32')][_0x219c('0x34')]?_0x6d7b13['attributes']:_0x5b2ab4[_0x219c('0x2d')];_0x6d7b13['order']=qs['sort'](_0x477eaf['query'][_0x219c('0x37')]);_0x6d7b13['where']=qs[_0x219c('0x30')](_[_0x219c('0x4a')](_0x477eaf[_0x219c('0x2e')],_0x5b2ab4[_0x219c('0x30')]));if(_0x477eaf[_0x219c('0x2e')][_0x219c('0x39')]){_0x6d7b13[_0x219c('0x38')]=_[_0x219c('0x3a')](_0x6d7b13[_0x219c('0x38')],{'$or':_['map'](_0x6d7b13[_0x219c('0x32')],function(_0x4c4a2c){var _0x485c4d={};_0x485c4d[_0x4c4a2c]={'$like':'%'+_0x477eaf[_0x219c('0x2e')][_0x219c('0x39')]+'%'};return _0x485c4d;})});}_0x6d7b13=_[_0x219c('0x3a')]({},_0x6d7b13,_0x477eaf[_0x219c('0x3c')]);return _0x3e7c43[_0x219c('0x48')](_0x6d7b13);}})[_0x219c('0x24')](function(_0x50ea27){if(_0x50ea27){_0x50312c=_0x50ea27[_0x219c('0x34')];if(!_0x477eaf[_0x219c('0x2e')][_0x219c('0x35')](_0x219c('0x36'))){_0x6d7b13[_0x219c('0x20')]=qs[_0x219c('0x20')](_0x477eaf['query'][_0x219c('0x20')]);_0x6d7b13[_0x219c('0x1e')]=qs[_0x219c('0x1e')](_0x477eaf[_0x219c('0x2e')][_0x219c('0x1e')]);}return _0x3e7c43[_0x219c('0x48')](_0x6d7b13);}})[_0x219c('0x24')](function(_0x359164){if(_0x359164){return _0x359164?{'count':_0x50312c,'rows':_0x359164}:null;}})[_0x219c('0x24')](respondWithResult(_0x125391,null))['catch'](handleError(_0x125391,null));};exports[_0x219c('0x4b')]=function(_0x17c313,_0x37445e,_0x579b57){var _0x2f2fbe={};var _0x332df2={};var _0x4342e8;var _0x2e03d3;return db[_0x219c('0x3f')][_0x219c('0x49')]({'where':{'id':_0x17c313[_0x219c('0x46')]['id']}})[_0x219c('0x24')](handleEntityNotFound(_0x37445e,null))[_0x219c('0x24')](function(_0x43631e){if(_0x43631e){_0x4342e8=_0x43631e;_0x332df2[_0x219c('0x2d')]=_[_0x219c('0x2f')](db[_0x219c('0x4c')][_0x219c('0x2b')]);_0x332df2[_0x219c('0x2e')]=_[_0x219c('0x2f')](_0x17c313[_0x219c('0x2e')]);_0x332df2['filters']=_[_0x219c('0x31')](_0x332df2[_0x219c('0x2d')],_0x332df2[_0x219c('0x2e')]);_0x2f2fbe[_0x219c('0x32')]=_[_0x219c('0x31')](_0x332df2[_0x219c('0x2d')],qs['fields'](_0x17c313[_0x219c('0x2e')][_0x219c('0x33')]));_0x2f2fbe[_0x219c('0x32')]=_0x2f2fbe[_0x219c('0x32')][_0x219c('0x34')]?_0x2f2fbe['attributes']:_0x332df2[_0x219c('0x2d')];_0x2f2fbe['order']=qs[_0x219c('0x37')](_0x17c313[_0x219c('0x2e')]['sort']);_0x2f2fbe[_0x219c('0x38')]=qs[_0x219c('0x30')](_[_0x219c('0x4a')](_0x17c313['query'],_0x332df2[_0x219c('0x30')]));if(_0x17c313[_0x219c('0x2e')][_0x219c('0x39')]){_0x2f2fbe[_0x219c('0x38')]=_[_0x219c('0x3a')](_0x2f2fbe[_0x219c('0x38')],{'$or':_[_0x219c('0x2a')](_0x2f2fbe['attributes'],function(_0xca7ff7){var _0x19ab4f={};_0x19ab4f[_0xca7ff7]={'$like':'%'+_0x17c313[_0x219c('0x2e')][_0x219c('0x39')]+'%'};return _0x19ab4f;})});}_0x2f2fbe=_['merge']({},_0x2f2fbe,_0x17c313[_0x219c('0x3c')]);return _0x4342e8[_0x219c('0x4b')](_0x2f2fbe);}})['then'](function(_0x248627){if(_0x248627){_0x2e03d3=_0x248627[_0x219c('0x34')];if(!_0x17c313[_0x219c('0x2e')]['hasOwnProperty'](_0x219c('0x36'))){_0x2f2fbe[_0x219c('0x20')]=qs[_0x219c('0x20')](_0x17c313[_0x219c('0x2e')][_0x219c('0x20')]);_0x2f2fbe[_0x219c('0x1e')]=qs[_0x219c('0x1e')](_0x17c313['query'][_0x219c('0x1e')]);}return _0x4342e8['getSubjects'](_0x2f2fbe);}})[_0x219c('0x24')](function(_0x3fa3c4){if(_0x3fa3c4){return _0x3fa3c4?{'count':_0x2e03d3,'rows':_0x3fa3c4}:null;}})[_0x219c('0x24')](respondWithResult(_0x37445e,null))[_0x219c('0x43')](handleError(_0x37445e,null));};exports['getDescriptions']=function(_0x4897ed,_0x4feab1,_0x2e17ef){var _0x2aa1ef={};var _0x4e34e2={};var _0x403d7a;var _0x30bcf7;return db[_0x219c('0x3f')]['findOne']({'where':{'id':_0x4897ed['params']['id']}})['then'](handleEntityNotFound(_0x4feab1,null))['then'](function(_0x42929c){if(_0x42929c){_0x403d7a=_0x42929c;_0x4e34e2['model']=_[_0x219c('0x2f')](db[_0x219c('0x4c')][_0x219c('0x2b')]);_0x4e34e2['query']=_[_0x219c('0x2f')](_0x4897ed[_0x219c('0x2e')]);_0x4e34e2[_0x219c('0x30')]=_[_0x219c('0x31')](_0x4e34e2[_0x219c('0x2d')],_0x4e34e2[_0x219c('0x2e')]);_0x2aa1ef[_0x219c('0x32')]=_[_0x219c('0x31')](_0x4e34e2[_0x219c('0x2d')],qs[_0x219c('0x33')](_0x4897ed[_0x219c('0x2e')][_0x219c('0x33')]));_0x2aa1ef['attributes']=_0x2aa1ef[_0x219c('0x32')]['length']?_0x2aa1ef[_0x219c('0x32')]:_0x4e34e2['model'];_0x2aa1ef['order']=qs['sort'](_0x4897ed['query'][_0x219c('0x37')]);_0x2aa1ef[_0x219c('0x38')]=qs[_0x219c('0x30')](_['pick'](_0x4897ed[_0x219c('0x2e')],_0x4e34e2['filters']));if(_0x4897ed[_0x219c('0x2e')][_0x219c('0x39')]){_0x2aa1ef[_0x219c('0x38')]=_[_0x219c('0x3a')](_0x2aa1ef['where'],{'$or':_[_0x219c('0x2a')](_0x2aa1ef[_0x219c('0x32')],function(_0x33807e){var _0x22fe89={};_0x22fe89[_0x33807e]={'$like':'%'+_0x4897ed[_0x219c('0x2e')][_0x219c('0x39')]+'%'};return _0x22fe89;})});}_0x2aa1ef=_[_0x219c('0x3a')]({},_0x2aa1ef,_0x4897ed[_0x219c('0x3c')]);return _0x403d7a[_0x219c('0x4d')](_0x2aa1ef);}})['then'](function(_0x20c88a){if(_0x20c88a){_0x30bcf7=_0x20c88a[_0x219c('0x34')];if(!_0x4897ed[_0x219c('0x2e')]['hasOwnProperty']('nolimit')){_0x2aa1ef['limit']=qs['limit'](_0x4897ed['query'][_0x219c('0x20')]);_0x2aa1ef[_0x219c('0x1e')]=qs[_0x219c('0x1e')](_0x4897ed[_0x219c('0x2e')][_0x219c('0x1e')]);}return _0x403d7a['getDescriptions'](_0x2aa1ef);}})[_0x219c('0x24')](function(_0x32d1ef){if(_0x32d1ef){return _0x32d1ef?{'count':_0x30bcf7,'rows':_0x32d1ef}:null;}})['then'](respondWithResult(_0x4feab1,null))['catch'](handleError(_0x4feab1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 38fccb0..1d51eea 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 _0xcfc8=['util','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash'];(function(_0x1cc8d6,_0x276521){var _0x49660a=function(_0x1b7115){while(--_0x1b7115){_0x1cc8d6['push'](_0x1cc8d6['shift']());}};_0x49660a(++_0x276521);}(_0xcfc8,0x133));var _0x8cfc=function(_0x37a64d,_0x1f78a6){_0x37a64d=_0x37a64d-0x0;var _0x273144=_0xcfc8[_0x37a64d];return _0x273144;};'use strict';var _=require(_0x8cfc('0x0'));var util=require(_0x8cfc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cfc('0x2'));var BPromise=require('bluebird');var rp=require(_0x8cfc('0x3'));var fs=require('fs');var path=require(_0x8cfc('0x4'));var rimraf=require(_0x8cfc('0x5'));var config=require(_0x8cfc('0x6'));var attributes=require(_0x8cfc('0x7'));module[_0x8cfc('0x8')]=function(_0x14b1e4,_0x3ccd18){return _0x14b1e4[_0x8cfc('0x9')](_0x8cfc('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9be=['./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x122352,_0xe620ee){var _0x2d9441=function(_0x5f2ec6){while(--_0x5f2ec6){_0x122352['push'](_0x122352['shift']());}};_0x2d9441(++_0xe620ee);}(_0xf9be,0xfe));var _0xef9b=function(_0xee588,_0x368239){_0xee588=_0xee588-0x0;var _0x58dd1a=_0xf9be[_0xee588];return _0x58dd1a;};'use strict';var _=require(_0xef9b('0x0'));var util=require(_0xef9b('0x1'));var logger=require(_0xef9b('0x2'))('api');var moment=require(_0xef9b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef9b('0x4'));var config=require(_0xef9b('0x5'));var attributes=require(_0xef9b('0x6'));module[_0xef9b('0x7')]=function(_0x32f532,_0x4f0616){return _0x32f532[_0xef9b('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xef9b('0x9'),'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 ffd328d..233cbb7 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 _0x5eae=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0xa09591,_0xe201be){var _0x152315=function(_0x5961e4){while(--_0x5961e4){_0xa09591['push'](_0xa09591['shift']());}};_0x152315(++_0xe201be);}(_0x5eae,0x92));var _0xe5ea=function(_0x4418dd,_0x441841){_0x4418dd=_0x4418dd-0x0;var _0x3ccc13=_0x5eae[_0x4418dd];return _0x3ccc13;};'use strict';var _=require(_0xe5ea('0x0'));var util=require(_0xe5ea('0x1'));var moment=require('moment');var BPromise=require(_0xe5ea('0x2'));var rs=require(_0xe5ea('0x3'));var fs=require('fs');var Redis=require(_0xe5ea('0x4'));var db=require(_0xe5ea('0x5'))['db'];var utils=require(_0xe5ea('0x6'));var logger=require(_0xe5ea('0x7'))(_0xe5ea('0x8'));var config=require(_0xe5ea('0x9'));var jayson=require(_0xe5ea('0xa'));var client=jayson[_0xe5ea('0xb')][_0xe5ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a5d,_0x193f61,_0x5151c8){return new BPromise(function(_0x472057,_0x327332){return client['request'](_0x3f9a5d,_0x5151c8)['then'](function(_0x4019bf){logger[_0xe5ea('0xd')](_0xe5ea('0xe'),_0x193f61,'request\x20sent');logger[_0xe5ea('0xf')](_0xe5ea('0x10'),_0x193f61,_0xe5ea('0x11'),JSON[_0xe5ea('0x12')](_0x4019bf));if(_0x4019bf['error']){if(_0x4019bf[_0xe5ea('0x13')]['code']===0x1f4){logger[_0xe5ea('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x193f61,_0x4019bf[_0xe5ea('0x13')][_0xe5ea('0x14')]);return _0x327332(_0x4019bf[_0xe5ea('0x13')][_0xe5ea('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x193f61,_0x4019bf['error'][_0xe5ea('0x14')]);return _0x472057(_0x4019bf['error'][_0xe5ea('0x14')]);}else{logger[_0xe5ea('0xd')](_0xe5ea('0xe'),_0x193f61,_0xe5ea('0x11'));_0x472057(_0x4019bf[_0xe5ea('0x15')]['message']);}})[_0xe5ea('0x16')](function(_0x2fb35f){logger[_0xe5ea('0x13')](_0xe5ea('0xe'),_0x193f61,_0x2fb35f);_0x327332(_0x2fb35f);});});} \ No newline at end of file +var _0x4f46=['jayson/promise','client','http','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4ad48b,_0x38fd67){var _0x1d93ba=function(_0x429461){while(--_0x429461){_0x4ad48b['push'](_0x4ad48b['shift']());}};_0x1d93ba(++_0x38fd67);}(_0x4f46,0x1c5));var _0x64f4=function(_0x15c056,_0x5bf32d){_0x15c056=_0x15c056-0x0;var _0x3838c3=_0x4f46[_0x15c056];return _0x3838c3;};'use strict';var _=require('lodash');var util=require(_0x64f4('0x0'));var moment=require('moment');var BPromise=require(_0x64f4('0x1'));var rs=require(_0x64f4('0x2'));var fs=require('fs');var Redis=require(_0x64f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x64f4('0x4'));var logger=require(_0x64f4('0x5'))('rpc');var config=require(_0x64f4('0x6'));var jayson=require(_0x64f4('0x7'));var client=jayson[_0x64f4('0x8')][_0x64f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x848264,_0x55421c,_0x10683f){return new BPromise(function(_0x46e896,_0x234548){return client[_0x64f4('0xa')](_0x848264,_0x10683f)[_0x64f4('0xb')](function(_0x1b0fe7){logger[_0x64f4('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x55421c,_0x64f4('0xd'));logger['debug'](_0x64f4('0xe'),_0x55421c,_0x64f4('0xd'),JSON[_0x64f4('0xf')](_0x1b0fe7));if(_0x1b0fe7[_0x64f4('0x10')]){if(_0x1b0fe7[_0x64f4('0x10')][_0x64f4('0x11')]===0x1f4){logger[_0x64f4('0x10')](_0x64f4('0x12'),_0x55421c,_0x1b0fe7['error'][_0x64f4('0x13')]);return _0x234548(_0x1b0fe7[_0x64f4('0x10')]['message']);}logger[_0x64f4('0x10')](_0x64f4('0x12'),_0x55421c,_0x1b0fe7[_0x64f4('0x10')][_0x64f4('0x13')]);return _0x46e896(_0x1b0fe7[_0x64f4('0x10')][_0x64f4('0x13')]);}else{logger['info'](_0x64f4('0x12'),_0x55421c,'request\x20sent');_0x46e896(_0x1b0fe7['result']['message']);}})['catch'](function(_0x3d0675){logger[_0x64f4('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x55421c,_0x3d0675);_0x234548(_0x3d0675);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ec1ff93..d803e74 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 _0x6f84=['../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x6f84,0xc1));var _0x46f8=function(_0xec4380,_0x4ab158){_0xec4380=_0xec4380-0x0;var _0x228927=_0x6f84[_0xec4380];return _0x228927;};'use strict';var multer=require(_0x46f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x46f8('0x1'));var express=require(_0x46f8('0x2'));var router=express[_0x46f8('0x3')]();var fs_extra=require(_0x46f8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x46f8('0x5'));var config=require('../../config/environment');var controller=require(_0x46f8('0x6'));router[_0x46f8('0x7')]('/',auth[_0x46f8('0x8')](),controller[_0x46f8('0x9')]);router['get'](_0x46f8('0xa'),auth['isAuthenticated'](),controller[_0x46f8('0xb')]);router[_0x46f8('0xc')]('/',auth[_0x46f8('0x8')](),controller[_0x46f8('0xd')]);router[_0x46f8('0xe')](_0x46f8('0xa'),auth[_0x46f8('0x8')](),controller[_0x46f8('0xf')]);router[_0x46f8('0x10')](_0x46f8('0xa'),auth[_0x46f8('0x8')](),controller['destroy']);module[_0x46f8('0x11')]=router; \ No newline at end of file +var _0xc3dc=['/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc3dc,0x1cf));var _0xcc3d=function(_0x2067c1,_0x4ad413){_0x2067c1=_0x2067c1-0x0;var _0x4c2968=_0xc3dc[_0x2067c1];return _0x4c2968;};'use strict';var multer=require(_0xcc3d('0x0'));var util=require(_0xcc3d('0x1'));var path=require(_0xcc3d('0x2'));var timeout=require(_0xcc3d('0x3'));var express=require(_0xcc3d('0x4'));var router=express[_0xcc3d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc3d('0x6'));var interaction=require(_0xcc3d('0x7'));var config=require('../../config/environment');var controller=require(_0xcc3d('0x8'));router[_0xcc3d('0x9')]('/',auth[_0xcc3d('0xa')](),controller[_0xcc3d('0xb')]);router[_0xcc3d('0x9')](_0xcc3d('0xc'),auth[_0xcc3d('0xa')](),controller[_0xcc3d('0xd')]);router[_0xcc3d('0xe')]('/',auth[_0xcc3d('0xa')](),controller[_0xcc3d('0xf')]);router[_0xcc3d('0x10')](_0xcc3d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcc3d('0x11')](_0xcc3d('0xc'),auth[_0xcc3d('0xa')](),controller['destroy']);module[_0xcc3d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8662c9b..e32cc07 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 _0x90f6=['string','STRING','customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','picklist'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x90f6,0xf7));var _0x690f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x90f6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x690f('0x0'));module['exports']={'type':{'type':Sequelize[_0x690f('0x1')]('string',_0x690f('0x2'),'customVariable',_0x690f('0x3'),_0x690f('0x4')),'defaultValue':_0x690f('0x5')},'content':{'type':Sequelize[_0x690f('0x6')]},'key':{'type':Sequelize[_0x690f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x690f('0x2'),_0x690f('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x690f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x690f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x690f('0x6')]}}; \ No newline at end of file +var _0x752b=['picklist','string','STRING','exports','ENUM','customVariable','keyValue'];(function(_0x123afb,_0x19ffac){var _0x56ef61=function(_0x5b8d24){while(--_0x5b8d24){_0x123afb['push'](_0x123afb['shift']());}};_0x56ef61(++_0x19ffac);}(_0x752b,0xce));var _0xb752=function(_0xfe9199,_0x1a964a){_0xfe9199=_0xfe9199-0x0;var _0x325bbe=_0x752b[_0xfe9199];return _0x325bbe;};'use strict';var Sequelize=require('sequelize');module[_0xb752('0x0')]={'type':{'type':Sequelize[_0xb752('0x1')]('string','variable',_0xb752('0x2'),_0xb752('0x3'),_0xb752('0x4')),'defaultValue':_0xb752('0x5')},'content':{'type':Sequelize[_0xb752('0x6')]},'key':{'type':Sequelize[_0xb752('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb752('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb752('0x6')]},'idField':{'type':Sequelize[_0xb752('0x6')]},'nameField':{'type':Sequelize[_0xb752('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb752('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b4c218f..6088cb1 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 _0x5384=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js'];(function(_0x246589,_0xe9df41){var _0x2ced72=function(_0x2023c1){while(--_0x2023c1){_0x246589['push'](_0x246589['shift']());}};_0x2ced72(++_0xe9df41);}(_0x5384,0x169));var _0x4538=function(_0x1bf316,_0x5cf102){_0x1bf316=_0x1bf316-0x0;var _0x223bdd=_0x5384[_0x1bf316];return _0x223bdd;};'use strict';var emlformat=require(_0x4538('0x0'));var rimraf=require(_0x4538('0x1'));var zipdir=require(_0x4538('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4538('0x3'));var BPromise=require(_0x4538('0x4'));var Mustache=require(_0x4538('0x5'));var util=require(_0x4538('0x6'));var path=require(_0x4538('0x7'));var sox=require(_0x4538('0x8'));var csv=require(_0x4538('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4538('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4538('0xb'));var jsforce=require(_0x4538('0xc'));var deskjs=require(_0x4538('0xd'));var toCsv=require(_0x4538('0x9'));var querystring=require(_0x4538('0xe'));var Papa=require(_0x4538('0xf'));var Redis=require(_0x4538('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4538('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4538('0x12'));var logger=require(_0x4538('0x13'))(_0x4538('0x14'));var utils=require(_0x4538('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4538('0x16'));var db=require(_0x4538('0x17'))['db'];function respondWithStatusCode(_0x347ab9,_0x13424b){_0x13424b=_0x13424b||0xcc;return function(_0xa105bc){if(_0xa105bc){return _0x347ab9['sendStatus'](_0x13424b);}return _0x347ab9['status'](_0x13424b)[_0x4538('0x18')]();};}function respondWithResult(_0x533774,_0x567516){_0x567516=_0x567516||0xc8;return function(_0x54641e){if(_0x54641e){return _0x533774[_0x4538('0x19')](_0x567516)[_0x4538('0x1a')](_0x54641e);}};}function respondWithFilteredResult(_0x1698b2,_0x18e472){return function(_0x153b47){if(_0x153b47){var _0x54b468=typeof _0x18e472[_0x4538('0x1b')]===_0x4538('0x1c')&&typeof _0x18e472[_0x4538('0x1d')]==='undefined';var _0x467a3e=_0x153b47['count'];var _0x3ea157=_0x54b468?0x0:_0x18e472[_0x4538('0x1b')];var _0x557846=_0x54b468?_0x153b47[_0x4538('0x1e')]:_0x18e472[_0x4538('0x1b')]+_0x18e472[_0x4538('0x1d')];var _0x39be45;if(_0x557846>=_0x467a3e){_0x557846=_0x467a3e;_0x39be45=0xc8;}else{_0x39be45=0xce;}_0x1698b2['status'](_0x39be45);return _0x1698b2[_0x4538('0x1f')](_0x4538('0x20'),_0x3ea157+'-'+_0x557846+'/'+_0x467a3e)['json'](_0x153b47);}return null;};}function patchUpdates(_0x1d2e7b){return function(_0x1ef2c8){try{jsonpatch[_0x4538('0x21')](_0x1ef2c8,_0x1d2e7b,!![]);}catch(_0x3fc367){return BPromise['reject'](_0x3fc367);}return _0x1ef2c8[_0x4538('0x22')]();};}function saveUpdates(_0x5aa66e,_0x1213f2){return function(_0x3a9e6f){if(_0x3a9e6f){return _0x3a9e6f[_0x4538('0x23')](_0x5aa66e)[_0x4538('0x24')](function(_0x4d7418){return _0x4d7418;});}return null;};}function removeEntity(_0x463a74,_0x18ac25){return function(_0x389b93){if(_0x389b93){return _0x389b93[_0x4538('0x25')]()[_0x4538('0x24')](function(){_0x463a74[_0x4538('0x19')](0xcc)[_0x4538('0x18')]();});}};}function handleEntityNotFound(_0x3dcebf,_0x578b00){return function(_0x3b0aee){if(!_0x3b0aee){_0x3dcebf[_0x4538('0x26')](0x194);}return _0x3b0aee;};}function handleError(_0x2b6348,_0x66a7cf){_0x66a7cf=_0x66a7cf||0x1f4;return function(_0x32fc8c){logger['error'](_0x32fc8c[_0x4538('0x27')]);if(_0x32fc8c[_0x4538('0x28')]){delete _0x32fc8c[_0x4538('0x28')];}_0x2b6348[_0x4538('0x19')](_0x66a7cf)[_0x4538('0x29')](_0x32fc8c);};}exports[_0x4538('0x2a')]=function(_0xefcd16,_0x3a9455){var _0x51d563={},_0x4248b8={},_0x1a8157={'count':0x0,'rows':[]};var _0x174d90=_[_0x4538('0x2b')](db[_0x4538('0x2c')][_0x4538('0x2d')],function(_0x22627a){return{'name':_0x22627a[_0x4538('0x2e')],'type':_0x22627a[_0x4538('0x2f')][_0x4538('0x30')]};});_0x4248b8[_0x4538('0x31')]=_['map'](_0x174d90,_0x4538('0x28'));_0x4248b8['query']=_[_0x4538('0x32')](_0xefcd16[_0x4538('0x33')]);_0x4248b8['filters']=_['intersection'](_0x4248b8[_0x4538('0x31')],_0x4248b8[_0x4538('0x33')]);_0x51d563['attributes']=_[_0x4538('0x34')](_0x4248b8[_0x4538('0x31')],qs['fields'](_0xefcd16[_0x4538('0x33')][_0x4538('0x35')]));_0x51d563[_0x4538('0x36')]=_0x51d563[_0x4538('0x36')][_0x4538('0x37')]?_0x51d563[_0x4538('0x36')]:_0x4248b8[_0x4538('0x31')];if(!_0xefcd16[_0x4538('0x33')][_0x4538('0x38')](_0x4538('0x39'))){_0x51d563[_0x4538('0x1d')]=qs[_0x4538('0x1d')](_0xefcd16[_0x4538('0x33')]['limit']);_0x51d563[_0x4538('0x1b')]=qs['offset'](_0xefcd16[_0x4538('0x33')]['offset']);}_0x51d563[_0x4538('0x3a')]=qs[_0x4538('0x3b')](_0xefcd16[_0x4538('0x33')][_0x4538('0x3b')]);_0x51d563['where']=qs[_0x4538('0x3c')](_[_0x4538('0x3d')](_0xefcd16[_0x4538('0x33')],_0x4248b8['filters']),_0x174d90);if(_0xefcd16[_0x4538('0x33')][_0x4538('0x3e')]){_0x51d563[_0x4538('0x3f')]=_[_0x4538('0x40')](_0x51d563['where'],{'$or':_[_0x4538('0x2b')](_0x174d90,function(_0x272633){if(_0x272633[_0x4538('0x2f')]!==_0x4538('0x41')){var _0x41b485={};_0x41b485[_0x272633['name']]={'$like':'%'+_0xefcd16[_0x4538('0x33')]['filter']+'%'};return _0x41b485;}})});}_0x51d563=_[_0x4538('0x40')]({},_0x51d563,_0xefcd16['options']);var _0x63ae6d={'where':_0x51d563[_0x4538('0x3f')]};return db[_0x4538('0x2c')][_0x4538('0x1e')](_0x63ae6d)[_0x4538('0x24')](function(_0x39a76c){_0x1a8157[_0x4538('0x1e')]=_0x39a76c;if(_0xefcd16['query'][_0x4538('0x42')]){_0x51d563[_0x4538('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0x4538('0x44')](_0x51d563);})[_0x4538('0x24')](function(_0x2b6404){_0x1a8157[_0x4538('0x45')]=_0x2b6404;return _0x1a8157;})[_0x4538('0x24')](respondWithFilteredResult(_0x3a9455,_0x51d563))[_0x4538('0x46')](handleError(_0x3a9455,null));};exports['show']=function(_0x3d039c,_0x21656e){var _0x1896fb={'raw':!![],'where':{'id':_0x3d039c[_0x4538('0x47')]['id']}},_0x26fe9c={};_0x26fe9c['model']=_[_0x4538('0x32')](db[_0x4538('0x2c')][_0x4538('0x2d')]);_0x26fe9c[_0x4538('0x33')]=_[_0x4538('0x32')](_0x3d039c[_0x4538('0x33')]);_0x26fe9c['filters']=_[_0x4538('0x34')](_0x26fe9c[_0x4538('0x31')],_0x26fe9c[_0x4538('0x33')]);_0x1896fb['attributes']=_['intersection'](_0x26fe9c[_0x4538('0x31')],qs[_0x4538('0x35')](_0x3d039c[_0x4538('0x33')][_0x4538('0x35')]));_0x1896fb[_0x4538('0x36')]=_0x1896fb[_0x4538('0x36')]['length']?_0x1896fb[_0x4538('0x36')]:_0x26fe9c['model'];if(_0x3d039c['query'][_0x4538('0x42')]){_0x1896fb[_0x4538('0x43')]=[{'all':!![]}];}_0x1896fb=_[_0x4538('0x40')]({},_0x1896fb,_0x3d039c[_0x4538('0x48')]);return db[_0x4538('0x2c')]['find'](_0x1896fb)['then'](handleEntityNotFound(_0x21656e,null))[_0x4538('0x24')](respondWithResult(_0x21656e,null))['catch'](handleError(_0x21656e,null));};exports['create']=function(_0x3029d8,_0x5629dd){return db['VtigerField']['create'](_0x3029d8['body'],{})[_0x4538('0x24')](respondWithResult(_0x5629dd,0xc9))[_0x4538('0x46')](handleError(_0x5629dd,null));};exports['update']=function(_0x380172,_0x434502){if(_0x380172['body']['id']){delete _0x380172[_0x4538('0x49')]['id'];}return db['VtigerField'][_0x4538('0x4a')]({'where':{'id':_0x380172[_0x4538('0x47')]['id']}})[_0x4538('0x24')](handleEntityNotFound(_0x434502,null))['then'](saveUpdates(_0x380172['body'],null))[_0x4538('0x24')](respondWithResult(_0x434502,null))['catch'](handleError(_0x434502,null));};exports[_0x4538('0x25')]=function(_0x1f5d5d,_0x53a6ac){return db[_0x4538('0x2c')][_0x4538('0x4a')]({'where':{'id':_0x1f5d5d[_0x4538('0x47')]['id']}})[_0x4538('0x24')](handleEntityNotFound(_0x53a6ac,null))['then'](removeEntity(_0x53a6ac,null))['catch'](handleError(_0x53a6ac,null));}; \ No newline at end of file +var _0xbd7f=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','VtigerField','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xbd7f,0x155));var _0xfbd7=function(_0x3f7de3,_0x5ae511){_0x3f7de3=_0x3f7de3-0x0;var _0x5573f4=_0xbd7f[_0x3f7de3];return _0x5573f4;};'use strict';var emlformat=require(_0xfbd7('0x0'));var rimraf=require(_0xfbd7('0x1'));var zipdir=require(_0xfbd7('0x2'));var jsonpatch=require(_0xfbd7('0x3'));var rp=require(_0xfbd7('0x4'));var moment=require(_0xfbd7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbd7('0x6'));var util=require(_0xfbd7('0x7'));var path=require(_0xfbd7('0x8'));var sox=require(_0xfbd7('0x9'));var csv=require('to-csv');var ejs=require(_0xfbd7('0xa'));var fs=require('fs');var fs_extra=require(_0xfbd7('0xb'));var _=require(_0xfbd7('0xc'));var squel=require('squel');var crypto=require(_0xfbd7('0xd'));var jsforce=require(_0xfbd7('0xe'));var deskjs=require(_0xfbd7('0xf'));var toCsv=require(_0xfbd7('0x10'));var querystring=require('querystring');var Papa=require(_0xfbd7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbd7('0x12'));var as=require(_0xfbd7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd7('0x14'))('api');var utils=require(_0xfbd7('0x15'));var config=require(_0xfbd7('0x16'));var licenseUtil=require(_0xfbd7('0x17'));var db=require(_0xfbd7('0x18'))['db'];function respondWithStatusCode(_0x3d70e9,_0x66ae54){_0x66ae54=_0x66ae54||0xcc;return function(_0x188509){if(_0x188509){return _0x3d70e9[_0xfbd7('0x19')](_0x66ae54);}return _0x3d70e9[_0xfbd7('0x1a')](_0x66ae54)[_0xfbd7('0x1b')]();};}function respondWithResult(_0x3fe851,_0x41c6f6){_0x41c6f6=_0x41c6f6||0xc8;return function(_0x49d4ae){if(_0x49d4ae){return _0x3fe851[_0xfbd7('0x1a')](_0x41c6f6)[_0xfbd7('0x1c')](_0x49d4ae);}};}function respondWithFilteredResult(_0x19c1ee,_0x3e994f){return function(_0x263eb9){if(_0x263eb9){var _0x3ebcc6=typeof _0x3e994f['offset']===_0xfbd7('0x1d')&&typeof _0x3e994f[_0xfbd7('0x1e')]===_0xfbd7('0x1d');var _0x176b6b=_0x263eb9['count'];var _0x2190e4=_0x3ebcc6?0x0:_0x3e994f['offset'];var _0x11d684=_0x3ebcc6?_0x263eb9[_0xfbd7('0x1f')]:_0x3e994f[_0xfbd7('0x20')]+_0x3e994f[_0xfbd7('0x1e')];var _0x5c5d88;if(_0x11d684>=_0x176b6b){_0x11d684=_0x176b6b;_0x5c5d88=0xc8;}else{_0x5c5d88=0xce;}_0x19c1ee[_0xfbd7('0x1a')](_0x5c5d88);return _0x19c1ee[_0xfbd7('0x21')](_0xfbd7('0x22'),_0x2190e4+'-'+_0x11d684+'/'+_0x176b6b)['json'](_0x263eb9);}return null;};}function patchUpdates(_0x246450){return function(_0xb22207){try{jsonpatch['apply'](_0xb22207,_0x246450,!![]);}catch(_0x5ed9d3){return BPromise[_0xfbd7('0x23')](_0x5ed9d3);}return _0xb22207[_0xfbd7('0x24')]();};}function saveUpdates(_0x201c29,_0x31176e){return function(_0x448567){if(_0x448567){return _0x448567[_0xfbd7('0x25')](_0x201c29)[_0xfbd7('0x26')](function(_0x39d76){return _0x39d76;});}return null;};}function removeEntity(_0x2d5c0c,_0x2f69b9){return function(_0x126b4c){if(_0x126b4c){return _0x126b4c['destroy']()[_0xfbd7('0x26')](function(){_0x2d5c0c[_0xfbd7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9f4fa,_0x348d03){return function(_0x39b405){if(!_0x39b405){_0xe9f4fa[_0xfbd7('0x19')](0x194);}return _0x39b405;};}function handleError(_0x501d75,_0x1698b9){_0x1698b9=_0x1698b9||0x1f4;return function(_0x4b12ea){logger['error'](_0x4b12ea[_0xfbd7('0x27')]);if(_0x4b12ea[_0xfbd7('0x28')]){delete _0x4b12ea['name'];}_0x501d75[_0xfbd7('0x1a')](_0x1698b9)[_0xfbd7('0x29')](_0x4b12ea);};}exports[_0xfbd7('0x2a')]=function(_0x5a9525,_0x31aab5){var _0x5ce6b7={},_0x485a71={},_0x2ced66={'count':0x0,'rows':[]};var _0x119e3a=_[_0xfbd7('0x2b')](db['VtigerField'][_0xfbd7('0x2c')],function(_0x2741e6){return{'name':_0x2741e6['fieldName'],'type':_0x2741e6[_0xfbd7('0x2d')][_0xfbd7('0x2e')]};});_0x485a71[_0xfbd7('0x2f')]=_[_0xfbd7('0x2b')](_0x119e3a,'name');_0x485a71[_0xfbd7('0x30')]=_[_0xfbd7('0x31')](_0x5a9525[_0xfbd7('0x30')]);_0x485a71[_0xfbd7('0x32')]=_[_0xfbd7('0x33')](_0x485a71['model'],_0x485a71[_0xfbd7('0x30')]);_0x5ce6b7[_0xfbd7('0x34')]=_[_0xfbd7('0x33')](_0x485a71[_0xfbd7('0x2f')],qs[_0xfbd7('0x35')](_0x5a9525['query']['fields']));_0x5ce6b7[_0xfbd7('0x34')]=_0x5ce6b7['attributes']['length']?_0x5ce6b7[_0xfbd7('0x34')]:_0x485a71[_0xfbd7('0x2f')];if(!_0x5a9525['query'][_0xfbd7('0x36')]('nolimit')){_0x5ce6b7['limit']=qs[_0xfbd7('0x1e')](_0x5a9525[_0xfbd7('0x30')][_0xfbd7('0x1e')]);_0x5ce6b7['offset']=qs[_0xfbd7('0x20')](_0x5a9525[_0xfbd7('0x30')][_0xfbd7('0x20')]);}_0x5ce6b7[_0xfbd7('0x37')]=qs['sort'](_0x5a9525[_0xfbd7('0x30')]['sort']);_0x5ce6b7['where']=qs['filters'](_[_0xfbd7('0x38')](_0x5a9525[_0xfbd7('0x30')],_0x485a71[_0xfbd7('0x32')]),_0x119e3a);if(_0x5a9525['query'][_0xfbd7('0x39')]){_0x5ce6b7[_0xfbd7('0x3a')]=_[_0xfbd7('0x3b')](_0x5ce6b7[_0xfbd7('0x3a')],{'$or':_[_0xfbd7('0x2b')](_0x119e3a,function(_0x27cb14){if(_0x27cb14[_0xfbd7('0x2d')]!==_0xfbd7('0x3c')){var _0x225cda={};_0x225cda[_0x27cb14[_0xfbd7('0x28')]]={'$like':'%'+_0x5a9525['query'][_0xfbd7('0x39')]+'%'};return _0x225cda;}})});}_0x5ce6b7=_[_0xfbd7('0x3b')]({},_0x5ce6b7,_0x5a9525['options']);var _0x11bf95={'where':_0x5ce6b7[_0xfbd7('0x3a')]};return db[_0xfbd7('0x3d')][_0xfbd7('0x1f')](_0x11bf95)[_0xfbd7('0x26')](function(_0x128c8c){_0x2ced66[_0xfbd7('0x1f')]=_0x128c8c;if(_0x5a9525[_0xfbd7('0x30')][_0xfbd7('0x3e')]){_0x5ce6b7[_0xfbd7('0x3f')]=[{'all':!![]}];}return db[_0xfbd7('0x3d')][_0xfbd7('0x40')](_0x5ce6b7);})[_0xfbd7('0x26')](function(_0x41b343){_0x2ced66[_0xfbd7('0x41')]=_0x41b343;return _0x2ced66;})['then'](respondWithFilteredResult(_0x31aab5,_0x5ce6b7))[_0xfbd7('0x42')](handleError(_0x31aab5,null));};exports[_0xfbd7('0x43')]=function(_0x25bc25,_0x1166a7){var _0x2d9ca9={'raw':!![],'where':{'id':_0x25bc25[_0xfbd7('0x44')]['id']}},_0x231424={};_0x231424[_0xfbd7('0x2f')]=_[_0xfbd7('0x31')](db[_0xfbd7('0x3d')][_0xfbd7('0x2c')]);_0x231424[_0xfbd7('0x30')]=_[_0xfbd7('0x31')](_0x25bc25[_0xfbd7('0x30')]);_0x231424['filters']=_[_0xfbd7('0x33')](_0x231424[_0xfbd7('0x2f')],_0x231424[_0xfbd7('0x30')]);_0x2d9ca9[_0xfbd7('0x34')]=_['intersection'](_0x231424[_0xfbd7('0x2f')],qs['fields'](_0x25bc25['query'][_0xfbd7('0x35')]));_0x2d9ca9[_0xfbd7('0x34')]=_0x2d9ca9[_0xfbd7('0x34')]['length']?_0x2d9ca9[_0xfbd7('0x34')]:_0x231424[_0xfbd7('0x2f')];if(_0x25bc25[_0xfbd7('0x30')][_0xfbd7('0x3e')]){_0x2d9ca9['include']=[{'all':!![]}];}_0x2d9ca9=_['merge']({},_0x2d9ca9,_0x25bc25[_0xfbd7('0x45')]);return db['VtigerField'][_0xfbd7('0x46')](_0x2d9ca9)['then'](handleEntityNotFound(_0x1166a7,null))[_0xfbd7('0x26')](respondWithResult(_0x1166a7,null))['catch'](handleError(_0x1166a7,null));};exports['create']=function(_0x323451,_0x99327e){return db[_0xfbd7('0x3d')]['create'](_0x323451[_0xfbd7('0x47')],{})[_0xfbd7('0x26')](respondWithResult(_0x99327e,0xc9))[_0xfbd7('0x42')](handleError(_0x99327e,null));};exports[_0xfbd7('0x25')]=function(_0x56e564,_0x31afe4){if(_0x56e564[_0xfbd7('0x47')]['id']){delete _0x56e564[_0xfbd7('0x47')]['id'];}return db[_0xfbd7('0x3d')][_0xfbd7('0x46')]({'where':{'id':_0x56e564['params']['id']}})[_0xfbd7('0x26')](handleEntityNotFound(_0x31afe4,null))[_0xfbd7('0x26')](saveUpdates(_0x56e564['body'],null))[_0xfbd7('0x26')](respondWithResult(_0x31afe4,null))[_0xfbd7('0x42')](handleError(_0x31afe4,null));};exports[_0xfbd7('0x48')]=function(_0x25880a,_0x60da49){return db[_0xfbd7('0x3d')][_0xfbd7('0x46')]({'where':{'id':_0x25880a[_0xfbd7('0x44')]['id']}})[_0xfbd7('0x26')](handleEntityNotFound(_0x60da49,null))['then'](removeEntity(_0x60da49,null))['catch'](handleError(_0x60da49,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9f132d9..aa6a27f 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 _0x2686=['./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50562e,_0x410e63){var _0x330725=function(_0x2faf38){while(--_0x2faf38){_0x50562e['push'](_0x50562e['shift']());}};_0x330725(++_0x410e63);}(_0x2686,0x10f));var _0x6268=function(_0xfad01,_0x1d786b){_0xfad01=_0xfad01-0x0;var _0x350858=_0x2686[_0xfad01];return _0x350858;};'use strict';var _=require(_0x6268('0x0'));var util=require('util');var logger=require(_0x6268('0x1'))(_0x6268('0x2'));var moment=require(_0x6268('0x3'));var BPromise=require(_0x6268('0x4'));var rp=require(_0x6268('0x5'));var fs=require('fs');var path=require(_0x6268('0x6'));var rimraf=require(_0x6268('0x7'));var config=require(_0x6268('0x8'));var attributes=require(_0x6268('0x9'));module[_0x6268('0xa')]=function(_0x3a40c5,_0x23edea){return _0x3a40c5[_0x6268('0xb')](_0x6268('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6268('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xead7=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','api','moment','request-promise'];(function(_0xe86a92,_0x1cf6e5){var _0x30395f=function(_0x3ae04b){while(--_0x3ae04b){_0xe86a92['push'](_0xe86a92['shift']());}};_0x30395f(++_0x1cf6e5);}(_0xead7,0x101));var _0x7ead=function(_0x424def,_0x2ae846){_0x424def=_0x424def-0x0;var _0x28bb3e=_0xead7[_0x424def];return _0x28bb3e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7ead('0x0'));var moment=require(_0x7ead('0x1'));var BPromise=require('bluebird');var rp=require(_0x7ead('0x2'));var fs=require('fs');var path=require(_0x7ead('0x3'));var rimraf=require(_0x7ead('0x4'));var config=require(_0x7ead('0x5'));var attributes=require(_0x7ead('0x6'));module[_0x7ead('0x7')]=function(_0x3cd454,_0x1d8a16){return _0x3cd454[_0x7ead('0x8')](_0x7ead('0x9'),attributes,{'tableName':_0x7ead('0xa'),'paranoid':![],'indexes':[{'name':_0x7ead('0xb'),'fields':[_0x7ead('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 580b876..118fd28 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 _0x8b72=['error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','code'];(function(_0x568067,_0x4a0ad0){var _0x34790c=function(_0x403f29){while(--_0x403f29){_0x568067['push'](_0x568067['shift']());}};_0x34790c(++_0x4a0ad0);}(_0x8b72,0x18c));var _0x28b7=function(_0x4a0b0f,_0x2880ed){_0x4a0b0f=_0x4a0b0f-0x0;var _0x5b937d=_0x8b72[_0x4a0b0f];return _0x5b937d;};'use strict';var _=require(_0x28b7('0x0'));var util=require(_0x28b7('0x1'));var moment=require(_0x28b7('0x2'));var BPromise=require(_0x28b7('0x3'));var rs=require(_0x28b7('0x4'));var fs=require('fs');var Redis=require(_0x28b7('0x5'));var db=require(_0x28b7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28b7('0x7'));var config=require(_0x28b7('0x8'));var jayson=require(_0x28b7('0x9'));var client=jayson[_0x28b7('0xa')][_0x28b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbc7162,_0x18d211,_0x119dac){return new BPromise(function(_0x50bdd3,_0x4c12f7){return client[_0x28b7('0xc')](_0xbc7162,_0x119dac)[_0x28b7('0xd')](function(_0x45f750){logger[_0x28b7('0xe')]('VtigerField,\x20%s,\x20%s',_0x18d211,'request\x20sent');logger['debug'](_0x28b7('0xf'),_0x18d211,_0x28b7('0x10'),JSON['stringify'](_0x45f750));if(_0x45f750['error']){if(_0x45f750['error'][_0x28b7('0x11')]===0x1f4){logger[_0x28b7('0x12')](_0x28b7('0x13'),_0x18d211,_0x45f750[_0x28b7('0x12')]['message']);return _0x4c12f7(_0x45f750[_0x28b7('0x12')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x18d211,_0x45f750[_0x28b7('0x12')][_0x28b7('0x14')]);return _0x50bdd3(_0x45f750[_0x28b7('0x12')][_0x28b7('0x14')]);}else{logger[_0x28b7('0xe')](_0x28b7('0x13'),_0x18d211,'request\x20sent');_0x50bdd3(_0x45f750[_0x28b7('0x15')][_0x28b7('0x14')]);}})[_0x28b7('0x16')](function(_0x67bf31){logger['error'](_0x28b7('0x13'),_0x18d211,_0x67bf31);_0x4c12f7(_0x67bf31);});});} \ No newline at end of file +var _0x7130=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment'];(function(_0x198975,_0x3c255c){var _0x167c20=function(_0x2b015a){while(--_0x2b015a){_0x198975['push'](_0x198975['shift']());}};_0x167c20(++_0x3c255c);}(_0x7130,0x14e));var _0x0713=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7130[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x0713('0x0'));var util=require('util');var moment=require(_0x0713('0x1'));var BPromise=require(_0x0713('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0713('0x3'));var db=require(_0x0713('0x4'))['db'];var utils=require(_0x0713('0x5'));var logger=require(_0x0713('0x6'))(_0x0713('0x7'));var config=require(_0x0713('0x8'));var jayson=require(_0x0713('0x9'));var client=jayson[_0x0713('0xa')][_0x0713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48fd83,_0x4f7126,_0x1a4421){return new BPromise(function(_0x4264a2,_0x2a0723){return client[_0x0713('0xc')](_0x48fd83,_0x1a4421)[_0x0713('0xd')](function(_0x2a483e){logger[_0x0713('0xe')](_0x0713('0xf'),_0x4f7126,_0x0713('0x10'));logger[_0x0713('0x11')](_0x0713('0x12'),_0x4f7126,_0x0713('0x10'),JSON['stringify'](_0x2a483e));if(_0x2a483e[_0x0713('0x13')]){if(_0x2a483e[_0x0713('0x13')][_0x0713('0x14')]===0x1f4){logger['error'](_0x0713('0xf'),_0x4f7126,_0x2a483e['error'][_0x0713('0x15')]);return _0x2a0723(_0x2a483e[_0x0713('0x13')][_0x0713('0x15')]);}logger[_0x0713('0x13')](_0x0713('0xf'),_0x4f7126,_0x2a483e[_0x0713('0x13')][_0x0713('0x15')]);return _0x4264a2(_0x2a483e[_0x0713('0x13')][_0x0713('0x15')]);}else{logger['info'](_0x0713('0xf'),_0x4f7126,_0x0713('0x10'));_0x4264a2(_0x2a483e[_0x0713('0x16')][_0x0713('0x15')]);}})[_0x0713('0x17')](function(_0x42a136){logger['error'](_0x0713('0xf'),_0x4f7126,_0x42a136);_0x2a0723(_0x42a136);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e0ed9b4..9f69730 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 _0xfaf5=['./intZendeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x478b46,_0x19b712){var _0x3493bf=function(_0x295168){while(--_0x295168){_0x478b46['push'](_0x478b46['shift']());}};_0x3493bf(++_0x19b712);}(_0xfaf5,0xe7));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5faf('0x0'));var util=require(_0x5faf('0x1'));var path=require('path');var timeout=require(_0x5faf('0x2'));var express=require(_0x5faf('0x3'));var router=express[_0x5faf('0x4')]();var fs_extra=require(_0x5faf('0x5'));var auth=require(_0x5faf('0x6'));var interaction=require(_0x5faf('0x7'));var config=require(_0x5faf('0x8'));var controller=require(_0x5faf('0x9'));router['get']('/',auth[_0x5faf('0xa')](),controller['index']);router[_0x5faf('0xb')](_0x5faf('0xc'),auth[_0x5faf('0xa')](),controller[_0x5faf('0xd')]);router[_0x5faf('0xb')](_0x5faf('0xe'),auth[_0x5faf('0xa')](),controller[_0x5faf('0xf')]);router['get'](_0x5faf('0x10'),auth[_0x5faf('0xa')](),controller[_0x5faf('0x11')]);router[_0x5faf('0x12')]('/',auth[_0x5faf('0xa')](),controller[_0x5faf('0x13')]);router[_0x5faf('0x12')](_0x5faf('0xe'),auth['isAuthenticated'](),controller[_0x5faf('0x14')]);router[_0x5faf('0x15')](_0x5faf('0xc'),auth[_0x5faf('0xa')](),controller['update']);router[_0x5faf('0x16')]('/:id',auth[_0x5faf('0xa')](),controller['destroy']);module[_0x5faf('0x17')]=router; \ No newline at end of file +var _0x97e9=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','/:id','destroy','exports','multer','util'];(function(_0x3b3f36,_0x52a412){var _0x188751=function(_0x5d9133){while(--_0x5d9133){_0x3b3f36['push'](_0x3b3f36['shift']());}};_0x188751(++_0x52a412);}(_0x97e9,0x15c));var _0x997e=function(_0x3f7244,_0x129435){_0x3f7244=_0x3f7244-0x0;var _0x256ed2=_0x97e9[_0x3f7244];return _0x256ed2;};'use strict';var multer=require(_0x997e('0x0'));var util=require(_0x997e('0x1'));var path=require(_0x997e('0x2'));var timeout=require(_0x997e('0x3'));var express=require(_0x997e('0x4'));var router=express[_0x997e('0x5')]();var fs_extra=require(_0x997e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x997e('0x7'));var config=require(_0x997e('0x8'));var controller=require(_0x997e('0x9'));router[_0x997e('0xa')]('/',auth['isAuthenticated'](),controller[_0x997e('0xb')]);router[_0x997e('0xa')]('/:id',auth[_0x997e('0xc')](),controller[_0x997e('0xd')]);router['get'](_0x997e('0xe'),auth[_0x997e('0xc')](),controller[_0x997e('0xf')]);router['get'](_0x997e('0x10'),auth[_0x997e('0xc')](),controller[_0x997e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x997e('0x12')]);router[_0x997e('0x13')](_0x997e('0xe'),auth[_0x997e('0xc')](),controller[_0x997e('0x14')]);router['put']('/:id',auth[_0x997e('0xc')](),controller[_0x997e('0x15')]);router['delete'](_0x997e('0x16'),auth['isAuthenticated'](),controller[_0x997e('0x17')]);module[_0x997e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6d059da..dafd123 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 _0x9582=['remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING','username'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0x9582,0x95));var _0x2958=function(_0x24cead,_0x446cbc){_0x24cead=_0x24cead-0x0;var _0x2dd8bd=_0x9582[_0x24cead];return _0x2dd8bd;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2958('0x2')]},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'authType':{'type':Sequelize[_0x2958('0x5')](_0x2958('0x6'),_0x2958('0x7')),'defaultValue':_0x2958('0x6')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2958('0x5')](_0x2958('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x01a6=['newTab','integrationTab','sequelize','STRING','username','ENUM','password','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01a6,0x162));var _0x601a=function(_0x4a9301,_0x25316e){_0x4a9301=_0x4a9301-0x0;var _0x31a333=_0x01a6[_0x4a9301];return _0x31a333;};'use strict';var Sequelize=require(_0x601a('0x0'));module['exports']={'name':{'type':Sequelize[_0x601a('0x1')]},'description':{'type':Sequelize[_0x601a('0x1')]},'username':{'type':Sequelize[_0x601a('0x1')],'unique':_0x601a('0x2')},'password':{'type':Sequelize[_0x601a('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x601a('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x601a('0x3')](_0x601a('0x4'),_0x601a('0x5')),'defaultValue':_0x601a('0x4')},'serverUrl':{'type':Sequelize[_0x601a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x601a('0x6')),'defaultValue':_0x601a('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f79d9a4..b80b0a7 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 _0xa902=['%s:%s','base64','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','sort','map','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','findOne','username','password','remoteUri','slice','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s'];(function(_0x29a9a7,_0x43e7e9){var _0x55e01f=function(_0x1ce683){while(--_0x1ce683){_0x29a9a7['push'](_0x29a9a7['shift']());}};_0x55e01f(++_0x43e7e9);}(_0xa902,0x8d));var _0x2a90=function(_0x19019f,_0x32d35f){_0x19019f=_0x19019f-0x0;var _0x289b57=_0xa902[_0x19019f];return _0x289b57;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f6953,_0x57aee3){_0x57aee3=_0x57aee3||0xcc;return function(_0x407ce5){if(_0x407ce5){return _0x1f6953[_0x2a90('0x17')](_0x57aee3);}return _0x1f6953[_0x2a90('0x18')](_0x57aee3)['end']();};}function respondWithResult(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xc8;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x18')](_0x57227c)['json'](_0x46cb32);}};}function respondWithFilteredResult(_0x1ff63d,_0x21c648){return function(_0x312782){if(_0x312782){var _0x25bd0e=typeof _0x21c648[_0x2a90('0x19')]===_0x2a90('0x1a')&&typeof _0x21c648[_0x2a90('0x1b')]===_0x2a90('0x1a');var _0x43eea5=_0x312782['count'];var _0x162f0b=_0x25bd0e?0x0:_0x21c648[_0x2a90('0x19')];var _0x4190ff=_0x25bd0e?_0x312782['count']:_0x21c648[_0x2a90('0x19')]+_0x21c648[_0x2a90('0x1b')];var _0x148d18;if(_0x4190ff>=_0x43eea5){_0x4190ff=_0x43eea5;_0x148d18=0xc8;}else{_0x148d18=0xce;}_0x1ff63d[_0x2a90('0x18')](_0x148d18);return _0x1ff63d[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x162f0b+'-'+_0x4190ff+'/'+_0x43eea5)[_0x2a90('0x1e')](_0x312782);}return null;};}function patchUpdates(_0x114d42){return function(_0xf97adb){try{jsonpatch[_0x2a90('0x1f')](_0xf97adb,_0x114d42,!![]);}catch(_0x1340b9){return BPromise[_0x2a90('0x20')](_0x1340b9);}return _0xf97adb['save']();};}function saveUpdates(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x21')](_0x3da7d0)['then'](function(_0x180485){return _0x180485;});}return null;};}function removeEntity(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(_0x1bcfd7){return _0x1bcfd7[_0x2a90('0x22')]()[_0x2a90('0x23')](function(){_0xd033d[_0x2a90('0x18')](0xcc)[_0x2a90('0x24')]();});}};}function handleEntityNotFound(_0x1303d9,_0x29ed73){return function(_0x24a6d3){if(!_0x24a6d3){_0x1303d9['sendStatus'](0x194);}return _0x24a6d3;};}function handleError(_0x27f883,_0x17f978){_0x17f978=_0x17f978||0x1f4;return function(_0x3934d4){logger[_0x2a90('0x25')](_0x3934d4[_0x2a90('0x26')]);if(_0x3934d4['name']){delete _0x3934d4['name'];}_0x27f883[_0x2a90('0x18')](_0x17f978)['send'](_0x3934d4);};}exports['index']=function(_0x4969c3,_0x2d83b3){var _0x3c78f5={},_0x595638={},_0x5bd700={'count':0x0,'rows':[]};var _0x1add9a=_['map'](db[_0x2a90('0x27')][_0x2a90('0x28')],function(_0x3b580f){return{'name':_0x3b580f[_0x2a90('0x29')],'type':_0x3b580f[_0x2a90('0x2a')][_0x2a90('0x2b')]};});_0x595638[_0x2a90('0x2c')]=_['map'](_0x1add9a,_0x2a90('0x2d'));_0x595638[_0x2a90('0x2e')]=_[_0x2a90('0x2f')](_0x4969c3['query']);_0x595638[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],_0x595638[_0x2a90('0x2e')]);_0x3c78f5['attributes']=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],qs[_0x2a90('0x32')](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x3c78f5[_0x2a90('0x33')]=_0x3c78f5['attributes'][_0x2a90('0x34')]?_0x3c78f5[_0x2a90('0x33')]:_0x595638[_0x2a90('0x2c')];if(!_0x4969c3[_0x2a90('0x2e')]['hasOwnProperty'](_0x2a90('0x35'))){_0x3c78f5[_0x2a90('0x1b')]=qs['limit'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x1b')]);_0x3c78f5['offset']=qs['offset'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x19')]);}_0x3c78f5[_0x2a90('0x36')]=qs['sort'](_0x4969c3[_0x2a90('0x2e')]['sort']);_0x3c78f5[_0x2a90('0x37')]=qs['filters'](_[_0x2a90('0x38')](_0x4969c3['query'],_0x595638['filters']),_0x1add9a);if(_0x4969c3[_0x2a90('0x2e')]['filter']){_0x3c78f5[_0x2a90('0x37')]=_[_0x2a90('0x39')](_0x3c78f5[_0x2a90('0x37')],{'$or':_['map'](_0x1add9a,function(_0x57a2a5){if(_0x57a2a5[_0x2a90('0x2a')]!==_0x2a90('0x3a')){var _0x4eb7d9={};_0x4eb7d9[_0x57a2a5[_0x2a90('0x2d')]]={'$like':'%'+_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x4eb7d9;}})});}_0x3c78f5=_['merge']({},_0x3c78f5,_0x4969c3[_0x2a90('0x3c')]);var _0x1db9d8={'where':_0x3c78f5['where']};return db[_0x2a90('0x27')][_0x2a90('0x3d')](_0x1db9d8)[_0x2a90('0x23')](function(_0x28f289){_0x5bd700[_0x2a90('0x3d')]=_0x28f289;if(_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x3c78f5[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x27')][_0x2a90('0x40')](_0x3c78f5);})[_0x2a90('0x23')](function(_0x3dba8a){_0x5bd700[_0x2a90('0x41')]=_0x3dba8a;return _0x5bd700;})[_0x2a90('0x23')](respondWithFilteredResult(_0x2d83b3,_0x3c78f5))['catch'](handleError(_0x2d83b3,null));};exports[_0x2a90('0x42')]=function(_0x3a70fe,_0x528b41){var _0x1045bb={'raw':![],'where':{'id':_0x3a70fe[_0x2a90('0x43')]['id']}},_0x1e971c={};_0x1e971c[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskAccount'][_0x2a90('0x28')]);_0x1e971c['query']=_[_0x2a90('0x2f')](_0x3a70fe['query']);_0x1e971c[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],_0x1e971c[_0x2a90('0x2e')]);_0x1045bb[_0x2a90('0x33')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],qs['fields'](_0x3a70fe['query'][_0x2a90('0x32')]));_0x1045bb[_0x2a90('0x33')]=_0x1045bb[_0x2a90('0x33')][_0x2a90('0x34')]?_0x1045bb[_0x2a90('0x33')]:_0x1e971c[_0x2a90('0x2c')];if(_0x3a70fe[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x1045bb['include']=[{'all':!![]}];}_0x1045bb=_[_0x2a90('0x39')]({},_0x1045bb,_0x3a70fe['options']);return db[_0x2a90('0x27')][_0x2a90('0x44')](_0x1045bb)['then'](handleEntityNotFound(_0x528b41,null))[_0x2a90('0x23')](respondWithResult(_0x528b41,null))[_0x2a90('0x45')](handleError(_0x528b41,null));};exports[_0x2a90('0x46')]=function(_0x1d55db,_0x175d59){return db[_0x2a90('0x27')][_0x2a90('0x46')](_0x1d55db['body'],{})['then'](respondWithResult(_0x175d59,0xc9))[_0x2a90('0x45')](handleError(_0x175d59,null));};exports[_0x2a90('0x21')]=function(_0x42c890,_0x43266a){if(_0x42c890[_0x2a90('0x47')]['id']){delete _0x42c890['body']['id'];}return db['ZendeskAccount'][_0x2a90('0x44')]({'where':{'id':_0x42c890[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x43266a,null))['then'](saveUpdates(_0x42c890['body'],null))[_0x2a90('0x23')](respondWithResult(_0x43266a,null))['catch'](handleError(_0x43266a,null));};exports[_0x2a90('0x22')]=function(_0x3dfe72,_0x272d07){return db[_0x2a90('0x27')][_0x2a90('0x44')]({'where':{'id':_0x3dfe72[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x272d07,null))[_0x2a90('0x23')](removeEntity(_0x272d07,null))[_0x2a90('0x45')](handleError(_0x272d07,null));};exports['getConfigurations']=function(_0x265769,_0x4d1303,_0x4c8bae){var _0x46f687={};var _0xe47c6b={};var _0x5819ab;var _0x4c0cb2;return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0x265769[_0x2a90('0x43')]['id']}})[_0x2a90('0x23')](handleEntityNotFound(_0x4d1303,null))['then'](function(_0x366429){if(_0x366429){_0x5819ab=_0x366429;_0xe47c6b[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskConfiguration'][_0x2a90('0x28')]);_0xe47c6b[_0x2a90('0x2e')]=_['keys'](_0x265769['query']);_0xe47c6b[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0xe47c6b['model'],_0xe47c6b[_0x2a90('0x2e')]);_0x46f687['attributes']=_[_0x2a90('0x31')](_0xe47c6b['model'],qs[_0x2a90('0x32')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x46f687['attributes']=_0x46f687['attributes']['length']?_0x46f687[_0x2a90('0x33')]:_0xe47c6b[_0x2a90('0x2c')];_0x46f687[_0x2a90('0x36')]=qs[_0x2a90('0x48')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x48')]);_0x46f687[_0x2a90('0x37')]=qs[_0x2a90('0x30')](_[_0x2a90('0x38')](_0x265769[_0x2a90('0x2e')],_0xe47c6b[_0x2a90('0x30')]));if(_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]){_0x46f687['where']=_['merge'](_0x46f687['where'],{'$or':_[_0x2a90('0x49')](_0x46f687[_0x2a90('0x33')],function(_0x13270d){var _0x400aca={};_0x400aca[_0x13270d]={'$like':'%'+_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x400aca;})});}_0x46f687=_[_0x2a90('0x39')]({},_0x46f687,_0x265769[_0x2a90('0x3c')]);return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x50973b){if(_0x50973b){_0x4c0cb2=_0x50973b[_0x2a90('0x34')];if(!_0x265769[_0x2a90('0x2e')][_0x2a90('0x4b')](_0x2a90('0x35'))){_0x46f687[_0x2a90('0x1b')]=qs['limit'](_0x265769[_0x2a90('0x2e')]['limit']);_0x46f687[_0x2a90('0x19')]=qs[_0x2a90('0x19')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x19')]);}return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x44b211){if(_0x44b211){return _0x44b211?{'count':_0x4c0cb2,'rows':_0x44b211}:null;}})['then'](respondWithResult(_0x4d1303,null))[_0x2a90('0x45')](handleError(_0x4d1303,null));};exports[_0x2a90('0x4c')]=function(_0xf88bbb,_0x48f9fa,_0xa1234a){if(_0xf88bbb[_0x2a90('0x47')]['id']){delete _0xf88bbb[_0x2a90('0x47')]['id'];}return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0xf88bbb[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f9fa,null))[_0x2a90('0x23')](function(_0x94e9fb){if(_0x94e9fb){_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4d')]=_0x94e9fb['id'];_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4e')]=integrations['getSubjects'](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x2a')]);_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x50')]=integrations[_0x2a90('0x51')](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb['body'][_0x2a90('0x2a')]);return db[_0x2a90('0x52')][_0x2a90('0x46')](_0xf88bbb['body'],{'include':[{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x4e')},{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x50')}]});}return null;})[_0x2a90('0x23')](respondWithResult(_0x48f9fa,null))['catch'](handleError(_0x48f9fa,null));};exports[_0x2a90('0x54')]=function(_0x5e0bf2,_0x5a770b,_0x9fafd){var _0x4e1dcd='';return db['ZendeskAccount'][_0x2a90('0x55')]({'where':{'id':_0x5e0bf2['params']['id']},'attributes':['id',_0x2a90('0x56'),_0x2a90('0x57'),'token','authType',_0x2a90('0x58')]})['then'](handleEntityNotFound(_0x5a770b,null))['then'](function(_0xd52ae2){if(_0xd52ae2){_0x4e1dcd=_0xd52ae2[_0x2a90('0x58')];var _0x1db063=_0x4e1dcd[_0x2a90('0x59')](-0x1);if(_0x1db063==='/'){_0x4e1dcd=_0x4e1dcd['substring'](0x0,_0x4e1dcd['lastIndexOf'](_0x1db063));}var _0x370144={'method':_0x2a90('0x5a'),'uri':util[_0x2a90('0x5b')](_0x2a90('0x5c'),_0x4e1dcd,_0x2a90('0x5d')),'json':!![]};switch(_0xd52ae2[_0x2a90('0x5e')]){case _0x2a90('0x57'):_0x370144[_0x2a90('0x5f')]={'Authorization':util[_0x2a90('0x5b')](_0x2a90('0x60'),new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x61'),_0xd52ae2['username'],_0xd52ae2[_0x2a90('0x57')]))['toString'](_0x2a90('0x62')))};break;case'token':_0x370144[_0x2a90('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x63'),_0xd52ae2[_0x2a90('0x56')],_0xd52ae2[_0x2a90('0x64')]))['toString']('base64'))};break;default:throw new db[(_0x2a90('0x65'))][(_0x2a90('0x66'))](_0x2a90('0x67'));}return rp(_0x370144);}})[_0x2a90('0x23')](function(_0x59b9e6){if(_0x59b9e6){var _0x3b0d5e=[_0x2a90('0x68'),_0x2a90('0x69'),_0x2a90('0x6a'),_0x2a90('0x6b')];_[_0x2a90('0x6c')](_0x59b9e6[_0x2a90('0x5d')],function(_0x4d46f5){return _0x3b0d5e[_0x2a90('0x6d')](_0x4d46f5[_0x2a90('0x2a')]);});return{'count':_0x59b9e6[_0x2a90('0x5d')][_0x2a90('0x34')],'rows':_[_0x2a90('0x49')](_0x59b9e6[_0x2a90('0x5d')],function(_0x1bbadd){return{'id':_0x1bbadd['id'],'name':_0x1bbadd[_0x2a90('0x6e')]>0x7?_0x1bbadd['title']:_0x1bbadd[_0x2a90('0x2a')],'custom':_0x1bbadd[_0x2a90('0x6e')]>0x7?!![]:![],'options':_0x1bbadd['system_field_options']?_0x1bbadd[_0x2a90('0x6f')]:_0x1bbadd[_0x2a90('0x70')]?_0x1bbadd[_0x2a90('0x70')]:[]};})};}})[_0x2a90('0x23')](respondWithResult(_0x5a770b,null))[_0x2a90('0x45')](function(_0x16e9e7){var _0x4b4a47=_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?0x1f4:_0x16e9e7[_0x2a90('0x72')]||0x1f4;logger[_0x2a90('0x25')](_0x2a90('0x73'),_0x2a90('0x54'),_0x4b4a47,JSON[_0x2a90('0x74')](_0x16e9e7));delete _0x16e9e7[_0x2a90('0x2d')];if(_0x4b4a47===0x191){_0x4b4a47=0x190;}_0x5a770b['status'](_0x4b4a47)[_0x2a90('0x75')](_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?{'message':_0x2a90('0x76'),'statusCode':_0x16e9e7[_0x2a90('0x72')]}:_0x16e9e7);});}; \ No newline at end of file +var _0xee5b=['model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','%s:%s','toString','base64','headers','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','includes','position','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type'];(function(_0x3e2b67,_0x5eae3c){var _0x419d32=function(_0x454cbd){while(--_0x454cbd){_0x3e2b67['push'](_0x3e2b67['shift']());}};_0x419d32(++_0x5eae3c);}(_0xee5b,0x1f4));var _0xbee5=function(_0x420613,_0x4cbac6){_0x420613=_0x420613-0x0;var _0x10c30a=_0xee5b[_0x420613];return _0x10c30a;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];var integrations=require(_0xbee5('0x17'));function respondWithStatusCode(_0x48f771,_0x14e032){_0x14e032=_0x14e032||0xcc;return function(_0x532a78){if(_0x532a78){return _0x48f771[_0xbee5('0x18')](_0x14e032);}return _0x48f771[_0xbee5('0x19')](_0x14e032)[_0xbee5('0x1a')]();};}function respondWithResult(_0x593ecb,_0x5092f2){_0x5092f2=_0x5092f2||0xc8;return function(_0x3c6e56){if(_0x3c6e56){return _0x593ecb['status'](_0x5092f2)[_0xbee5('0x1b')](_0x3c6e56);}};}function respondWithFilteredResult(_0x5426c9,_0x1a24bd){return function(_0x141878){if(_0x141878){var _0xf676b1=typeof _0x1a24bd['offset']===_0xbee5('0x1c')&&typeof _0x1a24bd[_0xbee5('0x1d')]==='undefined';var _0x254dd3=_0x141878[_0xbee5('0x1e')];var _0x11b4a3=_0xf676b1?0x0:_0x1a24bd[_0xbee5('0x1f')];var _0x35eb5c=_0xf676b1?_0x141878[_0xbee5('0x1e')]:_0x1a24bd[_0xbee5('0x1f')]+_0x1a24bd[_0xbee5('0x1d')];var _0x20cf52;if(_0x35eb5c>=_0x254dd3){_0x35eb5c=_0x254dd3;_0x20cf52=0xc8;}else{_0x20cf52=0xce;}_0x5426c9[_0xbee5('0x19')](_0x20cf52);return _0x5426c9[_0xbee5('0x20')](_0xbee5('0x21'),_0x11b4a3+'-'+_0x35eb5c+'/'+_0x254dd3)[_0xbee5('0x1b')](_0x141878);}return null;};}function patchUpdates(_0x40a06){return function(_0x450824){try{jsonpatch['apply'](_0x450824,_0x40a06,!![]);}catch(_0x550325){return BPromise[_0xbee5('0x22')](_0x550325);}return _0x450824['save']();};}function saveUpdates(_0x205491,_0x117cb3){return function(_0x3cee7f){if(_0x3cee7f){return _0x3cee7f[_0xbee5('0x23')](_0x205491)[_0xbee5('0x24')](function(_0xb665df){return _0xb665df;});}return null;};}function removeEntity(_0x359ccf,_0x3cfa8d){return function(_0xc79035){if(_0xc79035){return _0xc79035['destroy']()['then'](function(){_0x359ccf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d774,_0x1af3de){return function(_0x18d7f4){if(!_0x18d7f4){_0x50d774[_0xbee5('0x18')](0x194);}return _0x18d7f4;};}function handleError(_0x28c74d,_0x169042){_0x169042=_0x169042||0x1f4;return function(_0x20e7e8){logger[_0xbee5('0x25')](_0x20e7e8['stack']);if(_0x20e7e8[_0xbee5('0x26')]){delete _0x20e7e8[_0xbee5('0x26')];}_0x28c74d[_0xbee5('0x19')](_0x169042)[_0xbee5('0x27')](_0x20e7e8);};}exports[_0xbee5('0x28')]=function(_0x5f0419,_0x21b993){var _0x15ffb1={},_0xb7a077={},_0x136a00={'count':0x0,'rows':[]};var _0xa57f85=_[_0xbee5('0x29')](db[_0xbee5('0x2a')][_0xbee5('0x2b')],function(_0x2ccb91){return{'name':_0x2ccb91['fieldName'],'type':_0x2ccb91[_0xbee5('0x2c')]['key']};});_0xb7a077[_0xbee5('0x2d')]=_['map'](_0xa57f85,_0xbee5('0x26'));_0xb7a077['query']=_[_0xbee5('0x2e')](_0x5f0419['query']);_0xb7a077[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],_0xb7a077[_0xbee5('0x31')]);_0x15ffb1['attributes']=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],qs[_0xbee5('0x32')](_0x5f0419[_0xbee5('0x31')]['fields']));_0x15ffb1[_0xbee5('0x33')]=_0x15ffb1[_0xbee5('0x33')][_0xbee5('0x34')]?_0x15ffb1[_0xbee5('0x33')]:_0xb7a077['model'];if(!_0x5f0419[_0xbee5('0x31')][_0xbee5('0x35')](_0xbee5('0x36'))){_0x15ffb1[_0xbee5('0x1d')]=qs['limit'](_0x5f0419[_0xbee5('0x31')]['limit']);_0x15ffb1[_0xbee5('0x1f')]=qs['offset'](_0x5f0419['query']['offset']);}_0x15ffb1[_0xbee5('0x37')]=qs[_0xbee5('0x38')](_0x5f0419[_0xbee5('0x31')][_0xbee5('0x38')]);_0x15ffb1[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x5f0419[_0xbee5('0x31')],_0xb7a077['filters']),_0xa57f85);if(_0x5f0419[_0xbee5('0x31')]['filter']){_0x15ffb1[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x15ffb1[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0xa57f85,function(_0x4a89ac){if(_0x4a89ac[_0xbee5('0x2c')]!=='VIRTUAL'){var _0x565e9f={};_0x565e9f[_0x4a89ac[_0xbee5('0x26')]]={'$like':'%'+_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x565e9f;}})});}_0x15ffb1=_[_0xbee5('0x3b')]({},_0x15ffb1,_0x5f0419['options']);var _0xf3dd5={'where':_0x15ffb1[_0xbee5('0x39')]};return db[_0xbee5('0x2a')][_0xbee5('0x1e')](_0xf3dd5)[_0xbee5('0x24')](function(_0x25cf17){_0x136a00[_0xbee5('0x1e')]=_0x25cf17;if(_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3d')]){_0x15ffb1[_0xbee5('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xbee5('0x3f')](_0x15ffb1);})[_0xbee5('0x24')](function(_0x5637e0){_0x136a00[_0xbee5('0x40')]=_0x5637e0;return _0x136a00;})[_0xbee5('0x24')](respondWithFilteredResult(_0x21b993,_0x15ffb1))[_0xbee5('0x41')](handleError(_0x21b993,null));};exports[_0xbee5('0x42')]=function(_0x4dad75,_0x4cfe54){var _0x4b4641={'raw':![],'where':{'id':_0x4dad75[_0xbee5('0x43')]['id']}},_0x138a40={};_0x138a40[_0xbee5('0x2d')]=_[_0xbee5('0x2e')](db[_0xbee5('0x2a')][_0xbee5('0x2b')]);_0x138a40[_0xbee5('0x31')]=_[_0xbee5('0x2e')](_0x4dad75[_0xbee5('0x31')]);_0x138a40['filters']=_['intersection'](_0x138a40[_0xbee5('0x2d')],_0x138a40['query']);_0x4b4641[_0xbee5('0x33')]=_[_0xbee5('0x30')](_0x138a40['model'],qs[_0xbee5('0x32')](_0x4dad75[_0xbee5('0x31')]['fields']));_0x4b4641['attributes']=_0x4b4641[_0xbee5('0x33')][_0xbee5('0x34')]?_0x4b4641['attributes']:_0x138a40[_0xbee5('0x2d')];if(_0x4dad75[_0xbee5('0x31')]['includeAll']){_0x4b4641[_0xbee5('0x3e')]=[{'all':!![]}];}_0x4b4641=_[_0xbee5('0x3b')]({},_0x4b4641,_0x4dad75[_0xbee5('0x44')]);return db[_0xbee5('0x2a')][_0xbee5('0x45')](_0x4b4641)[_0xbee5('0x24')](handleEntityNotFound(_0x4cfe54,null))[_0xbee5('0x24')](respondWithResult(_0x4cfe54,null))['catch'](handleError(_0x4cfe54,null));};exports[_0xbee5('0x46')]=function(_0x34f01d,_0x27ea7b){return db[_0xbee5('0x2a')]['create'](_0x34f01d[_0xbee5('0x47')],{})[_0xbee5('0x24')](respondWithResult(_0x27ea7b,0xc9))[_0xbee5('0x41')](handleError(_0x27ea7b,null));};exports['update']=function(_0x44d4b1,_0xf637bf){if(_0x44d4b1['body']['id']){delete _0x44d4b1['body']['id'];}return db['ZendeskAccount'][_0xbee5('0x45')]({'where':{'id':_0x44d4b1['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf637bf,null))[_0xbee5('0x24')](saveUpdates(_0x44d4b1[_0xbee5('0x47')],null))[_0xbee5('0x24')](respondWithResult(_0xf637bf,null))[_0xbee5('0x41')](handleError(_0xf637bf,null));};exports[_0xbee5('0x48')]=function(_0x55e654,_0x24274d){return db[_0xbee5('0x2a')][_0xbee5('0x45')]({'where':{'id':_0x55e654[_0xbee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x24274d,null))[_0xbee5('0x24')](removeEntity(_0x24274d,null))['catch'](handleError(_0x24274d,null));};exports[_0xbee5('0x49')]=function(_0x45d114,_0xf48059,_0x22c51){var _0x2484c7={};var _0x1b02eb={};var _0xe8902;var _0x35f1d1;return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x45d114[_0xbee5('0x43')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf48059,null))[_0xbee5('0x24')](function(_0x359738){if(_0x359738){_0xe8902=_0x359738;_0x1b02eb[_0xbee5('0x2d')]=_['keys'](db[_0xbee5('0x4b')][_0xbee5('0x2b')]);_0x1b02eb[_0xbee5('0x31')]=_['keys'](_0x45d114[_0xbee5('0x31')]);_0x1b02eb[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0x1b02eb['model'],_0x1b02eb[_0xbee5('0x31')]);_0x2484c7['attributes']=_[_0xbee5('0x30')](_0x1b02eb['model'],qs[_0xbee5('0x32')](_0x45d114[_0xbee5('0x31')][_0xbee5('0x32')]));_0x2484c7['attributes']=_0x2484c7['attributes']['length']?_0x2484c7[_0xbee5('0x33')]:_0x1b02eb[_0xbee5('0x2d')];_0x2484c7[_0xbee5('0x37')]=qs['sort'](_0x45d114[_0xbee5('0x31')]['sort']);_0x2484c7[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x45d114['query'],_0x1b02eb[_0xbee5('0x2f')]));if(_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]){_0x2484c7[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x2484c7[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0x2484c7[_0xbee5('0x33')],function(_0x22fc1a){var _0x111027={};_0x111027[_0x22fc1a]={'$like':'%'+_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x111027;})});}_0x2484c7=_[_0xbee5('0x3b')]({},_0x2484c7,_0x45d114[_0xbee5('0x44')]);return _0xe8902[_0xbee5('0x49')](_0x2484c7);}})[_0xbee5('0x24')](function(_0x32a8d2){if(_0x32a8d2){_0x35f1d1=_0x32a8d2['length'];if(!_0x45d114[_0xbee5('0x31')]['hasOwnProperty']('nolimit')){_0x2484c7[_0xbee5('0x1d')]=qs[_0xbee5('0x1d')](_0x45d114['query']['limit']);_0x2484c7[_0xbee5('0x1f')]=qs['offset'](_0x45d114[_0xbee5('0x31')][_0xbee5('0x1f')]);}return _0xe8902['getConfigurations'](_0x2484c7);}})[_0xbee5('0x24')](function(_0x1a98c9){if(_0x1a98c9){return _0x1a98c9?{'count':_0x35f1d1,'rows':_0x1a98c9}:null;}})[_0xbee5('0x24')](respondWithResult(_0xf48059,null))[_0xbee5('0x41')](handleError(_0xf48059,null));};exports['addConfiguration']=function(_0x205784,_0x4ad4b5,_0x3294f1){if(_0x205784[_0xbee5('0x47')]['id']){delete _0x205784['body']['id'];}return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x205784['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x4ad4b5,null))[_0xbee5('0x24')](function(_0x4f431e){if(_0x4f431e){_0x205784[_0xbee5('0x47')]['AccountId']=_0x4f431e['id'];_0x205784[_0xbee5('0x47')]['Subjects']=integrations[_0xbee5('0x4c')](_0x205784['body']['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);_0x205784[_0xbee5('0x47')][_0xbee5('0x4d')]=integrations[_0xbee5('0x4e')](_0x205784[_0xbee5('0x47')]['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);return db[_0xbee5('0x4b')][_0xbee5('0x46')](_0x205784[_0xbee5('0x47')],{'include':[{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x50')},{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x4d')}]});}return null;})['then'](respondWithResult(_0x4ad4b5,null))[_0xbee5('0x41')](handleError(_0x4ad4b5,null));};exports[_0xbee5('0x51')]=function(_0x43452f,_0x274a2c,_0x59fe10){var _0x13e84a='';return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x43452f[_0xbee5('0x43')]['id']},'attributes':['id',_0xbee5('0x52'),_0xbee5('0x53'),_0xbee5('0x54'),_0xbee5('0x55'),_0xbee5('0x56')]})[_0xbee5('0x24')](handleEntityNotFound(_0x274a2c,null))[_0xbee5('0x24')](function(_0x24cd85){if(_0x24cd85){_0x13e84a=_0x24cd85['remoteUri'];var _0x20a9d2=_0x13e84a[_0xbee5('0x57')](-0x1);if(_0x20a9d2==='/'){_0x13e84a=_0x13e84a['substring'](0x0,_0x13e84a[_0xbee5('0x58')](_0x20a9d2));}var _0x56ceeb={'method':_0xbee5('0x59'),'uri':util[_0xbee5('0x5a')]('%s/%s',_0x13e84a,_0xbee5('0x5b')),'json':!![]};switch(_0x24cd85['authType']){case'password':_0x56ceeb['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xbee5('0x5c'),_0x24cd85[_0xbee5('0x52')],_0x24cd85[_0xbee5('0x53')]))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;case _0xbee5('0x54'):_0x56ceeb[_0xbee5('0x5f')]={'Authorization':util[_0xbee5('0x5a')](_0xbee5('0x60'),new Buffer(util[_0xbee5('0x5a')](_0xbee5('0x61'),_0x24cd85[_0xbee5('0x52')],_0x24cd85['token']))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;default:throw new db['Sequelize']['ValidationError'](_0xbee5('0x62'));}return rp(_0x56ceeb);}})[_0xbee5('0x24')](function(_0x39cc65){if(_0x39cc65){var _0x5e5cba=[_0xbee5('0x63'),_0xbee5('0x64'),_0xbee5('0x65'),'assignee'];_['remove'](_0x39cc65['ticket_fields'],function(_0x3b0d82){return _0x5e5cba[_0xbee5('0x66')](_0x3b0d82[_0xbee5('0x2c')]);});return{'count':_0x39cc65[_0xbee5('0x5b')][_0xbee5('0x34')],'rows':_[_0xbee5('0x29')](_0x39cc65[_0xbee5('0x5b')],function(_0x435b75){return{'id':_0x435b75['id'],'name':_0x435b75['position']>0x7?_0x435b75['title']:_0x435b75[_0xbee5('0x2c')],'custom':_0x435b75[_0xbee5('0x67')]>0x7?!![]:![],'options':_0x435b75['system_field_options']?_0x435b75['system_field_options']:_0x435b75[_0xbee5('0x68')]?_0x435b75['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x274a2c,null))[_0xbee5('0x41')](function(_0x525472){var _0x2b4ac9=_0x43452f[_0xbee5('0x31')]['test']?0x1f4:_0x525472[_0xbee5('0x69')]||0x1f4;logger[_0xbee5('0x25')](_0xbee5('0x6a'),_0xbee5('0x51'),_0x2b4ac9,JSON[_0xbee5('0x6b')](_0x525472));delete _0x525472['name'];if(_0x2b4ac9===0x191){_0x2b4ac9=0x190;}_0x274a2c['status'](_0x2b4ac9)[_0xbee5('0x27')](_0x43452f['query'][_0xbee5('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x525472[_0xbee5('0x69')]}:_0x525472);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d4f24be..79ef028 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 _0x2be7=['int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','ZendeskAccount'];(function(_0x1f79fb,_0x521218){var _0x3ab5b1=function(_0x55ca54){while(--_0x55ca54){_0x1f79fb['push'](_0x1f79fb['shift']());}};_0x3ab5b1(++_0x521218);}(_0x2be7,0x1c4));var _0x72be=function(_0x2a3cb2,_0x55280a){_0x2a3cb2=_0x2a3cb2-0x0;var _0x4120af=_0x2be7[_0x2a3cb2];return _0x4120af;};'use strict';var _=require(_0x72be('0x0'));var util=require('util');var logger=require(_0x72be('0x1'))(_0x72be('0x2'));var moment=require(_0x72be('0x3'));var BPromise=require(_0x72be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72be('0x5'));var rimraf=require(_0x72be('0x6'));var config=require(_0x72be('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2e45db,_0x4403a1){return _0x2e45db[_0x72be('0x8')](_0x72be('0x9'),attributes,{'tableName':_0x72be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x645d=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc91da1,_0x290db3){var _0x343e43=function(_0xcdd601){while(--_0xcdd601){_0xc91da1['push'](_0xc91da1['shift']());}};_0x343e43(++_0x290db3);}(_0x645d,0xf5));var _0xd645=function(_0x211907,_0x5486fe){_0x211907=_0x211907-0x0;var _0x2cc002=_0x645d[_0x211907];return _0x2cc002;};'use strict';var _=require(_0xd645('0x0'));var util=require(_0xd645('0x1'));var logger=require(_0xd645('0x2'))(_0xd645('0x3'));var moment=require(_0xd645('0x4'));var BPromise=require(_0xd645('0x5'));var rp=require(_0xd645('0x6'));var fs=require('fs');var path=require(_0xd645('0x7'));var rimraf=require('rimraf');var config=require(_0xd645('0x8'));var attributes=require(_0xd645('0x9'));var integrations=require(_0xd645('0xa'));module[_0xd645('0xb')]=function(_0xd72575,_0x459d3c){return _0xd72575[_0xd645('0xc')](_0xd645('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 75cdad6..61125b8 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 _0x2b34=['include','model','then','debug','ShowZendeskAccount','find','where','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','map'];(function(_0x5f2668,_0x29630f){var _0x42df13=function(_0x4ea449){while(--_0x4ea449){_0x5f2668['push'](_0x5f2668['shift']());}};_0x42df13(++_0x29630f);}(_0x2b34,0x165));var _0x42b3=function(_0x121309,_0x3de68a){_0x121309=_0x121309-0x0;var _0x542514=_0x2b34[_0x121309];return _0x542514;};'use strict';var _=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var moment=require('moment');var BPromise=require(_0x42b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b3('0x4'));var logger=require(_0x42b3('0x5'))(_0x42b3('0x6'));var config=require(_0x42b3('0x7'));var jayson=require(_0x42b3('0x8'));var client=jayson[_0x42b3('0x9')][_0x42b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3072e0,_0x3cb3e5,_0x3de38f){return new BPromise(function(_0x42c545,_0xcc7eee){return client[_0x42b3('0xb')](_0x3072e0,_0x3de38f)['then'](function(_0x2f9da0){logger[_0x42b3('0xc')](_0x42b3('0xd'),_0x3cb3e5,_0x42b3('0xe'));logger['debug'](_0x42b3('0xf'),_0x3cb3e5,'request\x20sent',JSON[_0x42b3('0x10')](_0x2f9da0));if(_0x2f9da0['error']){if(_0x2f9da0[_0x42b3('0x11')][_0x42b3('0x12')]===0x1f4){logger[_0x42b3('0x11')](_0x42b3('0xd'),_0x3cb3e5,_0x2f9da0[_0x42b3('0x11')][_0x42b3('0x13')]);return _0xcc7eee(_0x2f9da0[_0x42b3('0x11')][_0x42b3('0x13')]);}logger[_0x42b3('0x11')](_0x42b3('0xd'),_0x3cb3e5,_0x2f9da0[_0x42b3('0x11')][_0x42b3('0x13')]);return _0x42c545(_0x2f9da0['error']['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3cb3e5,_0x42b3('0xe'));_0x42c545(_0x2f9da0['result'][_0x42b3('0x13')]);}})[_0x42b3('0x14')](function(_0x498e16){logger[_0x42b3('0x11')](_0x42b3('0xd'),_0x3cb3e5,_0x498e16);_0xcc7eee(_0x498e16);});});}exports[_0x42b3('0x15')]=function(_0x24b218){var _0x37eefe=this;return new Promise(function(_0x37bda3,_0x2e23ab){return db[_0x42b3('0x16')]['findAll']({'raw':_0x24b218['options']?_0x24b218[_0x42b3('0x17')][_0x42b3('0x18')]===undefined?!![]:![]:!![],'where':_0x24b218[_0x42b3('0x17')]?_0x24b218[_0x42b3('0x17')]['where']||null:null,'attributes':_0x24b218[_0x42b3('0x17')]?_0x24b218[_0x42b3('0x17')][_0x42b3('0x19')]||null:null,'limit':_0x24b218[_0x42b3('0x17')]?_0x24b218[_0x42b3('0x17')][_0x42b3('0x1a')]||null:null,'include':_0x24b218[_0x42b3('0x17')]?_0x24b218[_0x42b3('0x17')]['include']?_[_0x42b3('0x1b')](_0x24b218[_0x42b3('0x17')][_0x42b3('0x1c')],function(_0x13b6de){return{'model':db[_0x13b6de['model']],'as':_0x13b6de['as'],'attributes':_0x13b6de['attributes'],'include':_0x13b6de[_0x42b3('0x1c')]?_['map'](_0x13b6de[_0x42b3('0x1c')],function(_0x51b860){return{'model':db[_0x51b860['model']],'as':_0x51b860['as'],'attributes':_0x51b860[_0x42b3('0x19')],'include':_0x51b860[_0x42b3('0x1c')]?_[_0x42b3('0x1b')](_0x51b860[_0x42b3('0x1c')],function(_0x2c2f1e){return{'model':db[_0x2c2f1e[_0x42b3('0x1d')]],'as':_0x2c2f1e['as'],'attributes':_0x2c2f1e[_0x42b3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x42b3('0x1e')](function(_0x2cf535){logger['info'](_0x42b3('0x15'),_0x24b218);logger[_0x42b3('0x1f')]('GetZendeskAccount',_0x24b218,JSON['stringify'](_0x2cf535));_0x37bda3(_0x2cf535);})[_0x42b3('0x14')](function(_0x229df1){logger[_0x42b3('0x11')](_0x42b3('0x15'),_0x229df1[_0x42b3('0x13')],_0x24b218);_0x2e23ab(_0x37eefe['error'](0x1f4,_0x229df1[_0x42b3('0x13')]));});});};exports[_0x42b3('0x20')]=function(_0x3367a1){var _0x57955e=this;return new Promise(function(_0xb5adc7,_0xa35be0){return db[_0x42b3('0x16')][_0x42b3('0x21')]({'raw':_0x3367a1[_0x42b3('0x17')]?_0x3367a1[_0x42b3('0x17')][_0x42b3('0x18')]===undefined?!![]:![]:!![],'where':_0x3367a1['options']?_0x3367a1[_0x42b3('0x17')][_0x42b3('0x22')]||null:null,'attributes':_0x3367a1[_0x42b3('0x17')]?_0x3367a1[_0x42b3('0x17')][_0x42b3('0x19')]||null:null,'include':_0x3367a1[_0x42b3('0x17')]?_0x3367a1[_0x42b3('0x17')][_0x42b3('0x1c')]?_[_0x42b3('0x1b')](_0x3367a1['options']['include'],function(_0x52390f){return{'model':db[_0x52390f[_0x42b3('0x1d')]],'as':_0x52390f['as'],'attributes':_0x52390f[_0x42b3('0x19')],'include':_0x52390f[_0x42b3('0x1c')]?_[_0x42b3('0x1b')](_0x52390f[_0x42b3('0x1c')],function(_0x2faf2b){return{'model':db[_0x2faf2b[_0x42b3('0x1d')]],'as':_0x2faf2b['as'],'attributes':_0x2faf2b['attributes'],'include':_0x2faf2b[_0x42b3('0x1c')]?_[_0x42b3('0x1b')](_0x2faf2b[_0x42b3('0x1c')],function(_0x5c4406){return{'model':db[_0x5c4406[_0x42b3('0x1d')]],'as':_0x5c4406['as'],'attributes':_0x5c4406[_0x42b3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x42b3('0x1e')](function(_0x42def5){logger[_0x42b3('0xc')](_0x42b3('0x20'),_0x3367a1);logger[_0x42b3('0x1f')](_0x42b3('0x20'),_0x3367a1,JSON[_0x42b3('0x10')](_0x42def5));_0xb5adc7(_0x42def5);})[_0x42b3('0x14')](function(_0x36a5cf){logger[_0x42b3('0x11')](_0x42b3('0x20'),_0x36a5cf[_0x42b3('0x13')],_0x3367a1);_0xa35be0(_0x57955e['error'](0x1f4,_0x36a5cf[_0x42b3('0x13')]));});});}; \ No newline at end of file +var _0xee4e=['request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ZendeskAccount,\x20%s,\x20%s','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4870fa,_0x37c587){var _0x1eba39=function(_0x12056b){while(--_0x12056b){_0x4870fa['push'](_0x4870fa['shift']());}};_0x1eba39(++_0x37c587);}(_0xee4e,0x89));var _0xeee4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xee4e[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xeee4('0x0'));var util=require('util');var moment=require(_0xeee4('0x1'));var BPromise=require('bluebird');var rs=require(_0xeee4('0x2'));var fs=require('fs');var Redis=require(_0xeee4('0x3'));var db=require(_0xeee4('0x4'))['db'];var utils=require(_0xeee4('0x5'));var logger=require(_0xeee4('0x6'))(_0xeee4('0x7'));var config=require(_0xeee4('0x8'));var jayson=require(_0xeee4('0x9'));var client=jayson[_0xeee4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3585ae,_0x167e91,_0x13766d){return new BPromise(function(_0x59c330,_0x2a8ed3){return client[_0xeee4('0xb')](_0x3585ae,_0x13766d)[_0xeee4('0xc')](function(_0x46be3){logger[_0xeee4('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x167e91,_0xeee4('0xe'));logger[_0xeee4('0xf')](_0xeee4('0x10'),_0x167e91,_0xeee4('0xe'),JSON[_0xeee4('0x11')](_0x46be3));if(_0x46be3['error']){if(_0x46be3['error'][_0xeee4('0x12')]===0x1f4){logger[_0xeee4('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x167e91,_0x46be3[_0xeee4('0x13')][_0xeee4('0x14')]);return _0x2a8ed3(_0x46be3[_0xeee4('0x13')][_0xeee4('0x14')]);}logger[_0xeee4('0x13')](_0xeee4('0x15'),_0x167e91,_0x46be3[_0xeee4('0x13')][_0xeee4('0x14')]);return _0x59c330(_0x46be3[_0xeee4('0x13')]['message']);}else{logger[_0xeee4('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x167e91,'request\x20sent');_0x59c330(_0x46be3[_0xeee4('0x16')][_0xeee4('0x14')]);}})[_0xeee4('0x17')](function(_0x3d5fed){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x167e91,_0x3d5fed);_0x2a8ed3(_0x3d5fed);});});}exports[_0xeee4('0x18')]=function(_0x1822a0){var _0x1678e8=this;return new Promise(function(_0x463ab6,_0x43fc0d){return db[_0xeee4('0x19')][_0xeee4('0x1a')]({'raw':_0x1822a0[_0xeee4('0x1b')]?_0x1822a0['options'][_0xeee4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1822a0[_0xeee4('0x1b')]?_0x1822a0[_0xeee4('0x1b')][_0xeee4('0x1d')]||null:null,'attributes':_0x1822a0[_0xeee4('0x1b')]?_0x1822a0[_0xeee4('0x1b')][_0xeee4('0x1e')]||null:null,'limit':_0x1822a0[_0xeee4('0x1b')]?_0x1822a0[_0xeee4('0x1b')][_0xeee4('0x1f')]||null:null,'include':_0x1822a0['options']?_0x1822a0['options'][_0xeee4('0x20')]?_[_0xeee4('0x21')](_0x1822a0[_0xeee4('0x1b')][_0xeee4('0x20')],function(_0x31b947){return{'model':db[_0x31b947[_0xeee4('0x22')]],'as':_0x31b947['as'],'attributes':_0x31b947['attributes'],'include':_0x31b947[_0xeee4('0x20')]?_['map'](_0x31b947['include'],function(_0xc7410a){return{'model':db[_0xc7410a[_0xeee4('0x22')]],'as':_0xc7410a['as'],'attributes':_0xc7410a['attributes'],'include':_0xc7410a[_0xeee4('0x20')]?_[_0xeee4('0x21')](_0xc7410a['include'],function(_0x5d1bb0){return{'model':db[_0x5d1bb0[_0xeee4('0x22')]],'as':_0x5d1bb0['as'],'attributes':_0x5d1bb0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f917d){logger[_0xeee4('0xd')]('GetZendeskAccount',_0x1822a0);logger['debug'](_0xeee4('0x18'),_0x1822a0,JSON[_0xeee4('0x11')](_0x4f917d));_0x463ab6(_0x4f917d);})[_0xeee4('0x17')](function(_0x48328b){logger['error']('GetZendeskAccount',_0x48328b['message'],_0x1822a0);_0x43fc0d(_0x1678e8['error'](0x1f4,_0x48328b[_0xeee4('0x14')]));});});};exports[_0xeee4('0x23')]=function(_0x3a9d0e){var _0x596119=this;return new Promise(function(_0x266ffa,_0x368bb7){return db[_0xeee4('0x19')][_0xeee4('0x24')]({'raw':_0x3a9d0e['options']?_0x3a9d0e[_0xeee4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a9d0e[_0xeee4('0x1b')]?_0x3a9d0e['options']['where']||null:null,'attributes':_0x3a9d0e[_0xeee4('0x1b')]?_0x3a9d0e['options'][_0xeee4('0x1e')]||null:null,'include':_0x3a9d0e[_0xeee4('0x1b')]?_0x3a9d0e[_0xeee4('0x1b')][_0xeee4('0x20')]?_[_0xeee4('0x21')](_0x3a9d0e[_0xeee4('0x1b')][_0xeee4('0x20')],function(_0x596fb0){return{'model':db[_0x596fb0[_0xeee4('0x22')]],'as':_0x596fb0['as'],'attributes':_0x596fb0[_0xeee4('0x1e')],'include':_0x596fb0[_0xeee4('0x20')]?_['map'](_0x596fb0[_0xeee4('0x20')],function(_0xb095b6){return{'model':db[_0xb095b6['model']],'as':_0xb095b6['as'],'attributes':_0xb095b6[_0xeee4('0x1e')],'include':_0xb095b6['include']?_[_0xeee4('0x21')](_0xb095b6[_0xeee4('0x20')],function(_0x247d32){return{'model':db[_0x247d32['model']],'as':_0x247d32['as'],'attributes':_0x247d32['attributes']};}):[]};}):[]};}):[]:[]})[_0xeee4('0xc')](function(_0x2f5752){logger['info'](_0xeee4('0x23'),_0x3a9d0e);logger['debug']('ShowZendeskAccount',_0x3a9d0e,JSON['stringify'](_0x2f5752));_0x266ffa(_0x2f5752);})[_0xeee4('0x17')](function(_0x1e8384){logger[_0xeee4('0x13')](_0xeee4('0x23'),_0x1e8384['message'],_0x3a9d0e);_0x368bb7(_0x596119['error'](0x1f4,_0x1e8384[_0xeee4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 465f8ca..5d321c0 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3a6e67,_0x35d4ad){var _0x1bcd08=function(_0x32cdd9){while(--_0x32cdd9){_0x3a6e67['push'](_0x3a6e67['shift']());}};_0x1bcd08(++_0x35d4ad);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x1e2ded,_0x293100){var _0x1ad8b4=function(_0x5d1992){while(--_0x5d1992){_0x1e2ded['push'](_0x1e2ded['shift']());}};_0x1ad8b4(++_0x293100);}(_0x91a7,0xe7));var _0x791a=function(_0x2f3ba3,_0x5dcde5){_0x2f3ba3=_0x2f3ba3-0x0;var _0x39d388=_0x91a7[_0x2f3ba3];return _0x39d388;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f841350..95121d9 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 _0xfde0=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfde0,0x1ac));var _0x0fde=function(_0x20f32c,_0x2ceb66){_0x20f32c=_0x20f32c-0x0;var _0x5a642e=_0xfde0[_0x20f32c];return _0x5a642e;};'use strict';var Sequelize=require(_0x0fde('0x0'));module[_0x0fde('0x1')]={'name':{'type':Sequelize[_0x0fde('0x2')]},'description':{'type':Sequelize[_0x0fde('0x2')]}}; \ No newline at end of file +var _0x1aca=['sequelize','STRING'];(function(_0x3a0631,_0x2d8a7e){var _0x44bdf0=function(_0x3d5b19){while(--_0x3d5b19){_0x3a0631['push'](_0x3a0631['shift']());}};_0x44bdf0(++_0x2d8a7e);}(_0x1aca,0x102));var _0xa1ac=function(_0x5031c1,_0x310436){_0x5031c1=_0x5031c1-0x0;var _0x418bb6=_0x1aca[_0x5031c1];return _0x418bb6;};'use strict';var Sequelize=require(_0xa1ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2b6c688..6fdeee3 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 _0x5db7=['getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','rows','catch','show','params','include','find','create','body','getFields','findOne','ZendeskField','nolimit'];(function(_0x425876,_0x16a76c){var _0x161efa=function(_0x278d34){while(--_0x278d34){_0x425876['push'](_0x425876['shift']());}};_0x161efa(++_0x16a76c);}(_0x5db7,0xb2));var _0x75db=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x5db7[_0x64aff8];return _0x5488a3;};'use strict';var emlformat=require(_0x75db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75db('0x1'));var jsonpatch=require(_0x75db('0x2'));var rp=require('request-promise');var moment=require(_0x75db('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x75db('0x4'));var util=require(_0x75db('0x5'));var path=require(_0x75db('0x6'));var sox=require(_0x75db('0x7'));var csv=require(_0x75db('0x8'));var ejs=require(_0x75db('0x9'));var fs=require('fs');var fs_extra=require(_0x75db('0xa'));var _=require(_0x75db('0xb'));var squel=require(_0x75db('0xc'));var crypto=require(_0x75db('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x75db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x75db('0xf'));var Papa=require(_0x75db('0x10'));var Redis=require(_0x75db('0x11'));var authService=require(_0x75db('0x12'));var qs=require(_0x75db('0x13'));var as=require(_0x75db('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75db('0x15'))(_0x75db('0x16'));var utils=require(_0x75db('0x17'));var config=require(_0x75db('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x75db('0x19'))['db'];function respondWithStatusCode(_0x4427a4,_0x132d1c){_0x132d1c=_0x132d1c||0xcc;return function(_0x1ea423){if(_0x1ea423){return _0x4427a4[_0x75db('0x1a')](_0x132d1c);}return _0x4427a4['status'](_0x132d1c)[_0x75db('0x1b')]();};}function respondWithResult(_0x5d151a,_0x32af2c){_0x32af2c=_0x32af2c||0xc8;return function(_0x3b945a){if(_0x3b945a){return _0x5d151a['status'](_0x32af2c)[_0x75db('0x1c')](_0x3b945a);}};}function respondWithFilteredResult(_0x36f4c1,_0x3c1fed){return function(_0x213bfa){if(_0x213bfa){var _0x2ff148=typeof _0x3c1fed['offset']==='undefined'&&typeof _0x3c1fed['limit']===_0x75db('0x1d');var _0x1d26eb=_0x213bfa[_0x75db('0x1e')];var _0x548a46=_0x2ff148?0x0:_0x3c1fed['offset'];var _0x3af291=_0x2ff148?_0x213bfa['count']:_0x3c1fed['offset']+_0x3c1fed['limit'];var _0x481058;if(_0x3af291>=_0x1d26eb){_0x3af291=_0x1d26eb;_0x481058=0xc8;}else{_0x481058=0xce;}_0x36f4c1[_0x75db('0x1f')](_0x481058);return _0x36f4c1[_0x75db('0x20')](_0x75db('0x21'),_0x548a46+'-'+_0x3af291+'/'+_0x1d26eb)['json'](_0x213bfa);}return null;};}function patchUpdates(_0x3b2a54){return function(_0x47657c){try{jsonpatch[_0x75db('0x22')](_0x47657c,_0x3b2a54,!![]);}catch(_0x108ded){return BPromise[_0x75db('0x23')](_0x108ded);}return _0x47657c['save']();};}function saveUpdates(_0x335dfe,_0x2c6783){return function(_0x111463){if(_0x111463){return _0x111463[_0x75db('0x24')](_0x335dfe)[_0x75db('0x25')](function(_0x2d851c){return _0x2d851c;});}return null;};}function removeEntity(_0x347737,_0x30086b){return function(_0x545f3e){if(_0x545f3e){return _0x545f3e[_0x75db('0x26')]()['then'](function(){_0x347737[_0x75db('0x1f')](0xcc)[_0x75db('0x1b')]();});}};}function handleEntityNotFound(_0xc1b9c9,_0x34b396){return function(_0x4ecdc2){if(!_0x4ecdc2){_0xc1b9c9[_0x75db('0x1a')](0x194);}return _0x4ecdc2;};}function handleError(_0x4b1d45,_0x17d4ee){_0x17d4ee=_0x17d4ee||0x1f4;return function(_0x53c4fa){logger[_0x75db('0x27')](_0x53c4fa[_0x75db('0x28')]);if(_0x53c4fa['name']){delete _0x53c4fa[_0x75db('0x29')];}_0x4b1d45[_0x75db('0x1f')](_0x17d4ee)[_0x75db('0x2a')](_0x53c4fa);};}exports['index']=function(_0x1ebd33,_0x496a32){var _0x27f6c0={},_0xc49b2e={},_0x199193={'count':0x0,'rows':[]};var _0x25391a=_[_0x75db('0x2b')](db[_0x75db('0x2c')][_0x75db('0x2d')],function(_0x3a30fb){return{'name':_0x3a30fb[_0x75db('0x2e')],'type':_0x3a30fb[_0x75db('0x2f')][_0x75db('0x30')]};});_0xc49b2e[_0x75db('0x31')]=_[_0x75db('0x2b')](_0x25391a,_0x75db('0x29'));_0xc49b2e['query']=_[_0x75db('0x32')](_0x1ebd33[_0x75db('0x33')]);_0xc49b2e[_0x75db('0x34')]=_[_0x75db('0x35')](_0xc49b2e['model'],_0xc49b2e[_0x75db('0x33')]);_0x27f6c0[_0x75db('0x36')]=_[_0x75db('0x35')](_0xc49b2e[_0x75db('0x31')],qs[_0x75db('0x37')](_0x1ebd33['query'][_0x75db('0x37')]));_0x27f6c0[_0x75db('0x36')]=_0x27f6c0['attributes'][_0x75db('0x38')]?_0x27f6c0[_0x75db('0x36')]:_0xc49b2e[_0x75db('0x31')];if(!_0x1ebd33['query'][_0x75db('0x39')]('nolimit')){_0x27f6c0[_0x75db('0x3a')]=qs['limit'](_0x1ebd33[_0x75db('0x33')][_0x75db('0x3a')]);_0x27f6c0[_0x75db('0x3b')]=qs[_0x75db('0x3b')](_0x1ebd33['query']['offset']);}_0x27f6c0[_0x75db('0x3c')]=qs[_0x75db('0x3d')](_0x1ebd33['query'][_0x75db('0x3d')]);_0x27f6c0['where']=qs[_0x75db('0x34')](_[_0x75db('0x3e')](_0x1ebd33[_0x75db('0x33')],_0xc49b2e[_0x75db('0x34')]),_0x25391a);if(_0x1ebd33[_0x75db('0x33')][_0x75db('0x3f')]){_0x27f6c0[_0x75db('0x40')]=_['merge'](_0x27f6c0[_0x75db('0x40')],{'$or':_[_0x75db('0x2b')](_0x25391a,function(_0x9e024e){if(_0x9e024e[_0x75db('0x2f')]!==_0x75db('0x41')){var _0x21885a={};_0x21885a[_0x9e024e[_0x75db('0x29')]]={'$like':'%'+_0x1ebd33[_0x75db('0x33')][_0x75db('0x3f')]+'%'};return _0x21885a;}})});}_0x27f6c0=_[_0x75db('0x42')]({},_0x27f6c0,_0x1ebd33[_0x75db('0x43')]);var _0x2392e4={'where':_0x27f6c0[_0x75db('0x40')]};return db[_0x75db('0x2c')]['count'](_0x2392e4)[_0x75db('0x25')](function(_0x361b75){_0x199193[_0x75db('0x1e')]=_0x361b75;if(_0x1ebd33['query']['includeAll']){_0x27f6c0['include']=[{'all':!![]}];}return db[_0x75db('0x2c')]['findAll'](_0x27f6c0);})[_0x75db('0x25')](function(_0x5ef47a){_0x199193[_0x75db('0x44')]=_0x5ef47a;return _0x199193;})[_0x75db('0x25')](respondWithFilteredResult(_0x496a32,_0x27f6c0))[_0x75db('0x45')](handleError(_0x496a32,null));};exports[_0x75db('0x46')]=function(_0x42c311,_0x33e17f){var _0x40049a={'raw':![],'where':{'id':_0x42c311[_0x75db('0x47')]['id']}},_0x19f6c5={};_0x19f6c5[_0x75db('0x31')]=_[_0x75db('0x32')](db[_0x75db('0x2c')][_0x75db('0x2d')]);_0x19f6c5[_0x75db('0x33')]=_[_0x75db('0x32')](_0x42c311[_0x75db('0x33')]);_0x19f6c5[_0x75db('0x34')]=_[_0x75db('0x35')](_0x19f6c5['model'],_0x19f6c5[_0x75db('0x33')]);_0x40049a[_0x75db('0x36')]=_['intersection'](_0x19f6c5[_0x75db('0x31')],qs[_0x75db('0x37')](_0x42c311[_0x75db('0x33')][_0x75db('0x37')]));_0x40049a['attributes']=_0x40049a['attributes']['length']?_0x40049a[_0x75db('0x36')]:_0x19f6c5[_0x75db('0x31')];if(_0x42c311[_0x75db('0x33')]['includeAll']){_0x40049a[_0x75db('0x48')]=[{'all':!![]}];}_0x40049a=_[_0x75db('0x42')]({},_0x40049a,_0x42c311['options']);return db[_0x75db('0x2c')][_0x75db('0x49')](_0x40049a)[_0x75db('0x25')](handleEntityNotFound(_0x33e17f,null))[_0x75db('0x25')](respondWithResult(_0x33e17f,null))['catch'](handleError(_0x33e17f,null));};exports[_0x75db('0x4a')]=function(_0x51d913,_0xfe1d4a){return db[_0x75db('0x2c')][_0x75db('0x4a')](_0x51d913['body'],{})[_0x75db('0x25')](respondWithResult(_0xfe1d4a,0xc9))[_0x75db('0x45')](handleError(_0xfe1d4a,null));};exports[_0x75db('0x24')]=function(_0xf52d96,_0xf66c07){if(_0xf52d96[_0x75db('0x4b')]['id']){delete _0xf52d96['body']['id'];}return db[_0x75db('0x2c')][_0x75db('0x49')]({'where':{'id':_0xf52d96[_0x75db('0x47')]['id']}})[_0x75db('0x25')](handleEntityNotFound(_0xf66c07,null))[_0x75db('0x25')](saveUpdates(_0xf52d96[_0x75db('0x4b')],null))[_0x75db('0x25')](respondWithResult(_0xf66c07,null))[_0x75db('0x45')](handleError(_0xf66c07,null));};exports[_0x75db('0x26')]=function(_0x246289,_0x212609){return db[_0x75db('0x2c')][_0x75db('0x49')]({'where':{'id':_0x246289['params']['id']}})[_0x75db('0x25')](handleEntityNotFound(_0x212609,null))['then'](removeEntity(_0x212609,null))[_0x75db('0x45')](handleError(_0x212609,null));};exports[_0x75db('0x4c')]=function(_0x493d5f,_0x51fd00,_0x47cc41){var _0x3c8108={};var _0x200714={};var _0x1fc337;var _0x1cbe78;return db['ZendeskConfiguration'][_0x75db('0x4d')]({'where':{'id':_0x493d5f[_0x75db('0x47')]['id']}})[_0x75db('0x25')](handleEntityNotFound(_0x51fd00,null))[_0x75db('0x25')](function(_0x15a95d){if(_0x15a95d){_0x1fc337=_0x15a95d;_0x200714[_0x75db('0x31')]=_[_0x75db('0x32')](db[_0x75db('0x4e')][_0x75db('0x2d')]);_0x200714[_0x75db('0x33')]=_[_0x75db('0x32')](_0x493d5f[_0x75db('0x33')]);_0x200714['filters']=_[_0x75db('0x35')](_0x200714['model'],_0x200714[_0x75db('0x33')]);_0x3c8108['attributes']=_[_0x75db('0x35')](_0x200714['model'],qs[_0x75db('0x37')](_0x493d5f[_0x75db('0x33')][_0x75db('0x37')]));_0x3c8108[_0x75db('0x36')]=_0x3c8108['attributes'][_0x75db('0x38')]?_0x3c8108[_0x75db('0x36')]:_0x200714[_0x75db('0x31')];_0x3c8108[_0x75db('0x3c')]=qs[_0x75db('0x3d')](_0x493d5f[_0x75db('0x33')]['sort']);_0x3c8108[_0x75db('0x40')]=qs['filters'](_[_0x75db('0x3e')](_0x493d5f[_0x75db('0x33')],_0x200714[_0x75db('0x34')]));if(_0x493d5f['query'][_0x75db('0x3f')]){_0x3c8108[_0x75db('0x40')]=_[_0x75db('0x42')](_0x3c8108['where'],{'$or':_['map'](_0x3c8108[_0x75db('0x36')],function(_0x219762){var _0x23c82c={};_0x23c82c[_0x219762]={'$like':'%'+_0x493d5f['query']['filter']+'%'};return _0x23c82c;})});}_0x3c8108=_[_0x75db('0x42')]({},_0x3c8108,_0x493d5f[_0x75db('0x43')]);return _0x1fc337['getFields'](_0x3c8108);}})[_0x75db('0x25')](function(_0x3e0df2){if(_0x3e0df2){_0x1cbe78=_0x3e0df2[_0x75db('0x38')];if(!_0x493d5f['query'][_0x75db('0x39')](_0x75db('0x4f'))){_0x3c8108[_0x75db('0x3a')]=qs[_0x75db('0x3a')](_0x493d5f['query'][_0x75db('0x3a')]);_0x3c8108[_0x75db('0x3b')]=qs['offset'](_0x493d5f[_0x75db('0x33')]['offset']);}return _0x1fc337[_0x75db('0x4c')](_0x3c8108);}})[_0x75db('0x25')](function(_0x1d2895){if(_0x1d2895){return _0x1d2895?{'count':_0x1cbe78,'rows':_0x1d2895}:null;}})['then'](respondWithResult(_0x51fd00,null))[_0x75db('0x45')](handleError(_0x51fd00,null));};exports[_0x75db('0x50')]=function(_0x3233a3,_0x2ac254,_0x4c16ab){var _0x5da0a5={};var _0x20e6a4={};var _0xad56f4;var _0x2cf20c;return db[_0x75db('0x2c')]['findOne']({'where':{'id':_0x3233a3[_0x75db('0x47')]['id']}})[_0x75db('0x25')](handleEntityNotFound(_0x2ac254,null))[_0x75db('0x25')](function(_0x4a963a){if(_0x4a963a){_0xad56f4=_0x4a963a;_0x20e6a4[_0x75db('0x31')]=_[_0x75db('0x32')](db[_0x75db('0x4e')][_0x75db('0x2d')]);_0x20e6a4['query']=_[_0x75db('0x32')](_0x3233a3[_0x75db('0x33')]);_0x20e6a4[_0x75db('0x34')]=_[_0x75db('0x35')](_0x20e6a4[_0x75db('0x31')],_0x20e6a4['query']);_0x5da0a5['attributes']=_['intersection'](_0x20e6a4['model'],qs['fields'](_0x3233a3[_0x75db('0x33')]['fields']));_0x5da0a5[_0x75db('0x36')]=_0x5da0a5['attributes'][_0x75db('0x38')]?_0x5da0a5[_0x75db('0x36')]:_0x20e6a4['model'];_0x5da0a5[_0x75db('0x3c')]=qs['sort'](_0x3233a3[_0x75db('0x33')]['sort']);_0x5da0a5[_0x75db('0x40')]=qs[_0x75db('0x34')](_[_0x75db('0x3e')](_0x3233a3[_0x75db('0x33')],_0x20e6a4['filters']));if(_0x3233a3['query']['filter']){_0x5da0a5[_0x75db('0x40')]=_['merge'](_0x5da0a5['where'],{'$or':_[_0x75db('0x2b')](_0x5da0a5['attributes'],function(_0x4a816e){var _0x2fe81b={};_0x2fe81b[_0x4a816e]={'$like':'%'+_0x3233a3[_0x75db('0x33')][_0x75db('0x3f')]+'%'};return _0x2fe81b;})});}_0x5da0a5=_[_0x75db('0x42')]({},_0x5da0a5,_0x3233a3[_0x75db('0x43')]);return _0xad56f4['getSubjects'](_0x5da0a5);}})[_0x75db('0x25')](function(_0x4a3a58){if(_0x4a3a58){_0x2cf20c=_0x4a3a58[_0x75db('0x38')];if(!_0x3233a3[_0x75db('0x33')][_0x75db('0x39')]('nolimit')){_0x5da0a5[_0x75db('0x3a')]=qs[_0x75db('0x3a')](_0x3233a3[_0x75db('0x33')][_0x75db('0x3a')]);_0x5da0a5[_0x75db('0x3b')]=qs[_0x75db('0x3b')](_0x3233a3['query']['offset']);}return _0xad56f4['getSubjects'](_0x5da0a5);}})[_0x75db('0x25')](function(_0x427de2){if(_0x427de2){return _0x427de2?{'count':_0x2cf20c,'rows':_0x427de2}:null;}})[_0x75db('0x25')](respondWithResult(_0x2ac254,null))[_0x75db('0x45')](handleError(_0x2ac254,null));};exports['getDescriptions']=function(_0x58d941,_0x2c7522,_0x496758){var _0x4c5cbe={};var _0x571d7c={};var _0x156e42;var _0x323f5c;return db[_0x75db('0x2c')]['findOne']({'where':{'id':_0x58d941['params']['id']}})[_0x75db('0x25')](handleEntityNotFound(_0x2c7522,null))[_0x75db('0x25')](function(_0x469c23){if(_0x469c23){_0x156e42=_0x469c23;_0x571d7c[_0x75db('0x31')]=_[_0x75db('0x32')](db[_0x75db('0x4e')][_0x75db('0x2d')]);_0x571d7c['query']=_[_0x75db('0x32')](_0x58d941[_0x75db('0x33')]);_0x571d7c[_0x75db('0x34')]=_[_0x75db('0x35')](_0x571d7c[_0x75db('0x31')],_0x571d7c[_0x75db('0x33')]);_0x4c5cbe[_0x75db('0x36')]=_[_0x75db('0x35')](_0x571d7c[_0x75db('0x31')],qs[_0x75db('0x37')](_0x58d941['query'][_0x75db('0x37')]));_0x4c5cbe[_0x75db('0x36')]=_0x4c5cbe[_0x75db('0x36')][_0x75db('0x38')]?_0x4c5cbe[_0x75db('0x36')]:_0x571d7c[_0x75db('0x31')];_0x4c5cbe[_0x75db('0x3c')]=qs[_0x75db('0x3d')](_0x58d941[_0x75db('0x33')][_0x75db('0x3d')]);_0x4c5cbe['where']=qs[_0x75db('0x34')](_[_0x75db('0x3e')](_0x58d941[_0x75db('0x33')],_0x571d7c[_0x75db('0x34')]));if(_0x58d941[_0x75db('0x33')][_0x75db('0x3f')]){_0x4c5cbe['where']=_[_0x75db('0x42')](_0x4c5cbe[_0x75db('0x40')],{'$or':_[_0x75db('0x2b')](_0x4c5cbe[_0x75db('0x36')],function(_0xf4c173){var _0x212b7e={};_0x212b7e[_0xf4c173]={'$like':'%'+_0x58d941[_0x75db('0x33')][_0x75db('0x3f')]+'%'};return _0x212b7e;})});}_0x4c5cbe=_[_0x75db('0x42')]({},_0x4c5cbe,_0x58d941[_0x75db('0x43')]);return _0x156e42['getDescriptions'](_0x4c5cbe);}})[_0x75db('0x25')](function(_0x53e641){if(_0x53e641){_0x323f5c=_0x53e641['length'];if(!_0x58d941[_0x75db('0x33')][_0x75db('0x39')](_0x75db('0x4f'))){_0x4c5cbe[_0x75db('0x3a')]=qs['limit'](_0x58d941['query']['limit']);_0x4c5cbe[_0x75db('0x3b')]=qs[_0x75db('0x3b')](_0x58d941[_0x75db('0x33')][_0x75db('0x3b')]);}return _0x156e42[_0x75db('0x51')](_0x4c5cbe);}})[_0x75db('0x25')](function(_0x595975){if(_0x595975){return _0x595975?{'count':_0x323f5c,'rows':_0x595975}:null;}})[_0x75db('0x25')](respondWithResult(_0x2c7522,null))['catch'](handleError(_0x2c7522,null));};exports[_0x75db('0x52')]=function(_0x15f41e,_0x55017e,_0x471d14){var _0x625d32={};var _0x44f229={};var _0x77e78e;var _0x56db88;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x15f41e[_0x75db('0x47')]['id']}})['then'](handleEntityNotFound(_0x55017e,null))[_0x75db('0x25')](function(_0x506e1a){if(_0x506e1a){_0x77e78e=_0x506e1a;_0x44f229[_0x75db('0x31')]=_[_0x75db('0x32')](db[_0x75db('0x53')][_0x75db('0x2d')]);_0x44f229['query']=_[_0x75db('0x32')](_0x15f41e[_0x75db('0x33')]);_0x44f229['filters']=_[_0x75db('0x35')](_0x44f229[_0x75db('0x31')],_0x44f229['query']);_0x625d32[_0x75db('0x36')]=_[_0x75db('0x35')](_0x44f229['model'],qs[_0x75db('0x37')](_0x15f41e[_0x75db('0x33')][_0x75db('0x37')]));_0x625d32['attributes']=_0x625d32[_0x75db('0x36')][_0x75db('0x38')]?_0x625d32[_0x75db('0x36')]:_0x44f229[_0x75db('0x31')];_0x625d32['order']=qs[_0x75db('0x3d')](_0x15f41e[_0x75db('0x33')][_0x75db('0x3d')]);_0x625d32[_0x75db('0x40')]=qs[_0x75db('0x34')](_[_0x75db('0x3e')](_0x15f41e[_0x75db('0x33')],_0x44f229[_0x75db('0x34')]));if(_0x15f41e[_0x75db('0x33')]['filter']){_0x625d32['where']=_[_0x75db('0x42')](_0x625d32['where'],{'$or':_[_0x75db('0x2b')](_0x625d32[_0x75db('0x36')],function(_0x12b03d){var _0x2c8219={};_0x2c8219[_0x12b03d]={'$like':'%'+_0x15f41e['query'][_0x75db('0x3f')]+'%'};return _0x2c8219;})});}_0x625d32=_[_0x75db('0x42')]({},_0x625d32,_0x15f41e[_0x75db('0x43')]);return _0x77e78e['getTags'](_0x625d32);}})[_0x75db('0x25')](function(_0x3312b7){if(_0x3312b7){_0x56db88=_0x3312b7[_0x75db('0x38')];if(!_0x15f41e['query'][_0x75db('0x39')](_0x75db('0x4f'))){_0x625d32[_0x75db('0x3a')]=qs[_0x75db('0x3a')](_0x15f41e[_0x75db('0x33')][_0x75db('0x3a')]);_0x625d32['offset']=qs[_0x75db('0x3b')](_0x15f41e[_0x75db('0x33')][_0x75db('0x3b')]);}return _0x77e78e[_0x75db('0x52')](_0x625d32);}})[_0x75db('0x25')](function(_0x29f7d9){if(_0x29f7d9){return _0x29f7d9?{'count':_0x56db88,'rows':_0x29f7d9}:null;}})[_0x75db('0x25')](respondWithResult(_0x55017e,null))[_0x75db('0x45')](handleError(_0x55017e,null));};exports['setTags']=function(_0x202878,_0x127da4,_0x2ecf8b){if(_0x202878[_0x75db('0x4b')]['id']){delete _0x202878[_0x75db('0x4b')]['id'];}return db[_0x75db('0x2c')]['findOne']({'where':{'id':_0x202878[_0x75db('0x47')]['id']}})['then'](handleEntityNotFound(_0x127da4,null))[_0x75db('0x25')](function(_0x5456c6){if(_0x5456c6){return _0x5456c6[_0x75db('0x54')](_0x202878[_0x75db('0x4b')][_0x75db('0x55')]||[]);}return null;})[_0x75db('0x25')](respondWithResult(_0x127da4,null))[_0x75db('0x45')](handleError(_0x127da4,null));}; \ No newline at end of file +var _0x6c4b=['getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','keys','ZendeskConfiguration','include','find','catch','create','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions'];(function(_0x3ac31a,_0x18f1b9){var _0x4caa11=function(_0x2d2211){while(--_0x2d2211){_0x3ac31a['push'](_0x3ac31a['shift']());}};_0x4caa11(++_0x18f1b9);}(_0x6c4b,0xa5));var _0xb6c4=function(_0x265a38,_0x26f553){_0x265a38=_0x265a38-0x0;var _0x510102=_0x6c4b[_0x265a38];return _0x510102;};'use strict';var emlformat=require(_0xb6c4('0x0'));var rimraf=require(_0xb6c4('0x1'));var zipdir=require(_0xb6c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c4('0x3'));var moment=require(_0xb6c4('0x4'));var BPromise=require(_0xb6c4('0x5'));var Mustache=require(_0xb6c4('0x6'));var util=require(_0xb6c4('0x7'));var path=require(_0xb6c4('0x8'));var sox=require(_0xb6c4('0x9'));var csv=require(_0xb6c4('0xa'));var ejs=require(_0xb6c4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6c4('0xc'));var squel=require('squel');var crypto=require(_0xb6c4('0xd'));var jsforce=require(_0xb6c4('0xe'));var deskjs=require(_0xb6c4('0xf'));var toCsv=require(_0xb6c4('0xa'));var querystring=require(_0xb6c4('0x10'));var Papa=require(_0xb6c4('0x11'));var Redis=require(_0xb6c4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb6c4('0x13'));var as=require(_0xb6c4('0x14'));var hardwareService=require(_0xb6c4('0x15'));var logger=require(_0xb6c4('0x16'))(_0xb6c4('0x17'));var utils=require(_0xb6c4('0x18'));var config=require(_0xb6c4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6c4('0x1a'))['db'];function respondWithStatusCode(_0x29ae16,_0x3b6f57){_0x3b6f57=_0x3b6f57||0xcc;return function(_0x42636d){if(_0x42636d){return _0x29ae16[_0xb6c4('0x1b')](_0x3b6f57);}return _0x29ae16[_0xb6c4('0x1c')](_0x3b6f57)['end']();};}function respondWithResult(_0x368201,_0x380710){_0x380710=_0x380710||0xc8;return function(_0x949282){if(_0x949282){return _0x368201[_0xb6c4('0x1c')](_0x380710)['json'](_0x949282);}};}function respondWithFilteredResult(_0x1f49b5,_0x416f70){return function(_0x5f35a7){if(_0x5f35a7){var _0x3fc9bd=typeof _0x416f70['offset']===_0xb6c4('0x1d')&&typeof _0x416f70[_0xb6c4('0x1e')]===_0xb6c4('0x1d');var _0x440c43=_0x5f35a7[_0xb6c4('0x1f')];var _0x5a29ec=_0x3fc9bd?0x0:_0x416f70[_0xb6c4('0x20')];var _0xbe81c6=_0x3fc9bd?_0x5f35a7[_0xb6c4('0x1f')]:_0x416f70[_0xb6c4('0x20')]+_0x416f70[_0xb6c4('0x1e')];var _0x12e5e9;if(_0xbe81c6>=_0x440c43){_0xbe81c6=_0x440c43;_0x12e5e9=0xc8;}else{_0x12e5e9=0xce;}_0x1f49b5[_0xb6c4('0x1c')](_0x12e5e9);return _0x1f49b5['set'](_0xb6c4('0x21'),_0x5a29ec+'-'+_0xbe81c6+'/'+_0x440c43)[_0xb6c4('0x22')](_0x5f35a7);}return null;};}function patchUpdates(_0x3aace0){return function(_0xa079e2){try{jsonpatch['apply'](_0xa079e2,_0x3aace0,!![]);}catch(_0x4fcee9){return BPromise[_0xb6c4('0x23')](_0x4fcee9);}return _0xa079e2['save']();};}function saveUpdates(_0x1ea237,_0x4a5672){return function(_0x3f3563){if(_0x3f3563){return _0x3f3563[_0xb6c4('0x24')](_0x1ea237)[_0xb6c4('0x25')](function(_0x5a8a5d){return _0x5a8a5d;});}return null;};}function removeEntity(_0x121b74,_0x3cc155){return function(_0x1ba91b){if(_0x1ba91b){return _0x1ba91b[_0xb6c4('0x26')]()[_0xb6c4('0x25')](function(){_0x121b74[_0xb6c4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c987,_0x2ec4d1){return function(_0x679992){if(!_0x679992){_0x43c987['sendStatus'](0x194);}return _0x679992;};}function handleError(_0x2c0546,_0x22ca39){_0x22ca39=_0x22ca39||0x1f4;return function(_0x15c800){logger['error'](_0x15c800[_0xb6c4('0x27')]);if(_0x15c800[_0xb6c4('0x28')]){delete _0x15c800[_0xb6c4('0x28')];}_0x2c0546['status'](_0x22ca39)['send'](_0x15c800);};}exports[_0xb6c4('0x29')]=function(_0x4cb50f,_0x5154da){var _0x119c9b={},_0x33531b={},_0x29b7c8={'count':0x0,'rows':[]};var _0x14c678=_[_0xb6c4('0x2a')](db['ZendeskConfiguration'][_0xb6c4('0x2b')],function(_0x5d365f){return{'name':_0x5d365f['fieldName'],'type':_0x5d365f[_0xb6c4('0x2c')][_0xb6c4('0x2d')]};});_0x33531b[_0xb6c4('0x2e')]=_[_0xb6c4('0x2a')](_0x14c678,_0xb6c4('0x28'));_0x33531b[_0xb6c4('0x2f')]=_['keys'](_0x4cb50f[_0xb6c4('0x2f')]);_0x33531b[_0xb6c4('0x30')]=_['intersection'](_0x33531b[_0xb6c4('0x2e')],_0x33531b['query']);_0x119c9b['attributes']=_[_0xb6c4('0x31')](_0x33531b[_0xb6c4('0x2e')],qs[_0xb6c4('0x32')](_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x32')]));_0x119c9b[_0xb6c4('0x33')]=_0x119c9b['attributes'][_0xb6c4('0x34')]?_0x119c9b[_0xb6c4('0x33')]:_0x33531b[_0xb6c4('0x2e')];if(!_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x35')](_0xb6c4('0x36'))){_0x119c9b[_0xb6c4('0x1e')]=qs[_0xb6c4('0x1e')](_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x1e')]);_0x119c9b[_0xb6c4('0x20')]=qs[_0xb6c4('0x20')](_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x20')]);}_0x119c9b['order']=qs[_0xb6c4('0x37')](_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x37')]);_0x119c9b[_0xb6c4('0x38')]=qs[_0xb6c4('0x30')](_[_0xb6c4('0x39')](_0x4cb50f['query'],_0x33531b[_0xb6c4('0x30')]),_0x14c678);if(_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x3a')]){_0x119c9b[_0xb6c4('0x38')]=_['merge'](_0x119c9b['where'],{'$or':_[_0xb6c4('0x2a')](_0x14c678,function(_0xac92df){if(_0xac92df[_0xb6c4('0x2c')]!=='VIRTUAL'){var _0x22e03f={};_0x22e03f[_0xac92df[_0xb6c4('0x28')]]={'$like':'%'+_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x3a')]+'%'};return _0x22e03f;}})});}_0x119c9b=_[_0xb6c4('0x3b')]({},_0x119c9b,_0x4cb50f[_0xb6c4('0x3c')]);var _0x159060={'where':_0x119c9b[_0xb6c4('0x38')]};return db['ZendeskConfiguration']['count'](_0x159060)[_0xb6c4('0x25')](function(_0x4c065d){_0x29b7c8[_0xb6c4('0x1f')]=_0x4c065d;if(_0x4cb50f[_0xb6c4('0x2f')][_0xb6c4('0x3d')]){_0x119c9b['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb6c4('0x3e')](_0x119c9b);})[_0xb6c4('0x25')](function(_0x411875){_0x29b7c8[_0xb6c4('0x3f')]=_0x411875;return _0x29b7c8;})['then'](respondWithFilteredResult(_0x5154da,_0x119c9b))['catch'](handleError(_0x5154da,null));};exports['show']=function(_0x100bfe,_0x1e1cf9){var _0x2b9fea={'raw':![],'where':{'id':_0x100bfe[_0xb6c4('0x40')]['id']}},_0x5e4b66={};_0x5e4b66['model']=_[_0xb6c4('0x41')](db[_0xb6c4('0x42')][_0xb6c4('0x2b')]);_0x5e4b66[_0xb6c4('0x2f')]=_['keys'](_0x100bfe[_0xb6c4('0x2f')]);_0x5e4b66[_0xb6c4('0x30')]=_[_0xb6c4('0x31')](_0x5e4b66['model'],_0x5e4b66[_0xb6c4('0x2f')]);_0x2b9fea[_0xb6c4('0x33')]=_['intersection'](_0x5e4b66[_0xb6c4('0x2e')],qs[_0xb6c4('0x32')](_0x100bfe[_0xb6c4('0x2f')][_0xb6c4('0x32')]));_0x2b9fea[_0xb6c4('0x33')]=_0x2b9fea[_0xb6c4('0x33')][_0xb6c4('0x34')]?_0x2b9fea[_0xb6c4('0x33')]:_0x5e4b66['model'];if(_0x100bfe[_0xb6c4('0x2f')][_0xb6c4('0x3d')]){_0x2b9fea[_0xb6c4('0x43')]=[{'all':!![]}];}_0x2b9fea=_[_0xb6c4('0x3b')]({},_0x2b9fea,_0x100bfe[_0xb6c4('0x3c')]);return db['ZendeskConfiguration'][_0xb6c4('0x44')](_0x2b9fea)['then'](handleEntityNotFound(_0x1e1cf9,null))[_0xb6c4('0x25')](respondWithResult(_0x1e1cf9,null))[_0xb6c4('0x45')](handleError(_0x1e1cf9,null));};exports[_0xb6c4('0x46')]=function(_0x157024,_0x43332a){return db[_0xb6c4('0x42')]['create'](_0x157024['body'],{})[_0xb6c4('0x25')](respondWithResult(_0x43332a,0xc9))[_0xb6c4('0x45')](handleError(_0x43332a,null));};exports['update']=function(_0x3c670a,_0x538eb9){if(_0x3c670a['body']['id']){delete _0x3c670a[_0xb6c4('0x47')]['id'];}return db[_0xb6c4('0x42')][_0xb6c4('0x44')]({'where':{'id':_0x3c670a[_0xb6c4('0x40')]['id']}})['then'](handleEntityNotFound(_0x538eb9,null))[_0xb6c4('0x25')](saveUpdates(_0x3c670a[_0xb6c4('0x47')],null))[_0xb6c4('0x25')](respondWithResult(_0x538eb9,null))[_0xb6c4('0x45')](handleError(_0x538eb9,null));};exports[_0xb6c4('0x26')]=function(_0x105438,_0x2419cd){return db[_0xb6c4('0x42')]['find']({'where':{'id':_0x105438[_0xb6c4('0x40')]['id']}})['then'](handleEntityNotFound(_0x2419cd,null))[_0xb6c4('0x25')](removeEntity(_0x2419cd,null))['catch'](handleError(_0x2419cd,null));};exports[_0xb6c4('0x48')]=function(_0xe3e991,_0x57f1f8,_0x41aa85){var _0x26fa0e={};var _0x5447a4={};var _0x2e38ae;var _0x357433;return db[_0xb6c4('0x42')][_0xb6c4('0x49')]({'where':{'id':_0xe3e991['params']['id']}})[_0xb6c4('0x25')](handleEntityNotFound(_0x57f1f8,null))['then'](function(_0x2236e6){if(_0x2236e6){_0x2e38ae=_0x2236e6;_0x5447a4[_0xb6c4('0x2e')]=_['keys'](db[_0xb6c4('0x4a')][_0xb6c4('0x2b')]);_0x5447a4[_0xb6c4('0x2f')]=_[_0xb6c4('0x41')](_0xe3e991['query']);_0x5447a4[_0xb6c4('0x30')]=_[_0xb6c4('0x31')](_0x5447a4[_0xb6c4('0x2e')],_0x5447a4[_0xb6c4('0x2f')]);_0x26fa0e[_0xb6c4('0x33')]=_[_0xb6c4('0x31')](_0x5447a4[_0xb6c4('0x2e')],qs['fields'](_0xe3e991[_0xb6c4('0x2f')]['fields']));_0x26fa0e['attributes']=_0x26fa0e['attributes'][_0xb6c4('0x34')]?_0x26fa0e[_0xb6c4('0x33')]:_0x5447a4[_0xb6c4('0x2e')];_0x26fa0e[_0xb6c4('0x4b')]=qs['sort'](_0xe3e991[_0xb6c4('0x2f')][_0xb6c4('0x37')]);_0x26fa0e['where']=qs[_0xb6c4('0x30')](_[_0xb6c4('0x39')](_0xe3e991[_0xb6c4('0x2f')],_0x5447a4[_0xb6c4('0x30')]));if(_0xe3e991[_0xb6c4('0x2f')]['filter']){_0x26fa0e['where']=_[_0xb6c4('0x3b')](_0x26fa0e[_0xb6c4('0x38')],{'$or':_['map'](_0x26fa0e[_0xb6c4('0x33')],function(_0x256810){var _0x24c8d9={};_0x24c8d9[_0x256810]={'$like':'%'+_0xe3e991['query'][_0xb6c4('0x3a')]+'%'};return _0x24c8d9;})});}_0x26fa0e=_[_0xb6c4('0x3b')]({},_0x26fa0e,_0xe3e991[_0xb6c4('0x3c')]);return _0x2e38ae[_0xb6c4('0x48')](_0x26fa0e);}})[_0xb6c4('0x25')](function(_0x3528a5){if(_0x3528a5){_0x357433=_0x3528a5[_0xb6c4('0x34')];if(!_0xe3e991[_0xb6c4('0x2f')][_0xb6c4('0x35')](_0xb6c4('0x36'))){_0x26fa0e[_0xb6c4('0x1e')]=qs[_0xb6c4('0x1e')](_0xe3e991['query'][_0xb6c4('0x1e')]);_0x26fa0e[_0xb6c4('0x20')]=qs['offset'](_0xe3e991['query']['offset']);}return _0x2e38ae[_0xb6c4('0x48')](_0x26fa0e);}})[_0xb6c4('0x25')](function(_0x314ee8){if(_0x314ee8){return _0x314ee8?{'count':_0x357433,'rows':_0x314ee8}:null;}})['then'](respondWithResult(_0x57f1f8,null))[_0xb6c4('0x45')](handleError(_0x57f1f8,null));};exports[_0xb6c4('0x4c')]=function(_0x284734,_0x4b12ba,_0x4946b3){var _0x50bb39={};var _0x528108={};var _0xc366a9;var _0x475297;return db[_0xb6c4('0x42')][_0xb6c4('0x49')]({'where':{'id':_0x284734[_0xb6c4('0x40')]['id']}})[_0xb6c4('0x25')](handleEntityNotFound(_0x4b12ba,null))['then'](function(_0x201b50){if(_0x201b50){_0xc366a9=_0x201b50;_0x528108[_0xb6c4('0x2e')]=_[_0xb6c4('0x41')](db[_0xb6c4('0x4a')][_0xb6c4('0x2b')]);_0x528108[_0xb6c4('0x2f')]=_['keys'](_0x284734['query']);_0x528108[_0xb6c4('0x30')]=_[_0xb6c4('0x31')](_0x528108[_0xb6c4('0x2e')],_0x528108[_0xb6c4('0x2f')]);_0x50bb39['attributes']=_[_0xb6c4('0x31')](_0x528108['model'],qs['fields'](_0x284734[_0xb6c4('0x2f')]['fields']));_0x50bb39[_0xb6c4('0x33')]=_0x50bb39[_0xb6c4('0x33')][_0xb6c4('0x34')]?_0x50bb39[_0xb6c4('0x33')]:_0x528108[_0xb6c4('0x2e')];_0x50bb39[_0xb6c4('0x4b')]=qs[_0xb6c4('0x37')](_0x284734[_0xb6c4('0x2f')][_0xb6c4('0x37')]);_0x50bb39[_0xb6c4('0x38')]=qs[_0xb6c4('0x30')](_[_0xb6c4('0x39')](_0x284734[_0xb6c4('0x2f')],_0x528108[_0xb6c4('0x30')]));if(_0x284734[_0xb6c4('0x2f')][_0xb6c4('0x3a')]){_0x50bb39['where']=_[_0xb6c4('0x3b')](_0x50bb39[_0xb6c4('0x38')],{'$or':_['map'](_0x50bb39[_0xb6c4('0x33')],function(_0x43815d){var _0x5713c8={};_0x5713c8[_0x43815d]={'$like':'%'+_0x284734['query']['filter']+'%'};return _0x5713c8;})});}_0x50bb39=_[_0xb6c4('0x3b')]({},_0x50bb39,_0x284734[_0xb6c4('0x3c')]);return _0xc366a9[_0xb6c4('0x4c')](_0x50bb39);}})[_0xb6c4('0x25')](function(_0xff8191){if(_0xff8191){_0x475297=_0xff8191[_0xb6c4('0x34')];if(!_0x284734[_0xb6c4('0x2f')][_0xb6c4('0x35')](_0xb6c4('0x36'))){_0x50bb39[_0xb6c4('0x1e')]=qs[_0xb6c4('0x1e')](_0x284734[_0xb6c4('0x2f')][_0xb6c4('0x1e')]);_0x50bb39[_0xb6c4('0x20')]=qs['offset'](_0x284734[_0xb6c4('0x2f')][_0xb6c4('0x20')]);}return _0xc366a9[_0xb6c4('0x4c')](_0x50bb39);}})[_0xb6c4('0x25')](function(_0x4393e1){if(_0x4393e1){return _0x4393e1?{'count':_0x475297,'rows':_0x4393e1}:null;}})[_0xb6c4('0x25')](respondWithResult(_0x4b12ba,null))[_0xb6c4('0x45')](handleError(_0x4b12ba,null));};exports[_0xb6c4('0x4d')]=function(_0x531728,_0x24932b,_0xa4a678){var _0x5482e8={};var _0x26e9ff={};var _0x5218d4;var _0x223d8e;return db[_0xb6c4('0x42')][_0xb6c4('0x49')]({'where':{'id':_0x531728[_0xb6c4('0x40')]['id']}})[_0xb6c4('0x25')](handleEntityNotFound(_0x24932b,null))['then'](function(_0x41c93b){if(_0x41c93b){_0x5218d4=_0x41c93b;_0x26e9ff[_0xb6c4('0x2e')]=_[_0xb6c4('0x41')](db[_0xb6c4('0x4a')]['rawAttributes']);_0x26e9ff[_0xb6c4('0x2f')]=_['keys'](_0x531728[_0xb6c4('0x2f')]);_0x26e9ff['filters']=_[_0xb6c4('0x31')](_0x26e9ff[_0xb6c4('0x2e')],_0x26e9ff[_0xb6c4('0x2f')]);_0x5482e8[_0xb6c4('0x33')]=_[_0xb6c4('0x31')](_0x26e9ff[_0xb6c4('0x2e')],qs[_0xb6c4('0x32')](_0x531728[_0xb6c4('0x2f')][_0xb6c4('0x32')]));_0x5482e8['attributes']=_0x5482e8['attributes'][_0xb6c4('0x34')]?_0x5482e8[_0xb6c4('0x33')]:_0x26e9ff[_0xb6c4('0x2e')];_0x5482e8['order']=qs[_0xb6c4('0x37')](_0x531728[_0xb6c4('0x2f')][_0xb6c4('0x37')]);_0x5482e8[_0xb6c4('0x38')]=qs[_0xb6c4('0x30')](_[_0xb6c4('0x39')](_0x531728[_0xb6c4('0x2f')],_0x26e9ff['filters']));if(_0x531728['query'][_0xb6c4('0x3a')]){_0x5482e8['where']=_[_0xb6c4('0x3b')](_0x5482e8[_0xb6c4('0x38')],{'$or':_['map'](_0x5482e8['attributes'],function(_0x10e6da){var _0x2d5ec7={};_0x2d5ec7[_0x10e6da]={'$like':'%'+_0x531728[_0xb6c4('0x2f')][_0xb6c4('0x3a')]+'%'};return _0x2d5ec7;})});}_0x5482e8=_['merge']({},_0x5482e8,_0x531728[_0xb6c4('0x3c')]);return _0x5218d4[_0xb6c4('0x4d')](_0x5482e8);}})[_0xb6c4('0x25')](function(_0x54f418){if(_0x54f418){_0x223d8e=_0x54f418[_0xb6c4('0x34')];if(!_0x531728[_0xb6c4('0x2f')][_0xb6c4('0x35')](_0xb6c4('0x36'))){_0x5482e8[_0xb6c4('0x1e')]=qs['limit'](_0x531728['query'][_0xb6c4('0x1e')]);_0x5482e8[_0xb6c4('0x20')]=qs[_0xb6c4('0x20')](_0x531728[_0xb6c4('0x2f')][_0xb6c4('0x20')]);}return _0x5218d4[_0xb6c4('0x4d')](_0x5482e8);}})[_0xb6c4('0x25')](function(_0x2fc177){if(_0x2fc177){return _0x2fc177?{'count':_0x223d8e,'rows':_0x2fc177}:null;}})[_0xb6c4('0x25')](respondWithResult(_0x24932b,null))[_0xb6c4('0x45')](handleError(_0x24932b,null));};exports[_0xb6c4('0x4e')]=function(_0x4f6e1d,_0x34a015,_0x4dbd77){var _0x48fc1a={};var _0x3fc1ad={};var _0x47cf28;var _0xbad4b;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4f6e1d[_0xb6c4('0x40')]['id']}})['then'](handleEntityNotFound(_0x34a015,null))['then'](function(_0xae9326){if(_0xae9326){_0x47cf28=_0xae9326;_0x3fc1ad[_0xb6c4('0x2e')]=_[_0xb6c4('0x41')](db['Tag'][_0xb6c4('0x2b')]);_0x3fc1ad[_0xb6c4('0x2f')]=_[_0xb6c4('0x41')](_0x4f6e1d[_0xb6c4('0x2f')]);_0x3fc1ad['filters']=_['intersection'](_0x3fc1ad[_0xb6c4('0x2e')],_0x3fc1ad[_0xb6c4('0x2f')]);_0x48fc1a['attributes']=_['intersection'](_0x3fc1ad[_0xb6c4('0x2e')],qs[_0xb6c4('0x32')](_0x4f6e1d[_0xb6c4('0x2f')][_0xb6c4('0x32')]));_0x48fc1a['attributes']=_0x48fc1a[_0xb6c4('0x33')][_0xb6c4('0x34')]?_0x48fc1a['attributes']:_0x3fc1ad['model'];_0x48fc1a[_0xb6c4('0x4b')]=qs[_0xb6c4('0x37')](_0x4f6e1d[_0xb6c4('0x2f')][_0xb6c4('0x37')]);_0x48fc1a['where']=qs[_0xb6c4('0x30')](_[_0xb6c4('0x39')](_0x4f6e1d[_0xb6c4('0x2f')],_0x3fc1ad[_0xb6c4('0x30')]));if(_0x4f6e1d['query']['filter']){_0x48fc1a[_0xb6c4('0x38')]=_['merge'](_0x48fc1a[_0xb6c4('0x38')],{'$or':_[_0xb6c4('0x2a')](_0x48fc1a[_0xb6c4('0x33')],function(_0x218472){var _0x6b2ad4={};_0x6b2ad4[_0x218472]={'$like':'%'+_0x4f6e1d[_0xb6c4('0x2f')][_0xb6c4('0x3a')]+'%'};return _0x6b2ad4;})});}_0x48fc1a=_['merge']({},_0x48fc1a,_0x4f6e1d[_0xb6c4('0x3c')]);return _0x47cf28['getTags'](_0x48fc1a);}})[_0xb6c4('0x25')](function(_0x391d84){if(_0x391d84){_0xbad4b=_0x391d84['length'];if(!_0x4f6e1d['query'][_0xb6c4('0x35')](_0xb6c4('0x36'))){_0x48fc1a[_0xb6c4('0x1e')]=qs['limit'](_0x4f6e1d['query'][_0xb6c4('0x1e')]);_0x48fc1a[_0xb6c4('0x20')]=qs['offset'](_0x4f6e1d[_0xb6c4('0x2f')][_0xb6c4('0x20')]);}return _0x47cf28[_0xb6c4('0x4e')](_0x48fc1a);}})[_0xb6c4('0x25')](function(_0x1f77ee){if(_0x1f77ee){return _0x1f77ee?{'count':_0xbad4b,'rows':_0x1f77ee}:null;}})['then'](respondWithResult(_0x34a015,null))[_0xb6c4('0x45')](handleError(_0x34a015,null));};exports[_0xb6c4('0x4f')]=function(_0x521413,_0x2c7204,_0x25e6f5){if(_0x521413['body']['id']){delete _0x521413[_0xb6c4('0x47')]['id'];}return db['ZendeskConfiguration'][_0xb6c4('0x49')]({'where':{'id':_0x521413[_0xb6c4('0x40')]['id']}})[_0xb6c4('0x25')](handleEntityNotFound(_0x2c7204,null))[_0xb6c4('0x25')](function(_0x2c735a){if(_0x2c735a){return _0x2c735a[_0xb6c4('0x4f')](_0x521413[_0xb6c4('0x47')][_0xb6c4('0x50')]||[]);}return null;})[_0xb6c4('0x25')](respondWithResult(_0x2c7204,null))[_0xb6c4('0x45')](handleError(_0x2c7204,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 18b2f1c..3475471 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 _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x2839de,_0x174168){var _0xd459f8=function(_0x5671a4){while(--_0x5671a4){_0x2839de['push'](_0x2839de['shift']());}};_0xd459f8(++_0x174168);}(_0xcf66,0x71));var _0x6cf6=function(_0x8f71e7,_0x501f54){_0x8f71e7=_0x8f71e7-0x0;var _0x3d16a8=_0xcf66[_0x8f71e7];return _0x3d16a8;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3f5d9a,_0x16c80b){_0x3f5d9a=_0x3f5d9a-0x0;var _0x42bb1c=_0xd4f4[_0x3f5d9a];return _0x42bb1c;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index fda5dfb..97f883b 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 _0xa9f0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0xa9f0,0x11b));var _0x0a9f=function(_0x302e8c,_0x31b9ce){_0x302e8c=_0x302e8c-0x0;var _0xa39cd7=_0xa9f0[_0x302e8c];return _0xa39cd7;};'use strict';var _=require(_0x0a9f('0x0'));var util=require(_0x0a9f('0x1'));var moment=require(_0x0a9f('0x2'));var BPromise=require(_0x0a9f('0x3'));var rs=require(_0x0a9f('0x4'));var fs=require('fs');var Redis=require(_0x0a9f('0x5'));var db=require(_0x0a9f('0x6'))['db'];var utils=require(_0x0a9f('0x7'));var logger=require(_0x0a9f('0x8'))(_0x0a9f('0x9'));var config=require(_0x0a9f('0xa'));var jayson=require(_0x0a9f('0xb'));var client=jayson[_0x0a9f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb64d,_0x2c1548,_0x3e393d){return new BPromise(function(_0x371ef7,_0x5bcb18){return client[_0x0a9f('0xd')](_0x2eb64d,_0x3e393d)[_0x0a9f('0xe')](function(_0x80b015){logger[_0x0a9f('0xf')](_0x0a9f('0x10'),_0x2c1548,_0x0a9f('0x11'));logger[_0x0a9f('0x12')](_0x0a9f('0x13'),_0x2c1548,_0x0a9f('0x11'),JSON[_0x0a9f('0x14')](_0x80b015));if(_0x80b015[_0x0a9f('0x15')]){if(_0x80b015[_0x0a9f('0x15')][_0x0a9f('0x16')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2c1548,_0x80b015[_0x0a9f('0x15')]['message']);return _0x5bcb18(_0x80b015['error'][_0x0a9f('0x17')]);}logger['error'](_0x0a9f('0x10'),_0x2c1548,_0x80b015['error'][_0x0a9f('0x17')]);return _0x371ef7(_0x80b015['error'][_0x0a9f('0x17')]);}else{logger['info'](_0x0a9f('0x10'),_0x2c1548,_0x0a9f('0x11'));_0x371ef7(_0x80b015[_0x0a9f('0x18')]['message']);}})[_0x0a9f('0x19')](function(_0x41f95a){logger[_0x0a9f('0x15')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2c1548,_0x41f95a);_0x5bcb18(_0x41f95a);});});} \ No newline at end of file +var _0x4f53=['then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x4bafac,_0x4ab088){var _0x2f706b=function(_0xb49191){while(--_0xb49191){_0x4bafac['push'](_0x4bafac['shift']());}};_0x2f706b(++_0x4ab088);}(_0x4f53,0x1c4));var _0x34f5=function(_0x15542a,_0x427744){_0x15542a=_0x15542a-0x0;var _0x5a9079=_0x4f53[_0x15542a];return _0x5a9079;};'use strict';var _=require(_0x34f5('0x0'));var util=require(_0x34f5('0x1'));var moment=require('moment');var BPromise=require(_0x34f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34f5('0x4'));var logger=require('../../config/logger')(_0x34f5('0x5'));var config=require(_0x34f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x34f5('0x7')][_0x34f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23051c,_0x49a477,_0x1de920){return new BPromise(function(_0x1b8dab,_0x1f913c){return client[_0x34f5('0x9')](_0x23051c,_0x1de920)[_0x34f5('0xa')](function(_0x11b439){logger['info'](_0x34f5('0xb'),_0x49a477,_0x34f5('0xc'));logger[_0x34f5('0xd')](_0x34f5('0xe'),_0x49a477,_0x34f5('0xc'),JSON[_0x34f5('0xf')](_0x11b439));if(_0x11b439['error']){if(_0x11b439[_0x34f5('0x10')][_0x34f5('0x11')]===0x1f4){logger[_0x34f5('0x10')](_0x34f5('0xb'),_0x49a477,_0x11b439[_0x34f5('0x10')][_0x34f5('0x12')]);return _0x1f913c(_0x11b439[_0x34f5('0x10')][_0x34f5('0x12')]);}logger[_0x34f5('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x49a477,_0x11b439['error'][_0x34f5('0x12')]);return _0x1b8dab(_0x11b439[_0x34f5('0x10')][_0x34f5('0x12')]);}else{logger[_0x34f5('0x13')](_0x34f5('0xb'),_0x49a477,'request\x20sent');_0x1b8dab(_0x11b439[_0x34f5('0x14')]['message']);}})[_0x34f5('0x15')](function(_0x52e263){logger[_0x34f5('0x10')](_0x34f5('0xb'),_0x49a477,_0x52e263);_0x1f913c(_0x52e263);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0f22348..35d59d4 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 _0x87a0=['create','put','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2f163c,_0x27bd79){var _0x3dd996=function(_0x274ff5){while(--_0x274ff5){_0x2f163c['push'](_0x2f163c['shift']());}};_0x3dd996(++_0x27bd79);}(_0x87a0,0xc9));var _0x087a=function(_0x5e5705,_0x4fd4f7){_0x5e5705=_0x5e5705-0x0;var _0x136165=_0x87a0[_0x5e5705];return _0x136165;};'use strict';var multer=require('multer');var util=require(_0x087a('0x0'));var path=require(_0x087a('0x1'));var timeout=require(_0x087a('0x2'));var express=require(_0x087a('0x3'));var router=express['Router']();var fs_extra=require(_0x087a('0x4'));var auth=require(_0x087a('0x5'));var interaction=require(_0x087a('0x6'));var config=require(_0x087a('0x7'));var controller=require(_0x087a('0x8'));router[_0x087a('0x9')]('/',auth[_0x087a('0xa')](),controller[_0x087a('0xb')]);router[_0x087a('0x9')](_0x087a('0xc'),auth[_0x087a('0xa')](),controller[_0x087a('0xd')]);router[_0x087a('0xe')]('/',auth[_0x087a('0xa')](),controller[_0x087a('0xf')]);router[_0x087a('0x10')]('/:id',auth[_0x087a('0xa')](),controller[_0x087a('0x11')]);router['delete'](_0x087a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9b45=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x22c095,_0x18cf27){var _0x3a8b6d=function(_0x241539){while(--_0x241539){_0x22c095['push'](_0x22c095['shift']());}};_0x3a8b6d(++_0x18cf27);}(_0x9b45,0x8e));var _0x59b4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9b45[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x59b4('0x0'));var util=require(_0x59b4('0x1'));var path=require(_0x59b4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59b4('0x3')]();var fs_extra=require(_0x59b4('0x4'));var auth=require(_0x59b4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x59b4('0x6'));router[_0x59b4('0x7')]('/',auth[_0x59b4('0x8')](),controller[_0x59b4('0x9')]);router[_0x59b4('0x7')](_0x59b4('0xa'),auth[_0x59b4('0x8')](),controller[_0x59b4('0xb')]);router[_0x59b4('0xc')]('/',auth[_0x59b4('0x8')](),controller[_0x59b4('0xd')]);router[_0x59b4('0xe')](_0x59b4('0xa'),auth[_0x59b4('0x8')](),controller[_0x59b4('0xf')]);router[_0x59b4('0x10')]('/:id',auth[_0x59b4('0x8')](),controller[_0x59b4('0x11')]);module[_0x59b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 31b9f40..2a2ea79 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 _0xd7a0=['string','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xd7a0,0x65));var _0x0d7a=function(_0x5e3847,_0x12ff41){_0x5e3847=_0x5e3847-0x0;var _0xbfe77e=_0xd7a0[_0x5e3847];return _0xbfe77e;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0d7a('0x1'),'variable',_0x0d7a('0x2'),_0x0d7a('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0d7a('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x0d7a('0x1'),'variable',_0x0d7a('0x2'))},'keyContent':{'type':Sequelize[_0x0d7a('0x4')]},'idField':{'type':Sequelize[_0x0d7a('0x4')]},'nameField':{'type':Sequelize[_0x0d7a('0x4')]},'customField':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d7a('0x4')]}}; \ No newline at end of file +var _0x8f41=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x1cbab7,_0x4580f1){var _0xa66e0=function(_0x492c3f){while(--_0x492c3f){_0x1cbab7['push'](_0x1cbab7['shift']());}};_0xa66e0(++_0x4580f1);}(_0x8f41,0x1cd));var _0x18f4=function(_0x1a06b4,_0x2a2c6d){_0x1a06b4=_0x1a06b4-0x0;var _0x1bf9d7=_0x8f41[_0x1a06b4];return _0x1bf9d7;};'use strict';var Sequelize=require(_0x18f4('0x0'));module['exports']={'type':{'type':Sequelize[_0x18f4('0x1')](_0x18f4('0x2'),_0x18f4('0x3'),_0x18f4('0x4'),_0x18f4('0x5'),_0x18f4('0x6')),'defaultValue':_0x18f4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x18f4('0x2'),_0x18f4('0x3'),_0x18f4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x18f4('0x7')]},'nameField':{'type':Sequelize[_0x18f4('0x7')]},'customField':{'type':Sequelize[_0x18f4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 503579f..5fa85e6 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 _0x6fbf=['where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x378e0c,_0x80ed18){var _0x26fffb=function(_0x3dc46c){while(--_0x3dc46c){_0x378e0c['push'](_0x378e0c['shift']());}};_0x26fffb(++_0x80ed18);}(_0x6fbf,0xa7));var _0xf6fb=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x6fbf[_0x19efbc];return _0x205c5e;};'use strict';var emlformat=require(_0xf6fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6fb('0x1'));var moment=require(_0xf6fb('0x2'));var BPromise=require(_0xf6fb('0x3'));var Mustache=require(_0xf6fb('0x4'));var util=require(_0xf6fb('0x5'));var path=require('path');var sox=require(_0xf6fb('0x6'));var csv=require(_0xf6fb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6fb('0x8'));var _=require(_0xf6fb('0x9'));var squel=require(_0xf6fb('0xa'));var crypto=require('crypto');var jsforce=require(_0xf6fb('0xb'));var deskjs=require(_0xf6fb('0xc'));var toCsv=require(_0xf6fb('0x7'));var querystring=require(_0xf6fb('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6fb('0xe'));var authService=require(_0xf6fb('0xf'));var qs=require(_0xf6fb('0x10'));var as=require(_0xf6fb('0x11'));var hardwareService=require(_0xf6fb('0x12'));var logger=require(_0xf6fb('0x13'))(_0xf6fb('0x14'));var utils=require(_0xf6fb('0x15'));var config=require(_0xf6fb('0x16'));var licenseUtil=require(_0xf6fb('0x17'));var db=require(_0xf6fb('0x18'))['db'];function respondWithStatusCode(_0x142465,_0x206567){_0x206567=_0x206567||0xcc;return function(_0x20c855){if(_0x20c855){return _0x142465['sendStatus'](_0x206567);}return _0x142465['status'](_0x206567)[_0xf6fb('0x19')]();};}function respondWithResult(_0xb3d8f1,_0x5ef481){_0x5ef481=_0x5ef481||0xc8;return function(_0x3c475f){if(_0x3c475f){return _0xb3d8f1[_0xf6fb('0x1a')](_0x5ef481)[_0xf6fb('0x1b')](_0x3c475f);}};}function respondWithFilteredResult(_0x37a2c4,_0x235787){return function(_0x447971){if(_0x447971){var _0x100bba=typeof _0x235787[_0xf6fb('0x1c')]==='undefined'&&typeof _0x235787['limit']===_0xf6fb('0x1d');var _0x38ef56=_0x447971[_0xf6fb('0x1e')];var _0x3ec512=_0x100bba?0x0:_0x235787['offset'];var _0x3f59a1=_0x100bba?_0x447971[_0xf6fb('0x1e')]:_0x235787[_0xf6fb('0x1c')]+_0x235787[_0xf6fb('0x1f')];var _0x12e6c6;if(_0x3f59a1>=_0x38ef56){_0x3f59a1=_0x38ef56;_0x12e6c6=0xc8;}else{_0x12e6c6=0xce;}_0x37a2c4['status'](_0x12e6c6);return _0x37a2c4[_0xf6fb('0x20')](_0xf6fb('0x21'),_0x3ec512+'-'+_0x3f59a1+'/'+_0x38ef56)[_0xf6fb('0x1b')](_0x447971);}return null;};}function patchUpdates(_0x13bc8e){return function(_0x1918a5){try{jsonpatch[_0xf6fb('0x22')](_0x1918a5,_0x13bc8e,!![]);}catch(_0x1720ba){return BPromise['reject'](_0x1720ba);}return _0x1918a5['save']();};}function saveUpdates(_0x4986de,_0x36eddc){return function(_0x47b684){if(_0x47b684){return _0x47b684['update'](_0x4986de)[_0xf6fb('0x23')](function(_0x1d6f6c){return _0x1d6f6c;});}return null;};}function removeEntity(_0x49d8fb,_0x169ab3){return function(_0x3159d3){if(_0x3159d3){return _0x3159d3[_0xf6fb('0x24')]()[_0xf6fb('0x23')](function(){_0x49d8fb[_0xf6fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe6aed7,_0x1acaeb){return function(_0x219ee2){if(!_0x219ee2){_0xe6aed7[_0xf6fb('0x25')](0x194);}return _0x219ee2;};}function handleError(_0x185ecd,_0x3d20b1){_0x3d20b1=_0x3d20b1||0x1f4;return function(_0x264d73){logger['error'](_0x264d73[_0xf6fb('0x26')]);if(_0x264d73['name']){delete _0x264d73[_0xf6fb('0x27')];}_0x185ecd[_0xf6fb('0x1a')](_0x3d20b1)[_0xf6fb('0x28')](_0x264d73);};}exports[_0xf6fb('0x29')]=function(_0x2bebb6,_0x218eb9){var _0x35cc54={},_0x93cec={},_0x352148={'count':0x0,'rows':[]};var _0x258fe1=_['map'](db[_0xf6fb('0x2a')][_0xf6fb('0x2b')],function(_0x933fa4){return{'name':_0x933fa4[_0xf6fb('0x2c')],'type':_0x933fa4[_0xf6fb('0x2d')][_0xf6fb('0x2e')]};});_0x93cec[_0xf6fb('0x2f')]=_[_0xf6fb('0x30')](_0x258fe1,_0xf6fb('0x27'));_0x93cec['query']=_['keys'](_0x2bebb6['query']);_0x93cec[_0xf6fb('0x31')]=_[_0xf6fb('0x32')](_0x93cec[_0xf6fb('0x2f')],_0x93cec[_0xf6fb('0x33')]);_0x35cc54['attributes']=_[_0xf6fb('0x32')](_0x93cec[_0xf6fb('0x2f')],qs['fields'](_0x2bebb6[_0xf6fb('0x33')][_0xf6fb('0x34')]));_0x35cc54[_0xf6fb('0x35')]=_0x35cc54[_0xf6fb('0x35')][_0xf6fb('0x36')]?_0x35cc54[_0xf6fb('0x35')]:_0x93cec[_0xf6fb('0x2f')];if(!_0x2bebb6['query'][_0xf6fb('0x37')]('nolimit')){_0x35cc54[_0xf6fb('0x1f')]=qs[_0xf6fb('0x1f')](_0x2bebb6['query']['limit']);_0x35cc54[_0xf6fb('0x1c')]=qs['offset'](_0x2bebb6[_0xf6fb('0x33')][_0xf6fb('0x1c')]);}_0x35cc54[_0xf6fb('0x38')]=qs[_0xf6fb('0x39')](_0x2bebb6[_0xf6fb('0x33')][_0xf6fb('0x39')]);_0x35cc54[_0xf6fb('0x3a')]=qs[_0xf6fb('0x31')](_[_0xf6fb('0x3b')](_0x2bebb6['query'],_0x93cec[_0xf6fb('0x31')]),_0x258fe1);if(_0x2bebb6[_0xf6fb('0x33')][_0xf6fb('0x3c')]){_0x35cc54[_0xf6fb('0x3a')]=_['merge'](_0x35cc54[_0xf6fb('0x3a')],{'$or':_[_0xf6fb('0x30')](_0x258fe1,function(_0x50d81b){if(_0x50d81b[_0xf6fb('0x2d')]!=='VIRTUAL'){var _0x9b4993={};_0x9b4993[_0x50d81b[_0xf6fb('0x27')]]={'$like':'%'+_0x2bebb6[_0xf6fb('0x33')]['filter']+'%'};return _0x9b4993;}})});}_0x35cc54=_[_0xf6fb('0x3d')]({},_0x35cc54,_0x2bebb6[_0xf6fb('0x3e')]);var _0x136391={'where':_0x35cc54[_0xf6fb('0x3a')]};return db[_0xf6fb('0x2a')][_0xf6fb('0x1e')](_0x136391)[_0xf6fb('0x23')](function(_0x5e0d05){_0x352148[_0xf6fb('0x1e')]=_0x5e0d05;if(_0x2bebb6[_0xf6fb('0x33')]['includeAll']){_0x35cc54[_0xf6fb('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0xf6fb('0x40')](_0x35cc54);})[_0xf6fb('0x23')](function(_0x28c6e2){_0x352148[_0xf6fb('0x41')]=_0x28c6e2;return _0x352148;})[_0xf6fb('0x23')](respondWithFilteredResult(_0x218eb9,_0x35cc54))[_0xf6fb('0x42')](handleError(_0x218eb9,null));};exports[_0xf6fb('0x43')]=function(_0x2bd979,_0x3c56ea){var _0x1aa8a6={'raw':!![],'where':{'id':_0x2bd979[_0xf6fb('0x44')]['id']}},_0x4a84f2={};_0x4a84f2[_0xf6fb('0x2f')]=_[_0xf6fb('0x45')](db[_0xf6fb('0x2a')]['rawAttributes']);_0x4a84f2[_0xf6fb('0x33')]=_[_0xf6fb('0x45')](_0x2bd979['query']);_0x4a84f2[_0xf6fb('0x31')]=_[_0xf6fb('0x32')](_0x4a84f2['model'],_0x4a84f2['query']);_0x1aa8a6[_0xf6fb('0x35')]=_['intersection'](_0x4a84f2[_0xf6fb('0x2f')],qs[_0xf6fb('0x34')](_0x2bd979[_0xf6fb('0x33')]['fields']));_0x1aa8a6[_0xf6fb('0x35')]=_0x1aa8a6['attributes'][_0xf6fb('0x36')]?_0x1aa8a6[_0xf6fb('0x35')]:_0x4a84f2[_0xf6fb('0x2f')];if(_0x2bd979[_0xf6fb('0x33')][_0xf6fb('0x46')]){_0x1aa8a6[_0xf6fb('0x3f')]=[{'all':!![]}];}_0x1aa8a6=_['merge']({},_0x1aa8a6,_0x2bd979[_0xf6fb('0x3e')]);return db[_0xf6fb('0x2a')][_0xf6fb('0x47')](_0x1aa8a6)[_0xf6fb('0x23')](handleEntityNotFound(_0x3c56ea,null))['then'](respondWithResult(_0x3c56ea,null))['catch'](handleError(_0x3c56ea,null));};exports['create']=function(_0x304319,_0xcaec9e){return db['ZendeskField'][_0xf6fb('0x48')](_0x304319[_0xf6fb('0x49')],{})[_0xf6fb('0x23')](respondWithResult(_0xcaec9e,0xc9))[_0xf6fb('0x42')](handleError(_0xcaec9e,null));};exports[_0xf6fb('0x4a')]=function(_0x21bef9,_0x3ffa7e){if(_0x21bef9[_0xf6fb('0x49')]['id']){delete _0x21bef9[_0xf6fb('0x49')]['id'];}return db[_0xf6fb('0x2a')][_0xf6fb('0x47')]({'where':{'id':_0x21bef9[_0xf6fb('0x44')]['id']}})[_0xf6fb('0x23')](handleEntityNotFound(_0x3ffa7e,null))[_0xf6fb('0x23')](saveUpdates(_0x21bef9[_0xf6fb('0x49')],null))[_0xf6fb('0x23')](respondWithResult(_0x3ffa7e,null))[_0xf6fb('0x42')](handleError(_0x3ffa7e,null));};exports['destroy']=function(_0x47d1cd,_0x2b62d7){return db[_0xf6fb('0x2a')][_0xf6fb('0x47')]({'where':{'id':_0x47d1cd[_0xf6fb('0x44')]['id']}})[_0xf6fb('0x23')](handleEntityNotFound(_0x2b62d7,null))['then'](removeEntity(_0x2b62d7,null))['catch'](handleError(_0x2b62d7,null));}; \ No newline at end of file +var _0xf28f=['reject','save','update','destroy','then','sendStatus','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','rows','catch','show','params','fields','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply'];(function(_0x6f1031,_0x3c0a6f){var _0x4e1b8d=function(_0x159882){while(--_0x159882){_0x6f1031['push'](_0x6f1031['shift']());}};_0x4e1b8d(++_0x3c0a6f);}(_0xf28f,0x6f));var _0xff28=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf28f[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xff28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff28('0x1'));var jsonpatch=require(_0xff28('0x2'));var rp=require('request-promise');var moment=require(_0xff28('0x3'));var BPromise=require(_0xff28('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff28('0x5'));var sox=require('sox');var csv=require(_0xff28('0x6'));var ejs=require(_0xff28('0x7'));var fs=require('fs');var fs_extra=require(_0xff28('0x8'));var _=require(_0xff28('0x9'));var squel=require('squel');var crypto=require(_0xff28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xff28('0xb'));var toCsv=require(_0xff28('0x6'));var querystring=require(_0xff28('0xc'));var Papa=require(_0xff28('0xd'));var Redis=require(_0xff28('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff28('0xf'));var hardwareService=require(_0xff28('0x10'));var logger=require(_0xff28('0x11'))(_0xff28('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff28('0x13'))['db'];function respondWithStatusCode(_0x106e6c,_0x593617){_0x593617=_0x593617||0xcc;return function(_0x4035e9){if(_0x4035e9){return _0x106e6c['sendStatus'](_0x593617);}return _0x106e6c['status'](_0x593617)[_0xff28('0x14')]();};}function respondWithResult(_0x41d51d,_0x579c1b){_0x579c1b=_0x579c1b||0xc8;return function(_0x723b84){if(_0x723b84){return _0x41d51d[_0xff28('0x15')](_0x579c1b)['json'](_0x723b84);}};}function respondWithFilteredResult(_0x4d4166,_0x281dd3){return function(_0x1dbebc){if(_0x1dbebc){var _0x5ee003=typeof _0x281dd3[_0xff28('0x16')]===_0xff28('0x17')&&typeof _0x281dd3[_0xff28('0x18')]===_0xff28('0x17');var _0x356376=_0x1dbebc[_0xff28('0x19')];var _0x3287d0=_0x5ee003?0x0:_0x281dd3['offset'];var _0x259e42=_0x5ee003?_0x1dbebc['count']:_0x281dd3['offset']+_0x281dd3[_0xff28('0x18')];var _0x294ca2;if(_0x259e42>=_0x356376){_0x259e42=_0x356376;_0x294ca2=0xc8;}else{_0x294ca2=0xce;}_0x4d4166['status'](_0x294ca2);return _0x4d4166[_0xff28('0x1a')]('Content-Range',_0x3287d0+'-'+_0x259e42+'/'+_0x356376)[_0xff28('0x1b')](_0x1dbebc);}return null;};}function patchUpdates(_0x165760){return function(_0x278d25){try{jsonpatch[_0xff28('0x1c')](_0x278d25,_0x165760,!![]);}catch(_0x865683){return BPromise[_0xff28('0x1d')](_0x865683);}return _0x278d25[_0xff28('0x1e')]();};}function saveUpdates(_0x2421a3,_0x4bd635){return function(_0x3643f7){if(_0x3643f7){return _0x3643f7[_0xff28('0x1f')](_0x2421a3)['then'](function(_0xa6cd8d){return _0xa6cd8d;});}return null;};}function removeEntity(_0xf5cb3f,_0x343157){return function(_0x1b268e){if(_0x1b268e){return _0x1b268e[_0xff28('0x20')]()[_0xff28('0x21')](function(){_0xf5cb3f['status'](0xcc)[_0xff28('0x14')]();});}};}function handleEntityNotFound(_0x2d80d3,_0x2f741e){return function(_0x45b8ca){if(!_0x45b8ca){_0x2d80d3[_0xff28('0x22')](0x194);}return _0x45b8ca;};}function handleError(_0x3e3042,_0x24a298){_0x24a298=_0x24a298||0x1f4;return function(_0x3485fe){logger[_0xff28('0x23')](_0x3485fe['stack']);if(_0x3485fe['name']){delete _0x3485fe[_0xff28('0x24')];}_0x3e3042['status'](_0x24a298)[_0xff28('0x25')](_0x3485fe);};}exports[_0xff28('0x26')]=function(_0x3eba51,_0x2a8365){var _0x2e70f1={},_0x2cff5e={},_0x176f9e={'count':0x0,'rows':[]};var _0x4179bd=_[_0xff28('0x27')](db[_0xff28('0x28')][_0xff28('0x29')],function(_0x44540f){return{'name':_0x44540f[_0xff28('0x2a')],'type':_0x44540f[_0xff28('0x2b')][_0xff28('0x2c')]};});_0x2cff5e[_0xff28('0x2d')]=_[_0xff28('0x27')](_0x4179bd,_0xff28('0x24'));_0x2cff5e[_0xff28('0x2e')]=_[_0xff28('0x2f')](_0x3eba51[_0xff28('0x2e')]);_0x2cff5e[_0xff28('0x30')]=_['intersection'](_0x2cff5e['model'],_0x2cff5e['query']);_0x2e70f1['attributes']=_[_0xff28('0x31')](_0x2cff5e[_0xff28('0x2d')],qs['fields'](_0x3eba51[_0xff28('0x2e')]['fields']));_0x2e70f1[_0xff28('0x32')]=_0x2e70f1[_0xff28('0x32')][_0xff28('0x33')]?_0x2e70f1[_0xff28('0x32')]:_0x2cff5e[_0xff28('0x2d')];if(!_0x3eba51[_0xff28('0x2e')][_0xff28('0x34')](_0xff28('0x35'))){_0x2e70f1[_0xff28('0x18')]=qs[_0xff28('0x18')](_0x3eba51['query'][_0xff28('0x18')]);_0x2e70f1['offset']=qs[_0xff28('0x16')](_0x3eba51[_0xff28('0x2e')][_0xff28('0x16')]);}_0x2e70f1[_0xff28('0x36')]=qs['sort'](_0x3eba51['query']['sort']);_0x2e70f1[_0xff28('0x37')]=qs[_0xff28('0x30')](_[_0xff28('0x38')](_0x3eba51['query'],_0x2cff5e['filters']),_0x4179bd);if(_0x3eba51['query']['filter']){_0x2e70f1['where']=_[_0xff28('0x39')](_0x2e70f1[_0xff28('0x37')],{'$or':_[_0xff28('0x27')](_0x4179bd,function(_0x1df030){if(_0x1df030[_0xff28('0x2b')]!=='VIRTUAL'){var _0x35f144={};_0x35f144[_0x1df030[_0xff28('0x24')]]={'$like':'%'+_0x3eba51['query'][_0xff28('0x3a')]+'%'};return _0x35f144;}})});}_0x2e70f1=_[_0xff28('0x39')]({},_0x2e70f1,_0x3eba51[_0xff28('0x3b')]);var _0x212ece={'where':_0x2e70f1[_0xff28('0x37')]};return db['ZendeskField'][_0xff28('0x19')](_0x212ece)['then'](function(_0x21a1d2){_0x176f9e[_0xff28('0x19')]=_0x21a1d2;if(_0x3eba51[_0xff28('0x2e')][_0xff28('0x3c')]){_0x2e70f1['include']=[{'all':!![]}];}return db[_0xff28('0x28')]['findAll'](_0x2e70f1);})[_0xff28('0x21')](function(_0x46dabb){_0x176f9e[_0xff28('0x3d')]=_0x46dabb;return _0x176f9e;})[_0xff28('0x21')](respondWithFilteredResult(_0x2a8365,_0x2e70f1))[_0xff28('0x3e')](handleError(_0x2a8365,null));};exports[_0xff28('0x3f')]=function(_0x1fd053,_0x5c1823){var _0x265b1f={'raw':!![],'where':{'id':_0x1fd053[_0xff28('0x40')]['id']}},_0x10563e={};_0x10563e[_0xff28('0x2d')]=_[_0xff28('0x2f')](db[_0xff28('0x28')]['rawAttributes']);_0x10563e[_0xff28('0x2e')]=_[_0xff28('0x2f')](_0x1fd053[_0xff28('0x2e')]);_0x10563e['filters']=_['intersection'](_0x10563e[_0xff28('0x2d')],_0x10563e[_0xff28('0x2e')]);_0x265b1f[_0xff28('0x32')]=_[_0xff28('0x31')](_0x10563e[_0xff28('0x2d')],qs[_0xff28('0x41')](_0x1fd053[_0xff28('0x2e')][_0xff28('0x41')]));_0x265b1f[_0xff28('0x32')]=_0x265b1f[_0xff28('0x32')][_0xff28('0x33')]?_0x265b1f['attributes']:_0x10563e[_0xff28('0x2d')];if(_0x1fd053[_0xff28('0x2e')][_0xff28('0x3c')]){_0x265b1f[_0xff28('0x42')]=[{'all':!![]}];}_0x265b1f=_[_0xff28('0x39')]({},_0x265b1f,_0x1fd053[_0xff28('0x3b')]);return db[_0xff28('0x28')][_0xff28('0x43')](_0x265b1f)[_0xff28('0x21')](handleEntityNotFound(_0x5c1823,null))[_0xff28('0x21')](respondWithResult(_0x5c1823,null))[_0xff28('0x3e')](handleError(_0x5c1823,null));};exports[_0xff28('0x44')]=function(_0x265a6f,_0x4a064a){return db[_0xff28('0x28')][_0xff28('0x44')](_0x265a6f['body'],{})[_0xff28('0x21')](respondWithResult(_0x4a064a,0xc9))[_0xff28('0x3e')](handleError(_0x4a064a,null));};exports[_0xff28('0x1f')]=function(_0xdb2017,_0x107c15){if(_0xdb2017[_0xff28('0x45')]['id']){delete _0xdb2017[_0xff28('0x45')]['id'];}return db[_0xff28('0x28')][_0xff28('0x43')]({'where':{'id':_0xdb2017[_0xff28('0x40')]['id']}})['then'](handleEntityNotFound(_0x107c15,null))[_0xff28('0x21')](saveUpdates(_0xdb2017['body'],null))['then'](respondWithResult(_0x107c15,null))[_0xff28('0x3e')](handleError(_0x107c15,null));};exports[_0xff28('0x20')]=function(_0x32d556,_0x45bf83){return db[_0xff28('0x28')][_0xff28('0x43')]({'where':{'id':_0x32d556['params']['id']}})[_0xff28('0x21')](handleEntityNotFound(_0x45bf83,null))[_0xff28('0x21')](removeEntity(_0x45bf83,null))['catch'](handleError(_0x45bf83,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 488aaef..12810ef 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 _0xfdaf=['request-promise','path','rimraf','../../config/environment','exports','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x837006,_0x326159){var _0x4cf513=function(_0x2ac68e){while(--_0x2ac68e){_0x837006['push'](_0x837006['shift']());}};_0x4cf513(++_0x326159);}(_0xfdaf,0x168));var _0xffda=function(_0x4e3b7f,_0x171f91){_0x4e3b7f=_0x4e3b7f-0x0;var _0x19a094=_0xfdaf[_0x4e3b7f];return _0x19a094;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffda('0x0'))(_0xffda('0x1'));var moment=require(_0xffda('0x2'));var BPromise=require('bluebird');var rp=require(_0xffda('0x3'));var fs=require('fs');var path=require(_0xffda('0x4'));var rimraf=require(_0xffda('0x5'));var config=require(_0xffda('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xffda('0x7')]=function(_0x3f70b3,_0x51702d){return _0x3f70b3['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xffda('0x8'),'fields':[_0xffda('0x9'),_0xffda('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59ec=['../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x59ec,0x19d));var _0xc59e=function(_0x447c12,_0x3789ce){_0x447c12=_0x447c12-0x0;var _0x573697=_0x59ec[_0x447c12];return _0x573697;};'use strict';var _=require(_0xc59e('0x0'));var util=require(_0xc59e('0x1'));var logger=require(_0xc59e('0x2'))(_0xc59e('0x3'));var moment=require('moment');var BPromise=require(_0xc59e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc59e('0x5'));var rimraf=require(_0xc59e('0x6'));var config=require(_0xc59e('0x7'));var attributes=require(_0xc59e('0x8'));module[_0xc59e('0x9')]=function(_0x36111d,_0x31139e){return _0x36111d['define'](_0xc59e('0xa'),attributes,{'tableName':_0xc59e('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xc59e('0xc'),_0xc59e('0xd')],'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 064140e..6361fc5 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 _0x9efe=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x9efe,0x1ca));var _0xe9ef=function(_0x17fb94,_0x1bd692){_0x17fb94=_0x17fb94-0x0;var _0x269261=_0x9efe[_0x17fb94];return _0x269261;};'use strict';var _=require(_0xe9ef('0x0'));var util=require(_0xe9ef('0x1'));var moment=require(_0xe9ef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9ef('0x3'));var db=require(_0xe9ef('0x4'))['db'];var utils=require(_0xe9ef('0x5'));var logger=require(_0xe9ef('0x6'))(_0xe9ef('0x7'));var config=require(_0xe9ef('0x8'));var jayson=require(_0xe9ef('0x9'));var client=jayson[_0xe9ef('0xa')][_0xe9ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57815d,_0x122565,_0xf998f){return new BPromise(function(_0x1f1f06,_0x3d7eee){return client[_0xe9ef('0xc')](_0x57815d,_0xf998f)[_0xe9ef('0xd')](function(_0x5ef190){logger[_0xe9ef('0xe')]('ZendeskField,\x20%s,\x20%s',_0x122565,'request\x20sent');logger[_0xe9ef('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x122565,_0xe9ef('0x10'),JSON[_0xe9ef('0x11')](_0x5ef190));if(_0x5ef190[_0xe9ef('0x12')]){if(_0x5ef190[_0xe9ef('0x12')][_0xe9ef('0x13')]===0x1f4){logger['error'](_0xe9ef('0x14'),_0x122565,_0x5ef190[_0xe9ef('0x12')]['message']);return _0x3d7eee(_0x5ef190[_0xe9ef('0x12')][_0xe9ef('0x15')]);}logger[_0xe9ef('0x12')](_0xe9ef('0x14'),_0x122565,_0x5ef190[_0xe9ef('0x12')][_0xe9ef('0x15')]);return _0x1f1f06(_0x5ef190[_0xe9ef('0x12')][_0xe9ef('0x15')]);}else{logger[_0xe9ef('0xe')](_0xe9ef('0x14'),_0x122565,_0xe9ef('0x10'));_0x1f1f06(_0x5ef190[_0xe9ef('0x16')][_0xe9ef('0x15')]);}})[_0xe9ef('0x17')](function(_0x108b90){logger[_0xe9ef('0x12')](_0xe9ef('0x14'),_0x122565,_0x108b90);_0x3d7eee(_0x108b90);});});} \ No newline at end of file +var _0x8e18=['../../config/logger','../../config/environment','client','http','request','then','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskField,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3f50ce,_0x541c88){var _0x5767a0=function(_0x576794){while(--_0x576794){_0x3f50ce['push'](_0x3f50ce['shift']());}};_0x5767a0(++_0x541c88);}(_0x8e18,0xa9));var _0x88e1=function(_0x5bfe49,_0x3efc4c){_0x5bfe49=_0x5bfe49-0x0;var _0x2b5650=_0x8e18[_0x5bfe49];return _0x2b5650;};'use strict';var _=require(_0x88e1('0x0'));var util=require(_0x88e1('0x1'));var moment=require(_0x88e1('0x2'));var BPromise=require(_0x88e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88e1('0x4'));var db=require(_0x88e1('0x5'))['db'];var utils=require(_0x88e1('0x6'));var logger=require(_0x88e1('0x7'))('rpc');var config=require(_0x88e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x88e1('0x9')][_0x88e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219285,_0x25508c,_0xdc504d){return new BPromise(function(_0x168c8d,_0x374188){return client[_0x88e1('0xb')](_0x219285,_0xdc504d)[_0x88e1('0xc')](function(_0x2a717d){logger['info']('ZendeskField,\x20%s,\x20%s',_0x25508c,_0x88e1('0xd'));logger['debug'](_0x88e1('0xe'),_0x25508c,_0x88e1('0xd'),JSON['stringify'](_0x2a717d));if(_0x2a717d['error']){if(_0x2a717d[_0x88e1('0xf')][_0x88e1('0x10')]===0x1f4){logger[_0x88e1('0xf')]('ZendeskField,\x20%s,\x20%s',_0x25508c,_0x2a717d[_0x88e1('0xf')][_0x88e1('0x11')]);return _0x374188(_0x2a717d['error']['message']);}logger['error'](_0x88e1('0x12'),_0x25508c,_0x2a717d[_0x88e1('0xf')][_0x88e1('0x11')]);return _0x168c8d(_0x2a717d[_0x88e1('0xf')][_0x88e1('0x11')]);}else{logger[_0x88e1('0x13')](_0x88e1('0x12'),_0x25508c,_0x88e1('0xd'));_0x168c8d(_0x2a717d[_0x88e1('0x14')][_0x88e1('0x11')]);}})[_0x88e1('0x15')](function(_0x56e6e4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x25508c,_0x56e6e4);_0x374188(_0x56e6e4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 339f86a..dec4293 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 _0x143e=['create','post','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x41499a,_0x837d4f){var _0x890202=function(_0x31c449){while(--_0x31c449){_0x41499a['push'](_0x41499a['shift']());}};_0x890202(++_0x837d4f);}(_0x143e,0xdf));var _0xe143=function(_0x55b35c,_0x4dfb0d){_0x55b35c=_0x55b35c-0x0;var _0xe6a50d=_0x143e[_0x55b35c];return _0xe6a50d;};'use strict';var multer=require(_0xe143('0x0'));var util=require(_0xe143('0x1'));var path=require('path');var timeout=require(_0xe143('0x2'));var express=require(_0xe143('0x3'));var router=express[_0xe143('0x4')]();var fs_extra=require(_0xe143('0x5'));var auth=require(_0xe143('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe143('0x7'));var controller=require(_0xe143('0x8'));router[_0xe143('0x9')]('/',auth['isAuthenticated'](),controller[_0xe143('0xa')]);router['get'](_0xe143('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe143('0xc'),auth[_0xe143('0xd')](),controller[_0xe143('0xe')]);router['get'](_0xe143('0xf'),auth[_0xe143('0xd')](),controller[_0xe143('0x10')]);router['post']('/',auth[_0xe143('0xd')](),controller[_0xe143('0x11')]);router[_0xe143('0x12')](_0xe143('0xc'),auth['isAuthenticated'](),controller[_0xe143('0x13')]);router[_0xe143('0x14')](_0xe143('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe143('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe143('0x16')]);module[_0xe143('0x17')]=router; \ No newline at end of file +var _0x0e16=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x0e16,0xd3));var _0x60e1=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x0e16[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x60e1('0x0'));var util=require(_0x60e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x60e1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x60e1('0x3'));var interaction=require(_0x60e1('0x4'));var config=require(_0x60e1('0x5'));var controller=require(_0x60e1('0x6'));router[_0x60e1('0x7')]('/',auth[_0x60e1('0x8')](),controller[_0x60e1('0x9')]);router['get'](_0x60e1('0xa'),auth[_0x60e1('0x8')](),controller[_0x60e1('0xb')]);router[_0x60e1('0x7')](_0x60e1('0xc'),auth['isAuthenticated'](),controller[_0x60e1('0xd')]);router[_0x60e1('0x7')](_0x60e1('0xe'),auth[_0x60e1('0x8')](),controller[_0x60e1('0xf')]);router[_0x60e1('0x10')]('/',auth[_0x60e1('0x8')](),controller[_0x60e1('0x11')]);router['post']('/:id/configurations',auth[_0x60e1('0x8')](),controller[_0x60e1('0x12')]);router[_0x60e1('0x13')](_0x60e1('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x60e1('0xa'),auth[_0x60e1('0x8')](),controller[_0x60e1('0x14')]);module[_0x60e1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a87da8c..9f3a13d 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 _0xcb91=['STRING'];(function(_0x63d82,_0x5bec68){var _0x1477f6=function(_0x1a2e3c){while(--_0x1a2e3c){_0x63d82['push'](_0x63d82['shift']());}};_0x1477f6(++_0x5bec68);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0xcb91[_0x4f11cb];return _0x491488;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1cb9('0x0')]},'description':{'type':Sequelize[_0x1cb9('0x0')]},'host':{'type':Sequelize[_0x1cb9('0x0')]},'zone':{'type':Sequelize[_0x1cb9('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1cb9('0x0')]},'serverUrl':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x1cb9('0x0')]}}; \ No newline at end of file +var _0x1be1=['STRING'];(function(_0x1976a9,_0x112bb6){var _0x2c2aec=function(_0x14a4a9){while(--_0x14a4a9){_0x1976a9['push'](_0x1976a9['shift']());}};_0x2c2aec(++_0x112bb6);}(_0x1be1,0x192));var _0x11be=function(_0x4e0ea8,_0x43186f){_0x4e0ea8=_0x4e0ea8-0x0;var _0x1b19a2=_0x1be1[_0x4e0ea8];return _0x1b19a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')]},'description':{'type':Sequelize[_0x11be('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x11be('0x0')]},'clientId':{'type':Sequelize[_0x11be('0x0')]},'clientSecret':{'type':Sequelize[_0x11be('0x0')]},'serverUrl':{'type':Sequelize[_0x11be('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x11be('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2916bf1..27c0784 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 _0xef3f=['refreshToken','zoho.eu','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Start_Time','remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','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/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','update','findOne','ZohoConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','access_token','getFields','host','zone','serverUrl','code'];(function(_0x20e555,_0x40aea6){var _0x182077=function(_0x1d0d69){while(--_0x1d0d69){_0x20e555['push'](_0x20e555['shift']());}};_0x182077(++_0x40aea6);}(_0xef3f,0x95));var _0xfef3=function(_0x13c098,_0x3d7ab3){_0x13c098=_0x13c098-0x0;var _0xaff5bb=_0xef3f[_0x13c098];return _0xaff5bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfef3('0x0'));var jsonpatch=require(_0xfef3('0x1'));var rp=require(_0xfef3('0x2'));var moment=require(_0xfef3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfef3('0x4'));var util=require(_0xfef3('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfef3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfef3('0x7'));var squel=require('squel');var crypto=require(_0xfef3('0x8'));var jsforce=require(_0xfef3('0x9'));var deskjs=require(_0xfef3('0xa'));var toCsv=require(_0xfef3('0xb'));var querystring=require(_0xfef3('0xc'));var Papa=require(_0xfef3('0xd'));var Redis=require(_0xfef3('0xe'));var authService=require(_0xfef3('0xf'));var qs=require(_0xfef3('0x10'));var as=require(_0xfef3('0x11'));var hardwareService=require(_0xfef3('0x12'));var logger=require(_0xfef3('0x13'))('api');var utils=require(_0xfef3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfef3('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfef3('0x16'));function respondWithStatusCode(_0x18ac84,_0x5d4a97){_0x5d4a97=_0x5d4a97||0xcc;return function(_0x44c143){if(_0x44c143){return _0x18ac84[_0xfef3('0x17')](_0x5d4a97);}return _0x18ac84[_0xfef3('0x18')](_0x5d4a97)[_0xfef3('0x19')]();};}function respondWithResult(_0x443c6c,_0x2591c2){_0x2591c2=_0x2591c2||0xc8;return function(_0x5714f0){if(_0x5714f0){return _0x443c6c[_0xfef3('0x18')](_0x2591c2)[_0xfef3('0x1a')](_0x5714f0);}};}function respondWithFilteredResult(_0x5873b0,_0x435350){return function(_0x3b58b2){if(_0x3b58b2){var _0xd897fd=typeof _0x435350[_0xfef3('0x1b')]===_0xfef3('0x1c')&&typeof _0x435350[_0xfef3('0x1d')]===_0xfef3('0x1c');var _0xcb97a0=_0x3b58b2[_0xfef3('0x1e')];var _0x2b4802=_0xd897fd?0x0:_0x435350[_0xfef3('0x1b')];var _0x63a622=_0xd897fd?_0x3b58b2[_0xfef3('0x1e')]:_0x435350[_0xfef3('0x1b')]+_0x435350['limit'];var _0x2f3ff6;if(_0x63a622>=_0xcb97a0){_0x63a622=_0xcb97a0;_0x2f3ff6=0xc8;}else{_0x2f3ff6=0xce;}_0x5873b0[_0xfef3('0x18')](_0x2f3ff6);return _0x5873b0['set'](_0xfef3('0x1f'),_0x2b4802+'-'+_0x63a622+'/'+_0xcb97a0)[_0xfef3('0x1a')](_0x3b58b2);}return null;};}function patchUpdates(_0xa777d7){return function(_0x369e92){try{jsonpatch[_0xfef3('0x20')](_0x369e92,_0xa777d7,!![]);}catch(_0x121566){return BPromise[_0xfef3('0x21')](_0x121566);}return _0x369e92['save']();};}function saveUpdates(_0x4b811b,_0x355917){return function(_0x480780){if(_0x480780){return _0x480780['update'](_0x4b811b)[_0xfef3('0x22')](function(_0x2257a6){return _0x2257a6;});}return null;};}function removeEntity(_0x23d4f3,_0x4ef9e6){return function(_0x489aed){if(_0x489aed){return _0x489aed[_0xfef3('0x23')]()[_0xfef3('0x22')](function(){_0x23d4f3['status'](0xcc)[_0xfef3('0x19')]();});}};}function handleEntityNotFound(_0x2ff093,_0x1645ca){return function(_0x221b1d){if(!_0x221b1d){_0x2ff093[_0xfef3('0x17')](0x194);}return _0x221b1d;};}function handleError(_0x4a74e5,_0x21903b){_0x21903b=_0x21903b||0x1f4;return function(_0x595d7f){logger[_0xfef3('0x24')](_0x595d7f[_0xfef3('0x25')]);if(_0x595d7f[_0xfef3('0x26')]){delete _0x595d7f[_0xfef3('0x26')];}_0x4a74e5['status'](_0x21903b)[_0xfef3('0x27')](_0x595d7f);};}exports['index']=function(_0xab9f61,_0x2fb2b1){var _0x2bac38={},_0x1ac874={},_0x23d11f={'count':0x0,'rows':[]};var _0x37897e=_['map'](db[_0xfef3('0x28')][_0xfef3('0x29')],function(_0x5a4778){return{'name':_0x5a4778[_0xfef3('0x2a')],'type':_0x5a4778[_0xfef3('0x2b')][_0xfef3('0x2c')]};});_0x1ac874['model']=_[_0xfef3('0x2d')](_0x37897e,_0xfef3('0x26'));_0x1ac874[_0xfef3('0x2e')]=_[_0xfef3('0x2f')](_0xab9f61[_0xfef3('0x2e')]);_0x1ac874['filters']=_[_0xfef3('0x30')](_0x1ac874[_0xfef3('0x31')],_0x1ac874[_0xfef3('0x2e')]);_0x2bac38[_0xfef3('0x32')]=_[_0xfef3('0x30')](_0x1ac874['model'],qs[_0xfef3('0x33')](_0xab9f61[_0xfef3('0x2e')]['fields']));_0x2bac38['attributes']=_0x2bac38[_0xfef3('0x32')][_0xfef3('0x34')]?_0x2bac38[_0xfef3('0x32')]:_0x1ac874[_0xfef3('0x31')];if(!_0xab9f61['query'][_0xfef3('0x35')]('nolimit')){_0x2bac38['limit']=qs['limit'](_0xab9f61[_0xfef3('0x2e')][_0xfef3('0x1d')]);_0x2bac38[_0xfef3('0x1b')]=qs['offset'](_0xab9f61[_0xfef3('0x2e')]['offset']);}_0x2bac38[_0xfef3('0x36')]=qs['sort'](_0xab9f61['query'][_0xfef3('0x37')]);_0x2bac38[_0xfef3('0x38')]=qs[_0xfef3('0x39')](_[_0xfef3('0x3a')](_0xab9f61[_0xfef3('0x2e')],_0x1ac874['filters']),_0x37897e);if(_0xab9f61[_0xfef3('0x2e')][_0xfef3('0x3b')]){_0x2bac38[_0xfef3('0x38')]=_[_0xfef3('0x3c')](_0x2bac38[_0xfef3('0x38')],{'$or':_[_0xfef3('0x2d')](_0x37897e,function(_0x361cdd){if(_0x361cdd['type']!=='VIRTUAL'){var _0x561056={};_0x561056[_0x361cdd['name']]={'$like':'%'+_0xab9f61[_0xfef3('0x2e')][_0xfef3('0x3b')]+'%'};return _0x561056;}})});}_0x2bac38=_[_0xfef3('0x3c')]({},_0x2bac38,_0xab9f61['options']);var _0x45d718={'where':_0x2bac38[_0xfef3('0x38')]};return db[_0xfef3('0x28')][_0xfef3('0x1e')](_0x45d718)[_0xfef3('0x22')](function(_0x2aede2){_0x23d11f[_0xfef3('0x1e')]=_0x2aede2;if(_0xab9f61[_0xfef3('0x2e')][_0xfef3('0x3d')]){_0x2bac38['include']=[{'all':!![]}];}return db[_0xfef3('0x28')][_0xfef3('0x3e')](_0x2bac38);})[_0xfef3('0x22')](function(_0x5359fe){_0x23d11f['rows']=_0x5359fe;return _0x23d11f;})[_0xfef3('0x22')](respondWithFilteredResult(_0x2fb2b1,_0x2bac38))[_0xfef3('0x3f')](handleError(_0x2fb2b1,null));};exports[_0xfef3('0x40')]=function(_0x352620,_0x1678db){var _0xe50dd2={'raw':![],'where':{'id':_0x352620[_0xfef3('0x41')]['id']}},_0x58aa8f={};_0x58aa8f[_0xfef3('0x31')]=_[_0xfef3('0x2f')](db[_0xfef3('0x28')][_0xfef3('0x29')]);_0x58aa8f[_0xfef3('0x2e')]=_[_0xfef3('0x2f')](_0x352620[_0xfef3('0x2e')]);_0x58aa8f['filters']=_[_0xfef3('0x30')](_0x58aa8f['model'],_0x58aa8f[_0xfef3('0x2e')]);_0xe50dd2['attributes']=_[_0xfef3('0x30')](_0x58aa8f['model'],qs[_0xfef3('0x33')](_0x352620[_0xfef3('0x2e')]['fields']));_0xe50dd2['attributes']=_0xe50dd2[_0xfef3('0x32')][_0xfef3('0x34')]?_0xe50dd2[_0xfef3('0x32')]:_0x58aa8f['model'];if(_0x352620[_0xfef3('0x2e')][_0xfef3('0x3d')]){_0xe50dd2[_0xfef3('0x42')]=[{'all':!![]}];}_0xe50dd2=_[_0xfef3('0x3c')]({},_0xe50dd2,_0x352620[_0xfef3('0x43')]);return db[_0xfef3('0x28')][_0xfef3('0x44')](_0xe50dd2)[_0xfef3('0x22')](handleEntityNotFound(_0x1678db,null))['then'](respondWithResult(_0x1678db,null))[_0xfef3('0x3f')](handleError(_0x1678db,null));};exports[_0xfef3('0x45')]=function(_0x446763,_0x339e5a){return db[_0xfef3('0x28')][_0xfef3('0x45')](_0x446763[_0xfef3('0x46')],{})[_0xfef3('0x22')](respondWithResult(_0x339e5a,0xc9))[_0xfef3('0x3f')](handleError(_0x339e5a,null));};exports[_0xfef3('0x47')]=function(_0x448bf4,_0x48a9d8){if(_0x448bf4['body']['id']){delete _0x448bf4[_0xfef3('0x46')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x448bf4['params']['id']}})[_0xfef3('0x22')](handleEntityNotFound(_0x48a9d8,null))[_0xfef3('0x22')](saveUpdates(_0x448bf4[_0xfef3('0x46')],null))[_0xfef3('0x22')](respondWithResult(_0x48a9d8,null))['catch'](handleError(_0x48a9d8,null));};exports[_0xfef3('0x23')]=function(_0xccc307,_0x22ccbe){return db['ZohoAccount']['find']({'where':{'id':_0xccc307[_0xfef3('0x41')]['id']}})[_0xfef3('0x22')](handleEntityNotFound(_0x22ccbe,null))['then'](removeEntity(_0x22ccbe,null))[_0xfef3('0x3f')](handleError(_0x22ccbe,null));};exports['getConfigurations']=function(_0x21718d,_0xcdf4fd,_0x28f283){var _0x17be82={};var _0x2bf879={};var _0x465bcf;var _0xd260c9;return db[_0xfef3('0x28')][_0xfef3('0x48')]({'where':{'id':_0x21718d[_0xfef3('0x41')]['id']}})[_0xfef3('0x22')](handleEntityNotFound(_0xcdf4fd,null))[_0xfef3('0x22')](function(_0x305ee1){if(_0x305ee1){_0x465bcf=_0x305ee1;_0x2bf879[_0xfef3('0x31')]=_['keys'](db[_0xfef3('0x49')][_0xfef3('0x29')]);_0x2bf879[_0xfef3('0x2e')]=_[_0xfef3('0x2f')](_0x21718d[_0xfef3('0x2e')]);_0x2bf879['filters']=_['intersection'](_0x2bf879[_0xfef3('0x31')],_0x2bf879[_0xfef3('0x2e')]);_0x17be82[_0xfef3('0x32')]=_[_0xfef3('0x30')](_0x2bf879[_0xfef3('0x31')],qs[_0xfef3('0x33')](_0x21718d['query'][_0xfef3('0x33')]));_0x17be82[_0xfef3('0x32')]=_0x17be82['attributes'][_0xfef3('0x34')]?_0x17be82[_0xfef3('0x32')]:_0x2bf879[_0xfef3('0x31')];_0x17be82[_0xfef3('0x36')]=qs[_0xfef3('0x37')](_0x21718d[_0xfef3('0x2e')]['sort']);_0x17be82[_0xfef3('0x38')]=qs[_0xfef3('0x39')](_[_0xfef3('0x3a')](_0x21718d['query'],_0x2bf879[_0xfef3('0x39')]));if(_0x21718d[_0xfef3('0x2e')]['filter']){_0x17be82[_0xfef3('0x38')]=_[_0xfef3('0x3c')](_0x17be82[_0xfef3('0x38')],{'$or':_[_0xfef3('0x2d')](_0x17be82[_0xfef3('0x32')],function(_0x5cfc95){var _0x552a4a={};_0x552a4a[_0x5cfc95]={'$like':'%'+_0x21718d[_0xfef3('0x2e')][_0xfef3('0x3b')]+'%'};return _0x552a4a;})});}_0x17be82=_[_0xfef3('0x3c')]({},_0x17be82,_0x21718d[_0xfef3('0x43')]);return _0x465bcf[_0xfef3('0x4a')](_0x17be82);}})['then'](function(_0x2fb039){if(_0x2fb039){_0xd260c9=_0x2fb039[_0xfef3('0x34')];if(!_0x21718d[_0xfef3('0x2e')][_0xfef3('0x35')](_0xfef3('0x4b'))){_0x17be82[_0xfef3('0x1d')]=qs[_0xfef3('0x1d')](_0x21718d[_0xfef3('0x2e')][_0xfef3('0x1d')]);_0x17be82[_0xfef3('0x1b')]=qs['offset'](_0x21718d['query'][_0xfef3('0x1b')]);}return _0x465bcf[_0xfef3('0x4a')](_0x17be82);}})['then'](function(_0x4f883e){if(_0x4f883e){return _0x4f883e?{'count':_0xd260c9,'rows':_0x4f883e}:null;}})['then'](respondWithResult(_0xcdf4fd,null))['catch'](handleError(_0xcdf4fd,null));};exports[_0xfef3('0x4c')]=function(_0x3035ee,_0xc862f1,_0x3b1d18){if(_0x3035ee[_0xfef3('0x46')]['id']){delete _0x3035ee[_0xfef3('0x46')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x3035ee[_0xfef3('0x41')]['id']}})[_0xfef3('0x22')](handleEntityNotFound(_0xc862f1,null))[_0xfef3('0x22')](function(_0x1885ce){if(_0x1885ce){_0x3035ee[_0xfef3('0x46')][_0xfef3('0x4d')]=_0x1885ce['id'];_0x3035ee[_0xfef3('0x46')]['Subjects']=integrations[_0xfef3('0x4e')](_0x3035ee[_0xfef3('0x46')][_0xfef3('0x4f')],_0x3035ee['body'][_0xfef3('0x2b')]);_0x3035ee[_0xfef3('0x46')][_0xfef3('0x50')]=integrations['getDescriptions'](_0x3035ee[_0xfef3('0x46')]['channel'],_0x3035ee[_0xfef3('0x46')][_0xfef3('0x2b')]);return db['ZohoConfiguration'][_0xfef3('0x45')](_0x3035ee[_0xfef3('0x46')],{'include':[{'model':db[_0xfef3('0x51')],'as':'Subjects'},{'model':db[_0xfef3('0x51')],'as':'Descriptions'}]});}return null;})[_0xfef3('0x22')](respondWithResult(_0xc862f1,null))[_0xfef3('0x3f')](handleError(_0xc862f1,null));};function getAccessToken(_0x50f1d4){return new Promise(function(_0x31ced6,_0x51cf73){var _0x51f9c8;switch(_0x50f1d4['zone']){case'US':_0x51f9c8=_0xfef3('0x52');break;case'AU':_0x51f9c8=_0xfef3('0x53');break;case'EU':_0x51f9c8='https://accounts.zoho.eu';break;case'IN':_0x51f9c8=_0xfef3('0x54');break;case'CN':_0x51f9c8=_0xfef3('0x55');break;default:_0x51f9c8=_0xfef3('0x56');break;}var _0x21a4bc={'method':_0xfef3('0x57'),'uri':_0x51f9c8+_0xfef3('0x58'),'qs':{'refresh_token':_0x50f1d4['refreshToken'],'client_id':_0x50f1d4[_0xfef3('0x59')],'client_secret':_0x50f1d4[_0xfef3('0x5a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x21a4bc)[_0xfef3('0x22')](function(_0xabc4a6){if(_0xabc4a6[_0xfef3('0x5b')]){_0x31ced6(_0xabc4a6[_0xfef3('0x5b')]);}else{_0x51cf73('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xfef3('0x3f')](function(_0x1f3905){_0x51cf73(_0x1f3905);});});}exports[_0xfef3('0x5c')]=function(_0x238303,_0xd851b6,_0x212536){var _0x63521b,_0x337fff,_0x551316,_0x12d8bb,_0x2f16a1;return db['ZohoAccount'][_0xfef3('0x48')]({'where':{'id':_0x238303[_0xfef3('0x41')]['id']},'attributes':['id',_0xfef3('0x5d'),_0xfef3('0x5e'),_0xfef3('0x59'),_0xfef3('0x5a'),_0xfef3('0x5f'),_0xfef3('0x60'),_0xfef3('0x61')]})['then'](handleEntityNotFound(_0xd851b6,null))[_0xfef3('0x22')](function(_0x5cbcd7){_0x2f16a1=_0x5cbcd7;_0x63521b=_0x2f16a1['host'];_0x337fff=_0x63521b===_0xfef3('0x62')?'eu':'com';_0x551316=_0x2f16a1[_0xfef3('0x5f')];var _0x291135=_0x551316[_0xfef3('0x63')](-0x1);if(_0x291135==='/'||_0x291135==='\x5c'||_0x291135===':'){_0x551316=_0x551316[_0xfef3('0x64')](0x0,_0x551316[_0xfef3('0x65')](_0x291135));}if(!_0x2f16a1['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2f16a1);})[_0xfef3('0x22')](function(_0x685ea8){if(_0x685ea8){return rp({'method':_0xfef3('0x66'),'uri':util[_0xfef3('0x67')](_0xfef3('0x68'),_0x337fff),'qs':{'module':_0xfef3('0x69')},'headers':{'Authorization':_0xfef3('0x6a')+_0x685ea8},'json':!![]});}})[_0xfef3('0x22')](function(_0x15fd03){if(_0x15fd03){if(_0x15fd03[_0xfef3('0x6b')]&&_0x15fd03[_0xfef3('0x6b')][_0xfef3('0x24')]){throw new Error(_0x15fd03[_0xfef3('0x6b')][_0xfef3('0x24')]['message']);}var _0x4d9d8a=[];var _0x113527=[];var _0x552259=['Owner',_0xfef3('0x6c'),_0xfef3('0x6d'),_0xfef3('0x6e'),'Call_Duration','Call_Result',_0xfef3('0x6f'),'Call_Type'];_0x113527=_[_0xfef3('0x70')](_0x15fd03[_0xfef3('0x33')],function(_0x137e3b){return _0x552259['includes'](_0x137e3b[_0xfef3('0x71')]);});for(var _0x28b4f2=0x0;_0x28b4f2<_0x113527['length'];_0x28b4f2++){if(_0x113527[_0x28b4f2][_0xfef3('0x72')]===![]){_0x4d9d8a[_0xfef3('0x73')]({'id':_0x113527[_0x28b4f2]['id'],'name':_0x113527[_0x28b4f2]['display_label'],'custom':_0x113527[_0x28b4f2][_0xfef3('0x74')],'options':_0x113527[_0x28b4f2][_0xfef3('0x75')]===_0xfef3('0x76')&&_0x113527[_0x28b4f2][_0xfef3('0x77')]['length']>-0x1?_[_0xfef3('0x2d')](_0x113527[_0x28b4f2][_0xfef3('0x77')],function(_0x57453b){return{'name':_0x57453b,'value':_0x57453b};}):[]});}}return{'count':_0x4d9d8a[_0xfef3('0x34')],'rows':_0x4d9d8a};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xd851b6,null))['catch'](function(_0x29b7ff){var _0x1c22f7=_0x238303[_0xfef3('0x2e')]['test']?0x1f4:_0x29b7ff[_0xfef3('0x78')]||0x1f4;logger[_0xfef3('0x24')](_0xfef3('0x79'),_0xfef3('0x5c'),_0x1c22f7,JSON['stringify'](_0x29b7ff));delete _0x29b7ff[_0xfef3('0x26')];if(_0x1c22f7===0x191){_0x1c22f7=0x190;}_0xd851b6['status'](_0x1c22f7)[_0xfef3('0x27')](_0x238303['query'][_0xfef3('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x29b7ff['statusCode']}:_0x29b7ff);});}; \ No newline at end of file +var _0xe73a=['includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientSecret','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x4b0582,_0x35f749){var _0x3d645a=function(_0xc839ec){while(--_0xc839ec){_0x4b0582['push'](_0x4b0582['shift']());}};_0x3d645a(++_0x35f749);}(_0xe73a,0xcb));var _0xae73=function(_0x1e3e59,_0x596d22){_0x1e3e59=_0x1e3e59-0x0;var _0x4cdd16=_0xe73a[_0x1e3e59];return _0x4cdd16;};'use strict';var emlformat=require(_0xae73('0x0'));var rimraf=require(_0xae73('0x1'));var zipdir=require(_0xae73('0x2'));var jsonpatch=require(_0xae73('0x3'));var rp=require('request-promise');var moment=require(_0xae73('0x4'));var BPromise=require(_0xae73('0x5'));var Mustache=require(_0xae73('0x6'));var util=require('util');var path=require(_0xae73('0x7'));var sox=require(_0xae73('0x8'));var csv=require(_0xae73('0x9'));var ejs=require(_0xae73('0xa'));var fs=require('fs');var fs_extra=require(_0xae73('0xb'));var _=require(_0xae73('0xc'));var squel=require(_0xae73('0xd'));var crypto=require('crypto');var jsforce=require(_0xae73('0xe'));var deskjs=require(_0xae73('0xf'));var toCsv=require(_0xae73('0x9'));var querystring=require(_0xae73('0x10'));var Papa=require(_0xae73('0x11'));var Redis=require(_0xae73('0x12'));var authService=require(_0xae73('0x13'));var qs=require(_0xae73('0x14'));var as=require(_0xae73('0x15'));var hardwareService=require(_0xae73('0x16'));var logger=require(_0xae73('0x17'))(_0xae73('0x18'));var utils=require(_0xae73('0x19'));var config=require(_0xae73('0x1a'));var licenseUtil=require(_0xae73('0x1b'));var db=require(_0xae73('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2835c2,_0x44574d){_0x44574d=_0x44574d||0xcc;return function(_0x2e1a3f){if(_0x2e1a3f){return _0x2835c2[_0xae73('0x1d')](_0x44574d);}return _0x2835c2[_0xae73('0x1e')](_0x44574d)['end']();};}function respondWithResult(_0x5e1eb6,_0x457023){_0x457023=_0x457023||0xc8;return function(_0x4087af){if(_0x4087af){return _0x5e1eb6['status'](_0x457023)[_0xae73('0x1f')](_0x4087af);}};}function respondWithFilteredResult(_0x14a416,_0x5c3078){return function(_0x30d02d){if(_0x30d02d){var _0x340910=typeof _0x5c3078['offset']===_0xae73('0x20')&&typeof _0x5c3078[_0xae73('0x21')]===_0xae73('0x20');var _0x3ad1aa=_0x30d02d[_0xae73('0x22')];var _0x4bc6e0=_0x340910?0x0:_0x5c3078[_0xae73('0x23')];var _0x291c9c=_0x340910?_0x30d02d[_0xae73('0x22')]:_0x5c3078[_0xae73('0x23')]+_0x5c3078[_0xae73('0x21')];var _0x40601b;if(_0x291c9c>=_0x3ad1aa){_0x291c9c=_0x3ad1aa;_0x40601b=0xc8;}else{_0x40601b=0xce;}_0x14a416[_0xae73('0x1e')](_0x40601b);return _0x14a416[_0xae73('0x24')](_0xae73('0x25'),_0x4bc6e0+'-'+_0x291c9c+'/'+_0x3ad1aa)[_0xae73('0x1f')](_0x30d02d);}return null;};}function patchUpdates(_0x28adb2){return function(_0x28399d){try{jsonpatch[_0xae73('0x26')](_0x28399d,_0x28adb2,!![]);}catch(_0x51eeae){return BPromise[_0xae73('0x27')](_0x51eeae);}return _0x28399d['save']();};}function saveUpdates(_0x31d299,_0x254b1f){return function(_0x13fc62){if(_0x13fc62){return _0x13fc62['update'](_0x31d299)[_0xae73('0x28')](function(_0x574a89){return _0x574a89;});}return null;};}function removeEntity(_0x3ec1db,_0x4c7a77){return function(_0x41529c){if(_0x41529c){return _0x41529c['destroy']()[_0xae73('0x28')](function(){_0x3ec1db[_0xae73('0x1e')](0xcc)[_0xae73('0x29')]();});}};}function handleEntityNotFound(_0x3b89fb,_0x50ac18){return function(_0x3fa8e1){if(!_0x3fa8e1){_0x3b89fb[_0xae73('0x1d')](0x194);}return _0x3fa8e1;};}function handleError(_0x1ffbe4,_0x35414d){_0x35414d=_0x35414d||0x1f4;return function(_0x27222b){logger[_0xae73('0x2a')](_0x27222b['stack']);if(_0x27222b[_0xae73('0x2b')]){delete _0x27222b[_0xae73('0x2b')];}_0x1ffbe4['status'](_0x35414d)[_0xae73('0x2c')](_0x27222b);};}exports[_0xae73('0x2d')]=function(_0x1c0888,_0x9541c4){var _0x5ebea6={},_0x1f6a1b={},_0x4e7b9d={'count':0x0,'rows':[]};var _0x4afe6f=_[_0xae73('0x2e')](db[_0xae73('0x2f')][_0xae73('0x30')],function(_0x2f0f1b){return{'name':_0x2f0f1b[_0xae73('0x31')],'type':_0x2f0f1b[_0xae73('0x32')][_0xae73('0x33')]};});_0x1f6a1b['model']=_['map'](_0x4afe6f,_0xae73('0x2b'));_0x1f6a1b[_0xae73('0x34')]=_[_0xae73('0x35')](_0x1c0888['query']);_0x1f6a1b[_0xae73('0x36')]=_[_0xae73('0x37')](_0x1f6a1b[_0xae73('0x38')],_0x1f6a1b['query']);_0x5ebea6[_0xae73('0x39')]=_[_0xae73('0x37')](_0x1f6a1b[_0xae73('0x38')],qs[_0xae73('0x3a')](_0x1c0888[_0xae73('0x34')][_0xae73('0x3a')]));_0x5ebea6[_0xae73('0x39')]=_0x5ebea6[_0xae73('0x39')][_0xae73('0x3b')]?_0x5ebea6['attributes']:_0x1f6a1b[_0xae73('0x38')];if(!_0x1c0888[_0xae73('0x34')]['hasOwnProperty'](_0xae73('0x3c'))){_0x5ebea6['limit']=qs[_0xae73('0x21')](_0x1c0888[_0xae73('0x34')][_0xae73('0x21')]);_0x5ebea6[_0xae73('0x23')]=qs[_0xae73('0x23')](_0x1c0888[_0xae73('0x34')]['offset']);}_0x5ebea6[_0xae73('0x3d')]=qs['sort'](_0x1c0888[_0xae73('0x34')][_0xae73('0x3e')]);_0x5ebea6[_0xae73('0x3f')]=qs[_0xae73('0x36')](_[_0xae73('0x40')](_0x1c0888[_0xae73('0x34')],_0x1f6a1b[_0xae73('0x36')]),_0x4afe6f);if(_0x1c0888['query'][_0xae73('0x41')]){_0x5ebea6[_0xae73('0x3f')]=_['merge'](_0x5ebea6['where'],{'$or':_[_0xae73('0x2e')](_0x4afe6f,function(_0x1b9f09){if(_0x1b9f09[_0xae73('0x32')]!==_0xae73('0x42')){var _0x12b05f={};_0x12b05f[_0x1b9f09[_0xae73('0x2b')]]={'$like':'%'+_0x1c0888['query'][_0xae73('0x41')]+'%'};return _0x12b05f;}})});}_0x5ebea6=_[_0xae73('0x43')]({},_0x5ebea6,_0x1c0888[_0xae73('0x44')]);var _0x3bfd59={'where':_0x5ebea6[_0xae73('0x3f')]};return db['ZohoAccount'][_0xae73('0x22')](_0x3bfd59)[_0xae73('0x28')](function(_0xef76af){_0x4e7b9d[_0xae73('0x22')]=_0xef76af;if(_0x1c0888[_0xae73('0x34')][_0xae73('0x45')]){_0x5ebea6[_0xae73('0x46')]=[{'all':!![]}];}return db[_0xae73('0x2f')][_0xae73('0x47')](_0x5ebea6);})['then'](function(_0x288543){_0x4e7b9d[_0xae73('0x48')]=_0x288543;return _0x4e7b9d;})[_0xae73('0x28')](respondWithFilteredResult(_0x9541c4,_0x5ebea6))[_0xae73('0x49')](handleError(_0x9541c4,null));};exports[_0xae73('0x4a')]=function(_0x5bbc57,_0x59ca86){var _0x44e2e5={'raw':![],'where':{'id':_0x5bbc57[_0xae73('0x4b')]['id']}},_0x4f439d={};_0x4f439d['model']=_[_0xae73('0x35')](db[_0xae73('0x2f')][_0xae73('0x30')]);_0x4f439d[_0xae73('0x34')]=_['keys'](_0x5bbc57['query']);_0x4f439d[_0xae73('0x36')]=_['intersection'](_0x4f439d[_0xae73('0x38')],_0x4f439d[_0xae73('0x34')]);_0x44e2e5[_0xae73('0x39')]=_[_0xae73('0x37')](_0x4f439d[_0xae73('0x38')],qs['fields'](_0x5bbc57['query'][_0xae73('0x3a')]));_0x44e2e5['attributes']=_0x44e2e5[_0xae73('0x39')][_0xae73('0x3b')]?_0x44e2e5[_0xae73('0x39')]:_0x4f439d[_0xae73('0x38')];if(_0x5bbc57[_0xae73('0x34')][_0xae73('0x45')]){_0x44e2e5[_0xae73('0x46')]=[{'all':!![]}];}_0x44e2e5=_[_0xae73('0x43')]({},_0x44e2e5,_0x5bbc57['options']);return db['ZohoAccount']['find'](_0x44e2e5)['then'](handleEntityNotFound(_0x59ca86,null))[_0xae73('0x28')](respondWithResult(_0x59ca86,null))['catch'](handleError(_0x59ca86,null));};exports[_0xae73('0x4c')]=function(_0x258fc6,_0x431dc2){return db[_0xae73('0x2f')][_0xae73('0x4c')](_0x258fc6[_0xae73('0x4d')],{})['then'](respondWithResult(_0x431dc2,0xc9))[_0xae73('0x49')](handleError(_0x431dc2,null));};exports[_0xae73('0x4e')]=function(_0x908508,_0x3b67fe){if(_0x908508[_0xae73('0x4d')]['id']){delete _0x908508[_0xae73('0x4d')]['id'];}return db[_0xae73('0x2f')]['find']({'where':{'id':_0x908508['params']['id']}})[_0xae73('0x28')](handleEntityNotFound(_0x3b67fe,null))[_0xae73('0x28')](saveUpdates(_0x908508[_0xae73('0x4d')],null))[_0xae73('0x28')](respondWithResult(_0x3b67fe,null))[_0xae73('0x49')](handleError(_0x3b67fe,null));};exports[_0xae73('0x4f')]=function(_0x23b412,_0x51f446){return db[_0xae73('0x2f')][_0xae73('0x50')]({'where':{'id':_0x23b412[_0xae73('0x4b')]['id']}})[_0xae73('0x28')](handleEntityNotFound(_0x51f446,null))[_0xae73('0x28')](removeEntity(_0x51f446,null))[_0xae73('0x49')](handleError(_0x51f446,null));};exports['getConfigurations']=function(_0x3dc6f2,_0x1a7108,_0x45313a){var _0x136e86={};var _0x44badb={};var _0x3d5217;var _0x41253e;return db['ZohoAccount'][_0xae73('0x51')]({'where':{'id':_0x3dc6f2[_0xae73('0x4b')]['id']}})[_0xae73('0x28')](handleEntityNotFound(_0x1a7108,null))[_0xae73('0x28')](function(_0x31b09a){if(_0x31b09a){_0x3d5217=_0x31b09a;_0x44badb['model']=_['keys'](db[_0xae73('0x52')][_0xae73('0x30')]);_0x44badb['query']=_[_0xae73('0x35')](_0x3dc6f2[_0xae73('0x34')]);_0x44badb[_0xae73('0x36')]=_[_0xae73('0x37')](_0x44badb['model'],_0x44badb[_0xae73('0x34')]);_0x136e86['attributes']=_[_0xae73('0x37')](_0x44badb[_0xae73('0x38')],qs[_0xae73('0x3a')](_0x3dc6f2[_0xae73('0x34')][_0xae73('0x3a')]));_0x136e86[_0xae73('0x39')]=_0x136e86['attributes'][_0xae73('0x3b')]?_0x136e86[_0xae73('0x39')]:_0x44badb['model'];_0x136e86[_0xae73('0x3d')]=qs[_0xae73('0x3e')](_0x3dc6f2[_0xae73('0x34')][_0xae73('0x3e')]);_0x136e86['where']=qs['filters'](_[_0xae73('0x40')](_0x3dc6f2[_0xae73('0x34')],_0x44badb['filters']));if(_0x3dc6f2[_0xae73('0x34')]['filter']){_0x136e86[_0xae73('0x3f')]=_['merge'](_0x136e86[_0xae73('0x3f')],{'$or':_[_0xae73('0x2e')](_0x136e86['attributes'],function(_0x363f55){var _0x43787c={};_0x43787c[_0x363f55]={'$like':'%'+_0x3dc6f2['query'][_0xae73('0x41')]+'%'};return _0x43787c;})});}_0x136e86=_['merge']({},_0x136e86,_0x3dc6f2[_0xae73('0x44')]);return _0x3d5217[_0xae73('0x53')](_0x136e86);}})['then'](function(_0x4dc1dc){if(_0x4dc1dc){_0x41253e=_0x4dc1dc[_0xae73('0x3b')];if(!_0x3dc6f2[_0xae73('0x34')][_0xae73('0x54')](_0xae73('0x3c'))){_0x136e86[_0xae73('0x21')]=qs['limit'](_0x3dc6f2[_0xae73('0x34')][_0xae73('0x21')]);_0x136e86['offset']=qs[_0xae73('0x23')](_0x3dc6f2[_0xae73('0x34')][_0xae73('0x23')]);}return _0x3d5217['getConfigurations'](_0x136e86);}})[_0xae73('0x28')](function(_0x87729a){if(_0x87729a){return _0x87729a?{'count':_0x41253e,'rows':_0x87729a}:null;}})[_0xae73('0x28')](respondWithResult(_0x1a7108,null))[_0xae73('0x49')](handleError(_0x1a7108,null));};exports[_0xae73('0x55')]=function(_0x495dd0,_0x2cf94e,_0x8ac784){if(_0x495dd0[_0xae73('0x4d')]['id']){delete _0x495dd0[_0xae73('0x4d')]['id'];}return db[_0xae73('0x2f')]['findOne']({'where':{'id':_0x495dd0[_0xae73('0x4b')]['id']}})[_0xae73('0x28')](handleEntityNotFound(_0x2cf94e,null))['then'](function(_0x2143c2){if(_0x2143c2){_0x495dd0['body'][_0xae73('0x56')]=_0x2143c2['id'];_0x495dd0[_0xae73('0x4d')]['Subjects']=integrations[_0xae73('0x57')](_0x495dd0[_0xae73('0x4d')][_0xae73('0x58')],_0x495dd0[_0xae73('0x4d')][_0xae73('0x32')]);_0x495dd0[_0xae73('0x4d')][_0xae73('0x59')]=integrations[_0xae73('0x5a')](_0x495dd0['body']['channel'],_0x495dd0[_0xae73('0x4d')][_0xae73('0x32')]);return db['ZohoConfiguration'][_0xae73('0x4c')](_0x495dd0['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xae73('0x5b')],'as':'Descriptions'}]});}return null;})[_0xae73('0x28')](respondWithResult(_0x2cf94e,null))[_0xae73('0x49')](handleError(_0x2cf94e,null));};function getAccessToken(_0x4be02e){return new Promise(function(_0x30c6c7,_0x27a459){var _0xf57c4a;switch(_0x4be02e[_0xae73('0x5c')]){case'US':_0xf57c4a=_0xae73('0x5d');break;case'AU':_0xf57c4a=_0xae73('0x5e');break;case'EU':_0xf57c4a=_0xae73('0x5f');break;case'IN':_0xf57c4a=_0xae73('0x60');break;case'CN':_0xf57c4a=_0xae73('0x61');break;default:_0xf57c4a=_0xae73('0x5f');break;}var _0x521874={'method':'POST','uri':_0xf57c4a+_0xae73('0x62'),'qs':{'refresh_token':_0x4be02e['refreshToken'],'client_id':_0x4be02e[_0xae73('0x63')],'client_secret':_0x4be02e['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x521874)[_0xae73('0x28')](function(_0x305df7){if(_0x305df7[_0xae73('0x64')]){_0x30c6c7(_0x305df7['access_token']);}else{_0x27a459(_0xae73('0x65'));}})[_0xae73('0x49')](function(_0x443c27){_0x27a459(_0x443c27);});});}exports['getFields']=function(_0x4c3632,_0x5e72cc,_0x14d57a){var _0x171de2,_0x19da5a,_0x1eb826,_0x89ad9b,_0x576ab6;return db[_0xae73('0x2f')]['findOne']({'where':{'id':_0x4c3632[_0xae73('0x4b')]['id']},'attributes':['id',_0xae73('0x66'),_0xae73('0x5c'),'clientId',_0xae73('0x67'),_0xae73('0x68'),'code',_0xae73('0x69')]})['then'](handleEntityNotFound(_0x5e72cc,null))[_0xae73('0x28')](function(_0x2280f3){_0x576ab6=_0x2280f3;_0x171de2=_0x576ab6[_0xae73('0x66')];_0x19da5a=_0x171de2===_0xae73('0x6a')?'eu':_0xae73('0x6b');_0x1eb826=_0x576ab6[_0xae73('0x68')];var _0x2b45c3=_0x1eb826[_0xae73('0x6c')](-0x1);if(_0x2b45c3==='/'||_0x2b45c3==='\x5c'||_0x2b45c3===':'){_0x1eb826=_0x1eb826[_0xae73('0x6d')](0x0,_0x1eb826[_0xae73('0x6e')](_0x2b45c3));}if(!_0x576ab6['refreshToken']){throw new Error(_0xae73('0x6f'));}return getAccessToken(_0x576ab6);})['then'](function(_0x3da289){if(_0x3da289){return rp({'method':'GET','uri':util[_0xae73('0x70')](_0xae73('0x71'),_0x19da5a),'qs':{'module':_0xae73('0x72')},'headers':{'Authorization':_0xae73('0x73')+_0x3da289},'json':!![]});}})[_0xae73('0x28')](function(_0x296211){if(_0x296211){if(_0x296211[_0xae73('0x74')]&&_0x296211[_0xae73('0x74')][_0xae73('0x2a')]){throw new Error(_0x296211[_0xae73('0x74')]['error'][_0xae73('0x75')]);}var _0x13a77a=[];var _0xdfa563=[];var _0x373bec=['Owner',_0xae73('0x76'),_0xae73('0x77'),_0xae73('0x78'),'Call_Duration',_0xae73('0x79'),_0xae73('0x7a'),_0xae73('0x7b')];_0xdfa563=_[_0xae73('0x7c')](_0x296211[_0xae73('0x3a')],function(_0x508ef5){return _0x373bec['includes'](_0x508ef5[_0xae73('0x7d')]);});for(var _0x5703f2=0x0;_0x5703f2<_0xdfa563['length'];_0x5703f2++){if(_0xdfa563[_0x5703f2]['system_mandatory']===![]){_0x13a77a[_0xae73('0x7e')]({'id':_0xdfa563[_0x5703f2]['id'],'name':_0xdfa563[_0x5703f2]['display_label'],'custom':_0xdfa563[_0x5703f2][_0xae73('0x7f')],'options':_0xdfa563[_0x5703f2][_0xae73('0x80')]===_0xae73('0x81')&&_0xdfa563[_0x5703f2][_0xae73('0x82')][_0xae73('0x3b')]>-0x1?_['map'](_0xdfa563[_0x5703f2][_0xae73('0x82')],function(_0x5e6fd4){return{'name':_0x5e6fd4,'value':_0x5e6fd4};}):[]});}}return{'count':_0x13a77a[_0xae73('0x3b')],'rows':_0x13a77a};}else{return{'count':0x0,'rows':[]};}})[_0xae73('0x28')](respondWithResult(_0x5e72cc,null))[_0xae73('0x49')](function(_0x1711cb){var _0x50e7be=_0x4c3632[_0xae73('0x34')][_0xae73('0x83')]?0x1f4:_0x1711cb[_0xae73('0x84')]||0x1f4;logger[_0xae73('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xae73('0x85'),_0x50e7be,JSON[_0xae73('0x86')](_0x1711cb));delete _0x1711cb[_0xae73('0x2b')];if(_0x50e7be===0x191){_0x50e7be=0x190;}_0x5e72cc[_0xae73('0x1e')](_0x50e7be)[_0xae73('0x2c')](_0x4c3632[_0xae73('0x34')][_0xae73('0x83')]?{'message':_0xae73('0x87'),'statusCode':_0x1711cb[_0xae73('0x84')]}:_0x1711cb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3ab5f40..2aeeb18 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 _0xb7fe=['define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','code','application/x-www-form-urlencoded','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','slice','https://accounts.zoho.eu','clientId','then','parse','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x643b2,_0x14e495){var _0x2e5346=function(_0x3ed065){while(--_0x3ed065){_0x643b2['push'](_0x643b2['shift']());}};_0x2e5346(++_0x14e495);}(_0xb7fe,0x168));var _0xeb7f=function(_0x31c9ac,_0xae7e1b){_0x31c9ac=_0x31c9ac-0x0;var _0x1be1e2=_0xb7fe[_0x31c9ac];return _0x1be1e2;};'use strict';var _=require(_0xeb7f('0x0'));var util=require(_0xeb7f('0x1'));var logger=require(_0xeb7f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeb7f('0x3'));var rp=require(_0xeb7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb7f('0x5'));var attributes=require(_0xeb7f('0x6'));var integrations=require(_0xeb7f('0x7'));module[_0xeb7f('0x8')]=function(_0x2e09cf,_0x13f4d0){return _0x2e09cf[_0xeb7f('0x9')](_0xeb7f('0xa'),attributes,{'tableName':_0xeb7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a24fe,_0xd5b36b,_0x4d9651){if(_0x1a24fe[_0xeb7f('0xc')](_0xeb7f('0xd'))||_0x1a24fe[_0xeb7f('0xc')](_0xeb7f('0xe'))||_0x1a24fe[_0xeb7f('0xc')]('clientId')||_0x1a24fe[_0xeb7f('0xc')]('clientSecret')||_0x1a24fe[_0xeb7f('0xc')]('code')||_0x1a24fe[_0xeb7f('0xc')](_0xeb7f('0xf'))){var _0x4d0c1f,_0x4a84b2;_0x4d0c1f=_0x1a24fe[_0xeb7f('0xe')];var _0x258c11=_0x4d0c1f['slice'](-0x1);if(_0x258c11==='/'||_0x258c11==='\x5c'||_0x258c11===':'){_0x4d0c1f=_0x4d0c1f[_0xeb7f('0x10')](0x0,_0x4d0c1f[_0xeb7f('0x11')](_0x258c11));}switch(_0x1a24fe['zone']){case'US':_0x4a84b2='https://accounts.zoho.com';break;case'AU':_0x4a84b2=_0xeb7f('0x12');break;case'IN':_0x4a84b2=_0xeb7f('0x13');break;case'CN':_0x4a84b2=_0xeb7f('0x14');break;default:_0x4a84b2='https://accounts.zoho.eu';break;}var _0x4aec28={'method':_0xeb7f('0x15'),'uri':_0x4a84b2+_0xeb7f('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x1a24fe['clientId'],'client_secret':_0x1a24fe[_0xeb7f('0x17')],'redirect_uri':_0x1a24fe['serverUrl'],'code':_0x1a24fe[_0xeb7f('0x18')]},'headers':{'Content-Type':_0xeb7f('0x19')}};return rp(_0x4aec28)['then'](function(_0x2a6799){var _0xadd1=JSON['parse'](_0x2a6799);if(_0xadd1['refresh_token']){_0x1a24fe[_0xeb7f('0x1a')]=_0xadd1[_0xeb7f('0x1b')];logger['info'](util[_0xeb7f('0x1c')](_0xeb7f('0x1d'),_0x1a24fe[_0xeb7f('0x1e')],_0x1a24fe['id']));}else{logger[_0xeb7f('0x1f')](util[_0xeb7f('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a24fe[_0xeb7f('0x1e')],_0x1a24fe['id']),util[_0xeb7f('0x20')](_0xadd1,{'showHidden':![],'depth':null}));}return _0x4d9651(null,_0xd5b36b);})[_0xeb7f('0x21')](function(_0x252f93){logger[_0xeb7f('0x1f')](util[_0xeb7f('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a24fe['name'],_0x1a24fe['id']),util[_0xeb7f('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d9651(_0x252f93);});}else{return _0x4d9651(null,_0xd5b36b);}},'beforeUpdate':function(_0x371046,_0x5d7f28,_0x4ebb9b){if(_0x371046['changed']('zone')||_0x371046[_0xeb7f('0xc')](_0xeb7f('0xe'))||_0x371046[_0xeb7f('0xc')]('clientId')||_0x371046[_0xeb7f('0xc')](_0xeb7f('0x17'))||_0x371046[_0xeb7f('0xc')](_0xeb7f('0x18'))||_0x371046[_0xeb7f('0xc')](_0xeb7f('0xf'))){var _0x46443a,_0x5094f8;_0x46443a=_0x371046[_0xeb7f('0xe')];var _0x52584f=_0x46443a[_0xeb7f('0x22')](-0x1);if(_0x52584f==='/'||_0x52584f==='\x5c'||_0x52584f===':'){_0x46443a=_0x46443a['substring'](0x0,_0x46443a[_0xeb7f('0x11')](_0x52584f));}switch(_0x371046[_0xeb7f('0xd')]){case'US':_0x5094f8='https://accounts.zoho.com';break;case'AU':_0x5094f8=_0xeb7f('0x12');break;case'IN':_0x5094f8=_0xeb7f('0x13');break;case'CN':_0x5094f8='https://accounts.zoho.com.cn';break;default:_0x5094f8=_0xeb7f('0x23');break;}var _0x4aef85={'method':'POST','uri':_0x5094f8+_0xeb7f('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x371046[_0xeb7f('0x24')],'client_secret':_0x371046['clientSecret'],'redirect_uri':_0x371046[_0xeb7f('0xe')],'code':_0x371046['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4aef85)[_0xeb7f('0x25')](function(_0x12ed53){var _0x3a554d=JSON[_0xeb7f('0x26')](_0x12ed53);if(_0x3a554d['refresh_token']){_0x371046[_0xeb7f('0x1a')]=_0x3a554d['refresh_token'];logger[_0xeb7f('0x27')](util['format'](_0xeb7f('0x1d'),_0x371046[_0xeb7f('0x1e')],_0x371046['id']));}else{logger[_0xeb7f('0x1f')](util['format'](_0xeb7f('0x28'),_0x371046[_0xeb7f('0x1e')],_0x371046['id']),util['inspect'](_0x3a554d,{'showHidden':![],'depth':null}));}return _0x4ebb9b(null,_0x5d7f28);})[_0xeb7f('0x21')](function(_0x69e656){logger[_0xeb7f('0x1f')](util[_0xeb7f('0x1c')](_0xeb7f('0x28'),_0x371046[_0xeb7f('0x1e')],_0x371046['id']),util[_0xeb7f('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ebb9b(_0x69e656);});}else{return _0x4ebb9b(null,_0x5d7f28);}}}});}; \ No newline at end of file +var _0xb899=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','slice','authorization_code','refreshToken','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','clientSecret','code','host','serverUrl','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x11d985,_0x1317a5){var _0x52e86c=function(_0x191e8b){while(--_0x191e8b){_0x11d985['push'](_0x11d985['shift']());}};_0x52e86c(++_0x1317a5);}(_0xb899,0x18e));var _0x9b89=function(_0x3f3dc2,_0x869917){_0x3f3dc2=_0x3f3dc2-0x0;var _0x44e050=_0xb899[_0x3f3dc2];return _0x44e050;};'use strict';var _=require(_0x9b89('0x0'));var util=require(_0x9b89('0x1'));var logger=require(_0x9b89('0x2'))('api');var moment=require(_0x9b89('0x3'));var BPromise=require(_0x9b89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b89('0x5'));var rimraf=require(_0x9b89('0x6'));var config=require(_0x9b89('0x7'));var attributes=require(_0x9b89('0x8'));var integrations=require(_0x9b89('0x9'));module[_0x9b89('0xa')]=function(_0x389908,_0x116121){return _0x389908['define']('ZohoAccount',attributes,{'tableName':_0x9b89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x508ddc,_0x54c396,_0x1c9023){if(_0x508ddc['changed']('zone')||_0x508ddc['changed']('serverUrl')||_0x508ddc[_0x9b89('0xc')]('clientId')||_0x508ddc[_0x9b89('0xc')](_0x9b89('0xd'))||_0x508ddc[_0x9b89('0xc')](_0x9b89('0xe'))||_0x508ddc[_0x9b89('0xc')](_0x9b89('0xf'))){var _0x25f581,_0x1e440c;_0x25f581=_0x508ddc[_0x9b89('0x10')];var _0x172561=_0x25f581['slice'](-0x1);if(_0x172561==='/'||_0x172561==='\x5c'||_0x172561===':'){_0x25f581=_0x25f581[_0x9b89('0x11')](0x0,_0x25f581[_0x9b89('0x12')](_0x172561));}switch(_0x508ddc[_0x9b89('0x13')]){case'US':_0x1e440c=_0x9b89('0x14');break;case'AU':_0x1e440c=_0x9b89('0x15');break;case'IN':_0x1e440c=_0x9b89('0x16');break;case'CN':_0x1e440c=_0x9b89('0x17');break;default:_0x1e440c=_0x9b89('0x18');break;}var _0x3729d6={'method':_0x9b89('0x19'),'uri':_0x1e440c+_0x9b89('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x508ddc[_0x9b89('0x1b')],'client_secret':_0x508ddc[_0x9b89('0xd')],'redirect_uri':_0x508ddc[_0x9b89('0x10')],'code':_0x508ddc[_0x9b89('0xe')]},'headers':{'Content-Type':_0x9b89('0x1c')}};return rp(_0x3729d6)[_0x9b89('0x1d')](function(_0xb854c1){var _0x2596f3=JSON[_0x9b89('0x1e')](_0xb854c1);if(_0x2596f3[_0x9b89('0x1f')]){_0x508ddc['refreshToken']=_0x2596f3[_0x9b89('0x1f')];logger[_0x9b89('0x20')](util[_0x9b89('0x21')](_0x9b89('0x22'),_0x508ddc[_0x9b89('0x23')],_0x508ddc['id']));}else{logger[_0x9b89('0x24')](util[_0x9b89('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x508ddc[_0x9b89('0x23')],_0x508ddc['id']),util[_0x9b89('0x25')](_0x2596f3,{'showHidden':![],'depth':null}));}return _0x1c9023(null,_0x54c396);})[_0x9b89('0x26')](function(_0x4b441d){logger[_0x9b89('0x24')](util[_0x9b89('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x508ddc['name'],_0x508ddc['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1c9023(_0x4b441d);});}else{return _0x1c9023(null,_0x54c396);}},'beforeUpdate':function(_0xc8f657,_0xe88c38,_0x58a1d8){if(_0xc8f657[_0x9b89('0xc')](_0x9b89('0x13'))||_0xc8f657[_0x9b89('0xc')](_0x9b89('0x10'))||_0xc8f657[_0x9b89('0xc')](_0x9b89('0x1b'))||_0xc8f657[_0x9b89('0xc')](_0x9b89('0xd'))||_0xc8f657[_0x9b89('0xc')](_0x9b89('0xe'))||_0xc8f657[_0x9b89('0xc')](_0x9b89('0xf'))){var _0x3e74aa,_0x1d48d9;_0x3e74aa=_0xc8f657[_0x9b89('0x10')];var _0x5cedf0=_0x3e74aa[_0x9b89('0x27')](-0x1);if(_0x5cedf0==='/'||_0x5cedf0==='\x5c'||_0x5cedf0===':'){_0x3e74aa=_0x3e74aa['substring'](0x0,_0x3e74aa['lastIndexOf'](_0x5cedf0));}switch(_0xc8f657[_0x9b89('0x13')]){case'US':_0x1d48d9=_0x9b89('0x14');break;case'AU':_0x1d48d9=_0x9b89('0x15');break;case'IN':_0x1d48d9=_0x9b89('0x16');break;case'CN':_0x1d48d9='https://accounts.zoho.com.cn';break;default:_0x1d48d9=_0x9b89('0x18');break;}var _0xf2809f={'method':_0x9b89('0x19'),'uri':_0x1d48d9+_0x9b89('0x1a'),'form':{'grant_type':_0x9b89('0x28'),'client_id':_0xc8f657[_0x9b89('0x1b')],'client_secret':_0xc8f657[_0x9b89('0xd')],'redirect_uri':_0xc8f657[_0x9b89('0x10')],'code':_0xc8f657[_0x9b89('0xe')]},'headers':{'Content-Type':_0x9b89('0x1c')}};return rp(_0xf2809f)[_0x9b89('0x1d')](function(_0x3185e1){var _0x1d2fe6=JSON[_0x9b89('0x1e')](_0x3185e1);if(_0x1d2fe6['refresh_token']){_0xc8f657[_0x9b89('0x29')]=_0x1d2fe6[_0x9b89('0x1f')];logger[_0x9b89('0x20')](util[_0x9b89('0x21')](_0x9b89('0x22'),_0xc8f657['name'],_0xc8f657['id']));}else{logger[_0x9b89('0x24')](util[_0x9b89('0x21')](_0x9b89('0x2a'),_0xc8f657[_0x9b89('0x23')],_0xc8f657['id']),util[_0x9b89('0x25')](_0x1d2fe6,{'showHidden':![],'depth':null}));}return _0x58a1d8(null,_0xe88c38);})[_0x9b89('0x26')](function(_0x18e2aa){logger[_0x9b89('0x24')](util['format'](_0x9b89('0x2a'),_0xc8f657[_0x9b89('0x23')],_0xc8f657['id']),util[_0x9b89('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x58a1d8(_0x18e2aa);});}else{return _0x58a1d8(null,_0xe88c38);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f021122..b4d6002 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 _0x4201=['then','ShowZohoAccount','ZohoAccount','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x4201,0x71));var _0x1420=function(_0x9d1180,_0x2f71fb){_0x9d1180=_0x9d1180-0x0;var _0x155274=_0x4201[_0x9d1180];return _0x155274;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require('moment');var BPromise=require(_0x1420('0x2'));var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require(_0x1420('0x6'));var logger=require(_0x1420('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a8ba,_0x239e16,_0x59ddc5){return new BPromise(function(_0x5a925c,_0x46d303){return client[_0x1420('0xb')](_0x35a8ba,_0x59ddc5)['then'](function(_0x1d52ff){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'));logger[_0x1420('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'),JSON[_0x1420('0xe')](_0x1d52ff));if(_0x1d52ff[_0x1420('0xf')]){if(_0x1d52ff[_0x1420('0xf')][_0x1420('0x10')]===0x1f4){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')]['message']);return _0x46d303(_0x1d52ff['error']['message']);}logger['error'](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);return _0x5a925c(_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);}else{logger[_0x1420('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x239e16,'request\x20sent');_0x5a925c(_0x1d52ff[_0x1420('0x14')]['message']);}})['catch'](function(_0x231659){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x231659);_0x46d303(_0x231659);});});}exports[_0x1420('0x15')]=function(_0x47bea3){var _0x22feca=this;return new Promise(function(_0x137b75,_0x3ee585){return db['ZohoAccount'][_0x1420('0x16')]({'raw':_0x47bea3[_0x1420('0x17')]?_0x47bea3[_0x1420('0x17')][_0x1420('0x18')]===undefined?!![]:![]:!![],'where':_0x47bea3['options']?_0x47bea3['options'][_0x1420('0x19')]||null:null,'attributes':_0x47bea3['options']?_0x47bea3[_0x1420('0x17')][_0x1420('0x1a')]||null:null,'limit':_0x47bea3[_0x1420('0x17')]?_0x47bea3[_0x1420('0x17')][_0x1420('0x1b')]||null:null,'include':_0x47bea3['options']?_0x47bea3[_0x1420('0x17')][_0x1420('0x1c')]?_[_0x1420('0x1d')](_0x47bea3[_0x1420('0x17')][_0x1420('0x1c')],function(_0xd66521){return{'model':db[_0xd66521['model']],'as':_0xd66521['as'],'attributes':_0xd66521['attributes'],'include':_0xd66521['include']?_[_0x1420('0x1d')](_0xd66521[_0x1420('0x1c')],function(_0x8d03e9){return{'model':db[_0x8d03e9[_0x1420('0x1e')]],'as':_0x8d03e9['as'],'attributes':_0x8d03e9[_0x1420('0x1a')],'include':_0x8d03e9['include']?_['map'](_0x8d03e9[_0x1420('0x1c')],function(_0x205d1a){return{'model':db[_0x205d1a[_0x1420('0x1e')]],'as':_0x205d1a['as'],'attributes':_0x205d1a[_0x1420('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1420('0x1f')](function(_0x32e63c){logger['info'](_0x1420('0x15'),_0x47bea3);logger[_0x1420('0xd')](_0x1420('0x15'),_0x47bea3,JSON[_0x1420('0xe')](_0x32e63c));_0x137b75(_0x32e63c);})['catch'](function(_0x26e523){logger[_0x1420('0xf')](_0x1420('0x15'),_0x26e523[_0x1420('0x12')],_0x47bea3);_0x3ee585(_0x22feca['error'](0x1f4,_0x26e523[_0x1420('0x12')]));});});};exports[_0x1420('0x20')]=function(_0x8c3e84){var _0x42a317=this;return new Promise(function(_0x392318,_0x2b8fef){return db[_0x1420('0x21')][_0x1420('0x22')]({'raw':_0x8c3e84[_0x1420('0x17')]?_0x8c3e84[_0x1420('0x17')][_0x1420('0x18')]===undefined?!![]:![]:!![],'where':_0x8c3e84[_0x1420('0x17')]?_0x8c3e84['options'][_0x1420('0x19')]||null:null,'attributes':_0x8c3e84[_0x1420('0x17')]?_0x8c3e84[_0x1420('0x17')][_0x1420('0x1a')]||null:null,'include':_0x8c3e84[_0x1420('0x17')]?_0x8c3e84['options'][_0x1420('0x1c')]?_[_0x1420('0x1d')](_0x8c3e84['options'][_0x1420('0x1c')],function(_0x4d055e){return{'model':db[_0x4d055e['model']],'as':_0x4d055e['as'],'attributes':_0x4d055e['attributes'],'include':_0x4d055e[_0x1420('0x1c')]?_[_0x1420('0x1d')](_0x4d055e[_0x1420('0x1c')],function(_0x3ad62f){return{'model':db[_0x3ad62f[_0x1420('0x1e')]],'as':_0x3ad62f['as'],'attributes':_0x3ad62f[_0x1420('0x1a')],'include':_0x3ad62f['include']?_[_0x1420('0x1d')](_0x3ad62f[_0x1420('0x1c')],function(_0x55eb1f){return{'model':db[_0x55eb1f[_0x1420('0x1e')]],'as':_0x55eb1f['as'],'attributes':_0x55eb1f[_0x1420('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1420('0x1f')](function(_0x25f23e){logger[_0x1420('0x13')](_0x1420('0x20'),_0x8c3e84);logger[_0x1420('0xd')](_0x1420('0x20'),_0x8c3e84,JSON['stringify'](_0x25f23e));_0x392318(_0x25f23e);})[_0x1420('0x23')](function(_0x369348){logger[_0x1420('0xf')](_0x1420('0x20'),_0x369348[_0x1420('0x12')],_0x8c3e84);_0x2b8fef(_0x42a317['error'](0x1f4,_0x369348[_0x1420('0x12')]));});});}; \ No newline at end of file +var _0xeae8=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','ZohoAccount','findAll','options','raw','attributes','limit','include','model','map','then','GetZohoAccount','stringify','catch','ShowZohoAccount','find','where'];(function(_0x2c4d22,_0x4ca120){var _0x1f0537=function(_0x2374a9){while(--_0x2374a9){_0x2c4d22['push'](_0x2c4d22['shift']());}};_0x1f0537(++_0x4ca120);}(_0xeae8,0x66));var _0x8eae=function(_0x1a15ae,_0x41bf3a){_0x1a15ae=_0x1a15ae-0x0;var _0x45d51b=_0xeae8[_0x1a15ae];return _0x45d51b;};'use strict';var _=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var moment=require(_0x8eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x8eae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eae('0x5'))(_0x8eae('0x6'));var config=require(_0x8eae('0x7'));var jayson=require(_0x8eae('0x8'));var client=jayson[_0x8eae('0x9')][_0x8eae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c67f,_0xd2b0,_0x2dcd90){return new BPromise(function(_0x2ae6e7,_0x476ba1){return client['request'](_0x32c67f,_0x2dcd90)['then'](function(_0x1cd68f){logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));logger[_0x8eae('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd2b0,'request\x20sent',JSON['stringify'](_0x1cd68f));if(_0x1cd68f[_0x8eae('0xf')]){if(_0x1cd68f[_0x8eae('0xf')]['code']===0x1f4){logger[_0x8eae('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x476ba1(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}logger[_0x8eae('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x2ae6e7(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}else{logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));_0x2ae6e7(_0x1cd68f[_0x8eae('0x11')][_0x8eae('0x10')]);}})['catch'](function(_0x5e214e){logger['error'](_0x8eae('0xc'),_0xd2b0,_0x5e214e);_0x476ba1(_0x5e214e);});});}exports['GetZohoAccount']=function(_0x3db47b){var _0x3fe930=this;return new Promise(function(_0x386a97,_0x13331a){return db[_0x8eae('0x12')][_0x8eae('0x13')]({'raw':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x3db47b[_0x8eae('0x14')]?_0x3db47b['options']['where']||null:null,'attributes':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'limit':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x17')]||null:null,'include':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')]?_['map'](_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x171710){return{'model':db[_0x171710[_0x8eae('0x19')]],'as':_0x171710['as'],'attributes':_0x171710[_0x8eae('0x16')],'include':_0x171710[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x171710[_0x8eae('0x18')],function(_0x14c0c5){return{'model':db[_0x14c0c5[_0x8eae('0x19')]],'as':_0x14c0c5['as'],'attributes':_0x14c0c5[_0x8eae('0x16')],'include':_0x14c0c5['include']?_[_0x8eae('0x1a')](_0x14c0c5[_0x8eae('0x18')],function(_0x141940){return{'model':db[_0x141940[_0x8eae('0x19')]],'as':_0x141940['as'],'attributes':_0x141940[_0x8eae('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x206ba3){logger['info'](_0x8eae('0x1c'),_0x3db47b);logger['debug'](_0x8eae('0x1c'),_0x3db47b,JSON[_0x8eae('0x1d')](_0x206ba3));_0x386a97(_0x206ba3);})[_0x8eae('0x1e')](function(_0x3f5d30){logger[_0x8eae('0xf')]('GetZohoAccount',_0x3f5d30['message'],_0x3db47b);_0x13331a(_0x3fe930[_0x8eae('0xf')](0x1f4,_0x3f5d30[_0x8eae('0x10')]));});});};exports[_0x8eae('0x1f')]=function(_0x307a19){var _0x547eea=this;return new Promise(function(_0x113dc7,_0x22ffeb){return db[_0x8eae('0x12')][_0x8eae('0x20')]({'raw':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x21')]||null:null,'attributes':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'include':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x2fc72a){return{'model':db[_0x2fc72a[_0x8eae('0x19')]],'as':_0x2fc72a['as'],'attributes':_0x2fc72a['attributes'],'include':_0x2fc72a[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x2fc72a[_0x8eae('0x18')],function(_0x4bf905){return{'model':db[_0x4bf905[_0x8eae('0x19')]],'as':_0x4bf905['as'],'attributes':_0x4bf905[_0x8eae('0x16')],'include':_0x4bf905[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x4bf905['include'],function(_0xa885ad){return{'model':db[_0xa885ad['model']],'as':_0xa885ad['as'],'attributes':_0xa885ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x38713d){logger[_0x8eae('0xb')](_0x8eae('0x1f'),_0x307a19);logger[_0x8eae('0xe')](_0x8eae('0x1f'),_0x307a19,JSON[_0x8eae('0x1d')](_0x38713d));_0x113dc7(_0x38713d);})['catch'](function(_0x71f9be){logger[_0x8eae('0xf')]('ShowZohoAccount',_0x71f9be['message'],_0x307a19);_0x22ffeb(_0x547eea['error'](0x1f4,_0x71f9be[_0x8eae('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d0c589b..d21dec2 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 _0x7d06=['get','getDescriptions','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4c4291,_0x163530){var _0x2d9aa5=function(_0x31929c){while(--_0x31929c){_0x4c4291['push'](_0x4c4291['shift']());}};_0x2d9aa5(++_0x163530);}(_0x7d06,0x70));var _0x67d0=function(_0xb1c9b0,_0x131847){_0xb1c9b0=_0xb1c9b0-0x0;var _0x2cfa66=_0x7d06[_0xb1c9b0];return _0x2cfa66;};'use strict';var multer=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var path=require(_0x67d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x67d0('0x3'));var router=express[_0x67d0('0x4')]();var fs_extra=require(_0x67d0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x67d0('0x6'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x67d0('0x7')](),controller[_0x67d0('0x8')]);router['get'](_0x67d0('0x9'),auth[_0x67d0('0x7')](),controller['show']);router['get'](_0x67d0('0xa'),auth[_0x67d0('0x7')](),controller[_0x67d0('0xb')]);router['get'](_0x67d0('0xc'),auth[_0x67d0('0x7')](),controller[_0x67d0('0xd')]);router[_0x67d0('0xe')]('/:id/descriptions',auth[_0x67d0('0x7')](),controller[_0x67d0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x67d0('0x10')]);router[_0x67d0('0x11')](_0x67d0('0x9'),auth[_0x67d0('0x7')](),controller[_0x67d0('0x12')]);router[_0x67d0('0x13')](_0x67d0('0x9'),auth[_0x67d0('0x7')](),controller[_0x67d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9880=['/:id','show','/:id/fields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x2b2ab2,_0x29ffe6){var _0x149c62=function(_0x20cf12){while(--_0x20cf12){_0x2b2ab2['push'](_0x2b2ab2['shift']());}};_0x149c62(++_0x29ffe6);}(_0x9880,0x12b));var _0x0988=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x9880[_0x1314d4];return _0x584ba5;};'use strict';var multer=require('multer');var util=require(_0x0988('0x0'));var path=require('path');var timeout=require(_0x0988('0x1'));var express=require('express');var router=express[_0x0988('0x2')]();var fs_extra=require(_0x0988('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0988('0x4'));var config=require(_0x0988('0x5'));var controller=require(_0x0988('0x6'));router[_0x0988('0x7')]('/',auth['isAuthenticated'](),controller[_0x0988('0x8')]);router[_0x0988('0x7')](_0x0988('0x9'),auth['isAuthenticated'](),controller[_0x0988('0xa')]);router[_0x0988('0x7')](_0x0988('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x0988('0x7')](_0x0988('0xc'),auth[_0x0988('0xd')](),controller[_0x0988('0xe')]);router[_0x0988('0x7')](_0x0988('0xf'),auth[_0x0988('0xd')](),controller[_0x0988('0x10')]);router[_0x0988('0x11')]('/',auth[_0x0988('0xd')](),controller[_0x0988('0x12')]);router[_0x0988('0x13')](_0x0988('0x9'),auth[_0x0988('0xd')](),controller['update']);router['delete']('/:id',auth[_0x0988('0xd')](),controller[_0x0988('0x14')]);module[_0x0988('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e84b05a..fe8122d 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 _0xb1af=['STRING','ENUM','lead','contact','nothing','contact_lead','exports'];(function(_0x1ab8a2,_0x7f3ff0){var _0x504c29=function(_0x1ac12c){while(--_0x1ac12c){_0x1ab8a2['push'](_0x1ab8a2['shift']());}};_0x504c29(++_0x7f3ff0);}(_0xb1af,0x156));var _0xfb1a=function(_0xd803c8,_0x22bbf2){_0xd803c8=_0xd803c8-0x0;var _0x14d343=_0xb1af[_0xd803c8];return _0x14d343;};'use strict';var Sequelize=require('sequelize');module[_0xfb1a('0x0')]={'name':{'type':Sequelize[_0xfb1a('0x1')]},'moduleCreate':{'type':Sequelize[_0xfb1a('0x2')](_0xfb1a('0x3'),_0xfb1a('0x4'),_0xfb1a('0x5')),'defaultValue':_0xfb1a('0x3')},'moduleSearch':{'type':Sequelize[_0xfb1a('0x2')](_0xfb1a('0x6'),_0xfb1a('0x4'),_0xfb1a('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xfb1a('0x1')]}}; \ No newline at end of file +var _0x4fd7=['exports','STRING','ENUM','nothing','lead','contact_lead','sequelize'];(function(_0x2beb3d,_0x57bdc2){var _0x59ee1a=function(_0x59348e){while(--_0x59348e){_0x2beb3d['push'](_0x2beb3d['shift']());}};_0x59ee1a(++_0x57bdc2);}(_0x4fd7,0xe6));var _0x74fd=function(_0x3ee9fc,_0x25edb9){_0x3ee9fc=_0x3ee9fc-0x0;var _0x3fe6e7=_0x4fd7[_0x3ee9fc];return _0x3fe6e7;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'name':{'type':Sequelize[_0x74fd('0x2')]},'moduleCreate':{'type':Sequelize[_0x74fd('0x3')]('lead','contact',_0x74fd('0x4')),'defaultValue':_0x74fd('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x74fd('0x6'),'contact',_0x74fd('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x74fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fb6b9bd..7f19fa3 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 _0xf4c6=['getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','rows','catch','show','params','keys','intersection','includeAll','options','find','create','body','getFields','ZohoField','pick','getSubjects'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf4c6,0x96));var _0x6f4c=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0xf4c6[_0x5c7e53];return _0x1c9af9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f4c('0x0'));var zipdir=require(_0x6f4c('0x1'));var jsonpatch=require(_0x6f4c('0x2'));var rp=require(_0x6f4c('0x3'));var moment=require(_0x6f4c('0x4'));var BPromise=require(_0x6f4c('0x5'));var Mustache=require(_0x6f4c('0x6'));var util=require('util');var path=require(_0x6f4c('0x7'));var sox=require(_0x6f4c('0x8'));var csv=require(_0x6f4c('0x9'));var ejs=require(_0x6f4c('0xa'));var fs=require('fs');var fs_extra=require(_0x6f4c('0xb'));var _=require(_0x6f4c('0xc'));var squel=require(_0x6f4c('0xd'));var crypto=require(_0x6f4c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f4c('0x9'));var querystring=require(_0x6f4c('0xf'));var Papa=require(_0x6f4c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f4c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f4c('0x12'))('api');var utils=require(_0x6f4c('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f4c('0x14'))['db'];function respondWithStatusCode(_0x386219,_0x48f8b6){_0x48f8b6=_0x48f8b6||0xcc;return function(_0x427fdc){if(_0x427fdc){return _0x386219[_0x6f4c('0x15')](_0x48f8b6);}return _0x386219[_0x6f4c('0x16')](_0x48f8b6)[_0x6f4c('0x17')]();};}function respondWithResult(_0x5de6fc,_0xf539a4){_0xf539a4=_0xf539a4||0xc8;return function(_0x4435f9){if(_0x4435f9){return _0x5de6fc[_0x6f4c('0x16')](_0xf539a4)[_0x6f4c('0x18')](_0x4435f9);}};}function respondWithFilteredResult(_0x4414c0,_0x42b25d){return function(_0x9ee1f){if(_0x9ee1f){var _0x2922b8=typeof _0x42b25d[_0x6f4c('0x19')]===_0x6f4c('0x1a')&&typeof _0x42b25d[_0x6f4c('0x1b')]===_0x6f4c('0x1a');var _0x1db2d4=_0x9ee1f['count'];var _0x3f118c=_0x2922b8?0x0:_0x42b25d[_0x6f4c('0x19')];var _0x9cb90c=_0x2922b8?_0x9ee1f[_0x6f4c('0x1c')]:_0x42b25d['offset']+_0x42b25d['limit'];var _0x4a061a;if(_0x9cb90c>=_0x1db2d4){_0x9cb90c=_0x1db2d4;_0x4a061a=0xc8;}else{_0x4a061a=0xce;}_0x4414c0[_0x6f4c('0x16')](_0x4a061a);return _0x4414c0[_0x6f4c('0x1d')]('Content-Range',_0x3f118c+'-'+_0x9cb90c+'/'+_0x1db2d4)['json'](_0x9ee1f);}return null;};}function patchUpdates(_0x315a91){return function(_0x336f28){try{jsonpatch['apply'](_0x336f28,_0x315a91,!![]);}catch(_0x20748f){return BPromise['reject'](_0x20748f);}return _0x336f28['save']();};}function saveUpdates(_0x467431,_0xf43266){return function(_0x2b40d1){if(_0x2b40d1){return _0x2b40d1[_0x6f4c('0x1e')](_0x467431)[_0x6f4c('0x1f')](function(_0x39c286){return _0x39c286;});}return null;};}function removeEntity(_0x45cea6,_0x1cdd7b){return function(_0x36955c){if(_0x36955c){return _0x36955c[_0x6f4c('0x20')]()[_0x6f4c('0x1f')](function(){_0x45cea6[_0x6f4c('0x16')](0xcc)[_0x6f4c('0x17')]();});}};}function handleEntityNotFound(_0x2c3cb,_0x277e4a){return function(_0x23c380){if(!_0x23c380){_0x2c3cb[_0x6f4c('0x15')](0x194);}return _0x23c380;};}function handleError(_0x387e31,_0x1b1c41){_0x1b1c41=_0x1b1c41||0x1f4;return function(_0x1be587){logger[_0x6f4c('0x21')](_0x1be587['stack']);if(_0x1be587['name']){delete _0x1be587[_0x6f4c('0x22')];}_0x387e31['status'](_0x1b1c41)[_0x6f4c('0x23')](_0x1be587);};}exports[_0x6f4c('0x24')]=function(_0x3b7979,_0x33dbb8){var _0x413f8f={},_0x4bc068={},_0x5b9dc4={'count':0x0,'rows':[]};var _0x35e254=_[_0x6f4c('0x25')](db[_0x6f4c('0x26')][_0x6f4c('0x27')],function(_0x195721){return{'name':_0x195721[_0x6f4c('0x28')],'type':_0x195721[_0x6f4c('0x29')][_0x6f4c('0x2a')]};});_0x4bc068[_0x6f4c('0x2b')]=_[_0x6f4c('0x25')](_0x35e254,_0x6f4c('0x22'));_0x4bc068[_0x6f4c('0x2c')]=_['keys'](_0x3b7979['query']);_0x4bc068[_0x6f4c('0x2d')]=_['intersection'](_0x4bc068[_0x6f4c('0x2b')],_0x4bc068[_0x6f4c('0x2c')]);_0x413f8f[_0x6f4c('0x2e')]=_['intersection'](_0x4bc068['model'],qs[_0x6f4c('0x2f')](_0x3b7979[_0x6f4c('0x2c')][_0x6f4c('0x2f')]));_0x413f8f['attributes']=_0x413f8f[_0x6f4c('0x2e')][_0x6f4c('0x30')]?_0x413f8f['attributes']:_0x4bc068[_0x6f4c('0x2b')];if(!_0x3b7979['query'][_0x6f4c('0x31')](_0x6f4c('0x32'))){_0x413f8f[_0x6f4c('0x1b')]=qs[_0x6f4c('0x1b')](_0x3b7979[_0x6f4c('0x2c')][_0x6f4c('0x1b')]);_0x413f8f['offset']=qs['offset'](_0x3b7979[_0x6f4c('0x2c')]['offset']);}_0x413f8f[_0x6f4c('0x33')]=qs['sort'](_0x3b7979[_0x6f4c('0x2c')][_0x6f4c('0x34')]);_0x413f8f[_0x6f4c('0x35')]=qs['filters'](_['pick'](_0x3b7979[_0x6f4c('0x2c')],_0x4bc068[_0x6f4c('0x2d')]),_0x35e254);if(_0x3b7979[_0x6f4c('0x2c')][_0x6f4c('0x36')]){_0x413f8f['where']=_['merge'](_0x413f8f[_0x6f4c('0x35')],{'$or':_[_0x6f4c('0x25')](_0x35e254,function(_0x135786){if(_0x135786['type']!=='VIRTUAL'){var _0x2f120c={};_0x2f120c[_0x135786[_0x6f4c('0x22')]]={'$like':'%'+_0x3b7979[_0x6f4c('0x2c')][_0x6f4c('0x36')]+'%'};return _0x2f120c;}})});}_0x413f8f=_[_0x6f4c('0x37')]({},_0x413f8f,_0x3b7979['options']);var _0xa0908e={'where':_0x413f8f['where']};return db[_0x6f4c('0x26')][_0x6f4c('0x1c')](_0xa0908e)['then'](function(_0xcceb16){_0x5b9dc4[_0x6f4c('0x1c')]=_0xcceb16;if(_0x3b7979[_0x6f4c('0x2c')]['includeAll']){_0x413f8f[_0x6f4c('0x38')]=[{'all':!![]}];}return db[_0x6f4c('0x26')]['findAll'](_0x413f8f);})[_0x6f4c('0x1f')](function(_0x5af96a){_0x5b9dc4[_0x6f4c('0x39')]=_0x5af96a;return _0x5b9dc4;})[_0x6f4c('0x1f')](respondWithFilteredResult(_0x33dbb8,_0x413f8f))[_0x6f4c('0x3a')](handleError(_0x33dbb8,null));};exports[_0x6f4c('0x3b')]=function(_0x2593b4,_0x484f4e){var _0x56c91e={'raw':![],'where':{'id':_0x2593b4[_0x6f4c('0x3c')]['id']}},_0x19842d={};_0x19842d['model']=_[_0x6f4c('0x3d')](db[_0x6f4c('0x26')][_0x6f4c('0x27')]);_0x19842d[_0x6f4c('0x2c')]=_[_0x6f4c('0x3d')](_0x2593b4['query']);_0x19842d[_0x6f4c('0x2d')]=_[_0x6f4c('0x3e')](_0x19842d[_0x6f4c('0x2b')],_0x19842d[_0x6f4c('0x2c')]);_0x56c91e[_0x6f4c('0x2e')]=_[_0x6f4c('0x3e')](_0x19842d['model'],qs[_0x6f4c('0x2f')](_0x2593b4['query']['fields']));_0x56c91e[_0x6f4c('0x2e')]=_0x56c91e['attributes'][_0x6f4c('0x30')]?_0x56c91e[_0x6f4c('0x2e')]:_0x19842d[_0x6f4c('0x2b')];if(_0x2593b4[_0x6f4c('0x2c')][_0x6f4c('0x3f')]){_0x56c91e[_0x6f4c('0x38')]=[{'all':!![]}];}_0x56c91e=_[_0x6f4c('0x37')]({},_0x56c91e,_0x2593b4[_0x6f4c('0x40')]);return db['ZohoConfiguration'][_0x6f4c('0x41')](_0x56c91e)[_0x6f4c('0x1f')](handleEntityNotFound(_0x484f4e,null))[_0x6f4c('0x1f')](respondWithResult(_0x484f4e,null))['catch'](handleError(_0x484f4e,null));};exports[_0x6f4c('0x42')]=function(_0x4735f6,_0x10b2ab){return db[_0x6f4c('0x26')][_0x6f4c('0x42')](_0x4735f6['body'],{})[_0x6f4c('0x1f')](respondWithResult(_0x10b2ab,0xc9))['catch'](handleError(_0x10b2ab,null));};exports[_0x6f4c('0x1e')]=function(_0x4cd3d9,_0x3dee9e){if(_0x4cd3d9[_0x6f4c('0x43')]['id']){delete _0x4cd3d9[_0x6f4c('0x43')]['id'];}return db['ZohoConfiguration'][_0x6f4c('0x41')]({'where':{'id':_0x4cd3d9['params']['id']}})[_0x6f4c('0x1f')](handleEntityNotFound(_0x3dee9e,null))[_0x6f4c('0x1f')](saveUpdates(_0x4cd3d9[_0x6f4c('0x43')],null))['then'](respondWithResult(_0x3dee9e,null))[_0x6f4c('0x3a')](handleError(_0x3dee9e,null));};exports[_0x6f4c('0x20')]=function(_0x100456,_0xfa8cce){return db[_0x6f4c('0x26')][_0x6f4c('0x41')]({'where':{'id':_0x100456['params']['id']}})[_0x6f4c('0x1f')](handleEntityNotFound(_0xfa8cce,null))['then'](removeEntity(_0xfa8cce,null))[_0x6f4c('0x3a')](handleError(_0xfa8cce,null));};exports[_0x6f4c('0x44')]=function(_0x2e92e8,_0x431487,_0x47528a){var _0x5268f9={};var _0x3cc616={};var _0xa256db;var _0x24c306;return db[_0x6f4c('0x26')]['findOne']({'where':{'id':_0x2e92e8[_0x6f4c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x431487,null))['then'](function(_0x4b2712){if(_0x4b2712){_0xa256db=_0x4b2712;_0x3cc616[_0x6f4c('0x2b')]=_[_0x6f4c('0x3d')](db[_0x6f4c('0x45')][_0x6f4c('0x27')]);_0x3cc616[_0x6f4c('0x2c')]=_['keys'](_0x2e92e8['query']);_0x3cc616[_0x6f4c('0x2d')]=_[_0x6f4c('0x3e')](_0x3cc616['model'],_0x3cc616[_0x6f4c('0x2c')]);_0x5268f9[_0x6f4c('0x2e')]=_[_0x6f4c('0x3e')](_0x3cc616[_0x6f4c('0x2b')],qs[_0x6f4c('0x2f')](_0x2e92e8[_0x6f4c('0x2c')][_0x6f4c('0x2f')]));_0x5268f9[_0x6f4c('0x2e')]=_0x5268f9[_0x6f4c('0x2e')][_0x6f4c('0x30')]?_0x5268f9[_0x6f4c('0x2e')]:_0x3cc616['model'];_0x5268f9[_0x6f4c('0x33')]=qs[_0x6f4c('0x34')](_0x2e92e8['query'][_0x6f4c('0x34')]);_0x5268f9[_0x6f4c('0x35')]=qs[_0x6f4c('0x2d')](_[_0x6f4c('0x46')](_0x2e92e8[_0x6f4c('0x2c')],_0x3cc616[_0x6f4c('0x2d')]));if(_0x2e92e8[_0x6f4c('0x2c')]['filter']){_0x5268f9[_0x6f4c('0x35')]=_[_0x6f4c('0x37')](_0x5268f9[_0x6f4c('0x35')],{'$or':_[_0x6f4c('0x25')](_0x5268f9[_0x6f4c('0x2e')],function(_0xd2504c){var _0x126e16={};_0x126e16[_0xd2504c]={'$like':'%'+_0x2e92e8[_0x6f4c('0x2c')][_0x6f4c('0x36')]+'%'};return _0x126e16;})});}_0x5268f9=_[_0x6f4c('0x37')]({},_0x5268f9,_0x2e92e8[_0x6f4c('0x40')]);return _0xa256db[_0x6f4c('0x44')](_0x5268f9);}})['then'](function(_0x25a8be){if(_0x25a8be){_0x24c306=_0x25a8be[_0x6f4c('0x30')];if(!_0x2e92e8[_0x6f4c('0x2c')][_0x6f4c('0x31')]('nolimit')){_0x5268f9[_0x6f4c('0x1b')]=qs[_0x6f4c('0x1b')](_0x2e92e8[_0x6f4c('0x2c')][_0x6f4c('0x1b')]);_0x5268f9[_0x6f4c('0x19')]=qs[_0x6f4c('0x19')](_0x2e92e8[_0x6f4c('0x2c')][_0x6f4c('0x19')]);}return _0xa256db[_0x6f4c('0x44')](_0x5268f9);}})['then'](function(_0x491447){if(_0x491447){return _0x491447?{'count':_0x24c306,'rows':_0x491447}:null;}})[_0x6f4c('0x1f')](respondWithResult(_0x431487,null))[_0x6f4c('0x3a')](handleError(_0x431487,null));};exports[_0x6f4c('0x47')]=function(_0x5889dd,_0x2f95bd,_0x5e6a3e){var _0x2cb9da={};var _0x20a4ca={};var _0x2c1b0b;var _0x538b24;return db[_0x6f4c('0x26')]['findOne']({'where':{'id':_0x5889dd[_0x6f4c('0x3c')]['id']}})[_0x6f4c('0x1f')](handleEntityNotFound(_0x2f95bd,null))[_0x6f4c('0x1f')](function(_0x1b0f07){if(_0x1b0f07){_0x2c1b0b=_0x1b0f07;_0x20a4ca[_0x6f4c('0x2b')]=_['keys'](db[_0x6f4c('0x45')]['rawAttributes']);_0x20a4ca[_0x6f4c('0x2c')]=_[_0x6f4c('0x3d')](_0x5889dd[_0x6f4c('0x2c')]);_0x20a4ca[_0x6f4c('0x2d')]=_[_0x6f4c('0x3e')](_0x20a4ca[_0x6f4c('0x2b')],_0x20a4ca[_0x6f4c('0x2c')]);_0x2cb9da['attributes']=_[_0x6f4c('0x3e')](_0x20a4ca[_0x6f4c('0x2b')],qs[_0x6f4c('0x2f')](_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x2f')]));_0x2cb9da['attributes']=_0x2cb9da[_0x6f4c('0x2e')][_0x6f4c('0x30')]?_0x2cb9da[_0x6f4c('0x2e')]:_0x20a4ca[_0x6f4c('0x2b')];_0x2cb9da['order']=qs[_0x6f4c('0x34')](_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x34')]);_0x2cb9da[_0x6f4c('0x35')]=qs['filters'](_[_0x6f4c('0x46')](_0x5889dd[_0x6f4c('0x2c')],_0x20a4ca[_0x6f4c('0x2d')]));if(_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x36')]){_0x2cb9da[_0x6f4c('0x35')]=_[_0x6f4c('0x37')](_0x2cb9da[_0x6f4c('0x35')],{'$or':_[_0x6f4c('0x25')](_0x2cb9da[_0x6f4c('0x2e')],function(_0x3058b6){var _0x569c28={};_0x569c28[_0x3058b6]={'$like':'%'+_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x36')]+'%'};return _0x569c28;})});}_0x2cb9da=_['merge']({},_0x2cb9da,_0x5889dd[_0x6f4c('0x40')]);return _0x2c1b0b['getSubjects'](_0x2cb9da);}})[_0x6f4c('0x1f')](function(_0x435b9d){if(_0x435b9d){_0x538b24=_0x435b9d['length'];if(!_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x31')]('nolimit')){_0x2cb9da[_0x6f4c('0x1b')]=qs[_0x6f4c('0x1b')](_0x5889dd['query']['limit']);_0x2cb9da[_0x6f4c('0x19')]=qs[_0x6f4c('0x19')](_0x5889dd[_0x6f4c('0x2c')][_0x6f4c('0x19')]);}return _0x2c1b0b[_0x6f4c('0x47')](_0x2cb9da);}})[_0x6f4c('0x1f')](function(_0x34dd4e){if(_0x34dd4e){return _0x34dd4e?{'count':_0x538b24,'rows':_0x34dd4e}:null;}})[_0x6f4c('0x1f')](respondWithResult(_0x2f95bd,null))['catch'](handleError(_0x2f95bd,null));};exports[_0x6f4c('0x48')]=function(_0x1a9486,_0x4e9543,_0x3a4951){var _0x470aad={};var _0x192948={};var _0x3e7c3e;var _0x18dbfd;return db[_0x6f4c('0x26')][_0x6f4c('0x49')]({'where':{'id':_0x1a9486[_0x6f4c('0x3c')]['id']}})[_0x6f4c('0x1f')](handleEntityNotFound(_0x4e9543,null))['then'](function(_0x182c97){if(_0x182c97){_0x3e7c3e=_0x182c97;_0x192948['model']=_[_0x6f4c('0x3d')](db[_0x6f4c('0x45')][_0x6f4c('0x27')]);_0x192948['query']=_[_0x6f4c('0x3d')](_0x1a9486[_0x6f4c('0x2c')]);_0x192948['filters']=_['intersection'](_0x192948['model'],_0x192948[_0x6f4c('0x2c')]);_0x470aad[_0x6f4c('0x2e')]=_[_0x6f4c('0x3e')](_0x192948['model'],qs[_0x6f4c('0x2f')](_0x1a9486['query']['fields']));_0x470aad['attributes']=_0x470aad['attributes']['length']?_0x470aad[_0x6f4c('0x2e')]:_0x192948['model'];_0x470aad[_0x6f4c('0x33')]=qs[_0x6f4c('0x34')](_0x1a9486[_0x6f4c('0x2c')][_0x6f4c('0x34')]);_0x470aad[_0x6f4c('0x35')]=qs[_0x6f4c('0x2d')](_['pick'](_0x1a9486['query'],_0x192948[_0x6f4c('0x2d')]));if(_0x1a9486[_0x6f4c('0x2c')][_0x6f4c('0x36')]){_0x470aad['where']=_[_0x6f4c('0x37')](_0x470aad[_0x6f4c('0x35')],{'$or':_[_0x6f4c('0x25')](_0x470aad[_0x6f4c('0x2e')],function(_0x354695){var _0x3889fe={};_0x3889fe[_0x354695]={'$like':'%'+_0x1a9486[_0x6f4c('0x2c')][_0x6f4c('0x36')]+'%'};return _0x3889fe;})});}_0x470aad=_[_0x6f4c('0x37')]({},_0x470aad,_0x1a9486[_0x6f4c('0x40')]);return _0x3e7c3e[_0x6f4c('0x48')](_0x470aad);}})[_0x6f4c('0x1f')](function(_0x2a6e08){if(_0x2a6e08){_0x18dbfd=_0x2a6e08['length'];if(!_0x1a9486[_0x6f4c('0x2c')][_0x6f4c('0x31')](_0x6f4c('0x32'))){_0x470aad[_0x6f4c('0x1b')]=qs[_0x6f4c('0x1b')](_0x1a9486['query'][_0x6f4c('0x1b')]);_0x470aad[_0x6f4c('0x19')]=qs[_0x6f4c('0x19')](_0x1a9486[_0x6f4c('0x2c')]['offset']);}return _0x3e7c3e[_0x6f4c('0x48')](_0x470aad);}})[_0x6f4c('0x1f')](function(_0x4be68f){if(_0x4be68f){return _0x4be68f?{'count':_0x18dbfd,'rows':_0x4be68f}:null;}})['then'](respondWithResult(_0x4e9543,null))['catch'](handleError(_0x4e9543,null));}; \ No newline at end of file +var _0x2980=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','ZohoField','options','nolimit','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment'];(function(_0x498dd2,_0x4fbc77){var _0x4d10a9=function(_0x44bcf4){while(--_0x44bcf4){_0x498dd2['push'](_0x498dd2['shift']());}};_0x4d10a9(++_0x4fbc77);}(_0x2980,0x92));var _0x0298=function(_0x28a152,_0x13a2c4){_0x28a152=_0x28a152-0x0;var _0x588b8a=_0x2980[_0x28a152];return _0x588b8a;};'use strict';var emlformat=require(_0x0298('0x0'));var rimraf=require(_0x0298('0x1'));var zipdir=require(_0x0298('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0298('0x3'));var BPromise=require(_0x0298('0x4'));var Mustache=require(_0x0298('0x5'));var util=require(_0x0298('0x6'));var path=require(_0x0298('0x7'));var sox=require(_0x0298('0x8'));var csv=require(_0x0298('0x9'));var ejs=require(_0x0298('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0298('0xb'));var squel=require(_0x0298('0xc'));var crypto=require('crypto');var jsforce=require(_0x0298('0xd'));var deskjs=require(_0x0298('0xe'));var toCsv=require(_0x0298('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0298('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0298('0x10'));var as=require(_0x0298('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0298('0x12'));var utils=require(_0x0298('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0298('0x14'));var db=require(_0x0298('0x15'))['db'];function respondWithStatusCode(_0x7dbf9e,_0x37c553){_0x37c553=_0x37c553||0xcc;return function(_0x18a5ce){if(_0x18a5ce){return _0x7dbf9e[_0x0298('0x16')](_0x37c553);}return _0x7dbf9e['status'](_0x37c553)[_0x0298('0x17')]();};}function respondWithResult(_0x2e7ce6,_0x1743bb){_0x1743bb=_0x1743bb||0xc8;return function(_0x2ca2e5){if(_0x2ca2e5){return _0x2e7ce6[_0x0298('0x18')](_0x1743bb)[_0x0298('0x19')](_0x2ca2e5);}};}function respondWithFilteredResult(_0x1d131f,_0x23bf2f){return function(_0x4a7880){if(_0x4a7880){var _0x38d33d=typeof _0x23bf2f[_0x0298('0x1a')]===_0x0298('0x1b')&&typeof _0x23bf2f['limit']===_0x0298('0x1b');var _0x2de62=_0x4a7880[_0x0298('0x1c')];var _0xd2610d=_0x38d33d?0x0:_0x23bf2f[_0x0298('0x1a')];var _0x32e91e=_0x38d33d?_0x4a7880['count']:_0x23bf2f[_0x0298('0x1a')]+_0x23bf2f[_0x0298('0x1d')];var _0x39356a;if(_0x32e91e>=_0x2de62){_0x32e91e=_0x2de62;_0x39356a=0xc8;}else{_0x39356a=0xce;}_0x1d131f[_0x0298('0x18')](_0x39356a);return _0x1d131f['set'](_0x0298('0x1e'),_0xd2610d+'-'+_0x32e91e+'/'+_0x2de62)['json'](_0x4a7880);}return null;};}function patchUpdates(_0x23bedc){return function(_0x1a45e4){try{jsonpatch[_0x0298('0x1f')](_0x1a45e4,_0x23bedc,!![]);}catch(_0x2a5bfa){return BPromise['reject'](_0x2a5bfa);}return _0x1a45e4['save']();};}function saveUpdates(_0x3f5a05,_0x4390fd){return function(_0x24ae1e){if(_0x24ae1e){return _0x24ae1e[_0x0298('0x20')](_0x3f5a05)[_0x0298('0x21')](function(_0x3b787e){return _0x3b787e;});}return null;};}function removeEntity(_0x3cf6c8,_0xc45d18){return function(_0x1fe0b1){if(_0x1fe0b1){return _0x1fe0b1['destroy']()[_0x0298('0x21')](function(){_0x3cf6c8[_0x0298('0x18')](0xcc)[_0x0298('0x17')]();});}};}function handleEntityNotFound(_0x15eadf,_0x55f5e7){return function(_0x2543f0){if(!_0x2543f0){_0x15eadf[_0x0298('0x16')](0x194);}return _0x2543f0;};}function handleError(_0x1c2dd9,_0x15cbfc){_0x15cbfc=_0x15cbfc||0x1f4;return function(_0x4f06c8){logger[_0x0298('0x22')](_0x4f06c8[_0x0298('0x23')]);if(_0x4f06c8[_0x0298('0x24')]){delete _0x4f06c8['name'];}_0x1c2dd9['status'](_0x15cbfc)[_0x0298('0x25')](_0x4f06c8);};}exports[_0x0298('0x26')]=function(_0xf6dff9,_0x2a6dd1){var _0x542a1c={},_0x122309={},_0x276ee8={'count':0x0,'rows':[]};var _0x1ac11c=_[_0x0298('0x27')](db[_0x0298('0x28')][_0x0298('0x29')],function(_0x323ff4){return{'name':_0x323ff4['fieldName'],'type':_0x323ff4['type']['key']};});_0x122309[_0x0298('0x2a')]=_[_0x0298('0x27')](_0x1ac11c,_0x0298('0x24'));_0x122309['query']=_[_0x0298('0x2b')](_0xf6dff9[_0x0298('0x2c')]);_0x122309[_0x0298('0x2d')]=_[_0x0298('0x2e')](_0x122309[_0x0298('0x2a')],_0x122309[_0x0298('0x2c')]);_0x542a1c[_0x0298('0x2f')]=_[_0x0298('0x2e')](_0x122309[_0x0298('0x2a')],qs[_0x0298('0x30')](_0xf6dff9[_0x0298('0x2c')]['fields']));_0x542a1c[_0x0298('0x2f')]=_0x542a1c['attributes'][_0x0298('0x31')]?_0x542a1c[_0x0298('0x2f')]:_0x122309['model'];if(!_0xf6dff9[_0x0298('0x2c')][_0x0298('0x32')]('nolimit')){_0x542a1c[_0x0298('0x1d')]=qs[_0x0298('0x1d')](_0xf6dff9[_0x0298('0x2c')]['limit']);_0x542a1c['offset']=qs['offset'](_0xf6dff9[_0x0298('0x2c')][_0x0298('0x1a')]);}_0x542a1c[_0x0298('0x33')]=qs[_0x0298('0x34')](_0xf6dff9['query']['sort']);_0x542a1c[_0x0298('0x35')]=qs[_0x0298('0x2d')](_[_0x0298('0x36')](_0xf6dff9[_0x0298('0x2c')],_0x122309[_0x0298('0x2d')]),_0x1ac11c);if(_0xf6dff9[_0x0298('0x2c')][_0x0298('0x37')]){_0x542a1c[_0x0298('0x35')]=_[_0x0298('0x38')](_0x542a1c[_0x0298('0x35')],{'$or':_[_0x0298('0x27')](_0x1ac11c,function(_0x1cadeb){if(_0x1cadeb['type']!==_0x0298('0x39')){var _0x4e2211={};_0x4e2211[_0x1cadeb[_0x0298('0x24')]]={'$like':'%'+_0xf6dff9['query']['filter']+'%'};return _0x4e2211;}})});}_0x542a1c=_[_0x0298('0x38')]({},_0x542a1c,_0xf6dff9['options']);var _0x2f1148={'where':_0x542a1c[_0x0298('0x35')]};return db[_0x0298('0x28')][_0x0298('0x1c')](_0x2f1148)[_0x0298('0x21')](function(_0x518e81){_0x276ee8[_0x0298('0x1c')]=_0x518e81;if(_0xf6dff9[_0x0298('0x2c')][_0x0298('0x3a')]){_0x542a1c[_0x0298('0x3b')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x0298('0x3c')](_0x542a1c);})[_0x0298('0x21')](function(_0x690b2b){_0x276ee8[_0x0298('0x3d')]=_0x690b2b;return _0x276ee8;})[_0x0298('0x21')](respondWithFilteredResult(_0x2a6dd1,_0x542a1c))['catch'](handleError(_0x2a6dd1,null));};exports[_0x0298('0x3e')]=function(_0x15b723,_0x1c0535){var _0x5634a9={'raw':![],'where':{'id':_0x15b723[_0x0298('0x3f')]['id']}},_0xdd2519={};_0xdd2519[_0x0298('0x2a')]=_[_0x0298('0x2b')](db[_0x0298('0x28')][_0x0298('0x29')]);_0xdd2519[_0x0298('0x2c')]=_[_0x0298('0x2b')](_0x15b723['query']);_0xdd2519[_0x0298('0x2d')]=_['intersection'](_0xdd2519[_0x0298('0x2a')],_0xdd2519[_0x0298('0x2c')]);_0x5634a9[_0x0298('0x2f')]=_[_0x0298('0x2e')](_0xdd2519[_0x0298('0x2a')],qs[_0x0298('0x30')](_0x15b723[_0x0298('0x2c')][_0x0298('0x30')]));_0x5634a9[_0x0298('0x2f')]=_0x5634a9['attributes'][_0x0298('0x31')]?_0x5634a9[_0x0298('0x2f')]:_0xdd2519[_0x0298('0x2a')];if(_0x15b723[_0x0298('0x2c')][_0x0298('0x3a')]){_0x5634a9[_0x0298('0x3b')]=[{'all':!![]}];}_0x5634a9=_[_0x0298('0x38')]({},_0x5634a9,_0x15b723['options']);return db[_0x0298('0x28')][_0x0298('0x40')](_0x5634a9)[_0x0298('0x21')](handleEntityNotFound(_0x1c0535,null))[_0x0298('0x21')](respondWithResult(_0x1c0535,null))[_0x0298('0x41')](handleError(_0x1c0535,null));};exports[_0x0298('0x42')]=function(_0x4fb9d4,_0x254ab3){return db[_0x0298('0x28')][_0x0298('0x42')](_0x4fb9d4[_0x0298('0x43')],{})[_0x0298('0x21')](respondWithResult(_0x254ab3,0xc9))[_0x0298('0x41')](handleError(_0x254ab3,null));};exports[_0x0298('0x20')]=function(_0x3d28cc,_0x201b03){if(_0x3d28cc[_0x0298('0x43')]['id']){delete _0x3d28cc[_0x0298('0x43')]['id'];}return db[_0x0298('0x28')]['find']({'where':{'id':_0x3d28cc['params']['id']}})[_0x0298('0x21')](handleEntityNotFound(_0x201b03,null))[_0x0298('0x21')](saveUpdates(_0x3d28cc[_0x0298('0x43')],null))[_0x0298('0x21')](respondWithResult(_0x201b03,null))[_0x0298('0x41')](handleError(_0x201b03,null));};exports['destroy']=function(_0xb7003d,_0x1dccb4){return db[_0x0298('0x28')]['find']({'where':{'id':_0xb7003d[_0x0298('0x3f')]['id']}})[_0x0298('0x21')](handleEntityNotFound(_0x1dccb4,null))['then'](removeEntity(_0x1dccb4,null))[_0x0298('0x41')](handleError(_0x1dccb4,null));};exports['getFields']=function(_0x45143d,_0x358d90,_0x58a7d2){var _0x2cc11d={};var _0x498fce={};var _0x492ee8;var _0x289b53;return db[_0x0298('0x28')][_0x0298('0x44')]({'where':{'id':_0x45143d[_0x0298('0x3f')]['id']}})[_0x0298('0x21')](handleEntityNotFound(_0x358d90,null))[_0x0298('0x21')](function(_0x468bdd){if(_0x468bdd){_0x492ee8=_0x468bdd;_0x498fce['model']=_[_0x0298('0x2b')](db[_0x0298('0x45')]['rawAttributes']);_0x498fce[_0x0298('0x2c')]=_['keys'](_0x45143d[_0x0298('0x2c')]);_0x498fce[_0x0298('0x2d')]=_['intersection'](_0x498fce[_0x0298('0x2a')],_0x498fce[_0x0298('0x2c')]);_0x2cc11d[_0x0298('0x2f')]=_[_0x0298('0x2e')](_0x498fce[_0x0298('0x2a')],qs['fields'](_0x45143d['query'][_0x0298('0x30')]));_0x2cc11d[_0x0298('0x2f')]=_0x2cc11d[_0x0298('0x2f')]['length']?_0x2cc11d[_0x0298('0x2f')]:_0x498fce['model'];_0x2cc11d['order']=qs[_0x0298('0x34')](_0x45143d[_0x0298('0x2c')][_0x0298('0x34')]);_0x2cc11d[_0x0298('0x35')]=qs[_0x0298('0x2d')](_[_0x0298('0x36')](_0x45143d[_0x0298('0x2c')],_0x498fce['filters']));if(_0x45143d['query'][_0x0298('0x37')]){_0x2cc11d['where']=_[_0x0298('0x38')](_0x2cc11d[_0x0298('0x35')],{'$or':_[_0x0298('0x27')](_0x2cc11d[_0x0298('0x2f')],function(_0x4dd173){var _0x21b8ae={};_0x21b8ae[_0x4dd173]={'$like':'%'+_0x45143d['query'][_0x0298('0x37')]+'%'};return _0x21b8ae;})});}_0x2cc11d=_[_0x0298('0x38')]({},_0x2cc11d,_0x45143d[_0x0298('0x46')]);return _0x492ee8['getFields'](_0x2cc11d);}})[_0x0298('0x21')](function(_0x11bb1){if(_0x11bb1){_0x289b53=_0x11bb1['length'];if(!_0x45143d[_0x0298('0x2c')]['hasOwnProperty'](_0x0298('0x47'))){_0x2cc11d[_0x0298('0x1d')]=qs[_0x0298('0x1d')](_0x45143d[_0x0298('0x2c')][_0x0298('0x1d')]);_0x2cc11d[_0x0298('0x1a')]=qs[_0x0298('0x1a')](_0x45143d[_0x0298('0x2c')][_0x0298('0x1a')]);}return _0x492ee8[_0x0298('0x48')](_0x2cc11d);}})[_0x0298('0x21')](function(_0x49f1c9){if(_0x49f1c9){return _0x49f1c9?{'count':_0x289b53,'rows':_0x49f1c9}:null;}})[_0x0298('0x21')](respondWithResult(_0x358d90,null))[_0x0298('0x41')](handleError(_0x358d90,null));};exports[_0x0298('0x49')]=function(_0x16b66f,_0x2ad022,_0x4aa8dc){var _0x48a2da={};var _0x3a1323={};var _0x5bd34a;var _0x4b56da;return db[_0x0298('0x28')][_0x0298('0x44')]({'where':{'id':_0x16b66f[_0x0298('0x3f')]['id']}})[_0x0298('0x21')](handleEntityNotFound(_0x2ad022,null))[_0x0298('0x21')](function(_0x859a54){if(_0x859a54){_0x5bd34a=_0x859a54;_0x3a1323[_0x0298('0x2a')]=_[_0x0298('0x2b')](db[_0x0298('0x45')][_0x0298('0x29')]);_0x3a1323[_0x0298('0x2c')]=_[_0x0298('0x2b')](_0x16b66f[_0x0298('0x2c')]);_0x3a1323['filters']=_[_0x0298('0x2e')](_0x3a1323[_0x0298('0x2a')],_0x3a1323[_0x0298('0x2c')]);_0x48a2da[_0x0298('0x2f')]=_[_0x0298('0x2e')](_0x3a1323[_0x0298('0x2a')],qs[_0x0298('0x30')](_0x16b66f[_0x0298('0x2c')][_0x0298('0x30')]));_0x48a2da[_0x0298('0x2f')]=_0x48a2da[_0x0298('0x2f')][_0x0298('0x31')]?_0x48a2da['attributes']:_0x3a1323[_0x0298('0x2a')];_0x48a2da[_0x0298('0x33')]=qs[_0x0298('0x34')](_0x16b66f['query'][_0x0298('0x34')]);_0x48a2da['where']=qs['filters'](_[_0x0298('0x36')](_0x16b66f[_0x0298('0x2c')],_0x3a1323[_0x0298('0x2d')]));if(_0x16b66f[_0x0298('0x2c')]['filter']){_0x48a2da[_0x0298('0x35')]=_[_0x0298('0x38')](_0x48a2da[_0x0298('0x35')],{'$or':_[_0x0298('0x27')](_0x48a2da[_0x0298('0x2f')],function(_0x4bf886){var _0x5b86dd={};_0x5b86dd[_0x4bf886]={'$like':'%'+_0x16b66f[_0x0298('0x2c')][_0x0298('0x37')]+'%'};return _0x5b86dd;})});}_0x48a2da=_[_0x0298('0x38')]({},_0x48a2da,_0x16b66f[_0x0298('0x46')]);return _0x5bd34a[_0x0298('0x49')](_0x48a2da);}})[_0x0298('0x21')](function(_0xe87030){if(_0xe87030){_0x4b56da=_0xe87030['length'];if(!_0x16b66f['query'][_0x0298('0x32')](_0x0298('0x47'))){_0x48a2da[_0x0298('0x1d')]=qs[_0x0298('0x1d')](_0x16b66f[_0x0298('0x2c')]['limit']);_0x48a2da[_0x0298('0x1a')]=qs[_0x0298('0x1a')](_0x16b66f[_0x0298('0x2c')][_0x0298('0x1a')]);}return _0x5bd34a[_0x0298('0x49')](_0x48a2da);}})[_0x0298('0x21')](function(_0xf6f049){if(_0xf6f049){return _0xf6f049?{'count':_0x4b56da,'rows':_0xf6f049}:null;}})['then'](respondWithResult(_0x2ad022,null))['catch'](handleError(_0x2ad022,null));};exports[_0x0298('0x4a')]=function(_0x34541a,_0x542daf,_0x38cfd8){var _0x1bf289={};var _0x1a19d3={};var _0x2c1179;var _0x14a12d;return db[_0x0298('0x28')][_0x0298('0x44')]({'where':{'id':_0x34541a[_0x0298('0x3f')]['id']}})['then'](handleEntityNotFound(_0x542daf,null))['then'](function(_0x4eaca0){if(_0x4eaca0){_0x2c1179=_0x4eaca0;_0x1a19d3[_0x0298('0x2a')]=_[_0x0298('0x2b')](db[_0x0298('0x45')][_0x0298('0x29')]);_0x1a19d3[_0x0298('0x2c')]=_[_0x0298('0x2b')](_0x34541a[_0x0298('0x2c')]);_0x1a19d3[_0x0298('0x2d')]=_[_0x0298('0x2e')](_0x1a19d3['model'],_0x1a19d3['query']);_0x1bf289[_0x0298('0x2f')]=_[_0x0298('0x2e')](_0x1a19d3['model'],qs[_0x0298('0x30')](_0x34541a[_0x0298('0x2c')][_0x0298('0x30')]));_0x1bf289[_0x0298('0x2f')]=_0x1bf289[_0x0298('0x2f')]['length']?_0x1bf289[_0x0298('0x2f')]:_0x1a19d3[_0x0298('0x2a')];_0x1bf289[_0x0298('0x33')]=qs[_0x0298('0x34')](_0x34541a[_0x0298('0x2c')][_0x0298('0x34')]);_0x1bf289['where']=qs[_0x0298('0x2d')](_[_0x0298('0x36')](_0x34541a['query'],_0x1a19d3[_0x0298('0x2d')]));if(_0x34541a['query'][_0x0298('0x37')]){_0x1bf289[_0x0298('0x35')]=_[_0x0298('0x38')](_0x1bf289['where'],{'$or':_[_0x0298('0x27')](_0x1bf289[_0x0298('0x2f')],function(_0x177536){var _0x19bdb7={};_0x19bdb7[_0x177536]={'$like':'%'+_0x34541a[_0x0298('0x2c')][_0x0298('0x37')]+'%'};return _0x19bdb7;})});}_0x1bf289=_[_0x0298('0x38')]({},_0x1bf289,_0x34541a[_0x0298('0x46')]);return _0x2c1179['getDescriptions'](_0x1bf289);}})[_0x0298('0x21')](function(_0x422436){if(_0x422436){_0x14a12d=_0x422436[_0x0298('0x31')];if(!_0x34541a[_0x0298('0x2c')][_0x0298('0x32')](_0x0298('0x47'))){_0x1bf289[_0x0298('0x1d')]=qs[_0x0298('0x1d')](_0x34541a[_0x0298('0x2c')][_0x0298('0x1d')]);_0x1bf289[_0x0298('0x1a')]=qs['offset'](_0x34541a['query'][_0x0298('0x1a')]);}return _0x2c1179[_0x0298('0x4a')](_0x1bf289);}})['then'](function(_0x2e96e5){if(_0x2e96e5){return _0x2e96e5?{'count':_0x14a12d,'rows':_0x2e96e5}:null;}})[_0x0298('0x21')](respondWithResult(_0x542daf,null))[_0x0298('0x41')](handleError(_0x542daf,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d1426a9..4955653 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 _0xd03f=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd03f,0x121));var _0xfd03=function(_0x437f7e,_0x1fe12d){_0x437f7e=_0x437f7e-0x0;var _0x73d594=_0xd03f[_0x437f7e];return _0x73d594;};'use strict';var _=require('lodash');var util=require(_0xfd03('0x0'));var logger=require(_0xfd03('0x1'))(_0xfd03('0x2'));var moment=require(_0xfd03('0x3'));var BPromise=require(_0xfd03('0x4'));var rp=require(_0xfd03('0x5'));var fs=require('fs');var path=require(_0xfd03('0x6'));var rimraf=require(_0xfd03('0x7'));var config=require(_0xfd03('0x8'));var attributes=require(_0xfd03('0x9'));module[_0xfd03('0xa')]=function(_0x4e00e2,_0x3ea103){return _0x4e00e2[_0xfd03('0xb')](_0xfd03('0xc'),attributes,{'tableName':_0xfd03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d34=['../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d34,0x94));var _0x49d3=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x9d34[_0xea46d];return _0x1fa4c5;};'use strict';var _=require(_0x49d3('0x0'));var util=require(_0x49d3('0x1'));var logger=require(_0x49d3('0x2'))(_0x49d3('0x3'));var moment=require(_0x49d3('0x4'));var BPromise=require(_0x49d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49d3('0x6'));var rimraf=require(_0x49d3('0x7'));var config=require(_0x49d3('0x8'));var attributes=require(_0x49d3('0x9'));module[_0x49d3('0xa')]=function(_0x7b903e,_0x5115ea){return _0x7b903e[_0x49d3('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x49d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f836d63..e059157 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 _0x1739=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x230c02,_0x281b7f){var _0xb42c47=function(_0xa468bc){while(--_0xa468bc){_0x230c02['push'](_0x230c02['shift']());}};_0xb42c47(++_0x281b7f);}(_0x1739,0xf4));var _0x9173=function(_0x4df3c0,_0x22037a){_0x4df3c0=_0x4df3c0-0x0;var _0x1b88ca=_0x1739[_0x4df3c0];return _0x1b88ca;};'use strict';var _=require(_0x9173('0x0'));var util=require(_0x9173('0x1'));var moment=require(_0x9173('0x2'));var BPromise=require(_0x9173('0x3'));var rs=require(_0x9173('0x4'));var fs=require('fs');var Redis=require(_0x9173('0x5'));var db=require(_0x9173('0x6'))['db'];var utils=require(_0x9173('0x7'));var logger=require(_0x9173('0x8'))(_0x9173('0x9'));var config=require('../../config/environment');var jayson=require(_0x9173('0xa'));var client=jayson[_0x9173('0xb')][_0x9173('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ab781,_0x38e123,_0x4b9309){return new BPromise(function(_0x31a941,_0x5425ef){return client[_0x9173('0xd')](_0x4ab781,_0x4b9309)[_0x9173('0xe')](function(_0x5445da){logger[_0x9173('0xf')](_0x9173('0x10'),_0x38e123,_0x9173('0x11'));logger['debug'](_0x9173('0x12'),_0x38e123,_0x9173('0x11'),JSON[_0x9173('0x13')](_0x5445da));if(_0x5445da[_0x9173('0x14')]){if(_0x5445da['error'][_0x9173('0x15')]===0x1f4){logger[_0x9173('0x14')](_0x9173('0x10'),_0x38e123,_0x5445da[_0x9173('0x14')][_0x9173('0x16')]);return _0x5425ef(_0x5445da['error'][_0x9173('0x16')]);}logger[_0x9173('0x14')](_0x9173('0x10'),_0x38e123,_0x5445da['error'][_0x9173('0x16')]);return _0x31a941(_0x5445da[_0x9173('0x14')][_0x9173('0x16')]);}else{logger[_0x9173('0xf')](_0x9173('0x10'),_0x38e123,_0x9173('0x11'));_0x31a941(_0x5445da[_0x9173('0x17')]['message']);}})['catch'](function(_0x36bfd9){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x38e123,_0x36bfd9);_0x5425ef(_0x36bfd9);});});} \ No newline at end of file +var _0xe047=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe047,0x14f));var _0x7e04=function(_0x2f163c,_0x27bd79){_0x2f163c=_0x2f163c-0x0;var _0x3dd996=_0xe047[_0x2f163c];return _0x3dd996;};'use strict';var _=require(_0x7e04('0x0'));var util=require(_0x7e04('0x1'));var moment=require(_0x7e04('0x2'));var BPromise=require(_0x7e04('0x3'));var rs=require(_0x7e04('0x4'));var fs=require('fs');var Redis=require(_0x7e04('0x5'));var db=require(_0x7e04('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e04('0x7'));var config=require(_0x7e04('0x8'));var jayson=require(_0x7e04('0x9'));var client=jayson[_0x7e04('0xa')][_0x7e04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ef512,_0x19f113,_0x28b98d){return new BPromise(function(_0x17e402,_0x5b0260){return client[_0x7e04('0xc')](_0x1ef512,_0x28b98d)[_0x7e04('0xd')](function(_0x1f0893){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x19f113,_0x7e04('0xe'));logger[_0x7e04('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x19f113,_0x7e04('0xe'),JSON[_0x7e04('0x10')](_0x1f0893));if(_0x1f0893['error']){if(_0x1f0893['error'][_0x7e04('0x11')]===0x1f4){logger[_0x7e04('0x12')](_0x7e04('0x13'),_0x19f113,_0x1f0893[_0x7e04('0x12')]['message']);return _0x5b0260(_0x1f0893[_0x7e04('0x12')][_0x7e04('0x14')]);}logger[_0x7e04('0x12')](_0x7e04('0x13'),_0x19f113,_0x1f0893[_0x7e04('0x12')][_0x7e04('0x14')]);return _0x17e402(_0x1f0893[_0x7e04('0x12')][_0x7e04('0x14')]);}else{logger[_0x7e04('0x15')](_0x7e04('0x13'),_0x19f113,_0x7e04('0xe'));_0x17e402(_0x1f0893[_0x7e04('0x16')][_0x7e04('0x14')]);}})[_0x7e04('0x17')](function(_0x50fee8){logger[_0x7e04('0x12')](_0x7e04('0x13'),_0x19f113,_0x50fee8);_0x5b0260(_0x50fee8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4cc1c27..355741a 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 _0x5698=['isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32d447,_0x55d609){var _0x20bf69=function(_0x44f393){while(--_0x44f393){_0x32d447['push'](_0x32d447['shift']());}};_0x20bf69(++_0x55d609);}(_0x5698,0xbd));var _0x8569=function(_0x4cb408,_0x2054c9){_0x4cb408=_0x4cb408-0x0;var _0x28fc52=_0x5698[_0x4cb408];return _0x28fc52;};'use strict';var multer=require(_0x8569('0x0'));var util=require(_0x8569('0x1'));var path=require(_0x8569('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8569('0x3'));var auth=require(_0x8569('0x4'));var interaction=require(_0x8569('0x5'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x8569('0x6')](),controller[_0x8569('0x7')]);router['post']('/',auth[_0x8569('0x6')](),controller[_0x8569('0x8')]);router[_0x8569('0x9')](_0x8569('0xa'),auth[_0x8569('0x6')](),controller[_0x8569('0xb')]);router[_0x8569('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8569('0xd')]);module[_0x8569('0xe')]=router; \ No newline at end of file +var _0xba5f=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x519228,_0x2bcbc2){var _0xc3c605=function(_0x4d3811){while(--_0x4d3811){_0x519228['push'](_0x519228['shift']());}};_0xc3c605(++_0x2bcbc2);}(_0xba5f,0x1f4));var _0xfba5=function(_0x13acf5,_0x966fb5){_0x13acf5=_0x13acf5-0x0;var _0x352d2b=_0xba5f[_0x13acf5];return _0x352d2b;};'use strict';var multer=require(_0xfba5('0x0'));var util=require('util');var path=require(_0xfba5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfba5('0x2'));var router=express['Router']();var fs_extra=require(_0xfba5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfba5('0x4'));var config=require(_0xfba5('0x5'));var controller=require(_0xfba5('0x6'));router[_0xfba5('0x7')]('/',auth[_0xfba5('0x8')](),controller[_0xfba5('0x9')]);router[_0xfba5('0x7')](_0xfba5('0xa'),auth[_0xfba5('0x8')](),controller[_0xfba5('0xb')]);router[_0xfba5('0xc')]('/',auth[_0xfba5('0x8')](),controller[_0xfba5('0xd')]);router['put'](_0xfba5('0xa'),auth[_0xfba5('0x8')](),controller[_0xfba5('0xe')]);router[_0xfba5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfba5('0x10')]);module[_0xfba5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5e79daf..c78b8bc 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 _0x443c=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x443c,0x142));var _0xc443=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x443c[_0x36fe46];return _0x4d2e9c;};'use strict';var Sequelize=require(_0xc443('0x0'));module[_0xc443('0x1')]={'type':{'type':Sequelize[_0xc443('0x2')](_0xc443('0x3'),'variable',_0xc443('0x4'),'keyValue',_0xc443('0x5')),'defaultValue':_0xc443('0x3')},'content':{'type':Sequelize[_0xc443('0x6')]},'key':{'type':Sequelize[_0xc443('0x6')]},'keyType':{'type':Sequelize[_0xc443('0x2')](_0xc443('0x3'),_0xc443('0x7'),_0xc443('0x4'))},'keyContent':{'type':Sequelize[_0xc443('0x6')]},'idField':{'type':Sequelize[_0xc443('0x6')]},'nameField':{'type':Sequelize[_0xc443('0x6')]},'customField':{'type':Sequelize[_0xc443('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc443('0x6')]}}; \ No newline at end of file +var _0x0618=['ENUM','customVariable','STRING','BOOLEAN','sequelize','exports','variable','keyValue','picklist','string'];(function(_0x362e85,_0x3547b7){var _0xba4543=function(_0x1fc559){while(--_0x1fc559){_0x362e85['push'](_0x362e85['shift']());}};_0xba4543(++_0x3547b7);}(_0x0618,0xa4));var _0x8061=function(_0x169732,_0x43e683){_0x169732=_0x169732-0x0;var _0x43bb67=_0x0618[_0x169732];return _0x43bb67;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8061('0x2'),'customVariable',_0x8061('0x3'),_0x8061('0x4')),'defaultValue':_0x8061('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8061('0x6')](_0x8061('0x5'),_0x8061('0x2'),_0x8061('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8061('0x8')]},'nameField':{'type':Sequelize[_0x8061('0x8')]},'customField':{'type':Sequelize[_0x8061('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8061('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4452f12..806bdf3 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 _0x685b=['ZohoField','rawAttributes','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','json','apply','save','then','end','sendStatus','error','stack','index'];(function(_0xba862b,_0xc5adfd){var _0x9ecf0c=function(_0x279950){while(--_0x279950){_0xba862b['push'](_0xba862b['shift']());}};_0x9ecf0c(++_0xc5adfd);}(_0x685b,0x199));var _0xb685=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0x685b[_0x12a57d];return _0x4b26f6;};'use strict';var emlformat=require(_0xb685('0x0'));var rimraf=require(_0xb685('0x1'));var zipdir=require(_0xb685('0x2'));var jsonpatch=require(_0xb685('0x3'));var rp=require(_0xb685('0x4'));var moment=require(_0xb685('0x5'));var BPromise=require(_0xb685('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb685('0x7'));var sox=require(_0xb685('0x8'));var csv=require(_0xb685('0x9'));var ejs=require(_0xb685('0xa'));var fs=require('fs');var fs_extra=require(_0xb685('0xb'));var _=require(_0xb685('0xc'));var squel=require(_0xb685('0xd'));var crypto=require(_0xb685('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb685('0xf'));var toCsv=require(_0xb685('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb685('0x10'));var authService=require(_0xb685('0x11'));var qs=require(_0xb685('0x12'));var as=require(_0xb685('0x13'));var hardwareService=require(_0xb685('0x14'));var logger=require(_0xb685('0x15'))('api');var utils=require(_0xb685('0x16'));var config=require(_0xb685('0x17'));var licenseUtil=require(_0xb685('0x18'));var db=require(_0xb685('0x19'))['db'];function respondWithStatusCode(_0x25a06e,_0x5d4255){_0x5d4255=_0x5d4255||0xcc;return function(_0x35a41e){if(_0x35a41e){return _0x25a06e['sendStatus'](_0x5d4255);}return _0x25a06e[_0xb685('0x1a')](_0x5d4255)['end']();};}function respondWithResult(_0x37400a,_0xfac243){_0xfac243=_0xfac243||0xc8;return function(_0x2a7557){if(_0x2a7557){return _0x37400a[_0xb685('0x1a')](_0xfac243)['json'](_0x2a7557);}};}function respondWithFilteredResult(_0x217c06,_0x5dfa46){return function(_0x2aa19e){if(_0x2aa19e){var _0x1bd88b=typeof _0x5dfa46[_0xb685('0x1b')]==='undefined'&&typeof _0x5dfa46['limit']==='undefined';var _0x24028d=_0x2aa19e[_0xb685('0x1c')];var _0x23f701=_0x1bd88b?0x0:_0x5dfa46['offset'];var _0x111066=_0x1bd88b?_0x2aa19e[_0xb685('0x1c')]:_0x5dfa46[_0xb685('0x1b')]+_0x5dfa46[_0xb685('0x1d')];var _0x2587bc;if(_0x111066>=_0x24028d){_0x111066=_0x24028d;_0x2587bc=0xc8;}else{_0x2587bc=0xce;}_0x217c06[_0xb685('0x1a')](_0x2587bc);return _0x217c06[_0xb685('0x1e')](_0xb685('0x1f'),_0x23f701+'-'+_0x111066+'/'+_0x24028d)[_0xb685('0x20')](_0x2aa19e);}return null;};}function patchUpdates(_0x16032e){return function(_0x1e466f){try{jsonpatch[_0xb685('0x21')](_0x1e466f,_0x16032e,!![]);}catch(_0x394c84){return BPromise['reject'](_0x394c84);}return _0x1e466f[_0xb685('0x22')]();};}function saveUpdates(_0x13f3fc,_0x55e39e){return function(_0xcce887){if(_0xcce887){return _0xcce887['update'](_0x13f3fc)[_0xb685('0x23')](function(_0x24b78b){return _0x24b78b;});}return null;};}function removeEntity(_0x527847,_0x433bb3){return function(_0x5f1532){if(_0x5f1532){return _0x5f1532['destroy']()['then'](function(){_0x527847[_0xb685('0x1a')](0xcc)[_0xb685('0x24')]();});}};}function handleEntityNotFound(_0x42983b,_0x170798){return function(_0x39b1ac){if(!_0x39b1ac){_0x42983b[_0xb685('0x25')](0x194);}return _0x39b1ac;};}function handleError(_0x8f8da3,_0x2ea329){_0x2ea329=_0x2ea329||0x1f4;return function(_0x2ade94){logger[_0xb685('0x26')](_0x2ade94[_0xb685('0x27')]);if(_0x2ade94['name']){delete _0x2ade94['name'];}_0x8f8da3[_0xb685('0x1a')](_0x2ea329)['send'](_0x2ade94);};}exports[_0xb685('0x28')]=function(_0x42e6eb,_0x52b321){var _0x20dce7={},_0x13c91e={},_0x3af7c5={'count':0x0,'rows':[]};var _0x31cb04=_['map'](db[_0xb685('0x29')][_0xb685('0x2a')],function(_0x1747d5){return{'name':_0x1747d5['fieldName'],'type':_0x1747d5['type'][_0xb685('0x2b')]};});_0x13c91e['model']=_[_0xb685('0x2c')](_0x31cb04,_0xb685('0x2d'));_0x13c91e[_0xb685('0x2e')]=_[_0xb685('0x2f')](_0x42e6eb[_0xb685('0x2e')]);_0x13c91e[_0xb685('0x30')]=_[_0xb685('0x31')](_0x13c91e[_0xb685('0x32')],_0x13c91e['query']);_0x20dce7[_0xb685('0x33')]=_[_0xb685('0x31')](_0x13c91e[_0xb685('0x32')],qs[_0xb685('0x34')](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x34')]));_0x20dce7[_0xb685('0x33')]=_0x20dce7['attributes'][_0xb685('0x35')]?_0x20dce7[_0xb685('0x33')]:_0x13c91e[_0xb685('0x32')];if(!_0x42e6eb['query'][_0xb685('0x36')](_0xb685('0x37'))){_0x20dce7['limit']=qs['limit'](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x1d')]);_0x20dce7['offset']=qs['offset'](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x1b')]);}_0x20dce7[_0xb685('0x38')]=qs[_0xb685('0x39')](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x39')]);_0x20dce7[_0xb685('0x3a')]=qs[_0xb685('0x30')](_['pick'](_0x42e6eb[_0xb685('0x2e')],_0x13c91e[_0xb685('0x30')]),_0x31cb04);if(_0x42e6eb[_0xb685('0x2e')][_0xb685('0x3b')]){_0x20dce7[_0xb685('0x3a')]=_[_0xb685('0x3c')](_0x20dce7[_0xb685('0x3a')],{'$or':_[_0xb685('0x2c')](_0x31cb04,function(_0x2bd0fc){if(_0x2bd0fc[_0xb685('0x3d')]!==_0xb685('0x3e')){var _0x34fbfc={};_0x34fbfc[_0x2bd0fc['name']]={'$like':'%'+_0x42e6eb[_0xb685('0x2e')][_0xb685('0x3b')]+'%'};return _0x34fbfc;}})});}_0x20dce7=_[_0xb685('0x3c')]({},_0x20dce7,_0x42e6eb[_0xb685('0x3f')]);var _0x568555={'where':_0x20dce7[_0xb685('0x3a')]};return db['ZohoField'][_0xb685('0x1c')](_0x568555)[_0xb685('0x23')](function(_0xd71ab5){_0x3af7c5[_0xb685('0x1c')]=_0xd71ab5;if(_0x42e6eb['query'][_0xb685('0x40')]){_0x20dce7[_0xb685('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0xb685('0x42')](_0x20dce7);})[_0xb685('0x23')](function(_0x562d12){_0x3af7c5[_0xb685('0x43')]=_0x562d12;return _0x3af7c5;})[_0xb685('0x23')](respondWithFilteredResult(_0x52b321,_0x20dce7))[_0xb685('0x44')](handleError(_0x52b321,null));};exports[_0xb685('0x45')]=function(_0x329cdb,_0x50c226){var _0x75abc7={'raw':!![],'where':{'id':_0x329cdb[_0xb685('0x46')]['id']}},_0x32b337={};_0x32b337[_0xb685('0x32')]=_['keys'](db[_0xb685('0x29')]['rawAttributes']);_0x32b337[_0xb685('0x2e')]=_[_0xb685('0x2f')](_0x329cdb[_0xb685('0x2e')]);_0x32b337[_0xb685('0x30')]=_[_0xb685('0x31')](_0x32b337[_0xb685('0x32')],_0x32b337[_0xb685('0x2e')]);_0x75abc7[_0xb685('0x33')]=_[_0xb685('0x31')](_0x32b337[_0xb685('0x32')],qs[_0xb685('0x34')](_0x329cdb[_0xb685('0x2e')][_0xb685('0x34')]));_0x75abc7[_0xb685('0x33')]=_0x75abc7[_0xb685('0x33')][_0xb685('0x35')]?_0x75abc7[_0xb685('0x33')]:_0x32b337['model'];if(_0x329cdb['query'][_0xb685('0x40')]){_0x75abc7[_0xb685('0x41')]=[{'all':!![]}];}_0x75abc7=_[_0xb685('0x3c')]({},_0x75abc7,_0x329cdb[_0xb685('0x3f')]);return db[_0xb685('0x29')]['find'](_0x75abc7)[_0xb685('0x23')](handleEntityNotFound(_0x50c226,null))[_0xb685('0x23')](respondWithResult(_0x50c226,null))[_0xb685('0x44')](handleError(_0x50c226,null));};exports[_0xb685('0x47')]=function(_0x544b0f,_0x120c92){return db[_0xb685('0x29')]['create'](_0x544b0f[_0xb685('0x48')],{})[_0xb685('0x23')](respondWithResult(_0x120c92,0xc9))['catch'](handleError(_0x120c92,null));};exports[_0xb685('0x49')]=function(_0x317d8b,_0x16c306){if(_0x317d8b[_0xb685('0x48')]['id']){delete _0x317d8b[_0xb685('0x48')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x317d8b[_0xb685('0x46')]['id']}})['then'](handleEntityNotFound(_0x16c306,null))[_0xb685('0x23')](saveUpdates(_0x317d8b[_0xb685('0x48')],null))[_0xb685('0x23')](respondWithResult(_0x16c306,null))[_0xb685('0x44')](handleError(_0x16c306,null));};exports[_0xb685('0x4a')]=function(_0x1e433f,_0x57a798){return db[_0xb685('0x29')]['find']({'where':{'id':_0x1e433f['params']['id']}})[_0xb685('0x23')](handleEntityNotFound(_0x57a798,null))['then'](removeEntity(_0x57a798,null))['catch'](handleError(_0x57a798,null));}; \ No newline at end of file +var _0x226e=['save','update','then','sendStatus','stack','name','index','map','ZohoField','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x59b043,_0x34ea51){var _0x51581b=function(_0x4a9617){while(--_0x4a9617){_0x59b043['push'](_0x59b043['shift']());}};_0x51581b(++_0x34ea51);}(_0x226e,0xbe));var _0xe226=function(_0x4cf36f,_0x23d63f){_0x4cf36f=_0x4cf36f-0x0;var _0x5413a5=_0x226e[_0x4cf36f];return _0x5413a5;};'use strict';var emlformat=require(_0xe226('0x0'));var rimraf=require(_0xe226('0x1'));var zipdir=require(_0xe226('0x2'));var jsonpatch=require(_0xe226('0x3'));var rp=require(_0xe226('0x4'));var moment=require(_0xe226('0x5'));var BPromise=require(_0xe226('0x6'));var Mustache=require(_0xe226('0x7'));var util=require(_0xe226('0x8'));var path=require(_0xe226('0x9'));var sox=require(_0xe226('0xa'));var csv=require(_0xe226('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe226('0xc'));var _=require(_0xe226('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe226('0xe'));var toCsv=require(_0xe226('0xb'));var querystring=require(_0xe226('0xf'));var Papa=require(_0xe226('0x10'));var Redis=require(_0xe226('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe226('0x12'));var as=require(_0xe226('0x13'));var hardwareService=require(_0xe226('0x14'));var logger=require(_0xe226('0x15'))('api');var utils=require(_0xe226('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe226('0x17'));var db=require(_0xe226('0x18'))['db'];function respondWithStatusCode(_0xa3a20b,_0x1348b7){_0x1348b7=_0x1348b7||0xcc;return function(_0x390120){if(_0x390120){return _0xa3a20b['sendStatus'](_0x1348b7);}return _0xa3a20b['status'](_0x1348b7)[_0xe226('0x19')]();};}function respondWithResult(_0x586c7b,_0x14816b){_0x14816b=_0x14816b||0xc8;return function(_0x299ca9){if(_0x299ca9){return _0x586c7b[_0xe226('0x1a')](_0x14816b)['json'](_0x299ca9);}};}function respondWithFilteredResult(_0x43864b,_0x3270c4){return function(_0xbf00fc){if(_0xbf00fc){var _0x351481=typeof _0x3270c4['offset']==='undefined'&&typeof _0x3270c4[_0xe226('0x1b')]===_0xe226('0x1c');var _0x3bc122=_0xbf00fc[_0xe226('0x1d')];var _0x5e6f4b=_0x351481?0x0:_0x3270c4['offset'];var _0x2790bf=_0x351481?_0xbf00fc['count']:_0x3270c4[_0xe226('0x1e')]+_0x3270c4[_0xe226('0x1b')];var _0x19544a;if(_0x2790bf>=_0x3bc122){_0x2790bf=_0x3bc122;_0x19544a=0xc8;}else{_0x19544a=0xce;}_0x43864b[_0xe226('0x1a')](_0x19544a);return _0x43864b[_0xe226('0x1f')](_0xe226('0x20'),_0x5e6f4b+'-'+_0x2790bf+'/'+_0x3bc122)['json'](_0xbf00fc);}return null;};}function patchUpdates(_0x99d0bc){return function(_0x2610f3){try{jsonpatch[_0xe226('0x21')](_0x2610f3,_0x99d0bc,!![]);}catch(_0x1f8f1c){return BPromise[_0xe226('0x22')](_0x1f8f1c);}return _0x2610f3[_0xe226('0x23')]();};}function saveUpdates(_0x3ed1db,_0x5544a1){return function(_0x229687){if(_0x229687){return _0x229687[_0xe226('0x24')](_0x3ed1db)[_0xe226('0x25')](function(_0x5984f1){return _0x5984f1;});}return null;};}function removeEntity(_0x187f45,_0xe50ece){return function(_0x439e86){if(_0x439e86){return _0x439e86['destroy']()['then'](function(){_0x187f45[_0xe226('0x1a')](0xcc)[_0xe226('0x19')]();});}};}function handleEntityNotFound(_0x17539d,_0xbaaf10){return function(_0x51910f){if(!_0x51910f){_0x17539d[_0xe226('0x26')](0x194);}return _0x51910f;};}function handleError(_0x2951dc,_0x561aa5){_0x561aa5=_0x561aa5||0x1f4;return function(_0x5c7679){logger['error'](_0x5c7679[_0xe226('0x27')]);if(_0x5c7679[_0xe226('0x28')]){delete _0x5c7679[_0xe226('0x28')];}_0x2951dc[_0xe226('0x1a')](_0x561aa5)['send'](_0x5c7679);};}exports[_0xe226('0x29')]=function(_0xb9166a,_0x12ed9f){var _0x1ccf54={},_0x3422ec={},_0x3450f6={'count':0x0,'rows':[]};var _0x4f2970=_[_0xe226('0x2a')](db[_0xe226('0x2b')]['rawAttributes'],function(_0x3b546c){return{'name':_0x3b546c[_0xe226('0x2c')],'type':_0x3b546c[_0xe226('0x2d')]['key']};});_0x3422ec['model']=_[_0xe226('0x2a')](_0x4f2970,'name');_0x3422ec[_0xe226('0x2e')]=_['keys'](_0xb9166a['query']);_0x3422ec[_0xe226('0x2f')]=_[_0xe226('0x30')](_0x3422ec[_0xe226('0x31')],_0x3422ec[_0xe226('0x2e')]);_0x1ccf54[_0xe226('0x32')]=_[_0xe226('0x30')](_0x3422ec[_0xe226('0x31')],qs['fields'](_0xb9166a[_0xe226('0x2e')][_0xe226('0x33')]));_0x1ccf54[_0xe226('0x32')]=_0x1ccf54['attributes'][_0xe226('0x34')]?_0x1ccf54['attributes']:_0x3422ec[_0xe226('0x31')];if(!_0xb9166a['query'][_0xe226('0x35')](_0xe226('0x36'))){_0x1ccf54[_0xe226('0x1b')]=qs['limit'](_0xb9166a[_0xe226('0x2e')][_0xe226('0x1b')]);_0x1ccf54['offset']=qs[_0xe226('0x1e')](_0xb9166a[_0xe226('0x2e')][_0xe226('0x1e')]);}_0x1ccf54[_0xe226('0x37')]=qs[_0xe226('0x38')](_0xb9166a['query'][_0xe226('0x38')]);_0x1ccf54[_0xe226('0x39')]=qs['filters'](_[_0xe226('0x3a')](_0xb9166a[_0xe226('0x2e')],_0x3422ec[_0xe226('0x2f')]),_0x4f2970);if(_0xb9166a[_0xe226('0x2e')][_0xe226('0x3b')]){_0x1ccf54['where']=_[_0xe226('0x3c')](_0x1ccf54[_0xe226('0x39')],{'$or':_['map'](_0x4f2970,function(_0x794e34){if(_0x794e34['type']!==_0xe226('0x3d')){var _0x2eaf2b={};_0x2eaf2b[_0x794e34[_0xe226('0x28')]]={'$like':'%'+_0xb9166a[_0xe226('0x2e')][_0xe226('0x3b')]+'%'};return _0x2eaf2b;}})});}_0x1ccf54=_[_0xe226('0x3c')]({},_0x1ccf54,_0xb9166a['options']);var _0x4181a3={'where':_0x1ccf54[_0xe226('0x39')]};return db['ZohoField'][_0xe226('0x1d')](_0x4181a3)['then'](function(_0x39f6a5){_0x3450f6['count']=_0x39f6a5;if(_0xb9166a['query'][_0xe226('0x3e')]){_0x1ccf54[_0xe226('0x3f')]=[{'all':!![]}];}return db[_0xe226('0x2b')][_0xe226('0x40')](_0x1ccf54);})[_0xe226('0x25')](function(_0x17a4fa){_0x3450f6['rows']=_0x17a4fa;return _0x3450f6;})['then'](respondWithFilteredResult(_0x12ed9f,_0x1ccf54))['catch'](handleError(_0x12ed9f,null));};exports[_0xe226('0x41')]=function(_0x121686,_0x293a52){var _0x28ea06={'raw':!![],'where':{'id':_0x121686[_0xe226('0x42')]['id']}},_0x5a6b02={};_0x5a6b02['model']=_[_0xe226('0x43')](db[_0xe226('0x2b')][_0xe226('0x44')]);_0x5a6b02['query']=_[_0xe226('0x43')](_0x121686['query']);_0x5a6b02[_0xe226('0x2f')]=_[_0xe226('0x30')](_0x5a6b02['model'],_0x5a6b02[_0xe226('0x2e')]);_0x28ea06[_0xe226('0x32')]=_['intersection'](_0x5a6b02[_0xe226('0x31')],qs[_0xe226('0x33')](_0x121686[_0xe226('0x2e')][_0xe226('0x33')]));_0x28ea06[_0xe226('0x32')]=_0x28ea06[_0xe226('0x32')][_0xe226('0x34')]?_0x28ea06[_0xe226('0x32')]:_0x5a6b02['model'];if(_0x121686[_0xe226('0x2e')]['includeAll']){_0x28ea06[_0xe226('0x3f')]=[{'all':!![]}];}_0x28ea06=_[_0xe226('0x3c')]({},_0x28ea06,_0x121686[_0xe226('0x45')]);return db['ZohoField'][_0xe226('0x46')](_0x28ea06)['then'](handleEntityNotFound(_0x293a52,null))[_0xe226('0x25')](respondWithResult(_0x293a52,null))[_0xe226('0x47')](handleError(_0x293a52,null));};exports[_0xe226('0x48')]=function(_0x26738f,_0x1e88c6){return db[_0xe226('0x2b')]['create'](_0x26738f['body'],{})[_0xe226('0x25')](respondWithResult(_0x1e88c6,0xc9))['catch'](handleError(_0x1e88c6,null));};exports['update']=function(_0x2c4aed,_0x2304a9){if(_0x2c4aed['body']['id']){delete _0x2c4aed[_0xe226('0x49')]['id'];}return db[_0xe226('0x2b')][_0xe226('0x46')]({'where':{'id':_0x2c4aed[_0xe226('0x42')]['id']}})[_0xe226('0x25')](handleEntityNotFound(_0x2304a9,null))[_0xe226('0x25')](saveUpdates(_0x2c4aed['body'],null))[_0xe226('0x25')](respondWithResult(_0x2304a9,null))[_0xe226('0x47')](handleError(_0x2304a9,null));};exports[_0xe226('0x4a')]=function(_0x51fef1,_0x157490){return db['ZohoField'][_0xe226('0x46')]({'where':{'id':_0x51fef1[_0xe226('0x42')]['id']}})[_0xe226('0x25')](handleEntityNotFound(_0x157490,null))[_0xe226('0x25')](removeEntity(_0x157490,null))[_0xe226('0x47')](handleError(_0x157490,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a88990a..13bc4f0 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 _0x687b=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x12bee0,_0x130376){var _0x41b204=function(_0x2114f4){while(--_0x2114f4){_0x12bee0['push'](_0x12bee0['shift']());}};_0x41b204(++_0x130376);}(_0x687b,0x14a));var _0xb687=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x687b[_0x39941c];return _0x52d9c7;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','util','api','bluebird','request-promise','path'];(function(_0x20b2ba,_0x1df7ff){var _0x1b684d=function(_0x22b600){while(--_0x22b600){_0x20b2ba['push'](_0x20b2ba['shift']());}};_0x1b684d(++_0x1df7ff);}(_0x7096,0x10c));var _0x6709=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7096[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['idField','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 a366d3a..cfba820 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 _0x8355=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xec09a9,_0x50941e){var _0x237895=function(_0x51e2f4){while(--_0x51e2f4){_0xec09a9['push'](_0xec09a9['shift']());}};_0x237895(++_0x50941e);}(_0x8355,0x73));var _0x5835=function(_0x41796c,_0x29aa1f){_0x41796c=_0x41796c-0x0;var _0x4b43f1=_0x8355[_0x41796c];return _0x4b43f1;};'use strict';var _=require(_0x5835('0x0'));var util=require(_0x5835('0x1'));var moment=require(_0x5835('0x2'));var BPromise=require(_0x5835('0x3'));var rs=require(_0x5835('0x4'));var fs=require('fs');var Redis=require(_0x5835('0x5'));var db=require(_0x5835('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5835('0x7'))(_0x5835('0x8'));var config=require(_0x5835('0x9'));var jayson=require(_0x5835('0xa'));var client=jayson[_0x5835('0xb')][_0x5835('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x503bc5,_0x292a27,_0x576fff){return new BPromise(function(_0x4c5245,_0x565788){return client[_0x5835('0xd')](_0x503bc5,_0x576fff)[_0x5835('0xe')](function(_0x294c97){logger[_0x5835('0xf')](_0x5835('0x10'),_0x292a27,_0x5835('0x11'));logger['debug'](_0x5835('0x12'),_0x292a27,_0x5835('0x11'),JSON['stringify'](_0x294c97));if(_0x294c97[_0x5835('0x13')]){if(_0x294c97[_0x5835('0x13')][_0x5835('0x14')]===0x1f4){logger['error'](_0x5835('0x10'),_0x292a27,_0x294c97[_0x5835('0x13')]['message']);return _0x565788(_0x294c97['error'][_0x5835('0x15')]);}logger[_0x5835('0x13')]('ZohoField,\x20%s,\x20%s',_0x292a27,_0x294c97[_0x5835('0x13')][_0x5835('0x15')]);return _0x4c5245(_0x294c97['error']['message']);}else{logger['info'](_0x5835('0x10'),_0x292a27,_0x5835('0x11'));_0x4c5245(_0x294c97[_0x5835('0x16')][_0x5835('0x15')]);}})[_0x5835('0x17')](function(_0x2decb5){logger[_0x5835('0x13')](_0x5835('0x10'),_0x292a27,_0x2decb5);_0x565788(_0x2decb5);});});} \ No newline at end of file +var _0xf659=['client','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xf659,0x162));var _0x9f65=function(_0x4646ba,_0x4939c5){_0x4646ba=_0x4646ba-0x0;var _0x27ff09=_0xf659[_0x4646ba];return _0x27ff09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f65('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f65('0x1'));var fs=require('fs');var Redis=require(_0x9f65('0x2'));var db=require(_0x9f65('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f65('0x4'));var config=require(_0x9f65('0x5'));var jayson=require(_0x9f65('0x6'));var client=jayson[_0x9f65('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d64d4,_0x2e1ce1,_0x381baf){return new BPromise(function(_0x1dd8a6,_0x43d8e9){return client['request'](_0x4d64d4,_0x381baf)['then'](function(_0x12fea0){logger[_0x9f65('0x8')](_0x9f65('0x9'),_0x2e1ce1,'request\x20sent');logger[_0x9f65('0xa')](_0x9f65('0xb'),_0x2e1ce1,'request\x20sent',JSON[_0x9f65('0xc')](_0x12fea0));if(_0x12fea0[_0x9f65('0xd')]){if(_0x12fea0[_0x9f65('0xd')][_0x9f65('0xe')]===0x1f4){logger[_0x9f65('0xd')](_0x9f65('0x9'),_0x2e1ce1,_0x12fea0[_0x9f65('0xd')][_0x9f65('0xf')]);return _0x43d8e9(_0x12fea0[_0x9f65('0xd')]['message']);}logger[_0x9f65('0xd')](_0x9f65('0x9'),_0x2e1ce1,_0x12fea0[_0x9f65('0xd')][_0x9f65('0xf')]);return _0x1dd8a6(_0x12fea0[_0x9f65('0xd')][_0x9f65('0xf')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x2e1ce1,_0x9f65('0x10'));_0x1dd8a6(_0x12fea0[_0x9f65('0x11')][_0x9f65('0xf')]);}})[_0x9f65('0x12')](function(_0x49b4ad){logger[_0x9f65('0xd')](_0x9f65('0x9'),_0x2e1ce1,_0x49b4ad);_0x43d8e9(_0x49b4ad);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1f68f34..acdb80e 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a318a,_0x3f8006){var _0x346cf3=function(_0x314595){while(--_0x314595){_0x2a318a['push'](_0x2a318a['shift']());}};_0x346cf3(++_0x3f8006);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xae72ff,_0x2f4c78){var _0x3df50e=function(_0x5028f6){while(--_0x5028f6){_0xae72ff['push'](_0xae72ff['shift']());}};_0x3df50e(++_0x2f4c78);}(_0x70e0,0x17b));var _0x070e=function(_0x3f8b53,_0x221085){_0x3f8b53=_0x3f8b53-0x0;var _0x588bd8=_0x70e0[_0x3f8b53];return _0x588bd8;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 25b939c..0460e65 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 _0xe4ab=['app.js','INTEGER','state','sequelize','STRING','unique_name_and_version'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe4ab,0x17d));var _0xbe4a=function(_0x119195,_0x5ee281){_0x119195=_0x119195-0x0;var _0x4e06d1=_0xe4ab[_0x119195];return _0x4e06d1;};'use strict';var Sequelize=require(_0xbe4a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe4a('0x1')],'allowNull':![],'unique':_0xbe4a('0x2')},'version':{'type':Sequelize[_0xbe4a('0x1')],'allowNull':![],'unique':_0xbe4a('0x2')},'main':{'type':Sequelize[_0xbe4a('0x1')],'defaultValue':_0xbe4a('0x3')},'filename':{'type':Sequelize[_0xbe4a('0x1')]},'path':{'type':Sequelize[_0xbe4a('0x1')]},'type':{'type':Sequelize[_0xbe4a('0x1')]},'size':{'type':Sequelize[_0xbe4a('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbe4a('0x1')]},'logo':{'type':Sequelize[_0xbe4a('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xbe4a('0x5')},'description':{'type':Sequelize[_0xbe4a('0x1')]},'title':{'type':Sequelize[_0xbe4a('0x1')]},'remoteUri':{'type':Sequelize[_0xbe4a('0x1')]},'link':{'type':Sequelize[_0xbe4a('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe52a=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x7978a5,_0x5a4e10){var _0x5a7ad3=function(_0x45b8f2){while(--_0x45b8f2){_0x7978a5['push'](_0x7978a5['shift']());}};_0x5a7ad3(++_0x5a4e10);}(_0xe52a,0x94));var _0xae52=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xe52a[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xae52('0x0'));module[_0xae52('0x1')]={'name':{'type':Sequelize[_0xae52('0x2')],'allowNull':![],'unique':_0xae52('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xae52('0x3')},'main':{'type':Sequelize[_0xae52('0x2')],'defaultValue':_0xae52('0x4')},'filename':{'type':Sequelize[_0xae52('0x2')]},'path':{'type':Sequelize[_0xae52('0x2')]},'type':{'type':Sequelize[_0xae52('0x2')]},'size':{'type':Sequelize[_0xae52('0x5')]},'active':{'type':Sequelize[_0xae52('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xae52('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xae52('0x7')},'description':{'type':Sequelize[_0xae52('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xae52('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f249c10..0933356 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1a37,0xb4));var _0x71a3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1a37[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x8a5eb8,_0x5a8ed1){var _0x2fc9f6=function(_0x4589e6){while(--_0x4589e6){_0x8a5eb8['push'](_0x8a5eb8['shift']());}};_0x2fc9f6(++_0x5a8ed1);}(_0x2ef3,0xba));var _0x32ef=function(_0xd9e81c,_0x3ddc2c){_0xd9e81c=_0xd9e81c-0x0;var _0x24e84c=_0x2ef3[_0xd9e81c];return _0x24e84c;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c22f6b3..1c77765 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 _0xe8d6=['path','./integration.attributes','define','integrations','bluebird','request-promise'];(function(_0x27fcb6,_0x187ba0){var _0x3102c8=function(_0x22c811){while(--_0x22c811){_0x27fcb6['push'](_0x27fcb6['shift']());}};_0x3102c8(++_0x187ba0);}(_0xe8d6,0xd6));var _0x6e8d=function(_0x5f018b,_0x405a39){_0x5f018b=_0x5f018b-0x0;var _0x104059=_0xe8d6[_0x5f018b];return _0x104059;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6e8d('0x0'));var rp=require(_0x6e8d('0x1'));var fs=require('fs');var path=require(_0x6e8d('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e8d('0x3'));module['exports']=function(_0x1ac99b,_0x474e47){return _0x1ac99b[_0x6e8d('0x4')]('Integration',attributes,{'tableName':_0x6e8d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9987=['./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9987,0xc4));var _0x7998=function(_0x82c3df,_0x12051c){_0x82c3df=_0x82c3df-0x0;var _0x91ba2f=_0x9987[_0x82c3df];return _0x91ba2f;};'use strict';var _=require(_0x7998('0x0'));var util=require(_0x7998('0x1'));var logger=require(_0x7998('0x2'))(_0x7998('0x3'));var moment=require(_0x7998('0x4'));var BPromise=require(_0x7998('0x5'));var rp=require(_0x7998('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7998('0x7'));var attributes=require(_0x7998('0x8'));module[_0x7998('0x9')]=function(_0x584508,_0x2e5d7c){return _0x584508[_0x7998('0xa')]('Integration',attributes,{'tableName':_0x7998('0xb'),'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 fc0e588..599b6c9 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4b256a,_0x154505){var _0x14ca6f=function(_0x3c9f41){while(--_0x3c9f41){_0x4b256a['push'](_0x4b256a['shift']());}};_0x14ca6f(++_0x154505);}(_0xda2d,0x102));var _0xdda2=function(_0x2c3fb1,_0x296baa){_0x2c3fb1=_0x2c3fb1-0x0;var _0x456d9d=_0xda2d[_0x2c3fb1];return _0x456d9d;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x580925,_0x2167e6){var _0x57fdbc=function(_0x5c42ec){while(--_0x5c42ec){_0x580925['push'](_0x580925['shift']());}};_0x57fdbc(++_0x2167e6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x591184,_0x5bad64){_0x591184=_0x591184-0x0;var _0x50cb8d=_0xc6ac[_0x591184];return _0x50cb8d;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ae6af28..bec43ee 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x2cf702,_0x333323){var _0x15f7a6=function(_0x164eeb){while(--_0x164eeb){_0x2cf702['push'](_0x2cf702['shift']());}};_0x15f7a6(++_0x333323);}(_0x9f0e,0x116));var _0xe9f0=function(_0x491d86,_0x43a7da){_0x491d86=_0x491d86-0x0;var _0xa0230d=_0x9f0e[_0x491d86];return _0xa0230d;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +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(_0x34473f,_0x2b9c5c){var _0x25cf6f=function(_0x4214a2){while(--_0x4214a2){_0x34473f['push'](_0x34473f['shift']());}};_0x25cf6f(++_0x2b9c5c);}(_0xadb5,0xad));var _0x5adb=function(_0x4ef96e,_0x2bb5b4){_0x4ef96e=_0x4ef96e-0x0;var _0x32638a=_0xadb5[_0x4ef96e];return _0x32638a;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f74ccf9..1151e4b 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 _0xa86a=['ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x487912,_0x486a10){var _0x21c785=function(_0x520073){while(--_0x520073){_0x487912['push'](_0x487912['shift']());}};_0x21c785(++_0x486a10);}(_0xa86a,0x1e8));var _0xaa86=function(_0xc5b79f,_0x1cea3a){_0xc5b79f=_0xc5b79f-0x0;var _0x3b5020=_0xa86a[_0xc5b79f];return _0x3b5020;};'use strict';var Sequelize=require(_0xaa86('0x0'));module[_0xaa86('0x1')]={'integration':{'type':Sequelize[_0xaa86('0x2')]},'eventChannel':{'type':Sequelize[_0xaa86('0x2')]},'exitStatus':{'type':Sequelize[_0xaa86('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xaa86('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaa86('0x2')]},'calleridnum':{'type':Sequelize[_0xaa86('0x2')]},'calleridname':{'type':Sequelize[_0xaa86('0x2')]},'queue':{'type':Sequelize[_0xaa86('0x2')]},'interface':{'type':Sequelize[_0xaa86('0x2')]},'membername':{'type':Sequelize[_0xaa86('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaa86('0x4')]},'agentconnectAt':{'type':Sequelize[_0xaa86('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xaa86('0x4')]},'talktime':{'type':Sequelize[_0xaa86('0x3')]},'agentacw':{'type':Sequelize[_0xaa86('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaa86('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xaa86('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xaa86('0x4')]},'agentdump':{'type':Sequelize[_0xaa86('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xaa86('0x4')]},'lastevent':{'type':Sequelize[_0xaa86('0x2')]},'channel':{'type':Sequelize[_0xaa86('0x2')]},'channelstate':{'type':Sequelize[_0xaa86('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa86('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa86('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaa86('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa86('0x2')]},'exten':{'type':Sequelize[_0xaa86('0x2')]},'priority':{'type':Sequelize[_0xaa86('0x2')]},'destchannel':{'type':Sequelize[_0xaa86('0x2')]},'destchannelstate':{'type':Sequelize[_0xaa86('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaa86('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa86('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xaa86('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa86('0x2')]},'destcontext':{'type':Sequelize[_0xaa86('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xaa86('0x2')]},'destuniqueid':{'type':Sequelize[_0xaa86('0x2')]},'messageId':{'type':Sequelize[_0xaa86('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xaa86('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xaa86('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xaa86('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xaa86('0x6')]},'status':{'type':Sequelize[_0xaa86('0x7')](_0xaa86('0x8'),'SENDING',_0xaa86('0x9'),_0xaa86('0xa'))},'url':{'type':Sequelize[_0xaa86('0x2')]},'app':{'type':Sequelize[_0xaa86('0x2')]},'appdata':{'type':Sequelize[_0xaa86('0x2')]},'projectId':{'type':Sequelize[_0xaa86('0x3')]}}; \ No newline at end of file +var _0xf858=['INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','exports','STRING','DATE'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xf858,0xb1));var _0x8f85=function(_0x12db52,_0xf14aa2){_0x12db52=_0x12db52-0x0;var _0x2ab080=_0xf858[_0x12db52];return _0x2ab080;};'use strict';var Sequelize=require('sequelize');module[_0x8f85('0x0')]={'integration':{'type':Sequelize[_0x8f85('0x1')]},'eventChannel':{'type':Sequelize[_0x8f85('0x1')]},'exitStatus':{'type':Sequelize[_0x8f85('0x1')]},'ticketId':{'type':Sequelize[_0x8f85('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x8f85('0x1')]},'uniqueid':{'type':Sequelize[_0x8f85('0x1')]},'calleridnum':{'type':Sequelize[_0x8f85('0x1')]},'calleridname':{'type':Sequelize[_0x8f85('0x1')]},'queue':{'type':Sequelize[_0x8f85('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8f85('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8f85('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8f85('0x2')]},'holdtime':{'type':Sequelize[_0x8f85('0x3')]},'agentcomplete':{'type':Sequelize[_0x8f85('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x8f85('0x3')]},'agentacw':{'type':Sequelize[_0x8f85('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8f85('0x3')]},'reason':{'type':Sequelize[_0x8f85('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8f85('0x2')]},'agentdump':{'type':Sequelize[_0x8f85('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8f85('0x2')]},'lastevent':{'type':Sequelize[_0x8f85('0x1')]},'channel':{'type':Sequelize[_0x8f85('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8f85('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8f85('0x1')]},'language':{'type':Sequelize[_0x8f85('0x1')]},'accountcode':{'type':Sequelize[_0x8f85('0x1')]},'context':{'type':Sequelize[_0x8f85('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8f85('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8f85('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8f85('0x1')]},'destcalleridname':{'type':Sequelize[_0x8f85('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8f85('0x1')]},'destcontext':{'type':Sequelize[_0x8f85('0x1')]},'destexten':{'type':Sequelize[_0x8f85('0x1')]},'destpriority':{'type':Sequelize[_0x8f85('0x1')]},'destuniqueid':{'type':Sequelize[_0x8f85('0x1')]},'messageId':{'type':Sequelize[_0x8f85('0x1')]},'inReplyTo':{'type':Sequelize[_0x8f85('0x1')]},'subject':{'type':Sequelize[_0x8f85('0x1')]},'from':{'type':Sequelize[_0x8f85('0x1')]},'to':{'type':Sequelize[_0x8f85('0x1')]},'cc':{'type':Sequelize[_0x8f85('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8f85('0x5')]},'text':{'type':Sequelize[_0x8f85('0x5')]},'status':{'type':Sequelize[_0x8f85('0x6')](_0x8f85('0x7'),_0x8f85('0x8'),_0x8f85('0x9'),'FAILED')},'url':{'type':Sequelize[_0x8f85('0x1')]},'app':{'type':Sequelize[_0x8f85('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x8f85('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c44e9a1..4811301 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 _0x0df3=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','IntegrationReport','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4eed12,_0x1faabc){var _0x44d939=function(_0x3feda4){while(--_0x3feda4){_0x4eed12['push'](_0x4eed12['shift']());}};_0x44d939(++_0x1faabc);}(_0x0df3,0xd9));var _0x30df=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x0df3[_0x1034bb];return _0x453fdb;};'use strict';var emlformat=require(_0x30df('0x0'));var rimraf=require(_0x30df('0x1'));var zipdir=require(_0x30df('0x2'));var jsonpatch=require(_0x30df('0x3'));var rp=require(_0x30df('0x4'));var moment=require(_0x30df('0x5'));var BPromise=require(_0x30df('0x6'));var Mustache=require(_0x30df('0x7'));var util=require(_0x30df('0x8'));var path=require(_0x30df('0x9'));var sox=require('sox');var csv=require(_0x30df('0xa'));var ejs=require(_0x30df('0xb'));var fs=require('fs');var fs_extra=require(_0x30df('0xc'));var _=require(_0x30df('0xd'));var squel=require(_0x30df('0xe'));var crypto=require(_0x30df('0xf'));var jsforce=require(_0x30df('0x10'));var deskjs=require(_0x30df('0x11'));var toCsv=require('to-csv');var querystring=require(_0x30df('0x12'));var Papa=require(_0x30df('0x13'));var Redis=require(_0x30df('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x30df('0x15'));var as=require(_0x30df('0x16'));var hardwareService=require(_0x30df('0x17'));var logger=require(_0x30df('0x18'))('api');var utils=require(_0x30df('0x19'));var config=require(_0x30df('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x30df('0x1b'))['db'];function respondWithStatusCode(_0x4464c3,_0x2e8f2c){_0x2e8f2c=_0x2e8f2c||0xcc;return function(_0x7ec2c9){if(_0x7ec2c9){return _0x4464c3[_0x30df('0x1c')](_0x2e8f2c);}return _0x4464c3[_0x30df('0x1d')](_0x2e8f2c)[_0x30df('0x1e')]();};}function respondWithResult(_0x569f54,_0x582ac6){_0x582ac6=_0x582ac6||0xc8;return function(_0x5a1595){if(_0x5a1595){return _0x569f54[_0x30df('0x1d')](_0x582ac6)['json'](_0x5a1595);}};}function respondWithFilteredResult(_0x47288b,_0x3ca18c){return function(_0x114917){if(_0x114917){var _0x541cdb=typeof _0x3ca18c[_0x30df('0x1f')]===_0x30df('0x20')&&typeof _0x3ca18c['limit']===_0x30df('0x20');var _0x439df0=_0x114917[_0x30df('0x21')];var _0x2e3b81=_0x541cdb?0x0:_0x3ca18c['offset'];var _0x302eae=_0x541cdb?_0x114917[_0x30df('0x21')]:_0x3ca18c[_0x30df('0x1f')]+_0x3ca18c[_0x30df('0x22')];var _0x38f04e;if(_0x302eae>=_0x439df0){_0x302eae=_0x439df0;_0x38f04e=0xc8;}else{_0x38f04e=0xce;}_0x47288b[_0x30df('0x1d')](_0x38f04e);return _0x47288b[_0x30df('0x23')](_0x30df('0x24'),_0x2e3b81+'-'+_0x302eae+'/'+_0x439df0)[_0x30df('0x25')](_0x114917);}return null;};}function patchUpdates(_0x10c758){return function(_0x4b70a5){try{jsonpatch[_0x30df('0x26')](_0x4b70a5,_0x10c758,!![]);}catch(_0x1f1ae5){return BPromise[_0x30df('0x27')](_0x1f1ae5);}return _0x4b70a5[_0x30df('0x28')]();};}function saveUpdates(_0x27c949,_0x11326d){return function(_0x436c09){if(_0x436c09){return _0x436c09[_0x30df('0x29')](_0x27c949)[_0x30df('0x2a')](function(_0x232b3a){return _0x232b3a;});}return null;};}function removeEntity(_0x38c33e,_0x29f80b){return function(_0x3c7807){if(_0x3c7807){return _0x3c7807[_0x30df('0x2b')]()['then'](function(){_0x38c33e[_0x30df('0x1d')](0xcc)[_0x30df('0x1e')]();});}};}function handleEntityNotFound(_0x130c46,_0x2a294a){return function(_0x36ce67){if(!_0x36ce67){_0x130c46[_0x30df('0x1c')](0x194);}return _0x36ce67;};}function handleError(_0x2d0498,_0x5924e0){_0x5924e0=_0x5924e0||0x1f4;return function(_0x32d72d){logger[_0x30df('0x2c')](_0x32d72d[_0x30df('0x2d')]);if(_0x32d72d[_0x30df('0x2e')]){delete _0x32d72d[_0x30df('0x2e')];}_0x2d0498['status'](_0x5924e0)[_0x30df('0x2f')](_0x32d72d);};}exports['index']=function(_0x1f90ff,_0x340724){var _0x5946df={},_0x14140a={},_0x34e558={'count':0x0,'rows':[]};var _0x14c4c9=_['map'](db[_0x30df('0x30')][_0x30df('0x31')],function(_0x516b38){return{'name':_0x516b38['fieldName'],'type':_0x516b38['type'][_0x30df('0x32')]};});_0x14140a[_0x30df('0x33')]=_['map'](_0x14c4c9,'name');_0x14140a['query']=_[_0x30df('0x34')](_0x1f90ff[_0x30df('0x35')]);_0x14140a[_0x30df('0x36')]=_[_0x30df('0x37')](_0x14140a['model'],_0x14140a[_0x30df('0x35')]);_0x5946df['attributes']=_[_0x30df('0x37')](_0x14140a['model'],qs[_0x30df('0x38')](_0x1f90ff['query'][_0x30df('0x38')]));_0x5946df[_0x30df('0x39')]=_0x5946df[_0x30df('0x39')][_0x30df('0x3a')]?_0x5946df[_0x30df('0x39')]:_0x14140a[_0x30df('0x33')];if(!_0x1f90ff[_0x30df('0x35')][_0x30df('0x3b')]('nolimit')){_0x5946df[_0x30df('0x22')]=qs[_0x30df('0x22')](_0x1f90ff[_0x30df('0x35')]['limit']);_0x5946df[_0x30df('0x1f')]=qs['offset'](_0x1f90ff[_0x30df('0x35')][_0x30df('0x1f')]);}_0x5946df[_0x30df('0x3c')]=qs[_0x30df('0x3d')](_0x1f90ff[_0x30df('0x35')][_0x30df('0x3d')]);_0x5946df[_0x30df('0x3e')]=qs[_0x30df('0x36')](_[_0x30df('0x3f')](_0x1f90ff[_0x30df('0x35')],_0x14140a[_0x30df('0x36')]),_0x14c4c9);if(_0x1f90ff[_0x30df('0x35')][_0x30df('0x40')]){_0x5946df['where']=_[_0x30df('0x41')](_0x5946df[_0x30df('0x3e')],{'$or':_[_0x30df('0x42')](_0x14c4c9,function(_0x6c4304){if(_0x6c4304[_0x30df('0x43')]!==_0x30df('0x44')){var _0x10e245={};_0x10e245[_0x6c4304[_0x30df('0x2e')]]={'$like':'%'+_0x1f90ff[_0x30df('0x35')][_0x30df('0x40')]+'%'};return _0x10e245;}})});}_0x5946df=_['merge']({},_0x5946df,_0x1f90ff[_0x30df('0x45')]);var _0x4866ad={'where':_0x5946df[_0x30df('0x3e')]};return db['IntegrationReport']['count'](_0x4866ad)[_0x30df('0x2a')](function(_0x32e9bb){_0x34e558[_0x30df('0x21')]=_0x32e9bb;if(_0x1f90ff[_0x30df('0x35')][_0x30df('0x46')]){_0x5946df[_0x30df('0x47')]=[{'all':!![]}];}return db[_0x30df('0x30')][_0x30df('0x48')](_0x5946df);})[_0x30df('0x2a')](function(_0x578bd5){_0x34e558[_0x30df('0x49')]=_0x578bd5;return _0x34e558;})[_0x30df('0x2a')](respondWithFilteredResult(_0x340724,_0x5946df))[_0x30df('0x4a')](handleError(_0x340724,null));};exports[_0x30df('0x4b')]=function(_0x15ea98,_0x45fbea){var _0x26302e={'raw':![],'where':{'id':_0x15ea98[_0x30df('0x4c')]['id']}},_0x1f1026={};_0x1f1026[_0x30df('0x33')]=_['keys'](db[_0x30df('0x30')]['rawAttributes']);_0x1f1026[_0x30df('0x35')]=_[_0x30df('0x34')](_0x15ea98['query']);_0x1f1026[_0x30df('0x36')]=_[_0x30df('0x37')](_0x1f1026[_0x30df('0x33')],_0x1f1026['query']);_0x26302e[_0x30df('0x39')]=_[_0x30df('0x37')](_0x1f1026['model'],qs[_0x30df('0x38')](_0x15ea98[_0x30df('0x35')][_0x30df('0x38')]));_0x26302e['attributes']=_0x26302e[_0x30df('0x39')][_0x30df('0x3a')]?_0x26302e['attributes']:_0x1f1026['model'];if(_0x15ea98['query']['includeAll']){_0x26302e[_0x30df('0x47')]=[{'all':!![]}];}_0x26302e=_[_0x30df('0x41')]({},_0x26302e,_0x15ea98[_0x30df('0x45')]);return db[_0x30df('0x30')][_0x30df('0x4d')](_0x26302e)[_0x30df('0x2a')](handleEntityNotFound(_0x45fbea,null))[_0x30df('0x2a')](respondWithResult(_0x45fbea,null))[_0x30df('0x4a')](handleError(_0x45fbea,null));};exports['create']=function(_0x171e0,_0x4dced8){return db['IntegrationReport'][_0x30df('0x4e')](_0x171e0[_0x30df('0x4f')],{})['then'](respondWithResult(_0x4dced8,0xc9))['catch'](handleError(_0x4dced8,null));};exports[_0x30df('0x29')]=function(_0x11a0f1,_0x10475b){if(_0x11a0f1[_0x30df('0x4f')]['id']){delete _0x11a0f1[_0x30df('0x4f')]['id'];}return db[_0x30df('0x30')][_0x30df('0x4d')]({'where':{'id':_0x11a0f1[_0x30df('0x4c')]['id']}})[_0x30df('0x2a')](handleEntityNotFound(_0x10475b,null))[_0x30df('0x2a')](saveUpdates(_0x11a0f1[_0x30df('0x4f')],null))[_0x30df('0x2a')](respondWithResult(_0x10475b,null))[_0x30df('0x4a')](handleError(_0x10475b,null));};exports[_0x30df('0x2b')]=function(_0x3aaf10,_0x137043){return db['IntegrationReport'][_0x30df('0x4d')]({'where':{'id':_0x3aaf10[_0x30df('0x4c')]['id']}})['then'](handleEntityNotFound(_0x137043,null))[_0x30df('0x2a')](removeEntity(_0x137043,null))[_0x30df('0x4a')](handleError(_0x137043,null));};exports[_0x30df('0x50')]=function(_0x1a4ec1,_0x5cd6e0){return db[_0x30df('0x30')][_0x30df('0x50')]()[_0x30df('0x2a')](respondWithResult(_0x5cd6e0,null))[_0x30df('0x4a')](handleError(_0x5cd6e0,null));}; \ No newline at end of file +var _0xed5b=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','end','error','stack','name','send','index','IntegrationReport','rawAttributes','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed5b,0xd0));var _0xbed5=function(_0x128d5f,_0x25ae3f){_0x128d5f=_0x128d5f-0x0;var _0x3cc3c6=_0xed5b[_0x128d5f];return _0x3cc3c6;};'use strict';var emlformat=require(_0xbed5('0x0'));var rimraf=require(_0xbed5('0x1'));var zipdir=require(_0xbed5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbed5('0x3'));var moment=require(_0xbed5('0x4'));var BPromise=require(_0xbed5('0x5'));var Mustache=require('mustache');var util=require(_0xbed5('0x6'));var path=require('path');var sox=require(_0xbed5('0x7'));var csv=require(_0xbed5('0x8'));var ejs=require(_0xbed5('0x9'));var fs=require('fs');var fs_extra=require(_0xbed5('0xa'));var _=require('lodash');var squel=require(_0xbed5('0xb'));var crypto=require(_0xbed5('0xc'));var jsforce=require(_0xbed5('0xd'));var deskjs=require(_0xbed5('0xe'));var toCsv=require(_0xbed5('0x8'));var querystring=require(_0xbed5('0xf'));var Papa=require(_0xbed5('0x10'));var Redis=require(_0xbed5('0x11'));var authService=require(_0xbed5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbed5('0x13'));var logger=require('../../config/logger')(_0xbed5('0x14'));var utils=require(_0xbed5('0x15'));var config=require(_0xbed5('0x16'));var licenseUtil=require(_0xbed5('0x17'));var db=require(_0xbed5('0x18'))['db'];function respondWithStatusCode(_0x582987,_0x43ba17){_0x43ba17=_0x43ba17||0xcc;return function(_0x45a9f8){if(_0x45a9f8){return _0x582987[_0xbed5('0x19')](_0x43ba17);}return _0x582987[_0xbed5('0x1a')](_0x43ba17)['end']();};}function respondWithResult(_0x5e475d,_0x8909f7){_0x8909f7=_0x8909f7||0xc8;return function(_0x59937f){if(_0x59937f){return _0x5e475d[_0xbed5('0x1a')](_0x8909f7)['json'](_0x59937f);}};}function respondWithFilteredResult(_0x3eb8b1,_0x2dd7ad){return function(_0x473836){if(_0x473836){var _0x287d7a=typeof _0x2dd7ad[_0xbed5('0x1b')]===_0xbed5('0x1c')&&typeof _0x2dd7ad[_0xbed5('0x1d')]===_0xbed5('0x1c');var _0x2e772e=_0x473836['count'];var _0x29267f=_0x287d7a?0x0:_0x2dd7ad[_0xbed5('0x1b')];var _0x9fc8f2=_0x287d7a?_0x473836[_0xbed5('0x1e')]:_0x2dd7ad[_0xbed5('0x1b')]+_0x2dd7ad[_0xbed5('0x1d')];var _0x13a342;if(_0x9fc8f2>=_0x2e772e){_0x9fc8f2=_0x2e772e;_0x13a342=0xc8;}else{_0x13a342=0xce;}_0x3eb8b1[_0xbed5('0x1a')](_0x13a342);return _0x3eb8b1['set'](_0xbed5('0x1f'),_0x29267f+'-'+_0x9fc8f2+'/'+_0x2e772e)[_0xbed5('0x20')](_0x473836);}return null;};}function patchUpdates(_0x122569){return function(_0x14d093){try{jsonpatch['apply'](_0x14d093,_0x122569,!![]);}catch(_0x79178c){return BPromise[_0xbed5('0x21')](_0x79178c);}return _0x14d093['save']();};}function saveUpdates(_0x6ec8ee,_0x45df92){return function(_0x460645){if(_0x460645){return _0x460645[_0xbed5('0x22')](_0x6ec8ee)[_0xbed5('0x23')](function(_0x2fbaa2){return _0x2fbaa2;});}return null;};}function removeEntity(_0x5e6cc7,_0x534591){return function(_0x4b9a54){if(_0x4b9a54){return _0x4b9a54[_0xbed5('0x24')]()[_0xbed5('0x23')](function(){_0x5e6cc7[_0xbed5('0x1a')](0xcc)[_0xbed5('0x25')]();});}};}function handleEntityNotFound(_0x22bb9b,_0x576aa0){return function(_0x6a016a){if(!_0x6a016a){_0x22bb9b[_0xbed5('0x19')](0x194);}return _0x6a016a;};}function handleError(_0x3eabb2,_0x26e907){_0x26e907=_0x26e907||0x1f4;return function(_0x56c825){logger[_0xbed5('0x26')](_0x56c825[_0xbed5('0x27')]);if(_0x56c825[_0xbed5('0x28')]){delete _0x56c825[_0xbed5('0x28')];}_0x3eabb2[_0xbed5('0x1a')](_0x26e907)[_0xbed5('0x29')](_0x56c825);};}exports[_0xbed5('0x2a')]=function(_0x1557b7,_0x3ef612){var _0x2909ad={},_0x3afa99={},_0x169bbc={'count':0x0,'rows':[]};var _0x416c34=_['map'](db[_0xbed5('0x2b')][_0xbed5('0x2c')],function(_0x47bee9){return{'name':_0x47bee9['fieldName'],'type':_0x47bee9[_0xbed5('0x2d')][_0xbed5('0x2e')]};});_0x3afa99[_0xbed5('0x2f')]=_[_0xbed5('0x30')](_0x416c34,_0xbed5('0x28'));_0x3afa99[_0xbed5('0x31')]=_[_0xbed5('0x32')](_0x1557b7['query']);_0x3afa99['filters']=_['intersection'](_0x3afa99[_0xbed5('0x2f')],_0x3afa99['query']);_0x2909ad['attributes']=_['intersection'](_0x3afa99['model'],qs[_0xbed5('0x33')](_0x1557b7[_0xbed5('0x31')][_0xbed5('0x33')]));_0x2909ad[_0xbed5('0x34')]=_0x2909ad[_0xbed5('0x34')][_0xbed5('0x35')]?_0x2909ad[_0xbed5('0x34')]:_0x3afa99['model'];if(!_0x1557b7['query'][_0xbed5('0x36')](_0xbed5('0x37'))){_0x2909ad[_0xbed5('0x1d')]=qs[_0xbed5('0x1d')](_0x1557b7['query'][_0xbed5('0x1d')]);_0x2909ad['offset']=qs[_0xbed5('0x1b')](_0x1557b7[_0xbed5('0x31')][_0xbed5('0x1b')]);}_0x2909ad[_0xbed5('0x38')]=qs[_0xbed5('0x39')](_0x1557b7[_0xbed5('0x31')]['sort']);_0x2909ad[_0xbed5('0x3a')]=qs[_0xbed5('0x3b')](_[_0xbed5('0x3c')](_0x1557b7[_0xbed5('0x31')],_0x3afa99[_0xbed5('0x3b')]),_0x416c34);if(_0x1557b7['query'][_0xbed5('0x3d')]){_0x2909ad['where']=_['merge'](_0x2909ad[_0xbed5('0x3a')],{'$or':_[_0xbed5('0x30')](_0x416c34,function(_0x411d28){if(_0x411d28[_0xbed5('0x2d')]!=='VIRTUAL'){var _0x59dc65={};_0x59dc65[_0x411d28[_0xbed5('0x28')]]={'$like':'%'+_0x1557b7['query'][_0xbed5('0x3d')]+'%'};return _0x59dc65;}})});}_0x2909ad=_[_0xbed5('0x3e')]({},_0x2909ad,_0x1557b7['options']);var _0x2a2de9={'where':_0x2909ad[_0xbed5('0x3a')]};return db['IntegrationReport'][_0xbed5('0x1e')](_0x2a2de9)[_0xbed5('0x23')](function(_0x2c9a8d){_0x169bbc['count']=_0x2c9a8d;if(_0x1557b7[_0xbed5('0x31')]['includeAll']){_0x2909ad['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2909ad);})['then'](function(_0x4fa247){_0x169bbc[_0xbed5('0x3f')]=_0x4fa247;return _0x169bbc;})[_0xbed5('0x23')](respondWithFilteredResult(_0x3ef612,_0x2909ad))[_0xbed5('0x40')](handleError(_0x3ef612,null));};exports[_0xbed5('0x41')]=function(_0x417c0e,_0x3779db){var _0x3f8b2d={'raw':![],'where':{'id':_0x417c0e[_0xbed5('0x42')]['id']}},_0x43ffd3={};_0x43ffd3[_0xbed5('0x2f')]=_[_0xbed5('0x32')](db['IntegrationReport'][_0xbed5('0x2c')]);_0x43ffd3[_0xbed5('0x31')]=_['keys'](_0x417c0e[_0xbed5('0x31')]);_0x43ffd3['filters']=_['intersection'](_0x43ffd3[_0xbed5('0x2f')],_0x43ffd3[_0xbed5('0x31')]);_0x3f8b2d[_0xbed5('0x34')]=_['intersection'](_0x43ffd3[_0xbed5('0x2f')],qs[_0xbed5('0x33')](_0x417c0e[_0xbed5('0x31')][_0xbed5('0x33')]));_0x3f8b2d[_0xbed5('0x34')]=_0x3f8b2d[_0xbed5('0x34')][_0xbed5('0x35')]?_0x3f8b2d[_0xbed5('0x34')]:_0x43ffd3[_0xbed5('0x2f')];if(_0x417c0e[_0xbed5('0x31')]['includeAll']){_0x3f8b2d['include']=[{'all':!![]}];}_0x3f8b2d=_[_0xbed5('0x3e')]({},_0x3f8b2d,_0x417c0e[_0xbed5('0x43')]);return db[_0xbed5('0x2b')][_0xbed5('0x44')](_0x3f8b2d)[_0xbed5('0x23')](handleEntityNotFound(_0x3779db,null))['then'](respondWithResult(_0x3779db,null))[_0xbed5('0x40')](handleError(_0x3779db,null));};exports[_0xbed5('0x45')]=function(_0x109c93,_0x568980){return db['IntegrationReport'][_0xbed5('0x45')](_0x109c93[_0xbed5('0x46')],{})[_0xbed5('0x23')](respondWithResult(_0x568980,0xc9))[_0xbed5('0x40')](handleError(_0x568980,null));};exports[_0xbed5('0x22')]=function(_0x2f2977,_0x53fe8b){if(_0x2f2977[_0xbed5('0x46')]['id']){delete _0x2f2977['body']['id'];}return db['IntegrationReport'][_0xbed5('0x44')]({'where':{'id':_0x2f2977[_0xbed5('0x42')]['id']}})[_0xbed5('0x23')](handleEntityNotFound(_0x53fe8b,null))[_0xbed5('0x23')](saveUpdates(_0x2f2977[_0xbed5('0x46')],null))[_0xbed5('0x23')](respondWithResult(_0x53fe8b,null))[_0xbed5('0x40')](handleError(_0x53fe8b,null));};exports[_0xbed5('0x24')]=function(_0x4f28c2,_0x227644){return db[_0xbed5('0x2b')][_0xbed5('0x44')]({'where':{'id':_0x4f28c2['params']['id']}})[_0xbed5('0x23')](handleEntityNotFound(_0x227644,null))[_0xbed5('0x23')](removeEntity(_0x227644,null))[_0xbed5('0x40')](handleError(_0x227644,null));};exports[_0xbed5('0x47')]=function(_0x56fb59,_0x2f9636){return db['IntegrationReport'][_0xbed5('0x47')]()[_0xbed5('0x23')](respondWithResult(_0x2f9636,null))['catch'](handleError(_0x2f9636,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7facb6a..b4a7af2 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 _0xac44=['bluebird','request-promise','path','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','moment'];(function(_0x31f444,_0x2b9f14){var _0x1efa25=function(_0x42ed5d){while(--_0x42ed5d){_0x31f444['push'](_0x31f444['shift']());}};_0x1efa25(++_0x2b9f14);}(_0xac44,0xa4));var _0x4ac4=function(_0x1b2ba7,_0x59160b){_0x1b2ba7=_0x1b2ba7-0x0;var _0x5020db=_0xac44[_0x1b2ba7];return _0x5020db;};'use strict';var _=require(_0x4ac4('0x0'));var util=require(_0x4ac4('0x1'));var logger=require('../../config/logger')(_0x4ac4('0x2'));var moment=require(_0x4ac4('0x3'));var BPromise=require(_0x4ac4('0x4'));var rp=require(_0x4ac4('0x5'));var fs=require('fs');var path=require(_0x4ac4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ac4('0x7'));module[_0x4ac4('0x8')]=function(_0x25a634,_0x1610da){return _0x25a634[_0x4ac4('0x9')](_0x4ac4('0xa'),attributes,{'tableName':_0x4ac4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefd2=['path','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41b212,_0x52206a){var _0x305ca0=function(_0xf412c4){while(--_0xf412c4){_0x41b212['push'](_0x41b212['shift']());}};_0x305ca0(++_0x52206a);}(_0xefd2,0x156));var _0x2efd=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xefd2[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x2efd('0x0'));var logger=require(_0x2efd('0x1'))(_0x2efd('0x2'));var moment=require(_0x2efd('0x3'));var BPromise=require(_0x2efd('0x4'));var rp=require(_0x2efd('0x5'));var fs=require('fs');var path=require(_0x2efd('0x6'));var rimraf=require('rimraf');var config=require(_0x2efd('0x7'));var attributes=require(_0x2efd('0x8'));module['exports']=function(_0xa0c2f6,_0x1f39db){return _0xa0c2f6[_0x2efd('0x9')](_0x2efd('0xa'),attributes,{'tableName':_0x2efd('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 1ea76ed..3c6db8e 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x53ec,0x192));var _0xc53e=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0x53ec[_0xd49e15];return _0x306b6a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 31697b7..5ba38c4 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 _0xe9e7=['isAuthenticated','index','get','/:id/sub_intervals','getIntervals','post','create','addInterval','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x1b77d6,_0x53e44f){_0x1b77d6=_0x1b77d6-0x0;var _0x34e8f9=_0xe9e7[_0x1b77d6];return _0x34e8f9;};'use strict';var multer=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var path=require(_0x7e9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e9e('0x3'));var router=express[_0x7e9e('0x4')]();var fs_extra=require(_0x7e9e('0x5'));var auth=require(_0x7e9e('0x6'));var interaction=require(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var controller=require(_0x7e9e('0x9'));router['get']('/',auth[_0x7e9e('0xa')](),controller[_0x7e9e('0xb')]);router[_0x7e9e('0xc')]('/:id',auth[_0x7e9e('0xa')](),controller['show']);router[_0x7e9e('0xc')](_0x7e9e('0xd'),auth[_0x7e9e('0xa')](),controller[_0x7e9e('0xe')]);router[_0x7e9e('0xf')]('/',auth[_0x7e9e('0xa')](),controller[_0x7e9e('0x10')]);router[_0x7e9e('0xf')](_0x7e9e('0xd'),auth[_0x7e9e('0xa')](),controller[_0x7e9e('0x11')]);router[_0x7e9e('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller['addIntervals']);router[_0x7e9e('0x12')](_0x7e9e('0x13'),auth[_0x7e9e('0xa')](),controller[_0x7e9e('0x14')]);router['delete']('/:id',auth[_0x7e9e('0xa')](),controller[_0x7e9e('0x15')]);module[_0x7e9e('0x16')]=router; \ No newline at end of file +var _0x7676=['../../config/environment','./interval.controller','get','index','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','exports','multer','util','path','express','../../components/auth/service'];(function(_0x5b465e,_0x306735){var _0x43d478=function(_0x57fc55){while(--_0x57fc55){_0x5b465e['push'](_0x5b465e['shift']());}};_0x43d478(++_0x306735);}(_0x7676,0xb8));var _0x6767=function(_0xe3ec6f,_0x4b4a3c){_0xe3ec6f=_0xe3ec6f-0x0;var _0x1521fb=_0x7676[_0xe3ec6f];return _0x1521fb;};'use strict';var multer=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var path=require(_0x6767('0x2'));var timeout=require('connect-timeout');var express=require(_0x6767('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6767('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6767('0x5'));var controller=require(_0x6767('0x6'));router[_0x6767('0x7')]('/',auth['isAuthenticated'](),controller[_0x6767('0x8')]);router[_0x6767('0x7')](_0x6767('0x9'),auth['isAuthenticated'](),controller[_0x6767('0xa')]);router[_0x6767('0x7')](_0x6767('0xb'),auth[_0x6767('0xc')](),controller[_0x6767('0xd')]);router[_0x6767('0xe')]('/',auth[_0x6767('0xc')](),controller[_0x6767('0xf')]);router[_0x6767('0xe')](_0x6767('0xb'),auth[_0x6767('0xc')](),controller[_0x6767('0x10')]);router['post'](_0x6767('0x11'),auth[_0x6767('0xc')](),controller[_0x6767('0x12')]);router['put']('/:id',auth[_0x6767('0xc')](),controller[_0x6767('0x13')]);router['delete'](_0x6767('0x9'),auth[_0x6767('0xc')](),controller['destroy']);module[_0x6767('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b91dd37..6f4624e 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 _0xa64e=['exports','STRING','sequelize'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xa64e,0xe3));var _0xea64=function(_0x3419b0,_0x255acd){_0x3419b0=_0x3419b0-0x0;var _0x2fddb6=_0xa64e[_0x3419b0];return _0x2fddb6;};'use strict';var Sequelize=require(_0xea64('0x0'));module[_0xea64('0x1')]={'name':{'type':Sequelize[_0xea64('0x2')]},'description':{'type':Sequelize[_0xea64('0x2')]},'interval':{'type':Sequelize[_0xea64('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc089=['exports','STRING','sequelize'];(function(_0x2071d9,_0x5ce003){var _0x3eeda7=function(_0x21c046){while(--_0x21c046){_0x2071d9['push'](_0x2071d9['shift']());}};_0x3eeda7(++_0x5ce003);}(_0xc089,0x8f));var _0x9c08=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc089[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x9c08('0x0'));module[_0x9c08('0x1')]={'name':{'type':Sequelize[_0x9c08('0x2')]},'description':{'type':Sequelize[_0x9c08('0x2')]},'interval':{'type':Sequelize[_0x9c08('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 9390fd5..7be7b08 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 _0x2cd7=['model','query','keys','intersection','fields','attributes','order','sort','where','pick','filter','merge','include','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','filters','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','destroy','get','Intervals','UserProfileResource','end','name','send','index','map','Interval','rawAttributes','fieldName','type'];(function(_0x50d148,_0x919656){var _0x2fb79b=function(_0x48306d){while(--_0x48306d){_0x50d148['push'](_0x50d148['shift']());}};_0x2fb79b(++_0x919656);}(_0x2cd7,0x199));var _0x72cd=function(_0x3f952a,_0x24dbef){_0x3f952a=_0x3f952a-0x0;var _0x13fbc3=_0x2cd7[_0x3f952a];return _0x13fbc3;};'use strict';var emlformat=require(_0x72cd('0x0'));var rimraf=require(_0x72cd('0x1'));var zipdir=require(_0x72cd('0x2'));var jsonpatch=require(_0x72cd('0x3'));var rp=require(_0x72cd('0x4'));var moment=require('moment');var BPromise=require(_0x72cd('0x5'));var Mustache=require(_0x72cd('0x6'));var util=require(_0x72cd('0x7'));var path=require(_0x72cd('0x8'));var sox=require(_0x72cd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72cd('0xa'));var _=require(_0x72cd('0xb'));var squel=require(_0x72cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x72cd('0xd'));var deskjs=require(_0x72cd('0xe'));var toCsv=require(_0x72cd('0xf'));var querystring=require(_0x72cd('0x10'));var Papa=require(_0x72cd('0x11'));var Redis=require(_0x72cd('0x12'));var authService=require(_0x72cd('0x13'));var qs=require(_0x72cd('0x14'));var as=require(_0x72cd('0x15'));var hardwareService=require(_0x72cd('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x72cd('0x17'));var db=require(_0x72cd('0x18'))['db'];var extensions=require(_0x72cd('0x19'));function respondWithStatusCode(_0x3b45e1,_0x593fd9){_0x593fd9=_0x593fd9||0xcc;return function(_0x10e5bb){if(_0x10e5bb){return _0x3b45e1[_0x72cd('0x1a')](_0x593fd9);}return _0x3b45e1['status'](_0x593fd9)['end']();};}function respondWithResult(_0x29e1b6,_0x143d6f){_0x143d6f=_0x143d6f||0xc8;return function(_0x34f086){if(_0x34f086){return _0x29e1b6['status'](_0x143d6f)[_0x72cd('0x1b')](_0x34f086);}};}function respondWithFilteredResult(_0x511ae7,_0x356aff){return function(_0x58414e){if(_0x58414e){var _0x32a74e=typeof _0x356aff[_0x72cd('0x1c')]==='undefined'&&typeof _0x356aff[_0x72cd('0x1d')]===_0x72cd('0x1e');var _0x53d79a=_0x58414e[_0x72cd('0x1f')];var _0x30f762=_0x32a74e?0x0:_0x356aff[_0x72cd('0x1c')];var _0x566aeb=_0x32a74e?_0x58414e[_0x72cd('0x1f')]:_0x356aff[_0x72cd('0x1c')]+_0x356aff[_0x72cd('0x1d')];var _0x529cae;if(_0x566aeb>=_0x53d79a){_0x566aeb=_0x53d79a;_0x529cae=0xc8;}else{_0x529cae=0xce;}_0x511ae7[_0x72cd('0x20')](_0x529cae);return _0x511ae7[_0x72cd('0x21')](_0x72cd('0x22'),_0x30f762+'-'+_0x566aeb+'/'+_0x53d79a)['json'](_0x58414e);}return null;};}function patchUpdates(_0x3e7176){return function(_0x221f60){try{jsonpatch['apply'](_0x221f60,_0x3e7176,!![]);}catch(_0x5e79ff){return BPromise[_0x72cd('0x23')](_0x5e79ff);}return _0x221f60['save']();};}function saveUpdates(_0xd0608,_0x3b7c8e){return function(_0x3df09a){if(_0x3df09a){return _0x3df09a[_0x72cd('0x24')](_0xd0608)[_0x72cd('0x25')](function(_0x1fd79e){return _0x1fd79e;});}return null;};}function removeEntity(_0x2b3e21,_0x2ee01a){return function(_0x3bcd2f){if(_0x3bcd2f){return _0x3bcd2f[_0x72cd('0x26')]()['then'](function(){var _0x396674=_0x3bcd2f[_0x72cd('0x27')]({'plain':!![]});var _0x33fd55=_0x72cd('0x28');return db[_0x72cd('0x29')][_0x72cd('0x26')]({'where':{'type':_0x33fd55,'resourceId':_0x396674['id']}})['then'](function(){return _0x3bcd2f;});})[_0x72cd('0x25')](function(){_0x2b3e21['status'](0xcc)[_0x72cd('0x2a')]();});}};}function handleEntityNotFound(_0x40c62b,_0xa73e62){return function(_0x2af49e){if(!_0x2af49e){_0x40c62b[_0x72cd('0x1a')](0x194);}return _0x2af49e;};}function handleError(_0x488029,_0x4e1f43){_0x4e1f43=_0x4e1f43||0x1f4;return function(_0x18836b){logger['error'](_0x18836b['stack']);if(_0x18836b['name']){delete _0x18836b[_0x72cd('0x2b')];}_0x488029[_0x72cd('0x20')](_0x4e1f43)[_0x72cd('0x2c')](_0x18836b);};}exports[_0x72cd('0x2d')]=function(_0x543cb1,_0x1981a7){var _0x449a1c={},_0x15da25={},_0x2ec969={'count':0x0,'rows':[]};var _0x2b07bd=_[_0x72cd('0x2e')](db[_0x72cd('0x2f')][_0x72cd('0x30')],function(_0x5cdc74){return{'name':_0x5cdc74[_0x72cd('0x31')],'type':_0x5cdc74[_0x72cd('0x32')]['key']};});_0x15da25[_0x72cd('0x33')]=_[_0x72cd('0x2e')](_0x2b07bd,_0x72cd('0x2b'));_0x15da25[_0x72cd('0x34')]=_[_0x72cd('0x35')](_0x543cb1[_0x72cd('0x34')]);_0x15da25['filters']=_[_0x72cd('0x36')](_0x15da25[_0x72cd('0x33')],_0x15da25[_0x72cd('0x34')]);_0x449a1c['attributes']=_['intersection'](_0x15da25[_0x72cd('0x33')],qs[_0x72cd('0x37')](_0x543cb1[_0x72cd('0x34')][_0x72cd('0x37')]));_0x449a1c[_0x72cd('0x38')]=_0x449a1c[_0x72cd('0x38')]['length']?_0x449a1c[_0x72cd('0x38')]:_0x15da25['model'];if(!_0x543cb1[_0x72cd('0x34')]['hasOwnProperty']('nolimit')){_0x449a1c[_0x72cd('0x1d')]=qs['limit'](_0x543cb1[_0x72cd('0x34')]['limit']);_0x449a1c[_0x72cd('0x1c')]=qs[_0x72cd('0x1c')](_0x543cb1['query'][_0x72cd('0x1c')]);}_0x449a1c[_0x72cd('0x39')]=qs[_0x72cd('0x3a')](_0x543cb1[_0x72cd('0x34')]['sort']);_0x449a1c[_0x72cd('0x3b')]=qs['filters'](_[_0x72cd('0x3c')](_0x543cb1['query'],_0x15da25['filters']),_0x2b07bd);if(_0x543cb1[_0x72cd('0x34')][_0x72cd('0x3d')]){_0x449a1c[_0x72cd('0x3b')]=_[_0x72cd('0x3e')](_0x449a1c[_0x72cd('0x3b')],{'$or':_[_0x72cd('0x2e')](_0x2b07bd,function(_0x582233){if(_0x582233[_0x72cd('0x32')]!=='VIRTUAL'){var _0x46169f={};_0x46169f[_0x582233[_0x72cd('0x2b')]]={'$like':'%'+_0x543cb1[_0x72cd('0x34')][_0x72cd('0x3d')]+'%'};return _0x46169f;}})});}_0x449a1c=_['merge']({},_0x449a1c,_0x543cb1['options']);var _0x5a423d={'where':_0x449a1c[_0x72cd('0x3b')]};return db[_0x72cd('0x2f')]['count'](_0x5a423d)[_0x72cd('0x25')](function(_0x2833d6){_0x2ec969[_0x72cd('0x1f')]=_0x2833d6;if(_0x543cb1['query']['includeAll']){_0x449a1c[_0x72cd('0x3f')]=[{'all':!![]}];}return db[_0x72cd('0x2f')]['findAll'](_0x449a1c);})[_0x72cd('0x25')](function(_0x1971c6){_0x2ec969[_0x72cd('0x40')]=_0x1971c6;return _0x2ec969;})[_0x72cd('0x25')](respondWithFilteredResult(_0x1981a7,_0x449a1c))[_0x72cd('0x41')](handleError(_0x1981a7,null));};exports[_0x72cd('0x42')]=function(_0x3bd10f,_0x347d75){var _0x17a6b8={'raw':!![],'where':{'id':_0x3bd10f[_0x72cd('0x43')]['id']}},_0x197fd6={};_0x197fd6[_0x72cd('0x33')]=_['keys'](db[_0x72cd('0x2f')][_0x72cd('0x30')]);_0x197fd6['query']=_['keys'](_0x3bd10f[_0x72cd('0x34')]);_0x197fd6['filters']=_[_0x72cd('0x36')](_0x197fd6['model'],_0x197fd6[_0x72cd('0x34')]);_0x17a6b8['attributes']=_['intersection'](_0x197fd6['model'],qs[_0x72cd('0x37')](_0x3bd10f[_0x72cd('0x34')][_0x72cd('0x37')]));_0x17a6b8[_0x72cd('0x38')]=_0x17a6b8[_0x72cd('0x38')][_0x72cd('0x44')]?_0x17a6b8['attributes']:_0x197fd6['model'];if(_0x3bd10f[_0x72cd('0x34')]['includeAll']){_0x17a6b8[_0x72cd('0x3f')]=[{'all':!![]}];}_0x17a6b8=_['merge']({},_0x17a6b8,_0x3bd10f[_0x72cd('0x45')]);return db[_0x72cd('0x2f')][_0x72cd('0x46')](_0x17a6b8)[_0x72cd('0x25')](handleEntityNotFound(_0x347d75,null))[_0x72cd('0x25')](respondWithResult(_0x347d75,null))['catch'](handleError(_0x347d75,null));};exports['create']=function(_0x3654cb,_0x2439fa){return db[_0x72cd('0x2f')][_0x72cd('0x47')](_0x3654cb[_0x72cd('0x48')],{})[_0x72cd('0x25')](function(_0x547725){var _0x1ce185=_0x3654cb['user'][_0x72cd('0x27')]({'plain':!![]});if(!_0x1ce185)throw new Error(_0x72cd('0x49'));if(_0x1ce185[_0x72cd('0x4a')]===_0x72cd('0x4b')){var _0x3f46b5=_0x547725['get']({'plain':!![]});var _0x85d586=_0x72cd('0x28');return db[_0x72cd('0x4c')][_0x72cd('0x46')]({'where':{'name':_0x85d586,'userProfileId':_0x1ce185[_0x72cd('0x4d')]},'raw':!![]})['then'](function(_0x1da18c){if(_0x1da18c&&_0x1da18c[_0x72cd('0x4e')]===0x0){return db[_0x72cd('0x29')][_0x72cd('0x47')]({'name':_0x3f46b5[_0x72cd('0x2b')],'resourceId':_0x3f46b5['id'],'type':_0x1da18c[_0x72cd('0x2b')],'sectionId':_0x1da18c['id']},{})[_0x72cd('0x25')](function(){return _0x547725;});}else{return _0x547725;}})[_0x72cd('0x41')](function(_0xb4a38b){logger[_0x72cd('0x4f')](_0x72cd('0x50'),_0xb4a38b);throw _0xb4a38b;});}return _0x547725;})['then'](respondWithResult(_0x2439fa,0xc9))[_0x72cd('0x41')](handleError(_0x2439fa,null));};exports[_0x72cd('0x24')]=function(_0xdd5899,_0x23fb55){if(_0xdd5899['body']['id']){delete _0xdd5899[_0x72cd('0x48')]['id'];}return db[_0x72cd('0x2f')][_0x72cd('0x46')]({'where':{'id':_0xdd5899[_0x72cd('0x43')]['id']}})[_0x72cd('0x25')](handleEntityNotFound(_0x23fb55,null))[_0x72cd('0x25')](saveUpdates(_0xdd5899[_0x72cd('0x48')],null))[_0x72cd('0x25')](respondWithResult(_0x23fb55,null))[_0x72cd('0x41')](handleError(_0x23fb55,null));};exports['destroy']=function(_0x40f172,_0x2fbfb3){return db[_0x72cd('0x2f')]['find']({'where':{'id':_0x40f172[_0x72cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fbfb3,null))[_0x72cd('0x25')](removeEntity(_0x2fbfb3,null))[_0x72cd('0x41')](handleError(_0x2fbfb3,null));};exports[_0x72cd('0x51')]=function(_0x3d7dd2,_0x5b8f2a,_0x2c3382){if(_0x3d7dd2[_0x72cd('0x48')]['id']){delete _0x3d7dd2[_0x72cd('0x48')]['id'];}return db[_0x72cd('0x2f')]['find']({'where':{'id':_0x3d7dd2['params']['id']}})[_0x72cd('0x25')](handleEntityNotFound(_0x5b8f2a,null))[_0x72cd('0x25')](function(_0x37de90){if(_0x37de90){_0x3d7dd2['body'][_0x72cd('0x52')]=_0x37de90['id'];return db[_0x72cd('0x2f')][_0x72cd('0x47')](_0x3d7dd2[_0x72cd('0x48')]);}})[_0x72cd('0x25')](respondWithResult(_0x5b8f2a,null))[_0x72cd('0x41')](handleError(_0x5b8f2a,null));};exports[_0x72cd('0x53')]=function(_0x1cc953,_0x42640f,_0xeabaa4){var _0x10cf6d={};var _0x384fa9={};var _0x4bea4a;var _0x2e2f29;return db[_0x72cd('0x2f')][_0x72cd('0x54')]({'where':{'id':_0x1cc953['params']['id']}})[_0x72cd('0x25')](handleEntityNotFound(_0x42640f,null))[_0x72cd('0x25')](function(_0x541052){if(_0x541052){_0x4bea4a=_0x541052;_0x384fa9[_0x72cd('0x33')]=_[_0x72cd('0x35')](db['Interval'][_0x72cd('0x30')]);_0x384fa9[_0x72cd('0x34')]=_['keys'](_0x1cc953[_0x72cd('0x34')]);_0x384fa9[_0x72cd('0x55')]=_[_0x72cd('0x36')](_0x384fa9[_0x72cd('0x33')],_0x384fa9[_0x72cd('0x34')]);_0x10cf6d['attributes']=_[_0x72cd('0x36')](_0x384fa9[_0x72cd('0x33')],qs[_0x72cd('0x37')](_0x1cc953[_0x72cd('0x34')][_0x72cd('0x37')]));_0x10cf6d[_0x72cd('0x38')]=_0x10cf6d[_0x72cd('0x38')][_0x72cd('0x44')]?_0x10cf6d[_0x72cd('0x38')]:_0x384fa9[_0x72cd('0x33')];_0x10cf6d['order']=qs[_0x72cd('0x3a')](_0x1cc953[_0x72cd('0x34')][_0x72cd('0x3a')]);_0x10cf6d['where']=qs['filters'](_[_0x72cd('0x3c')](_0x1cc953[_0x72cd('0x34')],_0x384fa9[_0x72cd('0x55')]));if(_0x1cc953['query'][_0x72cd('0x3d')]){_0x10cf6d[_0x72cd('0x3b')]=_[_0x72cd('0x3e')](_0x10cf6d[_0x72cd('0x3b')],{'$or':_[_0x72cd('0x2e')](_0x10cf6d[_0x72cd('0x38')],function(_0x34ac57){var _0xefd7c2={};_0xefd7c2[_0x34ac57]={'$like':'%'+_0x1cc953[_0x72cd('0x34')]['filter']+'%'};return _0xefd7c2;})});}_0x10cf6d=_[_0x72cd('0x3e')]({},_0x10cf6d,_0x1cc953[_0x72cd('0x45')]);return _0x4bea4a[_0x72cd('0x53')](_0x10cf6d);}})['then'](function(_0x28bc83){if(_0x28bc83){_0x2e2f29=_0x28bc83['length'];if(!_0x1cc953[_0x72cd('0x34')][_0x72cd('0x56')]('nolimit')){_0x10cf6d[_0x72cd('0x1d')]=qs[_0x72cd('0x1d')](_0x1cc953[_0x72cd('0x34')][_0x72cd('0x1d')]);_0x10cf6d[_0x72cd('0x1c')]=qs[_0x72cd('0x1c')](_0x1cc953[_0x72cd('0x34')]['offset']);}return _0x4bea4a['getIntervals'](_0x10cf6d);}})[_0x72cd('0x25')](function(_0x18c63f){if(_0x18c63f){return _0x18c63f?{'count':_0x2e2f29,'rows':_0x18c63f}:null;}})[_0x72cd('0x25')](respondWithResult(_0x42640f,null))[_0x72cd('0x41')](handleError(_0x42640f,null));};exports[_0x72cd('0x57')]=function(_0x3d7884,_0x396bd1,_0x16ff82){return db[_0x72cd('0x2f')]['findOne']({'where':{'id':_0x3d7884['params']['id']}})['then'](handleEntityNotFound(_0x396bd1,null))[_0x72cd('0x25')](function(_0x4d78d6){if(_0x4d78d6){return db[_0x72cd('0x58')][_0x72cd('0x59')](function(_0x95e03d){return db[_0x72cd('0x2f')][_0x72cd('0x26')]({'where':{'IntervalId':_0x3d7884[_0x72cd('0x43')]['id']},'transaction':_0x95e03d})['then'](function(_0x22c550){var _0x8cbffd=_['map'](_0x3d7884[_0x72cd('0x48')],function(_0x3fcfef){delete _0x3fcfef['id'];_0x3fcfef['IntervalId']=_0x3d7884['params']['id'];return _0x3fcfef;});return db[_0x72cd('0x2f')][_0x72cd('0x5a')](_0x8cbffd,{'transaction':_0x95e03d});});})['then'](function(){return db[_0x72cd('0x2f')][_0x72cd('0x5b')]({'where':{'IntervalId':_0x3d7884[_0x72cd('0x43')]['id']}});});}})[_0x72cd('0x25')](respondWithResult(_0x396bd1,null))['catch'](handleError(_0x396bd1,null));}; \ No newline at end of file +var _0x5c14=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','Intervals','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5003e7,_0x227255){var _0x3b6fe8=function(_0x51f2b5){while(--_0x51f2b5){_0x5003e7['push'](_0x5003e7['shift']());}};_0x3b6fe8(++_0x227255);}(_0x5c14,0xab));var _0x45c1=function(_0x1819f0,_0x4bb467){_0x1819f0=_0x1819f0-0x0;var _0x48a1cc=_0x5c14[_0x1819f0];return _0x48a1cc;};'use strict';var emlformat=require(_0x45c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45c1('0x1'));var jsonpatch=require(_0x45c1('0x2'));var rp=require(_0x45c1('0x3'));var moment=require(_0x45c1('0x4'));var BPromise=require(_0x45c1('0x5'));var Mustache=require(_0x45c1('0x6'));var util=require(_0x45c1('0x7'));var path=require(_0x45c1('0x8'));var sox=require('sox');var csv=require(_0x45c1('0x9'));var ejs=require(_0x45c1('0xa'));var fs=require('fs');var fs_extra=require(_0x45c1('0xb'));var _=require('lodash');var squel=require(_0x45c1('0xc'));var crypto=require(_0x45c1('0xd'));var jsforce=require(_0x45c1('0xe'));var deskjs=require(_0x45c1('0xf'));var toCsv=require(_0x45c1('0x9'));var querystring=require(_0x45c1('0x10'));var Papa=require(_0x45c1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45c1('0x12'));var hardwareService=require(_0x45c1('0x13'));var logger=require(_0x45c1('0x14'))(_0x45c1('0x15'));var utils=require(_0x45c1('0x16'));var config=require(_0x45c1('0x17'));var licenseUtil=require(_0x45c1('0x18'));var db=require(_0x45c1('0x19'))['db'];var extensions=require(_0x45c1('0x1a'));function respondWithStatusCode(_0x277514,_0x1445e7){_0x1445e7=_0x1445e7||0xcc;return function(_0x565d6a){if(_0x565d6a){return _0x277514[_0x45c1('0x1b')](_0x1445e7);}return _0x277514['status'](_0x1445e7)[_0x45c1('0x1c')]();};}function respondWithResult(_0x497153,_0x1d9b82){_0x1d9b82=_0x1d9b82||0xc8;return function(_0x4e7866){if(_0x4e7866){return _0x497153[_0x45c1('0x1d')](_0x1d9b82)[_0x45c1('0x1e')](_0x4e7866);}};}function respondWithFilteredResult(_0x4b5ea5,_0x406db0){return function(_0x50a708){if(_0x50a708){var _0x450c96=typeof _0x406db0['offset']===_0x45c1('0x1f')&&typeof _0x406db0[_0x45c1('0x20')]===_0x45c1('0x1f');var _0x2565d4=_0x50a708[_0x45c1('0x21')];var _0x25f921=_0x450c96?0x0:_0x406db0['offset'];var _0x32b74a=_0x450c96?_0x50a708[_0x45c1('0x21')]:_0x406db0[_0x45c1('0x22')]+_0x406db0[_0x45c1('0x20')];var _0x2945d5;if(_0x32b74a>=_0x2565d4){_0x32b74a=_0x2565d4;_0x2945d5=0xc8;}else{_0x2945d5=0xce;}_0x4b5ea5[_0x45c1('0x1d')](_0x2945d5);return _0x4b5ea5['set'](_0x45c1('0x23'),_0x25f921+'-'+_0x32b74a+'/'+_0x2565d4)[_0x45c1('0x1e')](_0x50a708);}return null;};}function patchUpdates(_0x3f301e){return function(_0x11f67f){try{jsonpatch[_0x45c1('0x24')](_0x11f67f,_0x3f301e,!![]);}catch(_0x247ad7){return BPromise['reject'](_0x247ad7);}return _0x11f67f[_0x45c1('0x25')]();};}function saveUpdates(_0x3ee1b7,_0xa0d3da){return function(_0x2661a1){if(_0x2661a1){return _0x2661a1[_0x45c1('0x26')](_0x3ee1b7)[_0x45c1('0x27')](function(_0x15ca3c){return _0x15ca3c;});}return null;};}function removeEntity(_0x2950ee,_0x129bf3){return function(_0x284a3a){if(_0x284a3a){return _0x284a3a[_0x45c1('0x28')]()[_0x45c1('0x27')](function(){var _0x2ccb2a=_0x284a3a[_0x45c1('0x29')]({'plain':!![]});var _0x2350b1=_0x45c1('0x2a');return db['UserProfileResource'][_0x45c1('0x28')]({'where':{'type':_0x2350b1,'resourceId':_0x2ccb2a['id']}})[_0x45c1('0x27')](function(){return _0x284a3a;});})[_0x45c1('0x27')](function(){_0x2950ee[_0x45c1('0x1d')](0xcc)[_0x45c1('0x1c')]();});}};}function handleEntityNotFound(_0x267070,_0x1d2e87){return function(_0xb06dca){if(!_0xb06dca){_0x267070[_0x45c1('0x1b')](0x194);}return _0xb06dca;};}function handleError(_0x36cbcc,_0x3138eb){_0x3138eb=_0x3138eb||0x1f4;return function(_0x358c05){logger[_0x45c1('0x2b')](_0x358c05[_0x45c1('0x2c')]);if(_0x358c05[_0x45c1('0x2d')]){delete _0x358c05[_0x45c1('0x2d')];}_0x36cbcc[_0x45c1('0x1d')](_0x3138eb)[_0x45c1('0x2e')](_0x358c05);};}exports[_0x45c1('0x2f')]=function(_0xe07dd4,_0x18a421){var _0x52daa4={},_0x442bd8={},_0x2df4be={'count':0x0,'rows':[]};var _0x325bb=_[_0x45c1('0x30')](db[_0x45c1('0x31')][_0x45c1('0x32')],function(_0x2fb361){return{'name':_0x2fb361['fieldName'],'type':_0x2fb361[_0x45c1('0x33')][_0x45c1('0x34')]};});_0x442bd8[_0x45c1('0x35')]=_['map'](_0x325bb,_0x45c1('0x2d'));_0x442bd8[_0x45c1('0x36')]=_[_0x45c1('0x37')](_0xe07dd4[_0x45c1('0x36')]);_0x442bd8['filters']=_['intersection'](_0x442bd8[_0x45c1('0x35')],_0x442bd8[_0x45c1('0x36')]);_0x52daa4[_0x45c1('0x38')]=_[_0x45c1('0x39')](_0x442bd8[_0x45c1('0x35')],qs['fields'](_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x3a')]));_0x52daa4[_0x45c1('0x38')]=_0x52daa4[_0x45c1('0x38')][_0x45c1('0x3b')]?_0x52daa4[_0x45c1('0x38')]:_0x442bd8[_0x45c1('0x35')];if(!_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x3c')](_0x45c1('0x3d'))){_0x52daa4[_0x45c1('0x20')]=qs[_0x45c1('0x20')](_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x20')]);_0x52daa4[_0x45c1('0x22')]=qs[_0x45c1('0x22')](_0xe07dd4[_0x45c1('0x36')]['offset']);}_0x52daa4[_0x45c1('0x3e')]=qs[_0x45c1('0x3f')](_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x3f')]);_0x52daa4['where']=qs[_0x45c1('0x40')](_[_0x45c1('0x41')](_0xe07dd4[_0x45c1('0x36')],_0x442bd8[_0x45c1('0x40')]),_0x325bb);if(_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x42')]){_0x52daa4[_0x45c1('0x43')]=_[_0x45c1('0x44')](_0x52daa4[_0x45c1('0x43')],{'$or':_['map'](_0x325bb,function(_0x4551ef){if(_0x4551ef[_0x45c1('0x33')]!==_0x45c1('0x45')){var _0x52e685={};_0x52e685[_0x4551ef[_0x45c1('0x2d')]]={'$like':'%'+_0xe07dd4['query']['filter']+'%'};return _0x52e685;}})});}_0x52daa4=_[_0x45c1('0x44')]({},_0x52daa4,_0xe07dd4[_0x45c1('0x46')]);var _0x1bf717={'where':_0x52daa4['where']};return db[_0x45c1('0x31')][_0x45c1('0x21')](_0x1bf717)[_0x45c1('0x27')](function(_0x59b941){_0x2df4be[_0x45c1('0x21')]=_0x59b941;if(_0xe07dd4[_0x45c1('0x36')][_0x45c1('0x47')]){_0x52daa4[_0x45c1('0x48')]=[{'all':!![]}];}return db[_0x45c1('0x31')][_0x45c1('0x49')](_0x52daa4);})[_0x45c1('0x27')](function(_0x33c973){_0x2df4be[_0x45c1('0x4a')]=_0x33c973;return _0x2df4be;})[_0x45c1('0x27')](respondWithFilteredResult(_0x18a421,_0x52daa4))['catch'](handleError(_0x18a421,null));};exports[_0x45c1('0x4b')]=function(_0x26a772,_0x3f0cb0){var _0x4977ff={'raw':!![],'where':{'id':_0x26a772[_0x45c1('0x4c')]['id']}},_0x3c28dc={};_0x3c28dc[_0x45c1('0x35')]=_[_0x45c1('0x37')](db[_0x45c1('0x31')]['rawAttributes']);_0x3c28dc[_0x45c1('0x36')]=_[_0x45c1('0x37')](_0x26a772[_0x45c1('0x36')]);_0x3c28dc['filters']=_[_0x45c1('0x39')](_0x3c28dc['model'],_0x3c28dc[_0x45c1('0x36')]);_0x4977ff['attributes']=_['intersection'](_0x3c28dc[_0x45c1('0x35')],qs[_0x45c1('0x3a')](_0x26a772[_0x45c1('0x36')][_0x45c1('0x3a')]));_0x4977ff['attributes']=_0x4977ff['attributes']['length']?_0x4977ff['attributes']:_0x3c28dc[_0x45c1('0x35')];if(_0x26a772[_0x45c1('0x36')][_0x45c1('0x47')]){_0x4977ff[_0x45c1('0x48')]=[{'all':!![]}];}_0x4977ff=_['merge']({},_0x4977ff,_0x26a772['options']);return db[_0x45c1('0x31')][_0x45c1('0x4d')](_0x4977ff)[_0x45c1('0x27')](handleEntityNotFound(_0x3f0cb0,null))['then'](respondWithResult(_0x3f0cb0,null))[_0x45c1('0x4e')](handleError(_0x3f0cb0,null));};exports[_0x45c1('0x4f')]=function(_0x1c1f45,_0x1f8f83){return db['Interval']['create'](_0x1c1f45[_0x45c1('0x50')],{})[_0x45c1('0x27')](function(_0x302066){var _0x10d0f9=_0x1c1f45['user'][_0x45c1('0x29')]({'plain':!![]});if(!_0x10d0f9)throw new Error(_0x45c1('0x51'));if(_0x10d0f9[_0x45c1('0x52')]===_0x45c1('0x53')){var _0x1bca86=_0x302066['get']({'plain':!![]});var _0x3a576f=_0x45c1('0x2a');return db[_0x45c1('0x54')][_0x45c1('0x4d')]({'where':{'name':_0x3a576f,'userProfileId':_0x10d0f9['userProfileId']},'raw':!![]})['then'](function(_0x193b42){if(_0x193b42&&_0x193b42['autoAssociation']===0x0){return db['UserProfileResource'][_0x45c1('0x4f')]({'name':_0x1bca86[_0x45c1('0x2d')],'resourceId':_0x1bca86['id'],'type':_0x193b42[_0x45c1('0x2d')],'sectionId':_0x193b42['id']},{})[_0x45c1('0x27')](function(){return _0x302066;});}else{return _0x302066;}})[_0x45c1('0x4e')](function(_0x1e0324){logger[_0x45c1('0x2b')](_0x45c1('0x55'),_0x1e0324);throw _0x1e0324;});}return _0x302066;})[_0x45c1('0x27')](respondWithResult(_0x1f8f83,0xc9))[_0x45c1('0x4e')](handleError(_0x1f8f83,null));};exports['update']=function(_0x33ad9b,_0x409f94){if(_0x33ad9b['body']['id']){delete _0x33ad9b[_0x45c1('0x50')]['id'];}return db[_0x45c1('0x31')][_0x45c1('0x4d')]({'where':{'id':_0x33ad9b['params']['id']}})[_0x45c1('0x27')](handleEntityNotFound(_0x409f94,null))[_0x45c1('0x27')](saveUpdates(_0x33ad9b[_0x45c1('0x50')],null))[_0x45c1('0x27')](respondWithResult(_0x409f94,null))[_0x45c1('0x4e')](handleError(_0x409f94,null));};exports['destroy']=function(_0xb7a65a,_0x3be1d4){return db['Interval']['find']({'where':{'id':_0xb7a65a[_0x45c1('0x4c')]['id']}})[_0x45c1('0x27')](handleEntityNotFound(_0x3be1d4,null))[_0x45c1('0x27')](removeEntity(_0x3be1d4,null))[_0x45c1('0x4e')](handleError(_0x3be1d4,null));};exports[_0x45c1('0x56')]=function(_0x4d6867,_0x294a66,_0x565628){if(_0x4d6867[_0x45c1('0x50')]['id']){delete _0x4d6867['body']['id'];}return db[_0x45c1('0x31')][_0x45c1('0x4d')]({'where':{'id':_0x4d6867[_0x45c1('0x4c')]['id']}})[_0x45c1('0x27')](handleEntityNotFound(_0x294a66,null))['then'](function(_0x4ce104){if(_0x4ce104){_0x4d6867['body'][_0x45c1('0x57')]=_0x4ce104['id'];return db['Interval'][_0x45c1('0x4f')](_0x4d6867[_0x45c1('0x50')]);}})[_0x45c1('0x27')](respondWithResult(_0x294a66,null))[_0x45c1('0x4e')](handleError(_0x294a66,null));};exports[_0x45c1('0x58')]=function(_0x4f2b20,_0x40e301,_0x52a6a0){var _0x3c736a={};var _0x108c51={};var _0x1dfae4;var _0x150b15;return db['Interval'][_0x45c1('0x59')]({'where':{'id':_0x4f2b20[_0x45c1('0x4c')]['id']}})[_0x45c1('0x27')](handleEntityNotFound(_0x40e301,null))[_0x45c1('0x27')](function(_0x33b8a8){if(_0x33b8a8){_0x1dfae4=_0x33b8a8;_0x108c51[_0x45c1('0x35')]=_[_0x45c1('0x37')](db[_0x45c1('0x31')]['rawAttributes']);_0x108c51[_0x45c1('0x36')]=_['keys'](_0x4f2b20[_0x45c1('0x36')]);_0x108c51['filters']=_[_0x45c1('0x39')](_0x108c51[_0x45c1('0x35')],_0x108c51[_0x45c1('0x36')]);_0x3c736a[_0x45c1('0x38')]=_[_0x45c1('0x39')](_0x108c51[_0x45c1('0x35')],qs[_0x45c1('0x3a')](_0x4f2b20['query'][_0x45c1('0x3a')]));_0x3c736a[_0x45c1('0x38')]=_0x3c736a['attributes'][_0x45c1('0x3b')]?_0x3c736a[_0x45c1('0x38')]:_0x108c51[_0x45c1('0x35')];_0x3c736a[_0x45c1('0x3e')]=qs[_0x45c1('0x3f')](_0x4f2b20[_0x45c1('0x36')][_0x45c1('0x3f')]);_0x3c736a[_0x45c1('0x43')]=qs['filters'](_[_0x45c1('0x41')](_0x4f2b20[_0x45c1('0x36')],_0x108c51[_0x45c1('0x40')]));if(_0x4f2b20[_0x45c1('0x36')]['filter']){_0x3c736a[_0x45c1('0x43')]=_['merge'](_0x3c736a[_0x45c1('0x43')],{'$or':_['map'](_0x3c736a[_0x45c1('0x38')],function(_0x5615dc){var _0x35ecb6={};_0x35ecb6[_0x5615dc]={'$like':'%'+_0x4f2b20[_0x45c1('0x36')]['filter']+'%'};return _0x35ecb6;})});}_0x3c736a=_['merge']({},_0x3c736a,_0x4f2b20[_0x45c1('0x46')]);return _0x1dfae4[_0x45c1('0x58')](_0x3c736a);}})['then'](function(_0x1f5a8a){if(_0x1f5a8a){_0x150b15=_0x1f5a8a[_0x45c1('0x3b')];if(!_0x4f2b20[_0x45c1('0x36')][_0x45c1('0x3c')](_0x45c1('0x3d'))){_0x3c736a['limit']=qs[_0x45c1('0x20')](_0x4f2b20[_0x45c1('0x36')][_0x45c1('0x20')]);_0x3c736a[_0x45c1('0x22')]=qs[_0x45c1('0x22')](_0x4f2b20[_0x45c1('0x36')][_0x45c1('0x22')]);}return _0x1dfae4['getIntervals'](_0x3c736a);}})[_0x45c1('0x27')](function(_0x488cfc){if(_0x488cfc){return _0x488cfc?{'count':_0x150b15,'rows':_0x488cfc}:null;}})[_0x45c1('0x27')](respondWithResult(_0x40e301,null))[_0x45c1('0x4e')](handleError(_0x40e301,null));};exports[_0x45c1('0x5a')]=function(_0x2a2a44,_0x166ab5,_0x3a1c39){return db[_0x45c1('0x31')][_0x45c1('0x59')]({'where':{'id':_0x2a2a44[_0x45c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x166ab5,null))['then'](function(_0x17e58b){if(_0x17e58b){return db[_0x45c1('0x5b')][_0x45c1('0x5c')](function(_0x120084){return db[_0x45c1('0x31')]['destroy']({'where':{'IntervalId':_0x2a2a44['params']['id']},'transaction':_0x120084})[_0x45c1('0x27')](function(_0x34b0cd){var _0x2ad019=_[_0x45c1('0x30')](_0x2a2a44[_0x45c1('0x50')],function(_0x837650){delete _0x837650['id'];_0x837650[_0x45c1('0x57')]=_0x2a2a44[_0x45c1('0x4c')]['id'];return _0x837650;});return db[_0x45c1('0x31')][_0x45c1('0x5d')](_0x2ad019,{'transaction':_0x120084});});})['then'](function(){return db[_0x45c1('0x31')]['findAll']({'where':{'IntervalId':_0x2a2a44['params']['id']}});});}})[_0x45c1('0x27')](respondWithResult(_0x166ab5,null))[_0x45c1('0x4e')](handleError(_0x166ab5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ab437cd..a00fa19 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 _0x1730=['rewrite','interval','string','getIntervals','then','all','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals'];(function(_0x3cc710,_0x1e7023){var _0x16f0f5=function(_0x5211cd){while(--_0x5211cd){_0x3cc710['push'](_0x3cc710['shift']());}};_0x16f0f5(++_0x1e7023);}(_0x1730,0x93));var _0x0173=function(_0x2b77f7,_0x237870){_0x2b77f7=_0x2b77f7-0x0;var _0x30ffb8=_0x1730[_0x2b77f7];return _0x30ffb8;};'use strict';var attributes=require(_0x0173('0x0'));var extensions=require(_0x0173('0x1'));var iftime=require(_0x0173('0x2'))['iftime'];module[_0x0173('0x3')]=function(_0x17aefa){return _0x17aefa[_0x0173('0x4')](_0x0173('0x5'),attributes,{'tableName':_0x0173('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f7bc1){extensions['rewrite'](_0x17aefa,_0x1f7bc1);},'afterBulkCreate':function(_0x6edc86,_0x193389,_0x1365a8){_0x1365a8();extensions[_0x0173('0x7')](_0x17aefa,_0x6edc86[0x0]);},'afterUpdate':function(_0x556b9c){extensions['rewrite'](_0x17aefa,_0x556b9c);},'afterDestroy':function(_0x31a5b4){extensions[_0x0173('0x7')](_0x17aefa,_0x31a5b4);}},'instanceMethods':{'ifTime':function(_0x5f0d25=undefined,_0x358e04=new Date()){if(typeof this[_0x0173('0x8')]===_0x0173('0x9')){return iftime(this[_0x0173('0x8')],_0x5f0d25,_0x358e04);}else{return this[_0x0173('0xa')]()[_0x0173('0xb')](function(_0x3d691e){return Promise[_0x0173('0xc')](_0x3d691e['map'](function(_0x29eea2){return _0x29eea2['ifTime'](_0x5f0d25,_0x358e04);}));})[_0x0173('0xb')](function(_0x52aa45){return _0x52aa45[_0x0173('0xd')](function(_0x500261,_0x1d63a6){return _0x500261||_0x1d63a6;},![]);});}}}});}; \ No newline at end of file +var _0xa1a6=['Interval','tools_intervals','rewrite','interval','string','then','all','map','ifTime','reduce','./interval.attributes','iftime','exports','define'];(function(_0x5bfb78,_0x22e3ff){var _0x4efd00=function(_0x5c9496){while(--_0x5c9496){_0x5bfb78['push'](_0x5bfb78['shift']());}};_0x4efd00(++_0x22e3ff);}(_0xa1a6,0x176));var _0x6a1a=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xa1a6[_0x48b810];return _0x23c17d;};'use strict';var attributes=require(_0x6a1a('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x6a1a('0x1')];module[_0x6a1a('0x2')]=function(_0x1fa8a4){return _0x1fa8a4[_0x6a1a('0x3')](_0x6a1a('0x4'),attributes,{'tableName':_0x6a1a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d09e7){extensions[_0x6a1a('0x6')](_0x1fa8a4,_0x3d09e7);},'afterBulkCreate':function(_0x3500b,_0x20c30c,_0x55a404){_0x55a404();extensions[_0x6a1a('0x6')](_0x1fa8a4,_0x3500b[0x0]);},'afterUpdate':function(_0x59934c){extensions[_0x6a1a('0x6')](_0x1fa8a4,_0x59934c);},'afterDestroy':function(_0x53bd84){extensions[_0x6a1a('0x6')](_0x1fa8a4,_0x53bd84);}},'instanceMethods':{'ifTime':function(_0x73ec05=undefined,_0x1ed689=new Date()){if(typeof this[_0x6a1a('0x7')]===_0x6a1a('0x8')){return iftime(this[_0x6a1a('0x7')],_0x73ec05,_0x1ed689);}else{return this['getIntervals']()[_0x6a1a('0x9')](function(_0x3c798b){return Promise[_0x6a1a('0xa')](_0x3c798b[_0x6a1a('0xb')](function(_0x314edc){return _0x314edc[_0x6a1a('0xc')](_0x73ec05,_0x1ed689);}));})[_0x6a1a('0x9')](function(_0x2fcaea){return _0x2fcaea[_0x6a1a('0xd')](function(_0x52fcc9,_0x56b2e2){return _0x52fcc9||_0x56b2e2;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1f7a065..da3ae19 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 _0x4fa3=['IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','catch','error','ShowInterval','find','where','then','info','message','ifTime','reduce','format','name','join','findById'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4fa3,0x1ce));var _0x34fa=function(_0x3438e0,_0x140a7f){_0x3438e0=_0x3438e0-0x0;var _0x45cbba=_0x4fa3[_0x3438e0];return _0x45cbba;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x34fa('0x0'))['db'];var iftime=require('../../utils/iftime')[_0x34fa('0x1')];var logger=require(_0x34fa('0x2'))(_0x34fa('0x3'));exports[_0x34fa('0x4')]=function(_0x4affa8){var _0x2d028a=this;return new Promise(function(_0x49cf2d,_0x34dd83){return db[_0x34fa('0x5')][_0x34fa('0x6')]({'raw':_0x4affa8[_0x34fa('0x7')]?_0x4affa8[_0x34fa('0x7')][_0x34fa('0x8')]===undefined?!![]:![]:!![],'where':_0x4affa8[_0x34fa('0x7')]?_0x4affa8[_0x34fa('0x7')]['where']||null:null,'attributes':_0x4affa8[_0x34fa('0x7')]?_0x4affa8[_0x34fa('0x7')][_0x34fa('0x9')]||null:null,'limit':_0x4affa8[_0x34fa('0x7')]?_0x4affa8[_0x34fa('0x7')][_0x34fa('0xa')]||null:null,'include':_0x4affa8[_0x34fa('0x7')]?_0x4affa8['options']['include']?_['map'](_0x4affa8[_0x34fa('0x7')][_0x34fa('0xb')],function(_0x1d3b22){return{'model':db[_0x1d3b22[_0x34fa('0xc')]],'as':_0x1d3b22['as'],'attributes':_0x1d3b22[_0x34fa('0x9')],'include':_0x1d3b22['include']?_['map'](_0x1d3b22['include'],function(_0x150afb){return{'model':db[_0x150afb[_0x34fa('0xc')]],'as':_0x150afb['as'],'attributes':_0x150afb['attributes'],'include':_0x150afb['include']?_[_0x34fa('0xd')](_0x150afb['include'],function(_0x1a95ba){return{'model':db[_0x1a95ba[_0x34fa('0xc')]],'as':_0x1a95ba['as'],'attributes':_0x1a95ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7b50){logger['info'](_0x34fa('0x4'),_0x4affa8);logger[_0x34fa('0xe')](_0x34fa('0x4'),_0x4affa8,JSON[_0x34fa('0xf')](_0x1c7b50));_0x49cf2d(_0x1c7b50);})[_0x34fa('0x10')](function(_0x49cb8c){logger[_0x34fa('0x11')](_0x34fa('0x4'),_0x49cb8c['message'],_0x4affa8);_0x34dd83(_0x2d028a[_0x34fa('0x11')](0x1f4,_0x49cb8c['message']));});});};exports[_0x34fa('0x12')]=function(_0x53bef8){var _0x27daf9=this;return new Promise(function(_0x1e9909,_0x1e7846){return db[_0x34fa('0x5')][_0x34fa('0x13')]({'raw':_0x53bef8[_0x34fa('0x7')]?_0x53bef8[_0x34fa('0x7')][_0x34fa('0x8')]===undefined?!![]:![]:!![],'where':_0x53bef8['options']?_0x53bef8['options'][_0x34fa('0x14')]||null:null,'attributes':_0x53bef8['options']?_0x53bef8[_0x34fa('0x7')][_0x34fa('0x9')]||null:null,'include':_0x53bef8['options']?_0x53bef8[_0x34fa('0x7')][_0x34fa('0xb')]?_[_0x34fa('0xd')](_0x53bef8['options'][_0x34fa('0xb')],function(_0xac6314){return{'model':db[_0xac6314[_0x34fa('0xc')]],'as':_0xac6314['as'],'attributes':_0xac6314[_0x34fa('0x9')],'include':_0xac6314[_0x34fa('0xb')]?_[_0x34fa('0xd')](_0xac6314[_0x34fa('0xb')],function(_0x3e732e){return{'model':db[_0x3e732e[_0x34fa('0xc')]],'as':_0x3e732e['as'],'attributes':_0x3e732e[_0x34fa('0x9')],'include':_0x3e732e[_0x34fa('0xb')]?_[_0x34fa('0xd')](_0x3e732e[_0x34fa('0xb')],function(_0x118be8){return{'model':db[_0x118be8[_0x34fa('0xc')]],'as':_0x118be8['as'],'attributes':_0x118be8[_0x34fa('0x9')]};}):[]};}):[]};}):[]:[]})[_0x34fa('0x15')](function(_0x40a3e3){logger[_0x34fa('0x16')](_0x34fa('0x12'),_0x53bef8);logger[_0x34fa('0xe')](_0x34fa('0x12'),_0x53bef8,JSON[_0x34fa('0xf')](_0x40a3e3));_0x1e9909(_0x40a3e3);})[_0x34fa('0x10')](function(_0x5d31ca){logger['error'](_0x34fa('0x12'),_0x5d31ca[_0x34fa('0x17')],_0x53bef8);_0x1e7846(_0x27daf9[_0x34fa('0x11')](0x1f4,_0x5d31ca['message']));});});};function checkArrayOfIntervals(_0x2aa1a7,_0x3d67e1){var _0x2f46eb=[];return db[_0x34fa('0x5')]['findAll']({'where':{'id':_0x2aa1a7}})[_0x34fa('0x15')](function(_0x91f604){_0x2f46eb=_0x91f604;return Promise['all'](_0x2f46eb[_0x34fa('0xd')](function(_0x397352){return _0x397352[_0x34fa('0x18')](_0x3d67e1);}));})[_0x34fa('0x15')](function(_0x12db26){var _0x1f69d5=_0x12db26[_0x34fa('0x19')](function(_0x5eb6ba,_0x54be7e){return _0x5eb6ba||_0x54be7e;},![]);logger[_0x34fa('0x16')](util[_0x34fa('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2f46eb[_0x34fa('0xd')](function(_0xbe892d){return _0xbe892d[_0x34fa('0x1b')];})[_0x34fa('0x1c')](',\x20'),_0x2f46eb['map'](function(_0x2ee0df){return _0x2ee0df['id'];})[_0x34fa('0x1c')](',\x20')));return _0x1f69d5;});}function checkSingleInterval(_0x2cfee4,_0xbed1e){return db[_0x34fa('0x5')][_0x34fa('0x1d')](_0x2cfee4)['then'](function(_0x1602e3){if(_0x1602e3){logger['info'](util[_0x34fa('0x1a')](_0x34fa('0x1e'),_0x1602e3[_0x34fa('0x1b')],_0x1602e3['id']));return _0x1602e3['ifTime'](_0xbed1e);}});}exports[_0x34fa('0x1f')]=function(_0x1760bc){var _0x5a9a18=_0x1760bc[_0x34fa('0x20')];var _0x4e958d=Array[_0x34fa('0x21')](_0x1760bc['intervals'])?_0x1760bc[_0x34fa('0x22')]:typeof _0x1760bc[_0x34fa('0x22')]===_0x34fa('0x23')?[_0x1760bc[_0x34fa('0x22')]]:[];var _0x5c235c=_0x1760bc[_0x34fa('0x24')]||undefined;var _0x5d5322=![];if(_0x4e958d['length']){logger[_0x34fa('0x16')](util[_0x34fa('0x1a')](_0x34fa('0x25'),_0x4e958d[_0x34fa('0x1c')](';\x20')));}if(_0x5c235c){logger['info'](util[_0x34fa('0x1a')](_0x34fa('0x26'),_0x5c235c));}logger[_0x34fa('0xe')](_0x34fa('0x27'),_0x5d5322);logger[_0x34fa('0x28')](_0x34fa('0x1f'),_0x1760bc);return Promise['resolve']()[_0x34fa('0x15')](function(){if(Array[_0x34fa('0x21')](_0x5a9a18)){return checkArrayOfIntervals(_0x5a9a18,_0x5c235c);}else if(_0x5a9a18){return checkSingleInterval(_0x5a9a18,_0x5c235c);}})[_0x34fa('0x15')](function(_0x3c07df){var _0x420f17=_0x4e958d['reduce'](function(_0x5e05dc,_0x4b792b){return _0x5e05dc||iftime(_0x4b792b,_0x5c235c);},![]);_0x5d5322=_0x3c07df||_0x420f17;return _0x5d5322;})[_0x34fa('0x10')](function(_0x2c5404){logger['error']('IntervalIftime',_0x1760bc,_0x2c5404);throw this['error'](0x1f4,_0x2c5404[_0x34fa('0x17')]);});}; \ No newline at end of file +var _0x131b=['map','model','attributes','then','info','debug','stringify','message','error','find','where','ShowInterval','catch','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','reduce','IntervalIftime','lodash','util','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x131b,0xd0));var _0xb131=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x131b[_0x8a0140];return _0x1be8a8;};'use strict';var _=require(_0xb131('0x0'));var util=require(_0xb131('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0xb131('0x2'))['iftime'];var logger=require(_0xb131('0x3'))(_0xb131('0x4'));exports[_0xb131('0x5')]=function(_0x2c8b18){var _0x828714=this;return new Promise(function(_0x1eca00,_0x43e71e){return db[_0xb131('0x6')][_0xb131('0x7')]({'raw':_0x2c8b18['options']?_0x2c8b18[_0xb131('0x8')][_0xb131('0x9')]===undefined?!![]:![]:!![],'where':_0x2c8b18[_0xb131('0x8')]?_0x2c8b18[_0xb131('0x8')]['where']||null:null,'attributes':_0x2c8b18[_0xb131('0x8')]?_0x2c8b18['options']['attributes']||null:null,'limit':_0x2c8b18[_0xb131('0x8')]?_0x2c8b18[_0xb131('0x8')][_0xb131('0xa')]||null:null,'include':_0x2c8b18[_0xb131('0x8')]?_0x2c8b18[_0xb131('0x8')][_0xb131('0xb')]?_[_0xb131('0xc')](_0x2c8b18[_0xb131('0x8')][_0xb131('0xb')],function(_0x1cbb2d){return{'model':db[_0x1cbb2d[_0xb131('0xd')]],'as':_0x1cbb2d['as'],'attributes':_0x1cbb2d[_0xb131('0xe')],'include':_0x1cbb2d['include']?_[_0xb131('0xc')](_0x1cbb2d[_0xb131('0xb')],function(_0x11f7f8){return{'model':db[_0x11f7f8[_0xb131('0xd')]],'as':_0x11f7f8['as'],'attributes':_0x11f7f8[_0xb131('0xe')],'include':_0x11f7f8[_0xb131('0xb')]?_['map'](_0x11f7f8[_0xb131('0xb')],function(_0x451fd2){return{'model':db[_0x451fd2[_0xb131('0xd')]],'as':_0x451fd2['as'],'attributes':_0x451fd2[_0xb131('0xe')]};}):[]};}):[]};}):[]:[]})[_0xb131('0xf')](function(_0x249e30){logger[_0xb131('0x10')](_0xb131('0x5'),_0x2c8b18);logger[_0xb131('0x11')]('GetInterval',_0x2c8b18,JSON[_0xb131('0x12')](_0x249e30));_0x1eca00(_0x249e30);})['catch'](function(_0x5bd1b9){logger['error'](_0xb131('0x5'),_0x5bd1b9[_0xb131('0x13')],_0x2c8b18);_0x43e71e(_0x828714[_0xb131('0x14')](0x1f4,_0x5bd1b9[_0xb131('0x13')]));});});};exports['ShowInterval']=function(_0x329ab9){var _0x58a771=this;return new Promise(function(_0x1ffd54,_0x723566){return db[_0xb131('0x6')][_0xb131('0x15')]({'raw':_0x329ab9['options']?_0x329ab9['options'][_0xb131('0x9')]===undefined?!![]:![]:!![],'where':_0x329ab9['options']?_0x329ab9[_0xb131('0x8')][_0xb131('0x16')]||null:null,'attributes':_0x329ab9['options']?_0x329ab9[_0xb131('0x8')][_0xb131('0xe')]||null:null,'include':_0x329ab9[_0xb131('0x8')]?_0x329ab9[_0xb131('0x8')][_0xb131('0xb')]?_[_0xb131('0xc')](_0x329ab9['options'][_0xb131('0xb')],function(_0x4d75f4){return{'model':db[_0x4d75f4[_0xb131('0xd')]],'as':_0x4d75f4['as'],'attributes':_0x4d75f4[_0xb131('0xe')],'include':_0x4d75f4[_0xb131('0xb')]?_[_0xb131('0xc')](_0x4d75f4[_0xb131('0xb')],function(_0x46e83c){return{'model':db[_0x46e83c[_0xb131('0xd')]],'as':_0x46e83c['as'],'attributes':_0x46e83c[_0xb131('0xe')],'include':_0x46e83c[_0xb131('0xb')]?_[_0xb131('0xc')](_0x46e83c[_0xb131('0xb')],function(_0x687d78){return{'model':db[_0x687d78[_0xb131('0xd')]],'as':_0x687d78['as'],'attributes':_0x687d78[_0xb131('0xe')]};}):[]};}):[]};}):[]:[]})[_0xb131('0xf')](function(_0x2080b6){logger[_0xb131('0x10')]('ShowInterval',_0x329ab9);logger[_0xb131('0x11')](_0xb131('0x17'),_0x329ab9,JSON[_0xb131('0x12')](_0x2080b6));_0x1ffd54(_0x2080b6);})[_0xb131('0x18')](function(_0x2bd626){logger[_0xb131('0x14')](_0xb131('0x17'),_0x2bd626[_0xb131('0x13')],_0x329ab9);_0x723566(_0x58a771[_0xb131('0x14')](0x1f4,_0x2bd626[_0xb131('0x13')]));});});};function checkArrayOfIntervals(_0x506520,_0x5278cc){var _0x22f5de=[];return db[_0xb131('0x6')][_0xb131('0x7')]({'where':{'id':_0x506520}})[_0xb131('0xf')](function(_0x403a1f){_0x22f5de=_0x403a1f;return Promise[_0xb131('0x19')](_0x22f5de[_0xb131('0xc')](function(_0x3bea32){return _0x3bea32[_0xb131('0x1a')](_0x5278cc);}));})[_0xb131('0xf')](function(_0x59f1c4){var _0x2abd04=_0x59f1c4['reduce'](function(_0x436b26,_0x1c1ea9){return _0x436b26||_0x1c1ea9;},![]);logger[_0xb131('0x10')](util[_0xb131('0x1b')](_0xb131('0x1c'),_0x22f5de[_0xb131('0xc')](function(_0x123e11){return _0x123e11[_0xb131('0x1d')];})[_0xb131('0x1e')](',\x20'),_0x22f5de[_0xb131('0xc')](function(_0x263e65){return _0x263e65['id'];})[_0xb131('0x1e')](',\x20')));return _0x2abd04;});}function checkSingleInterval(_0x5197b3,_0x152dee){return db[_0xb131('0x6')][_0xb131('0x1f')](_0x5197b3)[_0xb131('0xf')](function(_0x466856){if(_0x466856){logger[_0xb131('0x10')](util[_0xb131('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x466856['name'],_0x466856['id']));return _0x466856['ifTime'](_0x152dee);}});}exports['IntervalIftime']=function(_0x168691){var _0x1fcd81=_0x168691[_0xb131('0x20')];var _0x122055=Array[_0xb131('0x21')](_0x168691['intervals'])?_0x168691[_0xb131('0x22')]:typeof _0x168691[_0xb131('0x22')]===_0xb131('0x23')?[_0x168691[_0xb131('0x22')]]:[];var _0x1f7d8f=_0x168691[_0xb131('0x24')]||undefined;var _0x3917d7=![];if(_0x122055[_0xb131('0x25')]){logger[_0xb131('0x10')](util[_0xb131('0x1b')](_0xb131('0x26'),_0x122055[_0xb131('0x1e')](';\x20')));}if(_0x1f7d8f){logger[_0xb131('0x10')](util[_0xb131('0x1b')](_0xb131('0x27'),_0x1f7d8f));}logger['debug'](_0xb131('0x28'),_0x3917d7);logger[_0xb131('0x29')]('IntervalIftime',_0x168691);return Promise['resolve']()['then'](function(){if(Array['isArray'](_0x1fcd81)){return checkArrayOfIntervals(_0x1fcd81,_0x1f7d8f);}else if(_0x1fcd81){return checkSingleInterval(_0x1fcd81,_0x1f7d8f);}})['then'](function(_0x1f8694){var _0x15e527=_0x122055[_0xb131('0x2a')](function(_0x133926,_0x4f6cbe){return _0x133926||iftime(_0x4f6cbe,_0x1f7d8f);},![]);_0x3917d7=_0x1f8694||_0x15e527;return _0x3917d7;})[_0xb131('0x18')](function(_0x43c087){logger[_0xb131('0x14')](_0xb131('0x2b'),_0x168691,_0x43c087);throw this['error'](0x1f4,_0x43c087[_0xb131('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bab260e..6277da8 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(_0x356d7f,_0xe690f5){var _0x3ef8af=function(_0x204220){while(--_0x204220){_0x356d7f['push'](_0x356d7f['shift']());}};_0x3ef8af(++_0xe690f5);}(_0xadb5,0xad));var _0x5adb=function(_0x3b4ccd,_0x2c3777){_0x3b4ccd=_0x3b4ccd-0x0;var _0x5c904c=_0xadb5[_0x3b4ccd];return _0x5c904c;};'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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x4934e3,_0x124098){var _0x86a0c3=function(_0x59da73){while(--_0x59da73){_0x4934e3['push'](_0x4934e3['shift']());}};_0x86a0c3(++_0x124098);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4da5ac,_0x8308a8){_0x4da5ac=_0x4da5ac-0x0;var _0x3d8fca=_0x5f2f[_0x4da5ac];return _0x3d8fca;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7167bdb..d4896ac 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 _0x7422=['customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','body','headers','x-forwarded-for','connection','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email'];(function(_0x50a7d6,_0x109734){var _0x37feb7=function(_0x1a7311){while(--_0x1a7311){_0x50a7d6['push'](_0x50a7d6['shift']());}};_0x37feb7(++_0x109734);}(_0x7422,0x141));var _0x2742=function(_0x78e1e1,_0x548ee3){_0x78e1e1=_0x78e1e1-0x0;var _0x1fbc54=_0x7422[_0x78e1e1];return _0x1fbc54;};'use strict';var BPromise=require('bluebird');var https=require(_0x2742('0x0'));var logger=require(_0x2742('0x1'))(_0x2742('0x2'));var USERNAME=_0x2742('0x3');var PASSWORD=_0x2742('0x4');function openIssue(_0x347d5d,_0xcca811){var _0xc3e5f6={'fields':{'project':{'key':_0x347d5d[_0x2742('0x5')]||'MOTGUI'},'summary':(_0x347d5d['summary']||_0x2742('0x6'))+_0x2742('0x7')+_0x347d5d['ip'],'description':_0x347d5d[_0x2742('0x8')]||JSON[_0x2742('0x9')](_0x347d5d),'issuetype':{'name':_0x347d5d[_0x2742('0xa')]||_0x2742('0xb')}}};_0xc3e5f6[_0x2742('0xc')][_0x2742('0xd')]=_0x347d5d[_0x2742('0xe')];_0xc3e5f6[_0x2742('0xc')][_0x2742('0xf')]=_0x347d5d['oldToken'];_0xc3e5f6[_0x2742('0xc')][_0x2742('0x10')]=_0x347d5d[_0x2742('0x11')];_0xc3e5f6[_0x2742('0xc')][_0x2742('0x12')]=_0x347d5d[_0x2742('0x13')];_0xc3e5f6[_0x2742('0xc')]['customfield_11504']=_0x347d5d['reason'];_0xc3e5f6[_0x2742('0xc')][_0x2742('0x14')]=_0x347d5d['ip'];var _0x42d0b4={'host':_0x2742('0x15'),'port':0x1bb,'path':_0x2742('0x16'),'method':_0x2742('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x2742('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2742('0x19')](_0x2742('0x1a'))}};var _0x34b7bf=JSON['stringify'](_0xc3e5f6);var _0x3c7b2e=https[_0x2742('0x1b')](_0x42d0b4,function(_0x3ac3c7){_0x3ac3c7['setEncoding'](_0x2742('0x1c'));var _0x272d64='';_0x3ac3c7['on'](_0x2742('0x1d'),function(_0xd7e03a){_0x272d64+=_0xd7e03a;});_0x3ac3c7['on'](_0x2742('0x1e'),function(){if(_0xcca811){return _0xcca811[_0x2742('0x1f')](_0x3ac3c7['statusCode'])[_0x2742('0x20')](JSON[_0x2742('0x21')](_0x272d64));}});});_0x3c7b2e['on'](_0x2742('0x22'),function(_0x23ce58){if(_0xcca811){return _0xcca811[_0x2742('0x1f')](0x1f4)[_0x2742('0x20')]({'errors':[{'message':_0x2742('0x23'),'type':'api.jira'}]});}});_0x3c7b2e[_0x2742('0x24')](_0x34b7bf);_0x3c7b2e['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x371df6,_0x914d0){_0x371df6[_0x2742('0x25')]['ip']=_0x371df6[_0x2742('0x26')][_0x2742('0x27')]||_0x371df6[_0x2742('0x28')][_0x2742('0x29')]||_0x371df6['socket'][_0x2742('0x29')]||_0x371df6[_0x2742('0x28')]['socket'][_0x2742('0x29')];return openIssue(_0x371df6[_0x2742('0x25')],_0x914d0);}; \ No newline at end of file +var _0xe7f3=['remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','key','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','send','headers','x-forwarded-for','connection'];(function(_0x4dab51,_0x2a5c13){var _0x2b6f22=function(_0x4dca07){while(--_0x4dca07){_0x4dab51['push'](_0x4dab51['shift']());}};_0x2b6f22(++_0x2a5c13);}(_0xe7f3,0x16b));var _0x3e7f=function(_0x34a0db,_0x26d07b){_0x34a0db=_0x34a0db-0x0;var _0x30a4e9=_0xe7f3[_0x34a0db];return _0x30a4e9;};'use strict';var BPromise=require(_0x3e7f('0x0'));var https=require(_0x3e7f('0x1'));var logger=require(_0x3e7f('0x2'))(_0x3e7f('0x3'));var USERNAME=_0x3e7f('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1766de,_0x50b44b){var _0x2ce7e2={'fields':{'project':{'key':_0x1766de[_0x3e7f('0x5')]||'MOTGUI'},'summary':(_0x1766de[_0x3e7f('0x6')]||_0x3e7f('0x7'))+'\x20from\x20'+_0x1766de['ip'],'description':_0x1766de[_0x3e7f('0x8')]||JSON[_0x3e7f('0x9')](_0x1766de),'issuetype':{'name':_0x1766de['issuetype']||_0x3e7f('0xa')}}};_0x2ce7e2[_0x3e7f('0xb')][_0x3e7f('0xc')]=_0x1766de[_0x3e7f('0xd')];_0x2ce7e2[_0x3e7f('0xb')][_0x3e7f('0xe')]=_0x1766de[_0x3e7f('0xf')];_0x2ce7e2[_0x3e7f('0xb')][_0x3e7f('0x10')]=_0x1766de[_0x3e7f('0x11')];_0x2ce7e2[_0x3e7f('0xb')][_0x3e7f('0x12')]=_0x1766de[_0x3e7f('0x13')];_0x2ce7e2[_0x3e7f('0xb')]['customfield_11504']=_0x1766de[_0x3e7f('0x14')];_0x2ce7e2[_0x3e7f('0xb')]['customfield_10102']=_0x1766de['ip'];var _0x5c02e9={'host':_0x3e7f('0x15'),'port':0x1bb,'path':_0x3e7f('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x3e7f('0x17'),'Authorization':_0x3e7f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x3e7f('0x19')](_0x3e7f('0x1a'))}};var _0x386a6e=JSON[_0x3e7f('0x9')](_0x2ce7e2);var _0x2d7258=https[_0x3e7f('0x1b')](_0x5c02e9,function(_0x4e3c54){_0x4e3c54[_0x3e7f('0x1c')](_0x3e7f('0x1d'));var _0x622517='';_0x4e3c54['on'](_0x3e7f('0x1e'),function(_0x314e5c){_0x622517+=_0x314e5c;});_0x4e3c54['on']('end',function(){if(_0x50b44b){return _0x50b44b[_0x3e7f('0x1f')](_0x4e3c54[_0x3e7f('0x20')])['json'](JSON['parse'](_0x622517));}});});_0x2d7258['on'](_0x3e7f('0x21'),function(_0x3e80b2){if(_0x50b44b){return _0x50b44b[_0x3e7f('0x1f')](0x1f4)[_0x3e7f('0x22')]({'errors':[{'message':_0x3e7f('0x23'),'type':'api.jira'}]});}});_0x2d7258[_0x3e7f('0x24')](_0x386a6e);_0x2d7258[_0x3e7f('0x25')]();}exports['openIssue']=openIssue;exports[_0x3e7f('0x26')]=function(_0x3602fb,_0xd1fbc3){_0x3602fb['body']['ip']=_0x3602fb[_0x3e7f('0x27')][_0x3e7f('0x28')]||_0x3602fb[_0x3e7f('0x29')][_0x3e7f('0x2a')]||_0x3602fb['socket'][_0x3e7f('0x2a')]||_0x3602fb[_0x3e7f('0x29')][_0x3e7f('0x2b')][_0x3e7f('0x2a')];return openIssue(_0x3602fb[_0x3e7f('0x2c')],_0xd1fbc3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e08cea3..6dc3dc3 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x717306,_0x1cfcc5){var _0x363aae=function(_0x1f617c){while(--_0x1f617c){_0x717306['push'](_0x717306['shift']());}};_0x363aae(++_0x1cfcc5);}(_0xa75b,0x170));var _0xba75=function(_0x21a0e3,_0x37f1cd){_0x21a0e3=_0x21a0e3-0x0;var _0x13deaf=_0xa75b[_0x21a0e3];return _0x13deaf;};'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['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xda55,0x6d));var _0x5da5=function(_0x552b03,_0x48e023){_0x552b03=_0x552b03-0x0;var _0x14ab19=_0xda55[_0x552b03];return _0x14ab19;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9ffaf4c..98fda57 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x2252c8,_0x3266ef){_0x2252c8=_0x2252c8-0x0;var _0x3f19df=_0x7a54[_0x2252c8];return _0x3f19df;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x52fe86,_0x23a43c){_0x52fe86=_0x52fe86-0x0;var _0x497ea5=_0x7a54[_0x52fe86];return _0x497ea5;};'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 3a3c5c5..7c7d0aa 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 _0x13f5=['count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','findAll','rows','show','params','intersection','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x57c462,_0x200e5f){var _0x50e46c=function(_0xa5fa8){while(--_0xa5fa8){_0x57c462['push'](_0x57c462['shift']());}};_0x50e46c(++_0x200e5f);}(_0x13f5,0xc3));var _0x513f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x13f5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x513f('0x0'));var rimraf=require(_0x513f('0x1'));var zipdir=require(_0x513f('0x2'));var jsonpatch=require(_0x513f('0x3'));var rp=require('request-promise');var moment=require(_0x513f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x513f('0x5'));var path=require(_0x513f('0x6'));var sox=require(_0x513f('0x7'));var csv=require(_0x513f('0x8'));var ejs=require(_0x513f('0x9'));var fs=require('fs');var fs_extra=require(_0x513f('0xa'));var _=require(_0x513f('0xb'));var squel=require(_0x513f('0xc'));var crypto=require(_0x513f('0xd'));var jsforce=require(_0x513f('0xe'));var deskjs=require(_0x513f('0xf'));var toCsv=require(_0x513f('0x8'));var querystring=require('querystring');var Papa=require(_0x513f('0x10'));var Redis=require(_0x513f('0x11'));var authService=require(_0x513f('0x12'));var qs=require(_0x513f('0x13'));var as=require(_0x513f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x513f('0x15'))(_0x513f('0x16'));var utils=require('../../config/utils');var config=require(_0x513f('0x17'));var licenseUtil=require(_0x513f('0x18'));var db=require(_0x513f('0x19'))['db'];function respondWithStatusCode(_0x5f1f37,_0x476153){_0x476153=_0x476153||0xcc;return function(_0xfb8469){if(_0xfb8469){return _0x5f1f37[_0x513f('0x1a')](_0x476153);}return _0x5f1f37[_0x513f('0x1b')](_0x476153)[_0x513f('0x1c')]();};}function respondWithResult(_0x2356ab,_0x3958ab){_0x3958ab=_0x3958ab||0xc8;return function(_0x359478){if(_0x359478){return _0x2356ab[_0x513f('0x1b')](_0x3958ab)[_0x513f('0x1d')](_0x359478);}};}function respondWithFilteredResult(_0x57fd65,_0x369b25){return function(_0x4d1001){if(_0x4d1001){var _0x13f919=typeof _0x369b25[_0x513f('0x1e')]===_0x513f('0x1f')&&typeof _0x369b25[_0x513f('0x20')]===_0x513f('0x1f');var _0x584305=_0x4d1001[_0x513f('0x21')];var _0x73ac7d=_0x13f919?0x0:_0x369b25['offset'];var _0x186121=_0x13f919?_0x4d1001['count']:_0x369b25[_0x513f('0x1e')]+_0x369b25[_0x513f('0x20')];var _0x511ae0;if(_0x186121>=_0x584305){_0x186121=_0x584305;_0x511ae0=0xc8;}else{_0x511ae0=0xce;}_0x57fd65[_0x513f('0x1b')](_0x511ae0);return _0x57fd65[_0x513f('0x22')](_0x513f('0x23'),_0x73ac7d+'-'+_0x186121+'/'+_0x584305)[_0x513f('0x1d')](_0x4d1001);}return null;};}function patchUpdates(_0x443dcb){return function(_0x1e3a46){try{jsonpatch['apply'](_0x1e3a46,_0x443dcb,!![]);}catch(_0x350f07){return BPromise[_0x513f('0x24')](_0x350f07);}return _0x1e3a46['save']();};}function saveUpdates(_0x1af0d6,_0x3314cf){return function(_0x7971c5){if(_0x7971c5){return _0x7971c5[_0x513f('0x25')](_0x1af0d6)[_0x513f('0x26')](function(_0x1eb0f4){return _0x1eb0f4;});}return null;};}function removeEntity(_0x50a93c,_0x560835){return function(_0x59de20){if(_0x59de20){return _0x59de20[_0x513f('0x27')]()[_0x513f('0x26')](function(){_0x50a93c[_0x513f('0x1b')](0xcc)[_0x513f('0x1c')]();});}};}function handleEntityNotFound(_0x2191d4,_0xabb40b){return function(_0x1624d2){if(!_0x1624d2){_0x2191d4[_0x513f('0x1a')](0x194);}return _0x1624d2;};}function handleError(_0x468382,_0x4928de){_0x4928de=_0x4928de||0x1f4;return function(_0x509e63){logger[_0x513f('0x28')](_0x509e63[_0x513f('0x29')]);if(_0x509e63[_0x513f('0x2a')]){delete _0x509e63['name'];}_0x468382[_0x513f('0x1b')](_0x4928de)[_0x513f('0x2b')](_0x509e63);};}exports['index']=function(_0x3c41aa,_0x54c9aa){var _0x47a5c4={},_0x24dc28={},_0xd6c20c={'count':0x0,'rows':[]};var _0x419810=_[_0x513f('0x2c')](db['JscriptyAnswerReport'][_0x513f('0x2d')],function(_0x405710){return{'name':_0x405710[_0x513f('0x2e')],'type':_0x405710[_0x513f('0x2f')]['key']};});_0x24dc28[_0x513f('0x30')]=_[_0x513f('0x2c')](_0x419810,_0x513f('0x2a'));_0x24dc28[_0x513f('0x31')]=_[_0x513f('0x32')](_0x3c41aa[_0x513f('0x31')]);_0x24dc28['filters']=_['intersection'](_0x24dc28[_0x513f('0x30')],_0x24dc28[_0x513f('0x31')]);_0x47a5c4['attributes']=_['intersection'](_0x24dc28[_0x513f('0x30')],qs[_0x513f('0x33')](_0x3c41aa[_0x513f('0x31')]['fields']));_0x47a5c4[_0x513f('0x34')]=_0x47a5c4[_0x513f('0x34')]['length']?_0x47a5c4[_0x513f('0x34')]:_0x24dc28[_0x513f('0x30')];if(!_0x3c41aa[_0x513f('0x31')][_0x513f('0x35')](_0x513f('0x36'))){_0x47a5c4[_0x513f('0x20')]=qs[_0x513f('0x20')](_0x3c41aa[_0x513f('0x31')][_0x513f('0x20')]);_0x47a5c4['offset']=qs[_0x513f('0x1e')](_0x3c41aa['query']['offset']);}_0x47a5c4[_0x513f('0x37')]=qs['sort'](_0x3c41aa[_0x513f('0x31')][_0x513f('0x38')]);_0x47a5c4['where']=qs[_0x513f('0x39')](_['pick'](_0x3c41aa['query'],_0x24dc28[_0x513f('0x39')]),_0x419810);if(_0x3c41aa[_0x513f('0x31')][_0x513f('0x3a')]){_0x47a5c4[_0x513f('0x3b')]=_[_0x513f('0x3c')](_0x47a5c4['where'],{'$or':_[_0x513f('0x2c')](_0x419810,function(_0x1612ca){if(_0x1612ca['type']!==_0x513f('0x3d')){var _0x13cedc={};_0x13cedc[_0x1612ca[_0x513f('0x2a')]]={'$like':'%'+_0x3c41aa[_0x513f('0x31')][_0x513f('0x3a')]+'%'};return _0x13cedc;}})});}_0x47a5c4=_['merge']({},_0x47a5c4,_0x3c41aa[_0x513f('0x3e')]);var _0x1c1f33={'where':_0x47a5c4[_0x513f('0x3b')]};return db[_0x513f('0x3f')]['count'](_0x1c1f33)['then'](function(_0x3072a1){_0xd6c20c[_0x513f('0x21')]=_0x3072a1;if(_0x3c41aa[_0x513f('0x31')][_0x513f('0x40')]){_0x47a5c4['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x513f('0x41')](_0x47a5c4);})[_0x513f('0x26')](function(_0x4265da){_0xd6c20c[_0x513f('0x42')]=_0x4265da;return _0xd6c20c;})[_0x513f('0x26')](respondWithFilteredResult(_0x54c9aa,_0x47a5c4))['catch'](handleError(_0x54c9aa,null));};exports[_0x513f('0x43')]=function(_0x333db1,_0x1ff5ce){var _0x5d0122={'raw':!![],'where':{'id':_0x333db1[_0x513f('0x44')]['id']}},_0xbc80f0={};_0xbc80f0['model']=_[_0x513f('0x32')](db[_0x513f('0x3f')][_0x513f('0x2d')]);_0xbc80f0[_0x513f('0x31')]=_[_0x513f('0x32')](_0x333db1['query']);_0xbc80f0[_0x513f('0x39')]=_[_0x513f('0x45')](_0xbc80f0[_0x513f('0x30')],_0xbc80f0[_0x513f('0x31')]);_0x5d0122['attributes']=_['intersection'](_0xbc80f0[_0x513f('0x30')],qs[_0x513f('0x33')](_0x333db1[_0x513f('0x31')][_0x513f('0x33')]));_0x5d0122[_0x513f('0x34')]=_0x5d0122[_0x513f('0x34')][_0x513f('0x46')]?_0x5d0122['attributes']:_0xbc80f0[_0x513f('0x30')];if(_0x333db1[_0x513f('0x31')][_0x513f('0x40')]){_0x5d0122['include']=[{'all':!![]}];}_0x5d0122=_[_0x513f('0x3c')]({},_0x5d0122,_0x333db1['options']);return db[_0x513f('0x3f')]['find'](_0x5d0122)[_0x513f('0x26')](handleEntityNotFound(_0x1ff5ce,null))['then'](respondWithResult(_0x1ff5ce,null))[_0x513f('0x47')](handleError(_0x1ff5ce,null));};exports[_0x513f('0x48')]=function(_0x5e1076,_0x47bee5){return db[_0x513f('0x3f')]['create'](_0x5e1076[_0x513f('0x49')],{})[_0x513f('0x26')](respondWithResult(_0x47bee5,0xc9))['catch'](handleError(_0x47bee5,null));};exports[_0x513f('0x25')]=function(_0xd175f2,_0x4d410f){if(_0xd175f2[_0x513f('0x49')]['id']){delete _0xd175f2[_0x513f('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x513f('0x4a')]({'where':{'id':_0xd175f2['params']['id']}})[_0x513f('0x26')](handleEntityNotFound(_0x4d410f,null))['then'](saveUpdates(_0xd175f2[_0x513f('0x49')],null))['then'](respondWithResult(_0x4d410f,null))[_0x513f('0x47')](handleError(_0x4d410f,null));};exports['destroy']=function(_0x254d3f,_0x55f425){return db[_0x513f('0x3f')]['find']({'where':{'id':_0x254d3f['params']['id']}})[_0x513f('0x26')](handleEntityNotFound(_0x55f425,null))[_0x513f('0x26')](removeEntity(_0x55f425,null))['catch'](handleError(_0x55f425,null));};exports[_0x513f('0x4b')]=function(_0x10282b,_0x2e012a){return db['JscriptyAnswerReport'][_0x513f('0x4b')]()[_0x513f('0x26')](respondWithResult(_0x2e012a,null))[_0x513f('0x47')](handleError(_0x2e012a,null));}; \ No newline at end of file +var _0xf8b2=['sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','JscriptyAnswerReport','include','findAll','then','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x581e1d,_0x1ed7d4){var _0x39965b=function(_0x3cf384){while(--_0x3cf384){_0x581e1d['push'](_0x581e1d['shift']());}};_0x39965b(++_0x1ed7d4);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x26641f,_0x2ee983){_0x26641f=_0x26641f-0x0;var _0x269285=_0xf8b2[_0x26641f];return _0x269285;};'use strict';var emlformat=require(_0x2f8b('0x0'));var rimraf=require(_0x2f8b('0x1'));var zipdir=require(_0x2f8b('0x2'));var jsonpatch=require(_0x2f8b('0x3'));var rp=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var BPromise=require(_0x2f8b('0x6'));var Mustache=require(_0x2f8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f8b('0x8'));var csv=require(_0x2f8b('0x9'));var ejs=require(_0x2f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8b('0xb'));var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var licenseUtil=require(_0x2f8b('0x19'));var db=require(_0x2f8b('0x1a'))['db'];function respondWithStatusCode(_0x175111,_0x4cb1e0){_0x4cb1e0=_0x4cb1e0||0xcc;return function(_0x16d5a2){if(_0x16d5a2){return _0x175111['sendStatus'](_0x4cb1e0);}return _0x175111[_0x2f8b('0x1b')](_0x4cb1e0)[_0x2f8b('0x1c')]();};}function respondWithResult(_0x1b6a17,_0x15634){_0x15634=_0x15634||0xc8;return function(_0xf9cbe0){if(_0xf9cbe0){return _0x1b6a17[_0x2f8b('0x1b')](_0x15634)[_0x2f8b('0x1d')](_0xf9cbe0);}};}function respondWithFilteredResult(_0x2b6003,_0x532fe4){return function(_0x14a248){if(_0x14a248){var _0xdec711=typeof _0x532fe4[_0x2f8b('0x1e')]===_0x2f8b('0x1f')&&typeof _0x532fe4[_0x2f8b('0x20')]===_0x2f8b('0x1f');var _0x3d65ee=_0x14a248[_0x2f8b('0x21')];var _0x35ec40=_0xdec711?0x0:_0x532fe4['offset'];var _0x23dd63=_0xdec711?_0x14a248[_0x2f8b('0x21')]:_0x532fe4[_0x2f8b('0x1e')]+_0x532fe4['limit'];var _0xdc8171;if(_0x23dd63>=_0x3d65ee){_0x23dd63=_0x3d65ee;_0xdc8171=0xc8;}else{_0xdc8171=0xce;}_0x2b6003['status'](_0xdc8171);return _0x2b6003[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x35ec40+'-'+_0x23dd63+'/'+_0x3d65ee)[_0x2f8b('0x1d')](_0x14a248);}return null;};}function patchUpdates(_0x26d78f){return function(_0x3be6dc){try{jsonpatch['apply'](_0x3be6dc,_0x26d78f,!![]);}catch(_0x29c2f3){return BPromise[_0x2f8b('0x24')](_0x29c2f3);}return _0x3be6dc[_0x2f8b('0x25')]();};}function saveUpdates(_0x17b251,_0x3ad38b){return function(_0x1ffbae){if(_0x1ffbae){return _0x1ffbae[_0x2f8b('0x26')](_0x17b251)['then'](function(_0x273950){return _0x273950;});}return null;};}function removeEntity(_0x23f73c,_0x3560c4){return function(_0x41e12b){if(_0x41e12b){return _0x41e12b[_0x2f8b('0x27')]()['then'](function(){_0x23f73c[_0x2f8b('0x1b')](0xcc)[_0x2f8b('0x1c')]();});}};}function handleEntityNotFound(_0x152492,_0x46a95a){return function(_0x183e51){if(!_0x183e51){_0x152492[_0x2f8b('0x28')](0x194);}return _0x183e51;};}function handleError(_0x45e313,_0x347f5a){_0x347f5a=_0x347f5a||0x1f4;return function(_0x4145b3){logger['error'](_0x4145b3[_0x2f8b('0x29')]);if(_0x4145b3['name']){delete _0x4145b3[_0x2f8b('0x2a')];}_0x45e313[_0x2f8b('0x1b')](_0x347f5a)[_0x2f8b('0x2b')](_0x4145b3);};}exports[_0x2f8b('0x2c')]=function(_0x72b23b,_0x4adacd){var _0x2cfbea={},_0x5cc78c={},_0x5207a8={'count':0x0,'rows':[]};var _0x194e75=_[_0x2f8b('0x2d')](db['JscriptyAnswerReport'][_0x2f8b('0x2e')],function(_0x20d80c){return{'name':_0x20d80c[_0x2f8b('0x2f')],'type':_0x20d80c[_0x2f8b('0x30')][_0x2f8b('0x31')]};});_0x5cc78c[_0x2f8b('0x32')]=_['map'](_0x194e75,_0x2f8b('0x2a'));_0x5cc78c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0x72b23b[_0x2f8b('0x33')]);_0x5cc78c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x5cc78c[_0x2f8b('0x32')],_0x5cc78c['query']);_0x2cfbea[_0x2f8b('0x37')]=_['intersection'](_0x5cc78c[_0x2f8b('0x32')],qs[_0x2f8b('0x38')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x38')]));_0x2cfbea[_0x2f8b('0x37')]=_0x2cfbea[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x2cfbea[_0x2f8b('0x37')]:_0x5cc78c[_0x2f8b('0x32')];if(!_0x72b23b['query']['hasOwnProperty'](_0x2f8b('0x3a'))){_0x2cfbea[_0x2f8b('0x20')]=qs[_0x2f8b('0x20')](_0x72b23b[_0x2f8b('0x33')]['limit']);_0x2cfbea[_0x2f8b('0x1e')]=qs[_0x2f8b('0x1e')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x1e')]);}_0x2cfbea[_0x2f8b('0x3b')]=qs['sort'](_0x72b23b['query'][_0x2f8b('0x3c')]);_0x2cfbea[_0x2f8b('0x3d')]=qs[_0x2f8b('0x35')](_[_0x2f8b('0x3e')](_0x72b23b[_0x2f8b('0x33')],_0x5cc78c[_0x2f8b('0x35')]),_0x194e75);if(_0x72b23b[_0x2f8b('0x33')]['filter']){_0x2cfbea[_0x2f8b('0x3d')]=_[_0x2f8b('0x3f')](_0x2cfbea['where'],{'$or':_[_0x2f8b('0x2d')](_0x194e75,function(_0x4594b2){if(_0x4594b2[_0x2f8b('0x30')]!=='VIRTUAL'){var _0xa1d8de={};_0xa1d8de[_0x4594b2[_0x2f8b('0x2a')]]={'$like':'%'+_0x72b23b['query'][_0x2f8b('0x40')]+'%'};return _0xa1d8de;}})});}_0x2cfbea=_[_0x2f8b('0x3f')]({},_0x2cfbea,_0x72b23b['options']);var _0x92b37a={'where':_0x2cfbea['where']};return db[_0x2f8b('0x41')][_0x2f8b('0x21')](_0x92b37a)['then'](function(_0x9030da){_0x5207a8[_0x2f8b('0x21')]=_0x9030da;if(_0x72b23b[_0x2f8b('0x33')]['includeAll']){_0x2cfbea[_0x2f8b('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2f8b('0x43')](_0x2cfbea);})[_0x2f8b('0x44')](function(_0x1ff6e7){_0x5207a8[_0x2f8b('0x45')]=_0x1ff6e7;return _0x5207a8;})[_0x2f8b('0x44')](respondWithFilteredResult(_0x4adacd,_0x2cfbea))[_0x2f8b('0x46')](handleError(_0x4adacd,null));};exports[_0x2f8b('0x47')]=function(_0xa2fc94,_0x1c0b64){var _0x40577c={'raw':!![],'where':{'id':_0xa2fc94[_0x2f8b('0x48')]['id']}},_0x45c92c={};_0x45c92c[_0x2f8b('0x32')]=_[_0x2f8b('0x34')](db[_0x2f8b('0x41')][_0x2f8b('0x2e')]);_0x45c92c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0xa2fc94[_0x2f8b('0x33')]);_0x45c92c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x45c92c[_0x2f8b('0x32')],_0x45c92c[_0x2f8b('0x33')]);_0x40577c[_0x2f8b('0x37')]=_[_0x2f8b('0x36')](_0x45c92c['model'],qs['fields'](_0xa2fc94['query'][_0x2f8b('0x38')]));_0x40577c['attributes']=_0x40577c[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x40577c[_0x2f8b('0x37')]:_0x45c92c['model'];if(_0xa2fc94[_0x2f8b('0x33')]['includeAll']){_0x40577c[_0x2f8b('0x42')]=[{'all':!![]}];}_0x40577c=_['merge']({},_0x40577c,_0xa2fc94[_0x2f8b('0x49')]);return db[_0x2f8b('0x41')]['find'](_0x40577c)[_0x2f8b('0x44')](handleEntityNotFound(_0x1c0b64,null))[_0x2f8b('0x44')](respondWithResult(_0x1c0b64,null))[_0x2f8b('0x46')](handleError(_0x1c0b64,null));};exports[_0x2f8b('0x4a')]=function(_0x1e6ac2,_0x465d59){return db[_0x2f8b('0x41')][_0x2f8b('0x4a')](_0x1e6ac2[_0x2f8b('0x4b')],{})['then'](respondWithResult(_0x465d59,0xc9))[_0x2f8b('0x46')](handleError(_0x465d59,null));};exports[_0x2f8b('0x26')]=function(_0x2d79f9,_0x1bb257){if(_0x2d79f9[_0x2f8b('0x4b')]['id']){delete _0x2d79f9['body']['id'];}return db[_0x2f8b('0x41')][_0x2f8b('0x4c')]({'where':{'id':_0x2d79f9[_0x2f8b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bb257,null))[_0x2f8b('0x44')](saveUpdates(_0x2d79f9['body'],null))[_0x2f8b('0x44')](respondWithResult(_0x1bb257,null))[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x27')]=function(_0x3a25bb,_0x17b855){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3a25bb['params']['id']}})[_0x2f8b('0x44')](handleEntityNotFound(_0x17b855,null))[_0x2f8b('0x44')](removeEntity(_0x17b855,null))[_0x2f8b('0x46')](handleError(_0x17b855,null));};exports[_0x2f8b('0x4d')]=function(_0x49e047,_0x5ea07d){return db[_0x2f8b('0x41')][_0x2f8b('0x4d')]()[_0x2f8b('0x44')](respondWithResult(_0x5ea07d,null))[_0x2f8b('0x46')](handleError(_0x5ea07d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c50ef55..48498f0 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 _0xef7d=['exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x2fdd5c,_0x34f668){var _0x129e10=function(_0x1322cb){while(--_0x1322cb){_0x2fdd5c['push'](_0x2fdd5c['shift']());}};_0x129e10(++_0x34f668);}(_0xef7d,0x161));var _0xdef7=function(_0x3ac392,_0x57126b){_0x3ac392=_0x3ac392-0x0;var _0x788ab8=_0xef7d[_0x3ac392];return _0x788ab8;};'use strict';var _=require(_0xdef7('0x0'));var util=require(_0xdef7('0x1'));var logger=require(_0xdef7('0x2'))(_0xdef7('0x3'));var moment=require(_0xdef7('0x4'));var BPromise=require(_0xdef7('0x5'));var rp=require(_0xdef7('0x6'));var fs=require('fs');var path=require(_0xdef7('0x7'));var rimraf=require(_0xdef7('0x8'));var config=require(_0xdef7('0x9'));var attributes=require(_0xdef7('0xa'));module[_0xdef7('0xb')]=function(_0x19c75f,_0x3dc5ec){return _0x19c75f[_0xdef7('0xc')]('JscriptyAnswerReport',attributes,{'tableName':_0xdef7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc251=['JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x16233a,_0x54e4dc){var _0x428060=function(_0x15bb5f){while(--_0x15bb5f){_0x16233a['push'](_0x16233a['shift']());}};_0x428060(++_0x54e4dc);}(_0xc251,0x1b9));var _0x1c25=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xc251[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x1c25('0x0'));var util=require('util');var logger=require(_0x1c25('0x1'))(_0x1c25('0x2'));var moment=require(_0x1c25('0x3'));var BPromise=require(_0x1c25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c25('0x5'));var rimraf=require(_0x1c25('0x6'));var config=require(_0x1c25('0x7'));var attributes=require(_0x1c25('0x8'));module['exports']=function(_0x521b07,_0x1baa2d){return _0x521b07['define'](_0x1c25('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 72d9aba..5f2c2f5 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 _0x5d81=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5d81,0x1b1));var _0x15d8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5d81[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x15d8('0x0'));var util=require('util');var moment=require(_0x15d8('0x1'));var BPromise=require(_0x15d8('0x2'));var rs=require(_0x15d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x15d8('0x5'))(_0x15d8('0x6'));var config=require(_0x15d8('0x7'));var jayson=require(_0x15d8('0x8'));var client=jayson[_0x15d8('0x9')][_0x15d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e71b5,_0x27fd27,_0x2d35bd){return new BPromise(function(_0x217895,_0xf91627){return client[_0x15d8('0xb')](_0x4e71b5,_0x2d35bd)['then'](function(_0x26a1be){logger[_0x15d8('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27fd27,_0x15d8('0xd'));logger[_0x15d8('0xe')](_0x15d8('0xf'),_0x27fd27,_0x15d8('0xd'),JSON[_0x15d8('0x10')](_0x26a1be));if(_0x26a1be[_0x15d8('0x11')]){if(_0x26a1be[_0x15d8('0x11')][_0x15d8('0x12')]===0x1f4){logger[_0x15d8('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27fd27,_0x26a1be[_0x15d8('0x11')][_0x15d8('0x13')]);return _0xf91627(_0x26a1be[_0x15d8('0x11')][_0x15d8('0x13')]);}logger['error'](_0x15d8('0x14'),_0x27fd27,_0x26a1be[_0x15d8('0x11')][_0x15d8('0x13')]);return _0x217895(_0x26a1be[_0x15d8('0x11')]['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x27fd27,_0x15d8('0xd'));_0x217895(_0x26a1be[_0x15d8('0x15')][_0x15d8('0x13')]);}})['catch'](function(_0x49f3d9){logger[_0x15d8('0x11')](_0x15d8('0x14'),_0x27fd27,_0x49f3d9);_0xf91627(_0x49f3d9);});});} \ No newline at end of file +var _0xc453=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x43a78d,_0x54b355){var _0x49824b=function(_0x28fddd){while(--_0x28fddd){_0x43a78d['push'](_0x43a78d['shift']());}};_0x49824b(++_0x54b355);}(_0xc453,0x133));var _0x3c45=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0xc453[_0x36e0e9];return _0x4591f5;};'use strict';var _=require(_0x3c45('0x0'));var util=require(_0x3c45('0x1'));var moment=require(_0x3c45('0x2'));var BPromise=require(_0x3c45('0x3'));var rs=require(_0x3c45('0x4'));var fs=require('fs');var Redis=require(_0x3c45('0x5'));var db=require(_0x3c45('0x6'))['db'];var utils=require(_0x3c45('0x7'));var logger=require(_0x3c45('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c45('0x9'));var client=jayson[_0x3c45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddd56,_0x3cf828,_0xd7b991){return new BPromise(function(_0x409ce4,_0x11ff6c){return client[_0x3c45('0xb')](_0x4ddd56,_0xd7b991)[_0x3c45('0xc')](function(_0x263533){logger['info'](_0x3c45('0xd'),_0x3cf828,'request\x20sent');logger[_0x3c45('0xe')](_0x3c45('0xf'),_0x3cf828,'request\x20sent',JSON[_0x3c45('0x10')](_0x263533));if(_0x263533[_0x3c45('0x11')]){if(_0x263533[_0x3c45('0x11')][_0x3c45('0x12')]===0x1f4){logger[_0x3c45('0x11')](_0x3c45('0xd'),_0x3cf828,_0x263533[_0x3c45('0x11')][_0x3c45('0x13')]);return _0x11ff6c(_0x263533['error'][_0x3c45('0x13')]);}logger['error'](_0x3c45('0xd'),_0x3cf828,_0x263533['error']['message']);return _0x409ce4(_0x263533[_0x3c45('0x11')][_0x3c45('0x13')]);}else{logger[_0x3c45('0x14')](_0x3c45('0xd'),_0x3cf828,_0x3c45('0x15'));_0x409ce4(_0x263533[_0x3c45('0x16')][_0x3c45('0x13')]);}})[_0x3c45('0x17')](function(_0x574a16){logger[_0x3c45('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cf828,_0x574a16);_0x11ff6c(_0x574a16);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 52daf86..bf9e1cf 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 _0x9852=['/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','getSessions','getAnswers','30s','getSummary','post','clone','put'];(function(_0x44abc7,_0x3dfafc){var _0x313b72=function(_0x2c6bbb){while(--_0x2c6bbb){_0x44abc7['push'](_0x44abc7['shift']());}};_0x313b72(++_0x3dfafc);}(_0x9852,0xf5));var _0x2985=function(_0x4012b0,_0x1a6169){_0x4012b0=_0x4012b0-0x0;var _0x43ac67=_0x9852[_0x4012b0];return _0x43ac67;};'use strict';var multer=require(_0x2985('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2985('0x1'));var express=require(_0x2985('0x2'));var router=express[_0x2985('0x3')]();var fs_extra=require(_0x2985('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2985('0x5'));var config=require(_0x2985('0x6'));var controller=require(_0x2985('0x7'));router[_0x2985('0x8')]('/',auth[_0x2985('0x9')](),controller[_0x2985('0xa')]);router[_0x2985('0x8')]('/:id',auth[_0x2985('0x9')](),controller[_0x2985('0xb')]);router[_0x2985('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x2985('0xc')]);router[_0x2985('0x8')]('/:id/answers',auth[_0x2985('0x9')](),controller[_0x2985('0xd')]);router[_0x2985('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x2985('0xe')),controller[_0x2985('0xf')]);router[_0x2985('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2985('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0x2985('0x11')]);router[_0x2985('0x12')](_0x2985('0x13'),auth[_0x2985('0x9')](),controller[_0x2985('0x14')]);router[_0x2985('0x15')](_0x2985('0x13'),auth[_0x2985('0x9')](),controller[_0x2985('0x16')]);module[_0x2985('0x17')]=router; \ No newline at end of file +var _0x9871=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy'];(function(_0x59d2d8,_0x5df195){var _0x14cc62=function(_0x536514){while(--_0x536514){_0x59d2d8['push'](_0x59d2d8['shift']());}};_0x14cc62(++_0x5df195);}(_0x9871,0x68));var _0x1987=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x9871[_0x391c55];return _0xa434e0;};'use strict';var multer=require(_0x1987('0x0'));var util=require(_0x1987('0x1'));var path=require(_0x1987('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1987('0x3'));var auth=require(_0x1987('0x4'));var interaction=require(_0x1987('0x5'));var config=require(_0x1987('0x6'));var controller=require(_0x1987('0x7'));router[_0x1987('0x8')]('/',auth[_0x1987('0x9')](),controller[_0x1987('0xa')]);router[_0x1987('0x8')](_0x1987('0xb'),auth[_0x1987('0x9')](),controller[_0x1987('0xc')]);router[_0x1987('0x8')](_0x1987('0xd'),auth[_0x1987('0x9')](),controller['getSessions']);router[_0x1987('0x8')](_0x1987('0xe'),auth[_0x1987('0x9')](),controller['getAnswers']);router[_0x1987('0x8')](_0x1987('0xf'),auth[_0x1987('0x9')](),timeout(_0x1987('0x10')),controller[_0x1987('0x11')]);router['post']('/',auth[_0x1987('0x9')](),controller[_0x1987('0x12')]);router[_0x1987('0x13')](_0x1987('0x14'),auth[_0x1987('0x9')](),controller[_0x1987('0x15')]);router[_0x1987('0x16')]('/:id',auth[_0x1987('0x9')](),controller[_0x1987('0x17')]);router[_0x1987('0x18')](_0x1987('0xb'),auth[_0x1987('0x9')](),controller[_0x1987('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 18ec995..4844525 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 _0x0ad5=['format','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x962590,_0x17ece8){var _0xf0a80=function(_0x17cb19){while(--_0x17cb19){_0x962590['push'](_0x962590['shift']());}};_0xf0a80(++_0x17ece8);}(_0x0ad5,0x1f4));var _0x50ad=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0ad5[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x50ad('0x0'));var _=require(_0x50ad('0x1'));var util=require('util');module[_0x50ad('0x2')]={'name':{'type':Sequelize[_0x50ad('0x3')],'unique':_0x50ad('0x4')},'description':{'type':Sequelize[_0x50ad('0x3')]},'formData':{'type':Sequelize[_0x50ad('0x5')](_0x50ad('0x6')),'set':function(_0x3cac89){if(_[_0x50ad('0x7')](_0x3cac89)){this[_0x50ad('0x8')](_0x50ad('0x9'),JSON[_0x50ad('0xa')](_0x3cac89));}else if(_[_0x50ad('0xb')](_0x3cac89)){this[_0x50ad('0x8')](_0x50ad('0x9'),_0x3cac89);}else{this[_0x50ad('0x8')](_0x50ad('0x9'),util[_0x50ad('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x50ad('0xd')]('name')||'',this[_0x50ad('0xd')](_0x50ad('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x50ad('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xf881=['lodash','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x4984f6,_0x1e153e){var _0x3fe74=function(_0x59b150){while(--_0x59b150){_0x4984f6['push'](_0x4984f6['shift']());}};_0x3fe74(++_0x1e153e);}(_0xf881,0xc2));var _0x1f88=function(_0x71430b,_0x224419){_0x71430b=_0x71430b-0x0;var _0x5d5f14=_0xf881[_0x71430b];return _0x5d5f14;};'use strict';var Sequelize=require(_0x1f88('0x0'));var _=require(_0x1f88('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x1f88('0x2')],'unique':_0x1f88('0x3')},'description':{'type':Sequelize[_0x1f88('0x2')]},'formData':{'type':Sequelize[_0x1f88('0x4')]('long'),'set':function(_0xfb9e9){if(_[_0x1f88('0x5')](_0xfb9e9)){this[_0x1f88('0x6')](_0x1f88('0x7'),JSON[_0x1f88('0x8')](_0xfb9e9));}else if(_[_0x1f88('0x9')](_0xfb9e9)){this[_0x1f88('0x6')](_0x1f88('0x7'),_0xfb9e9);}else{this['setDataValue'](_0x1f88('0x7'),util[_0x1f88('0xa')](_0x1f88('0xb'),this[_0x1f88('0xc')](_0x1f88('0x3'))||'',this['getDataValue'](_0x1f88('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1f88('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1f88('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 3f76015..f6c33e9 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 _0xc698=['-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','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','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','get','UserProfileResource','error','name','send','JscriptyProject','fieldName','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','rawAttributes','length','includeAll','find','catch','create','body','userProfileId','clone','params','omit','createdAt','updatedAt','user','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','findOne','JscriptySessionReport','hasOwnProperty','order','ProjectId','findAll','getAnswers','JscriptyAnswerReport','nolimit','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','JscriptyQuestionReport'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xc698,0x85));var _0x8c69=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xc698[_0x4e4519];return _0x340044;};'use strict';var emlformat=require(_0x8c69('0x0'));var rimraf=require(_0x8c69('0x1'));var zipdir=require(_0x8c69('0x2'));var jsonpatch=require(_0x8c69('0x3'));var rp=require(_0x8c69('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c69('0x5'));var util=require('util');var path=require(_0x8c69('0x6'));var sox=require('sox');var csv=require(_0x8c69('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c69('0x8'));var squel=require(_0x8c69('0x9'));var crypto=require(_0x8c69('0xa'));var jsforce=require(_0x8c69('0xb'));var deskjs=require(_0x8c69('0xc'));var toCsv=require(_0x8c69('0x7'));var querystring=require(_0x8c69('0xd'));var Papa=require(_0x8c69('0xe'));var Redis=require(_0x8c69('0xf'));var authService=require(_0x8c69('0x10'));var qs=require(_0x8c69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c69('0x12'));var logger=require(_0x8c69('0x13'))(_0x8c69('0x14'));var utils=require('../../config/utils');var config=require(_0x8c69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c69('0x16'))['db'];function respondWithStatusCode(_0x5886d3,_0x33e020){_0x33e020=_0x33e020||0xcc;return function(_0x5bbd63){if(_0x5bbd63){return _0x5886d3[_0x8c69('0x17')](_0x33e020);}return _0x5886d3['status'](_0x33e020)[_0x8c69('0x18')]();};}function respondWithResult(_0x44fd99,_0x5e8143){_0x5e8143=_0x5e8143||0xc8;return function(_0x1147cb){if(_0x1147cb){return _0x44fd99['status'](_0x5e8143)[_0x8c69('0x19')](_0x1147cb);}};}function respondWithFilteredResult(_0x30254b,_0x11f45f){return function(_0x3a765c){if(_0x3a765c){var _0x557918=typeof _0x11f45f[_0x8c69('0x1a')]===_0x8c69('0x1b')&&typeof _0x11f45f[_0x8c69('0x1c')]==='undefined';var _0x3cde3f=_0x3a765c[_0x8c69('0x1d')];var _0xfc7224=_0x557918?0x0:_0x11f45f[_0x8c69('0x1a')];var _0x5a816c=_0x557918?_0x3a765c[_0x8c69('0x1d')]:_0x11f45f[_0x8c69('0x1a')]+_0x11f45f[_0x8c69('0x1c')];var _0x32b90d;if(_0x5a816c>=_0x3cde3f){_0x5a816c=_0x3cde3f;_0x32b90d=0xc8;}else{_0x32b90d=0xce;}_0x30254b[_0x8c69('0x1e')](_0x32b90d);return _0x30254b['set'](_0x8c69('0x1f'),_0xfc7224+'-'+_0x5a816c+'/'+_0x3cde3f)['json'](_0x3a765c);}return null;};}function patchUpdates(_0x5bd3bf){return function(_0x2b2bbe){try{jsonpatch[_0x8c69('0x20')](_0x2b2bbe,_0x5bd3bf,!![]);}catch(_0x34229b){return BPromise[_0x8c69('0x21')](_0x34229b);}return _0x2b2bbe['save']();};}function saveUpdates(_0x327ce4,_0x34d2fd){return function(_0x9718bf){if(_0x9718bf){return _0x9718bf[_0x8c69('0x22')](_0x327ce4)[_0x8c69('0x23')](function(_0x160810){return _0x160810;});}return null;};}function removeEntity(_0x47c56c,_0x3fdadd){return function(_0x2590d6){if(_0x2590d6){return _0x2590d6['destroy']()[_0x8c69('0x23')](function(){var _0x2ee467=_0x2590d6[_0x8c69('0x24')]({'plain':!![]});var _0x5373b7='Projects';return db[_0x8c69('0x25')]['destroy']({'where':{'type':_0x5373b7,'resourceId':_0x2ee467['id']}})['then'](function(){return _0x2590d6;});})['then'](function(){_0x47c56c[_0x8c69('0x1e')](0xcc)[_0x8c69('0x18')]();});}};}function handleEntityNotFound(_0xa3d4df,_0x1383a0){return function(_0x1f0837){if(!_0x1f0837){_0xa3d4df[_0x8c69('0x17')](0x194);}return _0x1f0837;};}function handleError(_0x2d144f,_0x30d2ef){_0x30d2ef=_0x30d2ef||0x1f4;return function(_0x41e7b5){logger[_0x8c69('0x26')](_0x41e7b5['stack']);if(_0x41e7b5[_0x8c69('0x27')]){delete _0x41e7b5[_0x8c69('0x27')];}_0x2d144f[_0x8c69('0x1e')](_0x30d2ef)[_0x8c69('0x28')](_0x41e7b5);};}exports['index']=function(_0x392eac,_0x98354){var _0x51d0dd={},_0x3aad39={},_0x4e4e6a={'count':0x0,'rows':[]};var _0x2e0c47=_['map'](db[_0x8c69('0x29')]['rawAttributes'],function(_0x51a49b){return{'name':_0x51a49b[_0x8c69('0x2a')],'type':_0x51a49b['type'][_0x8c69('0x2b')]};});_0x3aad39[_0x8c69('0x2c')]=_['map'](_0x2e0c47,_0x8c69('0x27'));_0x3aad39[_0x8c69('0x2d')]=_[_0x8c69('0x2e')](_0x392eac[_0x8c69('0x2d')]);_0x3aad39[_0x8c69('0x2f')]=_[_0x8c69('0x30')](_0x3aad39['model'],_0x3aad39[_0x8c69('0x2d')]);_0x51d0dd[_0x8c69('0x31')]=_[_0x8c69('0x30')](_0x3aad39[_0x8c69('0x2c')],qs['fields'](_0x392eac[_0x8c69('0x2d')][_0x8c69('0x32')]));_0x51d0dd['attributes']=_0x51d0dd['attributes']['length']?_0x51d0dd['attributes']:_0x3aad39[_0x8c69('0x2c')];if(!_0x392eac[_0x8c69('0x2d')]['hasOwnProperty']('nolimit')){_0x51d0dd['limit']=qs[_0x8c69('0x1c')](_0x392eac[_0x8c69('0x2d')]['limit']);_0x51d0dd['offset']=qs[_0x8c69('0x1a')](_0x392eac[_0x8c69('0x2d')][_0x8c69('0x1a')]);}_0x51d0dd['order']=qs[_0x8c69('0x33')](_0x392eac[_0x8c69('0x2d')][_0x8c69('0x33')]);_0x51d0dd[_0x8c69('0x34')]=qs[_0x8c69('0x2f')](_[_0x8c69('0x35')](_0x392eac[_0x8c69('0x2d')],_0x3aad39['filters']),_0x2e0c47);if(_0x392eac[_0x8c69('0x2d')][_0x8c69('0x36')]){_0x51d0dd['where']=_[_0x8c69('0x37')](_0x51d0dd[_0x8c69('0x34')],{'$or':_[_0x8c69('0x38')](_0x2e0c47,function(_0x18726c){if(_0x18726c['type']!==_0x8c69('0x39')){var _0xc60b17={};_0xc60b17[_0x18726c[_0x8c69('0x27')]]={'$like':'%'+_0x392eac[_0x8c69('0x2d')]['filter']+'%'};return _0xc60b17;}})});}_0x51d0dd=_[_0x8c69('0x37')]({},_0x51d0dd,_0x392eac[_0x8c69('0x3a')]);var _0x28dfbc={'where':_0x51d0dd[_0x8c69('0x34')]};return db[_0x8c69('0x29')][_0x8c69('0x1d')](_0x28dfbc)[_0x8c69('0x23')](function(_0x575172){_0x4e4e6a[_0x8c69('0x1d')]=_0x575172;if(_0x392eac['query']['includeAll']){_0x51d0dd[_0x8c69('0x3b')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x51d0dd);})['then'](function(_0x458b02){_0x4e4e6a[_0x8c69('0x3c')]=_0x458b02;return _0x4e4e6a;})[_0x8c69('0x23')](respondWithFilteredResult(_0x98354,_0x51d0dd))['catch'](handleError(_0x98354,null));};exports['show']=function(_0x5b5208,_0x27f9a1){var _0x4848ce={'raw':![],'where':{'id':_0x5b5208['params']['id']}},_0x575a09={};_0x575a09[_0x8c69('0x2c')]=_[_0x8c69('0x2e')](db[_0x8c69('0x29')][_0x8c69('0x3d')]);_0x575a09[_0x8c69('0x2d')]=_['keys'](_0x5b5208['query']);_0x575a09[_0x8c69('0x2f')]=_[_0x8c69('0x30')](_0x575a09[_0x8c69('0x2c')],_0x575a09[_0x8c69('0x2d')]);_0x4848ce[_0x8c69('0x31')]=_['intersection'](_0x575a09[_0x8c69('0x2c')],qs['fields'](_0x5b5208[_0x8c69('0x2d')][_0x8c69('0x32')]));_0x4848ce['attributes']=_0x4848ce[_0x8c69('0x31')][_0x8c69('0x3e')]?_0x4848ce[_0x8c69('0x31')]:_0x575a09[_0x8c69('0x2c')];if(_0x5b5208['query'][_0x8c69('0x3f')]){_0x4848ce[_0x8c69('0x3b')]=[{'all':!![]}];}_0x4848ce=_[_0x8c69('0x37')]({},_0x4848ce,_0x5b5208[_0x8c69('0x3a')]);return db[_0x8c69('0x29')][_0x8c69('0x40')](_0x4848ce)[_0x8c69('0x23')](handleEntityNotFound(_0x27f9a1,null))[_0x8c69('0x23')](respondWithResult(_0x27f9a1,null))[_0x8c69('0x41')](handleError(_0x27f9a1,null));};exports[_0x8c69('0x42')]=function(_0x1d91d0,_0x24d840){return db['JscriptyProject'][_0x8c69('0x42')](_0x1d91d0[_0x8c69('0x43')],{})['then'](function(_0x5e77e5){var _0x2406d9=_0x1d91d0['user'][_0x8c69('0x24')]({'plain':!![]});if(!_0x2406d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2406d9['role']==='user'){var _0x51549a=_0x5e77e5[_0x8c69('0x24')]({'plain':!![]});var _0x43a924='Projects';return db['UserProfileSection'][_0x8c69('0x40')]({'where':{'name':_0x43a924,'userProfileId':_0x2406d9[_0x8c69('0x44')]},'raw':!![]})['then'](function(_0x387878){if(_0x387878&&_0x387878['autoAssociation']===0x0){return db[_0x8c69('0x25')][_0x8c69('0x42')]({'name':_0x51549a['name'],'resourceId':_0x51549a['id'],'type':_0x387878[_0x8c69('0x27')],'sectionId':_0x387878['id']},{})[_0x8c69('0x23')](function(){return _0x5e77e5;});}else{return _0x5e77e5;}})[_0x8c69('0x41')](function(_0x2de454){logger[_0x8c69('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2de454);throw _0x2de454;});}return _0x5e77e5;})[_0x8c69('0x23')](respondWithResult(_0x24d840,0xc9))[_0x8c69('0x41')](handleError(_0x24d840,null));};exports[_0x8c69('0x45')]=function(_0x3c58b1,_0x2c1d04){var _0x4f806e={'where':{'id':_0x3c58b1[_0x8c69('0x46')]['id']}},_0xdd7326={};_0xdd7326[_0x8c69('0x2c')]=_[_0x8c69('0x2e')](db[_0x8c69('0x29')][_0x8c69('0x3d')]);_0x4f806e[_0x8c69('0x31')]=_[_0x8c69('0x30')](_0xdd7326[_0x8c69('0x2c')],qs['fields'](_0x3c58b1[_0x8c69('0x2d')][_0x8c69('0x32')]));_0x4f806e['attributes']=_0x4f806e[_0x8c69('0x31')][_0x8c69('0x3e')]?_0x4f806e[_0x8c69('0x31')]:_0xdd7326[_0x8c69('0x2c')];if(_0x3c58b1[_0x8c69('0x2d')][_0x8c69('0x3f')]){_0x4f806e[_0x8c69('0x3b')]=[{'all':!![]}];}_0x4f806e=_[_0x8c69('0x37')]({},_0x4f806e,_0x3c58b1[_0x8c69('0x3a')]);return db[_0x8c69('0x29')][_0x8c69('0x40')](_0x4f806e)[_0x8c69('0x23')](handleEntityNotFound(_0x2c1d04,null))[_0x8c69('0x23')](function(_0x46c0eb){if(_0x46c0eb){var _0x5aeb05=_0x46c0eb[_0x8c69('0x24')]({'plain':!![]});_0x5aeb05=qs[_0x8c69('0x47')](_0x5aeb05,['id',_0x8c69('0x48'),'updatedAt']);_0x3c58b1[_0x8c69('0x43')]=_['omit'](_0x3c58b1[_0x8c69('0x43')],['id',_0x8c69('0x48'),_0x8c69('0x49')]);return db['JscriptyProject']['create'](_[_0x8c69('0x37')](_0x5aeb05,_0x3c58b1['body']),{'include':_0x3c58b1[_0x8c69('0x2d')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5485c8){var _0x33787b=_0x3c58b1[_0x8c69('0x4a')][_0x8c69('0x24')]({'plain':!![]});if(!_0x33787b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33787b['role']===_0x8c69('0x4a')){var _0x411ac8=_0x5485c8[_0x8c69('0x24')]({'plain':!![]});var _0x3974c1=_0x8c69('0x4b');return db[_0x8c69('0x4c')][_0x8c69('0x40')]({'where':{'name':_0x3974c1,'userProfileId':_0x33787b[_0x8c69('0x44')]},'raw':!![]})['then'](function(_0x1a1736){if(_0x1a1736&&_0x1a1736[_0x8c69('0x4d')]===0x0){return db[_0x8c69('0x25')][_0x8c69('0x42')]({'name':_0x411ac8[_0x8c69('0x27')],'resourceId':_0x411ac8['id'],'type':_0x1a1736[_0x8c69('0x27')],'sectionId':_0x1a1736['id']},{})[_0x8c69('0x23')](function(){return _0x5485c8;});}else{return _0x5485c8;}})['catch'](function(_0x282bff){logger[_0x8c69('0x26')](_0x8c69('0x4e'),_0x282bff);throw _0x282bff;});}return _0x5485c8;});}})[_0x8c69('0x23')](respondWithResult(_0x2c1d04,0xc9))[_0x8c69('0x41')](handleError(_0x2c1d04,null));};exports[_0x8c69('0x22')]=function(_0x19196b,_0x33e3d1){if(_0x19196b[_0x8c69('0x43')]['id']){delete _0x19196b[_0x8c69('0x43')]['id'];}return db[_0x8c69('0x29')][_0x8c69('0x40')]({'where':{'id':_0x19196b[_0x8c69('0x46')]['id']}})[_0x8c69('0x23')](handleEntityNotFound(_0x33e3d1,null))[_0x8c69('0x23')](saveUpdates(_0x19196b['body'],null))[_0x8c69('0x23')](respondWithResult(_0x33e3d1,null))[_0x8c69('0x41')](handleError(_0x33e3d1,null));};exports[_0x8c69('0x4f')]=function(_0x48f1ca,_0x839ba6){return db[_0x8c69('0x29')][_0x8c69('0x40')]({'where':{'id':_0x48f1ca[_0x8c69('0x46')]['id']}})[_0x8c69('0x23')](handleEntityNotFound(_0x839ba6,null))[_0x8c69('0x23')](removeEntity(_0x839ba6,null))['catch'](handleError(_0x839ba6,null));};exports['getSessions']=function(_0x2ca068,_0x250b3f,_0x38f9cd){var _0x3f8c97={'raw':!![],'where':{}};var _0x1d6500={};var _0x36e3c8={'count':0x0,'rows':[]};return db[_0x8c69('0x29')][_0x8c69('0x50')]({'where':{'id':_0x2ca068[_0x8c69('0x46')]['id']}})[_0x8c69('0x23')](handleEntityNotFound(_0x250b3f,null))['then'](function(_0x310d64){if(_0x310d64){_0x1d6500[_0x8c69('0x2c')]=_['keys'](db[_0x8c69('0x51')][_0x8c69('0x3d')]);_0x1d6500[_0x8c69('0x2d')]=_[_0x8c69('0x2e')](_0x2ca068[_0x8c69('0x2d')]);_0x1d6500[_0x8c69('0x2f')]=_[_0x8c69('0x30')](_0x1d6500[_0x8c69('0x2c')],_0x1d6500[_0x8c69('0x2d')]);_0x3f8c97['attributes']=_[_0x8c69('0x30')](_0x1d6500[_0x8c69('0x2c')],qs[_0x8c69('0x32')](_0x2ca068[_0x8c69('0x2d')][_0x8c69('0x32')]));_0x3f8c97['attributes']=_0x3f8c97[_0x8c69('0x31')][_0x8c69('0x3e')]?_0x3f8c97[_0x8c69('0x31')]:_0x1d6500['model'];if(!_0x2ca068['query'][_0x8c69('0x52')]('nolimit')){_0x3f8c97[_0x8c69('0x1c')]=qs[_0x8c69('0x1c')](_0x2ca068['query'][_0x8c69('0x1c')]);_0x3f8c97[_0x8c69('0x1a')]=qs[_0x8c69('0x1a')](_0x2ca068[_0x8c69('0x2d')][_0x8c69('0x1a')]);}_0x3f8c97[_0x8c69('0x53')]=qs[_0x8c69('0x33')](_0x2ca068[_0x8c69('0x2d')][_0x8c69('0x33')]);_0x3f8c97[_0x8c69('0x34')]=qs[_0x8c69('0x2f')](_['pick'](_0x2ca068[_0x8c69('0x2d')],_0x1d6500[_0x8c69('0x2f')]));_0x3f8c97[_0x8c69('0x34')][_0x8c69('0x54')]=_0x310d64['id'];if(_0x2ca068[_0x8c69('0x2d')]['filter']){_0x3f8c97[_0x8c69('0x34')]=_[_0x8c69('0x37')](_0x3f8c97[_0x8c69('0x34')],{'$or':_[_0x8c69('0x38')](_0x3f8c97['attributes'],function(_0x502e84){var _0x2df708={};_0x2df708[_0x502e84]={'$like':'%'+_0x2ca068[_0x8c69('0x2d')][_0x8c69('0x36')]+'%'};return _0x2df708;})});}_0x3f8c97=_[_0x8c69('0x37')]({},_0x3f8c97,_0x2ca068[_0x8c69('0x3a')]);return db[_0x8c69('0x51')][_0x8c69('0x1d')]({'where':_0x3f8c97[_0x8c69('0x34')]})[_0x8c69('0x23')](function(_0x31cee1){_0x36e3c8[_0x8c69('0x1d')]=_0x31cee1;if(_0x2ca068['query'][_0x8c69('0x3f')]){_0x3f8c97[_0x8c69('0x3b')]=[{'all':!![]}];}return db[_0x8c69('0x51')][_0x8c69('0x55')](_0x3f8c97);})[_0x8c69('0x23')](function(_0x2ca340){_0x36e3c8[_0x8c69('0x3c')]=_0x2ca340;return _0x36e3c8;});}})[_0x8c69('0x23')](respondWithFilteredResult(_0x250b3f,_0x3f8c97))[_0x8c69('0x41')](handleError(_0x250b3f,null));};exports[_0x8c69('0x56')]=function(_0xf075e5,_0x36bc4d,_0x4e6d85){var _0x5039dd={'raw':!![],'where':{}};var _0x7e61b7={};var _0x4795a6={'count':0x0,'rows':[]};return db[_0x8c69('0x29')][_0x8c69('0x50')]({'where':{'id':_0xf075e5[_0x8c69('0x46')]['id']}})['then'](handleEntityNotFound(_0x36bc4d,null))[_0x8c69('0x23')](function(_0x53c460){if(_0x53c460){_0x7e61b7[_0x8c69('0x2c')]=_[_0x8c69('0x2e')](db[_0x8c69('0x57')]['rawAttributes']);_0x7e61b7['query']=_[_0x8c69('0x2e')](_0xf075e5[_0x8c69('0x2d')]);_0x7e61b7[_0x8c69('0x2f')]=_['intersection'](_0x7e61b7['model'],_0x7e61b7[_0x8c69('0x2d')]);_0x5039dd[_0x8c69('0x31')]=_[_0x8c69('0x30')](_0x7e61b7[_0x8c69('0x2c')],qs['fields'](_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x32')]));_0x5039dd[_0x8c69('0x31')]=_0x5039dd[_0x8c69('0x31')][_0x8c69('0x3e')]?_0x5039dd[_0x8c69('0x31')]:_0x7e61b7[_0x8c69('0x2c')];if(!_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x52')](_0x8c69('0x58'))){_0x5039dd[_0x8c69('0x1c')]=qs[_0x8c69('0x1c')](_0xf075e5['query'][_0x8c69('0x1c')]);_0x5039dd[_0x8c69('0x1a')]=qs['offset'](_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x1a')]);}_0x5039dd['order']=qs[_0x8c69('0x33')](_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x33')]);_0x5039dd[_0x8c69('0x34')]=qs[_0x8c69('0x2f')](_[_0x8c69('0x35')](_0xf075e5[_0x8c69('0x2d')],_0x7e61b7[_0x8c69('0x2f')]));_0x5039dd[_0x8c69('0x34')]['ProjectId']=_0x53c460['id'];if(_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x36')]){_0x5039dd[_0x8c69('0x34')]=_['merge'](_0x5039dd[_0x8c69('0x34')],{'$or':_[_0x8c69('0x38')](_0x5039dd[_0x8c69('0x31')],function(_0x35a352){var _0x6e193={};_0x6e193[_0x35a352]={'$like':'%'+_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x36')]+'%'};return _0x6e193;})});}_0x5039dd=_['merge']({},_0x5039dd,_0xf075e5[_0x8c69('0x3a')]);return db[_0x8c69('0x57')][_0x8c69('0x1d')]({'where':_0x5039dd[_0x8c69('0x34')]})[_0x8c69('0x23')](function(_0x181009){_0x4795a6[_0x8c69('0x1d')]=_0x181009;if(_0xf075e5[_0x8c69('0x2d')][_0x8c69('0x3f')]){_0x5039dd[_0x8c69('0x3b')]=[{'all':!![]}];}return db[_0x8c69('0x57')][_0x8c69('0x55')](_0x5039dd);})[_0x8c69('0x23')](function(_0x34e44a){_0x4795a6[_0x8c69('0x3c')]=_0x34e44a;return _0x4795a6;});}})[_0x8c69('0x23')](respondWithFilteredResult(_0x36bc4d,_0x5039dd))[_0x8c69('0x41')](handleError(_0x36bc4d,null));};function char(_0x35aaa1){return _0x8c69('0x59')===typeof _0x35aaa1?String[_0x8c69('0x5a')][_0x8c69('0x20')](null,arguments):_0x35aaa1;}function needsEncapsulation(_0x40b795){return!!_0x40b795&&(_0x40b795['toString']()[_0x8c69('0x5b')](char(0xd))>=0x0||_0x40b795[_0x8c69('0x5c')]()[_0x8c69('0x5b')](char(0xa))>=0x0||_0x40b795[_0x8c69('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x40b795[_0x8c69('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x12ecc7){var _0x3fafd7=char(0x22),_0x315cd1='\x5c'+char(0x22),_0x2215ef=_0x12ecc7['toString']()[_0x8c69('0x5d')](new RegExp(_0x3fafd7,'g'),_0x315cd1);return _0x3fafd7+_0x2215ef+_0x3fafd7;}exports[_0x8c69('0x5e')]=function(_0x1a3671,_0x2e1a35,_0x500182){var _0x2b2c42,_0x14aecd;var _0x22d6a3={'where':{'ProjectId':_0x1a3671[_0x8c69('0x46')]['id']}};if(_0x1a3671[_0x8c69('0x2d')][_0x8c69('0x5f')]){_0x22d6a3['where']['starttime']=JSON['parse'](_0x1a3671[_0x8c69('0x2d')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x22d6a3)[_0x8c69('0x23')](handleEntityNotFound(_0x2e1a35,null))[_0x8c69('0x23')](function(_0x43607f){if(_0x43607f){_0x2b2c42=_0x43607f;return db[_0x8c69('0x60')][_0x8c69('0x55')]({'where':{'SessionId':{'$in':_[_0x8c69('0x38')](_0x2b2c42,'id')},'ProjectId':_0x1a3671[_0x8c69('0x46')]['id']},'order':_0x8c69('0x61')});}})[_0x8c69('0x23')](handleEntityNotFound(_0x2e1a35,null))[_0x8c69('0x23')](function(_0x345474){if(_0x345474){_0x14aecd=_0x345474;var _0x2a16a5={};for(var _0x56aeba=0x0,_0x47c168=_0x14aecd['length'];_0x56aeba<_0x47c168;_0x56aeba++){if(!_0x2a16a5[_0x8c69('0x52')](_0x14aecd[_0x56aeba][_0x8c69('0x62')])){_0x2a16a5[_0x14aecd[_0x56aeba][_0x8c69('0x62')]]=needsEncapsulation(_0x14aecd[_0x56aeba][_0x8c69('0x63')])?encapsulate(_0x14aecd[_0x56aeba][_0x8c69('0x63')]):_0x14aecd[_0x56aeba]['question'];}}var _0x410e7a=[],_0x42f11e={};for(var _0x263bf8=0x0,_0x5a9ebc=_0x2b2c42['length'];_0x263bf8<_0x5a9ebc;_0x263bf8++){_0x42f11e={'ProjectId':_0x1a3671[_0x8c69('0x46')]['id'],'SessionId':_0x2b2c42[_0x263bf8]['id'],'StartTime':moment(_0x2b2c42[_0x263bf8][_0x8c69('0x64')])[_0x8c69('0x65')](_0x8c69('0x66'))};for(var _0x17049c=0x0,_0x4756e7=_0x14aecd['length'];_0x17049c<_0x4756e7;_0x17049c++){if(_0x14aecd[_0x17049c][_0x8c69('0x67')]==_0x2b2c42[_0x263bf8]['id']&&_0x2a16a5[_0x8c69('0x52')](_0x14aecd[_0x17049c][_0x8c69('0x62')])){_0x42f11e[_0x2a16a5[_0x14aecd[_0x17049c][_0x8c69('0x62')]]]=_0x14aecd[_0x17049c][_0x8c69('0x68')];}}for(var _0x5deedd in _0x2a16a5){if(!_0x42f11e['hasOwnProperty'](_0x2a16a5[_0x5deedd])){_0x42f11e[_0x2a16a5[_0x5deedd]]=null;}}_0x410e7a[_0x8c69('0x69')](_0x42f11e);}return _0x410e7a;}})[_0x8c69('0x23')](function(_0x18308c){if(!_['isEmpty'](_0x18308c)){var _0xec18ba=toCsv(_0x18308c);var _0x25d041=Date[_0x8c69('0x6a')]();fs[_0x8c69('0x6b')](util['format'](_0x8c69('0x6c'),_0x1a3671[_0x8c69('0x46')]['id'],_0x25d041),_0xec18ba);_0x2e1a35[_0x8c69('0x6d')](_0x8c69('0x6e'),_0x8c69('0x6f')+util[_0x8c69('0x65')](_0x8c69('0x70'),_0x1a3671[_0x8c69('0x46')]['id'],_0x25d041));_0x2e1a35[_0x8c69('0x6d')](_0x8c69('0x71'),'text/csv');return _0x2e1a35[_0x8c69('0x72')](util[_0x8c69('0x65')](_0x8c69('0x6c'),_0x1a3671[_0x8c69('0x46')]['id'],_0x25d041));}else{return _0x2e1a35[_0x8c69('0x17')](0xcc);}})[_0x8c69('0x41')](handleError(_0x2e1a35,null));}; \ No newline at end of file +var _0xe903=['parse','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Projects','UserProfileResource','sendStatus','error','stack','name','index','JscriptyProject','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','ProjectId','findOne','JscriptyAnswerReport','number','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','starttime'];(function(_0x135fb4,_0x50e172){var _0x1b7f11=function(_0x3d10e0){while(--_0x3d10e0){_0x135fb4['push'](_0x135fb4['shift']());}};_0x1b7f11(++_0x50e172);}(_0xe903,0x17d));var _0x3e90=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xe903[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x3e90('0x0'));var rimraf=require(_0x3e90('0x1'));var zipdir=require(_0x3e90('0x2'));var jsonpatch=require(_0x3e90('0x3'));var rp=require(_0x3e90('0x4'));var moment=require('moment');var BPromise=require(_0x3e90('0x5'));var Mustache=require(_0x3e90('0x6'));var util=require(_0x3e90('0x7'));var path=require(_0x3e90('0x8'));var sox=require(_0x3e90('0x9'));var csv=require(_0x3e90('0xa'));var ejs=require(_0x3e90('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e90('0xc'));var deskjs=require(_0x3e90('0xd'));var toCsv=require(_0x3e90('0xa'));var querystring=require(_0x3e90('0xe'));var Papa=require(_0x3e90('0xf'));var Redis=require(_0x3e90('0x10'));var authService=require(_0x3e90('0x11'));var qs=require(_0x3e90('0x12'));var as=require(_0x3e90('0x13'));var hardwareService=require(_0x3e90('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3e90('0x15'));var config=require(_0x3e90('0x16'));var licenseUtil=require(_0x3e90('0x17'));var db=require(_0x3e90('0x18'))['db'];function respondWithStatusCode(_0x1bcba9,_0x431cba){_0x431cba=_0x431cba||0xcc;return function(_0xdc474f){if(_0xdc474f){return _0x1bcba9['sendStatus'](_0x431cba);}return _0x1bcba9[_0x3e90('0x19')](_0x431cba)[_0x3e90('0x1a')]();};}function respondWithResult(_0x119340,_0x2c3f7f){_0x2c3f7f=_0x2c3f7f||0xc8;return function(_0x33d74f){if(_0x33d74f){return _0x119340['status'](_0x2c3f7f)[_0x3e90('0x1b')](_0x33d74f);}};}function respondWithFilteredResult(_0x1a30d0,_0x42b394){return function(_0x142e62){if(_0x142e62){var _0xfab73b=typeof _0x42b394[_0x3e90('0x1c')]===_0x3e90('0x1d')&&typeof _0x42b394[_0x3e90('0x1e')]===_0x3e90('0x1d');var _0x2fb75e=_0x142e62[_0x3e90('0x1f')];var _0x2ed204=_0xfab73b?0x0:_0x42b394['offset'];var _0x45ebb6=_0xfab73b?_0x142e62[_0x3e90('0x1f')]:_0x42b394[_0x3e90('0x1c')]+_0x42b394[_0x3e90('0x1e')];var _0x3c3708;if(_0x45ebb6>=_0x2fb75e){_0x45ebb6=_0x2fb75e;_0x3c3708=0xc8;}else{_0x3c3708=0xce;}_0x1a30d0[_0x3e90('0x19')](_0x3c3708);return _0x1a30d0[_0x3e90('0x20')](_0x3e90('0x21'),_0x2ed204+'-'+_0x45ebb6+'/'+_0x2fb75e)[_0x3e90('0x1b')](_0x142e62);}return null;};}function patchUpdates(_0x1da349){return function(_0x26d54e){try{jsonpatch['apply'](_0x26d54e,_0x1da349,!![]);}catch(_0x245ff4){return BPromise[_0x3e90('0x22')](_0x245ff4);}return _0x26d54e[_0x3e90('0x23')]();};}function saveUpdates(_0x371128,_0x38bf56){return function(_0x4e0924){if(_0x4e0924){return _0x4e0924[_0x3e90('0x24')](_0x371128)[_0x3e90('0x25')](function(_0x16707f){return _0x16707f;});}return null;};}function removeEntity(_0x4a6ead,_0x4cdc09){return function(_0x35a29e){if(_0x35a29e){return _0x35a29e[_0x3e90('0x26')]()['then'](function(){var _0x2ed350=_0x35a29e['get']({'plain':!![]});var _0x420eaf=_0x3e90('0x27');return db[_0x3e90('0x28')]['destroy']({'where':{'type':_0x420eaf,'resourceId':_0x2ed350['id']}})[_0x3e90('0x25')](function(){return _0x35a29e;});})[_0x3e90('0x25')](function(){_0x4a6ead[_0x3e90('0x19')](0xcc)[_0x3e90('0x1a')]();});}};}function handleEntityNotFound(_0x2ac52f,_0x3d3d50){return function(_0x4889db){if(!_0x4889db){_0x2ac52f[_0x3e90('0x29')](0x194);}return _0x4889db;};}function handleError(_0x503cf2,_0x33c3d4){_0x33c3d4=_0x33c3d4||0x1f4;return function(_0x278970){logger[_0x3e90('0x2a')](_0x278970[_0x3e90('0x2b')]);if(_0x278970['name']){delete _0x278970[_0x3e90('0x2c')];}_0x503cf2['status'](_0x33c3d4)['send'](_0x278970);};}exports[_0x3e90('0x2d')]=function(_0xa2c116,_0x2bb1d6){var _0x53ef34={},_0x489a6b={},_0x352859={'count':0x0,'rows':[]};var _0x57ada0=_['map'](db[_0x3e90('0x2e')][_0x3e90('0x2f')],function(_0x290152){return{'name':_0x290152['fieldName'],'type':_0x290152[_0x3e90('0x30')]['key']};});_0x489a6b[_0x3e90('0x31')]=_['map'](_0x57ada0,'name');_0x489a6b['query']=_[_0x3e90('0x32')](_0xa2c116[_0x3e90('0x33')]);_0x489a6b[_0x3e90('0x34')]=_[_0x3e90('0x35')](_0x489a6b['model'],_0x489a6b[_0x3e90('0x33')]);_0x53ef34[_0x3e90('0x36')]=_[_0x3e90('0x35')](_0x489a6b[_0x3e90('0x31')],qs[_0x3e90('0x37')](_0xa2c116[_0x3e90('0x33')][_0x3e90('0x37')]));_0x53ef34[_0x3e90('0x36')]=_0x53ef34[_0x3e90('0x36')][_0x3e90('0x38')]?_0x53ef34[_0x3e90('0x36')]:_0x489a6b[_0x3e90('0x31')];if(!_0xa2c116[_0x3e90('0x33')][_0x3e90('0x39')](_0x3e90('0x3a'))){_0x53ef34[_0x3e90('0x1e')]=qs[_0x3e90('0x1e')](_0xa2c116[_0x3e90('0x33')][_0x3e90('0x1e')]);_0x53ef34[_0x3e90('0x1c')]=qs['offset'](_0xa2c116['query'][_0x3e90('0x1c')]);}_0x53ef34[_0x3e90('0x3b')]=qs[_0x3e90('0x3c')](_0xa2c116[_0x3e90('0x33')][_0x3e90('0x3c')]);_0x53ef34[_0x3e90('0x3d')]=qs[_0x3e90('0x34')](_[_0x3e90('0x3e')](_0xa2c116[_0x3e90('0x33')],_0x489a6b[_0x3e90('0x34')]),_0x57ada0);if(_0xa2c116[_0x3e90('0x33')][_0x3e90('0x3f')]){_0x53ef34[_0x3e90('0x3d')]=_[_0x3e90('0x40')](_0x53ef34[_0x3e90('0x3d')],{'$or':_[_0x3e90('0x41')](_0x57ada0,function(_0x4d7550){if(_0x4d7550[_0x3e90('0x30')]!=='VIRTUAL'){var _0x411354={};_0x411354[_0x4d7550[_0x3e90('0x2c')]]={'$like':'%'+_0xa2c116[_0x3e90('0x33')][_0x3e90('0x3f')]+'%'};return _0x411354;}})});}_0x53ef34=_[_0x3e90('0x40')]({},_0x53ef34,_0xa2c116[_0x3e90('0x42')]);var _0x10dfec={'where':_0x53ef34['where']};return db[_0x3e90('0x2e')][_0x3e90('0x1f')](_0x10dfec)[_0x3e90('0x25')](function(_0x4d5374){_0x352859['count']=_0x4d5374;if(_0xa2c116[_0x3e90('0x33')][_0x3e90('0x43')]){_0x53ef34[_0x3e90('0x44')]=[{'all':!![]}];}return db[_0x3e90('0x2e')][_0x3e90('0x45')](_0x53ef34);})[_0x3e90('0x25')](function(_0x29d354){_0x352859[_0x3e90('0x46')]=_0x29d354;return _0x352859;})[_0x3e90('0x25')](respondWithFilteredResult(_0x2bb1d6,_0x53ef34))[_0x3e90('0x47')](handleError(_0x2bb1d6,null));};exports[_0x3e90('0x48')]=function(_0x2ec424,_0x2602d5){var _0x15c75d={'raw':![],'where':{'id':_0x2ec424[_0x3e90('0x49')]['id']}},_0x4e81e9={};_0x4e81e9['model']=_[_0x3e90('0x32')](db['JscriptyProject'][_0x3e90('0x2f')]);_0x4e81e9['query']=_[_0x3e90('0x32')](_0x2ec424[_0x3e90('0x33')]);_0x4e81e9[_0x3e90('0x34')]=_['intersection'](_0x4e81e9[_0x3e90('0x31')],_0x4e81e9[_0x3e90('0x33')]);_0x15c75d['attributes']=_['intersection'](_0x4e81e9[_0x3e90('0x31')],qs[_0x3e90('0x37')](_0x2ec424['query']['fields']));_0x15c75d[_0x3e90('0x36')]=_0x15c75d[_0x3e90('0x36')][_0x3e90('0x38')]?_0x15c75d[_0x3e90('0x36')]:_0x4e81e9[_0x3e90('0x31')];if(_0x2ec424[_0x3e90('0x33')][_0x3e90('0x43')]){_0x15c75d[_0x3e90('0x44')]=[{'all':!![]}];}_0x15c75d=_[_0x3e90('0x40')]({},_0x15c75d,_0x2ec424[_0x3e90('0x42')]);return db['JscriptyProject']['find'](_0x15c75d)[_0x3e90('0x25')](handleEntityNotFound(_0x2602d5,null))[_0x3e90('0x25')](respondWithResult(_0x2602d5,null))[_0x3e90('0x47')](handleError(_0x2602d5,null));};exports[_0x3e90('0x4a')]=function(_0x1e58a2,_0x4cbc98){return db[_0x3e90('0x2e')][_0x3e90('0x4a')](_0x1e58a2[_0x3e90('0x4b')],{})[_0x3e90('0x25')](function(_0x525b86){var _0x4c245a=_0x1e58a2[_0x3e90('0x4c')][_0x3e90('0x4d')]({'plain':!![]});if(!_0x4c245a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c245a[_0x3e90('0x4e')]===_0x3e90('0x4c')){var _0x859b37=_0x525b86[_0x3e90('0x4d')]({'plain':!![]});var _0x4cb695=_0x3e90('0x27');return db[_0x3e90('0x4f')][_0x3e90('0x50')]({'where':{'name':_0x4cb695,'userProfileId':_0x4c245a[_0x3e90('0x51')]},'raw':!![]})[_0x3e90('0x25')](function(_0x58d204){if(_0x58d204&&_0x58d204[_0x3e90('0x52')]===0x0){return db[_0x3e90('0x28')][_0x3e90('0x4a')]({'name':_0x859b37[_0x3e90('0x2c')],'resourceId':_0x859b37['id'],'type':_0x58d204['name'],'sectionId':_0x58d204['id']},{})[_0x3e90('0x25')](function(){return _0x525b86;});}else{return _0x525b86;}})[_0x3e90('0x47')](function(_0x562c46){logger[_0x3e90('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x562c46);throw _0x562c46;});}return _0x525b86;})[_0x3e90('0x25')](respondWithResult(_0x4cbc98,0xc9))['catch'](handleError(_0x4cbc98,null));};exports[_0x3e90('0x53')]=function(_0x440b98,_0x1e53f3){var _0x188c49={'where':{'id':_0x440b98[_0x3e90('0x49')]['id']}},_0x15a606={};_0x15a606[_0x3e90('0x31')]=_[_0x3e90('0x32')](db[_0x3e90('0x2e')]['rawAttributes']);_0x188c49['attributes']=_[_0x3e90('0x35')](_0x15a606[_0x3e90('0x31')],qs[_0x3e90('0x37')](_0x440b98[_0x3e90('0x33')][_0x3e90('0x37')]));_0x188c49[_0x3e90('0x36')]=_0x188c49[_0x3e90('0x36')][_0x3e90('0x38')]?_0x188c49[_0x3e90('0x36')]:_0x15a606[_0x3e90('0x31')];if(_0x440b98[_0x3e90('0x33')][_0x3e90('0x43')]){_0x188c49[_0x3e90('0x44')]=[{'all':!![]}];}_0x188c49=_['merge']({},_0x188c49,_0x440b98[_0x3e90('0x42')]);return db[_0x3e90('0x2e')][_0x3e90('0x50')](_0x188c49)[_0x3e90('0x25')](handleEntityNotFound(_0x1e53f3,null))[_0x3e90('0x25')](function(_0x534916){if(_0x534916){var _0x2ac793=_0x534916[_0x3e90('0x4d')]({'plain':!![]});_0x2ac793=qs[_0x3e90('0x54')](_0x2ac793,['id','createdAt',_0x3e90('0x55')]);_0x440b98[_0x3e90('0x4b')]=_[_0x3e90('0x54')](_0x440b98[_0x3e90('0x4b')],['id',_0x3e90('0x56'),'updatedAt']);return db['JscriptyProject'][_0x3e90('0x4a')](_[_0x3e90('0x40')](_0x2ac793,_0x440b98[_0x3e90('0x4b')]),{'include':_0x440b98[_0x3e90('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1395fa){var _0x5f4b4a=_0x440b98[_0x3e90('0x4c')][_0x3e90('0x4d')]({'plain':!![]});if(!_0x5f4b4a)throw new Error(_0x3e90('0x57'));if(_0x5f4b4a[_0x3e90('0x4e')]===_0x3e90('0x4c')){var _0x50dd67=_0x1395fa[_0x3e90('0x4d')]({'plain':!![]});var _0x13fe10=_0x3e90('0x27');return db['UserProfileSection'][_0x3e90('0x50')]({'where':{'name':_0x13fe10,'userProfileId':_0x5f4b4a['userProfileId']},'raw':!![]})[_0x3e90('0x25')](function(_0xdeda){if(_0xdeda&&_0xdeda[_0x3e90('0x52')]===0x0){return db[_0x3e90('0x28')]['create']({'name':_0x50dd67[_0x3e90('0x2c')],'resourceId':_0x50dd67['id'],'type':_0xdeda[_0x3e90('0x2c')],'sectionId':_0xdeda['id']},{})[_0x3e90('0x25')](function(){return _0x1395fa;});}else{return _0x1395fa;}})[_0x3e90('0x47')](function(_0x41cc8b){logger[_0x3e90('0x2a')](_0x3e90('0x58'),_0x41cc8b);throw _0x41cc8b;});}return _0x1395fa;});}})[_0x3e90('0x25')](respondWithResult(_0x1e53f3,0xc9))['catch'](handleError(_0x1e53f3,null));};exports['update']=function(_0x44641d,_0x59c740){if(_0x44641d[_0x3e90('0x4b')]['id']){delete _0x44641d[_0x3e90('0x4b')]['id'];}return db['JscriptyProject'][_0x3e90('0x50')]({'where':{'id':_0x44641d[_0x3e90('0x49')]['id']}})[_0x3e90('0x25')](handleEntityNotFound(_0x59c740,null))['then'](saveUpdates(_0x44641d[_0x3e90('0x4b')],null))[_0x3e90('0x25')](respondWithResult(_0x59c740,null))[_0x3e90('0x47')](handleError(_0x59c740,null));};exports[_0x3e90('0x26')]=function(_0x36b9e1,_0x35e800){return db[_0x3e90('0x2e')][_0x3e90('0x50')]({'where':{'id':_0x36b9e1['params']['id']}})['then'](handleEntityNotFound(_0x35e800,null))[_0x3e90('0x25')](removeEntity(_0x35e800,null))[_0x3e90('0x47')](handleError(_0x35e800,null));};exports[_0x3e90('0x59')]=function(_0x2665e9,_0x21cb36,_0x272ade){var _0x6e7c98={'raw':!![],'where':{}};var _0x21beff={};var _0x3c85d5={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x2665e9[_0x3e90('0x49')]['id']}})[_0x3e90('0x25')](handleEntityNotFound(_0x21cb36,null))['then'](function(_0x1ed132){if(_0x1ed132){_0x21beff[_0x3e90('0x31')]=_[_0x3e90('0x32')](db[_0x3e90('0x5a')][_0x3e90('0x2f')]);_0x21beff[_0x3e90('0x33')]=_[_0x3e90('0x32')](_0x2665e9['query']);_0x21beff[_0x3e90('0x34')]=_[_0x3e90('0x35')](_0x21beff['model'],_0x21beff[_0x3e90('0x33')]);_0x6e7c98[_0x3e90('0x36')]=_[_0x3e90('0x35')](_0x21beff[_0x3e90('0x31')],qs[_0x3e90('0x37')](_0x2665e9[_0x3e90('0x33')][_0x3e90('0x37')]));_0x6e7c98[_0x3e90('0x36')]=_0x6e7c98[_0x3e90('0x36')][_0x3e90('0x38')]?_0x6e7c98[_0x3e90('0x36')]:_0x21beff[_0x3e90('0x31')];if(!_0x2665e9[_0x3e90('0x33')]['hasOwnProperty'](_0x3e90('0x3a'))){_0x6e7c98[_0x3e90('0x1e')]=qs[_0x3e90('0x1e')](_0x2665e9[_0x3e90('0x33')][_0x3e90('0x1e')]);_0x6e7c98[_0x3e90('0x1c')]=qs[_0x3e90('0x1c')](_0x2665e9['query'][_0x3e90('0x1c')]);}_0x6e7c98['order']=qs[_0x3e90('0x3c')](_0x2665e9[_0x3e90('0x33')][_0x3e90('0x3c')]);_0x6e7c98['where']=qs[_0x3e90('0x34')](_[_0x3e90('0x3e')](_0x2665e9['query'],_0x21beff[_0x3e90('0x34')]));_0x6e7c98[_0x3e90('0x3d')][_0x3e90('0x5b')]=_0x1ed132['id'];if(_0x2665e9[_0x3e90('0x33')][_0x3e90('0x3f')]){_0x6e7c98[_0x3e90('0x3d')]=_['merge'](_0x6e7c98[_0x3e90('0x3d')],{'$or':_[_0x3e90('0x41')](_0x6e7c98['attributes'],function(_0x56730e){var _0x3ef1b5={};_0x3ef1b5[_0x56730e]={'$like':'%'+_0x2665e9['query'][_0x3e90('0x3f')]+'%'};return _0x3ef1b5;})});}_0x6e7c98=_[_0x3e90('0x40')]({},_0x6e7c98,_0x2665e9[_0x3e90('0x42')]);return db[_0x3e90('0x5a')][_0x3e90('0x1f')]({'where':_0x6e7c98['where']})[_0x3e90('0x25')](function(_0x15d536){_0x3c85d5[_0x3e90('0x1f')]=_0x15d536;if(_0x2665e9[_0x3e90('0x33')][_0x3e90('0x43')]){_0x6e7c98[_0x3e90('0x44')]=[{'all':!![]}];}return db[_0x3e90('0x5a')][_0x3e90('0x45')](_0x6e7c98);})[_0x3e90('0x25')](function(_0x98f3aa){_0x3c85d5[_0x3e90('0x46')]=_0x98f3aa;return _0x3c85d5;});}})['then'](respondWithFilteredResult(_0x21cb36,_0x6e7c98))[_0x3e90('0x47')](handleError(_0x21cb36,null));};exports['getAnswers']=function(_0x196d08,_0x55b74b,_0x109075){var _0x58af27={'raw':!![],'where':{}};var _0x3a64e3={};var _0x4e004d={'count':0x0,'rows':[]};return db[_0x3e90('0x2e')][_0x3e90('0x5c')]({'where':{'id':_0x196d08['params']['id']}})[_0x3e90('0x25')](handleEntityNotFound(_0x55b74b,null))[_0x3e90('0x25')](function(_0x38a0c6){if(_0x38a0c6){_0x3a64e3[_0x3e90('0x31')]=_[_0x3e90('0x32')](db[_0x3e90('0x5d')][_0x3e90('0x2f')]);_0x3a64e3['query']=_['keys'](_0x196d08[_0x3e90('0x33')]);_0x3a64e3[_0x3e90('0x34')]=_[_0x3e90('0x35')](_0x3a64e3[_0x3e90('0x31')],_0x3a64e3['query']);_0x58af27[_0x3e90('0x36')]=_[_0x3e90('0x35')](_0x3a64e3[_0x3e90('0x31')],qs[_0x3e90('0x37')](_0x196d08[_0x3e90('0x33')][_0x3e90('0x37')]));_0x58af27['attributes']=_0x58af27['attributes'][_0x3e90('0x38')]?_0x58af27[_0x3e90('0x36')]:_0x3a64e3[_0x3e90('0x31')];if(!_0x196d08[_0x3e90('0x33')][_0x3e90('0x39')](_0x3e90('0x3a'))){_0x58af27[_0x3e90('0x1e')]=qs[_0x3e90('0x1e')](_0x196d08[_0x3e90('0x33')][_0x3e90('0x1e')]);_0x58af27[_0x3e90('0x1c')]=qs[_0x3e90('0x1c')](_0x196d08[_0x3e90('0x33')][_0x3e90('0x1c')]);}_0x58af27[_0x3e90('0x3b')]=qs[_0x3e90('0x3c')](_0x196d08[_0x3e90('0x33')][_0x3e90('0x3c')]);_0x58af27[_0x3e90('0x3d')]=qs[_0x3e90('0x34')](_[_0x3e90('0x3e')](_0x196d08[_0x3e90('0x33')],_0x3a64e3[_0x3e90('0x34')]));_0x58af27[_0x3e90('0x3d')]['ProjectId']=_0x38a0c6['id'];if(_0x196d08[_0x3e90('0x33')][_0x3e90('0x3f')]){_0x58af27[_0x3e90('0x3d')]=_[_0x3e90('0x40')](_0x58af27[_0x3e90('0x3d')],{'$or':_[_0x3e90('0x41')](_0x58af27[_0x3e90('0x36')],function(_0x3375c7){var _0x42b2f8={};_0x42b2f8[_0x3375c7]={'$like':'%'+_0x196d08[_0x3e90('0x33')][_0x3e90('0x3f')]+'%'};return _0x42b2f8;})});}_0x58af27=_[_0x3e90('0x40')]({},_0x58af27,_0x196d08[_0x3e90('0x42')]);return db[_0x3e90('0x5d')]['count']({'where':_0x58af27['where']})[_0x3e90('0x25')](function(_0x17c538){_0x4e004d['count']=_0x17c538;if(_0x196d08[_0x3e90('0x33')][_0x3e90('0x43')]){_0x58af27[_0x3e90('0x44')]=[{'all':!![]}];}return db[_0x3e90('0x5d')][_0x3e90('0x45')](_0x58af27);})[_0x3e90('0x25')](function(_0x3b74a3){_0x4e004d['rows']=_0x3b74a3;return _0x4e004d;});}})['then'](respondWithFilteredResult(_0x55b74b,_0x58af27))[_0x3e90('0x47')](handleError(_0x55b74b,null));};function char(_0x2a812b){return _0x3e90('0x5e')===typeof _0x2a812b?String[_0x3e90('0x5f')][_0x3e90('0x60')](null,arguments):_0x2a812b;}function needsEncapsulation(_0x4b7481){return!!_0x4b7481&&(_0x4b7481['toString']()[_0x3e90('0x61')](char(0xd))>=0x0||_0x4b7481[_0x3e90('0x62')]()[_0x3e90('0x61')](char(0xa))>=0x0||_0x4b7481[_0x3e90('0x62')]()[_0x3e90('0x61')](char(0x2c))>=0x0||_0x4b7481[_0x3e90('0x62')]()[_0x3e90('0x61')](char(0x22))>=0x0);}function encapsulate(_0x32e1d4){var _0x5a62a2=char(0x22),_0xf3c53f='\x5c'+char(0x22),_0x447c1d=_0x32e1d4['toString']()[_0x3e90('0x63')](new RegExp(_0x5a62a2,'g'),_0xf3c53f);return _0x5a62a2+_0x447c1d+_0x5a62a2;}exports[_0x3e90('0x64')]=function(_0x4b3390,_0xf639f0,_0x557442){var _0x1d169a,_0x30d804;var _0x5cf374={'where':{'ProjectId':_0x4b3390[_0x3e90('0x49')]['id']}};if(_0x4b3390['query'][_0x3e90('0x65')]){_0x5cf374[_0x3e90('0x3d')][_0x3e90('0x66')]=JSON[_0x3e90('0x67')](_0x4b3390[_0x3e90('0x33')][_0x3e90('0x65')]);}return db[_0x3e90('0x5a')]['findAll'](_0x5cf374)[_0x3e90('0x25')](handleEntityNotFound(_0xf639f0,null))['then'](function(_0x883461){if(_0x883461){_0x1d169a=_0x883461;return db[_0x3e90('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0x3e90('0x41')](_0x1d169a,'id')},'ProjectId':_0x4b3390[_0x3e90('0x49')]['id']},'order':_0x3e90('0x69')});}})[_0x3e90('0x25')](handleEntityNotFound(_0xf639f0,null))[_0x3e90('0x25')](function(_0x1085b7){if(_0x1085b7){_0x30d804=_0x1085b7;var _0x260487={};for(var _0x523538=0x0,_0x2caab0=_0x30d804['length'];_0x523538<_0x2caab0;_0x523538++){if(!_0x260487['hasOwnProperty'](_0x30d804[_0x523538][_0x3e90('0x6a')])){_0x260487[_0x30d804[_0x523538][_0x3e90('0x6a')]]=needsEncapsulation(_0x30d804[_0x523538][_0x3e90('0x6b')])?encapsulate(_0x30d804[_0x523538][_0x3e90('0x6b')]):_0x30d804[_0x523538][_0x3e90('0x6b')];}}var _0x35243d=[],_0x3b7842={};for(var _0x144905=0x0,_0x2c411b=_0x1d169a[_0x3e90('0x38')];_0x144905<_0x2c411b;_0x144905++){_0x3b7842={'ProjectId':_0x4b3390[_0x3e90('0x49')]['id'],'SessionId':_0x1d169a[_0x144905]['id'],'StartTime':moment(_0x1d169a[_0x144905][_0x3e90('0x66')])[_0x3e90('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4945a2=0x0,_0x4f65c1=_0x30d804[_0x3e90('0x38')];_0x4945a2<_0x4f65c1;_0x4945a2++){if(_0x30d804[_0x4945a2]['SessionId']==_0x1d169a[_0x144905]['id']&&_0x260487[_0x3e90('0x39')](_0x30d804[_0x4945a2][_0x3e90('0x6a')])){_0x3b7842[_0x260487[_0x30d804[_0x4945a2][_0x3e90('0x6a')]]]=_0x30d804[_0x4945a2][_0x3e90('0x6d')];}}for(var _0x2086ab in _0x260487){if(!_0x3b7842['hasOwnProperty'](_0x260487[_0x2086ab])){_0x3b7842[_0x260487[_0x2086ab]]=null;}}_0x35243d[_0x3e90('0x6e')](_0x3b7842);}return _0x35243d;}})[_0x3e90('0x25')](function(_0x3bbc2a){if(!_[_0x3e90('0x6f')](_0x3bbc2a)){var _0x12acc1=toCsv(_0x3bbc2a);var _0x5e160d=Date[_0x3e90('0x70')]();fs['writeFileSync'](util[_0x3e90('0x6c')](_0x3e90('0x71'),_0x4b3390[_0x3e90('0x49')]['id'],_0x5e160d),_0x12acc1);_0xf639f0[_0x3e90('0x72')](_0x3e90('0x73'),_0x3e90('0x74')+util['format'](_0x3e90('0x75'),_0x4b3390['params']['id'],_0x5e160d));_0xf639f0[_0x3e90('0x72')](_0x3e90('0x76'),_0x3e90('0x77'));return _0xf639f0[_0x3e90('0x78')](util[_0x3e90('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4b3390[_0x3e90('0x49')]['id'],_0x5e160d));}else{return _0xf639f0[_0x3e90('0x29')](0xcc);}})[_0x3e90('0x47')](handleError(_0xf639f0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2568539..d7b9a10 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 _0x3937=['exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','bluebird','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3937,0xbf));var _0x7393=function(_0x5e1d5d,_0x43602f){_0x5e1d5d=_0x5e1d5d-0x0;var _0x305ca0=_0x3937[_0x5e1d5d];return _0x305ca0;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3a=['exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x1456f4,_0x18a1fe){_0x1456f4=_0x1456f4-0x0;var _0x1ffd59=_0x2a3a[_0x1456f4];return _0x1ffd59;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index bbc3488..9a2f955 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 _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x138f19,_0x3fbf6d){var _0x415e7e=function(_0x6f773d){while(--_0x6f773d){_0x138f19['push'](_0x138f19['shift']());}};_0x415e7e(++_0x3fbf6d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x111e9b,_0x16072d){_0x111e9b=_0x111e9b-0x0;var _0x2aeb86=_0x9bde[_0x111e9b];return _0x2aeb86;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\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(_0x1f65c0,_0x12a132){var _0x129ee0=function(_0x1b4064){while(--_0x1b4064){_0x1f65c0['push'](_0x1f65c0['shift']());}};_0x129ee0(++_0x12a132);}(_0xb7e7,0x121));var _0x7b7e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb7e7[_0x43d11d];return _0x38cd08;};'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')]('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 712e32d..fadab3a 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 _0xa77e=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x4d475e,_0x1c2276){var _0x491576=function(_0x544dc9){while(--_0x544dc9){_0x4d475e['push'](_0x4d475e['shift']());}};_0x491576(++_0x1c2276);}(_0xa77e,0x17e));var _0xea77=function(_0x5a8e3c,_0x390673){_0x5a8e3c=_0x5a8e3c-0x0;var _0x163dad=_0xa77e[_0x5a8e3c];return _0x163dad;};'use strict';var multer=require(_0xea77('0x0'));var util=require('util');var path=require(_0xea77('0x1'));var timeout=require(_0xea77('0x2'));var express=require(_0xea77('0x3'));var router=express['Router']();var fs_extra=require(_0xea77('0x4'));var auth=require(_0xea77('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea77('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0xea77('0x7')]('/',auth[_0xea77('0x8')](),controller[_0xea77('0x9')]);router[_0xea77('0x7')](_0xea77('0xa'),auth[_0xea77('0x8')](),controller['describe']);router[_0xea77('0x7')](_0xea77('0xb'),auth[_0xea77('0x8')](),controller[_0xea77('0xc')]);router[_0xea77('0xd')]('/',auth[_0xea77('0x8')](),controller['create']);router['put'](_0xea77('0xb'),auth['isAuthenticated'](),controller[_0xea77('0xe')]);router[_0xea77('0xf')](_0xea77('0xb'),auth[_0xea77('0x8')](),controller[_0xea77('0x10')]);module[_0xea77('0x11')]=router; \ No newline at end of file +var _0x9a0d=['isAuthenticated','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id'];(function(_0x5e9084,_0x3028a4){var _0x52f026=function(_0x3df59f){while(--_0x3df59f){_0x5e9084['push'](_0x5e9084['shift']());}};_0x52f026(++_0x3028a4);}(_0x9a0d,0x197));var _0xd9a0=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x9a0d[_0x172747];return _0x509692;};'use strict';var multer=require('multer');var util=require(_0xd9a0('0x0'));var path=require('path');var timeout=require(_0xd9a0('0x1'));var express=require(_0xd9a0('0x2'));var router=express[_0xd9a0('0x3')]();var fs_extra=require(_0xd9a0('0x4'));var auth=require(_0xd9a0('0x5'));var interaction=require(_0xd9a0('0x6'));var config=require('../../config/environment');var controller=require(_0xd9a0('0x7'));router[_0xd9a0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9a0('0x9')]);router[_0xd9a0('0x8')](_0xd9a0('0xa'),auth['isAuthenticated'](),controller[_0xd9a0('0xb')]);router[_0xd9a0('0x8')](_0xd9a0('0xc'),auth[_0xd9a0('0xd')](),controller[_0xd9a0('0xe')]);router[_0xd9a0('0xf')]('/',auth[_0xd9a0('0xd')](),controller[_0xd9a0('0x10')]);router[_0xd9a0('0x11')]('/:id',auth[_0xd9a0('0xd')](),controller[_0xd9a0('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd9a0('0x13')]);module[_0xd9a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index fd38ca8..372e7f4 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x5aa6b2,_0xbca4f8){_0x5aa6b2=_0x5aa6b2-0x0;var _0x1d4064=_0x7a54[_0x5aa6b2];return _0x1d4064;};'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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x5e129c,_0x227ade){_0x5e129c=_0x5e129c-0x0;var _0x5ddd02=_0x7a54[_0x5e129c];return _0x5ddd02;};'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 f77fc0f..c54c7e4 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 _0x761e=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','JscriptyQuestionReport','includeAll','findAll','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xea2efa,_0x4b31c5){var _0x37de95=function(_0x1496cf){while(--_0x1496cf){_0xea2efa['push'](_0xea2efa['shift']());}};_0x37de95(++_0x4b31c5);}(_0x761e,0x88));var _0xe761=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x761e[_0x12e073];return _0x267748;};'use strict';var emlformat=require(_0xe761('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe761('0x1'));var jsonpatch=require(_0xe761('0x2'));var rp=require(_0xe761('0x3'));var moment=require(_0xe761('0x4'));var BPromise=require(_0xe761('0x5'));var Mustache=require(_0xe761('0x6'));var util=require(_0xe761('0x7'));var path=require(_0xe761('0x8'));var sox=require(_0xe761('0x9'));var csv=require(_0xe761('0xa'));var ejs=require(_0xe761('0xb'));var fs=require('fs');var fs_extra=require(_0xe761('0xc'));var _=require(_0xe761('0xd'));var squel=require(_0xe761('0xe'));var crypto=require(_0xe761('0xf'));var jsforce=require(_0xe761('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe761('0xa'));var querystring=require(_0xe761('0x11'));var Papa=require('papaparse');var Redis=require(_0xe761('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe761('0x13'));var as=require(_0xe761('0x14'));var hardwareService=require(_0xe761('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe761('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe761('0x17'))['db'];function respondWithStatusCode(_0x3ea087,_0x5de114){_0x5de114=_0x5de114||0xcc;return function(_0x72abfc){if(_0x72abfc){return _0x3ea087['sendStatus'](_0x5de114);}return _0x3ea087[_0xe761('0x18')](_0x5de114)[_0xe761('0x19')]();};}function respondWithResult(_0xaac8be,_0x2f6167){_0x2f6167=_0x2f6167||0xc8;return function(_0x125e05){if(_0x125e05){return _0xaac8be[_0xe761('0x18')](_0x2f6167)[_0xe761('0x1a')](_0x125e05);}};}function respondWithFilteredResult(_0x52178f,_0x2d27b7){return function(_0x3cdeab){if(_0x3cdeab){var _0x139f84=typeof _0x2d27b7[_0xe761('0x1b')]===_0xe761('0x1c')&&typeof _0x2d27b7[_0xe761('0x1d')]===_0xe761('0x1c');var _0x423bb6=_0x3cdeab[_0xe761('0x1e')];var _0xdfb7b6=_0x139f84?0x0:_0x2d27b7['offset'];var _0x51e596=_0x139f84?_0x3cdeab['count']:_0x2d27b7['offset']+_0x2d27b7[_0xe761('0x1d')];var _0x30ae38;if(_0x51e596>=_0x423bb6){_0x51e596=_0x423bb6;_0x30ae38=0xc8;}else{_0x30ae38=0xce;}_0x52178f['status'](_0x30ae38);return _0x52178f[_0xe761('0x1f')]('Content-Range',_0xdfb7b6+'-'+_0x51e596+'/'+_0x423bb6)[_0xe761('0x1a')](_0x3cdeab);}return null;};}function patchUpdates(_0x55fba9){return function(_0x4d5a64){try{jsonpatch[_0xe761('0x20')](_0x4d5a64,_0x55fba9,!![]);}catch(_0x3b3505){return BPromise[_0xe761('0x21')](_0x3b3505);}return _0x4d5a64[_0xe761('0x22')]();};}function saveUpdates(_0x4cb6de,_0x5ba04a){return function(_0x15abf7){if(_0x15abf7){return _0x15abf7[_0xe761('0x23')](_0x4cb6de)['then'](function(_0x417c0c){return _0x417c0c;});}return null;};}function removeEntity(_0x12a1f6,_0x4e1f3e){return function(_0x527086){if(_0x527086){return _0x527086[_0xe761('0x24')]()[_0xe761('0x25')](function(){_0x12a1f6[_0xe761('0x18')](0xcc)[_0xe761('0x19')]();});}};}function handleEntityNotFound(_0xe8ca56,_0x583933){return function(_0xea8b45){if(!_0xea8b45){_0xe8ca56[_0xe761('0x26')](0x194);}return _0xea8b45;};}function handleError(_0x19f192,_0x37b7b6){_0x37b7b6=_0x37b7b6||0x1f4;return function(_0x3dda12){logger[_0xe761('0x27')](_0x3dda12[_0xe761('0x28')]);if(_0x3dda12[_0xe761('0x29')]){delete _0x3dda12[_0xe761('0x29')];}_0x19f192['status'](_0x37b7b6)[_0xe761('0x2a')](_0x3dda12);};}exports['index']=function(_0x196c99,_0x5ac6b6){var _0x2a3134={},_0x3e2657={},_0x44dad9={'count':0x0,'rows':[]};var _0x24d1c4=_[_0xe761('0x2b')](db['JscriptyQuestionReport'][_0xe761('0x2c')],function(_0x353f1c){return{'name':_0x353f1c[_0xe761('0x2d')],'type':_0x353f1c[_0xe761('0x2e')][_0xe761('0x2f')]};});_0x3e2657[_0xe761('0x30')]=_[_0xe761('0x2b')](_0x24d1c4,_0xe761('0x29'));_0x3e2657[_0xe761('0x31')]=_[_0xe761('0x32')](_0x196c99[_0xe761('0x31')]);_0x3e2657[_0xe761('0x33')]=_[_0xe761('0x34')](_0x3e2657[_0xe761('0x30')],_0x3e2657[_0xe761('0x31')]);_0x2a3134[_0xe761('0x35')]=_['intersection'](_0x3e2657[_0xe761('0x30')],qs['fields'](_0x196c99['query'][_0xe761('0x36')]));_0x2a3134[_0xe761('0x35')]=_0x2a3134['attributes'][_0xe761('0x37')]?_0x2a3134['attributes']:_0x3e2657[_0xe761('0x30')];if(!_0x196c99[_0xe761('0x31')][_0xe761('0x38')](_0xe761('0x39'))){_0x2a3134['limit']=qs[_0xe761('0x1d')](_0x196c99[_0xe761('0x31')][_0xe761('0x1d')]);_0x2a3134[_0xe761('0x1b')]=qs['offset'](_0x196c99[_0xe761('0x31')][_0xe761('0x1b')]);}_0x2a3134[_0xe761('0x3a')]=qs['sort'](_0x196c99[_0xe761('0x31')]['sort']);_0x2a3134[_0xe761('0x3b')]=qs[_0xe761('0x33')](_[_0xe761('0x3c')](_0x196c99['query'],_0x3e2657[_0xe761('0x33')]),_0x24d1c4);if(_0x196c99[_0xe761('0x31')][_0xe761('0x3d')]){_0x2a3134[_0xe761('0x3b')]=_[_0xe761('0x3e')](_0x2a3134[_0xe761('0x3b')],{'$or':_[_0xe761('0x2b')](_0x24d1c4,function(_0xd3f554){if(_0xd3f554[_0xe761('0x2e')]!=='VIRTUAL'){var _0x5d4980={};_0x5d4980[_0xd3f554[_0xe761('0x29')]]={'$like':'%'+_0x196c99[_0xe761('0x31')][_0xe761('0x3d')]+'%'};return _0x5d4980;}})});}_0x2a3134=_[_0xe761('0x3e')]({},_0x2a3134,_0x196c99['options']);var _0x585a84={'where':_0x2a3134[_0xe761('0x3b')]};return db[_0xe761('0x3f')]['count'](_0x585a84)[_0xe761('0x25')](function(_0x1c2498){_0x44dad9[_0xe761('0x1e')]=_0x1c2498;if(_0x196c99[_0xe761('0x31')][_0xe761('0x40')]){_0x2a3134['include']=[{'all':!![]}];}return db[_0xe761('0x3f')][_0xe761('0x41')](_0x2a3134);})['then'](function(_0x153635){_0x44dad9['rows']=_0x153635;return _0x44dad9;})[_0xe761('0x25')](respondWithFilteredResult(_0x5ac6b6,_0x2a3134))[_0xe761('0x42')](handleError(_0x5ac6b6,null));};exports['show']=function(_0x3b0bf,_0x2d2738){var _0x36ecc5={'raw':!![],'where':{'id':_0x3b0bf[_0xe761('0x43')]['id']}},_0x1bf6b9={};_0x1bf6b9[_0xe761('0x30')]=_['keys'](db[_0xe761('0x3f')][_0xe761('0x2c')]);_0x1bf6b9[_0xe761('0x31')]=_[_0xe761('0x32')](_0x3b0bf[_0xe761('0x31')]);_0x1bf6b9[_0xe761('0x33')]=_[_0xe761('0x34')](_0x1bf6b9[_0xe761('0x30')],_0x1bf6b9[_0xe761('0x31')]);_0x36ecc5[_0xe761('0x35')]=_[_0xe761('0x34')](_0x1bf6b9[_0xe761('0x30')],qs[_0xe761('0x36')](_0x3b0bf['query'][_0xe761('0x36')]));_0x36ecc5['attributes']=_0x36ecc5['attributes'][_0xe761('0x37')]?_0x36ecc5[_0xe761('0x35')]:_0x1bf6b9[_0xe761('0x30')];if(_0x3b0bf['query'][_0xe761('0x40')]){_0x36ecc5['include']=[{'all':!![]}];}_0x36ecc5=_['merge']({},_0x36ecc5,_0x3b0bf['options']);return db[_0xe761('0x3f')]['find'](_0x36ecc5)[_0xe761('0x25')](handleEntityNotFound(_0x2d2738,null))[_0xe761('0x25')](respondWithResult(_0x2d2738,null))[_0xe761('0x42')](handleError(_0x2d2738,null));};exports['create']=function(_0x1d6e16,_0x570df4){return db[_0xe761('0x3f')][_0xe761('0x44')](_0x1d6e16[_0xe761('0x45')],{})[_0xe761('0x25')](respondWithResult(_0x570df4,0xc9))[_0xe761('0x42')](handleError(_0x570df4,null));};exports['update']=function(_0x215ea1,_0x2f2eab){if(_0x215ea1['body']['id']){delete _0x215ea1[_0xe761('0x45')]['id'];}return db[_0xe761('0x3f')][_0xe761('0x46')]({'where':{'id':_0x215ea1[_0xe761('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f2eab,null))[_0xe761('0x25')](saveUpdates(_0x215ea1['body'],null))['then'](respondWithResult(_0x2f2eab,null))['catch'](handleError(_0x2f2eab,null));};exports['destroy']=function(_0x19f41c,_0x2eaf39){return db[_0xe761('0x3f')][_0xe761('0x46')]({'where':{'id':_0x19f41c[_0xe761('0x43')]['id']}})[_0xe761('0x25')](handleEntityNotFound(_0x2eaf39,null))[_0xe761('0x25')](removeEntity(_0x2eaf39,null))[_0xe761('0x42')](handleError(_0x2eaf39,null));};exports[_0xe761('0x47')]=function(_0x1b0f64,_0x53504f){return db['JscriptyQuestionReport'][_0xe761('0x47')]()['then'](respondWithResult(_0x53504f,null))[_0xe761('0x42')](handleError(_0x53504f,null));}; \ No newline at end of file +var _0x5165=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','end','error','name','index','JscriptyQuestionReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','where','includeAll','include','rows','catch','options','find','create','update','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x3d9d7d,_0x447b7f){var _0x429817=function(_0x5b9f7e){while(--_0x5b9f7e){_0x3d9d7d['push'](_0x3d9d7d['shift']());}};_0x429817(++_0x447b7f);}(_0x5165,0x193));var _0x5516=function(_0x3534e1,_0x24a279){_0x3534e1=_0x3534e1-0x0;var _0xad1754=_0x5165[_0x3534e1];return _0xad1754;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5516('0x0'));var zipdir=require(_0x5516('0x1'));var jsonpatch=require(_0x5516('0x2'));var rp=require(_0x5516('0x3'));var moment=require('moment');var BPromise=require(_0x5516('0x4'));var Mustache=require(_0x5516('0x5'));var util=require(_0x5516('0x6'));var path=require(_0x5516('0x7'));var sox=require(_0x5516('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5516('0x9'));var _=require(_0x5516('0xa'));var squel=require(_0x5516('0xb'));var crypto=require(_0x5516('0xc'));var jsforce=require(_0x5516('0xd'));var deskjs=require(_0x5516('0xe'));var toCsv=require(_0x5516('0xf'));var querystring=require('querystring');var Papa=require(_0x5516('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5516('0x11'));var as=require(_0x5516('0x12'));var hardwareService=require(_0x5516('0x13'));var logger=require(_0x5516('0x14'))(_0x5516('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5516('0x16'));var db=require(_0x5516('0x17'))['db'];function respondWithStatusCode(_0x1d1c0a,_0x112183){_0x112183=_0x112183||0xcc;return function(_0x423d7b){if(_0x423d7b){return _0x1d1c0a[_0x5516('0x18')](_0x112183);}return _0x1d1c0a[_0x5516('0x19')](_0x112183)['end']();};}function respondWithResult(_0x5bc21d,_0x4fb05e){_0x4fb05e=_0x4fb05e||0xc8;return function(_0x30b7db){if(_0x30b7db){return _0x5bc21d[_0x5516('0x19')](_0x4fb05e)[_0x5516('0x1a')](_0x30b7db);}};}function respondWithFilteredResult(_0x155b9a,_0x240a50){return function(_0x5780af){if(_0x5780af){var _0x1c3700=typeof _0x240a50[_0x5516('0x1b')]==='undefined'&&typeof _0x240a50[_0x5516('0x1c')]===_0x5516('0x1d');var _0x2d0097=_0x5780af[_0x5516('0x1e')];var _0x19f60=_0x1c3700?0x0:_0x240a50[_0x5516('0x1b')];var _0xf79070=_0x1c3700?_0x5780af[_0x5516('0x1e')]:_0x240a50['offset']+_0x240a50[_0x5516('0x1c')];var _0x20fae7;if(_0xf79070>=_0x2d0097){_0xf79070=_0x2d0097;_0x20fae7=0xc8;}else{_0x20fae7=0xce;}_0x155b9a[_0x5516('0x19')](_0x20fae7);return _0x155b9a[_0x5516('0x1f')]('Content-Range',_0x19f60+'-'+_0xf79070+'/'+_0x2d0097)['json'](_0x5780af);}return null;};}function patchUpdates(_0x5e5c36){return function(_0x234913){try{jsonpatch['apply'](_0x234913,_0x5e5c36,!![]);}catch(_0x205191){return BPromise[_0x5516('0x20')](_0x205191);}return _0x234913[_0x5516('0x21')]();};}function saveUpdates(_0x31784c,_0x3d79d9){return function(_0x26869b){if(_0x26869b){return _0x26869b['update'](_0x31784c)['then'](function(_0x3098b1){return _0x3098b1;});}return null;};}function removeEntity(_0x556b50,_0x5dd4a7){return function(_0x595cd1){if(_0x595cd1){return _0x595cd1['destroy']()[_0x5516('0x22')](function(){_0x556b50['status'](0xcc)[_0x5516('0x23')]();});}};}function handleEntityNotFound(_0x5b52c4,_0x31624d){return function(_0x37b02c){if(!_0x37b02c){_0x5b52c4[_0x5516('0x18')](0x194);}return _0x37b02c;};}function handleError(_0x3619ee,_0xb85640){_0xb85640=_0xb85640||0x1f4;return function(_0x5da132){logger[_0x5516('0x24')](_0x5da132['stack']);if(_0x5da132[_0x5516('0x25')]){delete _0x5da132[_0x5516('0x25')];}_0x3619ee[_0x5516('0x19')](_0xb85640)['send'](_0x5da132);};}exports[_0x5516('0x26')]=function(_0x5255b9,_0x7a28cd){var _0xe01ac1={},_0x4126e0={},_0xb41e4f={'count':0x0,'rows':[]};var _0x264105=_['map'](db[_0x5516('0x27')][_0x5516('0x28')],function(_0x5adf99){return{'name':_0x5adf99[_0x5516('0x29')],'type':_0x5adf99[_0x5516('0x2a')]['key']};});_0x4126e0['model']=_['map'](_0x264105,_0x5516('0x25'));_0x4126e0['query']=_[_0x5516('0x2b')](_0x5255b9[_0x5516('0x2c')]);_0x4126e0[_0x5516('0x2d')]=_[_0x5516('0x2e')](_0x4126e0[_0x5516('0x2f')],_0x4126e0['query']);_0xe01ac1[_0x5516('0x30')]=_[_0x5516('0x2e')](_0x4126e0[_0x5516('0x2f')],qs['fields'](_0x5255b9[_0x5516('0x2c')][_0x5516('0x31')]));_0xe01ac1[_0x5516('0x30')]=_0xe01ac1[_0x5516('0x30')][_0x5516('0x32')]?_0xe01ac1[_0x5516('0x30')]:_0x4126e0[_0x5516('0x2f')];if(!_0x5255b9[_0x5516('0x2c')][_0x5516('0x33')](_0x5516('0x34'))){_0xe01ac1[_0x5516('0x1c')]=qs[_0x5516('0x1c')](_0x5255b9[_0x5516('0x2c')][_0x5516('0x1c')]);_0xe01ac1['offset']=qs[_0x5516('0x1b')](_0x5255b9[_0x5516('0x2c')][_0x5516('0x1b')]);}_0xe01ac1[_0x5516('0x35')]=qs['sort'](_0x5255b9['query']['sort']);_0xe01ac1['where']=qs[_0x5516('0x2d')](_['pick'](_0x5255b9[_0x5516('0x2c')],_0x4126e0[_0x5516('0x2d')]),_0x264105);if(_0x5255b9[_0x5516('0x2c')][_0x5516('0x36')]){_0xe01ac1['where']=_[_0x5516('0x37')](_0xe01ac1['where'],{'$or':_['map'](_0x264105,function(_0x313893){if(_0x313893[_0x5516('0x2a')]!==_0x5516('0x38')){var _0x5c5481={};_0x5c5481[_0x313893[_0x5516('0x25')]]={'$like':'%'+_0x5255b9['query'][_0x5516('0x36')]+'%'};return _0x5c5481;}})});}_0xe01ac1=_['merge']({},_0xe01ac1,_0x5255b9['options']);var _0x36d829={'where':_0xe01ac1[_0x5516('0x39')]};return db[_0x5516('0x27')]['count'](_0x36d829)[_0x5516('0x22')](function(_0x3e075c){_0xb41e4f['count']=_0x3e075c;if(_0x5255b9['query'][_0x5516('0x3a')]){_0xe01ac1[_0x5516('0x3b')]=[{'all':!![]}];}return db[_0x5516('0x27')]['findAll'](_0xe01ac1);})[_0x5516('0x22')](function(_0x15784a){_0xb41e4f[_0x5516('0x3c')]=_0x15784a;return _0xb41e4f;})[_0x5516('0x22')](respondWithFilteredResult(_0x7a28cd,_0xe01ac1))[_0x5516('0x3d')](handleError(_0x7a28cd,null));};exports['show']=function(_0x2c6cdd,_0x34716e){var _0x4abb47={'raw':!![],'where':{'id':_0x2c6cdd['params']['id']}},_0x50d8de={};_0x50d8de[_0x5516('0x2f')]=_[_0x5516('0x2b')](db[_0x5516('0x27')][_0x5516('0x28')]);_0x50d8de['query']=_[_0x5516('0x2b')](_0x2c6cdd[_0x5516('0x2c')]);_0x50d8de[_0x5516('0x2d')]=_[_0x5516('0x2e')](_0x50d8de[_0x5516('0x2f')],_0x50d8de[_0x5516('0x2c')]);_0x4abb47[_0x5516('0x30')]=_[_0x5516('0x2e')](_0x50d8de[_0x5516('0x2f')],qs[_0x5516('0x31')](_0x2c6cdd[_0x5516('0x2c')][_0x5516('0x31')]));_0x4abb47['attributes']=_0x4abb47[_0x5516('0x30')][_0x5516('0x32')]?_0x4abb47[_0x5516('0x30')]:_0x50d8de[_0x5516('0x2f')];if(_0x2c6cdd[_0x5516('0x2c')][_0x5516('0x3a')]){_0x4abb47['include']=[{'all':!![]}];}_0x4abb47=_[_0x5516('0x37')]({},_0x4abb47,_0x2c6cdd[_0x5516('0x3e')]);return db[_0x5516('0x27')][_0x5516('0x3f')](_0x4abb47)[_0x5516('0x22')](handleEntityNotFound(_0x34716e,null))[_0x5516('0x22')](respondWithResult(_0x34716e,null))['catch'](handleError(_0x34716e,null));};exports[_0x5516('0x40')]=function(_0x49500f,_0x4ff15d){return db[_0x5516('0x27')][_0x5516('0x40')](_0x49500f['body'],{})['then'](respondWithResult(_0x4ff15d,0xc9))[_0x5516('0x3d')](handleError(_0x4ff15d,null));};exports[_0x5516('0x41')]=function(_0x160319,_0x359a43){if(_0x160319[_0x5516('0x42')]['id']){delete _0x160319['body']['id'];}return db[_0x5516('0x27')][_0x5516('0x3f')]({'where':{'id':_0x160319[_0x5516('0x43')]['id']}})[_0x5516('0x22')](handleEntityNotFound(_0x359a43,null))[_0x5516('0x22')](saveUpdates(_0x160319[_0x5516('0x42')],null))[_0x5516('0x22')](respondWithResult(_0x359a43,null))[_0x5516('0x3d')](handleError(_0x359a43,null));};exports[_0x5516('0x44')]=function(_0x568b90,_0x50364c){return db['JscriptyQuestionReport'][_0x5516('0x3f')]({'where':{'id':_0x568b90['params']['id']}})[_0x5516('0x22')](handleEntityNotFound(_0x50364c,null))[_0x5516('0x22')](removeEntity(_0x50364c,null))[_0x5516('0x3d')](handleError(_0x50364c,null));};exports['describe']=function(_0x3905a4,_0x540d46){return db[_0x5516('0x27')][_0x5516('0x45')]()[_0x5516('0x22')](respondWithResult(_0x540d46,null))[_0x5516('0x3d')](handleError(_0x540d46,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9af9ac5..7fe634d 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 _0xb7e2=['bluebird','request-promise','path','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','moment'];(function(_0x4874d1,_0xb53cf){var _0x136e8a=function(_0x549247){while(--_0x549247){_0x4874d1['push'](_0x4874d1['shift']());}};_0x136e8a(++_0xb53cf);}(_0xb7e2,0x102));var _0x2b7e=function(_0x5aaa26,_0x3d2f78){_0x5aaa26=_0x5aaa26-0x0;var _0x471d40=_0xb7e2[_0x5aaa26];return _0x471d40;};'use strict';var _=require('lodash');var util=require(_0x2b7e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2b7e('0x1'));var BPromise=require(_0x2b7e('0x2'));var rp=require(_0x2b7e('0x3'));var fs=require('fs');var path=require(_0x2b7e('0x4'));var rimraf=require('rimraf');var config=require(_0x2b7e('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2b7e('0x6')]=function(_0x2262d1,_0x49fce9){return _0x2262d1[_0x2b7e('0x7')](_0x2b7e('0x8'),attributes,{'tableName':_0x2b7e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d38=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x291982,_0x23a8e6){var _0x5cf632=function(_0x505809){while(--_0x505809){_0x291982['push'](_0x291982['shift']());}};_0x5cf632(++_0x23a8e6);}(_0x0d38,0x125));var _0x80d3=function(_0x54c8d4,_0x44675e){_0x54c8d4=_0x54c8d4-0x0;var _0x188865=_0x0d38[_0x54c8d4];return _0x188865;};'use strict';var _=require(_0x80d3('0x0'));var util=require(_0x80d3('0x1'));var logger=require(_0x80d3('0x2'))(_0x80d3('0x3'));var moment=require(_0x80d3('0x4'));var BPromise=require(_0x80d3('0x5'));var rp=require(_0x80d3('0x6'));var fs=require('fs');var path=require(_0x80d3('0x7'));var rimraf=require(_0x80d3('0x8'));var config=require(_0x80d3('0x9'));var attributes=require(_0x80d3('0xa'));module[_0x80d3('0xb')]=function(_0x5e98c7,_0x186aa5){return _0x5e98c7[_0x80d3('0xc')](_0x80d3('0xd'),attributes,{'tableName':_0x80d3('0xe'),'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 c8fa7d8..cb304b2 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 _0x4112=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x306be5,_0x292487){var _0x41e532=function(_0x23ef5e){while(--_0x23ef5e){_0x306be5['push'](_0x306be5['shift']());}};_0x41e532(++_0x292487);}(_0x4112,0x1ae));var _0x2411=function(_0x8ecee4,_0xfb3b79){_0x8ecee4=_0x8ecee4-0x0;var _0x1c1069=_0x4112[_0x8ecee4];return _0x1c1069;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2411('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2411('0x1'));var db=require(_0x2411('0x2'))['db'];var utils=require(_0x2411('0x3'));var logger=require(_0x2411('0x4'))('rpc');var config=require(_0x2411('0x5'));var jayson=require(_0x2411('0x6'));var client=jayson[_0x2411('0x7')][_0x2411('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a722d,_0x38b63b,_0x1175eb){return new BPromise(function(_0x4a716f,_0x25610a){return client['request'](_0x1a722d,_0x1175eb)[_0x2411('0x9')](function(_0x3a2eeb){logger[_0x2411('0xa')](_0x2411('0xb'),_0x38b63b,_0x2411('0xc'));logger[_0x2411('0xd')](_0x2411('0xe'),_0x38b63b,_0x2411('0xc'),JSON[_0x2411('0xf')](_0x3a2eeb));if(_0x3a2eeb[_0x2411('0x10')]){if(_0x3a2eeb[_0x2411('0x10')][_0x2411('0x11')]===0x1f4){logger['error'](_0x2411('0xb'),_0x38b63b,_0x3a2eeb['error'][_0x2411('0x12')]);return _0x25610a(_0x3a2eeb['error']['message']);}logger[_0x2411('0x10')](_0x2411('0xb'),_0x38b63b,_0x3a2eeb[_0x2411('0x10')][_0x2411('0x12')]);return _0x4a716f(_0x3a2eeb[_0x2411('0x10')][_0x2411('0x12')]);}else{logger[_0x2411('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38b63b,_0x2411('0xc'));_0x4a716f(_0x3a2eeb['result'][_0x2411('0x12')]);}})[_0x2411('0x13')](function(_0x55c482){logger[_0x2411('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38b63b,_0x55c482);_0x25610a(_0x55c482);});});} \ No newline at end of file +var _0xac37=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0xc0b4a5,_0x3dd6bd){var _0x13d5d6=function(_0x28001a){while(--_0x28001a){_0xc0b4a5['push'](_0xc0b4a5['shift']());}};_0x13d5d6(++_0x3dd6bd);}(_0xac37,0x6d));var _0x7ac3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xac37[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x7ac3('0x0'));var moment=require(_0x7ac3('0x1'));var BPromise=require(_0x7ac3('0x2'));var rs=require(_0x7ac3('0x3'));var fs=require('fs');var Redis=require(_0x7ac3('0x4'));var db=require(_0x7ac3('0x5'))['db'];var utils=require(_0x7ac3('0x6'));var logger=require(_0x7ac3('0x7'))(_0x7ac3('0x8'));var config=require(_0x7ac3('0x9'));var jayson=require(_0x7ac3('0xa'));var client=jayson[_0x7ac3('0xb')][_0x7ac3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d6831,_0x5694f7,_0x2d428d){return new BPromise(function(_0x44eb8b,_0x50a604){return client['request'](_0x4d6831,_0x2d428d)[_0x7ac3('0xd')](function(_0x12d5de){logger[_0x7ac3('0xe')](_0x7ac3('0xf'),_0x5694f7,_0x7ac3('0x10'));logger[_0x7ac3('0x11')](_0x7ac3('0x12'),_0x5694f7,'request\x20sent',JSON[_0x7ac3('0x13')](_0x12d5de));if(_0x12d5de['error']){if(_0x12d5de[_0x7ac3('0x14')][_0x7ac3('0x15')]===0x1f4){logger[_0x7ac3('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5694f7,_0x12d5de[_0x7ac3('0x14')]['message']);return _0x50a604(_0x12d5de['error'][_0x7ac3('0x16')]);}logger[_0x7ac3('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5694f7,_0x12d5de['error'][_0x7ac3('0x16')]);return _0x44eb8b(_0x12d5de['error'][_0x7ac3('0x16')]);}else{logger[_0x7ac3('0xe')](_0x7ac3('0xf'),_0x5694f7,_0x7ac3('0x10'));_0x44eb8b(_0x12d5de[_0x7ac3('0x17')][_0x7ac3('0x16')]);}})[_0x7ac3('0x18')](function(_0x15a827){logger[_0x7ac3('0x14')](_0x7ac3('0xf'),_0x5694f7,_0x15a827);_0x50a604(_0x15a827);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 29e7c9f..9f3ca82 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 _0x942f=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x353948,_0x79cfe7){var _0x10ba0e=function(_0x5ee0a6){while(--_0x5ee0a6){_0x353948['push'](_0x353948['shift']());}};_0x10ba0e(++_0x79cfe7);}(_0x942f,0x7c));var _0xf942=function(_0x49b51f,_0x35413f){_0x49b51f=_0x49b51f-0x0;var _0x429872=_0x942f[_0x49b51f];return _0x429872;};'use strict';var multer=require(_0xf942('0x0'));var util=require('util');var path=require(_0xf942('0x1'));var timeout=require(_0xf942('0x2'));var express=require(_0xf942('0x3'));var router=express[_0xf942('0x4')]();var fs_extra=require(_0xf942('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf942('0x6'));var controller=require(_0xf942('0x7'));router[_0xf942('0x8')]('/',auth[_0xf942('0x9')](),controller[_0xf942('0xa')]);router[_0xf942('0x8')](_0xf942('0xb'),auth[_0xf942('0x9')](),controller[_0xf942('0xc')]);router[_0xf942('0x8')](_0xf942('0xd'),auth[_0xf942('0x9')](),controller['show']);router[_0xf942('0x8')]('/:id/questions',auth[_0xf942('0x9')](),controller['getQuestions']);router[_0xf942('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf942('0xf')]('/:id',auth[_0xf942('0x9')](),controller[_0xf942('0x10')]);router[_0xf942('0x11')](_0xf942('0xd'),auth[_0xf942('0x9')](),controller[_0xf942('0x12')]);module[_0xf942('0x13')]=router; \ No newline at end of file +var _0xdafc=['fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','destroy','multer','path','connect-timeout','express','Router'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xdafc,0x8e));var _0xcdaf=function(_0x99ed93,_0x2b8395){_0x99ed93=_0x99ed93-0x0;var _0x519412=_0xdafc[_0x99ed93];return _0x519412;};'use strict';var multer=require(_0xcdaf('0x0'));var util=require('util');var path=require(_0xcdaf('0x1'));var timeout=require(_0xcdaf('0x2'));var express=require(_0xcdaf('0x3'));var router=express[_0xcdaf('0x4')]();var fs_extra=require(_0xcdaf('0x5'));var auth=require(_0xcdaf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcdaf('0x7'));var controller=require(_0xcdaf('0x8'));router['get']('/',auth[_0xcdaf('0x9')](),controller['index']);router[_0xcdaf('0xa')](_0xcdaf('0xb'),auth[_0xcdaf('0x9')](),controller[_0xcdaf('0xc')]);router['get'](_0xcdaf('0xd'),auth['isAuthenticated'](),controller[_0xcdaf('0xe')]);router[_0xcdaf('0xa')](_0xcdaf('0xf'),auth[_0xcdaf('0x9')](),controller[_0xcdaf('0x10')]);router[_0xcdaf('0x11')]('/',auth[_0xcdaf('0x9')](),controller[_0xcdaf('0x12')]);router[_0xcdaf('0x13')](_0xcdaf('0xd'),auth[_0xcdaf('0x9')](),controller['update']);router['delete'](_0xcdaf('0xd'),auth['isAuthenticated'](),controller[_0xcdaf('0x14')]);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 a014da4..c739b07 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 _0xf62d=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x59606e,_0x429521){var _0x19e449=function(_0x1a0483){while(--_0x1a0483){_0x59606e['push'](_0x59606e['shift']());}};_0x19e449(++_0x429521);}(_0xf62d,0x1c0));var _0xdf62=function(_0x44f38b,_0x326d90){_0x44f38b=_0x44f38b-0x0;var _0x468e5e=_0xf62d[_0x44f38b];return _0x468e5e;};'use strict';var moment=require(_0xdf62('0x0'));var Sequelize=require(_0xdf62('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xdf62('0x2')],'set':function(_0xaaae54){this[_0xdf62('0x3')](_0xdf62('0x4'),_0xaaae54);this[_0xdf62('0x3')](_0xdf62('0x5'),moment()[_0xdf62('0x6')](_0xdf62('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdf62('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf62('0x8')]},'calleridnum':{'type':Sequelize[_0xdf62('0x8')]},'completed':{'type':Sequelize[_0xdf62('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf496=['starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x2ed791,_0x1abc01){var _0x1a1990=function(_0x433f23){while(--_0x433f23){_0x2ed791['push'](_0x2ed791['shift']());}};_0x1a1990(++_0x1abc01);}(_0xf496,0x1c7));var _0x6f49=function(_0x120734,_0x29e920){_0x120734=_0x120734-0x0;var _0x13d9f2=_0xf496[_0x120734];return _0x13d9f2;};'use strict';var moment=require(_0x6f49('0x0'));var Sequelize=require(_0x6f49('0x1'));module[_0x6f49('0x2')]={'starttime':{'type':Sequelize[_0x6f49('0x3')],'set':function(_0x1e9547){this['setDataValue'](_0x6f49('0x4'),_0x1e9547);this[_0x6f49('0x5')]('endtime',moment()[_0x6f49('0x6')](_0x6f49('0x7')));}},'endtime':{'type':Sequelize[_0x6f49('0x3')]},'membername':{'type':Sequelize[_0x6f49('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6f49('0x8')]},'uniqueid':{'type':Sequelize[_0x6f49('0x8')]},'calleridname':{'type':Sequelize[_0x6f49('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'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 fb390b7..60011f0 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 _0x6731=['then','destroy','sendStatus','error','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','pick','SessionId','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update'];(function(_0x429a3d,_0x1f2cc6){var _0x10317c=function(_0x3601be){while(--_0x3601be){_0x429a3d['push'](_0x429a3d['shift']());}};_0x10317c(++_0x1f2cc6);}(_0x6731,0x1c0));var _0x1673=function(_0x3042d5,_0x349534){_0x3042d5=_0x3042d5-0x0;var _0x1acfef=_0x6731[_0x3042d5];return _0x1acfef;};'use strict';var emlformat=require(_0x1673('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1673('0x2'));var moment=require(_0x1673('0x3'));var BPromise=require(_0x1673('0x4'));var Mustache=require(_0x1673('0x5'));var util=require(_0x1673('0x6'));var path=require(_0x1673('0x7'));var sox=require(_0x1673('0x8'));var csv=require(_0x1673('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1673('0xa'));var _=require('lodash');var squel=require(_0x1673('0xb'));var crypto=require(_0x1673('0xc'));var jsforce=require(_0x1673('0xd'));var deskjs=require(_0x1673('0xe'));var toCsv=require(_0x1673('0x9'));var querystring=require(_0x1673('0xf'));var Papa=require(_0x1673('0x10'));var Redis=require(_0x1673('0x11'));var authService=require(_0x1673('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1673('0x13'));var hardwareService=require(_0x1673('0x14'));var logger=require(_0x1673('0x15'))('api');var utils=require(_0x1673('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1673('0x17'));var db=require(_0x1673('0x18'))['db'];function respondWithStatusCode(_0x36d7a2,_0x2bd538){_0x2bd538=_0x2bd538||0xcc;return function(_0x2dccaf){if(_0x2dccaf){return _0x36d7a2['sendStatus'](_0x2bd538);}return _0x36d7a2['status'](_0x2bd538)[_0x1673('0x19')]();};}function respondWithResult(_0x162e58,_0x295a0){_0x295a0=_0x295a0||0xc8;return function(_0x70bea9){if(_0x70bea9){return _0x162e58[_0x1673('0x1a')](_0x295a0)[_0x1673('0x1b')](_0x70bea9);}};}function respondWithFilteredResult(_0x1cca7b,_0xbbc907){return function(_0x4d4e98){if(_0x4d4e98){var _0xd8c5d8=typeof _0xbbc907['offset']===_0x1673('0x1c')&&typeof _0xbbc907[_0x1673('0x1d')]===_0x1673('0x1c');var _0x700fda=_0x4d4e98['count'];var _0x2e7029=_0xd8c5d8?0x0:_0xbbc907[_0x1673('0x1e')];var _0x2277b9=_0xd8c5d8?_0x4d4e98[_0x1673('0x1f')]:_0xbbc907[_0x1673('0x1e')]+_0xbbc907[_0x1673('0x1d')];var _0x2a0e1d;if(_0x2277b9>=_0x700fda){_0x2277b9=_0x700fda;_0x2a0e1d=0xc8;}else{_0x2a0e1d=0xce;}_0x1cca7b[_0x1673('0x1a')](_0x2a0e1d);return _0x1cca7b[_0x1673('0x20')](_0x1673('0x21'),_0x2e7029+'-'+_0x2277b9+'/'+_0x700fda)[_0x1673('0x1b')](_0x4d4e98);}return null;};}function patchUpdates(_0x21a1d0){return function(_0x61ef4c){try{jsonpatch[_0x1673('0x22')](_0x61ef4c,_0x21a1d0,!![]);}catch(_0x274d47){return BPromise[_0x1673('0x23')](_0x274d47);}return _0x61ef4c[_0x1673('0x24')]();};}function saveUpdates(_0x4819e3,_0x576030){return function(_0x35bab4){if(_0x35bab4){return _0x35bab4[_0x1673('0x25')](_0x4819e3)[_0x1673('0x26')](function(_0x444ab1){return _0x444ab1;});}return null;};}function removeEntity(_0xdc02a6,_0x2f6c8e){return function(_0x121831){if(_0x121831){return _0x121831[_0x1673('0x27')]()[_0x1673('0x26')](function(){_0xdc02a6['status'](0xcc)[_0x1673('0x19')]();});}};}function handleEntityNotFound(_0x19053b,_0x556d58){return function(_0x33cc5a){if(!_0x33cc5a){_0x19053b[_0x1673('0x28')](0x194);}return _0x33cc5a;};}function handleError(_0x504757,_0x37ef5b){_0x37ef5b=_0x37ef5b||0x1f4;return function(_0x4b1c3d){logger[_0x1673('0x29')](_0x4b1c3d['stack']);if(_0x4b1c3d['name']){delete _0x4b1c3d[_0x1673('0x2a')];}_0x504757['status'](_0x37ef5b)['send'](_0x4b1c3d);};}exports[_0x1673('0x2b')]=function(_0x33e37f,_0x25f813){var _0x85f5c7={},_0x38df89={},_0x589b93={'count':0x0,'rows':[]};var _0x347b69=_[_0x1673('0x2c')](db[_0x1673('0x2d')]['rawAttributes'],function(_0x1a73bb){return{'name':_0x1a73bb[_0x1673('0x2e')],'type':_0x1a73bb[_0x1673('0x2f')][_0x1673('0x30')]};});_0x38df89[_0x1673('0x31')]=_[_0x1673('0x2c')](_0x347b69,_0x1673('0x2a'));_0x38df89[_0x1673('0x32')]=_[_0x1673('0x33')](_0x33e37f[_0x1673('0x32')]);_0x38df89[_0x1673('0x34')]=_[_0x1673('0x35')](_0x38df89[_0x1673('0x31')],_0x38df89[_0x1673('0x32')]);_0x85f5c7['attributes']=_[_0x1673('0x35')](_0x38df89['model'],qs['fields'](_0x33e37f['query'][_0x1673('0x36')]));_0x85f5c7[_0x1673('0x37')]=_0x85f5c7[_0x1673('0x37')][_0x1673('0x38')]?_0x85f5c7[_0x1673('0x37')]:_0x38df89[_0x1673('0x31')];if(!_0x33e37f['query'][_0x1673('0x39')](_0x1673('0x3a'))){_0x85f5c7['limit']=qs['limit'](_0x33e37f[_0x1673('0x32')][_0x1673('0x1d')]);_0x85f5c7[_0x1673('0x1e')]=qs[_0x1673('0x1e')](_0x33e37f[_0x1673('0x32')]['offset']);}_0x85f5c7['order']=qs[_0x1673('0x3b')](_0x33e37f[_0x1673('0x32')]['sort']);_0x85f5c7[_0x1673('0x3c')]=qs[_0x1673('0x34')](_['pick'](_0x33e37f['query'],_0x38df89['filters']),_0x347b69);if(_0x33e37f[_0x1673('0x32')]['filter']){_0x85f5c7['where']=_['merge'](_0x85f5c7[_0x1673('0x3c')],{'$or':_['map'](_0x347b69,function(_0x4d47a6){if(_0x4d47a6[_0x1673('0x2f')]!==_0x1673('0x3d')){var _0x2ed4ec={};_0x2ed4ec[_0x4d47a6['name']]={'$like':'%'+_0x33e37f['query'][_0x1673('0x3e')]+'%'};return _0x2ed4ec;}})});}_0x85f5c7=_[_0x1673('0x3f')]({},_0x85f5c7,_0x33e37f[_0x1673('0x40')]);var _0xc071ac={'where':_0x85f5c7['where']};return db[_0x1673('0x2d')][_0x1673('0x1f')](_0xc071ac)[_0x1673('0x26')](function(_0x2f68dd){_0x589b93[_0x1673('0x1f')]=_0x2f68dd;if(_0x33e37f[_0x1673('0x32')][_0x1673('0x41')]){_0x85f5c7[_0x1673('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1673('0x43')](_0x85f5c7);})[_0x1673('0x26')](function(_0x59daaa){_0x589b93[_0x1673('0x44')]=_0x59daaa;return _0x589b93;})['then'](respondWithFilteredResult(_0x25f813,_0x85f5c7))['catch'](handleError(_0x25f813,null));};exports[_0x1673('0x45')]=function(_0x25990b,_0xc797d0){var _0x2f8cc0={'raw':!![],'where':{'id':_0x25990b[_0x1673('0x46')]['id']}},_0x2bc831={};_0x2bc831[_0x1673('0x31')]=_['keys'](db['JscriptySessionReport'][_0x1673('0x47')]);_0x2bc831['query']=_['keys'](_0x25990b[_0x1673('0x32')]);_0x2bc831[_0x1673('0x34')]=_['intersection'](_0x2bc831[_0x1673('0x31')],_0x2bc831[_0x1673('0x32')]);_0x2f8cc0['attributes']=_[_0x1673('0x35')](_0x2bc831[_0x1673('0x31')],qs[_0x1673('0x36')](_0x25990b['query'][_0x1673('0x36')]));_0x2f8cc0['attributes']=_0x2f8cc0[_0x1673('0x37')][_0x1673('0x38')]?_0x2f8cc0['attributes']:_0x2bc831['model'];if(_0x25990b[_0x1673('0x32')]['includeAll']){_0x2f8cc0['include']=[{'all':!![]}];}_0x2f8cc0=_[_0x1673('0x3f')]({},_0x2f8cc0,_0x25990b['options']);return db[_0x1673('0x2d')][_0x1673('0x48')](_0x2f8cc0)['then'](handleEntityNotFound(_0xc797d0,null))[_0x1673('0x26')](respondWithResult(_0xc797d0,null))[_0x1673('0x49')](handleError(_0xc797d0,null));};exports[_0x1673('0x4a')]=function(_0xf4fb3c,_0x1ce0e7){return db[_0x1673('0x2d')][_0x1673('0x4a')](_0xf4fb3c[_0x1673('0x4b')],{})[_0x1673('0x26')](respondWithResult(_0x1ce0e7,0xc9))[_0x1673('0x49')](handleError(_0x1ce0e7,null));};exports[_0x1673('0x25')]=function(_0x3448f3,_0xf802b6){if(_0x3448f3[_0x1673('0x4b')]['id']){delete _0x3448f3['body']['id'];}return db['JscriptySessionReport'][_0x1673('0x48')]({'where':{'id':_0x3448f3['params']['id']}})['then'](handleEntityNotFound(_0xf802b6,null))[_0x1673('0x26')](saveUpdates(_0x3448f3[_0x1673('0x4b')],null))['then'](respondWithResult(_0xf802b6,null))[_0x1673('0x49')](handleError(_0xf802b6,null));};exports['destroy']=function(_0x3b7985,_0x15f41b){return db[_0x1673('0x2d')][_0x1673('0x48')]({'where':{'id':_0x3b7985[_0x1673('0x46')]['id']}})[_0x1673('0x26')](handleEntityNotFound(_0x15f41b,null))['then'](removeEntity(_0x15f41b,null))['catch'](handleError(_0x15f41b,null));};exports[_0x1673('0x4c')]=function(_0x3bd2af,_0xae7b62){return db[_0x1673('0x2d')][_0x1673('0x4c')]()['then'](respondWithResult(_0xae7b62,null))['catch'](handleError(_0xae7b62,null));};exports[_0x1673('0x4d')]=function(_0x2fc25a,_0x87d1a1,_0xcc9399){var _0xe63fa7={'raw':!![],'where':{}};var _0x102b24={};var _0x3e5ced={'count':0x0,'rows':[]};return db[_0x1673('0x2d')]['findOne']({'where':{'id':_0x2fc25a[_0x1673('0x46')]['id']}})[_0x1673('0x26')](handleEntityNotFound(_0x87d1a1,null))[_0x1673('0x26')](function(_0x446cc3){if(_0x446cc3){_0x102b24['model']=_['keys'](db[_0x1673('0x4e')][_0x1673('0x47')]);_0x102b24['query']=_[_0x1673('0x33')](_0x2fc25a[_0x1673('0x32')]);_0x102b24[_0x1673('0x34')]=_[_0x1673('0x35')](_0x102b24['model'],_0x102b24[_0x1673('0x32')]);_0xe63fa7[_0x1673('0x37')]=_[_0x1673('0x35')](_0x102b24[_0x1673('0x31')],qs['fields'](_0x2fc25a[_0x1673('0x32')]['fields']));_0xe63fa7['attributes']=_0xe63fa7['attributes'][_0x1673('0x38')]?_0xe63fa7[_0x1673('0x37')]:_0x102b24[_0x1673('0x31')];if(!_0x2fc25a[_0x1673('0x32')][_0x1673('0x39')](_0x1673('0x3a'))){_0xe63fa7[_0x1673('0x1d')]=qs[_0x1673('0x1d')](_0x2fc25a[_0x1673('0x32')]['limit']);_0xe63fa7[_0x1673('0x1e')]=qs['offset'](_0x2fc25a[_0x1673('0x32')][_0x1673('0x1e')]);}_0xe63fa7['order']=qs[_0x1673('0x3b')](_0x2fc25a['query'][_0x1673('0x3b')]);_0xe63fa7[_0x1673('0x3c')]=qs[_0x1673('0x34')](_[_0x1673('0x4f')](_0x2fc25a[_0x1673('0x32')],_0x102b24[_0x1673('0x34')]));_0xe63fa7[_0x1673('0x3c')][_0x1673('0x50')]=_0x446cc3['id'];if(_0x2fc25a[_0x1673('0x32')]['filter']){_0xe63fa7[_0x1673('0x3c')]=_[_0x1673('0x3f')](_0xe63fa7['where'],{'$or':_['map'](_0xe63fa7[_0x1673('0x37')],function(_0x594d08){var _0x5b818c={};_0x5b818c[_0x594d08]={'$like':'%'+_0x2fc25a[_0x1673('0x32')][_0x1673('0x3e')]+'%'};return _0x5b818c;})});}_0xe63fa7=_['merge']({},_0xe63fa7,_0x2fc25a['options']);return db[_0x1673('0x4e')][_0x1673('0x1f')]({'where':_0xe63fa7[_0x1673('0x3c')]})[_0x1673('0x26')](function(_0x26320a){_0x3e5ced[_0x1673('0x1f')]=_0x26320a;if(_0x2fc25a[_0x1673('0x32')][_0x1673('0x41')]){_0xe63fa7['include']=[{'all':!![]}];}return db[_0x1673('0x4e')][_0x1673('0x43')](_0xe63fa7);})['then'](function(_0x4d5105){_0x3e5ced['rows']=_0x4d5105;return _0x3e5ced;});}})['then'](respondWithFilteredResult(_0x87d1a1,_0xe63fa7))['catch'](handleError(_0x87d1a1,null));}; \ No newline at end of file +var _0x4390=['nolimit','pick','filter','where','merge','options','JscriptySessionReport','includeAll','include','findAll','show','length','find','catch','create','body','describe','findOne','params','JscriptyQuestionReport','sort','SessionId','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','index','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x55b145,_0x83f3b6){var _0x1dfed4=function(_0x1ed801){while(--_0x1ed801){_0x55b145['push'](_0x55b145['shift']());}};_0x1dfed4(++_0x83f3b6);}(_0x4390,0x67));var _0x0439=function(_0x80b77d,_0x3c7c6e){_0x80b77d=_0x80b77d-0x0;var _0x1e7793=_0x4390[_0x80b77d];return _0x1e7793;};'use strict';var emlformat=require(_0x0439('0x0'));var rimraf=require(_0x0439('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0439('0x2'));var rp=require(_0x0439('0x3'));var moment=require(_0x0439('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0439('0x5'));var path=require(_0x0439('0x6'));var sox=require(_0x0439('0x7'));var csv=require('to-csv');var ejs=require(_0x0439('0x8'));var fs=require('fs');var fs_extra=require(_0x0439('0x9'));var _=require(_0x0439('0xa'));var squel=require(_0x0439('0xb'));var crypto=require(_0x0439('0xc'));var jsforce=require(_0x0439('0xd'));var deskjs=require(_0x0439('0xe'));var toCsv=require(_0x0439('0xf'));var querystring=require(_0x0439('0x10'));var Papa=require(_0x0439('0x11'));var Redis=require(_0x0439('0x12'));var authService=require(_0x0439('0x13'));var qs=require(_0x0439('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0439('0x15'));var logger=require(_0x0439('0x16'))(_0x0439('0x17'));var utils=require(_0x0439('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0439('0x19'));var db=require(_0x0439('0x1a'))['db'];function respondWithStatusCode(_0x144bd8,_0x4aa449){_0x4aa449=_0x4aa449||0xcc;return function(_0x3d55a6){if(_0x3d55a6){return _0x144bd8[_0x0439('0x1b')](_0x4aa449);}return _0x144bd8[_0x0439('0x1c')](_0x4aa449)[_0x0439('0x1d')]();};}function respondWithResult(_0x3b139f,_0x39b459){_0x39b459=_0x39b459||0xc8;return function(_0x4326ae){if(_0x4326ae){return _0x3b139f['status'](_0x39b459)[_0x0439('0x1e')](_0x4326ae);}};}function respondWithFilteredResult(_0x125f95,_0x1b0794){return function(_0x133f72){if(_0x133f72){var _0x57598a=typeof _0x1b0794[_0x0439('0x1f')]===_0x0439('0x20')&&typeof _0x1b0794[_0x0439('0x21')]==='undefined';var _0x1d9d5b=_0x133f72[_0x0439('0x22')];var _0xe3e672=_0x57598a?0x0:_0x1b0794[_0x0439('0x1f')];var _0x4079b3=_0x57598a?_0x133f72['count']:_0x1b0794[_0x0439('0x1f')]+_0x1b0794[_0x0439('0x21')];var _0x16a07d;if(_0x4079b3>=_0x1d9d5b){_0x4079b3=_0x1d9d5b;_0x16a07d=0xc8;}else{_0x16a07d=0xce;}_0x125f95['status'](_0x16a07d);return _0x125f95[_0x0439('0x23')](_0x0439('0x24'),_0xe3e672+'-'+_0x4079b3+'/'+_0x1d9d5b)[_0x0439('0x1e')](_0x133f72);}return null;};}function patchUpdates(_0x21c591){return function(_0x420d4e){try{jsonpatch['apply'](_0x420d4e,_0x21c591,!![]);}catch(_0x494421){return BPromise[_0x0439('0x25')](_0x494421);}return _0x420d4e[_0x0439('0x26')]();};}function saveUpdates(_0x268fb1,_0x498b93){return function(_0x2bb771){if(_0x2bb771){return _0x2bb771[_0x0439('0x27')](_0x268fb1)['then'](function(_0xa27230){return _0xa27230;});}return null;};}function removeEntity(_0xfe630f,_0x2e21bf){return function(_0x3cb31f){if(_0x3cb31f){return _0x3cb31f[_0x0439('0x28')]()[_0x0439('0x29')](function(){_0xfe630f[_0x0439('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fba5,_0x141910){return function(_0x2fc249){if(!_0x2fc249){_0x33fba5[_0x0439('0x1b')](0x194);}return _0x2fc249;};}function handleError(_0x187e00,_0x421723){_0x421723=_0x421723||0x1f4;return function(_0x593bb5){logger[_0x0439('0x2a')](_0x593bb5['stack']);if(_0x593bb5['name']){delete _0x593bb5['name'];}_0x187e00['status'](_0x421723)['send'](_0x593bb5);};}exports[_0x0439('0x2b')]=function(_0x22121a,_0x23cc34){var _0x38b8b2={},_0x153f67={},_0x5b9969={'count':0x0,'rows':[]};var _0x321b8d=_['map'](db['JscriptySessionReport'][_0x0439('0x2c')],function(_0x2afc1e){return{'name':_0x2afc1e[_0x0439('0x2d')],'type':_0x2afc1e['type'][_0x0439('0x2e')]};});_0x153f67[_0x0439('0x2f')]=_[_0x0439('0x30')](_0x321b8d,_0x0439('0x31'));_0x153f67[_0x0439('0x32')]=_[_0x0439('0x33')](_0x22121a['query']);_0x153f67[_0x0439('0x34')]=_[_0x0439('0x35')](_0x153f67[_0x0439('0x2f')],_0x153f67[_0x0439('0x32')]);_0x38b8b2[_0x0439('0x36')]=_['intersection'](_0x153f67[_0x0439('0x2f')],qs[_0x0439('0x37')](_0x22121a[_0x0439('0x32')][_0x0439('0x37')]));_0x38b8b2[_0x0439('0x36')]=_0x38b8b2[_0x0439('0x36')]['length']?_0x38b8b2['attributes']:_0x153f67[_0x0439('0x2f')];if(!_0x22121a[_0x0439('0x32')][_0x0439('0x38')](_0x0439('0x39'))){_0x38b8b2[_0x0439('0x21')]=qs[_0x0439('0x21')](_0x22121a[_0x0439('0x32')][_0x0439('0x21')]);_0x38b8b2['offset']=qs[_0x0439('0x1f')](_0x22121a['query']['offset']);}_0x38b8b2['order']=qs['sort'](_0x22121a['query']['sort']);_0x38b8b2['where']=qs[_0x0439('0x34')](_[_0x0439('0x3a')](_0x22121a[_0x0439('0x32')],_0x153f67[_0x0439('0x34')]),_0x321b8d);if(_0x22121a[_0x0439('0x32')][_0x0439('0x3b')]){_0x38b8b2[_0x0439('0x3c')]=_['merge'](_0x38b8b2[_0x0439('0x3c')],{'$or':_[_0x0439('0x30')](_0x321b8d,function(_0x41ac33){if(_0x41ac33['type']!=='VIRTUAL'){var _0x1b8b47={};_0x1b8b47[_0x41ac33[_0x0439('0x31')]]={'$like':'%'+_0x22121a[_0x0439('0x32')][_0x0439('0x3b')]+'%'};return _0x1b8b47;}})});}_0x38b8b2=_[_0x0439('0x3d')]({},_0x38b8b2,_0x22121a[_0x0439('0x3e')]);var _0x110bca={'where':_0x38b8b2[_0x0439('0x3c')]};return db[_0x0439('0x3f')]['count'](_0x110bca)[_0x0439('0x29')](function(_0x1fea89){_0x5b9969[_0x0439('0x22')]=_0x1fea89;if(_0x22121a[_0x0439('0x32')][_0x0439('0x40')]){_0x38b8b2[_0x0439('0x41')]=[{'all':!![]}];}return db[_0x0439('0x3f')][_0x0439('0x42')](_0x38b8b2);})[_0x0439('0x29')](function(_0x1dfaa7){_0x5b9969['rows']=_0x1dfaa7;return _0x5b9969;})['then'](respondWithFilteredResult(_0x23cc34,_0x38b8b2))['catch'](handleError(_0x23cc34,null));};exports[_0x0439('0x43')]=function(_0x479bcf,_0x54e14a){var _0x1fa14a={'raw':!![],'where':{'id':_0x479bcf['params']['id']}},_0x4a770f={};_0x4a770f[_0x0439('0x2f')]=_[_0x0439('0x33')](db[_0x0439('0x3f')][_0x0439('0x2c')]);_0x4a770f[_0x0439('0x32')]=_[_0x0439('0x33')](_0x479bcf['query']);_0x4a770f[_0x0439('0x34')]=_[_0x0439('0x35')](_0x4a770f[_0x0439('0x2f')],_0x4a770f[_0x0439('0x32')]);_0x1fa14a[_0x0439('0x36')]=_[_0x0439('0x35')](_0x4a770f[_0x0439('0x2f')],qs['fields'](_0x479bcf['query']['fields']));_0x1fa14a[_0x0439('0x36')]=_0x1fa14a[_0x0439('0x36')][_0x0439('0x44')]?_0x1fa14a[_0x0439('0x36')]:_0x4a770f[_0x0439('0x2f')];if(_0x479bcf[_0x0439('0x32')][_0x0439('0x40')]){_0x1fa14a['include']=[{'all':!![]}];}_0x1fa14a=_[_0x0439('0x3d')]({},_0x1fa14a,_0x479bcf[_0x0439('0x3e')]);return db['JscriptySessionReport'][_0x0439('0x45')](_0x1fa14a)[_0x0439('0x29')](handleEntityNotFound(_0x54e14a,null))[_0x0439('0x29')](respondWithResult(_0x54e14a,null))[_0x0439('0x46')](handleError(_0x54e14a,null));};exports['create']=function(_0x1f1f75,_0x54bb97){return db[_0x0439('0x3f')][_0x0439('0x47')](_0x1f1f75[_0x0439('0x48')],{})[_0x0439('0x29')](respondWithResult(_0x54bb97,0xc9))[_0x0439('0x46')](handleError(_0x54bb97,null));};exports[_0x0439('0x27')]=function(_0x1af88f,_0x49670d){if(_0x1af88f[_0x0439('0x48')]['id']){delete _0x1af88f[_0x0439('0x48')]['id'];}return db['JscriptySessionReport'][_0x0439('0x45')]({'where':{'id':_0x1af88f['params']['id']}})[_0x0439('0x29')](handleEntityNotFound(_0x49670d,null))[_0x0439('0x29')](saveUpdates(_0x1af88f[_0x0439('0x48')],null))['then'](respondWithResult(_0x49670d,null))['catch'](handleError(_0x49670d,null));};exports[_0x0439('0x28')]=function(_0x2ad8eb,_0x4f49c2){return db['JscriptySessionReport'][_0x0439('0x45')]({'where':{'id':_0x2ad8eb['params']['id']}})[_0x0439('0x29')](handleEntityNotFound(_0x4f49c2,null))[_0x0439('0x29')](removeEntity(_0x4f49c2,null))['catch'](handleError(_0x4f49c2,null));};exports[_0x0439('0x49')]=function(_0x281518,_0x5697f7){return db[_0x0439('0x3f')][_0x0439('0x49')]()[_0x0439('0x29')](respondWithResult(_0x5697f7,null))[_0x0439('0x46')](handleError(_0x5697f7,null));};exports['getQuestions']=function(_0x51e394,_0x555353,_0x501e5f){var _0x4ee8e2={'raw':!![],'where':{}};var _0x55f639={};var _0xac482b={'count':0x0,'rows':[]};return db[_0x0439('0x3f')][_0x0439('0x4a')]({'where':{'id':_0x51e394[_0x0439('0x4b')]['id']}})[_0x0439('0x29')](handleEntityNotFound(_0x555353,null))[_0x0439('0x29')](function(_0x553ce2){if(_0x553ce2){_0x55f639['model']=_[_0x0439('0x33')](db[_0x0439('0x4c')]['rawAttributes']);_0x55f639[_0x0439('0x32')]=_[_0x0439('0x33')](_0x51e394[_0x0439('0x32')]);_0x55f639[_0x0439('0x34')]=_[_0x0439('0x35')](_0x55f639['model'],_0x55f639[_0x0439('0x32')]);_0x4ee8e2['attributes']=_[_0x0439('0x35')](_0x55f639[_0x0439('0x2f')],qs[_0x0439('0x37')](_0x51e394[_0x0439('0x32')][_0x0439('0x37')]));_0x4ee8e2[_0x0439('0x36')]=_0x4ee8e2[_0x0439('0x36')][_0x0439('0x44')]?_0x4ee8e2[_0x0439('0x36')]:_0x55f639['model'];if(!_0x51e394[_0x0439('0x32')][_0x0439('0x38')]('nolimit')){_0x4ee8e2[_0x0439('0x21')]=qs['limit'](_0x51e394[_0x0439('0x32')][_0x0439('0x21')]);_0x4ee8e2[_0x0439('0x1f')]=qs[_0x0439('0x1f')](_0x51e394[_0x0439('0x32')][_0x0439('0x1f')]);}_0x4ee8e2['order']=qs[_0x0439('0x4d')](_0x51e394[_0x0439('0x32')][_0x0439('0x4d')]);_0x4ee8e2[_0x0439('0x3c')]=qs[_0x0439('0x34')](_['pick'](_0x51e394[_0x0439('0x32')],_0x55f639[_0x0439('0x34')]));_0x4ee8e2[_0x0439('0x3c')][_0x0439('0x4e')]=_0x553ce2['id'];if(_0x51e394[_0x0439('0x32')][_0x0439('0x3b')]){_0x4ee8e2[_0x0439('0x3c')]=_[_0x0439('0x3d')](_0x4ee8e2[_0x0439('0x3c')],{'$or':_['map'](_0x4ee8e2[_0x0439('0x36')],function(_0x58905e){var _0x4ad2e4={};_0x4ad2e4[_0x58905e]={'$like':'%'+_0x51e394[_0x0439('0x32')]['filter']+'%'};return _0x4ad2e4;})});}_0x4ee8e2=_[_0x0439('0x3d')]({},_0x4ee8e2,_0x51e394['options']);return db['JscriptyQuestionReport'][_0x0439('0x22')]({'where':_0x4ee8e2['where']})['then'](function(_0x4b12d4){_0xac482b[_0x0439('0x22')]=_0x4b12d4;if(_0x51e394[_0x0439('0x32')][_0x0439('0x40')]){_0x4ee8e2['include']=[{'all':!![]}];}return db[_0x0439('0x4c')][_0x0439('0x42')](_0x4ee8e2);})[_0x0439('0x29')](function(_0x469599){_0xac482b[_0x0439('0x4f')]=_0x469599;return _0xac482b;});}})[_0x0439('0x29')](respondWithFilteredResult(_0x555353,_0x4ee8e2))[_0x0439('0x46')](handleError(_0x555353,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 12677ff..0f6f83e 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 _0x5334=['moment','request-promise','rimraf','../../config/environment','lodash','util','../../config/logger','api'];(function(_0xe22c0c,_0x480784){var _0x585804=function(_0x1ec985){while(--_0x1ec985){_0xe22c0c['push'](_0xe22c0c['shift']());}};_0x585804(++_0x480784);}(_0x5334,0x84));var _0x4533=function(_0x4b244d,_0x6fe6a3){_0x4b244d=_0x4b244d-0x0;var _0x7629ae=_0x5334[_0x4b244d];return _0x7629ae;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var logger=require(_0x4533('0x2'))(_0x4533('0x3'));var moment=require(_0x4533('0x4'));var BPromise=require('bluebird');var rp=require(_0x4533('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x51b4ce,_0x201673){return _0x51b4ce['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x256d6b,_0x3bb246){var _0x3fc0b0=function(_0x1ea1d2){while(--_0x1ea1d2){_0x256d6b['push'](_0x256d6b['shift']());}};_0x3fc0b0(++_0x3bb246);}(_0x2d72,0xa8));var _0x22d7=function(_0xc45226,_0x1ecf2c){_0xc45226=_0xc45226-0x0;var _0x33964a=_0x2d72[_0xc45226];return _0x33964a;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 3043a2a..16476a7 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 _0xa456=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5dde91,_0x3bb66e){var _0x402888=function(_0x3ee674){while(--_0x3ee674){_0x5dde91['push'](_0x5dde91['shift']());}};_0x402888(++_0x3bb66e);}(_0xa456,0x142));var _0x6a45=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa456[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});} \ 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(_0xadc861,_0x306a3d){var _0x2cd2ac=function(_0xb2741c){while(--_0xb2741c){_0xadc861['push'](_0xadc861['shift']());}};_0x2cd2ac(++_0x306a3d);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e6d38,_0x1fc3af){_0x2e6d38=_0x2e6d38-0x0;var _0x4f8575=_0x2ef3[_0x2e6d38];return _0x4f8575;};'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 a91dacc..16b5192 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 _0x808c=['isAuthenticated','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x187038,_0x4a927c){var _0xf70e7a=function(_0x4a13d4){while(--_0x4a13d4){_0x187038['push'](_0x187038['shift']());}};_0xf70e7a(++_0x4a927c);}(_0x808c,0x6c));var _0xc808=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x808c[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xc808('0x0'));var util=require(_0xc808('0x1'));var path=require('path');var timeout=require(_0xc808('0x2'));var express=require(_0xc808('0x3'));var router=express['Router']();var fs_extra=require(_0xc808('0x4'));var auth=require(_0xc808('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc808('0x6'));var controller=require(_0xc808('0x7'));router[_0xc808('0x8')]('/',controller[_0xc808('0x9')]);router[_0xc808('0xa')](_0xc808('0xb'),auth[_0xc808('0xc')](),controller[_0xc808('0xd')]);router[_0xc808('0x8')]('/download_log_file',auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xc808('0xe')]=router; \ No newline at end of file +var _0x40cb=['./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x40cb,0x108));var _0xb40c=function(_0x2eb197,_0xd87e96){_0x2eb197=_0x2eb197-0x0;var _0x11928a=_0x40cb[_0x2eb197];return _0x11928a;};'use strict';var multer=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var path=require(_0xb40c('0x2'));var timeout=require(_0xb40c('0x3'));var express=require('express');var router=express[_0xb40c('0x4')]();var fs_extra=require(_0xb40c('0x5'));var auth=require(_0xb40c('0x6'));var interaction=require(_0xb40c('0x7'));var config=require('../../config/environment');var controller=require(_0xb40c('0x8'));router[_0xb40c('0x9')]('/',controller['index']);router[_0xb40c('0xa')](_0xb40c('0xb'),auth[_0xb40c('0xc')](),controller[_0xb40c('0xd')]);router[_0xb40c('0x9')](_0xb40c('0xe'),auth[_0xb40c('0xc')](),controller['downloadLogFile']);module[_0xb40c('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 14d36ec..f445e16 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 _0x85dd=['STRING','INTEGER','sequelize','exports'];(function(_0x2c11ec,_0x774faf){var _0x40a567=function(_0x386f53){while(--_0x386f53){_0x2c11ec['push'](_0x2c11ec['shift']());}};_0x40a567(++_0x774faf);}(_0x85dd,0xd2));var _0xd85d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x85dd[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xd85d('0x0'));module[_0xd85d('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd85d('0x2')]},'data2':{'type':Sequelize[_0xd85d('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd85d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x980b=['sequelize','exports','STRING','INTEGER'];(function(_0xef92d2,_0x2fd06f){var _0x490c1f=function(_0x2f8ca3){while(--_0x2f8ca3){_0xef92d2['push'](_0xef92d2['shift']());}};_0x490c1f(++_0x2fd06f);}(_0x980b,0xa8));var _0xb980=function(_0x3f11f7,_0x389abf){_0x3f11f7=_0x3f11f7-0x0;var _0x2d4e7d=_0x980b[_0x3f11f7];return _0x2d4e7d;};'use strict';var Sequelize=require(_0xb980('0x0'));module[_0xb980('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xb980('0x2')]},'data2':{'type':Sequelize[_0xb980('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xb980('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 4c29991..275e305 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 _0x82c7=['limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','body','params','get','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','undefined'];(function(_0x488f2b,_0x3ee28a){var _0x5c0c05=function(_0x1d9651){while(--_0x1d9651){_0x488f2b['push'](_0x488f2b['shift']());}};_0x5c0c05(++_0x3ee28a);}(_0x82c7,0x18f));var _0x782c=function(_0x215b81,_0x2e5b6d){_0x215b81=_0x215b81-0x0;var _0x52177b=_0x82c7[_0x215b81];return _0x52177b;};'use strict';var emlformat=require(_0x782c('0x0'));var rimraf=require(_0x782c('0x1'));var zipdir=require(_0x782c('0x2'));var jsonpatch=require(_0x782c('0x3'));var rp=require(_0x782c('0x4'));var moment=require(_0x782c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x782c('0x6'));var util=require(_0x782c('0x7'));var path=require(_0x782c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x782c('0x9'));var fs=require('fs');var fs_extra=require(_0x782c('0xa'));var _=require(_0x782c('0xb'));var squel=require(_0x782c('0xc'));var crypto=require(_0x782c('0xd'));var jsforce=require(_0x782c('0xe'));var deskjs=require(_0x782c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x782c('0x10'));var Papa=require('papaparse');var Redis=require(_0x782c('0x11'));var authService=require(_0x782c('0x12'));var qs=require(_0x782c('0x13'));var as=require(_0x782c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x782c('0x15'))(_0x782c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x782c('0x17'));var db=require(_0x782c('0x18'))['db'];function respondWithStatusCode(_0x3e8b62,_0x2696f8){_0x2696f8=_0x2696f8||0xcc;return function(_0x48fd5a){if(_0x48fd5a){return _0x3e8b62['sendStatus'](_0x2696f8);}return _0x3e8b62[_0x782c('0x19')](_0x2696f8)['end']();};}function respondWithResult(_0x4dcb78,_0x3a0747){_0x3a0747=_0x3a0747||0xc8;return function(_0x322a2d){if(_0x322a2d){return _0x4dcb78['status'](_0x3a0747)['json'](_0x322a2d);}};}function respondWithFilteredResult(_0x4492e3,_0x4f1baf){return function(_0x3dc870){if(_0x3dc870){var _0x2d659f=typeof _0x4f1baf['offset']===_0x782c('0x1a')&&typeof _0x4f1baf[_0x782c('0x1b')]===_0x782c('0x1a');var _0x348f82=_0x3dc870['count'];var _0x464361=_0x2d659f?0x0:_0x4f1baf['offset'];var _0x50c1cc=_0x2d659f?_0x3dc870[_0x782c('0x1c')]:_0x4f1baf[_0x782c('0x1d')]+_0x4f1baf['limit'];var _0x5d6351;if(_0x50c1cc>=_0x348f82){_0x50c1cc=_0x348f82;_0x5d6351=0xc8;}else{_0x5d6351=0xce;}_0x4492e3['status'](_0x5d6351);return _0x4492e3[_0x782c('0x1e')](_0x782c('0x1f'),_0x464361+'-'+_0x50c1cc+'/'+_0x348f82)[_0x782c('0x20')](_0x3dc870);}return null;};}function patchUpdates(_0x45cdfc){return function(_0x50061d){try{jsonpatch[_0x782c('0x21')](_0x50061d,_0x45cdfc,!![]);}catch(_0x654941){return BPromise[_0x782c('0x22')](_0x654941);}return _0x50061d[_0x782c('0x23')]();};}function saveUpdates(_0x13ad41,_0x5eda1a){return function(_0x3ceb81){if(_0x3ceb81){return _0x3ceb81[_0x782c('0x24')](_0x13ad41)[_0x782c('0x25')](function(_0x2ef085){return _0x2ef085;});}return null;};}function removeEntity(_0x4011f0,_0x1390dd){return function(_0x505b57){if(_0x505b57){return _0x505b57[_0x782c('0x26')]()[_0x782c('0x25')](function(){_0x4011f0[_0x782c('0x19')](0xcc)[_0x782c('0x27')]();});}};}function handleEntityNotFound(_0x2f1090,_0x28894d){return function(_0x411fca){if(!_0x411fca){_0x2f1090[_0x782c('0x28')](0x194);}return _0x411fca;};}function handleError(_0x4b5430,_0x4c51e7){_0x4c51e7=_0x4c51e7||0x1f4;return function(_0x48e39f){logger[_0x782c('0x29')](_0x48e39f[_0x782c('0x2a')]);if(_0x48e39f['name']){delete _0x48e39f[_0x782c('0x2b')];}_0x4b5430[_0x782c('0x19')](_0x4c51e7)['send'](_0x48e39f);};}var utilLicense=require(_0x782c('0x17'));exports[_0x782c('0x2c')]=function(_0x344712,_0x5de111){var _0x30798a={'raw':!![],'where':{'id':0x1}},_0x406cfc={};_0x406cfc['model']=_[_0x782c('0x2d')](db[_0x782c('0x2e')][_0x782c('0x2f')]);_0x406cfc[_0x782c('0x30')]=_[_0x782c('0x2d')](_0x344712[_0x782c('0x30')]);_0x406cfc[_0x782c('0x31')]=_[_0x782c('0x32')](_0x406cfc[_0x782c('0x33')],_0x406cfc['query']);_0x30798a[_0x782c('0x34')]=_[_0x782c('0x32')](_0x406cfc[_0x782c('0x33')],qs[_0x782c('0x35')](_0x344712['query'][_0x782c('0x35')]));_0x30798a[_0x782c('0x34')]=_0x30798a[_0x782c('0x34')][_0x782c('0x36')]?_0x30798a[_0x782c('0x34')]:_0x406cfc['model'];_0x30798a=_[_0x782c('0x37')]({},_0x30798a,_0x344712[_0x782c('0x38')]);return utilLicense[_0x782c('0x39')](_0x30798a)[_0x782c('0x25')](respondWithResult(_0x5de111,null))['catch'](handleError(_0x5de111,null));};exports['update']=function(_0x2eba02,_0x4885cd){if(_0x2eba02[_0x782c('0x3a')]['id']){delete _0x2eba02[_0x782c('0x3a')]['id'];}return db[_0x782c('0x2e')]['find']({'where':{'id':_0x2eba02[_0x782c('0x3b')]['id']}})[_0x782c('0x25')](handleEntityNotFound(_0x4885cd,null))[_0x782c('0x25')](function(_0x1a61a0){var _0x4f3b20=_0x1a61a0[_0x782c('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x4f3b20,_0x2eba02[_0x782c('0x3a')]['key']);})[_0x782c('0x25')](function(_0x3ff32d){if(!_0x3ff32d['demo']){return saveUpdates(_0x2eba02[_0x782c('0x3a')],null);}return _0x3ff32d;})[_0x782c('0x25')](respondWithResult(_0x4885cd,null))['catch'](handleError(_0x4885cd,null));};exports[_0x782c('0x3d')]=function(_0x515b8f,_0x1e91ed){var _0x5e06b8=_0x782c('0x3e');var _0x15ca58=path[_0x782c('0x3f')](_0x782c('0x40'),_0x782c('0x41'),'xcally',_0x5e06b8);_0x1e91ed[_0x782c('0x42')](_0x782c('0x43'),_0x782c('0x44')+_0x5e06b8);_0x1e91ed[_0x782c('0x1e')]('Content-Type',_0x782c('0x45'));_0x1e91ed[_0x782c('0x46')](_0x15ca58);}; \ No newline at end of file +var _0x8dfa=['body','find','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','download','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','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','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','fields','merge','options'];(function(_0x44842b,_0x1e39eb){var _0x2b1240=function(_0x2482cc){while(--_0x2482cc){_0x44842b['push'](_0x44842b['shift']());}};_0x2b1240(++_0x1e39eb);}(_0x8dfa,0xa3));var _0xa8df=function(_0x44334a,_0x181bce){_0x44334a=_0x44334a-0x0;var _0x20a140=_0x8dfa[_0x44334a];return _0x20a140;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8df('0x0'));var jsonpatch=require(_0xa8df('0x1'));var rp=require('request-promise');var moment=require(_0xa8df('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa8df('0x3'));var util=require(_0xa8df('0x4'));var path=require(_0xa8df('0x5'));var sox=require(_0xa8df('0x6'));var csv=require(_0xa8df('0x7'));var ejs=require(_0xa8df('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa8df('0x9'));var squel=require(_0xa8df('0xa'));var crypto=require('crypto');var jsforce=require(_0xa8df('0xb'));var deskjs=require(_0xa8df('0xc'));var toCsv=require(_0xa8df('0x7'));var querystring=require('querystring');var Papa=require(_0xa8df('0xd'));var Redis=require(_0xa8df('0xe'));var authService=require(_0xa8df('0xf'));var qs=require(_0xa8df('0x10'));var as=require(_0xa8df('0x11'));var hardwareService=require(_0xa8df('0x12'));var logger=require(_0xa8df('0x13'))(_0xa8df('0x14'));var utils=require(_0xa8df('0x15'));var config=require(_0xa8df('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8df('0x17'))['db'];function respondWithStatusCode(_0x7f0727,_0x584ff9){_0x584ff9=_0x584ff9||0xcc;return function(_0x28eb23){if(_0x28eb23){return _0x7f0727[_0xa8df('0x18')](_0x584ff9);}return _0x7f0727[_0xa8df('0x19')](_0x584ff9)[_0xa8df('0x1a')]();};}function respondWithResult(_0x3b86e5,_0x28b3be){_0x28b3be=_0x28b3be||0xc8;return function(_0x224bcb){if(_0x224bcb){return _0x3b86e5[_0xa8df('0x19')](_0x28b3be)['json'](_0x224bcb);}};}function respondWithFilteredResult(_0x306964,_0x12eae4){return function(_0x296fbb){if(_0x296fbb){var _0x33ad3a=typeof _0x12eae4['offset']===_0xa8df('0x1b')&&typeof _0x12eae4['limit']==='undefined';var _0x20416c=_0x296fbb[_0xa8df('0x1c')];var _0x2ae852=_0x33ad3a?0x0:_0x12eae4[_0xa8df('0x1d')];var _0x53fd74=_0x33ad3a?_0x296fbb[_0xa8df('0x1c')]:_0x12eae4[_0xa8df('0x1d')]+_0x12eae4[_0xa8df('0x1e')];var _0x1a67b0;if(_0x53fd74>=_0x20416c){_0x53fd74=_0x20416c;_0x1a67b0=0xc8;}else{_0x1a67b0=0xce;}_0x306964[_0xa8df('0x19')](_0x1a67b0);return _0x306964[_0xa8df('0x1f')](_0xa8df('0x20'),_0x2ae852+'-'+_0x53fd74+'/'+_0x20416c)[_0xa8df('0x21')](_0x296fbb);}return null;};}function patchUpdates(_0x96b25a){return function(_0x4c8db9){try{jsonpatch[_0xa8df('0x22')](_0x4c8db9,_0x96b25a,!![]);}catch(_0x53937f){return BPromise[_0xa8df('0x23')](_0x53937f);}return _0x4c8db9[_0xa8df('0x24')]();};}function saveUpdates(_0x224d33,_0x1c4525){return function(_0x2990c0){if(_0x2990c0){return _0x2990c0[_0xa8df('0x25')](_0x224d33)[_0xa8df('0x26')](function(_0x2edd5b){return _0x2edd5b;});}return null;};}function removeEntity(_0x3a1fa7,_0x4442d9){return function(_0x3d4a95){if(_0x3d4a95){return _0x3d4a95[_0xa8df('0x27')]()[_0xa8df('0x26')](function(){_0x3a1fa7[_0xa8df('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2122c9,_0x3375b3){return function(_0xad0070){if(!_0xad0070){_0x2122c9['sendStatus'](0x194);}return _0xad0070;};}function handleError(_0x27daa2,_0x14e0e7){_0x14e0e7=_0x14e0e7||0x1f4;return function(_0xbba40){logger[_0xa8df('0x28')](_0xbba40[_0xa8df('0x29')]);if(_0xbba40[_0xa8df('0x2a')]){delete _0xbba40['name'];}_0x27daa2['status'](_0x14e0e7)[_0xa8df('0x2b')](_0xbba40);};}var utilLicense=require(_0xa8df('0x2c'));exports[_0xa8df('0x2d')]=function(_0xf4e7b,_0x469a62){var _0xbc81c={'raw':!![],'where':{'id':0x1}},_0x5824a6={};_0x5824a6[_0xa8df('0x2e')]=_[_0xa8df('0x2f')](db[_0xa8df('0x30')][_0xa8df('0x31')]);_0x5824a6[_0xa8df('0x32')]=_[_0xa8df('0x2f')](_0xf4e7b['query']);_0x5824a6[_0xa8df('0x33')]=_['intersection'](_0x5824a6[_0xa8df('0x2e')],_0x5824a6[_0xa8df('0x32')]);_0xbc81c[_0xa8df('0x34')]=_['intersection'](_0x5824a6['model'],qs[_0xa8df('0x35')](_0xf4e7b['query'][_0xa8df('0x35')]));_0xbc81c[_0xa8df('0x34')]=_0xbc81c[_0xa8df('0x34')]['length']?_0xbc81c[_0xa8df('0x34')]:_0x5824a6['model'];_0xbc81c=_[_0xa8df('0x36')]({},_0xbc81c,_0xf4e7b[_0xa8df('0x37')]);return utilLicense['getLicense'](_0xbc81c)[_0xa8df('0x26')](respondWithResult(_0x469a62,null))['catch'](handleError(_0x469a62,null));};exports[_0xa8df('0x25')]=function(_0x44cc22,_0x4fefed){if(_0x44cc22[_0xa8df('0x38')]['id']){delete _0x44cc22[_0xa8df('0x38')]['id'];}return db[_0xa8df('0x30')][_0xa8df('0x39')]({'where':{'id':_0x44cc22[_0xa8df('0x3a')]['id']}})[_0xa8df('0x26')](handleEntityNotFound(_0x4fefed,null))[_0xa8df('0x26')](function(_0x525d73){var _0x3b9a91=_0x525d73[_0xa8df('0x3b')]({'plain':!![]});return utilLicense[_0xa8df('0x3c')](_0x3b9a91,_0x44cc22[_0xa8df('0x38')][_0xa8df('0x3d')]);})['then'](function(_0x3c5fa9){if(!_0x3c5fa9[_0xa8df('0x3e')]){return saveUpdates(_0x44cc22['body'],null);}return _0x3c5fa9;})[_0xa8df('0x26')](respondWithResult(_0x4fefed,null))[_0xa8df('0x3f')](handleError(_0x4fefed,null));};exports[_0xa8df('0x40')]=function(_0x171031,_0x522cba){var _0x480c6c=_0xa8df('0x41');var _0x54f71e=path[_0xa8df('0x42')]('/var',_0xa8df('0x43'),'xcally',_0x480c6c);_0x522cba[_0xa8df('0x44')](_0xa8df('0x45'),_0xa8df('0x46')+_0x480c6c);_0x522cba[_0xa8df('0x1f')](_0xa8df('0x47'),'text/plain');_0x522cba[_0xa8df('0x48')](_0x54f71e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 54447c0..430e555 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 _0x3167=['rimraf','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x545906,_0x46fac2){var _0x431d=function(_0x2e4ed0){while(--_0x2e4ed0){_0x545906['push'](_0x545906['shift']());}};_0x431d(++_0x46fac2);}(_0x3167,0xfd));var _0x7316=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x3167[_0x139b63];return _0x2493f2;};'use strict';var _=require(_0x7316('0x0'));var util=require(_0x7316('0x1'));var logger=require(_0x7316('0x2'))('api');var moment=require(_0x7316('0x3'));var BPromise=require(_0x7316('0x4'));var rp=require(_0x7316('0x5'));var fs=require('fs');var path=require(_0x7316('0x6'));var rimraf=require(_0x7316('0x7'));var config=require('../../config/environment');var attributes=require(_0x7316('0x8'));module[_0x7316('0x9')]=function(_0x11cdad,_0x217f01){return _0x11cdad[_0x7316('0xa')](_0x7316('0xb'),attributes,{'tableName':_0x7316('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf4f=['../../config/environment','exports','define','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcf4f,0x1c3));var _0xfcf4=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xcf4f[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xfcf4('0x0'));var logger=require(_0xfcf4('0x1'))('api');var moment=require(_0xfcf4('0x2'));var BPromise=require('bluebird');var rp=require(_0xfcf4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcf4('0x4'));var config=require(_0xfcf4('0x5'));var attributes=require('./license.attributes');module[_0xfcf4('0x6')]=function(_0x289f70,_0x5d165e){return _0x289f70[_0xfcf4('0x7')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5202181..d1f6a3d 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 _0xb993=['../../config/environment','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf8ebe,_0x4a8cba){var _0x11131f=function(_0x2a5d52){while(--_0x2a5d52){_0xf8ebe['push'](_0xf8ebe['shift']());}};_0x11131f(++_0x4a8cba);}(_0xb993,0x15e));var _0x3b99=function(_0xd3c6f1,_0xba2320){_0xd3c6f1=_0xd3c6f1-0x0;var _0x36cc91=_0xb993[_0xd3c6f1];return _0x36cc91;};'use strict';var _=require('lodash');var util=require(_0x3b99('0x0'));var moment=require(_0x3b99('0x1'));var BPromise=require(_0x3b99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b99('0x3'))['db'];var utils=require(_0x3b99('0x4'));var logger=require(_0x3b99('0x5'))(_0x3b99('0x6'));var config=require(_0x3b99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b99('0x8')][_0x3b99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4c1b,_0x1fba8a,_0x3319f3){return new BPromise(function(_0x25a7ac,_0xb20e13){return client['request'](_0x2f4c1b,_0x3319f3)[_0x3b99('0xa')](function(_0x3b9a89){logger[_0x3b99('0xb')](_0x3b99('0xc'),_0x1fba8a,_0x3b99('0xd'));logger[_0x3b99('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x1fba8a,'request\x20sent',JSON[_0x3b99('0xf')](_0x3b9a89));if(_0x3b9a89['error']){if(_0x3b9a89[_0x3b99('0x10')][_0x3b99('0x11')]===0x1f4){logger[_0x3b99('0x10')]('License,\x20%s,\x20%s',_0x1fba8a,_0x3b9a89['error'][_0x3b99('0x12')]);return _0xb20e13(_0x3b9a89['error'][_0x3b99('0x12')]);}logger['error'](_0x3b99('0xc'),_0x1fba8a,_0x3b9a89['error'][_0x3b99('0x12')]);return _0x25a7ac(_0x3b9a89[_0x3b99('0x10')]['message']);}else{logger[_0x3b99('0xb')]('License,\x20%s,\x20%s',_0x1fba8a,_0x3b99('0xd'));_0x25a7ac(_0x3b9a89[_0x3b99('0x13')][_0x3b99('0x12')]);}})[_0x3b99('0x14')](function(_0x2e5f52){logger[_0x3b99('0x10')](_0x3b99('0xc'),_0x1fba8a,_0x2e5f52);_0xb20e13(_0x2e5f52);});});} \ No newline at end of file +var _0x1817=['code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x1817,0xf8));var _0x7181=function(_0x310e2a,_0x53f82){_0x310e2a=_0x310e2a-0x0;var _0x1ac3c8=_0x1817[_0x310e2a];return _0x1ac3c8;};'use strict';var _=require(_0x7181('0x0'));var util=require(_0x7181('0x1'));var moment=require(_0x7181('0x2'));var BPromise=require(_0x7181('0x3'));var rs=require(_0x7181('0x4'));var fs=require('fs');var Redis=require(_0x7181('0x5'));var db=require(_0x7181('0x6'))['db'];var utils=require(_0x7181('0x7'));var logger=require(_0x7181('0x8'))(_0x7181('0x9'));var config=require(_0x7181('0xa'));var jayson=require(_0x7181('0xb'));var client=jayson[_0x7181('0xc')][_0x7181('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1512c2,_0x215bc7,_0x559f0f){return new BPromise(function(_0x2b5e4b,_0x2c714b){return client[_0x7181('0xe')](_0x1512c2,_0x559f0f)[_0x7181('0xf')](function(_0xa349f8){logger[_0x7181('0x10')]('License,\x20%s,\x20%s',_0x215bc7,'request\x20sent');logger[_0x7181('0x11')](_0x7181('0x12'),_0x215bc7,_0x7181('0x13'),JSON[_0x7181('0x14')](_0xa349f8));if(_0xa349f8[_0x7181('0x15')]){if(_0xa349f8['error'][_0x7181('0x16')]===0x1f4){logger[_0x7181('0x15')](_0x7181('0x17'),_0x215bc7,_0xa349f8['error'][_0x7181('0x18')]);return _0x2c714b(_0xa349f8['error'][_0x7181('0x18')]);}logger[_0x7181('0x15')](_0x7181('0x17'),_0x215bc7,_0xa349f8[_0x7181('0x15')][_0x7181('0x18')]);return _0x2b5e4b(_0xa349f8[_0x7181('0x15')][_0x7181('0x18')]);}else{logger['info'](_0x7181('0x17'),_0x215bc7,_0x7181('0x13'));_0x2b5e4b(_0xa349f8[_0x7181('0x19')][_0x7181('0x18')]);}})[_0x7181('0x1a')](function(_0x251d97){logger['error']('License,\x20%s,\x20%s',_0x215bc7,_0x251d97);_0x2c714b(_0x251d97);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a508ed2..f151bc4 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 _0x092d=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','path'];(function(_0x3cce7f,_0x387619){var _0x47227e=function(_0x509ad7){while(--_0x509ad7){_0x3cce7f['push'](_0x3cce7f['shift']());}};_0x47227e(++_0x387619);}(_0x092d,0x1a5));var _0xd092=function(_0x1830a9,_0x1583bd){_0x1830a9=_0x1830a9-0x0;var _0x2b6166=_0x092d[_0x1830a9];return _0x2b6166;};'use strict';var multer=require(_0xd092('0x0'));var util=require('util');var path=require(_0xd092('0x1'));var timeout=require(_0xd092('0x2'));var express=require(_0xd092('0x3'));var router=express['Router']();var fs_extra=require(_0xd092('0x4'));var auth=require(_0xd092('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd092('0x6'));var controller=require(_0xd092('0x7'));router[_0xd092('0x8')]('/',auth[_0xd092('0x9')](),controller['index']);router['get'](_0xd092('0xa'),auth[_0xd092('0x9')](),controller[_0xd092('0xb')]);router[_0xd092('0x8')](_0xd092('0xc'),auth[_0xd092('0x9')](),controller[_0xd092('0xd')]);router[_0xd092('0x8')](_0xd092('0xe'),auth['isAuthenticated'](),controller[_0xd092('0xf')]);router[_0xd092('0x8')](_0xd092('0x10'),auth[_0xd092('0x9')](),controller[_0xd092('0x11')]);router[_0xd092('0x8')](_0xd092('0x12'),auth[_0xd092('0x9')](),controller['getImap']);router['get'](_0xd092('0x13'),auth[_0xd092('0x9')](),controller[_0xd092('0x14')]);router[_0xd092('0x8')](_0xd092('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xd092('0x16'),auth[_0xd092('0x9')](),controller['getApplications']);router[_0xd092('0x8')](_0xd092('0x17'),auth[_0xd092('0x9')](),controller[_0xd092('0x18')]);router[_0xd092('0x8')](_0xd092('0x19'),auth[_0xd092('0x9')](),controller[_0xd092('0x1a')]);router[_0xd092('0x8')](_0xd092('0x1b'),auth[_0xd092('0x9')](),controller[_0xd092('0x1c')]);router[_0xd092('0x1d')](_0xd092('0xe'),auth[_0xd092('0x9')](),controller[_0xd092('0x1e')]);router[_0xd092('0x1d')]('/:id/canned_answers',auth[_0xd092('0x9')](),controller[_0xd092('0x1f')]);router[_0xd092('0x1d')]('/',auth['isAuthenticated'](),controller[_0xd092('0x20')]);router[_0xd092('0x1d')](_0xd092('0x12'),auth[_0xd092('0x9')](),controller[_0xd092('0x21')]);router[_0xd092('0x1d')](_0xd092('0x13'),auth[_0xd092('0x9')](),controller[_0xd092('0x22')]);router[_0xd092('0x1d')](_0xd092('0x15'),auth[_0xd092('0x9')](),controller[_0xd092('0x23')]);router['post'](_0xd092('0x16'),auth[_0xd092('0x9')](),controller[_0xd092('0x24')]);router['post']('/:id/send',auth[_0xd092('0x9')](),controller[_0xd092('0x25')]);router[_0xd092('0x1d')](_0xd092('0x1b'),auth[_0xd092('0x9')](),controller[_0xd092('0x26')]);router[_0xd092('0x27')](_0xd092('0xc'),auth[_0xd092('0x9')](),controller['update']);router[_0xd092('0x28')](_0xd092('0xe'),auth[_0xd092('0x9')](),controller[_0xd092('0x29')]);router[_0xd092('0x28')](_0xd092('0x10'),auth[_0xd092('0x9')](),controller[_0xd092('0x2a')]);router[_0xd092('0x28')](_0xd092('0x12'),auth[_0xd092('0x9')](),controller[_0xd092('0x2b')]);router[_0xd092('0x28')]('/:id/out_servers',auth[_0xd092('0x9')](),controller['removeSmtp']);router[_0xd092('0x28')](_0xd092('0xc'),auth['isAuthenticated'](),controller[_0xd092('0x2c')]);router[_0xd092('0x28')]('/:id/users',auth[_0xd092('0x9')](),controller[_0xd092('0x2d')]);module[_0xd092('0x2e')]=router; \ No newline at end of file +var _0x8d85=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','destroy','exports','multer'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x8d85,0x1af));var _0x58d8=function(_0x4157d7,_0x27b6b7){_0x4157d7=_0x4157d7-0x0;var _0x501c64=_0x8d85[_0x4157d7];return _0x501c64;};'use strict';var multer=require(_0x58d8('0x0'));var util=require('util');var path=require(_0x58d8('0x1'));var timeout=require(_0x58d8('0x2'));var express=require(_0x58d8('0x3'));var router=express['Router']();var fs_extra=require(_0x58d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58d8('0x5'));var config=require(_0x58d8('0x6'));var controller=require(_0x58d8('0x7'));router[_0x58d8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x58d8('0x9'),auth[_0x58d8('0xa')](),controller[_0x58d8('0xb')]);router[_0x58d8('0x8')](_0x58d8('0xc'),auth[_0x58d8('0xa')](),controller[_0x58d8('0xd')]);router[_0x58d8('0x8')](_0x58d8('0xe'),auth[_0x58d8('0xa')](),controller[_0x58d8('0xf')]);router[_0x58d8('0x8')](_0x58d8('0x10'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x11')]);router[_0x58d8('0x8')](_0x58d8('0x12'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x13')]);router[_0x58d8('0x8')](_0x58d8('0x14'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x15')]);router['get'](_0x58d8('0x16'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x17')]);router[_0x58d8('0x8')](_0x58d8('0x18'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x19')]);router['get'](_0x58d8('0x1a'),auth[_0x58d8('0xa')](),controller['getMessages']);router[_0x58d8('0x8')](_0x58d8('0x1b'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x1c')]);router[_0x58d8('0x8')](_0x58d8('0x1d'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x1e')]);router['post'](_0x58d8('0xe'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x1f')]);router[_0x58d8('0x20')](_0x58d8('0x10'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x21')]);router['post']('/',auth[_0x58d8('0xa')](),controller[_0x58d8('0x22')]);router[_0x58d8('0x20')]('/:id/in_servers',auth[_0x58d8('0xa')](),controller[_0x58d8('0x23')]);router[_0x58d8('0x20')](_0x58d8('0x14'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x24')]);router[_0x58d8('0x20')](_0x58d8('0x16'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x25')]);router[_0x58d8('0x20')](_0x58d8('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x58d8('0x20')](_0x58d8('0x26'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x27')]);router[_0x58d8('0x20')]('/:id/users',auth[_0x58d8('0xa')](),controller[_0x58d8('0x28')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x58d8('0x29')]);router['delete'](_0x58d8('0xe'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x2a')]);router[_0x58d8('0x2b')]('/:id/canned_answers',auth[_0x58d8('0xa')](),controller['removeAnswers']);router['delete'](_0x58d8('0x12'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x2c')]);router[_0x58d8('0x2b')](_0x58d8('0x14'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x2d')]);router[_0x58d8('0x2b')]('/:id',auth['isAuthenticated'](),controller[_0x58d8('0x2e')]);router['delete'](_0x58d8('0x1d'),auth[_0x58d8('0xa')](),controller['removeAgents']);module[_0x58d8('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6d1a650..60771bc 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 _0xafdf=['yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail'];(function(_0x5cee2f,_0x27fadc){var _0x144f61=function(_0x3bafe1){while(--_0x3bafe1){_0x5cee2f['push'](_0x5cee2f['shift']());}};_0x144f61(++_0x27fadc);}(_0xafdf,0x64));var _0xfafd=function(_0x2031f5,_0x56a405){_0x2031f5=_0x2031f5-0x0;var _0x533b49=_0xafdf[_0x2031f5];return _0x533b49;};'use strict';var Sequelize=require(_0xfafd('0x0'));module[_0xfafd('0x1')]={'description':{'type':Sequelize[_0xfafd('0x2')]},'name':{'type':Sequelize[_0xfafd('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfafd('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfafd('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xfafd('0x4')]},'markAsUnread':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfafd('0x2')],'allowNull':![],'defaultValue':_0xfafd('0x5')},'fontSize':{'type':Sequelize[_0xfafd('0x6')](0x2)[_0xfafd('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfafd('0x4')],'defaultValue':function(){return _0xfafd('0x8');}},'notificationSound':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfafd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfafd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfafd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xfafd('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xfafd('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x32a034){if(!_0x32a034)this[_0xfafd('0xa')](_0xfafd('0xb'),null);this[_0xfafd('0xa')](_0xfafd('0xc'),_0x32a034);}},'provider':{'type':Sequelize['ENUM'](_0xfafd('0xd'),'hotmail',_0xfafd('0xe'),_0xfafd('0xf')),'defaultValue':null,'get':function(){if(!this[_0xfafd('0x10')](_0xfafd('0x11')))return _0xfafd('0x12');return this[_0xfafd('0x10')](_0xfafd('0x11'));},'set':function(_0x1548e4){if(_0x1548e4===_0xfafd('0x12'))_0x1548e4=null;return this['setDataValue']('provider',_0x1548e4);}}}; \ No newline at end of file +var _0x9646=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x2d1f6f,_0x239dec){var _0x2b8c80=function(_0x2bb5ce){while(--_0x2bb5ce){_0x2d1f6f['push'](_0x2d1f6f['shift']());}};_0x2b8c80(++_0x239dec);}(_0x9646,0x14f));var _0x6964=function(_0x96a3e,_0x166ff0){_0x96a3e=_0x96a3e-0x0;var _0x44e17a=_0x9646[_0x96a3e];return _0x44e17a;};'use strict';var Sequelize=require(_0x6964('0x0'));module[_0x6964('0x1')]={'description':{'type':Sequelize[_0x6964('0x2')]},'name':{'type':Sequelize[_0x6964('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x6964('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6964('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6964('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6964('0x4')]},'markAsUnread':{'type':Sequelize[_0x6964('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6964('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6964('0x5')](0x2)[_0x6964('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6964('0x4')],'defaultValue':function(){return _0x6964('0x7');}},'notificationSound':{'type':Sequelize[_0x6964('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6964('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6964('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6964('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6964('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6964('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6964('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6964('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6964('0x3')],'defaultValue':![],'comment':_0x6964('0x9'),'set':function(_0x1f96b8){if(!_0x1f96b8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6964('0xa')](_0x6964('0xb'),_0x1f96b8);}},'provider':{'type':Sequelize[_0x6964('0xc')](_0x6964('0xd'),_0x6964('0xe'),_0x6964('0xf'),_0x6964('0x10')),'defaultValue':null,'get':function(){if(!this[_0x6964('0x11')](_0x6964('0x12')))return _0x6964('0x13');return this['getDataValue'](_0x6964('0x12'));},'set':function(_0x272f2e){if(_0x272f2e===_0x6964('0x13'))_0x272f2e=null;return this[_0x6964('0xa')]('provider',_0x272f2e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0711a6c..c933ffb 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 _0xc609=['../../mysqldb','redis','defaults','register','client','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','update','destroy','MailAccounts','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','authentication','Imap','Smtp','index','MailServerOut','Pause','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','options','MailAccount','includeAll','include','rows','MailServerIn','mandatoryDispositionPause','body','custom','provider','find','Mail\x20Account\x20not\x20found','service','describe','addDisposition','params','MailAccountId','Disposition','create','getDispositions','findOne','findAll','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','email','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','nolimit','order','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','from','subject','attach','out','messageId','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x479552,_0x454202){var _0x47d0c3=function(_0x194998){while(--_0x194998){_0x479552['push'](_0x479552['shift']());}};_0x47d0c3(++_0x454202);}(_0xc609,0x17d));var _0x9c60=function(_0x5486dc,_0x166c15){_0x5486dc=_0x5486dc-0x0;var _0x4bd4aa=_0xc609[_0x5486dc];return _0x4bd4aa;};'use strict';var moment=require('moment');var BPromise=require(_0x9c60('0x0'));var util=require(_0x9c60('0x1'));var path=require(_0x9c60('0x2'));var _=require('lodash');var juice=require(_0x9c60('0x3'));var Redis=require(_0x9c60('0x4'));var qs=require(_0x9c60('0x5'));var logger=require(_0x9c60('0x6'))(_0x9c60('0x7'));var config=require(_0x9c60('0x8'));var db=require(_0x9c60('0x9'))['db'];config[_0x9c60('0xa')]=_[_0x9c60('0xb')](config[_0x9c60('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c60('0xa')]));require('./mailAccount.socket')[_0x9c60('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c60('0xd')][_0x9c60('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1c1e49,_0xcd89fb,_0x13acc1,_0x85bd47){return new BPromise(function(_0x26740e,_0x31a47d){var _0x3f0cb1=_0x85bd47||client;return _0x3f0cb1['request'](_0x1c1e49,_0x13acc1)[_0x9c60('0xf')](function(_0x4aa3ee){logger['info'](_0x9c60('0x10'),_0xcd89fb,_0x9c60('0x11'));logger['debug'](_0x9c60('0x12'),_0xcd89fb,_0x9c60('0x11'),JSON['stringify'](_0x4aa3ee));if(_0x4aa3ee[_0x9c60('0x13')]){if(_0x4aa3ee[_0x9c60('0x13')][_0x9c60('0x14')]===0x1f4){logger[_0x9c60('0x13')](_0x9c60('0x10'),_0xcd89fb,_0x4aa3ee[_0x9c60('0x13')][_0x9c60('0x15')]);return _0x31a47d(_0x4aa3ee[_0x9c60('0x13')][_0x9c60('0x15')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0xcd89fb,_0x4aa3ee['error'][_0x9c60('0x15')]);return _0x26740e(_0x4aa3ee[_0x9c60('0x13')][_0x9c60('0x15')]);}else{logger['info'](_0x9c60('0x10'),_0xcd89fb,'request\x20sent');_0x26740e(_0x4aa3ee[_0x9c60('0x16')][_0x9c60('0x15')]);}})[_0x9c60('0x17')](function(_0xdff2f1){logger[_0x9c60('0x13')](_0x9c60('0x10'),_0xcd89fb,_0xdff2f1);_0x31a47d(_0xdff2f1);});});}function respondWithStatusCode(_0x5c514f,_0x101e1d){_0x101e1d=_0x101e1d||0xcc;return function(_0x1cfd21){if(_0x1cfd21){return _0x5c514f[_0x9c60('0x18')](_0x101e1d);}return _0x5c514f[_0x9c60('0x19')](_0x101e1d)['end']();};}function respondWithResult(_0x3ac18f,_0x56b5c6){_0x56b5c6=_0x56b5c6||0xc8;return function(_0x345d64){if(_0x345d64){return _0x3ac18f[_0x9c60('0x19')](_0x56b5c6)['json'](_0x345d64);}};}function respondWithFilteredResult(_0x45845c,_0x4fabc6){return function(_0xd993ea){if(_0xd993ea){var _0x4b112b=typeof _0x4fabc6[_0x9c60('0x1a')]===_0x9c60('0x1b')&&typeof _0x4fabc6[_0x9c60('0x1c')]==='undefined';var _0x13743e=_0xd993ea[_0x9c60('0x1d')];var _0x616d9c=_0x4b112b?0x0:_0x4fabc6[_0x9c60('0x1a')];var _0x51f183=_0x4b112b?_0xd993ea[_0x9c60('0x1d')]:_0x4fabc6[_0x9c60('0x1a')]+_0x4fabc6[_0x9c60('0x1c')];var _0x486ebc;if(_0x51f183>=_0x13743e){_0x51f183=_0x13743e;_0x486ebc=0xc8;}else{_0x486ebc=0xce;}_0x45845c[_0x9c60('0x19')](_0x486ebc);return _0x45845c[_0x9c60('0x1e')]('Content-Range',_0x616d9c+'-'+_0x51f183+'/'+_0x13743e)['json'](_0xd993ea);}return null;};}function saveUpdates(_0x48ca72){return function(_0x3a70db){if(_0x3a70db){return _0x3a70db[_0x9c60('0x1f')](_0x48ca72)[_0x9c60('0xf')](function(_0x2efb2f){return _0x2efb2f;});}return null;};}function removeEntity(_0x74a467){return function(_0x414d54){if(_0x414d54){return _0x414d54[_0x9c60('0x20')]()['then'](function(){var _0x2f051f=_0x414d54['get']({'plain':!![]});var _0x3fbe6d=_0x9c60('0x21');return db[_0x9c60('0x22')][_0x9c60('0x20')]({'where':{'type':_0x3fbe6d,'resourceId':_0x2f051f['id']}})[_0x9c60('0xf')](function(){return _0x414d54;});})['then'](function(){_0x74a467['status'](0xcc)[_0x9c60('0x23')]();});}};}function handleEntityNotFound(_0x53f8cc){return function(_0x25b5a4){if(!_0x25b5a4){_0x53f8cc[_0x9c60('0x18')](0x194);}return _0x25b5a4;};}function handleError(_0x26a850,_0x2c38ee){_0x2c38ee=_0x2c38ee||0x1f4;return function(_0x1a21ad){logger['error'](_0x1a21ad[_0x9c60('0x24')]);if(_0x1a21ad[_0x9c60('0x25')]){delete _0x1a21ad[_0x9c60('0x25')];}_0x26a850[_0x9c60('0x19')](_0x2c38ee)[_0x9c60('0x26')](_0x1a21ad);};}function getImapHost(_0x1376d8){switch(_0x1376d8){case _0x9c60('0x27'):return _0x9c60('0x28');case _0x9c60('0x29'):return _0x9c60('0x2a');case _0x9c60('0x2b'):return _0x9c60('0x2c');case _0x9c60('0x2d'):return'outlook.office365.com';}throw new Error(_0x9c60('0x2e'),_0x1376d8);}function getSmtpHost(_0x51f7d5){switch(_0x51f7d5){case _0x9c60('0x27'):return _0x9c60('0x2f');case _0x9c60('0x29'):return'smtp.mail.yahoo.com';case'hotmail':return _0x9c60('0x30');case _0x9c60('0x2d'):return _0x9c60('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x51f7d5);}function getAuthenticationOptions(_0x7bd0c1,_0x254a77){var _0x5499ad={};var _0x51366b={};if(_0x7bd0c1){_0x5499ad[_0x9c60('0x32')]=_0x51366b[_0x9c60('0x32')]=_0x254a77[_0x9c60('0x33')];_0x5499ad[_0x9c60('0x34')]=_0x51366b[_0x9c60('0x35')]=_0x254a77['password'];if(_0x254a77[_0x9c60('0x36')]){_0x5499ad[_0x9c60('0x36')]=_0x51366b[_0x9c60('0x36')]=!![];_0x5499ad['CloudProviderId']=_0x51366b['CloudProviderId']=_0x254a77[_0x9c60('0x37')];_0x5499ad['password']=_0x51366b['pass']=null;}else{_0x5499ad[_0x9c60('0x37')]=_0x51366b[_0x9c60('0x37')]=null;}_0x5499ad[_0x9c60('0x38')]=getImapHost(_0x7bd0c1);_0x5499ad[_0x9c60('0x39')]=0x3e1;_0x51366b[_0x9c60('0x38')]=getSmtpHost(_0x7bd0c1);_0x51366b[_0x9c60('0x39')]=0x24b;_0x51366b[_0x9c60('0x3a')]=![];_0x5499ad['service']=_0x51366b['service']=null;}else{if(_0x254a77[_0x9c60('0x3b')]){_0x5499ad[_0x9c60('0x32')]=_0x51366b['user']=_0x254a77['username'];_0x5499ad[_0x9c60('0x34')]=_0x51366b[_0x9c60('0x35')]=_0x254a77[_0x9c60('0x34')];}else{_0x5499ad[_0x9c60('0x3b')]=_0x51366b[_0x9c60('0x3b')]=![];_0x5499ad[_0x9c60('0x32')]=_0x51366b['user']=null;_0x5499ad[_0x9c60('0x34')]=_0x51366b['pass']=null;}_0x5499ad[_0x9c60('0x38')]=_0x254a77[_0x9c60('0x3c')][_0x9c60('0x38')];_0x5499ad[_0x9c60('0x39')]=_0x254a77[_0x9c60('0x3c')][_0x9c60('0x39')];_0x51366b[_0x9c60('0x38')]=_0x254a77[_0x9c60('0x3d')][_0x9c60('0x38')];_0x51366b[_0x9c60('0x39')]=_0x254a77[_0x9c60('0x3d')][_0x9c60('0x39')];}return{'Imap':_0x5499ad,'Smtp':_0x51366b};}exports[_0x9c60('0x3e')]=function(_0x3af518,_0x26f28b){var _0x4ee9a8={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x9c60('0x3f')],'as':_0x9c60('0x3d')},{'model':db[_0x9c60('0x40')],'as':'mandatoryDispositionPause'}]},_0x53229c={},_0x103774={'count':0x0,'rows':[]};var _0x22174a=_[_0x9c60('0x41')](db['MailAccount'][_0x9c60('0x42')],function(_0x10e884){return{'name':_0x10e884[_0x9c60('0x43')],'type':_0x10e884[_0x9c60('0x44')][_0x9c60('0x45')]};});_0x53229c['model']=_[_0x9c60('0x41')](_0x22174a,'name');_0x53229c['query']=_[_0x9c60('0x46')](_0x3af518['query']);_0x53229c[_0x9c60('0x47')]=_[_0x9c60('0x48')](_0x53229c[_0x9c60('0x49')],_0x53229c[_0x9c60('0x4a')]);_0x4ee9a8[_0x9c60('0x4b')]=_[_0x9c60('0x48')](_0x53229c['model'],qs['fields'](_0x3af518[_0x9c60('0x4a')][_0x9c60('0x4c')]));_0x4ee9a8[_0x9c60('0x4b')]=_0x4ee9a8[_0x9c60('0x4b')][_0x9c60('0x4d')]?_0x4ee9a8[_0x9c60('0x4b')]:_0x53229c[_0x9c60('0x49')];if(!_0x3af518[_0x9c60('0x4a')]['hasOwnProperty']('nolimit')){_0x4ee9a8['limit']=qs[_0x9c60('0x1c')](_0x3af518[_0x9c60('0x4a')]['limit']);_0x4ee9a8[_0x9c60('0x1a')]=qs[_0x9c60('0x1a')](_0x3af518[_0x9c60('0x4a')][_0x9c60('0x1a')]);}_0x4ee9a8['order']=qs[_0x9c60('0x4e')](_0x3af518['query'][_0x9c60('0x4e')]);_0x4ee9a8[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_[_0x9c60('0x50')](_0x3af518[_0x9c60('0x4a')],_0x53229c[_0x9c60('0x47')]),_0x22174a);if(_0x3af518[_0x9c60('0x4a')][_0x9c60('0x51')]){_0x4ee9a8[_0x9c60('0x4f')]=_['merge'](_0x4ee9a8[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x22174a,function(_0x2ad995){if(_0x2ad995[_0x9c60('0x44')]!==_0x9c60('0x52')){var _0x15f4a8={};_0x15f4a8[_0x2ad995[_0x9c60('0x25')]]={'$like':'%'+_0x3af518[_0x9c60('0x4a')]['filter']+'%'};return _0x15f4a8;}})});}_0x4ee9a8=_[_0x9c60('0x53')]({},_0x4ee9a8,_0x3af518[_0x9c60('0x54')]);var _0x13e65b={'where':_0x4ee9a8[_0x9c60('0x4f')]};return db[_0x9c60('0x55')][_0x9c60('0x1d')](_0x13e65b)[_0x9c60('0xf')](function(_0x4648cc){_0x103774['count']=_0x4648cc;if(_0x3af518[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x4ee9a8[_0x9c60('0x57')]=[{'all':!![]}];}return db[_0x9c60('0x55')]['findAll'](_0x4ee9a8);})['then'](function(_0x8f13b3){_0x103774[_0x9c60('0x58')]=_0x8f13b3;return _0x103774;})[_0x9c60('0xf')](respondWithFilteredResult(_0x26f28b,_0x4ee9a8))[_0x9c60('0x17')](handleError(_0x26f28b,null));};exports['show']=function(_0x37d1dc,_0x176367){var _0x16a9f5={'raw':![],'where':{'id':_0x37d1dc['params']['id']},'include':[{'model':db[_0x9c60('0x59')],'as':_0x9c60('0x3c')},{'model':db[_0x9c60('0x3f')],'as':_0x9c60('0x3d')},{'model':db[_0x9c60('0x40')],'as':_0x9c60('0x5a')}]},_0x4630a8={};_0x4630a8['model']=_['keys'](db['MailAccount']['rawAttributes']);_0x4630a8['query']=_[_0x9c60('0x46')](_0x37d1dc['query']);_0x4630a8['filters']=_[_0x9c60('0x48')](_0x4630a8['model'],_0x4630a8[_0x9c60('0x4a')]);_0x16a9f5[_0x9c60('0x4b')]=_[_0x9c60('0x48')](_0x4630a8[_0x9c60('0x49')],qs[_0x9c60('0x4c')](_0x37d1dc['query'][_0x9c60('0x4c')]));_0x16a9f5[_0x9c60('0x4b')]=_0x16a9f5[_0x9c60('0x4b')]['length']?_0x16a9f5[_0x9c60('0x4b')]:_0x4630a8[_0x9c60('0x49')];if(_0x37d1dc[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x16a9f5[_0x9c60('0x57')]=[{'all':!![]}];}_0x16a9f5=_[_0x9c60('0x53')]({},_0x16a9f5,_0x37d1dc['options']);return db[_0x9c60('0x55')]['find'](_0x16a9f5)['then'](handleEntityNotFound(_0x176367,null))[_0x9c60('0xf')](respondWithResult(_0x176367,null))[_0x9c60('0x17')](handleError(_0x176367,null));};exports['update']=function(_0x48251e,_0x171eca){if(_0x48251e[_0x9c60('0x5b')]['id']){delete _0x48251e[_0x9c60('0x5b')]['id'];}var _0x37529c=_0x48251e['body']['provider']===_0x9c60('0x5c')?null:_0x48251e['body'][_0x9c60('0x5d')];var _0x4bcf70=_0x48251e[_0x9c60('0x5b')][_0x9c60('0x3c')]||{};var _0x31a8a4=_0x48251e['body'][_0x9c60('0x3d')]||{};if(_0x37529c){_0x4bcf70[_0x9c60('0x38')]=getImapHost(_0x37529c);_0x4bcf70[_0x9c60('0x39')]=0x3e1;_0x31a8a4[_0x9c60('0x38')]=getSmtpHost(_0x37529c);_0x31a8a4['port']=0x24b;_0x31a8a4[_0x9c60('0x3a')]=![];}if(_0x31a8a4[_0x9c60('0x36')]){_0x31a8a4[_0x9c60('0x3a')]=![];}else{_0x31a8a4[_0x9c60('0x37')]=null;}if(!_0x4bcf70[_0x9c60('0x36')])_0x4bcf70[_0x9c60('0x37')]=null;_0x48251e['body'][_0x9c60('0x3c')]=_0x4bcf70;_0x48251e['body'][_0x9c60('0x3d')]=_0x31a8a4;return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x48251e['params']['id']},'include':[{'model':db[_0x9c60('0x59')],'as':_0x9c60('0x3c')},{'model':db[_0x9c60('0x3f')],'as':_0x9c60('0x3d')},{'model':db['Pause'],'as':_0x9c60('0x5a')}]})[_0x9c60('0xf')](handleEntityNotFound(_0x171eca,null))[_0x9c60('0xf')](function(_0x33c28b){if(!_0x33c28b)throw new Error(_0x9c60('0x5f'));if(_0x33c28b[_0x9c60('0x60')])delete _0x48251e['body']['Imap'];return _0x33c28b;})[_0x9c60('0xf')](saveUpdates(_0x48251e[_0x9c60('0x5b')],null))[_0x9c60('0xf')](function(_0x4cdbea){if(!_0x48251e['body'][_0x9c60('0x3c')])return _0x4cdbea;return db[_0x9c60('0x59')][_0x9c60('0x1f')](_0x48251e[_0x9c60('0x5b')][_0x9c60('0x3c')],{'where':{'MailAccountId':_0x4cdbea['id']}})[_0x9c60('0xf')](function(){return _0x4cdbea;});})['then'](function(_0x731e48){if(!_0x48251e[_0x9c60('0x5b')][_0x9c60('0x3d')])return _0x731e48;return db[_0x9c60('0x3f')][_0x9c60('0x1f')](_0x48251e[_0x9c60('0x5b')][_0x9c60('0x3d')],{'where':{'MailAccountId':_0x731e48['id']}})[_0x9c60('0xf')](function(){return _0x731e48;});})['then'](respondWithResult(_0x171eca,null))[_0x9c60('0x17')](handleError(_0x171eca,null));};exports['describe']=function(_0x5a6edf,_0x53a4c2){return db[_0x9c60('0x55')][_0x9c60('0x61')]()['then'](respondWithResult(_0x53a4c2,null))[_0x9c60('0x17')](handleError(_0x53a4c2,null));};exports[_0x9c60('0x62')]=function(_0x53b011,_0x59ea54){if(_0x53b011[_0x9c60('0x5b')]['id']){delete _0x53b011[_0x9c60('0x5b')]['id'];}return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x53b011[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x59ea54,null))['then'](function(_0x3e118f){if(_0x3e118f){_0x53b011['body'][_0x9c60('0x64')]=_0x3e118f['id'];return db[_0x9c60('0x65')][_0x9c60('0x66')](_0x53b011[_0x9c60('0x5b')]);}})[_0x9c60('0xf')](respondWithResult(_0x59ea54,null))[_0x9c60('0x17')](handleError(_0x59ea54,null));};exports[_0x9c60('0x67')]=function(_0x10a963,_0xf2f7d3){var _0x6304bd={'raw':![],'where':{}};var _0x458da0={};var _0x1b7204={'count':0x0,'rows':[]};return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x10a963[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0xf2f7d3,null))[_0x9c60('0xf')](function(_0x4b6922){if(_0x4b6922){_0x458da0[_0x9c60('0x49')]=_[_0x9c60('0x46')](db[_0x9c60('0x65')][_0x9c60('0x42')]);_0x458da0['query']=_[_0x9c60('0x46')](_0x10a963[_0x9c60('0x4a')]);_0x458da0['filters']=_[_0x9c60('0x48')](_0x458da0[_0x9c60('0x49')],_0x458da0[_0x9c60('0x4a')]);_0x6304bd['attributes']=_[_0x9c60('0x48')](_0x458da0['model'],qs[_0x9c60('0x4c')](_0x10a963[_0x9c60('0x4a')][_0x9c60('0x4c')]));_0x6304bd[_0x9c60('0x4b')]=_0x6304bd[_0x9c60('0x4b')][_0x9c60('0x4d')]?_0x6304bd['attributes']:_0x458da0[_0x9c60('0x49')];if(!_0x10a963['query']['hasOwnProperty']('nolimit')){_0x6304bd[_0x9c60('0x1c')]=qs['limit'](_0x10a963[_0x9c60('0x4a')]['limit']);_0x6304bd[_0x9c60('0x1a')]=qs[_0x9c60('0x1a')](_0x10a963[_0x9c60('0x4a')]['offset']);}_0x6304bd['order']=qs[_0x9c60('0x4e')](_0x10a963[_0x9c60('0x4a')]['sort']);_0x6304bd[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_[_0x9c60('0x50')](_0x10a963['query'],_0x458da0[_0x9c60('0x47')]));_0x6304bd['where']['MailAccountId']=_0x4b6922['id'];if(_0x10a963[_0x9c60('0x4a')][_0x9c60('0x51')]){_0x6304bd[_0x9c60('0x4f')]=_[_0x9c60('0x53')](_0x6304bd[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x6304bd['attributes'],function(_0x36306f){var _0x3af9a4={};_0x3af9a4[_0x36306f]={'$like':'%'+_0x10a963[_0x9c60('0x4a')]['filter']+'%'};return _0x3af9a4;})});}_0x6304bd=_[_0x9c60('0x53')]({},_0x6304bd,_0x10a963[_0x9c60('0x54')]);return db['Disposition'][_0x9c60('0x1d')]({'where':_0x6304bd['where']})[_0x9c60('0xf')](function(_0x47eb90){_0x1b7204[_0x9c60('0x1d')]=_0x47eb90;if(_0x10a963[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x6304bd[_0x9c60('0x57')]=[{'all':!![]}];}return db[_0x9c60('0x65')][_0x9c60('0x69')](_0x6304bd);})[_0x9c60('0xf')](function(_0x908239){_0x1b7204['rows']=_0x908239;return _0x1b7204;});}})['then'](respondWithFilteredResult(_0xf2f7d3,_0x6304bd))[_0x9c60('0x17')](handleError(_0xf2f7d3,null));};exports['removeDispositions']=function(_0x586f96,_0x1499e7){return db['MailAccount'][_0x9c60('0x5e')]({'where':{'id':_0x586f96['params']['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x1499e7,null))[_0x9c60('0xf')](function(_0x497bb4){if(_0x497bb4){return _0x497bb4['removeDispositions'](_0x586f96[_0x9c60('0x4a')][_0x9c60('0x6a')]);}})['then'](respondWithStatusCode(_0x1499e7,null))[_0x9c60('0x17')](handleError(_0x1499e7,null));};exports[_0x9c60('0x6b')]=function(_0x40c812,_0x1651bb){if(_0x40c812[_0x9c60('0x5b')]['id']){delete _0x40c812['body']['id'];}return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x40c812[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x1651bb,null))[_0x9c60('0xf')](function(_0x47320c){if(_0x47320c){_0x40c812[_0x9c60('0x5b')][_0x9c60('0x64')]=_0x47320c['id'];return db[_0x9c60('0x6c')]['create'](_0x40c812[_0x9c60('0x5b')]);}})[_0x9c60('0xf')](respondWithResult(_0x1651bb,null))[_0x9c60('0x17')](handleError(_0x1651bb,null));};exports[_0x9c60('0x6d')]=function(_0xf98b92,_0x419bd2){var _0x5e0dd9={'raw':![],'where':{}};var _0x420cab={};var _0x4b17b9={'count':0x0,'rows':[]};return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0xf98b92['params']['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x419bd2,null))[_0x9c60('0xf')](function(_0x1cb161){if(_0x1cb161){_0x420cab[_0x9c60('0x49')]=_[_0x9c60('0x46')](db[_0x9c60('0x6c')][_0x9c60('0x42')]);_0x420cab['query']=_[_0x9c60('0x46')](_0xf98b92[_0x9c60('0x4a')]);_0x420cab[_0x9c60('0x47')]=_[_0x9c60('0x48')](_0x420cab[_0x9c60('0x49')],_0x420cab['query']);_0x5e0dd9[_0x9c60('0x4b')]=_['intersection'](_0x420cab[_0x9c60('0x49')],qs['fields'](_0xf98b92['query'][_0x9c60('0x4c')]));_0x5e0dd9[_0x9c60('0x4b')]=_0x5e0dd9[_0x9c60('0x4b')][_0x9c60('0x4d')]?_0x5e0dd9[_0x9c60('0x4b')]:_0x420cab[_0x9c60('0x49')];if(!_0xf98b92[_0x9c60('0x4a')][_0x9c60('0x6e')]('nolimit')){_0x5e0dd9['limit']=qs[_0x9c60('0x1c')](_0xf98b92[_0x9c60('0x4a')][_0x9c60('0x1c')]);_0x5e0dd9[_0x9c60('0x1a')]=qs['offset'](_0xf98b92[_0x9c60('0x4a')][_0x9c60('0x1a')]);}_0x5e0dd9['order']=qs[_0x9c60('0x4e')](_0xf98b92[_0x9c60('0x4a')][_0x9c60('0x4e')]);_0x5e0dd9[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_[_0x9c60('0x50')](_0xf98b92[_0x9c60('0x4a')],_0x420cab[_0x9c60('0x47')]));_0x5e0dd9[_0x9c60('0x4f')][_0x9c60('0x64')]=_0x1cb161['id'];if(_0xf98b92[_0x9c60('0x4a')]['filter']){_0x5e0dd9[_0x9c60('0x4f')]=_[_0x9c60('0x53')](_0x5e0dd9[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x5e0dd9[_0x9c60('0x4b')],function(_0x4f9e88){var _0x4d5f4e={};_0x4d5f4e[_0x4f9e88]={'$like':'%'+_0xf98b92['query'][_0x9c60('0x51')]+'%'};return _0x4d5f4e;})});}_0x5e0dd9=_[_0x9c60('0x53')]({},_0x5e0dd9,_0xf98b92[_0x9c60('0x54')]);return db['CannedAnswer'][_0x9c60('0x1d')]({'where':_0x5e0dd9[_0x9c60('0x4f')]})[_0x9c60('0xf')](function(_0x449dbf){_0x4b17b9[_0x9c60('0x1d')]=_0x449dbf;if(_0xf98b92[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x5e0dd9[_0x9c60('0x57')]=[{'all':!![]}];}return db[_0x9c60('0x6c')]['findAll'](_0x5e0dd9);})[_0x9c60('0xf')](function(_0x366871){_0x4b17b9['rows']=_0x366871;return _0x4b17b9;});}})[_0x9c60('0xf')](respondWithFilteredResult(_0x419bd2,_0x5e0dd9))[_0x9c60('0x17')](handleError(_0x419bd2,null));};exports[_0x9c60('0x6f')]=function(_0x131f9c,_0x46362){return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x131f9c[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x46362,null))['then'](function(_0x1fcfa4){if(_0x1fcfa4){return _0x1fcfa4[_0x9c60('0x6f')](_0x131f9c[_0x9c60('0x4a')][_0x9c60('0x6a')]);}})['then'](respondWithStatusCode(_0x46362,null))[_0x9c60('0x17')](handleError(_0x46362,null));};exports['create']=function(_0x203615,_0x127bc1){var _0x36b41d={'name':_0x203615['body'][_0x9c60('0x25')],'key':_0x203615[_0x9c60('0x5b')]['key'],'provider':_0x203615[_0x9c60('0x5b')]['provider']===_0x9c60('0x5c')?null:_0x203615[_0x9c60('0x5b')][_0x9c60('0x5d')],'email':_0x203615[_0x9c60('0x5b')][_0x9c60('0x70')],'ListId':_0x203615[_0x9c60('0x5b')]['ListId'],'active':!_[_0x9c60('0x71')](_0x203615[_0x9c60('0x5b')]['active'])?_0x203615[_0x9c60('0x5b')][_0x9c60('0x72')]:!![],'description':_0x203615[_0x9c60('0x5b')][_0x9c60('0x73')]||null};var _0x5b2af2=getAuthenticationOptions(_0x36b41d['provider'],_0x203615[_0x9c60('0x5b')]);_0x36b41d[_0x9c60('0x3c')]=_0x5b2af2[_0x9c60('0x3c')];_0x36b41d['Smtp']=_0x5b2af2[_0x9c60('0x3d')];return db['MailAccount'][_0x9c60('0x66')](_0x36b41d,{'include':[{'model':db[_0x9c60('0x3f')],'as':_0x9c60('0x3d')},{'model':db['MailServerIn'],'as':_0x9c60('0x3c')}]})[_0x9c60('0xf')](function(_0x2a6234){var _0x32bd6b=_0x203615[_0x9c60('0x32')][_0x9c60('0x74')]({'plain':!![]});if(!_0x32bd6b)throw new Error(_0x9c60('0x75'));if(_0x32bd6b[_0x9c60('0x76')]===_0x9c60('0x32')){var _0x421ba4=_0x2a6234[_0x9c60('0x74')]({'plain':!![]});return db[_0x9c60('0x77')][_0x9c60('0x5e')]({'where':{'name':_0x9c60('0x21'),'userProfileId':_0x32bd6b[_0x9c60('0x78')]},'raw':!![]})[_0x9c60('0xf')](function(_0x3563b5){if(_0x3563b5&&_0x3563b5[_0x9c60('0x79')]===0x0){return db[_0x9c60('0x22')][_0x9c60('0x66')]({'name':_0x421ba4[_0x9c60('0x25')],'resourceId':_0x421ba4['id'],'type':_0x3563b5[_0x9c60('0x25')],'sectionId':_0x3563b5['id']},{})['then'](function(){return _0x2a6234;});}else{return _0x2a6234;}})[_0x9c60('0x17')](function(_0x5804c8){logger[_0x9c60('0x13')](_0x9c60('0x7a'),_0x5804c8);throw _0x5804c8;});}return _0x2a6234;})['then'](respondWithResult(_0x127bc1,0xc9))[_0x9c60('0x17')](handleError(_0x127bc1,null));};exports['getImap']=function(_0x348220,_0x356c8f){return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x348220[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x356c8f,null))[_0x9c60('0xf')](function(_0x23efa0){if(_0x23efa0){return _0x23efa0[_0x9c60('0x7b')]();}return null;})[_0x9c60('0xf')](respondWithResult(_0x356c8f,null))[_0x9c60('0x17')](handleError(_0x356c8f,null));};exports[_0x9c60('0x7c')]=function(_0x325a74,_0x18ab7d){if(_0x325a74[_0x9c60('0x5b')]['id']){delete _0x325a74[_0x9c60('0x5b')]['id'];}return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x325a74[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x18ab7d,null))[_0x9c60('0xf')](function(_0x451f90){if(_0x451f90){_0x325a74[_0x9c60('0x5b')][_0x9c60('0x64')]=_0x451f90['id'];return db[_0x9c60('0x59')][_0x9c60('0x66')](_0x325a74['body']);}})[_0x9c60('0xf')](respondWithResult(_0x18ab7d,null))['catch'](handleError(_0x18ab7d,null));};exports['removeImap']=function(_0x535a1b,_0x5a99d3){return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x535a1b[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x5a99d3,null))[_0x9c60('0xf')](function(_0x478b32){if(_0x478b32){return _0x478b32['setImap'](null);}return null;})[_0x9c60('0xf')](respondWithStatusCode(_0x5a99d3,null))[_0x9c60('0x17')](handleError(_0x5a99d3,null));};exports[_0x9c60('0x7d')]=function(_0x3d582a,_0x410180){return db[_0x9c60('0x55')]['findOne']({'where':{'id':_0x3d582a[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x410180,null))[_0x9c60('0xf')](function(_0x11bb4c){if(_0x11bb4c){return _0x11bb4c['getSmtp']();}return null;})[_0x9c60('0xf')](respondWithResult(_0x410180,null))[_0x9c60('0x17')](handleError(_0x410180,null));};exports[_0x9c60('0x7e')]=function(_0x4c3c35,_0x4c5f2e){if(_0x4c3c35['body']['id']){delete _0x4c3c35[_0x9c60('0x5b')]['id'];}return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0x4c3c35[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x4c5f2e,null))['then'](function(_0x7fc783){if(_0x7fc783){_0x4c3c35[_0x9c60('0x5b')]['MailAccountId']=_0x7fc783['id'];return db[_0x9c60('0x3f')][_0x9c60('0x66')](_0x4c3c35[_0x9c60('0x5b')]);}})['then'](respondWithResult(_0x4c5f2e,null))[_0x9c60('0x17')](handleError(_0x4c5f2e,null));};exports[_0x9c60('0x7f')]=function(_0x426a6e,_0x1f910f){return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x426a6e[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x1f910f,null))[_0x9c60('0xf')](function(_0x417c84){if(_0x417c84){return _0x417c84[_0x9c60('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x1f910f,null))['catch'](handleError(_0x1f910f,null));};exports[_0x9c60('0x81')]=function(_0x20b885,_0x27644c){return db[_0x9c60('0x82')][_0x9c60('0x5e')]({'where':{'id':_0x20b885[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x27644c,null))[_0x9c60('0xf')](function(_0x34b32d){if(_0x34b32d){return _0x34b32d[_0x9c60('0x81')](_0x20b885[_0x9c60('0x5b')][_0x9c60('0x6a')],_[_0x9c60('0x83')](_0x20b885[_0x9c60('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x27644c,null))[_0x9c60('0x17')](handleError(_0x27644c,null));};exports[_0x9c60('0x84')]=function(_0x2c14e0,_0x21a1f2){var _0x50afb7={'raw':![],'where':{}};var _0x566751={};var _0x3764d7={'count':0x0,'rows':[]};return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x2c14e0[_0x9c60('0x63')]['id']}})['then'](handleEntityNotFound(_0x21a1f2,null))['then'](function(_0x33bc1a){if(_0x33bc1a){_0x566751[_0x9c60('0x49')]=_[_0x9c60('0x46')](db[_0x9c60('0x82')][_0x9c60('0x42')]);_0x566751[_0x9c60('0x4a')]=_['keys'](_0x2c14e0['query']);_0x566751[_0x9c60('0x47')]=_[_0x9c60('0x48')](_0x566751['model'],_0x566751[_0x9c60('0x4a')]);_0x50afb7[_0x9c60('0x4b')]=_[_0x9c60('0x48')](_0x566751['model'],qs[_0x9c60('0x4c')](_0x2c14e0[_0x9c60('0x4a')][_0x9c60('0x4c')]));_0x50afb7[_0x9c60('0x4b')]=_0x50afb7['attributes'][_0x9c60('0x4d')]?_0x50afb7['attributes']:_0x566751[_0x9c60('0x49')];if(!_0x2c14e0['query']['hasOwnProperty'](_0x9c60('0x85'))){_0x50afb7['limit']=qs[_0x9c60('0x1c')](_0x2c14e0[_0x9c60('0x4a')][_0x9c60('0x1c')]);_0x50afb7[_0x9c60('0x1a')]=qs[_0x9c60('0x1a')](_0x2c14e0['query'][_0x9c60('0x1a')]);}_0x50afb7[_0x9c60('0x86')]=qs[_0x9c60('0x4e')](_0x2c14e0[_0x9c60('0x4a')][_0x9c60('0x4e')]);_0x50afb7[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_[_0x9c60('0x50')](_0x2c14e0[_0x9c60('0x4a')],_0x566751[_0x9c60('0x47')]));_0x50afb7[_0x9c60('0x4f')][_0x9c60('0x64')]=_0x33bc1a['id'];if(_0x2c14e0[_0x9c60('0x4a')][_0x9c60('0x51')]){_0x50afb7[_0x9c60('0x4f')]=_['merge'](_0x50afb7[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x50afb7[_0x9c60('0x4b')],function(_0xa78f42){var _0x38991a={};_0x38991a[_0xa78f42]={'$like':'%'+_0x2c14e0['query'][_0x9c60('0x51')]+'%'};return _0x38991a;})});}_0x50afb7=_[_0x9c60('0x53')]({},_0x50afb7,_0x2c14e0[_0x9c60('0x54')]);return db[_0x9c60('0x82')]['count']({'where':_0x50afb7['where']})[_0x9c60('0xf')](function(_0x3aa991){_0x3764d7[_0x9c60('0x1d')]=_0x3aa991;if(_0x2c14e0[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x50afb7['include']=[{'model':db[_0x9c60('0x87')],'as':'Contact','required':![]},{'model':db[_0x9c60('0x88')],'as':_0x9c60('0x89'),'attributes':['name','fullname',_0x9c60('0x8a')],'required':![]},{'model':db[_0x9c60('0x8b')],'as':_0x9c60('0x8c'),'attributes':['id',_0x9c60('0x25'),_0x9c60('0x8d')],'where':_0x2c14e0[_0x9c60('0x4a')]['tag']?{'id':_0x2c14e0['query'][_0x9c60('0x8e')]}:undefined,'required':_0x2c14e0['query'][_0x9c60('0x8e')]?!![]:![]}];}return db['MailInteraction'][_0x9c60('0x69')](_0x50afb7);})[_0x9c60('0xf')](function(_0x100c19){_0x3764d7[_0x9c60('0x58')]=_0x100c19;return _0x3764d7;});}})[_0x9c60('0xf')](respondWithFilteredResult(_0x21a1f2,_0x50afb7))[_0x9c60('0x17')](handleError(_0x21a1f2,null));};exports[_0x9c60('0x8f')]=function addApplications(_0x220e0b,_0xd4c612){var _0x75cfd6=_0x220e0b[_0x9c60('0x63')]['id'];var _0x340964=_0x220e0b[_0x9c60('0x5b')];var _0x110e40=0xc8;var _0x209984=null;return db[_0x9c60('0x90')]['transaction']({'isolationLevel':db['sequelize'][_0x9c60('0x91')][_0x9c60('0x92')][_0x9c60('0x93')]},function(_0x1304f5){return db[_0x9c60('0x55')]['findOne']({'where':{'id':_0x75cfd6},'transaction':_0x1304f5})['then'](function(_0x4860d0){if(_0x4860d0){return db[_0x9c60('0x94')][_0x9c60('0x20')]({'where':{'MailAccountId':_0x75cfd6},'transaction':_0x1304f5})[_0x9c60('0xf')](function(){var _0x135722=_[_0x9c60('0x41')](_0x340964,function(_0x1f0fe2){_0x1f0fe2[_0x9c60('0x64')]=_0x75cfd6;return _0x1f0fe2;});return db[_0x9c60('0x94')][_0x9c60('0x95')](_0x135722,{'transaction':_0x1304f5});});}else{_0x110e40=0x194;_0x209984=[];}});})[_0x9c60('0xf')](function(){if(_0x110e40!==0x194){return db[_0x9c60('0x94')][_0x9c60('0x96')]({'where':{'MailAccountId':_0x75cfd6},'order':_0x9c60('0x97')})[_0x9c60('0xf')](function(_0x394c85){_0x209984=_0x394c85;});}})['catch'](function(_0x41dc7e){_0x110e40=0x1f4;logger[_0x9c60('0x13')](_0x41dc7e[_0x9c60('0x24')]);if(_0x41dc7e[_0x9c60('0x25')]){delete _0x41dc7e[_0x9c60('0x25')];}_0x209984=_0x41dc7e;})[_0x9c60('0x98')](function(){if(_0x209984===null){_0xd4c612['sendStatus'](_0x110e40);}else{if(_0x110e40===0x1f4){_0xd4c612[_0x9c60('0x19')](_0x110e40)[_0x9c60('0x26')](_0x209984);}else{_0xd4c612[_0x9c60('0x19')](_0x110e40)[_0x9c60('0x99')](_0x209984);}}});};exports['getApplications']=function(_0x3c6ddc,_0x3d5da1){var _0x16cc04={};var _0x36438e={};var _0x4c1347;var _0x4d32bc;return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x3c6ddc[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x3d5da1,null))['then'](function(_0x261fcb){if(_0x261fcb){_0x4c1347=_0x261fcb;_0x36438e[_0x9c60('0x49')]=_[_0x9c60('0x46')](db['MailApplication'][_0x9c60('0x42')]);_0x36438e[_0x9c60('0x4a')]=_[_0x9c60('0x46')](_0x3c6ddc[_0x9c60('0x4a')]);_0x36438e['filters']=_['intersection'](_0x36438e[_0x9c60('0x49')],_0x36438e[_0x9c60('0x4a')]);_0x16cc04[_0x9c60('0x4b')]=_['intersection'](_0x36438e[_0x9c60('0x49')],qs[_0x9c60('0x4c')](_0x3c6ddc['query'][_0x9c60('0x4c')]));_0x16cc04[_0x9c60('0x4b')]=_0x16cc04[_0x9c60('0x4b')][_0x9c60('0x4d')]?_0x16cc04['attributes']:_0x36438e[_0x9c60('0x49')];_0x16cc04['order']=qs[_0x9c60('0x4e')](_0x3c6ddc[_0x9c60('0x4a')][_0x9c60('0x4e')]);_0x16cc04[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_['pick'](_0x3c6ddc[_0x9c60('0x4a')],_0x36438e['filters']));if(_0x3c6ddc[_0x9c60('0x4a')][_0x9c60('0x51')]){_0x16cc04[_0x9c60('0x4f')]=_[_0x9c60('0x53')](_0x16cc04[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x16cc04[_0x9c60('0x4b')],function(_0x391d73){var _0x51557f={};_0x51557f[_0x391d73]={'$like':'%'+_0x3c6ddc[_0x9c60('0x4a')][_0x9c60('0x51')]+'%'};return _0x51557f;})});}_0x16cc04=_['merge']({},_0x16cc04,_0x3c6ddc[_0x9c60('0x54')]);return _0x4c1347[_0x9c60('0x9a')](_0x16cc04);}})[_0x9c60('0xf')](function(_0x54e82d){if(_0x54e82d){_0x4d32bc=_0x54e82d[_0x9c60('0x4d')];if(!_0x3c6ddc['query']['hasOwnProperty']('nolimit')){_0x16cc04[_0x9c60('0x1c')]=qs[_0x9c60('0x1c')](_0x3c6ddc[_0x9c60('0x4a')][_0x9c60('0x1c')]);_0x16cc04[_0x9c60('0x1a')]=qs[_0x9c60('0x1a')](_0x3c6ddc[_0x9c60('0x4a')]['offset']);}return _0x4c1347[_0x9c60('0x9a')](_0x16cc04);}})[_0x9c60('0xf')](function(_0x451207){if(_0x451207){return _0x451207?{'count':_0x4d32bc,'rows':_0x451207}:null;}})[_0x9c60('0xf')](respondWithResult(_0x3d5da1,null))['catch'](handleError(_0x3d5da1,null));};exports[_0x9c60('0x9b')]=function(_0x101ad7,_0x8d96be){var _0x118ddd={'raw':!![],'where':{}};var _0x382ee2={};var _0x58efaf={'count':0x0,'rows':[]};return db['MailAccount'][_0x9c60('0x68')]({'where':{'id':_0x101ad7[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x8d96be,null))[_0x9c60('0xf')](function(_0x2fcc54){if(_0x2fcc54){_0x382ee2[_0x9c60('0x49')]=_[_0x9c60('0x46')](db[_0x9c60('0x9c')][_0x9c60('0x42')]);_0x382ee2[_0x9c60('0x4a')]=_[_0x9c60('0x46')](_0x101ad7[_0x9c60('0x4a')]);_0x382ee2[_0x9c60('0x47')]=_[_0x9c60('0x48')](_0x382ee2['model'],_0x382ee2[_0x9c60('0x4a')]);_0x118ddd[_0x9c60('0x4b')]=_[_0x9c60('0x48')](_0x382ee2[_0x9c60('0x49')],qs[_0x9c60('0x4c')](_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x4c')]));_0x118ddd[_0x9c60('0x4b')]=_0x118ddd[_0x9c60('0x4b')]['length']?_0x118ddd[_0x9c60('0x4b')]:_0x382ee2[_0x9c60('0x49')];if(!_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x6e')]('nolimit')){_0x118ddd[_0x9c60('0x1c')]=qs[_0x9c60('0x1c')](_0x101ad7['query'][_0x9c60('0x1c')]);_0x118ddd[_0x9c60('0x1a')]=qs[_0x9c60('0x1a')](_0x101ad7[_0x9c60('0x4a')]['offset']);}_0x118ddd[_0x9c60('0x86')]=qs['sort'](_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x4e')]);_0x118ddd[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_['pick'](_0x101ad7[_0x9c60('0x4a')],_0x382ee2[_0x9c60('0x47')]));_0x118ddd['where'][_0x9c60('0x64')]=_0x2fcc54['id'];if(_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x51')]){_0x118ddd['where']=_[_0x9c60('0x53')](_0x118ddd[_0x9c60('0x4f')],{'$or':_[_0x9c60('0x41')](_0x118ddd['attributes'],function(_0x49ea07){var _0x5617d1={};_0x5617d1[_0x49ea07]={'$like':'%'+_0x101ad7[_0x9c60('0x4a')]['filter']+'%'};return _0x5617d1;})});}if(_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x9d')]){var _0x33f16f=_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x9d')][_0x9c60('0x9e')](',');var _0xa20496={};_0xa20496[_0x33f16f[0x0]]={'$gte':moment(_0x33f16f[0x1])[_0x9c60('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x118ddd['where']=_[_0x9c60('0x53')](_0x118ddd[_0x9c60('0x4f')],_0xa20496);}_0x118ddd=_[_0x9c60('0x53')]({},_0x118ddd,_0x101ad7[_0x9c60('0x54')]);return db[_0x9c60('0x9c')][_0x9c60('0x1d')]({'where':_0x118ddd[_0x9c60('0x4f')]})[_0x9c60('0xf')](function(_0x4b605e){_0x58efaf[_0x9c60('0x1d')]=_0x4b605e;if(_0x101ad7[_0x9c60('0x4a')][_0x9c60('0x56')]){_0x118ddd[_0x9c60('0x57')]=[{'all':!![]}];}return db[_0x9c60('0x9c')]['findAll'](_0x118ddd);})['then'](function(_0x3ca044){if(_0x101ad7[_0x9c60('0x4a')]['inlineCss']==='true'){for(var _0xc775ac=0x0;_0xc775ac<_0x3ca044[_0x9c60('0x4d')];_0xc775ac++){_0x3ca044[_0xc775ac]['body']=juice(_0x3ca044[_0xc775ac][_0x9c60('0x5b')]);}}_0x58efaf[_0x9c60('0x58')]=_0x3ca044;return _0x58efaf;});}})[_0x9c60('0xf')](respondWithFilteredResult(_0x8d96be,_0x118ddd))['catch'](handleError(_0x8d96be,null));};exports[_0x9c60('0x26')]=function(_0x4cc8e7,_0x58d210){var _0x29ee08,_0x494674={},_0x3e96ce;if(_0x4cc8e7[_0x9c60('0x5b')]['to']){_0x3e96ce=_0x4cc8e7[_0x9c60('0x5b')]['to'][_0x9c60('0x9e')](',')[0x0];}return db[_0x9c60('0x55')]['find']({'where':{'id':_0x4cc8e7[_0x9c60('0x63')]['id']},'include':[{'model':db[_0x9c60('0xa0')],'as':_0x9c60('0xa1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x3e96ce},'limit':0x1,'order':[[_0x9c60('0xa2'),_0x9c60('0xa3')]]}]},{'model':db[_0x9c60('0x3f')],'as':_0x9c60('0x3d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9c60('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x58d210,null))[_0x9c60('0xf')](function(_0x2251c9){if(!_0x2251c9)return;_0x29ee08=_0x2251c9;if(!_0x2251c9[_0x9c60('0x3d')])throw new Error(_0x9c60('0xa5'));if(_[_0x9c60('0x71')](_0x4cc8e7[_0x9c60('0x5b')]['from'])){_0x4cc8e7[_0x9c60('0x5b')]['from']=util['format']('%s\x20<%s>',_0x2251c9[_0x9c60('0x25')],_0x2251c9[_0x9c60('0x70')]||_0x2251c9[_0x9c60('0x3d')][_0x9c60('0x32')]);}if(_0x4cc8e7[_0x9c60('0x5b')]['attachments']&&_0x4cc8e7['body'][_0x9c60('0xa6')][_0x9c60('0x4d')]){for(var _0x434781=0x0;_0x434781<_0x4cc8e7[_0x9c60('0x5b')]['attachments'][_0x9c60('0x4d')];_0x434781+=0x1){_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xa6')][_0x434781]={'filename':_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xa6')][_0x434781][_0x9c60('0x25')],'path':path[_0x9c60('0xa7')](config[_0x9c60('0xa8')],_0x9c60('0xa9'),_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xa6')][_0x434781][_0x9c60('0xaa')])};}}var _0x476034=_0x2251c9[_0x9c60('0xab')]();return respondWithRpcPromise(_0x9c60('0xac'),_0x9c60('0xad'),{'account':_0x476034,'message':_0x4cc8e7[_0x9c60('0x5b')]});})[_0x9c60('0xf')](function(_0x4060a7){if(!_0x4060a7)return;_0x494674=_0x4060a7;if(!_0x29ee08[_0x9c60('0xa1')])throw new Error(_0x9c60('0xae'));if(_0x29ee08[_0x9c60('0xa1')]['Contacts']['length'])return _0x29ee08[_0x9c60('0xa1')][_0x9c60('0xaf')][0x0];return db[_0x9c60('0x87')]['create'](_[_0x9c60('0xb')](_0x4cc8e7['body'],{'firstName':_0x4cc8e7['body']['to'],'email':_0x4cc8e7['body']['to'],'phone':_0x4cc8e7[_0x9c60('0x5b')]['to'],'ListId':_0x29ee08[_0x9c60('0xb0')]}));})[_0x9c60('0xf')](function(_0x2f4a15){if(!_0x2f4a15)return;var _0x5bf723={'UserId':_0x4cc8e7[_0x9c60('0x32')]['id'],'ContactId':_0x2f4a15['id'],'MailAccountId':_0x29ee08['id'],'inReplyTo':_0x494674['messageId'],'to':_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xb1')],'cc':_0x4cc8e7[_0x9c60('0x5b')]['cc'],'subject':_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xb2')],'attach':_0x4cc8e7[_0x9c60('0x5b')][_0x9c60('0xb3')],'firstMsgDirection':_0x9c60('0xb4'),'lastMsgAt':moment()[_0x9c60('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x9c60('0xb4'),'Messages':[_[_0x9c60('0x53')](_0x4cc8e7['body'],{'messageId':_0x494674[_0x9c60('0xb5')],'sentAt':moment()[_0x9c60('0x9f')](_0x9c60('0xb6')),'read':!![],'MailAccountId':_0x29ee08['id'],'UserId':_0x4cc8e7[_0x9c60('0x32')]['id'],'ContactId':_0x2f4a15['id']})]};if(_0x4cc8e7[_0x9c60('0x5b')]['Interaction']){_0x5bf723=_['merge'](_0x5bf723,_0x4cc8e7[_0x9c60('0x5b')]['Interaction']);}return db[_0x9c60('0x82')][_0x9c60('0x66')](_0x5bf723,{'include':[{'model':db['MailMessage'],'as':_0x9c60('0xb7')}]});})[_0x9c60('0xf')](respondWithResult(_0x58d210,null))[_0x9c60('0x17')](handleError(_0x58d210,null));};exports[_0x9c60('0xb8')]=function(_0x4f78ef,_0xcb6544){return db['MailAccount']['find']({'where':{'id':_0x4f78ef['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x9c60('0x3d'),'raw':!![],'include':[{'model':db[_0x9c60('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x9c60('0xf')](handleEntityNotFound(_0xcb6544,null))[_0x9c60('0xf')](function(_0x22e0ec){if(!_0x22e0ec[_0x9c60('0x3d')])return;var _0x1700ea=_0x22e0ec[_0x9c60('0xab')]();return respondWithRpcPromise(_0x9c60('0xb9'),_0x9c60('0xb8'),{'account':_0x1700ea});})['then'](respondWithResult(_0xcb6544,null))[_0x9c60('0x17')](handleError(_0xcb6544,null));};exports[_0x9c60('0x20')]=function(_0x41d93a,_0x33d987){return db[_0x9c60('0x55')]['find']({'where':{'id':_0x41d93a[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x33d987,null))[_0x9c60('0xf')](function(_0x557f9e){if(_0x557f9e&&_0x557f9e['service']){throw new db[(_0x9c60('0xba'))][(_0x9c60('0xbb'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x557f9e;})[_0x9c60('0xf')](removeEntity(_0x33d987,null))[_0x9c60('0x17')](handleError(_0x33d987,null));};exports['addAgents']=function(_0xdf098b,_0x944249){return db[_0x9c60('0x55')][_0x9c60('0x5e')]({'where':{'id':_0xdf098b[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x944249,null))[_0x9c60('0xf')](function(_0x202d20){if(_0x202d20){return _0x202d20['addAgents'](_0xdf098b['body'][_0x9c60('0x6a')],_[_0x9c60('0x83')](_0xdf098b['body'],['ids','id'])||{})[_0x9c60('0xbc')](function(_0x47ea1f){for(var _0x3eefa1=0x0;_0x3eefa1<_0xdf098b[_0x9c60('0x5b')][_0x9c60('0x6a')][_0x9c60('0x4d')];_0x3eefa1+=0x1){socket[_0x9c60('0xbd')](_0x9c60('0xbe'),{'UserId':Number(_0xdf098b[_0x9c60('0x5b')][_0x9c60('0x6a')][_0x3eefa1]),'MailAccountId':Number(_0xdf098b[_0x9c60('0x63')]['id'])});}return _0x47ea1f;});}})[_0x9c60('0xf')](respondWithResult(_0x944249,null))['catch'](handleError(_0x944249,null));};exports[_0x9c60('0xbf')]=function(_0x431377,_0x5a3213){return db['MailAccount'][_0x9c60('0x5e')]({'where':{'id':_0x431377[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x5a3213,null))['then'](function(_0x467520){if(_0x467520){return _0x467520['removeAgents'](_0x431377[_0x9c60('0x4a')][_0x9c60('0x6a')])[_0x9c60('0xf')](function(){if(_[_0x9c60('0xc0')](_0x431377['query'][_0x9c60('0x6a')])){for(var _0x26b9f7=0x0;_0x26b9f7<_0x431377[_0x9c60('0x4a')][_0x9c60('0x6a')]['length'];_0x26b9f7+=0x1){socket['emit'](_0x9c60('0xc1'),{'UserId':Number(_0x431377[_0x9c60('0x4a')]['ids'][_0x26b9f7]),'MailAccountId':Number(_0x431377[_0x9c60('0x63')]['id'])});}}else{socket['emit'](_0x9c60('0xc1'),{'UserId':Number(_0x431377[_0x9c60('0x4a')][_0x9c60('0x6a')]),'MailAccountId':Number(_0x431377['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a3213,null))['catch'](handleError(_0x5a3213,null));};exports[_0x9c60('0xc2')]=function(_0x23323d,_0x52664a){var _0xf840e={};var _0x8f353b={};var _0x31dc46;var _0x369fee;return db[_0x9c60('0x55')][_0x9c60('0x68')]({'where':{'id':_0x23323d[_0x9c60('0x63')]['id']}})[_0x9c60('0xf')](handleEntityNotFound(_0x52664a,null))[_0x9c60('0xf')](function(_0x55863b){if(_0x55863b){_0x31dc46=_0x55863b;_0x8f353b[_0x9c60('0x49')]=_[_0x9c60('0x46')](db[_0x9c60('0x88')][_0x9c60('0x42')]);_0x8f353b[_0x9c60('0x4a')]=_[_0x9c60('0x46')](_0x23323d['query']);_0x8f353b[_0x9c60('0x47')]=_[_0x9c60('0x48')](_0x8f353b[_0x9c60('0x49')],_0x8f353b[_0x9c60('0x4a')]);_0xf840e[_0x9c60('0x4b')]=_[_0x9c60('0x48')](_0x8f353b['model'],qs[_0x9c60('0x4c')](_0x23323d[_0x9c60('0x4a')][_0x9c60('0x4c')]));_0xf840e[_0x9c60('0x4b')]=_0xf840e['attributes']['length']?_0xf840e[_0x9c60('0x4b')]:_0x8f353b[_0x9c60('0x49')];_0xf840e[_0x9c60('0x86')]=qs[_0x9c60('0x4e')](_0x23323d['query'][_0x9c60('0x4e')]);_0xf840e[_0x9c60('0x4f')]=qs[_0x9c60('0x47')](_['pick'](_0x23323d['query'],_0x8f353b[_0x9c60('0x47')]));if(_0x23323d[_0x9c60('0x4a')]['filter']){_0xf840e['where']=_['merge'](_0xf840e[_0x9c60('0x4f')],{'$or':_['map'](_0xf840e[_0x9c60('0x4b')],function(_0x159777){var _0x37e0b1={};_0x37e0b1[_0x159777]={'$like':'%'+_0x23323d[_0x9c60('0x4a')][_0x9c60('0x51')]+'%'};return _0x37e0b1;})});}_0xf840e=_[_0x9c60('0x53')]({},_0xf840e,_0x23323d['options']);return _0x31dc46[_0x9c60('0xc2')](_0xf840e);}})[_0x9c60('0xf')](function(_0x58c3ea){if(_0x58c3ea){_0x369fee=_0x58c3ea[_0x9c60('0x4d')];if(!_0x23323d[_0x9c60('0x4a')][_0x9c60('0x6e')](_0x9c60('0x85'))){_0xf840e['limit']=qs[_0x9c60('0x1c')](_0x23323d[_0x9c60('0x4a')][_0x9c60('0x1c')]);_0xf840e['offset']=qs[_0x9c60('0x1a')](_0x23323d[_0x9c60('0x4a')][_0x9c60('0x1a')]);}return _0x31dc46['getAgents'](_0xf840e);}})[_0x9c60('0xf')](function(_0x523a72){if(_0x523a72){return _0x523a72?{'count':_0x369fee,'rows':_0x523a72}:null;}})[_0x9c60('0xf')](respondWithResult(_0x52664a,null))[_0x9c60('0x17')](handleError(_0x52664a,null));}; \ No newline at end of file +var _0xef31=['CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','rows','params','rawAttributes','options','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','findAll','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','attach','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','destroy','get','MailAccounts','send','gmail','yahoo','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','user','username','password','pass','modernAuthentication'];(function(_0x1a1d4a,_0x48ef2b){var _0x44fda1=function(_0x1c68b9){while(--_0x1c68b9){_0x1a1d4a['push'](_0x1a1d4a['shift']());}};_0x44fda1(++_0x48ef2b);}(_0xef31,0x8e));var _0x1ef3=function(_0x29af75,_0x193a68){_0x29af75=_0x29af75-0x0;var _0x3c0b11=_0xef31[_0x29af75];return _0x3c0b11;};'use strict';var moment=require('moment');var BPromise=require(_0x1ef3('0x0'));var util=require(_0x1ef3('0x1'));var path=require(_0x1ef3('0x2'));var _=require(_0x1ef3('0x3'));var juice=require('juice');var Redis=require(_0x1ef3('0x4'));var qs=require(_0x1ef3('0x5'));var logger=require(_0x1ef3('0x6'))(_0x1ef3('0x7'));var config=require(_0x1ef3('0x8'));var db=require(_0x1ef3('0x9'))['db'];config[_0x1ef3('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1ef3('0xb'))(new Redis(config['redis']));require(_0x1ef3('0xc'))['register'](socket);var jayson=require(_0x1ef3('0xd'));var client=jayson[_0x1ef3('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x17eb0b,_0x534a68,_0x904cd4,_0x42e25b){return new BPromise(function(_0x23f85f,_0x47f5ec){var _0x5a9645=_0x42e25b||client;return _0x5a9645[_0x1ef3('0xf')](_0x17eb0b,_0x904cd4)[_0x1ef3('0x10')](function(_0x4d4fd8){logger[_0x1ef3('0x11')](_0x1ef3('0x12'),_0x534a68,_0x1ef3('0x13'));logger[_0x1ef3('0x14')](_0x1ef3('0x15'),_0x534a68,_0x1ef3('0x13'),JSON[_0x1ef3('0x16')](_0x4d4fd8));if(_0x4d4fd8[_0x1ef3('0x17')]){if(_0x4d4fd8['error'][_0x1ef3('0x18')]===0x1f4){logger[_0x1ef3('0x17')]('MailAccount,\x20%s,\x20%s',_0x534a68,_0x4d4fd8[_0x1ef3('0x17')][_0x1ef3('0x19')]);return _0x47f5ec(_0x4d4fd8[_0x1ef3('0x17')][_0x1ef3('0x19')]);}logger[_0x1ef3('0x17')](_0x1ef3('0x12'),_0x534a68,_0x4d4fd8[_0x1ef3('0x17')][_0x1ef3('0x19')]);return _0x23f85f(_0x4d4fd8[_0x1ef3('0x17')][_0x1ef3('0x19')]);}else{logger[_0x1ef3('0x11')](_0x1ef3('0x12'),_0x534a68,_0x1ef3('0x13'));_0x23f85f(_0x4d4fd8[_0x1ef3('0x1a')][_0x1ef3('0x19')]);}})[_0x1ef3('0x1b')](function(_0x44a974){logger[_0x1ef3('0x17')](_0x1ef3('0x12'),_0x534a68,_0x44a974);_0x47f5ec(_0x44a974);});});}function respondWithStatusCode(_0x2dd08d,_0x57c85c){_0x57c85c=_0x57c85c||0xcc;return function(_0x4144e2){if(_0x4144e2){return _0x2dd08d[_0x1ef3('0x1c')](_0x57c85c);}return _0x2dd08d[_0x1ef3('0x1d')](_0x57c85c)[_0x1ef3('0x1e')]();};}function respondWithResult(_0x375f09,_0x286e48){_0x286e48=_0x286e48||0xc8;return function(_0x19eb7f){if(_0x19eb7f){return _0x375f09[_0x1ef3('0x1d')](_0x286e48)[_0x1ef3('0x1f')](_0x19eb7f);}};}function respondWithFilteredResult(_0xb0ee5e,_0x368537){return function(_0x295e90){if(_0x295e90){var _0x3c4f6c=typeof _0x368537['offset']===_0x1ef3('0x20')&&typeof _0x368537[_0x1ef3('0x21')]===_0x1ef3('0x20');var _0x47a423=_0x295e90['count'];var _0x435729=_0x3c4f6c?0x0:_0x368537['offset'];var _0x4679c2=_0x3c4f6c?_0x295e90['count']:_0x368537[_0x1ef3('0x22')]+_0x368537[_0x1ef3('0x21')];var _0xdd214;if(_0x4679c2>=_0x47a423){_0x4679c2=_0x47a423;_0xdd214=0xc8;}else{_0xdd214=0xce;}_0xb0ee5e[_0x1ef3('0x1d')](_0xdd214);return _0xb0ee5e[_0x1ef3('0x23')](_0x1ef3('0x24'),_0x435729+'-'+_0x4679c2+'/'+_0x47a423)[_0x1ef3('0x1f')](_0x295e90);}return null;};}function saveUpdates(_0x2dc600){return function(_0x3be8b5){if(_0x3be8b5){return _0x3be8b5['update'](_0x2dc600)[_0x1ef3('0x10')](function(_0x149405){return _0x149405;});}return null;};}function removeEntity(_0xda136f){return function(_0x35b694){if(_0x35b694){return _0x35b694[_0x1ef3('0x25')]()[_0x1ef3('0x10')](function(){var _0x7316a7=_0x35b694[_0x1ef3('0x26')]({'plain':!![]});var _0xa3efa4=_0x1ef3('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xa3efa4,'resourceId':_0x7316a7['id']}})[_0x1ef3('0x10')](function(){return _0x35b694;});})['then'](function(){_0xda136f[_0x1ef3('0x1d')](0xcc)[_0x1ef3('0x1e')]();});}};}function handleEntityNotFound(_0x1c4922){return function(_0x56b345){if(!_0x56b345){_0x1c4922[_0x1ef3('0x1c')](0x194);}return _0x56b345;};}function handleError(_0xdbd56d,_0x6c7d84){_0x6c7d84=_0x6c7d84||0x1f4;return function(_0x2665de){logger[_0x1ef3('0x17')](_0x2665de['stack']);if(_0x2665de['name']){delete _0x2665de['name'];}_0xdbd56d[_0x1ef3('0x1d')](_0x6c7d84)[_0x1ef3('0x28')](_0x2665de);};}function getImapHost(_0x541669){switch(_0x541669){case _0x1ef3('0x29'):return'imap.gmail.com';case _0x1ef3('0x2a'):return'imap.mail.yahoo.com';case'hotmail':return'imap-mail.outlook.com';case _0x1ef3('0x2b'):return'outlook.office365.com';}throw new Error(_0x1ef3('0x2c'),_0x541669);}function getSmtpHost(_0x23b7db){switch(_0x23b7db){case _0x1ef3('0x29'):return _0x1ef3('0x2d');case _0x1ef3('0x2a'):return _0x1ef3('0x2e');case _0x1ef3('0x2f'):return'smtp-mail.outlook.com';case _0x1ef3('0x2b'):return'smtp.office365.com';}throw new Error(_0x1ef3('0x2c'),_0x23b7db);}function getAuthenticationOptions(_0xb8788d,_0x225b36){var _0x394130={};var _0xee8efb={};if(_0xb8788d){_0x394130['user']=_0xee8efb[_0x1ef3('0x30')]=_0x225b36[_0x1ef3('0x31')];_0x394130[_0x1ef3('0x32')]=_0xee8efb[_0x1ef3('0x33')]=_0x225b36['password'];if(_0x225b36[_0x1ef3('0x34')]){_0x394130['modernAuthentication']=_0xee8efb[_0x1ef3('0x34')]=!![];_0x394130['CloudProviderId']=_0xee8efb[_0x1ef3('0x35')]=_0x225b36[_0x1ef3('0x35')];_0x394130['password']=_0xee8efb[_0x1ef3('0x33')]=null;}else{_0x394130[_0x1ef3('0x35')]=_0xee8efb[_0x1ef3('0x35')]=null;}_0x394130[_0x1ef3('0x36')]=getImapHost(_0xb8788d);_0x394130['port']=0x3e1;_0xee8efb[_0x1ef3('0x36')]=getSmtpHost(_0xb8788d);_0xee8efb[_0x1ef3('0x37')]=0x24b;_0xee8efb['secure']=![];_0x394130[_0x1ef3('0x38')]=_0xee8efb[_0x1ef3('0x38')]=null;}else{if(_0x225b36[_0x1ef3('0x39')]){_0x394130['user']=_0xee8efb[_0x1ef3('0x30')]=_0x225b36[_0x1ef3('0x31')];_0x394130[_0x1ef3('0x32')]=_0xee8efb[_0x1ef3('0x33')]=_0x225b36[_0x1ef3('0x32')];}else{_0x394130[_0x1ef3('0x39')]=_0xee8efb[_0x1ef3('0x39')]=![];_0x394130[_0x1ef3('0x30')]=_0xee8efb[_0x1ef3('0x30')]=null;_0x394130[_0x1ef3('0x32')]=_0xee8efb[_0x1ef3('0x33')]=null;}_0x394130[_0x1ef3('0x36')]=_0x225b36[_0x1ef3('0x3a')]['host'];_0x394130['port']=_0x225b36[_0x1ef3('0x3a')][_0x1ef3('0x37')];_0xee8efb[_0x1ef3('0x36')]=_0x225b36['Smtp'][_0x1ef3('0x36')];_0xee8efb[_0x1ef3('0x37')]=_0x225b36[_0x1ef3('0x3b')]['port'];}return{'Imap':_0x394130,'Smtp':_0xee8efb};}exports[_0x1ef3('0x3c')]=function(_0xf10cec,_0x33f066){var _0x348f56={'include':[{'model':db[_0x1ef3('0x3d')],'as':_0x1ef3('0x3a')},{'model':db[_0x1ef3('0x3e')],'as':_0x1ef3('0x3b')},{'model':db[_0x1ef3('0x3f')],'as':_0x1ef3('0x40')}]},_0x53840e={},_0x4b1132={'count':0x0,'rows':[]};var _0x4b0376=_['map'](db[_0x1ef3('0x41')]['rawAttributes'],function(_0x342285){return{'name':_0x342285['fieldName'],'type':_0x342285[_0x1ef3('0x42')][_0x1ef3('0x43')]};});_0x53840e[_0x1ef3('0x44')]=_[_0x1ef3('0x45')](_0x4b0376,_0x1ef3('0x46'));_0x53840e[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0xf10cec[_0x1ef3('0x47')]);_0x53840e[_0x1ef3('0x49')]=_[_0x1ef3('0x4a')](_0x53840e[_0x1ef3('0x44')],_0x53840e[_0x1ef3('0x47')]);_0x348f56[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x53840e['model'],qs[_0x1ef3('0x4c')](_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x4c')]));_0x348f56[_0x1ef3('0x4b')]=_0x348f56['attributes'][_0x1ef3('0x4d')]?_0x348f56['attributes']:_0x53840e[_0x1ef3('0x44')];if(!_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x4e')](_0x1ef3('0x4f'))){_0x348f56[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x21')]);_0x348f56[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x22')]);}_0x348f56[_0x1ef3('0x50')]=qs[_0x1ef3('0x51')](_0xf10cec['query']['sort']);_0x348f56['where']=qs['filters'](_[_0x1ef3('0x52')](_0xf10cec['query'],_0x53840e[_0x1ef3('0x49')]),_0x4b0376);if(_0xf10cec['query'][_0x1ef3('0x53')]){_0x348f56[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x348f56['where'],{'$or':_[_0x1ef3('0x45')](_0x4b0376,function(_0x140cf2){if(_0x140cf2['type']!=='VIRTUAL'){var _0x26b57={};_0x26b57[_0x140cf2[_0x1ef3('0x46')]]={'$like':'%'+_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x53')]+'%'};return _0x26b57;}})});}_0x348f56=_[_0x1ef3('0x55')]({},_0x348f56,_0xf10cec['options']);var _0x591f36={'where':_0x348f56[_0x1ef3('0x54')]};return db[_0x1ef3('0x41')]['count'](_0x591f36)[_0x1ef3('0x10')](function(_0x1d6e6a){_0x4b1132[_0x1ef3('0x56')]=_0x1d6e6a;if(_0xf10cec[_0x1ef3('0x47')][_0x1ef3('0x57')]){_0x348f56[_0x1ef3('0x58')]=[{'all':!![]}];}return db[_0x1ef3('0x41')]['findAll'](_0x348f56);})['then'](function(_0x2cef59){_0x4b1132[_0x1ef3('0x59')]=_0x2cef59;return _0x4b1132;})[_0x1ef3('0x10')](respondWithFilteredResult(_0x33f066,_0x348f56))[_0x1ef3('0x1b')](handleError(_0x33f066,null));};exports['show']=function(_0x4db706,_0xc9ef1d){var _0x12c1b3={'raw':![],'where':{'id':_0x4db706[_0x1ef3('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x1ef3('0x3b')},{'model':db[_0x1ef3('0x3f')],'as':_0x1ef3('0x40')}]},_0x38ccb5={};_0x38ccb5[_0x1ef3('0x44')]=_[_0x1ef3('0x48')](db[_0x1ef3('0x41')][_0x1ef3('0x5b')]);_0x38ccb5[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x4db706['query']);_0x38ccb5['filters']=_['intersection'](_0x38ccb5['model'],_0x38ccb5[_0x1ef3('0x47')]);_0x12c1b3[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x38ccb5[_0x1ef3('0x44')],qs[_0x1ef3('0x4c')](_0x4db706[_0x1ef3('0x47')][_0x1ef3('0x4c')]));_0x12c1b3[_0x1ef3('0x4b')]=_0x12c1b3[_0x1ef3('0x4b')][_0x1ef3('0x4d')]?_0x12c1b3[_0x1ef3('0x4b')]:_0x38ccb5['model'];if(_0x4db706['query'][_0x1ef3('0x57')]){_0x12c1b3['include']=[{'all':!![]}];}_0x12c1b3=_['merge']({},_0x12c1b3,_0x4db706[_0x1ef3('0x5c')]);return db[_0x1ef3('0x41')][_0x1ef3('0x5d')](_0x12c1b3)[_0x1ef3('0x10')](handleEntityNotFound(_0xc9ef1d,null))[_0x1ef3('0x10')](respondWithResult(_0xc9ef1d,null))['catch'](handleError(_0xc9ef1d,null));};exports['update']=function(_0x1ad252,_0x1b0419){if(_0x1ad252[_0x1ef3('0x5e')]['id']){delete _0x1ad252[_0x1ef3('0x5e')]['id'];}var _0x2571a5=_0x1ad252['body'][_0x1ef3('0x5f')]===_0x1ef3('0x60')?null:_0x1ad252[_0x1ef3('0x5e')][_0x1ef3('0x5f')];var _0x1c09e9=_0x1ad252[_0x1ef3('0x5e')][_0x1ef3('0x3a')]||{};var _0x10abeb=_0x1ad252['body'][_0x1ef3('0x3b')]||{};if(_0x2571a5){_0x1c09e9[_0x1ef3('0x36')]=getImapHost(_0x2571a5);_0x1c09e9['port']=0x3e1;_0x10abeb['host']=getSmtpHost(_0x2571a5);_0x10abeb[_0x1ef3('0x37')]=0x24b;_0x10abeb[_0x1ef3('0x61')]=![];}if(_0x10abeb['modernAuthentication']){_0x10abeb[_0x1ef3('0x61')]=![];}else{_0x10abeb[_0x1ef3('0x35')]=null;}if(!_0x1c09e9['modernAuthentication'])_0x1c09e9[_0x1ef3('0x35')]=null;_0x1ad252['body'][_0x1ef3('0x3a')]=_0x1c09e9;_0x1ad252[_0x1ef3('0x5e')]['Smtp']=_0x10abeb;return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x1ad252['params']['id']},'include':[{'model':db[_0x1ef3('0x3d')],'as':_0x1ef3('0x3a')},{'model':db[_0x1ef3('0x3e')],'as':'Smtp'},{'model':db[_0x1ef3('0x3f')],'as':_0x1ef3('0x40')}]})[_0x1ef3('0x10')](handleEntityNotFound(_0x1b0419,null))[_0x1ef3('0x10')](function(_0x2249b4){if(!_0x2249b4)throw new Error(_0x1ef3('0x62'));if(_0x2249b4['service'])delete _0x1ad252[_0x1ef3('0x5e')][_0x1ef3('0x3a')];return _0x2249b4;})[_0x1ef3('0x10')](saveUpdates(_0x1ad252[_0x1ef3('0x5e')],null))[_0x1ef3('0x10')](function(_0x1277b5){if(!_0x1ad252['body'][_0x1ef3('0x3a')])return _0x1277b5;return db[_0x1ef3('0x3d')][_0x1ef3('0x63')](_0x1ad252['body']['Imap'],{'where':{'MailAccountId':_0x1277b5['id']}})[_0x1ef3('0x10')](function(){return _0x1277b5;});})[_0x1ef3('0x10')](function(_0x4f160d){if(!_0x1ad252['body'][_0x1ef3('0x3b')])return _0x4f160d;return db[_0x1ef3('0x3e')][_0x1ef3('0x63')](_0x1ad252[_0x1ef3('0x5e')][_0x1ef3('0x3b')],{'where':{'MailAccountId':_0x4f160d['id']}})['then'](function(){return _0x4f160d;});})[_0x1ef3('0x10')](respondWithResult(_0x1b0419,null))['catch'](handleError(_0x1b0419,null));};exports[_0x1ef3('0x64')]=function(_0x2f8655,_0xcd2a67){return db[_0x1ef3('0x41')][_0x1ef3('0x64')]()[_0x1ef3('0x10')](respondWithResult(_0xcd2a67,null))[_0x1ef3('0x1b')](handleError(_0xcd2a67,null));};exports[_0x1ef3('0x65')]=function(_0x41c765,_0x485324){if(_0x41c765[_0x1ef3('0x5e')]['id']){delete _0x41c765[_0x1ef3('0x5e')]['id'];}return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x41c765[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x485324,null))[_0x1ef3('0x10')](function(_0x2d1b65){if(_0x2d1b65){_0x41c765[_0x1ef3('0x5e')][_0x1ef3('0x66')]=_0x2d1b65['id'];return db[_0x1ef3('0x67')][_0x1ef3('0x68')](_0x41c765[_0x1ef3('0x5e')]);}})['then'](respondWithResult(_0x485324,null))[_0x1ef3('0x1b')](handleError(_0x485324,null));};exports[_0x1ef3('0x69')]=function(_0x21897a,_0x5825de){var _0x53153e={'raw':![],'where':{}};var _0x2fc2db={};var _0x69449f={'count':0x0,'rows':[]};return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x21897a[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x5825de,null))[_0x1ef3('0x10')](function(_0x5bb486){if(_0x5bb486){_0x2fc2db[_0x1ef3('0x44')]=_[_0x1ef3('0x48')](db[_0x1ef3('0x67')][_0x1ef3('0x5b')]);_0x2fc2db[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x21897a[_0x1ef3('0x47')]);_0x2fc2db[_0x1ef3('0x49')]=_[_0x1ef3('0x4a')](_0x2fc2db[_0x1ef3('0x44')],_0x2fc2db[_0x1ef3('0x47')]);_0x53153e[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x2fc2db['model'],qs['fields'](_0x21897a['query'][_0x1ef3('0x4c')]));_0x53153e[_0x1ef3('0x4b')]=_0x53153e['attributes'][_0x1ef3('0x4d')]?_0x53153e[_0x1ef3('0x4b')]:_0x2fc2db[_0x1ef3('0x44')];if(!_0x21897a[_0x1ef3('0x47')][_0x1ef3('0x4e')](_0x1ef3('0x4f'))){_0x53153e[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0x21897a[_0x1ef3('0x47')][_0x1ef3('0x21')]);_0x53153e[_0x1ef3('0x22')]=qs['offset'](_0x21897a[_0x1ef3('0x47')][_0x1ef3('0x22')]);}_0x53153e['order']=qs[_0x1ef3('0x51')](_0x21897a[_0x1ef3('0x47')][_0x1ef3('0x51')]);_0x53153e[_0x1ef3('0x54')]=qs[_0x1ef3('0x49')](_['pick'](_0x21897a[_0x1ef3('0x47')],_0x2fc2db[_0x1ef3('0x49')]));_0x53153e[_0x1ef3('0x54')][_0x1ef3('0x66')]=_0x5bb486['id'];if(_0x21897a[_0x1ef3('0x47')][_0x1ef3('0x53')]){_0x53153e[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x53153e[_0x1ef3('0x54')],{'$or':_[_0x1ef3('0x45')](_0x53153e[_0x1ef3('0x4b')],function(_0x4c0440){var _0x1bef17={};_0x1bef17[_0x4c0440]={'$like':'%'+_0x21897a['query'][_0x1ef3('0x53')]+'%'};return _0x1bef17;})});}_0x53153e=_[_0x1ef3('0x55')]({},_0x53153e,_0x21897a[_0x1ef3('0x5c')]);return db[_0x1ef3('0x67')]['count']({'where':_0x53153e[_0x1ef3('0x54')]})[_0x1ef3('0x10')](function(_0x65127f){_0x69449f[_0x1ef3('0x56')]=_0x65127f;if(_0x21897a['query'][_0x1ef3('0x57')]){_0x53153e[_0x1ef3('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x53153e);})[_0x1ef3('0x10')](function(_0x8a41ac){_0x69449f[_0x1ef3('0x59')]=_0x8a41ac;return _0x69449f;});}})[_0x1ef3('0x10')](respondWithFilteredResult(_0x5825de,_0x53153e))[_0x1ef3('0x1b')](handleError(_0x5825de,null));};exports[_0x1ef3('0x6b')]=function(_0x185b81,_0x3b17eb){return db['MailAccount']['find']({'where':{'id':_0x185b81[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x3b17eb,null))['then'](function(_0x4c0122){if(_0x4c0122){return _0x4c0122['removeDispositions'](_0x185b81[_0x1ef3('0x47')][_0x1ef3('0x6c')]);}})[_0x1ef3('0x10')](respondWithStatusCode(_0x3b17eb,null))['catch'](handleError(_0x3b17eb,null));};exports[_0x1ef3('0x6d')]=function(_0x5234bf,_0x1b625d){if(_0x5234bf[_0x1ef3('0x5e')]['id']){delete _0x5234bf['body']['id'];}return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x5234bf[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x1b625d,null))['then'](function(_0x38babf){if(_0x38babf){_0x5234bf[_0x1ef3('0x5e')][_0x1ef3('0x66')]=_0x38babf['id'];return db[_0x1ef3('0x6e')]['create'](_0x5234bf['body']);}})[_0x1ef3('0x10')](respondWithResult(_0x1b625d,null))[_0x1ef3('0x1b')](handleError(_0x1b625d,null));};exports['getAnswers']=function(_0x2eee08,_0x51b45e){var _0x5dfd73={'raw':![],'where':{}};var _0x179eb9={};var _0x1b0c2c={'count':0x0,'rows':[]};return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x2eee08[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x51b45e,null))[_0x1ef3('0x10')](function(_0x2ad879){if(_0x2ad879){_0x179eb9['model']=_[_0x1ef3('0x48')](db[_0x1ef3('0x6e')][_0x1ef3('0x5b')]);_0x179eb9[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x2eee08[_0x1ef3('0x47')]);_0x179eb9[_0x1ef3('0x49')]=_[_0x1ef3('0x4a')](_0x179eb9[_0x1ef3('0x44')],_0x179eb9[_0x1ef3('0x47')]);_0x5dfd73[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x179eb9[_0x1ef3('0x44')],qs[_0x1ef3('0x4c')](_0x2eee08[_0x1ef3('0x47')][_0x1ef3('0x4c')]));_0x5dfd73[_0x1ef3('0x4b')]=_0x5dfd73[_0x1ef3('0x4b')]['length']?_0x5dfd73[_0x1ef3('0x4b')]:_0x179eb9[_0x1ef3('0x44')];if(!_0x2eee08[_0x1ef3('0x47')]['hasOwnProperty'](_0x1ef3('0x4f'))){_0x5dfd73[_0x1ef3('0x21')]=qs['limit'](_0x2eee08[_0x1ef3('0x47')][_0x1ef3('0x21')]);_0x5dfd73[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0x2eee08[_0x1ef3('0x47')]['offset']);}_0x5dfd73[_0x1ef3('0x50')]=qs['sort'](_0x2eee08[_0x1ef3('0x47')][_0x1ef3('0x51')]);_0x5dfd73['where']=qs[_0x1ef3('0x49')](_[_0x1ef3('0x52')](_0x2eee08[_0x1ef3('0x47')],_0x179eb9['filters']));_0x5dfd73[_0x1ef3('0x54')]['MailAccountId']=_0x2ad879['id'];if(_0x2eee08['query'][_0x1ef3('0x53')]){_0x5dfd73[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x5dfd73[_0x1ef3('0x54')],{'$or':_[_0x1ef3('0x45')](_0x5dfd73[_0x1ef3('0x4b')],function(_0x2e4754){var _0x4b0531={};_0x4b0531[_0x2e4754]={'$like':'%'+_0x2eee08[_0x1ef3('0x47')][_0x1ef3('0x53')]+'%'};return _0x4b0531;})});}_0x5dfd73=_['merge']({},_0x5dfd73,_0x2eee08[_0x1ef3('0x5c')]);return db['CannedAnswer'][_0x1ef3('0x56')]({'where':_0x5dfd73[_0x1ef3('0x54')]})[_0x1ef3('0x10')](function(_0x571ef4){_0x1b0c2c[_0x1ef3('0x56')]=_0x571ef4;if(_0x2eee08[_0x1ef3('0x47')][_0x1ef3('0x57')]){_0x5dfd73[_0x1ef3('0x58')]=[{'all':!![]}];}return db[_0x1ef3('0x6e')]['findAll'](_0x5dfd73);})[_0x1ef3('0x10')](function(_0x29d5c7){_0x1b0c2c[_0x1ef3('0x59')]=_0x29d5c7;return _0x1b0c2c;});}})[_0x1ef3('0x10')](respondWithFilteredResult(_0x51b45e,_0x5dfd73))[_0x1ef3('0x1b')](handleError(_0x51b45e,null));};exports['removeAnswers']=function(_0x3fbcd2,_0x8ee7b8){return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x3fbcd2[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x8ee7b8,null))[_0x1ef3('0x10')](function(_0x216f01){if(_0x216f01){return _0x216f01['removeAnswers'](_0x3fbcd2['query'][_0x1ef3('0x6c')]);}})['then'](respondWithStatusCode(_0x8ee7b8,null))[_0x1ef3('0x1b')](handleError(_0x8ee7b8,null));};exports[_0x1ef3('0x68')]=function(_0x36d7ee,_0x335e57){var _0x14ca9b={'name':_0x36d7ee[_0x1ef3('0x5e')][_0x1ef3('0x46')],'key':_0x36d7ee[_0x1ef3('0x5e')][_0x1ef3('0x43')],'provider':_0x36d7ee['body'][_0x1ef3('0x5f')]===_0x1ef3('0x60')?null:_0x36d7ee[_0x1ef3('0x5e')][_0x1ef3('0x5f')],'email':_0x36d7ee['body'][_0x1ef3('0x6f')],'ListId':_0x36d7ee[_0x1ef3('0x5e')][_0x1ef3('0x70')],'active':!_[_0x1ef3('0x71')](_0x36d7ee['body'][_0x1ef3('0x72')])?_0x36d7ee['body'][_0x1ef3('0x72')]:!![],'description':_0x36d7ee[_0x1ef3('0x5e')][_0x1ef3('0x73')]||null};var _0x29ef35=getAuthenticationOptions(_0x14ca9b['provider'],_0x36d7ee['body']);_0x14ca9b[_0x1ef3('0x3a')]=_0x29ef35[_0x1ef3('0x3a')];_0x14ca9b[_0x1ef3('0x3b')]=_0x29ef35[_0x1ef3('0x3b')];return db[_0x1ef3('0x41')][_0x1ef3('0x68')](_0x14ca9b,{'include':[{'model':db['MailServerOut'],'as':_0x1ef3('0x3b')},{'model':db[_0x1ef3('0x3d')],'as':_0x1ef3('0x3a')}]})[_0x1ef3('0x10')](function(_0x34eaad){var _0x3dea07=_0x36d7ee['user']['get']({'plain':!![]});if(!_0x3dea07)throw new Error(_0x1ef3('0x74'));if(_0x3dea07[_0x1ef3('0x75')]===_0x1ef3('0x30')){var _0x37fd3e=_0x34eaad[_0x1ef3('0x26')]({'plain':!![]});return db[_0x1ef3('0x76')][_0x1ef3('0x5d')]({'where':{'name':_0x1ef3('0x27'),'userProfileId':_0x3dea07[_0x1ef3('0x77')]},'raw':!![]})[_0x1ef3('0x10')](function(_0x254c67){if(_0x254c67&&_0x254c67[_0x1ef3('0x78')]===0x0){return db[_0x1ef3('0x79')][_0x1ef3('0x68')]({'name':_0x37fd3e['name'],'resourceId':_0x37fd3e['id'],'type':_0x254c67[_0x1ef3('0x46')],'sectionId':_0x254c67['id']},{})['then'](function(){return _0x34eaad;});}else{return _0x34eaad;}})[_0x1ef3('0x1b')](function(_0x1a2e8a){logger['error'](_0x1ef3('0x7a'),_0x1a2e8a);throw _0x1a2e8a;});}return _0x34eaad;})['then'](respondWithResult(_0x335e57,0xc9))[_0x1ef3('0x1b')](handleError(_0x335e57,null));};exports[_0x1ef3('0x7b')]=function(_0x3636d3,_0x55fbb3){return db[_0x1ef3('0x41')]['findOne']({'where':{'id':_0x3636d3[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x55fbb3,null))[_0x1ef3('0x10')](function(_0x53c666){if(_0x53c666){return _0x53c666[_0x1ef3('0x7b')]();}return null;})[_0x1ef3('0x10')](respondWithResult(_0x55fbb3,null))[_0x1ef3('0x1b')](handleError(_0x55fbb3,null));};exports['addImap']=function(_0x2e9b71,_0x4de06e){if(_0x2e9b71[_0x1ef3('0x5e')]['id']){delete _0x2e9b71[_0x1ef3('0x5e')]['id'];}return db[_0x1ef3('0x41')]['find']({'where':{'id':_0x2e9b71[_0x1ef3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4de06e,null))['then'](function(_0x35818d){if(_0x35818d){_0x2e9b71[_0x1ef3('0x5e')]['MailAccountId']=_0x35818d['id'];return db['MailServerIn']['create'](_0x2e9b71['body']);}})[_0x1ef3('0x10')](respondWithResult(_0x4de06e,null))[_0x1ef3('0x1b')](handleError(_0x4de06e,null));};exports[_0x1ef3('0x7c')]=function(_0xa593db,_0x32d550){return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0xa593db[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x32d550,null))['then'](function(_0x507b81){if(_0x507b81){return _0x507b81[_0x1ef3('0x7d')](null);}return null;})[_0x1ef3('0x10')](respondWithStatusCode(_0x32d550,null))['catch'](handleError(_0x32d550,null));};exports[_0x1ef3('0x7e')]=function(_0x54e37f,_0x5c0882){return db['MailAccount']['findOne']({'where':{'id':_0x54e37f[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x5c0882,null))['then'](function(_0x59af22){if(_0x59af22){return _0x59af22[_0x1ef3('0x7e')]();}return null;})[_0x1ef3('0x10')](respondWithResult(_0x5c0882,null))[_0x1ef3('0x1b')](handleError(_0x5c0882,null));};exports['addSmtp']=function(_0x43ced2,_0x182f10){if(_0x43ced2[_0x1ef3('0x5e')]['id']){delete _0x43ced2['body']['id'];}return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x43ced2[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x182f10,null))[_0x1ef3('0x10')](function(_0x12f169){if(_0x12f169){_0x43ced2['body'][_0x1ef3('0x66')]=_0x12f169['id'];return db[_0x1ef3('0x3e')][_0x1ef3('0x68')](_0x43ced2[_0x1ef3('0x5e')]);}})[_0x1ef3('0x10')](respondWithResult(_0x182f10,null))[_0x1ef3('0x1b')](handleError(_0x182f10,null));};exports['removeSmtp']=function(_0x5f3e57,_0x7abb91){return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x5f3e57[_0x1ef3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7abb91,null))[_0x1ef3('0x10')](function(_0x233901){if(_0x233901){return _0x233901[_0x1ef3('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x7abb91,null))[_0x1ef3('0x1b')](handleError(_0x7abb91,null));};exports[_0x1ef3('0x80')]=function(_0x170d4d,_0x2df5fe){return db['MailInteraction'][_0x1ef3('0x5d')]({'where':{'id':_0x170d4d[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x2df5fe,null))[_0x1ef3('0x10')](function(_0x28ee36){if(_0x28ee36){return _0x28ee36[_0x1ef3('0x80')](_0x170d4d[_0x1ef3('0x5e')]['ids'],_['omit'](_0x170d4d[_0x1ef3('0x5e')],[_0x1ef3('0x6c'),'id'])||{});}})[_0x1ef3('0x10')](respondWithResult(_0x2df5fe,null))[_0x1ef3('0x1b')](handleError(_0x2df5fe,null));};exports[_0x1ef3('0x81')]=function(_0x1d2867,_0x57a149){var _0x358799={'raw':![],'where':{}};var _0x2ee8d5={};var _0x500b96={'count':0x0,'rows':[]};return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x1d2867[_0x1ef3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x57a149,null))['then'](function(_0x24fd9c){if(_0x24fd9c){_0x2ee8d5['model']=_[_0x1ef3('0x48')](db[_0x1ef3('0x82')]['rawAttributes']);_0x2ee8d5[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x1d2867['query']);_0x2ee8d5[_0x1ef3('0x49')]=_['intersection'](_0x2ee8d5[_0x1ef3('0x44')],_0x2ee8d5[_0x1ef3('0x47')]);_0x358799[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x2ee8d5[_0x1ef3('0x44')],qs['fields'](_0x1d2867[_0x1ef3('0x47')]['fields']));_0x358799[_0x1ef3('0x4b')]=_0x358799[_0x1ef3('0x4b')][_0x1ef3('0x4d')]?_0x358799[_0x1ef3('0x4b')]:_0x2ee8d5['model'];if(!_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x4e')](_0x1ef3('0x4f'))){_0x358799[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0x1d2867['query']['limit']);_0x358799[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x22')]);}_0x358799[_0x1ef3('0x50')]=qs[_0x1ef3('0x51')](_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x51')]);_0x358799['where']=qs[_0x1ef3('0x49')](_[_0x1ef3('0x52')](_0x1d2867[_0x1ef3('0x47')],_0x2ee8d5[_0x1ef3('0x49')]));_0x358799[_0x1ef3('0x54')][_0x1ef3('0x66')]=_0x24fd9c['id'];if(_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x53')]){_0x358799[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x358799[_0x1ef3('0x54')],{'$or':_['map'](_0x358799[_0x1ef3('0x4b')],function(_0x2ee512){var _0x215906={};_0x215906[_0x2ee512]={'$like':'%'+_0x1d2867[_0x1ef3('0x47')]['filter']+'%'};return _0x215906;})});}_0x358799=_['merge']({},_0x358799,_0x1d2867[_0x1ef3('0x5c')]);return db['MailInteraction'][_0x1ef3('0x56')]({'where':_0x358799[_0x1ef3('0x54')]})[_0x1ef3('0x10')](function(_0x2b09c1){_0x500b96['count']=_0x2b09c1;if(_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x57')]){_0x358799['include']=[{'model':db[_0x1ef3('0x83')],'as':_0x1ef3('0x84'),'required':![]},{'model':db[_0x1ef3('0x85')],'as':_0x1ef3('0x86'),'attributes':[_0x1ef3('0x46'),_0x1ef3('0x87'),_0x1ef3('0x88')],'required':![]},{'model':db[_0x1ef3('0x89')],'as':_0x1ef3('0x8a'),'attributes':['id',_0x1ef3('0x46'),_0x1ef3('0x8b')],'where':_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x8c')]?{'id':_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x8c')]}:undefined,'required':_0x1d2867[_0x1ef3('0x47')][_0x1ef3('0x8c')]?!![]:![]}];}return db[_0x1ef3('0x82')][_0x1ef3('0x8d')](_0x358799);})[_0x1ef3('0x10')](function(_0x4900b2){_0x500b96[_0x1ef3('0x59')]=_0x4900b2;return _0x500b96;});}})[_0x1ef3('0x10')](respondWithFilteredResult(_0x57a149,_0x358799))['catch'](handleError(_0x57a149,null));};exports[_0x1ef3('0x8e')]=function addApplications(_0x58a181,_0x2f4558){var _0x246d09=_0x58a181[_0x1ef3('0x5a')]['id'];var _0x462dcd=_0x58a181[_0x1ef3('0x5e')];var _0x589c66=0xc8;var _0x392441=null;return db[_0x1ef3('0x8f')][_0x1ef3('0x90')]({'isolationLevel':db['sequelize'][_0x1ef3('0x91')][_0x1ef3('0x92')][_0x1ef3('0x93')]},function(_0x330ce0){return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x246d09},'transaction':_0x330ce0})[_0x1ef3('0x10')](function(_0x2775d7){if(_0x2775d7){return db[_0x1ef3('0x94')][_0x1ef3('0x25')]({'where':{'MailAccountId':_0x246d09},'transaction':_0x330ce0})[_0x1ef3('0x10')](function(){var _0x3d708e=_['map'](_0x462dcd,function(_0x3168e5){_0x3168e5[_0x1ef3('0x66')]=_0x246d09;return _0x3168e5;});return db[_0x1ef3('0x94')][_0x1ef3('0x95')](_0x3d708e,{'transaction':_0x330ce0});});}else{_0x589c66=0x194;_0x392441=[];}});})[_0x1ef3('0x10')](function(){if(_0x589c66!==0x194){return db['MailApplication'][_0x1ef3('0x96')]({'where':{'MailAccountId':_0x246d09},'order':_0x1ef3('0x97')})['then'](function(_0x88f268){_0x392441=_0x88f268;});}})[_0x1ef3('0x1b')](function(_0x43d8b8){_0x589c66=0x1f4;logger[_0x1ef3('0x17')](_0x43d8b8['stack']);if(_0x43d8b8[_0x1ef3('0x46')]){delete _0x43d8b8[_0x1ef3('0x46')];}_0x392441=_0x43d8b8;})['finally'](function(){if(_0x392441===null){_0x2f4558[_0x1ef3('0x1c')](_0x589c66);}else{if(_0x589c66===0x1f4){_0x2f4558[_0x1ef3('0x1d')](_0x589c66)['send'](_0x392441);}else{_0x2f4558[_0x1ef3('0x1d')](_0x589c66)['json'](_0x392441);}}});};exports[_0x1ef3('0x98')]=function(_0x16a5cb,_0x2e4716){var _0xd1e4b={};var _0x26f9a7={};var _0x2aa854;var _0x1f7c0f;return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x16a5cb[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x2e4716,null))[_0x1ef3('0x10')](function(_0x321082){if(_0x321082){_0x2aa854=_0x321082;_0x26f9a7[_0x1ef3('0x44')]=_[_0x1ef3('0x48')](db[_0x1ef3('0x94')][_0x1ef3('0x5b')]);_0x26f9a7[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x16a5cb[_0x1ef3('0x47')]);_0x26f9a7[_0x1ef3('0x49')]=_[_0x1ef3('0x4a')](_0x26f9a7[_0x1ef3('0x44')],_0x26f9a7[_0x1ef3('0x47')]);_0xd1e4b[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x26f9a7['model'],qs['fields'](_0x16a5cb['query'][_0x1ef3('0x4c')]));_0xd1e4b['attributes']=_0xd1e4b['attributes'][_0x1ef3('0x4d')]?_0xd1e4b[_0x1ef3('0x4b')]:_0x26f9a7[_0x1ef3('0x44')];_0xd1e4b[_0x1ef3('0x50')]=qs[_0x1ef3('0x51')](_0x16a5cb['query'][_0x1ef3('0x51')]);_0xd1e4b[_0x1ef3('0x54')]=qs[_0x1ef3('0x49')](_[_0x1ef3('0x52')](_0x16a5cb[_0x1ef3('0x47')],_0x26f9a7[_0x1ef3('0x49')]));if(_0x16a5cb[_0x1ef3('0x47')][_0x1ef3('0x53')]){_0xd1e4b[_0x1ef3('0x54')]=_['merge'](_0xd1e4b['where'],{'$or':_['map'](_0xd1e4b[_0x1ef3('0x4b')],function(_0x4d10e9){var _0x2bf286={};_0x2bf286[_0x4d10e9]={'$like':'%'+_0x16a5cb[_0x1ef3('0x47')][_0x1ef3('0x53')]+'%'};return _0x2bf286;})});}_0xd1e4b=_[_0x1ef3('0x55')]({},_0xd1e4b,_0x16a5cb[_0x1ef3('0x5c')]);return _0x2aa854[_0x1ef3('0x98')](_0xd1e4b);}})[_0x1ef3('0x10')](function(_0x455aef){if(_0x455aef){_0x1f7c0f=_0x455aef['length'];if(!_0x16a5cb[_0x1ef3('0x47')][_0x1ef3('0x4e')](_0x1ef3('0x4f'))){_0xd1e4b[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0x16a5cb[_0x1ef3('0x47')][_0x1ef3('0x21')]);_0xd1e4b[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0x16a5cb[_0x1ef3('0x47')][_0x1ef3('0x22')]);}return _0x2aa854[_0x1ef3('0x98')](_0xd1e4b);}})['then'](function(_0x273e19){if(_0x273e19){return _0x273e19?{'count':_0x1f7c0f,'rows':_0x273e19}:null;}})[_0x1ef3('0x10')](respondWithResult(_0x2e4716,null))[_0x1ef3('0x1b')](handleError(_0x2e4716,null));};exports[_0x1ef3('0x99')]=function(_0x3cfa98,_0x52b991){var _0x3f6d59={'raw':!![],'where':{}};var _0x4104fd={};var _0x29a9f2={'count':0x0,'rows':[]};return db[_0x1ef3('0x41')]['findOne']({'where':{'id':_0x3cfa98[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x52b991,null))[_0x1ef3('0x10')](function(_0x2f754b){if(_0x2f754b){_0x4104fd[_0x1ef3('0x44')]=_[_0x1ef3('0x48')](db[_0x1ef3('0x9a')][_0x1ef3('0x5b')]);_0x4104fd[_0x1ef3('0x47')]=_[_0x1ef3('0x48')](_0x3cfa98[_0x1ef3('0x47')]);_0x4104fd[_0x1ef3('0x49')]=_[_0x1ef3('0x4a')](_0x4104fd[_0x1ef3('0x44')],_0x4104fd['query']);_0x3f6d59[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x4104fd['model'],qs['fields'](_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x4c')]));_0x3f6d59[_0x1ef3('0x4b')]=_0x3f6d59[_0x1ef3('0x4b')][_0x1ef3('0x4d')]?_0x3f6d59[_0x1ef3('0x4b')]:_0x4104fd[_0x1ef3('0x44')];if(!_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x4e')]('nolimit')){_0x3f6d59[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0x3cfa98[_0x1ef3('0x47')]['limit']);_0x3f6d59[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0x3cfa98['query']['offset']);}_0x3f6d59[_0x1ef3('0x50')]=qs[_0x1ef3('0x51')](_0x3cfa98[_0x1ef3('0x47')]['sort']);_0x3f6d59[_0x1ef3('0x54')]=qs[_0x1ef3('0x49')](_[_0x1ef3('0x52')](_0x3cfa98[_0x1ef3('0x47')],_0x4104fd[_0x1ef3('0x49')]));_0x3f6d59['where']['MailAccountId']=_0x2f754b['id'];if(_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x53')]){_0x3f6d59[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x3f6d59[_0x1ef3('0x54')],{'$or':_['map'](_0x3f6d59[_0x1ef3('0x4b')],function(_0x139e2b){var _0x4f43f7={};_0x4f43f7[_0x139e2b]={'$like':'%'+_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x53')]+'%'};return _0x4f43f7;})});}if(_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x9b')]){var _0x19c36f=_0x3cfa98[_0x1ef3('0x47')]['$gte'][_0x1ef3('0x9c')](',');var _0x57374f={};_0x57374f[_0x19c36f[0x0]]={'$gte':moment(_0x19c36f[0x1])[_0x1ef3('0x9d')](_0x1ef3('0x9e'))};_0x3f6d59[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x3f6d59['where'],_0x57374f);}_0x3f6d59=_[_0x1ef3('0x55')]({},_0x3f6d59,_0x3cfa98[_0x1ef3('0x5c')]);return db[_0x1ef3('0x9a')][_0x1ef3('0x56')]({'where':_0x3f6d59['where']})[_0x1ef3('0x10')](function(_0xee715f){_0x29a9f2[_0x1ef3('0x56')]=_0xee715f;if(_0x3cfa98['query'][_0x1ef3('0x57')]){_0x3f6d59[_0x1ef3('0x58')]=[{'all':!![]}];}return db[_0x1ef3('0x9a')][_0x1ef3('0x8d')](_0x3f6d59);})['then'](function(_0x28956c){if(_0x3cfa98[_0x1ef3('0x47')][_0x1ef3('0x9f')]===_0x1ef3('0xa0')){for(var _0x46aa59=0x0;_0x46aa59<_0x28956c[_0x1ef3('0x4d')];_0x46aa59++){_0x28956c[_0x46aa59][_0x1ef3('0x5e')]=juice(_0x28956c[_0x46aa59]['body']);}}_0x29a9f2['rows']=_0x28956c;return _0x29a9f2;});}})['then'](respondWithFilteredResult(_0x52b991,_0x3f6d59))[_0x1ef3('0x1b')](handleError(_0x52b991,null));};exports[_0x1ef3('0x28')]=function(_0x447bdc,_0xcc362){var _0x252ab8,_0xd56f32={},_0x3e66b2;if(_0x447bdc['body']['to']){_0x3e66b2=_0x447bdc['body']['to'][_0x1ef3('0x9c')](',')[0x0];}return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x447bdc[_0x1ef3('0x5a')]['id']},'include':[{'model':db[_0x1ef3('0xa1')],'as':_0x1ef3('0xa2'),'include':[{'model':db[_0x1ef3('0x83')],'as':_0x1ef3('0xa3'),'where':{'email':_0x3e66b2},'limit':0x1,'order':[[_0x1ef3('0xa4'),_0x1ef3('0xa5')]]}]},{'model':db[_0x1ef3('0x3e')],'as':_0x1ef3('0x3b'),'raw':!![],'include':[{'model':db[_0x1ef3('0xa6')],'as':_0x1ef3('0xa6'),'raw':!![]}]}]})[_0x1ef3('0x10')](handleEntityNotFound(_0xcc362,null))[_0x1ef3('0x10')](function(_0x599c45){if(!_0x599c45)return;_0x252ab8=_0x599c45;if(!_0x599c45[_0x1ef3('0x3b')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x1ef3('0x71')](_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa7')])){_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa7')]=util[_0x1ef3('0x9d')](_0x1ef3('0xa8'),_0x599c45[_0x1ef3('0x46')],_0x599c45['email']||_0x599c45['Smtp'][_0x1ef3('0x30')]);}if(_0x447bdc[_0x1ef3('0x5e')]['attachments']&&_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa9')][_0x1ef3('0x4d')]){for(var _0x44c147=0x0;_0x44c147<_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa9')][_0x1ef3('0x4d')];_0x44c147+=0x1){_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa9')][_0x44c147]={'filename':_0x447bdc['body']['attachments'][_0x44c147][_0x1ef3('0x46')],'path':path[_0x1ef3('0xaa')](config[_0x1ef3('0xab')],_0x1ef3('0xac'),_0x447bdc['body']['attachments'][_0x44c147][_0x1ef3('0xad')])};}}var _0x46ce76=_0x599c45[_0x1ef3('0xae')]();return respondWithRpcPromise(_0x1ef3('0xaf'),_0x1ef3('0xb0'),{'account':_0x46ce76,'message':_0x447bdc[_0x1ef3('0x5e')]});})[_0x1ef3('0x10')](function(_0xa16f6b){if(!_0xa16f6b)return;_0xd56f32=_0xa16f6b;if(!_0x252ab8[_0x1ef3('0xa2')])throw new Error(_0x1ef3('0xb1'));if(_0x252ab8[_0x1ef3('0xa2')][_0x1ef3('0xa3')]['length'])return _0x252ab8[_0x1ef3('0xa2')][_0x1ef3('0xa3')][0x0];return db[_0x1ef3('0x83')][_0x1ef3('0x68')](_[_0x1ef3('0xb2')](_0x447bdc[_0x1ef3('0x5e')],{'firstName':_0x447bdc['body']['to'],'email':_0x447bdc[_0x1ef3('0x5e')]['to'],'phone':_0x447bdc[_0x1ef3('0x5e')]['to'],'ListId':_0x252ab8[_0x1ef3('0x70')]}));})[_0x1ef3('0x10')](function(_0x14a05d){if(!_0x14a05d)return;var _0x39612b={'UserId':_0x447bdc[_0x1ef3('0x30')]['id'],'ContactId':_0x14a05d['id'],'MailAccountId':_0x252ab8['id'],'inReplyTo':_0xd56f32['messageId'],'to':_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xa7')],'cc':_0x447bdc[_0x1ef3('0x5e')]['cc'],'subject':_0x447bdc['body']['subject'],'attach':_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x1ef3('0x9e')),'lastMsgDirection':_0x1ef3('0xb4'),'Messages':[_[_0x1ef3('0x55')](_0x447bdc[_0x1ef3('0x5e')],{'messageId':_0xd56f32['messageId'],'sentAt':moment()['format'](_0x1ef3('0x9e')),'read':!![],'MailAccountId':_0x252ab8['id'],'UserId':_0x447bdc[_0x1ef3('0x30')]['id'],'ContactId':_0x14a05d['id']})]};if(_0x447bdc[_0x1ef3('0x5e')]['Interaction']){_0x39612b=_[_0x1ef3('0x55')](_0x39612b,_0x447bdc[_0x1ef3('0x5e')][_0x1ef3('0xb5')]);}return db['MailInteraction'][_0x1ef3('0x68')](_0x39612b,{'include':[{'model':db[_0x1ef3('0x9a')],'as':'Messages'}]});})[_0x1ef3('0x10')](respondWithResult(_0xcc362,null))['catch'](handleError(_0xcc362,null));};exports['verifySmtp']=function(_0x5e65cd,_0x1320dc){return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0x5e65cd[_0x1ef3('0x5a')]['id']},'include':[{'model':db[_0x1ef3('0x3e')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1ef3('0xa6'),'raw':!![]}]}]})[_0x1ef3('0x10')](handleEntityNotFound(_0x1320dc,null))[_0x1ef3('0x10')](function(_0x51a279){if(!_0x51a279[_0x1ef3('0x3b')])return;var _0x47f7a9=_0x51a279[_0x1ef3('0xae')]();return respondWithRpcPromise(_0x1ef3('0xb6'),_0x1ef3('0xb7'),{'account':_0x47f7a9});})[_0x1ef3('0x10')](respondWithResult(_0x1320dc,null))[_0x1ef3('0x1b')](handleError(_0x1320dc,null));};exports[_0x1ef3('0x25')]=function(_0x4d6f40,_0x2c8fee){return db[_0x1ef3('0x41')]['find']({'where':{'id':_0x4d6f40[_0x1ef3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2c8fee,null))[_0x1ef3('0x10')](function(_0x2c24ea){if(_0x2c24ea&&_0x2c24ea[_0x1ef3('0x38')]){throw new db[(_0x1ef3('0xb8'))][(_0x1ef3('0xb9'))](_0x1ef3('0xba'));}return _0x2c24ea;})[_0x1ef3('0x10')](removeEntity(_0x2c8fee,null))['catch'](handleError(_0x2c8fee,null));};exports[_0x1ef3('0xbb')]=function(_0x4ff0c3,_0xe787d7){return db[_0x1ef3('0x41')]['find']({'where':{'id':_0x4ff0c3[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0xe787d7,null))[_0x1ef3('0x10')](function(_0x353dad){if(_0x353dad){return _0x353dad[_0x1ef3('0xbb')](_0x4ff0c3[_0x1ef3('0x5e')][_0x1ef3('0x6c')],_[_0x1ef3('0xbc')](_0x4ff0c3[_0x1ef3('0x5e')],[_0x1ef3('0x6c'),'id'])||{})[_0x1ef3('0xbd')](function(_0x45f2f1){for(var _0x15423f=0x0;_0x15423f<_0x4ff0c3[_0x1ef3('0x5e')][_0x1ef3('0x6c')][_0x1ef3('0x4d')];_0x15423f+=0x1){socket['emit'](_0x1ef3('0xbe'),{'UserId':Number(_0x4ff0c3[_0x1ef3('0x5e')]['ids'][_0x15423f]),'MailAccountId':Number(_0x4ff0c3[_0x1ef3('0x5a')]['id'])});}return _0x45f2f1;});}})['then'](respondWithResult(_0xe787d7,null))[_0x1ef3('0x1b')](handleError(_0xe787d7,null));};exports['removeAgents']=function(_0xe9cb0a,_0x2beaed){return db[_0x1ef3('0x41')][_0x1ef3('0x5d')]({'where':{'id':_0xe9cb0a[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x2beaed,null))[_0x1ef3('0x10')](function(_0x5788f3){if(_0x5788f3){return _0x5788f3[_0x1ef3('0xbf')](_0xe9cb0a[_0x1ef3('0x47')][_0x1ef3('0x6c')])[_0x1ef3('0x10')](function(){if(_[_0x1ef3('0xc0')](_0xe9cb0a['query'][_0x1ef3('0x6c')])){for(var _0x42f9cb=0x0;_0x42f9cb<_0xe9cb0a[_0x1ef3('0x47')][_0x1ef3('0x6c')][_0x1ef3('0x4d')];_0x42f9cb+=0x1){socket['emit'](_0x1ef3('0xc1'),{'UserId':Number(_0xe9cb0a['query'][_0x1ef3('0x6c')][_0x42f9cb]),'MailAccountId':Number(_0xe9cb0a[_0x1ef3('0x5a')]['id'])});}}else{socket['emit'](_0x1ef3('0xc1'),{'UserId':Number(_0xe9cb0a[_0x1ef3('0x47')][_0x1ef3('0x6c')]),'MailAccountId':Number(_0xe9cb0a[_0x1ef3('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2beaed,null))['catch'](handleError(_0x2beaed,null));};exports[_0x1ef3('0xc2')]=function(_0x3b0c6c,_0x3a8dc2){var _0x3c94b4={};var _0x2c2ef5={};var _0x3b8c03;var _0x470f9b;return db[_0x1ef3('0x41')][_0x1ef3('0x6a')]({'where':{'id':_0x3b0c6c[_0x1ef3('0x5a')]['id']}})[_0x1ef3('0x10')](handleEntityNotFound(_0x3a8dc2,null))[_0x1ef3('0x10')](function(_0x359f1b){if(_0x359f1b){_0x3b8c03=_0x359f1b;_0x2c2ef5[_0x1ef3('0x44')]=_[_0x1ef3('0x48')](db[_0x1ef3('0x85')]['rawAttributes']);_0x2c2ef5[_0x1ef3('0x47')]=_['keys'](_0x3b0c6c[_0x1ef3('0x47')]);_0x2c2ef5['filters']=_[_0x1ef3('0x4a')](_0x2c2ef5[_0x1ef3('0x44')],_0x2c2ef5[_0x1ef3('0x47')]);_0x3c94b4[_0x1ef3('0x4b')]=_[_0x1ef3('0x4a')](_0x2c2ef5[_0x1ef3('0x44')],qs[_0x1ef3('0x4c')](_0x3b0c6c[_0x1ef3('0x47')][_0x1ef3('0x4c')]));_0x3c94b4[_0x1ef3('0x4b')]=_0x3c94b4[_0x1ef3('0x4b')][_0x1ef3('0x4d')]?_0x3c94b4[_0x1ef3('0x4b')]:_0x2c2ef5[_0x1ef3('0x44')];_0x3c94b4[_0x1ef3('0x50')]=qs[_0x1ef3('0x51')](_0x3b0c6c[_0x1ef3('0x47')][_0x1ef3('0x51')]);_0x3c94b4[_0x1ef3('0x54')]=qs[_0x1ef3('0x49')](_[_0x1ef3('0x52')](_0x3b0c6c[_0x1ef3('0x47')],_0x2c2ef5[_0x1ef3('0x49')]));if(_0x3b0c6c[_0x1ef3('0x47')]['filter']){_0x3c94b4[_0x1ef3('0x54')]=_[_0x1ef3('0x55')](_0x3c94b4[_0x1ef3('0x54')],{'$or':_[_0x1ef3('0x45')](_0x3c94b4['attributes'],function(_0x22ae82){var _0x272071={};_0x272071[_0x22ae82]={'$like':'%'+_0x3b0c6c['query']['filter']+'%'};return _0x272071;})});}_0x3c94b4=_['merge']({},_0x3c94b4,_0x3b0c6c[_0x1ef3('0x5c')]);return _0x3b8c03[_0x1ef3('0xc2')](_0x3c94b4);}})['then'](function(_0x4f1949){if(_0x4f1949){_0x470f9b=_0x4f1949[_0x1ef3('0x4d')];if(!_0x3b0c6c['query'][_0x1ef3('0x4e')](_0x1ef3('0x4f'))){_0x3c94b4[_0x1ef3('0x21')]=qs[_0x1ef3('0x21')](_0x3b0c6c[_0x1ef3('0x47')][_0x1ef3('0x21')]);_0x3c94b4[_0x1ef3('0x22')]=qs[_0x1ef3('0x22')](_0x3b0c6c[_0x1ef3('0x47')]['offset']);}return _0x3b8c03['getAgents'](_0x3c94b4);}})[_0x1ef3('0x10')](function(_0x1353fd){if(_0x1353fd){return _0x1353fd?{'count':_0x470f9b,'rows':_0x1353fd}:null;}})[_0x1ef3('0x10')](respondWithResult(_0x3a8dc2,null))['catch'](handleError(_0x3a8dc2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4e8e8b4..d677c62 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 _0x430c=['update','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x591a7c,_0x41238a){var _0x4ef9c6=function(_0x566317){while(--_0x566317){_0x591a7c['push'](_0x591a7c['shift']());}};_0x4ef9c6(++_0x41238a);}(_0x430c,0x1a1));var _0xc430=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x430c[_0x3e5bc8];return _0xfd84bc;};'use strict';var EventEmitter=require(_0xc430('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc430('0x1')](0x0);var events={'afterCreate':_0xc430('0x2'),'afterUpdate':_0xc430('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f0118){return function(_0x5ccda6,_0x47d8b9,_0x338a82){MailAccountEvents[_0xc430('0x4')](_0x4f0118+':'+_0x5ccda6['id'],_0x5ccda6);MailAccountEvents['emit'](_0x4f0118,_0x5ccda6);_0x338a82(null);};}for(var e in events){if(events[_0xc430('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xc430('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xb1aa=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x772e9c,_0x57852a){var _0x28af15=function(_0x3be88f){while(--_0x3be88f){_0x772e9c['push'](_0x772e9c['shift']());}};_0x28af15(++_0x57852a);}(_0xb1aa,0x159));var _0xab1a=function(_0xcddfd8,_0x77e436){_0xcddfd8=_0xcddfd8-0x0;var _0x216e9c=_0xb1aa[_0xcddfd8];return _0x216e9c;};'use strict';var EventEmitter=require(_0xab1a('0x0'));var MailAccount=require(_0xab1a('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xab1a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab1a('0x3'),'afterDestroy':_0xab1a('0x4')};function emitEvent(_0x26a247){return function(_0x3c224b,_0x2371d3,_0x2649be){MailAccountEvents[_0xab1a('0x5')](_0x26a247+':'+_0x3c224b['id'],_0x3c224b);MailAccountEvents[_0xab1a('0x5')](_0x26a247,_0x3c224b);_0x2649be(null);};}for(var e in events){if(events[_0xab1a('0x6')](e)){var event=events[e];MailAccount[_0xab1a('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1b70a22..3a149c9 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 _0x7bc9=['mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x7bc9,0xe0));var _0x97bc=function(_0x552e69,_0x25fa90){_0x552e69=_0x552e69-0x0;var _0x101352=_0x7bc9[_0x552e69];return _0x101352;};'use strict';var attributes=require(_0x97bc('0x0'));module[_0x97bc('0x1')]=function(_0x36002f){return _0x36002f[_0x97bc('0x2')](_0x97bc('0x3'),attributes,{'tableName':_0x97bc('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x342cbf=this;var _0x53e25f={'id':_0x342cbf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x342cbf[_0x97bc('0x5')]!==_0x97bc('0x6')){_0x53e25f[_0x97bc('0x7')]=_0x342cbf[_0x97bc('0x5')];}else{_0x53e25f[_0x97bc('0x8')]=_0x342cbf['Smtp'][_0x97bc('0x8')];_0x53e25f[_0x97bc('0x9')]=_0x342cbf[_0x97bc('0xa')][_0x97bc('0x9')];_0x53e25f[_0x97bc('0xb')]=_0x342cbf[_0x97bc('0xa')][_0x97bc('0xb')];}if(_0x342cbf[_0x97bc('0xa')][_0x97bc('0xc')]){if(_0x342cbf[_0x97bc('0xa')][_0x97bc('0xd')]){if(!_0x342cbf[_0x97bc('0xa')][_0x97bc('0xe')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x53e25f[_0x97bc('0xf')]={'type':_0x97bc('0x10'),'user':_0x342cbf[_0x97bc('0xa')][_0x97bc('0x11')],'accessToken':_0x342cbf[_0x97bc('0xa')][_0x97bc('0xe')][_0x97bc('0x12')]};}else{_0x53e25f[_0x97bc('0xf')]={'user':_0x342cbf[_0x97bc('0xa')][_0x97bc('0x11')],'pass':_0x342cbf[_0x97bc('0xa')]['pass']};}}return _0x53e25f;}}});}; \ No newline at end of file +var _0x864e=['pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','data5','auth'];(function(_0x2e434e,_0x4cc12b){var _0x23aa62=function(_0x56223b){while(--_0x56223b){_0x2e434e['push'](_0x2e434e['shift']());}};_0x23aa62(++_0x4cc12b);}(_0x864e,0xdd));var _0xe864=function(_0x32639a,_0x5752d8){_0x32639a=_0x32639a-0x0;var _0xf168ac=_0x864e[_0x32639a];return _0xf168ac;};'use strict';var attributes=require(_0xe864('0x0'));module['exports']=function(_0x50f8c6){return _0x50f8c6[_0xe864('0x1')](_0xe864('0x2'),attributes,{'tableName':_0xe864('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3dc6d9=this;var _0x3e8d31={'id':_0x3dc6d9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3dc6d9[_0xe864('0x4')]!==_0xe864('0x5')){_0x3e8d31[_0xe864('0x6')]=_0x3dc6d9['provider'];}else{_0x3e8d31[_0xe864('0x7')]=_0x3dc6d9['Smtp'][_0xe864('0x7')];_0x3e8d31[_0xe864('0x8')]=_0x3dc6d9[_0xe864('0x9')][_0xe864('0x8')];_0x3e8d31['secure']=_0x3dc6d9['Smtp'][_0xe864('0xa')];}if(_0x3dc6d9[_0xe864('0x9')][_0xe864('0xb')]){if(_0x3dc6d9['Smtp'][_0xe864('0xc')]){if(!_0x3dc6d9[_0xe864('0x9')]['CloudProvider'])throw new Error(_0xe864('0xd'));_0x3e8d31['auth']={'type':_0xe864('0xe'),'user':_0x3dc6d9[_0xe864('0x9')][_0xe864('0xf')],'accessToken':_0x3dc6d9[_0xe864('0x9')][_0xe864('0x10')][_0xe864('0x11')]};}else{_0x3e8d31[_0xe864('0x12')]={'user':_0x3dc6d9[_0xe864('0x9')][_0xe864('0xf')],'pass':_0x3dc6d9[_0xe864('0x9')][_0xe864('0x13')]};}}return _0x3e8d31;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 1a67014..7de1167 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 _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(_0xa23777,_0x2a3d0f){var _0x43f949=function(_0x483180){while(--_0x483180){_0xa23777['push'](_0xa23777['shift']());}};_0x43f949(++_0x2a3d0f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x551dd4,_0x180910){_0x551dd4=_0x551dd4-0x0;var _0x56a58e=_0xc2c7[_0x551dd4];return _0x56a58e;};'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 +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(_0xe483f1,_0x4048c2){var _0x239fe7=function(_0x3abca8){while(--_0x3abca8){_0xe483f1['push'](_0xe483f1['shift']());}};_0x239fe7(++_0x4048c2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x568b80,_0x4ee11c){_0x568b80=_0x568b80-0x0;var _0x220fad=_0xc2c7[_0x568b80];return _0x220fad;};'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 6bfdb65..e1ad141 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 _0xe3cf=['length','./mailAccount.events','remove','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3cf,0x16f));var _0xfe3c=function(_0x138528,_0x5ea28a){_0x138528=_0x138528-0x0;var _0x4731dc=_0xe3cf[_0x138528];return _0x4731dc;};'use strict';var MailAccountEvents=require(_0xfe3c('0x0'));var events=['save',_0xfe3c('0x1'),'update'];function createListener(_0x4d8753,_0x5b815f){return function(_0x3dc630){_0x5b815f[_0xfe3c('0x2')](_0x4d8753,_0x3dc630);};}function removeListener(_0x1e474a,_0x32bb6b){return function(){MailAccountEvents[_0xfe3c('0x3')](_0x1e474a,_0x32bb6b);};}exports[_0xfe3c('0x4')]=function(_0x5a0f0c){for(var _0x1ee76c=0x0,_0x140482=events[_0xfe3c('0x5')];_0x1ee76c<_0x140482;_0x1ee76c++){var _0x1bc84a=events[_0x1ee76c];var _0x157da0=createListener('mailAccount:'+_0x1bc84a,_0x5a0f0c);MailAccountEvents['on'](_0x1bc84a,_0x157da0);}}; \ No newline at end of file +var _0x2752=['remove','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2752,0x12b));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x2275('0x0'));var events=['save',_0x2275('0x1'),'update'];function createListener(_0x1ed869,_0x21d56c){return function(_0x3bec2b){_0x21d56c['emit'](_0x1ed869,_0x3bec2b);};}function removeListener(_0x99bef9,_0x1819c1){return function(){MailAccountEvents[_0x2275('0x2')](_0x99bef9,_0x1819c1);};}exports[_0x2275('0x3')]=function(_0x19249d){for(var _0x3bc1b9=0x0,_0x48e596=events[_0x2275('0x4')];_0x3bc1b9<_0x48e596;_0x3bc1b9++){var _0x4ec32f=events[_0x3bc1b9];var _0x565af8=createListener(_0x2275('0x5')+_0x4ec32f,_0x19249d);MailAccountEvents['on'](_0x4ec32f,_0x565af8);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5a6cb0b..1df17c5 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 _0x2c2a=['show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x18fea5,_0x274ce0){var _0x44e062=function(_0x1b8a01){while(--_0x1b8a01){_0x18fea5['push'](_0x18fea5['shift']());}};_0x44e062(++_0x274ce0);}(_0x2c2a,0x1d7));var _0xa2c2=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2c2a[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xa2c2('0x0'));var util=require('util');var path=require(_0xa2c2('0x1'));var timeout=require(_0xa2c2('0x2'));var express=require(_0xa2c2('0x3'));var router=express['Router']();var fs_extra=require(_0xa2c2('0x4'));var auth=require(_0xa2c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa2c2('0x6'));var controller=require('./mailApplication.controller');router[_0xa2c2('0x7')]('/:id',auth[_0xa2c2('0x8')](),controller[_0xa2c2('0x9')]);router[_0xa2c2('0xa')](_0xa2c2('0xb'),auth['isAuthenticated'](),controller[_0xa2c2('0xc')]);router[_0xa2c2('0xd')](_0xa2c2('0xb'),auth[_0xa2c2('0x8')](),controller[_0xa2c2('0xe')]);module[_0xa2c2('0xf')]=router; \ No newline at end of file +var _0x6ee8=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer'];(function(_0x3ebd68,_0x58f53d){var _0x703d21=function(_0x3ea408){while(--_0x3ea408){_0x3ebd68['push'](_0x3ebd68['shift']());}};_0x703d21(++_0x58f53d);}(_0x6ee8,0x1c1));var _0x86ee=function(_0x285c5e,_0x73e8ff){_0x285c5e=_0x285c5e-0x0;var _0x32dd93=_0x6ee8[_0x285c5e];return _0x32dd93;};'use strict';var multer=require(_0x86ee('0x0'));var util=require(_0x86ee('0x1'));var path=require(_0x86ee('0x2'));var timeout=require(_0x86ee('0x3'));var express=require(_0x86ee('0x4'));var router=express['Router']();var fs_extra=require(_0x86ee('0x5'));var auth=require(_0x86ee('0x6'));var interaction=require(_0x86ee('0x7'));var config=require(_0x86ee('0x8'));var controller=require(_0x86ee('0x9'));router[_0x86ee('0xa')](_0x86ee('0xb'),auth[_0x86ee('0xc')](),controller['show']);router[_0x86ee('0xd')](_0x86ee('0xb'),auth[_0x86ee('0xc')](),controller[_0x86ee('0xe')]);router[_0x86ee('0xf')](_0x86ee('0xb'),auth[_0x86ee('0xc')](),controller[_0x86ee('0x10')]);module[_0x86ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 642ae4a..491fc3a 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 _0x3884=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x492ec1,_0x1b62bd){var _0x4cfb7e=function(_0x49408a){while(--_0x49408a){_0x492ec1['push'](_0x492ec1['shift']());}};_0x4cfb7e(++_0x1b62bd);}(_0x3884,0x1c6));var _0x4388=function(_0x2d6533,_0x19f68c){_0x2d6533=_0x2d6533-0x0;var _0x26c12f=_0x3884[_0x2d6533];return _0x26c12f;};'use strict';var Sequelize=require(_0x4388('0x0'));module[_0x4388('0x1')]={'priority':{'type':Sequelize[_0x4388('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4388('0x3')],'allowNull':![],'defaultValue':_0x4388('0x4')},'appdata':{'type':Sequelize[_0x4388('0x5')]()},'description':{'type':Sequelize[_0x4388('0x3')]},'interval':{'type':Sequelize[_0x4388('0x3')],'defaultValue':_0x4388('0x6')}}; \ No newline at end of file +var _0xe47a=['INTEGER','TEXT','STRING','sequelize','exports'];(function(_0x5a6f8d,_0x2dac20){var _0x52712f=function(_0x31810a){while(--_0x31810a){_0x5a6f8d['push'](_0x5a6f8d['shift']());}};_0x52712f(++_0x2dac20);}(_0xe47a,0x152));var _0xae47=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe47a[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xae47('0x0'));module[_0xae47('0x1')]={'priority':{'type':Sequelize[_0xae47('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xae47('0x3')]()},'description':{'type':Sequelize[_0xae47('0x4')]},'interval':{'type':Sequelize[_0xae47('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e3c48d2..dbfa209 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x4c3c44,_0x1219ae){var _0x1a350f=function(_0x57d200){while(--_0x57d200){_0x4c3c44['push'](_0x4c3c44['shift']());}};_0x1a350f(++_0x1219ae);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x2831f6,_0x4c267b){var _0x49323f=function(_0x209523){while(--_0x209523){_0x2831f6['push'](_0x2831f6['shift']());}};_0x49323f(++_0x4c267b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3be913,_0x213c97){_0x3be913=_0x3be913-0x0;var _0x4d64da=_0xf4eb[_0x3be913];return _0x4d64da;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 50f0a4a..2a7af87 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 _0xbc23=['../../config/logger','api','moment','bluebird','path','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','lodash'];(function(_0x3c6e36,_0x765046){var _0x62f89b=function(_0x328095){while(--_0x328095){_0x3c6e36['push'](_0x3c6e36['shift']());}};_0x62f89b(++_0x765046);}(_0xbc23,0xef));var _0x3bc2=function(_0x41e0cb,_0x115f77){_0x41e0cb=_0x41e0cb-0x0;var _0xfe8775=_0xbc23[_0x41e0cb];return _0xfe8775;};'use strict';var _=require(_0x3bc2('0x0'));var util=require('util');var logger=require(_0x3bc2('0x1'))(_0x3bc2('0x2'));var moment=require(_0x3bc2('0x3'));var BPromise=require(_0x3bc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bc2('0x5'));var rimraf=require('rimraf');var config=require(_0x3bc2('0x6'));var attributes=require(_0x3bc2('0x7'));module[_0x3bc2('0x8')]=function(_0x4800e4,_0x533494){return _0x4800e4[_0x3bc2('0x9')]('MailApplication',attributes,{'tableName':_0x3bc2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3bc2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc0b1=['utf8mb4_unicode_ci','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x1a5d0d,_0x4e35f3){var _0x5e0c14=function(_0x152b7b){while(--_0x152b7b){_0x1a5d0d['push'](_0x1a5d0d['shift']());}};_0x5e0c14(++_0x4e35f3);}(_0xc0b1,0x115));var _0x1c0b=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xc0b1[_0x211bc3];return _0x34c9a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c0b('0x0'))(_0x1c0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c0b('0x2'));var fs=require('fs');var path=require(_0x1c0b('0x3'));var rimraf=require(_0x1c0b('0x4'));var config=require(_0x1c0b('0x5'));var attributes=require('./mailApplication.attributes');module[_0x1c0b('0x6')]=function(_0x23210d,_0x170b57){return _0x23210d[_0x1c0b('0x7')](_0x1c0b('0x8'),attributes,{'tableName':_0x1c0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c0b('0xa'),'collate':_0x1c0b('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9cf3025..262ca05 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 _0xdcdb=['error','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0xdcdb,0x139));var _0xbdcd=function(_0xce2826,_0x5bce8c){_0xce2826=_0xce2826-0x0;var _0x91c8aa=_0xdcdb[_0xce2826];return _0x91c8aa;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var moment=require(_0xbdcd('0x2'));var BPromise=require(_0xbdcd('0x3'));var rs=require(_0xbdcd('0x4'));var fs=require('fs');var Redis=require(_0xbdcd('0x5'));var db=require(_0xbdcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdcd('0x7'));var config=require(_0xbdcd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbdcd('0x9')][_0xbdcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475bb2,_0x40fd4c,_0x136a57){return new BPromise(function(_0x2f8f58,_0x3c51ad){return client['request'](_0x475bb2,_0x136a57)[_0xbdcd('0xb')](function(_0x1af650){logger[_0xbdcd('0xc')](_0xbdcd('0xd'),_0x40fd4c,_0xbdcd('0xe'));logger[_0xbdcd('0xf')](_0xbdcd('0x10'),_0x40fd4c,_0xbdcd('0xe'),JSON['stringify'](_0x1af650));if(_0x1af650[_0xbdcd('0x11')]){if(_0x1af650[_0xbdcd('0x11')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x40fd4c,_0x1af650[_0xbdcd('0x11')][_0xbdcd('0x12')]);return _0x3c51ad(_0x1af650[_0xbdcd('0x11')]['message']);}logger[_0xbdcd('0x11')](_0xbdcd('0xd'),_0x40fd4c,_0x1af650['error'][_0xbdcd('0x12')]);return _0x2f8f58(_0x1af650[_0xbdcd('0x11')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x40fd4c,_0xbdcd('0xe'));_0x2f8f58(_0x1af650['result']['message']);}})[_0xbdcd('0x13')](function(_0x47f869){logger[_0xbdcd('0x11')](_0xbdcd('0xd'),_0x40fd4c,_0x47f869);_0x3c51ad(_0x47f869);});});}exports[_0xbdcd('0x14')]=function(_0x5c0121){var _0x57dc6c=this;return new Promise(function(_0x384d5f,_0x2c2ee7){return db[_0xbdcd('0x15')][_0xbdcd('0x16')](_0x5c0121[_0xbdcd('0x17')],{'raw':_0x5c0121[_0xbdcd('0x18')]?_0x5c0121[_0xbdcd('0x18')][_0xbdcd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0121['options']?_0x5c0121[_0xbdcd('0x18')][_0xbdcd('0x1a')]||null:null,'attributes':_0x5c0121[_0xbdcd('0x18')]?_0x5c0121[_0xbdcd('0x18')][_0xbdcd('0x1b')]||null:null,'limit':_0x5c0121[_0xbdcd('0x18')]?_0x5c0121['options'][_0xbdcd('0x1c')]||null:null})[_0xbdcd('0xb')](function(_0x1eeec7){logger[_0xbdcd('0xc')](_0xbdcd('0x14'),_0x5c0121);logger[_0xbdcd('0xf')](_0xbdcd('0x14'),_0x5c0121,JSON[_0xbdcd('0x1d')](_0x1eeec7));_0x384d5f(_0x1eeec7);})[_0xbdcd('0x13')](function(_0x313722){logger['error'](_0xbdcd('0x14'),_0x313722['message'],_0x5c0121);_0x2c2ee7(_0x57dc6c[_0xbdcd('0x11')](0x1f4,_0x313722['message']));});});}; \ No newline at end of file +var _0x6c3e=['options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x2886ff,_0x3f3e89){var _0xd9cd7d=function(_0x6777e1){while(--_0x6777e1){_0x2886ff['push'](_0x2886ff['shift']());}};_0xd9cd7d(++_0x3f3e89);}(_0x6c3e,0x65));var _0xe6c3=function(_0x34fbeb,_0x4f9f9b){_0x34fbeb=_0x34fbeb-0x0;var _0x460778=_0x6c3e[_0x34fbeb];return _0x460778;};'use strict';var _=require(_0xe6c3('0x0'));var util=require('util');var moment=require(_0xe6c3('0x1'));var BPromise=require(_0xe6c3('0x2'));var rs=require(_0xe6c3('0x3'));var fs=require('fs');var Redis=require(_0xe6c3('0x4'));var db=require(_0xe6c3('0x5'))['db'];var utils=require(_0xe6c3('0x6'));var logger=require(_0xe6c3('0x7'))('rpc');var config=require(_0xe6c3('0x8'));var jayson=require(_0xe6c3('0x9'));var client=jayson[_0xe6c3('0xa')][_0xe6c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x372db8,_0x2d1209,_0x3d0e24){return new BPromise(function(_0x421c22,_0x382cc3){return client['request'](_0x372db8,_0x3d0e24)[_0xe6c3('0xc')](function(_0xc5dca2){logger[_0xe6c3('0xd')](_0xe6c3('0xe'),_0x2d1209,_0xe6c3('0xf'));logger[_0xe6c3('0x10')](_0xe6c3('0x11'),_0x2d1209,_0xe6c3('0xf'),JSON['stringify'](_0xc5dca2));if(_0xc5dca2[_0xe6c3('0x12')]){if(_0xc5dca2[_0xe6c3('0x12')][_0xe6c3('0x13')]===0x1f4){logger[_0xe6c3('0x12')]('MailApplication,\x20%s,\x20%s',_0x2d1209,_0xc5dca2[_0xe6c3('0x12')][_0xe6c3('0x14')]);return _0x382cc3(_0xc5dca2[_0xe6c3('0x12')]['message']);}logger[_0xe6c3('0x12')](_0xe6c3('0xe'),_0x2d1209,_0xc5dca2[_0xe6c3('0x12')][_0xe6c3('0x14')]);return _0x421c22(_0xc5dca2[_0xe6c3('0x12')]['message']);}else{logger[_0xe6c3('0xd')](_0xe6c3('0xe'),_0x2d1209,_0xe6c3('0xf'));_0x421c22(_0xc5dca2[_0xe6c3('0x15')][_0xe6c3('0x14')]);}})[_0xe6c3('0x16')](function(_0x4b41b8){logger[_0xe6c3('0x12')](_0xe6c3('0xe'),_0x2d1209,_0x4b41b8);_0x382cc3(_0x4b41b8);});});}exports[_0xe6c3('0x17')]=function(_0x1aca1e){var _0x3ae2d4=this;return new Promise(function(_0x1566dd,_0x378837){return db[_0xe6c3('0x18')][_0xe6c3('0x19')](_0x1aca1e[_0xe6c3('0x1a')],{'raw':_0x1aca1e[_0xe6c3('0x1b')]?_0x1aca1e[_0xe6c3('0x1b')][_0xe6c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1aca1e['options']?_0x1aca1e[_0xe6c3('0x1b')][_0xe6c3('0x1d')]||null:null,'attributes':_0x1aca1e[_0xe6c3('0x1b')]?_0x1aca1e[_0xe6c3('0x1b')][_0xe6c3('0x1e')]||null:null,'limit':_0x1aca1e[_0xe6c3('0x1b')]?_0x1aca1e[_0xe6c3('0x1b')][_0xe6c3('0x1f')]||null:null})[_0xe6c3('0xc')](function(_0x57f674){logger[_0xe6c3('0xd')](_0xe6c3('0x17'),_0x1aca1e);logger[_0xe6c3('0x10')](_0xe6c3('0x17'),_0x1aca1e,JSON['stringify'](_0x57f674));_0x1566dd(_0x57f674);})[_0xe6c3('0x16')](function(_0x58f389){logger[_0xe6c3('0x12')]('UpdateMailApplication',_0x58f389[_0xe6c3('0x14')],_0x1aca1e);_0x378837(_0x3ae2d4[_0xe6c3('0x12')](0x1f4,_0x58f389['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ac51c34..15ef49b 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 _0x0146=['tracked','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','/:id'];(function(_0x1e9d6a,_0x3e5cab){var _0x222bd1=function(_0x3e9c8f){while(--_0x3e9c8f){_0x1e9d6a['push'](_0x1e9d6a['shift']());}};_0x222bd1(++_0x3e5cab);}(_0x0146,0x18c));var _0x6014=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x0146[_0x3f4dd9];return _0x31c54a;};'use strict';var express=require(_0x6014('0x0'));var router=express['Router']();var auth=require(_0x6014('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0x6014('0x2')]('/',auth['isAuthenticated'](),controller[_0x6014('0x3')]);router[_0x6014('0x2')]('/describe',auth['isAuthenticated'](),controller[_0x6014('0x4')]);router[_0x6014('0x2')]('/:id',auth['isAuthenticated'](),controller[_0x6014('0x5')]);router[_0x6014('0x2')](_0x6014('0x6'),auth[_0x6014('0x7')](),controller[_0x6014('0x8')]);router['get'](_0x6014('0x9'),auth[_0x6014('0x7')](),controller[_0x6014('0xa')]);router[_0x6014('0xb')]('/',auth['isAuthenticated'](),controller[_0x6014('0xc')]);router[_0x6014('0xb')](_0x6014('0x6'),auth[_0x6014('0x7')](),controller[_0x6014('0xd')]);router[_0x6014('0xb')](_0x6014('0xe'),auth[_0x6014('0x7')](),interaction['tracked'](_0x6014('0xf'),_0x6014('0x10')),controller[_0x6014('0x11')]);router[_0x6014('0x12')](_0x6014('0x13'),auth[_0x6014('0x7')](),interaction[_0x6014('0x14')](_0x6014('0xf'),_0x6014('0x15')),controller['update']);router[_0x6014('0x16')]('/:id',auth[_0x6014('0x7')](),interaction[_0x6014('0x14')](_0x6014('0xf'),_0x6014('0x17')),controller[_0x6014('0x18')]);router['delete'](_0x6014('0xe'),auth['isAuthenticated'](),controller[_0x6014('0x19')]);module['exports']=router; \ No newline at end of file +var _0x2e88=['index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated'];(function(_0x19f727,_0x28224e){var _0x412836=function(_0x40634f){while(--_0x40634f){_0x19f727['push'](_0x19f727['shift']());}};_0x412836(++_0x28224e);}(_0x2e88,0xeb));var _0x82e8=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x2e88[_0x3b711c];return _0x2685f0;};'use strict';var express=require(_0x82e8('0x0'));var router=express[_0x82e8('0x1')]();var auth=require(_0x82e8('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x82e8('0x3'));router['get']('/',auth[_0x82e8('0x4')](),controller[_0x82e8('0x5')]);router['get'](_0x82e8('0x6'),auth[_0x82e8('0x4')](),controller[_0x82e8('0x7')]);router[_0x82e8('0x8')](_0x82e8('0x9'),auth[_0x82e8('0x4')](),controller[_0x82e8('0xa')]);router['get'](_0x82e8('0xb'),auth['isAuthenticated'](),controller[_0x82e8('0xc')]);router[_0x82e8('0x8')](_0x82e8('0xd'),auth[_0x82e8('0x4')](),controller['download']);router[_0x82e8('0xe')]('/',auth[_0x82e8('0x4')](),controller[_0x82e8('0xf')]);router[_0x82e8('0xe')](_0x82e8('0xb'),auth[_0x82e8('0x4')](),controller[_0x82e8('0x10')]);router[_0x82e8('0xe')](_0x82e8('0x11'),auth[_0x82e8('0x4')](),interaction[_0x82e8('0x12')](_0x82e8('0x13'),_0x82e8('0x14')),controller[_0x82e8('0x15')]);router[_0x82e8('0x16')](_0x82e8('0x9'),auth[_0x82e8('0x4')](),interaction[_0x82e8('0x12')](_0x82e8('0x13'),_0x82e8('0x17')),controller[_0x82e8('0x18')]);router[_0x82e8('0x19')](_0x82e8('0x9'),auth[_0x82e8('0x4')](),interaction[_0x82e8('0x12')](_0x82e8('0x13'),_0x82e8('0x1a')),controller[_0x82e8('0x1b')]);router[_0x82e8('0x19')]('/:id/tags',auth[_0x82e8('0x4')](),controller[_0x82e8('0x1c')]);module[_0x82e8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 79272cf..4dc138c 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 _0xc434=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x46aa44,_0x36a1c2){var _0x54961c=function(_0x6c471f){while(--_0x6c471f){_0x46aa44['push'](_0x46aa44['shift']());}};_0x54961c(++_0x36a1c2);}(_0xc434,0x17a));var _0x4c43=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xc434[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4c43('0x0'));module[_0x4c43('0x1')]={'closed':{'type':Sequelize[_0x4c43('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c43('0x3')]},'disposition':{'type':Sequelize[_0x4c43('0x4')]},'secondDisposition':{'type':Sequelize[_0x4c43('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4c43('0x4')]},'note':{'type':Sequelize[_0x4c43('0x4')]},'inReplyTo':{'type':Sequelize[_0x4c43('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4c43('0x5')](_0x4c43('0x6'))},'subject':{'type':Sequelize[_0x4c43('0x5')]()},'attach':{'type':Sequelize[_0x4c43('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x4c43('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x4c43('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4c43('0x7')]('in',_0x4c43('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c43('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4c43('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4c43('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5eb8=['BOOLEAN','DATE','out','iconv','exports','STRING','TEXT'];(function(_0x212aa5,_0x401838){var _0x5a98b8=function(_0x4b28ec){while(--_0x4b28ec){_0x212aa5['push'](_0x212aa5['shift']());}};_0x5a98b8(++_0x401838);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x1c7b4c,_0x5b85b2){_0x1c7b4c=_0x1c7b4c-0x0;var _0x18daf6=_0x5eb8[_0x1c7b4c];return _0x18daf6;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x85eb('0x0'));module[_0x85eb('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x85eb('0x2')]},'secondDisposition':{'type':Sequelize[_0x85eb('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x85eb('0x2')]},'inReplyTo':{'type':Sequelize[_0x85eb('0x2')](0x1fe)},'to':{'type':Sequelize[_0x85eb('0x2')]},'cc':{'type':Sequelize[_0x85eb('0x3')]('long')},'subject':{'type':Sequelize[_0x85eb('0x3')]()},'attach':{'type':Sequelize[_0x85eb('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x85eb('0x5')]},'substatus':{'type':Sequelize[_0x85eb('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x85eb('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x85eb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x85eb('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x85eb('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4b0e3a3..5605b69 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 _0x72ca=['build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','util','path','ioredis','../../components/parsers/qs','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','json','update','then','destroy','error','name','send','map','MailInteraction','fieldName','key','findAll','query','user','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','create','body','describe','addMessage','ids','omit','findOne','MailMessage','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','Tag','emit','mailInteractionTags:save','removeTags','download','toString','server','tmp','join','files','attachments','push','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','decode','format','headers','Bcc','basename','existsSync','type'];(function(_0xd05c23,_0x1db499){var _0x494807=function(_0x41da14){while(--_0x41da14){_0xd05c23['push'](_0xd05c23['shift']());}};_0x494807(++_0x1db499);}(_0x72ca,0xce));var _0xa72c=function(_0x540a9d,_0x2f375b){_0x540a9d=_0x540a9d-0x0;var _0x211982=_0x72ca[_0x540a9d];return _0x211982;};'use strict';var emlformat=require(_0xa72c('0x0'));var rimraf=require(_0xa72c('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xa72c('0x2'));var path=require(_0xa72c('0x3'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xa72c('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xa72c('0x5'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xa72c('0x6'))['db'];var htmlEntities=require(_0xa72c('0x7'));config[_0xa72c('0x8')]=_[_0xa72c('0x9')](config['redis'],{'host':_0xa72c('0xa'),'port':0x18eb});var socket=require(_0xa72c('0xb'))(new Redis(config[_0xa72c('0x8')]));require('./mailInteraction.socket')[_0xa72c('0xc')](socket);function respondWithStatusCode(_0x2f5029,_0x4b1b77){_0x4b1b77=_0x4b1b77||0xcc;return function(_0x20d9ef){if(_0x20d9ef){return _0x2f5029[_0xa72c('0xd')](_0x4b1b77);}return _0x2f5029[_0xa72c('0xe')](_0x4b1b77)[_0xa72c('0xf')]();};}function respondWithResult(_0x4a7121,_0xf710fd){_0xf710fd=_0xf710fd||0xc8;return function(_0x36608f){if(_0x36608f){return _0x4a7121['status'](_0xf710fd)['json'](_0x36608f);}};}function respondWithFilteredResult(_0x54351c,_0x1f7e9f){return function(_0xca1aca){if(_0xca1aca){var _0x2e236b=typeof _0x1f7e9f[_0xa72c('0x10')]===_0xa72c('0x11')&&typeof _0x1f7e9f[_0xa72c('0x12')]===_0xa72c('0x11');var _0x57283b=_0xca1aca['count'];var _0x56d4c1=_0x2e236b?0x0:_0x1f7e9f[_0xa72c('0x10')];var _0x391ac7=_0x2e236b?_0xca1aca[_0xa72c('0x13')]:_0x1f7e9f[_0xa72c('0x10')]+_0x1f7e9f[_0xa72c('0x12')];var _0x1e543;if(_0x391ac7>=_0x57283b){_0x391ac7=_0x57283b;_0x1e543=0xc8;}else{_0x1e543=0xce;}_0x54351c[_0xa72c('0xe')](_0x1e543);return _0x54351c['set']('Content-Range',_0x56d4c1+'-'+_0x391ac7+'/'+_0x57283b)[_0xa72c('0x14')](_0xca1aca);}return null;};}function saveUpdates(_0xe6c346){return function(_0x374998){if(_0x374998){return _0x374998[_0xa72c('0x15')](_0xe6c346)[_0xa72c('0x16')](function(_0x32d52b){return _0x32d52b;});}return null;};}function removeEntity(_0x12387d){return function(_0x28190c){if(_0x28190c){return _0x28190c[_0xa72c('0x17')]()[_0xa72c('0x16')](function(){_0x12387d[_0xa72c('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x192702){return function(_0x187709){if(!_0x187709){_0x192702[_0xa72c('0xd')](0x194);}return _0x187709;};}function handleError(_0x42f466,_0x5ecc85){_0x5ecc85=_0x5ecc85||0x1f4;return function(_0x308153){logger[_0xa72c('0x18')](_0x308153['stack']);if(_0x308153[_0xa72c('0x19')]){delete _0x308153[_0xa72c('0x19')];}_0x42f466[_0xa72c('0xe')](_0x5ecc85)[_0xa72c('0x1a')](_0x308153);};}exports['index']=function(_0x2f17a6,_0x1e40c3){var _0x472ba4={};var _0x56e048=_[_0xa72c('0x1b')](db[_0xa72c('0x1c')]['rawAttributes'],function(_0x290af4){return{'name':_0x290af4[_0xa72c('0x1d')],'type':_0x290af4['type'][_0xa72c('0x1e')]};});_0x472ba4=qs['getOptions'](_0x56e048,_0x2f17a6);return interaction[_0xa72c('0x1f')]('mail',_0x2f17a6[_0xa72c('0x20')],_0x2f17a6[_0xa72c('0x21')],_0x472ba4,_0x56e048)[_0xa72c('0x16')](respondWithFilteredResult(_0x1e40c3,_0x472ba4))['catch'](handleError(_0x1e40c3,null));};exports[_0xa72c('0x22')]=function(_0x2af9f4,_0x177877){var _0x4e4531={'raw':![],'where':{'id':_0x2af9f4[_0xa72c('0x23')]['id']}},_0xd6145f={};_0xd6145f[_0xa72c('0x24')]=_[_0xa72c('0x25')](db[_0xa72c('0x1c')][_0xa72c('0x26')]);_0xd6145f['query']=_[_0xa72c('0x25')](_0x2af9f4[_0xa72c('0x20')]);_0xd6145f[_0xa72c('0x27')]=_[_0xa72c('0x28')](_0xd6145f['model'],_0xd6145f[_0xa72c('0x20')]);_0x4e4531['attributes']=_[_0xa72c('0x28')](_0xd6145f[_0xa72c('0x24')],qs[_0xa72c('0x29')](_0x2af9f4[_0xa72c('0x20')]['fields']));_0x4e4531[_0xa72c('0x2a')]=_0x4e4531['attributes'][_0xa72c('0x2b')]?_0x4e4531[_0xa72c('0x2a')]:_0xd6145f['model'];if(_0x2af9f4[_0xa72c('0x20')][_0xa72c('0x2c')]){_0x4e4531[_0xa72c('0x2d')]=[{'all':!![]}];}_0x4e4531=_['merge']({},_0x4e4531,_0x2af9f4[_0xa72c('0x2e')]);return db[_0xa72c('0x1c')][_0xa72c('0x2f')](_0x4e4531)[_0xa72c('0x16')](handleEntityNotFound(_0x177877,null))['then'](respondWithResult(_0x177877,null))[_0xa72c('0x30')](handleError(_0x177877,null));};exports[_0xa72c('0x31')]=function(_0x5f3f26,_0x57e1da){return db[_0xa72c('0x1c')][_0xa72c('0x31')](_0x5f3f26[_0xa72c('0x32')],{})['then'](respondWithResult(_0x57e1da,0xc9))['catch'](handleError(_0x57e1da,null));};exports[_0xa72c('0x15')]=function(_0x136d32,_0x2de7a9){if(_0x136d32['body']['id']){delete _0x136d32[_0xa72c('0x32')]['id'];}return db['MailInteraction'][_0xa72c('0x2f')]({'where':{'id':_0x136d32[_0xa72c('0x23')]['id']}})[_0xa72c('0x16')](handleEntityNotFound(_0x2de7a9,null))[_0xa72c('0x16')](saveUpdates(_0x136d32[_0xa72c('0x32')],null))[_0xa72c('0x16')](respondWithResult(_0x2de7a9,null))[_0xa72c('0x30')](handleError(_0x2de7a9,null));};exports[_0xa72c('0x17')]=function(_0x3b6fe7,_0x170360){return db['MailInteraction'][_0xa72c('0x2f')]({'where':{'id':_0x3b6fe7[_0xa72c('0x23')]['id']}})[_0xa72c('0x16')](handleEntityNotFound(_0x170360,null))['then'](removeEntity(_0x170360,null))[_0xa72c('0x30')](handleError(_0x170360,null));};exports[_0xa72c('0x33')]=function(_0x52659a,_0x3a75d3){return db['MailInteraction']['describe']()[_0xa72c('0x16')](respondWithResult(_0x3a75d3,null))[_0xa72c('0x30')](handleError(_0x3a75d3,null));};exports[_0xa72c('0x34')]=function(_0xb820c3,_0x59ef7e){return db['MailMessage'][_0xa72c('0x2f')]({'where':{'id':_0xb820c3[_0xa72c('0x23')]['id']}})['then'](handleEntityNotFound(_0x59ef7e,null))[_0xa72c('0x16')](function(_0x3e0189){if(_0x3e0189){return _0x3e0189[_0xa72c('0x34')](_0xb820c3['body'][_0xa72c('0x35')],_[_0xa72c('0x36')](_0xb820c3['body'],[_0xa72c('0x35'),'id'])||{});}})['then'](respondWithResult(_0x59ef7e,null))[_0xa72c('0x30')](handleError(_0x59ef7e,null));};exports['getMessages']=function(_0x184a6c,_0x201541){var _0x49916c={'raw':![],'where':{}};var _0x3ebfab={};var _0xc086af={'count':0x0,'rows':[]};return db[_0xa72c('0x1c')][_0xa72c('0x37')]({'where':{'id':_0x184a6c[_0xa72c('0x23')]['id']}})['then'](handleEntityNotFound(_0x201541,null))[_0xa72c('0x16')](function(_0x4d3c00){if(_0x4d3c00){_0x3ebfab[_0xa72c('0x24')]=_[_0xa72c('0x25')](db[_0xa72c('0x38')][_0xa72c('0x26')]);_0x3ebfab['query']=_[_0xa72c('0x25')](_0x184a6c[_0xa72c('0x20')]);_0x3ebfab[_0xa72c('0x27')]=_['intersection'](_0x3ebfab['model'],_0x3ebfab[_0xa72c('0x20')]);_0x49916c[_0xa72c('0x2a')]=_['intersection'](_0x3ebfab[_0xa72c('0x24')],qs[_0xa72c('0x29')](_0x184a6c['query'][_0xa72c('0x29')]));_0x49916c[_0xa72c('0x2a')]=_0x49916c[_0xa72c('0x2a')][_0xa72c('0x2b')]?_0x49916c[_0xa72c('0x2a')]:_0x3ebfab[_0xa72c('0x24')];if(!_0x184a6c[_0xa72c('0x20')]['hasOwnProperty']('nolimit')){_0x49916c[_0xa72c('0x12')]=qs[_0xa72c('0x12')](_0x184a6c[_0xa72c('0x20')][_0xa72c('0x12')]);_0x49916c['offset']=qs[_0xa72c('0x10')](_0x184a6c['query'][_0xa72c('0x10')]);}_0x49916c['order']=qs[_0xa72c('0x39')](_0x184a6c['query'][_0xa72c('0x39')]);_0x49916c[_0xa72c('0x3a')]=qs['filters'](_[_0xa72c('0x3b')](_0x184a6c[_0xa72c('0x20')],_0x3ebfab['filters']));_0x49916c[_0xa72c('0x3a')][_0xa72c('0x3c')]=_0x4d3c00['id'];if(_0x184a6c[_0xa72c('0x20')][_0xa72c('0x3d')]){_0x49916c['where']=_['merge'](_0x49916c[_0xa72c('0x3a')],{'$or':_[_0xa72c('0x1b')](_0x49916c[_0xa72c('0x2a')],function(_0x356cdf){var _0x4fc77e={};_0x4fc77e[_0x356cdf]={'$like':'%'+_0x184a6c[_0xa72c('0x20')][_0xa72c('0x3d')]+'%'};return _0x4fc77e;})});}if(_0x184a6c[_0xa72c('0x20')][_0xa72c('0x3e')]){var _0x478255=_0x184a6c[_0xa72c('0x20')][_0xa72c('0x3e')][_0xa72c('0x3f')](',');var _0x23dc3e={};_0x23dc3e[_0x478255[0x0]]={'$gte':moment(_0x478255[0x1])['format'](_0xa72c('0x40'))};_0x49916c[_0xa72c('0x3a')]=_['merge'](_0x49916c[_0xa72c('0x3a')],_0x23dc3e);}_0x49916c=_['merge']({},_0x49916c,_0x184a6c[_0xa72c('0x2e')]);return db[_0xa72c('0x38')]['count']({'where':_0x49916c['where']})[_0xa72c('0x16')](function(_0x1ccc1a){_0xc086af['count']=_0x1ccc1a;if(_0x184a6c[_0xa72c('0x20')][_0xa72c('0x2c')]){_0x49916c[_0xa72c('0x2d')]=[{'all':!![]}];}return db[_0xa72c('0x38')]['findAll'](_0x49916c);})[_0xa72c('0x16')](function(_0x379ee3){if(_0x184a6c[_0xa72c('0x20')][_0xa72c('0x41')]==='true'){for(var _0x9ce0cf=0x0;_0x9ce0cf<_0x379ee3[_0xa72c('0x2b')];_0x9ce0cf++){_0x379ee3[_0x9ce0cf][_0xa72c('0x32')]=juice(_0x379ee3[_0x9ce0cf][_0xa72c('0x32')]);}}_0xc086af[_0xa72c('0x42')]=_0x379ee3;return _0xc086af;});}})[_0xa72c('0x16')](respondWithFilteredResult(_0x201541,_0x49916c))['catch'](handleError(_0x201541,null));};exports[_0xa72c('0x43')]=function(_0x267fb3,_0x3ece10){return db[_0xa72c('0x1c')][_0xa72c('0x2f')]({'where':{'id':_0x267fb3[_0xa72c('0x23')]['id']}})[_0xa72c('0x16')](handleEntityNotFound(_0x3ece10,null))[_0xa72c('0x16')](function(_0x20a638){if(_0x20a638){return _0x20a638['setTags'](_0x267fb3[_0xa72c('0x32')][_0xa72c('0x35')],_[_0xa72c('0x36')](_0x267fb3['body'],[_0xa72c('0x35'),'id'])||{})['spread'](function(){return db[_0xa72c('0x44')][_0xa72c('0x1f')]({'attributes':['id',_0xa72c('0x19'),'color'],'where':{'id':_0x267fb3[_0xa72c('0x32')]['ids']}});})[_0xa72c('0x16')](function(_0x292ce0){socket[_0xa72c('0x45')](_0xa72c('0x46'),{'id':Number(_0x267fb3[_0xa72c('0x23')]['id']),'tags':_0x292ce0||[]});return{'id':Number(_0x267fb3[_0xa72c('0x23')]['id']),'tags':_0x292ce0||[]};});}})[_0xa72c('0x16')](respondWithResult(_0x3ece10,null))['catch'](handleError(_0x3ece10,null));};exports['removeTags']=function(_0x5c218c,_0x47b89e){return db['MailInteraction'][_0xa72c('0x2f')]({'where':{'id':_0x5c218c[_0xa72c('0x23')]['id']}})[_0xa72c('0x16')](handleEntityNotFound(_0x47b89e,null))['then'](function(_0x592bac){if(_0x592bac){return _0x592bac[_0xa72c('0x47')](_0x5c218c[_0xa72c('0x20')][_0xa72c('0x35')]);}})['then'](respondWithStatusCode(_0x47b89e,null))[_0xa72c('0x30')](handleError(_0x47b89e,null));};exports[_0xa72c('0x48')]=function(_0x3888c6,_0x24ebfa){var _0xb2829d=moment()['unix']()[_0xa72c('0x49')]();var _0x3b5f1d=path['join'](config['root'],_0xa72c('0x4a'),'files',_0xa72c('0x4b'));var _0x70d56d=path[_0xa72c('0x4c')](config['root'],_0xa72c('0x4a'),_0xa72c('0x4d'),_0xa72c('0x4e'));var _0x2a9a85=path['join'](_0x3b5f1d,_0xb2829d);var _0x10cc5a=util['format']('transcript-%d-%s.zip',_0x3888c6[_0xa72c('0x23')]['id'],_0xb2829d);var _0x1c04b2=path[_0xa72c('0x4c')](_0x3b5f1d,_0x10cc5a);var _0x45b32c=[];if(_0x3888c6[_0xa72c('0x20')][_0xa72c('0x4e')]){_0x45b32c[_0xa72c('0x4f')]({'model':db[_0xa72c('0x50')],'as':_0xa72c('0x51'),'raw':!![]});}var _0x26ea90=[{'model':db[_0xa72c('0x38')],'as':_0xa72c('0x52'),'attributes':['id',_0xa72c('0x32'),'from','to','cc',_0xa72c('0x53'),_0xa72c('0x54'),_0xa72c('0x55')],'where':{'secret':![]},'order':qs[_0xa72c('0x39')]('id'),'include':_0x45b32c}];return db[_0xa72c('0x1c')][_0xa72c('0x2f')]({'where':{'id':_0x3888c6[_0xa72c('0x23')]['id']},'include':_0x26ea90})[_0xa72c('0x16')](handleEntityNotFound(_0x24ebfa,null))['then'](function(_0x2d6ea1){if(_0x2d6ea1&&_0x2d6ea1['Messages']){var _0x43521d=_0x2d6ea1[_0xa72c('0x56')]({'plain':!![]});fs[_0xa72c('0x57')](_0x2a9a85);return BPromise[_0xa72c('0x58')](_0x43521d[_0xa72c('0x52')],function(_0x35e7dc,_0x5e8a41){var _0xaec1cd={'from':_0x35e7dc[_0xa72c('0x59')],'to':_0x35e7dc['to']||'missing.recipient@your.company.com','subject':_0x35e7dc['subject'],'html':htmlEntities[_0xa72c('0x5a')](_0x35e7dc[_0xa72c('0x32')]),'headers':{'Date':moment(_0x35e7dc[_0xa72c('0x55')])[_0xa72c('0x5b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x35e7dc['cc']){_0xaec1cd[_0xa72c('0x5c')]['Cc']=_0x35e7dc['cc'];}if(_0x35e7dc[_0xa72c('0x53')]){_0xaec1cd['headers'][_0xa72c('0x5d')]=_0x35e7dc[_0xa72c('0x53')];}return new BPromise(function(_0x581751,_0x4cd283){if(_0x35e7dc['Attachments']){for(var _0x4ad30f=0x0;_0x4ad30f<_0x35e7dc[_0xa72c('0x51')][_0xa72c('0x2b')];_0x4ad30f++){var _0x5911af=_0x35e7dc[_0xa72c('0x51')][_0x4ad30f];var _0x2c50be=path[_0xa72c('0x4c')](_0x70d56d,_0x5911af[_0xa72c('0x5e')]);if(fs[_0xa72c('0x5f')](_0x2c50be)){_0xaec1cd['attachments'][_0xa72c('0x4f')]({'name':_0x5911af[_0xa72c('0x19')],'contentType':_0x5911af[_0xa72c('0x60')],'data':fs['readFileSync'](_0x2c50be)});}}}emlformat[_0xa72c('0x61')](_0xaec1cd,function(_0x2669d0,_0x1f6985){if(_0x2669d0)return _0x4cd283(_0x2669d0);fs[_0xa72c('0x62')](path[_0xa72c('0x4c')](_0x2a9a85,util[_0xa72c('0x5b')](_0xa72c('0x63'),_0x5e8a41)),_0x1f6985);return _0x581751(_0x1f6985);});});})['then'](function(){return new BPromise(function(_0x3019ae,_0x1ab506){zipdir(_0x2a9a85,{'saveTo':_0x1c04b2},function(_0x2f91b8,_0x5204e1){if(_0x2f91b8)return _0x1ab506(_0x2f91b8);return _0x3019ae(_0x5204e1);});})[_0xa72c('0x16')](function(){return new BPromise(function(_0x27c42f,_0x5c1b5b){rimraf(_0x2a9a85,function(_0x529655){if(_0x529655)_0x5c1b5b(_0x529655);return _0x27c42f();});});})['then'](function(){return _0x24ebfa[_0xa72c('0x48')](_0x1c04b2,_0x10cc5a,function(_0x887925){if(!_0x887925)fs[_0xa72c('0x64')](_0x1c04b2);});});});}else{return _0x24ebfa['sendStatus'](0xc8);}})[_0xa72c('0x30')](handleError(_0x24ebfa,null));}; \ No newline at end of file +var _0x8bb7=['map','MailInteraction','fieldName','type','key','mail','query','user','catch','show','model','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','keys','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','join','root','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','bcc','createdAt','get','missing.recipient@your.company.com','subject','decode','headers','Bcc','basename','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','index'];(function(_0x3a0a14,_0x3a1216){var _0x2844ee=function(_0x35cc97){while(--_0x35cc97){_0x3a0a14['push'](_0x3a0a14['shift']());}};_0x2844ee(++_0x3a1216);}(_0x8bb7,0x127));var _0x78bb=function(_0x2ef3ba,_0x3e025f){_0x2ef3ba=_0x2ef3ba-0x0;var _0xe4282e=_0x8bb7[_0x2ef3ba];return _0xe4282e;};'use strict';var emlformat=require(_0x78bb('0x0'));var rimraf=require(_0x78bb('0x1'));var zipdir=require('zip-dir');var moment=require(_0x78bb('0x2'));var BPromise=require(_0x78bb('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x78bb('0x4'));var juice=require(_0x78bb('0x5'));var Redis=require(_0x78bb('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x78bb('0x7'));var logger=require(_0x78bb('0x8'))(_0x78bb('0x9'));var config=require(_0x78bb('0xa'));var db=require(_0x78bb('0xb'))['db'];var htmlEntities=require(_0x78bb('0xc'));config[_0x78bb('0xd')]=_['defaults'](config[_0x78bb('0xd')],{'host':_0x78bb('0xe'),'port':0x18eb});var socket=require(_0x78bb('0xf'))(new Redis(config[_0x78bb('0xd')]));require(_0x78bb('0x10'))[_0x78bb('0x11')](socket);function respondWithStatusCode(_0x359ea8,_0x3cccf9){_0x3cccf9=_0x3cccf9||0xcc;return function(_0x2da233){if(_0x2da233){return _0x359ea8['sendStatus'](_0x3cccf9);}return _0x359ea8[_0x78bb('0x12')](_0x3cccf9)['end']();};}function respondWithResult(_0x48f583,_0x3bfa99){_0x3bfa99=_0x3bfa99||0xc8;return function(_0x46c923){if(_0x46c923){return _0x48f583['status'](_0x3bfa99)[_0x78bb('0x13')](_0x46c923);}};}function respondWithFilteredResult(_0x259f9d,_0x5a64d6){return function(_0x26c88f){if(_0x26c88f){var _0x1c27ec=typeof _0x5a64d6[_0x78bb('0x14')]===_0x78bb('0x15')&&typeof _0x5a64d6[_0x78bb('0x16')]==='undefined';var _0x3f954f=_0x26c88f[_0x78bb('0x17')];var _0x1c25da=_0x1c27ec?0x0:_0x5a64d6[_0x78bb('0x14')];var _0x474f0b=_0x1c27ec?_0x26c88f['count']:_0x5a64d6[_0x78bb('0x14')]+_0x5a64d6[_0x78bb('0x16')];var _0x22f18b;if(_0x474f0b>=_0x3f954f){_0x474f0b=_0x3f954f;_0x22f18b=0xc8;}else{_0x22f18b=0xce;}_0x259f9d[_0x78bb('0x12')](_0x22f18b);return _0x259f9d[_0x78bb('0x18')](_0x78bb('0x19'),_0x1c25da+'-'+_0x474f0b+'/'+_0x3f954f)[_0x78bb('0x13')](_0x26c88f);}return null;};}function saveUpdates(_0x83cd7f){return function(_0x384a68){if(_0x384a68){return _0x384a68[_0x78bb('0x1a')](_0x83cd7f)['then'](function(_0x228f62){return _0x228f62;});}return null;};}function removeEntity(_0x3930ef){return function(_0x436cf2){if(_0x436cf2){return _0x436cf2[_0x78bb('0x1b')]()[_0x78bb('0x1c')](function(){_0x3930ef[_0x78bb('0x12')](0xcc)[_0x78bb('0x1d')]();});}};}function handleEntityNotFound(_0x189ade){return function(_0x9af7b3){if(!_0x9af7b3){_0x189ade[_0x78bb('0x1e')](0x194);}return _0x9af7b3;};}function handleError(_0x44ee62,_0x1ec342){_0x1ec342=_0x1ec342||0x1f4;return function(_0x49d23e){logger[_0x78bb('0x1f')](_0x49d23e[_0x78bb('0x20')]);if(_0x49d23e[_0x78bb('0x21')]){delete _0x49d23e[_0x78bb('0x21')];}_0x44ee62['status'](_0x1ec342)['send'](_0x49d23e);};}exports[_0x78bb('0x22')]=function(_0x5180a0,_0x5b87a0){var _0x103594={};var _0x34ebf7=_[_0x78bb('0x23')](db[_0x78bb('0x24')]['rawAttributes'],function(_0x431776){return{'name':_0x431776[_0x78bb('0x25')],'type':_0x431776[_0x78bb('0x26')][_0x78bb('0x27')]};});_0x103594=qs['getOptions'](_0x34ebf7,_0x5180a0);return interaction['findAll'](_0x78bb('0x28'),_0x5180a0[_0x78bb('0x29')],_0x5180a0[_0x78bb('0x2a')],_0x103594,_0x34ebf7)['then'](respondWithFilteredResult(_0x5b87a0,_0x103594))[_0x78bb('0x2b')](handleError(_0x5b87a0,null));};exports[_0x78bb('0x2c')]=function(_0x285782,_0x5f3ca2){var _0x1e6383={'raw':![],'where':{'id':_0x285782['params']['id']}},_0x300dea={};_0x300dea[_0x78bb('0x2d')]=_['keys'](db[_0x78bb('0x24')][_0x78bb('0x2e')]);_0x300dea[_0x78bb('0x29')]=_['keys'](_0x285782[_0x78bb('0x29')]);_0x300dea[_0x78bb('0x2f')]=_[_0x78bb('0x30')](_0x300dea[_0x78bb('0x2d')],_0x300dea['query']);_0x1e6383[_0x78bb('0x31')]=_[_0x78bb('0x30')](_0x300dea[_0x78bb('0x2d')],qs[_0x78bb('0x32')](_0x285782['query'][_0x78bb('0x32')]));_0x1e6383[_0x78bb('0x31')]=_0x1e6383[_0x78bb('0x31')][_0x78bb('0x33')]?_0x1e6383['attributes']:_0x300dea[_0x78bb('0x2d')];if(_0x285782[_0x78bb('0x29')][_0x78bb('0x34')]){_0x1e6383[_0x78bb('0x35')]=[{'all':!![]}];}_0x1e6383=_[_0x78bb('0x36')]({},_0x1e6383,_0x285782[_0x78bb('0x37')]);return db['MailInteraction'][_0x78bb('0x38')](_0x1e6383)[_0x78bb('0x1c')](handleEntityNotFound(_0x5f3ca2,null))['then'](respondWithResult(_0x5f3ca2,null))[_0x78bb('0x2b')](handleError(_0x5f3ca2,null));};exports[_0x78bb('0x39')]=function(_0x5b340b,_0x408c65){return db['MailInteraction'][_0x78bb('0x39')](_0x5b340b[_0x78bb('0x3a')],{})[_0x78bb('0x1c')](respondWithResult(_0x408c65,0xc9))['catch'](handleError(_0x408c65,null));};exports[_0x78bb('0x1a')]=function(_0x1e3f92,_0x5f1af0){if(_0x1e3f92[_0x78bb('0x3a')]['id']){delete _0x1e3f92['body']['id'];}return db['MailInteraction'][_0x78bb('0x38')]({'where':{'id':_0x1e3f92[_0x78bb('0x3b')]['id']}})[_0x78bb('0x1c')](handleEntityNotFound(_0x5f1af0,null))['then'](saveUpdates(_0x1e3f92[_0x78bb('0x3a')],null))[_0x78bb('0x1c')](respondWithResult(_0x5f1af0,null))[_0x78bb('0x2b')](handleError(_0x5f1af0,null));};exports[_0x78bb('0x1b')]=function(_0x7b67fd,_0x543dd0){return db[_0x78bb('0x24')][_0x78bb('0x38')]({'where':{'id':_0x7b67fd[_0x78bb('0x3b')]['id']}})['then'](handleEntityNotFound(_0x543dd0,null))[_0x78bb('0x1c')](removeEntity(_0x543dd0,null))['catch'](handleError(_0x543dd0,null));};exports[_0x78bb('0x3c')]=function(_0x4b4993,_0x5ee52e){return db[_0x78bb('0x24')]['describe']()[_0x78bb('0x1c')](respondWithResult(_0x5ee52e,null))[_0x78bb('0x2b')](handleError(_0x5ee52e,null));};exports[_0x78bb('0x3d')]=function(_0x9281b4,_0x2fb924){return db[_0x78bb('0x3e')][_0x78bb('0x38')]({'where':{'id':_0x9281b4[_0x78bb('0x3b')]['id']}})[_0x78bb('0x1c')](handleEntityNotFound(_0x2fb924,null))[_0x78bb('0x1c')](function(_0x40574c){if(_0x40574c){return _0x40574c[_0x78bb('0x3d')](_0x9281b4[_0x78bb('0x3a')][_0x78bb('0x3f')],_[_0x78bb('0x40')](_0x9281b4[_0x78bb('0x3a')],['ids','id'])||{});}})['then'](respondWithResult(_0x2fb924,null))['catch'](handleError(_0x2fb924,null));};exports[_0x78bb('0x41')]=function(_0x8d17e0,_0x2eef0f){var _0x592c45={'raw':![],'where':{}};var _0x2263b={};var _0x1efade={'count':0x0,'rows':[]};return db[_0x78bb('0x24')]['findOne']({'where':{'id':_0x8d17e0[_0x78bb('0x3b')]['id']}})[_0x78bb('0x1c')](handleEntityNotFound(_0x2eef0f,null))['then'](function(_0x21fdb6){if(_0x21fdb6){_0x2263b[_0x78bb('0x2d')]=_[_0x78bb('0x42')](db[_0x78bb('0x3e')][_0x78bb('0x2e')]);_0x2263b[_0x78bb('0x29')]=_['keys'](_0x8d17e0[_0x78bb('0x29')]);_0x2263b[_0x78bb('0x2f')]=_[_0x78bb('0x30')](_0x2263b[_0x78bb('0x2d')],_0x2263b[_0x78bb('0x29')]);_0x592c45[_0x78bb('0x31')]=_[_0x78bb('0x30')](_0x2263b[_0x78bb('0x2d')],qs[_0x78bb('0x32')](_0x8d17e0['query']['fields']));_0x592c45[_0x78bb('0x31')]=_0x592c45[_0x78bb('0x31')][_0x78bb('0x33')]?_0x592c45[_0x78bb('0x31')]:_0x2263b['model'];if(!_0x8d17e0[_0x78bb('0x29')][_0x78bb('0x43')](_0x78bb('0x44'))){_0x592c45[_0x78bb('0x16')]=qs['limit'](_0x8d17e0[_0x78bb('0x29')]['limit']);_0x592c45[_0x78bb('0x14')]=qs[_0x78bb('0x14')](_0x8d17e0[_0x78bb('0x29')][_0x78bb('0x14')]);}_0x592c45[_0x78bb('0x45')]=qs[_0x78bb('0x46')](_0x8d17e0[_0x78bb('0x29')][_0x78bb('0x46')]);_0x592c45[_0x78bb('0x47')]=qs[_0x78bb('0x2f')](_['pick'](_0x8d17e0[_0x78bb('0x29')],_0x2263b[_0x78bb('0x2f')]));_0x592c45['where'][_0x78bb('0x48')]=_0x21fdb6['id'];if(_0x8d17e0[_0x78bb('0x29')][_0x78bb('0x49')]){_0x592c45[_0x78bb('0x47')]=_['merge'](_0x592c45['where'],{'$or':_[_0x78bb('0x23')](_0x592c45[_0x78bb('0x31')],function(_0x23cef9){var _0x401512={};_0x401512[_0x23cef9]={'$like':'%'+_0x8d17e0[_0x78bb('0x29')][_0x78bb('0x49')]+'%'};return _0x401512;})});}if(_0x8d17e0[_0x78bb('0x29')]['$gte']){var _0x3182b4=_0x8d17e0['query']['$gte'][_0x78bb('0x4a')](',');var _0x115489={};_0x115489[_0x3182b4[0x0]]={'$gte':moment(_0x3182b4[0x1])[_0x78bb('0x4b')](_0x78bb('0x4c'))};_0x592c45[_0x78bb('0x47')]=_[_0x78bb('0x36')](_0x592c45[_0x78bb('0x47')],_0x115489);}_0x592c45=_[_0x78bb('0x36')]({},_0x592c45,_0x8d17e0['options']);return db['MailMessage'][_0x78bb('0x17')]({'where':_0x592c45[_0x78bb('0x47')]})[_0x78bb('0x1c')](function(_0xe85750){_0x1efade['count']=_0xe85750;if(_0x8d17e0[_0x78bb('0x29')]['includeAll']){_0x592c45[_0x78bb('0x35')]=[{'all':!![]}];}return db['MailMessage'][_0x78bb('0x4d')](_0x592c45);})['then'](function(_0x14db04){if(_0x8d17e0[_0x78bb('0x29')]['inlineCss']==='true'){for(var _0x21d466=0x0;_0x21d466<_0x14db04['length'];_0x21d466++){_0x14db04[_0x21d466]['body']=juice(_0x14db04[_0x21d466]['body']);}}_0x1efade[_0x78bb('0x4e')]=_0x14db04;return _0x1efade;});}})[_0x78bb('0x1c')](respondWithFilteredResult(_0x2eef0f,_0x592c45))[_0x78bb('0x2b')](handleError(_0x2eef0f,null));};exports[_0x78bb('0x4f')]=function(_0x355e73,_0x526cd2){return db[_0x78bb('0x24')][_0x78bb('0x38')]({'where':{'id':_0x355e73[_0x78bb('0x3b')]['id']}})[_0x78bb('0x1c')](handleEntityNotFound(_0x526cd2,null))[_0x78bb('0x1c')](function(_0x3ef9b5){if(_0x3ef9b5){return _0x3ef9b5[_0x78bb('0x50')](_0x355e73[_0x78bb('0x3a')][_0x78bb('0x3f')],_[_0x78bb('0x40')](_0x355e73['body'],[_0x78bb('0x3f'),'id'])||{})['spread'](function(){return db[_0x78bb('0x51')]['findAll']({'attributes':['id',_0x78bb('0x21'),_0x78bb('0x52')],'where':{'id':_0x355e73[_0x78bb('0x3a')][_0x78bb('0x3f')]}});})[_0x78bb('0x1c')](function(_0x13a1d9){socket[_0x78bb('0x53')](_0x78bb('0x54'),{'id':Number(_0x355e73[_0x78bb('0x3b')]['id']),'tags':_0x13a1d9||[]});return{'id':Number(_0x355e73[_0x78bb('0x3b')]['id']),'tags':_0x13a1d9||[]};});}})[_0x78bb('0x1c')](respondWithResult(_0x526cd2,null))[_0x78bb('0x2b')](handleError(_0x526cd2,null));};exports[_0x78bb('0x55')]=function(_0xc6d210,_0x23076b){return db['MailInteraction']['find']({'where':{'id':_0xc6d210[_0x78bb('0x3b')]['id']}})[_0x78bb('0x1c')](handleEntityNotFound(_0x23076b,null))[_0x78bb('0x1c')](function(_0x5f1e04){if(_0x5f1e04){return _0x5f1e04[_0x78bb('0x55')](_0xc6d210['query']['ids']);}})[_0x78bb('0x1c')](respondWithStatusCode(_0x23076b,null))['catch'](handleError(_0x23076b,null));};exports[_0x78bb('0x56')]=function(_0x280e24,_0x2c26e9){var _0xcccb2e=moment()['unix']()['toString']();var _0x99cb45=path[_0x78bb('0x57')](config[_0x78bb('0x58')],'server',_0x78bb('0x59'),_0x78bb('0x5a'));var _0x3ed57a=path[_0x78bb('0x57')](config[_0x78bb('0x58')],'server',_0x78bb('0x59'),'attachments');var _0x1703b1=path[_0x78bb('0x57')](_0x99cb45,_0xcccb2e);var _0x41f2d6=util[_0x78bb('0x4b')](_0x78bb('0x5b'),_0x280e24[_0x78bb('0x3b')]['id'],_0xcccb2e);var _0x449a4b=path['join'](_0x99cb45,_0x41f2d6);var _0x58293a=[];if(_0x280e24[_0x78bb('0x29')][_0x78bb('0x5c')]){_0x58293a['push']({'model':db[_0x78bb('0x5d')],'as':_0x78bb('0x5e'),'raw':!![]});}var _0x280abb=[{'model':db[_0x78bb('0x3e')],'as':_0x78bb('0x5f'),'attributes':['id','body',_0x78bb('0x60'),'to','cc',_0x78bb('0x61'),'subject',_0x78bb('0x62')],'where':{'secret':![]},'order':qs[_0x78bb('0x46')]('id'),'include':_0x58293a}];return db[_0x78bb('0x24')][_0x78bb('0x38')]({'where':{'id':_0x280e24[_0x78bb('0x3b')]['id']},'include':_0x280abb})[_0x78bb('0x1c')](handleEntityNotFound(_0x2c26e9,null))['then'](function(_0x14c9c6){if(_0x14c9c6&&_0x14c9c6[_0x78bb('0x5f')]){var _0x575375=_0x14c9c6[_0x78bb('0x63')]({'plain':!![]});fs['mkdirSync'](_0x1703b1);return BPromise['each'](_0x575375['Messages'],function(_0x285b48,_0x7cd569){var _0x5a4e04={'from':_0x285b48['from'],'to':_0x285b48['to']||_0x78bb('0x64'),'subject':_0x285b48[_0x78bb('0x65')],'html':htmlEntities[_0x78bb('0x66')](_0x285b48['body']),'headers':{'Date':moment(_0x285b48[_0x78bb('0x62')])[_0x78bb('0x4b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x285b48['cc']){_0x5a4e04[_0x78bb('0x67')]['Cc']=_0x285b48['cc'];}if(_0x285b48[_0x78bb('0x61')]){_0x5a4e04[_0x78bb('0x67')][_0x78bb('0x68')]=_0x285b48['bcc'];}return new BPromise(function(_0x5e8b55,_0x2e3f82){if(_0x285b48[_0x78bb('0x5e')]){for(var _0x45bab8=0x0;_0x45bab8<_0x285b48[_0x78bb('0x5e')][_0x78bb('0x33')];_0x45bab8++){var _0x117487=_0x285b48[_0x78bb('0x5e')][_0x45bab8];var _0x25065d=path[_0x78bb('0x57')](_0x3ed57a,_0x117487[_0x78bb('0x69')]);if(fs['existsSync'](_0x25065d)){_0x5a4e04[_0x78bb('0x5c')]['push']({'name':_0x117487[_0x78bb('0x21')],'contentType':_0x117487[_0x78bb('0x26')],'data':fs[_0x78bb('0x6a')](_0x25065d)});}}}emlformat[_0x78bb('0x6b')](_0x5a4e04,function(_0x7baa45,_0x133967){if(_0x7baa45)return _0x2e3f82(_0x7baa45);fs[_0x78bb('0x6c')](path[_0x78bb('0x57')](_0x1703b1,util['format']('message%d.eml',_0x7cd569)),_0x133967);return _0x5e8b55(_0x133967);});});})[_0x78bb('0x1c')](function(){return new BPromise(function(_0x29f001,_0x29e02a){zipdir(_0x1703b1,{'saveTo':_0x449a4b},function(_0xb20d25,_0x45fa46){if(_0xb20d25)return _0x29e02a(_0xb20d25);return _0x29f001(_0x45fa46);});})[_0x78bb('0x1c')](function(){return new BPromise(function(_0x576a71,_0x14581f){rimraf(_0x1703b1,function(_0x45259a){if(_0x45259a)_0x14581f(_0x45259a);return _0x576a71();});});})[_0x78bb('0x1c')](function(){return _0x2c26e9[_0x78bb('0x56')](_0x449a4b,_0x41f2d6,function(_0x49f882){if(!_0x49f882)fs[_0x78bb('0x6d')](_0x449a4b);});});});}else{return _0x2c26e9[_0x78bb('0x1e')](0xc8);}})[_0x78bb('0x2b')](handleError(_0x2c26e9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7fd727e..2bd71b0 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 _0x7afa=['map','findAll','length','emit','hasOwnProperty','hook','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','getUsers','then','setDataValue','Users'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7afa,0x186));var _0xa7af=function(_0x36af0b,_0x4eb90b){_0x36af0b=_0x36af0b-0x0;var _0x3b938e=_0x7afa[_0x36af0b];return _0x3b938e;};'use strict';var EventEmitter=require(_0xa7af('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xa7af('0x1')];var MailMessage=require(_0xa7af('0x2'))['db'][_0xa7af('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa7af('0x4')](0x0);var events={'afterCreate':_0xa7af('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x148295){return function(_0x20efed,_0x27657a,_0x401583){_0x20efed[_0xa7af('0x6')]({'attributes':['id'],'raw':!![]})[_0xa7af('0x7')](function(_0x40f0c9){_0x20efed[_0xa7af('0x8')](_0xa7af('0x9'),_0x40f0c9[_0xa7af('0xa')](function(_0x4cdb26){return{'id':_0x4cdb26['id']};}));return MailMessage[_0xa7af('0xb')]({'where':{'MailInteractionId':_0x20efed['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa7af('0x7')](function(_0x5df4b){_0x20efed[_0xa7af('0x8')]('unreadMessages',_0x5df4b[_0xa7af('0xc')]);MailInteractionEvents[_0xa7af('0xd')](_0x148295+':'+_0x20efed['id'],_0x20efed);MailInteractionEvents[_0xa7af('0xd')](_0x148295,_0x20efed);_0x401583(null);})['catch'](_0x401583(null));};}for(var e in events){if(events[_0xa7af('0xe')](e)){var event=events[e];MailInteraction[_0xa7af('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xd95e=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x45a0fd,_0x3ca156){var _0x39b69e=function(_0x42ba8c){while(--_0x42ba8c){_0x45a0fd['push'](_0x45a0fd['shift']());}};_0x39b69e(++_0x3ca156);}(_0xd95e,0xa3));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xed95('0x0'));var MailInteraction=require(_0xed95('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xed95('0x1'))['db'][_0xed95('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xed95('0x3')](0x0);var events={'afterCreate':_0xed95('0x4'),'afterUpdate':_0xed95('0x5'),'afterDestroy':_0xed95('0x6')};function emitEvent(_0x1a34d8){return function(_0x52c808,_0x30abcc,_0x5ad1f5){_0x52c808[_0xed95('0x7')]({'attributes':['id'],'raw':!![]})[_0xed95('0x8')](function(_0x183bf2){_0x52c808[_0xed95('0x9')](_0xed95('0xa'),_0x183bf2['map'](function(_0x56d1f7){return{'id':_0x56d1f7['id']};}));return MailMessage[_0xed95('0xb')]({'where':{'MailInteractionId':_0x52c808['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed95('0x8')](function(_0x6b32ca){_0x52c808[_0xed95('0x9')]('unreadMessages',_0x6b32ca[_0xed95('0xc')]);MailInteractionEvents[_0xed95('0xd')](_0x1a34d8+':'+_0x52c808['id'],_0x52c808);MailInteractionEvents[_0xed95('0xd')](_0x1a34d8,_0x52c808);_0x5ad1f5(null);})[_0xed95('0xe')](_0x5ad1f5(null));};}for(var e in events){if(events[_0xed95('0xf')](e)){var event=events[e];MailInteraction[_0xed95('0x10')](e,emitEvent(event));}}module[_0xed95('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b83293e..456a013 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 _0x288c=['../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','changed','format','models','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x7ba55e,_0x311902){var _0x461281=function(_0xba19c){while(--_0xba19c){_0x7ba55e['push'](_0x7ba55e['shift']());}};_0x461281(++_0x311902);}(_0x288c,0x9b));var _0xc288=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0x288c[_0xa041de];return _0x1d654c;};'use strict';var _=require(_0xc288('0x0'));var util=require(_0xc288('0x1'));var logger=require(_0xc288('0x2'))('api');var moment=require(_0xc288('0x3'));var BPromise=require(_0xc288('0x4'));var rp=require(_0xc288('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc288('0x6'));var attributes=require(_0xc288('0x7'));module['exports']=function(_0xf33f08,_0x43de05){return _0xf33f08[_0xc288('0x8')](_0xc288('0x9'),attributes,{'tableName':_0xc288('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xc288('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44c6c9,_0x57c298,_0x2762e1){if(_0x44c6c9[_0xc288('0xc')]){_0x44c6c9[_0xc288('0xd')]=moment()['format'](_0xc288('0xe'));}if(_0x44c6c9[_0xc288('0xf')]){_0x44c6c9['closedAt']=moment()['format'](_0xc288('0xe'));}_0x2762e1(null,_0x57c298);},'beforeUpdate':function(_0x4b04b2,_0xa7b8f0,_0x466032){if(_0x4b04b2[_0xc288('0x10')](_0xc288('0xc'))){_0x4b04b2[_0xc288('0xd')]=_0x4b04b2[_0xc288('0xc')]?moment()[_0xc288('0x11')](_0xc288('0xe')):null;}if(_0x4b04b2[_0xc288('0x10')]('closed')){_0x4b04b2['closedAt']=moment()[_0xc288('0x11')](_0xc288('0xe'));_0x4b04b2[_0xc288('0xc')]=null;_0x4b04b2['substatusAt']=null;}_0x466032(null,_0x4b04b2);},'afterUpdate':function(_0xd1f5c9,_0x1eaa65,_0x16d6e0){var _0x51e653=_0xf33f08[_0xc288('0x12')];var _0x304c10=_0xd1f5c9['get']({'plain':!![]});if(_0x304c10['closed']){return _0x51e653[_0xc288('0x13')][_0xc288('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x304c10['id']}})[_0xc288('0x15')](function(){_0x16d6e0();})['catch'](function(_0x449225){_0x16d6e0(_0x449225);});}else{_0x16d6e0();}}},'charset':'utf8mb4','collate':_0xc288('0x16')});}; \ No newline at end of file +var _0xc972=['MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','substatus','models','get','closed','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define'];(function(_0x25a76c,_0x13e507){var _0x1215c0=function(_0xa7ae72){while(--_0xa7ae72){_0x25a76c['push'](_0x25a76c['shift']());}};_0x1215c0(++_0x13e507);}(_0xc972,0xdd));var _0x2c97=function(_0x3f7039,_0x308064){_0x3f7039=_0x3f7039-0x0;var _0x30b322=_0xc972[_0x3f7039];return _0x30b322;};'use strict';var _=require('lodash');var util=require(_0x2c97('0x0'));var logger=require(_0x2c97('0x1'))(_0x2c97('0x2'));var moment=require('moment');var BPromise=require(_0x2c97('0x3'));var rp=require(_0x2c97('0x4'));var fs=require('fs');var path=require(_0x2c97('0x5'));var rimraf=require(_0x2c97('0x6'));var config=require(_0x2c97('0x7'));var attributes=require(_0x2c97('0x8'));module[_0x2c97('0x9')]=function(_0x262183,_0x88259a){return _0x262183[_0x2c97('0xa')](_0x2c97('0xb'),attributes,{'tableName':_0x2c97('0xc'),'paranoid':![],'indexes':[{'name':_0x2c97('0xd'),'fields':['subject','to'],'type':_0x2c97('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a5afe,_0xae9eac,_0x2a862b){if(_0x5a5afe['substatus']){_0x5a5afe[_0x2c97('0xf')]=moment()['format'](_0x2c97('0x10'));}if(_0x5a5afe['closed']){_0x5a5afe[_0x2c97('0x11')]=moment()[_0x2c97('0x12')](_0x2c97('0x10'));}_0x2a862b(null,_0xae9eac);},'beforeUpdate':function(_0x4ba288,_0x2574bd,_0x4ea669){if(_0x4ba288[_0x2c97('0x13')](_0x2c97('0x14'))){_0x4ba288[_0x2c97('0xf')]=_0x4ba288[_0x2c97('0x14')]?moment()[_0x2c97('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4ba288['changed']('closed')){_0x4ba288['closedAt']=moment()['format'](_0x2c97('0x10'));_0x4ba288[_0x2c97('0x14')]=null;_0x4ba288[_0x2c97('0xf')]=null;}_0x4ea669(null,_0x4ba288);},'afterUpdate':function(_0x49df3e,_0x271077,_0x400797){var _0x4f248c=_0x262183[_0x2c97('0x15')];var _0x5d8807=_0x49df3e[_0x2c97('0x16')]({'plain':!![]});if(_0x5d8807[_0x2c97('0x17')]){return _0x4f248c[_0x2c97('0x18')][_0x2c97('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5d8807['id']}})[_0x2c97('0x1a')](function(){_0x400797();})['catch'](function(_0x89a469){_0x400797(_0x89a469);});}else{_0x400797();}}},'charset':_0x2c97('0x1b'),'collate':_0x2c97('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5ae863c..007fb55 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 _0xd47c=['result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info'];(function(_0x5cfd3a,_0x11a19d){var _0x646a43=function(_0x1962f8){while(--_0x1962f8){_0x5cfd3a['push'](_0x5cfd3a['shift']());}};_0x646a43(++_0x11a19d);}(_0xd47c,0x195));var _0xcd47=function(_0x2b04bc,_0x46f30a){_0x2b04bc=_0x2b04bc-0x0;var _0xa426c7=_0xd47c[_0x2b04bc];return _0xa426c7;};'use strict';var _=require('lodash');var util=require(_0xcd47('0x0'));var moment=require(_0xcd47('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd47('0x2'));var fs=require('fs');var Redis=require(_0xcd47('0x3'));var db=require(_0xcd47('0x4'))['db'];var utils=require(_0xcd47('0x5'));var logger=require(_0xcd47('0x6'))(_0xcd47('0x7'));var config=require(_0xcd47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcd47('0x9')]['http']({'port':0x232a});config[_0xcd47('0xa')]=_[_0xcd47('0xb')](config[_0xcd47('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd47('0xc'))(new Redis(config[_0xcd47('0xa')]));require(_0xcd47('0xd'))[_0xcd47('0xe')](socket);function respondWithRpcPromise(_0x1e0706,_0x25626e,_0x1cb4ed){return new BPromise(function(_0x3a2248,_0x1ac842){return client['request'](_0x1e0706,_0x1cb4ed)[_0xcd47('0xf')](function(_0x5437e5){logger['info']('MailInteraction,\x20%s,\x20%s',_0x25626e,_0xcd47('0x10'));logger[_0xcd47('0x11')](_0xcd47('0x12'),_0x25626e,_0xcd47('0x10'),JSON[_0xcd47('0x13')](_0x5437e5));if(_0x5437e5[_0xcd47('0x14')]){if(_0x5437e5[_0xcd47('0x14')][_0xcd47('0x15')]===0x1f4){logger[_0xcd47('0x14')](_0xcd47('0x16'),_0x25626e,_0x5437e5[_0xcd47('0x14')][_0xcd47('0x17')]);return _0x1ac842(_0x5437e5[_0xcd47('0x14')][_0xcd47('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x25626e,_0x5437e5[_0xcd47('0x14')][_0xcd47('0x17')]);return _0x3a2248(_0x5437e5[_0xcd47('0x14')][_0xcd47('0x17')]);}else{logger[_0xcd47('0x18')](_0xcd47('0x16'),_0x25626e,_0xcd47('0x10'));_0x3a2248(_0x5437e5[_0xcd47('0x19')]['message']);}})['catch'](function(_0x4d1b54){logger[_0xcd47('0x14')](_0xcd47('0x16'),_0x25626e,_0x4d1b54);_0x1ac842(_0x4d1b54);});});}exports[_0xcd47('0x1a')]=function(_0x170c38){var _0x42ec8f=this;return new Promise(function(_0x152d88,_0x4e307f){return db[_0xcd47('0x1b')][_0xcd47('0x1c')](_0x170c38['body'],{'raw':_0x170c38[_0xcd47('0x1d')]?_0x170c38[_0xcd47('0x1d')][_0xcd47('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170c38['options']?_0x170c38[_0xcd47('0x1d')][_0xcd47('0x1f')]||null:null,'attributes':_0x170c38[_0xcd47('0x1d')]?_0x170c38[_0xcd47('0x1d')][_0xcd47('0x20')]||null:null,'limit':_0x170c38[_0xcd47('0x1d')]?_0x170c38[_0xcd47('0x1d')][_0xcd47('0x21')]||null:null})[_0xcd47('0xf')](function(_0x4cc56b){logger[_0xcd47('0x18')](_0xcd47('0x1a'),_0x170c38);logger['debug'](_0xcd47('0x1a'),_0x170c38,JSON[_0xcd47('0x13')](_0x4cc56b));_0x152d88(_0x4cc56b);})[_0xcd47('0x22')](function(_0x109748){logger[_0xcd47('0x14')]('UpdateMailInteraction',_0x109748[_0xcd47('0x17')],_0x170c38);_0x4e307f(_0x42ec8f[_0xcd47('0x14')](0x1f4,_0x109748[_0xcd47('0x17')]));});});};exports[_0xcd47('0x23')]=function(_0x50d6d8){return new Promise(function(_0x5b67b7,_0x447f90){return db['MailInteraction'][_0xcd47('0x24')]({'where':_0x50d6d8[_0xcd47('0x1d')]?_0x50d6d8['options'][_0xcd47('0x1f')]||null:null})[_0xcd47('0xf')](function(_0x1da082){if(_0x1da082){return _0x1da082[_0xcd47('0x25')](_0x50d6d8[_0xcd47('0x26')][_0xcd47('0x27')],_[_0xcd47('0x28')](_0x50d6d8[_0xcd47('0x26')],[_0xcd47('0x27'),'id'])||{});}})[_0xcd47('0x29')](function(_0x13b00b){logger[_0xcd47('0x18')](_0xcd47('0x2a'),_0x50d6d8);logger[_0xcd47('0x11')](_0xcd47('0x2a'),_0x50d6d8,JSON['stringify'](_0x13b00b));_0x5b67b7(_0x13b00b);})['catch'](function(_0x10de85){logger[_0xcd47('0x14')](_0xcd47('0x2a'),_0x10de85[_0xcd47('0x17')],_0x50d6d8);_0x447f90(_this[_0xcd47('0x14')](0x1f4,_0x10de85[_0xcd47('0x17')]));});});}; \ No newline at end of file +var _0xd4ad=['request\x20sent','debug','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','options','where','limit','then','addTags','body','ids','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','./mailInteraction.socket','register','request','info'];(function(_0x570ca1,_0x15face){var _0x2a4833=function(_0x7f0a7b){while(--_0x7f0a7b){_0x570ca1['push'](_0x570ca1['shift']());}};_0x2a4833(++_0x15face);}(_0xd4ad,0x158));var _0xdd4a=function(_0x51ba11,_0xe5d691){_0x51ba11=_0x51ba11-0x0;var _0x2d6cab=_0xd4ad[_0x51ba11];return _0x2d6cab;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var moment=require(_0xdd4a('0x2'));var BPromise=require(_0xdd4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd4a('0x4'));var db=require(_0xdd4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd4a('0x6'));var config=require(_0xdd4a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x8')]['http']({'port':0x232a});config[_0xdd4a('0x9')]=_[_0xdd4a('0xa')](config['redis'],{'host':_0xdd4a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd4a('0x9')]));require(_0xdd4a('0xc'))[_0xdd4a('0xd')](socket);function respondWithRpcPromise(_0x1bb817,_0x23e1dc,_0x934dff){return new BPromise(function(_0x4de3d5,_0x521e0d){return client[_0xdd4a('0xe')](_0x1bb817,_0x934dff)['then'](function(_0x11d422){logger[_0xdd4a('0xf')]('MailInteraction,\x20%s,\x20%s',_0x23e1dc,_0xdd4a('0x10'));logger[_0xdd4a('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x23e1dc,_0xdd4a('0x10'),JSON['stringify'](_0x11d422));if(_0x11d422[_0xdd4a('0x12')]){if(_0x11d422['error'][_0xdd4a('0x13')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x23e1dc,_0x11d422[_0xdd4a('0x12')]['message']);return _0x521e0d(_0x11d422['error']['message']);}logger[_0xdd4a('0x12')](_0xdd4a('0x14'),_0x23e1dc,_0x11d422[_0xdd4a('0x12')][_0xdd4a('0x15')]);return _0x4de3d5(_0x11d422[_0xdd4a('0x12')][_0xdd4a('0x15')]);}else{logger[_0xdd4a('0xf')](_0xdd4a('0x14'),_0x23e1dc,'request\x20sent');_0x4de3d5(_0x11d422[_0xdd4a('0x16')][_0xdd4a('0x15')]);}})['catch'](function(_0x2aaf26){logger[_0xdd4a('0x12')]('MailInteraction,\x20%s,\x20%s',_0x23e1dc,_0x2aaf26);_0x521e0d(_0x2aaf26);});});}exports[_0xdd4a('0x17')]=function(_0x2d690a){var _0x3eb13e=this;return new Promise(function(_0x2cb507,_0x46a9ba){return db[_0xdd4a('0x18')][_0xdd4a('0x19')](_0x2d690a['body'],{'raw':_0x2d690a['options']?_0x2d690a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d690a[_0xdd4a('0x1a')]?_0x2d690a[_0xdd4a('0x1a')][_0xdd4a('0x1b')]||null:null,'attributes':_0x2d690a[_0xdd4a('0x1a')]?_0x2d690a[_0xdd4a('0x1a')]['attributes']||null:null,'limit':_0x2d690a[_0xdd4a('0x1a')]?_0x2d690a[_0xdd4a('0x1a')][_0xdd4a('0x1c')]||null:null})[_0xdd4a('0x1d')](function(_0x574050){logger['info']('UpdateMailInteraction',_0x2d690a);logger['debug'](_0xdd4a('0x17'),_0x2d690a,JSON['stringify'](_0x574050));_0x2cb507(_0x574050);})['catch'](function(_0x26846d){logger[_0xdd4a('0x12')](_0xdd4a('0x17'),_0x26846d[_0xdd4a('0x15')],_0x2d690a);_0x46a9ba(_0x3eb13e[_0xdd4a('0x12')](0x1f4,_0x26846d[_0xdd4a('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x29ca5c){return new Promise(function(_0x3baba8,_0x540597){return db[_0xdd4a('0x18')]['find']({'where':_0x29ca5c[_0xdd4a('0x1a')]?_0x29ca5c[_0xdd4a('0x1a')][_0xdd4a('0x1b')]||null:null})[_0xdd4a('0x1d')](function(_0x4e35b8){if(_0x4e35b8){return _0x4e35b8[_0xdd4a('0x1e')](_0x29ca5c[_0xdd4a('0x1f')][_0xdd4a('0x20')],_['omit'](_0x29ca5c[_0xdd4a('0x1f')],['ids','id'])||{});}})[_0xdd4a('0x21')](function(_0x36ee4e){logger[_0xdd4a('0xf')]('AddTags',_0x29ca5c);logger[_0xdd4a('0x11')](_0xdd4a('0x22'),_0x29ca5c,JSON['stringify'](_0x36ee4e));_0x3baba8(_0x36ee4e);})[_0xdd4a('0x23')](function(_0x456627){logger['error'](_0xdd4a('0x22'),_0x456627['message'],_0x29ca5c);_0x540597(_this[_0xdd4a('0x12')](0x1f4,_0x456627[_0xdd4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 35cd76d..ac1b8b6 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 _0x758f=['remove','update','emit','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x758f,0x1ef));var _0xf758=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x758f[_0x4eab61];return _0x342426;};'use strict';var MailInteractionEvents=require(_0xf758('0x0'));var events=[_0xf758('0x1'),_0xf758('0x2'),_0xf758('0x3')];function createListener(_0x279655,_0x475a0e){return function(_0x2761ea){_0x475a0e[_0xf758('0x4')](_0x279655,_0x2761ea);};}function removeListener(_0x119815,_0x41c7e1){return function(){MailInteractionEvents['removeListener'](_0x119815,_0x41c7e1);};}exports['register']=function(_0x40fdb4){for(var _0x16138e=0x0,_0x445cf5=events[_0xf758('0x5')];_0x16138e<_0x445cf5;_0x16138e++){var _0x701eec=events[_0x16138e];var _0x1feac8=createListener(_0xf758('0x6')+_0x701eec,_0x40fdb4);MailInteractionEvents['on'](_0x701eec,_0x1feac8);}}; \ No newline at end of file +var _0x4d55=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x26e606,_0xf6d86e){var _0x4b346e=function(_0x397e25){while(--_0x397e25){_0x26e606['push'](_0x26e606['shift']());}};_0x4b346e(++_0xf6d86e);}(_0x4d55,0x97));var _0x54d5=function(_0x3ae767,_0x1fab25){_0x3ae767=_0x3ae767-0x0;var _0x166836=_0x4d55[_0x3ae767];return _0x166836;};'use strict';var MailInteractionEvents=require(_0x54d5('0x0'));var events=[_0x54d5('0x1'),_0x54d5('0x2'),'update'];function createListener(_0x4297c4,_0x338af9){return function(_0x51bb0e){_0x338af9['emit'](_0x4297c4,_0x51bb0e);};}function removeListener(_0x3d6359,_0x2ade25){return function(){MailInteractionEvents[_0x54d5('0x3')](_0x3d6359,_0x2ade25);};}exports[_0x54d5('0x4')]=function(_0x398f6f){for(var _0x33cab2=0x0,_0x55a363=events[_0x54d5('0x5')];_0x33cab2<_0x55a363;_0x33cab2++){var _0x4ff3b8=events[_0x33cab2];var _0x4efe8a=createListener(_0x54d5('0x6')+_0x4ff3b8,_0x398f6f);MailInteractionEvents['on'](_0x4ff3b8,_0x4efe8a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cd65cb5..0c4e0a5 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 _0x0102=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./mailMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x0102,0x186));var _0x2010=function(_0x533edd,_0x568707){_0x533edd=_0x533edd-0x0;var _0x5c7f20=_0x0102[_0x533edd];return _0x5c7f20;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file +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','mail','create','put'];(function(_0x57bfbd,_0x417539){var _0x3f6776=function(_0x4f2bc0){while(--_0x4f2bc0){_0x57bfbd['push'](_0x57bfbd['shift']());}};_0x3f6776(++_0x417539);}(_0xbee3,0xd5));var _0x3bee=function(_0x598672,_0x3f34f1){_0x598672=_0x598672-0x0;var _0x9ffe56=_0xbee3[_0x598672];return _0x9ffe56;};'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('./mailMessage.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'),'mailmessage: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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7d9c695..32c7769 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 _0xbe4c=['long','BOOLEAN','out','STRING','DATE','Email','sequelize','exports','TEXT'];(function(_0x3a8bbc,_0x3a572d){var _0x5e9f39=function(_0x12ba2b){while(--_0x12ba2b){_0x3a8bbc['push'](_0x3a8bbc['shift']());}};_0x5e9f39(++_0x3a572d);}(_0xbe4c,0x15c));var _0xcbe4=function(_0x5810af,_0x5afba2){_0x5810af=_0x5810af-0x0;var _0x2e4739=_0xbe4c[_0x5810af];return _0x2e4739;};'use strict';var Sequelize=require(_0xcbe4('0x0'));var _=require('lodash');module[_0xcbe4('0x1')]={'body':{'type':Sequelize[_0xcbe4('0x2')](_0xcbe4('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcbe4('0x2')]('medium')},'read':{'type':Sequelize[_0xcbe4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcbe4('0x5')),'defaultValue':_0xcbe4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcbe4('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xcbe4('0x2')](_0xcbe4('0x3'))},'cc':{'type':Sequelize[_0xcbe4('0x2')](_0xcbe4('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xcbe4('0x3'))},'subject':{'type':Sequelize[_0xcbe4('0x2')]},'sentAt':{'type':Sequelize[_0xcbe4('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcbe4('0x7')]},'originTo':{'type':Sequelize[_0xcbe4('0x2')](_0xcbe4('0x3'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM'](_0xcbe4('0x8'),'Chat'),'defaultValue':_0xcbe4('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x5b0f=['out','STRING','DATE','INTEGER','Email','Chat','lodash','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5b0f,0xde));var _0xf5b0=function(_0x3adbfa,_0x9ff21d){_0x3adbfa=_0x3adbfa-0x0;var _0x31d08f=_0x5b0f[_0x3adbfa];return _0x31d08f;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf5b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x3'))},'read':{'type':Sequelize[_0xf5b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf5b0('0x5')]('in',_0xf5b0('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xf5b0('0x7')]},'to':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x2'))},'cc':{'type':Sequelize[_0xf5b0('0x1')]('long')},'bcc':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xf5b0('0x8')]},'attach':{'type':Sequelize[_0xf5b0('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf5b0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x2'))},'originCc':{'type':Sequelize[_0xf5b0('0x1')](_0xf5b0('0x2'))},'originChannel':{'type':Sequelize['ENUM'](_0xf5b0('0xa'),_0xf5b0('0xb')),'defaultValue':_0xf5b0('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 09cd8d5..210d626 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 _0x3e9b=['toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','offset','undefined','limit','count','status','set','Content-Range','json','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','update','body','describe','create','out','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','internal','rejectmessage'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x3e9b,0xb5));var _0xb3e9=function(_0x45e8c6,_0x33eb6b){_0x45e8c6=_0x45e8c6-0x0;var _0x296738=_0x3e9b[_0x45e8c6];return _0x296738;};'use strict';var emlformat=require(_0xb3e9('0x0'));var moment=require(_0xb3e9('0x1'));var BPromise=require(_0xb3e9('0x2'));var util=require(_0xb3e9('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xb3e9('0x4'));var Redis=require(_0xb3e9('0x5'));var htmlToText=require('html-to-text');var qs=require(_0xb3e9('0x6'));var logger=require(_0xb3e9('0x7'))(_0xb3e9('0x8'));var interaction_log=require('../../config/logger')(_0xb3e9('0x9'));var config=require(_0xb3e9('0xa'));var db=require(_0xb3e9('0xb'))['db'];config['redis']=_[_0xb3e9('0xc')](config[_0xb3e9('0xd')],{'host':_0xb3e9('0xe'),'port':0x18eb});var socket=require(_0xb3e9('0xf'))(new Redis(config[_0xb3e9('0xd')]));var htmlEntities=require('html-entities');require(_0xb3e9('0x10'))[_0xb3e9('0x11')](socket);var jayson=require(_0xb3e9('0x12'));var client=jayson['client'][_0xb3e9('0x13')]({'port':0x232c});var client9003=jayson[_0xb3e9('0x14')][_0xb3e9('0x13')]({'port':0x232b});var client9002=jayson[_0xb3e9('0x14')][_0xb3e9('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1dd400,_0x3d67d8,_0x3f0bda,_0x2db00f){return new BPromise(function(_0x563488,_0x5386f1){var _0x259799=_0x2db00f||client;return _0x259799[_0xb3e9('0x15')](_0x1dd400,_0x3f0bda)[_0xb3e9('0x16')](function(_0x363414){logger[_0xb3e9('0x17')](_0xb3e9('0x18'),_0x3d67d8,_0xb3e9('0x19'));logger[_0xb3e9('0x1a')](_0xb3e9('0x1b'),_0x3d67d8,_0xb3e9('0x19'),JSON['stringify'](_0x363414));if(_0x363414[_0xb3e9('0x1c')]){if(_0x363414[_0xb3e9('0x1c')][_0xb3e9('0x1d')]===0x1f4){logger[_0xb3e9('0x1c')](_0xb3e9('0x18'),_0x3d67d8,_0x363414['error'][_0xb3e9('0x1e')]);return _0x5386f1(_0x363414[_0xb3e9('0x1c')][_0xb3e9('0x1e')]);}logger[_0xb3e9('0x1c')](_0xb3e9('0x18'),_0x3d67d8,_0x363414[_0xb3e9('0x1c')][_0xb3e9('0x1e')]);return _0x563488(_0x363414[_0xb3e9('0x1c')]['message']);}else{logger[_0xb3e9('0x17')](_0xb3e9('0x18'),_0x3d67d8,_0xb3e9('0x19'));_0x563488(_0x363414[_0xb3e9('0x1f')][_0xb3e9('0x1e')]);}})[_0xb3e9('0x20')](function(_0x362054){logger['error'](_0xb3e9('0x18'),_0x3d67d8,_0x362054);_0x5386f1(_0x362054);});});}function respondWithResult(_0x3abf10,_0x4d53d4){_0x4d53d4=_0x4d53d4||0xc8;return function(_0x2cb6c6){if(_0x2cb6c6){return _0x3abf10['status'](_0x4d53d4)['json'](_0x2cb6c6);}};}function respondWithFilteredResult(_0x5957c6,_0xb28f08){return function(_0x552d92){if(_0x552d92){var _0x394d94=typeof _0xb28f08[_0xb3e9('0x21')]===_0xb3e9('0x22')&&typeof _0xb28f08[_0xb3e9('0x23')]==='undefined';var _0x1cefa2=_0x552d92[_0xb3e9('0x24')];var _0x369a6d=_0x394d94?0x0:_0xb28f08['offset'];var _0x2ec785=_0x394d94?_0x552d92[_0xb3e9('0x24')]:_0xb28f08[_0xb3e9('0x21')]+_0xb28f08[_0xb3e9('0x23')];var _0x563948;if(_0x2ec785>=_0x1cefa2){_0x2ec785=_0x1cefa2;_0x563948=0xc8;}else{_0x563948=0xce;}_0x5957c6[_0xb3e9('0x25')](_0x563948);return _0x5957c6[_0xb3e9('0x26')](_0xb3e9('0x27'),_0x369a6d+'-'+_0x2ec785+'/'+_0x1cefa2)[_0xb3e9('0x28')](_0x552d92);}return null;};}function saveUpdates(_0x561119){return function(_0x1969e6){if(_0x1969e6){return _0x1969e6['update'](_0x561119)[_0xb3e9('0x16')](function(_0xf932d9){return _0xf932d9;});}return null;};}function removeEntity(_0x1b4ed0){return function(_0x484b8c){if(_0x484b8c){return _0x484b8c[_0xb3e9('0x29')]()[_0xb3e9('0x16')](function(){_0x1b4ed0[_0xb3e9('0x25')](0xcc)[_0xb3e9('0x2a')]();});}};}function handleEntityNotFound(_0x343001){return function(_0x22ad97){if(!_0x22ad97){_0x343001[_0xb3e9('0x2b')](0x194);}return _0x22ad97;};}function handleError(_0x55583c,_0x4c2fdf){_0x4c2fdf=_0x4c2fdf||0x1f4;return function(_0x45459c){logger['error'](_0x45459c[_0xb3e9('0x2c')]);if(_0x45459c[_0xb3e9('0x2d')]){delete _0x45459c[_0xb3e9('0x2d')];}_0x55583c[_0xb3e9('0x25')](_0x4c2fdf)[_0xb3e9('0x2e')](_0x45459c);};}exports[_0xb3e9('0x2f')]=function(_0x250a4a,_0x2aba4e){var _0x4cca26={},_0x53d6bf={},_0x537667={'count':0x0,'rows':[]};var _0x175653=_[_0xb3e9('0x30')](db[_0xb3e9('0x31')][_0xb3e9('0x32')],function(_0x60e078){return{'name':_0x60e078[_0xb3e9('0x33')],'type':_0x60e078[_0xb3e9('0x34')][_0xb3e9('0x35')]};});_0x53d6bf[_0xb3e9('0x36')]=_['map'](_0x175653,_0xb3e9('0x2d'));_0x53d6bf[_0xb3e9('0x37')]=_['keys'](_0x250a4a[_0xb3e9('0x37')]);_0x53d6bf[_0xb3e9('0x38')]=_[_0xb3e9('0x39')](_0x53d6bf[_0xb3e9('0x36')],_0x53d6bf['query']);_0x4cca26[_0xb3e9('0x3a')]=_[_0xb3e9('0x39')](_0x53d6bf[_0xb3e9('0x36')],qs[_0xb3e9('0x3b')](_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x3b')]));_0x4cca26[_0xb3e9('0x3a')]=_0x4cca26[_0xb3e9('0x3a')][_0xb3e9('0x3c')]?_0x4cca26['attributes']:_0x53d6bf[_0xb3e9('0x36')];if(!_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x3d')](_0xb3e9('0x3e'))){_0x4cca26['limit']=qs[_0xb3e9('0x23')](_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x23')]);_0x4cca26['offset']=qs[_0xb3e9('0x21')](_0x250a4a['query'][_0xb3e9('0x21')]);}_0x4cca26[_0xb3e9('0x3f')]=qs[_0xb3e9('0x40')](_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x40')]);_0x4cca26[_0xb3e9('0x41')]=qs[_0xb3e9('0x38')](_[_0xb3e9('0x42')](_0x250a4a['query'],_0x53d6bf['filters']),_0x175653);if(_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x43')]){_0x4cca26['where']=_[_0xb3e9('0x44')](_0x4cca26[_0xb3e9('0x41')],{'$or':_[_0xb3e9('0x30')](_0x175653,function(_0x43d6fc){if(_0x43d6fc['type']!=='VIRTUAL'){var _0x202801={};_0x202801[_0x43d6fc[_0xb3e9('0x2d')]]={'$like':'%'+_0x250a4a[_0xb3e9('0x37')][_0xb3e9('0x43')]+'%'};return _0x202801;}})});}_0x4cca26=_['merge']({},_0x4cca26,_0x250a4a[_0xb3e9('0x45')]);var _0x34b84d={'where':_0x4cca26[_0xb3e9('0x41')]};return db[_0xb3e9('0x31')][_0xb3e9('0x24')](_0x34b84d)[_0xb3e9('0x16')](function(_0x42f5c8){_0x537667['count']=_0x42f5c8;if(_0x250a4a['query']['includeAll']){_0x4cca26[_0xb3e9('0x46')]=[{'all':!![]}];}return db[_0xb3e9('0x31')][_0xb3e9('0x47')](_0x4cca26);})['then'](function(_0x5271ef){_0x537667[_0xb3e9('0x48')]=_0x5271ef;return _0x537667;})[_0xb3e9('0x16')](respondWithFilteredResult(_0x2aba4e,_0x4cca26))[_0xb3e9('0x20')](handleError(_0x2aba4e,null));};exports[_0xb3e9('0x49')]=function(_0x684cd8,_0x476ac8){var _0x346ac0={'raw':!![],'where':{'id':_0x684cd8[_0xb3e9('0x4a')]['id']}},_0x19bb93={};_0x19bb93['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x19bb93[_0xb3e9('0x37')]=_['keys'](_0x684cd8['query']);_0x19bb93[_0xb3e9('0x38')]=_[_0xb3e9('0x39')](_0x19bb93['model'],_0x19bb93[_0xb3e9('0x37')]);_0x346ac0[_0xb3e9('0x3a')]=_['intersection'](_0x19bb93[_0xb3e9('0x36')],qs[_0xb3e9('0x3b')](_0x684cd8[_0xb3e9('0x37')][_0xb3e9('0x3b')]));_0x346ac0[_0xb3e9('0x3a')]=_0x346ac0[_0xb3e9('0x3a')][_0xb3e9('0x3c')]?_0x346ac0[_0xb3e9('0x3a')]:_0x19bb93[_0xb3e9('0x36')];if(_0x684cd8[_0xb3e9('0x37')][_0xb3e9('0x4b')]){_0x346ac0['include']=[{'all':!![]}];}_0x346ac0=_[_0xb3e9('0x44')]({},_0x346ac0,_0x684cd8[_0xb3e9('0x45')]);return db[_0xb3e9('0x31')][_0xb3e9('0x4c')](_0x346ac0)[_0xb3e9('0x16')](handleEntityNotFound(_0x476ac8,null))['then'](respondWithResult(_0x476ac8,null))[_0xb3e9('0x20')](handleError(_0x476ac8,null));};exports[_0xb3e9('0x4d')]=function(_0x26b537,_0x1a510d){if(_0x26b537[_0xb3e9('0x4e')]['id']){delete _0x26b537['body']['id'];}return db[_0xb3e9('0x31')][_0xb3e9('0x4c')]({'where':{'id':_0x26b537[_0xb3e9('0x4a')]['id']}})[_0xb3e9('0x16')](handleEntityNotFound(_0x1a510d,null))[_0xb3e9('0x16')](saveUpdates(_0x26b537[_0xb3e9('0x4e')],null))[_0xb3e9('0x16')](respondWithResult(_0x1a510d,null))[_0xb3e9('0x20')](handleError(_0x1a510d,null));};exports['destroy']=function(_0x1d4b81,_0x6fc2d4){return db[_0xb3e9('0x31')][_0xb3e9('0x4c')]({'where':{'id':_0x1d4b81[_0xb3e9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6fc2d4,null))[_0xb3e9('0x16')](removeEntity(_0x6fc2d4,null))[_0xb3e9('0x20')](handleError(_0x6fc2d4,null));};exports[_0xb3e9('0x4f')]=function(_0x77c33a,_0x5849bf){return db['MailMessage']['describe']()[_0xb3e9('0x16')](respondWithResult(_0x5849bf,null))[_0xb3e9('0x20')](handleError(_0x5849bf,null));};exports[_0xb3e9('0x50')]=function(_0x4b6edf,_0x2e36a6){return db['MailMessage']['create'](_0x4b6edf[_0xb3e9('0x4e')])[_0xb3e9('0x16')](function(_0x621b64){if(_0x621b64){if(_0x621b64['direction']===_0xb3e9('0x51')&&!_0x621b64['secret']){var _0x3f1c57,_0xb338a6,_0x4abe91;if(_0x4b6edf[_0xb3e9('0x4e')]['to']){_0xb338a6=_0x4b6edf[_0xb3e9('0x4e')]['to'][_0xb3e9('0x52')](',')[0x0];}return db[_0xb3e9('0x53')][_0xb3e9('0x54')]({'where':{'id':_0x621b64['MailAccountId']},'include':[{'model':db[_0xb3e9('0x55')],'as':_0xb3e9('0x56'),'include':[{'model':db[_0xb3e9('0x57')],'as':_0xb3e9('0x58'),'where':{'email':_0xb338a6},'limit':0x1,'order':[[_0xb3e9('0x59'),_0xb3e9('0x5a')]]}]},{'model':db[_0xb3e9('0x5b')],'as':_0xb3e9('0x5c'),'raw':!![],'include':[{'model':db[_0xb3e9('0x5d')],'as':_0xb3e9('0x5d'),'raw':!![]}]}]})[_0xb3e9('0x16')](function(_0x4b0d6e){_0x3f1c57=_0x4b0d6e;if(!_0x3f1c57||!_0x3f1c57[_0xb3e9('0x5c')])return;var _0x4295d6=_0x3f1c57[_0xb3e9('0x5e')]();if(_0x4b6edf[_0xb3e9('0x4e')][_0xb3e9('0x5f')]&&_0x4b6edf[_0xb3e9('0x4e')][_0xb3e9('0x5f')][_0xb3e9('0x3c')]){for(var _0x186342=0x0;_0x186342<_0x4b6edf['body']['attachments'][_0xb3e9('0x3c')];_0x186342+=0x1){_0x4b6edf[_0xb3e9('0x4e')][_0xb3e9('0x5f')][_0x186342]={'filename':_0x4b6edf[_0xb3e9('0x4e')][_0xb3e9('0x5f')][_0x186342][_0xb3e9('0x2d')],'path':path[_0xb3e9('0x60')](config['root'],_0xb3e9('0x61'),_0x4b6edf[_0xb3e9('0x4e')]['attachments'][_0x186342][_0xb3e9('0x62')])};}}_0x4abe91={'account':_0x4295d6,'message':_0x4b6edf[_0xb3e9('0x4e')]};return;})[_0xb3e9('0x16')](function(){if(_0x3f1c57[_0xb3e9('0x56')]){if(_0x3f1c57[_0xb3e9('0x56')]['Contacts'][_0xb3e9('0x3c')]){return _0x3f1c57[_0xb3e9('0x56')][_0xb3e9('0x58')][0x0];}else{return db['CmContact']['create'](_[_0xb3e9('0xc')](_0x4b6edf['body'],{'firstName':_0x4b6edf['body']['to'],'email':_0x4b6edf[_0xb3e9('0x4e')]['to'],'phone':_0x4b6edf[_0xb3e9('0x4e')]['to'],'ListId':_0x3f1c57[_0xb3e9('0x63')]}));}}else{throw new Error(_0xb3e9('0x64'));}})['then'](function(){if(_0x4abe91){return respondWithRpcPromise(_0xb3e9('0x65'),_0xb3e9('0x66'),_0x4abe91,client9003)['then'](function(_0x1a2572){return _0x621b64[_0xb3e9('0x4d')]({'read':!![],'messageId':_0x1a2572[_0xb3e9('0x67')],'sentAt':moment()[_0xb3e9('0x68')](_0xb3e9('0x69'))});})['catch'](function(_0x1da206){logger[_0xb3e9('0x1c')]('%s',JSON[_0xb3e9('0x6a')](_0x1da206));return _0x621b64;});}return _0x621b64;});}return _0x621b64;}})[_0xb3e9('0x16')](respondWithResult(_0x2e36a6,0xc9))['catch'](handleError(_0x2e36a6,null));};exports['accept']=function(_0x1bff93,_0x189afe){var _0x35c997={'agent':{},'channel':_0xb3e9('0x6b')};if(_0x1bff93[_0xb3e9('0x4e')]['id']){delete _0x1bff93[_0xb3e9('0x4e')]['id'];}_0x1bff93[_0xb3e9('0x4e')][_0xb3e9('0x6c')]=!![];_0x1bff93['body'][_0xb3e9('0x6d')]=moment()[_0xb3e9('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bff93[_0xb3e9('0x4e')][_0xb3e9('0x6e')]=_0x1bff93[_0xb3e9('0x4e')]['UserId']||_0x1bff93[_0xb3e9('0x6f')]['id'];_0x35c997[_0xb3e9('0x70')]['id']=_0x1bff93[_0xb3e9('0x4e')][_0xb3e9('0x6e')];return db[_0xb3e9('0x31')][_0xb3e9('0x4c')]({'where':{'id':_0x1bff93[_0xb3e9('0x4a')]['id'],'UserId':null}})[_0xb3e9('0x16')](handleEntityNotFound(_0x189afe,null))[_0xb3e9('0x16')](saveUpdates(_0x1bff93[_0xb3e9('0x4e')],null))[_0xb3e9('0x16')](function(_0x40b312){if(_0x40b312){_0x35c997[_0xb3e9('0x1e')]=_0x40b312['get']({'plain':!![]});return db[_0xb3e9('0x71')]['find']({'where':{'id':_0x40b312[_0xb3e9('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x189afe,null))[_0xb3e9('0x16')](function(_0xd2c0fb){if(_0xd2c0fb){return _0xd2c0fb[_0xb3e9('0x4d')]({'UserId':_0x1bff93['body'][_0xb3e9('0x6e')],'read1stAt':_[_0xb3e9('0x73')](_0xd2c0fb[_0xb3e9('0x74')])?moment()[_0xb3e9('0x68')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5550a9){if(_0x5550a9){_0x35c997[_0xb3e9('0x75')]=_0x5550a9[_0xb3e9('0x76')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1bff93['user']['id'],_0x1bff93[_0xb3e9('0x6f')]['name'],_0x1bff93[_0xb3e9('0x6f')]['role'],_0x35c997['interaction']['id'],_0x1bff93[_0xb3e9('0x4e')]?JSON['stringify'](_0x1bff93['body']):_0xb3e9('0x77'));return respondWithRpcPromise(_0xb3e9('0x78'),'acceptMessage',_0x35c997);}return null;})[_0xb3e9('0x16')](function(_0x135271){var _0x1d536e=_0xb3e9('0x79')+_0x135271[_0xb3e9('0x1e')][_0xb3e9('0x7a')];return db['sequelize'][_0xb3e9('0x37')](_0x1d536e,{'type':db[_0xb3e9('0x7b')]['QueryTypes'][_0xb3e9('0x7c')],'raw':!![]})['then'](function(_0x209911){return _0x209911;});})[_0xb3e9('0x16')](function(_0x12ebcb){if(_0x12ebcb){_0x35c997[_0xb3e9('0x1e')][_0xb3e9('0x7d')]=_0x12ebcb[0x0];if(!_0x1bff93['body'][_0xb3e9('0x6e')])return;return db[_0xb3e9('0x7e')]['find']({'where':{'id':_0x1bff93[_0xb3e9('0x4e')]['UserId'],'role':_0xb3e9('0x70')},'attributes':['id',_0xb3e9('0x2d'),_0xb3e9('0x7f'),_0xb3e9('0x80'),'internal'],'raw':!![]});}return null;})[_0xb3e9('0x16')](function(_0x580366){if(!_0x580366)return null;_0x35c997['message'][_0xb3e9('0x70')]=_0x580366;return _0x35c997;})['then'](function(_0x50f75f){if(_0x50f75f){if(_0x1bff93[_0xb3e9('0x4e')][_0xb3e9('0x81')]){_0x35c997[_0xb3e9('0x1e')][_0xb3e9('0x82')]=util[_0xb3e9('0x68')](_0xb3e9('0x83'),_0x1bff93['user']['name']);_0x35c997['message'][_0xb3e9('0x84')]=_0x35c997['channel'];_0x35c997[_0xb3e9('0x1e')][_0xb3e9('0x85')]=_0x35c997[_0xb3e9('0x84')];_0x35c997[_0xb3e9('0x1e')][_0xb3e9('0x86')]=_0xb3e9('0x87');_0x35c997[_0xb3e9('0x1e')][_0xb3e9('0x4e')]=htmlToText[_0xb3e9('0x88')](_0x35c997['message'][_0xb3e9('0x4e')]);return respondWithRpcPromise(_0xb3e9('0x89'),_0xb3e9('0x89'),{'event':_0xb3e9('0x8a'),'message':_0x35c997[_0xb3e9('0x1e')]},client9002)[_0xb3e9('0x16')](function(){return _0x35c997;});}return _0x35c997;}return null;})[_0xb3e9('0x16')](respondWithResult(_0x189afe,null))[_0xb3e9('0x20')](handleError(_0x189afe,null));};exports[_0xb3e9('0x8b')]=function(_0x2982e5,_0x2d4e03){var _0x12347d={'agent':{},'channel':'mail'};if(_0x2982e5['body']['id']){delete _0x2982e5[_0xb3e9('0x4e')]['id'];}_0x2982e5['body']['UserId']=_0x2982e5['body']['UserId']||_0x2982e5[_0xb3e9('0x6f')]['id'];_0x12347d[_0xb3e9('0x70')]['id']=_0x2982e5[_0xb3e9('0x4e')][_0xb3e9('0x6e')];return db[_0xb3e9('0x31')][_0xb3e9('0x4c')]({'where':{'id':_0x2982e5[_0xb3e9('0x4a')]['id'],'UserId':null}})[_0xb3e9('0x16')](handleEntityNotFound(_0x2d4e03,null))[_0xb3e9('0x16')](function(_0x3f2311){if(_0x3f2311){_0x12347d[_0xb3e9('0x1e')]=_0x3f2311[_0xb3e9('0x76')]({'plain':!![]});return db[_0xb3e9('0x71')][_0xb3e9('0x4c')]({'where':{'id':_0x3f2311[_0xb3e9('0x72')]}});}return null;})[_0xb3e9('0x16')](handleEntityNotFound(_0x2d4e03,null))['then'](function(_0x125b1c){if(_0x125b1c){_0x12347d[_0xb3e9('0x75')]=_0x125b1c[_0xb3e9('0x76')]({'plain':!![]});interaction_log[_0xb3e9('0x17')](_0xb3e9('0x8c'),_0x2982e5['user']['id'],_0x2982e5[_0xb3e9('0x6f')][_0xb3e9('0x2d')],_0x2982e5[_0xb3e9('0x6f')]['role'],_0x12347d[_0xb3e9('0x75')]['id'],_0x2982e5['body']?JSON[_0xb3e9('0x6a')](_0x2982e5[_0xb3e9('0x4e')]):_0xb3e9('0x77'));return respondWithRpcPromise(_0xb3e9('0x8d'),'rejectMessage',_0x12347d);}return null;})[_0xb3e9('0x16')](function(_0x5411dd){var _0x102955='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5411dd[_0xb3e9('0x1e')][_0xb3e9('0x7a')];return db['sequelize'][_0xb3e9('0x37')](_0x102955,{'type':db[_0xb3e9('0x7b')][_0xb3e9('0x8e')][_0xb3e9('0x7c')],'raw':!![]})[_0xb3e9('0x16')](function(_0x91484){return _0x91484;});})['then'](function(_0x10f66f){if(_0x10f66f){_0x12347d[_0xb3e9('0x1e')][_0xb3e9('0x7d')]=_0x10f66f[0x0];if(!_0x2982e5[_0xb3e9('0x4e')][_0xb3e9('0x6e')])return;return db[_0xb3e9('0x7e')][_0xb3e9('0x4c')]({'where':{'id':_0x2982e5[_0xb3e9('0x4e')]['UserId'],'role':'agent'},'attributes':['id',_0xb3e9('0x2d'),'fullname',_0xb3e9('0x80'),_0xb3e9('0x8f')],'raw':!![]});}return null;})[_0xb3e9('0x16')](function(_0x1b3ae9){if(!_0x1b3ae9)return null;_0x12347d[_0xb3e9('0x1e')][_0xb3e9('0x70')]=_0x1b3ae9;return _0x12347d;})[_0xb3e9('0x16')](function(_0x49db48){if(_0x49db48){_0x49db48[_0xb3e9('0x1e')][_0xb3e9('0x82')]=util['format'](_0xb3e9('0x83'),_0x2982e5['user'][_0xb3e9('0x2d')]);_0x49db48[_0xb3e9('0x1e')][_0xb3e9('0x84')]=_0x12347d[_0xb3e9('0x84')];_0x49db48['message'][_0xb3e9('0x85')]=_0x12347d[_0xb3e9('0x84')];_0x49db48[_0xb3e9('0x1e')][_0xb3e9('0x86')]=_0xb3e9('0x8b');_0x49db48[_0xb3e9('0x1e')]['body']=htmlToText[_0xb3e9('0x88')](_0x12347d[_0xb3e9('0x1e')]['body']);respondWithRpcPromise(_0xb3e9('0x89'),'EventManager',{'event':_0xb3e9('0x90'),'message':_0x49db48[_0xb3e9('0x1e')]},client9002);return _0x12347d;}return null;})[_0xb3e9('0x16')](respondWithResult(_0x2d4e03,null))[_0xb3e9('0x20')](handleError(_0x2d4e03,null));};exports['download']=function(_0x2c177c,_0x6f8e3){var _0x191b67=moment()['unix']()[_0xb3e9('0x91')]();var _0x2fc17d=path[_0xb3e9('0x60')](config['root'],_0xb3e9('0x92'),'files','tmp');var _0x13847f=path['join'](config['root'],_0xb3e9('0x92'),_0xb3e9('0x93'),_0xb3e9('0x5f'));var _0x22b9d8=util[_0xb3e9('0x68')](_0xb3e9('0x94'),_0x191b67);return db[_0xb3e9('0x31')][_0xb3e9('0x4c')]({'where':{'id':_0x2c177c[_0xb3e9('0x4a')]['id']},'attributes':['id',_0xb3e9('0x4e'),_0xb3e9('0x95'),'to','cc',_0xb3e9('0x96'),_0xb3e9('0x97'),_0xb3e9('0x98')],'include':_0x2c177c[_0xb3e9('0x37')][_0xb3e9('0x5f')]?[{'model':db[_0xb3e9('0x99')],'as':_0xb3e9('0x9a')}]:undefined})['then'](handleEntityNotFound(_0x6f8e3,null))['then'](function(_0x45181a){if(_0x45181a){var _0x41dc8f=_0x45181a;var _0x545957={'from':_0x41dc8f[_0xb3e9('0x95')],'to':_0x41dc8f['to'],'subject':_0x41dc8f[_0xb3e9('0x97')],'html':htmlEntities[_0xb3e9('0x9b')](_0x41dc8f[_0xb3e9('0x4e')]),'headers':{'Date':moment(_0x41dc8f[_0xb3e9('0x98')])[_0xb3e9('0x68')](_0xb3e9('0x9c'))},'attachments':[]};if(_0x45181a['cc']){_0x545957[_0xb3e9('0x9d')]['Cc']=_0x45181a['cc'];}if(_0x45181a[_0xb3e9('0x96')]){_0x545957[_0xb3e9('0x9d')]['Bcc']=_0x45181a[_0xb3e9('0x96')];}return new BPromise(function(_0xaa44b5,_0x217e2e){if(_0x45181a['Attachments']){for(var _0x58a383=0x0;_0x58a383<_0x45181a[_0xb3e9('0x9a')][_0xb3e9('0x3c')];_0x58a383++){var _0x2ac45a=_0x45181a[_0xb3e9('0x9a')][_0x58a383];var _0x5c5476=path[_0xb3e9('0x60')](_0x13847f,_0x2ac45a[_0xb3e9('0x62')]);if(fs[_0xb3e9('0x9e')](_0x5c5476)){_0x545957[_0xb3e9('0x5f')]['push']({'name':_0x2ac45a[_0xb3e9('0x2d')],'contentType':_0x2ac45a[_0xb3e9('0x34')],'data':fs['readFileSync'](_0x5c5476)});}}}emlformat[_0xb3e9('0x9f')](_0x545957,function(_0x39d7f1,_0xa90590){if(_0x39d7f1)return _0x217e2e(_0x39d7f1);fs[_0xb3e9('0xa0')](path[_0xb3e9('0x60')](_0x2fc17d,_0x22b9d8),_0xa90590);return _0xaa44b5(_0xa90590);});});}})['then'](function(_0x337765){if(_0x337765){return _0x6f8e3[_0xb3e9('0xa1')](path['join'](_0x2fc17d,_0x22b9d8),_0x22b9d8,function(_0x49a410){if(!_0x49a410)fs[_0xb3e9('0xa2')](path['join'](_0x2fc17d,_0x22b9d8));});}})['catch'](handleError(_0x6f8e3,null));}; \ No newline at end of file +var _0xbe24=['agent','get','MailInteractionId','update','isNil','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','contact','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','type','readFileSync','unlinkSync','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','offset','undefined','limit','count','set','destroy','end','stack','name','send','map','MailMessage','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','merge','find','body','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','defaults','ListId','SendMail','format','stringify','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe24,0x16c));var _0x4be2=function(_0x4704f1,_0x45abc0){_0x4704f1=_0x4704f1-0x0;var _0x3ce830=_0xbe24[_0x4704f1];return _0x3ce830;};'use strict';var emlformat=require('eml-format');var moment=require(_0x4be2('0x0'));var BPromise=require(_0x4be2('0x1'));var util=require('util');var path=require(_0x4be2('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4be2('0x3'));var htmlToText=require(_0x4be2('0x4'));var qs=require(_0x4be2('0x5'));var logger=require(_0x4be2('0x6'))(_0x4be2('0x7'));var interaction_log=require(_0x4be2('0x6'))(_0x4be2('0x8'));var config=require('../../config/environment');var db=require(_0x4be2('0x9'))['db'];config['redis']=_['defaults'](config[_0x4be2('0xa')],{'host':_0x4be2('0xb'),'port':0x18eb});var socket=require(_0x4be2('0xc'))(new Redis(config[_0x4be2('0xa')]));var htmlEntities=require(_0x4be2('0xd'));require(_0x4be2('0xe'))[_0x4be2('0xf')](socket);var jayson=require(_0x4be2('0x10'));var client=jayson[_0x4be2('0x11')]['http']({'port':0x232c});var client9003=jayson['client'][_0x4be2('0x12')]({'port':0x232b});var client9002=jayson[_0x4be2('0x11')][_0x4be2('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x3a7239,_0x490a3a,_0x3fd4b8,_0x1de491){return new BPromise(function(_0xe29ac6,_0x5eee69){var _0x4a4002=_0x1de491||client;return _0x4a4002[_0x4be2('0x13')](_0x3a7239,_0x3fd4b8)[_0x4be2('0x14')](function(_0x199e1b){logger['info'](_0x4be2('0x15'),_0x490a3a,_0x4be2('0x16'));logger[_0x4be2('0x17')](_0x4be2('0x18'),_0x490a3a,_0x4be2('0x16'),JSON['stringify'](_0x199e1b));if(_0x199e1b[_0x4be2('0x19')]){if(_0x199e1b[_0x4be2('0x19')][_0x4be2('0x1a')]===0x1f4){logger[_0x4be2('0x19')](_0x4be2('0x15'),_0x490a3a,_0x199e1b[_0x4be2('0x19')]['message']);return _0x5eee69(_0x199e1b['error'][_0x4be2('0x1b')]);}logger[_0x4be2('0x19')](_0x4be2('0x15'),_0x490a3a,_0x199e1b['error'][_0x4be2('0x1b')]);return _0xe29ac6(_0x199e1b[_0x4be2('0x19')][_0x4be2('0x1b')]);}else{logger[_0x4be2('0x1c')](_0x4be2('0x15'),_0x490a3a,_0x4be2('0x16'));_0xe29ac6(_0x199e1b[_0x4be2('0x1d')]['message']);}})[_0x4be2('0x1e')](function(_0x37947f){logger['error'](_0x4be2('0x15'),_0x490a3a,_0x37947f);_0x5eee69(_0x37947f);});});}function respondWithResult(_0x535624,_0x1c9f6f){_0x1c9f6f=_0x1c9f6f||0xc8;return function(_0x6831c){if(_0x6831c){return _0x535624[_0x4be2('0x1f')](_0x1c9f6f)['json'](_0x6831c);}};}function respondWithFilteredResult(_0x6a4cc6,_0x1af676){return function(_0x44128e){if(_0x44128e){var _0x289c06=typeof _0x1af676[_0x4be2('0x20')]===_0x4be2('0x21')&&typeof _0x1af676[_0x4be2('0x22')]===_0x4be2('0x21');var _0x5f223d=_0x44128e[_0x4be2('0x23')];var _0x15bd83=_0x289c06?0x0:_0x1af676['offset'];var _0x385dae=_0x289c06?_0x44128e[_0x4be2('0x23')]:_0x1af676[_0x4be2('0x20')]+_0x1af676['limit'];var _0x3b6e9a;if(_0x385dae>=_0x5f223d){_0x385dae=_0x5f223d;_0x3b6e9a=0xc8;}else{_0x3b6e9a=0xce;}_0x6a4cc6[_0x4be2('0x1f')](_0x3b6e9a);return _0x6a4cc6[_0x4be2('0x24')]('Content-Range',_0x15bd83+'-'+_0x385dae+'/'+_0x5f223d)['json'](_0x44128e);}return null;};}function saveUpdates(_0xc25e3e){return function(_0x173252){if(_0x173252){return _0x173252['update'](_0xc25e3e)[_0x4be2('0x14')](function(_0x4ddbf0){return _0x4ddbf0;});}return null;};}function removeEntity(_0x57fc37){return function(_0x5a6c55){if(_0x5a6c55){return _0x5a6c55[_0x4be2('0x25')]()[_0x4be2('0x14')](function(){_0x57fc37[_0x4be2('0x1f')](0xcc)[_0x4be2('0x26')]();});}};}function handleEntityNotFound(_0x5bc127){return function(_0x1ac13e){if(!_0x1ac13e){_0x5bc127['sendStatus'](0x194);}return _0x1ac13e;};}function handleError(_0x4df233,_0x3f4676){_0x3f4676=_0x3f4676||0x1f4;return function(_0x165f1c){logger[_0x4be2('0x19')](_0x165f1c[_0x4be2('0x27')]);if(_0x165f1c[_0x4be2('0x28')]){delete _0x165f1c[_0x4be2('0x28')];}_0x4df233[_0x4be2('0x1f')](_0x3f4676)[_0x4be2('0x29')](_0x165f1c);};}exports['index']=function(_0xe8d292,_0x50b794){var _0x4ab308={},_0xdc516e={},_0x5dcc06={'count':0x0,'rows':[]};var _0x4e8511=_[_0x4be2('0x2a')](db[_0x4be2('0x2b')]['rawAttributes'],function(_0x155d09){return{'name':_0x155d09['fieldName'],'type':_0x155d09['type'][_0x4be2('0x2c')]};});_0xdc516e['model']=_[_0x4be2('0x2a')](_0x4e8511,_0x4be2('0x28'));_0xdc516e[_0x4be2('0x2d')]=_['keys'](_0xe8d292[_0x4be2('0x2d')]);_0xdc516e[_0x4be2('0x2e')]=_[_0x4be2('0x2f')](_0xdc516e[_0x4be2('0x30')],_0xdc516e[_0x4be2('0x2d')]);_0x4ab308[_0x4be2('0x31')]=_[_0x4be2('0x2f')](_0xdc516e[_0x4be2('0x30')],qs['fields'](_0xe8d292[_0x4be2('0x2d')][_0x4be2('0x32')]));_0x4ab308['attributes']=_0x4ab308[_0x4be2('0x31')][_0x4be2('0x33')]?_0x4ab308['attributes']:_0xdc516e[_0x4be2('0x30')];if(!_0xe8d292['query'][_0x4be2('0x34')](_0x4be2('0x35'))){_0x4ab308['limit']=qs['limit'](_0xe8d292[_0x4be2('0x2d')][_0x4be2('0x22')]);_0x4ab308[_0x4be2('0x20')]=qs[_0x4be2('0x20')](_0xe8d292[_0x4be2('0x2d')][_0x4be2('0x20')]);}_0x4ab308[_0x4be2('0x36')]=qs[_0x4be2('0x37')](_0xe8d292[_0x4be2('0x2d')][_0x4be2('0x37')]);_0x4ab308[_0x4be2('0x38')]=qs[_0x4be2('0x2e')](_[_0x4be2('0x39')](_0xe8d292[_0x4be2('0x2d')],_0xdc516e['filters']),_0x4e8511);if(_0xe8d292[_0x4be2('0x2d')]['filter']){_0x4ab308['where']=_['merge'](_0x4ab308['where'],{'$or':_[_0x4be2('0x2a')](_0x4e8511,function(_0x3d3589){if(_0x3d3589['type']!==_0x4be2('0x3a')){var _0x4c3570={};_0x4c3570[_0x3d3589[_0x4be2('0x28')]]={'$like':'%'+_0xe8d292['query'][_0x4be2('0x3b')]+'%'};return _0x4c3570;}})});}_0x4ab308=_['merge']({},_0x4ab308,_0xe8d292[_0x4be2('0x3c')]);var _0x2566b1={'where':_0x4ab308[_0x4be2('0x38')]};return db[_0x4be2('0x2b')][_0x4be2('0x23')](_0x2566b1)[_0x4be2('0x14')](function(_0x21b13c){_0x5dcc06[_0x4be2('0x23')]=_0x21b13c;if(_0xe8d292[_0x4be2('0x2d')][_0x4be2('0x3d')]){_0x4ab308[_0x4be2('0x3e')]=[{'all':!![]}];}return db[_0x4be2('0x2b')][_0x4be2('0x3f')](_0x4ab308);})[_0x4be2('0x14')](function(_0x34ba5d){_0x5dcc06[_0x4be2('0x40')]=_0x34ba5d;return _0x5dcc06;})[_0x4be2('0x14')](respondWithFilteredResult(_0x50b794,_0x4ab308))[_0x4be2('0x1e')](handleError(_0x50b794,null));};exports[_0x4be2('0x41')]=function(_0xe811c6,_0x53fc2c){var _0x57e28b={'raw':!![],'where':{'id':_0xe811c6[_0x4be2('0x42')]['id']}},_0xd693d9={};_0xd693d9[_0x4be2('0x30')]=_['keys'](db[_0x4be2('0x2b')][_0x4be2('0x43')]);_0xd693d9[_0x4be2('0x2d')]=_[_0x4be2('0x44')](_0xe811c6[_0x4be2('0x2d')]);_0xd693d9[_0x4be2('0x2e')]=_[_0x4be2('0x2f')](_0xd693d9[_0x4be2('0x30')],_0xd693d9['query']);_0x57e28b[_0x4be2('0x31')]=_[_0x4be2('0x2f')](_0xd693d9['model'],qs[_0x4be2('0x32')](_0xe811c6['query'][_0x4be2('0x32')]));_0x57e28b[_0x4be2('0x31')]=_0x57e28b[_0x4be2('0x31')]['length']?_0x57e28b[_0x4be2('0x31')]:_0xd693d9['model'];if(_0xe811c6[_0x4be2('0x2d')][_0x4be2('0x3d')]){_0x57e28b[_0x4be2('0x3e')]=[{'all':!![]}];}_0x57e28b=_[_0x4be2('0x45')]({},_0x57e28b,_0xe811c6[_0x4be2('0x3c')]);return db[_0x4be2('0x2b')][_0x4be2('0x46')](_0x57e28b)['then'](handleEntityNotFound(_0x53fc2c,null))[_0x4be2('0x14')](respondWithResult(_0x53fc2c,null))[_0x4be2('0x1e')](handleError(_0x53fc2c,null));};exports['update']=function(_0x23a728,_0x2f21c6){if(_0x23a728[_0x4be2('0x47')]['id']){delete _0x23a728[_0x4be2('0x47')]['id'];}return db['MailMessage'][_0x4be2('0x46')]({'where':{'id':_0x23a728[_0x4be2('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f21c6,null))[_0x4be2('0x14')](saveUpdates(_0x23a728[_0x4be2('0x47')],null))[_0x4be2('0x14')](respondWithResult(_0x2f21c6,null))[_0x4be2('0x1e')](handleError(_0x2f21c6,null));};exports[_0x4be2('0x25')]=function(_0x45ba1f,_0x2f6ba3){return db[_0x4be2('0x2b')]['find']({'where':{'id':_0x45ba1f[_0x4be2('0x42')]['id']}})[_0x4be2('0x14')](handleEntityNotFound(_0x2f6ba3,null))[_0x4be2('0x14')](removeEntity(_0x2f6ba3,null))[_0x4be2('0x1e')](handleError(_0x2f6ba3,null));};exports['describe']=function(_0x5262e1,_0x289009){return db[_0x4be2('0x2b')][_0x4be2('0x48')]()['then'](respondWithResult(_0x289009,null))[_0x4be2('0x1e')](handleError(_0x289009,null));};exports[_0x4be2('0x49')]=function(_0x260ee0,_0x3c1a1e){return db['MailMessage']['create'](_0x260ee0[_0x4be2('0x47')])['then'](function(_0x49ba18){if(_0x49ba18){if(_0x49ba18[_0x4be2('0x4a')]==='out'&&!_0x49ba18[_0x4be2('0x4b')]){var _0x29607f,_0xcead83,_0x46ccc6;if(_0x260ee0[_0x4be2('0x47')]['to']){_0xcead83=_0x260ee0[_0x4be2('0x47')]['to']['split'](',')[0x0];}return db[_0x4be2('0x4c')][_0x4be2('0x4d')]({'where':{'id':_0x49ba18[_0x4be2('0x4e')]},'include':[{'model':db[_0x4be2('0x4f')],'as':_0x4be2('0x50'),'include':[{'model':db[_0x4be2('0x51')],'as':_0x4be2('0x52'),'where':{'email':_0xcead83},'limit':0x1,'order':[[_0x4be2('0x53'),_0x4be2('0x54')]]}]},{'model':db['MailServerOut'],'as':_0x4be2('0x55'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4be2('0x56'),'raw':!![]}]}]})[_0x4be2('0x14')](function(_0x1f6db1){_0x29607f=_0x1f6db1;if(!_0x29607f||!_0x29607f['Smtp'])return;var _0x5af948=_0x29607f[_0x4be2('0x57')]();if(_0x260ee0[_0x4be2('0x47')][_0x4be2('0x58')]&&_0x260ee0[_0x4be2('0x47')][_0x4be2('0x58')][_0x4be2('0x33')]){for(var _0x51c261=0x0;_0x51c261<_0x260ee0[_0x4be2('0x47')]['attachments'][_0x4be2('0x33')];_0x51c261+=0x1){_0x260ee0[_0x4be2('0x47')][_0x4be2('0x58')][_0x51c261]={'filename':_0x260ee0['body'][_0x4be2('0x58')][_0x51c261]['name'],'path':path[_0x4be2('0x59')](config[_0x4be2('0x5a')],_0x4be2('0x5b'),_0x260ee0['body'][_0x4be2('0x58')][_0x51c261][_0x4be2('0x5c')])};}}_0x46ccc6={'account':_0x5af948,'message':_0x260ee0[_0x4be2('0x47')]};return;})['then'](function(){if(_0x29607f[_0x4be2('0x50')]){if(_0x29607f[_0x4be2('0x50')]['Contacts'][_0x4be2('0x33')]){return _0x29607f[_0x4be2('0x50')][_0x4be2('0x52')][0x0];}else{return db[_0x4be2('0x51')][_0x4be2('0x49')](_[_0x4be2('0x5d')](_0x260ee0['body'],{'firstName':_0x260ee0[_0x4be2('0x47')]['to'],'email':_0x260ee0['body']['to'],'phone':_0x260ee0[_0x4be2('0x47')]['to'],'ListId':_0x29607f[_0x4be2('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x4be2('0x14')](function(){if(_0x46ccc6){return respondWithRpcPromise(_0x4be2('0x5f'),'sendMail',_0x46ccc6,client9003)[_0x4be2('0x14')](function(_0x500dd4){return _0x49ba18['update']({'read':!![],'messageId':_0x500dd4['messageId'],'sentAt':moment()[_0x4be2('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x371c28){logger[_0x4be2('0x19')]('%s',JSON[_0x4be2('0x61')](_0x371c28));return _0x49ba18;});}return _0x49ba18;});}return _0x49ba18;}})[_0x4be2('0x14')](respondWithResult(_0x3c1a1e,0xc9))[_0x4be2('0x1e')](handleError(_0x3c1a1e,null));};exports[_0x4be2('0x62')]=function(_0x2a8d1e,_0x4abc98){var _0x1e27c3={'agent':{},'channel':'mail'};if(_0x2a8d1e[_0x4be2('0x47')]['id']){delete _0x2a8d1e['body']['id'];}_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x63')]=!![];_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x64')]=moment()['format'](_0x4be2('0x65'));_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x66')]=_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x66')]||_0x2a8d1e[_0x4be2('0x67')]['id'];_0x1e27c3[_0x4be2('0x68')]['id']=_0x2a8d1e['body'][_0x4be2('0x66')];return db[_0x4be2('0x2b')][_0x4be2('0x46')]({'where':{'id':_0x2a8d1e['params']['id'],'UserId':null}})[_0x4be2('0x14')](handleEntityNotFound(_0x4abc98,null))[_0x4be2('0x14')](saveUpdates(_0x2a8d1e[_0x4be2('0x47')],null))['then'](function(_0x28b14d){if(_0x28b14d){_0x1e27c3[_0x4be2('0x1b')]=_0x28b14d[_0x4be2('0x69')]({'plain':!![]});return db['MailInteraction'][_0x4be2('0x46')]({'where':{'id':_0x28b14d[_0x4be2('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4abc98,null))[_0x4be2('0x14')](function(_0x55edec){if(_0x55edec){return _0x55edec[_0x4be2('0x6b')]({'UserId':_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x66')],'read1stAt':_[_0x4be2('0x6c')](_0x55edec['read1stAt'])?moment()[_0x4be2('0x60')](_0x4be2('0x65')):undefined});}return null;})[_0x4be2('0x14')](function(_0x1cd9a6){if(_0x1cd9a6){_0x1e27c3[_0x4be2('0x6d')]=_0x1cd9a6[_0x4be2('0x69')]({'plain':!![]});interaction_log[_0x4be2('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a8d1e[_0x4be2('0x67')]['id'],_0x2a8d1e[_0x4be2('0x67')][_0x4be2('0x28')],_0x2a8d1e[_0x4be2('0x67')][_0x4be2('0x6e')],_0x1e27c3[_0x4be2('0x6d')]['id'],_0x2a8d1e[_0x4be2('0x47')]?JSON['stringify'](_0x2a8d1e[_0x4be2('0x47')]):_0x4be2('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x4be2('0x70'),_0x1e27c3);}return null;})[_0x4be2('0x14')](function(_0x46b16e){var _0x179e75=_0x4be2('0x71')+_0x46b16e[_0x4be2('0x1b')][_0x4be2('0x72')];return db[_0x4be2('0x73')][_0x4be2('0x2d')](_0x179e75,{'type':db[_0x4be2('0x74')]['QueryTypes'][_0x4be2('0x75')],'raw':!![]})['then'](function(_0x1afb62){return _0x1afb62;});})['then'](function(_0x5d75b9){if(_0x5d75b9){_0x1e27c3[_0x4be2('0x1b')]['contact']=_0x5d75b9[0x0];if(!_0x2a8d1e['body'][_0x4be2('0x66')])return;return db[_0x4be2('0x76')][_0x4be2('0x46')]({'where':{'id':_0x2a8d1e[_0x4be2('0x47')]['UserId'],'role':'agent'},'attributes':['id','name',_0x4be2('0x77'),_0x4be2('0x78'),_0x4be2('0x79')],'raw':!![]});}return null;})[_0x4be2('0x14')](function(_0x2eac51){if(!_0x2eac51)return null;_0x1e27c3[_0x4be2('0x1b')]['agent']=_0x2eac51;return _0x1e27c3;})[_0x4be2('0x14')](function(_0x5f239e){if(_0x5f239e){if(_0x2a8d1e[_0x4be2('0x47')][_0x4be2('0x7a')]){_0x1e27c3[_0x4be2('0x1b')][_0x4be2('0x7b')]=util[_0x4be2('0x60')](_0x4be2('0x7c'),_0x2a8d1e['user'][_0x4be2('0x28')]);_0x1e27c3['message'][_0x4be2('0x7d')]=_0x1e27c3[_0x4be2('0x7d')];_0x1e27c3[_0x4be2('0x1b')]['motionChannel']=_0x1e27c3[_0x4be2('0x7d')];_0x1e27c3[_0x4be2('0x1b')][_0x4be2('0x7e')]=_0x4be2('0x62');_0x1e27c3[_0x4be2('0x1b')][_0x4be2('0x47')]=htmlToText[_0x4be2('0x7f')](_0x1e27c3[_0x4be2('0x1b')][_0x4be2('0x47')]);return respondWithRpcPromise(_0x4be2('0x80'),_0x4be2('0x80'),{'event':'acceptmessage','message':_0x1e27c3[_0x4be2('0x1b')]},client9002)['then'](function(){return _0x1e27c3;});}return _0x1e27c3;}return null;})['then'](respondWithResult(_0x4abc98,null))['catch'](handleError(_0x4abc98,null));};exports[_0x4be2('0x81')]=function(_0x188ee4,_0x482b27){var _0x5933ea={'agent':{},'channel':_0x4be2('0x82')};if(_0x188ee4[_0x4be2('0x47')]['id']){delete _0x188ee4[_0x4be2('0x47')]['id'];}_0x188ee4[_0x4be2('0x47')][_0x4be2('0x66')]=_0x188ee4[_0x4be2('0x47')][_0x4be2('0x66')]||_0x188ee4['user']['id'];_0x5933ea[_0x4be2('0x68')]['id']=_0x188ee4['body'][_0x4be2('0x66')];return db['MailMessage'][_0x4be2('0x46')]({'where':{'id':_0x188ee4[_0x4be2('0x42')]['id'],'UserId':null}})[_0x4be2('0x14')](handleEntityNotFound(_0x482b27,null))[_0x4be2('0x14')](function(_0x4a70f6){if(_0x4a70f6){_0x5933ea[_0x4be2('0x1b')]=_0x4a70f6[_0x4be2('0x69')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x4a70f6[_0x4be2('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x482b27,null))[_0x4be2('0x14')](function(_0x4a0a0b){if(_0x4a0a0b){_0x5933ea[_0x4be2('0x6d')]=_0x4a0a0b[_0x4be2('0x69')]({'plain':!![]});interaction_log['info'](_0x4be2('0x83'),_0x188ee4[_0x4be2('0x67')]['id'],_0x188ee4[_0x4be2('0x67')]['name'],_0x188ee4[_0x4be2('0x67')][_0x4be2('0x6e')],_0x5933ea[_0x4be2('0x6d')]['id'],_0x188ee4[_0x4be2('0x47')]?JSON[_0x4be2('0x61')](_0x188ee4[_0x4be2('0x47')]):_0x4be2('0x6f'));return respondWithRpcPromise('RejectMessage',_0x4be2('0x84'),_0x5933ea);}return null;})[_0x4be2('0x14')](function(_0x44fc62){var _0x48ced1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x44fc62[_0x4be2('0x1b')][_0x4be2('0x72')];return db[_0x4be2('0x73')][_0x4be2('0x2d')](_0x48ced1,{'type':db[_0x4be2('0x74')][_0x4be2('0x85')][_0x4be2('0x75')],'raw':!![]})[_0x4be2('0x14')](function(_0x451234){return _0x451234;});})[_0x4be2('0x14')](function(_0x17a85a){if(_0x17a85a){_0x5933ea[_0x4be2('0x1b')][_0x4be2('0x86')]=_0x17a85a[0x0];if(!_0x188ee4['body']['UserId'])return;return db[_0x4be2('0x76')][_0x4be2('0x46')]({'where':{'id':_0x188ee4[_0x4be2('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0x4be2('0x28'),_0x4be2('0x77'),'email',_0x4be2('0x79')],'raw':!![]});}return null;})['then'](function(_0x2cf7b6){if(!_0x2cf7b6)return null;_0x5933ea[_0x4be2('0x1b')][_0x4be2('0x68')]=_0x2cf7b6;return _0x5933ea;})[_0x4be2('0x14')](function(_0x3f484b){if(_0x3f484b){_0x3f484b[_0x4be2('0x1b')][_0x4be2('0x7b')]=util[_0x4be2('0x60')]('SIP/%s',_0x188ee4[_0x4be2('0x67')][_0x4be2('0x28')]);_0x3f484b[_0x4be2('0x1b')][_0x4be2('0x7d')]=_0x5933ea[_0x4be2('0x7d')];_0x3f484b[_0x4be2('0x1b')]['motionChannel']=_0x5933ea[_0x4be2('0x7d')];_0x3f484b[_0x4be2('0x1b')][_0x4be2('0x7e')]=_0x4be2('0x81');_0x3f484b[_0x4be2('0x1b')]['body']=htmlToText[_0x4be2('0x7f')](_0x5933ea['message']['body']);respondWithRpcPromise('EventManager',_0x4be2('0x80'),{'event':_0x4be2('0x87'),'message':_0x3f484b[_0x4be2('0x1b')]},client9002);return _0x5933ea;}return null;})[_0x4be2('0x14')](respondWithResult(_0x482b27,null))[_0x4be2('0x1e')](handleError(_0x482b27,null));};exports[_0x4be2('0x88')]=function(_0x75ad66,_0x550f3d){var _0x2be5f9=moment()[_0x4be2('0x89')]()[_0x4be2('0x8a')]();var _0x3ace48=path[_0x4be2('0x59')](config[_0x4be2('0x5a')],_0x4be2('0x8b'),_0x4be2('0x8c'),_0x4be2('0x8d'));var _0x34fd9a=path[_0x4be2('0x59')](config[_0x4be2('0x5a')],'server','files',_0x4be2('0x58'));var _0x5951d2=util[_0x4be2('0x60')](_0x4be2('0x8e'),_0x2be5f9);return db[_0x4be2('0x2b')][_0x4be2('0x46')]({'where':{'id':_0x75ad66[_0x4be2('0x42')]['id']},'attributes':['id',_0x4be2('0x47'),_0x4be2('0x8f'),'to','cc',_0x4be2('0x90'),_0x4be2('0x91'),_0x4be2('0x92')],'include':_0x75ad66[_0x4be2('0x2d')]['attachments']?[{'model':db[_0x4be2('0x93')],'as':_0x4be2('0x94')}]:undefined})[_0x4be2('0x14')](handleEntityNotFound(_0x550f3d,null))[_0x4be2('0x14')](function(_0x18eeed){if(_0x18eeed){var _0x12b6e0=_0x18eeed;var _0x5c3b6a={'from':_0x12b6e0[_0x4be2('0x8f')],'to':_0x12b6e0['to'],'subject':_0x12b6e0['subject'],'html':htmlEntities['decode'](_0x12b6e0[_0x4be2('0x47')]),'headers':{'Date':moment(_0x12b6e0[_0x4be2('0x92')])[_0x4be2('0x60')](_0x4be2('0x95'))},'attachments':[]};if(_0x18eeed['cc']){_0x5c3b6a[_0x4be2('0x96')]['Cc']=_0x18eeed['cc'];}if(_0x18eeed[_0x4be2('0x90')]){_0x5c3b6a[_0x4be2('0x96')][_0x4be2('0x97')]=_0x18eeed[_0x4be2('0x90')];}return new BPromise(function(_0x3b89cd,_0x40c697){if(_0x18eeed['Attachments']){for(var _0x4562e6=0x0;_0x4562e6<_0x18eeed['Attachments']['length'];_0x4562e6++){var _0x2fabf6=_0x18eeed[_0x4be2('0x94')][_0x4562e6];var _0x50c63c=path[_0x4be2('0x59')](_0x34fd9a,_0x2fabf6[_0x4be2('0x5c')]);if(fs[_0x4be2('0x98')](_0x50c63c)){_0x5c3b6a[_0x4be2('0x58')]['push']({'name':_0x2fabf6[_0x4be2('0x28')],'contentType':_0x2fabf6[_0x4be2('0x99')],'data':fs[_0x4be2('0x9a')](_0x50c63c)});}}}emlformat['build'](_0x5c3b6a,function(_0x289379,_0x142301){if(_0x289379)return _0x40c697(_0x289379);fs['writeFileSync'](path[_0x4be2('0x59')](_0x3ace48,_0x5951d2),_0x142301);return _0x3b89cd(_0x142301);});});}})[_0x4be2('0x14')](function(_0x423d24){if(_0x423d24){return _0x550f3d['download'](path[_0x4be2('0x59')](_0x3ace48,_0x5951d2),_0x5951d2,function(_0x432706){if(!_0x432706)fs[_0x4be2('0x9b')](path[_0x4be2('0x59')](_0x3ace48,_0x5951d2));});}})[_0x4be2('0x1e')](handleError(_0x550f3d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 0e24bc3..13eb123 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 _0x08df=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x151a5e,_0x54d5f8){var _0x13d95e=function(_0x44d78e){while(--_0x44d78e){_0x151a5e['push'](_0x151a5e['shift']());}};_0x13d95e(++_0x54d5f8);}(_0x08df,0xf6));var _0xf08d=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x08df[_0xd2d54];return _0x78b113;};'use strict';var EventEmitter=require(_0xf08d('0x0'));var MailMessage=require(_0xf08d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf08d('0x2')](0x0);var events={'afterCreate':_0xf08d('0x3'),'afterUpdate':_0xf08d('0x4'),'afterDestroy':_0xf08d('0x5')};function emitEvent(_0x4f90f2){return function(_0x35a466,_0x18bf56,_0x3b4da4){MailMessageEvents[_0xf08d('0x6')](_0x4f90f2+':'+_0x35a466['id'],_0x35a466);MailMessageEvents['emit'](_0x4f90f2,_0x35a466);_0x3b4da4(null);};}for(var e in events){if(events[_0xf08d('0x7')](e)){var event=events[e];MailMessage[_0xf08d('0x8')](e,emitEvent(event));}}module[_0xf08d('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xe09f=['exports','events','../../mysqldb','MailMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x5d58b0,_0x2fb909){var _0x420579=function(_0x4c7aef){while(--_0x4c7aef){_0x5d58b0['push'](_0x5d58b0['shift']());}};_0x420579(++_0x2fb909);}(_0xe09f,0x19f));var _0xfe09=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe09f[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0xfe09('0x0'));var MailMessage=require(_0xfe09('0x1'))['db'][_0xfe09('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe09('0x3'),'afterUpdate':_0xfe09('0x4'),'afterDestroy':'remove'};function emitEvent(_0x564d7d){return function(_0x24867a,_0x1d3777,_0x3d1585){MailMessageEvents['emit'](_0x564d7d+':'+_0x24867a['id'],_0x24867a);MailMessageEvents[_0xfe09('0x5')](_0x564d7d,_0x24867a);_0x3d1585(null);};}for(var e in events){if(events[_0xfe09('0x6')](e)){var event=events[e];MailMessage[_0xfe09('0x7')](e,emitEvent(event));}}module[_0xfe09('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 2d3e533..7252dcd 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 _0xf3b1=['fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body'];(function(_0x29920c,_0x57fb6f){var _0x49bd86=function(_0x36262e){while(--_0x36262e){_0x29920c['push'](_0x29920c['shift']());}};_0x49bd86(++_0x57fb6f);}(_0xf3b1,0x11d));var _0x1f3b=function(_0x416540,_0x359a85){_0x416540=_0x416540-0x0;var _0x143b2e=_0xf3b1[_0x416540];return _0x143b2e;};'use strict';var _=require(_0x1f3b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1f3b('0x1'));var rp=require(_0x1f3b('0x2'));var htmlToText=require(_0x1f3b('0x3'));var fs=require('fs');var path=require(_0x1f3b('0x4'));var rimraf=require('rimraf');var config=require(_0x1f3b('0x5'));var attributes=require(_0x1f3b('0x6'));module[_0x1f3b('0x7')]=function(_0x31551e,_0x34f2c5){return _0x31551e[_0x1f3b('0x8')](_0x1f3b('0x9'),attributes,{'tableName':_0x1f3b('0xa'),'paranoid':![],'indexes':[{'name':_0x1f3b('0xb'),'fields':[_0x1f3b('0xb')]},{'name':'fti_mail_messages','fields':[_0x1f3b('0xc'),_0x1f3b('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f0ffc,_0x52e3ee,_0x52f6f2){if(_0x3f0ffc[_0x1f3b('0xe')]){_0x3f0ffc[_0x1f3b('0xc')]=htmlToText[_0x1f3b('0xf')](_0x3f0ffc[_0x1f3b('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x52f6f2(null,_0x52e3ee);},'afterCreate':function(_0x41f312,_0x5e3c96,_0x5e56ff){var _0x699dd5=_0x31551e[_0x1f3b('0x10')];var _0x4adf56=_0x41f312[_0x1f3b('0x11')]({'plain':!![]});if(_0x4adf56[_0x1f3b('0x12')][_0x1f3b('0x13')]()==='in'||_0x4adf56[_0x1f3b('0x12')]['toLowerCase']()===_0x1f3b('0x14')&&!_0x4adf56[_0x1f3b('0x15')]&&!_[_0x1f3b('0x16')](_0x4adf56['UserId'])){_0x699dd5[_0x1f3b('0x17')]['findOne']({'where':{'id':_0x4adf56[_0x1f3b('0x18')]}})[_0x1f3b('0x19')](function(_0xff905f){if(_0xff905f){_0xff905f['update']({'lastMsgAt':_0x4adf56[_0x1f3b('0x1a')],'lastMsgDirection':_0x4adf56[_0x1f3b('0x12')]['toLowerCase']()});}})['catch'](function(_0x31ed9b){console[_0x1f3b('0x1b')](_0x31ed9b);});}_0x5e56ff();}},'charset':_0x1f3b('0x1c'),'collate':_0x1f3b('0x1d')});}; \ No newline at end of file +var _0x22f3=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update'];(function(_0x351fcf,_0x53a1ac){var _0x4fdde3=function(_0x5c0825){while(--_0x5c0825){_0x351fcf['push'](_0x351fcf['shift']());}};_0x4fdde3(++_0x53a1ac);}(_0x22f3,0xf3));var _0x322f=function(_0x4de3ae,_0x4c2d83){_0x4de3ae=_0x4de3ae-0x0;var _0x264e7c=_0x22f3[_0x4de3ae];return _0x264e7c;};'use strict';var _=require(_0x322f('0x0'));var util=require(_0x322f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x322f('0x2'));var BPromise=require(_0x322f('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x322f('0x4'));var rimraf=require(_0x322f('0x5'));var config=require(_0x322f('0x6'));var attributes=require(_0x322f('0x7'));module[_0x322f('0x8')]=function(_0x177326,_0x4b9ba5){return _0x177326[_0x322f('0x9')](_0x322f('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x322f('0xb')]},{'name':_0x322f('0xc'),'fields':[_0x322f('0xd'),_0x322f('0xe')],'type':_0x322f('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20656c,_0x8010cd,_0x1dccac){if(_0x20656c[_0x322f('0x10')]){_0x20656c[_0x322f('0xd')]=htmlToText[_0x322f('0x11')](_0x20656c[_0x322f('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1dccac(null,_0x8010cd);},'afterCreate':function(_0x445c4,_0x1fad32,_0x452d2e){var _0x18234c=_0x177326['models'];var _0x342bf7=_0x445c4[_0x322f('0x12')]({'plain':!![]});if(_0x342bf7[_0x322f('0x13')][_0x322f('0x14')]()==='in'||_0x342bf7[_0x322f('0x13')][_0x322f('0x14')]()===_0x322f('0x15')&&!_0x342bf7['secret']&&!_[_0x322f('0x16')](_0x342bf7[_0x322f('0x17')])){_0x18234c[_0x322f('0x18')][_0x322f('0x19')]({'where':{'id':_0x342bf7[_0x322f('0x1a')]}})[_0x322f('0x1b')](function(_0x205d80){if(_0x205d80){_0x205d80[_0x322f('0x1c')]({'lastMsgAt':_0x342bf7[_0x322f('0x1d')],'lastMsgDirection':_0x342bf7[_0x322f('0x13')]['toLowerCase']()});}})[_0x322f('0x1e')](function(_0x2ed207){console[_0x322f('0x1f')](_0x2ed207);});}_0x452d2e();}},'charset':_0x322f('0x20'),'collate':_0x322f('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index cb5a900..46610b0 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 _0xfcbb=['catch','CreateMailMessage','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x213a2b,_0x57e9d6){var _0x2cb5fa=function(_0x182380){while(--_0x182380){_0x213a2b['push'](_0x213a2b['shift']());}};_0x2cb5fa(++_0x57e9d6);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x845b2d,_0xb56e1){_0x845b2d=_0x845b2d-0x0;var _0x2a6513=_0xfcbb[_0x845b2d];return _0x2a6513;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});config[_0xbfcb('0xa')]=_[_0xbfcb('0xb')](config[_0xbfcb('0xa')],{'host':_0xbfcb('0xc'),'port':0x18eb});var socket=require(_0xbfcb('0xd'))(new Redis(config['redis']));require(_0xbfcb('0xe'))[_0xbfcb('0xf')](socket);function respondWithRpcPromise(_0x346685,_0x52b2f8,_0x2c72f3){return new BPromise(function(_0x3d01fa,_0x3e735a){return client[_0xbfcb('0x10')](_0x346685,_0x2c72f3)[_0xbfcb('0x11')](function(_0x1fad67){logger['info'](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));logger[_0xbfcb('0x14')](_0xbfcb('0x15'),_0x52b2f8,'request\x20sent',JSON[_0xbfcb('0x16')](_0x1fad67));if(_0x1fad67['error']){if(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x18')]===0x1f4){logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3e735a(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3d01fa(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}else{logger[_0xbfcb('0x1a')](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));_0x3d01fa(_0x1fad67[_0xbfcb('0x1b')][_0xbfcb('0x19')]);}})[_0xbfcb('0x1c')](function(_0xccd6ff){logger[_0xbfcb('0x17')]('MailMessage,\x20%s,\x20%s',_0x52b2f8,_0xccd6ff);_0x3e735a(_0xccd6ff);});});}exports[_0xbfcb('0x1d')]=function(_0x37263b){var _0x54ec7a=this;return new Promise(function(_0xa3c089,_0x1a7225){return db['MailMessage']['create'](_0x37263b[_0xbfcb('0x1e')],{'raw':_0x37263b[_0xbfcb('0x1f')]?_0x37263b[_0xbfcb('0x1f')][_0xbfcb('0x20')]===undefined?!![]:![]:!![]})[_0xbfcb('0x11')](function(_0x56c158){logger[_0xbfcb('0x1a')](_0xbfcb('0x1d'),_0x37263b);logger[_0xbfcb('0x14')](_0xbfcb('0x1d'),_0x37263b,JSON[_0xbfcb('0x16')](_0x56c158));_0xa3c089(_0x56c158);})[_0xbfcb('0x1c')](function(_0x69c8e9){logger[_0xbfcb('0x17')](_0xbfcb('0x1d'),_0x69c8e9[_0xbfcb('0x19')],_0x37263b);_0x1a7225(_0x54ec7a[_0xbfcb('0x17')](0x1f4,_0x69c8e9[_0xbfcb('0x19')]));});});}; \ No newline at end of file +var _0x8f4c=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','then','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'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x512f8c,_0x3545c1){_0x512f8c=_0x512f8c-0x0;var _0x2099f8=_0x8f4c[_0x512f8c];return _0x2099f8;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc8f4('0xa')](config['redis'],{'host':_0xc8f4('0xb'),'port':0x18eb});var socket=require(_0xc8f4('0xc'))(new Redis(config[_0xc8f4('0xd')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x599de3,_0x38c41b,_0x191b92){return new BPromise(function(_0x2fba62,_0x3a2f8a){return client['request'](_0x599de3,_0x191b92)[_0xc8f4('0x10')](function(_0x52c699){logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));logger[_0xc8f4('0x14')](_0xc8f4('0x15'),_0x38c41b,'request\x20sent',JSON[_0xc8f4('0x16')](_0x52c699));if(_0x52c699[_0xc8f4('0x17')]){if(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x18')]===0x1f4){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x3a2f8a(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x19')]);}logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x2fba62(_0x52c699['error']['message']);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));_0x2fba62(_0x52c699[_0xc8f4('0x1a')][_0xc8f4('0x19')]);}})[_0xc8f4('0x1b')](function(_0x2459ac){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x2459ac);_0x3a2f8a(_0x2459ac);});});}exports[_0xc8f4('0x1c')]=function(_0x3cd90c){var _0x3126e5=this;return new Promise(function(_0x22236c,_0x5f3264){return db[_0xc8f4('0x1d')][_0xc8f4('0x1e')](_0x3cd90c[_0xc8f4('0x1f')],{'raw':_0x3cd90c[_0xc8f4('0x20')]?_0x3cd90c[_0xc8f4('0x20')][_0xc8f4('0x21')]===undefined?!![]:![]:!![]})[_0xc8f4('0x10')](function(_0x43eb57){logger['info'](_0xc8f4('0x1c'),_0x3cd90c);logger[_0xc8f4('0x14')](_0xc8f4('0x1c'),_0x3cd90c,JSON[_0xc8f4('0x16')](_0x43eb57));_0x22236c(_0x43eb57);})['catch'](function(_0x39174f){logger['error'](_0xc8f4('0x1c'),_0x39174f['message'],_0x3cd90c);_0x5f3264(_0x3126e5[_0xc8f4('0x17')](0x1f4,_0x39174f[_0xc8f4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 827577a..afb5c38 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 _0x68de=['length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68de,0xfa));var _0xe68d=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x68de[_0x3c487b];return _0x1d65f6;};'use strict';var MailMessageEvents=require(_0xe68d('0x0'));var events=[_0xe68d('0x1'),_0xe68d('0x2'),'update'];function createListener(_0x33891b,_0x1b8a18){return function(_0x2088e7){_0x1b8a18[_0xe68d('0x3')](_0x33891b,_0x2088e7);};}function removeListener(_0x5536bc,_0x425415){return function(){MailMessageEvents[_0xe68d('0x4')](_0x5536bc,_0x425415);};}exports[_0xe68d('0x5')]=function(_0x21fb14){for(var _0x170c82=0x0,_0x5cd0b5=events[_0xe68d('0x6')];_0x170c82<_0x5cd0b5;_0x170c82++){var _0x4e46f3=events[_0x170c82];var _0x2cf142=createListener(_0xe68d('0x7')+_0x4e46f3,_0x21fb14);MailMessageEvents['on'](_0x4e46f3,_0x2cf142);}}; \ No newline at end of file +var _0x912c=['mailMessage:','save','remove','update','emit','removeListener'];(function(_0x337670,_0x47defa){var _0x3ecc8b=function(_0x1f5822){while(--_0x1f5822){_0x337670['push'](_0x337670['shift']());}};_0x3ecc8b(++_0x47defa);}(_0x912c,0x12d));var _0xc912=function(_0x2c37b2,_0x107055){_0x2c37b2=_0x2c37b2-0x0;var _0x559312=_0x912c[_0x2c37b2];return _0x559312;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc912('0x0'),_0xc912('0x1'),_0xc912('0x2')];function createListener(_0x3a5143,_0x4faa47){return function(_0x188552){_0x4faa47[_0xc912('0x3')](_0x3a5143,_0x188552);};}function removeListener(_0x1bb329,_0x280b0b){return function(){MailMessageEvents[_0xc912('0x4')](_0x1bb329,_0x280b0b);};}exports['register']=function(_0x3e92ba){for(var _0x42ca86=0x0,_0x1e584d=events['length'];_0x42ca86<_0x1e584d;_0x42ca86++){var _0x4c057=events[_0x42ca86];var _0x584879=createListener(_0xc912('0x5')+_0x4c057,_0x3e92ba);MailMessageEvents['on'](_0x4c057,_0x584879);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8560b97..2abe58b 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 _0x0e0c=['destroy','delete','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put'];(function(_0x33e370,_0x3d702a){var _0x27249d=function(_0x49ae88){while(--_0x49ae88){_0x33e370['push'](_0x33e370['shift']());}};_0x27249d(++_0x3d702a);}(_0x0e0c,0xc8));var _0xc0e0=function(_0x59cd0d,_0x10ce55){_0x59cd0d=_0x59cd0d-0x0;var _0x49d1f4=_0x0e0c[_0x59cd0d];return _0x49d1f4;};'use strict';var multer=require('multer');var util=require(_0xc0e0('0x0'));var path=require('path');var timeout=require(_0xc0e0('0x1'));var express=require(_0xc0e0('0x2'));var router=express[_0xc0e0('0x3')]();var fs_extra=require(_0xc0e0('0x4'));var auth=require(_0xc0e0('0x5'));var interaction=require(_0xc0e0('0x6'));var config=require('../../config/environment');var controller=require(_0xc0e0('0x7'));router[_0xc0e0('0x8')]('/',auth[_0xc0e0('0x9')](),controller[_0xc0e0('0xa')]);router['get'](_0xc0e0('0xb'),auth['isAuthenticated'](),controller[_0xc0e0('0xc')]);router[_0xc0e0('0x8')](_0xc0e0('0xd'),auth['isAuthenticated'](),controller[_0xc0e0('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xc0e0('0xf')]);router[_0xc0e0('0x8')](_0xc0e0('0x10'),auth['isAuthenticated'](),controller[_0xc0e0('0x11')]);router[_0xc0e0('0x8')]('/:id/users',auth[_0xc0e0('0x9')](),controller['getAgents']);router[_0xc0e0('0x12')]('/',auth[_0xc0e0('0x9')](),controller[_0xc0e0('0x13')]);router[_0xc0e0('0x12')](_0xc0e0('0x10'),auth[_0xc0e0('0x9')](),controller[_0xc0e0('0x14')]);router[_0xc0e0('0x12')](_0xc0e0('0x15'),auth[_0xc0e0('0x9')](),controller[_0xc0e0('0x16')]);router[_0xc0e0('0x17')](_0xc0e0('0xd'),auth[_0xc0e0('0x9')](),controller['update']);router['delete'](_0xc0e0('0xd'),auth[_0xc0e0('0x9')](),controller[_0xc0e0('0x18')]);router[_0xc0e0('0x19')](_0xc0e0('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc0e0('0x19')](_0xc0e0('0x15'),auth[_0xc0e0('0x9')](),controller[_0xc0e0('0x1a')]);module[_0xc0e0('0x1b')]=router; \ No newline at end of file +var _0x0cdb=['/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x86f20f,_0x2e68cb){var _0x5dd1f1=function(_0x4c580e){while(--_0x4c580e){_0x86f20f['push'](_0x86f20f['shift']());}};_0x5dd1f1(++_0x2e68cb);}(_0x0cdb,0xdd));var _0xb0cd=function(_0x4291dd,_0x95d82){_0x4291dd=_0x4291dd-0x0;var _0x152462=_0x0cdb[_0x4291dd];return _0x152462;};'use strict';var multer=require(_0xb0cd('0x0'));var util=require(_0xb0cd('0x1'));var path=require('path');var timeout=require(_0xb0cd('0x2'));var express=require(_0xb0cd('0x3'));var router=express[_0xb0cd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0cd('0x5'));var config=require(_0xb0cd('0x6'));var controller=require(_0xb0cd('0x7'));router[_0xb0cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0cd('0x9')]);router[_0xb0cd('0x8')](_0xb0cd('0xa'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0xc')]);router['get'](_0xb0cd('0xd'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0xe')]);router['get'](_0xb0cd('0xf'),auth['isAuthenticated'](),controller[_0xb0cd('0x10')]);router[_0xb0cd('0x8')](_0xb0cd('0x11'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x12')]);router[_0xb0cd('0x8')](_0xb0cd('0x13'),auth['isAuthenticated'](),controller[_0xb0cd('0x14')]);router['post']('/',auth[_0xb0cd('0xb')](),controller['create']);router[_0xb0cd('0x15')](_0xb0cd('0x11'),auth[_0xb0cd('0xb')](),controller['addTeams']);router['post'](_0xb0cd('0x13'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x16')]);router[_0xb0cd('0x17')]('/:id',auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x18')]);router[_0xb0cd('0x19')](_0xb0cd('0xd'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x1a')]);router[_0xb0cd('0x19')]('/:id/teams',auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x1b')]);router[_0xb0cd('0x19')](_0xb0cd('0x13'),auth[_0xb0cd('0xb')](),controller[_0xb0cd('0x1c')]);module[_0xb0cd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8c0bbac..6b2650e 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 _0xb551=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0xbb83e,_0x1fff5b){var _0x159734=function(_0x38d955){while(--_0x38d955){_0xbb83e['push'](_0xbb83e['shift']());}};_0x159734(++_0x1fff5b);}(_0xb551,0x181));var _0x1b55=function(_0x2728fc,_0x2bf7a0){_0x2728fc=_0x2728fc-0x0;var _0x4e18e4=_0xb551[_0x2728fc];return _0x4e18e4;};'use strict';var Sequelize=require(_0x1b55('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b55('0x1')],'unique':_0x1b55('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b55('0x1')]},'timeout':{'type':Sequelize[_0x1b55('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b55('0x4')](_0x1b55('0x5'),_0x1b55('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x84ee=['beepall','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x84ee,0x1a5));var _0xe84e=function(_0x212b5d,_0x318113){_0x212b5d=_0x212b5d-0x0;var _0xd29835=_0x84ee[_0x212b5d];return _0xd29835;};'use strict';var Sequelize=require(_0xe84e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe84e('0x1')],'unique':_0xe84e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe84e('0x1')]},'timeout':{'type':Sequelize[_0xe84e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe84e('0x4'),_0xe84e('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a07fa42..abb8e13 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 _0xe168=['include','query','rows','catch','show','keys','filters','attributes','model','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','intersection','hasOwnProperty','order','sort','pick','where','MailQueueId','filter','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','findOne','Team','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','length','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','MailQueues','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','fieldName','key'];(function(_0x47ecd2,_0x2e4be6){var _0x2dc9ea=function(_0x3c7e63){while(--_0x3c7e63){_0x47ecd2['push'](_0x47ecd2['shift']());}};_0x2dc9ea(++_0x2e4be6);}(_0xe168,0x1d7));var _0x8e16=function(_0x38ccdc,_0xd2595a){_0x38ccdc=_0x38ccdc-0x0;var _0xeaf026=_0xe168[_0x38ccdc];return _0xeaf026;};'use strict';var BPromise=require(_0x8e16('0x0'));var util=require(_0x8e16('0x1'));var _=require(_0x8e16('0x2'));var squel=require(_0x8e16('0x3'));var Redis=require('ioredis');var qs=require(_0x8e16('0x4'));var logger=require(_0x8e16('0x5'))('api');var config=require(_0x8e16('0x6'));var db=require(_0x8e16('0x7'))['db'];config[_0x8e16('0x8')]=_['defaults'](config[_0x8e16('0x8')],{'host':_0x8e16('0x9'),'port':0x18eb});var socket=require(_0x8e16('0xa'))(new Redis(config[_0x8e16('0x8')]));require(_0x8e16('0xb'))[_0x8e16('0xc')](socket);function respondWithStatusCode(_0x319919,_0xc9b7db){_0xc9b7db=_0xc9b7db||0xcc;return function(_0x48360e){if(_0x48360e){return _0x319919[_0x8e16('0xd')](_0xc9b7db);}return _0x319919[_0x8e16('0xe')](_0xc9b7db)[_0x8e16('0xf')]();};}function respondWithResult(_0x294945,_0x58c984){_0x58c984=_0x58c984||0xc8;return function(_0x1ffc4a){if(_0x1ffc4a){return _0x294945[_0x8e16('0xe')](_0x58c984)[_0x8e16('0x10')](_0x1ffc4a);}};}function respondWithFilteredResult(_0x134cbe,_0x4e4aa5){return function(_0x37ab9e){if(_0x37ab9e){var _0x419e89=typeof _0x4e4aa5[_0x8e16('0x11')]===_0x8e16('0x12')&&typeof _0x4e4aa5[_0x8e16('0x13')]===_0x8e16('0x12');var _0x5dbefc=_0x37ab9e['count'];var _0x1622a7=_0x419e89?0x0:_0x4e4aa5[_0x8e16('0x11')];var _0x5ea1fb=_0x419e89?_0x37ab9e[_0x8e16('0x14')]:_0x4e4aa5['offset']+_0x4e4aa5[_0x8e16('0x13')];var _0x5430db;if(_0x5ea1fb>=_0x5dbefc){_0x5ea1fb=_0x5dbefc;_0x5430db=0xc8;}else{_0x5430db=0xce;}_0x134cbe['status'](_0x5430db);return _0x134cbe[_0x8e16('0x15')](_0x8e16('0x16'),_0x1622a7+'-'+_0x5ea1fb+'/'+_0x5dbefc)[_0x8e16('0x10')](_0x37ab9e);}return null;};}function saveUpdates(_0x187d7a){return function(_0x108762){if(_0x108762){return _0x108762['update'](_0x187d7a)['then'](function(_0x1e7257){return _0x1e7257;});}return null;};}function removeEntity(_0x534987){return function(_0x199b51){if(_0x199b51){return _0x199b51['destroy']()[_0x8e16('0x17')](function(){var _0x321a57=_0x199b51[_0x8e16('0x18')]({'plain':!![]});var _0x589d6d=_0x8e16('0x19');return db[_0x8e16('0x1a')][_0x8e16('0x1b')]({'where':{'type':_0x589d6d,'resourceId':_0x321a57['id']}})[_0x8e16('0x17')](function(){return _0x199b51;});})[_0x8e16('0x17')](function(){_0x534987[_0x8e16('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1993b7){return function(_0x2a676e){if(!_0x2a676e){_0x1993b7[_0x8e16('0xd')](0x194);}return _0x2a676e;};}function handleError(_0x1d13a4,_0x18190e){_0x18190e=_0x18190e||0x1f4;return function(_0x3d8617){logger[_0x8e16('0x1c')](_0x3d8617['stack']);if(_0x3d8617['name']){delete _0x3d8617[_0x8e16('0x1d')];}_0x1d13a4[_0x8e16('0xe')](_0x18190e)[_0x8e16('0x1e')](_0x3d8617);};}exports[_0x8e16('0x1f')]=function(_0x1406ae,_0x35161d){var _0x22c861={};var _0x1c6eeb={'count':0x0,'rows':[]};var _0x4cc703=_[_0x8e16('0x20')](db[_0x8e16('0x21')][_0x8e16('0x22')],function(_0x41239c){return{'name':_0x41239c[_0x8e16('0x23')],'type':_0x41239c['type'][_0x8e16('0x24')]};});_0x22c861=qs['getOptions'](_0x4cc703,_0x1406ae);var _0x27651f={'where':_0x22c861['where']};return db['MailQueue'][_0x8e16('0x14')](_0x27651f)[_0x8e16('0x17')](function(_0x41da96){_0x1c6eeb[_0x8e16('0x14')]=_0x41da96;_0x22c861['include']=qs[_0x8e16('0x25')](_0x1406ae[_0x8e16('0x26')]);return db[_0x8e16('0x21')]['findAll'](_0x22c861);})[_0x8e16('0x17')](function(_0x2d3705){_0x1c6eeb[_0x8e16('0x27')]=_0x2d3705;return _0x1c6eeb;})[_0x8e16('0x17')](respondWithFilteredResult(_0x35161d,_0x22c861))[_0x8e16('0x28')](handleError(_0x35161d,null));};exports[_0x8e16('0x29')]=function(_0x43c6d9,_0x36d62b){var _0x45c3bd={'raw':!![],'where':{'id':_0x43c6d9['params']['id']}},_0x21d0f4={};_0x21d0f4['model']=_[_0x8e16('0x2a')](db[_0x8e16('0x21')][_0x8e16('0x22')]);_0x21d0f4[_0x8e16('0x26')]=_[_0x8e16('0x2a')](_0x43c6d9[_0x8e16('0x26')]);_0x21d0f4[_0x8e16('0x2b')]=_['intersection'](_0x21d0f4['model'],_0x21d0f4[_0x8e16('0x26')]);_0x45c3bd[_0x8e16('0x2c')]=_['intersection'](_0x21d0f4[_0x8e16('0x2d')],qs[_0x8e16('0x2e')](_0x43c6d9[_0x8e16('0x26')][_0x8e16('0x2e')]));_0x45c3bd[_0x8e16('0x2c')]=_0x45c3bd[_0x8e16('0x2c')]['length']?_0x45c3bd[_0x8e16('0x2c')]:_0x21d0f4['model'];if(_0x43c6d9[_0x8e16('0x26')][_0x8e16('0x2f')]){_0x45c3bd[_0x8e16('0x25')]=[{'all':!![]}];}_0x45c3bd=_[_0x8e16('0x30')]({},_0x45c3bd,_0x43c6d9[_0x8e16('0x31')]);return db[_0x8e16('0x21')][_0x8e16('0x32')](_0x45c3bd)[_0x8e16('0x17')](handleEntityNotFound(_0x36d62b,null))[_0x8e16('0x17')](respondWithResult(_0x36d62b,null))[_0x8e16('0x28')](handleError(_0x36d62b,null));};exports[_0x8e16('0x33')]=function(_0x31c374,_0x2a0369){return db[_0x8e16('0x21')][_0x8e16('0x33')](_0x31c374[_0x8e16('0x34')],{})[_0x8e16('0x17')](function(_0x4883c4){var _0x2e6c39=_0x31c374[_0x8e16('0x35')][_0x8e16('0x18')]({'plain':!![]});if(!_0x2e6c39)throw new Error(_0x8e16('0x36'));if(_0x2e6c39[_0x8e16('0x37')]===_0x8e16('0x35')){var _0x3cb109=_0x4883c4['get']({'plain':!![]});var _0x2bffcb=_0x8e16('0x19');return db[_0x8e16('0x38')][_0x8e16('0x32')]({'where':{'name':_0x2bffcb,'userProfileId':_0x2e6c39['userProfileId']},'raw':!![]})['then'](function(_0x3fa6e6){if(_0x3fa6e6&&_0x3fa6e6[_0x8e16('0x39')]===0x0){return db[_0x8e16('0x1a')][_0x8e16('0x33')]({'name':_0x3cb109[_0x8e16('0x1d')],'resourceId':_0x3cb109['id'],'type':_0x3fa6e6['name'],'sectionId':_0x3fa6e6['id']},{})[_0x8e16('0x17')](function(){return _0x4883c4;});}else{return _0x4883c4;}})['catch'](function(_0x5e4f4c){logger['error'](_0x8e16('0x3a'),_0x5e4f4c);throw _0x5e4f4c;});}return _0x4883c4;})[_0x8e16('0x17')](respondWithResult(_0x2a0369,0xc9))[_0x8e16('0x28')](handleError(_0x2a0369,null));};exports[_0x8e16('0x3b')]=function(_0x2abf99,_0x112925){if(_0x2abf99[_0x8e16('0x34')]['id']){delete _0x2abf99['body']['id'];}return db[_0x8e16('0x21')][_0x8e16('0x32')]({'where':{'id':_0x2abf99[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x112925,null))['then'](saveUpdates(_0x2abf99['body'],null))[_0x8e16('0x17')](respondWithResult(_0x112925,null))[_0x8e16('0x28')](handleError(_0x112925,null));};exports[_0x8e16('0x1b')]=function(_0x2704f8,_0x1a4ff3){return db[_0x8e16('0x21')][_0x8e16('0x32')]({'where':{'id':_0x2704f8[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x1a4ff3,null))[_0x8e16('0x17')](removeEntity(_0x1a4ff3,null))[_0x8e16('0x28')](handleError(_0x1a4ff3,null));};exports[_0x8e16('0x3d')]=function(_0x83ab9f,_0x5985ee){return db['MailQueue'][_0x8e16('0x3d')]()[_0x8e16('0x17')](respondWithResult(_0x5985ee,null))['catch'](handleError(_0x5985ee,null));};exports[_0x8e16('0x3e')]=function(_0x44bba5,_0x4ecc4a){var _0x3d969c={'raw':!![],'where':{}},_0xb60581={},_0x1f9d95;return db['MailQueue']['findOne']({'where':{'id':_0x44bba5[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x4ecc4a,null))[_0x8e16('0x17')](function(_0x5c1200){if(_0x5c1200){_0x1f9d95=_0x5c1200[_0x8e16('0x18')]({'plain':!![]});_0xb60581[_0x8e16('0x2d')]=_['keys'](db['UserMailQueue'][_0x8e16('0x22')]);_0xb60581[_0x8e16('0x26')]=_[_0x8e16('0x2a')](_0x44bba5[_0x8e16('0x26')]);_0xb60581[_0x8e16('0x2b')]=_[_0x8e16('0x3f')](_0xb60581[_0x8e16('0x2d')],_0xb60581[_0x8e16('0x26')]);_0x3d969c[_0x8e16('0x2c')]=_[_0x8e16('0x3f')](_0xb60581['model'],qs[_0x8e16('0x2e')](_0x44bba5[_0x8e16('0x26')]['fields']));_0x3d969c[_0x8e16('0x2c')]=_0x3d969c[_0x8e16('0x2c')]['length']?_0x3d969c[_0x8e16('0x2c')]:_0xb60581[_0x8e16('0x2d')];if(!_0x44bba5[_0x8e16('0x26')][_0x8e16('0x40')]('nolimit')){_0x3d969c[_0x8e16('0x13')]=qs[_0x8e16('0x13')](_0x44bba5[_0x8e16('0x26')]['limit']);_0x3d969c['offset']=qs[_0x8e16('0x11')](_0x44bba5[_0x8e16('0x26')][_0x8e16('0x11')]);}_0x3d969c[_0x8e16('0x41')]=qs[_0x8e16('0x42')](_0x44bba5[_0x8e16('0x26')][_0x8e16('0x42')]);_0x3d969c['where']=qs[_0x8e16('0x2b')](_[_0x8e16('0x43')](_0x44bba5['query'],_0xb60581[_0x8e16('0x2b')]));_0x3d969c[_0x8e16('0x44')][_0x8e16('0x45')]=_0x5c1200['id'];if(_0x44bba5[_0x8e16('0x26')][_0x8e16('0x46')]){_0x3d969c[_0x8e16('0x44')]=_['merge'](_0x3d969c[_0x8e16('0x44')],{'$or':_[_0x8e16('0x20')](_0x3d969c[_0x8e16('0x2c')],function(_0x4d4ca5){var _0x388b2c={};_0x388b2c[_0x4d4ca5]={'$like':'%'+_0x44bba5[_0x8e16('0x26')][_0x8e16('0x46')]+'%'};return _0x388b2c;})});}_0x3d969c=_[_0x8e16('0x30')]({},_0x3d969c,_0x44bba5['options']);return db['UserMailQueue'][_0x8e16('0x47')](_0x3d969c);}})['then'](function(_0x2856ea){if(_0x2856ea){return db[_0x8e16('0x48')][_0x8e16('0x49')]({'where':{'id':_[_0x8e16('0x20')](_0x2856ea,_0x8e16('0x4a')),'role':_0x8e16('0x4b')},'attributes':['id',_0x8e16('0x1d'),'mailPause',_0x8e16('0x4c'),_0x8e16('0x4d')]});}})[_0x8e16('0x17')](function(_0x376e6d){if(_0x376e6d){return{'count':_0x376e6d['count'],'rows':_[_0x8e16('0x20')](_0x376e6d[_0x8e16('0x27')],function(_0x30eba6){return{'membername':_0x30eba6['name'],'UserId':_0x30eba6['id'],'queue_name':_0x1f9d95[_0x8e16('0x1d')],'MailQueueId':_0x1f9d95['id'],'interface':util['format'](_0x8e16('0x4e'),_0x8e16('0x4f'),_0x30eba6[_0x8e16('0x1d')]),'penalty':0x0,'paused':_0x30eba6[_0x8e16('0x50')],'createdAt':_0x30eba6[_0x8e16('0x4d')],'updatedAt':_0x30eba6[_0x8e16('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8e16('0x17')](respondWithFilteredResult(_0x4ecc4a,_0x3d969c))['catch'](handleError(_0x4ecc4a,null));};exports[_0x8e16('0x51')]=function(_0x164016,_0x3a5085){var _0xcf8912={};var _0x1801e1={};var _0x112e8b;var _0x2c91fb;return db['MailQueue'][_0x8e16('0x52')]({'where':{'id':_0x164016[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x3a5085,null))['then'](function(_0x9e786a){if(_0x9e786a){_0x112e8b=_0x9e786a;_0x1801e1[_0x8e16('0x2d')]=_[_0x8e16('0x2a')](db[_0x8e16('0x53')][_0x8e16('0x22')]);_0x1801e1[_0x8e16('0x26')]=_[_0x8e16('0x2a')](_0x164016['query']);_0x1801e1['filters']=_[_0x8e16('0x3f')](_0x1801e1[_0x8e16('0x2d')],_0x1801e1[_0x8e16('0x26')]);_0xcf8912[_0x8e16('0x2c')]=_[_0x8e16('0x3f')](_0x1801e1[_0x8e16('0x2d')],qs[_0x8e16('0x2e')](_0x164016['query']['fields']));_0xcf8912[_0x8e16('0x2c')]=_0xcf8912[_0x8e16('0x2c')]['length']?_0xcf8912['attributes']:_0x1801e1['model'];_0xcf8912[_0x8e16('0x41')]=qs[_0x8e16('0x42')](_0x164016[_0x8e16('0x26')]['sort']);_0xcf8912[_0x8e16('0x44')]=qs[_0x8e16('0x2b')](_[_0x8e16('0x43')](_0x164016['query'],_0x1801e1[_0x8e16('0x2b')]));if(_0x164016[_0x8e16('0x26')][_0x8e16('0x46')]){_0xcf8912[_0x8e16('0x44')]=_[_0x8e16('0x30')](_0xcf8912['where'],{'$or':_[_0x8e16('0x20')](_0xcf8912[_0x8e16('0x2c')],function(_0x1f144c){var _0x5081f7={};_0x5081f7[_0x1f144c]={'$like':'%'+_0x164016[_0x8e16('0x26')][_0x8e16('0x46')]+'%'};return _0x5081f7;})});}_0xcf8912=_[_0x8e16('0x30')]({},_0xcf8912,_0x164016[_0x8e16('0x31')]);return _0x112e8b['getTeams'](_0xcf8912);}})['then'](function(_0x184c6a){if(_0x184c6a){_0x2c91fb=_0x184c6a['length'];if(!_0x164016[_0x8e16('0x26')]['hasOwnProperty'](_0x8e16('0x54'))){_0xcf8912[_0x8e16('0x13')]=qs[_0x8e16('0x13')](_0x164016[_0x8e16('0x26')]['limit']);_0xcf8912[_0x8e16('0x11')]=qs[_0x8e16('0x11')](_0x164016[_0x8e16('0x26')][_0x8e16('0x11')]);}return _0x112e8b['getTeams'](_0xcf8912);}})[_0x8e16('0x17')](function(_0x563127){if(_0x563127){return _0x563127?{'count':_0x2c91fb,'rows':_0x563127}:null;}})[_0x8e16('0x17')](respondWithResult(_0x3a5085,null))['catch'](handleError(_0x3a5085,null));};exports[_0x8e16('0x55')]=function(_0x2dbd95,_0x50498a){var _0x4563c9=_0x2dbd95[_0x8e16('0x34')][_0x8e16('0x56')];return db['Team'][_0x8e16('0x47')]({'where':{'id':_0x4563c9},'attributes':['id'],'include':[{'model':db[_0x8e16('0x48')],'as':'Agents','attributes':['id',_0x8e16('0x1d'),'online',_0x8e16('0x57'),_0x8e16('0x58')],'raw':!![]}]})[_0x8e16('0x17')](function(_0x25c363){if(_0x25c363){var _0x2b276c=_[_0x8e16('0x59')](_0x25c363,function(_0x2d4d1a){var _0x30582a=_0x2d4d1a[_0x8e16('0x18')]({'plain':!![]});return _0x30582a[_0x8e16('0x5a')];});return db[_0x8e16('0x21')][_0x8e16('0x32')]({'where':{'id':_0x2dbd95[_0x8e16('0x3c')]['id']}})['then'](function(_0x21885b){return db[_0x8e16('0x5b')][_0x8e16('0x5c')](function(_0x47f63f){return _0x21885b[_0x8e16('0x55')](_0x4563c9,{'transaction':_0x47f63f})[_0x8e16('0x17')](function(){return BPromise[_0x8e16('0x5d')](_0x2b276c,function(_0x149e86){return db['UserMailQueue'][_0x8e16('0x5e')]({'where':{'UserId':_0x149e86['id'],'MailQueueId':_0x2dbd95[_0x8e16('0x3c')]['id']},'transaction':_0x47f63f});});})[_0x8e16('0x17')](function(){_0x2b276c[_0x8e16('0x5f')](function(_0x5b8750){socket[_0x8e16('0x60')]('userMailQueue:save',{'UserId':_0x5b8750['id'],'MailQueueId':_0x21885b['id']});});});});});}})['then'](respondWithStatusCode(_0x50498a,null))[_0x8e16('0x28')](handleError(_0x50498a,null));};exports[_0x8e16('0x61')]=function(_0x2ea4b2,_0x5a28a0){return db[_0x8e16('0x53')][_0x8e16('0x47')]({'where':{'id':_0x2ea4b2[_0x8e16('0x26')][_0x8e16('0x56')]},'attributes':['id'],'include':[{'model':db[_0x8e16('0x48')],'as':_0x8e16('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x8e16('0x17')](handleEntityNotFound(_0x5a28a0,null))['then'](function(_0x3ecb1d){var _0x4598b4=_[_0x8e16('0x20')](_0x3ecb1d,'id');var _0x2e27d3=[];var _0x4f909a=[];var _0x380585=squel[_0x8e16('0x62')]();_0x380585['field'](_0x8e16('0x63'))[_0x8e16('0x64')](_0x8e16('0x65'),'tq')[_0x8e16('0x66')](_0x8e16('0x67'),'ut',_0x8e16('0x68'))[_0x8e16('0x44')](_0x8e16('0x69'),_0x2ea4b2['params']['id']);for(var _0x4b27fb=0x0;_0x4b27fb<_0x3ecb1d[_0x8e16('0x6a')];_0x4b27fb+=0x1){let _0x452da1=_0x3ecb1d[_0x4b27fb];for(var _0x24733f=0x0;_0x24733f<_0x452da1['Agents'][_0x8e16('0x6a')];_0x24733f+=0x1){let _0x288f75=_0x452da1['Agents'][_0x24733f];var _0x24504f=_0x380585[_0x8e16('0x6b')]();_0x24504f[_0x8e16('0x44')](_0x8e16('0x6c'),_0x288f75['id']);_0x4f909a[_0x8e16('0x6d')](db['sequelize'][_0x8e16('0x26')](_0x24504f[_0x8e16('0x6e')](),{'type':db[_0x8e16('0x5b')][_0x8e16('0x6f')][_0x8e16('0x70')]})[_0x8e16('0x17')](function(_0x5e33ce){if(_0x5e33ce[_0x8e16('0x6a')]===0x1){return _0x288f75['id'];}else{var _0x6fd3b9=_[_0x8e16('0x71')](_[_0x8e16('0x20')](_0x5e33ce,'TeamId'),function(_0x5b43f9){return _[_0x8e16('0x72')](_0x4598b4,_0x5b43f9);});if(_0x6fd3b9){return _0x288f75['id'];}}}));}}return BPromise[_0x8e16('0x73')](_0x4f909a)[_0x8e16('0x17')](function(_0x3e8a9c){_0x2e27d3=_(_0x2e27d3)[_0x8e16('0x74')](_0x3e8a9c)[_0x8e16('0x75')]()['value']();return db['MailQueue'][_0x8e16('0x32')]({'where':{'id':_0x2ea4b2[_0x8e16('0x3c')]['id']}})['then'](function(_0x58e44b){return db[_0x8e16('0x5b')][_0x8e16('0x5c')](function(_0x184873){return _0x58e44b[_0x8e16('0x61')](_0x2ea4b2[_0x8e16('0x26')]['ids'],{'transaction':_0x184873})['then'](function(){if(!_[_0x8e16('0x76')](_0x2e27d3)){return _0x58e44b[_0x8e16('0x77')](_0x2e27d3,{'transaction':_0x184873});}})['then'](function(){_0x2e27d3[_0x8e16('0x5f')](function(_0x5a2b67){socket[_0x8e16('0x60')](_0x8e16('0x78'),{'UserId':_0x5a2b67,'MailQueueId':_0x58e44b['id']});});});});});});})['then'](respondWithStatusCode(_0x5a28a0,null))[_0x8e16('0x28')](handleError(_0x5a28a0,null));};exports[_0x8e16('0x79')]=function(_0x582392,_0x419ea8){return db[_0x8e16('0x21')][_0x8e16('0x32')]({'where':{'id':_0x582392[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x419ea8,null))[_0x8e16('0x17')](function(_0x42fbdf){if(_0x42fbdf){return _0x42fbdf[_0x8e16('0x79')](_0x582392[_0x8e16('0x34')][_0x8e16('0x56')],_[_0x8e16('0x7a')](_0x582392['body'],[_0x8e16('0x56'),'id'])||{})[_0x8e16('0x7b')](function(_0x280a27){for(var _0x10a862=0x0;_0x10a862<_0x582392[_0x8e16('0x34')][_0x8e16('0x56')][_0x8e16('0x6a')];_0x10a862+=0x1){socket['emit'](_0x8e16('0x7c'),{'UserId':Number(_0x582392[_0x8e16('0x34')][_0x8e16('0x56')][_0x10a862]),'MailQueueId':Number(_0x582392[_0x8e16('0x3c')]['id'])});}return _0x280a27;});}})[_0x8e16('0x17')](respondWithResult(_0x419ea8,null))[_0x8e16('0x28')](handleError(_0x419ea8,null));};exports[_0x8e16('0x77')]=function(_0xcdbe89,_0x4213c0){return db[_0x8e16('0x21')]['find']({'where':{'id':_0xcdbe89[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x4213c0,null))['then'](function(_0x4b6edb){if(_0x4b6edb){return _0x4b6edb['removeAgents'](_0xcdbe89[_0x8e16('0x26')]['ids'])['then'](function(){if(_[_0x8e16('0x7d')](_0xcdbe89[_0x8e16('0x26')][_0x8e16('0x56')])){for(var _0x2f3aa0=0x0;_0x2f3aa0<_0xcdbe89[_0x8e16('0x26')][_0x8e16('0x56')][_0x8e16('0x6a')];_0x2f3aa0+=0x1){socket[_0x8e16('0x60')]('userMailQueue:remove',{'UserId':Number(_0xcdbe89['query'][_0x8e16('0x56')][_0x2f3aa0]),'MailQueueId':Number(_0xcdbe89[_0x8e16('0x3c')]['id'])});}}else{socket[_0x8e16('0x60')](_0x8e16('0x78'),{'UserId':Number(_0xcdbe89[_0x8e16('0x26')][_0x8e16('0x56')]),'MailQueueId':Number(_0xcdbe89[_0x8e16('0x3c')]['id'])});}});}})[_0x8e16('0x17')](respondWithStatusCode(_0x4213c0,null))[_0x8e16('0x28')](handleError(_0x4213c0,null));};exports[_0x8e16('0x7e')]=function(_0x6cd327,_0x303a7b){var _0x4ef769={};var _0x39b7cd={};var _0x5a2416;var _0x2c43c4;return db[_0x8e16('0x21')][_0x8e16('0x52')]({'where':{'id':_0x6cd327[_0x8e16('0x3c')]['id']}})[_0x8e16('0x17')](handleEntityNotFound(_0x303a7b,null))[_0x8e16('0x17')](function(_0x44ac92){if(_0x44ac92){_0x5a2416=_0x44ac92;_0x39b7cd[_0x8e16('0x2d')]=_['keys'](db[_0x8e16('0x48')]['rawAttributes']);_0x39b7cd[_0x8e16('0x26')]=_[_0x8e16('0x2a')](_0x6cd327[_0x8e16('0x26')]);_0x39b7cd[_0x8e16('0x2b')]=_['intersection'](_0x39b7cd[_0x8e16('0x2d')],_0x39b7cd[_0x8e16('0x26')]);_0x4ef769[_0x8e16('0x2c')]=_['intersection'](_0x39b7cd[_0x8e16('0x2d')],qs[_0x8e16('0x2e')](_0x6cd327['query'][_0x8e16('0x2e')]));_0x4ef769[_0x8e16('0x2c')]=_0x4ef769[_0x8e16('0x2c')][_0x8e16('0x6a')]?_0x4ef769[_0x8e16('0x2c')]:_0x39b7cd[_0x8e16('0x2d')];_0x4ef769['order']=qs['sort'](_0x6cd327[_0x8e16('0x26')][_0x8e16('0x42')]);_0x4ef769[_0x8e16('0x44')]=qs[_0x8e16('0x2b')](_[_0x8e16('0x43')](_0x6cd327[_0x8e16('0x26')],_0x39b7cd[_0x8e16('0x2b')]));if(_0x6cd327['query']['filter']){_0x4ef769['where']=_['merge'](_0x4ef769['where'],{'$or':_[_0x8e16('0x20')](_0x4ef769['attributes'],function(_0x1bd8fa){var _0x5322ee={};_0x5322ee[_0x1bd8fa]={'$like':'%'+_0x6cd327['query'][_0x8e16('0x46')]+'%'};return _0x5322ee;})});}_0x4ef769=_['merge']({},_0x4ef769,_0x6cd327['options']);return _0x5a2416[_0x8e16('0x7e')](_0x4ef769);}})[_0x8e16('0x17')](function(_0x2f8edc){if(_0x2f8edc){_0x2c43c4=_0x2f8edc[_0x8e16('0x6a')];if(!_0x6cd327[_0x8e16('0x26')]['hasOwnProperty'](_0x8e16('0x54'))){_0x4ef769[_0x8e16('0x13')]=qs[_0x8e16('0x13')](_0x6cd327[_0x8e16('0x26')][_0x8e16('0x13')]);_0x4ef769[_0x8e16('0x11')]=qs['offset'](_0x6cd327[_0x8e16('0x26')]['offset']);}return _0x5a2416['getAgents'](_0x4ef769);}})[_0x8e16('0x17')](function(_0x40c0e7){if(_0x40c0e7){return _0x40c0e7?{'count':_0x2c43c4,'rows':_0x40c0e7}:null;}})[_0x8e16('0x17')](respondWithResult(_0x303a7b,null))[_0x8e16('0x28')](handleError(_0x303a7b,null));}; \ No newline at end of file +var _0x93e0=['stack','name','send','map','rawAttributes','type','key','getOptions','where','MailQueue','include','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','MailQueueId','filter','merge','UserMailQueue','User','findAndCountAll','UserId','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','length','ids','findAll','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','userMailQueue:save','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0x93e0,0xd3));var _0x093e=function(_0x36029e,_0x24068f){_0x36029e=_0x36029e-0x0;var _0x3fdb1a=_0x93e0[_0x36029e];return _0x3fdb1a;};'use strict';var BPromise=require(_0x093e('0x0'));var util=require(_0x093e('0x1'));var _=require(_0x093e('0x2'));var squel=require(_0x093e('0x3'));var Redis=require(_0x093e('0x4'));var qs=require(_0x093e('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x093e('0x6'));var db=require(_0x093e('0x7'))['db'];config[_0x093e('0x8')]=_[_0x093e('0x9')](config[_0x093e('0x8')],{'host':_0x093e('0xa'),'port':0x18eb});var socket=require(_0x093e('0xb'))(new Redis(config[_0x093e('0x8')]));require(_0x093e('0xc'))[_0x093e('0xd')](socket);function respondWithStatusCode(_0x1bbbba,_0x5189a3){_0x5189a3=_0x5189a3||0xcc;return function(_0x29e904){if(_0x29e904){return _0x1bbbba[_0x093e('0xe')](_0x5189a3);}return _0x1bbbba[_0x093e('0xf')](_0x5189a3)[_0x093e('0x10')]();};}function respondWithResult(_0x4445a8,_0xff4295){_0xff4295=_0xff4295||0xc8;return function(_0x4ef921){if(_0x4ef921){return _0x4445a8[_0x093e('0xf')](_0xff4295)[_0x093e('0x11')](_0x4ef921);}};}function respondWithFilteredResult(_0x33529b,_0x235465){return function(_0x537033){if(_0x537033){var _0xa8586c=typeof _0x235465[_0x093e('0x12')]==='undefined'&&typeof _0x235465[_0x093e('0x13')]==='undefined';var _0x186c18=_0x537033[_0x093e('0x14')];var _0x3e1092=_0xa8586c?0x0:_0x235465[_0x093e('0x12')];var _0x16d94f=_0xa8586c?_0x537033['count']:_0x235465['offset']+_0x235465[_0x093e('0x13')];var _0x5f5be2;if(_0x16d94f>=_0x186c18){_0x16d94f=_0x186c18;_0x5f5be2=0xc8;}else{_0x5f5be2=0xce;}_0x33529b['status'](_0x5f5be2);return _0x33529b[_0x093e('0x15')](_0x093e('0x16'),_0x3e1092+'-'+_0x16d94f+'/'+_0x186c18)[_0x093e('0x11')](_0x537033);}return null;};}function saveUpdates(_0x3e27e4){return function(_0x58c8e9){if(_0x58c8e9){return _0x58c8e9[_0x093e('0x17')](_0x3e27e4)[_0x093e('0x18')](function(_0x24c042){return _0x24c042;});}return null;};}function removeEntity(_0x2ee3ea){return function(_0x4d5b6c){if(_0x4d5b6c){return _0x4d5b6c[_0x093e('0x19')]()['then'](function(){var _0x546a5b=_0x4d5b6c[_0x093e('0x1a')]({'plain':!![]});var _0x36ecd6='MailQueues';return db[_0x093e('0x1b')][_0x093e('0x19')]({'where':{'type':_0x36ecd6,'resourceId':_0x546a5b['id']}})['then'](function(){return _0x4d5b6c;});})['then'](function(){_0x2ee3ea[_0x093e('0xf')](0xcc)[_0x093e('0x10')]();});}};}function handleEntityNotFound(_0x125bd9){return function(_0x3927b9){if(!_0x3927b9){_0x125bd9[_0x093e('0xe')](0x194);}return _0x3927b9;};}function handleError(_0x98b82c,_0x44796c){_0x44796c=_0x44796c||0x1f4;return function(_0x1d3cb0){logger[_0x093e('0x1c')](_0x1d3cb0[_0x093e('0x1d')]);if(_0x1d3cb0[_0x093e('0x1e')]){delete _0x1d3cb0['name'];}_0x98b82c[_0x093e('0xf')](_0x44796c)[_0x093e('0x1f')](_0x1d3cb0);};}exports['index']=function(_0x4b343e,_0x360e60){var _0x1cc128={};var _0x15ed58={'count':0x0,'rows':[]};var _0x22257f=_[_0x093e('0x20')](db['MailQueue'][_0x093e('0x21')],function(_0x39e0b2){return{'name':_0x39e0b2['fieldName'],'type':_0x39e0b2[_0x093e('0x22')][_0x093e('0x23')]};});_0x1cc128=qs[_0x093e('0x24')](_0x22257f,_0x4b343e);var _0x3b284d={'where':_0x1cc128[_0x093e('0x25')]};return db[_0x093e('0x26')][_0x093e('0x14')](_0x3b284d)['then'](function(_0x124088){_0x15ed58[_0x093e('0x14')]=_0x124088;_0x1cc128[_0x093e('0x27')]=qs[_0x093e('0x27')](_0x4b343e['query']);return db[_0x093e('0x26')]['findAll'](_0x1cc128);})[_0x093e('0x18')](function(_0x15240d){_0x15ed58['rows']=_0x15240d;return _0x15ed58;})[_0x093e('0x18')](respondWithFilteredResult(_0x360e60,_0x1cc128))['catch'](handleError(_0x360e60,null));};exports[_0x093e('0x28')]=function(_0x40f993,_0x42361b){var _0x3de4cd={'raw':!![],'where':{'id':_0x40f993[_0x093e('0x29')]['id']}},_0x22963b={};_0x22963b[_0x093e('0x2a')]=_[_0x093e('0x2b')](db[_0x093e('0x26')][_0x093e('0x21')]);_0x22963b[_0x093e('0x2c')]=_[_0x093e('0x2b')](_0x40f993['query']);_0x22963b[_0x093e('0x2d')]=_[_0x093e('0x2e')](_0x22963b[_0x093e('0x2a')],_0x22963b[_0x093e('0x2c')]);_0x3de4cd[_0x093e('0x2f')]=_[_0x093e('0x2e')](_0x22963b[_0x093e('0x2a')],qs['fields'](_0x40f993[_0x093e('0x2c')][_0x093e('0x30')]));_0x3de4cd[_0x093e('0x2f')]=_0x3de4cd[_0x093e('0x2f')]['length']?_0x3de4cd[_0x093e('0x2f')]:_0x22963b[_0x093e('0x2a')];if(_0x40f993[_0x093e('0x2c')][_0x093e('0x31')]){_0x3de4cd['include']=[{'all':!![]}];}_0x3de4cd=_['merge']({},_0x3de4cd,_0x40f993[_0x093e('0x32')]);return db['MailQueue']['find'](_0x3de4cd)['then'](handleEntityNotFound(_0x42361b,null))[_0x093e('0x18')](respondWithResult(_0x42361b,null))[_0x093e('0x33')](handleError(_0x42361b,null));};exports[_0x093e('0x34')]=function(_0x1b7cbc,_0x500d7d){return db[_0x093e('0x26')][_0x093e('0x34')](_0x1b7cbc[_0x093e('0x35')],{})[_0x093e('0x18')](function(_0x324e30){var _0x159a27=_0x1b7cbc['user'][_0x093e('0x1a')]({'plain':!![]});if(!_0x159a27)throw new Error(_0x093e('0x36'));if(_0x159a27['role']==='user'){var _0x150b89=_0x324e30['get']({'plain':!![]});var _0x1d6f6a='MailQueues';return db[_0x093e('0x37')]['find']({'where':{'name':_0x1d6f6a,'userProfileId':_0x159a27[_0x093e('0x38')]},'raw':!![]})[_0x093e('0x18')](function(_0x80e236){if(_0x80e236&&_0x80e236[_0x093e('0x39')]===0x0){return db[_0x093e('0x1b')][_0x093e('0x34')]({'name':_0x150b89[_0x093e('0x1e')],'resourceId':_0x150b89['id'],'type':_0x80e236[_0x093e('0x1e')],'sectionId':_0x80e236['id']},{})[_0x093e('0x18')](function(){return _0x324e30;});}else{return _0x324e30;}})[_0x093e('0x33')](function(_0x4baab0){logger['error'](_0x093e('0x3a'),_0x4baab0);throw _0x4baab0;});}return _0x324e30;})[_0x093e('0x18')](respondWithResult(_0x500d7d,0xc9))[_0x093e('0x33')](handleError(_0x500d7d,null));};exports[_0x093e('0x17')]=function(_0x3f0d02,_0x277b3a){if(_0x3f0d02['body']['id']){delete _0x3f0d02[_0x093e('0x35')]['id'];}return db[_0x093e('0x26')][_0x093e('0x3b')]({'where':{'id':_0x3f0d02[_0x093e('0x29')]['id']}})[_0x093e('0x18')](handleEntityNotFound(_0x277b3a,null))[_0x093e('0x18')](saveUpdates(_0x3f0d02['body'],null))['then'](respondWithResult(_0x277b3a,null))[_0x093e('0x33')](handleError(_0x277b3a,null));};exports['destroy']=function(_0x3b6467,_0x3ab099){return db[_0x093e('0x26')][_0x093e('0x3b')]({'where':{'id':_0x3b6467[_0x093e('0x29')]['id']}})[_0x093e('0x18')](handleEntityNotFound(_0x3ab099,null))['then'](removeEntity(_0x3ab099,null))[_0x093e('0x33')](handleError(_0x3ab099,null));};exports[_0x093e('0x3c')]=function(_0x4b69d8,_0x11fb2c){return db[_0x093e('0x26')][_0x093e('0x3c')]()[_0x093e('0x18')](respondWithResult(_0x11fb2c,null))[_0x093e('0x33')](handleError(_0x11fb2c,null));};exports[_0x093e('0x3d')]=function(_0x398f0e,_0x2fd44d){var _0x116496={'raw':!![],'where':{}},_0x2847ec={},_0x382cef;return db[_0x093e('0x26')][_0x093e('0x3e')]({'where':{'id':_0x398f0e[_0x093e('0x29')]['id']}})['then'](handleEntityNotFound(_0x2fd44d,null))[_0x093e('0x18')](function(_0x34cd29){if(_0x34cd29){_0x382cef=_0x34cd29[_0x093e('0x1a')]({'plain':!![]});_0x2847ec[_0x093e('0x2a')]=_[_0x093e('0x2b')](db['UserMailQueue'][_0x093e('0x21')]);_0x2847ec[_0x093e('0x2c')]=_['keys'](_0x398f0e[_0x093e('0x2c')]);_0x2847ec[_0x093e('0x2d')]=_[_0x093e('0x2e')](_0x2847ec[_0x093e('0x2a')],_0x2847ec[_0x093e('0x2c')]);_0x116496[_0x093e('0x2f')]=_[_0x093e('0x2e')](_0x2847ec['model'],qs[_0x093e('0x30')](_0x398f0e['query'][_0x093e('0x30')]));_0x116496['attributes']=_0x116496['attributes']['length']?_0x116496[_0x093e('0x2f')]:_0x2847ec[_0x093e('0x2a')];if(!_0x398f0e[_0x093e('0x2c')][_0x093e('0x3f')](_0x093e('0x40'))){_0x116496[_0x093e('0x13')]=qs[_0x093e('0x13')](_0x398f0e[_0x093e('0x2c')]['limit']);_0x116496['offset']=qs[_0x093e('0x12')](_0x398f0e[_0x093e('0x2c')][_0x093e('0x12')]);}_0x116496['order']=qs[_0x093e('0x41')](_0x398f0e['query'][_0x093e('0x41')]);_0x116496[_0x093e('0x25')]=qs[_0x093e('0x2d')](_['pick'](_0x398f0e[_0x093e('0x2c')],_0x2847ec[_0x093e('0x2d')]));_0x116496['where'][_0x093e('0x42')]=_0x34cd29['id'];if(_0x398f0e[_0x093e('0x2c')][_0x093e('0x43')]){_0x116496['where']=_[_0x093e('0x44')](_0x116496['where'],{'$or':_['map'](_0x116496['attributes'],function(_0x58289b){var _0x87f04={};_0x87f04[_0x58289b]={'$like':'%'+_0x398f0e[_0x093e('0x2c')][_0x093e('0x43')]+'%'};return _0x87f04;})});}_0x116496=_[_0x093e('0x44')]({},_0x116496,_0x398f0e[_0x093e('0x32')]);return db[_0x093e('0x45')]['findAll'](_0x116496);}})[_0x093e('0x18')](function(_0x41931d){if(_0x41931d){return db[_0x093e('0x46')][_0x093e('0x47')]({'where':{'id':_[_0x093e('0x20')](_0x41931d,_0x093e('0x48')),'role':'agent'},'attributes':['id',_0x093e('0x1e'),'mailPause','updatedAt',_0x093e('0x49')]});}})[_0x093e('0x18')](function(_0x2a4bf8){if(_0x2a4bf8){return{'count':_0x2a4bf8[_0x093e('0x14')],'rows':_[_0x093e('0x20')](_0x2a4bf8['rows'],function(_0x59fb52){return{'membername':_0x59fb52['name'],'UserId':_0x59fb52['id'],'queue_name':_0x382cef['name'],'MailQueueId':_0x382cef['id'],'interface':util[_0x093e('0x4a')](_0x093e('0x4b'),_0x093e('0x4c'),_0x59fb52[_0x093e('0x1e')]),'penalty':0x0,'paused':_0x59fb52['mailPause'],'createdAt':_0x59fb52[_0x093e('0x49')],'updatedAt':_0x59fb52[_0x093e('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x093e('0x18')](respondWithFilteredResult(_0x2fd44d,_0x116496))[_0x093e('0x33')](handleError(_0x2fd44d,null));};exports[_0x093e('0x4e')]=function(_0x12007e,_0x49f50b){var _0x18293f={};var _0x1f891a={};var _0x4fc258;var _0x127368;return db[_0x093e('0x26')][_0x093e('0x3e')]({'where':{'id':_0x12007e[_0x093e('0x29')]['id']}})[_0x093e('0x18')](handleEntityNotFound(_0x49f50b,null))[_0x093e('0x18')](function(_0x5d7b02){if(_0x5d7b02){_0x4fc258=_0x5d7b02;_0x1f891a['model']=_[_0x093e('0x2b')](db[_0x093e('0x4f')][_0x093e('0x21')]);_0x1f891a[_0x093e('0x2c')]=_[_0x093e('0x2b')](_0x12007e['query']);_0x1f891a[_0x093e('0x2d')]=_['intersection'](_0x1f891a[_0x093e('0x2a')],_0x1f891a[_0x093e('0x2c')]);_0x18293f[_0x093e('0x2f')]=_['intersection'](_0x1f891a[_0x093e('0x2a')],qs[_0x093e('0x30')](_0x12007e[_0x093e('0x2c')][_0x093e('0x30')]));_0x18293f['attributes']=_0x18293f[_0x093e('0x2f')][_0x093e('0x50')]?_0x18293f[_0x093e('0x2f')]:_0x1f891a[_0x093e('0x2a')];_0x18293f['order']=qs['sort'](_0x12007e[_0x093e('0x2c')][_0x093e('0x41')]);_0x18293f[_0x093e('0x25')]=qs['filters'](_['pick'](_0x12007e[_0x093e('0x2c')],_0x1f891a[_0x093e('0x2d')]));if(_0x12007e[_0x093e('0x2c')][_0x093e('0x43')]){_0x18293f[_0x093e('0x25')]=_[_0x093e('0x44')](_0x18293f['where'],{'$or':_['map'](_0x18293f[_0x093e('0x2f')],function(_0x3d1197){var _0x440801={};_0x440801[_0x3d1197]={'$like':'%'+_0x12007e[_0x093e('0x2c')][_0x093e('0x43')]+'%'};return _0x440801;})});}_0x18293f=_[_0x093e('0x44')]({},_0x18293f,_0x12007e[_0x093e('0x32')]);return _0x4fc258[_0x093e('0x4e')](_0x18293f);}})['then'](function(_0x2fcb82){if(_0x2fcb82){_0x127368=_0x2fcb82[_0x093e('0x50')];if(!_0x12007e['query'][_0x093e('0x3f')]('nolimit')){_0x18293f['limit']=qs[_0x093e('0x13')](_0x12007e['query']['limit']);_0x18293f['offset']=qs[_0x093e('0x12')](_0x12007e[_0x093e('0x2c')][_0x093e('0x12')]);}return _0x4fc258[_0x093e('0x4e')](_0x18293f);}})[_0x093e('0x18')](function(_0x2d1de9){if(_0x2d1de9){return _0x2d1de9?{'count':_0x127368,'rows':_0x2d1de9}:null;}})[_0x093e('0x18')](respondWithResult(_0x49f50b,null))[_0x093e('0x33')](handleError(_0x49f50b,null));};exports['addTeams']=function(_0x31f617,_0x315ab4){var _0x25a717=_0x31f617[_0x093e('0x35')][_0x093e('0x51')];return db['Team'][_0x093e('0x52')]({'where':{'id':_0x25a717},'attributes':['id'],'include':[{'model':db[_0x093e('0x46')],'as':_0x093e('0x53'),'attributes':['id',_0x093e('0x1e'),_0x093e('0x54'),_0x093e('0x55'),_0x093e('0x56')],'raw':!![]}]})[_0x093e('0x18')](function(_0x5692d6){if(_0x5692d6){var _0x2d4d6c=_['flatMap'](_0x5692d6,function(_0x55b53f){var _0x452473=_0x55b53f['get']({'plain':!![]});return _0x452473['Agents'];});return db[_0x093e('0x26')][_0x093e('0x3b')]({'where':{'id':_0x31f617[_0x093e('0x29')]['id']}})['then'](function(_0xf0eb92){return db[_0x093e('0x57')][_0x093e('0x58')](function(_0x3bdcbf){return _0xf0eb92[_0x093e('0x59')](_0x25a717,{'transaction':_0x3bdcbf})[_0x093e('0x18')](function(){return BPromise[_0x093e('0x5a')](_0x2d4d6c,function(_0x1f634d){return db[_0x093e('0x45')][_0x093e('0x5b')]({'where':{'UserId':_0x1f634d['id'],'MailQueueId':_0x31f617['params']['id']},'transaction':_0x3bdcbf});});})[_0x093e('0x18')](function(){_0x2d4d6c[_0x093e('0x5c')](function(_0x131355){socket['emit'](_0x093e('0x5d'),{'UserId':_0x131355['id'],'MailQueueId':_0xf0eb92['id']});});});});});}})[_0x093e('0x18')](respondWithStatusCode(_0x315ab4,null))[_0x093e('0x33')](handleError(_0x315ab4,null));};exports['removeTeams']=function(_0x4b008b,_0x1540aa){return db['Team'][_0x093e('0x52')]({'where':{'id':_0x4b008b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x093e('0x46')],'as':_0x093e('0x53'),'attributes':['id'],'raw':!![]}]})[_0x093e('0x18')](handleEntityNotFound(_0x1540aa,null))['then'](function(_0x92dd94){var _0x1570d7=_['map'](_0x92dd94,'id');var _0x355e84=[];var _0x127b60=[];var _0x5429d9=squel[_0x093e('0x5e')]();_0x5429d9[_0x093e('0x5f')]('tq.TeamId')[_0x093e('0x60')](_0x093e('0x61'),'tq')[_0x093e('0x62')]('user_has_teams','ut',_0x093e('0x63'))[_0x093e('0x25')](_0x093e('0x64'),_0x4b008b[_0x093e('0x29')]['id']);for(var _0x6ed75c=0x0;_0x6ed75c<_0x92dd94[_0x093e('0x50')];_0x6ed75c+=0x1){let _0x2a65eb=_0x92dd94[_0x6ed75c];for(var _0x5bfc7b=0x0;_0x5bfc7b<_0x2a65eb['Agents']['length'];_0x5bfc7b+=0x1){let _0x84143=_0x2a65eb['Agents'][_0x5bfc7b];var _0x2fd72a=_0x5429d9[_0x093e('0x65')]();_0x2fd72a[_0x093e('0x25')](_0x093e('0x66'),_0x84143['id']);_0x127b60[_0x093e('0x67')](db[_0x093e('0x57')]['query'](_0x2fd72a[_0x093e('0x68')](),{'type':db['sequelize'][_0x093e('0x69')][_0x093e('0x6a')]})[_0x093e('0x18')](function(_0x586110){if(_0x586110[_0x093e('0x50')]===0x1){return _0x84143['id'];}else{var _0x39c2ad=_[_0x093e('0x6b')](_[_0x093e('0x20')](_0x586110,'TeamId'),function(_0x141cc8){return _['includes'](_0x1570d7,_0x141cc8);});if(_0x39c2ad){return _0x84143['id'];}}}));}}return BPromise['all'](_0x127b60)[_0x093e('0x18')](function(_0x2b497f){_0x355e84=_(_0x355e84)[_0x093e('0x6c')](_0x2b497f)[_0x093e('0x6d')]()['value']();return db[_0x093e('0x26')][_0x093e('0x3b')]({'where':{'id':_0x4b008b['params']['id']}})[_0x093e('0x18')](function(_0x1b138f){return db[_0x093e('0x57')]['transaction'](function(_0x26dbc2){return _0x1b138f['removeTeams'](_0x4b008b['query'][_0x093e('0x51')],{'transaction':_0x26dbc2})[_0x093e('0x18')](function(){if(!_[_0x093e('0x6e')](_0x355e84)){return _0x1b138f[_0x093e('0x6f')](_0x355e84,{'transaction':_0x26dbc2});}})[_0x093e('0x18')](function(){_0x355e84[_0x093e('0x5c')](function(_0x38e8b4){socket[_0x093e('0x70')](_0x093e('0x71'),{'UserId':_0x38e8b4,'MailQueueId':_0x1b138f['id']});});});});});});})[_0x093e('0x18')](respondWithStatusCode(_0x1540aa,null))[_0x093e('0x33')](handleError(_0x1540aa,null));};exports[_0x093e('0x72')]=function(_0x58ab37,_0x966b66){return db['MailQueue'][_0x093e('0x3b')]({'where':{'id':_0x58ab37[_0x093e('0x29')]['id']}})[_0x093e('0x18')](handleEntityNotFound(_0x966b66,null))[_0x093e('0x18')](function(_0x4996f5){if(_0x4996f5){return _0x4996f5[_0x093e('0x72')](_0x58ab37[_0x093e('0x35')][_0x093e('0x51')],_[_0x093e('0x73')](_0x58ab37[_0x093e('0x35')],[_0x093e('0x51'),'id'])||{})[_0x093e('0x74')](function(_0x1856d8){for(var _0x3cf855=0x0;_0x3cf855<_0x58ab37['body'][_0x093e('0x51')][_0x093e('0x50')];_0x3cf855+=0x1){socket[_0x093e('0x70')](_0x093e('0x5d'),{'UserId':Number(_0x58ab37[_0x093e('0x35')]['ids'][_0x3cf855]),'MailQueueId':Number(_0x58ab37[_0x093e('0x29')]['id'])});}return _0x1856d8;});}})[_0x093e('0x18')](respondWithResult(_0x966b66,null))[_0x093e('0x33')](handleError(_0x966b66,null));};exports['removeAgents']=function(_0x5f307d,_0x3b63a7){return db[_0x093e('0x26')][_0x093e('0x3b')]({'where':{'id':_0x5f307d[_0x093e('0x29')]['id']}})[_0x093e('0x18')](handleEntityNotFound(_0x3b63a7,null))[_0x093e('0x18')](function(_0x487ff8){if(_0x487ff8){return _0x487ff8[_0x093e('0x6f')](_0x5f307d[_0x093e('0x2c')][_0x093e('0x51')])['then'](function(){if(_[_0x093e('0x75')](_0x5f307d['query'][_0x093e('0x51')])){for(var _0x1d25f2=0x0;_0x1d25f2<_0x5f307d[_0x093e('0x2c')][_0x093e('0x51')][_0x093e('0x50')];_0x1d25f2+=0x1){socket[_0x093e('0x70')]('userMailQueue:remove',{'UserId':Number(_0x5f307d[_0x093e('0x2c')][_0x093e('0x51')][_0x1d25f2]),'MailQueueId':Number(_0x5f307d['params']['id'])});}}else{socket[_0x093e('0x70')](_0x093e('0x71'),{'UserId':Number(_0x5f307d[_0x093e('0x2c')][_0x093e('0x51')]),'MailQueueId':Number(_0x5f307d[_0x093e('0x29')]['id'])});}});}})[_0x093e('0x18')](respondWithStatusCode(_0x3b63a7,null))[_0x093e('0x33')](handleError(_0x3b63a7,null));};exports[_0x093e('0x76')]=function(_0xad0da1,_0x16e97f){var _0x550206={};var _0x1243f3={};var _0x44afd0;var _0x2f08b9;return db[_0x093e('0x26')][_0x093e('0x3e')]({'where':{'id':_0xad0da1[_0x093e('0x29')]['id']}})['then'](handleEntityNotFound(_0x16e97f,null))[_0x093e('0x18')](function(_0x3bf6e6){if(_0x3bf6e6){_0x44afd0=_0x3bf6e6;_0x1243f3['model']=_[_0x093e('0x2b')](db['User'][_0x093e('0x21')]);_0x1243f3[_0x093e('0x2c')]=_['keys'](_0xad0da1[_0x093e('0x2c')]);_0x1243f3['filters']=_['intersection'](_0x1243f3['model'],_0x1243f3[_0x093e('0x2c')]);_0x550206['attributes']=_[_0x093e('0x2e')](_0x1243f3[_0x093e('0x2a')],qs[_0x093e('0x30')](_0xad0da1[_0x093e('0x2c')][_0x093e('0x30')]));_0x550206[_0x093e('0x2f')]=_0x550206[_0x093e('0x2f')][_0x093e('0x50')]?_0x550206[_0x093e('0x2f')]:_0x1243f3[_0x093e('0x2a')];_0x550206[_0x093e('0x77')]=qs[_0x093e('0x41')](_0xad0da1[_0x093e('0x2c')][_0x093e('0x41')]);_0x550206[_0x093e('0x25')]=qs[_0x093e('0x2d')](_['pick'](_0xad0da1[_0x093e('0x2c')],_0x1243f3['filters']));if(_0xad0da1[_0x093e('0x2c')]['filter']){_0x550206[_0x093e('0x25')]=_['merge'](_0x550206[_0x093e('0x25')],{'$or':_[_0x093e('0x20')](_0x550206[_0x093e('0x2f')],function(_0x20565f){var _0x8d4a7c={};_0x8d4a7c[_0x20565f]={'$like':'%'+_0xad0da1['query'][_0x093e('0x43')]+'%'};return _0x8d4a7c;})});}_0x550206=_['merge']({},_0x550206,_0xad0da1[_0x093e('0x32')]);return _0x44afd0['getAgents'](_0x550206);}})[_0x093e('0x18')](function(_0x4cd3e8){if(_0x4cd3e8){_0x2f08b9=_0x4cd3e8[_0x093e('0x50')];if(!_0xad0da1[_0x093e('0x2c')][_0x093e('0x3f')]('nolimit')){_0x550206['limit']=qs['limit'](_0xad0da1['query'][_0x093e('0x13')]);_0x550206[_0x093e('0x12')]=qs[_0x093e('0x12')](_0xad0da1['query']['offset']);}return _0x44afd0['getAgents'](_0x550206);}})[_0x093e('0x18')](function(_0x4a4c18){if(_0x4a4c18){return _0x4a4c18?{'count':_0x2f08b9,'rows':_0x4a4c18}:null;}})[_0x093e('0x18')](respondWithResult(_0x16e97f,null))['catch'](handleError(_0x16e97f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c7aba06..59e6640 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 _0x81e4=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','save','update','remove','emit'];(function(_0x1c41e2,_0x31fe59){var _0xb0e196=function(_0x566022){while(--_0x566022){_0x1c41e2['push'](_0x1c41e2['shift']());}};_0xb0e196(++_0x31fe59);}(_0x81e4,0xd5));var _0x481e=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0x81e4[_0x2ccd5e];return _0x1a758e;};'use strict';var EventEmitter=require(_0x481e('0x0'));var MailQueue=require(_0x481e('0x1'))['db'][_0x481e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x481e('0x3'),'afterUpdate':_0x481e('0x4'),'afterDestroy':_0x481e('0x5')};function emitEvent(_0x5b30e7){return function(_0x9cbd68,_0x83e988,_0x549222){MailQueueEvents['emit'](_0x5b30e7+':'+_0x9cbd68['id'],_0x9cbd68);MailQueueEvents[_0x481e('0x6')](_0x5b30e7,_0x9cbd68);_0x549222(null);};}for(var e in events){if(events[_0x481e('0x7')](e)){var event=events[e];MailQueue[_0x481e('0x8')](e,emitEvent(event));}}module[_0x481e('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x6ad2=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ad2,0x1cf));var _0x26ad=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x6ad2[_0x22b68a];return _0x1ac67a;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x26ad('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x26ad('0x1')](0x0);var events={'afterCreate':_0x26ad('0x2'),'afterUpdate':_0x26ad('0x3'),'afterDestroy':_0x26ad('0x4')};function emitEvent(_0x5317d4){return function(_0x547739,_0x24b882,_0x40c779){MailQueueEvents['emit'](_0x5317d4+':'+_0x547739['id'],_0x547739);MailQueueEvents[_0x26ad('0x5')](_0x5317d4,_0x547739);_0x40c779(null);};}for(var e in events){if(events[_0x26ad('0x6')](e)){var event=events[e];MailQueue[_0x26ad('0x7')](e,emitEvent(event));}}module[_0x26ad('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 4367de6..25cbcb1 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 _0xe65d=['define','mail_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0xb50996,_0x10d9ef){var _0x1dc7da=function(_0xa013aa){while(--_0xa013aa){_0xb50996['push'](_0xb50996['shift']());}};_0x1dc7da(++_0x10d9ef);}(_0xe65d,0x9e));var _0xde65=function(_0x1e18d2,_0x42a362){_0x1e18d2=_0x1e18d2-0x0;var _0x635f5e=_0xe65d[_0x1e18d2];return _0x635f5e;};'use strict';var _=require('lodash');var util=require(_0xde65('0x0'));var logger=require('../../config/logger')(_0xde65('0x1'));var moment=require(_0xde65('0x2'));var BPromise=require(_0xde65('0x3'));var rp=require(_0xde65('0x4'));var fs=require('fs');var path=require(_0xde65('0x5'));var rimraf=require(_0xde65('0x6'));var config=require(_0xde65('0x7'));var attributes=require(_0xde65('0x8'));module[_0xde65('0x9')]=function(_0x55edde,_0x12af4f){return _0x55edde[_0xde65('0xa')]('MailQueue',attributes,{'tableName':_0xde65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d33=['exports','MailQueue','mail_queues','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x1087ee,_0x307a79){var _0x308c2f=function(_0x41b990){while(--_0x41b990){_0x1087ee['push'](_0x1087ee['shift']());}};_0x308c2f(++_0x307a79);}(_0x6d33,0xdf));var _0x36d3=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0x6d33[_0x566bdf];return _0x331215;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36d3('0x0'))(_0x36d3('0x1'));var moment=require(_0x36d3('0x2'));var BPromise=require(_0x36d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36d3('0x4'));var rimraf=require(_0x36d3('0x5'));var config=require(_0x36d3('0x6'));var attributes=require(_0x36d3('0x7'));module[_0x36d3('0x8')]=function(_0x50e99c,_0xc0a708){return _0x50e99c['define'](_0x36d3('0x9'),attributes,{'tableName':_0x36d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 0a597c5..e5996f3 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 _0xe4fc=['options','attributes','limit','include','map','model','GetMailQueue','raw','where','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','catch','MailQueue','findAll'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xe4fc,0xc8));var _0xce4f=function(_0x20b504,_0x330c27){_0x20b504=_0x20b504-0x0;var _0x237692=_0xe4fc[_0x20b504];return _0x237692;};'use strict';var _=require('lodash');var util=require(_0xce4f('0x0'));var moment=require(_0xce4f('0x1'));var BPromise=require(_0xce4f('0x2'));var rs=require(_0xce4f('0x3'));var fs=require('fs');var Redis=require(_0xce4f('0x4'));var db=require(_0xce4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xce4f('0x6'));var jayson=require(_0xce4f('0x7'));var client=jayson[_0xce4f('0x8')][_0xce4f('0x9')]({'port':0x232a});config[_0xce4f('0xa')]=_[_0xce4f('0xb')](config['redis'],{'host':_0xce4f('0xc'),'port':0x18eb});var socket=require(_0xce4f('0xd'))(new Redis(config[_0xce4f('0xa')]));require('./mailQueue.socket')[_0xce4f('0xe')](socket);function respondWithRpcPromise(_0x23d5d5,_0x11b2c9,_0x16e8af){return new BPromise(function(_0xf872c8,_0x5078ae){return client[_0xce4f('0xf')](_0x23d5d5,_0x16e8af)[_0xce4f('0x10')](function(_0x217b5a){logger['info']('MailQueue,\x20%s,\x20%s',_0x11b2c9,'request\x20sent');logger['debug'](_0xce4f('0x11'),_0x11b2c9,_0xce4f('0x12'),JSON[_0xce4f('0x13')](_0x217b5a));if(_0x217b5a[_0xce4f('0x14')]){if(_0x217b5a['error'][_0xce4f('0x15')]===0x1f4){logger[_0xce4f('0x14')](_0xce4f('0x16'),_0x11b2c9,_0x217b5a['error'][_0xce4f('0x17')]);return _0x5078ae(_0x217b5a['error'][_0xce4f('0x17')]);}logger[_0xce4f('0x14')](_0xce4f('0x16'),_0x11b2c9,_0x217b5a[_0xce4f('0x14')][_0xce4f('0x17')]);return _0xf872c8(_0x217b5a['error'][_0xce4f('0x17')]);}else{logger[_0xce4f('0x18')]('MailQueue,\x20%s,\x20%s',_0x11b2c9,_0xce4f('0x12'));_0xf872c8(_0x217b5a['result'][_0xce4f('0x17')]);}})[_0xce4f('0x19')](function(_0x28d7ce){logger['error']('MailQueue,\x20%s,\x20%s',_0x11b2c9,_0x28d7ce);_0x5078ae(_0x28d7ce);});});}exports['GetMailQueue']=function(_0x413d39){var _0x2b948f=this;return new Promise(function(_0x48b790,_0x2549e3){return db[_0xce4f('0x1a')][_0xce4f('0x1b')]({'raw':_0x413d39['options']?_0x413d39[_0xce4f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x413d39['options']?_0x413d39[_0xce4f('0x1c')]['where']||null:null,'attributes':_0x413d39['options']?_0x413d39['options'][_0xce4f('0x1d')]||null:null,'limit':_0x413d39[_0xce4f('0x1c')]?_0x413d39[_0xce4f('0x1c')][_0xce4f('0x1e')]||null:null,'include':_0x413d39[_0xce4f('0x1c')]?_0x413d39[_0xce4f('0x1c')][_0xce4f('0x1f')]?_[_0xce4f('0x20')](_0x413d39[_0xce4f('0x1c')][_0xce4f('0x1f')],function(_0x5f98c9){return{'model':db[_0x5f98c9[_0xce4f('0x21')]],'as':_0x5f98c9['as'],'attributes':_0x5f98c9[_0xce4f('0x1d')],'include':_0x5f98c9[_0xce4f('0x1f')]?_[_0xce4f('0x20')](_0x5f98c9[_0xce4f('0x1f')],function(_0xe5e78e){return{'model':db[_0xe5e78e[_0xce4f('0x21')]],'as':_0xe5e78e['as'],'attributes':_0xe5e78e[_0xce4f('0x1d')],'include':_0xe5e78e[_0xce4f('0x1f')]?_[_0xce4f('0x20')](_0xe5e78e[_0xce4f('0x1f')],function(_0x329f42){return{'model':db[_0x329f42[_0xce4f('0x21')]],'as':_0x329f42['as'],'attributes':_0x329f42['attributes']};}):[]};}):[]};}):[]:[]})[_0xce4f('0x10')](function(_0x3d765f){logger['info']('GetMailQueue',_0x413d39);logger['debug'](_0xce4f('0x22'),_0x413d39,JSON[_0xce4f('0x13')](_0x3d765f));_0x48b790(_0x3d765f);})['catch'](function(_0x47a4e0){logger[_0xce4f('0x14')](_0xce4f('0x22'),_0x47a4e0[_0xce4f('0x17')],_0x413d39);_0x2549e3(_0x2b948f[_0xce4f('0x14')](0x1f4,_0x47a4e0[_0xce4f('0x17')]));});});};exports['ShowMailQueue']=function(_0x4ae92a){var _0x29d20d=this;return new Promise(function(_0x4bfc47,_0x1576c7){return db['MailQueue']['find']({'raw':_0x4ae92a[_0xce4f('0x1c')]?_0x4ae92a[_0xce4f('0x1c')][_0xce4f('0x23')]===undefined?!![]:![]:!![],'where':_0x4ae92a[_0xce4f('0x1c')]?_0x4ae92a[_0xce4f('0x1c')][_0xce4f('0x24')]||null:null,'attributes':_0x4ae92a[_0xce4f('0x1c')]?_0x4ae92a[_0xce4f('0x1c')][_0xce4f('0x1d')]||null:null,'include':_0x4ae92a[_0xce4f('0x1c')]?_0x4ae92a['options'][_0xce4f('0x1f')]?_[_0xce4f('0x20')](_0x4ae92a[_0xce4f('0x1c')][_0xce4f('0x1f')],function(_0x2a56bc){return{'model':db[_0x2a56bc['model']],'as':_0x2a56bc['as'],'attributes':_0x2a56bc[_0xce4f('0x1d')],'include':_0x2a56bc[_0xce4f('0x1f')]?_[_0xce4f('0x20')](_0x2a56bc['include'],function(_0x3e79df){return{'model':db[_0x3e79df[_0xce4f('0x21')]],'as':_0x3e79df['as'],'attributes':_0x3e79df['attributes'],'include':_0x3e79df['include']?_['map'](_0x3e79df['include'],function(_0x512508){return{'model':db[_0x512508[_0xce4f('0x21')]],'as':_0x512508['as'],'attributes':_0x512508[_0xce4f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xce4f('0x10')](function(_0x983920){logger[_0xce4f('0x18')](_0xce4f('0x25'),_0x4ae92a);logger['debug']('ShowMailQueue',_0x4ae92a,JSON[_0xce4f('0x13')](_0x983920));_0x4bfc47(_0x983920);})[_0xce4f('0x19')](function(_0xf95647){logger[_0xce4f('0x14')]('ShowMailQueue',_0xf95647[_0xce4f('0x17')],_0x4ae92a);_0x1576c7(_0x29d20d['error'](0x1f4,_0xf95647[_0xce4f('0x17')]));});});}; \ No newline at end of file +var _0xc181=['catch','options','raw','where','attributes','limit','map','model','include','then','info','GetMailQueue','ShowMailQueue','MailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3a86a0,_0x14cfd6){var _0x350ed1=function(_0x4cb99c){while(--_0x4cb99c){_0x3a86a0['push'](_0x3a86a0['shift']());}};_0x350ed1(++_0x14cfd6);}(_0xc181,0x126));var _0x1c18=function(_0x46b1c9,_0x169f87){_0x46b1c9=_0x46b1c9-0x0;var _0x17569c=_0xc181[_0x46b1c9];return _0x17569c;};'use strict';var _=require(_0x1c18('0x0'));var util=require(_0x1c18('0x1'));var moment=require('moment');var BPromise=require(_0x1c18('0x2'));var rs=require(_0x1c18('0x3'));var fs=require('fs');var Redis=require(_0x1c18('0x4'));var db=require(_0x1c18('0x5'))['db'];var utils=require(_0x1c18('0x6'));var logger=require('../../config/logger')(_0x1c18('0x7'));var config=require(_0x1c18('0x8'));var jayson=require(_0x1c18('0x9'));var client=jayson[_0x1c18('0xa')][_0x1c18('0xb')]({'port':0x232a});config[_0x1c18('0xc')]=_[_0x1c18('0xd')](config[_0x1c18('0xc')],{'host':_0x1c18('0xe'),'port':0x18eb});var socket=require(_0x1c18('0xf'))(new Redis(config[_0x1c18('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x80e7b0,_0x29b678,_0x2934af){return new BPromise(function(_0x50a9ad,_0x437ea5){return client[_0x1c18('0x10')](_0x80e7b0,_0x2934af)['then'](function(_0x4b5aaa){logger['info'](_0x1c18('0x11'),_0x29b678,_0x1c18('0x12'));logger[_0x1c18('0x13')](_0x1c18('0x14'),_0x29b678,'request\x20sent',JSON[_0x1c18('0x15')](_0x4b5aaa));if(_0x4b5aaa[_0x1c18('0x16')]){if(_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x17')]===0x1f4){logger[_0x1c18('0x16')](_0x1c18('0x11'),_0x29b678,_0x4b5aaa['error'][_0x1c18('0x18')]);return _0x437ea5(_0x4b5aaa['error'][_0x1c18('0x18')]);}logger[_0x1c18('0x16')]('MailQueue,\x20%s,\x20%s',_0x29b678,_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x18')]);return _0x50a9ad(_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x18')]);}else{logger['info'](_0x1c18('0x11'),_0x29b678,'request\x20sent');_0x50a9ad(_0x4b5aaa[_0x1c18('0x19')][_0x1c18('0x18')]);}})[_0x1c18('0x1a')](function(_0x1262bb){logger[_0x1c18('0x16')](_0x1c18('0x11'),_0x29b678,_0x1262bb);_0x437ea5(_0x1262bb);});});}exports['GetMailQueue']=function(_0x38942d){var _0x53c44c=this;return new Promise(function(_0x599140,_0x591d7a){return db['MailQueue']['findAll']({'raw':_0x38942d[_0x1c18('0x1b')]?_0x38942d[_0x1c18('0x1b')][_0x1c18('0x1c')]===undefined?!![]:![]:!![],'where':_0x38942d[_0x1c18('0x1b')]?_0x38942d['options'][_0x1c18('0x1d')]||null:null,'attributes':_0x38942d['options']?_0x38942d['options'][_0x1c18('0x1e')]||null:null,'limit':_0x38942d[_0x1c18('0x1b')]?_0x38942d['options'][_0x1c18('0x1f')]||null:null,'include':_0x38942d[_0x1c18('0x1b')]?_0x38942d[_0x1c18('0x1b')]['include']?_[_0x1c18('0x20')](_0x38942d[_0x1c18('0x1b')]['include'],function(_0x3fa7c7){return{'model':db[_0x3fa7c7[_0x1c18('0x21')]],'as':_0x3fa7c7['as'],'attributes':_0x3fa7c7[_0x1c18('0x1e')],'include':_0x3fa7c7['include']?_['map'](_0x3fa7c7['include'],function(_0x349120){return{'model':db[_0x349120[_0x1c18('0x21')]],'as':_0x349120['as'],'attributes':_0x349120[_0x1c18('0x1e')],'include':_0x349120[_0x1c18('0x22')]?_['map'](_0x349120['include'],function(_0x5a5a95){return{'model':db[_0x5a5a95['model']],'as':_0x5a5a95['as'],'attributes':_0x5a5a95[_0x1c18('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c18('0x23')](function(_0x5018ea){logger[_0x1c18('0x24')](_0x1c18('0x25'),_0x38942d);logger[_0x1c18('0x13')]('GetMailQueue',_0x38942d,JSON[_0x1c18('0x15')](_0x5018ea));_0x599140(_0x5018ea);})[_0x1c18('0x1a')](function(_0xcfa8a9){logger['error']('GetMailQueue',_0xcfa8a9[_0x1c18('0x18')],_0x38942d);_0x591d7a(_0x53c44c[_0x1c18('0x16')](0x1f4,_0xcfa8a9[_0x1c18('0x18')]));});});};exports[_0x1c18('0x26')]=function(_0x530411){var _0x1e5735=this;return new Promise(function(_0x22100c,_0x9a35ba){return db[_0x1c18('0x27')]['find']({'raw':_0x530411[_0x1c18('0x1b')]?_0x530411['options']['raw']===undefined?!![]:![]:!![],'where':_0x530411[_0x1c18('0x1b')]?_0x530411[_0x1c18('0x1b')][_0x1c18('0x1d')]||null:null,'attributes':_0x530411[_0x1c18('0x1b')]?_0x530411[_0x1c18('0x1b')][_0x1c18('0x1e')]||null:null,'include':_0x530411[_0x1c18('0x1b')]?_0x530411['options'][_0x1c18('0x22')]?_[_0x1c18('0x20')](_0x530411['options']['include'],function(_0x51b835){return{'model':db[_0x51b835[_0x1c18('0x21')]],'as':_0x51b835['as'],'attributes':_0x51b835[_0x1c18('0x1e')],'include':_0x51b835[_0x1c18('0x22')]?_[_0x1c18('0x20')](_0x51b835['include'],function(_0x46ea89){return{'model':db[_0x46ea89[_0x1c18('0x21')]],'as':_0x46ea89['as'],'attributes':_0x46ea89[_0x1c18('0x1e')],'include':_0x46ea89[_0x1c18('0x22')]?_['map'](_0x46ea89[_0x1c18('0x22')],function(_0x58cc20){return{'model':db[_0x58cc20[_0x1c18('0x21')]],'as':_0x58cc20['as'],'attributes':_0x58cc20[_0x1c18('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c18('0x23')](function(_0x28ffe8){logger[_0x1c18('0x24')](_0x1c18('0x26'),_0x530411);logger[_0x1c18('0x13')](_0x1c18('0x26'),_0x530411,JSON['stringify'](_0x28ffe8));_0x22100c(_0x28ffe8);})['catch'](function(_0x1174d8){logger['error'](_0x1c18('0x26'),_0x1174d8['message'],_0x530411);_0x9a35ba(_0x1e5735[_0x1c18('0x16')](0x1f4,_0x1174d8[_0x1c18('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c64f8df..4831890 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 _0x0703=['length','mailQueue:','./mailQueue.events','remove','update','removeListener','register'];(function(_0x2c6b00,_0x573739){var _0x59537e=function(_0x57bcf1){while(--_0x57bcf1){_0x2c6b00['push'](_0x2c6b00['shift']());}};_0x59537e(++_0x573739);}(_0x0703,0xaa));var _0x3070=function(_0x3703eb,_0x1c7cde){_0x3703eb=_0x3703eb-0x0;var _0x190bdc=_0x0703[_0x3703eb];return _0x190bdc;};'use strict';var MailQueueEvents=require(_0x3070('0x0'));var events=['save',_0x3070('0x1'),_0x3070('0x2')];function createListener(_0x50f1e5,_0x5ecd00){return function(_0x236b05){_0x5ecd00['emit'](_0x50f1e5,_0x236b05);};}function removeListener(_0xbebaf9,_0x18b055){return function(){MailQueueEvents[_0x3070('0x3')](_0xbebaf9,_0x18b055);};}exports[_0x3070('0x4')]=function(_0x31bb87){for(var _0x5e16cc=0x0,_0x2f7baf=events[_0x3070('0x5')];_0x5e16cc<_0x2f7baf;_0x5e16cc++){var _0xc18d26=events[_0x5e16cc];var _0x155a1a=createListener(_0x3070('0x6')+_0xc18d26,_0x31bb87);MailQueueEvents['on'](_0xc18d26,_0x155a1a);}}; \ No newline at end of file +var _0x9215=['save','remove','update','emit','removeListener','register','mailQueue:','./mailQueue.events'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x9215,0x13f));var _0x5921=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9215[_0x5447fd];return _0x15b28a;};'use strict';var MailQueueEvents=require(_0x5921('0x0'));var events=[_0x5921('0x1'),_0x5921('0x2'),_0x5921('0x3')];function createListener(_0x44c210,_0x31f807){return function(_0x1f72e5){_0x31f807[_0x5921('0x4')](_0x44c210,_0x1f72e5);};}function removeListener(_0x27de5d,_0x4b47ef){return function(){MailQueueEvents[_0x5921('0x5')](_0x27de5d,_0x4b47ef);};}exports[_0x5921('0x6')]=function(_0xad6f1b){for(var _0x1cf2d7=0x0,_0x43a3f2=events['length'];_0x1cf2d7<_0x43a3f2;_0x1cf2d7++){var _0x55d649=events[_0x1cf2d7];var _0x2a6ef2=createListener(_0x5921('0x7')+_0x55d649,_0xad6f1b);MailQueueEvents['on'](_0x55d649,_0x2a6ef2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d18574f..607a37a 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 _0x5407=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','create','update','destroy'];(function(_0x11ed60,_0xdeea67){var _0x53f2ac=function(_0x1cd48a){while(--_0x1cd48a){_0x11ed60['push'](_0x11ed60['shift']());}};_0x53f2ac(++_0xdeea67);}(_0x5407,0x1f0));var _0x7540=function(_0x2c2b05,_0x46fe9e){_0x2c2b05=_0x2c2b05-0x0;var _0x341d82=_0x5407[_0x2c2b05];return _0x341d82;};'use strict';var multer=require(_0x7540('0x0'));var util=require(_0x7540('0x1'));var path=require(_0x7540('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7540('0x3')]();var fs_extra=require(_0x7540('0x4'));var auth=require(_0x7540('0x5'));var interaction=require(_0x7540('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x7540('0x7')]('/',auth[_0x7540('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7540('0x9')]);router[_0x7540('0x7')](_0x7540('0xa'),auth[_0x7540('0x8')](),controller['show']);router['post']('/',auth[_0x7540('0x8')](),controller[_0x7540('0xb')]);router['put'](_0x7540('0xa'),auth['isAuthenticated'](),controller[_0x7540('0xc')]);router['delete'](_0x7540('0xa'),auth['isAuthenticated'](),controller[_0x7540('0xd')]);module[_0x7540('0xe')]=router; \ No newline at end of file +var _0xe385=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe385,0x165));var _0x5e38=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe385[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x5e38('0x0'));var util=require('util');var path=require(_0x5e38('0x1'));var timeout=require(_0x5e38('0x2'));var express=require(_0x5e38('0x3'));var router=express['Router']();var fs_extra=require(_0x5e38('0x4'));var auth=require(_0x5e38('0x5'));var interaction=require(_0x5e38('0x6'));var config=require('../../config/environment');var controller=require(_0x5e38('0x7'));router[_0x5e38('0x8')]('/',auth[_0x5e38('0x9')](),controller[_0x5e38('0xa')]);router[_0x5e38('0x8')](_0x5e38('0xb'),auth[_0x5e38('0x9')](),controller[_0x5e38('0xc')]);router[_0x5e38('0x8')]('/:id',auth[_0x5e38('0x9')](),controller[_0x5e38('0xd')]);router[_0x5e38('0xe')]('/',auth[_0x5e38('0x9')](),controller['create']);router['put'](_0x5e38('0xf'),auth[_0x5e38('0x9')](),controller[_0x5e38('0x10')]);router[_0x5e38('0x11')]('/:id',auth[_0x5e38('0x9')](),controller[_0x5e38('0x12')]);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 3697d3d..c131c17 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 _0xd88b=['exports','STRING','DATE','moment'];(function(_0xed17df,_0x495c7c){var _0x38edf9=function(_0x584f5c){while(--_0x584f5c){_0xed17df['push'](_0xed17df['shift']());}};_0x38edf9(++_0x495c7c);}(_0xd88b,0xa7));var _0xbd88=function(_0x259c14,_0xf31a2b){_0x259c14=_0x259c14-0x0;var _0x45eb09=_0xd88b[_0x259c14];return _0x45eb09;};'use strict';var moment=require(_0xbd88('0x0'));var Sequelize=require('sequelize');module[_0xbd88('0x1')]={'uniqueid':{'type':Sequelize[_0xbd88('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbd88('0x2')]},'joinAt':{'type':Sequelize[_0xbd88('0x3')]},'leaveAt':{'type':Sequelize[_0xbd88('0x3')]},'acceptAt':{'type':Sequelize[_0xbd88('0x3')]},'exitAt':{'type':Sequelize[_0xbd88('0x3')]},'reason':{'type':Sequelize[_0xbd88('0x2')]}}; \ No newline at end of file +var _0xcafc=['sequelize','DATE','moment'];(function(_0x3cfdc9,_0x4b9446){var _0x35d36f=function(_0x118955){while(--_0x118955){_0x3cfdc9['push'](_0x3cfdc9['shift']());}};_0x35d36f(++_0x4b9446);}(_0xcafc,0x77));var _0xccaf=function(_0x7c7b39,_0x240f71){_0x7c7b39=_0x7c7b39-0x0;var _0x52dfef=_0xcafc[_0x7c7b39];return _0x52dfef;};'use strict';var moment=require(_0xccaf('0x0'));var Sequelize=require(_0xccaf('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xccaf('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 287cccd..5fb62bf 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 _0x4325=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','MailQueueReport','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}exports['index']=function(_0x29dc15,_0x5be867){var _0x4821be={},_0x6fc7f5={},_0x4a52ba={'count':0x0,'rows':[]};var _0x428141=_['map'](db['MailQueueReport'][_0x5432('0x2a')],function(_0x21735e){return{'name':_0x21735e[_0x5432('0x2b')],'type':_0x21735e['type'][_0x5432('0x2c')]};});_0x6fc7f5[_0x5432('0x2d')]=_[_0x5432('0x2e')](_0x428141,_0x5432('0x28'));_0x6fc7f5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x29dc15[_0x5432('0x2f')]);_0x6fc7f5[_0x5432('0x31')]=_[_0x5432('0x32')](_0x6fc7f5['model'],_0x6fc7f5['query']);_0x4821be[_0x5432('0x33')]=_[_0x5432('0x32')](_0x6fc7f5[_0x5432('0x2d')],qs[_0x5432('0x34')](_0x29dc15[_0x5432('0x2f')]['fields']));_0x4821be[_0x5432('0x33')]=_0x4821be['attributes'][_0x5432('0x35')]?_0x4821be[_0x5432('0x33')]:_0x6fc7f5[_0x5432('0x2d')];if(!_0x29dc15[_0x5432('0x2f')][_0x5432('0x36')](_0x5432('0x37'))){_0x4821be['limit']=qs[_0x5432('0x1e')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1e')]);_0x4821be[_0x5432('0x1d')]=qs['offset'](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x4821be[_0x5432('0x38')]=qs[_0x5432('0x39')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x39')]);_0x4821be[_0x5432('0x3a')]=qs[_0x5432('0x31')](_[_0x5432('0x3b')](_0x29dc15[_0x5432('0x2f')],_0x6fc7f5[_0x5432('0x31')]),_0x428141);if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x3c')]){_0x4821be[_0x5432('0x3a')]=_['merge'](_0x4821be[_0x5432('0x3a')],{'$or':_['map'](_0x428141,function(_0x6f5006){if(_0x6f5006[_0x5432('0x3d')]!==_0x5432('0x3e')){var _0x1a5561={};_0x1a5561[_0x6f5006['name']]={'$like':'%'+_0x29dc15['query']['filter']+'%'};return _0x1a5561;}})});}_0x4821be=_[_0x5432('0x3f')]({},_0x4821be,_0x29dc15[_0x5432('0x40')]);var _0x139d0a={'where':_0x4821be[_0x5432('0x3a')]};return db['MailQueueReport'][_0x5432('0x1c')](_0x139d0a)[_0x5432('0x24')](function(_0x3cd343){_0x4a52ba['count']=_0x3cd343;if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x41')]){_0x4821be['include']=[{'all':!![]}];}return db[_0x5432('0x42')][_0x5432('0x43')](_0x4821be);})['then'](function(_0x23f8f4){_0x4a52ba['rows']=_0x23f8f4;return _0x4a52ba;})[_0x5432('0x24')](respondWithFilteredResult(_0x5be867,_0x4821be))[_0x5432('0x44')](handleError(_0x5be867,null));};exports[_0x5432('0x45')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x46')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x2d')]=_[_0x5432('0x30')](db[_0x5432('0x42')][_0x5432('0x2a')]);_0x4b93b4[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x31')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],_0x4b93b4[_0x5432('0x2f')]);_0x9cfb8b[_0x5432('0x33')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],qs['fields'](_0x11c7f2[_0x5432('0x2f')][_0x5432('0x34')]));_0x9cfb8b[_0x5432('0x33')]=_0x9cfb8b[_0x5432('0x33')][_0x5432('0x35')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x2d')];if(_0x11c7f2['query'][_0x5432('0x41')]){_0x9cfb8b[_0x5432('0x47')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x40')]);return db['MailQueueReport'][_0x5432('0x48')](_0x9cfb8b)[_0x5432('0x24')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x49')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x42')][_0x5432('0x49')](_0xa971bd[_0x5432('0x4a')],{})[_0x5432('0x24')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x23')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x14763c[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x24')](saveUpdates(_0x14763c[_0x5432('0x4a')],null))[_0x5432('0x24')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x25')]=function(_0xce691b,_0x7937f9){return db['MailQueueReport'][_0x5432('0x48')]({'where':{'id':_0xce691b[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x24')](removeEntity(_0x7937f9,null))[_0x5432('0x44')](handleError(_0x7937f9,null));};exports['describe']=function(_0xbcf523,_0x5bbedb){return db[_0x5432('0x42')]['describe']()[_0x5432('0x24')](respondWithResult(_0x5bbedb,null))[_0x5432('0x44')](handleError(_0x5bbedb,null));}; \ No newline at end of file +var _0x5204=['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','limit','count','offset','set','reject','save','update','destroy','error','stack','name','send','map','MailQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','then','rows','params','keys','rawAttributes','catch','create','body','find','describe','eml-format','rimraf'];(function(_0x14ca42,_0x31df52){var _0x99f787=function(_0x248368){while(--_0x248368){_0x14ca42['push'](_0x14ca42['shift']());}};_0x99f787(++_0x31df52);}(_0x5204,0xdf));var _0x4520=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x5204[_0x2d4661];return _0x42ed1e;};'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(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x3532aa,_0x3e2906){return function(_0x57306b){if(!_0x57306b){_0x3532aa[_0x4520('0x1b')](0x194);}return _0x57306b;};}function handleError(_0x4602a4,_0x92168b){_0x92168b=_0x92168b||0x1f4;return function(_0x21e1f3){logger[_0x4520('0x28')](_0x21e1f3[_0x4520('0x29')]);if(_0x21e1f3[_0x4520('0x2a')]){delete _0x21e1f3[_0x4520('0x2a')];}_0x4602a4[_0x4520('0x1c')](_0x92168b)[_0x4520('0x2b')](_0x21e1f3);};}exports['index']=function(_0x222dbd,_0x5c1a0b){var _0x7ce8d2={},_0x14778a={},_0x43b4a2={'count':0x0,'rows':[]};var _0x157293=_[_0x4520('0x2c')](db[_0x4520('0x2d')]['rawAttributes'],function(_0x2c32ce){return{'name':_0x2c32ce['fieldName'],'type':_0x2c32ce[_0x4520('0x2e')]['key']};});_0x14778a[_0x4520('0x2f')]=_['map'](_0x157293,_0x4520('0x2a'));_0x14778a['query']=_['keys'](_0x222dbd[_0x4520('0x30')]);_0x14778a[_0x4520('0x31')]=_[_0x4520('0x32')](_0x14778a['model'],_0x14778a[_0x4520('0x30')]);_0x7ce8d2[_0x4520('0x33')]=_[_0x4520('0x32')](_0x14778a[_0x4520('0x2f')],qs['fields'](_0x222dbd['query'][_0x4520('0x34')]));_0x7ce8d2[_0x4520('0x33')]=_0x7ce8d2['attributes'][_0x4520('0x35')]?_0x7ce8d2[_0x4520('0x33')]:_0x14778a[_0x4520('0x2f')];if(!_0x222dbd[_0x4520('0x30')][_0x4520('0x36')](_0x4520('0x37'))){_0x7ce8d2['limit']=qs[_0x4520('0x20')](_0x222dbd[_0x4520('0x30')]['limit']);_0x7ce8d2[_0x4520('0x22')]=qs['offset'](_0x222dbd[_0x4520('0x30')][_0x4520('0x22')]);}_0x7ce8d2['order']=qs['sort'](_0x222dbd['query'][_0x4520('0x38')]);_0x7ce8d2[_0x4520('0x39')]=qs[_0x4520('0x31')](_[_0x4520('0x3a')](_0x222dbd[_0x4520('0x30')],_0x14778a[_0x4520('0x31')]),_0x157293);if(_0x222dbd[_0x4520('0x30')]['filter']){_0x7ce8d2[_0x4520('0x39')]=_[_0x4520('0x3b')](_0x7ce8d2[_0x4520('0x39')],{'$or':_['map'](_0x157293,function(_0x16d489){if(_0x16d489[_0x4520('0x2e')]!=='VIRTUAL'){var _0x57b155={};_0x57b155[_0x16d489[_0x4520('0x2a')]]={'$like':'%'+_0x222dbd[_0x4520('0x30')][_0x4520('0x3c')]+'%'};return _0x57b155;}})});}_0x7ce8d2=_[_0x4520('0x3b')]({},_0x7ce8d2,_0x222dbd[_0x4520('0x3d')]);var _0x5ca832={'where':_0x7ce8d2['where']};return db['MailQueueReport'][_0x4520('0x21')](_0x5ca832)['then'](function(_0x43dc36){_0x43b4a2['count']=_0x43dc36;if(_0x222dbd['query'][_0x4520('0x3e')]){_0x7ce8d2[_0x4520('0x3f')]=[{'all':!![]}];}return db[_0x4520('0x2d')][_0x4520('0x40')](_0x7ce8d2);})[_0x4520('0x41')](function(_0x59d646){_0x43b4a2[_0x4520('0x42')]=_0x59d646;return _0x43b4a2;})[_0x4520('0x41')](respondWithFilteredResult(_0x5c1a0b,_0x7ce8d2))['catch'](handleError(_0x5c1a0b,null));};exports['show']=function(_0x3780e4,_0x2ff306){var _0x500c45={'raw':!![],'where':{'id':_0x3780e4[_0x4520('0x43')]['id']}},_0x2978d5={};_0x2978d5[_0x4520('0x2f')]=_[_0x4520('0x44')](db['MailQueueReport'][_0x4520('0x45')]);_0x2978d5[_0x4520('0x30')]=_[_0x4520('0x44')](_0x3780e4[_0x4520('0x30')]);_0x2978d5[_0x4520('0x31')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],_0x2978d5[_0x4520('0x30')]);_0x500c45[_0x4520('0x33')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],qs[_0x4520('0x34')](_0x3780e4[_0x4520('0x30')][_0x4520('0x34')]));_0x500c45[_0x4520('0x33')]=_0x500c45[_0x4520('0x33')][_0x4520('0x35')]?_0x500c45['attributes']:_0x2978d5[_0x4520('0x2f')];if(_0x3780e4[_0x4520('0x30')]['includeAll']){_0x500c45['include']=[{'all':!![]}];}_0x500c45=_['merge']({},_0x500c45,_0x3780e4['options']);return db[_0x4520('0x2d')]['find'](_0x500c45)[_0x4520('0x41')](handleEntityNotFound(_0x2ff306,null))[_0x4520('0x41')](respondWithResult(_0x2ff306,null))[_0x4520('0x46')](handleError(_0x2ff306,null));};exports[_0x4520('0x47')]=function(_0x177c4e,_0x5e3eef){return db[_0x4520('0x2d')][_0x4520('0x47')](_0x177c4e[_0x4520('0x48')],{})[_0x4520('0x41')](respondWithResult(_0x5e3eef,0xc9))[_0x4520('0x46')](handleError(_0x5e3eef,null));};exports[_0x4520('0x26')]=function(_0x737ba4,_0x1e4821){if(_0x737ba4[_0x4520('0x48')]['id']){delete _0x737ba4[_0x4520('0x48')]['id'];}return db[_0x4520('0x2d')][_0x4520('0x49')]({'where':{'id':_0x737ba4['params']['id']}})['then'](handleEntityNotFound(_0x1e4821,null))[_0x4520('0x41')](saveUpdates(_0x737ba4[_0x4520('0x48')],null))[_0x4520('0x41')](respondWithResult(_0x1e4821,null))['catch'](handleError(_0x1e4821,null));};exports[_0x4520('0x27')]=function(_0x2288a7,_0x3f9a4c){return db['MailQueueReport'][_0x4520('0x49')]({'where':{'id':_0x2288a7[_0x4520('0x43')]['id']}})[_0x4520('0x41')](handleEntityNotFound(_0x3f9a4c,null))['then'](removeEntity(_0x3f9a4c,null))['catch'](handleError(_0x3f9a4c,null));};exports[_0x4520('0x4a')]=function(_0x24a6a4,_0x24269e){return db[_0x4520('0x2d')][_0x4520('0x4a')]()[_0x4520('0x41')](respondWithResult(_0x24269e,null))[_0x4520('0x46')](handleError(_0x24269e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d174914..0e12185 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 _0xb48c=['uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','report_mail_queue'];(function(_0x42bbed,_0x2ded4a){var _0x5cba04=function(_0x1f0d37){while(--_0x1f0d37){_0x42bbed['push'](_0x42bbed['shift']());}};_0x5cba04(++_0x2ded4a);}(_0xb48c,0xdd));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var logger=require(_0xcb48('0x2'))('api');var moment=require(_0xcb48('0x3'));var BPromise=require(_0xcb48('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb48('0x5'));var rimraf=require(_0xcb48('0x6'));var config=require(_0xcb48('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xcb48('0x8')]=function(_0xf423d7,_0x2c69db){return _0xf423d7['define']('MailQueueReport',attributes,{'tableName':_0xcb48('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcb48('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd1c=['api','bluebird','path','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x517bf6,_0x68ed7f){var _0x17da81=function(_0xc1a10d){while(--_0xc1a10d){_0x517bf6['push'](_0x517bf6['shift']());}};_0x17da81(++_0x68ed7f);}(_0xbd1c,0x14e));var _0xcbd1=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xbd1c[_0x176329];return _0x31997c;};'use strict';var _=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var logger=require('../../config/logger')(_0xcbd1('0x2'));var moment=require('moment');var BPromise=require(_0xcbd1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbd1('0x4'));var rimraf=require(_0xcbd1('0x5'));var config=require(_0xcbd1('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0xcbd1('0x7')]=function(_0x5f2b7c,_0x430906){return _0x5f2b7c[_0xcbd1('0x8')](_0xcbd1('0x9'),attributes,{'tableName':_0xcbd1('0xa'),'paranoid':![],'indexes':[{'name':_0xcbd1('0xb'),'fields':[_0xcbd1('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 2800669..260dc3d 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x4f53d2,_0x373000){var _0x1587db=function(_0x4d2c4c){while(--_0x4d2c4c){_0x4f53d2['push'](_0x4f53d2['shift']());}};_0x1587db(++_0x373000);}(_0x2ef3,0xba));var _0x32ef=function(_0x2d88bc,_0x1ba0aa){_0x2d88bc=_0x2d88bc-0x0;var _0x24b7e7=_0x2ef3[_0x2d88bc];return _0x24b7e7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x44d9f6,_0x4f2a6b){var _0x525b91=function(_0x27a608){while(--_0x27a608){_0x44d9f6['push'](_0x44d9f6['shift']());}};_0x525b91(++_0x4f2a6b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ae484,_0x4d68ac){_0x1ae484=_0x1ae484-0x0;var _0xf73934=_0x5f2f[_0x1ae484];return _0xf73934;};'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')]('MailQueueReport,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 16d51ab..0b445aa 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x37e000,_0x2f86d8){var _0x2b5619=function(_0xc5f6ee){while(--_0xc5f6ee){_0x37e000['push'](_0x37e000['shift']());}};_0x2b5619(++_0x2f86d8);}(_0x70e0,0x17b));var _0x070e=function(_0x4babf8,_0x51d543){_0x4babf8=_0x4babf8-0x0;var _0x41f5ce=_0x70e0[_0x4babf8];return _0x41f5ce;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4c13ba,_0x40fbcb){var _0x27850a=function(_0x28880f){while(--_0x28880f){_0x4c13ba['push'](_0x4c13ba['shift']());}};_0x27850a(++_0x40fbcb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1f6c92d..20df981 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 _0xf76a=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x3aac96,_0xd712c2){var _0x36f377=function(_0x34f1c5){while(--_0x34f1c5){_0x3aac96['push'](_0x3aac96['shift']());}};_0x36f377(++_0xd712c2);}(_0xf76a,0xd4));var _0xaf76=function(_0x4efa28,_0x4e1805){_0x4efa28=_0x4efa28-0x0;var _0x599196=_0xf76a[_0x4efa28];return _0x599196;};'use strict';var Sequelize=require(_0xaf76('0x0'));module[_0xaf76('0x1')]={'description':{'type':Sequelize[_0xaf76('0x2')]},'host':{'type':Sequelize[_0xaf76('0x2')]},'authentication':{'type':Sequelize[_0xaf76('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xaf76('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaf76('0x4')]},'tls':{'type':Sequelize[_0xaf76('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xaf76('0x2')],'defaultValue':_0xaf76('0x5')},'connTimeout':{'type':Sequelize[_0xaf76('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaf76('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xaf76('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xec8b=['INTEGER','STRING','BOOLEAN'];(function(_0x3d5ebc,_0x354479){var _0x1a9911=function(_0x1da1ea){while(--_0x1da1ea){_0x3d5ebc['push'](_0x3d5ebc['shift']());}};_0x1a9911(++_0x354479);}(_0xec8b,0x91));var _0xbec8=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xec8b[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xbec8('0x0')]},'host':{'type':Sequelize[_0xbec8('0x0')]},'authentication':{'type':Sequelize[_0xbec8('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbec8('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbec8('0x2')]},'tls':{'type':Sequelize[_0xbec8('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xbec8('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xbec8('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbec8('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xbec8('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1c623e1..0ec42ed 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 _0x8d2a=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x5c9906,_0xcaa270){var _0x57e87d=function(_0x92d69a){while(--_0x92d69a){_0x5c9906['push'](_0x5c9906['shift']());}};_0x57e87d(++_0xcaa270);}(_0x8d2a,0x176));var _0xa8d2=function(_0x221514,_0x32c758){_0x221514=_0x221514-0x0;var _0x4a6d5e=_0x8d2a[_0x221514];return _0x4a6d5e;};'use strict';var _=require(_0xa8d2('0x0'));var util=require(_0xa8d2('0x1'));var logger=require(_0xa8d2('0x2'))('api');var moment=require(_0xa8d2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8d2('0x4'));var fs=require('fs');var path=require(_0xa8d2('0x5'));var rimraf=require('rimraf');var config=require(_0xa8d2('0x6'));var attributes=require(_0xa8d2('0x7'));module[_0xa8d2('0x8')]=function(_0x560f16,_0x552558){return _0x560f16[_0xa8d2('0x9')](_0xa8d2('0xa'),attributes,{'tableName':_0xa8d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b1d=['MailServerIn','mail_servers_in','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2b1d,0x160));var _0xd2b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd2b1('0x0'));var logger=require(_0xd2b1('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd2b1('0x2'));var rp=require(_0xd2b1('0x3'));var fs=require('fs');var path=require(_0xd2b1('0x4'));var rimraf=require(_0xd2b1('0x5'));var config=require(_0xd2b1('0x6'));var attributes=require('./mailServerIn.attributes');module[_0xd2b1('0x7')]=function(_0x4cad86,_0x4546b6){return _0x4cad86['define'](_0xd2b1('0x8'),attributes,{'tableName':_0xd2b1('0x9'),'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 7d86019..8cd3255 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 _0x2dfb=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','catch'];(function(_0x5f1465,_0x3d2c4c){var _0x39e51d=function(_0x151354){while(--_0x151354){_0x5f1465['push'](_0x5f1465['shift']());}};_0x39e51d(++_0x3d2c4c);}(_0x2dfb,0x10e));var _0xb2df=function(_0x1d60ec,_0x5101d4){_0x1d60ec=_0x1d60ec-0x0;var _0xe6508e=_0x2dfb[_0x1d60ec];return _0xe6508e;};'use strict';var _=require(_0xb2df('0x0'));var util=require(_0xb2df('0x1'));var moment=require('moment');var BPromise=require(_0xb2df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2df('0x3'));var db=require(_0xb2df('0x4'))['db'];var utils=require(_0xb2df('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb2df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb2df('0x7')][_0xb2df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e4ade,_0x3a8b74,_0x203af6){return new BPromise(function(_0x26bd09,_0x43a8c0){return client[_0xb2df('0x9')](_0x2e4ade,_0x203af6)[_0xb2df('0xa')](function(_0x4abd84){logger[_0xb2df('0xb')](_0xb2df('0xc'),_0x3a8b74,'request\x20sent');logger['debug'](_0xb2df('0xd'),_0x3a8b74,_0xb2df('0xe'),JSON[_0xb2df('0xf')](_0x4abd84));if(_0x4abd84[_0xb2df('0x10')]){if(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x11')]===0x1f4){logger[_0xb2df('0x10')](_0xb2df('0xc'),_0x3a8b74,_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);return _0x43a8c0(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0x4abd84[_0xb2df('0x10')]['message']);return _0x26bd09(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);}else{logger[_0xb2df('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0xb2df('0xe'));_0x26bd09(_0x4abd84['result']['message']);}})['catch'](function(_0x2dbaae){logger[_0xb2df('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0x2dbaae);_0x43a8c0(_0x2dbaae);});});}exports[_0xb2df('0x13')]=function(_0x37e733){var _0x301635=this;return new Promise(function(_0x327d4a,_0x712d8){return db['MailServerIn'][_0xb2df('0x14')]({'raw':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x16')]===undefined?!![]:![]:!![],'where':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x17')]||null:null,'attributes':_0x37e733['options']?_0x37e733[_0xb2df('0x15')][_0xb2df('0x18')]||null:null,'limit':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')]['limit']||null:null,'include':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x19')]?_[_0xb2df('0x1a')](_0x37e733[_0xb2df('0x15')][_0xb2df('0x19')],function(_0x38094e){return{'model':db[_0x38094e[_0xb2df('0x1b')]],'as':_0x38094e['as'],'attributes':_0x38094e[_0xb2df('0x18')],'include':_0x38094e[_0xb2df('0x19')]?_[_0xb2df('0x1a')](_0x38094e[_0xb2df('0x19')],function(_0x173acd){return{'model':db[_0x173acd[_0xb2df('0x1b')]],'as':_0x173acd['as'],'attributes':_0x173acd[_0xb2df('0x18')],'include':_0x173acd['include']?_[_0xb2df('0x1a')](_0x173acd[_0xb2df('0x19')],function(_0x14ccd3){return{'model':db[_0x14ccd3['model']],'as':_0x14ccd3['as'],'attributes':_0x14ccd3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2df('0xa')](function(_0x4efab0){logger['info'](_0xb2df('0x13'),_0x37e733);logger[_0xb2df('0x1c')]('GetMailServerIn',_0x37e733,JSON[_0xb2df('0xf')](_0x4efab0));_0x327d4a(_0x4efab0);})[_0xb2df('0x1d')](function(_0x33c9b8){logger[_0xb2df('0x10')]('GetMailServerIn',_0x33c9b8[_0xb2df('0x12')],_0x37e733);_0x712d8(_0x301635[_0xb2df('0x10')](0x1f4,_0x33c9b8[_0xb2df('0x12')]));});});}; \ No newline at end of file +var _0xc743=['options','where','attributes','limit','include','map','model','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','info','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xc743,0x15c));var _0x3c74=function(_0x1c33b1,_0x4ced53){_0x1c33b1=_0x1c33b1-0x0;var _0x488310=_0xc743[_0x1c33b1];return _0x488310;};'use strict';var _=require('lodash');var util=require(_0x3c74('0x0'));var moment=require('moment');var BPromise=require(_0x3c74('0x1'));var rs=require(_0x3c74('0x2'));var fs=require('fs');var Redis=require(_0x3c74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c74('0x4'))(_0x3c74('0x5'));var config=require(_0x3c74('0x6'));var jayson=require(_0x3c74('0x7'));var client=jayson[_0x3c74('0x8')][_0x3c74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dde75,_0x4aac2e,_0x39fc3f){return new BPromise(function(_0x337754,_0x4991b7){return client[_0x3c74('0xa')](_0x3dde75,_0x39fc3f)[_0x3c74('0xb')](function(_0x206322){logger['info']('MailServerIn,\x20%s,\x20%s',_0x4aac2e,'request\x20sent');logger[_0x3c74('0xc')](_0x3c74('0xd'),_0x4aac2e,_0x3c74('0xe'),JSON['stringify'](_0x206322));if(_0x206322[_0x3c74('0xf')]){if(_0x206322[_0x3c74('0xf')][_0x3c74('0x10')]===0x1f4){logger[_0x3c74('0xf')](_0x3c74('0x11'),_0x4aac2e,_0x206322['error']['message']);return _0x4991b7(_0x206322[_0x3c74('0xf')][_0x3c74('0x12')]);}logger[_0x3c74('0xf')](_0x3c74('0x11'),_0x4aac2e,_0x206322[_0x3c74('0xf')][_0x3c74('0x12')]);return _0x337754(_0x206322['error']['message']);}else{logger[_0x3c74('0x13')](_0x3c74('0x11'),_0x4aac2e,'request\x20sent');_0x337754(_0x206322['result'][_0x3c74('0x12')]);}})[_0x3c74('0x14')](function(_0xd23661){logger['error'](_0x3c74('0x11'),_0x4aac2e,_0xd23661);_0x4991b7(_0xd23661);});});}exports[_0x3c74('0x15')]=function(_0x307055){var _0x3709b1=this;return new Promise(function(_0x29c147,_0x15bf26){return db[_0x3c74('0x16')][_0x3c74('0x17')]({'raw':_0x307055[_0x3c74('0x18')]?_0x307055[_0x3c74('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x307055[_0x3c74('0x18')]?_0x307055['options'][_0x3c74('0x19')]||null:null,'attributes':_0x307055['options']?_0x307055[_0x3c74('0x18')][_0x3c74('0x1a')]||null:null,'limit':_0x307055[_0x3c74('0x18')]?_0x307055[_0x3c74('0x18')][_0x3c74('0x1b')]||null:null,'include':_0x307055['options']?_0x307055[_0x3c74('0x18')][_0x3c74('0x1c')]?_[_0x3c74('0x1d')](_0x307055['options'][_0x3c74('0x1c')],function(_0x1cc27c){return{'model':db[_0x1cc27c['model']],'as':_0x1cc27c['as'],'attributes':_0x1cc27c[_0x3c74('0x1a')],'include':_0x1cc27c['include']?_[_0x3c74('0x1d')](_0x1cc27c['include'],function(_0x38c39c){return{'model':db[_0x38c39c[_0x3c74('0x1e')]],'as':_0x38c39c['as'],'attributes':_0x38c39c['attributes'],'include':_0x38c39c['include']?_[_0x3c74('0x1d')](_0x38c39c[_0x3c74('0x1c')],function(_0x55f0bc){return{'model':db[_0x55f0bc['model']],'as':_0x55f0bc['as'],'attributes':_0x55f0bc[_0x3c74('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3c74('0xb')](function(_0x35b1ed){logger[_0x3c74('0x13')](_0x3c74('0x15'),_0x307055);logger[_0x3c74('0xc')](_0x3c74('0x15'),_0x307055,JSON['stringify'](_0x35b1ed));_0x29c147(_0x35b1ed);})[_0x3c74('0x14')](function(_0x47d95a){logger[_0x3c74('0xf')](_0x3c74('0x15'),_0x47d95a[_0x3c74('0x12')],_0x307055);_0x15bf26(_0x3709b1[_0x3c74('0xf')](0x1f4,_0x47d95a[_0x3c74('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b26fff3..42e2a56 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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x25022f,_0x1477ac){_0x25022f=_0x25022f-0x0;var _0x20036f=_0x7a54[_0x25022f];return _0x20036f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x10c0bd,_0x5dcaf7){_0x10c0bd=_0x10c0bd-0x0;var _0x2e42bf=_0x7a54[_0x10c0bd];return _0x2e42bf;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 51a715a..0548d48 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 _0x3266=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4cc11e,_0x3c625b){var _0x507008=function(_0x2ad184){while(--_0x2ad184){_0x4cc11e['push'](_0x4cc11e['shift']());}};_0x507008(++_0x3c625b);}(_0x3266,0x6a));var _0x6326=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x3266[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'description':{'type':Sequelize[_0x6326('0x2')]},'host':{'type':Sequelize[_0x6326('0x2')]},'user':{'type':Sequelize[_0x6326('0x2')]},'pass':{'type':Sequelize[_0x6326('0x2')]},'port':{'type':Sequelize[_0x6326('0x3')]},'secure':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6326('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2f68=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x9a5cb3,_0x3c813a){var _0x2f72fb=function(_0x30a945){while(--_0x30a945){_0x9a5cb3['push'](_0x9a5cb3['shift']());}};_0x2f72fb(++_0x3c813a);}(_0x2f68,0x9a));var _0x82f6=function(_0x48bcfa,_0x6f45d0){_0x48bcfa=_0x48bcfa-0x0;var _0x36c9aa=_0x2f68[_0x48bcfa];return _0x36c9aa;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'description':{'type':Sequelize[_0x82f6('0x1')]},'host':{'type':Sequelize[_0x82f6('0x1')]},'user':{'type':Sequelize[_0x82f6('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x82f6('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x82f6('0x1')]},'authentication':{'type':Sequelize[_0x82f6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7dedc6d..3e25151 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 _0x99c8=['catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','apply','save','update','destroy','then','end','sendStatus','error','name','send','MailServerOut','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','find','create','body','params'];(function(_0x2db328,_0xf8e678){var _0x15b8b5=function(_0x1e0447){while(--_0x1e0447){_0x2db328['push'](_0x2db328['shift']());}};_0x15b8b5(++_0xf8e678);}(_0x99c8,0x115));var _0x899c=function(_0x404154,_0x47b6bf){_0x404154=_0x404154-0x0;var _0x13b5be=_0x99c8[_0x404154];return _0x13b5be;};'use strict';var emlformat=require(_0x899c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x899c('0x1'));var jsonpatch=require(_0x899c('0x2'));var rp=require(_0x899c('0x3'));var moment=require(_0x899c('0x4'));var BPromise=require(_0x899c('0x5'));var Mustache=require(_0x899c('0x6'));var util=require('util');var path=require(_0x899c('0x7'));var sox=require(_0x899c('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(_0x899c('0x9'));var crypto=require(_0x899c('0xa'));var jsforce=require(_0x899c('0xb'));var deskjs=require(_0x899c('0xc'));var toCsv=require(_0x899c('0xd'));var querystring=require(_0x899c('0xe'));var Papa=require(_0x899c('0xf'));var Redis=require(_0x899c('0x10'));var authService=require(_0x899c('0x11'));var qs=require(_0x899c('0x12'));var as=require(_0x899c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x899c('0x14'));var utils=require(_0x899c('0x15'));var config=require(_0x899c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d29be,_0xbcaebf){_0xbcaebf=_0xbcaebf||0xcc;return function(_0x57f325){if(_0x57f325){return _0x1d29be['sendStatus'](_0xbcaebf);}return _0x1d29be[_0x899c('0x17')](_0xbcaebf)['end']();};}function respondWithResult(_0x43e5d8,_0x503186){_0x503186=_0x503186||0xc8;return function(_0x4d2508){if(_0x4d2508){return _0x43e5d8['status'](_0x503186)[_0x899c('0x18')](_0x4d2508);}};}function respondWithFilteredResult(_0x34c216,_0x29ceb2){return function(_0x5c5b26){if(_0x5c5b26){var _0x458bdb=typeof _0x29ceb2[_0x899c('0x19')]===_0x899c('0x1a')&&typeof _0x29ceb2[_0x899c('0x1b')]===_0x899c('0x1a');var _0x34a5f4=_0x5c5b26[_0x899c('0x1c')];var _0x4b8a42=_0x458bdb?0x0:_0x29ceb2[_0x899c('0x19')];var _0x1000ed=_0x458bdb?_0x5c5b26[_0x899c('0x1c')]:_0x29ceb2[_0x899c('0x19')]+_0x29ceb2['limit'];var _0x483322;if(_0x1000ed>=_0x34a5f4){_0x1000ed=_0x34a5f4;_0x483322=0xc8;}else{_0x483322=0xce;}_0x34c216['status'](_0x483322);return _0x34c216['set']('Content-Range',_0x4b8a42+'-'+_0x1000ed+'/'+_0x34a5f4)['json'](_0x5c5b26);}return null;};}function patchUpdates(_0x2fabba){return function(_0x15e581){try{jsonpatch[_0x899c('0x1d')](_0x15e581,_0x2fabba,!![]);}catch(_0xb08e71){return BPromise['reject'](_0xb08e71);}return _0x15e581[_0x899c('0x1e')]();};}function saveUpdates(_0x1e131a,_0x339da4){return function(_0x1dbcde){if(_0x1dbcde){return _0x1dbcde[_0x899c('0x1f')](_0x1e131a)['then'](function(_0x2ded39){return _0x2ded39;});}return null;};}function removeEntity(_0x38ced5,_0x29ad9d){return function(_0x5c78cd){if(_0x5c78cd){return _0x5c78cd[_0x899c('0x20')]()[_0x899c('0x21')](function(){_0x38ced5['status'](0xcc)[_0x899c('0x22')]();});}};}function handleEntityNotFound(_0x1ed264,_0x407ae9){return function(_0x225372){if(!_0x225372){_0x1ed264[_0x899c('0x23')](0x194);}return _0x225372;};}function handleError(_0x409c0f,_0x206979){_0x206979=_0x206979||0x1f4;return function(_0x12c396){logger[_0x899c('0x24')](_0x12c396['stack']);if(_0x12c396['name']){delete _0x12c396[_0x899c('0x25')];}_0x409c0f[_0x899c('0x17')](_0x206979)[_0x899c('0x26')](_0x12c396);};}exports['index']=function(_0x30debb,_0x589ffc){var _0x5dfd6d={},_0x20e138={},_0x4001ba={'count':0x0,'rows':[]};var _0x385182=_['map'](db[_0x899c('0x27')][_0x899c('0x28')],function(_0x3b5fb0){return{'name':_0x3b5fb0[_0x899c('0x29')],'type':_0x3b5fb0[_0x899c('0x2a')][_0x899c('0x2b')]};});_0x20e138[_0x899c('0x2c')]=_[_0x899c('0x2d')](_0x385182,'name');_0x20e138['query']=_[_0x899c('0x2e')](_0x30debb[_0x899c('0x2f')]);_0x20e138[_0x899c('0x30')]=_['intersection'](_0x20e138[_0x899c('0x2c')],_0x20e138[_0x899c('0x2f')]);_0x5dfd6d[_0x899c('0x31')]=_[_0x899c('0x32')](_0x20e138['model'],qs[_0x899c('0x33')](_0x30debb[_0x899c('0x2f')][_0x899c('0x33')]));_0x5dfd6d[_0x899c('0x31')]=_0x5dfd6d[_0x899c('0x31')][_0x899c('0x34')]?_0x5dfd6d['attributes']:_0x20e138[_0x899c('0x2c')];if(!_0x30debb[_0x899c('0x2f')][_0x899c('0x35')](_0x899c('0x36'))){_0x5dfd6d[_0x899c('0x1b')]=qs[_0x899c('0x1b')](_0x30debb[_0x899c('0x2f')]['limit']);_0x5dfd6d[_0x899c('0x19')]=qs[_0x899c('0x19')](_0x30debb[_0x899c('0x2f')][_0x899c('0x19')]);}_0x5dfd6d[_0x899c('0x37')]=qs[_0x899c('0x38')](_0x30debb[_0x899c('0x2f')][_0x899c('0x38')]);_0x5dfd6d[_0x899c('0x39')]=qs[_0x899c('0x30')](_['pick'](_0x30debb[_0x899c('0x2f')],_0x20e138[_0x899c('0x30')]),_0x385182);if(_0x30debb[_0x899c('0x2f')][_0x899c('0x3a')]){_0x5dfd6d[_0x899c('0x39')]=_[_0x899c('0x3b')](_0x5dfd6d[_0x899c('0x39')],{'$or':_['map'](_0x385182,function(_0x3127a7){if(_0x3127a7[_0x899c('0x2a')]!==_0x899c('0x3c')){var _0x4139e6={};_0x4139e6[_0x3127a7['name']]={'$like':'%'+_0x30debb[_0x899c('0x2f')][_0x899c('0x3a')]+'%'};return _0x4139e6;}})});}_0x5dfd6d=_[_0x899c('0x3b')]({},_0x5dfd6d,_0x30debb[_0x899c('0x3d')]);var _0x1011ce={'where':_0x5dfd6d[_0x899c('0x39')]};return db[_0x899c('0x27')]['count'](_0x1011ce)[_0x899c('0x21')](function(_0x2717cc){_0x4001ba[_0x899c('0x1c')]=_0x2717cc;if(_0x30debb[_0x899c('0x2f')][_0x899c('0x3e')]){_0x5dfd6d[_0x899c('0x3f')]=[{'all':!![]}];}return db[_0x899c('0x27')]['findAll'](_0x5dfd6d);})['then'](function(_0x1ab364){_0x4001ba['rows']=_0x1ab364;return _0x4001ba;})[_0x899c('0x21')](respondWithFilteredResult(_0x589ffc,_0x5dfd6d))['catch'](handleError(_0x589ffc,null));};exports['show']=function(_0x1a91d1,_0x1adb80){var _0x35c635={'raw':!![],'where':{'id':_0x1a91d1['params']['id']}},_0x315c6c={};_0x315c6c['model']=_[_0x899c('0x2e')](db['MailServerOut'][_0x899c('0x28')]);_0x315c6c[_0x899c('0x2f')]=_[_0x899c('0x2e')](_0x1a91d1[_0x899c('0x2f')]);_0x315c6c[_0x899c('0x30')]=_[_0x899c('0x32')](_0x315c6c[_0x899c('0x2c')],_0x315c6c[_0x899c('0x2f')]);_0x35c635[_0x899c('0x31')]=_[_0x899c('0x32')](_0x315c6c[_0x899c('0x2c')],qs[_0x899c('0x33')](_0x1a91d1[_0x899c('0x2f')][_0x899c('0x33')]));_0x35c635[_0x899c('0x31')]=_0x35c635['attributes']['length']?_0x35c635[_0x899c('0x31')]:_0x315c6c[_0x899c('0x2c')];if(_0x1a91d1[_0x899c('0x2f')][_0x899c('0x3e')]){_0x35c635[_0x899c('0x3f')]=[{'all':!![]}];}_0x35c635=_[_0x899c('0x3b')]({},_0x35c635,_0x1a91d1['options']);return db[_0x899c('0x27')][_0x899c('0x40')](_0x35c635)[_0x899c('0x21')](handleEntityNotFound(_0x1adb80,null))['then'](respondWithResult(_0x1adb80,null))['catch'](handleError(_0x1adb80,null));};exports[_0x899c('0x41')]=function(_0x4d06e8,_0xd116b9){return db['MailServerOut']['create'](_0x4d06e8['body'],{})[_0x899c('0x21')](respondWithResult(_0xd116b9,0xc9))['catch'](handleError(_0xd116b9,null));};exports[_0x899c('0x1f')]=function(_0xe5c2cc,_0x5e365d){if(_0xe5c2cc[_0x899c('0x42')]['id']){delete _0xe5c2cc['body']['id'];}return db['MailServerOut'][_0x899c('0x40')]({'where':{'id':_0xe5c2cc[_0x899c('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e365d,null))['then'](saveUpdates(_0xe5c2cc[_0x899c('0x42')],null))[_0x899c('0x21')](respondWithResult(_0x5e365d,null))[_0x899c('0x44')](handleError(_0x5e365d,null));};exports[_0x899c('0x20')]=function(_0x5839ea,_0x4e642c){return db[_0x899c('0x27')]['find']({'where':{'id':_0x5839ea[_0x899c('0x43')]['id']}})[_0x899c('0x21')](handleEntityNotFound(_0x4e642c,null))[_0x899c('0x21')](removeEntity(_0x4e642c,null))[_0x899c('0x44')](handleError(_0x4e642c,null));}; \ No newline at end of file +var _0x5547=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','index','map','MailServerOut','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','params','rawAttributes','length','find','catch','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x45a846,_0x2d421c){var _0x35d725=function(_0x257119){while(--_0x257119){_0x45a846['push'](_0x45a846['shift']());}};_0x35d725(++_0x2d421c);}(_0x5547,0xbd));var _0x7554=function(_0x4c56b6,_0x239082){_0x4c56b6=_0x4c56b6-0x0;var _0x1ee73a=_0x5547[_0x4c56b6];return _0x1ee73a;};'use strict';var emlformat=require(_0x7554('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7554('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7554('0x2'));var BPromise=require(_0x7554('0x3'));var Mustache=require(_0x7554('0x4'));var util=require(_0x7554('0x5'));var path=require(_0x7554('0x6'));var sox=require(_0x7554('0x7'));var csv=require(_0x7554('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7554('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7554('0xa'));var deskjs=require(_0x7554('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7554('0xc'));var Papa=require(_0x7554('0xd'));var Redis=require('ioredis');var authService=require(_0x7554('0xe'));var qs=require(_0x7554('0xf'));var as=require(_0x7554('0x10'));var hardwareService=require(_0x7554('0x11'));var logger=require('../../config/logger')(_0x7554('0x12'));var utils=require(_0x7554('0x13'));var config=require(_0x7554('0x14'));var licenseUtil=require(_0x7554('0x15'));var db=require(_0x7554('0x16'))['db'];function respondWithStatusCode(_0x23e121,_0x273dcf){_0x273dcf=_0x273dcf||0xcc;return function(_0x2c5e6f){if(_0x2c5e6f){return _0x23e121[_0x7554('0x17')](_0x273dcf);}return _0x23e121['status'](_0x273dcf)[_0x7554('0x18')]();};}function respondWithResult(_0x25f0a9,_0x1c1082){_0x1c1082=_0x1c1082||0xc8;return function(_0x1baece){if(_0x1baece){return _0x25f0a9['status'](_0x1c1082)[_0x7554('0x19')](_0x1baece);}};}function respondWithFilteredResult(_0x5a233d,_0x3ffcd9){return function(_0x1f5e86){if(_0x1f5e86){var _0x487608=typeof _0x3ffcd9[_0x7554('0x1a')]===_0x7554('0x1b')&&typeof _0x3ffcd9[_0x7554('0x1c')]===_0x7554('0x1b');var _0x498529=_0x1f5e86['count'];var _0x87f9fc=_0x487608?0x0:_0x3ffcd9['offset'];var _0x27d3e3=_0x487608?_0x1f5e86[_0x7554('0x1d')]:_0x3ffcd9[_0x7554('0x1a')]+_0x3ffcd9[_0x7554('0x1c')];var _0x4de290;if(_0x27d3e3>=_0x498529){_0x27d3e3=_0x498529;_0x4de290=0xc8;}else{_0x4de290=0xce;}_0x5a233d[_0x7554('0x1e')](_0x4de290);return _0x5a233d['set'](_0x7554('0x1f'),_0x87f9fc+'-'+_0x27d3e3+'/'+_0x498529)[_0x7554('0x19')](_0x1f5e86);}return null;};}function patchUpdates(_0x35c962){return function(_0xc5c679){try{jsonpatch[_0x7554('0x20')](_0xc5c679,_0x35c962,!![]);}catch(_0x2613b9){return BPromise[_0x7554('0x21')](_0x2613b9);}return _0xc5c679[_0x7554('0x22')]();};}function saveUpdates(_0x298816,_0x51c619){return function(_0x3d0c6e){if(_0x3d0c6e){return _0x3d0c6e[_0x7554('0x23')](_0x298816)[_0x7554('0x24')](function(_0x45d817){return _0x45d817;});}return null;};}function removeEntity(_0x4d31a6,_0x15388c){return function(_0x54179d){if(_0x54179d){return _0x54179d[_0x7554('0x25')]()[_0x7554('0x24')](function(){_0x4d31a6[_0x7554('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a9d9,_0x238e11){return function(_0xcaaa8d){if(!_0xcaaa8d){_0x23a9d9['sendStatus'](0x194);}return _0xcaaa8d;};}function handleError(_0x117c08,_0x2539d2){_0x2539d2=_0x2539d2||0x1f4;return function(_0x57d530){logger['error'](_0x57d530['stack']);if(_0x57d530['name']){delete _0x57d530['name'];}_0x117c08['status'](_0x2539d2)['send'](_0x57d530);};}exports[_0x7554('0x26')]=function(_0x3e595c,_0x819785){var _0x2fc8c5={},_0x4adea5={},_0x362366={'count':0x0,'rows':[]};var _0x52519a=_[_0x7554('0x27')](db[_0x7554('0x28')]['rawAttributes'],function(_0x4e2e6d){return{'name':_0x4e2e6d[_0x7554('0x29')],'type':_0x4e2e6d[_0x7554('0x2a')][_0x7554('0x2b')]};});_0x4adea5[_0x7554('0x2c')]=_[_0x7554('0x27')](_0x52519a,_0x7554('0x2d'));_0x4adea5[_0x7554('0x2e')]=_[_0x7554('0x2f')](_0x3e595c[_0x7554('0x2e')]);_0x4adea5['filters']=_[_0x7554('0x30')](_0x4adea5[_0x7554('0x2c')],_0x4adea5[_0x7554('0x2e')]);_0x2fc8c5['attributes']=_[_0x7554('0x30')](_0x4adea5['model'],qs[_0x7554('0x31')](_0x3e595c['query'][_0x7554('0x31')]));_0x2fc8c5[_0x7554('0x32')]=_0x2fc8c5[_0x7554('0x32')]['length']?_0x2fc8c5['attributes']:_0x4adea5[_0x7554('0x2c')];if(!_0x3e595c[_0x7554('0x2e')][_0x7554('0x33')](_0x7554('0x34'))){_0x2fc8c5[_0x7554('0x1c')]=qs[_0x7554('0x1c')](_0x3e595c['query']['limit']);_0x2fc8c5[_0x7554('0x1a')]=qs[_0x7554('0x1a')](_0x3e595c[_0x7554('0x2e')]['offset']);}_0x2fc8c5[_0x7554('0x35')]=qs[_0x7554('0x36')](_0x3e595c['query'][_0x7554('0x36')]);_0x2fc8c5[_0x7554('0x37')]=qs[_0x7554('0x38')](_['pick'](_0x3e595c['query'],_0x4adea5[_0x7554('0x38')]),_0x52519a);if(_0x3e595c[_0x7554('0x2e')][_0x7554('0x39')]){_0x2fc8c5[_0x7554('0x37')]=_[_0x7554('0x3a')](_0x2fc8c5[_0x7554('0x37')],{'$or':_[_0x7554('0x27')](_0x52519a,function(_0x59adbd){if(_0x59adbd[_0x7554('0x2a')]!=='VIRTUAL'){var _0x34d6e3={};_0x34d6e3[_0x59adbd['name']]={'$like':'%'+_0x3e595c[_0x7554('0x2e')][_0x7554('0x39')]+'%'};return _0x34d6e3;}})});}_0x2fc8c5=_[_0x7554('0x3a')]({},_0x2fc8c5,_0x3e595c[_0x7554('0x3b')]);var _0x298ce5={'where':_0x2fc8c5[_0x7554('0x37')]};return db['MailServerOut'][_0x7554('0x1d')](_0x298ce5)['then'](function(_0x1341be){_0x362366['count']=_0x1341be;if(_0x3e595c[_0x7554('0x2e')][_0x7554('0x3c')]){_0x2fc8c5[_0x7554('0x3d')]=[{'all':!![]}];}return db['MailServerOut'][_0x7554('0x3e')](_0x2fc8c5);})[_0x7554('0x24')](function(_0x57a94f){_0x362366['rows']=_0x57a94f;return _0x362366;})[_0x7554('0x24')](respondWithFilteredResult(_0x819785,_0x2fc8c5))['catch'](handleError(_0x819785,null));};exports['show']=function(_0x53a669,_0x45f8a9){var _0x5c1eb7={'raw':!![],'where':{'id':_0x53a669[_0x7554('0x3f')]['id']}},_0x3b1df0={};_0x3b1df0['model']=_[_0x7554('0x2f')](db[_0x7554('0x28')][_0x7554('0x40')]);_0x3b1df0['query']=_[_0x7554('0x2f')](_0x53a669[_0x7554('0x2e')]);_0x3b1df0[_0x7554('0x38')]=_[_0x7554('0x30')](_0x3b1df0[_0x7554('0x2c')],_0x3b1df0[_0x7554('0x2e')]);_0x5c1eb7[_0x7554('0x32')]=_['intersection'](_0x3b1df0[_0x7554('0x2c')],qs[_0x7554('0x31')](_0x53a669[_0x7554('0x2e')][_0x7554('0x31')]));_0x5c1eb7[_0x7554('0x32')]=_0x5c1eb7[_0x7554('0x32')][_0x7554('0x41')]?_0x5c1eb7[_0x7554('0x32')]:_0x3b1df0[_0x7554('0x2c')];if(_0x53a669[_0x7554('0x2e')][_0x7554('0x3c')]){_0x5c1eb7['include']=[{'all':!![]}];}_0x5c1eb7=_['merge']({},_0x5c1eb7,_0x53a669['options']);return db[_0x7554('0x28')][_0x7554('0x42')](_0x5c1eb7)[_0x7554('0x24')](handleEntityNotFound(_0x45f8a9,null))[_0x7554('0x24')](respondWithResult(_0x45f8a9,null))[_0x7554('0x43')](handleError(_0x45f8a9,null));};exports[_0x7554('0x44')]=function(_0x390f27,_0x3fcac9){return db[_0x7554('0x28')]['create'](_0x390f27[_0x7554('0x45')],{})[_0x7554('0x24')](respondWithResult(_0x3fcac9,0xc9))['catch'](handleError(_0x3fcac9,null));};exports[_0x7554('0x23')]=function(_0x1f7f6d,_0x360e12){if(_0x1f7f6d[_0x7554('0x45')]['id']){delete _0x1f7f6d[_0x7554('0x45')]['id'];}return db['MailServerOut'][_0x7554('0x42')]({'where':{'id':_0x1f7f6d[_0x7554('0x3f')]['id']}})[_0x7554('0x24')](handleEntityNotFound(_0x360e12,null))[_0x7554('0x24')](saveUpdates(_0x1f7f6d[_0x7554('0x45')],null))[_0x7554('0x24')](respondWithResult(_0x360e12,null))[_0x7554('0x43')](handleError(_0x360e12,null));};exports[_0x7554('0x25')]=function(_0x1bd90b,_0xec2227){return db['MailServerOut'][_0x7554('0x42')]({'where':{'id':_0x1bd90b[_0x7554('0x3f')]['id']}})['then'](handleEntityNotFound(_0xec2227,null))['then'](removeEntity(_0xec2227,null))[_0x7554('0x43')](handleError(_0xec2227,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eabe998..ae9683e 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 _0xe1f9=['request-promise','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger','moment','bluebird'];(function(_0x18a619,_0x27dbdc){var _0x3e5c96=function(_0x3a8db5){while(--_0x3a8db5){_0x18a619['push'](_0x18a619['shift']());}};_0x3e5c96(++_0x27dbdc);}(_0xe1f9,0x128));var _0x9e1f=function(_0x4008c4,_0x59adbc){_0x4008c4=_0x4008c4-0x0;var _0x197211=_0xe1f9[_0x4008c4];return _0x197211;};'use strict';var _=require(_0x9e1f('0x0'));var util=require('util');var logger=require(_0x9e1f('0x1'))('api');var moment=require(_0x9e1f('0x2'));var BPromise=require(_0x9e1f('0x3'));var rp=require(_0x9e1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e1f('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e1f('0x6'));module[_0x9e1f('0x7')]=function(_0x218a5e,_0x3c7b9f){return _0x218a5e[_0x9e1f('0x8')](_0x9e1f('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fc1=['../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x529da5,_0x15de30){var _0x3b4fa7=function(_0x1d9d34){while(--_0x1d9d34){_0x529da5['push'](_0x529da5['shift']());}};_0x3b4fa7(++_0x15de30);}(_0x1fc1,0x117));var _0x11fc=function(_0x55f6cd,_0x3aec70){_0x55f6cd=_0x55f6cd-0x0;var _0x3c3c19=_0x1fc1[_0x55f6cd];return _0x3c3c19;};'use strict';var _=require('lodash');var util=require(_0x11fc('0x0'));var logger=require('../../config/logger')(_0x11fc('0x1'));var moment=require(_0x11fc('0x2'));var BPromise=require(_0x11fc('0x3'));var rp=require(_0x11fc('0x4'));var fs=require('fs');var path=require(_0x11fc('0x5'));var rimraf=require(_0x11fc('0x6'));var config=require(_0x11fc('0x7'));var attributes=require(_0x11fc('0x8'));module['exports']=function(_0x230ef2,_0x1d2179){return _0x230ef2['define'](_0x11fc('0x9'),attributes,{'tableName':_0x11fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c931f33..a7ed227 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(_0x66094a,_0x3f5795){var _0xf8cf1d=function(_0x65c657){while(--_0x65c657){_0x66094a['push'](_0x66094a['shift']());}};_0xf8cf1d(++_0x3f5795);}(_0xadb5,0xad));var _0x5adb=function(_0x5337a8,_0x46a7cd){_0x5337a8=_0x5337a8-0x0;var _0x391a69=_0xadb5[_0x5337a8];return _0x391a69;};'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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x1dda83,_0x24c881){_0x1dda83=_0x1dda83-0x0;var _0x2ba145=_0x7a54[_0x1dda83];return _0x2ba145;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0188f81..db4c72d 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 _0x6cce=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','/describe','isAuthenticated','describe','get','/:id','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2beffc,_0x34542f){var _0x56d300=function(_0x1936a9){while(--_0x1936a9){_0x2beffc['push'](_0x2beffc['shift']());}};_0x56d300(++_0x34542f);}(_0x6cce,0x81));var _0xe6cc=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0x6cce[_0x33d4a2];return _0x2c793f;};'use strict';var multer=require(_0xe6cc('0x0'));var util=require(_0xe6cc('0x1'));var path=require(_0xe6cc('0x2'));var timeout=require(_0xe6cc('0x3'));var express=require(_0xe6cc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6cc('0x5'));var interaction=require(_0xe6cc('0x6'));var config=require(_0xe6cc('0x7'));var controller=require(_0xe6cc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe6cc('0x9')]);router['get'](_0xe6cc('0xa'),auth[_0xe6cc('0xb')](),controller[_0xe6cc('0xc')]);router[_0xe6cc('0xd')](_0xe6cc('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe6cc('0xb')](),controller[_0xe6cc('0xf')]);router['put'](_0xe6cc('0xe'),auth[_0xe6cc('0xb')](),controller[_0xe6cc('0x10')]);router['delete'](_0xe6cc('0xe'),auth[_0xe6cc('0xb')](),controller[_0xe6cc('0x11')]);module[_0xe6cc('0x12')]=router; \ No newline at end of file +var _0x20a5=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x36847b,_0x5accf7){var _0x42056a=function(_0x5d9eb9){while(--_0x5d9eb9){_0x36847b['push'](_0x36847b['shift']());}};_0x42056a(++_0x5accf7);}(_0x20a5,0x125));var _0x520a=function(_0x351c21,_0x3f1dee){_0x351c21=_0x351c21-0x0;var _0x31336f=_0x20a5[_0x351c21];return _0x31336f;};'use strict';var multer=require(_0x520a('0x0'));var util=require(_0x520a('0x1'));var path=require(_0x520a('0x2'));var timeout=require(_0x520a('0x3'));var express=require(_0x520a('0x4'));var router=express[_0x520a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x520a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x520a('0x7'));var controller=require(_0x520a('0x8'));router[_0x520a('0x9')]('/',auth[_0x520a('0xa')](),controller['index']);router[_0x520a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x520a('0xb')]);router[_0x520a('0x9')](_0x520a('0xc'),auth[_0x520a('0xa')](),controller[_0x520a('0xd')]);router[_0x520a('0xe')]('/',auth[_0x520a('0xa')](),controller[_0x520a('0xf')]);router[_0x520a('0x10')](_0x520a('0xc'),auth['isAuthenticated'](),controller[_0x520a('0x11')]);router[_0x520a('0x12')]('/:id',auth[_0x520a('0xa')](),controller[_0x520a('0x13')]);module[_0x520a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3d581bd..8b18b4b 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 _0x1883=['exports','STRING','name','sequelize'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x1883,0xab));var _0x3188=function(_0x5a1d95,_0x3ce365){_0x5a1d95=_0x5a1d95-0x0;var _0x2a5eef=_0x1883[_0x5a1d95];return _0x2a5eef;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'unique':_0x3188('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3188('0x2')]}}; \ No newline at end of file +var _0xe0ae=['name','STRING'];(function(_0x33c021,_0x17844c){var _0x12c2cd=function(_0x5eeef6){while(--_0x5eeef6){_0x33c021['push'](_0x33c021['shift']());}};_0x12c2cd(++_0x17844c);}(_0xe0ae,0xa1));var _0xee0a=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xe0ae[_0x529296];return _0x1796bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee0a('0x0')],'unique':_0xee0a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 565e817..ec282cb 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 _0x9b6c=['sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','count','includeAll','include','rows','catch','show','params','length','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','then','stack','name','send','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order'];(function(_0x59a6f3,_0x166ede){var _0x4dc086=function(_0x48d4bb){while(--_0x48d4bb){_0x59a6f3['push'](_0x59a6f3['shift']());}};_0x4dc086(++_0x166ede);}(_0x9b6c,0xf9));var _0xc9b6=function(_0x1526f2,_0x1cb4f8){_0x1526f2=_0x1526f2-0x0;var _0x2ce186=_0x9b6c[_0x1526f2];return _0x2ce186;};'use strict';var emlformat=require(_0xc9b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9b6('0x1'));var jsonpatch=require(_0xc9b6('0x2'));var rp=require(_0xc9b6('0x3'));var moment=require('moment');var BPromise=require(_0xc9b6('0x4'));var Mustache=require('mustache');var util=require(_0xc9b6('0x5'));var path=require(_0xc9b6('0x6'));var sox=require(_0xc9b6('0x7'));var csv=require('to-csv');var ejs=require(_0xc9b6('0x8'));var fs=require('fs');var fs_extra=require(_0xc9b6('0x9'));var _=require('lodash');var squel=require(_0xc9b6('0xa'));var crypto=require(_0xc9b6('0xb'));var jsforce=require(_0xc9b6('0xc'));var deskjs=require(_0xc9b6('0xd'));var toCsv=require(_0xc9b6('0xe'));var querystring=require(_0xc9b6('0xf'));var Papa=require(_0xc9b6('0x10'));var Redis=require('ioredis');var authService=require(_0xc9b6('0x11'));var qs=require(_0xc9b6('0x12'));var as=require(_0xc9b6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9b6('0x14'))(_0xc9b6('0x15'));var utils=require(_0xc9b6('0x16'));var config=require(_0xc9b6('0x17'));var licenseUtil=require(_0xc9b6('0x18'));var db=require(_0xc9b6('0x19'))['db'];function respondWithStatusCode(_0x59a041,_0x27b728){_0x27b728=_0x27b728||0xcc;return function(_0x4c7156){if(_0x4c7156){return _0x59a041[_0xc9b6('0x1a')](_0x27b728);}return _0x59a041[_0xc9b6('0x1b')](_0x27b728)[_0xc9b6('0x1c')]();};}function respondWithResult(_0x292292,_0x28a358){_0x28a358=_0x28a358||0xc8;return function(_0x23e855){if(_0x23e855){return _0x292292[_0xc9b6('0x1b')](_0x28a358)[_0xc9b6('0x1d')](_0x23e855);}};}function respondWithFilteredResult(_0x51038b,_0x22c9f3){return function(_0x35bece){if(_0x35bece){var _0x4a02b8=typeof _0x22c9f3['offset']===_0xc9b6('0x1e')&&typeof _0x22c9f3[_0xc9b6('0x1f')]===_0xc9b6('0x1e');var _0x4464cb=_0x35bece['count'];var _0x227b6b=_0x4a02b8?0x0:_0x22c9f3['offset'];var _0x5f0546=_0x4a02b8?_0x35bece['count']:_0x22c9f3[_0xc9b6('0x20')]+_0x22c9f3[_0xc9b6('0x1f')];var _0x1aa04b;if(_0x5f0546>=_0x4464cb){_0x5f0546=_0x4464cb;_0x1aa04b=0xc8;}else{_0x1aa04b=0xce;}_0x51038b[_0xc9b6('0x1b')](_0x1aa04b);return _0x51038b[_0xc9b6('0x21')](_0xc9b6('0x22'),_0x227b6b+'-'+_0x5f0546+'/'+_0x4464cb)[_0xc9b6('0x1d')](_0x35bece);}return null;};}function patchUpdates(_0x1fa5ec){return function(_0x575985){try{jsonpatch[_0xc9b6('0x23')](_0x575985,_0x1fa5ec,!![]);}catch(_0x2d9fa4){return BPromise[_0xc9b6('0x24')](_0x2d9fa4);}return _0x575985['save']();};}function saveUpdates(_0x21e121,_0x52f21f){return function(_0x3e4ba9){if(_0x3e4ba9){return _0x3e4ba9['update'](_0x21e121)[_0xc9b6('0x25')](function(_0xd3d40a){return _0xd3d40a;});}return null;};}function removeEntity(_0x42e112,_0x72caf2){return function(_0xf3af4d){if(_0xf3af4d){return _0xf3af4d['destroy']()[_0xc9b6('0x25')](function(){_0x42e112[_0xc9b6('0x1b')](0xcc)[_0xc9b6('0x1c')]();});}};}function handleEntityNotFound(_0x162e66,_0x56dc02){return function(_0x5e99c8){if(!_0x5e99c8){_0x162e66['sendStatus'](0x194);}return _0x5e99c8;};}function handleError(_0x41ab2c,_0x5fc001){_0x5fc001=_0x5fc001||0x1f4;return function(_0x1f37ef){logger['error'](_0x1f37ef[_0xc9b6('0x26')]);if(_0x1f37ef[_0xc9b6('0x27')]){delete _0x1f37ef[_0xc9b6('0x27')];}_0x41ab2c['status'](_0x5fc001)[_0xc9b6('0x28')](_0x1f37ef);};}exports['index']=function(_0x508634,_0x14e5d8){var _0x4dd24c={},_0x500c78={},_0x47d0bb={'count':0x0,'rows':[]};var _0x4a48c4=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x22cb12){return{'name':_0x22cb12[_0xc9b6('0x29')],'type':_0x22cb12[_0xc9b6('0x2a')][_0xc9b6('0x2b')]};});_0x500c78['model']=_[_0xc9b6('0x2c')](_0x4a48c4,'name');_0x500c78[_0xc9b6('0x2d')]=_[_0xc9b6('0x2e')](_0x508634['query']);_0x500c78[_0xc9b6('0x2f')]=_[_0xc9b6('0x30')](_0x500c78['model'],_0x500c78[_0xc9b6('0x2d')]);_0x4dd24c[_0xc9b6('0x31')]=_[_0xc9b6('0x30')](_0x500c78[_0xc9b6('0x32')],qs[_0xc9b6('0x33')](_0x508634[_0xc9b6('0x2d')]['fields']));_0x4dd24c['attributes']=_0x4dd24c[_0xc9b6('0x31')]['length']?_0x4dd24c[_0xc9b6('0x31')]:_0x500c78[_0xc9b6('0x32')];if(!_0x508634[_0xc9b6('0x2d')][_0xc9b6('0x34')](_0xc9b6('0x35'))){_0x4dd24c[_0xc9b6('0x1f')]=qs[_0xc9b6('0x1f')](_0x508634[_0xc9b6('0x2d')][_0xc9b6('0x1f')]);_0x4dd24c[_0xc9b6('0x20')]=qs[_0xc9b6('0x20')](_0x508634[_0xc9b6('0x2d')][_0xc9b6('0x20')]);}_0x4dd24c[_0xc9b6('0x36')]=qs[_0xc9b6('0x37')](_0x508634[_0xc9b6('0x2d')]['sort']);_0x4dd24c[_0xc9b6('0x38')]=qs['filters'](_[_0xc9b6('0x39')](_0x508634[_0xc9b6('0x2d')],_0x500c78[_0xc9b6('0x2f')]),_0x4a48c4);if(_0x508634[_0xc9b6('0x2d')][_0xc9b6('0x3a')]){_0x4dd24c[_0xc9b6('0x38')]=_[_0xc9b6('0x3b')](_0x4dd24c[_0xc9b6('0x38')],{'$or':_['map'](_0x4a48c4,function(_0x41606d){if(_0x41606d[_0xc9b6('0x2a')]!==_0xc9b6('0x3c')){var _0x2d1fda={};_0x2d1fda[_0x41606d[_0xc9b6('0x27')]]={'$like':'%'+_0x508634[_0xc9b6('0x2d')]['filter']+'%'};return _0x2d1fda;}})});}_0x4dd24c=_['merge']({},_0x4dd24c,_0x508634['options']);var _0x3a1352={'where':_0x4dd24c['where']};return db[_0xc9b6('0x3d')][_0xc9b6('0x3e')](_0x3a1352)[_0xc9b6('0x25')](function(_0x42143a){_0x47d0bb[_0xc9b6('0x3e')]=_0x42143a;if(_0x508634['query'][_0xc9b6('0x3f')]){_0x4dd24c[_0xc9b6('0x40')]=[{'all':!![]}];}return db[_0xc9b6('0x3d')]['findAll'](_0x4dd24c);})[_0xc9b6('0x25')](function(_0x8b2061){_0x47d0bb[_0xc9b6('0x41')]=_0x8b2061;return _0x47d0bb;})['then'](respondWithFilteredResult(_0x14e5d8,_0x4dd24c))[_0xc9b6('0x42')](handleError(_0x14e5d8,null));};exports[_0xc9b6('0x43')]=function(_0x51e18b,_0x25bfbb){var _0x631d29={'raw':!![],'where':{'id':_0x51e18b[_0xc9b6('0x44')]['id']}},_0x68a2f3={};_0x68a2f3[_0xc9b6('0x32')]=_[_0xc9b6('0x2e')](db[_0xc9b6('0x3d')]['rawAttributes']);_0x68a2f3[_0xc9b6('0x2d')]=_[_0xc9b6('0x2e')](_0x51e18b[_0xc9b6('0x2d')]);_0x68a2f3[_0xc9b6('0x2f')]=_[_0xc9b6('0x30')](_0x68a2f3[_0xc9b6('0x32')],_0x68a2f3[_0xc9b6('0x2d')]);_0x631d29['attributes']=_['intersection'](_0x68a2f3[_0xc9b6('0x32')],qs[_0xc9b6('0x33')](_0x51e18b[_0xc9b6('0x2d')][_0xc9b6('0x33')]));_0x631d29[_0xc9b6('0x31')]=_0x631d29[_0xc9b6('0x31')][_0xc9b6('0x45')]?_0x631d29[_0xc9b6('0x31')]:_0x68a2f3[_0xc9b6('0x32')];if(_0x51e18b[_0xc9b6('0x2d')][_0xc9b6('0x3f')]){_0x631d29[_0xc9b6('0x40')]=[{'all':!![]}];}_0x631d29=_['merge']({},_0x631d29,_0x51e18b[_0xc9b6('0x46')]);return db[_0xc9b6('0x3d')][_0xc9b6('0x47')](_0x631d29)[_0xc9b6('0x25')](handleEntityNotFound(_0x25bfbb,null))[_0xc9b6('0x25')](respondWithResult(_0x25bfbb,null))[_0xc9b6('0x42')](handleError(_0x25bfbb,null));};exports['create']=function(_0x212d07,_0x19c370){return db[_0xc9b6('0x3d')][_0xc9b6('0x48')](_0x212d07[_0xc9b6('0x49')],{})[_0xc9b6('0x25')](respondWithResult(_0x19c370,0xc9))['catch'](handleError(_0x19c370,null));};exports['update']=function(_0x930cb,_0x2fe771){if(_0x930cb[_0xc9b6('0x49')]['id']){delete _0x930cb[_0xc9b6('0x49')]['id'];}return db[_0xc9b6('0x3d')]['find']({'where':{'id':_0x930cb[_0xc9b6('0x44')]['id']}})[_0xc9b6('0x25')](handleEntityNotFound(_0x2fe771,null))[_0xc9b6('0x25')](saveUpdates(_0x930cb[_0xc9b6('0x49')],null))[_0xc9b6('0x25')](respondWithResult(_0x2fe771,null))['catch'](handleError(_0x2fe771,null));};exports[_0xc9b6('0x4a')]=function(_0x47ecba,_0x461599){return db[_0xc9b6('0x3d')][_0xc9b6('0x47')]({'where':{'id':_0x47ecba[_0xc9b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x461599,null))[_0xc9b6('0x25')](removeEntity(_0x461599,null))[_0xc9b6('0x42')](handleError(_0x461599,null));};exports[_0xc9b6('0x4b')]=function(_0x1a35ed,_0x5336cd){return db[_0xc9b6('0x3d')][_0xc9b6('0x4b')]()['then'](respondWithResult(_0x5336cd,null))[_0xc9b6('0x42')](handleError(_0x5336cd,null));}; \ No newline at end of file +var _0x9131=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','end','name','index','map','MailSubstatus','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x9131,0xc7));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1913('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1913('0x1'));var rp=require(_0x1913('0x2'));var moment=require(_0x1913('0x3'));var BPromise=require(_0x1913('0x4'));var Mustache=require(_0x1913('0x5'));var util=require(_0x1913('0x6'));var path=require(_0x1913('0x7'));var sox=require(_0x1913('0x8'));var csv=require(_0x1913('0x9'));var ejs=require(_0x1913('0xa'));var fs=require('fs');var fs_extra=require(_0x1913('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1913('0xc'));var jsforce=require(_0x1913('0xd'));var deskjs=require(_0x1913('0xe'));var toCsv=require(_0x1913('0x9'));var querystring=require(_0x1913('0xf'));var Papa=require(_0x1913('0x10'));var Redis=require('ioredis');var authService=require(_0x1913('0x11'));var qs=require(_0x1913('0x12'));var as=require(_0x1913('0x13'));var hardwareService=require(_0x1913('0x14'));var logger=require(_0x1913('0x15'))(_0x1913('0x16'));var utils=require(_0x1913('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1913('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x383853,_0x4e59a6){_0x4e59a6=_0x4e59a6||0xcc;return function(_0x206060){if(_0x206060){return _0x383853[_0x1913('0x19')](_0x4e59a6);}return _0x383853['status'](_0x4e59a6)['end']();};}function respondWithResult(_0x33d177,_0x1befcc){_0x1befcc=_0x1befcc||0xc8;return function(_0x391c19){if(_0x391c19){return _0x33d177[_0x1913('0x1a')](_0x1befcc)['json'](_0x391c19);}};}function respondWithFilteredResult(_0xc0a353,_0x4ee9f5){return function(_0x267ef9){if(_0x267ef9){var _0x4801a3=typeof _0x4ee9f5['offset']===_0x1913('0x1b')&&typeof _0x4ee9f5[_0x1913('0x1c')]==='undefined';var _0x5bbffd=_0x267ef9[_0x1913('0x1d')];var _0x2ade63=_0x4801a3?0x0:_0x4ee9f5[_0x1913('0x1e')];var _0x2ce8c1=_0x4801a3?_0x267ef9['count']:_0x4ee9f5[_0x1913('0x1e')]+_0x4ee9f5[_0x1913('0x1c')];var _0x112523;if(_0x2ce8c1>=_0x5bbffd){_0x2ce8c1=_0x5bbffd;_0x112523=0xc8;}else{_0x112523=0xce;}_0xc0a353[_0x1913('0x1a')](_0x112523);return _0xc0a353['set'](_0x1913('0x1f'),_0x2ade63+'-'+_0x2ce8c1+'/'+_0x5bbffd)[_0x1913('0x20')](_0x267ef9);}return null;};}function patchUpdates(_0x2bc8cb){return function(_0x2fb0ec){try{jsonpatch['apply'](_0x2fb0ec,_0x2bc8cb,!![]);}catch(_0x5eea10){return BPromise[_0x1913('0x21')](_0x5eea10);}return _0x2fb0ec[_0x1913('0x22')]();};}function saveUpdates(_0x2ffcb3,_0x2bbd7c){return function(_0x479eb6){if(_0x479eb6){return _0x479eb6[_0x1913('0x23')](_0x2ffcb3)[_0x1913('0x24')](function(_0x258927){return _0x258927;});}return null;};}function removeEntity(_0x33a410,_0x57f81b){return function(_0x17c820){if(_0x17c820){return _0x17c820[_0x1913('0x25')]()[_0x1913('0x24')](function(){_0x33a410[_0x1913('0x1a')](0xcc)[_0x1913('0x26')]();});}};}function handleEntityNotFound(_0x58ce40,_0x1e2e48){return function(_0x3e2a53){if(!_0x3e2a53){_0x58ce40[_0x1913('0x19')](0x194);}return _0x3e2a53;};}function handleError(_0x32cae6,_0x5d769c){_0x5d769c=_0x5d769c||0x1f4;return function(_0x5b10f9){logger['error'](_0x5b10f9['stack']);if(_0x5b10f9[_0x1913('0x27')]){delete _0x5b10f9['name'];}_0x32cae6[_0x1913('0x1a')](_0x5d769c)['send'](_0x5b10f9);};}exports[_0x1913('0x28')]=function(_0x75356e,_0x56c389){var _0x3bd697={},_0xfe9f8d={},_0x53330a={'count':0x0,'rows':[]};var _0x54589d=_[_0x1913('0x29')](db[_0x1913('0x2a')][_0x1913('0x2b')],function(_0x4a8c6b){return{'name':_0x4a8c6b['fieldName'],'type':_0x4a8c6b['type'][_0x1913('0x2c')]};});_0xfe9f8d[_0x1913('0x2d')]=_['map'](_0x54589d,'name');_0xfe9f8d['query']=_[_0x1913('0x2e')](_0x75356e[_0x1913('0x2f')]);_0xfe9f8d[_0x1913('0x30')]=_[_0x1913('0x31')](_0xfe9f8d[_0x1913('0x2d')],_0xfe9f8d[_0x1913('0x2f')]);_0x3bd697[_0x1913('0x32')]=_['intersection'](_0xfe9f8d[_0x1913('0x2d')],qs[_0x1913('0x33')](_0x75356e[_0x1913('0x2f')][_0x1913('0x33')]));_0x3bd697[_0x1913('0x32')]=_0x3bd697['attributes'][_0x1913('0x34')]?_0x3bd697['attributes']:_0xfe9f8d[_0x1913('0x2d')];if(!_0x75356e[_0x1913('0x2f')][_0x1913('0x35')]('nolimit')){_0x3bd697[_0x1913('0x1c')]=qs[_0x1913('0x1c')](_0x75356e[_0x1913('0x2f')][_0x1913('0x1c')]);_0x3bd697[_0x1913('0x1e')]=qs[_0x1913('0x1e')](_0x75356e[_0x1913('0x2f')][_0x1913('0x1e')]);}_0x3bd697[_0x1913('0x36')]=qs[_0x1913('0x37')](_0x75356e[_0x1913('0x2f')][_0x1913('0x37')]);_0x3bd697[_0x1913('0x38')]=qs[_0x1913('0x30')](_[_0x1913('0x39')](_0x75356e[_0x1913('0x2f')],_0xfe9f8d[_0x1913('0x30')]),_0x54589d);if(_0x75356e[_0x1913('0x2f')][_0x1913('0x3a')]){_0x3bd697[_0x1913('0x38')]=_[_0x1913('0x3b')](_0x3bd697[_0x1913('0x38')],{'$or':_[_0x1913('0x29')](_0x54589d,function(_0x4d9181){if(_0x4d9181[_0x1913('0x3c')]!==_0x1913('0x3d')){var _0x46c1a0={};_0x46c1a0[_0x4d9181[_0x1913('0x27')]]={'$like':'%'+_0x75356e[_0x1913('0x2f')][_0x1913('0x3a')]+'%'};return _0x46c1a0;}})});}_0x3bd697=_['merge']({},_0x3bd697,_0x75356e['options']);var _0x2ac025={'where':_0x3bd697['where']};return db[_0x1913('0x2a')][_0x1913('0x1d')](_0x2ac025)['then'](function(_0x38a395){_0x53330a[_0x1913('0x1d')]=_0x38a395;if(_0x75356e[_0x1913('0x2f')][_0x1913('0x3e')]){_0x3bd697['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3bd697);})['then'](function(_0x31d3ab){_0x53330a[_0x1913('0x3f')]=_0x31d3ab;return _0x53330a;})[_0x1913('0x24')](respondWithFilteredResult(_0x56c389,_0x3bd697))[_0x1913('0x40')](handleError(_0x56c389,null));};exports['show']=function(_0x56eac0,_0x4048d2){var _0x451969={'raw':!![],'where':{'id':_0x56eac0[_0x1913('0x41')]['id']}},_0x12527b={};_0x12527b[_0x1913('0x2d')]=_[_0x1913('0x2e')](db[_0x1913('0x2a')]['rawAttributes']);_0x12527b['query']=_[_0x1913('0x2e')](_0x56eac0[_0x1913('0x2f')]);_0x12527b[_0x1913('0x30')]=_[_0x1913('0x31')](_0x12527b[_0x1913('0x2d')],_0x12527b[_0x1913('0x2f')]);_0x451969[_0x1913('0x32')]=_['intersection'](_0x12527b[_0x1913('0x2d')],qs[_0x1913('0x33')](_0x56eac0[_0x1913('0x2f')][_0x1913('0x33')]));_0x451969['attributes']=_0x451969[_0x1913('0x32')][_0x1913('0x34')]?_0x451969[_0x1913('0x32')]:_0x12527b[_0x1913('0x2d')];if(_0x56eac0[_0x1913('0x2f')][_0x1913('0x3e')]){_0x451969['include']=[{'all':!![]}];}_0x451969=_[_0x1913('0x3b')]({},_0x451969,_0x56eac0['options']);return db[_0x1913('0x2a')][_0x1913('0x42')](_0x451969)[_0x1913('0x24')](handleEntityNotFound(_0x4048d2,null))[_0x1913('0x24')](respondWithResult(_0x4048d2,null))[_0x1913('0x40')](handleError(_0x4048d2,null));};exports['create']=function(_0x3f5868,_0x4a3565){return db[_0x1913('0x2a')][_0x1913('0x43')](_0x3f5868[_0x1913('0x44')],{})[_0x1913('0x24')](respondWithResult(_0x4a3565,0xc9))[_0x1913('0x40')](handleError(_0x4a3565,null));};exports['update']=function(_0x207b6f,_0x1f919e){if(_0x207b6f[_0x1913('0x44')]['id']){delete _0x207b6f[_0x1913('0x44')]['id'];}return db[_0x1913('0x2a')]['find']({'where':{'id':_0x207b6f[_0x1913('0x41')]['id']}})[_0x1913('0x24')](handleEntityNotFound(_0x1f919e,null))[_0x1913('0x24')](saveUpdates(_0x207b6f[_0x1913('0x44')],null))[_0x1913('0x24')](respondWithResult(_0x1f919e,null))[_0x1913('0x40')](handleError(_0x1f919e,null));};exports['destroy']=function(_0x343659,_0x29cc53){return db[_0x1913('0x2a')]['find']({'where':{'id':_0x343659['params']['id']}})[_0x1913('0x24')](handleEntityNotFound(_0x29cc53,null))[_0x1913('0x24')](removeEntity(_0x29cc53,null))[_0x1913('0x40')](handleError(_0x29cc53,null));};exports[_0x1913('0x45')]=function(_0x50d1fb,_0x3e58ad){return db['MailSubstatus'][_0x1913('0x45')]()['then'](respondWithResult(_0x3e58ad,null))[_0x1913('0x40')](handleError(_0x3e58ad,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index fac368f..485245b 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 _0x2e92=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0xe945f5,_0x5872db){var _0xa9cd9f=function(_0xae8fe5){while(--_0xae8fe5){_0xe945f5['push'](_0xe945f5['shift']());}};_0xa9cd9f(++_0x5872db);}(_0x2e92,0xc2));var _0x22e9=function(_0x3e5630,_0x9cc9a2){_0x3e5630=_0x3e5630-0x0;var _0x1e1754=_0x2e92[_0x3e5630];return _0x1e1754;};'use strict';var EventEmitter=require(_0x22e9('0x0'));var MailSubstatus=require(_0x22e9('0x1'))['db'][_0x22e9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x22e9('0x3')](0x0);var events={'afterUpdate':_0x22e9('0x4')};function emitEvent(_0x5ee8b3){return function(_0x4d96be,_0x154a73,_0x4de880){MailSubstatusEvents[_0x22e9('0x5')](_0x5ee8b3+':'+_0x4d96be['id'],_0x4d96be);MailSubstatusEvents['emit'](_0x5ee8b3,_0x4d96be);_0x4de880(null);};}for(var e in events){if(events[_0x22e9('0x6')](e)){var event=events[e];MailSubstatus[_0x22e9('0x7')](e,emitEvent(event));}}module[_0x22e9('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xe2dc=['update','emit','hasOwnProperty','hook','../../mysqldb','MailSubstatus'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe2dc,0x11e));var _0xce2d=function(_0x315d90,_0xbf14e0){_0x315d90=_0x315d90-0x0;var _0x4e2bdd=_0xe2dc[_0x315d90];return _0x4e2bdd;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xce2d('0x0'))['db'][_0xce2d('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xce2d('0x2')};function emitEvent(_0x5db871){return function(_0x5d40df,_0x5c9f90,_0x390396){MailSubstatusEvents[_0xce2d('0x3')](_0x5db871+':'+_0x5d40df['id'],_0x5d40df);MailSubstatusEvents['emit'](_0x5db871,_0x5d40df);_0x390396(null);};}for(var e in events){if(events[_0xce2d('0x4')](e)){var event=events[e];MailSubstatus[_0xce2d('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 115ae1c..485f7cb 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 _0x3999=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define','Condition','name'];(function(_0x2782a9,_0x137bc3){var _0x4d7299=function(_0x56f649){while(--_0x56f649){_0x2782a9['push'](_0x2782a9['shift']());}};_0x4d7299(++_0x137bc3);}(_0x3999,0xd3));var _0x9399=function(_0x59e177,_0x188018){_0x59e177=_0x59e177-0x0;var _0x2b9d7b=_0x3999[_0x59e177];return _0x2b9d7b;};'use strict';var attributes=require(_0x9399('0x0'));module['exports']=function(_0x8b98f4){var _0x4d46fb=_0x8b98f4[_0x9399('0x1')];return _0x8b98f4[_0x9399('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x308e7a,_0x3fd11b,_0x16a472){return _0x4d46fb[_0x9399('0x3')]['update']({'value':_0x308e7a[_0x9399('0x4')]},{'where':{'field':_0x9399('0x5'),'value':_0x308e7a[_0x9399('0x6')][_0x9399('0x4')]}})[_0x9399('0x7')](function(){_0x16a472();})[_0x9399('0x8')](function(_0x16460b){_0x16a472(_0x16460b);});}}});}; \ No newline at end of file +var _0xf3aa=['_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus'];(function(_0x27c775,_0x18f9fc){var _0x4ddfc5=function(_0x1f8159){while(--_0x1f8159){_0x27c775['push'](_0x27c775['shift']());}};_0x4ddfc5(++_0x18f9fc);}(_0xf3aa,0x10a));var _0xaf3a=function(_0x50a330,_0x2e003c){_0x50a330=_0x50a330-0x0;var _0x475636=_0xf3aa[_0x50a330];return _0x475636;};'use strict';var attributes=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]=function(_0x298463){var _0x289cca=_0x298463[_0xaf3a('0x2')];return _0x298463[_0xaf3a('0x3')](_0xaf3a('0x4'),attributes,{'tableName':_0xaf3a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x43141e,_0x2c2e71,_0x24fc88){return _0x289cca[_0xaf3a('0x6')][_0xaf3a('0x7')]({'value':_0x43141e[_0xaf3a('0x8')]},{'where':{'field':_0xaf3a('0x9'),'value':_0x43141e[_0xaf3a('0xa')]['name']}})[_0xaf3a('0xb')](function(){_0x24fc88();})['catch'](function(_0x36c03d){_0x24fc88(_0x36c03d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 6a70082..c987336 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 _0x0c8f=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0c8f,0xa2));var _0xf0c8=function(_0x347b29,_0x69cb09){_0x347b29=_0x347b29-0x0;var _0x49c0a6=_0x0c8f[_0x347b29];return _0x49c0a6;};'use strict';var _=require(_0xf0c8('0x0'));var util=require(_0xf0c8('0x1'));var moment=require(_0xf0c8('0x2'));var BPromise=require(_0xf0c8('0x3'));var rs=require(_0xf0c8('0x4'));var fs=require('fs');var Redis=require(_0xf0c8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0c8('0x6'))(_0xf0c8('0x7'));var config=require('../../config/environment');var jayson=require(_0xf0c8('0x8'));var client=jayson[_0xf0c8('0x9')][_0xf0c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b497,_0x527ca7,_0x489f29){return new BPromise(function(_0x409e37,_0x38b240){return client[_0xf0c8('0xb')](_0x11b497,_0x489f29)[_0xf0c8('0xc')](function(_0x3d8cb0){logger[_0xf0c8('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x527ca7,_0xf0c8('0xe'));logger['debug'](_0xf0c8('0xf'),_0x527ca7,_0xf0c8('0xe'),JSON[_0xf0c8('0x10')](_0x3d8cb0));if(_0x3d8cb0[_0xf0c8('0x11')]){if(_0x3d8cb0[_0xf0c8('0x11')][_0xf0c8('0x12')]===0x1f4){logger[_0xf0c8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x527ca7,_0x3d8cb0['error'][_0xf0c8('0x13')]);return _0x38b240(_0x3d8cb0[_0xf0c8('0x11')][_0xf0c8('0x13')]);}logger[_0xf0c8('0x11')](_0xf0c8('0x14'),_0x527ca7,_0x3d8cb0['error']['message']);return _0x409e37(_0x3d8cb0[_0xf0c8('0x11')][_0xf0c8('0x13')]);}else{logger[_0xf0c8('0xd')](_0xf0c8('0x14'),_0x527ca7,_0xf0c8('0xe'));_0x409e37(_0x3d8cb0[_0xf0c8('0x15')][_0xf0c8('0x13')]);}})['catch'](function(_0x2128a7){logger[_0xf0c8('0x11')](_0xf0c8('0x14'),_0x527ca7,_0x2128a7);_0x38b240(_0x2128a7);});});} \ No newline at end of file +var _0x2f7e=['../../config/environment','jayson/promise','client','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x22e34e,_0x598a1d){var _0x411e59=function(_0x63f722){while(--_0x63f722){_0x22e34e['push'](_0x22e34e['shift']());}};_0x411e59(++_0x598a1d);}(_0x2f7e,0x122));var _0xe2f7=function(_0x4d22f3,_0x4fdcae){_0x4d22f3=_0x4d22f3-0x0;var _0x14e14b=_0x2f7e[_0x4d22f3];return _0x14e14b;};'use strict';var _=require(_0xe2f7('0x0'));var util=require(_0xe2f7('0x1'));var moment=require('moment');var BPromise=require(_0xe2f7('0x2'));var rs=require(_0xe2f7('0x3'));var fs=require('fs');var Redis=require(_0xe2f7('0x4'));var db=require(_0xe2f7('0x5'))['db'];var utils=require(_0xe2f7('0x6'));var logger=require(_0xe2f7('0x7'))(_0xe2f7('0x8'));var config=require(_0xe2f7('0x9'));var jayson=require(_0xe2f7('0xa'));var client=jayson[_0xe2f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x396b4d,_0x210389,_0x3ca8d8){return new BPromise(function(_0xd55dc8,_0x2e564f){return client[_0xe2f7('0xc')](_0x396b4d,_0x3ca8d8)['then'](function(_0x564605){logger[_0xe2f7('0xd')](_0xe2f7('0xe'),_0x210389,'request\x20sent');logger[_0xe2f7('0xf')](_0xe2f7('0x10'),_0x210389,_0xe2f7('0x11'),JSON[_0xe2f7('0x12')](_0x564605));if(_0x564605[_0xe2f7('0x13')]){if(_0x564605['error']['code']===0x1f4){logger[_0xe2f7('0x13')](_0xe2f7('0xe'),_0x210389,_0x564605['error'][_0xe2f7('0x14')]);return _0x2e564f(_0x564605[_0xe2f7('0x13')][_0xe2f7('0x14')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x210389,_0x564605[_0xe2f7('0x13')][_0xe2f7('0x14')]);return _0xd55dc8(_0x564605[_0xe2f7('0x13')][_0xe2f7('0x14')]);}else{logger[_0xe2f7('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x210389,_0xe2f7('0x11'));_0xd55dc8(_0x564605[_0xe2f7('0x15')][_0xe2f7('0x14')]);}})[_0xe2f7('0x16')](function(_0x28f85){logger[_0xe2f7('0x13')](_0xe2f7('0xe'),_0x210389,_0x28f85);_0x2e564f(_0x28f85);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 583c884..5800d8e 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 _0xba56=['/:id','post','create','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xba56,0x112));var _0x6ba5=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xba56[_0x414f67];return _0x338537;};'use strict';var multer=require(_0x6ba5('0x0'));var util=require('util');var path=require(_0x6ba5('0x1'));var timeout=require(_0x6ba5('0x2'));var express=require(_0x6ba5('0x3'));var router=express[_0x6ba5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ba5('0x5'));var interaction=require(_0x6ba5('0x6'));var config=require(_0x6ba5('0x7'));var controller=require(_0x6ba5('0x8'));router[_0x6ba5('0x9')]('/',auth['isAuthenticated'](),controller[_0x6ba5('0xa')]);router[_0x6ba5('0x9')](_0x6ba5('0xb'),auth[_0x6ba5('0xc')](),controller[_0x6ba5('0xd')]);router['get'](_0x6ba5('0xe'),auth[_0x6ba5('0xc')](),controller['show']);router[_0x6ba5('0xf')]('/',auth[_0x6ba5('0xc')](),controller[_0x6ba5('0x10')]);router['put'](_0x6ba5('0xe'),auth[_0x6ba5('0xc')](),controller['update']);router['delete'](_0x6ba5('0xe'),auth[_0x6ba5('0xc')](),controller[_0x6ba5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x241b=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x44328b,_0x3fe093){var _0x50c6a5=function(_0xccf03d){while(--_0xccf03d){_0x44328b['push'](_0x44328b['shift']());}};_0x50c6a5(++_0x3fe093);}(_0x241b,0x176));var _0xb241=function(_0x129c87,_0x2c3615){_0x129c87=_0x129c87-0x0;var _0x2c068e=_0x241b[_0x129c87];return _0x2c068e;};'use strict';var multer=require(_0xb241('0x0'));var util=require(_0xb241('0x1'));var path=require('path');var timeout=require(_0xb241('0x2'));var express=require(_0xb241('0x3'));var router=express['Router']();var fs_extra=require(_0xb241('0x4'));var auth=require(_0xb241('0x5'));var interaction=require(_0xb241('0x6'));var config=require(_0xb241('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xb241('0x8')](),controller[_0xb241('0x9')]);router['get'](_0xb241('0xa'),auth[_0xb241('0x8')](),controller[_0xb241('0xb')]);router[_0xb241('0xc')](_0xb241('0xd'),auth[_0xb241('0x8')](),controller[_0xb241('0xe')]);router[_0xb241('0xf')]('/',auth[_0xb241('0x8')](),controller[_0xb241('0x10')]);router['put']('/:id',auth[_0xb241('0x8')](),controller['update']);router[_0xb241('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb241('0x12')]);module[_0xb241('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7f752ca..9c69a5f 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x45f42e,_0x417bb){var _0x5704b6=function(_0x4d1621){while(--_0x4d1621){_0x45f42e['push'](_0x45f42e['shift']());}};_0x5704b6(++_0x417bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x25ada9,_0x5f0e07){var _0x59e1ab=function(_0x241d91){while(--_0x241d91){_0x25ada9['push'](_0x25ada9['shift']());}};_0x59e1ab(++_0x5f0e07);}(_0x34e8,0x12c));var _0x834e=function(_0x1f192c,_0x1d5154){_0x1f192c=_0x1f192c-0x0;var _0x310479=_0x34e8[_0x1f192c];return _0x310479;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 74c5c12..bc1c84a 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 _0xfa8a=['find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','limit','count','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x1a45e3,_0x385589){var _0x3615f8=function(_0x40ce0a){while(--_0x40ce0a){_0x1a45e3['push'](_0x1a45e3['shift']());}};_0x3615f8(++_0x385589);}(_0xfa8a,0x8f));var _0xafa8=function(_0x33481a,_0x5d4316){_0x33481a=_0x33481a-0x0;var _0x408ab9=_0xfa8a[_0x33481a];return _0x408ab9;};'use strict';var emlformat=require(_0xafa8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafa8('0x1'));var jsonpatch=require(_0xafa8('0x2'));var rp=require('request-promise');var moment=require(_0xafa8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xafa8('0x4'));var util=require(_0xafa8('0x5'));var path=require(_0xafa8('0x6'));var sox=require(_0xafa8('0x7'));var csv=require(_0xafa8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafa8('0x9'));var _=require('lodash');var squel=require(_0xafa8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xafa8('0xb'));var toCsv=require(_0xafa8('0x8'));var querystring=require(_0xafa8('0xc'));var Papa=require('papaparse');var Redis=require(_0xafa8('0xd'));var authService=require(_0xafa8('0xe'));var qs=require(_0xafa8('0xf'));var as=require(_0xafa8('0x10'));var hardwareService=require(_0xafa8('0x11'));var logger=require('../../config/logger')(_0xafa8('0x12'));var utils=require(_0xafa8('0x13'));var config=require(_0xafa8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33391c,_0x988db8){_0x988db8=_0x988db8||0xcc;return function(_0x4e33a6){if(_0x4e33a6){return _0x33391c['sendStatus'](_0x988db8);}return _0x33391c[_0xafa8('0x15')](_0x988db8)[_0xafa8('0x16')]();};}function respondWithResult(_0x3a5b46,_0x2fc2e7){_0x2fc2e7=_0x2fc2e7||0xc8;return function(_0xf2caed){if(_0xf2caed){return _0x3a5b46[_0xafa8('0x15')](_0x2fc2e7)[_0xafa8('0x17')](_0xf2caed);}};}function respondWithFilteredResult(_0x3c622b,_0x3649df){return function(_0x42b257){if(_0x42b257){var _0x3c86bc=typeof _0x3649df[_0xafa8('0x18')]==='undefined'&&typeof _0x3649df[_0xafa8('0x19')]==='undefined';var _0xfd9796=_0x42b257['count'];var _0xae4fb0=_0x3c86bc?0x0:_0x3649df[_0xafa8('0x18')];var _0x549083=_0x3c86bc?_0x42b257[_0xafa8('0x1a')]:_0x3649df['offset']+_0x3649df[_0xafa8('0x19')];var _0x3a02cc;if(_0x549083>=_0xfd9796){_0x549083=_0xfd9796;_0x3a02cc=0xc8;}else{_0x3a02cc=0xce;}_0x3c622b[_0xafa8('0x15')](_0x3a02cc);return _0x3c622b['set']('Content-Range',_0xae4fb0+'-'+_0x549083+'/'+_0xfd9796)['json'](_0x42b257);}return null;};}function patchUpdates(_0x233cb7){return function(_0x3360ed){try{jsonpatch['apply'](_0x3360ed,_0x233cb7,!![]);}catch(_0x3b8d8c){return BPromise[_0xafa8('0x1b')](_0x3b8d8c);}return _0x3360ed[_0xafa8('0x1c')]();};}function saveUpdates(_0x476985,_0x58b0cf){return function(_0x1607a8){if(_0x1607a8){return _0x1607a8[_0xafa8('0x1d')](_0x476985)[_0xafa8('0x1e')](function(_0x4e5b7b){return _0x4e5b7b;});}return null;};}function removeEntity(_0x3c2d16,_0x4e9d79){return function(_0x538bd7){if(_0x538bd7){return _0x538bd7[_0xafa8('0x1f')]()[_0xafa8('0x1e')](function(){_0x3c2d16[_0xafa8('0x15')](0xcc)[_0xafa8('0x16')]();});}};}function handleEntityNotFound(_0x228c43,_0x3fccb9){return function(_0x20aebb){if(!_0x20aebb){_0x228c43[_0xafa8('0x20')](0x194);}return _0x20aebb;};}function handleError(_0x3bc15e,_0x2fff9b){_0x2fff9b=_0x2fff9b||0x1f4;return function(_0x2baf0f){logger[_0xafa8('0x21')](_0x2baf0f[_0xafa8('0x22')]);if(_0x2baf0f['name']){delete _0x2baf0f[_0xafa8('0x23')];}_0x3bc15e[_0xafa8('0x15')](_0x2fff9b)[_0xafa8('0x24')](_0x2baf0f);};}exports[_0xafa8('0x25')]=function(_0x450b75,_0x2f0db7){var _0x187b63={},_0x542789={},_0xddcd71={'count':0x0,'rows':[]};var _0x21fd76=_[_0xafa8('0x26')](db[_0xafa8('0x27')][_0xafa8('0x28')],function(_0x199d8e){return{'name':_0x199d8e['fieldName'],'type':_0x199d8e[_0xafa8('0x29')][_0xafa8('0x2a')]};});_0x542789['model']=_[_0xafa8('0x26')](_0x21fd76,_0xafa8('0x23'));_0x542789[_0xafa8('0x2b')]=_[_0xafa8('0x2c')](_0x450b75[_0xafa8('0x2b')]);_0x542789[_0xafa8('0x2d')]=_[_0xafa8('0x2e')](_0x542789['model'],_0x542789[_0xafa8('0x2b')]);_0x187b63[_0xafa8('0x2f')]=_['intersection'](_0x542789[_0xafa8('0x30')],qs['fields'](_0x450b75[_0xafa8('0x2b')][_0xafa8('0x31')]));_0x187b63[_0xafa8('0x2f')]=_0x187b63['attributes']['length']?_0x187b63[_0xafa8('0x2f')]:_0x542789[_0xafa8('0x30')];if(!_0x450b75[_0xafa8('0x2b')]['hasOwnProperty'](_0xafa8('0x32'))){_0x187b63[_0xafa8('0x19')]=qs[_0xafa8('0x19')](_0x450b75[_0xafa8('0x2b')][_0xafa8('0x19')]);_0x187b63['offset']=qs[_0xafa8('0x18')](_0x450b75[_0xafa8('0x2b')][_0xafa8('0x18')]);}_0x187b63['order']=qs[_0xafa8('0x33')](_0x450b75[_0xafa8('0x2b')][_0xafa8('0x33')]);_0x187b63[_0xafa8('0x34')]=qs['filters'](_['pick'](_0x450b75[_0xafa8('0x2b')],_0x542789[_0xafa8('0x2d')]),_0x21fd76);if(_0x450b75[_0xafa8('0x2b')][_0xafa8('0x35')]){_0x187b63[_0xafa8('0x34')]=_[_0xafa8('0x36')](_0x187b63['where'],{'$or':_[_0xafa8('0x26')](_0x21fd76,function(_0x30fbae){if(_0x30fbae[_0xafa8('0x29')]!==_0xafa8('0x37')){var _0x3a620f={};_0x3a620f[_0x30fbae[_0xafa8('0x23')]]={'$like':'%'+_0x450b75[_0xafa8('0x2b')][_0xafa8('0x35')]+'%'};return _0x3a620f;}})});}_0x187b63=_[_0xafa8('0x36')]({},_0x187b63,_0x450b75[_0xafa8('0x38')]);var _0x359087={'where':_0x187b63[_0xafa8('0x34')]};return db[_0xafa8('0x27')][_0xafa8('0x1a')](_0x359087)[_0xafa8('0x1e')](function(_0x56a904){_0xddcd71[_0xafa8('0x1a')]=_0x56a904;if(_0x450b75[_0xafa8('0x2b')][_0xafa8('0x39')]){_0x187b63[_0xafa8('0x3a')]=[{'all':!![]}];}return db['MailTransferReport'][_0xafa8('0x3b')](_0x187b63);})[_0xafa8('0x1e')](function(_0x2a4851){_0xddcd71[_0xafa8('0x3c')]=_0x2a4851;return _0xddcd71;})['then'](respondWithFilteredResult(_0x2f0db7,_0x187b63))['catch'](handleError(_0x2f0db7,null));};exports[_0xafa8('0x3d')]=function(_0x3c7ffd,_0x207aa9){var _0x2e3408={'raw':!![],'where':{'id':_0x3c7ffd[_0xafa8('0x3e')]['id']}},_0x41d2b4={};_0x41d2b4[_0xafa8('0x30')]=_[_0xafa8('0x2c')](db[_0xafa8('0x27')][_0xafa8('0x28')]);_0x41d2b4['query']=_[_0xafa8('0x2c')](_0x3c7ffd[_0xafa8('0x2b')]);_0x41d2b4[_0xafa8('0x2d')]=_[_0xafa8('0x2e')](_0x41d2b4['model'],_0x41d2b4['query']);_0x2e3408['attributes']=_[_0xafa8('0x2e')](_0x41d2b4[_0xafa8('0x30')],qs[_0xafa8('0x31')](_0x3c7ffd[_0xafa8('0x2b')][_0xafa8('0x31')]));_0x2e3408[_0xafa8('0x2f')]=_0x2e3408[_0xafa8('0x2f')][_0xafa8('0x3f')]?_0x2e3408[_0xafa8('0x2f')]:_0x41d2b4[_0xafa8('0x30')];if(_0x3c7ffd[_0xafa8('0x2b')][_0xafa8('0x39')]){_0x2e3408['include']=[{'all':!![]}];}_0x2e3408=_[_0xafa8('0x36')]({},_0x2e3408,_0x3c7ffd[_0xafa8('0x38')]);return db[_0xafa8('0x27')][_0xafa8('0x40')](_0x2e3408)[_0xafa8('0x1e')](handleEntityNotFound(_0x207aa9,null))[_0xafa8('0x1e')](respondWithResult(_0x207aa9,null))[_0xafa8('0x41')](handleError(_0x207aa9,null));};exports['create']=function(_0x14c2f0,_0x4570a6){return db[_0xafa8('0x27')][_0xafa8('0x42')](_0x14c2f0[_0xafa8('0x43')],{})['then'](respondWithResult(_0x4570a6,0xc9))[_0xafa8('0x41')](handleError(_0x4570a6,null));};exports['update']=function(_0x295b32,_0x364fb7){if(_0x295b32[_0xafa8('0x43')]['id']){delete _0x295b32[_0xafa8('0x43')]['id'];}return db[_0xafa8('0x27')][_0xafa8('0x40')]({'where':{'id':_0x295b32['params']['id']}})['then'](handleEntityNotFound(_0x364fb7,null))['then'](saveUpdates(_0x295b32[_0xafa8('0x43')],null))[_0xafa8('0x1e')](respondWithResult(_0x364fb7,null))['catch'](handleError(_0x364fb7,null));};exports[_0xafa8('0x1f')]=function(_0x294b5f,_0xbf1681){return db['MailTransferReport'][_0xafa8('0x40')]({'where':{'id':_0x294b5f['params']['id']}})['then'](handleEntityNotFound(_0xbf1681,null))[_0xafa8('0x1e')](removeEntity(_0xbf1681,null))[_0xafa8('0x41')](handleError(_0xbf1681,null));};exports[_0xafa8('0x44')]=function(_0x1d2f2f,_0x246bf2){return db['MailTransferReport']['describe']()[_0xafa8('0x1e')](respondWithResult(_0x246bf2,null))['catch'](handleError(_0x246bf2,null));}; \ No newline at end of file +var _0x1bdf=['Content-Range','reject','save','update','then','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2078c9,_0x505a19){var _0x3deb3e=function(_0x464bc6){while(--_0x464bc6){_0x2078c9['push'](_0x2078c9['shift']());}};_0x3deb3e(++_0x505a19);}(_0x1bdf,0x107));var _0xf1bd=function(_0x5acc08,_0x34908c){_0x5acc08=_0x5acc08-0x0;var _0x253794=_0x1bdf[_0x5acc08];return _0x253794;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1bd('0x0'));var zipdir=require(_0xf1bd('0x1'));var jsonpatch=require(_0xf1bd('0x2'));var rp=require(_0xf1bd('0x3'));var moment=require(_0xf1bd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf1bd('0x5'));var util=require(_0xf1bd('0x6'));var path=require(_0xf1bd('0x7'));var sox=require(_0xf1bd('0x8'));var csv=require(_0xf1bd('0x9'));var ejs=require(_0xf1bd('0xa'));var fs=require('fs');var fs_extra=require(_0xf1bd('0xb'));var _=require('lodash');var squel=require(_0xf1bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xf1bd('0xd'));var deskjs=require(_0xf1bd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf1bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf1bd('0x10'));var hardwareService=require(_0xf1bd('0x11'));var logger=require(_0xf1bd('0x12'))(_0xf1bd('0x13'));var utils=require(_0xf1bd('0x14'));var config=require(_0xf1bd('0x15'));var licenseUtil=require(_0xf1bd('0x16'));var db=require(_0xf1bd('0x17'))['db'];function respondWithStatusCode(_0x44cc5d,_0x49df8c){_0x49df8c=_0x49df8c||0xcc;return function(_0x5ef71a){if(_0x5ef71a){return _0x44cc5d[_0xf1bd('0x18')](_0x49df8c);}return _0x44cc5d[_0xf1bd('0x19')](_0x49df8c)[_0xf1bd('0x1a')]();};}function respondWithResult(_0x49f715,_0x111cda){_0x111cda=_0x111cda||0xc8;return function(_0x16262f){if(_0x16262f){return _0x49f715['status'](_0x111cda)[_0xf1bd('0x1b')](_0x16262f);}};}function respondWithFilteredResult(_0x24b785,_0x462bcf){return function(_0x1c5e3e){if(_0x1c5e3e){var _0x2ccb0a=typeof _0x462bcf[_0xf1bd('0x1c')]===_0xf1bd('0x1d')&&typeof _0x462bcf[_0xf1bd('0x1e')]===_0xf1bd('0x1d');var _0x6bbd18=_0x1c5e3e[_0xf1bd('0x1f')];var _0x369bc3=_0x2ccb0a?0x0:_0x462bcf[_0xf1bd('0x1c')];var _0x216022=_0x2ccb0a?_0x1c5e3e['count']:_0x462bcf['offset']+_0x462bcf[_0xf1bd('0x1e')];var _0x1499b5;if(_0x216022>=_0x6bbd18){_0x216022=_0x6bbd18;_0x1499b5=0xc8;}else{_0x1499b5=0xce;}_0x24b785[_0xf1bd('0x19')](_0x1499b5);return _0x24b785[_0xf1bd('0x20')](_0xf1bd('0x21'),_0x369bc3+'-'+_0x216022+'/'+_0x6bbd18)[_0xf1bd('0x1b')](_0x1c5e3e);}return null;};}function patchUpdates(_0x3b7d32){return function(_0x424616){try{jsonpatch['apply'](_0x424616,_0x3b7d32,!![]);}catch(_0x2b2698){return BPromise[_0xf1bd('0x22')](_0x2b2698);}return _0x424616[_0xf1bd('0x23')]();};}function saveUpdates(_0x4de8a8,_0x50977b){return function(_0x13f26e){if(_0x13f26e){return _0x13f26e[_0xf1bd('0x24')](_0x4de8a8)[_0xf1bd('0x25')](function(_0x5649ef){return _0x5649ef;});}return null;};}function removeEntity(_0x2b95c6,_0x2d1fa2){return function(_0x57e8af){if(_0x57e8af){return _0x57e8af['destroy']()['then'](function(){_0x2b95c6['status'](0xcc)[_0xf1bd('0x1a')]();});}};}function handleEntityNotFound(_0x2f72be,_0x5d54dd){return function(_0x4cebc1){if(!_0x4cebc1){_0x2f72be[_0xf1bd('0x18')](0x194);}return _0x4cebc1;};}function handleError(_0x14f624,_0x5034f5){_0x5034f5=_0x5034f5||0x1f4;return function(_0x52d672){logger['error'](_0x52d672[_0xf1bd('0x26')]);if(_0x52d672['name']){delete _0x52d672[_0xf1bd('0x27')];}_0x14f624['status'](_0x5034f5)['send'](_0x52d672);};}exports[_0xf1bd('0x28')]=function(_0x1f8636,_0x5ba1de){var _0x7e60bd={},_0x6d966c={},_0x1ccc10={'count':0x0,'rows':[]};var _0x2cbad5=_[_0xf1bd('0x29')](db[_0xf1bd('0x2a')][_0xf1bd('0x2b')],function(_0x15ac19){return{'name':_0x15ac19[_0xf1bd('0x2c')],'type':_0x15ac19[_0xf1bd('0x2d')][_0xf1bd('0x2e')]};});_0x6d966c['model']=_[_0xf1bd('0x29')](_0x2cbad5,_0xf1bd('0x27'));_0x6d966c[_0xf1bd('0x2f')]=_[_0xf1bd('0x30')](_0x1f8636[_0xf1bd('0x2f')]);_0x6d966c[_0xf1bd('0x31')]=_['intersection'](_0x6d966c[_0xf1bd('0x32')],_0x6d966c[_0xf1bd('0x2f')]);_0x7e60bd['attributes']=_[_0xf1bd('0x33')](_0x6d966c[_0xf1bd('0x32')],qs[_0xf1bd('0x34')](_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x34')]));_0x7e60bd['attributes']=_0x7e60bd[_0xf1bd('0x35')]['length']?_0x7e60bd[_0xf1bd('0x35')]:_0x6d966c[_0xf1bd('0x32')];if(!_0x1f8636['query'][_0xf1bd('0x36')]('nolimit')){_0x7e60bd[_0xf1bd('0x1e')]=qs['limit'](_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x1e')]);_0x7e60bd[_0xf1bd('0x1c')]=qs[_0xf1bd('0x1c')](_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x1c')]);}_0x7e60bd[_0xf1bd('0x37')]=qs[_0xf1bd('0x38')](_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x38')]);_0x7e60bd['where']=qs[_0xf1bd('0x31')](_['pick'](_0x1f8636[_0xf1bd('0x2f')],_0x6d966c[_0xf1bd('0x31')]),_0x2cbad5);if(_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x39')]){_0x7e60bd[_0xf1bd('0x3a')]=_[_0xf1bd('0x3b')](_0x7e60bd[_0xf1bd('0x3a')],{'$or':_['map'](_0x2cbad5,function(_0x1cfcef){if(_0x1cfcef[_0xf1bd('0x2d')]!==_0xf1bd('0x3c')){var _0x14b005={};_0x14b005[_0x1cfcef[_0xf1bd('0x27')]]={'$like':'%'+_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x39')]+'%'};return _0x14b005;}})});}_0x7e60bd=_[_0xf1bd('0x3b')]({},_0x7e60bd,_0x1f8636[_0xf1bd('0x3d')]);var _0x49efe5={'where':_0x7e60bd['where']};return db['MailTransferReport'][_0xf1bd('0x1f')](_0x49efe5)[_0xf1bd('0x25')](function(_0x165ada){_0x1ccc10[_0xf1bd('0x1f')]=_0x165ada;if(_0x1f8636[_0xf1bd('0x2f')][_0xf1bd('0x3e')]){_0x7e60bd[_0xf1bd('0x3f')]=[{'all':!![]}];}return db[_0xf1bd('0x2a')][_0xf1bd('0x40')](_0x7e60bd);})[_0xf1bd('0x25')](function(_0x23bf1c){_0x1ccc10[_0xf1bd('0x41')]=_0x23bf1c;return _0x1ccc10;})['then'](respondWithFilteredResult(_0x5ba1de,_0x7e60bd))[_0xf1bd('0x42')](handleError(_0x5ba1de,null));};exports[_0xf1bd('0x43')]=function(_0x2b9dcc,_0x174b4a){var _0x9387a2={'raw':!![],'where':{'id':_0x2b9dcc[_0xf1bd('0x44')]['id']}},_0x4cb350={};_0x4cb350[_0xf1bd('0x32')]=_[_0xf1bd('0x30')](db['MailTransferReport']['rawAttributes']);_0x4cb350[_0xf1bd('0x2f')]=_[_0xf1bd('0x30')](_0x2b9dcc[_0xf1bd('0x2f')]);_0x4cb350[_0xf1bd('0x31')]=_[_0xf1bd('0x33')](_0x4cb350[_0xf1bd('0x32')],_0x4cb350['query']);_0x9387a2[_0xf1bd('0x35')]=_[_0xf1bd('0x33')](_0x4cb350[_0xf1bd('0x32')],qs['fields'](_0x2b9dcc[_0xf1bd('0x2f')][_0xf1bd('0x34')]));_0x9387a2['attributes']=_0x9387a2[_0xf1bd('0x35')][_0xf1bd('0x45')]?_0x9387a2[_0xf1bd('0x35')]:_0x4cb350[_0xf1bd('0x32')];if(_0x2b9dcc[_0xf1bd('0x2f')]['includeAll']){_0x9387a2[_0xf1bd('0x3f')]=[{'all':!![]}];}_0x9387a2=_[_0xf1bd('0x3b')]({},_0x9387a2,_0x2b9dcc[_0xf1bd('0x3d')]);return db['MailTransferReport']['find'](_0x9387a2)[_0xf1bd('0x25')](handleEntityNotFound(_0x174b4a,null))[_0xf1bd('0x25')](respondWithResult(_0x174b4a,null))['catch'](handleError(_0x174b4a,null));};exports[_0xf1bd('0x46')]=function(_0x16e136,_0x44ff0c){return db[_0xf1bd('0x2a')][_0xf1bd('0x46')](_0x16e136['body'],{})['then'](respondWithResult(_0x44ff0c,0xc9))['catch'](handleError(_0x44ff0c,null));};exports[_0xf1bd('0x24')]=function(_0xdb15b8,_0x471d6e){if(_0xdb15b8[_0xf1bd('0x47')]['id']){delete _0xdb15b8[_0xf1bd('0x47')]['id'];}return db[_0xf1bd('0x2a')]['find']({'where':{'id':_0xdb15b8['params']['id']}})['then'](handleEntityNotFound(_0x471d6e,null))[_0xf1bd('0x25')](saveUpdates(_0xdb15b8[_0xf1bd('0x47')],null))[_0xf1bd('0x25')](respondWithResult(_0x471d6e,null))[_0xf1bd('0x42')](handleError(_0x471d6e,null));};exports['destroy']=function(_0x270ce8,_0x553a67){return db[_0xf1bd('0x2a')][_0xf1bd('0x48')]({'where':{'id':_0x270ce8['params']['id']}})[_0xf1bd('0x25')](handleEntityNotFound(_0x553a67,null))[_0xf1bd('0x25')](removeEntity(_0x553a67,null))['catch'](handleError(_0x553a67,null));};exports[_0xf1bd('0x49')]=function(_0x773900,_0xd7f90e){return db[_0xf1bd('0x2a')][_0xf1bd('0x49')]()['then'](respondWithResult(_0xd7f90e,null))[_0xf1bd('0x42')](handleError(_0xd7f90e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fdaacb1..89a8b2f 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 _0x430e=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x170985,_0x29fd01){var _0x74ac7a=function(_0x3726a0){while(--_0x3726a0){_0x170985['push'](_0x170985['shift']());}};_0x74ac7a(++_0x29fd01);}(_0x430e,0x105));var _0xe430=function(_0x5938c8,_0x4a9ca){_0x5938c8=_0x5938c8-0x0;var _0x4353f7=_0x430e[_0x5938c8];return _0x4353f7;};'use strict';var _=require('lodash');var util=require(_0xe430('0x0'));var logger=require(_0xe430('0x1'))('api');var moment=require(_0xe430('0x2'));var BPromise=require(_0xe430('0x3'));var rp=require(_0xe430('0x4'));var fs=require('fs');var path=require(_0xe430('0x5'));var rimraf=require('rimraf');var config=require(_0xe430('0x6'));var attributes=require(_0xe430('0x7'));module[_0xe430('0x8')]=function(_0x1faac1,_0x541e30){return _0x1faac1[_0xe430('0x9')](_0xe430('0xa'),attributes,{'tableName':_0xe430('0xb'),'paranoid':![],'indexes':[{'name':_0xe430('0xc'),'fields':[_0xe430('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ad=['uniqueid','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x49554d,_0x2f57a8){var _0x2ead18=function(_0x343f82){while(--_0x343f82){_0x49554d['push'](_0x49554d['shift']());}};_0x2ead18(++_0x2f57a8);}(_0xe7ad,0x1b1));var _0xde7a=function(_0x595742,_0x2cc590){_0x595742=_0x595742-0x0;var _0x1dcfb4=_0xe7ad[_0x595742];return _0x1dcfb4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde7a('0x0'))('api');var moment=require(_0xde7a('0x1'));var BPromise=require(_0xde7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xde7a('0x3'));var config=require(_0xde7a('0x4'));var attributes=require(_0xde7a('0x5'));module[_0xde7a('0x6')]=function(_0x7db9b6,_0x3b112e){return _0x7db9b6['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xde7a('0x7'),'fields':[_0xde7a('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9c34042..c189781 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 _0x210e=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0xc9416a,_0x6951d8){var _0x2bd78d=function(_0x58386b){while(--_0x58386b){_0xc9416a['push'](_0xc9416a['shift']());}};_0x2bd78d(++_0x6951d8);}(_0x210e,0xe4));var _0xe210=function(_0x325bc4,_0x4df462){_0x325bc4=_0x325bc4-0x0;var _0x330091=_0x210e[_0x325bc4];return _0x330091;};'use strict';var _=require('lodash');var util=require(_0xe210('0x0'));var moment=require(_0xe210('0x1'));var BPromise=require(_0xe210('0x2'));var rs=require(_0xe210('0x3'));var fs=require('fs');var Redis=require(_0xe210('0x4'));var db=require(_0xe210('0x5'))['db'];var utils=require(_0xe210('0x6'));var logger=require(_0xe210('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe210('0x8'));var client=jayson[_0xe210('0x9')][_0xe210('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b68b,_0x5d6244,_0x3f226c){return new BPromise(function(_0x405356,_0x2d886d){return client[_0xe210('0xb')](_0x14b68b,_0x3f226c)[_0xe210('0xc')](function(_0x52580e){logger[_0xe210('0xd')](_0xe210('0xe'),_0x5d6244,'request\x20sent');logger[_0xe210('0xf')](_0xe210('0x10'),_0x5d6244,_0xe210('0x11'),JSON[_0xe210('0x12')](_0x52580e));if(_0x52580e[_0xe210('0x13')]){if(_0x52580e[_0xe210('0x13')][_0xe210('0x14')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5d6244,_0x52580e[_0xe210('0x13')]['message']);return _0x2d886d(_0x52580e['error'][_0xe210('0x15')]);}logger[_0xe210('0x13')](_0xe210('0xe'),_0x5d6244,_0x52580e[_0xe210('0x13')]['message']);return _0x405356(_0x52580e['error'][_0xe210('0x15')]);}else{logger['info'](_0xe210('0xe'),_0x5d6244,_0xe210('0x11'));_0x405356(_0x52580e[_0xe210('0x16')]['message']);}})[_0xe210('0x17')](function(_0x248b06){logger[_0xe210('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x5d6244,_0x248b06);_0x2d886d(_0x248b06);});});} \ No newline at end of file +var _0xa82a=['rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x161114,_0x227c9f){var _0x8c2056=function(_0x58889b){while(--_0x58889b){_0x161114['push'](_0x161114['shift']());}};_0x8c2056(++_0x227c9f);}(_0xa82a,0x189));var _0xaa82=function(_0x3bee20,_0x53935a){_0x3bee20=_0x3bee20-0x0;var _0x49173e=_0xa82a[_0x3bee20];return _0x49173e;};'use strict';var _=require('lodash');var util=require(_0xaa82('0x0'));var moment=require(_0xaa82('0x1'));var BPromise=require(_0xaa82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa82('0x3'));var db=require(_0xaa82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa82('0x5'))(_0xaa82('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa82('0x7'));var client=jayson[_0xaa82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2461f7,_0x2e8fa2,_0x131400){return new BPromise(function(_0x39be92,_0x3e8561){return client[_0xaa82('0x9')](_0x2461f7,_0x131400)[_0xaa82('0xa')](function(_0x138ffc){logger[_0xaa82('0xb')](_0xaa82('0xc'),_0x2e8fa2,_0xaa82('0xd'));logger[_0xaa82('0xe')](_0xaa82('0xf'),_0x2e8fa2,_0xaa82('0xd'),JSON[_0xaa82('0x10')](_0x138ffc));if(_0x138ffc['error']){if(_0x138ffc[_0xaa82('0x11')][_0xaa82('0x12')]===0x1f4){logger['error'](_0xaa82('0xc'),_0x2e8fa2,_0x138ffc[_0xaa82('0x11')][_0xaa82('0x13')]);return _0x3e8561(_0x138ffc[_0xaa82('0x11')][_0xaa82('0x13')]);}logger[_0xaa82('0x11')](_0xaa82('0xc'),_0x2e8fa2,_0x138ffc['error'][_0xaa82('0x13')]);return _0x39be92(_0x138ffc[_0xaa82('0x11')]['message']);}else{logger[_0xaa82('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x2e8fa2,_0xaa82('0xd'));_0x39be92(_0x138ffc['result'][_0xaa82('0x13')]);}})[_0xaa82('0x14')](function(_0x2cbf17){logger[_0xaa82('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2e8fa2,_0x2cbf17);_0x3e8561(_0x2cbf17);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7956926..56da89c 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 _0x4e0f=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports'];(function(_0x53c864,_0x407d7d){var _0x3aae54=function(_0x30c5c3){while(--_0x30c5c3){_0x53c864['push'](_0x53c864['shift']());}};_0x3aae54(++_0x407d7d);}(_0x4e0f,0x150));var _0xf4e0=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x4e0f[_0x43e97d];return _0x424cd9;};'use strict';var multer=require('multer');var util=require(_0xf4e0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4e0('0x1'));var router=express['Router']();var fs_extra=require(_0xf4e0('0x2'));var auth=require(_0xf4e0('0x3'));var interaction=require(_0xf4e0('0x4'));var config=require('../../config/environment');var controller=require(_0xf4e0('0x5'));router[_0xf4e0('0x6')]('/',auth[_0xf4e0('0x7')](),controller[_0xf4e0('0x8')]);router['get']('/describe',auth[_0xf4e0('0x7')](),controller['describe']);router[_0xf4e0('0x6')]('/:id',auth[_0xf4e0('0x7')](),controller[_0xf4e0('0x9')]);router['post']('/',auth[_0xf4e0('0x7')](),controller[_0xf4e0('0xa')]);router[_0xf4e0('0xb')](_0xf4e0('0xc'),auth[_0xf4e0('0x7')](),controller[_0xf4e0('0xd')]);router[_0xf4e0('0xe')](_0xf4e0('0xc'),auth[_0xf4e0('0x7')](),controller['destroy']);module[_0xf4e0('0xf')]=router; \ No newline at end of file +var _0x84c9=['show','post','create','put','delete','/:id','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3ab36b,_0x58fba7){var _0x9b3171=function(_0x4cafe4){while(--_0x4cafe4){_0x3ab36b['push'](_0x3ab36b['shift']());}};_0x9b3171(++_0x58fba7);}(_0x84c9,0x180));var _0x984c=function(_0x440f94,_0x46e7ac){_0x440f94=_0x440f94-0x0;var _0x27f0ad=_0x84c9[_0x440f94];return _0x27f0ad;};'use strict';var multer=require('multer');var util=require(_0x984c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x984c('0x1'));var router=express[_0x984c('0x2')]();var fs_extra=require(_0x984c('0x3'));var auth=require(_0x984c('0x4'));var interaction=require(_0x984c('0x5'));var config=require(_0x984c('0x6'));var controller=require(_0x984c('0x7'));router[_0x984c('0x8')]('/',auth[_0x984c('0x9')](),controller[_0x984c('0xa')]);router[_0x984c('0x8')](_0x984c('0xb'),auth[_0x984c('0x9')](),controller['describe']);router[_0x984c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x984c('0xc')]);router[_0x984c('0xd')]('/',auth[_0x984c('0x9')](),controller[_0x984c('0xe')]);router[_0x984c('0xf')]('/:id',auth[_0x984c('0x9')](),controller['update']);router[_0x984c('0x10')](_0x984c('0x11'),auth[_0x984c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 06ce1f4..9134517 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 _0xe5a2=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','setDataValue','exitAt','duration','talk:[destination]','sequelize','moment','exports'];(function(_0x4813d8,_0x55eea9){var _0x186dec=function(_0x25888a){while(--_0x25888a){_0x4813d8['push'](_0x4813d8['shift']());}};_0x186dec(++_0x55eea9);}(_0xe5a2,0x1dd));var _0x2e5a=function(_0x25fd89,_0x3142b6){_0x25fd89=_0x25fd89-0x0;var _0x2f65a3=_0xe5a2[_0x25fd89];return _0x2f65a3;};'use strict';var Sequelize=require(_0x2e5a('0x0'));var moment=require(_0x2e5a('0x1'));module[_0x2e5a('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2e5a('0x3')]},'type':{'type':Sequelize[_0x2e5a('0x3')],'defaultValue':_0x2e5a('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x2e5a('0x5')]},'enterAt':{'type':Sequelize[_0x2e5a('0x6')]},'exitAt':{'type':Sequelize[_0x2e5a('0x6')],'set':function(_0x46adf3){var _0x392839=moment(_0x46adf3);var _0x1c275f=moment(this['getDataValue'](_0x2e5a('0x7')));var _0x465374=_0x392839['diff'](_0x1c275f,'seconds');this[_0x2e5a('0x8')](_0x2e5a('0x9'),_0x46adf3);this[_0x2e5a('0x8')](_0x2e5a('0xa'),_0x465374>=0x0?_0x465374:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2e5a('0x3')],'comment':_0x2e5a('0xb')},'data4':{'type':Sequelize[_0x2e5a('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2e5a('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x2e5a('0x3')]},'internal':{'type':Sequelize[_0x2e5a('0x5')]},'uniqueid':{'type':Sequelize[_0x2e5a('0x3')]}}; \ No newline at end of file +var _0x311a=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x1dbaee,_0x433c30){var _0x55b745=function(_0x201a2b){while(--_0x201a2b){_0x1dbaee['push'](_0x1dbaee['shift']());}};_0x55b745(++_0x433c30);}(_0x311a,0x1df));var _0xa311=function(_0x4ac261,_0x184902){_0x4ac261=_0x4ac261-0x0;var _0x1007fd=_0x311a[_0x4ac261];return _0x1007fd;};'use strict';var Sequelize=require(_0xa311('0x0'));var moment=require(_0xa311('0x1'));module[_0xa311('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa311('0x3')]},'interface':{'type':Sequelize[_0xa311('0x3')]},'type':{'type':Sequelize[_0xa311('0x3')],'defaultValue':_0xa311('0x4'),'comment':_0xa311('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa311('0x6')]},'exitAt':{'type':Sequelize[_0xa311('0x6')],'set':function(_0x5d106e){var _0xf00a1a=moment(_0x5d106e);var _0xf38536=moment(this[_0xa311('0x7')](_0xa311('0x8')));var _0x752be5=_0xf00a1a[_0xa311('0x9')](_0xf38536,_0xa311('0xa'));this[_0xa311('0xb')]('exitAt',_0x5d106e);this[_0xa311('0xb')](_0xa311('0xc'),_0x752be5>=0x0?_0x752be5:null);}},'data1':{'type':Sequelize[_0xa311('0x3')],'comment':_0xa311('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xa311('0xe')},'data3':{'type':Sequelize[_0xa311('0x3')],'comment':_0xa311('0xf')},'data4':{'type':Sequelize[_0xa311('0x3')],'comment':_0xa311('0x10')},'data5':{'type':Sequelize[_0xa311('0x3')],'comment':_0xa311('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xa311('0x12')]},'uniqueid':{'type':Sequelize[_0xa311('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b17d422..bdb0e2f 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x36aa59,_0x55030c){var _0x2a6eb9=function(_0x2739c7){while(--_0x2739c7){_0x36aa59['push'](_0x36aa59['shift']());}};_0x2a6eb9(++_0x55030c);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x76a667,_0x456b95){var _0xaac135=function(_0x3029fe){while(--_0x3029fe){_0x76a667['push'](_0x76a667['shift']());}};_0xaac135(++_0x456b95);}(_0x3e74,0x175));var _0x43e7=function(_0x4940bd,_0x2f7c0a){_0x4940bd=_0x4940bd-0x0;var _0x4c0e8d=_0x3e74[_0x4940bd];return _0x4c0e8d;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 5bdbf46..2867301 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 _0x9303=['./memberReport.attributes','exports','report_member','membername_interface','membername','interface','lodash','api','bluebird','rimraf','../../config/environment'];(function(_0x483a7a,_0x58ca9c){var _0x47ef93=function(_0x1b4d86){while(--_0x1b4d86){_0x483a7a['push'](_0x483a7a['shift']());}};_0x47ef93(++_0x58ca9c);}(_0x9303,0xd7));var _0x3930=function(_0x381cd5,_0x1f66dd){_0x381cd5=_0x381cd5-0x0;var _0x14b162=_0x9303[_0x381cd5];return _0x14b162;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3930('0x1'));var moment=require('moment');var BPromise=require(_0x3930('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3930('0x3'));var config=require(_0x3930('0x4'));var attributes=require(_0x3930('0x5'));module[_0x3930('0x6')]=function(_0x57e19d,_0x44949e){return _0x57e19d['define']('MemberReport',attributes,{'tableName':_0x3930('0x7'),'paranoid':![],'indexes':[{'name':_0x3930('0x8'),'fields':[_0x3930('0x9'),_0x3930('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x176c=['rimraf','../../config/environment','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x176c,0x134));var _0xc176=function(_0x4cd300,_0x141ff0){_0x4cd300=_0x4cd300-0x0;var _0x18dd6c=_0x176c[_0x4cd300];return _0x18dd6c;};'use strict';var _=require(_0xc176('0x0'));var util=require(_0xc176('0x1'));var logger=require(_0xc176('0x2'))(_0xc176('0x3'));var moment=require(_0xc176('0x4'));var BPromise=require(_0xc176('0x5'));var rp=require(_0xc176('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc176('0x7'));var config=require(_0xc176('0x8'));var attributes=require('./memberReport.attributes');module[_0xc176('0x9')]=function(_0x299972,_0xc86b41){return _0x299972['define'](_0xc176('0xa'),attributes,{'tableName':_0xc176('0xb'),'paranoid':![],'indexes':[{'name':_0xc176('0xc'),'fields':[_0xc176('0xd'),_0xc176('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 70d06f1..189567d 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 _0x1bb4=['limit','include','map','model','info','stringify','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','options','raw','where','attributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x574edc,_0x48f033){_0x574edc=_0x574edc-0x0;var _0x32449a=_0x1bb4[_0x574edc];return _0x32449a;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var moment=require(_0x41bb('0x2'));var BPromise=require(_0x41bb('0x3'));var rs=require(_0x41bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41bb('0x6'))('rpc');var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41bb('0x8')][_0x41bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a2bfc,_0x492edd,_0xbaf7dc){return new BPromise(function(_0x3dc644,_0x4af8b1){return client[_0x41bb('0xa')](_0x1a2bfc,_0xbaf7dc)[_0x41bb('0xb')](function(_0x2ee5b8){logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));logger[_0x41bb('0xe')](_0x41bb('0xf'),_0x492edd,_0x41bb('0xd'),JSON['stringify'](_0x2ee5b8));if(_0x2ee5b8[_0x41bb('0x10')]){if(_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x11')]===0x1f4){logger[_0x41bb('0x10')](_0x41bb('0xc'),_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x4af8b1(_0x2ee5b8[_0x41bb('0x10')]['message']);}logger['error']('MemberReport,\x20%s,\x20%s',_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x3dc644(_0x2ee5b8[_0x41bb('0x10')]['message']);}else{logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));_0x3dc644(_0x2ee5b8[_0x41bb('0x13')][_0x41bb('0x12')]);}})[_0x41bb('0x14')](function(_0x4a1687){logger[_0x41bb('0x10')]('MemberReport,\x20%s,\x20%s',_0x492edd,_0x4a1687);_0x4af8b1(_0x4a1687);});});}exports[_0x41bb('0x15')]=function(_0x3fa4a4){var _0x569bce=this;return new Promise(function(_0xc202d0,_0x4163ad){return db['MemberReport']['findAll']({'raw':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4['options'][_0x41bb('0x17')]===undefined?!![]:![]:!![],'where':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x18')]||null:null,'attributes':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x19')]||null:null,'limit':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x1a')]||null:null,'include':_0x3fa4a4['options']?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x1b')]?_[_0x41bb('0x1c')](_0x3fa4a4[_0x41bb('0x16')]['include'],function(_0x4d065e){return{'model':db[_0x4d065e[_0x41bb('0x1d')]],'as':_0x4d065e['as'],'attributes':_0x4d065e[_0x41bb('0x19')],'include':_0x4d065e[_0x41bb('0x1b')]?_['map'](_0x4d065e[_0x41bb('0x1b')],function(_0x19bd28){return{'model':db[_0x19bd28['model']],'as':_0x19bd28['as'],'attributes':_0x19bd28[_0x41bb('0x19')],'include':_0x19bd28[_0x41bb('0x1b')]?_[_0x41bb('0x1c')](_0x19bd28[_0x41bb('0x1b')],function(_0x440d33){return{'model':db[_0x440d33[_0x41bb('0x1d')]],'as':_0x440d33['as'],'attributes':_0x440d33[_0x41bb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x41bb('0xb')](function(_0x27ebe8){logger[_0x41bb('0x1e')](_0x41bb('0x15'),_0x3fa4a4);logger[_0x41bb('0xe')](_0x41bb('0x15'),_0x3fa4a4,JSON[_0x41bb('0x1f')](_0x27ebe8));_0xc202d0(_0x27ebe8);})[_0x41bb('0x14')](function(_0x4645c8){logger['error'](_0x41bb('0x15'),_0x4645c8[_0x41bb('0x12')],_0x3fa4a4);_0x4163ad(_0x569bce[_0x41bb('0x10')](0x1f4,_0x4645c8[_0x41bb('0x12')]));});});};exports[_0x41bb('0x20')]=function(_0x126444){var _0x31aa42=this;return new Promise(function(_0x39539a,_0x3590d6){return db[_0x41bb('0x21')][_0x41bb('0x22')](_0x126444[_0x41bb('0x23')],{'raw':_0x126444[_0x41bb('0x16')]?_0x126444[_0x41bb('0x16')][_0x41bb('0x17')]===undefined?!![]:![]:!![]})[_0x41bb('0xb')](function(_0x58eb96){logger[_0x41bb('0x1e')](_0x41bb('0x20'),_0x126444);logger[_0x41bb('0xe')](_0x41bb('0x20'),_0x126444,JSON[_0x41bb('0x1f')](_0x58eb96));_0x39539a(_0x58eb96);})[_0x41bb('0x14')](function(_0x131ce3){logger['error']('CreateMemberReport',_0x131ce3[_0x41bb('0x12')],_0x126444);_0x3590d6(_0x31aa42[_0x41bb('0x10')](0x1f4,_0x131ce3[_0x41bb('0x12')]));});});};exports[_0x41bb('0x24')]=function(_0x37764d){var _0x11f3c9=this;return new Promise(function(_0x346cbc,_0x333738){return db['MemberReport']['update'](_0x37764d['body'],{'raw':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')]['where']||null:null,'attributes':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x19')]||null:null,'limit':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x1a')]||null:null})[_0x41bb('0xb')](function(_0x3ecb67){logger[_0x41bb('0x1e')](_0x41bb('0x24'),_0x37764d);logger['debug']('UpdateMemberReport',_0x37764d,JSON['stringify'](_0x3ecb67));_0x346cbc(_0x3ecb67);})[_0x41bb('0x14')](function(_0x43a7b5){logger[_0x41bb('0x10')](_0x41bb('0x24'),_0x43a7b5['message'],_0x37764d);_0x333738(_0x11f3c9[_0x41bb('0x10')](0x1f4,_0x43a7b5[_0x41bb('0x12')]));});});}; \ No newline at end of file +var _0x018c=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1af482,_0x1af5b7){var _0x7e7580=function(_0x5ed4a7){while(--_0x5ed4a7){_0x1af482['push'](_0x1af482['shift']());}};_0x7e7580(++_0x1af5b7);}(_0x018c,0xda));var _0xc018=function(_0x97dc12,_0x2417b6){_0x97dc12=_0x97dc12-0x0;var _0x1f1880=_0x018c[_0x97dc12];return _0x1f1880;};'use strict';var _=require(_0xc018('0x0'));var util=require(_0xc018('0x1'));var moment=require(_0xc018('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc018('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc018('0x4'));var logger=require(_0xc018('0x5'))(_0xc018('0x6'));var config=require(_0xc018('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc018('0x8')][_0xc018('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f194,_0x4762ab,_0x29a572){return new BPromise(function(_0x236893,_0x638610){return client[_0xc018('0xa')](_0x46f194,_0x29a572)[_0xc018('0xb')](function(_0x193169){logger[_0xc018('0xc')](_0xc018('0xd'),_0x4762ab,_0xc018('0xe'));logger[_0xc018('0xf')](_0xc018('0x10'),_0x4762ab,_0xc018('0xe'),JSON[_0xc018('0x11')](_0x193169));if(_0x193169[_0xc018('0x12')]){if(_0x193169['error'][_0xc018('0x13')]===0x1f4){logger['error'](_0xc018('0xd'),_0x4762ab,_0x193169[_0xc018('0x12')][_0xc018('0x14')]);return _0x638610(_0x193169[_0xc018('0x12')][_0xc018('0x14')]);}logger[_0xc018('0x12')](_0xc018('0xd'),_0x4762ab,_0x193169[_0xc018('0x12')][_0xc018('0x14')]);return _0x236893(_0x193169[_0xc018('0x12')][_0xc018('0x14')]);}else{logger['info'](_0xc018('0xd'),_0x4762ab,_0xc018('0xe'));_0x236893(_0x193169[_0xc018('0x15')][_0xc018('0x14')]);}})[_0xc018('0x16')](function(_0x3f023f){logger[_0xc018('0x12')](_0xc018('0xd'),_0x4762ab,_0x3f023f);_0x638610(_0x3f023f);});});}exports['GetMemberReport']=function(_0x5f2c11){var _0xe5f2fe=this;return new Promise(function(_0x4e388e,_0x994233){return db[_0xc018('0x17')][_0xc018('0x18')]({'raw':_0x5f2c11['options']?_0x5f2c11[_0xc018('0x19')][_0xc018('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f2c11[_0xc018('0x19')]?_0x5f2c11['options'][_0xc018('0x1b')]||null:null,'attributes':_0x5f2c11[_0xc018('0x19')]?_0x5f2c11[_0xc018('0x19')][_0xc018('0x1c')]||null:null,'limit':_0x5f2c11[_0xc018('0x19')]?_0x5f2c11[_0xc018('0x19')][_0xc018('0x1d')]||null:null,'include':_0x5f2c11[_0xc018('0x19')]?_0x5f2c11[_0xc018('0x19')][_0xc018('0x1e')]?_[_0xc018('0x1f')](_0x5f2c11[_0xc018('0x19')][_0xc018('0x1e')],function(_0x1ff3f6){return{'model':db[_0x1ff3f6[_0xc018('0x20')]],'as':_0x1ff3f6['as'],'attributes':_0x1ff3f6[_0xc018('0x1c')],'include':_0x1ff3f6[_0xc018('0x1e')]?_[_0xc018('0x1f')](_0x1ff3f6[_0xc018('0x1e')],function(_0x68871){return{'model':db[_0x68871['model']],'as':_0x68871['as'],'attributes':_0x68871[_0xc018('0x1c')],'include':_0x68871[_0xc018('0x1e')]?_[_0xc018('0x1f')](_0x68871[_0xc018('0x1e')],function(_0x4a857d){return{'model':db[_0x4a857d[_0xc018('0x20')]],'as':_0x4a857d['as'],'attributes':_0x4a857d[_0xc018('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc018('0xb')](function(_0x509bc0){logger['info'](_0xc018('0x21'),_0x5f2c11);logger[_0xc018('0xf')]('GetMemberReport',_0x5f2c11,JSON['stringify'](_0x509bc0));_0x4e388e(_0x509bc0);})[_0xc018('0x16')](function(_0x31373c){logger[_0xc018('0x12')]('GetMemberReport',_0x31373c[_0xc018('0x14')],_0x5f2c11);_0x994233(_0xe5f2fe[_0xc018('0x12')](0x1f4,_0x31373c[_0xc018('0x14')]));});});};exports[_0xc018('0x22')]=function(_0x34ea58){var _0x34fdf4=this;return new Promise(function(_0x1f8cfd,_0x24b2fb){return db[_0xc018('0x17')][_0xc018('0x23')](_0x34ea58[_0xc018('0x24')],{'raw':_0x34ea58[_0xc018('0x19')]?_0x34ea58[_0xc018('0x19')][_0xc018('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4430f5){logger[_0xc018('0xc')](_0xc018('0x22'),_0x34ea58);logger[_0xc018('0xf')](_0xc018('0x22'),_0x34ea58,JSON[_0xc018('0x11')](_0x4430f5));_0x1f8cfd(_0x4430f5);})[_0xc018('0x16')](function(_0x275316){logger[_0xc018('0x12')](_0xc018('0x22'),_0x275316[_0xc018('0x14')],_0x34ea58);_0x24b2fb(_0x34fdf4[_0xc018('0x12')](0x1f4,_0x275316[_0xc018('0x14')]));});});};exports[_0xc018('0x25')]=function(_0x5b04c6){var _0x391127=this;return new Promise(function(_0x2bab06,_0x1b47cb){return db[_0xc018('0x17')][_0xc018('0x26')](_0x5b04c6[_0xc018('0x24')],{'raw':_0x5b04c6[_0xc018('0x19')]?_0x5b04c6[_0xc018('0x19')][_0xc018('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b04c6[_0xc018('0x19')]?_0x5b04c6[_0xc018('0x19')][_0xc018('0x1b')]||null:null,'attributes':_0x5b04c6['options']?_0x5b04c6[_0xc018('0x19')][_0xc018('0x1c')]||null:null,'limit':_0x5b04c6[_0xc018('0x19')]?_0x5b04c6[_0xc018('0x19')][_0xc018('0x1d')]||null:null})[_0xc018('0xb')](function(_0x2493cf){logger[_0xc018('0xc')](_0xc018('0x25'),_0x5b04c6);logger[_0xc018('0xf')](_0xc018('0x25'),_0x5b04c6,JSON[_0xc018('0x11')](_0x2493cf));_0x2bab06(_0x2493cf);})[_0xc018('0x16')](function(_0x47316e){logger['error']('UpdateMemberReport',_0x47316e['message'],_0x5b04c6);_0x1b47cb(_0x391127[_0xc018('0x12')](0x1f4,_0x47316e[_0xc018('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8a96fb8..67f12c3 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 _0x1b20=['get','index','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',controller[_0x01b2('0x9')]);module[_0x01b2('0xa')]=router; \ No newline at end of file +var _0x9275=['../../components/interaction/service','../../config/environment','get','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4ca9d5,_0x4c91f4){var _0x5d0e24=function(_0xaad365){while(--_0xaad365){_0x4ca9d5['push'](_0x4ca9d5['shift']());}};_0x5d0e24(++_0x4c91f4);}(_0x9275,0x130));var _0x5927=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x9275[_0x3b1b23];return _0x1efc85;};'use strict';var multer=require('multer');var util=require(_0x5927('0x0'));var path=require(_0x5927('0x1'));var timeout=require(_0x5927('0x2'));var express=require('express');var router=express[_0x5927('0x3')]();var fs_extra=require(_0x5927('0x4'));var auth=require(_0x5927('0x5'));var interaction=require(_0x5927('0x6'));var config=require(_0x5927('0x7'));var controller=require('./migration.controller');router[_0x5927('0x8')]('/',controller['index']);module[_0x5927('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 24eed1c..c3c71b5 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 _0x9af6=['sequelize','exports','version'];(function(_0x54e1e2,_0x2ff2d1){var _0x13215c=function(_0x436824){while(--_0x436824){_0x54e1e2['push'](_0x54e1e2['shift']());}};_0x13215c(++_0x2ff2d1);}(_0x9af6,0x1e6));var _0x69af=function(_0x5bcf36,_0x16cf24){_0x5bcf36=_0x5bcf36-0x0;var _0x5071be=_0x9af6[_0x5bcf36];return _0x5071be;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x69af('0x2')}}; \ No newline at end of file +var _0x0a6e=['STRING','version','sequelize','exports'];(function(_0x2dcb94,_0x15891c){var _0x1d3ea4=function(_0x85ef91){while(--_0x85ef91){_0x2dcb94['push'](_0x2dcb94['shift']());}};_0x1d3ea4(++_0x15891c);}(_0x0a6e,0x18e));var _0xe0a6=function(_0x97799d,_0x241c82){_0x97799d=_0x97799d-0x0;var _0x355366=_0x0a6e[_0x97799d];return _0x355366;};'use strict';var Sequelize=require(_0xe0a6('0x0'));module[_0xe0a6('0x1')]={'version':{'type':Sequelize[_0xe0a6('0x2')],'unique':_0xe0a6('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f38aff1..76f0d1a 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 _0x649b=['then','destroy','stack','name','send','index','map','Migration','rawAttributes','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','update'];(function(_0x5d732b,_0x1a60c2){var _0x3538c7=function(_0x2804fd){while(--_0x2804fd){_0x5d732b['push'](_0x5d732b['shift']());}};_0x3538c7(++_0x1a60c2);}(_0x649b,0x16a));var _0xb649=function(_0x5f5666,_0x49394b){_0x5f5666=_0x5f5666-0x0;var _0x579f33=_0x649b[_0x5f5666];return _0x579f33;};'use strict';var emlformat=require(_0xb649('0x0'));var rimraf=require(_0xb649('0x1'));var zipdir=require(_0xb649('0x2'));var jsonpatch=require(_0xb649('0x3'));var rp=require(_0xb649('0x4'));var moment=require(_0xb649('0x5'));var BPromise=require(_0xb649('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb649('0x7'));var sox=require('sox');var csv=require(_0xb649('0x8'));var ejs=require(_0xb649('0x9'));var fs=require('fs');var fs_extra=require(_0xb649('0xa'));var _=require(_0xb649('0xb'));var squel=require(_0xb649('0xc'));var crypto=require(_0xb649('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb649('0x8'));var querystring=require(_0xb649('0xe'));var Papa=require(_0xb649('0xf'));var Redis=require(_0xb649('0x10'));var authService=require(_0xb649('0x11'));var qs=require(_0xb649('0x12'));var as=require(_0xb649('0x13'));var hardwareService=require(_0xb649('0x14'));var logger=require(_0xb649('0x15'))(_0xb649('0x16'));var utils=require('../../config/utils');var config=require(_0xb649('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d597b,_0x2e091b){_0x2e091b=_0x2e091b||0xcc;return function(_0x299a27){if(_0x299a27){return _0x1d597b[_0xb649('0x18')](_0x2e091b);}return _0x1d597b[_0xb649('0x19')](_0x2e091b)[_0xb649('0x1a')]();};}function respondWithResult(_0x27e8f8,_0x3fa166){_0x3fa166=_0x3fa166||0xc8;return function(_0xdf3593){if(_0xdf3593){return _0x27e8f8[_0xb649('0x19')](_0x3fa166)[_0xb649('0x1b')](_0xdf3593);}};}function respondWithFilteredResult(_0x52a5c5,_0x280712){return function(_0x4034d6){if(_0x4034d6){var _0x19c40e=typeof _0x280712[_0xb649('0x1c')]===_0xb649('0x1d')&&typeof _0x280712[_0xb649('0x1e')]===_0xb649('0x1d');var _0x51c9eb=_0x4034d6['count'];var _0x5719a6=_0x19c40e?0x0:_0x280712[_0xb649('0x1c')];var _0x408c72=_0x19c40e?_0x4034d6['count']:_0x280712['offset']+_0x280712['limit'];var _0x2dfa3d;if(_0x408c72>=_0x51c9eb){_0x408c72=_0x51c9eb;_0x2dfa3d=0xc8;}else{_0x2dfa3d=0xce;}_0x52a5c5[_0xb649('0x19')](_0x2dfa3d);return _0x52a5c5['set'](_0xb649('0x1f'),_0x5719a6+'-'+_0x408c72+'/'+_0x51c9eb)[_0xb649('0x1b')](_0x4034d6);}return null;};}function patchUpdates(_0x2df170){return function(_0x5201d8){try{jsonpatch[_0xb649('0x20')](_0x5201d8,_0x2df170,!![]);}catch(_0x438499){return BPromise['reject'](_0x438499);}return _0x5201d8['save']();};}function saveUpdates(_0xc05663,_0x444681){return function(_0x25e87e){if(_0x25e87e){return _0x25e87e[_0xb649('0x21')](_0xc05663)[_0xb649('0x22')](function(_0x4fe0eb){return _0x4fe0eb;});}return null;};}function removeEntity(_0x4f850f,_0x2759af){return function(_0x3e39df){if(_0x3e39df){return _0x3e39df[_0xb649('0x23')]()[_0xb649('0x22')](function(){_0x4f850f[_0xb649('0x19')](0xcc)[_0xb649('0x1a')]();});}};}function handleEntityNotFound(_0x772d4,_0x59b6c8){return function(_0x473b8b){if(!_0x473b8b){_0x772d4['sendStatus'](0x194);}return _0x473b8b;};}function handleError(_0x4c8dc2,_0x2ed8d3){_0x2ed8d3=_0x2ed8d3||0x1f4;return function(_0x19dcaf){logger['error'](_0x19dcaf[_0xb649('0x24')]);if(_0x19dcaf[_0xb649('0x25')]){delete _0x19dcaf[_0xb649('0x25')];}_0x4c8dc2[_0xb649('0x19')](_0x2ed8d3)[_0xb649('0x26')](_0x19dcaf);};}exports[_0xb649('0x27')]=function(_0x2ff08f,_0x59a24f){var _0x30c195={},_0x1eec6a={},_0x420de7={'count':0x0,'rows':[]};var _0x1cbc9b=_[_0xb649('0x28')](db[_0xb649('0x29')][_0xb649('0x2a')],function(_0x79a359){return{'name':_0x79a359['fieldName'],'type':_0x79a359['type'][_0xb649('0x2b')]};});_0x1eec6a[_0xb649('0x2c')]=_['map'](_0x1cbc9b,_0xb649('0x25'));_0x1eec6a[_0xb649('0x2d')]=_[_0xb649('0x2e')](_0x2ff08f[_0xb649('0x2d')]);_0x1eec6a[_0xb649('0x2f')]=_[_0xb649('0x30')](_0x1eec6a[_0xb649('0x2c')],_0x1eec6a[_0xb649('0x2d')]);_0x30c195['attributes']=_['intersection'](_0x1eec6a[_0xb649('0x2c')],qs[_0xb649('0x31')](_0x2ff08f[_0xb649('0x2d')]['fields']));_0x30c195['attributes']=_0x30c195['attributes'][_0xb649('0x32')]?_0x30c195[_0xb649('0x33')]:_0x1eec6a['model'];if(!_0x2ff08f[_0xb649('0x2d')][_0xb649('0x34')](_0xb649('0x35'))){_0x30c195[_0xb649('0x1e')]=qs[_0xb649('0x1e')](_0x2ff08f[_0xb649('0x2d')][_0xb649('0x1e')]);_0x30c195[_0xb649('0x1c')]=qs[_0xb649('0x1c')](_0x2ff08f['query'][_0xb649('0x1c')]);}_0x30c195[_0xb649('0x36')]=qs[_0xb649('0x37')](_0x2ff08f[_0xb649('0x2d')]['sort']);_0x30c195[_0xb649('0x38')]=qs['filters'](_['pick'](_0x2ff08f[_0xb649('0x2d')],_0x1eec6a[_0xb649('0x2f')]),_0x1cbc9b);if(_0x2ff08f[_0xb649('0x2d')][_0xb649('0x39')]){_0x30c195[_0xb649('0x38')]=_[_0xb649('0x3a')](_0x30c195[_0xb649('0x38')],{'$or':_[_0xb649('0x28')](_0x1cbc9b,function(_0x14929d){if(_0x14929d[_0xb649('0x3b')]!==_0xb649('0x3c')){var _0x41a9c7={};_0x41a9c7[_0x14929d[_0xb649('0x25')]]={'$like':'%'+_0x2ff08f['query']['filter']+'%'};return _0x41a9c7;}})});}_0x30c195=_[_0xb649('0x3a')]({},_0x30c195,_0x2ff08f[_0xb649('0x3d')]);var _0x58d66b={'where':_0x30c195[_0xb649('0x38')]};return db[_0xb649('0x29')][_0xb649('0x3e')](_0x58d66b)[_0xb649('0x22')](function(_0x40eea8){_0x420de7[_0xb649('0x3e')]=_0x40eea8;if(_0x2ff08f[_0xb649('0x2d')][_0xb649('0x3f')]){_0x30c195[_0xb649('0x40')]=[{'all':!![]}];}return db[_0xb649('0x29')][_0xb649('0x41')](_0x30c195);})[_0xb649('0x22')](function(_0x5c5ec8){_0x420de7['rows']=_0x5c5ec8;return _0x420de7;})['then'](respondWithFilteredResult(_0x59a24f,_0x30c195))['catch'](handleError(_0x59a24f,null));}; \ No newline at end of file +var _0x8075=['set','apply','reject','save','update','then','error','name','index','map','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','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','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x8075,0xab));var _0x5807=function(_0x456411,_0x1b7bea){_0x456411=_0x456411-0x0;var _0x1e32ed=_0x8075[_0x456411];return _0x1e32ed;};'use strict';var emlformat=require(_0x5807('0x0'));var rimraf=require(_0x5807('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5807('0x2'));var rp=require('request-promise');var moment=require(_0x5807('0x3'));var BPromise=require(_0x5807('0x4'));var Mustache=require('mustache');var util=require(_0x5807('0x5'));var path=require(_0x5807('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5807('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5807('0x8'));var squel=require(_0x5807('0x9'));var crypto=require(_0x5807('0xa'));var jsforce=require(_0x5807('0xb'));var deskjs=require(_0x5807('0xc'));var toCsv=require(_0x5807('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5807('0xe'));var authService=require(_0x5807('0xf'));var qs=require(_0x5807('0x10'));var as=require(_0x5807('0x11'));var hardwareService=require(_0x5807('0x12'));var logger=require(_0x5807('0x13'))(_0x5807('0x14'));var utils=require(_0x5807('0x15'));var config=require(_0x5807('0x16'));var licenseUtil=require(_0x5807('0x17'));var db=require(_0x5807('0x18'))['db'];function respondWithStatusCode(_0x50ea31,_0x147959){_0x147959=_0x147959||0xcc;return function(_0xf02be4){if(_0xf02be4){return _0x50ea31[_0x5807('0x19')](_0x147959);}return _0x50ea31[_0x5807('0x1a')](_0x147959)[_0x5807('0x1b')]();};}function respondWithResult(_0xbf1de,_0x193918){_0x193918=_0x193918||0xc8;return function(_0x3586a6){if(_0x3586a6){return _0xbf1de[_0x5807('0x1a')](_0x193918)[_0x5807('0x1c')](_0x3586a6);}};}function respondWithFilteredResult(_0x24f54a,_0x178ab0){return function(_0x20f8c9){if(_0x20f8c9){var _0x3ae845=typeof _0x178ab0[_0x5807('0x1d')]===_0x5807('0x1e')&&typeof _0x178ab0[_0x5807('0x1f')]===_0x5807('0x1e');var _0x563d44=_0x20f8c9[_0x5807('0x20')];var _0x24dec8=_0x3ae845?0x0:_0x178ab0[_0x5807('0x1d')];var _0x9c184c=_0x3ae845?_0x20f8c9[_0x5807('0x20')]:_0x178ab0['offset']+_0x178ab0[_0x5807('0x1f')];var _0x3af9f6;if(_0x9c184c>=_0x563d44){_0x9c184c=_0x563d44;_0x3af9f6=0xc8;}else{_0x3af9f6=0xce;}_0x24f54a[_0x5807('0x1a')](_0x3af9f6);return _0x24f54a[_0x5807('0x21')]('Content-Range',_0x24dec8+'-'+_0x9c184c+'/'+_0x563d44)[_0x5807('0x1c')](_0x20f8c9);}return null;};}function patchUpdates(_0x1d19f1){return function(_0x4710a2){try{jsonpatch[_0x5807('0x22')](_0x4710a2,_0x1d19f1,!![]);}catch(_0x2abcd4){return BPromise[_0x5807('0x23')](_0x2abcd4);}return _0x4710a2[_0x5807('0x24')]();};}function saveUpdates(_0x24ee3f,_0x5d0aa7){return function(_0x5874bb){if(_0x5874bb){return _0x5874bb[_0x5807('0x25')](_0x24ee3f)[_0x5807('0x26')](function(_0x39c8e9){return _0x39c8e9;});}return null;};}function removeEntity(_0x5b2aa6,_0x32360e){return function(_0xbbbf22){if(_0xbbbf22){return _0xbbbf22['destroy']()[_0x5807('0x26')](function(){_0x5b2aa6[_0x5807('0x1a')](0xcc)[_0x5807('0x1b')]();});}};}function handleEntityNotFound(_0x50dac1,_0x4410ca){return function(_0x2f8393){if(!_0x2f8393){_0x50dac1[_0x5807('0x19')](0x194);}return _0x2f8393;};}function handleError(_0x528fe2,_0x5a42b9){_0x5a42b9=_0x5a42b9||0x1f4;return function(_0x5ccaf1){logger[_0x5807('0x27')](_0x5ccaf1['stack']);if(_0x5ccaf1[_0x5807('0x28')]){delete _0x5ccaf1[_0x5807('0x28')];}_0x528fe2[_0x5807('0x1a')](_0x5a42b9)['send'](_0x5ccaf1);};}exports[_0x5807('0x29')]=function(_0x58e9ab,_0x4c7550){var _0x35e500={},_0x4966fa={},_0x347a08={'count':0x0,'rows':[]};var _0x5640ec=_[_0x5807('0x2a')](db[_0x5807('0x2b')][_0x5807('0x2c')],function(_0x1186ab){return{'name':_0x1186ab[_0x5807('0x2d')],'type':_0x1186ab[_0x5807('0x2e')][_0x5807('0x2f')]};});_0x4966fa['model']=_[_0x5807('0x2a')](_0x5640ec,_0x5807('0x28'));_0x4966fa['query']=_['keys'](_0x58e9ab[_0x5807('0x30')]);_0x4966fa[_0x5807('0x31')]=_[_0x5807('0x32')](_0x4966fa[_0x5807('0x33')],_0x4966fa[_0x5807('0x30')]);_0x35e500[_0x5807('0x34')]=_['intersection'](_0x4966fa[_0x5807('0x33')],qs[_0x5807('0x35')](_0x58e9ab[_0x5807('0x30')][_0x5807('0x35')]));_0x35e500['attributes']=_0x35e500[_0x5807('0x34')][_0x5807('0x36')]?_0x35e500[_0x5807('0x34')]:_0x4966fa[_0x5807('0x33')];if(!_0x58e9ab[_0x5807('0x30')][_0x5807('0x37')]('nolimit')){_0x35e500[_0x5807('0x1f')]=qs[_0x5807('0x1f')](_0x58e9ab[_0x5807('0x30')][_0x5807('0x1f')]);_0x35e500[_0x5807('0x1d')]=qs[_0x5807('0x1d')](_0x58e9ab[_0x5807('0x30')]['offset']);}_0x35e500[_0x5807('0x38')]=qs[_0x5807('0x39')](_0x58e9ab['query'][_0x5807('0x39')]);_0x35e500[_0x5807('0x3a')]=qs['filters'](_[_0x5807('0x3b')](_0x58e9ab[_0x5807('0x30')],_0x4966fa[_0x5807('0x31')]),_0x5640ec);if(_0x58e9ab['query']['filter']){_0x35e500['where']=_['merge'](_0x35e500[_0x5807('0x3a')],{'$or':_[_0x5807('0x2a')](_0x5640ec,function(_0x22bf0b){if(_0x22bf0b[_0x5807('0x2e')]!==_0x5807('0x3c')){var _0x20daf2={};_0x20daf2[_0x22bf0b[_0x5807('0x28')]]={'$like':'%'+_0x58e9ab[_0x5807('0x30')][_0x5807('0x3d')]+'%'};return _0x20daf2;}})});}_0x35e500=_[_0x5807('0x3e')]({},_0x35e500,_0x58e9ab[_0x5807('0x3f')]);var _0x4cc2e2={'where':_0x35e500[_0x5807('0x3a')]};return db[_0x5807('0x2b')][_0x5807('0x20')](_0x4cc2e2)[_0x5807('0x26')](function(_0x2e572b){_0x347a08[_0x5807('0x20')]=_0x2e572b;if(_0x58e9ab[_0x5807('0x30')][_0x5807('0x40')]){_0x35e500[_0x5807('0x41')]=[{'all':!![]}];}return db['Migration'][_0x5807('0x42')](_0x35e500);})[_0x5807('0x26')](function(_0x484179){_0x347a08[_0x5807('0x43')]=_0x484179;return _0x347a08;})[_0x5807('0x26')](respondWithFilteredResult(_0x4c7550,_0x35e500))['catch'](handleError(_0x4c7550,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bda1c45..75e37ef 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 _0x7653=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash'];(function(_0xed945a,_0x5325a2){var _0x1fa223=function(_0x526891){while(--_0x526891){_0xed945a['push'](_0xed945a['shift']());}};_0x1fa223(++_0x5325a2);}(_0x7653,0x99));var _0x3765=function(_0x1ccda4,_0x1647d3){_0x1ccda4=_0x1ccda4-0x0;var _0x334196=_0x7653[_0x1ccda4];return _0x334196;};'use strict';var _=require(_0x3765('0x0'));var util=require(_0x3765('0x1'));var logger=require(_0x3765('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3765('0x3'));var rp=require(_0x3765('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3765('0x5'));var config=require(_0x3765('0x6'));var attributes=require(_0x3765('0x7'));module[_0x3765('0x8')]=function(_0x23065a,_0x1bb232){return _0x23065a[_0x3765('0x9')]('Migration',attributes,{'tableName':_0x3765('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68e6=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','migrations'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x68e6,0xd8));var _0x668e=function(_0x6be9d9,_0x153d7e){_0x6be9d9=_0x6be9d9-0x0;var _0x43858f=_0x68e6[_0x6be9d9];return _0x43858f;};'use strict';var _=require(_0x668e('0x0'));var util=require('util');var logger=require(_0x668e('0x1'))('api');var moment=require(_0x668e('0x2'));var BPromise=require(_0x668e('0x3'));var rp=require(_0x668e('0x4'));var fs=require('fs');var path=require(_0x668e('0x5'));var rimraf=require(_0x668e('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x668e('0x7')]=function(_0x312705,_0x502980){return _0x312705['define']('Migration',attributes,{'tableName':_0x668e('0x8'),'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 14322a0..2fa9bdc 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 _0xd52d=['jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1dc8f8,_0x1d5fb8){var _0x271cd0=function(_0x449fea){while(--_0x449fea){_0x1dc8f8['push'](_0x1dc8f8['shift']());}};_0x271cd0(++_0x1d5fb8);}(_0xd52d,0x1c7));var _0xdd52=function(_0x578a7b,_0x300916){_0x578a7b=_0x578a7b-0x0;var _0x37ee89=_0xd52d[_0x578a7b];return _0x37ee89;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file +var _0x18a5=['../../config/logger','rpc','../../config/environment','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x18a5,0x164));var _0x518a=function(_0x525ae0,_0x231536){_0x525ae0=_0x525ae0-0x0;var _0x49acd0=_0x18a5[_0x525ae0];return _0x49acd0;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x518a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518a('0x3'))['db'];var utils=require(_0x518a('0x4'));var logger=require(_0x518a('0x5'))(_0x518a('0x6'));var config=require(_0x518a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea311,_0x1d4199,_0x19a2df){return new BPromise(function(_0x2a5fa6,_0x8bd966){return client[_0x518a('0x8')](_0x2ea311,_0x19a2df)[_0x518a('0x9')](function(_0xb996c3){logger[_0x518a('0xa')](_0x518a('0xb'),_0x1d4199,_0x518a('0xc'));logger[_0x518a('0xd')](_0x518a('0xe'),_0x1d4199,_0x518a('0xc'),JSON[_0x518a('0xf')](_0xb996c3));if(_0xb996c3['error']){if(_0xb996c3[_0x518a('0x10')]['code']===0x1f4){logger[_0x518a('0x10')]('Migration,\x20%s,\x20%s',_0x1d4199,_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);return _0x8bd966(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}logger[_0x518a('0x10')](_0x518a('0xb'),_0x1d4199,_0xb996c3[_0x518a('0x10')]['message']);return _0x2a5fa6(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}else{logger[_0x518a('0xa')]('Migration,\x20%s,\x20%s',_0x1d4199,_0x518a('0xc'));_0x2a5fa6(_0xb996c3[_0x518a('0x12')]['message']);}})['catch'](function(_0x177882){logger['error'](_0x518a('0xb'),_0x1d4199,_0x177882);_0x8bd966(_0x177882);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5ef9d6f..af20615 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 _0xffb0=['create','update','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x36f3df,_0x2b1621){var _0xcfb7b7=function(_0xcc9fc0){while(--_0xcc9fc0){_0x36f3df['push'](_0x36f3df['shift']());}};_0xcfb7b7(++_0x2b1621);}(_0xffb0,0x1d5));var _0x0ffb=function(_0x25c4cc,_0x728f7a){_0x25c4cc=_0x25c4cc-0x0;var _0x1722fb=_0xffb0[_0x25c4cc];return _0x1722fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ffb('0x0'));var timeout=require('connect-timeout');var express=require(_0x0ffb('0x1'));var router=express[_0x0ffb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0ffb('0x3'));var interaction=require(_0x0ffb('0x4'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0x0ffb('0x5')]('/',auth[_0x0ffb('0x6')](),controller[_0x0ffb('0x7')]);router[_0x0ffb('0x5')](_0x0ffb('0x8'),auth['isAuthenticated'](),controller[_0x0ffb('0x9')]);router[_0x0ffb('0xa')]('/',auth[_0x0ffb('0x6')](),controller[_0x0ffb('0xb')]);router['put'](_0x0ffb('0x8'),auth[_0x0ffb('0x6')](),controller[_0x0ffb('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ffb('0xd')]);module[_0x0ffb('0xe')]=router; \ No newline at end of file +var _0x2eba=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','post','create'];(function(_0x6f1f57,_0x6510a4){var _0x51dcf9=function(_0x2770c4){while(--_0x2770c4){_0x6f1f57['push'](_0x6f1f57['shift']());}};_0x51dcf9(++_0x6510a4);}(_0x2eba,0xc7));var _0xa2eb=function(_0x40e00e,_0xe3ddfa){_0x40e00e=_0x40e00e-0x0;var _0x1050de=_0x2eba[_0x40e00e];return _0x1050de;};'use strict';var multer=require('multer');var util=require(_0xa2eb('0x0'));var path=require(_0xa2eb('0x1'));var timeout=require(_0xa2eb('0x2'));var express=require(_0xa2eb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa2eb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2eb('0x5'));var controller=require(_0xa2eb('0x6'));router[_0xa2eb('0x7')]('/',auth[_0xa2eb('0x8')](),controller['index']);router['get']('/:id',auth[_0xa2eb('0x8')](),controller['show']);router[_0xa2eb('0x9')]('/',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xa')]);router['put']('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xb')]);router[_0xa2eb('0xc')]('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0901d39..5ede717 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 _0x8e81=['exports','ENUM','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x3bfd87,_0x58cb29){var _0x530e21=function(_0xe35007){while(--_0xe35007){_0x3bfd87['push'](_0x3bfd87['shift']());}};_0x530e21(++_0x58cb29);}(_0x8e81,0xbf));var _0x18e8=function(_0x12f3a2,_0x4fd9a2){_0x12f3a2=_0x12f3a2-0x0;var _0x2fae20=_0x8e81[_0x12f3a2];return _0x2fae20;};'use strict';var Sequelize=require(_0x18e8('0x0'));module[_0x18e8('0x1')]={'type':{'type':Sequelize[_0x18e8('0x2')](_0x18e8('0x3'),_0x18e8('0x4'),_0x18e8('0x5'),_0x18e8('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x18e8('0x7')]},'password':{'type':Sequelize[_0x18e8('0x7')]}}; \ No newline at end of file +var _0x9af6=['ENUM','STRING'];(function(_0x465454,_0x11aa27){var _0x6c109a=function(_0x29d3e8){while(--_0x29d3e8){_0x465454['push'](_0x465454['shift']());}};_0x6c109a(++_0x11aa27);}(_0x9af6,0x14c));var _0x69af=function(_0x3a9349,_0x168219){_0x3a9349=_0x3a9349-0x0;var _0xc5a40=_0x9af6[_0x3a9349];return _0xc5a40;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x69af('0x0')]('localnet','externip','stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x69af('0x1')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 77d9c11..6753711 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 _0x9b0d=['api','../../mysqldb','client','then','info','Network,\x20%s,\x20%s,\x20%s','request\x20sent','code','Network,\x20%s,\x20%s','message','error','result','status','offset','undefined','limit','count','Content-Range','json','update','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','Network','include','findAll','catch','show','params','includeAll','options','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','toUpperCase','/etc/asterisk/stun_xcally.conf','path','ejs','lodash','../../components/parsers/qs','../../config/logger'];(function(_0x49eeeb,_0x169d6c){var _0x4c1998=function(_0xcbb88b){while(--_0xcbb88b){_0x49eeeb['push'](_0x49eeeb['shift']());}};_0x4c1998(++_0x169d6c);}(_0x9b0d,0x9d));var _0xd9b0=function(_0x3e5f83,_0x1e2852){_0x3e5f83=_0x3e5f83-0x0;var _0x25e817=_0x9b0d[_0x3e5f83];return _0x25e817;};'use strict';var util=require('util');var path=require(_0xd9b0('0x0'));var ejs=require(_0xd9b0('0x1'));var fs=require('fs');var _=require(_0xd9b0('0x2'));var qs=require(_0xd9b0('0x3'));var logger=require(_0xd9b0('0x4'))(_0xd9b0('0x5'));var config=require('../../config/environment');var db=require(_0xd9b0('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd9b0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3c71,_0x125f60,_0x3a6782,_0x3c9f7a){return new Promise(function(_0x572178,_0x30d304){var _0x38e9ea=_0x3c9f7a||client;return _0x38e9ea['request'](_0x4c3c71,_0x3a6782)[_0xd9b0('0x8')](function(_0x168273){logger[_0xd9b0('0x9')]('Network,\x20%s,\x20%s',_0x125f60,'request\x20sent');logger['debug'](_0xd9b0('0xa'),_0x125f60,_0xd9b0('0xb'),JSON['stringify'](_0x168273));if(_0x168273['error']){if(_0x168273['error'][_0xd9b0('0xc')]===0x1f4){logger['error'](_0xd9b0('0xd'),_0x125f60,_0x168273['error'][_0xd9b0('0xe')]);return _0x30d304(_0x168273[_0xd9b0('0xf')][_0xd9b0('0xe')]);}logger[_0xd9b0('0xf')](_0xd9b0('0xd'),_0x125f60,_0x168273[_0xd9b0('0xf')]['message']);return _0x572178(_0x168273[_0xd9b0('0xf')]['message']);}else{logger['info'](_0xd9b0('0xd'),_0x125f60,_0xd9b0('0xb'));_0x572178(_0x168273[_0xd9b0('0x10')]['message']);}})['catch'](function(_0x4f8c3b){logger[_0xd9b0('0xf')](_0xd9b0('0xd'),_0x125f60,_0x4f8c3b);_0x30d304(_0x4f8c3b);});});}function respondWithResult(_0x52a6e3,_0x4c2d33){_0x4c2d33=_0x4c2d33||0xc8;return function(_0x42993a){if(_0x42993a){return _0x52a6e3[_0xd9b0('0x11')](_0x4c2d33)['json'](_0x42993a);}};}function respondWithFilteredResult(_0x350fc7,_0x54cf0a){return function(_0x5627cb){if(_0x5627cb){var _0x212dd0=typeof _0x54cf0a[_0xd9b0('0x12')]===_0xd9b0('0x13')&&typeof _0x54cf0a[_0xd9b0('0x14')]===_0xd9b0('0x13');var _0x47611a=_0x5627cb[_0xd9b0('0x15')];var _0x4f0f39=_0x212dd0?0x0:_0x54cf0a[_0xd9b0('0x12')];var _0x4b6b3b=_0x212dd0?_0x5627cb[_0xd9b0('0x15')]:_0x54cf0a[_0xd9b0('0x12')]+_0x54cf0a[_0xd9b0('0x14')];var _0x5952dd;if(_0x4b6b3b>=_0x47611a){_0x4b6b3b=_0x47611a;_0x5952dd=0xc8;}else{_0x5952dd=0xce;}_0x350fc7[_0xd9b0('0x11')](_0x5952dd);return _0x350fc7['set'](_0xd9b0('0x16'),_0x4f0f39+'-'+_0x4b6b3b+'/'+_0x47611a)[_0xd9b0('0x17')](_0x5627cb);}return null;};}function saveUpdates(_0x4cd41e){return function(_0x390bf6){if(_0x390bf6){return _0x390bf6[_0xd9b0('0x18')](_0x4cd41e)['then'](function(_0x5ef0bd){return _0x5ef0bd;});}return null;};}function removeEntity(_0x19db4c){return function(_0x2962d1){if(_0x2962d1){return _0x2962d1[_0xd9b0('0x19')]()[_0xd9b0('0x8')](function(){_0x19db4c[_0xd9b0('0x11')](0xcc)[_0xd9b0('0x1a')]();});}};}function handleEntityNotFound(_0x5b6ab9){return function(_0x30a5c2){if(!_0x30a5c2){_0x5b6ab9[_0xd9b0('0x1b')](0x194);}return _0x30a5c2;};}function handleError(_0x28a241,_0x38156a){_0x38156a=_0x38156a||0x1f4;return function(_0x32ea31){logger[_0xd9b0('0xf')](_0x32ea31[_0xd9b0('0x1c')]);if(_0x32ea31[_0xd9b0('0x1d')]){delete _0x32ea31[_0xd9b0('0x1d')];}_0x28a241[_0xd9b0('0x11')](_0x38156a)['send'](_0x32ea31);};}exports[_0xd9b0('0x1e')]=function(_0x487f90,_0x2e3315){var _0x44e99b={},_0x83431b={},_0xfe190f={'count':0x0,'rows':[]};var _0x1bfe54=_[_0xd9b0('0x1f')](db['Network'][_0xd9b0('0x20')],function(_0x248359){return{'name':_0x248359[_0xd9b0('0x21')],'type':_0x248359[_0xd9b0('0x22')]['key']};});_0x83431b[_0xd9b0('0x23')]=_[_0xd9b0('0x1f')](_0x1bfe54,_0xd9b0('0x1d'));_0x83431b[_0xd9b0('0x24')]=_[_0xd9b0('0x25')](_0x487f90[_0xd9b0('0x24')]);_0x83431b['filters']=_[_0xd9b0('0x26')](_0x83431b[_0xd9b0('0x23')],_0x83431b[_0xd9b0('0x24')]);_0x44e99b[_0xd9b0('0x27')]=_['intersection'](_0x83431b['model'],qs[_0xd9b0('0x28')](_0x487f90[_0xd9b0('0x24')][_0xd9b0('0x28')]));_0x44e99b['attributes']=_0x44e99b[_0xd9b0('0x27')][_0xd9b0('0x29')]?_0x44e99b[_0xd9b0('0x27')]:_0x83431b[_0xd9b0('0x23')];if(!_0x487f90[_0xd9b0('0x24')][_0xd9b0('0x2a')](_0xd9b0('0x2b'))){_0x44e99b[_0xd9b0('0x14')]=qs[_0xd9b0('0x14')](_0x487f90['query'][_0xd9b0('0x14')]);_0x44e99b[_0xd9b0('0x12')]=qs['offset'](_0x487f90['query'][_0xd9b0('0x12')]);}_0x44e99b[_0xd9b0('0x2c')]=qs['sort'](_0x487f90[_0xd9b0('0x24')][_0xd9b0('0x2d')]);_0x44e99b[_0xd9b0('0x2e')]=qs['filters'](_['pick'](_0x487f90[_0xd9b0('0x24')],_0x83431b[_0xd9b0('0x2f')]),_0x1bfe54);if(_0x487f90[_0xd9b0('0x24')]['filter']){_0x44e99b[_0xd9b0('0x2e')]=_[_0xd9b0('0x30')](_0x44e99b['where'],{'$or':_[_0xd9b0('0x1f')](_0x1bfe54,function(_0xd054f3){if(_0xd054f3[_0xd9b0('0x22')]!==_0xd9b0('0x31')){var _0x54b99a={};_0x54b99a[_0xd054f3[_0xd9b0('0x1d')]]={'$like':'%'+_0x487f90[_0xd9b0('0x24')]['filter']+'%'};return _0x54b99a;}})});}_0x44e99b=_[_0xd9b0('0x30')]({},_0x44e99b,_0x487f90['options']);var _0x19486e={'where':_0x44e99b[_0xd9b0('0x2e')]};return db[_0xd9b0('0x32')][_0xd9b0('0x15')](_0x19486e)[_0xd9b0('0x8')](function(_0x557477){_0xfe190f['count']=_0x557477;if(_0x487f90[_0xd9b0('0x24')]['includeAll']){_0x44e99b[_0xd9b0('0x33')]=[{'all':!![]}];}return db[_0xd9b0('0x32')][_0xd9b0('0x34')](_0x44e99b);})[_0xd9b0('0x8')](function(_0x3ad5f4){_0xfe190f['rows']=_0x3ad5f4;return _0xfe190f;})[_0xd9b0('0x8')](respondWithFilteredResult(_0x2e3315,_0x44e99b))[_0xd9b0('0x35')](handleError(_0x2e3315,null));};exports[_0xd9b0('0x36')]=function(_0x51907c,_0x58f6a4){var _0x2a6ce7={'raw':!![],'where':{'id':_0x51907c[_0xd9b0('0x37')]['id']}},_0x56db25={};_0x56db25['model']=_[_0xd9b0('0x25')](db[_0xd9b0('0x32')][_0xd9b0('0x20')]);_0x56db25[_0xd9b0('0x24')]=_[_0xd9b0('0x25')](_0x51907c['query']);_0x56db25[_0xd9b0('0x2f')]=_[_0xd9b0('0x26')](_0x56db25[_0xd9b0('0x23')],_0x56db25['query']);_0x2a6ce7['attributes']=_[_0xd9b0('0x26')](_0x56db25[_0xd9b0('0x23')],qs['fields'](_0x51907c['query'][_0xd9b0('0x28')]));_0x2a6ce7[_0xd9b0('0x27')]=_0x2a6ce7[_0xd9b0('0x27')][_0xd9b0('0x29')]?_0x2a6ce7['attributes']:_0x56db25[_0xd9b0('0x23')];if(_0x51907c[_0xd9b0('0x24')][_0xd9b0('0x38')]){_0x2a6ce7['include']=[{'all':!![]}];}_0x2a6ce7=_[_0xd9b0('0x30')]({},_0x2a6ce7,_0x51907c[_0xd9b0('0x39')]);return db['Network'][_0xd9b0('0x3a')](_0x2a6ce7)[_0xd9b0('0x8')](handleEntityNotFound(_0x58f6a4,null))[_0xd9b0('0x8')](respondWithResult(_0x58f6a4,null))['catch'](handleError(_0x58f6a4,null));};exports[_0xd9b0('0x3b')]=function(_0x1b0b81,_0x5d1f89){var _0x43ca9a;return db[_0xd9b0('0x32')][_0xd9b0('0x3b')](_0x1b0b81[_0xd9b0('0x3c')],{'raw':!![]})[_0xd9b0('0x8')](function(_0x4f85b6){_0x43ca9a=_0x4f85b6;return db[_0xd9b0('0x32')][_0xd9b0('0x34')]({'where':{'type':_0x1b0b81['body']['type']},'raw':!![]});})[_0xd9b0('0x8')](function(_0x44262d){if(_0x43ca9a[_0xd9b0('0x22')]['toUpperCase']()==_0xd9b0('0x3d')){var _0x16afb6=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x41')),_0xd9b0('0x42'));var _0xe60b91=ejs['render'](_0x16afb6,{'networks':_0x44262d||[]});fs[_0xd9b0('0x43')]('/etc/asterisk/stun_xcally.conf',_0xe60b91);return respondWithRpcPromise(_0xd9b0('0x44'),_0xd9b0('0x3b'),{'module':'res_stun_monitor.so'});}else if(_0x43ca9a[_0xd9b0('0x22')]['toUpperCase']()==_0xd9b0('0x45')){var _0x23093c=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x46')),'utf8');var _0x1e9878=ejs[_0xd9b0('0x47')](_0x23093c,{'networks':_0x44262d||[]});fs['writeFileSync'](_0xd9b0('0x48'),_0x1e9878);return respondWithRpcPromise(_0xd9b0('0x44'),_0xd9b0('0x3b'),{'module':_0xd9b0('0x49')});}else{var _0x5ec20c=fs[_0xd9b0('0x3e')](path['join'](config[_0xd9b0('0x40')],_0xd9b0('0x4a')),_0xd9b0('0x42'));var _0x2cd60a=ejs[_0xd9b0('0x47')](_0x5ec20c,{'networks':_0x44262d||[]});fs[_0xd9b0('0x43')](util[_0xd9b0('0x4b')](_0xd9b0('0x4c'),_0x1b0b81[_0xd9b0('0x3c')][_0xd9b0('0x22')][_0xd9b0('0x4d')]()),_0x2cd60a);return respondWithRpcPromise(_0xd9b0('0x44'),'create',{'module':_0xd9b0('0x4e')});}})['then'](function(){return _0x43ca9a;})['then'](respondWithResult(_0x5d1f89,0xc9))[_0xd9b0('0x35')](handleError(_0x5d1f89,null));};exports['update']=function(_0x5d2ff7,_0xedcd7c){var _0x1257dd;return db[_0xd9b0('0x32')]['find']({'where':{'id':_0x5d2ff7[_0xd9b0('0x37')]['id']}})[_0xd9b0('0x8')](handleEntityNotFound(_0xedcd7c,null))[_0xd9b0('0x8')](saveUpdates(_0x5d2ff7[_0xd9b0('0x3c')],null))['then'](function(_0x42f4ea){if(_0x42f4ea){_0x1257dd=_0x42f4ea;return db['Network']['findAll']({'where':{'type':_0x1257dd[_0xd9b0('0x22')]},'raw':!![]});}return null;})[_0xd9b0('0x8')](function(_0x1c4e00){if(_0x1257dd[_0xd9b0('0x22')][_0xd9b0('0x4f')]()==_0xd9b0('0x3d')){var _0xd9b726=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],'server/files/templates/stun_multiple.ejs'),_0xd9b0('0x42'));var _0x543db1=ejs[_0xd9b0('0x47')](_0xd9b726,{'networks':_0x1c4e00||[]});fs['writeFileSync'](_0xd9b0('0x50'),_0x543db1);return respondWithRpcPromise(_0xd9b0('0x44'),'update',{'module':'res_stun_monitor.so'});}else if(_0x1257dd[_0xd9b0('0x22')][_0xd9b0('0x4f')]()==_0xd9b0('0x45')){var _0x2e24e6=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x46')),_0xd9b0('0x42'));var _0x5e8097=ejs['render'](_0x2e24e6,{'networks':_0x1c4e00||[]});fs['writeFileSync'](_0xd9b0('0x48'),_0x5e8097);return respondWithRpcPromise(_0xd9b0('0x44'),_0xd9b0('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x302162=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x4a')),_0xd9b0('0x42'));var _0x521774=ejs['render'](_0x302162,{'networks':_0x1c4e00||[]});fs[_0xd9b0('0x43')](util[_0xd9b0('0x4b')](_0xd9b0('0x4c'),_0x5d2ff7[_0xd9b0('0x3c')][_0xd9b0('0x22')]['toLowerCase']()),_0x521774);return respondWithRpcPromise('Reload','update',{'module':_0xd9b0('0x4e')});}})[_0xd9b0('0x8')](function(_0xaa866a){if(_0xaa866a){return _0x1257dd;}return null;})[_0xd9b0('0x8')](respondWithResult(_0xedcd7c,null))[_0xd9b0('0x35')](handleError(_0xedcd7c,null));};exports[_0xd9b0('0x19')]=function(_0x29be8c,_0x16dd34){var _0x40c11c;return db[_0xd9b0('0x32')][_0xd9b0('0x3a')]({'where':{'id':_0x29be8c[_0xd9b0('0x37')]['id']}})['then'](function(_0x1bd456){_0x40c11c=_0x1bd456;return _0x1bd456;})[_0xd9b0('0x8')](handleEntityNotFound(_0x16dd34,null))[_0xd9b0('0x8')](removeEntity(_0x16dd34,null))[_0xd9b0('0x8')](function(){if(_0x40c11c){return db[_0xd9b0('0x32')][_0xd9b0('0x34')]({'where':{'type':_0x40c11c[_0xd9b0('0x22')]},'raw':!![]});}})['then'](function(_0x24c5a1){if(_0x40c11c['type'][_0xd9b0('0x4f')]()==_0xd9b0('0x3d')){var _0x270704=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x41')),_0xd9b0('0x42'));var _0x3057e1=ejs[_0xd9b0('0x47')](_0x270704,{'networks':_0x24c5a1||[]});fs[_0xd9b0('0x43')](_0xd9b0('0x50'),_0x3057e1);return respondWithRpcPromise(_0xd9b0('0x44'),_0xd9b0('0x19'),{'module':_0xd9b0('0x49')});}else if(_0x40c11c[_0xd9b0('0x22')]['toUpperCase']()==_0xd9b0('0x45')){var _0x2886b3=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],_0xd9b0('0x46')),_0xd9b0('0x42'));var _0x57a4c2=ejs['render'](_0x2886b3,{'networks':_0x24c5a1||[]});fs[_0xd9b0('0x43')](_0xd9b0('0x48'),_0x57a4c2);return respondWithRpcPromise(_0xd9b0('0x44'),_0xd9b0('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x8c4527=fs[_0xd9b0('0x3e')](path[_0xd9b0('0x3f')](config[_0xd9b0('0x40')],'server/files/templates/network.ejs'),_0xd9b0('0x42'));var _0x531d96=ejs[_0xd9b0('0x47')](_0x8c4527,{'networks':_0x24c5a1||[]});fs[_0xd9b0('0x43')](util[_0xd9b0('0x4b')](_0xd9b0('0x4c'),_0x40c11c[_0xd9b0('0x22')][_0xd9b0('0x4d')]()),_0x531d96);return respondWithRpcPromise('Reload','destroy',{'module':_0xd9b0('0x4e')});}})[_0xd9b0('0x35')](handleError(_0x16dd34,null));}; \ No newline at end of file +var _0xbccd=['intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','keys','options','find','create','body','type','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','STUN','/etc/asterisk/stun_xcally.conf','TURN','catch','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','status','json','offset','undefined','limit','count','set','Content-Range','destroy','sendStatus','stack','name','send','index','map','Network','fieldName','key','model','query'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xbccd,0x12d));var _0xdbcc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xbccd[_0x5608a3];return _0x1ed50a;};'use strict';var util=require(_0xdbcc('0x0'));var path=require(_0xdbcc('0x1'));var ejs=require(_0xdbcc('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xdbcc('0x3'));var logger=require(_0xdbcc('0x4'))('api');var config=require(_0xdbcc('0x5'));var db=require(_0xdbcc('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xdbcc('0x7')][_0xdbcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29a152,_0x5aacca,_0x52867e,_0x57b751){return new Promise(function(_0x383a27,_0x3ea0aa){var _0x1fed2d=_0x57b751||client;return _0x1fed2d[_0xdbcc('0x9')](_0x29a152,_0x52867e)[_0xdbcc('0xa')](function(_0x31c228){logger['info'](_0xdbcc('0xb'),_0x5aacca,_0xdbcc('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5aacca,_0xdbcc('0xc'),JSON[_0xdbcc('0xd')](_0x31c228));if(_0x31c228[_0xdbcc('0xe')]){if(_0x31c228[_0xdbcc('0xe')][_0xdbcc('0xf')]===0x1f4){logger[_0xdbcc('0xe')](_0xdbcc('0xb'),_0x5aacca,_0x31c228[_0xdbcc('0xe')]['message']);return _0x3ea0aa(_0x31c228[_0xdbcc('0xe')]['message']);}logger['error'](_0xdbcc('0xb'),_0x5aacca,_0x31c228[_0xdbcc('0xe')][_0xdbcc('0x10')]);return _0x383a27(_0x31c228[_0xdbcc('0xe')][_0xdbcc('0x10')]);}else{logger[_0xdbcc('0x11')](_0xdbcc('0xb'),_0x5aacca,'request\x20sent');_0x383a27(_0x31c228[_0xdbcc('0x12')]['message']);}})['catch'](function(_0xf66e6b){logger[_0xdbcc('0xe')](_0xdbcc('0xb'),_0x5aacca,_0xf66e6b);_0x3ea0aa(_0xf66e6b);});});}function respondWithResult(_0x56e685,_0x3fee56){_0x3fee56=_0x3fee56||0xc8;return function(_0x3ee817){if(_0x3ee817){return _0x56e685[_0xdbcc('0x13')](_0x3fee56)[_0xdbcc('0x14')](_0x3ee817);}};}function respondWithFilteredResult(_0x363f69,_0x183738){return function(_0x2ea0d1){if(_0x2ea0d1){var _0x2afe60=typeof _0x183738[_0xdbcc('0x15')]===_0xdbcc('0x16')&&typeof _0x183738[_0xdbcc('0x17')]===_0xdbcc('0x16');var _0x30e2ba=_0x2ea0d1[_0xdbcc('0x18')];var _0x18e072=_0x2afe60?0x0:_0x183738[_0xdbcc('0x15')];var _0x29172d=_0x2afe60?_0x2ea0d1[_0xdbcc('0x18')]:_0x183738[_0xdbcc('0x15')]+_0x183738['limit'];var _0x1ff805;if(_0x29172d>=_0x30e2ba){_0x29172d=_0x30e2ba;_0x1ff805=0xc8;}else{_0x1ff805=0xce;}_0x363f69[_0xdbcc('0x13')](_0x1ff805);return _0x363f69[_0xdbcc('0x19')](_0xdbcc('0x1a'),_0x18e072+'-'+_0x29172d+'/'+_0x30e2ba)['json'](_0x2ea0d1);}return null;};}function saveUpdates(_0x379ff9){return function(_0x53c642){if(_0x53c642){return _0x53c642['update'](_0x379ff9)['then'](function(_0x4936b3){return _0x4936b3;});}return null;};}function removeEntity(_0x31a000){return function(_0x2130a3){if(_0x2130a3){return _0x2130a3[_0xdbcc('0x1b')]()[_0xdbcc('0xa')](function(){_0x31a000[_0xdbcc('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212245){return function(_0x15c646){if(!_0x15c646){_0x212245[_0xdbcc('0x1c')](0x194);}return _0x15c646;};}function handleError(_0x4be80a,_0x3f382b){_0x3f382b=_0x3f382b||0x1f4;return function(_0x141e9d){logger['error'](_0x141e9d[_0xdbcc('0x1d')]);if(_0x141e9d[_0xdbcc('0x1e')]){delete _0x141e9d['name'];}_0x4be80a[_0xdbcc('0x13')](_0x3f382b)[_0xdbcc('0x1f')](_0x141e9d);};}exports[_0xdbcc('0x20')]=function(_0x2c6c9c,_0x5903c7){var _0x544fe={},_0x3aec8c={},_0x3326ad={'count':0x0,'rows':[]};var _0x117de3=_[_0xdbcc('0x21')](db[_0xdbcc('0x22')]['rawAttributes'],function(_0x20a319){return{'name':_0x20a319[_0xdbcc('0x23')],'type':_0x20a319['type'][_0xdbcc('0x24')]};});_0x3aec8c[_0xdbcc('0x25')]=_[_0xdbcc('0x21')](_0x117de3,_0xdbcc('0x1e'));_0x3aec8c['query']=_['keys'](_0x2c6c9c[_0xdbcc('0x26')]);_0x3aec8c['filters']=_[_0xdbcc('0x27')](_0x3aec8c['model'],_0x3aec8c[_0xdbcc('0x26')]);_0x544fe['attributes']=_[_0xdbcc('0x27')](_0x3aec8c[_0xdbcc('0x25')],qs[_0xdbcc('0x28')](_0x2c6c9c[_0xdbcc('0x26')][_0xdbcc('0x28')]));_0x544fe[_0xdbcc('0x29')]=_0x544fe[_0xdbcc('0x29')][_0xdbcc('0x2a')]?_0x544fe[_0xdbcc('0x29')]:_0x3aec8c['model'];if(!_0x2c6c9c[_0xdbcc('0x26')][_0xdbcc('0x2b')]('nolimit')){_0x544fe[_0xdbcc('0x17')]=qs[_0xdbcc('0x17')](_0x2c6c9c[_0xdbcc('0x26')]['limit']);_0x544fe[_0xdbcc('0x15')]=qs['offset'](_0x2c6c9c[_0xdbcc('0x26')]['offset']);}_0x544fe['order']=qs[_0xdbcc('0x2c')](_0x2c6c9c['query']['sort']);_0x544fe[_0xdbcc('0x2d')]=qs[_0xdbcc('0x2e')](_[_0xdbcc('0x2f')](_0x2c6c9c[_0xdbcc('0x26')],_0x3aec8c['filters']),_0x117de3);if(_0x2c6c9c['query']['filter']){_0x544fe[_0xdbcc('0x2d')]=_[_0xdbcc('0x30')](_0x544fe[_0xdbcc('0x2d')],{'$or':_['map'](_0x117de3,function(_0x3edb6f){if(_0x3edb6f['type']!==_0xdbcc('0x31')){var _0x9644b1={};_0x9644b1[_0x3edb6f[_0xdbcc('0x1e')]]={'$like':'%'+_0x2c6c9c[_0xdbcc('0x26')]['filter']+'%'};return _0x9644b1;}})});}_0x544fe=_[_0xdbcc('0x30')]({},_0x544fe,_0x2c6c9c['options']);var _0x18ecf0={'where':_0x544fe['where']};return db['Network'][_0xdbcc('0x18')](_0x18ecf0)['then'](function(_0x557618){_0x3326ad['count']=_0x557618;if(_0x2c6c9c[_0xdbcc('0x26')][_0xdbcc('0x32')]){_0x544fe[_0xdbcc('0x33')]=[{'all':!![]}];}return db[_0xdbcc('0x22')][_0xdbcc('0x34')](_0x544fe);})[_0xdbcc('0xa')](function(_0x3d7643){_0x3326ad[_0xdbcc('0x35')]=_0x3d7643;return _0x3326ad;})[_0xdbcc('0xa')](respondWithFilteredResult(_0x5903c7,_0x544fe))['catch'](handleError(_0x5903c7,null));};exports[_0xdbcc('0x36')]=function(_0x5ba141,_0x3c710e){var _0x3b88e3={'raw':!![],'where':{'id':_0x5ba141[_0xdbcc('0x37')]['id']}},_0x161a13={};_0x161a13[_0xdbcc('0x25')]=_['keys'](db['Network'][_0xdbcc('0x38')]);_0x161a13['query']=_[_0xdbcc('0x39')](_0x5ba141['query']);_0x161a13['filters']=_[_0xdbcc('0x27')](_0x161a13[_0xdbcc('0x25')],_0x161a13[_0xdbcc('0x26')]);_0x3b88e3[_0xdbcc('0x29')]=_['intersection'](_0x161a13['model'],qs[_0xdbcc('0x28')](_0x5ba141[_0xdbcc('0x26')]['fields']));_0x3b88e3[_0xdbcc('0x29')]=_0x3b88e3[_0xdbcc('0x29')][_0xdbcc('0x2a')]?_0x3b88e3[_0xdbcc('0x29')]:_0x161a13[_0xdbcc('0x25')];if(_0x5ba141['query']['includeAll']){_0x3b88e3[_0xdbcc('0x33')]=[{'all':!![]}];}_0x3b88e3=_[_0xdbcc('0x30')]({},_0x3b88e3,_0x5ba141[_0xdbcc('0x3a')]);return db[_0xdbcc('0x22')][_0xdbcc('0x3b')](_0x3b88e3)[_0xdbcc('0xa')](handleEntityNotFound(_0x3c710e,null))['then'](respondWithResult(_0x3c710e,null))['catch'](handleError(_0x3c710e,null));};exports[_0xdbcc('0x3c')]=function(_0x178bc3,_0x5821a9){var _0x21ffd9;return db['Network'][_0xdbcc('0x3c')](_0x178bc3[_0xdbcc('0x3d')],{'raw':!![]})[_0xdbcc('0xa')](function(_0x3b2499){_0x21ffd9=_0x3b2499;return db['Network'][_0xdbcc('0x34')]({'where':{'type':_0x178bc3[_0xdbcc('0x3d')][_0xdbcc('0x3e')]},'raw':!![]});})[_0xdbcc('0xa')](function(_0x2d9b25){if(_0x21ffd9['type'][_0xdbcc('0x3f')]()=='STUN'){var _0x11f8cf=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],_0xdbcc('0x43')),_0xdbcc('0x44'));var _0x15ce83=ejs[_0xdbcc('0x45')](_0x11f8cf,{'networks':_0x2d9b25||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x15ce83);return respondWithRpcPromise(_0xdbcc('0x46'),'create',{'module':_0xdbcc('0x47')});}else if(_0x21ffd9[_0xdbcc('0x3e')][_0xdbcc('0x3f')]()=='TURN'){var _0x24e32a=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],_0xdbcc('0x48')),_0xdbcc('0x44'));var _0x307348=ejs[_0xdbcc('0x45')](_0x24e32a,{'networks':_0x2d9b25||[]});fs[_0xdbcc('0x49')](_0xdbcc('0x4a'),_0x307348);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x3c'),{'module':_0xdbcc('0x47')});}else{var _0x4302b0=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config['root'],_0xdbcc('0x4b')),_0xdbcc('0x44'));var _0xf15ce0=ejs['render'](_0x4302b0,{'networks':_0x2d9b25||[]});fs[_0xdbcc('0x49')](util[_0xdbcc('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x178bc3[_0xdbcc('0x3d')][_0xdbcc('0x3e')][_0xdbcc('0x4d')]()),_0xf15ce0);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x3c'),{'module':_0xdbcc('0x4e')});}})[_0xdbcc('0xa')](function(){return _0x21ffd9;})[_0xdbcc('0xa')](respondWithResult(_0x5821a9,0xc9))['catch'](handleError(_0x5821a9,null));};exports[_0xdbcc('0x4f')]=function(_0xb6ca24,_0x196cea){var _0xb6c30d;return db['Network'][_0xdbcc('0x3b')]({'where':{'id':_0xb6ca24[_0xdbcc('0x37')]['id']}})['then'](handleEntityNotFound(_0x196cea,null))[_0xdbcc('0xa')](saveUpdates(_0xb6ca24[_0xdbcc('0x3d')],null))[_0xdbcc('0xa')](function(_0x458539){if(_0x458539){_0xb6c30d=_0x458539;return db[_0xdbcc('0x22')][_0xdbcc('0x34')]({'where':{'type':_0xb6c30d[_0xdbcc('0x3e')]},'raw':!![]});}return null;})[_0xdbcc('0xa')](function(_0x1e65dd){if(_0xb6c30d[_0xdbcc('0x3e')][_0xdbcc('0x3f')]()==_0xdbcc('0x50')){var _0x18f7ea=fs[_0xdbcc('0x40')](path['join'](config[_0xdbcc('0x42')],'server/files/templates/stun_multiple.ejs'),_0xdbcc('0x44'));var _0x4eb923=ejs[_0xdbcc('0x45')](_0x18f7ea,{'networks':_0x1e65dd||[]});fs[_0xdbcc('0x49')](_0xdbcc('0x51'),_0x4eb923);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x4f'),{'module':_0xdbcc('0x47')});}else if(_0xb6c30d[_0xdbcc('0x3e')][_0xdbcc('0x3f')]()==_0xdbcc('0x52')){var _0x52ea92=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],_0xdbcc('0x48')),_0xdbcc('0x44'));var _0x13e2d4=ejs[_0xdbcc('0x45')](_0x52ea92,{'networks':_0x1e65dd||[]});fs[_0xdbcc('0x49')](_0xdbcc('0x4a'),_0x13e2d4);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x4f'),{'module':_0xdbcc('0x47')});}else{var _0x15d501=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],_0xdbcc('0x4b')),'utf8');var _0x2873c6=ejs['render'](_0x15d501,{'networks':_0x1e65dd||[]});fs[_0xdbcc('0x49')](util[_0xdbcc('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0xb6ca24[_0xdbcc('0x3d')][_0xdbcc('0x3e')][_0xdbcc('0x4d')]()),_0x2873c6);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x4f'),{'module':_0xdbcc('0x4e')});}})[_0xdbcc('0xa')](function(_0x54afc9){if(_0x54afc9){return _0xb6c30d;}return null;})['then'](respondWithResult(_0x196cea,null))[_0xdbcc('0x53')](handleError(_0x196cea,null));};exports[_0xdbcc('0x1b')]=function(_0x30392f,_0x2e1197){var _0x325752;return db[_0xdbcc('0x22')]['find']({'where':{'id':_0x30392f[_0xdbcc('0x37')]['id']}})[_0xdbcc('0xa')](function(_0x1021f7){_0x325752=_0x1021f7;return _0x1021f7;})[_0xdbcc('0xa')](handleEntityNotFound(_0x2e1197,null))[_0xdbcc('0xa')](removeEntity(_0x2e1197,null))[_0xdbcc('0xa')](function(){if(_0x325752){return db[_0xdbcc('0x22')][_0xdbcc('0x34')]({'where':{'type':_0x325752[_0xdbcc('0x3e')]},'raw':!![]});}})[_0xdbcc('0xa')](function(_0x45260e){if(_0x325752[_0xdbcc('0x3e')][_0xdbcc('0x3f')]()==_0xdbcc('0x50')){var _0x2f9b48=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4f59f6=ejs[_0xdbcc('0x45')](_0x2f9b48,{'networks':_0x45260e||[]});fs[_0xdbcc('0x49')](_0xdbcc('0x51'),_0x4f59f6);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x1b'),{'module':_0xdbcc('0x47')});}else if(_0x325752[_0xdbcc('0x3e')]['toUpperCase']()==_0xdbcc('0x52')){var _0x115993=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x489f9b=ejs[_0xdbcc('0x45')](_0x115993,{'networks':_0x45260e||[]});fs[_0xdbcc('0x49')](_0xdbcc('0x4a'),_0x489f9b);return respondWithRpcPromise(_0xdbcc('0x46'),_0xdbcc('0x1b'),{'module':_0xdbcc('0x47')});}else{var _0x4b6122=fs[_0xdbcc('0x40')](path[_0xdbcc('0x41')](config[_0xdbcc('0x42')],_0xdbcc('0x4b')),_0xdbcc('0x44'));var _0x97a7af=ejs[_0xdbcc('0x45')](_0x4b6122,{'networks':_0x45260e||[]});fs[_0xdbcc('0x49')](util[_0xdbcc('0x4c')](_0xdbcc('0x54'),_0x325752[_0xdbcc('0x3e')]['toLowerCase']()),_0x97a7af);return respondWithRpcPromise(_0xdbcc('0x46'),'destroy',{'module':_0xdbcc('0x4e')});}})[_0xdbcc('0x53')](handleError(_0x2e1197,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1a1544a..4e337fb 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 _0x9e0d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x356cae,_0x53ac9b){_0x356cae=_0x356cae-0x0;var _0x53eee8=_0x9e0d[_0x356cae];return _0x53eee8;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var logger=require(_0xd9e0('0x2'))(_0xd9e0('0x3'));var moment=require('moment');var BPromise=require(_0xd9e0('0x4'));var rp=require(_0xd9e0('0x5'));var fs=require('fs');var path=require(_0xd9e0('0x6'));var rimraf=require(_0xd9e0('0x7'));var config=require(_0xd9e0('0x8'));var attributes=require(_0xd9e0('0x9'));module['exports']=function(_0x570a07,_0x22e726){return _0x570a07[_0xd9e0('0xa')](_0xd9e0('0xb'),attributes,{'tableName':_0xd9e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68fc=['bluebird','path','./network.attributes','exports','network','lodash','util','../../config/logger'];(function(_0x266b5c,_0x72f5e){var _0x37230e=function(_0x10de68){while(--_0x10de68){_0x266b5c['push'](_0x266b5c['shift']());}};_0x37230e(++_0x72f5e);}(_0x68fc,0xa5));var _0xc68f=function(_0x3c6825,_0x2e721e){_0x3c6825=_0x3c6825-0x0;var _0x32a228=_0x68fc[_0x3c6825];return _0x32a228;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('Network',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ebd29d0..f4c815c 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(_0x590a7b,_0x1e6aaf){var _0x4910a0=function(_0x7e9828){while(--_0x7e9828){_0x590a7b['push'](_0x590a7b['shift']());}};_0x4910a0(++_0x1e6aaf);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x18783f,_0x8bf9d3){_0x18783f=_0x18783f-0x0;var _0x38b6e5=_0x7a54[_0x18783f];return _0x38b6e5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index bd01931..7c52bea 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 _0x9c04=['/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/applications','getApplications'];(function(_0x2fca9d,_0x1acd79){var _0x3cb2e9=function(_0x2d5289){while(--_0x2d5289){_0x2fca9d['push'](_0x2fca9d['shift']());}};_0x3cb2e9(++_0x1acd79);}(_0x9c04,0xa5));var _0x49c0=function(_0x443f02,_0x291639){_0x443f02=_0x443f02-0x0;var _0x1f4f12=_0x9c04[_0x443f02];return _0x1f4f12;};'use strict';var multer=require(_0x49c0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x49c0('0x1'));var router=express[_0x49c0('0x2')]();var fs_extra=require(_0x49c0('0x3'));var auth=require(_0x49c0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x49c0('0x5')]('/',auth[_0x49c0('0x6')](),controller[_0x49c0('0x7')]);router[_0x49c0('0x5')](_0x49c0('0x8'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x9')]);router[_0x49c0('0x5')](_0x49c0('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x49c0('0x5')](_0x49c0('0xb'),auth[_0x49c0('0x6')](),controller[_0x49c0('0xc')]);router[_0x49c0('0x5')]('/:id/canned_answers',auth[_0x49c0('0x6')](),controller['getAnswers']);router[_0x49c0('0x5')](_0x49c0('0xd'),auth['isAuthenticated'](),controller[_0x49c0('0xe')]);router[_0x49c0('0x5')](_0x49c0('0xf'),auth['isAuthenticated'](),controller[_0x49c0('0x10')]);router[_0x49c0('0x5')](_0x49c0('0x11'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x12')]);router['post']('/',auth[_0x49c0('0x6')](),controller[_0x49c0('0x13')]);router[_0x49c0('0x14')](_0x49c0('0xb'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x15')]);router[_0x49c0('0x14')](_0x49c0('0x16'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x17')]);router[_0x49c0('0x14')](_0x49c0('0x18'),controller[_0x49c0('0x19')]);router['post']('/:id/applications',auth[_0x49c0('0x6')](),controller[_0x49c0('0x1a')]);router[_0x49c0('0x14')](_0x49c0('0x11'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x1b')]);router[_0x49c0('0x14')](_0x49c0('0x1c'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x1d')]);router[_0x49c0('0x1e')](_0x49c0('0xa'),auth[_0x49c0('0x6')](),controller[_0x49c0('0x1f')]);router[_0x49c0('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x49c0('0x21')]);router[_0x49c0('0x20')](_0x49c0('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x49c0('0x20')](_0x49c0('0x16'),auth['isAuthenticated'](),controller[_0x49c0('0x22')]);router['delete'](_0x49c0('0x11'),auth[_0x49c0('0x6')](),controller['removeAgents']);module[_0x49c0('0x23')]=router; \ No newline at end of file +var _0x308f=['removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/users','getAgents','post','addDisposition','/:id/notify','/:id/applications','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions'];(function(_0x5ca72b,_0x22f81d){var _0x54c53e=function(_0x3dda88){while(--_0x3dda88){_0x5ca72b['push'](_0x5ca72b['shift']());}};_0x54c53e(++_0x22f81d);}(_0x308f,0x106));var _0xf308=function(_0x1e4da7,_0x3c885e){_0x1e4da7=_0x1e4da7-0x0;var _0x4e72bd=_0x308f[_0x1e4da7];return _0x4e72bd;};'use strict';var multer=require(_0xf308('0x0'));var util=require('util');var path=require(_0xf308('0x1'));var timeout=require(_0xf308('0x2'));var express=require(_0xf308('0x3'));var router=express[_0xf308('0x4')]();var fs_extra=require(_0xf308('0x5'));var auth=require(_0xf308('0x6'));var interaction=require(_0xf308('0x7'));var config=require(_0xf308('0x8'));var controller=require(_0xf308('0x9'));router[_0xf308('0xa')]('/',auth[_0xf308('0xb')](),controller[_0xf308('0xc')]);router[_0xf308('0xa')]('/describe',auth[_0xf308('0xb')](),controller[_0xf308('0xd')]);router[_0xf308('0xa')](_0xf308('0xe'),auth[_0xf308('0xb')](),controller[_0xf308('0xf')]);router[_0xf308('0xa')](_0xf308('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xf308('0x11'),auth[_0xf308('0xb')](),controller[_0xf308('0x12')]);router['get']('/:id/applications',auth[_0xf308('0xb')](),controller['getApplications']);router[_0xf308('0xa')](_0xf308('0x13'),auth[_0xf308('0xb')](),controller['getInteractions']);router['get'](_0xf308('0x14'),auth['isAuthenticated'](),controller[_0xf308('0x15')]);router[_0xf308('0x16')]('/',auth[_0xf308('0xb')](),controller['create']);router[_0xf308('0x16')](_0xf308('0x10'),auth[_0xf308('0xb')](),controller[_0xf308('0x17')]);router[_0xf308('0x16')]('/:id/canned_answers',auth[_0xf308('0xb')](),controller['addAnswer']);router['post'](_0xf308('0x18'),controller['notify']);router[_0xf308('0x16')](_0xf308('0x19'),auth[_0xf308('0xb')](),controller[_0xf308('0x1a')]);router[_0xf308('0x16')](_0xf308('0x14'),auth['isAuthenticated'](),controller[_0xf308('0x1b')]);router[_0xf308('0x16')]('/:id/send',auth[_0xf308('0xb')](),controller[_0xf308('0x1c')]);router[_0xf308('0x1d')](_0xf308('0xe'),auth['isAuthenticated'](),controller[_0xf308('0x1e')]);router[_0xf308('0x1f')](_0xf308('0xe'),auth[_0xf308('0xb')](),controller[_0xf308('0x20')]);router[_0xf308('0x1f')](_0xf308('0x10'),auth['isAuthenticated'](),controller[_0xf308('0x21')]);router[_0xf308('0x1f')](_0xf308('0x11'),auth[_0xf308('0xb')](),controller[_0xf308('0x22')]);router[_0xf308('0x1f')](_0xf308('0x14'),auth[_0xf308('0xb')](),controller[_0xf308('0x23')]);module[_0xf308('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e3fd962..d3777be 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 _0x04b7=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x19fb15,_0x57951f){var _0x439a33=function(_0x3172a2){while(--_0x3172a2){_0x19fb15['push'](_0x19fb15['shift']());}};_0x439a33(++_0x57951f);}(_0x04b7,0x6e));var _0x704b=function(_0x593467,_0x14e615){_0x593467=_0x593467-0x0;var _0x67a71b=_0x04b7[_0x593467];return _0x67a71b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x704b('0x0'));module[_0x704b('0x1')]={'name':{'type':Sequelize[_0x704b('0x2')],'unique':_0x704b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x704b('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x704b('0x4')]();}},'replyUri':{'type':Sequelize[_0x704b('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x704b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x704b('0x5')],'defaultValue':function(){return _0x704b('0x6');}},'notificationSound':{'type':Sequelize[_0x704b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x704b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x704b('0x2')]},'queueTransfer':{'type':Sequelize[_0x704b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x704b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x704b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x704b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x704b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x704b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x25803c){if(!_0x25803c)this[_0x704b('0xa')](_0x704b('0xb'),null);this[_0x704b('0xa')](_0x704b('0xc'),_0x25803c);}}}; \ No newline at end of file +var _0x4859=['STRING','name','generate','TEXT','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','exports'];(function(_0x3e7a50,_0x43aa46){var _0x754437=function(_0x28cbb2){while(--_0x28cbb2){_0x3e7a50['push'](_0x3e7a50['shift']());}};_0x754437(++_0x43aa46);}(_0x4859,0xdb));var _0x9485=function(_0x5980cf,_0x256b46){_0x5980cf=_0x5980cf-0x0;var _0x120e13=_0x4859[_0x5980cf];return _0x120e13;};'use strict';var Sequelize=require(_0x9485('0x0'));var rs=require('randomstring');module[_0x9485('0x1')]={'name':{'type':Sequelize[_0x9485('0x2')],'unique':_0x9485('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9485('0x2')]},'token':{'type':Sequelize[_0x9485('0x2')],'defaultValue':function(){return rs[_0x9485('0x4')]();}},'replyUri':{'type':Sequelize[_0x9485('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9485('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9485('0x5')],'defaultValue':function(){return _0x9485('0x6');}},'notificationSound':{'type':Sequelize[_0x9485('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9485('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9485('0x2')]},'queueTransfer':{'type':Sequelize[_0x9485('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9485('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9485('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9485('0x7')],'defaultValue':![],'comment':_0x9485('0x9'),'set':function(_0x5b07e5){if(!_0x5b07e5)this['setDataValue'](_0x9485('0xa'),null);this[_0x9485('0xb')](_0x9485('0xc'),_0x5b07e5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 69f8ff2..7dea26c 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 _0x225c=['updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','OpenchannelApplication','applications','Applications','list','priority','asc','account','List','defaults','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','internal','Tag','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','findAll','show','length','includeAll','include','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','params','order','pick','rows','removeDispositions','ids','CannedAnswer','filter','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt'];(function(_0x5e5a3f,_0xacda38){var _0x216d8e=function(_0x29757e){while(--_0x29757e){_0x5e5a3f['push'](_0x5e5a3f['shift']());}};_0x216d8e(++_0xacda38);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc225('0x0'));var rimraf=require(_0xc225('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc225('0x2'));var moment=require('moment');var BPromise=require(_0xc225('0x3'));var Mustache=require(_0xc225('0x4'));var util=require(_0xc225('0x5'));var path=require(_0xc225('0x6'));var sox=require(_0xc225('0x7'));var csv=require(_0xc225('0x8'));var ejs=require(_0xc225('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc225('0xa'));var squel=require(_0xc225('0xb'));var crypto=require(_0xc225('0xc'));var jsforce=require(_0xc225('0xd'));var deskjs=require(_0xc225('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc225('0xf'));var Papa=require('papaparse');var Redis=require(_0xc225('0x10'));var authService=require(_0xc225('0x11'));var qs=require(_0xc225('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc225('0x13'));var logger=require(_0xc225('0x14'))(_0xc225('0x15'));var utils=require(_0xc225('0x16'));var config=require(_0xc225('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc225('0x18'))['db'];config[_0xc225('0x19')]=_['defaults'](config['redis'],{'host':_0xc225('0x1a'),'port':0x18eb});var socket=require(_0xc225('0x1b'))(new Redis(config[_0xc225('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc225('0x1c')][_0xc225('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x40b1a6,_0x520049,_0x1bc1ef,_0x51751d){return new BPromise(function(_0x5798e1,_0x419580){var _0x5d1c4a=_0x51751d||client;return _0x5d1c4a[_0xc225('0x1e')](_0x40b1a6,_0x1bc1ef)[_0xc225('0x1f')](function(_0x52a917){logger[_0xc225('0x20')](_0xc225('0x21'),_0x520049,_0xc225('0x22'));logger[_0xc225('0x23')](_0xc225('0x24'),_0x520049,_0xc225('0x22'),JSON[_0xc225('0x25')](_0x52a917));if(_0x52a917['error']){if(_0x52a917[_0xc225('0x26')][_0xc225('0x27')]===0x1f4){logger[_0xc225('0x26')](_0xc225('0x21'),_0x520049,_0x52a917['error'][_0xc225('0x28')]);return _0x419580(_0x52a917['error'][_0xc225('0x28')]);}logger['error'](_0xc225('0x21'),_0x520049,_0x52a917[_0xc225('0x26')][_0xc225('0x28')]);return _0x5798e1(_0x52a917['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x520049,_0xc225('0x22'));_0x5798e1(_0x52a917['result'][_0xc225('0x28')]);}})[_0xc225('0x29')](function(_0x3c9452){logger[_0xc225('0x26')](_0xc225('0x21'),_0x520049,_0x3c9452);_0x419580(_0x3c9452);});});}function respondWithStatusCode(_0x105d7b,_0x44e294){_0x44e294=_0x44e294||0xcc;return function(_0x1acba8){if(_0x1acba8){return _0x105d7b[_0xc225('0x2a')](_0x44e294);}return _0x105d7b['status'](_0x44e294)[_0xc225('0x2b')]();};}function respondWithResult(_0x4e9cee,_0x1caf12){_0x1caf12=_0x1caf12||0xc8;return function(_0x22bffe){if(_0x22bffe){return _0x4e9cee[_0xc225('0x2c')](_0x1caf12)[_0xc225('0x2d')](_0x22bffe);}};}function respondWithFilteredResult(_0xa59278,_0x2b7840){return function(_0x188f91){if(_0x188f91){var _0x23dd2a=typeof _0x2b7840['offset']===_0xc225('0x2e')&&typeof _0x2b7840[_0xc225('0x2f')]==='undefined';var _0x46c7f5=_0x188f91[_0xc225('0x30')];var _0x4e5ad2=_0x23dd2a?0x0:_0x2b7840[_0xc225('0x31')];var _0x359f24=_0x23dd2a?_0x188f91[_0xc225('0x30')]:_0x2b7840['offset']+_0x2b7840['limit'];var _0x154f86;if(_0x359f24>=_0x46c7f5){_0x359f24=_0x46c7f5;_0x154f86=0xc8;}else{_0x154f86=0xce;}_0xa59278[_0xc225('0x2c')](_0x154f86);return _0xa59278[_0xc225('0x32')](_0xc225('0x33'),_0x4e5ad2+'-'+_0x359f24+'/'+_0x46c7f5)[_0xc225('0x2d')](_0x188f91);}return null;};}function patchUpdates(_0x44aa2f){return function(_0xf07e19){try{jsonpatch[_0xc225('0x34')](_0xf07e19,_0x44aa2f,!![]);}catch(_0x2023f0){return BPromise[_0xc225('0x35')](_0x2023f0);}return _0xf07e19[_0xc225('0x36')]();};}function saveUpdates(_0x256e13,_0x3127e2){return function(_0x2742c0){if(_0x2742c0){return _0x2742c0[_0xc225('0x37')](_0x256e13)[_0xc225('0x1f')](function(_0x53eab4){return _0x53eab4;});}return null;};}function removeEntity(_0x46634d,_0x454e42){return function(_0x45c412){if(_0x45c412){return _0x45c412[_0xc225('0x38')]()['then'](function(){var _0x1654d9=_0x45c412[_0xc225('0x39')]({'plain':!![]});var _0x5a2b30=_0xc225('0x3a');return db[_0xc225('0x3b')]['destroy']({'where':{'type':_0x5a2b30,'resourceId':_0x1654d9['id']}})[_0xc225('0x1f')](function(){return _0x45c412;});})['then'](function(){_0x46634d[_0xc225('0x2c')](0xcc)[_0xc225('0x2b')]();});}};}function handleEntityNotFound(_0x418471,_0x372705){return function(_0x15c206){if(!_0x15c206){_0x418471[_0xc225('0x2a')](0x194);}return _0x15c206;};}function handleError(_0xe60220,_0xbef636){_0xbef636=_0xbef636||0x1f4;return function(_0x26c35e){logger['error'](_0x26c35e[_0xc225('0x3c')]);if(_0x26c35e[_0xc225('0x3d')]){delete _0x26c35e['name'];}_0xe60220[_0xc225('0x2c')](_0xbef636)[_0xc225('0x3e')](_0x26c35e);};}exports[_0xc225('0x3f')]=function(_0x117d05,_0x35ca50){var _0x34ad70={'include':[{'model':db[_0xc225('0x40')],'as':_0xc225('0x41')}]},_0x16aec8={},_0x28c95e={'count':0x0,'rows':[]};var _0x764bc8=_['map'](db[_0xc225('0x42')][_0xc225('0x43')],function(_0x227bc9){return{'name':_0x227bc9[_0xc225('0x44')],'type':_0x227bc9[_0xc225('0x45')]['key']};});_0x16aec8['model']=_[_0xc225('0x46')](_0x764bc8,'name');_0x16aec8[_0xc225('0x47')]=_[_0xc225('0x48')](_0x117d05[_0xc225('0x47')]);_0x16aec8[_0xc225('0x49')]=_[_0xc225('0x4a')](_0x16aec8['model'],_0x16aec8[_0xc225('0x47')]);_0x34ad70[_0xc225('0x4b')]=_[_0xc225('0x4a')](_0x16aec8[_0xc225('0x4c')],qs[_0xc225('0x4d')](_0x117d05[_0xc225('0x47')][_0xc225('0x4d')]));_0x34ad70[_0xc225('0x4b')]=_0x34ad70[_0xc225('0x4b')]['length']?_0x34ad70['attributes']:_0x16aec8['model'];if(!_0x117d05[_0xc225('0x47')][_0xc225('0x4e')](_0xc225('0x4f'))){_0x34ad70['limit']=qs[_0xc225('0x2f')](_0x117d05[_0xc225('0x47')]['limit']);_0x34ad70[_0xc225('0x31')]=qs[_0xc225('0x31')](_0x117d05[_0xc225('0x47')][_0xc225('0x31')]);}_0x34ad70['order']=qs['sort'](_0x117d05[_0xc225('0x47')][_0xc225('0x50')]);_0x34ad70[_0xc225('0x51')]=qs[_0xc225('0x49')](_['pick'](_0x117d05[_0xc225('0x47')],_0x16aec8[_0xc225('0x49')]),_0x764bc8);if(_0x117d05[_0xc225('0x47')]['filter']){_0x34ad70['where']=_['merge'](_0x34ad70[_0xc225('0x51')],{'$or':_[_0xc225('0x46')](_0x764bc8,function(_0x1d51aa){if(_0x1d51aa[_0xc225('0x45')]!==_0xc225('0x52')){var _0xa6359={};_0xa6359[_0x1d51aa['name']]={'$like':'%'+_0x117d05[_0xc225('0x47')]['filter']+'%'};return _0xa6359;}})});}_0x34ad70=_[_0xc225('0x53')]({},_0x34ad70,_0x117d05[_0xc225('0x54')]);var _0x4abcb1={'where':_0x34ad70[_0xc225('0x51')]};return db['OpenchannelAccount'][_0xc225('0x30')](_0x4abcb1)[_0xc225('0x1f')](function(_0x1c8f2c){_0x28c95e[_0xc225('0x30')]=_0x1c8f2c;if(_0x117d05[_0xc225('0x47')]['includeAll']){_0x34ad70['include']=[{'all':!![]}];}return db[_0xc225('0x42')][_0xc225('0x55')](_0x34ad70);})[_0xc225('0x1f')](function(_0x301ca3){_0x28c95e['rows']=_0x301ca3;return _0x28c95e;})[_0xc225('0x1f')](respondWithFilteredResult(_0x35ca50,_0x34ad70))[_0xc225('0x29')](handleError(_0x35ca50,null));};exports[_0xc225('0x56')]=function(_0x180459,_0x594524){var _0x39c56f={'raw':![],'where':{'id':_0x180459['params']['id']},'include':[{'model':db[_0xc225('0x40')],'as':_0xc225('0x41')}]},_0x4dc574={};_0x4dc574[_0xc225('0x4c')]=_[_0xc225('0x48')](db[_0xc225('0x42')][_0xc225('0x43')]);_0x4dc574[_0xc225('0x47')]=_[_0xc225('0x48')](_0x180459[_0xc225('0x47')]);_0x4dc574[_0xc225('0x49')]=_[_0xc225('0x4a')](_0x4dc574[_0xc225('0x4c')],_0x4dc574[_0xc225('0x47')]);_0x39c56f[_0xc225('0x4b')]=_[_0xc225('0x4a')](_0x4dc574['model'],qs[_0xc225('0x4d')](_0x180459['query'][_0xc225('0x4d')]));_0x39c56f[_0xc225('0x4b')]=_0x39c56f['attributes'][_0xc225('0x57')]?_0x39c56f['attributes']:_0x4dc574[_0xc225('0x4c')];if(_0x180459[_0xc225('0x47')][_0xc225('0x58')]){_0x39c56f[_0xc225('0x59')]=[{'all':!![]}];}_0x39c56f=_[_0xc225('0x53')]({},_0x39c56f,_0x180459[_0xc225('0x54')]);return db[_0xc225('0x42')][_0xc225('0x5a')](_0x39c56f)[_0xc225('0x1f')](handleEntityNotFound(_0x594524,null))[_0xc225('0x1f')](respondWithResult(_0x594524,null))[_0xc225('0x29')](handleError(_0x594524,null));};exports[_0xc225('0x5b')]=function(_0x2fb6ec,_0x51f39d){return db[_0xc225('0x42')][_0xc225('0x5b')](_0x2fb6ec['body'],{})[_0xc225('0x1f')](function(_0x57445c){var _0x184596=_0x2fb6ec['user'][_0xc225('0x39')]({'plain':!![]});if(!_0x184596)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x184596[_0xc225('0x5c')]===_0xc225('0x5d')){var _0xb26716=_0x57445c[_0xc225('0x39')]({'plain':!![]});var _0x333dc8='OpenchannelAccounts';return db[_0xc225('0x5e')][_0xc225('0x5a')]({'where':{'name':_0x333dc8,'userProfileId':_0x184596[_0xc225('0x5f')]},'raw':!![]})[_0xc225('0x1f')](function(_0x58bf0c){if(_0x58bf0c&&_0x58bf0c[_0xc225('0x60')]===0x0){return db[_0xc225('0x3b')]['create']({'name':_0xb26716[_0xc225('0x3d')],'resourceId':_0xb26716['id'],'type':_0x58bf0c['name'],'sectionId':_0x58bf0c['id']},{})[_0xc225('0x1f')](function(){return _0x57445c;});}else{return _0x57445c;}})['catch'](function(_0x1e0d7f){logger[_0xc225('0x26')](_0xc225('0x61'),_0x1e0d7f);throw _0x1e0d7f;});}return _0x57445c;})['then'](respondWithResult(_0x51f39d,0xc9))[_0xc225('0x29')](handleError(_0x51f39d,null));};exports['update']=function(_0x49aaa9,_0x2008e3){if(_0x49aaa9[_0xc225('0x62')]['id']){delete _0x49aaa9[_0xc225('0x62')]['id'];}return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x49aaa9['params']['id']},'include':[{'model':db[_0xc225('0x40')],'as':_0xc225('0x41')}]})[_0xc225('0x1f')](handleEntityNotFound(_0x2008e3,null))['then'](saveUpdates(_0x49aaa9[_0xc225('0x62')],null))[_0xc225('0x1f')](respondWithResult(_0x2008e3,null))[_0xc225('0x29')](handleError(_0x2008e3,null));};exports[_0xc225('0x38')]=function(_0x57d1d1,_0x32fabd){return db['OpenchannelAccount']['find']({'where':{'id':_0x57d1d1['params']['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x32fabd,null))[_0xc225('0x1f')](removeEntity(_0x32fabd,null))[_0xc225('0x29')](handleError(_0x32fabd,null));};exports[_0xc225('0x63')]=function(_0x5a5629,_0x3eaccc){return db[_0xc225('0x42')]['describe']()['then'](respondWithResult(_0x3eaccc,null))['catch'](handleError(_0x3eaccc,null));};exports[_0xc225('0x64')]=function(_0x52afd7,_0x4dc55d,_0x145018){if(_0x52afd7['body']['id']){delete _0x52afd7[_0xc225('0x62')]['id'];}return db[_0xc225('0x42')]['find']({'where':{'id':_0x52afd7['params']['id']}})['then'](handleEntityNotFound(_0x4dc55d,null))[_0xc225('0x1f')](function(_0x258113){if(_0x258113){_0x52afd7['body'][_0xc225('0x65')]=_0x258113['id'];return db[_0xc225('0x66')][_0xc225('0x5b')](_0x52afd7['body']);}})[_0xc225('0x1f')](respondWithResult(_0x4dc55d,null))[_0xc225('0x29')](handleError(_0x4dc55d,null));};exports[_0xc225('0x67')]=function(_0x575c9c,_0x18263,_0x3eed9f){var _0x37c20c={'raw':![],'where':{}};var _0x59054a={};var _0x44820b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc225('0x68')]({'where':{'id':_0x575c9c[_0xc225('0x69')]['id']}})['then'](handleEntityNotFound(_0x18263,null))['then'](function(_0x3d7f58){if(_0x3d7f58){_0x59054a[_0xc225('0x4c')]=_[_0xc225('0x48')](db[_0xc225('0x66')][_0xc225('0x43')]);_0x59054a[_0xc225('0x47')]=_['keys'](_0x575c9c[_0xc225('0x47')]);_0x59054a['filters']=_[_0xc225('0x4a')](_0x59054a['model'],_0x59054a[_0xc225('0x47')]);_0x37c20c['attributes']=_[_0xc225('0x4a')](_0x59054a[_0xc225('0x4c')],qs[_0xc225('0x4d')](_0x575c9c[_0xc225('0x47')][_0xc225('0x4d')]));_0x37c20c[_0xc225('0x4b')]=_0x37c20c[_0xc225('0x4b')][_0xc225('0x57')]?_0x37c20c[_0xc225('0x4b')]:_0x59054a[_0xc225('0x4c')];if(!_0x575c9c[_0xc225('0x47')][_0xc225('0x4e')](_0xc225('0x4f'))){_0x37c20c[_0xc225('0x2f')]=qs[_0xc225('0x2f')](_0x575c9c[_0xc225('0x47')][_0xc225('0x2f')]);_0x37c20c[_0xc225('0x31')]=qs[_0xc225('0x31')](_0x575c9c[_0xc225('0x47')]['offset']);}_0x37c20c[_0xc225('0x6a')]=qs[_0xc225('0x50')](_0x575c9c['query'][_0xc225('0x50')]);_0x37c20c['where']=qs[_0xc225('0x49')](_[_0xc225('0x6b')](_0x575c9c[_0xc225('0x47')],_0x59054a[_0xc225('0x49')]));_0x37c20c[_0xc225('0x51')]['OpenchannelAccountId']=_0x3d7f58['id'];if(_0x575c9c[_0xc225('0x47')]['filter']){_0x37c20c[_0xc225('0x51')]=_[_0xc225('0x53')](_0x37c20c[_0xc225('0x51')],{'$or':_[_0xc225('0x46')](_0x37c20c[_0xc225('0x4b')],function(_0x134a9c){var _0x5ecd2c={};_0x5ecd2c[_0x134a9c]={'$like':'%'+_0x575c9c[_0xc225('0x47')]['filter']+'%'};return _0x5ecd2c;})});}_0x37c20c=_[_0xc225('0x53')]({},_0x37c20c,_0x575c9c[_0xc225('0x54')]);return db[_0xc225('0x66')]['count']({'where':_0x37c20c[_0xc225('0x51')]})['then'](function(_0x59c693){_0x44820b[_0xc225('0x30')]=_0x59c693;if(_0x575c9c[_0xc225('0x47')]['includeAll']){_0x37c20c[_0xc225('0x59')]=[{'all':!![]}];}return db[_0xc225('0x66')]['findAll'](_0x37c20c);})[_0xc225('0x1f')](function(_0x5e62c1){_0x44820b[_0xc225('0x6c')]=_0x5e62c1;return _0x44820b;});}})[_0xc225('0x1f')](respondWithFilteredResult(_0x18263,_0x37c20c))[_0xc225('0x29')](handleError(_0x18263,null));};exports['removeDispositions']=function(_0x3dfc80,_0x5e589d,_0x226f9b){return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x3dfc80[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x5e589d,null))[_0xc225('0x1f')](function(_0x3e71e4){if(_0x3e71e4){return _0x3e71e4[_0xc225('0x6d')](_0x3dfc80[_0xc225('0x47')][_0xc225('0x6e')]);}})[_0xc225('0x1f')](respondWithStatusCode(_0x5e589d,null))['catch'](handleError(_0x5e589d,null));};exports['addAnswer']=function(_0x2a3a65,_0x4585fd,_0x129839){if(_0x2a3a65[_0xc225('0x62')]['id']){delete _0x2a3a65[_0xc225('0x62')]['id'];}return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x2a3a65[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x4585fd,null))[_0xc225('0x1f')](function(_0xbebeab){if(_0xbebeab){_0x2a3a65[_0xc225('0x62')][_0xc225('0x65')]=_0xbebeab['id'];return db[_0xc225('0x6f')][_0xc225('0x5b')](_0x2a3a65[_0xc225('0x62')]);}})[_0xc225('0x1f')](respondWithResult(_0x4585fd,null))[_0xc225('0x29')](handleError(_0x4585fd,null));};exports['getAnswers']=function(_0xc315af,_0x542aa9,_0x335c4f){var _0x59c5f6={'raw':![],'where':{}};var _0x232f20={};var _0x3929cb={'count':0x0,'rows':[]};return db[_0xc225('0x42')][_0xc225('0x68')]({'where':{'id':_0xc315af[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x542aa9,null))[_0xc225('0x1f')](function(_0x1dcca3){if(_0x1dcca3){_0x232f20[_0xc225('0x4c')]=_['keys'](db[_0xc225('0x6f')][_0xc225('0x43')]);_0x232f20['query']=_['keys'](_0xc315af[_0xc225('0x47')]);_0x232f20[_0xc225('0x49')]=_['intersection'](_0x232f20['model'],_0x232f20['query']);_0x59c5f6[_0xc225('0x4b')]=_[_0xc225('0x4a')](_0x232f20['model'],qs[_0xc225('0x4d')](_0xc315af[_0xc225('0x47')][_0xc225('0x4d')]));_0x59c5f6[_0xc225('0x4b')]=_0x59c5f6[_0xc225('0x4b')][_0xc225('0x57')]?_0x59c5f6[_0xc225('0x4b')]:_0x232f20['model'];if(!_0xc315af['query'][_0xc225('0x4e')](_0xc225('0x4f'))){_0x59c5f6[_0xc225('0x2f')]=qs[_0xc225('0x2f')](_0xc315af[_0xc225('0x47')][_0xc225('0x2f')]);_0x59c5f6['offset']=qs[_0xc225('0x31')](_0xc315af[_0xc225('0x47')][_0xc225('0x31')]);}_0x59c5f6['order']=qs[_0xc225('0x50')](_0xc315af['query'][_0xc225('0x50')]);_0x59c5f6[_0xc225('0x51')]=qs[_0xc225('0x49')](_[_0xc225('0x6b')](_0xc315af[_0xc225('0x47')],_0x232f20[_0xc225('0x49')]));_0x59c5f6[_0xc225('0x51')]['OpenchannelAccountId']=_0x1dcca3['id'];if(_0xc315af[_0xc225('0x47')][_0xc225('0x70')]){_0x59c5f6['where']=_['merge'](_0x59c5f6['where'],{'$or':_[_0xc225('0x46')](_0x59c5f6[_0xc225('0x4b')],function(_0x4608a0){var _0x3acb4b={};_0x3acb4b[_0x4608a0]={'$like':'%'+_0xc315af[_0xc225('0x47')][_0xc225('0x70')]+'%'};return _0x3acb4b;})});}_0x59c5f6=_[_0xc225('0x53')]({},_0x59c5f6,_0xc315af[_0xc225('0x54')]);return db[_0xc225('0x6f')][_0xc225('0x30')]({'where':_0x59c5f6[_0xc225('0x51')]})[_0xc225('0x1f')](function(_0x1c822a){_0x3929cb[_0xc225('0x30')]=_0x1c822a;if(_0xc315af[_0xc225('0x47')][_0xc225('0x58')]){_0x59c5f6[_0xc225('0x59')]=[{'all':!![]}];}return db[_0xc225('0x6f')][_0xc225('0x55')](_0x59c5f6);})[_0xc225('0x1f')](function(_0x5e62ac){_0x3929cb[_0xc225('0x6c')]=_0x5e62ac;return _0x3929cb;});}})[_0xc225('0x1f')](respondWithFilteredResult(_0x542aa9,_0x59c5f6))['catch'](handleError(_0x542aa9,null));};exports['removeAnswers']=function(_0x39b4e5,_0x7bebab,_0x1a22b4){return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x39b4e5[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x7bebab,null))[_0xc225('0x1f')](function(_0x21c69c){if(_0x21c69c){return _0x21c69c[_0xc225('0x71')](_0x39b4e5[_0xc225('0x47')][_0xc225('0x6e')]);}})[_0xc225('0x1f')](respondWithStatusCode(_0x7bebab,null))['catch'](handleError(_0x7bebab,null));};exports['notify']=function(_0x4a0f3d,_0x1430d1,_0x35b02a){var _0x41079f={'body':_0x4a0f3d[_0xc225('0x62')],'channel':_0xc225('0x72')};var _0x39cf04=[];var _0x9e128b=[];var _0x1597e3={};var _0x1fe29f=![];return db[_0xc225('0x73')][_0xc225('0x63')]()[_0xc225('0x1f')](function(_0x3701fd){if(!_0x3701fd){throw new db[(_0xc225('0x74'))]['ValidationError'](_0xc225('0x75'));}_0x39cf04=_[_0xc225('0x76')](_[_0xc225('0x48')](_0x3701fd),[_0xc225('0x77'),_0xc225('0x78')]);_0x9e128b=_[_0xc225('0x76')](_['keys'](_0x3701fd),[_0xc225('0x77'),_0xc225('0x78'),_0xc225('0x79'),_0xc225('0x7a')]);if(_0x4a0f3d['body']['id']){delete _0x4a0f3d[_0xc225('0x62')]['id'];}if(_[_0xc225('0x7b')](_0x4a0f3d[_0xc225('0x62')][_0xc225('0x7c')])){throw new db[(_0xc225('0x74'))][(_0xc225('0x7d'))](_0xc225('0x7e'));}if(_[_0xc225('0x7b')](_0x4a0f3d[_0xc225('0x62')][_0xc225('0x62')])||_0x4a0f3d[_0xc225('0x62')][_0xc225('0x62')]===''){throw new db[(_0xc225('0x74'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc225('0x7b')](_0x4a0f3d[_0xc225('0x62')][_0xc225('0x7f')])){throw new db[(_0xc225('0x74'))][(_0xc225('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9e128b);}if(!_['includes'](_0x9e128b,_0x4a0f3d[_0xc225('0x62')][_0xc225('0x7f')])){throw new db['Sequelize'][(_0xc225('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9e128b);}_0x1597e3[_0x4a0f3d[_0xc225('0x62')][_0xc225('0x7f')]]=_0x4a0f3d['body']['from'];})['then'](function(){return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x4a0f3d[_0xc225('0x69')]['id']},'include':[{'model':db[_0xc225('0x80')],'as':'List','include':[{'model':db[_0xc225('0x73')],'as':_0xc225('0x81'),'where':_0x1597e3,'limit':0x1,'order':[[_0xc225('0x78'),_0xc225('0x82')]]}]},{'model':db[_0xc225('0x83')],'as':'Applications'}]});})[_0xc225('0x1f')](handleEntityNotFound(_0x1430d1,null))['then'](function(_0x10a588){if(_0x10a588&&_0x10a588['List']){_0x41079f['account']=_0x10a588;_0x41079f[_0xc225('0x84')]=_0x10a588[_0xc225('0x85')];_0x41079f[_0xc225('0x86')]=_0x10a588['List'];_0x41079f[_0xc225('0x84')]=_['orderBy'](_0x41079f[_0xc225('0x84')],[_0xc225('0x87')],[_0xc225('0x88')]);if(_0x41079f[_0xc225('0x89')][_0xc225('0x85')]){delete _0x41079f['account'][_0xc225('0x85')];}if(_0x41079f[_0xc225('0x89')]['List']&&_0x41079f[_0xc225('0x89')]['List']['Contacts']['length']){return _0x41079f[_0xc225('0x89')][_0xc225('0x8a')][_0xc225('0x81')][0x0];}var _0x5c0b9f=_[_0xc225('0x8b')](_0x4a0f3d['body'],{'firstName':_0x4a0f3d['body'][_0xc225('0x7c')],'ListId':_0x10a588[_0xc225('0x7a')]});_0x5c0b9f[_0x4a0f3d['body'][_0xc225('0x7f')]]=_0x4a0f3d[_0xc225('0x62')][_0xc225('0x7c')];return db['CmContact'][_0xc225('0x5b')](_0x5c0b9f,{'fields':_0x39cf04,'raw':!![]});}})['then'](handleEntityNotFound(_0x1430d1,null))[_0xc225('0x1f')](function(_0x20c5d6){_0x41079f['contact']=_0x20c5d6;if(_0x20c5d6){var _0x26c8b8={'ContactId':_0x20c5d6['id'],'OpenchannelAccountId':_0x4a0f3d['params']['id'],'from':(_0x20c5d6[_0xc225('0x8c')]||'')+'\x20'+(_0x20c5d6[_0xc225('0x8d')]||'')};var _0x17a4c3={'OpenchannelAccountId':_0x4a0f3d[_0xc225('0x69')]['id'],'closed':![]};if(_0x4a0f3d[_0xc225('0x62')][_0xc225('0x8e')]){_0x17a4c3[_0xc225('0x8e')]=_0x4a0f3d[_0xc225('0x62')][_0xc225('0x8e')];return db['OpenchannelInteraction']['find']({'where':_0x17a4c3})[_0xc225('0x1f')](function(_0x2a8d70){if(_0x2a8d70){return[_0x2a8d70,![]];}_0x26c8b8[_0xc225('0x8e')]=_0x4a0f3d[_0xc225('0x62')][_0xc225('0x8e')];_0x26c8b8[_0xc225('0x8f')]=_0x4a0f3d[_0xc225('0x62')]['externalUrl'];return db['OpenchannelInteraction'][_0xc225('0x5b')](_0x26c8b8)[_0xc225('0x1f')](function(_0x3bd3c1){return[_0x3bd3c1,!![]];});});}else{_0x17a4c3[_0xc225('0x8e')]=null;}_0x17a4c3[_0xc225('0x90')]=_0x20c5d6['id'];return db[_0xc225('0x91')][_0xc225('0x5a')]({'where':_0x17a4c3})[_0xc225('0x1f')](function(_0x143afc){if(_0x143afc){return[_0x143afc,![]];}return db[_0xc225('0x91')][_0xc225('0x5b')](_0x26c8b8)[_0xc225('0x1f')](function(_0x3b1a5b){return[_0x3b1a5b,!![]];});});}})[_0xc225('0x92')](function(_0xa9550d,_0x65a38c){if(_0xa9550d){_0x1fe29f=_0x65a38c;if(!_0x65a38c){var _0x342a14={'from':(_0x41079f[_0xc225('0x93')][_0xc225('0x8c')]||'')+'\x20'+(_0x41079f[_0xc225('0x93')][_0xc225('0x8d')]||'')};if(_0x4a0f3d[_0xc225('0x62')][_0xc225('0x8e')]&&_0x4a0f3d[_0xc225('0x62')][_0xc225('0x94')]&&_0x4a0f3d[_0xc225('0x62')]['threadId']!=_0x4a0f3d['body']['messageId']){_0x342a14[_0xc225('0x8e')]=_0x4a0f3d[_0xc225('0x62')][_0xc225('0x94')];}return _0xa9550d[_0xc225('0x37')](_0x342a14);}else{return _0xa9550d;}}})[_0xc225('0x1f')](function(_0xbec48c){_0x41079f['interaction']=_0xbec48c[_0xc225('0x39')]({'plain':!![]});_0x41079f[_0xc225('0x95')]['created']=_0x1fe29f;if(_0x41079f[_0xc225('0x95')][_0xc225('0x96')]){if(_0x41079f[_0xc225('0x89')][_0xc225('0x97')]){_0x41079f[_0xc225('0x84')][_0xc225('0x98')]({'id':0x0,'priority':_0x41079f['applications']['length']+0x1,'app':_0xc225('0x99'),'appdata':_0xc225('0x9a'),'interval':_0xc225('0x9b')});}}return db[_0xc225('0x9c')][_0xc225('0x5b')]({'body':_0x4a0f3d[_0xc225('0x62')][_0xc225('0x62')],'OpenchannelAccountId':_0x4a0f3d[_0xc225('0x69')]['id'],'OpenchannelInteractionId':_0xbec48c['id'],'direction':'in','ContactId':_0x41079f[_0xc225('0x93')]['id'],'AttachmentId':_0x4a0f3d[_0xc225('0x62')][_0xc225('0x9d')]});})[_0xc225('0x1f')](function(_0x501f7b){_0x41079f[_0xc225('0x28')]=_0x501f7b;if(_0x41079f['interaction'][_0xc225('0x9e')]){return db[_0xc225('0x9f')][_0xc225('0x5a')]({'attributes':['id',_0xc225('0x3d')],'where':{'id':_0x41079f[_0xc225('0x95')][_0xc225('0x9e')]}})[_0xc225('0x1f')](function(_0x2aee1c){if(_0x2aee1c){_0x41079f[_0xc225('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc225('0xa0'),'appdata':_0x2aee1c[_0xc225('0x3d')]+','+(_0x41079f[_0xc225('0x89')][_0xc225('0xa1')]||0xa),'interval':_0xc225('0x9b')});_0x41079f[_0xc225('0xa2')]=![];}return respondWithRpcPromise(_0xc225('0xa3'),'startRouting',_0x41079f);});}return respondWithRpcPromise('Start',_0xc225('0xa4'),_0x41079f);})['then'](function(_0x240bbb){respondWithRpcPromise(_0xc225('0xa5'),'EventManager',{'event':_0xc225('0xa6'),'message':_0x240bbb},client9002);return _0x240bbb;})[_0xc225('0x1f')](respondWithResult(_0x1430d1,null))[_0xc225('0x29')](handleError(_0x1430d1,null));};exports[_0xc225('0xa7')]=function(_0x41e152,_0x1dd800){var _0x297bf2=_0x41e152[_0xc225('0x69')]['id'];var _0x1be1c2=_0x41e152[_0xc225('0x62')];var _0x1d0d2e=0xc8;var _0x1738df=null;return db[_0xc225('0xa8')][_0xc225('0xa9')]({'isolationLevel':db[_0xc225('0xa8')][_0xc225('0xaa')]['ISOLATION_LEVELS'][_0xc225('0xab')]},function(_0x33012d){return db[_0xc225('0x42')][_0xc225('0x68')]({'where':{'id':_0x297bf2},'transaction':_0x33012d})[_0xc225('0x1f')](function(_0x50ad2a){if(_0x50ad2a){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x297bf2},'transaction':_0x33012d})[_0xc225('0x1f')](function(){var _0x1ec34f=_[_0xc225('0x46')](_0x1be1c2,function(_0x58821f){_0x58821f[_0xc225('0x65')]=_0x297bf2;return _0x58821f;});return db[_0xc225('0x83')][_0xc225('0xac')](_0x1ec34f,{'transaction':_0x33012d});});}else{_0x1d0d2e=0x194;_0x1738df=[];}});})[_0xc225('0x1f')](function(){if(_0x1d0d2e!==0x194){return db[_0xc225('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x297bf2},'order':_0xc225('0x87')})[_0xc225('0x1f')](function(_0x8267c6){_0x1738df=_0x8267c6;});}})[_0xc225('0x29')](function(_0xf6797d){_0x1d0d2e=0x1f4;logger[_0xc225('0x26')](_0xf6797d[_0xc225('0x3c')]);if(_0xf6797d['name']){delete _0xf6797d[_0xc225('0x3d')];}_0x1738df=_0xf6797d;})[_0xc225('0xad')](function(){if(_0x1738df===null){_0x1dd800['sendStatus'](_0x1d0d2e);}else{if(_0x1d0d2e===0x1f4){_0x1dd800[_0xc225('0x2c')](_0x1d0d2e)[_0xc225('0x3e')](_0x1738df);}else{_0x1dd800['status'](_0x1d0d2e)[_0xc225('0x2d')](_0x1738df);}}});};exports['getApplications']=function(_0x212007,_0x61a8ba,_0x340b5e){var _0x4eccb7={};var _0x54b311={};var _0x33be6b;var _0x5b57b9;return db[_0xc225('0x42')][_0xc225('0x68')]({'where':{'id':_0x212007[_0xc225('0x69')]['id']}})['then'](handleEntityNotFound(_0x61a8ba,null))[_0xc225('0x1f')](function(_0x1e770f){if(_0x1e770f){_0x33be6b=_0x1e770f;_0x54b311[_0xc225('0x4c')]=_[_0xc225('0x48')](db[_0xc225('0x83')][_0xc225('0x43')]);_0x54b311[_0xc225('0x47')]=_[_0xc225('0x48')](_0x212007[_0xc225('0x47')]);_0x54b311[_0xc225('0x49')]=_[_0xc225('0x4a')](_0x54b311[_0xc225('0x4c')],_0x54b311[_0xc225('0x47')]);_0x4eccb7[_0xc225('0x4b')]=_[_0xc225('0x4a')](_0x54b311[_0xc225('0x4c')],qs['fields'](_0x212007[_0xc225('0x47')][_0xc225('0x4d')]));_0x4eccb7['attributes']=_0x4eccb7['attributes'][_0xc225('0x57')]?_0x4eccb7['attributes']:_0x54b311['model'];_0x4eccb7['order']=qs[_0xc225('0x50')](_0x212007[_0xc225('0x47')]['sort']);_0x4eccb7[_0xc225('0x51')]=qs[_0xc225('0x49')](_[_0xc225('0x6b')](_0x212007[_0xc225('0x47')],_0x54b311[_0xc225('0x49')]));if(_0x212007['query']['filter']){_0x4eccb7[_0xc225('0x51')]=_[_0xc225('0x53')](_0x4eccb7['where'],{'$or':_[_0xc225('0x46')](_0x4eccb7['attributes'],function(_0x34161a){var _0x16938b={};_0x16938b[_0x34161a]={'$like':'%'+_0x212007[_0xc225('0x47')][_0xc225('0x70')]+'%'};return _0x16938b;})});}_0x4eccb7=_[_0xc225('0x53')]({},_0x4eccb7,_0x212007['options']);return _0x33be6b[_0xc225('0xae')](_0x4eccb7);}})[_0xc225('0x1f')](function(_0x4be2c6){if(_0x4be2c6){_0x5b57b9=_0x4be2c6[_0xc225('0x57')];if(!_0x212007[_0xc225('0x47')][_0xc225('0x4e')](_0xc225('0x4f'))){_0x4eccb7[_0xc225('0x2f')]=qs['limit'](_0x212007[_0xc225('0x47')][_0xc225('0x2f')]);_0x4eccb7['offset']=qs[_0xc225('0x31')](_0x212007['query']['offset']);}return _0x33be6b[_0xc225('0xae')](_0x4eccb7);}})[_0xc225('0x1f')](function(_0x229364){if(_0x229364){return _0x229364?{'count':_0x5b57b9,'rows':_0x229364}:null;}})['then'](respondWithResult(_0x61a8ba,null))[_0xc225('0x29')](handleError(_0x61a8ba,null));};exports['getInteractions']=function(_0x12034d,_0x2cfd00,_0x1d0d8a){var _0x19eb7={'raw':![],'where':{}};var _0x3d707b={};var _0x3fb87a={'count':0x0,'rows':[]};return db[_0xc225('0x42')][_0xc225('0x68')]({'where':{'id':_0x12034d[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x2cfd00,null))[_0xc225('0x1f')](function(_0x150d39){if(_0x150d39){_0x3d707b[_0xc225('0x4c')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x3d707b['query']=_[_0xc225('0x48')](_0x12034d['query']);_0x3d707b[_0xc225('0x49')]=_[_0xc225('0x4a')](_0x3d707b[_0xc225('0x4c')],_0x3d707b[_0xc225('0x47')]);_0x19eb7['attributes']=_[_0xc225('0x4a')](_0x3d707b[_0xc225('0x4c')],qs['fields'](_0x12034d[_0xc225('0x47')][_0xc225('0x4d')]));_0x19eb7[_0xc225('0x4b')]=_0x19eb7[_0xc225('0x4b')][_0xc225('0x57')]?_0x19eb7['attributes']:_0x3d707b['model'];if(!_0x12034d[_0xc225('0x47')][_0xc225('0x4e')](_0xc225('0x4f'))){_0x19eb7[_0xc225('0x2f')]=qs[_0xc225('0x2f')](_0x12034d[_0xc225('0x47')][_0xc225('0x2f')]);_0x19eb7[_0xc225('0x31')]=qs[_0xc225('0x31')](_0x12034d[_0xc225('0x47')]['offset']);}_0x19eb7[_0xc225('0x6a')]=qs['sort'](_0x12034d['query'][_0xc225('0x50')]);_0x19eb7[_0xc225('0x51')]=qs['filters'](_[_0xc225('0x6b')](_0x12034d[_0xc225('0x47')],_0x3d707b[_0xc225('0x49')]));_0x19eb7[_0xc225('0x51')][_0xc225('0x65')]=_0x150d39['id'];if(_0x12034d[_0xc225('0x47')][_0xc225('0x70')]){_0x19eb7[_0xc225('0x51')]=_[_0xc225('0x53')](_0x19eb7[_0xc225('0x51')],{'$or':_[_0xc225('0x46')](_0x19eb7[_0xc225('0x4b')],function(_0x167b10){var _0x32f745={};_0x32f745[_0x167b10]={'$like':'%'+_0x12034d[_0xc225('0x47')][_0xc225('0x70')]+'%'};return _0x32f745;})});}_0x19eb7=_[_0xc225('0x53')]({},_0x19eb7,_0x12034d[_0xc225('0x54')]);return db[_0xc225('0x91')]['count']({'where':_0x19eb7[_0xc225('0x51')]})['then'](function(_0x3f5680){_0x3fb87a[_0xc225('0x30')]=_0x3f5680;if(_0x12034d['query']['includeAll']){_0x19eb7['include']=[{'model':db[_0xc225('0x73')],'as':_0xc225('0xaf'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xc225('0x3d'),'fullname',_0xc225('0xb0')],'required':![]},{'model':db[_0xc225('0xb1')],'as':_0xc225('0xb2'),'attributes':['id',_0xc225('0x3d'),_0xc225('0xb3')],'where':_0x12034d[_0xc225('0x47')][_0xc225('0xb4')]?{'id':_0x12034d[_0xc225('0x47')][_0xc225('0xb4')]}:undefined,'required':_0x12034d[_0xc225('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xc225('0x55')](_0x19eb7);})['then'](function(_0x25bcac){_0x3fb87a[_0xc225('0x6c')]=_0x25bcac;return _0x3fb87a;});}})[_0xc225('0x1f')](respondWithFilteredResult(_0x2cfd00,_0x19eb7))[_0xc225('0x29')](handleError(_0x2cfd00,null));};exports[_0xc225('0xb5')]=function(_0xb7c2f2,_0x52cbdb,_0x105ddd){return db['OpenchannelAccount'][_0xc225('0x5a')]({'where':{'id':_0xb7c2f2[_0xc225('0x69')]['id']}})['then'](handleEntityNotFound(_0x52cbdb,null))[_0xc225('0x1f')](function(_0x350ac8){if(_0x350ac8){return _0x350ac8[_0xc225('0xb5')](_0xb7c2f2['body']['ids'],_['omit'](_0xb7c2f2['body'],['ids','id'])||{})[_0xc225('0x92')](function(_0x350f44){for(var _0x3cb57a=0x0;_0x3cb57a<_0xb7c2f2[_0xc225('0x62')][_0xc225('0x6e')][_0xc225('0x57')];_0x3cb57a+=0x1){socket[_0xc225('0xb6')]('userOpenchannelAccount:save',{'UserId':Number(_0xb7c2f2['body']['ids'][_0x3cb57a]),'OpenchannelAccountId':Number(_0xb7c2f2['params']['id'])});}return _0x350f44;});}})[_0xc225('0x1f')](respondWithResult(_0x52cbdb,null))[_0xc225('0x29')](handleError(_0x52cbdb,null));};exports[_0xc225('0xb7')]=function(_0x3b64fd,_0x3e54a5,_0x22711d){return db[_0xc225('0x42')][_0xc225('0x5a')]({'where':{'id':_0x3b64fd[_0xc225('0x69')]['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x3e54a5,null))[_0xc225('0x1f')](function(_0x3e5bdd){if(_0x3e5bdd){return _0x3e5bdd[_0xc225('0xb7')](_0x3b64fd[_0xc225('0x47')][_0xc225('0x6e')])[_0xc225('0x1f')](function(){if(_[_0xc225('0xb8')](_0x3b64fd['query'][_0xc225('0x6e')])){for(var _0x5cc998=0x0;_0x5cc998<_0x3b64fd[_0xc225('0x47')]['ids'][_0xc225('0x57')];_0x5cc998+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3b64fd[_0xc225('0x47')][_0xc225('0x6e')][_0x5cc998]),'OpenchannelAccountId':Number(_0x3b64fd[_0xc225('0x69')]['id'])});}}else{socket['emit'](_0xc225('0xb9'),{'UserId':Number(_0x3b64fd[_0xc225('0x47')]['ids']),'OpenchannelAccountId':Number(_0x3b64fd[_0xc225('0x69')]['id'])});}});}})[_0xc225('0x1f')](respondWithStatusCode(_0x3e54a5,null))[_0xc225('0x29')](handleError(_0x3e54a5,null));};exports[_0xc225('0xba')]=function(_0x311721,_0x259ce8,_0x3f2254){var _0x146281={};var _0x3765b2={};var _0x2ca5c9;var _0x1cbf5c;return db[_0xc225('0x42')][_0xc225('0x68')]({'where':{'id':_0x311721['params']['id']}})[_0xc225('0x1f')](handleEntityNotFound(_0x259ce8,null))['then'](function(_0x32fbd7){if(_0x32fbd7){_0x2ca5c9=_0x32fbd7;_0x3765b2['model']=_[_0xc225('0x48')](db['User']['rawAttributes']);_0x3765b2[_0xc225('0x47')]=_[_0xc225('0x48')](_0x311721[_0xc225('0x47')]);_0x3765b2[_0xc225('0x49')]=_['intersection'](_0x3765b2[_0xc225('0x4c')],_0x3765b2[_0xc225('0x47')]);_0x146281['attributes']=_[_0xc225('0x4a')](_0x3765b2['model'],qs[_0xc225('0x4d')](_0x311721[_0xc225('0x47')][_0xc225('0x4d')]));_0x146281[_0xc225('0x4b')]=_0x146281['attributes'][_0xc225('0x57')]?_0x146281[_0xc225('0x4b')]:_0x3765b2['model'];_0x146281[_0xc225('0x6a')]=qs[_0xc225('0x50')](_0x311721[_0xc225('0x47')][_0xc225('0x50')]);_0x146281['where']=qs[_0xc225('0x49')](_['pick'](_0x311721['query'],_0x3765b2['filters']));if(_0x311721[_0xc225('0x47')][_0xc225('0x70')]){_0x146281['where']=_[_0xc225('0x53')](_0x146281[_0xc225('0x51')],{'$or':_[_0xc225('0x46')](_0x146281[_0xc225('0x4b')],function(_0x402e03){var _0x248a69={};_0x248a69[_0x402e03]={'$like':'%'+_0x311721[_0xc225('0x47')][_0xc225('0x70')]+'%'};return _0x248a69;})});}_0x146281=_[_0xc225('0x53')]({},_0x146281,_0x311721['options']);return _0x2ca5c9['getAgents'](_0x146281);}})[_0xc225('0x1f')](function(_0x317fd9){if(_0x317fd9){_0x1cbf5c=_0x317fd9['length'];if(!_0x311721[_0xc225('0x47')]['hasOwnProperty'](_0xc225('0x4f'))){_0x146281[_0xc225('0x2f')]=qs[_0xc225('0x2f')](_0x311721[_0xc225('0x47')][_0xc225('0x2f')]);_0x146281[_0xc225('0x31')]=qs[_0xc225('0x31')](_0x311721[_0xc225('0x47')][_0xc225('0x31')]);}return _0x2ca5c9[_0xc225('0xba')](_0x146281);}})[_0xc225('0x1f')](function(_0x227d14){if(_0x227d14){return _0x227d14?{'count':_0x1cbf5c,'rows':_0x227d14}:null;}})['then'](respondWithResult(_0x259ce8,null))[_0xc225('0x29')](handleError(_0x259ce8,null));};exports[_0xc225('0x3e')]=function(_0x29d876,_0x360189,_0x3fabfe){var _0x551608,_0x3d69d5,_0x515e1b;if(_[_0xc225('0x7b')](_0x29d876[_0xc225('0x62')][_0xc225('0x62')])||_0x29d876[_0xc225('0x62')]['body']===''){throw new db[(_0xc225('0x74'))][(_0xc225('0x7d'))](_0xc225('0xbb'));}if(_[_0xc225('0x7b')](_0x29d876['body']['to'])){}_0x551608=_0x29d876[_0xc225('0x62')]['to'];return db['OpenchannelAccount'][_0xc225('0x68')]({'where':{'id':_0x29d876['params']['id']}})['then'](handleEntityNotFound(_0x360189,null))[_0xc225('0x1f')](function(_0x2c7a96){if(_0x2c7a96){return db[_0xc225('0x42')]['find']({'where':{'id':_0x2c7a96['id']},'include':[{'model':db[_0xc225('0x80')],'as':_0xc225('0x8a'),'include':[{'model':db[_0xc225('0x73')],'as':_0xc225('0x81'),'where':{[_0x2c7a96[_0xc225('0x7f')]]:_0x551608},'limit':0x1,'order':[[_0xc225('0x78'),_0xc225('0x82')]]}]}]})['then'](handleEntityNotFound(_0x360189,null))[_0xc225('0x1f')](function(_0x1daf75){if(_0x1daf75&&_0x1daf75['List']){_0x3d69d5=_0x1daf75['get']({'plain':!![]});if(_0x3d69d5[_0xc225('0x8a')]&&_0x3d69d5[_0xc225('0x8a')][_0xc225('0x81')][_0xc225('0x57')]){return _0x3d69d5[_0xc225('0x8a')][_0xc225('0x81')][0x0];}return db[_0xc225('0x73')][_0xc225('0x5b')](_['defaults'](_0x29d876[_0xc225('0x62')],{'firstName':_0x551608,[_0x1daf75[_0xc225('0x7f')]]:_0x551608,'phone':_0x551608,'ListId':_0x3d69d5[_0xc225('0x7a')]}));}})['then'](handleEntityNotFound(_0x360189,null))[_0xc225('0x1f')](function(_0x36dbe3){if(_0x36dbe3){_0x515e1b=_0x36dbe3;return db[_0xc225('0x91')][_0xc225('0x5a')]({'where':{'ContactId':_0x515e1b['id'],'closed':![],'OpenchannelAccountId':_0x3d69d5['id']}})[_0xc225('0x1f')](function(_0x2a8dbb){if(_0x2a8dbb){return[_0x2a8dbb,![]];}return db[_0xc225('0x91')][_0xc225('0x5b')]({'UserId':_0x29d876[_0xc225('0x5d')]['id'],'ContactId':_0x515e1b['id'],'OpenchannelAccountId':_0x3d69d5['id'],'lastMsgDirection':_0xc225('0xbc'),'firstMsgDirection':_0xc225('0xbc'),'Messages':[_[_0xc225('0x53')](_0x29d876[_0xc225('0x62')],{'read':![],'body':_0x29d876[_0xc225('0x62')]['body'],'OpenchannelAccountId':_0x3d69d5['id'],'UserId':_0x29d876['user']['id'],'ContactId':_0x515e1b['id']})]},{'include':[{'model':db[_0xc225('0x9c')],'as':_0xc225('0xbd')}]})[_0xc225('0x1f')](function(_0x117794){return[_0x117794,!![]];});});}})[_0xc225('0x92')](function(_0x5c877d,_0x4b8efb){if(_0x4b8efb){return _0x5c877d;}return db['OpenchannelMessage'][_0xc225('0x5b')](_[_0xc225('0x53')](_0x29d876['body'],{'read':![],'body':_0x29d876['body']['body'],'OpenchannelAccountId':_0x3d69d5['id'],'OpenchannelInteractionId':_0x5c877d['id'],'UserId':_0x29d876[_0xc225('0x5d')]['id'],'ContactId':_0x515e1b['id']}))['then'](function(_0x3c9f9b){_0x5c877d[_0xc225('0xbe')]['Messages']=[];_0x5c877d[_0xc225('0xbe')][_0xc225('0xbd')]['push'](_0x3c9f9b[_0xc225('0xbe')]);return _0x5c877d;});});}})[_0xc225('0x1f')](respondWithResult(_0x360189,null))[_0xc225('0x29')](handleError(_0x360189,null));}; \ No newline at end of file +var _0xbf18=['DESC','OpenchannelApplication','Applications','account','applications','orderBy','asc','Contacts','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','getInteractions','Contact','Owner','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','OpenchannelMessage','dataValues','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','OpenchannelAccounts','destroy','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xbf18,0xfa));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8bf1('0x0'));var jsonpatch=require(_0x8bf1('0x1'));var rp=require(_0x8bf1('0x2'));var moment=require(_0x8bf1('0x3'));var BPromise=require(_0x8bf1('0x4'));var Mustache=require(_0x8bf1('0x5'));var util=require(_0x8bf1('0x6'));var path=require(_0x8bf1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8bf1('0x8'));var fs=require('fs');var fs_extra=require(_0x8bf1('0x9'));var _=require(_0x8bf1('0xa'));var squel=require(_0x8bf1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8bf1('0xc'));var querystring=require('querystring');var Papa=require(_0x8bf1('0xd'));var Redis=require(_0x8bf1('0xe'));var authService=require(_0x8bf1('0xf'));var qs=require(_0x8bf1('0x10'));var as=require(_0x8bf1('0x11'));var hardwareService=require(_0x8bf1('0x12'));var logger=require(_0x8bf1('0x13'))(_0x8bf1('0x14'));var utils=require(_0x8bf1('0x15'));var config=require(_0x8bf1('0x16'));var licenseUtil=require(_0x8bf1('0x17'));var db=require(_0x8bf1('0x18'))['db'];config[_0x8bf1('0x19')]=_[_0x8bf1('0x1a')](config['redis'],{'host':_0x8bf1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf1('0x19')]));require(_0x8bf1('0x1c'))['register'](socket);var jayson=require(_0x8bf1('0x1d'));var client=jayson[_0x8bf1('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x8bf1('0x1e')][_0x8bf1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x59b567,_0xc0a8e,_0x570d04,_0xd9db45){return new BPromise(function(_0x11ab16,_0x532f2c){var _0x50dffa=_0xd9db45||client;return _0x50dffa[_0x8bf1('0x20')](_0x59b567,_0x570d04)['then'](function(_0x32ca31){logger['info'](_0x8bf1('0x21'),_0xc0a8e,_0x8bf1('0x22'));logger[_0x8bf1('0x23')](_0x8bf1('0x24'),_0xc0a8e,_0x8bf1('0x22'),JSON[_0x8bf1('0x25')](_0x32ca31));if(_0x32ca31[_0x8bf1('0x26')]){if(_0x32ca31[_0x8bf1('0x26')][_0x8bf1('0x27')]===0x1f4){logger[_0x8bf1('0x26')](_0x8bf1('0x21'),_0xc0a8e,_0x32ca31['error']['message']);return _0x532f2c(_0x32ca31['error'][_0x8bf1('0x28')]);}logger[_0x8bf1('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0xc0a8e,_0x32ca31[_0x8bf1('0x26')][_0x8bf1('0x28')]);return _0x11ab16(_0x32ca31[_0x8bf1('0x26')]['message']);}else{logger[_0x8bf1('0x29')](_0x8bf1('0x21'),_0xc0a8e,_0x8bf1('0x22'));_0x11ab16(_0x32ca31['result'][_0x8bf1('0x28')]);}})['catch'](function(_0x22a8d4){logger[_0x8bf1('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0xc0a8e,_0x22a8d4);_0x532f2c(_0x22a8d4);});});}function respondWithStatusCode(_0x22d610,_0x57c532){_0x57c532=_0x57c532||0xcc;return function(_0x318f8e){if(_0x318f8e){return _0x22d610[_0x8bf1('0x2a')](_0x57c532);}return _0x22d610[_0x8bf1('0x2b')](_0x57c532)[_0x8bf1('0x2c')]();};}function respondWithResult(_0x35b63d,_0x3614d7){_0x3614d7=_0x3614d7||0xc8;return function(_0x30d45e){if(_0x30d45e){return _0x35b63d[_0x8bf1('0x2b')](_0x3614d7)[_0x8bf1('0x2d')](_0x30d45e);}};}function respondWithFilteredResult(_0x3fc608,_0x280ea4){return function(_0x570380){if(_0x570380){var _0x40943f=typeof _0x280ea4[_0x8bf1('0x2e')]===_0x8bf1('0x2f')&&typeof _0x280ea4[_0x8bf1('0x30')]===_0x8bf1('0x2f');var _0x2d7ed3=_0x570380[_0x8bf1('0x31')];var _0x1836c0=_0x40943f?0x0:_0x280ea4[_0x8bf1('0x2e')];var _0xd2150a=_0x40943f?_0x570380[_0x8bf1('0x31')]:_0x280ea4['offset']+_0x280ea4[_0x8bf1('0x30')];var _0x11968f;if(_0xd2150a>=_0x2d7ed3){_0xd2150a=_0x2d7ed3;_0x11968f=0xc8;}else{_0x11968f=0xce;}_0x3fc608['status'](_0x11968f);return _0x3fc608[_0x8bf1('0x32')](_0x8bf1('0x33'),_0x1836c0+'-'+_0xd2150a+'/'+_0x2d7ed3)[_0x8bf1('0x2d')](_0x570380);}return null;};}function patchUpdates(_0x1e22ad){return function(_0x5bdda0){try{jsonpatch[_0x8bf1('0x34')](_0x5bdda0,_0x1e22ad,!![]);}catch(_0x537180){return BPromise['reject'](_0x537180);}return _0x5bdda0['save']();};}function saveUpdates(_0x1f3406,_0x255772){return function(_0x259e95){if(_0x259e95){return _0x259e95[_0x8bf1('0x35')](_0x1f3406)[_0x8bf1('0x36')](function(_0x330090){return _0x330090;});}return null;};}function removeEntity(_0x56fc87,_0x297858){return function(_0x2eb511){if(_0x2eb511){return _0x2eb511['destroy']()[_0x8bf1('0x36')](function(){var _0x122517=_0x2eb511[_0x8bf1('0x37')]({'plain':!![]});var _0x3a1ad8=_0x8bf1('0x38');return db['UserProfileResource'][_0x8bf1('0x39')]({'where':{'type':_0x3a1ad8,'resourceId':_0x122517['id']}})[_0x8bf1('0x36')](function(){return _0x2eb511;});})[_0x8bf1('0x36')](function(){_0x56fc87['status'](0xcc)[_0x8bf1('0x2c')]();});}};}function handleEntityNotFound(_0x1be41c,_0x7f565c){return function(_0x129fcc){if(!_0x129fcc){_0x1be41c[_0x8bf1('0x2a')](0x194);}return _0x129fcc;};}function handleError(_0x14b582,_0x2598f7){_0x2598f7=_0x2598f7||0x1f4;return function(_0x3f260d){logger[_0x8bf1('0x26')](_0x3f260d[_0x8bf1('0x3a')]);if(_0x3f260d['name']){delete _0x3f260d[_0x8bf1('0x3b')];}_0x14b582['status'](_0x2598f7)[_0x8bf1('0x3c')](_0x3f260d);};}exports[_0x8bf1('0x3d')]=function(_0x5397af,_0x29c0c6){var _0x380aa9={'include':[{'model':db[_0x8bf1('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3bc706={},_0x5e20a4={'count':0x0,'rows':[]};var _0xad26d6=_[_0x8bf1('0x3f')](db['OpenchannelAccount'][_0x8bf1('0x40')],function(_0x248901){return{'name':_0x248901['fieldName'],'type':_0x248901[_0x8bf1('0x41')][_0x8bf1('0x42')]};});_0x3bc706[_0x8bf1('0x43')]=_[_0x8bf1('0x3f')](_0xad26d6,'name');_0x3bc706['query']=_['keys'](_0x5397af[_0x8bf1('0x44')]);_0x3bc706[_0x8bf1('0x45')]=_[_0x8bf1('0x46')](_0x3bc706['model'],_0x3bc706['query']);_0x380aa9[_0x8bf1('0x47')]=_[_0x8bf1('0x46')](_0x3bc706[_0x8bf1('0x43')],qs[_0x8bf1('0x48')](_0x5397af['query'][_0x8bf1('0x48')]));_0x380aa9['attributes']=_0x380aa9[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x380aa9[_0x8bf1('0x47')]:_0x3bc706[_0x8bf1('0x43')];if(!_0x5397af[_0x8bf1('0x44')][_0x8bf1('0x4a')]('nolimit')){_0x380aa9['limit']=qs['limit'](_0x5397af[_0x8bf1('0x44')][_0x8bf1('0x30')]);_0x380aa9[_0x8bf1('0x2e')]=qs[_0x8bf1('0x2e')](_0x5397af['query']['offset']);}_0x380aa9[_0x8bf1('0x4b')]=qs[_0x8bf1('0x4c')](_0x5397af[_0x8bf1('0x44')][_0x8bf1('0x4c')]);_0x380aa9[_0x8bf1('0x4d')]=qs[_0x8bf1('0x45')](_['pick'](_0x5397af[_0x8bf1('0x44')],_0x3bc706[_0x8bf1('0x45')]),_0xad26d6);if(_0x5397af[_0x8bf1('0x44')]['filter']){_0x380aa9[_0x8bf1('0x4d')]=_[_0x8bf1('0x4e')](_0x380aa9[_0x8bf1('0x4d')],{'$or':_[_0x8bf1('0x3f')](_0xad26d6,function(_0x42bf87){if(_0x42bf87[_0x8bf1('0x41')]!==_0x8bf1('0x4f')){var _0x4d725b={};_0x4d725b[_0x42bf87['name']]={'$like':'%'+_0x5397af[_0x8bf1('0x44')][_0x8bf1('0x50')]+'%'};return _0x4d725b;}})});}_0x380aa9=_[_0x8bf1('0x4e')]({},_0x380aa9,_0x5397af[_0x8bf1('0x51')]);var _0xecadf6={'where':_0x380aa9[_0x8bf1('0x4d')]};return db['OpenchannelAccount']['count'](_0xecadf6)[_0x8bf1('0x36')](function(_0x471dff){_0x5e20a4[_0x8bf1('0x31')]=_0x471dff;if(_0x5397af[_0x8bf1('0x44')][_0x8bf1('0x52')]){_0x380aa9[_0x8bf1('0x53')]=[{'all':!![]}];}return db[_0x8bf1('0x54')][_0x8bf1('0x55')](_0x380aa9);})['then'](function(_0x540f6d){_0x5e20a4[_0x8bf1('0x56')]=_0x540f6d;return _0x5e20a4;})[_0x8bf1('0x36')](respondWithFilteredResult(_0x29c0c6,_0x380aa9))[_0x8bf1('0x57')](handleError(_0x29c0c6,null));};exports[_0x8bf1('0x58')]=function(_0x2134ae,_0x492da3){var _0x369da4={'raw':![],'where':{'id':_0x2134ae[_0x8bf1('0x59')]['id']},'include':[{'model':db[_0x8bf1('0x3e')],'as':_0x8bf1('0x5a')}]},_0x201296={};_0x201296[_0x8bf1('0x43')]=_[_0x8bf1('0x5b')](db[_0x8bf1('0x54')]['rawAttributes']);_0x201296[_0x8bf1('0x44')]=_['keys'](_0x2134ae['query']);_0x201296[_0x8bf1('0x45')]=_[_0x8bf1('0x46')](_0x201296[_0x8bf1('0x43')],_0x201296[_0x8bf1('0x44')]);_0x369da4['attributes']=_['intersection'](_0x201296[_0x8bf1('0x43')],qs[_0x8bf1('0x48')](_0x2134ae[_0x8bf1('0x44')][_0x8bf1('0x48')]));_0x369da4[_0x8bf1('0x47')]=_0x369da4[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x369da4[_0x8bf1('0x47')]:_0x201296[_0x8bf1('0x43')];if(_0x2134ae['query'][_0x8bf1('0x52')]){_0x369da4[_0x8bf1('0x53')]=[{'all':!![]}];}_0x369da4=_['merge']({},_0x369da4,_0x2134ae[_0x8bf1('0x51')]);return db['OpenchannelAccount']['find'](_0x369da4)[_0x8bf1('0x36')](handleEntityNotFound(_0x492da3,null))[_0x8bf1('0x36')](respondWithResult(_0x492da3,null))['catch'](handleError(_0x492da3,null));};exports['create']=function(_0x50cebf,_0x5c31a1){return db['OpenchannelAccount'][_0x8bf1('0x5c')](_0x50cebf[_0x8bf1('0x5d')],{})['then'](function(_0x11bd9e){var _0x403ca4=_0x50cebf[_0x8bf1('0x5e')][_0x8bf1('0x37')]({'plain':!![]});if(!_0x403ca4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403ca4[_0x8bf1('0x5f')]==='user'){var _0xc3f7b9=_0x11bd9e['get']({'plain':!![]});var _0xb38827=_0x8bf1('0x38');return db[_0x8bf1('0x60')][_0x8bf1('0x61')]({'where':{'name':_0xb38827,'userProfileId':_0x403ca4[_0x8bf1('0x62')]},'raw':!![]})['then'](function(_0xb024b8){if(_0xb024b8&&_0xb024b8['autoAssociation']===0x0){return db['UserProfileResource'][_0x8bf1('0x5c')]({'name':_0xc3f7b9[_0x8bf1('0x3b')],'resourceId':_0xc3f7b9['id'],'type':_0xb024b8[_0x8bf1('0x3b')],'sectionId':_0xb024b8['id']},{})[_0x8bf1('0x36')](function(){return _0x11bd9e;});}else{return _0x11bd9e;}})[_0x8bf1('0x57')](function(_0x21640f){logger['error'](_0x8bf1('0x63'),_0x21640f);throw _0x21640f;});}return _0x11bd9e;})[_0x8bf1('0x36')](respondWithResult(_0x5c31a1,0xc9))[_0x8bf1('0x57')](handleError(_0x5c31a1,null));};exports[_0x8bf1('0x35')]=function(_0x44137e,_0x5c318c){if(_0x44137e[_0x8bf1('0x5d')]['id']){delete _0x44137e[_0x8bf1('0x5d')]['id'];}return db[_0x8bf1('0x54')][_0x8bf1('0x61')]({'where':{'id':_0x44137e[_0x8bf1('0x59')]['id']},'include':[{'model':db[_0x8bf1('0x3e')],'as':_0x8bf1('0x5a')}]})[_0x8bf1('0x36')](handleEntityNotFound(_0x5c318c,null))['then'](saveUpdates(_0x44137e[_0x8bf1('0x5d')],null))[_0x8bf1('0x36')](respondWithResult(_0x5c318c,null))[_0x8bf1('0x57')](handleError(_0x5c318c,null));};exports['destroy']=function(_0x32414c,_0x51f921){return db[_0x8bf1('0x54')][_0x8bf1('0x61')]({'where':{'id':_0x32414c[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x51f921,null))[_0x8bf1('0x36')](removeEntity(_0x51f921,null))['catch'](handleError(_0x51f921,null));};exports[_0x8bf1('0x64')]=function(_0x3ca32e,_0x3b69ee){return db[_0x8bf1('0x54')]['describe']()['then'](respondWithResult(_0x3b69ee,null))[_0x8bf1('0x57')](handleError(_0x3b69ee,null));};exports[_0x8bf1('0x65')]=function(_0x293ee5,_0x3b5aaa,_0x2afb24){if(_0x293ee5[_0x8bf1('0x5d')]['id']){delete _0x293ee5['body']['id'];}return db[_0x8bf1('0x54')][_0x8bf1('0x61')]({'where':{'id':_0x293ee5['params']['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x3b5aaa,null))[_0x8bf1('0x36')](function(_0x529321){if(_0x529321){_0x293ee5[_0x8bf1('0x5d')][_0x8bf1('0x66')]=_0x529321['id'];return db[_0x8bf1('0x67')][_0x8bf1('0x5c')](_0x293ee5['body']);}})['then'](respondWithResult(_0x3b5aaa,null))[_0x8bf1('0x57')](handleError(_0x3b5aaa,null));};exports[_0x8bf1('0x68')]=function(_0x36c828,_0x1d3d25,_0x3c360f){var _0x557e17={'raw':![],'where':{}};var _0x1d783e={};var _0x5d7041={'count':0x0,'rows':[]};return db[_0x8bf1('0x54')][_0x8bf1('0x69')]({'where':{'id':_0x36c828[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x1d3d25,null))[_0x8bf1('0x36')](function(_0x835afe){if(_0x835afe){_0x1d783e[_0x8bf1('0x43')]=_['keys'](db['Disposition']['rawAttributes']);_0x1d783e[_0x8bf1('0x44')]=_['keys'](_0x36c828[_0x8bf1('0x44')]);_0x1d783e['filters']=_['intersection'](_0x1d783e[_0x8bf1('0x43')],_0x1d783e[_0x8bf1('0x44')]);_0x557e17[_0x8bf1('0x47')]=_[_0x8bf1('0x46')](_0x1d783e[_0x8bf1('0x43')],qs[_0x8bf1('0x48')](_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x48')]));_0x557e17[_0x8bf1('0x47')]=_0x557e17[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x557e17[_0x8bf1('0x47')]:_0x1d783e[_0x8bf1('0x43')];if(!_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x4a')](_0x8bf1('0x6a'))){_0x557e17[_0x8bf1('0x30')]=qs[_0x8bf1('0x30')](_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x30')]);_0x557e17[_0x8bf1('0x2e')]=qs[_0x8bf1('0x2e')](_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x2e')]);}_0x557e17[_0x8bf1('0x4b')]=qs[_0x8bf1('0x4c')](_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x4c')]);_0x557e17['where']=qs[_0x8bf1('0x45')](_[_0x8bf1('0x6b')](_0x36c828[_0x8bf1('0x44')],_0x1d783e[_0x8bf1('0x45')]));_0x557e17[_0x8bf1('0x4d')][_0x8bf1('0x66')]=_0x835afe['id'];if(_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x50')]){_0x557e17['where']=_[_0x8bf1('0x4e')](_0x557e17[_0x8bf1('0x4d')],{'$or':_['map'](_0x557e17['attributes'],function(_0x567213){var _0x50e35c={};_0x50e35c[_0x567213]={'$like':'%'+_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x50')]+'%'};return _0x50e35c;})});}_0x557e17=_[_0x8bf1('0x4e')]({},_0x557e17,_0x36c828['options']);return db[_0x8bf1('0x67')][_0x8bf1('0x31')]({'where':_0x557e17[_0x8bf1('0x4d')]})[_0x8bf1('0x36')](function(_0xb7aca){_0x5d7041[_0x8bf1('0x31')]=_0xb7aca;if(_0x36c828[_0x8bf1('0x44')][_0x8bf1('0x52')]){_0x557e17[_0x8bf1('0x53')]=[{'all':!![]}];}return db[_0x8bf1('0x67')][_0x8bf1('0x55')](_0x557e17);})[_0x8bf1('0x36')](function(_0xc8b75){_0x5d7041[_0x8bf1('0x56')]=_0xc8b75;return _0x5d7041;});}})[_0x8bf1('0x36')](respondWithFilteredResult(_0x1d3d25,_0x557e17))[_0x8bf1('0x57')](handleError(_0x1d3d25,null));};exports[_0x8bf1('0x6c')]=function(_0x2f21a4,_0x301b70,_0x407a88){return db[_0x8bf1('0x54')]['find']({'where':{'id':_0x2f21a4[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x301b70,null))[_0x8bf1('0x36')](function(_0x46f1b4){if(_0x46f1b4){return _0x46f1b4[_0x8bf1('0x6c')](_0x2f21a4[_0x8bf1('0x44')][_0x8bf1('0x6d')]);}})[_0x8bf1('0x36')](respondWithStatusCode(_0x301b70,null))[_0x8bf1('0x57')](handleError(_0x301b70,null));};exports[_0x8bf1('0x6e')]=function(_0x29fc45,_0x2979dc,_0x425d68){if(_0x29fc45[_0x8bf1('0x5d')]['id']){delete _0x29fc45[_0x8bf1('0x5d')]['id'];}return db[_0x8bf1('0x54')]['find']({'where':{'id':_0x29fc45[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x2979dc,null))[_0x8bf1('0x36')](function(_0x5c8de3){if(_0x5c8de3){_0x29fc45[_0x8bf1('0x5d')][_0x8bf1('0x66')]=_0x5c8de3['id'];return db[_0x8bf1('0x6f')][_0x8bf1('0x5c')](_0x29fc45[_0x8bf1('0x5d')]);}})[_0x8bf1('0x36')](respondWithResult(_0x2979dc,null))[_0x8bf1('0x57')](handleError(_0x2979dc,null));};exports[_0x8bf1('0x70')]=function(_0x194acc,_0x230308,_0x5c1771){var _0x100daa={'raw':![],'where':{}};var _0x3bd605={};var _0x196001={'count':0x0,'rows':[]};return db[_0x8bf1('0x54')][_0x8bf1('0x69')]({'where':{'id':_0x194acc['params']['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x230308,null))[_0x8bf1('0x36')](function(_0xfa2c27){if(_0xfa2c27){_0x3bd605[_0x8bf1('0x43')]=_[_0x8bf1('0x5b')](db['CannedAnswer'][_0x8bf1('0x40')]);_0x3bd605[_0x8bf1('0x44')]=_['keys'](_0x194acc[_0x8bf1('0x44')]);_0x3bd605['filters']=_[_0x8bf1('0x46')](_0x3bd605['model'],_0x3bd605[_0x8bf1('0x44')]);_0x100daa[_0x8bf1('0x47')]=_[_0x8bf1('0x46')](_0x3bd605[_0x8bf1('0x43')],qs['fields'](_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x48')]));_0x100daa[_0x8bf1('0x47')]=_0x100daa[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x100daa[_0x8bf1('0x47')]:_0x3bd605['model'];if(!_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x4a')](_0x8bf1('0x6a'))){_0x100daa[_0x8bf1('0x30')]=qs['limit'](_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x30')]);_0x100daa[_0x8bf1('0x2e')]=qs[_0x8bf1('0x2e')](_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x2e')]);}_0x100daa[_0x8bf1('0x4b')]=qs[_0x8bf1('0x4c')](_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x4c')]);_0x100daa[_0x8bf1('0x4d')]=qs[_0x8bf1('0x45')](_[_0x8bf1('0x6b')](_0x194acc[_0x8bf1('0x44')],_0x3bd605['filters']));_0x100daa[_0x8bf1('0x4d')][_0x8bf1('0x66')]=_0xfa2c27['id'];if(_0x194acc['query']['filter']){_0x100daa[_0x8bf1('0x4d')]=_[_0x8bf1('0x4e')](_0x100daa[_0x8bf1('0x4d')],{'$or':_[_0x8bf1('0x3f')](_0x100daa[_0x8bf1('0x47')],function(_0x5313f7){var _0x25170d={};_0x25170d[_0x5313f7]={'$like':'%'+_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x50')]+'%'};return _0x25170d;})});}_0x100daa=_[_0x8bf1('0x4e')]({},_0x100daa,_0x194acc[_0x8bf1('0x51')]);return db['CannedAnswer'][_0x8bf1('0x31')]({'where':_0x100daa[_0x8bf1('0x4d')]})[_0x8bf1('0x36')](function(_0x541045){_0x196001[_0x8bf1('0x31')]=_0x541045;if(_0x194acc[_0x8bf1('0x44')][_0x8bf1('0x52')]){_0x100daa[_0x8bf1('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8bf1('0x55')](_0x100daa);})[_0x8bf1('0x36')](function(_0x5e398e){_0x196001[_0x8bf1('0x56')]=_0x5e398e;return _0x196001;});}})[_0x8bf1('0x36')](respondWithFilteredResult(_0x230308,_0x100daa))[_0x8bf1('0x57')](handleError(_0x230308,null));};exports[_0x8bf1('0x71')]=function(_0x3356d9,_0x345375,_0x1b3a11){return db[_0x8bf1('0x54')][_0x8bf1('0x61')]({'where':{'id':_0x3356d9['params']['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x345375,null))[_0x8bf1('0x36')](function(_0x3fe49d){if(_0x3fe49d){return _0x3fe49d['removeAnswers'](_0x3356d9[_0x8bf1('0x44')][_0x8bf1('0x6d')]);}})[_0x8bf1('0x36')](respondWithStatusCode(_0x345375,null))['catch'](handleError(_0x345375,null));};exports[_0x8bf1('0x72')]=function(_0x4f4c50,_0x4219a6,_0x2115d6){var _0x67af5a={'body':_0x4f4c50[_0x8bf1('0x5d')],'channel':_0x8bf1('0x73')};var _0x40fa7f=[];var _0x566caa=[];var _0x14f493={};var _0xbe1b39=![];return db[_0x8bf1('0x74')][_0x8bf1('0x64')]()['then'](function(_0x316a93){if(!_0x316a93){throw new db[(_0x8bf1('0x75'))][(_0x8bf1('0x76'))](_0x8bf1('0x77'));}_0x40fa7f=_[_0x8bf1('0x78')](_[_0x8bf1('0x5b')](_0x316a93),[_0x8bf1('0x79'),'updatedAt']);_0x566caa=_['difference'](_[_0x8bf1('0x5b')](_0x316a93),[_0x8bf1('0x79'),_0x8bf1('0x7a'),_0x8bf1('0x7b'),_0x8bf1('0x7c')]);if(_0x4f4c50[_0x8bf1('0x5d')]['id']){delete _0x4f4c50['body']['id'];}if(_['isNil'](_0x4f4c50[_0x8bf1('0x5d')]['from'])){throw new db['Sequelize']['ValidationError'](_0x8bf1('0x7d'));}if(_[_0x8bf1('0x7e')](_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x5d')])||_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x5d')]===''){throw new db[(_0x8bf1('0x75'))][(_0x8bf1('0x76'))](_0x8bf1('0x7f'));}if(_['isNil'](_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x80')])){throw new db[(_0x8bf1('0x75'))]['ValidationError'](_0x8bf1('0x81')+_0x566caa);}if(!_[_0x8bf1('0x82')](_0x566caa,_0x4f4c50['body'][_0x8bf1('0x80')])){throw new db[(_0x8bf1('0x75'))][(_0x8bf1('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x566caa);}_0x14f493[_0x4f4c50['body'][_0x8bf1('0x80')]]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x83')];})[_0x8bf1('0x36')](function(){return db[_0x8bf1('0x54')][_0x8bf1('0x61')]({'where':{'id':_0x4f4c50[_0x8bf1('0x59')]['id']},'include':[{'model':db[_0x8bf1('0x84')],'as':_0x8bf1('0x85'),'include':[{'model':db[_0x8bf1('0x74')],'as':'Contacts','where':_0x14f493,'limit':0x1,'order':[[_0x8bf1('0x7a'),_0x8bf1('0x86')]]}]},{'model':db[_0x8bf1('0x87')],'as':_0x8bf1('0x88')}]});})['then'](handleEntityNotFound(_0x4219a6,null))[_0x8bf1('0x36')](function(_0x344dd2){if(_0x344dd2&&_0x344dd2['List']){_0x67af5a[_0x8bf1('0x89')]=_0x344dd2;_0x67af5a[_0x8bf1('0x8a')]=_0x344dd2[_0x8bf1('0x88')];_0x67af5a['list']=_0x344dd2['List'];_0x67af5a[_0x8bf1('0x8a')]=_[_0x8bf1('0x8b')](_0x67af5a[_0x8bf1('0x8a')],['priority'],[_0x8bf1('0x8c')]);if(_0x67af5a['account'][_0x8bf1('0x88')]){delete _0x67af5a[_0x8bf1('0x89')][_0x8bf1('0x88')];}if(_0x67af5a['account'][_0x8bf1('0x85')]&&_0x67af5a[_0x8bf1('0x89')][_0x8bf1('0x85')][_0x8bf1('0x8d')]['length']){return _0x67af5a[_0x8bf1('0x89')][_0x8bf1('0x85')][_0x8bf1('0x8d')][0x0];}var _0x17b78a=_['defaults'](_0x4f4c50[_0x8bf1('0x5d')],{'firstName':_0x4f4c50['body'][_0x8bf1('0x83')],'ListId':_0x344dd2[_0x8bf1('0x7c')]});_0x17b78a[_0x4f4c50['body'][_0x8bf1('0x80')]]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x83')];return db[_0x8bf1('0x74')]['create'](_0x17b78a,{'fields':_0x40fa7f,'raw':!![]});}})[_0x8bf1('0x36')](handleEntityNotFound(_0x4219a6,null))[_0x8bf1('0x36')](function(_0x376c8e){_0x67af5a['contact']=_0x376c8e;if(_0x376c8e){var _0x4abddf={'ContactId':_0x376c8e['id'],'OpenchannelAccountId':_0x4f4c50[_0x8bf1('0x59')]['id'],'from':(_0x376c8e[_0x8bf1('0x8e')]||'')+'\x20'+(_0x376c8e['lastName']||'')};var _0x299be7={'OpenchannelAccountId':_0x4f4c50[_0x8bf1('0x59')]['id'],'closed':![]};if(_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x8f')]){_0x299be7[_0x8bf1('0x8f')]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x8f')];return db[_0x8bf1('0x90')][_0x8bf1('0x61')]({'where':_0x299be7})[_0x8bf1('0x36')](function(_0x4379f4){if(_0x4379f4){return[_0x4379f4,![]];}_0x4abddf[_0x8bf1('0x8f')]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x8f')];_0x4abddf[_0x8bf1('0x91')]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x91')];return db[_0x8bf1('0x90')]['create'](_0x4abddf)[_0x8bf1('0x36')](function(_0x5003c9){return[_0x5003c9,!![]];});});}else{_0x299be7[_0x8bf1('0x8f')]=null;}_0x299be7['ContactId']=_0x376c8e['id'];return db[_0x8bf1('0x90')][_0x8bf1('0x61')]({'where':_0x299be7})[_0x8bf1('0x36')](function(_0x403f59){if(_0x403f59){return[_0x403f59,![]];}return db[_0x8bf1('0x90')][_0x8bf1('0x5c')](_0x4abddf)[_0x8bf1('0x36')](function(_0x5856ea){return[_0x5856ea,!![]];});});}})[_0x8bf1('0x92')](function(_0x1fddb3,_0x32af4f){if(_0x1fddb3){_0xbe1b39=_0x32af4f;if(!_0x32af4f){var _0x308c74={'from':(_0x67af5a[_0x8bf1('0x93')]['firstName']||'')+'\x20'+(_0x67af5a[_0x8bf1('0x93')][_0x8bf1('0x94')]||'')};if(_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x8f')]&&_0x4f4c50['body'][_0x8bf1('0x95')]&&_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x8f')]!=_0x4f4c50['body'][_0x8bf1('0x95')]){_0x308c74[_0x8bf1('0x8f')]=_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x95')];}return _0x1fddb3[_0x8bf1('0x35')](_0x308c74);}else{return _0x1fddb3;}}})[_0x8bf1('0x36')](function(_0x2b5e25){_0x67af5a[_0x8bf1('0x96')]=_0x2b5e25[_0x8bf1('0x37')]({'plain':!![]});_0x67af5a['interaction'][_0x8bf1('0x97')]=_0xbe1b39;if(_0x67af5a[_0x8bf1('0x96')][_0x8bf1('0x97')]){if(_0x67af5a[_0x8bf1('0x89')]['autoclose']){_0x67af5a['applications'][_0x8bf1('0x98')]({'id':0x0,'priority':_0x67af5a['applications'][_0x8bf1('0x49')]+0x1,'app':_0x8bf1('0x99'),'appdata':_0x8bf1('0x9a'),'interval':_0x8bf1('0x9b')});}}return db['OpenchannelMessage'][_0x8bf1('0x5c')]({'body':_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x5d')],'OpenchannelAccountId':_0x4f4c50[_0x8bf1('0x59')]['id'],'OpenchannelInteractionId':_0x2b5e25['id'],'direction':'in','ContactId':_0x67af5a[_0x8bf1('0x93')]['id'],'AttachmentId':_0x4f4c50[_0x8bf1('0x5d')][_0x8bf1('0x9c')]});})[_0x8bf1('0x36')](function(_0x4ca6f9){_0x67af5a[_0x8bf1('0x28')]=_0x4ca6f9;if(_0x67af5a[_0x8bf1('0x96')][_0x8bf1('0x9d')]){return db[_0x8bf1('0x9e')][_0x8bf1('0x61')]({'attributes':['id',_0x8bf1('0x3b')],'where':{'id':_0x67af5a[_0x8bf1('0x96')][_0x8bf1('0x9d')]}})[_0x8bf1('0x36')](function(_0x398ca2){if(_0x398ca2){_0x67af5a[_0x8bf1('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8bf1('0x9f'),'appdata':_0x398ca2['name']+','+(_0x67af5a[_0x8bf1('0x89')][_0x8bf1('0xa0')]||0xa),'interval':_0x8bf1('0x9b')});_0x67af5a[_0x8bf1('0xa1')]=![];}return respondWithRpcPromise(_0x8bf1('0xa2'),_0x8bf1('0xa3'),_0x67af5a);});}return respondWithRpcPromise(_0x8bf1('0xa2'),'startRouting',_0x67af5a);})['then'](function(_0x5927d7){respondWithRpcPromise(_0x8bf1('0xa4'),'EventManager',{'event':'notify','message':_0x5927d7},client9002);return _0x5927d7;})[_0x8bf1('0x36')](respondWithResult(_0x4219a6,null))[_0x8bf1('0x57')](handleError(_0x4219a6,null));};exports['addApplications']=function(_0x4113e7,_0x57c8ec){var _0xaa5e6b=_0x4113e7[_0x8bf1('0x59')]['id'];var _0x40bef8=_0x4113e7[_0x8bf1('0x5d')];var _0x54f533=0xc8;var _0x2b13a2=null;return db[_0x8bf1('0xa5')][_0x8bf1('0xa6')]({'isolationLevel':db[_0x8bf1('0xa5')][_0x8bf1('0xa7')][_0x8bf1('0xa8')][_0x8bf1('0xa9')]},function(_0x27f422){return db[_0x8bf1('0x54')][_0x8bf1('0x69')]({'where':{'id':_0xaa5e6b},'transaction':_0x27f422})[_0x8bf1('0x36')](function(_0x1dd47b){if(_0x1dd47b){return db[_0x8bf1('0x87')][_0x8bf1('0x39')]({'where':{'OpenchannelAccountId':_0xaa5e6b},'transaction':_0x27f422})[_0x8bf1('0x36')](function(){var _0x2edb7c=_['map'](_0x40bef8,function(_0x490ae9){_0x490ae9[_0x8bf1('0x66')]=_0xaa5e6b;return _0x490ae9;});return db[_0x8bf1('0x87')][_0x8bf1('0xaa')](_0x2edb7c,{'transaction':_0x27f422});});}else{_0x54f533=0x194;_0x2b13a2=[];}});})[_0x8bf1('0x36')](function(){if(_0x54f533!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0xaa5e6b},'order':_0x8bf1('0xab')})[_0x8bf1('0x36')](function(_0x427567){_0x2b13a2=_0x427567;});}})[_0x8bf1('0x57')](function(_0x351bf3){_0x54f533=0x1f4;logger[_0x8bf1('0x26')](_0x351bf3[_0x8bf1('0x3a')]);if(_0x351bf3[_0x8bf1('0x3b')]){delete _0x351bf3[_0x8bf1('0x3b')];}_0x2b13a2=_0x351bf3;})[_0x8bf1('0xac')](function(){if(_0x2b13a2===null){_0x57c8ec[_0x8bf1('0x2a')](_0x54f533);}else{if(_0x54f533===0x1f4){_0x57c8ec['status'](_0x54f533)[_0x8bf1('0x3c')](_0x2b13a2);}else{_0x57c8ec[_0x8bf1('0x2b')](_0x54f533)[_0x8bf1('0x2d')](_0x2b13a2);}}});};exports[_0x8bf1('0xad')]=function(_0x1cafc6,_0x2aa956,_0x40b321){var _0x144e27={};var _0x3d4c8b={};var _0x1a827c;var _0x405d0a;return db['OpenchannelAccount'][_0x8bf1('0x69')]({'where':{'id':_0x1cafc6[_0x8bf1('0x59')]['id']}})['then'](handleEntityNotFound(_0x2aa956,null))[_0x8bf1('0x36')](function(_0x29ecd9){if(_0x29ecd9){_0x1a827c=_0x29ecd9;_0x3d4c8b[_0x8bf1('0x43')]=_[_0x8bf1('0x5b')](db[_0x8bf1('0x87')][_0x8bf1('0x40')]);_0x3d4c8b['query']=_['keys'](_0x1cafc6[_0x8bf1('0x44')]);_0x3d4c8b[_0x8bf1('0x45')]=_[_0x8bf1('0x46')](_0x3d4c8b[_0x8bf1('0x43')],_0x3d4c8b[_0x8bf1('0x44')]);_0x144e27[_0x8bf1('0x47')]=_[_0x8bf1('0x46')](_0x3d4c8b[_0x8bf1('0x43')],qs[_0x8bf1('0x48')](_0x1cafc6['query'][_0x8bf1('0x48')]));_0x144e27[_0x8bf1('0x47')]=_0x144e27[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x144e27[_0x8bf1('0x47')]:_0x3d4c8b[_0x8bf1('0x43')];_0x144e27[_0x8bf1('0x4b')]=qs[_0x8bf1('0x4c')](_0x1cafc6[_0x8bf1('0x44')][_0x8bf1('0x4c')]);_0x144e27[_0x8bf1('0x4d')]=qs['filters'](_['pick'](_0x1cafc6[_0x8bf1('0x44')],_0x3d4c8b[_0x8bf1('0x45')]));if(_0x1cafc6['query'][_0x8bf1('0x50')]){_0x144e27[_0x8bf1('0x4d')]=_[_0x8bf1('0x4e')](_0x144e27[_0x8bf1('0x4d')],{'$or':_[_0x8bf1('0x3f')](_0x144e27['attributes'],function(_0x55b3b2){var _0xca12cb={};_0xca12cb[_0x55b3b2]={'$like':'%'+_0x1cafc6[_0x8bf1('0x44')][_0x8bf1('0x50')]+'%'};return _0xca12cb;})});}_0x144e27=_[_0x8bf1('0x4e')]({},_0x144e27,_0x1cafc6['options']);return _0x1a827c['getApplications'](_0x144e27);}})['then'](function(_0x345b54){if(_0x345b54){_0x405d0a=_0x345b54['length'];if(!_0x1cafc6['query']['hasOwnProperty']('nolimit')){_0x144e27[_0x8bf1('0x30')]=qs[_0x8bf1('0x30')](_0x1cafc6['query'][_0x8bf1('0x30')]);_0x144e27['offset']=qs[_0x8bf1('0x2e')](_0x1cafc6[_0x8bf1('0x44')][_0x8bf1('0x2e')]);}return _0x1a827c['getApplications'](_0x144e27);}})['then'](function(_0xa05918){if(_0xa05918){return _0xa05918?{'count':_0x405d0a,'rows':_0xa05918}:null;}})[_0x8bf1('0x36')](respondWithResult(_0x2aa956,null))['catch'](handleError(_0x2aa956,null));};exports[_0x8bf1('0xae')]=function(_0x144a4a,_0x16b24d,_0x52b4b7){var _0x3217d4={'raw':![],'where':{}};var _0x3083a3={};var _0x5771f4={'count':0x0,'rows':[]};return db[_0x8bf1('0x54')]['findOne']({'where':{'id':_0x144a4a[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x16b24d,null))[_0x8bf1('0x36')](function(_0x46ffbd){if(_0x46ffbd){_0x3083a3['model']=_[_0x8bf1('0x5b')](db[_0x8bf1('0x90')][_0x8bf1('0x40')]);_0x3083a3['query']=_[_0x8bf1('0x5b')](_0x144a4a[_0x8bf1('0x44')]);_0x3083a3[_0x8bf1('0x45')]=_[_0x8bf1('0x46')](_0x3083a3[_0x8bf1('0x43')],_0x3083a3[_0x8bf1('0x44')]);_0x3217d4[_0x8bf1('0x47')]=_['intersection'](_0x3083a3[_0x8bf1('0x43')],qs[_0x8bf1('0x48')](_0x144a4a[_0x8bf1('0x44')]['fields']));_0x3217d4[_0x8bf1('0x47')]=_0x3217d4[_0x8bf1('0x47')]['length']?_0x3217d4[_0x8bf1('0x47')]:_0x3083a3[_0x8bf1('0x43')];if(!_0x144a4a[_0x8bf1('0x44')][_0x8bf1('0x4a')]('nolimit')){_0x3217d4[_0x8bf1('0x30')]=qs[_0x8bf1('0x30')](_0x144a4a[_0x8bf1('0x44')][_0x8bf1('0x30')]);_0x3217d4[_0x8bf1('0x2e')]=qs['offset'](_0x144a4a[_0x8bf1('0x44')][_0x8bf1('0x2e')]);}_0x3217d4[_0x8bf1('0x4b')]=qs['sort'](_0x144a4a[_0x8bf1('0x44')]['sort']);_0x3217d4['where']=qs['filters'](_[_0x8bf1('0x6b')](_0x144a4a[_0x8bf1('0x44')],_0x3083a3[_0x8bf1('0x45')]));_0x3217d4[_0x8bf1('0x4d')]['OpenchannelAccountId']=_0x46ffbd['id'];if(_0x144a4a[_0x8bf1('0x44')]['filter']){_0x3217d4[_0x8bf1('0x4d')]=_[_0x8bf1('0x4e')](_0x3217d4[_0x8bf1('0x4d')],{'$or':_[_0x8bf1('0x3f')](_0x3217d4[_0x8bf1('0x47')],function(_0x3270e8){var _0x5edc7b={};_0x5edc7b[_0x3270e8]={'$like':'%'+_0x144a4a[_0x8bf1('0x44')][_0x8bf1('0x50')]+'%'};return _0x5edc7b;})});}_0x3217d4=_[_0x8bf1('0x4e')]({},_0x3217d4,_0x144a4a[_0x8bf1('0x51')]);return db[_0x8bf1('0x90')][_0x8bf1('0x31')]({'where':_0x3217d4[_0x8bf1('0x4d')]})['then'](function(_0xa077b5){_0x5771f4[_0x8bf1('0x31')]=_0xa077b5;if(_0x144a4a[_0x8bf1('0x44')]['includeAll']){_0x3217d4[_0x8bf1('0x53')]=[{'model':db[_0x8bf1('0x74')],'as':_0x8bf1('0xaf'),'required':![]},{'model':db[_0x8bf1('0x9e')],'as':_0x8bf1('0xb0'),'attributes':[_0x8bf1('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x8bf1('0xb1')],'as':_0x8bf1('0xb2'),'attributes':['id',_0x8bf1('0x3b'),_0x8bf1('0xb3')],'where':_0x144a4a[_0x8bf1('0x44')]['tag']?{'id':_0x144a4a['query'][_0x8bf1('0xb4')]}:undefined,'required':_0x144a4a[_0x8bf1('0x44')][_0x8bf1('0xb4')]?!![]:![]}];}return db[_0x8bf1('0x90')]['findAll'](_0x3217d4);})[_0x8bf1('0x36')](function(_0x459816){_0x5771f4[_0x8bf1('0x56')]=_0x459816;return _0x5771f4;});}})[_0x8bf1('0x36')](respondWithFilteredResult(_0x16b24d,_0x3217d4))[_0x8bf1('0x57')](handleError(_0x16b24d,null));};exports[_0x8bf1('0xb5')]=function(_0x4ca7c8,_0x5cab24,_0x19d824){return db['OpenchannelAccount']['find']({'where':{'id':_0x4ca7c8[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x5cab24,null))[_0x8bf1('0x36')](function(_0x49cc9f){if(_0x49cc9f){return _0x49cc9f[_0x8bf1('0xb5')](_0x4ca7c8['body'][_0x8bf1('0x6d')],_[_0x8bf1('0xb6')](_0x4ca7c8[_0x8bf1('0x5d')],[_0x8bf1('0x6d'),'id'])||{})['spread'](function(_0x24a944){for(var _0x444fe0=0x0;_0x444fe0<_0x4ca7c8['body']['ids'][_0x8bf1('0x49')];_0x444fe0+=0x1){socket[_0x8bf1('0xb7')](_0x8bf1('0xb8'),{'UserId':Number(_0x4ca7c8[_0x8bf1('0x5d')]['ids'][_0x444fe0]),'OpenchannelAccountId':Number(_0x4ca7c8['params']['id'])});}return _0x24a944;});}})['then'](respondWithResult(_0x5cab24,null))['catch'](handleError(_0x5cab24,null));};exports[_0x8bf1('0xb9')]=function(_0x168d55,_0x7f3a49,_0x226d0f){return db[_0x8bf1('0x54')]['find']({'where':{'id':_0x168d55[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x7f3a49,null))[_0x8bf1('0x36')](function(_0x3c8535){if(_0x3c8535){return _0x3c8535['removeAgents'](_0x168d55[_0x8bf1('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x168d55['query'][_0x8bf1('0x6d')])){for(var _0x92cd53=0x0;_0x92cd53<_0x168d55[_0x8bf1('0x44')]['ids'][_0x8bf1('0x49')];_0x92cd53+=0x1){socket['emit'](_0x8bf1('0xba'),{'UserId':Number(_0x168d55['query'][_0x8bf1('0x6d')][_0x92cd53]),'OpenchannelAccountId':Number(_0x168d55[_0x8bf1('0x59')]['id'])});}}else{socket[_0x8bf1('0xb7')](_0x8bf1('0xba'),{'UserId':Number(_0x168d55[_0x8bf1('0x44')]['ids']),'OpenchannelAccountId':Number(_0x168d55[_0x8bf1('0x59')]['id'])});}});}})[_0x8bf1('0x36')](respondWithStatusCode(_0x7f3a49,null))[_0x8bf1('0x57')](handleError(_0x7f3a49,null));};exports[_0x8bf1('0xbb')]=function(_0x2a60dc,_0x50f6e9,_0x136a03){var _0x2678d6={};var _0x4d388e={};var _0x85bdd2;var _0x217765;return db['OpenchannelAccount'][_0x8bf1('0x69')]({'where':{'id':_0x2a60dc[_0x8bf1('0x59')]['id']}})[_0x8bf1('0x36')](handleEntityNotFound(_0x50f6e9,null))[_0x8bf1('0x36')](function(_0x4fd107){if(_0x4fd107){_0x85bdd2=_0x4fd107;_0x4d388e[_0x8bf1('0x43')]=_[_0x8bf1('0x5b')](db['User'][_0x8bf1('0x40')]);_0x4d388e[_0x8bf1('0x44')]=_[_0x8bf1('0x5b')](_0x2a60dc['query']);_0x4d388e[_0x8bf1('0x45')]=_[_0x8bf1('0x46')](_0x4d388e[_0x8bf1('0x43')],_0x4d388e[_0x8bf1('0x44')]);_0x2678d6[_0x8bf1('0x47')]=_[_0x8bf1('0x46')](_0x4d388e['model'],qs[_0x8bf1('0x48')](_0x2a60dc[_0x8bf1('0x44')][_0x8bf1('0x48')]));_0x2678d6[_0x8bf1('0x47')]=_0x2678d6[_0x8bf1('0x47')][_0x8bf1('0x49')]?_0x2678d6[_0x8bf1('0x47')]:_0x4d388e['model'];_0x2678d6[_0x8bf1('0x4b')]=qs[_0x8bf1('0x4c')](_0x2a60dc[_0x8bf1('0x44')]['sort']);_0x2678d6[_0x8bf1('0x4d')]=qs[_0x8bf1('0x45')](_[_0x8bf1('0x6b')](_0x2a60dc[_0x8bf1('0x44')],_0x4d388e[_0x8bf1('0x45')]));if(_0x2a60dc[_0x8bf1('0x44')][_0x8bf1('0x50')]){_0x2678d6['where']=_[_0x8bf1('0x4e')](_0x2678d6[_0x8bf1('0x4d')],{'$or':_['map'](_0x2678d6[_0x8bf1('0x47')],function(_0x5022c8){var _0xdd060c={};_0xdd060c[_0x5022c8]={'$like':'%'+_0x2a60dc[_0x8bf1('0x44')]['filter']+'%'};return _0xdd060c;})});}_0x2678d6=_['merge']({},_0x2678d6,_0x2a60dc[_0x8bf1('0x51')]);return _0x85bdd2[_0x8bf1('0xbb')](_0x2678d6);}})[_0x8bf1('0x36')](function(_0x42e78f){if(_0x42e78f){_0x217765=_0x42e78f[_0x8bf1('0x49')];if(!_0x2a60dc['query'][_0x8bf1('0x4a')](_0x8bf1('0x6a'))){_0x2678d6[_0x8bf1('0x30')]=qs[_0x8bf1('0x30')](_0x2a60dc['query'][_0x8bf1('0x30')]);_0x2678d6[_0x8bf1('0x2e')]=qs['offset'](_0x2a60dc[_0x8bf1('0x44')]['offset']);}return _0x85bdd2[_0x8bf1('0xbb')](_0x2678d6);}})['then'](function(_0xd4551){if(_0xd4551){return _0xd4551?{'count':_0x217765,'rows':_0xd4551}:null;}})[_0x8bf1('0x36')](respondWithResult(_0x50f6e9,null))[_0x8bf1('0x57')](handleError(_0x50f6e9,null));};exports[_0x8bf1('0x3c')]=function(_0x22b6e1,_0x4f3c9b,_0x581984){var _0xd3af5b,_0x4f0cfb,_0x5055d1;if(_['isNil'](_0x22b6e1[_0x8bf1('0x5d')][_0x8bf1('0x5d')])||_0x22b6e1[_0x8bf1('0x5d')][_0x8bf1('0x5d')]===''){throw new db['Sequelize'][(_0x8bf1('0x76'))](_0x8bf1('0x7f'));}if(_[_0x8bf1('0x7e')](_0x22b6e1[_0x8bf1('0x5d')]['to'])){}_0xd3af5b=_0x22b6e1[_0x8bf1('0x5d')]['to'];return db[_0x8bf1('0x54')]['findOne']({'where':{'id':_0x22b6e1['params']['id']}})['then'](handleEntityNotFound(_0x4f3c9b,null))[_0x8bf1('0x36')](function(_0x351809){if(_0x351809){return db['OpenchannelAccount'][_0x8bf1('0x61')]({'where':{'id':_0x351809['id']},'include':[{'model':db[_0x8bf1('0x84')],'as':_0x8bf1('0x85'),'include':[{'model':db[_0x8bf1('0x74')],'as':'Contacts','where':{[_0x351809[_0x8bf1('0x80')]]:_0xd3af5b},'limit':0x1,'order':[[_0x8bf1('0x7a'),_0x8bf1('0x86')]]}]}]})[_0x8bf1('0x36')](handleEntityNotFound(_0x4f3c9b,null))[_0x8bf1('0x36')](function(_0x5cff39){if(_0x5cff39&&_0x5cff39[_0x8bf1('0x85')]){_0x4f0cfb=_0x5cff39[_0x8bf1('0x37')]({'plain':!![]});if(_0x4f0cfb['List']&&_0x4f0cfb[_0x8bf1('0x85')][_0x8bf1('0x8d')][_0x8bf1('0x49')]){return _0x4f0cfb[_0x8bf1('0x85')][_0x8bf1('0x8d')][0x0];}return db['CmContact'][_0x8bf1('0x5c')](_[_0x8bf1('0x1a')](_0x22b6e1[_0x8bf1('0x5d')],{'firstName':_0xd3af5b,[_0x5cff39[_0x8bf1('0x80')]]:_0xd3af5b,'phone':_0xd3af5b,'ListId':_0x4f0cfb[_0x8bf1('0x7c')]}));}})[_0x8bf1('0x36')](handleEntityNotFound(_0x4f3c9b,null))['then'](function(_0x581103){if(_0x581103){_0x5055d1=_0x581103;return db['OpenchannelInteraction'][_0x8bf1('0x61')]({'where':{'ContactId':_0x5055d1['id'],'closed':![],'OpenchannelAccountId':_0x4f0cfb['id']}})[_0x8bf1('0x36')](function(_0x12b53d){if(_0x12b53d){return[_0x12b53d,![]];}return db[_0x8bf1('0x90')][_0x8bf1('0x5c')]({'UserId':_0x22b6e1[_0x8bf1('0x5e')]['id'],'ContactId':_0x5055d1['id'],'OpenchannelAccountId':_0x4f0cfb['id'],'lastMsgDirection':'out','firstMsgDirection':_0x8bf1('0xbc'),'Messages':[_[_0x8bf1('0x4e')](_0x22b6e1[_0x8bf1('0x5d')],{'read':![],'body':_0x22b6e1[_0x8bf1('0x5d')][_0x8bf1('0x5d')],'OpenchannelAccountId':_0x4f0cfb['id'],'UserId':_0x22b6e1['user']['id'],'ContactId':_0x5055d1['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x8bf1('0xbd')}]})[_0x8bf1('0x36')](function(_0x4a90fe){return[_0x4a90fe,!![]];});});}})[_0x8bf1('0x92')](function(_0x1c14ae,_0x2a66be){if(_0x2a66be){return _0x1c14ae;}return db[_0x8bf1('0xbe')]['create'](_[_0x8bf1('0x4e')](_0x22b6e1['body'],{'read':![],'body':_0x22b6e1['body'][_0x8bf1('0x5d')],'OpenchannelAccountId':_0x4f0cfb['id'],'OpenchannelInteractionId':_0x1c14ae['id'],'UserId':_0x22b6e1[_0x8bf1('0x5e')]['id'],'ContactId':_0x5055d1['id']}))[_0x8bf1('0x36')](function(_0x399947){_0x1c14ae[_0x8bf1('0xbf')][_0x8bf1('0xbd')]=[];_0x1c14ae[_0x8bf1('0xbf')][_0x8bf1('0xbd')][_0x8bf1('0x98')](_0x399947[_0x8bf1('0xbf')]);return _0x1c14ae;});});}})[_0x8bf1('0x36')](respondWithResult(_0x4f3c9b,null))[_0x8bf1('0x57')](handleError(_0x4f3c9b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 74d8515..8894661 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 _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x70390e,_0x4e75e3){var _0x221a25=function(_0x11f649){while(--_0x11f649){_0x70390e['push'](_0x70390e['shift']());}};_0x221a25(++_0x4e75e3);}(_0xb821,0xa7));var _0x1b82=function(_0x25ff3d,_0x1a134a){_0x25ff3d=_0x25ff3d-0x0;var _0x5080d2=_0xb821[_0x25ff3d];return _0x5080d2;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x48b247,_0x26cab6){var _0x3c1485=function(_0x5c6b12){while(--_0x5c6b12){_0x48b247['push'](_0x48b247['shift']());}};_0x3c1485(++_0x26cab6);}(_0x70e0,0x17b));var _0x070e=function(_0x492270,_0x5a191a){_0x492270=_0x492270-0x0;var _0x1b553b=_0x70e0[_0x492270];return _0x1b553b;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 0522ef5..8fce637 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(_0xa695d7,_0x54a893){var _0x562197=function(_0x49c477){while(--_0x49c477){_0xa695d7['push'](_0xa695d7['shift']());}};_0x562197(++_0x54a893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x232c06,_0x41943d){var _0x22bb2c=function(_0x35ebf3){while(--_0x35ebf3){_0x232c06['push'](_0x232c06['shift']());}};_0x22bb2c(++_0x41943d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 669d432..cbf7c6e 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 _0xb688=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0xb688,0xcf));var _0x8b68=function(_0x2d9245,_0x4d3a2e){_0x2d9245=_0x2d9245-0x0;var _0x3dd8c4=_0xb688[_0x2d9245];return _0x3dd8c4;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});config['redis']=_[_0x8b68('0xb')](config[_0x8b68('0xc')],{'host':_0x8b68('0xd'),'port':0x18eb});var socket=require(_0x8b68('0xe'))(new Redis(config[_0x8b68('0xc')]));require(_0x8b68('0xf'))[_0x8b68('0x10')](socket);function respondWithRpcPromise(_0x21d944,_0x24e0b0,_0x2f2e3c){return new BPromise(function(_0x418775,_0x317d01){return client[_0x8b68('0x11')](_0x21d944,_0x2f2e3c)['then'](function(_0x2c0f3b){logger[_0x8b68('0x12')](_0x8b68('0x13'),_0x24e0b0,_0x8b68('0x14'));logger[_0x8b68('0x15')](_0x8b68('0x16'),_0x24e0b0,_0x8b68('0x14'),JSON[_0x8b68('0x17')](_0x2c0f3b));if(_0x2c0f3b[_0x8b68('0x18')]){if(_0x2c0f3b['error'][_0x8b68('0x19')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x24e0b0,_0x2c0f3b[_0x8b68('0x18')][_0x8b68('0x1a')]);return _0x317d01(_0x2c0f3b[_0x8b68('0x18')]['message']);}logger['error'](_0x8b68('0x13'),_0x24e0b0,_0x2c0f3b['error'][_0x8b68('0x1a')]);return _0x418775(_0x2c0f3b[_0x8b68('0x18')][_0x8b68('0x1a')]);}else{logger[_0x8b68('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x24e0b0,_0x8b68('0x14'));_0x418775(_0x2c0f3b[_0x8b68('0x1b')]['message']);}})[_0x8b68('0x1c')](function(_0x3c7e5a){logger[_0x8b68('0x18')](_0x8b68('0x13'),_0x24e0b0,_0x3c7e5a);_0x317d01(_0x3c7e5a);});});} \ No newline at end of file +var _0xe9e8=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1e56cc,_0x45b25c){var _0xa5f5ba=function(_0x56d76b){while(--_0x56d76b){_0x1e56cc['push'](_0x1e56cc['shift']());}};_0xa5f5ba(++_0x45b25c);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x680322,_0x33614f){_0x680322=_0x680322-0x0;var _0x116f9e=_0xe9e8[_0x680322];return _0x116f9e;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});config[_0x8e9e('0xc')]=_[_0x8e9e('0xd')](config['redis'],{'host':_0x8e9e('0xe'),'port':0x18eb});var socket=require(_0x8e9e('0xf'))(new Redis(config[_0x8e9e('0xc')]));require('./openchannelAccount.socket')[_0x8e9e('0x10')](socket);function respondWithRpcPromise(_0x29edcb,_0x449f72,_0x57ffc0){return new BPromise(function(_0xbcfd72,_0x303402){return client[_0x8e9e('0x11')](_0x29edcb,_0x57ffc0)[_0x8e9e('0x12')](function(_0x35f014){logger[_0x8e9e('0x13')](_0x8e9e('0x14'),_0x449f72,'request\x20sent');logger[_0x8e9e('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x449f72,_0x8e9e('0x16'),JSON[_0x8e9e('0x17')](_0x35f014));if(_0x35f014[_0x8e9e('0x18')]){if(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x19')]===0x1f4){logger[_0x8e9e('0x18')](_0x8e9e('0x14'),_0x449f72,_0x35f014['error']['message']);return _0x303402(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);}logger['error'](_0x8e9e('0x14'),_0x449f72,_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);return _0xbcfd72(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x449f72,_0x8e9e('0x16'));_0xbcfd72(_0x35f014[_0x8e9e('0x1b')][_0x8e9e('0x1a')]);}})[_0x8e9e('0x1c')](function(_0xa079b5){logger[_0x8e9e('0x18')](_0x8e9e('0x14'),_0x449f72,_0xa079b5);_0x303402(_0xa079b5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index d63ff33..a892f1f 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 _0xbed7=['removeListener','register','./openchannelAccount.events','save','remove','update','emit'];(function(_0x104ee6,_0x3a0c9c){var _0x134e3c=function(_0x3b5f66){while(--_0x3b5f66){_0x104ee6['push'](_0x104ee6['shift']());}};_0x134e3c(++_0x3a0c9c);}(_0xbed7,0x14b));var _0x7bed=function(_0x3f3dc8,_0x4ebd0c){_0x3f3dc8=_0x3f3dc8-0x0;var _0x2e457d=_0xbed7[_0x3f3dc8];return _0x2e457d;};'use strict';var OpenchannelAccountEvents=require(_0x7bed('0x0'));var events=[_0x7bed('0x1'),_0x7bed('0x2'),_0x7bed('0x3')];function createListener(_0x3c9a9f,_0x47b9cb){return function(_0x44da5a){_0x47b9cb[_0x7bed('0x4')](_0x3c9a9f,_0x44da5a);};}function removeListener(_0x1da710,_0x18c2c7){return function(){OpenchannelAccountEvents[_0x7bed('0x5')](_0x1da710,_0x18c2c7);};}exports[_0x7bed('0x6')]=function(_0x41c148){for(var _0x3aa0e9=0x0,_0x38a818=events['length'];_0x3aa0e9<_0x38a818;_0x3aa0e9++){var _0x27434d=events[_0x3aa0e9];var _0x27f7d9=createListener('openchannelAccount:'+_0x27434d,_0x41c148);OpenchannelAccountEvents['on'](_0x27434d,_0x27f7d9);}}; \ No newline at end of file +var _0x9a62=['remove','removeListener','register','openchannelAccount:','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a62,0x1bc));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x29a6('0x0'),_0x29a6('0x1'),'update'];function createListener(_0x14ca27,_0x2d49a0){return function(_0x585d58){_0x2d49a0['emit'](_0x14ca27,_0x585d58);};}function removeListener(_0x19b33c,_0x29f220){return function(){OpenchannelAccountEvents[_0x29a6('0x2')](_0x19b33c,_0x29f220);};}exports[_0x29a6('0x3')]=function(_0x1ced6f){for(var _0x19127c=0x0,_0x316d9e=events['length'];_0x19127c<_0x316d9e;_0x19127c++){var _0x5b325a=events[_0x19127c];var _0x72dde2=createListener(_0x29a6('0x4')+_0x5b325a,_0x1ced6f);OpenchannelAccountEvents['on'](_0x5b325a,_0x72dde2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index dc5ee2e..c129f59 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 _0x32c3=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x513e03,_0x279e8a){var _0x499648=function(_0x5c6fff){while(--_0x5c6fff){_0x513e03['push'](_0x513e03['shift']());}};_0x499648(++_0x279e8a);}(_0x32c3,0x10a));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x332c('0x0'));var util=require(_0x332c('0x1'));var path=require(_0x332c('0x2'));var timeout=require(_0x332c('0x3'));var express=require(_0x332c('0x4'));var router=express['Router']();var fs_extra=require(_0x332c('0x5'));var auth=require(_0x332c('0x6'));var interaction=require(_0x332c('0x7'));var config=require('../../config/environment');var controller=require(_0x332c('0x8'));router[_0x332c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x332c('0x9')]('/:id',auth[_0x332c('0xa')](),controller['show']);router[_0x332c('0xb')]('/',auth[_0x332c('0xa')](),controller[_0x332c('0xc')]);router[_0x332c('0xd')](_0x332c('0xe'),auth['isAuthenticated'](),controller[_0x332c('0xf')]);router[_0x332c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x332c('0x11')]);module[_0x332c('0x12')]=router; \ No newline at end of file +var _0x07fe=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x46cab1,_0x2fba43){var _0x3df21d=function(_0x59e4a9){while(--_0x59e4a9){_0x46cab1['push'](_0x46cab1['shift']());}};_0x3df21d(++_0x2fba43);}(_0x07fe,0x73));var _0xe07f=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x07fe[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0xe07f('0x0'));var util=require(_0xe07f('0x1'));var path=require(_0xe07f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe07f('0x3'));var router=express[_0xe07f('0x4')]();var fs_extra=require(_0xe07f('0x5'));var auth=require(_0xe07f('0x6'));var interaction=require(_0xe07f('0x7'));var config=require(_0xe07f('0x8'));var controller=require(_0xe07f('0x9'));router[_0xe07f('0xa')]('/',auth[_0xe07f('0xb')](),controller[_0xe07f('0xc')]);router['get'](_0xe07f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe07f('0xe')]('/',auth[_0xe07f('0xb')](),controller[_0xe07f('0xf')]);router[_0xe07f('0x10')](_0xe07f('0xd'),auth['isAuthenticated'](),controller[_0xe07f('0x11')]);router[_0xe07f('0x12')](_0xe07f('0xd'),auth[_0xe07f('0xb')](),controller[_0xe07f('0x13')]);module[_0xe07f('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f3ce211..feed643 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 _0x01c9=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x20f203,_0x550fa2){var _0x3e203b=function(_0x3269db){while(--_0x3269db){_0x20f203['push'](_0x20f203['shift']());}};_0x3e203b(++_0x550fa2);}(_0x01c9,0xf0));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x901c('0x0')]={'priority':{'type':Sequelize[_0x901c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x901c('0x2')],'allowNull':![],'defaultValue':_0x901c('0x3')},'appdata':{'type':Sequelize[_0x901c('0x4')]()},'description':{'type':Sequelize[_0x901c('0x2')]},'interval':{'type':Sequelize[_0x901c('0x2')],'defaultValue':_0x901c('0x5')}}; \ No newline at end of file +var _0x3171=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x994ecf,_0x4a0202){var _0x120749=function(_0x48c4a9){while(--_0x48c4a9){_0x994ecf['push'](_0x994ecf['shift']());}};_0x120749(++_0x4a0202);}(_0x3171,0x7a));var _0x1317=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x3171[_0x77d310];return _0x2cdce4;};'use strict';var Sequelize=require(_0x1317('0x0'));module[_0x1317('0x1')]={'priority':{'type':Sequelize[_0x1317('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1317('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1317('0x4')]()},'description':{'type':Sequelize[_0x1317('0x3')]},'interval':{'type':Sequelize[_0x1317('0x3')],'defaultValue':_0x1317('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 43a8c30..0fb31d9 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 _0x70db=['../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','then','error','stack','name','send','index','OpenchannelApplication','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x70db,0xce));var _0xb70d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x70db[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb70d('0x0'));var zipdir=require(_0xb70d('0x1'));var jsonpatch=require(_0xb70d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb70d('0x3'));var Mustache=require(_0xb70d('0x4'));var util=require(_0xb70d('0x5'));var path=require(_0xb70d('0x6'));var sox=require(_0xb70d('0x7'));var csv=require(_0xb70d('0x8'));var ejs=require(_0xb70d('0x9'));var fs=require('fs');var fs_extra=require(_0xb70d('0xa'));var _=require(_0xb70d('0xb'));var squel=require(_0xb70d('0xc'));var crypto=require(_0xb70d('0xd'));var jsforce=require(_0xb70d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb70d('0xf'));var Papa=require(_0xb70d('0x10'));var Redis=require(_0xb70d('0x11'));var authService=require(_0xb70d('0x12'));var qs=require(_0xb70d('0x13'));var as=require(_0xb70d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb70d('0x15'))(_0xb70d('0x16'));var utils=require(_0xb70d('0x17'));var config=require(_0xb70d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb70d('0x19'))['db'];function respondWithStatusCode(_0x294cb0,_0x5f13e0){_0x5f13e0=_0x5f13e0||0xcc;return function(_0x207ac6){if(_0x207ac6){return _0x294cb0[_0xb70d('0x1a')](_0x5f13e0);}return _0x294cb0['status'](_0x5f13e0)[_0xb70d('0x1b')]();};}function respondWithResult(_0x14dfc9,_0x56982f){_0x56982f=_0x56982f||0xc8;return function(_0x4ba583){if(_0x4ba583){return _0x14dfc9['status'](_0x56982f)[_0xb70d('0x1c')](_0x4ba583);}};}function respondWithFilteredResult(_0x1fd7e5,_0xb64291){return function(_0xb45911){if(_0xb45911){var _0x3a206c=typeof _0xb64291[_0xb70d('0x1d')]===_0xb70d('0x1e')&&typeof _0xb64291['limit']===_0xb70d('0x1e');var _0x5f3fec=_0xb45911['count'];var _0x3b2867=_0x3a206c?0x0:_0xb64291[_0xb70d('0x1d')];var _0x2454cb=_0x3a206c?_0xb45911[_0xb70d('0x1f')]:_0xb64291[_0xb70d('0x1d')]+_0xb64291[_0xb70d('0x20')];var _0x3c28f3;if(_0x2454cb>=_0x5f3fec){_0x2454cb=_0x5f3fec;_0x3c28f3=0xc8;}else{_0x3c28f3=0xce;}_0x1fd7e5[_0xb70d('0x21')](_0x3c28f3);return _0x1fd7e5[_0xb70d('0x22')](_0xb70d('0x23'),_0x3b2867+'-'+_0x2454cb+'/'+_0x5f3fec)[_0xb70d('0x1c')](_0xb45911);}return null;};}function patchUpdates(_0x19a454){return function(_0x49155f){try{jsonpatch['apply'](_0x49155f,_0x19a454,!![]);}catch(_0x53c2b5){return BPromise['reject'](_0x53c2b5);}return _0x49155f['save']();};}function saveUpdates(_0x216909,_0x37e713){return function(_0x4af996){if(_0x4af996){return _0x4af996['update'](_0x216909)[_0xb70d('0x24')](function(_0xce34c8){return _0xce34c8;});}return null;};}function removeEntity(_0x4cb3bc,_0x5b13d4){return function(_0x496e04){if(_0x496e04){return _0x496e04['destroy']()[_0xb70d('0x24')](function(){_0x4cb3bc[_0xb70d('0x21')](0xcc)[_0xb70d('0x1b')]();});}};}function handleEntityNotFound(_0x360f67,_0x8384d7){return function(_0x49d851){if(!_0x49d851){_0x360f67[_0xb70d('0x1a')](0x194);}return _0x49d851;};}function handleError(_0x511936,_0x518dd7){_0x518dd7=_0x518dd7||0x1f4;return function(_0x4d1243){logger[_0xb70d('0x25')](_0x4d1243[_0xb70d('0x26')]);if(_0x4d1243[_0xb70d('0x27')]){delete _0x4d1243[_0xb70d('0x27')];}_0x511936[_0xb70d('0x21')](_0x518dd7)[_0xb70d('0x28')](_0x4d1243);};}exports[_0xb70d('0x29')]=function(_0x203870,_0x538914){var _0x4c90f6={},_0x586207={},_0x38a145={'count':0x0,'rows':[]};var _0x322265=_['map'](db[_0xb70d('0x2a')]['rawAttributes'],function(_0x1ddaa7){return{'name':_0x1ddaa7[_0xb70d('0x2b')],'type':_0x1ddaa7['type'][_0xb70d('0x2c')]};});_0x586207['model']=_[_0xb70d('0x2d')](_0x322265,'name');_0x586207['query']=_[_0xb70d('0x2e')](_0x203870[_0xb70d('0x2f')]);_0x586207[_0xb70d('0x30')]=_[_0xb70d('0x31')](_0x586207[_0xb70d('0x32')],_0x586207[_0xb70d('0x2f')]);_0x4c90f6[_0xb70d('0x33')]=_['intersection'](_0x586207[_0xb70d('0x32')],qs[_0xb70d('0x34')](_0x203870['query'][_0xb70d('0x34')]));_0x4c90f6[_0xb70d('0x33')]=_0x4c90f6[_0xb70d('0x33')][_0xb70d('0x35')]?_0x4c90f6['attributes']:_0x586207[_0xb70d('0x32')];if(!_0x203870[_0xb70d('0x2f')][_0xb70d('0x36')](_0xb70d('0x37'))){_0x4c90f6['limit']=qs['limit'](_0x203870[_0xb70d('0x2f')][_0xb70d('0x20')]);_0x4c90f6['offset']=qs[_0xb70d('0x1d')](_0x203870[_0xb70d('0x2f')][_0xb70d('0x1d')]);}_0x4c90f6[_0xb70d('0x38')]=qs[_0xb70d('0x39')](_0x203870[_0xb70d('0x2f')]['sort']);_0x4c90f6[_0xb70d('0x3a')]=qs[_0xb70d('0x30')](_[_0xb70d('0x3b')](_0x203870['query'],_0x586207[_0xb70d('0x30')]),_0x322265);if(_0x203870[_0xb70d('0x2f')][_0xb70d('0x3c')]){_0x4c90f6[_0xb70d('0x3a')]=_[_0xb70d('0x3d')](_0x4c90f6['where'],{'$or':_['map'](_0x322265,function(_0x257853){if(_0x257853[_0xb70d('0x3e')]!==_0xb70d('0x3f')){var _0x161de4={};_0x161de4[_0x257853[_0xb70d('0x27')]]={'$like':'%'+_0x203870['query'][_0xb70d('0x3c')]+'%'};return _0x161de4;}})});}_0x4c90f6=_[_0xb70d('0x3d')]({},_0x4c90f6,_0x203870[_0xb70d('0x40')]);var _0x420701={'where':_0x4c90f6[_0xb70d('0x3a')]};return db[_0xb70d('0x2a')][_0xb70d('0x1f')](_0x420701)[_0xb70d('0x24')](function(_0x331cd3){_0x38a145[_0xb70d('0x1f')]=_0x331cd3;if(_0x203870[_0xb70d('0x2f')][_0xb70d('0x41')]){_0x4c90f6[_0xb70d('0x42')]=[{'all':!![]}];}return db[_0xb70d('0x2a')][_0xb70d('0x43')](_0x4c90f6);})['then'](function(_0x5e7c79){_0x38a145[_0xb70d('0x44')]=_0x5e7c79;return _0x38a145;})['then'](respondWithFilteredResult(_0x538914,_0x4c90f6))[_0xb70d('0x45')](handleError(_0x538914,null));};exports[_0xb70d('0x46')]=function(_0x3858d4,_0xc4148e){var _0x4440b1={'raw':!![],'where':{'id':_0x3858d4[_0xb70d('0x47')]['id']}},_0xbde8d1={};_0xbde8d1[_0xb70d('0x32')]=_[_0xb70d('0x2e')](db[_0xb70d('0x2a')]['rawAttributes']);_0xbde8d1[_0xb70d('0x2f')]=_[_0xb70d('0x2e')](_0x3858d4['query']);_0xbde8d1[_0xb70d('0x30')]=_[_0xb70d('0x31')](_0xbde8d1['model'],_0xbde8d1['query']);_0x4440b1['attributes']=_[_0xb70d('0x31')](_0xbde8d1[_0xb70d('0x32')],qs[_0xb70d('0x34')](_0x3858d4[_0xb70d('0x2f')][_0xb70d('0x34')]));_0x4440b1['attributes']=_0x4440b1[_0xb70d('0x33')][_0xb70d('0x35')]?_0x4440b1['attributes']:_0xbde8d1[_0xb70d('0x32')];if(_0x3858d4[_0xb70d('0x2f')]['includeAll']){_0x4440b1[_0xb70d('0x42')]=[{'all':!![]}];}_0x4440b1=_['merge']({},_0x4440b1,_0x3858d4[_0xb70d('0x40')]);return db[_0xb70d('0x2a')][_0xb70d('0x48')](_0x4440b1)[_0xb70d('0x24')](handleEntityNotFound(_0xc4148e,null))['then'](respondWithResult(_0xc4148e,null))[_0xb70d('0x45')](handleError(_0xc4148e,null));};exports[_0xb70d('0x49')]=function(_0x5c0cbd,_0x5cd328){return db[_0xb70d('0x2a')]['create'](_0x5c0cbd[_0xb70d('0x4a')],{})[_0xb70d('0x24')](respondWithResult(_0x5cd328,0xc9))[_0xb70d('0x45')](handleError(_0x5cd328,null));};exports[_0xb70d('0x4b')]=function(_0x3f7b6f,_0xbc55ed){if(_0x3f7b6f['body']['id']){delete _0x3f7b6f[_0xb70d('0x4a')]['id'];}return db[_0xb70d('0x2a')][_0xb70d('0x48')]({'where':{'id':_0x3f7b6f[_0xb70d('0x47')]['id']}})[_0xb70d('0x24')](handleEntityNotFound(_0xbc55ed,null))['then'](saveUpdates(_0x3f7b6f[_0xb70d('0x4a')],null))[_0xb70d('0x24')](respondWithResult(_0xbc55ed,null))[_0xb70d('0x45')](handleError(_0xbc55ed,null));};exports[_0xb70d('0x4c')]=function(_0x4a49ff,_0x2e1f79){return db[_0xb70d('0x2a')][_0xb70d('0x48')]({'where':{'id':_0x4a49ff[_0xb70d('0x47')]['id']}})[_0xb70d('0x24')](handleEntityNotFound(_0x2e1f79,null))['then'](removeEntity(_0x2e1f79,null))['catch'](handleError(_0x2e1f79,null));}; \ No newline at end of file +var _0x3db0=['params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','OpenchannelApplication','includeAll','rows','catch','rawAttributes','include','find','create','body'];(function(_0x308397,_0x2a0714){var _0x1a3250=function(_0x28a9a1){while(--_0x28a9a1){_0x308397['push'](_0x308397['shift']());}};_0x1a3250(++_0x2a0714);}(_0x3db0,0x15f));var _0x03db=function(_0x2a4c3a,_0x338cb0){_0x2a4c3a=_0x2a4c3a-0x0;var _0x2f41cb=_0x3db0[_0x2a4c3a];return _0x2f41cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03db('0x0'));var zipdir=require(_0x03db('0x1'));var jsonpatch=require(_0x03db('0x2'));var rp=require(_0x03db('0x3'));var moment=require(_0x03db('0x4'));var BPromise=require(_0x03db('0x5'));var Mustache=require(_0x03db('0x6'));var util=require(_0x03db('0x7'));var path=require('path');var sox=require(_0x03db('0x8'));var csv=require(_0x03db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03db('0xa'));var squel=require(_0x03db('0xb'));var crypto=require('crypto');var jsforce=require(_0x03db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03db('0x9'));var querystring=require(_0x03db('0xd'));var Papa=require(_0x03db('0xe'));var Redis=require(_0x03db('0xf'));var authService=require(_0x03db('0x10'));var qs=require(_0x03db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03db('0x12'));var logger=require(_0x03db('0x13'))(_0x03db('0x14'));var utils=require(_0x03db('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x03db('0x16'));var db=require(_0x03db('0x17'))['db'];function respondWithStatusCode(_0x118a43,_0x17f6d5){_0x17f6d5=_0x17f6d5||0xcc;return function(_0x5b93fa){if(_0x5b93fa){return _0x118a43[_0x03db('0x18')](_0x17f6d5);}return _0x118a43[_0x03db('0x19')](_0x17f6d5)['end']();};}function respondWithResult(_0xbac93a,_0x352aee){_0x352aee=_0x352aee||0xc8;return function(_0x3dfcc5){if(_0x3dfcc5){return _0xbac93a['status'](_0x352aee)['json'](_0x3dfcc5);}};}function respondWithFilteredResult(_0x4bdfea,_0x56827a){return function(_0x39518){if(_0x39518){var _0x13be6b=typeof _0x56827a[_0x03db('0x1a')]===_0x03db('0x1b')&&typeof _0x56827a[_0x03db('0x1c')]==='undefined';var _0x55c71c=_0x39518['count'];var _0x451f17=_0x13be6b?0x0:_0x56827a[_0x03db('0x1a')];var _0xd3dbca=_0x13be6b?_0x39518[_0x03db('0x1d')]:_0x56827a[_0x03db('0x1a')]+_0x56827a['limit'];var _0x3aa3a6;if(_0xd3dbca>=_0x55c71c){_0xd3dbca=_0x55c71c;_0x3aa3a6=0xc8;}else{_0x3aa3a6=0xce;}_0x4bdfea[_0x03db('0x19')](_0x3aa3a6);return _0x4bdfea[_0x03db('0x1e')](_0x03db('0x1f'),_0x451f17+'-'+_0xd3dbca+'/'+_0x55c71c)[_0x03db('0x20')](_0x39518);}return null;};}function patchUpdates(_0xd97405){return function(_0x531b4c){try{jsonpatch['apply'](_0x531b4c,_0xd97405,!![]);}catch(_0x36c0d5){return BPromise[_0x03db('0x21')](_0x36c0d5);}return _0x531b4c[_0x03db('0x22')]();};}function saveUpdates(_0xc4d45b,_0x57ea90){return function(_0x4202fc){if(_0x4202fc){return _0x4202fc[_0x03db('0x23')](_0xc4d45b)[_0x03db('0x24')](function(_0x5f2a36){return _0x5f2a36;});}return null;};}function removeEntity(_0x50f0e1,_0x4ecc65){return function(_0x5a2e6c){if(_0x5a2e6c){return _0x5a2e6c[_0x03db('0x25')]()['then'](function(){_0x50f0e1['status'](0xcc)[_0x03db('0x26')]();});}};}function handleEntityNotFound(_0x2e64d6,_0x1956c8){return function(_0x4ecbaa){if(!_0x4ecbaa){_0x2e64d6[_0x03db('0x18')](0x194);}return _0x4ecbaa;};}function handleError(_0x53d25f,_0xe21abd){_0xe21abd=_0xe21abd||0x1f4;return function(_0x3b768b){logger['error'](_0x3b768b['stack']);if(_0x3b768b[_0x03db('0x27')]){delete _0x3b768b[_0x03db('0x27')];}_0x53d25f[_0x03db('0x19')](_0xe21abd)['send'](_0x3b768b);};}exports[_0x03db('0x28')]=function(_0x2fce5d,_0x1452ed){var _0x15b1b9={},_0x528afc={},_0x41d054={'count':0x0,'rows':[]};var _0x44c6dc=_[_0x03db('0x29')](db['OpenchannelApplication']['rawAttributes'],function(_0x209897){return{'name':_0x209897[_0x03db('0x2a')],'type':_0x209897['type'][_0x03db('0x2b')]};});_0x528afc[_0x03db('0x2c')]=_[_0x03db('0x29')](_0x44c6dc,_0x03db('0x27'));_0x528afc['query']=_[_0x03db('0x2d')](_0x2fce5d[_0x03db('0x2e')]);_0x528afc[_0x03db('0x2f')]=_[_0x03db('0x30')](_0x528afc[_0x03db('0x2c')],_0x528afc[_0x03db('0x2e')]);_0x15b1b9[_0x03db('0x31')]=_[_0x03db('0x30')](_0x528afc[_0x03db('0x2c')],qs[_0x03db('0x32')](_0x2fce5d['query'][_0x03db('0x32')]));_0x15b1b9[_0x03db('0x31')]=_0x15b1b9[_0x03db('0x31')][_0x03db('0x33')]?_0x15b1b9['attributes']:_0x528afc[_0x03db('0x2c')];if(!_0x2fce5d[_0x03db('0x2e')][_0x03db('0x34')](_0x03db('0x35'))){_0x15b1b9[_0x03db('0x1c')]=qs[_0x03db('0x1c')](_0x2fce5d[_0x03db('0x2e')][_0x03db('0x1c')]);_0x15b1b9[_0x03db('0x1a')]=qs['offset'](_0x2fce5d['query'][_0x03db('0x1a')]);}_0x15b1b9['order']=qs['sort'](_0x2fce5d[_0x03db('0x2e')][_0x03db('0x36')]);_0x15b1b9[_0x03db('0x37')]=qs[_0x03db('0x2f')](_[_0x03db('0x38')](_0x2fce5d[_0x03db('0x2e')],_0x528afc[_0x03db('0x2f')]),_0x44c6dc);if(_0x2fce5d[_0x03db('0x2e')]['filter']){_0x15b1b9[_0x03db('0x37')]=_[_0x03db('0x39')](_0x15b1b9[_0x03db('0x37')],{'$or':_['map'](_0x44c6dc,function(_0x41f3b6){if(_0x41f3b6['type']!=='VIRTUAL'){var _0x3db727={};_0x3db727[_0x41f3b6[_0x03db('0x27')]]={'$like':'%'+_0x2fce5d['query'][_0x03db('0x3a')]+'%'};return _0x3db727;}})});}_0x15b1b9=_[_0x03db('0x39')]({},_0x15b1b9,_0x2fce5d[_0x03db('0x3b')]);var _0x5e2b90={'where':_0x15b1b9[_0x03db('0x37')]};return db[_0x03db('0x3c')][_0x03db('0x1d')](_0x5e2b90)[_0x03db('0x24')](function(_0x460c6e){_0x41d054[_0x03db('0x1d')]=_0x460c6e;if(_0x2fce5d[_0x03db('0x2e')][_0x03db('0x3d')]){_0x15b1b9['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x15b1b9);})[_0x03db('0x24')](function(_0x1e43f3){_0x41d054[_0x03db('0x3e')]=_0x1e43f3;return _0x41d054;})['then'](respondWithFilteredResult(_0x1452ed,_0x15b1b9))[_0x03db('0x3f')](handleError(_0x1452ed,null));};exports['show']=function(_0x4962ab,_0x11107f){var _0x3e0e56={'raw':!![],'where':{'id':_0x4962ab['params']['id']}},_0x215666={};_0x215666[_0x03db('0x2c')]=_[_0x03db('0x2d')](db['OpenchannelApplication'][_0x03db('0x40')]);_0x215666[_0x03db('0x2e')]=_['keys'](_0x4962ab[_0x03db('0x2e')]);_0x215666[_0x03db('0x2f')]=_[_0x03db('0x30')](_0x215666[_0x03db('0x2c')],_0x215666[_0x03db('0x2e')]);_0x3e0e56[_0x03db('0x31')]=_[_0x03db('0x30')](_0x215666[_0x03db('0x2c')],qs[_0x03db('0x32')](_0x4962ab['query'][_0x03db('0x32')]));_0x3e0e56[_0x03db('0x31')]=_0x3e0e56[_0x03db('0x31')]['length']?_0x3e0e56['attributes']:_0x215666[_0x03db('0x2c')];if(_0x4962ab[_0x03db('0x2e')][_0x03db('0x3d')]){_0x3e0e56[_0x03db('0x41')]=[{'all':!![]}];}_0x3e0e56=_[_0x03db('0x39')]({},_0x3e0e56,_0x4962ab[_0x03db('0x3b')]);return db[_0x03db('0x3c')][_0x03db('0x42')](_0x3e0e56)[_0x03db('0x24')](handleEntityNotFound(_0x11107f,null))['then'](respondWithResult(_0x11107f,null))[_0x03db('0x3f')](handleError(_0x11107f,null));};exports[_0x03db('0x43')]=function(_0x3c182d,_0x2c536a){return db[_0x03db('0x3c')]['create'](_0x3c182d[_0x03db('0x44')],{})[_0x03db('0x24')](respondWithResult(_0x2c536a,0xc9))['catch'](handleError(_0x2c536a,null));};exports[_0x03db('0x23')]=function(_0xf7fe22,_0x96f69f){if(_0xf7fe22[_0x03db('0x44')]['id']){delete _0xf7fe22[_0x03db('0x44')]['id'];}return db[_0x03db('0x3c')][_0x03db('0x42')]({'where':{'id':_0xf7fe22[_0x03db('0x45')]['id']}})[_0x03db('0x24')](handleEntityNotFound(_0x96f69f,null))[_0x03db('0x24')](saveUpdates(_0xf7fe22['body'],null))[_0x03db('0x24')](respondWithResult(_0x96f69f,null))[_0x03db('0x3f')](handleError(_0x96f69f,null));};exports['destroy']=function(_0x3d379e,_0x21f3e6){return db[_0x03db('0x3c')][_0x03db('0x42')]({'where':{'id':_0x3d379e[_0x03db('0x45')]['id']}})[_0x03db('0x24')](handleEntityNotFound(_0x21f3e6,null))[_0x03db('0x24')](removeEntity(_0x21f3e6,null))[_0x03db('0x3f')](handleError(_0x21f3e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d32d927..f318a69 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 _0x8067=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x822e49,_0x357d56){var _0x399cb1=function(_0x198aa9){while(--_0x198aa9){_0x822e49['push'](_0x822e49['shift']());}};_0x399cb1(++_0x357d56);}(_0x8067,0x138));var _0x7806=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8067[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7806('0x0'));var util=require(_0x7806('0x1'));var logger=require(_0x7806('0x2'))(_0x7806('0x3'));var moment=require(_0x7806('0x4'));var BPromise=require(_0x7806('0x5'));var rp=require(_0x7806('0x6'));var fs=require('fs');var path=require(_0x7806('0x7'));var rimraf=require(_0x7806('0x8'));var config=require(_0x7806('0x9'));var attributes=require(_0x7806('0xa'));module[_0x7806('0xb')]=function(_0x2fec02,_0xe45abb){return _0x2fec02[_0x7806('0xc')](_0x7806('0xd'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7806('0xe'),'collate':_0x7806('0xf')});}; \ No newline at end of file +var _0xd8c4=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c635a,_0x1d7009){var _0x45621d=function(_0x1fc2a7){while(--_0x1fc2a7){_0x2c635a['push'](_0x2c635a['shift']());}};_0x45621d(++_0x1d7009);}(_0xd8c4,0x146));var _0x4d8c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xd8c4[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x4d8c('0x0'));var util=require(_0x4d8c('0x1'));var logger=require(_0x4d8c('0x2'))(_0x4d8c('0x3'));var moment=require(_0x4d8c('0x4'));var BPromise=require(_0x4d8c('0x5'));var rp=require(_0x4d8c('0x6'));var fs=require('fs');var path=require(_0x4d8c('0x7'));var rimraf=require(_0x4d8c('0x8'));var config=require(_0x4d8c('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0x4d8c('0xa')]=function(_0x1da2dc,_0x191781){return _0x1da2dc[_0x4d8c('0xb')](_0x4d8c('0xc'),attributes,{'tableName':_0x4d8c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d8c('0xe'),'collate':_0x4d8c('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 61d3e09..9121d1e 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 _0x6b82=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6b82,0x86));var _0x26b8=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0x6b82[_0x348fec];return _0x5914c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x26b8('0x0'));var BPromise=require('bluebird');var rs=require(_0x26b8('0x1'));var fs=require('fs');var Redis=require(_0x26b8('0x2'));var db=require(_0x26b8('0x3'))['db'];var utils=require(_0x26b8('0x4'));var logger=require(_0x26b8('0x5'))(_0x26b8('0x6'));var config=require(_0x26b8('0x7'));var jayson=require(_0x26b8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9d06,_0x2d7ea8,_0xe0a25c){return new BPromise(function(_0x110eda,_0x3831a2){return client[_0x26b8('0x9')](_0x3a9d06,_0xe0a25c)[_0x26b8('0xa')](function(_0xc4f1ad){logger[_0x26b8('0xb')](_0x26b8('0xc'),_0x2d7ea8,_0x26b8('0xd'));logger[_0x26b8('0xe')](_0x26b8('0xf'),_0x2d7ea8,_0x26b8('0xd'),JSON[_0x26b8('0x10')](_0xc4f1ad));if(_0xc4f1ad[_0x26b8('0x11')]){if(_0xc4f1ad[_0x26b8('0x11')][_0x26b8('0x12')]===0x1f4){logger[_0x26b8('0x11')](_0x26b8('0xc'),_0x2d7ea8,_0xc4f1ad[_0x26b8('0x11')][_0x26b8('0x13')]);return _0x3831a2(_0xc4f1ad['error']['message']);}logger[_0x26b8('0x11')](_0x26b8('0xc'),_0x2d7ea8,_0xc4f1ad[_0x26b8('0x11')][_0x26b8('0x13')]);return _0x110eda(_0xc4f1ad[_0x26b8('0x11')][_0x26b8('0x13')]);}else{logger[_0x26b8('0xb')](_0x26b8('0xc'),_0x2d7ea8,_0x26b8('0xd'));_0x110eda(_0xc4f1ad[_0x26b8('0x14')]['message']);}})[_0x26b8('0x15')](function(_0x1b2925){logger['error'](_0x26b8('0xc'),_0x2d7ea8,_0x1b2925);_0x3831a2(_0x1b2925);});});}exports[_0x26b8('0x16')]=function(_0x5150d7){var _0x5369c3=this;return new Promise(function(_0x482a18,_0x53bd8e){return db['OpenchannelApplication'][_0x26b8('0x17')](_0x5150d7[_0x26b8('0x18')],{'raw':_0x5150d7[_0x26b8('0x19')]?_0x5150d7[_0x26b8('0x19')][_0x26b8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5150d7[_0x26b8('0x19')]?_0x5150d7[_0x26b8('0x19')]['where']||null:null,'attributes':_0x5150d7[_0x26b8('0x19')]?_0x5150d7['options'][_0x26b8('0x1b')]||null:null,'limit':_0x5150d7[_0x26b8('0x19')]?_0x5150d7[_0x26b8('0x19')][_0x26b8('0x1c')]||null:null})[_0x26b8('0xa')](function(_0x28cc30){logger[_0x26b8('0xb')](_0x26b8('0x16'),_0x5150d7);logger[_0x26b8('0xe')](_0x26b8('0x16'),_0x5150d7,JSON[_0x26b8('0x10')](_0x28cc30));_0x482a18(_0x28cc30);})[_0x26b8('0x15')](function(_0xcdab88){logger[_0x26b8('0x11')](_0x26b8('0x16'),_0xcdab88[_0x26b8('0x13')],_0x5150d7);_0x53bd8e(_0x5369c3[_0x26b8('0x11')](0x1f4,_0xcdab88[_0x26b8('0x13')]));});});}; \ No newline at end of file +var _0x1916=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1916,0x11a));var _0x6191=function(_0x4ec86b,_0xfe0b6c){_0x4ec86b=_0x4ec86b-0x0;var _0xe8c79e=_0x1916[_0x4ec86b];return _0xe8c79e;};'use strict';var _=require(_0x6191('0x0'));var util=require(_0x6191('0x1'));var moment=require(_0x6191('0x2'));var BPromise=require(_0x6191('0x3'));var rs=require(_0x6191('0x4'));var fs=require('fs');var Redis=require(_0x6191('0x5'));var db=require(_0x6191('0x6'))['db'];var utils=require(_0x6191('0x7'));var logger=require(_0x6191('0x8'))(_0x6191('0x9'));var config=require(_0x6191('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6191('0xb')][_0x6191('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2560,_0x4139df,_0x2be298){return new BPromise(function(_0x20f1ad,_0x4ee2f6){return client[_0x6191('0xd')](_0x1e2560,_0x2be298)[_0x6191('0xe')](function(_0x2607ed){logger[_0x6191('0xf')](_0x6191('0x10'),_0x4139df,_0x6191('0x11'));logger[_0x6191('0x12')](_0x6191('0x13'),_0x4139df,'request\x20sent',JSON['stringify'](_0x2607ed));if(_0x2607ed[_0x6191('0x14')]){if(_0x2607ed[_0x6191('0x14')][_0x6191('0x15')]===0x1f4){logger[_0x6191('0x14')](_0x6191('0x10'),_0x4139df,_0x2607ed[_0x6191('0x14')][_0x6191('0x16')]);return _0x4ee2f6(_0x2607ed[_0x6191('0x14')][_0x6191('0x16')]);}logger[_0x6191('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x4139df,_0x2607ed['error']['message']);return _0x20f1ad(_0x2607ed[_0x6191('0x14')][_0x6191('0x16')]);}else{logger[_0x6191('0xf')](_0x6191('0x10'),_0x4139df,'request\x20sent');_0x20f1ad(_0x2607ed['result'][_0x6191('0x16')]);}})[_0x6191('0x17')](function(_0x24a9a2){logger[_0x6191('0x14')](_0x6191('0x10'),_0x4139df,_0x24a9a2);_0x4ee2f6(_0x24a9a2);});});}exports[_0x6191('0x18')]=function(_0x3c46cb){var _0x52e49b=this;return new Promise(function(_0x2832ed,_0x1cbd47){return db[_0x6191('0x19')]['update'](_0x3c46cb[_0x6191('0x1a')],{'raw':_0x3c46cb[_0x6191('0x1b')]?_0x3c46cb[_0x6191('0x1b')][_0x6191('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c46cb[_0x6191('0x1b')]?_0x3c46cb[_0x6191('0x1b')][_0x6191('0x1d')]||null:null,'attributes':_0x3c46cb[_0x6191('0x1b')]?_0x3c46cb[_0x6191('0x1b')]['attributes']||null:null,'limit':_0x3c46cb[_0x6191('0x1b')]?_0x3c46cb[_0x6191('0x1b')][_0x6191('0x1e')]||null:null})[_0x6191('0xe')](function(_0x1acb98){logger[_0x6191('0xf')](_0x6191('0x18'),_0x3c46cb);logger['debug'](_0x6191('0x18'),_0x3c46cb,JSON[_0x6191('0x1f')](_0x1acb98));_0x2832ed(_0x1acb98);})[_0x6191('0x17')](function(_0x266bc0){logger['error']('UpdateOpenchannelApplication',_0x266bc0['message'],_0x3c46cb);_0x1cbd47(_0x52e49b[_0x6191('0x14')](0x1f4,_0x266bc0[_0x6191('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 77cb13c..0d06e69 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 _0x234a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','create','post','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','multer','path','connect-timeout'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x234a,0xc9));var _0xa234=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0x234a[_0xf0f7ba];return _0x44382c;};'use strict';var multer=require(_0xa234('0x0'));var util=require('util');var path=require(_0xa234('0x1'));var timeout=require(_0xa234('0x2'));var express=require(_0xa234('0x3'));var router=express[_0xa234('0x4')]();var fs_extra=require(_0xa234('0x5'));var auth=require(_0xa234('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa234('0x7'));var controller=require(_0xa234('0x8'));router[_0xa234('0x9')]('/',auth[_0xa234('0xa')](),controller[_0xa234('0xb')]);router[_0xa234('0x9')](_0xa234('0xc'),auth['isAuthenticated'](),controller[_0xa234('0xd')]);router['get'](_0xa234('0xe'),auth[_0xa234('0xa')](),controller[_0xa234('0xf')]);router['get']('/:id/messages',auth[_0xa234('0xa')](),controller[_0xa234('0x10')]);router['get']('/:id/download',auth[_0xa234('0xa')](),controller[_0xa234('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa234('0x12')]);router[_0xa234('0x13')](_0xa234('0x14'),auth[_0xa234('0xa')](),controller[_0xa234('0x15')]);router[_0xa234('0x13')](_0xa234('0x16'),auth[_0xa234('0xa')](),interaction['tracked'](_0xa234('0x17'),_0xa234('0x18')),controller[_0xa234('0x19')]);router[_0xa234('0x1a')](_0xa234('0xe'),auth[_0xa234('0xa')](),interaction[_0xa234('0x1b')](_0xa234('0x17'),_0xa234('0x1c')),controller[_0xa234('0x1d')]);router['delete'](_0xa234('0xe'),auth[_0xa234('0xa')](),interaction[_0xa234('0x1b')](_0xa234('0x17'),_0xa234('0x1e')),controller[_0xa234('0x1f')]);router[_0xa234('0x20')]('/:id/tags',auth[_0xa234('0xa')](),controller[_0xa234('0x21')]);module['exports']=router; \ No newline at end of file +var _0xdc4c=['describe','get','show','getMessages','/:id/download','download','create','post','/:id/tags','tracked','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe'];(function(_0xbf4fd8,_0x276b23){var _0x512333=function(_0x18b69f){while(--_0x18b69f){_0xbf4fd8['push'](_0xbf4fd8['shift']());}};_0x512333(++_0x276b23);}(_0xdc4c,0xba));var _0xcdc4=function(_0x599453,_0x2dda73){_0x599453=_0x599453-0x0;var _0x1fc0a1=_0xdc4c[_0x599453];return _0x1fc0a1;};'use strict';var multer=require('multer');var util=require(_0xcdc4('0x0'));var path=require(_0xcdc4('0x1'));var timeout=require('connect-timeout');var express=require(_0xcdc4('0x2'));var router=express[_0xcdc4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdc4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc4('0x5'));var controller=require(_0xcdc4('0x6'));router['get']('/',auth[_0xcdc4('0x7')](),controller[_0xcdc4('0x8')]);router['get'](_0xcdc4('0x9'),auth[_0xcdc4('0x7')](),controller[_0xcdc4('0xa')]);router[_0xcdc4('0xb')]('/:id',auth[_0xcdc4('0x7')](),controller[_0xcdc4('0xc')]);router[_0xcdc4('0xb')]('/:id/messages',auth[_0xcdc4('0x7')](),controller[_0xcdc4('0xd')]);router['get'](_0xcdc4('0xe'),auth['isAuthenticated'](),controller[_0xcdc4('0xf')]);router['post']('/',auth[_0xcdc4('0x7')](),controller[_0xcdc4('0x10')]);router[_0xcdc4('0x11')]('/:id/messages',auth[_0xcdc4('0x7')](),controller['addMessage']);router[_0xcdc4('0x11')](_0xcdc4('0x12'),auth[_0xcdc4('0x7')](),interaction[_0xcdc4('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0xcdc4('0x14')]);router[_0xcdc4('0x15')]('/:id',auth[_0xcdc4('0x7')](),interaction[_0xcdc4('0x13')]('openchannel',_0xcdc4('0x16')),controller[_0xcdc4('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xcdc4('0x13')]('openchannel',_0xcdc4('0x18')),controller[_0xcdc4('0x19')]);router[_0xcdc4('0x1a')](_0xcdc4('0x12'),auth['isAuthenticated'](),controller[_0xcdc4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3062c7f..cd045da 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 _0xc999=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0xc999,0x176));var _0x9c99=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xc999[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require('sequelize');module[_0x9c99('0x0')]={'closed':{'type':Sequelize[_0x9c99('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9c99('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9c99('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x9c99('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9c99('0x4')]('in',_0x9c99('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9c99('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9c99('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x9c99('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x3e5c=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x332143,_0x53adfd){_0x332143=_0x332143-0x0;var _0x37f99b=_0x3e5c[_0x332143];return _0x37f99b;};'use strict';var Sequelize=require(_0xc3e5('0x0'));module[_0xc3e5('0x1')]={'closed':{'type':Sequelize[_0xc3e5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc3e5('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc3e5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc3e5('0x4')]},'note':{'type':Sequelize[_0xc3e5('0x4')]},'read1stAt':{'type':Sequelize[_0xc3e5('0x3')]},'threadId':{'type':Sequelize[_0xc3e5('0x4')]},'externalUrl':{'type':Sequelize[_0xc3e5('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc3e5('0x5')]('in',_0xc3e5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xc3e5('0x5')]('in',_0xc3e5('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc3e5('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5d280b8..1b61699 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 _0xded4=['format','includeAll','include','rows','addTags','setTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','Openchannel','Account','N.A.','toString','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','end','error','name','send','index','map','OpenchannelInteraction','rawAttributes','type','getOptions','findAll','openchannel','query','user','catch','show','params','model','keys','intersection','attributes','fields','merge','options','find','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xded4,0x1bd));var _0x4ded=function(_0x210192,_0x109632){_0x210192=_0x210192-0x0;var _0x24fd4a=_0xded4[_0x210192];return _0x24fd4a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x4ded('0x0'));var util=require(_0x4ded('0x1'));var path=require(_0x4ded('0x2'));var ejs=require(_0x4ded('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4ded('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x4ded('0x5'));var pdf=require(_0x4ded('0x6'));var logger=require(_0x4ded('0x7'))(_0x4ded('0x8'));var config=require(_0x4ded('0x9'));var db=require(_0x4ded('0xa'))['db'];config['redis']=_['defaults'](config[_0x4ded('0xb')],{'host':_0x4ded('0xc'),'port':0x18eb});var socket=require(_0x4ded('0xd'))(new Redis(config[_0x4ded('0xb')]));require(_0x4ded('0xe'))[_0x4ded('0xf')](socket);function respondWithStatusCode(_0x22d079,_0x2890b1){_0x2890b1=_0x2890b1||0xcc;return function(_0x42e768){if(_0x42e768){return _0x22d079[_0x4ded('0x10')](_0x2890b1);}return _0x22d079[_0x4ded('0x11')](_0x2890b1)['end']();};}function respondWithResult(_0x28a11e,_0x5c2f8c){_0x5c2f8c=_0x5c2f8c||0xc8;return function(_0x261de3){if(_0x261de3){return _0x28a11e['status'](_0x5c2f8c)['json'](_0x261de3);}};}function respondWithFilteredResult(_0x67e5c7,_0x584e85){return function(_0x242bd3){if(_0x242bd3){var _0x44b516=typeof _0x584e85[_0x4ded('0x12')]===_0x4ded('0x13')&&typeof _0x584e85['limit']===_0x4ded('0x13');var _0x4d7245=_0x242bd3[_0x4ded('0x14')];var _0x4068a5=_0x44b516?0x0:_0x584e85[_0x4ded('0x12')];var _0x4bfd92=_0x44b516?_0x242bd3['count']:_0x584e85[_0x4ded('0x12')]+_0x584e85[_0x4ded('0x15')];var _0xe8cbcf;if(_0x4bfd92>=_0x4d7245){_0x4bfd92=_0x4d7245;_0xe8cbcf=0xc8;}else{_0xe8cbcf=0xce;}_0x67e5c7[_0x4ded('0x11')](_0xe8cbcf);return _0x67e5c7[_0x4ded('0x16')](_0x4ded('0x17'),_0x4068a5+'-'+_0x4bfd92+'/'+_0x4d7245)[_0x4ded('0x18')](_0x242bd3);}return null;};}function saveUpdates(_0x27fe70){return function(_0x4c6dcd){if(_0x4c6dcd){return _0x4c6dcd[_0x4ded('0x19')](_0x27fe70)[_0x4ded('0x1a')](function(_0x4c5a23){return _0x4c5a23;});}return null;};}function removeEntity(_0x22e765){return function(_0x4da95d){if(_0x4da95d){return _0x4da95d['destroy']()[_0x4ded('0x1a')](function(){_0x22e765[_0x4ded('0x11')](0xcc)[_0x4ded('0x1b')]();});}};}function handleEntityNotFound(_0x2295b7){return function(_0x2bc566){if(!_0x2bc566){_0x2295b7['sendStatus'](0x194);}return _0x2bc566;};}function handleError(_0x57b70f,_0x2a1a80){_0x2a1a80=_0x2a1a80||0x1f4;return function(_0x2c6f63){logger[_0x4ded('0x1c')](_0x2c6f63['stack']);if(_0x2c6f63[_0x4ded('0x1d')]){delete _0x2c6f63[_0x4ded('0x1d')];}_0x57b70f[_0x4ded('0x11')](_0x2a1a80)[_0x4ded('0x1e')](_0x2c6f63);};}exports[_0x4ded('0x1f')]=function(_0x1fd593,_0x4d4017){var _0x943896={};var _0x9aa501=_[_0x4ded('0x20')](db[_0x4ded('0x21')][_0x4ded('0x22')],function(_0x44168b){return{'name':_0x44168b['fieldName'],'type':_0x44168b[_0x4ded('0x23')]['key']};});_0x943896=qs[_0x4ded('0x24')](_0x9aa501,_0x1fd593);return interaction[_0x4ded('0x25')](_0x4ded('0x26'),_0x1fd593[_0x4ded('0x27')],_0x1fd593[_0x4ded('0x28')],_0x943896,_0x9aa501)['then'](respondWithFilteredResult(_0x4d4017,_0x943896))[_0x4ded('0x29')](handleError(_0x4d4017,null));};exports[_0x4ded('0x2a')]=function(_0x2a2070,_0x170b6e){var _0x27499c={};if(_0x2a2070[_0x4ded('0x27')]['type']&&_0x2a2070[_0x4ded('0x27')][_0x4ded('0x23')]==='from'){_0x27499c['from']=_0x2a2070[_0x4ded('0x2b')]['id'];}else{_0x27499c['id']=_0x2a2070['params']['id'];}var _0x2130a5={'raw':![],'where':_0x27499c},_0x2c5dc4={};_0x2c5dc4[_0x4ded('0x2c')]=_[_0x4ded('0x2d')](db[_0x4ded('0x21')][_0x4ded('0x22')]);_0x2c5dc4[_0x4ded('0x27')]=_[_0x4ded('0x2d')](_0x2a2070['query']);_0x2c5dc4['filters']=_[_0x4ded('0x2e')](_0x2c5dc4['model'],_0x2c5dc4['query']);_0x2130a5[_0x4ded('0x2f')]=_[_0x4ded('0x2e')](_0x2c5dc4[_0x4ded('0x2c')],qs[_0x4ded('0x30')](_0x2a2070[_0x4ded('0x27')]['fields']));_0x2130a5['attributes']=_0x2130a5['attributes']['length']?_0x2130a5[_0x4ded('0x2f')]:_0x2c5dc4[_0x4ded('0x2c')];if(_0x2a2070['query']['includeAll']){_0x2130a5['include']=[{'all':!![]}];}_0x2130a5=_[_0x4ded('0x31')]({},_0x2130a5,_0x2a2070[_0x4ded('0x32')]);return db[_0x4ded('0x21')][_0x4ded('0x33')](_0x2130a5)[_0x4ded('0x1a')](handleEntityNotFound(_0x170b6e,null))['then'](respondWithResult(_0x170b6e,null))[_0x4ded('0x29')](handleError(_0x170b6e,null));};exports[_0x4ded('0x34')]=function(_0x21924a,_0x35e42c){return db['OpenchannelInteraction']['create'](_0x21924a['body'],{})[_0x4ded('0x1a')](respondWithResult(_0x35e42c,0xc9))[_0x4ded('0x29')](handleError(_0x35e42c,null));};exports[_0x4ded('0x19')]=function(_0x540668,_0x198476){if(_0x540668[_0x4ded('0x35')]['id']){delete _0x540668[_0x4ded('0x35')]['id'];}return db['OpenchannelInteraction'][_0x4ded('0x33')]({'where':{'id':_0x540668[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x198476,null))[_0x4ded('0x1a')](saveUpdates(_0x540668['body'],null))['then'](respondWithResult(_0x198476,null))['catch'](handleError(_0x198476,null));};exports[_0x4ded('0x36')]=function(_0x3f9b3c,_0x2a83f4){return db['OpenchannelInteraction'][_0x4ded('0x33')]({'where':{'id':_0x3f9b3c[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x2a83f4,null))[_0x4ded('0x1a')](removeEntity(_0x2a83f4,null))['catch'](handleError(_0x2a83f4,null));};exports[_0x4ded('0x37')]=function(_0x330f14,_0x3d0f08){return db[_0x4ded('0x21')]['describe']()[_0x4ded('0x1a')](respondWithResult(_0x3d0f08,null))[_0x4ded('0x29')](handleError(_0x3d0f08,null));};exports[_0x4ded('0x38')]=function(_0x327e8d,_0x35dbed){return db[_0x4ded('0x39')][_0x4ded('0x33')]({'where':{'id':_0x327e8d[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x35dbed,null))[_0x4ded('0x1a')](function(_0x3ac180){if(_0x3ac180){return _0x3ac180[_0x4ded('0x38')](_0x327e8d[_0x4ded('0x35')][_0x4ded('0x3a')],_['omit'](_0x327e8d['body'],[_0x4ded('0x3a'),'id'])||{});}})[_0x4ded('0x1a')](respondWithResult(_0x35dbed,null))[_0x4ded('0x29')](handleError(_0x35dbed,null));};exports[_0x4ded('0x3b')]=function(_0x1400cb,_0x2eb7f4){var _0x65f32={'raw':![],'where':{}};var _0x1b2f07={};var _0x40cf36={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x1400cb[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x2eb7f4,null))['then'](function(_0x5e474c){if(_0x5e474c){_0x1b2f07['model']=_[_0x4ded('0x2d')](db['OpenchannelMessage'][_0x4ded('0x22')]);_0x1b2f07[_0x4ded('0x27')]=_[_0x4ded('0x2d')](_0x1400cb['query']);_0x1b2f07[_0x4ded('0x3c')]=_['intersection'](_0x1b2f07[_0x4ded('0x2c')],_0x1b2f07[_0x4ded('0x27')]);_0x65f32[_0x4ded('0x2f')]=_[_0x4ded('0x2e')](_0x1b2f07['model'],qs[_0x4ded('0x30')](_0x1400cb[_0x4ded('0x27')]['fields']));_0x65f32[_0x4ded('0x2f')]=_0x65f32[_0x4ded('0x2f')]['length']?_0x65f32[_0x4ded('0x2f')]:_0x1b2f07[_0x4ded('0x2c')];if(!_0x1400cb[_0x4ded('0x27')][_0x4ded('0x3d')](_0x4ded('0x3e'))){_0x65f32[_0x4ded('0x15')]=qs['limit'](_0x1400cb['query'][_0x4ded('0x15')]);_0x65f32[_0x4ded('0x12')]=qs['offset'](_0x1400cb[_0x4ded('0x27')][_0x4ded('0x12')]);}_0x65f32[_0x4ded('0x3f')]=qs[_0x4ded('0x40')](_0x1400cb[_0x4ded('0x27')][_0x4ded('0x40')]);_0x65f32[_0x4ded('0x41')]=qs[_0x4ded('0x3c')](_[_0x4ded('0x42')](_0x1400cb['query'],_0x1b2f07[_0x4ded('0x3c')]));_0x65f32[_0x4ded('0x41')][_0x4ded('0x43')]=_0x5e474c['id'];if(_0x1400cb[_0x4ded('0x27')][_0x4ded('0x44')]){_0x65f32[_0x4ded('0x41')]=_['merge'](_0x65f32['where'],{'$or':_[_0x4ded('0x20')](_0x65f32[_0x4ded('0x2f')],function(_0x3f28b4){var _0x5c1c05={};_0x5c1c05[_0x3f28b4]={'$like':'%'+_0x1400cb[_0x4ded('0x27')]['filter']+'%'};return _0x5c1c05;})});}if(_0x1400cb[_0x4ded('0x27')][_0x4ded('0x45')]){var _0x5a635e=_0x1400cb['query'][_0x4ded('0x45')][_0x4ded('0x46')](',');var _0x5879b7={};_0x5879b7[_0x5a635e[0x0]]={'$gte':moment(_0x5a635e[0x1])[_0x4ded('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x65f32[_0x4ded('0x41')]=_[_0x4ded('0x31')](_0x65f32[_0x4ded('0x41')],_0x5879b7);}_0x65f32=_['merge']({},_0x65f32,_0x1400cb[_0x4ded('0x32')]);return db[_0x4ded('0x39')]['count']({'where':_0x65f32[_0x4ded('0x41')]})[_0x4ded('0x1a')](function(_0x335026){_0x40cf36[_0x4ded('0x14')]=_0x335026;if(_0x1400cb[_0x4ded('0x27')][_0x4ded('0x48')]){_0x65f32[_0x4ded('0x49')]=[{'all':!![]}];}return db[_0x4ded('0x39')][_0x4ded('0x25')](_0x65f32);})[_0x4ded('0x1a')](function(_0x9657b){_0x40cf36[_0x4ded('0x4a')]=_0x9657b;return _0x40cf36;});}})[_0x4ded('0x1a')](respondWithFilteredResult(_0x2eb7f4,_0x65f32))[_0x4ded('0x29')](handleError(_0x2eb7f4,null));};exports[_0x4ded('0x4b')]=function(_0x58f97a,_0x252403){return db[_0x4ded('0x21')][_0x4ded('0x33')]({'where':{'id':_0x58f97a[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x252403,null))[_0x4ded('0x1a')](function(_0x303ef8){if(_0x303ef8){return _0x303ef8[_0x4ded('0x4c')](_0x58f97a['body'][_0x4ded('0x3a')],_[_0x4ded('0x4d')](_0x58f97a['body'],[_0x4ded('0x3a'),'id'])||{})[_0x4ded('0x4e')](function(){return db[_0x4ded('0x4f')][_0x4ded('0x25')]({'attributes':['id',_0x4ded('0x1d'),_0x4ded('0x50')],'where':{'id':_0x58f97a[_0x4ded('0x35')][_0x4ded('0x3a')]}});})[_0x4ded('0x1a')](function(_0xd404ac){socket['emit'](_0x4ded('0x51'),{'id':Number(_0x58f97a[_0x4ded('0x2b')]['id']),'tags':_0xd404ac||[]});return{'id':Number(_0x58f97a[_0x4ded('0x2b')]['id']),'tags':_0xd404ac||[]};});}})[_0x4ded('0x1a')](respondWithResult(_0x252403,null))[_0x4ded('0x29')](handleError(_0x252403,null));};exports[_0x4ded('0x52')]=function(_0x5e79a4,_0x150148){return db[_0x4ded('0x21')][_0x4ded('0x33')]({'where':{'id':_0x5e79a4[_0x4ded('0x2b')]['id']}})[_0x4ded('0x1a')](handleEntityNotFound(_0x150148,null))[_0x4ded('0x1a')](function(_0x25645b){if(_0x25645b){return _0x25645b['removeTags'](_0x5e79a4[_0x4ded('0x27')]['ids']);}})[_0x4ded('0x1a')](respondWithStatusCode(_0x150148,null))[_0x4ded('0x29')](handleError(_0x150148,null));};exports['download']=function(_0x305c11,_0x56868c){var _0x3422a8=moment()[_0x4ded('0x53')]()['toString']();var _0x4c3e68=path[_0x4ded('0x54')](config[_0x4ded('0x55')],_0x4ded('0x56'),_0x4ded('0x57'),_0x4ded('0x58'));var _0xe71058=path[_0x4ded('0x54')](config[_0x4ded('0x55')],_0x4ded('0x56'),_0x4ded('0x57'),_0x4ded('0x59'));var _0x2fc310=path[_0x4ded('0x54')](_0x4c3e68,_0x3422a8);var _0x424f02=util[_0x4ded('0x47')](_0x4ded('0x5a'),_0x305c11[_0x4ded('0x2b')]['id'],_0x3422a8);var _0x17ee68=path[_0x4ded('0x54')](_0x4c3e68,_0x424f02);var _0x2970a8=[];_0x2970a8['push']({'model':db['User'],'as':_0x4ded('0x5b'),'attributes':['id',_0x4ded('0x5c')],'raw':!![]});_0x2970a8[_0x4ded('0x5d')]({'model':db['CmContact'],'as':_0x4ded('0x5e'),'attributes':['id',_0x4ded('0x5f'),_0x4ded('0x60')],'raw':!![]});if(_0x305c11[_0x4ded('0x27')]['attachments']){_0x2970a8[_0x4ded('0x5d')]({'model':db['Attachment'],'as':_0x4ded('0x61'),'raw':!![]});}var _0x79980f=[{'model':db[_0x4ded('0x39')],'as':_0x4ded('0x62'),'attributes':['id',_0x4ded('0x35'),_0x4ded('0x63'),_0x4ded('0x64'),_0x4ded('0x65'),_0x4ded('0x66')],'include':_0x2970a8}];_0x79980f[_0x4ded('0x5d')]({'model':db[_0x4ded('0x67')],'as':'Account','attributes':['id',_0x4ded('0x1d')]});_0x79980f[_0x4ded('0x5d')]({'model':db[_0x4ded('0x5b')],'as':_0x4ded('0x68'),'attributes':['id',_0x4ded('0x5c')]});return db[_0x4ded('0x21')][_0x4ded('0x33')]({'where':{'id':_0x305c11[_0x4ded('0x2b')]['id']},'include':_0x79980f})[_0x4ded('0x1a')](handleEntityNotFound(_0x56868c,null))['then'](function(_0x5b4052){if(_0x5b4052){var _0x1a85b2=_0x5b4052[_0x4ded('0x69')]({'plain':!![]});fs['mkdirSync'](_0x2fc310);var _0x2d14e7={'channel':_0x4ded('0x6a'),'account':_0x1a85b2[_0x4ded('0x6b')]['name'],'agent':_0x1a85b2[_0x4ded('0x68')]?_0x1a85b2[_0x4ded('0x68')][_0x4ded('0x5c')]:_0x4ded('0x6c'),'createdAt':moment(_0x1a85b2[_0x4ded('0x63')])[_0x4ded('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4ded('0x6d')](),'closedAt':_0x1a85b2['closed']?moment(_0x1a85b2['closedAt'])['format'](_0x4ded('0x6e'))[_0x4ded('0x6d')]():'','disposition':_0x1a85b2[_0x4ded('0x6f')],'visibility':_0x1a85b2[_0x4ded('0x70')]?_0x4ded('0x71'):'Private','messages':_(_0x1a85b2[_0x4ded('0x62')])[_0x4ded('0x44')]({'secret':![]})['map'](function(_0x9499d2){if(_0x9499d2[_0x4ded('0x61')]){var _0x3c2cbb=path[_0x4ded('0x54')](_0xe71058,_0x9499d2['Attachment'][_0x4ded('0x72')]);if(fs[_0x4ded('0x73')](_0x3c2cbb)){fs[_0x4ded('0x74')](_0x3c2cbb)[_0x4ded('0x75')](fs['createWriteStream'](path[_0x4ded('0x54')](_0x2fc310,_0x9499d2[_0x4ded('0x61')][_0x4ded('0x72')])));}}return{'date':moment(_0x9499d2[_0x4ded('0x63')])['format'](_0x4ded('0x6e'))[_0x4ded('0x6d')](),'sender':_0x9499d2[_0x4ded('0x64')]===_0x4ded('0x76')?_0x9499d2['User']?_0x9499d2[_0x4ded('0x5b')][_0x4ded('0x5c')]:_0x4ded('0x77'):_0x9499d2[_0x4ded('0x5e')][_0x4ded('0x5f')]+(_0x9499d2[_0x4ded('0x5e')][_0x4ded('0x60')]?'\x20'+_0x9499d2['Contact'][_0x4ded('0x60')]:''),'body':_0x9499d2[_0x4ded('0x61')]?_0x9499d2[_0x4ded('0x61')][_0x4ded('0x72')]:_0x9499d2[_0x4ded('0x35')],'direction':_0x9499d2[_0x4ded('0x64')]===_0x4ded('0x76')?'A':'C','secret':_0x9499d2[_0x4ded('0x65')],'read':_0x9499d2[_0x4ded('0x66')],'attachment':_0x9499d2[_0x4ded('0x61')]};})[_0x4ded('0x78')]()};return ejs[_0x4ded('0x79')](path['join'](config[_0x4ded('0x55')],_0x4ded('0x56'),_0x4ded('0x7a'),_0x4ded('0x7b')),{'interaction':_0x2d14e7})[_0x4ded('0x1a')](function(_0x323d17){var _0x39242c=path['join'](_0x2fc310,_0x4ded('0x7c')+_0x1a85b2['id']+'-'+_0x3422a8+_0x4ded('0x7d'));var _0x1491f={'path':_0x39242c,'channel':_0x4ded('0x6a'),'interactionId':_0x1a85b2['id']};return pdf['createPdfFromHTML'](_0x323d17,_0x1491f);})[_0x4ded('0x1a')](function(){return new Promise(function(_0x586977,_0x3fb018){zipdir(_0x2fc310,{'saveTo':_0x17ee68},function(_0x14edab,_0x1e0821){if(_0x14edab)return _0x3fb018(_0x14edab);return _0x586977(_0x1e0821);});})[_0x4ded('0x1a')](function(){return new Promise(function(_0x48a723,_0x276ea3){rimraf(_0x2fc310,function(_0x213c88){if(_0x213c88)_0x276ea3(_0x213c88);return _0x48a723();});});})['then'](function(){return _0x56868c[_0x4ded('0x7e')](_0x17ee68,_0x424f02,function(_0x1c7e6d){if(_0x1c7e6d){logger[_0x4ded('0x1c')](_0x4ded('0x7f'),_0x1c7e6d);}else{fs[_0x4ded('0x80')](_0x17ee68);}});});});}else{return _0x56868c[_0x4ded('0x10')](0xc8);}})[_0x4ded('0x29')](handleError(_0x56868c,null));}; \ No newline at end of file +var _0xed25=['format','Public','Private','existsSync','createReadStream','pipe','out','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','sendStatus','error','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','openchannel','query','user','type','from','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','catch','create','update','body','find','describe','OpenchannelMessage','addMessage','omit','ids','findOne','filters','length','nolimit','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','color','openchannelInteractionTags:save','download','unix','toString','join','server','files','tmp','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','Openchannel','N.A.','closed','closedAt'];(function(_0x42ef26,_0x595718){var _0x5bc7c5=function(_0x145be1){while(--_0x145be1){_0x42ef26['push'](_0x42ef26['shift']());}};_0x5bc7c5(++_0x595718);}(_0xed25,0x178));var _0x5ed2=function(_0x52e0da,_0x46546d){_0x52e0da=_0x52e0da-0x0;var _0x3490ec=_0xed25[_0x52e0da];return _0x3490ec;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5ed2('0x0'));var moment=require('moment');var util=require('util');var path=require(_0x5ed2('0x1'));var ejs=require(_0x5ed2('0x2'));var fs=require('fs');var _=require(_0x5ed2('0x3'));var Redis=require('ioredis');var interaction=require(_0x5ed2('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5ed2('0x5'));var logger=require('../../config/logger')(_0x5ed2('0x6'));var config=require(_0x5ed2('0x7'));var db=require(_0x5ed2('0x8'))['db'];config['redis']=_[_0x5ed2('0x9')](config[_0x5ed2('0xa')],{'host':_0x5ed2('0xb'),'port':0x18eb});var socket=require(_0x5ed2('0xc'))(new Redis(config['redis']));require(_0x5ed2('0xd'))['register'](socket);function respondWithStatusCode(_0x6a90fc,_0x162755){_0x162755=_0x162755||0xcc;return function(_0xf9a737){if(_0xf9a737){return _0x6a90fc['sendStatus'](_0x162755);}return _0x6a90fc[_0x5ed2('0xe')](_0x162755)['end']();};}function respondWithResult(_0x579457,_0x1c5d1f){_0x1c5d1f=_0x1c5d1f||0xc8;return function(_0xf2c6b1){if(_0xf2c6b1){return _0x579457[_0x5ed2('0xe')](_0x1c5d1f)[_0x5ed2('0xf')](_0xf2c6b1);}};}function respondWithFilteredResult(_0x1a0152,_0x275635){return function(_0x4bcf11){if(_0x4bcf11){var _0x23fe47=typeof _0x275635['offset']===_0x5ed2('0x10')&&typeof _0x275635[_0x5ed2('0x11')]===_0x5ed2('0x10');var _0x15e52b=_0x4bcf11[_0x5ed2('0x12')];var _0xa573f4=_0x23fe47?0x0:_0x275635[_0x5ed2('0x13')];var _0xad851=_0x23fe47?_0x4bcf11[_0x5ed2('0x12')]:_0x275635[_0x5ed2('0x13')]+_0x275635['limit'];var _0x4d70c5;if(_0xad851>=_0x15e52b){_0xad851=_0x15e52b;_0x4d70c5=0xc8;}else{_0x4d70c5=0xce;}_0x1a0152[_0x5ed2('0xe')](_0x4d70c5);return _0x1a0152[_0x5ed2('0x14')](_0x5ed2('0x15'),_0xa573f4+'-'+_0xad851+'/'+_0x15e52b)[_0x5ed2('0xf')](_0x4bcf11);}return null;};}function saveUpdates(_0x5f0bc6){return function(_0x26c87e){if(_0x26c87e){return _0x26c87e['update'](_0x5f0bc6)[_0x5ed2('0x16')](function(_0x4c52bd){return _0x4c52bd;});}return null;};}function removeEntity(_0x52874f){return function(_0x2d0ca9){if(_0x2d0ca9){return _0x2d0ca9[_0x5ed2('0x17')]()['then'](function(){_0x52874f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x481c03){return function(_0x272db6){if(!_0x272db6){_0x481c03[_0x5ed2('0x18')](0x194);}return _0x272db6;};}function handleError(_0x3f792d,_0x4e5b76){_0x4e5b76=_0x4e5b76||0x1f4;return function(_0x580f65){logger[_0x5ed2('0x19')](_0x580f65['stack']);if(_0x580f65[_0x5ed2('0x1a')]){delete _0x580f65[_0x5ed2('0x1a')];}_0x3f792d['status'](_0x4e5b76)[_0x5ed2('0x1b')](_0x580f65);};}exports[_0x5ed2('0x1c')]=function(_0xeb12ac,_0x3d9160){var _0x524fc2={};var _0x792ff=_[_0x5ed2('0x1d')](db[_0x5ed2('0x1e')][_0x5ed2('0x1f')],function(_0x404038){return{'name':_0x404038[_0x5ed2('0x20')],'type':_0x404038['type'][_0x5ed2('0x21')]};});_0x524fc2=qs[_0x5ed2('0x22')](_0x792ff,_0xeb12ac);return interaction['findAll'](_0x5ed2('0x23'),_0xeb12ac[_0x5ed2('0x24')],_0xeb12ac[_0x5ed2('0x25')],_0x524fc2,_0x792ff)[_0x5ed2('0x16')](respondWithFilteredResult(_0x3d9160,_0x524fc2))['catch'](handleError(_0x3d9160,null));};exports['show']=function(_0x5d92a0,_0x197f7){var _0x563827={};if(_0x5d92a0['query'][_0x5ed2('0x26')]&&_0x5d92a0[_0x5ed2('0x24')]['type']===_0x5ed2('0x27')){_0x563827[_0x5ed2('0x27')]=_0x5d92a0['params']['id'];}else{_0x563827['id']=_0x5d92a0[_0x5ed2('0x28')]['id'];}var _0x18b3fc={'raw':![],'where':_0x563827},_0x665134={};_0x665134[_0x5ed2('0x29')]=_['keys'](db[_0x5ed2('0x1e')]['rawAttributes']);_0x665134[_0x5ed2('0x24')]=_[_0x5ed2('0x2a')](_0x5d92a0[_0x5ed2('0x24')]);_0x665134['filters']=_[_0x5ed2('0x2b')](_0x665134['model'],_0x665134[_0x5ed2('0x24')]);_0x18b3fc[_0x5ed2('0x2c')]=_[_0x5ed2('0x2b')](_0x665134[_0x5ed2('0x29')],qs[_0x5ed2('0x2d')](_0x5d92a0['query'][_0x5ed2('0x2d')]));_0x18b3fc[_0x5ed2('0x2c')]=_0x18b3fc['attributes']['length']?_0x18b3fc['attributes']:_0x665134[_0x5ed2('0x29')];if(_0x5d92a0[_0x5ed2('0x24')][_0x5ed2('0x2e')]){_0x18b3fc[_0x5ed2('0x2f')]=[{'all':!![]}];}_0x18b3fc=_[_0x5ed2('0x30')]({},_0x18b3fc,_0x5d92a0[_0x5ed2('0x31')]);return db[_0x5ed2('0x1e')]['find'](_0x18b3fc)[_0x5ed2('0x16')](handleEntityNotFound(_0x197f7,null))['then'](respondWithResult(_0x197f7,null))[_0x5ed2('0x32')](handleError(_0x197f7,null));};exports[_0x5ed2('0x33')]=function(_0x23bc00,_0x1c4ade){return db[_0x5ed2('0x1e')][_0x5ed2('0x33')](_0x23bc00['body'],{})['then'](respondWithResult(_0x1c4ade,0xc9))[_0x5ed2('0x32')](handleError(_0x1c4ade,null));};exports[_0x5ed2('0x34')]=function(_0x27fe76,_0x40962d){if(_0x27fe76['body']['id']){delete _0x27fe76[_0x5ed2('0x35')]['id'];}return db[_0x5ed2('0x1e')]['find']({'where':{'id':_0x27fe76[_0x5ed2('0x28')]['id']}})[_0x5ed2('0x16')](handleEntityNotFound(_0x40962d,null))[_0x5ed2('0x16')](saveUpdates(_0x27fe76[_0x5ed2('0x35')],null))[_0x5ed2('0x16')](respondWithResult(_0x40962d,null))['catch'](handleError(_0x40962d,null));};exports['destroy']=function(_0x22db86,_0x517017){return db['OpenchannelInteraction'][_0x5ed2('0x36')]({'where':{'id':_0x22db86[_0x5ed2('0x28')]['id']}})['then'](handleEntityNotFound(_0x517017,null))[_0x5ed2('0x16')](removeEntity(_0x517017,null))[_0x5ed2('0x32')](handleError(_0x517017,null));};exports[_0x5ed2('0x37')]=function(_0x2b0674,_0x4edf83){return db[_0x5ed2('0x1e')]['describe']()[_0x5ed2('0x16')](respondWithResult(_0x4edf83,null))[_0x5ed2('0x32')](handleError(_0x4edf83,null));};exports['addMessage']=function(_0x1f69df,_0x2e2aed){return db[_0x5ed2('0x38')]['find']({'where':{'id':_0x1f69df[_0x5ed2('0x28')]['id']}})[_0x5ed2('0x16')](handleEntityNotFound(_0x2e2aed,null))[_0x5ed2('0x16')](function(_0x3c1784){if(_0x3c1784){return _0x3c1784[_0x5ed2('0x39')](_0x1f69df[_0x5ed2('0x35')]['ids'],_[_0x5ed2('0x3a')](_0x1f69df['body'],[_0x5ed2('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x2e2aed,null))[_0x5ed2('0x32')](handleError(_0x2e2aed,null));};exports['getMessages']=function(_0x2b455c,_0x3e2f13){var _0x477fc6={'raw':![],'where':{}};var _0x334eca={};var _0x5db8c6={'count':0x0,'rows':[]};return db[_0x5ed2('0x1e')][_0x5ed2('0x3c')]({'where':{'id':_0x2b455c['params']['id']}})[_0x5ed2('0x16')](handleEntityNotFound(_0x3e2f13,null))['then'](function(_0x4f051b){if(_0x4f051b){_0x334eca[_0x5ed2('0x29')]=_[_0x5ed2('0x2a')](db[_0x5ed2('0x38')]['rawAttributes']);_0x334eca['query']=_[_0x5ed2('0x2a')](_0x2b455c[_0x5ed2('0x24')]);_0x334eca[_0x5ed2('0x3d')]=_['intersection'](_0x334eca[_0x5ed2('0x29')],_0x334eca[_0x5ed2('0x24')]);_0x477fc6[_0x5ed2('0x2c')]=_['intersection'](_0x334eca[_0x5ed2('0x29')],qs[_0x5ed2('0x2d')](_0x2b455c[_0x5ed2('0x24')]['fields']));_0x477fc6[_0x5ed2('0x2c')]=_0x477fc6[_0x5ed2('0x2c')][_0x5ed2('0x3e')]?_0x477fc6[_0x5ed2('0x2c')]:_0x334eca[_0x5ed2('0x29')];if(!_0x2b455c['query']['hasOwnProperty'](_0x5ed2('0x3f'))){_0x477fc6[_0x5ed2('0x11')]=qs[_0x5ed2('0x11')](_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x11')]);_0x477fc6[_0x5ed2('0x13')]=qs[_0x5ed2('0x13')](_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x13')]);}_0x477fc6[_0x5ed2('0x40')]=qs[_0x5ed2('0x41')](_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x41')]);_0x477fc6[_0x5ed2('0x42')]=qs[_0x5ed2('0x3d')](_['pick'](_0x2b455c[_0x5ed2('0x24')],_0x334eca['filters']));_0x477fc6[_0x5ed2('0x42')]['OpenchannelInteractionId']=_0x4f051b['id'];if(_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x43')]){_0x477fc6[_0x5ed2('0x42')]=_[_0x5ed2('0x30')](_0x477fc6[_0x5ed2('0x42')],{'$or':_[_0x5ed2('0x1d')](_0x477fc6[_0x5ed2('0x2c')],function(_0x371feb){var _0x39c087={};_0x39c087[_0x371feb]={'$like':'%'+_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x43')]+'%'};return _0x39c087;})});}if(_0x2b455c['query'][_0x5ed2('0x44')]){var _0xb06fc3=_0x2b455c[_0x5ed2('0x24')][_0x5ed2('0x44')][_0x5ed2('0x45')](',');var _0x5a781b={};_0x5a781b[_0xb06fc3[0x0]]={'$gte':moment(_0xb06fc3[0x1])['format'](_0x5ed2('0x46'))};_0x477fc6[_0x5ed2('0x42')]=_[_0x5ed2('0x30')](_0x477fc6['where'],_0x5a781b);}_0x477fc6=_[_0x5ed2('0x30')]({},_0x477fc6,_0x2b455c['options']);return db[_0x5ed2('0x38')]['count']({'where':_0x477fc6['where']})['then'](function(_0x500795){_0x5db8c6[_0x5ed2('0x12')]=_0x500795;if(_0x2b455c[_0x5ed2('0x24')]['includeAll']){_0x477fc6[_0x5ed2('0x2f')]=[{'all':!![]}];}return db[_0x5ed2('0x38')]['findAll'](_0x477fc6);})[_0x5ed2('0x16')](function(_0x234d83){_0x5db8c6['rows']=_0x234d83;return _0x5db8c6;});}})[_0x5ed2('0x16')](respondWithFilteredResult(_0x3e2f13,_0x477fc6))['catch'](handleError(_0x3e2f13,null));};exports[_0x5ed2('0x47')]=function(_0x5300dc,_0x19566d){return db[_0x5ed2('0x1e')]['find']({'where':{'id':_0x5300dc[_0x5ed2('0x28')]['id']}})['then'](handleEntityNotFound(_0x19566d,null))[_0x5ed2('0x16')](function(_0x182a29){if(_0x182a29){return _0x182a29[_0x5ed2('0x48')](_0x5300dc[_0x5ed2('0x35')][_0x5ed2('0x3b')],_['omit'](_0x5300dc['body'],[_0x5ed2('0x3b'),'id'])||{})[_0x5ed2('0x49')](function(){return db[_0x5ed2('0x4a')][_0x5ed2('0x4b')]({'attributes':['id',_0x5ed2('0x1a'),_0x5ed2('0x4c')],'where':{'id':_0x5300dc[_0x5ed2('0x35')][_0x5ed2('0x3b')]}});})[_0x5ed2('0x16')](function(_0x701505){socket['emit'](_0x5ed2('0x4d'),{'id':Number(_0x5300dc[_0x5ed2('0x28')]['id']),'tags':_0x701505||[]});return{'id':Number(_0x5300dc[_0x5ed2('0x28')]['id']),'tags':_0x701505||[]};});}})[_0x5ed2('0x16')](respondWithResult(_0x19566d,null))['catch'](handleError(_0x19566d,null));};exports['removeTags']=function(_0x2a1184,_0x24f321){return db[_0x5ed2('0x1e')]['find']({'where':{'id':_0x2a1184[_0x5ed2('0x28')]['id']}})[_0x5ed2('0x16')](handleEntityNotFound(_0x24f321,null))[_0x5ed2('0x16')](function(_0x46c7be){if(_0x46c7be){return _0x46c7be['removeTags'](_0x2a1184[_0x5ed2('0x24')][_0x5ed2('0x3b')]);}})['then'](respondWithStatusCode(_0x24f321,null))[_0x5ed2('0x32')](handleError(_0x24f321,null));};exports[_0x5ed2('0x4e')]=function(_0x3d7ffc,_0x13bb08){var _0x4d26db=moment()[_0x5ed2('0x4f')]()[_0x5ed2('0x50')]();var _0x408c34=path[_0x5ed2('0x51')](config['root'],_0x5ed2('0x52'),_0x5ed2('0x53'),_0x5ed2('0x54'));var _0x3c48af=path[_0x5ed2('0x51')](config['root'],_0x5ed2('0x52'),'files','attachments');var _0x3a4ffd=path[_0x5ed2('0x51')](_0x408c34,_0x4d26db);var _0x58de9a=util['format']('transcript-%d-%s.zip',_0x3d7ffc['params']['id'],_0x4d26db);var _0x1028c8=path[_0x5ed2('0x51')](_0x408c34,_0x58de9a);var _0x1a5da6=[];_0x1a5da6[_0x5ed2('0x55')]({'model':db['User'],'as':_0x5ed2('0x56'),'attributes':['id',_0x5ed2('0x57')],'raw':!![]});_0x1a5da6[_0x5ed2('0x55')]({'model':db['CmContact'],'as':_0x5ed2('0x58'),'attributes':['id',_0x5ed2('0x59'),_0x5ed2('0x5a')],'raw':!![]});if(_0x3d7ffc[_0x5ed2('0x24')][_0x5ed2('0x5b')]){_0x1a5da6[_0x5ed2('0x55')]({'model':db[_0x5ed2('0x5c')],'as':'Attachment','raw':!![]});}var _0x17f623=[{'model':db[_0x5ed2('0x38')],'as':_0x5ed2('0x5d'),'attributes':['id','body',_0x5ed2('0x5e'),_0x5ed2('0x5f'),_0x5ed2('0x60'),'read'],'include':_0x1a5da6}];_0x17f623[_0x5ed2('0x55')]({'model':db['OpenchannelAccount'],'as':_0x5ed2('0x61'),'attributes':['id',_0x5ed2('0x1a')]});_0x17f623[_0x5ed2('0x55')]({'model':db['User'],'as':_0x5ed2('0x62'),'attributes':['id','fullname']});return db[_0x5ed2('0x1e')][_0x5ed2('0x36')]({'where':{'id':_0x3d7ffc[_0x5ed2('0x28')]['id']},'include':_0x17f623})[_0x5ed2('0x16')](handleEntityNotFound(_0x13bb08,null))[_0x5ed2('0x16')](function(_0x3249f){if(_0x3249f){var _0x8268a8=_0x3249f[_0x5ed2('0x63')]({'plain':!![]});fs['mkdirSync'](_0x3a4ffd);var _0x5626d={'channel':_0x5ed2('0x64'),'account':_0x8268a8['Account']['name'],'agent':_0x8268a8['Owner']?_0x8268a8[_0x5ed2('0x62')][_0x5ed2('0x57')]:_0x5ed2('0x65'),'createdAt':moment(_0x8268a8[_0x5ed2('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5ed2('0x50')](),'closedAt':_0x8268a8[_0x5ed2('0x66')]?moment(_0x8268a8[_0x5ed2('0x67')])[_0x5ed2('0x68')](_0x5ed2('0x46'))[_0x5ed2('0x50')]():'','disposition':_0x8268a8['disposition'],'visibility':_0x8268a8['threadId']?_0x5ed2('0x69'):_0x5ed2('0x6a'),'messages':_(_0x8268a8[_0x5ed2('0x5d')])['filter']({'secret':![]})[_0x5ed2('0x1d')](function(_0x21cc43){if(_0x21cc43[_0x5ed2('0x5c')]){var _0x4d768c=path['join'](_0x3c48af,_0x21cc43[_0x5ed2('0x5c')]['basename']);if(fs[_0x5ed2('0x6b')](_0x4d768c)){fs[_0x5ed2('0x6c')](_0x4d768c)[_0x5ed2('0x6d')](fs['createWriteStream'](path[_0x5ed2('0x51')](_0x3a4ffd,_0x21cc43[_0x5ed2('0x5c')]['basename'])));}}return{'date':moment(_0x21cc43[_0x5ed2('0x5e')])[_0x5ed2('0x68')](_0x5ed2('0x46'))[_0x5ed2('0x50')](),'sender':_0x21cc43[_0x5ed2('0x5f')]==='out'?_0x21cc43[_0x5ed2('0x56')]?_0x21cc43[_0x5ed2('0x56')][_0x5ed2('0x57')]:'System':_0x21cc43[_0x5ed2('0x58')][_0x5ed2('0x59')]+(_0x21cc43[_0x5ed2('0x58')][_0x5ed2('0x5a')]?'\x20'+_0x21cc43[_0x5ed2('0x58')][_0x5ed2('0x5a')]:''),'body':_0x21cc43[_0x5ed2('0x5c')]?_0x21cc43[_0x5ed2('0x5c')]['basename']:_0x21cc43[_0x5ed2('0x35')],'direction':_0x21cc43['direction']===_0x5ed2('0x6e')?'A':'C','secret':_0x21cc43['secret'],'read':_0x21cc43[_0x5ed2('0x6f')],'attachment':_0x21cc43[_0x5ed2('0x5c')]};})['value']()};return ejs[_0x5ed2('0x70')](path['join'](config['root'],'server',_0x5ed2('0x71'),_0x5ed2('0x72')),{'interaction':_0x5626d})['then'](function(_0x2a39d9){var _0x4e68b2=path[_0x5ed2('0x51')](_0x3a4ffd,_0x5ed2('0x73')+_0x8268a8['id']+'-'+_0x4d26db+_0x5ed2('0x74'));var _0x2e79c6={'path':_0x4e68b2,'channel':_0x5ed2('0x64'),'interactionId':_0x8268a8['id']};return pdf[_0x5ed2('0x75')](_0x2a39d9,_0x2e79c6);})[_0x5ed2('0x16')](function(){return new Promise(function(_0x3548ef,_0x5bc8a2){zipdir(_0x3a4ffd,{'saveTo':_0x1028c8},function(_0x4d4ecf,_0x99bcbf){if(_0x4d4ecf)return _0x5bc8a2(_0x4d4ecf);return _0x3548ef(_0x99bcbf);});})[_0x5ed2('0x16')](function(){return new Promise(function(_0xc564ce,_0x345a97){rimraf(_0x3a4ffd,function(_0x1baadf){if(_0x1baadf)_0x345a97(_0x1baadf);return _0xc564ce();});});})['then'](function(){return _0x13bb08['download'](_0x1028c8,_0x58de9a,function(_0x2e8f75){if(_0x2e8f75){logger['error'](_0x5ed2('0x76'),_0x2e8f75);}else{fs[_0x5ed2('0x77')](_0x1028c8);}});});});}else{return _0x13bb08[_0x5ed2('0x18')](0xc8);}})[_0x5ed2('0x32')](handleError(_0x13bb08,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f7842e5..3240440 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 _0x474e=['../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','unreadMessages','length','catch','hasOwnProperty','hook','events'];(function(_0x2c3954,_0x4df48f){var _0x1c95be=function(_0x5e8a3f){while(--_0x5e8a3f){_0x2c3954['push'](_0x2c3954['shift']());}};_0x1c95be(++_0x4df48f);}(_0x474e,0x133));var _0xe474=function(_0x5a77f0,_0x56c60b){_0x5a77f0=_0x5a77f0-0x0;var _0x3d6d82=_0x474e[_0x5a77f0];return _0x3d6d82;};'use strict';var EventEmitter=require(_0xe474('0x0'));var OpenchannelInteraction=require(_0xe474('0x1'))['db'][_0xe474('0x2')];var OpenchannelMessage=require(_0xe474('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe474('0x3')](0x0);var events={'afterCreate':_0xe474('0x4'),'afterUpdate':_0xe474('0x5'),'afterDestroy':_0xe474('0x6')};function emitEvent(_0x4f70da){return function(_0x6f5da0,_0x40dd2e,_0x1ba450){_0x6f5da0[_0xe474('0x7')]({'attributes':['id'],'raw':!![]})[_0xe474('0x8')](function(_0x51e587){_0x6f5da0['setDataValue']('Users',_0x51e587['map'](function(_0x5b97cc){return{'id':_0x5b97cc['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x6f5da0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe474('0x8')](function(_0x2b4a7e){_0x6f5da0['setDataValue'](_0xe474('0x9'),_0x2b4a7e[_0xe474('0xa')]);OpenchannelInteractionEvents['emit'](_0x4f70da+':'+_0x6f5da0['id'],_0x6f5da0);OpenchannelInteractionEvents['emit'](_0x4f70da,_0x6f5da0);_0x1ba450(null);})[_0xe474('0xb')](_0x1ba450(null));};}for(var e in events){if(events[_0xe474('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xe474('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1d92=['OpenchannelMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1d92,0x19b));var _0x21d9=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0x1d92[_0x52b844];return _0x14432f;};'use strict';var EventEmitter=require(_0x21d9('0x0'));var OpenchannelInteraction=require(_0x21d9('0x1'))['db'][_0x21d9('0x2')];var OpenchannelMessage=require(_0x21d9('0x1'))['db'][_0x21d9('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x21d9('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x21d9('0x5')};function emitEvent(_0x1c4179){return function(_0x264368,_0x92b677,_0x10c655){_0x264368[_0x21d9('0x6')]({'attributes':['id'],'raw':!![]})[_0x21d9('0x7')](function(_0x44b7da){_0x264368[_0x21d9('0x8')](_0x21d9('0x9'),_0x44b7da[_0x21d9('0xa')](function(_0x32ded7){return{'id':_0x32ded7['id']};}));return OpenchannelMessage[_0x21d9('0xb')]({'where':{'OpenchannelInteractionId':_0x264368['id'],'direction':'in','read':![]},'raw':!![]});})[_0x21d9('0x7')](function(_0x3d406a){_0x264368['setDataValue'](_0x21d9('0xc'),_0x3d406a[_0x21d9('0xd')]);OpenchannelInteractionEvents['emit'](_0x1c4179+':'+_0x264368['id'],_0x264368);OpenchannelInteractionEvents[_0x21d9('0xe')](_0x1c4179,_0x264368);_0x10c655(null);})[_0x21d9('0xf')](_0x10c655(null));};}for(var e in events){if(events[_0x21d9('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x21d9('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 19b15d3..2078ab4 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 _0x9172=['api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x2b96c5,_0xb376b1){var _0x3e432a=function(_0x20352a){while(--_0x20352a){_0x2b96c5['push'](_0x2b96c5['shift']());}};_0x3e432a(++_0xb376b1);}(_0x9172,0xe8));var _0x2917=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x9172[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x2917('0x0'));var util=require('util');var logger=require(_0x2917('0x1'))(_0x2917('0x2'));var moment=require(_0x2917('0x3'));var BPromise=require('bluebird');var rp=require(_0x2917('0x4'));var fs=require('fs');var path=require(_0x2917('0x5'));var rimraf=require(_0x2917('0x6'));var config=require(_0x2917('0x7'));var attributes=require(_0x2917('0x8'));module[_0x2917('0x9')]=function(_0x5da1a6,_0x4b4588){return _0x5da1a6[_0x2917('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x2917('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2917('0xc'),'collate':_0x2917('0xd'),'hooks':{'beforeUpdate':function(_0x25a2c8,_0x5be954,_0x33af6a){if(_0x25a2c8[_0x2917('0xe')](_0x2917('0xf'))){_0x25a2c8[_0x2917('0x10')]=moment()['format'](_0x2917('0x11'));}_0x33af6a(null,_0x25a2c8);}}});}; \ No newline at end of file +var _0x213f=['./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','format','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x213f,0x1c7));var _0xf213=function(_0x41081e,_0x2faf8a){_0x41081e=_0x41081e-0x0;var _0x140b28=_0x213f[_0x41081e];return _0x140b28;};'use strict';var _=require('lodash');var util=require(_0xf213('0x0'));var logger=require(_0xf213('0x1'))('api');var moment=require(_0xf213('0x2'));var BPromise=require('bluebird');var rp=require(_0xf213('0x3'));var fs=require('fs');var path=require(_0xf213('0x4'));var rimraf=require(_0xf213('0x5'));var config=require(_0xf213('0x6'));var attributes=require(_0xf213('0x7'));module[_0xf213('0x8')]=function(_0x4795b3,_0x513fed){return _0x4795b3['define'](_0xf213('0x9'),attributes,{'tableName':_0xf213('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf213('0xb'),'hooks':{'beforeUpdate':function(_0x520f1a,_0xf15e8d,_0x21c1eb){if(_0x520f1a[_0xf213('0xc')]('closed')){_0x520f1a['closedAt']=moment()[_0xf213('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21c1eb(null,_0x520f1a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 78aa292..9a23132 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 _0xd2f9=['http','defaults','socket.io-emitter','redis','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1fa792,_0x2de71d){var _0x31c4f9=function(_0x261030){while(--_0x261030){_0x1fa792['push'](_0x1fa792['shift']());}};_0x31c4f9(++_0x2de71d);}(_0xd2f9,0xcb));var _0x9d2f=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xd2f9[_0x1b5a05];return _0x347931;};'use strict';var _=require(_0x9d2f('0x0'));var util=require(_0x9d2f('0x1'));var moment=require(_0x9d2f('0x2'));var BPromise=require(_0x9d2f('0x3'));var rs=require(_0x9d2f('0x4'));var fs=require('fs');var Redis=require(_0x9d2f('0x5'));var db=require(_0x9d2f('0x6'))['db'];var utils=require(_0x9d2f('0x7'));var logger=require('../../config/logger')(_0x9d2f('0x8'));var config=require(_0x9d2f('0x9'));var jayson=require(_0x9d2f('0xa'));var client=jayson[_0x9d2f('0xb')][_0x9d2f('0xc')]({'port':0x232a});config['redis']=_[_0x9d2f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9d2f('0xe'))(new Redis(config[_0x9d2f('0xf')]));require('./openchannelInteraction.socket')[_0x9d2f('0x10')](socket);function respondWithRpcPromise(_0x3423ba,_0xe16610,_0x17444f){return new BPromise(function(_0x879a4e,_0xc1cd3c){return client[_0x9d2f('0x11')](_0x3423ba,_0x17444f)[_0x9d2f('0x12')](function(_0x10c740){logger['info'](_0x9d2f('0x13'),_0xe16610,_0x9d2f('0x14'));logger[_0x9d2f('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xe16610,_0x9d2f('0x14'),JSON[_0x9d2f('0x16')](_0x10c740));if(_0x10c740['error']){if(_0x10c740[_0x9d2f('0x17')][_0x9d2f('0x18')]===0x1f4){logger['error'](_0x9d2f('0x13'),_0xe16610,_0x10c740[_0x9d2f('0x17')]['message']);return _0xc1cd3c(_0x10c740['error']['message']);}logger[_0x9d2f('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0xe16610,_0x10c740[_0x9d2f('0x17')]['message']);return _0x879a4e(_0x10c740[_0x9d2f('0x17')]['message']);}else{logger['info'](_0x9d2f('0x13'),_0xe16610,'request\x20sent');_0x879a4e(_0x10c740[_0x9d2f('0x19')][_0x9d2f('0x1a')]);}})[_0x9d2f('0x1b')](function(_0x16fe3a){logger[_0x9d2f('0x17')](_0x9d2f('0x13'),_0xe16610,_0x16fe3a);_0xc1cd3c(_0x16fe3a);});});}exports[_0x9d2f('0x1c')]=function(_0x9bfc04){var _0x4b0d5d=this;return new Promise(function(_0x158a54,_0x221ddc){return db[_0x9d2f('0x1d')][_0x9d2f('0x1e')](_0x9bfc04[_0x9d2f('0x1f')],{'raw':_0x9bfc04[_0x9d2f('0x20')]?_0x9bfc04['options'][_0x9d2f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9bfc04[_0x9d2f('0x20')]?_0x9bfc04['options'][_0x9d2f('0x22')]||null:null,'attributes':_0x9bfc04['options']?_0x9bfc04[_0x9d2f('0x20')][_0x9d2f('0x23')]||null:null,'limit':_0x9bfc04[_0x9d2f('0x20')]?_0x9bfc04[_0x9d2f('0x20')][_0x9d2f('0x24')]||null:null})[_0x9d2f('0x12')](function(_0x111d32){logger['info'](_0x9d2f('0x1c'),_0x9bfc04);logger[_0x9d2f('0x15')](_0x9d2f('0x1c'),_0x9bfc04,JSON[_0x9d2f('0x16')](_0x111d32));_0x158a54(_0x111d32);})['catch'](function(_0x5aa406){logger['error'](_0x9d2f('0x1c'),_0x5aa406['message'],_0x9bfc04);_0x221ddc(_0x4b0d5d['error'](0x1f4,_0x5aa406[_0x9d2f('0x1a')]));});});};exports[_0x9d2f('0x25')]=function(_0x3ab266){return new Promise(function(_0x5671f6,_0x7efbcc){return db['OpenchannelInteraction'][_0x9d2f('0x26')]({'where':_0x3ab266[_0x9d2f('0x20')]?_0x3ab266[_0x9d2f('0x20')][_0x9d2f('0x22')]||null:null})[_0x9d2f('0x12')](function(_0x19f484){if(_0x19f484){return _0x19f484[_0x9d2f('0x27')](_0x3ab266[_0x9d2f('0x1f')][_0x9d2f('0x28')],_[_0x9d2f('0x29')](_0x3ab266[_0x9d2f('0x1f')],['ids','id'])||{});}})['spread'](function(_0x16dd5d){logger['info'](_0x9d2f('0x2a'),_0x3ab266);logger[_0x9d2f('0x15')]('AddTags',_0x3ab266,JSON['stringify'](_0x16dd5d));_0x5671f6(_0x16dd5d);})[_0x9d2f('0x1b')](function(_0x421b40){logger['error']('AddTags',_0x421b40[_0x9d2f('0x1a')],_0x3ab266);_0x7efbcc(_this[_0x9d2f('0x17')](0x1f4,_0x421b40[_0x9d2f('0x1a')]));});});}; \ No newline at end of file +var _0xae58=['OpenchannelInteraction','body','options','raw','where','attributes','stringify','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelInteraction'];(function(_0x488f32,_0x307ba6){var _0x2dc451=function(_0x4610d5){while(--_0x4610d5){_0x488f32['push'](_0x488f32['shift']());}};_0x2dc451(++_0x307ba6);}(_0xae58,0x1d3));var _0x8ae5=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xae58[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0x8ae5('0x0'));var util=require('util');var moment=require(_0x8ae5('0x1'));var BPromise=require(_0x8ae5('0x2'));var rs=require(_0x8ae5('0x3'));var fs=require('fs');var Redis=require(_0x8ae5('0x4'));var db=require(_0x8ae5('0x5'))['db'];var utils=require(_0x8ae5('0x6'));var logger=require('../../config/logger')(_0x8ae5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ae5('0x8'));var client=jayson[_0x8ae5('0x9')]['http']({'port':0x232a});config[_0x8ae5('0xa')]=_[_0x8ae5('0xb')](config['redis'],{'host':_0x8ae5('0xc'),'port':0x18eb});var socket=require(_0x8ae5('0xd'))(new Redis(config[_0x8ae5('0xa')]));require(_0x8ae5('0xe'))[_0x8ae5('0xf')](socket);function respondWithRpcPromise(_0xd06465,_0x34b6cb,_0x16db9e){return new BPromise(function(_0x1b435e,_0x4b0403){return client[_0x8ae5('0x10')](_0xd06465,_0x16db9e)[_0x8ae5('0x11')](function(_0x11fd71){logger[_0x8ae5('0x12')](_0x8ae5('0x13'),_0x34b6cb,'request\x20sent');logger[_0x8ae5('0x14')](_0x8ae5('0x15'),_0x34b6cb,'request\x20sent',JSON['stringify'](_0x11fd71));if(_0x11fd71[_0x8ae5('0x16')]){if(_0x11fd71[_0x8ae5('0x16')]['code']===0x1f4){logger['error'](_0x8ae5('0x13'),_0x34b6cb,_0x11fd71['error']['message']);return _0x4b0403(_0x11fd71['error'][_0x8ae5('0x17')]);}logger[_0x8ae5('0x16')](_0x8ae5('0x13'),_0x34b6cb,_0x11fd71['error'][_0x8ae5('0x17')]);return _0x1b435e(_0x11fd71['error']['message']);}else{logger['info'](_0x8ae5('0x13'),_0x34b6cb,'request\x20sent');_0x1b435e(_0x11fd71[_0x8ae5('0x18')][_0x8ae5('0x17')]);}})[_0x8ae5('0x19')](function(_0x503ba1){logger[_0x8ae5('0x16')](_0x8ae5('0x13'),_0x34b6cb,_0x503ba1);_0x4b0403(_0x503ba1);});});}exports[_0x8ae5('0x1a')]=function(_0x5309b1){var _0x2845c4=this;return new Promise(function(_0x271d7b,_0x3872c7){return db[_0x8ae5('0x1b')]['update'](_0x5309b1[_0x8ae5('0x1c')],{'raw':_0x5309b1[_0x8ae5('0x1d')]?_0x5309b1[_0x8ae5('0x1d')][_0x8ae5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5309b1[_0x8ae5('0x1d')]?_0x5309b1[_0x8ae5('0x1d')][_0x8ae5('0x1f')]||null:null,'attributes':_0x5309b1[_0x8ae5('0x1d')]?_0x5309b1[_0x8ae5('0x1d')][_0x8ae5('0x20')]||null:null,'limit':_0x5309b1[_0x8ae5('0x1d')]?_0x5309b1['options']['limit']||null:null})[_0x8ae5('0x11')](function(_0x4159b0){logger['info'](_0x8ae5('0x1a'),_0x5309b1);logger['debug'](_0x8ae5('0x1a'),_0x5309b1,JSON[_0x8ae5('0x21')](_0x4159b0));_0x271d7b(_0x4159b0);})[_0x8ae5('0x19')](function(_0x91d30c){logger['error'](_0x8ae5('0x1a'),_0x91d30c[_0x8ae5('0x17')],_0x5309b1);_0x3872c7(_0x2845c4[_0x8ae5('0x16')](0x1f4,_0x91d30c[_0x8ae5('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x31f83d){return new Promise(function(_0x430951,_0x19bb63){return db[_0x8ae5('0x1b')]['find']({'where':_0x31f83d['options']?_0x31f83d['options']['where']||null:null})[_0x8ae5('0x11')](function(_0x34781c){if(_0x34781c){return _0x34781c['addTags'](_0x31f83d[_0x8ae5('0x1c')][_0x8ae5('0x22')],_[_0x8ae5('0x23')](_0x31f83d['body'],[_0x8ae5('0x22'),'id'])||{});}})[_0x8ae5('0x24')](function(_0x266d89){logger[_0x8ae5('0x12')]('AddTags',_0x31f83d);logger[_0x8ae5('0x14')](_0x8ae5('0x25'),_0x31f83d,JSON['stringify'](_0x266d89));_0x430951(_0x266d89);})[_0x8ae5('0x19')](function(_0x348cfe){logger[_0x8ae5('0x16')](_0x8ae5('0x25'),_0x348cfe[_0x8ae5('0x17')],_0x31f83d);_0x19bb63(_this['error'](0x1f4,_0x348cfe[_0x8ae5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 26aea75..fab8ec8 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 _0xb8a0=['openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener','length'];(function(_0x48f3a9,_0x1946f3){var _0x5b333a=function(_0xef298c){while(--_0xef298c){_0x48f3a9['push'](_0x48f3a9['shift']());}};_0x5b333a(++_0x1946f3);}(_0xb8a0,0x121));var _0x0b8a=function(_0x1e75dd,_0x5cf6f0){_0x1e75dd=_0x1e75dd-0x0;var _0x555d1b=_0xb8a0[_0x1e75dd];return _0x555d1b;};'use strict';var OpenchannelInteractionEvents=require(_0x0b8a('0x0'));var events=[_0x0b8a('0x1'),'remove',_0x0b8a('0x2')];function createListener(_0x2f73e3,_0x234019){return function(_0x516b22){_0x234019['emit'](_0x2f73e3,_0x516b22);};}function removeListener(_0x508193,_0x2f1d29){return function(){OpenchannelInteractionEvents[_0x0b8a('0x3')](_0x508193,_0x2f1d29);};}exports['register']=function(_0x440a84){for(var _0x1fe2b1=0x0,_0x28eaa6=events[_0x0b8a('0x4')];_0x1fe2b1<_0x28eaa6;_0x1fe2b1++){var _0x51e59b=events[_0x1fe2b1];var _0xfc0677=createListener(_0x0b8a('0x5')+_0x51e59b,_0x440a84);OpenchannelInteractionEvents['on'](_0x51e59b,_0xfc0677);}}; \ No newline at end of file +var _0x74c1=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x74c1,0x13f));var _0x174c=function(_0x863e9e,_0x5854b0){_0x863e9e=_0x863e9e-0x0;var _0x24fa60=_0x74c1[_0x863e9e];return _0x24fa60;};'use strict';var OpenchannelInteractionEvents=require(_0x174c('0x0'));var events=['save',_0x174c('0x1'),_0x174c('0x2')];function createListener(_0x129ab5,_0x5997a5){return function(_0x1d55e0){_0x5997a5['emit'](_0x129ab5,_0x1d55e0);};}function removeListener(_0x104089,_0x1972b5){return function(){OpenchannelInteractionEvents[_0x174c('0x3')](_0x104089,_0x1972b5);};}exports[_0x174c('0x4')]=function(_0x3191d5){for(var _0xed32e9=0x0,_0x5cf95d=events[_0x174c('0x5')];_0xed32e9<_0x5cf95d;_0xed32e9++){var _0x215ad3=events[_0xed32e9];var _0x215168=createListener(_0x174c('0x6')+_0x215ad3,_0x3191d5);OpenchannelInteractionEvents['on'](_0x215ad3,_0x215168);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ac25516..533c26e 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x1c8a88,_0x51d55e){var _0x116225=function(_0x5cf835){while(--_0x5cf835){_0x1c8a88['push'](_0x1c8a88['shift']());}};_0x116225(++_0x51d55e);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x1cda30,_0x57881d){var _0x1809f8=function(_0x2a62ea){while(--_0x2a62ea){_0x1cda30['push'](_0x1cda30['shift']());}};_0x1809f8(++_0x57881d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 7e8ed57..ae09a9f 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 _0xcbe1=['out','DATE','TEXT','exports','ENUM'];(function(_0x237bb1,_0x4481f3){var _0x5a781b=function(_0x1ee401){while(--_0x1ee401){_0x237bb1['push'](_0x237bb1['shift']());}};_0x5a781b(++_0x4481f3);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x2d2153,_0x4509d6){_0x2d2153=_0x2d2153-0x0;var _0x20299e=_0xcbe1[_0x2d2153];return _0x20299e;};'use strict';var Sequelize=require('sequelize');module[_0x1cbe('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1cbe('0x1')]('in',_0x1cbe('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x1cbe('0x3')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1cbe('0x4')]}}; \ No newline at end of file +var _0x4b0f=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x367825,_0xba445e){var _0x17e0c2=function(_0x2a16cc){while(--_0x2a16cc){_0x367825['push'](_0x367825['shift']());}};_0x17e0c2(++_0xba445e);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x1ec3fe,_0x2bbc3d){_0x1ec3fe=_0x1ec3fe-0x0;var _0x23d25b=_0x4b0f[_0x1ec3fe];return _0x23d25b;};'use strict';var Sequelize=require('sequelize');module[_0xf4b0('0x0')]={'body':{'type':Sequelize[_0xf4b0('0x1')](_0xf4b0('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf4b0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4b0('0x4')]('in',_0xf4b0('0x5')),'defaultValue':_0xf4b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf4b0('0x6')]},'providerName':{'type':Sequelize[_0xf4b0('0x7')]},'providerResponse':{'type':Sequelize[_0xf4b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e2146cf..d2d9801 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 _0xa72f=['request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','params','describe','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','openchannel-interactions','OpenchannelInteraction','rejectMessage','sequelize','SELECT','event','rejectmessage','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http'];(function(_0x477f38,_0xdd56b4){var _0x5be1a3=function(_0x1591eb){while(--_0x1591eb){_0x477f38['push'](_0x477f38['shift']());}};_0x5be1a3(++_0xdd56b4);}(_0xa72f,0x170));var _0xfa72=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0xa72f[_0x29f730];return _0x189806;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa72('0x0'));var jsonpatch=require(_0xfa72('0x1'));var rp=require('request-promise');var moment=require(_0xfa72('0x2'));var BPromise=require(_0xfa72('0x3'));var Mustache=require(_0xfa72('0x4'));var util=require('util');var path=require(_0xfa72('0x5'));var sox=require(_0xfa72('0x6'));var csv=require(_0xfa72('0x7'));var ejs=require(_0xfa72('0x8'));var fs=require('fs');var fs_extra=require(_0xfa72('0x9'));var _=require(_0xfa72('0xa'));var squel=require('squel');var crypto=require(_0xfa72('0xb'));var jsforce=require(_0xfa72('0xc'));var deskjs=require(_0xfa72('0xd'));var toCsv=require(_0xfa72('0x7'));var querystring=require(_0xfa72('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa72('0xf'));var authService=require(_0xfa72('0x10'));var qs=require(_0xfa72('0x11'));var as=require(_0xfa72('0x12'));var hardwareService=require(_0xfa72('0x13'));var logger=require(_0xfa72('0x14'))(_0xfa72('0x15'));var utils=require(_0xfa72('0x16'));var config=require(_0xfa72('0x17'));var licenseUtil=require(_0xfa72('0x18'));var db=require(_0xfa72('0x19'))['db'];config[_0xfa72('0x1a')]=_[_0xfa72('0x1b')](config[_0xfa72('0x1a')],{'host':_0xfa72('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa72('0x1a')]));require(_0xfa72('0x1d'))[_0xfa72('0x1e')](socket);var jayson=require(_0xfa72('0x1f'));var client=jayson[_0xfa72('0x20')][_0xfa72('0x21')]({'port':0x232c});var client9002=jayson[_0xfa72('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554b8c,_0x41ff22,_0x3245d6,_0x3e3f83){return new BPromise(function(_0x494b33,_0x1b903b){var _0x193d37=_0x3e3f83||client;return _0x193d37[_0xfa72('0x22')](_0x554b8c,_0x3245d6)[_0xfa72('0x23')](function(_0x2c9521){logger[_0xfa72('0x24')](_0xfa72('0x25'),_0x41ff22,_0xfa72('0x26'));logger[_0xfa72('0x27')](_0xfa72('0x28'),_0x41ff22,_0xfa72('0x26'),JSON[_0xfa72('0x29')](_0x2c9521));if(_0x2c9521[_0xfa72('0x2a')]){if(_0x2c9521[_0xfa72('0x2a')][_0xfa72('0x2b')]===0x1f4){logger[_0xfa72('0x2a')](_0xfa72('0x25'),_0x41ff22,_0x2c9521[_0xfa72('0x2a')]['message']);return _0x1b903b(_0x2c9521[_0xfa72('0x2a')][_0xfa72('0x2c')]);}logger['error'](_0xfa72('0x25'),_0x41ff22,_0x2c9521[_0xfa72('0x2a')]['message']);return _0x494b33(_0x2c9521[_0xfa72('0x2a')][_0xfa72('0x2c')]);}else{logger[_0xfa72('0x24')](_0xfa72('0x25'),_0x41ff22,_0xfa72('0x26'));_0x494b33(_0x2c9521[_0xfa72('0x2d')][_0xfa72('0x2c')]);}})['catch'](function(_0x7691c1){logger['error'](_0xfa72('0x25'),_0x41ff22,_0x7691c1);_0x1b903b(_0x7691c1);});});}function respondWithStatusCode(_0x58b807,_0x5402f6){_0x5402f6=_0x5402f6||0xcc;return function(_0x233968){if(_0x233968){return _0x58b807[_0xfa72('0x2e')](_0x5402f6);}return _0x58b807[_0xfa72('0x2f')](_0x5402f6)[_0xfa72('0x30')]();};}function respondWithResult(_0x46b0d0,_0x98f3d3){_0x98f3d3=_0x98f3d3||0xc8;return function(_0x266e70){if(_0x266e70){return _0x46b0d0[_0xfa72('0x2f')](_0x98f3d3)[_0xfa72('0x31')](_0x266e70);}};}function respondWithFilteredResult(_0x431a53,_0x1052ba){return function(_0x3dd624){if(_0x3dd624){var _0x33b338=typeof _0x1052ba['offset']===_0xfa72('0x32')&&typeof _0x1052ba['limit']==='undefined';var _0x5b5c38=_0x3dd624[_0xfa72('0x33')];var _0x3483aa=_0x33b338?0x0:_0x1052ba['offset'];var _0x3a43b2=_0x33b338?_0x3dd624[_0xfa72('0x33')]:_0x1052ba[_0xfa72('0x34')]+_0x1052ba[_0xfa72('0x35')];var _0x2d6603;if(_0x3a43b2>=_0x5b5c38){_0x3a43b2=_0x5b5c38;_0x2d6603=0xc8;}else{_0x2d6603=0xce;}_0x431a53['status'](_0x2d6603);return _0x431a53[_0xfa72('0x36')](_0xfa72('0x37'),_0x3483aa+'-'+_0x3a43b2+'/'+_0x5b5c38)[_0xfa72('0x31')](_0x3dd624);}return null;};}function patchUpdates(_0x484863){return function(_0xf7ec3){try{jsonpatch['apply'](_0xf7ec3,_0x484863,!![]);}catch(_0x3877a9){return BPromise[_0xfa72('0x38')](_0x3877a9);}return _0xf7ec3[_0xfa72('0x39')]();};}function saveUpdates(_0x4f25ee,_0x512c6f){return function(_0x5b0218){if(_0x5b0218){return _0x5b0218[_0xfa72('0x3a')](_0x4f25ee)[_0xfa72('0x23')](function(_0x4b70af){return _0x4b70af;});}return null;};}function removeEntity(_0xc1f122,_0x322cc4){return function(_0xc64ba){if(_0xc64ba){return _0xc64ba[_0xfa72('0x3b')]()[_0xfa72('0x23')](function(){_0xc1f122[_0xfa72('0x2f')](0xcc)[_0xfa72('0x30')]();});}};}function handleEntityNotFound(_0xcc1386,_0x47ddb9){return function(_0x3c538a){if(!_0x3c538a){_0xcc1386[_0xfa72('0x2e')](0x194);}return _0x3c538a;};}function handleError(_0x861399,_0x1b7308){_0x1b7308=_0x1b7308||0x1f4;return function(_0xa502a6){logger[_0xfa72('0x2a')](_0xa502a6[_0xfa72('0x3c')]);if(_0xa502a6[_0xfa72('0x3d')]){delete _0xa502a6['name'];}_0x861399['status'](_0x1b7308)['send'](_0xa502a6);};}exports['index']=function(_0x4ce0a7,_0x54dfbc){var _0x2a295c={},_0x510d76={},_0x59cab2={'count':0x0,'rows':[]};var _0x496e35=_[_0xfa72('0x3e')](db[_0xfa72('0x3f')][_0xfa72('0x40')],function(_0x17bd6a){return{'name':_0x17bd6a[_0xfa72('0x41')],'type':_0x17bd6a[_0xfa72('0x42')][_0xfa72('0x43')]};});_0x510d76[_0xfa72('0x44')]=_[_0xfa72('0x3e')](_0x496e35,'name');_0x510d76[_0xfa72('0x45')]=_[_0xfa72('0x46')](_0x4ce0a7[_0xfa72('0x45')]);_0x510d76[_0xfa72('0x47')]=_[_0xfa72('0x48')](_0x510d76['model'],_0x510d76['query']);_0x2a295c['attributes']=_[_0xfa72('0x48')](_0x510d76[_0xfa72('0x44')],qs[_0xfa72('0x49')](_0x4ce0a7[_0xfa72('0x45')]['fields']));_0x2a295c['attributes']=_0x2a295c[_0xfa72('0x4a')]['length']?_0x2a295c['attributes']:_0x510d76[_0xfa72('0x44')];if(!_0x4ce0a7[_0xfa72('0x45')][_0xfa72('0x4b')]('nolimit')){_0x2a295c['limit']=qs['limit'](_0x4ce0a7[_0xfa72('0x45')][_0xfa72('0x35')]);_0x2a295c[_0xfa72('0x34')]=qs[_0xfa72('0x34')](_0x4ce0a7['query']['offset']);}_0x2a295c[_0xfa72('0x4c')]=qs[_0xfa72('0x4d')](_0x4ce0a7[_0xfa72('0x45')][_0xfa72('0x4d')]);_0x2a295c[_0xfa72('0x4e')]=qs['filters'](_[_0xfa72('0x4f')](_0x4ce0a7['query'],_0x510d76[_0xfa72('0x47')]),_0x496e35);if(_0x4ce0a7[_0xfa72('0x45')][_0xfa72('0x50')]){_0x2a295c['where']=_[_0xfa72('0x51')](_0x2a295c[_0xfa72('0x4e')],{'$or':_['map'](_0x496e35,function(_0x5bddb9){if(_0x5bddb9[_0xfa72('0x42')]!==_0xfa72('0x52')){var _0x4423a5={};_0x4423a5[_0x5bddb9[_0xfa72('0x3d')]]={'$like':'%'+_0x4ce0a7['query']['filter']+'%'};return _0x4423a5;}})});}_0x2a295c=_[_0xfa72('0x51')]({},_0x2a295c,_0x4ce0a7[_0xfa72('0x53')]);var _0x69de06={'where':_0x2a295c['where']};return db[_0xfa72('0x3f')][_0xfa72('0x33')](_0x69de06)['then'](function(_0x377001){_0x59cab2[_0xfa72('0x33')]=_0x377001;if(_0x4ce0a7[_0xfa72('0x45')][_0xfa72('0x54')]){_0x2a295c[_0xfa72('0x55')]=[{'all':!![]}];}return db[_0xfa72('0x3f')][_0xfa72('0x56')](_0x2a295c);})[_0xfa72('0x23')](function(_0xc7e2e){_0x59cab2['rows']=_0xc7e2e;return _0x59cab2;})[_0xfa72('0x23')](respondWithFilteredResult(_0x54dfbc,_0x2a295c))['catch'](handleError(_0x54dfbc,null));};exports[_0xfa72('0x57')]=function(_0x2b88f9,_0x5beb83){var _0x159412={'raw':!![],'where':{'id':_0x2b88f9['params']['id']}},_0x589a31={};_0x589a31[_0xfa72('0x44')]=_[_0xfa72('0x46')](db[_0xfa72('0x3f')]['rawAttributes']);_0x589a31[_0xfa72('0x45')]=_[_0xfa72('0x46')](_0x2b88f9[_0xfa72('0x45')]);_0x589a31[_0xfa72('0x47')]=_['intersection'](_0x589a31[_0xfa72('0x44')],_0x589a31[_0xfa72('0x45')]);_0x159412[_0xfa72('0x4a')]=_[_0xfa72('0x48')](_0x589a31[_0xfa72('0x44')],qs[_0xfa72('0x49')](_0x2b88f9[_0xfa72('0x45')]['fields']));_0x159412[_0xfa72('0x4a')]=_0x159412[_0xfa72('0x4a')]['length']?_0x159412[_0xfa72('0x4a')]:_0x589a31[_0xfa72('0x44')];if(_0x2b88f9[_0xfa72('0x45')][_0xfa72('0x54')]){_0x159412[_0xfa72('0x55')]=[{'all':!![]}];}_0x159412=_[_0xfa72('0x51')]({},_0x159412,_0x2b88f9['options']);return db['OpenchannelMessage'][_0xfa72('0x58')](_0x159412)[_0xfa72('0x23')](handleEntityNotFound(_0x5beb83,null))[_0xfa72('0x23')](respondWithResult(_0x5beb83,null))[_0xfa72('0x59')](handleError(_0x5beb83,null));};exports[_0xfa72('0x5a')]=function(_0x551692,_0xecd492){return db[_0xfa72('0x3f')][_0xfa72('0x5a')](_0x551692[_0xfa72('0x5b')],{})[_0xfa72('0x23')](respondWithResult(_0xecd492,0xc9))[_0xfa72('0x59')](handleError(_0xecd492,null));};exports[_0xfa72('0x3a')]=function(_0x28c82c,_0xfb876c){if(_0x28c82c[_0xfa72('0x5b')]['id']){delete _0x28c82c[_0xfa72('0x5b')]['id'];}return db[_0xfa72('0x3f')]['find']({'where':{'id':_0x28c82c[_0xfa72('0x5c')]['id']}})[_0xfa72('0x23')](handleEntityNotFound(_0xfb876c,null))[_0xfa72('0x23')](saveUpdates(_0x28c82c[_0xfa72('0x5b')],null))['then'](respondWithResult(_0xfb876c,null))['catch'](handleError(_0xfb876c,null));};exports[_0xfa72('0x3b')]=function(_0x308d2a,_0x15c114){return db[_0xfa72('0x3f')][_0xfa72('0x58')]({'where':{'id':_0x308d2a[_0xfa72('0x5c')]['id']}})[_0xfa72('0x23')](handleEntityNotFound(_0x15c114,null))[_0xfa72('0x23')](removeEntity(_0x15c114,null))[_0xfa72('0x59')](handleError(_0x15c114,null));};exports['describe']=function(_0x5a0039,_0x31966b){return db['OpenchannelMessage'][_0xfa72('0x5d')]()[_0xfa72('0x23')](respondWithResult(_0x31966b,null))[_0xfa72('0x59')](handleError(_0x31966b,null));};var interaction_log=require(_0xfa72('0x14'))('openchannel-interactions');exports[_0xfa72('0x5e')]=function(_0x293fb3,_0x3933d2,_0x13cff5){var _0x29821d={'agent':{},'channel':_0xfa72('0x5f')};if(_0x293fb3[_0xfa72('0x5b')]['id']){delete _0x293fb3[_0xfa72('0x5b')]['id'];}_0x293fb3[_0xfa72('0x5b')][_0xfa72('0x60')]=!![];_0x293fb3[_0xfa72('0x5b')][_0xfa72('0x61')]=moment()[_0xfa72('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x293fb3[_0xfa72('0x5b')][_0xfa72('0x63')]=_0x293fb3[_0xfa72('0x5b')]['UserId']||_0x293fb3[_0xfa72('0x64')]['id'];_0x29821d[_0xfa72('0x65')]['id']=_0x293fb3['body'][_0xfa72('0x63')];return db[_0xfa72('0x3f')][_0xfa72('0x58')]({'where':{'id':_0x293fb3[_0xfa72('0x5c')]['id'],'UserId':null}})[_0xfa72('0x23')](handleEntityNotFound(_0x3933d2,null))[_0xfa72('0x23')](saveUpdates(_0x293fb3[_0xfa72('0x5b')],null))[_0xfa72('0x23')](function(_0x2d6857){if(_0x2d6857){_0x29821d[_0xfa72('0x2c')]=_0x2d6857[_0xfa72('0x66')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2d6857[_0xfa72('0x67')]}});}return null;})[_0xfa72('0x23')](handleEntityNotFound(_0x3933d2,null))['then'](function(_0xdc9192){if(_0xdc9192){return _0xdc9192['update']({'UserId':_0x293fb3[_0xfa72('0x5b')]['UserId'],'read1stAt':_[_0xfa72('0x68')](_0xdc9192[_0xfa72('0x69')])?moment()[_0xfa72('0x62')](_0xfa72('0x6a')):undefined});}return null;})[_0xfa72('0x23')](function(_0x442ffb){if(_0x442ffb){_0x29821d['interaction']=_0x442ffb[_0xfa72('0x66')]({'plain':!![]});interaction_log[_0xfa72('0x24')](_0xfa72('0x6b'),_0x293fb3[_0xfa72('0x64')]['id'],_0x293fb3[_0xfa72('0x64')]['name'],_0x293fb3['user'][_0xfa72('0x6c')],_0x29821d[_0xfa72('0x6d')]['id'],_0x293fb3[_0xfa72('0x5b')]?JSON[_0xfa72('0x29')](_0x293fb3[_0xfa72('0x5b')]):'null');return respondWithRpcPromise(_0xfa72('0x6e'),_0xfa72('0x6f'),_0x29821d);}return null;})['then'](function(_0x25d914){var _0x449f00=_0xfa72('0x70')+_0x25d914['message'][_0xfa72('0x71')];return db['sequelize']['query'](_0x449f00,{'type':db[_0xfa72('0x72')][_0xfa72('0x73')]['SELECT'],'raw':!![]})[_0xfa72('0x23')](function(_0x27a1e){return _0x27a1e;});})[_0xfa72('0x23')](function(_0x437c76){if(_0x437c76){_0x29821d[_0xfa72('0x2c')][_0xfa72('0x74')]=_0x437c76[0x0];if(!_0x293fb3[_0xfa72('0x5b')]['UserId'])return;return db[_0xfa72('0x75')][_0xfa72('0x58')]({'where':{'id':_0x293fb3[_0xfa72('0x5b')][_0xfa72('0x63')],'role':'agent'},'attributes':['id','name',_0xfa72('0x76'),_0xfa72('0x77'),_0xfa72('0x78')],'raw':!![]});}return null;})[_0xfa72('0x23')](function(_0x5bc882){if(!_0x5bc882)return null;_0x29821d[_0xfa72('0x2c')][_0xfa72('0x65')]=_0x5bc882;return _0x29821d;})[_0xfa72('0x23')](function(_0x1314e5){if(_0x1314e5){if(_0x293fb3[_0xfa72('0x5b')][_0xfa72('0x79')]){_0x29821d[_0xfa72('0x2c')][_0xfa72('0x7a')]=util[_0xfa72('0x62')](_0xfa72('0x7b'),_0x293fb3[_0xfa72('0x64')][_0xfa72('0x3d')]);_0x29821d['message'][_0xfa72('0x7c')]=_0x29821d['channel'];_0x29821d[_0xfa72('0x2c')][_0xfa72('0x7d')]=_0x29821d[_0xfa72('0x7c')];_0x29821d[_0xfa72('0x2c')]['event']='accept';return respondWithRpcPromise(_0xfa72('0x7e'),_0xfa72('0x7e'),{'event':'acceptmessage','message':_0x29821d[_0xfa72('0x2c')]},client9002)[_0xfa72('0x23')](function(){return _0x29821d;});}return _0x29821d;}return null;})[_0xfa72('0x23')](respondWithResult(_0x3933d2,null))[_0xfa72('0x59')](handleError(_0x3933d2,null));};var interaction_log=require('../../config/logger')(_0xfa72('0x7f'));exports[_0xfa72('0x38')]=function(_0x26ce57,_0x1358b3,_0x189193){var _0x398148={'agent':{},'channel':_0xfa72('0x5f')};if(_0x26ce57[_0xfa72('0x5b')]['id']){delete _0x26ce57[_0xfa72('0x5b')]['id'];}_0x26ce57[_0xfa72('0x5b')][_0xfa72('0x63')]=_0x26ce57[_0xfa72('0x5b')]['UserId']||_0x26ce57['user']['id'];_0x398148['agent']['id']=_0x26ce57[_0xfa72('0x5b')][_0xfa72('0x63')];return db['OpenchannelMessage'][_0xfa72('0x58')]({'where':{'id':_0x26ce57[_0xfa72('0x5c')]['id'],'UserId':null}})[_0xfa72('0x23')](handleEntityNotFound(_0x1358b3,null))[_0xfa72('0x23')](function(_0x51b954){if(_0x51b954){_0x398148[_0xfa72('0x2c')]=_0x51b954['get']({'plain':!![]});return db[_0xfa72('0x80')][_0xfa72('0x58')]({'where':{'id':_0x51b954[_0xfa72('0x67')]}});}return null;})[_0xfa72('0x23')](handleEntityNotFound(_0x1358b3,null))[_0xfa72('0x23')](function(_0x8c04f2){if(_0x8c04f2){_0x398148['interaction']=_0x8c04f2[_0xfa72('0x66')]({'plain':!![]});interaction_log[_0xfa72('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26ce57['user']['id'],_0x26ce57[_0xfa72('0x64')]['name'],_0x26ce57[_0xfa72('0x64')][_0xfa72('0x6c')],_0x398148[_0xfa72('0x6d')]['id'],_0x26ce57['body']?JSON['stringify'](_0x26ce57[_0xfa72('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0xfa72('0x81'),_0x398148);}return null;})[_0xfa72('0x23')](function(_0x46b7db){var _0x36cfd2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x46b7db[_0xfa72('0x2c')][_0xfa72('0x71')];return db[_0xfa72('0x82')][_0xfa72('0x45')](_0x36cfd2,{'type':db[_0xfa72('0x72')][_0xfa72('0x73')][_0xfa72('0x83')],'raw':!![]})[_0xfa72('0x23')](function(_0x4ebe4c){return _0x4ebe4c;});})['then'](function(_0x51c832){if(_0x51c832){_0x398148['message'][_0xfa72('0x74')]=_0x51c832[0x0];if(!_0x26ce57[_0xfa72('0x5b')][_0xfa72('0x63')])return;return db[_0xfa72('0x75')][_0xfa72('0x58')]({'where':{'id':_0x26ce57['body'][_0xfa72('0x63')],'role':_0xfa72('0x65')},'attributes':['id','name','fullname',_0xfa72('0x77'),_0xfa72('0x78')],'raw':!![]});}return null;})[_0xfa72('0x23')](function(_0x1e75c3){if(!_0x1e75c3)return null;_0x398148[_0xfa72('0x2c')][_0xfa72('0x65')]=_0x1e75c3;return _0x398148;})[_0xfa72('0x23')](function(_0x1f84b1){if(_0x1f84b1){_0x1f84b1[_0xfa72('0x2c')][_0xfa72('0x7a')]=util[_0xfa72('0x62')]('SIP/%s',_0x26ce57['user'][_0xfa72('0x3d')]);_0x1f84b1[_0xfa72('0x2c')][_0xfa72('0x7c')]=_0x398148[_0xfa72('0x7c')];_0x1f84b1[_0xfa72('0x2c')][_0xfa72('0x7d')]=_0x398148[_0xfa72('0x7c')];_0x1f84b1[_0xfa72('0x2c')][_0xfa72('0x84')]='reject';respondWithRpcPromise(_0xfa72('0x7e'),'EventManager',{'event':_0xfa72('0x85'),'message':_0x1f84b1['message']},client9002);return _0x398148;}return null;})[_0xfa72('0x23')](respondWithResult(_0x1358b3,null))[_0xfa72('0x59')](handleError(_0x1358b3,null));}; \ No newline at end of file +var _0xd714=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','include','findAll','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','channel','motionChannel','EventManager','acceptmessage','reject','OpenchannelInteraction','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request'];(function(_0x4f8d4a,_0x52f8dc){var _0x29b013=function(_0x5aed79){while(--_0x5aed79){_0x4f8d4a['push'](_0x4f8d4a['shift']());}};_0x29b013(++_0x52f8dc);}(_0xd714,0x1e4));var _0x4d71=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0xd714[_0x2cde2a];return _0x110f55;};'use strict';var emlformat=require(_0x4d71('0x0'));var rimraf=require(_0x4d71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d71('0x2'));var rp=require(_0x4d71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d71('0x4'));var util=require(_0x4d71('0x5'));var path=require(_0x4d71('0x6'));var sox=require(_0x4d71('0x7'));var csv=require(_0x4d71('0x8'));var ejs=require(_0x4d71('0x9'));var fs=require('fs');var fs_extra=require(_0x4d71('0xa'));var _=require(_0x4d71('0xb'));var squel=require(_0x4d71('0xc'));var crypto=require(_0x4d71('0xd'));var jsforce=require(_0x4d71('0xe'));var deskjs=require(_0x4d71('0xf'));var toCsv=require(_0x4d71('0x8'));var querystring=require(_0x4d71('0x10'));var Papa=require(_0x4d71('0x11'));var Redis=require(_0x4d71('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4d71('0x13'));var as=require(_0x4d71('0x14'));var hardwareService=require(_0x4d71('0x15'));var logger=require(_0x4d71('0x16'))('api');var utils=require(_0x4d71('0x17'));var config=require(_0x4d71('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d71('0x19'))['db'];config[_0x4d71('0x1a')]=_[_0x4d71('0x1b')](config[_0x4d71('0x1a')],{'host':_0x4d71('0x1c'),'port':0x18eb});var socket=require(_0x4d71('0x1d'))(new Redis(config['redis']));require(_0x4d71('0x1e'))[_0x4d71('0x1f')](socket);var jayson=require(_0x4d71('0x20'));var client=jayson['client'][_0x4d71('0x21')]({'port':0x232c});var client9002=jayson[_0x4d71('0x22')][_0x4d71('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1b610a,_0x4f02d1,_0x484a18,_0x511342){return new BPromise(function(_0x230aea,_0x349337){var _0x37d4f2=_0x511342||client;return _0x37d4f2[_0x4d71('0x23')](_0x1b610a,_0x484a18)[_0x4d71('0x24')](function(_0x591968){logger[_0x4d71('0x25')](_0x4d71('0x26'),_0x4f02d1,_0x4d71('0x27'));logger['debug'](_0x4d71('0x28'),_0x4f02d1,'request\x20sent',JSON[_0x4d71('0x29')](_0x591968));if(_0x591968[_0x4d71('0x2a')]){if(_0x591968[_0x4d71('0x2a')][_0x4d71('0x2b')]===0x1f4){logger[_0x4d71('0x2a')](_0x4d71('0x26'),_0x4f02d1,_0x591968[_0x4d71('0x2a')][_0x4d71('0x2c')]);return _0x349337(_0x591968[_0x4d71('0x2a')][_0x4d71('0x2c')]);}logger['error'](_0x4d71('0x26'),_0x4f02d1,_0x591968[_0x4d71('0x2a')][_0x4d71('0x2c')]);return _0x230aea(_0x591968[_0x4d71('0x2a')][_0x4d71('0x2c')]);}else{logger[_0x4d71('0x25')](_0x4d71('0x26'),_0x4f02d1,'request\x20sent');_0x230aea(_0x591968[_0x4d71('0x2d')][_0x4d71('0x2c')]);}})[_0x4d71('0x2e')](function(_0x3d7c1d){logger[_0x4d71('0x2a')](_0x4d71('0x26'),_0x4f02d1,_0x3d7c1d);_0x349337(_0x3d7c1d);});});}function respondWithStatusCode(_0x563cc9,_0x249540){_0x249540=_0x249540||0xcc;return function(_0x121eab){if(_0x121eab){return _0x563cc9[_0x4d71('0x2f')](_0x249540);}return _0x563cc9[_0x4d71('0x30')](_0x249540)[_0x4d71('0x31')]();};}function respondWithResult(_0x370199,_0x2a245e){_0x2a245e=_0x2a245e||0xc8;return function(_0x2ad485){if(_0x2ad485){return _0x370199[_0x4d71('0x30')](_0x2a245e)[_0x4d71('0x32')](_0x2ad485);}};}function respondWithFilteredResult(_0x47755e,_0x4691ed){return function(_0x45c170){if(_0x45c170){var _0x2f673d=typeof _0x4691ed[_0x4d71('0x33')]===_0x4d71('0x34')&&typeof _0x4691ed[_0x4d71('0x35')]==='undefined';var _0x167c16=_0x45c170[_0x4d71('0x36')];var _0x316226=_0x2f673d?0x0:_0x4691ed[_0x4d71('0x33')];var _0x143d04=_0x2f673d?_0x45c170['count']:_0x4691ed['offset']+_0x4691ed['limit'];var _0x13d485;if(_0x143d04>=_0x167c16){_0x143d04=_0x167c16;_0x13d485=0xc8;}else{_0x13d485=0xce;}_0x47755e[_0x4d71('0x30')](_0x13d485);return _0x47755e['set'](_0x4d71('0x37'),_0x316226+'-'+_0x143d04+'/'+_0x167c16)[_0x4d71('0x32')](_0x45c170);}return null;};}function patchUpdates(_0x43e27e){return function(_0x159f6e){try{jsonpatch['apply'](_0x159f6e,_0x43e27e,!![]);}catch(_0x405455){return BPromise['reject'](_0x405455);}return _0x159f6e[_0x4d71('0x38')]();};}function saveUpdates(_0x1a5921,_0x298c94){return function(_0x495d29){if(_0x495d29){return _0x495d29[_0x4d71('0x39')](_0x1a5921)[_0x4d71('0x24')](function(_0xc90011){return _0xc90011;});}return null;};}function removeEntity(_0xa5e123,_0x3b47f6){return function(_0x4d52e3){if(_0x4d52e3){return _0x4d52e3[_0x4d71('0x3a')]()[_0x4d71('0x24')](function(){_0xa5e123[_0x4d71('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b9eb,_0x17b5e5){return function(_0x415d1a){if(!_0x415d1a){_0x45b9eb[_0x4d71('0x2f')](0x194);}return _0x415d1a;};}function handleError(_0x9de372,_0x57874f){_0x57874f=_0x57874f||0x1f4;return function(_0x11b182){logger['error'](_0x11b182['stack']);if(_0x11b182[_0x4d71('0x3b')]){delete _0x11b182[_0x4d71('0x3b')];}_0x9de372[_0x4d71('0x30')](_0x57874f)['send'](_0x11b182);};}exports[_0x4d71('0x3c')]=function(_0x32076d,_0xdcce55){var _0x584ef9={},_0x53cc9f={},_0x10366f={'count':0x0,'rows':[]};var _0x893b82=_[_0x4d71('0x3d')](db['OpenchannelMessage'][_0x4d71('0x3e')],function(_0x4e6ac2){return{'name':_0x4e6ac2['fieldName'],'type':_0x4e6ac2[_0x4d71('0x3f')][_0x4d71('0x40')]};});_0x53cc9f[_0x4d71('0x41')]=_[_0x4d71('0x3d')](_0x893b82,_0x4d71('0x3b'));_0x53cc9f[_0x4d71('0x42')]=_[_0x4d71('0x43')](_0x32076d[_0x4d71('0x42')]);_0x53cc9f[_0x4d71('0x44')]=_['intersection'](_0x53cc9f[_0x4d71('0x41')],_0x53cc9f[_0x4d71('0x42')]);_0x584ef9[_0x4d71('0x45')]=_[_0x4d71('0x46')](_0x53cc9f[_0x4d71('0x41')],qs[_0x4d71('0x47')](_0x32076d[_0x4d71('0x42')][_0x4d71('0x47')]));_0x584ef9[_0x4d71('0x45')]=_0x584ef9[_0x4d71('0x45')][_0x4d71('0x48')]?_0x584ef9[_0x4d71('0x45')]:_0x53cc9f[_0x4d71('0x41')];if(!_0x32076d[_0x4d71('0x42')][_0x4d71('0x49')](_0x4d71('0x4a'))){_0x584ef9[_0x4d71('0x35')]=qs['limit'](_0x32076d[_0x4d71('0x42')][_0x4d71('0x35')]);_0x584ef9[_0x4d71('0x33')]=qs[_0x4d71('0x33')](_0x32076d['query'][_0x4d71('0x33')]);}_0x584ef9[_0x4d71('0x4b')]=qs[_0x4d71('0x4c')](_0x32076d[_0x4d71('0x42')][_0x4d71('0x4c')]);_0x584ef9[_0x4d71('0x4d')]=qs[_0x4d71('0x44')](_['pick'](_0x32076d[_0x4d71('0x42')],_0x53cc9f[_0x4d71('0x44')]),_0x893b82);if(_0x32076d['query'][_0x4d71('0x4e')]){_0x584ef9['where']=_[_0x4d71('0x4f')](_0x584ef9[_0x4d71('0x4d')],{'$or':_[_0x4d71('0x3d')](_0x893b82,function(_0x34e7e3){if(_0x34e7e3['type']!==_0x4d71('0x50')){var _0x1cc962={};_0x1cc962[_0x34e7e3['name']]={'$like':'%'+_0x32076d[_0x4d71('0x42')][_0x4d71('0x4e')]+'%'};return _0x1cc962;}})});}_0x584ef9=_[_0x4d71('0x4f')]({},_0x584ef9,_0x32076d[_0x4d71('0x51')]);var _0x3714a4={'where':_0x584ef9['where']};return db[_0x4d71('0x52')][_0x4d71('0x36')](_0x3714a4)[_0x4d71('0x24')](function(_0x521a07){_0x10366f[_0x4d71('0x36')]=_0x521a07;if(_0x32076d['query']['includeAll']){_0x584ef9[_0x4d71('0x53')]=[{'all':!![]}];}return db[_0x4d71('0x52')][_0x4d71('0x54')](_0x584ef9);})['then'](function(_0x357875){_0x10366f[_0x4d71('0x55')]=_0x357875;return _0x10366f;})[_0x4d71('0x24')](respondWithFilteredResult(_0xdcce55,_0x584ef9))[_0x4d71('0x2e')](handleError(_0xdcce55,null));};exports[_0x4d71('0x56')]=function(_0x3a4a8c,_0x22c4c2){var _0x391dc9={'raw':!![],'where':{'id':_0x3a4a8c[_0x4d71('0x57')]['id']}},_0x3e75e5={};_0x3e75e5[_0x4d71('0x41')]=_[_0x4d71('0x43')](db[_0x4d71('0x52')][_0x4d71('0x3e')]);_0x3e75e5[_0x4d71('0x42')]=_[_0x4d71('0x43')](_0x3a4a8c[_0x4d71('0x42')]);_0x3e75e5[_0x4d71('0x44')]=_[_0x4d71('0x46')](_0x3e75e5[_0x4d71('0x41')],_0x3e75e5[_0x4d71('0x42')]);_0x391dc9['attributes']=_[_0x4d71('0x46')](_0x3e75e5['model'],qs[_0x4d71('0x47')](_0x3a4a8c[_0x4d71('0x42')][_0x4d71('0x47')]));_0x391dc9[_0x4d71('0x45')]=_0x391dc9[_0x4d71('0x45')]['length']?_0x391dc9[_0x4d71('0x45')]:_0x3e75e5[_0x4d71('0x41')];if(_0x3a4a8c['query'][_0x4d71('0x58')]){_0x391dc9['include']=[{'all':!![]}];}_0x391dc9=_['merge']({},_0x391dc9,_0x3a4a8c[_0x4d71('0x51')]);return db['OpenchannelMessage'][_0x4d71('0x59')](_0x391dc9)[_0x4d71('0x24')](handleEntityNotFound(_0x22c4c2,null))['then'](respondWithResult(_0x22c4c2,null))[_0x4d71('0x2e')](handleError(_0x22c4c2,null));};exports[_0x4d71('0x5a')]=function(_0x4d472a,_0x35aef3){return db[_0x4d71('0x52')][_0x4d71('0x5a')](_0x4d472a[_0x4d71('0x5b')],{})[_0x4d71('0x24')](respondWithResult(_0x35aef3,0xc9))[_0x4d71('0x2e')](handleError(_0x35aef3,null));};exports['update']=function(_0xf48d79,_0x528336){if(_0xf48d79[_0x4d71('0x5b')]['id']){delete _0xf48d79[_0x4d71('0x5b')]['id'];}return db['OpenchannelMessage'][_0x4d71('0x59')]({'where':{'id':_0xf48d79['params']['id']}})[_0x4d71('0x24')](handleEntityNotFound(_0x528336,null))['then'](saveUpdates(_0xf48d79['body'],null))['then'](respondWithResult(_0x528336,null))[_0x4d71('0x2e')](handleError(_0x528336,null));};exports[_0x4d71('0x3a')]=function(_0x5b82b9,_0xf3496b){return db['OpenchannelMessage'][_0x4d71('0x59')]({'where':{'id':_0x5b82b9[_0x4d71('0x57')]['id']}})[_0x4d71('0x24')](handleEntityNotFound(_0xf3496b,null))['then'](removeEntity(_0xf3496b,null))[_0x4d71('0x2e')](handleError(_0xf3496b,null));};exports[_0x4d71('0x5c')]=function(_0x715762,_0x2f1ab3){return db[_0x4d71('0x52')]['describe']()['then'](respondWithResult(_0x2f1ab3,null))[_0x4d71('0x2e')](handleError(_0x2f1ab3,null));};var interaction_log=require(_0x4d71('0x16'))(_0x4d71('0x5d'));exports[_0x4d71('0x5e')]=function(_0xa83333,_0x14df17,_0x5e202b){var _0xf3cc49={'agent':{},'channel':_0x4d71('0x5f')};if(_0xa83333[_0x4d71('0x5b')]['id']){delete _0xa83333['body']['id'];}_0xa83333['body'][_0x4d71('0x60')]=!![];_0xa83333[_0x4d71('0x5b')][_0x4d71('0x61')]=moment()[_0x4d71('0x62')](_0x4d71('0x63'));_0xa83333[_0x4d71('0x5b')]['UserId']=_0xa83333[_0x4d71('0x5b')][_0x4d71('0x64')]||_0xa83333[_0x4d71('0x65')]['id'];_0xf3cc49['agent']['id']=_0xa83333[_0x4d71('0x5b')]['UserId'];return db[_0x4d71('0x52')][_0x4d71('0x59')]({'where':{'id':_0xa83333['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14df17,null))[_0x4d71('0x24')](saveUpdates(_0xa83333[_0x4d71('0x5b')],null))[_0x4d71('0x24')](function(_0x166658){if(_0x166658){_0xf3cc49[_0x4d71('0x2c')]=_0x166658[_0x4d71('0x66')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x166658[_0x4d71('0x67')]}});}return null;})[_0x4d71('0x24')](handleEntityNotFound(_0x14df17,null))[_0x4d71('0x24')](function(_0x1310e5){if(_0x1310e5){return _0x1310e5[_0x4d71('0x39')]({'UserId':_0xa83333['body'][_0x4d71('0x64')],'read1stAt':_['isNil'](_0x1310e5[_0x4d71('0x68')])?moment()[_0x4d71('0x62')](_0x4d71('0x63')):undefined});}return null;})[_0x4d71('0x24')](function(_0x24c928){if(_0x24c928){_0xf3cc49[_0x4d71('0x69')]=_0x24c928[_0x4d71('0x66')]({'plain':!![]});interaction_log[_0x4d71('0x25')](_0x4d71('0x6a'),_0xa83333['user']['id'],_0xa83333['user'][_0x4d71('0x3b')],_0xa83333[_0x4d71('0x65')][_0x4d71('0x6b')],_0xf3cc49[_0x4d71('0x69')]['id'],_0xa83333[_0x4d71('0x5b')]?JSON[_0x4d71('0x29')](_0xa83333[_0x4d71('0x5b')]):_0x4d71('0x6c'));return respondWithRpcPromise(_0x4d71('0x6d'),'acceptMessage',_0xf3cc49);}return null;})[_0x4d71('0x24')](function(_0x4eeb7f){var _0x4b8971='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4eeb7f['message']['ContactId'];return db['sequelize'][_0x4d71('0x42')](_0x4b8971,{'type':db[_0x4d71('0x6e')][_0x4d71('0x6f')][_0x4d71('0x70')],'raw':!![]})[_0x4d71('0x24')](function(_0x296e50){return _0x296e50;});})[_0x4d71('0x24')](function(_0xdbd925){if(_0xdbd925){_0xf3cc49[_0x4d71('0x2c')]['contact']=_0xdbd925[0x0];if(!_0xa83333['body'][_0x4d71('0x64')])return;return db[_0x4d71('0x71')][_0x4d71('0x59')]({'where':{'id':_0xa83333[_0x4d71('0x5b')][_0x4d71('0x64')],'role':_0x4d71('0x72')},'attributes':['id',_0x4d71('0x3b'),_0x4d71('0x73'),_0x4d71('0x74'),_0x4d71('0x75')],'raw':!![]});}return null;})['then'](function(_0x15ae5c){if(!_0x15ae5c)return null;_0xf3cc49['message']['agent']=_0x15ae5c;return _0xf3cc49;})[_0x4d71('0x24')](function(_0x3cd82d){if(_0x3cd82d){if(_0xa83333[_0x4d71('0x5b')]['manual']){_0xf3cc49['message'][_0x4d71('0x76')]=util['format']('SIP/%s',_0xa83333[_0x4d71('0x65')][_0x4d71('0x3b')]);_0xf3cc49[_0x4d71('0x2c')][_0x4d71('0x77')]=_0xf3cc49['channel'];_0xf3cc49[_0x4d71('0x2c')][_0x4d71('0x78')]=_0xf3cc49[_0x4d71('0x77')];_0xf3cc49[_0x4d71('0x2c')]['event']=_0x4d71('0x5e');return respondWithRpcPromise(_0x4d71('0x79'),_0x4d71('0x79'),{'event':_0x4d71('0x7a'),'message':_0xf3cc49[_0x4d71('0x2c')]},client9002)[_0x4d71('0x24')](function(){return _0xf3cc49;});}return _0xf3cc49;}return null;})[_0x4d71('0x24')](respondWithResult(_0x14df17,null))[_0x4d71('0x2e')](handleError(_0x14df17,null));};var interaction_log=require('../../config/logger')(_0x4d71('0x5d'));exports[_0x4d71('0x7b')]=function(_0x5332e0,_0x222118,_0x7b1ae0){var _0x4aed65={'agent':{},'channel':_0x4d71('0x5f')};if(_0x5332e0[_0x4d71('0x5b')]['id']){delete _0x5332e0[_0x4d71('0x5b')]['id'];}_0x5332e0[_0x4d71('0x5b')][_0x4d71('0x64')]=_0x5332e0[_0x4d71('0x5b')][_0x4d71('0x64')]||_0x5332e0[_0x4d71('0x65')]['id'];_0x4aed65['agent']['id']=_0x5332e0['body'][_0x4d71('0x64')];return db[_0x4d71('0x52')]['find']({'where':{'id':_0x5332e0[_0x4d71('0x57')]['id'],'UserId':null}})[_0x4d71('0x24')](handleEntityNotFound(_0x222118,null))[_0x4d71('0x24')](function(_0x49b426){if(_0x49b426){_0x4aed65['message']=_0x49b426[_0x4d71('0x66')]({'plain':!![]});return db[_0x4d71('0x7c')][_0x4d71('0x59')]({'where':{'id':_0x49b426[_0x4d71('0x67')]}});}return null;})[_0x4d71('0x24')](handleEntityNotFound(_0x222118,null))[_0x4d71('0x24')](function(_0x15b832){if(_0x15b832){_0x4aed65[_0x4d71('0x69')]=_0x15b832[_0x4d71('0x66')]({'plain':!![]});interaction_log[_0x4d71('0x25')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5332e0[_0x4d71('0x65')]['id'],_0x5332e0[_0x4d71('0x65')][_0x4d71('0x3b')],_0x5332e0['user'][_0x4d71('0x6b')],_0x4aed65[_0x4d71('0x69')]['id'],_0x5332e0[_0x4d71('0x5b')]?JSON['stringify'](_0x5332e0[_0x4d71('0x5b')]):_0x4d71('0x6c'));return respondWithRpcPromise(_0x4d71('0x7d'),'rejectMessage',_0x4aed65);}return null;})['then'](function(_0x2744e6){var _0x39a57f=_0x4d71('0x7e')+_0x2744e6[_0x4d71('0x2c')]['ContactId'];return db['sequelize'][_0x4d71('0x42')](_0x39a57f,{'type':db[_0x4d71('0x6e')][_0x4d71('0x6f')][_0x4d71('0x70')],'raw':!![]})[_0x4d71('0x24')](function(_0x297988){return _0x297988;});})[_0x4d71('0x24')](function(_0x1ef1a3){if(_0x1ef1a3){_0x4aed65['message']['contact']=_0x1ef1a3[0x0];if(!_0x5332e0['body']['UserId'])return;return db[_0x4d71('0x71')][_0x4d71('0x59')]({'where':{'id':_0x5332e0[_0x4d71('0x5b')][_0x4d71('0x64')],'role':_0x4d71('0x72')},'attributes':['id',_0x4d71('0x3b'),'fullname',_0x4d71('0x74'),_0x4d71('0x75')],'raw':!![]});}return null;})[_0x4d71('0x24')](function(_0x4252c9){if(!_0x4252c9)return null;_0x4aed65[_0x4d71('0x2c')][_0x4d71('0x72')]=_0x4252c9;return _0x4aed65;})[_0x4d71('0x24')](function(_0x227036){if(_0x227036){_0x227036['message'][_0x4d71('0x76')]=util[_0x4d71('0x62')](_0x4d71('0x7f'),_0x5332e0[_0x4d71('0x65')][_0x4d71('0x3b')]);_0x227036[_0x4d71('0x2c')][_0x4d71('0x77')]=_0x4aed65[_0x4d71('0x77')];_0x227036[_0x4d71('0x2c')][_0x4d71('0x78')]=_0x4aed65[_0x4d71('0x77')];_0x227036[_0x4d71('0x2c')][_0x4d71('0x80')]=_0x4d71('0x7b');respondWithRpcPromise(_0x4d71('0x79'),_0x4d71('0x79'),{'event':_0x4d71('0x81'),'message':_0x227036['message']},client9002);return _0x4aed65;}return null;})[_0x4d71('0x24')](respondWithResult(_0x222118,null))[_0x4d71('0x2e')](handleError(_0x222118,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1e2857a..91a6eab 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 _0xc6d7=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6d7,0x125));var _0x7c6d=function(_0x5c8ca3,_0x1357e6){_0x5c8ca3=_0x5c8ca3-0x0;var _0x15d7d6=_0xc6d7[_0x5c8ca3];return _0x15d7d6;};'use strict';var EventEmitter=require(_0x7c6d('0x0'));var OpenchannelMessage=require(_0x7c6d('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7c6d('0x2')](0x0);var events={'afterCreate':_0x7c6d('0x3'),'afterUpdate':_0x7c6d('0x4'),'afterDestroy':_0x7c6d('0x5')};function emitEvent(_0x101be3){return function(_0x518396,_0x5001f1,_0x2e3332){OpenchannelMessageEvents['emit'](_0x101be3+':'+_0x518396['id'],_0x518396);OpenchannelMessageEvents[_0x7c6d('0x6')](_0x101be3,_0x518396);_0x2e3332(null);};}for(var e in events){if(events[_0x7c6d('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7c6d('0x8')](e,emitEvent(event));}}module[_0x7c6d('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x7336=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','save'];(function(_0x5409f7,_0x48a2e0){var _0x45fa90=function(_0x4b9321){while(--_0x4b9321){_0x5409f7['push'](_0x5409f7['shift']());}};_0x45fa90(++_0x48a2e0);}(_0x7336,0x135));var _0x6733=function(_0x5acea7,_0x10e23a){_0x5acea7=_0x5acea7-0x0;var _0x1f1cb7=_0x7336[_0x5acea7];return _0x1f1cb7;};'use strict';var EventEmitter=require(_0x6733('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6733('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6733('0x2'),'afterUpdate':'update','afterDestroy':_0x6733('0x3')};function emitEvent(_0x223d95){return function(_0x58bee8,_0x275a36,_0x542627){OpenchannelMessageEvents['emit'](_0x223d95+':'+_0x58bee8['id'],_0x58bee8);OpenchannelMessageEvents[_0x6733('0x4')](_0x223d95,_0x58bee8);_0x542627(null);};}for(var e in events){if(events[_0x6733('0x5')](e)){var event=events[e];OpenchannelMessage[_0x6733('0x6')](e,emitEvent(event));}}module[_0x6733('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 1d3a150..5d03d7f 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 _0xcdc4=['lodash','util','moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelMessage','body','direction','toLowerCase','out','isNil','UserId','findOne','update','createdAt','catch','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','OpenchannelInteractionId','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xcdc4,0xb8));var _0x4cdc=function(_0x463934,_0x1e38ec){_0x463934=_0x463934-0x0;var _0x44c1a2=_0xcdc4[_0x463934];return _0x44c1a2;};'use strict';var _=require(_0x4cdc('0x0'));var util=require(_0x4cdc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4cdc('0x2'));var BPromise=require(_0x4cdc('0x3'));var rp=require(_0x4cdc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4cdc('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x4cdc('0x6')]=function(_0x405f22,_0x23c2d4){return _0x405f22[_0x4cdc('0x7')](_0x4cdc('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x4cdc('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e69fa,_0x39bdbb,_0x350557){var _0x243834=_0x405f22['models'];var _0x39c61d=_0x2e69fa['get']({'plain':!![]});if(_0x39c61d[_0x4cdc('0xa')][_0x4cdc('0xb')]()==='in'||_0x39c61d[_0x4cdc('0xa')]['toLowerCase']()===_0x4cdc('0xc')&&!_0x39c61d['secret']&&!_[_0x4cdc('0xd')](_0x39c61d[_0x4cdc('0xe')])){_0x243834['OpenchannelInteraction'][_0x4cdc('0xf')]({'where':{'id':_0x39c61d['OpenchannelInteractionId']}})['then'](function(_0x1116cf){if(_0x1116cf){_0x1116cf[_0x4cdc('0x10')]({'lastMsgAt':_0x39c61d[_0x4cdc('0x11')],'lastMsgDirection':_0x39c61d[_0x4cdc('0xa')][_0x4cdc('0xb')]()});}})[_0x4cdc('0x12')](function(_0x7e9b49){console['error'](_0x7e9b49);});}if(_0x39c61d['direction']===_0x4cdc('0xc')&&!_0x39c61d[_0x4cdc('0x13')]){var _0x1f80f8;_0x243834[_0x4cdc('0x14')][_0x4cdc('0x15')]()[_0x4cdc('0x16')](function(_0x3bb654){return _0x243834[_0x4cdc('0x17')][_0x4cdc('0x18')]({'where':{'id':_0x39c61d[_0x4cdc('0x19')]},'include':[{'model':_0x243834[_0x4cdc('0x1a')],'as':'Interactions','where':{'id':_0x39c61d[_0x4cdc('0x1b')]},'limit':0x1,'include':[{'model':_0x243834[_0x4cdc('0x14')],'as':_0x4cdc('0x1c'),'attributes':_['keys'](_0x3bb654)}]}]});})[_0x4cdc('0x16')](function(_0x28312e){_0x1f80f8=_0x28312e[_0x4cdc('0x1d')]({'plain':!![]});if(_0x1f80f8&&_0x1f80f8[_0x4cdc('0x1e')]){logger[_0x4cdc('0x1f')](_0x4cdc('0x20'),_0x4cdc('0x21'),util[_0x4cdc('0x22')](_0x4cdc('0x23'),_0x39c61d['id'],_0x1f80f8['replyUri']));if(_0x1f80f8['Interactions']&&_0x1f80f8[_0x4cdc('0x24')][_0x4cdc('0x25')]){_0x39c61d[_0x4cdc('0x26')]=_['omit'](_0x1f80f8[_0x4cdc('0x24')][0x0],_0x4cdc('0x1c'));_0x39c61d[_0x4cdc('0x1c')]=_0x1f80f8['Interactions'][0x0][_0x4cdc('0x1c')];}var _0x39bdbb={'method':_0x4cdc('0x27'),'uri':encodeURI(_0x1f80f8[_0x4cdc('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39bdbb[_0x4cdc('0x28')]){case'GET':_0x39bdbb['qs']=_0x39c61d;break;case _0x4cdc('0x27'):_0x39bdbb[_0x4cdc('0x9')]=_0x39c61d;break;}return rp(_0x39bdbb)['then'](function(_0x253597){logger[_0x4cdc('0x1f')](_0x4cdc('0x20'),_0x4cdc('0x21'),util[_0x4cdc('0x22')](_0x4cdc('0x29'),_0x39c61d['id'],_0x1f80f8[_0x4cdc('0x1e')]));if(_0x253597[_0x4cdc('0x9')][_0x4cdc('0x2a')]&&_0x253597[_0x4cdc('0x9')][_0x4cdc('0x2a')]!=_0x39c61d['Interaction'][_0x4cdc('0x2a')]){return _0x243834['OpenchannelInteraction'][_0x4cdc('0x10')]({'threadId':_0x253597[_0x4cdc('0x9')][_0x4cdc('0x2a')]},{'where':{'id':_0x39c61d[_0x4cdc('0x26')]['id']}});}else{return;}})[_0x4cdc('0x16')](function(){return _0x2e69fa[_0x4cdc('0x10')]({'read':!![]});})[_0x4cdc('0x12')](function(_0x162fee){logger[_0x4cdc('0x2b')](_0x4cdc('0x20'),'afterCreate',util['inspect'](_0x162fee,{'showHidden':![],'depth':null}));_0x350557();});}else{_0x350557();}})[_0x4cdc('0x2c')](function(){_0x350557();});}else{_0x350557();}}},'charset':_0x4cdc('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe82f=['get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','createdAt','describe','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','method','POST','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe82f,0x119));var _0xfe82=function(_0x24a00e,_0x3638c6){_0x24a00e=_0x24a00e-0x0;var _0x1859b4=_0xe82f[_0x24a00e];return _0x1859b4;};'use strict';var _=require(_0xfe82('0x0'));var util=require(_0xfe82('0x1'));var logger=require(_0xfe82('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfe82('0x3'));var rp=require(_0xfe82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe82('0x5'));var config=require(_0xfe82('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x4fb958,_0x2881c8){return _0x4fb958[_0xfe82('0x7')](_0xfe82('0x8'),attributes,{'tableName':_0xfe82('0x9'),'paranoid':![],'indexes':[{'name':_0xfe82('0xa'),'fields':['body'],'type':_0xfe82('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x495226,_0x5d27a9,_0x643c){var _0x53fefa=_0x4fb958[_0xfe82('0xc')];var _0xd6ecf6=_0x495226[_0xfe82('0xd')]({'plain':!![]});if(_0xd6ecf6[_0xfe82('0xe')][_0xfe82('0xf')]()==='in'||_0xd6ecf6[_0xfe82('0xe')][_0xfe82('0xf')]()===_0xfe82('0x10')&&!_0xd6ecf6[_0xfe82('0x11')]&&!_[_0xfe82('0x12')](_0xd6ecf6[_0xfe82('0x13')])){_0x53fefa[_0xfe82('0x14')][_0xfe82('0x15')]({'where':{'id':_0xd6ecf6['OpenchannelInteractionId']}})[_0xfe82('0x16')](function(_0x45f0c4){if(_0x45f0c4){_0x45f0c4['update']({'lastMsgAt':_0xd6ecf6[_0xfe82('0x17')],'lastMsgDirection':_0xd6ecf6[_0xfe82('0xe')][_0xfe82('0xf')]()});}})['catch'](function(_0x1b625e){console['error'](_0x1b625e);});}if(_0xd6ecf6[_0xfe82('0xe')]===_0xfe82('0x10')&&!_0xd6ecf6[_0xfe82('0x11')]){var _0x3473fe;_0x53fefa['CmContact'][_0xfe82('0x18')]()[_0xfe82('0x16')](function(_0x3676e5){return _0x53fefa['OpenchannelAccount'][_0xfe82('0x19')]({'where':{'id':_0xd6ecf6[_0xfe82('0x1a')]},'include':[{'model':_0x53fefa[_0xfe82('0x14')],'as':_0xfe82('0x1b'),'where':{'id':_0xd6ecf6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x53fefa[_0xfe82('0x1c')],'as':'Contact','attributes':_[_0xfe82('0x1d')](_0x3676e5)}]}]});})[_0xfe82('0x16')](function(_0x180afd){_0x3473fe=_0x180afd[_0xfe82('0xd')]({'plain':!![]});if(_0x3473fe&&_0x3473fe[_0xfe82('0x1e')]){logger[_0xfe82('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xfe82('0x20'),util['format'](_0xfe82('0x21'),_0xd6ecf6['id'],_0x3473fe[_0xfe82('0x1e')]));if(_0x3473fe[_0xfe82('0x1b')]&&_0x3473fe['Interactions'][_0xfe82('0x22')]){_0xd6ecf6[_0xfe82('0x23')]=_[_0xfe82('0x24')](_0x3473fe['Interactions'][0x0],_0xfe82('0x25'));_0xd6ecf6[_0xfe82('0x25')]=_0x3473fe[_0xfe82('0x1b')][0x0][_0xfe82('0x25')];}var _0x5d27a9={'method':'POST','uri':encodeURI(_0x3473fe[_0xfe82('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d27a9[_0xfe82('0x26')]){case'GET':_0x5d27a9['qs']=_0xd6ecf6;break;case _0xfe82('0x27'):_0x5d27a9[_0xfe82('0x28')]=_0xd6ecf6;break;}return rp(_0x5d27a9)[_0xfe82('0x16')](function(_0x4be173){logger['info'](_0xfe82('0x29'),_0xfe82('0x20'),util['format'](_0xfe82('0x2a'),_0xd6ecf6['id'],_0x3473fe[_0xfe82('0x1e')]));if(_0x4be173[_0xfe82('0x28')][_0xfe82('0x2b')]&&_0x4be173[_0xfe82('0x28')][_0xfe82('0x2b')]!=_0xd6ecf6['Interaction']['threadId']){return _0x53fefa[_0xfe82('0x14')][_0xfe82('0x2c')]({'threadId':_0x4be173[_0xfe82('0x28')]['threadId']},{'where':{'id':_0xd6ecf6[_0xfe82('0x23')]['id']}});}else{return;}})['then'](function(){return _0x495226['update']({'read':!![]});})[_0xfe82('0x2d')](function(_0x486b63){logger['error'](_0xfe82('0x29'),'afterCreate',util['inspect'](_0x486b63,{'showHidden':![],'depth':null}));_0x643c();});}else{_0x643c();}})[_0xfe82('0x2e')](function(){_0x643c();});}else{_0x643c();}}},'charset':_0xfe82('0x2f'),'collate':_0xfe82('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fab01ce..eb2c071 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 _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(_0x3051ee,_0x2130e6){var _0x4d38f5=function(_0xf8a602){while(--_0xf8a602){_0x3051ee['push'](_0x3051ee['shift']());}};_0x4d38f5(++_0x2130e6);}(_0x2ef3,0xba));var _0x32ef=function(_0x16c30d,_0x19148e){_0x16c30d=_0x16c30d-0x0;var _0x40c951=_0x2ef3[_0x16c30d];return _0x40c951;};'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 +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(_0x3bb350,_0x28fab0){var _0x3c793b=function(_0x2b566c){while(--_0x2b566c){_0x3bb350['push'](_0x3bb350['shift']());}};_0x3c793b(++_0x28fab0);}(_0x2ef3,0xba));var _0x32ef=function(_0x5aeee6,_0x51ec14){_0x5aeee6=_0x5aeee6-0x0;var _0x1b0131=_0x2ef3[_0x5aeee6];return _0x1b0131;};'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 dced299..67de3ce 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 _0xa6ee=['openchannelMessage:','./openchannelMessage.events','save','emit','register','length'];(function(_0x4826ba,_0x564a6b){var _0x44c28d=function(_0x5f32a2){while(--_0x5f32a2){_0x4826ba['push'](_0x4826ba['shift']());}};_0x44c28d(++_0x564a6b);}(_0xa6ee,0x1ed));var _0xea6e=function(_0xb8547a,_0x5a4c88){_0xb8547a=_0xb8547a-0x0;var _0x30f4e5=_0xa6ee[_0xb8547a];return _0x30f4e5;};'use strict';var OpenchannelMessageEvents=require(_0xea6e('0x0'));var events=[_0xea6e('0x1'),'remove','update'];function createListener(_0x4b2a4c,_0x1d40b2){return function(_0x48232d){_0x1d40b2[_0xea6e('0x2')](_0x4b2a4c,_0x48232d);};}function removeListener(_0x106312,_0x5bb9d8){return function(){OpenchannelMessageEvents['removeListener'](_0x106312,_0x5bb9d8);};}exports[_0xea6e('0x3')]=function(_0x4de7fd){for(var _0x107ec3=0x0,_0x5d9ccf=events[_0xea6e('0x4')];_0x107ec3<_0x5d9ccf;_0x107ec3++){var _0x4a3b09=events[_0x107ec3];var _0x1fd222=createListener(_0xea6e('0x5')+_0x4a3b09,_0x4de7fd);OpenchannelMessageEvents['on'](_0x4a3b09,_0x1fd222);}}; \ No newline at end of file +var _0x7ca8=['emit','removeListener','register','length','openchannelMessage:','save','remove','update'];(function(_0x9b7a2e,_0x31f874){var _0x2e308f=function(_0x47a1d9){while(--_0x47a1d9){_0x9b7a2e['push'](_0x9b7a2e['shift']());}};_0x2e308f(++_0x31f874);}(_0x7ca8,0xf5));var _0x87ca=function(_0x57b849,_0x6c9742){_0x57b849=_0x57b849-0x0;var _0x582ed4=_0x7ca8[_0x57b849];return _0x582ed4;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x87ca('0x0'),_0x87ca('0x1'),_0x87ca('0x2')];function createListener(_0x4549d9,_0x2968b3){return function(_0x17faf2){_0x2968b3[_0x87ca('0x3')](_0x4549d9,_0x17faf2);};}function removeListener(_0x1f1e4e,_0x1b4dcb){return function(){OpenchannelMessageEvents[_0x87ca('0x4')](_0x1f1e4e,_0x1b4dcb);};}exports[_0x87ca('0x5')]=function(_0x411355){for(var _0x4de788=0x0,_0x4ce850=events[_0x87ca('0x6')];_0x4de788<_0x4ce850;_0x4de788++){var _0x12b73f=events[_0x4de788];var _0x10323f=createListener(_0x87ca('0x7')+_0x12b73f,_0x411355);OpenchannelMessageEvents['on'](_0x12b73f,_0x10323f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4acd75c..6a0947b 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 _0x5afe=['/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id/teams','removeTeams','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x2c11ec,_0x1a0f15){var _0x33769b=function(_0x177494){while(--_0x177494){_0x2c11ec['push'](_0x2c11ec['shift']());}};_0x33769b(++_0x1a0f15);}(_0x5afe,0xf4));var _0xe5af=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x5afe[_0x5caf7e];return _0x5c3435;};'use strict';var multer=require(_0xe5af('0x0'));var util=require(_0xe5af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5af('0x2'));var router=express[_0xe5af('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe5af('0x4'));var interaction=require(_0xe5af('0x5'));var config=require(_0xe5af('0x6'));var controller=require(_0xe5af('0x7'));router[_0xe5af('0x8')]('/',auth[_0xe5af('0x9')](),controller[_0xe5af('0xa')]);router['get'](_0xe5af('0xb'),auth['isAuthenticated'](),controller[_0xe5af('0xc')]);router['get'](_0xe5af('0xd'),auth[_0xe5af('0x9')](),controller[_0xe5af('0xe')]);router[_0xe5af('0x8')](_0xe5af('0xf'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x10')]);router['get']('/:id/teams',auth[_0xe5af('0x9')](),controller['getTeams']);router['get'](_0xe5af('0x11'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x12')]);router[_0xe5af('0x13')]('/',auth[_0xe5af('0x9')](),controller[_0xe5af('0x14')]);router[_0xe5af('0x13')]('/:id/teams',auth[_0xe5af('0x9')](),controller[_0xe5af('0x15')]);router['post'](_0xe5af('0x11'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x16')]);router[_0xe5af('0x17')](_0xe5af('0xd'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe5af('0x19')](_0xe5af('0x1a'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x1b')]);router['delete'](_0xe5af('0x11'),auth[_0xe5af('0x9')](),controller[_0xe5af('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x16fc=['delete','destroy','removeTeams','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x16fc,0x1e9));var _0xc16f=function(_0xb0a4dc,_0x2c8e54){_0xb0a4dc=_0xb0a4dc-0x0;var _0x145759=_0x16fc[_0xb0a4dc];return _0x145759;};'use strict';var multer=require(_0xc16f('0x0'));var util=require(_0xc16f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc16f('0x2'));var router=express[_0xc16f('0x3')]();var fs_extra=require(_0xc16f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc16f('0x5'));var config=require(_0xc16f('0x6'));var controller=require(_0xc16f('0x7'));router[_0xc16f('0x8')]('/',auth[_0xc16f('0x9')](),controller[_0xc16f('0xa')]);router[_0xc16f('0x8')](_0xc16f('0xb'),auth[_0xc16f('0x9')](),controller[_0xc16f('0xc')]);router[_0xc16f('0x8')](_0xc16f('0xd'),auth['isAuthenticated'](),controller[_0xc16f('0xe')]);router[_0xc16f('0x8')]('/:id/members',auth[_0xc16f('0x9')](),controller[_0xc16f('0xf')]);router['get'](_0xc16f('0x10'),auth[_0xc16f('0x9')](),controller[_0xc16f('0x11')]);router[_0xc16f('0x8')](_0xc16f('0x12'),auth[_0xc16f('0x9')](),controller[_0xc16f('0x13')]);router[_0xc16f('0x14')]('/',auth[_0xc16f('0x9')](),controller['create']);router[_0xc16f('0x14')](_0xc16f('0x10'),auth[_0xc16f('0x9')](),controller[_0xc16f('0x15')]);router[_0xc16f('0x14')](_0xc16f('0x12'),auth[_0xc16f('0x9')](),controller['addAgents']);router[_0xc16f('0x16')](_0xc16f('0xd'),auth[_0xc16f('0x9')](),controller[_0xc16f('0x17')]);router[_0xc16f('0x18')]('/:id',auth[_0xc16f('0x9')](),controller[_0xc16f('0x19')]);router[_0xc16f('0x18')](_0xc16f('0x10'),auth[_0xc16f('0x9')](),controller[_0xc16f('0x1a')]);router[_0xc16f('0x18')](_0xc16f('0x12'),auth[_0xc16f('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9490184..62bcb3f 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 _0x5e27=['STRING','INTEGER','ENUM','rrmemory','beepall','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e27,0x107));var _0x75e2=function(_0x24662a,_0x5212fd){_0x24662a=_0x24662a-0x0;var _0x1caf1a=_0x5e27[_0x24662a];return _0x1caf1a;};'use strict';var Sequelize=require('sequelize');module[_0x75e2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x75e2('0x1')]},'timeout':{'type':Sequelize[_0x75e2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x75e2('0x3')](_0x75e2('0x4'),_0x75e2('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xeaab=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x46f693,_0x5ec6fc){var _0x2d5143=function(_0x2faa5b){while(--_0x2faa5b){_0x46f693['push'](_0x46f693['shift']());}};_0x2d5143(++_0x5ec6fc);}(_0xeaab,0xe6));var _0xbeaa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xeaab[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xbeaa('0x0'));module[_0xbeaa('0x1')]={'name':{'type':Sequelize[_0xbeaa('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbeaa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbeaa('0x4')]('rrmemory','beepall',_0xbeaa('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0f1ba18..b7597d2 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 _0x5e8f=['key','getOptions','where','include','findAll','catch','params','model','keys','query','filters','intersection','attributes','fields','length','merge','options','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','order','Agents','online','interface','transaction','addTeams','each','forEach','userOpenchannelQueue:save','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','then','destroy','get','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type'];(function(_0x15b8da,_0x31e8b7){var _0x3a5787=function(_0x14caa7){while(--_0x14caa7){_0x15b8da['push'](_0x15b8da['shift']());}};_0x3a5787(++_0x31e8b7);}(_0x5e8f,0xd2));var _0xf5e8=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x5e8f[_0x56ba92];return _0x8fe94d;};'use strict';var BPromise=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var _=require(_0xf5e8('0x2'));var squel=require(_0xf5e8('0x3'));var Redis=require(_0xf5e8('0x4'));var qs=require(_0xf5e8('0x5'));var logger=require(_0xf5e8('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5e8('0x7')]=_[_0xf5e8('0x8')](config[_0xf5e8('0x7')],{'host':_0xf5e8('0x9'),'port':0x18eb});var socket=require(_0xf5e8('0xa'))(new Redis(config[_0xf5e8('0x7')]));require(_0xf5e8('0xb'))[_0xf5e8('0xc')](socket);function respondWithStatusCode(_0x1ac1fc,_0x506b4e){_0x506b4e=_0x506b4e||0xcc;return function(_0x1b555d){if(_0x1b555d){return _0x1ac1fc[_0xf5e8('0xd')](_0x506b4e);}return _0x1ac1fc[_0xf5e8('0xe')](_0x506b4e)[_0xf5e8('0xf')]();};}function respondWithResult(_0x1f5b7d,_0x3b57d2){_0x3b57d2=_0x3b57d2||0xc8;return function(_0x563ef8){if(_0x563ef8){return _0x1f5b7d['status'](_0x3b57d2)['json'](_0x563ef8);}};}function respondWithFilteredResult(_0x513058,_0x10517b){return function(_0x3a521b){if(_0x3a521b){var _0x486c1=typeof _0x10517b[_0xf5e8('0x10')]===_0xf5e8('0x11')&&typeof _0x10517b['limit']===_0xf5e8('0x11');var _0x12faec=_0x3a521b[_0xf5e8('0x12')];var _0x21105a=_0x486c1?0x0:_0x10517b[_0xf5e8('0x10')];var _0x5a0904=_0x486c1?_0x3a521b['count']:_0x10517b[_0xf5e8('0x10')]+_0x10517b[_0xf5e8('0x13')];var _0x22cfb8;if(_0x5a0904>=_0x12faec){_0x5a0904=_0x12faec;_0x22cfb8=0xc8;}else{_0x22cfb8=0xce;}_0x513058[_0xf5e8('0xe')](_0x22cfb8);return _0x513058[_0xf5e8('0x14')](_0xf5e8('0x15'),_0x21105a+'-'+_0x5a0904+'/'+_0x12faec)[_0xf5e8('0x16')](_0x3a521b);}return null;};}function saveUpdates(_0x5e4ca3){return function(_0x1f10ae){if(_0x1f10ae){return _0x1f10ae['update'](_0x5e4ca3)[_0xf5e8('0x17')](function(_0x25c436){return _0x25c436;});}return null;};}function removeEntity(_0x565e86){return function(_0x2a2bcb){if(_0x2a2bcb){return _0x2a2bcb[_0xf5e8('0x18')]()[_0xf5e8('0x17')](function(){var _0x139013=_0x2a2bcb[_0xf5e8('0x19')]({'plain':!![]});var _0x726129='OpenchannelQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x726129,'resourceId':_0x139013['id']}})[_0xf5e8('0x17')](function(){return _0x2a2bcb;});})[_0xf5e8('0x17')](function(){_0x565e86[_0xf5e8('0xe')](0xcc)[_0xf5e8('0xf')]();});}};}function handleEntityNotFound(_0x5bd113){return function(_0x412f38){if(!_0x412f38){_0x5bd113[_0xf5e8('0xd')](0x194);}return _0x412f38;};}function handleError(_0x4297b9,_0x37b6a4){_0x37b6a4=_0x37b6a4||0x1f4;return function(_0x457f3d){logger['error'](_0x457f3d[_0xf5e8('0x1a')]);if(_0x457f3d[_0xf5e8('0x1b')]){delete _0x457f3d[_0xf5e8('0x1b')];}_0x4297b9[_0xf5e8('0xe')](_0x37b6a4)['send'](_0x457f3d);};}exports[_0xf5e8('0x1c')]=function(_0x3c6c79,_0x635ea5){var _0x18390d={};var _0x369bd3={'count':0x0,'rows':[]};var _0x1ccb07=_[_0xf5e8('0x1d')](db[_0xf5e8('0x1e')][_0xf5e8('0x1f')],function(_0x220e7b){return{'name':_0x220e7b[_0xf5e8('0x20')],'type':_0x220e7b[_0xf5e8('0x21')][_0xf5e8('0x22')]};});_0x18390d=qs[_0xf5e8('0x23')](_0x1ccb07,_0x3c6c79);var _0x1e1f3e={'where':_0x18390d[_0xf5e8('0x24')]};return db['OpenchannelQueue'][_0xf5e8('0x12')](_0x1e1f3e)[_0xf5e8('0x17')](function(_0x99f1f4){_0x369bd3[_0xf5e8('0x12')]=_0x99f1f4;_0x18390d[_0xf5e8('0x25')]=qs[_0xf5e8('0x25')](_0x3c6c79['query']);return db[_0xf5e8('0x1e')][_0xf5e8('0x26')](_0x18390d);})[_0xf5e8('0x17')](function(_0x43c66d){_0x369bd3['rows']=_0x43c66d;return _0x369bd3;})['then'](respondWithFilteredResult(_0x635ea5,_0x18390d))[_0xf5e8('0x27')](handleError(_0x635ea5,null));};exports['show']=function(_0x30513b,_0x3f88c0){var _0x5ea675={'raw':!![],'where':{'id':_0x30513b[_0xf5e8('0x28')]['id']}},_0x50308c={};_0x50308c[_0xf5e8('0x29')]=_[_0xf5e8('0x2a')](db['OpenchannelQueue'][_0xf5e8('0x1f')]);_0x50308c['query']=_[_0xf5e8('0x2a')](_0x30513b[_0xf5e8('0x2b')]);_0x50308c[_0xf5e8('0x2c')]=_[_0xf5e8('0x2d')](_0x50308c['model'],_0x50308c[_0xf5e8('0x2b')]);_0x5ea675[_0xf5e8('0x2e')]=_['intersection'](_0x50308c[_0xf5e8('0x29')],qs[_0xf5e8('0x2f')](_0x30513b[_0xf5e8('0x2b')][_0xf5e8('0x2f')]));_0x5ea675[_0xf5e8('0x2e')]=_0x5ea675[_0xf5e8('0x2e')][_0xf5e8('0x30')]?_0x5ea675[_0xf5e8('0x2e')]:_0x50308c[_0xf5e8('0x29')];if(_0x30513b['query']['includeAll']){_0x5ea675[_0xf5e8('0x25')]=[{'all':!![]}];}_0x5ea675=_[_0xf5e8('0x31')]({},_0x5ea675,_0x30513b[_0xf5e8('0x32')]);return db[_0xf5e8('0x1e')]['find'](_0x5ea675)[_0xf5e8('0x17')](handleEntityNotFound(_0x3f88c0,null))['then'](respondWithResult(_0x3f88c0,null))['catch'](handleError(_0x3f88c0,null));};exports['create']=function(_0x28f0d8,_0xf0b307){return db[_0xf5e8('0x1e')]['create'](_0x28f0d8[_0xf5e8('0x33')],{})[_0xf5e8('0x17')](function(_0x1ce3ce){var _0x187524=_0x28f0d8['user']['get']({'plain':!![]});if(!_0x187524)throw new Error(_0xf5e8('0x34'));if(_0x187524[_0xf5e8('0x35')]===_0xf5e8('0x36')){var _0x11459f=_0x1ce3ce[_0xf5e8('0x19')]({'plain':!![]});var _0x4fec7c=_0xf5e8('0x37');return db['UserProfileSection'][_0xf5e8('0x38')]({'where':{'name':_0x4fec7c,'userProfileId':_0x187524['userProfileId']},'raw':!![]})['then'](function(_0x1ee167){if(_0x1ee167&&_0x1ee167[_0xf5e8('0x39')]===0x0){return db[_0xf5e8('0x3a')]['create']({'name':_0x11459f['name'],'resourceId':_0x11459f['id'],'type':_0x1ee167['name'],'sectionId':_0x1ee167['id']},{})[_0xf5e8('0x17')](function(){return _0x1ce3ce;});}else{return _0x1ce3ce;}})['catch'](function(_0x144045){logger[_0xf5e8('0x3b')](_0xf5e8('0x3c'),_0x144045);throw _0x144045;});}return _0x1ce3ce;})['then'](respondWithResult(_0xf0b307,0xc9))[_0xf5e8('0x27')](handleError(_0xf0b307,null));};exports[_0xf5e8('0x3d')]=function(_0x199b70,_0x20079f){if(_0x199b70['body']['id']){delete _0x199b70['body']['id'];}return db[_0xf5e8('0x1e')][_0xf5e8('0x38')]({'where':{'id':_0x199b70[_0xf5e8('0x28')]['id']}})[_0xf5e8('0x17')](handleEntityNotFound(_0x20079f,null))['then'](saveUpdates(_0x199b70['body'],null))[_0xf5e8('0x17')](respondWithResult(_0x20079f,null))[_0xf5e8('0x27')](handleError(_0x20079f,null));};exports['destroy']=function(_0x52cb7b,_0x249030){return db[_0xf5e8('0x1e')][_0xf5e8('0x38')]({'where':{'id':_0x52cb7b['params']['id']}})[_0xf5e8('0x17')](handleEntityNotFound(_0x249030,null))['then'](removeEntity(_0x249030,null))[_0xf5e8('0x27')](handleError(_0x249030,null));};exports[_0xf5e8('0x3e')]=function(_0x4f80bd,_0x3b6bb8){return db[_0xf5e8('0x1e')]['describe']()[_0xf5e8('0x17')](respondWithResult(_0x3b6bb8,null))[_0xf5e8('0x27')](handleError(_0x3b6bb8,null));};exports[_0xf5e8('0x3f')]=function(_0xcb0b67,_0x523090){var _0x290c1d={'raw':!![],'where':{}},_0x2ff3eb={},_0x43dc45;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xcb0b67[_0xf5e8('0x28')]['id']}})['then'](handleEntityNotFound(_0x523090,null))[_0xf5e8('0x17')](function(_0xbd2a6e){if(_0xbd2a6e){_0x43dc45=_0xbd2a6e['get']({'plain':!![]});_0x2ff3eb[_0xf5e8('0x29')]=_[_0xf5e8('0x2a')](db[_0xf5e8('0x40')][_0xf5e8('0x1f')]);_0x2ff3eb[_0xf5e8('0x2b')]=_['keys'](_0xcb0b67['query']);_0x2ff3eb[_0xf5e8('0x2c')]=_['intersection'](_0x2ff3eb[_0xf5e8('0x29')],_0x2ff3eb[_0xf5e8('0x2b')]);_0x290c1d['attributes']=_['intersection'](_0x2ff3eb[_0xf5e8('0x29')],qs[_0xf5e8('0x2f')](_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x2f')]));_0x290c1d[_0xf5e8('0x2e')]=_0x290c1d['attributes'][_0xf5e8('0x30')]?_0x290c1d[_0xf5e8('0x2e')]:_0x2ff3eb[_0xf5e8('0x29')];if(!_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x41')](_0xf5e8('0x42'))){_0x290c1d['limit']=qs[_0xf5e8('0x13')](_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x13')]);_0x290c1d[_0xf5e8('0x10')]=qs[_0xf5e8('0x10')](_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x10')]);}_0x290c1d['order']=qs[_0xf5e8('0x43')](_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x43')]);_0x290c1d[_0xf5e8('0x24')]=qs[_0xf5e8('0x2c')](_[_0xf5e8('0x44')](_0xcb0b67[_0xf5e8('0x2b')],_0x2ff3eb[_0xf5e8('0x2c')]));_0x290c1d[_0xf5e8('0x24')][_0xf5e8('0x45')]=_0xbd2a6e['id'];if(_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x46')]){_0x290c1d[_0xf5e8('0x24')]=_[_0xf5e8('0x31')](_0x290c1d[_0xf5e8('0x24')],{'$or':_[_0xf5e8('0x1d')](_0x290c1d[_0xf5e8('0x2e')],function(_0x329f01){var _0xf4c6e2={};_0xf4c6e2[_0x329f01]={'$like':'%'+_0xcb0b67[_0xf5e8('0x2b')][_0xf5e8('0x46')]+'%'};return _0xf4c6e2;})});}_0x290c1d=_[_0xf5e8('0x31')]({},_0x290c1d,_0xcb0b67['options']);return db[_0xf5e8('0x40')][_0xf5e8('0x26')](_0x290c1d);}})[_0xf5e8('0x17')](function(_0x586f0e){if(_0x586f0e){return db[_0xf5e8('0x47')][_0xf5e8('0x48')]({'where':{'id':_[_0xf5e8('0x1d')](_0x586f0e,_0xf5e8('0x49')),'role':_0xf5e8('0x4a')},'attributes':['id',_0xf5e8('0x1b'),'openchannelPause',_0xf5e8('0x4b'),_0xf5e8('0x4c')]});}})[_0xf5e8('0x17')](function(_0x4f36de){if(_0x4f36de){return{'count':_0x4f36de[_0xf5e8('0x12')],'rows':_['map'](_0x4f36de[_0xf5e8('0x4d')],function(_0x3aef5a){return{'membername':_0x3aef5a[_0xf5e8('0x1b')],'UserId':_0x3aef5a['id'],'queue_name':_0x43dc45[_0xf5e8('0x1b')],'OpenchannelQueueId':_0x43dc45['id'],'interface':util[_0xf5e8('0x4e')](_0xf5e8('0x4f'),_0xf5e8('0x50'),_0x3aef5a[_0xf5e8('0x1b')]),'penalty':0x0,'paused':_0x3aef5a[_0xf5e8('0x51')],'createdAt':_0x3aef5a['createdAt'],'updatedAt':_0x3aef5a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5e8('0x17')](respondWithFilteredResult(_0x523090,_0x290c1d))[_0xf5e8('0x27')](handleError(_0x523090,null));};exports[_0xf5e8('0x52')]=function(_0x2a0f6c,_0x4078c3){var _0x32b269={};var _0x3f27b2={};var _0x24424e;var _0x36d874;return db[_0xf5e8('0x1e')][_0xf5e8('0x53')]({'where':{'id':_0x2a0f6c['params']['id']}})['then'](handleEntityNotFound(_0x4078c3,null))[_0xf5e8('0x17')](function(_0x51fcdd){if(_0x51fcdd){_0x24424e=_0x51fcdd;_0x3f27b2[_0xf5e8('0x29')]=_[_0xf5e8('0x2a')](db[_0xf5e8('0x54')]['rawAttributes']);_0x3f27b2[_0xf5e8('0x2b')]=_[_0xf5e8('0x2a')](_0x2a0f6c[_0xf5e8('0x2b')]);_0x3f27b2['filters']=_[_0xf5e8('0x2d')](_0x3f27b2['model'],_0x3f27b2[_0xf5e8('0x2b')]);_0x32b269[_0xf5e8('0x2e')]=_[_0xf5e8('0x2d')](_0x3f27b2[_0xf5e8('0x29')],qs[_0xf5e8('0x2f')](_0x2a0f6c[_0xf5e8('0x2b')][_0xf5e8('0x2f')]));_0x32b269[_0xf5e8('0x2e')]=_0x32b269['attributes']['length']?_0x32b269[_0xf5e8('0x2e')]:_0x3f27b2[_0xf5e8('0x29')];_0x32b269[_0xf5e8('0x55')]=qs[_0xf5e8('0x43')](_0x2a0f6c[_0xf5e8('0x2b')][_0xf5e8('0x43')]);_0x32b269[_0xf5e8('0x24')]=qs[_0xf5e8('0x2c')](_[_0xf5e8('0x44')](_0x2a0f6c[_0xf5e8('0x2b')],_0x3f27b2[_0xf5e8('0x2c')]));if(_0x2a0f6c[_0xf5e8('0x2b')][_0xf5e8('0x46')]){_0x32b269['where']=_['merge'](_0x32b269[_0xf5e8('0x24')],{'$or':_[_0xf5e8('0x1d')](_0x32b269[_0xf5e8('0x2e')],function(_0x3e1d8c){var _0x87b18c={};_0x87b18c[_0x3e1d8c]={'$like':'%'+_0x2a0f6c[_0xf5e8('0x2b')][_0xf5e8('0x46')]+'%'};return _0x87b18c;})});}_0x32b269=_[_0xf5e8('0x31')]({},_0x32b269,_0x2a0f6c[_0xf5e8('0x32')]);return _0x24424e['getTeams'](_0x32b269);}})[_0xf5e8('0x17')](function(_0x1c9440){if(_0x1c9440){_0x36d874=_0x1c9440[_0xf5e8('0x30')];if(!_0x2a0f6c[_0xf5e8('0x2b')]['hasOwnProperty']('nolimit')){_0x32b269[_0xf5e8('0x13')]=qs[_0xf5e8('0x13')](_0x2a0f6c[_0xf5e8('0x2b')]['limit']);_0x32b269[_0xf5e8('0x10')]=qs[_0xf5e8('0x10')](_0x2a0f6c['query'][_0xf5e8('0x10')]);}return _0x24424e['getTeams'](_0x32b269);}})[_0xf5e8('0x17')](function(_0x443d81){if(_0x443d81){return _0x443d81?{'count':_0x36d874,'rows':_0x443d81}:null;}})['then'](respondWithResult(_0x4078c3,null))[_0xf5e8('0x27')](handleError(_0x4078c3,null));};exports['addTeams']=function(_0x1fd5f3,_0x5e604d){var _0x1cff58=_0x1fd5f3['body']['ids'];return db[_0xf5e8('0x54')][_0xf5e8('0x26')]({'where':{'id':_0x1cff58},'attributes':['id'],'include':[{'model':db[_0xf5e8('0x47')],'as':_0xf5e8('0x56'),'attributes':['id',_0xf5e8('0x1b'),_0xf5e8('0x57'),'voicePause',_0xf5e8('0x58')],'raw':!![]}]})[_0xf5e8('0x17')](function(_0x2e81e0){if(_0x2e81e0){var _0x3f25ea=_['flatMap'](_0x2e81e0,function(_0x2668c4){var _0x16f398=_0x2668c4['get']({'plain':!![]});return _0x16f398['Agents'];});return db[_0xf5e8('0x1e')]['find']({'where':{'id':_0x1fd5f3[_0xf5e8('0x28')]['id']}})[_0xf5e8('0x17')](function(_0x438879){return db['sequelize'][_0xf5e8('0x59')](function(_0x58dd86){return _0x438879[_0xf5e8('0x5a')](_0x1cff58,{'transaction':_0x58dd86})[_0xf5e8('0x17')](function(){return BPromise[_0xf5e8('0x5b')](_0x3f25ea,function(_0x5ea6aa){return db[_0xf5e8('0x40')]['findOrCreate']({'where':{'UserId':_0x5ea6aa['id'],'OpenchannelQueueId':_0x1fd5f3[_0xf5e8('0x28')]['id']},'transaction':_0x58dd86});});})[_0xf5e8('0x17')](function(){_0x3f25ea[_0xf5e8('0x5c')](function(_0x292750){socket['emit'](_0xf5e8('0x5d'),{'UserId':_0x292750['id'],'OpenchannelQueueId':_0x438879['id']});});});});});}})[_0xf5e8('0x17')](respondWithStatusCode(_0x5e604d,null))['catch'](handleError(_0x5e604d,null));};exports[_0xf5e8('0x5e')]=function(_0xb31358,_0x2c9175){return db[_0xf5e8('0x54')][_0xf5e8('0x26')]({'where':{'id':_0xb31358['query'][_0xf5e8('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xf5e8('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5e8('0x17')](handleEntityNotFound(_0x2c9175,null))[_0xf5e8('0x17')](function(_0x29e5c6){var _0x4c32a3=_[_0xf5e8('0x1d')](_0x29e5c6,'id');var _0x5b9240=[];var _0x3c4884=[];var _0x250272=squel[_0xf5e8('0x60')]();_0x250272[_0xf5e8('0x61')]('tq.TeamId')[_0xf5e8('0x62')](_0xf5e8('0x63'),'tq')[_0xf5e8('0x64')](_0xf5e8('0x65'),'ut',_0xf5e8('0x66'))[_0xf5e8('0x24')](_0xf5e8('0x67'),_0xb31358[_0xf5e8('0x28')]['id']);for(var _0x3e82df=0x0;_0x3e82df<_0x29e5c6[_0xf5e8('0x30')];_0x3e82df+=0x1){let _0x358696=_0x29e5c6[_0x3e82df];for(var _0x4fdafe=0x0;_0x4fdafe<_0x358696[_0xf5e8('0x56')][_0xf5e8('0x30')];_0x4fdafe+=0x1){let _0x376bba=_0x358696[_0xf5e8('0x56')][_0x4fdafe];var _0x336d51=_0x250272[_0xf5e8('0x68')]();_0x336d51[_0xf5e8('0x24')](_0xf5e8('0x69'),_0x376bba['id']);_0x3c4884['push'](db[_0xf5e8('0x6a')][_0xf5e8('0x2b')](_0x336d51[_0xf5e8('0x6b')](),{'type':db['sequelize']['QueryTypes'][_0xf5e8('0x6c')]})[_0xf5e8('0x17')](function(_0xa2ae62){if(_0xa2ae62['length']===0x1){return _0x376bba['id'];}else{var _0x4eae62=_[_0xf5e8('0x6d')](_[_0xf5e8('0x1d')](_0xa2ae62,_0xf5e8('0x6e')),function(_0x432ea3){return _[_0xf5e8('0x6f')](_0x4c32a3,_0x432ea3);});if(_0x4eae62){return _0x376bba['id'];}}}));}}return BPromise['all'](_0x3c4884)[_0xf5e8('0x17')](function(_0x29c01c){_0x5b9240=_(_0x5b9240)['union'](_0x29c01c)[_0xf5e8('0x70')]()[_0xf5e8('0x71')]();return db[_0xf5e8('0x1e')][_0xf5e8('0x38')]({'where':{'id':_0xb31358[_0xf5e8('0x28')]['id']}})[_0xf5e8('0x17')](function(_0x511cac){return db[_0xf5e8('0x6a')][_0xf5e8('0x59')](function(_0x1fc1e9){return _0x511cac[_0xf5e8('0x5e')](_0xb31358[_0xf5e8('0x2b')][_0xf5e8('0x5f')],{'transaction':_0x1fc1e9})[_0xf5e8('0x17')](function(){if(!_[_0xf5e8('0x72')](_0x5b9240)){return _0x511cac[_0xf5e8('0x73')](_0x5b9240,{'transaction':_0x1fc1e9});}})[_0xf5e8('0x17')](function(){_0x5b9240[_0xf5e8('0x5c')](function(_0x202f85){socket[_0xf5e8('0x74')](_0xf5e8('0x75'),{'UserId':_0x202f85,'OpenchannelQueueId':_0x511cac['id']});});});});});});})['then'](respondWithStatusCode(_0x2c9175,null))[_0xf5e8('0x27')](handleError(_0x2c9175,null));};exports[_0xf5e8('0x76')]=function(_0x3949c8,_0x38d753){return db[_0xf5e8('0x1e')]['find']({'where':{'id':_0x3949c8['params']['id']}})[_0xf5e8('0x17')](handleEntityNotFound(_0x38d753,null))[_0xf5e8('0x17')](function(_0x28b252){if(_0x28b252){return _0x28b252[_0xf5e8('0x76')](_0x3949c8[_0xf5e8('0x33')]['ids'],_[_0xf5e8('0x77')](_0x3949c8[_0xf5e8('0x33')],[_0xf5e8('0x5f'),'id'])||{})['spread'](function(_0x1ebb4f){for(var _0x24b1ea=0x0;_0x24b1ea<_0x3949c8['body'][_0xf5e8('0x5f')][_0xf5e8('0x30')];_0x24b1ea+=0x1){socket['emit'](_0xf5e8('0x5d'),{'UserId':Number(_0x3949c8[_0xf5e8('0x33')][_0xf5e8('0x5f')][_0x24b1ea]),'OpenchannelQueueId':Number(_0x3949c8['params']['id'])});}return _0x1ebb4f;});}})[_0xf5e8('0x17')](respondWithResult(_0x38d753,null))['catch'](handleError(_0x38d753,null));};exports[_0xf5e8('0x73')]=function(_0x38ad3e,_0x351042){return db['OpenchannelQueue'][_0xf5e8('0x38')]({'where':{'id':_0x38ad3e[_0xf5e8('0x28')]['id']}})['then'](handleEntityNotFound(_0x351042,null))[_0xf5e8('0x17')](function(_0x1c37d1){if(_0x1c37d1){return _0x1c37d1[_0xf5e8('0x73')](_0x38ad3e[_0xf5e8('0x2b')][_0xf5e8('0x5f')])['then'](function(){if(_[_0xf5e8('0x78')](_0x38ad3e[_0xf5e8('0x2b')]['ids'])){for(var _0x142e7c=0x0;_0x142e7c<_0x38ad3e['query'][_0xf5e8('0x5f')][_0xf5e8('0x30')];_0x142e7c+=0x1){socket[_0xf5e8('0x74')](_0xf5e8('0x75'),{'UserId':Number(_0x38ad3e['query'][_0xf5e8('0x5f')][_0x142e7c]),'OpenchannelQueueId':Number(_0x38ad3e[_0xf5e8('0x28')]['id'])});}}else{socket[_0xf5e8('0x74')](_0xf5e8('0x75'),{'UserId':Number(_0x38ad3e['query']['ids']),'OpenchannelQueueId':Number(_0x38ad3e[_0xf5e8('0x28')]['id'])});}});}})[_0xf5e8('0x17')](respondWithStatusCode(_0x351042,null))[_0xf5e8('0x27')](handleError(_0x351042,null));};exports[_0xf5e8('0x79')]=function(_0x325c96,_0x2544a8){var _0x4de0a6={};var _0x12460f={};var _0xdc6d3;var _0x3f55a9;return db['OpenchannelQueue'][_0xf5e8('0x53')]({'where':{'id':_0x325c96[_0xf5e8('0x28')]['id']}})[_0xf5e8('0x17')](handleEntityNotFound(_0x2544a8,null))[_0xf5e8('0x17')](function(_0x14281a){if(_0x14281a){_0xdc6d3=_0x14281a;_0x12460f[_0xf5e8('0x29')]=_['keys'](db['User'][_0xf5e8('0x1f')]);_0x12460f[_0xf5e8('0x2b')]=_[_0xf5e8('0x2a')](_0x325c96[_0xf5e8('0x2b')]);_0x12460f['filters']=_[_0xf5e8('0x2d')](_0x12460f[_0xf5e8('0x29')],_0x12460f[_0xf5e8('0x2b')]);_0x4de0a6[_0xf5e8('0x2e')]=_[_0xf5e8('0x2d')](_0x12460f[_0xf5e8('0x29')],qs[_0xf5e8('0x2f')](_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x2f')]));_0x4de0a6[_0xf5e8('0x2e')]=_0x4de0a6[_0xf5e8('0x2e')]['length']?_0x4de0a6['attributes']:_0x12460f['model'];_0x4de0a6['order']=qs['sort'](_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x43')]);_0x4de0a6[_0xf5e8('0x24')]=qs[_0xf5e8('0x2c')](_[_0xf5e8('0x44')](_0x325c96[_0xf5e8('0x2b')],_0x12460f[_0xf5e8('0x2c')]));if(_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x46')]){_0x4de0a6['where']=_[_0xf5e8('0x31')](_0x4de0a6[_0xf5e8('0x24')],{'$or':_[_0xf5e8('0x1d')](_0x4de0a6[_0xf5e8('0x2e')],function(_0x216096){var _0x4e577d={};_0x4e577d[_0x216096]={'$like':'%'+_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x46')]+'%'};return _0x4e577d;})});}_0x4de0a6=_[_0xf5e8('0x31')]({},_0x4de0a6,_0x325c96[_0xf5e8('0x32')]);return _0xdc6d3[_0xf5e8('0x79')](_0x4de0a6);}})['then'](function(_0x3faa36){if(_0x3faa36){_0x3f55a9=_0x3faa36['length'];if(!_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x41')](_0xf5e8('0x42'))){_0x4de0a6[_0xf5e8('0x13')]=qs[_0xf5e8('0x13')](_0x325c96[_0xf5e8('0x2b')][_0xf5e8('0x13')]);_0x4de0a6[_0xf5e8('0x10')]=qs[_0xf5e8('0x10')](_0x325c96['query'][_0xf5e8('0x10')]);}return _0xdc6d3[_0xf5e8('0x79')](_0x4de0a6);}})[_0xf5e8('0x17')](function(_0x1b65cf){if(_0x1b65cf){return _0x1b65cf?{'count':_0x3f55a9,'rows':_0x1b65cf}:null;}})[_0xf5e8('0x17')](respondWithResult(_0x2544a8,null))['catch'](handleError(_0x2544a8,null));}; \ No newline at end of file +var _0x7890=['index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','intersection','model','attributes','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','filters','OpenchannelQueueId','merge','UserOpenchannelQueue','User','findAndCountAll','map','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','pick','options','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','filter','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','name','send'];(function(_0x54c90e,_0x1a1b51){var _0x502f1e=function(_0x47eaad){while(--_0x47eaad){_0x54c90e['push'](_0x54c90e['shift']());}};_0x502f1e(++_0x1a1b51);}(_0x7890,0x160));var _0x0789=function(_0x48022d,_0x2bb25e){_0x48022d=_0x48022d-0x0;var _0x4443a0=_0x7890[_0x48022d];return _0x4443a0;};'use strict';var BPromise=require(_0x0789('0x0'));var util=require(_0x0789('0x1'));var _=require(_0x0789('0x2'));var squel=require(_0x0789('0x3'));var Redis=require(_0x0789('0x4'));var qs=require(_0x0789('0x5'));var logger=require(_0x0789('0x6'))(_0x0789('0x7'));var config=require(_0x0789('0x8'));var db=require(_0x0789('0x9'))['db'];config[_0x0789('0xa')]=_[_0x0789('0xb')](config[_0x0789('0xa')],{'host':_0x0789('0xc'),'port':0x18eb});var socket=require(_0x0789('0xd'))(new Redis(config[_0x0789('0xa')]));require('./openchannelQueue.socket')[_0x0789('0xe')](socket);function respondWithStatusCode(_0x8dd608,_0x9d973e){_0x9d973e=_0x9d973e||0xcc;return function(_0x547fa6){if(_0x547fa6){return _0x8dd608[_0x0789('0xf')](_0x9d973e);}return _0x8dd608[_0x0789('0x10')](_0x9d973e)[_0x0789('0x11')]();};}function respondWithResult(_0x182c2b,_0x4b57f5){_0x4b57f5=_0x4b57f5||0xc8;return function(_0x4495fb){if(_0x4495fb){return _0x182c2b[_0x0789('0x10')](_0x4b57f5)[_0x0789('0x12')](_0x4495fb);}};}function respondWithFilteredResult(_0x477b36,_0x5d15d0){return function(_0x354d60){if(_0x354d60){var _0x13a431=typeof _0x5d15d0['offset']===_0x0789('0x13')&&typeof _0x5d15d0[_0x0789('0x14')]===_0x0789('0x13');var _0x4cc63b=_0x354d60[_0x0789('0x15')];var _0x62f4a6=_0x13a431?0x0:_0x5d15d0['offset'];var _0x22d9d1=_0x13a431?_0x354d60[_0x0789('0x15')]:_0x5d15d0[_0x0789('0x16')]+_0x5d15d0['limit'];var _0x34bc36;if(_0x22d9d1>=_0x4cc63b){_0x22d9d1=_0x4cc63b;_0x34bc36=0xc8;}else{_0x34bc36=0xce;}_0x477b36[_0x0789('0x10')](_0x34bc36);return _0x477b36['set'](_0x0789('0x17'),_0x62f4a6+'-'+_0x22d9d1+'/'+_0x4cc63b)[_0x0789('0x12')](_0x354d60);}return null;};}function saveUpdates(_0xfe6a38){return function(_0x456362){if(_0x456362){return _0x456362[_0x0789('0x18')](_0xfe6a38)[_0x0789('0x19')](function(_0x569f32){return _0x569f32;});}return null;};}function removeEntity(_0x385d94){return function(_0x2b5832){if(_0x2b5832){return _0x2b5832[_0x0789('0x1a')]()[_0x0789('0x19')](function(){var _0x13d3cc=_0x2b5832[_0x0789('0x1b')]({'plain':!![]});var _0x2dde40=_0x0789('0x1c');return db[_0x0789('0x1d')][_0x0789('0x1a')]({'where':{'type':_0x2dde40,'resourceId':_0x13d3cc['id']}})[_0x0789('0x19')](function(){return _0x2b5832;});})['then'](function(){_0x385d94['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x450775){return function(_0x3832fe){if(!_0x3832fe){_0x450775[_0x0789('0xf')](0x194);}return _0x3832fe;};}function handleError(_0x848bf9,_0x47d9a9){_0x47d9a9=_0x47d9a9||0x1f4;return function(_0x4ca78e){logger['error'](_0x4ca78e['stack']);if(_0x4ca78e[_0x0789('0x1e')]){delete _0x4ca78e[_0x0789('0x1e')];}_0x848bf9[_0x0789('0x10')](_0x47d9a9)[_0x0789('0x1f')](_0x4ca78e);};}exports[_0x0789('0x20')]=function(_0x2d1736,_0x10e0e8){var _0xe4ec70={};var _0x3047bf={'count':0x0,'rows':[]};var _0x15591a=_['map'](db[_0x0789('0x21')][_0x0789('0x22')],function(_0x229cdc){return{'name':_0x229cdc[_0x0789('0x23')],'type':_0x229cdc['type'][_0x0789('0x24')]};});_0xe4ec70=qs[_0x0789('0x25')](_0x15591a,_0x2d1736);var _0x3bd52c={'where':_0xe4ec70[_0x0789('0x26')]};return db[_0x0789('0x21')][_0x0789('0x15')](_0x3bd52c)[_0x0789('0x19')](function(_0xc3834b){_0x3047bf['count']=_0xc3834b;_0xe4ec70[_0x0789('0x27')]=qs['include'](_0x2d1736[_0x0789('0x28')]);return db[_0x0789('0x21')][_0x0789('0x29')](_0xe4ec70);})[_0x0789('0x19')](function(_0x16550e){_0x3047bf[_0x0789('0x2a')]=_0x16550e;return _0x3047bf;})['then'](respondWithFilteredResult(_0x10e0e8,_0xe4ec70))[_0x0789('0x2b')](handleError(_0x10e0e8,null));};exports[_0x0789('0x2c')]=function(_0x16879f,_0x4e5661){var _0x23aca4={'raw':!![],'where':{'id':_0x16879f[_0x0789('0x2d')]['id']}},_0x175418={};_0x175418['model']=_['keys'](db[_0x0789('0x21')][_0x0789('0x22')]);_0x175418[_0x0789('0x28')]=_[_0x0789('0x2e')](_0x16879f['query']);_0x175418['filters']=_[_0x0789('0x2f')](_0x175418[_0x0789('0x30')],_0x175418[_0x0789('0x28')]);_0x23aca4[_0x0789('0x31')]=_[_0x0789('0x2f')](_0x175418[_0x0789('0x30')],qs[_0x0789('0x32')](_0x16879f['query'][_0x0789('0x32')]));_0x23aca4[_0x0789('0x31')]=_0x23aca4[_0x0789('0x31')][_0x0789('0x33')]?_0x23aca4[_0x0789('0x31')]:_0x175418[_0x0789('0x30')];if(_0x16879f[_0x0789('0x28')]['includeAll']){_0x23aca4[_0x0789('0x27')]=[{'all':!![]}];}_0x23aca4=_['merge']({},_0x23aca4,_0x16879f['options']);return db[_0x0789('0x21')][_0x0789('0x34')](_0x23aca4)[_0x0789('0x19')](handleEntityNotFound(_0x4e5661,null))['then'](respondWithResult(_0x4e5661,null))[_0x0789('0x2b')](handleError(_0x4e5661,null));};exports[_0x0789('0x35')]=function(_0x3705f4,_0x3c41a9){return db[_0x0789('0x21')][_0x0789('0x35')](_0x3705f4['body'],{})[_0x0789('0x19')](function(_0x3aaab6){var _0xb18af2=_0x3705f4[_0x0789('0x36')][_0x0789('0x1b')]({'plain':!![]});if(!_0xb18af2)throw new Error(_0x0789('0x37'));if(_0xb18af2[_0x0789('0x38')]===_0x0789('0x36')){var _0xc51235=_0x3aaab6['get']({'plain':!![]});var _0x2fb4d6=_0x0789('0x1c');return db[_0x0789('0x39')][_0x0789('0x34')]({'where':{'name':_0x2fb4d6,'userProfileId':_0xb18af2['userProfileId']},'raw':!![]})[_0x0789('0x19')](function(_0x232e3e){if(_0x232e3e&&_0x232e3e[_0x0789('0x3a')]===0x0){return db[_0x0789('0x1d')][_0x0789('0x35')]({'name':_0xc51235[_0x0789('0x1e')],'resourceId':_0xc51235['id'],'type':_0x232e3e['name'],'sectionId':_0x232e3e['id']},{})[_0x0789('0x19')](function(){return _0x3aaab6;});}else{return _0x3aaab6;}})[_0x0789('0x2b')](function(_0x17c300){logger['error'](_0x0789('0x3b'),_0x17c300);throw _0x17c300;});}return _0x3aaab6;})[_0x0789('0x19')](respondWithResult(_0x3c41a9,0xc9))[_0x0789('0x2b')](handleError(_0x3c41a9,null));};exports[_0x0789('0x18')]=function(_0x5ccaa6,_0x1bce3d){if(_0x5ccaa6[_0x0789('0x3c')]['id']){delete _0x5ccaa6[_0x0789('0x3c')]['id'];}return db[_0x0789('0x21')][_0x0789('0x34')]({'where':{'id':_0x5ccaa6[_0x0789('0x2d')]['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x1bce3d,null))[_0x0789('0x19')](saveUpdates(_0x5ccaa6[_0x0789('0x3c')],null))[_0x0789('0x19')](respondWithResult(_0x1bce3d,null))[_0x0789('0x2b')](handleError(_0x1bce3d,null));};exports[_0x0789('0x1a')]=function(_0x2c40ec,_0x365fd9){return db[_0x0789('0x21')][_0x0789('0x34')]({'where':{'id':_0x2c40ec[_0x0789('0x2d')]['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x365fd9,null))[_0x0789('0x19')](removeEntity(_0x365fd9,null))['catch'](handleError(_0x365fd9,null));};exports[_0x0789('0x3d')]=function(_0x308dd0,_0x4fc0b1){return db[_0x0789('0x21')][_0x0789('0x3d')]()['then'](respondWithResult(_0x4fc0b1,null))[_0x0789('0x2b')](handleError(_0x4fc0b1,null));};exports[_0x0789('0x3e')]=function(_0x150fd1,_0x14a6ef){var _0x240e9f={'raw':!![],'where':{}},_0x37c176={},_0x19daf9;return db[_0x0789('0x21')][_0x0789('0x3f')]({'where':{'id':_0x150fd1[_0x0789('0x2d')]['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x14a6ef,null))['then'](function(_0x404108){if(_0x404108){_0x19daf9=_0x404108[_0x0789('0x1b')]({'plain':!![]});_0x37c176[_0x0789('0x30')]=_[_0x0789('0x2e')](db['UserOpenchannelQueue'][_0x0789('0x22')]);_0x37c176[_0x0789('0x28')]=_[_0x0789('0x2e')](_0x150fd1[_0x0789('0x28')]);_0x37c176['filters']=_['intersection'](_0x37c176[_0x0789('0x30')],_0x37c176['query']);_0x240e9f[_0x0789('0x31')]=_[_0x0789('0x2f')](_0x37c176['model'],qs['fields'](_0x150fd1[_0x0789('0x28')]['fields']));_0x240e9f['attributes']=_0x240e9f[_0x0789('0x31')]['length']?_0x240e9f['attributes']:_0x37c176[_0x0789('0x30')];if(!_0x150fd1[_0x0789('0x28')][_0x0789('0x40')](_0x0789('0x41'))){_0x240e9f[_0x0789('0x14')]=qs[_0x0789('0x14')](_0x150fd1[_0x0789('0x28')]['limit']);_0x240e9f[_0x0789('0x16')]=qs[_0x0789('0x16')](_0x150fd1['query'][_0x0789('0x16')]);}_0x240e9f[_0x0789('0x42')]=qs[_0x0789('0x43')](_0x150fd1['query']['sort']);_0x240e9f[_0x0789('0x26')]=qs[_0x0789('0x44')](_['pick'](_0x150fd1[_0x0789('0x28')],_0x37c176[_0x0789('0x44')]));_0x240e9f[_0x0789('0x26')][_0x0789('0x45')]=_0x404108['id'];if(_0x150fd1[_0x0789('0x28')]['filter']){_0x240e9f['where']=_[_0x0789('0x46')](_0x240e9f['where'],{'$or':_['map'](_0x240e9f[_0x0789('0x31')],function(_0x223eed){var _0x2db305={};_0x2db305[_0x223eed]={'$like':'%'+_0x150fd1[_0x0789('0x28')]['filter']+'%'};return _0x2db305;})});}_0x240e9f=_['merge']({},_0x240e9f,_0x150fd1['options']);return db[_0x0789('0x47')][_0x0789('0x29')](_0x240e9f);}})[_0x0789('0x19')](function(_0x150e31){if(_0x150e31){return db[_0x0789('0x48')][_0x0789('0x49')]({'where':{'id':_[_0x0789('0x4a')](_0x150e31,_0x0789('0x4b')),'role':_0x0789('0x4c')},'attributes':['id',_0x0789('0x1e'),_0x0789('0x4d'),_0x0789('0x4e'),'createdAt']});}})['then'](function(_0x4bb11e){if(_0x4bb11e){return{'count':_0x4bb11e[_0x0789('0x15')],'rows':_[_0x0789('0x4a')](_0x4bb11e['rows'],function(_0xe98185){return{'membername':_0xe98185[_0x0789('0x1e')],'UserId':_0xe98185['id'],'queue_name':_0x19daf9[_0x0789('0x1e')],'OpenchannelQueueId':_0x19daf9['id'],'interface':util[_0x0789('0x4f')](_0x0789('0x50'),_0x0789('0x51'),_0xe98185['name']),'penalty':0x0,'paused':_0xe98185[_0x0789('0x4d')],'createdAt':_0xe98185[_0x0789('0x52')],'updatedAt':_0xe98185[_0x0789('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0789('0x19')](respondWithFilteredResult(_0x14a6ef,_0x240e9f))[_0x0789('0x2b')](handleError(_0x14a6ef,null));};exports[_0x0789('0x53')]=function(_0x54715c,_0x4f7538){var _0x58e6f6={};var _0x4a0e42={};var _0x5d9da5;var _0x59153;return db[_0x0789('0x21')]['findOne']({'where':{'id':_0x54715c['params']['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x4f7538,null))['then'](function(_0x46c8f8){if(_0x46c8f8){_0x5d9da5=_0x46c8f8;_0x4a0e42[_0x0789('0x30')]=_[_0x0789('0x2e')](db[_0x0789('0x54')][_0x0789('0x22')]);_0x4a0e42['query']=_[_0x0789('0x2e')](_0x54715c[_0x0789('0x28')]);_0x4a0e42[_0x0789('0x44')]=_[_0x0789('0x2f')](_0x4a0e42[_0x0789('0x30')],_0x4a0e42[_0x0789('0x28')]);_0x58e6f6[_0x0789('0x31')]=_['intersection'](_0x4a0e42[_0x0789('0x30')],qs['fields'](_0x54715c['query'][_0x0789('0x32')]));_0x58e6f6['attributes']=_0x58e6f6[_0x0789('0x31')][_0x0789('0x33')]?_0x58e6f6[_0x0789('0x31')]:_0x4a0e42[_0x0789('0x30')];_0x58e6f6['order']=qs[_0x0789('0x43')](_0x54715c[_0x0789('0x28')][_0x0789('0x43')]);_0x58e6f6[_0x0789('0x26')]=qs[_0x0789('0x44')](_[_0x0789('0x55')](_0x54715c[_0x0789('0x28')],_0x4a0e42[_0x0789('0x44')]));if(_0x54715c[_0x0789('0x28')]['filter']){_0x58e6f6[_0x0789('0x26')]=_['merge'](_0x58e6f6[_0x0789('0x26')],{'$or':_[_0x0789('0x4a')](_0x58e6f6[_0x0789('0x31')],function(_0x1ef8f1){var _0x2c9fa9={};_0x2c9fa9[_0x1ef8f1]={'$like':'%'+_0x54715c[_0x0789('0x28')]['filter']+'%'};return _0x2c9fa9;})});}_0x58e6f6=_[_0x0789('0x46')]({},_0x58e6f6,_0x54715c[_0x0789('0x56')]);return _0x5d9da5[_0x0789('0x53')](_0x58e6f6);}})[_0x0789('0x19')](function(_0x578768){if(_0x578768){_0x59153=_0x578768[_0x0789('0x33')];if(!_0x54715c[_0x0789('0x28')][_0x0789('0x40')]('nolimit')){_0x58e6f6[_0x0789('0x14')]=qs[_0x0789('0x14')](_0x54715c[_0x0789('0x28')]['limit']);_0x58e6f6['offset']=qs[_0x0789('0x16')](_0x54715c[_0x0789('0x28')]['offset']);}return _0x5d9da5['getTeams'](_0x58e6f6);}})[_0x0789('0x19')](function(_0x486f9b){if(_0x486f9b){return _0x486f9b?{'count':_0x59153,'rows':_0x486f9b}:null;}})[_0x0789('0x19')](respondWithResult(_0x4f7538,null))[_0x0789('0x2b')](handleError(_0x4f7538,null));};exports[_0x0789('0x57')]=function(_0x130a41,_0x36bee3){var _0x4f5fb4=_0x130a41[_0x0789('0x3c')][_0x0789('0x58')];return db['Team'][_0x0789('0x29')]({'where':{'id':_0x4f5fb4},'attributes':['id'],'include':[{'model':db[_0x0789('0x48')],'as':'Agents','attributes':['id',_0x0789('0x1e'),_0x0789('0x59'),_0x0789('0x5a'),_0x0789('0x5b')],'raw':!![]}]})[_0x0789('0x19')](function(_0x2b8ad5){if(_0x2b8ad5){var _0x1d2028=_[_0x0789('0x5c')](_0x2b8ad5,function(_0x2a767a){var _0x3ed9c8=_0x2a767a[_0x0789('0x1b')]({'plain':!![]});return _0x3ed9c8[_0x0789('0x5d')];});return db['OpenchannelQueue'][_0x0789('0x34')]({'where':{'id':_0x130a41['params']['id']}})[_0x0789('0x19')](function(_0x3b1ea3){return db[_0x0789('0x5e')][_0x0789('0x5f')](function(_0x2be017){return _0x3b1ea3[_0x0789('0x57')](_0x4f5fb4,{'transaction':_0x2be017})['then'](function(){return BPromise[_0x0789('0x60')](_0x1d2028,function(_0x4c8b02){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x4c8b02['id'],'OpenchannelQueueId':_0x130a41[_0x0789('0x2d')]['id']},'transaction':_0x2be017});});})[_0x0789('0x19')](function(){_0x1d2028['forEach'](function(_0x5d2e2f){socket[_0x0789('0x61')](_0x0789('0x62'),{'UserId':_0x5d2e2f['id'],'OpenchannelQueueId':_0x3b1ea3['id']});});});});});}})['then'](respondWithStatusCode(_0x36bee3,null))[_0x0789('0x2b')](handleError(_0x36bee3,null));};exports[_0x0789('0x63')]=function(_0x27921b,_0x4622b2){return db['Team'][_0x0789('0x29')]({'where':{'id':_0x27921b[_0x0789('0x28')][_0x0789('0x58')]},'attributes':['id'],'include':[{'model':db[_0x0789('0x48')],'as':_0x0789('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x0789('0x19')](handleEntityNotFound(_0x4622b2,null))[_0x0789('0x19')](function(_0x3b0f19){var _0x1f2d01=_[_0x0789('0x4a')](_0x3b0f19,'id');var _0x1429ef=[];var _0x8f8fac=[];var _0x416e98=squel[_0x0789('0x64')]();_0x416e98[_0x0789('0x65')]('tq.TeamId')[_0x0789('0x66')](_0x0789('0x67'),'tq')[_0x0789('0x68')](_0x0789('0x69'),'ut',_0x0789('0x6a'))['where']('OpenchannelQueueId\x20=\x20?',_0x27921b[_0x0789('0x2d')]['id']);for(var _0x3b562c=0x0;_0x3b562c<_0x3b0f19['length'];_0x3b562c+=0x1){let _0x4a4ecc=_0x3b0f19[_0x3b562c];for(var _0x118a3b=0x0;_0x118a3b<_0x4a4ecc[_0x0789('0x5d')]['length'];_0x118a3b+=0x1){let _0x3ebdf5=_0x4a4ecc[_0x0789('0x5d')][_0x118a3b];var _0x42a7f2=_0x416e98[_0x0789('0x6b')]();_0x42a7f2['where'](_0x0789('0x6c'),_0x3ebdf5['id']);_0x8f8fac['push'](db[_0x0789('0x5e')]['query'](_0x42a7f2[_0x0789('0x6d')](),{'type':db[_0x0789('0x5e')][_0x0789('0x6e')][_0x0789('0x6f')]})[_0x0789('0x19')](function(_0x4ad523){if(_0x4ad523[_0x0789('0x33')]===0x1){return _0x3ebdf5['id'];}else{var _0x3443fa=_[_0x0789('0x70')](_[_0x0789('0x4a')](_0x4ad523,_0x0789('0x71')),function(_0x44cfcb){return _[_0x0789('0x72')](_0x1f2d01,_0x44cfcb);});if(_0x3443fa){return _0x3ebdf5['id'];}}}));}}return BPromise[_0x0789('0x73')](_0x8f8fac)[_0x0789('0x19')](function(_0x3bf8d3){_0x1429ef=_(_0x1429ef)[_0x0789('0x74')](_0x3bf8d3)['compact']()[_0x0789('0x75')]();return db[_0x0789('0x21')][_0x0789('0x34')]({'where':{'id':_0x27921b[_0x0789('0x2d')]['id']}})[_0x0789('0x19')](function(_0x1f486e){return db[_0x0789('0x5e')][_0x0789('0x5f')](function(_0x51d543){return _0x1f486e[_0x0789('0x63')](_0x27921b[_0x0789('0x28')]['ids'],{'transaction':_0x51d543})[_0x0789('0x19')](function(){if(!_[_0x0789('0x76')](_0x1429ef)){return _0x1f486e[_0x0789('0x77')](_0x1429ef,{'transaction':_0x51d543});}})[_0x0789('0x19')](function(){_0x1429ef[_0x0789('0x78')](function(_0x17e2ee){socket[_0x0789('0x61')](_0x0789('0x79'),{'UserId':_0x17e2ee,'OpenchannelQueueId':_0x1f486e['id']});});});});});});})[_0x0789('0x19')](respondWithStatusCode(_0x4622b2,null))['catch'](handleError(_0x4622b2,null));};exports[_0x0789('0x7a')]=function(_0x16d447,_0x123fc0){return db[_0x0789('0x21')][_0x0789('0x34')]({'where':{'id':_0x16d447['params']['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x123fc0,null))[_0x0789('0x19')](function(_0x5f46f5){if(_0x5f46f5){return _0x5f46f5['addAgents'](_0x16d447[_0x0789('0x3c')][_0x0789('0x58')],_[_0x0789('0x7b')](_0x16d447['body'],['ids','id'])||{})[_0x0789('0x7c')](function(_0x5b9d92){for(var _0x493f91=0x0;_0x493f91<_0x16d447['body']['ids'][_0x0789('0x33')];_0x493f91+=0x1){socket[_0x0789('0x61')](_0x0789('0x62'),{'UserId':Number(_0x16d447[_0x0789('0x3c')]['ids'][_0x493f91]),'OpenchannelQueueId':Number(_0x16d447[_0x0789('0x2d')]['id'])});}return _0x5b9d92;});}})['then'](respondWithResult(_0x123fc0,null))[_0x0789('0x2b')](handleError(_0x123fc0,null));};exports[_0x0789('0x77')]=function(_0x3e2593,_0x7c9999){return db['OpenchannelQueue'][_0x0789('0x34')]({'where':{'id':_0x3e2593['params']['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x7c9999,null))[_0x0789('0x19')](function(_0x1e72c6){if(_0x1e72c6){return _0x1e72c6[_0x0789('0x77')](_0x3e2593[_0x0789('0x28')][_0x0789('0x58')])[_0x0789('0x19')](function(){if(_[_0x0789('0x7d')](_0x3e2593[_0x0789('0x28')][_0x0789('0x58')])){for(var _0x3fa9ed=0x0;_0x3fa9ed<_0x3e2593[_0x0789('0x28')]['ids'][_0x0789('0x33')];_0x3fa9ed+=0x1){socket[_0x0789('0x61')](_0x0789('0x79'),{'UserId':Number(_0x3e2593[_0x0789('0x28')][_0x0789('0x58')][_0x3fa9ed]),'OpenchannelQueueId':Number(_0x3e2593[_0x0789('0x2d')]['id'])});}}else{socket[_0x0789('0x61')](_0x0789('0x79'),{'UserId':Number(_0x3e2593[_0x0789('0x28')][_0x0789('0x58')]),'OpenchannelQueueId':Number(_0x3e2593[_0x0789('0x2d')]['id'])});}});}})[_0x0789('0x19')](respondWithStatusCode(_0x7c9999,null))[_0x0789('0x2b')](handleError(_0x7c9999,null));};exports[_0x0789('0x7e')]=function(_0x4ee889,_0x38853c){var _0x3acb89={};var _0x232b69={};var _0x20bfee;var _0x4e315a;return db[_0x0789('0x21')][_0x0789('0x3f')]({'where':{'id':_0x4ee889[_0x0789('0x2d')]['id']}})[_0x0789('0x19')](handleEntityNotFound(_0x38853c,null))[_0x0789('0x19')](function(_0x2a1207){if(_0x2a1207){_0x20bfee=_0x2a1207;_0x232b69[_0x0789('0x30')]=_[_0x0789('0x2e')](db[_0x0789('0x48')][_0x0789('0x22')]);_0x232b69[_0x0789('0x28')]=_[_0x0789('0x2e')](_0x4ee889[_0x0789('0x28')]);_0x232b69['filters']=_[_0x0789('0x2f')](_0x232b69[_0x0789('0x30')],_0x232b69[_0x0789('0x28')]);_0x3acb89['attributes']=_[_0x0789('0x2f')](_0x232b69[_0x0789('0x30')],qs[_0x0789('0x32')](_0x4ee889[_0x0789('0x28')]['fields']));_0x3acb89[_0x0789('0x31')]=_0x3acb89[_0x0789('0x31')]['length']?_0x3acb89['attributes']:_0x232b69[_0x0789('0x30')];_0x3acb89[_0x0789('0x42')]=qs[_0x0789('0x43')](_0x4ee889[_0x0789('0x28')][_0x0789('0x43')]);_0x3acb89['where']=qs[_0x0789('0x44')](_[_0x0789('0x55')](_0x4ee889[_0x0789('0x28')],_0x232b69[_0x0789('0x44')]));if(_0x4ee889[_0x0789('0x28')][_0x0789('0x7f')]){_0x3acb89['where']=_['merge'](_0x3acb89[_0x0789('0x26')],{'$or':_[_0x0789('0x4a')](_0x3acb89[_0x0789('0x31')],function(_0x5826cc){var _0xd7025d={};_0xd7025d[_0x5826cc]={'$like':'%'+_0x4ee889['query'][_0x0789('0x7f')]+'%'};return _0xd7025d;})});}_0x3acb89=_[_0x0789('0x46')]({},_0x3acb89,_0x4ee889[_0x0789('0x56')]);return _0x20bfee['getAgents'](_0x3acb89);}})[_0x0789('0x19')](function(_0x475f29){if(_0x475f29){_0x4e315a=_0x475f29['length'];if(!_0x4ee889[_0x0789('0x28')]['hasOwnProperty'](_0x0789('0x41'))){_0x3acb89[_0x0789('0x14')]=qs['limit'](_0x4ee889[_0x0789('0x28')]['limit']);_0x3acb89[_0x0789('0x16')]=qs[_0x0789('0x16')](_0x4ee889[_0x0789('0x28')][_0x0789('0x16')]);}return _0x20bfee['getAgents'](_0x3acb89);}})[_0x0789('0x19')](function(_0x33f550){if(_0x33f550){return _0x33f550?{'count':_0x4e315a,'rows':_0x33f550}:null;}})['then'](respondWithResult(_0x38853c,null))[_0x0789('0x2b')](handleError(_0x38853c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d04fc43..f4d106e 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 _0xdb53=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdb53,0x17a));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x3db5('0x0'))['db'][_0x3db5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3db5('0x2')](0x0);var events={'afterCreate':_0x3db5('0x3'),'afterUpdate':_0x3db5('0x4'),'afterDestroy':_0x3db5('0x5')};function emitEvent(_0x2109eb){return function(_0x37aa9e,_0x4ef199,_0x127c65){OpenchannelQueueEvents[_0x3db5('0x6')](_0x2109eb+':'+_0x37aa9e['id'],_0x37aa9e);OpenchannelQueueEvents[_0x3db5('0x6')](_0x2109eb,_0x37aa9e);_0x127c65(null);};}for(var e in events){if(events[_0x3db5('0x7')](e)){var event=events[e];OpenchannelQueue[_0x3db5('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x7edb=['update','remove','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x9fe8f9,_0x399176){var _0x9040c9=function(_0x3b13f2){while(--_0x3b13f2){_0x9fe8f9['push'](_0x9fe8f9['shift']());}};_0x9040c9(++_0x399176);}(_0x7edb,0xbc));var _0xb7ed=function(_0x117007,_0x4d3414){_0x117007=_0x117007-0x0;var _0x2e5522=_0x7edb[_0x117007];return _0x2e5522;};'use strict';var EventEmitter=require(_0xb7ed('0x0'));var OpenchannelQueue=require(_0xb7ed('0x1'))['db'][_0xb7ed('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb7ed('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb7ed('0x4'),'afterDestroy':_0xb7ed('0x5')};function emitEvent(_0x3d06ef){return function(_0x3ab912,_0x1e5666,_0x4a157b){OpenchannelQueueEvents['emit'](_0x3d06ef+':'+_0x3ab912['id'],_0x3ab912);OpenchannelQueueEvents['emit'](_0x3d06ef,_0x3ab912);_0x4a157b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xb7ed('0x6')](e,emitEvent(event));}}module[_0xb7ed('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c5989d0..21cec78 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 _0x2e1f=['exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45c16a,_0x665979){var _0x57c530=function(_0x5330e3){while(--_0x5330e3){_0x45c16a['push'](_0x45c16a['shift']());}};_0x57c530(++_0x665979);}(_0x2e1f,0x100));var _0xf2e1=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x2e1f[_0x4b4d43];return _0x5706ba;};'use strict';var _=require('lodash');var util=require(_0xf2e1('0x0'));var logger=require(_0xf2e1('0x1'))(_0xf2e1('0x2'));var moment=require(_0xf2e1('0x3'));var BPromise=require(_0xf2e1('0x4'));var rp=require(_0xf2e1('0x5'));var fs=require('fs');var path=require(_0xf2e1('0x6'));var rimraf=require(_0xf2e1('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xf2e1('0x8')]=function(_0x1c297d,_0x461e65){return _0x1c297d[_0xf2e1('0x9')](_0xf2e1('0xa'),attributes,{'tableName':_0xf2e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a7d=['./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0x1a7d,0x163));var _0xd1a7=function(_0x25815a,_0x3f8957){_0x25815a=_0x25815a-0x0;var _0x31c870=_0x1a7d[_0x25815a];return _0x31c870;};'use strict';var _=require('lodash');var util=require(_0xd1a7('0x0'));var logger=require(_0xd1a7('0x1'))(_0xd1a7('0x2'));var moment=require(_0xd1a7('0x3'));var BPromise=require(_0xd1a7('0x4'));var rp=require(_0xd1a7('0x5'));var fs=require('fs');var path=require(_0xd1a7('0x6'));var rimraf=require('rimraf');var config=require(_0xd1a7('0x7'));var attributes=require(_0xd1a7('0x8'));module['exports']=function(_0x28bd36,_0xe2556f){return _0x28bd36['define'](_0xd1a7('0x9'),attributes,{'tableName':_0xd1a7('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 436ba8e..dd88e99 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 _0x4c83=['limit','include','model','map','then','catch','ShowOpenchannelQueue','find','stringify','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes'];(function(_0x4f6c62,_0x4e0267){var _0x4f6d3e=function(_0x16c4dc){while(--_0x16c4dc){_0x4f6c62['push'](_0x4f6c62['shift']());}};_0x4f6d3e(++_0x4e0267);}(_0x4c83,0xa9));var _0x34c8=function(_0x15757d,_0x415f8e){_0x15757d=_0x15757d-0x0;var _0x3247df=_0x4c83[_0x15757d];return _0x3247df;};'use strict';var _=require('lodash');var util=require(_0x34c8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34c8('0x1'));var db=require(_0x34c8('0x2'))['db'];var utils=require(_0x34c8('0x3'));var logger=require(_0x34c8('0x4'))(_0x34c8('0x5'));var config=require(_0x34c8('0x6'));var jayson=require(_0x34c8('0x7'));var client=jayson[_0x34c8('0x8')]['http']({'port':0x232a});config[_0x34c8('0x9')]=_['defaults'](config[_0x34c8('0x9')],{'host':_0x34c8('0xa'),'port':0x18eb});var socket=require(_0x34c8('0xb'))(new Redis(config[_0x34c8('0x9')]));require(_0x34c8('0xc'))[_0x34c8('0xd')](socket);function respondWithRpcPromise(_0x5d1926,_0x1752e8,_0x1be78f){return new BPromise(function(_0x564b4c,_0x54f668){return client[_0x34c8('0xe')](_0x5d1926,_0x1be78f)['then'](function(_0x2f9db5){logger['info'](_0x34c8('0xf'),_0x1752e8,_0x34c8('0x10'));logger[_0x34c8('0x11')](_0x34c8('0x12'),_0x1752e8,_0x34c8('0x10'),JSON['stringify'](_0x2f9db5));if(_0x2f9db5[_0x34c8('0x13')]){if(_0x2f9db5[_0x34c8('0x13')][_0x34c8('0x14')]===0x1f4){logger[_0x34c8('0x13')](_0x34c8('0xf'),_0x1752e8,_0x2f9db5[_0x34c8('0x13')]['message']);return _0x54f668(_0x2f9db5[_0x34c8('0x13')][_0x34c8('0x15')]);}logger[_0x34c8('0x13')](_0x34c8('0xf'),_0x1752e8,_0x2f9db5['error'][_0x34c8('0x15')]);return _0x564b4c(_0x2f9db5['error'][_0x34c8('0x15')]);}else{logger[_0x34c8('0x16')](_0x34c8('0xf'),_0x1752e8,'request\x20sent');_0x564b4c(_0x2f9db5[_0x34c8('0x17')][_0x34c8('0x15')]);}})['catch'](function(_0x4abe58){logger[_0x34c8('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1752e8,_0x4abe58);_0x54f668(_0x4abe58);});});}exports[_0x34c8('0x18')]=function(_0x4411d3){var _0x8f90a=this;return new Promise(function(_0x470143,_0x498ddc){return db[_0x34c8('0x19')][_0x34c8('0x1a')]({'raw':_0x4411d3['options']?_0x4411d3[_0x34c8('0x1b')][_0x34c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x4411d3[_0x34c8('0x1b')]?_0x4411d3['options'][_0x34c8('0x1d')]||null:null,'attributes':_0x4411d3[_0x34c8('0x1b')]?_0x4411d3[_0x34c8('0x1b')][_0x34c8('0x1e')]||null:null,'limit':_0x4411d3[_0x34c8('0x1b')]?_0x4411d3[_0x34c8('0x1b')][_0x34c8('0x1f')]||null:null,'include':_0x4411d3[_0x34c8('0x1b')]?_0x4411d3[_0x34c8('0x1b')][_0x34c8('0x20')]?_['map'](_0x4411d3[_0x34c8('0x1b')]['include'],function(_0x40b4b4){return{'model':db[_0x40b4b4[_0x34c8('0x21')]],'as':_0x40b4b4['as'],'attributes':_0x40b4b4['attributes'],'include':_0x40b4b4[_0x34c8('0x20')]?_[_0x34c8('0x22')](_0x40b4b4['include'],function(_0x3f884e){return{'model':db[_0x3f884e[_0x34c8('0x21')]],'as':_0x3f884e['as'],'attributes':_0x3f884e[_0x34c8('0x1e')],'include':_0x3f884e[_0x34c8('0x20')]?_[_0x34c8('0x22')](_0x3f884e[_0x34c8('0x20')],function(_0x23cf28){return{'model':db[_0x23cf28[_0x34c8('0x21')]],'as':_0x23cf28['as'],'attributes':_0x23cf28[_0x34c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x34c8('0x23')](function(_0x132d0a){logger[_0x34c8('0x16')](_0x34c8('0x18'),_0x4411d3);logger['debug'](_0x34c8('0x18'),_0x4411d3,JSON['stringify'](_0x132d0a));_0x470143(_0x132d0a);})[_0x34c8('0x24')](function(_0x4634b3){logger[_0x34c8('0x13')]('GetOpenchannelQueue',_0x4634b3[_0x34c8('0x15')],_0x4411d3);_0x498ddc(_0x8f90a[_0x34c8('0x13')](0x1f4,_0x4634b3['message']));});});};exports[_0x34c8('0x25')]=function(_0x329f24){var _0x12a2b4=this;return new Promise(function(_0x8ba045,_0x2c3aeb){return db['OpenchannelQueue'][_0x34c8('0x26')]({'raw':_0x329f24[_0x34c8('0x1b')]?_0x329f24['options'][_0x34c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x329f24['options']?_0x329f24[_0x34c8('0x1b')][_0x34c8('0x1d')]||null:null,'attributes':_0x329f24[_0x34c8('0x1b')]?_0x329f24[_0x34c8('0x1b')][_0x34c8('0x1e')]||null:null,'include':_0x329f24[_0x34c8('0x1b')]?_0x329f24[_0x34c8('0x1b')][_0x34c8('0x20')]?_['map'](_0x329f24[_0x34c8('0x1b')][_0x34c8('0x20')],function(_0x5b9c71){return{'model':db[_0x5b9c71[_0x34c8('0x21')]],'as':_0x5b9c71['as'],'attributes':_0x5b9c71['attributes'],'include':_0x5b9c71[_0x34c8('0x20')]?_[_0x34c8('0x22')](_0x5b9c71[_0x34c8('0x20')],function(_0x56ece1){return{'model':db[_0x56ece1[_0x34c8('0x21')]],'as':_0x56ece1['as'],'attributes':_0x56ece1[_0x34c8('0x1e')],'include':_0x56ece1[_0x34c8('0x20')]?_[_0x34c8('0x22')](_0x56ece1['include'],function(_0x388d49){return{'model':db[_0x388d49[_0x34c8('0x21')]],'as':_0x388d49['as'],'attributes':_0x388d49[_0x34c8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f6588){logger['info']('ShowOpenchannelQueue',_0x329f24);logger['debug'](_0x34c8('0x25'),_0x329f24,JSON[_0x34c8('0x27')](_0x4f6588));_0x8ba045(_0x4f6588);})['catch'](function(_0x2659e5){logger[_0x34c8('0x13')](_0x34c8('0x25'),_0x2659e5[_0x34c8('0x15')],_0x329f24);_0x2c3aeb(_0x12a2b4[_0x34c8('0x13')](0x1f4,_0x2659e5[_0x34c8('0x15')]));});});}; \ No newline at end of file +var _0xb303=['raw','where','attributes','include','map','catch','find','model','ShowOpenchannelQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb303,0xe7));var _0x3b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb303[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b30('0x0'));var util=require('util');var moment=require(_0x3b30('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b30('0x2'));var fs=require('fs');var Redis=require(_0x3b30('0x3'));var db=require(_0x3b30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b30('0x5'))(_0x3b30('0x6'));var config=require('../../config/environment');var jayson=require(_0x3b30('0x7'));var client=jayson[_0x3b30('0x8')]['http']({'port':0x232a});config[_0x3b30('0x9')]=_['defaults'](config[_0x3b30('0x9')],{'host':_0x3b30('0xa'),'port':0x18eb});var socket=require(_0x3b30('0xb'))(new Redis(config[_0x3b30('0x9')]));require(_0x3b30('0xc'))['register'](socket);function respondWithRpcPromise(_0x1659b9,_0x3cd5b9,_0x8fd482){return new BPromise(function(_0x439872,_0x1341fe){return client[_0x3b30('0xd')](_0x1659b9,_0x8fd482)[_0x3b30('0xe')](function(_0x445f9f){logger['info'](_0x3b30('0xf'),_0x3cd5b9,_0x3b30('0x10'));logger[_0x3b30('0x11')](_0x3b30('0x12'),_0x3cd5b9,_0x3b30('0x10'),JSON[_0x3b30('0x13')](_0x445f9f));if(_0x445f9f[_0x3b30('0x14')]){if(_0x445f9f[_0x3b30('0x14')]['code']===0x1f4){logger[_0x3b30('0x14')](_0x3b30('0xf'),_0x3cd5b9,_0x445f9f[_0x3b30('0x14')]['message']);return _0x1341fe(_0x445f9f[_0x3b30('0x14')][_0x3b30('0x15')]);}logger[_0x3b30('0x14')](_0x3b30('0xf'),_0x3cd5b9,_0x445f9f[_0x3b30('0x14')][_0x3b30('0x15')]);return _0x439872(_0x445f9f[_0x3b30('0x14')]['message']);}else{logger[_0x3b30('0x16')](_0x3b30('0xf'),_0x3cd5b9,_0x3b30('0x10'));_0x439872(_0x445f9f[_0x3b30('0x17')][_0x3b30('0x15')]);}})['catch'](function(_0x1ea8c3){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3cd5b9,_0x1ea8c3);_0x1341fe(_0x1ea8c3);});});}exports[_0x3b30('0x18')]=function(_0x5dc0ab){var _0x14f19f=this;return new Promise(function(_0x58e998,_0x2d7cd8){return db[_0x3b30('0x19')][_0x3b30('0x1a')]({'raw':_0x5dc0ab[_0x3b30('0x1b')]?_0x5dc0ab[_0x3b30('0x1b')][_0x3b30('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dc0ab[_0x3b30('0x1b')]?_0x5dc0ab[_0x3b30('0x1b')][_0x3b30('0x1d')]||null:null,'attributes':_0x5dc0ab[_0x3b30('0x1b')]?_0x5dc0ab[_0x3b30('0x1b')][_0x3b30('0x1e')]||null:null,'limit':_0x5dc0ab[_0x3b30('0x1b')]?_0x5dc0ab[_0x3b30('0x1b')]['limit']||null:null,'include':_0x5dc0ab['options']?_0x5dc0ab['options'][_0x3b30('0x1f')]?_[_0x3b30('0x20')](_0x5dc0ab[_0x3b30('0x1b')][_0x3b30('0x1f')],function(_0x2491fb){return{'model':db[_0x2491fb['model']],'as':_0x2491fb['as'],'attributes':_0x2491fb[_0x3b30('0x1e')],'include':_0x2491fb['include']?_[_0x3b30('0x20')](_0x2491fb['include'],function(_0x2045b6){return{'model':db[_0x2045b6['model']],'as':_0x2045b6['as'],'attributes':_0x2045b6[_0x3b30('0x1e')],'include':_0x2045b6[_0x3b30('0x1f')]?_[_0x3b30('0x20')](_0x2045b6[_0x3b30('0x1f')],function(_0x1dc31d){return{'model':db[_0x1dc31d['model']],'as':_0x1dc31d['as'],'attributes':_0x1dc31d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f2802){logger[_0x3b30('0x16')](_0x3b30('0x18'),_0x5dc0ab);logger[_0x3b30('0x11')](_0x3b30('0x18'),_0x5dc0ab,JSON[_0x3b30('0x13')](_0x3f2802));_0x58e998(_0x3f2802);})[_0x3b30('0x21')](function(_0x5c729c){logger[_0x3b30('0x14')](_0x3b30('0x18'),_0x5c729c[_0x3b30('0x15')],_0x5dc0ab);_0x2d7cd8(_0x14f19f['error'](0x1f4,_0x5c729c[_0x3b30('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x483ea2){var _0x3e9643=this;return new Promise(function(_0x37826e,_0x380c2e){return db[_0x3b30('0x19')][_0x3b30('0x22')]({'raw':_0x483ea2[_0x3b30('0x1b')]?_0x483ea2[_0x3b30('0x1b')][_0x3b30('0x1c')]===undefined?!![]:![]:!![],'where':_0x483ea2[_0x3b30('0x1b')]?_0x483ea2['options']['where']||null:null,'attributes':_0x483ea2[_0x3b30('0x1b')]?_0x483ea2[_0x3b30('0x1b')][_0x3b30('0x1e')]||null:null,'include':_0x483ea2[_0x3b30('0x1b')]?_0x483ea2[_0x3b30('0x1b')][_0x3b30('0x1f')]?_[_0x3b30('0x20')](_0x483ea2['options'][_0x3b30('0x1f')],function(_0x362845){return{'model':db[_0x362845[_0x3b30('0x23')]],'as':_0x362845['as'],'attributes':_0x362845[_0x3b30('0x1e')],'include':_0x362845[_0x3b30('0x1f')]?_[_0x3b30('0x20')](_0x362845[_0x3b30('0x1f')],function(_0x4ca8e9){return{'model':db[_0x4ca8e9['model']],'as':_0x4ca8e9['as'],'attributes':_0x4ca8e9[_0x3b30('0x1e')],'include':_0x4ca8e9[_0x3b30('0x1f')]?_[_0x3b30('0x20')](_0x4ca8e9[_0x3b30('0x1f')],function(_0x2c8a82){return{'model':db[_0x2c8a82[_0x3b30('0x23')]],'as':_0x2c8a82['as'],'attributes':_0x2c8a82[_0x3b30('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e111){logger['info'](_0x3b30('0x24'),_0x483ea2);logger[_0x3b30('0x11')]('ShowOpenchannelQueue',_0x483ea2,JSON['stringify'](_0x21e111));_0x37826e(_0x21e111);})[_0x3b30('0x21')](function(_0x4445cb){logger[_0x3b30('0x14')]('ShowOpenchannelQueue',_0x4445cb[_0x3b30('0x15')],_0x483ea2);_0x380c2e(_0x3e9643['error'](0x1f4,_0x4445cb[_0x3b30('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3f59d80..8595277 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 _0x0727=['register','openchannelQueue:','save','remove','update','removeListener'];(function(_0x2c9674,_0x2511ed){var _0x552de5=function(_0x4ac15a){while(--_0x4ac15a){_0x2c9674['push'](_0x2c9674['shift']());}};_0x552de5(++_0x2511ed);}(_0x0727,0x110));var _0x7072=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x0727[_0x2a1b33];return _0x4c50e7;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x7072('0x0'),_0x7072('0x1'),_0x7072('0x2')];function createListener(_0x11e538,_0xf74879){return function(_0x419cc2){_0xf74879['emit'](_0x11e538,_0x419cc2);};}function removeListener(_0x4131a5,_0x137e31){return function(){OpenchannelQueueEvents[_0x7072('0x3')](_0x4131a5,_0x137e31);};}exports[_0x7072('0x4')]=function(_0xc02184){for(var _0x58f17a=0x0,_0x3c0754=events['length'];_0x58f17a<_0x3c0754;_0x58f17a++){var _0x40185a=events[_0x58f17a];var _0x4ab794=createListener(_0x7072('0x5')+_0x40185a,_0xc02184);OpenchannelQueueEvents['on'](_0x40185a,_0x4ab794);}}; \ No newline at end of file +var _0x77a9=['emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x1e8e84,_0x33b0e9){var _0x3bf88b=function(_0x5a045e){while(--_0x5a045e){_0x1e8e84['push'](_0x1e8e84['shift']());}};_0x3bf88b(++_0x33b0e9);}(_0x77a9,0x1ec));var _0x977a=function(_0x3d1da6,_0x490f78){_0x3d1da6=_0x3d1da6-0x0;var _0x2986ad=_0x77a9[_0x3d1da6];return _0x2986ad;};'use strict';var OpenchannelQueueEvents=require(_0x977a('0x0'));var events=[_0x977a('0x1'),_0x977a('0x2'),_0x977a('0x3')];function createListener(_0xdb22d2,_0x4275e3){return function(_0xf1bc6){_0x4275e3[_0x977a('0x4')](_0xdb22d2,_0xf1bc6);};}function removeListener(_0x26e876,_0x2d772d){return function(){OpenchannelQueueEvents[_0x977a('0x5')](_0x26e876,_0x2d772d);};}exports['register']=function(_0x7c482b){for(var _0x5e3e6e=0x0,_0x593dda=events[_0x977a('0x6')];_0x5e3e6e<_0x593dda;_0x5e3e6e++){var _0x4363e4=events[_0x5e3e6e];var _0x270d66=createListener(_0x977a('0x7')+_0x4363e4,_0x7c482b);OpenchannelQueueEvents['on'](_0x4363e4,_0x270d66);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ae18363..4c0992e 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 _0x790f=['show','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x790f,0x80));var _0xf790=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x790f[_0x3f0b30];return _0x2748a5;};'use strict';var multer=require(_0xf790('0x0'));var util=require(_0xf790('0x1'));var path=require('path');var timeout=require(_0xf790('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf790('0x3'));var auth=require(_0xf790('0x4'));var interaction=require(_0xf790('0x5'));var config=require(_0xf790('0x6'));var controller=require(_0xf790('0x7'));router['get']('/',auth[_0xf790('0x8')](),controller[_0xf790('0x9')]);router[_0xf790('0xa')](_0xf790('0xb'),auth[_0xf790('0x8')](),controller['describe']);router[_0xf790('0xa')]('/:id',auth[_0xf790('0x8')](),controller[_0xf790('0xc')]);router[_0xf790('0xd')]('/',auth[_0xf790('0x8')](),controller[_0xf790('0xe')]);router['put']('/:id',auth[_0xf790('0x8')](),controller[_0xf790('0xf')]);router[_0xf790('0x10')](_0xf790('0x11'),auth[_0xf790('0x8')](),controller[_0xf790('0x12')]);module[_0xf790('0x13')]=router; \ No newline at end of file +var _0x599e=['delete','destroy','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x599e,0xd2));var _0xe599=function(_0x1e5c71,_0x4b087d){_0x1e5c71=_0x1e5c71-0x0;var _0x366264=_0x599e[_0x1e5c71];return _0x366264;};'use strict';var multer=require('multer');var util=require(_0xe599('0x0'));var path=require(_0xe599('0x1'));var timeout=require('connect-timeout');var express=require(_0xe599('0x2'));var router=express[_0xe599('0x3')]();var fs_extra=require(_0xe599('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe599('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0xe599('0x6')]('/',auth[_0xe599('0x7')](),controller['index']);router['get']('/describe',auth[_0xe599('0x7')](),controller[_0xe599('0x8')]);router['get'](_0xe599('0x9'),auth[_0xe599('0x7')](),controller[_0xe599('0xa')]);router[_0xe599('0xb')]('/',auth[_0xe599('0x7')](),controller['create']);router[_0xe599('0xc')](_0xe599('0x9'),auth[_0xe599('0x7')](),controller[_0xe599('0xd')]);router[_0xe599('0xe')]('/:id',auth[_0xe599('0x7')](),controller[_0xe599('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c00d3e2..a6cf19d 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 _0x4fea=['exports','STRING','DATE','moment','sequelize'];(function(_0x56b9aa,_0x356b89){var _0x5318d2=function(_0x452137){while(--_0x452137){_0x56b9aa['push'](_0x56b9aa['shift']());}};_0x5318d2(++_0x356b89);}(_0x4fea,0xad));var _0xa4fe=function(_0x496368,_0x886b7b){_0x496368=_0x496368-0x0;var _0x4e2482=_0x4fea[_0x496368];return _0x4e2482;};'use strict';var moment=require(_0xa4fe('0x0'));var Sequelize=require(_0xa4fe('0x1'));module[_0xa4fe('0x2')]={'uniqueid':{'type':Sequelize[_0xa4fe('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa4fe('0x3')]},'joinAt':{'type':Sequelize[_0xa4fe('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa4fe('0x4')]},'exitAt':{'type':Sequelize[_0xa4fe('0x4')]},'reason':{'type':Sequelize[_0xa4fe('0x3')]}}; \ No newline at end of file +var _0xa832=['moment','sequelize','exports','STRING','DATE'];(function(_0x2a2560,_0x21e5d9){var _0xef702f=function(_0x1929f4){while(--_0x1929f4){_0x2a2560['push'](_0x2a2560['shift']());}};_0xef702f(++_0x21e5d9);}(_0xa832,0x1db));var _0x2a83=function(_0x10f210,_0x2f4a2b){_0x10f210=_0x10f210-0x0;var _0x1471d0=_0xa832[_0x10f210];return _0x1471d0;};'use strict';var moment=require(_0x2a83('0x0'));var Sequelize=require(_0x2a83('0x1'));module[_0x2a83('0x2')]={'uniqueid':{'type':Sequelize[_0x2a83('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2a83('0x3')]},'joinAt':{'type':Sequelize[_0x2a83('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2a83('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5853bcb..42911ff 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 _0xd7f9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','OpenchannelQueueReport','includeAll','include','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5ae4bf,_0xf4c26f){var _0x128779=function(_0x48d78d){while(--_0x48d78d){_0x5ae4bf['push'](_0x5ae4bf['shift']());}};_0x128779(++_0xf4c26f);}(_0xd7f9,0x168));var _0x9d7f=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xd7f9[_0x55fa03];return _0x2cd7cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d7f('0x0'));var zipdir=require(_0x9d7f('0x1'));var jsonpatch=require(_0x9d7f('0x2'));var rp=require(_0x9d7f('0x3'));var moment=require('moment');var BPromise=require(_0x9d7f('0x4'));var Mustache=require(_0x9d7f('0x5'));var util=require(_0x9d7f('0x6'));var path=require(_0x9d7f('0x7'));var sox=require('sox');var csv=require(_0x9d7f('0x8'));var ejs=require(_0x9d7f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d7f('0xa'));var _=require(_0x9d7f('0xb'));var squel=require(_0x9d7f('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d7f('0xd'));var deskjs=require(_0x9d7f('0xe'));var toCsv=require(_0x9d7f('0x8'));var querystring=require('querystring');var Papa=require(_0x9d7f('0xf'));var Redis=require(_0x9d7f('0x10'));var authService=require(_0x9d7f('0x11'));var qs=require(_0x9d7f('0x12'));var as=require(_0x9d7f('0x13'));var hardwareService=require(_0x9d7f('0x14'));var logger=require(_0x9d7f('0x15'))(_0x9d7f('0x16'));var utils=require(_0x9d7f('0x17'));var config=require(_0x9d7f('0x18'));var licenseUtil=require(_0x9d7f('0x19'));var db=require(_0x9d7f('0x1a'))['db'];function respondWithStatusCode(_0x2eb513,_0x7a736a){_0x7a736a=_0x7a736a||0xcc;return function(_0x20dec4){if(_0x20dec4){return _0x2eb513['sendStatus'](_0x7a736a);}return _0x2eb513[_0x9d7f('0x1b')](_0x7a736a)['end']();};}function respondWithResult(_0x381401,_0x1ff3b4){_0x1ff3b4=_0x1ff3b4||0xc8;return function(_0x18c10d){if(_0x18c10d){return _0x381401[_0x9d7f('0x1b')](_0x1ff3b4)[_0x9d7f('0x1c')](_0x18c10d);}};}function respondWithFilteredResult(_0x1f521c,_0xe39b93){return function(_0x7699f8){if(_0x7699f8){var _0x213166=typeof _0xe39b93[_0x9d7f('0x1d')]===_0x9d7f('0x1e')&&typeof _0xe39b93[_0x9d7f('0x1f')]===_0x9d7f('0x1e');var _0x3a3462=_0x7699f8['count'];var _0x23dc6d=_0x213166?0x0:_0xe39b93[_0x9d7f('0x1d')];var _0x54fb4e=_0x213166?_0x7699f8[_0x9d7f('0x20')]:_0xe39b93[_0x9d7f('0x1d')]+_0xe39b93['limit'];var _0xf35173;if(_0x54fb4e>=_0x3a3462){_0x54fb4e=_0x3a3462;_0xf35173=0xc8;}else{_0xf35173=0xce;}_0x1f521c[_0x9d7f('0x1b')](_0xf35173);return _0x1f521c[_0x9d7f('0x21')](_0x9d7f('0x22'),_0x23dc6d+'-'+_0x54fb4e+'/'+_0x3a3462)[_0x9d7f('0x1c')](_0x7699f8);}return null;};}function patchUpdates(_0x49b940){return function(_0x300fe8){try{jsonpatch[_0x9d7f('0x23')](_0x300fe8,_0x49b940,!![]);}catch(_0x473720){return BPromise[_0x9d7f('0x24')](_0x473720);}return _0x300fe8['save']();};}function saveUpdates(_0x2921c0,_0x17c955){return function(_0xf597c5){if(_0xf597c5){return _0xf597c5[_0x9d7f('0x25')](_0x2921c0)[_0x9d7f('0x26')](function(_0x1692ee){return _0x1692ee;});}return null;};}function removeEntity(_0x5ad011,_0x3dd7dd){return function(_0x236e34){if(_0x236e34){return _0x236e34[_0x9d7f('0x27')]()[_0x9d7f('0x26')](function(){_0x5ad011[_0x9d7f('0x1b')](0xcc)[_0x9d7f('0x28')]();});}};}function handleEntityNotFound(_0xf9c9d1,_0x521edb){return function(_0xe83e3e){if(!_0xe83e3e){_0xf9c9d1[_0x9d7f('0x29')](0x194);}return _0xe83e3e;};}function handleError(_0x225c5d,_0x6a4fa2){_0x6a4fa2=_0x6a4fa2||0x1f4;return function(_0x50fa18){logger['error'](_0x50fa18['stack']);if(_0x50fa18['name']){delete _0x50fa18[_0x9d7f('0x2a')];}_0x225c5d[_0x9d7f('0x1b')](_0x6a4fa2)[_0x9d7f('0x2b')](_0x50fa18);};}exports[_0x9d7f('0x2c')]=function(_0x169d1f,_0x1fa680){var _0x358512={},_0xdcf764={},_0x37572b={'count':0x0,'rows':[]};var _0x2f8fc9=_[_0x9d7f('0x2d')](db['OpenchannelQueueReport'][_0x9d7f('0x2e')],function(_0x1d7d75){return{'name':_0x1d7d75[_0x9d7f('0x2f')],'type':_0x1d7d75['type']['key']};});_0xdcf764[_0x9d7f('0x30')]=_['map'](_0x2f8fc9,_0x9d7f('0x2a'));_0xdcf764['query']=_[_0x9d7f('0x31')](_0x169d1f[_0x9d7f('0x32')]);_0xdcf764[_0x9d7f('0x33')]=_['intersection'](_0xdcf764[_0x9d7f('0x30')],_0xdcf764['query']);_0x358512[_0x9d7f('0x34')]=_[_0x9d7f('0x35')](_0xdcf764[_0x9d7f('0x30')],qs[_0x9d7f('0x36')](_0x169d1f['query'][_0x9d7f('0x36')]));_0x358512[_0x9d7f('0x34')]=_0x358512[_0x9d7f('0x34')][_0x9d7f('0x37')]?_0x358512[_0x9d7f('0x34')]:_0xdcf764['model'];if(!_0x169d1f[_0x9d7f('0x32')][_0x9d7f('0x38')](_0x9d7f('0x39'))){_0x358512[_0x9d7f('0x1f')]=qs[_0x9d7f('0x1f')](_0x169d1f['query'][_0x9d7f('0x1f')]);_0x358512[_0x9d7f('0x1d')]=qs[_0x9d7f('0x1d')](_0x169d1f['query']['offset']);}_0x358512['order']=qs[_0x9d7f('0x3a')](_0x169d1f[_0x9d7f('0x32')][_0x9d7f('0x3a')]);_0x358512[_0x9d7f('0x3b')]=qs[_0x9d7f('0x33')](_[_0x9d7f('0x3c')](_0x169d1f[_0x9d7f('0x32')],_0xdcf764[_0x9d7f('0x33')]),_0x2f8fc9);if(_0x169d1f[_0x9d7f('0x32')][_0x9d7f('0x3d')]){_0x358512[_0x9d7f('0x3b')]=_['merge'](_0x358512[_0x9d7f('0x3b')],{'$or':_[_0x9d7f('0x2d')](_0x2f8fc9,function(_0x460dae){if(_0x460dae['type']!==_0x9d7f('0x3e')){var _0x3b2479={};_0x3b2479[_0x460dae['name']]={'$like':'%'+_0x169d1f[_0x9d7f('0x32')]['filter']+'%'};return _0x3b2479;}})});}_0x358512=_[_0x9d7f('0x3f')]({},_0x358512,_0x169d1f['options']);var _0x480261={'where':_0x358512[_0x9d7f('0x3b')]};return db[_0x9d7f('0x40')]['count'](_0x480261)[_0x9d7f('0x26')](function(_0x2c69d2){_0x37572b['count']=_0x2c69d2;if(_0x169d1f[_0x9d7f('0x32')][_0x9d7f('0x41')]){_0x358512[_0x9d7f('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x358512);})[_0x9d7f('0x26')](function(_0x277a05){_0x37572b[_0x9d7f('0x43')]=_0x277a05;return _0x37572b;})[_0x9d7f('0x26')](respondWithFilteredResult(_0x1fa680,_0x358512))[_0x9d7f('0x44')](handleError(_0x1fa680,null));};exports[_0x9d7f('0x45')]=function(_0x19ab48,_0x2102d9){var _0x39e7b7={'raw':!![],'where':{'id':_0x19ab48[_0x9d7f('0x46')]['id']}},_0x8c3254={};_0x8c3254[_0x9d7f('0x30')]=_['keys'](db[_0x9d7f('0x40')]['rawAttributes']);_0x8c3254[_0x9d7f('0x32')]=_['keys'](_0x19ab48[_0x9d7f('0x32')]);_0x8c3254[_0x9d7f('0x33')]=_[_0x9d7f('0x35')](_0x8c3254[_0x9d7f('0x30')],_0x8c3254['query']);_0x39e7b7['attributes']=_[_0x9d7f('0x35')](_0x8c3254['model'],qs['fields'](_0x19ab48[_0x9d7f('0x32')][_0x9d7f('0x36')]));_0x39e7b7['attributes']=_0x39e7b7['attributes']['length']?_0x39e7b7['attributes']:_0x8c3254[_0x9d7f('0x30')];if(_0x19ab48[_0x9d7f('0x32')]['includeAll']){_0x39e7b7[_0x9d7f('0x42')]=[{'all':!![]}];}_0x39e7b7=_[_0x9d7f('0x3f')]({},_0x39e7b7,_0x19ab48[_0x9d7f('0x47')]);return db[_0x9d7f('0x40')][_0x9d7f('0x48')](_0x39e7b7)['then'](handleEntityNotFound(_0x2102d9,null))['then'](respondWithResult(_0x2102d9,null))[_0x9d7f('0x44')](handleError(_0x2102d9,null));};exports[_0x9d7f('0x49')]=function(_0x2f2eeb,_0x15037d){return db[_0x9d7f('0x40')][_0x9d7f('0x49')](_0x2f2eeb[_0x9d7f('0x4a')],{})[_0x9d7f('0x26')](respondWithResult(_0x15037d,0xc9))[_0x9d7f('0x44')](handleError(_0x15037d,null));};exports[_0x9d7f('0x25')]=function(_0x2e455d,_0x468165){if(_0x2e455d[_0x9d7f('0x4a')]['id']){delete _0x2e455d['body']['id'];}return db[_0x9d7f('0x40')]['find']({'where':{'id':_0x2e455d[_0x9d7f('0x46')]['id']}})[_0x9d7f('0x26')](handleEntityNotFound(_0x468165,null))[_0x9d7f('0x26')](saveUpdates(_0x2e455d[_0x9d7f('0x4a')],null))[_0x9d7f('0x26')](respondWithResult(_0x468165,null))[_0x9d7f('0x44')](handleError(_0x468165,null));};exports[_0x9d7f('0x27')]=function(_0x220c5b,_0x41148a){return db[_0x9d7f('0x40')][_0x9d7f('0x48')]({'where':{'id':_0x220c5b['params']['id']}})[_0x9d7f('0x26')](handleEntityNotFound(_0x41148a,null))['then'](removeEntity(_0x41148a,null))[_0x9d7f('0x44')](handleError(_0x41148a,null));};exports[_0x9d7f('0x4b')]=function(_0x128e1e,_0x13310f){return db[_0x9d7f('0x40')][_0x9d7f('0x4b')]()[_0x9d7f('0x26')](respondWithResult(_0x13310f,null))[_0x9d7f('0x44')](handleError(_0x13310f,null));}; \ No newline at end of file +var _0x1e97=['set','json','apply','reject','save','update','then','error','name','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e97,0x158));var _0x71e9=function(_0xa6a98c,_0x6fada6){_0xa6a98c=_0xa6a98c-0x0;var _0x337e98=_0x1e97[_0xa6a98c];return _0x337e98;};'use strict';var emlformat=require(_0x71e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71e9('0x1'));var jsonpatch=require(_0x71e9('0x2'));var rp=require(_0x71e9('0x3'));var moment=require(_0x71e9('0x4'));var BPromise=require(_0x71e9('0x5'));var Mustache=require(_0x71e9('0x6'));var util=require(_0x71e9('0x7'));var path=require(_0x71e9('0x8'));var sox=require(_0x71e9('0x9'));var csv=require('to-csv');var ejs=require(_0x71e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71e9('0xb'));var squel=require(_0x71e9('0xc'));var crypto=require(_0x71e9('0xd'));var jsforce=require(_0x71e9('0xe'));var deskjs=require(_0x71e9('0xf'));var toCsv=require(_0x71e9('0x10'));var querystring=require(_0x71e9('0x11'));var Papa=require(_0x71e9('0x12'));var Redis=require(_0x71e9('0x13'));var authService=require(_0x71e9('0x14'));var qs=require(_0x71e9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71e9('0x16'));var logger=require(_0x71e9('0x17'))(_0x71e9('0x18'));var utils=require(_0x71e9('0x19'));var config=require(_0x71e9('0x1a'));var licenseUtil=require(_0x71e9('0x1b'));var db=require(_0x71e9('0x1c'))['db'];function respondWithStatusCode(_0x326f85,_0x51cbc6){_0x51cbc6=_0x51cbc6||0xcc;return function(_0xfee042){if(_0xfee042){return _0x326f85[_0x71e9('0x1d')](_0x51cbc6);}return _0x326f85['status'](_0x51cbc6)[_0x71e9('0x1e')]();};}function respondWithResult(_0x43a0dd,_0x52fb2e){_0x52fb2e=_0x52fb2e||0xc8;return function(_0x57e63a){if(_0x57e63a){return _0x43a0dd[_0x71e9('0x1f')](_0x52fb2e)['json'](_0x57e63a);}};}function respondWithFilteredResult(_0x1b548d,_0x3baf7b){return function(_0x3af0cb){if(_0x3af0cb){var _0x4ebb76=typeof _0x3baf7b['offset']===_0x71e9('0x20')&&typeof _0x3baf7b[_0x71e9('0x21')]===_0x71e9('0x20');var _0x4bef9a=_0x3af0cb[_0x71e9('0x22')];var _0x2c18c9=_0x4ebb76?0x0:_0x3baf7b[_0x71e9('0x23')];var _0x5c75eb=_0x4ebb76?_0x3af0cb[_0x71e9('0x22')]:_0x3baf7b[_0x71e9('0x23')]+_0x3baf7b[_0x71e9('0x21')];var _0x2250e8;if(_0x5c75eb>=_0x4bef9a){_0x5c75eb=_0x4bef9a;_0x2250e8=0xc8;}else{_0x2250e8=0xce;}_0x1b548d[_0x71e9('0x1f')](_0x2250e8);return _0x1b548d[_0x71e9('0x24')]('Content-Range',_0x2c18c9+'-'+_0x5c75eb+'/'+_0x4bef9a)[_0x71e9('0x25')](_0x3af0cb);}return null;};}function patchUpdates(_0x3c806d){return function(_0x173635){try{jsonpatch[_0x71e9('0x26')](_0x173635,_0x3c806d,!![]);}catch(_0x295c75){return BPromise[_0x71e9('0x27')](_0x295c75);}return _0x173635[_0x71e9('0x28')]();};}function saveUpdates(_0x72b826,_0x4b4ce0){return function(_0x6e5291){if(_0x6e5291){return _0x6e5291[_0x71e9('0x29')](_0x72b826)['then'](function(_0x3416af){return _0x3416af;});}return null;};}function removeEntity(_0x4c9c51,_0x3ecc37){return function(_0x4c12cb){if(_0x4c12cb){return _0x4c12cb['destroy']()[_0x71e9('0x2a')](function(){_0x4c9c51[_0x71e9('0x1f')](0xcc)[_0x71e9('0x1e')]();});}};}function handleEntityNotFound(_0x8fdf4f,_0x1574b7){return function(_0x3c59bc){if(!_0x3c59bc){_0x8fdf4f['sendStatus'](0x194);}return _0x3c59bc;};}function handleError(_0x2050b1,_0x374e1a){_0x374e1a=_0x374e1a||0x1f4;return function(_0x67d050){logger[_0x71e9('0x2b')](_0x67d050['stack']);if(_0x67d050[_0x71e9('0x2c')]){delete _0x67d050[_0x71e9('0x2c')];}_0x2050b1[_0x71e9('0x1f')](_0x374e1a)['send'](_0x67d050);};}exports['index']=function(_0xcce0c6,_0x2d6164){var _0x639904={},_0x123c1f={},_0x3d2f75={'count':0x0,'rows':[]};var _0x2ecdcf=_[_0x71e9('0x2d')](db['OpenchannelQueueReport'][_0x71e9('0x2e')],function(_0x4f0035){return{'name':_0x4f0035[_0x71e9('0x2f')],'type':_0x4f0035[_0x71e9('0x30')]['key']};});_0x123c1f['model']=_[_0x71e9('0x2d')](_0x2ecdcf,_0x71e9('0x2c'));_0x123c1f[_0x71e9('0x31')]=_[_0x71e9('0x32')](_0xcce0c6[_0x71e9('0x31')]);_0x123c1f['filters']=_[_0x71e9('0x33')](_0x123c1f[_0x71e9('0x34')],_0x123c1f[_0x71e9('0x31')]);_0x639904['attributes']=_[_0x71e9('0x33')](_0x123c1f[_0x71e9('0x34')],qs['fields'](_0xcce0c6[_0x71e9('0x31')]['fields']));_0x639904[_0x71e9('0x35')]=_0x639904[_0x71e9('0x35')][_0x71e9('0x36')]?_0x639904[_0x71e9('0x35')]:_0x123c1f['model'];if(!_0xcce0c6[_0x71e9('0x31')]['hasOwnProperty'](_0x71e9('0x37'))){_0x639904[_0x71e9('0x21')]=qs[_0x71e9('0x21')](_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x21')]);_0x639904[_0x71e9('0x23')]=qs[_0x71e9('0x23')](_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x23')]);}_0x639904['order']=qs[_0x71e9('0x38')](_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x38')]);_0x639904[_0x71e9('0x39')]=qs[_0x71e9('0x3a')](_[_0x71e9('0x3b')](_0xcce0c6[_0x71e9('0x31')],_0x123c1f[_0x71e9('0x3a')]),_0x2ecdcf);if(_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x3c')]){_0x639904[_0x71e9('0x39')]=_[_0x71e9('0x3d')](_0x639904[_0x71e9('0x39')],{'$or':_[_0x71e9('0x2d')](_0x2ecdcf,function(_0x4e4a83){if(_0x4e4a83['type']!==_0x71e9('0x3e')){var _0x49f4c3={};_0x49f4c3[_0x4e4a83['name']]={'$like':'%'+_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x3c')]+'%'};return _0x49f4c3;}})});}_0x639904=_[_0x71e9('0x3d')]({},_0x639904,_0xcce0c6[_0x71e9('0x3f')]);var _0x235623={'where':_0x639904[_0x71e9('0x39')]};return db[_0x71e9('0x40')]['count'](_0x235623)[_0x71e9('0x2a')](function(_0x25b1b7){_0x3d2f75[_0x71e9('0x22')]=_0x25b1b7;if(_0xcce0c6[_0x71e9('0x31')][_0x71e9('0x41')]){_0x639904[_0x71e9('0x42')]=[{'all':!![]}];}return db[_0x71e9('0x40')][_0x71e9('0x43')](_0x639904);})[_0x71e9('0x2a')](function(_0x113786){_0x3d2f75['rows']=_0x113786;return _0x3d2f75;})[_0x71e9('0x2a')](respondWithFilteredResult(_0x2d6164,_0x639904))[_0x71e9('0x44')](handleError(_0x2d6164,null));};exports[_0x71e9('0x45')]=function(_0x5bf6f8,_0x3c5df6){var _0x1ba111={'raw':!![],'where':{'id':_0x5bf6f8[_0x71e9('0x46')]['id']}},_0x2ba3c6={};_0x2ba3c6[_0x71e9('0x34')]=_[_0x71e9('0x32')](db[_0x71e9('0x40')][_0x71e9('0x2e')]);_0x2ba3c6['query']=_[_0x71e9('0x32')](_0x5bf6f8[_0x71e9('0x31')]);_0x2ba3c6[_0x71e9('0x3a')]=_['intersection'](_0x2ba3c6[_0x71e9('0x34')],_0x2ba3c6['query']);_0x1ba111[_0x71e9('0x35')]=_[_0x71e9('0x33')](_0x2ba3c6['model'],qs[_0x71e9('0x47')](_0x5bf6f8['query'][_0x71e9('0x47')]));_0x1ba111[_0x71e9('0x35')]=_0x1ba111['attributes'][_0x71e9('0x36')]?_0x1ba111[_0x71e9('0x35')]:_0x2ba3c6[_0x71e9('0x34')];if(_0x5bf6f8[_0x71e9('0x31')]['includeAll']){_0x1ba111[_0x71e9('0x42')]=[{'all':!![]}];}_0x1ba111=_[_0x71e9('0x3d')]({},_0x1ba111,_0x5bf6f8[_0x71e9('0x3f')]);return db['OpenchannelQueueReport']['find'](_0x1ba111)[_0x71e9('0x2a')](handleEntityNotFound(_0x3c5df6,null))[_0x71e9('0x2a')](respondWithResult(_0x3c5df6,null))[_0x71e9('0x44')](handleError(_0x3c5df6,null));};exports[_0x71e9('0x48')]=function(_0x2d808b,_0x2b34d4){return db[_0x71e9('0x40')]['create'](_0x2d808b['body'],{})[_0x71e9('0x2a')](respondWithResult(_0x2b34d4,0xc9))[_0x71e9('0x44')](handleError(_0x2b34d4,null));};exports[_0x71e9('0x29')]=function(_0x38da4d,_0x30d2d3){if(_0x38da4d['body']['id']){delete _0x38da4d[_0x71e9('0x49')]['id'];}return db[_0x71e9('0x40')][_0x71e9('0x4a')]({'where':{'id':_0x38da4d[_0x71e9('0x46')]['id']}})[_0x71e9('0x2a')](handleEntityNotFound(_0x30d2d3,null))[_0x71e9('0x2a')](saveUpdates(_0x38da4d[_0x71e9('0x49')],null))[_0x71e9('0x2a')](respondWithResult(_0x30d2d3,null))[_0x71e9('0x44')](handleError(_0x30d2d3,null));};exports['destroy']=function(_0x7ad67d,_0x2263f4){return db[_0x71e9('0x40')]['find']({'where':{'id':_0x7ad67d['params']['id']}})[_0x71e9('0x2a')](handleEntityNotFound(_0x2263f4,null))[_0x71e9('0x2a')](removeEntity(_0x2263f4,null))[_0x71e9('0x44')](handleError(_0x2263f4,null));};exports[_0x71e9('0x4b')]=function(_0x122438,_0xf0f62a){return db[_0x71e9('0x40')][_0x71e9('0x4b')]()['then'](respondWithResult(_0xf0f62a,null))[_0x71e9('0x44')](handleError(_0xf0f62a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6e7be26..b748ea9 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x51e750,_0x229219){var _0x208054=function(_0x447523){while(--_0x447523){_0x51e750['push'](_0x51e750['shift']());}};_0x208054(++_0x229219);}(_0x1261,0x144));var _0x1126=function(_0x32f38b,_0x1b4fc7){_0x32f38b=_0x32f38b-0x0;var _0x15ec9b=_0x1261[_0x32f38b];return _0x15ec9b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x3cd1c9,_0x3114f7){var _0x4ab8d0=function(_0x2c2176){while(--_0x2c2176){_0x3cd1c9['push'](_0x3cd1c9['shift']());}};_0x4ab8d0(++_0x3114f7);}(_0x7a54,0x106));var _0x47a5=function(_0x500c18,_0x2b4ba9){_0x500c18=_0x500c18-0x0;var _0x58ee51=_0x7a54[_0x500c18];return _0x58ee51;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index deb6157..c9168c4 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 _0x8f59=['raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','then','debug','stringify','catch','update'];(function(_0x5e5c15,_0x56ef84){var _0x41684e=function(_0x2400f2){while(--_0x2400f2){_0x5e5c15['push'](_0x5e5c15['shift']());}};_0x41684e(++_0x56ef84);}(_0x8f59,0x11d));var _0x98f5=function(_0x11b7ee,_0x304f2c){_0x11b7ee=_0x11b7ee-0x0;var _0x118a1f=_0x8f59[_0x11b7ee];return _0x118a1f;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')](_0x51a567[_0x98f5('0x17')],{'raw':_0x51a567['options']?_0x51a567[_0x98f5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x98f5('0x19')](function(_0x191f23){logger['info'](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x1a')](_0x98f5('0x14'),_0x51a567,JSON[_0x98f5('0x1b')](_0x191f23));_0x9e42dd(_0x191f23);})[_0x98f5('0x1c')](function(_0x3dc7c2){logger[_0x98f5('0x11')]('CreateOpenchannelQueueReport',_0x3dc7c2[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c['error'](0x1f4,_0x3dc7c2[_0x98f5('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x44bfbb){var _0x40c69b=this;return new Promise(function(_0x106b24,_0x5c64e){return db[_0x98f5('0x15')][_0x98f5('0x1d')](_0x44bfbb[_0x98f5('0x17')],{'raw':_0x44bfbb['options']?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44bfbb['options']?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x1f')]||null:null,'attributes':_0x44bfbb[_0x98f5('0x18')]?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x20')]||null:null,'limit':_0x44bfbb[_0x98f5('0x18')]?_0x44bfbb[_0x98f5('0x18')][_0x98f5('0x21')]||null:null})['then'](function(_0x4c10b8){logger[_0x98f5('0xd')](_0x98f5('0x22'),_0x44bfbb);logger[_0x98f5('0x1a')](_0x98f5('0x22'),_0x44bfbb,JSON[_0x98f5('0x1b')](_0x4c10b8));_0x106b24(_0x4c10b8);})[_0x98f5('0x1c')](function(_0x5e9d73){logger[_0x98f5('0x11')](_0x98f5('0x22'),_0x5e9d73[_0x98f5('0x12')],_0x44bfbb);_0x5c64e(_0x40c69b[_0x98f5('0x11')](0x1f4,_0x5e9d73[_0x98f5('0x12')]));});});}; \ No newline at end of file +var _0xd237=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','stringify','update','options','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd237,0x14f));var _0x7d23=function(_0xec00c7,_0x502741){_0xec00c7=_0xec00c7-0x0;var _0xc89ed1=_0xd237[_0xec00c7];return _0xc89ed1;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});}exports[_0x7d23('0x17')]=function(_0x506a3b){var _0x313471=this;return new Promise(function(_0x3d6a7b,_0x49ce32){return db[_0x7d23('0x18')][_0x7d23('0x19')](_0x506a3b[_0x7d23('0x1a')],{'raw':_0x506a3b['options']?_0x506a3b['options'][_0x7d23('0x1b')]===undefined?!![]:![]:!![]})[_0x7d23('0xc')](function(_0x56b0ba){logger[_0x7d23('0xd')]('CreateOpenchannelQueueReport',_0x506a3b);logger[_0x7d23('0xf')]('CreateOpenchannelQueueReport',_0x506a3b,JSON[_0x7d23('0x1c')](_0x56b0ba));_0x3d6a7b(_0x56b0ba);})[_0x7d23('0x16')](function(_0x59522b){logger[_0x7d23('0x12')](_0x7d23('0x17'),_0x59522b[_0x7d23('0x14')],_0x506a3b);_0x49ce32(_0x313471['error'](0x1f4,_0x59522b[_0x7d23('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2e6d9f){var _0x354b2a=this;return new Promise(function(_0x1c007a,_0x3a5d87){return db[_0x7d23('0x18')][_0x7d23('0x1d')](_0x2e6d9f[_0x7d23('0x1a')],{'raw':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f['options'][_0x7d23('0x1f')]||null:null,'attributes':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x20')]||null:null,'limit':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x21')]||null:null})[_0x7d23('0xc')](function(_0x4808f2){logger[_0x7d23('0xd')](_0x7d23('0x22'),_0x2e6d9f);logger['debug'](_0x7d23('0x22'),_0x2e6d9f,JSON[_0x7d23('0x1c')](_0x4808f2));_0x1c007a(_0x4808f2);})[_0x7d23('0x16')](function(_0x4b1c92){logger[_0x7d23('0x12')](_0x7d23('0x22'),_0x4b1c92[_0x7d23('0x14')],_0x2e6d9f);_0x3a5d87(_0x354b2a[_0x7d23('0x12')](0x1f4,_0x4b1c92[_0x7d23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7c0678a..52a66e8 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 _0x6066=['create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x9fac81,_0x2e0d19){var _0x1290e5=function(_0x491430){while(--_0x491430){_0x9fac81['push'](_0x9fac81['shift']());}};_0x1290e5(++_0x2e0d19);}(_0x6066,0x131));var _0x6606=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x6066[_0xd7b0a4];return _0x184e9e;};'use strict';var multer=require('multer');var util=require(_0x6606('0x0'));var path=require(_0x6606('0x1'));var timeout=require(_0x6606('0x2'));var express=require(_0x6606('0x3'));var router=express['Router']();var fs_extra=require(_0x6606('0x4'));var auth=require(_0x6606('0x5'));var interaction=require(_0x6606('0x6'));var config=require(_0x6606('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x6606('0x8')]('/',auth[_0x6606('0x9')](),controller[_0x6606('0xa')]);router[_0x6606('0x8')](_0x6606('0xb'),auth['isAuthenticated'](),controller[_0x6606('0xc')]);router[_0x6606('0x8')](_0x6606('0xd'),auth[_0x6606('0x9')](),controller['show']);router[_0x6606('0xe')]('/',auth['isAuthenticated'](),controller[_0x6606('0xf')]);router[_0x6606('0x10')](_0x6606('0xd'),auth[_0x6606('0x9')](),controller[_0x6606('0x11')]);router[_0x6606('0x12')]('/:id',auth[_0x6606('0x9')](),controller['destroy']);module[_0x6606('0x13')]=router; \ No newline at end of file +var _0xbde1=['../../components/interaction/service','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x1c47dd,_0x3348d8){var _0x41de79=function(_0x548e9d){while(--_0x548e9d){_0x1c47dd['push'](_0x1c47dd['shift']());}};_0x41de79(++_0x3348d8);}(_0xbde1,0x1d6));var _0x1bde=function(_0x114db7,_0x3c3d4b){_0x114db7=_0x114db7-0x0;var _0x391c20=_0xbde1[_0x114db7];return _0x391c20;};'use strict';var multer=require(_0x1bde('0x0'));var util=require(_0x1bde('0x1'));var path=require(_0x1bde('0x2'));var timeout=require('connect-timeout');var express=require(_0x1bde('0x3'));var router=express[_0x1bde('0x4')]();var fs_extra=require(_0x1bde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1bde('0x6'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1bde('0x7')](_0x1bde('0x8'),auth[_0x1bde('0x9')](),controller[_0x1bde('0xa')]);router[_0x1bde('0x7')]('/:id',auth[_0x1bde('0x9')](),controller[_0x1bde('0xb')]);router[_0x1bde('0xc')]('/',auth[_0x1bde('0x9')](),controller[_0x1bde('0xd')]);router['put'](_0x1bde('0xe'),auth['isAuthenticated'](),controller[_0x1bde('0xf')]);router['delete'](_0x1bde('0xe'),auth[_0x1bde('0x9')](),controller[_0x1bde('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c0fa141..08e42d0 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x428a1a,_0xef1de9){var _0x2e6bab=function(_0x4ffeb5){while(--_0x4ffeb5){_0x428a1a['push'](_0x428a1a['shift']());}};_0x2e6bab(++_0xef1de9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x25c348,_0x33c0db){_0x25c348=_0x25c348-0x0;var _0x25c60a=_0xf4eb[_0x25c348];return _0x25c60a;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x382353,_0x1ece1e){var _0xf42fa9=function(_0x399b28){while(--_0x399b28){_0x382353['push'](_0x382353['shift']());}};_0xf42fa9(++_0x1ece1e);}(_0x008c,0x188));var _0xc008=function(_0x4ce39b,_0x30dca9){_0x4ce39b=_0x4ce39b-0x0;var _0x25957c=_0x008c[_0x4ce39b];return _0x25957c;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6a7763d..cd6d5ab 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 _0x67c7=['catch','create','body','update','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','set','reject','then','destroy','sendStatus','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','params','includeAll','options','find'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x67c7,0xd3));var _0x767c=function(_0x9ec221,_0x2594a6){_0x9ec221=_0x9ec221-0x0;var _0xdbe55e=_0x67c7[_0x9ec221];return _0xdbe55e;};'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(_0x767c('0x0'));var moment=require(_0x767c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x767c('0x2'));var util=require(_0x767c('0x3'));var path=require(_0x767c('0x4'));var sox=require(_0x767c('0x5'));var csv=require(_0x767c('0x6'));var ejs=require(_0x767c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x767c('0x8'));var squel=require(_0x767c('0x9'));var crypto=require(_0x767c('0xa'));var jsforce=require(_0x767c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x767c('0x6'));var querystring=require(_0x767c('0xc'));var Papa=require(_0x767c('0xd'));var Redis=require('ioredis');var authService=require(_0x767c('0xe'));var qs=require(_0x767c('0xf'));var as=require(_0x767c('0x10'));var hardwareService=require(_0x767c('0x11'));var logger=require(_0x767c('0x12'))(_0x767c('0x13'));var utils=require(_0x767c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x767c('0x15'))['db'];function respondWithStatusCode(_0xf6c3bd,_0x390cc9){_0x390cc9=_0x390cc9||0xcc;return function(_0x54f414){if(_0x54f414){return _0xf6c3bd['sendStatus'](_0x390cc9);}return _0xf6c3bd[_0x767c('0x16')](_0x390cc9)[_0x767c('0x17')]();};}function respondWithResult(_0x1530de,_0x4bfb26){_0x4bfb26=_0x4bfb26||0xc8;return function(_0x17e386){if(_0x17e386){return _0x1530de[_0x767c('0x16')](_0x4bfb26)[_0x767c('0x18')](_0x17e386);}};}function respondWithFilteredResult(_0x58804b,_0x1cc60a){return function(_0x4cd2e9){if(_0x4cd2e9){var _0x2ea6db=typeof _0x1cc60a['offset']==='undefined'&&typeof _0x1cc60a[_0x767c('0x19')]===_0x767c('0x1a');var _0x50ecb1=_0x4cd2e9[_0x767c('0x1b')];var _0x329b0a=_0x2ea6db?0x0:_0x1cc60a[_0x767c('0x1c')];var _0x4a436b=_0x2ea6db?_0x4cd2e9['count']:_0x1cc60a['offset']+_0x1cc60a[_0x767c('0x19')];var _0x3a78d9;if(_0x4a436b>=_0x50ecb1){_0x4a436b=_0x50ecb1;_0x3a78d9=0xc8;}else{_0x3a78d9=0xce;}_0x58804b[_0x767c('0x16')](_0x3a78d9);return _0x58804b[_0x767c('0x1d')]('Content-Range',_0x329b0a+'-'+_0x4a436b+'/'+_0x50ecb1)[_0x767c('0x18')](_0x4cd2e9);}return null;};}function patchUpdates(_0x5b81fc){return function(_0x4d62e8){try{jsonpatch['apply'](_0x4d62e8,_0x5b81fc,!![]);}catch(_0x35f705){return BPromise[_0x767c('0x1e')](_0x35f705);}return _0x4d62e8['save']();};}function saveUpdates(_0x796691,_0x520e4d){return function(_0x55355a){if(_0x55355a){return _0x55355a['update'](_0x796691)[_0x767c('0x1f')](function(_0x411f06){return _0x411f06;});}return null;};}function removeEntity(_0x2cc0d7,_0x4575f6){return function(_0x3137d1){if(_0x3137d1){return _0x3137d1[_0x767c('0x20')]()[_0x767c('0x1f')](function(){_0x2cc0d7[_0x767c('0x16')](0xcc)[_0x767c('0x17')]();});}};}function handleEntityNotFound(_0x51b557,_0x16e877){return function(_0xbbe004){if(!_0xbbe004){_0x51b557[_0x767c('0x21')](0x194);}return _0xbbe004;};}function handleError(_0x419ba1,_0x2896fe){_0x2896fe=_0x2896fe||0x1f4;return function(_0x102038){logger['error'](_0x102038[_0x767c('0x22')]);if(_0x102038['name']){delete _0x102038[_0x767c('0x23')];}_0x419ba1[_0x767c('0x16')](_0x2896fe)[_0x767c('0x24')](_0x102038);};}exports['index']=function(_0x20c9f5,_0x38284e){var _0x2e7421={},_0x5edcfb={},_0x412fa1={'count':0x0,'rows':[]};var _0x5a1681=_[_0x767c('0x25')](db[_0x767c('0x26')][_0x767c('0x27')],function(_0x5d424a){return{'name':_0x5d424a[_0x767c('0x28')],'type':_0x5d424a[_0x767c('0x29')][_0x767c('0x2a')]};});_0x5edcfb[_0x767c('0x2b')]=_[_0x767c('0x25')](_0x5a1681,'name');_0x5edcfb[_0x767c('0x2c')]=_[_0x767c('0x2d')](_0x20c9f5[_0x767c('0x2c')]);_0x5edcfb['filters']=_[_0x767c('0x2e')](_0x5edcfb[_0x767c('0x2b')],_0x5edcfb[_0x767c('0x2c')]);_0x2e7421['attributes']=_['intersection'](_0x5edcfb[_0x767c('0x2b')],qs[_0x767c('0x2f')](_0x20c9f5[_0x767c('0x2c')][_0x767c('0x2f')]));_0x2e7421[_0x767c('0x30')]=_0x2e7421[_0x767c('0x30')][_0x767c('0x31')]?_0x2e7421[_0x767c('0x30')]:_0x5edcfb[_0x767c('0x2b')];if(!_0x20c9f5[_0x767c('0x2c')]['hasOwnProperty'](_0x767c('0x32'))){_0x2e7421[_0x767c('0x19')]=qs['limit'](_0x20c9f5['query'][_0x767c('0x19')]);_0x2e7421[_0x767c('0x1c')]=qs[_0x767c('0x1c')](_0x20c9f5[_0x767c('0x2c')]['offset']);}_0x2e7421[_0x767c('0x33')]=qs[_0x767c('0x34')](_0x20c9f5[_0x767c('0x2c')][_0x767c('0x34')]);_0x2e7421[_0x767c('0x35')]=qs[_0x767c('0x36')](_[_0x767c('0x37')](_0x20c9f5[_0x767c('0x2c')],_0x5edcfb[_0x767c('0x36')]),_0x5a1681);if(_0x20c9f5[_0x767c('0x2c')][_0x767c('0x38')]){_0x2e7421[_0x767c('0x35')]=_[_0x767c('0x39')](_0x2e7421['where'],{'$or':_[_0x767c('0x25')](_0x5a1681,function(_0x3ad0e4){if(_0x3ad0e4[_0x767c('0x29')]!=='VIRTUAL'){var _0x4515be={};_0x4515be[_0x3ad0e4[_0x767c('0x23')]]={'$like':'%'+_0x20c9f5[_0x767c('0x2c')][_0x767c('0x38')]+'%'};return _0x4515be;}})});}_0x2e7421=_['merge']({},_0x2e7421,_0x20c9f5['options']);var _0x1ef9e4={'where':_0x2e7421[_0x767c('0x35')]};return db['OpenchannelTransferReport'][_0x767c('0x1b')](_0x1ef9e4)['then'](function(_0x507302){_0x412fa1[_0x767c('0x1b')]=_0x507302;if(_0x20c9f5['query']['includeAll']){_0x2e7421[_0x767c('0x3a')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x767c('0x3b')](_0x2e7421);})[_0x767c('0x1f')](function(_0x211799){_0x412fa1[_0x767c('0x3c')]=_0x211799;return _0x412fa1;})[_0x767c('0x1f')](respondWithFilteredResult(_0x38284e,_0x2e7421))['catch'](handleError(_0x38284e,null));};exports['show']=function(_0x39ac44,_0x25c025){var _0x544719={'raw':!![],'where':{'id':_0x39ac44[_0x767c('0x3d')]['id']}},_0x434e5f={};_0x434e5f[_0x767c('0x2b')]=_[_0x767c('0x2d')](db[_0x767c('0x26')]['rawAttributes']);_0x434e5f[_0x767c('0x2c')]=_[_0x767c('0x2d')](_0x39ac44[_0x767c('0x2c')]);_0x434e5f['filters']=_[_0x767c('0x2e')](_0x434e5f[_0x767c('0x2b')],_0x434e5f[_0x767c('0x2c')]);_0x544719[_0x767c('0x30')]=_[_0x767c('0x2e')](_0x434e5f['model'],qs[_0x767c('0x2f')](_0x39ac44[_0x767c('0x2c')][_0x767c('0x2f')]));_0x544719[_0x767c('0x30')]=_0x544719[_0x767c('0x30')][_0x767c('0x31')]?_0x544719['attributes']:_0x434e5f[_0x767c('0x2b')];if(_0x39ac44[_0x767c('0x2c')][_0x767c('0x3e')]){_0x544719[_0x767c('0x3a')]=[{'all':!![]}];}_0x544719=_['merge']({},_0x544719,_0x39ac44[_0x767c('0x3f')]);return db[_0x767c('0x26')][_0x767c('0x40')](_0x544719)[_0x767c('0x1f')](handleEntityNotFound(_0x25c025,null))[_0x767c('0x1f')](respondWithResult(_0x25c025,null))[_0x767c('0x41')](handleError(_0x25c025,null));};exports['create']=function(_0xaffac5,_0x17f889){return db[_0x767c('0x26')][_0x767c('0x42')](_0xaffac5[_0x767c('0x43')],{})[_0x767c('0x1f')](respondWithResult(_0x17f889,0xc9))['catch'](handleError(_0x17f889,null));};exports[_0x767c('0x44')]=function(_0x45797c,_0x346989){if(_0x45797c[_0x767c('0x43')]['id']){delete _0x45797c[_0x767c('0x43')]['id'];}return db[_0x767c('0x26')][_0x767c('0x40')]({'where':{'id':_0x45797c[_0x767c('0x3d')]['id']}})[_0x767c('0x1f')](handleEntityNotFound(_0x346989,null))[_0x767c('0x1f')](saveUpdates(_0x45797c[_0x767c('0x43')],null))[_0x767c('0x1f')](respondWithResult(_0x346989,null))[_0x767c('0x41')](handleError(_0x346989,null));};exports[_0x767c('0x20')]=function(_0x165256,_0x49807e){return db['OpenchannelTransferReport'][_0x767c('0x40')]({'where':{'id':_0x165256[_0x767c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x49807e,null))['then'](removeEntity(_0x49807e,null))[_0x767c('0x41')](handleError(_0x49807e,null));};exports['describe']=function(_0x3fe155,_0x4fe437){return db['OpenchannelTransferReport']['describe']()[_0x767c('0x1f')](respondWithResult(_0x4fe437,null))[_0x767c('0x41')](handleError(_0x4fe437,null));}; \ No newline at end of file +var _0x1ddd=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs'];(function(_0x2b625a,_0x4db612){var _0x1ef595=function(_0x212f12){while(--_0x212f12){_0x2b625a['push'](_0x2b625a['shift']());}};_0x1ef595(++_0x4db612);}(_0x1ddd,0x123));var _0xd1dd=function(_0x42a182,_0x17437b){_0x42a182=_0x42a182-0x0;var _0x7e848c=_0x1ddd[_0x42a182];return _0x7e848c;};'use strict';var emlformat=require(_0xd1dd('0x0'));var rimraf=require(_0xd1dd('0x1'));var zipdir=require(_0xd1dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1dd('0x3'));var BPromise=require(_0xd1dd('0x4'));var Mustache=require('mustache');var util=require(_0xd1dd('0x5'));var path=require(_0xd1dd('0x6'));var sox=require('sox');var csv=require(_0xd1dd('0x7'));var ejs=require(_0xd1dd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1dd('0x9'));var squel=require(_0xd1dd('0xa'));var crypto=require(_0xd1dd('0xb'));var jsforce=require(_0xd1dd('0xc'));var deskjs=require(_0xd1dd('0xd'));var toCsv=require(_0xd1dd('0x7'));var querystring=require(_0xd1dd('0xe'));var Papa=require(_0xd1dd('0xf'));var Redis=require(_0xd1dd('0x10'));var authService=require(_0xd1dd('0x11'));var qs=require(_0xd1dd('0x12'));var as=require(_0xd1dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1dd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd1dd('0x15'));var licenseUtil=require(_0xd1dd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b71a2,_0x3f7d0c){_0x3f7d0c=_0x3f7d0c||0xcc;return function(_0x149f17){if(_0x149f17){return _0x4b71a2[_0xd1dd('0x17')](_0x3f7d0c);}return _0x4b71a2['status'](_0x3f7d0c)['end']();};}function respondWithResult(_0x589026,_0x1a4513){_0x1a4513=_0x1a4513||0xc8;return function(_0xd583f2){if(_0xd583f2){return _0x589026['status'](_0x1a4513)[_0xd1dd('0x18')](_0xd583f2);}};}function respondWithFilteredResult(_0x5e9460,_0x4fd941){return function(_0x5564ff){if(_0x5564ff){var _0x2e68d6=typeof _0x4fd941[_0xd1dd('0x19')]===_0xd1dd('0x1a')&&typeof _0x4fd941[_0xd1dd('0x1b')]==='undefined';var _0xbf34e9=_0x5564ff[_0xd1dd('0x1c')];var _0x2a3440=_0x2e68d6?0x0:_0x4fd941[_0xd1dd('0x19')];var _0x100a12=_0x2e68d6?_0x5564ff[_0xd1dd('0x1c')]:_0x4fd941[_0xd1dd('0x19')]+_0x4fd941[_0xd1dd('0x1b')];var _0x4f020e;if(_0x100a12>=_0xbf34e9){_0x100a12=_0xbf34e9;_0x4f020e=0xc8;}else{_0x4f020e=0xce;}_0x5e9460[_0xd1dd('0x1d')](_0x4f020e);return _0x5e9460[_0xd1dd('0x1e')](_0xd1dd('0x1f'),_0x2a3440+'-'+_0x100a12+'/'+_0xbf34e9)[_0xd1dd('0x18')](_0x5564ff);}return null;};}function patchUpdates(_0xaab3cb){return function(_0x5c6a90){try{jsonpatch['apply'](_0x5c6a90,_0xaab3cb,!![]);}catch(_0x2b50b5){return BPromise[_0xd1dd('0x20')](_0x2b50b5);}return _0x5c6a90[_0xd1dd('0x21')]();};}function saveUpdates(_0x1319a9,_0x2ecefa){return function(_0x3b8a2f){if(_0x3b8a2f){return _0x3b8a2f['update'](_0x1319a9)[_0xd1dd('0x22')](function(_0x3bcb7e){return _0x3bcb7e;});}return null;};}function removeEntity(_0x1c5c22,_0x538f5a){return function(_0xfe0f25){if(_0xfe0f25){return _0xfe0f25[_0xd1dd('0x23')]()[_0xd1dd('0x22')](function(){_0x1c5c22[_0xd1dd('0x1d')](0xcc)[_0xd1dd('0x24')]();});}};}function handleEntityNotFound(_0x22e2d8,_0x4255e9){return function(_0x2d7dab){if(!_0x2d7dab){_0x22e2d8[_0xd1dd('0x17')](0x194);}return _0x2d7dab;};}function handleError(_0x19fd2c,_0x7bfebe){_0x7bfebe=_0x7bfebe||0x1f4;return function(_0x10122b){logger[_0xd1dd('0x25')](_0x10122b[_0xd1dd('0x26')]);if(_0x10122b['name']){delete _0x10122b[_0xd1dd('0x27')];}_0x19fd2c[_0xd1dd('0x1d')](_0x7bfebe)[_0xd1dd('0x28')](_0x10122b);};}exports['index']=function(_0x10eb07,_0x17c412){var _0x2aa2c5={},_0x5918e8={},_0xf7e0c5={'count':0x0,'rows':[]};var _0x40afbb=_[_0xd1dd('0x29')](db['OpenchannelTransferReport'][_0xd1dd('0x2a')],function(_0xb3e958){return{'name':_0xb3e958[_0xd1dd('0x2b')],'type':_0xb3e958[_0xd1dd('0x2c')][_0xd1dd('0x2d')]};});_0x5918e8[_0xd1dd('0x2e')]=_[_0xd1dd('0x29')](_0x40afbb,_0xd1dd('0x27'));_0x5918e8['query']=_[_0xd1dd('0x2f')](_0x10eb07['query']);_0x5918e8[_0xd1dd('0x30')]=_['intersection'](_0x5918e8[_0xd1dd('0x2e')],_0x5918e8[_0xd1dd('0x31')]);_0x2aa2c5[_0xd1dd('0x32')]=_[_0xd1dd('0x33')](_0x5918e8[_0xd1dd('0x2e')],qs['fields'](_0x10eb07[_0xd1dd('0x31')][_0xd1dd('0x34')]));_0x2aa2c5['attributes']=_0x2aa2c5[_0xd1dd('0x32')][_0xd1dd('0x35')]?_0x2aa2c5['attributes']:_0x5918e8[_0xd1dd('0x2e')];if(!_0x10eb07['query'][_0xd1dd('0x36')]('nolimit')){_0x2aa2c5[_0xd1dd('0x1b')]=qs['limit'](_0x10eb07[_0xd1dd('0x31')][_0xd1dd('0x1b')]);_0x2aa2c5[_0xd1dd('0x19')]=qs[_0xd1dd('0x19')](_0x10eb07['query']['offset']);}_0x2aa2c5[_0xd1dd('0x37')]=qs['sort'](_0x10eb07[_0xd1dd('0x31')][_0xd1dd('0x38')]);_0x2aa2c5[_0xd1dd('0x39')]=qs[_0xd1dd('0x30')](_[_0xd1dd('0x3a')](_0x10eb07[_0xd1dd('0x31')],_0x5918e8['filters']),_0x40afbb);if(_0x10eb07[_0xd1dd('0x31')][_0xd1dd('0x3b')]){_0x2aa2c5['where']=_['merge'](_0x2aa2c5[_0xd1dd('0x39')],{'$or':_[_0xd1dd('0x29')](_0x40afbb,function(_0x8dbed0){if(_0x8dbed0[_0xd1dd('0x2c')]!==_0xd1dd('0x3c')){var _0x342a2f={};_0x342a2f[_0x8dbed0[_0xd1dd('0x27')]]={'$like':'%'+_0x10eb07[_0xd1dd('0x31')][_0xd1dd('0x3b')]+'%'};return _0x342a2f;}})});}_0x2aa2c5=_[_0xd1dd('0x3d')]({},_0x2aa2c5,_0x10eb07[_0xd1dd('0x3e')]);var _0x23ae33={'where':_0x2aa2c5[_0xd1dd('0x39')]};return db[_0xd1dd('0x3f')]['count'](_0x23ae33)[_0xd1dd('0x22')](function(_0x592376){_0xf7e0c5[_0xd1dd('0x1c')]=_0x592376;if(_0x10eb07['query'][_0xd1dd('0x40')]){_0x2aa2c5[_0xd1dd('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xd1dd('0x42')](_0x2aa2c5);})[_0xd1dd('0x22')](function(_0x5324f3){_0xf7e0c5['rows']=_0x5324f3;return _0xf7e0c5;})[_0xd1dd('0x22')](respondWithFilteredResult(_0x17c412,_0x2aa2c5))[_0xd1dd('0x43')](handleError(_0x17c412,null));};exports[_0xd1dd('0x44')]=function(_0x2063e1,_0x80acaf){var _0x395173={'raw':!![],'where':{'id':_0x2063e1[_0xd1dd('0x45')]['id']}},_0x234367={};_0x234367[_0xd1dd('0x2e')]=_[_0xd1dd('0x2f')](db[_0xd1dd('0x3f')][_0xd1dd('0x2a')]);_0x234367[_0xd1dd('0x31')]=_[_0xd1dd('0x2f')](_0x2063e1[_0xd1dd('0x31')]);_0x234367[_0xd1dd('0x30')]=_['intersection'](_0x234367[_0xd1dd('0x2e')],_0x234367['query']);_0x395173[_0xd1dd('0x32')]=_[_0xd1dd('0x33')](_0x234367['model'],qs[_0xd1dd('0x34')](_0x2063e1['query'][_0xd1dd('0x34')]));_0x395173['attributes']=_0x395173['attributes'][_0xd1dd('0x35')]?_0x395173[_0xd1dd('0x32')]:_0x234367['model'];if(_0x2063e1[_0xd1dd('0x31')][_0xd1dd('0x40')]){_0x395173[_0xd1dd('0x41')]=[{'all':!![]}];}_0x395173=_['merge']({},_0x395173,_0x2063e1[_0xd1dd('0x3e')]);return db[_0xd1dd('0x3f')]['find'](_0x395173)[_0xd1dd('0x22')](handleEntityNotFound(_0x80acaf,null))['then'](respondWithResult(_0x80acaf,null))[_0xd1dd('0x43')](handleError(_0x80acaf,null));};exports[_0xd1dd('0x46')]=function(_0x33909a,_0x430b88){return db[_0xd1dd('0x3f')][_0xd1dd('0x46')](_0x33909a[_0xd1dd('0x47')],{})['then'](respondWithResult(_0x430b88,0xc9))[_0xd1dd('0x43')](handleError(_0x430b88,null));};exports[_0xd1dd('0x48')]=function(_0x23f7ab,_0x2b5b67){if(_0x23f7ab['body']['id']){delete _0x23f7ab['body']['id'];}return db[_0xd1dd('0x3f')][_0xd1dd('0x49')]({'where':{'id':_0x23f7ab[_0xd1dd('0x45')]['id']}})[_0xd1dd('0x22')](handleEntityNotFound(_0x2b5b67,null))['then'](saveUpdates(_0x23f7ab[_0xd1dd('0x47')],null))[_0xd1dd('0x22')](respondWithResult(_0x2b5b67,null))['catch'](handleError(_0x2b5b67,null));};exports[_0xd1dd('0x23')]=function(_0x2a2fcd,_0x3e296d){return db[_0xd1dd('0x3f')][_0xd1dd('0x49')]({'where':{'id':_0x2a2fcd[_0xd1dd('0x45')]['id']}})[_0xd1dd('0x22')](handleEntityNotFound(_0x3e296d,null))['then'](removeEntity(_0x3e296d,null))[_0xd1dd('0x43')](handleError(_0x3e296d,null));};exports[_0xd1dd('0x4a')]=function(_0x4cfdc8,_0x496c9a){return db[_0xd1dd('0x3f')][_0xd1dd('0x4a')]()[_0xd1dd('0x22')](respondWithResult(_0x496c9a,null))[_0xd1dd('0x43')](handleError(_0x496c9a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d14cff4..437b963 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 _0x7f57=['../../config/logger','api','moment','bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid'];(function(_0xe5b8f,_0x368331){var _0x4b6c0b=function(_0x3752e2){while(--_0x3752e2){_0xe5b8f['push'](_0xe5b8f['shift']());}};_0x4b6c0b(++_0x368331);}(_0x7f57,0x1f4));var _0x77f5=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x7f57[_0x31a371];return _0x2a5bd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x77f5('0x0'))(_0x77f5('0x1'));var moment=require(_0x77f5('0x2'));var BPromise=require(_0x77f5('0x3'));var rp=require(_0x77f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77f5('0x5'));module[_0x77f5('0x6')]=function(_0x2bd5e0,_0x18a9b2){return _0x2bd5e0[_0x77f5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x77f5('0x8'),'paranoid':![],'indexes':[{'name':_0x77f5('0x9'),'fields':[_0x77f5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1586=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1586,0x11f));var _0x6158=function(_0x5af1ce,_0x318f6e){_0x5af1ce=_0x5af1ce-0x0;var _0x4e7f4f=_0x1586[_0x5af1ce];return _0x4e7f4f;};'use strict';var _=require(_0x6158('0x0'));var util=require(_0x6158('0x1'));var logger=require(_0x6158('0x2'))('api');var moment=require(_0x6158('0x3'));var BPromise=require('bluebird');var rp=require(_0x6158('0x4'));var fs=require('fs');var path=require(_0x6158('0x5'));var rimraf=require(_0x6158('0x6'));var config=require(_0x6158('0x7'));var attributes=require(_0x6158('0x8'));module[_0x6158('0x9')]=function(_0x1313ce,_0x48c131){return _0x1313ce[_0x6158('0xa')](_0x6158('0xb'),attributes,{'tableName':_0x6158('0xc'),'paranoid':![],'indexes':[{'name':_0x6158('0xd'),'fields':[_0x6158('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8677078..e09ffac 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 _0x1a61=['error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x29f013,_0x2b13f3){var _0x5001bb=function(_0x4ddba5){while(--_0x4ddba5){_0x29f013['push'](_0x29f013['shift']());}};_0x5001bb(++_0x2b13f3);}(_0x1a61,0x1e6));var _0x11a6=function(_0x417cc4,_0x512e93){_0x417cc4=_0x417cc4-0x0;var _0x2dc1fa=_0x1a61[_0x417cc4];return _0x2dc1fa;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});} \ No newline at end of file +var _0x43fd=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x43fd,0x1ec));var _0xd43f=function(_0x296d02,_0x442044){_0x296d02=_0x296d02-0x0;var _0x36c9d5=_0x43fd[_0x296d02];return _0x36c9d5;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 49174e5..05f3230 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 _0xcd6e=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd6e,0x198));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecd6('0x0'));var util=require(_0xecd6('0x1'));var path=require(_0xecd6('0x2'));var timeout=require(_0xecd6('0x3'));var express=require(_0xecd6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xecd6('0x5'));var interaction=require(_0xecd6('0x6'));var config=require(_0xecd6('0x7'));var controller=require(_0xecd6('0x8'));router[_0xecd6('0x9')]('/',auth['isAuthenticated'](),controller[_0xecd6('0xa')]);router[_0xecd6('0x9')](_0xecd6('0xb'),auth[_0xecd6('0xc')](),controller[_0xecd6('0xd')]);router[_0xecd6('0xe')]('/',auth[_0xecd6('0xc')](),controller[_0xecd6('0xf')]);router[_0xecd6('0x10')](_0xecd6('0xb'),auth[_0xecd6('0xc')](),controller[_0xecd6('0x11')]);router[_0xecd6('0x12')](_0xecd6('0xb'),auth[_0xecd6('0xc')](),controller[_0xecd6('0x13')]);module[_0xecd6('0x14')]=router; \ No newline at end of file +var _0x91be=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller'];(function(_0x483134,_0x57de34){var _0x47518d=function(_0x5cc0bd){while(--_0x5cc0bd){_0x483134['push'](_0x483134['shift']());}};_0x47518d(++_0x57de34);}(_0x91be,0x107));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe91b('0x0'));var timeout=require('connect-timeout');var express=require(_0xe91b('0x1'));var router=express[_0xe91b('0x2')]();var fs_extra=require(_0xe91b('0x3'));var auth=require(_0xe91b('0x4'));var interaction=require(_0xe91b('0x5'));var config=require('../../config/environment');var controller=require(_0xe91b('0x6'));router['get']('/',auth[_0xe91b('0x7')](),controller[_0xe91b('0x8')]);router[_0xe91b('0x9')](_0xe91b('0xa'),auth['isAuthenticated'](),controller[_0xe91b('0xb')]);router[_0xe91b('0xc')]('/',auth['isAuthenticated'](),controller[_0xe91b('0xd')]);router[_0xe91b('0xe')](_0xe91b('0xa'),auth['isAuthenticated'](),controller[_0xe91b('0xf')]);router[_0xe91b('0x10')](_0xe91b('0xa'),auth[_0xe91b('0x7')](),controller['destroy']);module[_0xe91b('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9256fe2..13a5224 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 _0x9eca=['name','sequelize','exports','STRING'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x9eca,0x71));var _0xa9ec=function(_0x1e765a,_0x4a7c55){_0x1e765a=_0x1e765a-0x0;var _0x5bc8a1=_0x9eca[_0x1e765a];return _0x5bc8a1;};'use strict';var Sequelize=require(_0xa9ec('0x0'));module[_0xa9ec('0x1')]={'name':{'type':Sequelize[_0xa9ec('0x2')],'unique':_0xa9ec('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa9ec('0x2')]}}; \ No newline at end of file +var _0x41d9=['name','sequelize','STRING'];(function(_0x3ed122,_0x13eb5f){var _0x382bb1=function(_0x3d83c6){while(--_0x3d83c6){_0x3ed122['push'](_0x3ed122['shift']());}};_0x382bb1(++_0x13eb5f);}(_0x41d9,0xd6));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x941d('0x0'));module['exports']={'name':{'type':Sequelize[_0x941d('0x1')],'unique':_0x941d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x941d('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1031304..2db67de 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 _0xfa13=['rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Pause'];(function(_0x3d4d29,_0x338feb){var _0xe35858=function(_0x35e26e){while(--_0x35e26e){_0x3d4d29['push'](_0x3d4d29['shift']());}};_0xe35858(++_0x338feb);}(_0xfa13,0x11d));var _0x3fa1=function(_0x1942d2,_0x47da4c){_0x1942d2=_0x1942d2-0x0;var _0x19b039=_0xfa13[_0x1942d2];return _0x19b039;};'use strict';var emlformat=require(_0x3fa1('0x0'));var rimraf=require(_0x3fa1('0x1'));var zipdir=require(_0x3fa1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3fa1('0x3'));var BPromise=require(_0x3fa1('0x4'));var Mustache=require(_0x3fa1('0x5'));var util=require(_0x3fa1('0x6'));var path=require(_0x3fa1('0x7'));var sox=require('sox');var csv=require(_0x3fa1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fa1('0x9'));var _=require(_0x3fa1('0xa'));var squel=require(_0x3fa1('0xb'));var crypto=require('crypto');var jsforce=require(_0x3fa1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fa1('0xd'));var Redis=require(_0x3fa1('0xe'));var authService=require(_0x3fa1('0xf'));var qs=require(_0x3fa1('0x10'));var as=require(_0x3fa1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fa1('0x12'))(_0x3fa1('0x13'));var utils=require(_0x3fa1('0x14'));var config=require(_0x3fa1('0x15'));var licenseUtil=require(_0x3fa1('0x16'));var db=require(_0x3fa1('0x17'))['db'];function respondWithStatusCode(_0x1e4d81,_0x1115e9){_0x1115e9=_0x1115e9||0xcc;return function(_0x267d50){if(_0x267d50){return _0x1e4d81[_0x3fa1('0x18')](_0x1115e9);}return _0x1e4d81[_0x3fa1('0x19')](_0x1115e9)[_0x3fa1('0x1a')]();};}function respondWithResult(_0x11de7f,_0x391c79){_0x391c79=_0x391c79||0xc8;return function(_0x255694){if(_0x255694){return _0x11de7f['status'](_0x391c79)['json'](_0x255694);}};}function respondWithFilteredResult(_0x5d083b,_0x19057b){return function(_0x1fcf68){if(_0x1fcf68){var _0x412eb2=typeof _0x19057b['offset']===_0x3fa1('0x1b')&&typeof _0x19057b[_0x3fa1('0x1c')]===_0x3fa1('0x1b');var _0xc38657=_0x1fcf68[_0x3fa1('0x1d')];var _0x595646=_0x412eb2?0x0:_0x19057b[_0x3fa1('0x1e')];var _0xc94c1d=_0x412eb2?_0x1fcf68[_0x3fa1('0x1d')]:_0x19057b['offset']+_0x19057b[_0x3fa1('0x1c')];var _0x1d8750;if(_0xc94c1d>=_0xc38657){_0xc94c1d=_0xc38657;_0x1d8750=0xc8;}else{_0x1d8750=0xce;}_0x5d083b['status'](_0x1d8750);return _0x5d083b['set']('Content-Range',_0x595646+'-'+_0xc94c1d+'/'+_0xc38657)[_0x3fa1('0x1f')](_0x1fcf68);}return null;};}function patchUpdates(_0x2d3415){return function(_0x4d540d){try{jsonpatch[_0x3fa1('0x20')](_0x4d540d,_0x2d3415,!![]);}catch(_0x591e7f){return BPromise[_0x3fa1('0x21')](_0x591e7f);}return _0x4d540d[_0x3fa1('0x22')]();};}function saveUpdates(_0x1970c5,_0x5438e4){return function(_0x58c495){if(_0x58c495){return _0x58c495[_0x3fa1('0x23')](_0x1970c5)[_0x3fa1('0x24')](function(_0x516f78){return _0x516f78;});}return null;};}function removeEntity(_0x242e95,_0x43dfb1){return function(_0x189d37){if(_0x189d37){return _0x189d37[_0x3fa1('0x25')]()[_0x3fa1('0x24')](function(){var _0x34295b=_0x189d37[_0x3fa1('0x26')]({'plain':!![]});var _0xe9d38b='Pauses';return db[_0x3fa1('0x27')][_0x3fa1('0x25')]({'where':{'type':_0xe9d38b,'resourceId':_0x34295b['id']}})[_0x3fa1('0x24')](function(){return _0x189d37;});})['then'](function(){_0x242e95['status'](0xcc)[_0x3fa1('0x1a')]();});}};}function handleEntityNotFound(_0x21fc75,_0x42a6d0){return function(_0x552389){if(!_0x552389){_0x21fc75[_0x3fa1('0x18')](0x194);}return _0x552389;};}function handleError(_0x2b35a4,_0x3e1fee){_0x3e1fee=_0x3e1fee||0x1f4;return function(_0x3805d4){logger[_0x3fa1('0x28')](_0x3805d4[_0x3fa1('0x29')]);if(_0x3805d4['name']){delete _0x3805d4[_0x3fa1('0x2a')];}_0x2b35a4[_0x3fa1('0x19')](_0x3e1fee)[_0x3fa1('0x2b')](_0x3805d4);};}exports[_0x3fa1('0x2c')]=function(_0x5214b8,_0x18a400){var _0x4b76fd={},_0x500ea2={},_0x3b8390={'count':0x0,'rows':[]};var _0x54ca9f=_[_0x3fa1('0x2d')](db[_0x3fa1('0x2e')][_0x3fa1('0x2f')],function(_0x3e59d4){return{'name':_0x3e59d4[_0x3fa1('0x30')],'type':_0x3e59d4[_0x3fa1('0x31')][_0x3fa1('0x32')]};});_0x500ea2['model']=_[_0x3fa1('0x2d')](_0x54ca9f,_0x3fa1('0x2a'));_0x500ea2[_0x3fa1('0x33')]=_[_0x3fa1('0x34')](_0x5214b8['query']);_0x500ea2[_0x3fa1('0x35')]=_['intersection'](_0x500ea2[_0x3fa1('0x36')],_0x500ea2[_0x3fa1('0x33')]);_0x4b76fd[_0x3fa1('0x37')]=_[_0x3fa1('0x38')](_0x500ea2[_0x3fa1('0x36')],qs[_0x3fa1('0x39')](_0x5214b8[_0x3fa1('0x33')][_0x3fa1('0x39')]));_0x4b76fd[_0x3fa1('0x37')]=_0x4b76fd[_0x3fa1('0x37')][_0x3fa1('0x3a')]?_0x4b76fd[_0x3fa1('0x37')]:_0x500ea2[_0x3fa1('0x36')];if(!_0x5214b8[_0x3fa1('0x33')]['hasOwnProperty'](_0x3fa1('0x3b'))){_0x4b76fd['limit']=qs['limit'](_0x5214b8[_0x3fa1('0x33')][_0x3fa1('0x1c')]);_0x4b76fd[_0x3fa1('0x1e')]=qs['offset'](_0x5214b8['query'][_0x3fa1('0x1e')]);}_0x4b76fd[_0x3fa1('0x3c')]=qs['sort'](_0x5214b8[_0x3fa1('0x33')]['sort']);_0x4b76fd[_0x3fa1('0x3d')]=qs['filters'](_[_0x3fa1('0x3e')](_0x5214b8[_0x3fa1('0x33')],_0x500ea2['filters']),_0x54ca9f);if(_0x5214b8['query'][_0x3fa1('0x3f')]){_0x4b76fd[_0x3fa1('0x3d')]=_['merge'](_0x4b76fd['where'],{'$or':_[_0x3fa1('0x2d')](_0x54ca9f,function(_0x32a9e8){if(_0x32a9e8[_0x3fa1('0x31')]!==_0x3fa1('0x40')){var _0x3ea0e7={};_0x3ea0e7[_0x32a9e8[_0x3fa1('0x2a')]]={'$like':'%'+_0x5214b8['query'][_0x3fa1('0x3f')]+'%'};return _0x3ea0e7;}})});}_0x4b76fd=_['merge']({},_0x4b76fd,_0x5214b8[_0x3fa1('0x41')]);var _0x2f5c22={'where':_0x4b76fd[_0x3fa1('0x3d')]};return db['Pause'][_0x3fa1('0x1d')](_0x2f5c22)[_0x3fa1('0x24')](function(_0x4583c1){_0x3b8390[_0x3fa1('0x1d')]=_0x4583c1;if(_0x5214b8[_0x3fa1('0x33')][_0x3fa1('0x42')]){_0x4b76fd[_0x3fa1('0x43')]=[{'all':!![]}];}return db[_0x3fa1('0x2e')][_0x3fa1('0x44')](_0x4b76fd);})[_0x3fa1('0x24')](function(_0x36fac3){_0x3b8390[_0x3fa1('0x45')]=_0x36fac3;return _0x3b8390;})[_0x3fa1('0x24')](respondWithFilteredResult(_0x18a400,_0x4b76fd))[_0x3fa1('0x46')](handleError(_0x18a400,null));};exports[_0x3fa1('0x47')]=function(_0x56dbf3,_0x4640e0){var _0x5246e4={'raw':!![],'where':{'id':_0x56dbf3[_0x3fa1('0x48')]['id']}},_0x36fa09={};_0x36fa09[_0x3fa1('0x36')]=_[_0x3fa1('0x34')](db[_0x3fa1('0x2e')][_0x3fa1('0x2f')]);_0x36fa09['query']=_['keys'](_0x56dbf3['query']);_0x36fa09['filters']=_[_0x3fa1('0x38')](_0x36fa09['model'],_0x36fa09[_0x3fa1('0x33')]);_0x5246e4['attributes']=_[_0x3fa1('0x38')](_0x36fa09[_0x3fa1('0x36')],qs[_0x3fa1('0x39')](_0x56dbf3[_0x3fa1('0x33')][_0x3fa1('0x39')]));_0x5246e4[_0x3fa1('0x37')]=_0x5246e4['attributes']['length']?_0x5246e4[_0x3fa1('0x37')]:_0x36fa09['model'];if(_0x56dbf3[_0x3fa1('0x33')]['includeAll']){_0x5246e4[_0x3fa1('0x43')]=[{'all':!![]}];}_0x5246e4=_['merge']({},_0x5246e4,_0x56dbf3[_0x3fa1('0x41')]);return db['Pause'][_0x3fa1('0x49')](_0x5246e4)[_0x3fa1('0x24')](handleEntityNotFound(_0x4640e0,null))[_0x3fa1('0x24')](respondWithResult(_0x4640e0,null))['catch'](handleError(_0x4640e0,null));};exports[_0x3fa1('0x4a')]=function(_0x4d8a09,_0x301b66){return db['Pause'][_0x3fa1('0x4a')](_0x4d8a09[_0x3fa1('0x4b')],{})[_0x3fa1('0x24')](function(_0x2781bc){var _0x5b3c23=_0x4d8a09[_0x3fa1('0x4c')][_0x3fa1('0x26')]({'plain':!![]});if(!_0x5b3c23)throw new Error(_0x3fa1('0x4d'));if(_0x5b3c23[_0x3fa1('0x4e')]===_0x3fa1('0x4c')){var _0x47eb13=_0x2781bc[_0x3fa1('0x26')]({'plain':!![]});var _0x195419=_0x3fa1('0x4f');return db[_0x3fa1('0x50')][_0x3fa1('0x49')]({'where':{'name':_0x195419,'userProfileId':_0x5b3c23[_0x3fa1('0x51')]},'raw':!![]})[_0x3fa1('0x24')](function(_0x2858cb){if(_0x2858cb&&_0x2858cb['autoAssociation']===0x0){return db[_0x3fa1('0x27')][_0x3fa1('0x4a')]({'name':_0x47eb13[_0x3fa1('0x2a')],'resourceId':_0x47eb13['id'],'type':_0x2858cb[_0x3fa1('0x2a')],'sectionId':_0x2858cb['id']},{})[_0x3fa1('0x24')](function(){return _0x2781bc;});}else{return _0x2781bc;}})['catch'](function(_0x13a495){logger[_0x3fa1('0x28')](_0x3fa1('0x52'),_0x13a495);throw _0x13a495;});}return _0x2781bc;})['then'](respondWithResult(_0x301b66,0xc9))[_0x3fa1('0x46')](handleError(_0x301b66,null));};exports['update']=function(_0x4e9365,_0x1eafff){if(_0x4e9365[_0x3fa1('0x4b')]['id']){delete _0x4e9365['body']['id'];}return db['Pause']['find']({'where':{'id':_0x4e9365[_0x3fa1('0x48')]['id']}})['then'](handleEntityNotFound(_0x1eafff,null))[_0x3fa1('0x24')](saveUpdates(_0x4e9365['body'],null))[_0x3fa1('0x24')](respondWithResult(_0x1eafff,null))[_0x3fa1('0x46')](handleError(_0x1eafff,null));};exports['destroy']=function(_0x29aeac,_0xcfaf32){return db['Pause'][_0x3fa1('0x49')]({'where':{'id':_0x29aeac[_0x3fa1('0x48')]['id']}})['then'](handleEntityNotFound(_0xcfaf32,null))[_0x3fa1('0x24')](removeEntity(_0xcfaf32,null))[_0x3fa1('0x46')](handleError(_0xcfaf32,null));}; \ No newline at end of file +var _0x75a2=['../../config/utils','../../mysqldb','end','json','offset','limit','count','status','set','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','show','params','Pause','includeAll','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x75a2,0x12d));var _0x275a=function(_0x51541e,_0x451ab2){_0x51541e=_0x51541e-0x0;var _0xf33eb=_0x75a2[_0x51541e];return _0xf33eb;};'use strict';var emlformat=require(_0x275a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x275a('0x1'));var rp=require(_0x275a('0x2'));var moment=require(_0x275a('0x3'));var BPromise=require(_0x275a('0x4'));var Mustache=require('mustache');var util=require(_0x275a('0x5'));var path=require('path');var sox=require(_0x275a('0x6'));var csv=require(_0x275a('0x7'));var ejs=require(_0x275a('0x8'));var fs=require('fs');var fs_extra=require(_0x275a('0x9'));var _=require(_0x275a('0xa'));var squel=require(_0x275a('0xb'));var crypto=require(_0x275a('0xc'));var jsforce=require(_0x275a('0xd'));var deskjs=require(_0x275a('0xe'));var toCsv=require(_0x275a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x275a('0xf'));var authService=require(_0x275a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x275a('0x11'));var logger=require(_0x275a('0x12'))('api');var utils=require(_0x275a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x275a('0x14'))['db'];function respondWithStatusCode(_0x5bcc1f,_0x3a01d3){_0x3a01d3=_0x3a01d3||0xcc;return function(_0x25d443){if(_0x25d443){return _0x5bcc1f['sendStatus'](_0x3a01d3);}return _0x5bcc1f['status'](_0x3a01d3)[_0x275a('0x15')]();};}function respondWithResult(_0x13a71d,_0x1f229f){_0x1f229f=_0x1f229f||0xc8;return function(_0x458bde){if(_0x458bde){return _0x13a71d['status'](_0x1f229f)[_0x275a('0x16')](_0x458bde);}};}function respondWithFilteredResult(_0x85c011,_0x2f88f0){return function(_0x59cce9){if(_0x59cce9){var _0x4e952d=typeof _0x2f88f0[_0x275a('0x17')]==='undefined'&&typeof _0x2f88f0[_0x275a('0x18')]==='undefined';var _0x15a0eb=_0x59cce9[_0x275a('0x19')];var _0xc8035a=_0x4e952d?0x0:_0x2f88f0[_0x275a('0x17')];var _0x4a5a2c=_0x4e952d?_0x59cce9[_0x275a('0x19')]:_0x2f88f0[_0x275a('0x17')]+_0x2f88f0[_0x275a('0x18')];var _0x487d0a;if(_0x4a5a2c>=_0x15a0eb){_0x4a5a2c=_0x15a0eb;_0x487d0a=0xc8;}else{_0x487d0a=0xce;}_0x85c011[_0x275a('0x1a')](_0x487d0a);return _0x85c011[_0x275a('0x1b')]('Content-Range',_0xc8035a+'-'+_0x4a5a2c+'/'+_0x15a0eb)['json'](_0x59cce9);}return null;};}function patchUpdates(_0x259602){return function(_0x32ce75){try{jsonpatch[_0x275a('0x1c')](_0x32ce75,_0x259602,!![]);}catch(_0x297f9e){return BPromise[_0x275a('0x1d')](_0x297f9e);}return _0x32ce75[_0x275a('0x1e')]();};}function saveUpdates(_0x12d318,_0x598ec){return function(_0x1eb891){if(_0x1eb891){return _0x1eb891['update'](_0x12d318)[_0x275a('0x1f')](function(_0x501f88){return _0x501f88;});}return null;};}function removeEntity(_0x284a83,_0xa74a84){return function(_0xbfb33f){if(_0xbfb33f){return _0xbfb33f[_0x275a('0x20')]()['then'](function(){var _0x58520e=_0xbfb33f[_0x275a('0x21')]({'plain':!![]});var _0x74efb6='Pauses';return db[_0x275a('0x22')][_0x275a('0x20')]({'where':{'type':_0x74efb6,'resourceId':_0x58520e['id']}})[_0x275a('0x1f')](function(){return _0xbfb33f;});})[_0x275a('0x1f')](function(){_0x284a83[_0x275a('0x1a')](0xcc)[_0x275a('0x15')]();});}};}function handleEntityNotFound(_0x4c3f99,_0x3a27a7){return function(_0x32346f){if(!_0x32346f){_0x4c3f99[_0x275a('0x23')](0x194);}return _0x32346f;};}function handleError(_0x378fd3,_0x24e4a6){_0x24e4a6=_0x24e4a6||0x1f4;return function(_0x16ba5d){logger[_0x275a('0x24')](_0x16ba5d[_0x275a('0x25')]);if(_0x16ba5d[_0x275a('0x26')]){delete _0x16ba5d[_0x275a('0x26')];}_0x378fd3[_0x275a('0x1a')](_0x24e4a6)['send'](_0x16ba5d);};}exports['index']=function(_0x241d3f,_0x50806b){var _0x26a66f={},_0xed71a8={},_0x20583a={'count':0x0,'rows':[]};var _0x868eeb=_[_0x275a('0x27')](db['Pause'][_0x275a('0x28')],function(_0x1816fa){return{'name':_0x1816fa[_0x275a('0x29')],'type':_0x1816fa[_0x275a('0x2a')][_0x275a('0x2b')]};});_0xed71a8[_0x275a('0x2c')]=_[_0x275a('0x27')](_0x868eeb,_0x275a('0x26'));_0xed71a8[_0x275a('0x2d')]=_[_0x275a('0x2e')](_0x241d3f['query']);_0xed71a8['filters']=_[_0x275a('0x2f')](_0xed71a8['model'],_0xed71a8['query']);_0x26a66f['attributes']=_[_0x275a('0x2f')](_0xed71a8['model'],qs[_0x275a('0x30')](_0x241d3f[_0x275a('0x2d')]['fields']));_0x26a66f[_0x275a('0x31')]=_0x26a66f['attributes'][_0x275a('0x32')]?_0x26a66f[_0x275a('0x31')]:_0xed71a8['model'];if(!_0x241d3f[_0x275a('0x2d')][_0x275a('0x33')](_0x275a('0x34'))){_0x26a66f['limit']=qs['limit'](_0x241d3f[_0x275a('0x2d')][_0x275a('0x18')]);_0x26a66f[_0x275a('0x17')]=qs['offset'](_0x241d3f[_0x275a('0x2d')][_0x275a('0x17')]);}_0x26a66f[_0x275a('0x35')]=qs[_0x275a('0x36')](_0x241d3f[_0x275a('0x2d')][_0x275a('0x36')]);_0x26a66f[_0x275a('0x37')]=qs['filters'](_[_0x275a('0x38')](_0x241d3f[_0x275a('0x2d')],_0xed71a8[_0x275a('0x39')]),_0x868eeb);if(_0x241d3f[_0x275a('0x2d')][_0x275a('0x3a')]){_0x26a66f[_0x275a('0x37')]=_[_0x275a('0x3b')](_0x26a66f[_0x275a('0x37')],{'$or':_[_0x275a('0x27')](_0x868eeb,function(_0x5e7b0c){if(_0x5e7b0c[_0x275a('0x2a')]!==_0x275a('0x3c')){var _0x166d38={};_0x166d38[_0x5e7b0c['name']]={'$like':'%'+_0x241d3f[_0x275a('0x2d')][_0x275a('0x3a')]+'%'};return _0x166d38;}})});}_0x26a66f=_[_0x275a('0x3b')]({},_0x26a66f,_0x241d3f[_0x275a('0x3d')]);var _0x342625={'where':_0x26a66f['where']};return db['Pause'][_0x275a('0x19')](_0x342625)[_0x275a('0x1f')](function(_0x29053d){_0x20583a['count']=_0x29053d;if(_0x241d3f['query']['includeAll']){_0x26a66f['include']=[{'all':!![]}];}return db['Pause'][_0x275a('0x3e')](_0x26a66f);})['then'](function(_0x7a738f){_0x20583a[_0x275a('0x3f')]=_0x7a738f;return _0x20583a;})[_0x275a('0x1f')](respondWithFilteredResult(_0x50806b,_0x26a66f))['catch'](handleError(_0x50806b,null));};exports[_0x275a('0x40')]=function(_0x572128,_0x4ba2d0){var _0x47be40={'raw':!![],'where':{'id':_0x572128[_0x275a('0x41')]['id']}},_0x3fa510={};_0x3fa510[_0x275a('0x2c')]=_[_0x275a('0x2e')](db[_0x275a('0x42')]['rawAttributes']);_0x3fa510['query']=_[_0x275a('0x2e')](_0x572128[_0x275a('0x2d')]);_0x3fa510[_0x275a('0x39')]=_['intersection'](_0x3fa510['model'],_0x3fa510[_0x275a('0x2d')]);_0x47be40[_0x275a('0x31')]=_[_0x275a('0x2f')](_0x3fa510[_0x275a('0x2c')],qs[_0x275a('0x30')](_0x572128['query'][_0x275a('0x30')]));_0x47be40[_0x275a('0x31')]=_0x47be40[_0x275a('0x31')][_0x275a('0x32')]?_0x47be40[_0x275a('0x31')]:_0x3fa510['model'];if(_0x572128[_0x275a('0x2d')][_0x275a('0x43')]){_0x47be40[_0x275a('0x44')]=[{'all':!![]}];}_0x47be40=_[_0x275a('0x3b')]({},_0x47be40,_0x572128[_0x275a('0x3d')]);return db[_0x275a('0x42')][_0x275a('0x45')](_0x47be40)[_0x275a('0x1f')](handleEntityNotFound(_0x4ba2d0,null))[_0x275a('0x1f')](respondWithResult(_0x4ba2d0,null))[_0x275a('0x46')](handleError(_0x4ba2d0,null));};exports[_0x275a('0x47')]=function(_0x367f7b,_0x382238){return db[_0x275a('0x42')][_0x275a('0x47')](_0x367f7b['body'],{})[_0x275a('0x1f')](function(_0x3f88a4){var _0x3d2741=_0x367f7b['user']['get']({'plain':!![]});if(!_0x3d2741)throw new Error(_0x275a('0x48'));if(_0x3d2741[_0x275a('0x49')]==='user'){var _0x6b6803=_0x3f88a4[_0x275a('0x21')]({'plain':!![]});var _0x100fd1=_0x275a('0x4a');return db[_0x275a('0x4b')]['find']({'where':{'name':_0x100fd1,'userProfileId':_0x3d2741[_0x275a('0x4c')]},'raw':!![]})[_0x275a('0x1f')](function(_0xb2a8bb){if(_0xb2a8bb&&_0xb2a8bb[_0x275a('0x4d')]===0x0){return db[_0x275a('0x22')][_0x275a('0x47')]({'name':_0x6b6803[_0x275a('0x26')],'resourceId':_0x6b6803['id'],'type':_0xb2a8bb[_0x275a('0x26')],'sectionId':_0xb2a8bb['id']},{})['then'](function(){return _0x3f88a4;});}else{return _0x3f88a4;}})[_0x275a('0x46')](function(_0xfbd7da){logger[_0x275a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfbd7da);throw _0xfbd7da;});}return _0x3f88a4;})[_0x275a('0x1f')](respondWithResult(_0x382238,0xc9))[_0x275a('0x46')](handleError(_0x382238,null));};exports[_0x275a('0x4e')]=function(_0x54648c,_0xa66480){if(_0x54648c[_0x275a('0x4f')]['id']){delete _0x54648c[_0x275a('0x4f')]['id'];}return db[_0x275a('0x42')][_0x275a('0x45')]({'where':{'id':_0x54648c[_0x275a('0x41')]['id']}})['then'](handleEntityNotFound(_0xa66480,null))[_0x275a('0x1f')](saveUpdates(_0x54648c[_0x275a('0x4f')],null))[_0x275a('0x1f')](respondWithResult(_0xa66480,null))[_0x275a('0x46')](handleError(_0xa66480,null));};exports[_0x275a('0x20')]=function(_0x43a421,_0x2e1d){return db[_0x275a('0x42')]['find']({'where':{'id':_0x43a421[_0x275a('0x41')]['id']}})[_0x275a('0x1f')](handleEntityNotFound(_0x2e1d,null))[_0x275a('0x1f')](removeEntity(_0x2e1d,null))[_0x275a('0x46')](handleError(_0x2e1d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 379556f..123bc4e 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x46e9a0,_0x36c1a5){var _0x1fe009=function(_0x30541d){while(--_0x30541d){_0x46e9a0['push'](_0x46e9a0['shift']());}};_0x1fe009(++_0x36c1a5);}(_0x53ec,0x192));var _0xc53e=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x53ec[_0x408de5];return _0x2015a1;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x2fa8e3,_0x5b9f50){var _0x342140=function(_0x46f784){while(--_0x46f784){_0x2fa8e3['push'](_0x2fa8e3['shift']());}};_0x342140(++_0x5b9f50);}(_0x53ec,0x192));var _0xc53e=function(_0xeb94a4,_0x166c7b){_0xeb94a4=_0xeb94a4-0x0;var _0x5a9285=_0x53ec[_0xeb94a4];return _0x5a9285;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 19fc52b..a77dd8c 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 _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(_0x346149,_0x2bb5e7){var _0x4184d2=function(_0xb5a185){while(--_0xb5a185){_0x346149['push'](_0x346149['shift']());}};_0x4184d2(++_0x2bb5e7);}(_0x7a54,0x106));var _0x47a5=function(_0x4ec857,_0x7b8cb7){_0x4ec857=_0x4ec857-0x0;var _0x599e74=_0x7a54[_0x4ec857];return _0x599e74;};'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 +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(_0x3d6122,_0x5a7a5a){var _0x18c96a=function(_0x3b8c82){while(--_0x3b8c82){_0x3d6122['push'](_0x3d6122['shift']());}};_0x18c96a(++_0x5a7a5a);}(_0xb10b,0x12a));var _0xbb10=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0xb10b[_0xb0975b];return _0x320d30;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 4d52ca9..eda3cc7 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 _0xe107=['get','/webhook','webhookGet','show','isAuthenticated','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./plugin.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe107,0xb3));var _0x7e10=function(_0x4bf1a6,_0x322a4e){_0x4bf1a6=_0x4bf1a6-0x0;var _0x5e74bb=_0xe107[_0x4bf1a6];return _0x5e74bb;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),controller[_0x7e10('0x9')]);router[_0x7e10('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e10('0xa')]);router['get']('/:id/download',auth[_0x7e10('0xb')](),controller[_0x7e10('0xc')]);var upload=multer({'storage':multer[_0x7e10('0xd')]({'destination':function(_0x2bd58a,_0x256cb1,_0x52ba74){_0x52ba74(null,path[_0x7e10('0xe')](config['root'],_0x7e10('0xf')));},'filename':function(_0x2ca84c,_0x2f4d72,_0x5434dd){_0x2f4d72[_0x7e10('0x10')]=_0x2f4d72[_0x7e10('0x10')][_0x7e10('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5434dd(null,util[_0x7e10('0x12')](_0x7e10('0x13'),path[_0x7e10('0x14')](_0x2f4d72[_0x7e10('0x10')],path[_0x7e10('0x15')](_0x2f4d72['originalname'])),Date[_0x7e10('0x16')](),path[_0x7e10('0x15')](_0x2f4d72['originalname'])));}})});router['post']('/',upload[_0x7e10('0x17')]('file'),controller[_0x7e10('0x18')]);router[_0x7e10('0x19')](_0x7e10('0x8'),controller[_0x7e10('0x1a')]);router['put'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1c')]);router['delete'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1d')]);module[_0x7e10('0x1e')]=router; \ No newline at end of file +var _0x0e85=['put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x36732a,_0xa52741){var _0x253a34=function(_0x29b6f1){while(--_0x29b6f1){_0x36732a['push'](_0x36732a['shift']());}};_0x253a34(++_0xa52741);}(_0x0e85,0x7c));var _0x50e8=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x0e85[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xc')]);router['get'](_0x50e8('0xd'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xe')]);var upload=multer({'storage':multer[_0x50e8('0xf')]({'destination':function(_0x154b9e,_0x194a89,_0x45dc6f){_0x45dc6f(null,path[_0x50e8('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0xfc6bb9,_0x24d381,_0x508377){_0x24d381['originalname']=_0x24d381[_0x50e8('0x11')][_0x50e8('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x508377(null,util[_0x50e8('0x13')](_0x50e8('0x14'),path['basename'](_0x24d381[_0x50e8('0x11')],path[_0x50e8('0x15')](_0x24d381[_0x50e8('0x11')])),Date['now'](),path['extname'](_0x24d381[_0x50e8('0x11')])));}})});router[_0x50e8('0x16')]('/',upload[_0x50e8('0x17')](_0x50e8('0x18')),controller[_0x50e8('0x19')]);router[_0x50e8('0x16')]('/webhook',controller['webhookPost']);router[_0x50e8('0x1a')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x1b')]);router[_0x50e8('0x1c')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['delete']);module[_0x50e8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index cd672b8..465cf35 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 _0x6f55=['html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','sequelize','exports','ENUM'];(function(_0x2fbe31,_0x1af25c){var _0x2039c4=function(_0x454a77){while(--_0x454a77){_0x2fbe31['push'](_0x2fbe31['shift']());}};_0x2039c4(++_0x1af25c);}(_0x6f55,0x111));var _0x56f5=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x6f55[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x56f5('0x0'));module[_0x56f5('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x56f5('0x2')](_0x56f5('0x3'),_0x56f5('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x56f5('0x5')],'comment':_0x56f5('0x6')},'active':{'type':Sequelize[_0x56f5('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x56f5('0x8'),_0x56f5('0x9'),_0x56f5('0xa'),_0x56f5('0xb')),'defaultValue':_0x56f5('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x56f5('0x5')]},'adminUrl':{'type':Sequelize[_0x56f5('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x56f5('0x5')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2525=['agentOnly','never','always','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x332684,_0x4c5b5b){var _0x42c520=function(_0x443b9b){while(--_0x443b9b){_0x332684['push'](_0x332684['shift']());}};_0x42c520(++_0x4c5b5b);}(_0x2525,0x9f));var _0x5252=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2525[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0x5252('0x0'));module['exports']={'name':{'type':Sequelize[_0x5252('0x1')]},'type':{'type':Sequelize[_0x5252('0x2')](_0x5252('0x3'),_0x5252('0x4'))},'description':{'type':Sequelize[_0x5252('0x5')]},'version':{'type':Sequelize[_0x5252('0x5')]},'path':{'type':Sequelize[_0x5252('0x1')],'comment':_0x5252('0x6')},'active':{'type':Sequelize[_0x5252('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5252('0x2')](_0x5252('0x8'),_0x5252('0x9'),'always',_0x5252('0xa')),'defaultValue':_0x5252('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5252('0x1')]},'adminUrl':{'type':Sequelize[_0x5252('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5252('0x1')]},'scriptPath':{'type':Sequelize[_0x5252('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6262fa6..184447a 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 _0xe00a=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','root','format','%s.zip','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','basename','finalize','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Plugins','UserProfileResource','destroy','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe00a,0x6f));var _0xae00=function(_0x416688,_0x4e247b){_0x416688=_0x416688-0x0;var _0x43551f=_0xe00a[_0x416688];return _0x43551f;};'use strict';var emlformat=require(_0xae00('0x0'));var rimraf=require(_0xae00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae00('0x2'));var rp=require(_0xae00('0x3'));var moment=require(_0xae00('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae00('0x5'));var util=require(_0xae00('0x6'));var path=require(_0xae00('0x7'));var sox=require(_0xae00('0x8'));var csv=require(_0xae00('0x9'));var ejs=require(_0xae00('0xa'));var fs=require('fs');var fs_extra=require(_0xae00('0xb'));var _=require(_0xae00('0xc'));var squel=require(_0xae00('0xd'));var crypto=require(_0xae00('0xe'));var jsforce=require(_0xae00('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xae00('0x9'));var querystring=require(_0xae00('0x10'));var Papa=require(_0xae00('0x11'));var extract=require(_0xae00('0x12'));var rimraf=require(_0xae00('0x1'));var archiver=require(_0xae00('0x13'));var Redis=require('ioredis');var authService=require(_0xae00('0x14'));var qs=require(_0xae00('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae00('0x16'));var logger=require('../../config/logger')(_0xae00('0x17'));var utils=require(_0xae00('0x18'));var config=require(_0xae00('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xae00('0x1a')]=_[_0xae00('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae00('0x1c'))(new Redis(config[_0xae00('0x1a')]));require(_0xae00('0x1d'))[_0xae00('0x1e')](socket);function respondWithStatusCode(_0x5e2950,_0x2c2247){_0x2c2247=_0x2c2247||0xcc;return function(_0x12b210){if(_0x12b210){return _0x5e2950[_0xae00('0x1f')](_0x2c2247);}return _0x5e2950[_0xae00('0x20')](_0x2c2247)[_0xae00('0x21')]();};}function respondWithResult(_0x40cd88,_0x38d488){_0x38d488=_0x38d488||0xc8;return function(_0x19d497){if(_0x19d497){return _0x40cd88[_0xae00('0x20')](_0x38d488)[_0xae00('0x22')](_0x19d497);}};}function respondWithFilteredResult(_0x12eb84,_0x1fb235){return function(_0x4d0817){if(_0x4d0817){var _0x4e17f6=typeof _0x1fb235[_0xae00('0x23')]===_0xae00('0x24')&&typeof _0x1fb235[_0xae00('0x25')]===_0xae00('0x24');var _0x48aa30=_0x4d0817[_0xae00('0x26')];var _0x232803=_0x4e17f6?0x0:_0x1fb235[_0xae00('0x23')];var _0x4c6eba=_0x4e17f6?_0x4d0817[_0xae00('0x26')]:_0x1fb235[_0xae00('0x23')]+_0x1fb235[_0xae00('0x25')];var _0x132fcd;if(_0x4c6eba>=_0x48aa30){_0x4c6eba=_0x48aa30;_0x132fcd=0xc8;}else{_0x132fcd=0xce;}_0x12eb84['status'](_0x132fcd);return _0x12eb84[_0xae00('0x27')](_0xae00('0x28'),_0x232803+'-'+_0x4c6eba+'/'+_0x48aa30)['json'](_0x4d0817);}return null;};}function patchUpdates(_0x36b8cd){return function(_0x144e79){try{jsonpatch[_0xae00('0x29')](_0x144e79,_0x36b8cd,!![]);}catch(_0x49a858){return BPromise[_0xae00('0x2a')](_0x49a858);}return _0x144e79[_0xae00('0x2b')]();};}function saveUpdates(_0x4ba244,_0x42e4ef){return function(_0x2dce97){if(_0x2dce97){return _0x2dce97[_0xae00('0x2c')](_0x4ba244)[_0xae00('0x2d')](function(_0x3d6ee4){return _0x3d6ee4;});}return null;};}function removeEntity(_0x22febc,_0x5b7cd9){return function(_0x169c1b){if(_0x169c1b){return _0x169c1b['destroy']()[_0xae00('0x2d')](function(){var _0x1d56d5=_0x169c1b[_0xae00('0x2e')]({'plain':!![]});var _0x5f4aa1=_0xae00('0x2f');return db[_0xae00('0x30')][_0xae00('0x31')]({'where':{'type':_0x5f4aa1,'resourceId':_0x1d56d5['id']}})[_0xae00('0x2d')](function(){return _0x169c1b;});})[_0xae00('0x2d')](function(){_0x22febc['status'](0xcc)[_0xae00('0x21')]();});}};}function handleEntityNotFound(_0x5f4f4f,_0x4daa97){return function(_0x1f391a){if(!_0x1f391a){_0x5f4f4f[_0xae00('0x1f')](0x194);}return _0x1f391a;};}function handleError(_0x2b4df0,_0x46b9a1){_0x46b9a1=_0x46b9a1||0x1f4;return function(_0x4b6103){logger[_0xae00('0x32')](_0x4b6103['stack']);if(_0x4b6103['name']){delete _0x4b6103[_0xae00('0x33')];}_0x2b4df0[_0xae00('0x20')](_0x46b9a1)[_0xae00('0x34')](_0x4b6103);};}exports[_0xae00('0x35')]=function(_0x26b186,_0x12bf6e){var _0x5ac953={},_0x4164d0={},_0x473462={'count':0x0,'rows':[]};var _0x21ff52=_[_0xae00('0x36')](db[_0xae00('0x37')][_0xae00('0x38')],function(_0x3c1bf8){return{'name':_0x3c1bf8[_0xae00('0x39')],'type':_0x3c1bf8[_0xae00('0x3a')][_0xae00('0x3b')]};});_0x4164d0[_0xae00('0x3c')]=_[_0xae00('0x36')](_0x21ff52,_0xae00('0x33'));_0x4164d0['query']=_['keys'](_0x26b186[_0xae00('0x3d')]);_0x4164d0[_0xae00('0x3e')]=_[_0xae00('0x3f')](_0x4164d0['model'],_0x4164d0[_0xae00('0x3d')]);_0x5ac953[_0xae00('0x40')]=_['intersection'](_0x4164d0['model'],qs[_0xae00('0x41')](_0x26b186[_0xae00('0x3d')]['fields']));_0x5ac953[_0xae00('0x40')]=_0x5ac953[_0xae00('0x40')][_0xae00('0x42')]?_0x5ac953[_0xae00('0x40')]:_0x4164d0['model'];if(!_0x26b186['query']['hasOwnProperty'](_0xae00('0x43'))){_0x5ac953[_0xae00('0x25')]=qs['limit'](_0x26b186[_0xae00('0x3d')][_0xae00('0x25')]);_0x5ac953[_0xae00('0x23')]=qs[_0xae00('0x23')](_0x26b186['query']['offset']);}_0x5ac953[_0xae00('0x44')]=qs[_0xae00('0x45')](_0x26b186[_0xae00('0x3d')][_0xae00('0x45')]);_0x5ac953[_0xae00('0x46')]=qs['filters'](_[_0xae00('0x47')](_0x26b186[_0xae00('0x3d')],_0x4164d0[_0xae00('0x3e')]),_0x21ff52);if(_0x26b186['query'][_0xae00('0x48')]){_0x5ac953['where']=_[_0xae00('0x49')](_0x5ac953[_0xae00('0x46')],{'$or':_[_0xae00('0x36')](_0x21ff52,function(_0x36da99){if(_0x36da99[_0xae00('0x3a')]!=='VIRTUAL'){var _0x384307={};_0x384307[_0x36da99[_0xae00('0x33')]]={'$like':'%'+_0x26b186[_0xae00('0x3d')]['filter']+'%'};return _0x384307;}})});}_0x5ac953=_[_0xae00('0x49')]({},_0x5ac953,_0x26b186[_0xae00('0x4a')]);var _0xf97a72={'where':_0x5ac953[_0xae00('0x46')]};return db['Plugin'][_0xae00('0x26')](_0xf97a72)['then'](function(_0x5c5bfb){_0x473462[_0xae00('0x26')]=_0x5c5bfb;if(_0x26b186[_0xae00('0x3d')][_0xae00('0x4b')]){_0x5ac953['include']=[{'all':!![]}];}return db[_0xae00('0x37')][_0xae00('0x4c')](_0x5ac953);})[_0xae00('0x2d')](function(_0x32e5df){_0x473462[_0xae00('0x4d')]=_0x32e5df;return _0x473462;})[_0xae00('0x2d')](respondWithFilteredResult(_0x12bf6e,_0x5ac953))[_0xae00('0x4e')](handleError(_0x12bf6e,null));};exports[_0xae00('0x4f')]=function(_0x1c483f,_0x24fac1){var _0x10b82c={'raw':!![],'where':{'id':_0x1c483f[_0xae00('0x50')]['id']}},_0x505265={};_0x505265[_0xae00('0x3c')]=_[_0xae00('0x51')](db[_0xae00('0x37')][_0xae00('0x38')]);_0x505265[_0xae00('0x3d')]=_['keys'](_0x1c483f[_0xae00('0x3d')]);_0x505265[_0xae00('0x3e')]=_[_0xae00('0x3f')](_0x505265[_0xae00('0x3c')],_0x505265[_0xae00('0x3d')]);_0x10b82c[_0xae00('0x40')]=_[_0xae00('0x3f')](_0x505265['model'],qs['fields'](_0x1c483f['query']['fields']));_0x10b82c[_0xae00('0x40')]=_0x10b82c[_0xae00('0x40')][_0xae00('0x42')]?_0x10b82c[_0xae00('0x40')]:_0x505265[_0xae00('0x3c')];if(_0x1c483f[_0xae00('0x3d')][_0xae00('0x4b')]){_0x10b82c[_0xae00('0x52')]=[{'all':!![]}];}_0x10b82c=_['merge']({},_0x10b82c,_0x1c483f['options']);return db[_0xae00('0x37')][_0xae00('0x53')](_0x10b82c)['then'](handleEntityNotFound(_0x24fac1,null))['then'](respondWithResult(_0x24fac1,null))[_0xae00('0x4e')](handleError(_0x24fac1,null));};exports['download']=function(_0x47f307,_0x582c09,_0x3733a9){return db[_0xae00('0x37')]['find']({'where':{'id':_0x47f307[_0xae00('0x50')]['id']},'attributes':[_0xae00('0x33'),_0xae00('0x7')],'raw':!![]})[_0xae00('0x2d')](handleEntityNotFound(_0x582c09,null))[_0xae00('0x2d')](function(_0xc380b1){if(_0xc380b1){var _0x17e796=path['join'](config[_0xae00('0x54')],'server/files/plugins',util[_0xae00('0x55')](_0xae00('0x56'),path['basename'](_0xc380b1[_0xae00('0x7')])));var _0x2506ee=fs['createWriteStream'](_0x17e796);var _0x65a60e=archiver(_0xae00('0x57'),{'zlib':{'level':0x9}});_0x65a60e['on'](_0xae00('0x58'),function(_0x77a849){if(_0x77a849[_0xae00('0x59')]==='ENOENT'){logger[_0xae00('0x32')](_0x77a849);}else{throw new db[(_0xae00('0x5a'))][(_0xae00('0x5b'))](_0xae00('0x5c'));}});_0x65a60e['on'](_0xae00('0x32'),function(_0x45bde8){throw new db[(_0xae00('0x5a'))][(_0xae00('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x65a60e[_0xae00('0x5d')](_0x2506ee);_0x65a60e[_0xae00('0x5e')](_0xae00('0x5f'),{'cwd':path[_0xae00('0x60')](config[_0xae00('0x54')],_0xae00('0x61'),path[_0xae00('0x62')](_0xc380b1[_0xae00('0x7')])),'ignore':[path[_0xae00('0x60')](path['basename'](_0xc380b1['path']),_0xae00('0x63')),path[_0xae00('0x60')](path[_0xae00('0x64')](_0xc380b1[_0xae00('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xae00('0x65')]();_0x2506ee['on']('close',function(){if(!fs['existsSync'](_0x17e796)){throw new db[(_0xae00('0x5a'))][(_0xae00('0x5b'))](_0xae00('0x66'));}return _0x582c09[_0xae00('0x67')](_0x17e796,util[_0xae00('0x55')](_0xae00('0x56'),path[_0xae00('0x64')](_0xc380b1[_0xae00('0x7')])),function(_0x59f140){if(_0x59f140){throw new db['Sequelize'][(_0xae00('0x5b'))](_0xae00('0x68'));}fs[_0xae00('0x69')](_0x17e796);logger[_0xae00('0x6a')](_0xae00('0x6b'));logger[_0xae00('0x6a')](_0xae00('0x6c'));});});}return null;})[_0xae00('0x4e')](handleError(_0x582c09,null));};exports[_0xae00('0x6d')]=function(_0x4bbd8b,_0x4f752a,_0x4c464a){var _0x31e9fb=path['basename'](_0x4bbd8b[_0xae00('0x6e')][_0xae00('0x6f')],path[_0xae00('0x70')](_0x4bbd8b[_0xae00('0x6e')][_0xae00('0x6f')]));var _0x137f7f=path[_0xae00('0x60')](config['root'],_0xae00('0x61'),_0x4bbd8b[_0xae00('0x6e')][_0xae00('0x6f')]);var _0x70ae87=path[_0xae00('0x60')](config[_0xae00('0x54')],'server/files/plugins',_0x31e9fb);logger[_0xae00('0x6a')](_0xae00('0x71'),_0x137f7f);logger[_0xae00('0x6a')](_0xae00('0x72'),_0x70ae87);try{fs[_0xae00('0x73')](_0x137f7f,parseInt(_0xae00('0x74'),0x8));extract(_0x137f7f,{'dir':_0x70ae87},function(_0x1f924a){if(_0x1f924a){logger['error'](_0x1f924a);handleError(_0x1f924a,!![]);};var _0x18f7b4=fs['readdirSync'](_0x70ae87);if(_0x18f7b4[_0xae00('0x42')]>0x1){removeReferences(_0x137f7f,_0x70ae87);logger[_0xae00('0x32')](_0xae00('0x75'));return _0x4c464a(new Error(_0xae00('0x75')));}var _0x117dac=fs[_0xae00('0x76')](path[_0xae00('0x60')](_0x70ae87,_0x18f7b4[0x0]));if(_0x117dac[_0xae00('0x77')]()){removeReferences(_0x137f7f,_0x70ae87);logger['error'](_0xae00('0x75'));return _0x4c464a(new Error(_0xae00('0x75')));}if(_0x117dac[_0xae00('0x78')]()){var _0x2d5cc2=fs[_0xae00('0x79')](path[_0xae00('0x60')](_0x70ae87,_0x18f7b4[0x0]));if(_0x2d5cc2[_0xae00('0x42')]===0x0){removeReferences(_0x137f7f,_0x70ae87);logger[_0xae00('0x32')]('Invalid\x20plugin\x20structure');return _0x4c464a(new Error(_0xae00('0x75')));}var _0x451eb1=_0x2d5cc2['some'](function(_0x5dad98){return _0x5dad98===_0xae00('0x7a');});if(!_0x451eb1){return _0x4c464a(new Error('Plugin\x20manifest\x20missing'));}var _0x2c8b6e=fs[_0xae00('0x7b')](path[_0xae00('0x60')](_0x70ae87,_0x18f7b4[0x0],_0xae00('0x7a')));var _0x2bb9e1=JSON[_0xae00('0x7c')](_0x2c8b6e);if(_0xae00('0x24')==typeof _0x2bb9e1['name']){return _0x4c464a(new Error(_0xae00('0x7d')));}if(_0xae00('0x24')==typeof _0x2bb9e1[_0xae00('0x3a')]){return _0x4c464a(new Error(_0xae00('0x7e')));}if(_0xae00('0x24')==typeof _0x2bb9e1[_0xae00('0x7f')]){return _0x4c464a(new Error(_0xae00('0x80')));}if(_0xae00('0x24')==typeof _0x2bb9e1[_0xae00('0x81')]){return _0x4c464a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2bb9e1[_0xae00('0x3a')]===_0xae00('0x82')){if(_0xae00('0x24')==typeof _0x2bb9e1[_0xae00('0x81')]['views']){return _0x4c464a(new Error(_0xae00('0x83')));}if(_0xae00('0x24')==typeof _0x2bb9e1['parameters'][_0xae00('0x84')][_0xae00('0x85')]&&_0xae00('0x24')==typeof _0x2bb9e1['parameters'][_0xae00('0x84')][_0xae00('0x86')]){return _0x4c464a(new Error(_0xae00('0x87')));}}else if(_0x2bb9e1[_0xae00('0x3a')]===_0xae00('0x88')){if(_0xae00('0x24')==typeof _0x2bb9e1[_0xae00('0x81')][_0xae00('0x89')]){return _0x4c464a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x2bb9e1['parameters']['scriptPath']){return _0x4c464a(new Error(_0xae00('0x8a')));}}else{return _0x4c464a(new Error(_0xae00('0x8b')));}var _0x1673b1=_0x2bb9e1[_0xae00('0x33')];var _0x367a64=_0x2bb9e1['description'];var _0x47bacf=_0x2bb9e1['type'];var _0x26044c=_0x2bb9e1[_0xae00('0x8c')]?_0x2bb9e1[_0xae00('0x8c')]:_0xae00('0x8d');var _0x545ed8=_0x2bb9e1[_0xae00('0x8e')]?_0x2bb9e1['icon']:'icon-apps';var _0xbc5da0='';var _0x509f47='';var _0x54ebc1='';var _0x2ec463='';var _0x4af1cc=_0x2bb9e1[_0xae00('0x7f')];if(_0x47bacf==='html'){if(_0xae00('0x24')!=typeof _0x2bb9e1['parameters'][_0xae00('0x84')][_0xae00('0x85')]){var _0x53c21c=_0x2bb9e1[_0xae00('0x81')]['views'][_0xae00('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xae00('0x8f')](_0x53c21c)){_0xbc5da0=path['join'](_0xae00('0x90'),_0x31e9fb,_0x18f7b4[0x0],_0x53c21c);}else{_0xbc5da0=_0x53c21c;}}else{logger[_0xae00('0x6a')](_0xae00('0x91'));}if(_0xae00('0x24')!=typeof _0x2bb9e1['parameters'][_0xae00('0x84')][_0xae00('0x86')]){var _0x4ab255=_0x2bb9e1['parameters']['views'][_0xae00('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xae00('0x8f')](_0x4ab255)){_0x509f47=path[_0xae00('0x60')](_0xae00('0x90'),_0x31e9fb,_0x18f7b4[0x0],_0x4ab255);}else{_0x509f47=_0x4ab255;}}else{logger[_0xae00('0x6a')](_0xae00('0x92'));}}else if(_0x47bacf===_0xae00('0x88')){_0x54ebc1=_0x2bb9e1['parameters']['scriptName'];_0x2ec463=_0x2bb9e1[_0xae00('0x81')][_0xae00('0x93')];if(_0xae00('0x24')!=typeof _0x2bb9e1[_0xae00('0x81')][_0xae00('0x84')]){if(_0xae00('0x24')!=typeof _0x2bb9e1[_0xae00('0x81')]['views'][_0xae00('0x85')]){var _0x53c21c=_0x2bb9e1[_0xae00('0x81')][_0xae00('0x84')][_0xae00('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xae00('0x8f')](_0x53c21c)){_0xbc5da0=path[_0xae00('0x60')](_0xae00('0x90'),_0x31e9fb,_0x18f7b4[0x0],_0x53c21c);}else{_0xbc5da0=_0x53c21c;}}if(_0xae00('0x24')!=typeof _0x2bb9e1[_0xae00('0x81')]['views']['agent']){var _0x4ab255=_0x2bb9e1[_0xae00('0x81')][_0xae00('0x84')][_0xae00('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xae00('0x8f')](_0x4ab255)){_0x509f47=path[_0xae00('0x60')]('plugins',_0x31e9fb,_0x18f7b4[0x0],_0x4ab255);}else{_0x509f47=_0x4ab255;}}}}var _0x2341f4={'name':_0x1673b1,'description':_0x367a64,'path':path[_0xae00('0x60')](_0x31e9fb,_0x18f7b4[0x0]),'type':_0x47bacf,'sidebar':_0x26044c,'icon':_0x545ed8,'adminUrl':_0xbc5da0,'agentUrl':_0x509f47,'scriptName':_0x54ebc1,'scriptPath':_0x2ec463,'version':_0x4af1cc};removeReferences(_0x137f7f,null);return db[_0xae00('0x37')][_0xae00('0x94')](_0x2341f4)[_0xae00('0x2d')](function(_0x4895ec){var _0x127722={'role':_0x4bbd8b[_0xae00('0x95')][_0xae00('0x96')],'userProfileId':_0x4bbd8b[_0xae00('0x95')][_0xae00('0x97')]};if(!_0x127722)throw new Error(_0xae00('0x98'));if(_0x127722[_0xae00('0x96')]===_0xae00('0x99')){var _0x15608b=_0x4895ec['get']({'plain':!![]});return db['UserProfileSection'][_0xae00('0x53')]({'where':{'name':_0xae00('0x2f'),'userProfileId':_0x127722[_0xae00('0x97')]},'raw':!![]})[_0xae00('0x2d')](function(_0xeb6bb){if(_0xeb6bb&&_0xeb6bb[_0xae00('0x9a')]===0x0){return db['UserProfileResource']['create']({'name':_0x15608b['name'],'resourceId':_0x15608b['id'],'type':_0xeb6bb[_0xae00('0x33')],'sectionId':_0xeb6bb['id']},{})['then'](function(){return _0x4895ec;});}else{return _0x4895ec;}})[_0xae00('0x4e')](function(_0xfb0f7e){logger[_0xae00('0x32')](_0xae00('0x9b'),_0xfb0f7e);throw _0xfb0f7e;});}return _0x4895ec;})[_0xae00('0x2d')](respondWithResult(_0x4f752a,null))[_0xae00('0x4e')](handleError(_0x4f752a,null));}});}catch(_0x3419b3){_0x4f752a['status'](0x1f4)[_0xae00('0x34')](_0x3419b3);}};function removeReferences(_0x4c30df,_0x279843){try{if(_0x4c30df){fs['unlinkSync'](_0x4c30df);logger[_0xae00('0x6a')](_0xae00('0x9c'));}if(_0x279843){rimraf(_0x279843,function(){});logger[_0xae00('0x6a')](_0xae00('0x9d'));}}catch(_0x174e33){logger[_0xae00('0x32')](_0x174e33);}}exports[_0xae00('0x2c')]=function(_0x5099d8,_0x4aec0c,_0x1db335){return db[_0xae00('0x37')][_0xae00('0x53')]({'where':{'id':_0x5099d8[_0xae00('0x50')]['id']}})[_0xae00('0x2d')](handleEntityNotFound(_0x4aec0c,null))[_0xae00('0x2d')](saveUpdates(_0x5099d8[_0xae00('0x95')],null))[_0xae00('0x2d')](respondWithResult(_0x4aec0c,null))[_0xae00('0x4e')](handleError(_0x4aec0c,null));};exports[_0xae00('0x9e')]=function(_0x5d3a55,_0x799463,_0x53c07a){return db[_0xae00('0x37')][_0xae00('0x53')]({'where':{'id':_0x5d3a55[_0xae00('0x50')]['id']}})[_0xae00('0x2d')](function(_0x339384){if(_0x339384){return _0x339384[_0xae00('0x31')]();}})[_0xae00('0x2d')](function(_0x19f4d){rimraf(path[_0xae00('0x60')](config['root'],'server/files/plugins',path[_0xae00('0x62')](_0x19f4d['path'])),function(){});return _0x19f4d;})['then'](handleEntityNotFound(_0x799463,null))['then'](respondWithStatusCode(_0x799463,null))['catch'](handleError(_0x799463,null));};exports['webhookGet']=function(_0x2e7205,_0x2b404b,_0x7dad5b){return BPromise[_0xae00('0x9f')]()[_0xae00('0x2d')](function(){if(!_0x2e7205['query']['path']){throw new Error(_0xae00('0xa0'));}if(!_0x2e7205[_0xae00('0x3d')]['port']){throw new Error(_0xae00('0xa1'));}var _0x5938d5=_0x2e7205[_0xae00('0x3d')][_0xae00('0xa2')]?_0x2e7205[_0xae00('0x3d')][_0xae00('0xa2')]+':'+_0x2e7205[_0xae00('0x3d')][_0xae00('0xa3')]:_0xae00('0xa4')+_0x2e7205['query'][_0xae00('0xa3')];var _0x204f7b=_0x2e7205[_0xae00('0x3d')][_0xae00('0x22')]?_0x2e7205['query'][_0xae00('0x22')]:!![];var _0x445874=_0x2e7205[_0xae00('0x3d')][_0xae00('0xa5')]?_0x2e7205[_0xae00('0x3d')][_0xae00('0xa5')]:null;var _0x56ce28={'method':_0x2e7205[_0xae00('0xa6')],'uri':util[_0xae00('0x55')](_0xae00('0xa7'),_0x5938d5,_0x2e7205[_0xae00('0x3d')][_0xae00('0x7')]),'json':_0x204f7b,'resolveWithFullResponse':!![],'encoding':_0x445874,'qs':_0x2e7205[_0xae00('0x3d')]};if(_0x2e7205[_0xae00('0xa8')]){_0x56ce28[_0xae00('0xa8')]=_0x2e7205[_0xae00('0xa8')];if(_0x56ce28[_0xae00('0xa8')][_0xae00('0xa9')]){delete _0x56ce28[_0xae00('0xa8')][_0xae00('0xa9')];}}if(_0x56ce28[_0xae00('0xa8')][_0xae00('0xaa')]){delete _0x56ce28[_0xae00('0xa8')]['content-type'];}return rp(_0x56ce28);})[_0xae00('0x2d')](function(_0xad2e22){if(_0xad2e22){_0x2b404b[_0xae00('0x27')](_0xad2e22['headers']);logger[_0xae00('0x6a')](_0xad2e22['body']);if(_['endsWith'](_0x2e7205[_0xae00('0x3d')][_0xae00('0x7')],_0xae00('0x67'))&&_0xad2e22[_0xae00('0xab')]==0x1f4){return _0x2b404b[_0xae00('0x1f')](_0xad2e22['statusCode']);}else{return _0x2b404b[_0xae00('0x20')](_0xad2e22[_0xae00('0xab')])['send'](_0xad2e22[_0xae00('0x95')]);}}else{return _0x2b404b[_0xae00('0x1f')](0xc8);}})[_0xae00('0x4e')](handleError(_0x2b404b,null));};exports['webhookPost']=function(_0x155c1d,_0x3bbcae,_0x2a6618){return BPromise[_0xae00('0x9f')]()['then'](function(){if(!_0x155c1d[_0xae00('0x3d')][_0xae00('0x7')]){throw new Error(_0xae00('0xa0'));}if(!_0x155c1d[_0xae00('0x3d')]['port']){throw new Error(_0xae00('0xa1'));}var _0x144a64=_0x155c1d[_0xae00('0x3d')][_0xae00('0xa2')]?_0x155c1d[_0xae00('0x3d')][_0xae00('0xa2')]+':'+_0x155c1d[_0xae00('0x3d')][_0xae00('0xa3')]:_0xae00('0xa4')+_0x155c1d[_0xae00('0x3d')][_0xae00('0xa3')];var _0x79241f=_0x155c1d[_0xae00('0x3d')]['json']?_0x155c1d[_0xae00('0x3d')][_0xae00('0x22')]:!![];var _0x30bf72=_0x155c1d['query'][_0xae00('0xa5')]?_0x155c1d['query']['encoding']:null;var _0xa3eea7={'method':_0x155c1d[_0xae00('0xa6')],'uri':util[_0xae00('0x55')](_0xae00('0xa7'),_0x144a64,_0x155c1d[_0xae00('0x3d')]['path']),'json':_0x79241f,'resolveWithFullResponse':!![],'encoding':_0x30bf72,'body':_0x155c1d[_0xae00('0x95')]};if(_0x155c1d[_0xae00('0xa8')]){_0xa3eea7[_0xae00('0xa8')]=_0x155c1d['headers'];if(_0xa3eea7[_0xae00('0xa8')][_0xae00('0xa9')]){delete _0xa3eea7['headers'][_0xae00('0xa9')];}}if(_0xa3eea7[_0xae00('0xa8')][_0xae00('0xaa')]){delete _0xa3eea7['headers']['content-type'];}return rp(_0xa3eea7);})[_0xae00('0x2d')](function(_0x455f00){if(_0x455f00){_0x3bbcae[_0xae00('0x27')](_0x455f00[_0xae00('0xa8')]);logger[_0xae00('0x6a')](_0x455f00[_0xae00('0x95')]);return _0x3bbcae[_0xae00('0x20')](_0x455f00[_0xae00('0xab')])['send'](_0x455f00[_0xae00('0x95')]);}else{return _0x3bbcae[_0xae00('0x1f')](0xc8);}})[_0xae00('0x4e')](handleError(_0x3bbcae,null));}; \ No newline at end of file +var _0xd206=['limit','undefined','count','offset','apply','update','then','get','Plugins','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','Plugin','includeAll','include','findAll','rows','show','keys','find','catch','download','params','root','server/files/plugins','format','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','length','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','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','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json'];(function(_0x53d60d,_0x10347b){var _0x5d4e57=function(_0x2346a1){while(--_0x2346a1){_0x53d60d['push'](_0x53d60d['shift']());}};_0x5d4e57(++_0x10347b);}(_0xd206,0x86));var _0x6d20=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd206[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x6d20('0x0'));var rimraf=require(_0x6d20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d20('0x2'));var rp=require(_0x6d20('0x3'));var moment=require(_0x6d20('0x4'));var BPromise=require(_0x6d20('0x5'));var Mustache=require(_0x6d20('0x6'));var util=require('util');var path=require(_0x6d20('0x7'));var sox=require('sox');var csv=require(_0x6d20('0x8'));var ejs=require(_0x6d20('0x9'));var fs=require('fs');var fs_extra=require(_0x6d20('0xa'));var _=require(_0x6d20('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d20('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6d20('0xd'));var Papa=require(_0x6d20('0xe'));var extract=require(_0x6d20('0xf'));var rimraf=require(_0x6d20('0x1'));var archiver=require(_0x6d20('0x10'));var Redis=require('ioredis');var authService=require(_0x6d20('0x11'));var qs=require(_0x6d20('0x12'));var as=require(_0x6d20('0x13'));var hardwareService=require(_0x6d20('0x14'));var logger=require(_0x6d20('0x15'))(_0x6d20('0x16'));var utils=require(_0x6d20('0x17'));var config=require(_0x6d20('0x18'));var licenseUtil=require(_0x6d20('0x19'));var db=require('../../mysqldb')['db'];config[_0x6d20('0x1a')]=_[_0x6d20('0x1b')](config['redis'],{'host':_0x6d20('0x1c'),'port':0x18eb});var socket=require(_0x6d20('0x1d'))(new Redis(config[_0x6d20('0x1a')]));require(_0x6d20('0x1e'))[_0x6d20('0x1f')](socket);function respondWithStatusCode(_0x4de613,_0x28d67f){_0x28d67f=_0x28d67f||0xcc;return function(_0x3ed36d){if(_0x3ed36d){return _0x4de613['sendStatus'](_0x28d67f);}return _0x4de613[_0x6d20('0x20')](_0x28d67f)[_0x6d20('0x21')]();};}function respondWithResult(_0x3bac60,_0x53847a){_0x53847a=_0x53847a||0xc8;return function(_0x25db42){if(_0x25db42){return _0x3bac60[_0x6d20('0x20')](_0x53847a)[_0x6d20('0x22')](_0x25db42);}};}function respondWithFilteredResult(_0x3fe904,_0x15c952){return function(_0x4abb69){if(_0x4abb69){var _0x522403=typeof _0x15c952['offset']==='undefined'&&typeof _0x15c952[_0x6d20('0x23')]===_0x6d20('0x24');var _0x57e81f=_0x4abb69[_0x6d20('0x25')];var _0x1ce8aa=_0x522403?0x0:_0x15c952['offset'];var _0x56be31=_0x522403?_0x4abb69[_0x6d20('0x25')]:_0x15c952[_0x6d20('0x26')]+_0x15c952['limit'];var _0x45144d;if(_0x56be31>=_0x57e81f){_0x56be31=_0x57e81f;_0x45144d=0xc8;}else{_0x45144d=0xce;}_0x3fe904['status'](_0x45144d);return _0x3fe904['set']('Content-Range',_0x1ce8aa+'-'+_0x56be31+'/'+_0x57e81f)[_0x6d20('0x22')](_0x4abb69);}return null;};}function patchUpdates(_0xe71b0b){return function(_0x5e6325){try{jsonpatch[_0x6d20('0x27')](_0x5e6325,_0xe71b0b,!![]);}catch(_0x2a7448){return BPromise['reject'](_0x2a7448);}return _0x5e6325['save']();};}function saveUpdates(_0x757b63,_0x108a30){return function(_0x27db0a){if(_0x27db0a){return _0x27db0a[_0x6d20('0x28')](_0x757b63)['then'](function(_0x3998cf){return _0x3998cf;});}return null;};}function removeEntity(_0x2b2bd3,_0x56a30c){return function(_0x14d906){if(_0x14d906){return _0x14d906['destroy']()[_0x6d20('0x29')](function(){var _0x3df93f=_0x14d906[_0x6d20('0x2a')]({'plain':!![]});var _0x19aef2=_0x6d20('0x2b');return db['UserProfileResource'][_0x6d20('0x2c')]({'where':{'type':_0x19aef2,'resourceId':_0x3df93f['id']}})[_0x6d20('0x29')](function(){return _0x14d906;});})[_0x6d20('0x29')](function(){_0x2b2bd3[_0x6d20('0x20')](0xcc)[_0x6d20('0x21')]();});}};}function handleEntityNotFound(_0x24d326,_0x32172e){return function(_0x201b0d){if(!_0x201b0d){_0x24d326[_0x6d20('0x2d')](0x194);}return _0x201b0d;};}function handleError(_0x2cac4e,_0x3637fa){_0x3637fa=_0x3637fa||0x1f4;return function(_0x67587b){logger[_0x6d20('0x2e')](_0x67587b[_0x6d20('0x2f')]);if(_0x67587b['name']){delete _0x67587b[_0x6d20('0x30')];}_0x2cac4e[_0x6d20('0x20')](_0x3637fa)[_0x6d20('0x31')](_0x67587b);};}exports[_0x6d20('0x32')]=function(_0x1a094c,_0x31cc59){var _0x5182e2={},_0x134949={},_0x2c2cff={'count':0x0,'rows':[]};var _0x120c5c=_['map'](db['Plugin'][_0x6d20('0x33')],function(_0x387caa){return{'name':_0x387caa['fieldName'],'type':_0x387caa[_0x6d20('0x34')][_0x6d20('0x35')]};});_0x134949['model']=_[_0x6d20('0x36')](_0x120c5c,_0x6d20('0x30'));_0x134949[_0x6d20('0x37')]=_['keys'](_0x1a094c['query']);_0x134949[_0x6d20('0x38')]=_[_0x6d20('0x39')](_0x134949[_0x6d20('0x3a')],_0x134949[_0x6d20('0x37')]);_0x5182e2['attributes']=_['intersection'](_0x134949[_0x6d20('0x3a')],qs[_0x6d20('0x3b')](_0x1a094c[_0x6d20('0x37')][_0x6d20('0x3b')]));_0x5182e2[_0x6d20('0x3c')]=_0x5182e2[_0x6d20('0x3c')]['length']?_0x5182e2[_0x6d20('0x3c')]:_0x134949[_0x6d20('0x3a')];if(!_0x1a094c[_0x6d20('0x37')][_0x6d20('0x3d')]('nolimit')){_0x5182e2[_0x6d20('0x23')]=qs['limit'](_0x1a094c[_0x6d20('0x37')][_0x6d20('0x23')]);_0x5182e2[_0x6d20('0x26')]=qs[_0x6d20('0x26')](_0x1a094c[_0x6d20('0x37')][_0x6d20('0x26')]);}_0x5182e2[_0x6d20('0x3e')]=qs[_0x6d20('0x3f')](_0x1a094c[_0x6d20('0x37')][_0x6d20('0x3f')]);_0x5182e2[_0x6d20('0x40')]=qs['filters'](_[_0x6d20('0x41')](_0x1a094c['query'],_0x134949[_0x6d20('0x38')]),_0x120c5c);if(_0x1a094c[_0x6d20('0x37')][_0x6d20('0x42')]){_0x5182e2['where']=_['merge'](_0x5182e2[_0x6d20('0x40')],{'$or':_[_0x6d20('0x36')](_0x120c5c,function(_0x1a5d0a){if(_0x1a5d0a[_0x6d20('0x34')]!=='VIRTUAL'){var _0x530ca8={};_0x530ca8[_0x1a5d0a['name']]={'$like':'%'+_0x1a094c[_0x6d20('0x37')][_0x6d20('0x42')]+'%'};return _0x530ca8;}})});}_0x5182e2=_[_0x6d20('0x43')]({},_0x5182e2,_0x1a094c[_0x6d20('0x44')]);var _0x85159f={'where':_0x5182e2[_0x6d20('0x40')]};return db[_0x6d20('0x45')][_0x6d20('0x25')](_0x85159f)[_0x6d20('0x29')](function(_0x20de4a){_0x2c2cff[_0x6d20('0x25')]=_0x20de4a;if(_0x1a094c[_0x6d20('0x37')][_0x6d20('0x46')]){_0x5182e2[_0x6d20('0x47')]=[{'all':!![]}];}return db[_0x6d20('0x45')][_0x6d20('0x48')](_0x5182e2);})[_0x6d20('0x29')](function(_0x15cecb){_0x2c2cff[_0x6d20('0x49')]=_0x15cecb;return _0x2c2cff;})[_0x6d20('0x29')](respondWithFilteredResult(_0x31cc59,_0x5182e2))['catch'](handleError(_0x31cc59,null));};exports[_0x6d20('0x4a')]=function(_0x45fe3b,_0x2ad325){var _0x56841f={'raw':!![],'where':{'id':_0x45fe3b['params']['id']}},_0x47b4cd={};_0x47b4cd[_0x6d20('0x3a')]=_['keys'](db['Plugin']['rawAttributes']);_0x47b4cd[_0x6d20('0x37')]=_[_0x6d20('0x4b')](_0x45fe3b[_0x6d20('0x37')]);_0x47b4cd['filters']=_[_0x6d20('0x39')](_0x47b4cd['model'],_0x47b4cd[_0x6d20('0x37')]);_0x56841f[_0x6d20('0x3c')]=_['intersection'](_0x47b4cd[_0x6d20('0x3a')],qs[_0x6d20('0x3b')](_0x45fe3b[_0x6d20('0x37')][_0x6d20('0x3b')]));_0x56841f['attributes']=_0x56841f[_0x6d20('0x3c')]['length']?_0x56841f['attributes']:_0x47b4cd[_0x6d20('0x3a')];if(_0x45fe3b[_0x6d20('0x37')][_0x6d20('0x46')]){_0x56841f[_0x6d20('0x47')]=[{'all':!![]}];}_0x56841f=_[_0x6d20('0x43')]({},_0x56841f,_0x45fe3b['options']);return db[_0x6d20('0x45')][_0x6d20('0x4c')](_0x56841f)[_0x6d20('0x29')](handleEntityNotFound(_0x2ad325,null))[_0x6d20('0x29')](respondWithResult(_0x2ad325,null))[_0x6d20('0x4d')](handleError(_0x2ad325,null));};exports[_0x6d20('0x4e')]=function(_0x575aa5,_0x46967e,_0x5ec594){return db[_0x6d20('0x45')][_0x6d20('0x4c')]({'where':{'id':_0x575aa5[_0x6d20('0x4f')]['id']},'attributes':[_0x6d20('0x30'),_0x6d20('0x7')],'raw':!![]})[_0x6d20('0x29')](handleEntityNotFound(_0x46967e,null))['then'](function(_0x52690f){if(_0x52690f){var _0x4ae694=path['join'](config[_0x6d20('0x50')],_0x6d20('0x51'),util[_0x6d20('0x52')]('%s.zip',path['basename'](_0x52690f[_0x6d20('0x7')])));var _0x2b286e=fs['createWriteStream'](_0x4ae694);var _0x20574f=archiver(_0x6d20('0x53'),{'zlib':{'level':0x9}});_0x20574f['on']('warning',function(_0x353f89){if(_0x353f89[_0x6d20('0x54')]===_0x6d20('0x55')){logger[_0x6d20('0x2e')](_0x353f89);}else{throw new db[(_0x6d20('0x56'))][(_0x6d20('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x20574f['on'](_0x6d20('0x2e'),function(_0x37b6a8){throw new db['Sequelize'][(_0x6d20('0x57'))](_0x6d20('0x58'));});_0x20574f['pipe'](_0x2b286e);_0x20574f[_0x6d20('0x59')](_0x6d20('0x5a'),{'cwd':path[_0x6d20('0x5b')](config['root'],_0x6d20('0x51'),path[_0x6d20('0x5c')](_0x52690f[_0x6d20('0x7')])),'ignore':[path[_0x6d20('0x5b')](path[_0x6d20('0x5d')](_0x52690f['path']),'node_modules/**/*'),path[_0x6d20('0x5b')](path['basename'](_0x52690f[_0x6d20('0x7')]),_0x6d20('0x5e'))],'nodir':!![]})[_0x6d20('0x5f')]();_0x2b286e['on'](_0x6d20('0x60'),function(){if(!fs[_0x6d20('0x61')](_0x4ae694)){throw new db[(_0x6d20('0x56'))]['Error'](_0x6d20('0x62'));}return _0x46967e[_0x6d20('0x4e')](_0x4ae694,util[_0x6d20('0x52')]('%s.zip',path[_0x6d20('0x5d')](_0x52690f['path'])),function(_0xc9ed20){if(_0xc9ed20){throw new db[(_0x6d20('0x56'))][(_0x6d20('0x57'))](_0x6d20('0x63'));}fs[_0x6d20('0x64')](_0x4ae694);logger[_0x6d20('0x65')](_0x6d20('0x66'));logger[_0x6d20('0x65')](_0x6d20('0x67'));});});}return null;})[_0x6d20('0x4d')](handleError(_0x46967e,null));};exports[_0x6d20('0x68')]=function(_0x552674,_0xb4e52b,_0x1aa8d1){var _0xa6d249=path[_0x6d20('0x5d')](_0x552674[_0x6d20('0x69')][_0x6d20('0x6a')],path[_0x6d20('0x6b')](_0x552674[_0x6d20('0x69')][_0x6d20('0x6a')]));var _0x20e6e8=path[_0x6d20('0x5b')](config[_0x6d20('0x50')],_0x6d20('0x51'),_0x552674[_0x6d20('0x69')][_0x6d20('0x6a')]);var _0x1e0ab0=path[_0x6d20('0x5b')](config[_0x6d20('0x50')],'server/files/plugins',_0xa6d249);logger[_0x6d20('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x20e6e8);logger['info'](_0x6d20('0x6c'),_0x1e0ab0);try{fs['chmodSync'](_0x20e6e8,parseInt('0777',0x8));extract(_0x20e6e8,{'dir':_0x1e0ab0},function(_0x596869){if(_0x596869){logger[_0x6d20('0x2e')](_0x596869);handleError(_0x596869,!![]);};var _0x121cc0=fs[_0x6d20('0x6d')](_0x1e0ab0);if(_0x121cc0['length']>0x1){removeReferences(_0x20e6e8,_0x1e0ab0);logger[_0x6d20('0x2e')](_0x6d20('0x6e'));return _0x1aa8d1(new Error('Invalid\x20plugin\x20structure'));}var _0x1ec455=fs[_0x6d20('0x6f')](path[_0x6d20('0x5b')](_0x1e0ab0,_0x121cc0[0x0]));if(_0x1ec455['isFile']()){removeReferences(_0x20e6e8,_0x1e0ab0);logger[_0x6d20('0x2e')](_0x6d20('0x6e'));return _0x1aa8d1(new Error(_0x6d20('0x6e')));}if(_0x1ec455[_0x6d20('0x70')]()){var _0x20bd66=fs[_0x6d20('0x6d')](path[_0x6d20('0x5b')](_0x1e0ab0,_0x121cc0[0x0]));if(_0x20bd66[_0x6d20('0x71')]===0x0){removeReferences(_0x20e6e8,_0x1e0ab0);logger[_0x6d20('0x2e')]('Invalid\x20plugin\x20structure');return _0x1aa8d1(new Error(_0x6d20('0x6e')));}var _0x4cba17=_0x20bd66[_0x6d20('0x72')](function(_0x1dd814){return _0x1dd814===_0x6d20('0x73');});if(!_0x4cba17){return _0x1aa8d1(new Error('Plugin\x20manifest\x20missing'));}var _0x4a99a9=fs[_0x6d20('0x74')](path[_0x6d20('0x5b')](_0x1e0ab0,_0x121cc0[0x0],'manifest.json'));var _0x5bbc23=JSON['parse'](_0x4a99a9);if('undefined'==typeof _0x5bbc23[_0x6d20('0x30')]){return _0x1aa8d1(new Error(_0x6d20('0x75')));}if(_0x6d20('0x24')==typeof _0x5bbc23[_0x6d20('0x34')]){return _0x1aa8d1(new Error(_0x6d20('0x76')));}if('undefined'==typeof _0x5bbc23['version']){return _0x1aa8d1(new Error(_0x6d20('0x77')));}if(_0x6d20('0x24')==typeof _0x5bbc23[_0x6d20('0x78')]){return _0x1aa8d1(new Error(_0x6d20('0x79')));}if(_0x5bbc23[_0x6d20('0x34')]==='html'){if(_0x6d20('0x24')==typeof _0x5bbc23['parameters'][_0x6d20('0x7a')]){return _0x1aa8d1(new Error(_0x6d20('0x7b')));}if('undefined'==typeof _0x5bbc23['parameters']['views']['admin']&&_0x6d20('0x24')==typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')][_0x6d20('0x7c')]){return _0x1aa8d1(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5bbc23[_0x6d20('0x34')]===_0x6d20('0x7d')){if(_0x6d20('0x24')==typeof _0x5bbc23['parameters'][_0x6d20('0x7e')]){return _0x1aa8d1(new Error(_0x6d20('0x7f')));}if(_0x6d20('0x24')==typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x80')]){return _0x1aa8d1(new Error(_0x6d20('0x81')));}}else{return _0x1aa8d1(new Error(_0x6d20('0x82')));}var _0x12298c=_0x5bbc23['name'];var _0x6bf358=_0x5bbc23[_0x6d20('0x83')];var _0x29e2d4=_0x5bbc23[_0x6d20('0x34')];var _0x59af92=_0x5bbc23['sidebar']?_0x5bbc23[_0x6d20('0x84')]:_0x6d20('0x85');var _0x5bab79=_0x5bbc23[_0x6d20('0x86')]?_0x5bbc23[_0x6d20('0x86')]:_0x6d20('0x87');var _0x179860='';var _0x2daa40='';var _0x449630='';var _0x585adc='';var _0x4e1e11=_0x5bbc23[_0x6d20('0x88')];if(_0x29e2d4==='html'){if(_0x6d20('0x24')!=typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')]['admin']){var _0x575089=_0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')][_0x6d20('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x575089)){_0x179860=path[_0x6d20('0x5b')](_0x6d20('0x8a'),_0xa6d249,_0x121cc0[0x0],_0x575089);}else{_0x179860=_0x575089;}}else{logger[_0x6d20('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x6d20('0x24')!=typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')]['agent']){var _0x37db8d=_0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')][_0x6d20('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x6d20('0x8b')](_0x37db8d)){_0x2daa40=path[_0x6d20('0x5b')](_0x6d20('0x8a'),_0xa6d249,_0x121cc0[0x0],_0x37db8d);}else{_0x2daa40=_0x37db8d;}}else{logger[_0x6d20('0x65')](_0x6d20('0x8c'));}}else if(_0x29e2d4==='script'){_0x449630=_0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7e')];_0x585adc=_0x5bbc23[_0x6d20('0x78')][_0x6d20('0x80')];if(_0x6d20('0x24')!=typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')]){if(_0x6d20('0x24')!=typeof _0x5bbc23[_0x6d20('0x78')]['views'][_0x6d20('0x89')]){var _0x575089=_0x5bbc23[_0x6d20('0x78')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x575089)){_0x179860=path[_0x6d20('0x5b')]('plugins',_0xa6d249,_0x121cc0[0x0],_0x575089);}else{_0x179860=_0x575089;}}if(_0x6d20('0x24')!=typeof _0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')][_0x6d20('0x7c')]){var _0x37db8d=_0x5bbc23[_0x6d20('0x78')][_0x6d20('0x7a')][_0x6d20('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x6d20('0x8b')](_0x37db8d)){_0x2daa40=path[_0x6d20('0x5b')]('plugins',_0xa6d249,_0x121cc0[0x0],_0x37db8d);}else{_0x2daa40=_0x37db8d;}}}}var _0x56a162={'name':_0x12298c,'description':_0x6bf358,'path':path[_0x6d20('0x5b')](_0xa6d249,_0x121cc0[0x0]),'type':_0x29e2d4,'sidebar':_0x59af92,'icon':_0x5bab79,'adminUrl':_0x179860,'agentUrl':_0x2daa40,'scriptName':_0x449630,'scriptPath':_0x585adc,'version':_0x4e1e11};removeReferences(_0x20e6e8,null);return db[_0x6d20('0x45')][_0x6d20('0x8d')](_0x56a162)['then'](function(_0x5b60ec){var _0x49185f={'role':_0x552674[_0x6d20('0x8e')]['role'],'userProfileId':_0x552674[_0x6d20('0x8e')]['userProfileId']};if(!_0x49185f)throw new Error(_0x6d20('0x8f'));if(_0x49185f[_0x6d20('0x90')]===_0x6d20('0x91')){var _0x12152e=_0x5b60ec[_0x6d20('0x2a')]({'plain':!![]});return db[_0x6d20('0x92')]['find']({'where':{'name':_0x6d20('0x2b'),'userProfileId':_0x49185f['userProfileId']},'raw':!![]})[_0x6d20('0x29')](function(_0x52ddc7){if(_0x52ddc7&&_0x52ddc7['autoAssociation']===0x0){return db[_0x6d20('0x93')]['create']({'name':_0x12152e[_0x6d20('0x30')],'resourceId':_0x12152e['id'],'type':_0x52ddc7[_0x6d20('0x30')],'sectionId':_0x52ddc7['id']},{})['then'](function(){return _0x5b60ec;});}else{return _0x5b60ec;}})[_0x6d20('0x4d')](function(_0x2dd49a){logger[_0x6d20('0x2e')](_0x6d20('0x94'),_0x2dd49a);throw _0x2dd49a;});}return _0x5b60ec;})[_0x6d20('0x29')](respondWithResult(_0xb4e52b,null))[_0x6d20('0x4d')](handleError(_0xb4e52b,null));}});}catch(_0x336618){_0xb4e52b[_0x6d20('0x20')](0x1f4)[_0x6d20('0x31')](_0x336618);}};function removeReferences(_0x3ae21f,_0x1ce5cc){try{if(_0x3ae21f){fs[_0x6d20('0x64')](_0x3ae21f);logger[_0x6d20('0x65')](_0x6d20('0x95'));}if(_0x1ce5cc){rimraf(_0x1ce5cc,function(){});logger['info'](_0x6d20('0x96'));}}catch(_0x306d47){logger['error'](_0x306d47);}}exports[_0x6d20('0x28')]=function(_0xca33ce,_0x588bd9,_0x4cd57d){return db[_0x6d20('0x45')]['find']({'where':{'id':_0xca33ce[_0x6d20('0x4f')]['id']}})['then'](handleEntityNotFound(_0x588bd9,null))['then'](saveUpdates(_0xca33ce[_0x6d20('0x8e')],null))[_0x6d20('0x29')](respondWithResult(_0x588bd9,null))[_0x6d20('0x4d')](handleError(_0x588bd9,null));};exports[_0x6d20('0x97')]=function(_0xf5e76,_0x4d2c4e,_0x44942e){return db[_0x6d20('0x45')][_0x6d20('0x4c')]({'where':{'id':_0xf5e76[_0x6d20('0x4f')]['id']}})[_0x6d20('0x29')](function(_0x994173){if(_0x994173){return _0x994173[_0x6d20('0x2c')]();}})[_0x6d20('0x29')](function(_0x177508){rimraf(path[_0x6d20('0x5b')](config[_0x6d20('0x50')],'server/files/plugins',path[_0x6d20('0x5c')](_0x177508[_0x6d20('0x7')])),function(){});return _0x177508;})['then'](handleEntityNotFound(_0x4d2c4e,null))[_0x6d20('0x29')](respondWithStatusCode(_0x4d2c4e,null))['catch'](handleError(_0x4d2c4e,null));};exports[_0x6d20('0x98')]=function(_0x3621b3,_0x567782,_0x8003c3){return BPromise[_0x6d20('0x99')]()[_0x6d20('0x29')](function(){if(!_0x3621b3[_0x6d20('0x37')][_0x6d20('0x7')]){throw new Error(_0x6d20('0x9a'));}if(!_0x3621b3['query'][_0x6d20('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5d9e1d=_0x3621b3['query'][_0x6d20('0x9c')]?_0x3621b3['query'][_0x6d20('0x9c')]+':'+_0x3621b3['query'][_0x6d20('0x9b')]:_0x6d20('0x9d')+_0x3621b3[_0x6d20('0x37')][_0x6d20('0x9b')];var _0x33627c=_0x3621b3[_0x6d20('0x37')][_0x6d20('0x22')]?_0x3621b3[_0x6d20('0x37')][_0x6d20('0x22')]:!![];var _0x5220a8=_0x3621b3[_0x6d20('0x37')][_0x6d20('0x9e')]?_0x3621b3[_0x6d20('0x37')][_0x6d20('0x9e')]:null;var _0xb81268={'method':_0x3621b3['method'],'uri':util[_0x6d20('0x52')](_0x6d20('0x9f'),_0x5d9e1d,_0x3621b3[_0x6d20('0x37')][_0x6d20('0x7')]),'json':_0x33627c,'resolveWithFullResponse':!![],'encoding':_0x5220a8,'qs':_0x3621b3[_0x6d20('0x37')]};if(_0x3621b3[_0x6d20('0xa0')]){_0xb81268[_0x6d20('0xa0')]=_0x3621b3[_0x6d20('0xa0')];if(_0xb81268[_0x6d20('0xa0')][_0x6d20('0xa1')]){delete _0xb81268[_0x6d20('0xa0')][_0x6d20('0xa1')];}}if(_0xb81268[_0x6d20('0xa0')][_0x6d20('0xa2')]){delete _0xb81268[_0x6d20('0xa0')]['content-type'];}return rp(_0xb81268);})[_0x6d20('0x29')](function(_0x4ca796){if(_0x4ca796){_0x567782[_0x6d20('0xa3')](_0x4ca796['headers']);logger[_0x6d20('0x65')](_0x4ca796['body']);if(_[_0x6d20('0xa4')](_0x3621b3[_0x6d20('0x37')][_0x6d20('0x7')],_0x6d20('0x4e'))&&_0x4ca796['statusCode']==0x1f4){return _0x567782[_0x6d20('0x2d')](_0x4ca796['statusCode']);}else{return _0x567782[_0x6d20('0x20')](_0x4ca796[_0x6d20('0xa5')])[_0x6d20('0x31')](_0x4ca796[_0x6d20('0x8e')]);}}else{return _0x567782[_0x6d20('0x2d')](0xc8);}})['catch'](handleError(_0x567782,null));};exports[_0x6d20('0xa6')]=function(_0x3f693a,_0x211c63,_0x44e6f9){return BPromise[_0x6d20('0x99')]()[_0x6d20('0x29')](function(){if(!_0x3f693a[_0x6d20('0x37')][_0x6d20('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3f693a[_0x6d20('0x37')]['port']){throw new Error(_0x6d20('0xa7'));}var _0x5b77a6=_0x3f693a['query'][_0x6d20('0x9c')]?_0x3f693a['query'][_0x6d20('0x9c')]+':'+_0x3f693a[_0x6d20('0x37')][_0x6d20('0x9b')]:_0x6d20('0x9d')+_0x3f693a['query'][_0x6d20('0x9b')];var _0x5282e4=_0x3f693a[_0x6d20('0x37')][_0x6d20('0x22')]?_0x3f693a[_0x6d20('0x37')][_0x6d20('0x22')]:!![];var _0x14e2c2=_0x3f693a['query'][_0x6d20('0x9e')]?_0x3f693a[_0x6d20('0x37')][_0x6d20('0x9e')]:null;var _0x424fd3={'method':_0x3f693a[_0x6d20('0xa8')],'uri':util[_0x6d20('0x52')](_0x6d20('0x9f'),_0x5b77a6,_0x3f693a['query'][_0x6d20('0x7')]),'json':_0x5282e4,'resolveWithFullResponse':!![],'encoding':_0x14e2c2,'body':_0x3f693a[_0x6d20('0x8e')]};if(_0x3f693a[_0x6d20('0xa0')]){_0x424fd3[_0x6d20('0xa0')]=_0x3f693a[_0x6d20('0xa0')];if(_0x424fd3[_0x6d20('0xa0')][_0x6d20('0xa1')]){delete _0x424fd3[_0x6d20('0xa0')][_0x6d20('0xa1')];}}if(_0x424fd3[_0x6d20('0xa0')]['content-type']){delete _0x424fd3[_0x6d20('0xa0')][_0x6d20('0xa2')];}return rp(_0x424fd3);})[_0x6d20('0x29')](function(_0xde4409){if(_0xde4409){_0x211c63[_0x6d20('0xa3')](_0xde4409[_0x6d20('0xa0')]);logger[_0x6d20('0x65')](_0xde4409[_0x6d20('0x8e')]);return _0x211c63['status'](_0xde4409[_0x6d20('0xa5')])[_0x6d20('0x31')](_0xde4409['body']);}else{return _0x211c63[_0x6d20('0x2d')](0xc8);}})[_0x6d20('0x4d')](handleError(_0x211c63,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a5f3e61..7cb4acb 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 _0x744c=['Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x200b43,_0x47dbcb){var _0x375278=function(_0x4fc6a5){while(--_0x4fc6a5){_0x200b43['push'](_0x200b43['shift']());}};_0x375278(++_0x47dbcb);}(_0x744c,0xa0));var _0xc744=function(_0x21ce97,_0x10dbe9){_0x21ce97=_0x21ce97-0x0;var _0x10ad5e=_0x744c[_0x21ce97];return _0x10ad5e;};'use strict';var EventEmitter=require(_0xc744('0x0'));var Plugin=require(_0xc744('0x1'))['db'][_0xc744('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc744('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc744('0x4'),'afterDestroy':_0xc744('0x5')};function emitEvent(_0xe29616){return function(_0xde4228,_0x4f1c94,_0x5dc024){PluginEvents[_0xc744('0x6')](_0xe29616+':'+_0xde4228['id'],_0xde4228);PluginEvents[_0xc744('0x6')](_0xe29616,_0xde4228);_0x5dc024(null);};}for(var e in events){if(events[_0xc744('0x7')](e)){var event=events[e];Plugin[_0xc744('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x8ce1=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2d16d8,_0x295ba2){var _0x40e2bf=function(_0x45c1cf){while(--_0x45c1cf){_0x2d16d8['push'](_0x2d16d8['shift']());}};_0x40e2bf(++_0x295ba2);}(_0x8ce1,0x152));var _0x18ce=function(_0x425637,_0x33d269){_0x425637=_0x425637-0x0;var _0x3fede3=_0x8ce1[_0x425637];return _0x3fede3;};'use strict';var EventEmitter=require(_0x18ce('0x0'));var Plugin=require(_0x18ce('0x1'))['db'][_0x18ce('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x18ce('0x3')](0x0);var events={'afterCreate':_0x18ce('0x4'),'afterUpdate':_0x18ce('0x5'),'afterDestroy':_0x18ce('0x6')};function emitEvent(_0x5e10bb){return function(_0x194532,_0xcffe1d,_0x37947f){PluginEvents[_0x18ce('0x7')](_0x5e10bb+':'+_0x194532['id'],_0x194532);PluginEvents['emit'](_0x5e10bb,_0x194532);_0x37947f(null);};}for(var e in events){if(events[_0x18ce('0x8')](e)){var event=events[e];Plugin[_0x18ce('0x9')](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 dca07c6..dc54f3d 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 _0x3c7d=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3c7d,0x84));var _0xd3c7=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x3c7d[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0xd3c7('0x0'));var util=require('util');var logger=require(_0xd3c7('0x1'))('api');var moment=require(_0xd3c7('0x2'));var BPromise=require(_0xd3c7('0x3'));var rp=require(_0xd3c7('0x4'));var fs=require('fs');var path=require(_0xd3c7('0x5'));var rimraf=require(_0xd3c7('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3c7('0x7'));module[_0xd3c7('0x8')]=function(_0x1579c6,_0x884b69){return _0x1579c6[_0xd3c7('0x9')]('Plugin',attributes,{'tableName':_0xd3c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4983=['Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./plugin.attributes','exports','define'];(function(_0x578e7a,_0xa274d7){var _0x1fa139=function(_0x21aa95){while(--_0x21aa95){_0x578e7a['push'](_0x578e7a['shift']());}};_0x1fa139(++_0xa274d7);}(_0x4983,0x1a4));var _0x3498=function(_0x438da4,_0x32cd35){_0x438da4=_0x438da4-0x0;var _0x22e661=_0x4983[_0x438da4];return _0x22e661;};'use strict';var _=require(_0x3498('0x0'));var util=require('util');var logger=require(_0x3498('0x1'))(_0x3498('0x2'));var moment=require(_0x3498('0x3'));var BPromise=require(_0x3498('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3498('0x5'));var attributes=require(_0x3498('0x6'));module[_0x3498('0x7')]=function(_0x39f0e9,_0x4e3316){return _0x39f0e9[_0x3498('0x8')](_0x3498('0x9'),attributes,{'tableName':_0x3498('0xa'),'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 2236bc2..f743dab 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 _0xee7f=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./plugin.socket'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xee7f,0xc3));var _0xfee7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee7f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfee7('0x0'));var BPromise=require(_0xfee7('0x1'));var rs=require(_0xfee7('0x2'));var fs=require('fs');var Redis=require(_0xfee7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee7('0x4'));var logger=require(_0xfee7('0x5'))(_0xfee7('0x6'));var config=require(_0xfee7('0x7'));var jayson=require(_0xfee7('0x8'));var client=jayson[_0xfee7('0x9')][_0xfee7('0xa')]({'port':0x232a});config['redis']=_[_0xfee7('0xb')](config[_0xfee7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfee7('0xd'))(new Redis(config[_0xfee7('0xc')]));require(_0xfee7('0xe'))[_0xfee7('0xf')](socket);function respondWithRpcPromise(_0x28f80c,_0x4571ca,_0x1e01a7){return new BPromise(function(_0x3f96bd,_0x2a2471){return client[_0xfee7('0x10')](_0x28f80c,_0x1e01a7)[_0xfee7('0x11')](function(_0x5bf4be){logger[_0xfee7('0x12')](_0xfee7('0x13'),_0x4571ca,_0xfee7('0x14'));logger[_0xfee7('0x15')](_0xfee7('0x16'),_0x4571ca,_0xfee7('0x14'),JSON[_0xfee7('0x17')](_0x5bf4be));if(_0x5bf4be['error']){if(_0x5bf4be['error'][_0xfee7('0x18')]===0x1f4){logger['error'](_0xfee7('0x13'),_0x4571ca,_0x5bf4be[_0xfee7('0x19')][_0xfee7('0x1a')]);return _0x2a2471(_0x5bf4be[_0xfee7('0x19')][_0xfee7('0x1a')]);}logger[_0xfee7('0x19')]('Plugin,\x20%s,\x20%s',_0x4571ca,_0x5bf4be[_0xfee7('0x19')][_0xfee7('0x1a')]);return _0x3f96bd(_0x5bf4be[_0xfee7('0x19')]['message']);}else{logger['info'](_0xfee7('0x13'),_0x4571ca,_0xfee7('0x14'));_0x3f96bd(_0x5bf4be[_0xfee7('0x1b')][_0xfee7('0x1a')]);}})[_0xfee7('0x1c')](function(_0x521b05){logger['error'](_0xfee7('0x13'),_0x4571ca,_0x521b05);_0x2a2471(_0x521b05);});});}exports[_0xfee7('0x1d')]=function(_0x475885){var _0x36adb8=this;return new Promise(function(_0x347325,_0x555442){return db[_0xfee7('0x1e')][_0xfee7('0x1f')](_0x475885[_0xfee7('0x20')],{'raw':_0x475885[_0xfee7('0x21')]?_0x475885['options'][_0xfee7('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x35b5c3){logger[_0xfee7('0x12')]('CreatePlugin',_0x475885);logger[_0xfee7('0x15')](_0xfee7('0x1d'),_0x475885,JSON['stringify'](_0x35b5c3));_0x347325(_0x35b5c3);})[_0xfee7('0x1c')](function(_0x157e86){logger[_0xfee7('0x19')](_0xfee7('0x1d'),_0x157e86['message'],_0x475885);_0x555442(_0x36adb8[_0xfee7('0x19')](0x1f4,_0x157e86[_0xfee7('0x1a')]));});});}; \ No newline at end of file +var _0xb0f6=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreatePlugin','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','request','then'];(function(_0x159246,_0x48148a){var _0x346fc9=function(_0xf1f023){while(--_0xf1f023){_0x159246['push'](_0x159246['shift']());}};_0x346fc9(++_0x48148a);}(_0xb0f6,0x1bf));var _0x6b0f=function(_0x124078,_0x37d255){_0x124078=_0x124078-0x0;var _0x78cac0=_0xb0f6[_0x124078];return _0x78cac0;};'use strict';var _=require(_0x6b0f('0x0'));var util=require(_0x6b0f('0x1'));var moment=require(_0x6b0f('0x2'));var BPromise=require(_0x6b0f('0x3'));var rs=require(_0x6b0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b0f('0x5'))['db'];var utils=require(_0x6b0f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b0f('0x7'));var jayson=require(_0x6b0f('0x8'));var client=jayson[_0x6b0f('0x9')][_0x6b0f('0xa')]({'port':0x232a});config['redis']=_[_0x6b0f('0xb')](config[_0x6b0f('0xc')],{'host':_0x6b0f('0xd'),'port':0x18eb});var socket=require(_0x6b0f('0xe'))(new Redis(config[_0x6b0f('0xc')]));require(_0x6b0f('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b5add,_0x4ac2e8,_0x125eb7){return new BPromise(function(_0x26deb2,_0x4f6092){return client[_0x6b0f('0x10')](_0x5b5add,_0x125eb7)[_0x6b0f('0x11')](function(_0x2f5f12){logger[_0x6b0f('0x12')](_0x6b0f('0x13'),_0x4ac2e8,_0x6b0f('0x14'));logger[_0x6b0f('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4ac2e8,_0x6b0f('0x14'),JSON[_0x6b0f('0x16')](_0x2f5f12));if(_0x2f5f12[_0x6b0f('0x17')]){if(_0x2f5f12[_0x6b0f('0x17')]['code']===0x1f4){logger[_0x6b0f('0x17')](_0x6b0f('0x13'),_0x4ac2e8,_0x2f5f12['error'][_0x6b0f('0x18')]);return _0x4f6092(_0x2f5f12['error'][_0x6b0f('0x18')]);}logger[_0x6b0f('0x17')](_0x6b0f('0x13'),_0x4ac2e8,_0x2f5f12[_0x6b0f('0x17')]['message']);return _0x26deb2(_0x2f5f12[_0x6b0f('0x17')][_0x6b0f('0x18')]);}else{logger[_0x6b0f('0x12')](_0x6b0f('0x13'),_0x4ac2e8,'request\x20sent');_0x26deb2(_0x2f5f12[_0x6b0f('0x19')]['message']);}})[_0x6b0f('0x1a')](function(_0x48dcf9){logger[_0x6b0f('0x17')](_0x6b0f('0x13'),_0x4ac2e8,_0x48dcf9);_0x4f6092(_0x48dcf9);});});}exports[_0x6b0f('0x1b')]=function(_0x1016b8){var _0x5df01c=this;return new Promise(function(_0x37785e,_0x379b1f){return db['Plugin'][_0x6b0f('0x1c')](_0x1016b8['body'],{'raw':_0x1016b8[_0x6b0f('0x1d')]?_0x1016b8[_0x6b0f('0x1d')][_0x6b0f('0x1e')]===undefined?!![]:![]:!![]})[_0x6b0f('0x11')](function(_0x3c45b0){logger[_0x6b0f('0x12')](_0x6b0f('0x1b'),_0x1016b8);logger[_0x6b0f('0x15')](_0x6b0f('0x1b'),_0x1016b8,JSON['stringify'](_0x3c45b0));_0x37785e(_0x3c45b0);})['catch'](function(_0x4e8e69){logger[_0x6b0f('0x17')](_0x6b0f('0x1b'),_0x4e8e69['message'],_0x1016b8);_0x379b1f(_0x5df01c['error'](0x1f4,_0x4e8e69[_0x6b0f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 02479b5..f51c18a 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 _0x81b8=['removeListener','register','length','plugin:','save','remove','update','emit'];(function(_0x3b96af,_0x235992){var _0x483a05=function(_0xf6bad6){while(--_0xf6bad6){_0x3b96af['push'](_0x3b96af['shift']());}};_0x483a05(++_0x235992);}(_0x81b8,0x1ec));var _0x881b=function(_0x21aaf2,_0x30e170){_0x21aaf2=_0x21aaf2-0x0;var _0x3a6559=_0x81b8[_0x21aaf2];return _0x3a6559;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x881b('0x0'),_0x881b('0x1'),_0x881b('0x2')];function createListener(_0x3b3bdc,_0xf329d3){return function(_0x318697){_0xf329d3[_0x881b('0x3')](_0x3b3bdc,_0x318697);};}function removeListener(_0x2de554,_0x4b29cd){return function(){PluginEvents[_0x881b('0x4')](_0x2de554,_0x4b29cd);};}exports[_0x881b('0x5')]=function(_0x16b8fb){for(var _0x4c9392=0x0,_0x16eb12=events[_0x881b('0x6')];_0x4c9392<_0x16eb12;_0x4c9392++){var _0x455cec=events[_0x4c9392];var _0xb3a1d0=createListener(_0x881b('0x7')+_0x455cec,_0x16b8fb);PluginEvents['on'](_0x455cec,_0xb3a1d0);}}; \ No newline at end of file +var _0x7b73=['plugin:','save','remove','update','register'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x7b73,0xb0));var _0x37b7=function(_0x4315f7,_0x5e14ed){_0x4315f7=_0x4315f7-0x0;var _0x3d7aea=_0x7b73[_0x4315f7];return _0x3d7aea;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x37b7('0x0'),_0x37b7('0x1'),_0x37b7('0x2')];function createListener(_0x43f3d0,_0x1c979e){return function(_0x44b33e){_0x1c979e['emit'](_0x43f3d0,_0x44b33e);};}function removeListener(_0x22b437,_0x565184){return function(){PluginEvents['removeListener'](_0x22b437,_0x565184);};}exports[_0x37b7('0x3')]=function(_0x2df8b9){for(var _0x16244f=0x0,_0x2e7488=events['length'];_0x16244f<_0x2e7488;_0x16244f++){var _0x44d116=events[_0x16244f];var _0x2d32d2=createListener(_0x37b7('0x4')+_0x44d116,_0x2df8b9);PluginEvents['on'](_0x44d116,_0x2d32d2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1d4af51..7d72221 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(_0x533deb,_0x13d177){var _0x2efe05=function(_0x390f7e){while(--_0x390f7e){_0x533deb['push'](_0x533deb['shift']());}};_0x2efe05(++_0x13d177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x262b29,_0x87a7b0){var _0x381146=function(_0x1e07b5){while(--_0x1e07b5){_0x262b29['push'](_0x262b29['shift']());}};_0x381146(++_0x87a7b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 645a63d..043766f 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 _0xbb53=['send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','npm\x20install','info','index','then','reject','motion2','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','dump'];(function(_0x676c8d,_0x31a7c0){var _0x5575d0=function(_0x837e96){while(--_0x837e96){_0x676c8d['push'](_0x676c8d['shift']());}};_0x5575d0(++_0x31a7c0);}(_0xbb53,0x121));var _0x3bb5=function(_0x19b450,_0x2dd788){_0x19b450=_0x19b450-0x0;var _0x43fc1b=_0xbb53[_0x19b450];return _0x43fc1b;};'use strict';var _=require(_0x3bb5('0x0'));var pm2=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var path=require(_0x3bb5('0x4'));var exec=require(_0x3bb5('0x5'))[_0x3bb5('0x6')];var BPromise=require(_0x3bb5('0x7'));function handleEntityNotFound(_0x83e44b,_0x450d9e){return function(_0x55fdaf){if(!_0x55fdaf){_0x83e44b['sendStatus'](0x194);;}return _0x55fdaf;};}function respondWithResult(_0x23f11e,_0x2460b0){_0x2460b0=_0x2460b0||0xc8;return function(_0x28aa7d){if(_0x28aa7d){return _0x23f11e[_0x3bb5('0x8')](_0x2460b0)[_0x3bb5('0x9')](_0x28aa7d);}return null;};}function handleError(_0x480f9c,_0x5a4ae3){_0x5a4ae3=_0x5a4ae3||0x1f4;return function(_0x4cfdd7){logger[_0x3bb5('0xa')](_0x4cfdd7[_0x3bb5('0xb')]);if(_0x4cfdd7[_0x3bb5('0xc')]){delete _0x4cfdd7['name'];}_0x480f9c[_0x3bb5('0x8')](_0x5a4ae3)['send'](_0x4cfdd7);};}function execChildProcess(){return new BPromise(function(_0x53af18,_0xd8d9bf){exec(_0x3bb5('0xd'),function(_0x5cfc6b,_0xe00ace,_0x511e41){logger[_0x3bb5('0xe')](_0xe00ace);logger['info'](_0x511e41);if(_0x5cfc6b){logger['error'](_0x5cfc6b);return _0xd8d9bf(_0x5cfc6b);}return _0x53af18(_0xe00ace);});});}exports[_0x3bb5('0xf')]=function(_0x35a99b,_0x1e46a5){return pm2['list']()[_0x3bb5('0x10')](function(_0x12e409){if(_0x12e409){var _0x519123=_[_0x3bb5('0x11')](_0x12e409,function(_0x15c369){return _0x15c369['name']==='express'||_0x15c369['name']===_0x3bb5('0x12');});return{'rows':_0x519123,'count':_0x519123[_0x3bb5('0x13')]};}return null;})['then'](respondWithResult(_0x1e46a5,null))[_0x3bb5('0x14')](handleError(_0x1e46a5,null));};exports[_0x3bb5('0x15')]=function(_0x4656c4,_0x262059){return pm2['describe'](_0x4656c4[_0x3bb5('0x16')]['id'])[_0x3bb5('0x10')](respondWithResult(_0x262059,null))[_0x3bb5('0x10')](handleEntityNotFound(_0x262059,null))['catch'](handleError(_0x262059,null));};exports['create']=function(_0x19b177,_0x478021){if(_0x19b177[_0x3bb5('0x17')]['name']&&_0x19b177[_0x3bb5('0x17')][_0x3bb5('0x18')]){var _0x3f94ad=path[_0x3bb5('0x19')](__dirname,_0x3bb5('0x1a'),_0x19b177[_0x3bb5('0x17')]['script']);var _0x37444e=process[_0x3bb5('0x1b')]();process[_0x3bb5('0x1c')](path[_0x3bb5('0x1d')](_0x3f94ad));return execChildProcess()[_0x3bb5('0x10')](function(_0xfb9e8){process[_0x3bb5('0x1c')](_0x37444e);return pm2['start']({'name':_0x19b177[_0x3bb5('0x17')][_0x3bb5('0xc')],'script':_0x3f94ad});})['then'](function(_0x4fc81b){pm2[_0x3bb5('0x1e')]();return _0x4fc81b[0x0];})[_0x3bb5('0x10')](respondWithResult(_0x478021,0xc9))['catch'](handleError(_0x478021,null));}else{return _0x478021['status'](0x1f4)[_0x3bb5('0x1f')]({'message':_0x3bb5('0x20')});}};exports[_0x3bb5('0x21')]=function(_0xc1c149,_0x57abf4){if(_0xc1c149['body']['id']){delete _0xc1c149[_0x3bb5('0x17')]['id'];}var _0x4e8c65={'online':_0x3bb5('0x22'),'stopped':_0x3bb5('0x23')};if(_0x4e8c65[_0x3bb5('0x24')](_0xc1c149['body']['status'])){return pm2[_0x4e8c65[_0xc1c149[_0x3bb5('0x17')][_0x3bb5('0x8')]]](_0xc1c149[_0x3bb5('0x16')]['id'])[_0x3bb5('0x10')](respondWithResult(_0x57abf4,0xc8))[_0x3bb5('0x14')](handleError(_0x57abf4,null));}else{return _0x57abf4[_0x3bb5('0x8')](0x1f4)[_0x3bb5('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x3bb5('0x25')]=function(_0xa643c9,_0x5ebd0a){if(_0xa643c9[_0x3bb5('0x17')]['id']){delete _0xa643c9[_0x3bb5('0x17')]['id'];}if(_0xa643c9[_0x3bb5('0x16')]['id']){return pm2[_0x3bb5('0x26')](_0xa643c9['params']['id'])[_0x3bb5('0x10')](function(_0x25ba4c){pm2['dump']();return _0x25ba4c[0x0];})[_0x3bb5('0x10')](respondWithResult(_0x5ebd0a,null))[_0x3bb5('0x14')](handleError(_0x5ebd0a,null));}else{return _0x5ebd0a[_0x3bb5('0x8')](0x1f4)[_0x3bb5('0x1f')]({'message':_0x3bb5('0x27')});}}; \ No newline at end of file +var _0xe706=['dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','express','motion2','then','catch','params','create','body','script','join','../../files/plugins','cwd'];(function(_0x55e570,_0x1e93ed){var _0x3cf22b=function(_0x1ab37d){while(--_0x1ab37d){_0x55e570['push'](_0x55e570['shift']());}};_0x3cf22b(++_0x1e93ed);}(_0xe706,0xa3));var _0x6e70=function(_0x125a8a,_0x490d31){_0x125a8a=_0x125a8a-0x0;var _0xe767a5=_0xe706[_0x125a8a];return _0xe767a5;};'use strict';var _=require(_0x6e70('0x0'));var pm2=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var path=require(_0x6e70('0x3'));var exec=require(_0x6e70('0x4'))[_0x6e70('0x5')];var BPromise=require(_0x6e70('0x6'));function handleEntityNotFound(_0x142c27,_0x2164a4){return function(_0x376a8d){if(!_0x376a8d){_0x142c27[_0x6e70('0x7')](0x194);;}return _0x376a8d;};}function respondWithResult(_0x1b0389,_0x4381d1){_0x4381d1=_0x4381d1||0xc8;return function(_0x36357b){if(_0x36357b){return _0x1b0389[_0x6e70('0x8')](_0x4381d1)[_0x6e70('0x9')](_0x36357b);}return null;};}function handleError(_0x188ed3,_0x3c4843){_0x3c4843=_0x3c4843||0x1f4;return function(_0x449b48){logger[_0x6e70('0xa')](_0x449b48[_0x6e70('0xb')]);if(_0x449b48[_0x6e70('0xc')]){delete _0x449b48[_0x6e70('0xc')];}_0x188ed3[_0x6e70('0x8')](_0x3c4843)[_0x6e70('0xd')](_0x449b48);};}function execChildProcess(){return new BPromise(function(_0x37b3e0,_0x4600f9){exec('npm\x20install',function(_0x47f6b2,_0x3594c1,_0x15a1a5){logger[_0x6e70('0xe')](_0x3594c1);logger[_0x6e70('0xe')](_0x15a1a5);if(_0x47f6b2){logger[_0x6e70('0xa')](_0x47f6b2);return _0x4600f9(_0x47f6b2);}return _0x37b3e0(_0x3594c1);});});}exports[_0x6e70('0xf')]=function(_0xa1eb74,_0x181005){return pm2['list']()['then'](function(_0x48bc72){if(_0x48bc72){var _0x257e81=_['reject'](_0x48bc72,function(_0x53aed0){return _0x53aed0[_0x6e70('0xc')]===_0x6e70('0x10')||_0x53aed0['name']===_0x6e70('0x11');});return{'rows':_0x257e81,'count':_0x257e81['length']};}return null;})[_0x6e70('0x12')](respondWithResult(_0x181005,null))[_0x6e70('0x13')](handleError(_0x181005,null));};exports['show']=function(_0x49029f,_0x3bd572){return pm2['describe'](_0x49029f[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x3bd572,null))['then'](handleEntityNotFound(_0x3bd572,null))['catch'](handleError(_0x3bd572,null));};exports[_0x6e70('0x15')]=function(_0x208e21,_0x2368eb){if(_0x208e21[_0x6e70('0x16')][_0x6e70('0xc')]&&_0x208e21[_0x6e70('0x16')][_0x6e70('0x17')]){var _0x44a49f=path[_0x6e70('0x18')](__dirname,_0x6e70('0x19'),_0x208e21['body'][_0x6e70('0x17')]);var _0x344b65=process[_0x6e70('0x1a')]();process['chdir'](path[_0x6e70('0x1b')](_0x44a49f));return execChildProcess()[_0x6e70('0x12')](function(_0x3337a6){process['chdir'](_0x344b65);return pm2[_0x6e70('0x1c')]({'name':_0x208e21['body']['name'],'script':_0x44a49f});})['then'](function(_0x41e352){pm2[_0x6e70('0x1d')]();return _0x41e352[0x0];})['then'](respondWithResult(_0x2368eb,0xc9))[_0x6e70('0x13')](handleError(_0x2368eb,null));}else{return _0x2368eb[_0x6e70('0x8')](0x1f4)['send']({'message':_0x6e70('0x1e')});}};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){if(_0x2bb231['body']['id']){delete _0x2bb231[_0x6e70('0x16')]['id'];}var _0x3af17f={'online':_0x6e70('0x20'),'stopped':_0x6e70('0x21')};if(_0x3af17f[_0x6e70('0x22')](_0x2bb231['body'][_0x6e70('0x8')])){return pm2[_0x3af17f[_0x2bb231[_0x6e70('0x16')][_0x6e70('0x8')]]](_0x2bb231[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x4a67ac,0xc8))[_0x6e70('0x13')](handleError(_0x4a67ac,null));}else{return _0x4a67ac[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':_0x6e70('0x23')});}};exports[_0x6e70('0x24')]=function(_0x4b1229,_0x1b27d8){if(_0x4b1229['body']['id']){delete _0x4b1229[_0x6e70('0x16')]['id'];}if(_0x4b1229['params']['id']){return pm2[_0x6e70('0x25')](_0x4b1229[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](function(_0x56f6f7){pm2[_0x6e70('0x1d')]();return _0x56f6f7[0x0];})[_0x6e70('0x12')](respondWithResult(_0x1b27d8,null))['catch'](handleError(_0x1b27d8,null));}else{return _0x1b27d8[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9164eeb..fad4efa 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 _0x0375=['../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues','getQueues','express','Router'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x0375,0x102));var _0x5037=function(_0x51b51a,_0x2f156c){_0x51b51a=_0x51b51a-0x0;var _0x40bcd6=_0x0375[_0x51b51a];return _0x40bcd6;};'use strict';var express=require(_0x5037('0x0'));var router=express[_0x5037('0x1')]();var auth=require(_0x5037('0x2'));var controller=require(_0x5037('0x3'));router['get'](_0x5037('0x4'),auth[_0x5037('0x5')](),controller[_0x5037('0x6')]);router[_0x5037('0x7')](_0x5037('0x8'),auth[_0x5037('0x5')](),controller[_0x5037('0x9')]);module['exports']=router; \ No newline at end of file +var _0xda87=['express','../../components/auth/service','./realtime.controller','get','/agents','/queues','getQueues','exports'];(function(_0x1f15bb,_0x4663fb){var _0x3a49ef=function(_0x5aa13c){while(--_0x5aa13c){_0x1f15bb['push'](_0x1f15bb['shift']());}};_0x3a49ef(++_0x4663fb);}(_0xda87,0x178));var _0x7da8=function(_0x5003bc,_0x18e9cc){_0x5003bc=_0x5003bc-0x0;var _0x57d786=_0xda87[_0x5003bc];return _0x57d786;};'use strict';var express=require(_0x7da8('0x0'));var router=express['Router']();var auth=require(_0x7da8('0x1'));var controller=require(_0x7da8('0x2'));router[_0x7da8('0x3')](_0x7da8('0x4'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7da8('0x3')](_0x7da8('0x5'),auth['isAuthenticated'](),controller[_0x7da8('0x6')]);module[_0x7da8('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 79884f8..345a680 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x3db35d,_0x201743){var _0xca2c31=function(_0x1e256c){while(--_0x1e256c){_0x3db35d['push'](_0x3db35d['shift']());}};_0xca2c31(++_0x201743);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x1f9f5b,_0x90f0f5){var _0x128a57=function(_0x5dbbbe){while(--_0x5dbbbe){_0x1f9f5b['push'](_0x1f9f5b['shift']());}};_0x128a57(++_0x90f0f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0d8c38d..786c48a 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x558563,_0x39081f){var _0x23ef87=function(_0x409d43){while(--_0x409d43){_0x558563['push'](_0x558563['shift']());}};_0x23ef87(++_0x39081f);}(_0xedd9,0xfc));var _0x9edd=function(_0x191f98,_0x17361b){_0x191f98=_0x191f98-0x0;var _0x980d3c=_0xedd9[_0x191f98];return _0x980d3c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x596d8f,_0x48d0c8){var _0xacceb1=function(_0x3bbbe7){while(--_0x3bbbe7){_0x596d8f['push'](_0x596d8f['shift']());}};_0xacceb1(++_0x48d0c8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xcb91[_0x38b14f];return _0x22a324;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 22e4350..e6db0a4 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 _0x0c75=['DATE','INTEGER','exports','STRING'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0c75,0x6a));var _0x50c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c75[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x50c7('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x50c7('0x1')]},'scheduledat':{'type':Sequelize[_0x50c7('0x2')]},'uniqueid':{'type':Sequelize[_0x50c7('0x1')]},'starttime':{'type':Sequelize[_0x50c7('0x2')]},'responsetime':{'type':Sequelize[_0x50c7('0x2')]},'ringtime':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x50c7('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x50c7('0x1')]}}; \ No newline at end of file +var _0xec46=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x5672b3,_0x520a22){var _0x3b1a58=function(_0x4576c8){while(--_0x4576c8){_0x5672b3['push'](_0x5672b3['shift']());}};_0x3b1a58(++_0x520a22);}(_0xec46,0x19c));var _0x6ec4=function(_0x352b24,_0x1a4c28){_0x352b24=_0x352b24-0x0;var _0x5b34ee=_0xec46[_0x352b24];return _0x5b34ee;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'state':{'type':Sequelize[_0x6ec4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6ec4('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6ec4('0x4')]},'responsetime':{'type':Sequelize[_0x6ec4('0x4')]},'ringtime':{'type':Sequelize[_0x6ec4('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6ec4('0x3')]},'membername':{'type':Sequelize[_0x6ec4('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 801f163..f7a70af 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 _0x8e57=['exports','report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xc93d66,_0x2c794c){var _0x304f83=function(_0x46dc66){while(--_0x46dc66){_0xc93d66['push'](_0xc93d66['shift']());}};_0x304f83(++_0x2c794c);}(_0x8e57,0x138));var _0x78e5=function(_0x2094e7,_0x1c9fd2){_0x2094e7=_0x2094e7-0x0;var _0x9f27d9=_0x8e57[_0x2094e7];return _0x9f27d9;};'use strict';var _=require('lodash');var util=require(_0x78e5('0x0'));var logger=require(_0x78e5('0x1'))(_0x78e5('0x2'));var moment=require(_0x78e5('0x3'));var BPromise=require(_0x78e5('0x4'));var rp=require(_0x78e5('0x5'));var fs=require('fs');var path=require(_0x78e5('0x6'));var rimraf=require('rimraf');var config=require(_0x78e5('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x78e5('0x8')]=function(_0x459a5c,_0x3f175c){return _0x459a5c['define']('ReportAgentPreview',attributes,{'tableName':_0x78e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14c5=['define','ReportAgentPreview','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14c5,0x13a));var _0x514c=function(_0x59652d,_0xd3187e){_0x59652d=_0x59652d-0x0;var _0x87d836=_0x14c5[_0x59652d];return _0x87d836;};'use strict';var _=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var logger=require(_0x514c('0x2'))('api');var moment=require(_0x514c('0x3'));var BPromise=require('bluebird');var rp=require(_0x514c('0x4'));var fs=require('fs');var path=require(_0x514c('0x5'));var rimraf=require(_0x514c('0x6'));var config=require(_0x514c('0x7'));var attributes=require(_0x514c('0x8'));module[_0x514c('0x9')]=function(_0x3b90ad,_0xf4b2c9){return _0x3b90ad[_0x514c('0xa')](_0x514c('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 4dba2a6..e0221f3 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 _0xed59=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xed59,0xab));var _0x9ed5=function(_0x588d2d,_0x54929e){_0x588d2d=_0x588d2d-0x0;var _0x3a8f33=_0xed59[_0x588d2d];return _0x3a8f33;};'use strict';var _=require(_0x9ed5('0x0'));var util=require(_0x9ed5('0x1'));var moment=require(_0x9ed5('0x2'));var BPromise=require(_0x9ed5('0x3'));var rs=require(_0x9ed5('0x4'));var fs=require('fs');var Redis=require(_0x9ed5('0x5'));var db=require(_0x9ed5('0x6'))['db'];var utils=require(_0x9ed5('0x7'));var logger=require(_0x9ed5('0x8'))(_0x9ed5('0x9'));var config=require(_0x9ed5('0xa'));var jayson=require(_0x9ed5('0xb'));var client=jayson[_0x9ed5('0xc')][_0x9ed5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4613c8,_0x3cf158,_0x33361d){return new BPromise(function(_0x2b16b9,_0x49f689){return client[_0x9ed5('0xe')](_0x4613c8,_0x33361d)[_0x9ed5('0xf')](function(_0x1e03c5){logger[_0x9ed5('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x3cf158,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3cf158,'request\x20sent',JSON[_0x9ed5('0x11')](_0x1e03c5));if(_0x1e03c5[_0x9ed5('0x12')]){if(_0x1e03c5[_0x9ed5('0x12')]['code']===0x1f4){logger[_0x9ed5('0x12')](_0x9ed5('0x13'),_0x3cf158,_0x1e03c5[_0x9ed5('0x12')][_0x9ed5('0x14')]);return _0x49f689(_0x1e03c5[_0x9ed5('0x12')][_0x9ed5('0x14')]);}logger[_0x9ed5('0x12')](_0x9ed5('0x13'),_0x3cf158,_0x1e03c5[_0x9ed5('0x12')][_0x9ed5('0x14')]);return _0x2b16b9(_0x1e03c5['error'][_0x9ed5('0x14')]);}else{logger['info'](_0x9ed5('0x13'),_0x3cf158,_0x9ed5('0x15'));_0x2b16b9(_0x1e03c5[_0x9ed5('0x16')]['message']);}})[_0x9ed5('0x17')](function(_0x4646c){logger[_0x9ed5('0x12')](_0x9ed5('0x13'),_0x3cf158,_0x4646c);_0x49f689(_0x4646c);});});}exports[_0x9ed5('0x18')]=function(_0x4ff92a){var _0x4b6266=this;return new Promise(function(_0x22d989,_0x4780c9){return db[_0x9ed5('0x19')][_0x9ed5('0x1a')](_0x4ff92a[_0x9ed5('0x1b')],{'raw':_0x4ff92a[_0x9ed5('0x1c')]?_0x4ff92a['options']['raw']===undefined?!![]:![]:!![]})[_0x9ed5('0xf')](function(_0x58449e){logger[_0x9ed5('0x10')](_0x9ed5('0x18'),_0x4ff92a);logger[_0x9ed5('0x1d')](_0x9ed5('0x18'),_0x4ff92a,JSON[_0x9ed5('0x11')](_0x58449e));_0x22d989(_0x58449e);})[_0x9ed5('0x17')](function(_0x1e0a3c){logger[_0x9ed5('0x12')](_0x9ed5('0x18'),_0x1e0a3c[_0x9ed5('0x14')],_0x4ff92a);_0x4780c9(_0x4b6266[_0x9ed5('0x12')](0x1f4,_0x1e0a3c[_0x9ed5('0x14')]));});});}; \ No newline at end of file +var _0xdf06=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util'];(function(_0x1c743d,_0x1adc58){var _0x1f47b1=function(_0x50fcb7){while(--_0x50fcb7){_0x1c743d['push'](_0x1c743d['shift']());}};_0x1f47b1(++_0x1adc58);}(_0xdf06,0xc2));var _0x6df0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdf06[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6df0('0x0'));var util=require(_0x6df0('0x1'));var moment=require(_0x6df0('0x2'));var BPromise=require(_0x6df0('0x3'));var rs=require(_0x6df0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6df0('0x5'))['db'];var utils=require(_0x6df0('0x6'));var logger=require(_0x6df0('0x7'))('rpc');var config=require(_0x6df0('0x8'));var jayson=require(_0x6df0('0x9'));var client=jayson[_0x6df0('0xa')][_0x6df0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a036,_0x3c010e,_0x11f38a){return new BPromise(function(_0xe04f77,_0x5ddfcb){return client['request'](_0x36a036,_0x11f38a)[_0x6df0('0xc')](function(_0x24f71f){logger[_0x6df0('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c010e,_0x6df0('0xe'));logger[_0x6df0('0xf')](_0x6df0('0x10'),_0x3c010e,'request\x20sent',JSON[_0x6df0('0x11')](_0x24f71f));if(_0x24f71f[_0x6df0('0x12')]){if(_0x24f71f['error'][_0x6df0('0x13')]===0x1f4){logger['error'](_0x6df0('0x14'),_0x3c010e,_0x24f71f[_0x6df0('0x12')][_0x6df0('0x15')]);return _0x5ddfcb(_0x24f71f[_0x6df0('0x12')]['message']);}logger[_0x6df0('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c010e,_0x24f71f[_0x6df0('0x12')][_0x6df0('0x15')]);return _0xe04f77(_0x24f71f['error'][_0x6df0('0x15')]);}else{logger[_0x6df0('0xd')](_0x6df0('0x14'),_0x3c010e,_0x6df0('0xe'));_0xe04f77(_0x24f71f['result'][_0x6df0('0x15')]);}})[_0x6df0('0x16')](function(_0x561735){logger[_0x6df0('0x12')](_0x6df0('0x14'),_0x3c010e,_0x561735);_0x5ddfcb(_0x561735);});});}exports[_0x6df0('0x17')]=function(_0x2860f8){var _0x176244=this;return new Promise(function(_0x2fc217,_0x57cd1d){return db[_0x6df0('0x18')]['create'](_0x2860f8[_0x6df0('0x19')],{'raw':_0x2860f8[_0x6df0('0x1a')]?_0x2860f8[_0x6df0('0x1a')][_0x6df0('0x1b')]===undefined?!![]:![]:!![]})[_0x6df0('0xc')](function(_0x1e73af){logger['info'](_0x6df0('0x17'),_0x2860f8);logger['debug'](_0x6df0('0x17'),_0x2860f8,JSON[_0x6df0('0x11')](_0x1e73af));_0x2fc217(_0x1e73af);})[_0x6df0('0x16')](function(_0x304127){logger[_0x6df0('0x12')](_0x6df0('0x17'),_0x304127[_0x6df0('0x15')],_0x2860f8);_0x57cd1d(_0x176244[_0x6df0('0x12')](0x1f4,_0x304127['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2c75bc6..f363ffc 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 _0x9e93=['showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x9e93,0x1ad));var _0x39e9=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x9e93[_0x334fea];return _0x3c5829;};'use strict';var multer=require(_0x39e9('0x0'));var util=require(_0x39e9('0x1'));var path=require('path');var express=require('express');var router=express[_0x39e9('0x2')]();var auth=require(_0x39e9('0x3'));var controller=require(_0x39e9('0x4'));router['get'](_0x39e9('0x5'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x7')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x39e9('0x6')](),controller[_0x39e9('0x8')]);router[_0x39e9('0x9')](_0x39e9('0xa'),auth[_0x39e9('0x6')](),controller[_0x39e9('0xb')]);router['get']('/voice/queues',auth[_0x39e9('0x6')](),controller[_0x39e9('0xc')]);router[_0x39e9('0x9')](_0x39e9('0xd'),auth['isAuthenticated'](),controller[_0x39e9('0xe')]);router['get'](_0x39e9('0xf'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x10')]);router[_0x39e9('0x9')](_0x39e9('0x11'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x12')]);router[_0x39e9('0x9')](_0x39e9('0x13'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x14')]);router[_0x39e9('0x9')](_0x39e9('0x15'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x39e9('0x9')]('/whatsapp/queues',auth[_0x39e9('0x6')](),controller[_0x39e9('0x16')]);router[_0x39e9('0x9')](_0x39e9('0x17'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x18')]);router[_0x39e9('0x9')]('/voice/queues/preview/:id',auth[_0x39e9('0x6')](),controller[_0x39e9('0x19')]);router[_0x39e9('0x9')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x39e9('0x1a')]);router[_0x39e9('0x9')]('/voice/queues/channels/:uniqueid',auth[_0x39e9('0x6')](),controller[_0x39e9('0x1b')]);router['get'](_0x39e9('0x1c'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x1d')]);router[_0x39e9('0x9')](_0x39e9('0x1e'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x1f')]);router['get'](_0x39e9('0x20'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x21')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x39e9('0x22')]);router[_0x39e9('0x9')](_0x39e9('0x23'),auth[_0x39e9('0x6')](),controller['outbound']);router[_0x39e9('0x9')](_0x39e9('0x24'),auth[_0x39e9('0x6')](),controller['outboundChannels']);router[_0x39e9('0x9')](_0x39e9('0x25'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x26')]);router[_0x39e9('0x27')](_0x39e9('0x28'),auth['isAuthenticated'](),controller[_0x39e9('0x29')]);router[_0x39e9('0x9')](_0x39e9('0x2a'),auth['isAuthenticated'](),controller[_0x39e9('0x2b')]);router[_0x39e9('0x9')](_0x39e9('0x2c'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x2d')]);router[_0x39e9('0x9')](_0x39e9('0x2e'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x2f')]);router[_0x39e9('0x9')](_0x39e9('0x30'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x31')]);router['get'](_0x39e9('0x32'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x33')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x39e9('0x34')]);router[_0x39e9('0x9')]('/openchannel/queues/waitinginteractions',auth[_0x39e9('0x6')](),controller[_0x39e9('0x35')]);router[_0x39e9('0x9')](_0x39e9('0x36'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x37')]);router[_0x39e9('0x9')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x39e9('0x9')](_0x39e9('0x38'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x39')]);router[_0x39e9('0x9')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x39e9('0x3a')](_0x39e9('0x3b'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3c')](_0x39e9('0x3d')));router[_0x39e9('0x9')](_0x39e9('0x3e'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3f')]);router['post'](_0x39e9('0x40'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3c')]('chat'));router[_0x39e9('0x9')](_0x39e9('0x41'),auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x39e9('0x42'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3c')]('fax'));router['get'](_0x39e9('0x43'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x39e9('0x3a')](_0x39e9('0x44'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3c')](_0x39e9('0x45')));router[_0x39e9('0x9')](_0x39e9('0x46'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x47')]);router[_0x39e9('0x3a')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x39e9('0x3c')](_0x39e9('0x48')));router[_0x39e9('0x3a')](_0x39e9('0x49'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x3c')](_0x39e9('0x4a')));router['get'](_0x39e9('0x4b'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x4c')]);router[_0x39e9('0x9')](_0x39e9('0x4d'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x4e')]);router[_0x39e9('0x3a')](_0x39e9('0x4f'),auth[_0x39e9('0x6')](),controller[_0x39e9('0x50')]);module[_0x39e9('0x51')]=router; \ No newline at end of file +var _0x3290=['/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','showMailQueues','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts'];(function(_0xbb3772,_0x3c60f5){var _0x3e1759=function(_0x3153aa){while(--_0x3153aa){_0xbb3772['push'](_0xbb3772['shift']());}};_0x3e1759(++_0x3c60f5);}(_0x3290,0x1af));var _0x0329=function(_0x441c19,_0x215965){_0x441c19=_0x441c19-0x0;var _0x57eb9f=_0x3290[_0x441c19];return _0x57eb9f;};'use strict';var multer=require(_0x0329('0x0'));var util=require(_0x0329('0x1'));var path=require(_0x0329('0x2'));var express=require('express');var router=express[_0x0329('0x3')]();var auth=require(_0x0329('0x4'));var controller=require(_0x0329('0x5'));router[_0x0329('0x6')](_0x0329('0x7'),auth[_0x0329('0x8')](),controller[_0x0329('0x9')]);router[_0x0329('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x0329('0xa')]);router['get'](_0x0329('0xb'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x0329('0x6')](_0x0329('0xc'),auth[_0x0329('0x8')](),controller[_0x0329('0xd')]);router['get']('/chat/queues',auth[_0x0329('0x8')](),controller[_0x0329('0xe')]);router[_0x0329('0x6')](_0x0329('0xf'),auth[_0x0329('0x8')](),controller[_0x0329('0x10')]);router[_0x0329('0x6')](_0x0329('0x11'),auth[_0x0329('0x8')](),controller[_0x0329('0x12')]);router[_0x0329('0x6')](_0x0329('0x13'),auth[_0x0329('0x8')](),controller[_0x0329('0x14')]);router[_0x0329('0x6')](_0x0329('0x15'),auth['isAuthenticated'](),controller[_0x0329('0x16')]);router[_0x0329('0x6')]('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x0329('0x6')](_0x0329('0x17'),auth[_0x0329('0x8')](),controller[_0x0329('0x18')]);router[_0x0329('0x6')](_0x0329('0x19'),auth[_0x0329('0x8')](),controller[_0x0329('0x1a')]);router['get'](_0x0329('0x1b'),auth[_0x0329('0x8')](),controller[_0x0329('0x1c')]);router[_0x0329('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x0329('0x8')](),controller[_0x0329('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x0329('0x8')](),controller[_0x0329('0x1e')]);router[_0x0329('0x6')](_0x0329('0x1f'),auth['isAuthenticated'](),controller[_0x0329('0x20')]);router[_0x0329('0x6')](_0x0329('0x21'),auth['isAuthenticated'](),controller[_0x0329('0x22')]);router[_0x0329('0x23')](_0x0329('0x21'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x0329('0x6')](_0x0329('0x24'),auth[_0x0329('0x8')](),controller[_0x0329('0x25')]);router['get'](_0x0329('0x26'),auth[_0x0329('0x8')](),controller[_0x0329('0x27')]);router[_0x0329('0x6')](_0x0329('0x28'),auth[_0x0329('0x8')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x0329('0x8')](),controller['agentCapacity']);router[_0x0329('0x6')](_0x0329('0x29'),auth[_0x0329('0x8')](),controller['telephones']);router[_0x0329('0x6')](_0x0329('0x2a'),auth[_0x0329('0x8')](),controller[_0x0329('0x2b')]);router[_0x0329('0x6')](_0x0329('0x2c'),auth[_0x0329('0x8')](),controller[_0x0329('0x2d')]);router['get']('/fax/accounts',auth[_0x0329('0x8')](),controller['faxAccounts']);router['get'](_0x0329('0x2e'),auth[_0x0329('0x8')](),controller[_0x0329('0x2f')]);router[_0x0329('0x6')](_0x0329('0x30'),auth[_0x0329('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x0329('0x6')](_0x0329('0x31'),auth[_0x0329('0x8')](),controller[_0x0329('0x32')]);router['get'](_0x0329('0x33'),auth[_0x0329('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0329('0x6')](_0x0329('0x34'),auth[_0x0329('0x8')](),controller[_0x0329('0x35')]);router[_0x0329('0x6')](_0x0329('0x36'),auth[_0x0329('0x8')](),controller[_0x0329('0x37')]);router[_0x0329('0x6')](_0x0329('0x38'),auth[_0x0329('0x8')](),controller[_0x0329('0x39')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0329('0x3a')]('mail'));router[_0x0329('0x6')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x0329('0x3b')]);router[_0x0329('0x3c')]('/chat/queues/:id/notify',auth[_0x0329('0x8')](),controller[_0x0329('0x3a')](_0x0329('0x3d')));router[_0x0329('0x6')](_0x0329('0x3e'),auth['isAuthenticated'](),controller[_0x0329('0x3f')]);router[_0x0329('0x3c')](_0x0329('0x40'),auth[_0x0329('0x8')](),controller[_0x0329('0x3a')](_0x0329('0x41')));router['get']('/fax/queues/:id',auth[_0x0329('0x8')](),controller[_0x0329('0x42')]);router[_0x0329('0x3c')]('/openchannel/queues/:id/notify',auth[_0x0329('0x8')](),controller[_0x0329('0x3a')](_0x0329('0x43')));router[_0x0329('0x6')](_0x0329('0x44'),auth[_0x0329('0x8')](),controller[_0x0329('0x45')]);router[_0x0329('0x3c')]('/sms/queues/:id/notify',auth[_0x0329('0x8')](),controller[_0x0329('0x3a')]('sms'));router[_0x0329('0x3c')](_0x0329('0x46'),auth[_0x0329('0x8')](),controller[_0x0329('0x3a')](_0x0329('0x47')));router[_0x0329('0x6')](_0x0329('0x48'),auth[_0x0329('0x8')](),controller['showSmsQueues']);router[_0x0329('0x6')]('/whatsapp/queues/:id',auth[_0x0329('0x8')](),controller[_0x0329('0x49')]);router['post']('/agents/:id/notify',auth[_0x0329('0x8')](),controller['agentNotify']);module[_0x0329('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0f5bf72..cffb860 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 _0xb06e=['api','client','http','request','then','error','code','message','result','catch','status','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','user','interaction','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','create','Start','queue','agentNotify','channel','chat','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb'];(function(_0xb6c4f0,_0x4dd61d){var _0x42dd58=function(_0x5eb9d3){while(--_0x5eb9d3){_0xb6c4f0['push'](_0xb6c4f0['shift']());}};_0x42dd58(++_0x4dd61d);}(_0xb06e,0x1d7));var _0xeb06=function(_0x3d7f78,_0x17e4d0){_0x3d7f78=_0x3d7f78-0x0;var _0x3bf252=_0xb06e[_0x3d7f78];return _0x3bf252;};'use strict';var BPromise=require(_0xeb06('0x0'));var moment=require(_0xeb06('0x1'));var _=require(_0xeb06('0x2'));var util=require(_0xeb06('0x3'));var db=require(_0xeb06('0x4'))['db'];var logger=require('../../config/logger')(_0xeb06('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xeb06('0x6')][_0xeb06('0x7')]({'port':0x232a});var mailClient=jayson[_0xeb06('0x6')][_0xeb06('0x7')]({'port':0x232b});var routingClient=jayson[_0xeb06('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2c51f0,_0x442e9c,_0x1f6988){return new BPromise(function(_0x5d1da6,_0x2be8ba){var _0x4b9d3e=_0x1f6988?_0x1f6988:amiClient;return _0x4b9d3e[_0xeb06('0x8')](_0x2c51f0,_0x442e9c)[_0xeb06('0x9')](function(_0x434a6a){if(_0x434a6a[_0xeb06('0xa')]){if(_0x434a6a['error'][_0xeb06('0xb')]===0x1f4){return _0x2be8ba(_0x434a6a[_0xeb06('0xa')][_0xeb06('0xc')]);}return _0x5d1da6(_0x434a6a[_0xeb06('0xa')][_0xeb06('0xc')]);}else{_0x5d1da6(_0x434a6a[_0xeb06('0xd')]);}})[_0xeb06('0xe')](function(_0x4488b0){_0x2be8ba(_0x4488b0);});});}function respondWithResult(_0xadd476,_0x55917b){_0x55917b=_0x55917b||0xc8;return function(_0xc25ad9){if(_0xc25ad9){return _0xadd476[_0xeb06('0xf')](_0x55917b)['json'](_0xc25ad9);}return _0xadd476['sendStatus'](0x194);};}function handleError(_0x322d2d,_0x4e84c6){_0x4e84c6=_0x4e84c6||0x1f4;return function(_0x3c7aa4){logger[_0xeb06('0xa')](_0x3c7aa4['stack']);if(_0x3c7aa4[_0xeb06('0x10')]){delete _0x3c7aa4['name'];}_0x322d2d[_0xeb06('0xf')](_0x4e84c6)[_0xeb06('0x11')](_0x3c7aa4);};}function findById(_0x11ef94){return function(_0x22f0fb){if(!_[_0xeb06('0x12')](_0x11ef94)&&!_['isNil'](_0x22f0fb)&&!_['isNil'](_0x22f0fb['rows'])){return _[_0xeb06('0x13')](_0x22f0fb[_0xeb06('0x14')],function(_0x586da4){return _0x586da4['id']==_0x11ef94;});}return null;};}exports[_0xeb06('0x15')]=function(_0x50a77e,_0xb31ae){return respondWithRpcPromise(_0xeb06('0x16'),_0x50a77e[_0xeb06('0x17')])[_0xeb06('0x9')](respondWithResult(_0xb31ae,null))[_0xeb06('0xe')](handleError(_0xb31ae,null));};exports[_0xeb06('0x18')]=function(_0x388d08,_0x3a2371){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x388d08['query'],_0x388d08[_0xeb06('0x19')]))['then'](respondWithResult(_0x3a2371,null))[_0xeb06('0xe')](handleError(_0x3a2371,null));};exports['voiceChannelStopMixMonitor']=function(_0x947f7c,_0x4dc662){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x947f7c['query'],_0x947f7c[_0xeb06('0x19')]))[_0xeb06('0x9')](respondWithResult(_0x4dc662,null))['catch'](handleError(_0x4dc662,null));};exports[_0xeb06('0x1a')]=function(_0x23f3fe,_0x256118){return respondWithRpcPromise(_0xeb06('0x1b'),_0x23f3fe['query'])['then'](respondWithResult(_0x256118,null))[_0xeb06('0xe')](handleError(_0x256118,null));};exports[_0xeb06('0x1c')]=function(_0x61754d,_0x1b1ab9){return respondWithRpcPromise(_0xeb06('0x1b'),_0x61754d['query'])[_0xeb06('0x9')](findById(_0x61754d['params']['id']))['then'](respondWithResult(_0x1b1ab9,null))[_0xeb06('0xe')](handleError(_0x1b1ab9,null));};exports[_0xeb06('0x1d')]=function(_0x434278,_0x59f599){return respondWithRpcPromise(_0xeb06('0x1e'),_[_0xeb06('0x1f')](_0x434278[_0xeb06('0x20')],_0x434278['params']))[_0xeb06('0x9')](respondWithResult(_0x59f599,null))['catch'](handleError(_0x59f599,null));};exports[_0xeb06('0x21')]=function(_0x22d7f5,_0x9ee912){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x22d7f5[_0xeb06('0x17')],_0x22d7f5[_0xeb06('0x19')]))['then'](respondWithResult(_0x9ee912,null))['catch'](handleError(_0x9ee912,null));};exports[_0xeb06('0x22')]=function(_0x10d975,_0xe2d115){return respondWithRpcPromise(_0xeb06('0x23'),_0x10d975['query'])['then'](respondWithResult(_0xe2d115,null))[_0xeb06('0xe')](handleError(_0xe2d115,null));};exports[_0xeb06('0x24')]=function(_0x4564de,_0x8a80ad){return respondWithRpcPromise(_0xeb06('0x25'),_[_0xeb06('0x1f')](_0x4564de[_0xeb06('0x17')],_0x4564de[_0xeb06('0x19')]))['then'](respondWithResult(_0x8a80ad,null))[_0xeb06('0xe')](handleError(_0x8a80ad,null));};exports[_0xeb06('0x26')]=function(_0x22a07f,_0x12a711){return respondWithRpcPromise(_0xeb06('0x27'),_['merge'](_0x22a07f['query'],_0x22a07f[_0xeb06('0x19')]))[_0xeb06('0x9')](respondWithResult(_0x12a711,null))[_0xeb06('0xe')](handleError(_0x12a711,null));};exports[_0xeb06('0x28')]=function(_0x4cc010,_0x70f14a){return respondWithRpcPromise(_0xeb06('0x29'),_[_0xeb06('0x1f')](_0x4cc010[_0xeb06('0x17')],_0x4cc010['params']))['then'](respondWithResult(_0x70f14a,null))[_0xeb06('0xe')](handleError(_0x70f14a,null));};exports['outbound']=function(_0x52450e,_0x25b531){return respondWithRpcPromise(_0xeb06('0x2a'),_0x52450e['query'])['then'](respondWithResult(_0x25b531,null))[_0xeb06('0xe')](handleError(_0x25b531,null));};exports['outboundChannels']=function(_0x30a4d6,_0x9bfa8d){return respondWithRpcPromise(_0xeb06('0x2b'),_0x30a4d6[_0xeb06('0x17')])['then'](respondWithResult(_0x9bfa8d,null))['catch'](handleError(_0x9bfa8d,null));};exports[_0xeb06('0x2c')]=function(_0x2260b9,_0x27dab5){var _0x17e5ae;return respondWithRpcPromise(_0xeb06('0x2d'),_0x2260b9[_0xeb06('0x17')])[_0xeb06('0x9')](function(_0x477d6a){_0x17e5ae=_0x477d6a;return respondWithRpcPromise(_0xeb06('0x2d'),_0x2260b9[_0xeb06('0x17')],routingClient);})[_0xeb06('0x9')](function(_0xe771e6){return _['merge']({},_0xe771e6,_0x17e5ae);})[_0xeb06('0x9')](respondWithResult(_0x27dab5,null))[_0xeb06('0xe')](handleError(_0x27dab5,null));};exports[_0xeb06('0x2e')]=function(_0x2beee7,_0x30b338){if(_0x2beee7[_0xeb06('0x20')]&&_0x2beee7[_0xeb06('0x20')]['interaction']&&_0x2beee7[_0xeb06('0x2f')]&&_0x2beee7['user'][_0xeb06('0x10')]){for(var _0x52e4c2 in _0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')]){if(_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')]['hasOwnProperty'](_0x52e4c2)){db[_0xeb06('0x31')][_0xeb06('0x32')]({'where':{'channel':_0x52e4c2,'membername':_0x2beee7[_0xeb06('0x2f')]['name'],'type':_0xeb06('0x33'),'exitAt':null,'uniqueid':_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')][_0x52e4c2]&&_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')][_0x52e4c2]['length']?{'$notIn':_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')][_0x52e4c2]}:{'$ne':null}}})[_0xeb06('0x9')](function(_0xf1dfcb){var _0x4a11d5=moment()[_0xeb06('0x34')](_0xeb06('0x35'));for(var _0xf1cd00=0x0,_0x16db56=_0xf1dfcb['length'];_0xf1cd00<_0x16db56;_0xf1cd00+=0x1){_0xf1dfcb[_0xf1cd00]['updateAttributes']({'exitAt':_0x4a11d5});}});for(var _0x322933=0x0;_0x322933<_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')][_0x52e4c2]['length'];_0x322933+=0x1){db[_0xeb06('0x31')]['findOrCreate']({'where':{'channel':_0x52e4c2,'membername':_0x2beee7[_0xeb06('0x2f')][_0xeb06('0x10')],'type':_0xeb06('0x33'),'uniqueid':_0x2beee7[_0xeb06('0x20')][_0xeb06('0x30')][_0x52e4c2][_0x322933],'exitAt':null},'defaults':{'channel':_0x52e4c2,'membername':_0x2beee7[_0xeb06('0x2f')][_0xeb06('0x10')],'interface':_[_0xeb06('0x12')](_0x2beee7[_0xeb06('0x2f')][_0xeb06('0x36')])?util[_0xeb06('0x34')](_0xeb06('0x37'),_0x2beee7[_0xeb06('0x2f')][_0xeb06('0x10')]):_0x2beee7[_0xeb06('0x2f')]['interface'],'type':_0xeb06('0x33'),'enterAt':moment()[_0xeb06('0x34')](_0xeb06('0x35')),'role':_0xeb06('0x38'),'internal':_0x2beee7['user'][_0xeb06('0x39')],'uniqueid':_0x2beee7['body']['interaction'][_0x52e4c2][_0x322933]}});}}}}return respondWithRpcPromise(_0xeb06('0x3a'),{'id':_0x2beee7['params']['id'],'capacity':_0x2beee7[_0xeb06('0x20')][_0xeb06('0x3b')]},routingClient)[_0xeb06('0x9')](respondWithResult(_0x30b338,null))['catch'](handleError(_0x30b338,null));};exports[_0xeb06('0x3c')]=function(_0x104a53,_0x27a209){return respondWithRpcPromise(_0xeb06('0x3d'),_0x104a53[_0xeb06('0x17')])[_0xeb06('0x9')](respondWithResult(_0x27a209,null))[_0xeb06('0xe')](handleError(_0x27a209,null));};exports[_0xeb06('0x3e')]=function(_0x29485a,_0x14bae5){return respondWithRpcPromise('Trunks',_0x29485a[_0xeb06('0x17')])[_0xeb06('0x9')](respondWithResult(_0x14bae5,null))[_0xeb06('0xe')](handleError(_0x14bae5,null));};exports[_0xeb06('0x3f')]=function(_0xe79962,_0x4ae42f){return respondWithRpcPromise(_0xeb06('0x40'),_0xe79962[_0xeb06('0x17')])['then'](respondWithResult(_0x4ae42f,null))[_0xeb06('0xe')](handleError(_0x4ae42f,null));};exports[_0xeb06('0x41')]=function(_0xf8f374,_0x2dd0fb){return respondWithRpcPromise('ChatQueues',_0xf8f374[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x2dd0fb,null))['catch'](handleError(_0x2dd0fb,null));};exports['showChatQueues']=function(_0x5d6863,_0x428cb0){return respondWithRpcPromise('ChatQueues',_0x5d6863['query'],routingClient)['then'](findById(_0x5d6863[_0xeb06('0x19')]['id']))[_0xeb06('0x9')](respondWithResult(_0x428cb0,null))[_0xeb06('0xe')](handleError(_0x428cb0,null));};exports[_0xeb06('0x42')]=function(_0x5a68f6,_0x17b200){return respondWithRpcPromise(_0xeb06('0x43'),_0x5a68f6[_0xeb06('0x17')],routingClient)['then'](respondWithResult(_0x17b200,null))[_0xeb06('0xe')](handleError(_0x17b200,null));};exports[_0xeb06('0x44')]=function(_0x4905e1,_0x4ef6ad){return respondWithRpcPromise(_0xeb06('0x43'),_0x4905e1['query'],routingClient)[_0xeb06('0x9')](findById(_0x4905e1[_0xeb06('0x19')]['id']))[_0xeb06('0x9')](respondWithResult(_0x4ef6ad,null))[_0xeb06('0xe')](handleError(_0x4ef6ad,null));};exports[_0xeb06('0x45')]=function(_0x2b3e80,_0x2e1ed7){return respondWithRpcPromise('MailAccounts',_0x2b3e80[_0xeb06('0x17')],mailClient)[_0xeb06('0x9')](respondWithResult(_0x2e1ed7,null))['catch'](handleError(_0x2e1ed7,null));};exports[_0xeb06('0x46')]=function(_0x1bc474,_0x5744e3){return respondWithRpcPromise('OpenchannelQueues',_0x1bc474[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x5744e3,null))[_0xeb06('0xe')](handleError(_0x5744e3,null));};exports['showOpenchannelQueues']=function(_0x2982a1,_0x624e5c){return respondWithRpcPromise(_0xeb06('0x47'),_0x2982a1[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](findById(_0x2982a1[_0xeb06('0x19')]['id']))[_0xeb06('0x9')](respondWithResult(_0x624e5c,null))[_0xeb06('0xe')](handleError(_0x624e5c,null));};exports[_0xeb06('0x48')]=function(_0x281bff,_0x5eb6cf){return respondWithRpcPromise(_0xeb06('0x49'),_0x281bff[_0xeb06('0x17')],routingClient)['then'](respondWithResult(_0x5eb6cf,null))[_0xeb06('0xe')](handleError(_0x5eb6cf,null));};exports[_0xeb06('0x4a')]=function(_0x5bba46,_0x242881){return respondWithRpcPromise(_0xeb06('0x49'),_0x5bba46[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](findById(_0x5bba46[_0xeb06('0x19')]['id']))[_0xeb06('0x9')](respondWithResult(_0x242881,null))[_0xeb06('0xe')](handleError(_0x242881,null));};exports[_0xeb06('0x4b')]=function(_0x1a654e,_0x5129c7){return respondWithRpcPromise(_0xeb06('0x4c'),_0x1a654e['query'],routingClient)['then'](respondWithResult(_0x5129c7,null))[_0xeb06('0xe')](handleError(_0x5129c7,null));};exports[_0xeb06('0x4d')]=function(_0x43587c,_0x5c904c){return respondWithRpcPromise(_0xeb06('0x4c'),_0x43587c[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](findById(_0x43587c[_0xeb06('0x19')]['id']))['then'](respondWithResult(_0x5c904c,null))[_0xeb06('0xe')](handleError(_0x5c904c,null));};exports[_0xeb06('0x4e')]=function(_0x3adcd8,_0x47e65e){return respondWithRpcPromise('FaxQueues',_0x3adcd8[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x47e65e,null))[_0xeb06('0xe')](handleError(_0x47e65e,null));};exports[_0xeb06('0x4f')]=function(_0x1660c1,_0x1456e4){return respondWithRpcPromise(_0xeb06('0x50'),_0x1660c1['query'],routingClient)[_0xeb06('0x9')](findById(_0x1660c1['params']['id']))[_0xeb06('0x9')](respondWithResult(_0x1456e4,null))['catch'](handleError(_0x1456e4,null));};exports['faxAccounts']=function(_0x557bd4,_0x278883){return respondWithRpcPromise(_0xeb06('0x51'),_0x557bd4[_0xeb06('0x17')])[_0xeb06('0x9')](respondWithResult(_0x278883,null))['catch'](handleError(_0x278883,null));};exports[_0xeb06('0x52')]=function(_0x5a6b02,_0x14c332){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5a6b02[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x14c332,null))[_0xeb06('0xe')](handleError(_0x14c332,null));};exports['mailQueuesWaitingInteractions']=function(_0x2b13fa,_0x2c5b4e){return respondWithRpcPromise(_0xeb06('0x53'),_0x2b13fa[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x2c5b4e,null))[_0xeb06('0xe')](handleError(_0x2c5b4e,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x33f443,_0x935d8a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x33f443[_0xeb06('0x17')],routingClient)[_0xeb06('0x9')](respondWithResult(_0x935d8a,null))[_0xeb06('0xe')](handleError(_0x935d8a,null));};exports[_0xeb06('0x54')]=function(_0x5b10c2,_0x2f8825){return respondWithRpcPromise(_0xeb06('0x55'),_0x5b10c2[_0xeb06('0x17')],routingClient)['then'](function(_0x18eeeb){if(_0x5b10c2[_0xeb06('0x17')]['type']!==undefined){var _0x502926=_(_0x18eeeb['rows'])[_0xeb06('0x56')]([_0x5b10c2[_0xeb06('0x17')][_0xeb06('0x57')],_0x5b10c2[_0xeb06('0x19')]['id']])[_0xeb06('0x58')](_0xeb06('0x59'))[_0xeb06('0x5a')]()[_0xeb06('0x5b')]();return _0x18eeeb[_0xeb06('0x14')]['filter'](function(_0x19f50d){return _0x502926['indexOf'](_0x19f50d[_0xeb06('0x59')])>-0x1;});}else{return _0x18eeeb['rows']['filter'](function(_0x56cc34){return _0x56cc34[_0xeb06('0x59')]===parseInt(_0x5b10c2[_0xeb06('0x19')]['id']);});}})[_0xeb06('0x9')](respondWithResult(_0x2f8825,null))[_0xeb06('0xe')](handleError(_0x2f8825,null));};exports[_0xeb06('0x5c')]=function(_0x1b8bee,_0x3fb9bf){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1b8bee[_0xeb06('0x17')],routingClient)['then'](respondWithResult(_0x3fb9bf,null))[_0xeb06('0xe')](handleError(_0x3fb9bf,null));};exports[_0xeb06('0x5d')]=function(_0x52525f,_0x514fe3){return respondWithRpcPromise(_0xeb06('0x5e'),_0x52525f['query'],routingClient)[_0xeb06('0x9')](respondWithResult(_0x514fe3,null))['catch'](handleError(_0x514fe3,null));};exports[_0xeb06('0x5f')]=function(_0xcdf446,_0x3a2de0){return respondWithRpcPromise(_0xeb06('0x60'),_0xcdf446[_0xeb06('0x17')],routingClient)['then'](respondWithResult(_0x3a2de0,null))[_0xeb06('0xe')](handleError(_0x3a2de0,null));};exports['queueNotify']=function(_0x442e29){return function(_0xa42c,_0xede1a3){var _0x90be2,_0x1c7b49;var _0x4dd458=_[_0xeb06('0x61')](_0x442e29);var _0x5083fd=_0x442e29==='chat'?_0xeb06('0x62'):_0xeb06('0x63');return db[_0x4dd458+_0xeb06('0x64')][_0xeb06('0x65')]({'raw':!![],'where':{'id':_0xa42c[_0xeb06('0x19')]['id']}})[_0xeb06('0x9')](function(_0xc2d169){if(_[_0xeb06('0x12')](_0xc2d169)){throw new Error(_0x4dd458+'\x20Queue\x20not\x20found');}_0x90be2=_0xc2d169;return db[_0x4dd458+_0xeb06('0x66')][_0xeb06('0x65')]({'where':{'id':_0xa42c[_0xeb06('0x20')][_0xeb06('0x67')]},'include':[{'model':db[_0x4dd458+_0xeb06('0x68')],'as':_0xeb06('0x68')},{'model':db[_0x4dd458+_0x5083fd],'as':_0xeb06('0x63')}]});})[_0xeb06('0x9')](function(_0x717a50){if(_[_0xeb06('0x12')](_0x717a50)){throw new Error(_0x4dd458+_0xeb06('0x69'));}_0x1c7b49=_0x717a50;return _0x717a50['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeb06('0x9')](function(){var _0x50dda3={'uniqueid':_0x442e29+'.'+_0x1c7b49['id']+'.'+_0x1c7b49['Interaction']['id'],'FromUserId':_0xa42c['user']['id'],'type':'queue'};_0x50dda3[_0x4dd458+_0xeb06('0x6a')]=_0x1c7b49['id'];_0x50dda3[_0x4dd458+'InteractionId']=_0x1c7b49[_0xeb06('0x68')]['id'];_0x50dda3[_0xeb06('0x6b')+_0x4dd458+_0x5083fd+'Id']=_0x1c7b49[_0xeb06('0x63')]['id'];_0x50dda3['To'+_0x4dd458+_0xeb06('0x6c')]=_0x90be2['id'];return db[_0x4dd458+_0xeb06('0x6d')][_0xeb06('0x6e')](_0x50dda3);})[_0xeb06('0x9')](function(){return respondWithRpcPromise(_0xeb06('0x6f'),{'channel':_0x442e29,'interaction':_0x1c7b49[_0xeb06('0x68')],'message':_0x1c7b49,'account':_0x1c7b49[_0xeb06('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeb06('0x70'),'appdata':_0x90be2[_0xeb06('0x10')]+','+(_0x1c7b49[_0xeb06('0x63')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xede1a3,null))[_0xeb06('0xe')](handleError(_0xede1a3,null));};};exports[_0xeb06('0x71')]=function(_0x506008,_0x1377b1){var _0x11de42,_0x2150f3;if(_['isNil'](_0x506008[_0xeb06('0x20')][_0xeb06('0x72')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4b5b7c=_0x506008[_0xeb06('0x20')]['channel'];var _0x23ed69=_['capitalize'](_0x4b5b7c);var _0x25e387=_0x4b5b7c===_0xeb06('0x73')?_0xeb06('0x62'):_0xeb06('0x63');return db['User'][_0xeb06('0x65')]({'raw':!![],'where':{'id':_0x506008[_0xeb06('0x19')]['id'],'role':'agent'}})['then'](function(_0x445ab4){if(_['isNil'](_0x445ab4)){throw new Error(_0xeb06('0x74'));}_0x11de42=_0x445ab4;return db[_0x23ed69+_0xeb06('0x66')]['findOne']({'where':{'id':_0x506008[_0xeb06('0x20')][_0xeb06('0x67')]},'include':[{'model':db[_0x23ed69+'Interaction'],'as':_0xeb06('0x68')},{'model':db[_0x23ed69+_0x25e387],'as':_0xeb06('0x63')}]});})[_0xeb06('0x9')](function(_0x26c829){if(_[_0xeb06('0x12')](_0x26c829)){throw new Error(_0x23ed69+_0xeb06('0x69'));}_0x2150f3=_0x26c829;return _0x26c829[_0xeb06('0x75')]({'read':0x0,'readAt':null,'UserId':null});})[_0xeb06('0x9')](function(){var _0x3d4ef9={'uniqueid':_0x4b5b7c+'.'+_0x2150f3['id']+'.'+_0x2150f3[_0xeb06('0x68')]['id'],'FromUserId':_0x506008[_0xeb06('0x2f')]['id'],'type':_0xeb06('0x38'),'ToUserId':_0x11de42['id']};_0x3d4ef9[_0x23ed69+'MessageId']=_0x2150f3['id'];_0x3d4ef9[_0x23ed69+'InteractionId']=_0x2150f3[_0xeb06('0x68')]['id'];_0x3d4ef9[_0xeb06('0x6b')+_0x23ed69+_0x25e387+'Id']=_0x2150f3[_0xeb06('0x63')]['id'];return db[_0x23ed69+_0xeb06('0x6d')][_0xeb06('0x6e')](_0x3d4ef9);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4b5b7c,'interaction':_0x2150f3[_0xeb06('0x68')],'message':_0x2150f3,'account':_0x2150f3['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xeb06('0x38'),'appdata':_0x11de42[_0xeb06('0x10')]+','+(_0x2150f3['Account'][_0xeb06('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1377b1,null))[_0xeb06('0xe')](handleError(_0x1377b1,null));}; \ No newline at end of file +var _0x4604=['VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','http','client','request','then','error','code','message','result','catch','status','sendStatus','name','send','isNil','rows','find','voiceChannels'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4604,0x69));var _0x4460=function(_0x122246,_0x1619ac){_0x122246=_0x122246-0x0;var _0x1a8952=_0x4604[_0x122246];return _0x1a8952;};'use strict';var BPromise=require(_0x4460('0x0'));var moment=require(_0x4460('0x1'));var _=require(_0x4460('0x2'));var util=require(_0x4460('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4460('0x4'))(_0x4460('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x4460('0x6')]({'port':0x232a});var mailClient=jayson[_0x4460('0x7')][_0x4460('0x6')]({'port':0x232b});var routingClient=jayson[_0x4460('0x7')][_0x4460('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x5a7030,_0x52cbc3,_0x37af1b){return new BPromise(function(_0x12a486,_0x58174e){var _0x5129dc=_0x37af1b?_0x37af1b:amiClient;return _0x5129dc[_0x4460('0x8')](_0x5a7030,_0x52cbc3)[_0x4460('0x9')](function(_0x5db611){if(_0x5db611[_0x4460('0xa')]){if(_0x5db611[_0x4460('0xa')][_0x4460('0xb')]===0x1f4){return _0x58174e(_0x5db611[_0x4460('0xa')]['message']);}return _0x12a486(_0x5db611[_0x4460('0xa')][_0x4460('0xc')]);}else{_0x12a486(_0x5db611[_0x4460('0xd')]);}})[_0x4460('0xe')](function(_0x50486a){_0x58174e(_0x50486a);});});}function respondWithResult(_0x228cc9,_0x1eedc6){_0x1eedc6=_0x1eedc6||0xc8;return function(_0x53fd0c){if(_0x53fd0c){return _0x228cc9[_0x4460('0xf')](_0x1eedc6)['json'](_0x53fd0c);}return _0x228cc9[_0x4460('0x10')](0x194);};}function handleError(_0x42eac6,_0x2685f2){_0x2685f2=_0x2685f2||0x1f4;return function(_0x444406){logger[_0x4460('0xa')](_0x444406['stack']);if(_0x444406[_0x4460('0x11')]){delete _0x444406[_0x4460('0x11')];}_0x42eac6[_0x4460('0xf')](_0x2685f2)[_0x4460('0x12')](_0x444406);};}function findById(_0x4a022d){return function(_0x4ee5b9){if(!_[_0x4460('0x13')](_0x4a022d)&&!_[_0x4460('0x13')](_0x4ee5b9)&&!_[_0x4460('0x13')](_0x4ee5b9[_0x4460('0x14')])){return _[_0x4460('0x15')](_0x4ee5b9[_0x4460('0x14')],function(_0x261781){return _0x261781['id']==_0x4a022d;});}return null;};}exports[_0x4460('0x16')]=function(_0x2cbfd0,_0x4e7653){return respondWithRpcPromise(_0x4460('0x17'),_0x2cbfd0['query'])[_0x4460('0x9')](respondWithResult(_0x4e7653,null))[_0x4460('0xe')](handleError(_0x4e7653,null));};exports[_0x4460('0x18')]=function(_0x4b8777,_0x92dd4a){return respondWithRpcPromise(_0x4460('0x19'),_[_0x4460('0x1a')](_0x4b8777['query'],_0x4b8777[_0x4460('0x1b')]))[_0x4460('0x9')](respondWithResult(_0x92dd4a,null))[_0x4460('0xe')](handleError(_0x92dd4a,null));};exports[_0x4460('0x1c')]=function(_0x5d020a,_0x16dc80){return respondWithRpcPromise(_0x4460('0x1d'),_[_0x4460('0x1a')](_0x5d020a[_0x4460('0x1e')],_0x5d020a[_0x4460('0x1b')]))[_0x4460('0x9')](respondWithResult(_0x16dc80,null))[_0x4460('0xe')](handleError(_0x16dc80,null));};exports[_0x4460('0x1f')]=function(_0x15a083,_0xda47d7){return respondWithRpcPromise('VoiceQueues',_0x15a083[_0x4460('0x1e')])[_0x4460('0x9')](respondWithResult(_0xda47d7,null))[_0x4460('0xe')](handleError(_0xda47d7,null));};exports[_0x4460('0x20')]=function(_0x730d9d,_0xec3579){return respondWithRpcPromise(_0x4460('0x21'),_0x730d9d[_0x4460('0x1e')])[_0x4460('0x9')](findById(_0x730d9d['params']['id']))[_0x4460('0x9')](respondWithResult(_0xec3579,null))[_0x4460('0xe')](handleError(_0xec3579,null));};exports[_0x4460('0x22')]=function(_0x2e5a1e,_0xaca17f){return respondWithRpcPromise(_0x4460('0x23'),_[_0x4460('0x1a')](_0x2e5a1e[_0x4460('0x24')],_0x2e5a1e[_0x4460('0x1b')]))['then'](respondWithResult(_0xaca17f,null))[_0x4460('0xe')](handleError(_0xaca17f,null));};exports[_0x4460('0x25')]=function(_0x4c2617,_0x4ce997){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x4c2617['query'],_0x4c2617[_0x4460('0x1b')]))[_0x4460('0x9')](respondWithResult(_0x4ce997,null))[_0x4460('0xe')](handleError(_0x4ce997,null));};exports['voiceQueuesChannels']=function(_0x237fbb,_0x37d2fc){return respondWithRpcPromise(_0x4460('0x26'),_0x237fbb[_0x4460('0x1e')])[_0x4460('0x9')](respondWithResult(_0x37d2fc,null))['catch'](handleError(_0x37d2fc,null));};exports['voiceQueuesChannel']=function(_0x41f229,_0x4999ec){return respondWithRpcPromise(_0x4460('0x27'),_['merge'](_0x41f229[_0x4460('0x1e')],_0x41f229[_0x4460('0x1b')]))[_0x4460('0x9')](respondWithResult(_0x4999ec,null))[_0x4460('0xe')](handleError(_0x4999ec,null));};exports[_0x4460('0x28')]=function(_0x1875df,_0x403bec){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x4460('0x1a')](_0x1875df[_0x4460('0x1e')],_0x1875df['params']))['then'](respondWithResult(_0x403bec,null))[_0x4460('0xe')](handleError(_0x403bec,null));};exports[_0x4460('0x29')]=function(_0x1d2382,_0x1510f1){return respondWithRpcPromise(_0x4460('0x2a'),_['merge'](_0x1d2382[_0x4460('0x1e')],_0x1d2382[_0x4460('0x1b')]))['then'](respondWithResult(_0x1510f1,null))['catch'](handleError(_0x1510f1,null));};exports['outbound']=function(_0x22a059,_0x4e77c3){return respondWithRpcPromise(_0x4460('0x2b'),_0x22a059[_0x4460('0x1e')])[_0x4460('0x9')](respondWithResult(_0x4e77c3,null))[_0x4460('0xe')](handleError(_0x4e77c3,null));};exports[_0x4460('0x2c')]=function(_0x38ef23,_0x41ee10){return respondWithRpcPromise(_0x4460('0x2d'),_0x38ef23[_0x4460('0x1e')])[_0x4460('0x9')](respondWithResult(_0x41ee10,null))[_0x4460('0xe')](handleError(_0x41ee10,null));};exports[_0x4460('0x2e')]=function(_0xda7fd8,_0xdd7bc6){var _0x1624e5;return respondWithRpcPromise(_0x4460('0x2f'),_0xda7fd8[_0x4460('0x1e')])['then'](function(_0x9b3f5e){_0x1624e5=_0x9b3f5e;return respondWithRpcPromise(_0x4460('0x2f'),_0xda7fd8[_0x4460('0x1e')],routingClient);})[_0x4460('0x9')](function(_0x1df8fa){return _['merge']({},_0x1df8fa,_0x1624e5);})[_0x4460('0x9')](respondWithResult(_0xdd7bc6,null))['catch'](handleError(_0xdd7bc6,null));};exports[_0x4460('0x30')]=function(_0x4cd5c6,_0x137c7a){if(_0x4cd5c6['body']&&_0x4cd5c6[_0x4460('0x24')][_0x4460('0x31')]&&_0x4cd5c6[_0x4460('0x32')]&&_0x4cd5c6[_0x4460('0x32')]['name']){for(var _0x42b976 in _0x4cd5c6[_0x4460('0x24')][_0x4460('0x31')]){if(_0x4cd5c6[_0x4460('0x24')]['interaction'][_0x4460('0x33')](_0x42b976)){db[_0x4460('0x34')][_0x4460('0x35')]({'where':{'channel':_0x42b976,'membername':_0x4cd5c6[_0x4460('0x32')][_0x4460('0x11')],'type':_0x4460('0x36'),'exitAt':null,'uniqueid':_0x4cd5c6[_0x4460('0x24')][_0x4460('0x31')][_0x42b976]&&_0x4cd5c6[_0x4460('0x24')][_0x4460('0x31')][_0x42b976][_0x4460('0x37')]?{'$notIn':_0x4cd5c6['body'][_0x4460('0x31')][_0x42b976]}:{'$ne':null}}})['then'](function(_0x546a44){var _0x898931=moment()[_0x4460('0x38')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xd5ef51=0x0,_0x4474b9=_0x546a44['length'];_0xd5ef51<_0x4474b9;_0xd5ef51+=0x1){_0x546a44[_0xd5ef51][_0x4460('0x39')]({'exitAt':_0x898931});}});for(var _0x6aedd3=0x0;_0x6aedd3<_0x4cd5c6[_0x4460('0x24')][_0x4460('0x31')][_0x42b976][_0x4460('0x37')];_0x6aedd3+=0x1){db[_0x4460('0x34')][_0x4460('0x3a')]({'where':{'channel':_0x42b976,'membername':_0x4cd5c6[_0x4460('0x32')][_0x4460('0x11')],'type':_0x4460('0x36'),'uniqueid':_0x4cd5c6['body'][_0x4460('0x31')][_0x42b976][_0x6aedd3],'exitAt':null},'defaults':{'channel':_0x42b976,'membername':_0x4cd5c6[_0x4460('0x32')][_0x4460('0x11')],'interface':_[_0x4460('0x13')](_0x4cd5c6['user'][_0x4460('0x3b')])?util[_0x4460('0x38')](_0x4460('0x3c'),_0x4cd5c6[_0x4460('0x32')][_0x4460('0x11')]):_0x4cd5c6[_0x4460('0x32')][_0x4460('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x4460('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4460('0x3d'),'internal':_0x4cd5c6[_0x4460('0x32')][_0x4460('0x3e')],'uniqueid':_0x4cd5c6[_0x4460('0x24')]['interaction'][_0x42b976][_0x6aedd3]}});}}}}return respondWithRpcPromise(_0x4460('0x3f'),{'id':_0x4cd5c6[_0x4460('0x1b')]['id'],'capacity':_0x4cd5c6[_0x4460('0x24')]['capacity']},routingClient)[_0x4460('0x9')](respondWithResult(_0x137c7a,null))[_0x4460('0xe')](handleError(_0x137c7a,null));};exports[_0x4460('0x40')]=function(_0x3baf2f,_0x20404d){return respondWithRpcPromise(_0x4460('0x41'),_0x3baf2f[_0x4460('0x1e')])['then'](respondWithResult(_0x20404d,null))[_0x4460('0xe')](handleError(_0x20404d,null));};exports['trunks']=function(_0x17ae6c,_0x28407c){return respondWithRpcPromise(_0x4460('0x42'),_0x17ae6c[_0x4460('0x1e')])['then'](respondWithResult(_0x28407c,null))[_0x4460('0xe')](handleError(_0x28407c,null));};exports[_0x4460('0x43')]=function(_0x268ba2,_0x1febd4){return respondWithRpcPromise('Campaigns',_0x268ba2['query'])[_0x4460('0x9')](respondWithResult(_0x1febd4,null))[_0x4460('0xe')](handleError(_0x1febd4,null));};exports[_0x4460('0x44')]=function(_0x1a926b,_0x4e18ba){return respondWithRpcPromise(_0x4460('0x45'),_0x1a926b[_0x4460('0x1e')],routingClient)['then'](respondWithResult(_0x4e18ba,null))[_0x4460('0xe')](handleError(_0x4e18ba,null));};exports[_0x4460('0x46')]=function(_0x23b072,_0x551541){return respondWithRpcPromise(_0x4460('0x45'),_0x23b072['query'],routingClient)[_0x4460('0x9')](findById(_0x23b072[_0x4460('0x1b')]['id']))[_0x4460('0x9')](respondWithResult(_0x551541,null))[_0x4460('0xe')](handleError(_0x551541,null));};exports[_0x4460('0x47')]=function(_0xb4484f,_0x560c93){return respondWithRpcPromise(_0x4460('0x48'),_0xb4484f['query'],routingClient)[_0x4460('0x9')](respondWithResult(_0x560c93,null))[_0x4460('0xe')](handleError(_0x560c93,null));};exports[_0x4460('0x49')]=function(_0x8d97be,_0x485e59){return respondWithRpcPromise(_0x4460('0x48'),_0x8d97be[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](findById(_0x8d97be['params']['id']))[_0x4460('0x9')](respondWithResult(_0x485e59,null))[_0x4460('0xe')](handleError(_0x485e59,null));};exports['mailAccounts']=function(_0x3642fb,_0x29bee2){return respondWithRpcPromise('MailAccounts',_0x3642fb[_0x4460('0x1e')],mailClient)[_0x4460('0x9')](respondWithResult(_0x29bee2,null))['catch'](handleError(_0x29bee2,null));};exports[_0x4460('0x4a')]=function(_0x11453e,_0x409069){return respondWithRpcPromise(_0x4460('0x4b'),_0x11453e['query'],routingClient)['then'](respondWithResult(_0x409069,null))[_0x4460('0xe')](handleError(_0x409069,null));};exports[_0x4460('0x4c')]=function(_0x47568f,_0x54e0ba){return respondWithRpcPromise(_0x4460('0x4b'),_0x47568f[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](findById(_0x47568f[_0x4460('0x1b')]['id']))[_0x4460('0x9')](respondWithResult(_0x54e0ba,null))['catch'](handleError(_0x54e0ba,null));};exports[_0x4460('0x4d')]=function(_0x23b46c,_0x5c689f){return respondWithRpcPromise(_0x4460('0x4e'),_0x23b46c[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x5c689f,null))['catch'](handleError(_0x5c689f,null));};exports[_0x4460('0x4f')]=function(_0x5d230e,_0x230c9b){return respondWithRpcPromise(_0x4460('0x4e'),_0x5d230e[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](findById(_0x5d230e[_0x4460('0x1b')]['id']))['then'](respondWithResult(_0x230c9b,null))[_0x4460('0xe')](handleError(_0x230c9b,null));};exports[_0x4460('0x50')]=function(_0x330ae0,_0x13843e){return respondWithRpcPromise(_0x4460('0x51'),_0x330ae0[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x13843e,null))['catch'](handleError(_0x13843e,null));};exports[_0x4460('0x52')]=function(_0x543a01,_0x268bdb){return respondWithRpcPromise('WhatsappQueues',_0x543a01[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](findById(_0x543a01[_0x4460('0x1b')]['id']))['then'](respondWithResult(_0x268bdb,null))[_0x4460('0xe')](handleError(_0x268bdb,null));};exports[_0x4460('0x53')]=function(_0x9c0442,_0xcf5e16){return respondWithRpcPromise(_0x4460('0x54'),_0x9c0442[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0xcf5e16,null))[_0x4460('0xe')](handleError(_0xcf5e16,null));};exports[_0x4460('0x55')]=function(_0x5875d1,_0x43c30c){return respondWithRpcPromise('FaxQueues',_0x5875d1['query'],routingClient)[_0x4460('0x9')](findById(_0x5875d1['params']['id']))['then'](respondWithResult(_0x43c30c,null))[_0x4460('0xe')](handleError(_0x43c30c,null));};exports[_0x4460('0x56')]=function(_0x4f7a64,_0x5b4638){return respondWithRpcPromise(_0x4460('0x57'),_0x4f7a64['query'])[_0x4460('0x9')](respondWithResult(_0x5b4638,null))[_0x4460('0xe')](handleError(_0x5b4638,null));};exports[_0x4460('0x58')]=function(_0x350af0,_0x327a8d){return respondWithRpcPromise(_0x4460('0x59'),_0x350af0[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x327a8d,null))['catch'](handleError(_0x327a8d,null));};exports[_0x4460('0x5a')]=function(_0x3c8620,_0x47c69d){return respondWithRpcPromise(_0x4460('0x5b'),_0x3c8620[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x47c69d,null))[_0x4460('0xe')](handleError(_0x47c69d,null));};exports[_0x4460('0x5c')]=function(_0xc6510c,_0x2d1cfd){return respondWithRpcPromise(_0x4460('0x5d'),_0xc6510c[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x2d1cfd,null))[_0x4460('0xe')](handleError(_0x2d1cfd,null));};exports[_0x4460('0x5e')]=function(_0x35e83c,_0x3de9df){return respondWithRpcPromise(_0x4460('0x5d'),_0x35e83c[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](function(_0x3a37ef){if(_0x35e83c[_0x4460('0x1e')][_0x4460('0x5f')]!==undefined){var _0x5afd5e=_(_0x3a37ef['rows'])['filter']([_0x35e83c[_0x4460('0x1e')][_0x4460('0x5f')],_0x35e83c[_0x4460('0x1b')]['id']])['map'](_0x4460('0x60'))[_0x4460('0x61')]()[_0x4460('0x62')]();return _0x3a37ef[_0x4460('0x14')][_0x4460('0x63')](function(_0x43f831){return _0x5afd5e['indexOf'](_0x43f831[_0x4460('0x60')])>-0x1;});}else{return _0x3a37ef[_0x4460('0x14')][_0x4460('0x63')](function(_0xec03bf){return _0xec03bf[_0x4460('0x60')]===parseInt(_0x35e83c[_0x4460('0x1b')]['id']);});}})[_0x4460('0x9')](respondWithResult(_0x3de9df,null))[_0x4460('0xe')](handleError(_0x3de9df,null));};exports[_0x4460('0x64')]=function(_0x226c43,_0x2c03c1){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x226c43['query'],routingClient)[_0x4460('0x9')](respondWithResult(_0x2c03c1,null))[_0x4460('0xe')](handleError(_0x2c03c1,null));};exports[_0x4460('0x65')]=function(_0x347443,_0x3747d9){return respondWithRpcPromise(_0x4460('0x66'),_0x347443['query'],routingClient)[_0x4460('0x9')](respondWithResult(_0x3747d9,null))[_0x4460('0xe')](handleError(_0x3747d9,null));};exports[_0x4460('0x67')]=function(_0xdf4fb3,_0x5b23a8){return respondWithRpcPromise(_0x4460('0x68'),_0xdf4fb3[_0x4460('0x1e')],routingClient)[_0x4460('0x9')](respondWithResult(_0x5b23a8,null))[_0x4460('0xe')](handleError(_0x5b23a8,null));};exports[_0x4460('0x69')]=function(_0x2167f4){return function(_0x3349b6,_0x1ffb72){var _0x47f317,_0x5070d0;var _0x422191=_[_0x4460('0x6a')](_0x2167f4);var _0x43f0dc=_0x2167f4==='chat'?_0x4460('0x6b'):_0x4460('0x6c');return db[_0x422191+'Queue'][_0x4460('0x6d')]({'raw':!![],'where':{'id':_0x3349b6[_0x4460('0x1b')]['id']}})['then'](function(_0x54e391){if(_[_0x4460('0x13')](_0x54e391)){throw new Error(_0x422191+'\x20Queue\x20not\x20found');}_0x47f317=_0x54e391;return db[_0x422191+'Message']['findOne']({'where':{'id':_0x3349b6[_0x4460('0x24')][_0x4460('0x6e')]},'include':[{'model':db[_0x422191+_0x4460('0x6f')],'as':_0x4460('0x6f')},{'model':db[_0x422191+_0x43f0dc],'as':_0x4460('0x6c')}]});})[_0x4460('0x9')](function(_0x4dce3e){if(_[_0x4460('0x13')](_0x4dce3e)){throw new Error(_0x422191+_0x4460('0x70'));}_0x5070d0=_0x4dce3e;return _0x4dce3e[_0x4460('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x54f99e={'uniqueid':_0x2167f4+'.'+_0x5070d0['id']+'.'+_0x5070d0[_0x4460('0x6f')]['id'],'FromUserId':_0x3349b6['user']['id'],'type':_0x4460('0x72')};_0x54f99e[_0x422191+'MessageId']=_0x5070d0['id'];_0x54f99e[_0x422191+'InteractionId']=_0x5070d0[_0x4460('0x6f')]['id'];_0x54f99e[_0x4460('0x73')+_0x422191+_0x43f0dc+'Id']=_0x5070d0['Account']['id'];_0x54f99e['To'+_0x422191+_0x4460('0x74')]=_0x47f317['id'];return db[_0x422191+_0x4460('0x75')][_0x4460('0x76')](_0x54f99e);})[_0x4460('0x9')](function(){return respondWithRpcPromise(_0x4460('0x77'),{'channel':_0x2167f4,'interaction':_0x5070d0[_0x4460('0x6f')],'message':_0x5070d0,'account':_0x5070d0[_0x4460('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x47f317['name']+','+(_0x5070d0[_0x4460('0x6c')][_0x4460('0x78')]||0x12c),'interval':_0x4460('0x79')}]},routingClient);})[_0x4460('0x9')](respondWithResult(_0x1ffb72,null))[_0x4460('0xe')](handleError(_0x1ffb72,null));};};exports[_0x4460('0x7a')]=function(_0x597b61,_0x557548){var _0x9a5365,_0x9840d3;if(_['isNil'](_0x597b61[_0x4460('0x24')][_0x4460('0x7b')])){throw new Error(_0x4460('0x7c'));}var _0x2abcb9=_0x597b61[_0x4460('0x24')][_0x4460('0x7b')];var _0x183f47=_[_0x4460('0x6a')](_0x2abcb9);var _0x517989=_0x2abcb9==='chat'?_0x4460('0x6b'):_0x4460('0x6c');return db['User'][_0x4460('0x6d')]({'raw':!![],'where':{'id':_0x597b61[_0x4460('0x1b')]['id'],'role':_0x4460('0x3d')}})[_0x4460('0x9')](function(_0x228e05){if(_['isNil'](_0x228e05)){throw new Error(_0x4460('0x7d'));}_0x9a5365=_0x228e05;return db[_0x183f47+'Message']['findOne']({'where':{'id':_0x597b61[_0x4460('0x24')][_0x4460('0x6e')]},'include':[{'model':db[_0x183f47+_0x4460('0x6f')],'as':_0x4460('0x6f')},{'model':db[_0x183f47+_0x517989],'as':'Account'}]});})['then'](function(_0x110e94){if(_[_0x4460('0x13')](_0x110e94)){throw new Error(_0x183f47+'\x20Message\x20not\x20found');}_0x9840d3=_0x110e94;return _0x110e94[_0x4460('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4460('0x9')](function(){var _0x3d8ba0={'uniqueid':_0x2abcb9+'.'+_0x9840d3['id']+'.'+_0x9840d3[_0x4460('0x6f')]['id'],'FromUserId':_0x597b61[_0x4460('0x32')]['id'],'type':_0x4460('0x3d'),'ToUserId':_0x9a5365['id']};_0x3d8ba0[_0x183f47+_0x4460('0x7e')]=_0x9840d3['id'];_0x3d8ba0[_0x183f47+'InteractionId']=_0x9840d3['Interaction']['id'];_0x3d8ba0[_0x4460('0x73')+_0x183f47+_0x517989+'Id']=_0x9840d3[_0x4460('0x6c')]['id'];return db[_0x183f47+_0x4460('0x75')][_0x4460('0x76')](_0x3d8ba0);})[_0x4460('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x2abcb9,'interaction':_0x9840d3[_0x4460('0x6f')],'message':_0x9840d3,'account':_0x9840d3[_0x4460('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4460('0x3d'),'appdata':_0x9a5365[_0x4460('0x11')]+','+(_0x9840d3[_0x4460('0x6c')][_0x4460('0x7f')]||0x12c),'interval':_0x4460('0x79')}]},routingClient);})['then'](respondWithResult(_0x557548,null))[_0x4460('0xe')](handleError(_0x557548,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c088f54..66d8d84 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 _0xb1ad=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','util'];(function(_0x13a032,_0x22abbd){var _0x370344=function(_0x42b606){while(--_0x42b606){_0x13a032['push'](_0x13a032['shift']());}};_0x370344(++_0x22abbd);}(_0xb1ad,0x149));var _0xdb1a=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xb1ad[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require('multer');var util=require(_0xdb1a('0x0'));var path=require(_0xdb1a('0x1'));var timeout=require(_0xdb1a('0x2'));var express=require(_0xdb1a('0x3'));var router=express[_0xdb1a('0x4')]();var fs_extra=require(_0xdb1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb1a('0x6'));var config=require(_0xdb1a('0x7'));var controller=require(_0xdb1a('0x8'));router['get']('/',auth[_0xdb1a('0x9')](),controller[_0xdb1a('0xa')]);router[_0xdb1a('0xb')](_0xdb1a('0xc'),auth[_0xdb1a('0x9')](),controller['show']);router['get'](_0xdb1a('0xd'),auth[_0xdb1a('0x9')](),controller[_0xdb1a('0xe')]);router[_0xdb1a('0xf')]('/',auth[_0xdb1a('0x9')](),controller[_0xdb1a('0x10')]);router[_0xdb1a('0x11')](_0xdb1a('0xc'),auth[_0xdb1a('0x9')](),controller[_0xdb1a('0x12')]);router[_0xdb1a('0x13')](_0xdb1a('0xc'),auth[_0xdb1a('0x9')](),controller[_0xdb1a('0x14')]);module[_0xdb1a('0x15')]=router; \ No newline at end of file +var _0xf372=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/run','run','create','put','/:id','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x155b00,_0x507d5b){var _0x5eb933=function(_0x380501){while(--_0x380501){_0x155b00['push'](_0x155b00['shift']());}};_0x5eb933(++_0x507d5b);}(_0xf372,0x94));var _0x2f37=function(_0x28569d,_0x14fe07){_0x28569d=_0x28569d-0x0;var _0x4be535=_0xf372[_0x28569d];return _0x4be535;};'use strict';var multer=require('multer');var util=require(_0x2f37('0x0'));var path=require(_0x2f37('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f37('0x2'));var router=express[_0x2f37('0x3')]();var fs_extra=require(_0x2f37('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2f37('0x5'));var config=require(_0x2f37('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0x2f37('0x7')](),controller[_0x2f37('0x8')]);router[_0x2f37('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2f37('0x9')](_0x2f37('0xa'),auth[_0x2f37('0x7')](),controller[_0x2f37('0xb')]);router['post']('/',auth[_0x2f37('0x7')](),controller[_0x2f37('0xc')]);router[_0x2f37('0xd')](_0x2f37('0xe'),auth[_0x2f37('0x7')](),controller['update']);router['delete'](_0x2f37('0xe'),auth[_0x2f37('0x7')](),controller[_0x2f37('0xf')]);module[_0x2f37('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 46c4eda..eab6ceb 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 _0x9683=['default','custom','TEXT','BOOLEAN','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','xlsx'];(function(_0x1e837b,_0x16abe2){var _0x209765=function(_0x406ef2){while(--_0x406ef2){_0x1e837b['push'](_0x1e837b['shift']());}};_0x209765(++_0x16abe2);}(_0x9683,0x124));var _0x3968=function(_0x18ea53,_0x1b8623){_0x18ea53=_0x18ea53-0x0;var _0x213f94=_0x9683[_0x18ea53];return _0x213f94;};'use strict';var Sequelize=require('sequelize');module[_0x3968('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3968('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3968('0x1')],'allowNull':![],'defaultValue':_0x3968('0x2')},'startAt':{'type':Sequelize[_0x3968('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3968('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3968('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3968('0x5')]('years',_0x3968('0x6'),_0x3968('0x7'),_0x3968('0x8'),_0x3968('0x9'),_0x3968('0xa'),_0x3968('0xb')),'allowNull':![],'defaultValue':_0x3968('0x9')},'output':{'type':Sequelize[_0x3968('0x5')](_0x3968('0xc'),'pdf',_0x3968('0xd')),'allowNull':![],'defaultValue':_0x3968('0xc')},'type':{'type':Sequelize[_0x3968('0x5')]('custom',_0x3968('0xe')),'allowNull':![],'defaultValue':_0x3968('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x3968('0x1')]},'cc':{'type':Sequelize[_0x3968('0x10')]},'bcc':{'type':Sequelize[_0x3968('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x3968('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd0c7=['STRING','BOOLEAN','DATE','ENUM','years','quarters','months','weeks','minutes','days','csv','xlsx','default','custom','TEXT','sequelize','exports'];(function(_0xf49aea,_0x2bef17){var _0x277be5=function(_0x20ebeb){while(--_0x20ebeb){_0xf49aea['push'](_0xf49aea['shift']());}};_0x277be5(++_0x2bef17);}(_0xd0c7,0x97));var _0x7d0c=function(_0xac696d,_0x185493){_0xac696d=_0xac696d-0x0;var _0x435a31=_0xd0c7[_0xac696d];return _0x435a31;};'use strict';var Sequelize=require(_0x7d0c('0x0'));module[_0x7d0c('0x1')]={'name':{'type':Sequelize[_0x7d0c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d0c('0x2')]},'active':{'type':Sequelize[_0x7d0c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7d0c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x7d0c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7d0c('0x5')](_0x7d0c('0x6'),_0x7d0c('0x7'),_0x7d0c('0x8'),_0x7d0c('0x9'),'days','hours',_0x7d0c('0xa')),'allowNull':![],'defaultValue':_0x7d0c('0xb')},'output':{'type':Sequelize[_0x7d0c('0x5')](_0x7d0c('0xc'),'pdf',_0x7d0c('0xd')),'allowNull':![],'defaultValue':_0x7d0c('0xc')},'type':{'type':Sequelize[_0x7d0c('0x5')]('custom',_0x7d0c('0xe')),'allowNull':![],'defaultValue':_0x7d0c('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7d0c('0x2')]},'cc':{'type':Sequelize[_0x7d0c('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7d0c('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 1419488..71408db 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 _0xa6d9=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Scheduler','error','stack','name','send','index','Schedule','fieldName','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','merge','create','body','user','role','UserProfileSection','find','autoAssociation','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x160cd5,_0x19c58e){var _0x366763=function(_0x3b8e31){while(--_0x3b8e31){_0x160cd5['push'](_0x160cd5['shift']());}};_0x366763(++_0x19c58e);}(_0xa6d9,0x197));var _0x9a6d=function(_0xd83b7f,_0x2943c0){_0xd83b7f=_0xd83b7f-0x0;var _0x3bf85e=_0xa6d9[_0xd83b7f];return _0x3bf85e;};'use strict';var emlformat=require(_0x9a6d('0x0'));var rimraf=require(_0x9a6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a6d('0x2'));var rp=require(_0x9a6d('0x3'));var moment=require(_0x9a6d('0x4'));var BPromise=require(_0x9a6d('0x5'));var Mustache=require(_0x9a6d('0x6'));var util=require(_0x9a6d('0x7'));var path=require(_0x9a6d('0x8'));var sox=require(_0x9a6d('0x9'));var csv=require('to-csv');var ejs=require(_0x9a6d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a6d('0xb'));var squel=require('squel');var crypto=require(_0x9a6d('0xc'));var jsforce=require(_0x9a6d('0xd'));var deskjs=require(_0x9a6d('0xe'));var toCsv=require(_0x9a6d('0xf'));var querystring=require(_0x9a6d('0x10'));var Papa=require(_0x9a6d('0x11'));var Redis=require(_0x9a6d('0x12'));var authService=require(_0x9a6d('0x13'));var qs=require(_0x9a6d('0x14'));var as=require(_0x9a6d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9a6d('0x16'));var utils=require(_0x9a6d('0x17'));var config=require(_0x9a6d('0x18'));var licenseUtil=require(_0x9a6d('0x19'));var db=require(_0x9a6d('0x1a'))['db'];function respondWithStatusCode(_0x46202e,_0x535c6a){_0x535c6a=_0x535c6a||0xcc;return function(_0x478aef){if(_0x478aef){return _0x46202e[_0x9a6d('0x1b')](_0x535c6a);}return _0x46202e[_0x9a6d('0x1c')](_0x535c6a)[_0x9a6d('0x1d')]();};}function respondWithResult(_0x49d7eb,_0x328aa0){_0x328aa0=_0x328aa0||0xc8;return function(_0x4c9ace){if(_0x4c9ace){return _0x49d7eb['status'](_0x328aa0)['json'](_0x4c9ace);}};}function respondWithFilteredResult(_0x37db5e,_0x21abc4){return function(_0x53a467){if(_0x53a467){var _0x1c35ad=typeof _0x21abc4[_0x9a6d('0x1e')]===_0x9a6d('0x1f')&&typeof _0x21abc4[_0x9a6d('0x20')]===_0x9a6d('0x1f');var _0x46616f=_0x53a467['count'];var _0x14af71=_0x1c35ad?0x0:_0x21abc4[_0x9a6d('0x1e')];var _0x51722d=_0x1c35ad?_0x53a467['count']:_0x21abc4[_0x9a6d('0x1e')]+_0x21abc4[_0x9a6d('0x20')];var _0x4836d0;if(_0x51722d>=_0x46616f){_0x51722d=_0x46616f;_0x4836d0=0xc8;}else{_0x4836d0=0xce;}_0x37db5e[_0x9a6d('0x1c')](_0x4836d0);return _0x37db5e[_0x9a6d('0x21')](_0x9a6d('0x22'),_0x14af71+'-'+_0x51722d+'/'+_0x46616f)['json'](_0x53a467);}return null;};}function patchUpdates(_0x57c414){return function(_0xa02be){try{jsonpatch['apply'](_0xa02be,_0x57c414,!![]);}catch(_0x452b68){return BPromise[_0x9a6d('0x23')](_0x452b68);}return _0xa02be[_0x9a6d('0x24')]();};}function saveUpdates(_0x20b3af,_0x4549ba){return function(_0x53d3a0){if(_0x53d3a0){return _0x53d3a0[_0x9a6d('0x25')](_0x20b3af)[_0x9a6d('0x26')](function(_0x1856ee){return _0x1856ee;});}return null;};}function removeEntity(_0x3bd16b,_0x3a47fb){return function(_0x391681){if(_0x391681){return _0x391681[_0x9a6d('0x27')]()[_0x9a6d('0x26')](function(){var _0xf7592f=_0x391681[_0x9a6d('0x28')]({'plain':!![]});var _0x51024b=_0x9a6d('0x29');return db['UserProfileResource'][_0x9a6d('0x27')]({'where':{'type':_0x51024b,'resourceId':_0xf7592f['id']}})[_0x9a6d('0x26')](function(){return _0x391681;});})['then'](function(){_0x3bd16b[_0x9a6d('0x1c')](0xcc)[_0x9a6d('0x1d')]();});}};}function handleEntityNotFound(_0x2c863a,_0x7994f2){return function(_0x418e4f){if(!_0x418e4f){_0x2c863a[_0x9a6d('0x1b')](0x194);}return _0x418e4f;};}function handleError(_0x5ae117,_0x5c6fcc){_0x5c6fcc=_0x5c6fcc||0x1f4;return function(_0x559cab){logger[_0x9a6d('0x2a')](_0x559cab[_0x9a6d('0x2b')]);if(_0x559cab[_0x9a6d('0x2c')]){delete _0x559cab['name'];}_0x5ae117['status'](_0x5c6fcc)[_0x9a6d('0x2d')](_0x559cab);};}exports[_0x9a6d('0x2e')]=function(_0x352a38,_0x30175c){var _0x46c1fa={},_0x395bdf={},_0x11c581={'count':0x0,'rows':[]};var _0x1ff9c3=_['map'](db[_0x9a6d('0x2f')]['rawAttributes'],function(_0x36eaca){return{'name':_0x36eaca[_0x9a6d('0x30')],'type':_0x36eaca['type']['key']};});_0x395bdf[_0x9a6d('0x31')]=_[_0x9a6d('0x32')](_0x1ff9c3,_0x9a6d('0x2c'));_0x395bdf['query']=_[_0x9a6d('0x33')](_0x352a38[_0x9a6d('0x34')]);_0x395bdf['filters']=_['intersection'](_0x395bdf[_0x9a6d('0x31')],_0x395bdf[_0x9a6d('0x34')]);_0x46c1fa[_0x9a6d('0x35')]=_[_0x9a6d('0x36')](_0x395bdf[_0x9a6d('0x31')],qs[_0x9a6d('0x37')](_0x352a38[_0x9a6d('0x34')][_0x9a6d('0x37')]));_0x46c1fa[_0x9a6d('0x35')]=_0x46c1fa[_0x9a6d('0x35')][_0x9a6d('0x38')]?_0x46c1fa[_0x9a6d('0x35')]:_0x395bdf['model'];if(!_0x352a38['query'][_0x9a6d('0x39')](_0x9a6d('0x3a'))){_0x46c1fa[_0x9a6d('0x20')]=qs['limit'](_0x352a38['query'][_0x9a6d('0x20')]);_0x46c1fa[_0x9a6d('0x1e')]=qs['offset'](_0x352a38[_0x9a6d('0x34')][_0x9a6d('0x1e')]);}_0x46c1fa[_0x9a6d('0x3b')]=qs[_0x9a6d('0x3c')](_0x352a38['query'][_0x9a6d('0x3c')]);_0x46c1fa[_0x9a6d('0x3d')]=qs['filters'](_[_0x9a6d('0x3e')](_0x352a38[_0x9a6d('0x34')],_0x395bdf[_0x9a6d('0x3f')]),_0x1ff9c3);if(_0x352a38[_0x9a6d('0x34')][_0x9a6d('0x40')]){_0x46c1fa[_0x9a6d('0x3d')]=_['merge'](_0x46c1fa[_0x9a6d('0x3d')],{'$or':_[_0x9a6d('0x32')](_0x1ff9c3,function(_0x24ddcd){if(_0x24ddcd['type']!==_0x9a6d('0x41')){var _0x234117={};_0x234117[_0x24ddcd[_0x9a6d('0x2c')]]={'$like':'%'+_0x352a38[_0x9a6d('0x34')][_0x9a6d('0x40')]+'%'};return _0x234117;}})});}_0x46c1fa=_['merge']({},_0x46c1fa,_0x352a38[_0x9a6d('0x42')]);var _0x43ae7f={'where':_0x46c1fa[_0x9a6d('0x3d')]};return db[_0x9a6d('0x2f')][_0x9a6d('0x43')](_0x43ae7f)[_0x9a6d('0x26')](function(_0x22e8b6){_0x11c581[_0x9a6d('0x43')]=_0x22e8b6;if(_0x352a38[_0x9a6d('0x34')][_0x9a6d('0x44')]){_0x46c1fa['include']=[{'all':!![]}];}return db[_0x9a6d('0x2f')][_0x9a6d('0x45')](_0x46c1fa);})[_0x9a6d('0x26')](function(_0x2c5818){_0x11c581[_0x9a6d('0x46')]=_0x2c5818;return _0x11c581;})[_0x9a6d('0x26')](respondWithFilteredResult(_0x30175c,_0x46c1fa))[_0x9a6d('0x47')](handleError(_0x30175c,null));};exports[_0x9a6d('0x48')]=function(_0x1fdbac,_0x2448b9){var _0x58fcf6={'raw':![],'where':{'id':_0x1fdbac[_0x9a6d('0x49')]['id']}},_0x3912ed={};_0x3912ed[_0x9a6d('0x31')]=_[_0x9a6d('0x33')](db[_0x9a6d('0x2f')]['rawAttributes']);_0x3912ed['query']=_['keys'](_0x1fdbac[_0x9a6d('0x34')]);_0x3912ed[_0x9a6d('0x3f')]=_[_0x9a6d('0x36')](_0x3912ed[_0x9a6d('0x31')],_0x3912ed[_0x9a6d('0x34')]);_0x58fcf6[_0x9a6d('0x35')]=_[_0x9a6d('0x36')](_0x3912ed['model'],qs[_0x9a6d('0x37')](_0x1fdbac[_0x9a6d('0x34')][_0x9a6d('0x37')]));_0x58fcf6[_0x9a6d('0x35')]=_0x58fcf6[_0x9a6d('0x35')][_0x9a6d('0x38')]?_0x58fcf6['attributes']:_0x3912ed[_0x9a6d('0x31')];if(_0x1fdbac['query'][_0x9a6d('0x44')]){_0x58fcf6[_0x9a6d('0x4a')]=[{'all':!![]}];}_0x58fcf6=_[_0x9a6d('0x4b')]({},_0x58fcf6,_0x1fdbac['options']);return db[_0x9a6d('0x2f')]['find'](_0x58fcf6)[_0x9a6d('0x26')](handleEntityNotFound(_0x2448b9,null))[_0x9a6d('0x26')](respondWithResult(_0x2448b9,null))['catch'](handleError(_0x2448b9,null));};exports[_0x9a6d('0x4c')]=function(_0x494aeb,_0x1e3153){return db[_0x9a6d('0x2f')][_0x9a6d('0x4c')](_0x494aeb[_0x9a6d('0x4d')],{})[_0x9a6d('0x26')](function(_0x337a3d){var _0x5bd350=_0x494aeb[_0x9a6d('0x4e')][_0x9a6d('0x28')]({'plain':!![]});if(!_0x5bd350)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bd350[_0x9a6d('0x4f')]===_0x9a6d('0x4e')){var _0x83a5cf=_0x337a3d[_0x9a6d('0x28')]({'plain':!![]});var _0x5d1d59=_0x9a6d('0x29');return db[_0x9a6d('0x50')][_0x9a6d('0x51')]({'where':{'name':_0x5d1d59,'userProfileId':_0x5bd350['userProfileId']},'raw':!![]})[_0x9a6d('0x26')](function(_0xea5e14){if(_0xea5e14&&_0xea5e14[_0x9a6d('0x52')]===0x0){return db['UserProfileResource'][_0x9a6d('0x4c')]({'name':_0x83a5cf[_0x9a6d('0x2c')],'resourceId':_0x83a5cf['id'],'type':_0xea5e14['name'],'sectionId':_0xea5e14['id']},{})['then'](function(){return _0x337a3d;});}else{return _0x337a3d;}})['catch'](function(_0xbdd5d7){logger[_0x9a6d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbdd5d7);throw _0xbdd5d7;});}return _0x337a3d;})['then'](respondWithResult(_0x1e3153,0xc9))['catch'](handleError(_0x1e3153,null));};exports[_0x9a6d('0x25')]=function(_0x4e3338,_0x1b59a9){if(_0x4e3338[_0x9a6d('0x4d')]['id']){delete _0x4e3338[_0x9a6d('0x4d')]['id'];}return db[_0x9a6d('0x2f')][_0x9a6d('0x51')]({'where':{'id':_0x4e3338[_0x9a6d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b59a9,null))[_0x9a6d('0x26')](saveUpdates(_0x4e3338[_0x9a6d('0x4d')],null))['then'](respondWithResult(_0x1b59a9,null))[_0x9a6d('0x47')](handleError(_0x1b59a9,null));};exports[_0x9a6d('0x27')]=function(_0x5e4074,_0x42008e){return db[_0x9a6d('0x2f')][_0x9a6d('0x51')]({'where':{'id':_0x5e4074[_0x9a6d('0x49')]['id']}})['then'](handleEntityNotFound(_0x42008e,null))[_0x9a6d('0x26')](removeEntity(_0x42008e,null))[_0x9a6d('0x47')](handleError(_0x42008e,null));};exports[_0x9a6d('0x53')]=function(_0x2c749d,_0x2c631c,_0x5a130c){var _0x29b1d6=require(_0x9a6d('0x54'));return db[_0x9a6d('0x2f')][_0x9a6d('0x51')]({'where':{'id':_0x2c749d[_0x9a6d('0x49')]['id']},'raw':!![]})[_0x9a6d('0x26')](handleEntityNotFound(_0x2c631c,null))[_0x9a6d('0x26')](function(){_0x29b1d6[_0x9a6d('0x53')](_0x2c749d[_0x9a6d('0x49')]['id']);})[_0x9a6d('0x26')](respondWithStatusCode(_0x2c631c,null))[_0x9a6d('0x47')](handleError(_0x2c631c,null));}; \ No newline at end of file +var _0xdf89=['options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','../../config/schedule','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','sendStatus','error','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x586877,_0x56eb61){var _0x36ad98=function(_0x41d31f){while(--_0x41d31f){_0x586877['push'](_0x586877['shift']());}};_0x36ad98(++_0x56eb61);}(_0xdf89,0xbc));var _0x9df8=function(_0x32926a,_0xb9f7e9){_0x32926a=_0x32926a-0x0;var _0x1856e4=_0xdf89[_0x32926a];return _0x1856e4;};'use strict';var emlformat=require(_0x9df8('0x0'));var rimraf=require(_0x9df8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9df8('0x2'));var rp=require(_0x9df8('0x3'));var moment=require(_0x9df8('0x4'));var BPromise=require(_0x9df8('0x5'));var Mustache=require(_0x9df8('0x6'));var util=require(_0x9df8('0x7'));var path=require(_0x9df8('0x8'));var sox=require('sox');var csv=require(_0x9df8('0x9'));var ejs=require(_0x9df8('0xa'));var fs=require('fs');var fs_extra=require(_0x9df8('0xb'));var _=require(_0x9df8('0xc'));var squel=require(_0x9df8('0xd'));var crypto=require(_0x9df8('0xe'));var jsforce=require(_0x9df8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9df8('0x10'));var Papa=require('papaparse');var Redis=require(_0x9df8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9df8('0x12'));var as=require(_0x9df8('0x13'));var hardwareService=require(_0x9df8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9df8('0x15'));var config=require(_0x9df8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9df8('0x17'))['db'];function respondWithStatusCode(_0x42a15e,_0x5ca502){_0x5ca502=_0x5ca502||0xcc;return function(_0x2de999){if(_0x2de999){return _0x42a15e['sendStatus'](_0x5ca502);}return _0x42a15e[_0x9df8('0x18')](_0x5ca502)[_0x9df8('0x19')]();};}function respondWithResult(_0x20e4f8,_0x19a94a){_0x19a94a=_0x19a94a||0xc8;return function(_0x4a7757){if(_0x4a7757){return _0x20e4f8[_0x9df8('0x18')](_0x19a94a)[_0x9df8('0x1a')](_0x4a7757);}};}function respondWithFilteredResult(_0x10f37c,_0x4c6bb8){return function(_0x1a15c4){if(_0x1a15c4){var _0x203cb7=typeof _0x4c6bb8[_0x9df8('0x1b')]==='undefined'&&typeof _0x4c6bb8['limit']===_0x9df8('0x1c');var _0x57f6a0=_0x1a15c4['count'];var _0x298901=_0x203cb7?0x0:_0x4c6bb8['offset'];var _0x100833=_0x203cb7?_0x1a15c4[_0x9df8('0x1d')]:_0x4c6bb8[_0x9df8('0x1b')]+_0x4c6bb8[_0x9df8('0x1e')];var _0x47d8cd;if(_0x100833>=_0x57f6a0){_0x100833=_0x57f6a0;_0x47d8cd=0xc8;}else{_0x47d8cd=0xce;}_0x10f37c[_0x9df8('0x18')](_0x47d8cd);return _0x10f37c[_0x9df8('0x1f')](_0x9df8('0x20'),_0x298901+'-'+_0x100833+'/'+_0x57f6a0)[_0x9df8('0x1a')](_0x1a15c4);}return null;};}function patchUpdates(_0x5507c8){return function(_0x105856){try{jsonpatch[_0x9df8('0x21')](_0x105856,_0x5507c8,!![]);}catch(_0x576ee7){return BPromise['reject'](_0x576ee7);}return _0x105856[_0x9df8('0x22')]();};}function saveUpdates(_0x2c0caf,_0x4efff2){return function(_0x54a89b){if(_0x54a89b){return _0x54a89b[_0x9df8('0x23')](_0x2c0caf)[_0x9df8('0x24')](function(_0x5d4a86){return _0x5d4a86;});}return null;};}function removeEntity(_0x1bf6c2,_0xf6fd35){return function(_0x5a76e5){if(_0x5a76e5){return _0x5a76e5[_0x9df8('0x25')]()[_0x9df8('0x24')](function(){var _0x52b152=_0x5a76e5[_0x9df8('0x26')]({'plain':!![]});var _0x3cb6f6=_0x9df8('0x27');return db['UserProfileResource'][_0x9df8('0x25')]({'where':{'type':_0x3cb6f6,'resourceId':_0x52b152['id']}})['then'](function(){return _0x5a76e5;});})['then'](function(){_0x1bf6c2[_0x9df8('0x18')](0xcc)[_0x9df8('0x19')]();});}};}function handleEntityNotFound(_0x4f2732,_0x206450){return function(_0x36effc){if(!_0x36effc){_0x4f2732[_0x9df8('0x28')](0x194);}return _0x36effc;};}function handleError(_0x161c5e,_0x192705){_0x192705=_0x192705||0x1f4;return function(_0x4a2f2d){logger[_0x9df8('0x29')](_0x4a2f2d['stack']);if(_0x4a2f2d[_0x9df8('0x2a')]){delete _0x4a2f2d[_0x9df8('0x2a')];}_0x161c5e[_0x9df8('0x18')](_0x192705)[_0x9df8('0x2b')](_0x4a2f2d);};}exports['index']=function(_0x2915b5,_0x5b1c54){var _0x47f874={},_0x2c850f={},_0x2be755={'count':0x0,'rows':[]};var _0x25dbd3=_[_0x9df8('0x2c')](db[_0x9df8('0x2d')][_0x9df8('0x2e')],function(_0x5c3340){return{'name':_0x5c3340[_0x9df8('0x2f')],'type':_0x5c3340[_0x9df8('0x30')][_0x9df8('0x31')]};});_0x2c850f[_0x9df8('0x32')]=_['map'](_0x25dbd3,_0x9df8('0x2a'));_0x2c850f[_0x9df8('0x33')]=_[_0x9df8('0x34')](_0x2915b5[_0x9df8('0x33')]);_0x2c850f[_0x9df8('0x35')]=_['intersection'](_0x2c850f['model'],_0x2c850f['query']);_0x47f874[_0x9df8('0x36')]=_[_0x9df8('0x37')](_0x2c850f[_0x9df8('0x32')],qs[_0x9df8('0x38')](_0x2915b5[_0x9df8('0x33')][_0x9df8('0x38')]));_0x47f874[_0x9df8('0x36')]=_0x47f874['attributes'][_0x9df8('0x39')]?_0x47f874[_0x9df8('0x36')]:_0x2c850f[_0x9df8('0x32')];if(!_0x2915b5[_0x9df8('0x33')][_0x9df8('0x3a')](_0x9df8('0x3b'))){_0x47f874[_0x9df8('0x1e')]=qs[_0x9df8('0x1e')](_0x2915b5[_0x9df8('0x33')][_0x9df8('0x1e')]);_0x47f874[_0x9df8('0x1b')]=qs[_0x9df8('0x1b')](_0x2915b5['query'][_0x9df8('0x1b')]);}_0x47f874[_0x9df8('0x3c')]=qs['sort'](_0x2915b5['query'][_0x9df8('0x3d')]);_0x47f874[_0x9df8('0x3e')]=qs[_0x9df8('0x35')](_[_0x9df8('0x3f')](_0x2915b5[_0x9df8('0x33')],_0x2c850f[_0x9df8('0x35')]),_0x25dbd3);if(_0x2915b5[_0x9df8('0x33')][_0x9df8('0x40')]){_0x47f874[_0x9df8('0x3e')]=_[_0x9df8('0x41')](_0x47f874[_0x9df8('0x3e')],{'$or':_['map'](_0x25dbd3,function(_0x325805){if(_0x325805['type']!==_0x9df8('0x42')){var _0x1fc217={};_0x1fc217[_0x325805['name']]={'$like':'%'+_0x2915b5['query'][_0x9df8('0x40')]+'%'};return _0x1fc217;}})});}_0x47f874=_['merge']({},_0x47f874,_0x2915b5[_0x9df8('0x43')]);var _0x13ee83={'where':_0x47f874[_0x9df8('0x3e')]};return db['Schedule'][_0x9df8('0x1d')](_0x13ee83)[_0x9df8('0x24')](function(_0x16995c){_0x2be755[_0x9df8('0x1d')]=_0x16995c;if(_0x2915b5['query'][_0x9df8('0x44')]){_0x47f874[_0x9df8('0x45')]=[{'all':!![]}];}return db[_0x9df8('0x2d')]['findAll'](_0x47f874);})[_0x9df8('0x24')](function(_0x12b0ca){_0x2be755[_0x9df8('0x46')]=_0x12b0ca;return _0x2be755;})[_0x9df8('0x24')](respondWithFilteredResult(_0x5b1c54,_0x47f874))[_0x9df8('0x47')](handleError(_0x5b1c54,null));};exports[_0x9df8('0x48')]=function(_0x5b1a20,_0x57ff36){var _0x26324d={'raw':![],'where':{'id':_0x5b1a20[_0x9df8('0x49')]['id']}},_0x25a057={};_0x25a057[_0x9df8('0x32')]=_[_0x9df8('0x34')](db['Schedule'][_0x9df8('0x2e')]);_0x25a057['query']=_[_0x9df8('0x34')](_0x5b1a20['query']);_0x25a057[_0x9df8('0x35')]=_['intersection'](_0x25a057[_0x9df8('0x32')],_0x25a057[_0x9df8('0x33')]);_0x26324d[_0x9df8('0x36')]=_[_0x9df8('0x37')](_0x25a057[_0x9df8('0x32')],qs[_0x9df8('0x38')](_0x5b1a20[_0x9df8('0x33')][_0x9df8('0x38')]));_0x26324d[_0x9df8('0x36')]=_0x26324d[_0x9df8('0x36')][_0x9df8('0x39')]?_0x26324d['attributes']:_0x25a057[_0x9df8('0x32')];if(_0x5b1a20[_0x9df8('0x33')]['includeAll']){_0x26324d[_0x9df8('0x45')]=[{'all':!![]}];}_0x26324d=_[_0x9df8('0x41')]({},_0x26324d,_0x5b1a20[_0x9df8('0x43')]);return db[_0x9df8('0x2d')]['find'](_0x26324d)[_0x9df8('0x24')](handleEntityNotFound(_0x57ff36,null))['then'](respondWithResult(_0x57ff36,null))[_0x9df8('0x47')](handleError(_0x57ff36,null));};exports[_0x9df8('0x4a')]=function(_0x33ba38,_0x2c1743){return db[_0x9df8('0x2d')]['create'](_0x33ba38['body'],{})[_0x9df8('0x24')](function(_0x4495a7){var _0x3e3cce=_0x33ba38[_0x9df8('0x4b')]['get']({'plain':!![]});if(!_0x3e3cce)throw new Error(_0x9df8('0x4c'));if(_0x3e3cce[_0x9df8('0x4d')]===_0x9df8('0x4b')){var _0x23c99d=_0x4495a7[_0x9df8('0x26')]({'plain':!![]});var _0x598e23='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x598e23,'userProfileId':_0x3e3cce[_0x9df8('0x4e')]},'raw':!![]})[_0x9df8('0x24')](function(_0x5b16cb){if(_0x5b16cb&&_0x5b16cb[_0x9df8('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x23c99d[_0x9df8('0x2a')],'resourceId':_0x23c99d['id'],'type':_0x5b16cb['name'],'sectionId':_0x5b16cb['id']},{})[_0x9df8('0x24')](function(){return _0x4495a7;});}else{return _0x4495a7;}})['catch'](function(_0x268597){logger['error'](_0x9df8('0x50'),_0x268597);throw _0x268597;});}return _0x4495a7;})[_0x9df8('0x24')](respondWithResult(_0x2c1743,0xc9))[_0x9df8('0x47')](handleError(_0x2c1743,null));};exports[_0x9df8('0x23')]=function(_0xaed3a9,_0x3508a5){if(_0xaed3a9[_0x9df8('0x51')]['id']){delete _0xaed3a9['body']['id'];}return db[_0x9df8('0x2d')][_0x9df8('0x52')]({'where':{'id':_0xaed3a9['params']['id']}})[_0x9df8('0x24')](handleEntityNotFound(_0x3508a5,null))[_0x9df8('0x24')](saveUpdates(_0xaed3a9['body'],null))[_0x9df8('0x24')](respondWithResult(_0x3508a5,null))[_0x9df8('0x47')](handleError(_0x3508a5,null));};exports[_0x9df8('0x25')]=function(_0x32dfc2,_0xfc0eb5){return db[_0x9df8('0x2d')][_0x9df8('0x52')]({'where':{'id':_0x32dfc2[_0x9df8('0x49')]['id']}})['then'](handleEntityNotFound(_0xfc0eb5,null))[_0x9df8('0x24')](removeEntity(_0xfc0eb5,null))[_0x9df8('0x47')](handleError(_0xfc0eb5,null));};exports['run']=function(_0x5b5b62,_0xdcfc97,_0x435d2c){var _0x52ee00=require(_0x9df8('0x53'));return db[_0x9df8('0x2d')][_0x9df8('0x52')]({'where':{'id':_0x5b5b62[_0x9df8('0x49')]['id']},'raw':!![]})[_0x9df8('0x24')](handleEntityNotFound(_0xdcfc97,null))[_0x9df8('0x24')](function(){_0x52ee00[_0x9df8('0x54')](_0x5b5b62[_0x9df8('0x49')]['id']);})[_0x9df8('0x24')](respondWithStatusCode(_0xdcfc97,null))[_0x9df8('0x47')](handleError(_0xdcfc97,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3ed284c..a838116 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 _0xd561=['./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd561,0x189));var _0x1d56=function(_0x51c200,_0x2c3223){_0x51c200=_0x51c200-0x0;var _0x38ca3f=_0xd561[_0x51c200];return _0x38ca3f;};'use strict';var _=require(_0x1d56('0x0'));var util=require(_0x1d56('0x1'));var logger=require(_0x1d56('0x2'))(_0x1d56('0x3'));var moment=require('moment');var BPromise=require(_0x1d56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d56('0x5'));var rimraf=require('rimraf');var config=require(_0x1d56('0x6'));var attributes=require(_0x1d56('0x7'));module[_0x1d56('0x8')]=function(_0x36d609,_0xf740ea){return _0x36d609['define'](_0x1d56('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f36=['bluebird','path','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','api','moment'];(function(_0x693580,_0x246929){var _0x405e7c=function(_0x5005aa){while(--_0x5005aa){_0x693580['push'](_0x693580['shift']());}};_0x405e7c(++_0x246929);}(_0x7f36,0x15c));var _0x67f3=function(_0x32a49c,_0x59d008){_0x32a49c=_0x32a49c-0x0;var _0x263e80=_0x7f36[_0x32a49c];return _0x263e80;};'use strict';var _=require(_0x67f3('0x0'));var util=require(_0x67f3('0x1'));var logger=require('../../config/logger')(_0x67f3('0x2'));var moment=require(_0x67f3('0x3'));var BPromise=require(_0x67f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67f3('0x5'));var rimraf=require('rimraf');var config=require(_0x67f3('0x6'));var attributes=require('./schedule.attributes');module[_0x67f3('0x7')]=function(_0x4c86f8,_0x431e44){return _0x4c86f8[_0x67f3('0x8')](_0x67f3('0x9'),attributes,{'tableName':_0x67f3('0xa'),'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 3a916e0..ff04bdc 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 _0xaf2d=['info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x465e14,_0x17c84d){var _0x5c0466=function(_0xe6d67a){while(--_0xe6d67a){_0x465e14['push'](_0x465e14['shift']());}};_0x5c0466(++_0x17c84d);}(_0xaf2d,0x172));var _0xdaf2=function(_0x1d8807,_0x1dd7f8){_0x1d8807=_0x1d8807-0x0;var _0x144497=_0xaf2d[_0x1d8807];return _0x144497;};'use strict';var _=require(_0xdaf2('0x0'));var util=require(_0xdaf2('0x1'));var moment=require(_0xdaf2('0x2'));var BPromise=require('bluebird');var rs=require(_0xdaf2('0x3'));var fs=require('fs');var Redis=require(_0xdaf2('0x4'));var db=require(_0xdaf2('0x5'))['db'];var utils=require(_0xdaf2('0x6'));var logger=require(_0xdaf2('0x7'))('rpc');var config=require(_0xdaf2('0x8'));var jayson=require(_0xdaf2('0x9'));var client=jayson[_0xdaf2('0xa')][_0xdaf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x246219,_0x3126f5,_0x3c6cca){return new BPromise(function(_0x2e3971,_0x4ecccc){return client[_0xdaf2('0xc')](_0x246219,_0x3c6cca)[_0xdaf2('0xd')](function(_0x1636eb){logger[_0xdaf2('0xe')](_0xdaf2('0xf'),_0x3126f5,'request\x20sent');logger[_0xdaf2('0x10')](_0xdaf2('0x11'),_0x3126f5,'request\x20sent',JSON[_0xdaf2('0x12')](_0x1636eb));if(_0x1636eb[_0xdaf2('0x13')]){if(_0x1636eb[_0xdaf2('0x13')][_0xdaf2('0x14')]===0x1f4){logger[_0xdaf2('0x13')]('Schedule,\x20%s,\x20%s',_0x3126f5,_0x1636eb[_0xdaf2('0x13')][_0xdaf2('0x15')]);return _0x4ecccc(_0x1636eb['error'][_0xdaf2('0x15')]);}logger[_0xdaf2('0x13')]('Schedule,\x20%s,\x20%s',_0x3126f5,_0x1636eb[_0xdaf2('0x13')][_0xdaf2('0x15')]);return _0x2e3971(_0x1636eb[_0xdaf2('0x13')][_0xdaf2('0x15')]);}else{logger[_0xdaf2('0xe')](_0xdaf2('0xf'),_0x3126f5,_0xdaf2('0x16'));_0x2e3971(_0x1636eb[_0xdaf2('0x17')][_0xdaf2('0x15')]);}})['catch'](function(_0x183ad5){logger['error'](_0xdaf2('0xf'),_0x3126f5,_0x183ad5);_0x4ecccc(_0x183ad5);});});} \ No newline at end of file +var _0x2e31=['info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xf7a5d6,_0x4c671e){var _0xe21476=function(_0x5cbd31){while(--_0x5cbd31){_0xf7a5d6['push'](_0xf7a5d6['shift']());}};_0xe21476(++_0x4c671e);}(_0x2e31,0x1e6));var _0x12e3=function(_0x118ed8,_0x4357fd){_0x118ed8=_0x118ed8-0x0;var _0x19ebe5=_0x2e31[_0x118ed8];return _0x19ebe5;};'use strict';var _=require(_0x12e3('0x0'));var util=require('util');var moment=require(_0x12e3('0x1'));var BPromise=require(_0x12e3('0x2'));var rs=require(_0x12e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12e3('0x5'))(_0x12e3('0x6'));var config=require(_0x12e3('0x7'));var jayson=require(_0x12e3('0x8'));var client=jayson[_0x12e3('0x9')][_0x12e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8598,_0x4860c5,_0x483864){return new BPromise(function(_0x10c4a0,_0x94cc67){return client[_0x12e3('0xb')](_0x4b8598,_0x483864)['then'](function(_0xcf2659){logger['info'](_0x12e3('0xc'),_0x4860c5,_0x12e3('0xd'));logger[_0x12e3('0xe')](_0x12e3('0xf'),_0x4860c5,'request\x20sent',JSON[_0x12e3('0x10')](_0xcf2659));if(_0xcf2659[_0x12e3('0x11')]){if(_0xcf2659[_0x12e3('0x11')][_0x12e3('0x12')]===0x1f4){logger[_0x12e3('0x11')](_0x12e3('0xc'),_0x4860c5,_0xcf2659[_0x12e3('0x11')][_0x12e3('0x13')]);return _0x94cc67(_0xcf2659[_0x12e3('0x11')][_0x12e3('0x13')]);}logger[_0x12e3('0x11')](_0x12e3('0xc'),_0x4860c5,_0xcf2659[_0x12e3('0x11')]['message']);return _0x10c4a0(_0xcf2659[_0x12e3('0x11')][_0x12e3('0x13')]);}else{logger[_0x12e3('0x14')](_0x12e3('0xc'),_0x4860c5,_0x12e3('0xd'));_0x10c4a0(_0xcf2659['result']['message']);}})[_0x12e3('0x15')](function(_0x4b6ec8){logger['error']('Schedule,\x20%s,\x20%s',_0x4860c5,_0x4b6ec8);_0x94cc67(_0x4b6ec8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 19aeff2..35f40f2 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 _0xad3b=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','create'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xad3b,0x191));var _0xbad3=function(_0x7afb4c,_0x10778f){_0x7afb4c=_0x7afb4c-0x0;var _0x54a1e9=_0xad3b[_0x7afb4c];return _0x54a1e9;};'use strict';var multer=require('multer');var util=require(_0xbad3('0x0'));var path=require(_0xbad3('0x1'));var timeout=require(_0xbad3('0x2'));var express=require(_0xbad3('0x3'));var router=express[_0xbad3('0x4')]();var fs_extra=require(_0xbad3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbad3('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xbad3('0x7')]('/',auth[_0xbad3('0x8')](),controller[_0xbad3('0x9')]);router[_0xbad3('0x7')](_0xbad3('0xa'),auth[_0xbad3('0x8')](),controller[_0xbad3('0xb')]);router[_0xbad3('0x7')](_0xbad3('0xc'),auth[_0xbad3('0x8')](),controller['show']);router[_0xbad3('0x7')](_0xbad3('0xd'),auth['isAuthenticated'](),controller[_0xbad3('0xe')]);router[_0xbad3('0xf')]('/',auth['isAuthenticated'](),controller[_0xbad3('0x10')]);router[_0xbad3('0x11')](_0xbad3('0xc'),auth[_0xbad3('0x8')](),controller[_0xbad3('0x12')]);router[_0xbad3('0x13')](_0xbad3('0xc'),auth[_0xbad3('0x8')](),controller[_0xbad3('0x14')]);module[_0xbad3('0x15')]=router; \ No newline at end of file +var _0x7565=['/:id','show','/:id/download','download','post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x3f1db6,_0x4b996e){var _0x27cc63=function(_0x4ba268){while(--_0x4ba268){_0x3f1db6['push'](_0x3f1db6['shift']());}};_0x27cc63(++_0x4b996e);}(_0x7565,0x1ad));var _0x5756=function(_0x10b59c,_0x5494d7){_0x10b59c=_0x10b59c-0x0;var _0x1c0537=_0x7565[_0x10b59c];return _0x1c0537;};'use strict';var multer=require(_0x5756('0x0'));var util=require(_0x5756('0x1'));var path=require('path');var timeout=require(_0x5756('0x2'));var express=require(_0x5756('0x3'));var router=express['Router']();var fs_extra=require(_0x5756('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5756('0x5'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x5756('0x6')]('/',auth[_0x5756('0x7')](),controller[_0x5756('0x8')]);router['get'](_0x5756('0x9'),auth['isAuthenticated'](),controller[_0x5756('0xa')]);router[_0x5756('0x6')](_0x5756('0xb'),auth[_0x5756('0x7')](),controller[_0x5756('0xc')]);router[_0x5756('0x6')](_0x5756('0xd'),auth[_0x5756('0x7')](),controller[_0x5756('0xe')]);router[_0x5756('0xf')]('/',auth[_0x5756('0x7')](),controller['create']);router[_0x5756('0x10')](_0x5756('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5756('0x11')](_0x5756('0xb'),auth['isAuthenticated'](),controller[_0x5756('0x12')]);module[_0x5756('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 393f2ca..17f8c82 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 _0x9c9b=['DATE','getDataValue','closedAt','format','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration'];(function(_0x5a39ae,_0x7a4b7f){var _0x4728af=function(_0x3f35c2){while(--_0x3f35c2){_0x5a39ae['push'](_0x5a39ae['shift']());}};_0x4728af(++_0x7a4b7f);}(_0x9c9b,0x194));var _0xb9c9=function(_0x56cc9f,_0x2ad53e){_0x56cc9f=_0x56cc9f-0x0;var _0x1608de=_0x9c9b[_0x56cc9f];return _0x1608de;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb9c9('0x0'));var path=require(_0xb9c9('0x1'));var config=require(_0xb9c9('0x2'));module[_0xb9c9('0x3')]={'format':{'type':Sequelize[_0xb9c9('0x4')],'get':function(){return this['getDataValue'](_0xb9c9('0x5'))?path[_0xb9c9('0x6')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb9c9('0x7')]},'value':{'type':Sequelize[_0xb9c9('0x7')],'set':function(_0x726f01){var _0x3ccb91=_0x726f01[_0xb9c9('0x8')](/\\/g,'/');this[_0xb9c9('0x9')](_0xb9c9('0x5'),_0x3ccb91);}},'rating':{'type':Sequelize[_0xb9c9('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb9c9('0xa')],'set':function(_0x131b42){this[_0xb9c9('0x9')](_0xb9c9('0xb'),moment()[_0xb9c9('0xc')](_0x131b42,'ms'));this['setDataValue']('closedAt',moment());this[_0xb9c9('0x9')](_0xb9c9('0xd'),_0x131b42);}},'startedAt':{'type':Sequelize[_0xb9c9('0xe')],'get':function(){return moment(this[_0xb9c9('0xf')](_0xb9c9('0xb')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xb9c9('0xe')],'get':function(){return moment(this['getDataValue'](_0xb9c9('0x10')))[_0xb9c9('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb9c9('0xe')],'get':function(){return moment(this[_0xb9c9('0xf')](_0xb9c9('0x12')))['format'](_0xb9c9('0x13'))[_0xb9c9('0x14')]();}},'updatedAt':{'type':Sequelize[_0xb9c9('0xe')],'get':function(){return moment(this[_0xb9c9('0xf')](_0xb9c9('0x15')))['format'](_0xb9c9('0x13'))[_0xb9c9('0x14')]();}}}; \ No newline at end of file +var _0x6829=['setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt','toString','createdAt','sequelize','moment','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt'];(function(_0x4ca120,_0x1f78d7){var _0x226536=function(_0xeb492){while(--_0xeb492){_0x4ca120['push'](_0x4ca120['shift']());}};_0x226536(++_0x1f78d7);}(_0x6829,0x14c));var _0x9682=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6829[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x9682('0x0'));var moment=require(_0x9682('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x9682('0x2')],'get':function(){return this[_0x9682('0x3')](_0x9682('0x4'))?path[_0x9682('0x5')](this[_0x9682('0x3')](_0x9682('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x9682('0x6')]},'channel':{'type':Sequelize[_0x9682('0x6')]},'value':{'type':Sequelize[_0x9682('0x6')],'set':function(_0x4cec91){var _0x37ab0a=_0x4cec91[_0x9682('0x7')](/\\/g,'/');this['setDataValue']('value',_0x37ab0a);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9682('0x8')],'set':function(_0x1b27c2){this['setDataValue'](_0x9682('0x9'),moment()['subtract'](_0x1b27c2,'ms'));this[_0x9682('0xa')]('closedAt',moment());this[_0x9682('0xa')](_0x9682('0xb'),_0x1b27c2);}},'startedAt':{'type':Sequelize[_0x9682('0xc')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x9682('0xd')](_0x9682('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x9682('0xc')],'get':function(){return moment(this['getDataValue'](_0x9682('0xf')))[_0x9682('0xd')](_0x9682('0xe'))[_0x9682('0x10')]();}},'createdAt':{'type':Sequelize[_0x9682('0xc')],'get':function(){return moment(this[_0x9682('0x3')](_0x9682('0x11')))[_0x9682('0xd')](_0x9682('0xe'))[_0x9682('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9682('0x3')]('updatedAt'))[_0x9682('0xd')](_0x9682('0xe'))[_0x9682('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ce46c51..8255a05 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 _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x15ef01,_0x4d3587){_0x15ef01=_0x15ef01-0x0;var _0x59af8a=_0x9c5a[_0x15ef01];return _0x59af8a;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x4c4e,0x152));var _0xe4c4=function(_0x49c2a5,_0xf22be7){_0x49c2a5=_0x49c2a5-0x0;var _0x5e3cb7=_0x4c4e[_0x49c2a5];return _0x5e3cb7;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 754cbae..6909ba9 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 _0xcee3=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x56806f,_0x35ab82){var _0x39ac49=function(_0xd5c960){while(--_0xd5c960){_0x56806f['push'](_0x56806f['shift']());}};_0x39ac49(++_0x35ab82);}(_0xcee3,0x1cc));var _0x3cee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcee3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3cee('0x0'));var util=require(_0x3cee('0x1'));var logger=require('../../config/logger')(_0x3cee('0x2'));var moment=require(_0x3cee('0x3'));var BPromise=require('bluebird');var rp=require(_0x3cee('0x4'));var fs=require('fs');var path=require(_0x3cee('0x5'));var rimraf=require(_0x3cee('0x6'));var config=require(_0x3cee('0x7'));var attributes=require('./screenRecording.attributes');module[_0x3cee('0x8')]=function(_0x30dc14,_0x51cbdb){return _0x30dc14[_0x3cee('0x9')](_0x3cee('0xa'),attributes,{'tableName':_0x3cee('0xb'),'paranoid':![],'indexes':[{'name':_0x3cee('0xc'),'fields':[_0x3cee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32f1=['util','api','moment','bluebird','path','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash'];(function(_0x2d53bc,_0x17cfee){var _0x8929bc=function(_0xfcdd83){while(--_0xfcdd83){_0x2d53bc['push'](_0x2d53bc['shift']());}};_0x8929bc(++_0x17cfee);}(_0x32f1,0x175));var _0x132f=function(_0x3d4881,_0x34344d){_0x3d4881=_0x3d4881-0x0;var _0x41b538=_0x32f1[_0x3d4881];return _0x41b538;};'use strict';var _=require(_0x132f('0x0'));var util=require(_0x132f('0x1'));var logger=require('../../config/logger')(_0x132f('0x2'));var moment=require(_0x132f('0x3'));var BPromise=require(_0x132f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x132f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x132f('0x6'));module[_0x132f('0x7')]=function(_0x1d105b,_0x4ba43c){return _0x1d105b[_0x132f('0x8')](_0x132f('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x132f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index cf0f014..641a433 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 _0xe0cb=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x10432f,_0x579e58){var _0x5b5b3a=function(_0xcdfc24){while(--_0xcdfc24){_0x10432f['push'](_0x10432f['shift']());}};_0x5b5b3a(++_0x579e58);}(_0xe0cb,0x8d));var _0xbe0c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe0cb[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xbe0c('0x0'));var moment=require('moment');var BPromise=require(_0xbe0c('0x1'));var rs=require(_0xbe0c('0x2'));var fs=require('fs');var Redis=require(_0xbe0c('0x3'));var db=require(_0xbe0c('0x4'))['db'];var utils=require(_0xbe0c('0x5'));var logger=require(_0xbe0c('0x6'))(_0xbe0c('0x7'));var config=require(_0xbe0c('0x8'));var jayson=require(_0xbe0c('0x9'));var client=jayson[_0xbe0c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43069b,_0x74f9bd,_0x301c33){return new BPromise(function(_0x44ef5a,_0x3ed5d5){return client['request'](_0x43069b,_0x301c33)[_0xbe0c('0xb')](function(_0xbd6926){logger[_0xbe0c('0xc')](_0xbe0c('0xd'),_0x74f9bd,'request\x20sent');logger[_0xbe0c('0xe')](_0xbe0c('0xf'),_0x74f9bd,_0xbe0c('0x10'),JSON[_0xbe0c('0x11')](_0xbd6926));if(_0xbd6926[_0xbe0c('0x12')]){if(_0xbd6926['error'][_0xbe0c('0x13')]===0x1f4){logger[_0xbe0c('0x12')](_0xbe0c('0xd'),_0x74f9bd,_0xbd6926[_0xbe0c('0x12')]['message']);return _0x3ed5d5(_0xbd6926[_0xbe0c('0x12')][_0xbe0c('0x14')]);}logger[_0xbe0c('0x12')](_0xbe0c('0xd'),_0x74f9bd,_0xbd6926['error']['message']);return _0x44ef5a(_0xbd6926[_0xbe0c('0x12')][_0xbe0c('0x14')]);}else{logger['info'](_0xbe0c('0xd'),_0x74f9bd,_0xbe0c('0x10'));_0x44ef5a(_0xbd6926[_0xbe0c('0x15')]['message']);}})[_0xbe0c('0x16')](function(_0x1c4746){logger['error'](_0xbe0c('0xd'),_0x74f9bd,_0x1c4746);_0x3ed5d5(_0x1c4746);});});} \ No newline at end of file +var _0x1627=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','http','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2aa733,_0xcde568){var _0x2bcf85=function(_0x5d9358){while(--_0x5d9358){_0x2aa733['push'](_0x2aa733['shift']());}};_0x2bcf85(++_0xcde568);}(_0x1627,0x6b));var _0x7162=function(_0x61925b,_0x434fda){_0x61925b=_0x61925b-0x0;var _0x2c11c9=_0x1627[_0x61925b];return _0x2c11c9;};'use strict';var _=require(_0x7162('0x0'));var util=require(_0x7162('0x1'));var moment=require('moment');var BPromise=require(_0x7162('0x2'));var rs=require(_0x7162('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7162('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7162('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5706c4,_0x14b598,_0x5ab6e5){return new BPromise(function(_0x3ce95f,_0x3d5ca6){return client['request'](_0x5706c4,_0x5ab6e5)[_0x7162('0x6')](function(_0x330021){logger[_0x7162('0x7')](_0x7162('0x8'),_0x14b598,'request\x20sent');logger[_0x7162('0x9')](_0x7162('0xa'),_0x14b598,'request\x20sent',JSON[_0x7162('0xb')](_0x330021));if(_0x330021[_0x7162('0xc')]){if(_0x330021['error'][_0x7162('0xd')]===0x1f4){logger[_0x7162('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x14b598,_0x330021[_0x7162('0xc')][_0x7162('0xe')]);return _0x3d5ca6(_0x330021[_0x7162('0xc')][_0x7162('0xe')]);}logger['error'](_0x7162('0x8'),_0x14b598,_0x330021[_0x7162('0xc')]['message']);return _0x3ce95f(_0x330021[_0x7162('0xc')][_0x7162('0xe')]);}else{logger[_0x7162('0x7')](_0x7162('0x8'),_0x14b598,'request\x20sent');_0x3ce95f(_0x330021[_0x7162('0xf')][_0x7162('0xe')]);}})[_0x7162('0x10')](function(_0x89f7b3){logger[_0x7162('0xc')](_0x7162('0x8'),_0x14b598,_0x89f7b3);_0x3d5ca6(_0x89f7b3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c281702..e7c5a65 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 _0xd973=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','extname','originalname','single','file','addLogo','root','post','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','getDate','/:id','show','/:id/logo'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd973,0x68));var _0x3d97=function(_0x17ea99,_0x5bc796){_0x17ea99=_0x17ea99-0x0;var _0x2b4d7c=_0xd973[_0x17ea99];return _0x2b4d7c;};'use strict';var multer=require(_0x3d97('0x0'));var util=require(_0x3d97('0x1'));var path=require('path');var timeout=require(_0x3d97('0x2'));var express=require(_0x3d97('0x3'));var router=express[_0x3d97('0x4')]();var fs_extra=require(_0x3d97('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d97('0x6'));var controller=require('./setting.controller');router[_0x3d97('0x7')]('/',auth[_0x3d97('0x8')](),controller['index']);router[_0x3d97('0x7')]('/now',controller[_0x3d97('0x9')]);router[_0x3d97('0x7')](_0x3d97('0xa'),controller[_0x3d97('0xb')]);router['get'](_0x3d97('0xc'),controller['getLogo']);router[_0x3d97('0x7')](_0x3d97('0xd'),controller[_0x3d97('0xe')]);router[_0x3d97('0x7')](_0x3d97('0xf'),controller[_0x3d97('0x10')]);router[_0x3d97('0x7')]('/:id/preferred',controller[_0x3d97('0x11')]);router[_0x3d97('0x7')](_0x3d97('0x12'),controller[_0x3d97('0x13')]);var upload=multer({'storage':multer[_0x3d97('0x14')]({'destination':function(_0x51feed,_0x184fdf,_0x395a1a){_0x395a1a(null,path[_0x3d97('0x15')](config['root'],_0x3d97('0x16')));},'filename':function(_0x223bb2,_0x3d10cd,_0x597c4f){_0x597c4f(null,util[_0x3d97('0x17')](_0x3d97('0x18'),'logo',path[_0x3d97('0x19')](_0x3d10cd[_0x3d97('0x1a')])));}})});router['post']('/:id/logo',upload[_0x3d97('0x1b')](_0x3d97('0x1c')),controller[_0x3d97('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30e875,_0x2456f2,_0x168246){_0x168246(null,path[_0x3d97('0x15')](config[_0x3d97('0x1e')],_0x3d97('0x16')));},'filename':function(_0x3ecc60,_0x13af99,_0x3d7d4d){_0x3d7d4d(null,util[_0x3d97('0x17')]('%s%s','logologin',path['extname'](_0x13af99['originalname'])));}})});router[_0x3d97('0x1f')](_0x3d97('0xd'),upload['single'](_0x3d97('0x1c')),controller[_0x3d97('0x20')]);var upload=multer({'storage':multer[_0x3d97('0x14')]({'destination':function(_0x1ef41a,_0x227b93,_0xf7f8bc){_0xf7f8bc(null,path[_0x3d97('0x15')](config[_0x3d97('0x1e')],_0x3d97('0x16')));},'filename':function(_0x33bea2,_0x3215da,_0x237d8f){_0x237d8f(null,util[_0x3d97('0x17')](_0x3d97('0x18'),'preferred',path[_0x3d97('0x19')](_0x3215da[_0x3d97('0x1a')])));}})});router[_0x3d97('0x1f')](_0x3d97('0x21'),upload[_0x3d97('0x1b')](_0x3d97('0x1c')),controller[_0x3d97('0x22')]);var upload=multer({'storage':multer[_0x3d97('0x14')]({'destination':function(_0x413d95,_0x13b3a1,_0x25e908){_0x25e908(null,path['join'](config[_0x3d97('0x1e')],'server/files/images/logos/'));},'filename':function(_0x3d69cf,_0x14575e,_0x2df53d){_0x2df53d(null,util[_0x3d97('0x17')](_0x3d97('0x18'),_0x3d97('0x23'),path[_0x3d97('0x19')](_0x14575e['originalname'])));}})});router[_0x3d97('0x1f')](_0x3d97('0x12'),upload[_0x3d97('0x1b')](_0x3d97('0x1c')),controller[_0x3d97('0x24')]);router['put']('/:id',auth[_0x3d97('0x8')](),controller[_0x3d97('0x25')]);module[_0x3d97('0x26')]=router; \ No newline at end of file +var _0x9a4b=['join','preferred','/:id/preferred','favicon','addFavicon','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','originalname','post','/:id/logo','single','file','addLogo','root','extname'];(function(_0x43eb32,_0x290c24){var _0x47a41b=function(_0x202e83){while(--_0x202e83){_0x43eb32['push'](_0x43eb32['shift']());}};_0x47a41b(++_0x290c24);}(_0x9a4b,0x134));var _0xb9a4=function(_0x446832,_0x12964a){_0x446832=_0x446832-0x0;var _0x2002bd=_0x9a4b[_0x446832];return _0x2002bd;};'use strict';var multer=require(_0xb9a4('0x0'));var util=require(_0xb9a4('0x1'));var path=require(_0xb9a4('0x2'));var timeout=require(_0xb9a4('0x3'));var express=require(_0xb9a4('0x4'));var router=express[_0xb9a4('0x5')]();var fs_extra=require(_0xb9a4('0x6'));var auth=require(_0xb9a4('0x7'));var interaction=require(_0xb9a4('0x8'));var config=require(_0xb9a4('0x9'));var controller=require(_0xb9a4('0xa'));router[_0xb9a4('0xb')]('/',auth[_0xb9a4('0xc')](),controller['index']);router['get'](_0xb9a4('0xd'),controller[_0xb9a4('0xe')]);router[_0xb9a4('0xb')](_0xb9a4('0xf'),controller[_0xb9a4('0x10')]);router['get']('/:id/logo',controller[_0xb9a4('0x11')]);router['get'](_0xb9a4('0x12'),controller[_0xb9a4('0x13')]);router['get']('/:id/gdpr',controller[_0xb9a4('0x14')]);router['get']('/:id/preferred',controller[_0xb9a4('0x15')]);router[_0xb9a4('0xb')](_0xb9a4('0x16'),controller[_0xb9a4('0x17')]);var upload=multer({'storage':multer[_0xb9a4('0x18')]({'destination':function(_0x1e6169,_0x3b5fbe,_0x446be3){_0x446be3(null,path['join'](config['root'],_0xb9a4('0x19')));},'filename':function(_0x5afeb2,_0x3b575b,_0x2d8ee9){_0x2d8ee9(null,util[_0xb9a4('0x1a')](_0xb9a4('0x1b'),'logo',path['extname'](_0x3b575b[_0xb9a4('0x1c')])));}})});router[_0xb9a4('0x1d')](_0xb9a4('0x1e'),upload[_0xb9a4('0x1f')](_0xb9a4('0x20')),controller[_0xb9a4('0x21')]);var upload=multer({'storage':multer[_0xb9a4('0x18')]({'destination':function(_0x43506a,_0x5c1342,_0x178738){_0x178738(null,path['join'](config[_0xb9a4('0x22')],_0xb9a4('0x19')));},'filename':function(_0x511704,_0x512036,_0x54790c){_0x54790c(null,util['format'](_0xb9a4('0x1b'),'logologin',path[_0xb9a4('0x23')](_0x512036['originalname'])));}})});router[_0xb9a4('0x1d')](_0xb9a4('0x12'),upload[_0xb9a4('0x1f')](_0xb9a4('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xb9a4('0x18')]({'destination':function(_0x32e9bb,_0xabf219,_0x22f2b4){_0x22f2b4(null,path[_0xb9a4('0x24')](config[_0xb9a4('0x22')],_0xb9a4('0x19')));},'filename':function(_0x5945a3,_0x225c9c,_0x46b09b){_0x46b09b(null,util['format'](_0xb9a4('0x1b'),_0xb9a4('0x25'),path[_0xb9a4('0x23')](_0x225c9c[_0xb9a4('0x1c')])));}})});router[_0xb9a4('0x1d')](_0xb9a4('0x26'),upload[_0xb9a4('0x1f')](_0xb9a4('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0xb9a4('0x18')]({'destination':function(_0x26360b,_0x12451c,_0x3c6f3e){_0x3c6f3e(null,path['join'](config['root'],_0xb9a4('0x19')));},'filename':function(_0x4f9f63,_0x117c8b,_0x12af9e){_0x12af9e(null,util['format'](_0xb9a4('0x1b'),_0xb9a4('0x27'),path[_0xb9a4('0x23')](_0x117c8b[_0xb9a4('0x1c')])));}})});router[_0xb9a4('0x1d')](_0xb9a4('0x16'),upload[_0xb9a4('0x1f')]('file'),controller[_0xb9a4('0x28')]);router['put'](_0xb9a4('0xf'),auth['isAuthenticated'](),controller[_0xb9a4('0x29')]);module[_0xb9a4('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3419b85..6e44990 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(_0x4aa1e0,_0x4c155d){var _0x45d0b=function(_0x461ca5){while(--_0x461ca5){_0x4aa1e0['push'](_0x4aa1e0['shift']());}};_0x45d0b(++_0x4c155d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x31aa1c,_0x25feb3){var _0x5a77aa=function(_0x3affb2){while(--_0x3affb2){_0x31aa1c['push'](_0x31aa1c['shift']());}};_0x5a77aa(++_0x25feb3);}(_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 diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0cfa8c4..d0e70d4 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 _0x4953=['defaultLoginLogo','default_loginLogo.svg','ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','custom','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','length','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','Sequelize','upperFirst','\x20not\x20found','getLogoLogin'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x4953,0x10a));var _0x3495=function(_0x32ff46,_0x1af311){_0x32ff46=_0x32ff46-0x0;var _0x237536=_0x4953[_0x32ff46];return _0x237536;};'use strict';var emlformat=require(_0x3495('0x0'));var rimraf=require(_0x3495('0x1'));var zipdir=require(_0x3495('0x2'));var jsonpatch=require(_0x3495('0x3'));var rp=require(_0x3495('0x4'));var moment=require(_0x3495('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3495('0x6'));var util=require('util');var path=require(_0x3495('0x7'));var sox=require(_0x3495('0x8'));var csv=require(_0x3495('0x9'));var ejs=require(_0x3495('0xa'));var fs=require('fs');var fs_extra=require(_0x3495('0xb'));var _=require(_0x3495('0xc'));var squel=require(_0x3495('0xd'));var crypto=require(_0x3495('0xe'));var jsforce=require(_0x3495('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3495('0x9'));var querystring=require(_0x3495('0x10'));var Papa=require('papaparse');var Redis=require(_0x3495('0x11'));var authService=require(_0x3495('0x12'));var qs=require(_0x3495('0x13'));var as=require(_0x3495('0x14'));var hardwareService=require(_0x3495('0x15'));var logger=require(_0x3495('0x16'))(_0x3495('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3495('0x18'));var db=require(_0x3495('0x19'))['db'];var jayson=require(_0x3495('0x1a'));var client=jayson[_0x3495('0x1b')][_0x3495('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x27ac59,_0x2ece9d,_0x5ca8ad,_0x4450d7){return new BPromise(function(_0x5f9e8d,_0xca76ef){var _0x319d6d=_0x4450d7||client;return _0x319d6d[_0x3495('0x1d')](_0x27ac59,_0x5ca8ad)[_0x3495('0x1e')](function(_0x17ef58){logger['info']('Setting,\x20%s,\x20%s',_0x2ece9d,_0x3495('0x1f'));logger[_0x3495('0x20')](_0x3495('0x21'),_0x2ece9d,_0x3495('0x1f'),JSON['stringify'](_0x17ef58));if(_0x17ef58['error']){if(_0x17ef58[_0x3495('0x22')][_0x3495('0x23')]===0x1f4){logger[_0x3495('0x22')](_0x3495('0x24'),_0x2ece9d,_0x17ef58['error'][_0x3495('0x25')]);return _0xca76ef(_0x17ef58[_0x3495('0x22')][_0x3495('0x25')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2ece9d,_0x17ef58[_0x3495('0x22')][_0x3495('0x25')]);return _0x5f9e8d(_0x17ef58[_0x3495('0x22')][_0x3495('0x25')]);}else{logger[_0x3495('0x26')](_0x3495('0x24'),_0x2ece9d,_0x3495('0x1f'));_0x5f9e8d(_0x17ef58[_0x3495('0x27')][_0x3495('0x25')]);}})[_0x3495('0x28')](function(_0x3edf17){logger['error'](_0x3495('0x24'),_0x2ece9d,_0x3edf17);_0xca76ef(_0x3edf17);});});}function respondWithStatusCode(_0x526b4b,_0x5e88d1){_0x5e88d1=_0x5e88d1||0xcc;return function(_0x19d4e3){if(_0x19d4e3){return _0x526b4b[_0x3495('0x29')](_0x5e88d1);}return _0x526b4b['status'](_0x5e88d1)[_0x3495('0x2a')]();};}function respondWithResult(_0x4174a0,_0x19b1ea){_0x19b1ea=_0x19b1ea||0xc8;return function(_0x293a9a){if(_0x293a9a){return _0x4174a0[_0x3495('0x2b')](_0x19b1ea)[_0x3495('0x2c')](_0x293a9a);}};}function respondWithFilteredResult(_0x56353a,_0x25aa2b){return function(_0x2517c5){if(_0x2517c5){var _0x4cb97a=typeof _0x25aa2b[_0x3495('0x2d')]===_0x3495('0x2e')&&typeof _0x25aa2b['limit']===_0x3495('0x2e');var _0x4f4997=_0x2517c5[_0x3495('0x2f')];var _0x24038e=_0x4cb97a?0x0:_0x25aa2b[_0x3495('0x2d')];var _0x4eb5d1=_0x4cb97a?_0x2517c5[_0x3495('0x2f')]:_0x25aa2b['offset']+_0x25aa2b[_0x3495('0x30')];var _0x4f3493;if(_0x4eb5d1>=_0x4f4997){_0x4eb5d1=_0x4f4997;_0x4f3493=0xc8;}else{_0x4f3493=0xce;}_0x56353a[_0x3495('0x2b')](_0x4f3493);return _0x56353a[_0x3495('0x31')](_0x3495('0x32'),_0x24038e+'-'+_0x4eb5d1+'/'+_0x4f4997)[_0x3495('0x2c')](_0x2517c5);}return null;};}function patchUpdates(_0x430a6d){return function(_0x3a203b){try{jsonpatch['apply'](_0x3a203b,_0x430a6d,!![]);}catch(_0x518eec){return BPromise['reject'](_0x518eec);}return _0x3a203b[_0x3495('0x33')]();};}function saveUpdates(_0x35748c,_0x4bae0c){return function(_0x48b5a4){if(_0x48b5a4){return _0x48b5a4[_0x3495('0x34')](_0x35748c)[_0x3495('0x1e')](function(_0x539723){return _0x539723;});}return null;};}function removeEntity(_0x252d05,_0x527688){return function(_0x420992){if(_0x420992){return _0x420992[_0x3495('0x35')]()[_0x3495('0x1e')](function(){_0x252d05[_0x3495('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x112699,_0x2a4889){return function(_0x40e6b3){if(!_0x40e6b3){_0x112699['sendStatus'](0x194);}return _0x40e6b3;};}function handleError(_0x37dc3b,_0x156a18){_0x156a18=_0x156a18||0x1f4;return function(_0x3a96f3){logger['error'](_0x3a96f3[_0x3495('0x36')]);if(_0x3a96f3[_0x3495('0x37')]){delete _0x3a96f3[_0x3495('0x37')];}_0x37dc3b[_0x3495('0x2b')](_0x156a18)[_0x3495('0x38')](_0x3a96f3);};}exports[_0x3495('0x39')]=function(_0x2a9a57,_0x36726b){var _0x31a544={},_0x5a45de={},_0xc10a94={'count':0x0,'rows':[]};var _0x17dc67=_[_0x3495('0x3a')](db[_0x3495('0x3b')][_0x3495('0x3c')],function(_0x35eed6){return{'name':_0x35eed6['fieldName'],'type':_0x35eed6[_0x3495('0x3d')]['key']};});_0x5a45de['model']=_['map'](_0x17dc67,'name');_0x5a45de['query']=_[_0x3495('0x3e')](_0x2a9a57[_0x3495('0x3f')]);_0x5a45de[_0x3495('0x40')]=_[_0x3495('0x41')](_0x5a45de[_0x3495('0x42')],_0x5a45de['query']);_0x31a544[_0x3495('0x43')]=_[_0x3495('0x41')](_0x5a45de[_0x3495('0x42')],qs[_0x3495('0x44')](_0x2a9a57[_0x3495('0x3f')]['fields']));_0x31a544[_0x3495('0x43')]=_0x31a544[_0x3495('0x43')]['length']?_0x31a544['attributes']:_0x5a45de['model'];if(!_0x2a9a57[_0x3495('0x3f')][_0x3495('0x45')](_0x3495('0x46'))){_0x31a544[_0x3495('0x30')]=qs[_0x3495('0x30')](_0x2a9a57[_0x3495('0x3f')][_0x3495('0x30')]);_0x31a544[_0x3495('0x2d')]=qs['offset'](_0x2a9a57[_0x3495('0x3f')]['offset']);}_0x31a544[_0x3495('0x47')]=qs[_0x3495('0x48')](_0x2a9a57[_0x3495('0x3f')]['sort']);_0x31a544['where']=qs[_0x3495('0x40')](_['pick'](_0x2a9a57[_0x3495('0x3f')],_0x5a45de[_0x3495('0x40')]),_0x17dc67);if(_0x2a9a57[_0x3495('0x3f')]['filter']){_0x31a544[_0x3495('0x49')]=_['merge'](_0x31a544[_0x3495('0x49')],{'$or':_[_0x3495('0x3a')](_0x17dc67,function(_0x504b26){if(_0x504b26[_0x3495('0x3d')]!==_0x3495('0x4a')){var _0x282ae5={};_0x282ae5[_0x504b26['name']]={'$like':'%'+_0x2a9a57[_0x3495('0x3f')][_0x3495('0x4b')]+'%'};return _0x282ae5;}})});}_0x31a544=_[_0x3495('0x4c')]({},_0x31a544,_0x2a9a57[_0x3495('0x4d')]);var _0x1a3de1={'where':_0x31a544[_0x3495('0x49')]};return db['Setting'][_0x3495('0x2f')](_0x1a3de1)[_0x3495('0x1e')](function(_0x34c03f){_0xc10a94[_0x3495('0x2f')]=_0x34c03f;if(_0x2a9a57[_0x3495('0x3f')][_0x3495('0x4e')]){_0x31a544[_0x3495('0x4f')]=[{'all':!![]}];}return db[_0x3495('0x3b')]['findAll'](_0x31a544);})[_0x3495('0x1e')](function(_0x1750be){_0xc10a94[_0x3495('0x50')]=_0x1750be;return _0xc10a94;})[_0x3495('0x1e')](respondWithFilteredResult(_0x36726b,_0x31a544))[_0x3495('0x28')](handleError(_0x36726b,null));};exports[_0x3495('0x51')]=function(_0x505101,_0x188d37){var _0xe5bf87={'raw':![],'where':{'id':_0x505101[_0x3495('0x52')]['id']}},_0x1c7dee={};_0x1c7dee[_0x3495('0x42')]=_[_0x3495('0x3e')](db['Setting'][_0x3495('0x3c')]);_0x1c7dee[_0x3495('0x3f')]=_[_0x3495('0x3e')](_0x505101['query']);_0x1c7dee['filters']=_[_0x3495('0x41')](_0x1c7dee[_0x3495('0x42')],_0x1c7dee[_0x3495('0x3f')]);_0xe5bf87[_0x3495('0x43')]=_[_0x3495('0x41')](_0x1c7dee[_0x3495('0x42')],qs[_0x3495('0x44')](_0x505101[_0x3495('0x3f')][_0x3495('0x44')]));_0xe5bf87[_0x3495('0x43')]=_0xe5bf87['attributes'][_0x3495('0x53')]?_0xe5bf87[_0x3495('0x43')]:_0x1c7dee[_0x3495('0x42')];if(_0x505101['query']['includeAll']){_0xe5bf87[_0x3495('0x4f')]=[{'all':!![]}];}_0xe5bf87=_['merge']({},_0xe5bf87,_0x505101[_0x3495('0x4d')]);return db['Setting'][_0x3495('0x54')](_0xe5bf87)[_0x3495('0x1e')](handleEntityNotFound(_0x188d37,null))[_0x3495('0x1e')](respondWithResult(_0x188d37,null))['catch'](handleError(_0x188d37,null));};exports['update']=function(_0x12441a,_0x40062a){if(_0x12441a[_0x3495('0x55')]['id']){delete _0x12441a[_0x3495('0x55')]['id'];}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x12441a[_0x3495('0x52')]['id']}})['then'](handleEntityNotFound(_0x40062a,null))[_0x3495('0x1e')](saveUpdates(_0x12441a[_0x3495('0x55')],null))[_0x3495('0x1e')](respondWithResult(_0x40062a,null))[_0x3495('0x28')](handleError(_0x40062a,null));};exports[_0x3495('0x56')]=function(_0x39be5d,_0x462aa9,_0x40007e){if(_0x39be5d['file']&&_0x39be5d[_0x3495('0x57')][_0x3495('0x58')]){_0x39be5d[_0x3495('0x55')][_0x3495('0x59')]=_0x39be5d[_0x3495('0x57')][_0x3495('0x58')];}return db[_0x3495('0x3b')]['find']({'where':{'id':_0x39be5d[_0x3495('0x52')]['id']}})[_0x3495('0x1e')](handleEntityNotFound(_0x462aa9,null))[_0x3495('0x1e')](saveUpdates(_0x39be5d[_0x3495('0x55')],null))[_0x3495('0x1e')](respondWithResult(_0x462aa9,null))['catch'](handleError(_0x462aa9,null));};exports['addLogoLogin']=function(_0x5f39a6,_0x1945b4,_0x3f945c){if(_0x5f39a6[_0x3495('0x57')]&&_0x5f39a6[_0x3495('0x57')][_0x3495('0x58')]){_0x5f39a6['body'][_0x3495('0x5a')]=_0x5f39a6[_0x3495('0x57')][_0x3495('0x58')];}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x5f39a6[_0x3495('0x52')]['id']}})[_0x3495('0x1e')](handleEntityNotFound(_0x1945b4,null))[_0x3495('0x1e')](saveUpdates(_0x5f39a6[_0x3495('0x55')],null))[_0x3495('0x1e')](respondWithResult(_0x1945b4,null))[_0x3495('0x28')](handleError(_0x1945b4,null));};var utilLicense=require('../../config/license/util');exports[_0x3495('0x5b')]=function(_0x3f147d,_0x13b285,_0x493d5c){var _0xf5cb48=_0x3495('0x5c');var _0x28ca5f={'custom':![]};return utilLicense[_0x3495('0x5d')]()[_0x3495('0x1e')](function(_0x4ab92b){if(_0x4ab92b){_0x28ca5f=_0x4ab92b;}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x3f147d[_0x3495('0x52')]['id']},'attributes':[_0x3495('0x59'),_0x3495('0x5a'),_0x3495('0x5e'),_0x3495('0x5f'),_0x3495('0x60'),'defaultLoginLogo',_0x3495('0x61'),_0x3495('0x62')],'raw':!![]});})[_0x3495('0x1e')](handleEntityNotFound(_0x13b285,null))[_0x3495('0x1e')](function(_0xf2adeb){if(_0xf2adeb){var _0x1e85a7=_0xf2adeb[_0x3495('0x59')]&&fs[_0x3495('0x63')](path[_0x3495('0x64')](config[_0x3495('0x65')],_0xf5cb48,_[_0x3495('0x66')](_0xf2adeb['logo'])))?path['join'](config['root'],_0xf5cb48,_['toLower'](_0xf2adeb[_0x3495('0x59')])):path[_0x3495('0x64')](config[_0x3495('0x65')],_0xf5cb48,_['toLower'](_0x3495('0x67')));var _0x3e25dc=_0x3495('0x68')+_['upperFirst'](_0x3495('0x59'));if(_0xf2adeb[_0x3e25dc]||!_0x28ca5f['custom']){_0x1e85a7=path[_0x3495('0x64')](config['root'],_0xf5cb48,_[_0x3495('0x66')](_0x3495('0x67')));}if(!fs['existsSync'](_0x1e85a7)){throw new db[(_0x3495('0x69'))]['ValidationError'](_[_0x3495('0x6a')](_0x3495('0x59'))+_0x3495('0x6b'));}return _0x13b285['download'](_0x1e85a7);}})[_0x3495('0x28')](handleError(_0x13b285,null));};var utilLicense=require(_0x3495('0x18'));exports[_0x3495('0x6c')]=function(_0x28d702,_0x360091,_0x17944f){var _0x46c32f='server/files/images/logos';var _0x45f7ba={'custom':![]};return utilLicense[_0x3495('0x5d')]()['then'](function(_0x6c85a9){if(_0x6c85a9){_0x45f7ba=_0x6c85a9;}return db[_0x3495('0x3b')]['find']({'where':{'id':_0x28d702['params']['id']},'attributes':[_0x3495('0x59'),_0x3495('0x5a'),_0x3495('0x5e'),_0x3495('0x5f'),'defaultLogo',_0x3495('0x6d'),_0x3495('0x61'),_0x3495('0x62')],'raw':!![]});})[_0x3495('0x1e')](handleEntityNotFound(_0x360091,null))[_0x3495('0x1e')](function(_0x10b19f){if(_0x10b19f){var _0x3362ff=_0x10b19f[_0x3495('0x5a')]&&fs['existsSync'](path['join'](config[_0x3495('0x65')],_0x46c32f,_[_0x3495('0x66')](_0x10b19f[_0x3495('0x5a')])))?path[_0x3495('0x64')](config[_0x3495('0x65')],_0x46c32f,_[_0x3495('0x66')](_0x10b19f[_0x3495('0x5a')])):path[_0x3495('0x64')](config[_0x3495('0x65')],_0x46c32f,_['toLower'](_0x3495('0x6e')));var _0x1240df='default'+_['upperFirst'](_0x3495('0x5a'));if(_0x10b19f[_0x1240df]||!_0x45f7ba['custom']){_0x3362ff=path['join'](config['root'],_0x46c32f,_[_0x3495('0x66')](_0x3495('0x6e')));}if(!fs[_0x3495('0x63')](_0x3362ff)){throw new db[(_0x3495('0x69'))][(_0x3495('0x6f'))](_[_0x3495('0x6a')](_0x3495('0x5a'))+_0x3495('0x6b'));}return _0x360091[_0x3495('0x70')](_0x3362ff);}})[_0x3495('0x28')](handleError(_0x360091,null));};exports[_0x3495('0x71')]=function(_0x1233b7,_0x1b315c){return db['Setting'][_0x3495('0x54')]({'where':{'id':_0x1233b7[_0x3495('0x52')]['id']},'attributes':[_0x3495('0x72')]})['then'](respondWithResult(_0x1b315c,null))['catch'](handleError(_0x1b315c,null));};exports[_0x3495('0x73')]=function(_0x2318b8,_0x460832,_0x314f32){if(_0x2318b8[_0x3495('0x57')]&&_0x2318b8[_0x3495('0x57')]['filename']){_0x2318b8[_0x3495('0x55')]['preferred']=_0x2318b8['file'][_0x3495('0x58')];}return db[_0x3495('0x3b')]['find']({'where':{'id':_0x2318b8['params']['id']}})[_0x3495('0x1e')](handleEntityNotFound(_0x460832,null))['then'](saveUpdates(_0x2318b8['body'],null))['then'](respondWithResult(_0x460832,null))[_0x3495('0x28')](handleError(_0x460832,null));};var utilLicense=require(_0x3495('0x18'));exports[_0x3495('0x74')]=function(_0x32ee33,_0x12a2cb,_0x5e68b1){var _0x1b1881='server/files/images/logos';var _0x1de211={'custom':![]};return utilLicense[_0x3495('0x5d')]()[_0x3495('0x1e')](function(_0x8194fb){if(_0x8194fb){_0x1de211=_0x8194fb;}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x32ee33['params']['id']},'attributes':[_0x3495('0x59'),_0x3495('0x5a'),'preferred',_0x3495('0x5f'),'defaultLogo','defaultLoginLogo',_0x3495('0x61'),_0x3495('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x12a2cb,null))[_0x3495('0x1e')](function(_0x47a3b8){if(_0x47a3b8){var _0x44a56f=_0x47a3b8['preferred']&&fs[_0x3495('0x63')](path['join'](config[_0x3495('0x65')],_0x1b1881,_[_0x3495('0x66')](_0x47a3b8[_0x3495('0x5e')])))?path[_0x3495('0x64')](config['root'],_0x1b1881,_[_0x3495('0x66')](_0x47a3b8[_0x3495('0x5e')])):path[_0x3495('0x64')](config['root'],_0x1b1881,_[_0x3495('0x66')](_0x3495('0x75')));var _0x20c53a=_0x3495('0x68')+_[_0x3495('0x6a')](_0x3495('0x5e'));if(_0x47a3b8[_0x20c53a]||!_0x1de211['custom']||!_0x1de211[_0x3495('0x5e')]){_0x44a56f=path['join'](config[_0x3495('0x65')],_0x1b1881,_[_0x3495('0x66')](_0x3495('0x75')));}if(!fs[_0x3495('0x63')](_0x44a56f)){throw new db[(_0x3495('0x69'))][(_0x3495('0x6f'))](_['upperFirst'](_0x3495('0x5e'))+_0x3495('0x6b'));}return _0x12a2cb[_0x3495('0x70')](_0x44a56f);}})[_0x3495('0x28')](handleError(_0x12a2cb,null));};exports[_0x3495('0x76')]=function(_0x3e7c8c,_0x2d207d,_0x516bfe){if(_0x3e7c8c['file']&&_0x3e7c8c[_0x3495('0x57')][_0x3495('0x58')]){_0x3e7c8c[_0x3495('0x55')][_0x3495('0x5f')]=_0x3e7c8c[_0x3495('0x57')]['filename'];}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x3e7c8c[_0x3495('0x52')]['id']}})[_0x3495('0x1e')](handleEntityNotFound(_0x2d207d,null))['then'](saveUpdates(_0x3e7c8c[_0x3495('0x55')],null))[_0x3495('0x1e')](respondWithResult(_0x2d207d,null))[_0x3495('0x28')](handleError(_0x2d207d,null));};var utilLicense=require('../../config/license/util');exports[_0x3495('0x77')]=function(_0x2744e7,_0x26e021,_0x419f48){var _0x2d746d=_0x3495('0x5c');var _0x1ca630={'custom':![]};return utilLicense[_0x3495('0x5d')]()['then'](function(_0x56c0da){if(_0x56c0da){_0x1ca630=_0x56c0da;}return db[_0x3495('0x3b')][_0x3495('0x54')]({'where':{'id':_0x2744e7['params']['id']},'attributes':[_0x3495('0x59'),_0x3495('0x5a'),_0x3495('0x5e'),'favicon','defaultLogo',_0x3495('0x6d'),_0x3495('0x61'),_0x3495('0x62')],'raw':!![]});})[_0x3495('0x1e')](handleEntityNotFound(_0x26e021,null))[_0x3495('0x1e')](function(_0x388470){if(_0x388470){var _0x1def62=_0x388470[_0x3495('0x5f')]&&fs[_0x3495('0x63')](path[_0x3495('0x64')](config[_0x3495('0x65')],_0x2d746d,_[_0x3495('0x66')](_0x388470[_0x3495('0x5f')])))?path['join'](config['root'],_0x2d746d,_[_0x3495('0x66')](_0x388470[_0x3495('0x5f')])):path[_0x3495('0x64')](config[_0x3495('0x65')],_0x2d746d,_[_0x3495('0x66')](_0x3495('0x78')));var _0xc5b618=_0x3495('0x68')+_[_0x3495('0x6a')](_0x3495('0x5f'));if(_0x388470[_0xc5b618]||!_0x1ca630[_0x3495('0x79')]){_0x1def62=path[_0x3495('0x64')](config[_0x3495('0x65')],_0x2d746d,_[_0x3495('0x66')](_0x3495('0x78')));}if(!fs[_0x3495('0x63')](_0x1def62)){throw new db[(_0x3495('0x69'))][(_0x3495('0x6f'))](_[_0x3495('0x6a')](_0x3495('0x5f'))+'\x20not\x20found');}return _0x26e021[_0x3495('0x70')](_0x1def62);}})[_0x3495('0x28')](handleError(_0x26e021,null));};exports['getDate']=function(_0x11228b,_0x5f27b1){var _0x16d303={'offset':moment()[_0x3495('0x7a')]()};_0x16d303[_0x3495('0x7b')]=moment()['utcOffset'](_0x16d303[_0x3495('0x2d')])[_0x3495('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5f27b1[_0x3495('0x2b')](0xc8)['send'](_0x16d303);}; \ No newline at end of file +var _0x6282=['fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','rows','catch','params','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','default_logo.svg','default','custom','toLower','existsSync','ValidationError','upperFirst','getLogoLogin','defaultFavicon','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','getLicense','default_preferred.png','\x20not\x20found','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir'];(function(_0x488556,_0x3ce6ce){var _0x3eac29=function(_0x29624f){while(--_0x29624f){_0x488556['push'](_0x488556['shift']());}};_0x3eac29(++_0x3ce6ce);}(_0x6282,0x76));var _0x2628=function(_0x575cc7,_0x26643f){_0x575cc7=_0x575cc7-0x0;var _0x5d11dc=_0x6282[_0x575cc7];return _0x5d11dc;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require(_0x2628('0x1'));var zipdir=require(_0x2628('0x2'));var jsonpatch=require(_0x2628('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2628('0x4'));var Mustache=require(_0x2628('0x5'));var util=require('util');var path=require(_0x2628('0x6'));var sox=require(_0x2628('0x7'));var csv=require(_0x2628('0x8'));var ejs=require(_0x2628('0x9'));var fs=require('fs');var fs_extra=require(_0x2628('0xa'));var _=require('lodash');var squel=require(_0x2628('0xb'));var crypto=require(_0x2628('0xc'));var jsforce=require(_0x2628('0xd'));var deskjs=require(_0x2628('0xe'));var toCsv=require(_0x2628('0x8'));var querystring=require(_0x2628('0xf'));var Papa=require(_0x2628('0x10'));var Redis=require(_0x2628('0x11'));var authService=require(_0x2628('0x12'));var qs=require(_0x2628('0x13'));var as=require(_0x2628('0x14'));var hardwareService=require(_0x2628('0x15'));var logger=require(_0x2628('0x16'))(_0x2628('0x17'));var utils=require(_0x2628('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2628('0x19'))['db'];var jayson=require(_0x2628('0x1a'));var client=jayson[_0x2628('0x1b')][_0x2628('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0a32,_0x49dc1b,_0x1081a4,_0x465a6f){return new BPromise(function(_0x4d2cfb,_0x2395fe){var _0x2f59ca=_0x465a6f||client;return _0x2f59ca['request'](_0x5d0a32,_0x1081a4)[_0x2628('0x1d')](function(_0x16e67a){logger[_0x2628('0x1e')]('Setting,\x20%s,\x20%s',_0x49dc1b,_0x2628('0x1f'));logger[_0x2628('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x49dc1b,_0x2628('0x1f'),JSON['stringify'](_0x16e67a));if(_0x16e67a[_0x2628('0x21')]){if(_0x16e67a[_0x2628('0x21')]['code']===0x1f4){logger[_0x2628('0x21')](_0x2628('0x22'),_0x49dc1b,_0x16e67a['error'][_0x2628('0x23')]);return _0x2395fe(_0x16e67a['error'][_0x2628('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x49dc1b,_0x16e67a[_0x2628('0x21')][_0x2628('0x23')]);return _0x4d2cfb(_0x16e67a[_0x2628('0x21')][_0x2628('0x23')]);}else{logger[_0x2628('0x1e')](_0x2628('0x22'),_0x49dc1b,_0x2628('0x1f'));_0x4d2cfb(_0x16e67a[_0x2628('0x24')][_0x2628('0x23')]);}})['catch'](function(_0x41c3d1){logger[_0x2628('0x21')](_0x2628('0x22'),_0x49dc1b,_0x41c3d1);_0x2395fe(_0x41c3d1);});});}function respondWithStatusCode(_0x3904cb,_0x1abc7e){_0x1abc7e=_0x1abc7e||0xcc;return function(_0x4bae60){if(_0x4bae60){return _0x3904cb[_0x2628('0x25')](_0x1abc7e);}return _0x3904cb[_0x2628('0x26')](_0x1abc7e)[_0x2628('0x27')]();};}function respondWithResult(_0xfc2210,_0x6070fd){_0x6070fd=_0x6070fd||0xc8;return function(_0x57455c){if(_0x57455c){return _0xfc2210['status'](_0x6070fd)[_0x2628('0x28')](_0x57455c);}};}function respondWithFilteredResult(_0x254e1f,_0x221f07){return function(_0x41c18e){if(_0x41c18e){var _0x135ed7=typeof _0x221f07['offset']===_0x2628('0x29')&&typeof _0x221f07[_0x2628('0x2a')]===_0x2628('0x29');var _0x1df2d8=_0x41c18e[_0x2628('0x2b')];var _0x118e75=_0x135ed7?0x0:_0x221f07['offset'];var _0x541eef=_0x135ed7?_0x41c18e[_0x2628('0x2b')]:_0x221f07[_0x2628('0x2c')]+_0x221f07[_0x2628('0x2a')];var _0x59a28e;if(_0x541eef>=_0x1df2d8){_0x541eef=_0x1df2d8;_0x59a28e=0xc8;}else{_0x59a28e=0xce;}_0x254e1f['status'](_0x59a28e);return _0x254e1f[_0x2628('0x2d')](_0x2628('0x2e'),_0x118e75+'-'+_0x541eef+'/'+_0x1df2d8)[_0x2628('0x28')](_0x41c18e);}return null;};}function patchUpdates(_0x32e089){return function(_0x4b5938){try{jsonpatch[_0x2628('0x2f')](_0x4b5938,_0x32e089,!![]);}catch(_0x1dd96a){return BPromise[_0x2628('0x30')](_0x1dd96a);}return _0x4b5938[_0x2628('0x31')]();};}function saveUpdates(_0x515f29,_0x24e688){return function(_0x16cd54){if(_0x16cd54){return _0x16cd54[_0x2628('0x32')](_0x515f29)[_0x2628('0x1d')](function(_0x45711d){return _0x45711d;});}return null;};}function removeEntity(_0x146c5c,_0x23b271){return function(_0x31d231){if(_0x31d231){return _0x31d231[_0x2628('0x33')]()['then'](function(){_0x146c5c[_0x2628('0x26')](0xcc)[_0x2628('0x27')]();});}};}function handleEntityNotFound(_0x3b2b89,_0x2d18a5){return function(_0x1b711d){if(!_0x1b711d){_0x3b2b89['sendStatus'](0x194);}return _0x1b711d;};}function handleError(_0x4ba58c,_0x3b4bfa){_0x3b4bfa=_0x3b4bfa||0x1f4;return function(_0x42930c){logger[_0x2628('0x21')](_0x42930c['stack']);if(_0x42930c[_0x2628('0x34')]){delete _0x42930c[_0x2628('0x34')];}_0x4ba58c[_0x2628('0x26')](_0x3b4bfa)['send'](_0x42930c);};}exports[_0x2628('0x35')]=function(_0x1903c6,_0x1ad0ed){var _0x4792fa={},_0x497e6b={},_0x5c7af8={'count':0x0,'rows':[]};var _0x5e10f2=_[_0x2628('0x36')](db[_0x2628('0x37')][_0x2628('0x38')],function(_0x48acb8){return{'name':_0x48acb8[_0x2628('0x39')],'type':_0x48acb8[_0x2628('0x3a')][_0x2628('0x3b')]};});_0x497e6b['model']=_[_0x2628('0x36')](_0x5e10f2,_0x2628('0x34'));_0x497e6b[_0x2628('0x3c')]=_[_0x2628('0x3d')](_0x1903c6[_0x2628('0x3c')]);_0x497e6b[_0x2628('0x3e')]=_[_0x2628('0x3f')](_0x497e6b['model'],_0x497e6b[_0x2628('0x3c')]);_0x4792fa[_0x2628('0x40')]=_[_0x2628('0x3f')](_0x497e6b[_0x2628('0x41')],qs[_0x2628('0x42')](_0x1903c6[_0x2628('0x3c')]['fields']));_0x4792fa[_0x2628('0x40')]=_0x4792fa['attributes'][_0x2628('0x43')]?_0x4792fa[_0x2628('0x40')]:_0x497e6b[_0x2628('0x41')];if(!_0x1903c6[_0x2628('0x3c')][_0x2628('0x44')]('nolimit')){_0x4792fa[_0x2628('0x2a')]=qs['limit'](_0x1903c6['query'][_0x2628('0x2a')]);_0x4792fa[_0x2628('0x2c')]=qs[_0x2628('0x2c')](_0x1903c6[_0x2628('0x3c')][_0x2628('0x2c')]);}_0x4792fa['order']=qs[_0x2628('0x45')](_0x1903c6[_0x2628('0x3c')][_0x2628('0x45')]);_0x4792fa[_0x2628('0x46')]=qs[_0x2628('0x3e')](_['pick'](_0x1903c6[_0x2628('0x3c')],_0x497e6b['filters']),_0x5e10f2);if(_0x1903c6[_0x2628('0x3c')][_0x2628('0x47')]){_0x4792fa[_0x2628('0x46')]=_[_0x2628('0x48')](_0x4792fa['where'],{'$or':_['map'](_0x5e10f2,function(_0xffd716){if(_0xffd716[_0x2628('0x3a')]!=='VIRTUAL'){var _0x23726f={};_0x23726f[_0xffd716[_0x2628('0x34')]]={'$like':'%'+_0x1903c6[_0x2628('0x3c')][_0x2628('0x47')]+'%'};return _0x23726f;}})});}_0x4792fa=_['merge']({},_0x4792fa,_0x1903c6[_0x2628('0x49')]);var _0x1b6822={'where':_0x4792fa[_0x2628('0x46')]};return db[_0x2628('0x37')][_0x2628('0x2b')](_0x1b6822)[_0x2628('0x1d')](function(_0x309dad){_0x5c7af8[_0x2628('0x2b')]=_0x309dad;if(_0x1903c6['query'][_0x2628('0x4a')]){_0x4792fa['include']=[{'all':!![]}];}return db[_0x2628('0x37')]['findAll'](_0x4792fa);})[_0x2628('0x1d')](function(_0x166340){_0x5c7af8[_0x2628('0x4b')]=_0x166340;return _0x5c7af8;})[_0x2628('0x1d')](respondWithFilteredResult(_0x1ad0ed,_0x4792fa))[_0x2628('0x4c')](handleError(_0x1ad0ed,null));};exports['show']=function(_0x264a79,_0x5bac16){var _0x2cb756={'raw':![],'where':{'id':_0x264a79[_0x2628('0x4d')]['id']}},_0x3a7bd7={};_0x3a7bd7['model']=_[_0x2628('0x3d')](db[_0x2628('0x37')]['rawAttributes']);_0x3a7bd7[_0x2628('0x3c')]=_[_0x2628('0x3d')](_0x264a79[_0x2628('0x3c')]);_0x3a7bd7[_0x2628('0x3e')]=_[_0x2628('0x3f')](_0x3a7bd7['model'],_0x3a7bd7[_0x2628('0x3c')]);_0x2cb756['attributes']=_[_0x2628('0x3f')](_0x3a7bd7[_0x2628('0x41')],qs[_0x2628('0x42')](_0x264a79[_0x2628('0x3c')][_0x2628('0x42')]));_0x2cb756[_0x2628('0x40')]=_0x2cb756[_0x2628('0x40')]['length']?_0x2cb756[_0x2628('0x40')]:_0x3a7bd7[_0x2628('0x41')];if(_0x264a79[_0x2628('0x3c')][_0x2628('0x4a')]){_0x2cb756[_0x2628('0x4e')]=[{'all':!![]}];}_0x2cb756=_[_0x2628('0x48')]({},_0x2cb756,_0x264a79[_0x2628('0x49')]);return db[_0x2628('0x37')][_0x2628('0x4f')](_0x2cb756)['then'](handleEntityNotFound(_0x5bac16,null))['then'](respondWithResult(_0x5bac16,null))[_0x2628('0x4c')](handleError(_0x5bac16,null));};exports[_0x2628('0x32')]=function(_0x13d49c,_0xc7abb4){if(_0x13d49c[_0x2628('0x50')]['id']){delete _0x13d49c['body']['id'];}return db['Setting'][_0x2628('0x4f')]({'where':{'id':_0x13d49c['params']['id']}})[_0x2628('0x1d')](handleEntityNotFound(_0xc7abb4,null))[_0x2628('0x1d')](saveUpdates(_0x13d49c[_0x2628('0x50')],null))[_0x2628('0x1d')](respondWithResult(_0xc7abb4,null))[_0x2628('0x4c')](handleError(_0xc7abb4,null));};exports[_0x2628('0x51')]=function(_0x158831,_0x35c19c,_0x227cba){if(_0x158831[_0x2628('0x52')]&&_0x158831[_0x2628('0x52')][_0x2628('0x53')]){_0x158831[_0x2628('0x50')][_0x2628('0x54')]=_0x158831[_0x2628('0x52')][_0x2628('0x53')];}return db[_0x2628('0x37')][_0x2628('0x4f')]({'where':{'id':_0x158831[_0x2628('0x4d')]['id']}})[_0x2628('0x1d')](handleEntityNotFound(_0x35c19c,null))[_0x2628('0x1d')](saveUpdates(_0x158831[_0x2628('0x50')],null))['then'](respondWithResult(_0x35c19c,null))[_0x2628('0x4c')](handleError(_0x35c19c,null));};exports[_0x2628('0x55')]=function(_0x499afa,_0x416e7c,_0x382c0b){if(_0x499afa[_0x2628('0x52')]&&_0x499afa[_0x2628('0x52')][_0x2628('0x53')]){_0x499afa[_0x2628('0x50')][_0x2628('0x56')]=_0x499afa[_0x2628('0x52')]['filename'];}return db[_0x2628('0x37')][_0x2628('0x4f')]({'where':{'id':_0x499afa[_0x2628('0x4d')]['id']}})['then'](handleEntityNotFound(_0x416e7c,null))[_0x2628('0x1d')](saveUpdates(_0x499afa[_0x2628('0x50')],null))[_0x2628('0x1d')](respondWithResult(_0x416e7c,null))[_0x2628('0x4c')](handleError(_0x416e7c,null));};var utilLicense=require(_0x2628('0x57'));exports[_0x2628('0x58')]=function(_0x2499da,_0x532f09,_0x5997e2){var _0x49d412=_0x2628('0x59');var _0x4be311={'custom':![]};return utilLicense['getLicense']()[_0x2628('0x1d')](function(_0x36bcaf){if(_0x36bcaf){_0x4be311=_0x36bcaf;}return db[_0x2628('0x37')]['find']({'where':{'id':_0x2499da['params']['id']},'attributes':['logo','loginLogo',_0x2628('0x5a'),_0x2628('0x5b'),_0x2628('0x5c'),_0x2628('0x5d'),_0x2628('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x532f09,null))['then'](function(_0x418055){if(_0x418055){var _0xe5b565=_0x418055['logo']&&fs['existsSync'](path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x49d412,_['toLower'](_0x418055[_0x2628('0x54')])))?path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x49d412,_['toLower'](_0x418055['logo'])):path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x49d412,_['toLower'](_0x2628('0x61')));var _0x1c5575=_0x2628('0x62')+_['upperFirst'](_0x2628('0x54'));if(_0x418055[_0x1c5575]||!_0x4be311[_0x2628('0x63')]){_0xe5b565=path['join'](config[_0x2628('0x60')],_0x49d412,_[_0x2628('0x64')](_0x2628('0x61')));}if(!fs[_0x2628('0x65')](_0xe5b565)){throw new db['Sequelize'][(_0x2628('0x66'))](_[_0x2628('0x67')](_0x2628('0x54'))+'\x20not\x20found');}return _0x532f09['download'](_0xe5b565);}})['catch'](handleError(_0x532f09,null));};var utilLicense=require(_0x2628('0x57'));exports[_0x2628('0x68')]=function(_0x54f46f,_0x14b7ef,_0x4a7008){var _0x52d1ce=_0x2628('0x59');var _0x355444={'custom':![]};return utilLicense['getLicense']()[_0x2628('0x1d')](function(_0xff4c5e){if(_0xff4c5e){_0x355444=_0xff4c5e;}return db[_0x2628('0x37')][_0x2628('0x4f')]({'where':{'id':_0x54f46f[_0x2628('0x4d')]['id']},'attributes':[_0x2628('0x54'),'loginLogo',_0x2628('0x5a'),'favicon',_0x2628('0x5c'),'defaultLoginLogo',_0x2628('0x5e'),_0x2628('0x69')],'raw':!![]});})[_0x2628('0x1d')](handleEntityNotFound(_0x14b7ef,null))[_0x2628('0x1d')](function(_0x303507){if(_0x303507){var _0x2390a3=_0x303507[_0x2628('0x56')]&&fs[_0x2628('0x65')](path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x52d1ce,_[_0x2628('0x64')](_0x303507[_0x2628('0x56')])))?path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x52d1ce,_[_0x2628('0x64')](_0x303507['loginLogo'])):path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x52d1ce,_[_0x2628('0x64')](_0x2628('0x6a')));var _0x20821e=_0x2628('0x62')+_[_0x2628('0x67')](_0x2628('0x56'));if(_0x303507[_0x20821e]||!_0x355444['custom']){_0x2390a3=path[_0x2628('0x5f')](config['root'],_0x52d1ce,_[_0x2628('0x64')]('default_loginLogo.svg'));}if(!fs[_0x2628('0x65')](_0x2390a3)){throw new db[(_0x2628('0x6b'))][(_0x2628('0x66'))](_[_0x2628('0x67')](_0x2628('0x56'))+'\x20not\x20found');}return _0x14b7ef[_0x2628('0x6c')](_0x2390a3);}})[_0x2628('0x4c')](handleError(_0x14b7ef,null));};exports[_0x2628('0x6d')]=function(_0x1c3e42,_0x7caf20){return db[_0x2628('0x37')][_0x2628('0x4f')]({'where':{'id':_0x1c3e42[_0x2628('0x4d')]['id']},'attributes':[_0x2628('0x6e')]})[_0x2628('0x1d')](respondWithResult(_0x7caf20,null))[_0x2628('0x4c')](handleError(_0x7caf20,null));};exports['addPreferred']=function(_0x9f9e0a,_0x4a6902,_0x118d26){if(_0x9f9e0a[_0x2628('0x52')]&&_0x9f9e0a[_0x2628('0x52')][_0x2628('0x53')]){_0x9f9e0a['body']['preferred']=_0x9f9e0a[_0x2628('0x52')][_0x2628('0x53')];}return db['Setting'][_0x2628('0x4f')]({'where':{'id':_0x9f9e0a['params']['id']}})['then'](handleEntityNotFound(_0x4a6902,null))[_0x2628('0x1d')](saveUpdates(_0x9f9e0a[_0x2628('0x50')],null))['then'](respondWithResult(_0x4a6902,null))[_0x2628('0x4c')](handleError(_0x4a6902,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0xc9e57c,_0x1440f7,_0xbd2b20){var _0x28fdad=_0x2628('0x59');var _0x290952={'custom':![]};return utilLicense[_0x2628('0x6f')]()[_0x2628('0x1d')](function(_0x10c130){if(_0x10c130){_0x290952=_0x10c130;}return db[_0x2628('0x37')]['find']({'where':{'id':_0xc9e57c[_0x2628('0x4d')]['id']},'attributes':[_0x2628('0x54'),_0x2628('0x56'),_0x2628('0x5a'),'favicon',_0x2628('0x5c'),'defaultLoginLogo','defaultPreferred',_0x2628('0x69')],'raw':!![]});})[_0x2628('0x1d')](handleEntityNotFound(_0x1440f7,null))[_0x2628('0x1d')](function(_0x2f67f0){if(_0x2f67f0){var _0x1859f2=_0x2f67f0['preferred']&&fs[_0x2628('0x65')](path['join'](config[_0x2628('0x60')],_0x28fdad,_[_0x2628('0x64')](_0x2f67f0[_0x2628('0x5a')])))?path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x28fdad,_[_0x2628('0x64')](_0x2f67f0[_0x2628('0x5a')])):path['join'](config['root'],_0x28fdad,_[_0x2628('0x64')](_0x2628('0x70')));var _0x4e6727='default'+_[_0x2628('0x67')](_0x2628('0x5a'));if(_0x2f67f0[_0x4e6727]||!_0x290952['custom']||!_0x290952['preferred']){_0x1859f2=path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x28fdad,_[_0x2628('0x64')](_0x2628('0x70')));}if(!fs[_0x2628('0x65')](_0x1859f2)){throw new db[(_0x2628('0x6b'))][(_0x2628('0x66'))](_['upperFirst'](_0x2628('0x5a'))+_0x2628('0x71'));}return _0x1440f7[_0x2628('0x6c')](_0x1859f2);}})[_0x2628('0x4c')](handleError(_0x1440f7,null));};exports[_0x2628('0x72')]=function(_0x133c45,_0x159bbe,_0x19bbe8){if(_0x133c45[_0x2628('0x52')]&&_0x133c45[_0x2628('0x52')][_0x2628('0x53')]){_0x133c45[_0x2628('0x50')][_0x2628('0x5b')]=_0x133c45[_0x2628('0x52')][_0x2628('0x53')];}return db['Setting'][_0x2628('0x4f')]({'where':{'id':_0x133c45[_0x2628('0x4d')]['id']}})[_0x2628('0x1d')](handleEntityNotFound(_0x159bbe,null))[_0x2628('0x1d')](saveUpdates(_0x133c45[_0x2628('0x50')],null))[_0x2628('0x1d')](respondWithResult(_0x159bbe,null))['catch'](handleError(_0x159bbe,null));};var utilLicense=require(_0x2628('0x57'));exports['getFavicon']=function(_0x3f49ea,_0x46ec20,_0x46fd8f){var _0x18da16=_0x2628('0x59');var _0x4477de={'custom':![]};return utilLicense['getLicense']()[_0x2628('0x1d')](function(_0x494d23){if(_0x494d23){_0x4477de=_0x494d23;}return db[_0x2628('0x37')][_0x2628('0x4f')]({'where':{'id':_0x3f49ea[_0x2628('0x4d')]['id']},'attributes':[_0x2628('0x54'),_0x2628('0x56'),_0x2628('0x5a'),_0x2628('0x5b'),_0x2628('0x5c'),'defaultLoginLogo',_0x2628('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x2628('0x1d')](handleEntityNotFound(_0x46ec20,null))['then'](function(_0x4bf20c){if(_0x4bf20c){var _0x1dc844=_0x4bf20c['favicon']&&fs[_0x2628('0x65')](path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x18da16,_[_0x2628('0x64')](_0x4bf20c['favicon'])))?path['join'](config[_0x2628('0x60')],_0x18da16,_[_0x2628('0x64')](_0x4bf20c[_0x2628('0x5b')])):path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x18da16,_[_0x2628('0x64')]('default_favicon.ico'));var _0x327acd=_0x2628('0x62')+_['upperFirst'](_0x2628('0x5b'));if(_0x4bf20c[_0x327acd]||!_0x4477de['custom']){_0x1dc844=path[_0x2628('0x5f')](config[_0x2628('0x60')],_0x18da16,_[_0x2628('0x64')](_0x2628('0x73')));}if(!fs[_0x2628('0x65')](_0x1dc844)){throw new db[(_0x2628('0x6b'))]['ValidationError'](_['upperFirst'](_0x2628('0x5b'))+_0x2628('0x71'));}return _0x46ec20[_0x2628('0x6c')](_0x1dc844);}})[_0x2628('0x4c')](handleError(_0x46ec20,null));};exports[_0x2628('0x74')]=function(_0x5a1ed9,_0x35adcc){var _0x2b40ef={'offset':moment()[_0x2628('0x75')]()};_0x2b40ef[_0x2628('0x76')]=moment()['utcOffset'](_0x2b40ef['offset'])[_0x2628('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x35adcc[_0x2628('0x26')](0xc8)[_0x2628('0x78')](_0x2b40ef);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a8e97be..b3109fb 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x55ca,0x126));var _0xa55c=function(_0x3a93b7,_0x658183){_0x3a93b7=_0x3a93b7-0x0;var _0x2ed891=_0x55ca[_0x3a93b7];return _0x2ed891;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','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 a14d834..19b9880 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 _0x1285=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','Setting','options','raw','where','attributes','include','map','model','debug','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x1285,0x1e3));var _0x5128=function(_0x449d58,_0x59ba11){_0x449d58=_0x449d58-0x0;var _0x1abdeb=_0x1285[_0x449d58];return _0x1abdeb;};'use strict';var _=require('lodash');var util=require(_0x5128('0x0'));var moment=require(_0x5128('0x1'));var BPromise=require(_0x5128('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5128('0x3'))['db'];var utils=require(_0x5128('0x4'));var logger=require(_0x5128('0x5'))(_0x5128('0x6'));var config=require(_0x5128('0x7'));var jayson=require(_0x5128('0x8'));var client=jayson['client'][_0x5128('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df23e,_0x179c8d,_0x3bf857){return new BPromise(function(_0x526624,_0x281c1c){return client['request'](_0x2df23e,_0x3bf857)[_0x5128('0xa')](function(_0x38be58){logger[_0x5128('0xb')](_0x5128('0xc'),_0x179c8d,_0x5128('0xd'));logger['debug'](_0x5128('0xe'),_0x179c8d,_0x5128('0xd'),JSON[_0x5128('0xf')](_0x38be58));if(_0x38be58[_0x5128('0x10')]){if(_0x38be58['error'][_0x5128('0x11')]===0x1f4){logger[_0x5128('0x10')](_0x5128('0xc'),_0x179c8d,_0x38be58['error']['message']);return _0x281c1c(_0x38be58[_0x5128('0x10')][_0x5128('0x12')]);}logger[_0x5128('0x10')](_0x5128('0xc'),_0x179c8d,_0x38be58[_0x5128('0x10')]['message']);return _0x526624(_0x38be58[_0x5128('0x10')][_0x5128('0x12')]);}else{logger[_0x5128('0xb')]('Setting,\x20%s,\x20%s',_0x179c8d,_0x5128('0xd'));_0x526624(_0x38be58[_0x5128('0x13')][_0x5128('0x12')]);}})['catch'](function(_0x12f1e8){logger[_0x5128('0x10')]('Setting,\x20%s,\x20%s',_0x179c8d,_0x12f1e8);_0x281c1c(_0x12f1e8);});});}exports[_0x5128('0x14')]=function(_0x2c5302){var _0x179bfc=this;return new Promise(function(_0x4c682a,_0x2dc3e0){return db[_0x5128('0x15')]['find']({'raw':_0x2c5302[_0x5128('0x16')]?_0x2c5302[_0x5128('0x16')][_0x5128('0x17')]===undefined?!![]:![]:!![],'where':_0x2c5302[_0x5128('0x16')]?_0x2c5302[_0x5128('0x16')][_0x5128('0x18')]||null:null,'attributes':_0x2c5302['options']?_0x2c5302[_0x5128('0x16')][_0x5128('0x19')]||null:null,'include':_0x2c5302[_0x5128('0x16')]?_0x2c5302[_0x5128('0x16')][_0x5128('0x1a')]?_[_0x5128('0x1b')](_0x2c5302[_0x5128('0x16')][_0x5128('0x1a')],function(_0x570788){return{'model':db[_0x570788[_0x5128('0x1c')]],'as':_0x570788['as'],'attributes':_0x570788[_0x5128('0x19')],'include':_0x570788[_0x5128('0x1a')]?_[_0x5128('0x1b')](_0x570788[_0x5128('0x1a')],function(_0x2abc24){return{'model':db[_0x2abc24[_0x5128('0x1c')]],'as':_0x2abc24['as'],'attributes':_0x2abc24['attributes'],'include':_0x2abc24['include']?_[_0x5128('0x1b')](_0x2abc24[_0x5128('0x1a')],function(_0x750311){return{'model':db[_0x750311['model']],'as':_0x750311['as'],'attributes':_0x750311['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa28942){logger[_0x5128('0xb')](_0x5128('0x14'),_0x2c5302);logger[_0x5128('0x1d')](_0x5128('0x14'),_0x2c5302,JSON['stringify'](_0xa28942));_0x4c682a(_0xa28942);})[_0x5128('0x1e')](function(_0xade05e){logger[_0x5128('0x10')](_0x5128('0x14'),_0xade05e[_0x5128('0x12')],_0x2c5302);_0x2dc3e0(_0x179bfc[_0x5128('0x10')](0x1f4,_0xade05e[_0x5128('0x12')]));});});}; \ No newline at end of file +var _0x750f=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x750f,0x142));var _0xf750=function(_0x17b590,_0x438621){_0x17b590=_0x17b590-0x0;var _0x1fffab=_0x750f[_0x17b590];return _0x1fffab;};'use strict';var _=require(_0xf750('0x0'));var util=require(_0xf750('0x1'));var moment=require(_0xf750('0x2'));var BPromise=require(_0xf750('0x3'));var rs=require(_0xf750('0x4'));var fs=require('fs');var Redis=require(_0xf750('0x5'));var db=require(_0xf750('0x6'))['db'];var utils=require(_0xf750('0x7'));var logger=require(_0xf750('0x8'))(_0xf750('0x9'));var config=require(_0xf750('0xa'));var jayson=require(_0xf750('0xb'));var client=jayson['client'][_0xf750('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54ed27,_0x228edd,_0x1a2feb){return new BPromise(function(_0x2e5dda,_0x162cf6){return client[_0xf750('0xd')](_0x54ed27,_0x1a2feb)[_0xf750('0xe')](function(_0x41bab3){logger[_0xf750('0xf')](_0xf750('0x10'),_0x228edd,'request\x20sent');logger[_0xf750('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x228edd,'request\x20sent',JSON[_0xf750('0x12')](_0x41bab3));if(_0x41bab3[_0xf750('0x13')]){if(_0x41bab3['error'][_0xf750('0x14')]===0x1f4){logger[_0xf750('0x13')](_0xf750('0x10'),_0x228edd,_0x41bab3['error']['message']);return _0x162cf6(_0x41bab3[_0xf750('0x13')][_0xf750('0x15')]);}logger[_0xf750('0x13')]('Setting,\x20%s,\x20%s',_0x228edd,_0x41bab3[_0xf750('0x13')][_0xf750('0x15')]);return _0x2e5dda(_0x41bab3[_0xf750('0x13')][_0xf750('0x15')]);}else{logger[_0xf750('0xf')](_0xf750('0x10'),_0x228edd,_0xf750('0x16'));_0x2e5dda(_0x41bab3['result'][_0xf750('0x15')]);}})[_0xf750('0x17')](function(_0x1ab4be){logger[_0xf750('0x13')](_0xf750('0x10'),_0x228edd,_0x1ab4be);_0x162cf6(_0x1ab4be);});});}exports[_0xf750('0x18')]=function(_0x28edb9){var _0x8d7ed5=this;return new Promise(function(_0x9f3713,_0x22cc2e){return db[_0xf750('0x19')]['find']({'raw':_0x28edb9['options']?_0x28edb9[_0xf750('0x1a')][_0xf750('0x1b')]===undefined?!![]:![]:!![],'where':_0x28edb9['options']?_0x28edb9['options'][_0xf750('0x1c')]||null:null,'attributes':_0x28edb9['options']?_0x28edb9[_0xf750('0x1a')][_0xf750('0x1d')]||null:null,'include':_0x28edb9['options']?_0x28edb9[_0xf750('0x1a')][_0xf750('0x1e')]?_[_0xf750('0x1f')](_0x28edb9[_0xf750('0x1a')][_0xf750('0x1e')],function(_0x1d19fb){return{'model':db[_0x1d19fb[_0xf750('0x20')]],'as':_0x1d19fb['as'],'attributes':_0x1d19fb[_0xf750('0x1d')],'include':_0x1d19fb[_0xf750('0x1e')]?_[_0xf750('0x1f')](_0x1d19fb[_0xf750('0x1e')],function(_0x2924e5){return{'model':db[_0x2924e5[_0xf750('0x20')]],'as':_0x2924e5['as'],'attributes':_0x2924e5[_0xf750('0x1d')],'include':_0x2924e5[_0xf750('0x1e')]?_[_0xf750('0x1f')](_0x2924e5[_0xf750('0x1e')],function(_0x4c5770){return{'model':db[_0x4c5770[_0xf750('0x20')]],'as':_0x4c5770['as'],'attributes':_0x4c5770[_0xf750('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf750('0xe')](function(_0x42dcbe){logger[_0xf750('0xf')]('ShowSetting',_0x28edb9);logger[_0xf750('0x11')](_0xf750('0x18'),_0x28edb9,JSON['stringify'](_0x42dcbe));_0x9f3713(_0x42dcbe);})['catch'](function(_0x2c7f36){logger[_0xf750('0x13')](_0xf750('0x18'),_0x2c7f36['message'],_0x28edb9);_0x22cc2e(_0x8d7ed5[_0xf750('0x13')](0x1f4,_0x2c7f36['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c3d15f5..87b0e53 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 _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(_0xdb8c35,_0x49387e){var _0x3636f6=function(_0x30e5e8){while(--_0x30e5e8){_0xdb8c35['push'](_0xdb8c35['shift']());}};_0x3636f6(++_0x49387e);}(_0xe14b,0x93));var _0xbe14=function(_0x542b24,_0x2803a2){_0x542b24=_0x542b24-0x0;var _0x2a8359=_0xe14b[_0x542b24];return _0x2a8359;};'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 +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x9bb3ca,_0x5955e3){var _0x415694=function(_0x2b4841){while(--_0x2b4841){_0x9bb3ca['push'](_0x9bb3ca['shift']());}};_0x415694(++_0x5955e3);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c3a3d,_0x5a3d3d){_0x3c3a3d=_0x3c3a3d-0x0;var _0x3f7d2b=_0x6aa7[_0x3c3a3d];return _0x3f7d2b;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0489ce4..e13833c 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 _0xa36e=['BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer'];(function(_0x2fc734,_0x4dfd78){var _0x13d105=function(_0x2add85){while(--_0x2add85){_0x2fc734['push'](_0x2fc734['shift']());}};_0x13d105(++_0x4dfd78);}(_0xa36e,0x11f));var _0xea36=function(_0xd074e1,_0x4437a0){_0xd074e1=_0xd074e1-0x0;var _0x4fdb0c=_0xa36e[_0xd074e1];return _0x4fdb0c;};'use strict';var Sequelize=require(_0xea36('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xea36('0x1')],'unique':_0xea36('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xea36('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xea36('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xea36('0x1')],'defaultValue':function(){return rs[_0xea36('0x3')]();}},'phone':{'type':Sequelize[_0xea36('0x1')]},'type':{'type':Sequelize[_0xea36('0x4')](_0xea36('0x5'),'skebby',_0xea36('0x6'),_0xea36('0x7'),_0xea36('0x8'),_0xea36('0x9'),_0xea36('0xa'),'csc',_0xea36('0xb'),_0xea36('0xc'))},'accountSid':{'type':Sequelize[_0xea36('0x1')]},'authId':{'type':Sequelize[_0xea36('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xea36('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xea36('0x1')]},'password':{'type':Sequelize[_0xea36('0x1')]},'apiKey':{'type':Sequelize[_0xea36('0x1')]},'applicationId':{'type':Sequelize[_0xea36('0x1')]},'accountId':{'type':Sequelize[_0xea36('0x1')]},'senderString':{'type':Sequelize[_0xea36('0x1')]},'deliveryReport':{'type':Sequelize[_0xea36('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xea36('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xea36('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xea36('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xea36('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xea36('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xea36('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xea36('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xea36('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xea36('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xea36('0xd')],'defaultValue':![],'comment':_0xea36('0x10'),'set':function(_0x1201a1){if(!_0x1201a1)this[_0xea36('0x11')](_0xea36('0x12'),null);this['setDataValue'](_0xea36('0x13'),_0x1201a1);}}}; \ No newline at end of file +var _0x8996=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x36c080,_0x5a271c){var _0x5c3d43=function(_0x3bfed7){while(--_0x3bfed7){_0x36c080['push'](_0x36c080['shift']());}};_0x5c3d43(++_0x5a271c);}(_0x8996,0x84));var _0x6899=function(_0x55cb20,_0x31c96b){_0x55cb20=_0x55cb20-0x0;var _0x3a6aa5=_0x8996[_0x55cb20];return _0x3a6aa5;};'use strict';var Sequelize=require(_0x6899('0x0'));var rs=require('randomstring');module[_0x6899('0x1')]={'name':{'type':Sequelize[_0x6899('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6899('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6899('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6899('0x3')]('twilio',_0x6899('0x4'),_0x6899('0x5'),_0x6899('0x6'),_0x6899('0x7'),_0x6899('0x8'),_0x6899('0x9'),'csc',_0x6899('0xa'),_0x6899('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x6899('0x2')]},'authToken':{'type':Sequelize[_0x6899('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x6899('0x2')]},'password':{'type':Sequelize[_0x6899('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x6899('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6899('0x2')]},'deliveryReport':{'type':Sequelize[_0x6899('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6899('0xd')],'defaultValue':function(){return _0x6899('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6899('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6899('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6899('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6899('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6899('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6899('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6899('0xf')],'comment':_0x6899('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6899('0x11'),'set':function(_0xed3105){if(!_0xed3105)this[_0x6899('0x12')](_0x6899('0x13'),null);this['setDataValue'](_0x6899('0x14'),_0xed3105);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f9b9ad4..dd73bf6 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 _0xfe34=['save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','rows','show','params','include','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','account','twilio','from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','receiveMessage','entity\x20found','set','text/xml','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','Messages','dataValues','inspect','skebby_dispatch_id','statusInt','status_code','infobip','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xfe34,0xac));var _0x4fe3=function(_0x5939fe,_0x1c0873){_0x5939fe=_0x5939fe-0x0;var _0x283318=_0xfe34[_0x5939fe];return _0x283318;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fe3('0x0'));var zipdir=require(_0x4fe3('0x1'));var jsonpatch=require(_0x4fe3('0x2'));var rp=require(_0x4fe3('0x3'));var moment=require('moment');var BPromise=require(_0x4fe3('0x4'));var Mustache=require(_0x4fe3('0x5'));var util=require(_0x4fe3('0x6'));var path=require(_0x4fe3('0x7'));var sox=require(_0x4fe3('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('squel');var crypto=require(_0x4fe3('0x9'));var jsforce=require(_0x4fe3('0xa'));var deskjs=require(_0x4fe3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4fe3('0xc'));var Papa=require(_0x4fe3('0xd'));var Redis=require(_0x4fe3('0xe'));var authService=require(_0x4fe3('0xf'));var qs=require(_0x4fe3('0x10'));var as=require(_0x4fe3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fe3('0x12'))(_0x4fe3('0x13'));var utils=require('../../config/utils');var config=require(_0x4fe3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fe3('0x15'))['db'];config[_0x4fe3('0x16')]=_[_0x4fe3('0x17')](config['redis'],{'host':_0x4fe3('0x18'),'port':0x18eb});var socket=require(_0x4fe3('0x19'))(new Redis(config[_0x4fe3('0x16')]));require(_0x4fe3('0x1a'))[_0x4fe3('0x1b')](socket);var jayson=require(_0x4fe3('0x1c'));var client=jayson[_0x4fe3('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2edf77,_0x38bdf6,_0x4a0b0d,_0x5c4baf){return new BPromise(function(_0x3a3dd5,_0x32e5c0){var _0x8ceb5e=_0x5c4baf||client;return _0x8ceb5e[_0x4fe3('0x1e')](_0x2edf77,_0x4a0b0d)[_0x4fe3('0x1f')](function(_0x501e16){logger[_0x4fe3('0x20')](_0x4fe3('0x21'),_0x38bdf6,'request\x20sent');logger[_0x4fe3('0x22')](_0x4fe3('0x23'),_0x38bdf6,_0x4fe3('0x24'),JSON[_0x4fe3('0x25')](_0x501e16));if(_0x501e16['error']){if(_0x501e16['error'][_0x4fe3('0x26')]===0x1f4){logger[_0x4fe3('0x27')](_0x4fe3('0x21'),_0x38bdf6,_0x501e16['error']['message']);return _0x32e5c0(_0x501e16['error']['message']);}logger[_0x4fe3('0x27')](_0x4fe3('0x21'),_0x38bdf6,_0x501e16[_0x4fe3('0x27')][_0x4fe3('0x28')]);return _0x3a3dd5(_0x501e16['error'][_0x4fe3('0x28')]);}else{logger[_0x4fe3('0x20')](_0x4fe3('0x21'),_0x38bdf6,_0x4fe3('0x24'));_0x3a3dd5(_0x501e16[_0x4fe3('0x29')][_0x4fe3('0x28')]);}})[_0x4fe3('0x2a')](function(_0xa69f1f){logger[_0x4fe3('0x27')](_0x4fe3('0x21'),_0x38bdf6,_0xa69f1f);_0x32e5c0(_0xa69f1f);});});}function respondWithStatusCode(_0x153c23,_0x4d066e){_0x4d066e=_0x4d066e||0xcc;return function(_0x1b666b){if(_0x1b666b){return _0x153c23[_0x4fe3('0x2b')](_0x4d066e);}return _0x153c23[_0x4fe3('0x2c')](_0x4d066e)[_0x4fe3('0x2d')]();};}function respondWithResult(_0x122e07,_0x7ccbad){_0x7ccbad=_0x7ccbad||0xc8;return function(_0x5a363a){if(_0x5a363a){return _0x122e07[_0x4fe3('0x2c')](_0x7ccbad)['json'](_0x5a363a);}};}function respondWithFilteredResult(_0x1f63cf,_0x2d76b7){return function(_0x39a5b7){if(_0x39a5b7){var _0x2daa34=typeof _0x2d76b7[_0x4fe3('0x2e')]===_0x4fe3('0x2f')&&typeof _0x2d76b7[_0x4fe3('0x30')]==='undefined';var _0x4c0c3d=_0x39a5b7[_0x4fe3('0x31')];var _0x46a1e1=_0x2daa34?0x0:_0x2d76b7[_0x4fe3('0x2e')];var _0x2e0394=_0x2daa34?_0x39a5b7[_0x4fe3('0x31')]:_0x2d76b7[_0x4fe3('0x2e')]+_0x2d76b7[_0x4fe3('0x30')];var _0x2e504a;if(_0x2e0394>=_0x4c0c3d){_0x2e0394=_0x4c0c3d;_0x2e504a=0xc8;}else{_0x2e504a=0xce;}_0x1f63cf[_0x4fe3('0x2c')](_0x2e504a);return _0x1f63cf['set'](_0x4fe3('0x32'),_0x46a1e1+'-'+_0x2e0394+'/'+_0x4c0c3d)[_0x4fe3('0x33')](_0x39a5b7);}return null;};}function patchUpdates(_0x282e30){return function(_0x54fec5){try{jsonpatch[_0x4fe3('0x34')](_0x54fec5,_0x282e30,!![]);}catch(_0x1db4e5){return BPromise[_0x4fe3('0x35')](_0x1db4e5);}return _0x54fec5[_0x4fe3('0x36')]();};}function saveUpdates(_0x219296,_0x2bc730){return function(_0x229952){if(_0x229952){return _0x229952[_0x4fe3('0x37')](_0x219296)[_0x4fe3('0x1f')](function(_0x577c78){return _0x577c78;});}return null;};}function removeEntity(_0xd4d34e,_0x535d05){return function(_0x46bd53){if(_0x46bd53){return _0x46bd53[_0x4fe3('0x38')]()['then'](function(){var _0x4541a5=_0x46bd53[_0x4fe3('0x39')]({'plain':!![]});var _0x44c7a2=_0x4fe3('0x3a');return db[_0x4fe3('0x3b')]['destroy']({'where':{'type':_0x44c7a2,'resourceId':_0x4541a5['id']}})['then'](function(){return _0x46bd53;});})['then'](function(){_0xd4d34e['status'](0xcc)[_0x4fe3('0x2d')]();});}};}function handleEntityNotFound(_0x2ad0b8,_0x4f1587){return function(_0x378695){if(!_0x378695){_0x2ad0b8[_0x4fe3('0x2b')](0x194);}return _0x378695;};}function handleError(_0x3e02ae,_0x9aed1){_0x9aed1=_0x9aed1||0x1f4;return function(_0x5094bf){logger[_0x4fe3('0x27')](_0x5094bf['stack']);if(_0x5094bf[_0x4fe3('0x3c')]){delete _0x5094bf[_0x4fe3('0x3c')];}_0x3e02ae[_0x4fe3('0x2c')](_0x9aed1)[_0x4fe3('0x3d')](_0x5094bf);};}exports['index']=function(_0x12d254,_0xa1c1e1){var _0x53e88b={'include':[{'model':db[_0x4fe3('0x3e')],'as':_0x4fe3('0x3f')}]},_0x28eb09={},_0x3ae9f0={'count':0x0,'rows':[]};var _0x58ad42=_['map'](db[_0x4fe3('0x40')][_0x4fe3('0x41')],function(_0x526117){return{'name':_0x526117[_0x4fe3('0x42')],'type':_0x526117[_0x4fe3('0x43')][_0x4fe3('0x44')]};});_0x28eb09[_0x4fe3('0x45')]=_[_0x4fe3('0x46')](_0x58ad42,_0x4fe3('0x3c'));_0x28eb09['query']=_[_0x4fe3('0x47')](_0x12d254['query']);_0x28eb09[_0x4fe3('0x48')]=_[_0x4fe3('0x49')](_0x28eb09[_0x4fe3('0x45')],_0x28eb09[_0x4fe3('0x4a')]);_0x53e88b[_0x4fe3('0x4b')]=_[_0x4fe3('0x49')](_0x28eb09[_0x4fe3('0x45')],qs['fields'](_0x12d254[_0x4fe3('0x4a')][_0x4fe3('0x4c')]));_0x53e88b['attributes']=_0x53e88b[_0x4fe3('0x4b')][_0x4fe3('0x4d')]?_0x53e88b[_0x4fe3('0x4b')]:_0x28eb09[_0x4fe3('0x45')];if(!_0x12d254[_0x4fe3('0x4a')]['hasOwnProperty'](_0x4fe3('0x4e'))){_0x53e88b[_0x4fe3('0x30')]=qs[_0x4fe3('0x30')](_0x12d254['query']['limit']);_0x53e88b[_0x4fe3('0x2e')]=qs[_0x4fe3('0x2e')](_0x12d254['query']['offset']);}_0x53e88b[_0x4fe3('0x4f')]=qs['sort'](_0x12d254['query'][_0x4fe3('0x50')]);_0x53e88b['where']=qs[_0x4fe3('0x48')](_[_0x4fe3('0x51')](_0x12d254[_0x4fe3('0x4a')],_0x28eb09[_0x4fe3('0x48')]),_0x58ad42);if(_0x12d254[_0x4fe3('0x4a')]['filter']){_0x53e88b['where']=_['merge'](_0x53e88b[_0x4fe3('0x52')],{'$or':_[_0x4fe3('0x46')](_0x58ad42,function(_0x140980){if(_0x140980['type']!==_0x4fe3('0x53')){var _0x38266a={};_0x38266a[_0x140980[_0x4fe3('0x3c')]]={'$like':'%'+_0x12d254['query'][_0x4fe3('0x54')]+'%'};return _0x38266a;}})});}_0x53e88b=_['merge']({},_0x53e88b,_0x12d254['options']);var _0x232ddf={'where':_0x53e88b['where']};return db[_0x4fe3('0x40')][_0x4fe3('0x31')](_0x232ddf)[_0x4fe3('0x1f')](function(_0x3284fc){_0x3ae9f0[_0x4fe3('0x31')]=_0x3284fc;if(_0x12d254[_0x4fe3('0x4a')][_0x4fe3('0x55')]){_0x53e88b['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x53e88b);})['then'](function(_0x151488){_0x3ae9f0[_0x4fe3('0x56')]=_0x151488;return _0x3ae9f0;})['then'](respondWithFilteredResult(_0xa1c1e1,_0x53e88b))['catch'](handleError(_0xa1c1e1,null));};exports[_0x4fe3('0x57')]=function(_0x4b451f,_0x21b78b){var _0x75a407={'raw':![],'where':{'id':_0x4b451f[_0x4fe3('0x58')]['id']},'include':[{'model':db[_0x4fe3('0x3e')],'as':_0x4fe3('0x3f')}]},_0x15de24={};_0x15de24['model']=_[_0x4fe3('0x47')](db[_0x4fe3('0x40')]['rawAttributes']);_0x15de24['query']=_[_0x4fe3('0x47')](_0x4b451f[_0x4fe3('0x4a')]);_0x15de24[_0x4fe3('0x48')]=_['intersection'](_0x15de24[_0x4fe3('0x45')],_0x15de24[_0x4fe3('0x4a')]);_0x75a407[_0x4fe3('0x4b')]=_[_0x4fe3('0x49')](_0x15de24[_0x4fe3('0x45')],qs[_0x4fe3('0x4c')](_0x4b451f[_0x4fe3('0x4a')][_0x4fe3('0x4c')]));_0x75a407['attributes']=_0x75a407['attributes'][_0x4fe3('0x4d')]?_0x75a407['attributes']:_0x15de24[_0x4fe3('0x45')];if(_0x4b451f[_0x4fe3('0x4a')][_0x4fe3('0x55')]){_0x75a407[_0x4fe3('0x59')]=[{'all':!![]}];}_0x75a407=_[_0x4fe3('0x5a')]({},_0x75a407,_0x4b451f[_0x4fe3('0x5b')]);return db['SmsAccount'][_0x4fe3('0x5c')](_0x75a407)[_0x4fe3('0x1f')](handleEntityNotFound(_0x21b78b,null))[_0x4fe3('0x1f')](respondWithResult(_0x21b78b,null))[_0x4fe3('0x2a')](handleError(_0x21b78b,null));};exports[_0x4fe3('0x5d')]=function(_0x1fb6d6,_0x427310){return db[_0x4fe3('0x40')][_0x4fe3('0x5d')](_0x1fb6d6['body'],{})[_0x4fe3('0x1f')](function(_0x5e841b){var _0x5f3378=_0x1fb6d6[_0x4fe3('0x5e')]['get']({'plain':!![]});if(!_0x5f3378)throw new Error(_0x4fe3('0x5f'));if(_0x5f3378['role']===_0x4fe3('0x5e')){var _0x4ae5d7=_0x5e841b[_0x4fe3('0x39')]({'plain':!![]});var _0x44722c='SmsAccounts';return db[_0x4fe3('0x60')]['find']({'where':{'name':_0x44722c,'userProfileId':_0x5f3378[_0x4fe3('0x61')]},'raw':!![]})[_0x4fe3('0x1f')](function(_0x11764e){if(_0x11764e&&_0x11764e[_0x4fe3('0x62')]===0x0){return db[_0x4fe3('0x3b')][_0x4fe3('0x5d')]({'name':_0x4ae5d7[_0x4fe3('0x3c')],'resourceId':_0x4ae5d7['id'],'type':_0x11764e[_0x4fe3('0x3c')],'sectionId':_0x11764e['id']},{})[_0x4fe3('0x1f')](function(){return _0x5e841b;});}else{return _0x5e841b;}})[_0x4fe3('0x2a')](function(_0xdb102b){logger[_0x4fe3('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdb102b);throw _0xdb102b;});}return _0x5e841b;})[_0x4fe3('0x1f')](respondWithResult(_0x427310,0xc9))[_0x4fe3('0x2a')](handleError(_0x427310,null));};exports[_0x4fe3('0x37')]=function(_0x275fa9,_0x183c40){if(_0x275fa9[_0x4fe3('0x63')]['id']){delete _0x275fa9[_0x4fe3('0x63')]['id'];}return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x275fa9[_0x4fe3('0x58')]['id']},'include':[{'model':db[_0x4fe3('0x3e')],'as':_0x4fe3('0x3f')}]})[_0x4fe3('0x1f')](handleEntityNotFound(_0x183c40,null))[_0x4fe3('0x1f')](saveUpdates(_0x275fa9[_0x4fe3('0x63')],null))[_0x4fe3('0x1f')](respondWithResult(_0x183c40,null))[_0x4fe3('0x2a')](handleError(_0x183c40,null));};exports[_0x4fe3('0x38')]=function(_0x44ac6a,_0x16d1ef){return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x44ac6a['params']['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x16d1ef,null))['then'](removeEntity(_0x16d1ef,null))[_0x4fe3('0x2a')](handleError(_0x16d1ef,null));};exports['describe']=function(_0x560aee,_0x469278){return db['SmsAccount']['describe']()[_0x4fe3('0x1f')](respondWithResult(_0x469278,null))[_0x4fe3('0x2a')](handleError(_0x469278,null));};exports[_0x4fe3('0x64')]=function(_0x27a8ba,_0x5030d3,_0x39652b){if(_0x27a8ba['body']['id']){delete _0x27a8ba[_0x4fe3('0x63')]['id'];}return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x27a8ba[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x5030d3,null))[_0x4fe3('0x1f')](function(_0x67b435){if(_0x67b435){_0x27a8ba[_0x4fe3('0x63')][_0x4fe3('0x65')]=_0x67b435['id'];return db[_0x4fe3('0x66')][_0x4fe3('0x5d')](_0x27a8ba[_0x4fe3('0x63')]);}})[_0x4fe3('0x1f')](respondWithResult(_0x5030d3,null))[_0x4fe3('0x2a')](handleError(_0x5030d3,null));};exports[_0x4fe3('0x67')]=function(_0x35268e,_0x2ce68b,_0x8a43f1){var _0x51fd5d={'raw':![],'where':{}};var _0x339df3={};var _0x1b3c24={'count':0x0,'rows':[]};return db[_0x4fe3('0x40')][_0x4fe3('0x68')]({'where':{'id':_0x35268e[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x2ce68b,null))[_0x4fe3('0x1f')](function(_0x502387){if(_0x502387){_0x339df3[_0x4fe3('0x45')]=_[_0x4fe3('0x47')](db[_0x4fe3('0x66')][_0x4fe3('0x41')]);_0x339df3[_0x4fe3('0x4a')]=_['keys'](_0x35268e[_0x4fe3('0x4a')]);_0x339df3[_0x4fe3('0x48')]=_[_0x4fe3('0x49')](_0x339df3[_0x4fe3('0x45')],_0x339df3[_0x4fe3('0x4a')]);_0x51fd5d[_0x4fe3('0x4b')]=_[_0x4fe3('0x49')](_0x339df3[_0x4fe3('0x45')],qs[_0x4fe3('0x4c')](_0x35268e['query'][_0x4fe3('0x4c')]));_0x51fd5d[_0x4fe3('0x4b')]=_0x51fd5d[_0x4fe3('0x4b')][_0x4fe3('0x4d')]?_0x51fd5d[_0x4fe3('0x4b')]:_0x339df3[_0x4fe3('0x45')];if(!_0x35268e['query'][_0x4fe3('0x69')](_0x4fe3('0x4e'))){_0x51fd5d[_0x4fe3('0x30')]=qs[_0x4fe3('0x30')](_0x35268e[_0x4fe3('0x4a')][_0x4fe3('0x30')]);_0x51fd5d[_0x4fe3('0x2e')]=qs[_0x4fe3('0x2e')](_0x35268e[_0x4fe3('0x4a')][_0x4fe3('0x2e')]);}_0x51fd5d[_0x4fe3('0x4f')]=qs[_0x4fe3('0x50')](_0x35268e[_0x4fe3('0x4a')][_0x4fe3('0x50')]);_0x51fd5d[_0x4fe3('0x52')]=qs[_0x4fe3('0x48')](_[_0x4fe3('0x51')](_0x35268e[_0x4fe3('0x4a')],_0x339df3[_0x4fe3('0x48')]));_0x51fd5d[_0x4fe3('0x52')]['SmsAccountId']=_0x502387['id'];if(_0x35268e['query'][_0x4fe3('0x54')]){_0x51fd5d[_0x4fe3('0x52')]=_[_0x4fe3('0x5a')](_0x51fd5d['where'],{'$or':_['map'](_0x51fd5d[_0x4fe3('0x4b')],function(_0x3293fb){var _0x1cf46f={};_0x1cf46f[_0x3293fb]={'$like':'%'+_0x35268e['query']['filter']+'%'};return _0x1cf46f;})});}_0x51fd5d=_[_0x4fe3('0x5a')]({},_0x51fd5d,_0x35268e[_0x4fe3('0x5b')]);return db[_0x4fe3('0x66')][_0x4fe3('0x31')]({'where':_0x51fd5d[_0x4fe3('0x52')]})['then'](function(_0x1163fe){_0x1b3c24[_0x4fe3('0x31')]=_0x1163fe;if(_0x35268e[_0x4fe3('0x4a')]['includeAll']){_0x51fd5d['include']=[{'all':!![]}];}return db[_0x4fe3('0x66')][_0x4fe3('0x6a')](_0x51fd5d);})[_0x4fe3('0x1f')](function(_0x12b714){_0x1b3c24['rows']=_0x12b714;return _0x1b3c24;});}})[_0x4fe3('0x1f')](respondWithFilteredResult(_0x2ce68b,_0x51fd5d))[_0x4fe3('0x2a')](handleError(_0x2ce68b,null));};exports[_0x4fe3('0x6b')]=function(_0x34da9c,_0x56674f,_0x20b326){return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x34da9c[_0x4fe3('0x58')]['id']}})['then'](handleEntityNotFound(_0x56674f,null))[_0x4fe3('0x1f')](function(_0x56676e){if(_0x56676e){return _0x56676e[_0x4fe3('0x6b')](_0x34da9c['query'][_0x4fe3('0x6c')]);}})[_0x4fe3('0x1f')](respondWithStatusCode(_0x56674f,null))[_0x4fe3('0x2a')](handleError(_0x56674f,null));};exports['addAnswer']=function(_0x575bb8,_0x57e9a0,_0x20eebb){if(_0x575bb8[_0x4fe3('0x63')]['id']){delete _0x575bb8[_0x4fe3('0x63')]['id'];}return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x575bb8[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x57e9a0,null))[_0x4fe3('0x1f')](function(_0x1b7829){if(_0x1b7829){_0x575bb8['body']['SmsAccountId']=_0x1b7829['id'];return db[_0x4fe3('0x6d')][_0x4fe3('0x5d')](_0x575bb8[_0x4fe3('0x63')]);}})[_0x4fe3('0x1f')](respondWithResult(_0x57e9a0,null))['catch'](handleError(_0x57e9a0,null));};exports[_0x4fe3('0x6e')]=function(_0x5bbd1a,_0x33bd30,_0xd486fa){var _0x460e96={'raw':![],'where':{}};var _0xbaabea={};var _0x1a4d0e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4fe3('0x68')]({'where':{'id':_0x5bbd1a[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x33bd30,null))[_0x4fe3('0x1f')](function(_0x5ce331){if(_0x5ce331){_0xbaabea[_0x4fe3('0x45')]=_['keys'](db['CannedAnswer'][_0x4fe3('0x41')]);_0xbaabea[_0x4fe3('0x4a')]=_['keys'](_0x5bbd1a[_0x4fe3('0x4a')]);_0xbaabea['filters']=_['intersection'](_0xbaabea[_0x4fe3('0x45')],_0xbaabea[_0x4fe3('0x4a')]);_0x460e96[_0x4fe3('0x4b')]=_['intersection'](_0xbaabea['model'],qs[_0x4fe3('0x4c')](_0x5bbd1a['query']['fields']));_0x460e96[_0x4fe3('0x4b')]=_0x460e96[_0x4fe3('0x4b')][_0x4fe3('0x4d')]?_0x460e96[_0x4fe3('0x4b')]:_0xbaabea['model'];if(!_0x5bbd1a[_0x4fe3('0x4a')][_0x4fe3('0x69')]('nolimit')){_0x460e96[_0x4fe3('0x30')]=qs[_0x4fe3('0x30')](_0x5bbd1a[_0x4fe3('0x4a')][_0x4fe3('0x30')]);_0x460e96['offset']=qs[_0x4fe3('0x2e')](_0x5bbd1a[_0x4fe3('0x4a')][_0x4fe3('0x2e')]);}_0x460e96['order']=qs[_0x4fe3('0x50')](_0x5bbd1a[_0x4fe3('0x4a')][_0x4fe3('0x50')]);_0x460e96[_0x4fe3('0x52')]=qs[_0x4fe3('0x48')](_['pick'](_0x5bbd1a[_0x4fe3('0x4a')],_0xbaabea[_0x4fe3('0x48')]));_0x460e96['where'][_0x4fe3('0x65')]=_0x5ce331['id'];if(_0x5bbd1a['query']['filter']){_0x460e96[_0x4fe3('0x52')]=_[_0x4fe3('0x5a')](_0x460e96[_0x4fe3('0x52')],{'$or':_['map'](_0x460e96['attributes'],function(_0x28abe8){var _0x43261f={};_0x43261f[_0x28abe8]={'$like':'%'+_0x5bbd1a[_0x4fe3('0x4a')][_0x4fe3('0x54')]+'%'};return _0x43261f;})});}_0x460e96=_[_0x4fe3('0x5a')]({},_0x460e96,_0x5bbd1a[_0x4fe3('0x5b')]);return db[_0x4fe3('0x6d')][_0x4fe3('0x31')]({'where':_0x460e96[_0x4fe3('0x52')]})['then'](function(_0x24b682){_0x1a4d0e[_0x4fe3('0x31')]=_0x24b682;if(_0x5bbd1a[_0x4fe3('0x4a')]['includeAll']){_0x460e96[_0x4fe3('0x59')]=[{'all':!![]}];}return db[_0x4fe3('0x6d')][_0x4fe3('0x6a')](_0x460e96);})[_0x4fe3('0x1f')](function(_0x483f8e){_0x1a4d0e[_0x4fe3('0x56')]=_0x483f8e;return _0x1a4d0e;});}})[_0x4fe3('0x1f')](respondWithFilteredResult(_0x33bd30,_0x460e96))['catch'](handleError(_0x33bd30,null));};exports['removeAnswers']=function(_0x3d4726,_0x58fcdf,_0xcb1adf){return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x3d4726[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x58fcdf,null))[_0x4fe3('0x1f')](function(_0x1d8635){if(_0x1d8635){return _0x1d8635[_0x4fe3('0x6f')](_0x3d4726[_0x4fe3('0x4a')][_0x4fe3('0x6c')]);}})[_0x4fe3('0x1f')](respondWithStatusCode(_0x58fcdf,null))['catch'](handleError(_0x58fcdf,null));};exports[_0x4fe3('0x70')]=function(_0x2068fb,_0x53c677,_0x8e0da0){var _0x812dd5={'channel':_0x4fe3('0x71')};var _0x2f1c6e=[];var _0x48a498=[];var _0x5b6930={};return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x2068fb[_0x4fe3('0x58')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x4fe3('0x72')}]})['then'](handleEntityNotFound(_0x53c677,null))['then'](function(_0x2255ac){_0x812dd5['account']=_0x2255ac;_0x812dd5[_0x4fe3('0x73')]=_['orderBy'](_0x2255ac[_0x4fe3('0x72')],['priority'],[_0x4fe3('0x74')]);if(_0x812dd5['account'][_0x4fe3('0x72')]){delete _0x812dd5['account'][_0x4fe3('0x72')];}return db[_0x4fe3('0x75')]['describe']();})[_0x4fe3('0x1f')](function(_0x488346){if(!_0x488346){throw new db[(_0x4fe3('0x76'))]['ValidationError'](_0x4fe3('0x77'));}_0x2f1c6e=_[_0x4fe3('0x78')](_[_0x4fe3('0x47')](_0x488346),[_0x4fe3('0x79'),_0x4fe3('0x7a')]);_0x48a498=_[_0x4fe3('0x78')](_['keys'](_0x488346),[_0x4fe3('0x79'),_0x4fe3('0x7a'),_0x4fe3('0x7b'),_0x4fe3('0x7c')]);_0x812dd5['body']={'mapKey':_0x4fe3('0x7d')};if(_0x812dd5[_0x4fe3('0x7e')][_0x4fe3('0x43')]){switch(_0x812dd5[_0x4fe3('0x7e')][_0x4fe3('0x43')]){case _0x4fe3('0x7f'):_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x81')];_0x812dd5[_0x4fe3('0x63')]['body']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x82')];_0x812dd5[_0x4fe3('0x63')]['messageId']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x83')];break;case _0x4fe3('0x84'):_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')]='+'+_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x85')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb['body'][_0x4fe3('0x86')];break;case _0x4fe3('0x87'):_0x812dd5[_0x4fe3('0x63')]['from']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x80')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x28')];break;case _0x4fe3('0x88'):_0x812dd5[_0x4fe3('0x63')]['from']=_0x2068fb[_0x4fe3('0x63')]['from'];_0x812dd5[_0x4fe3('0x63')]['body']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x63')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x89')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8a')];break;case'plivo':_0x812dd5['body']['from']=_0x2068fb[_0x4fe3('0x63')]['From'];_0x812dd5[_0x4fe3('0x63')]['body']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8b')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x89')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8c')];break;case'infobip':_0x812dd5['body'][_0x4fe3('0x80')]='+'+_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8d')][0x0][_0x4fe3('0x80')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb['body'][_0x4fe3('0x8d')][0x0]['text'];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x89')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8d')][0x0][_0x4fe3('0x89')];break;case _0x4fe3('0x8e'):_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x8f')];_0x812dd5[_0x4fe3('0x63')]['body']=_0x2068fb['body']['segmentedMessage']['message'];break;case _0x4fe3('0x90'):_0x812dd5['body'][_0x4fe3('0x80')]=_0x2068fb['body'][_0x4fe3('0x91')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x86')];_0x812dd5[_0x4fe3('0x63')]['messageId']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x92')];break;case _0x4fe3('0x93'):_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x89')]=_0x2068fb[_0x4fe3('0x63')][0x0][_0x4fe3('0x28')]['id'];_0x812dd5[_0x4fe3('0x63')]['from']=_0x2068fb['body'][0x0][_0x4fe3('0x28')][_0x4fe3('0x80')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb[_0x4fe3('0x63')][0x0][_0x4fe3('0x28')][_0x4fe3('0x86')];break;case _0x4fe3('0x94'):_0x812dd5[_0x4fe3('0x63')]['from']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x80')];_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')]=_0x2068fb['body']['message'];_0x812dd5[_0x4fe3('0x63')]['messageId']=_0x2068fb[_0x4fe3('0x63')][_0x4fe3('0x95')];break;}}if(_0x812dd5['body']['id']){delete _0x812dd5['body']['id'];}if(_[_0x4fe3('0x96')](_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')])){throw new db['Sequelize']['ValidationError'](_0x4fe3('0x97'));}if(_['isNil'](_0x812dd5[_0x4fe3('0x63')]['body'])||_0x812dd5[_0x4fe3('0x63')]['body']===''){throw new db[(_0x4fe3('0x76'))][(_0x4fe3('0x98'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4fe3('0x96')](_0x812dd5['body'][_0x4fe3('0x99')])){throw new db[(_0x4fe3('0x76'))][(_0x4fe3('0x98'))](_0x4fe3('0x9a')+_0x48a498);}if(!_[_0x4fe3('0x9b')](_0x48a498,_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x99')])){throw new db[(_0x4fe3('0x76'))][(_0x4fe3('0x98'))](_0x4fe3('0x9c')+_0x48a498);}_0x5b6930[_0x812dd5['body'][_0x4fe3('0x99')]]=_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')];return db['CmList']['find']({'where':{'id':_0x812dd5[_0x4fe3('0x7e')][_0x4fe3('0x7c')]},'include':[{'model':db['CmContact'],'as':_0x4fe3('0x9d'),'where':_0x5b6930,'limit':0x1,'order':[[_0x4fe3('0x7a'),'DESC']]}]});})[_0x4fe3('0x1f')](handleEntityNotFound(_0x53c677,null))[_0x4fe3('0x1f')](function(_0x4866cb){if(_0x4866cb){_0x812dd5[_0x4fe3('0x9e')]=_['omit'](_0x4866cb,[_0x4fe3('0x9d')]);if(_0x4866cb['Contacts'][_0x4fe3('0x4d')]){return _0x4866cb[_0x4fe3('0x9d')][0x0];}var _0x4b5392=_['defaults'](_0x812dd5['body'],{'firstName':_0x812dd5[_0x4fe3('0x63')]['from'],'ListId':_0x4866cb['id']});_0x4b5392[_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x99')]]=_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x80')];return db['CmContact']['create'](_0x4b5392,{'fields':_0x2f1c6e,'raw':!![]});}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x53c677,null))[_0x4fe3('0x1f')](function(_0x49371b){if(_0x49371b){_0x812dd5[_0x4fe3('0x9f')]=_0x49371b;var _0x278f26={'ContactId':_0x49371b['id'],'phone':_0x812dd5[_0x4fe3('0x63')]['from'],'SmsAccountId':_0x2068fb['params']['id']};var _0x4c3873={'ContactId':_0x49371b['id'],'SmsAccountId':_0x2068fb[_0x4fe3('0x58')]['id'],'closed':![]};return db[_0x4fe3('0xa0')]['find']({'where':_0x4c3873})[_0x4fe3('0x1f')](function(_0x3a6656){if(_0x3a6656){return[_0x3a6656,![]];}return db[_0x4fe3('0xa0')][_0x4fe3('0x5d')](_0x278f26)['then'](function(_0x5f2183){return[_0x5f2183,!![]];});});}})[_0x4fe3('0xa1')](function(_0x306afd,_0x201538){_0x812dd5[_0x4fe3('0xa2')]=_0x306afd[_0x4fe3('0x39')]({'plain':!![]});_0x812dd5[_0x4fe3('0xa2')][_0x4fe3('0xa3')]=![];if(_0x201538){if(_0x812dd5[_0x4fe3('0x7e')][_0x4fe3('0xa4')]){_0x812dd5[_0x4fe3('0x73')][_0x4fe3('0xa5')]({'id':0x0,'priority':_0x812dd5[_0x4fe3('0x73')][_0x4fe3('0x4d')]+0x1,'app':_0x4fe3('0xa6'),'appdata':_0x4fe3('0xa7'),'interval':'*,*,*,*'});}_0x812dd5[_0x4fe3('0xa2')]['created']=!![];}return db[_0x4fe3('0xa8')]['create']({'phone':_0x812dd5['body']['from'],'messageId':_0x812dd5['body'][_0x4fe3('0x89')],'body':_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0x63')],'SmsAccountId':_0x2068fb[_0x4fe3('0x58')]['id'],'SmsInteractionId':_0x306afd['id'],'direction':'in','ContactId':_0x306afd[_0x4fe3('0xa9')],'AttachmentId':_0x812dd5[_0x4fe3('0x63')][_0x4fe3('0xaa')]});})[_0x4fe3('0x1f')](function(_0x4cd483){_0x812dd5[_0x4fe3('0x28')]=_0x4cd483;if(_0x812dd5['interaction'][_0x4fe3('0xab')]){return db[_0x4fe3('0xac')][_0x4fe3('0x5c')]({'attributes':['id',_0x4fe3('0x3c')],'where':{'id':_0x812dd5[_0x4fe3('0xa2')][_0x4fe3('0xab')]}})['then'](function(_0x4edc9d){if(_0x4edc9d){_0x812dd5[_0x4fe3('0x73')][_0x4fe3('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4edc9d['name']+','+(_0x812dd5[_0x4fe3('0x7e')][_0x4fe3('0xae')]||0xa),'interval':_0x4fe3('0xaf')});}return respondWithRpcPromise('Start',_0x4fe3('0xb0'),_0x812dd5);});}return respondWithRpcPromise('Start',_0x4fe3('0xb0'),_0x812dd5);})['then'](function(_0xbd0823){if(_0xbd0823){var _0x1f6118=0xc8;var _0x47c368=_0x4fe3('0xb1');logger[_0x4fe3('0x20')](_0x4fe3('0x23'),_0x47c368,_0x1f6118,_0x4fe3('0xb2'));logger[_0x4fe3('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x47c368,_0x1f6118,_0x4fe3('0xb2'),JSON['stringify'](_0xbd0823));if(_0x812dd5['account'][_0x4fe3('0x43')]===_0x4fe3('0x7f')){return _0x53c677[_0x4fe3('0x2c')](_0x1f6118)[_0x4fe3('0xb3')]('Content-Type',_0x4fe3('0xb4'))[_0x4fe3('0x3d')]('\x0a');}else{return _0x53c677[_0x4fe3('0x2c')](_0x1f6118)['json'](_0xbd0823);}}})[_0x4fe3('0x2a')](handleError(_0x53c677,null));};exports['addApplications']=function(_0x307848,_0x31f84b){var _0x187e55=_0x307848[_0x4fe3('0x58')]['id'];var _0x45345c=_0x307848['body'];var _0x1edddf=0xc8;var _0x2c0aff=null;return db[_0x4fe3('0xb5')][_0x4fe3('0xb6')]({'isolationLevel':db[_0x4fe3('0xb5')][_0x4fe3('0xb7')][_0x4fe3('0xb8')][_0x4fe3('0xb9')]},function(_0x4442d1){return db[_0x4fe3('0x40')][_0x4fe3('0x68')]({'where':{'id':_0x187e55},'transaction':_0x4442d1})['then'](function(_0x5d62c0){if(_0x5d62c0){return db[_0x4fe3('0xba')][_0x4fe3('0x38')]({'where':{'SmsAccountId':_0x187e55},'transaction':_0x4442d1})[_0x4fe3('0x1f')](function(){var _0x13dcc1=_[_0x4fe3('0x46')](_0x45345c,function(_0x1d83d3){_0x1d83d3[_0x4fe3('0x65')]=_0x187e55;return _0x1d83d3;});return db[_0x4fe3('0xba')][_0x4fe3('0xbb')](_0x13dcc1,{'transaction':_0x4442d1});});}else{_0x1edddf=0x194;_0x2c0aff=[];}});})['then'](function(){if(_0x1edddf!==0x194){return db[_0x4fe3('0xba')][_0x4fe3('0xbc')]({'where':{'SmsAccountId':_0x187e55},'order':_0x4fe3('0xbd')})[_0x4fe3('0x1f')](function(_0x34b054){_0x2c0aff=_0x34b054;});}})[_0x4fe3('0x2a')](function(_0x38ce83){_0x1edddf=0x1f4;logger[_0x4fe3('0x27')](_0x38ce83['stack']);if(_0x38ce83[_0x4fe3('0x3c')]){delete _0x38ce83['name'];}_0x2c0aff=_0x38ce83;})['finally'](function(){if(_0x2c0aff===null){_0x31f84b[_0x4fe3('0x2b')](_0x1edddf);}else{if(_0x1edddf===0x1f4){_0x31f84b['status'](_0x1edddf)[_0x4fe3('0x3d')](_0x2c0aff);}else{_0x31f84b['status'](_0x1edddf)['json'](_0x2c0aff);}}});};exports[_0x4fe3('0xbe')]=function(_0x4e3cf2,_0x17e574,_0x1d16d1){var _0x1c39e6={};var _0x138107={};var _0x3d0c1f;var _0x5b1a46;return db[_0x4fe3('0x40')][_0x4fe3('0x68')]({'where':{'id':_0x4e3cf2[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x17e574,null))['then'](function(_0x5b5616){if(_0x5b5616){_0x3d0c1f=_0x5b5616;_0x138107[_0x4fe3('0x45')]=_['keys'](db[_0x4fe3('0xba')][_0x4fe3('0x41')]);_0x138107[_0x4fe3('0x4a')]=_[_0x4fe3('0x47')](_0x4e3cf2[_0x4fe3('0x4a')]);_0x138107['filters']=_['intersection'](_0x138107[_0x4fe3('0x45')],_0x138107['query']);_0x1c39e6[_0x4fe3('0x4b')]=_['intersection'](_0x138107['model'],qs[_0x4fe3('0x4c')](_0x4e3cf2[_0x4fe3('0x4a')]['fields']));_0x1c39e6[_0x4fe3('0x4b')]=_0x1c39e6[_0x4fe3('0x4b')][_0x4fe3('0x4d')]?_0x1c39e6[_0x4fe3('0x4b')]:_0x138107[_0x4fe3('0x45')];_0x1c39e6[_0x4fe3('0x4f')]=qs[_0x4fe3('0x50')](_0x4e3cf2[_0x4fe3('0x4a')]['sort']);_0x1c39e6[_0x4fe3('0x52')]=qs['filters'](_['pick'](_0x4e3cf2[_0x4fe3('0x4a')],_0x138107['filters']));if(_0x4e3cf2[_0x4fe3('0x4a')][_0x4fe3('0x54')]){_0x1c39e6[_0x4fe3('0x52')]=_['merge'](_0x1c39e6[_0x4fe3('0x52')],{'$or':_[_0x4fe3('0x46')](_0x1c39e6[_0x4fe3('0x4b')],function(_0x564871){var _0x8c91b1={};_0x8c91b1[_0x564871]={'$like':'%'+_0x4e3cf2[_0x4fe3('0x4a')][_0x4fe3('0x54')]+'%'};return _0x8c91b1;})});}_0x1c39e6=_[_0x4fe3('0x5a')]({},_0x1c39e6,_0x4e3cf2[_0x4fe3('0x5b')]);return _0x3d0c1f[_0x4fe3('0xbe')](_0x1c39e6);}})[_0x4fe3('0x1f')](function(_0x2be1aa){if(_0x2be1aa){_0x5b1a46=_0x2be1aa[_0x4fe3('0x4d')];if(!_0x4e3cf2[_0x4fe3('0x4a')][_0x4fe3('0x69')](_0x4fe3('0x4e'))){_0x1c39e6['limit']=qs[_0x4fe3('0x30')](_0x4e3cf2[_0x4fe3('0x4a')][_0x4fe3('0x30')]);_0x1c39e6[_0x4fe3('0x2e')]=qs[_0x4fe3('0x2e')](_0x4e3cf2[_0x4fe3('0x4a')]['offset']);}return _0x3d0c1f['getApplications'](_0x1c39e6);}})[_0x4fe3('0x1f')](function(_0x19dad5){if(_0x19dad5){return _0x19dad5?{'count':_0x5b1a46,'rows':_0x19dad5}:null;}})[_0x4fe3('0x1f')](respondWithResult(_0x17e574,null))[_0x4fe3('0x2a')](handleError(_0x17e574,null));};exports[_0x4fe3('0xbf')]=function(_0x308fe2,_0x2ff18a,_0xdab171){var _0xc433ee={'raw':![],'where':{}};var _0x41c1f3={};var _0x52f817={'count':0x0,'rows':[]};return db[_0x4fe3('0x40')][_0x4fe3('0x68')]({'where':{'id':_0x308fe2[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x2ff18a,null))[_0x4fe3('0x1f')](function(_0x12ae58){if(_0x12ae58){_0x41c1f3['model']=_[_0x4fe3('0x47')](db[_0x4fe3('0xa0')][_0x4fe3('0x41')]);_0x41c1f3[_0x4fe3('0x4a')]=_[_0x4fe3('0x47')](_0x308fe2[_0x4fe3('0x4a')]);_0x41c1f3[_0x4fe3('0x48')]=_[_0x4fe3('0x49')](_0x41c1f3[_0x4fe3('0x45')],_0x41c1f3[_0x4fe3('0x4a')]);_0xc433ee[_0x4fe3('0x4b')]=_['intersection'](_0x41c1f3[_0x4fe3('0x45')],qs['fields'](_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0x4c')]));_0xc433ee[_0x4fe3('0x4b')]=_0xc433ee[_0x4fe3('0x4b')][_0x4fe3('0x4d')]?_0xc433ee[_0x4fe3('0x4b')]:_0x41c1f3[_0x4fe3('0x45')];if(!_0x308fe2['query'][_0x4fe3('0x69')](_0x4fe3('0x4e'))){_0xc433ee[_0x4fe3('0x30')]=qs[_0x4fe3('0x30')](_0x308fe2[_0x4fe3('0x4a')]['limit']);_0xc433ee['offset']=qs['offset'](_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0x2e')]);}_0xc433ee[_0x4fe3('0x4f')]=qs['sort'](_0x308fe2['query'][_0x4fe3('0x50')]);_0xc433ee[_0x4fe3('0x52')]=qs['filters'](_[_0x4fe3('0x51')](_0x308fe2[_0x4fe3('0x4a')],_0x41c1f3['filters']));_0xc433ee[_0x4fe3('0x52')][_0x4fe3('0x65')]=_0x12ae58['id'];if(_0x308fe2['query'][_0x4fe3('0x54')]){_0xc433ee[_0x4fe3('0x52')]=_['merge'](_0xc433ee['where'],{'$or':_[_0x4fe3('0x46')](_0xc433ee[_0x4fe3('0x4b')],function(_0x5a6095){var _0xee3a25={};_0xee3a25[_0x5a6095]={'$like':'%'+_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0x54')]+'%'};return _0xee3a25;})});}_0xc433ee=_[_0x4fe3('0x5a')]({},_0xc433ee,_0x308fe2[_0x4fe3('0x5b')]);return db['SmsInteraction'][_0x4fe3('0x31')]({'where':_0xc433ee[_0x4fe3('0x52')]})[_0x4fe3('0x1f')](function(_0x692cdc){_0x52f817['count']=_0x692cdc;if(_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0x55')]){_0xc433ee[_0x4fe3('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4fe3('0xac')],'as':_0x4fe3('0xc0'),'attributes':[_0x4fe3('0x3c'),_0x4fe3('0xc1'),_0x4fe3('0xc2')],'required':![]},{'model':db[_0x4fe3('0xc3')],'as':_0x4fe3('0xc4'),'attributes':['id','name',_0x4fe3('0xc5')],'where':_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0xc6')]?{'id':_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0xc6')]}:undefined,'required':_0x308fe2[_0x4fe3('0x4a')][_0x4fe3('0xc6')]?!![]:![]}];}return db[_0x4fe3('0xa0')][_0x4fe3('0x6a')](_0xc433ee);})['then'](function(_0x2dc5f6){_0x52f817[_0x4fe3('0x56')]=_0x2dc5f6;return _0x52f817;});}})[_0x4fe3('0x1f')](respondWithFilteredResult(_0x2ff18a,_0xc433ee))['catch'](handleError(_0x2ff18a,null));};exports[_0x4fe3('0x3d')]=function(_0x484715,_0x2c559,_0x23b6d4){var _0x204489,_0x4873a5,_0x418a7c;if(_[_0x4fe3('0x96')](_0x484715[_0x4fe3('0x63')]['body'])||_0x484715['body'][_0x4fe3('0x63')]===''){throw new db[(_0x4fe3('0x76'))][(_0x4fe3('0x98'))](_0x4fe3('0xc7'));}if(_[_0x4fe3('0x96')](_0x484715[_0x4fe3('0x63')]['to'])){throw new db['Sequelize'][(_0x4fe3('0x98'))]('to\x20is\x20mandatory');}_0x204489=_0x484715[_0x4fe3('0x63')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x484715[_0x4fe3('0x58')]['id']},'include':[{'model':db[_0x4fe3('0xc8')],'as':_0x4fe3('0xc9'),'include':[{'model':db[_0x4fe3('0x75')],'as':_0x4fe3('0x9d'),'where':{'mobile':_0x204489},'limit':0x1,'order':[[_0x4fe3('0x7a'),'DESC']]}]}]})[_0x4fe3('0x1f')](handleEntityNotFound(_0x2c559,null))[_0x4fe3('0x1f')](function(_0x1f3fb4){if(_0x1f3fb4&&_0x1f3fb4[_0x4fe3('0xc9')]){_0x4873a5=_0x1f3fb4[_0x4fe3('0x39')]({'plain':!![]});if(_0x4873a5[_0x4fe3('0xc9')]&&_0x4873a5['List'][_0x4fe3('0x9d')][_0x4fe3('0x4d')]){return _0x4873a5[_0x4fe3('0xc9')][_0x4fe3('0x9d')][0x0];}return db[_0x4fe3('0x75')][_0x4fe3('0x5d')](_[_0x4fe3('0x17')](_0x484715[_0x4fe3('0x63')],{'firstName':_0x204489,'mobile':_0x204489,'phone':_0x204489,'ListId':_0x4873a5[_0x4fe3('0x7c')]}));}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x2c559,null))[_0x4fe3('0x1f')](function(_0x4dda9f){if(_0x4dda9f){_0x418a7c=_0x4dda9f;return db['SmsInteraction'][_0x4fe3('0x5c')]({'where':{'ContactId':_0x418a7c['id'],'closed':![],'SmsAccountId':_0x4873a5['id']}})[_0x4fe3('0x1f')](function(_0x4a681b){if(_0x4a681b){return[_0x4a681b,![]];}return db[_0x4fe3('0xa0')]['create']({'UserId':_0x484715[_0x4fe3('0x5e')]['id'],'ContactId':_0x418a7c['id'],'SmsAccountId':_0x4873a5['id'],'phone':_0x204489,'firstMsgDirection':'out','Messages':[_[_0x4fe3('0x5a')](_0x484715[_0x4fe3('0x63')],{'read':![],'body':_0x484715[_0x4fe3('0x63')]['body'],'phone':_0x204489,'SmsAccountId':_0x4873a5['id'],'UserId':_0x484715[_0x4fe3('0x5e')]['id'],'ContactId':_0x418a7c['id']})]},{'include':[{'model':db[_0x4fe3('0xa8')],'as':_0x4fe3('0xca')}]})[_0x4fe3('0x1f')](function(_0x197efd){return[_0x197efd,!![]];});});}})['spread'](function(_0x5e2ac8,_0x53eda4){if(_0x53eda4){return _0x5e2ac8;}return db[_0x4fe3('0xa8')]['create'](_[_0x4fe3('0x5a')](_0x484715[_0x4fe3('0x63')],{'read':![],'body':_0x484715[_0x4fe3('0x63')][_0x4fe3('0x63')],'phone':_0x204489,'SmsAccountId':_0x4873a5['id'],'SmsInteractionId':_0x5e2ac8['id'],'UserId':_0x484715[_0x4fe3('0x5e')]['id'],'ContactId':_0x418a7c['id']}))['then'](function(_0xc86276){_0x5e2ac8[_0x4fe3('0xcb')][_0x4fe3('0xca')]=[];_0x5e2ac8[_0x4fe3('0xcb')][_0x4fe3('0xca')]['push'](_0xc86276[_0x4fe3('0xcb')]);return _0x5e2ac8;});})['then'](respondWithResult(_0x2c559,null))['catch'](handleError(_0x2c559,null));};exports['status']=function(_0x420aff,_0x4c70b6,_0x3b40af){if(_0x420aff[_0x4fe3('0x63')]['id']){delete _0x420aff['body']['id'];}var _0x4d0a42,_0x4c2839,_0x21ac30;return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x420aff[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x4c70b6,null))[_0x4fe3('0x1f')](function(_0x1ba08c){if(_0x1ba08c){_0x21ac30=_0x1ba08c;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fe3('0x2c'),'received\x20delivery\x20report\x20from',_0x1ba08c[_0x4fe3('0x43')],util[_0x4fe3('0xcc')](_0x420aff[_0x4fe3('0x63')],{'showHidden':![],'depth':null}));switch(_0x1ba08c[_0x4fe3('0x43')]){case _0x4fe3('0x84'):if(_0x420aff[_0x4fe3('0x63')][_0x4fe3('0xcd')]&&_0x420aff['body'][_0x4fe3('0x2c')]){_0x4c2839=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x2c')];return db[_0x4fe3('0xa8')][_0x4fe3('0x5c')]({'where':{'messageId':_0x420aff[_0x4fe3('0x63')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x420aff[_0x4fe3('0x63')]['requestid']&&_0x420aff[_0x4fe3('0x63')][_0x4fe3('0xce')]){_0x4c2839=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0xce')];return db[_0x4fe3('0xa8')]['find']({'where':{'messageId':_0x420aff[_0x4fe3('0x63')]['requestid']}});}break;case'clicksend':if(_0x420aff[_0x4fe3('0x63')]['message_id']&&_0x420aff[_0x4fe3('0x63')]['status_code']){_0x4c2839=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0xcf')];return db[_0x4fe3('0xa8')][_0x4fe3('0x5c')]({'where':{'messageId':_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x8a')]}});}break;case _0x4fe3('0xd0'):var _0x49b080=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x8d')][0x0];if(_0x49b080[_0x4fe3('0x89')]&&_0x49b080[_0x4fe3('0x2c')][_0x4fe3('0xd1')]===_0x4fe3('0xd2')){_0x4c2839=_0x49b080[_0x4fe3('0x2c')][_0x4fe3('0xd1')];return db[_0x4fe3('0xa8')][_0x4fe3('0x5c')]({'where':{'messageId':_0x49b080[_0x4fe3('0x89')]}});}break;case _0x4fe3('0x90'):if(_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x89')]&&_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x2c')]){_0x4c2839=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x2c')];return db[_0x4fe3('0xa8')]['find']({'where':{'messageId':_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x89')]}});}break;case'bandwidth':if(_0x420aff['body'][0x0][_0x4fe3('0x28')]['id']){_0x4c2839=_0x420aff['body'][0x0][_0x4fe3('0x43')];return db['SmsMessage'][_0x4fe3('0x5c')]({'where':{'messageId':_0x420aff['body'][0x0][_0x4fe3('0x28')]['id']}});}break;case _0x4fe3('0x94'):if(_0x420aff[_0x4fe3('0x63')]['redif']&&_0x420aff[_0x4fe3('0x63')]['status']){_0x4c2839=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x2c')];return db[_0x4fe3('0xa8')]['find']({'where':{'messageId':_0x420aff[_0x4fe3('0x63')][_0x4fe3('0xd3')]}});}break;}}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x4c70b6,null))['then'](function(_0x4d3573){if(_0x4d3573){_0x4d0a42=_0x4d3573;switch(_0x21ac30[_0x4fe3('0x43')]){case _0x4fe3('0x84'):if(_0x4c2839==='DELIVERED'){return _0x4d0a42['update']({'read':!![]});}else{logger[_0x4fe3('0x27')](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0x84'),util['inspect'](_0x420aff[_0x4fe3('0x63')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4c2839==='1'){return _0x4d0a42[_0x4fe3('0x37')]({'read':!![]});}else{logger[_0x4fe3('0x27')](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0x84'),util[_0x4fe3('0xcc')](_0x420aff['body'],{'showHidden':![],'depth':null}));}break;case _0x4fe3('0x88'):if(!_0x420aff['body']['error_code']&&_0x4c2839>=0xc8&&_0x4c2839<=0xce){return _0x4d0a42['update']({'read':!![]});}else{logger[_0x4fe3('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fe3('0x2c'),_0x4fe3('0x88'),util['inspect'](_0x420aff['body'],{'showHidden':![],'depth':null}));}break;case _0x4fe3('0xd0'):var _0x2d6a37=_0x420aff[_0x4fe3('0x63')][_0x4fe3('0x8d')][0x0];if(_0x2d6a37[_0x4fe3('0x2c')][_0x4fe3('0xd1')]===_0x4fe3('0xd2')){return _0x4d0a42[_0x4fe3('0x37')]({'read':!![]});}else{logger['error'](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0xd0'),util[_0x4fe3('0xcc')](_0x420aff[_0x4fe3('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4fe3('0x90'):if(_0x4c2839==_0x4fe3('0xd4')||_0x4c2839==_0x4fe3('0xd5')){return _0x4d0a42[_0x4fe3('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fe3('0x2c'),_0x4fe3('0x90'),util[_0x4fe3('0xcc')](_0x420aff[_0x4fe3('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4fe3('0x93'):if(_0x4c2839=='message-delivered'){return _0x4d0a42[_0x4fe3('0x37')]({'read':!![]});}else{logger[_0x4fe3('0x27')](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0x93'),util[_0x4fe3('0xcc')](_0x420aff[_0x4fe3('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4fe3('0x94'):if(_0x4c2839===_0x4fe3('0xd6')||_0x4c2839===_0x4fe3('0xd7')){return _0x4d0a42[_0x4fe3('0x37')]({'read':!![]});}else{logger['error'](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0x94'),util[_0x4fe3('0xcc')](_0x420aff['body'],{'showHidden':![],'depth':null}));}break;}return _0x4d0a42;}})[_0x4fe3('0x1f')](respondWithResult(_0x4c70b6,null))['catch'](handleError(_0x4c70b6,null));};exports[_0x4fe3('0xd8')]=function(_0x10439b,_0x1b48a8,_0x3afed1){var _0x3ed9f6,_0x2c6485,_0x5892d4;return db[_0x4fe3('0x40')][_0x4fe3('0x5c')]({'where':{'id':_0x10439b[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x1b48a8,null))[_0x4fe3('0x1f')](function(_0x5de1ee){if(_0x5de1ee){_0x5892d4=_0x5de1ee;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fe3('0x2c'),'received\x20delivery\x20report\x20from',_0x5de1ee[_0x4fe3('0x43')],util['inspect'](_0x10439b[_0x4fe3('0x4a')],{'showHidden':![],'depth':null}));switch(_0x5de1ee[_0x4fe3('0x43')]){case'csc':if(_0x10439b[_0x4fe3('0x4a')][_0x4fe3('0xd9')]&&_0x10439b['query'][_0x4fe3('0xda')]){_0x2c6485=_0x10439b[_0x4fe3('0x4a')][_0x4fe3('0xda')];return db[_0x4fe3('0xa8')][_0x4fe3('0x5c')]({'where':{'messageId':_0x10439b[_0x4fe3('0x4a')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x1b48a8,null))[_0x4fe3('0x1f')](function(_0x4fc144){if(_0x4fc144){_0x3ed9f6=_0x4fc144;switch(_0x5892d4[_0x4fe3('0x43')]){case'csc':if(_0x2c6485==='2'||_0x2c6485==='6'){return _0x3ed9f6[_0x4fe3('0x37')]({'read':!![]});}else{logger[_0x4fe3('0x27')](_0x4fe3('0x23'),_0x4fe3('0x2c'),_0x4fe3('0x8e'),util[_0x4fe3('0xcc')](_0x10439b['query'],{'showHidden':![],'depth':null}));};break;}return _0x3ed9f6;}})[_0x4fe3('0x1f')](respondWithResult(_0x1b48a8,null))[_0x4fe3('0x2a')](handleError(_0x1b48a8,null));};exports[_0x4fe3('0xdb')]=function(_0x3cbec2,_0x7190e,_0x56128b){return db['SmsAccount'][_0x4fe3('0x5c')]({'where':{'id':_0x3cbec2[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x7190e,null))['then'](function(_0x23bf86){if(_0x23bf86){return _0x23bf86['addAgents'](_0x3cbec2['body'][_0x4fe3('0x6c')],_[_0x4fe3('0xdc')](_0x3cbec2[_0x4fe3('0x63')],[_0x4fe3('0x6c'),'id'])||{})[_0x4fe3('0xa1')](function(_0x4d3cb5){for(var _0x4222db=0x0;_0x4222db<_0x3cbec2['body'][_0x4fe3('0x6c')][_0x4fe3('0x4d')];_0x4222db+=0x1){socket[_0x4fe3('0xdd')]('userSmsAccount:save',{'UserId':Number(_0x3cbec2[_0x4fe3('0x63')][_0x4fe3('0x6c')][_0x4222db]),'SmsAccountId':Number(_0x3cbec2[_0x4fe3('0x58')]['id'])});}return _0x4d3cb5;});}})[_0x4fe3('0x1f')](respondWithResult(_0x7190e,null))[_0x4fe3('0x2a')](handleError(_0x7190e,null));};exports[_0x4fe3('0xde')]=function(_0x5637e8,_0x467aa9,_0x4d74b9){return db['SmsAccount'][_0x4fe3('0x5c')]({'where':{'id':_0x5637e8['params']['id']}})['then'](handleEntityNotFound(_0x467aa9,null))[_0x4fe3('0x1f')](function(_0x27e89a){if(_0x27e89a){return _0x27e89a[_0x4fe3('0xde')](_0x5637e8[_0x4fe3('0x4a')][_0x4fe3('0x6c')])[_0x4fe3('0x1f')](function(){if(_[_0x4fe3('0xdf')](_0x5637e8[_0x4fe3('0x4a')][_0x4fe3('0x6c')])){for(var _0x5718de=0x0;_0x5718de<_0x5637e8[_0x4fe3('0x4a')][_0x4fe3('0x6c')][_0x4fe3('0x4d')];_0x5718de+=0x1){socket[_0x4fe3('0xdd')](_0x4fe3('0xe0'),{'UserId':Number(_0x5637e8[_0x4fe3('0x4a')][_0x4fe3('0x6c')][_0x5718de]),'SmsAccountId':Number(_0x5637e8[_0x4fe3('0x58')]['id'])});}}else{socket['emit'](_0x4fe3('0xe0'),{'UserId':Number(_0x5637e8[_0x4fe3('0x4a')][_0x4fe3('0x6c')]),'SmsAccountId':Number(_0x5637e8[_0x4fe3('0x58')]['id'])});}});}})[_0x4fe3('0x1f')](respondWithStatusCode(_0x467aa9,null))['catch'](handleError(_0x467aa9,null));};exports[_0x4fe3('0xe1')]=function(_0x1c1b14,_0x11ebe4,_0x5155bd){var _0x11d68d={};var _0x3fe20e={};var _0x2e276a;var _0x114a6d;return db[_0x4fe3('0x40')][_0x4fe3('0x68')]({'where':{'id':_0x1c1b14[_0x4fe3('0x58')]['id']}})[_0x4fe3('0x1f')](handleEntityNotFound(_0x11ebe4,null))[_0x4fe3('0x1f')](function(_0x3aca3c){if(_0x3aca3c){_0x2e276a=_0x3aca3c;_0x3fe20e[_0x4fe3('0x45')]=_[_0x4fe3('0x47')](db[_0x4fe3('0xac')]['rawAttributes']);_0x3fe20e[_0x4fe3('0x4a')]=_['keys'](_0x1c1b14[_0x4fe3('0x4a')]);_0x3fe20e[_0x4fe3('0x48')]=_['intersection'](_0x3fe20e[_0x4fe3('0x45')],_0x3fe20e[_0x4fe3('0x4a')]);_0x11d68d[_0x4fe3('0x4b')]=_[_0x4fe3('0x49')](_0x3fe20e[_0x4fe3('0x45')],qs[_0x4fe3('0x4c')](_0x1c1b14[_0x4fe3('0x4a')][_0x4fe3('0x4c')]));_0x11d68d[_0x4fe3('0x4b')]=_0x11d68d['attributes'][_0x4fe3('0x4d')]?_0x11d68d[_0x4fe3('0x4b')]:_0x3fe20e['model'];_0x11d68d[_0x4fe3('0x4f')]=qs[_0x4fe3('0x50')](_0x1c1b14[_0x4fe3('0x4a')]['sort']);_0x11d68d['where']=qs[_0x4fe3('0x48')](_[_0x4fe3('0x51')](_0x1c1b14[_0x4fe3('0x4a')],_0x3fe20e[_0x4fe3('0x48')]));if(_0x1c1b14[_0x4fe3('0x4a')][_0x4fe3('0x54')]){_0x11d68d[_0x4fe3('0x52')]=_[_0x4fe3('0x5a')](_0x11d68d['where'],{'$or':_[_0x4fe3('0x46')](_0x11d68d[_0x4fe3('0x4b')],function(_0xd87129){var _0x5efc1d={};_0x5efc1d[_0xd87129]={'$like':'%'+_0x1c1b14[_0x4fe3('0x4a')][_0x4fe3('0x54')]+'%'};return _0x5efc1d;})});}_0x11d68d=_['merge']({},_0x11d68d,_0x1c1b14[_0x4fe3('0x5b')]);return _0x2e276a[_0x4fe3('0xe1')](_0x11d68d);}})['then'](function(_0x4d454e){if(_0x4d454e){_0x114a6d=_0x4d454e['length'];if(!_0x1c1b14['query'][_0x4fe3('0x69')](_0x4fe3('0x4e'))){_0x11d68d[_0x4fe3('0x30')]=qs[_0x4fe3('0x30')](_0x1c1b14[_0x4fe3('0x4a')][_0x4fe3('0x30')]);_0x11d68d[_0x4fe3('0x2e')]=qs[_0x4fe3('0x2e')](_0x1c1b14['query'][_0x4fe3('0x2e')]);}return _0x2e276a[_0x4fe3('0xe1')](_0x11d68d);}})[_0x4fe3('0x1f')](function(_0x2a40a2){if(_0x2a40a2){return _0x2a40a2?{'count':_0x114a6d,'rows':_0x2a40a2}:null;}})[_0x4fe3('0x1f')](respondWithResult(_0x11ebe4,null))[_0x4fe3('0x2a')](handleError(_0x11ebe4,null));}; \ No newline at end of file +var _0xe679=['socket.io-emitter','register','jayson/promise','client','http','request','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','status','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','rawAttributes','includeAll','find','create','role','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','sms','SmsApplication','Applications','account','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','applications','close','unmanaged','*,*,*,*','interaction','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','priority','getApplications','getInteractions','User','Owner','internal','Tags','tag','to\x20is\x20mandatory','List','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','bandwidth','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x1a8dec,_0x833d72){var _0x5550c3=function(_0x3a8e5a){while(--_0x3a8e5a){_0x1a8dec['push'](_0x1a8dec['shift']());}};_0x5550c3(++_0x833d72);}(_0xe679,0xd3));var _0x9e67=function(_0x3b0cbb,_0x142860){_0x3b0cbb=_0x3b0cbb-0x0;var _0x3d7c6c=_0xe679[_0x3b0cbb];return _0x3d7c6c;};'use strict';var emlformat=require(_0x9e67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e67('0x1'));var jsonpatch=require(_0x9e67('0x2'));var rp=require(_0x9e67('0x3'));var moment=require(_0x9e67('0x4'));var BPromise=require(_0x9e67('0x5'));var Mustache=require(_0x9e67('0x6'));var util=require(_0x9e67('0x7'));var path=require(_0x9e67('0x8'));var sox=require(_0x9e67('0x9'));var csv=require(_0x9e67('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e67('0xb'));var _=require(_0x9e67('0xc'));var squel=require(_0x9e67('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9e67('0xe'));var Papa=require('papaparse');var Redis=require(_0x9e67('0xf'));var authService=require(_0x9e67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9e67('0x11'));var hardwareService=require(_0x9e67('0x12'));var logger=require(_0x9e67('0x13'))('api');var utils=require(_0x9e67('0x14'));var config=require(_0x9e67('0x15'));var licenseUtil=require(_0x9e67('0x16'));var db=require(_0x9e67('0x17'))['db'];config[_0x9e67('0x18')]=_[_0x9e67('0x19')](config[_0x9e67('0x18')],{'host':_0x9e67('0x1a'),'port':0x18eb});var socket=require(_0x9e67('0x1b'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x9e67('0x1c')](socket);var jayson=require(_0x9e67('0x1d'));var client=jayson[_0x9e67('0x1e')][_0x9e67('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4e6ba1,_0x4e4a75,_0x3c8985,_0x27e739){return new BPromise(function(_0x267566,_0x4e96f2){var _0x5204e4=_0x27e739||client;return _0x5204e4[_0x9e67('0x20')](_0x4e6ba1,_0x3c8985)['then'](function(_0xd1deda){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4e4a75,_0x9e67('0x21'));logger[_0x9e67('0x22')](_0x9e67('0x23'),_0x4e4a75,_0x9e67('0x21'),JSON[_0x9e67('0x24')](_0xd1deda));if(_0xd1deda[_0x9e67('0x25')]){if(_0xd1deda[_0x9e67('0x25')][_0x9e67('0x26')]===0x1f4){logger[_0x9e67('0x25')](_0x9e67('0x27'),_0x4e4a75,_0xd1deda['error'][_0x9e67('0x28')]);return _0x4e96f2(_0xd1deda[_0x9e67('0x25')][_0x9e67('0x28')]);}logger['error'](_0x9e67('0x27'),_0x4e4a75,_0xd1deda[_0x9e67('0x25')][_0x9e67('0x28')]);return _0x267566(_0xd1deda['error']['message']);}else{logger[_0x9e67('0x29')](_0x9e67('0x27'),_0x4e4a75,'request\x20sent');_0x267566(_0xd1deda[_0x9e67('0x2a')]['message']);}})[_0x9e67('0x2b')](function(_0x324127){logger['error'](_0x9e67('0x27'),_0x4e4a75,_0x324127);_0x4e96f2(_0x324127);});});}function respondWithStatusCode(_0x245bc4,_0x3076ea){_0x3076ea=_0x3076ea||0xcc;return function(_0x50d9f9){if(_0x50d9f9){return _0x245bc4[_0x9e67('0x2c')](_0x3076ea);}return _0x245bc4['status'](_0x3076ea)['end']();};}function respondWithResult(_0x33887e,_0x18f70c){_0x18f70c=_0x18f70c||0xc8;return function(_0x36354c){if(_0x36354c){return _0x33887e['status'](_0x18f70c)[_0x9e67('0x2d')](_0x36354c);}};}function respondWithFilteredResult(_0xd72718,_0x130604){return function(_0x48bd1d){if(_0x48bd1d){var _0x1a77ef=typeof _0x130604[_0x9e67('0x2e')]===_0x9e67('0x2f')&&typeof _0x130604['limit']===_0x9e67('0x2f');var _0xbc160a=_0x48bd1d[_0x9e67('0x30')];var _0x1e8a00=_0x1a77ef?0x0:_0x130604[_0x9e67('0x2e')];var _0x2350db=_0x1a77ef?_0x48bd1d[_0x9e67('0x30')]:_0x130604[_0x9e67('0x2e')]+_0x130604[_0x9e67('0x31')];var _0x4bc1f7;if(_0x2350db>=_0xbc160a){_0x2350db=_0xbc160a;_0x4bc1f7=0xc8;}else{_0x4bc1f7=0xce;}_0xd72718['status'](_0x4bc1f7);return _0xd72718['set'](_0x9e67('0x32'),_0x1e8a00+'-'+_0x2350db+'/'+_0xbc160a)['json'](_0x48bd1d);}return null;};}function patchUpdates(_0x5e821a){return function(_0x5cc81e){try{jsonpatch[_0x9e67('0x33')](_0x5cc81e,_0x5e821a,!![]);}catch(_0x209b9d){return BPromise[_0x9e67('0x34')](_0x209b9d);}return _0x5cc81e[_0x9e67('0x35')]();};}function saveUpdates(_0x334864,_0x208a2c){return function(_0xb42e8b){if(_0xb42e8b){return _0xb42e8b[_0x9e67('0x36')](_0x334864)[_0x9e67('0x37')](function(_0xa17b97){return _0xa17b97;});}return null;};}function removeEntity(_0x323be2,_0x28a40d){return function(_0x133d81){if(_0x133d81){return _0x133d81[_0x9e67('0x38')]()[_0x9e67('0x37')](function(){var _0x5e8008=_0x133d81[_0x9e67('0x39')]({'plain':!![]});var _0x4aca8b='SmsAccounts';return db['UserProfileResource'][_0x9e67('0x38')]({'where':{'type':_0x4aca8b,'resourceId':_0x5e8008['id']}})[_0x9e67('0x37')](function(){return _0x133d81;});})[_0x9e67('0x37')](function(){_0x323be2[_0x9e67('0x3a')](0xcc)[_0x9e67('0x3b')]();});}};}function handleEntityNotFound(_0x3ff68e,_0x252a62){return function(_0x9142c7){if(!_0x9142c7){_0x3ff68e[_0x9e67('0x2c')](0x194);}return _0x9142c7;};}function handleError(_0x1ff0fb,_0x46f496){_0x46f496=_0x46f496||0x1f4;return function(_0x1b7082){logger[_0x9e67('0x25')](_0x1b7082[_0x9e67('0x3c')]);if(_0x1b7082[_0x9e67('0x3d')]){delete _0x1b7082[_0x9e67('0x3d')];}_0x1ff0fb[_0x9e67('0x3a')](_0x46f496)[_0x9e67('0x3e')](_0x1b7082);};}exports[_0x9e67('0x3f')]=function(_0x2e8d41,_0x4cbe6c){var _0x3128cf={'include':[{'model':db[_0x9e67('0x40')],'as':_0x9e67('0x41')}]},_0x5f1ff6={},_0x3dbf2f={'count':0x0,'rows':[]};var _0x351a10=_[_0x9e67('0x42')](db[_0x9e67('0x43')]['rawAttributes'],function(_0x544d77){return{'name':_0x544d77[_0x9e67('0x44')],'type':_0x544d77[_0x9e67('0x45')][_0x9e67('0x46')]};});_0x5f1ff6['model']=_[_0x9e67('0x42')](_0x351a10,_0x9e67('0x3d'));_0x5f1ff6[_0x9e67('0x47')]=_[_0x9e67('0x48')](_0x2e8d41['query']);_0x5f1ff6[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0x5f1ff6[_0x9e67('0x4b')],_0x5f1ff6[_0x9e67('0x47')]);_0x3128cf[_0x9e67('0x4c')]=_['intersection'](_0x5f1ff6['model'],qs['fields'](_0x2e8d41[_0x9e67('0x47')][_0x9e67('0x4d')]));_0x3128cf[_0x9e67('0x4c')]=_0x3128cf[_0x9e67('0x4c')][_0x9e67('0x4e')]?_0x3128cf[_0x9e67('0x4c')]:_0x5f1ff6['model'];if(!_0x2e8d41['query'][_0x9e67('0x4f')](_0x9e67('0x50'))){_0x3128cf[_0x9e67('0x31')]=qs[_0x9e67('0x31')](_0x2e8d41[_0x9e67('0x47')][_0x9e67('0x31')]);_0x3128cf[_0x9e67('0x2e')]=qs[_0x9e67('0x2e')](_0x2e8d41[_0x9e67('0x47')][_0x9e67('0x2e')]);}_0x3128cf['order']=qs['sort'](_0x2e8d41[_0x9e67('0x47')]['sort']);_0x3128cf[_0x9e67('0x51')]=qs[_0x9e67('0x49')](_[_0x9e67('0x52')](_0x2e8d41[_0x9e67('0x47')],_0x5f1ff6[_0x9e67('0x49')]),_0x351a10);if(_0x2e8d41[_0x9e67('0x47')]['filter']){_0x3128cf[_0x9e67('0x51')]=_[_0x9e67('0x53')](_0x3128cf[_0x9e67('0x51')],{'$or':_[_0x9e67('0x42')](_0x351a10,function(_0x91d60a){if(_0x91d60a[_0x9e67('0x45')]!==_0x9e67('0x54')){var _0xd60cb1={};_0xd60cb1[_0x91d60a[_0x9e67('0x3d')]]={'$like':'%'+_0x2e8d41[_0x9e67('0x47')][_0x9e67('0x55')]+'%'};return _0xd60cb1;}})});}_0x3128cf=_[_0x9e67('0x53')]({},_0x3128cf,_0x2e8d41[_0x9e67('0x56')]);var _0x58bd9d={'where':_0x3128cf[_0x9e67('0x51')]};return db[_0x9e67('0x43')]['count'](_0x58bd9d)[_0x9e67('0x37')](function(_0x58556f){_0x3dbf2f['count']=_0x58556f;if(_0x2e8d41[_0x9e67('0x47')]['includeAll']){_0x3128cf[_0x9e67('0x57')]=[{'all':!![]}];}return db[_0x9e67('0x43')][_0x9e67('0x58')](_0x3128cf);})[_0x9e67('0x37')](function(_0x52f714){_0x3dbf2f['rows']=_0x52f714;return _0x3dbf2f;})[_0x9e67('0x37')](respondWithFilteredResult(_0x4cbe6c,_0x3128cf))['catch'](handleError(_0x4cbe6c,null));};exports[_0x9e67('0x59')]=function(_0x1cd662,_0x1edfdd){var _0x53a585={'raw':![],'where':{'id':_0x1cd662[_0x9e67('0x5a')]['id']},'include':[{'model':db[_0x9e67('0x40')],'as':'mandatoryDispositionPause'}]},_0x7cc626={};_0x7cc626[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db[_0x9e67('0x43')][_0x9e67('0x5b')]);_0x7cc626[_0x9e67('0x47')]=_[_0x9e67('0x48')](_0x1cd662[_0x9e67('0x47')]);_0x7cc626[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0x7cc626[_0x9e67('0x4b')],_0x7cc626[_0x9e67('0x47')]);_0x53a585['attributes']=_[_0x9e67('0x4a')](_0x7cc626[_0x9e67('0x4b')],qs['fields'](_0x1cd662['query'][_0x9e67('0x4d')]));_0x53a585[_0x9e67('0x4c')]=_0x53a585[_0x9e67('0x4c')]['length']?_0x53a585[_0x9e67('0x4c')]:_0x7cc626[_0x9e67('0x4b')];if(_0x1cd662[_0x9e67('0x47')][_0x9e67('0x5c')]){_0x53a585[_0x9e67('0x57')]=[{'all':!![]}];}_0x53a585=_[_0x9e67('0x53')]({},_0x53a585,_0x1cd662['options']);return db[_0x9e67('0x43')][_0x9e67('0x5d')](_0x53a585)[_0x9e67('0x37')](handleEntityNotFound(_0x1edfdd,null))[_0x9e67('0x37')](respondWithResult(_0x1edfdd,null))[_0x9e67('0x2b')](handleError(_0x1edfdd,null));};exports['create']=function(_0x5b089f,_0x5f27e0){return db[_0x9e67('0x43')][_0x9e67('0x5e')](_0x5b089f['body'],{})[_0x9e67('0x37')](function(_0x21fc13){var _0x2fcccc=_0x5b089f['user']['get']({'plain':!![]});if(!_0x2fcccc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fcccc[_0x9e67('0x5f')]===_0x9e67('0x60')){var _0x362b6e=_0x21fc13['get']({'plain':!![]});var _0x58e299=_0x9e67('0x61');return db[_0x9e67('0x62')][_0x9e67('0x5d')]({'where':{'name':_0x58e299,'userProfileId':_0x2fcccc[_0x9e67('0x63')]},'raw':!![]})[_0x9e67('0x37')](function(_0x5c6441){if(_0x5c6441&&_0x5c6441[_0x9e67('0x64')]===0x0){return db[_0x9e67('0x65')][_0x9e67('0x5e')]({'name':_0x362b6e['name'],'resourceId':_0x362b6e['id'],'type':_0x5c6441[_0x9e67('0x3d')],'sectionId':_0x5c6441['id']},{})[_0x9e67('0x37')](function(){return _0x21fc13;});}else{return _0x21fc13;}})[_0x9e67('0x2b')](function(_0x575238){logger[_0x9e67('0x25')](_0x9e67('0x66'),_0x575238);throw _0x575238;});}return _0x21fc13;})[_0x9e67('0x37')](respondWithResult(_0x5f27e0,0xc9))['catch'](handleError(_0x5f27e0,null));};exports[_0x9e67('0x36')]=function(_0x30c2dd,_0x3c6a5b){if(_0x30c2dd['body']['id']){delete _0x30c2dd[_0x9e67('0x67')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x30c2dd['params']['id']},'include':[{'model':db[_0x9e67('0x40')],'as':_0x9e67('0x41')}]})[_0x9e67('0x37')](handleEntityNotFound(_0x3c6a5b,null))[_0x9e67('0x37')](saveUpdates(_0x30c2dd[_0x9e67('0x67')],null))['then'](respondWithResult(_0x3c6a5b,null))['catch'](handleError(_0x3c6a5b,null));};exports[_0x9e67('0x38')]=function(_0x4ce70c,_0x692a20){return db[_0x9e67('0x43')][_0x9e67('0x5d')]({'where':{'id':_0x4ce70c[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x692a20,null))['then'](removeEntity(_0x692a20,null))[_0x9e67('0x2b')](handleError(_0x692a20,null));};exports['describe']=function(_0x5ecf70,_0x1652f3){return db[_0x9e67('0x43')][_0x9e67('0x68')]()['then'](respondWithResult(_0x1652f3,null))[_0x9e67('0x2b')](handleError(_0x1652f3,null));};exports[_0x9e67('0x69')]=function(_0x5616af,_0x307e1d,_0x50acda){if(_0x5616af[_0x9e67('0x67')]['id']){delete _0x5616af[_0x9e67('0x67')]['id'];}return db[_0x9e67('0x43')]['find']({'where':{'id':_0x5616af[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x307e1d,null))['then'](function(_0x3efc49){if(_0x3efc49){_0x5616af[_0x9e67('0x67')][_0x9e67('0x6a')]=_0x3efc49['id'];return db[_0x9e67('0x6b')][_0x9e67('0x5e')](_0x5616af[_0x9e67('0x67')]);}})[_0x9e67('0x37')](respondWithResult(_0x307e1d,null))['catch'](handleError(_0x307e1d,null));};exports[_0x9e67('0x6c')]=function(_0x2f2507,_0x59e715,_0x12f508){var _0x4609ff={'raw':![],'where':{}};var _0x522c90={};var _0x29faba={'count':0x0,'rows':[]};return db[_0x9e67('0x43')][_0x9e67('0x6d')]({'where':{'id':_0x2f2507['params']['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x59e715,null))['then'](function(_0x24590e){if(_0x24590e){_0x522c90[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db[_0x9e67('0x6b')][_0x9e67('0x5b')]);_0x522c90['query']=_[_0x9e67('0x48')](_0x2f2507[_0x9e67('0x47')]);_0x522c90[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0x522c90[_0x9e67('0x4b')],_0x522c90['query']);_0x4609ff[_0x9e67('0x4c')]=_['intersection'](_0x522c90['model'],qs[_0x9e67('0x4d')](_0x2f2507[_0x9e67('0x47')]['fields']));_0x4609ff[_0x9e67('0x4c')]=_0x4609ff[_0x9e67('0x4c')][_0x9e67('0x4e')]?_0x4609ff[_0x9e67('0x4c')]:_0x522c90[_0x9e67('0x4b')];if(!_0x2f2507['query']['hasOwnProperty'](_0x9e67('0x50'))){_0x4609ff[_0x9e67('0x31')]=qs[_0x9e67('0x31')](_0x2f2507[_0x9e67('0x47')][_0x9e67('0x31')]);_0x4609ff['offset']=qs[_0x9e67('0x2e')](_0x2f2507[_0x9e67('0x47')][_0x9e67('0x2e')]);}_0x4609ff[_0x9e67('0x6e')]=qs[_0x9e67('0x6f')](_0x2f2507['query'][_0x9e67('0x6f')]);_0x4609ff[_0x9e67('0x51')]=qs[_0x9e67('0x49')](_['pick'](_0x2f2507['query'],_0x522c90[_0x9e67('0x49')]));_0x4609ff[_0x9e67('0x51')][_0x9e67('0x6a')]=_0x24590e['id'];if(_0x2f2507[_0x9e67('0x47')][_0x9e67('0x55')]){_0x4609ff[_0x9e67('0x51')]=_[_0x9e67('0x53')](_0x4609ff[_0x9e67('0x51')],{'$or':_[_0x9e67('0x42')](_0x4609ff[_0x9e67('0x4c')],function(_0x51e5e3){var _0x3dba7b={};_0x3dba7b[_0x51e5e3]={'$like':'%'+_0x2f2507[_0x9e67('0x47')][_0x9e67('0x55')]+'%'};return _0x3dba7b;})});}_0x4609ff=_[_0x9e67('0x53')]({},_0x4609ff,_0x2f2507[_0x9e67('0x56')]);return db[_0x9e67('0x6b')][_0x9e67('0x30')]({'where':_0x4609ff[_0x9e67('0x51')]})['then'](function(_0x5d3a6d){_0x29faba[_0x9e67('0x30')]=_0x5d3a6d;if(_0x2f2507['query'][_0x9e67('0x5c')]){_0x4609ff[_0x9e67('0x57')]=[{'all':!![]}];}return db[_0x9e67('0x6b')][_0x9e67('0x58')](_0x4609ff);})[_0x9e67('0x37')](function(_0x93f058){_0x29faba['rows']=_0x93f058;return _0x29faba;});}})[_0x9e67('0x37')](respondWithFilteredResult(_0x59e715,_0x4609ff))['catch'](handleError(_0x59e715,null));};exports['removeDispositions']=function(_0x4e2a2a,_0xee174d,_0x4dcd14){return db['SmsAccount']['find']({'where':{'id':_0x4e2a2a[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0xee174d,null))[_0x9e67('0x37')](function(_0x41c6f0){if(_0x41c6f0){return _0x41c6f0[_0x9e67('0x70')](_0x4e2a2a[_0x9e67('0x47')][_0x9e67('0x71')]);}})[_0x9e67('0x37')](respondWithStatusCode(_0xee174d,null))[_0x9e67('0x2b')](handleError(_0xee174d,null));};exports[_0x9e67('0x72')]=function(_0x58231e,_0x130a0f,_0x171f7c){if(_0x58231e[_0x9e67('0x67')]['id']){delete _0x58231e[_0x9e67('0x67')]['id'];}return db['SmsAccount'][_0x9e67('0x5d')]({'where':{'id':_0x58231e[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x130a0f,null))[_0x9e67('0x37')](function(_0x46a58b){if(_0x46a58b){_0x58231e[_0x9e67('0x67')][_0x9e67('0x6a')]=_0x46a58b['id'];return db[_0x9e67('0x73')][_0x9e67('0x5e')](_0x58231e[_0x9e67('0x67')]);}})['then'](respondWithResult(_0x130a0f,null))['catch'](handleError(_0x130a0f,null));};exports[_0x9e67('0x74')]=function(_0x32671f,_0x3a1375,_0x103f0a){var _0x196b17={'raw':![],'where':{}};var _0x34a388={};var _0xad906={'count':0x0,'rows':[]};return db[_0x9e67('0x43')][_0x9e67('0x6d')]({'where':{'id':_0x32671f['params']['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x3a1375,null))['then'](function(_0x776eb9){if(_0x776eb9){_0x34a388[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db['CannedAnswer'][_0x9e67('0x5b')]);_0x34a388[_0x9e67('0x47')]=_[_0x9e67('0x48')](_0x32671f[_0x9e67('0x47')]);_0x34a388[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0x34a388[_0x9e67('0x4b')],_0x34a388[_0x9e67('0x47')]);_0x196b17[_0x9e67('0x4c')]=_[_0x9e67('0x4a')](_0x34a388[_0x9e67('0x4b')],qs[_0x9e67('0x4d')](_0x32671f[_0x9e67('0x47')]['fields']));_0x196b17[_0x9e67('0x4c')]=_0x196b17[_0x9e67('0x4c')][_0x9e67('0x4e')]?_0x196b17[_0x9e67('0x4c')]:_0x34a388['model'];if(!_0x32671f[_0x9e67('0x47')][_0x9e67('0x4f')](_0x9e67('0x50'))){_0x196b17[_0x9e67('0x31')]=qs['limit'](_0x32671f[_0x9e67('0x47')]['limit']);_0x196b17[_0x9e67('0x2e')]=qs[_0x9e67('0x2e')](_0x32671f[_0x9e67('0x47')][_0x9e67('0x2e')]);}_0x196b17[_0x9e67('0x6e')]=qs[_0x9e67('0x6f')](_0x32671f[_0x9e67('0x47')][_0x9e67('0x6f')]);_0x196b17['where']=qs[_0x9e67('0x49')](_[_0x9e67('0x52')](_0x32671f[_0x9e67('0x47')],_0x34a388[_0x9e67('0x49')]));_0x196b17['where'][_0x9e67('0x6a')]=_0x776eb9['id'];if(_0x32671f['query'][_0x9e67('0x55')]){_0x196b17['where']=_[_0x9e67('0x53')](_0x196b17['where'],{'$or':_[_0x9e67('0x42')](_0x196b17['attributes'],function(_0x47e371){var _0x525484={};_0x525484[_0x47e371]={'$like':'%'+_0x32671f[_0x9e67('0x47')][_0x9e67('0x55')]+'%'};return _0x525484;})});}_0x196b17=_[_0x9e67('0x53')]({},_0x196b17,_0x32671f[_0x9e67('0x56')]);return db[_0x9e67('0x73')][_0x9e67('0x30')]({'where':_0x196b17[_0x9e67('0x51')]})[_0x9e67('0x37')](function(_0x5a9b45){_0xad906[_0x9e67('0x30')]=_0x5a9b45;if(_0x32671f[_0x9e67('0x47')][_0x9e67('0x5c')]){_0x196b17[_0x9e67('0x57')]=[{'all':!![]}];}return db[_0x9e67('0x73')]['findAll'](_0x196b17);})[_0x9e67('0x37')](function(_0x308be3){_0xad906[_0x9e67('0x75')]=_0x308be3;return _0xad906;});}})[_0x9e67('0x37')](respondWithFilteredResult(_0x3a1375,_0x196b17))[_0x9e67('0x2b')](handleError(_0x3a1375,null));};exports[_0x9e67('0x76')]=function(_0xd43a2,_0x30a828,_0x393fb5){return db[_0x9e67('0x43')][_0x9e67('0x5d')]({'where':{'id':_0xd43a2[_0x9e67('0x5a')]['id']}})['then'](handleEntityNotFound(_0x30a828,null))[_0x9e67('0x37')](function(_0x2edbe){if(_0x2edbe){return _0x2edbe['removeAnswers'](_0xd43a2[_0x9e67('0x47')][_0x9e67('0x71')]);}})[_0x9e67('0x37')](respondWithStatusCode(_0x30a828,null))[_0x9e67('0x2b')](handleError(_0x30a828,null));};exports[_0x9e67('0x77')]=function(_0x3a2648,_0x5a70ff,_0x48c03f){var _0x531426={'channel':_0x9e67('0x78')};var _0x7d70cf=[];var _0x43616e=[];var _0x29c918={};return db['SmsAccount']['find']({'where':{'id':_0x3a2648['params']['id']},'include':[{'model':db[_0x9e67('0x79')],'as':_0x9e67('0x7a')}]})[_0x9e67('0x37')](handleEntityNotFound(_0x5a70ff,null))[_0x9e67('0x37')](function(_0x4d1251){_0x531426[_0x9e67('0x7b')]=_0x4d1251;_0x531426['applications']=_['orderBy'](_0x4d1251[_0x9e67('0x7a')],['priority'],[_0x9e67('0x7c')]);if(_0x531426['account'][_0x9e67('0x7a')]){delete _0x531426[_0x9e67('0x7b')][_0x9e67('0x7a')];}return db['CmContact'][_0x9e67('0x68')]();})[_0x9e67('0x37')](function(_0x30ff1d){if(!_0x30ff1d){throw new db[(_0x9e67('0x7d'))][(_0x9e67('0x7e'))](_0x9e67('0x7f'));}_0x7d70cf=_[_0x9e67('0x80')](_['keys'](_0x30ff1d),[_0x9e67('0x81'),_0x9e67('0x82')]);_0x43616e=_[_0x9e67('0x80')](_[_0x9e67('0x48')](_0x30ff1d),[_0x9e67('0x81'),_0x9e67('0x82'),_0x9e67('0x83'),'ListId']);_0x531426[_0x9e67('0x67')]={'mapKey':_0x9e67('0x84')};if(_0x531426['account'][_0x9e67('0x45')]){switch(_0x531426['account'][_0x9e67('0x45')]){case _0x9e67('0x85'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]=_0x3a2648['body'][_0x9e67('0x87')];_0x531426['body']['body']=_0x3a2648['body'][_0x9e67('0x88')];_0x531426['body']['messageId']=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x89')];break;case _0x9e67('0x8a'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]='+'+_0x3a2648[_0x9e67('0x67')][_0x9e67('0x8b')];_0x531426[_0x9e67('0x67')][_0x9e67('0x67')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x8c')];break;case _0x9e67('0x8d'):_0x531426[_0x9e67('0x67')]['from']=_0x3a2648['body']['from'];_0x531426['body'][_0x9e67('0x67')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x28')];break;case _0x9e67('0x8e'):_0x531426['body'][_0x9e67('0x86')]=_0x3a2648[_0x9e67('0x67')]['from'];_0x531426[_0x9e67('0x67')]['body']=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x67')];_0x531426['body'][_0x9e67('0x8f')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x90')];break;case _0x9e67('0x91'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]=_0x3a2648[_0x9e67('0x67')]['From'];_0x531426['body']['body']=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x92')];_0x531426[_0x9e67('0x67')][_0x9e67('0x8f')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x93')];break;case _0x9e67('0x94'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]='+'+_0x3a2648[_0x9e67('0x67')][_0x9e67('0x95')][0x0]['from'];_0x531426['body'][_0x9e67('0x67')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x95')][0x0][_0x9e67('0x8c')];_0x531426[_0x9e67('0x67')][_0x9e67('0x8f')]=_0x3a2648[_0x9e67('0x67')]['results'][0x0]['messageId'];break;case _0x9e67('0x96'):_0x531426[_0x9e67('0x67')]['from']=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x97')];_0x531426[_0x9e67('0x67')][_0x9e67('0x67')]=_0x3a2648['body'][_0x9e67('0x98')][_0x9e67('0x28')];break;case _0x9e67('0x99'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x9a')];_0x531426['body']['body']=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x8c')];_0x531426['body'][_0x9e67('0x8f')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x9b')];break;case'bandwidth':_0x531426[_0x9e67('0x67')]['messageId']=_0x3a2648[_0x9e67('0x67')][0x0][_0x9e67('0x28')]['id'];_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]=_0x3a2648['body'][0x0][_0x9e67('0x28')]['from'];_0x531426[_0x9e67('0x67')][_0x9e67('0x67')]=_0x3a2648['body'][0x0][_0x9e67('0x28')][_0x9e67('0x8c')];break;case _0x9e67('0x9c'):_0x531426[_0x9e67('0x67')][_0x9e67('0x86')]=_0x3a2648['body'][_0x9e67('0x86')];_0x531426['body'][_0x9e67('0x67')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x28')];_0x531426[_0x9e67('0x67')][_0x9e67('0x8f')]=_0x3a2648[_0x9e67('0x67')][_0x9e67('0x9d')];break;}}if(_0x531426[_0x9e67('0x67')]['id']){delete _0x531426[_0x9e67('0x67')]['id'];}if(_[_0x9e67('0x9e')](_0x531426['body'][_0x9e67('0x86')])){throw new db[(_0x9e67('0x7d'))][(_0x9e67('0x7e'))](_0x9e67('0x9f'));}if(_[_0x9e67('0x9e')](_0x531426[_0x9e67('0x67')][_0x9e67('0x67')])||_0x531426[_0x9e67('0x67')][_0x9e67('0x67')]===''){throw new db['Sequelize'][(_0x9e67('0x7e'))](_0x9e67('0xa0'));}if(_['isNil'](_0x531426['body']['mapKey'])){throw new db[(_0x9e67('0x7d'))][(_0x9e67('0x7e'))](_0x9e67('0xa1')+_0x43616e);}if(!_[_0x9e67('0xa2')](_0x43616e,_0x531426['body'][_0x9e67('0xa3')])){throw new db[(_0x9e67('0x7d'))][(_0x9e67('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43616e);}_0x29c918[_0x531426['body'][_0x9e67('0xa3')]]=_0x531426[_0x9e67('0x67')][_0x9e67('0x86')];return db[_0x9e67('0xa4')][_0x9e67('0x5d')]({'where':{'id':_0x531426['account']['ListId']},'include':[{'model':db[_0x9e67('0xa5')],'as':_0x9e67('0xa6'),'where':_0x29c918,'limit':0x1,'order':[[_0x9e67('0x82'),_0x9e67('0xa7')]]}]});})['then'](handleEntityNotFound(_0x5a70ff,null))[_0x9e67('0x37')](function(_0x557b75){if(_0x557b75){_0x531426[_0x9e67('0xa8')]=_[_0x9e67('0xa9')](_0x557b75,[_0x9e67('0xa6')]);if(_0x557b75[_0x9e67('0xa6')][_0x9e67('0x4e')]){return _0x557b75[_0x9e67('0xa6')][0x0];}var _0x3125e4=_[_0x9e67('0x19')](_0x531426[_0x9e67('0x67')],{'firstName':_0x531426[_0x9e67('0x67')][_0x9e67('0x86')],'ListId':_0x557b75['id']});_0x3125e4[_0x531426['body'][_0x9e67('0xa3')]]=_0x531426['body'][_0x9e67('0x86')];return db['CmContact'][_0x9e67('0x5e')](_0x3125e4,{'fields':_0x7d70cf,'raw':!![]});}})[_0x9e67('0x37')](handleEntityNotFound(_0x5a70ff,null))[_0x9e67('0x37')](function(_0x51396e){if(_0x51396e){_0x531426[_0x9e67('0xaa')]=_0x51396e;var _0x560b3d={'ContactId':_0x51396e['id'],'phone':_0x531426[_0x9e67('0x67')][_0x9e67('0x86')],'SmsAccountId':_0x3a2648['params']['id']};var _0x5cbe26={'ContactId':_0x51396e['id'],'SmsAccountId':_0x3a2648[_0x9e67('0x5a')]['id'],'closed':![]};return db[_0x9e67('0xab')][_0x9e67('0x5d')]({'where':_0x5cbe26})[_0x9e67('0x37')](function(_0x50ea27){if(_0x50ea27){return[_0x50ea27,![]];}return db['SmsInteraction']['create'](_0x560b3d)[_0x9e67('0x37')](function(_0x53aca0){return[_0x53aca0,!![]];});});}})[_0x9e67('0xac')](function(_0x424492,_0x47ac85){_0x531426['interaction']=_0x424492[_0x9e67('0x39')]({'plain':!![]});_0x531426['interaction']['created']=![];if(_0x47ac85){if(_0x531426[_0x9e67('0x7b')]['autoclose']){_0x531426[_0x9e67('0xad')]['push']({'id':0x0,'priority':_0x531426['applications'][_0x9e67('0x4e')]+0x1,'app':_0x9e67('0xae'),'appdata':_0x9e67('0xaf'),'interval':_0x9e67('0xb0')});}_0x531426[_0x9e67('0xb1')][_0x9e67('0xb2')]=!![];}return db[_0x9e67('0xb3')][_0x9e67('0x5e')]({'phone':_0x531426[_0x9e67('0x67')]['from'],'messageId':_0x531426['body']['messageId'],'body':_0x531426[_0x9e67('0x67')][_0x9e67('0x67')],'SmsAccountId':_0x3a2648[_0x9e67('0x5a')]['id'],'SmsInteractionId':_0x424492['id'],'direction':'in','ContactId':_0x424492[_0x9e67('0xb4')],'AttachmentId':_0x531426[_0x9e67('0x67')][_0x9e67('0xb5')]});})[_0x9e67('0x37')](function(_0x430e31){_0x531426[_0x9e67('0x28')]=_0x430e31;if(_0x531426['interaction'][_0x9e67('0xb6')]){return db['User'][_0x9e67('0x5d')]({'attributes':['id','name'],'where':{'id':_0x531426['interaction'][_0x9e67('0xb6')]}})[_0x9e67('0x37')](function(_0x560b61){if(_0x560b61){_0x531426[_0x9e67('0xad')][_0x9e67('0xb7')]({'id':0x0,'priority':0x0,'app':_0x9e67('0xb8'),'appdata':_0x560b61[_0x9e67('0x3d')]+','+(_0x531426['account'][_0x9e67('0xb9')]||0xa),'interval':_0x9e67('0xb0')});}return respondWithRpcPromise('Start','startRouting',_0x531426);});}return respondWithRpcPromise(_0x9e67('0xba'),_0x9e67('0xbb'),_0x531426);})[_0x9e67('0x37')](function(_0x391c9e){if(_0x391c9e){var _0x2136d7=0xc8;var _0x1789b5=_0x9e67('0xbc');logger[_0x9e67('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1789b5,_0x2136d7,_0x9e67('0xbd'));logger['debug'](_0x9e67('0xbe'),_0x1789b5,_0x2136d7,_0x9e67('0xbd'),JSON['stringify'](_0x391c9e));if(_0x531426[_0x9e67('0x7b')][_0x9e67('0x45')]===_0x9e67('0x85')){return _0x5a70ff[_0x9e67('0x3a')](_0x2136d7)[_0x9e67('0xbf')](_0x9e67('0xc0'),_0x9e67('0xc1'))['send'](_0x9e67('0xc2'));}else{return _0x5a70ff[_0x9e67('0x3a')](_0x2136d7)[_0x9e67('0x2d')](_0x391c9e);}}})['catch'](handleError(_0x5a70ff,null));};exports[_0x9e67('0xc3')]=function(_0x1ef982,_0x3d2500){var _0x193167=_0x1ef982['params']['id'];var _0x2ddfd9=_0x1ef982['body'];var _0x5ed000=0xc8;var _0x18566a=null;return db[_0x9e67('0xc4')][_0x9e67('0xc5')]({'isolationLevel':db['sequelize'][_0x9e67('0xc6')]['ISOLATION_LEVELS'][_0x9e67('0xc7')]},function(_0x4f3e41){return db[_0x9e67('0x43')][_0x9e67('0x6d')]({'where':{'id':_0x193167},'transaction':_0x4f3e41})['then'](function(_0x1b7aa2){if(_0x1b7aa2){return db[_0x9e67('0x79')][_0x9e67('0x38')]({'where':{'SmsAccountId':_0x193167},'transaction':_0x4f3e41})[_0x9e67('0x37')](function(){var _0x53b730=_[_0x9e67('0x42')](_0x2ddfd9,function(_0x1d64f2){_0x1d64f2[_0x9e67('0x6a')]=_0x193167;return _0x1d64f2;});return db[_0x9e67('0x79')][_0x9e67('0xc8')](_0x53b730,{'transaction':_0x4f3e41});});}else{_0x5ed000=0x194;_0x18566a=[];}});})[_0x9e67('0x37')](function(){if(_0x5ed000!==0x194){return db[_0x9e67('0x79')]['findAndCountAll']({'where':{'SmsAccountId':_0x193167},'order':_0x9e67('0xc9')})['then'](function(_0x56d9a2){_0x18566a=_0x56d9a2;});}})[_0x9e67('0x2b')](function(_0x574a96){_0x5ed000=0x1f4;logger[_0x9e67('0x25')](_0x574a96[_0x9e67('0x3c')]);if(_0x574a96[_0x9e67('0x3d')]){delete _0x574a96['name'];}_0x18566a=_0x574a96;})['finally'](function(){if(_0x18566a===null){_0x3d2500[_0x9e67('0x2c')](_0x5ed000);}else{if(_0x5ed000===0x1f4){_0x3d2500['status'](_0x5ed000)[_0x9e67('0x3e')](_0x18566a);}else{_0x3d2500[_0x9e67('0x3a')](_0x5ed000)['json'](_0x18566a);}}});};exports[_0x9e67('0xca')]=function(_0x41633e,_0xc2f48c,_0x924d75){var _0x2c58f3={};var _0x5aa178={};var _0x4936dc;var _0xa46bc3;return db[_0x9e67('0x43')][_0x9e67('0x6d')]({'where':{'id':_0x41633e[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0xc2f48c,null))[_0x9e67('0x37')](function(_0x21e443){if(_0x21e443){_0x4936dc=_0x21e443;_0x5aa178[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db[_0x9e67('0x79')][_0x9e67('0x5b')]);_0x5aa178[_0x9e67('0x47')]=_['keys'](_0x41633e[_0x9e67('0x47')]);_0x5aa178['filters']=_['intersection'](_0x5aa178[_0x9e67('0x4b')],_0x5aa178[_0x9e67('0x47')]);_0x2c58f3[_0x9e67('0x4c')]=_[_0x9e67('0x4a')](_0x5aa178['model'],qs[_0x9e67('0x4d')](_0x41633e[_0x9e67('0x47')]['fields']));_0x2c58f3[_0x9e67('0x4c')]=_0x2c58f3['attributes'][_0x9e67('0x4e')]?_0x2c58f3[_0x9e67('0x4c')]:_0x5aa178[_0x9e67('0x4b')];_0x2c58f3[_0x9e67('0x6e')]=qs[_0x9e67('0x6f')](_0x41633e[_0x9e67('0x47')][_0x9e67('0x6f')]);_0x2c58f3['where']=qs[_0x9e67('0x49')](_[_0x9e67('0x52')](_0x41633e[_0x9e67('0x47')],_0x5aa178[_0x9e67('0x49')]));if(_0x41633e[_0x9e67('0x47')]['filter']){_0x2c58f3[_0x9e67('0x51')]=_[_0x9e67('0x53')](_0x2c58f3[_0x9e67('0x51')],{'$or':_['map'](_0x2c58f3[_0x9e67('0x4c')],function(_0x90f2da){var _0x283e36={};_0x283e36[_0x90f2da]={'$like':'%'+_0x41633e['query']['filter']+'%'};return _0x283e36;})});}_0x2c58f3=_[_0x9e67('0x53')]({},_0x2c58f3,_0x41633e['options']);return _0x4936dc[_0x9e67('0xca')](_0x2c58f3);}})['then'](function(_0x4309da){if(_0x4309da){_0xa46bc3=_0x4309da['length'];if(!_0x41633e['query']['hasOwnProperty'](_0x9e67('0x50'))){_0x2c58f3[_0x9e67('0x31')]=qs[_0x9e67('0x31')](_0x41633e[_0x9e67('0x47')]['limit']);_0x2c58f3[_0x9e67('0x2e')]=qs[_0x9e67('0x2e')](_0x41633e[_0x9e67('0x47')]['offset']);}return _0x4936dc[_0x9e67('0xca')](_0x2c58f3);}})['then'](function(_0x171fb6){if(_0x171fb6){return _0x171fb6?{'count':_0xa46bc3,'rows':_0x171fb6}:null;}})['then'](respondWithResult(_0xc2f48c,null))['catch'](handleError(_0xc2f48c,null));};exports[_0x9e67('0xcb')]=function(_0x2c3da8,_0x2a80ed,_0x78cc5f){var _0x162826={'raw':![],'where':{}};var _0x4b38d0={};var _0x1fdea9={'count':0x0,'rows':[]};return db[_0x9e67('0x43')][_0x9e67('0x6d')]({'where':{'id':_0x2c3da8[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x2a80ed,null))[_0x9e67('0x37')](function(_0x2360b5){if(_0x2360b5){_0x4b38d0[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db['SmsInteraction'][_0x9e67('0x5b')]);_0x4b38d0[_0x9e67('0x47')]=_['keys'](_0x2c3da8['query']);_0x4b38d0[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0x4b38d0[_0x9e67('0x4b')],_0x4b38d0[_0x9e67('0x47')]);_0x162826['attributes']=_['intersection'](_0x4b38d0[_0x9e67('0x4b')],qs[_0x9e67('0x4d')](_0x2c3da8[_0x9e67('0x47')]['fields']));_0x162826[_0x9e67('0x4c')]=_0x162826[_0x9e67('0x4c')]['length']?_0x162826[_0x9e67('0x4c')]:_0x4b38d0[_0x9e67('0x4b')];if(!_0x2c3da8['query'][_0x9e67('0x4f')](_0x9e67('0x50'))){_0x162826[_0x9e67('0x31')]=qs[_0x9e67('0x31')](_0x2c3da8[_0x9e67('0x47')]['limit']);_0x162826[_0x9e67('0x2e')]=qs[_0x9e67('0x2e')](_0x2c3da8[_0x9e67('0x47')]['offset']);}_0x162826[_0x9e67('0x6e')]=qs[_0x9e67('0x6f')](_0x2c3da8[_0x9e67('0x47')][_0x9e67('0x6f')]);_0x162826[_0x9e67('0x51')]=qs[_0x9e67('0x49')](_[_0x9e67('0x52')](_0x2c3da8[_0x9e67('0x47')],_0x4b38d0[_0x9e67('0x49')]));_0x162826[_0x9e67('0x51')][_0x9e67('0x6a')]=_0x2360b5['id'];if(_0x2c3da8[_0x9e67('0x47')][_0x9e67('0x55')]){_0x162826[_0x9e67('0x51')]=_['merge'](_0x162826[_0x9e67('0x51')],{'$or':_[_0x9e67('0x42')](_0x162826[_0x9e67('0x4c')],function(_0x51cc44){var _0x50da53={};_0x50da53[_0x51cc44]={'$like':'%'+_0x2c3da8[_0x9e67('0x47')]['filter']+'%'};return _0x50da53;})});}_0x162826=_[_0x9e67('0x53')]({},_0x162826,_0x2c3da8['options']);return db[_0x9e67('0xab')]['count']({'where':_0x162826[_0x9e67('0x51')]})[_0x9e67('0x37')](function(_0x12c20e){_0x1fdea9['count']=_0x12c20e;if(_0x2c3da8[_0x9e67('0x47')][_0x9e67('0x5c')]){_0x162826[_0x9e67('0x57')]=[{'model':db[_0x9e67('0xa5')],'as':'Contact','required':![]},{'model':db[_0x9e67('0xcc')],'as':_0x9e67('0xcd'),'attributes':[_0x9e67('0x3d'),'fullname',_0x9e67('0xce')],'required':![]},{'model':db['Tag'],'as':_0x9e67('0xcf'),'attributes':['id',_0x9e67('0x3d'),'color'],'where':_0x2c3da8['query'][_0x9e67('0xd0')]?{'id':_0x2c3da8[_0x9e67('0x47')][_0x9e67('0xd0')]}:undefined,'required':_0x2c3da8[_0x9e67('0x47')][_0x9e67('0xd0')]?!![]:![]}];}return db['SmsInteraction'][_0x9e67('0x58')](_0x162826);})[_0x9e67('0x37')](function(_0x2744a3){_0x1fdea9['rows']=_0x2744a3;return _0x1fdea9;});}})[_0x9e67('0x37')](respondWithFilteredResult(_0x2a80ed,_0x162826))[_0x9e67('0x2b')](handleError(_0x2a80ed,null));};exports[_0x9e67('0x3e')]=function(_0xde8f59,_0x4e1516,_0x1451af){var _0x4f1245,_0x134f66,_0x5cd181;if(_['isNil'](_0xde8f59['body'][_0x9e67('0x67')])||_0xde8f59[_0x9e67('0x67')][_0x9e67('0x67')]===''){throw new db['Sequelize']['ValidationError'](_0x9e67('0xa0'));}if(_[_0x9e67('0x9e')](_0xde8f59[_0x9e67('0x67')]['to'])){throw new db[(_0x9e67('0x7d'))]['ValidationError'](_0x9e67('0xd1'));}_0x4f1245=_0xde8f59['body']['to'];return db[_0x9e67('0x43')]['find']({'where':{'id':_0xde8f59['params']['id']},'include':[{'model':db[_0x9e67('0xa4')],'as':_0x9e67('0xd2'),'include':[{'model':db[_0x9e67('0xa5')],'as':_0x9e67('0xa6'),'where':{'mobile':_0x4f1245},'limit':0x1,'order':[[_0x9e67('0x82'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4e1516,null))[_0x9e67('0x37')](function(_0x5b9293){if(_0x5b9293&&_0x5b9293[_0x9e67('0xd2')]){_0x134f66=_0x5b9293[_0x9e67('0x39')]({'plain':!![]});if(_0x134f66[_0x9e67('0xd2')]&&_0x134f66[_0x9e67('0xd2')][_0x9e67('0xa6')][_0x9e67('0x4e')]){return _0x134f66[_0x9e67('0xd2')][_0x9e67('0xa6')][0x0];}return db[_0x9e67('0xa5')]['create'](_['defaults'](_0xde8f59[_0x9e67('0x67')],{'firstName':_0x4f1245,'mobile':_0x4f1245,'phone':_0x4f1245,'ListId':_0x134f66['ListId']}));}})['then'](handleEntityNotFound(_0x4e1516,null))['then'](function(_0x35bf25){if(_0x35bf25){_0x5cd181=_0x35bf25;return db['SmsInteraction']['find']({'where':{'ContactId':_0x5cd181['id'],'closed':![],'SmsAccountId':_0x134f66['id']}})[_0x9e67('0x37')](function(_0x22d5c1){if(_0x22d5c1){return[_0x22d5c1,![]];}return db['SmsInteraction'][_0x9e67('0x5e')]({'UserId':_0xde8f59[_0x9e67('0x60')]['id'],'ContactId':_0x5cd181['id'],'SmsAccountId':_0x134f66['id'],'phone':_0x4f1245,'firstMsgDirection':'out','Messages':[_['merge'](_0xde8f59[_0x9e67('0x67')],{'read':![],'body':_0xde8f59[_0x9e67('0x67')][_0x9e67('0x67')],'phone':_0x4f1245,'SmsAccountId':_0x134f66['id'],'UserId':_0xde8f59[_0x9e67('0x60')]['id'],'ContactId':_0x5cd181['id']})]},{'include':[{'model':db[_0x9e67('0xb3')],'as':_0x9e67('0xd3')}]})[_0x9e67('0x37')](function(_0x3ac771){return[_0x3ac771,!![]];});});}})[_0x9e67('0xac')](function(_0x321786,_0x1c8dae){if(_0x1c8dae){return _0x321786;}return db[_0x9e67('0xb3')][_0x9e67('0x5e')](_[_0x9e67('0x53')](_0xde8f59[_0x9e67('0x67')],{'read':![],'body':_0xde8f59[_0x9e67('0x67')][_0x9e67('0x67')],'phone':_0x4f1245,'SmsAccountId':_0x134f66['id'],'SmsInteractionId':_0x321786['id'],'UserId':_0xde8f59[_0x9e67('0x60')]['id'],'ContactId':_0x5cd181['id']}))[_0x9e67('0x37')](function(_0x578df0){_0x321786[_0x9e67('0xd4')][_0x9e67('0xd3')]=[];_0x321786[_0x9e67('0xd4')][_0x9e67('0xd3')][_0x9e67('0xd5')](_0x578df0[_0x9e67('0xd4')]);return _0x321786;});})[_0x9e67('0x37')](respondWithResult(_0x4e1516,null))['catch'](handleError(_0x4e1516,null));};exports[_0x9e67('0x3a')]=function(_0x1c30be,_0x24e299,_0x3e898d){if(_0x1c30be[_0x9e67('0x67')]['id']){delete _0x1c30be[_0x9e67('0x67')]['id'];}var _0x5af990,_0x442af4,_0x3e6fe6;return db['SmsAccount'][_0x9e67('0x5d')]({'where':{'id':_0x1c30be[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x24e299,null))['then'](function(_0x977f56){if(_0x977f56){_0x3e6fe6=_0x977f56;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9e67('0xd6'),_0x977f56[_0x9e67('0x45')],util[_0x9e67('0xd7')](_0x1c30be['body'],{'showHidden':![],'depth':null}));switch(_0x977f56[_0x9e67('0x45')]){case'skebby':if(_0x1c30be[_0x9e67('0x67')][_0x9e67('0xd8')]&&_0x1c30be[_0x9e67('0x67')][_0x9e67('0x3a')]){_0x442af4=_0x1c30be[_0x9e67('0x67')][_0x9e67('0x3a')];return db['SmsMessage'][_0x9e67('0x5d')]({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][_0x9e67('0xd8')]}});}break;case _0x9e67('0x8d'):if(_0x1c30be['body'][_0x9e67('0xd9')]&&_0x1c30be[_0x9e67('0x67')][_0x9e67('0xda')]){_0x442af4=_0x1c30be[_0x9e67('0x67')][_0x9e67('0xda')];return db[_0x9e67('0xb3')][_0x9e67('0x5d')]({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][_0x9e67('0xd9')]}});}break;case'clicksend':if(_0x1c30be[_0x9e67('0x67')][_0x9e67('0x90')]&&_0x1c30be['body']['status_code']){_0x442af4=_0x1c30be[_0x9e67('0x67')][_0x9e67('0xdb')];return db['SmsMessage']['find']({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][_0x9e67('0x90')]}});}break;case _0x9e67('0x94'):var _0x31990d=_0x1c30be[_0x9e67('0x67')][_0x9e67('0x95')][0x0];if(_0x31990d[_0x9e67('0x8f')]&&_0x31990d[_0x9e67('0x3a')][_0x9e67('0xdc')]==='DELIVERED'){_0x442af4=_0x31990d['status'][_0x9e67('0xdc')];return db[_0x9e67('0xb3')][_0x9e67('0x5d')]({'where':{'messageId':_0x31990d[_0x9e67('0x8f')]}});}break;case _0x9e67('0x99'):if(_0x1c30be[_0x9e67('0x67')][_0x9e67('0x8f')]&&_0x1c30be['body']['status']){_0x442af4=_0x1c30be[_0x9e67('0x67')][_0x9e67('0x3a')];return db[_0x9e67('0xb3')]['find']({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][_0x9e67('0x8f')]}});}break;case _0x9e67('0xdd'):if(_0x1c30be[_0x9e67('0x67')][0x0]['message']['id']){_0x442af4=_0x1c30be[_0x9e67('0x67')][0x0][_0x9e67('0x45')];return db[_0x9e67('0xb3')][_0x9e67('0x5d')]({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][0x0][_0x9e67('0x28')]['id']}});}break;case'intelepeer':if(_0x1c30be[_0x9e67('0x67')][_0x9e67('0xde')]&&_0x1c30be['body']['status']){_0x442af4=_0x1c30be['body'][_0x9e67('0x3a')];return db['SmsMessage'][_0x9e67('0x5d')]({'where':{'messageId':_0x1c30be[_0x9e67('0x67')][_0x9e67('0xde')]}});}break;}}})[_0x9e67('0x37')](handleEntityNotFound(_0x24e299,null))['then'](function(_0x269ad6){if(_0x269ad6){_0x5af990=_0x269ad6;switch(_0x3e6fe6[_0x9e67('0x45')]){case'skebby':if(_0x442af4===_0x9e67('0xdf')){return _0x5af990['update']({'read':!![]});}else{logger['error'](_0x9e67('0x23'),_0x9e67('0x3a'),_0x9e67('0x8a'),util['inspect'](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case _0x9e67('0x8d'):if(_0x442af4==='1'){return _0x5af990[_0x9e67('0x36')]({'read':!![]});}else{logger[_0x9e67('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e67('0x3a'),'skebby',util['inspect'](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1c30be[_0x9e67('0x67')]['error_code']&&_0x442af4>=0xc8&&_0x442af4<=0xce){return _0x5af990[_0x9e67('0x36')]({'read':!![]});}else{logger[_0x9e67('0x25')](_0x9e67('0x23'),_0x9e67('0x3a'),_0x9e67('0x8e'),util['inspect'](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case _0x9e67('0x94'):var _0x28912e=_0x1c30be['body']['results'][0x0];if(_0x28912e[_0x9e67('0x3a')][_0x9e67('0xdc')]===_0x9e67('0xdf')){return _0x5af990[_0x9e67('0x36')]({'read':!![]});}else{logger[_0x9e67('0x25')](_0x9e67('0x23'),'status',_0x9e67('0x94'),util[_0x9e67('0xd7')](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x442af4==_0x9e67('0xe0')||_0x442af4==_0x9e67('0xe1')){return _0x5af990['update']({'read':!![]});}else{logger[_0x9e67('0x25')](_0x9e67('0x23'),_0x9e67('0x3a'),_0x9e67('0x99'),util[_0x9e67('0xd7')](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case _0x9e67('0xdd'):if(_0x442af4==_0x9e67('0xe2')){return _0x5af990[_0x9e67('0x36')]({'read':!![]});}else{logger['error'](_0x9e67('0x23'),_0x9e67('0x3a'),'bandwidth',util[_0x9e67('0xd7')](_0x1c30be[_0x9e67('0x67')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x442af4===_0x9e67('0xe3')||_0x442af4===_0x9e67('0xe4')){return _0x5af990['update']({'read':!![]});}else{logger[_0x9e67('0x25')](_0x9e67('0x23'),_0x9e67('0x3a'),_0x9e67('0x9c'),util[_0x9e67('0xd7')](_0x1c30be['body'],{'showHidden':![],'depth':null}));}break;}return _0x5af990;}})['then'](respondWithResult(_0x24e299,null))[_0x9e67('0x2b')](handleError(_0x24e299,null));};exports[_0x9e67('0xe5')]=function(_0x5ca659,_0x2228b6,_0x17dd3f){var _0x433102,_0x23f4ae,_0x1d36c2;return db[_0x9e67('0x43')]['find']({'where':{'id':_0x5ca659[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x2228b6,null))[_0x9e67('0x37')](function(_0x4266ec){if(_0x4266ec){_0x1d36c2=_0x4266ec;logger[_0x9e67('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e67('0x3a'),_0x9e67('0xd6'),_0x4266ec['type'],util[_0x9e67('0xd7')](_0x5ca659[_0x9e67('0x47')],{'showHidden':![],'depth':null}));switch(_0x4266ec[_0x9e67('0x45')]){case _0x9e67('0x96'):if(_0x5ca659[_0x9e67('0x47')][_0x9e67('0xe6')]&&_0x5ca659[_0x9e67('0x47')][_0x9e67('0xe7')]){_0x23f4ae=_0x5ca659[_0x9e67('0x47')][_0x9e67('0xe7')];return db[_0x9e67('0xb3')][_0x9e67('0x5d')]({'where':{'messageId':_0x5ca659[_0x9e67('0x47')][_0x9e67('0xe6')]}});}break;}}})[_0x9e67('0x37')](handleEntityNotFound(_0x2228b6,null))[_0x9e67('0x37')](function(_0x22c5e6){if(_0x22c5e6){_0x433102=_0x22c5e6;switch(_0x1d36c2['type']){case _0x9e67('0x96'):if(_0x23f4ae==='2'||_0x23f4ae==='6'){return _0x433102[_0x9e67('0x36')]({'read':!![]});}else{logger[_0x9e67('0x25')](_0x9e67('0x23'),_0x9e67('0x3a'),_0x9e67('0x96'),util['inspect'](_0x5ca659[_0x9e67('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x433102;}})[_0x9e67('0x37')](respondWithResult(_0x2228b6,null))['catch'](handleError(_0x2228b6,null));};exports['addAgents']=function(_0x3e5823,_0x5c4eab,_0x43ad04){return db[_0x9e67('0x43')]['find']({'where':{'id':_0x3e5823[_0x9e67('0x5a')]['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x5c4eab,null))[_0x9e67('0x37')](function(_0x2b1992){if(_0x2b1992){return _0x2b1992[_0x9e67('0xe8')](_0x3e5823[_0x9e67('0x67')][_0x9e67('0x71')],_[_0x9e67('0xa9')](_0x3e5823[_0x9e67('0x67')],[_0x9e67('0x71'),'id'])||{})[_0x9e67('0xac')](function(_0x27107f){for(var _0x282fd9=0x0;_0x282fd9<_0x3e5823[_0x9e67('0x67')][_0x9e67('0x71')][_0x9e67('0x4e')];_0x282fd9+=0x1){socket[_0x9e67('0xe9')]('userSmsAccount:save',{'UserId':Number(_0x3e5823[_0x9e67('0x67')][_0x9e67('0x71')][_0x282fd9]),'SmsAccountId':Number(_0x3e5823[_0x9e67('0x5a')]['id'])});}return _0x27107f;});}})[_0x9e67('0x37')](respondWithResult(_0x5c4eab,null))['catch'](handleError(_0x5c4eab,null));};exports['removeAgents']=function(_0x2a720e,_0x1ac270,_0x3281ca){return db[_0x9e67('0x43')][_0x9e67('0x5d')]({'where':{'id':_0x2a720e['params']['id']}})['then'](handleEntityNotFound(_0x1ac270,null))[_0x9e67('0x37')](function(_0xef8264){if(_0xef8264){return _0xef8264[_0x9e67('0xea')](_0x2a720e[_0x9e67('0x47')]['ids'])[_0x9e67('0x37')](function(){if(_[_0x9e67('0xeb')](_0x2a720e['query']['ids'])){for(var _0x305705=0x0;_0x305705<_0x2a720e['query'][_0x9e67('0x71')][_0x9e67('0x4e')];_0x305705+=0x1){socket[_0x9e67('0xe9')](_0x9e67('0xec'),{'UserId':Number(_0x2a720e[_0x9e67('0x47')][_0x9e67('0x71')][_0x305705]),'SmsAccountId':Number(_0x2a720e[_0x9e67('0x5a')]['id'])});}}else{socket[_0x9e67('0xe9')](_0x9e67('0xec'),{'UserId':Number(_0x2a720e['query'][_0x9e67('0x71')]),'SmsAccountId':Number(_0x2a720e[_0x9e67('0x5a')]['id'])});}});}})[_0x9e67('0x37')](respondWithStatusCode(_0x1ac270,null))[_0x9e67('0x2b')](handleError(_0x1ac270,null));};exports['getAgents']=function(_0xbfd979,_0x1f46df,_0x2710cd){var _0x2882de={};var _0xef2b7a={};var _0x3aeb7c;var _0x21fc39;return db[_0x9e67('0x43')]['findOne']({'where':{'id':_0xbfd979['params']['id']}})[_0x9e67('0x37')](handleEntityNotFound(_0x1f46df,null))[_0x9e67('0x37')](function(_0x5b4d1b){if(_0x5b4d1b){_0x3aeb7c=_0x5b4d1b;_0xef2b7a[_0x9e67('0x4b')]=_[_0x9e67('0x48')](db[_0x9e67('0xcc')][_0x9e67('0x5b')]);_0xef2b7a[_0x9e67('0x47')]=_[_0x9e67('0x48')](_0xbfd979[_0x9e67('0x47')]);_0xef2b7a[_0x9e67('0x49')]=_[_0x9e67('0x4a')](_0xef2b7a[_0x9e67('0x4b')],_0xef2b7a[_0x9e67('0x47')]);_0x2882de[_0x9e67('0x4c')]=_[_0x9e67('0x4a')](_0xef2b7a['model'],qs['fields'](_0xbfd979[_0x9e67('0x47')][_0x9e67('0x4d')]));_0x2882de[_0x9e67('0x4c')]=_0x2882de[_0x9e67('0x4c')][_0x9e67('0x4e')]?_0x2882de[_0x9e67('0x4c')]:_0xef2b7a[_0x9e67('0x4b')];_0x2882de['order']=qs['sort'](_0xbfd979[_0x9e67('0x47')][_0x9e67('0x6f')]);_0x2882de[_0x9e67('0x51')]=qs['filters'](_[_0x9e67('0x52')](_0xbfd979[_0x9e67('0x47')],_0xef2b7a['filters']));if(_0xbfd979[_0x9e67('0x47')][_0x9e67('0x55')]){_0x2882de[_0x9e67('0x51')]=_['merge'](_0x2882de[_0x9e67('0x51')],{'$or':_['map'](_0x2882de[_0x9e67('0x4c')],function(_0x4f597a){var _0x45da7d={};_0x45da7d[_0x4f597a]={'$like':'%'+_0xbfd979[_0x9e67('0x47')][_0x9e67('0x55')]+'%'};return _0x45da7d;})});}_0x2882de=_['merge']({},_0x2882de,_0xbfd979['options']);return _0x3aeb7c[_0x9e67('0xed')](_0x2882de);}})[_0x9e67('0x37')](function(_0x20d650){if(_0x20d650){_0x21fc39=_0x20d650[_0x9e67('0x4e')];if(!_0xbfd979[_0x9e67('0x47')][_0x9e67('0x4f')](_0x9e67('0x50'))){_0x2882de[_0x9e67('0x31')]=qs[_0x9e67('0x31')](_0xbfd979[_0x9e67('0x47')]['limit']);_0x2882de[_0x9e67('0x2e')]=qs[_0x9e67('0x2e')](_0xbfd979[_0x9e67('0x47')][_0x9e67('0x2e')]);}return _0x3aeb7c[_0x9e67('0xed')](_0x2882de);}})['then'](function(_0x12e57d){if(_0x12e57d){return _0x12e57d?{'count':_0x21fc39,'rows':_0x12e57d}:null;}})[_0x9e67('0x37')](respondWithResult(_0x1f46df,null))[_0x9e67('0x2b')](handleError(_0x1f46df,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b87e421..f2fe28b 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 _0xf430=['../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf430,0xd8));var _0x0f43=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xf430[_0x36eaaa];return _0x461349;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x0f43('0x0'))['db'][_0x0f43('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f43('0x2'),'afterDestroy':_0x0f43('0x3')};function emitEvent(_0x125c71){return function(_0x1f9df1,_0x1ceec8,_0x3c82be){SmsAccountEvents['emit'](_0x125c71+':'+_0x1f9df1['id'],_0x1f9df1);SmsAccountEvents[_0x0f43('0x4')](_0x125c71,_0x1f9df1);_0x3c82be(null);};}for(var e in events){if(events[_0x0f43('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xa2bc=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa2bc,0x144));var _0xca2b=function(_0x1c4ad8,_0x461fe4){_0x1c4ad8=_0x1c4ad8-0x0;var _0x4cef33=_0xa2bc[_0x1c4ad8];return _0x4cef33;};'use strict';var EventEmitter=require(_0xca2b('0x0'));var SmsAccount=require(_0xca2b('0x1'))['db'][_0xca2b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xca2b('0x3')](0x0);var events={'afterCreate':_0xca2b('0x4'),'afterUpdate':_0xca2b('0x5'),'afterDestroy':_0xca2b('0x6')};function emitEvent(_0xcd2315){return function(_0x5d4116,_0x55ea9b,_0xbd0d64){SmsAccountEvents[_0xca2b('0x7')](_0xcd2315+':'+_0x5d4116['id'],_0x5d4116);SmsAccountEvents[_0xca2b('0x7')](_0xcd2315,_0x5d4116);_0xbd0d64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xca2b('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 293a73f..50d79a3 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 _0x0a54=['lodash','util','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x35566f,_0x2131f5){var _0x2cd13a=function(_0x53a0e7){while(--_0x53a0e7){_0x35566f['push'](_0x35566f['shift']());}};_0x2cd13a(++_0x2131f5);}(_0x0a54,0x9a));var _0x40a5=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x0a54[_0x35387d];return _0x3aba56;};'use strict';var _=require(_0x40a5('0x0'));var util=require(_0x40a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x40a5('0x2'));var BPromise=require(_0x40a5('0x3'));var rp=require(_0x40a5('0x4'));var fs=require('fs');var path=require(_0x40a5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40a5('0x6'));module[_0x40a5('0x7')]=function(_0x24dccb,_0x10d81e){return _0x24dccb[_0x40a5('0x8')](_0x40a5('0x9'),attributes,{'tableName':_0x40a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40e1=['../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4633f9,_0x91b9a9){var _0x2404ee=function(_0xd8347e){while(--_0xd8347e){_0x4633f9['push'](_0x4633f9['shift']());}};_0x2404ee(++_0x91b9a9);}(_0x40e1,0x72));var _0x140e=function(_0x1f5e33,_0x10f720){_0x1f5e33=_0x1f5e33-0x0;var _0x28aadf=_0x40e1[_0x1f5e33];return _0x28aadf;};'use strict';var _=require(_0x140e('0x0'));var util=require('util');var logger=require(_0x140e('0x1'))(_0x140e('0x2'));var moment=require('moment');var BPromise=require(_0x140e('0x3'));var rp=require(_0x140e('0x4'));var fs=require('fs');var path=require(_0x140e('0x5'));var rimraf=require(_0x140e('0x6'));var config=require(_0x140e('0x7'));var attributes=require(_0x140e('0x8'));module[_0x140e('0x9')]=function(_0x3b6b57,_0x23accb){return _0x3b6b57['define'](_0x140e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 57e3dae..4cbbe18 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 _0x54ac=['code','message','catch','find','options','raw','attributes','include','model','map','ShowSmsAccount','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x27392d,_0x4bcb89){var _0x35bfc4=function(_0x311840){while(--_0x311840){_0x27392d['push'](_0x27392d['shift']());}};_0x35bfc4(++_0x4bcb89);}(_0x54ac,0xd2));var _0xc54a=function(_0x9ac89b,_0x25b61d){_0x9ac89b=_0x9ac89b-0x0;var _0x40da74=_0x54ac[_0x9ac89b];return _0x40da74;};'use strict';var _=require('lodash');var util=require(_0xc54a('0x0'));var moment=require(_0xc54a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc54a('0x2'));var db=require(_0xc54a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc54a('0x4'))('rpc');var config=require(_0xc54a('0x5'));var jayson=require(_0xc54a('0x6'));var client=jayson['client'][_0xc54a('0x7')]({'port':0x232a});config[_0xc54a('0x8')]=_[_0xc54a('0x9')](config[_0xc54a('0x8')],{'host':_0xc54a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc54a('0x8')]));require(_0xc54a('0xb'))[_0xc54a('0xc')](socket);function respondWithRpcPromise(_0x2f7764,_0x52de62,_0x44999b){return new BPromise(function(_0x5d3411,_0x2ffbf9){return client[_0xc54a('0xd')](_0x2f7764,_0x44999b)[_0xc54a('0xe')](function(_0x61d428){logger[_0xc54a('0xf')](_0xc54a('0x10'),_0x52de62,_0xc54a('0x11'));logger[_0xc54a('0x12')](_0xc54a('0x13'),_0x52de62,_0xc54a('0x11'),JSON['stringify'](_0x61d428));if(_0x61d428['error']){if(_0x61d428[_0xc54a('0x14')][_0xc54a('0x15')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x52de62,_0x61d428[_0xc54a('0x14')][_0xc54a('0x16')]);return _0x2ffbf9(_0x61d428['error'][_0xc54a('0x16')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x52de62,_0x61d428[_0xc54a('0x14')]['message']);return _0x5d3411(_0x61d428[_0xc54a('0x14')]['message']);}else{logger[_0xc54a('0xf')](_0xc54a('0x10'),_0x52de62,'request\x20sent');_0x5d3411(_0x61d428['result'][_0xc54a('0x16')]);}})[_0xc54a('0x17')](function(_0x1e494b){logger[_0xc54a('0x14')](_0xc54a('0x10'),_0x52de62,_0x1e494b);_0x2ffbf9(_0x1e494b);});});}exports['ShowSmsAccount']=function(_0x41d104){var _0x539801=this;return new Promise(function(_0x280890,_0x543f8b){return db['SmsAccount'][_0xc54a('0x18')]({'raw':_0x41d104[_0xc54a('0x19')]?_0x41d104[_0xc54a('0x19')][_0xc54a('0x1a')]===undefined?!![]:![]:!![],'where':_0x41d104[_0xc54a('0x19')]?_0x41d104[_0xc54a('0x19')]['where']||null:null,'attributes':_0x41d104[_0xc54a('0x19')]?_0x41d104[_0xc54a('0x19')][_0xc54a('0x1b')]||null:null,'include':_0x41d104[_0xc54a('0x19')]?_0x41d104['options']['include']?_['map'](_0x41d104[_0xc54a('0x19')][_0xc54a('0x1c')],function(_0x12ac92){return{'model':db[_0x12ac92[_0xc54a('0x1d')]],'as':_0x12ac92['as'],'attributes':_0x12ac92[_0xc54a('0x1b')],'include':_0x12ac92['include']?_['map'](_0x12ac92[_0xc54a('0x1c')],function(_0x464296){return{'model':db[_0x464296[_0xc54a('0x1d')]],'as':_0x464296['as'],'attributes':_0x464296[_0xc54a('0x1b')],'include':_0x464296['include']?_[_0xc54a('0x1e')](_0x464296[_0xc54a('0x1c')],function(_0x1f97ca){return{'model':db[_0x1f97ca[_0xc54a('0x1d')]],'as':_0x1f97ca['as'],'attributes':_0x1f97ca[_0xc54a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc54a('0xe')](function(_0x516da7){logger[_0xc54a('0xf')](_0xc54a('0x1f'),_0x41d104);logger[_0xc54a('0x12')](_0xc54a('0x1f'),_0x41d104,JSON[_0xc54a('0x20')](_0x516da7));_0x280890(_0x516da7);})[_0xc54a('0x17')](function(_0x8dc072){logger['error'](_0xc54a('0x1f'),_0x8dc072[_0xc54a('0x16')],_0x41d104);_0x543f8b(_0x539801[_0xc54a('0x14')](0x1f4,_0x8dc072['message']));});});}; \ No newline at end of file +var _0x2f74=['lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','options','raw','where','attributes','map','model','include','debug','catch'];(function(_0x5ec4b0,_0x403669){var _0x1572b5=function(_0x38c0cf){while(--_0x38c0cf){_0x5ec4b0['push'](_0x5ec4b0['shift']());}};_0x1572b5(++_0x403669);}(_0x2f74,0x1ea));var _0x42f7=function(_0x113876,_0x2d243d){_0x113876=_0x113876-0x0;var _0x3da554=_0x2f74[_0x113876];return _0x3da554;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42f7('0x1'));var rs=require(_0x42f7('0x2'));var fs=require('fs');var Redis=require(_0x42f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42f7('0x4'))(_0x42f7('0x5'));var config=require(_0x42f7('0x6'));var jayson=require(_0x42f7('0x7'));var client=jayson['client'][_0x42f7('0x8')]({'port':0x232a});config[_0x42f7('0x9')]=_[_0x42f7('0xa')](config[_0x42f7('0x9')],{'host':_0x42f7('0xb'),'port':0x18eb});var socket=require(_0x42f7('0xc'))(new Redis(config[_0x42f7('0x9')]));require(_0x42f7('0xd'))[_0x42f7('0xe')](socket);function respondWithRpcPromise(_0x13b4e2,_0x2368a0,_0x5d1e18){return new BPromise(function(_0x524c19,_0x57a1b1){return client['request'](_0x13b4e2,_0x5d1e18)[_0x42f7('0xf')](function(_0x1fdda0){logger[_0x42f7('0x10')](_0x42f7('0x11'),_0x2368a0,_0x42f7('0x12'));logger['debug'](_0x42f7('0x13'),_0x2368a0,_0x42f7('0x12'),JSON[_0x42f7('0x14')](_0x1fdda0));if(_0x1fdda0[_0x42f7('0x15')]){if(_0x1fdda0[_0x42f7('0x15')][_0x42f7('0x16')]===0x1f4){logger[_0x42f7('0x15')](_0x42f7('0x11'),_0x2368a0,_0x1fdda0['error']['message']);return _0x57a1b1(_0x1fdda0[_0x42f7('0x15')][_0x42f7('0x17')]);}logger[_0x42f7('0x15')]('SmsAccount,\x20%s,\x20%s',_0x2368a0,_0x1fdda0['error']['message']);return _0x524c19(_0x1fdda0[_0x42f7('0x15')][_0x42f7('0x17')]);}else{logger[_0x42f7('0x10')]('SmsAccount,\x20%s,\x20%s',_0x2368a0,_0x42f7('0x12'));_0x524c19(_0x1fdda0[_0x42f7('0x18')][_0x42f7('0x17')]);}})['catch'](function(_0x10d5ab){logger[_0x42f7('0x15')]('SmsAccount,\x20%s,\x20%s',_0x2368a0,_0x10d5ab);_0x57a1b1(_0x10d5ab);});});}exports[_0x42f7('0x19')]=function(_0x2be0f7){var _0x442b4a=this;return new Promise(function(_0x1aef37,_0x4c1c8a){return db['SmsAccount']['find']({'raw':_0x2be0f7['options']?_0x2be0f7[_0x42f7('0x1a')][_0x42f7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2be0f7[_0x42f7('0x1a')]?_0x2be0f7[_0x42f7('0x1a')][_0x42f7('0x1c')]||null:null,'attributes':_0x2be0f7[_0x42f7('0x1a')]?_0x2be0f7[_0x42f7('0x1a')][_0x42f7('0x1d')]||null:null,'include':_0x2be0f7[_0x42f7('0x1a')]?_0x2be0f7[_0x42f7('0x1a')]['include']?_[_0x42f7('0x1e')](_0x2be0f7['options']['include'],function(_0x18f56c){return{'model':db[_0x18f56c[_0x42f7('0x1f')]],'as':_0x18f56c['as'],'attributes':_0x18f56c[_0x42f7('0x1d')],'include':_0x18f56c['include']?_[_0x42f7('0x1e')](_0x18f56c['include'],function(_0x11b329){return{'model':db[_0x11b329[_0x42f7('0x1f')]],'as':_0x11b329['as'],'attributes':_0x11b329[_0x42f7('0x1d')],'include':_0x11b329[_0x42f7('0x20')]?_['map'](_0x11b329[_0x42f7('0x20')],function(_0x482c6d){return{'model':db[_0x482c6d[_0x42f7('0x1f')]],'as':_0x482c6d['as'],'attributes':_0x482c6d[_0x42f7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x42f7('0xf')](function(_0x2d3fa5){logger['info'](_0x42f7('0x19'),_0x2be0f7);logger[_0x42f7('0x21')](_0x42f7('0x19'),_0x2be0f7,JSON[_0x42f7('0x14')](_0x2d3fa5));_0x1aef37(_0x2d3fa5);})[_0x42f7('0x22')](function(_0x5ec375){logger[_0x42f7('0x15')](_0x42f7('0x19'),_0x5ec375[_0x42f7('0x17')],_0x2be0f7);_0x4c1c8a(_0x442b4a[_0x42f7('0x15')](0x1f4,_0x5ec375[_0x42f7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 42fbf44..c0e363e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 a43e390..bfc2ad1 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d30c0,_0x3a0ae7){var _0x5b0c2e=function(_0x3d752b){while(--_0x3d752b){_0x4d30c0['push'](_0x4d30c0['shift']());}};_0x5b0c2e(++_0x3a0ae7);}(_0x34e8,0x12c));var _0x834e=function(_0x34333d,_0x356793){_0x34333d=_0x34333d-0x0;var _0x412b91=_0x34e8[_0x34333d];return _0x412b91;};'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 aa4cfcd..82b9ef6 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 _0x505b=['INTEGER','noop','STRING','sequelize','exports'];(function(_0x499137,_0x44c95e){var _0x1e7247=function(_0x45eeb3){while(--_0x45eeb3){_0x499137['push'](_0x499137['shift']());}};_0x1e7247(++_0x44c95e);}(_0x505b,0x148));var _0xb505=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x505b[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xb505('0x0'));module[_0xb505('0x1')]={'priority':{'type':Sequelize[_0xb505('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb505('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb505('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb9bf=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x20277b,_0x1b3cf0){var _0x40dd48=function(_0x5dafae){while(--_0x5dafae){_0x20277b['push'](_0x20277b['shift']());}};_0x40dd48(++_0x1b3cf0);}(_0xb9bf,0x1c3));var _0xfb9b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xb9bf[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0xfb9b('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfb9b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfb9b('0x2')],'allowNull':![],'defaultValue':_0xfb9b('0x3')},'appdata':{'type':Sequelize[_0xfb9b('0x4')]()},'description':{'type':Sequelize[_0xfb9b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfb9b('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dda63db..a6650f0 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 _0x177c=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsApplication','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x782ebf,_0x4c1be3){var _0x1f7980=function(_0xd2cd0c){while(--_0xd2cd0c){_0x782ebf['push'](_0x782ebf['shift']());}};_0x1f7980(++_0x4c1be3);}(_0x177c,0xf3));var _0xc177=function(_0x192856,_0x1af22d){_0x192856=_0x192856-0x0;var _0x29b4f9=_0x177c[_0x192856];return _0x29b4f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc177('0x0'));var jsonpatch=require(_0xc177('0x1'));var rp=require(_0xc177('0x2'));var moment=require(_0xc177('0x3'));var BPromise=require(_0xc177('0x4'));var Mustache=require(_0xc177('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc177('0x6'));var csv=require(_0xc177('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc177('0x8'));var _=require(_0xc177('0x9'));var squel=require(_0xc177('0xa'));var crypto=require(_0xc177('0xb'));var jsforce=require(_0xc177('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc177('0x7'));var querystring=require(_0xc177('0xd'));var Papa=require('papaparse');var Redis=require(_0xc177('0xe'));var authService=require(_0xc177('0xf'));var qs=require(_0xc177('0x10'));var as=require(_0xc177('0x11'));var hardwareService=require(_0xc177('0x12'));var logger=require(_0xc177('0x13'))(_0xc177('0x14'));var utils=require(_0xc177('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc177('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24b8b0,_0x46fefe){_0x46fefe=_0x46fefe||0xcc;return function(_0x3b69f5){if(_0x3b69f5){return _0x24b8b0[_0xc177('0x17')](_0x46fefe);}return _0x24b8b0[_0xc177('0x18')](_0x46fefe)['end']();};}function respondWithResult(_0x15d73a,_0x45febc){_0x45febc=_0x45febc||0xc8;return function(_0x16089c){if(_0x16089c){return _0x15d73a['status'](_0x45febc)[_0xc177('0x19')](_0x16089c);}};}function respondWithFilteredResult(_0x234653,_0x204ee6){return function(_0x338895){if(_0x338895){var _0x4fe0f3=typeof _0x204ee6[_0xc177('0x1a')]==='undefined'&&typeof _0x204ee6['limit']==='undefined';var _0x32ee34=_0x338895[_0xc177('0x1b')];var _0x53d54e=_0x4fe0f3?0x0:_0x204ee6[_0xc177('0x1a')];var _0x15140d=_0x4fe0f3?_0x338895[_0xc177('0x1b')]:_0x204ee6[_0xc177('0x1a')]+_0x204ee6[_0xc177('0x1c')];var _0x22d95f;if(_0x15140d>=_0x32ee34){_0x15140d=_0x32ee34;_0x22d95f=0xc8;}else{_0x22d95f=0xce;}_0x234653[_0xc177('0x18')](_0x22d95f);return _0x234653['set'](_0xc177('0x1d'),_0x53d54e+'-'+_0x15140d+'/'+_0x32ee34)[_0xc177('0x19')](_0x338895);}return null;};}function patchUpdates(_0x3d681d){return function(_0x59a766){try{jsonpatch[_0xc177('0x1e')](_0x59a766,_0x3d681d,!![]);}catch(_0x56f6a6){return BPromise[_0xc177('0x1f')](_0x56f6a6);}return _0x59a766[_0xc177('0x20')]();};}function saveUpdates(_0x1fb4c0,_0x1e0904){return function(_0x3d86aa){if(_0x3d86aa){return _0x3d86aa[_0xc177('0x21')](_0x1fb4c0)[_0xc177('0x22')](function(_0x2e891d){return _0x2e891d;});}return null;};}function removeEntity(_0x4c65df,_0x54212f){return function(_0x565ffb){if(_0x565ffb){return _0x565ffb[_0xc177('0x23')]()['then'](function(){_0x4c65df[_0xc177('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554199,_0x591c85){return function(_0x270156){if(!_0x270156){_0x554199['sendStatus'](0x194);}return _0x270156;};}function handleError(_0x10999e,_0x4d56c3){_0x4d56c3=_0x4d56c3||0x1f4;return function(_0x497d46){logger[_0xc177('0x24')](_0x497d46[_0xc177('0x25')]);if(_0x497d46[_0xc177('0x26')]){delete _0x497d46[_0xc177('0x26')];}_0x10999e['status'](_0x4d56c3)[_0xc177('0x27')](_0x497d46);};}exports['index']=function(_0x121475,_0xafa620){var _0x525f6e={},_0x45a5b5={},_0x310699={'count':0x0,'rows':[]};var _0x4ccc99=_['map'](db[_0xc177('0x28')][_0xc177('0x29')],function(_0x282e0a){return{'name':_0x282e0a[_0xc177('0x2a')],'type':_0x282e0a['type'][_0xc177('0x2b')]};});_0x45a5b5[_0xc177('0x2c')]=_[_0xc177('0x2d')](_0x4ccc99,_0xc177('0x26'));_0x45a5b5[_0xc177('0x2e')]=_[_0xc177('0x2f')](_0x121475['query']);_0x45a5b5[_0xc177('0x30')]=_[_0xc177('0x31')](_0x45a5b5[_0xc177('0x2c')],_0x45a5b5[_0xc177('0x2e')]);_0x525f6e['attributes']=_[_0xc177('0x31')](_0x45a5b5[_0xc177('0x2c')],qs[_0xc177('0x32')](_0x121475[_0xc177('0x2e')][_0xc177('0x32')]));_0x525f6e[_0xc177('0x33')]=_0x525f6e[_0xc177('0x33')][_0xc177('0x34')]?_0x525f6e[_0xc177('0x33')]:_0x45a5b5[_0xc177('0x2c')];if(!_0x121475[_0xc177('0x2e')][_0xc177('0x35')](_0xc177('0x36'))){_0x525f6e[_0xc177('0x1c')]=qs[_0xc177('0x1c')](_0x121475[_0xc177('0x2e')]['limit']);_0x525f6e['offset']=qs['offset'](_0x121475[_0xc177('0x2e')]['offset']);}_0x525f6e[_0xc177('0x37')]=qs['sort'](_0x121475[_0xc177('0x2e')][_0xc177('0x38')]);_0x525f6e['where']=qs[_0xc177('0x30')](_[_0xc177('0x39')](_0x121475[_0xc177('0x2e')],_0x45a5b5['filters']),_0x4ccc99);if(_0x121475[_0xc177('0x2e')][_0xc177('0x3a')]){_0x525f6e[_0xc177('0x3b')]=_[_0xc177('0x3c')](_0x525f6e[_0xc177('0x3b')],{'$or':_[_0xc177('0x2d')](_0x4ccc99,function(_0x5d92e6){if(_0x5d92e6[_0xc177('0x3d')]!==_0xc177('0x3e')){var _0x16f824={};_0x16f824[_0x5d92e6[_0xc177('0x26')]]={'$like':'%'+_0x121475['query'][_0xc177('0x3a')]+'%'};return _0x16f824;}})});}_0x525f6e=_[_0xc177('0x3c')]({},_0x525f6e,_0x121475['options']);var _0x1b7806={'where':_0x525f6e[_0xc177('0x3b')]};return db[_0xc177('0x28')][_0xc177('0x1b')](_0x1b7806)['then'](function(_0xc84f25){_0x310699[_0xc177('0x1b')]=_0xc84f25;if(_0x121475[_0xc177('0x2e')]['includeAll']){_0x525f6e[_0xc177('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xc177('0x40')](_0x525f6e);})['then'](function(_0x895a40){_0x310699[_0xc177('0x41')]=_0x895a40;return _0x310699;})[_0xc177('0x22')](respondWithFilteredResult(_0xafa620,_0x525f6e))[_0xc177('0x42')](handleError(_0xafa620,null));};exports[_0xc177('0x43')]=function(_0x4bba27,_0x481744){var _0x37583f={'raw':!![],'where':{'id':_0x4bba27['params']['id']}},_0x15a0c8={};_0x15a0c8[_0xc177('0x2c')]=_['keys'](db[_0xc177('0x28')][_0xc177('0x29')]);_0x15a0c8[_0xc177('0x2e')]=_[_0xc177('0x2f')](_0x4bba27[_0xc177('0x2e')]);_0x15a0c8[_0xc177('0x30')]=_['intersection'](_0x15a0c8[_0xc177('0x2c')],_0x15a0c8['query']);_0x37583f[_0xc177('0x33')]=_['intersection'](_0x15a0c8[_0xc177('0x2c')],qs[_0xc177('0x32')](_0x4bba27[_0xc177('0x2e')][_0xc177('0x32')]));_0x37583f[_0xc177('0x33')]=_0x37583f[_0xc177('0x33')][_0xc177('0x34')]?_0x37583f[_0xc177('0x33')]:_0x15a0c8['model'];if(_0x4bba27[_0xc177('0x2e')][_0xc177('0x44')]){_0x37583f[_0xc177('0x3f')]=[{'all':!![]}];}_0x37583f=_[_0xc177('0x3c')]({},_0x37583f,_0x4bba27[_0xc177('0x45')]);return db[_0xc177('0x28')][_0xc177('0x46')](_0x37583f)['then'](handleEntityNotFound(_0x481744,null))['then'](respondWithResult(_0x481744,null))[_0xc177('0x42')](handleError(_0x481744,null));};exports[_0xc177('0x47')]=function(_0x4dbd33,_0x19f7bd){return db[_0xc177('0x28')]['create'](_0x4dbd33[_0xc177('0x48')],{})[_0xc177('0x22')](respondWithResult(_0x19f7bd,0xc9))[_0xc177('0x42')](handleError(_0x19f7bd,null));};exports[_0xc177('0x21')]=function(_0x50afb5,_0x3375a8){if(_0x50afb5[_0xc177('0x48')]['id']){delete _0x50afb5[_0xc177('0x48')]['id'];}return db[_0xc177('0x28')][_0xc177('0x46')]({'where':{'id':_0x50afb5[_0xc177('0x49')]['id']}})[_0xc177('0x22')](handleEntityNotFound(_0x3375a8,null))[_0xc177('0x22')](saveUpdates(_0x50afb5[_0xc177('0x48')],null))[_0xc177('0x22')](respondWithResult(_0x3375a8,null))[_0xc177('0x42')](handleError(_0x3375a8,null));};exports['destroy']=function(_0x3f9e00,_0x4514b6){return db[_0xc177('0x28')][_0xc177('0x46')]({'where':{'id':_0x3f9e00[_0xc177('0x49')]['id']}})[_0xc177('0x22')](handleEntityNotFound(_0x4514b6,null))[_0xc177('0x22')](removeEntity(_0x4514b6,null))[_0xc177('0x42')](handleError(_0x4514b6,null));}; \ No newline at end of file +var _0xc325=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x258d23,_0x2c1e53){var _0x26ff56=function(_0x153a54){while(--_0x153a54){_0x258d23['push'](_0x258d23['shift']());}};_0x26ff56(++_0x2c1e53);}(_0xc325,0x125));var _0x5c32=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc325[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x5c32('0x0'));var rimraf=require(_0x5c32('0x1'));var zipdir=require(_0x5c32('0x2'));var jsonpatch=require(_0x5c32('0x3'));var rp=require(_0x5c32('0x4'));var moment=require('moment');var BPromise=require(_0x5c32('0x5'));var Mustache=require(_0x5c32('0x6'));var util=require(_0x5c32('0x7'));var path=require(_0x5c32('0x8'));var sox=require(_0x5c32('0x9'));var csv=require(_0x5c32('0xa'));var ejs=require(_0x5c32('0xb'));var fs=require('fs');var fs_extra=require(_0x5c32('0xc'));var _=require(_0x5c32('0xd'));var squel=require('squel');var crypto=require(_0x5c32('0xe'));var jsforce=require(_0x5c32('0xf'));var deskjs=require(_0x5c32('0x10'));var toCsv=require(_0x5c32('0xa'));var querystring=require(_0x5c32('0x11'));var Papa=require(_0x5c32('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c32('0x13'));var as=require(_0x5c32('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c32('0x15'))(_0x5c32('0x16'));var utils=require(_0x5c32('0x17'));var config=require(_0x5c32('0x18'));var licenseUtil=require(_0x5c32('0x19'));var db=require(_0x5c32('0x1a'))['db'];function respondWithStatusCode(_0x3c0fff,_0x132dc7){_0x132dc7=_0x132dc7||0xcc;return function(_0x2e1554){if(_0x2e1554){return _0x3c0fff[_0x5c32('0x1b')](_0x132dc7);}return _0x3c0fff[_0x5c32('0x1c')](_0x132dc7)[_0x5c32('0x1d')]();};}function respondWithResult(_0x35ef1a,_0x1ef36b){_0x1ef36b=_0x1ef36b||0xc8;return function(_0x1edcba){if(_0x1edcba){return _0x35ef1a[_0x5c32('0x1c')](_0x1ef36b)['json'](_0x1edcba);}};}function respondWithFilteredResult(_0x35c1ba,_0x4f94b8){return function(_0x3f3edf){if(_0x3f3edf){var _0x3c2d80=typeof _0x4f94b8[_0x5c32('0x1e')]===_0x5c32('0x1f')&&typeof _0x4f94b8[_0x5c32('0x20')]===_0x5c32('0x1f');var _0x129b67=_0x3f3edf['count'];var _0x58cde9=_0x3c2d80?0x0:_0x4f94b8['offset'];var _0xd2d253=_0x3c2d80?_0x3f3edf[_0x5c32('0x21')]:_0x4f94b8[_0x5c32('0x1e')]+_0x4f94b8[_0x5c32('0x20')];var _0xde9b30;if(_0xd2d253>=_0x129b67){_0xd2d253=_0x129b67;_0xde9b30=0xc8;}else{_0xde9b30=0xce;}_0x35c1ba['status'](_0xde9b30);return _0x35c1ba[_0x5c32('0x22')](_0x5c32('0x23'),_0x58cde9+'-'+_0xd2d253+'/'+_0x129b67)[_0x5c32('0x24')](_0x3f3edf);}return null;};}function patchUpdates(_0xc7f90c){return function(_0x46d96c){try{jsonpatch[_0x5c32('0x25')](_0x46d96c,_0xc7f90c,!![]);}catch(_0x5e4862){return BPromise[_0x5c32('0x26')](_0x5e4862);}return _0x46d96c[_0x5c32('0x27')]();};}function saveUpdates(_0x2c0674,_0x2b7710){return function(_0x3fb005){if(_0x3fb005){return _0x3fb005[_0x5c32('0x28')](_0x2c0674)[_0x5c32('0x29')](function(_0x304ab0){return _0x304ab0;});}return null;};}function removeEntity(_0x27b5e9,_0x42cd55){return function(_0x38c390){if(_0x38c390){return _0x38c390['destroy']()[_0x5c32('0x29')](function(){_0x27b5e9[_0x5c32('0x1c')](0xcc)[_0x5c32('0x1d')]();});}};}function handleEntityNotFound(_0x31fb10,_0x58444c){return function(_0x348547){if(!_0x348547){_0x31fb10['sendStatus'](0x194);}return _0x348547;};}function handleError(_0x1addc0,_0x5b9cd8){_0x5b9cd8=_0x5b9cd8||0x1f4;return function(_0x3741a5){logger[_0x5c32('0x2a')](_0x3741a5['stack']);if(_0x3741a5[_0x5c32('0x2b')]){delete _0x3741a5['name'];}_0x1addc0[_0x5c32('0x1c')](_0x5b9cd8)['send'](_0x3741a5);};}exports[_0x5c32('0x2c')]=function(_0x3f694e,_0xe6ddb0){var _0x55a3e1={},_0x164d2b={},_0x4812bc={'count':0x0,'rows':[]};var _0x4bc694=_['map'](db[_0x5c32('0x2d')][_0x5c32('0x2e')],function(_0x36bd78){return{'name':_0x36bd78[_0x5c32('0x2f')],'type':_0x36bd78[_0x5c32('0x30')][_0x5c32('0x31')]};});_0x164d2b[_0x5c32('0x32')]=_[_0x5c32('0x33')](_0x4bc694,_0x5c32('0x2b'));_0x164d2b[_0x5c32('0x34')]=_[_0x5c32('0x35')](_0x3f694e['query']);_0x164d2b['filters']=_[_0x5c32('0x36')](_0x164d2b[_0x5c32('0x32')],_0x164d2b[_0x5c32('0x34')]);_0x55a3e1[_0x5c32('0x37')]=_['intersection'](_0x164d2b['model'],qs[_0x5c32('0x38')](_0x3f694e[_0x5c32('0x34')][_0x5c32('0x38')]));_0x55a3e1['attributes']=_0x55a3e1[_0x5c32('0x37')][_0x5c32('0x39')]?_0x55a3e1[_0x5c32('0x37')]:_0x164d2b[_0x5c32('0x32')];if(!_0x3f694e[_0x5c32('0x34')][_0x5c32('0x3a')](_0x5c32('0x3b'))){_0x55a3e1[_0x5c32('0x20')]=qs['limit'](_0x3f694e[_0x5c32('0x34')][_0x5c32('0x20')]);_0x55a3e1['offset']=qs['offset'](_0x3f694e[_0x5c32('0x34')][_0x5c32('0x1e')]);}_0x55a3e1['order']=qs[_0x5c32('0x3c')](_0x3f694e[_0x5c32('0x34')][_0x5c32('0x3c')]);_0x55a3e1['where']=qs[_0x5c32('0x3d')](_[_0x5c32('0x3e')](_0x3f694e[_0x5c32('0x34')],_0x164d2b['filters']),_0x4bc694);if(_0x3f694e[_0x5c32('0x34')][_0x5c32('0x3f')]){_0x55a3e1[_0x5c32('0x40')]=_[_0x5c32('0x41')](_0x55a3e1[_0x5c32('0x40')],{'$or':_[_0x5c32('0x33')](_0x4bc694,function(_0x33d029){if(_0x33d029[_0x5c32('0x30')]!==_0x5c32('0x42')){var _0xbdb387={};_0xbdb387[_0x33d029[_0x5c32('0x2b')]]={'$like':'%'+_0x3f694e['query'][_0x5c32('0x3f')]+'%'};return _0xbdb387;}})});}_0x55a3e1=_[_0x5c32('0x41')]({},_0x55a3e1,_0x3f694e[_0x5c32('0x43')]);var _0x46662b={'where':_0x55a3e1[_0x5c32('0x40')]};return db['SmsApplication'][_0x5c32('0x21')](_0x46662b)[_0x5c32('0x29')](function(_0x10201b){_0x4812bc[_0x5c32('0x21')]=_0x10201b;if(_0x3f694e['query'][_0x5c32('0x44')]){_0x55a3e1['include']=[{'all':!![]}];}return db[_0x5c32('0x2d')][_0x5c32('0x45')](_0x55a3e1);})['then'](function(_0x1ae4d2){_0x4812bc[_0x5c32('0x46')]=_0x1ae4d2;return _0x4812bc;})[_0x5c32('0x29')](respondWithFilteredResult(_0xe6ddb0,_0x55a3e1))[_0x5c32('0x47')](handleError(_0xe6ddb0,null));};exports[_0x5c32('0x48')]=function(_0x5d6b43,_0x52f17c){var _0x4b6178={'raw':!![],'where':{'id':_0x5d6b43[_0x5c32('0x49')]['id']}},_0x544557={};_0x544557[_0x5c32('0x32')]=_['keys'](db[_0x5c32('0x2d')]['rawAttributes']);_0x544557[_0x5c32('0x34')]=_[_0x5c32('0x35')](_0x5d6b43[_0x5c32('0x34')]);_0x544557[_0x5c32('0x3d')]=_[_0x5c32('0x36')](_0x544557[_0x5c32('0x32')],_0x544557[_0x5c32('0x34')]);_0x4b6178[_0x5c32('0x37')]=_[_0x5c32('0x36')](_0x544557[_0x5c32('0x32')],qs[_0x5c32('0x38')](_0x5d6b43[_0x5c32('0x34')]['fields']));_0x4b6178[_0x5c32('0x37')]=_0x4b6178[_0x5c32('0x37')][_0x5c32('0x39')]?_0x4b6178[_0x5c32('0x37')]:_0x544557[_0x5c32('0x32')];if(_0x5d6b43[_0x5c32('0x34')][_0x5c32('0x44')]){_0x4b6178[_0x5c32('0x4a')]=[{'all':!![]}];}_0x4b6178=_[_0x5c32('0x41')]({},_0x4b6178,_0x5d6b43[_0x5c32('0x43')]);return db[_0x5c32('0x2d')][_0x5c32('0x4b')](_0x4b6178)[_0x5c32('0x29')](handleEntityNotFound(_0x52f17c,null))[_0x5c32('0x29')](respondWithResult(_0x52f17c,null))[_0x5c32('0x47')](handleError(_0x52f17c,null));};exports[_0x5c32('0x4c')]=function(_0x3ee02a,_0x4a985a){return db[_0x5c32('0x2d')]['create'](_0x3ee02a['body'],{})[_0x5c32('0x29')](respondWithResult(_0x4a985a,0xc9))[_0x5c32('0x47')](handleError(_0x4a985a,null));};exports[_0x5c32('0x28')]=function(_0x31f3cb,_0x57da75){if(_0x31f3cb[_0x5c32('0x4d')]['id']){delete _0x31f3cb['body']['id'];}return db[_0x5c32('0x2d')][_0x5c32('0x4b')]({'where':{'id':_0x31f3cb[_0x5c32('0x49')]['id']}})['then'](handleEntityNotFound(_0x57da75,null))[_0x5c32('0x29')](saveUpdates(_0x31f3cb[_0x5c32('0x4d')],null))[_0x5c32('0x29')](respondWithResult(_0x57da75,null))[_0x5c32('0x47')](handleError(_0x57da75,null));};exports['destroy']=function(_0xeb4394,_0x2c5587){return db[_0x5c32('0x2d')][_0x5c32('0x4b')]({'where':{'id':_0xeb4394['params']['id']}})[_0x5c32('0x29')](handleEntityNotFound(_0x2c5587,null))[_0x5c32('0x29')](removeEntity(_0x2c5587,null))[_0x5c32('0x47')](handleError(_0x2c5587,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5fa919f..b655f35 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 _0x5004=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x51db2a,_0x5e8422){var _0x1deeff=function(_0x130c95){while(--_0x130c95){_0x51db2a['push'](_0x51db2a['shift']());}};_0x1deeff(++_0x5e8422);}(_0x5004,0x84));var _0x4500=function(_0x562624,_0x37d74c){_0x562624=_0x562624-0x0;var _0x1b7fc9=_0x5004[_0x562624];return _0x1b7fc9;};'use strict';var _=require('lodash');var util=require(_0x4500('0x0'));var logger=require(_0x4500('0x1'))('api');var moment=require(_0x4500('0x2'));var BPromise=require(_0x4500('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4500('0x4'));var rimraf=require(_0x4500('0x5'));var config=require(_0x4500('0x6'));var attributes=require(_0x4500('0x7'));module[_0x4500('0x8')]=function(_0x5c2b28,_0x58fc69){return _0x5c2b28[_0x4500('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4500('0xa'),'collate':_0x4500('0xb')});}; \ No newline at end of file +var _0xf21c=['SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x21ce1e,_0xe69626){var _0x1662f3=function(_0x23a6d7){while(--_0x23a6d7){_0x21ce1e['push'](_0x21ce1e['shift']());}};_0x1662f3(++_0xe69626);}(_0xf21c,0x1b6));var _0xcf21=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xf21c[_0x54fe1c];return _0x460aaa;};'use strict';var _=require(_0xcf21('0x0'));var util=require(_0xcf21('0x1'));var logger=require(_0xcf21('0x2'))(_0xcf21('0x3'));var moment=require(_0xcf21('0x4'));var BPromise=require(_0xcf21('0x5'));var rp=require(_0xcf21('0x6'));var fs=require('fs');var path=require(_0xcf21('0x7'));var rimraf=require('rimraf');var config=require(_0xcf21('0x8'));var attributes=require(_0xcf21('0x9'));module[_0xcf21('0xa')]=function(_0x5928b8,_0x4e5268){return _0x5928b8[_0xcf21('0xb')](_0xcf21('0xc'),attributes,{'tableName':_0xcf21('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf21('0xe'),'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 9e63cbd..5e5a8ac 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 _0xf470=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x18c6de,_0x4a00fb){var _0x5a3a1b=function(_0x412d8f){while(--_0x412d8f){_0x18c6de['push'](_0x18c6de['shift']());}};_0x5a3a1b(++_0x4a00fb);}(_0xf470,0xfd));var _0x0f47=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xf470[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x0f47('0x0'));var util=require(_0x0f47('0x1'));var moment=require(_0x0f47('0x2'));var BPromise=require(_0x0f47('0x3'));var rs=require(_0x0f47('0x4'));var fs=require('fs');var Redis=require(_0x0f47('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f47('0x6'));var logger=require(_0x0f47('0x7'))('rpc');var config=require(_0x0f47('0x8'));var jayson=require(_0x0f47('0x9'));var client=jayson[_0x0f47('0xa')][_0x0f47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42c33a,_0x3c1886,_0x36f17c){return new BPromise(function(_0x4500be,_0x145344){return client[_0x0f47('0xc')](_0x42c33a,_0x36f17c)[_0x0f47('0xd')](function(_0x30d884){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x3c1886,_0x0f47('0x10'));logger[_0x0f47('0x11')](_0x0f47('0x12'),_0x3c1886,_0x0f47('0x10'),JSON[_0x0f47('0x13')](_0x30d884));if(_0x30d884['error']){if(_0x30d884[_0x0f47('0x14')][_0x0f47('0x15')]===0x1f4){logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x30d884[_0x0f47('0x14')]['message']);return _0x145344(_0x30d884['error'][_0x0f47('0x16')]);}logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x30d884[_0x0f47('0x14')][_0x0f47('0x16')]);return _0x4500be(_0x30d884['error'][_0x0f47('0x16')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x3c1886,_0x0f47('0x10'));_0x4500be(_0x30d884[_0x0f47('0x17')][_0x0f47('0x16')]);}})[_0x0f47('0x18')](function(_0x475754){logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x475754);_0x145344(_0x475754);});});} \ No newline at end of file +var _0x1410=['jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1410,0x130));var _0x0141=function(_0x796d82,_0x5c6ade){_0x796d82=_0x796d82-0x0;var _0x445e8a=_0x1410[_0x796d82];return _0x445e8a;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('SmsApplication,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5b75d67..e7763e3 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 _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x1f6467,_0x493d92){_0x1f6467=_0x1f6467-0x0;var _0x17eb27=_0x757a[_0x1f6467];return _0x17eb27;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4213,0x77));var _0x3421=function(_0x40a785,_0x3cf4f1){_0x40a785=_0x40a785-0x0;var _0x92b65f=_0x4213[_0x40a785];return _0x92b65f;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 38af45c..142ccef 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 _0x28b1=['BOOLEAN','sequelize','moment','exports','DATE','STRING','out'];(function(_0x2b74c2,_0x56bd48){var _0xefbe92=function(_0x1a6767){while(--_0x1a6767){_0x2b74c2['push'](_0x2b74c2['shift']());}};_0xefbe92(++_0x56bd48);}(_0x28b1,0x1d6));var _0x128b=function(_0x2965ba,_0x1f0210){_0x2965ba=_0x2965ba-0x0;var _0x2bef47=_0x28b1[_0x2965ba];return _0x2bef47;};'use strict';var Sequelize=require(_0x128b('0x0'));var moment=require(_0x128b('0x1'));module[_0x128b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x128b('0x3')]},'disposition':{'type':Sequelize[_0x128b('0x4')]},'secondDisposition':{'type':Sequelize[_0x128b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x128b('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x128b('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x128b('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x128b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x128b('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0be3=['BOOLEAN','DATE','STRING','ENUM','exports'];(function(_0x5a9fb9,_0xb126c4){var _0x110430=function(_0x5112a1){while(--_0x5112a1){_0x5a9fb9['push'](_0x5a9fb9['shift']());}};_0x110430(++_0xb126c4);}(_0x0be3,0x9a));var _0x30be=function(_0x735da9,_0x38b186){_0x735da9=_0x735da9-0x0;var _0x39160b=_0x0be3[_0x735da9];return _0x39160b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x30be('0x0')]={'closed':{'type':Sequelize[_0x30be('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x30be('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x30be('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x30be('0x3')]},'phone':{'type':Sequelize[_0x30be('0x3')]},'read1stAt':{'type':Sequelize[_0x30be('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x30be('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x30be('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x30be('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b9c367c..2f47bb6 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 _0x94b9=['attributes','length','includeAll','merge','options','find','create','body','describe','SmsMessage','addMessage','ids','omit','filters','intersection','hasOwnProperty','sort','where','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','server','files','transcript-%d-%s.zip','join','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','disposition','out','System','value','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','limit','undefined','count','set','json','update','destroy','then','end','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','user','catch','show','params','model','query','keys','fields'];(function(_0xf75919,_0x9e603){var _0x3fdea4=function(_0x275a72){while(--_0x275a72){_0xf75919['push'](_0xf75919['shift']());}};_0x3fdea4(++_0x9e603);}(_0x94b9,0x1ad));var _0x994b=function(_0x316ef0,_0x4a4f5e){_0x316ef0=_0x316ef0-0x0;var _0x35136b=_0x94b9[_0x316ef0];return _0x35136b;};'use strict';var rimraf=require(_0x994b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x994b('0x1'));var BPromise=require(_0x994b('0x2'));var util=require(_0x994b('0x3'));var path=require('path');var ejs=require(_0x994b('0x4'));var fs=require('fs');var _=require(_0x994b('0x5'));var Redis=require('ioredis');var interaction=require(_0x994b('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x994b('0x7'));var logger=require(_0x994b('0x8'))('api');var config=require(_0x994b('0x9'));var db=require(_0x994b('0xa'))['db'];config[_0x994b('0xb')]=_[_0x994b('0xc')](config[_0x994b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x994b('0xd'))(new Redis(config[_0x994b('0xb')]));require(_0x994b('0xe'))[_0x994b('0xf')](socket);function respondWithStatusCode(_0x16eb94,_0x19c5b1){_0x19c5b1=_0x19c5b1||0xcc;return function(_0x5859ac){if(_0x5859ac){return _0x16eb94[_0x994b('0x10')](_0x19c5b1);}return _0x16eb94[_0x994b('0x11')](_0x19c5b1)['end']();};}function respondWithResult(_0x1cf445,_0x57b39b){_0x57b39b=_0x57b39b||0xc8;return function(_0x1478a0){if(_0x1478a0){return _0x1cf445[_0x994b('0x11')](_0x57b39b)['json'](_0x1478a0);}};}function respondWithFilteredResult(_0x40fed3,_0x52e7d1){return function(_0x1a4f3a){if(_0x1a4f3a){var _0x284526=typeof _0x52e7d1[_0x994b('0x12')]==='undefined'&&typeof _0x52e7d1[_0x994b('0x13')]===_0x994b('0x14');var _0x229019=_0x1a4f3a['count'];var _0x509320=_0x284526?0x0:_0x52e7d1[_0x994b('0x12')];var _0x491f29=_0x284526?_0x1a4f3a[_0x994b('0x15')]:_0x52e7d1[_0x994b('0x12')]+_0x52e7d1[_0x994b('0x13')];var _0x219447;if(_0x491f29>=_0x229019){_0x491f29=_0x229019;_0x219447=0xc8;}else{_0x219447=0xce;}_0x40fed3[_0x994b('0x11')](_0x219447);return _0x40fed3[_0x994b('0x16')]('Content-Range',_0x509320+'-'+_0x491f29+'/'+_0x229019)[_0x994b('0x17')](_0x1a4f3a);}return null;};}function saveUpdates(_0x3717bf){return function(_0x246911){if(_0x246911){return _0x246911[_0x994b('0x18')](_0x3717bf)['then'](function(_0x32d1b8){return _0x32d1b8;});}return null;};}function removeEntity(_0x4c3217){return function(_0x89b77c){if(_0x89b77c){return _0x89b77c[_0x994b('0x19')]()[_0x994b('0x1a')](function(){_0x4c3217[_0x994b('0x11')](0xcc)[_0x994b('0x1b')]();});}};}function handleEntityNotFound(_0x428991){return function(_0x382504){if(!_0x382504){_0x428991[_0x994b('0x10')](0x194);}return _0x382504;};}function handleError(_0x595448,_0x26aa32){_0x26aa32=_0x26aa32||0x1f4;return function(_0x4f4e97){logger['error'](_0x4f4e97['stack']);if(_0x4f4e97['name']){delete _0x4f4e97[_0x994b('0x1c')];}_0x595448['status'](_0x26aa32)[_0x994b('0x1d')](_0x4f4e97);};}exports[_0x994b('0x1e')]=function(_0x371ee6,_0x7d92fc){var _0x70b834={};var _0x57b987=_[_0x994b('0x1f')](db[_0x994b('0x20')][_0x994b('0x21')],function(_0x2b2a69){return{'name':_0x2b2a69[_0x994b('0x22')],'type':_0x2b2a69[_0x994b('0x23')]['key']};});_0x70b834=qs[_0x994b('0x24')](_0x57b987,_0x371ee6);return interaction[_0x994b('0x25')](_0x994b('0x26'),_0x371ee6['query'],_0x371ee6[_0x994b('0x27')],_0x70b834,_0x57b987)[_0x994b('0x1a')](respondWithFilteredResult(_0x7d92fc,_0x70b834))[_0x994b('0x28')](handleError(_0x7d92fc,null));};exports[_0x994b('0x29')]=function(_0x4d93eb,_0x469cf9){var _0x54fb16={'raw':![],'where':{'id':_0x4d93eb[_0x994b('0x2a')]['id']}},_0x3f845e={};_0x3f845e[_0x994b('0x2b')]=_['keys'](db[_0x994b('0x20')][_0x994b('0x21')]);_0x3f845e[_0x994b('0x2c')]=_[_0x994b('0x2d')](_0x4d93eb[_0x994b('0x2c')]);_0x3f845e['filters']=_['intersection'](_0x3f845e[_0x994b('0x2b')],_0x3f845e['query']);_0x54fb16['attributes']=_['intersection'](_0x3f845e[_0x994b('0x2b')],qs['fields'](_0x4d93eb['query'][_0x994b('0x2e')]));_0x54fb16[_0x994b('0x2f')]=_0x54fb16[_0x994b('0x2f')][_0x994b('0x30')]?_0x54fb16[_0x994b('0x2f')]:_0x3f845e['model'];if(_0x4d93eb['query'][_0x994b('0x31')]){_0x54fb16['include']=[{'all':!![]}];}_0x54fb16=_[_0x994b('0x32')]({},_0x54fb16,_0x4d93eb[_0x994b('0x33')]);return db[_0x994b('0x20')][_0x994b('0x34')](_0x54fb16)['then'](handleEntityNotFound(_0x469cf9,null))[_0x994b('0x1a')](respondWithResult(_0x469cf9,null))[_0x994b('0x28')](handleError(_0x469cf9,null));};exports[_0x994b('0x35')]=function(_0x5bca2f,_0x244a94){return db[_0x994b('0x20')][_0x994b('0x35')](_0x5bca2f[_0x994b('0x36')],{})['then'](respondWithResult(_0x244a94,0xc9))[_0x994b('0x28')](handleError(_0x244a94,null));};exports[_0x994b('0x18')]=function(_0x4d6da9,_0x2efaf4){if(_0x4d6da9['body']['id']){delete _0x4d6da9[_0x994b('0x36')]['id'];}return db[_0x994b('0x20')][_0x994b('0x34')]({'where':{'id':_0x4d6da9[_0x994b('0x2a')]['id']}})[_0x994b('0x1a')](handleEntityNotFound(_0x2efaf4,null))['then'](saveUpdates(_0x4d6da9[_0x994b('0x36')],null))[_0x994b('0x1a')](respondWithResult(_0x2efaf4,null))['catch'](handleError(_0x2efaf4,null));};exports[_0x994b('0x19')]=function(_0x136723,_0x373ff5){return db[_0x994b('0x20')][_0x994b('0x34')]({'where':{'id':_0x136723[_0x994b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x373ff5,null))['then'](removeEntity(_0x373ff5,null))[_0x994b('0x28')](handleError(_0x373ff5,null));};exports[_0x994b('0x37')]=function(_0x9d0eeb,_0xf059f5){return db[_0x994b('0x20')]['describe']()['then'](respondWithResult(_0xf059f5,null))[_0x994b('0x28')](handleError(_0xf059f5,null));};exports['addMessage']=function(_0x3eadb4,_0x27f5f1){return db[_0x994b('0x38')][_0x994b('0x34')]({'where':{'id':_0x3eadb4[_0x994b('0x2a')]['id']}})[_0x994b('0x1a')](handleEntityNotFound(_0x27f5f1,null))['then'](function(_0x22810f){if(_0x22810f){return _0x22810f[_0x994b('0x39')](_0x3eadb4[_0x994b('0x36')][_0x994b('0x3a')],_[_0x994b('0x3b')](_0x3eadb4['body'],['ids','id'])||{});}})[_0x994b('0x1a')](respondWithResult(_0x27f5f1,null))[_0x994b('0x28')](handleError(_0x27f5f1,null));};exports['getMessages']=function(_0x53c2a7,_0x2715b1){var _0x530486={'raw':![],'where':{}};var _0x101136={};var _0x383d4e={'count':0x0,'rows':[]};return db[_0x994b('0x20')]['findOne']({'where':{'id':_0x53c2a7[_0x994b('0x2a')]['id']}})[_0x994b('0x1a')](handleEntityNotFound(_0x2715b1,null))[_0x994b('0x1a')](function(_0x2a5f4c){if(_0x2a5f4c){_0x101136['model']=_[_0x994b('0x2d')](db[_0x994b('0x38')][_0x994b('0x21')]);_0x101136[_0x994b('0x2c')]=_['keys'](_0x53c2a7[_0x994b('0x2c')]);_0x101136[_0x994b('0x3c')]=_[_0x994b('0x3d')](_0x101136[_0x994b('0x2b')],_0x101136[_0x994b('0x2c')]);_0x530486[_0x994b('0x2f')]=_[_0x994b('0x3d')](_0x101136[_0x994b('0x2b')],qs[_0x994b('0x2e')](_0x53c2a7[_0x994b('0x2c')][_0x994b('0x2e')]));_0x530486[_0x994b('0x2f')]=_0x530486[_0x994b('0x2f')][_0x994b('0x30')]?_0x530486[_0x994b('0x2f')]:_0x101136[_0x994b('0x2b')];if(!_0x53c2a7[_0x994b('0x2c')][_0x994b('0x3e')]('nolimit')){_0x530486[_0x994b('0x13')]=qs[_0x994b('0x13')](_0x53c2a7['query'][_0x994b('0x13')]);_0x530486[_0x994b('0x12')]=qs[_0x994b('0x12')](_0x53c2a7['query'][_0x994b('0x12')]);}_0x530486['order']=qs[_0x994b('0x3f')](_0x53c2a7[_0x994b('0x2c')][_0x994b('0x3f')]);_0x530486[_0x994b('0x40')]=qs[_0x994b('0x3c')](_[_0x994b('0x41')](_0x53c2a7[_0x994b('0x2c')],_0x101136[_0x994b('0x3c')]));_0x530486[_0x994b('0x40')][_0x994b('0x42')]=_0x2a5f4c['id'];if(_0x53c2a7[_0x994b('0x2c')]['filter']){_0x530486[_0x994b('0x40')]=_[_0x994b('0x32')](_0x530486[_0x994b('0x40')],{'$or':_[_0x994b('0x1f')](_0x530486[_0x994b('0x2f')],function(_0x552f00){var _0x3df1ff={};_0x3df1ff[_0x552f00]={'$like':'%'+_0x53c2a7[_0x994b('0x2c')][_0x994b('0x43')]+'%'};return _0x3df1ff;})});}if(_0x53c2a7[_0x994b('0x2c')][_0x994b('0x44')]){var _0x18ac9c=_0x53c2a7[_0x994b('0x2c')][_0x994b('0x44')]['split'](',');var _0x377c7c={};_0x377c7c[_0x18ac9c[0x0]]={'$gte':moment(_0x18ac9c[0x1])[_0x994b('0x45')](_0x994b('0x46'))};_0x530486[_0x994b('0x40')]=_[_0x994b('0x32')](_0x530486['where'],_0x377c7c);}_0x530486=_[_0x994b('0x32')]({},_0x530486,_0x53c2a7['options']);return db['SmsMessage'][_0x994b('0x15')]({'where':_0x530486[_0x994b('0x40')]})[_0x994b('0x1a')](function(_0x96c4f3){_0x383d4e['count']=_0x96c4f3;if(_0x53c2a7[_0x994b('0x2c')][_0x994b('0x31')]){_0x530486[_0x994b('0x47')]=[{'all':!![]}];}return db[_0x994b('0x38')][_0x994b('0x25')](_0x530486);})[_0x994b('0x1a')](function(_0x2da23c){_0x383d4e[_0x994b('0x48')]=_0x2da23c;return _0x383d4e;});}})[_0x994b('0x1a')](respondWithFilteredResult(_0x2715b1,_0x530486))[_0x994b('0x28')](handleError(_0x2715b1,null));};exports['addTags']=function(_0x1d3402,_0xc901a0){return db[_0x994b('0x20')][_0x994b('0x34')]({'where':{'id':_0x1d3402[_0x994b('0x2a')]['id']}})['then'](handleEntityNotFound(_0xc901a0,null))[_0x994b('0x1a')](function(_0xaa67a4){if(_0xaa67a4){return _0xaa67a4[_0x994b('0x49')](_0x1d3402[_0x994b('0x36')]['ids'],_[_0x994b('0x3b')](_0x1d3402[_0x994b('0x36')],[_0x994b('0x3a'),'id'])||{})[_0x994b('0x4a')](function(){return db[_0x994b('0x4b')][_0x994b('0x25')]({'attributes':['id',_0x994b('0x1c'),_0x994b('0x4c')],'where':{'id':_0x1d3402['body'][_0x994b('0x3a')]}});})['then'](function(_0x1c9e93){socket['emit'](_0x994b('0x4d'),{'id':Number(_0x1d3402['params']['id']),'tags':_0x1c9e93||[]});return{'id':Number(_0x1d3402[_0x994b('0x2a')]['id']),'tags':_0x1c9e93||[]};});}})['then'](respondWithResult(_0xc901a0,null))[_0x994b('0x28')](handleError(_0xc901a0,null));};exports['removeTags']=function(_0x54156c,_0x3dbbe2){return db[_0x994b('0x20')][_0x994b('0x34')]({'where':{'id':_0x54156c[_0x994b('0x2a')]['id']}})[_0x994b('0x1a')](handleEntityNotFound(_0x3dbbe2,null))[_0x994b('0x1a')](function(_0x21fa9a){if(_0x21fa9a){return _0x21fa9a[_0x994b('0x4e')](_0x54156c[_0x994b('0x2c')][_0x994b('0x3a')]);}})[_0x994b('0x1a')](respondWithStatusCode(_0x3dbbe2,null))[_0x994b('0x28')](handleError(_0x3dbbe2,null));};exports[_0x994b('0x4f')]=function(_0x49df4f,_0x11e1a6){var _0x3203b3=moment()[_0x994b('0x50')]()[_0x994b('0x51')]();var _0x29bab7=path['join'](config['root'],_0x994b('0x52'),_0x994b('0x53'),'tmp');var _0x353958=path['join'](_0x29bab7,_0x3203b3);var _0x563fed=util['format'](_0x994b('0x54'),_0x49df4f[_0x994b('0x2a')]['id'],_0x3203b3);var _0x55a2c6=path[_0x994b('0x55')](_0x29bab7,_0x563fed);var _0x389e69=[];_0x389e69[_0x994b('0x56')]({'model':db[_0x994b('0x57')],'as':_0x994b('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x389e69[_0x994b('0x56')]({'model':db[_0x994b('0x58')],'as':_0x994b('0x59'),'attributes':['id',_0x994b('0x5a'),_0x994b('0x5b')],'raw':!![]});var _0x835630=[{'model':db[_0x994b('0x38')],'as':_0x994b('0x5c'),'attributes':['id',_0x994b('0x36'),_0x994b('0x5d'),_0x994b('0x5e'),_0x994b('0x5f'),_0x994b('0x60')],'include':_0x389e69}];_0x835630['push']({'model':db[_0x994b('0x61')],'as':_0x994b('0x62'),'attributes':['id','name']});_0x835630['push']({'model':db[_0x994b('0x57')],'as':'Owner','attributes':['id',_0x994b('0x63')]});return db[_0x994b('0x20')][_0x994b('0x34')]({'where':{'id':_0x49df4f[_0x994b('0x2a')]['id']},'include':_0x835630})['then'](handleEntityNotFound(_0x11e1a6,null))[_0x994b('0x1a')](function(_0x577ea6){if(_0x577ea6){var _0x2cf80f=_0x577ea6[_0x994b('0x64')]({'plain':!![]});fs[_0x994b('0x65')](_0x353958);var _0x5414c5={'channel':_0x994b('0x66'),'account':_0x2cf80f[_0x994b('0x62')][_0x994b('0x1c')],'agent':_0x2cf80f[_0x994b('0x67')]?_0x2cf80f[_0x994b('0x67')]['fullname']:_0x994b('0x68'),'createdAt':moment(_0x2cf80f['createdAt'])[_0x994b('0x45')](_0x994b('0x46'))[_0x994b('0x51')](),'closedAt':_0x2cf80f[_0x994b('0x69')]?moment(_0x2cf80f[_0x994b('0x6a')])[_0x994b('0x45')](_0x994b('0x46'))['toString']():'','disposition':_0x2cf80f[_0x994b('0x6b')],'messages':_(_0x2cf80f[_0x994b('0x5c')])[_0x994b('0x43')]({'secret':![]})['map'](function(_0x594015){return{'date':moment(_0x594015['createdAt'])[_0x994b('0x45')](_0x994b('0x46'))['toString'](),'sender':_0x594015['direction']===_0x994b('0x6c')?_0x594015[_0x994b('0x57')]?_0x594015[_0x994b('0x57')][_0x994b('0x63')]:_0x994b('0x6d'):_0x594015[_0x994b('0x59')][_0x994b('0x5a')]+(_0x594015[_0x994b('0x59')]['lastName']?'\x20'+_0x594015[_0x994b('0x59')][_0x994b('0x5b')]:''),'body':_0x594015[_0x994b('0x36')],'direction':_0x594015[_0x994b('0x5e')]==='out'?'A':'C','secret':_0x594015['secret'],'read':_0x594015[_0x994b('0x60')]};})[_0x994b('0x6e')]()};return ejs[_0x994b('0x6f')](path[_0x994b('0x55')](config[_0x994b('0x70')],_0x994b('0x52'),_0x994b('0x71'),_0x994b('0x72')),{'interaction':_0x5414c5})['then'](function(_0x5ae03f){var _0x427c7e=path['join'](_0x353958,'transcript-'+_0x2cf80f['id']+'-'+_0x3203b3+_0x994b('0x73'));var _0x26a727={'path':_0x427c7e,'channel':_0x994b('0x66'),'interactionId':_0x2cf80f['id']};return pdf[_0x994b('0x74')](_0x5ae03f,_0x26a727);})[_0x994b('0x1a')](function(){return new BPromise(function(_0xaef85c,_0x151b3a){zipdir(_0x353958,{'saveTo':_0x55a2c6},function(_0x242f61,_0x446b96){if(_0x242f61)return _0x151b3a(_0x242f61);return _0xaef85c(_0x446b96);});})[_0x994b('0x1a')](function(){return new BPromise(function(_0x1af155,_0x11b0ae){rimraf(_0x353958,function(_0x56c5d0){if(_0x56c5d0)_0x11b0ae(_0x56c5d0);return _0x1af155();});});})[_0x994b('0x1a')](function(){return _0x11e1a6['download'](_0x55a2c6,_0x563fed,function(_0x592a1b){if(_0x592a1b){console[_0x994b('0x75')](_0x994b('0x76'),_0x592a1b);}else{fs['unlinkSync'](_0x55a2c6);}});});});}else{return _0x11e1a6[_0x994b('0x10')](0xc8);}})['catch'](handleError(_0x11e1a6,null));}; \ No newline at end of file +var _0x861d=['path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','offset','limit','undefined','count','set','json','update','then','end','error','name','send','type','key','getOptions','findAll','sms','query','user','params','keys','SmsInteraction','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','catch','create','body','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','map','$gte','split','merge','addTags','spread','color','emit','removeTags','download','toString','join','root','files','tmp','format','push','User','Contact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','fullname','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','value','server','views','downloadInteraction.ejs','.pdf','Sms','log','err','unlinkSync','zip-dir','moment','util'];(function(_0x5c0e58,_0x2bebae){var _0x3c3d85=function(_0x5b731b){while(--_0x5b731b){_0x5c0e58['push'](_0x5c0e58['shift']());}};_0x3c3d85(++_0x2bebae);}(_0x861d,0x159));var _0xd861=function(_0x38382f,_0x51183d){_0x38382f=_0x38382f-0x0;var _0x152e8b=_0x861d[_0x38382f];return _0x152e8b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd861('0x0'));var moment=require(_0xd861('0x1'));var BPromise=require('bluebird');var util=require(_0xd861('0x2'));var path=require(_0xd861('0x3'));var ejs=require(_0xd861('0x4'));var fs=require('fs');var _=require(_0xd861('0x5'));var Redis=require(_0xd861('0x6'));var interaction=require(_0xd861('0x7'));var qs=require(_0xd861('0x8'));var pdf=require(_0xd861('0x9'));var logger=require(_0xd861('0xa'))(_0xd861('0xb'));var config=require(_0xd861('0xc'));var db=require(_0xd861('0xd'))['db'];config[_0xd861('0xe')]=_[_0xd861('0xf')](config[_0xd861('0xe')],{'host':_0xd861('0x10'),'port':0x18eb});var socket=require(_0xd861('0x11'))(new Redis(config[_0xd861('0xe')]));require(_0xd861('0x12'))['register'](socket);function respondWithStatusCode(_0x373905,_0x31144e){_0x31144e=_0x31144e||0xcc;return function(_0x263902){if(_0x263902){return _0x373905[_0xd861('0x13')](_0x31144e);}return _0x373905[_0xd861('0x14')](_0x31144e)['end']();};}function respondWithResult(_0xb4834e,_0xe06bf2){_0xe06bf2=_0xe06bf2||0xc8;return function(_0x3e00ef){if(_0x3e00ef){return _0xb4834e[_0xd861('0x14')](_0xe06bf2)['json'](_0x3e00ef);}};}function respondWithFilteredResult(_0x50223f,_0x3531fd){return function(_0x7ed574){if(_0x7ed574){var _0x1314d6=typeof _0x3531fd[_0xd861('0x15')]==='undefined'&&typeof _0x3531fd[_0xd861('0x16')]===_0xd861('0x17');var _0x152c92=_0x7ed574[_0xd861('0x18')];var _0x3dd8bd=_0x1314d6?0x0:_0x3531fd[_0xd861('0x15')];var _0x3a54e1=_0x1314d6?_0x7ed574[_0xd861('0x18')]:_0x3531fd[_0xd861('0x15')]+_0x3531fd[_0xd861('0x16')];var _0x2e346f;if(_0x3a54e1>=_0x152c92){_0x3a54e1=_0x152c92;_0x2e346f=0xc8;}else{_0x2e346f=0xce;}_0x50223f[_0xd861('0x14')](_0x2e346f);return _0x50223f[_0xd861('0x19')]('Content-Range',_0x3dd8bd+'-'+_0x3a54e1+'/'+_0x152c92)[_0xd861('0x1a')](_0x7ed574);}return null;};}function saveUpdates(_0x34cfd0){return function(_0xdf1e5){if(_0xdf1e5){return _0xdf1e5[_0xd861('0x1b')](_0x34cfd0)[_0xd861('0x1c')](function(_0x25b62c){return _0x25b62c;});}return null;};}function removeEntity(_0x441c40){return function(_0x2066ed){if(_0x2066ed){return _0x2066ed['destroy']()[_0xd861('0x1c')](function(){_0x441c40[_0xd861('0x14')](0xcc)[_0xd861('0x1d')]();});}};}function handleEntityNotFound(_0x527c1c){return function(_0x147238){if(!_0x147238){_0x527c1c[_0xd861('0x13')](0x194);}return _0x147238;};}function handleError(_0x5f8d4,_0x4aa91f){_0x4aa91f=_0x4aa91f||0x1f4;return function(_0x29ff9e){logger[_0xd861('0x1e')](_0x29ff9e['stack']);if(_0x29ff9e[_0xd861('0x1f')]){delete _0x29ff9e[_0xd861('0x1f')];}_0x5f8d4[_0xd861('0x14')](_0x4aa91f)[_0xd861('0x20')](_0x29ff9e);};}exports['index']=function(_0x551595,_0x4277c0){var _0x258eab={};var _0x466205=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x5d720c){return{'name':_0x5d720c['fieldName'],'type':_0x5d720c[_0xd861('0x21')][_0xd861('0x22')]};});_0x258eab=qs[_0xd861('0x23')](_0x466205,_0x551595);return interaction[_0xd861('0x24')](_0xd861('0x25'),_0x551595[_0xd861('0x26')],_0x551595[_0xd861('0x27')],_0x258eab,_0x466205)[_0xd861('0x1c')](respondWithFilteredResult(_0x4277c0,_0x258eab))['catch'](handleError(_0x4277c0,null));};exports['show']=function(_0x45d49f,_0x34f4a1){var _0x993407={'raw':![],'where':{'id':_0x45d49f[_0xd861('0x28')]['id']}},_0x2c35b7={};_0x2c35b7['model']=_[_0xd861('0x29')](db[_0xd861('0x2a')][_0xd861('0x2b')]);_0x2c35b7[_0xd861('0x26')]=_['keys'](_0x45d49f[_0xd861('0x26')]);_0x2c35b7[_0xd861('0x2c')]=_[_0xd861('0x2d')](_0x2c35b7[_0xd861('0x2e')],_0x2c35b7[_0xd861('0x26')]);_0x993407[_0xd861('0x2f')]=_[_0xd861('0x2d')](_0x2c35b7['model'],qs['fields'](_0x45d49f[_0xd861('0x26')][_0xd861('0x30')]));_0x993407[_0xd861('0x2f')]=_0x993407['attributes'][_0xd861('0x31')]?_0x993407['attributes']:_0x2c35b7['model'];if(_0x45d49f[_0xd861('0x26')][_0xd861('0x32')]){_0x993407[_0xd861('0x33')]=[{'all':!![]}];}_0x993407=_['merge']({},_0x993407,_0x45d49f[_0xd861('0x34')]);return db[_0xd861('0x2a')][_0xd861('0x35')](_0x993407)['then'](handleEntityNotFound(_0x34f4a1,null))[_0xd861('0x1c')](respondWithResult(_0x34f4a1,null))[_0xd861('0x36')](handleError(_0x34f4a1,null));};exports[_0xd861('0x37')]=function(_0x126ef8,_0x567ec5){return db[_0xd861('0x2a')]['create'](_0x126ef8[_0xd861('0x38')],{})[_0xd861('0x1c')](respondWithResult(_0x567ec5,0xc9))[_0xd861('0x36')](handleError(_0x567ec5,null));};exports[_0xd861('0x1b')]=function(_0x3ce4b9,_0x556c71){if(_0x3ce4b9[_0xd861('0x38')]['id']){delete _0x3ce4b9[_0xd861('0x38')]['id'];}return db[_0xd861('0x2a')][_0xd861('0x35')]({'where':{'id':_0x3ce4b9[_0xd861('0x28')]['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0x556c71,null))[_0xd861('0x1c')](saveUpdates(_0x3ce4b9[_0xd861('0x38')],null))[_0xd861('0x1c')](respondWithResult(_0x556c71,null))['catch'](handleError(_0x556c71,null));};exports[_0xd861('0x39')]=function(_0x22f30a,_0xb903e8){return db[_0xd861('0x2a')][_0xd861('0x35')]({'where':{'id':_0x22f30a[_0xd861('0x28')]['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0xb903e8,null))[_0xd861('0x1c')](removeEntity(_0xb903e8,null))[_0xd861('0x36')](handleError(_0xb903e8,null));};exports['describe']=function(_0x3e6f6c,_0x590148){return db[_0xd861('0x2a')][_0xd861('0x3a')]()[_0xd861('0x1c')](respondWithResult(_0x590148,null))['catch'](handleError(_0x590148,null));};exports[_0xd861('0x3b')]=function(_0xb3346a,_0xfe5aa7){return db[_0xd861('0x3c')][_0xd861('0x35')]({'where':{'id':_0xb3346a[_0xd861('0x28')]['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0xfe5aa7,null))['then'](function(_0x39a19d){if(_0x39a19d){return _0x39a19d['addMessage'](_0xb3346a['body'][_0xd861('0x3d')],_[_0xd861('0x3e')](_0xb3346a['body'],[_0xd861('0x3d'),'id'])||{});}})[_0xd861('0x1c')](respondWithResult(_0xfe5aa7,null))[_0xd861('0x36')](handleError(_0xfe5aa7,null));};exports['getMessages']=function(_0x3413a1,_0x790876){var _0x4ec0ec={'raw':![],'where':{}};var _0x55696b={};var _0x46d410={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xd861('0x3f')]({'where':{'id':_0x3413a1[_0xd861('0x28')]['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0x790876,null))[_0xd861('0x1c')](function(_0x4da0e2){if(_0x4da0e2){_0x55696b[_0xd861('0x2e')]=_[_0xd861('0x29')](db[_0xd861('0x3c')]['rawAttributes']);_0x55696b[_0xd861('0x26')]=_[_0xd861('0x29')](_0x3413a1[_0xd861('0x26')]);_0x55696b[_0xd861('0x2c')]=_[_0xd861('0x2d')](_0x55696b['model'],_0x55696b[_0xd861('0x26')]);_0x4ec0ec[_0xd861('0x2f')]=_[_0xd861('0x2d')](_0x55696b['model'],qs[_0xd861('0x30')](_0x3413a1[_0xd861('0x26')][_0xd861('0x30')]));_0x4ec0ec[_0xd861('0x2f')]=_0x4ec0ec['attributes'][_0xd861('0x31')]?_0x4ec0ec[_0xd861('0x2f')]:_0x55696b[_0xd861('0x2e')];if(!_0x3413a1[_0xd861('0x26')][_0xd861('0x40')]('nolimit')){_0x4ec0ec[_0xd861('0x16')]=qs[_0xd861('0x16')](_0x3413a1[_0xd861('0x26')][_0xd861('0x16')]);_0x4ec0ec['offset']=qs[_0xd861('0x15')](_0x3413a1['query'][_0xd861('0x15')]);}_0x4ec0ec[_0xd861('0x41')]=qs[_0xd861('0x42')](_0x3413a1[_0xd861('0x26')][_0xd861('0x42')]);_0x4ec0ec[_0xd861('0x43')]=qs[_0xd861('0x2c')](_[_0xd861('0x44')](_0x3413a1['query'],_0x55696b[_0xd861('0x2c')]));_0x4ec0ec[_0xd861('0x43')][_0xd861('0x45')]=_0x4da0e2['id'];if(_0x3413a1[_0xd861('0x26')][_0xd861('0x46')]){_0x4ec0ec[_0xd861('0x43')]=_['merge'](_0x4ec0ec[_0xd861('0x43')],{'$or':_[_0xd861('0x47')](_0x4ec0ec[_0xd861('0x2f')],function(_0x1b9a36){var _0x88a635={};_0x88a635[_0x1b9a36]={'$like':'%'+_0x3413a1[_0xd861('0x26')][_0xd861('0x46')]+'%'};return _0x88a635;})});}if(_0x3413a1[_0xd861('0x26')][_0xd861('0x48')]){var _0x102ad9=_0x3413a1['query'][_0xd861('0x48')][_0xd861('0x49')](',');var _0x5330e8={};_0x5330e8[_0x102ad9[0x0]]={'$gte':moment(_0x102ad9[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4ec0ec[_0xd861('0x43')]=_[_0xd861('0x4a')](_0x4ec0ec[_0xd861('0x43')],_0x5330e8);}_0x4ec0ec=_[_0xd861('0x4a')]({},_0x4ec0ec,_0x3413a1[_0xd861('0x34')]);return db[_0xd861('0x3c')][_0xd861('0x18')]({'where':_0x4ec0ec[_0xd861('0x43')]})[_0xd861('0x1c')](function(_0x3aee72){_0x46d410[_0xd861('0x18')]=_0x3aee72;if(_0x3413a1[_0xd861('0x26')][_0xd861('0x32')]){_0x4ec0ec[_0xd861('0x33')]=[{'all':!![]}];}return db[_0xd861('0x3c')][_0xd861('0x24')](_0x4ec0ec);})['then'](function(_0x4303dc){_0x46d410['rows']=_0x4303dc;return _0x46d410;});}})[_0xd861('0x1c')](respondWithFilteredResult(_0x790876,_0x4ec0ec))['catch'](handleError(_0x790876,null));};exports[_0xd861('0x4b')]=function(_0x426a4a,_0x1478c7){return db[_0xd861('0x2a')][_0xd861('0x35')]({'where':{'id':_0x426a4a[_0xd861('0x28')]['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0x1478c7,null))[_0xd861('0x1c')](function(_0x5d4944){if(_0x5d4944){return _0x5d4944['setTags'](_0x426a4a[_0xd861('0x38')][_0xd861('0x3d')],_['omit'](_0x426a4a[_0xd861('0x38')],[_0xd861('0x3d'),'id'])||{})[_0xd861('0x4c')](function(){return db['Tag'][_0xd861('0x24')]({'attributes':['id',_0xd861('0x1f'),_0xd861('0x4d')],'where':{'id':_0x426a4a['body'][_0xd861('0x3d')]}});})[_0xd861('0x1c')](function(_0x1a70c6){socket[_0xd861('0x4e')]('smsInteractionTags:save',{'id':Number(_0x426a4a['params']['id']),'tags':_0x1a70c6||[]});return{'id':Number(_0x426a4a['params']['id']),'tags':_0x1a70c6||[]};});}})['then'](respondWithResult(_0x1478c7,null))[_0xd861('0x36')](handleError(_0x1478c7,null));};exports['removeTags']=function(_0x352890,_0xfe0e22){return db['SmsInteraction']['find']({'where':{'id':_0x352890['params']['id']}})[_0xd861('0x1c')](handleEntityNotFound(_0xfe0e22,null))[_0xd861('0x1c')](function(_0x427adc){if(_0x427adc){return _0x427adc[_0xd861('0x4f')](_0x352890['query'][_0xd861('0x3d')]);}})[_0xd861('0x1c')](respondWithStatusCode(_0xfe0e22,null))['catch'](handleError(_0xfe0e22,null));};exports[_0xd861('0x50')]=function(_0x18631c,_0x549e4f){var _0xfc454a=moment()['unix']()[_0xd861('0x51')]();var _0x19adfa=path[_0xd861('0x52')](config[_0xd861('0x53')],'server',_0xd861('0x54'),_0xd861('0x55'));var _0x379457=path[_0xd861('0x52')](_0x19adfa,_0xfc454a);var _0x5c5a13=util[_0xd861('0x56')]('transcript-%d-%s.zip',_0x18631c[_0xd861('0x28')]['id'],_0xfc454a);var _0x1935b4=path[_0xd861('0x52')](_0x19adfa,_0x5c5a13);var _0x3f59f5=[];_0x3f59f5[_0xd861('0x57')]({'model':db['User'],'as':_0xd861('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x3f59f5['push']({'model':db['CmContact'],'as':_0xd861('0x59'),'attributes':['id',_0xd861('0x5a'),_0xd861('0x5b')],'raw':!![]});var _0x37e258=[{'model':db[_0xd861('0x3c')],'as':_0xd861('0x5c'),'attributes':['id','body',_0xd861('0x5d'),_0xd861('0x5e'),_0xd861('0x5f'),'read'],'include':_0x3f59f5}];_0x37e258['push']({'model':db[_0xd861('0x60')],'as':_0xd861('0x61'),'attributes':['id',_0xd861('0x1f')]});_0x37e258[_0xd861('0x57')]({'model':db['User'],'as':_0xd861('0x62'),'attributes':['id',_0xd861('0x63')]});return db[_0xd861('0x2a')][_0xd861('0x35')]({'where':{'id':_0x18631c[_0xd861('0x28')]['id']},'include':_0x37e258})['then'](handleEntityNotFound(_0x549e4f,null))[_0xd861('0x1c')](function(_0xf1424e){if(_0xf1424e){var _0x462e3e=_0xf1424e['get']({'plain':!![]});fs[_0xd861('0x64')](_0x379457);var _0x5dda80={'channel':'Sms','account':_0x462e3e[_0xd861('0x61')]['name'],'agent':_0x462e3e[_0xd861('0x62')]?_0x462e3e[_0xd861('0x62')]['fullname']:_0xd861('0x65'),'createdAt':moment(_0x462e3e[_0xd861('0x5d')])[_0xd861('0x56')](_0xd861('0x66'))[_0xd861('0x51')](),'closedAt':_0x462e3e['closed']?moment(_0x462e3e[_0xd861('0x67')])[_0xd861('0x56')](_0xd861('0x66'))[_0xd861('0x51')]():'','disposition':_0x462e3e[_0xd861('0x68')],'messages':_(_0x462e3e[_0xd861('0x5c')])[_0xd861('0x46')]({'secret':![]})[_0xd861('0x47')](function(_0x3f72cf){return{'date':moment(_0x3f72cf[_0xd861('0x5d')])[_0xd861('0x56')](_0xd861('0x66'))[_0xd861('0x51')](),'sender':_0x3f72cf[_0xd861('0x5e')]===_0xd861('0x69')?_0x3f72cf[_0xd861('0x58')]?_0x3f72cf[_0xd861('0x58')][_0xd861('0x63')]:_0xd861('0x6a'):_0x3f72cf[_0xd861('0x59')][_0xd861('0x5a')]+(_0x3f72cf[_0xd861('0x59')][_0xd861('0x5b')]?'\x20'+_0x3f72cf['Contact'][_0xd861('0x5b')]:''),'body':_0x3f72cf[_0xd861('0x38')],'direction':_0x3f72cf[_0xd861('0x5e')]===_0xd861('0x69')?'A':'C','secret':_0x3f72cf[_0xd861('0x5f')],'read':_0x3f72cf['read']};})[_0xd861('0x6b')]()};return ejs['renderFile'](path[_0xd861('0x52')](config[_0xd861('0x53')],_0xd861('0x6c'),_0xd861('0x6d'),_0xd861('0x6e')),{'interaction':_0x5dda80})['then'](function(_0x49b006){var _0xa7688b=path[_0xd861('0x52')](_0x379457,'transcript-'+_0x462e3e['id']+'-'+_0xfc454a+_0xd861('0x6f'));var _0x5a2382={'path':_0xa7688b,'channel':_0xd861('0x70'),'interactionId':_0x462e3e['id']};return pdf['createPdfFromHTML'](_0x49b006,_0x5a2382);})[_0xd861('0x1c')](function(){return new BPromise(function(_0x475c2a,_0x2f663c){zipdir(_0x379457,{'saveTo':_0x1935b4},function(_0x1e3ba7,_0x34634d){if(_0x1e3ba7)return _0x2f663c(_0x1e3ba7);return _0x475c2a(_0x34634d);});})[_0xd861('0x1c')](function(){return new BPromise(function(_0x242900,_0x32ecd4){rimraf(_0x379457,function(_0x25130e){if(_0x25130e)_0x32ecd4(_0x25130e);return _0x242900();});});})[_0xd861('0x1c')](function(){return _0x549e4f[_0xd861('0x50')](_0x1935b4,_0x5c5a13,function(_0x1f6105){if(_0x1f6105){console[_0xd861('0x71')](_0xd861('0x72'),_0x1f6105);}else{fs[_0xd861('0x73')](_0x1935b4);}});});});}else{return _0x549e4f[_0xd861('0x13')](0xc8);}})[_0xd861('0x36')](handleError(_0x549e4f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 49c172e..cc2c2ab 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 _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x3ca14f,_0x1ba8d3){var _0x44772a=function(_0x314da0){while(--_0x314da0){_0x3ca14f['push'](_0x3ca14f['shift']());}};_0x44772a(++_0x1ba8d3);}(_0x1893,0xa2));var _0x3189=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0x1893[_0x42e495];return _0x595da1;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x2edbcd,_0x1d75af){var _0x4cec3e=function(_0xbc6dc2){while(--_0xbc6dc2){_0x2edbcd['push'](_0x2edbcd['shift']());}};_0x4cec3e(++_0x1d75af);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x35bf67,_0x8f7f9c){_0x35bf67=_0x35bf67-0x0;var _0x2401dd=_0xdd4f[_0x35bf67];return _0x2401dd;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b4abdfb..2a6357c 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 _0x6cfd=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','request-promise','path'];(function(_0x4f48f8,_0x43f757){var _0x13aadd=function(_0x2a7269){while(--_0x2a7269){_0x4f48f8['push'](_0x4f48f8['shift']());}};_0x13aadd(++_0x43f757);}(_0x6cfd,0xf8));var _0xd6cf=function(_0x20b08a,_0x3865e5){_0x20b08a=_0x20b08a-0x0;var _0x5ce0f5=_0x6cfd[_0x20b08a];return _0x5ce0f5;};'use strict';var _=require('lodash');var util=require(_0xd6cf('0x0'));var logger=require(_0xd6cf('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd6cf('0x2'));var fs=require('fs');var path=require(_0xd6cf('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6cf('0x4'));module[_0xd6cf('0x5')]=function(_0x2c9934,_0x322fe2){return _0x2c9934[_0xd6cf('0x6')](_0xd6cf('0x7'),attributes,{'tableName':_0xd6cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5cec3f,_0x3c9a3d,_0x185cfd){if(_0x5cec3f[_0xd6cf('0x9')]('closed')){_0x5cec3f['closedAt']=moment()[_0xd6cf('0xa')](_0xd6cf('0xb'));}_0x185cfd(null,_0x5cec3f);}}});}; \ No newline at end of file +var _0xfa3a=['path','rimraf','./smsInteraction.attributes','exports','define','changed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b5436,_0x6471ec){var _0x35c158=function(_0x1421cb){while(--_0x1421cb){_0x5b5436['push'](_0x5b5436['shift']());}};_0x35c158(++_0x6471ec);}(_0xfa3a,0x80));var _0xafa3=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0xfa3a[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0xafa3('0x0'));var util=require(_0xafa3('0x1'));var logger=require(_0xafa3('0x2'))(_0xafa3('0x3'));var moment=require(_0xafa3('0x4'));var BPromise=require(_0xafa3('0x5'));var rp=require(_0xafa3('0x6'));var fs=require('fs');var path=require(_0xafa3('0x7'));var rimraf=require(_0xafa3('0x8'));var config=require('../../config/environment');var attributes=require(_0xafa3('0x9'));module[_0xafa3('0xa')]=function(_0x40585c,_0x22ccb1){return _0x40585c[_0xafa3('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23804b,_0xb44943,_0x30f8a0){if(_0x23804b[_0xafa3('0xc')]('closed')){_0x23804b[_0xafa3('0xd')]=moment()[_0xafa3('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x30f8a0(null,_0x23804b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 240e5bd..f1415ea 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 _0x99d7=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','limit','debug','AddTagsToSmsInteraction','find','where','ids','omit','spread','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsInteraction.socket','register','then'];(function(_0xace71e,_0x53a9ed){var _0x3ee4df=function(_0x4decbd){while(--_0x4decbd){_0xace71e['push'](_0xace71e['shift']());}};_0x3ee4df(++_0x53a9ed);}(_0x99d7,0x129));var _0x799d=function(_0x2386ab,_0x58fe47){_0x2386ab=_0x2386ab-0x0;var _0xd3b1ec=_0x99d7[_0x2386ab];return _0xd3b1ec;};'use strict';var _=require(_0x799d('0x0'));var util=require('util');var moment=require(_0x799d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x799d('0x2'));var db=require(_0x799d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x799d('0x4'));var config=require(_0x799d('0x5'));var jayson=require(_0x799d('0x6'));var client=jayson[_0x799d('0x7')][_0x799d('0x8')]({'port':0x232a});config['redis']=_[_0x799d('0x9')](config['redis'],{'host':_0x799d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x799d('0xb')]));require(_0x799d('0xc'))[_0x799d('0xd')](socket);function respondWithRpcPromise(_0x36df28,_0x22606a,_0x45d9b1){return new BPromise(function(_0x4ad3fc,_0x44322e){return client['request'](_0x36df28,_0x45d9b1)[_0x799d('0xe')](function(_0x488bd2){logger[_0x799d('0xf')](_0x799d('0x10'),_0x22606a,_0x799d('0x11'));logger['debug'](_0x799d('0x12'),_0x22606a,'request\x20sent',JSON[_0x799d('0x13')](_0x488bd2));if(_0x488bd2[_0x799d('0x14')]){if(_0x488bd2[_0x799d('0x14')]['code']===0x1f4){logger[_0x799d('0x14')](_0x799d('0x10'),_0x22606a,_0x488bd2[_0x799d('0x14')]['message']);return _0x44322e(_0x488bd2[_0x799d('0x14')]['message']);}logger[_0x799d('0x14')](_0x799d('0x10'),_0x22606a,_0x488bd2[_0x799d('0x14')][_0x799d('0x15')]);return _0x4ad3fc(_0x488bd2[_0x799d('0x14')]['message']);}else{logger[_0x799d('0xf')](_0x799d('0x10'),_0x22606a,_0x799d('0x11'));_0x4ad3fc(_0x488bd2[_0x799d('0x16')][_0x799d('0x15')]);}})[_0x799d('0x17')](function(_0x4e0f42){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x22606a,_0x4e0f42);_0x44322e(_0x4e0f42);});});}exports[_0x799d('0x18')]=function(_0x23bdb5){var _0x2711d2=this;return new Promise(function(_0x41bae2,_0x4181a5){return db[_0x799d('0x19')]['update'](_0x23bdb5[_0x799d('0x1a')],{'raw':_0x23bdb5['options']?_0x23bdb5[_0x799d('0x1b')][_0x799d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23bdb5[_0x799d('0x1b')]?_0x23bdb5[_0x799d('0x1b')]['where']||null:null,'attributes':_0x23bdb5[_0x799d('0x1b')]?_0x23bdb5[_0x799d('0x1b')][_0x799d('0x1d')]||null:null,'limit':_0x23bdb5['options']?_0x23bdb5[_0x799d('0x1b')][_0x799d('0x1e')]||null:null})[_0x799d('0xe')](function(_0x1021ea){logger[_0x799d('0xf')]('UpdateSmsInteraction',_0x23bdb5);logger[_0x799d('0x1f')](_0x799d('0x18'),_0x23bdb5,JSON['stringify'](_0x1021ea));_0x41bae2(_0x1021ea);})[_0x799d('0x17')](function(_0x311b28){logger[_0x799d('0x14')]('UpdateSmsInteraction',_0x311b28[_0x799d('0x15')],_0x23bdb5);_0x4181a5(_0x2711d2['error'](0x1f4,_0x311b28[_0x799d('0x15')]));});});};exports[_0x799d('0x20')]=function(_0x148a08){return new Promise(function(_0x207d0a,_0x49e838){return db[_0x799d('0x19')][_0x799d('0x21')]({'where':_0x148a08[_0x799d('0x1b')]?_0x148a08[_0x799d('0x1b')][_0x799d('0x22')]||null:null})[_0x799d('0xe')](function(_0x1a8752){if(_0x1a8752){return _0x1a8752['addTags'](_0x148a08[_0x799d('0x1a')][_0x799d('0x23')],_[_0x799d('0x24')](_0x148a08['body'],[_0x799d('0x23'),'id'])||{});}})[_0x799d('0x25')](function(_0x42e26f){logger[_0x799d('0xf')](_0x799d('0x26'),_0x148a08);logger[_0x799d('0x1f')](_0x799d('0x26'),_0x148a08,JSON[_0x799d('0x13')](_0x42e26f));_0x207d0a(_0x42e26f);})[_0x799d('0x17')](function(_0x242d77){logger[_0x799d('0x14')](_0x799d('0x26'),_0x242d77['message'],_0x148a08);_0x49e838(_this[_0x799d('0x14')](0x1f4,_0x242d77[_0x799d('0x15')]));});});}; \ No newline at end of file +var _0xa13d=['catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x208af9,_0x428504){var _0x34e94b=function(_0x48aa03){while(--_0x48aa03){_0x208af9['push'](_0x208af9['shift']());}};_0x34e94b(++_0x428504);}(_0xa13d,0x1e9));var _0xda13=function(_0x33c45b,_0x104d57){_0x33c45b=_0x33c45b-0x0;var _0x1fe222=_0xa13d[_0x33c45b];return _0x1fe222;};'use strict';var _=require(_0xda13('0x0'));var util=require(_0xda13('0x1'));var moment=require('moment');var BPromise=require(_0xda13('0x2'));var rs=require(_0xda13('0x3'));var fs=require('fs');var Redis=require(_0xda13('0x4'));var db=require(_0xda13('0x5'))['db'];var utils=require(_0xda13('0x6'));var logger=require('../../config/logger')(_0xda13('0x7'));var config=require(_0xda13('0x8'));var jayson=require(_0xda13('0x9'));var client=jayson[_0xda13('0xa')]['http']({'port':0x232a});config['redis']=_[_0xda13('0xb')](config[_0xda13('0xc')],{'host':_0xda13('0xd'),'port':0x18eb});var socket=require(_0xda13('0xe'))(new Redis(config[_0xda13('0xc')]));require(_0xda13('0xf'))[_0xda13('0x10')](socket);function respondWithRpcPromise(_0x31a37e,_0x289383,_0x13c737){return new BPromise(function(_0x4bfee1,_0x4b7fab){return client['request'](_0x31a37e,_0x13c737)[_0xda13('0x11')](function(_0x5aa584){logger[_0xda13('0x12')](_0xda13('0x13'),_0x289383,_0xda13('0x14'));logger[_0xda13('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x289383,'request\x20sent',JSON[_0xda13('0x16')](_0x5aa584));if(_0x5aa584['error']){if(_0x5aa584[_0xda13('0x17')][_0xda13('0x18')]===0x1f4){logger[_0xda13('0x17')](_0xda13('0x13'),_0x289383,_0x5aa584['error'][_0xda13('0x19')]);return _0x4b7fab(_0x5aa584['error'][_0xda13('0x19')]);}logger['error'](_0xda13('0x13'),_0x289383,_0x5aa584['error'][_0xda13('0x19')]);return _0x4bfee1(_0x5aa584[_0xda13('0x17')]['message']);}else{logger[_0xda13('0x12')](_0xda13('0x13'),_0x289383,_0xda13('0x14'));_0x4bfee1(_0x5aa584[_0xda13('0x1a')][_0xda13('0x19')]);}})[_0xda13('0x1b')](function(_0x588a5d){logger[_0xda13('0x17')](_0xda13('0x13'),_0x289383,_0x588a5d);_0x4b7fab(_0x588a5d);});});}exports['UpdateSmsInteraction']=function(_0x18e737){var _0x2945c7=this;return new Promise(function(_0x5f2fcb,_0x1564b8){return db[_0xda13('0x1c')][_0xda13('0x1d')](_0x18e737[_0xda13('0x1e')],{'raw':_0x18e737[_0xda13('0x1f')]?_0x18e737[_0xda13('0x1f')][_0xda13('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18e737[_0xda13('0x1f')]?_0x18e737[_0xda13('0x1f')][_0xda13('0x21')]||null:null,'attributes':_0x18e737[_0xda13('0x1f')]?_0x18e737[_0xda13('0x1f')][_0xda13('0x22')]||null:null,'limit':_0x18e737[_0xda13('0x1f')]?_0x18e737[_0xda13('0x1f')][_0xda13('0x23')]||null:null})[_0xda13('0x11')](function(_0x23b670){logger[_0xda13('0x12')](_0xda13('0x24'),_0x18e737);logger['debug'](_0xda13('0x24'),_0x18e737,JSON[_0xda13('0x16')](_0x23b670));_0x5f2fcb(_0x23b670);})[_0xda13('0x1b')](function(_0x23502c){logger['error'](_0xda13('0x24'),_0x23502c[_0xda13('0x19')],_0x18e737);_0x1564b8(_0x2945c7['error'](0x1f4,_0x23502c[_0xda13('0x19')]));});});};exports[_0xda13('0x25')]=function(_0x994e0d){return new Promise(function(_0x2e572c,_0x5ca170){return db[_0xda13('0x1c')][_0xda13('0x26')]({'where':_0x994e0d[_0xda13('0x1f')]?_0x994e0d[_0xda13('0x1f')][_0xda13('0x21')]||null:null})['then'](function(_0x4d0381){if(_0x4d0381){return _0x4d0381[_0xda13('0x27')](_0x994e0d['body'][_0xda13('0x28')],_[_0xda13('0x29')](_0x994e0d[_0xda13('0x1e')],['ids','id'])||{});}})['spread'](function(_0x25c5b4){logger[_0xda13('0x12')]('AddTags',_0x994e0d);logger[_0xda13('0x15')](_0xda13('0x2a'),_0x994e0d,JSON[_0xda13('0x16')](_0x25c5b4));_0x2e572c(_0x25c5b4);})[_0xda13('0x1b')](function(_0x41299a){logger['error'](_0xda13('0x2a'),_0x41299a[_0xda13('0x19')],_0x994e0d);_0x5ca170(_this[_0xda13('0x17')](0x1f4,_0x41299a[_0xda13('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 98e6593..8a54397 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 _0x14fb=['remove','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x52feac,_0xe9a2cf){var _0x30fdfd=function(_0x453cf0){while(--_0x453cf0){_0x52feac['push'](_0x52feac['shift']());}};_0x30fdfd(++_0xe9a2cf);}(_0x14fb,0x155));var _0xb14f=function(_0x3ca22d,_0x4f7732){_0x3ca22d=_0x3ca22d-0x0;var _0x579d8d=_0x14fb[_0x3ca22d];return _0x579d8d;};'use strict';var SmsInteractionEvents=require(_0xb14f('0x0'));var events=[_0xb14f('0x1'),_0xb14f('0x2'),'update'];function createListener(_0x5e776b,_0xb3bcc4){return function(_0x239e4f){_0xb3bcc4['emit'](_0x5e776b,_0x239e4f);};}function removeListener(_0x385de4,_0x32506a){return function(){SmsInteractionEvents[_0xb14f('0x3')](_0x385de4,_0x32506a);};}exports[_0xb14f('0x4')]=function(_0x1a7de8){for(var _0x54a5c9=0x0,_0x2a2ed6=events[_0xb14f('0x5')];_0x54a5c9<_0x2a2ed6;_0x54a5c9++){var _0x5164b6=events[_0x54a5c9];var _0x905d14=createListener(_0xb14f('0x6')+_0x5164b6,_0x1a7de8);SmsInteractionEvents['on'](_0x5164b6,_0x905d14);}}; \ No newline at end of file +var _0xf3d6=['./smsInteraction.events','save','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0xf3d6,0x158));var _0x6f3d=function(_0x4fa665,_0x1ae12a){_0x4fa665=_0x4fa665-0x0;var _0x62ccff=_0xf3d6[_0x4fa665];return _0x62ccff;};'use strict';var SmsInteractionEvents=require(_0x6f3d('0x0'));var events=[_0x6f3d('0x1'),'remove',_0x6f3d('0x2')];function createListener(_0x2219a9,_0x41aa5e){return function(_0x5f4858){_0x41aa5e[_0x6f3d('0x3')](_0x2219a9,_0x5f4858);};}function removeListener(_0x48bf16,_0x3dddc9){return function(){SmsInteractionEvents[_0x6f3d('0x4')](_0x48bf16,_0x3dddc9);};}exports[_0x6f3d('0x5')]=function(_0x1e866d){for(var _0x1a1f9e=0x0,_0x5646d2=events[_0x6f3d('0x6')];_0x1a1f9e<_0x5646d2;_0x1a1f9e++){var _0x458ada=events[_0x1a1f9e];var _0x570709=createListener(_0x6f3d('0x7')+_0x458ada,_0x1e866d);SmsInteractionEvents['on'](_0x458ada,_0x570709);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ac1a0b9..55b0ca4 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 _0xa6ea=['accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','smsmessage:create','/:id/status','status','update','put','/:id/accept'];(function(_0x1aa735,_0xb44ead){var _0x17c4c2=function(_0x5f06ef){while(--_0x5f06ef){_0x1aa735['push'](_0x1aa735['shift']());}};_0x17c4c2(++_0xb44ead);}(_0xa6ea,0x122));var _0xaa6e=function(_0x414b07,_0x18dd24){_0x414b07=_0x414b07-0x0;var _0x327c9c=_0xa6ea[_0x414b07];return _0x327c9c;};'use strict';var multer=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var path=require(_0xaa6e('0x2'));var timeout=require(_0xaa6e('0x3'));var express=require(_0xaa6e('0x4'));var router=express[_0xaa6e('0x5')]();var fs_extra=require(_0xaa6e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaa6e('0x7'));var config=require(_0xaa6e('0x8'));var controller=require(_0xaa6e('0x9'));router[_0xaa6e('0xa')]('/',auth[_0xaa6e('0xb')](),controller['index']);router['get'](_0xaa6e('0xc'),auth[_0xaa6e('0xb')](),controller[_0xaa6e('0xd')]);router[_0xaa6e('0xa')](_0xaa6e('0xe'),auth[_0xaa6e('0xb')](),controller[_0xaa6e('0xf')]);router['post']('/',auth[_0xaa6e('0xb')](),interaction['tracked']('sms',_0xaa6e('0x10')),controller['create']);router['post'](_0xaa6e('0x11'),controller[_0xaa6e('0x12')]);router['put'](_0xaa6e('0xe'),auth['isAuthenticated'](),controller[_0xaa6e('0x13')]);router[_0xaa6e('0x14')](_0xaa6e('0x15'),auth[_0xaa6e('0xb')](),controller[_0xaa6e('0x16')]);router[_0xaa6e('0x14')](_0xaa6e('0x17'),auth[_0xaa6e('0xb')](),controller[_0xaa6e('0x18')]);router['delete'](_0xaa6e('0xe'),auth[_0xaa6e('0xb')](),controller[_0xaa6e('0x19')]);module['exports']=router; \ No newline at end of file +var _0x0d8b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','reject','delete','destroy','exports'];(function(_0x1d0856,_0x49e164){var _0x598328=function(_0x527647){while(--_0x527647){_0x1d0856['push'](_0x1d0856['shift']());}};_0x598328(++_0x49e164);}(_0x0d8b,0x1e6));var _0xb0d8=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x0d8b[_0x310d10];return _0x1fb8af;};'use strict';var multer=require('multer');var util=require(_0xb0d8('0x0'));var path=require(_0xb0d8('0x1'));var timeout=require(_0xb0d8('0x2'));var express=require(_0xb0d8('0x3'));var router=express[_0xb0d8('0x4')]();var fs_extra=require(_0xb0d8('0x5'));var auth=require(_0xb0d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb0d8('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xb0d8('0x8')](),controller[_0xb0d8('0x9')]);router[_0xb0d8('0xa')](_0xb0d8('0xb'),auth[_0xb0d8('0x8')](),controller[_0xb0d8('0xc')]);router[_0xb0d8('0xa')](_0xb0d8('0xd'),auth[_0xb0d8('0x8')](),controller['show']);router[_0xb0d8('0xe')]('/',auth[_0xb0d8('0x8')](),interaction[_0xb0d8('0xf')](_0xb0d8('0x10'),_0xb0d8('0x11')),controller['create']);router[_0xb0d8('0xe')](_0xb0d8('0x12'),controller[_0xb0d8('0x13')]);router[_0xb0d8('0x14')](_0xb0d8('0xd'),auth[_0xb0d8('0x8')](),controller[_0xb0d8('0x15')]);router[_0xb0d8('0x14')](_0xb0d8('0x16'),auth[_0xb0d8('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0xb0d8('0x8')](),controller[_0xb0d8('0x17')]);router[_0xb0d8('0x18')](_0xb0d8('0xd'),auth[_0xb0d8('0x8')](),controller[_0xb0d8('0x19')]);module[_0xb0d8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 434781e..8640a2a 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 _0xc13c=['BOOLEAN','out','STRING','exports','TEXT'];(function(_0x39a140,_0x9ee7ae){var _0x49fa2a=function(_0x39239d){while(--_0x39239d){_0x39a140['push'](_0x39a140['shift']());}};_0x49fa2a(++_0x9ee7ae);}(_0xc13c,0x15c));var _0xcc13=function(_0x5b033,_0x30849f){_0x5b033=_0x5b033-0x0;var _0x373547=_0xc13c[_0x5b033];return _0x373547;};'use strict';var Sequelize=require('sequelize');module[_0xcc13('0x0')]={'body':{'type':Sequelize[_0xcc13('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcc13('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcc13('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcc13('0x4')](0xbe)},'phone':{'type':Sequelize[_0xcc13('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xcc13('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcc13('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x397b=['sequelize','medium','out','STRING','BOOLEAN','TEXT'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0x397b,0x168));var _0xb397=function(_0x371607,_0x37483a){_0x371607=_0x371607-0x0;var _0x319fc6=_0x397b[_0x371607];return _0x319fc6;};'use strict';var Sequelize=require(_0xb397('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xb397('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb397('0x2')),'defaultValue':_0xb397('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb397('0x3')](0xbe)},'phone':{'type':Sequelize[_0xb397('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xb397('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb397('0x3')]},'providerResponse':{'type':Sequelize[_0xb397('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e5ec3fc..7d8f3a3 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 _0xc42c=['event','EventManager','acceptmessage','SmsInteractionId','role','RejectMessage','rejectMessage','ContactId','User','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','SmsMessage','includeAll','include','findAll','rows','params','options','create','body','find','destroy','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc42c,0x13e));var _0xcc42=function(_0x3f8757,_0x39a77c){_0x3f8757=_0x3f8757-0x0;var _0x3464a5=_0xc42c[_0x3f8757];return _0x3464a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc42('0x0'));var zipdir=require(_0xcc42('0x1'));var jsonpatch=require(_0xcc42('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc42('0x3'));var util=require(_0xcc42('0x4'));var path=require(_0xcc42('0x5'));var sox=require(_0xcc42('0x6'));var csv=require(_0xcc42('0x7'));var ejs=require(_0xcc42('0x8'));var fs=require('fs');var fs_extra=require(_0xcc42('0x9'));var _=require(_0xcc42('0xa'));var squel=require(_0xcc42('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc42('0xc'));var toCsv=require(_0xcc42('0x7'));var querystring=require('querystring');var Papa=require(_0xcc42('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc42('0xe'));var as=require(_0xcc42('0xf'));var hardwareService=require(_0xcc42('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcc42('0x11'));var config=require(_0xcc42('0x12'));var licenseUtil=require(_0xcc42('0x13'));var db=require(_0xcc42('0x14'))['db'];config[_0xcc42('0x15')]=_['defaults'](config[_0xcc42('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc42('0x16'))(new Redis(config['redis']));require(_0xcc42('0x17'))['register'](socket);var jayson=require(_0xcc42('0x18'));var client=jayson[_0xcc42('0x19')][_0xcc42('0x1a')]({'port':0x232c});var client9002=jayson[_0xcc42('0x19')][_0xcc42('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x34f385,_0x422a49,_0x2b39d2,_0x38dca5){return new BPromise(function(_0x40a6da,_0x2ec718){var _0xb9872c=_0x38dca5||client;return _0xb9872c[_0xcc42('0x1b')](_0x34f385,_0x2b39d2)[_0xcc42('0x1c')](function(_0x1babbd){logger[_0xcc42('0x1d')](_0xcc42('0x1e'),_0x422a49,'request\x20sent');logger[_0xcc42('0x1f')](_0xcc42('0x20'),_0x422a49,_0xcc42('0x21'),JSON[_0xcc42('0x22')](_0x1babbd));if(_0x1babbd['error']){if(_0x1babbd[_0xcc42('0x23')][_0xcc42('0x24')]===0x1f4){logger[_0xcc42('0x23')](_0xcc42('0x1e'),_0x422a49,_0x1babbd[_0xcc42('0x23')][_0xcc42('0x25')]);return _0x2ec718(_0x1babbd[_0xcc42('0x23')][_0xcc42('0x25')]);}logger['error'](_0xcc42('0x1e'),_0x422a49,_0x1babbd[_0xcc42('0x23')]['message']);return _0x40a6da(_0x1babbd[_0xcc42('0x23')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x422a49,_0xcc42('0x21'));_0x40a6da(_0x1babbd[_0xcc42('0x26')][_0xcc42('0x25')]);}})[_0xcc42('0x27')](function(_0x505978){logger[_0xcc42('0x23')](_0xcc42('0x1e'),_0x422a49,_0x505978);_0x2ec718(_0x505978);});});}function respondWithStatusCode(_0x5b58a1,_0x3e22ac){_0x3e22ac=_0x3e22ac||0xcc;return function(_0x33cd4a){if(_0x33cd4a){return _0x5b58a1[_0xcc42('0x28')](_0x3e22ac);}return _0x5b58a1[_0xcc42('0x29')](_0x3e22ac)[_0xcc42('0x2a')]();};}function respondWithResult(_0x10c637,_0x198d04){_0x198d04=_0x198d04||0xc8;return function(_0x592479){if(_0x592479){return _0x10c637['status'](_0x198d04)[_0xcc42('0x2b')](_0x592479);}};}function respondWithFilteredResult(_0x3d66fa,_0x11ff3d){return function(_0x27e1d5){if(_0x27e1d5){var _0x313b6d=typeof _0x11ff3d[_0xcc42('0x2c')]===_0xcc42('0x2d')&&typeof _0x11ff3d[_0xcc42('0x2e')]===_0xcc42('0x2d');var _0x3a0a83=_0x27e1d5[_0xcc42('0x2f')];var _0xe8bd5=_0x313b6d?0x0:_0x11ff3d[_0xcc42('0x2c')];var _0x1d6582=_0x313b6d?_0x27e1d5[_0xcc42('0x2f')]:_0x11ff3d['offset']+_0x11ff3d[_0xcc42('0x2e')];var _0x110d39;if(_0x1d6582>=_0x3a0a83){_0x1d6582=_0x3a0a83;_0x110d39=0xc8;}else{_0x110d39=0xce;}_0x3d66fa[_0xcc42('0x29')](_0x110d39);return _0x3d66fa[_0xcc42('0x30')](_0xcc42('0x31'),_0xe8bd5+'-'+_0x1d6582+'/'+_0x3a0a83)[_0xcc42('0x2b')](_0x27e1d5);}return null;};}function patchUpdates(_0x2b4493){return function(_0x420fd1){try{jsonpatch[_0xcc42('0x32')](_0x420fd1,_0x2b4493,!![]);}catch(_0x5f1057){return BPromise[_0xcc42('0x33')](_0x5f1057);}return _0x420fd1[_0xcc42('0x34')]();};}function saveUpdates(_0x5999aa,_0x54c436){return function(_0x13b1e){if(_0x13b1e){return _0x13b1e[_0xcc42('0x35')](_0x5999aa)[_0xcc42('0x1c')](function(_0x3f7a32){return _0x3f7a32;});}return null;};}function removeEntity(_0x171524,_0x1f4383){return function(_0x9f8edb){if(_0x9f8edb){return _0x9f8edb['destroy']()[_0xcc42('0x1c')](function(){_0x171524[_0xcc42('0x29')](0xcc)[_0xcc42('0x2a')]();});}};}function handleEntityNotFound(_0x262d89,_0x443a29){return function(_0x11c075){if(!_0x11c075){_0x262d89[_0xcc42('0x28')](0x194);}return _0x11c075;};}function handleError(_0x56f942,_0x27cf31){_0x27cf31=_0x27cf31||0x1f4;return function(_0x61d6fe){logger['error'](_0x61d6fe[_0xcc42('0x36')]);if(_0x61d6fe['name']){delete _0x61d6fe[_0xcc42('0x37')];}_0x56f942[_0xcc42('0x29')](_0x27cf31)[_0xcc42('0x38')](_0x61d6fe);};}exports[_0xcc42('0x39')]=function(_0x3cddc3,_0x1e903a){var _0x530ab8={},_0x3a0e83={},_0x1fc487={'count':0x0,'rows':[]};var _0x449fc5=_[_0xcc42('0x3a')](db['SmsMessage'][_0xcc42('0x3b')],function(_0x3b0b3d){return{'name':_0x3b0b3d[_0xcc42('0x3c')],'type':_0x3b0b3d['type']['key']};});_0x3a0e83[_0xcc42('0x3d')]=_['map'](_0x449fc5,'name');_0x3a0e83[_0xcc42('0x3e')]=_[_0xcc42('0x3f')](_0x3cddc3[_0xcc42('0x3e')]);_0x3a0e83[_0xcc42('0x40')]=_[_0xcc42('0x41')](_0x3a0e83[_0xcc42('0x3d')],_0x3a0e83[_0xcc42('0x3e')]);_0x530ab8[_0xcc42('0x42')]=_[_0xcc42('0x41')](_0x3a0e83[_0xcc42('0x3d')],qs[_0xcc42('0x43')](_0x3cddc3[_0xcc42('0x3e')]['fields']));_0x530ab8[_0xcc42('0x42')]=_0x530ab8[_0xcc42('0x42')][_0xcc42('0x44')]?_0x530ab8[_0xcc42('0x42')]:_0x3a0e83[_0xcc42('0x3d')];if(!_0x3cddc3[_0xcc42('0x3e')][_0xcc42('0x45')](_0xcc42('0x46'))){_0x530ab8['limit']=qs['limit'](_0x3cddc3[_0xcc42('0x3e')][_0xcc42('0x2e')]);_0x530ab8[_0xcc42('0x2c')]=qs[_0xcc42('0x2c')](_0x3cddc3['query'][_0xcc42('0x2c')]);}_0x530ab8[_0xcc42('0x47')]=qs['sort'](_0x3cddc3[_0xcc42('0x3e')]['sort']);_0x530ab8[_0xcc42('0x48')]=qs[_0xcc42('0x40')](_[_0xcc42('0x49')](_0x3cddc3[_0xcc42('0x3e')],_0x3a0e83[_0xcc42('0x40')]),_0x449fc5);if(_0x3cddc3['query'][_0xcc42('0x4a')]){_0x530ab8[_0xcc42('0x48')]=_[_0xcc42('0x4b')](_0x530ab8['where'],{'$or':_['map'](_0x449fc5,function(_0xd46ad9){if(_0xd46ad9[_0xcc42('0x4c')]!=='VIRTUAL'){var _0x1a9be1={};_0x1a9be1[_0xd46ad9['name']]={'$like':'%'+_0x3cddc3[_0xcc42('0x3e')]['filter']+'%'};return _0x1a9be1;}})});}_0x530ab8=_[_0xcc42('0x4b')]({},_0x530ab8,_0x3cddc3['options']);var _0x1849ff={'where':_0x530ab8[_0xcc42('0x48')]};return db[_0xcc42('0x4d')][_0xcc42('0x2f')](_0x1849ff)[_0xcc42('0x1c')](function(_0x53e753){_0x1fc487[_0xcc42('0x2f')]=_0x53e753;if(_0x3cddc3[_0xcc42('0x3e')][_0xcc42('0x4e')]){_0x530ab8[_0xcc42('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0xcc42('0x50')](_0x530ab8);})['then'](function(_0x2f5eb6){_0x1fc487[_0xcc42('0x51')]=_0x2f5eb6;return _0x1fc487;})[_0xcc42('0x1c')](respondWithFilteredResult(_0x1e903a,_0x530ab8))[_0xcc42('0x27')](handleError(_0x1e903a,null));};exports['show']=function(_0x24e51c,_0x4445c2){var _0x37c09f={'raw':!![],'where':{'id':_0x24e51c[_0xcc42('0x52')]['id']}},_0x1d0f3e={};_0x1d0f3e[_0xcc42('0x3d')]=_[_0xcc42('0x3f')](db['SmsMessage'][_0xcc42('0x3b')]);_0x1d0f3e[_0xcc42('0x3e')]=_['keys'](_0x24e51c['query']);_0x1d0f3e[_0xcc42('0x40')]=_[_0xcc42('0x41')](_0x1d0f3e[_0xcc42('0x3d')],_0x1d0f3e[_0xcc42('0x3e')]);_0x37c09f['attributes']=_[_0xcc42('0x41')](_0x1d0f3e['model'],qs['fields'](_0x24e51c[_0xcc42('0x3e')][_0xcc42('0x43')]));_0x37c09f[_0xcc42('0x42')]=_0x37c09f[_0xcc42('0x42')]['length']?_0x37c09f['attributes']:_0x1d0f3e['model'];if(_0x24e51c[_0xcc42('0x3e')][_0xcc42('0x4e')]){_0x37c09f['include']=[{'all':!![]}];}_0x37c09f=_[_0xcc42('0x4b')]({},_0x37c09f,_0x24e51c[_0xcc42('0x53')]);return db[_0xcc42('0x4d')]['find'](_0x37c09f)[_0xcc42('0x1c')](handleEntityNotFound(_0x4445c2,null))[_0xcc42('0x1c')](respondWithResult(_0x4445c2,null))[_0xcc42('0x27')](handleError(_0x4445c2,null));};exports[_0xcc42('0x54')]=function(_0x52e056,_0x42a0ed){return db[_0xcc42('0x4d')][_0xcc42('0x54')](_0x52e056[_0xcc42('0x55')],{})[_0xcc42('0x1c')](respondWithResult(_0x42a0ed,0xc9))[_0xcc42('0x27')](handleError(_0x42a0ed,null));};exports[_0xcc42('0x35')]=function(_0x1c4536,_0x110c7c){if(_0x1c4536[_0xcc42('0x55')]['id']){delete _0x1c4536[_0xcc42('0x55')]['id'];}return db[_0xcc42('0x4d')][_0xcc42('0x56')]({'where':{'id':_0x1c4536[_0xcc42('0x52')]['id']}})[_0xcc42('0x1c')](handleEntityNotFound(_0x110c7c,null))[_0xcc42('0x1c')](saveUpdates(_0x1c4536['body'],null))[_0xcc42('0x1c')](respondWithResult(_0x110c7c,null))[_0xcc42('0x27')](handleError(_0x110c7c,null));};exports[_0xcc42('0x57')]=function(_0x20affc,_0x29658c){return db[_0xcc42('0x4d')][_0xcc42('0x56')]({'where':{'id':_0x20affc['params']['id']}})[_0xcc42('0x1c')](handleEntityNotFound(_0x29658c,null))[_0xcc42('0x1c')](removeEntity(_0x29658c,null))['catch'](handleError(_0x29658c,null));};exports['describe']=function(_0x3b1912,_0x2184c6){return db['SmsMessage']['describe']()[_0xcc42('0x1c')](respondWithResult(_0x2184c6,null))[_0xcc42('0x27')](handleError(_0x2184c6,null));};var interaction_log=require(_0xcc42('0x58'))(_0xcc42('0x59'));exports[_0xcc42('0x5a')]=function(_0x30f994,_0x51d3e3,_0x410f05){var _0x58d432={'agent':{},'channel':_0xcc42('0x5b')};if(_0x30f994[_0xcc42('0x55')]['id']){delete _0x30f994[_0xcc42('0x55')]['id'];}_0x30f994[_0xcc42('0x55')][_0xcc42('0x5c')]=!![];_0x30f994['body'][_0xcc42('0x5d')]=moment()[_0xcc42('0x5e')](_0xcc42('0x5f'));_0x30f994[_0xcc42('0x55')][_0xcc42('0x60')]=_0x30f994[_0xcc42('0x55')][_0xcc42('0x60')]||_0x30f994['user']['id'];_0x58d432[_0xcc42('0x61')]['id']=_0x30f994[_0xcc42('0x55')][_0xcc42('0x60')];return db[_0xcc42('0x4d')][_0xcc42('0x56')]({'where':{'id':_0x30f994[_0xcc42('0x52')]['id'],'UserId':null}})[_0xcc42('0x1c')](handleEntityNotFound(_0x51d3e3,null))[_0xcc42('0x1c')](saveUpdates(_0x30f994[_0xcc42('0x55')],null))[_0xcc42('0x1c')](function(_0x530850){if(_0x530850){_0x58d432[_0xcc42('0x25')]=_0x530850['get']({'plain':!![]});return db[_0xcc42('0x62')][_0xcc42('0x56')]({'where':{'id':_0x530850['SmsInteractionId']}});}return null;})[_0xcc42('0x1c')](handleEntityNotFound(_0x51d3e3,null))['then'](function(_0x37edd4){if(_0x37edd4){return _0x37edd4[_0xcc42('0x35')]({'UserId':_0x30f994['body'][_0xcc42('0x60')],'read1stAt':_['isNil'](_0x37edd4[_0xcc42('0x63')])?moment()[_0xcc42('0x5e')](_0xcc42('0x5f')):undefined});}return null;})[_0xcc42('0x1c')](function(_0x85e832){if(_0x85e832){_0x58d432[_0xcc42('0x64')]=_0x85e832[_0xcc42('0x65')]({'plain':!![]});interaction_log[_0xcc42('0x1d')](_0xcc42('0x66'),_0x30f994[_0xcc42('0x67')]['id'],_0x30f994[_0xcc42('0x67')][_0xcc42('0x37')],_0x30f994[_0xcc42('0x67')]['role'],_0x58d432[_0xcc42('0x64')]['id'],_0x30f994['body']?JSON[_0xcc42('0x22')](_0x30f994[_0xcc42('0x55')]):'null');return respondWithRpcPromise(_0xcc42('0x68'),'acceptMessage',_0x58d432);}return null;})[_0xcc42('0x1c')](function(_0x2aa5f7){var _0x4fad1d=_0xcc42('0x69')+_0x2aa5f7[_0xcc42('0x25')]['ContactId'];return db[_0xcc42('0x6a')][_0xcc42('0x3e')](_0x4fad1d,{'type':db[_0xcc42('0x6b')][_0xcc42('0x6c')][_0xcc42('0x6d')],'raw':!![]})['then'](function(_0x39a1fb){return _0x39a1fb;});})[_0xcc42('0x1c')](function(_0x3cf1e5){if(_0x3cf1e5){_0x58d432['message'][_0xcc42('0x6e')]=_0x3cf1e5[0x0];if(!_0x30f994[_0xcc42('0x55')][_0xcc42('0x60')])return;return db['User'][_0xcc42('0x56')]({'where':{'id':_0x30f994[_0xcc42('0x55')][_0xcc42('0x60')],'role':'agent'},'attributes':['id','name',_0xcc42('0x6f'),'email',_0xcc42('0x70')],'raw':!![]});}return null;})['then'](function(_0x122cc4){if(!_0x122cc4)return null;_0x58d432[_0xcc42('0x25')][_0xcc42('0x61')]=_0x122cc4;return _0x58d432;})[_0xcc42('0x1c')](function(_0x569d95){if(_0x569d95){if(_0x30f994[_0xcc42('0x55')]['manual']){_0x58d432[_0xcc42('0x25')][_0xcc42('0x71')]=util[_0xcc42('0x5e')](_0xcc42('0x72'),_0x30f994['user']['name']);_0x58d432[_0xcc42('0x25')][_0xcc42('0x73')]=_0x58d432[_0xcc42('0x73')];_0x58d432[_0xcc42('0x25')][_0xcc42('0x74')]=_0x58d432[_0xcc42('0x73')];_0x58d432[_0xcc42('0x25')][_0xcc42('0x75')]=_0xcc42('0x5a');return respondWithRpcPromise(_0xcc42('0x76'),_0xcc42('0x76'),{'event':_0xcc42('0x77'),'message':_0x58d432[_0xcc42('0x25')]},client9002)[_0xcc42('0x1c')](function(){return _0x58d432;});}return _0x58d432;}return null;})[_0xcc42('0x1c')](respondWithResult(_0x51d3e3,null))[_0xcc42('0x27')](handleError(_0x51d3e3,null));};var interaction_log=require('../../config/logger')(_0xcc42('0x59'));exports['reject']=function(_0x40cbb4,_0x2d90db,_0x378c4c){var _0x267bd2={'agent':{},'channel':_0xcc42('0x5b')};if(_0x40cbb4[_0xcc42('0x55')]['id']){delete _0x40cbb4[_0xcc42('0x55')]['id'];}_0x40cbb4[_0xcc42('0x55')][_0xcc42('0x60')]=_0x40cbb4[_0xcc42('0x55')][_0xcc42('0x60')]||_0x40cbb4[_0xcc42('0x67')]['id'];_0x267bd2[_0xcc42('0x61')]['id']=_0x40cbb4[_0xcc42('0x55')]['UserId'];return db[_0xcc42('0x4d')][_0xcc42('0x56')]({'where':{'id':_0x40cbb4[_0xcc42('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d90db,null))['then'](function(_0x253854){if(_0x253854){_0x267bd2[_0xcc42('0x25')]=_0x253854[_0xcc42('0x65')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x253854[_0xcc42('0x78')]}});}return null;})['then'](handleEntityNotFound(_0x2d90db,null))['then'](function(_0x5383b6){if(_0x5383b6){_0x267bd2[_0xcc42('0x64')]=_0x5383b6['get']({'plain':!![]});interaction_log[_0xcc42('0x1d')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40cbb4[_0xcc42('0x67')]['id'],_0x40cbb4[_0xcc42('0x67')][_0xcc42('0x37')],_0x40cbb4[_0xcc42('0x67')][_0xcc42('0x79')],_0x267bd2[_0xcc42('0x64')]['id'],_0x40cbb4['body']?JSON[_0xcc42('0x22')](_0x40cbb4['body']):'null');return respondWithRpcPromise(_0xcc42('0x7a'),_0xcc42('0x7b'),_0x267bd2);}return null;})['then'](function(_0x5a97d1){var _0x3338bd=_0xcc42('0x69')+_0x5a97d1[_0xcc42('0x25')][_0xcc42('0x7c')];return db['sequelize'][_0xcc42('0x3e')](_0x3338bd,{'type':db[_0xcc42('0x6b')][_0xcc42('0x6c')][_0xcc42('0x6d')],'raw':!![]})[_0xcc42('0x1c')](function(_0x20aae3){return _0x20aae3;});})['then'](function(_0x18b77d){if(_0x18b77d){_0x267bd2['message']['contact']=_0x18b77d[0x0];if(!_0x40cbb4[_0xcc42('0x55')]['UserId'])return;return db[_0xcc42('0x7d')]['find']({'where':{'id':_0x40cbb4[_0xcc42('0x55')][_0xcc42('0x60')],'role':_0xcc42('0x61')},'attributes':['id','name',_0xcc42('0x6f'),'email',_0xcc42('0x70')],'raw':!![]});}return null;})[_0xcc42('0x1c')](function(_0x4efea6){if(!_0x4efea6)return null;_0x267bd2[_0xcc42('0x25')]['agent']=_0x4efea6;return _0x267bd2;})[_0xcc42('0x1c')](function(_0x406920){if(_0x406920){_0x406920[_0xcc42('0x25')]['interface']=util[_0xcc42('0x5e')]('SIP/%s',_0x40cbb4['user'][_0xcc42('0x37')]);_0x406920[_0xcc42('0x25')][_0xcc42('0x73')]=_0x267bd2[_0xcc42('0x73')];_0x406920[_0xcc42('0x25')][_0xcc42('0x74')]=_0x267bd2[_0xcc42('0x73')];_0x406920['message'][_0xcc42('0x75')]=_0xcc42('0x33');respondWithRpcPromise(_0xcc42('0x76'),_0xcc42('0x76'),{'event':_0xcc42('0x7e'),'message':_0x406920['message']},client9002);return _0x267bd2;}return null;})['then'](respondWithResult(_0x2d90db,null))['catch'](handleError(_0x2d90db,null));};exports[_0xcc42('0x29')]=function(_0x3536d5,_0x18b9cf,_0xde4a3b){if(_0x3536d5[_0xcc42('0x55')]['id']){delete _0x3536d5['body']['id'];}var _0x3152c4;return db['SmsMessage'][_0xcc42('0x56')]({'where':{'id':_0x3536d5[_0xcc42('0x52')]['id']}})[_0xcc42('0x1c')](handleEntityNotFound(_0x18b9cf,null))[_0xcc42('0x1c')](function(_0x39f743){if(_0x39f743){_0x3152c4=_0x39f743;return db[_0xcc42('0x7f')][_0xcc42('0x56')]({'where':{'id':_0x39f743[_0xcc42('0x80')]}});}})['then'](handleEntityNotFound(_0x18b9cf,null))[_0xcc42('0x1c')](function(_0x5a1853){if(_0x5a1853){logger['debug'](_0xcc42('0x20'),_0xcc42('0x29'),_0xcc42('0x81'),_0x5a1853[_0xcc42('0x4c')],util[_0xcc42('0x82')](_0x3536d5[_0xcc42('0x55')],{'showHidden':![],'depth':null}));switch(_0x5a1853['type']){case'twilio':if(_0x3536d5[_0xcc42('0x55')]['MessageSid']&&_0x3536d5[_0xcc42('0x55')][_0xcc42('0x83')]===_0x3152c4[_0xcc42('0x84')]){return _0x3152c4[_0xcc42('0x35')]({'read':!![]});}else{logger[_0xcc42('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcc42('0x29'),_0xcc42('0x85'),util[_0xcc42('0x82')](_0x3536d5[_0xcc42('0x55')],{'showHidden':![],'depth':null}));}break;case _0xcc42('0x86'):if(_0x3536d5[_0xcc42('0x55')][_0xcc42('0x87')]&&_0x3536d5[_0xcc42('0x55')][_0xcc42('0x87')]===_0x3152c4[_0xcc42('0x84')]&&_[_0xcc42('0x88')]([_0xcc42('0x89'),'delivered'],_0x3536d5[_0xcc42('0x55')][_0xcc42('0x8a')])>=0x0){return _0x3152c4['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcc42('0x29'),_0xcc42('0x8b'),util['inspect'](_0x3536d5[_0xcc42('0x55')],{'showHidden':![],'depth':null}));}break;case _0xcc42('0x8c'):var _0x2ef82e=_0x3536d5['body'][_0xcc42('0x8d')][0x0];if(_0x2ef82e['status'][_0xcc42('0x8e')]===_0xcc42('0x8f')){return _0x3152c4[_0xcc42('0x35')]({'read':!![]});}else{logger[_0xcc42('0x23')](_0xcc42('0x90'),'status',_0xcc42('0x8c'),util['inspect'](_0x3536d5[_0xcc42('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x3152c4;}})[_0xcc42('0x1c')](respondWithResult(_0x18b9cf,null))['catch'](handleError(_0x18b9cf,null));}; \ No newline at end of file +var _0x86bc=['messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','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/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','client','http','request','then','info','request\x20sent','debug','stringify','code','SmsMessage,\x20%s,\x20%s','message','error','result','catch','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','name','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','User','email','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid'];(function(_0x489e76,_0x251444){var _0xbf6359=function(_0x5a4623){while(--_0x5a4623){_0x489e76['push'](_0x489e76['shift']());}};_0xbf6359(++_0x251444);}(_0x86bc,0x1b1));var _0xc86b=function(_0x24d5c8,_0x5667bc){_0x24d5c8=_0x24d5c8-0x0;var _0x32bd15=_0x86bc[_0x24d5c8];return _0x32bd15;};'use strict';var emlformat=require(_0xc86b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc86b('0x1'));var jsonpatch=require(_0xc86b('0x2'));var rp=require(_0xc86b('0x3'));var moment=require(_0xc86b('0x4'));var BPromise=require(_0xc86b('0x5'));var Mustache=require(_0xc86b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc86b('0x7'));var csv=require('to-csv');var ejs=require(_0xc86b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc86b('0x9'));var crypto=require(_0xc86b('0xa'));var jsforce=require(_0xc86b('0xb'));var deskjs=require(_0xc86b('0xc'));var toCsv=require(_0xc86b('0xd'));var querystring=require('querystring');var Papa=require(_0xc86b('0xe'));var Redis=require(_0xc86b('0xf'));var authService=require(_0xc86b('0x10'));var qs=require(_0xc86b('0x11'));var as=require(_0xc86b('0x12'));var hardwareService=require(_0xc86b('0x13'));var logger=require(_0xc86b('0x14'))(_0xc86b('0x15'));var utils=require('../../config/utils');var config=require(_0xc86b('0x16'));var licenseUtil=require(_0xc86b('0x17'));var db=require(_0xc86b('0x18'))['db'];config['redis']=_[_0xc86b('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc86b('0x1a'))(new Redis(config[_0xc86b('0x1b')]));require('./smsMessage.socket')[_0xc86b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc86b('0x1d')][_0xc86b('0x1e')]({'port':0x232c});var client9002=jayson[_0xc86b('0x1d')][_0xc86b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2c271d,_0x534b48,_0x360916,_0x22beec){return new BPromise(function(_0x32e0ad,_0x26475e){var _0x53dcf3=_0x22beec||client;return _0x53dcf3[_0xc86b('0x1f')](_0x2c271d,_0x360916)[_0xc86b('0x20')](function(_0x36d681){logger[_0xc86b('0x21')]('SmsMessage,\x20%s,\x20%s',_0x534b48,_0xc86b('0x22'));logger[_0xc86b('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x534b48,_0xc86b('0x22'),JSON[_0xc86b('0x24')](_0x36d681));if(_0x36d681['error']){if(_0x36d681['error'][_0xc86b('0x25')]===0x1f4){logger['error'](_0xc86b('0x26'),_0x534b48,_0x36d681['error'][_0xc86b('0x27')]);return _0x26475e(_0x36d681[_0xc86b('0x28')]['message']);}logger[_0xc86b('0x28')]('SmsMessage,\x20%s,\x20%s',_0x534b48,_0x36d681[_0xc86b('0x28')][_0xc86b('0x27')]);return _0x32e0ad(_0x36d681[_0xc86b('0x28')][_0xc86b('0x27')]);}else{logger['info'](_0xc86b('0x26'),_0x534b48,_0xc86b('0x22'));_0x32e0ad(_0x36d681[_0xc86b('0x29')][_0xc86b('0x27')]);}})[_0xc86b('0x2a')](function(_0x4ef627){logger[_0xc86b('0x28')](_0xc86b('0x26'),_0x534b48,_0x4ef627);_0x26475e(_0x4ef627);});});}function respondWithStatusCode(_0xe7dc4b,_0xf19828){_0xf19828=_0xf19828||0xcc;return function(_0x1eb6d9){if(_0x1eb6d9){return _0xe7dc4b['sendStatus'](_0xf19828);}return _0xe7dc4b[_0xc86b('0x2b')](_0xf19828)[_0xc86b('0x2c')]();};}function respondWithResult(_0x206b52,_0x102d9a){_0x102d9a=_0x102d9a||0xc8;return function(_0x2f33dd){if(_0x2f33dd){return _0x206b52[_0xc86b('0x2b')](_0x102d9a)[_0xc86b('0x2d')](_0x2f33dd);}};}function respondWithFilteredResult(_0x4482dc,_0x2bf385){return function(_0x259db7){if(_0x259db7){var _0x37fc26=typeof _0x2bf385[_0xc86b('0x2e')]===_0xc86b('0x2f')&&typeof _0x2bf385['limit']==='undefined';var _0x58767a=_0x259db7[_0xc86b('0x30')];var _0x479cc9=_0x37fc26?0x0:_0x2bf385['offset'];var _0x426fe7=_0x37fc26?_0x259db7[_0xc86b('0x30')]:_0x2bf385[_0xc86b('0x2e')]+_0x2bf385[_0xc86b('0x31')];var _0x1597f7;if(_0x426fe7>=_0x58767a){_0x426fe7=_0x58767a;_0x1597f7=0xc8;}else{_0x1597f7=0xce;}_0x4482dc['status'](_0x1597f7);return _0x4482dc['set'](_0xc86b('0x32'),_0x479cc9+'-'+_0x426fe7+'/'+_0x58767a)[_0xc86b('0x2d')](_0x259db7);}return null;};}function patchUpdates(_0x9e4348){return function(_0x28b97f){try{jsonpatch[_0xc86b('0x33')](_0x28b97f,_0x9e4348,!![]);}catch(_0x2cb945){return BPromise[_0xc86b('0x34')](_0x2cb945);}return _0x28b97f['save']();};}function saveUpdates(_0x41db10,_0x4ff6c9){return function(_0x2858f0){if(_0x2858f0){return _0x2858f0[_0xc86b('0x35')](_0x41db10)[_0xc86b('0x20')](function(_0x30498b){return _0x30498b;});}return null;};}function removeEntity(_0x163355,_0x509429){return function(_0x466e30){if(_0x466e30){return _0x466e30[_0xc86b('0x36')]()[_0xc86b('0x20')](function(){_0x163355['status'](0xcc)[_0xc86b('0x2c')]();});}};}function handleEntityNotFound(_0x5a611b,_0x532c7b){return function(_0x139362){if(!_0x139362){_0x5a611b['sendStatus'](0x194);}return _0x139362;};}function handleError(_0x4dd7e7,_0x1d5486){_0x1d5486=_0x1d5486||0x1f4;return function(_0x68d564){logger[_0xc86b('0x28')](_0x68d564['stack']);if(_0x68d564['name']){delete _0x68d564[_0xc86b('0x37')];}_0x4dd7e7[_0xc86b('0x2b')](_0x1d5486)['send'](_0x68d564);};}exports['index']=function(_0x45f2c8,_0x2116be){var _0x12e5d1={},_0x303592={},_0x56c67e={'count':0x0,'rows':[]};var _0x339fbe=_[_0xc86b('0x38')](db[_0xc86b('0x39')][_0xc86b('0x3a')],function(_0x230353){return{'name':_0x230353[_0xc86b('0x3b')],'type':_0x230353[_0xc86b('0x3c')][_0xc86b('0x3d')]};});_0x303592['model']=_[_0xc86b('0x38')](_0x339fbe,_0xc86b('0x37'));_0x303592[_0xc86b('0x3e')]=_[_0xc86b('0x3f')](_0x45f2c8[_0xc86b('0x3e')]);_0x303592[_0xc86b('0x40')]=_[_0xc86b('0x41')](_0x303592[_0xc86b('0x42')],_0x303592[_0xc86b('0x3e')]);_0x12e5d1[_0xc86b('0x43')]=_['intersection'](_0x303592[_0xc86b('0x42')],qs[_0xc86b('0x44')](_0x45f2c8['query'][_0xc86b('0x44')]));_0x12e5d1[_0xc86b('0x43')]=_0x12e5d1[_0xc86b('0x43')][_0xc86b('0x45')]?_0x12e5d1[_0xc86b('0x43')]:_0x303592[_0xc86b('0x42')];if(!_0x45f2c8['query']['hasOwnProperty']('nolimit')){_0x12e5d1[_0xc86b('0x31')]=qs[_0xc86b('0x31')](_0x45f2c8[_0xc86b('0x3e')][_0xc86b('0x31')]);_0x12e5d1[_0xc86b('0x2e')]=qs['offset'](_0x45f2c8['query'][_0xc86b('0x2e')]);}_0x12e5d1['order']=qs[_0xc86b('0x46')](_0x45f2c8[_0xc86b('0x3e')]['sort']);_0x12e5d1[_0xc86b('0x47')]=qs['filters'](_['pick'](_0x45f2c8['query'],_0x303592['filters']),_0x339fbe);if(_0x45f2c8[_0xc86b('0x3e')][_0xc86b('0x48')]){_0x12e5d1[_0xc86b('0x47')]=_['merge'](_0x12e5d1['where'],{'$or':_[_0xc86b('0x38')](_0x339fbe,function(_0x1d5686){if(_0x1d5686[_0xc86b('0x3c')]!==_0xc86b('0x49')){var _0x5160a3={};_0x5160a3[_0x1d5686[_0xc86b('0x37')]]={'$like':'%'+_0x45f2c8[_0xc86b('0x3e')]['filter']+'%'};return _0x5160a3;}})});}_0x12e5d1=_[_0xc86b('0x4a')]({},_0x12e5d1,_0x45f2c8[_0xc86b('0x4b')]);var _0x4fa0f9={'where':_0x12e5d1[_0xc86b('0x47')]};return db[_0xc86b('0x39')][_0xc86b('0x30')](_0x4fa0f9)[_0xc86b('0x20')](function(_0x1b2d43){_0x56c67e[_0xc86b('0x30')]=_0x1b2d43;if(_0x45f2c8[_0xc86b('0x3e')][_0xc86b('0x4c')]){_0x12e5d1[_0xc86b('0x4d')]=[{'all':!![]}];}return db[_0xc86b('0x39')][_0xc86b('0x4e')](_0x12e5d1);})[_0xc86b('0x20')](function(_0x5922e3){_0x56c67e['rows']=_0x5922e3;return _0x56c67e;})[_0xc86b('0x20')](respondWithFilteredResult(_0x2116be,_0x12e5d1))['catch'](handleError(_0x2116be,null));};exports[_0xc86b('0x4f')]=function(_0x28f9a6,_0x5e8bcc){var _0x4960a1={'raw':!![],'where':{'id':_0x28f9a6[_0xc86b('0x50')]['id']}},_0x2ed442={};_0x2ed442[_0xc86b('0x42')]=_[_0xc86b('0x3f')](db['SmsMessage'][_0xc86b('0x3a')]);_0x2ed442[_0xc86b('0x3e')]=_['keys'](_0x28f9a6[_0xc86b('0x3e')]);_0x2ed442[_0xc86b('0x40')]=_[_0xc86b('0x41')](_0x2ed442[_0xc86b('0x42')],_0x2ed442[_0xc86b('0x3e')]);_0x4960a1['attributes']=_['intersection'](_0x2ed442[_0xc86b('0x42')],qs['fields'](_0x28f9a6['query'][_0xc86b('0x44')]));_0x4960a1['attributes']=_0x4960a1[_0xc86b('0x43')][_0xc86b('0x45')]?_0x4960a1[_0xc86b('0x43')]:_0x2ed442[_0xc86b('0x42')];if(_0x28f9a6['query'][_0xc86b('0x4c')]){_0x4960a1[_0xc86b('0x4d')]=[{'all':!![]}];}_0x4960a1=_[_0xc86b('0x4a')]({},_0x4960a1,_0x28f9a6[_0xc86b('0x4b')]);return db[_0xc86b('0x39')][_0xc86b('0x51')](_0x4960a1)[_0xc86b('0x20')](handleEntityNotFound(_0x5e8bcc,null))[_0xc86b('0x20')](respondWithResult(_0x5e8bcc,null))[_0xc86b('0x2a')](handleError(_0x5e8bcc,null));};exports[_0xc86b('0x52')]=function(_0x3dfb67,_0x2b374c){return db[_0xc86b('0x39')][_0xc86b('0x52')](_0x3dfb67[_0xc86b('0x53')],{})[_0xc86b('0x20')](respondWithResult(_0x2b374c,0xc9))[_0xc86b('0x2a')](handleError(_0x2b374c,null));};exports['update']=function(_0x4cb885,_0x42efe6){if(_0x4cb885['body']['id']){delete _0x4cb885[_0xc86b('0x53')]['id'];}return db[_0xc86b('0x39')][_0xc86b('0x51')]({'where':{'id':_0x4cb885[_0xc86b('0x50')]['id']}})[_0xc86b('0x20')](handleEntityNotFound(_0x42efe6,null))['then'](saveUpdates(_0x4cb885[_0xc86b('0x53')],null))[_0xc86b('0x20')](respondWithResult(_0x42efe6,null))[_0xc86b('0x2a')](handleError(_0x42efe6,null));};exports[_0xc86b('0x36')]=function(_0x190c19,_0x528289){return db[_0xc86b('0x39')][_0xc86b('0x51')]({'where':{'id':_0x190c19[_0xc86b('0x50')]['id']}})[_0xc86b('0x20')](handleEntityNotFound(_0x528289,null))[_0xc86b('0x20')](removeEntity(_0x528289,null))['catch'](handleError(_0x528289,null));};exports['describe']=function(_0x403dfe,_0x11077c){return db[_0xc86b('0x39')][_0xc86b('0x54')]()[_0xc86b('0x20')](respondWithResult(_0x11077c,null))[_0xc86b('0x2a')](handleError(_0x11077c,null));};var interaction_log=require(_0xc86b('0x14'))(_0xc86b('0x55'));exports['accept']=function(_0x1bb889,_0x36fd92,_0x3f101f){var _0x26d5d9={'agent':{},'channel':_0xc86b('0x56')};if(_0x1bb889[_0xc86b('0x53')]['id']){delete _0x1bb889['body']['id'];}_0x1bb889[_0xc86b('0x53')][_0xc86b('0x57')]=!![];_0x1bb889[_0xc86b('0x53')]['readAt']=moment()[_0xc86b('0x58')](_0xc86b('0x59'));_0x1bb889['body'][_0xc86b('0x5a')]=_0x1bb889[_0xc86b('0x53')][_0xc86b('0x5a')]||_0x1bb889['user']['id'];_0x26d5d9[_0xc86b('0x5b')]['id']=_0x1bb889[_0xc86b('0x53')][_0xc86b('0x5a')];return db[_0xc86b('0x39')]['find']({'where':{'id':_0x1bb889[_0xc86b('0x50')]['id'],'UserId':null}})[_0xc86b('0x20')](handleEntityNotFound(_0x36fd92,null))[_0xc86b('0x20')](saveUpdates(_0x1bb889[_0xc86b('0x53')],null))[_0xc86b('0x20')](function(_0xe6fde6){if(_0xe6fde6){_0x26d5d9[_0xc86b('0x27')]=_0xe6fde6[_0xc86b('0x5c')]({'plain':!![]});return db[_0xc86b('0x5d')][_0xc86b('0x51')]({'where':{'id':_0xe6fde6['SmsInteractionId']}});}return null;})[_0xc86b('0x20')](handleEntityNotFound(_0x36fd92,null))[_0xc86b('0x20')](function(_0x3db00f){if(_0x3db00f){return _0x3db00f[_0xc86b('0x35')]({'UserId':_0x1bb889[_0xc86b('0x53')][_0xc86b('0x5a')],'read1stAt':_[_0xc86b('0x5e')](_0x3db00f['read1stAt'])?moment()[_0xc86b('0x58')](_0xc86b('0x59')):undefined});}return null;})[_0xc86b('0x20')](function(_0x386a86){if(_0x386a86){_0x26d5d9['interaction']=_0x386a86[_0xc86b('0x5c')]({'plain':!![]});interaction_log[_0xc86b('0x21')](_0xc86b('0x5f'),_0x1bb889[_0xc86b('0x60')]['id'],_0x1bb889[_0xc86b('0x60')][_0xc86b('0x37')],_0x1bb889[_0xc86b('0x60')]['role'],_0x26d5d9[_0xc86b('0x61')]['id'],_0x1bb889[_0xc86b('0x53')]?JSON[_0xc86b('0x24')](_0x1bb889[_0xc86b('0x53')]):_0xc86b('0x62'));return respondWithRpcPromise('AcceptMessage',_0xc86b('0x63'),_0x26d5d9);}return null;})[_0xc86b('0x20')](function(_0x290a97){var _0x36382f=_0xc86b('0x64')+_0x290a97['message'][_0xc86b('0x65')];return db[_0xc86b('0x66')][_0xc86b('0x3e')](_0x36382f,{'type':db['Sequelize'][_0xc86b('0x67')][_0xc86b('0x68')],'raw':!![]})[_0xc86b('0x20')](function(_0x50bfd8){return _0x50bfd8;});})[_0xc86b('0x20')](function(_0x49ce1e){if(_0x49ce1e){_0x26d5d9[_0xc86b('0x27')][_0xc86b('0x69')]=_0x49ce1e[0x0];if(!_0x1bb889[_0xc86b('0x53')][_0xc86b('0x5a')])return;return db['User']['find']({'where':{'id':_0x1bb889['body'][_0xc86b('0x5a')],'role':_0xc86b('0x5b')},'attributes':['id',_0xc86b('0x37'),_0xc86b('0x6a'),'email',_0xc86b('0x6b')],'raw':!![]});}return null;})[_0xc86b('0x20')](function(_0x49acc7){if(!_0x49acc7)return null;_0x26d5d9[_0xc86b('0x27')][_0xc86b('0x5b')]=_0x49acc7;return _0x26d5d9;})[_0xc86b('0x20')](function(_0x49cedc){if(_0x49cedc){if(_0x1bb889[_0xc86b('0x53')][_0xc86b('0x6c')]){_0x26d5d9['message'][_0xc86b('0x6d')]=util[_0xc86b('0x58')](_0xc86b('0x6e'),_0x1bb889[_0xc86b('0x60')][_0xc86b('0x37')]);_0x26d5d9[_0xc86b('0x27')][_0xc86b('0x6f')]=_0x26d5d9[_0xc86b('0x6f')];_0x26d5d9[_0xc86b('0x27')]['motionChannel']=_0x26d5d9[_0xc86b('0x6f')];_0x26d5d9['message'][_0xc86b('0x70')]=_0xc86b('0x71');return respondWithRpcPromise('EventManager',_0xc86b('0x72'),{'event':'acceptmessage','message':_0x26d5d9[_0xc86b('0x27')]},client9002)['then'](function(){return _0x26d5d9;});}return _0x26d5d9;}return null;})[_0xc86b('0x20')](respondWithResult(_0x36fd92,null))[_0xc86b('0x2a')](handleError(_0x36fd92,null));};var interaction_log=require(_0xc86b('0x14'))(_0xc86b('0x55'));exports['reject']=function(_0x4da164,_0x113e3e,_0x46bbf4){var _0x8329d4={'agent':{},'channel':_0xc86b('0x56')};if(_0x4da164['body']['id']){delete _0x4da164[_0xc86b('0x53')]['id'];}_0x4da164[_0xc86b('0x53')][_0xc86b('0x5a')]=_0x4da164['body']['UserId']||_0x4da164[_0xc86b('0x60')]['id'];_0x8329d4[_0xc86b('0x5b')]['id']=_0x4da164[_0xc86b('0x53')][_0xc86b('0x5a')];return db[_0xc86b('0x39')]['find']({'where':{'id':_0x4da164[_0xc86b('0x50')]['id'],'UserId':null}})[_0xc86b('0x20')](handleEntityNotFound(_0x113e3e,null))[_0xc86b('0x20')](function(_0x3b6aee){if(_0x3b6aee){_0x8329d4['message']=_0x3b6aee['get']({'plain':!![]});return db[_0xc86b('0x5d')][_0xc86b('0x51')]({'where':{'id':_0x3b6aee[_0xc86b('0x73')]}});}return null;})[_0xc86b('0x20')](handleEntityNotFound(_0x113e3e,null))['then'](function(_0x5f328a){if(_0x5f328a){_0x8329d4['interaction']=_0x5f328a[_0xc86b('0x5c')]({'plain':!![]});interaction_log[_0xc86b('0x21')](_0xc86b('0x74'),_0x4da164[_0xc86b('0x60')]['id'],_0x4da164[_0xc86b('0x60')]['name'],_0x4da164[_0xc86b('0x60')][_0xc86b('0x75')],_0x8329d4[_0xc86b('0x61')]['id'],_0x4da164['body']?JSON[_0xc86b('0x24')](_0x4da164[_0xc86b('0x53')]):_0xc86b('0x62'));return respondWithRpcPromise(_0xc86b('0x76'),_0xc86b('0x77'),_0x8329d4);}return null;})[_0xc86b('0x20')](function(_0x303aa8){var _0x426a88=_0xc86b('0x64')+_0x303aa8[_0xc86b('0x27')][_0xc86b('0x65')];return db[_0xc86b('0x66')][_0xc86b('0x3e')](_0x426a88,{'type':db[_0xc86b('0x78')][_0xc86b('0x67')][_0xc86b('0x68')],'raw':!![]})[_0xc86b('0x20')](function(_0x451a5b){return _0x451a5b;});})[_0xc86b('0x20')](function(_0x1c3316){if(_0x1c3316){_0x8329d4[_0xc86b('0x27')][_0xc86b('0x69')]=_0x1c3316[0x0];if(!_0x4da164['body'][_0xc86b('0x5a')])return;return db[_0xc86b('0x79')][_0xc86b('0x51')]({'where':{'id':_0x4da164['body']['UserId'],'role':'agent'},'attributes':['id',_0xc86b('0x37'),'fullname',_0xc86b('0x7a'),_0xc86b('0x6b')],'raw':!![]});}return null;})[_0xc86b('0x20')](function(_0x520b06){if(!_0x520b06)return null;_0x8329d4[_0xc86b('0x27')][_0xc86b('0x5b')]=_0x520b06;return _0x8329d4;})[_0xc86b('0x20')](function(_0x4b7e28){if(_0x4b7e28){_0x4b7e28['message'][_0xc86b('0x6d')]=util['format'](_0xc86b('0x6e'),_0x4da164[_0xc86b('0x60')][_0xc86b('0x37')]);_0x4b7e28[_0xc86b('0x27')][_0xc86b('0x6f')]=_0x8329d4[_0xc86b('0x6f')];_0x4b7e28[_0xc86b('0x27')]['motionChannel']=_0x8329d4['channel'];_0x4b7e28[_0xc86b('0x27')][_0xc86b('0x70')]=_0xc86b('0x34');respondWithRpcPromise(_0xc86b('0x72'),'EventManager',{'event':_0xc86b('0x7b'),'message':_0x4b7e28[_0xc86b('0x27')]},client9002);return _0x8329d4;}return null;})[_0xc86b('0x20')](respondWithResult(_0x113e3e,null))['catch'](handleError(_0x113e3e,null));};exports['status']=function(_0x3695ed,_0x11787c,_0x5f23e0){if(_0x3695ed[_0xc86b('0x53')]['id']){delete _0x3695ed[_0xc86b('0x53')]['id'];}var _0x3d3478;return db[_0xc86b('0x39')]['find']({'where':{'id':_0x3695ed[_0xc86b('0x50')]['id']}})[_0xc86b('0x20')](handleEntityNotFound(_0x11787c,null))[_0xc86b('0x20')](function(_0x10e1f5){if(_0x10e1f5){_0x3d3478=_0x10e1f5;return db[_0xc86b('0x7c')]['find']({'where':{'id':_0x10e1f5[_0xc86b('0x7d')]}});}})[_0xc86b('0x20')](handleEntityNotFound(_0x11787c,null))[_0xc86b('0x20')](function(_0x3a0f1d){if(_0x3a0f1d){logger[_0xc86b('0x23')](_0xc86b('0x7e'),_0xc86b('0x2b'),_0xc86b('0x7f'),_0x3a0f1d[_0xc86b('0x3c')],util[_0xc86b('0x80')](_0x3695ed[_0xc86b('0x53')],{'showHidden':![],'depth':null}));switch(_0x3a0f1d[_0xc86b('0x3c')]){case _0xc86b('0x81'):if(_0x3695ed['body'][_0xc86b('0x82')]&&_0x3695ed[_0xc86b('0x53')][_0xc86b('0x82')]===_0x3d3478[_0xc86b('0x83')]){return _0x3d3478[_0xc86b('0x35')]({'read':!![]});}else{logger[_0xc86b('0x28')](_0xc86b('0x84'),_0xc86b('0x2b'),_0xc86b('0x81'),util['inspect'](_0x3695ed['body'],{'showHidden':![],'depth':null}));}break;case _0xc86b('0x85'):if(_0x3695ed['body']['MessageUUID']&&_0x3695ed['body'][_0xc86b('0x86')]===_0x3d3478[_0xc86b('0x83')]&&_[_0xc86b('0x87')]([_0xc86b('0x88'),_0xc86b('0x89')],_0x3695ed['body'][_0xc86b('0x8a')])>=0x0){return _0x3d3478[_0xc86b('0x35')]({'read':!![]});}else{logger['error'](_0xc86b('0x84'),'status','plivio',util[_0xc86b('0x80')](_0x3695ed['body'],{'showHidden':![],'depth':null}));}break;case _0xc86b('0x8b'):var _0x15375c=_0x3695ed['body'][_0xc86b('0x8c')][0x0];if(_0x15375c['status']['groupName']==='DELIVERED'){return _0x3d3478[_0xc86b('0x35')]({'read':!![]});}else{logger[_0xc86b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc86b('0x2b'),'infobip',util[_0xc86b('0x80')](_0x3695ed['body'],{'showHidden':![],'depth':null}));}break;}return _0x3d3478;}})[_0xc86b('0x20')](respondWithResult(_0x11787c,null))['catch'](handleError(_0x11787c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e464945..3407db2 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 _0x56a5=['update','emit','hook','exports','events','save'];(function(_0x40247d,_0x4f4ccc){var _0x3ba764=function(_0x30aa76){while(--_0x30aa76){_0x40247d['push'](_0x40247d['shift']());}};_0x3ba764(++_0x4f4ccc);}(_0x56a5,0x9a));var _0x556a=function(_0x3aa39a,_0x22e843){_0x3aa39a=_0x3aa39a-0x0;var _0x7bfda=_0x56a5[_0x3aa39a];return _0x7bfda;};'use strict';var EventEmitter=require(_0x556a('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x556a('0x1'),'afterUpdate':_0x556a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5bbfc9){return function(_0x39e00b,_0x119482,_0x1dc293){SmsMessageEvents[_0x556a('0x3')](_0x5bbfc9+':'+_0x39e00b['id'],_0x39e00b);SmsMessageEvents[_0x556a('0x3')](_0x5bbfc9,_0x39e00b);_0x1dc293(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x556a('0x4')](e,emitEvent(event));}}module[_0x556a('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x4012=['hasOwnProperty','events','../../mysqldb','SmsMessage','setMaxListeners','update','emit'];(function(_0x49d7a1,_0x16f7cf){var _0x2bc1c2=function(_0x28d0b9){while(--_0x28d0b9){_0x49d7a1['push'](_0x49d7a1['shift']());}};_0x2bc1c2(++_0x16f7cf);}(_0x4012,0x12e));var _0x2401=function(_0x3797cf,_0x1234b5){_0x3797cf=_0x3797cf-0x0;var _0x56a87b=_0x4012[_0x3797cf];return _0x56a87b;};'use strict';var EventEmitter=require(_0x2401('0x0'));var SmsMessage=require(_0x2401('0x1'))['db'][_0x2401('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2401('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2401('0x4'),'afterDestroy':'remove'};function emitEvent(_0x319032){return function(_0x45d5ba,_0x2b0812,_0x525175){SmsMessageEvents[_0x2401('0x5')](_0x319032+':'+_0x45d5ba['id'],_0x45d5ba);SmsMessageEvents[_0x2401('0x5')](_0x319032,_0x45d5ba);_0x525175(null);};}for(var e in events){if(events[_0x2401('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 23c7412..ef7a78b 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 _0x06fe=['accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','error','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','clickSend','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','csc','crypto','apiKey','sort','createHash','md5','signature=','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','type','twilio'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x06fe,0xda));var _0xe06f=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x06fe[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var logger=require(_0xe06f('0x2'))(_0xe06f('0x3'));var moment=require(_0xe06f('0x4'));var BPromise=require(_0xe06f('0x5'));var rp=require(_0xe06f('0x6'));var fs=require('fs');var path=require(_0xe06f('0x7'));var rimraf=require(_0xe06f('0x8'));var config=require(_0xe06f('0x9'));var attributes=require(_0xe06f('0xa'));module[_0xe06f('0xb')]=function(_0x5d609f,_0x2d6a44){return _0x5d609f[_0xe06f('0xc')](_0xe06f('0xd'),attributes,{'tableName':_0xe06f('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xe06f('0xf')]},{'name':'fti_sms_messages','fields':[_0xe06f('0x10')],'type':_0xe06f('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x402bc7,_0x4dd411,_0x41f172){var _0x2f0844=_0x5d609f[_0xe06f('0x12')];var _0x3121c0=_0x402bc7[_0xe06f('0x13')]({'plain':!![]});if(_0x3121c0[_0xe06f('0x14')]['toLowerCase']()==='in'||_0x3121c0[_0xe06f('0x14')][_0xe06f('0x15')]()===_0xe06f('0x16')&&!_0x3121c0[_0xe06f('0x17')]&&!_[_0xe06f('0x18')](_0x3121c0[_0xe06f('0x19')])&&!_['isNil'](_0x3121c0[_0xe06f('0x1a')])){_0x2f0844[_0xe06f('0x1b')][_0xe06f('0x1c')]({'where':{'id':_0x3121c0['SmsInteractionId']}})[_0xe06f('0x1d')](function(_0x947991){if(_0x947991){_0x947991[_0xe06f('0x1e')]({'lastMsgAt':_0x3121c0['createdAt'],'lastMsgDirection':_0x3121c0[_0xe06f('0x14')][_0xe06f('0x15')]()});}})[_0xe06f('0x1f')](function(_0x2b5677){console['error'](_0x2b5677);});}if(_0x3121c0[_0xe06f('0x14')]===_0xe06f('0x16')&&!_0x3121c0[_0xe06f('0x17')]){var _0x22878e;_0x2f0844[_0xe06f('0x20')][_0xe06f('0x21')]({'where':{'id':_0x3121c0['SmsAccountId']},'raw':!![]})[_0xe06f('0x1d')](function(_0x3a3a2b){_0x22878e=_0x3a3a2b;if(_0x22878e&&_0x22878e['type']){switch(_0x22878e[_0xe06f('0x22')]){case _0xe06f('0x23'):var _0x21cb95=require(_0xe06f('0x23'));if(_0x22878e[_0xe06f('0x24')]&&_0x22878e[_0xe06f('0x25')]&&_0x22878e[_0xe06f('0x26')]){var _0x2a5d06=new _0x21cb95(_0x22878e[_0xe06f('0x24')],_0x22878e['authToken']);_0x2a5d06[_0xe06f('0x27')][_0xe06f('0x28')]({'body':_0x3121c0[_0xe06f('0x10')],'to':_0x3121c0[_0xe06f('0x26')],'from':_0x22878e[_0xe06f('0x26')],'statusCallback':_0x22878e[_0xe06f('0x29')]+_0xe06f('0x2a')+_0x3121c0['id']+_0xe06f('0x2b')+_0x22878e[_0xe06f('0x2c')]})[_0xe06f('0x1d')](function(_0x175919){if(_0x175919[_0xe06f('0x2d')]){return _0x402bc7['update']({'messageId':_0x175919[_0xe06f('0x2d')]});}})[_0xe06f('0x1f')](function(_0x533b0e){logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x23'),util['inspect'](_0x533b0e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x23'),_0xe06f('0x30'));}break;case'skebby':var _0x2ae003=_0xe06f('0x31');if(_0x22878e[_0xe06f('0x32')]&&_0x22878e['password']){var _0x3cedd4={'recipient':[_0x3121c0[_0xe06f('0x26')]],'message':_0x3121c0[_0xe06f('0x10')],'message_type':_0x22878e[_0xe06f('0x33')]};if(_0x22878e[_0xe06f('0x33')]&&_0x22878e[_0xe06f('0x33')]!=='SI'){_0x3cedd4[_0xe06f('0x34')]=_0x22878e[_0xe06f('0x26')];}var _0x6277da={'url':_0x2ae003+_0xe06f('0x35')+_0x22878e[_0xe06f('0x32')]+_0xe06f('0x36')+_0x22878e[_0xe06f('0x37')],'method':'GET'};rp(_0x6277da)[_0xe06f('0x1d')](function(_0x474844){var _0x445ac2=_0x474844[_0xe06f('0x38')](';');var _0x3674af={'user_key':_0x445ac2[0x0],'session_key':_0x445ac2[0x1]};_0x6277da={'url':_0x2ae003+_0xe06f('0x39'),'method':_0xe06f('0x3a'),'headers':{'user_key':_0x3674af['user_key'],'Session_key':_0x3674af[_0xe06f('0x3b')]},'json':!![],'body':_0x3cedd4};return rp(_0x6277da);})[_0xe06f('0x1d')](function(_0x9aa4db){if(_0x9aa4db[_0xe06f('0x3c')]>=0x1){var _0x2ea543={'messageId':_0x9aa4db[_0xe06f('0x3d')]};if(_0x22878e[_0xe06f('0x33')]!=='GP'||!_0x22878e[_0xe06f('0x3e')]){_0x2ea543[_0xe06f('0x3f')]=!![];}return _0x402bc7['update'](_0x2ea543);}else{return logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x40'),util['inspect'](_0x9aa4db,{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x1bd29f){return logger[_0xe06f('0x41')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe06f('0x2f'),_0xe06f('0x40'),util[_0xe06f('0x42')](_0x1bd29f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x40'),_0xe06f('0x43'));}break;case _0xe06f('0x44'):if(_0x22878e[_0xe06f('0x25')]){var _0x1f0b89={'recipient':_0x3121c0[_0xe06f('0x26')],'message':_0x3121c0[_0xe06f('0x10')],'sender':_0x22878e[_0xe06f('0x45')]||_0x22878e['phone'],'authorization':_0x22878e[_0xe06f('0x25')]};var _0x4dd411={'method':_0xe06f('0x3a'),'uri':_0xe06f('0x46'),'body':_0x1f0b89,'json':!![]};rp(_0x4dd411)['then'](function(_0x1b63fb){var _0x2ba051={'messageId':_0x1b63fb[_0xe06f('0x47')]};if(!_0x22878e[_0xe06f('0x3e')]){_0x2ba051[_0xe06f('0x3f')]=!![];}return _0x402bc7[_0xe06f('0x1e')](_0x2ba051);})[_0xe06f('0x1f')](function(_0x21770d){logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),'connectel',util[_0xe06f('0x42')](_0x21770d,{'showHidden':![],'depth':null}));});}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x22878e[_0xe06f('0x32')]&&_0x22878e[_0xe06f('0x37')]){var _0x1f0b89={'messages':[{'source':_0xe06f('0x48'),'to':_0x3121c0[_0xe06f('0x26')],'body':_0x3121c0[_0xe06f('0x10')],'from':_0x22878e[_0xe06f('0x45')]||_0x22878e[_0xe06f('0x26')]}]};var _0xed3409=util['format'](_0xe06f('0x49'),_0x22878e['username'],_0x22878e['password']);var _0x4dd411={'method':_0xe06f('0x3a'),'uri':_0xe06f('0x4a'),'body':_0x1f0b89,'headers':{'Authorization':util[_0xe06f('0x4b')]('Basic\x20%s',new Buffer(_0xed3409)[_0xe06f('0x4c')](_0xe06f('0x4d')))},'json':!![]};rp(_0x4dd411)[_0xe06f('0x1d')](function(_0x4466fe){if(_0x4466fe['http_code']>=0xc8&&_0x4466fe[_0xe06f('0x4e')]<=0xce){if(_0x4466fe[_0xe06f('0x4f')]&&_0x4466fe[_0xe06f('0x4f')][_0xe06f('0x50')]>0x0){var _0x3b0cd0=_[_0xe06f('0x51')](_0x4466fe[_0xe06f('0x4f')][_0xe06f('0x27')]);var _0x1fa66f={'messageId':_0x3b0cd0['message_id']};if(!_0x22878e[_0xe06f('0x3e')]){_0x1fa66f[_0xe06f('0x3f')]=!![];}return _0x402bc7[_0xe06f('0x1e')](_0x1fa66f);}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x52'),util['inspect'](_0x4466fe,{'showHidden':![],'depth':null}));}}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x52'),util[_0xe06f('0x42')](_0x4466fe,{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x46ef5c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe06f('0x2f'),_0xe06f('0x52'),util['inspect'](_0x46ef5c,{'showHidden':![],'depth':null}));});}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x52'),_0xe06f('0x43'));}break;case'plivo':if(_0x22878e[_0xe06f('0x53')]&&_0x22878e['authToken']){var _0x1f0b89={'dst':_0x3121c0['phone'],'text':_0x3121c0[_0xe06f('0x10')],'src':_0x22878e['senderString']||_0x22878e['phone'],'url':_0x22878e[_0xe06f('0x29')]+_0xe06f('0x2a')+_0x3121c0['id']+_0xe06f('0x2b')+_0x22878e[_0xe06f('0x2c')]};var _0xed3409=util[_0xe06f('0x4b')](_0xe06f('0x49'),_0x22878e[_0xe06f('0x53')],_0x22878e[_0xe06f('0x25')]);var _0x4dd411={'method':_0xe06f('0x3a'),'uri':util[_0xe06f('0x4b')](_0xe06f('0x54'),_0x22878e[_0xe06f('0x53')]),'body':_0x1f0b89,'headers':{'Authorization':util[_0xe06f('0x4b')]('Basic\x20%s',new Buffer(_0xed3409)[_0xe06f('0x4c')]('base64'))},'json':!![]};rp(_0x4dd411)[_0xe06f('0x1d')](function(_0x2b78f0){var _0x538530={'messageId':_0x2b78f0[_0xe06f('0x55')][0x0]};return _0x402bc7[_0xe06f('0x1e')](_0x538530);})[_0xe06f('0x1f')](function(_0x2e65bf){logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),'plivo',util[_0xe06f('0x42')](_0x2e65bf,{'showHidden':![],'depth':null}));});}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x56'),_0xe06f('0x57'));}break;case _0xe06f('0x58'):if(_0x22878e['username']&&_0x22878e[_0xe06f('0x37')]){if(_0x22878e[_0xe06f('0x59')]){var _0x100691={'method':_0xe06f('0x3a'),'uri':_0x22878e['baseUrl']+_0xe06f('0x5a'),'body':{'username':_0x22878e[_0xe06f('0x32')],'password':_0x22878e[_0xe06f('0x37')]},'json':!![]};return rp(_0x100691)[_0xe06f('0x1d')](function(_0x33af75){var _0x4b9ca2={'method':_0xe06f('0x3a'),'uri':_0x22878e['baseUrl']+_0xe06f('0x5b'),'body':{'messages':[{'from':_0x22878e[_0xe06f('0x26')],'destinations':[{'to':_0x3121c0[_0xe06f('0x26')]}],'text':_0x3121c0[_0xe06f('0x10')],'notifyUrl':_0x22878e['remote']+_0xe06f('0x2a')+_0x3121c0['id']+_0xe06f('0x2b')+_0x22878e[_0xe06f('0x2c')],'notifyContentType':'application/json','callbackData':_0x22878e[_0xe06f('0x26')]+';'+_0x3121c0[_0xe06f('0x10')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x33af75[_0xe06f('0x2c')]},'json':!![]};return rp(_0x4b9ca2)['then'](function(_0x5b00f3){if(_0x5b00f3['messages']){var _0xc0c9f={'messageId':_0x5b00f3[_0xe06f('0x27')][0x0][_0xe06f('0xf')]};if(!_0x22878e['deliveryReport']){_0xc0c9f[_0xe06f('0x3f')]=!![];}return _0x402bc7[_0xe06f('0x1e')](_0xc0c9f);}else{return logger[_0xe06f('0x41')](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x58'),util[_0xe06f('0x42')](_0x5b00f3,{'showHidden':![],'depth':null}));}});})[_0xe06f('0x1f')](function(_0xd341f2){return logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x58'),util[_0xe06f('0x42')](_0xd341f2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe06f('0x2f'),_0xe06f('0x58'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x58'),_0xe06f('0x43'));}break;case _0xe06f('0x5c'):var _0x84afbc=require(_0xe06f('0x5d'));if(_0x22878e[_0xe06f('0x5e')]){var _0x34c6e2={};_0x34c6e2['login']=_0x22878e[_0xe06f('0x32')];_0x34c6e2[_0xe06f('0x26')]=_0x3121c0[_0xe06f('0x26')];_0x34c6e2[_0xe06f('0x34')]=_0x22878e[_0xe06f('0x26')];_0x34c6e2['text']=_0x3121c0[_0xe06f('0x10')];_0x34c6e2['timestamp']=+new Date();var _0x4204ae='';var _0x59bd5b='';var _0x12dc28=Object['keys'](_0x34c6e2);_0x12dc28[_0xe06f('0x5f')]();for(var _0x245599=0x0;_0x245599<_0x12dc28['length'];_0x245599++){if(_0x4204ae!=''){_0x4204ae+='&';}_0x4204ae+=_0x12dc28[_0x245599]+'='+encodeURIComponent(_0x34c6e2[_0x12dc28[_0x245599]]);_0x59bd5b+=_0x34c6e2[_0x12dc28[_0x245599]];}_0x59bd5b+=_0x22878e[_0xe06f('0x5e')];_0x59bd5b=_0x84afbc[_0xe06f('0x60')](_0xe06f('0x61'))[_0xe06f('0x1e')](_0x59bd5b)['digest']('hex');if(_0x4204ae!==''){_0x4204ae+='&';}_0x4204ae+=_0xe06f('0x62')+_0x59bd5b;var _0x6277da={'method':_0xe06f('0x63'),'uri':_0x22878e['baseUrl']+_0xe06f('0x64')+_0x4204ae,'json':!![]};return rp(_0x6277da)[_0xe06f('0x1d')](function(_0xb624cd){var _0x3c1834=Object[_0xe06f('0x65')](_0xb624cd);if(_0xb624cd[_0x3c1834[0x0]][_0xe06f('0x41')]&&parseInt(_0xb624cd[_0x3c1834[0x0]]['error'])===0x0){var _0x16843d={'messageId':_0xb624cd[_0x3c1834[0x0]][_0xe06f('0x66')]};if(!_0x22878e[_0xe06f('0x3e')]){_0x16843d[_0xe06f('0x3f')]=!![];}return _0x402bc7['update'](_0x16843d);}else{return logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x5c'),util[_0xe06f('0x42')](_0xb624cd[_0xe06f('0x41')],{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x337bd){return logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x5c'),util['inspect'](_0x337bd,{'showHidden':![],'depth':null}));});}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x5c'),_0xe06f('0x67'));}break;case'clickatell':if(_0x22878e[_0xe06f('0x5e')]){var _0x4bdfdf={'method':_0xe06f('0x3a'),'uri':_0xe06f('0x68'),'headers':{'Authorization':_0x22878e[_0xe06f('0x5e')]},'body':{'content':_0x3121c0[_0xe06f('0x10')],'to':[_0x3121c0[_0xe06f('0x26')]],'from':_0x22878e[_0xe06f('0x26')],'binary':![],'clientMessageId':_0xe06f('0x69'),'charset':_0xe06f('0x6a')},'json':!![]};rp(_0x4bdfdf)[_0xe06f('0x1d')](function(_0x5e9013){if(!_0x5e9013['error']){var _0x5f2d78={'messageId':_0x5e9013['messages'][0x0][_0xe06f('0x6b')]};if(!_0x22878e['deliveryReport']){_0x5f2d78[_0xe06f('0x3f')]=!![];}return _0x402bc7[_0xe06f('0x1e')](_0x5f2d78);}else{return logger[_0xe06f('0x41')](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x6c'),util[_0xe06f('0x42')](_0x5e9013[_0xe06f('0x41')],{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x4576a0){return logger['error'](_0xe06f('0x2e'),_0xe06f('0x2f'),_0xe06f('0x6c'),util[_0xe06f('0x42')](_0x4576a0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe06f('0x6c'),_0xe06f('0x67'));}break;case _0xe06f('0x6d'):if(_0x22878e[_0xe06f('0x32')]&&_0x22878e[_0xe06f('0x37')]){var _0xed3409=util[_0xe06f('0x4b')](_0xe06f('0x49'),_0x22878e[_0xe06f('0x32')],_0x22878e[_0xe06f('0x37')]);var _0x4dd411={'method':'POST','uri':_0xe06f('0x6e')+_0x22878e[_0xe06f('0x6f')]+_0xe06f('0x70'),'body':{'to':[_0x3121c0['phone']],'text':_0x3121c0['body'],'from':_0x22878e[_0xe06f('0x26')],'applicationId':_0x22878e[_0xe06f('0x71')]},'headers':{'Authorization':util[_0xe06f('0x4b')](_0xe06f('0x72'),new Buffer(_0xed3409)[_0xe06f('0x4c')](_0xe06f('0x4d')))},'json':!![]};rp(_0x4dd411)[_0xe06f('0x1d')](function(_0x292fad){if(_0x292fad['id']){var _0x50de1f={'messageId':_0x292fad['id']};return _0x402bc7[_0xe06f('0x1e')](_0x50de1f);}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x6d'),util[_0xe06f('0x42')](_0x292fad,{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x5a5847){logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),'bandwidth',util[_0xe06f('0x42')](_0x5a5847,{'showHidden':![],'depth':null}));});}else{logger[_0xe06f('0x41')](_0xe06f('0x2e'),_0xe06f('0x2f'),'bandwidth',_0xe06f('0x43'));}break;case _0xe06f('0x73'):if(_0x22878e['apiKey']){var _0x4ddcb2={};var _0x6277da={'method':_0xe06f('0x3a'),'uri':_0xe06f('0x74'),'headers':{'Authorization':_0xe06f('0x75')+_0x22878e[_0xe06f('0x5e')],'Content-Type':_0xe06f('0x76')},'body':{'from':_0x22878e['phone'],'to':_0x3121c0[_0xe06f('0x26')],'text':_0x3121c0[_0xe06f('0x10')]},'json':!![]};return rp(_0x6277da)[_0xe06f('0x1d')](function(_0x14804c){if(_0x14804c['code']==0xca){_0x4ddcb2['message']=_0x14804c;var _0x3431f7={'method':'POST','uri':_0xe06f('0x77'),'headers':{'Authorization':_0xe06f('0x75')+_0x22878e['apiKey'],'Content-Type':_0xe06f('0x76')},'body':{'refid':_0x4ddcb2[_0xe06f('0x78')][_0xe06f('0x79')]},'json':!![]};return rp(_0x3431f7)['then'](function(_0x5ed130){_0x4ddcb2[_0xe06f('0x7a')]=_0x5ed130;var _0x201940={'messageId':_0x4ddcb2['message'][_0xe06f('0x79')],'read':!![]};return _0x402bc7[_0xe06f('0x1e')](_0x201940);});}else{return logger[_0xe06f('0x41')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0xe06f('0x42')](_0x14804c,{'showHidden':![],'depth':null}));}})[_0xe06f('0x1f')](function(_0x5c096f){return logger[_0xe06f('0x41')](_0xe06f('0x2e'),'afterCreate',_0xe06f('0x73'),util[_0xe06f('0x42')](_0x5c096f,{'showHidden':![],'depth':null}));});}else{return logger[_0xe06f('0x41')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe06f('0x2f'),'intelepeer',_0xe06f('0x7b'));}break;}}})[_0xe06f('0x7c')](function(){_0x41f172();});}else{_0x41f172();}}},'charset':_0xe06f('0x7d'),'collate':_0xe06f('0x7e')});}; \ No newline at end of file +var _0x3e0b=['hex','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','body','models','get','toLowerCase','direction','out','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','csc','apiKey','timestamp','keys','createHash','md5','digest'];(function(_0x487f51,_0x268f8f){var _0xaf1452=function(_0x228ab7){while(--_0x228ab7){_0x487f51['push'](_0x487f51['shift']());}};_0xaf1452(++_0x268f8f);}(_0x3e0b,0x186));var _0xb3e0=function(_0x2632ab,_0x5bc3c2){_0x2632ab=_0x2632ab-0x0;var _0x29775f=_0x3e0b[_0x2632ab];return _0x29775f;};'use strict';var _=require('lodash');var util=require(_0xb3e0('0x0'));var logger=require('../../config/logger')(_0xb3e0('0x1'));var moment=require('moment');var BPromise=require(_0xb3e0('0x2'));var rp=require(_0xb3e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3e0('0x4'));var config=require(_0xb3e0('0x5'));var attributes=require('./smsMessage.attributes');module[_0xb3e0('0x6')]=function(_0x1c0898,_0x33c7a6){return _0x1c0898[_0xb3e0('0x7')](_0xb3e0('0x8'),attributes,{'tableName':_0xb3e0('0x9'),'paranoid':![],'indexes':[{'name':_0xb3e0('0xa'),'fields':[_0xb3e0('0xa')]},{'name':'fti_sms_messages','fields':[_0xb3e0('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41e63a,_0x102db1,_0x1013fe){var _0x4c2e6b=_0x1c0898[_0xb3e0('0xc')];var _0x3b3076=_0x41e63a[_0xb3e0('0xd')]({'plain':!![]});if(_0x3b3076['direction'][_0xb3e0('0xe')]()==='in'||_0x3b3076[_0xb3e0('0xf')]['toLowerCase']()===_0xb3e0('0x10')&&!_0x3b3076['secret']&&!_[_0xb3e0('0x11')](_0x3b3076[_0xb3e0('0x12')])&&!_[_0xb3e0('0x11')](_0x3b3076[_0xb3e0('0x13')])){_0x4c2e6b[_0xb3e0('0x14')]['findOne']({'where':{'id':_0x3b3076[_0xb3e0('0x13')]}})[_0xb3e0('0x15')](function(_0x222380){if(_0x222380){_0x222380[_0xb3e0('0x16')]({'lastMsgAt':_0x3b3076[_0xb3e0('0x17')],'lastMsgDirection':_0x3b3076[_0xb3e0('0xf')][_0xb3e0('0xe')]()});}})[_0xb3e0('0x18')](function(_0x2db5d4){console[_0xb3e0('0x19')](_0x2db5d4);});}if(_0x3b3076['direction']===_0xb3e0('0x10')&&!_0x3b3076[_0xb3e0('0x1a')]){var _0x13c97d;_0x4c2e6b[_0xb3e0('0x1b')][_0xb3e0('0x1c')]({'where':{'id':_0x3b3076[_0xb3e0('0x1d')]},'raw':!![]})[_0xb3e0('0x15')](function(_0x5cea92){_0x13c97d=_0x5cea92;if(_0x13c97d&&_0x13c97d[_0xb3e0('0x1e')]){switch(_0x13c97d[_0xb3e0('0x1e')]){case _0xb3e0('0x1f'):var _0x2b2022=require(_0xb3e0('0x1f'));if(_0x13c97d[_0xb3e0('0x20')]&&_0x13c97d[_0xb3e0('0x21')]&&_0x13c97d['phone']){var _0x4bc994=new _0x2b2022(_0x13c97d['accountSid'],_0x13c97d[_0xb3e0('0x21')]);_0x4bc994[_0xb3e0('0x22')][_0xb3e0('0x23')]({'body':_0x3b3076[_0xb3e0('0xb')],'to':_0x3b3076[_0xb3e0('0x24')],'from':_0x13c97d[_0xb3e0('0x24')],'statusCallback':_0x13c97d[_0xb3e0('0x25')]+_0xb3e0('0x26')+_0x3b3076['id']+_0xb3e0('0x27')+_0x13c97d[_0xb3e0('0x28')]})[_0xb3e0('0x15')](function(_0x20c020){if(_0x20c020[_0xb3e0('0x29')]){return _0x41e63a[_0xb3e0('0x16')]({'messageId':_0x20c020[_0xb3e0('0x29')]});}})[_0xb3e0('0x18')](function(_0x10a574){logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),'twilio',util['inspect'](_0x10a574,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb3e0('0x2c'):var _0x1b8260=_0xb3e0('0x2d');if(_0x13c97d[_0xb3e0('0x2e')]&&_0x13c97d[_0xb3e0('0x2f')]){var _0x3a960b={'recipient':[_0x3b3076['phone']],'message':_0x3b3076[_0xb3e0('0xb')],'message_type':_0x13c97d[_0xb3e0('0x30')]};if(_0x13c97d[_0xb3e0('0x30')]&&_0x13c97d[_0xb3e0('0x30')]!=='SI'){_0x3a960b[_0xb3e0('0x31')]=_0x13c97d[_0xb3e0('0x24')];}var _0x566abc={'url':_0x1b8260+_0xb3e0('0x32')+_0x13c97d['username']+_0xb3e0('0x33')+_0x13c97d['password'],'method':_0xb3e0('0x34')};rp(_0x566abc)[_0xb3e0('0x15')](function(_0x18f565){var _0x417aa6=_0x18f565[_0xb3e0('0x35')](';');var _0x448478={'user_key':_0x417aa6[0x0],'session_key':_0x417aa6[0x1]};_0x566abc={'url':_0x1b8260+_0xb3e0('0x36'),'method':_0xb3e0('0x37'),'headers':{'user_key':_0x448478[_0xb3e0('0x38')],'Session_key':_0x448478['session_key']},'json':!![],'body':_0x3a960b};return rp(_0x566abc);})[_0xb3e0('0x15')](function(_0x59c9b9){if(_0x59c9b9[_0xb3e0('0x39')]>=0x1){var _0x269afa={'messageId':_0x59c9b9[_0xb3e0('0x3a')]};if(_0x13c97d['smsMethod']!=='GP'||!_0x13c97d[_0xb3e0('0x3b')]){_0x269afa['read']=!![];}return _0x41e63a[_0xb3e0('0x16')](_0x269afa);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),_0xb3e0('0x2c'),util[_0xb3e0('0x3c')](_0x59c9b9,{'showHidden':![],'depth':null}));}})[_0xb3e0('0x18')](function(_0x31b1c6){return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),'skebby',util[_0xb3e0('0x3c')](_0x31b1c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x2c'),_0xb3e0('0x3d'));}break;case _0xb3e0('0x3e'):if(_0x13c97d[_0xb3e0('0x21')]){var _0x196490={'recipient':_0x3b3076['phone'],'message':_0x3b3076['body'],'sender':_0x13c97d[_0xb3e0('0x3f')]||_0x13c97d['phone'],'authorization':_0x13c97d[_0xb3e0('0x21')]};var _0x102db1={'method':'POST','uri':_0xb3e0('0x40'),'body':_0x196490,'json':!![]};rp(_0x102db1)['then'](function(_0x1ead51){var _0x59531a={'messageId':_0x1ead51[_0xb3e0('0x41')]};if(!_0x13c97d['deliveryReport']){_0x59531a[_0xb3e0('0x42')]=!![];}return _0x41e63a[_0xb3e0('0x16')](_0x59531a);})[_0xb3e0('0x18')](function(_0x4c9c25){logger['error'](_0xb3e0('0x2b'),'afterCreate','connectel',util['inspect'](_0x4c9c25,{'showHidden':![],'depth':null}));});}else{logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb3e0('0x3e'),_0xb3e0('0x43'));}break;case _0xb3e0('0x44'):if(_0x13c97d[_0xb3e0('0x2e')]&&_0x13c97d[_0xb3e0('0x2f')]){var _0x196490={'messages':[{'source':_0xb3e0('0x45'),'to':_0x3b3076['phone'],'body':_0x3b3076['body'],'from':_0x13c97d['senderString']||_0x13c97d[_0xb3e0('0x24')]}]};var _0x1ba9af=util['format'](_0xb3e0('0x46'),_0x13c97d[_0xb3e0('0x2e')],_0x13c97d[_0xb3e0('0x2f')]);var _0x102db1={'method':_0xb3e0('0x37'),'uri':_0xb3e0('0x47'),'body':_0x196490,'headers':{'Authorization':util[_0xb3e0('0x48')](_0xb3e0('0x49'),new Buffer(_0x1ba9af)[_0xb3e0('0x4a')]('base64'))},'json':!![]};rp(_0x102db1)[_0xb3e0('0x15')](function(_0x556223){if(_0x556223[_0xb3e0('0x4b')]>=0xc8&&_0x556223[_0xb3e0('0x4b')]<=0xce){if(_0x556223[_0xb3e0('0x4c')]&&_0x556223['data'][_0xb3e0('0x4d')]>0x0){var _0x50c992=_['head'](_0x556223[_0xb3e0('0x4c')]['messages']);var _0x4fef4b={'messageId':_0x50c992[_0xb3e0('0x4e')]};if(!_0x13c97d[_0xb3e0('0x3b')]){_0x4fef4b['read']=!![];}return _0x41e63a[_0xb3e0('0x16')](_0x4fef4b);}else{logger['error'](_0xb3e0('0x2b'),_0xb3e0('0x2a'),'clickSend',util['inspect'](_0x556223,{'showHidden':![],'depth':null}));}}else{logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),_0xb3e0('0x4f'),util['inspect'](_0x556223,{'showHidden':![],'depth':null}));}})['catch'](function(_0x195747){logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),'clickSend',util[_0xb3e0('0x3c')](_0x195747,{'showHidden':![],'depth':null}));});}else{logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x4f'),_0xb3e0('0x3d'));}break;case _0xb3e0('0x50'):if(_0x13c97d[_0xb3e0('0x51')]&&_0x13c97d[_0xb3e0('0x21')]){var _0x196490={'dst':_0x3b3076[_0xb3e0('0x24')],'text':_0x3b3076['body'],'src':_0x13c97d[_0xb3e0('0x3f')]||_0x13c97d[_0xb3e0('0x24')],'url':_0x13c97d[_0xb3e0('0x25')]+'/api/sms/messages/'+_0x3b3076['id']+_0xb3e0('0x27')+_0x13c97d[_0xb3e0('0x28')]};var _0x1ba9af=util[_0xb3e0('0x48')]('%s:%s',_0x13c97d[_0xb3e0('0x51')],_0x13c97d[_0xb3e0('0x21')]);var _0x102db1={'method':_0xb3e0('0x37'),'uri':util[_0xb3e0('0x48')](_0xb3e0('0x52'),_0x13c97d[_0xb3e0('0x51')]),'body':_0x196490,'headers':{'Authorization':util[_0xb3e0('0x48')](_0xb3e0('0x49'),new Buffer(_0x1ba9af)['toString'](_0xb3e0('0x53')))},'json':!![]};rp(_0x102db1)[_0xb3e0('0x15')](function(_0x1ff217){var _0x5a3eb8={'messageId':_0x1ff217[_0xb3e0('0x54')][0x0]};return _0x41e63a[_0xb3e0('0x16')](_0x5a3eb8);})[_0xb3e0('0x18')](function(_0x20922b){logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x50'),util['inspect'](_0x20922b,{'showHidden':![],'depth':null}));});}else{logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),'afterCreate','plivo',_0xb3e0('0x55'));}break;case'infobip':if(_0x13c97d[_0xb3e0('0x2e')]&&_0x13c97d['password']){if(_0x13c97d[_0xb3e0('0x56')]){var _0x3aeec9={'method':_0xb3e0('0x37'),'uri':_0x13c97d[_0xb3e0('0x56')]+_0xb3e0('0x57'),'body':{'username':_0x13c97d['username'],'password':_0x13c97d[_0xb3e0('0x2f')]},'json':!![]};return rp(_0x3aeec9)[_0xb3e0('0x15')](function(_0x944fa4){var _0x6e1307={'method':_0xb3e0('0x37'),'uri':_0x13c97d[_0xb3e0('0x56')]+_0xb3e0('0x58'),'body':{'messages':[{'from':_0x13c97d['phone'],'destinations':[{'to':_0x3b3076[_0xb3e0('0x24')]}],'text':_0x3b3076[_0xb3e0('0xb')],'notifyUrl':_0x13c97d['remote']+_0xb3e0('0x26')+_0x3b3076['id']+_0xb3e0('0x27')+_0x13c97d['token'],'notifyContentType':'application/json','callbackData':_0x13c97d[_0xb3e0('0x24')]+';'+_0x3b3076[_0xb3e0('0xb')]}]},'headers':{'Authorization':_0xb3e0('0x59')+_0x944fa4[_0xb3e0('0x28')]},'json':!![]};return rp(_0x6e1307)[_0xb3e0('0x15')](function(_0x326981){if(_0x326981['messages']){var _0x1676f2={'messageId':_0x326981[_0xb3e0('0x22')][0x0][_0xb3e0('0xa')]};if(!_0x13c97d[_0xb3e0('0x3b')]){_0x1676f2[_0xb3e0('0x42')]=!![];}return _0x41e63a['update'](_0x1676f2);}else{return logger['error'](_0xb3e0('0x2b'),'afterCreate',_0xb3e0('0x5a'),util[_0xb3e0('0x3c')](_0x326981,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5ac9ce){return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x5a'),util['inspect'](_0x5ac9ce,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),_0xb3e0('0x5a'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb3e0('0x5a'),_0xb3e0('0x3d'));}break;case _0xb3e0('0x5b'):var _0x248400=require('crypto');if(_0x13c97d[_0xb3e0('0x5c')]){var _0x17c32b={};_0x17c32b['login']=_0x13c97d['username'];_0x17c32b[_0xb3e0('0x24')]=_0x3b3076['phone'];_0x17c32b[_0xb3e0('0x31')]=_0x13c97d[_0xb3e0('0x24')];_0x17c32b['text']=_0x3b3076[_0xb3e0('0xb')];_0x17c32b[_0xb3e0('0x5d')]=+new Date();var _0x540d46='';var _0x1646c1='';var _0x16b9d4=Object[_0xb3e0('0x5e')](_0x17c32b);_0x16b9d4['sort']();for(var _0x35f9d6=0x0;_0x35f9d6<_0x16b9d4['length'];_0x35f9d6++){if(_0x540d46!=''){_0x540d46+='&';}_0x540d46+=_0x16b9d4[_0x35f9d6]+'='+encodeURIComponent(_0x17c32b[_0x16b9d4[_0x35f9d6]]);_0x1646c1+=_0x17c32b[_0x16b9d4[_0x35f9d6]];}_0x1646c1+=_0x13c97d[_0xb3e0('0x5c')];_0x1646c1=_0x248400[_0xb3e0('0x5f')](_0xb3e0('0x60'))['update'](_0x1646c1)[_0xb3e0('0x61')](_0xb3e0('0x62'));if(_0x540d46!==''){_0x540d46+='&';}_0x540d46+=_0xb3e0('0x63')+_0x1646c1;var _0x566abc={'method':_0xb3e0('0x34'),'uri':_0x13c97d[_0xb3e0('0x56')]+_0xb3e0('0x64')+_0x540d46,'json':!![]};return rp(_0x566abc)[_0xb3e0('0x15')](function(_0x8b3941){var _0x3271c4=Object[_0xb3e0('0x5e')](_0x8b3941);if(_0x8b3941[_0x3271c4[0x0]][_0xb3e0('0x19')]&&parseInt(_0x8b3941[_0x3271c4[0x0]]['error'])===0x0){var _0x377845={'messageId':_0x8b3941[_0x3271c4[0x0]]['id_sms']};if(!_0x13c97d[_0xb3e0('0x3b')]){_0x377845[_0xb3e0('0x42')]=!![];}return _0x41e63a[_0xb3e0('0x16')](_0x377845);}else{return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x5b'),util[_0xb3e0('0x3c')](_0x8b3941[_0xb3e0('0x19')],{'showHidden':![],'depth':null}));}})[_0xb3e0('0x18')](function(_0x1edf90){return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x5b'),util['inspect'](_0x1edf90,{'showHidden':![],'depth':null}));});}else{logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0xb3e0('0x65'):if(_0x13c97d[_0xb3e0('0x5c')]){var _0x4a5de6={'method':_0xb3e0('0x37'),'uri':_0xb3e0('0x66'),'headers':{'Authorization':_0x13c97d[_0xb3e0('0x5c')]},'body':{'content':_0x3b3076['body'],'to':[_0x3b3076['phone']],'from':_0x13c97d[_0xb3e0('0x24')],'binary':![],'clientMessageId':_0xb3e0('0x67'),'charset':_0xb3e0('0x68')},'json':!![]};rp(_0x4a5de6)[_0xb3e0('0x15')](function(_0x24d10e){if(!_0x24d10e['error']){var _0x21c1d0={'messageId':_0x24d10e[_0xb3e0('0x22')][0x0][_0xb3e0('0x69')]};if(!_0x13c97d['deliveryReport']){_0x21c1d0['read']=!![];}return _0x41e63a[_0xb3e0('0x16')](_0x21c1d0);}else{return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x65'),util[_0xb3e0('0x3c')](_0x24d10e[_0xb3e0('0x19')],{'showHidden':![],'depth':null}));}})[_0xb3e0('0x18')](function(_0x130f2d){return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),'afterCreate','clickatell',util[_0xb3e0('0x3c')](_0x130f2d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),_0xb3e0('0x65'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x13c97d[_0xb3e0('0x2e')]&&_0x13c97d['password']){var _0x1ba9af=util[_0xb3e0('0x48')](_0xb3e0('0x46'),_0x13c97d[_0xb3e0('0x2e')],_0x13c97d[_0xb3e0('0x2f')]);var _0x102db1={'method':_0xb3e0('0x37'),'uri':_0xb3e0('0x6a')+_0x13c97d[_0xb3e0('0x6b')]+_0xb3e0('0x6c'),'body':{'to':[_0x3b3076[_0xb3e0('0x24')]],'text':_0x3b3076[_0xb3e0('0xb')],'from':_0x13c97d[_0xb3e0('0x24')],'applicationId':_0x13c97d[_0xb3e0('0x6d')]},'headers':{'Authorization':util[_0xb3e0('0x48')](_0xb3e0('0x49'),new Buffer(_0x1ba9af)[_0xb3e0('0x4a')]('base64'))},'json':!![]};rp(_0x102db1)[_0xb3e0('0x15')](function(_0xd2c4fa){if(_0xd2c4fa['id']){var _0x2f592e={'messageId':_0xd2c4fa['id']};return _0x41e63a[_0xb3e0('0x16')](_0x2f592e);}else{logger[_0xb3e0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb3e0('0x2a'),_0xb3e0('0x6e'),util[_0xb3e0('0x3c')](_0xd2c4fa,{'showHidden':![],'depth':null}));}})[_0xb3e0('0x18')](function(_0x27bd7a){logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),'bandwidth',util[_0xb3e0('0x3c')](_0x27bd7a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb3e0('0x2b'),'afterCreate',_0xb3e0('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x13c97d[_0xb3e0('0x5c')]){var _0x2f4397={};var _0x566abc={'method':_0xb3e0('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xb3e0('0x6f')+_0x13c97d['apiKey'],'Content-Type':_0xb3e0('0x70')},'body':{'from':_0x13c97d[_0xb3e0('0x24')],'to':_0x3b3076[_0xb3e0('0x24')],'text':_0x3b3076[_0xb3e0('0xb')]},'json':!![]};return rp(_0x566abc)['then'](function(_0x1199ca){if(_0x1199ca[_0xb3e0('0x71')]==0xca){_0x2f4397[_0xb3e0('0x72')]=_0x1199ca;var _0x3a25ac={'method':_0xb3e0('0x37'),'uri':_0xb3e0('0x73'),'headers':{'Authorization':_0xb3e0('0x6f')+_0x13c97d[_0xb3e0('0x5c')],'Content-Type':_0xb3e0('0x70')},'body':{'refid':_0x2f4397[_0xb3e0('0x72')][_0xb3e0('0x74')]},'json':!![]};return rp(_0x3a25ac)[_0xb3e0('0x15')](function(_0x343b6b){_0x2f4397[_0xb3e0('0x75')]=_0x343b6b;var _0x489f92={'messageId':_0x2f4397[_0xb3e0('0x72')][_0xb3e0('0x74')],'read':!![]};return _0x41e63a[_0xb3e0('0x16')](_0x489f92);});}else{return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),'afterCreate',_0xb3e0('0x76'),util[_0xb3e0('0x3c')](_0x1199ca,{'showHidden':![],'depth':null}));}})[_0xb3e0('0x18')](function(_0x3f3888){return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),'intelepeer',util[_0xb3e0('0x3c')](_0x3f3888,{'showHidden':![],'depth':null}));});}else{return logger[_0xb3e0('0x19')](_0xb3e0('0x2b'),_0xb3e0('0x2a'),_0xb3e0('0x76'),'Token\x20not\x20received');}break;}}})[_0xb3e0('0x77')](function(){_0x1013fe();});}else{_0x1013fe();}}},'charset':_0xb3e0('0x78'),'collate':_0xb3e0('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 73291c6..e872978 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 _0xcd4b=['CreateSmsMessage','SmsMessage','body','options','raw','then','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x32e264,_0x41cee8){var _0x1d7175=function(_0x5913d9){while(--_0x5913d9){_0x32e264['push'](_0x32e264['shift']());}};_0x1d7175(++_0x41cee8);}(_0xcd4b,0x1c0));var _0xbcd4=function(_0x4d795a,_0x4922e8){_0x4d795a=_0x4d795a-0x0;var _0x1fccfd=_0xcd4b[_0x4d795a];return _0x1fccfd;};'use strict';var _=require(_0xbcd4('0x0'));var util=require(_0xbcd4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbcd4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcd4('0x3'))['db'];var utils=require(_0xbcd4('0x4'));var logger=require(_0xbcd4('0x5'))(_0xbcd4('0x6'));var config=require(_0xbcd4('0x7'));var jayson=require(_0xbcd4('0x8'));var client=jayson[_0xbcd4('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbcd4('0xa')](config[_0xbcd4('0xb')],{'host':_0xbcd4('0xc'),'port':0x18eb});var socket=require(_0xbcd4('0xd'))(new Redis(config[_0xbcd4('0xb')]));require(_0xbcd4('0xe'))[_0xbcd4('0xf')](socket);function respondWithRpcPromise(_0xbfa12,_0x1a8020,_0xa18fc2){return new BPromise(function(_0x344e88,_0x15eca2){return client[_0xbcd4('0x10')](_0xbfa12,_0xa18fc2)['then'](function(_0x6aa9c1){logger['info'](_0xbcd4('0x11'),_0x1a8020,'request\x20sent');logger[_0xbcd4('0x12')](_0xbcd4('0x13'),_0x1a8020,_0xbcd4('0x14'),JSON[_0xbcd4('0x15')](_0x6aa9c1));if(_0x6aa9c1['error']){if(_0x6aa9c1[_0xbcd4('0x16')][_0xbcd4('0x17')]===0x1f4){logger['error'](_0xbcd4('0x11'),_0x1a8020,_0x6aa9c1['error'][_0xbcd4('0x18')]);return _0x15eca2(_0x6aa9c1[_0xbcd4('0x16')][_0xbcd4('0x18')]);}logger[_0xbcd4('0x16')](_0xbcd4('0x11'),_0x1a8020,_0x6aa9c1[_0xbcd4('0x16')][_0xbcd4('0x18')]);return _0x344e88(_0x6aa9c1['error']['message']);}else{logger[_0xbcd4('0x19')]('SmsMessage,\x20%s,\x20%s',_0x1a8020,_0xbcd4('0x14'));_0x344e88(_0x6aa9c1[_0xbcd4('0x1a')][_0xbcd4('0x18')]);}})[_0xbcd4('0x1b')](function(_0x61227a){logger[_0xbcd4('0x16')](_0xbcd4('0x11'),_0x1a8020,_0x61227a);_0x15eca2(_0x61227a);});});}exports[_0xbcd4('0x1c')]=function(_0x196c10){var _0x421d30=this;return new Promise(function(_0x136520,_0x34da3e){return db[_0xbcd4('0x1d')]['create'](_0x196c10[_0xbcd4('0x1e')],{'raw':_0x196c10[_0xbcd4('0x1f')]?_0x196c10[_0xbcd4('0x1f')][_0xbcd4('0x20')]===undefined?!![]:![]:!![]})[_0xbcd4('0x21')](function(_0x237b5c){logger[_0xbcd4('0x19')](_0xbcd4('0x1c'),_0x196c10);logger[_0xbcd4('0x12')](_0xbcd4('0x1c'),_0x196c10,JSON['stringify'](_0x237b5c));_0x136520(_0x237b5c);})[_0xbcd4('0x1b')](function(_0x4faaef){logger[_0xbcd4('0x16')](_0xbcd4('0x1c'),_0x4faaef['message'],_0x196c10);_0x34da3e(_0x421d30[_0xbcd4('0x16')](0x1f4,_0x4faaef[_0xbcd4('0x18')]));});});}; \ No newline at end of file +var _0x48d7=['SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','then','info'];(function(_0x53b7fd,_0x4cdf92){var _0x5c5624=function(_0x4523ca){while(--_0x4523ca){_0x53b7fd['push'](_0x53b7fd['shift']());}};_0x5c5624(++_0x4cdf92);}(_0x48d7,0xd5));var _0x748d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x48d7[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x748d('0x0'));var moment=require(_0x748d('0x1'));var BPromise=require('bluebird');var rs=require(_0x748d('0x2'));var fs=require('fs');var Redis=require(_0x748d('0x3'));var db=require(_0x748d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x748d('0x5'))(_0x748d('0x6'));var config=require(_0x748d('0x7'));var jayson=require(_0x748d('0x8'));var client=jayson[_0x748d('0x9')][_0x748d('0xa')]({'port':0x232a});config[_0x748d('0xb')]=_[_0x748d('0xc')](config[_0x748d('0xb')],{'host':_0x748d('0xd'),'port':0x18eb});var socket=require(_0x748d('0xe'))(new Redis(config['redis']));require(_0x748d('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a8dc8,_0x165106,_0x5d9e5a){return new BPromise(function(_0x272a78,_0x410578){return client['request'](_0x4a8dc8,_0x5d9e5a)[_0x748d('0x10')](function(_0x3706b9){logger[_0x748d('0x11')](_0x748d('0x12'),_0x165106,_0x748d('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x165106,_0x748d('0x13'),JSON[_0x748d('0x14')](_0x3706b9));if(_0x3706b9[_0x748d('0x15')]){if(_0x3706b9[_0x748d('0x15')][_0x748d('0x16')]===0x1f4){logger[_0x748d('0x15')](_0x748d('0x12'),_0x165106,_0x3706b9['error'][_0x748d('0x17')]);return _0x410578(_0x3706b9[_0x748d('0x15')][_0x748d('0x17')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x165106,_0x3706b9[_0x748d('0x15')][_0x748d('0x17')]);return _0x272a78(_0x3706b9[_0x748d('0x15')][_0x748d('0x17')]);}else{logger[_0x748d('0x11')](_0x748d('0x12'),_0x165106,'request\x20sent');_0x272a78(_0x3706b9[_0x748d('0x18')][_0x748d('0x17')]);}})[_0x748d('0x19')](function(_0x569e3f){logger[_0x748d('0x15')](_0x748d('0x12'),_0x165106,_0x569e3f);_0x410578(_0x569e3f);});});}exports[_0x748d('0x1a')]=function(_0x2c0223){var _0x1f8c12=this;return new Promise(function(_0x4d9f2f,_0x1edbbc){return db[_0x748d('0x1b')][_0x748d('0x1c')](_0x2c0223[_0x748d('0x1d')],{'raw':_0x2c0223[_0x748d('0x1e')]?_0x2c0223['options'][_0x748d('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x351af2){logger[_0x748d('0x11')]('CreateSmsMessage',_0x2c0223);logger[_0x748d('0x20')](_0x748d('0x1a'),_0x2c0223,JSON[_0x748d('0x14')](_0x351af2));_0x4d9f2f(_0x351af2);})[_0x748d('0x19')](function(_0x1627fc){logger['error'](_0x748d('0x1a'),_0x1627fc[_0x748d('0x17')],_0x2c0223);_0x1edbbc(_0x1f8c12['error'](0x1f4,_0x1627fc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e354e42..cfa2aa1 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 _0x7a82=['./smsMessage.events','remove','update','removeListener','register','length','smsMessage:'];(function(_0x32f506,_0x389def){var _0x494591=function(_0x1c1faa){while(--_0x1c1faa){_0x32f506['push'](_0x32f506['shift']());}};_0x494591(++_0x389def);}(_0x7a82,0x111));var _0x27a8=function(_0x5bef43,_0x42bb49){_0x5bef43=_0x5bef43-0x0;var _0x1de567=_0x7a82[_0x5bef43];return _0x1de567;};'use strict';var SmsMessageEvents=require(_0x27a8('0x0'));var events=['save',_0x27a8('0x1'),_0x27a8('0x2')];function createListener(_0x4e0056,_0x19e42c){return function(_0x3491fc){_0x19e42c['emit'](_0x4e0056,_0x3491fc);};}function removeListener(_0x52a928,_0x1099e1){return function(){SmsMessageEvents[_0x27a8('0x3')](_0x52a928,_0x1099e1);};}exports[_0x27a8('0x4')]=function(_0x3ab6bf){for(var _0x8f9930=0x0,_0x97be68=events[_0x27a8('0x5')];_0x8f9930<_0x97be68;_0x8f9930++){var _0x164367=events[_0x8f9930];var _0x3a1fb=createListener(_0x27a8('0x6')+_0x164367,_0x3ab6bf);SmsMessageEvents['on'](_0x164367,_0x3a1fb);}}; \ No newline at end of file +var _0xe686=['removeListener','register','length','smsMessage:','./smsMessage.events','remove','update','emit'];(function(_0xa662f0,_0x30824a){var _0x4a8b35=function(_0x234d1c){while(--_0x234d1c){_0xa662f0['push'](_0xa662f0['shift']());}};_0x4a8b35(++_0x30824a);}(_0xe686,0x1b4));var _0x6e68=function(_0x27d7a5,_0x5bddf3){_0x27d7a5=_0x27d7a5-0x0;var _0x4fecf8=_0xe686[_0x27d7a5];return _0x4fecf8;};'use strict';var SmsMessageEvents=require(_0x6e68('0x0'));var events=['save',_0x6e68('0x1'),_0x6e68('0x2')];function createListener(_0x33a9ca,_0x4510d7){return function(_0x1213ea){_0x4510d7[_0x6e68('0x3')](_0x33a9ca,_0x1213ea);};}function removeListener(_0x280b61,_0x2439bd){return function(){SmsMessageEvents[_0x6e68('0x4')](_0x280b61,_0x2439bd);};}exports[_0x6e68('0x5')]=function(_0x41d489){for(var _0x46e492=0x0,_0xc39e67=events[_0x6e68('0x6')];_0x46e492<_0xc39e67;_0x46e492++){var _0x161334=events[_0x46e492];var _0x79bb3b=createListener(_0x6e68('0x7')+_0x161334,_0x41d489);SmsMessageEvents['on'](_0x161334,_0x79bb3b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index dcb99ff..db2d877 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 _0x3800=['index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id','delete','destroy','removeTeams','exports','multer','util','express','Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x25c18b,_0x47f089){var _0x493114=function(_0x575495){while(--_0x575495){_0x25c18b['push'](_0x25c18b['shift']());}};_0x493114(++_0x47f089);}(_0x3800,0x105));var _0x0380=function(_0x56c6c6,_0x53a1ac){_0x56c6c6=_0x56c6c6-0x0;var _0x24b65d=_0x3800[_0x56c6c6];return _0x24b65d;};'use strict';var multer=require(_0x0380('0x0'));var util=require(_0x0380('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0380('0x2'));var router=express[_0x0380('0x3')]();var fs_extra=require(_0x0380('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0380('0x5'));var controller=require(_0x0380('0x6'));router[_0x0380('0x7')]('/',auth[_0x0380('0x8')](),controller[_0x0380('0x9')]);router['get']('/describe',auth[_0x0380('0x8')](),controller[_0x0380('0xa')]);router[_0x0380('0x7')]('/:id',auth[_0x0380('0x8')](),controller[_0x0380('0xb')]);router[_0x0380('0x7')](_0x0380('0xc'),auth[_0x0380('0x8')](),controller[_0x0380('0xd')]);router[_0x0380('0x7')](_0x0380('0xe'),auth[_0x0380('0x8')](),controller[_0x0380('0xf')]);router['get']('/:id/users',auth[_0x0380('0x8')](),controller[_0x0380('0x10')]);router[_0x0380('0x11')]('/',auth[_0x0380('0x8')](),controller[_0x0380('0x12')]);router['post'](_0x0380('0xe'),auth[_0x0380('0x8')](),controller[_0x0380('0x13')]);router[_0x0380('0x11')](_0x0380('0x14'),auth[_0x0380('0x8')](),controller[_0x0380('0x15')]);router['put'](_0x0380('0x16'),auth[_0x0380('0x8')](),controller['update']);router[_0x0380('0x17')](_0x0380('0x16'),auth[_0x0380('0x8')](),controller[_0x0380('0x18')]);router['delete'](_0x0380('0xe'),auth['isAuthenticated'](),controller[_0x0380('0x19')]);router[_0x0380('0x17')](_0x0380('0x14'),auth[_0x0380('0x8')](),controller['removeAgents']);module[_0x0380('0x1a')]=router; \ No newline at end of file +var _0x4d8c=['/:id','show','getMembers','getTeams','post','/:id/teams','addTeams','addAgents','put','update','destroy','removeTeams','delete','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x12582e,_0x4617e6){var _0x2786bf=function(_0x4515de){while(--_0x4515de){_0x12582e['push'](_0x12582e['shift']());}};_0x2786bf(++_0x4617e6);}(_0x4d8c,0xa6));var _0xc4d8=function(_0xbfd575,_0x3f3a37){_0xbfd575=_0xbfd575-0x0;var _0x53d9bd=_0x4d8c[_0xbfd575];return _0x53d9bd;};'use strict';var multer=require(_0xc4d8('0x0'));var util=require('util');var path=require(_0xc4d8('0x1'));var timeout=require(_0xc4d8('0x2'));var express=require(_0xc4d8('0x3'));var router=express[_0xc4d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc4d8('0x5'));var interaction=require(_0xc4d8('0x6'));var config=require(_0xc4d8('0x7'));var controller=require(_0xc4d8('0x8'));router[_0xc4d8('0x9')]('/',auth[_0xc4d8('0xa')](),controller[_0xc4d8('0xb')]);router[_0xc4d8('0x9')](_0xc4d8('0xc'),auth[_0xc4d8('0xa')](),controller[_0xc4d8('0xd')]);router['get'](_0xc4d8('0xe'),auth[_0xc4d8('0xa')](),controller[_0xc4d8('0xf')]);router[_0xc4d8('0x9')]('/:id/members',auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x10')]);router[_0xc4d8('0x9')]('/:id/teams',auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x11')]);router[_0xc4d8('0x9')]('/:id/users',auth[_0xc4d8('0xa')](),controller['getAgents']);router[_0xc4d8('0x12')]('/',auth[_0xc4d8('0xa')](),controller['create']);router[_0xc4d8('0x12')](_0xc4d8('0x13'),auth['isAuthenticated'](),controller[_0xc4d8('0x14')]);router['post']('/:id/users',auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x15')]);router[_0xc4d8('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc4d8('0x17')]);router['delete'](_0xc4d8('0xe'),auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x18')]);router['delete']('/:id/teams',auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x19')]);router[_0xc4d8('0x1a')](_0xc4d8('0x1b'),auth[_0xc4d8('0xa')](),controller[_0xc4d8('0x1c')]);module[_0xc4d8('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 cffdd33..fdfcc0c 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 _0x4ce2=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x230249,_0x27c009){var _0x4f6e0b=function(_0x50d266){while(--_0x50d266){_0x230249['push'](_0x230249['shift']());}};_0x4f6e0b(++_0x27c009);}(_0x4ce2,0x15e));var _0x24ce=function(_0x2dd88f,_0xd837c2){_0x2dd88f=_0x2dd88f-0x0;var _0x5f5468=_0x4ce2[_0x2dd88f];return _0x5f5468;};'use strict';var Sequelize=require(_0x24ce('0x0'));module[_0x24ce('0x1')]={'name':{'type':Sequelize[_0x24ce('0x2')],'unique':_0x24ce('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x24ce('0x2')]},'timeout':{'type':Sequelize[_0x24ce('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x24ce('0x5')]('rrmemory',_0x24ce('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xa9c5=['ENUM','rrmemory','STRING','name','INTEGER'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xa9c5,0x1c9));var _0x5a9c=function(_0x3ad93c,_0x252124){_0x3ad93c=_0x3ad93c-0x0;var _0x51bf64=_0xa9c5[_0x3ad93c];return _0x51bf64;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5a9c('0x0')],'unique':_0x5a9c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5a9c('0x0')]},'timeout':{'type':Sequelize[_0x5a9c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5a9c('0x3')](_0x5a9c('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a48e1e8..cf4a5fc 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x0b0e[_0x2132a3];return _0x21890c;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x40050a,_0x4ddea6){var _0x58cb5e=function(_0x4de744){while(--_0x4de744){_0x40050a['push'](_0x40050a['shift']());}};_0x58cb5e(++_0x4ddea6);}(_0xdb28,0x106));var _0x8db2=function(_0x1409da,_0x1f54a3){_0x1409da=_0x1409da-0x0;var _0x2e102b=_0xdb28[_0x1409da];return _0x2e102b;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 56d375f..c69b93d 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 _0xa5d5=['events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xa5d5,0x19a));var _0x5a5d=function(_0xe7da10,_0x4e8f91){_0xe7da10=_0xe7da10-0x0;var _0x5c64e7=_0xa5d5[_0xe7da10];return _0x5c64e7;};'use strict';var EventEmitter=require(_0x5a5d('0x0'));var SmsQueue=require(_0x5a5d('0x1'))['db'][_0x5a5d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5a5d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a5d('0x4'),'afterDestroy':_0x5a5d('0x5')};function emitEvent(_0x4f0874){return function(_0x27e5cb,_0x3e9eab,_0x265e23){SmsQueueEvents[_0x5a5d('0x6')](_0x4f0874+':'+_0x27e5cb['id'],_0x27e5cb);SmsQueueEvents['emit'](_0x4f0874,_0x27e5cb);_0x265e23(null);};}for(var e in events){if(events[_0x5a5d('0x7')](e)){var event=events[e];SmsQueue[_0x5a5d('0x8')](e,emitEvent(event));}}module[_0x5a5d('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x374a=['hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x374a,0x12c));var _0xa374=function(_0x1b9b51,_0x2c92dd){_0x1b9b51=_0x1b9b51-0x0;var _0x540649=_0x374a[_0x1b9b51];return _0x540649;};'use strict';var EventEmitter=require(_0xa374('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xa374('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa374('0x2')](0x0);var events={'afterCreate':_0xa374('0x3'),'afterUpdate':'update','afterDestroy':_0xa374('0x4')};function emitEvent(_0x7a0a28){return function(_0x6acd2,_0x5ca6f7,_0xa5b639){SmsQueueEvents[_0xa374('0x5')](_0x7a0a28+':'+_0x6acd2['id'],_0x6acd2);SmsQueueEvents[_0xa374('0x5')](_0x7a0a28,_0x6acd2);_0xa5b639(null);};}for(var e in events){if(events[_0xa374('0x6')](e)){var event=events[e];SmsQueue[_0xa374('0x7')](e,emitEvent(event));}}module[_0xa374('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index dd99adb..5ff341b 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 _0x7cd4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x3443d3,_0xf1bb82){var _0x3de675=function(_0x3d4692){while(--_0x3d4692){_0x3443d3['push'](_0x3443d3['shift']());}};_0x3de675(++_0xf1bb82);}(_0x7cd4,0x186));var _0x47cd=function(_0x39e019,_0x43eeb7){_0x39e019=_0x39e019-0x0;var _0x476eee=_0x7cd4[_0x39e019];return _0x476eee;};'use strict';var _=require(_0x47cd('0x0'));var util=require(_0x47cd('0x1'));var logger=require(_0x47cd('0x2'))(_0x47cd('0x3'));var moment=require(_0x47cd('0x4'));var BPromise=require(_0x47cd('0x5'));var rp=require(_0x47cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47cd('0x7'));var config=require(_0x47cd('0x8'));var attributes=require(_0x47cd('0x9'));module[_0x47cd('0xa')]=function(_0x573c16,_0x510120){return _0x573c16[_0x47cd('0xb')](_0x47cd('0xc'),attributes,{'tableName':_0x47cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbda4=['./smsQueue.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fa73d,_0x220502){var _0x4b9d89=function(_0x29b511){while(--_0x29b511){_0x4fa73d['push'](_0x4fa73d['shift']());}};_0x4b9d89(++_0x220502);}(_0xbda4,0x16c));var _0x4bda=function(_0x1a7771,_0x5de070){_0x1a7771=_0x1a7771-0x0;var _0x3765aa=_0xbda4[_0x1a7771];return _0x3765aa;};'use strict';var _=require(_0x4bda('0x0'));var util=require(_0x4bda('0x1'));var logger=require(_0x4bda('0x2'))(_0x4bda('0x3'));var moment=require(_0x4bda('0x4'));var BPromise=require(_0x4bda('0x5'));var rp=require(_0x4bda('0x6'));var fs=require('fs');var path=require(_0x4bda('0x7'));var rimraf=require(_0x4bda('0x8'));var config=require(_0x4bda('0x9'));var attributes=require(_0x4bda('0xa'));module['exports']=function(_0x36560f,_0x36e4d5){return _0x36560f['define']('SmsQueue',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 7904268..b0545d0 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 _0x3d7d=['client','http','redis','socket.io-emitter','./smsQueue.socket','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowSmsQueue','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xc2ffb9,_0x18a0a8){var _0x422763=function(_0x4b4371){while(--_0x4b4371){_0xc2ffb9['push'](_0xc2ffb9['shift']());}};_0x422763(++_0x18a0a8);}(_0x3d7d,0x1c1));var _0xd3d7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3d7d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd3d7('0x0'));var BPromise=require(_0xd3d7('0x1'));var rs=require(_0xd3d7('0x2'));var fs=require('fs');var Redis=require(_0xd3d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3d7('0x4'));var logger=require(_0xd3d7('0x5'))(_0xd3d7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3d7('0x7')][_0xd3d7('0x8')]({'port':0x232a});config[_0xd3d7('0x9')]=_['defaults'](config[_0xd3d7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3d7('0xa'))(new Redis(config[_0xd3d7('0x9')]));require(_0xd3d7('0xb'))[_0xd3d7('0xc')](socket);function respondWithRpcPromise(_0x1bc124,_0x16ef07,_0x52a2b1){return new BPromise(function(_0x513bd6,_0x1fd6bb){return client[_0xd3d7('0xd')](_0x1bc124,_0x52a2b1)[_0xd3d7('0xe')](function(_0x1e82db){logger[_0xd3d7('0xf')]('SmsQueue,\x20%s,\x20%s',_0x16ef07,'request\x20sent');logger[_0xd3d7('0x10')](_0xd3d7('0x11'),_0x16ef07,_0xd3d7('0x12'),JSON[_0xd3d7('0x13')](_0x1e82db));if(_0x1e82db[_0xd3d7('0x14')]){if(_0x1e82db['error']['code']===0x1f4){logger['error'](_0xd3d7('0x15'),_0x16ef07,_0x1e82db[_0xd3d7('0x14')][_0xd3d7('0x16')]);return _0x1fd6bb(_0x1e82db['error'][_0xd3d7('0x16')]);}logger['error'](_0xd3d7('0x15'),_0x16ef07,_0x1e82db[_0xd3d7('0x14')]['message']);return _0x513bd6(_0x1e82db['error'][_0xd3d7('0x16')]);}else{logger[_0xd3d7('0xf')]('SmsQueue,\x20%s,\x20%s',_0x16ef07,_0xd3d7('0x12'));_0x513bd6(_0x1e82db[_0xd3d7('0x17')][_0xd3d7('0x16')]);}})['catch'](function(_0x28007f){logger['error'](_0xd3d7('0x15'),_0x16ef07,_0x28007f);_0x1fd6bb(_0x28007f);});});}exports[_0xd3d7('0x18')]=function(_0x24f5a0){var _0x1dcd9c=this;return new Promise(function(_0x109d7a,_0x5d936c){return db[_0xd3d7('0x19')][_0xd3d7('0x1a')]({'raw':_0x24f5a0[_0xd3d7('0x1b')]?_0x24f5a0[_0xd3d7('0x1b')][_0xd3d7('0x1c')]===undefined?!![]:![]:!![],'where':_0x24f5a0[_0xd3d7('0x1b')]?_0x24f5a0[_0xd3d7('0x1b')][_0xd3d7('0x1d')]||null:null,'attributes':_0x24f5a0[_0xd3d7('0x1b')]?_0x24f5a0['options'][_0xd3d7('0x1e')]||null:null,'limit':_0x24f5a0[_0xd3d7('0x1b')]?_0x24f5a0['options'][_0xd3d7('0x1f')]||null:null,'include':_0x24f5a0[_0xd3d7('0x1b')]?_0x24f5a0[_0xd3d7('0x1b')][_0xd3d7('0x20')]?_[_0xd3d7('0x21')](_0x24f5a0[_0xd3d7('0x1b')][_0xd3d7('0x20')],function(_0x1a8c76){return{'model':db[_0x1a8c76[_0xd3d7('0x22')]],'as':_0x1a8c76['as'],'attributes':_0x1a8c76['attributes'],'include':_0x1a8c76['include']?_[_0xd3d7('0x21')](_0x1a8c76[_0xd3d7('0x20')],function(_0x218494){return{'model':db[_0x218494[_0xd3d7('0x22')]],'as':_0x218494['as'],'attributes':_0x218494[_0xd3d7('0x1e')],'include':_0x218494['include']?_[_0xd3d7('0x21')](_0x218494[_0xd3d7('0x20')],function(_0x153fdc){return{'model':db[_0x153fdc['model']],'as':_0x153fdc['as'],'attributes':_0x153fdc[_0xd3d7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eeb16){logger[_0xd3d7('0xf')](_0xd3d7('0x18'),_0x24f5a0);logger[_0xd3d7('0x10')]('GetSmsQueue',_0x24f5a0,JSON[_0xd3d7('0x13')](_0x2eeb16));_0x109d7a(_0x2eeb16);})[_0xd3d7('0x23')](function(_0x28ebef){logger[_0xd3d7('0x14')](_0xd3d7('0x18'),_0x28ebef[_0xd3d7('0x16')],_0x24f5a0);_0x5d936c(_0x1dcd9c[_0xd3d7('0x14')](0x1f4,_0x28ebef[_0xd3d7('0x16')]));});});};exports['ShowSmsQueue']=function(_0x2ecbe8){var _0x999977=this;return new Promise(function(_0x4b4551,_0x1f3792){return db['SmsQueue'][_0xd3d7('0x24')]({'raw':_0x2ecbe8[_0xd3d7('0x1b')]?_0x2ecbe8[_0xd3d7('0x1b')][_0xd3d7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ecbe8[_0xd3d7('0x1b')]?_0x2ecbe8['options']['where']||null:null,'attributes':_0x2ecbe8[_0xd3d7('0x1b')]?_0x2ecbe8[_0xd3d7('0x1b')]['attributes']||null:null,'include':_0x2ecbe8[_0xd3d7('0x1b')]?_0x2ecbe8[_0xd3d7('0x1b')][_0xd3d7('0x20')]?_[_0xd3d7('0x21')](_0x2ecbe8[_0xd3d7('0x1b')][_0xd3d7('0x20')],function(_0x16789b){return{'model':db[_0x16789b[_0xd3d7('0x22')]],'as':_0x16789b['as'],'attributes':_0x16789b[_0xd3d7('0x1e')],'include':_0x16789b['include']?_[_0xd3d7('0x21')](_0x16789b[_0xd3d7('0x20')],function(_0x38f695){return{'model':db[_0x38f695['model']],'as':_0x38f695['as'],'attributes':_0x38f695[_0xd3d7('0x1e')],'include':_0x38f695['include']?_[_0xd3d7('0x21')](_0x38f695[_0xd3d7('0x20')],function(_0x521a63){return{'model':db[_0x521a63[_0xd3d7('0x22')]],'as':_0x521a63['as'],'attributes':_0x521a63[_0xd3d7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3d7('0xe')](function(_0x3602fb){logger[_0xd3d7('0xf')]('ShowSmsQueue',_0x2ecbe8);logger['debug']('ShowSmsQueue',_0x2ecbe8,JSON[_0xd3d7('0x13')](_0x3602fb));_0x4b4551(_0x3602fb);})['catch'](function(_0x52f87d){logger[_0xd3d7('0x14')](_0xd3d7('0x25'),_0x52f87d[_0xd3d7('0x16')],_0x2ecbe8);_0x1f3792(_0x999977[_0xd3d7('0x14')](0x1f4,_0x52f87d[_0xd3d7('0x16')]));});});}; \ No newline at end of file +var _0xeb92=['SmsQueue,\x20%s,\x20%s','message','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3f9939,_0x4adbbc){var _0x2db2ba=function(_0x1206ae){while(--_0x1206ae){_0x3f9939['push'](_0x3f9939['shift']());}};_0x2db2ba(++_0x4adbbc);}(_0xeb92,0x89));var _0x2eb9=function(_0x3965e3,_0xfb65b8){_0x3965e3=_0x3965e3-0x0;var _0x1ac1f9=_0xeb92[_0x3965e3];return _0x1ac1f9;};'use strict';var _=require(_0x2eb9('0x0'));var util=require(_0x2eb9('0x1'));var moment=require(_0x2eb9('0x2'));var BPromise=require(_0x2eb9('0x3'));var rs=require(_0x2eb9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2eb9('0x5'))['db'];var utils=require(_0x2eb9('0x6'));var logger=require(_0x2eb9('0x7'))(_0x2eb9('0x8'));var config=require(_0x2eb9('0x9'));var jayson=require(_0x2eb9('0xa'));var client=jayson['client'][_0x2eb9('0xb')]({'port':0x232a});config[_0x2eb9('0xc')]=_['defaults'](config['redis'],{'host':_0x2eb9('0xd'),'port':0x18eb});var socket=require(_0x2eb9('0xe'))(new Redis(config[_0x2eb9('0xc')]));require(_0x2eb9('0xf'))[_0x2eb9('0x10')](socket);function respondWithRpcPromise(_0x3aa50d,_0x2b7ea2,_0x5104b4){return new BPromise(function(_0x1a7efb,_0x8964c8){return client[_0x2eb9('0x11')](_0x3aa50d,_0x5104b4)[_0x2eb9('0x12')](function(_0x25c2ac){logger[_0x2eb9('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2b7ea2,'request\x20sent');logger['debug'](_0x2eb9('0x14'),_0x2b7ea2,'request\x20sent',JSON['stringify'](_0x25c2ac));if(_0x25c2ac['error']){if(_0x25c2ac[_0x2eb9('0x15')][_0x2eb9('0x16')]===0x1f4){logger[_0x2eb9('0x15')](_0x2eb9('0x17'),_0x2b7ea2,_0x25c2ac[_0x2eb9('0x15')][_0x2eb9('0x18')]);return _0x8964c8(_0x25c2ac['error'][_0x2eb9('0x18')]);}logger[_0x2eb9('0x15')](_0x2eb9('0x17'),_0x2b7ea2,_0x25c2ac['error'][_0x2eb9('0x18')]);return _0x1a7efb(_0x25c2ac[_0x2eb9('0x15')][_0x2eb9('0x18')]);}else{logger['info'](_0x2eb9('0x17'),_0x2b7ea2,'request\x20sent');_0x1a7efb(_0x25c2ac['result'][_0x2eb9('0x18')]);}})[_0x2eb9('0x19')](function(_0x10cb21){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2b7ea2,_0x10cb21);_0x8964c8(_0x10cb21);});});}exports['GetSmsQueue']=function(_0x444ec9){var _0x2209ea=this;return new Promise(function(_0x382c5d,_0x228576){return db[_0x2eb9('0x1a')][_0x2eb9('0x1b')]({'raw':_0x444ec9[_0x2eb9('0x1c')]?_0x444ec9[_0x2eb9('0x1c')][_0x2eb9('0x1d')]===undefined?!![]:![]:!![],'where':_0x444ec9[_0x2eb9('0x1c')]?_0x444ec9['options'][_0x2eb9('0x1e')]||null:null,'attributes':_0x444ec9[_0x2eb9('0x1c')]?_0x444ec9[_0x2eb9('0x1c')][_0x2eb9('0x1f')]||null:null,'limit':_0x444ec9[_0x2eb9('0x1c')]?_0x444ec9['options'][_0x2eb9('0x20')]||null:null,'include':_0x444ec9[_0x2eb9('0x1c')]?_0x444ec9[_0x2eb9('0x1c')][_0x2eb9('0x21')]?_[_0x2eb9('0x22')](_0x444ec9[_0x2eb9('0x1c')]['include'],function(_0x48ba67){return{'model':db[_0x48ba67[_0x2eb9('0x23')]],'as':_0x48ba67['as'],'attributes':_0x48ba67['attributes'],'include':_0x48ba67[_0x2eb9('0x21')]?_[_0x2eb9('0x22')](_0x48ba67[_0x2eb9('0x21')],function(_0x4e648c){return{'model':db[_0x4e648c[_0x2eb9('0x23')]],'as':_0x4e648c['as'],'attributes':_0x4e648c[_0x2eb9('0x1f')],'include':_0x4e648c[_0x2eb9('0x21')]?_['map'](_0x4e648c[_0x2eb9('0x21')],function(_0x2aa8bc){return{'model':db[_0x2aa8bc['model']],'as':_0x2aa8bc['as'],'attributes':_0x2aa8bc[_0x2eb9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2eb9('0x12')](function(_0x259272){logger[_0x2eb9('0x13')](_0x2eb9('0x24'),_0x444ec9);logger[_0x2eb9('0x25')](_0x2eb9('0x24'),_0x444ec9,JSON['stringify'](_0x259272));_0x382c5d(_0x259272);})[_0x2eb9('0x19')](function(_0x1e059f){logger[_0x2eb9('0x15')]('GetSmsQueue',_0x1e059f[_0x2eb9('0x18')],_0x444ec9);_0x228576(_0x2209ea[_0x2eb9('0x15')](0x1f4,_0x1e059f[_0x2eb9('0x18')]));});});};exports[_0x2eb9('0x26')]=function(_0x2c1ec5){var _0x2e9e25=this;return new Promise(function(_0x574f3d,_0x234b09){return db[_0x2eb9('0x1a')][_0x2eb9('0x27')]({'raw':_0x2c1ec5['options']?_0x2c1ec5['options'][_0x2eb9('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c1ec5[_0x2eb9('0x1c')]?_0x2c1ec5[_0x2eb9('0x1c')][_0x2eb9('0x1e')]||null:null,'attributes':_0x2c1ec5[_0x2eb9('0x1c')]?_0x2c1ec5[_0x2eb9('0x1c')][_0x2eb9('0x1f')]||null:null,'include':_0x2c1ec5['options']?_0x2c1ec5[_0x2eb9('0x1c')][_0x2eb9('0x21')]?_['map'](_0x2c1ec5[_0x2eb9('0x1c')][_0x2eb9('0x21')],function(_0x5c4edb){return{'model':db[_0x5c4edb[_0x2eb9('0x23')]],'as':_0x5c4edb['as'],'attributes':_0x5c4edb[_0x2eb9('0x1f')],'include':_0x5c4edb['include']?_['map'](_0x5c4edb[_0x2eb9('0x21')],function(_0xe69682){return{'model':db[_0xe69682['model']],'as':_0xe69682['as'],'attributes':_0xe69682[_0x2eb9('0x1f')],'include':_0xe69682['include']?_[_0x2eb9('0x22')](_0xe69682[_0x2eb9('0x21')],function(_0x664382){return{'model':db[_0x664382['model']],'as':_0x664382['as'],'attributes':_0x664382['attributes']};}):[]};}):[]};}):[]:[]})[_0x2eb9('0x12')](function(_0xc8ce48){logger[_0x2eb9('0x13')]('ShowSmsQueue',_0x2c1ec5);logger['debug'](_0x2eb9('0x26'),_0x2c1ec5,JSON['stringify'](_0xc8ce48));_0x574f3d(_0xc8ce48);})[_0x2eb9('0x19')](function(_0x4fe23c){logger[_0x2eb9('0x15')](_0x2eb9('0x26'),_0x4fe23c[_0x2eb9('0x18')],_0x2c1ec5);_0x234b09(_0x2e9e25['error'](0x1f4,_0x4fe23c[_0x2eb9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6a8e1b5..a04e2e6 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 _0xc105=['remove','register','length','./smsQueue.events','save'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0xc105,0x12a));var _0x5c10=function(_0x8398a9,_0x510eef){_0x8398a9=_0x8398a9-0x0;var _0x175a1e=_0xc105[_0x8398a9];return _0x175a1e;};'use strict';var SmsQueueEvents=require(_0x5c10('0x0'));var events=[_0x5c10('0x1'),_0x5c10('0x2'),'update'];function createListener(_0x5c5f85,_0x15b186){return function(_0x1a0830){_0x15b186['emit'](_0x5c5f85,_0x1a0830);};}function removeListener(_0x115f2e,_0x357b25){return function(){SmsQueueEvents['removeListener'](_0x115f2e,_0x357b25);};}exports[_0x5c10('0x3')]=function(_0x2b11c3){for(var _0x565946=0x0,_0x3a1aa0=events[_0x5c10('0x4')];_0x565946<_0x3a1aa0;_0x565946++){var _0x3d1422=events[_0x565946];var _0x4dd9f5=createListener('smsQueue:'+_0x3d1422,_0x2b11c3);SmsQueueEvents['on'](_0x3d1422,_0x4dd9f5);}}; \ No newline at end of file +var _0xd46a=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd46a,0x176));var _0xad46=function(_0x58b5b6,_0xfb1a68){_0x58b5b6=_0x58b5b6-0x0;var _0x362469=_0xd46a[_0x58b5b6];return _0x362469;};'use strict';var SmsQueueEvents=require(_0xad46('0x0'));var events=[_0xad46('0x1'),'remove',_0xad46('0x2')];function createListener(_0x21cd7d,_0x1644a8){return function(_0x5c24bb){_0x1644a8[_0xad46('0x3')](_0x21cd7d,_0x5c24bb);};}function removeListener(_0x50058d,_0x5ba15e){return function(){SmsQueueEvents[_0xad46('0x4')](_0x50058d,_0x5ba15e);};}exports[_0xad46('0x5')]=function(_0x1b9f60){for(var _0xb8133a=0x0,_0x4948fb=events[_0xad46('0x6')];_0xb8133a<_0x4948fb;_0xb8133a++){var _0x23c579=events[_0xb8133a];var _0x5dc02b=createListener(_0xad46('0x7')+_0x23c579,_0x1b9f60);SmsQueueEvents['on'](_0x23c579,_0x5dc02b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a95befd..74e39be 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 _0xddf7=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x32084f,_0x28fc38){var _0x187302=function(_0x481c2b){while(--_0x481c2b){_0x32084f['push'](_0x32084f['shift']());}};_0x187302(++_0x28fc38);}(_0xddf7,0x13c));var _0x7ddf=function(_0x147d24,_0x317d71){_0x147d24=_0x147d24-0x0;var _0x279b24=_0xddf7[_0x147d24];return _0x279b24;};'use strict';var multer=require('multer');var util=require(_0x7ddf('0x0'));var path=require(_0x7ddf('0x1'));var timeout=require(_0x7ddf('0x2'));var express=require(_0x7ddf('0x3'));var router=express[_0x7ddf('0x4')]();var fs_extra=require(_0x7ddf('0x5'));var auth=require(_0x7ddf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7ddf('0x7'));var controller=require(_0x7ddf('0x8'));router[_0x7ddf('0x9')]('/',auth[_0x7ddf('0xa')](),controller[_0x7ddf('0xb')]);router[_0x7ddf('0x9')]('/describe',auth[_0x7ddf('0xa')](),controller[_0x7ddf('0xc')]);router['get'](_0x7ddf('0xd'),auth[_0x7ddf('0xa')](),controller[_0x7ddf('0xe')]);router['post']('/',auth[_0x7ddf('0xa')](),controller['create']);router['put'](_0x7ddf('0xd'),auth[_0x7ddf('0xa')](),controller['update']);router[_0x7ddf('0xf')](_0x7ddf('0xd'),auth[_0x7ddf('0xa')](),controller['destroy']);module[_0x7ddf('0x10')]=router; \ No newline at end of file +var _0x1298=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','exports','util','connect-timeout'];(function(_0x35a441,_0x3a2ec6){var _0x571ce3=function(_0x161827){while(--_0x161827){_0x35a441['push'](_0x35a441['shift']());}};_0x571ce3(++_0x3a2ec6);}(_0x1298,0x19e));var _0x8129=function(_0x3a267b,_0x753798){_0x3a267b=_0x3a267b-0x0;var _0x5bf7d3=_0x1298[_0x3a267b];return _0x5bf7d3;};'use strict';var multer=require('multer');var util=require(_0x8129('0x0'));var path=require('path');var timeout=require(_0x8129('0x1'));var express=require(_0x8129('0x2'));var router=express[_0x8129('0x3')]();var fs_extra=require(_0x8129('0x4'));var auth=require(_0x8129('0x5'));var interaction=require(_0x8129('0x6'));var config=require(_0x8129('0x7'));var controller=require('./smsQueueReport.controller');router[_0x8129('0x8')]('/',auth[_0x8129('0x9')](),controller['index']);router['get'](_0x8129('0xa'),auth[_0x8129('0x9')](),controller[_0x8129('0xb')]);router[_0x8129('0x8')](_0x8129('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8129('0xd')]);router[_0x8129('0xe')]('/:id',auth[_0x8129('0x9')](),controller['update']);router['delete'](_0x8129('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8129('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2f20dd2..b40847a 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 _0x8ad8=['DATE','sequelize','exports','STRING'];(function(_0x1aac7b,_0x38dff9){var _0xda61b8=function(_0x4c9cb8){while(--_0x4c9cb8){_0x1aac7b['push'](_0x1aac7b['shift']());}};_0xda61b8(++_0x38dff9);}(_0x8ad8,0x17d));var _0x88ad=function(_0x16c55b,_0x5ad58d){_0x16c55b=_0x16c55b-0x0;var _0x16a402=_0x8ad8[_0x16c55b];return _0x16a402;};'use strict';var moment=require('moment');var Sequelize=require(_0x88ad('0x0'));module[_0x88ad('0x1')]={'uniqueid':{'type':Sequelize[_0x88ad('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x88ad('0x2')]},'joinAt':{'type':Sequelize[_0x88ad('0x3')]},'leaveAt':{'type':Sequelize[_0x88ad('0x3')]},'acceptAt':{'type':Sequelize[_0x88ad('0x3')]},'exitAt':{'type':Sequelize[_0x88ad('0x3')]},'reason':{'type':Sequelize[_0x88ad('0x2')]}}; \ No newline at end of file +var _0xa50d=['STRING','DATE','moment','exports'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xa50d,0xfa));var _0xda50=function(_0x501e37,_0x4c2a34){_0x501e37=_0x501e37-0x0;var _0xa02689=_0xa50d[_0x501e37];return _0xa02689;};'use strict';var moment=require(_0xda50('0x0'));var Sequelize=require('sequelize');module[_0xda50('0x1')]={'uniqueid':{'type':Sequelize[_0xda50('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xda50('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xda50('0x3')]},'acceptAt':{'type':Sequelize[_0xda50('0x3')]},'exitAt':{'type':Sequelize[_0xda50('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1ef746f..40ecedb 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 _0x999f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','save','update','destroy','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','then','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0xf1aaa1,_0x466e12){var _0x24fda2=function(_0x2ca1c7){while(--_0x2ca1c7){_0xf1aaa1['push'](_0xf1aaa1['shift']());}};_0x24fda2(++_0x466e12);}(_0x999f,0x1c2));var _0xf999=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x999f[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xf999('0x0'));var rimraf=require(_0xf999('0x1'));var zipdir=require(_0xf999('0x2'));var jsonpatch=require(_0xf999('0x3'));var rp=require(_0xf999('0x4'));var moment=require(_0xf999('0x5'));var BPromise=require(_0xf999('0x6'));var Mustache=require(_0xf999('0x7'));var util=require(_0xf999('0x8'));var path=require(_0xf999('0x9'));var sox=require(_0xf999('0xa'));var csv=require(_0xf999('0xb'));var ejs=require(_0xf999('0xc'));var fs=require('fs');var fs_extra=require(_0xf999('0xd'));var _=require(_0xf999('0xe'));var squel=require(_0xf999('0xf'));var crypto=require(_0xf999('0x10'));var jsforce=require(_0xf999('0x11'));var deskjs=require(_0xf999('0x12'));var toCsv=require(_0xf999('0xb'));var querystring=require(_0xf999('0x13'));var Papa=require(_0xf999('0x14'));var Redis=require(_0xf999('0x15'));var authService=require(_0xf999('0x16'));var qs=require(_0xf999('0x17'));var as=require(_0xf999('0x18'));var hardwareService=require(_0xf999('0x19'));var logger=require('../../config/logger')(_0xf999('0x1a'));var utils=require(_0xf999('0x1b'));var config=require(_0xf999('0x1c'));var licenseUtil=require(_0xf999('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3857f3,_0x4e27d3){_0x4e27d3=_0x4e27d3||0xcc;return function(_0x2ef012){if(_0x2ef012){return _0x3857f3['sendStatus'](_0x4e27d3);}return _0x3857f3[_0xf999('0x1e')](_0x4e27d3)[_0xf999('0x1f')]();};}function respondWithResult(_0x20533b,_0x12348d){_0x12348d=_0x12348d||0xc8;return function(_0x3821a8){if(_0x3821a8){return _0x20533b['status'](_0x12348d)[_0xf999('0x20')](_0x3821a8);}};}function respondWithFilteredResult(_0x5d0d24,_0x32fd6d){return function(_0x5916e3){if(_0x5916e3){var _0x3067c1=typeof _0x32fd6d[_0xf999('0x21')]==='undefined'&&typeof _0x32fd6d[_0xf999('0x22')]==='undefined';var _0x4dd325=_0x5916e3[_0xf999('0x23')];var _0x20b494=_0x3067c1?0x0:_0x32fd6d['offset'];var _0x2830c9=_0x3067c1?_0x5916e3['count']:_0x32fd6d['offset']+_0x32fd6d['limit'];var _0x4ac679;if(_0x2830c9>=_0x4dd325){_0x2830c9=_0x4dd325;_0x4ac679=0xc8;}else{_0x4ac679=0xce;}_0x5d0d24[_0xf999('0x1e')](_0x4ac679);return _0x5d0d24[_0xf999('0x24')]('Content-Range',_0x20b494+'-'+_0x2830c9+'/'+_0x4dd325)[_0xf999('0x20')](_0x5916e3);}return null;};}function patchUpdates(_0x5102cc){return function(_0x58806e){try{jsonpatch['apply'](_0x58806e,_0x5102cc,!![]);}catch(_0x2857f8){return BPromise['reject'](_0x2857f8);}return _0x58806e[_0xf999('0x25')]();};}function saveUpdates(_0x503602,_0x5340c9){return function(_0x4e7a36){if(_0x4e7a36){return _0x4e7a36[_0xf999('0x26')](_0x503602)['then'](function(_0x3a1c1c){return _0x3a1c1c;});}return null;};}function removeEntity(_0x13a5cb,_0x250c6a){return function(_0x129229){if(_0x129229){return _0x129229[_0xf999('0x27')]()['then'](function(){_0x13a5cb['status'](0xcc)[_0xf999('0x1f')]();});}};}function handleEntityNotFound(_0x6af768,_0x1f0aa3){return function(_0xa58f70){if(!_0xa58f70){_0x6af768[_0xf999('0x28')](0x194);}return _0xa58f70;};}function handleError(_0x2ecbad,_0xde28f){_0xde28f=_0xde28f||0x1f4;return function(_0xe28e1f){logger[_0xf999('0x29')](_0xe28e1f[_0xf999('0x2a')]);if(_0xe28e1f['name']){delete _0xe28e1f[_0xf999('0x2b')];}_0x2ecbad[_0xf999('0x1e')](_0xde28f)[_0xf999('0x2c')](_0xe28e1f);};}exports[_0xf999('0x2d')]=function(_0x4253a5,_0x11001b){var _0x2b9b6c={},_0x1d6ee1={},_0x55ff8a={'count':0x0,'rows':[]};var _0x9ef3c5=_[_0xf999('0x2e')](db[_0xf999('0x2f')][_0xf999('0x30')],function(_0x4c515f){return{'name':_0x4c515f[_0xf999('0x31')],'type':_0x4c515f['type']['key']};});_0x1d6ee1[_0xf999('0x32')]=_[_0xf999('0x2e')](_0x9ef3c5,_0xf999('0x2b'));_0x1d6ee1[_0xf999('0x33')]=_[_0xf999('0x34')](_0x4253a5['query']);_0x1d6ee1[_0xf999('0x35')]=_['intersection'](_0x1d6ee1['model'],_0x1d6ee1[_0xf999('0x33')]);_0x2b9b6c[_0xf999('0x36')]=_[_0xf999('0x37')](_0x1d6ee1[_0xf999('0x32')],qs[_0xf999('0x38')](_0x4253a5[_0xf999('0x33')][_0xf999('0x38')]));_0x2b9b6c[_0xf999('0x36')]=_0x2b9b6c['attributes'][_0xf999('0x39')]?_0x2b9b6c[_0xf999('0x36')]:_0x1d6ee1[_0xf999('0x32')];if(!_0x4253a5[_0xf999('0x33')][_0xf999('0x3a')]('nolimit')){_0x2b9b6c[_0xf999('0x22')]=qs[_0xf999('0x22')](_0x4253a5[_0xf999('0x33')][_0xf999('0x22')]);_0x2b9b6c['offset']=qs[_0xf999('0x21')](_0x4253a5[_0xf999('0x33')][_0xf999('0x21')]);}_0x2b9b6c[_0xf999('0x3b')]=qs['sort'](_0x4253a5['query'][_0xf999('0x3c')]);_0x2b9b6c['where']=qs[_0xf999('0x35')](_[_0xf999('0x3d')](_0x4253a5['query'],_0x1d6ee1[_0xf999('0x35')]),_0x9ef3c5);if(_0x4253a5[_0xf999('0x33')][_0xf999('0x3e')]){_0x2b9b6c['where']=_[_0xf999('0x3f')](_0x2b9b6c[_0xf999('0x40')],{'$or':_['map'](_0x9ef3c5,function(_0x5991c8){if(_0x5991c8[_0xf999('0x41')]!==_0xf999('0x42')){var _0x2a43c4={};_0x2a43c4[_0x5991c8[_0xf999('0x2b')]]={'$like':'%'+_0x4253a5[_0xf999('0x33')][_0xf999('0x3e')]+'%'};return _0x2a43c4;}})});}_0x2b9b6c=_['merge']({},_0x2b9b6c,_0x4253a5[_0xf999('0x43')]);var _0x33b5c4={'where':_0x2b9b6c[_0xf999('0x40')]};return db['SmsQueueReport']['count'](_0x33b5c4)[_0xf999('0x44')](function(_0x34d32f){_0x55ff8a[_0xf999('0x23')]=_0x34d32f;if(_0x4253a5[_0xf999('0x33')]['includeAll']){_0x2b9b6c[_0xf999('0x45')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xf999('0x46')](_0x2b9b6c);})[_0xf999('0x44')](function(_0x50a21e){_0x55ff8a[_0xf999('0x47')]=_0x50a21e;return _0x55ff8a;})[_0xf999('0x44')](respondWithFilteredResult(_0x11001b,_0x2b9b6c))[_0xf999('0x48')](handleError(_0x11001b,null));};exports['show']=function(_0x2d9d8f,_0x4d7933){var _0x1249bd={'raw':!![],'where':{'id':_0x2d9d8f[_0xf999('0x49')]['id']}},_0x3f0618={};_0x3f0618['model']=_[_0xf999('0x34')](db[_0xf999('0x2f')][_0xf999('0x30')]);_0x3f0618[_0xf999('0x33')]=_[_0xf999('0x34')](_0x2d9d8f[_0xf999('0x33')]);_0x3f0618['filters']=_[_0xf999('0x37')](_0x3f0618[_0xf999('0x32')],_0x3f0618['query']);_0x1249bd[_0xf999('0x36')]=_[_0xf999('0x37')](_0x3f0618['model'],qs['fields'](_0x2d9d8f[_0xf999('0x33')]['fields']));_0x1249bd[_0xf999('0x36')]=_0x1249bd['attributes'][_0xf999('0x39')]?_0x1249bd[_0xf999('0x36')]:_0x3f0618['model'];if(_0x2d9d8f[_0xf999('0x33')]['includeAll']){_0x1249bd[_0xf999('0x45')]=[{'all':!![]}];}_0x1249bd=_[_0xf999('0x3f')]({},_0x1249bd,_0x2d9d8f[_0xf999('0x43')]);return db['SmsQueueReport'][_0xf999('0x4a')](_0x1249bd)[_0xf999('0x44')](handleEntityNotFound(_0x4d7933,null))[_0xf999('0x44')](respondWithResult(_0x4d7933,null))['catch'](handleError(_0x4d7933,null));};exports[_0xf999('0x4b')]=function(_0x2b08f1,_0x3c1fbb){return db[_0xf999('0x2f')]['create'](_0x2b08f1[_0xf999('0x4c')],{})[_0xf999('0x44')](respondWithResult(_0x3c1fbb,0xc9))['catch'](handleError(_0x3c1fbb,null));};exports['update']=function(_0x36cb36,_0x5653ec){if(_0x36cb36[_0xf999('0x4c')]['id']){delete _0x36cb36['body']['id'];}return db['SmsQueueReport'][_0xf999('0x4a')]({'where':{'id':_0x36cb36[_0xf999('0x49')]['id']}})[_0xf999('0x44')](handleEntityNotFound(_0x5653ec,null))[_0xf999('0x44')](saveUpdates(_0x36cb36['body'],null))[_0xf999('0x44')](respondWithResult(_0x5653ec,null))[_0xf999('0x48')](handleError(_0x5653ec,null));};exports[_0xf999('0x27')]=function(_0x180416,_0xeaff2a){return db['SmsQueueReport']['find']({'where':{'id':_0x180416[_0xf999('0x49')]['id']}})[_0xf999('0x44')](handleEntityNotFound(_0xeaff2a,null))[_0xf999('0x44')](removeEntity(_0xeaff2a,null))[_0xf999('0x48')](handleError(_0xeaff2a,null));};exports['describe']=function(_0x6e883b,_0x3eb9cb){return db['SmsQueueReport'][_0xf999('0x4d')]()[_0xf999('0x44')](respondWithResult(_0x3eb9cb,null))['catch'](handleError(_0x3eb9cb,null));}; \ No newline at end of file +var _0xb582=['sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','api','../../config/environment','end','status','json','offset','undefined','limit','count','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SmsQueueReport','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0xac74c6,_0x358374){var _0x630f72=function(_0x13fe72){while(--_0x13fe72){_0xac74c6['push'](_0xac74c6['shift']());}};_0x630f72(++_0x358374);}(_0xb582,0x1e7));var _0x2b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb582[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x2b58('0x0'));var rimraf=require(_0x2b58('0x1'));var zipdir=require(_0x2b58('0x2'));var jsonpatch=require(_0x2b58('0x3'));var rp=require(_0x2b58('0x4'));var moment=require(_0x2b58('0x5'));var BPromise=require(_0x2b58('0x6'));var Mustache=require(_0x2b58('0x7'));var util=require(_0x2b58('0x8'));var path=require(_0x2b58('0x9'));var sox=require('sox');var csv=require(_0x2b58('0xa'));var ejs=require(_0x2b58('0xb'));var fs=require('fs');var fs_extra=require(_0x2b58('0xc'));var _=require(_0x2b58('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b58('0xe'));var deskjs=require(_0x2b58('0xf'));var toCsv=require(_0x2b58('0xa'));var querystring=require(_0x2b58('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b58('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b58('0x12'));var utils=require('../../config/utils');var config=require(_0x2b58('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5219fe,_0x29aac6){_0x29aac6=_0x29aac6||0xcc;return function(_0x42c728){if(_0x42c728){return _0x5219fe['sendStatus'](_0x29aac6);}return _0x5219fe['status'](_0x29aac6)[_0x2b58('0x14')]();};}function respondWithResult(_0x17e143,_0x5288e4){_0x5288e4=_0x5288e4||0xc8;return function(_0x3a9ab2){if(_0x3a9ab2){return _0x17e143[_0x2b58('0x15')](_0x5288e4)[_0x2b58('0x16')](_0x3a9ab2);}};}function respondWithFilteredResult(_0x1a2be4,_0x15c0d7){return function(_0x12cf8d){if(_0x12cf8d){var _0x38a75e=typeof _0x15c0d7[_0x2b58('0x17')]===_0x2b58('0x18')&&typeof _0x15c0d7[_0x2b58('0x19')]==='undefined';var _0x67a59f=_0x12cf8d[_0x2b58('0x1a')];var _0x820fc1=_0x38a75e?0x0:_0x15c0d7[_0x2b58('0x17')];var _0x56a415=_0x38a75e?_0x12cf8d[_0x2b58('0x1a')]:_0x15c0d7[_0x2b58('0x17')]+_0x15c0d7['limit'];var _0x4d3542;if(_0x56a415>=_0x67a59f){_0x56a415=_0x67a59f;_0x4d3542=0xc8;}else{_0x4d3542=0xce;}_0x1a2be4[_0x2b58('0x15')](_0x4d3542);return _0x1a2be4['set']('Content-Range',_0x820fc1+'-'+_0x56a415+'/'+_0x67a59f)[_0x2b58('0x16')](_0x12cf8d);}return null;};}function patchUpdates(_0x35a27c){return function(_0x37dc62){try{jsonpatch['apply'](_0x37dc62,_0x35a27c,!![]);}catch(_0x1d347e){return BPromise['reject'](_0x1d347e);}return _0x37dc62[_0x2b58('0x1b')]();};}function saveUpdates(_0x42db06,_0x56fc0c){return function(_0x46dcdd){if(_0x46dcdd){return _0x46dcdd[_0x2b58('0x1c')](_0x42db06)['then'](function(_0x538736){return _0x538736;});}return null;};}function removeEntity(_0x40280d,_0x361e49){return function(_0x455dc6){if(_0x455dc6){return _0x455dc6[_0x2b58('0x1d')]()[_0x2b58('0x1e')](function(){_0x40280d[_0x2b58('0x15')](0xcc)[_0x2b58('0x14')]();});}};}function handleEntityNotFound(_0x192ea7,_0xac819e){return function(_0xc81a1c){if(!_0xc81a1c){_0x192ea7[_0x2b58('0x1f')](0x194);}return _0xc81a1c;};}function handleError(_0x36dfb3,_0x3833ee){_0x3833ee=_0x3833ee||0x1f4;return function(_0x2fcc5e){logger[_0x2b58('0x20')](_0x2fcc5e[_0x2b58('0x21')]);if(_0x2fcc5e[_0x2b58('0x22')]){delete _0x2fcc5e[_0x2b58('0x22')];}_0x36dfb3[_0x2b58('0x15')](_0x3833ee)[_0x2b58('0x23')](_0x2fcc5e);};}exports[_0x2b58('0x24')]=function(_0x287044,_0x2af27e){var _0x5ad738={},_0x567873={},_0xcf8c7f={'count':0x0,'rows':[]};var _0x4c3048=_[_0x2b58('0x25')](db[_0x2b58('0x26')]['rawAttributes'],function(_0x3075e1){return{'name':_0x3075e1[_0x2b58('0x27')],'type':_0x3075e1['type']['key']};});_0x567873['model']=_[_0x2b58('0x25')](_0x4c3048,_0x2b58('0x22'));_0x567873['query']=_['keys'](_0x287044[_0x2b58('0x28')]);_0x567873[_0x2b58('0x29')]=_[_0x2b58('0x2a')](_0x567873[_0x2b58('0x2b')],_0x567873[_0x2b58('0x28')]);_0x5ad738[_0x2b58('0x2c')]=_[_0x2b58('0x2a')](_0x567873[_0x2b58('0x2b')],qs[_0x2b58('0x2d')](_0x287044[_0x2b58('0x28')][_0x2b58('0x2d')]));_0x5ad738[_0x2b58('0x2c')]=_0x5ad738[_0x2b58('0x2c')][_0x2b58('0x2e')]?_0x5ad738[_0x2b58('0x2c')]:_0x567873['model'];if(!_0x287044[_0x2b58('0x28')][_0x2b58('0x2f')]('nolimit')){_0x5ad738[_0x2b58('0x19')]=qs[_0x2b58('0x19')](_0x287044['query']['limit']);_0x5ad738[_0x2b58('0x17')]=qs[_0x2b58('0x17')](_0x287044[_0x2b58('0x28')]['offset']);}_0x5ad738[_0x2b58('0x30')]=qs[_0x2b58('0x31')](_0x287044[_0x2b58('0x28')]['sort']);_0x5ad738[_0x2b58('0x32')]=qs['filters'](_[_0x2b58('0x33')](_0x287044[_0x2b58('0x28')],_0x567873['filters']),_0x4c3048);if(_0x287044[_0x2b58('0x28')][_0x2b58('0x34')]){_0x5ad738[_0x2b58('0x32')]=_[_0x2b58('0x35')](_0x5ad738['where'],{'$or':_[_0x2b58('0x25')](_0x4c3048,function(_0x26d45b){if(_0x26d45b[_0x2b58('0x36')]!==_0x2b58('0x37')){var _0x3c251b={};_0x3c251b[_0x26d45b[_0x2b58('0x22')]]={'$like':'%'+_0x287044[_0x2b58('0x28')][_0x2b58('0x34')]+'%'};return _0x3c251b;}})});}_0x5ad738=_['merge']({},_0x5ad738,_0x287044[_0x2b58('0x38')]);var _0x56cbf0={'where':_0x5ad738[_0x2b58('0x32')]};return db[_0x2b58('0x26')][_0x2b58('0x1a')](_0x56cbf0)[_0x2b58('0x1e')](function(_0x41c4dc){_0xcf8c7f[_0x2b58('0x1a')]=_0x41c4dc;if(_0x287044['query'][_0x2b58('0x39')]){_0x5ad738['include']=[{'all':!![]}];}return db[_0x2b58('0x26')][_0x2b58('0x3a')](_0x5ad738);})['then'](function(_0x49b4d3){_0xcf8c7f['rows']=_0x49b4d3;return _0xcf8c7f;})[_0x2b58('0x1e')](respondWithFilteredResult(_0x2af27e,_0x5ad738))[_0x2b58('0x3b')](handleError(_0x2af27e,null));};exports[_0x2b58('0x3c')]=function(_0x386626,_0x175376){var _0xc56c21={'raw':!![],'where':{'id':_0x386626[_0x2b58('0x3d')]['id']}},_0x28baa6={};_0x28baa6[_0x2b58('0x2b')]=_[_0x2b58('0x3e')](db[_0x2b58('0x26')]['rawAttributes']);_0x28baa6[_0x2b58('0x28')]=_['keys'](_0x386626[_0x2b58('0x28')]);_0x28baa6['filters']=_[_0x2b58('0x2a')](_0x28baa6[_0x2b58('0x2b')],_0x28baa6[_0x2b58('0x28')]);_0xc56c21[_0x2b58('0x2c')]=_[_0x2b58('0x2a')](_0x28baa6[_0x2b58('0x2b')],qs[_0x2b58('0x2d')](_0x386626['query'][_0x2b58('0x2d')]));_0xc56c21[_0x2b58('0x2c')]=_0xc56c21['attributes']['length']?_0xc56c21['attributes']:_0x28baa6['model'];if(_0x386626[_0x2b58('0x28')][_0x2b58('0x39')]){_0xc56c21['include']=[{'all':!![]}];}_0xc56c21=_[_0x2b58('0x35')]({},_0xc56c21,_0x386626['options']);return db['SmsQueueReport']['find'](_0xc56c21)[_0x2b58('0x1e')](handleEntityNotFound(_0x175376,null))[_0x2b58('0x1e')](respondWithResult(_0x175376,null))['catch'](handleError(_0x175376,null));};exports['create']=function(_0x10a276,_0x3ce515){return db[_0x2b58('0x26')][_0x2b58('0x3f')](_0x10a276[_0x2b58('0x40')],{})[_0x2b58('0x1e')](respondWithResult(_0x3ce515,0xc9))[_0x2b58('0x3b')](handleError(_0x3ce515,null));};exports[_0x2b58('0x1c')]=function(_0x5d8c82,_0x3a530b){if(_0x5d8c82[_0x2b58('0x40')]['id']){delete _0x5d8c82[_0x2b58('0x40')]['id'];}return db[_0x2b58('0x26')][_0x2b58('0x41')]({'where':{'id':_0x5d8c82[_0x2b58('0x3d')]['id']}})[_0x2b58('0x1e')](handleEntityNotFound(_0x3a530b,null))['then'](saveUpdates(_0x5d8c82['body'],null))[_0x2b58('0x1e')](respondWithResult(_0x3a530b,null))[_0x2b58('0x3b')](handleError(_0x3a530b,null));};exports['destroy']=function(_0x1fb8fd,_0x1076cb){return db[_0x2b58('0x26')]['find']({'where':{'id':_0x1fb8fd[_0x2b58('0x3d')]['id']}})[_0x2b58('0x1e')](handleEntityNotFound(_0x1076cb,null))[_0x2b58('0x1e')](removeEntity(_0x1076cb,null))[_0x2b58('0x3b')](handleError(_0x1076cb,null));};exports[_0x2b58('0x42')]=function(_0x1ea659,_0x26a4a9){return db[_0x2b58('0x26')]['describe']()[_0x2b58('0x1e')](respondWithResult(_0x26a4a9,null))[_0x2b58('0x3b')](handleError(_0x26a4a9,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e344043..8a1f98d 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x14f132,_0x4cf31e){var _0x24bf39=function(_0x10ddad){while(--_0x10ddad){_0x14f132['push'](_0x14f132['shift']());}};_0x24bf39(++_0x4cf31e);}(_0xe706,0xa3));var _0x6e70=function(_0x413d74,_0x5bab1b){_0x413d74=_0x413d74-0x0;var _0x177f90=_0xe706[_0x413d74];return _0x177f90;};'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 22dada3..77422d1 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 _0xc4a3=['options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsQueueReport','create','body'];(function(_0x40b795,_0x1218cc){var _0x26a0fc=function(_0x222519){while(--_0x222519){_0x40b795['push'](_0x40b795['shift']());}};_0x26a0fc(++_0x1218cc);}(_0xc4a3,0x155));var _0x3c4a=function(_0x2ac109,_0x1c0ade){_0x2ac109=_0x2ac109-0x0;var _0x1621d2=_0xc4a3[_0x2ac109];return _0x1621d2;};'use strict';var _=require(_0x3c4a('0x0'));var util=require(_0x3c4a('0x1'));var moment=require(_0x3c4a('0x2'));var BPromise=require(_0x3c4a('0x3'));var rs=require(_0x3c4a('0x4'));var fs=require('fs');var Redis=require(_0x3c4a('0x5'));var db=require(_0x3c4a('0x6'))['db'];var utils=require(_0x3c4a('0x7'));var logger=require(_0x3c4a('0x8'))(_0x3c4a('0x9'));var config=require(_0x3c4a('0xa'));var jayson=require(_0x3c4a('0xb'));var client=jayson[_0x3c4a('0xc')][_0x3c4a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x252a11,_0x2deb1a,_0x114722){return new BPromise(function(_0x5120f8,_0x287b15){return client[_0x3c4a('0xe')](_0x252a11,_0x114722)[_0x3c4a('0xf')](function(_0x3769dc){logger[_0x3c4a('0x10')](_0x3c4a('0x11'),_0x2deb1a,'request\x20sent');logger[_0x3c4a('0x12')](_0x3c4a('0x13'),_0x2deb1a,_0x3c4a('0x14'),JSON[_0x3c4a('0x15')](_0x3769dc));if(_0x3769dc[_0x3c4a('0x16')]){if(_0x3769dc[_0x3c4a('0x16')][_0x3c4a('0x17')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x2deb1a,_0x3769dc[_0x3c4a('0x16')][_0x3c4a('0x18')]);return _0x287b15(_0x3769dc[_0x3c4a('0x16')]['message']);}logger[_0x3c4a('0x16')](_0x3c4a('0x11'),_0x2deb1a,_0x3769dc[_0x3c4a('0x16')]['message']);return _0x5120f8(_0x3769dc[_0x3c4a('0x16')][_0x3c4a('0x18')]);}else{logger[_0x3c4a('0x10')](_0x3c4a('0x11'),_0x2deb1a,'request\x20sent');_0x5120f8(_0x3769dc['result'][_0x3c4a('0x18')]);}})[_0x3c4a('0x19')](function(_0x174f4b){logger[_0x3c4a('0x16')](_0x3c4a('0x11'),_0x2deb1a,_0x174f4b);_0x287b15(_0x174f4b);});});}exports['CreateSmsQueueReport']=function(_0x3bc686){var _0x1d365d=this;return new Promise(function(_0x52b782,_0x2ca9ee){return db[_0x3c4a('0x1a')][_0x3c4a('0x1b')](_0x3bc686[_0x3c4a('0x1c')],{'raw':_0x3bc686[_0x3c4a('0x1d')]?_0x3bc686[_0x3c4a('0x1d')][_0x3c4a('0x1e')]===undefined?!![]:![]:!![]})[_0x3c4a('0xf')](function(_0x1bd234){logger['info']('CreateSmsQueueReport',_0x3bc686);logger[_0x3c4a('0x12')](_0x3c4a('0x1f'),_0x3bc686,JSON['stringify'](_0x1bd234));_0x52b782(_0x1bd234);})[_0x3c4a('0x19')](function(_0x5d689d){logger['error'](_0x3c4a('0x1f'),_0x5d689d['message'],_0x3bc686);_0x2ca9ee(_0x1d365d[_0x3c4a('0x16')](0x1f4,_0x5d689d[_0x3c4a('0x18')]));});});};exports[_0x3c4a('0x20')]=function(_0x277be4){var _0x3e0865=this;return new Promise(function(_0x198564,_0x113c17){return db[_0x3c4a('0x1a')][_0x3c4a('0x21')](_0x277be4[_0x3c4a('0x1c')],{'raw':_0x277be4[_0x3c4a('0x1d')]?_0x277be4[_0x3c4a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277be4[_0x3c4a('0x1d')]?_0x277be4[_0x3c4a('0x1d')][_0x3c4a('0x22')]||null:null,'attributes':_0x277be4[_0x3c4a('0x1d')]?_0x277be4[_0x3c4a('0x1d')][_0x3c4a('0x23')]||null:null,'limit':_0x277be4['options']?_0x277be4[_0x3c4a('0x1d')][_0x3c4a('0x24')]||null:null})[_0x3c4a('0xf')](function(_0x102b25){logger['info']('UpdateSmsQueueReport',_0x277be4);logger[_0x3c4a('0x12')](_0x3c4a('0x20'),_0x277be4,JSON[_0x3c4a('0x15')](_0x102b25));_0x198564(_0x102b25);})[_0x3c4a('0x19')](function(_0x3bf10e){logger[_0x3c4a('0x16')](_0x3c4a('0x20'),_0x3bf10e[_0x3c4a('0x18')],_0x277be4);_0x113c17(_0x3e0865[_0x3c4a('0x16')](0x1f4,_0x3bf10e['message']));});});}; \ No newline at end of file +var _0x8a2c=['create','body','options','stringify','SmsQueueReport','raw','where','attributes','limit','UpdateSmsQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateSmsQueueReport'];(function(_0x1e8c62,_0xfdf39a){var _0x2edf73=function(_0x108ab7){while(--_0x108ab7){_0x1e8c62['push'](_0x1e8c62['shift']());}};_0x2edf73(++_0xfdf39a);}(_0x8a2c,0x166));var _0xc8a2=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x8a2c[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xc8a2('0x0'));var util=require('util');var moment=require(_0xc8a2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8a2('0x2'));var db=require(_0xc8a2('0x3'))['db'];var utils=require(_0xc8a2('0x4'));var logger=require(_0xc8a2('0x5'))('rpc');var config=require(_0xc8a2('0x6'));var jayson=require(_0xc8a2('0x7'));var client=jayson['client'][_0xc8a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3598,_0xfdbd5d,_0x3c575d){return new BPromise(function(_0x147b93,_0x5b300e){return client['request'](_0x2f3598,_0x3c575d)[_0xc8a2('0x9')](function(_0xcdc456){logger[_0xc8a2('0xa')](_0xc8a2('0xb'),_0xfdbd5d,_0xc8a2('0xc'));logger[_0xc8a2('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xfdbd5d,_0xc8a2('0xc'),JSON['stringify'](_0xcdc456));if(_0xcdc456[_0xc8a2('0xe')]){if(_0xcdc456[_0xc8a2('0xe')][_0xc8a2('0xf')]===0x1f4){logger['error'](_0xc8a2('0xb'),_0xfdbd5d,_0xcdc456[_0xc8a2('0xe')][_0xc8a2('0x10')]);return _0x5b300e(_0xcdc456[_0xc8a2('0xe')][_0xc8a2('0x10')]);}logger[_0xc8a2('0xe')](_0xc8a2('0xb'),_0xfdbd5d,_0xcdc456['error'][_0xc8a2('0x10')]);return _0x147b93(_0xcdc456[_0xc8a2('0xe')][_0xc8a2('0x10')]);}else{logger['info'](_0xc8a2('0xb'),_0xfdbd5d,_0xc8a2('0xc'));_0x147b93(_0xcdc456['result']['message']);}})[_0xc8a2('0x11')](function(_0x29714a){logger['error'](_0xc8a2('0xb'),_0xfdbd5d,_0x29714a);_0x5b300e(_0x29714a);});});}exports[_0xc8a2('0x12')]=function(_0x554991){var _0x2bcc8d=this;return new Promise(function(_0x5c1400,_0xb7ecf4){return db['SmsQueueReport'][_0xc8a2('0x13')](_0x554991[_0xc8a2('0x14')],{'raw':_0x554991[_0xc8a2('0x15')]?_0x554991[_0xc8a2('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xc8a2('0x9')](function(_0x49b566){logger[_0xc8a2('0xa')]('CreateSmsQueueReport',_0x554991);logger[_0xc8a2('0xd')](_0xc8a2('0x12'),_0x554991,JSON[_0xc8a2('0x16')](_0x49b566));_0x5c1400(_0x49b566);})[_0xc8a2('0x11')](function(_0x50c41d){logger[_0xc8a2('0xe')](_0xc8a2('0x12'),_0x50c41d[_0xc8a2('0x10')],_0x554991);_0xb7ecf4(_0x2bcc8d['error'](0x1f4,_0x50c41d[_0xc8a2('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x3ddf05){var _0x1d65b3=this;return new Promise(function(_0x5c9a66,_0x5988c9){return db[_0xc8a2('0x17')]['update'](_0x3ddf05[_0xc8a2('0x14')],{'raw':_0x3ddf05['options']?_0x3ddf05['options'][_0xc8a2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ddf05[_0xc8a2('0x15')]?_0x3ddf05[_0xc8a2('0x15')][_0xc8a2('0x19')]||null:null,'attributes':_0x3ddf05[_0xc8a2('0x15')]?_0x3ddf05[_0xc8a2('0x15')][_0xc8a2('0x1a')]||null:null,'limit':_0x3ddf05[_0xc8a2('0x15')]?_0x3ddf05[_0xc8a2('0x15')][_0xc8a2('0x1b')]||null:null})[_0xc8a2('0x9')](function(_0x3f83bb){logger[_0xc8a2('0xa')]('UpdateSmsQueueReport',_0x3ddf05);logger[_0xc8a2('0xd')](_0xc8a2('0x1c'),_0x3ddf05,JSON[_0xc8a2('0x16')](_0x3f83bb));_0x5c9a66(_0x3f83bb);})[_0xc8a2('0x11')](function(_0x2f5bbf){logger[_0xc8a2('0xe')](_0xc8a2('0x1c'),_0x2f5bbf[_0xc8a2('0x10')],_0x3ddf05);_0x5988c9(_0x1d65b3[_0xc8a2('0xe')](0x1f4,_0x2f5bbf[_0xc8a2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c3d565e..b27fbc2 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 _0xd2bb=['../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x39c723,_0x3aab65){var _0x301685=function(_0x1ad515){while(--_0x1ad515){_0x39c723['push'](_0x39c723['shift']());}};_0x301685(++_0x3aab65);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5ca043,_0x12dfb8){_0x5ca043=_0x5ca043-0x0;var _0x2d6d60=_0xd2bb[_0x5ca043];return _0x2d6d60;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0x8')](_0xbd2b('0xd'),auth['isAuthenticated'](),controller[_0xbd2b('0xe')]);router['post']('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['put'](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);router[_0xbd2b('0x11')](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x12')]);module[_0xbd2b('0x13')]=router; \ No newline at end of file +var _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3bf619,_0x442781){var _0x39a740=function(_0x57dc3c){while(--_0x57dc3c){_0x3bf619['push'](_0x3bf619['shift']());}};_0x39a740(++_0x442781);}(_0x5178,0x171));var _0x8517=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5178[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./smsTransferReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ce6616f..274b8d6 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x441e17,_0x340ea9){var _0x3c9eb4=function(_0x3b941f){while(--_0x3b941f){_0x441e17['push'](_0x441e17['shift']());}};_0x3c9eb4(++_0x340ea9);}(_0x34e8,0x12c));var _0x834e=function(_0x3978f6,_0xea2bb){_0x3978f6=_0x3978f6-0x0;var _0x5a408c=_0x34e8[_0x3978f6];return _0x5a408c;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x28b15f,_0x3ce58f){var _0x28450b=function(_0x1cd019){while(--_0x1cd019){_0x28b15f['push'](_0x28b15f['shift']());}};_0x28450b(++_0x3ce58f);}(_0xaa88,0x137));var _0x8aa8=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xaa88[_0xa990b7];return _0x52c99c;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index de61f13..76c0c34 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 _0x84f1=['fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SmsTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','merge','VIRTUAL','options','rows','show','params','rawAttributes','include','catch','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x1c60e0,_0x46a019){var _0x411508=function(_0x45c2f0){while(--_0x45c2f0){_0x1c60e0['push'](_0x1c60e0['shift']());}};_0x411508(++_0x46a019);}(_0x84f1,0x89));var _0x184f=function(_0x40e6d3,_0x4fa998){_0x40e6d3=_0x40e6d3-0x0;var _0x48df98=_0x84f1[_0x40e6d3];return _0x48df98;};'use strict';var emlformat=require(_0x184f('0x0'));var rimraf=require(_0x184f('0x1'));var zipdir=require(_0x184f('0x2'));var jsonpatch=require(_0x184f('0x3'));var rp=require(_0x184f('0x4'));var moment=require('moment');var BPromise=require(_0x184f('0x5'));var Mustache=require('mustache');var util=require(_0x184f('0x6'));var path=require(_0x184f('0x7'));var sox=require(_0x184f('0x8'));var csv=require(_0x184f('0x9'));var ejs=require(_0x184f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x184f('0xb'));var squel=require(_0x184f('0xc'));var crypto=require('crypto');var jsforce=require(_0x184f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x184f('0x9'));var querystring=require(_0x184f('0xe'));var Papa=require(_0x184f('0xf'));var Redis=require('ioredis');var authService=require(_0x184f('0x10'));var qs=require(_0x184f('0x11'));var as=require(_0x184f('0x12'));var hardwareService=require(_0x184f('0x13'));var logger=require('../../config/logger')(_0x184f('0x14'));var utils=require(_0x184f('0x15'));var config=require(_0x184f('0x16'));var licenseUtil=require(_0x184f('0x17'));var db=require(_0x184f('0x18'))['db'];function respondWithStatusCode(_0x4ce579,_0x1fb8f7){_0x1fb8f7=_0x1fb8f7||0xcc;return function(_0x2cb5d5){if(_0x2cb5d5){return _0x4ce579[_0x184f('0x19')](_0x1fb8f7);}return _0x4ce579[_0x184f('0x1a')](_0x1fb8f7)[_0x184f('0x1b')]();};}function respondWithResult(_0x50d3a1,_0x3a3b9f){_0x3a3b9f=_0x3a3b9f||0xc8;return function(_0x3bbaeb){if(_0x3bbaeb){return _0x50d3a1[_0x184f('0x1a')](_0x3a3b9f)[_0x184f('0x1c')](_0x3bbaeb);}};}function respondWithFilteredResult(_0x37b8b2,_0x8b55e1){return function(_0x36d7f0){if(_0x36d7f0){var _0x5e5338=typeof _0x8b55e1['offset']===_0x184f('0x1d')&&typeof _0x8b55e1[_0x184f('0x1e')]===_0x184f('0x1d');var _0x3c2b85=_0x36d7f0[_0x184f('0x1f')];var _0x377350=_0x5e5338?0x0:_0x8b55e1[_0x184f('0x20')];var _0x2854df=_0x5e5338?_0x36d7f0['count']:_0x8b55e1['offset']+_0x8b55e1[_0x184f('0x1e')];var _0x1914ce;if(_0x2854df>=_0x3c2b85){_0x2854df=_0x3c2b85;_0x1914ce=0xc8;}else{_0x1914ce=0xce;}_0x37b8b2['status'](_0x1914ce);return _0x37b8b2[_0x184f('0x21')](_0x184f('0x22'),_0x377350+'-'+_0x2854df+'/'+_0x3c2b85)[_0x184f('0x1c')](_0x36d7f0);}return null;};}function patchUpdates(_0x4fffd9){return function(_0x2bfa28){try{jsonpatch[_0x184f('0x23')](_0x2bfa28,_0x4fffd9,!![]);}catch(_0x1b9a39){return BPromise[_0x184f('0x24')](_0x1b9a39);}return _0x2bfa28[_0x184f('0x25')]();};}function saveUpdates(_0x500109,_0x463b9d){return function(_0x4aad44){if(_0x4aad44){return _0x4aad44['update'](_0x500109)[_0x184f('0x26')](function(_0x36ebc3){return _0x36ebc3;});}return null;};}function removeEntity(_0x3e2290,_0x37a0a0){return function(_0x26d613){if(_0x26d613){return _0x26d613[_0x184f('0x27')]()[_0x184f('0x26')](function(){_0x3e2290[_0x184f('0x1a')](0xcc)[_0x184f('0x1b')]();});}};}function handleEntityNotFound(_0x2be246,_0x2a6d86){return function(_0x5ecc87){if(!_0x5ecc87){_0x2be246[_0x184f('0x19')](0x194);}return _0x5ecc87;};}function handleError(_0x373bb5,_0x70169){_0x70169=_0x70169||0x1f4;return function(_0x33c771){logger[_0x184f('0x28')](_0x33c771[_0x184f('0x29')]);if(_0x33c771['name']){delete _0x33c771[_0x184f('0x2a')];}_0x373bb5[_0x184f('0x1a')](_0x70169)[_0x184f('0x2b')](_0x33c771);};}exports['index']=function(_0x283239,_0x1bd45d){var _0x19602c={},_0x49a926={},_0x392d76={'count':0x0,'rows':[]};var _0x10ef7a=_[_0x184f('0x2c')](db[_0x184f('0x2d')]['rawAttributes'],function(_0x273084){return{'name':_0x273084[_0x184f('0x2e')],'type':_0x273084[_0x184f('0x2f')]['key']};});_0x49a926[_0x184f('0x30')]=_[_0x184f('0x2c')](_0x10ef7a,_0x184f('0x2a'));_0x49a926[_0x184f('0x31')]=_[_0x184f('0x32')](_0x283239[_0x184f('0x31')]);_0x49a926[_0x184f('0x33')]=_[_0x184f('0x34')](_0x49a926[_0x184f('0x30')],_0x49a926['query']);_0x19602c[_0x184f('0x35')]=_[_0x184f('0x34')](_0x49a926[_0x184f('0x30')],qs[_0x184f('0x36')](_0x283239[_0x184f('0x31')][_0x184f('0x36')]));_0x19602c['attributes']=_0x19602c[_0x184f('0x35')][_0x184f('0x37')]?_0x19602c[_0x184f('0x35')]:_0x49a926[_0x184f('0x30')];if(!_0x283239['query'][_0x184f('0x38')]('nolimit')){_0x19602c[_0x184f('0x1e')]=qs[_0x184f('0x1e')](_0x283239['query'][_0x184f('0x1e')]);_0x19602c['offset']=qs[_0x184f('0x20')](_0x283239[_0x184f('0x31')][_0x184f('0x20')]);}_0x19602c['order']=qs['sort'](_0x283239[_0x184f('0x31')]['sort']);_0x19602c[_0x184f('0x39')]=qs[_0x184f('0x33')](_['pick'](_0x283239[_0x184f('0x31')],_0x49a926[_0x184f('0x33')]),_0x10ef7a);if(_0x283239[_0x184f('0x31')]['filter']){_0x19602c[_0x184f('0x39')]=_[_0x184f('0x3a')](_0x19602c[_0x184f('0x39')],{'$or':_[_0x184f('0x2c')](_0x10ef7a,function(_0x5c1223){if(_0x5c1223[_0x184f('0x2f')]!==_0x184f('0x3b')){var _0x2893d8={};_0x2893d8[_0x5c1223[_0x184f('0x2a')]]={'$like':'%'+_0x283239[_0x184f('0x31')]['filter']+'%'};return _0x2893d8;}})});}_0x19602c=_[_0x184f('0x3a')]({},_0x19602c,_0x283239[_0x184f('0x3c')]);var _0x266184={'where':_0x19602c[_0x184f('0x39')]};return db[_0x184f('0x2d')][_0x184f('0x1f')](_0x266184)['then'](function(_0x53679a){_0x392d76[_0x184f('0x1f')]=_0x53679a;if(_0x283239[_0x184f('0x31')]['includeAll']){_0x19602c['include']=[{'all':!![]}];}return db[_0x184f('0x2d')]['findAll'](_0x19602c);})[_0x184f('0x26')](function(_0x35fe22){_0x392d76[_0x184f('0x3d')]=_0x35fe22;return _0x392d76;})[_0x184f('0x26')](respondWithFilteredResult(_0x1bd45d,_0x19602c))['catch'](handleError(_0x1bd45d,null));};exports[_0x184f('0x3e')]=function(_0x227e0d,_0x24438e){var _0x113fff={'raw':!![],'where':{'id':_0x227e0d[_0x184f('0x3f')]['id']}},_0x3aea9d={};_0x3aea9d[_0x184f('0x30')]=_[_0x184f('0x32')](db[_0x184f('0x2d')][_0x184f('0x40')]);_0x3aea9d[_0x184f('0x31')]=_['keys'](_0x227e0d['query']);_0x3aea9d[_0x184f('0x33')]=_[_0x184f('0x34')](_0x3aea9d['model'],_0x3aea9d[_0x184f('0x31')]);_0x113fff['attributes']=_['intersection'](_0x3aea9d[_0x184f('0x30')],qs[_0x184f('0x36')](_0x227e0d[_0x184f('0x31')][_0x184f('0x36')]));_0x113fff[_0x184f('0x35')]=_0x113fff[_0x184f('0x35')]['length']?_0x113fff[_0x184f('0x35')]:_0x3aea9d[_0x184f('0x30')];if(_0x227e0d[_0x184f('0x31')]['includeAll']){_0x113fff[_0x184f('0x41')]=[{'all':!![]}];}_0x113fff=_[_0x184f('0x3a')]({},_0x113fff,_0x227e0d[_0x184f('0x3c')]);return db[_0x184f('0x2d')]['find'](_0x113fff)[_0x184f('0x26')](handleEntityNotFound(_0x24438e,null))[_0x184f('0x26')](respondWithResult(_0x24438e,null))[_0x184f('0x42')](handleError(_0x24438e,null));};exports['create']=function(_0x387750,_0x2aff72){return db[_0x184f('0x2d')][_0x184f('0x43')](_0x387750[_0x184f('0x44')],{})[_0x184f('0x26')](respondWithResult(_0x2aff72,0xc9))[_0x184f('0x42')](handleError(_0x2aff72,null));};exports[_0x184f('0x45')]=function(_0x4ca816,_0x953e25){if(_0x4ca816[_0x184f('0x44')]['id']){delete _0x4ca816['body']['id'];}return db[_0x184f('0x2d')]['find']({'where':{'id':_0x4ca816[_0x184f('0x3f')]['id']}})[_0x184f('0x26')](handleEntityNotFound(_0x953e25,null))[_0x184f('0x26')](saveUpdates(_0x4ca816[_0x184f('0x44')],null))['then'](respondWithResult(_0x953e25,null))[_0x184f('0x42')](handleError(_0x953e25,null));};exports[_0x184f('0x27')]=function(_0x598021,_0x563dd2){return db[_0x184f('0x2d')]['find']({'where':{'id':_0x598021[_0x184f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x563dd2,null))['then'](removeEntity(_0x563dd2,null))[_0x184f('0x42')](handleError(_0x563dd2,null));};exports['describe']=function(_0x41f740,_0x1fe5f2){return db[_0x184f('0x2d')]['describe']()['then'](respondWithResult(_0x1fe5f2,null))[_0x184f('0x42')](handleError(_0x1fe5f2,null));}; \ No newline at end of file +var _0xbceb=['request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','status','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','SmsTransferReport','findAll','rows','catch','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbceb,0x8c));var _0xbbce=function(_0x30a789,_0x194c73){_0x30a789=_0x30a789-0x0;var _0x5c4f3c=_0xbceb[_0x30a789];return _0x5c4f3c;};'use strict';var emlformat=require(_0xbbce('0x0'));var rimraf=require(_0xbbce('0x1'));var zipdir=require(_0xbbce('0x2'));var jsonpatch=require(_0xbbce('0x3'));var rp=require(_0xbbce('0x4'));var moment=require(_0xbbce('0x5'));var BPromise=require(_0xbbce('0x6'));var Mustache=require(_0xbbce('0x7'));var util=require('util');var path=require(_0xbbce('0x8'));var sox=require(_0xbbce('0x9'));var csv=require('to-csv');var ejs=require(_0xbbce('0xa'));var fs=require('fs');var fs_extra=require(_0xbbce('0xb'));var _=require(_0xbbce('0xc'));var squel=require('squel');var crypto=require(_0xbbce('0xd'));var jsforce=require(_0xbbce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbbce('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbbce('0x10'));var authService=require(_0xbbce('0x11'));var qs=require(_0xbbce('0x12'));var as=require(_0xbbce('0x13'));var hardwareService=require(_0xbbce('0x14'));var logger=require('../../config/logger')(_0xbbce('0x15'));var utils=require('../../config/utils');var config=require(_0xbbce('0x16'));var licenseUtil=require(_0xbbce('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c660,_0xa80807){_0xa80807=_0xa80807||0xcc;return function(_0x58dd8a){if(_0x58dd8a){return _0x14c660[_0xbbce('0x18')](_0xa80807);}return _0x14c660['status'](_0xa80807)['end']();};}function respondWithResult(_0x2d8c71,_0x3c865c){_0x3c865c=_0x3c865c||0xc8;return function(_0x435a0c){if(_0x435a0c){return _0x2d8c71['status'](_0x3c865c)[_0xbbce('0x19')](_0x435a0c);}};}function respondWithFilteredResult(_0x56775c,_0x58c4d9){return function(_0x3d4285){if(_0x3d4285){var _0x4362da=typeof _0x58c4d9['offset']===_0xbbce('0x1a')&&typeof _0x58c4d9[_0xbbce('0x1b')]==='undefined';var _0x2e540e=_0x3d4285['count'];var _0x4d4e78=_0x4362da?0x0:_0x58c4d9[_0xbbce('0x1c')];var _0xd111e=_0x4362da?_0x3d4285[_0xbbce('0x1d')]:_0x58c4d9[_0xbbce('0x1c')]+_0x58c4d9['limit'];var _0x32ceb4;if(_0xd111e>=_0x2e540e){_0xd111e=_0x2e540e;_0x32ceb4=0xc8;}else{_0x32ceb4=0xce;}_0x56775c['status'](_0x32ceb4);return _0x56775c[_0xbbce('0x1e')](_0xbbce('0x1f'),_0x4d4e78+'-'+_0xd111e+'/'+_0x2e540e)['json'](_0x3d4285);}return null;};}function patchUpdates(_0x1e82ca){return function(_0xef404c){try{jsonpatch[_0xbbce('0x20')](_0xef404c,_0x1e82ca,!![]);}catch(_0x501dbc){return BPromise[_0xbbce('0x21')](_0x501dbc);}return _0xef404c[_0xbbce('0x22')]();};}function saveUpdates(_0x1e9aa0,_0x5b20a8){return function(_0x34759c){if(_0x34759c){return _0x34759c[_0xbbce('0x23')](_0x1e9aa0)[_0xbbce('0x24')](function(_0x5c26ff){return _0x5c26ff;});}return null;};}function removeEntity(_0xd5ac90,_0xc518c0){return function(_0x569ac8){if(_0x569ac8){return _0x569ac8['destroy']()[_0xbbce('0x24')](function(){_0xd5ac90[_0xbbce('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a33d9,_0x59c032){return function(_0x57303a){if(!_0x57303a){_0x4a33d9[_0xbbce('0x18')](0x194);}return _0x57303a;};}function handleError(_0x3648d9,_0x321c39){_0x321c39=_0x321c39||0x1f4;return function(_0x32435d){logger['error'](_0x32435d[_0xbbce('0x26')]);if(_0x32435d['name']){delete _0x32435d[_0xbbce('0x27')];}_0x3648d9[_0xbbce('0x25')](_0x321c39)[_0xbbce('0x28')](_0x32435d);};}exports['index']=function(_0x17454d,_0xb9d56f){var _0x5cbae3={},_0x2f9b8a={},_0x5afec7={'count':0x0,'rows':[]};var _0x2510dd=_[_0xbbce('0x29')](db['SmsTransferReport'][_0xbbce('0x2a')],function(_0x3fe6e5){return{'name':_0x3fe6e5['fieldName'],'type':_0x3fe6e5[_0xbbce('0x2b')][_0xbbce('0x2c')]};});_0x2f9b8a['model']=_[_0xbbce('0x29')](_0x2510dd,_0xbbce('0x27'));_0x2f9b8a[_0xbbce('0x2d')]=_[_0xbbce('0x2e')](_0x17454d['query']);_0x2f9b8a[_0xbbce('0x2f')]=_[_0xbbce('0x30')](_0x2f9b8a['model'],_0x2f9b8a['query']);_0x5cbae3['attributes']=_[_0xbbce('0x30')](_0x2f9b8a['model'],qs[_0xbbce('0x31')](_0x17454d[_0xbbce('0x2d')][_0xbbce('0x31')]));_0x5cbae3[_0xbbce('0x32')]=_0x5cbae3[_0xbbce('0x32')]['length']?_0x5cbae3[_0xbbce('0x32')]:_0x2f9b8a[_0xbbce('0x33')];if(!_0x17454d[_0xbbce('0x2d')][_0xbbce('0x34')](_0xbbce('0x35'))){_0x5cbae3['limit']=qs[_0xbbce('0x1b')](_0x17454d[_0xbbce('0x2d')][_0xbbce('0x1b')]);_0x5cbae3[_0xbbce('0x1c')]=qs[_0xbbce('0x1c')](_0x17454d[_0xbbce('0x2d')]['offset']);}_0x5cbae3['order']=qs[_0xbbce('0x36')](_0x17454d['query'][_0xbbce('0x36')]);_0x5cbae3[_0xbbce('0x37')]=qs['filters'](_['pick'](_0x17454d['query'],_0x2f9b8a[_0xbbce('0x2f')]),_0x2510dd);if(_0x17454d[_0xbbce('0x2d')][_0xbbce('0x38')]){_0x5cbae3[_0xbbce('0x37')]=_[_0xbbce('0x39')](_0x5cbae3[_0xbbce('0x37')],{'$or':_['map'](_0x2510dd,function(_0x5ccbb7){if(_0x5ccbb7[_0xbbce('0x2b')]!=='VIRTUAL'){var _0xa6e97c={};_0xa6e97c[_0x5ccbb7[_0xbbce('0x27')]]={'$like':'%'+_0x17454d[_0xbbce('0x2d')]['filter']+'%'};return _0xa6e97c;}})});}_0x5cbae3=_['merge']({},_0x5cbae3,_0x17454d[_0xbbce('0x3a')]);var _0x5ed0b3={'where':_0x5cbae3[_0xbbce('0x37')]};return db['SmsTransferReport'][_0xbbce('0x1d')](_0x5ed0b3)[_0xbbce('0x24')](function(_0x46a315){_0x5afec7[_0xbbce('0x1d')]=_0x46a315;if(_0x17454d['query'][_0xbbce('0x3b')]){_0x5cbae3[_0xbbce('0x3c')]=[{'all':!![]}];}return db[_0xbbce('0x3d')][_0xbbce('0x3e')](_0x5cbae3);})[_0xbbce('0x24')](function(_0x29c68a){_0x5afec7[_0xbbce('0x3f')]=_0x29c68a;return _0x5afec7;})['then'](respondWithFilteredResult(_0xb9d56f,_0x5cbae3))[_0xbbce('0x40')](handleError(_0xb9d56f,null));};exports['show']=function(_0x42c2fd,_0x1428c3){var _0x3b646d={'raw':!![],'where':{'id':_0x42c2fd[_0xbbce('0x41')]['id']}},_0x3609bb={};_0x3609bb[_0xbbce('0x33')]=_[_0xbbce('0x2e')](db[_0xbbce('0x3d')][_0xbbce('0x2a')]);_0x3609bb[_0xbbce('0x2d')]=_[_0xbbce('0x2e')](_0x42c2fd[_0xbbce('0x2d')]);_0x3609bb[_0xbbce('0x2f')]=_[_0xbbce('0x30')](_0x3609bb[_0xbbce('0x33')],_0x3609bb[_0xbbce('0x2d')]);_0x3b646d[_0xbbce('0x32')]=_[_0xbbce('0x30')](_0x3609bb[_0xbbce('0x33')],qs[_0xbbce('0x31')](_0x42c2fd['query'][_0xbbce('0x31')]));_0x3b646d[_0xbbce('0x32')]=_0x3b646d[_0xbbce('0x32')][_0xbbce('0x42')]?_0x3b646d[_0xbbce('0x32')]:_0x3609bb[_0xbbce('0x33')];if(_0x42c2fd[_0xbbce('0x2d')][_0xbbce('0x3b')]){_0x3b646d[_0xbbce('0x3c')]=[{'all':!![]}];}_0x3b646d=_[_0xbbce('0x39')]({},_0x3b646d,_0x42c2fd[_0xbbce('0x3a')]);return db[_0xbbce('0x3d')][_0xbbce('0x43')](_0x3b646d)[_0xbbce('0x24')](handleEntityNotFound(_0x1428c3,null))[_0xbbce('0x24')](respondWithResult(_0x1428c3,null))[_0xbbce('0x40')](handleError(_0x1428c3,null));};exports['create']=function(_0x39cb26,_0x5d6f8e){return db[_0xbbce('0x3d')][_0xbbce('0x44')](_0x39cb26[_0xbbce('0x45')],{})[_0xbbce('0x24')](respondWithResult(_0x5d6f8e,0xc9))[_0xbbce('0x40')](handleError(_0x5d6f8e,null));};exports[_0xbbce('0x23')]=function(_0x10256b,_0x5a71a2){if(_0x10256b[_0xbbce('0x45')]['id']){delete _0x10256b['body']['id'];}return db[_0xbbce('0x3d')]['find']({'where':{'id':_0x10256b[_0xbbce('0x41')]['id']}})[_0xbbce('0x24')](handleEntityNotFound(_0x5a71a2,null))[_0xbbce('0x24')](saveUpdates(_0x10256b[_0xbbce('0x45')],null))[_0xbbce('0x24')](respondWithResult(_0x5a71a2,null))[_0xbbce('0x40')](handleError(_0x5a71a2,null));};exports[_0xbbce('0x46')]=function(_0x3e2baf,_0x1ba589){return db[_0xbbce('0x3d')][_0xbbce('0x43')]({'where':{'id':_0x3e2baf[_0xbbce('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ba589,null))[_0xbbce('0x24')](removeEntity(_0x1ba589,null))[_0xbbce('0x40')](handleError(_0x1ba589,null));};exports[_0xbbce('0x47')]=function(_0x1b9b12,_0x136b1b){return db[_0xbbce('0x3d')]['describe']()[_0xbbce('0x24')](respondWithResult(_0x136b1b,null))[_0xbbce('0x40')](handleError(_0x136b1b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 58a2f57..78de3e3 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 _0x5f30=['report_sms_transfer','uniqueid','lodash','api','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x4415f6,_0x1c8d07){var _0xfd27f7=function(_0x1332f1){while(--_0x1332f1){_0x4415f6['push'](_0x4415f6['shift']());}};_0xfd27f7(++_0x1c8d07);}(_0x5f30,0xe9));var _0x05f3=function(_0xaa51f3,_0x102b04){_0xaa51f3=_0xaa51f3-0x0;var _0x24d5d1=_0x5f30[_0xaa51f3];return _0x24d5d1;};'use strict';var _=require(_0x05f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x05f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05f3('0x2'));var fs=require('fs');var path=require(_0x05f3('0x3'));var rimraf=require(_0x05f3('0x4'));var config=require('../../config/environment');var attributes=require(_0x05f3('0x5'));module[_0x05f3('0x6')]=function(_0x3e01d9,_0x1dc586){return _0x3e01d9[_0x05f3('0x7')](_0x05f3('0x8'),attributes,{'tableName':_0x05f3('0x9'),'paranoid':![],'indexes':[{'name':_0x05f3('0xa'),'fields':[_0x05f3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9677=['bluebird','request-promise','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9677,0xc2));var _0x7967=function(_0x8bf294,_0x1ca4ae){_0x8bf294=_0x8bf294-0x0;var _0x596021=_0x9677[_0x8bf294];return _0x596021;};'use strict';var _=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var logger=require(_0x7967('0x2'))(_0x7967('0x3'));var moment=require('moment');var BPromise=require(_0x7967('0x4'));var rp=require(_0x7967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7967('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x7967('0x7')]=function(_0x2c95db,_0x40d405){return _0x2c95db[_0x7967('0x8')]('SmsTransferReport',attributes,{'tableName':_0x7967('0x9'),'paranoid':![],'indexes':[{'name':_0x7967('0xa'),'fields':[_0x7967('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 4a2bee1..ae5fc1e 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 _0xf120=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0xedf622,_0x5a854d){var _0x245b71=function(_0x2058a2){while(--_0x2058a2){_0xedf622['push'](_0xedf622['shift']());}};_0x245b71(++_0x5a854d);}(_0xf120,0x179));var _0x0f12=function(_0x189459,_0x516388){_0x189459=_0x189459-0x0;var _0x349ee0=_0xf120[_0x189459];return _0x349ee0;};'use strict';var _=require('lodash');var util=require(_0x0f12('0x0'));var moment=require(_0x0f12('0x1'));var BPromise=require(_0x0f12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f12('0x3'));var db=require(_0x0f12('0x4'))['db'];var utils=require(_0x0f12('0x5'));var logger=require('../../config/logger')(_0x0f12('0x6'));var config=require(_0x0f12('0x7'));var jayson=require(_0x0f12('0x8'));var client=jayson[_0x0f12('0x9')][_0x0f12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341516,_0x1f32b7,_0x457122){return new BPromise(function(_0x5bb901,_0x3e240d){return client['request'](_0x341516,_0x457122)[_0x0f12('0xb')](function(_0x147f3b){logger[_0x0f12('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x1f32b7,'request\x20sent');logger[_0x0f12('0xd')](_0x0f12('0xe'),_0x1f32b7,_0x0f12('0xf'),JSON[_0x0f12('0x10')](_0x147f3b));if(_0x147f3b[_0x0f12('0x11')]){if(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x12')]===0x1f4){logger['error'](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x3e240d(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x5bb901(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}else{logger[_0x0f12('0xc')](_0x0f12('0x13'),_0x1f32b7,_0x0f12('0xf'));_0x5bb901(_0x147f3b[_0x0f12('0x15')]['message']);}})[_0x0f12('0x16')](function(_0x4d9613){logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x4d9613);_0x3e240d(_0x4d9613);});});} \ No newline at end of file +var _0x9330=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x29c50f,_0x4749cf){var _0x505b90=function(_0x3c9aa8){while(--_0x3c9aa8){_0x29c50f['push'](_0x29c50f['shift']());}};_0x505b90(++_0x4749cf);}(_0x9330,0x14a));var _0x0933=function(_0x10c684,_0x1a5e43){_0x10c684=_0x10c684-0x0;var _0x4ea0c8=_0x9330[_0x10c684];return _0x4ea0c8;};'use strict';var _=require(_0x0933('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0933('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0933('0x2'))['db'];var utils=require(_0x0933('0x3'));var logger=require(_0x0933('0x4'))(_0x0933('0x5'));var config=require(_0x0933('0x6'));var jayson=require(_0x0933('0x7'));var client=jayson[_0x0933('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fb304,_0x458577,_0x116554){return new BPromise(function(_0x1bd4b2,_0x13616e){return client[_0x0933('0x9')](_0x2fb304,_0x116554)[_0x0933('0xa')](function(_0x3d79c9){logger[_0x0933('0xb')](_0x0933('0xc'),_0x458577,_0x0933('0xd'));logger[_0x0933('0xe')](_0x0933('0xf'),_0x458577,_0x0933('0xd'),JSON['stringify'](_0x3d79c9));if(_0x3d79c9['error']){if(_0x3d79c9['error']['code']===0x1f4){logger[_0x0933('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x3d79c9['error']['message']);return _0x13616e(_0x3d79c9[_0x0933('0x10')][_0x0933('0x11')]);}logger['error'](_0x0933('0xc'),_0x458577,_0x3d79c9[_0x0933('0x10')]['message']);return _0x1bd4b2(_0x3d79c9['error'][_0x0933('0x11')]);}else{logger[_0x0933('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x0933('0xd'));_0x1bd4b2(_0x3d79c9[_0x0933('0x12')][_0x0933('0x11')]);}})[_0x0933('0x13')](function(_0x377140){logger[_0x0933('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x377140);_0x13616e(_0x377140);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index aa07098..4701127 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 _0xebab=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put'];(function(_0x4f01a9,_0x4a0d3a){var _0x5f5ade=function(_0xbd7ca6){while(--_0xbd7ca6){_0x4f01a9['push'](_0x4f01a9['shift']());}};_0x5f5ade(++_0x4a0d3a);}(_0xebab,0x124));var _0xbeba=function(_0xb5330f,_0x2746bb){_0xb5330f=_0xb5330f-0x0;var _0x189634=_0xebab[_0xb5330f];return _0x189634;};'use strict';var multer=require(_0xbeba('0x0'));var util=require(_0xbeba('0x1'));var path=require(_0xbeba('0x2'));var timeout=require('connect-timeout');var express=require(_0xbeba('0x3'));var router=express[_0xbeba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbeba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbeba('0x6'));var controller=require('./sound.controller');router[_0xbeba('0x7')]('/',auth[_0xbeba('0x8')](),controller[_0xbeba('0x9')]);router[_0xbeba('0x7')](_0xbeba('0xa'),auth[_0xbeba('0x8')](),controller[_0xbeba('0xb')]);router[_0xbeba('0x7')](_0xbeba('0xc'),auth[_0xbeba('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ea08d,_0x2f8dab,_0x13c2b5){_0x13c2b5(null,path[_0xbeba('0xd')](config['root'],_0xbeba('0xe')));},'filename':function(_0x1a2346,_0x2a28b9,_0x236bbf){_0x2a28b9[_0xbeba('0xf')]=_0x2a28b9['originalname'][_0xbeba('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x236bbf(null,util[_0xbeba('0x11')](_0xbeba('0x12'),path[_0xbeba('0x13')](_0x2a28b9[_0xbeba('0xf')],path[_0xbeba('0x14')](_0x2a28b9[_0xbeba('0xf')])),Date[_0xbeba('0x15')](),path[_0xbeba('0x14')](_0x2a28b9[_0xbeba('0xf')])));}})});router[_0xbeba('0x16')]('/',upload[_0xbeba('0x17')](_0xbeba('0x18')),controller[_0xbeba('0x19')]);router[_0xbeba('0x1a')](_0xbeba('0xa'),auth['isAuthenticated'](),controller[_0xbeba('0x1b')]);router[_0xbeba('0x1c')](_0xbeba('0xa'),auth[_0xbeba('0x8')](),controller[_0xbeba('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbe7d=['download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id'];(function(_0xadd012,_0x510368){var _0x3cc371=function(_0xaa583d){while(--_0xaa583d){_0xadd012['push'](_0xadd012['shift']());}};_0x3cc371(++_0x510368);}(_0xbe7d,0x1b7));var _0xdbe7=function(_0x5d2207,_0x25c3db){_0x5d2207=_0x5d2207-0x0;var _0x3d320e=_0xbe7d[_0x5d2207];return _0x3d320e;};'use strict';var multer=require(_0xdbe7('0x0'));var util=require(_0xdbe7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdbe7('0x2'));var router=express[_0xdbe7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdbe7('0x4'));var interaction=require(_0xdbe7('0x5'));var config=require(_0xdbe7('0x6'));var controller=require(_0xdbe7('0x7'));router[_0xdbe7('0x8')]('/',auth[_0xdbe7('0x9')](),controller['index']);router['get'](_0xdbe7('0xa'),auth[_0xdbe7('0x9')](),controller['show']);router['get']('/:id/download',auth[_0xdbe7('0x9')](),controller[_0xdbe7('0xb')]);var upload=multer({'storage':multer[_0xdbe7('0xc')]({'destination':function(_0x3a0e84,_0x38ce04,_0x5454c2){_0x5454c2(null,path[_0xdbe7('0xd')](config[_0xdbe7('0xe')],_0xdbe7('0xf')));},'filename':function(_0x29b45c,_0x48d293,_0xf9b8f6){_0x48d293[_0xdbe7('0x10')]=_0x48d293[_0xdbe7('0x10')][_0xdbe7('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf9b8f6(null,util[_0xdbe7('0x12')](_0xdbe7('0x13'),path[_0xdbe7('0x14')](_0x48d293[_0xdbe7('0x10')],path[_0xdbe7('0x15')](_0x48d293['originalname'])),Date['now'](),path[_0xdbe7('0x15')](_0x48d293[_0xdbe7('0x10')])));}})});router[_0xdbe7('0x16')]('/',upload[_0xdbe7('0x17')](_0xdbe7('0x18')),controller[_0xdbe7('0x19')]);router[_0xdbe7('0x1a')]('/:id',auth[_0xdbe7('0x9')](),controller[_0xdbe7('0x1b')]);router['delete'](_0xdbe7('0xa'),auth[_0xdbe7('0x9')](),controller[_0xdbe7('0x1c')]);module[_0xdbe7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 196fb91..9ec9d7b 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 _0xef5b=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x1b3463,_0x43e1f5){var _0x29d544=function(_0x73f158){while(--_0x73f158){_0x1b3463['push'](_0x1b3463['shift']());}};_0x29d544(++_0x43e1f5);}(_0xef5b,0x1b6));var _0xbef5=function(_0x54260a,_0x2a5245){_0x54260a=_0x54260a-0x0;var _0x92abb5=_0xef5b[_0x54260a];return _0x92abb5;};'use strict';var Sequelize=require(_0xbef5('0x0'));module[_0xbef5('0x1')]={'name':{'type':Sequelize[_0xbef5('0x2')],'unique':_0xbef5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbef5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xbef5('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xbef5('0x4')]},'original_sampleCount':{'type':Sequelize[_0xbef5('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xbef5('0x5')]},'original_sampleRate':{'type':Sequelize[_0xbef5('0x6')]},'converted_format':{'type':Sequelize[_0xbef5('0x2')]},'converted_duration':{'type':Sequelize[_0xbef5('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xbef5('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xbef5('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xbef5('0x6')]}}; \ No newline at end of file +var _0xd58c=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x218ee4,_0x174228){var _0x5ea97c=function(_0x3b4b2d){while(--_0x3b4b2d){_0x218ee4['push'](_0x218ee4['shift']());}};_0x5ea97c(++_0x174228);}(_0xd58c,0x70));var _0xcd58=function(_0x9956ba,_0x17344a){_0x9956ba=_0x9956ba-0x0;var _0x2da611=_0xd58c[_0x9956ba];return _0x2da611;};'use strict';var Sequelize=require(_0xcd58('0x0'));module[_0xcd58('0x1')]={'name':{'type':Sequelize[_0xcd58('0x2')],'unique':_0xcd58('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcd58('0x2')]},'display_name':{'type':Sequelize[_0xcd58('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xcd58('0x2')]},'original_format':{'type':Sequelize[_0xcd58('0x2')]},'original_duration':{'type':Sequelize[_0xcd58('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcd58('0x5')]},'original_channelCount':{'type':Sequelize[_0xcd58('0x6')]},'original_bitRate':{'type':Sequelize[_0xcd58('0x5')]},'original_sampleRate':{'type':Sequelize[_0xcd58('0x6')]},'converted_format':{'type':Sequelize[_0xcd58('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xcd58('0x6')]},'converted_bitRate':{'type':Sequelize[_0xcd58('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xcd58('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d11c202..99b2746 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 _0x84e4=['Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','basename','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','Sound','rows','show','params','find','catch','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted'];(function(_0xfd1ac3,_0xdff3a9){var _0x3aea18=function(_0x248645){while(--_0x248645){_0xfd1ac3['push'](_0xfd1ac3['shift']());}};_0x3aea18(++_0xdff3a9);}(_0x84e4,0xb0));var _0x484e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x84e4[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x484e('0x0'));var jsonpatch=require(_0x484e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x484e('0x2'));var util=require(_0x484e('0x3'));var path=require('path');var sox=require(_0x484e('0x4'));var csv=require(_0x484e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x484e('0x6'));var _=require(_0x484e('0x7'));var squel=require('squel');var crypto=require(_0x484e('0x8'));var jsforce=require(_0x484e('0x9'));var deskjs=require(_0x484e('0xa'));var toCsv=require(_0x484e('0x5'));var querystring=require(_0x484e('0xb'));var Papa=require(_0x484e('0xc'));var Redis=require(_0x484e('0xd'));var authService=require(_0x484e('0xe'));var qs=require(_0x484e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x484e('0x10'));var logger=require(_0x484e('0x11'))(_0x484e('0x12'));var utils=require(_0x484e('0x13'));var config=require(_0x484e('0x14'));var licenseUtil=require(_0x484e('0x15'));var db=require(_0x484e('0x16'))['db'];function respondWithStatusCode(_0x405b70,_0x5a7c99){_0x5a7c99=_0x5a7c99||0xcc;return function(_0x31538d){if(_0x31538d){return _0x405b70[_0x484e('0x17')](_0x5a7c99);}return _0x405b70[_0x484e('0x18')](_0x5a7c99)[_0x484e('0x19')]();};}function respondWithResult(_0xf2b764,_0x86b2fd){_0x86b2fd=_0x86b2fd||0xc8;return function(_0x5e8e0c){if(_0x5e8e0c){return _0xf2b764[_0x484e('0x18')](_0x86b2fd)[_0x484e('0x1a')](_0x5e8e0c);}};}function respondWithFilteredResult(_0x4c79ba,_0x17396f){return function(_0x31920e){if(_0x31920e){var _0x3b1ff8=typeof _0x17396f[_0x484e('0x1b')]===_0x484e('0x1c')&&typeof _0x17396f[_0x484e('0x1d')]==='undefined';var _0x2240f4=_0x31920e[_0x484e('0x1e')];var _0x229e45=_0x3b1ff8?0x0:_0x17396f[_0x484e('0x1b')];var _0x350794=_0x3b1ff8?_0x31920e[_0x484e('0x1e')]:_0x17396f['offset']+_0x17396f[_0x484e('0x1d')];var _0x4a0efd;if(_0x350794>=_0x2240f4){_0x350794=_0x2240f4;_0x4a0efd=0xc8;}else{_0x4a0efd=0xce;}_0x4c79ba['status'](_0x4a0efd);return _0x4c79ba[_0x484e('0x1f')]('Content-Range',_0x229e45+'-'+_0x350794+'/'+_0x2240f4)[_0x484e('0x1a')](_0x31920e);}return null;};}function patchUpdates(_0x1743ca){return function(_0x352c39){try{jsonpatch[_0x484e('0x20')](_0x352c39,_0x1743ca,!![]);}catch(_0x16f436){return BPromise['reject'](_0x16f436);}return _0x352c39['save']();};}function saveUpdates(_0x26d5a0,_0x4f9bed){return function(_0x2f3656){if(_0x2f3656){return _0x2f3656[_0x484e('0x21')](_0x26d5a0)['then'](function(_0x157f95){return _0x157f95;});}return null;};}function removeEntity(_0x26a807,_0x86dee6){return function(_0x5d83fa){if(_0x5d83fa){return _0x5d83fa['destroy']()[_0x484e('0x22')](function(){var _0x29519b=_0x5d83fa[_0x484e('0x23')]({'plain':!![]});var _0x573bbc=_0x484e('0x24');return db[_0x484e('0x25')][_0x484e('0x26')]({'where':{'type':_0x573bbc,'resourceId':_0x29519b['id']}})[_0x484e('0x22')](function(){return _0x5d83fa;});})[_0x484e('0x22')](function(){_0x26a807[_0x484e('0x18')](0xcc)[_0x484e('0x19')]();});}};}function handleEntityNotFound(_0x190446,_0x52521a){return function(_0x25cbb5){if(!_0x25cbb5){_0x190446['sendStatus'](0x194);}return _0x25cbb5;};}function handleError(_0x404f33,_0x419965){_0x419965=_0x419965||0x1f4;return function(_0x34c57f){logger[_0x484e('0x27')](_0x34c57f[_0x484e('0x28')]);if(_0x34c57f[_0x484e('0x29')]){delete _0x34c57f[_0x484e('0x29')];}_0x404f33[_0x484e('0x18')](_0x419965)[_0x484e('0x2a')](_0x34c57f);};}exports[_0x484e('0x2b')]=function(_0x2aca83,_0x14a8b6){var _0x227db1={},_0x50ede8={},_0xdd62a4={'count':0x0,'rows':[]};var _0x43de37=_[_0x484e('0x2c')](db['Sound'][_0x484e('0x2d')],function(_0x308747){return{'name':_0x308747[_0x484e('0x2e')],'type':_0x308747['type'][_0x484e('0x2f')]};});_0x50ede8[_0x484e('0x30')]=_[_0x484e('0x2c')](_0x43de37,_0x484e('0x29'));_0x50ede8[_0x484e('0x31')]=_[_0x484e('0x32')](_0x2aca83[_0x484e('0x31')]);_0x50ede8[_0x484e('0x33')]=_[_0x484e('0x34')](_0x50ede8[_0x484e('0x30')],_0x50ede8[_0x484e('0x31')]);_0x227db1[_0x484e('0x35')]=_[_0x484e('0x34')](_0x50ede8['model'],qs[_0x484e('0x36')](_0x2aca83['query']['fields']));_0x227db1['attributes']=_0x227db1[_0x484e('0x35')][_0x484e('0x37')]?_0x227db1[_0x484e('0x35')]:_0x50ede8[_0x484e('0x30')];if(!_0x2aca83[_0x484e('0x31')][_0x484e('0x38')](_0x484e('0x39'))){_0x227db1['limit']=qs[_0x484e('0x1d')](_0x2aca83[_0x484e('0x31')][_0x484e('0x1d')]);_0x227db1[_0x484e('0x1b')]=qs['offset'](_0x2aca83['query'][_0x484e('0x1b')]);}_0x227db1[_0x484e('0x3a')]=qs['sort'](_0x2aca83['query'][_0x484e('0x3b')]);_0x227db1['where']=qs['filters'](_[_0x484e('0x3c')](_0x2aca83[_0x484e('0x31')],_0x50ede8[_0x484e('0x33')]),_0x43de37);if(_0x2aca83[_0x484e('0x31')]['filter']){_0x227db1[_0x484e('0x3d')]=_['merge'](_0x227db1[_0x484e('0x3d')],{'$or':_[_0x484e('0x2c')](_0x43de37,function(_0x2540ce){if(_0x2540ce[_0x484e('0x3e')]!==_0x484e('0x3f')){var _0x300bcc={};_0x300bcc[_0x2540ce['name']]={'$like':'%'+_0x2aca83[_0x484e('0x31')][_0x484e('0x40')]+'%'};return _0x300bcc;}})});}_0x227db1=_[_0x484e('0x41')]({},_0x227db1,_0x2aca83[_0x484e('0x42')]);var _0x14320e={'where':_0x227db1['where']};return db['Sound'][_0x484e('0x1e')](_0x14320e)['then'](function(_0xf00863){_0xdd62a4[_0x484e('0x1e')]=_0xf00863;if(_0x2aca83[_0x484e('0x31')][_0x484e('0x43')]){_0x227db1[_0x484e('0x44')]=[{'all':!![]}];}return db[_0x484e('0x45')]['findAll'](_0x227db1);})['then'](function(_0x2792eb){_0xdd62a4[_0x484e('0x46')]=_0x2792eb;return _0xdd62a4;})['then'](respondWithFilteredResult(_0x14a8b6,_0x227db1))['catch'](handleError(_0x14a8b6,null));};exports[_0x484e('0x47')]=function(_0x27aa5d,_0x29fd70){var _0x39a122={'raw':!![],'where':{'id':_0x27aa5d[_0x484e('0x48')]['id']}},_0x596df8={};_0x596df8[_0x484e('0x30')]=_[_0x484e('0x32')](db[_0x484e('0x45')][_0x484e('0x2d')]);_0x596df8[_0x484e('0x31')]=_[_0x484e('0x32')](_0x27aa5d[_0x484e('0x31')]);_0x596df8[_0x484e('0x33')]=_[_0x484e('0x34')](_0x596df8[_0x484e('0x30')],_0x596df8[_0x484e('0x31')]);_0x39a122[_0x484e('0x35')]=_[_0x484e('0x34')](_0x596df8['model'],qs[_0x484e('0x36')](_0x27aa5d['query'][_0x484e('0x36')]));_0x39a122[_0x484e('0x35')]=_0x39a122[_0x484e('0x35')][_0x484e('0x37')]?_0x39a122[_0x484e('0x35')]:_0x596df8[_0x484e('0x30')];if(_0x27aa5d[_0x484e('0x31')][_0x484e('0x43')]){_0x39a122[_0x484e('0x44')]=[{'all':!![]}];}_0x39a122=_[_0x484e('0x41')]({},_0x39a122,_0x27aa5d[_0x484e('0x42')]);return db[_0x484e('0x45')][_0x484e('0x49')](_0x39a122)[_0x484e('0x22')](handleEntityNotFound(_0x29fd70,null))[_0x484e('0x22')](respondWithResult(_0x29fd70,null))[_0x484e('0x4a')](handleError(_0x29fd70,null));};exports[_0x484e('0x4b')]=function(_0x6f7a6b,_0x505e0c,_0x4c39c8){return db[_0x484e('0x45')]['find']({'where':{'id':_0x6f7a6b[_0x484e('0x48')]['id']},'attributes':[_0x484e('0x29'),_0x484e('0x4c'),_0x484e('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x505e0c,null))[_0x484e('0x22')](function(_0x578c38){if(_0x578c38){if(!fs[_0x484e('0x4e')](path[_0x484e('0x4f')](config[_0x484e('0x50')],_0x484e('0x51'),_0x578c38[_0x484e('0x4c')]+'.'+_0x578c38['converted_format']))){throw new db[(_0x484e('0x52'))][(_0x484e('0x53'))](_0x484e('0x54'));}return _0x505e0c[_0x484e('0x4b')](path[_0x484e('0x4f')](config['root'],_0x484e('0x51'),util[_0x484e('0x55')](_0x484e('0x56'),_0x578c38[_0x484e('0x4c')],_0x578c38[_0x484e('0x4d')])),util[_0x484e('0x55')]('%s.%s',_0x578c38[_0x484e('0x29')],_0x578c38['converted_format']));}return null;})[_0x484e('0x4a')](handleError(_0x505e0c,null));};exports[_0x484e('0x57')]=function(_0x2ca5d5,_0x2ed3d2,_0x488e0a){var _0x1fbc4a={'name':path['basename'](_0x2ca5d5[_0x484e('0x58')][_0x484e('0x59')],path['extname'](_0x2ca5d5[_0x484e('0x58')][_0x484e('0x59')])),'save_name':path[_0x484e('0x5a')](_0x2ca5d5[_0x484e('0x58')]['filename'],path[_0x484e('0x5b')](_0x2ca5d5[_0x484e('0x58')][_0x484e('0x5c')])),'original_format':path[_0x484e('0x5b')](_0x2ca5d5[_0x484e('0x58')][_0x484e('0x59')])[_0x484e('0x5d')](0x1),'converted_format':_0x484e('0x5e')};var _0x398168=path['join'](config[_0x484e('0x50')],_0x484e('0x5f'),_0x2ca5d5['file']['filename']);var _0x330eda=path[_0x484e('0x4f')](config[_0x484e('0x50')],_0x484e('0x51'),util[_0x484e('0x55')](_0x484e('0x56'),path['basename'](_0x2ca5d5[_0x484e('0x58')][_0x484e('0x5c')],path[_0x484e('0x5b')](_0x2ca5d5['file'][_0x484e('0x5c')])),_0x1fbc4a['converted_format']));logger[_0x484e('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x398168);logger[_0x484e('0x60')](_0x484e('0x61'),_0x330eda);try{fs[_0x484e('0x62')](_0x398168,parseInt(_0x484e('0x63'),0x8));var _0x47b800=sox[_0x484e('0x64')](_0x398168,_0x330eda,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47b800['on'](_0x484e('0x27'),function(_0x45fb0f){fs['unlinkSync'](_0x398168);_0x2ed3d2[_0x484e('0x18')](0x1f4)[_0x484e('0x2a')](_0x45fb0f);});_0x47b800['on'](_0x484e('0x65'),function(_0x562113){_0x1fbc4a[_0x484e('0x66')]=isNaN(_0x562113[_0x484e('0x67')])?null:_0x562113[_0x484e('0x67')]*0x3e8;_0x1fbc4a[_0x484e('0x68')]=isNaN(_0x562113['sampleCount'])?null:_0x562113[_0x484e('0x69')];_0x1fbc4a[_0x484e('0x6a')]=isNaN(_0x562113['channelCount'])?null:_0x562113[_0x484e('0x6b')];_0x1fbc4a[_0x484e('0x6c')]=isNaN(_0x562113[_0x484e('0x6d')])?null:_0x562113['bitRate'];_0x1fbc4a[_0x484e('0x6e')]=isNaN(_0x562113[_0x484e('0x6f')])?null:_0x562113[_0x484e('0x6f')];});_0x47b800['on']('dest',function(_0x4000e7){_0x1fbc4a[_0x484e('0x70')]=isNaN(_0x4000e7['duration'])?null:_0x4000e7[_0x484e('0x67')]*0x3e8;_0x1fbc4a[_0x484e('0x71')]=isNaN(_0x4000e7[_0x484e('0x69')])?null:_0x4000e7[_0x484e('0x69')];_0x1fbc4a[_0x484e('0x72')]=isNaN(_0x4000e7['channelCount'])?null:_0x4000e7['channelCount'];_0x1fbc4a[_0x484e('0x73')]=isNaN(_0x4000e7[_0x484e('0x6d')])?null:_0x4000e7[_0x484e('0x6d')];_0x1fbc4a[_0x484e('0x74')]=isNaN(_0x4000e7[_0x484e('0x6f')])?null:_0x4000e7[_0x484e('0x6f')];});_0x47b800['on'](_0x484e('0x19'),function(){fs[_0x484e('0x62')](_0x330eda,parseInt('0777',0x8));return db['Sound'][_0x484e('0x57')](_0x1fbc4a)['then'](function(_0x5f3430){var _0x3e5803={'role':_0x2ca5d5[_0x484e('0x75')][_0x484e('0x76')],'userProfileId':_0x2ca5d5[_0x484e('0x75')][_0x484e('0x77')]};if(!_0x3e5803)throw new Error(_0x484e('0x78'));if(_0x3e5803['role']===_0x484e('0x79')){var _0x1482f5=_0x5f3430['get']({'plain':!![]});return db['UserProfileSection'][_0x484e('0x49')]({'where':{'name':_0x484e('0x24'),'userProfileId':_0x3e5803['userProfileId']},'raw':!![]})[_0x484e('0x22')](function(_0x2a4314){if(_0x2a4314&&_0x2a4314[_0x484e('0x7a')]===0x0){return db[_0x484e('0x25')]['create']({'name':_0x1482f5[_0x484e('0x29')],'resourceId':_0x1482f5['id'],'type':_0x2a4314[_0x484e('0x29')],'sectionId':_0x2a4314['id']},{})[_0x484e('0x22')](function(){return _0x5f3430;});}else{return _0x5f3430;}})[_0x484e('0x4a')](function(_0x140d03){logger['error'](_0x484e('0x7b'),_0x140d03);throw _0x140d03;});}return _0x5f3430;})[_0x484e('0x22')](respondWithResult(_0x2ed3d2,null))[_0x484e('0x4a')](handleError(_0x2ed3d2,null));});_0x47b800[_0x484e('0x7c')]();}catch(_0x4a08f8){_0x2ed3d2['status'](0x1f4)[_0x484e('0x2a')](_0x4a08f8);}};exports[_0x484e('0x21')]=function(_0x2c8c23,_0x3a75ec,_0x1cc073){return db['Sound']['find']({'where':{'id':_0x2c8c23[_0x484e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a75ec,null))['then'](saveUpdates(_[_0x484e('0x3c')](_0x2c8c23[_0x484e('0x75')],[_0x484e('0x29'),_0x484e('0x7d')]),null))[_0x484e('0x22')](respondWithResult(_0x3a75ec,null))[_0x484e('0x4a')](handleError(_0x3a75ec,null));};exports[_0x484e('0x7e')]=function(_0x4fea08,_0x6849e4,_0x333d84){return db[_0x484e('0x45')][_0x484e('0x49')]({'where':{'id':_0x4fea08[_0x484e('0x48')]['id']}})['then'](function(_0x30972b){if(_0x30972b){return _0x30972b[_0x484e('0x26')]();}})[_0x484e('0x22')](function(_0x45b5ba){var _0x4a9410=path[_0x484e('0x4f')](config[_0x484e('0x50')],'server/files/sounds/original',util['format'](_0x484e('0x56'),_0x45b5ba[_0x484e('0x4c')],_0x45b5ba[_0x484e('0x7f')]));var _0x16e5b2=path[_0x484e('0x4f')](config[_0x484e('0x50')],_0x484e('0x51'),util[_0x484e('0x55')](_0x484e('0x56'),_0x45b5ba[_0x484e('0x4c')],_0x45b5ba[_0x484e('0x4d')]));fs[_0x484e('0x80')](_0x4a9410);fs[_0x484e('0x80')](_0x16e5b2);return _0x45b5ba;})[_0x484e('0x22')](function(_0x498cbe){if(_0x498cbe){return _0x6849e4[_0x484e('0x18')](0xcc)[_0x484e('0x19')]();}})[_0x484e('0x22')](handleEntityNotFound(_0x6849e4,null))[_0x484e('0x4a')](handleError(_0x6849e4,null));}; \ No newline at end of file +var _0x157d=['crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','rawAttributes','include','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','basename','filename','extname','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','description','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel'];(function(_0x5e6b1d,_0x118f03){var _0x5a61b0=function(_0xd9c6e8){while(--_0xd9c6e8){_0x5e6b1d['push'](_0x5e6b1d['shift']());}};_0x5a61b0(++_0x118f03);}(_0x157d,0xe5));var _0xd157=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x157d[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xd157('0x0'));var rimraf=require(_0xd157('0x1'));var zipdir=require(_0xd157('0x2'));var jsonpatch=require(_0xd157('0x3'));var rp=require(_0xd157('0x4'));var moment=require(_0xd157('0x5'));var BPromise=require(_0xd157('0x6'));var Mustache=require(_0xd157('0x7'));var util=require(_0xd157('0x8'));var path=require('path');var sox=require(_0xd157('0x9'));var csv=require(_0xd157('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd157('0xb'));var _=require('lodash');var squel=require(_0xd157('0xc'));var crypto=require(_0xd157('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd157('0xe'));var Redis=require('ioredis');var authService=require(_0xd157('0xf'));var qs=require(_0xd157('0x10'));var as=require(_0xd157('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd157('0x12'))(_0xd157('0x13'));var utils=require(_0xd157('0x14'));var config=require(_0xd157('0x15'));var licenseUtil=require(_0xd157('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54a3e2,_0x14305c){_0x14305c=_0x14305c||0xcc;return function(_0x29f043){if(_0x29f043){return _0x54a3e2[_0xd157('0x17')](_0x14305c);}return _0x54a3e2[_0xd157('0x18')](_0x14305c)[_0xd157('0x19')]();};}function respondWithResult(_0x21e9f8,_0x49826d){_0x49826d=_0x49826d||0xc8;return function(_0x1d724d){if(_0x1d724d){return _0x21e9f8[_0xd157('0x18')](_0x49826d)[_0xd157('0x1a')](_0x1d724d);}};}function respondWithFilteredResult(_0xd822df,_0x4dcec2){return function(_0x353d2a){if(_0x353d2a){var _0x2fd8cd=typeof _0x4dcec2['offset']===_0xd157('0x1b')&&typeof _0x4dcec2[_0xd157('0x1c')]===_0xd157('0x1b');var _0x490bf5=_0x353d2a['count'];var _0x17ced2=_0x2fd8cd?0x0:_0x4dcec2[_0xd157('0x1d')];var _0x1cf722=_0x2fd8cd?_0x353d2a[_0xd157('0x1e')]:_0x4dcec2[_0xd157('0x1d')]+_0x4dcec2[_0xd157('0x1c')];var _0x445148;if(_0x1cf722>=_0x490bf5){_0x1cf722=_0x490bf5;_0x445148=0xc8;}else{_0x445148=0xce;}_0xd822df[_0xd157('0x18')](_0x445148);return _0xd822df[_0xd157('0x1f')](_0xd157('0x20'),_0x17ced2+'-'+_0x1cf722+'/'+_0x490bf5)['json'](_0x353d2a);}return null;};}function patchUpdates(_0x2df6b7){return function(_0x510921){try{jsonpatch['apply'](_0x510921,_0x2df6b7,!![]);}catch(_0xce9e4e){return BPromise['reject'](_0xce9e4e);}return _0x510921[_0xd157('0x21')]();};}function saveUpdates(_0x26498c,_0x108cab){return function(_0x1d56bf){if(_0x1d56bf){return _0x1d56bf[_0xd157('0x22')](_0x26498c)[_0xd157('0x23')](function(_0x2feef5){return _0x2feef5;});}return null;};}function removeEntity(_0x5321fd,_0x1f3408){return function(_0x557154){if(_0x557154){return _0x557154[_0xd157('0x24')]()['then'](function(){var _0x1b08d4=_0x557154[_0xd157('0x25')]({'plain':!![]});var _0xa83e1d=_0xd157('0x26');return db[_0xd157('0x27')]['destroy']({'where':{'type':_0xa83e1d,'resourceId':_0x1b08d4['id']}})[_0xd157('0x23')](function(){return _0x557154;});})[_0xd157('0x23')](function(){_0x5321fd[_0xd157('0x18')](0xcc)[_0xd157('0x19')]();});}};}function handleEntityNotFound(_0x5f5652,_0x14bd66){return function(_0x175a42){if(!_0x175a42){_0x5f5652[_0xd157('0x17')](0x194);}return _0x175a42;};}function handleError(_0x480b54,_0x501001){_0x501001=_0x501001||0x1f4;return function(_0x582dcb){logger[_0xd157('0x28')](_0x582dcb[_0xd157('0x29')]);if(_0x582dcb[_0xd157('0x2a')]){delete _0x582dcb[_0xd157('0x2a')];}_0x480b54[_0xd157('0x18')](_0x501001)[_0xd157('0x2b')](_0x582dcb);};}exports[_0xd157('0x2c')]=function(_0x4d3aa5,_0x5706c7){var _0x915a2c={},_0x584e05={},_0x125497={'count':0x0,'rows':[]};var _0x4be957=_['map'](db[_0xd157('0x2d')]['rawAttributes'],function(_0x569dd0){return{'name':_0x569dd0['fieldName'],'type':_0x569dd0[_0xd157('0x2e')][_0xd157('0x2f')]};});_0x584e05[_0xd157('0x30')]=_[_0xd157('0x31')](_0x4be957,_0xd157('0x2a'));_0x584e05[_0xd157('0x32')]=_['keys'](_0x4d3aa5[_0xd157('0x32')]);_0x584e05[_0xd157('0x33')]=_[_0xd157('0x34')](_0x584e05[_0xd157('0x30')],_0x584e05[_0xd157('0x32')]);_0x915a2c[_0xd157('0x35')]=_[_0xd157('0x34')](_0x584e05[_0xd157('0x30')],qs[_0xd157('0x36')](_0x4d3aa5[_0xd157('0x32')]['fields']));_0x915a2c[_0xd157('0x35')]=_0x915a2c[_0xd157('0x35')][_0xd157('0x37')]?_0x915a2c[_0xd157('0x35')]:_0x584e05[_0xd157('0x30')];if(!_0x4d3aa5[_0xd157('0x32')][_0xd157('0x38')](_0xd157('0x39'))){_0x915a2c[_0xd157('0x1c')]=qs[_0xd157('0x1c')](_0x4d3aa5[_0xd157('0x32')][_0xd157('0x1c')]);_0x915a2c[_0xd157('0x1d')]=qs[_0xd157('0x1d')](_0x4d3aa5[_0xd157('0x32')][_0xd157('0x1d')]);}_0x915a2c[_0xd157('0x3a')]=qs[_0xd157('0x3b')](_0x4d3aa5[_0xd157('0x32')][_0xd157('0x3b')]);_0x915a2c[_0xd157('0x3c')]=qs[_0xd157('0x33')](_[_0xd157('0x3d')](_0x4d3aa5['query'],_0x584e05[_0xd157('0x33')]),_0x4be957);if(_0x4d3aa5[_0xd157('0x32')]['filter']){_0x915a2c[_0xd157('0x3c')]=_[_0xd157('0x3e')](_0x915a2c[_0xd157('0x3c')],{'$or':_[_0xd157('0x31')](_0x4be957,function(_0x122d05){if(_0x122d05[_0xd157('0x2e')]!==_0xd157('0x3f')){var _0xa66834={};_0xa66834[_0x122d05['name']]={'$like':'%'+_0x4d3aa5[_0xd157('0x32')][_0xd157('0x40')]+'%'};return _0xa66834;}})});}_0x915a2c=_[_0xd157('0x3e')]({},_0x915a2c,_0x4d3aa5[_0xd157('0x41')]);var _0x5481f0={'where':_0x915a2c[_0xd157('0x3c')]};return db[_0xd157('0x2d')][_0xd157('0x1e')](_0x5481f0)[_0xd157('0x23')](function(_0x4b64f4){_0x125497[_0xd157('0x1e')]=_0x4b64f4;if(_0x4d3aa5[_0xd157('0x32')]['includeAll']){_0x915a2c['include']=[{'all':!![]}];}return db[_0xd157('0x2d')][_0xd157('0x42')](_0x915a2c);})['then'](function(_0x25ffa0){_0x125497[_0xd157('0x43')]=_0x25ffa0;return _0x125497;})[_0xd157('0x23')](respondWithFilteredResult(_0x5706c7,_0x915a2c))[_0xd157('0x44')](handleError(_0x5706c7,null));};exports[_0xd157('0x45')]=function(_0x43fdd8,_0x83f1d2){var _0x1dbcc3={'raw':!![],'where':{'id':_0x43fdd8[_0xd157('0x46')]['id']}},_0x184451={};_0x184451['model']=_[_0xd157('0x47')](db[_0xd157('0x2d')][_0xd157('0x48')]);_0x184451['query']=_[_0xd157('0x47')](_0x43fdd8['query']);_0x184451[_0xd157('0x33')]=_['intersection'](_0x184451[_0xd157('0x30')],_0x184451[_0xd157('0x32')]);_0x1dbcc3[_0xd157('0x35')]=_['intersection'](_0x184451[_0xd157('0x30')],qs[_0xd157('0x36')](_0x43fdd8['query']['fields']));_0x1dbcc3[_0xd157('0x35')]=_0x1dbcc3[_0xd157('0x35')][_0xd157('0x37')]?_0x1dbcc3[_0xd157('0x35')]:_0x184451[_0xd157('0x30')];if(_0x43fdd8[_0xd157('0x32')]['includeAll']){_0x1dbcc3[_0xd157('0x49')]=[{'all':!![]}];}_0x1dbcc3=_[_0xd157('0x3e')]({},_0x1dbcc3,_0x43fdd8[_0xd157('0x41')]);return db['Sound'][_0xd157('0x4a')](_0x1dbcc3)[_0xd157('0x23')](handleEntityNotFound(_0x83f1d2,null))[_0xd157('0x23')](respondWithResult(_0x83f1d2,null))['catch'](handleError(_0x83f1d2,null));};exports[_0xd157('0x4b')]=function(_0x2a45a2,_0x2dfac9,_0x30c94c){return db[_0xd157('0x2d')][_0xd157('0x4a')]({'where':{'id':_0x2a45a2[_0xd157('0x46')]['id']},'attributes':[_0xd157('0x2a'),_0xd157('0x4c'),_0xd157('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x2dfac9,null))[_0xd157('0x23')](function(_0x5d119f){if(_0x5d119f){if(!fs[_0xd157('0x4e')](path[_0xd157('0x4f')](config[_0xd157('0x50')],_0xd157('0x51'),_0x5d119f['save_name']+'.'+_0x5d119f['converted_format']))){throw new db['Sequelize'][(_0xd157('0x52'))](_0xd157('0x53'));}return _0x2dfac9[_0xd157('0x4b')](path[_0xd157('0x4f')](config[_0xd157('0x50')],_0xd157('0x51'),util[_0xd157('0x54')](_0xd157('0x55'),_0x5d119f[_0xd157('0x4c')],_0x5d119f[_0xd157('0x4d')])),util['format'](_0xd157('0x55'),_0x5d119f['name'],_0x5d119f[_0xd157('0x4d')]));}return null;})[_0xd157('0x44')](handleError(_0x2dfac9,null));};exports[_0xd157('0x56')]=function(_0x37cc67,_0x568a70,_0x4de71a){var _0x2aba6d={'name':path['basename'](_0x37cc67[_0xd157('0x57')][_0xd157('0x58')],path['extname'](_0x37cc67[_0xd157('0x57')][_0xd157('0x58')])),'save_name':path[_0xd157('0x59')](_0x37cc67[_0xd157('0x57')][_0xd157('0x5a')],path[_0xd157('0x5b')](_0x37cc67[_0xd157('0x57')]['filename'])),'original_format':path[_0xd157('0x5b')](_0x37cc67[_0xd157('0x57')][_0xd157('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x21c034=path[_0xd157('0x4f')](config[_0xd157('0x50')],'server/files/sounds/original',_0x37cc67[_0xd157('0x57')]['filename']);var _0x1303da=path[_0xd157('0x4f')](config[_0xd157('0x50')],'server/files/sounds/converted',util[_0xd157('0x54')](_0xd157('0x55'),path[_0xd157('0x59')](_0x37cc67[_0xd157('0x57')][_0xd157('0x5a')],path[_0xd157('0x5b')](_0x37cc67['file'][_0xd157('0x5a')])),_0x2aba6d[_0xd157('0x4d')]));logger[_0xd157('0x5c')](_0xd157('0x5d'),_0x21c034);logger[_0xd157('0x5c')](_0xd157('0x5e'),_0x1303da);try{fs['chmodSync'](_0x21c034,parseInt(_0xd157('0x5f'),0x8));var _0x120fda=sox[_0xd157('0x60')](_0x21c034,_0x1303da,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x120fda['on'](_0xd157('0x28'),function(_0x8d3320){fs[_0xd157('0x61')](_0x21c034);_0x568a70['status'](0x1f4)[_0xd157('0x2b')](_0x8d3320);});_0x120fda['on'](_0xd157('0x62'),function(_0x47c3c4){_0x2aba6d['original_duration']=isNaN(_0x47c3c4[_0xd157('0x63')])?null:_0x47c3c4[_0xd157('0x63')]*0x3e8;_0x2aba6d['original_sampleCount']=isNaN(_0x47c3c4[_0xd157('0x64')])?null:_0x47c3c4[_0xd157('0x64')];_0x2aba6d[_0xd157('0x65')]=isNaN(_0x47c3c4[_0xd157('0x66')])?null:_0x47c3c4[_0xd157('0x66')];_0x2aba6d[_0xd157('0x67')]=isNaN(_0x47c3c4[_0xd157('0x68')])?null:_0x47c3c4['bitRate'];_0x2aba6d['original_sampleRate']=isNaN(_0x47c3c4[_0xd157('0x69')])?null:_0x47c3c4[_0xd157('0x69')];});_0x120fda['on']('dest',function(_0x2e4b46){_0x2aba6d[_0xd157('0x6a')]=isNaN(_0x2e4b46[_0xd157('0x63')])?null:_0x2e4b46[_0xd157('0x63')]*0x3e8;_0x2aba6d[_0xd157('0x6b')]=isNaN(_0x2e4b46[_0xd157('0x64')])?null:_0x2e4b46[_0xd157('0x64')];_0x2aba6d[_0xd157('0x6c')]=isNaN(_0x2e4b46[_0xd157('0x66')])?null:_0x2e4b46['channelCount'];_0x2aba6d[_0xd157('0x6d')]=isNaN(_0x2e4b46[_0xd157('0x68')])?null:_0x2e4b46[_0xd157('0x68')];_0x2aba6d[_0xd157('0x6e')]=isNaN(_0x2e4b46['sampleRate'])?null:_0x2e4b46['sampleRate'];});_0x120fda['on'](_0xd157('0x19'),function(){fs[_0xd157('0x6f')](_0x1303da,parseInt(_0xd157('0x5f'),0x8));return db[_0xd157('0x2d')]['create'](_0x2aba6d)[_0xd157('0x23')](function(_0x3291dc){var _0x2f9f52={'role':_0x37cc67[_0xd157('0x70')]['role'],'userProfileId':_0x37cc67['body']['userProfileId']};if(!_0x2f9f52)throw new Error(_0xd157('0x71'));if(_0x2f9f52[_0xd157('0x72')]==='user'){var _0x5b6063=_0x3291dc[_0xd157('0x25')]({'plain':!![]});return db[_0xd157('0x73')]['find']({'where':{'name':_0xd157('0x26'),'userProfileId':_0x2f9f52[_0xd157('0x74')]},'raw':!![]})[_0xd157('0x23')](function(_0x5b3042){if(_0x5b3042&&_0x5b3042[_0xd157('0x75')]===0x0){return db[_0xd157('0x27')][_0xd157('0x56')]({'name':_0x5b6063['name'],'resourceId':_0x5b6063['id'],'type':_0x5b3042[_0xd157('0x2a')],'sectionId':_0x5b3042['id']},{})[_0xd157('0x23')](function(){return _0x3291dc;});}else{return _0x3291dc;}})[_0xd157('0x44')](function(_0x20c6c1){logger[_0xd157('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20c6c1);throw _0x20c6c1;});}return _0x3291dc;})[_0xd157('0x23')](respondWithResult(_0x568a70,null))[_0xd157('0x44')](handleError(_0x568a70,null));});_0x120fda['start']();}catch(_0x552f58){_0x568a70[_0xd157('0x18')](0x1f4)[_0xd157('0x2b')](_0x552f58);}};exports[_0xd157('0x22')]=function(_0x47945b,_0xb35b3a,_0x57d24f){return db['Sound'][_0xd157('0x4a')]({'where':{'id':_0x47945b[_0xd157('0x46')]['id']}})['then'](handleEntityNotFound(_0xb35b3a,null))[_0xd157('0x23')](saveUpdates(_[_0xd157('0x3d')](_0x47945b[_0xd157('0x70')],[_0xd157('0x2a'),_0xd157('0x76')]),null))[_0xd157('0x23')](respondWithResult(_0xb35b3a,null))[_0xd157('0x44')](handleError(_0xb35b3a,null));};exports['delete']=function(_0x5ab11e,_0x9ea0a,_0x46e6a3){return db[_0xd157('0x2d')][_0xd157('0x4a')]({'where':{'id':_0x5ab11e[_0xd157('0x46')]['id']}})[_0xd157('0x23')](function(_0x54f7c4){if(_0x54f7c4){return _0x54f7c4[_0xd157('0x24')]();}})[_0xd157('0x23')](function(_0x568113){var _0xae7ca8=path['join'](config['root'],_0xd157('0x77'),util['format']('%s.%s',_0x568113[_0xd157('0x4c')],_0x568113[_0xd157('0x78')]));var _0x327ff7=path[_0xd157('0x4f')](config[_0xd157('0x50')],_0xd157('0x51'),util['format'](_0xd157('0x55'),_0x568113[_0xd157('0x4c')],_0x568113[_0xd157('0x4d')]));fs[_0xd157('0x61')](_0xae7ca8);fs[_0xd157('0x61')](_0x327ff7);return _0x568113;})[_0xd157('0x23')](function(_0x631560){if(_0x631560){return _0x9ea0a['status'](0xcc)[_0xd157('0x19')]();}})[_0xd157('0x23')](handleEntityNotFound(_0x9ea0a,null))['catch'](handleError(_0x9ea0a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 21ccac9..d274e3f 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 _0xbd9a=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0xbd9a,0x9c));var _0xabd9=function(_0x40c78a,_0x4aaca0){_0x40c78a=_0x40c78a-0x0;var _0x26e86b=_0xbd9a[_0x40c78a];return _0x26e86b;};'use strict';var _=require(_0xabd9('0x0'));var util=require(_0xabd9('0x1'));var logger=require('../../config/logger')(_0xabd9('0x2'));var moment=require(_0xabd9('0x3'));var BPromise=require(_0xabd9('0x4'));var rp=require(_0xabd9('0x5'));var fs=require('fs');var path=require(_0xabd9('0x6'));var rimraf=require(_0xabd9('0x7'));var config=require(_0xabd9('0x8'));var attributes=require(_0xabd9('0x9'));module[_0xabd9('0xa')]=function(_0x10365c,_0x324695){return _0x10365c[_0xabd9('0xb')]('Sound',attributes,{'tableName':_0xabd9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e3a=['tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./sound.attributes','exports','define','Sound'];(function(_0x4628fd,_0xc1fc5e){var _0x7b9add=function(_0x5bf411){while(--_0x5bf411){_0x4628fd['push'](_0x4628fd['shift']());}};_0x7b9add(++_0xc1fc5e);}(_0x9e3a,0xcd));var _0xa9e3=function(_0x229191,_0x3b9a5f){_0x229191=_0x229191-0x0;var _0xd00078=_0x9e3a[_0x229191];return _0xd00078;};'use strict';var _=require(_0xa9e3('0x0'));var util=require(_0xa9e3('0x1'));var logger=require(_0xa9e3('0x2'))(_0xa9e3('0x3'));var moment=require(_0xa9e3('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9e3('0x6'));var config=require('../../config/environment');var attributes=require(_0xa9e3('0x7'));module[_0xa9e3('0x8')]=function(_0x3ec17b,_0x2b4425){return _0x3ec17b[_0xa9e3('0x9')](_0xa9e3('0xa'),attributes,{'tableName':_0xa9e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 23b07bf..856e83a 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 _0xaa97=['http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','Sound','options','raw','where','attributes','include','model','map','ShowSound','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xaa97,0x9a));var _0x7aa9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xaa97[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7aa9('0x0'));var util=require(_0x7aa9('0x1'));var moment=require('moment');var BPromise=require(_0x7aa9('0x2'));var rs=require(_0x7aa9('0x3'));var fs=require('fs');var Redis=require(_0x7aa9('0x4'));var db=require(_0x7aa9('0x5'))['db'];var utils=require(_0x7aa9('0x6'));var logger=require(_0x7aa9('0x7'))('rpc');var config=require(_0x7aa9('0x8'));var jayson=require(_0x7aa9('0x9'));var client=jayson[_0x7aa9('0xa')][_0x7aa9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37a0ed,_0x15cd3e,_0x9e30ef){return new BPromise(function(_0x135b9b,_0x21e132){return client[_0x7aa9('0xc')](_0x37a0ed,_0x9e30ef)[_0x7aa9('0xd')](function(_0x33ff6b){logger[_0x7aa9('0xe')](_0x7aa9('0xf'),_0x15cd3e,'request\x20sent');logger[_0x7aa9('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x15cd3e,_0x7aa9('0x11'),JSON[_0x7aa9('0x12')](_0x33ff6b));if(_0x33ff6b[_0x7aa9('0x13')]){if(_0x33ff6b[_0x7aa9('0x13')][_0x7aa9('0x14')]===0x1f4){logger[_0x7aa9('0x13')](_0x7aa9('0xf'),_0x15cd3e,_0x33ff6b[_0x7aa9('0x13')][_0x7aa9('0x15')]);return _0x21e132(_0x33ff6b[_0x7aa9('0x13')][_0x7aa9('0x15')]);}logger[_0x7aa9('0x13')](_0x7aa9('0xf'),_0x15cd3e,_0x33ff6b['error'][_0x7aa9('0x15')]);return _0x135b9b(_0x33ff6b['error'][_0x7aa9('0x15')]);}else{logger[_0x7aa9('0xe')]('Sound,\x20%s,\x20%s',_0x15cd3e,_0x7aa9('0x11'));_0x135b9b(_0x33ff6b[_0x7aa9('0x16')][_0x7aa9('0x15')]);}})[_0x7aa9('0x17')](function(_0x597e37){logger[_0x7aa9('0x13')](_0x7aa9('0xf'),_0x15cd3e,_0x597e37);_0x21e132(_0x597e37);});});}exports['ShowSound']=function(_0x133325){var _0x5385e5=this;return new Promise(function(_0x46c932,_0x420004){return db[_0x7aa9('0x18')]['find']({'raw':_0x133325[_0x7aa9('0x19')]?_0x133325[_0x7aa9('0x19')][_0x7aa9('0x1a')]===undefined?!![]:![]:!![],'where':_0x133325[_0x7aa9('0x19')]?_0x133325[_0x7aa9('0x19')][_0x7aa9('0x1b')]||null:null,'attributes':_0x133325['options']?_0x133325['options'][_0x7aa9('0x1c')]||null:null,'include':_0x133325['options']?_0x133325[_0x7aa9('0x19')][_0x7aa9('0x1d')]?_['map'](_0x133325[_0x7aa9('0x19')][_0x7aa9('0x1d')],function(_0x55bb04){return{'model':db[_0x55bb04['model']],'as':_0x55bb04['as'],'attributes':_0x55bb04[_0x7aa9('0x1c')],'include':_0x55bb04[_0x7aa9('0x1d')]?_['map'](_0x55bb04[_0x7aa9('0x1d')],function(_0x4ed8b4){return{'model':db[_0x4ed8b4[_0x7aa9('0x1e')]],'as':_0x4ed8b4['as'],'attributes':_0x4ed8b4[_0x7aa9('0x1c')],'include':_0x4ed8b4[_0x7aa9('0x1d')]?_[_0x7aa9('0x1f')](_0x4ed8b4[_0x7aa9('0x1d')],function(_0x816921){return{'model':db[_0x816921[_0x7aa9('0x1e')]],'as':_0x816921['as'],'attributes':_0x816921['attributes']};}):[]};}):[]};}):[]:[]})[_0x7aa9('0xd')](function(_0x3588da){logger[_0x7aa9('0xe')]('ShowSound',_0x133325);logger[_0x7aa9('0x10')](_0x7aa9('0x20'),_0x133325,JSON[_0x7aa9('0x12')](_0x3588da));_0x46c932(_0x3588da);})[_0x7aa9('0x17')](function(_0x1f29a9){logger[_0x7aa9('0x13')](_0x7aa9('0x20'),_0x1f29a9['message'],_0x133325);_0x420004(_0x5385e5[_0x7aa9('0x13')](0x1f4,_0x1f29a9[_0x7aa9('0x15')]));});});}; \ No newline at end of file +var _0xffa2=['Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Sound','options','raw','attributes','model','map','include','then','ShowSound','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xffa2,0x69));var _0x2ffa=function(_0x1f9fa0,_0x52e4c9){_0x1f9fa0=_0x1f9fa0-0x0;var _0x13e380=_0xffa2[_0x1f9fa0];return _0x13e380;};'use strict';var _=require('lodash');var util=require(_0x2ffa('0x0'));var moment=require(_0x2ffa('0x1'));var BPromise=require(_0x2ffa('0x2'));var rs=require(_0x2ffa('0x3'));var fs=require('fs');var Redis=require(_0x2ffa('0x4'));var db=require(_0x2ffa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ffa('0x6'));var config=require(_0x2ffa('0x7'));var jayson=require(_0x2ffa('0x8'));var client=jayson[_0x2ffa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ba71f,_0x48a68a,_0x469b5f){return new BPromise(function(_0x381c33,_0x298bc1){return client[_0x2ffa('0xa')](_0x5ba71f,_0x469b5f)['then'](function(_0x44c485){logger[_0x2ffa('0xb')](_0x2ffa('0xc'),_0x48a68a,_0x2ffa('0xd'));logger[_0x2ffa('0xe')](_0x2ffa('0xf'),_0x48a68a,_0x2ffa('0xd'),JSON[_0x2ffa('0x10')](_0x44c485));if(_0x44c485[_0x2ffa('0x11')]){if(_0x44c485[_0x2ffa('0x11')]['code']===0x1f4){logger['error'](_0x2ffa('0xc'),_0x48a68a,_0x44c485[_0x2ffa('0x11')][_0x2ffa('0x12')]);return _0x298bc1(_0x44c485[_0x2ffa('0x11')][_0x2ffa('0x12')]);}logger[_0x2ffa('0x11')](_0x2ffa('0xc'),_0x48a68a,_0x44c485[_0x2ffa('0x11')]['message']);return _0x381c33(_0x44c485['error'][_0x2ffa('0x12')]);}else{logger[_0x2ffa('0xb')](_0x2ffa('0xc'),_0x48a68a,_0x2ffa('0xd'));_0x381c33(_0x44c485[_0x2ffa('0x13')][_0x2ffa('0x12')]);}})[_0x2ffa('0x14')](function(_0x4c8cf5){logger[_0x2ffa('0x11')](_0x2ffa('0xc'),_0x48a68a,_0x4c8cf5);_0x298bc1(_0x4c8cf5);});});}exports['ShowSound']=function(_0xf93757){var _0x355a30=this;return new Promise(function(_0x1e23e2,_0x305700){return db[_0x2ffa('0x15')]['find']({'raw':_0xf93757['options']?_0xf93757[_0x2ffa('0x16')][_0x2ffa('0x17')]===undefined?!![]:![]:!![],'where':_0xf93757[_0x2ffa('0x16')]?_0xf93757[_0x2ffa('0x16')]['where']||null:null,'attributes':_0xf93757[_0x2ffa('0x16')]?_0xf93757['options'][_0x2ffa('0x18')]||null:null,'include':_0xf93757[_0x2ffa('0x16')]?_0xf93757[_0x2ffa('0x16')]['include']?_['map'](_0xf93757[_0x2ffa('0x16')]['include'],function(_0xc7959e){return{'model':db[_0xc7959e[_0x2ffa('0x19')]],'as':_0xc7959e['as'],'attributes':_0xc7959e[_0x2ffa('0x18')],'include':_0xc7959e['include']?_[_0x2ffa('0x1a')](_0xc7959e[_0x2ffa('0x1b')],function(_0x74317a){return{'model':db[_0x74317a['model']],'as':_0x74317a['as'],'attributes':_0x74317a[_0x2ffa('0x18')],'include':_0x74317a['include']?_[_0x2ffa('0x1a')](_0x74317a[_0x2ffa('0x1b')],function(_0x5566de){return{'model':db[_0x5566de[_0x2ffa('0x19')]],'as':_0x5566de['as'],'attributes':_0x5566de[_0x2ffa('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2ffa('0x1c')](function(_0x3262b3){logger[_0x2ffa('0xb')](_0x2ffa('0x1d'),_0xf93757);logger[_0x2ffa('0xe')](_0x2ffa('0x1d'),_0xf93757,JSON[_0x2ffa('0x10')](_0x3262b3));_0x1e23e2(_0x3262b3);})[_0x2ffa('0x14')](function(_0x5291f5){logger[_0x2ffa('0x11')](_0x2ffa('0x1d'),_0x5291f5[_0x2ffa('0x12')],_0xf93757);_0x305700(_0x355a30[_0x2ffa('0x11')](0x1f4,_0x5291f5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9be7875..b102e49 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x5cc30e,_0x4f1bc8){var _0x3d0e5e=function(_0x15d32d){while(--_0x15d32d){_0x5cc30e['push'](_0x5cc30e['shift']());}};_0x3d0e5e(++_0x4f1bc8);}(_0x14a0,0x8e));var _0x014a=function(_0x275080,_0x38d7ef){_0x275080=_0x275080-0x0;var _0x4defa7=_0x14a0[_0x275080];return _0x4defa7;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a1872,_0x409461){_0x1a1872=_0x1a1872-0x0;var _0x5d0ad9=_0x4fc2[_0x1a1872];return _0x5d0ad9;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 903a824..a193f46 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 _0x9bf0=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0xd033df,_0x533be5){var _0x51e3ce=function(_0x8d1a84){while(--_0x8d1a84){_0xd033df['push'](_0xd033df['shift']());}};_0x51e3ce(++_0x533be5);}(_0x9bf0,0x16c));var _0x09bf=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x9bf0[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require(_0x09bf('0x0'));module[_0x09bf('0x1')]={'uniqueid':{'type':Sequelize[_0x09bf('0x2')]},'body':{'type':Sequelize[_0x09bf('0x3')](_0x09bf('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x09bf('0x5')]('in',_0x09bf('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x09bf('0x2')]},'providerResponse':{'type':Sequelize[_0x09bf('0x3')]}}; \ No newline at end of file +var _0x6215=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x6215,0x111));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'uniqueid':{'type':Sequelize[_0x5621('0x2')]},'body':{'type':Sequelize[_0x5621('0x3')](_0x5621('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5621('0x5')]('in',_0x5621('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5621('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 526a367..aa5a069 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 _0xca83=['rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','SquareMessage','includeAll','include','findAll','rows','catch','show'];(function(_0x4e6fc7,_0x6b9a5d){var _0x3c2ef6=function(_0x3907ed){while(--_0x3907ed){_0x4e6fc7['push'](_0x4e6fc7['shift']());}};_0x3c2ef6(++_0x6b9a5d);}(_0xca83,0x99));var _0x3ca8=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xca83[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0x3ca8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ca8('0x1'));var jsonpatch=require(_0x3ca8('0x2'));var rp=require(_0x3ca8('0x3'));var moment=require(_0x3ca8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ca8('0x5'));var util=require('util');var path=require(_0x3ca8('0x6'));var sox=require(_0x3ca8('0x7'));var csv=require('to-csv');var ejs=require(_0x3ca8('0x8'));var fs=require('fs');var fs_extra=require(_0x3ca8('0x9'));var _=require('lodash');var squel=require(_0x3ca8('0xa'));var crypto=require('crypto');var jsforce=require(_0x3ca8('0xb'));var deskjs=require(_0x3ca8('0xc'));var toCsv=require(_0x3ca8('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3ca8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3ca8('0xf'));var as=require(_0x3ca8('0x10'));var hardwareService=require(_0x3ca8('0x11'));var logger=require(_0x3ca8('0x12'))(_0x3ca8('0x13'));var utils=require(_0x3ca8('0x14'));var config=require(_0x3ca8('0x15'));var licenseUtil=require(_0x3ca8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e79b4,_0x413c3f){_0x413c3f=_0x413c3f||0xcc;return function(_0x2b71d6){if(_0x2b71d6){return _0x1e79b4[_0x3ca8('0x17')](_0x413c3f);}return _0x1e79b4[_0x3ca8('0x18')](_0x413c3f)[_0x3ca8('0x19')]();};}function respondWithResult(_0x30f53a,_0xc69de9){_0xc69de9=_0xc69de9||0xc8;return function(_0x150fc1){if(_0x150fc1){return _0x30f53a[_0x3ca8('0x18')](_0xc69de9)[_0x3ca8('0x1a')](_0x150fc1);}};}function respondWithFilteredResult(_0x365b09,_0x5a7ea2){return function(_0x172c8f){if(_0x172c8f){var _0x2fa11f=typeof _0x5a7ea2[_0x3ca8('0x1b')]===_0x3ca8('0x1c')&&typeof _0x5a7ea2[_0x3ca8('0x1d')]===_0x3ca8('0x1c');var _0x1f3a8f=_0x172c8f[_0x3ca8('0x1e')];var _0x3bc024=_0x2fa11f?0x0:_0x5a7ea2[_0x3ca8('0x1b')];var _0xe6379b=_0x2fa11f?_0x172c8f[_0x3ca8('0x1e')]:_0x5a7ea2[_0x3ca8('0x1b')]+_0x5a7ea2[_0x3ca8('0x1d')];var _0x22f061;if(_0xe6379b>=_0x1f3a8f){_0xe6379b=_0x1f3a8f;_0x22f061=0xc8;}else{_0x22f061=0xce;}_0x365b09[_0x3ca8('0x18')](_0x22f061);return _0x365b09[_0x3ca8('0x1f')](_0x3ca8('0x20'),_0x3bc024+'-'+_0xe6379b+'/'+_0x1f3a8f)[_0x3ca8('0x1a')](_0x172c8f);}return null;};}function patchUpdates(_0x4213d9){return function(_0x1a5220){try{jsonpatch[_0x3ca8('0x21')](_0x1a5220,_0x4213d9,!![]);}catch(_0x386c7b){return BPromise[_0x3ca8('0x22')](_0x386c7b);}return _0x1a5220[_0x3ca8('0x23')]();};}function saveUpdates(_0x192a2f,_0x207536){return function(_0x2d377c){if(_0x2d377c){return _0x2d377c[_0x3ca8('0x24')](_0x192a2f)[_0x3ca8('0x25')](function(_0x5f4b89){return _0x5f4b89;});}return null;};}function removeEntity(_0x1244db,_0x53e6b8){return function(_0x3d39e0){if(_0x3d39e0){return _0x3d39e0[_0x3ca8('0x26')]()[_0x3ca8('0x25')](function(){_0x1244db[_0x3ca8('0x18')](0xcc)[_0x3ca8('0x19')]();});}};}function handleEntityNotFound(_0x5380c9,_0x1ed6aa){return function(_0x2c50b8){if(!_0x2c50b8){_0x5380c9[_0x3ca8('0x17')](0x194);}return _0x2c50b8;};}function handleError(_0x1d28a0,_0x4fcca3){_0x4fcca3=_0x4fcca3||0x1f4;return function(_0x1efc1a){logger[_0x3ca8('0x27')](_0x1efc1a['stack']);if(_0x1efc1a[_0x3ca8('0x28')]){delete _0x1efc1a['name'];}_0x1d28a0[_0x3ca8('0x18')](_0x4fcca3)[_0x3ca8('0x29')](_0x1efc1a);};}exports['index']=function(_0x1663c5,_0x123261){var _0x5054bb={},_0x1741c4={},_0x2e1c91={'count':0x0,'rows':[]};var _0x2380ff=_['map'](db['SquareMessage']['rawAttributes'],function(_0x3d0c9e){return{'name':_0x3d0c9e[_0x3ca8('0x2a')],'type':_0x3d0c9e['type'][_0x3ca8('0x2b')]};});_0x1741c4[_0x3ca8('0x2c')]=_['map'](_0x2380ff,_0x3ca8('0x28'));_0x1741c4['query']=_[_0x3ca8('0x2d')](_0x1663c5[_0x3ca8('0x2e')]);_0x1741c4[_0x3ca8('0x2f')]=_[_0x3ca8('0x30')](_0x1741c4['model'],_0x1741c4['query']);_0x5054bb[_0x3ca8('0x31')]=_[_0x3ca8('0x30')](_0x1741c4[_0x3ca8('0x2c')],qs['fields'](_0x1663c5['query'][_0x3ca8('0x32')]));_0x5054bb['attributes']=_0x5054bb[_0x3ca8('0x31')][_0x3ca8('0x33')]?_0x5054bb[_0x3ca8('0x31')]:_0x1741c4[_0x3ca8('0x2c')];if(!_0x1663c5[_0x3ca8('0x2e')]['hasOwnProperty'](_0x3ca8('0x34'))){_0x5054bb[_0x3ca8('0x1d')]=qs[_0x3ca8('0x1d')](_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x1d')]);_0x5054bb[_0x3ca8('0x1b')]=qs['offset'](_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x1b')]);}_0x5054bb[_0x3ca8('0x35')]=qs[_0x3ca8('0x36')](_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x36')]);_0x5054bb[_0x3ca8('0x37')]=qs[_0x3ca8('0x2f')](_[_0x3ca8('0x38')](_0x1663c5[_0x3ca8('0x2e')],_0x1741c4[_0x3ca8('0x2f')]),_0x2380ff);if(_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x39')]){_0x5054bb[_0x3ca8('0x37')]=_[_0x3ca8('0x3a')](_0x5054bb[_0x3ca8('0x37')],{'$or':_[_0x3ca8('0x3b')](_0x2380ff,function(_0x61a6cf){if(_0x61a6cf[_0x3ca8('0x3c')]!=='VIRTUAL'){var _0x54622a={};_0x54622a[_0x61a6cf[_0x3ca8('0x28')]]={'$like':'%'+_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x39')]+'%'};return _0x54622a;}})});}_0x5054bb=_[_0x3ca8('0x3a')]({},_0x5054bb,_0x1663c5[_0x3ca8('0x3d')]);var _0x2113d3={'where':_0x5054bb['where']};return db[_0x3ca8('0x3e')][_0x3ca8('0x1e')](_0x2113d3)[_0x3ca8('0x25')](function(_0x54630a){_0x2e1c91[_0x3ca8('0x1e')]=_0x54630a;if(_0x1663c5[_0x3ca8('0x2e')][_0x3ca8('0x3f')]){_0x5054bb[_0x3ca8('0x40')]=[{'all':!![]}];}return db[_0x3ca8('0x3e')][_0x3ca8('0x41')](_0x5054bb);})[_0x3ca8('0x25')](function(_0x52e137){_0x2e1c91[_0x3ca8('0x42')]=_0x52e137;return _0x2e1c91;})['then'](respondWithFilteredResult(_0x123261,_0x5054bb))[_0x3ca8('0x43')](handleError(_0x123261,null));};exports[_0x3ca8('0x44')]=function(_0x13ec87,_0x1e15b7){var _0xedf40={'raw':!![],'where':{'id':_0x13ec87['params']['id']}},_0x4c6823={};_0x4c6823[_0x3ca8('0x2c')]=_[_0x3ca8('0x2d')](db[_0x3ca8('0x3e')][_0x3ca8('0x45')]);_0x4c6823[_0x3ca8('0x2e')]=_[_0x3ca8('0x2d')](_0x13ec87['query']);_0x4c6823[_0x3ca8('0x2f')]=_[_0x3ca8('0x30')](_0x4c6823[_0x3ca8('0x2c')],_0x4c6823[_0x3ca8('0x2e')]);_0xedf40[_0x3ca8('0x31')]=_[_0x3ca8('0x30')](_0x4c6823[_0x3ca8('0x2c')],qs['fields'](_0x13ec87[_0x3ca8('0x2e')][_0x3ca8('0x32')]));_0xedf40['attributes']=_0xedf40['attributes'][_0x3ca8('0x33')]?_0xedf40[_0x3ca8('0x31')]:_0x4c6823['model'];if(_0x13ec87['query'][_0x3ca8('0x3f')]){_0xedf40[_0x3ca8('0x40')]=[{'all':!![]}];}_0xedf40=_[_0x3ca8('0x3a')]({},_0xedf40,_0x13ec87[_0x3ca8('0x3d')]);return db[_0x3ca8('0x3e')][_0x3ca8('0x46')](_0xedf40)[_0x3ca8('0x25')](handleEntityNotFound(_0x1e15b7,null))[_0x3ca8('0x25')](respondWithResult(_0x1e15b7,null))['catch'](handleError(_0x1e15b7,null));};exports[_0x3ca8('0x47')]=function(_0x5ae957,_0x48a556){return db['SquareMessage'][_0x3ca8('0x47')](_0x5ae957['body'],{})[_0x3ca8('0x25')](respondWithResult(_0x48a556,0xc9))[_0x3ca8('0x43')](handleError(_0x48a556,null));};exports[_0x3ca8('0x24')]=function(_0x3bfef6,_0xe8adaa){if(_0x3bfef6[_0x3ca8('0x48')]['id']){delete _0x3bfef6[_0x3ca8('0x48')]['id'];}return db[_0x3ca8('0x3e')][_0x3ca8('0x46')]({'where':{'id':_0x3bfef6[_0x3ca8('0x49')]['id']}})[_0x3ca8('0x25')](handleEntityNotFound(_0xe8adaa,null))[_0x3ca8('0x25')](saveUpdates(_0x3bfef6[_0x3ca8('0x48')],null))[_0x3ca8('0x25')](respondWithResult(_0xe8adaa,null))[_0x3ca8('0x43')](handleError(_0xe8adaa,null));};exports['destroy']=function(_0x2ea592,_0x1cb053){return db['SquareMessage'][_0x3ca8('0x46')]({'where':{'id':_0x2ea592[_0x3ca8('0x49')]['id']}})[_0x3ca8('0x25')](handleEntityNotFound(_0x1cb053,null))['then'](removeEntity(_0x1cb053,null))['catch'](handleError(_0x1cb053,null));}; \ No newline at end of file +var _0xbdcc=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','findAll','rows','catch','show','params','includeAll','include','options','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x508c71,_0x55b144){var _0x1a1f53=function(_0x3755e7){while(--_0x3755e7){_0x508c71['push'](_0x508c71['shift']());}};_0x1a1f53(++_0x55b144);}(_0xbdcc,0x143));var _0xcbdc=function(_0x4ecc66,_0x55c4e2){_0x4ecc66=_0x4ecc66-0x0;var _0x57fd1=_0xbdcc[_0x4ecc66];return _0x57fd1;};'use strict';var emlformat=require(_0xcbdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcbdc('0x1'));var jsonpatch=require(_0xcbdc('0x2'));var rp=require(_0xcbdc('0x3'));var moment=require(_0xcbdc('0x4'));var BPromise=require(_0xcbdc('0x5'));var Mustache=require(_0xcbdc('0x6'));var util=require(_0xcbdc('0x7'));var path=require(_0xcbdc('0x8'));var sox=require(_0xcbdc('0x9'));var csv=require(_0xcbdc('0xa'));var ejs=require(_0xcbdc('0xb'));var fs=require('fs');var fs_extra=require(_0xcbdc('0xc'));var _=require(_0xcbdc('0xd'));var squel=require('squel');var crypto=require(_0xcbdc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcbdc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcbdc('0x10'));var Papa=require(_0xcbdc('0x11'));var Redis=require(_0xcbdc('0x12'));var authService=require(_0xcbdc('0x13'));var qs=require(_0xcbdc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbdc('0x15'));var logger=require('../../config/logger')(_0xcbdc('0x16'));var utils=require('../../config/utils');var config=require(_0xcbdc('0x17'));var licenseUtil=require(_0xcbdc('0x18'));var db=require(_0xcbdc('0x19'))['db'];function respondWithStatusCode(_0x488850,_0x4379ed){_0x4379ed=_0x4379ed||0xcc;return function(_0x444c19){if(_0x444c19){return _0x488850['sendStatus'](_0x4379ed);}return _0x488850[_0xcbdc('0x1a')](_0x4379ed)[_0xcbdc('0x1b')]();};}function respondWithResult(_0x4a64e1,_0x266fb7){_0x266fb7=_0x266fb7||0xc8;return function(_0x16334c){if(_0x16334c){return _0x4a64e1['status'](_0x266fb7)[_0xcbdc('0x1c')](_0x16334c);}};}function respondWithFilteredResult(_0x292772,_0x4802bc){return function(_0x3d4bc6){if(_0x3d4bc6){var _0x4f6d98=typeof _0x4802bc[_0xcbdc('0x1d')]===_0xcbdc('0x1e')&&typeof _0x4802bc[_0xcbdc('0x1f')]==='undefined';var _0x39d841=_0x3d4bc6['count'];var _0x187430=_0x4f6d98?0x0:_0x4802bc['offset'];var _0x542262=_0x4f6d98?_0x3d4bc6['count']:_0x4802bc[_0xcbdc('0x1d')]+_0x4802bc[_0xcbdc('0x1f')];var _0x49ba32;if(_0x542262>=_0x39d841){_0x542262=_0x39d841;_0x49ba32=0xc8;}else{_0x49ba32=0xce;}_0x292772[_0xcbdc('0x1a')](_0x49ba32);return _0x292772['set'](_0xcbdc('0x20'),_0x187430+'-'+_0x542262+'/'+_0x39d841)[_0xcbdc('0x1c')](_0x3d4bc6);}return null;};}function patchUpdates(_0x2abb8c){return function(_0x1d0ceb){try{jsonpatch[_0xcbdc('0x21')](_0x1d0ceb,_0x2abb8c,!![]);}catch(_0x5fdf8){return BPromise['reject'](_0x5fdf8);}return _0x1d0ceb['save']();};}function saveUpdates(_0x29992e,_0x15e7cc){return function(_0x559d11){if(_0x559d11){return _0x559d11['update'](_0x29992e)[_0xcbdc('0x22')](function(_0x22d50a){return _0x22d50a;});}return null;};}function removeEntity(_0x21cafa,_0x652d8f){return function(_0x7898ac){if(_0x7898ac){return _0x7898ac['destroy']()[_0xcbdc('0x22')](function(){_0x21cafa[_0xcbdc('0x1a')](0xcc)[_0xcbdc('0x1b')]();});}};}function handleEntityNotFound(_0x5cf334,_0x3ca08c){return function(_0x24f9f5){if(!_0x24f9f5){_0x5cf334[_0xcbdc('0x23')](0x194);}return _0x24f9f5;};}function handleError(_0x4e3951,_0x577213){_0x577213=_0x577213||0x1f4;return function(_0x2f749a){logger[_0xcbdc('0x24')](_0x2f749a[_0xcbdc('0x25')]);if(_0x2f749a[_0xcbdc('0x26')]){delete _0x2f749a[_0xcbdc('0x26')];}_0x4e3951[_0xcbdc('0x1a')](_0x577213)[_0xcbdc('0x27')](_0x2f749a);};}exports[_0xcbdc('0x28')]=function(_0x15c05c,_0x44a8d8){var _0x1e51ed={},_0x13c4d5={},_0x2c7a85={'count':0x0,'rows':[]};var _0x3d9188=_[_0xcbdc('0x29')](db[_0xcbdc('0x2a')][_0xcbdc('0x2b')],function(_0x1024e9){return{'name':_0x1024e9[_0xcbdc('0x2c')],'type':_0x1024e9['type'][_0xcbdc('0x2d')]};});_0x13c4d5[_0xcbdc('0x2e')]=_['map'](_0x3d9188,'name');_0x13c4d5[_0xcbdc('0x2f')]=_[_0xcbdc('0x30')](_0x15c05c[_0xcbdc('0x2f')]);_0x13c4d5[_0xcbdc('0x31')]=_[_0xcbdc('0x32')](_0x13c4d5[_0xcbdc('0x2e')],_0x13c4d5[_0xcbdc('0x2f')]);_0x1e51ed[_0xcbdc('0x33')]=_['intersection'](_0x13c4d5[_0xcbdc('0x2e')],qs['fields'](_0x15c05c['query']['fields']));_0x1e51ed[_0xcbdc('0x33')]=_0x1e51ed[_0xcbdc('0x33')]['length']?_0x1e51ed['attributes']:_0x13c4d5[_0xcbdc('0x2e')];if(!_0x15c05c[_0xcbdc('0x2f')][_0xcbdc('0x34')]('nolimit')){_0x1e51ed['limit']=qs['limit'](_0x15c05c[_0xcbdc('0x2f')]['limit']);_0x1e51ed[_0xcbdc('0x1d')]=qs[_0xcbdc('0x1d')](_0x15c05c['query'][_0xcbdc('0x1d')]);}_0x1e51ed[_0xcbdc('0x35')]=qs[_0xcbdc('0x36')](_0x15c05c['query']['sort']);_0x1e51ed[_0xcbdc('0x37')]=qs[_0xcbdc('0x31')](_[_0xcbdc('0x38')](_0x15c05c[_0xcbdc('0x2f')],_0x13c4d5[_0xcbdc('0x31')]),_0x3d9188);if(_0x15c05c[_0xcbdc('0x2f')][_0xcbdc('0x39')]){_0x1e51ed[_0xcbdc('0x37')]=_[_0xcbdc('0x3a')](_0x1e51ed[_0xcbdc('0x37')],{'$or':_[_0xcbdc('0x29')](_0x3d9188,function(_0xa2054a){if(_0xa2054a[_0xcbdc('0x3b')]!==_0xcbdc('0x3c')){var _0x36a195={};_0x36a195[_0xa2054a[_0xcbdc('0x26')]]={'$like':'%'+_0x15c05c[_0xcbdc('0x2f')][_0xcbdc('0x39')]+'%'};return _0x36a195;}})});}_0x1e51ed=_[_0xcbdc('0x3a')]({},_0x1e51ed,_0x15c05c['options']);var _0x54552d={'where':_0x1e51ed[_0xcbdc('0x37')]};return db[_0xcbdc('0x2a')][_0xcbdc('0x3d')](_0x54552d)[_0xcbdc('0x22')](function(_0x8197e5){_0x2c7a85['count']=_0x8197e5;if(_0x15c05c[_0xcbdc('0x2f')]['includeAll']){_0x1e51ed['include']=[{'all':!![]}];}return db[_0xcbdc('0x2a')][_0xcbdc('0x3e')](_0x1e51ed);})[_0xcbdc('0x22')](function(_0x206c04){_0x2c7a85[_0xcbdc('0x3f')]=_0x206c04;return _0x2c7a85;})[_0xcbdc('0x22')](respondWithFilteredResult(_0x44a8d8,_0x1e51ed))[_0xcbdc('0x40')](handleError(_0x44a8d8,null));};exports[_0xcbdc('0x41')]=function(_0x521e21,_0x1cd194){var _0x1c340a={'raw':!![],'where':{'id':_0x521e21[_0xcbdc('0x42')]['id']}},_0x1505d1={};_0x1505d1[_0xcbdc('0x2e')]=_['keys'](db[_0xcbdc('0x2a')][_0xcbdc('0x2b')]);_0x1505d1[_0xcbdc('0x2f')]=_[_0xcbdc('0x30')](_0x521e21[_0xcbdc('0x2f')]);_0x1505d1[_0xcbdc('0x31')]=_[_0xcbdc('0x32')](_0x1505d1[_0xcbdc('0x2e')],_0x1505d1[_0xcbdc('0x2f')]);_0x1c340a[_0xcbdc('0x33')]=_[_0xcbdc('0x32')](_0x1505d1[_0xcbdc('0x2e')],qs['fields'](_0x521e21[_0xcbdc('0x2f')]['fields']));_0x1c340a['attributes']=_0x1c340a[_0xcbdc('0x33')]['length']?_0x1c340a[_0xcbdc('0x33')]:_0x1505d1['model'];if(_0x521e21[_0xcbdc('0x2f')][_0xcbdc('0x43')]){_0x1c340a[_0xcbdc('0x44')]=[{'all':!![]}];}_0x1c340a=_[_0xcbdc('0x3a')]({},_0x1c340a,_0x521e21[_0xcbdc('0x45')]);return db[_0xcbdc('0x2a')][_0xcbdc('0x46')](_0x1c340a)[_0xcbdc('0x22')](handleEntityNotFound(_0x1cd194,null))[_0xcbdc('0x22')](respondWithResult(_0x1cd194,null))[_0xcbdc('0x40')](handleError(_0x1cd194,null));};exports[_0xcbdc('0x47')]=function(_0x4a82f1,_0x5f2807){return db[_0xcbdc('0x2a')][_0xcbdc('0x47')](_0x4a82f1['body'],{})['then'](respondWithResult(_0x5f2807,0xc9))[_0xcbdc('0x40')](handleError(_0x5f2807,null));};exports[_0xcbdc('0x48')]=function(_0x54f744,_0x4b2a76){if(_0x54f744['body']['id']){delete _0x54f744['body']['id'];}return db[_0xcbdc('0x2a')]['find']({'where':{'id':_0x54f744[_0xcbdc('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b2a76,null))[_0xcbdc('0x22')](saveUpdates(_0x54f744[_0xcbdc('0x49')],null))[_0xcbdc('0x22')](respondWithResult(_0x4b2a76,null))['catch'](handleError(_0x4b2a76,null));};exports[_0xcbdc('0x4a')]=function(_0x5e4bd9,_0x150fe5){return db[_0xcbdc('0x2a')][_0xcbdc('0x46')]({'where':{'id':_0x5e4bd9[_0xcbdc('0x42')]['id']}})[_0xcbdc('0x22')](handleEntityNotFound(_0x150fe5,null))[_0xcbdc('0x22')](removeEntity(_0x150fe5,null))[_0xcbdc('0x40')](handleError(_0x150fe5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 96e45ff..cfc3562 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 _0x6b4d=['./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x6b4d,0x1f0));var _0xd6b4=function(_0x36c337,_0x4a5fed){_0x36c337=_0x36c337-0x0;var _0x36a8f0=_0x6b4d[_0x36c337];return _0x36a8f0;};'use strict';var _=require(_0xd6b4('0x0'));var util=require(_0xd6b4('0x1'));var logger=require(_0xd6b4('0x2'))(_0xd6b4('0x3'));var moment=require(_0xd6b4('0x4'));var BPromise=require(_0xd6b4('0x5'));var rp=require(_0xd6b4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd6b4('0x7'));var attributes=require(_0xd6b4('0x8'));module[_0xd6b4('0x9')]=function(_0x49619c,_0x3ff076){return _0x49619c[_0xd6b4('0xa')](_0xd6b4('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf822=['exports','define','SquareMessage','lodash','api','moment','bluebird','path','rimraf','./squareMessage.attributes'];(function(_0x2047e1,_0x2e2487){var _0xdc40f9=function(_0x5ea3a1){while(--_0x5ea3a1){_0x2047e1['push'](_0x2047e1['shift']());}};_0xdc40f9(++_0x2e2487);}(_0xf822,0xd5));var _0x2f82=function(_0x37ec7b,_0x45ad1e){_0x37ec7b=_0x37ec7b-0x0;var _0x337c11=_0xf822[_0x37ec7b];return _0x337c11;};'use strict';var _=require(_0x2f82('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f82('0x1'));var moment=require(_0x2f82('0x2'));var BPromise=require(_0x2f82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f82('0x4'));var rimraf=require(_0x2f82('0x5'));var config=require('../../config/environment');var attributes=require(_0x2f82('0x6'));module[_0x2f82('0x7')]=function(_0x520905,_0x490215){return _0x520905[_0x2f82('0x8')](_0x2f82('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index ed1ddd9..06bc278 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 _0xc6a8=['then','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','raw'];(function(_0x2124a6,_0x4b788c){var _0x23e704=function(_0x367b3d){while(--_0x367b3d){_0x2124a6['push'](_0x2124a6['shift']());}};_0x23e704(++_0x4b788c);}(_0xc6a8,0x9d));var _0x8c6a=function(_0x4f03ef,_0x12d398){_0x4f03ef=_0x4f03ef-0x0;var _0x45ffe2=_0xc6a8[_0x4f03ef];return _0x45ffe2;};'use strict';var _=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c6a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6a('0x3'))['db'];var utils=require(_0x8c6a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c6a('0x5'));var jayson=require(_0x8c6a('0x6'));var client=jayson[_0x8c6a('0x7')][_0x8c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c6ecb,_0x443b3b,_0x3bed1d){return new BPromise(function(_0xcafdfe,_0x4b1585){return client['request'](_0x1c6ecb,_0x3bed1d)['then'](function(_0x4de2ec){logger['info'](_0x8c6a('0x9'),_0x443b3b,_0x8c6a('0xa'));logger[_0x8c6a('0xb')](_0x8c6a('0xc'),_0x443b3b,_0x8c6a('0xa'),JSON[_0x8c6a('0xd')](_0x4de2ec));if(_0x4de2ec[_0x8c6a('0xe')]){if(_0x4de2ec[_0x8c6a('0xe')][_0x8c6a('0xf')]===0x1f4){logger[_0x8c6a('0xe')](_0x8c6a('0x9'),_0x443b3b,_0x4de2ec[_0x8c6a('0xe')][_0x8c6a('0x10')]);return _0x4b1585(_0x4de2ec[_0x8c6a('0xe')][_0x8c6a('0x10')]);}logger[_0x8c6a('0xe')](_0x8c6a('0x9'),_0x443b3b,_0x4de2ec['error'][_0x8c6a('0x10')]);return _0xcafdfe(_0x4de2ec[_0x8c6a('0xe')][_0x8c6a('0x10')]);}else{logger[_0x8c6a('0x11')](_0x8c6a('0x9'),_0x443b3b,_0x8c6a('0xa'));_0xcafdfe(_0x4de2ec[_0x8c6a('0x12')][_0x8c6a('0x10')]);}})[_0x8c6a('0x13')](function(_0x597202){logger[_0x8c6a('0xe')](_0x8c6a('0x9'),_0x443b3b,_0x597202);_0x4b1585(_0x597202);});});}exports[_0x8c6a('0x14')]=function(_0xd29f97){var _0x58fc76=this;return new Promise(function(_0x24ec5c,_0x525ec0){return db[_0x8c6a('0x15')][_0x8c6a('0x16')](_0xd29f97[_0x8c6a('0x17')],{'raw':_0xd29f97['options']?_0xd29f97['options'][_0x8c6a('0x18')]===undefined?!![]:![]:!![]})[_0x8c6a('0x19')](function(_0x51b71c){logger[_0x8c6a('0x11')](_0x8c6a('0x14'),_0xd29f97);logger['debug'](_0x8c6a('0x14'),_0xd29f97,JSON[_0x8c6a('0xd')](_0x51b71c));_0x24ec5c(_0x51b71c);})[_0x8c6a('0x13')](function(_0x31624e){logger[_0x8c6a('0xe')](_0x8c6a('0x14'),_0x31624e['message'],_0xd29f97);_0x525ec0(_0x58fc76[_0x8c6a('0xe')](0x1f4,_0x31624e[_0x8c6a('0x10')]));});});}; \ No newline at end of file +var _0xaede=['rpc','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x50c7d7,_0x7a8e6b){var _0x565fb6=function(_0x19e848){while(--_0x19e848){_0x50c7d7['push'](_0x50c7d7['shift']());}};_0x565fb6(++_0x7a8e6b);}(_0xaede,0xf6));var _0xeaed=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xaede[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xeaed('0x0'));var util=require(_0xeaed('0x1'));var moment=require(_0xeaed('0x2'));var BPromise=require(_0xeaed('0x3'));var rs=require(_0xeaed('0x4'));var fs=require('fs');var Redis=require(_0xeaed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeaed('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeaed('0x7')][_0xeaed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40c431,_0x23350a,_0x4553ba){return new BPromise(function(_0x2c4710,_0x1245cf){return client[_0xeaed('0x9')](_0x40c431,_0x4553ba)[_0xeaed('0xa')](function(_0x164693){logger['info'](_0xeaed('0xb'),_0x23350a,_0xeaed('0xc'));logger[_0xeaed('0xd')](_0xeaed('0xe'),_0x23350a,_0xeaed('0xc'),JSON['stringify'](_0x164693));if(_0x164693['error']){if(_0x164693[_0xeaed('0xf')][_0xeaed('0x10')]===0x1f4){logger['error'](_0xeaed('0xb'),_0x23350a,_0x164693[_0xeaed('0xf')][_0xeaed('0x11')]);return _0x1245cf(_0x164693['error'][_0xeaed('0x11')]);}logger['error'](_0xeaed('0xb'),_0x23350a,_0x164693['error']['message']);return _0x2c4710(_0x164693[_0xeaed('0xf')][_0xeaed('0x11')]);}else{logger[_0xeaed('0x12')](_0xeaed('0xb'),_0x23350a,_0xeaed('0xc'));_0x2c4710(_0x164693[_0xeaed('0x13')][_0xeaed('0x11')]);}})[_0xeaed('0x14')](function(_0x8681a8){logger[_0xeaed('0xf')](_0xeaed('0xb'),_0x23350a,_0x8681a8);_0x1245cf(_0x8681a8);});});}exports[_0xeaed('0x15')]=function(_0x1f4337){var _0x5029ad=this;return new Promise(function(_0x2898cc,_0x47b9d6){return db[_0xeaed('0x16')][_0xeaed('0x17')](_0x1f4337[_0xeaed('0x18')],{'raw':_0x1f4337[_0xeaed('0x19')]?_0x1f4337[_0xeaed('0x19')][_0xeaed('0x1a')]===undefined?!![]:![]:!![]})[_0xeaed('0xa')](function(_0x568fd8){logger[_0xeaed('0x12')](_0xeaed('0x15'),_0x1f4337);logger['debug'](_0xeaed('0x15'),_0x1f4337,JSON[_0xeaed('0x1b')](_0x568fd8));_0x2898cc(_0x568fd8);})[_0xeaed('0x14')](function(_0x5cc31c){logger[_0xeaed('0xf')](_0xeaed('0x15'),_0x5cc31c[_0xeaed('0x11')],_0x1f4337);_0x47b9d6(_0x5029ad['error'](0x1f4,_0x5cc31c[_0xeaed('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 25634e7..315d488 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 _0xb84b=['put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create'];(function(_0x487cb0,_0x339d3e){var _0x5a8047=function(_0x2804a3){while(--_0x2804a3){_0x487cb0['push'](_0x487cb0['shift']());}};_0x5a8047(++_0x339d3e);}(_0xb84b,0x1e6));var _0xbb84=function(_0x35e9f8,_0x5368f4){_0x35e9f8=_0x35e9f8-0x0;var _0x2ca1e5=_0xb84b[_0x35e9f8];return _0x2ca1e5;};'use strict';var multer=require(_0xbb84('0x0'));var util=require(_0xbb84('0x1'));var path=require(_0xbb84('0x2'));var timeout=require(_0xbb84('0x3'));var express=require(_0xbb84('0x4'));var router=express[_0xbb84('0x5')]();var fs_extra=require(_0xbb84('0x6'));var auth=require(_0xbb84('0x7'));var interaction=require(_0xbb84('0x8'));var config=require(_0xbb84('0x9'));var controller=require(_0xbb84('0xa'));router[_0xbb84('0xb')]('/',auth[_0xbb84('0xc')](),controller[_0xbb84('0xd')]);router['get'](_0xbb84('0xe'),auth['isAuthenticated'](),controller[_0xbb84('0xf')]);router[_0xbb84('0xb')](_0xbb84('0x10'),auth[_0xbb84('0xc')](),timeout(_0xbb84('0x11')),controller[_0xbb84('0x12')]);router['post']('/',auth[_0xbb84('0xc')](),controller[_0xbb84('0x13')]);router[_0xbb84('0x14')]('/:id',auth[_0xbb84('0xc')](),controller['update']);router['delete'](_0xbb84('0xe'),auth[_0xbb84('0xc')](),controller[_0xbb84('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6bb4=['./squareOdbc.controller','get','index','/:id','/:id/test','15s','test','post','isAuthenticated','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x388899,_0x17f370){var _0x3be17d=function(_0x19ad17){while(--_0x19ad17){_0x388899['push'](_0x388899['shift']());}};_0x3be17d(++_0x17f370);}(_0x6bb4,0x13a));var _0x46bb=function(_0x5d5eab,_0x40e104){_0x5d5eab=_0x5d5eab-0x0;var _0x5133c7=_0x6bb4[_0x5d5eab];return _0x5133c7;};'use strict';var multer=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46bb('0x2'));var router=express[_0x46bb('0x3')]();var fs_extra=require(_0x46bb('0x4'));var auth=require(_0x46bb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x46bb('0x6'));router[_0x46bb('0x7')]('/',auth['isAuthenticated'](),controller[_0x46bb('0x8')]);router[_0x46bb('0x7')](_0x46bb('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x46bb('0x7')](_0x46bb('0xa'),auth['isAuthenticated'](),timeout(_0x46bb('0xb')),controller[_0x46bb('0xc')]);router[_0x46bb('0xd')]('/',auth[_0x46bb('0xe')](),controller[_0x46bb('0xf')]);router[_0x46bb('0x10')](_0x46bb('0x9'),auth[_0x46bb('0xe')](),controller[_0x46bb('0x11')]);router[_0x46bb('0x12')]('/:id',auth[_0x46bb('0xe')](),controller['destroy']);module[_0x46bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a653f3a..29771a8 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 _0x8d56=['STRING','exports'];(function(_0x5374c9,_0x5239e8){var _0x1f4e5e=function(_0x521086){while(--_0x521086){_0x5374c9['push'](_0x5374c9['shift']());}};_0x1f4e5e(++_0x5239e8);}(_0x8d56,0xa5));var _0x68d5=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x8d56[_0x214a25];return _0x405988;};'use strict';var Sequelize=require('sequelize');module[_0x68d5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x68d5('0x1')]}}; \ No newline at end of file +var _0x3e8f=['exports','STRING','name'];(function(_0x970ebd,_0x4c53e2){var _0xaafebf=function(_0x43c0df){while(--_0x43c0df){_0x970ebd['push'](_0x970ebd['shift']());}};_0xaafebf(++_0x4c53e2);}(_0x3e8f,0xcf));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf3e8('0x0')]={'name':{'type':Sequelize[_0xf3e8('0x1')],'unique':_0xf3e8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f6c8dbd..b5577f8 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 _0x214e=['attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','params','rawAttributes','fields','includeAll','create','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','get','ODBC','UserProfileResource','then','error','stack','name','send','index','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x20fa6b,_0xf36c43){var _0x18aca8=function(_0x50dc44){while(--_0x50dc44){_0x20fa6b['push'](_0x20fa6b['shift']());}};_0x18aca8(++_0xf36c43);}(_0x214e,0xbe));var _0xe214=function(_0x5aa554,_0x75d639){_0x5aa554=_0x5aa554-0x0;var _0x131832=_0x214e[_0x5aa554];return _0x131832;};'use strict';var emlformat=require(_0xe214('0x0'));var rimraf=require(_0xe214('0x1'));var zipdir=require(_0xe214('0x2'));var jsonpatch=require(_0xe214('0x3'));var rp=require(_0xe214('0x4'));var moment=require(_0xe214('0x5'));var BPromise=require(_0xe214('0x6'));var Mustache=require(_0xe214('0x7'));var util=require(_0xe214('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe214('0x9'));var ejs=require(_0xe214('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe214('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe214('0xc'));var deskjs=require(_0xe214('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe214('0xe'));var Papa=require(_0xe214('0xf'));var Redis=require(_0xe214('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe214('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe214('0x12'))('api');var utils=require(_0xe214('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3055b0,_0x58eb7d){_0x58eb7d=_0x58eb7d||0xcc;return function(_0x311c3b){if(_0x311c3b){return _0x3055b0['sendStatus'](_0x58eb7d);}return _0x3055b0[_0xe214('0x14')](_0x58eb7d)['end']();};}function respondWithResult(_0x164284,_0x2d868a){_0x2d868a=_0x2d868a||0xc8;return function(_0x2f0aa4){if(_0x2f0aa4){return _0x164284[_0xe214('0x14')](_0x2d868a)[_0xe214('0x15')](_0x2f0aa4);}};}function respondWithFilteredResult(_0x4f4d5c,_0x19b2f6){return function(_0x25fbf2){if(_0x25fbf2){var _0x506ccf=typeof _0x19b2f6['offset']===_0xe214('0x16')&&typeof _0x19b2f6[_0xe214('0x17')]===_0xe214('0x16');var _0x532fcb=_0x25fbf2['count'];var _0x3e6682=_0x506ccf?0x0:_0x19b2f6[_0xe214('0x18')];var _0x19f598=_0x506ccf?_0x25fbf2[_0xe214('0x19')]:_0x19b2f6[_0xe214('0x18')]+_0x19b2f6[_0xe214('0x17')];var _0x31d591;if(_0x19f598>=_0x532fcb){_0x19f598=_0x532fcb;_0x31d591=0xc8;}else{_0x31d591=0xce;}_0x4f4d5c[_0xe214('0x14')](_0x31d591);return _0x4f4d5c[_0xe214('0x1a')](_0xe214('0x1b'),_0x3e6682+'-'+_0x19f598+'/'+_0x532fcb)[_0xe214('0x15')](_0x25fbf2);}return null;};}function patchUpdates(_0x306f56){return function(_0x7ccbea){try{jsonpatch[_0xe214('0x1c')](_0x7ccbea,_0x306f56,!![]);}catch(_0x4b84c2){return BPromise[_0xe214('0x1d')](_0x4b84c2);}return _0x7ccbea[_0xe214('0x1e')]();};}function saveUpdates(_0xcacea2,_0x2686ae){return function(_0x48ec08){if(_0x48ec08){return _0x48ec08['update'](_0xcacea2)['then'](function(_0x1e40aa){return _0x1e40aa;});}return null;};}function removeEntity(_0x4c1b63,_0x5ebf4a){return function(_0x58cbd4){if(_0x58cbd4){return _0x58cbd4[_0xe214('0x1f')]()['then'](function(){var _0x357e0b=_0x58cbd4[_0xe214('0x20')]({'plain':!![]});var _0x745f53=_0xe214('0x21');return db[_0xe214('0x22')]['destroy']({'where':{'type':_0x745f53,'resourceId':_0x357e0b['id']}})[_0xe214('0x23')](function(){return _0x58cbd4;});})[_0xe214('0x23')](function(){_0x4c1b63[_0xe214('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8e83,_0x3d23db){return function(_0x255ba6){if(!_0x255ba6){_0x1f8e83['sendStatus'](0x194);}return _0x255ba6;};}function handleError(_0x4258c4,_0x4d072e){_0x4d072e=_0x4d072e||0x1f4;return function(_0x3498ff){logger[_0xe214('0x24')](_0x3498ff[_0xe214('0x25')]);if(_0x3498ff[_0xe214('0x26')]){delete _0x3498ff[_0xe214('0x26')];}_0x4258c4[_0xe214('0x14')](_0x4d072e)[_0xe214('0x27')](_0x3498ff);};}exports[_0xe214('0x28')]=function(_0x7dc70,_0x235569){var _0x1324a0={},_0x5d92c0={},_0x416f27={'count':0x0,'rows':[]};var _0x10601b=_['map'](db[_0xe214('0x29')]['rawAttributes'],function(_0x5b2f6e){return{'name':_0x5b2f6e[_0xe214('0x2a')],'type':_0x5b2f6e[_0xe214('0x2b')][_0xe214('0x2c')]};});_0x5d92c0[_0xe214('0x2d')]=_['map'](_0x10601b,_0xe214('0x26'));_0x5d92c0[_0xe214('0x2e')]=_[_0xe214('0x2f')](_0x7dc70[_0xe214('0x2e')]);_0x5d92c0[_0xe214('0x30')]=_[_0xe214('0x31')](_0x5d92c0[_0xe214('0x2d')],_0x5d92c0[_0xe214('0x2e')]);_0x1324a0[_0xe214('0x32')]=_['intersection'](_0x5d92c0[_0xe214('0x2d')],qs['fields'](_0x7dc70['query']['fields']));_0x1324a0[_0xe214('0x32')]=_0x1324a0[_0xe214('0x32')][_0xe214('0x33')]?_0x1324a0['attributes']:_0x5d92c0[_0xe214('0x2d')];if(!_0x7dc70[_0xe214('0x2e')]['hasOwnProperty'](_0xe214('0x34'))){_0x1324a0[_0xe214('0x17')]=qs[_0xe214('0x17')](_0x7dc70['query'][_0xe214('0x17')]);_0x1324a0[_0xe214('0x18')]=qs[_0xe214('0x18')](_0x7dc70['query'][_0xe214('0x18')]);}_0x1324a0[_0xe214('0x35')]=qs[_0xe214('0x36')](_0x7dc70[_0xe214('0x2e')]['sort']);_0x1324a0['where']=qs[_0xe214('0x30')](_[_0xe214('0x37')](_0x7dc70[_0xe214('0x2e')],_0x5d92c0['filters']),_0x10601b);if(_0x7dc70[_0xe214('0x2e')][_0xe214('0x38')]){_0x1324a0[_0xe214('0x39')]=_['merge'](_0x1324a0[_0xe214('0x39')],{'$or':_['map'](_0x10601b,function(_0x57d799){if(_0x57d799[_0xe214('0x2b')]!==_0xe214('0x3a')){var _0x387553={};_0x387553[_0x57d799[_0xe214('0x26')]]={'$like':'%'+_0x7dc70[_0xe214('0x2e')]['filter']+'%'};return _0x387553;}})});}_0x1324a0=_[_0xe214('0x3b')]({},_0x1324a0,_0x7dc70[_0xe214('0x3c')]);var _0x1cf7b6={'where':_0x1324a0[_0xe214('0x39')]};return db[_0xe214('0x29')]['count'](_0x1cf7b6)[_0xe214('0x23')](function(_0x5bf701){_0x416f27[_0xe214('0x19')]=_0x5bf701;if(_0x7dc70[_0xe214('0x2e')]['includeAll']){_0x1324a0[_0xe214('0x3d')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x1324a0);})[_0xe214('0x23')](function(_0x1dcbf8){_0x416f27[_0xe214('0x3e')]=_0x1dcbf8;return _0x416f27;})['then'](respondWithFilteredResult(_0x235569,_0x1324a0))[_0xe214('0x3f')](handleError(_0x235569,null));};exports['show']=function(_0x103009,_0x5a0393){var _0x5ad08d={'raw':!![],'where':{'id':_0x103009[_0xe214('0x40')]['id']}},_0x4ee518={};_0x4ee518['model']=_[_0xe214('0x2f')](db['SquareOdbc'][_0xe214('0x41')]);_0x4ee518[_0xe214('0x2e')]=_[_0xe214('0x2f')](_0x103009[_0xe214('0x2e')]);_0x4ee518['filters']=_[_0xe214('0x31')](_0x4ee518['model'],_0x4ee518[_0xe214('0x2e')]);_0x5ad08d[_0xe214('0x32')]=_[_0xe214('0x31')](_0x4ee518[_0xe214('0x2d')],qs[_0xe214('0x42')](_0x103009[_0xe214('0x2e')]['fields']));_0x5ad08d[_0xe214('0x32')]=_0x5ad08d['attributes'][_0xe214('0x33')]?_0x5ad08d[_0xe214('0x32')]:_0x4ee518[_0xe214('0x2d')];if(_0x103009['query'][_0xe214('0x43')]){_0x5ad08d[_0xe214('0x3d')]=[{'all':!![]}];}_0x5ad08d=_[_0xe214('0x3b')]({},_0x5ad08d,_0x103009[_0xe214('0x3c')]);return db['SquareOdbc']['find'](_0x5ad08d)[_0xe214('0x23')](handleEntityNotFound(_0x5a0393,null))['then'](respondWithResult(_0x5a0393,null))[_0xe214('0x3f')](handleError(_0x5a0393,null));};exports[_0xe214('0x44')]=function(_0x4f6ace,_0x9b14d2){return db[_0xe214('0x29')][_0xe214('0x44')](_0x4f6ace['body'],{})[_0xe214('0x23')](function(_0x5f2ccd){var _0x286036=_0x4f6ace[_0xe214('0x45')][_0xe214('0x20')]({'plain':!![]});if(!_0x286036)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x286036[_0xe214('0x46')]===_0xe214('0x45')){var _0x3b91ae=_0x5f2ccd[_0xe214('0x20')]({'plain':!![]});var _0x5b8656=_0xe214('0x21');return db['UserProfileSection'][_0xe214('0x47')]({'where':{'name':_0x5b8656,'userProfileId':_0x286036[_0xe214('0x48')]},'raw':!![]})[_0xe214('0x23')](function(_0xa0c75b){if(_0xa0c75b&&_0xa0c75b['autoAssociation']===0x0){return db[_0xe214('0x22')]['create']({'name':_0x3b91ae[_0xe214('0x26')],'resourceId':_0x3b91ae['id'],'type':_0xa0c75b[_0xe214('0x26')],'sectionId':_0xa0c75b['id']},{})[_0xe214('0x23')](function(){return _0x5f2ccd;});}else{return _0x5f2ccd;}})[_0xe214('0x3f')](function(_0x25207a){logger[_0xe214('0x24')](_0xe214('0x49'),_0x25207a);throw _0x25207a;});}return _0x5f2ccd;})[_0xe214('0x23')](respondWithResult(_0x9b14d2,0xc9))[_0xe214('0x3f')](handleError(_0x9b14d2,null));};exports['update']=function(_0x4a55e0,_0x503ef4){if(_0x4a55e0[_0xe214('0x4a')]['id']){delete _0x4a55e0[_0xe214('0x4a')]['id'];}return db[_0xe214('0x29')][_0xe214('0x47')]({'where':{'id':_0x4a55e0[_0xe214('0x40')]['id']}})[_0xe214('0x23')](handleEntityNotFound(_0x503ef4,null))['then'](saveUpdates(_0x4a55e0[_0xe214('0x4a')],null))[_0xe214('0x23')](respondWithResult(_0x503ef4,null))[_0xe214('0x3f')](handleError(_0x503ef4,null));};exports['destroy']=function(_0x142682,_0x389c25){return db['SquareOdbc']['find']({'where':{'id':_0x142682[_0xe214('0x40')]['id']}})[_0xe214('0x23')](handleEntityNotFound(_0x389c25,null))[_0xe214('0x23')](removeEntity(_0x389c25,null))[_0xe214('0x3f')](handleError(_0x389c25,null));};exports[_0xe214('0x4b')]=function(_0x1e95d5,_0x33a46e,_0x4c24c8){var _0x3890bd;return db[_0xe214('0x29')][_0xe214('0x47')]({'where':{'id':_0x1e95d5[_0xe214('0x40')]['id']},'attributes':['id',_0xe214('0x4c')]})[_0xe214('0x23')](handleEntityNotFound(_0x33a46e,null))['then'](function(_0x1c7ec5){if(_0x1c7ec5){var _0x13579d=require(_0xe214('0x4d'))();_0x13579d[_0xe214('0x4e')](_0x1c7ec5['dsn']);_0x13579d[_0xe214('0x4f')]();return _0x1c7ec5;}})['then'](respondWithResult(_0x33a46e,null))[_0xe214('0x3f')](handleError(_0x33a46e,null));}; \ No newline at end of file +var _0xfca4=['VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','type'];(function(_0x9ce749,_0x38b8cf){var _0x3d2c62=function(_0x58d630){while(--_0x58d630){_0x9ce749['push'](_0x9ce749['shift']());}};_0x3d2c62(++_0x38b8cf);}(_0xfca4,0x17d));var _0x4fca=function(_0x51fd26,_0x3a5973){_0x51fd26=_0x51fd26-0x0;var _0x4c333f=_0xfca4[_0x51fd26];return _0x4c333f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fca('0x0'));var zipdir=require(_0x4fca('0x1'));var jsonpatch=require(_0x4fca('0x2'));var rp=require(_0x4fca('0x3'));var moment=require(_0x4fca('0x4'));var BPromise=require(_0x4fca('0x5'));var Mustache=require(_0x4fca('0x6'));var util=require(_0x4fca('0x7'));var path=require(_0x4fca('0x8'));var sox=require(_0x4fca('0x9'));var csv=require(_0x4fca('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fca('0xb'));var _=require(_0x4fca('0xc'));var squel=require(_0x4fca('0xd'));var crypto=require(_0x4fca('0xe'));var jsforce=require(_0x4fca('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4fca('0xa'));var querystring=require('querystring');var Papa=require(_0x4fca('0x10'));var Redis=require(_0x4fca('0x11'));var authService=require(_0x4fca('0x12'));var qs=require(_0x4fca('0x13'));var as=require(_0x4fca('0x14'));var hardwareService=require(_0x4fca('0x15'));var logger=require(_0x4fca('0x16'))(_0x4fca('0x17'));var utils=require(_0x4fca('0x18'));var config=require(_0x4fca('0x19'));var licenseUtil=require(_0x4fca('0x1a'));var db=require(_0x4fca('0x1b'))['db'];function respondWithStatusCode(_0x1d9ef1,_0xc8650c){_0xc8650c=_0xc8650c||0xcc;return function(_0x303d21){if(_0x303d21){return _0x1d9ef1['sendStatus'](_0xc8650c);}return _0x1d9ef1[_0x4fca('0x1c')](_0xc8650c)[_0x4fca('0x1d')]();};}function respondWithResult(_0x4ec7ed,_0x1d381d){_0x1d381d=_0x1d381d||0xc8;return function(_0xee1f97){if(_0xee1f97){return _0x4ec7ed[_0x4fca('0x1c')](_0x1d381d)[_0x4fca('0x1e')](_0xee1f97);}};}function respondWithFilteredResult(_0x208eec,_0x51aa8a){return function(_0x295b14){if(_0x295b14){var _0x496409=typeof _0x51aa8a[_0x4fca('0x1f')]===_0x4fca('0x20')&&typeof _0x51aa8a[_0x4fca('0x21')]==='undefined';var _0x4d9143=_0x295b14['count'];var _0x8408dd=_0x496409?0x0:_0x51aa8a['offset'];var _0x46f228=_0x496409?_0x295b14[_0x4fca('0x22')]:_0x51aa8a['offset']+_0x51aa8a[_0x4fca('0x21')];var _0x474d93;if(_0x46f228>=_0x4d9143){_0x46f228=_0x4d9143;_0x474d93=0xc8;}else{_0x474d93=0xce;}_0x208eec['status'](_0x474d93);return _0x208eec[_0x4fca('0x23')](_0x4fca('0x24'),_0x8408dd+'-'+_0x46f228+'/'+_0x4d9143)[_0x4fca('0x1e')](_0x295b14);}return null;};}function patchUpdates(_0x22cace){return function(_0x21a03a){try{jsonpatch[_0x4fca('0x25')](_0x21a03a,_0x22cace,!![]);}catch(_0x4a02e4){return BPromise[_0x4fca('0x26')](_0x4a02e4);}return _0x21a03a[_0x4fca('0x27')]();};}function saveUpdates(_0x210c95,_0x37e4e7){return function(_0x338bcd){if(_0x338bcd){return _0x338bcd[_0x4fca('0x28')](_0x210c95)[_0x4fca('0x29')](function(_0x35d729){return _0x35d729;});}return null;};}function removeEntity(_0x4c1d55,_0x1e8c28){return function(_0x38d41d){if(_0x38d41d){return _0x38d41d[_0x4fca('0x2a')]()[_0x4fca('0x29')](function(){var _0x25715b=_0x38d41d[_0x4fca('0x2b')]({'plain':!![]});var _0x60b56=_0x4fca('0x2c');return db[_0x4fca('0x2d')]['destroy']({'where':{'type':_0x60b56,'resourceId':_0x25715b['id']}})[_0x4fca('0x29')](function(){return _0x38d41d;});})[_0x4fca('0x29')](function(){_0x4c1d55[_0x4fca('0x1c')](0xcc)[_0x4fca('0x1d')]();});}};}function handleEntityNotFound(_0x38c32e,_0x345074){return function(_0x39334b){if(!_0x39334b){_0x38c32e['sendStatus'](0x194);}return _0x39334b;};}function handleError(_0x29e797,_0x4c3870){_0x4c3870=_0x4c3870||0x1f4;return function(_0x257a27){logger[_0x4fca('0x2e')](_0x257a27[_0x4fca('0x2f')]);if(_0x257a27['name']){delete _0x257a27[_0x4fca('0x30')];}_0x29e797[_0x4fca('0x1c')](_0x4c3870)[_0x4fca('0x31')](_0x257a27);};}exports[_0x4fca('0x32')]=function(_0x379e67,_0x282cdb){var _0x3ecd20={},_0x5d825a={},_0x5d1bfa={'count':0x0,'rows':[]};var _0x2f65d4=_['map'](db[_0x4fca('0x33')][_0x4fca('0x34')],function(_0xbe4225){return{'name':_0xbe4225[_0x4fca('0x35')],'type':_0xbe4225['type']['key']};});_0x5d825a['model']=_[_0x4fca('0x36')](_0x2f65d4,_0x4fca('0x30'));_0x5d825a['query']=_['keys'](_0x379e67[_0x4fca('0x37')]);_0x5d825a[_0x4fca('0x38')]=_[_0x4fca('0x39')](_0x5d825a['model'],_0x5d825a[_0x4fca('0x37')]);_0x3ecd20[_0x4fca('0x3a')]=_[_0x4fca('0x39')](_0x5d825a[_0x4fca('0x3b')],qs[_0x4fca('0x3c')](_0x379e67['query'][_0x4fca('0x3c')]));_0x3ecd20[_0x4fca('0x3a')]=_0x3ecd20[_0x4fca('0x3a')][_0x4fca('0x3d')]?_0x3ecd20[_0x4fca('0x3a')]:_0x5d825a[_0x4fca('0x3b')];if(!_0x379e67[_0x4fca('0x37')]['hasOwnProperty'](_0x4fca('0x3e'))){_0x3ecd20[_0x4fca('0x21')]=qs[_0x4fca('0x21')](_0x379e67[_0x4fca('0x37')][_0x4fca('0x21')]);_0x3ecd20[_0x4fca('0x1f')]=qs[_0x4fca('0x1f')](_0x379e67[_0x4fca('0x37')][_0x4fca('0x1f')]);}_0x3ecd20[_0x4fca('0x3f')]=qs[_0x4fca('0x40')](_0x379e67[_0x4fca('0x37')][_0x4fca('0x40')]);_0x3ecd20[_0x4fca('0x41')]=qs[_0x4fca('0x38')](_[_0x4fca('0x42')](_0x379e67[_0x4fca('0x37')],_0x5d825a[_0x4fca('0x38')]),_0x2f65d4);if(_0x379e67[_0x4fca('0x37')][_0x4fca('0x43')]){_0x3ecd20[_0x4fca('0x41')]=_['merge'](_0x3ecd20['where'],{'$or':_[_0x4fca('0x36')](_0x2f65d4,function(_0x249083){if(_0x249083[_0x4fca('0x44')]!==_0x4fca('0x45')){var _0x5ee7d3={};_0x5ee7d3[_0x249083[_0x4fca('0x30')]]={'$like':'%'+_0x379e67[_0x4fca('0x37')][_0x4fca('0x43')]+'%'};return _0x5ee7d3;}})});}_0x3ecd20=_[_0x4fca('0x46')]({},_0x3ecd20,_0x379e67[_0x4fca('0x47')]);var _0x12231c={'where':_0x3ecd20[_0x4fca('0x41')]};return db[_0x4fca('0x33')][_0x4fca('0x22')](_0x12231c)['then'](function(_0xef30b2){_0x5d1bfa[_0x4fca('0x22')]=_0xef30b2;if(_0x379e67[_0x4fca('0x37')][_0x4fca('0x48')]){_0x3ecd20[_0x4fca('0x49')]=[{'all':!![]}];}return db[_0x4fca('0x33')][_0x4fca('0x4a')](_0x3ecd20);})[_0x4fca('0x29')](function(_0x4e5c79){_0x5d1bfa[_0x4fca('0x4b')]=_0x4e5c79;return _0x5d1bfa;})[_0x4fca('0x29')](respondWithFilteredResult(_0x282cdb,_0x3ecd20))[_0x4fca('0x4c')](handleError(_0x282cdb,null));};exports['show']=function(_0x569920,_0x2c5661){var _0x541100={'raw':!![],'where':{'id':_0x569920[_0x4fca('0x4d')]['id']}},_0x207ea9={};_0x207ea9['model']=_[_0x4fca('0x4e')](db[_0x4fca('0x33')][_0x4fca('0x34')]);_0x207ea9[_0x4fca('0x37')]=_['keys'](_0x569920['query']);_0x207ea9[_0x4fca('0x38')]=_[_0x4fca('0x39')](_0x207ea9[_0x4fca('0x3b')],_0x207ea9[_0x4fca('0x37')]);_0x541100[_0x4fca('0x3a')]=_['intersection'](_0x207ea9[_0x4fca('0x3b')],qs['fields'](_0x569920[_0x4fca('0x37')][_0x4fca('0x3c')]));_0x541100[_0x4fca('0x3a')]=_0x541100[_0x4fca('0x3a')][_0x4fca('0x3d')]?_0x541100[_0x4fca('0x3a')]:_0x207ea9['model'];if(_0x569920['query'][_0x4fca('0x48')]){_0x541100[_0x4fca('0x49')]=[{'all':!![]}];}_0x541100=_[_0x4fca('0x46')]({},_0x541100,_0x569920['options']);return db[_0x4fca('0x33')][_0x4fca('0x4f')](_0x541100)[_0x4fca('0x29')](handleEntityNotFound(_0x2c5661,null))['then'](respondWithResult(_0x2c5661,null))['catch'](handleError(_0x2c5661,null));};exports[_0x4fca('0x50')]=function(_0x49f5bb,_0x3c943f){return db[_0x4fca('0x33')][_0x4fca('0x50')](_0x49f5bb[_0x4fca('0x51')],{})[_0x4fca('0x29')](function(_0x26fc4c){var _0x5585dc=_0x49f5bb[_0x4fca('0x52')]['get']({'plain':!![]});if(!_0x5585dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5585dc[_0x4fca('0x53')]===_0x4fca('0x52')){var _0x244b93=_0x26fc4c[_0x4fca('0x2b')]({'plain':!![]});var _0x3f425d=_0x4fca('0x2c');return db[_0x4fca('0x54')][_0x4fca('0x4f')]({'where':{'name':_0x3f425d,'userProfileId':_0x5585dc['userProfileId']},'raw':!![]})[_0x4fca('0x29')](function(_0xb081da){if(_0xb081da&&_0xb081da['autoAssociation']===0x0){return db[_0x4fca('0x2d')][_0x4fca('0x50')]({'name':_0x244b93['name'],'resourceId':_0x244b93['id'],'type':_0xb081da['name'],'sectionId':_0xb081da['id']},{})[_0x4fca('0x29')](function(){return _0x26fc4c;});}else{return _0x26fc4c;}})['catch'](function(_0x503d04){logger[_0x4fca('0x2e')](_0x4fca('0x55'),_0x503d04);throw _0x503d04;});}return _0x26fc4c;})[_0x4fca('0x29')](respondWithResult(_0x3c943f,0xc9))[_0x4fca('0x4c')](handleError(_0x3c943f,null));};exports['update']=function(_0x2d49bc,_0x3b55cc){if(_0x2d49bc['body']['id']){delete _0x2d49bc[_0x4fca('0x51')]['id'];}return db[_0x4fca('0x33')][_0x4fca('0x4f')]({'where':{'id':_0x2d49bc[_0x4fca('0x4d')]['id']}})[_0x4fca('0x29')](handleEntityNotFound(_0x3b55cc,null))[_0x4fca('0x29')](saveUpdates(_0x2d49bc[_0x4fca('0x51')],null))[_0x4fca('0x29')](respondWithResult(_0x3b55cc,null))[_0x4fca('0x4c')](handleError(_0x3b55cc,null));};exports[_0x4fca('0x2a')]=function(_0x4ab093,_0x72cd79){return db['SquareOdbc'][_0x4fca('0x4f')]({'where':{'id':_0x4ab093[_0x4fca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x72cd79,null))[_0x4fca('0x29')](removeEntity(_0x72cd79,null))[_0x4fca('0x4c')](handleError(_0x72cd79,null));};exports['test']=function(_0x40a2cc,_0x44100b,_0x221ca8){var _0x552601;return db[_0x4fca('0x33')]['find']({'where':{'id':_0x40a2cc['params']['id']},'attributes':['id',_0x4fca('0x56')]})[_0x4fca('0x29')](handleEntityNotFound(_0x44100b,null))[_0x4fca('0x29')](function(_0x3cc87f){if(_0x3cc87f){var _0x57117e=require(_0x4fca('0x57'))();_0x57117e[_0x4fca('0x58')](_0x3cc87f[_0x4fca('0x56')]);_0x57117e[_0x4fca('0x59')]();return _0x3cc87f;}})['then'](respondWithResult(_0x44100b,null))[_0x4fca('0x4c')](handleError(_0x44100b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b358217..9ad3ecf 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 _0x4f2e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger'];(function(_0x13afe7,_0x31e4ea){var _0xee18b8=function(_0x322a8c){while(--_0x322a8c){_0x13afe7['push'](_0x13afe7['shift']());}};_0xee18b8(++_0x31e4ea);}(_0x4f2e,0xa6));var _0xe4f2=function(_0x247e3f,_0x454aec){_0x247e3f=_0x247e3f-0x0;var _0x3e261f=_0x4f2e[_0x247e3f];return _0x3e261f;};'use strict';var _=require(_0xe4f2('0x0'));var util=require(_0xe4f2('0x1'));var logger=require(_0xe4f2('0x2'))('api');var moment=require(_0xe4f2('0x3'));var BPromise=require(_0xe4f2('0x4'));var rp=require(_0xe4f2('0x5'));var fs=require('fs');var path=require(_0xe4f2('0x6'));var rimraf=require(_0xe4f2('0x7'));var config=require(_0xe4f2('0x8'));var attributes=require(_0xe4f2('0x9'));module[_0xe4f2('0xa')]=function(_0x1920ec,_0x5b3eb5){return _0x1920ec[_0xe4f2('0xb')]('SquareOdbc',attributes,{'tableName':_0xe4f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9911=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0x5c1174,_0x14d4fe){var _0x53e2aa=function(_0x2505b1){while(--_0x2505b1){_0x5c1174['push'](_0x5c1174['shift']());}};_0x53e2aa(++_0x14d4fe);}(_0x9911,0x16c));var _0x1991=function(_0x259383,_0x3e0d1d){_0x259383=_0x259383-0x0;var _0x1fd349=_0x9911[_0x259383];return _0x1fd349;};'use strict';var _=require(_0x1991('0x0'));var util=require(_0x1991('0x1'));var logger=require(_0x1991('0x2'))(_0x1991('0x3'));var moment=require(_0x1991('0x4'));var BPromise=require(_0x1991('0x5'));var rp=require(_0x1991('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1991('0x7'));var config=require(_0x1991('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x1991('0x9')]=function(_0x58a3f2,_0x36cd10){return _0x58a3f2[_0x1991('0xa')](_0x1991('0xb'),attributes,{'tableName':_0x1991('0xc'),'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 048358f..7e60a6a 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 _0x30ec=['info','result','catch','ShowSquareOdbc','SquareOdbc','options','where','map','include','model','attributes','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x30ec,0xcd));var _0xc30e=function(_0x56b6d5,_0x388f95){_0x56b6d5=_0x56b6d5-0x0;var _0x2fb790=_0x30ec[_0x56b6d5];return _0x2fb790;};'use strict';var _=require(_0xc30e('0x0'));var util=require(_0xc30e('0x1'));var moment=require(_0xc30e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc30e('0x3'));var fs=require('fs');var Redis=require(_0xc30e('0x4'));var db=require(_0xc30e('0x5'))['db'];var utils=require(_0xc30e('0x6'));var logger=require(_0xc30e('0x7'))('rpc');var config=require(_0xc30e('0x8'));var jayson=require(_0xc30e('0x9'));var client=jayson[_0xc30e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaf870e,_0x30fe5b,_0x140879){return new BPromise(function(_0xf86a93,_0xd6e63){return client[_0xc30e('0xb')](_0xaf870e,_0x140879)['then'](function(_0x2ff0b9){logger['info'](_0xc30e('0xc'),_0x30fe5b,_0xc30e('0xd'));logger[_0xc30e('0xe')](_0xc30e('0xf'),_0x30fe5b,_0xc30e('0xd'),JSON['stringify'](_0x2ff0b9));if(_0x2ff0b9[_0xc30e('0x10')]){if(_0x2ff0b9[_0xc30e('0x10')][_0xc30e('0x11')]===0x1f4){logger[_0xc30e('0x10')](_0xc30e('0xc'),_0x30fe5b,_0x2ff0b9[_0xc30e('0x10')][_0xc30e('0x12')]);return _0xd6e63(_0x2ff0b9[_0xc30e('0x10')][_0xc30e('0x12')]);}logger[_0xc30e('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x30fe5b,_0x2ff0b9['error']['message']);return _0xf86a93(_0x2ff0b9[_0xc30e('0x10')]['message']);}else{logger[_0xc30e('0x13')](_0xc30e('0xc'),_0x30fe5b,_0xc30e('0xd'));_0xf86a93(_0x2ff0b9[_0xc30e('0x14')][_0xc30e('0x12')]);}})[_0xc30e('0x15')](function(_0xf5eb65){logger[_0xc30e('0x10')](_0xc30e('0xc'),_0x30fe5b,_0xf5eb65);_0xd6e63(_0xf5eb65);});});}exports[_0xc30e('0x16')]=function(_0x1bcf1d){var _0x48548e=this;return new Promise(function(_0x548424,_0x20c284){return db[_0xc30e('0x17')]['find']({'raw':_0x1bcf1d['options']?_0x1bcf1d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1bcf1d[_0xc30e('0x18')]?_0x1bcf1d[_0xc30e('0x18')][_0xc30e('0x19')]||null:null,'attributes':_0x1bcf1d['options']?_0x1bcf1d['options']['attributes']||null:null,'include':_0x1bcf1d['options']?_0x1bcf1d[_0xc30e('0x18')]['include']?_[_0xc30e('0x1a')](_0x1bcf1d[_0xc30e('0x18')][_0xc30e('0x1b')],function(_0x56fdf4){return{'model':db[_0x56fdf4[_0xc30e('0x1c')]],'as':_0x56fdf4['as'],'attributes':_0x56fdf4[_0xc30e('0x1d')],'include':_0x56fdf4[_0xc30e('0x1b')]?_[_0xc30e('0x1a')](_0x56fdf4[_0xc30e('0x1b')],function(_0x2b7ab6){return{'model':db[_0x2b7ab6[_0xc30e('0x1c')]],'as':_0x2b7ab6['as'],'attributes':_0x2b7ab6['attributes'],'include':_0x2b7ab6[_0xc30e('0x1b')]?_[_0xc30e('0x1a')](_0x2b7ab6['include'],function(_0x5b808a){return{'model':db[_0x5b808a['model']],'as':_0x5b808a['as'],'attributes':_0x5b808a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc30e('0x1e')](function(_0xd0a922){logger[_0xc30e('0x13')](_0xc30e('0x16'),_0x1bcf1d);logger[_0xc30e('0xe')](_0xc30e('0x16'),_0x1bcf1d,JSON[_0xc30e('0x1f')](_0xd0a922));_0x548424(_0xd0a922);})[_0xc30e('0x15')](function(_0x3e32d1){logger['error'](_0xc30e('0x16'),_0x3e32d1[_0xc30e('0x12')],_0x1bcf1d);_0x20c284(_0x48548e['error'](0x1f4,_0x3e32d1[_0xc30e('0x12')]));});});}; \ No newline at end of file +var _0x1382=['SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ec49a,_0x56630d){var _0x48ee2d=function(_0x16b363){while(--_0x16b363){_0x1ec49a['push'](_0x1ec49a['shift']());}};_0x48ee2d(++_0x56630d);}(_0x1382,0x109));var _0x2138=function(_0x4047c3,_0x512c12){_0x4047c3=_0x4047c3-0x0;var _0x44dec9=_0x1382[_0x4047c3];return _0x44dec9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2138('0x0'));var BPromise=require('bluebird');var rs=require(_0x2138('0x1'));var fs=require('fs');var Redis=require(_0x2138('0x2'));var db=require(_0x2138('0x3'))['db'];var utils=require(_0x2138('0x4'));var logger=require(_0x2138('0x5'))(_0x2138('0x6'));var config=require(_0x2138('0x7'));var jayson=require(_0x2138('0x8'));var client=jayson['client'][_0x2138('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539e92,_0xa16a66,_0x2262cf){return new BPromise(function(_0x4db7ba,_0x7d8ebf){return client['request'](_0x539e92,_0x2262cf)[_0x2138('0xa')](function(_0x4abdcb){logger['info'](_0x2138('0xb'),_0xa16a66,_0x2138('0xc'));logger[_0x2138('0xd')](_0x2138('0xe'),_0xa16a66,'request\x20sent',JSON['stringify'](_0x4abdcb));if(_0x4abdcb[_0x2138('0xf')]){if(_0x4abdcb[_0x2138('0xf')][_0x2138('0x10')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xa16a66,_0x4abdcb[_0x2138('0xf')]['message']);return _0x7d8ebf(_0x4abdcb[_0x2138('0xf')]['message']);}logger['error'](_0x2138('0xb'),_0xa16a66,_0x4abdcb[_0x2138('0xf')][_0x2138('0x11')]);return _0x4db7ba(_0x4abdcb[_0x2138('0xf')][_0x2138('0x11')]);}else{logger[_0x2138('0x12')](_0x2138('0xb'),_0xa16a66,'request\x20sent');_0x4db7ba(_0x4abdcb[_0x2138('0x13')][_0x2138('0x11')]);}})['catch'](function(_0x2bb864){logger[_0x2138('0xf')](_0x2138('0xb'),_0xa16a66,_0x2bb864);_0x7d8ebf(_0x2bb864);});});}exports[_0x2138('0x14')]=function(_0x4b60ce){var _0x3fc28a=this;return new Promise(function(_0x109abd,_0x4c0672){return db[_0x2138('0x15')][_0x2138('0x16')]({'raw':_0x4b60ce[_0x2138('0x17')]?_0x4b60ce[_0x2138('0x17')][_0x2138('0x18')]===undefined?!![]:![]:!![],'where':_0x4b60ce[_0x2138('0x17')]?_0x4b60ce[_0x2138('0x17')][_0x2138('0x19')]||null:null,'attributes':_0x4b60ce['options']?_0x4b60ce[_0x2138('0x17')][_0x2138('0x1a')]||null:null,'include':_0x4b60ce[_0x2138('0x17')]?_0x4b60ce[_0x2138('0x17')][_0x2138('0x1b')]?_[_0x2138('0x1c')](_0x4b60ce['options']['include'],function(_0x527169){return{'model':db[_0x527169[_0x2138('0x1d')]],'as':_0x527169['as'],'attributes':_0x527169[_0x2138('0x1a')],'include':_0x527169[_0x2138('0x1b')]?_[_0x2138('0x1c')](_0x527169[_0x2138('0x1b')],function(_0x5e5ed5){return{'model':db[_0x5e5ed5[_0x2138('0x1d')]],'as':_0x5e5ed5['as'],'attributes':_0x5e5ed5[_0x2138('0x1a')],'include':_0x5e5ed5[_0x2138('0x1b')]?_[_0x2138('0x1c')](_0x5e5ed5[_0x2138('0x1b')],function(_0x41c2ef){return{'model':db[_0x41c2ef[_0x2138('0x1d')]],'as':_0x41c2ef['as'],'attributes':_0x41c2ef[_0x2138('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3788f0){logger[_0x2138('0x12')](_0x2138('0x14'),_0x4b60ce);logger[_0x2138('0xd')]('ShowSquareOdbc',_0x4b60ce,JSON[_0x2138('0x1e')](_0x3788f0));_0x109abd(_0x3788f0);})['catch'](function(_0x205633){logger['error'](_0x2138('0x14'),_0x205633['message'],_0x4b60ce);_0x4c0672(_0x3fc28a[_0x2138('0xf')](0x1f4,_0x205633[_0x2138('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 59f6ccd..8bfc950 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 _0x4afa=['put','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','post'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4afa,0xef));var _0xa4af=function(_0x2f1066,_0x57e70){_0x2f1066=_0x2f1066-0x0;var _0x1ee599=_0x4afa[_0x2f1066];return _0x1ee599;};'use strict';var multer=require(_0xa4af('0x0'));var util=require(_0xa4af('0x1'));var path=require('path');var timeout=require(_0xa4af('0x2'));var express=require(_0xa4af('0x3'));var router=express['Router']();var fs_extra=require(_0xa4af('0x4'));var auth=require(_0xa4af('0x5'));var interaction=require(_0xa4af('0x6'));var config=require(_0xa4af('0x7'));var controller=require(_0xa4af('0x8'));router['get']('/',auth[_0xa4af('0x9')](),controller[_0xa4af('0xa')]);router[_0xa4af('0xb')]('/:id',auth[_0xa4af('0x9')](),controller['show']);router[_0xa4af('0xc')]('/',auth[_0xa4af('0x9')](),controller['create']);router[_0xa4af('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa4af('0xe')](_0xa4af('0xf'),auth[_0xa4af('0x9')](),controller[_0xa4af('0x10')]);module[_0xa4af('0x11')]=router; \ No newline at end of file +var _0xf997=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','multer','util'];(function(_0x29c6d6,_0x36a722){var _0x3d1922=function(_0x401172){while(--_0x401172){_0x29c6d6['push'](_0x29c6d6['shift']());}};_0x3d1922(++_0x36a722);}(_0xf997,0x1a7));var _0x7f99=function(_0x521bd4,_0x54fd74){_0x521bd4=_0x521bd4-0x0;var _0x5c2156=_0xf997[_0x521bd4];return _0x5c2156;};'use strict';var multer=require(_0x7f99('0x0'));var util=require(_0x7f99('0x1'));var path=require(_0x7f99('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f99('0x3')]();var fs_extra=require(_0x7f99('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7f99('0x5'));var config=require(_0x7f99('0x6'));var controller=require(_0x7f99('0x7'));router[_0x7f99('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7f99('0x9'),auth['isAuthenticated'](),controller[_0x7f99('0xa')]);router['post']('/',auth[_0x7f99('0xb')](),controller[_0x7f99('0xc')]);router[_0x7f99('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7f99('0xe')]);router[_0x7f99('0xf')](_0x7f99('0x9'),auth['isAuthenticated'](),controller[_0x7f99('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index dacccc5..215d7ae 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 _0xb75b=['name','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xb75b,0x1ab));var _0xbb75=function(_0x66ffa9,_0x30604b){_0x66ffa9=_0x66ffa9-0x0;var _0x1819dc=_0xb75b[_0x66ffa9];return _0x1819dc;};'use strict';var Sequelize=require('sequelize');module[_0xbb75('0x0')]={'name':{'type':Sequelize[_0xbb75('0x1')],'unique':_0xbb75('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbb75('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xbb75('0x3')](_0xbb75('0x4')),'get':function(){if(this[_0xbb75('0x5')](_0xbb75('0x6'))){return this[_0xbb75('0x5')](_0xbb75('0x6'))[_0xbb75('0x7')](_0xbb75('0x8'));}}},'production':{'type':Sequelize[_0xbb75('0x3')]('long'),'get':function(){if(this['getDataValue'](_0xbb75('0x9'))){return this[_0xbb75('0x5')](_0xbb75('0x9'))[_0xbb75('0x7')](_0xbb75('0x8'));}}},'savedAt':{'type':Sequelize[_0xbb75('0xa')]},'publishedAt':{'type':Sequelize[_0xbb75('0xa')]}}; \ No newline at end of file +var _0x0760=['TEXT','BLOB','long','getDataValue','preproduction','utf8','DATE','sequelize','exports','STRING'];(function(_0x54baaa,_0x133edb){var _0x3c5fa1=function(_0x38341e){while(--_0x38341e){_0x54baaa['push'](_0x54baaa['shift']());}};_0x3c5fa1(++_0x133edb);}(_0x0760,0x1d3));var _0x0076=function(_0x12191c,_0x3496da){_0x12191c=_0x12191c-0x0;var _0x1146e5=_0x0760[_0x12191c];return _0x1146e5;};'use strict';var Sequelize=require(_0x0076('0x0'));module[_0x0076('0x1')]={'name':{'type':Sequelize[_0x0076('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0076('0x3')]},'preproduction':{'type':Sequelize[_0x0076('0x4')](_0x0076('0x5')),'get':function(){if(this[_0x0076('0x6')]('preproduction')){return this['getDataValue'](_0x0076('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x0076('0x5')),'get':function(){if(this[_0x0076('0x6')]('production')){return this[_0x0076('0x6')]('production')['toString'](_0x0076('0x8'));}}},'savedAt':{'type':Sequelize[_0x0076('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 475f768..d05d1aa 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 _0xae9e=['error','stack','name','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','limit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','undefined','count','offset','status','Content-Range','update','then','SquareProjects','destroy','publish','agi','stringify','end','sendStatus'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0xae9e,0x1c8));var _0xeae9=function(_0x46f38b,_0x5510c0){_0x46f38b=_0x46f38b-0x0;var _0x2bce63=_0xae9e[_0x46f38b];return _0x2bce63;};'use strict';var _=require(_0xeae9('0x0'));var Redis=require(_0xeae9('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xeae9('0x2'))(_0xeae9('0x3'));var config=require(_0xeae9('0x4'));var db=require(_0xeae9('0x5'))['db'];config[_0xeae9('0x6')]=_[_0xeae9('0x7')](config['redis'],{'host':_0xeae9('0x8'),'port':0x18eb});var socket=require(_0xeae9('0x9'))(new Redis(config[_0xeae9('0x6')]));require(_0xeae9('0xa'))[_0xeae9('0xb')](socket);function respondWithResult(_0x25504c,_0x5c0452){_0x5c0452=_0x5c0452||0xc8;return function(_0x2219f3){if(_0x2219f3){return _0x25504c['status'](_0x5c0452)[_0xeae9('0xc')](_0x2219f3);}};}function respondWithFilteredResult(_0x2c02a5,_0x58be87){return function(_0x419988){if(_0x419988){var _0x350d13=typeof _0x58be87['offset']===_0xeae9('0xd')&&typeof _0x58be87['limit']===_0xeae9('0xd');var _0x29c6f7=_0x419988[_0xeae9('0xe')];var _0x518514=_0x350d13?0x0:_0x58be87['offset'];var _0x178ba4=_0x350d13?_0x419988[_0xeae9('0xe')]:_0x58be87[_0xeae9('0xf')]+_0x58be87['limit'];var _0x17c7fb;if(_0x178ba4>=_0x29c6f7){_0x178ba4=_0x29c6f7;_0x17c7fb=0xc8;}else{_0x17c7fb=0xce;}_0x2c02a5[_0xeae9('0x10')](_0x17c7fb);return _0x2c02a5['set'](_0xeae9('0x11'),_0x518514+'-'+_0x178ba4+'/'+_0x29c6f7)[_0xeae9('0xc')](_0x419988);}return null;};}function saveUpdates(_0x33c75e){return function(_0x523c02){if(_0x523c02){return _0x523c02[_0xeae9('0x12')](_0x33c75e)[_0xeae9('0x13')](function(_0x472bc3){return _0x472bc3;});}return null;};}function removeEntity(_0x5560f8){return function(_0x39928d){if(_0x39928d){return _0x39928d['destroy']()[_0xeae9('0x13')](function(){var _0x335a19=_0x39928d['get']({'plain':!![]});var _0x1e4e17=_0xeae9('0x14');return db['UserProfileResource'][_0xeae9('0x15')]({'where':{'type':_0x1e4e17,'resourceId':_0x335a19['id']}})[_0xeae9('0x13')](function(){return _0x39928d;});})[_0xeae9('0x13')](function(){var _0x30a165=new Redis(config['redis']);_0x30a165[_0xeae9('0x16')](_0xeae9('0x17'),JSON[_0xeae9('0x18')]({'id':_0x39928d['id'],'deleted':!![]}));})[_0xeae9('0x13')](function(){_0x5560f8['status'](0xcc)[_0xeae9('0x19')]();});}};}function handleEntityNotFound(_0x3bbff0){return function(_0x8b8fc3){if(!_0x8b8fc3){_0x3bbff0[_0xeae9('0x1a')](0x194);}return _0x8b8fc3;};}function handleError(_0x2abfcd,_0x499da3){_0x499da3=_0x499da3||0x1f4;return function(_0xf4c268){logger[_0xeae9('0x1b')](_0xf4c268[_0xeae9('0x1c')]);if(_0xf4c268[_0xeae9('0x1d')]){delete _0xf4c268[_0xeae9('0x1d')];}_0x2abfcd[_0xeae9('0x10')](_0x499da3)['send'](_0xf4c268);};}exports[_0xeae9('0x1e')]=function(_0x5196b3,_0x4574e6){var _0x1af268={},_0x51fd6d={},_0x6b44a7={'count':0x0,'rows':[]};var _0x14f426=_[_0xeae9('0x1f')](db[_0xeae9('0x20')][_0xeae9('0x21')],function(_0x2e500e){return{'name':_0x2e500e[_0xeae9('0x22')],'type':_0x2e500e['type'][_0xeae9('0x23')]};});_0x51fd6d[_0xeae9('0x24')]=_['map'](_0x14f426,_0xeae9('0x1d'));_0x51fd6d[_0xeae9('0x25')]=_[_0xeae9('0x26')](_0x5196b3[_0xeae9('0x25')]);_0x51fd6d['filters']=_[_0xeae9('0x27')](_0x51fd6d['model'],_0x51fd6d[_0xeae9('0x25')]);_0x1af268[_0xeae9('0x28')]=_[_0xeae9('0x27')](_0x51fd6d[_0xeae9('0x24')],qs[_0xeae9('0x29')](_0x5196b3['query'][_0xeae9('0x29')]));_0x1af268[_0xeae9('0x28')]=_0x1af268[_0xeae9('0x28')][_0xeae9('0x2a')]?_0x1af268['attributes']:_0x51fd6d[_0xeae9('0x24')];if(!_0x5196b3[_0xeae9('0x25')]['hasOwnProperty']('nolimit')){_0x1af268[_0xeae9('0x2b')]=qs['limit'](_0x5196b3[_0xeae9('0x25')][_0xeae9('0x2b')]);_0x1af268['offset']=qs[_0xeae9('0xf')](_0x5196b3[_0xeae9('0x25')][_0xeae9('0xf')]);}_0x1af268['order']=qs['sort'](_0x5196b3['query'][_0xeae9('0x2c')]);_0x1af268[_0xeae9('0x2d')]=qs[_0xeae9('0x2e')](_[_0xeae9('0x2f')](_0x5196b3['query'],_0x51fd6d[_0xeae9('0x2e')]),_0x14f426);if(_0x5196b3[_0xeae9('0x25')][_0xeae9('0x30')]){_0x1af268[_0xeae9('0x2d')]=_[_0xeae9('0x31')](_0x1af268[_0xeae9('0x2d')],{'$or':_[_0xeae9('0x1f')](_0x14f426,function(_0x547189){if(_0x547189[_0xeae9('0x32')]!=='VIRTUAL'){var _0xb6d139={};_0xb6d139[_0x547189['name']]={'$like':'%'+_0x5196b3[_0xeae9('0x25')]['filter']+'%'};return _0xb6d139;}})});}_0x1af268=_[_0xeae9('0x31')]({},_0x1af268,_0x5196b3['options']);var _0x447617={'where':_0x1af268[_0xeae9('0x2d')]};return db['SquareProject'][_0xeae9('0xe')](_0x447617)[_0xeae9('0x13')](function(_0x50dd3e){_0x6b44a7['count']=_0x50dd3e;if(_0x5196b3[_0xeae9('0x25')][_0xeae9('0x33')]){_0x1af268[_0xeae9('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0xeae9('0x35')](_0x1af268);})[_0xeae9('0x13')](function(_0x2b295f){_0x6b44a7[_0xeae9('0x36')]=_0x2b295f;return _0x6b44a7;})[_0xeae9('0x13')](respondWithFilteredResult(_0x4574e6,_0x1af268))[_0xeae9('0x37')](handleError(_0x4574e6,null));};exports[_0xeae9('0x38')]=function(_0x43fcd1,_0x4336ba){var _0x4f145f={'raw':![],'where':{'id':_0x43fcd1[_0xeae9('0x39')]['id']}},_0x747005={};_0x747005[_0xeae9('0x24')]=_[_0xeae9('0x26')](db[_0xeae9('0x20')][_0xeae9('0x21')]);_0x747005['query']=_[_0xeae9('0x26')](_0x43fcd1[_0xeae9('0x25')]);_0x747005[_0xeae9('0x2e')]=_[_0xeae9('0x27')](_0x747005[_0xeae9('0x24')],_0x747005['query']);_0x4f145f[_0xeae9('0x28')]=_[_0xeae9('0x27')](_0x747005[_0xeae9('0x24')],qs[_0xeae9('0x29')](_0x43fcd1[_0xeae9('0x25')][_0xeae9('0x29')]));_0x4f145f[_0xeae9('0x28')]=_0x4f145f[_0xeae9('0x28')][_0xeae9('0x2a')]?_0x4f145f[_0xeae9('0x28')]:_0x747005[_0xeae9('0x24')];if(_0x43fcd1[_0xeae9('0x25')][_0xeae9('0x33')]){_0x4f145f[_0xeae9('0x34')]=[{'all':!![]}];}_0x4f145f=_[_0xeae9('0x31')]({},_0x4f145f,_0x43fcd1[_0xeae9('0x3a')]);return db[_0xeae9('0x20')][_0xeae9('0x3b')](_0x4f145f)[_0xeae9('0x13')](handleEntityNotFound(_0x4336ba,null))[_0xeae9('0x13')](respondWithResult(_0x4336ba,null))['catch'](handleError(_0x4336ba,null));};exports[_0xeae9('0x3c')]=function(_0x52af82,_0x5e129b){return db[_0xeae9('0x20')][_0xeae9('0x3c')](_0x52af82[_0xeae9('0x3d')],{})[_0xeae9('0x13')](function(_0x4fb896){var _0x393f2a=_0x52af82[_0xeae9('0x3e')]['get']({'plain':!![]});if(!_0x393f2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x393f2a[_0xeae9('0x3f')]===_0xeae9('0x3e')){var _0x504b2d=_0x4fb896[_0xeae9('0x40')]({'plain':!![]});var _0x291ef6='SquareProjects';return db['UserProfileSection'][_0xeae9('0x3b')]({'where':{'name':_0x291ef6,'userProfileId':_0x393f2a[_0xeae9('0x41')]},'raw':!![]})[_0xeae9('0x13')](function(_0x2c6fda){if(_0x2c6fda&&_0x2c6fda[_0xeae9('0x42')]===0x0){return db['UserProfileResource']['create']({'name':_0x504b2d[_0xeae9('0x1d')],'resourceId':_0x504b2d['id'],'type':_0x2c6fda[_0xeae9('0x1d')],'sectionId':_0x2c6fda['id']},{})[_0xeae9('0x13')](function(){return _0x4fb896;});}else{return _0x4fb896;}})['catch'](function(_0x508866){logger[_0xeae9('0x1b')](_0xeae9('0x43'),_0x508866);throw _0x508866;});}return _0x4fb896;})[_0xeae9('0x13')](respondWithResult(_0x5e129b,0xc9))['catch'](handleError(_0x5e129b,null));};exports[_0xeae9('0x12')]=function(_0x474c8e,_0x9d0e3c){if(_0x474c8e['body']['id']){delete _0x474c8e[_0xeae9('0x3d')]['id'];}return db[_0xeae9('0x20')][_0xeae9('0x3b')]({'where':{'id':_0x474c8e[_0xeae9('0x39')]['id']}})['then'](handleEntityNotFound(_0x9d0e3c,null))['then'](saveUpdates(_0x474c8e['body'],null))[_0xeae9('0x13')](function(_0x1c0161){if(!_0x1c0161)return;var _0x23df3a=_0x1c0161[_0xeae9('0x40')]({'plain':!![]});return _0x23df3a;})['then'](function(_0x29a508){var _0x2c7837=new Redis(config[_0xeae9('0x6')]);_0x2c7837[_0xeae9('0x16')](_0xeae9('0x17'),JSON['stringify'](_['pick'](_0x29a508,['id',_0xeae9('0x1d'),_0xeae9('0x44')])));return _0x29a508;})[_0xeae9('0x13')](respondWithResult(_0x9d0e3c,null))['catch'](handleError(_0x9d0e3c,null));};exports[_0xeae9('0x15')]=function(_0xafb298,_0x1d0810){return db[_0xeae9('0x20')][_0xeae9('0x3b')]({'where':{'id':_0xafb298['params']['id']}})[_0xeae9('0x13')](handleEntityNotFound(_0x1d0810,null))[_0xeae9('0x13')](removeEntity(_0x1d0810,null))[_0xeae9('0x37')](handleError(_0x1d0810,null));}; \ No newline at end of file +var _0x3c28=['then','SquareProjects','destroy','publish','agi','stringify','end','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','name','merge','includeAll','include','findAll','rows','catch','show','params','options','body','user','get','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','pick','lodash','ioredis','../../components/parsers/qs','api','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','count','set','Content-Range'];(function(_0xa55327,_0x2a884a){var _0x1f251f=function(_0x1cb1e9){while(--_0x1cb1e9){_0xa55327['push'](_0xa55327['shift']());}};_0x1f251f(++_0x2a884a);}(_0x3c28,0xb8));var _0x83c2=function(_0x4ece3c,_0x3b7cb4){_0x4ece3c=_0x4ece3c-0x0;var _0x5cabdf=_0x3c28[_0x4ece3c];return _0x5cabdf;};'use strict';var _=require(_0x83c2('0x0'));var Redis=require(_0x83c2('0x1'));var qs=require(_0x83c2('0x2'));var logger=require('../../config/logger')(_0x83c2('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x83c2('0x4')]=_[_0x83c2('0x5')](config['redis'],{'host':_0x83c2('0x6'),'port':0x18eb});var socket=require(_0x83c2('0x7'))(new Redis(config['redis']));require(_0x83c2('0x8'))[_0x83c2('0x9')](socket);function respondWithResult(_0x27316a,_0x3f89ec){_0x3f89ec=_0x3f89ec||0xc8;return function(_0x34419e){if(_0x34419e){return _0x27316a[_0x83c2('0xa')](_0x3f89ec)[_0x83c2('0xb')](_0x34419e);}};}function respondWithFilteredResult(_0x57e0b6,_0x495468){return function(_0x335d01){if(_0x335d01){var _0x1d83f2=typeof _0x495468[_0x83c2('0xc')]==='undefined'&&typeof _0x495468[_0x83c2('0xd')]==='undefined';var _0x267289=_0x335d01[_0x83c2('0xe')];var _0x109986=_0x1d83f2?0x0:_0x495468['offset'];var _0x103b5a=_0x1d83f2?_0x335d01[_0x83c2('0xe')]:_0x495468[_0x83c2('0xc')]+_0x495468[_0x83c2('0xd')];var _0x33e2d4;if(_0x103b5a>=_0x267289){_0x103b5a=_0x267289;_0x33e2d4=0xc8;}else{_0x33e2d4=0xce;}_0x57e0b6[_0x83c2('0xa')](_0x33e2d4);return _0x57e0b6[_0x83c2('0xf')](_0x83c2('0x10'),_0x109986+'-'+_0x103b5a+'/'+_0x267289)[_0x83c2('0xb')](_0x335d01);}return null;};}function saveUpdates(_0x45bc03){return function(_0x14fdb9){if(_0x14fdb9){return _0x14fdb9['update'](_0x45bc03)[_0x83c2('0x11')](function(_0x3284db){return _0x3284db;});}return null;};}function removeEntity(_0x44b711){return function(_0x4cc5b1){if(_0x4cc5b1){return _0x4cc5b1['destroy']()['then'](function(){var _0x5ad3dc=_0x4cc5b1['get']({'plain':!![]});var _0x4d8f65=_0x83c2('0x12');return db['UserProfileResource'][_0x83c2('0x13')]({'where':{'type':_0x4d8f65,'resourceId':_0x5ad3dc['id']}})['then'](function(){return _0x4cc5b1;});})[_0x83c2('0x11')](function(){var _0x52e261=new Redis(config[_0x83c2('0x4')]);_0x52e261[_0x83c2('0x14')](_0x83c2('0x15'),JSON[_0x83c2('0x16')]({'id':_0x4cc5b1['id'],'deleted':!![]}));})[_0x83c2('0x11')](function(){_0x44b711['status'](0xcc)[_0x83c2('0x17')]();});}};}function handleEntityNotFound(_0x484b89){return function(_0x573f81){if(!_0x573f81){_0x484b89['sendStatus'](0x194);}return _0x573f81;};}function handleError(_0x5a5b4b,_0x528b83){_0x528b83=_0x528b83||0x1f4;return function(_0x43f726){logger[_0x83c2('0x18')](_0x43f726[_0x83c2('0x19')]);if(_0x43f726['name']){delete _0x43f726['name'];}_0x5a5b4b['status'](_0x528b83)[_0x83c2('0x1a')](_0x43f726);};}exports[_0x83c2('0x1b')]=function(_0x153d36,_0x44ea87){var _0x120b2c={},_0x3a32ae={},_0x43bebe={'count':0x0,'rows':[]};var _0x25f397=_[_0x83c2('0x1c')](db[_0x83c2('0x1d')][_0x83c2('0x1e')],function(_0x3a6120){return{'name':_0x3a6120[_0x83c2('0x1f')],'type':_0x3a6120[_0x83c2('0x20')][_0x83c2('0x21')]};});_0x3a32ae[_0x83c2('0x22')]=_[_0x83c2('0x1c')](_0x25f397,'name');_0x3a32ae[_0x83c2('0x23')]=_[_0x83c2('0x24')](_0x153d36[_0x83c2('0x23')]);_0x3a32ae['filters']=_['intersection'](_0x3a32ae[_0x83c2('0x22')],_0x3a32ae[_0x83c2('0x23')]);_0x120b2c[_0x83c2('0x25')]=_['intersection'](_0x3a32ae['model'],qs[_0x83c2('0x26')](_0x153d36['query'][_0x83c2('0x26')]));_0x120b2c[_0x83c2('0x25')]=_0x120b2c[_0x83c2('0x25')][_0x83c2('0x27')]?_0x120b2c[_0x83c2('0x25')]:_0x3a32ae[_0x83c2('0x22')];if(!_0x153d36[_0x83c2('0x23')][_0x83c2('0x28')](_0x83c2('0x29'))){_0x120b2c[_0x83c2('0xd')]=qs[_0x83c2('0xd')](_0x153d36['query'][_0x83c2('0xd')]);_0x120b2c[_0x83c2('0xc')]=qs['offset'](_0x153d36[_0x83c2('0x23')]['offset']);}_0x120b2c[_0x83c2('0x2a')]=qs['sort'](_0x153d36['query']['sort']);_0x120b2c[_0x83c2('0x2b')]=qs[_0x83c2('0x2c')](_['pick'](_0x153d36[_0x83c2('0x23')],_0x3a32ae[_0x83c2('0x2c')]),_0x25f397);if(_0x153d36[_0x83c2('0x23')][_0x83c2('0x2d')]){_0x120b2c[_0x83c2('0x2b')]=_['merge'](_0x120b2c[_0x83c2('0x2b')],{'$or':_[_0x83c2('0x1c')](_0x25f397,function(_0x34e145){if(_0x34e145[_0x83c2('0x20')]!=='VIRTUAL'){var _0xd38e17={};_0xd38e17[_0x34e145[_0x83c2('0x2e')]]={'$like':'%'+_0x153d36[_0x83c2('0x23')]['filter']+'%'};return _0xd38e17;}})});}_0x120b2c=_[_0x83c2('0x2f')]({},_0x120b2c,_0x153d36['options']);var _0x266cf6={'where':_0x120b2c[_0x83c2('0x2b')]};return db['SquareProject'][_0x83c2('0xe')](_0x266cf6)[_0x83c2('0x11')](function(_0x5a972e){_0x43bebe['count']=_0x5a972e;if(_0x153d36[_0x83c2('0x23')][_0x83c2('0x30')]){_0x120b2c[_0x83c2('0x31')]=[{'all':!![]}];}return db[_0x83c2('0x1d')][_0x83c2('0x32')](_0x120b2c);})['then'](function(_0x46de2f){_0x43bebe[_0x83c2('0x33')]=_0x46de2f;return _0x43bebe;})[_0x83c2('0x11')](respondWithFilteredResult(_0x44ea87,_0x120b2c))[_0x83c2('0x34')](handleError(_0x44ea87,null));};exports[_0x83c2('0x35')]=function(_0x4be6cb,_0x32a9b5){var _0x3e5757={'raw':![],'where':{'id':_0x4be6cb[_0x83c2('0x36')]['id']}},_0x5e3770={};_0x5e3770['model']=_[_0x83c2('0x24')](db[_0x83c2('0x1d')][_0x83c2('0x1e')]);_0x5e3770[_0x83c2('0x23')]=_[_0x83c2('0x24')](_0x4be6cb[_0x83c2('0x23')]);_0x5e3770[_0x83c2('0x2c')]=_['intersection'](_0x5e3770[_0x83c2('0x22')],_0x5e3770[_0x83c2('0x23')]);_0x3e5757[_0x83c2('0x25')]=_['intersection'](_0x5e3770[_0x83c2('0x22')],qs[_0x83c2('0x26')](_0x4be6cb['query']['fields']));_0x3e5757[_0x83c2('0x25')]=_0x3e5757[_0x83c2('0x25')][_0x83c2('0x27')]?_0x3e5757[_0x83c2('0x25')]:_0x5e3770['model'];if(_0x4be6cb[_0x83c2('0x23')][_0x83c2('0x30')]){_0x3e5757[_0x83c2('0x31')]=[{'all':!![]}];}_0x3e5757=_[_0x83c2('0x2f')]({},_0x3e5757,_0x4be6cb[_0x83c2('0x37')]);return db[_0x83c2('0x1d')]['find'](_0x3e5757)[_0x83c2('0x11')](handleEntityNotFound(_0x32a9b5,null))[_0x83c2('0x11')](respondWithResult(_0x32a9b5,null))['catch'](handleError(_0x32a9b5,null));};exports['create']=function(_0x5adb06,_0x3b2c32){return db[_0x83c2('0x1d')]['create'](_0x5adb06[_0x83c2('0x38')],{})[_0x83c2('0x11')](function(_0x207a14){var _0xcca17=_0x5adb06[_0x83c2('0x39')][_0x83c2('0x3a')]({'plain':!![]});if(!_0xcca17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcca17['role']===_0x83c2('0x39')){var _0x46b0a7=_0x207a14[_0x83c2('0x3a')]({'plain':!![]});var _0x2b7875=_0x83c2('0x12');return db[_0x83c2('0x3b')]['find']({'where':{'name':_0x2b7875,'userProfileId':_0xcca17[_0x83c2('0x3c')]},'raw':!![]})[_0x83c2('0x11')](function(_0x209a66){if(_0x209a66&&_0x209a66['autoAssociation']===0x0){return db[_0x83c2('0x3d')][_0x83c2('0x3e')]({'name':_0x46b0a7[_0x83c2('0x2e')],'resourceId':_0x46b0a7['id'],'type':_0x209a66[_0x83c2('0x2e')],'sectionId':_0x209a66['id']},{})[_0x83c2('0x11')](function(){return _0x207a14;});}else{return _0x207a14;}})[_0x83c2('0x34')](function(_0x36b453){logger[_0x83c2('0x18')](_0x83c2('0x3f'),_0x36b453);throw _0x36b453;});}return _0x207a14;})[_0x83c2('0x11')](respondWithResult(_0x3b2c32,0xc9))['catch'](handleError(_0x3b2c32,null));};exports[_0x83c2('0x40')]=function(_0x4997bb,_0x1cbf18){if(_0x4997bb[_0x83c2('0x38')]['id']){delete _0x4997bb[_0x83c2('0x38')]['id'];}return db['SquareProject'][_0x83c2('0x41')]({'where':{'id':_0x4997bb['params']['id']}})['then'](handleEntityNotFound(_0x1cbf18,null))['then'](saveUpdates(_0x4997bb[_0x83c2('0x38')],null))['then'](function(_0x219ff5){if(!_0x219ff5)return;var _0x1c27e0=_0x219ff5[_0x83c2('0x3a')]({'plain':!![]});return _0x1c27e0;})[_0x83c2('0x11')](function(_0x567786){var _0xe40ba1=new Redis(config[_0x83c2('0x4')]);_0xe40ba1[_0x83c2('0x14')](_0x83c2('0x15'),JSON[_0x83c2('0x16')](_[_0x83c2('0x42')](_0x567786,['id','name','production'])));return _0x567786;})[_0x83c2('0x11')](respondWithResult(_0x1cbf18,null))[_0x83c2('0x34')](handleError(_0x1cbf18,null));};exports['destroy']=function(_0x27df49,_0x1abf49){return db[_0x83c2('0x1d')][_0x83c2('0x41')]({'where':{'id':_0x27df49[_0x83c2('0x36')]['id']}})[_0x83c2('0x11')](handleEntityNotFound(_0x1abf49,null))['then'](removeEntity(_0x1abf49,null))[_0x83c2('0x34')](handleError(_0x1abf49,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ba0db33..0f92c30 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 _0xf040=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3d1183,_0x5c9c52){var _0x5a3c90=function(_0xb65dd2){while(--_0xb65dd2){_0x3d1183['push'](_0x3d1183['shift']());}};_0x5a3c90(++_0x5c9c52);}(_0xf040,0xca));var _0x0f04=function(_0x614dc5,_0x3dd98e){_0x614dc5=_0x614dc5-0x0;var _0x571e07=_0xf040[_0x614dc5];return _0x571e07;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0f04('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0f04('0x1')](0x0);var events={'afterCreate':_0x0f04('0x2'),'afterUpdate':'update','afterDestroy':_0x0f04('0x3')};function emitEvent(_0x27f565){return function(_0x5e4f85,_0x1e799b,_0x56e582){SquareProjectEvents['emit'](_0x27f565+':'+_0x5e4f85['id'],_0x5e4f85);SquareProjectEvents[_0x0f04('0x4')](_0x27f565,_0x5e4f85);_0x56e582(null);};}for(var e in events){if(events[_0x0f04('0x5')](e)){var event=events[e];SquareProject[_0x0f04('0x6')](e,emitEvent(event));}}module[_0x0f04('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x428b=['save','remove','emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x53364f,_0x4142d4){var _0x2cb710=function(_0x1f59ae){while(--_0x1f59ae){_0x53364f['push'](_0x53364f['shift']());}};_0x2cb710(++_0x4142d4);}(_0x428b,0x191));var _0xb428=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x428b[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xb428('0x0'));var SquareProject=require(_0xb428('0x1'))['db'][_0xb428('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb428('0x3')](0x0);var events={'afterCreate':_0xb428('0x4'),'afterUpdate':'update','afterDestroy':_0xb428('0x5')};function emitEvent(_0x168036){return function(_0x24eb74,_0x3e5583,_0x761d03){SquareProjectEvents['emit'](_0x168036+':'+_0x24eb74['id'],_0x24eb74);SquareProjectEvents[_0xb428('0x6')](_0x168036,_0x24eb74);_0x761d03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb428('0x7')](e,emitEvent(event));}}module[_0xb428('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1d84734..a069509 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 _0x407a=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xa3fcd3,_0x34026f){var _0x1c5739=function(_0x16bdc1){while(--_0x16bdc1){_0xa3fcd3['push'](_0xa3fcd3['shift']());}};_0x1c5739(++_0x34026f);}(_0x407a,0x118));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa407('0x0'));var util=require('util');var logger=require(_0xa407('0x1'))('api');var moment=require(_0xa407('0x2'));var BPromise=require(_0xa407('0x3'));var rp=require(_0xa407('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa407('0x5'));var config=require(_0xa407('0x6'));var attributes=require(_0xa407('0x7'));module[_0xa407('0x8')]=function(_0x2b3cbd,_0x499971){return _0x2b3cbd[_0xa407('0x9')](_0xa407('0xa'),attributes,{'tableName':_0xa407('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f1945,_0x38c12c,_0xbbc064){if(_0x1f1945[_0xa407('0xc')](_0xa407('0xd'))){_0x1f1945[_0xa407('0xe')]=moment()[_0xa407('0xf')](_0xa407('0x10'));}if(_0x1f1945[_0xa407('0xc')](_0xa407('0x11'))){_0x1f1945[_0xa407('0x12')]=moment()['format'](_0xa407('0x10'));}_0xbbc064(null,_0x1f1945);}}});}; \ No newline at end of file +var _0xb117=['define','SquareProject','savedAt','changed','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x3d42f3,_0x5518b2){var _0x28ca20=function(_0x3f2048){while(--_0x3f2048){_0x3d42f3['push'](_0x3d42f3['shift']());}};_0x28ca20(++_0x5518b2);}(_0xb117,0x18d));var _0x7b11=function(_0x2c3327,_0x1d0085){_0x2c3327=_0x2c3327-0x0;var _0x3e6416=_0xb117[_0x2c3327];return _0x3e6416;};'use strict';var _=require(_0x7b11('0x0'));var util=require(_0x7b11('0x1'));var logger=require(_0x7b11('0x2'))(_0x7b11('0x3'));var moment=require('moment');var BPromise=require(_0x7b11('0x4'));var rp=require(_0x7b11('0x5'));var fs=require('fs');var path=require(_0x7b11('0x6'));var rimraf=require(_0x7b11('0x7'));var config=require(_0x7b11('0x8'));var attributes=require(_0x7b11('0x9'));module[_0x7b11('0xa')]=function(_0x32b3eb,_0x28d63d){return _0x32b3eb[_0x7b11('0xb')](_0x7b11('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53a301,_0x37ede2,_0x3e2097){if(_0x53a301['changed']('preproduction')){_0x53a301[_0x7b11('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53a301[_0x7b11('0xe')]('production')){_0x53a301[_0x7b11('0xf')]=moment()['format'](_0x7b11('0x10'));}_0x3e2097(null,_0x53a301);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 81ccc79..72cb3e3 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 _0x8a23=['localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowSquareProject','find','stringify','lodash','ioredis','../../config/logger','redis'];(function(_0x2a4172,_0x5bd9f1){var _0x24e48d=function(_0x241747){while(--_0x241747){_0x2a4172['push'](_0x2a4172['shift']());}};_0x24e48d(++_0x5bd9f1);}(_0x8a23,0xb9));var _0x38a2=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x8a23[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x38a2('0x0'));var Redis=require(_0x38a2('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x38a2('0x2'))('rpc');var config=require('../../config/environment');config[_0x38a2('0x3')]=_['defaults'](config[_0x38a2('0x3')],{'host':_0x38a2('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38a2('0x3')]));require(_0x38a2('0x5'))[_0x38a2('0x6')](socket);exports[_0x38a2('0x7')]=function(_0xffdfdc){var _0x254710=this;return new Promise(function(_0x55a1fd,_0x4b271f){return db[_0x38a2('0x8')][_0x38a2('0x9')]({'raw':_0xffdfdc[_0x38a2('0xa')]?_0xffdfdc[_0x38a2('0xa')][_0x38a2('0xb')]===undefined?!![]:![]:!![],'where':_0xffdfdc['options']?_0xffdfdc['options'][_0x38a2('0xc')]||null:null,'attributes':_0xffdfdc[_0x38a2('0xa')]?_0xffdfdc[_0x38a2('0xa')][_0x38a2('0xd')]||null:null,'limit':_0xffdfdc[_0x38a2('0xa')]?_0xffdfdc[_0x38a2('0xa')][_0x38a2('0xe')]||null:null,'include':_0xffdfdc[_0x38a2('0xa')]?_0xffdfdc['options'][_0x38a2('0xf')]?_[_0x38a2('0x10')](_0xffdfdc[_0x38a2('0xa')]['include'],function(_0x486eb1){return{'model':db[_0x486eb1[_0x38a2('0x11')]],'as':_0x486eb1['as'],'attributes':_0x486eb1['attributes'],'include':_0x486eb1[_0x38a2('0xf')]?_['map'](_0x486eb1['include'],function(_0x22f2c3){return{'model':db[_0x22f2c3[_0x38a2('0x11')]],'as':_0x22f2c3['as'],'attributes':_0x22f2c3['attributes'],'include':_0x22f2c3['include']?_[_0x38a2('0x10')](_0x22f2c3[_0x38a2('0xf')],function(_0xc27aa0){return{'model':db[_0xc27aa0[_0x38a2('0x11')]],'as':_0xc27aa0['as'],'attributes':_0xc27aa0[_0x38a2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x38a2('0x12')](function(_0x269485){logger[_0x38a2('0x13')]('GetSquareProjects',_0xffdfdc);logger[_0x38a2('0x14')]('GetSquareProjects',_0xffdfdc,JSON['stringify'](_0x269485));_0x55a1fd(_0x269485);})[_0x38a2('0x15')](function(_0xdad9a1){logger[_0x38a2('0x16')](_0x38a2('0x7'),_0xdad9a1[_0x38a2('0x17')],_0xffdfdc);_0x4b271f(_0x254710['error'](0x1f4,_0xdad9a1[_0x38a2('0x17')]));});});};exports[_0x38a2('0x18')]=function(_0x306497){var _0x34ab48=this;return new Promise(function(_0x40a1ad,_0xd033a4){return db[_0x38a2('0x8')][_0x38a2('0x19')]({'raw':_0x306497[_0x38a2('0xa')]?_0x306497['options'][_0x38a2('0xb')]===undefined?!![]:![]:!![],'where':_0x306497[_0x38a2('0xa')]?_0x306497[_0x38a2('0xa')][_0x38a2('0xc')]||null:null,'attributes':_0x306497[_0x38a2('0xa')]?_0x306497[_0x38a2('0xa')]['attributes']||null:null,'include':_0x306497['options']?_0x306497[_0x38a2('0xa')]['include']?_['map'](_0x306497[_0x38a2('0xa')]['include'],function(_0x90edb2){return{'model':db[_0x90edb2['model']],'as':_0x90edb2['as'],'attributes':_0x90edb2[_0x38a2('0xd')],'include':_0x90edb2[_0x38a2('0xf')]?_[_0x38a2('0x10')](_0x90edb2[_0x38a2('0xf')],function(_0x32367b){return{'model':db[_0x32367b[_0x38a2('0x11')]],'as':_0x32367b['as'],'attributes':_0x32367b[_0x38a2('0xd')],'include':_0x32367b['include']?_[_0x38a2('0x10')](_0x32367b[_0x38a2('0xf')],function(_0x401825){return{'model':db[_0x401825['model']],'as':_0x401825['as'],'attributes':_0x401825[_0x38a2('0xd')]};}):[]};}):[]};}):[]:[]})[_0x38a2('0x12')](function(_0x435921){logger[_0x38a2('0x13')](_0x38a2('0x18'),_0x306497);logger[_0x38a2('0x14')](_0x38a2('0x18'),_0x306497,JSON[_0x38a2('0x1a')](_0x435921));_0x40a1ad(_0x435921);})['catch'](function(_0xf3d17d){logger[_0x38a2('0x16')](_0x38a2('0x18'),_0xf3d17d[_0x38a2('0x17')],_0x306497);_0xd033a4(_0x34ab48[_0x38a2('0x16')](0x1f4,_0xf3d17d['message']));});});}; \ No newline at end of file +var _0x91e8=['error','message','find','info','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','register','SquareProject','findAll','raw','options','where','include','model','attributes','map','then','debug','GetSquareProjects','stringify','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91e8,0x144));var _0x891e=function(_0x537a5b,_0x209343){_0x537a5b=_0x537a5b-0x0;var _0x5e575b=_0x91e8[_0x537a5b];return _0x5e575b;};'use strict';var _=require(_0x891e('0x0'));var Redis=require(_0x891e('0x1'));var db=require(_0x891e('0x2'))['db'];var logger=require(_0x891e('0x3'))(_0x891e('0x4'));var config=require(_0x891e('0x5'));config[_0x891e('0x6')]=_[_0x891e('0x7')](config[_0x891e('0x6')],{'host':_0x891e('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0x891e('0x9')](socket);exports['GetSquareProjects']=function(_0x435094){var _0x58211b=this;return new Promise(function(_0x2c1166,_0x4b73a1){return db[_0x891e('0xa')][_0x891e('0xb')]({'raw':_0x435094['options']?_0x435094['options'][_0x891e('0xc')]===undefined?!![]:![]:!![],'where':_0x435094[_0x891e('0xd')]?_0x435094['options'][_0x891e('0xe')]||null:null,'attributes':_0x435094['options']?_0x435094['options']['attributes']||null:null,'limit':_0x435094[_0x891e('0xd')]?_0x435094[_0x891e('0xd')]['limit']||null:null,'include':_0x435094['options']?_0x435094['options']['include']?_['map'](_0x435094[_0x891e('0xd')][_0x891e('0xf')],function(_0x76ad0e){return{'model':db[_0x76ad0e[_0x891e('0x10')]],'as':_0x76ad0e['as'],'attributes':_0x76ad0e[_0x891e('0x11')],'include':_0x76ad0e[_0x891e('0xf')]?_[_0x891e('0x12')](_0x76ad0e['include'],function(_0x2d0627){return{'model':db[_0x2d0627[_0x891e('0x10')]],'as':_0x2d0627['as'],'attributes':_0x2d0627[_0x891e('0x11')],'include':_0x2d0627[_0x891e('0xf')]?_['map'](_0x2d0627[_0x891e('0xf')],function(_0x2ecbf1){return{'model':db[_0x2ecbf1[_0x891e('0x10')]],'as':_0x2ecbf1['as'],'attributes':_0x2ecbf1[_0x891e('0x11')]};}):[]};}):[]};}):[]:[]})[_0x891e('0x13')](function(_0x32cd91){logger['info']('GetSquareProjects',_0x435094);logger[_0x891e('0x14')](_0x891e('0x15'),_0x435094,JSON[_0x891e('0x16')](_0x32cd91));_0x2c1166(_0x32cd91);})[_0x891e('0x17')](function(_0x4f2232){logger[_0x891e('0x18')](_0x891e('0x15'),_0x4f2232['message'],_0x435094);_0x4b73a1(_0x58211b['error'](0x1f4,_0x4f2232[_0x891e('0x19')]));});});};exports['ShowSquareProject']=function(_0x10a22d){var _0x387c3e=this;return new Promise(function(_0x28c466,_0x46768c){return db[_0x891e('0xa')][_0x891e('0x1a')]({'raw':_0x10a22d[_0x891e('0xd')]?_0x10a22d[_0x891e('0xd')][_0x891e('0xc')]===undefined?!![]:![]:!![],'where':_0x10a22d[_0x891e('0xd')]?_0x10a22d[_0x891e('0xd')][_0x891e('0xe')]||null:null,'attributes':_0x10a22d[_0x891e('0xd')]?_0x10a22d[_0x891e('0xd')][_0x891e('0x11')]||null:null,'include':_0x10a22d['options']?_0x10a22d[_0x891e('0xd')][_0x891e('0xf')]?_['map'](_0x10a22d[_0x891e('0xd')][_0x891e('0xf')],function(_0x4815ef){return{'model':db[_0x4815ef[_0x891e('0x10')]],'as':_0x4815ef['as'],'attributes':_0x4815ef[_0x891e('0x11')],'include':_0x4815ef[_0x891e('0xf')]?_[_0x891e('0x12')](_0x4815ef['include'],function(_0xedbf6d){return{'model':db[_0xedbf6d['model']],'as':_0xedbf6d['as'],'attributes':_0xedbf6d[_0x891e('0x11')],'include':_0xedbf6d[_0x891e('0xf')]?_[_0x891e('0x12')](_0xedbf6d['include'],function(_0x40ac97){return{'model':db[_0x40ac97['model']],'as':_0x40ac97['as'],'attributes':_0x40ac97['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f38ef){logger[_0x891e('0x1b')]('ShowSquareProject',_0x10a22d);logger['debug'](_0x891e('0x1c'),_0x10a22d,JSON['stringify'](_0x4f38ef));_0x28c466(_0x4f38ef);})[_0x891e('0x17')](function(_0x20fbee){logger[_0x891e('0x18')](_0x891e('0x1c'),_0x20fbee['message'],_0x10a22d);_0x46768c(_0x387c3e[_0x891e('0x18')](0x1f4,_0x20fbee['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 6957b94..d043266 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 _0x79d8=['register','squareProject:','./squareProject.events','save','update','removeListener'];(function(_0xe00939,_0x5cd6c7){var _0x244e3c=function(_0x284ade){while(--_0x284ade){_0xe00939['push'](_0xe00939['shift']());}};_0x244e3c(++_0x5cd6c7);}(_0x79d8,0x110));var _0x879d=function(_0x3ddfaa,_0x56a99e){_0x3ddfaa=_0x3ddfaa-0x0;var _0x1f2c67=_0x79d8[_0x3ddfaa];return _0x1f2c67;};'use strict';var SquareProjectEvents=require(_0x879d('0x0'));var events=[_0x879d('0x1'),'remove',_0x879d('0x2')];function createListener(_0x59beb9,_0x30145f){return function(_0x94f715){_0x30145f['emit'](_0x59beb9,_0x94f715);};}function removeListener(_0x1ef0e7,_0x2e3bfb){return function(){SquareProjectEvents[_0x879d('0x3')](_0x1ef0e7,_0x2e3bfb);};}exports[_0x879d('0x4')]=function(_0x6a5c10){for(var _0x550c37=0x0,_0x44fc22=events['length'];_0x550c37<_0x44fc22;_0x550c37++){var _0x52d038=events[_0x550c37];var _0x84dbcf=createListener(_0x879d('0x5')+_0x52d038,_0x6a5c10);SquareProjectEvents['on'](_0x52d038,_0x84dbcf);}}; \ No newline at end of file +var _0x1cea=['register','squareProject:','./squareProject.events','update','removeListener'];(function(_0x40bfc4,_0x37442b){var _0xfc1cf6=function(_0x504852){while(--_0x504852){_0x40bfc4['push'](_0x40bfc4['shift']());}};_0xfc1cf6(++_0x37442b);}(_0x1cea,0x8e));var _0xa1ce=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x1cea[_0x5dee2a];return _0x31e98e;};'use strict';var SquareProjectEvents=require(_0xa1ce('0x0'));var events=['save','remove',_0xa1ce('0x1')];function createListener(_0x142f2c,_0x9d2b28){return function(_0x1e3504){_0x9d2b28['emit'](_0x142f2c,_0x1e3504);};}function removeListener(_0xedab9f,_0x58cffc){return function(){SquareProjectEvents[_0xa1ce('0x2')](_0xedab9f,_0x58cffc);};}exports[_0xa1ce('0x3')]=function(_0x2296c2){for(var _0x281579=0x0,_0x547a38=events['length'];_0x281579<_0x547a38;_0x281579++){var _0x51cfbb=events[_0x281579];var _0x14c249=createListener(_0xa1ce('0x4')+_0x51cfbb,_0x2296c2);SquareProjectEvents['on'](_0x51cfbb,_0x14c249);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b1a511e..9386ffa 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a1613,_0x5b12b5){var _0x2d319c=function(_0x29903f){while(--_0x29903f){_0x4a1613['push'](_0x4a1613['shift']());}};_0x2d319c(++_0x5b12b5);}(_0xf494,0x1c6));var _0x4f49=function(_0x515847,_0x276cb1){_0x515847=_0x515847-0x0;var _0x48b061=_0xf494[_0x515847];return _0x48b061;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x364195,_0xa80ee4){var _0x3e2434=function(_0x1118ac){while(--_0x1118ac){_0x364195['push'](_0x364195['shift']());}};_0x3e2434(++_0xa80ee4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f90e019..6bb1d26 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 _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0x1ea561,_0x3d0973){var _0x14affb=function(_0x15360c){while(--_0x15360c){_0x1ea561['push'](_0x1ea561['shift']());}};_0x14affb(++_0x3d0973);}(_0xeec6,0x1c2));var _0x6eec=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0xeec6[_0x395667];return _0x5cdb8f;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}}; \ No newline at end of file +var _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x59de41,_0x2b02de){var _0x286f43=function(_0x2b1405){while(--_0x2b1405){_0x59de41['push'](_0x59de41['shift']());}};_0x286f43(++_0x2b02de);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0xf2ca[_0x4169d8];return _0x32084a;};'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 diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index edd474b..a2767cd 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 _0xfc3f=['error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','show','intersection','length','find','catch','create','body','params','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','savePath','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end'];(function(_0x1e3757,_0x16eaca){var _0x395a15=function(_0x3641f7){while(--_0x3641f7){_0x1e3757['push'](_0x1e3757['shift']());}};_0x395a15(++_0x16eaca);}(_0xfc3f,0x1a7));var _0xffc3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfc3f[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xffc3('0x0'));var rimraf=require(_0xffc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffc3('0x2'));var moment=require(_0xffc3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xffc3('0x4'));var util=require(_0xffc3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xffc3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffc3('0x7'));var squel=require(_0xffc3('0x8'));var crypto=require('crypto');var jsforce=require(_0xffc3('0x9'));var deskjs=require(_0xffc3('0xa'));var toCsv=require(_0xffc3('0x6'));var querystring=require(_0xffc3('0xb'));var Papa=require(_0xffc3('0xc'));var Redis=require('ioredis');var authService=require(_0xffc3('0xd'));var qs=require(_0xffc3('0xe'));var as=require(_0xffc3('0xf'));var hardwareService=require(_0xffc3('0x10'));var logger=require(_0xffc3('0x11'))('api');var utils=require(_0xffc3('0x12'));var config=require(_0xffc3('0x13'));var licenseUtil=require(_0xffc3('0x14'));var db=require(_0xffc3('0x15'))['db'];function respondWithStatusCode(_0x2be756,_0x24e30f){_0x24e30f=_0x24e30f||0xcc;return function(_0x5b2e23){if(_0x5b2e23){return _0x2be756[_0xffc3('0x16')](_0x24e30f);}return _0x2be756[_0xffc3('0x17')](_0x24e30f)['end']();};}function respondWithResult(_0x48b1c6,_0x197b3a){_0x197b3a=_0x197b3a||0xc8;return function(_0x1d1a47){if(_0x1d1a47){return _0x48b1c6[_0xffc3('0x17')](_0x197b3a)[_0xffc3('0x18')](_0x1d1a47);}};}function respondWithFilteredResult(_0x2eac3e,_0x475d31){return function(_0x2daf3e){if(_0x2daf3e){var _0x15a5f6=typeof _0x475d31[_0xffc3('0x19')]===_0xffc3('0x1a')&&typeof _0x475d31[_0xffc3('0x1b')]===_0xffc3('0x1a');var _0x1c6e02=_0x2daf3e[_0xffc3('0x1c')];var _0x2c6c86=_0x15a5f6?0x0:_0x475d31[_0xffc3('0x19')];var _0x3e583e=_0x15a5f6?_0x2daf3e['count']:_0x475d31[_0xffc3('0x19')]+_0x475d31['limit'];var _0x33c9f7;if(_0x3e583e>=_0x1c6e02){_0x3e583e=_0x1c6e02;_0x33c9f7=0xc8;}else{_0x33c9f7=0xce;}_0x2eac3e[_0xffc3('0x17')](_0x33c9f7);return _0x2eac3e[_0xffc3('0x1d')](_0xffc3('0x1e'),_0x2c6c86+'-'+_0x3e583e+'/'+_0x1c6e02)['json'](_0x2daf3e);}return null;};}function patchUpdates(_0x321272){return function(_0x2bc4bb){try{jsonpatch[_0xffc3('0x1f')](_0x2bc4bb,_0x321272,!![]);}catch(_0x255301){return BPromise[_0xffc3('0x20')](_0x255301);}return _0x2bc4bb['save']();};}function saveUpdates(_0x47f096,_0x29d420){return function(_0xe66035){if(_0xe66035){return _0xe66035[_0xffc3('0x21')](_0x47f096)['then'](function(_0x340d82){return _0x340d82;});}return null;};}function removeEntity(_0x2f46c0,_0x560c16){return function(_0x527f4c){if(_0x527f4c){return _0x527f4c[_0xffc3('0x22')]()[_0xffc3('0x23')](function(){_0x2f46c0[_0xffc3('0x17')](0xcc)[_0xffc3('0x24')]();});}};}function handleEntityNotFound(_0x3fd40d,_0x1e76f6){return function(_0x75724d){if(!_0x75724d){_0x3fd40d[_0xffc3('0x16')](0x194);}return _0x75724d;};}function handleError(_0x3cb8fa,_0x698696){_0x698696=_0x698696||0x1f4;return function(_0x3325aa){logger[_0xffc3('0x25')](_0x3325aa[_0xffc3('0x26')]);if(_0x3325aa[_0xffc3('0x27')]){delete _0x3325aa['name'];}_0x3cb8fa[_0xffc3('0x17')](_0x698696)[_0xffc3('0x28')](_0x3325aa);};}exports[_0xffc3('0x29')]=function(_0xbc754d,_0x4ee8c4){var _0x3d98ca={},_0x24aab0={},_0x2982f6={'count':0x0,'rows':[]};var _0x3cf0ec=_[_0xffc3('0x2a')](db[_0xffc3('0x2b')][_0xffc3('0x2c')],function(_0x522dbf){return{'name':_0x522dbf[_0xffc3('0x2d')],'type':_0x522dbf[_0xffc3('0x2e')][_0xffc3('0x2f')]};});_0x24aab0['model']=_['map'](_0x3cf0ec,_0xffc3('0x27'));_0x24aab0[_0xffc3('0x30')]=_[_0xffc3('0x31')](_0xbc754d['query']);_0x24aab0[_0xffc3('0x32')]=_['intersection'](_0x24aab0[_0xffc3('0x33')],_0x24aab0[_0xffc3('0x30')]);_0x3d98ca[_0xffc3('0x34')]=_['intersection'](_0x24aab0[_0xffc3('0x33')],qs[_0xffc3('0x35')](_0xbc754d[_0xffc3('0x30')][_0xffc3('0x35')]));_0x3d98ca[_0xffc3('0x34')]=_0x3d98ca[_0xffc3('0x34')]['length']?_0x3d98ca[_0xffc3('0x34')]:_0x24aab0[_0xffc3('0x33')];if(!_0xbc754d[_0xffc3('0x30')][_0xffc3('0x36')](_0xffc3('0x37'))){_0x3d98ca[_0xffc3('0x1b')]=qs['limit'](_0xbc754d[_0xffc3('0x30')][_0xffc3('0x1b')]);_0x3d98ca['offset']=qs['offset'](_0xbc754d['query'][_0xffc3('0x19')]);}_0x3d98ca[_0xffc3('0x38')]=qs[_0xffc3('0x39')](_0xbc754d[_0xffc3('0x30')][_0xffc3('0x39')]);_0x3d98ca[_0xffc3('0x3a')]=qs[_0xffc3('0x32')](_['pick'](_0xbc754d['query'],_0x24aab0[_0xffc3('0x32')]),_0x3cf0ec);if(_0xbc754d['query']['filter']){_0x3d98ca[_0xffc3('0x3a')]=_[_0xffc3('0x3b')](_0x3d98ca['where'],{'$or':_[_0xffc3('0x2a')](_0x3cf0ec,function(_0x67951b){if(_0x67951b[_0xffc3('0x2e')]!==_0xffc3('0x3c')){var _0x9338ab={};_0x9338ab[_0x67951b[_0xffc3('0x27')]]={'$like':'%'+_0xbc754d[_0xffc3('0x30')][_0xffc3('0x3d')]+'%'};return _0x9338ab;}})});}_0x3d98ca=_[_0xffc3('0x3b')]({},_0x3d98ca,_0xbc754d['options']);var _0x537138={'where':_0x3d98ca[_0xffc3('0x3a')]};return db[_0xffc3('0x2b')][_0xffc3('0x1c')](_0x537138)[_0xffc3('0x23')](function(_0x4d741d){_0x2982f6[_0xffc3('0x1c')]=_0x4d741d;if(_0xbc754d[_0xffc3('0x30')][_0xffc3('0x3e')]){_0x3d98ca[_0xffc3('0x3f')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x3d98ca);})[_0xffc3('0x23')](function(_0x198f3f){_0x2982f6[_0xffc3('0x40')]=_0x198f3f;return _0x2982f6;})[_0xffc3('0x23')](respondWithFilteredResult(_0x4ee8c4,_0x3d98ca))['catch'](handleError(_0x4ee8c4,null));};exports[_0xffc3('0x41')]=function(_0x2ead17,_0x2c4cf8){var _0x1cc5f7={'raw':!![],'where':{'id':_0x2ead17['params']['id']}},_0x112d70={};_0x112d70[_0xffc3('0x33')]=_[_0xffc3('0x31')](db[_0xffc3('0x2b')][_0xffc3('0x2c')]);_0x112d70['query']=_[_0xffc3('0x31')](_0x2ead17[_0xffc3('0x30')]);_0x112d70[_0xffc3('0x32')]=_[_0xffc3('0x42')](_0x112d70[_0xffc3('0x33')],_0x112d70[_0xffc3('0x30')]);_0x1cc5f7[_0xffc3('0x34')]=_['intersection'](_0x112d70[_0xffc3('0x33')],qs['fields'](_0x2ead17['query'][_0xffc3('0x35')]));_0x1cc5f7[_0xffc3('0x34')]=_0x1cc5f7[_0xffc3('0x34')][_0xffc3('0x43')]?_0x1cc5f7[_0xffc3('0x34')]:_0x112d70[_0xffc3('0x33')];if(_0x2ead17[_0xffc3('0x30')]['includeAll']){_0x1cc5f7[_0xffc3('0x3f')]=[{'all':!![]}];}_0x1cc5f7=_['merge']({},_0x1cc5f7,_0x2ead17['options']);return db['SquareRecording'][_0xffc3('0x44')](_0x1cc5f7)[_0xffc3('0x23')](handleEntityNotFound(_0x2c4cf8,null))[_0xffc3('0x23')](respondWithResult(_0x2c4cf8,null))[_0xffc3('0x45')](handleError(_0x2c4cf8,null));};exports[_0xffc3('0x46')]=function(_0x59a05a,_0xa64d3){return db[_0xffc3('0x2b')][_0xffc3('0x46')](_0x59a05a[_0xffc3('0x47')],{})[_0xffc3('0x23')](respondWithResult(_0xa64d3,0xc9))['catch'](handleError(_0xa64d3,null));};exports[_0xffc3('0x21')]=function(_0x365755,_0x2cc836){if(_0x365755['body']['id']){delete _0x365755['body']['id'];}return db[_0xffc3('0x2b')][_0xffc3('0x44')]({'where':{'id':_0x365755[_0xffc3('0x48')]['id']}})[_0xffc3('0x23')](handleEntityNotFound(_0x2cc836,null))[_0xffc3('0x23')](saveUpdates(_0x365755[_0xffc3('0x47')],null))[_0xffc3('0x23')](respondWithResult(_0x2cc836,null))[_0xffc3('0x45')](handleError(_0x2cc836,null));};exports[_0xffc3('0x49')]=function(_0x81c084,_0x55f88c,_0x265caf){var _0x355bfa=require(_0xffc3('0x4a'));var _0x3e5347=![];var _0x262e4a={};if(_0x81c084[_0xffc3('0x30')][_0xffc3('0x2e')]&&_0x81c084[_0xffc3('0x30')]['type']===_0xffc3('0x4b')){_0x262e4a[_0xffc3('0x4b')]=_0x81c084[_0xffc3('0x48')]['id'];}else{_0x262e4a['id']=_0x81c084[_0xffc3('0x48')]['id'];}return db['SquareRecording'][_0xffc3('0x44')]({'where':_0x262e4a,'attributes':['id','savePath','filename'],'raw':!![]})[_0xffc3('0x23')](handleEntityNotFound(_0x55f88c,null))[_0xffc3('0x23')](function(_0x1aa938){if(_0x1aa938){var _0x3f59b6=_0x1aa938['savePath'];var _0x1fc34e=util['format'](_0xffc3('0x4c'),_0x3f59b6);if(fs[_0xffc3('0x4d')](_0x1fc34e)){_0x3e5347=!![];return _0x355bfa[_0xffc3('0x4e')](_0x1fc34e,_0x3f59b6,config['secrets']['recording'])[_0xffc3('0x23')](function(){return _0x1aa938;});}return _0x1aa938;}})[_0xffc3('0x23')](function(_0x3807a1){if(_0x3807a1){var _0xfa6f88=_0x3807a1[_0xffc3('0x4f')];if(!fs[_0xffc3('0x4d')](_0xfa6f88)){throw new db['Sequelize'][(_0xffc3('0x50'))](_0xffc3('0x51'));}if(_0x3807a1[_0xffc3('0x52')]){return _0x55f88c[_0xffc3('0x49')](_0xfa6f88,_0x3807a1[_0xffc3('0x52')]+path[_0xffc3('0x53')](_0xfa6f88),function(){if(_0x3e5347){fs['unlink'](_0xfa6f88);}});}else{return _0x55f88c[_0xffc3('0x49')](_0xfa6f88,function(_0x1aff6f){if(_0x3e5347){fs[_0xffc3('0x54')](_0xfa6f88);}});}}})['catch'](function(_0x1e599f){if(_0x1e599f['message']===_0xffc3('0x51')){_0x55f88c[_0xffc3('0x17')](0x194)['send'](_0xffc3('0x55'));}else{return handleError(_0x55f88c,null);}});};exports['destroy']=function(_0x598c45,_0x1a41b6){return db['SquareRecording'][_0xffc3('0x44')]({'where':{'id':_0x598c45['params']['id']}})[_0xffc3('0x23')](function(_0x103d56){if(_['isNil'](_0x103d56)){throw new ReferenceError('Entity\x20not\x20found');}return _0x103d56;})[_0xffc3('0x23')](function(_0x40dd67){var _0x2f82a6=_0x40dd67[_0xffc3('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f82a6);if(!_[_0xffc3('0x56')](_0x40dd67[_0xffc3('0x4f')])&&fs['existsSync'](_0x2f82a6)){logger[_0xffc3('0x57')](_0xffc3('0x58')+_0x2f82a6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2f82a6);}_0x2f82a6=_0x2f82a6+_0xffc3('0x59');if(!_[_0xffc3('0x56')](_0x40dd67[_0xffc3('0x4f')])&&fs[_0xffc3('0x4d')](_0x2f82a6)){logger[_0xffc3('0x57')]('File:\x20\x22'+_0x2f82a6+_0xffc3('0x5a'));fs[_0xffc3('0x5b')](_0x2f82a6);}return _0x40dd67;})[_0xffc3('0x23')](function(_0x5ada9a){if(!_0x5ada9a)throw new InternalError();return _0x5ada9a[_0xffc3('0x22')]();})[_0xffc3('0x23')](function(){_0x1a41b6['status'](0xcc)[_0xffc3('0x24')]();})[_0xffc3('0x45')](handleError(_0x1a41b6,null));}; \ No newline at end of file +var _0xa2f2=['params','find','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','show'];(function(_0x552f15,_0x55f623){var _0x5efc1e=function(_0x4db347){while(--_0x4db347){_0x552f15['push'](_0x552f15['shift']());}};_0x5efc1e(++_0x55f623);}(_0xa2f2,0x7c));var _0x2a2f=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa2f2[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2a2f('0x0'));var jsonpatch=require(_0x2a2f('0x1'));var rp=require(_0x2a2f('0x2'));var moment=require('moment');var BPromise=require(_0x2a2f('0x3'));var Mustache=require(_0x2a2f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2a2f('0x5'));var csv=require(_0x2a2f('0x6'));var ejs=require(_0x2a2f('0x7'));var fs=require('fs');var fs_extra=require(_0x2a2f('0x8'));var _=require(_0x2a2f('0x9'));var squel=require(_0x2a2f('0xa'));var crypto=require(_0x2a2f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a2f('0xc'));var toCsv=require(_0x2a2f('0x6'));var querystring=require(_0x2a2f('0xd'));var Papa=require(_0x2a2f('0xe'));var Redis=require('ioredis');var authService=require(_0x2a2f('0xf'));var qs=require(_0x2a2f('0x10'));var as=require(_0x2a2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a2f('0x12'))(_0x2a2f('0x13'));var utils=require(_0x2a2f('0x14'));var config=require(_0x2a2f('0x15'));var licenseUtil=require(_0x2a2f('0x16'));var db=require(_0x2a2f('0x17'))['db'];function respondWithStatusCode(_0x1e569c,_0x5b56cd){_0x5b56cd=_0x5b56cd||0xcc;return function(_0x62b181){if(_0x62b181){return _0x1e569c[_0x2a2f('0x18')](_0x5b56cd);}return _0x1e569c[_0x2a2f('0x19')](_0x5b56cd)[_0x2a2f('0x1a')]();};}function respondWithResult(_0x3523bd,_0x137e25){_0x137e25=_0x137e25||0xc8;return function(_0x3d898a){if(_0x3d898a){return _0x3523bd[_0x2a2f('0x19')](_0x137e25)[_0x2a2f('0x1b')](_0x3d898a);}};}function respondWithFilteredResult(_0x1177f8,_0x5093a0){return function(_0x319da3){if(_0x319da3){var _0x53bbde=typeof _0x5093a0[_0x2a2f('0x1c')]===_0x2a2f('0x1d')&&typeof _0x5093a0[_0x2a2f('0x1e')]===_0x2a2f('0x1d');var _0x3c5cd3=_0x319da3[_0x2a2f('0x1f')];var _0x479f02=_0x53bbde?0x0:_0x5093a0['offset'];var _0x2d663a=_0x53bbde?_0x319da3[_0x2a2f('0x1f')]:_0x5093a0[_0x2a2f('0x1c')]+_0x5093a0['limit'];var _0x32ba65;if(_0x2d663a>=_0x3c5cd3){_0x2d663a=_0x3c5cd3;_0x32ba65=0xc8;}else{_0x32ba65=0xce;}_0x1177f8[_0x2a2f('0x19')](_0x32ba65);return _0x1177f8[_0x2a2f('0x20')](_0x2a2f('0x21'),_0x479f02+'-'+_0x2d663a+'/'+_0x3c5cd3)[_0x2a2f('0x1b')](_0x319da3);}return null;};}function patchUpdates(_0x186155){return function(_0x53c74a){try{jsonpatch[_0x2a2f('0x22')](_0x53c74a,_0x186155,!![]);}catch(_0xf1097e){return BPromise[_0x2a2f('0x23')](_0xf1097e);}return _0x53c74a[_0x2a2f('0x24')]();};}function saveUpdates(_0x4e09ad,_0x529f63){return function(_0x29e859){if(_0x29e859){return _0x29e859[_0x2a2f('0x25')](_0x4e09ad)[_0x2a2f('0x26')](function(_0x57c2f9){return _0x57c2f9;});}return null;};}function removeEntity(_0x460b96,_0x413d17){return function(_0x8b9cca){if(_0x8b9cca){return _0x8b9cca['destroy']()[_0x2a2f('0x26')](function(){_0x460b96[_0x2a2f('0x19')](0xcc)[_0x2a2f('0x1a')]();});}};}function handleEntityNotFound(_0x452893,_0x54595d){return function(_0x48eb65){if(!_0x48eb65){_0x452893['sendStatus'](0x194);}return _0x48eb65;};}function handleError(_0x1c859d,_0x2ab478){_0x2ab478=_0x2ab478||0x1f4;return function(_0x3fa0de){logger[_0x2a2f('0x27')](_0x3fa0de[_0x2a2f('0x28')]);if(_0x3fa0de[_0x2a2f('0x29')]){delete _0x3fa0de[_0x2a2f('0x29')];}_0x1c859d[_0x2a2f('0x19')](_0x2ab478)[_0x2a2f('0x2a')](_0x3fa0de);};}exports[_0x2a2f('0x2b')]=function(_0x387e5d,_0x3bcb58){var _0x17a161={},_0x50e2f6={},_0x128093={'count':0x0,'rows':[]};var _0x2f4afc=_['map'](db['SquareRecording'][_0x2a2f('0x2c')],function(_0x543a7f){return{'name':_0x543a7f['fieldName'],'type':_0x543a7f[_0x2a2f('0x2d')][_0x2a2f('0x2e')]};});_0x50e2f6['model']=_[_0x2a2f('0x2f')](_0x2f4afc,_0x2a2f('0x29'));_0x50e2f6[_0x2a2f('0x30')]=_[_0x2a2f('0x31')](_0x387e5d['query']);_0x50e2f6[_0x2a2f('0x32')]=_[_0x2a2f('0x33')](_0x50e2f6[_0x2a2f('0x34')],_0x50e2f6['query']);_0x17a161[_0x2a2f('0x35')]=_[_0x2a2f('0x33')](_0x50e2f6[_0x2a2f('0x34')],qs['fields'](_0x387e5d[_0x2a2f('0x30')][_0x2a2f('0x36')]));_0x17a161[_0x2a2f('0x35')]=_0x17a161['attributes'][_0x2a2f('0x37')]?_0x17a161[_0x2a2f('0x35')]:_0x50e2f6[_0x2a2f('0x34')];if(!_0x387e5d[_0x2a2f('0x30')][_0x2a2f('0x38')](_0x2a2f('0x39'))){_0x17a161[_0x2a2f('0x1e')]=qs[_0x2a2f('0x1e')](_0x387e5d['query'][_0x2a2f('0x1e')]);_0x17a161[_0x2a2f('0x1c')]=qs[_0x2a2f('0x1c')](_0x387e5d['query']['offset']);}_0x17a161['order']=qs[_0x2a2f('0x3a')](_0x387e5d[_0x2a2f('0x30')]['sort']);_0x17a161['where']=qs[_0x2a2f('0x32')](_['pick'](_0x387e5d['query'],_0x50e2f6[_0x2a2f('0x32')]),_0x2f4afc);if(_0x387e5d['query']['filter']){_0x17a161[_0x2a2f('0x3b')]=_['merge'](_0x17a161[_0x2a2f('0x3b')],{'$or':_['map'](_0x2f4afc,function(_0x44bcbd){if(_0x44bcbd[_0x2a2f('0x2d')]!=='VIRTUAL'){var _0x464b2a={};_0x464b2a[_0x44bcbd['name']]={'$like':'%'+_0x387e5d[_0x2a2f('0x30')][_0x2a2f('0x3c')]+'%'};return _0x464b2a;}})});}_0x17a161=_[_0x2a2f('0x3d')]({},_0x17a161,_0x387e5d[_0x2a2f('0x3e')]);var _0x4e65f2={'where':_0x17a161['where']};return db[_0x2a2f('0x3f')][_0x2a2f('0x1f')](_0x4e65f2)[_0x2a2f('0x26')](function(_0xded0ea){_0x128093[_0x2a2f('0x1f')]=_0xded0ea;if(_0x387e5d[_0x2a2f('0x30')][_0x2a2f('0x40')]){_0x17a161[_0x2a2f('0x41')]=[{'all':!![]}];}return db[_0x2a2f('0x3f')][_0x2a2f('0x42')](_0x17a161);})[_0x2a2f('0x26')](function(_0x383420){_0x128093[_0x2a2f('0x43')]=_0x383420;return _0x128093;})[_0x2a2f('0x26')](respondWithFilteredResult(_0x3bcb58,_0x17a161))[_0x2a2f('0x44')](handleError(_0x3bcb58,null));};exports[_0x2a2f('0x45')]=function(_0x46ff11,_0x21b910){var _0x3ecca4={'raw':!![],'where':{'id':_0x46ff11[_0x2a2f('0x46')]['id']}},_0x9bee1a={};_0x9bee1a[_0x2a2f('0x34')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x9bee1a[_0x2a2f('0x30')]=_[_0x2a2f('0x31')](_0x46ff11[_0x2a2f('0x30')]);_0x9bee1a[_0x2a2f('0x32')]=_[_0x2a2f('0x33')](_0x9bee1a[_0x2a2f('0x34')],_0x9bee1a['query']);_0x3ecca4[_0x2a2f('0x35')]=_['intersection'](_0x9bee1a['model'],qs[_0x2a2f('0x36')](_0x46ff11[_0x2a2f('0x30')][_0x2a2f('0x36')]));_0x3ecca4[_0x2a2f('0x35')]=_0x3ecca4[_0x2a2f('0x35')][_0x2a2f('0x37')]?_0x3ecca4[_0x2a2f('0x35')]:_0x9bee1a[_0x2a2f('0x34')];if(_0x46ff11[_0x2a2f('0x30')]['includeAll']){_0x3ecca4['include']=[{'all':!![]}];}_0x3ecca4=_[_0x2a2f('0x3d')]({},_0x3ecca4,_0x46ff11[_0x2a2f('0x3e')]);return db[_0x2a2f('0x3f')][_0x2a2f('0x47')](_0x3ecca4)[_0x2a2f('0x26')](handleEntityNotFound(_0x21b910,null))['then'](respondWithResult(_0x21b910,null))[_0x2a2f('0x44')](handleError(_0x21b910,null));};exports[_0x2a2f('0x48')]=function(_0x23af44,_0x28c76f){return db[_0x2a2f('0x3f')][_0x2a2f('0x48')](_0x23af44[_0x2a2f('0x49')],{})[_0x2a2f('0x26')](respondWithResult(_0x28c76f,0xc9))[_0x2a2f('0x44')](handleError(_0x28c76f,null));};exports[_0x2a2f('0x25')]=function(_0x13a0ee,_0x4be0bf){if(_0x13a0ee[_0x2a2f('0x49')]['id']){delete _0x13a0ee[_0x2a2f('0x49')]['id'];}return db[_0x2a2f('0x3f')][_0x2a2f('0x47')]({'where':{'id':_0x13a0ee['params']['id']}})[_0x2a2f('0x26')](handleEntityNotFound(_0x4be0bf,null))[_0x2a2f('0x26')](saveUpdates(_0x13a0ee[_0x2a2f('0x49')],null))[_0x2a2f('0x26')](respondWithResult(_0x4be0bf,null))[_0x2a2f('0x44')](handleError(_0x4be0bf,null));};exports[_0x2a2f('0x4a')]=function(_0x28a401,_0x3b0296,_0x44210f){var _0x468379=require('../../components/encryptor');var _0x56fb3a=![];var _0x17236d={};if(_0x28a401[_0x2a2f('0x30')][_0x2a2f('0x2d')]&&_0x28a401[_0x2a2f('0x30')][_0x2a2f('0x2d')]==='uniqueid'){_0x17236d[_0x2a2f('0x4b')]=_0x28a401['params']['id'];}else{_0x17236d['id']=_0x28a401['params']['id'];}return db[_0x2a2f('0x3f')][_0x2a2f('0x47')]({'where':_0x17236d,'attributes':['id',_0x2a2f('0x4c'),'filename'],'raw':!![]})[_0x2a2f('0x26')](handleEntityNotFound(_0x3b0296,null))['then'](function(_0x2e5850){if(_0x2e5850){var _0x587da2=_0x2e5850[_0x2a2f('0x4c')];var _0x4c1a79=util[_0x2a2f('0x4d')](_0x2a2f('0x4e'),_0x587da2);if(fs[_0x2a2f('0x4f')](_0x4c1a79)){_0x56fb3a=!![];return _0x468379[_0x2a2f('0x50')](_0x4c1a79,_0x587da2,config[_0x2a2f('0x51')][_0x2a2f('0x52')])[_0x2a2f('0x26')](function(){return _0x2e5850;});}return _0x2e5850;}})['then'](function(_0x48cc2a){if(_0x48cc2a){var _0x553e74=_0x48cc2a[_0x2a2f('0x4c')];if(!fs[_0x2a2f('0x4f')](_0x553e74)){throw new db[(_0x2a2f('0x53'))]['ValidationError'](_0x2a2f('0x54'));}if(_0x48cc2a[_0x2a2f('0x55')]){return _0x3b0296[_0x2a2f('0x4a')](_0x553e74,_0x48cc2a['filename']+path[_0x2a2f('0x56')](_0x553e74),function(){if(_0x56fb3a){fs['unlink'](_0x553e74);}});}else{return _0x3b0296[_0x2a2f('0x4a')](_0x553e74,function(_0x4bc203){if(_0x56fb3a){fs['unlink'](_0x553e74);}});}}})[_0x2a2f('0x44')](function(_0x4f4da6){if(_0x4f4da6[_0x2a2f('0x57')]===_0x2a2f('0x54')){_0x3b0296[_0x2a2f('0x19')](0x194)[_0x2a2f('0x2a')](_0x2a2f('0x58'));}else{return handleError(_0x3b0296,null);}});};exports[_0x2a2f('0x59')]=function(_0x11cef2,_0x2a9d73){return db['SquareRecording']['find']({'where':{'id':_0x11cef2[_0x2a2f('0x46')]['id']}})[_0x2a2f('0x26')](function(_0x32d369){if(_['isNil'](_0x32d369)){throw new ReferenceError(_0x2a2f('0x5a'));}return _0x32d369;})['then'](function(_0x3956d3){var _0x1431ec=_0x3956d3['savePath'];logger[_0x2a2f('0x5b')](_0x2a2f('0x5c'),_0x1431ec);if(!_[_0x2a2f('0x5d')](_0x3956d3[_0x2a2f('0x4c')])&&fs[_0x2a2f('0x4f')](_0x1431ec)){logger[_0x2a2f('0x5b')](_0x2a2f('0x5e')+_0x1431ec+_0x2a2f('0x5f'));fs[_0x2a2f('0x60')](_0x1431ec);}_0x1431ec=_0x1431ec+'.cypher';if(!_[_0x2a2f('0x5d')](_0x3956d3[_0x2a2f('0x4c')])&&fs[_0x2a2f('0x4f')](_0x1431ec)){logger[_0x2a2f('0x5b')](_0x2a2f('0x5e')+_0x1431ec+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2a2f('0x60')](_0x1431ec);}return _0x3956d3;})[_0x2a2f('0x26')](function(_0x1fdf48){if(!_0x1fdf48)throw new InternalError();return _0x1fdf48[_0x2a2f('0x59')]();})['then'](function(){_0x2a9d73[_0x2a2f('0x19')](0xcc)[_0x2a2f('0x1a')]();})[_0x2a2f('0x44')](handleError(_0x2a9d73,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a6e3f52..abc8b00 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 _0xbc48=['rimraf','./squareRecording.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x333eee,_0x11151a){var _0x5ae390=function(_0x2cac79){while(--_0x2cac79){_0x333eee['push'](_0x333eee['shift']());}};_0x5ae390(++_0x11151a);}(_0xbc48,0x111));var _0x8bc4=function(_0x26f3bd,_0x18f48e){_0x26f3bd=_0x26f3bd-0x0;var _0x4e66be=_0xbc48[_0x26f3bd];return _0x4e66be;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var logger=require(_0x8bc4('0x2'))(_0x8bc4('0x3'));var moment=require('moment');var BPromise=require(_0x8bc4('0x4'));var rp=require(_0x8bc4('0x5'));var fs=require('fs');var path=require(_0x8bc4('0x6'));var rimraf=require(_0x8bc4('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bc4('0x8'));module['exports']=function(_0x59e2cc,_0x5ebb13){return _0x59e2cc[_0x8bc4('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4815=['bluebird','request-promise','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x41e06a,_0x114bf5){var _0xcbd790=function(_0x2a2234){while(--_0x2a2234){_0x41e06a['push'](_0x41e06a['shift']());}};_0xcbd790(++_0x114bf5);}(_0x4815,0xff));var _0x5481=function(_0x338e0f,_0x2a2244){_0x338e0f=_0x338e0f-0x0;var _0x3f7ca5=_0x4815[_0x338e0f];return _0x3f7ca5;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var logger=require(_0x5481('0x2'))(_0x5481('0x3'));var moment=require(_0x5481('0x4'));var BPromise=require(_0x5481('0x5'));var rp=require(_0x5481('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5481('0x7'));var attributes=require(_0x5481('0x8'));module[_0x5481('0x9')]=function(_0x3de2c3,_0xa91d26){return _0x3de2c3[_0x5481('0xa')](_0x5481('0xb'),attributes,{'tableName':_0x5481('0xc'),'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 84f40a7..c085f93 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 _0x7c7f=['../../config/logger','../../config/environment','request','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareRecording,\x20%s,\x20%s','message','info','result','CreateSquareRecording','create','options','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x312b37,_0x19f474){var _0x2e5f91=function(_0x19473d){while(--_0x19473d){_0x312b37['push'](_0x312b37['shift']());}};_0x2e5f91(++_0x19f474);}(_0x7c7f,0x125));var _0xf7c7=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x7c7f[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xf7c7('0x0'));var util=require('util');var moment=require(_0xf7c7('0x1'));var BPromise=require(_0xf7c7('0x2'));var rs=require(_0xf7c7('0x3'));var fs=require('fs');var Redis=require(_0xf7c7('0x4'));var db=require(_0xf7c7('0x5'))['db'];var utils=require(_0xf7c7('0x6'));var logger=require(_0xf7c7('0x7'))('rpc');var config=require(_0xf7c7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25e188,_0x56b6a4,_0x1b06ed){return new BPromise(function(_0x4e540b,_0x1121ff){return client[_0xf7c7('0x9')](_0x25e188,_0x1b06ed)[_0xf7c7('0xa')](function(_0x121d3c){logger['info']('SquareRecording,\x20%s,\x20%s',_0x56b6a4,_0xf7c7('0xb'));logger['debug'](_0xf7c7('0xc'),_0x56b6a4,'request\x20sent',JSON[_0xf7c7('0xd')](_0x121d3c));if(_0x121d3c['error']){if(_0x121d3c['error'][_0xf7c7('0xe')]===0x1f4){logger[_0xf7c7('0xf')](_0xf7c7('0x10'),_0x56b6a4,_0x121d3c[_0xf7c7('0xf')][_0xf7c7('0x11')]);return _0x1121ff(_0x121d3c[_0xf7c7('0xf')][_0xf7c7('0x11')]);}logger[_0xf7c7('0xf')]('SquareRecording,\x20%s,\x20%s',_0x56b6a4,_0x121d3c[_0xf7c7('0xf')][_0xf7c7('0x11')]);return _0x4e540b(_0x121d3c[_0xf7c7('0xf')][_0xf7c7('0x11')]);}else{logger[_0xf7c7('0x12')](_0xf7c7('0x10'),_0x56b6a4,'request\x20sent');_0x4e540b(_0x121d3c[_0xf7c7('0x13')][_0xf7c7('0x11')]);}})['catch'](function(_0x459fab){logger[_0xf7c7('0xf')](_0xf7c7('0x10'),_0x56b6a4,_0x459fab);_0x1121ff(_0x459fab);});});}exports[_0xf7c7('0x14')]=function(_0x1e46cc){var _0x477e61=this;return new Promise(function(_0x12e68e,_0x1580c1){return db['SquareRecording'][_0xf7c7('0x15')](_0x1e46cc['body'],{'raw':_0x1e46cc[_0xf7c7('0x16')]?_0x1e46cc[_0xf7c7('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xf7c7('0xa')](function(_0x35e8da){logger[_0xf7c7('0x12')](_0xf7c7('0x14'),_0x1e46cc);logger[_0xf7c7('0x17')](_0xf7c7('0x14'),_0x1e46cc,JSON[_0xf7c7('0xd')](_0x35e8da));_0x12e68e(_0x35e8da);})[_0xf7c7('0x18')](function(_0x4181d9){logger[_0xf7c7('0xf')](_0xf7c7('0x14'),_0x4181d9[_0xf7c7('0x11')],_0x1e46cc);_0x1580c1(_0x477e61[_0xf7c7('0xf')](0x1f4,_0x4181d9['message']));});});}; \ No newline at end of file +var _0xa2f8=['info','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then'];(function(_0x4c76ac,_0x4d92ba){var _0x1f032a=function(_0x38baa3){while(--_0x38baa3){_0x4c76ac['push'](_0x4c76ac['shift']());}};_0x1f032a(++_0x4d92ba);}(_0xa2f8,0x71));var _0x8a2f=function(_0x53467b,_0x1a69e3){_0x53467b=_0x53467b-0x0;var _0x40de3c=_0xa2f8[_0x53467b];return _0x40de3c;};'use strict';var _=require(_0x8a2f('0x0'));var util=require(_0x8a2f('0x1'));var moment=require('moment');var BPromise=require(_0x8a2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2f('0x4'));var logger=require(_0x8a2f('0x5'))(_0x8a2f('0x6'));var config=require(_0x8a2f('0x7'));var jayson=require(_0x8a2f('0x8'));var client=jayson[_0x8a2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4da807,_0x3ec569,_0x3093ce){return new BPromise(function(_0x3d49a9,_0x6620e9){return client[_0x8a2f('0xa')](_0x4da807,_0x3093ce)['then'](function(_0x273d30){logger['info'](_0x8a2f('0xb'),_0x3ec569,_0x8a2f('0xc'));logger['debug'](_0x8a2f('0xd'),_0x3ec569,_0x8a2f('0xc'),JSON[_0x8a2f('0xe')](_0x273d30));if(_0x273d30[_0x8a2f('0xf')]){if(_0x273d30['error'][_0x8a2f('0x10')]===0x1f4){logger['error'](_0x8a2f('0xb'),_0x3ec569,_0x273d30[_0x8a2f('0xf')][_0x8a2f('0x11')]);return _0x6620e9(_0x273d30['error'][_0x8a2f('0x11')]);}logger[_0x8a2f('0xf')](_0x8a2f('0xb'),_0x3ec569,_0x273d30[_0x8a2f('0xf')]['message']);return _0x3d49a9(_0x273d30[_0x8a2f('0xf')][_0x8a2f('0x11')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x3ec569,'request\x20sent');_0x3d49a9(_0x273d30[_0x8a2f('0x12')][_0x8a2f('0x11')]);}})[_0x8a2f('0x13')](function(_0x1e761f){logger[_0x8a2f('0xf')](_0x8a2f('0xb'),_0x3ec569,_0x1e761f);_0x6620e9(_0x1e761f);});});}exports[_0x8a2f('0x14')]=function(_0x277e3b){var _0x1eb868=this;return new Promise(function(_0x18aec6,_0x5a4900){return db[_0x8a2f('0x15')][_0x8a2f('0x16')](_0x277e3b[_0x8a2f('0x17')],{'raw':_0x277e3b[_0x8a2f('0x18')]?_0x277e3b[_0x8a2f('0x18')][_0x8a2f('0x19')]===undefined?!![]:![]:!![]})[_0x8a2f('0x1a')](function(_0x31f843){logger[_0x8a2f('0x1b')](_0x8a2f('0x14'),_0x277e3b);logger['debug'](_0x8a2f('0x14'),_0x277e3b,JSON[_0x8a2f('0xe')](_0x31f843));_0x18aec6(_0x31f843);})[_0x8a2f('0x13')](function(_0x64e3d8){logger[_0x8a2f('0xf')](_0x8a2f('0x14'),_0x64e3d8['message'],_0x277e3b);_0x5a4900(_0x1eb868[_0x8a2f('0xf')](0x1f4,_0x64e3d8[_0x8a2f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index aeade04..fd81dca 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1b50ba,_0x3181a8){var _0x10c56f=function(_0x240d3c){while(--_0x240d3c){_0x1b50ba['push'](_0x1b50ba['shift']());}};_0x10c56f(++_0x3181a8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x2b4d26,_0x279b45){var _0x1b5a40=function(_0x42837d){while(--_0x42837d){_0x2b4d26['push'](_0x2b4d26['shift']());}};_0x1b5a40(++_0x279b45);}(_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('./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 f906c8b..4e62abf 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 _0x43c9=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x48bcc2,_0x459a71){var _0x240728=function(_0x378f74){while(--_0x378f74){_0x48bcc2['push'](_0x48bcc2['shift']());}};_0x240728(++_0x459a71);}(_0x43c9,0x1b2));var _0x943c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x43c9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x943c('0x0'));module[_0x943c('0x1')]={'network':{'type':Sequelize[_0x943c('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x943c('0x2')]},'channel':{'type':Sequelize[_0x943c('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x943c('0x2')]},'uniqueid':{'type':Sequelize[_0x943c('0x2')]},'version':{'type':Sequelize[_0x943c('0x2')]},'callerid':{'type':Sequelize[_0x943c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x943c('0x2')]},'callingani2':{'type':Sequelize[_0x943c('0x2')]},'callington':{'type':Sequelize[_0x943c('0x2')]},'callingtns':{'type':Sequelize[_0x943c('0x2')]},'dnid':{'type':Sequelize[_0x943c('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x943c('0x2')]},'accountcode':{'type':Sequelize[_0x943c('0x2')]},'threadid':{'type':Sequelize[_0x943c('0x2')]},'project_name':{'type':Sequelize[_0x943c('0x2')]},'joinAt':{'type':Sequelize[_0x943c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x943c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x184c=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x49f61c,_0x326dd8){var _0x5abdd6=function(_0x3f721d){while(--_0x3f721d){_0x49f61c['push'](_0x49f61c['shift']());}};_0x5abdd6(++_0x326dd8);}(_0x184c,0x1c3));var _0xc184=function(_0x48223f,_0xb5d37e){_0x48223f=_0x48223f-0x0;var _0x4d6911=_0x184c[_0x48223f];return _0x4d6911;};'use strict';var Sequelize=require(_0xc184('0x0'));module[_0xc184('0x1')]={'network':{'type':Sequelize[_0xc184('0x2')]},'network_script':{'type':Sequelize[_0xc184('0x2')]},'request':{'type':Sequelize[_0xc184('0x2')]},'channel':{'type':Sequelize[_0xc184('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc184('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc184('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xc184('0x2')]},'callingani2':{'type':Sequelize[_0xc184('0x2')]},'callington':{'type':Sequelize[_0xc184('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc184('0x2')]},'rdnis':{'type':Sequelize[_0xc184('0x2')]},'context':{'type':Sequelize[_0xc184('0x2')]},'extension':{'type':Sequelize[_0xc184('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xc184('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc184('0x2')]},'joinAt':{'type':Sequelize[_0xc184('0x3')]},'leaveAt':{'type':Sequelize[_0xc184('0x3')]},'bot':{'type':Sequelize[_0xc184('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8e8f7d0..528c6e7 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 _0xe8f1=['show','params','keys','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0xf8886b,_0x504891){var _0x321bd5=function(_0x3c116b){while(--_0x3c116b){_0xf8886b['push'](_0xf8886b['shift']());}};_0x321bd5(++_0x504891);}(_0xe8f1,0x92));var _0x1e8f=function(_0x2838e7,_0x58d4fb){_0x2838e7=_0x2838e7-0x0;var _0x53b163=_0xe8f1[_0x2838e7];return _0x53b163;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e8f('0x0'));var zipdir=require(_0x1e8f('0x1'));var jsonpatch=require(_0x1e8f('0x2'));var rp=require(_0x1e8f('0x3'));var moment=require('moment');var BPromise=require(_0x1e8f('0x4'));var Mustache=require('mustache');var util=require(_0x1e8f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1e8f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e8f('0x7'));var squel=require(_0x1e8f('0x8'));var crypto=require('crypto');var jsforce=require(_0x1e8f('0x9'));var deskjs=require(_0x1e8f('0xa'));var toCsv=require(_0x1e8f('0x6'));var querystring=require(_0x1e8f('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e8f('0xc'));var as=require(_0x1e8f('0xd'));var hardwareService=require(_0x1e8f('0xe'));var logger=require(_0x1e8f('0xf'))('api');var utils=require(_0x1e8f('0x10'));var config=require(_0x1e8f('0x11'));var licenseUtil=require(_0x1e8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2227a7,_0x5b159d){_0x5b159d=_0x5b159d||0xcc;return function(_0x288dfe){if(_0x288dfe){return _0x2227a7['sendStatus'](_0x5b159d);}return _0x2227a7['status'](_0x5b159d)['end']();};}function respondWithResult(_0x507e0a,_0x143b9c){_0x143b9c=_0x143b9c||0xc8;return function(_0x4d6118){if(_0x4d6118){return _0x507e0a[_0x1e8f('0x13')](_0x143b9c)[_0x1e8f('0x14')](_0x4d6118);}};}function respondWithFilteredResult(_0x1f3b8c,_0x3fe024){return function(_0x70c545){if(_0x70c545){var _0x22fcdb=typeof _0x3fe024[_0x1e8f('0x15')]===_0x1e8f('0x16')&&typeof _0x3fe024[_0x1e8f('0x17')]===_0x1e8f('0x16');var _0x1c4859=_0x70c545['count'];var _0x4d50bc=_0x22fcdb?0x0:_0x3fe024[_0x1e8f('0x15')];var _0x49a592=_0x22fcdb?_0x70c545[_0x1e8f('0x18')]:_0x3fe024['offset']+_0x3fe024[_0x1e8f('0x17')];var _0xaed52a;if(_0x49a592>=_0x1c4859){_0x49a592=_0x1c4859;_0xaed52a=0xc8;}else{_0xaed52a=0xce;}_0x1f3b8c[_0x1e8f('0x13')](_0xaed52a);return _0x1f3b8c['set'](_0x1e8f('0x19'),_0x4d50bc+'-'+_0x49a592+'/'+_0x1c4859)[_0x1e8f('0x14')](_0x70c545);}return null;};}function patchUpdates(_0x4acb63){return function(_0x553591){try{jsonpatch[_0x1e8f('0x1a')](_0x553591,_0x4acb63,!![]);}catch(_0x26a559){return BPromise[_0x1e8f('0x1b')](_0x26a559);}return _0x553591[_0x1e8f('0x1c')]();};}function saveUpdates(_0x5db2f5,_0x2ef334){return function(_0x19cde3){if(_0x19cde3){return _0x19cde3['update'](_0x5db2f5)['then'](function(_0x5521de){return _0x5521de;});}return null;};}function removeEntity(_0x13cb0a,_0x2ea1a4){return function(_0x20772e){if(_0x20772e){return _0x20772e[_0x1e8f('0x1d')]()[_0x1e8f('0x1e')](function(){_0x13cb0a[_0x1e8f('0x13')](0xcc)[_0x1e8f('0x1f')]();});}};}function handleEntityNotFound(_0x1851f3,_0x258783){return function(_0x4bcb6){if(!_0x4bcb6){_0x1851f3[_0x1e8f('0x20')](0x194);}return _0x4bcb6;};}function handleError(_0x369d4e,_0x3b6613){_0x3b6613=_0x3b6613||0x1f4;return function(_0x342747){logger[_0x1e8f('0x21')](_0x342747[_0x1e8f('0x22')]);if(_0x342747[_0x1e8f('0x23')]){delete _0x342747[_0x1e8f('0x23')];}_0x369d4e['status'](_0x3b6613)[_0x1e8f('0x24')](_0x342747);};}exports[_0x1e8f('0x25')]=function(_0x4d6122,_0x335643){var _0x24b67f={},_0x2c7ddb={},_0x5e9795={'count':0x0,'rows':[]};var _0xf128fd=_[_0x1e8f('0x26')](db[_0x1e8f('0x27')][_0x1e8f('0x28')],function(_0x419086){return{'name':_0x419086['fieldName'],'type':_0x419086[_0x1e8f('0x29')][_0x1e8f('0x2a')]};});_0x2c7ddb[_0x1e8f('0x2b')]=_['map'](_0xf128fd,_0x1e8f('0x23'));_0x2c7ddb[_0x1e8f('0x2c')]=_['keys'](_0x4d6122[_0x1e8f('0x2c')]);_0x2c7ddb[_0x1e8f('0x2d')]=_['intersection'](_0x2c7ddb[_0x1e8f('0x2b')],_0x2c7ddb[_0x1e8f('0x2c')]);_0x24b67f[_0x1e8f('0x2e')]=_['intersection'](_0x2c7ddb['model'],qs[_0x1e8f('0x2f')](_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x2f')]));_0x24b67f[_0x1e8f('0x2e')]=_0x24b67f[_0x1e8f('0x2e')][_0x1e8f('0x30')]?_0x24b67f['attributes']:_0x2c7ddb[_0x1e8f('0x2b')];if(!_0x4d6122['query'][_0x1e8f('0x31')](_0x1e8f('0x32'))){_0x24b67f[_0x1e8f('0x17')]=qs[_0x1e8f('0x17')](_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x17')]);_0x24b67f[_0x1e8f('0x15')]=qs[_0x1e8f('0x15')](_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x15')]);}_0x24b67f['order']=qs[_0x1e8f('0x33')](_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x33')]);_0x24b67f[_0x1e8f('0x34')]=qs[_0x1e8f('0x2d')](_['pick'](_0x4d6122['query'],_0x2c7ddb[_0x1e8f('0x2d')]),_0xf128fd);if(_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x35')]){_0x24b67f[_0x1e8f('0x34')]=_['merge'](_0x24b67f[_0x1e8f('0x34')],{'$or':_[_0x1e8f('0x26')](_0xf128fd,function(_0x1eb68d){if(_0x1eb68d[_0x1e8f('0x29')]!=='VIRTUAL'){var _0xfd42eb={};_0xfd42eb[_0x1eb68d[_0x1e8f('0x23')]]={'$like':'%'+_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x35')]+'%'};return _0xfd42eb;}})});}_0x24b67f=_[_0x1e8f('0x36')]({},_0x24b67f,_0x4d6122[_0x1e8f('0x37')]);var _0x4a22fb={'where':_0x24b67f[_0x1e8f('0x34')]};return db['SquareReport'][_0x1e8f('0x18')](_0x4a22fb)[_0x1e8f('0x1e')](function(_0x288f08){_0x5e9795['count']=_0x288f08;if(_0x4d6122[_0x1e8f('0x2c')][_0x1e8f('0x38')]){_0x24b67f[_0x1e8f('0x39')]=[{'all':!![]}];}return db['SquareReport'][_0x1e8f('0x3a')](_0x24b67f);})[_0x1e8f('0x1e')](function(_0x1b9587){_0x5e9795[_0x1e8f('0x3b')]=_0x1b9587;return _0x5e9795;})['then'](respondWithFilteredResult(_0x335643,_0x24b67f))[_0x1e8f('0x3c')](handleError(_0x335643,null));};exports[_0x1e8f('0x3d')]=function(_0x2ff609,_0x49174){var _0x51b6f4={'raw':!![],'where':{'id':_0x2ff609[_0x1e8f('0x3e')]['id']}},_0x11fb43={};_0x11fb43[_0x1e8f('0x2b')]=_[_0x1e8f('0x3f')](db[_0x1e8f('0x27')]['rawAttributes']);_0x11fb43[_0x1e8f('0x2c')]=_['keys'](_0x2ff609['query']);_0x11fb43[_0x1e8f('0x2d')]=_[_0x1e8f('0x40')](_0x11fb43[_0x1e8f('0x2b')],_0x11fb43[_0x1e8f('0x2c')]);_0x51b6f4['attributes']=_[_0x1e8f('0x40')](_0x11fb43[_0x1e8f('0x2b')],qs['fields'](_0x2ff609[_0x1e8f('0x2c')][_0x1e8f('0x2f')]));_0x51b6f4[_0x1e8f('0x2e')]=_0x51b6f4[_0x1e8f('0x2e')]['length']?_0x51b6f4[_0x1e8f('0x2e')]:_0x11fb43[_0x1e8f('0x2b')];if(_0x2ff609['query'][_0x1e8f('0x38')]){_0x51b6f4[_0x1e8f('0x39')]=[{'all':!![]}];}_0x51b6f4=_[_0x1e8f('0x36')]({},_0x51b6f4,_0x2ff609[_0x1e8f('0x37')]);return db[_0x1e8f('0x27')][_0x1e8f('0x41')](_0x51b6f4)[_0x1e8f('0x1e')](handleEntityNotFound(_0x49174,null))[_0x1e8f('0x1e')](respondWithResult(_0x49174,null))[_0x1e8f('0x3c')](handleError(_0x49174,null));};exports[_0x1e8f('0x42')]=function(_0x2188f1,_0x58522e){return db['SquareReport'][_0x1e8f('0x42')](_0x2188f1['body'],{})['then'](respondWithResult(_0x58522e,0xc9))[_0x1e8f('0x3c')](handleError(_0x58522e,null));};exports['update']=function(_0xabe491,_0x3c6691){if(_0xabe491[_0x1e8f('0x43')]['id']){delete _0xabe491[_0x1e8f('0x43')]['id'];}return db['SquareReport'][_0x1e8f('0x41')]({'where':{'id':_0xabe491['params']['id']}})[_0x1e8f('0x1e')](handleEntityNotFound(_0x3c6691,null))[_0x1e8f('0x1e')](saveUpdates(_0xabe491[_0x1e8f('0x43')],null))[_0x1e8f('0x1e')](respondWithResult(_0x3c6691,null))[_0x1e8f('0x3c')](handleError(_0x3c6691,null));};exports[_0x1e8f('0x1d')]=function(_0x3e55ce,_0xd97fe0){return db[_0x1e8f('0x27')][_0x1e8f('0x41')]({'where':{'id':_0x3e55ce[_0x1e8f('0x3e')]['id']}})[_0x1e8f('0x1e')](handleEntityNotFound(_0xd97fe0,null))['then'](removeEntity(_0xd97fe0,null))[_0x1e8f('0x3c')](handleError(_0xd97fe0,null));};exports[_0x1e8f('0x44')]=function(_0x593579,_0x23d823){return db[_0x1e8f('0x27')][_0x1e8f('0x44')]()[_0x1e8f('0x1e')](respondWithResult(_0x23d823,null))[_0x1e8f('0x3c')](handleError(_0x23d823,null));}; \ No newline at end of file +var _0xc4e9=['merge','options','includeAll','include','rows','catch','show','params','rawAttributes','filters','find','create','body','destroy','describe','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','SquareReport','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4e9,0x1d1));var _0x9c4e=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0xc4e9[_0xd5709b];return _0x3dc484;};'use strict';var emlformat=require(_0x9c4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c4e('0x1'));var jsonpatch=require(_0x9c4e('0x2'));var rp=require(_0x9c4e('0x3'));var moment=require(_0x9c4e('0x4'));var BPromise=require(_0x9c4e('0x5'));var Mustache=require(_0x9c4e('0x6'));var util=require('util');var path=require(_0x9c4e('0x7'));var sox=require(_0x9c4e('0x8'));var csv=require(_0x9c4e('0x9'));var ejs=require(_0x9c4e('0xa'));var fs=require('fs');var fs_extra=require(_0x9c4e('0xb'));var _=require(_0x9c4e('0xc'));var squel=require(_0x9c4e('0xd'));var crypto=require(_0x9c4e('0xe'));var jsforce=require(_0x9c4e('0xf'));var deskjs=require(_0x9c4e('0x10'));var toCsv=require(_0x9c4e('0x9'));var querystring=require(_0x9c4e('0x11'));var Papa=require(_0x9c4e('0x12'));var Redis=require(_0x9c4e('0x13'));var authService=require(_0x9c4e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c4e('0x15'));var logger=require(_0x9c4e('0x16'))(_0x9c4e('0x17'));var utils=require(_0x9c4e('0x18'));var config=require(_0x9c4e('0x19'));var licenseUtil=require(_0x9c4e('0x1a'));var db=require(_0x9c4e('0x1b'))['db'];function respondWithStatusCode(_0x16c231,_0x4e91ca){_0x4e91ca=_0x4e91ca||0xcc;return function(_0x3e8534){if(_0x3e8534){return _0x16c231['sendStatus'](_0x4e91ca);}return _0x16c231[_0x9c4e('0x1c')](_0x4e91ca)[_0x9c4e('0x1d')]();};}function respondWithResult(_0x560116,_0x1b71eb){_0x1b71eb=_0x1b71eb||0xc8;return function(_0x276881){if(_0x276881){return _0x560116['status'](_0x1b71eb)[_0x9c4e('0x1e')](_0x276881);}};}function respondWithFilteredResult(_0xf1a466,_0x3987f7){return function(_0x19d89f){if(_0x19d89f){var _0x13f52e=typeof _0x3987f7[_0x9c4e('0x1f')]===_0x9c4e('0x20')&&typeof _0x3987f7['limit']===_0x9c4e('0x20');var _0x490512=_0x19d89f[_0x9c4e('0x21')];var _0x5a3e38=_0x13f52e?0x0:_0x3987f7[_0x9c4e('0x1f')];var _0x4c9873=_0x13f52e?_0x19d89f[_0x9c4e('0x21')]:_0x3987f7[_0x9c4e('0x1f')]+_0x3987f7[_0x9c4e('0x22')];var _0x38c87a;if(_0x4c9873>=_0x490512){_0x4c9873=_0x490512;_0x38c87a=0xc8;}else{_0x38c87a=0xce;}_0xf1a466[_0x9c4e('0x1c')](_0x38c87a);return _0xf1a466[_0x9c4e('0x23')]('Content-Range',_0x5a3e38+'-'+_0x4c9873+'/'+_0x490512)[_0x9c4e('0x1e')](_0x19d89f);}return null;};}function patchUpdates(_0x465476){return function(_0x147142){try{jsonpatch[_0x9c4e('0x24')](_0x147142,_0x465476,!![]);}catch(_0x2235bd){return BPromise[_0x9c4e('0x25')](_0x2235bd);}return _0x147142['save']();};}function saveUpdates(_0x440dc5,_0x533d93){return function(_0x4f9a74){if(_0x4f9a74){return _0x4f9a74[_0x9c4e('0x26')](_0x440dc5)[_0x9c4e('0x27')](function(_0x537c09){return _0x537c09;});}return null;};}function removeEntity(_0x218c5a,_0x564b8e){return function(_0x13bb1c){if(_0x13bb1c){return _0x13bb1c['destroy']()['then'](function(){_0x218c5a[_0x9c4e('0x1c')](0xcc)[_0x9c4e('0x1d')]();});}};}function handleEntityNotFound(_0x70835d,_0x8cd0de){return function(_0x3f75ef){if(!_0x3f75ef){_0x70835d[_0x9c4e('0x28')](0x194);}return _0x3f75ef;};}function handleError(_0x269791,_0x244efb){_0x244efb=_0x244efb||0x1f4;return function(_0x7d3e2d){logger[_0x9c4e('0x29')](_0x7d3e2d[_0x9c4e('0x2a')]);if(_0x7d3e2d['name']){delete _0x7d3e2d[_0x9c4e('0x2b')];}_0x269791[_0x9c4e('0x1c')](_0x244efb)[_0x9c4e('0x2c')](_0x7d3e2d);};}exports[_0x9c4e('0x2d')]=function(_0x24d76c,_0x23f74e){var _0x4797bf={},_0x22659d={},_0x4a9642={'count':0x0,'rows':[]};var _0x818066=_[_0x9c4e('0x2e')](db[_0x9c4e('0x2f')]['rawAttributes'],function(_0x3d556e){return{'name':_0x3d556e['fieldName'],'type':_0x3d556e[_0x9c4e('0x30')][_0x9c4e('0x31')]};});_0x22659d[_0x9c4e('0x32')]=_[_0x9c4e('0x2e')](_0x818066,_0x9c4e('0x2b'));_0x22659d[_0x9c4e('0x33')]=_[_0x9c4e('0x34')](_0x24d76c[_0x9c4e('0x33')]);_0x22659d['filters']=_[_0x9c4e('0x35')](_0x22659d[_0x9c4e('0x32')],_0x22659d[_0x9c4e('0x33')]);_0x4797bf[_0x9c4e('0x36')]=_[_0x9c4e('0x35')](_0x22659d[_0x9c4e('0x32')],qs[_0x9c4e('0x37')](_0x24d76c[_0x9c4e('0x33')][_0x9c4e('0x37')]));_0x4797bf[_0x9c4e('0x36')]=_0x4797bf['attributes'][_0x9c4e('0x38')]?_0x4797bf[_0x9c4e('0x36')]:_0x22659d[_0x9c4e('0x32')];if(!_0x24d76c[_0x9c4e('0x33')]['hasOwnProperty']('nolimit')){_0x4797bf['limit']=qs[_0x9c4e('0x22')](_0x24d76c[_0x9c4e('0x33')][_0x9c4e('0x22')]);_0x4797bf[_0x9c4e('0x1f')]=qs[_0x9c4e('0x1f')](_0x24d76c[_0x9c4e('0x33')][_0x9c4e('0x1f')]);}_0x4797bf['order']=qs[_0x9c4e('0x39')](_0x24d76c[_0x9c4e('0x33')][_0x9c4e('0x39')]);_0x4797bf[_0x9c4e('0x3a')]=qs['filters'](_[_0x9c4e('0x3b')](_0x24d76c[_0x9c4e('0x33')],_0x22659d['filters']),_0x818066);if(_0x24d76c[_0x9c4e('0x33')]['filter']){_0x4797bf[_0x9c4e('0x3a')]=_[_0x9c4e('0x3c')](_0x4797bf[_0x9c4e('0x3a')],{'$or':_[_0x9c4e('0x2e')](_0x818066,function(_0x1dfefb){if(_0x1dfefb[_0x9c4e('0x30')]!=='VIRTUAL'){var _0x340c48={};_0x340c48[_0x1dfefb[_0x9c4e('0x2b')]]={'$like':'%'+_0x24d76c['query']['filter']+'%'};return _0x340c48;}})});}_0x4797bf=_[_0x9c4e('0x3c')]({},_0x4797bf,_0x24d76c[_0x9c4e('0x3d')]);var _0x1fa305={'where':_0x4797bf[_0x9c4e('0x3a')]};return db[_0x9c4e('0x2f')]['count'](_0x1fa305)['then'](function(_0x30b1c2){_0x4a9642['count']=_0x30b1c2;if(_0x24d76c['query'][_0x9c4e('0x3e')]){_0x4797bf[_0x9c4e('0x3f')]=[{'all':!![]}];}return db[_0x9c4e('0x2f')]['findAll'](_0x4797bf);})[_0x9c4e('0x27')](function(_0x23e288){_0x4a9642[_0x9c4e('0x40')]=_0x23e288;return _0x4a9642;})[_0x9c4e('0x27')](respondWithFilteredResult(_0x23f74e,_0x4797bf))[_0x9c4e('0x41')](handleError(_0x23f74e,null));};exports[_0x9c4e('0x42')]=function(_0x217181,_0x52808d){var _0x5b0890={'raw':!![],'where':{'id':_0x217181[_0x9c4e('0x43')]['id']}},_0x4efac2={};_0x4efac2[_0x9c4e('0x32')]=_['keys'](db[_0x9c4e('0x2f')][_0x9c4e('0x44')]);_0x4efac2[_0x9c4e('0x33')]=_[_0x9c4e('0x34')](_0x217181[_0x9c4e('0x33')]);_0x4efac2[_0x9c4e('0x45')]=_[_0x9c4e('0x35')](_0x4efac2[_0x9c4e('0x32')],_0x4efac2[_0x9c4e('0x33')]);_0x5b0890[_0x9c4e('0x36')]=_[_0x9c4e('0x35')](_0x4efac2['model'],qs[_0x9c4e('0x37')](_0x217181[_0x9c4e('0x33')][_0x9c4e('0x37')]));_0x5b0890['attributes']=_0x5b0890['attributes'][_0x9c4e('0x38')]?_0x5b0890[_0x9c4e('0x36')]:_0x4efac2['model'];if(_0x217181['query'][_0x9c4e('0x3e')]){_0x5b0890[_0x9c4e('0x3f')]=[{'all':!![]}];}_0x5b0890=_[_0x9c4e('0x3c')]({},_0x5b0890,_0x217181[_0x9c4e('0x3d')]);return db[_0x9c4e('0x2f')][_0x9c4e('0x46')](_0x5b0890)[_0x9c4e('0x27')](handleEntityNotFound(_0x52808d,null))[_0x9c4e('0x27')](respondWithResult(_0x52808d,null))[_0x9c4e('0x41')](handleError(_0x52808d,null));};exports[_0x9c4e('0x47')]=function(_0x424842,_0xc2df8b){return db[_0x9c4e('0x2f')][_0x9c4e('0x47')](_0x424842['body'],{})[_0x9c4e('0x27')](respondWithResult(_0xc2df8b,0xc9))[_0x9c4e('0x41')](handleError(_0xc2df8b,null));};exports[_0x9c4e('0x26')]=function(_0x1f6f26,_0x7bc055){if(_0x1f6f26[_0x9c4e('0x48')]['id']){delete _0x1f6f26[_0x9c4e('0x48')]['id'];}return db[_0x9c4e('0x2f')][_0x9c4e('0x46')]({'where':{'id':_0x1f6f26[_0x9c4e('0x43')]['id']}})[_0x9c4e('0x27')](handleEntityNotFound(_0x7bc055,null))[_0x9c4e('0x27')](saveUpdates(_0x1f6f26['body'],null))[_0x9c4e('0x27')](respondWithResult(_0x7bc055,null))[_0x9c4e('0x41')](handleError(_0x7bc055,null));};exports[_0x9c4e('0x49')]=function(_0x4aeaa5,_0x4c7dc6){return db['SquareReport']['find']({'where':{'id':_0x4aeaa5[_0x9c4e('0x43')]['id']}})[_0x9c4e('0x27')](handleEntityNotFound(_0x4c7dc6,null))[_0x9c4e('0x27')](removeEntity(_0x4c7dc6,null))['catch'](handleError(_0x4c7dc6,null));};exports['describe']=function(_0x68e08,_0x596036){return db[_0x9c4e('0x2f')][_0x9c4e('0x4a')]()[_0x9c4e('0x27')](respondWithResult(_0x596036,null))['catch'](handleError(_0x596036,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a0a76e2..a782d1e 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 _0xbc44=['uid_pname','project_name','leaveAt','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xbc44,0xff));var _0x4bc4=function(_0x1a1413,_0x1422b9){_0x1a1413=_0x1a1413-0x0;var _0x5ada19=_0xbc44[_0x1a1413];return _0x5ada19;};'use strict';var _=require('lodash');var util=require(_0x4bc4('0x0'));var logger=require(_0x4bc4('0x1'))('api');var moment=require(_0x4bc4('0x2'));var BPromise=require(_0x4bc4('0x3'));var rp=require(_0x4bc4('0x4'));var fs=require('fs');var path=require(_0x4bc4('0x5'));var rimraf=require(_0x4bc4('0x6'));var config=require(_0x4bc4('0x7'));var attributes=require(_0x4bc4('0x8'));module['exports']=function(_0x4ed317,_0xa99783){return _0x4ed317['define'](_0x4bc4('0x9'),attributes,{'tableName':_0x4bc4('0xa'),'paranoid':![],'indexes':[{'name':_0x4bc4('0xb'),'fields':['uniqueid',_0x4bc4('0xc')]},{'name':'leaveAt','fields':[_0x4bc4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0140=['report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','exports','define','SquareReport'];(function(_0x1ad68e,_0x16562f){var _0x82d21e=function(_0x755572){while(--_0x755572){_0x1ad68e['push'](_0x1ad68e['shift']());}};_0x82d21e(++_0x16562f);}(_0x0140,0x74));var _0x0014=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0140[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0014('0x0'));var util=require(_0x0014('0x1'));var logger=require(_0x0014('0x2'))(_0x0014('0x3'));var moment=require(_0x0014('0x4'));var BPromise=require('bluebird');var rp=require(_0x0014('0x5'));var fs=require('fs');var path=require(_0x0014('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x0014('0x7')]=function(_0x1f2b74,_0x320676){return _0x1f2b74[_0x0014('0x8')](_0x0014('0x9'),attributes,{'tableName':_0x0014('0xa'),'paranoid':![],'indexes':[{'name':_0x0014('0xb'),'fields':['uniqueid',_0x0014('0xc')]},{'name':_0x0014('0xd'),'fields':[_0x0014('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 3304d39..d6b0d03 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 _0x6f98=['../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','stringify','UpdateSquareReport','update','where','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x347884,_0xd8ef37){var _0x2cd3fa=function(_0xbeb1b8){while(--_0xbeb1b8){_0x347884['push'](_0x347884['shift']());}};_0x2cd3fa(++_0xd8ef37);}(_0x6f98,0x73));var _0x86f9=function(_0xb5e4bd,_0x5ce80b){_0xb5e4bd=_0xb5e4bd-0x0;var _0x18c1fd=_0x6f98[_0xb5e4bd];return _0x18c1fd;};'use strict';var _=require(_0x86f9('0x0'));var util=require(_0x86f9('0x1'));var moment=require(_0x86f9('0x2'));var BPromise=require(_0x86f9('0x3'));var rs=require(_0x86f9('0x4'));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(_0x86f9('0x5'));var jayson=require(_0x86f9('0x6'));var client=jayson[_0x86f9('0x7')][_0x86f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59af5f,_0x2ab091,_0x3508cf){return new BPromise(function(_0x45ec7e,_0x38df57){return client[_0x86f9('0x9')](_0x59af5f,_0x3508cf)['then'](function(_0x2d4b44){logger[_0x86f9('0xa')](_0x86f9('0xb'),_0x2ab091,'request\x20sent');logger['debug'](_0x86f9('0xc'),_0x2ab091,_0x86f9('0xd'),JSON['stringify'](_0x2d4b44));if(_0x2d4b44[_0x86f9('0xe')]){if(_0x2d4b44[_0x86f9('0xe')][_0x86f9('0xf')]===0x1f4){logger[_0x86f9('0xe')](_0x86f9('0xb'),_0x2ab091,_0x2d4b44[_0x86f9('0xe')]['message']);return _0x38df57(_0x2d4b44['error']['message']);}logger[_0x86f9('0xe')](_0x86f9('0xb'),_0x2ab091,_0x2d4b44[_0x86f9('0xe')][_0x86f9('0x10')]);return _0x45ec7e(_0x2d4b44[_0x86f9('0xe')][_0x86f9('0x10')]);}else{logger[_0x86f9('0xa')](_0x86f9('0xb'),_0x2ab091,_0x86f9('0xd'));_0x45ec7e(_0x2d4b44[_0x86f9('0x11')]['message']);}})[_0x86f9('0x12')](function(_0x3db505){logger[_0x86f9('0xe')](_0x86f9('0xb'),_0x2ab091,_0x3db505);_0x38df57(_0x3db505);});});}exports[_0x86f9('0x13')]=function(_0x2847bf){var _0x1a699a=this;return new Promise(function(_0x5c0a4d,_0x4ca561){return db[_0x86f9('0x14')][_0x86f9('0x15')](_0x2847bf[_0x86f9('0x16')],{'raw':_0x2847bf[_0x86f9('0x17')]?_0x2847bf[_0x86f9('0x17')][_0x86f9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9c3dff){logger[_0x86f9('0xa')](_0x86f9('0x13'),_0x2847bf);logger['debug'](_0x86f9('0x13'),_0x2847bf,JSON[_0x86f9('0x19')](_0x9c3dff));_0x5c0a4d(_0x9c3dff);})['catch'](function(_0x349cf2){logger[_0x86f9('0xe')](_0x86f9('0x13'),_0x349cf2[_0x86f9('0x10')],_0x2847bf);_0x4ca561(_0x1a699a[_0x86f9('0xe')](0x1f4,_0x349cf2[_0x86f9('0x10')]));});});};exports[_0x86f9('0x1a')]=function(_0x595439){var _0x1df274=this;return new Promise(function(_0x53bda6,_0x4cd550){return db[_0x86f9('0x14')][_0x86f9('0x1b')](_0x595439[_0x86f9('0x16')],{'raw':_0x595439[_0x86f9('0x17')]?_0x595439[_0x86f9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595439[_0x86f9('0x17')]?_0x595439['options'][_0x86f9('0x1c')]||null:null,'attributes':_0x595439[_0x86f9('0x17')]?_0x595439[_0x86f9('0x17')]['attributes']||null:null,'limit':_0x595439[_0x86f9('0x17')]?_0x595439[_0x86f9('0x17')][_0x86f9('0x1d')]||null:null})['then'](function(_0x3e0d42){logger[_0x86f9('0xa')]('UpdateSquareReport',_0x595439);logger['debug'](_0x86f9('0x1a'),_0x595439,JSON[_0x86f9('0x19')](_0x3e0d42));_0x53bda6(_0x3e0d42);})[_0x86f9('0x12')](function(_0x591540){logger[_0x86f9('0xe')](_0x86f9('0x1a'),_0x591540[_0x86f9('0x10')],_0x595439);_0x4cd550(_0x1df274[_0x86f9('0xe')](0x1f4,_0x591540[_0x86f9('0x10')]));});});}; \ No newline at end of file +var _0xa2ef=['update','where','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport'];(function(_0x429370,_0x46ff4c){var _0x41a3ad=function(_0x47d51e){while(--_0x47d51e){_0x429370['push'](_0x429370['shift']());}};_0x41a3ad(++_0x46ff4c);}(_0xa2ef,0x14e));var _0xfa2e=function(_0x5ef528,_0x2ca3f0){_0x5ef528=_0x5ef528-0x0;var _0x3f8651=_0xa2ef[_0x5ef528];return _0x3f8651;};'use strict';var _=require('lodash');var util=require(_0xfa2e('0x0'));var moment=require(_0xfa2e('0x1'));var BPromise=require(_0xfa2e('0x2'));var rs=require(_0xfa2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfa2e('0x4'));var logger=require(_0xfa2e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfa2e('0x6'));var client=jayson[_0xfa2e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1e4a,_0x53df0a,_0x2fac33){return new BPromise(function(_0x50cec8,_0xd86b23){return client['request'](_0x1e1e4a,_0x2fac33)[_0xfa2e('0x8')](function(_0x56d4f1){logger[_0xfa2e('0x9')](_0xfa2e('0xa'),_0x53df0a,'request\x20sent');logger['debug'](_0xfa2e('0xb'),_0x53df0a,'request\x20sent',JSON[_0xfa2e('0xc')](_0x56d4f1));if(_0x56d4f1[_0xfa2e('0xd')]){if(_0x56d4f1[_0xfa2e('0xd')][_0xfa2e('0xe')]===0x1f4){logger[_0xfa2e('0xd')](_0xfa2e('0xa'),_0x53df0a,_0x56d4f1[_0xfa2e('0xd')][_0xfa2e('0xf')]);return _0xd86b23(_0x56d4f1[_0xfa2e('0xd')][_0xfa2e('0xf')]);}logger[_0xfa2e('0xd')](_0xfa2e('0xa'),_0x53df0a,_0x56d4f1[_0xfa2e('0xd')][_0xfa2e('0xf')]);return _0x50cec8(_0x56d4f1[_0xfa2e('0xd')][_0xfa2e('0xf')]);}else{logger[_0xfa2e('0x9')](_0xfa2e('0xa'),_0x53df0a,_0xfa2e('0x10'));_0x50cec8(_0x56d4f1[_0xfa2e('0x11')][_0xfa2e('0xf')]);}})[_0xfa2e('0x12')](function(_0x565a89){logger['error'](_0xfa2e('0xa'),_0x53df0a,_0x565a89);_0xd86b23(_0x565a89);});});}exports[_0xfa2e('0x13')]=function(_0x30acd5){var _0x2eddf7=this;return new Promise(function(_0x44da07,_0x405179){return db[_0xfa2e('0x14')]['create'](_0x30acd5[_0xfa2e('0x15')],{'raw':_0x30acd5[_0xfa2e('0x16')]?_0x30acd5[_0xfa2e('0x16')][_0xfa2e('0x17')]===undefined?!![]:![]:!![]})[_0xfa2e('0x8')](function(_0x1539ce){logger[_0xfa2e('0x9')](_0xfa2e('0x13'),_0x30acd5);logger[_0xfa2e('0x18')](_0xfa2e('0x13'),_0x30acd5,JSON[_0xfa2e('0xc')](_0x1539ce));_0x44da07(_0x1539ce);})[_0xfa2e('0x12')](function(_0x3d5f6f){logger[_0xfa2e('0xd')](_0xfa2e('0x13'),_0x3d5f6f[_0xfa2e('0xf')],_0x30acd5);_0x405179(_0x2eddf7[_0xfa2e('0xd')](0x1f4,_0x3d5f6f['message']));});});};exports[_0xfa2e('0x19')]=function(_0x24bfea){var _0x5972c4=this;return new Promise(function(_0x3bf26f,_0x3793d6){return db[_0xfa2e('0x14')][_0xfa2e('0x1a')](_0x24bfea['body'],{'raw':_0x24bfea[_0xfa2e('0x16')]?_0x24bfea[_0xfa2e('0x16')][_0xfa2e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24bfea[_0xfa2e('0x16')]?_0x24bfea[_0xfa2e('0x16')][_0xfa2e('0x1b')]||null:null,'attributes':_0x24bfea[_0xfa2e('0x16')]?_0x24bfea[_0xfa2e('0x16')][_0xfa2e('0x1c')]||null:null,'limit':_0x24bfea[_0xfa2e('0x16')]?_0x24bfea[_0xfa2e('0x16')][_0xfa2e('0x1d')]||null:null})[_0xfa2e('0x8')](function(_0x532f25){logger['info'](_0xfa2e('0x19'),_0x24bfea);logger[_0xfa2e('0x18')](_0xfa2e('0x19'),_0x24bfea,JSON['stringify'](_0x532f25));_0x3bf26f(_0x532f25);})[_0xfa2e('0x12')](function(_0x5b1ec4){logger[_0xfa2e('0xd')]('UpdateSquareReport',_0x5b1ec4[_0xfa2e('0xf')],_0x24bfea);_0x3793d6(_0x5972c4[_0xfa2e('0xd')](0x1f4,_0x5b1ec4['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7a31312..166e013 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 _0xd662=['../../components/auth/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','/describe','describe','/:id','create','put','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x159164,_0x1e8d49){var _0x3bc384=function(_0x1d6a1d){while(--_0x1d6a1d){_0x159164['push'](_0x159164['shift']());}};_0x3bc384(++_0x1e8d49);}(_0xd662,0x72));var _0x2d66=function(_0xf5d1f5,_0x4494d2){_0xf5d1f5=_0xf5d1f5-0x0;var _0x5f5bbd=_0xd662[_0xf5d1f5];return _0x5f5bbd;};'use strict';var multer=require(_0x2d66('0x0'));var util=require('util');var path=require(_0x2d66('0x1'));var timeout=require(_0x2d66('0x2'));var express=require(_0x2d66('0x3'));var router=express[_0x2d66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d66('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d66('0x6'));var controller=require(_0x2d66('0x7'));router['get']('/',auth[_0x2d66('0x8')](),controller['index']);router[_0x2d66('0x9')](_0x2d66('0xa'),auth[_0x2d66('0x8')](),controller[_0x2d66('0xb')]);router[_0x2d66('0x9')](_0x2d66('0xc'),auth[_0x2d66('0x8')](),controller['show']);router['post']('/',auth[_0x2d66('0x8')](),controller[_0x2d66('0xd')]);router[_0x2d66('0xe')](_0x2d66('0xc'),auth[_0x2d66('0x8')](),controller[_0x2d66('0xf')]);router['delete'](_0x2d66('0xc'),auth[_0x2d66('0x8')](),controller['destroy']);module[_0x2d66('0x10')]=router; \ No newline at end of file +var _0xede2=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x3cb4f9,_0x6f1048){var _0x2cfbde=function(_0x4a6e3a){while(--_0x4a6e3a){_0x3cb4f9['push'](_0x3cb4f9['shift']());}};_0x2cfbde(++_0x6f1048);}(_0xede2,0x1ea));var _0x2ede=function(_0x26c064,_0x304124){_0x26c064=_0x26c064-0x0;var _0x1230d9=_0xede2[_0x26c064];return _0x1230d9;};'use strict';var multer=require(_0x2ede('0x0'));var util=require('util');var path=require(_0x2ede('0x1'));var timeout=require(_0x2ede('0x2'));var express=require(_0x2ede('0x3'));var router=express[_0x2ede('0x4')]();var fs_extra=require(_0x2ede('0x5'));var auth=require(_0x2ede('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2ede('0x7'));var controller=require(_0x2ede('0x8'));router[_0x2ede('0x9')]('/',auth[_0x2ede('0xa')](),controller['index']);router[_0x2ede('0x9')]('/describe',auth[_0x2ede('0xa')](),controller[_0x2ede('0xb')]);router[_0x2ede('0x9')](_0x2ede('0xc'),auth[_0x2ede('0xa')](),controller['show']);router[_0x2ede('0xd')]('/',auth['isAuthenticated'](),controller[_0x2ede('0xe')]);router[_0x2ede('0xf')]('/:id',auth[_0x2ede('0xa')](),controller[_0x2ede('0x10')]);router[_0x2ede('0x11')]('/:id',auth[_0x2ede('0xa')](),controller[_0x2ede('0x12')]);module[_0x2ede('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 e1fc92a..8a52922 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 _0xb997=['STRING','TEXT','sequelize','exports'];(function(_0x17c261,_0x331bd8){var _0x50e487=function(_0x4803b4){while(--_0x4803b4){_0x17c261['push'](_0x17c261['shift']());}};_0x50e487(++_0x331bd8);}(_0xb997,0x1be));var _0x7b99=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0xb997[_0x45518f];return _0x198175;};'use strict';var Sequelize=require(_0x7b99('0x0'));module[_0x7b99('0x1')]={'uniqueid':{'type':Sequelize[_0x7b99('0x2')]},'node':{'type':Sequelize[_0x7b99('0x2')]},'application':{'type':Sequelize[_0x7b99('0x2')]},'data':{'type':Sequelize[_0x7b99('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e5e=['exports','STRING','sequelize'];(function(_0x2b6e8d,_0x31d0fa){var _0x210c69=function(_0x35d8b0){while(--_0x35d8b0){_0x2b6e8d['push'](_0x2b6e8d['shift']());}};_0x210c69(++_0x31d0fa);}(_0x3e5e,0x12e));var _0xe3e5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3e5e[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xe3e5('0x0'));module[_0xe3e5('0x1')]={'uniqueid':{'type':Sequelize[_0xe3e5('0x2')]},'node':{'type':Sequelize[_0xe3e5('0x2')]},'application':{'type':Sequelize[_0xe3e5('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xe3e5('0x2')]},'callerid':{'type':Sequelize[_0xe3e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 75b7813..184e9ea 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 _0x9de9=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','VIRTUAL','filter','options','includeAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x149c86,_0xc107c8){var _0x56a1ec=function(_0xefbbda){while(--_0xefbbda){_0x149c86['push'](_0x149c86['shift']());}};_0x56a1ec(++_0xc107c8);}(_0x9de9,0x91));var _0x99de=function(_0x447610,_0x405360){_0x447610=_0x447610-0x0;var _0x52438e=_0x9de9[_0x447610];return _0x52438e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99de('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99de('0x1'));var rp=require(_0x99de('0x2'));var moment=require(_0x99de('0x3'));var BPromise=require(_0x99de('0x4'));var Mustache=require(_0x99de('0x5'));var util=require(_0x99de('0x6'));var path=require(_0x99de('0x7'));var sox=require(_0x99de('0x8'));var csv=require(_0x99de('0x9'));var ejs=require(_0x99de('0xa'));var fs=require('fs');var fs_extra=require(_0x99de('0xb'));var _=require(_0x99de('0xc'));var squel=require(_0x99de('0xd'));var crypto=require(_0x99de('0xe'));var jsforce=require(_0x99de('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x99de('0x9'));var querystring=require(_0x99de('0x10'));var Papa=require('papaparse');var Redis=require(_0x99de('0x11'));var authService=require(_0x99de('0x12'));var qs=require(_0x99de('0x13'));var as=require(_0x99de('0x14'));var hardwareService=require(_0x99de('0x15'));var logger=require(_0x99de('0x16'))(_0x99de('0x17'));var utils=require(_0x99de('0x18'));var config=require(_0x99de('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x99de('0x1a'))['db'];function respondWithStatusCode(_0x102632,_0x2b8337){_0x2b8337=_0x2b8337||0xcc;return function(_0x259fb6){if(_0x259fb6){return _0x102632[_0x99de('0x1b')](_0x2b8337);}return _0x102632['status'](_0x2b8337)['end']();};}function respondWithResult(_0x11fa2a,_0xff47df){_0xff47df=_0xff47df||0xc8;return function(_0x48daf9){if(_0x48daf9){return _0x11fa2a[_0x99de('0x1c')](_0xff47df)[_0x99de('0x1d')](_0x48daf9);}};}function respondWithFilteredResult(_0x4ff7a1,_0x23ceae){return function(_0x35dc11){if(_0x35dc11){var _0x45f5cb=typeof _0x23ceae[_0x99de('0x1e')]===_0x99de('0x1f')&&typeof _0x23ceae['limit']===_0x99de('0x1f');var _0x4b71f9=_0x35dc11[_0x99de('0x20')];var _0x3d4cfd=_0x45f5cb?0x0:_0x23ceae[_0x99de('0x1e')];var _0x452131=_0x45f5cb?_0x35dc11[_0x99de('0x20')]:_0x23ceae[_0x99de('0x1e')]+_0x23ceae[_0x99de('0x21')];var _0x2c189c;if(_0x452131>=_0x4b71f9){_0x452131=_0x4b71f9;_0x2c189c=0xc8;}else{_0x2c189c=0xce;}_0x4ff7a1[_0x99de('0x1c')](_0x2c189c);return _0x4ff7a1[_0x99de('0x22')]('Content-Range',_0x3d4cfd+'-'+_0x452131+'/'+_0x4b71f9)[_0x99de('0x1d')](_0x35dc11);}return null;};}function patchUpdates(_0x57eae2){return function(_0x54eb60){try{jsonpatch[_0x99de('0x23')](_0x54eb60,_0x57eae2,!![]);}catch(_0x443f43){return BPromise[_0x99de('0x24')](_0x443f43);}return _0x54eb60['save']();};}function saveUpdates(_0x4aaf25,_0x1c0d73){return function(_0x2131d4){if(_0x2131d4){return _0x2131d4[_0x99de('0x25')](_0x4aaf25)[_0x99de('0x26')](function(_0x5f462d){return _0x5f462d;});}return null;};}function removeEntity(_0x381a16,_0x5ba05e){return function(_0x3733d3){if(_0x3733d3){return _0x3733d3[_0x99de('0x27')]()[_0x99de('0x26')](function(){_0x381a16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd323,_0x3897dd){return function(_0x32bfed){if(!_0x32bfed){_0x2cd323[_0x99de('0x1b')](0x194);}return _0x32bfed;};}function handleError(_0x4b219f,_0x2a4db1){_0x2a4db1=_0x2a4db1||0x1f4;return function(_0x26f60c){logger[_0x99de('0x28')](_0x26f60c[_0x99de('0x29')]);if(_0x26f60c[_0x99de('0x2a')]){delete _0x26f60c[_0x99de('0x2a')];}_0x4b219f['status'](_0x2a4db1)['send'](_0x26f60c);};}exports[_0x99de('0x2b')]=function(_0x4349eb,_0x252525){var _0x2254ae={},_0x1c42f6={},_0x499455={'count':0x0,'rows':[]};var _0x12c187=_[_0x99de('0x2c')](db[_0x99de('0x2d')][_0x99de('0x2e')],function(_0x5eec64){return{'name':_0x5eec64['fieldName'],'type':_0x5eec64[_0x99de('0x2f')][_0x99de('0x30')]};});_0x1c42f6[_0x99de('0x31')]=_[_0x99de('0x2c')](_0x12c187,_0x99de('0x2a'));_0x1c42f6[_0x99de('0x32')]=_[_0x99de('0x33')](_0x4349eb['query']);_0x1c42f6['filters']=_[_0x99de('0x34')](_0x1c42f6[_0x99de('0x31')],_0x1c42f6['query']);_0x2254ae[_0x99de('0x35')]=_[_0x99de('0x34')](_0x1c42f6['model'],qs['fields'](_0x4349eb['query']['fields']));_0x2254ae[_0x99de('0x35')]=_0x2254ae['attributes'][_0x99de('0x36')]?_0x2254ae[_0x99de('0x35')]:_0x1c42f6[_0x99de('0x31')];if(!_0x4349eb['query'][_0x99de('0x37')](_0x99de('0x38'))){_0x2254ae[_0x99de('0x21')]=qs[_0x99de('0x21')](_0x4349eb[_0x99de('0x32')]['limit']);_0x2254ae[_0x99de('0x1e')]=qs[_0x99de('0x1e')](_0x4349eb['query'][_0x99de('0x1e')]);}_0x2254ae[_0x99de('0x39')]=qs[_0x99de('0x3a')](_0x4349eb[_0x99de('0x32')][_0x99de('0x3a')]);_0x2254ae['where']=qs['filters'](_[_0x99de('0x3b')](_0x4349eb[_0x99de('0x32')],_0x1c42f6[_0x99de('0x3c')]),_0x12c187);if(_0x4349eb[_0x99de('0x32')]['filter']){_0x2254ae['where']=_['merge'](_0x2254ae['where'],{'$or':_[_0x99de('0x2c')](_0x12c187,function(_0x33d2ec){if(_0x33d2ec[_0x99de('0x2f')]!==_0x99de('0x3d')){var _0xa488ea={};_0xa488ea[_0x33d2ec[_0x99de('0x2a')]]={'$like':'%'+_0x4349eb[_0x99de('0x32')][_0x99de('0x3e')]+'%'};return _0xa488ea;}})});}_0x2254ae=_['merge']({},_0x2254ae,_0x4349eb[_0x99de('0x3f')]);var _0x3e40b6={'where':_0x2254ae['where']};return db[_0x99de('0x2d')][_0x99de('0x20')](_0x3e40b6)[_0x99de('0x26')](function(_0x54173a){_0x499455[_0x99de('0x20')]=_0x54173a;if(_0x4349eb[_0x99de('0x32')][_0x99de('0x40')]){_0x2254ae['include']=[{'all':!![]}];}return db[_0x99de('0x2d')]['findAll'](_0x2254ae);})[_0x99de('0x26')](function(_0x3fee1f){_0x499455[_0x99de('0x41')]=_0x3fee1f;return _0x499455;})['then'](respondWithFilteredResult(_0x252525,_0x2254ae))[_0x99de('0x42')](handleError(_0x252525,null));};exports[_0x99de('0x43')]=function(_0x5ddc3d,_0x45568d){var _0x710f0c={'raw':!![],'where':{'id':_0x5ddc3d[_0x99de('0x44')]['id']}},_0x2d71bb={};_0x2d71bb['model']=_[_0x99de('0x33')](db[_0x99de('0x2d')][_0x99de('0x2e')]);_0x2d71bb[_0x99de('0x32')]=_[_0x99de('0x33')](_0x5ddc3d['query']);_0x2d71bb[_0x99de('0x3c')]=_[_0x99de('0x34')](_0x2d71bb[_0x99de('0x31')],_0x2d71bb[_0x99de('0x32')]);_0x710f0c[_0x99de('0x35')]=_['intersection'](_0x2d71bb['model'],qs[_0x99de('0x45')](_0x5ddc3d[_0x99de('0x32')]['fields']));_0x710f0c[_0x99de('0x35')]=_0x710f0c[_0x99de('0x35')][_0x99de('0x36')]?_0x710f0c['attributes']:_0x2d71bb[_0x99de('0x31')];if(_0x5ddc3d[_0x99de('0x32')][_0x99de('0x40')]){_0x710f0c[_0x99de('0x46')]=[{'all':!![]}];}_0x710f0c=_['merge']({},_0x710f0c,_0x5ddc3d['options']);return db['SquareDetailsReport'][_0x99de('0x47')](_0x710f0c)[_0x99de('0x26')](handleEntityNotFound(_0x45568d,null))[_0x99de('0x26')](respondWithResult(_0x45568d,null))[_0x99de('0x42')](handleError(_0x45568d,null));};exports[_0x99de('0x48')]=function(_0x16c194,_0x4b7463){return db['SquareDetailsReport'][_0x99de('0x48')](_0x16c194[_0x99de('0x49')],{})['then'](respondWithResult(_0x4b7463,0xc9))[_0x99de('0x42')](handleError(_0x4b7463,null));};exports[_0x99de('0x25')]=function(_0x575e95,_0x197e8b){if(_0x575e95['body']['id']){delete _0x575e95['body']['id'];}return db['SquareDetailsReport'][_0x99de('0x47')]({'where':{'id':_0x575e95[_0x99de('0x44')]['id']}})[_0x99de('0x26')](handleEntityNotFound(_0x197e8b,null))['then'](saveUpdates(_0x575e95[_0x99de('0x49')],null))['then'](respondWithResult(_0x197e8b,null))[_0x99de('0x42')](handleError(_0x197e8b,null));};exports[_0x99de('0x27')]=function(_0x17884b,_0x109607){return db[_0x99de('0x2d')][_0x99de('0x47')]({'where':{'id':_0x17884b[_0x99de('0x44')]['id']}})[_0x99de('0x26')](handleEntityNotFound(_0x109607,null))['then'](removeEntity(_0x109607,null))[_0x99de('0x42')](handleError(_0x109607,null));};exports[_0x99de('0x4a')]=function(_0xb0f201,_0x4916cb){return db[_0x99de('0x2d')][_0x99de('0x4a')]()[_0x99de('0x26')](respondWithResult(_0x4916cb,null))['catch'](handleError(_0x4916cb,null));}; \ No newline at end of file +var _0x9b5c=['offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','length','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9b5c,0x80));var _0xc9b5=function(_0x2b77c3,_0x4aec47){_0x2b77c3=_0x2b77c3-0x0;var _0xa394bf=_0x9b5c[_0x2b77c3];return _0xa394bf;};'use strict';var emlformat=require(_0xc9b5('0x0'));var rimraf=require(_0xc9b5('0x1'));var zipdir=require(_0xc9b5('0x2'));var jsonpatch=require(_0xc9b5('0x3'));var rp=require(_0xc9b5('0x4'));var moment=require(_0xc9b5('0x5'));var BPromise=require(_0xc9b5('0x6'));var Mustache=require(_0xc9b5('0x7'));var util=require(_0xc9b5('0x8'));var path=require(_0xc9b5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9b5('0xa'));var _=require(_0xc9b5('0xb'));var squel=require('squel');var crypto=require(_0xc9b5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc9b5('0xd'));var toCsv=require(_0xc9b5('0xe'));var querystring=require(_0xc9b5('0xf'));var Papa=require(_0xc9b5('0x10'));var Redis=require('ioredis');var authService=require(_0xc9b5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc9b5('0x12'));var hardwareService=require(_0xc9b5('0x13'));var logger=require('../../config/logger')(_0xc9b5('0x14'));var utils=require(_0xc9b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc9b5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16257f,_0x10a491){_0x10a491=_0x10a491||0xcc;return function(_0x166f6f){if(_0x166f6f){return _0x16257f[_0xc9b5('0x17')](_0x10a491);}return _0x16257f[_0xc9b5('0x18')](_0x10a491)['end']();};}function respondWithResult(_0xc3da87,_0x9ef580){_0x9ef580=_0x9ef580||0xc8;return function(_0x242e13){if(_0x242e13){return _0xc3da87['status'](_0x9ef580)[_0xc9b5('0x19')](_0x242e13);}};}function respondWithFilteredResult(_0x30ce18,_0x2c8331){return function(_0x4bec98){if(_0x4bec98){var _0x4fe2cd=typeof _0x2c8331[_0xc9b5('0x1a')]===_0xc9b5('0x1b')&&typeof _0x2c8331['limit']===_0xc9b5('0x1b');var _0x20ed2b=_0x4bec98['count'];var _0x3e5467=_0x4fe2cd?0x0:_0x2c8331[_0xc9b5('0x1a')];var _0x7bb903=_0x4fe2cd?_0x4bec98[_0xc9b5('0x1c')]:_0x2c8331['offset']+_0x2c8331[_0xc9b5('0x1d')];var _0x5d16b7;if(_0x7bb903>=_0x20ed2b){_0x7bb903=_0x20ed2b;_0x5d16b7=0xc8;}else{_0x5d16b7=0xce;}_0x30ce18[_0xc9b5('0x18')](_0x5d16b7);return _0x30ce18[_0xc9b5('0x1e')]('Content-Range',_0x3e5467+'-'+_0x7bb903+'/'+_0x20ed2b)['json'](_0x4bec98);}return null;};}function patchUpdates(_0xfa7efd){return function(_0x14f740){try{jsonpatch[_0xc9b5('0x1f')](_0x14f740,_0xfa7efd,!![]);}catch(_0x180562){return BPromise[_0xc9b5('0x20')](_0x180562);}return _0x14f740[_0xc9b5('0x21')]();};}function saveUpdates(_0x3ad702,_0x40221b){return function(_0x4116d8){if(_0x4116d8){return _0x4116d8[_0xc9b5('0x22')](_0x3ad702)[_0xc9b5('0x23')](function(_0x1a4fda){return _0x1a4fda;});}return null;};}function removeEntity(_0x201d7f,_0x2ba501){return function(_0xbf6f33){if(_0xbf6f33){return _0xbf6f33[_0xc9b5('0x24')]()['then'](function(){_0x201d7f[_0xc9b5('0x18')](0xcc)[_0xc9b5('0x25')]();});}};}function handleEntityNotFound(_0x211b15,_0x4ae1b1){return function(_0xbe3afa){if(!_0xbe3afa){_0x211b15[_0xc9b5('0x17')](0x194);}return _0xbe3afa;};}function handleError(_0x2d8458,_0x2aea5a){_0x2aea5a=_0x2aea5a||0x1f4;return function(_0x2b4fce){logger[_0xc9b5('0x26')](_0x2b4fce[_0xc9b5('0x27')]);if(_0x2b4fce[_0xc9b5('0x28')]){delete _0x2b4fce[_0xc9b5('0x28')];}_0x2d8458['status'](_0x2aea5a)[_0xc9b5('0x29')](_0x2b4fce);};}exports[_0xc9b5('0x2a')]=function(_0x267dbe,_0x4bc30e){var _0x4d729d={},_0x508f70={},_0x5ab887={'count':0x0,'rows':[]};var _0x4a41b8=_['map'](db[_0xc9b5('0x2b')][_0xc9b5('0x2c')],function(_0x4a7462){return{'name':_0x4a7462[_0xc9b5('0x2d')],'type':_0x4a7462['type'][_0xc9b5('0x2e')]};});_0x508f70[_0xc9b5('0x2f')]=_[_0xc9b5('0x30')](_0x4a41b8,_0xc9b5('0x28'));_0x508f70[_0xc9b5('0x31')]=_[_0xc9b5('0x32')](_0x267dbe['query']);_0x508f70[_0xc9b5('0x33')]=_[_0xc9b5('0x34')](_0x508f70[_0xc9b5('0x2f')],_0x508f70[_0xc9b5('0x31')]);_0x4d729d['attributes']=_[_0xc9b5('0x34')](_0x508f70['model'],qs[_0xc9b5('0x35')](_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x35')]));_0x4d729d[_0xc9b5('0x36')]=_0x4d729d[_0xc9b5('0x36')]['length']?_0x4d729d[_0xc9b5('0x36')]:_0x508f70['model'];if(!_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x37')](_0xc9b5('0x38'))){_0x4d729d['limit']=qs['limit'](_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x1d')]);_0x4d729d['offset']=qs['offset'](_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x1a')]);}_0x4d729d[_0xc9b5('0x39')]=qs[_0xc9b5('0x3a')](_0x267dbe[_0xc9b5('0x31')]['sort']);_0x4d729d[_0xc9b5('0x3b')]=qs[_0xc9b5('0x33')](_[_0xc9b5('0x3c')](_0x267dbe[_0xc9b5('0x31')],_0x508f70[_0xc9b5('0x33')]),_0x4a41b8);if(_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x3d')]){_0x4d729d['where']=_[_0xc9b5('0x3e')](_0x4d729d['where'],{'$or':_[_0xc9b5('0x30')](_0x4a41b8,function(_0x318875){if(_0x318875[_0xc9b5('0x3f')]!==_0xc9b5('0x40')){var _0x3774a3={};_0x3774a3[_0x318875['name']]={'$like':'%'+_0x267dbe[_0xc9b5('0x31')][_0xc9b5('0x3d')]+'%'};return _0x3774a3;}})});}_0x4d729d=_[_0xc9b5('0x3e')]({},_0x4d729d,_0x267dbe[_0xc9b5('0x41')]);var _0x2308fb={'where':_0x4d729d[_0xc9b5('0x3b')]};return db[_0xc9b5('0x2b')][_0xc9b5('0x1c')](_0x2308fb)['then'](function(_0x44b77f){_0x5ab887[_0xc9b5('0x1c')]=_0x44b77f;if(_0x267dbe['query']['includeAll']){_0x4d729d['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xc9b5('0x42')](_0x4d729d);})['then'](function(_0x52e0c0){_0x5ab887['rows']=_0x52e0c0;return _0x5ab887;})[_0xc9b5('0x23')](respondWithFilteredResult(_0x4bc30e,_0x4d729d))[_0xc9b5('0x43')](handleError(_0x4bc30e,null));};exports[_0xc9b5('0x44')]=function(_0xd7b7f2,_0x3ee80e){var _0x3e2a7f={'raw':!![],'where':{'id':_0xd7b7f2['params']['id']}},_0x49a94f={};_0x49a94f['model']=_[_0xc9b5('0x32')](db[_0xc9b5('0x2b')][_0xc9b5('0x2c')]);_0x49a94f[_0xc9b5('0x31')]=_[_0xc9b5('0x32')](_0xd7b7f2[_0xc9b5('0x31')]);_0x49a94f[_0xc9b5('0x33')]=_['intersection'](_0x49a94f[_0xc9b5('0x2f')],_0x49a94f['query']);_0x3e2a7f[_0xc9b5('0x36')]=_[_0xc9b5('0x34')](_0x49a94f[_0xc9b5('0x2f')],qs['fields'](_0xd7b7f2['query'][_0xc9b5('0x35')]));_0x3e2a7f[_0xc9b5('0x36')]=_0x3e2a7f[_0xc9b5('0x36')][_0xc9b5('0x45')]?_0x3e2a7f[_0xc9b5('0x36')]:_0x49a94f[_0xc9b5('0x2f')];if(_0xd7b7f2[_0xc9b5('0x31')][_0xc9b5('0x46')]){_0x3e2a7f[_0xc9b5('0x47')]=[{'all':!![]}];}_0x3e2a7f=_[_0xc9b5('0x3e')]({},_0x3e2a7f,_0xd7b7f2['options']);return db[_0xc9b5('0x2b')][_0xc9b5('0x48')](_0x3e2a7f)[_0xc9b5('0x23')](handleEntityNotFound(_0x3ee80e,null))[_0xc9b5('0x23')](respondWithResult(_0x3ee80e,null))[_0xc9b5('0x43')](handleError(_0x3ee80e,null));};exports[_0xc9b5('0x49')]=function(_0x509dbc,_0x508a0d){return db[_0xc9b5('0x2b')]['create'](_0x509dbc[_0xc9b5('0x4a')],{})[_0xc9b5('0x23')](respondWithResult(_0x508a0d,0xc9))[_0xc9b5('0x43')](handleError(_0x508a0d,null));};exports[_0xc9b5('0x22')]=function(_0x305a73,_0x494f6c){if(_0x305a73[_0xc9b5('0x4a')]['id']){delete _0x305a73['body']['id'];}return db[_0xc9b5('0x2b')][_0xc9b5('0x48')]({'where':{'id':_0x305a73[_0xc9b5('0x4b')]['id']}})[_0xc9b5('0x23')](handleEntityNotFound(_0x494f6c,null))[_0xc9b5('0x23')](saveUpdates(_0x305a73[_0xc9b5('0x4a')],null))[_0xc9b5('0x23')](respondWithResult(_0x494f6c,null))['catch'](handleError(_0x494f6c,null));};exports[_0xc9b5('0x24')]=function(_0x3aa14b,_0x592d9c){return db['SquareDetailsReport'][_0xc9b5('0x48')]({'where':{'id':_0x3aa14b[_0xc9b5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x592d9c,null))[_0xc9b5('0x23')](removeEntity(_0x592d9c,null))[_0xc9b5('0x43')](handleError(_0x592d9c,null));};exports[_0xc9b5('0x4c')]=function(_0x24bfb0,_0x25d148){return db[_0xc9b5('0x2b')][_0xc9b5('0x4c')]()[_0xc9b5('0x23')](respondWithResult(_0x25d148,null))[_0xc9b5('0x43')](handleError(_0x25d148,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 05ea683..df0f3a5 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 _0xf428=['rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','api','request-promise','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf428,0xeb));var _0x8f42=function(_0x204faf,_0x1698e4){_0x204faf=_0x204faf-0x0;var _0x425a6b=_0xf428[_0x204faf];return _0x425a6b;};'use strict';var _=require(_0x8f42('0x0'));var util=require(_0x8f42('0x1'));var logger=require('../../config/logger')(_0x8f42('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f42('0x3'));var fs=require('fs');var path=require(_0x8f42('0x4'));var rimraf=require(_0x8f42('0x5'));var config=require('../../config/environment');var attributes=require(_0x8f42('0x6'));module[_0x8f42('0x7')]=function(_0x8fc880,_0x13d4c1){return _0x8fc880[_0x8f42('0x8')](_0x8f42('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8d8=['exports','define','SquareDetailsReport','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0xb8d8,0x12c));var _0x8b8d=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xb8d8[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x8b8d('0x0'));var util=require(_0x8b8d('0x1'));var logger=require(_0x8b8d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b8d('0x3'));var fs=require('fs');var path=require(_0x8b8d('0x4'));var rimraf=require(_0x8b8d('0x5'));var config=require(_0x8b8d('0x6'));var attributes=require(_0x8b8d('0x7'));module[_0x8b8d('0x8')]=function(_0x40bda5,_0x237f5e){return _0x40bda5[_0x8b8d('0x9')](_0x8b8d('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index c0d1f78..c53f508 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 _0x6017=['http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x6017,0xae));var _0x7601=function(_0x5008a5,_0xbe4d1){_0x5008a5=_0x5008a5-0x0;var _0x1f5fb7=_0x6017[_0x5008a5];return _0x1f5fb7;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});}exports[_0x7601('0x14')]=function(_0x5c3fb7){var _0x5f530e=this;return new Promise(function(_0x22520e,_0x403e38){return db[_0x7601('0x15')][_0x7601('0x16')](_0x5c3fb7[_0x7601('0x17')],{'raw':_0x5c3fb7[_0x7601('0x18')]?_0x5c3fb7[_0x7601('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7601('0xa')](function(_0x1d58c0){logger['info'](_0x7601('0x14'),_0x5c3fb7);logger[_0x7601('0xd')](_0x7601('0x14'),_0x5c3fb7,JSON[_0x7601('0xe')](_0x1d58c0));_0x22520e(_0x1d58c0);})[_0x7601('0x19')](function(_0x12f3f6){logger['error'](_0x7601('0x14'),_0x12f3f6[_0x7601('0x11')],_0x5c3fb7);_0x403e38(_0x5f530e[_0x7601('0xf')](0x1f4,_0x12f3f6[_0x7601('0x11')]));});});}; \ No newline at end of file +var _0xc900=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc900,0xb3));var _0x0c90=function(_0x2b0800,_0x25f8f8){_0x2b0800=_0x2b0800-0x0;var _0x338588=_0xc900[_0x2b0800];return _0x338588;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateSquareDetailsReport',_0x42321a);logger[_0x0c90('0xf')]('CreateSquareDetailsReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3d98d82..0676f68 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 _0x76e6=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x76e6,0x1ae));var _0x676e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x76e6[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x676e('0x0'));var router=express[_0x676e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x676e('0x2'));router[_0x676e('0x3')]('/',auth[_0x676e('0x4')](),controller[_0x676e('0x5')]);router['get'](_0x676e('0x6'),auth[_0x676e('0x4')](),controller[_0x676e('0x7')]);module['exports']=router; \ No newline at end of file +var _0xccea=['/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0xac87ce,_0x25dc5e){var _0xff6097=function(_0x31dfa9){while(--_0x31dfa9){_0xac87ce['push'](_0xac87ce['shift']());}};_0xff6097(++_0x25dc5e);}(_0xccea,0x103));var _0xacce=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xccea[_0x2555d0];return _0x3bb486;};'use strict';var express=require('express');var router=express[_0xacce('0x0')]();var auth=require(_0xacce('0x1'));var controller=require('./system.controller');router[_0xacce('0x2')]('/',auth[_0xacce('0x3')](),controller[_0xacce('0x4')]);router['get'](_0xacce('0x5'),auth['isAuthenticated'](),controller[_0xacce('0x6')]);module[_0xacce('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2968197..b57d019 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 _0xf277=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT'];(function(_0x3d389b,_0x55613f){var _0x3998fb=function(_0x11d480){while(--_0x11d480){_0x3d389b['push'](_0x3d389b['shift']());}};_0x3998fb(++_0x55613f);}(_0xf277,0x1e1));var _0x7f27=function(_0x19f011,_0x499dce){_0x19f011=_0x19f011-0x0;var _0x2442c8=_0xf277[_0x19f011];return _0x2442c8;};'use strict';var info=require(_0x7f27('0x0'));var exec=require(_0x7f27('0x1'))['exec'];var logger=require(_0x7f27('0x2'))('api');var util=require(_0x7f27('0x3'));var BPromise=require(_0x7f27('0x4'));var _=require(_0x7f27('0x5'));function handleError(_0x23f63b,_0x490cb8,_0x5121fb){_0x490cb8=_0x490cb8||0x1f4;return function(_0x2456db){logger['error'](_0x7f27('0x6'),_0x5121fb,_0x490cb8,util[_0x7f27('0x7')](_0x2456db,{'showHidden':![],'depth':null}));delete _0x2456db['name'];_0x23f63b[_0x7f27('0x8')](_0x490cb8)[_0x7f27('0x9')](_0x2456db);};}exports['index']=function(_0x341908,_0x176b50){return info[_0x7f27('0xa')]()[_0x7f27('0xb')](function(_0x530082){return _0x176b50['status'](0xc8)[_0x7f27('0xc')](_0x530082);})['catch'](function(_0x252be9){return _0x176b50[_0x7f27('0x8')](0x1f4)[_0x7f27('0xc')](_0x252be9);});};exports[_0x7f27('0xd')]=function(_0x4330d8,_0x5cc922){var _0x508189=[_0x7f27('0xe')];return new BPromise(function(_0x1c4fd6,_0x4a9b5c){return exec(util[_0x7f27('0xf')](_0x7f27('0x10'),_0x4330d8[_0x7f27('0x11')][_0x7f27('0x12')]),function(_0x3c169a,_0xddc730,_0x3aeb70){if(_0x3c169a){return _0x4a9b5c(_0x3c169a);}return _0x1c4fd6(_0xddc730);});})[_0x7f27('0xb')](function(_0x5094c5){var _0x3e819a=![];var _0x408a9f=_0x5094c5['split'](/\n/);for(var _0x43f3da=0x0,_0x402610=_0x508189['length'];_0x43f3da<_0x402610,_0x3e819a===![];_0x43f3da+=0x1){if(_0x5094c5[_0x7f27('0x13')](_0x508189[_0x43f3da])>=0x0){_0x3e819a=!![];}}if(!_0x3e819a){throw new Error(util[_0x7f27('0xf')](_0x7f27('0x14'),_0x4330d8[_0x7f27('0x11')]['pid']));}process[_0x7f27('0x15')](_0x4330d8[_0x7f27('0x11')][_0x7f27('0x12')],_0x7f27('0x16'));return _0x5cc922[_0x7f27('0x8')](0xc8)[_0x7f27('0xc')]({'message':util[_0x7f27('0xf')](_0x7f27('0x17'),_0x4330d8[_0x7f27('0x11')][_0x7f27('0x12')])});})['catch'](handleError(_0x5cc922,null,_0x7f27('0xd')));}; \ No newline at end of file +var _0x76b7=['util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','systeminformation','child_process','exec','../../config/logger','api'];(function(_0x3ba5d5,_0x550b1a){var _0x408418=function(_0x3263a5){while(--_0x3263a5){_0x3ba5d5['push'](_0x3ba5d5['shift']());}};_0x408418(++_0x550b1a);}(_0x76b7,0x15a));var _0x776b=function(_0x6bb21c,_0x476862){_0x6bb21c=_0x6bb21c-0x0;var _0x1b6c6f=_0x76b7[_0x6bb21c];return _0x1b6c6f;};'use strict';var info=require(_0x776b('0x0'));var exec=require(_0x776b('0x1'))[_0x776b('0x2')];var logger=require(_0x776b('0x3'))(_0x776b('0x4'));var util=require(_0x776b('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x46e41e,_0x345363,_0x35fc9c){_0x345363=_0x345363||0x1f4;return function(_0x3d8490){logger[_0x776b('0x6')](_0x776b('0x7'),_0x35fc9c,_0x345363,util[_0x776b('0x8')](_0x3d8490,{'showHidden':![],'depth':null}));delete _0x3d8490[_0x776b('0x9')];_0x46e41e[_0x776b('0xa')](_0x345363)[_0x776b('0xb')](_0x3d8490);};}exports[_0x776b('0xc')]=function(_0x479353,_0x112262){return info[_0x776b('0xd')]()[_0x776b('0xe')](function(_0x276f3c){return _0x112262[_0x776b('0xa')](0xc8)['json'](_0x276f3c);})[_0x776b('0xf')](function(_0x24e3de){return _0x112262[_0x776b('0xa')](0x1f4)[_0x776b('0x10')](_0x24e3de);});};exports[_0x776b('0x11')]=function(_0x553014,_0xd1029f){var _0x5d6818=[_0x776b('0x12')];return new BPromise(function(_0x3ef6a2,_0x25563e){return exec(util['format'](_0x776b('0x13'),_0x553014[_0x776b('0x14')][_0x776b('0x15')]),function(_0x80024,_0x2b6514,_0xef6b43){if(_0x80024){return _0x25563e(_0x80024);}return _0x3ef6a2(_0x2b6514);});})[_0x776b('0xe')](function(_0x5c2d99){var _0x5156e6=![];var _0x244562=_0x5c2d99[_0x776b('0x16')](/\n/);for(var _0x4f7f14=0x0,_0x5d3cb3=_0x5d6818[_0x776b('0x17')];_0x4f7f14<_0x5d3cb3,_0x5156e6===![];_0x4f7f14+=0x1){if(_0x5c2d99[_0x776b('0x18')](_0x5d6818[_0x4f7f14])>=0x0){_0x5156e6=!![];}}if(!_0x5156e6){throw new Error(util[_0x776b('0x19')](_0x776b('0x1a'),_0x553014['params'][_0x776b('0x15')]));}process['kill'](_0x553014[_0x776b('0x14')][_0x776b('0x15')],'SIGINT');return _0xd1029f['status'](0xc8)[_0x776b('0x10')]({'message':util[_0x776b('0x19')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x553014[_0x776b('0x14')][_0x776b('0x15')])});})[_0x776b('0xf')](handleError(_0xd1029f,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2f68821..593c741 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 _0xf536=['isAuthenticated','show','post','create','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','index','/:id'];(function(_0x5f1248,_0x3fcd97){var _0x3dc5fa=function(_0x52225b){while(--_0x52225b){_0x5f1248['push'](_0x5f1248['shift']());}};_0x3dc5fa(++_0x3fcd97);}(_0xf536,0x106));var _0x6f53=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0xf536[_0x4706a6];return _0x1bb705;};'use strict';var multer=require('multer');var util=require(_0x6f53('0x0'));var path=require('path');var timeout=require(_0x6f53('0x1'));var express=require('express');var router=express[_0x6f53('0x2')]();var fs_extra=require(_0x6f53('0x3'));var auth=require(_0x6f53('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f53('0x5'));var controller=require(_0x6f53('0x6'));router[_0x6f53('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f53('0x8')]);router['get'](_0x6f53('0x9'),auth[_0x6f53('0xa')](),controller[_0x6f53('0xb')]);router[_0x6f53('0xc')]('/',auth[_0x6f53('0xa')](),controller[_0x6f53('0xd')]);router['put']('/:id',auth[_0x6f53('0xa')](),controller[_0x6f53('0xe')]);router[_0x6f53('0xf')](_0x6f53('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f53('0x10')]=router; \ No newline at end of file +var _0x43b1=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x43b1,0x94));var _0x143b=function(_0x307d66,_0x5b3faa){_0x307d66=_0x307d66-0x0;var _0x41d351=_0x43b1[_0x307d66];return _0x41d351;};'use strict';var multer=require(_0x143b('0x0'));var util=require(_0x143b('0x1'));var path=require(_0x143b('0x2'));var timeout=require('connect-timeout');var express=require(_0x143b('0x3'));var router=express[_0x143b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x143b('0x5'));var interaction=require(_0x143b('0x6'));var config=require(_0x143b('0x7'));var controller=require(_0x143b('0x8'));router['get']('/',auth[_0x143b('0x9')](),controller[_0x143b('0xa')]);router[_0x143b('0xb')](_0x143b('0xc'),auth['isAuthenticated'](),controller[_0x143b('0xd')]);router[_0x143b('0xe')]('/',auth[_0x143b('0x9')](),controller['create']);router[_0x143b('0xf')](_0x143b('0xc'),auth[_0x143b('0x9')](),controller[_0x143b('0x10')]);router[_0x143b('0x11')](_0x143b('0xc'),auth[_0x143b('0x9')](),controller[_0x143b('0x12')]);module[_0x143b('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e8d843c..2b72eff 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 _0xd4f4=['exports','STRING','name','#0091EA','sequelize'];(function(_0x118604,_0x37584a){var _0x400e5b=function(_0x16f02f){while(--_0x16f02f){_0x118604['push'](_0x118604['shift']());}};_0x400e5b(++_0x37584a);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x32e749,_0x5b50a0){_0x32e749=_0x32e749-0x0;var _0x3f57ca=_0xd4f4[_0x32e749];return _0x3f57ca;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'unique':_0x4d4f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4d4f('0x2')],'defaultValue':_0x4d4f('0x4')},'description':{'type':Sequelize[_0x4d4f('0x2')]}}; \ No newline at end of file +var _0x7d25=['name','#0091EA','exports','STRING'];(function(_0x2e1c26,_0x451647){var _0x187bbe=function(_0x215661){while(--_0x215661){_0x2e1c26['push'](_0x2e1c26['shift']());}};_0x187bbe(++_0x451647);}(_0x7d25,0x8a));var _0x57d2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x7d25[_0x556927];return _0x5f1235;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'unique':_0x57d2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x57d2('0x1')],'defaultValue':_0x57d2('0x3')},'description':{'type':Sequelize[_0x57d2('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2432dcd..e3f3b36 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 _0xf290=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Tags','UserProfileResource','error','stack','name','send','map','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','Tag','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x32c5ee,_0x2bb64e){var _0x4b3f5b=function(_0x2d230e){while(--_0x2d230e){_0x32c5ee['push'](_0x32c5ee['shift']());}};_0x4b3f5b(++_0x2bb64e);}(_0xf290,0xde));var _0x0f29=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xf290[_0x272638];return _0x19d027;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){var _0x5a440f=_0x29ca73[_0x0f29('0x25')]({'plain':!![]});var _0x26f46f=_0x0f29('0x26');return db[_0x0f29('0x27')]['destroy']({'where':{'type':_0x26f46f,'resourceId':_0x5a440f['id']}})[_0x0f29('0x24')](function(){return _0x29ca73;});})['then'](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x5c0202,_0x5bfcac){return function(_0x57dcc7){if(!_0x57dcc7){_0x5c0202['sendStatus'](0x194);}return _0x57dcc7;};}function handleError(_0x3c6ce9,_0x1f4ad2){_0x1f4ad2=_0x1f4ad2||0x1f4;return function(_0x4cc5a0){logger[_0x0f29('0x28')](_0x4cc5a0[_0x0f29('0x29')]);if(_0x4cc5a0[_0x0f29('0x2a')]){delete _0x4cc5a0['name'];}_0x3c6ce9['status'](_0x1f4ad2)[_0x0f29('0x2b')](_0x4cc5a0);};}exports['index']=function(_0x36b65c,_0x561c31){var _0x526364={},_0x7b10f={},_0x409b19={'count':0x0,'rows':[]};var _0xf59431=_[_0x0f29('0x2c')](db['Tag']['rawAttributes'],function(_0x3bb3c8){return{'name':_0x3bb3c8['fieldName'],'type':_0x3bb3c8['type'][_0x0f29('0x2d')]};});_0x7b10f['model']=_[_0x0f29('0x2c')](_0xf59431,'name');_0x7b10f['query']=_[_0x0f29('0x2e')](_0x36b65c[_0x0f29('0x2f')]);_0x7b10f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x7b10f[_0x0f29('0x32')],_0x7b10f['query']);_0x526364[_0x0f29('0x33')]=_['intersection'](_0x7b10f[_0x0f29('0x32')],qs[_0x0f29('0x34')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x34')]));_0x526364['attributes']=_0x526364[_0x0f29('0x33')][_0x0f29('0x35')]?_0x526364['attributes']:_0x7b10f[_0x0f29('0x32')];if(!_0x36b65c[_0x0f29('0x2f')]['hasOwnProperty']('nolimit')){_0x526364[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x526364[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x36b65c['query'][_0x0f29('0x1d')]);}_0x526364['order']=qs[_0x0f29('0x36')](_0x36b65c['query'][_0x0f29('0x36')]);_0x526364[_0x0f29('0x37')]=qs[_0x0f29('0x30')](_['pick'](_0x36b65c['query'],_0x7b10f[_0x0f29('0x30')]),_0xf59431);if(_0x36b65c['query'][_0x0f29('0x38')]){_0x526364[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x526364[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0xf59431,function(_0x5afbb8){if(_0x5afbb8[_0x0f29('0x3a')]!==_0x0f29('0x3b')){var _0x42872b={};_0x42872b[_0x5afbb8[_0x0f29('0x2a')]]={'$like':'%'+_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x42872b;}})});}_0x526364=_[_0x0f29('0x39')]({},_0x526364,_0x36b65c[_0x0f29('0x3c')]);var _0x250b20={'where':_0x526364['where']};return db[_0x0f29('0x3d')][_0x0f29('0x20')](_0x250b20)[_0x0f29('0x24')](function(_0x11b1dc){_0x409b19['count']=_0x11b1dc;if(_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x526364[_0x0f29('0x3f')]=[{'all':!![]}];}return db[_0x0f29('0x3d')][_0x0f29('0x40')](_0x526364);})['then'](function(_0x410c59){_0x409b19[_0x0f29('0x41')]=_0x410c59;return _0x409b19;})[_0x0f29('0x24')](respondWithFilteredResult(_0x561c31,_0x526364))['catch'](handleError(_0x561c31,null));};exports[_0x0f29('0x42')]=function(_0x284279,_0x3a6479){var _0x338412={'raw':!![],'where':{'id':_0x284279[_0x0f29('0x43')]['id']}},_0x35f753={};_0x35f753[_0x0f29('0x32')]=_[_0x0f29('0x2e')](db['Tag']['rawAttributes']);_0x35f753['query']=_[_0x0f29('0x2e')](_0x284279[_0x0f29('0x2f')]);_0x35f753[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x35f753[_0x0f29('0x32')],_0x35f753[_0x0f29('0x2f')]);_0x338412['attributes']=_[_0x0f29('0x31')](_0x35f753['model'],qs[_0x0f29('0x34')](_0x284279['query'][_0x0f29('0x34')]));_0x338412[_0x0f29('0x33')]=_0x338412[_0x0f29('0x33')][_0x0f29('0x35')]?_0x338412[_0x0f29('0x33')]:_0x35f753['model'];if(_0x284279[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x338412[_0x0f29('0x3f')]=[{'all':!![]}];}_0x338412=_['merge']({},_0x338412,_0x284279[_0x0f29('0x3c')]);return db['Tag']['find'](_0x338412)[_0x0f29('0x24')](handleEntityNotFound(_0x3a6479,null))[_0x0f29('0x24')](respondWithResult(_0x3a6479,null))[_0x0f29('0x44')](handleError(_0x3a6479,null));};exports[_0x0f29('0x45')]=function(_0x20aa53,_0x335435){return db['Tag'][_0x0f29('0x45')](_0x20aa53[_0x0f29('0x46')],{})[_0x0f29('0x24')](function(_0x857564){var _0x2455d2=_0x20aa53[_0x0f29('0x47')][_0x0f29('0x25')]({'plain':!![]});if(!_0x2455d2)throw new Error(_0x0f29('0x48'));if(_0x2455d2[_0x0f29('0x49')]===_0x0f29('0x47')){var _0x5cd4a9=_0x857564['get']({'plain':!![]});var _0xa6231e=_0x0f29('0x26');return db[_0x0f29('0x4a')][_0x0f29('0x4b')]({'where':{'name':_0xa6231e,'userProfileId':_0x2455d2['userProfileId']},'raw':!![]})[_0x0f29('0x24')](function(_0xd624ad){if(_0xd624ad&&_0xd624ad[_0x0f29('0x4c')]===0x0){return db[_0x0f29('0x27')][_0x0f29('0x45')]({'name':_0x5cd4a9[_0x0f29('0x2a')],'resourceId':_0x5cd4a9['id'],'type':_0xd624ad[_0x0f29('0x2a')],'sectionId':_0xd624ad['id']},{})['then'](function(){return _0x857564;});}else{return _0x857564;}})[_0x0f29('0x44')](function(_0x6c1800){logger[_0x0f29('0x28')](_0x0f29('0x4d'),_0x6c1800);throw _0x6c1800;});}return _0x857564;})[_0x0f29('0x24')](respondWithResult(_0x335435,0xc9))[_0x0f29('0x44')](handleError(_0x335435,null));};exports['update']=function(_0x8c9780,_0x45d87c){if(_0x8c9780[_0x0f29('0x46')]['id']){delete _0x8c9780['body']['id'];}return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x8c9780[_0x0f29('0x43')]['id']}})['then'](handleEntityNotFound(_0x45d87c,null))[_0x0f29('0x24')](saveUpdates(_0x8c9780[_0x0f29('0x46')],null))['then'](respondWithResult(_0x45d87c,null))[_0x0f29('0x44')](handleError(_0x45d87c,null));};exports[_0x0f29('0x4e')]=function(_0x4ae30,_0x4a2c08){return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x4ae30[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x4a2c08,null))['then'](removeEntity(_0x4a2c08,null))[_0x0f29('0x44')](handleError(_0x4a2c08,null));}; \ No newline at end of file +var _0xb332=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','options','count','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','find','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x4ed142,_0x9450a0){var _0x2fe1f2=function(_0xe7a4bd){while(--_0xe7a4bd){_0x4ed142['push'](_0x4ed142['shift']());}};_0x2fe1f2(++_0x9450a0);}(_0xb332,0xd9));var _0x2b33=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xb332[_0x581af1];return _0x54c22e;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=typeof _0x57aea7[_0x2b33('0x1b')]===_0x2b33('0x1c')&&typeof _0x57aea7[_0x2b33('0x1d')]===_0x2b33('0x1c');var _0x4d69d0=_0x52693f['count'];var _0x59f0b6=_0x1d8e75?0x0:_0x57aea7[_0x2b33('0x1b')];var _0x4f10c4=_0x1d8e75?_0x52693f['count']:_0x57aea7[_0x2b33('0x1b')]+_0x57aea7[_0x2b33('0x1d')];var _0x205d8f;if(_0x4f10c4>=_0x4d69d0){_0x4f10c4=_0x4d69d0;_0x205d8f=0xc8;}else{_0x205d8f=0xce;}_0x233cd9['status'](_0x205d8f);return _0x233cd9[_0x2b33('0x1e')]('Content-Range',_0x59f0b6+'-'+_0x4f10c4+'/'+_0x4d69d0)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x2565be){return function(_0x8c8dc2){try{jsonpatch[_0x2b33('0x1f')](_0x8c8dc2,_0x2565be,!![]);}catch(_0x233ba6){return BPromise[_0x2b33('0x20')](_0x233ba6);}return _0x8c8dc2[_0x2b33('0x21')]();};}function saveUpdates(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x22')](_0x4fb725)[_0x2b33('0x23')](function(_0x58998e){return _0x58998e;});}return null;};}function removeEntity(_0x1c27d4,_0x27f1b8){return function(_0x2605e6){if(_0x2605e6){return _0x2605e6['destroy']()[_0x2b33('0x23')](function(){var _0x1b9a48=_0x2605e6[_0x2b33('0x24')]({'plain':!![]});var _0x32b835='Tags';return db[_0x2b33('0x25')]['destroy']({'where':{'type':_0x32b835,'resourceId':_0x1b9a48['id']}})[_0x2b33('0x23')](function(){return _0x2605e6;});})['then'](function(){_0x1c27d4[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x5d8d05,_0x195aa2){return function(_0x53c2ad){if(!_0x53c2ad){_0x5d8d05[_0x2b33('0x17')](0x194);}return _0x53c2ad;};}function handleError(_0x5b16a8,_0x315ebd){_0x315ebd=_0x315ebd||0x1f4;return function(_0xa109f4){logger[_0x2b33('0x26')](_0xa109f4[_0x2b33('0x27')]);if(_0xa109f4[_0x2b33('0x28')]){delete _0xa109f4[_0x2b33('0x28')];}_0x5b16a8[_0x2b33('0x18')](_0x315ebd)[_0x2b33('0x29')](_0xa109f4);};}exports[_0x2b33('0x2a')]=function(_0x203c43,_0x4cf72f){var _0x5b6527={},_0x106ea0={},_0x2a081c={'count':0x0,'rows':[]};var _0x3282bf=_[_0x2b33('0x2b')](db[_0x2b33('0x2c')]['rawAttributes'],function(_0x570765){return{'name':_0x570765[_0x2b33('0x2d')],'type':_0x570765[_0x2b33('0x2e')][_0x2b33('0x2f')]};});_0x106ea0[_0x2b33('0x30')]=_[_0x2b33('0x2b')](_0x3282bf,_0x2b33('0x28'));_0x106ea0['query']=_[_0x2b33('0x31')](_0x203c43['query']);_0x106ea0[_0x2b33('0x32')]=_[_0x2b33('0x33')](_0x106ea0[_0x2b33('0x30')],_0x106ea0[_0x2b33('0x34')]);_0x5b6527[_0x2b33('0x35')]=_[_0x2b33('0x33')](_0x106ea0[_0x2b33('0x30')],qs[_0x2b33('0x36')](_0x203c43[_0x2b33('0x34')][_0x2b33('0x36')]));_0x5b6527[_0x2b33('0x35')]=_0x5b6527[_0x2b33('0x35')][_0x2b33('0x37')]?_0x5b6527[_0x2b33('0x35')]:_0x106ea0[_0x2b33('0x30')];if(!_0x203c43[_0x2b33('0x34')]['hasOwnProperty']('nolimit')){_0x5b6527['limit']=qs[_0x2b33('0x1d')](_0x203c43[_0x2b33('0x34')][_0x2b33('0x1d')]);_0x5b6527[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0x203c43['query']['offset']);}_0x5b6527[_0x2b33('0x38')]=qs['sort'](_0x203c43[_0x2b33('0x34')][_0x2b33('0x39')]);_0x5b6527[_0x2b33('0x3a')]=qs[_0x2b33('0x32')](_[_0x2b33('0x3b')](_0x203c43[_0x2b33('0x34')],_0x106ea0[_0x2b33('0x32')]),_0x3282bf);if(_0x203c43[_0x2b33('0x34')][_0x2b33('0x3c')]){_0x5b6527[_0x2b33('0x3a')]=_['merge'](_0x5b6527[_0x2b33('0x3a')],{'$or':_[_0x2b33('0x2b')](_0x3282bf,function(_0x1f0160){if(_0x1f0160['type']!=='VIRTUAL'){var _0x3afaa5={};_0x3afaa5[_0x1f0160['name']]={'$like':'%'+_0x203c43[_0x2b33('0x34')][_0x2b33('0x3c')]+'%'};return _0x3afaa5;}})});}_0x5b6527=_['merge']({},_0x5b6527,_0x203c43[_0x2b33('0x3d')]);var _0x13874a={'where':_0x5b6527['where']};return db[_0x2b33('0x2c')][_0x2b33('0x3e')](_0x13874a)['then'](function(_0x2168b6){_0x2a081c[_0x2b33('0x3e')]=_0x2168b6;if(_0x203c43[_0x2b33('0x34')]['includeAll']){_0x5b6527[_0x2b33('0x3f')]=[{'all':!![]}];}return db[_0x2b33('0x2c')][_0x2b33('0x40')](_0x5b6527);})[_0x2b33('0x23')](function(_0x22ce0c){_0x2a081c['rows']=_0x22ce0c;return _0x2a081c;})[_0x2b33('0x23')](respondWithFilteredResult(_0x4cf72f,_0x5b6527))[_0x2b33('0x41')](handleError(_0x4cf72f,null));};exports[_0x2b33('0x42')]=function(_0x5ad3b2,_0x1fd4b2){var _0x2ac846={'raw':!![],'where':{'id':_0x5ad3b2[_0x2b33('0x43')]['id']}},_0x3c61d6={};_0x3c61d6['model']=_[_0x2b33('0x31')](db[_0x2b33('0x2c')]['rawAttributes']);_0x3c61d6['query']=_['keys'](_0x5ad3b2[_0x2b33('0x34')]);_0x3c61d6['filters']=_[_0x2b33('0x33')](_0x3c61d6[_0x2b33('0x30')],_0x3c61d6[_0x2b33('0x34')]);_0x2ac846[_0x2b33('0x35')]=_[_0x2b33('0x33')](_0x3c61d6[_0x2b33('0x30')],qs[_0x2b33('0x36')](_0x5ad3b2[_0x2b33('0x34')]['fields']));_0x2ac846[_0x2b33('0x35')]=_0x2ac846[_0x2b33('0x35')][_0x2b33('0x37')]?_0x2ac846[_0x2b33('0x35')]:_0x3c61d6[_0x2b33('0x30')];if(_0x5ad3b2[_0x2b33('0x34')]['includeAll']){_0x2ac846['include']=[{'all':!![]}];}_0x2ac846=_['merge']({},_0x2ac846,_0x5ad3b2['options']);return db[_0x2b33('0x2c')]['find'](_0x2ac846)[_0x2b33('0x23')](handleEntityNotFound(_0x1fd4b2,null))['then'](respondWithResult(_0x1fd4b2,null))['catch'](handleError(_0x1fd4b2,null));};exports[_0x2b33('0x44')]=function(_0xd15da9,_0x357724){return db['Tag'][_0x2b33('0x44')](_0xd15da9['body'],{})[_0x2b33('0x23')](function(_0x27d3b6){var _0x2a20a4=_0xd15da9[_0x2b33('0x45')][_0x2b33('0x24')]({'plain':!![]});if(!_0x2a20a4)throw new Error(_0x2b33('0x46'));if(_0x2a20a4['role']===_0x2b33('0x45')){var _0x27f766=_0x27d3b6[_0x2b33('0x24')]({'plain':!![]});var _0x4e8c21=_0x2b33('0x47');return db[_0x2b33('0x48')][_0x2b33('0x49')]({'where':{'name':_0x4e8c21,'userProfileId':_0x2a20a4['userProfileId']},'raw':!![]})[_0x2b33('0x23')](function(_0x4cffe9){if(_0x4cffe9&&_0x4cffe9['autoAssociation']===0x0){return db[_0x2b33('0x25')][_0x2b33('0x44')]({'name':_0x27f766[_0x2b33('0x28')],'resourceId':_0x27f766['id'],'type':_0x4cffe9[_0x2b33('0x28')],'sectionId':_0x4cffe9['id']},{})[_0x2b33('0x23')](function(){return _0x27d3b6;});}else{return _0x27d3b6;}})[_0x2b33('0x41')](function(_0x1982aa){logger[_0x2b33('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1982aa);throw _0x1982aa;});}return _0x27d3b6;})[_0x2b33('0x23')](respondWithResult(_0x357724,0xc9))[_0x2b33('0x41')](handleError(_0x357724,null));};exports['update']=function(_0x28e75b,_0x45a939){if(_0x28e75b['body']['id']){delete _0x28e75b[_0x2b33('0x4a')]['id'];}return db[_0x2b33('0x2c')][_0x2b33('0x49')]({'where':{'id':_0x28e75b[_0x2b33('0x43')]['id']}})['then'](handleEntityNotFound(_0x45a939,null))[_0x2b33('0x23')](saveUpdates(_0x28e75b[_0x2b33('0x4a')],null))['then'](respondWithResult(_0x45a939,null))[_0x2b33('0x41')](handleError(_0x45a939,null));};exports[_0x2b33('0x4b')]=function(_0x1ce316,_0x26e0ca){return db[_0x2b33('0x2c')][_0x2b33('0x49')]({'where':{'id':_0x1ce316[_0x2b33('0x43')]['id']}})['then'](handleEntityNotFound(_0x26e0ca,null))['then'](removeEntity(_0x26e0ca,null))[_0x2b33('0x41')](handleError(_0x26e0ca,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f164c9f..a9f25cf 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 _0x0fec=['path','rimraf','./tag.attributes','lodash','util','../../config/logger','bluebird'];(function(_0x54e346,_0x5e69c5){var _0x4b6e56=function(_0x266015){while(--_0x266015){_0x54e346['push'](_0x54e346['shift']());}};_0x4b6e56(++_0x5e69c5);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x39aa31,_0xfe54de){_0x39aa31=_0x39aa31-0x0;var _0x5e04d2=_0x0fec[_0x39aa31];return _0x5e04d2;};'use strict';var _=require(_0xc0fe('0x0'));var util=require(_0xc0fe('0x1'));var logger=require(_0xc0fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc0fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0fe('0x4'));var rimraf=require(_0xc0fe('0x5'));var config=require('../../config/environment');var attributes=require(_0xc0fe('0x6'));module['exports']=function(_0x3fce36,_0x1073f0){return _0x3fce36['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66cf=['Tag','tools_tags','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x1b6f60,_0x5d658a){var _0x29018c=function(_0x3e2fa9){while(--_0x3e2fa9){_0x1b6f60['push'](_0x1b6f60['shift']());}};_0x29018c(++_0x5d658a);}(_0x66cf,0x1a2));var _0xf66c=function(_0x58acbf,_0x5c655e){_0x58acbf=_0x58acbf-0x0;var _0x505d85=_0x66cf[_0x58acbf];return _0x505d85;};'use strict';var _=require(_0xf66c('0x0'));var util=require('util');var logger=require(_0xf66c('0x1'))(_0xf66c('0x2'));var moment=require('moment');var BPromise=require(_0xf66c('0x3'));var rp=require(_0xf66c('0x4'));var fs=require('fs');var path=require(_0xf66c('0x5'));var rimraf=require(_0xf66c('0x6'));var config=require(_0xf66c('0x7'));var attributes=require(_0xf66c('0x8'));module[_0xf66c('0x9')]=function(_0x5cde89,_0x56dc7b){return _0x5cde89[_0xf66c('0xa')](_0xf66c('0xb'),attributes,{'tableName':_0xf66c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index fb137b2..2858088 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 _0x24cd=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x131d0f,_0x27737d){var _0x5567f7=function(_0x540675){while(--_0x540675){_0x131d0f['push'](_0x131d0f['shift']());}};_0x5567f7(++_0x27737d);}(_0x24cd,0x83));var _0xd24c=function(_0x33dbf4,_0x4c3a3a){_0x33dbf4=_0x33dbf4-0x0;var _0x500a30=_0x24cd[_0x33dbf4];return _0x500a30;};'use strict';var _=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var moment=require('moment');var BPromise=require(_0xd24c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd24c('0x3'));var db=require(_0xd24c('0x4'))['db'];var utils=require(_0xd24c('0x5'));var logger=require('../../config/logger')(_0xd24c('0x6'));var config=require(_0xd24c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd24c('0x8')][_0xd24c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a432a,_0x95eb94,_0x3d4d20){return new BPromise(function(_0x411706,_0x3df525){return client[_0xd24c('0xa')](_0x2a432a,_0x3d4d20)['then'](function(_0x4c4455){logger[_0xd24c('0xb')](_0xd24c('0xc'),_0x95eb94,_0xd24c('0xd'));logger[_0xd24c('0xe')](_0xd24c('0xf'),_0x95eb94,_0xd24c('0xd'),JSON[_0xd24c('0x10')](_0x4c4455));if(_0x4c4455[_0xd24c('0x11')]){if(_0x4c4455['error'][_0xd24c('0x12')]===0x1f4){logger[_0xd24c('0x11')]('Tag,\x20%s,\x20%s',_0x95eb94,_0x4c4455[_0xd24c('0x11')][_0xd24c('0x13')]);return _0x3df525(_0x4c4455[_0xd24c('0x11')][_0xd24c('0x13')]);}logger[_0xd24c('0x11')](_0xd24c('0xc'),_0x95eb94,_0x4c4455[_0xd24c('0x11')][_0xd24c('0x13')]);return _0x411706(_0x4c4455['error'][_0xd24c('0x13')]);}else{logger[_0xd24c('0xb')]('Tag,\x20%s,\x20%s',_0x95eb94,_0xd24c('0xd'));_0x411706(_0x4c4455[_0xd24c('0x14')][_0xd24c('0x13')]);}})[_0xd24c('0x15')](function(_0x509992){logger['error'](_0xd24c('0xc'),_0x95eb94,_0x509992);_0x3df525(_0x509992);});});} \ No newline at end of file +var _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3e7c6d,_0x3f9f3d){var _0x51d909=function(_0xd8e1e3){while(--_0xd8e1e3){_0x3e7c6d['push'](_0x3e7c6d['shift']());}};_0x51d909(++_0x3f9f3d);}(_0x032e,0x124));var _0xe032=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x032e[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('Tag,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('Tag,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f9d6780..0a89d6f 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 fc33746..a6238ec 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x25d155,_0x5d1e4a){var _0x4a9e64=function(_0xc90e2a){while(--_0xc90e2a){_0x25d155['push'](_0x25d155['shift']());}};_0x4a9e64(++_0x5d1e4a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb7e7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 52bf1f2..0184b61 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 _0x3f40=['UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','sendStatus','end','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','pick','Queues','addQueues','add','ids','Unknown\x20channel','addAgents','isArray','Voice','Mail','Sms','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','emit','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','penalty','all','spread','removeAgents','Chat','Queue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Team','include','findAll','rows','then','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId'];(function(_0x2ac610,_0x317145){var _0x9ab5cb=function(_0x19b445){while(--_0x19b445){_0x2ac610['push'](_0x2ac610['shift']());}};_0x9ab5cb(++_0x317145);}(_0x3f40,0xde));var _0x03f4=function(_0x6d10d6,_0x3d0d2d){_0x6d10d6=_0x6d10d6-0x0;var _0x4993cc=_0x3f40[_0x6d10d6];return _0x4993cc;};'use strict';var emlformat=require(_0x03f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03f4('0x1'));var jsonpatch=require(_0x03f4('0x2'));var rp=require(_0x03f4('0x3'));var moment=require(_0x03f4('0x4'));var BPromise=require(_0x03f4('0x5'));var Mustache=require(_0x03f4('0x6'));var util=require(_0x03f4('0x7'));var path=require(_0x03f4('0x8'));var sox=require(_0x03f4('0x9'));var csv=require(_0x03f4('0xa'));var ejs=require(_0x03f4('0xb'));var fs=require('fs');var fs_extra=require(_0x03f4('0xc'));var _=require(_0x03f4('0xd'));var squel=require('squel');var crypto=require(_0x03f4('0xe'));var jsforce=require(_0x03f4('0xf'));var deskjs=require(_0x03f4('0x10'));var toCsv=require(_0x03f4('0xa'));var querystring=require(_0x03f4('0x11'));var Papa=require(_0x03f4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03f4('0x13'));var hardwareService=require(_0x03f4('0x14'));var logger=require(_0x03f4('0x15'))(_0x03f4('0x16'));var utils=require('../../config/utils');var config=require(_0x03f4('0x17'));var licenseUtil=require(_0x03f4('0x18'));var db=require('../../mysqldb')['db'];config[_0x03f4('0x19')]=_[_0x03f4('0x1a')](config[_0x03f4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x03f4('0x1b'))(new Redis(config[_0x03f4('0x19')]));require(_0x03f4('0x1c'))[_0x03f4('0x1d')](socket);function respondWithStatusCode(_0x4a3cd8,_0xee9daa){_0xee9daa=_0xee9daa||0xcc;return function(_0x8c54d0){if(_0x8c54d0){return _0x4a3cd8['sendStatus'](_0xee9daa);}return _0x4a3cd8[_0x03f4('0x1e')](_0xee9daa)['end']();};}function respondWithResult(_0x13b849,_0x599282){_0x599282=_0x599282||0xc8;return function(_0x1d1e1d){if(_0x1d1e1d){return _0x13b849[_0x03f4('0x1e')](_0x599282)['json'](_0x1d1e1d);}};}function respondWithFilteredResult(_0x3aa8b1,_0x2481b5){return function(_0x1ae247){if(_0x1ae247){var _0x324362=typeof _0x2481b5['offset']===_0x03f4('0x1f')&&typeof _0x2481b5['limit']==='undefined';var _0x8925ab=_0x1ae247[_0x03f4('0x20')];var _0x16231f=_0x324362?0x0:_0x2481b5[_0x03f4('0x21')];var _0x3cd8ba=_0x324362?_0x1ae247[_0x03f4('0x20')]:_0x2481b5['offset']+_0x2481b5[_0x03f4('0x22')];var _0x5bd7d2;if(_0x3cd8ba>=_0x8925ab){_0x3cd8ba=_0x8925ab;_0x5bd7d2=0xc8;}else{_0x5bd7d2=0xce;}_0x3aa8b1[_0x03f4('0x1e')](_0x5bd7d2);return _0x3aa8b1[_0x03f4('0x23')](_0x03f4('0x24'),_0x16231f+'-'+_0x3cd8ba+'/'+_0x8925ab)[_0x03f4('0x25')](_0x1ae247);}return null;};}function patchUpdates(_0x8969ef){return function(_0x3ccbc8){try{jsonpatch[_0x03f4('0x26')](_0x3ccbc8,_0x8969ef,!![]);}catch(_0x3c9a6a){return BPromise[_0x03f4('0x27')](_0x3c9a6a);}return _0x3ccbc8[_0x03f4('0x28')]();};}function saveUpdates(_0x2c3947,_0x39a418){return function(_0x3a848e){if(_0x3a848e){return _0x3a848e['update'](_0x2c3947)['then'](function(_0x4c8a45){return _0x4c8a45;});}return null;};}function handleEntityNotFound(_0x395af4,_0xaa9937){return function(_0x512147){if(!_0x512147){_0x395af4['sendStatus'](0x194);}return _0x512147;};}function handleError(_0x490f0a,_0x7870b0){_0x7870b0=_0x7870b0||0x1f4;return function(_0x186b10){logger[_0x03f4('0x29')](_0x186b10[_0x03f4('0x2a')]);if(_0x186b10[_0x03f4('0x2b')]){delete _0x186b10[_0x03f4('0x2b')];}_0x490f0a[_0x03f4('0x1e')](_0x7870b0)[_0x03f4('0x2c')](_0x186b10);};}exports[_0x03f4('0x2d')]=function(_0x436004,_0x4bd1b6){var _0x5d69fb={},_0x238e95={},_0x4ee016={'count':0x0,'rows':[]};var _0x33a068=_['map'](db['Team'][_0x03f4('0x2e')],function(_0x53c84b){return{'name':_0x53c84b[_0x03f4('0x2f')],'type':_0x53c84b[_0x03f4('0x30')][_0x03f4('0x31')]};});_0x238e95['model']=_[_0x03f4('0x32')](_0x33a068,'name');_0x238e95['query']=_[_0x03f4('0x33')](_0x436004[_0x03f4('0x34')]);_0x238e95[_0x03f4('0x35')]=_['intersection'](_0x238e95[_0x03f4('0x36')],_0x238e95['query']);_0x5d69fb[_0x03f4('0x37')]=_[_0x03f4('0x38')](_0x238e95[_0x03f4('0x36')],qs[_0x03f4('0x39')](_0x436004[_0x03f4('0x34')][_0x03f4('0x39')]));_0x5d69fb[_0x03f4('0x37')]=_0x5d69fb['attributes'][_0x03f4('0x3a')]?_0x5d69fb['attributes']:_0x238e95[_0x03f4('0x36')];if(!_0x436004[_0x03f4('0x34')]['hasOwnProperty'](_0x03f4('0x3b'))){_0x5d69fb[_0x03f4('0x22')]=qs[_0x03f4('0x22')](_0x436004['query'][_0x03f4('0x22')]);_0x5d69fb[_0x03f4('0x21')]=qs[_0x03f4('0x21')](_0x436004[_0x03f4('0x34')][_0x03f4('0x21')]);}_0x5d69fb[_0x03f4('0x3c')]=qs['sort'](_0x436004[_0x03f4('0x34')][_0x03f4('0x3d')]);_0x5d69fb[_0x03f4('0x3e')]=qs[_0x03f4('0x35')](_['pick'](_0x436004[_0x03f4('0x34')],_0x238e95[_0x03f4('0x35')]),_0x33a068);if(_0x436004[_0x03f4('0x34')][_0x03f4('0x3f')]){_0x5d69fb[_0x03f4('0x3e')]=_[_0x03f4('0x40')](_0x5d69fb[_0x03f4('0x3e')],{'$or':_['map'](_0x33a068,function(_0x2e34c0){if(_0x2e34c0[_0x03f4('0x30')]!==_0x03f4('0x41')){var _0x5dd55f={};_0x5dd55f[_0x2e34c0[_0x03f4('0x2b')]]={'$like':'%'+_0x436004[_0x03f4('0x34')][_0x03f4('0x3f')]+'%'};return _0x5dd55f;}})});}_0x5d69fb=_[_0x03f4('0x40')]({},_0x5d69fb,_0x436004[_0x03f4('0x42')]);var _0x5398b7={'where':_0x5d69fb[_0x03f4('0x3e')]};return db[_0x03f4('0x43')]['count'](_0x5398b7)['then'](function(_0x41155e){_0x4ee016['count']=_0x41155e;if(_0x436004[_0x03f4('0x34')]['includeAll']){_0x5d69fb[_0x03f4('0x44')]=[{'all':!![]}];}return db[_0x03f4('0x43')][_0x03f4('0x45')](_0x5d69fb);})['then'](function(_0x52f408){_0x4ee016[_0x03f4('0x46')]=_0x52f408;return _0x4ee016;})[_0x03f4('0x47')](respondWithFilteredResult(_0x4bd1b6,_0x5d69fb))['catch'](handleError(_0x4bd1b6,null));};exports[_0x03f4('0x48')]=function(_0x2e81ea,_0x32318c){var _0xb88bed={'raw':![],'where':{'id':_0x2e81ea[_0x03f4('0x49')]['id']}},_0x3a164e={};_0x3a164e['model']=_[_0x03f4('0x33')](db[_0x03f4('0x43')][_0x03f4('0x2e')]);_0x3a164e[_0x03f4('0x34')]=_[_0x03f4('0x33')](_0x2e81ea['query']);_0x3a164e[_0x03f4('0x35')]=_[_0x03f4('0x38')](_0x3a164e[_0x03f4('0x36')],_0x3a164e[_0x03f4('0x34')]);_0xb88bed[_0x03f4('0x37')]=_[_0x03f4('0x38')](_0x3a164e[_0x03f4('0x36')],qs[_0x03f4('0x39')](_0x2e81ea[_0x03f4('0x34')]['fields']));_0xb88bed[_0x03f4('0x37')]=_0xb88bed[_0x03f4('0x37')]['length']?_0xb88bed[_0x03f4('0x37')]:_0x3a164e[_0x03f4('0x36')];if(_0x2e81ea[_0x03f4('0x34')]['includeAll']){_0xb88bed[_0x03f4('0x44')]=[{'all':!![]}];}_0xb88bed=_[_0x03f4('0x40')]({},_0xb88bed,_0x2e81ea[_0x03f4('0x42')]);return db['Team'][_0x03f4('0x4a')](_0xb88bed)[_0x03f4('0x47')](handleEntityNotFound(_0x32318c,null))['then'](respondWithResult(_0x32318c,null))[_0x03f4('0x4b')](handleError(_0x32318c,null));};exports[_0x03f4('0x4c')]=function(_0x5820ea,_0x5df4d7){return db[_0x03f4('0x43')][_0x03f4('0x4c')](_0x5820ea[_0x03f4('0x4d')],{})['then'](function(_0x1deebf){var _0x49b076=_0x5820ea[_0x03f4('0x4e')][_0x03f4('0x4f')]({'plain':!![]});if(!_0x49b076)throw new Error(_0x03f4('0x50'));if(_0x49b076[_0x03f4('0x51')]===_0x03f4('0x4e')){var _0x24fb5f=_0x1deebf[_0x03f4('0x4f')]({'plain':!![]});var _0x2bb68a=_0x03f4('0x52');return db['UserProfileSection'][_0x03f4('0x4a')]({'where':{'name':_0x2bb68a,'userProfileId':_0x49b076[_0x03f4('0x53')]},'raw':!![]})[_0x03f4('0x47')](function(_0x5e1620){if(_0x5e1620&&_0x5e1620[_0x03f4('0x54')]===0x0){return db[_0x03f4('0x55')][_0x03f4('0x4c')]({'name':_0x24fb5f[_0x03f4('0x2b')],'resourceId':_0x24fb5f['id'],'type':_0x5e1620['name'],'sectionId':_0x5e1620['id']},{})[_0x03f4('0x47')](function(){return _0x1deebf;});}else{return _0x1deebf;}})[_0x03f4('0x4b')](function(_0x1b88e7){logger['error'](_0x03f4('0x56'),_0x1b88e7);throw _0x1b88e7;});}return _0x1deebf;})[_0x03f4('0x47')](respondWithResult(_0x5df4d7,0xc9))['catch'](handleError(_0x5df4d7,null));};exports[_0x03f4('0x57')]=function(_0x1999b2,_0x58dfe4){if(_0x1999b2[_0x03f4('0x4d')]['id']){delete _0x1999b2[_0x03f4('0x4d')]['id'];}return db['Team'][_0x03f4('0x4a')]({'where':{'id':_0x1999b2[_0x03f4('0x49')]['id']}})[_0x03f4('0x47')](handleEntityNotFound(_0x58dfe4,null))[_0x03f4('0x47')](saveUpdates(_0x1999b2['body'],null))['then'](respondWithResult(_0x58dfe4,null))[_0x03f4('0x4b')](handleError(_0x58dfe4,null));};exports[_0x03f4('0x58')]=function(_0xc5eee5,_0x484ba9){var _0x7366bd=_0xc5eee5[_0x03f4('0x49')]['id'];var _0x3c5350=[];return db[_0x03f4('0x59')][_0x03f4('0x5a')](function(_0x4826c8){var _0xb8350f=_0x03f4('0x5b')+_0x7366bd;return db['sequelize'][_0x03f4('0x34')](_0xb8350f,{'type':db['Sequelize'][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8})[_0x03f4('0x47')](function(_0x50acc5){_0x3c5350=_['map'](_0x50acc5,function(_0x16be87){return Number(_0x16be87[_0x03f4('0x5e')]);});})[_0x03f4('0x47')](function(){var _0x30d08b=_0x03f4('0x5f')+_0x7366bd;return db[_0x03f4('0x59')]['query'](_0x30d08b,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x401045){var _0x45350e=_[_0x03f4('0x32')](_0x401045,function(_0x26ef3c){return Number(_0x26ef3c[_0x03f4('0x61')]);});return db[_0x03f4('0x62')]['destroy']({'where':{'UserId':{'$in':_0x3c5350},'VoiceQueueId':{'$in':_0x45350e}},'transaction':_0x4826c8});})[_0x03f4('0x47')](function(){var _0x923ded=_0x03f4('0x63')+_0x7366bd;return db[_0x03f4('0x59')]['query'](_0x923ded,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x591a34){var _0x1ca06d=_[_0x03f4('0x32')](_0x591a34,function(_0x2d5375){return Number(_0x2d5375[_0x03f4('0x64')]);});return db[_0x03f4('0x65')][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'MailQueueId':{'$in':_0x1ca06d}},'transaction':_0x4826c8});})['then'](function(){var _0x7cb32a=_0x03f4('0x66')+_0x7366bd;return db[_0x03f4('0x59')][_0x03f4('0x34')](_0x7cb32a,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x2e2d08){var _0x26feab=_[_0x03f4('0x32')](_0x2e2d08,function(_0x159197){return Number(_0x159197['SmsQueueId']);});return db[_0x03f4('0x67')][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'SmsQueueId':{'$in':_0x26feab}},'transaction':_0x4826c8});})['then'](function(){var _0x16d62f=_0x03f4('0x68')+_0x7366bd;return db[_0x03f4('0x59')]['query'](_0x16d62f,{'type':db[_0x03f4('0x60')]['QueryTypes'][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x147720){var _0x191080=_['map'](_0x147720,function(_0x42c473){return Number(_0x42c473['ChatQueueId']);});return db[_0x03f4('0x69')]['destroy']({'where':{'UserId':{'$in':_0x3c5350},'ChatQueueId':{'$in':_0x191080}},'transaction':_0x4826c8});})[_0x03f4('0x47')](function(){var _0x1f4048=_0x03f4('0x6a')+_0x7366bd;return db[_0x03f4('0x59')][_0x03f4('0x34')](_0x1f4048,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})['then'](function(_0x3f0790){var _0x16b28f=_[_0x03f4('0x32')](_0x3f0790,function(_0x54ff78){return Number(_0x54ff78[_0x03f4('0x6b')]);});return db['UserFaxQueue'][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'FaxQueueId':{'$in':_0x16b28f}},'transaction':_0x4826c8});})['then'](function(){var _0x1d5e69=_0x03f4('0x6c')+_0x7366bd;return db[_0x03f4('0x59')][_0x03f4('0x34')](_0x1d5e69,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x30b650){var _0x5e92c1=_['map'](_0x30b650,function(_0x4bc7e2){return Number(_0x4bc7e2[_0x03f4('0x6d')]);});return db[_0x03f4('0x6e')][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'OpenchannelQueueId':{'$in':_0x5e92c1}},'transaction':_0x4826c8});})['then'](function(){var _0x1a4578=_0x03f4('0x6f')+_0x7366bd;return db[_0x03f4('0x59')][_0x03f4('0x34')](_0x1a4578,{'type':db[_0x03f4('0x60')][_0x03f4('0x5c')][_0x03f4('0x5d')],'raw':!![],'transaction':_0x4826c8});})['then'](function(_0x3ef041){var _0x2d453d=_[_0x03f4('0x32')](_0x3ef041,function(_0x4a31c7){return Number(_0x4a31c7[_0x03f4('0x70')]);});return db[_0x03f4('0x71')][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'WhatsappQueueId':{'$in':_0x2d453d}},'transaction':_0x4826c8});})[_0x03f4('0x47')](function(){return db[_0x03f4('0x72')][_0x03f4('0x4a')]({'where':{'TeamId':_0x7366bd}});})[_0x03f4('0x47')](function(_0x1fe139){if(_0x1fe139===null){return;}return db[_0x03f4('0x73')][_0x03f4('0x58')]({'where':{'UserId':{'$in':_0x3c5350},'VoicePrefixId':_0x1fe139[_0x03f4('0x74')]},'transaction':_0x4826c8});})[_0x03f4('0x47')](function(){return db[_0x03f4('0x43')][_0x03f4('0x58')]({'where':{'id':_0x7366bd},'cascade':!![],'transaction':_0x4826c8});})[_0x03f4('0x47')](function(_0x151ad0){if(_0x151ad0===0x0){_0x484ba9[_0x03f4('0x75')](0x194);}else{return db[_0x03f4('0x55')][_0x03f4('0x58')]({'where':{'type':_0x03f4('0x52'),'resourceId':_0x7366bd},'cascade':!![],'transaction':_0x4826c8})[_0x03f4('0x47')](function(){_0x484ba9['status'](0xcc)[_0x03f4('0x76')]();});}})[_0x03f4('0x4b')](function(_0x2117da){_0x484ba9[_0x03f4('0x1e')](0x1f4)[_0x03f4('0x2c')](_0x2117da);});});};exports[_0x03f4('0x77')]=function(_0x3f3a18,_0x12f0ea,_0x4f7d9c){return db[_0x03f4('0x43')][_0x03f4('0x78')]({'where':{'id':_0x3f3a18[_0x03f4('0x49')]['id']}})[_0x03f4('0x47')](handleEntityNotFound(_0x12f0ea,null))['then'](function(_0x54ebf1){if(!_0x3f3a18[_0x03f4('0x34')][_0x03f4('0x79')]||!utils[_0x03f4('0x7a')](_0x3f3a18[_0x03f4('0x34')][_0x03f4('0x79')])){throw new db['Sequelize'][(_0x03f4('0x7b'))]('Unknown\x20channel');}var _0xd858ca={};var _0x566aae={};_0x566aae['model']=_[_0x03f4('0x33')](db[_[_0x03f4('0x7c')](_0x3f3a18[_0x03f4('0x34')][_0x03f4('0x79')][_0x03f4('0x7d')]())+_0x03f4('0x7e')][_0x03f4('0x2e')]);_0x566aae['query']=_['keys'](_0x3f3a18[_0x03f4('0x34')]);_0x566aae['filters']=_['intersection'](_0x566aae[_0x03f4('0x36')],_0x566aae['query']);_0xd858ca['attributes']=_[_0x03f4('0x38')](_0x566aae['model'],qs[_0x03f4('0x39')](_0x3f3a18[_0x03f4('0x34')]['fields']));_0xd858ca['attributes']=_0xd858ca[_0x03f4('0x37')][_0x03f4('0x3a')]?_0xd858ca[_0x03f4('0x37')]:_0x566aae[_0x03f4('0x36')];_0xd858ca[_0x03f4('0x22')]=qs[_0x03f4('0x22')](_0x3f3a18[_0x03f4('0x34')]['limit']);_0xd858ca[_0x03f4('0x21')]=qs[_0x03f4('0x21')](_0x3f3a18[_0x03f4('0x34')][_0x03f4('0x21')]);_0xd858ca[_0x03f4('0x3c')]=qs[_0x03f4('0x3d')](_0x3f3a18[_0x03f4('0x34')][_0x03f4('0x3d')]);_0xd858ca[_0x03f4('0x3e')]=qs[_0x03f4('0x35')](_[_0x03f4('0x7f')](_0x3f3a18[_0x03f4('0x34')],_0x566aae['filters']));_0xd858ca=_[_0x03f4('0x40')]({},_0xd858ca,_0x3f3a18[_0x03f4('0x42')]);return _0x54ebf1[_0x03f4('0x4f')+_[_0x03f4('0x7c')](_0x3f3a18['query'][_0x03f4('0x79')][_0x03f4('0x7d')]())+_0x03f4('0x80')](_0xd858ca);})[_0x03f4('0x47')](respondWithResult(_0x12f0ea,null))['catch'](handleError(_0x12f0ea,null));};exports[_0x03f4('0x81')]=function(_0x78f8f8,_0x447619,_0x5ea325){return db[_0x03f4('0x43')][_0x03f4('0x78')]({'where':{'id':_0x78f8f8[_0x03f4('0x49')]['id']}})[_0x03f4('0x47')](function(_0x43b49f){if(_0x43b49f){if(!_0x78f8f8[_0x03f4('0x4d')][_0x03f4('0x79')]||!utils[_0x03f4('0x7a')](_0x78f8f8[_0x03f4('0x4d')]['channel'])){throw new db[(_0x03f4('0x60'))]['ValidationError']('Unknown\x20channel');}return _0x43b49f[_0x03f4('0x82')+_[_0x03f4('0x7c')](_0x78f8f8[_0x03f4('0x4d')]['channel'][_0x03f4('0x7d')]())+'Queues'](_0x78f8f8['body'][_0x03f4('0x83')]);}return null;})[_0x03f4('0x47')](handleEntityNotFound(_0x447619,null))[_0x03f4('0x47')](respondWithStatusCode(_0x447619,null))[_0x03f4('0x4b')](handleError(_0x447619,null));};exports['removeQueues']=function(_0x1d4fdd,_0x5d6948,_0x3df891){return db['Team'][_0x03f4('0x78')]({'where':{'id':_0x1d4fdd['params']['id']}})[_0x03f4('0x47')](function(_0x571651){if(_0x571651){if(!_0x1d4fdd[_0x03f4('0x34')][_0x03f4('0x79')]||!utils[_0x03f4('0x7a')](_0x1d4fdd[_0x03f4('0x34')]['channel'])){throw new db[(_0x03f4('0x60'))]['ValidationError'](_0x03f4('0x84'));}return _0x571651['remove'+_[_0x03f4('0x7c')](_0x1d4fdd[_0x03f4('0x34')]['channel'][_0x03f4('0x7d')]())+_0x03f4('0x80')](_0x1d4fdd[_0x03f4('0x34')][_0x03f4('0x83')]);}return null;})['then'](handleEntityNotFound(_0x5d6948,null))[_0x03f4('0x47')](respondWithStatusCode(_0x5d6948,null))[_0x03f4('0x4b')](handleError(_0x5d6948,null));};exports[_0x03f4('0x85')]=function(_0x330488,_0x52b28a){var _0x58bb8f=_[_0x03f4('0x86')](_0x330488[_0x03f4('0x4d')][_0x03f4('0x83')])?_0x330488[_0x03f4('0x4d')]['ids']:[_0x330488[_0x03f4('0x4d')][_0x03f4('0x83')]];var _0x2fd4e1=_0x330488[_0x03f4('0x49')]['id'];return db[_0x03f4('0x43')]['find']({'where':{'id':_0x2fd4e1}})[_0x03f4('0x47')](handleEntityNotFound(_0x52b28a,null))['then'](function(_0x3d2ab0){if(_0x3d2ab0){var _0x47efbf=[_0x03f4('0x87'),'Chat',_0x03f4('0x88'),_0x03f4('0x89'),'Fax',_0x03f4('0x8a'),_0x03f4('0x8b')];return db[_0x03f4('0x59')][_0x03f4('0x5a')](function(_0x4a37b5){var _0x1164c7=_['map'](_0x47efbf,function(_0x4cecaa){var _0x29e9dd={'attributes':['id',_0x03f4('0x2b')]};if(_0x4cecaa===_0x03f4('0x87')){_0x29e9dd[_0x03f4('0x8c')]={'attributes':['penalty']};}return _0x3d2ab0[_0x03f4('0x4f')+_0x4cecaa+'Queues'](_0x29e9dd)[_0x03f4('0x47')](function(_0x2aad8b){var _0x164c3f=_['map'](_0x2aad8b,function(_0x218bd5){var _0x1dbe3c=_[_0x03f4('0x32')](_0x58bb8f,function(_0x59c035){var _0x2bdd35={'where':{'UserId':_0x59c035,[_0x4cecaa+_0x03f4('0x8d')]:_0x218bd5['id']},'transaction':_0x4a37b5};if(_0x4cecaa===_0x03f4('0x87')){_0x2bdd35[_0x03f4('0x1a')]={'penalty':_0x218bd5[_0x03f4('0x8e')]['penalty']};}return db['User'+_0x4cecaa+_0x03f4('0x7e')]['findOrCreate'](_0x2bdd35)['then'](function(){socket[_0x03f4('0x8f')](_0x03f4('0x4e')+_0x4cecaa+'Queue:save',{'UserId':_0x59c035,[_0x4cecaa+_0x03f4('0x8d')]:_0x218bd5['id']});if(_0x4cecaa!==_0x03f4('0x87')){return;}return db[_0x03f4('0x90')][_0x03f4('0x45')]({'where':{'id':_0x58bb8f,'online':0x1},'attributes':['id',_0x03f4('0x2b'),_0x03f4('0x91'),_0x03f4('0x92'),_0x03f4('0x93')],'raw':!![]})[_0x03f4('0x47')](function(_0x11ed81){var _0x39b748=_[_0x03f4('0x32')](_0x11ed81,function(_0x262dd2){return db[_0x03f4('0x94')][_0x03f4('0x95')]({'membername':_0x262dd2[_0x03f4('0x2b')],'UserId':_0x262dd2['id'],'queue_name':_0x218bd5[_0x03f4('0x2b')],'VoiceQueueId':_0x218bd5['id'],'interface':_[_0x03f4('0x96')](_0x262dd2[_0x03f4('0x93')])?util[_0x03f4('0x97')]('SIP/%s',_0x262dd2['name']):_0x262dd2['interface'],'paused':_0x262dd2[_0x03f4('0x92')]||![],'penalty':_0x218bd5[_0x03f4('0x8e')][_0x03f4('0x98')]},{'transaction':_0x4a37b5});});return Promise[_0x03f4('0x99')](_0x39b748);});});});return Promise['all'](_0x1dbe3c);});return Promise['all'](_0x164c3f);})[_0x03f4('0x47')](function(){return db[_0x03f4('0x72')][_0x03f4('0x78')]({'where':{'teamId':_0x2fd4e1}})[_0x03f4('0x47')](function(_0x59b5f0){if(_0x59b5f0){var _0x4fda23=_[_0x03f4('0x32')](_0x58bb8f,function(_0x2af393){db[_0x03f4('0x73')][_0x03f4('0x95')]({'UserId':_0x2af393,'VoicePrefixId':_0x59b5f0[_0x03f4('0x74')]});});return Promise[_0x03f4('0x99')](_0x4fda23);}});});});return Promise[_0x03f4('0x99')](_0x1164c7)[_0x03f4('0x47')](function(){return _0x3d2ab0[_0x03f4('0x85')](_0x58bb8f,{'transaction':_0x4a37b5})[_0x03f4('0x9a')](function(_0x47732f){return _0x47732f;});});});}})[_0x03f4('0x47')](respondWithResult(_0x52b28a,null))[_0x03f4('0x4b')](handleError(_0x52b28a,null));};exports[_0x03f4('0x9b')]=function(_0x331d34,_0x5f3160){var _0x426026=_[_0x03f4('0x86')](_0x331d34['query'][_0x03f4('0x83')])?_0x331d34[_0x03f4('0x34')][_0x03f4('0x83')]:[_0x331d34[_0x03f4('0x34')][_0x03f4('0x83')]];var _0x4c7a32=_0x331d34['params']['id'];return db[_0x03f4('0x43')][_0x03f4('0x4a')]({'where':{'id':_0x4c7a32}})[_0x03f4('0x47')](handleEntityNotFound(_0x5f3160,null))[_0x03f4('0x47')](function(_0xa8bb5){if(_0xa8bb5){var _0x5a51cb=[_0x03f4('0x87'),_0x03f4('0x9c'),'Mail','Sms','Fax',_0x03f4('0x8a'),_0x03f4('0x8b')];return db[_0x03f4('0x59')][_0x03f4('0x5a')](function(_0x8a3c1b){var _0x255d19=_[_0x03f4('0x32')](_0x5a51cb,function(_0x1969b3){var _0xdc1896={'attributes':['id',_0x03f4('0x2b')]};return _0xa8bb5[_0x03f4('0x4f')+_0x1969b3+_0x03f4('0x80')](_0xdc1896)[_0x03f4('0x47')](function(_0x4dab24){var _0x529e8c=_[_0x03f4('0x32')](_0x4dab24,function(_0x3975b1){return _0x3975b1[_0x03f4('0x9b')](_0x426026,{'transaction':_0x8a3c1b})[_0x03f4('0x47')](function(){var _0x409339=_[_0x03f4('0x32')](_0x426026,function(_0x126941){socket[_0x03f4('0x8f')](_0x03f4('0x4e')+_0x1969b3+_0x03f4('0x9d'),{'UserId':Number(_0x126941),[_0x1969b3+_0x03f4('0x8d')]:_0x3975b1['id']});if(_0x1969b3!==_0x03f4('0x87')){return;}return db[_0x03f4('0x94')]['destroy']({'where':{'VoiceQueueId':_0x3975b1['id'],'UserId':_0x126941},'transaction':_0x8a3c1b});});return Promise[_0x03f4('0x99')](_0x409339);});});return Promise[_0x03f4('0x99')](_0x529e8c);});});return Promise[_0x03f4('0x99')](_0x255d19)[_0x03f4('0x47')](function(){return _0xa8bb5[_0x03f4('0x9b')](_0x426026,{'transaction':_0x8a3c1b});})[_0x03f4('0x47')](function(){return db['TeamVoicePrefix'][_0x03f4('0x78')]({'where':{'teamId':_0x4c7a32}})[_0x03f4('0x47')](function(_0x1118ce){if(_0x1118ce){var _0x5b6f20=_[_0x03f4('0x32')](_0x426026,function(_0x4eddde){db[_0x03f4('0x73')][_0x03f4('0x58')]({'where':{'UserId':_0x4eddde,'VoicePrefixId':_0x1118ce[_0x03f4('0x74')]}});});return Promise['all'](_0x5b6f20);}});});});}})[_0x03f4('0x47')](respondWithStatusCode(_0x5f3160,null))[_0x03f4('0x4b')](handleError(_0x5f3160,null));};exports[_0x03f4('0x9e')]=function(_0x441078,_0x5baafe,_0x4b312c){var _0x555035={};var _0x142680={};var _0x48ca04;var _0x11deec;return db[_0x03f4('0x43')][_0x03f4('0x78')]({'where':{'id':_0x441078[_0x03f4('0x49')]['id']}})[_0x03f4('0x47')](handleEntityNotFound(_0x5baafe,null))['then'](function(_0x29cba6){if(_0x29cba6){_0x48ca04=_0x29cba6;_0x142680[_0x03f4('0x36')]=_['keys'](db[_0x03f4('0x90')]['rawAttributes']);_0x142680[_0x03f4('0x34')]=_[_0x03f4('0x33')](_0x441078['query']);_0x142680[_0x03f4('0x35')]=_['intersection'](_0x142680['model'],_0x142680[_0x03f4('0x34')]);_0x555035[_0x03f4('0x37')]=_[_0x03f4('0x38')](_0x142680[_0x03f4('0x36')],qs[_0x03f4('0x39')](_0x441078[_0x03f4('0x34')][_0x03f4('0x39')]));_0x555035[_0x03f4('0x37')]=_0x555035[_0x03f4('0x37')][_0x03f4('0x3a')]?_0x555035[_0x03f4('0x37')]:_0x142680[_0x03f4('0x36')];_0x555035[_0x03f4('0x3c')]=qs['sort'](_0x441078[_0x03f4('0x34')]['sort']);_0x555035['where']=qs[_0x03f4('0x35')](_[_0x03f4('0x7f')](_0x441078['query'],_0x142680[_0x03f4('0x35')]));if(_0x441078['query']['filter']){_0x555035[_0x03f4('0x3e')]=_['merge'](_0x555035[_0x03f4('0x3e')],{'$or':_['map'](_0x555035[_0x03f4('0x37')],function(_0x476146){var _0x387d51={};_0x387d51[_0x476146]={'$like':'%'+_0x441078['query']['filter']+'%'};return _0x387d51;})});}_0x555035=_[_0x03f4('0x40')]({},_0x555035,_0x441078[_0x03f4('0x42')]);return _0x48ca04[_0x03f4('0x9e')](_0x555035);}})[_0x03f4('0x47')](function(_0x3056a6){if(_0x3056a6){_0x11deec=_0x3056a6[_0x03f4('0x3a')];if(!_0x441078[_0x03f4('0x34')][_0x03f4('0x9f')]('nolimit')){_0x555035[_0x03f4('0x22')]=qs[_0x03f4('0x22')](_0x441078[_0x03f4('0x34')][_0x03f4('0x22')]);_0x555035[_0x03f4('0x21')]=qs[_0x03f4('0x21')](_0x441078[_0x03f4('0x34')][_0x03f4('0x21')]);}return _0x48ca04[_0x03f4('0x9e')](_0x555035);}})[_0x03f4('0x47')](function(_0x2ec657){if(_0x2ec657){return _0x2ec657?{'count':_0x11deec,'rows':_0x2ec657}:null;}})[_0x03f4('0x47')](respondWithResult(_0x5baafe,null))[_0x03f4('0x4b')](handleError(_0x5baafe,null));}; \ No newline at end of file +var _0xfacd=['register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','Team','includeAll','include','findAll','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','UserProfileResource','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','order','addQueues','Unknown\x20channel','add','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','defaults','TeamVoiceQueue','User','findOrCreate','emit','QueueId','online','voicePause','UserVoiceQueueRt','isNil','interface','all','upsert','spread','removeAgents','Chat','Queue:remove','getAgents','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./team.socket'];(function(_0x1645af,_0x2aa5b){var _0xbdc903=function(_0x471d5c){while(--_0x471d5c){_0x1645af['push'](_0x1645af['shift']());}};_0xbdc903(++_0x2aa5b);}(_0xfacd,0x7e));var _0xdfac=function(_0xcbce20,_0x32e362){_0xcbce20=_0xcbce20-0x0;var _0x490842=_0xfacd[_0xcbce20];return _0x490842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfac('0x0'));var zipdir=require(_0xdfac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfac('0x2'));var moment=require(_0xdfac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdfac('0x4'));var util=require(_0xdfac('0x5'));var path=require(_0xdfac('0x6'));var sox=require(_0xdfac('0x7'));var csv=require(_0xdfac('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfac('0x9'));var _=require(_0xdfac('0xa'));var squel=require(_0xdfac('0xb'));var crypto=require(_0xdfac('0xc'));var jsforce=require(_0xdfac('0xd'));var deskjs=require(_0xdfac('0xe'));var toCsv=require(_0xdfac('0x8'));var querystring=require(_0xdfac('0xf'));var Papa=require('papaparse');var Redis=require(_0xdfac('0x10'));var authService=require(_0xdfac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdfac('0x12'));var hardwareService=require(_0xdfac('0x13'));var logger=require(_0xdfac('0x14'))(_0xdfac('0x15'));var utils=require('../../config/utils');var config=require(_0xdfac('0x16'));var licenseUtil=require(_0xdfac('0x17'));var db=require(_0xdfac('0x18'))['db'];config[_0xdfac('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfac('0x19')]));require(_0xdfac('0x1a'))[_0xdfac('0x1b')](socket);function respondWithStatusCode(_0x151c09,_0x223945){_0x223945=_0x223945||0xcc;return function(_0x1c68b2){if(_0x1c68b2){return _0x151c09[_0xdfac('0x1c')](_0x223945);}return _0x151c09[_0xdfac('0x1d')](_0x223945)[_0xdfac('0x1e')]();};}function respondWithResult(_0x49b496,_0x4b582e){_0x4b582e=_0x4b582e||0xc8;return function(_0x6ed769){if(_0x6ed769){return _0x49b496[_0xdfac('0x1d')](_0x4b582e)[_0xdfac('0x1f')](_0x6ed769);}};}function respondWithFilteredResult(_0x40a62c,_0x3fa3bc){return function(_0x267f8d){if(_0x267f8d){var _0x5e7b9a=typeof _0x3fa3bc[_0xdfac('0x20')]===_0xdfac('0x21')&&typeof _0x3fa3bc[_0xdfac('0x22')]==='undefined';var _0x15a547=_0x267f8d[_0xdfac('0x23')];var _0x42e37d=_0x5e7b9a?0x0:_0x3fa3bc[_0xdfac('0x20')];var _0x384945=_0x5e7b9a?_0x267f8d['count']:_0x3fa3bc[_0xdfac('0x20')]+_0x3fa3bc[_0xdfac('0x22')];var _0xff5f25;if(_0x384945>=_0x15a547){_0x384945=_0x15a547;_0xff5f25=0xc8;}else{_0xff5f25=0xce;}_0x40a62c[_0xdfac('0x1d')](_0xff5f25);return _0x40a62c['set'](_0xdfac('0x24'),_0x42e37d+'-'+_0x384945+'/'+_0x15a547)[_0xdfac('0x1f')](_0x267f8d);}return null;};}function patchUpdates(_0x4ef2e1){return function(_0x225924){try{jsonpatch[_0xdfac('0x25')](_0x225924,_0x4ef2e1,!![]);}catch(_0x598459){return BPromise['reject'](_0x598459);}return _0x225924[_0xdfac('0x26')]();};}function saveUpdates(_0x394186,_0x31b9d7){return function(_0x364155){if(_0x364155){return _0x364155[_0xdfac('0x27')](_0x394186)[_0xdfac('0x28')](function(_0x107bde){return _0x107bde;});}return null;};}function handleEntityNotFound(_0x13031f,_0x11f0d6){return function(_0x198679){if(!_0x198679){_0x13031f[_0xdfac('0x1c')](0x194);}return _0x198679;};}function handleError(_0x2e3d13,_0x345982){_0x345982=_0x345982||0x1f4;return function(_0x49b136){logger[_0xdfac('0x29')](_0x49b136['stack']);if(_0x49b136['name']){delete _0x49b136[_0xdfac('0x2a')];}_0x2e3d13['status'](_0x345982)[_0xdfac('0x2b')](_0x49b136);};}exports[_0xdfac('0x2c')]=function(_0xbb8189,_0x56b949){var _0x466833={},_0x2038f2={},_0x23faf4={'count':0x0,'rows':[]};var _0x424c68=_[_0xdfac('0x2d')](db['Team'][_0xdfac('0x2e')],function(_0x4190f8){return{'name':_0x4190f8[_0xdfac('0x2f')],'type':_0x4190f8['type'][_0xdfac('0x30')]};});_0x2038f2['model']=_['map'](_0x424c68,_0xdfac('0x2a'));_0x2038f2[_0xdfac('0x31')]=_[_0xdfac('0x32')](_0xbb8189[_0xdfac('0x31')]);_0x2038f2[_0xdfac('0x33')]=_['intersection'](_0x2038f2['model'],_0x2038f2[_0xdfac('0x31')]);_0x466833[_0xdfac('0x34')]=_[_0xdfac('0x35')](_0x2038f2[_0xdfac('0x36')],qs[_0xdfac('0x37')](_0xbb8189[_0xdfac('0x31')]['fields']));_0x466833[_0xdfac('0x34')]=_0x466833[_0xdfac('0x34')][_0xdfac('0x38')]?_0x466833[_0xdfac('0x34')]:_0x2038f2[_0xdfac('0x36')];if(!_0xbb8189[_0xdfac('0x31')][_0xdfac('0x39')](_0xdfac('0x3a'))){_0x466833[_0xdfac('0x22')]=qs[_0xdfac('0x22')](_0xbb8189['query']['limit']);_0x466833[_0xdfac('0x20')]=qs['offset'](_0xbb8189[_0xdfac('0x31')][_0xdfac('0x20')]);}_0x466833['order']=qs['sort'](_0xbb8189['query'][_0xdfac('0x3b')]);_0x466833[_0xdfac('0x3c')]=qs[_0xdfac('0x33')](_[_0xdfac('0x3d')](_0xbb8189[_0xdfac('0x31')],_0x2038f2['filters']),_0x424c68);if(_0xbb8189[_0xdfac('0x31')]['filter']){_0x466833[_0xdfac('0x3c')]=_['merge'](_0x466833[_0xdfac('0x3c')],{'$or':_[_0xdfac('0x2d')](_0x424c68,function(_0x1c5bea){if(_0x1c5bea[_0xdfac('0x3e')]!==_0xdfac('0x3f')){var _0x41a925={};_0x41a925[_0x1c5bea[_0xdfac('0x2a')]]={'$like':'%'+_0xbb8189[_0xdfac('0x31')][_0xdfac('0x40')]+'%'};return _0x41a925;}})});}_0x466833=_[_0xdfac('0x41')]({},_0x466833,_0xbb8189[_0xdfac('0x42')]);var _0x2c6830={'where':_0x466833['where']};return db[_0xdfac('0x43')][_0xdfac('0x23')](_0x2c6830)[_0xdfac('0x28')](function(_0x404e29){_0x23faf4[_0xdfac('0x23')]=_0x404e29;if(_0xbb8189[_0xdfac('0x31')][_0xdfac('0x44')]){_0x466833[_0xdfac('0x45')]=[{'all':!![]}];}return db[_0xdfac('0x43')][_0xdfac('0x46')](_0x466833);})[_0xdfac('0x28')](function(_0x1077a8){_0x23faf4[_0xdfac('0x47')]=_0x1077a8;return _0x23faf4;})[_0xdfac('0x28')](respondWithFilteredResult(_0x56b949,_0x466833))[_0xdfac('0x48')](handleError(_0x56b949,null));};exports['show']=function(_0x26c5eb,_0x36792a){var _0x1007ed={'raw':![],'where':{'id':_0x26c5eb[_0xdfac('0x49')]['id']}},_0x2ea877={};_0x2ea877[_0xdfac('0x36')]=_[_0xdfac('0x32')](db[_0xdfac('0x43')][_0xdfac('0x2e')]);_0x2ea877[_0xdfac('0x31')]=_[_0xdfac('0x32')](_0x26c5eb[_0xdfac('0x31')]);_0x2ea877[_0xdfac('0x33')]=_[_0xdfac('0x35')](_0x2ea877['model'],_0x2ea877['query']);_0x1007ed[_0xdfac('0x34')]=_[_0xdfac('0x35')](_0x2ea877['model'],qs[_0xdfac('0x37')](_0x26c5eb['query'][_0xdfac('0x37')]));_0x1007ed[_0xdfac('0x34')]=_0x1007ed[_0xdfac('0x34')][_0xdfac('0x38')]?_0x1007ed[_0xdfac('0x34')]:_0x2ea877[_0xdfac('0x36')];if(_0x26c5eb[_0xdfac('0x31')][_0xdfac('0x44')]){_0x1007ed['include']=[{'all':!![]}];}_0x1007ed=_[_0xdfac('0x41')]({},_0x1007ed,_0x26c5eb[_0xdfac('0x42')]);return db[_0xdfac('0x43')]['find'](_0x1007ed)[_0xdfac('0x28')](handleEntityNotFound(_0x36792a,null))[_0xdfac('0x28')](respondWithResult(_0x36792a,null))['catch'](handleError(_0x36792a,null));};exports[_0xdfac('0x4a')]=function(_0x3bf8d8,_0x5c141f){return db['Team'][_0xdfac('0x4a')](_0x3bf8d8[_0xdfac('0x4b')],{})[_0xdfac('0x28')](function(_0x4e97f9){var _0x1bc0a4=_0x3bf8d8[_0xdfac('0x4c')][_0xdfac('0x4d')]({'plain':!![]});if(!_0x1bc0a4)throw new Error(_0xdfac('0x4e'));if(_0x1bc0a4[_0xdfac('0x4f')]===_0xdfac('0x4c')){var _0x506d86=_0x4e97f9[_0xdfac('0x4d')]({'plain':!![]});var _0x3307c3=_0xdfac('0x50');return db[_0xdfac('0x51')][_0xdfac('0x52')]({'where':{'name':_0x3307c3,'userProfileId':_0x1bc0a4[_0xdfac('0x53')]},'raw':!![]})[_0xdfac('0x28')](function(_0x46d5c2){if(_0x46d5c2&&_0x46d5c2['autoAssociation']===0x0){return db[_0xdfac('0x54')][_0xdfac('0x4a')]({'name':_0x506d86[_0xdfac('0x2a')],'resourceId':_0x506d86['id'],'type':_0x46d5c2[_0xdfac('0x2a')],'sectionId':_0x46d5c2['id']},{})[_0xdfac('0x28')](function(){return _0x4e97f9;});}else{return _0x4e97f9;}})['catch'](function(_0x559a9e){logger[_0xdfac('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x559a9e);throw _0x559a9e;});}return _0x4e97f9;})['then'](respondWithResult(_0x5c141f,0xc9))['catch'](handleError(_0x5c141f,null));};exports[_0xdfac('0x27')]=function(_0x5af5e3,_0x483968){if(_0x5af5e3[_0xdfac('0x4b')]['id']){delete _0x5af5e3[_0xdfac('0x4b')]['id'];}return db[_0xdfac('0x43')][_0xdfac('0x52')]({'where':{'id':_0x5af5e3[_0xdfac('0x49')]['id']}})[_0xdfac('0x28')](handleEntityNotFound(_0x483968,null))[_0xdfac('0x28')](saveUpdates(_0x5af5e3['body'],null))[_0xdfac('0x28')](respondWithResult(_0x483968,null))[_0xdfac('0x48')](handleError(_0x483968,null));};exports[_0xdfac('0x55')]=function(_0x27ec70,_0x4e1848){var _0x19ed2e=_0x27ec70[_0xdfac('0x49')]['id'];var _0x550282=[];return db[_0xdfac('0x56')][_0xdfac('0x57')](function(_0x2a1790){var _0xaed094='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x19ed2e;return db[_0xdfac('0x56')][_0xdfac('0x31')](_0xaed094,{'type':db[_0xdfac('0x58')][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790})[_0xdfac('0x28')](function(_0x35bc67){_0x550282=_[_0xdfac('0x2d')](_0x35bc67,function(_0x4a3002){return Number(_0x4a3002[_0xdfac('0x5b')]);});})[_0xdfac('0x28')](function(){var _0xdaff48=_0xdfac('0x5c')+_0x19ed2e;return db[_0xdfac('0x56')][_0xdfac('0x31')](_0xdaff48,{'type':db[_0xdfac('0x58')][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790});})[_0xdfac('0x28')](function(_0x5251ff){var _0xa33e00=_[_0xdfac('0x2d')](_0x5251ff,function(_0x54b1eb){return Number(_0x54b1eb['VoiceQueueId']);});return db[_0xdfac('0x5d')][_0xdfac('0x55')]({'where':{'UserId':{'$in':_0x550282},'VoiceQueueId':{'$in':_0xa33e00}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x2ac0c8=_0xdfac('0x5e')+_0x19ed2e;return db['sequelize'][_0xdfac('0x31')](_0x2ac0c8,{'type':db['Sequelize'][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790});})['then'](function(_0x5bae1b){var _0x32d454=_['map'](_0x5bae1b,function(_0x234b9d){return Number(_0x234b9d[_0xdfac('0x5f')]);});return db[_0xdfac('0x60')][_0xdfac('0x55')]({'where':{'UserId':{'$in':_0x550282},'MailQueueId':{'$in':_0x32d454}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x3dc0f6=_0xdfac('0x61')+_0x19ed2e;return db['sequelize'][_0xdfac('0x31')](_0x3dc0f6,{'type':db[_0xdfac('0x58')][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790});})[_0xdfac('0x28')](function(_0x2f8c24){var _0x5d3c6a=_[_0xdfac('0x2d')](_0x2f8c24,function(_0x2d1d39){return Number(_0x2d1d39[_0xdfac('0x62')]);});return db[_0xdfac('0x63')]['destroy']({'where':{'UserId':{'$in':_0x550282},'SmsQueueId':{'$in':_0x5d3c6a}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x22e046='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x19ed2e;return db[_0xdfac('0x56')]['query'](_0x22e046,{'type':db['Sequelize'][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790});})[_0xdfac('0x28')](function(_0x287879){var _0x5e6417=_[_0xdfac('0x2d')](_0x287879,function(_0x5f4619){return Number(_0x5f4619[_0xdfac('0x64')]);});return db[_0xdfac('0x65')]['destroy']({'where':{'UserId':{'$in':_0x550282},'ChatQueueId':{'$in':_0x5e6417}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x27b7f2='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x19ed2e;return db['sequelize'][_0xdfac('0x31')](_0x27b7f2,{'type':db[_0xdfac('0x58')][_0xdfac('0x59')]['SELECT'],'raw':!![],'transaction':_0x2a1790});})[_0xdfac('0x28')](function(_0xab926b){var _0x2a9afa=_['map'](_0xab926b,function(_0xa93b23){return Number(_0xa93b23['FaxQueueId']);});return db[_0xdfac('0x66')][_0xdfac('0x55')]({'where':{'UserId':{'$in':_0x550282},'FaxQueueId':{'$in':_0x2a9afa}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x3bf2a2='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x19ed2e;return db['sequelize']['query'](_0x3bf2a2,{'type':db[_0xdfac('0x58')][_0xdfac('0x59')][_0xdfac('0x5a')],'raw':!![],'transaction':_0x2a1790});})['then'](function(_0x8ad371){var _0x1d0184=_[_0xdfac('0x2d')](_0x8ad371,function(_0x22cba2){return Number(_0x22cba2['OpenchannelQueueId']);});return db[_0xdfac('0x67')]['destroy']({'where':{'UserId':{'$in':_0x550282},'OpenchannelQueueId':{'$in':_0x1d0184}},'transaction':_0x2a1790});})[_0xdfac('0x28')](function(){var _0x550f2e=_0xdfac('0x68')+_0x19ed2e;return db[_0xdfac('0x56')][_0xdfac('0x31')](_0x550f2e,{'type':db[_0xdfac('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2a1790});})['then'](function(_0xe6cf7a){var _0x264cc7=_[_0xdfac('0x2d')](_0xe6cf7a,function(_0x4c594f){return Number(_0x4c594f[_0xdfac('0x69')]);});return db['UserWhatsappQueue'][_0xdfac('0x55')]({'where':{'UserId':{'$in':_0x550282},'WhatsappQueueId':{'$in':_0x264cc7}},'transaction':_0x2a1790});})['then'](function(){return db[_0xdfac('0x6a')][_0xdfac('0x52')]({'where':{'TeamId':_0x19ed2e}});})[_0xdfac('0x28')](function(_0x18cfcb){if(_0x18cfcb===null){return;}return db[_0xdfac('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x550282},'VoicePrefixId':_0x18cfcb[_0xdfac('0x6c')]},'transaction':_0x2a1790});})['then'](function(){return db['Team'][_0xdfac('0x55')]({'where':{'id':_0x19ed2e},'cascade':!![],'transaction':_0x2a1790});})[_0xdfac('0x28')](function(_0x1fa900){if(_0x1fa900===0x0){_0x4e1848[_0xdfac('0x1c')](0x194);}else{return db[_0xdfac('0x54')][_0xdfac('0x55')]({'where':{'type':_0xdfac('0x50'),'resourceId':_0x19ed2e},'cascade':!![],'transaction':_0x2a1790})['then'](function(){_0x4e1848[_0xdfac('0x1d')](0xcc)[_0xdfac('0x1e')]();});}})['catch'](function(_0x2ac242){_0x4e1848[_0xdfac('0x1d')](0x1f4)[_0xdfac('0x2b')](_0x2ac242);});});};exports[_0xdfac('0x6d')]=function(_0x2621c7,_0x544bb8,_0x552993){return db[_0xdfac('0x43')][_0xdfac('0x6e')]({'where':{'id':_0x2621c7['params']['id']}})[_0xdfac('0x28')](handleEntityNotFound(_0x544bb8,null))[_0xdfac('0x28')](function(_0x2304a7){if(!_0x2621c7['query'][_0xdfac('0x6f')]||!utils[_0xdfac('0x70')](_0x2621c7[_0xdfac('0x31')][_0xdfac('0x6f')])){throw new db['Sequelize'][(_0xdfac('0x71'))]('Unknown\x20channel');}var _0x1ff7b7={};var _0x58c693={};_0x58c693[_0xdfac('0x36')]=_[_0xdfac('0x32')](db[_[_0xdfac('0x72')](_0x2621c7[_0xdfac('0x31')]['channel'][_0xdfac('0x73')]())+_0xdfac('0x74')][_0xdfac('0x2e')]);_0x58c693[_0xdfac('0x31')]=_[_0xdfac('0x32')](_0x2621c7[_0xdfac('0x31')]);_0x58c693[_0xdfac('0x33')]=_[_0xdfac('0x35')](_0x58c693[_0xdfac('0x36')],_0x58c693[_0xdfac('0x31')]);_0x1ff7b7[_0xdfac('0x34')]=_['intersection'](_0x58c693[_0xdfac('0x36')],qs[_0xdfac('0x37')](_0x2621c7[_0xdfac('0x31')]['fields']));_0x1ff7b7[_0xdfac('0x34')]=_0x1ff7b7[_0xdfac('0x34')][_0xdfac('0x38')]?_0x1ff7b7['attributes']:_0x58c693[_0xdfac('0x36')];_0x1ff7b7[_0xdfac('0x22')]=qs['limit'](_0x2621c7[_0xdfac('0x31')][_0xdfac('0x22')]);_0x1ff7b7[_0xdfac('0x20')]=qs[_0xdfac('0x20')](_0x2621c7['query'][_0xdfac('0x20')]);_0x1ff7b7[_0xdfac('0x75')]=qs[_0xdfac('0x3b')](_0x2621c7[_0xdfac('0x31')][_0xdfac('0x3b')]);_0x1ff7b7[_0xdfac('0x3c')]=qs[_0xdfac('0x33')](_['pick'](_0x2621c7[_0xdfac('0x31')],_0x58c693[_0xdfac('0x33')]));_0x1ff7b7=_['merge']({},_0x1ff7b7,_0x2621c7[_0xdfac('0x42')]);return _0x2304a7[_0xdfac('0x4d')+_[_0xdfac('0x72')](_0x2621c7[_0xdfac('0x31')]['channel'][_0xdfac('0x73')]())+'Queues'](_0x1ff7b7);})[_0xdfac('0x28')](respondWithResult(_0x544bb8,null))[_0xdfac('0x48')](handleError(_0x544bb8,null));};exports[_0xdfac('0x76')]=function(_0x227f44,_0x201482,_0x42a83f){return db[_0xdfac('0x43')]['findOne']({'where':{'id':_0x227f44[_0xdfac('0x49')]['id']}})['then'](function(_0xe9d49){if(_0xe9d49){if(!_0x227f44['body'][_0xdfac('0x6f')]||!utils[_0xdfac('0x70')](_0x227f44['body'][_0xdfac('0x6f')])){throw new db[(_0xdfac('0x58'))][(_0xdfac('0x71'))](_0xdfac('0x77'));}return _0xe9d49[_0xdfac('0x78')+_[_0xdfac('0x72')](_0x227f44[_0xdfac('0x4b')]['channel'][_0xdfac('0x73')]())+_0xdfac('0x79')](_0x227f44['body']['ids']);}return null;})[_0xdfac('0x28')](handleEntityNotFound(_0x201482,null))[_0xdfac('0x28')](respondWithStatusCode(_0x201482,null))[_0xdfac('0x48')](handleError(_0x201482,null));};exports[_0xdfac('0x7a')]=function(_0x1aae33,_0x5682c5,_0x4c78cf){return db['Team'][_0xdfac('0x6e')]({'where':{'id':_0x1aae33[_0xdfac('0x49')]['id']}})[_0xdfac('0x28')](function(_0x522a6e){if(_0x522a6e){if(!_0x1aae33[_0xdfac('0x31')]['channel']||!utils['isValidChannel'](_0x1aae33[_0xdfac('0x31')][_0xdfac('0x6f')])){throw new db[(_0xdfac('0x58'))][(_0xdfac('0x71'))]('Unknown\x20channel');}return _0x522a6e[_0xdfac('0x7b')+_[_0xdfac('0x72')](_0x1aae33[_0xdfac('0x31')]['channel'][_0xdfac('0x73')]())+_0xdfac('0x79')](_0x1aae33[_0xdfac('0x31')][_0xdfac('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x5682c5,null))['then'](respondWithStatusCode(_0x5682c5,null))['catch'](handleError(_0x5682c5,null));};exports[_0xdfac('0x7d')]=function(_0x411f7e,_0x73ef32){var _0x2111b5=_[_0xdfac('0x7e')](_0x411f7e[_0xdfac('0x4b')][_0xdfac('0x7c')])?_0x411f7e[_0xdfac('0x4b')][_0xdfac('0x7c')]:[_0x411f7e[_0xdfac('0x4b')][_0xdfac('0x7c')]];var _0x4e3165=_0x411f7e[_0xdfac('0x49')]['id'];return db['Team'][_0xdfac('0x52')]({'where':{'id':_0x4e3165}})[_0xdfac('0x28')](handleEntityNotFound(_0x73ef32,null))[_0xdfac('0x28')](function(_0x136fc3){if(_0x136fc3){var _0x58d429=[_0xdfac('0x7f'),'Chat',_0xdfac('0x80'),_0xdfac('0x81'),_0xdfac('0x82'),_0xdfac('0x83'),_0xdfac('0x84')];return db[_0xdfac('0x56')][_0xdfac('0x57')](function(_0x58358d){var _0x259198=_['map'](_0x58d429,function(_0x321ab1){var _0x2e2d75={'attributes':['id',_0xdfac('0x2a')]};if(_0x321ab1==='Voice'){_0x2e2d75[_0xdfac('0x85')]={'attributes':[_0xdfac('0x86')]};}return _0x136fc3[_0xdfac('0x4d')+_0x321ab1+_0xdfac('0x79')](_0x2e2d75)['then'](function(_0x470b94){var _0x31eba1=_[_0xdfac('0x2d')](_0x470b94,function(_0x133e11){var _0x37ab50=_[_0xdfac('0x2d')](_0x2111b5,function(_0x58a01b){var _0x25cc81={'where':{'UserId':_0x58a01b,[_0x321ab1+'QueueId']:_0x133e11['id']},'transaction':_0x58358d};if(_0x321ab1===_0xdfac('0x7f')){_0x25cc81[_0xdfac('0x87')]={'penalty':_0x133e11[_0xdfac('0x88')][_0xdfac('0x86')]};}return db[_0xdfac('0x89')+_0x321ab1+_0xdfac('0x74')][_0xdfac('0x8a')](_0x25cc81)[_0xdfac('0x28')](function(){socket[_0xdfac('0x8b')](_0xdfac('0x4c')+_0x321ab1+'Queue:save',{'UserId':_0x58a01b,[_0x321ab1+_0xdfac('0x8c')]:_0x133e11['id']});if(_0x321ab1!==_0xdfac('0x7f')){return;}return db[_0xdfac('0x89')][_0xdfac('0x46')]({'where':{'id':_0x2111b5,'online':0x1},'attributes':['id',_0xdfac('0x2a'),_0xdfac('0x8d'),_0xdfac('0x8e'),'interface'],'raw':!![]})[_0xdfac('0x28')](function(_0x4425bf){var _0x1eb2d4=_[_0xdfac('0x2d')](_0x4425bf,function(_0xf0fa52){return db[_0xdfac('0x8f')]['upsert']({'membername':_0xf0fa52['name'],'UserId':_0xf0fa52['id'],'queue_name':_0x133e11[_0xdfac('0x2a')],'VoiceQueueId':_0x133e11['id'],'interface':_[_0xdfac('0x90')](_0xf0fa52[_0xdfac('0x91')])?util['format']('SIP/%s',_0xf0fa52[_0xdfac('0x2a')]):_0xf0fa52[_0xdfac('0x91')],'paused':_0xf0fa52[_0xdfac('0x8e')]||![],'penalty':_0x133e11[_0xdfac('0x88')][_0xdfac('0x86')]},{'transaction':_0x58358d});});return Promise[_0xdfac('0x92')](_0x1eb2d4);});});});return Promise[_0xdfac('0x92')](_0x37ab50);});return Promise['all'](_0x31eba1);})[_0xdfac('0x28')](function(){return db[_0xdfac('0x6a')][_0xdfac('0x6e')]({'where':{'teamId':_0x4e3165}})[_0xdfac('0x28')](function(_0x2807be){if(_0x2807be){var _0x1362b6=_[_0xdfac('0x2d')](_0x2111b5,function(_0xc10f6c){db['UserVoicePrefix'][_0xdfac('0x93')]({'UserId':_0xc10f6c,'VoicePrefixId':_0x2807be[_0xdfac('0x6c')]});});return Promise['all'](_0x1362b6);}});});});return Promise[_0xdfac('0x92')](_0x259198)[_0xdfac('0x28')](function(){return _0x136fc3[_0xdfac('0x7d')](_0x2111b5,{'transaction':_0x58358d})[_0xdfac('0x94')](function(_0x279d99){return _0x279d99;});});});}})[_0xdfac('0x28')](respondWithResult(_0x73ef32,null))[_0xdfac('0x48')](handleError(_0x73ef32,null));};exports[_0xdfac('0x95')]=function(_0x5bee12,_0x5fe907){var _0x1a3637=_[_0xdfac('0x7e')](_0x5bee12[_0xdfac('0x31')]['ids'])?_0x5bee12[_0xdfac('0x31')]['ids']:[_0x5bee12[_0xdfac('0x31')][_0xdfac('0x7c')]];var _0x5012b0=_0x5bee12['params']['id'];return db[_0xdfac('0x43')][_0xdfac('0x52')]({'where':{'id':_0x5012b0}})[_0xdfac('0x28')](handleEntityNotFound(_0x5fe907,null))['then'](function(_0x44e73e){if(_0x44e73e){var _0x5ee79b=['Voice',_0xdfac('0x96'),_0xdfac('0x80'),_0xdfac('0x81'),_0xdfac('0x82'),_0xdfac('0x83'),'Whatsapp'];return db[_0xdfac('0x56')][_0xdfac('0x57')](function(_0x1eff95){var _0x584689=_['map'](_0x5ee79b,function(_0x2280b9){var _0x3029bb={'attributes':['id',_0xdfac('0x2a')]};return _0x44e73e[_0xdfac('0x4d')+_0x2280b9+_0xdfac('0x79')](_0x3029bb)[_0xdfac('0x28')](function(_0x334037){var _0x9989d5=_[_0xdfac('0x2d')](_0x334037,function(_0x4c1a62){return _0x4c1a62[_0xdfac('0x95')](_0x1a3637,{'transaction':_0x1eff95})[_0xdfac('0x28')](function(){var _0x4c096c=_[_0xdfac('0x2d')](_0x1a3637,function(_0x34088e){socket[_0xdfac('0x8b')](_0xdfac('0x4c')+_0x2280b9+_0xdfac('0x97'),{'UserId':Number(_0x34088e),[_0x2280b9+_0xdfac('0x8c')]:_0x4c1a62['id']});if(_0x2280b9!==_0xdfac('0x7f')){return;}return db[_0xdfac('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x4c1a62['id'],'UserId':_0x34088e},'transaction':_0x1eff95});});return Promise[_0xdfac('0x92')](_0x4c096c);});});return Promise[_0xdfac('0x92')](_0x9989d5);});});return Promise[_0xdfac('0x92')](_0x584689)[_0xdfac('0x28')](function(){return _0x44e73e[_0xdfac('0x95')](_0x1a3637,{'transaction':_0x1eff95});})[_0xdfac('0x28')](function(){return db['TeamVoicePrefix'][_0xdfac('0x6e')]({'where':{'teamId':_0x5012b0}})['then'](function(_0x9a2e09){if(_0x9a2e09){var _0x1e880e=_[_0xdfac('0x2d')](_0x1a3637,function(_0x20c82b){db[_0xdfac('0x6b')][_0xdfac('0x55')]({'where':{'UserId':_0x20c82b,'VoicePrefixId':_0x9a2e09[_0xdfac('0x6c')]}});});return Promise['all'](_0x1e880e);}});});});}})[_0xdfac('0x28')](respondWithStatusCode(_0x5fe907,null))['catch'](handleError(_0x5fe907,null));};exports[_0xdfac('0x98')]=function(_0x554581,_0x3fad72,_0x46dd1f){var _0x5958df={};var _0xe201b2={};var _0x4980d9;var _0x168c00;return db[_0xdfac('0x43')]['findOne']({'where':{'id':_0x554581['params']['id']}})[_0xdfac('0x28')](handleEntityNotFound(_0x3fad72,null))[_0xdfac('0x28')](function(_0x3e99b1){if(_0x3e99b1){_0x4980d9=_0x3e99b1;_0xe201b2[_0xdfac('0x36')]=_['keys'](db[_0xdfac('0x89')][_0xdfac('0x2e')]);_0xe201b2[_0xdfac('0x31')]=_['keys'](_0x554581[_0xdfac('0x31')]);_0xe201b2[_0xdfac('0x33')]=_[_0xdfac('0x35')](_0xe201b2['model'],_0xe201b2['query']);_0x5958df[_0xdfac('0x34')]=_[_0xdfac('0x35')](_0xe201b2[_0xdfac('0x36')],qs[_0xdfac('0x37')](_0x554581[_0xdfac('0x31')][_0xdfac('0x37')]));_0x5958df['attributes']=_0x5958df[_0xdfac('0x34')]['length']?_0x5958df[_0xdfac('0x34')]:_0xe201b2[_0xdfac('0x36')];_0x5958df[_0xdfac('0x75')]=qs[_0xdfac('0x3b')](_0x554581[_0xdfac('0x31')][_0xdfac('0x3b')]);_0x5958df[_0xdfac('0x3c')]=qs['filters'](_[_0xdfac('0x3d')](_0x554581['query'],_0xe201b2[_0xdfac('0x33')]));if(_0x554581['query']['filter']){_0x5958df[_0xdfac('0x3c')]=_[_0xdfac('0x41')](_0x5958df[_0xdfac('0x3c')],{'$or':_['map'](_0x5958df['attributes'],function(_0x1f65ed){var _0x392752={};_0x392752[_0x1f65ed]={'$like':'%'+_0x554581[_0xdfac('0x31')][_0xdfac('0x40')]+'%'};return _0x392752;})});}_0x5958df=_['merge']({},_0x5958df,_0x554581[_0xdfac('0x42')]);return _0x4980d9[_0xdfac('0x98')](_0x5958df);}})[_0xdfac('0x28')](function(_0x4469bf){if(_0x4469bf){_0x168c00=_0x4469bf['length'];if(!_0x554581[_0xdfac('0x31')]['hasOwnProperty'](_0xdfac('0x3a'))){_0x5958df[_0xdfac('0x22')]=qs[_0xdfac('0x22')](_0x554581[_0xdfac('0x31')][_0xdfac('0x22')]);_0x5958df['offset']=qs[_0xdfac('0x20')](_0x554581[_0xdfac('0x31')][_0xdfac('0x20')]);}return _0x4980d9['getAgents'](_0x5958df);}})[_0xdfac('0x28')](function(_0x8849e6){if(_0x8849e6){return _0x8849e6?{'count':_0x168c00,'rows':_0x8849e6}:null;}})['then'](respondWithResult(_0x3fad72,null))[_0xdfac('0x48')](handleError(_0x3fad72,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 896c942..b642f93 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 _0xe97e=['events','../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x49c957,_0x3509d8){var _0x5b1d38=function(_0x219976){while(--_0x219976){_0x49c957['push'](_0x49c957['shift']());}};_0x5b1d38(++_0x3509d8);}(_0xe97e,0xdc));var _0xee97=function(_0xb7e199,_0x2108c3){_0xb7e199=_0xb7e199-0x0;var _0x2b9847=_0xe97e[_0xb7e199];return _0x2b9847;};'use strict';var EventEmitter=require(_0xee97('0x0'));var Team=require(_0xee97('0x1'))['db'][_0xee97('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee97('0x3'),'afterUpdate':_0xee97('0x4'),'afterDestroy':_0xee97('0x5')};function emitEvent(_0x486cd8){return function(_0x39d25d,_0x1fbcac,_0xb06e8f){TeamEvents[_0xee97('0x6')](_0x486cd8+':'+_0x39d25d['id'],_0x39d25d);TeamEvents[_0xee97('0x6')](_0x486cd8,_0x39d25d);_0xb06e8f(null);};}for(var e in events){if(events[_0xee97('0x7')](e)){var event=events[e];Team[_0xee97('0x8')](e,emitEvent(event));}}module[_0xee97('0x9')]=TeamEvents; \ No newline at end of file +var _0xccdb=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xccdb,0x147));var _0xbccd=function(_0xb6e9c7,_0x14898e){_0xb6e9c7=_0xb6e9c7-0x0;var _0x42d031=_0xccdb[_0xb6e9c7];return _0x42d031;};'use strict';var EventEmitter=require(_0xbccd('0x0'));var Team=require(_0xbccd('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xbccd('0x2')](0x0);var events={'afterCreate':_0xbccd('0x3'),'afterUpdate':'update','afterDestroy':_0xbccd('0x4')};function emitEvent(_0x389a59){return function(_0x49d669,_0x2be22d,_0x27af5d){TeamEvents['emit'](_0x389a59+':'+_0x49d669['id'],_0x49d669);TeamEvents[_0xbccd('0x5')](_0x389a59,_0x49d669);_0x27af5d(null);};}for(var e in events){if(events[_0xbccd('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xbccd('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6374e47..142be35 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 _0x8e32=['resolve','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8e32,0x1a5));var _0x28e3=function(_0x4db38c,_0x351db3){_0x4db38c=_0x4db38c-0x0;var _0xe83a7f=_0x8e32[_0x4db38c];return _0xe83a7f;};'use strict';var _=require(_0x28e3('0x0'));var attributes=require(_0x28e3('0x1'));function getQueuesByChannel(_0x14fd1f,_0x4b53be){var _0x568401=_0x28e3('0x2')+_0x4b53be+_0x28e3('0x3');return _0x14fd1f[_0x568401]()[_0x28e3('0x4')](function(_0x5792e1){return _[_0x28e3('0x5')](_0x5792e1,function(_0x1fbb5a){_0x1fbb5a[_0x28e3('0x6')]('channel',_0x4b53be);return _0x1fbb5a;});})[_0x28e3('0x7')](function(_0x4b2d4e){throw _0x4b2d4e;});}module[_0x28e3('0x8')]=function(_0x3394fe){return _0x3394fe[_0x28e3('0x9')](_0x28e3('0xa'),attributes,{'tableName':_0x28e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3a70b5=this;var _0x1c3261=[_0x28e3('0xc'),_0x28e3('0xd'),_0x28e3('0xe'),_0x28e3('0xf'),_0x28e3('0x10'),_0x28e3('0x11'),_0x28e3('0x12')];return Promise[_0x28e3('0x13')]()[_0x28e3('0x4')](function(){var _0x28917e=_[_0x28e3('0x5')](_0x1c3261,function(_0x3e765f){return getQueuesByChannel(_0x3a70b5,_0x3e765f);});return Promise['all'](_0x28917e);})[_0x28e3('0x7')](function(_0x38f66e){throw _0x38f66e;});}}});}; \ No newline at end of file +var _0x84e4=['Openchannel','Sms','Voice','resolve','all','lodash','get','Queues','then','map','setDataValue','catch','exports','Team','teams','Chat','Fax'];(function(_0x39cc8f,_0xb60cd8){var _0x15e616=function(_0x513d9e){while(--_0x513d9e){_0x39cc8f['push'](_0x39cc8f['shift']());}};_0x15e616(++_0xb60cd8);}(_0x84e4,0xc0));var _0x484e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x84e4[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x484e('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x319355,_0x5924b1){var _0x334b47=_0x484e('0x1')+_0x5924b1+_0x484e('0x2');return _0x319355[_0x334b47]()[_0x484e('0x3')](function(_0x482dc7){return _[_0x484e('0x4')](_0x482dc7,function(_0x48a258){_0x48a258[_0x484e('0x5')]('channel',_0x5924b1);return _0x48a258;});})[_0x484e('0x6')](function(_0x18235e){throw _0x18235e;});}module[_0x484e('0x7')]=function(_0x5a9e1d){return _0x5a9e1d['define'](_0x484e('0x8'),attributes,{'tableName':_0x484e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x15d2a3=this;var _0x5f1800=[_0x484e('0xa'),_0x484e('0xb'),'Mail',_0x484e('0xc'),_0x484e('0xd'),_0x484e('0xe'),'Whatsapp'];return Promise[_0x484e('0xf')]()['then'](function(){var _0x6ec138=_['map'](_0x5f1800,function(_0x5ba4ad){return getQueuesByChannel(_0x15d2a3,_0x5ba4ad);});return Promise[_0x484e('0x10')](_0x6ec138);})[_0x484e('0x6')](function(_0x3613d5){throw _0x3613d5;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9a2d368..6da4b04 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 _0x6c09=['then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','Team,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request'];(function(_0x2ff75c,_0x2d7c8c){var _0x41b448=function(_0x315c15){while(--_0x315c15){_0x2ff75c['push'](_0x2ff75c['shift']());}};_0x41b448(++_0x2d7c8c);}(_0x6c09,0x110));var _0x96c0=function(_0x2fd6e1,_0x4f3c41){_0x2fd6e1=_0x2fd6e1-0x0;var _0xeb54f3=_0x6c09[_0x2fd6e1];return _0xeb54f3;};'use strict';var _=require(_0x96c0('0x0'));var util=require(_0x96c0('0x1'));var moment=require(_0x96c0('0x2'));var BPromise=require(_0x96c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96c0('0x5'));var config=require(_0x96c0('0x6'));var jayson=require(_0x96c0('0x7'));var client=jayson[_0x96c0('0x8')][_0x96c0('0x9')]({'port':0x232a});config[_0x96c0('0xa')]=_[_0x96c0('0xb')](config[_0x96c0('0xa')],{'host':_0x96c0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96c0('0xa')]));require(_0x96c0('0xd'))[_0x96c0('0xe')](socket);function respondWithRpcPromise(_0x5b779b,_0x257c30,_0x304a3a){return new BPromise(function(_0x1c9d9c,_0x37afa2){return client[_0x96c0('0xf')](_0x5b779b,_0x304a3a)[_0x96c0('0x10')](function(_0x353dc7){logger[_0x96c0('0x11')]('Team,\x20%s,\x20%s',_0x257c30,_0x96c0('0x12'));logger['debug'](_0x96c0('0x13'),_0x257c30,_0x96c0('0x12'),JSON['stringify'](_0x353dc7));if(_0x353dc7['error']){if(_0x353dc7['error']['code']===0x1f4){logger['error'](_0x96c0('0x14'),_0x257c30,_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);return _0x37afa2(_0x353dc7['error'][_0x96c0('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x257c30,_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);return _0x1c9d9c(_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);}else{logger[_0x96c0('0x11')](_0x96c0('0x14'),_0x257c30,_0x96c0('0x12'));_0x1c9d9c(_0x353dc7['result']['message']);}})[_0x96c0('0x17')](function(_0x1b85d0){logger[_0x96c0('0x15')](_0x96c0('0x14'),_0x257c30,_0x1b85d0);_0x37afa2(_0x1b85d0);});});} \ No newline at end of file +var _0x7619=['Team,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4965d1,_0xb546d4){var _0x59e849=function(_0x2df6e9){while(--_0x2df6e9){_0x4965d1['push'](_0x4965d1['shift']());}};_0x59e849(++_0xb546d4);}(_0x7619,0x101));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9761('0x0'));var util=require('util');var moment=require(_0x9761('0x1'));var BPromise=require(_0x9761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9761('0x3'))['db'];var utils=require(_0x9761('0x4'));var logger=require(_0x9761('0x5'))('rpc');var config=require(_0x9761('0x6'));var jayson=require(_0x9761('0x7'));var client=jayson[_0x9761('0x8')]['http']({'port':0x232a});config[_0x9761('0x9')]=_[_0x9761('0xa')](config[_0x9761('0x9')],{'host':_0x9761('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9761('0x9')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x52c82d,_0x20ee09,_0x4c8052){return new BPromise(function(_0x3148a1,_0x162447){return client[_0x9761('0xc')](_0x52c82d,_0x4c8052)[_0x9761('0xd')](function(_0x394bcf){logger['info']('Team,\x20%s,\x20%s',_0x20ee09,_0x9761('0xe'));logger['debug'](_0x9761('0xf'),_0x20ee09,_0x9761('0xe'),JSON[_0x9761('0x10')](_0x394bcf));if(_0x394bcf[_0x9761('0x11')]){if(_0x394bcf[_0x9761('0x11')][_0x9761('0x12')]===0x1f4){logger['error'](_0x9761('0x13'),_0x20ee09,_0x394bcf['error'][_0x9761('0x14')]);return _0x162447(_0x394bcf['error'][_0x9761('0x14')]);}logger[_0x9761('0x11')](_0x9761('0x13'),_0x20ee09,_0x394bcf['error'][_0x9761('0x14')]);return _0x3148a1(_0x394bcf[_0x9761('0x11')][_0x9761('0x14')]);}else{logger['info'](_0x9761('0x13'),_0x20ee09,_0x9761('0xe'));_0x3148a1(_0x394bcf[_0x9761('0x15')]['message']);}})[_0x9761('0x16')](function(_0x56fb70){logger[_0x9761('0x11')](_0x9761('0x13'),_0x20ee09,_0x56fb70);_0x162447(_0x56fb70);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ad3c4d5..7055dbb 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 _0x19c7=['emit','removeListener','register','length','team:','save','remove','update'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0x19c7,0x16d));var _0x719c=function(_0x442d57,_0x46a3a5){_0x442d57=_0x442d57-0x0;var _0x3a9cce=_0x19c7[_0x442d57];return _0x3a9cce;};'use strict';var TeamEvents=require('./team.events');var events=[_0x719c('0x0'),_0x719c('0x1'),_0x719c('0x2')];function createListener(_0x6df9ba,_0x28ff12){return function(_0x761800){_0x28ff12[_0x719c('0x3')](_0x6df9ba,_0x761800);};}function removeListener(_0x144405,_0x3ad380){return function(){TeamEvents[_0x719c('0x4')](_0x144405,_0x3ad380);};}exports[_0x719c('0x5')]=function(_0x21db87){for(var _0x521b57=0x0,_0x2e7d0e=events[_0x719c('0x6')];_0x521b57<_0x2e7d0e;_0x521b57++){var _0x30af86=events[_0x521b57];var _0x178991=createListener(_0x719c('0x7')+_0x30af86,_0x21db87);TeamEvents['on'](_0x30af86,_0x178991);}}; \ No newline at end of file +var _0x16e3=['./team.events','update','removeListener','register','length'];(function(_0x45b771,_0x2caece){var _0x7ef73d=function(_0x44283a){while(--_0x44283a){_0x45b771['push'](_0x45b771['shift']());}};_0x7ef73d(++_0x2caece);}(_0x16e3,0x168));var _0x316e=function(_0x16da03,_0x44595a){_0x16da03=_0x16da03-0x0;var _0x313d64=_0x16e3[_0x16da03];return _0x313d64;};'use strict';var TeamEvents=require(_0x316e('0x0'));var events=['save','remove',_0x316e('0x1')];function createListener(_0x5dc80a,_0x4381dc){return function(_0x95932e){_0x4381dc['emit'](_0x5dc80a,_0x95932e);};}function removeListener(_0x1b3909,_0x51c8c9){return function(){TeamEvents[_0x316e('0x2')](_0x1b3909,_0x51c8c9);};}exports[_0x316e('0x3')]=function(_0x52af3d){for(var _0x3ef0e3=0x0,_0x5d7a5e=events[_0x316e('0x4')];_0x3ef0e3<_0x5d7a5e;_0x3ef0e3++){var _0x4ca4fc=events[_0x3ef0e3];var _0x250138=createListener('team:'+_0x4ca4fc,_0x52af3d);TeamEvents['on'](_0x4ca4fc,_0x250138);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7d2a184..dc5a90e 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 _0x18b8=['sequelize','exports','INTEGER'];(function(_0x3c4d46,_0x46ed6f){var _0x1572d9=function(_0x1d2db1){while(--_0x1d2db1){_0x3c4d46['push'](_0x3c4d46['shift']());}};_0x1572d9(++_0x46ed6f);}(_0x18b8,0xff));var _0x818b=function(_0x10c858,_0x1ed660){_0x10c858=_0x10c858-0x0;var _0x478d5a=_0x18b8[_0x10c858];return _0x478d5a;};'use strict';var Sequelize=require(_0x818b('0x0'));module[_0x818b('0x1')]={'TeamId':{'type':Sequelize[_0x818b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x818b('0x2')]}}; \ No newline at end of file +var _0x2bc6=['INTEGER','sequelize','exports'];(function(_0x6bc26,_0x59d229){var _0x420728=function(_0x419348){while(--_0x419348){_0x6bc26['push'](_0x6bc26['shift']());}};_0x420728(++_0x59d229);}(_0x2bc6,0x163));var _0x62bc=function(_0x3df1e9,_0x3cd30e){_0x3df1e9=_0x3df1e9-0x0;var _0xd6b371=_0x2bc6[_0x3df1e9];return _0xd6b371;};'use strict';var Sequelize=require(_0x62bc('0x0'));module[_0x62bc('0x1')]={'TeamId':{'type':Sequelize[_0x62bc('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a043a49..2653381 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 _0x174b=['path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise'];(function(_0x39c7c8,_0x3476ee){var _0x2a664a=function(_0x318c60){while(--_0x318c60){_0x39c7c8['push'](_0x39c7c8['shift']());}};_0x2a664a(++_0x3476ee);}(_0x174b,0x19d));var _0xb174=function(_0x46bcb9,_0x6bd0fc){_0x46bcb9=_0x46bcb9-0x0;var _0x3f572d=_0x174b[_0x46bcb9];return _0x3f572d;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb174('0x1'));var moment=require(_0xb174('0x2'));var BPromise=require(_0xb174('0x3'));var rp=require(_0xb174('0x4'));var fs=require('fs');var path=require(_0xb174('0x5'));var rimraf=require(_0xb174('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xb174('0x7')]=function(_0x3e81c9,_0x326afc){return _0x3e81c9[_0xb174('0x8')](_0xb174('0x9'),attributes,{'tableName':_0xb174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a0=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x84a0,0x66));var _0x084a=function(_0x5eabbc,_0x4301cb){_0x5eabbc=_0x5eabbc-0x0;var _0x4bb29=_0x84a0[_0x5eabbc];return _0x4bb29;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var logger=require(_0x084a('0x2'))(_0x084a('0x3'));var moment=require('moment');var BPromise=require(_0x084a('0x4'));var rp=require(_0x084a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x084a('0x6'));var attributes=require(_0x084a('0x7'));module['exports']=function(_0x16f8a7,_0x4325ce){return _0x16f8a7[_0x084a('0x8')](_0x084a('0x9'),attributes,{'tableName':_0x084a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8629660..1d821d4 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f240c,_0x45ff23){var _0x5a9f8d=function(_0x1beb7b){while(--_0x1beb7b){_0x3f240c['push'](_0x3f240c['shift']());}};_0x5a9f8d(++_0x45ff23);}(_0xedd9,0xfc));var _0x9edd=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xedd9[_0x3132e8];return _0x43eb8c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x355065,_0x1c0032){var _0x23743f=function(_0x460910){while(--_0x460910){_0x355065['push'](_0x355065['shift']());}};_0x23743f(++_0x1c0032);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 777a66e..2826c06 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 _0x7dfd=['sequelize','exports','INTEGER'];(function(_0xc546aa,_0x1d322c){var _0x2e8bb4=function(_0x4657e5){while(--_0x4657e5){_0xc546aa['push'](_0xc546aa['shift']());}};_0x2e8bb4(++_0x1d322c);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'penalty':{'type':Sequelize[_0xd7df('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb582=['sequelize','INTEGER'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb582,0xda));var _0x2b58=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb582[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x2b58('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2b58('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 38615fe..f8ff681 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 _0x0a9a=['bluebird','request-promise','rimraf','../../config/environment','exports','define','team_has_voice_queues','util','api','moment'];(function(_0x29f241,_0x1e8fd8){var _0x5d0ca8=function(_0x2cfdd7){while(--_0x2cfdd7){_0x29f241['push'](_0x29f241['shift']());}};_0x5d0ca8(++_0x1e8fd8);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3c8506,_0x44cf37){_0x3c8506=_0x3c8506-0x0;var _0x23f2be=_0x0a9a[_0x3c8506];return _0x23f2be;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var logger=require('../../config/logger')(_0xa0a9('0x1'));var moment=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var rp=require(_0xa0a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0xa0a9('0x7')]=function(_0xc65bbb,_0x1aa717){return _0xc65bbb[_0xa0a9('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0xa0a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7b=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3d30a4,_0x394ec6){var _0x1ad0ae=function(_0x2d7053){while(--_0x2d7053){_0x3d30a4['push'](_0x3d30a4['shift']());}};_0x1ad0ae(++_0x394ec6);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x3f5bc4,_0x2c2f1e){_0x3f5bc4=_0x3f5bc4-0x0;var _0x35edc6=_0x3c7b[_0x3f5bc4];return _0x35edc6;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'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 490b751..7f02684 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 _0x933b=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x196004,_0x31a6fc){var _0xec74b6=function(_0x57d5ba){while(--_0x57d5ba){_0x196004['push'](_0x196004['shift']());}};_0xec74b6(++_0x31a6fc);}(_0x933b,0x16e));var _0xb933=function(_0x2e2228,_0x594bb2){_0x2e2228=_0x2e2228-0x0;var _0x58f9e2=_0x933b[_0x2e2228];return _0x58f9e2;};'use strict';var _=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb933('0x2'));var fs=require('fs');var Redis=require(_0xb933('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb933('0x4'));var logger=require(_0xb933('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb933('0x6'));var client=jayson[_0xb933('0x7')][_0xb933('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x234230,_0x4c64e7,_0x30afea){return new BPromise(function(_0x31a82c,_0x4380d7){return client[_0xb933('0x9')](_0x234230,_0x30afea)[_0xb933('0xa')](function(_0x5c4c25){logger[_0xb933('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4c64e7,_0xb933('0xc'));logger['debug'](_0xb933('0xd'),_0x4c64e7,_0xb933('0xc'),JSON[_0xb933('0xe')](_0x5c4c25));if(_0x5c4c25[_0xb933('0xf')]){if(_0x5c4c25[_0xb933('0xf')][_0xb933('0x10')]===0x1f4){logger[_0xb933('0xf')](_0xb933('0x11'),_0x4c64e7,_0x5c4c25[_0xb933('0xf')][_0xb933('0x12')]);return _0x4380d7(_0x5c4c25[_0xb933('0xf')]['message']);}logger[_0xb933('0xf')](_0xb933('0x11'),_0x4c64e7,_0x5c4c25[_0xb933('0xf')][_0xb933('0x12')]);return _0x31a82c(_0x5c4c25[_0xb933('0xf')][_0xb933('0x12')]);}else{logger[_0xb933('0xb')](_0xb933('0x11'),_0x4c64e7,_0xb933('0xc'));_0x31a82c(_0x5c4c25[_0xb933('0x13')][_0xb933('0x12')]);}})[_0xb933('0x14')](function(_0x1c6e35){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4c64e7,_0x1c6e35);_0x4380d7(_0x1c6e35);});});} \ No newline at end of file +var _0x83d3=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x83d3,0x159));var _0x383d=function(_0x59db34,_0x593726){_0x59db34=_0x59db34-0x0;var _0x568a53=_0x83d3[_0x59db34];return _0x568a53;};'use strict';var _=require(_0x383d('0x0'));var util=require('util');var moment=require(_0x383d('0x1'));var BPromise=require(_0x383d('0x2'));var rs=require(_0x383d('0x3'));var fs=require('fs');var Redis=require(_0x383d('0x4'));var db=require(_0x383d('0x5'))['db'];var utils=require(_0x383d('0x6'));var logger=require('../../config/logger')(_0x383d('0x7'));var config=require(_0x383d('0x8'));var jayson=require(_0x383d('0x9'));var client=jayson[_0x383d('0xa')][_0x383d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c5e58,_0x5f592b,_0x8bec7f){return new BPromise(function(_0x545358,_0x9b3d3b){return client[_0x383d('0xc')](_0x1c5e58,_0x8bec7f)[_0x383d('0xd')](function(_0x38bc87){logger[_0x383d('0xe')](_0x383d('0xf'),_0x5f592b,'request\x20sent');logger['debug'](_0x383d('0x10'),_0x5f592b,_0x383d('0x11'),JSON[_0x383d('0x12')](_0x38bc87));if(_0x38bc87[_0x383d('0x13')]){if(_0x38bc87['error'][_0x383d('0x14')]===0x1f4){logger['error'](_0x383d('0xf'),_0x5f592b,_0x38bc87[_0x383d('0x13')]['message']);return _0x9b3d3b(_0x38bc87[_0x383d('0x13')][_0x383d('0x15')]);}logger[_0x383d('0x13')](_0x383d('0xf'),_0x5f592b,_0x38bc87[_0x383d('0x13')][_0x383d('0x15')]);return _0x545358(_0x38bc87[_0x383d('0x13')][_0x383d('0x15')]);}else{logger[_0x383d('0xe')](_0x383d('0xf'),_0x5f592b,_0x383d('0x11'));_0x545358(_0x38bc87[_0x383d('0x16')][_0x383d('0x15')]);}})['catch'](function(_0x4b8a22){logger[_0x383d('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5f592b,_0x4b8a22);_0x9b3d3b(_0x4b8a22);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3751c68..f2f73b7 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 _0xb1fa=['./template.controller','get','isAuthenticated','show','/:id','update','delete','destroy','path','express'];(function(_0x22eb8b,_0x7e936b){var _0x3d945e=function(_0x4405bd){while(--_0x4405bd){_0x22eb8b['push'](_0x22eb8b['shift']());}};_0x3d945e(++_0x7e936b);}(_0xb1fa,0x9e));var _0xab1f=function(_0x14eae1,_0x13f041){_0x14eae1=_0x14eae1-0x0;var _0x315db=_0xb1fa[_0x14eae1];return _0x315db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab1f('0x0'));var timeout=require('connect-timeout');var express=require(_0xab1f('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab1f('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab1f('0x3')]('/:id',auth[_0xab1f('0x4')](),controller[_0xab1f('0x5')]);router['post']('/',auth[_0xab1f('0x4')](),controller['create']);router['put'](_0xab1f('0x6'),auth[_0xab1f('0x4')](),controller[_0xab1f('0x7')]);router[_0xab1f('0x8')](_0xab1f('0x6'),auth['isAuthenticated'](),controller[_0xab1f('0x9')]);module['exports']=router; \ No newline at end of file +var _0x4253=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','destroy','multer','util','connect-timeout','Router'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4253,0x14c));var _0x3425=function(_0xaf61d2,_0x5ea967){_0xaf61d2=_0xaf61d2-0x0;var _0x448b9f=_0x4253[_0xaf61d2];return _0x448b9f;};'use strict';var multer=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var path=require('path');var timeout=require(_0x3425('0x2'));var express=require('express');var router=express[_0x3425('0x3')]();var fs_extra=require(_0x3425('0x4'));var auth=require(_0x3425('0x5'));var interaction=require(_0x3425('0x6'));var config=require(_0x3425('0x7'));var controller=require(_0x3425('0x8'));router[_0x3425('0x9')]('/',auth[_0x3425('0xa')](),controller[_0x3425('0xb')]);router['get'](_0x3425('0xc'),auth[_0x3425('0xa')](),controller[_0x3425('0xd')]);router['post']('/',auth[_0x3425('0xa')](),controller[_0x3425('0xe')]);router['put'](_0x3425('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3425('0xc'),auth[_0x3425('0xa')](),controller[_0x3425('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 16ce28c..cb4104e 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 _0x6bdd=['exports','STRING','TEXT'];(function(_0x5b70f0,_0x189655){var _0x49a246=function(_0x25cd5c){while(--_0x25cd5c){_0x5b70f0['push'](_0x5b70f0['shift']());}};_0x49a246(++_0x189655);}(_0x6bdd,0x138));var _0xd6bd=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x6bdd[_0x5d2ed9];return _0x4262c5;};'use strict';var Sequelize=require('sequelize');module[_0xd6bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd6bd('0x1')]},'html':{'type':Sequelize[_0xd6bd('0x2')]}}; \ No newline at end of file +var _0xf0be=['TEXT','sequelize','exports','STRING'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0xf0be,0xf9));var _0xef0b=function(_0x4ab116,_0x590001){_0x4ab116=_0x4ab116-0x0;var _0x1ba782=_0xf0be[_0x4ab116];return _0x1ba782;};'use strict';var Sequelize=require(_0xef0b('0x0'));module[_0xef0b('0x1')]={'name':{'type':Sequelize[_0xef0b('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xef0b('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 14545ba..c663af2 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 _0x0160=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','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','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','send','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Template','includeAll','include','rows','show','params','keys','find','catch','create'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x0160,0xab));var _0x0016=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x0160[_0x374ada];return _0x449ed8;};'use strict';var emlformat=require(_0x0016('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0016('0x1'));var rp=require('request-promise');var moment=require(_0x0016('0x2'));var BPromise=require(_0x0016('0x3'));var Mustache=require(_0x0016('0x4'));var util=require(_0x0016('0x5'));var path=require('path');var sox=require(_0x0016('0x6'));var csv=require(_0x0016('0x7'));var ejs=require(_0x0016('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0016('0x9'));var crypto=require(_0x0016('0xa'));var jsforce=require(_0x0016('0xb'));var deskjs=require(_0x0016('0xc'));var toCsv=require(_0x0016('0x7'));var querystring=require(_0x0016('0xd'));var Papa=require(_0x0016('0xe'));var Redis=require(_0x0016('0xf'));var authService=require(_0x0016('0x10'));var qs=require(_0x0016('0x11'));var as=require(_0x0016('0x12'));var hardwareService=require(_0x0016('0x13'));var logger=require(_0x0016('0x14'))(_0x0016('0x15'));var utils=require(_0x0016('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cc29f,_0x464fbd){_0x464fbd=_0x464fbd||0xcc;return function(_0x3001da){if(_0x3001da){return _0x4cc29f[_0x0016('0x17')](_0x464fbd);}return _0x4cc29f[_0x0016('0x18')](_0x464fbd)['end']();};}function respondWithResult(_0x29b56d,_0x57ea86){_0x57ea86=_0x57ea86||0xc8;return function(_0x44b2aa){if(_0x44b2aa){return _0x29b56d[_0x0016('0x18')](_0x57ea86)['json'](_0x44b2aa);}};}function respondWithFilteredResult(_0x30db02,_0x30f376){return function(_0x303dbe){if(_0x303dbe){var _0x8299e3=typeof _0x30f376[_0x0016('0x19')]===_0x0016('0x1a')&&typeof _0x30f376[_0x0016('0x1b')]===_0x0016('0x1a');var _0x52027c=_0x303dbe[_0x0016('0x1c')];var _0x83f56e=_0x8299e3?0x0:_0x30f376[_0x0016('0x19')];var _0x3d88fe=_0x8299e3?_0x303dbe[_0x0016('0x1c')]:_0x30f376[_0x0016('0x19')]+_0x30f376[_0x0016('0x1b')];var _0x538701;if(_0x3d88fe>=_0x52027c){_0x3d88fe=_0x52027c;_0x538701=0xc8;}else{_0x538701=0xce;}_0x30db02[_0x0016('0x18')](_0x538701);return _0x30db02[_0x0016('0x1d')](_0x0016('0x1e'),_0x83f56e+'-'+_0x3d88fe+'/'+_0x52027c)[_0x0016('0x1f')](_0x303dbe);}return null;};}function patchUpdates(_0x2858c4){return function(_0x4d92f9){try{jsonpatch[_0x0016('0x20')](_0x4d92f9,_0x2858c4,!![]);}catch(_0x1152a7){return BPromise[_0x0016('0x21')](_0x1152a7);}return _0x4d92f9['save']();};}function saveUpdates(_0x2b07e9,_0x58efe4){return function(_0x2666f8){if(_0x2666f8){return _0x2666f8[_0x0016('0x22')](_0x2b07e9)[_0x0016('0x23')](function(_0x581c9b){return _0x581c9b;});}return null;};}function removeEntity(_0x33a875,_0x3f8e7c){return function(_0x39b054){if(_0x39b054){return _0x39b054[_0x0016('0x24')]()[_0x0016('0x23')](function(){var _0x36f1fe=_0x39b054[_0x0016('0x25')]({'plain':!![]});var _0xacbede='Templates';return db[_0x0016('0x26')][_0x0016('0x24')]({'where':{'type':_0xacbede,'resourceId':_0x36f1fe['id']}})[_0x0016('0x23')](function(){return _0x39b054;});})[_0x0016('0x23')](function(){_0x33a875[_0x0016('0x18')](0xcc)[_0x0016('0x27')]();});}};}function handleEntityNotFound(_0x4af74a,_0x237bd3){return function(_0x140d90){if(!_0x140d90){_0x4af74a[_0x0016('0x17')](0x194);}return _0x140d90;};}function handleError(_0x456367,_0x1d7c12){_0x1d7c12=_0x1d7c12||0x1f4;return function(_0x3416ce){logger[_0x0016('0x28')](_0x3416ce[_0x0016('0x29')]);if(_0x3416ce['name']){delete _0x3416ce['name'];}_0x456367['status'](_0x1d7c12)[_0x0016('0x2a')](_0x3416ce);};}exports['index']=function(_0x435c2d,_0x34eb81){var _0x5ee83c={},_0x14930e={},_0x304264={'count':0x0,'rows':[]};var _0x5e9a60=_['map'](db['Template'][_0x0016('0x2b')],function(_0x1ae8f6){return{'name':_0x1ae8f6[_0x0016('0x2c')],'type':_0x1ae8f6[_0x0016('0x2d')][_0x0016('0x2e')]};});_0x14930e[_0x0016('0x2f')]=_[_0x0016('0x30')](_0x5e9a60,_0x0016('0x31'));_0x14930e[_0x0016('0x32')]=_['keys'](_0x435c2d[_0x0016('0x32')]);_0x14930e[_0x0016('0x33')]=_[_0x0016('0x34')](_0x14930e[_0x0016('0x2f')],_0x14930e['query']);_0x5ee83c[_0x0016('0x35')]=_['intersection'](_0x14930e[_0x0016('0x2f')],qs['fields'](_0x435c2d[_0x0016('0x32')][_0x0016('0x36')]));_0x5ee83c[_0x0016('0x35')]=_0x5ee83c[_0x0016('0x35')][_0x0016('0x37')]?_0x5ee83c[_0x0016('0x35')]:_0x14930e[_0x0016('0x2f')];if(!_0x435c2d['query'][_0x0016('0x38')](_0x0016('0x39'))){_0x5ee83c[_0x0016('0x1b')]=qs['limit'](_0x435c2d['query'][_0x0016('0x1b')]);_0x5ee83c[_0x0016('0x19')]=qs[_0x0016('0x19')](_0x435c2d[_0x0016('0x32')][_0x0016('0x19')]);}_0x5ee83c['order']=qs[_0x0016('0x3a')](_0x435c2d['query'][_0x0016('0x3a')]);_0x5ee83c[_0x0016('0x3b')]=qs[_0x0016('0x33')](_[_0x0016('0x3c')](_0x435c2d[_0x0016('0x32')],_0x14930e[_0x0016('0x33')]),_0x5e9a60);if(_0x435c2d['query']['filter']){_0x5ee83c[_0x0016('0x3b')]=_[_0x0016('0x3d')](_0x5ee83c['where'],{'$or':_[_0x0016('0x30')](_0x5e9a60,function(_0x8969d5){if(_0x8969d5[_0x0016('0x2d')]!==_0x0016('0x3e')){var _0x5adc16={};_0x5adc16[_0x8969d5['name']]={'$like':'%'+_0x435c2d[_0x0016('0x32')][_0x0016('0x3f')]+'%'};return _0x5adc16;}})});}_0x5ee83c=_['merge']({},_0x5ee83c,_0x435c2d[_0x0016('0x40')]);var _0x15e2b3={'where':_0x5ee83c[_0x0016('0x3b')]};return db[_0x0016('0x41')]['count'](_0x15e2b3)[_0x0016('0x23')](function(_0x363dea){_0x304264[_0x0016('0x1c')]=_0x363dea;if(_0x435c2d[_0x0016('0x32')][_0x0016('0x42')]){_0x5ee83c[_0x0016('0x43')]=[{'all':!![]}];}return db[_0x0016('0x41')]['findAll'](_0x5ee83c);})[_0x0016('0x23')](function(_0x348192){_0x304264[_0x0016('0x44')]=_0x348192;return _0x304264;})[_0x0016('0x23')](respondWithFilteredResult(_0x34eb81,_0x5ee83c))['catch'](handleError(_0x34eb81,null));};exports[_0x0016('0x45')]=function(_0x8b9c91,_0x521694){var _0x6664d0={'raw':!![],'where':{'id':_0x8b9c91[_0x0016('0x46')]['id']}},_0x4e2cb3={};_0x4e2cb3[_0x0016('0x2f')]=_[_0x0016('0x47')](db[_0x0016('0x41')][_0x0016('0x2b')]);_0x4e2cb3['query']=_[_0x0016('0x47')](_0x8b9c91[_0x0016('0x32')]);_0x4e2cb3[_0x0016('0x33')]=_[_0x0016('0x34')](_0x4e2cb3['model'],_0x4e2cb3[_0x0016('0x32')]);_0x6664d0[_0x0016('0x35')]=_[_0x0016('0x34')](_0x4e2cb3[_0x0016('0x2f')],qs[_0x0016('0x36')](_0x8b9c91[_0x0016('0x32')][_0x0016('0x36')]));_0x6664d0[_0x0016('0x35')]=_0x6664d0[_0x0016('0x35')][_0x0016('0x37')]?_0x6664d0[_0x0016('0x35')]:_0x4e2cb3['model'];if(_0x8b9c91[_0x0016('0x32')][_0x0016('0x42')]){_0x6664d0['include']=[{'all':!![]}];}_0x6664d0=_[_0x0016('0x3d')]({},_0x6664d0,_0x8b9c91[_0x0016('0x40')]);return db[_0x0016('0x41')][_0x0016('0x48')](_0x6664d0)[_0x0016('0x23')](handleEntityNotFound(_0x521694,null))['then'](respondWithResult(_0x521694,null))[_0x0016('0x49')](handleError(_0x521694,null));};exports[_0x0016('0x4a')]=function(_0x18647b,_0x49cb5c){return db[_0x0016('0x41')]['create'](_0x18647b[_0x0016('0x4b')],{})[_0x0016('0x23')](function(_0x835ce6){var _0x3d7507=_0x18647b[_0x0016('0x4c')][_0x0016('0x25')]({'plain':!![]});if(!_0x3d7507)throw new Error(_0x0016('0x4d'));if(_0x3d7507['role']==='user'){var _0x26180f=_0x835ce6[_0x0016('0x25')]({'plain':!![]});var _0x23a1ae=_0x0016('0x4e');return db[_0x0016('0x4f')][_0x0016('0x48')]({'where':{'name':_0x23a1ae,'userProfileId':_0x3d7507['userProfileId']},'raw':!![]})[_0x0016('0x23')](function(_0x2b52bc){if(_0x2b52bc&&_0x2b52bc[_0x0016('0x50')]===0x0){return db[_0x0016('0x26')]['create']({'name':_0x26180f[_0x0016('0x31')],'resourceId':_0x26180f['id'],'type':_0x2b52bc['name'],'sectionId':_0x2b52bc['id']},{})[_0x0016('0x23')](function(){return _0x835ce6;});}else{return _0x835ce6;}})[_0x0016('0x49')](function(_0x284fef){logger['error'](_0x0016('0x51'),_0x284fef);throw _0x284fef;});}return _0x835ce6;})[_0x0016('0x23')](respondWithResult(_0x49cb5c,0xc9))[_0x0016('0x49')](handleError(_0x49cb5c,null));};exports[_0x0016('0x22')]=function(_0x33e088,_0x15eca3){if(_0x33e088[_0x0016('0x4b')]['id']){delete _0x33e088[_0x0016('0x4b')]['id'];}return db[_0x0016('0x41')][_0x0016('0x48')]({'where':{'id':_0x33e088[_0x0016('0x46')]['id']}})[_0x0016('0x23')](handleEntityNotFound(_0x15eca3,null))[_0x0016('0x23')](saveUpdates(_0x33e088[_0x0016('0x4b')],null))['then'](respondWithResult(_0x15eca3,null))[_0x0016('0x49')](handleError(_0x15eca3,null));};exports[_0x0016('0x24')]=function(_0x13d72f,_0x2b810a){return db[_0x0016('0x41')]['find']({'where':{'id':_0x13d72f[_0x0016('0x46')]['id']}})[_0x0016('0x23')](handleEntityNotFound(_0x2b810a,null))['then'](removeEntity(_0x2b810a,null))[_0x0016('0x49')](handleError(_0x2b810a,null));}; \ No newline at end of file +var _0x61f6=['../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','end','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis'];(function(_0x46054b,_0x3f1923){var _0x2395eb=function(_0x25d6c0){while(--_0x25d6c0){_0x46054b['push'](_0x46054b['shift']());}};_0x2395eb(++_0x3f1923);}(_0x61f6,0x198));var _0x661f=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x61f6[_0x1df7b8];return _0x29d911;};'use strict';var emlformat=require(_0x661f('0x0'));var rimraf=require(_0x661f('0x1'));var zipdir=require(_0x661f('0x2'));var jsonpatch=require(_0x661f('0x3'));var rp=require(_0x661f('0x4'));var moment=require(_0x661f('0x5'));var BPromise=require(_0x661f('0x6'));var Mustache=require(_0x661f('0x7'));var util=require(_0x661f('0x8'));var path=require(_0x661f('0x9'));var sox=require(_0x661f('0xa'));var csv=require(_0x661f('0xb'));var ejs=require(_0x661f('0xc'));var fs=require('fs');var fs_extra=require(_0x661f('0xd'));var _=require(_0x661f('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x661f('0xb'));var querystring=require(_0x661f('0xf'));var Papa=require('papaparse');var Redis=require(_0x661f('0x10'));var authService=require(_0x661f('0x11'));var qs=require(_0x661f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x661f('0x13'));var config=require(_0x661f('0x14'));var licenseUtil=require(_0x661f('0x15'));var db=require(_0x661f('0x16'))['db'];function respondWithStatusCode(_0x2d42b6,_0x185001){_0x185001=_0x185001||0xcc;return function(_0x236c5c){if(_0x236c5c){return _0x2d42b6[_0x661f('0x17')](_0x185001);}return _0x2d42b6[_0x661f('0x18')](_0x185001)['end']();};}function respondWithResult(_0x15bd92,_0x183252){_0x183252=_0x183252||0xc8;return function(_0x209cce){if(_0x209cce){return _0x15bd92[_0x661f('0x18')](_0x183252)[_0x661f('0x19')](_0x209cce);}};}function respondWithFilteredResult(_0x1245b7,_0x3c6239){return function(_0x22b232){if(_0x22b232){var _0x52f2dc=typeof _0x3c6239[_0x661f('0x1a')]===_0x661f('0x1b')&&typeof _0x3c6239[_0x661f('0x1c')]===_0x661f('0x1b');var _0x2d33ee=_0x22b232['count'];var _0xd154e4=_0x52f2dc?0x0:_0x3c6239[_0x661f('0x1a')];var _0x2e979a=_0x52f2dc?_0x22b232[_0x661f('0x1d')]:_0x3c6239[_0x661f('0x1a')]+_0x3c6239[_0x661f('0x1c')];var _0x4f0a9d;if(_0x2e979a>=_0x2d33ee){_0x2e979a=_0x2d33ee;_0x4f0a9d=0xc8;}else{_0x4f0a9d=0xce;}_0x1245b7[_0x661f('0x18')](_0x4f0a9d);return _0x1245b7['set'](_0x661f('0x1e'),_0xd154e4+'-'+_0x2e979a+'/'+_0x2d33ee)[_0x661f('0x19')](_0x22b232);}return null;};}function patchUpdates(_0x5d10b6){return function(_0x4f0488){try{jsonpatch[_0x661f('0x1f')](_0x4f0488,_0x5d10b6,!![]);}catch(_0x42c619){return BPromise[_0x661f('0x20')](_0x42c619);}return _0x4f0488[_0x661f('0x21')]();};}function saveUpdates(_0x37b97b,_0x4d9632){return function(_0x3b63dd){if(_0x3b63dd){return _0x3b63dd[_0x661f('0x22')](_0x37b97b)[_0x661f('0x23')](function(_0x1e4c90){return _0x1e4c90;});}return null;};}function removeEntity(_0x1859f0,_0x46436b){return function(_0x20fb78){if(_0x20fb78){return _0x20fb78[_0x661f('0x24')]()[_0x661f('0x23')](function(){var _0x4be98b=_0x20fb78['get']({'plain':!![]});var _0x344a49=_0x661f('0x25');return db[_0x661f('0x26')]['destroy']({'where':{'type':_0x344a49,'resourceId':_0x4be98b['id']}})[_0x661f('0x23')](function(){return _0x20fb78;});})['then'](function(){_0x1859f0[_0x661f('0x18')](0xcc)[_0x661f('0x27')]();});}};}function handleEntityNotFound(_0x62984a,_0x5cbea2){return function(_0x41b42f){if(!_0x41b42f){_0x62984a['sendStatus'](0x194);}return _0x41b42f;};}function handleError(_0x235e47,_0x1ede8b){_0x1ede8b=_0x1ede8b||0x1f4;return function(_0x327182){logger['error'](_0x327182[_0x661f('0x28')]);if(_0x327182[_0x661f('0x29')]){delete _0x327182[_0x661f('0x29')];}_0x235e47[_0x661f('0x18')](_0x1ede8b)[_0x661f('0x2a')](_0x327182);};}exports[_0x661f('0x2b')]=function(_0x38f774,_0x28e267){var _0x5f0f9b={},_0x1f89bf={},_0x12be27={'count':0x0,'rows':[]};var _0x465e56=_[_0x661f('0x2c')](db[_0x661f('0x2d')][_0x661f('0x2e')],function(_0x227c9d){return{'name':_0x227c9d[_0x661f('0x2f')],'type':_0x227c9d[_0x661f('0x30')][_0x661f('0x31')]};});_0x1f89bf[_0x661f('0x32')]=_[_0x661f('0x2c')](_0x465e56,'name');_0x1f89bf[_0x661f('0x33')]=_[_0x661f('0x34')](_0x38f774[_0x661f('0x33')]);_0x1f89bf[_0x661f('0x35')]=_[_0x661f('0x36')](_0x1f89bf[_0x661f('0x32')],_0x1f89bf[_0x661f('0x33')]);_0x5f0f9b[_0x661f('0x37')]=_[_0x661f('0x36')](_0x1f89bf['model'],qs[_0x661f('0x38')](_0x38f774[_0x661f('0x33')][_0x661f('0x38')]));_0x5f0f9b['attributes']=_0x5f0f9b[_0x661f('0x37')][_0x661f('0x39')]?_0x5f0f9b[_0x661f('0x37')]:_0x1f89bf[_0x661f('0x32')];if(!_0x38f774[_0x661f('0x33')][_0x661f('0x3a')](_0x661f('0x3b'))){_0x5f0f9b[_0x661f('0x1c')]=qs[_0x661f('0x1c')](_0x38f774[_0x661f('0x33')][_0x661f('0x1c')]);_0x5f0f9b[_0x661f('0x1a')]=qs[_0x661f('0x1a')](_0x38f774['query'][_0x661f('0x1a')]);}_0x5f0f9b['order']=qs['sort'](_0x38f774['query'][_0x661f('0x3c')]);_0x5f0f9b[_0x661f('0x3d')]=qs['filters'](_[_0x661f('0x3e')](_0x38f774[_0x661f('0x33')],_0x1f89bf[_0x661f('0x35')]),_0x465e56);if(_0x38f774['query'][_0x661f('0x3f')]){_0x5f0f9b['where']=_[_0x661f('0x40')](_0x5f0f9b[_0x661f('0x3d')],{'$or':_[_0x661f('0x2c')](_0x465e56,function(_0x4f9e44){if(_0x4f9e44['type']!==_0x661f('0x41')){var _0x26047e={};_0x26047e[_0x4f9e44[_0x661f('0x29')]]={'$like':'%'+_0x38f774['query'][_0x661f('0x3f')]+'%'};return _0x26047e;}})});}_0x5f0f9b=_[_0x661f('0x40')]({},_0x5f0f9b,_0x38f774[_0x661f('0x42')]);var _0x163c83={'where':_0x5f0f9b['where']};return db[_0x661f('0x2d')][_0x661f('0x1d')](_0x163c83)[_0x661f('0x23')](function(_0x3ee99c){_0x12be27['count']=_0x3ee99c;if(_0x38f774[_0x661f('0x33')][_0x661f('0x43')]){_0x5f0f9b[_0x661f('0x44')]=[{'all':!![]}];}return db[_0x661f('0x2d')][_0x661f('0x45')](_0x5f0f9b);})['then'](function(_0x17b40b){_0x12be27[_0x661f('0x46')]=_0x17b40b;return _0x12be27;})[_0x661f('0x23')](respondWithFilteredResult(_0x28e267,_0x5f0f9b))[_0x661f('0x47')](handleError(_0x28e267,null));};exports[_0x661f('0x48')]=function(_0x5dc3d1,_0x45b173){var _0xd8e1={'raw':!![],'where':{'id':_0x5dc3d1[_0x661f('0x49')]['id']}},_0x185ad7={};_0x185ad7[_0x661f('0x32')]=_[_0x661f('0x34')](db[_0x661f('0x2d')][_0x661f('0x2e')]);_0x185ad7[_0x661f('0x33')]=_[_0x661f('0x34')](_0x5dc3d1[_0x661f('0x33')]);_0x185ad7['filters']=_['intersection'](_0x185ad7[_0x661f('0x32')],_0x185ad7[_0x661f('0x33')]);_0xd8e1[_0x661f('0x37')]=_['intersection'](_0x185ad7[_0x661f('0x32')],qs['fields'](_0x5dc3d1[_0x661f('0x33')][_0x661f('0x38')]));_0xd8e1['attributes']=_0xd8e1[_0x661f('0x37')][_0x661f('0x39')]?_0xd8e1['attributes']:_0x185ad7[_0x661f('0x32')];if(_0x5dc3d1[_0x661f('0x33')]['includeAll']){_0xd8e1['include']=[{'all':!![]}];}_0xd8e1=_[_0x661f('0x40')]({},_0xd8e1,_0x5dc3d1['options']);return db[_0x661f('0x2d')]['find'](_0xd8e1)[_0x661f('0x23')](handleEntityNotFound(_0x45b173,null))[_0x661f('0x23')](respondWithResult(_0x45b173,null))[_0x661f('0x47')](handleError(_0x45b173,null));};exports['create']=function(_0x106c3f,_0x29017d){return db[_0x661f('0x2d')][_0x661f('0x4a')](_0x106c3f['body'],{})[_0x661f('0x23')](function(_0x1ab039){var _0x4ac03e=_0x106c3f[_0x661f('0x4b')][_0x661f('0x4c')]({'plain':!![]});if(!_0x4ac03e)throw new Error(_0x661f('0x4d'));if(_0x4ac03e[_0x661f('0x4e')]==='user'){var _0x259587=_0x1ab039[_0x661f('0x4c')]({'plain':!![]});var _0x2e5774=_0x661f('0x25');return db[_0x661f('0x4f')][_0x661f('0x50')]({'where':{'name':_0x2e5774,'userProfileId':_0x4ac03e[_0x661f('0x51')]},'raw':!![]})['then'](function(_0x12de84){if(_0x12de84&&_0x12de84[_0x661f('0x52')]===0x0){return db[_0x661f('0x26')][_0x661f('0x4a')]({'name':_0x259587[_0x661f('0x29')],'resourceId':_0x259587['id'],'type':_0x12de84[_0x661f('0x29')],'sectionId':_0x12de84['id']},{})[_0x661f('0x23')](function(){return _0x1ab039;});}else{return _0x1ab039;}})[_0x661f('0x47')](function(_0x1ddba7){logger['error'](_0x661f('0x53'),_0x1ddba7);throw _0x1ddba7;});}return _0x1ab039;})['then'](respondWithResult(_0x29017d,0xc9))[_0x661f('0x47')](handleError(_0x29017d,null));};exports['update']=function(_0x1ff3ec,_0x293c28){if(_0x1ff3ec[_0x661f('0x54')]['id']){delete _0x1ff3ec[_0x661f('0x54')]['id'];}return db[_0x661f('0x2d')][_0x661f('0x50')]({'where':{'id':_0x1ff3ec[_0x661f('0x49')]['id']}})['then'](handleEntityNotFound(_0x293c28,null))[_0x661f('0x23')](saveUpdates(_0x1ff3ec[_0x661f('0x54')],null))[_0x661f('0x23')](respondWithResult(_0x293c28,null))[_0x661f('0x47')](handleError(_0x293c28,null));};exports[_0x661f('0x24')]=function(_0x165e59,_0xb3e21a){return db[_0x661f('0x2d')]['find']({'where':{'id':_0x165e59[_0x661f('0x49')]['id']}})[_0x661f('0x23')](handleEntityNotFound(_0xb3e21a,null))[_0x661f('0x23')](removeEntity(_0xb3e21a,null))[_0x661f('0x47')](handleError(_0xb3e21a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bb970e2..384861e 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 _0x2a32=['path','rimraf','../../config/environment','exports','define','Template','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x40740c,_0x5b17a2){var _0x4bb3a7=function(_0x3d7fd0){while(--_0x3d7fd0){_0x40740c['push'](_0x40740c['shift']());}};_0x4bb3a7(++_0x5b17a2);}(_0x2a32,0x17c));var _0x22a3=function(_0x2170e4,_0x5b969e){_0x2170e4=_0x2170e4-0x0;var _0xec86f5=_0x2a32[_0x2170e4];return _0xec86f5;};'use strict';var _=require(_0x22a3('0x0'));var util=require('util');var logger=require(_0x22a3('0x1'))('api');var moment=require(_0x22a3('0x2'));var BPromise=require(_0x22a3('0x3'));var rp=require(_0x22a3('0x4'));var fs=require('fs');var path=require(_0x22a3('0x5'));var rimraf=require(_0x22a3('0x6'));var config=require(_0x22a3('0x7'));var attributes=require('./template.attributes');module[_0x22a3('0x8')]=function(_0x5901f0,_0x289898){return _0x5901f0[_0x22a3('0x9')](_0x22a3('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6acd=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x1b92b2,_0xf45723){var _0xebd1f1=function(_0x33f988){while(--_0x33f988){_0x1b92b2['push'](_0x1b92b2['shift']());}};_0xebd1f1(++_0xf45723);}(_0x6acd,0x113));var _0xd6ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6acd[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd6ac('0x0'));var util=require(_0xd6ac('0x1'));var logger=require(_0xd6ac('0x2'))(_0xd6ac('0x3'));var moment=require(_0xd6ac('0x4'));var BPromise=require(_0xd6ac('0x5'));var rp=require(_0xd6ac('0x6'));var fs=require('fs');var path=require(_0xd6ac('0x7'));var rimraf=require(_0xd6ac('0x8'));var config=require(_0xd6ac('0x9'));var attributes=require(_0xd6ac('0xa'));module[_0xd6ac('0xb')]=function(_0x11abdd,_0x6d2387){return _0x11abdd['define'](_0xd6ac('0xc'),attributes,{'tableName':_0xd6ac('0xd'),'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 91155d1..6e0e7f8 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 _0x25cf=['attributes','GetTemplate','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Template','findAll','options','where','limit','include','map','model'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x25cf,0x138));var _0xf25c=function(_0x441195,_0x304a76){_0x441195=_0x441195-0x0;var _0x8de790=_0x25cf[_0x441195];return _0x8de790;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf25c('0x0'));var fs=require('fs');var Redis=require(_0xf25c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf25c('0x2'));var logger=require('../../config/logger')(_0xf25c('0x3'));var config=require(_0xf25c('0x4'));var jayson=require(_0xf25c('0x5'));var client=jayson[_0xf25c('0x6')][_0xf25c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46f2a2,_0x539fca,_0x88438e){return new BPromise(function(_0x5ba877,_0x141bb6){return client[_0xf25c('0x8')](_0x46f2a2,_0x88438e)[_0xf25c('0x9')](function(_0x94efb0){logger[_0xf25c('0xa')](_0xf25c('0xb'),_0x539fca,_0xf25c('0xc'));logger[_0xf25c('0xd')](_0xf25c('0xe'),_0x539fca,'request\x20sent',JSON[_0xf25c('0xf')](_0x94efb0));if(_0x94efb0[_0xf25c('0x10')]){if(_0x94efb0[_0xf25c('0x10')][_0xf25c('0x11')]===0x1f4){logger[_0xf25c('0x10')](_0xf25c('0xb'),_0x539fca,_0x94efb0[_0xf25c('0x10')][_0xf25c('0x12')]);return _0x141bb6(_0x94efb0['error'][_0xf25c('0x12')]);}logger['error'](_0xf25c('0xb'),_0x539fca,_0x94efb0[_0xf25c('0x10')][_0xf25c('0x12')]);return _0x5ba877(_0x94efb0[_0xf25c('0x10')][_0xf25c('0x12')]);}else{logger['info'](_0xf25c('0xb'),_0x539fca,_0xf25c('0xc'));_0x5ba877(_0x94efb0[_0xf25c('0x13')]['message']);}})[_0xf25c('0x14')](function(_0x127952){logger[_0xf25c('0x10')](_0xf25c('0xb'),_0x539fca,_0x127952);_0x141bb6(_0x127952);});});}exports['GetTemplate']=function(_0x51b989){var _0x5cd13f=this;return new Promise(function(_0x1acda2,_0x12aa8a){return db[_0xf25c('0x15')][_0xf25c('0x16')]({'raw':_0x51b989['options']?_0x51b989[_0xf25c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x51b989[_0xf25c('0x17')]?_0x51b989[_0xf25c('0x17')][_0xf25c('0x18')]||null:null,'attributes':_0x51b989['options']?_0x51b989[_0xf25c('0x17')]['attributes']||null:null,'limit':_0x51b989[_0xf25c('0x17')]?_0x51b989[_0xf25c('0x17')][_0xf25c('0x19')]||null:null,'include':_0x51b989[_0xf25c('0x17')]?_0x51b989['options'][_0xf25c('0x1a')]?_[_0xf25c('0x1b')](_0x51b989[_0xf25c('0x17')][_0xf25c('0x1a')],function(_0xc96eda){return{'model':db[_0xc96eda[_0xf25c('0x1c')]],'as':_0xc96eda['as'],'attributes':_0xc96eda[_0xf25c('0x1d')],'include':_0xc96eda[_0xf25c('0x1a')]?_['map'](_0xc96eda[_0xf25c('0x1a')],function(_0x290d78){return{'model':db[_0x290d78[_0xf25c('0x1c')]],'as':_0x290d78['as'],'attributes':_0x290d78[_0xf25c('0x1d')],'include':_0x290d78[_0xf25c('0x1a')]?_[_0xf25c('0x1b')](_0x290d78[_0xf25c('0x1a')],function(_0x513076){return{'model':db[_0x513076[_0xf25c('0x1c')]],'as':_0x513076['as'],'attributes':_0x513076[_0xf25c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf25c('0x9')](function(_0x2d635d){logger[_0xf25c('0xa')](_0xf25c('0x1e'),_0x51b989);logger['debug'](_0xf25c('0x1e'),_0x51b989,JSON['stringify'](_0x2d635d));_0x1acda2(_0x2d635d);})[_0xf25c('0x14')](function(_0x29f1cd){logger['error'](_0xf25c('0x1e'),_0x29f1cd['message'],_0x51b989);_0x12aa8a(_0x5cd13f[_0xf25c('0x10')](0x1f4,_0x29f1cd[_0xf25c('0x12')]));});});}; \ No newline at end of file +var _0xdb3a=['where','limit','include','model','attributes','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTemplate','Template','findAll','options'];(function(_0x52e0f5,_0x18eeaa){var _0x20b7f1=function(_0x2b161a){while(--_0x2b161a){_0x52e0f5['push'](_0x52e0f5['shift']());}};_0x20b7f1(++_0x18eeaa);}(_0xdb3a,0x1c0));var _0xadb3=function(_0x4dc8fc,_0x27d9a5){_0x4dc8fc=_0x4dc8fc-0x0;var _0x18d77f=_0xdb3a[_0x4dc8fc];return _0x18d77f;};'use strict';var _=require(_0xadb3('0x0'));var util=require(_0xadb3('0x1'));var moment=require(_0xadb3('0x2'));var BPromise=require(_0xadb3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb3('0x4'));var db=require(_0xadb3('0x5'))['db'];var utils=require(_0xadb3('0x6'));var logger=require(_0xadb3('0x7'))(_0xadb3('0x8'));var config=require(_0xadb3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xadb3('0xa')][_0xadb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x387078,_0x2ca9c3,_0x21cb2c){return new BPromise(function(_0xae3f3,_0x2c5a4f){return client[_0xadb3('0xc')](_0x387078,_0x21cb2c)[_0xadb3('0xd')](function(_0x14abdd){logger['info'](_0xadb3('0xe'),_0x2ca9c3,_0xadb3('0xf'));logger[_0xadb3('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x2ca9c3,_0xadb3('0xf'),JSON[_0xadb3('0x11')](_0x14abdd));if(_0x14abdd[_0xadb3('0x12')]){if(_0x14abdd[_0xadb3('0x12')][_0xadb3('0x13')]===0x1f4){logger[_0xadb3('0x12')]('Template,\x20%s,\x20%s',_0x2ca9c3,_0x14abdd[_0xadb3('0x12')][_0xadb3('0x14')]);return _0x2c5a4f(_0x14abdd['error'][_0xadb3('0x14')]);}logger[_0xadb3('0x12')](_0xadb3('0xe'),_0x2ca9c3,_0x14abdd['error'][_0xadb3('0x14')]);return _0xae3f3(_0x14abdd[_0xadb3('0x12')]['message']);}else{logger[_0xadb3('0x15')]('Template,\x20%s,\x20%s',_0x2ca9c3,_0xadb3('0xf'));_0xae3f3(_0x14abdd[_0xadb3('0x16')][_0xadb3('0x14')]);}})[_0xadb3('0x17')](function(_0x350fbc){logger[_0xadb3('0x12')](_0xadb3('0xe'),_0x2ca9c3,_0x350fbc);_0x2c5a4f(_0x350fbc);});});}exports[_0xadb3('0x18')]=function(_0x446506){var _0x2223ad=this;return new Promise(function(_0x253ec1,_0x223c67){return db[_0xadb3('0x19')][_0xadb3('0x1a')]({'raw':_0x446506['options']?_0x446506['options']['raw']===undefined?!![]:![]:!![],'where':_0x446506[_0xadb3('0x1b')]?_0x446506[_0xadb3('0x1b')][_0xadb3('0x1c')]||null:null,'attributes':_0x446506[_0xadb3('0x1b')]?_0x446506['options']['attributes']||null:null,'limit':_0x446506[_0xadb3('0x1b')]?_0x446506['options'][_0xadb3('0x1d')]||null:null,'include':_0x446506['options']?_0x446506[_0xadb3('0x1b')][_0xadb3('0x1e')]?_['map'](_0x446506[_0xadb3('0x1b')][_0xadb3('0x1e')],function(_0x1f1593){return{'model':db[_0x1f1593[_0xadb3('0x1f')]],'as':_0x1f1593['as'],'attributes':_0x1f1593[_0xadb3('0x20')],'include':_0x1f1593[_0xadb3('0x1e')]?_['map'](_0x1f1593[_0xadb3('0x1e')],function(_0x176e49){return{'model':db[_0x176e49[_0xadb3('0x1f')]],'as':_0x176e49['as'],'attributes':_0x176e49['attributes'],'include':_0x176e49['include']?_[_0xadb3('0x21')](_0x176e49[_0xadb3('0x1e')],function(_0x53df2d){return{'model':db[_0x53df2d['model']],'as':_0x53df2d['as'],'attributes':_0x53df2d[_0xadb3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xadb3('0xd')](function(_0x4b3497){logger['info'](_0xadb3('0x18'),_0x446506);logger[_0xadb3('0x10')]('GetTemplate',_0x446506,JSON['stringify'](_0x4b3497));_0x253ec1(_0x4b3497);})['catch'](function(_0x56cad5){logger['error'](_0xadb3('0x18'),_0x56cad5[_0xadb3('0x14')],_0x446506);_0x223c67(_0x2223ad[_0xadb3('0x12')](0x1f4,_0x56cad5['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9dd955d..3538315 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 _0x6f59=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','show','/:id/all_conditions','isAuthenticated','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x6f59,0x1be));var _0x96f5=function(_0x51a17e,_0x57e13f){_0x51a17e=_0x51a17e-0x0;var _0x521f0f=_0x6f59[_0x51a17e];return _0x521f0f;};'use strict';var multer=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var path=require(_0x96f5('0x2'));var timeout=require(_0x96f5('0x3'));var express=require(_0x96f5('0x4'));var router=express[_0x96f5('0x5')]();var fs_extra=require(_0x96f5('0x6'));var auth=require(_0x96f5('0x7'));var interaction=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var controller=require(_0x96f5('0xa'));router[_0x96f5('0xb')]('/',auth['isAuthenticated'](),controller[_0x96f5('0xc')]);router['get'](_0x96f5('0xd'),auth['isAuthenticated'](),controller[_0x96f5('0xe')]);router['get'](_0x96f5('0xf'),auth[_0x96f5('0x10')](),controller[_0x96f5('0x11')]);router[_0x96f5('0xb')]('/:id/any_conditions',auth[_0x96f5('0x10')](),controller[_0x96f5('0x12')]);router[_0x96f5('0xb')](_0x96f5('0x13'),auth[_0x96f5('0x10')](),controller[_0x96f5('0x14')]);router[_0x96f5('0x15')]('/',auth[_0x96f5('0x10')](),controller[_0x96f5('0x16')]);router[_0x96f5('0x15')](_0x96f5('0xf'),auth[_0x96f5('0x10')](),controller[_0x96f5('0x17')]);router['post'](_0x96f5('0x18'),auth[_0x96f5('0x10')](),controller[_0x96f5('0x19')]);router[_0x96f5('0x15')](_0x96f5('0x13'),auth[_0x96f5('0x10')](),controller['addAction']);router[_0x96f5('0x1a')]('/:id',auth[_0x96f5('0x10')](),controller[_0x96f5('0x1b')]);router[_0x96f5('0x1c')](_0x96f5('0xd'),auth[_0x96f5('0x10')](),controller['destroy']);module[_0x96f5('0x1d')]=router; \ No newline at end of file +var _0x2472=['addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/any_conditions','getAnyConditions','create','post'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2472,0xd8));var _0x2247=function(_0x14d52a,_0x230db6){_0x14d52a=_0x14d52a-0x0;var _0x2a3f66=_0x2472[_0x14d52a];return _0x2a3f66;};'use strict';var multer=require(_0x2247('0x0'));var util=require(_0x2247('0x1'));var path=require(_0x2247('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2247('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2247('0x4'));var config=require(_0x2247('0x5'));var controller=require(_0x2247('0x6'));router[_0x2247('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2247('0x7')](_0x2247('0x8'),auth[_0x2247('0x9')](),controller[_0x2247('0xa')]);router['get']('/:id/all_conditions',auth[_0x2247('0x9')](),controller['getAllConditions']);router[_0x2247('0x7')](_0x2247('0xb'),auth[_0x2247('0x9')](),controller[_0x2247('0xc')]);router[_0x2247('0x7')]('/:id/actions',auth[_0x2247('0x9')](),controller['getActions']);router['post']('/',auth[_0x2247('0x9')](),controller[_0x2247('0xd')]);router['post']('/:id/all_conditions',auth[_0x2247('0x9')](),controller['addAllCondition']);router[_0x2247('0xe')]('/:id/any_conditions',auth[_0x2247('0x9')](),controller[_0x2247('0xf')]);router[_0x2247('0xe')]('/:id/actions',auth[_0x2247('0x9')](),controller[_0x2247('0x10')]);router[_0x2247('0x11')](_0x2247('0x8'),auth[_0x2247('0x9')](),controller[_0x2247('0x12')]);router['delete'](_0x2247('0x8'),auth['isAuthenticated'](),controller[_0x2247('0x13')]);module[_0x2247('0x14')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 37addf3..a0daf2a 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 _0x5128=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1fb1a2,_0x16c9cd){var _0x3e1434=function(_0x93b357){while(--_0x93b357){_0x1fb1a2['push'](_0x1fb1a2['shift']());}};_0x3e1434(++_0x16c9cd);}(_0x5128,0xa8));var _0x8512=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x5128[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x8512('0x0'));module[_0x8512('0x1')]={'name':{'type':Sequelize[_0x8512('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8512('0x2')]},'status':{'type':Sequelize[_0x8512('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc727=['STRING','sequelize','exports'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xc727,0x11e));var _0x7c72=function(_0x2af547,_0x230962){_0x2af547=_0x2af547-0x0;var _0x264b8b=_0xc727[_0x2af547];return _0x264b8b;};'use strict';var Sequelize=require(_0x7c72('0x0'));module[_0x7c72('0x1')]={'name':{'type':Sequelize[_0x7c72('0x2')]},'channel':{'type':Sequelize[_0x7c72('0x2')]},'description':{'type':Sequelize[_0x7c72('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 9957aaa..4c389a5 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 _0x7bdb=['Trigger','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','params','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','Action','rawAttributes','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','index','map'];(function(_0x42076b,_0x4ebf43){var _0x51f2ab=function(_0x5ec89e){while(--_0x5ec89e){_0x42076b['push'](_0x42076b['shift']());}};_0x51f2ab(++_0x4ebf43);}(_0x7bdb,0x1a0));var _0xb7bd=function(_0x517d65,_0x29cbc3){_0x517d65=_0x517d65-0x0;var _0xf911de=_0x7bdb[_0x517d65];return _0xf911de;};'use strict';var emlformat=require(_0xb7bd('0x0'));var rimraf=require(_0xb7bd('0x1'));var zipdir=require(_0xb7bd('0x2'));var jsonpatch=require(_0xb7bd('0x3'));var rp=require('request-promise');var moment=require(_0xb7bd('0x4'));var BPromise=require(_0xb7bd('0x5'));var Mustache=require(_0xb7bd('0x6'));var util=require(_0xb7bd('0x7'));var path=require(_0xb7bd('0x8'));var sox=require(_0xb7bd('0x9'));var csv=require(_0xb7bd('0xa'));var ejs=require(_0xb7bd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb7bd('0xd'));var toCsv=require(_0xb7bd('0xa'));var querystring=require(_0xb7bd('0xe'));var Papa=require(_0xb7bd('0xf'));var Redis=require(_0xb7bd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb7bd('0x11'));var as=require(_0xb7bd('0x12'));var hardwareService=require(_0xb7bd('0x13'));var logger=require(_0xb7bd('0x14'))(_0xb7bd('0x15'));var utils=require('../../config/utils');var config=require(_0xb7bd('0x16'));var licenseUtil=require(_0xb7bd('0x17'));var db=require(_0xb7bd('0x18'))['db'];function respondWithStatusCode(_0x18258a,_0x2d0a14){_0x2d0a14=_0x2d0a14||0xcc;return function(_0x35365b){if(_0x35365b){return _0x18258a['sendStatus'](_0x2d0a14);}return _0x18258a[_0xb7bd('0x19')](_0x2d0a14)['end']();};}function respondWithResult(_0x596c53,_0x28b999){_0x28b999=_0x28b999||0xc8;return function(_0x38494f){if(_0x38494f){return _0x596c53['status'](_0x28b999)[_0xb7bd('0x1a')](_0x38494f);}};}function respondWithFilteredResult(_0x16c8e7,_0x47cc88){return function(_0x20a465){if(_0x20a465){var _0x39981a=typeof _0x47cc88[_0xb7bd('0x1b')]===_0xb7bd('0x1c')&&typeof _0x47cc88['limit']==='undefined';var _0x27bbe5=_0x20a465[_0xb7bd('0x1d')];var _0x5aeba6=_0x39981a?0x0:_0x47cc88[_0xb7bd('0x1b')];var _0x458787=_0x39981a?_0x20a465[_0xb7bd('0x1d')]:_0x47cc88[_0xb7bd('0x1b')]+_0x47cc88['limit'];var _0x54731e;if(_0x458787>=_0x27bbe5){_0x458787=_0x27bbe5;_0x54731e=0xc8;}else{_0x54731e=0xce;}_0x16c8e7[_0xb7bd('0x19')](_0x54731e);return _0x16c8e7[_0xb7bd('0x1e')](_0xb7bd('0x1f'),_0x5aeba6+'-'+_0x458787+'/'+_0x27bbe5)[_0xb7bd('0x1a')](_0x20a465);}return null;};}function patchUpdates(_0x575f01){return function(_0x42826c){try{jsonpatch[_0xb7bd('0x20')](_0x42826c,_0x575f01,!![]);}catch(_0x1a174b){return BPromise['reject'](_0x1a174b);}return _0x42826c['save']();};}function saveUpdates(_0x2dbdb2,_0x30efda){return function(_0x5e6024){if(_0x5e6024){return _0x5e6024['update'](_0x2dbdb2)['then'](function(_0x4bde0){return _0x4bde0;});}return null;};}function removeEntity(_0x14cf55,_0x3017e9){return function(_0x4322ce){if(_0x4322ce){return _0x4322ce[_0xb7bd('0x21')]()[_0xb7bd('0x22')](function(){var _0x43425b=_0x4322ce[_0xb7bd('0x23')]({'plain':!![]});var _0x802e08='Triggers';return db[_0xb7bd('0x24')]['destroy']({'where':{'type':_0x802e08,'resourceId':_0x43425b['id']}})[_0xb7bd('0x22')](function(){return _0x4322ce;});})[_0xb7bd('0x22')](function(){_0x14cf55[_0xb7bd('0x19')](0xcc)[_0xb7bd('0x25')]();});}};}function handleEntityNotFound(_0x4a7a17,_0x17ea87){return function(_0x5bbd0e){if(!_0x5bbd0e){_0x4a7a17[_0xb7bd('0x26')](0x194);}return _0x5bbd0e;};}function handleError(_0x1abab8,_0x14c9a7){_0x14c9a7=_0x14c9a7||0x1f4;return function(_0x14dc41){logger[_0xb7bd('0x27')](_0x14dc41[_0xb7bd('0x28')]);if(_0x14dc41[_0xb7bd('0x29')]){delete _0x14dc41['name'];}_0x1abab8[_0xb7bd('0x19')](_0x14c9a7)['send'](_0x14dc41);};}exports[_0xb7bd('0x2a')]=function(_0x1e8de4,_0x4b07a0){var _0x5572d5={},_0x957611={},_0x220e3b={'count':0x0,'rows':[]};var _0x2b568d=_[_0xb7bd('0x2b')](db[_0xb7bd('0x2c')]['rawAttributes'],function(_0x3802d0){return{'name':_0x3802d0[_0xb7bd('0x2d')],'type':_0x3802d0[_0xb7bd('0x2e')][_0xb7bd('0x2f')]};});_0x957611[_0xb7bd('0x30')]=_[_0xb7bd('0x2b')](_0x2b568d,_0xb7bd('0x29'));_0x957611[_0xb7bd('0x31')]=_[_0xb7bd('0x32')](_0x1e8de4[_0xb7bd('0x31')]);_0x957611['filters']=_[_0xb7bd('0x33')](_0x957611['model'],_0x957611[_0xb7bd('0x31')]);_0x5572d5[_0xb7bd('0x34')]=_['intersection'](_0x957611[_0xb7bd('0x30')],qs['fields'](_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x35')]));_0x5572d5['attributes']=_0x5572d5[_0xb7bd('0x34')]['length']?_0x5572d5['attributes']:_0x957611[_0xb7bd('0x30')];if(!_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x36')](_0xb7bd('0x37'))){_0x5572d5[_0xb7bd('0x38')]=qs[_0xb7bd('0x38')](_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x38')]);_0x5572d5[_0xb7bd('0x1b')]=qs[_0xb7bd('0x1b')](_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x1b')]);}_0x5572d5[_0xb7bd('0x39')]=qs[_0xb7bd('0x3a')](_0x1e8de4['query'][_0xb7bd('0x3a')]);_0x5572d5[_0xb7bd('0x3b')]=qs[_0xb7bd('0x3c')](_[_0xb7bd('0x3d')](_0x1e8de4[_0xb7bd('0x31')],_0x957611[_0xb7bd('0x3c')]),_0x2b568d);if(_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x3e')]){_0x5572d5[_0xb7bd('0x3b')]=_['merge'](_0x5572d5[_0xb7bd('0x3b')],{'$or':_[_0xb7bd('0x2b')](_0x2b568d,function(_0x36d432){if(_0x36d432[_0xb7bd('0x2e')]!==_0xb7bd('0x3f')){var _0x1564a8={};_0x1564a8[_0x36d432[_0xb7bd('0x29')]]={'$like':'%'+_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x3e')]+'%'};return _0x1564a8;}})});}_0x5572d5=_[_0xb7bd('0x40')]({},_0x5572d5,_0x1e8de4[_0xb7bd('0x41')]);var _0x49e33b={'where':_0x5572d5[_0xb7bd('0x3b')]};return db['Trigger'][_0xb7bd('0x1d')](_0x49e33b)[_0xb7bd('0x22')](function(_0x38ee02){_0x220e3b[_0xb7bd('0x1d')]=_0x38ee02;if(_0x1e8de4[_0xb7bd('0x31')][_0xb7bd('0x42')]){_0x5572d5[_0xb7bd('0x43')]=[{'all':!![]}];}return db[_0xb7bd('0x2c')][_0xb7bd('0x44')](_0x5572d5);})[_0xb7bd('0x22')](function(_0x3799ef){_0x220e3b['rows']=_0x3799ef;return _0x220e3b;})['then'](respondWithFilteredResult(_0x4b07a0,_0x5572d5))[_0xb7bd('0x45')](handleError(_0x4b07a0,null));};exports[_0xb7bd('0x46')]=function(_0x63ca80,_0x35faaa){var _0x1eeacb={'raw':![],'where':{'id':_0x63ca80['params']['id']}},_0x219528={};_0x219528[_0xb7bd('0x30')]=_[_0xb7bd('0x32')](db[_0xb7bd('0x2c')]['rawAttributes']);_0x219528[_0xb7bd('0x31')]=_[_0xb7bd('0x32')](_0x63ca80['query']);_0x219528[_0xb7bd('0x3c')]=_[_0xb7bd('0x33')](_0x219528[_0xb7bd('0x30')],_0x219528[_0xb7bd('0x31')]);_0x1eeacb[_0xb7bd('0x34')]=_[_0xb7bd('0x33')](_0x219528[_0xb7bd('0x30')],qs['fields'](_0x63ca80[_0xb7bd('0x31')][_0xb7bd('0x35')]));_0x1eeacb[_0xb7bd('0x34')]=_0x1eeacb[_0xb7bd('0x34')][_0xb7bd('0x47')]?_0x1eeacb[_0xb7bd('0x34')]:_0x219528['model'];if(_0x63ca80['query'][_0xb7bd('0x42')]){_0x1eeacb[_0xb7bd('0x43')]=[{'all':!![]}];}_0x1eeacb=_[_0xb7bd('0x40')]({},_0x1eeacb,_0x63ca80[_0xb7bd('0x41')]);return db[_0xb7bd('0x2c')][_0xb7bd('0x48')](_0x1eeacb)[_0xb7bd('0x22')](handleEntityNotFound(_0x35faaa,null))['then'](respondWithResult(_0x35faaa,null))[_0xb7bd('0x45')](handleError(_0x35faaa,null));};exports[_0xb7bd('0x49')]=function(_0x5843b8,_0x38b0fe){return db[_0xb7bd('0x2c')][_0xb7bd('0x49')](_0x5843b8[_0xb7bd('0x4a')],{})[_0xb7bd('0x22')](function(_0x25a7e5){var _0x1e414d=_0x5843b8['user'][_0xb7bd('0x23')]({'plain':!![]});if(!_0x1e414d)throw new Error(_0xb7bd('0x4b'));if(_0x1e414d[_0xb7bd('0x4c')]==='user'){var _0x5d16c1=_0x25a7e5[_0xb7bd('0x23')]({'plain':!![]});var _0x481941=_0xb7bd('0x4d');return db[_0xb7bd('0x4e')][_0xb7bd('0x48')]({'where':{'name':_0x481941,'userProfileId':_0x1e414d[_0xb7bd('0x4f')]},'raw':!![]})[_0xb7bd('0x22')](function(_0x3ba996){if(_0x3ba996&&_0x3ba996[_0xb7bd('0x50')]===0x0){return db[_0xb7bd('0x24')]['create']({'name':_0x5d16c1['name'],'resourceId':_0x5d16c1['id'],'type':_0x3ba996[_0xb7bd('0x29')],'sectionId':_0x3ba996['id']},{})[_0xb7bd('0x22')](function(){return _0x25a7e5;});}else{return _0x25a7e5;}})[_0xb7bd('0x45')](function(_0x7efbb3){logger[_0xb7bd('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7efbb3);throw _0x7efbb3;});}return _0x25a7e5;})[_0xb7bd('0x22')](respondWithResult(_0x38b0fe,0xc9))[_0xb7bd('0x45')](handleError(_0x38b0fe,null));};exports['update']=function(_0x302fba,_0x458428){if(_0x302fba[_0xb7bd('0x4a')]['id']){delete _0x302fba[_0xb7bd('0x4a')]['id'];}return db[_0xb7bd('0x2c')][_0xb7bd('0x48')]({'where':{'id':_0x302fba[_0xb7bd('0x51')]['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x458428,null))['then'](saveUpdates(_0x302fba['body'],null))[_0xb7bd('0x22')](respondWithResult(_0x458428,null))['catch'](handleError(_0x458428,null));};exports[_0xb7bd('0x21')]=function(_0x119707,_0x3641bf){return db['Trigger']['find']({'where':{'id':_0x119707[_0xb7bd('0x51')]['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x3641bf,null))[_0xb7bd('0x22')](removeEntity(_0x3641bf,null))['catch'](handleError(_0x3641bf,null));};exports['addAllCondition']=function(_0x587501,_0x36b73c,_0x1e9b41){if(_0x587501['body']['id']){delete _0x587501['body']['id'];}return db[_0xb7bd('0x2c')][_0xb7bd('0x48')]({'where':{'id':_0x587501['params']['id']}})['then'](handleEntityNotFound(_0x36b73c,null))[_0xb7bd('0x22')](function(_0x1a6fec){if(_0x1a6fec){_0x587501[_0xb7bd('0x4a')][_0xb7bd('0x52')]=_0x1a6fec['id'];return db[_0xb7bd('0x53')][_0xb7bd('0x49')](_0x587501[_0xb7bd('0x4a')]);}})[_0xb7bd('0x22')](respondWithResult(_0x36b73c,null))['catch'](handleError(_0x36b73c,null));};exports[_0xb7bd('0x54')]=function(_0xe4d3e3,_0x2cdddd,_0x2963b2){if(_0xe4d3e3['body']['id']){delete _0xe4d3e3[_0xb7bd('0x4a')]['id'];}return db[_0xb7bd('0x2c')][_0xb7bd('0x48')]({'where':{'id':_0xe4d3e3['params']['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x2cdddd,null))[_0xb7bd('0x22')](function(_0x351b11){if(_0x351b11){_0xe4d3e3[_0xb7bd('0x4a')]['TriggerAnyId']=_0x351b11['id'];return db[_0xb7bd('0x53')][_0xb7bd('0x49')](_0xe4d3e3[_0xb7bd('0x4a')]);}})['then'](respondWithResult(_0x2cdddd,null))[_0xb7bd('0x45')](handleError(_0x2cdddd,null));};exports[_0xb7bd('0x55')]=function(_0x108e65,_0x198137,_0x1dff09){var _0x37c309={};var _0x205b5e={};var _0xd9baa7;var _0x43546f;return db[_0xb7bd('0x2c')][_0xb7bd('0x56')]({'where':{'id':_0x108e65[_0xb7bd('0x51')]['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x198137,null))[_0xb7bd('0x22')](function(_0x522cf7){if(_0x522cf7){_0xd9baa7=_0x522cf7;_0x205b5e[_0xb7bd('0x30')]=_[_0xb7bd('0x32')](db[_0xb7bd('0x53')]['rawAttributes']);_0x205b5e[_0xb7bd('0x31')]=_[_0xb7bd('0x32')](_0x108e65['query']);_0x205b5e[_0xb7bd('0x3c')]=_[_0xb7bd('0x33')](_0x205b5e[_0xb7bd('0x30')],_0x205b5e[_0xb7bd('0x31')]);_0x37c309[_0xb7bd('0x34')]=_[_0xb7bd('0x33')](_0x205b5e['model'],qs[_0xb7bd('0x35')](_0x108e65['query']['fields']));_0x37c309[_0xb7bd('0x34')]=_0x37c309[_0xb7bd('0x34')][_0xb7bd('0x47')]?_0x37c309[_0xb7bd('0x34')]:_0x205b5e[_0xb7bd('0x30')];_0x37c309['order']=qs[_0xb7bd('0x3a')](_0x108e65[_0xb7bd('0x31')][_0xb7bd('0x3a')]);_0x37c309[_0xb7bd('0x3b')]=qs['filters'](_[_0xb7bd('0x3d')](_0x108e65[_0xb7bd('0x31')],_0x205b5e[_0xb7bd('0x3c')]));if(_0x108e65[_0xb7bd('0x31')][_0xb7bd('0x3e')]){_0x37c309[_0xb7bd('0x3b')]=_[_0xb7bd('0x40')](_0x37c309[_0xb7bd('0x3b')],{'$or':_[_0xb7bd('0x2b')](_0x37c309[_0xb7bd('0x34')],function(_0xe249bc){var _0x2f27d6={};_0x2f27d6[_0xe249bc]={'$like':'%'+_0x108e65[_0xb7bd('0x31')]['filter']+'%'};return _0x2f27d6;})});}_0x37c309=_[_0xb7bd('0x40')]({},_0x37c309,_0x108e65[_0xb7bd('0x41')]);return _0xd9baa7[_0xb7bd('0x55')](_0x37c309);}})[_0xb7bd('0x22')](function(_0x2dd3ca){if(_0x2dd3ca){_0x43546f=_0x2dd3ca[_0xb7bd('0x47')];if(!_0x108e65[_0xb7bd('0x31')][_0xb7bd('0x36')]('nolimit')){_0x37c309[_0xb7bd('0x38')]=qs['limit'](_0x108e65['query'][_0xb7bd('0x38')]);_0x37c309['offset']=qs[_0xb7bd('0x1b')](_0x108e65[_0xb7bd('0x31')][_0xb7bd('0x1b')]);}return _0xd9baa7[_0xb7bd('0x55')](_0x37c309);}})[_0xb7bd('0x22')](function(_0x2002bb){if(_0x2002bb){return _0x2002bb?{'count':_0x43546f,'rows':_0x2002bb}:null;}})[_0xb7bd('0x22')](respondWithResult(_0x198137,null))[_0xb7bd('0x45')](handleError(_0x198137,null));};exports[_0xb7bd('0x57')]=function(_0x2b9bcb,_0xa2eb77,_0xff3ccf){var _0x102b69={};var _0x452245={};var _0x576c9e;var _0x2c50a3;return db['Trigger'][_0xb7bd('0x56')]({'where':{'id':_0x2b9bcb[_0xb7bd('0x51')]['id']}})['then'](handleEntityNotFound(_0xa2eb77,null))[_0xb7bd('0x22')](function(_0x2971c8){if(_0x2971c8){_0x576c9e=_0x2971c8;_0x452245[_0xb7bd('0x30')]=_[_0xb7bd('0x32')](db['Condition']['rawAttributes']);_0x452245['query']=_['keys'](_0x2b9bcb['query']);_0x452245['filters']=_[_0xb7bd('0x33')](_0x452245[_0xb7bd('0x30')],_0x452245['query']);_0x102b69[_0xb7bd('0x34')]=_[_0xb7bd('0x33')](_0x452245[_0xb7bd('0x30')],qs[_0xb7bd('0x35')](_0x2b9bcb[_0xb7bd('0x31')][_0xb7bd('0x35')]));_0x102b69[_0xb7bd('0x34')]=_0x102b69[_0xb7bd('0x34')][_0xb7bd('0x47')]?_0x102b69[_0xb7bd('0x34')]:_0x452245['model'];_0x102b69[_0xb7bd('0x39')]=qs[_0xb7bd('0x3a')](_0x2b9bcb[_0xb7bd('0x31')][_0xb7bd('0x3a')]);_0x102b69[_0xb7bd('0x3b')]=qs[_0xb7bd('0x3c')](_['pick'](_0x2b9bcb[_0xb7bd('0x31')],_0x452245[_0xb7bd('0x3c')]));if(_0x2b9bcb['query'][_0xb7bd('0x3e')]){_0x102b69['where']=_[_0xb7bd('0x40')](_0x102b69['where'],{'$or':_['map'](_0x102b69[_0xb7bd('0x34')],function(_0x3bb9fa){var _0x1ce632={};_0x1ce632[_0x3bb9fa]={'$like':'%'+_0x2b9bcb[_0xb7bd('0x31')][_0xb7bd('0x3e')]+'%'};return _0x1ce632;})});}_0x102b69=_['merge']({},_0x102b69,_0x2b9bcb[_0xb7bd('0x41')]);return _0x576c9e['getAnyConditions'](_0x102b69);}})[_0xb7bd('0x22')](function(_0x477637){if(_0x477637){_0x2c50a3=_0x477637['length'];if(!_0x2b9bcb[_0xb7bd('0x31')][_0xb7bd('0x36')](_0xb7bd('0x37'))){_0x102b69[_0xb7bd('0x38')]=qs[_0xb7bd('0x38')](_0x2b9bcb['query']['limit']);_0x102b69[_0xb7bd('0x1b')]=qs[_0xb7bd('0x1b')](_0x2b9bcb[_0xb7bd('0x31')][_0xb7bd('0x1b')]);}return _0x576c9e[_0xb7bd('0x57')](_0x102b69);}})[_0xb7bd('0x22')](function(_0x2c141d){if(_0x2c141d){return _0x2c141d?{'count':_0x2c50a3,'rows':_0x2c141d}:null;}})[_0xb7bd('0x22')](respondWithResult(_0xa2eb77,null))['catch'](handleError(_0xa2eb77,null));};exports[_0xb7bd('0x58')]=function(_0x3ecd7c,_0x4dbb93,_0x42933b){if(_0x3ecd7c['body']['id']){delete _0x3ecd7c[_0xb7bd('0x4a')]['id'];}return db[_0xb7bd('0x2c')]['find']({'where':{'id':_0x3ecd7c[_0xb7bd('0x51')]['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x4dbb93,null))[_0xb7bd('0x22')](function(_0x3a3fe8){if(_0x3a3fe8){_0x3ecd7c['body']['TriggerId']=_0x3a3fe8['id'];return db[_0xb7bd('0x59')][_0xb7bd('0x49')](_0x3ecd7c[_0xb7bd('0x4a')]);}})[_0xb7bd('0x22')](respondWithResult(_0x4dbb93,null))[_0xb7bd('0x45')](handleError(_0x4dbb93,null));};exports['getActions']=function(_0x2d105c,_0x2047ab,_0x35ad47){var _0x507c32={};var _0x271eb9={};var _0x259085;var _0x205551;return db[_0xb7bd('0x2c')]['findOne']({'where':{'id':_0x2d105c[_0xb7bd('0x51')]['id']}})[_0xb7bd('0x22')](handleEntityNotFound(_0x2047ab,null))[_0xb7bd('0x22')](function(_0x4bc923){if(_0x4bc923){_0x259085=_0x4bc923;_0x271eb9[_0xb7bd('0x30')]=_[_0xb7bd('0x32')](db[_0xb7bd('0x59')][_0xb7bd('0x5a')]);_0x271eb9[_0xb7bd('0x31')]=_[_0xb7bd('0x32')](_0x2d105c['query']);_0x271eb9[_0xb7bd('0x3c')]=_[_0xb7bd('0x33')](_0x271eb9[_0xb7bd('0x30')],_0x271eb9['query']);_0x507c32[_0xb7bd('0x34')]=_[_0xb7bd('0x33')](_0x271eb9[_0xb7bd('0x30')],qs[_0xb7bd('0x35')](_0x2d105c[_0xb7bd('0x31')][_0xb7bd('0x35')]));_0x507c32[_0xb7bd('0x34')]=_0x507c32[_0xb7bd('0x34')][_0xb7bd('0x47')]?_0x507c32[_0xb7bd('0x34')]:_0x271eb9[_0xb7bd('0x30')];_0x507c32[_0xb7bd('0x39')]=qs[_0xb7bd('0x3a')](_0x2d105c['query'][_0xb7bd('0x3a')]);_0x507c32[_0xb7bd('0x3b')]=qs[_0xb7bd('0x3c')](_['pick'](_0x2d105c['query'],_0x271eb9['filters']));if(_0x2d105c[_0xb7bd('0x31')]['filter']){_0x507c32[_0xb7bd('0x3b')]=_[_0xb7bd('0x40')](_0x507c32['where'],{'$or':_[_0xb7bd('0x2b')](_0x507c32[_0xb7bd('0x34')],function(_0x3ed05e){var _0x49f0c6={};_0x49f0c6[_0x3ed05e]={'$like':'%'+_0x2d105c[_0xb7bd('0x31')][_0xb7bd('0x3e')]+'%'};return _0x49f0c6;})});}_0x507c32=_[_0xb7bd('0x40')]({},_0x507c32,_0x2d105c['options']);return _0x259085[_0xb7bd('0x5b')](_0x507c32);}})[_0xb7bd('0x22')](function(_0x494c77){if(_0x494c77){_0x205551=_0x494c77[_0xb7bd('0x47')];if(!_0x2d105c[_0xb7bd('0x31')][_0xb7bd('0x36')](_0xb7bd('0x37'))){_0x507c32[_0xb7bd('0x38')]=qs[_0xb7bd('0x38')](_0x2d105c[_0xb7bd('0x31')][_0xb7bd('0x38')]);_0x507c32['offset']=qs['offset'](_0x2d105c[_0xb7bd('0x31')][_0xb7bd('0x1b')]);}return _0x259085['getActions'](_0x507c32);}})[_0xb7bd('0x22')](function(_0x5f53c4){if(_0x5f53c4){return _0x5f53c4?{'count':_0x205551,'rows':_0x5f53c4}:null;}})['then'](respondWithResult(_0x2047ab,null))['catch'](handleError(_0x2047ab,null));}; \ No newline at end of file +var _0xf974=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','length','order','filter','getAllConditions','getAnyConditions','Condition','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','Trigger','include','rows','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x2739de,_0x500c97){var _0x48ee27=function(_0x4fdf01){while(--_0x4fdf01){_0x2739de['push'](_0x2739de['shift']());}};_0x48ee27(++_0x500c97);}(_0xf974,0x18d));var _0x4f97=function(_0x5b8a79,_0x259346){_0x5b8a79=_0x5b8a79-0x0;var _0x4c27af=_0xf974[_0x5b8a79];return _0x4c27af;};'use strict';var emlformat=require(_0x4f97('0x0'));var rimraf=require(_0x4f97('0x1'));var zipdir=require(_0x4f97('0x2'));var jsonpatch=require(_0x4f97('0x3'));var rp=require('request-promise');var moment=require(_0x4f97('0x4'));var BPromise=require(_0x4f97('0x5'));var Mustache=require('mustache');var util=require(_0x4f97('0x6'));var path=require(_0x4f97('0x7'));var sox=require(_0x4f97('0x8'));var csv=require(_0x4f97('0x9'));var ejs=require(_0x4f97('0xa'));var fs=require('fs');var fs_extra=require(_0x4f97('0xb'));var _=require('lodash');var squel=require(_0x4f97('0xc'));var crypto=require(_0x4f97('0xd'));var jsforce=require(_0x4f97('0xe'));var deskjs=require(_0x4f97('0xf'));var toCsv=require(_0x4f97('0x9'));var querystring=require(_0x4f97('0x10'));var Papa=require(_0x4f97('0x11'));var Redis=require(_0x4f97('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4f97('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f97('0x14'));var logger=require(_0x4f97('0x15'))(_0x4f97('0x16'));var utils=require(_0x4f97('0x17'));var config=require(_0x4f97('0x18'));var licenseUtil=require(_0x4f97('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d1d51,_0x284353){_0x284353=_0x284353||0xcc;return function(_0x14e024){if(_0x14e024){return _0x2d1d51[_0x4f97('0x1a')](_0x284353);}return _0x2d1d51[_0x4f97('0x1b')](_0x284353)[_0x4f97('0x1c')]();};}function respondWithResult(_0x45a78d,_0xa0d731){_0xa0d731=_0xa0d731||0xc8;return function(_0x3de979){if(_0x3de979){return _0x45a78d[_0x4f97('0x1b')](_0xa0d731)[_0x4f97('0x1d')](_0x3de979);}};}function respondWithFilteredResult(_0x473f0f,_0x25400e){return function(_0x216204){if(_0x216204){var _0x3750e3=typeof _0x25400e['offset']===_0x4f97('0x1e')&&typeof _0x25400e[_0x4f97('0x1f')]===_0x4f97('0x1e');var _0x3253c1=_0x216204[_0x4f97('0x20')];var _0x5e3ed6=_0x3750e3?0x0:_0x25400e['offset'];var _0xc9699f=_0x3750e3?_0x216204[_0x4f97('0x20')]:_0x25400e[_0x4f97('0x21')]+_0x25400e[_0x4f97('0x1f')];var _0x508045;if(_0xc9699f>=_0x3253c1){_0xc9699f=_0x3253c1;_0x508045=0xc8;}else{_0x508045=0xce;}_0x473f0f[_0x4f97('0x1b')](_0x508045);return _0x473f0f[_0x4f97('0x22')](_0x4f97('0x23'),_0x5e3ed6+'-'+_0xc9699f+'/'+_0x3253c1)[_0x4f97('0x1d')](_0x216204);}return null;};}function patchUpdates(_0x43a64d){return function(_0x30c16c){try{jsonpatch[_0x4f97('0x24')](_0x30c16c,_0x43a64d,!![]);}catch(_0x14e578){return BPromise['reject'](_0x14e578);}return _0x30c16c[_0x4f97('0x25')]();};}function saveUpdates(_0x1c0bed,_0x3f5afc){return function(_0x508597){if(_0x508597){return _0x508597[_0x4f97('0x26')](_0x1c0bed)[_0x4f97('0x27')](function(_0x595935){return _0x595935;});}return null;};}function removeEntity(_0xb13490,_0x123628){return function(_0x187f04){if(_0x187f04){return _0x187f04[_0x4f97('0x28')]()[_0x4f97('0x27')](function(){var _0x2ef133=_0x187f04[_0x4f97('0x29')]({'plain':!![]});var _0x3751ef=_0x4f97('0x2a');return db[_0x4f97('0x2b')][_0x4f97('0x28')]({'where':{'type':_0x3751ef,'resourceId':_0x2ef133['id']}})[_0x4f97('0x27')](function(){return _0x187f04;});})[_0x4f97('0x27')](function(){_0xb13490[_0x4f97('0x1b')](0xcc)[_0x4f97('0x1c')]();});}};}function handleEntityNotFound(_0x3e9eb1,_0x3259cd){return function(_0x57ebf0){if(!_0x57ebf0){_0x3e9eb1['sendStatus'](0x194);}return _0x57ebf0;};}function handleError(_0x165621,_0x224266){_0x224266=_0x224266||0x1f4;return function(_0x43f34e){logger[_0x4f97('0x2c')](_0x43f34e[_0x4f97('0x2d')]);if(_0x43f34e[_0x4f97('0x2e')]){delete _0x43f34e['name'];}_0x165621[_0x4f97('0x1b')](_0x224266)[_0x4f97('0x2f')](_0x43f34e);};}exports[_0x4f97('0x30')]=function(_0x4b41ca,_0x3a65e2){var _0x31a730={},_0x40372c={},_0x8f59c9={'count':0x0,'rows':[]};var _0x10f071=_[_0x4f97('0x31')](db['Trigger'][_0x4f97('0x32')],function(_0x2478c1){return{'name':_0x2478c1[_0x4f97('0x33')],'type':_0x2478c1[_0x4f97('0x34')]['key']};});_0x40372c[_0x4f97('0x35')]=_[_0x4f97('0x31')](_0x10f071,'name');_0x40372c[_0x4f97('0x36')]=_[_0x4f97('0x37')](_0x4b41ca[_0x4f97('0x36')]);_0x40372c[_0x4f97('0x38')]=_[_0x4f97('0x39')](_0x40372c[_0x4f97('0x35')],_0x40372c[_0x4f97('0x36')]);_0x31a730[_0x4f97('0x3a')]=_[_0x4f97('0x39')](_0x40372c[_0x4f97('0x35')],qs[_0x4f97('0x3b')](_0x4b41ca[_0x4f97('0x36')][_0x4f97('0x3b')]));_0x31a730['attributes']=_0x31a730[_0x4f97('0x3a')]['length']?_0x31a730[_0x4f97('0x3a')]:_0x40372c[_0x4f97('0x35')];if(!_0x4b41ca[_0x4f97('0x36')][_0x4f97('0x3c')](_0x4f97('0x3d'))){_0x31a730['limit']=qs['limit'](_0x4b41ca[_0x4f97('0x36')][_0x4f97('0x1f')]);_0x31a730[_0x4f97('0x21')]=qs['offset'](_0x4b41ca[_0x4f97('0x36')]['offset']);}_0x31a730['order']=qs['sort'](_0x4b41ca[_0x4f97('0x36')][_0x4f97('0x3e')]);_0x31a730[_0x4f97('0x3f')]=qs['filters'](_[_0x4f97('0x40')](_0x4b41ca[_0x4f97('0x36')],_0x40372c['filters']),_0x10f071);if(_0x4b41ca['query']['filter']){_0x31a730['where']=_[_0x4f97('0x41')](_0x31a730[_0x4f97('0x3f')],{'$or':_[_0x4f97('0x31')](_0x10f071,function(_0x5d27dd){if(_0x5d27dd[_0x4f97('0x34')]!==_0x4f97('0x42')){var _0x444bdc={};_0x444bdc[_0x5d27dd[_0x4f97('0x2e')]]={'$like':'%'+_0x4b41ca[_0x4f97('0x36')]['filter']+'%'};return _0x444bdc;}})});}_0x31a730=_[_0x4f97('0x41')]({},_0x31a730,_0x4b41ca[_0x4f97('0x43')]);var _0x383b32={'where':_0x31a730[_0x4f97('0x3f')]};return db[_0x4f97('0x44')][_0x4f97('0x20')](_0x383b32)[_0x4f97('0x27')](function(_0x6a35a9){_0x8f59c9[_0x4f97('0x20')]=_0x6a35a9;if(_0x4b41ca[_0x4f97('0x36')]['includeAll']){_0x31a730[_0x4f97('0x45')]=[{'all':!![]}];}return db[_0x4f97('0x44')]['findAll'](_0x31a730);})[_0x4f97('0x27')](function(_0x1b812a){_0x8f59c9[_0x4f97('0x46')]=_0x1b812a;return _0x8f59c9;})[_0x4f97('0x27')](respondWithFilteredResult(_0x3a65e2,_0x31a730))['catch'](handleError(_0x3a65e2,null));};exports['show']=function(_0x4334b0,_0x53d4cf){var _0x49d781={'raw':![],'where':{'id':_0x4334b0['params']['id']}},_0xc31b8={};_0xc31b8[_0x4f97('0x35')]=_[_0x4f97('0x37')](db['Trigger'][_0x4f97('0x32')]);_0xc31b8['query']=_[_0x4f97('0x37')](_0x4334b0[_0x4f97('0x36')]);_0xc31b8['filters']=_[_0x4f97('0x39')](_0xc31b8[_0x4f97('0x35')],_0xc31b8[_0x4f97('0x36')]);_0x49d781[_0x4f97('0x3a')]=_[_0x4f97('0x39')](_0xc31b8[_0x4f97('0x35')],qs['fields'](_0x4334b0[_0x4f97('0x36')]['fields']));_0x49d781['attributes']=_0x49d781[_0x4f97('0x3a')]['length']?_0x49d781[_0x4f97('0x3a')]:_0xc31b8[_0x4f97('0x35')];if(_0x4334b0['query'][_0x4f97('0x47')]){_0x49d781['include']=[{'all':!![]}];}_0x49d781=_[_0x4f97('0x41')]({},_0x49d781,_0x4334b0[_0x4f97('0x43')]);return db[_0x4f97('0x44')]['find'](_0x49d781)[_0x4f97('0x27')](handleEntityNotFound(_0x53d4cf,null))[_0x4f97('0x27')](respondWithResult(_0x53d4cf,null))[_0x4f97('0x48')](handleError(_0x53d4cf,null));};exports[_0x4f97('0x49')]=function(_0x3f0366,_0x2f2c67){return db['Trigger']['create'](_0x3f0366[_0x4f97('0x4a')],{})[_0x4f97('0x27')](function(_0x31d168){var _0x1ac82c=_0x3f0366['user'][_0x4f97('0x29')]({'plain':!![]});if(!_0x1ac82c)throw new Error(_0x4f97('0x4b'));if(_0x1ac82c[_0x4f97('0x4c')]==='user'){var _0x1467e7=_0x31d168['get']({'plain':!![]});var _0x224e3d='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x224e3d,'userProfileId':_0x1ac82c[_0x4f97('0x4d')]},'raw':!![]})[_0x4f97('0x27')](function(_0x16e129){if(_0x16e129&&_0x16e129[_0x4f97('0x4e')]===0x0){return db[_0x4f97('0x2b')][_0x4f97('0x49')]({'name':_0x1467e7['name'],'resourceId':_0x1467e7['id'],'type':_0x16e129['name'],'sectionId':_0x16e129['id']},{})[_0x4f97('0x27')](function(){return _0x31d168;});}else{return _0x31d168;}})[_0x4f97('0x48')](function(_0x1f072a){logger['error'](_0x4f97('0x4f'),_0x1f072a);throw _0x1f072a;});}return _0x31d168;})['then'](respondWithResult(_0x2f2c67,0xc9))[_0x4f97('0x48')](handleError(_0x2f2c67,null));};exports['update']=function(_0x15e818,_0x3a90b0){if(_0x15e818[_0x4f97('0x4a')]['id']){delete _0x15e818['body']['id'];}return db[_0x4f97('0x44')][_0x4f97('0x50')]({'where':{'id':_0x15e818[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x3a90b0,null))[_0x4f97('0x27')](saveUpdates(_0x15e818[_0x4f97('0x4a')],null))[_0x4f97('0x27')](respondWithResult(_0x3a90b0,null))[_0x4f97('0x48')](handleError(_0x3a90b0,null));};exports[_0x4f97('0x28')]=function(_0x18fcad,_0x1e0c66){return db['Trigger'][_0x4f97('0x50')]({'where':{'id':_0x18fcad[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x1e0c66,null))[_0x4f97('0x27')](removeEntity(_0x1e0c66,null))[_0x4f97('0x48')](handleError(_0x1e0c66,null));};exports[_0x4f97('0x52')]=function(_0x436ce3,_0x2b73d6,_0x4abe45){if(_0x436ce3['body']['id']){delete _0x436ce3[_0x4f97('0x4a')]['id'];}return db[_0x4f97('0x44')][_0x4f97('0x50')]({'where':{'id':_0x436ce3[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x2b73d6,null))[_0x4f97('0x27')](function(_0xcd8a93){if(_0xcd8a93){_0x436ce3[_0x4f97('0x4a')][_0x4f97('0x53')]=_0xcd8a93['id'];return db['Condition'][_0x4f97('0x49')](_0x436ce3['body']);}})['then'](respondWithResult(_0x2b73d6,null))[_0x4f97('0x48')](handleError(_0x2b73d6,null));};exports[_0x4f97('0x54')]=function(_0x492e45,_0x2853c6,_0x12f604){if(_0x492e45[_0x4f97('0x4a')]['id']){delete _0x492e45[_0x4f97('0x4a')]['id'];}return db[_0x4f97('0x44')][_0x4f97('0x50')]({'where':{'id':_0x492e45['params']['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x2853c6,null))[_0x4f97('0x27')](function(_0x2cbd7f){if(_0x2cbd7f){_0x492e45['body'][_0x4f97('0x55')]=_0x2cbd7f['id'];return db['Condition'][_0x4f97('0x49')](_0x492e45[_0x4f97('0x4a')]);}})['then'](respondWithResult(_0x2853c6,null))['catch'](handleError(_0x2853c6,null));};exports['getAllConditions']=function(_0x548d1b,_0x15d262,_0x31d5bb){var _0x27d884={};var _0x4c2243={};var _0x276d4f;var _0x265d0d;return db[_0x4f97('0x44')][_0x4f97('0x56')]({'where':{'id':_0x548d1b[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x15d262,null))[_0x4f97('0x27')](function(_0x484eb6){if(_0x484eb6){_0x276d4f=_0x484eb6;_0x4c2243[_0x4f97('0x35')]=_[_0x4f97('0x37')](db['Condition'][_0x4f97('0x32')]);_0x4c2243['query']=_[_0x4f97('0x37')](_0x548d1b[_0x4f97('0x36')]);_0x4c2243[_0x4f97('0x38')]=_[_0x4f97('0x39')](_0x4c2243[_0x4f97('0x35')],_0x4c2243[_0x4f97('0x36')]);_0x27d884[_0x4f97('0x3a')]=_[_0x4f97('0x39')](_0x4c2243[_0x4f97('0x35')],qs[_0x4f97('0x3b')](_0x548d1b[_0x4f97('0x36')][_0x4f97('0x3b')]));_0x27d884[_0x4f97('0x3a')]=_0x27d884[_0x4f97('0x3a')][_0x4f97('0x57')]?_0x27d884[_0x4f97('0x3a')]:_0x4c2243[_0x4f97('0x35')];_0x27d884[_0x4f97('0x58')]=qs[_0x4f97('0x3e')](_0x548d1b[_0x4f97('0x36')][_0x4f97('0x3e')]);_0x27d884['where']=qs['filters'](_[_0x4f97('0x40')](_0x548d1b[_0x4f97('0x36')],_0x4c2243['filters']));if(_0x548d1b[_0x4f97('0x36')][_0x4f97('0x59')]){_0x27d884[_0x4f97('0x3f')]=_[_0x4f97('0x41')](_0x27d884[_0x4f97('0x3f')],{'$or':_[_0x4f97('0x31')](_0x27d884[_0x4f97('0x3a')],function(_0x45ff4d){var _0x45f738={};_0x45f738[_0x45ff4d]={'$like':'%'+_0x548d1b['query'][_0x4f97('0x59')]+'%'};return _0x45f738;})});}_0x27d884=_[_0x4f97('0x41')]({},_0x27d884,_0x548d1b['options']);return _0x276d4f[_0x4f97('0x5a')](_0x27d884);}})[_0x4f97('0x27')](function(_0x7cf213){if(_0x7cf213){_0x265d0d=_0x7cf213[_0x4f97('0x57')];if(!_0x548d1b[_0x4f97('0x36')][_0x4f97('0x3c')](_0x4f97('0x3d'))){_0x27d884['limit']=qs[_0x4f97('0x1f')](_0x548d1b[_0x4f97('0x36')][_0x4f97('0x1f')]);_0x27d884['offset']=qs[_0x4f97('0x21')](_0x548d1b[_0x4f97('0x36')][_0x4f97('0x21')]);}return _0x276d4f[_0x4f97('0x5a')](_0x27d884);}})[_0x4f97('0x27')](function(_0x508099){if(_0x508099){return _0x508099?{'count':_0x265d0d,'rows':_0x508099}:null;}})['then'](respondWithResult(_0x15d262,null))[_0x4f97('0x48')](handleError(_0x15d262,null));};exports[_0x4f97('0x5b')]=function(_0xada38a,_0x552195,_0x42c7e6){var _0x1957b7={};var _0x58e0b3={};var _0x1f7f4b;var _0x2327c6;return db['Trigger'][_0x4f97('0x56')]({'where':{'id':_0xada38a[_0x4f97('0x51')]['id']}})['then'](handleEntityNotFound(_0x552195,null))[_0x4f97('0x27')](function(_0x132dde){if(_0x132dde){_0x1f7f4b=_0x132dde;_0x58e0b3[_0x4f97('0x35')]=_['keys'](db[_0x4f97('0x5c')][_0x4f97('0x32')]);_0x58e0b3[_0x4f97('0x36')]=_[_0x4f97('0x37')](_0xada38a[_0x4f97('0x36')]);_0x58e0b3['filters']=_[_0x4f97('0x39')](_0x58e0b3[_0x4f97('0x35')],_0x58e0b3[_0x4f97('0x36')]);_0x1957b7[_0x4f97('0x3a')]=_[_0x4f97('0x39')](_0x58e0b3[_0x4f97('0x35')],qs['fields'](_0xada38a[_0x4f97('0x36')][_0x4f97('0x3b')]));_0x1957b7[_0x4f97('0x3a')]=_0x1957b7[_0x4f97('0x3a')][_0x4f97('0x57')]?_0x1957b7[_0x4f97('0x3a')]:_0x58e0b3[_0x4f97('0x35')];_0x1957b7[_0x4f97('0x58')]=qs[_0x4f97('0x3e')](_0xada38a[_0x4f97('0x36')][_0x4f97('0x3e')]);_0x1957b7[_0x4f97('0x3f')]=qs[_0x4f97('0x38')](_[_0x4f97('0x40')](_0xada38a['query'],_0x58e0b3[_0x4f97('0x38')]));if(_0xada38a[_0x4f97('0x36')][_0x4f97('0x59')]){_0x1957b7['where']=_[_0x4f97('0x41')](_0x1957b7[_0x4f97('0x3f')],{'$or':_['map'](_0x1957b7[_0x4f97('0x3a')],function(_0x57edf6){var _0x5b8e54={};_0x5b8e54[_0x57edf6]={'$like':'%'+_0xada38a[_0x4f97('0x36')][_0x4f97('0x59')]+'%'};return _0x5b8e54;})});}_0x1957b7=_['merge']({},_0x1957b7,_0xada38a[_0x4f97('0x43')]);return _0x1f7f4b[_0x4f97('0x5b')](_0x1957b7);}})['then'](function(_0x241f0c){if(_0x241f0c){_0x2327c6=_0x241f0c[_0x4f97('0x57')];if(!_0xada38a[_0x4f97('0x36')][_0x4f97('0x3c')](_0x4f97('0x3d'))){_0x1957b7['limit']=qs[_0x4f97('0x1f')](_0xada38a['query'][_0x4f97('0x1f')]);_0x1957b7[_0x4f97('0x21')]=qs['offset'](_0xada38a['query'][_0x4f97('0x21')]);}return _0x1f7f4b['getAnyConditions'](_0x1957b7);}})[_0x4f97('0x27')](function(_0x5c3b21){if(_0x5c3b21){return _0x5c3b21?{'count':_0x2327c6,'rows':_0x5c3b21}:null;}})[_0x4f97('0x27')](respondWithResult(_0x552195,null))[_0x4f97('0x48')](handleError(_0x552195,null));};exports['addAction']=function(_0x2dc100,_0x59a4a3,_0x504f70){if(_0x2dc100['body']['id']){delete _0x2dc100[_0x4f97('0x4a')]['id'];}return db[_0x4f97('0x44')]['find']({'where':{'id':_0x2dc100[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0x59a4a3,null))[_0x4f97('0x27')](function(_0x240b6b){if(_0x240b6b){_0x2dc100[_0x4f97('0x4a')]['TriggerId']=_0x240b6b['id'];return db[_0x4f97('0x5d')][_0x4f97('0x49')](_0x2dc100[_0x4f97('0x4a')]);}})[_0x4f97('0x27')](respondWithResult(_0x59a4a3,null))[_0x4f97('0x48')](handleError(_0x59a4a3,null));};exports[_0x4f97('0x5e')]=function(_0x518df1,_0xde4b41,_0x23c76c){var _0x22b455={};var _0x415473={};var _0x5d113e;var _0xac5149;return db[_0x4f97('0x44')][_0x4f97('0x56')]({'where':{'id':_0x518df1[_0x4f97('0x51')]['id']}})[_0x4f97('0x27')](handleEntityNotFound(_0xde4b41,null))['then'](function(_0x22c236){if(_0x22c236){_0x5d113e=_0x22c236;_0x415473[_0x4f97('0x35')]=_['keys'](db[_0x4f97('0x5d')][_0x4f97('0x32')]);_0x415473['query']=_['keys'](_0x518df1[_0x4f97('0x36')]);_0x415473[_0x4f97('0x38')]=_[_0x4f97('0x39')](_0x415473[_0x4f97('0x35')],_0x415473[_0x4f97('0x36')]);_0x22b455['attributes']=_[_0x4f97('0x39')](_0x415473[_0x4f97('0x35')],qs[_0x4f97('0x3b')](_0x518df1[_0x4f97('0x36')][_0x4f97('0x3b')]));_0x22b455['attributes']=_0x22b455[_0x4f97('0x3a')]['length']?_0x22b455[_0x4f97('0x3a')]:_0x415473['model'];_0x22b455[_0x4f97('0x58')]=qs[_0x4f97('0x3e')](_0x518df1['query'][_0x4f97('0x3e')]);_0x22b455['where']=qs['filters'](_[_0x4f97('0x40')](_0x518df1[_0x4f97('0x36')],_0x415473[_0x4f97('0x38')]));if(_0x518df1[_0x4f97('0x36')][_0x4f97('0x59')]){_0x22b455[_0x4f97('0x3f')]=_[_0x4f97('0x41')](_0x22b455[_0x4f97('0x3f')],{'$or':_[_0x4f97('0x31')](_0x22b455[_0x4f97('0x3a')],function(_0x3a5652){var _0x5f3baf={};_0x5f3baf[_0x3a5652]={'$like':'%'+_0x518df1['query'][_0x4f97('0x59')]+'%'};return _0x5f3baf;})});}_0x22b455=_[_0x4f97('0x41')]({},_0x22b455,_0x518df1['options']);return _0x5d113e[_0x4f97('0x5e')](_0x22b455);}})['then'](function(_0x5e747e){if(_0x5e747e){_0xac5149=_0x5e747e[_0x4f97('0x57')];if(!_0x518df1[_0x4f97('0x36')][_0x4f97('0x3c')](_0x4f97('0x3d'))){_0x22b455['limit']=qs[_0x4f97('0x1f')](_0x518df1[_0x4f97('0x36')][_0x4f97('0x1f')]);_0x22b455[_0x4f97('0x21')]=qs[_0x4f97('0x21')](_0x518df1[_0x4f97('0x36')][_0x4f97('0x21')]);}return _0x5d113e[_0x4f97('0x5e')](_0x22b455);}})[_0x4f97('0x27')](function(_0xf71cb){if(_0xf71cb){return _0xf71cb?{'count':_0xac5149,'rows':_0xf71cb}:null;}})[_0x4f97('0x27')](respondWithResult(_0xde4b41,null))[_0x4f97('0x48')](handleError(_0xde4b41,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ee68017..a1f01cb 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 _0x207c=['api','moment','bluebird','request-promise','path','../../config/environment','define','Trigger','util','../../config/logger'];(function(_0x59a310,_0x2c36d2){var _0xd7a78=function(_0x2981c5){while(--_0x2981c5){_0x59a310['push'](_0x59a310['shift']());}};_0xd7a78(++_0x2c36d2);}(_0x207c,0x1e8));var _0xc207=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0x207c[_0x47a491];return _0x3b176b;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b1=['bluebird','request-promise','path','exports','define','Trigger','tools_triggers','../../config/logger','api','moment'];(function(_0x353fba,_0x46db7e){var _0x4694e4=function(_0x2c122a){while(--_0x2c122a){_0x353fba['push'](_0x353fba['shift']());}};_0x4694e4(++_0x46db7e);}(_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 diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b78649c..9d92224 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 _0xcfef=['rpc','../../config/environment','jayson/promise','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','where','include','map','attributes','model','info','ShowTrigger','find','util','moment','bluebird','../../config/logger'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x28eab5,_0x3f6403){_0x28eab5=_0x28eab5-0x0;var _0x1be3c0=_0xcfef[_0x28eab5];return _0x1be3c0;};'use strict';var _=require('lodash');var util=require(_0xfcfe('0x0'));var moment=require(_0xfcfe('0x1'));var BPromise=require(_0xfcfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcfe('0x3'))(_0xfcfe('0x4'));var config=require(_0xfcfe('0x5'));var jayson=require(_0xfcfe('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2aecec,_0x584f29,_0x28fe66){return new BPromise(function(_0x1d7307,_0x39d07c){return client['request'](_0x2aecec,_0x28fe66)[_0xfcfe('0x7')](function(_0x5c6211){logger['info'](_0xfcfe('0x8'),_0x584f29,'request\x20sent');logger[_0xfcfe('0x9')](_0xfcfe('0xa'),_0x584f29,_0xfcfe('0xb'),JSON[_0xfcfe('0xc')](_0x5c6211));if(_0x5c6211[_0xfcfe('0xd')]){if(_0x5c6211[_0xfcfe('0xd')]['code']===0x1f4){logger[_0xfcfe('0xd')]('Trigger,\x20%s,\x20%s',_0x584f29,_0x5c6211['error'][_0xfcfe('0xe')]);return _0x39d07c(_0x5c6211['error'][_0xfcfe('0xe')]);}logger[_0xfcfe('0xd')](_0xfcfe('0x8'),_0x584f29,_0x5c6211[_0xfcfe('0xd')][_0xfcfe('0xe')]);return _0x1d7307(_0x5c6211[_0xfcfe('0xd')][_0xfcfe('0xe')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x584f29,_0xfcfe('0xb'));_0x1d7307(_0x5c6211[_0xfcfe('0xf')][_0xfcfe('0xe')]);}})[_0xfcfe('0x10')](function(_0x5414b1){logger['error'](_0xfcfe('0x8'),_0x584f29,_0x5414b1);_0x39d07c(_0x5414b1);});});}exports[_0xfcfe('0x11')]=function(_0x4393e4){var _0x58dc99=this;return new Promise(function(_0x386a5d,_0x4c36b9){return db[_0xfcfe('0x12')][_0xfcfe('0x13')]({'raw':_0x4393e4['options']?_0x4393e4[_0xfcfe('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')][_0xfcfe('0x15')]||null:null,'attributes':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')]['attributes']||null:null,'limit':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4['options']['limit']||null:null,'include':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')][_0xfcfe('0x16')]?_[_0xfcfe('0x17')](_0x4393e4[_0xfcfe('0x14')]['include'],function(_0x131384){return{'model':db[_0x131384['model']],'as':_0x131384['as'],'attributes':_0x131384[_0xfcfe('0x18')],'include':_0x131384[_0xfcfe('0x16')]?_[_0xfcfe('0x17')](_0x131384['include'],function(_0x3ebd99){return{'model':db[_0x3ebd99[_0xfcfe('0x19')]],'as':_0x3ebd99['as'],'attributes':_0x3ebd99[_0xfcfe('0x18')],'include':_0x3ebd99[_0xfcfe('0x16')]?_['map'](_0x3ebd99[_0xfcfe('0x16')],function(_0x24f3a7){return{'model':db[_0x24f3a7[_0xfcfe('0x19')]],'as':_0x24f3a7['as'],'attributes':_0x24f3a7[_0xfcfe('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcfe('0x7')](function(_0x41e60d){logger[_0xfcfe('0x1a')](_0xfcfe('0x11'),_0x4393e4);logger[_0xfcfe('0x9')](_0xfcfe('0x11'),_0x4393e4,JSON[_0xfcfe('0xc')](_0x41e60d));_0x386a5d(_0x41e60d);})[_0xfcfe('0x10')](function(_0x12a91b){logger[_0xfcfe('0xd')](_0xfcfe('0x11'),_0x12a91b[_0xfcfe('0xe')],_0x4393e4);_0x4c36b9(_0x58dc99['error'](0x1f4,_0x12a91b[_0xfcfe('0xe')]));});});};exports[_0xfcfe('0x1b')]=function(_0x2c0998){var _0xa2c262=this;return new Promise(function(_0x1a7f54,_0x1d7134){return db[_0xfcfe('0x12')][_0xfcfe('0x1c')]({'raw':_0x2c0998[_0xfcfe('0x14')]?_0x2c0998[_0xfcfe('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2c0998[_0xfcfe('0x14')]?_0x2c0998[_0xfcfe('0x14')]['where']||null:null,'attributes':_0x2c0998[_0xfcfe('0x14')]?_0x2c0998[_0xfcfe('0x14')][_0xfcfe('0x18')]||null:null,'include':_0x2c0998[_0xfcfe('0x14')]?_0x2c0998[_0xfcfe('0x14')]['include']?_[_0xfcfe('0x17')](_0x2c0998['options'][_0xfcfe('0x16')],function(_0x664025){return{'model':db[_0x664025[_0xfcfe('0x19')]],'as':_0x664025['as'],'attributes':_0x664025[_0xfcfe('0x18')],'include':_0x664025[_0xfcfe('0x16')]?_[_0xfcfe('0x17')](_0x664025[_0xfcfe('0x16')],function(_0x489709){return{'model':db[_0x489709[_0xfcfe('0x19')]],'as':_0x489709['as'],'attributes':_0x489709['attributes'],'include':_0x489709['include']?_[_0xfcfe('0x17')](_0x489709[_0xfcfe('0x16')],function(_0x2eecfa){return{'model':db[_0x2eecfa[_0xfcfe('0x19')]],'as':_0x2eecfa['as'],'attributes':_0x2eecfa[_0xfcfe('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcfe('0x7')](function(_0x2e10b3){logger[_0xfcfe('0x1a')](_0xfcfe('0x1b'),_0x2c0998);logger[_0xfcfe('0x9')](_0xfcfe('0x1b'),_0x2c0998,JSON[_0xfcfe('0xc')](_0x2e10b3));_0x1a7f54(_0x2e10b3);})['catch'](function(_0x123e53){logger[_0xfcfe('0xd')](_0xfcfe('0x1b'),_0x123e53[_0xfcfe('0xe')],_0x2c0998);_0x1d7134(_0xa2c262[_0xfcfe('0xd')](0x1f4,_0x123e53[_0xfcfe('0xe')]));});});}; \ No newline at end of file +var _0xe165=['request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xe165,0x11c));var _0x5e16=function(_0x1521cf,_0x1857c1){_0x1521cf=_0x1521cf-0x0;var _0x1b0dd9=_0xe165[_0x1521cf];return _0x1b0dd9;};'use strict';var _=require(_0x5e16('0x0'));var util=require('util');var moment=require(_0x5e16('0x1'));var BPromise=require(_0x5e16('0x2'));var rs=require(_0x5e16('0x3'));var fs=require('fs');var Redis=require(_0x5e16('0x4'));var db=require(_0x5e16('0x5'))['db'];var utils=require(_0x5e16('0x6'));var logger=require(_0x5e16('0x7'))(_0x5e16('0x8'));var config=require(_0x5e16('0x9'));var jayson=require(_0x5e16('0xa'));var client=jayson['client'][_0x5e16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6741,_0x5a2ee4,_0xf43001){return new BPromise(function(_0x1f4e1c,_0xc44507){return client[_0x5e16('0xc')](_0x2c6741,_0xf43001)[_0x5e16('0xd')](function(_0x4a9fc3){logger[_0x5e16('0xe')](_0x5e16('0xf'),_0x5a2ee4,_0x5e16('0x10'));logger['debug'](_0x5e16('0x11'),_0x5a2ee4,'request\x20sent',JSON[_0x5e16('0x12')](_0x4a9fc3));if(_0x4a9fc3[_0x5e16('0x13')]){if(_0x4a9fc3[_0x5e16('0x13')]['code']===0x1f4){logger[_0x5e16('0x13')](_0x5e16('0xf'),_0x5a2ee4,_0x4a9fc3['error']['message']);return _0xc44507(_0x4a9fc3[_0x5e16('0x13')][_0x5e16('0x14')]);}logger['error'](_0x5e16('0xf'),_0x5a2ee4,_0x4a9fc3[_0x5e16('0x13')][_0x5e16('0x14')]);return _0x1f4e1c(_0x4a9fc3[_0x5e16('0x13')][_0x5e16('0x14')]);}else{logger[_0x5e16('0xe')](_0x5e16('0xf'),_0x5a2ee4,_0x5e16('0x10'));_0x1f4e1c(_0x4a9fc3[_0x5e16('0x15')]['message']);}})[_0x5e16('0x16')](function(_0x1be961){logger[_0x5e16('0x13')](_0x5e16('0xf'),_0x5a2ee4,_0x1be961);_0xc44507(_0x1be961);});});}exports[_0x5e16('0x17')]=function(_0x1f1250){var _0x3366ef=this;return new Promise(function(_0x429262,_0x129f3a){return db[_0x5e16('0x18')][_0x5e16('0x19')]({'raw':_0x1f1250[_0x5e16('0x1a')]?_0x1f1250[_0x5e16('0x1a')][_0x5e16('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f1250[_0x5e16('0x1a')]?_0x1f1250[_0x5e16('0x1a')][_0x5e16('0x1c')]||null:null,'attributes':_0x1f1250[_0x5e16('0x1a')]?_0x1f1250['options']['attributes']||null:null,'limit':_0x1f1250[_0x5e16('0x1a')]?_0x1f1250[_0x5e16('0x1a')][_0x5e16('0x1d')]||null:null,'include':_0x1f1250['options']?_0x1f1250[_0x5e16('0x1a')][_0x5e16('0x1e')]?_[_0x5e16('0x1f')](_0x1f1250[_0x5e16('0x1a')][_0x5e16('0x1e')],function(_0x26ee77){return{'model':db[_0x26ee77[_0x5e16('0x20')]],'as':_0x26ee77['as'],'attributes':_0x26ee77[_0x5e16('0x21')],'include':_0x26ee77[_0x5e16('0x1e')]?_[_0x5e16('0x1f')](_0x26ee77[_0x5e16('0x1e')],function(_0x24f8f4){return{'model':db[_0x24f8f4[_0x5e16('0x20')]],'as':_0x24f8f4['as'],'attributes':_0x24f8f4[_0x5e16('0x21')],'include':_0x24f8f4['include']?_['map'](_0x24f8f4[_0x5e16('0x1e')],function(_0x2194ef){return{'model':db[_0x2194ef['model']],'as':_0x2194ef['as'],'attributes':_0x2194ef[_0x5e16('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e16('0xd')](function(_0x1d826e){logger['info']('GetTrigger',_0x1f1250);logger['debug'](_0x5e16('0x17'),_0x1f1250,JSON[_0x5e16('0x12')](_0x1d826e));_0x429262(_0x1d826e);})[_0x5e16('0x16')](function(_0x377e2e){logger[_0x5e16('0x13')](_0x5e16('0x17'),_0x377e2e[_0x5e16('0x14')],_0x1f1250);_0x129f3a(_0x3366ef['error'](0x1f4,_0x377e2e[_0x5e16('0x14')]));});});};exports[_0x5e16('0x22')]=function(_0x330fda){var _0x34f9ff=this;return new Promise(function(_0x12508b,_0x3a3b5e){return db[_0x5e16('0x18')][_0x5e16('0x23')]({'raw':_0x330fda[_0x5e16('0x1a')]?_0x330fda[_0x5e16('0x1a')][_0x5e16('0x1b')]===undefined?!![]:![]:!![],'where':_0x330fda[_0x5e16('0x1a')]?_0x330fda[_0x5e16('0x1a')][_0x5e16('0x1c')]||null:null,'attributes':_0x330fda[_0x5e16('0x1a')]?_0x330fda[_0x5e16('0x1a')][_0x5e16('0x21')]||null:null,'include':_0x330fda[_0x5e16('0x1a')]?_0x330fda[_0x5e16('0x1a')]['include']?_[_0x5e16('0x1f')](_0x330fda[_0x5e16('0x1a')]['include'],function(_0x54940c){return{'model':db[_0x54940c[_0x5e16('0x20')]],'as':_0x54940c['as'],'attributes':_0x54940c[_0x5e16('0x21')],'include':_0x54940c[_0x5e16('0x1e')]?_[_0x5e16('0x1f')](_0x54940c[_0x5e16('0x1e')],function(_0x3e74f7){return{'model':db[_0x3e74f7[_0x5e16('0x20')]],'as':_0x3e74f7['as'],'attributes':_0x3e74f7[_0x5e16('0x21')],'include':_0x3e74f7[_0x5e16('0x1e')]?_[_0x5e16('0x1f')](_0x3e74f7['include'],function(_0x4acd98){return{'model':db[_0x4acd98[_0x5e16('0x20')]],'as':_0x4acd98['as'],'attributes':_0x4acd98[_0x5e16('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e16('0xd')](function(_0x3e0ab2){logger[_0x5e16('0xe')](_0x5e16('0x22'),_0x330fda);logger[_0x5e16('0x24')]('ShowTrigger',_0x330fda,JSON[_0x5e16('0x12')](_0x3e0ab2));_0x12508b(_0x3e0ab2);})['catch'](function(_0x51b1e8){logger['error'](_0x5e16('0x22'),_0x51b1e8[_0x5e16('0x14')],_0x330fda);_0x3a3b5e(_0x34f9ff[_0x5e16('0x13')](0x1f4,_0x51b1e8[_0x5e16('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dfc348f..65a5194 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 _0xf792=['destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','clone','post','/:id','delete'];(function(_0x4bdd9f,_0x572b90){var _0x4a4c0f=function(_0x31f97f){while(--_0x31f97f){_0x4bdd9f['push'](_0x4bdd9f['shift']());}};_0x4a4c0f(++_0x572b90);}(_0xf792,0x9b));var _0x2f79=function(_0x2b0ce4,_0x42cb1b){_0x2b0ce4=_0x2b0ce4-0x0;var _0x5c7b60=_0xf792[_0x2b0ce4];return _0x5c7b60;};'use strict';var multer=require('multer');var util=require(_0x2f79('0x0'));var path=require('path');var timeout=require(_0x2f79('0x1'));var express=require(_0x2f79('0x2'));var router=express['Router']();var fs_extra=require(_0x2f79('0x3'));var auth=require(_0x2f79('0x4'));var interaction=require(_0x2f79('0x5'));var config=require(_0x2f79('0x6'));var controller=require(_0x2f79('0x7'));router[_0x2f79('0x8')]('/',auth[_0x2f79('0x9')](),controller[_0x2f79('0xa')]);router[_0x2f79('0x8')]('/:id',auth[_0x2f79('0x9')](),controller['show']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x2f79('0xb')]);router[_0x2f79('0xc')]('/',auth[_0x2f79('0x9')](),controller['create']);router['put'](_0x2f79('0xd'),auth[_0x2f79('0x9')](),controller['update']);router[_0x2f79('0xe')](_0x2f79('0xd'),auth[_0x2f79('0x9')](),controller[_0x2f79('0xf')]);module[_0x2f79('0x10')]=router; \ No newline at end of file +var _0x0f27=['isAuthenticated','index','show','post','/:id/clone','put','/:id','update','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0x0f27,0x16d));var _0x70f2=function(_0x49a60f,_0x518c48){_0x49a60f=_0x49a60f-0x0;var _0x38c29c=_0x0f27[_0x49a60f];return _0x38c29c;};'use strict';var multer=require(_0x70f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x70f2('0x1'));var express=require(_0x70f2('0x2'));var router=express[_0x70f2('0x3')]();var fs_extra=require(_0x70f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x70f2('0x5'));var config=require(_0x70f2('0x6'));var controller=require(_0x70f2('0x7'));router[_0x70f2('0x8')]('/',auth[_0x70f2('0x9')](),controller[_0x70f2('0xa')]);router[_0x70f2('0x8')]('/:id',auth[_0x70f2('0x9')](),controller[_0x70f2('0xb')]);router[_0x70f2('0xc')](_0x70f2('0xd'),auth['isAuthenticated'](),controller['clone']);router[_0x70f2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x70f2('0xe')](_0x70f2('0xf'),auth[_0x70f2('0x9')](),controller[_0x70f2('0x10')]);router['delete'](_0x70f2('0xf'),auth[_0x70f2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index cf907db..cf9445d 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 _0x3e98=['ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','getDataValue','split','rfc2833','info','shortinfo','inband','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','pai','fingerprint','certificate','active','actpass','BOOLEAN','sequelize','exports','STRING','name','user','peer','friend','from-voip-provider'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x3e98,0x188));var _0x83e9=function(_0x4e8190,_0x1e485f){_0x4e8190=_0x4e8190-0x0;var _0x11b432=_0x3e98[_0x4e8190];return _0x11b432;};'use strict';var Sequelize=require(_0x83e9('0x0'));module[_0x83e9('0x1')]={'name':{'type':Sequelize[_0x83e9('0x2')],'allowNull':![],'unique':_0x83e9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x83e9('0x4'),_0x83e9('0x5')),'allowNull':![],'defaultValue':_0x83e9('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x83e9('0x7')},'callingpres':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x9'),_0x83e9('0xa'),'ALLOWED_FAILED_SCREEN',_0x83e9('0xb'),_0x83e9('0xc'),_0x83e9('0xd'),_0x83e9('0xe'),_0x83e9('0xf'))},'deny':{'type':Sequelize[_0x83e9('0x2')]},'permit':{'type':Sequelize[_0x83e9('0x2')]},'secret':{'type':Sequelize[_0x83e9('0x2')]},'md5secret':{'type':Sequelize[_0x83e9('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':_0x83e9('0x10'),'set':function(_0x1c6812){this[_0x83e9('0x11')]('transport',_0x1c6812?_0x1c6812[_0x83e9('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x83e9('0x13'))?this[_0x83e9('0x14')](_0x83e9('0x13'))[_0x83e9('0x15')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x16'),_0x83e9('0x17'),_0x83e9('0x18'),_0x83e9('0x19'),'auto'),'defaultValue':_0x83e9('0x16')},'directmedia':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x1b'),_0x83e9('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x83e9('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':_0x83e9('0x1d'),'set':function(_0x525981){this[_0x83e9('0x11')]('nat',_0x525981?_0x525981[_0x83e9('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x83e9('0x1e'))?this[_0x83e9('0x14')](_0x83e9('0x1e'))['split'](','):null;},'comment':_0x83e9('0x1f')},'callgroup':{'type':Sequelize[_0x83e9('0x2')]},'namedcallgroup':{'type':Sequelize[_0x83e9('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x83e9('0x2')]},'language':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x83e9('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x83e9('0x2')],'allowNull':![],'defaultValue':_0x83e9('0x20'),'set':function(_0x467698){this[_0x83e9('0x11')](_0x83e9('0x21'),_0x467698?_0x467698[_0x83e9('0x12')](';'):_0x83e9('0x20'));},'get':function(){return this[_0x83e9('0x14')](_0x83e9('0x21'))?this[_0x83e9('0x14')]('allow')[_0x83e9('0x15')](';'):null;},'comment':_0x83e9('0x22')},'autoframing':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no')},'insecure':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':_0x83e9('0x23'),'set':function(_0x12c9e4){this[_0x83e9('0x11')](_0x83e9('0x24'),_0x12c9e4?_0x12c9e4[_0x83e9('0x12')](','):null);},'get':function(){return this[_0x83e9('0x14')](_0x83e9('0x24'))?this[_0x83e9('0x14')](_0x83e9('0x24'))[_0x83e9('0x15')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x25'))},'promiscredir':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x83e9('0x8')]('yes','no')},'accountcode':{'type':Sequelize[_0x83e9('0x26')](0xb)},'setvar':{'type':Sequelize[_0x83e9('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x83e9('0x27')},'amaflags':{'type':Sequelize[_0x83e9('0x2')]},'callcounter':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':_0x83e9('0x1a')},'busylevel':{'type':Sequelize[_0x83e9('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x83e9('0x8')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x83e9('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x83e9('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x83e9('0x2')]},'template':{'type':Sequelize[_0x83e9('0x2')]},'videosupport':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x83e9('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x83e9('0x8')]('yes','no')},'mailbox':{'type':Sequelize[_0x83e9('0x2')]},'session_timers':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x29'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x83e9('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x2a'),_0x83e9('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x83e9('0x2')]},'regexten':{'type':Sequelize[_0x83e9('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x83e9('0x2')]},'port':{'type':Sequelize[_0x83e9('0x26')](0x5)},'qualify':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x83e9('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x83e9('0x2')]},'defaultuser':{'type':Sequelize[_0x83e9('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x83e9('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x83e9('0x2')]},'timert1':{'type':Sequelize[_0x83e9('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x83e9('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x83e9('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x83e9('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x83e9('0x2')]},'use_q850_reason':{'type':Sequelize[_0x83e9('0x2')]},'maxforwards':{'type':Sequelize[_0x83e9('0x26')](0xb)},'encryption':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x83e9('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x2d'),_0x83e9('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x83e9('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x83e9('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x83e9('0x2')]},'dtlscipher':{'type':Sequelize[_0x83e9('0x2')]},'dtlscafile':{'type':Sequelize[_0x83e9('0x2')]},'dtlscapath':{'type':Sequelize[_0x83e9('0x2')]},'dtlssetup':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x2f'),'passive',_0x83e9('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x83e9('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x83e9('0x2')]},'call_limit':{'type':Sequelize[_0x83e9('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x83e9('0x8')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x83e9('0x8')]('yes','no')},'vmexten':{'type':Sequelize[_0x83e9('0x2')]},'mohinterpret':{'type':Sequelize[_0x83e9('0x2')]},'mohsuggest':{'type':Sequelize[_0x83e9('0x2')]},'parkinglot':{'type':Sequelize[_0x83e9('0x2')]},'description':{'type':Sequelize[_0x83e9('0x2')]},'host':{'type':Sequelize[_0x83e9('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x83e9('0x8')](_0x83e9('0x1a'),'no',_0x83e9('0x1b'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x83e9('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x83e9('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x40ac=['never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x2ae96b,_0x205002){var _0x20bf7b=function(_0x540f97){while(--_0x540f97){_0x2ae96b['push'](_0x2ae96b['shift']());}};_0x20bf7b(++_0x205002);}(_0x40ac,0xdb));var _0xc40a=function(_0x12d573,_0x20ae28){_0x12d573=_0x12d573-0x0;var _0x5c7071=_0x40ac[_0x12d573];return _0x5c7071;};'use strict';var Sequelize=require(_0xc40a('0x0'));module[_0xc40a('0x1')]={'name':{'type':Sequelize[_0xc40a('0x2')],'allowNull':![],'unique':_0xc40a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x5'),_0xc40a('0x6'),_0xc40a('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x8'),'ALLOWED_PASSED_SCREEN',_0xc40a('0x9'),_0xc40a('0xa'),_0xc40a('0xb'),'PROHIB_PASSED_SCREEN',_0xc40a('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xc40a('0x2')]},'permit':{'type':Sequelize[_0xc40a('0x2')]},'secret':{'type':Sequelize[_0xc40a('0x2')]},'md5secret':{'type':Sequelize[_0xc40a('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':'udp','set':function(_0xc8c87d){this[_0xc40a('0xd')](_0xc40a('0xe'),_0xc8c87d?_0xc8c87d[_0xc40a('0xf')](','):null);},'get':function(){return this[_0xc40a('0x10')](_0xc40a('0xe'))?this[_0xc40a('0x10')](_0xc40a('0xe'))[_0xc40a('0x11')](','):null;},'comment':_0xc40a('0x12')},'dtmfmode':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x13'),_0xc40a('0x14'),_0xc40a('0x15'),_0xc40a('0x16'),_0xc40a('0x17')),'defaultValue':_0xc40a('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no',_0xc40a('0x19'),_0xc40a('0x1a'),_0xc40a('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc40a('0x2')]},'directmediadeny':{'type':Sequelize[_0xc40a('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc40a('0x1c'),'set':function(_0x53a373){this[_0xc40a('0xd')]('nat',_0x53a373?_0x53a373[_0xc40a('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xc40a('0x1d'))?this[_0xc40a('0x10')](_0xc40a('0x1d'))[_0xc40a('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc40a('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc40a('0x2')]},'pickupgroup':{'type':Sequelize[_0xc40a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xc40a('0x2')]},'language':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc40a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':_0xc40a('0x1e')},'allow':{'type':Sequelize[_0xc40a('0x2')],'allowNull':![],'defaultValue':_0xc40a('0x1f'),'set':function(_0x156e95){this[_0xc40a('0xd')](_0xc40a('0x20'),_0x156e95?_0x156e95[_0xc40a('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc40a('0x10')](_0xc40a('0x20'))?this['getDataValue']('allow')[_0xc40a('0x11')](';'):null;},'comment':_0xc40a('0x21')},'autoframing':{'type':Sequelize[_0xc40a('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':'port,invite','set':function(_0x33bb96){this[_0xc40a('0xd')](_0xc40a('0x22'),_0x33bb96?_0x33bb96['join'](','):null);},'get':function(){return this[_0xc40a('0x10')]('insecure')?this[_0xc40a('0x10')](_0xc40a('0x22'))[_0xc40a('0x11')](','):null;},'comment':_0xc40a('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc40a('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no',_0xc40a('0x24'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'accountcode':{'type':Sequelize[_0xc40a('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':_0xc40a('0x26')},'amaflags':{'type':Sequelize[_0xc40a('0x2')]},'callcounter':{'type':Sequelize[_0xc40a('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc40a('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xc40a('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xc40a('0x2')]},'template':{'type':Sequelize[_0xc40a('0x2')]},'videosupport':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no',_0xc40a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc40a('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x28'),'refuse',_0xc40a('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xc40a('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x2a'),_0xc40a('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xc40a('0x2')]},'regexten':{'type':Sequelize[_0xc40a('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc40a('0x25')](0x5)},'qualify':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no'),'defaultValue':_0xc40a('0x18')},'keepalive':{'type':Sequelize[_0xc40a('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc40a('0x2')]},'rtptimeout':{'type':Sequelize[_0xc40a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc40a('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xc40a('0x4')]('yes','no',_0xc40a('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc40a('0x2')]},'callbackextension':{'type':Sequelize[_0xc40a('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc40a('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc40a('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc40a('0x2')]},'contactdeny':{'type':Sequelize[_0xc40a('0x2')]},'contactacl':{'type':Sequelize[_0xc40a('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xc40a('0x2')]},'use_q850_reason':{'type':Sequelize[_0xc40a('0x2')]},'maxforwards':{'type':Sequelize[_0xc40a('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no')},'icesupport':{'type':Sequelize[_0xc40a('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xc40a('0x18'),'no','fingerprint',_0xc40a('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xc40a('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc40a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc40a('0x2')]},'dtlscipher':{'type':Sequelize[_0xc40a('0x2')]},'dtlscafile':{'type':Sequelize[_0xc40a('0x2')]},'dtlscapath':{'type':Sequelize[_0xc40a('0x2')]},'dtlssetup':{'type':Sequelize[_0xc40a('0x4')]('active',_0xc40a('0x2e'),_0xc40a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc40a('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc40a('0x2')]},'recordofffeature':{'type':Sequelize[_0xc40a('0x2')]},'call_limit':{'type':Sequelize[_0xc40a('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xc40a('0x4')](_0xc40a('0x18'),'no')},'vmexten':{'type':Sequelize[_0xc40a('0x2')]},'mohinterpret':{'type':Sequelize[_0xc40a('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc40a('0x2')]},'host':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':_0xc40a('0x30')},'canreinvite':{'type':Sequelize[_0xc40a('0x4')]('yes','no',_0xc40a('0x19'),_0xc40a('0x1a'),_0xc40a('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc40a('0x2')]},'otherFields':{'type':Sequelize[_0xc40a('0x2')]},'active':{'type':Sequelize[_0xc40a('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc40a('0x2')],'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 08a1eb0..368a081 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x3cad98,_0x3a6539){var _0x53f43c=function(_0x44ff9c){while(--_0x44ff9c){_0x3cad98['push'](_0x3cad98['shift']());}};_0x53f43c(++_0x3a6539);}(_0x9f62,0x154));var _0x29f6=function(_0x4f031e,_0x3a4601){_0x4f031e=_0x4f031e-0x0;var _0x1f7a27=_0x9f62[_0x4f031e];return _0x1f7a27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9f62,0x154));var _0x29f6=function(_0x271fa9,_0x5a42a9){_0x271fa9=_0x271fa9-0x0;var _0x16ce73=_0x9f62[_0x271fa9];return _0x16ce73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7fabf99..eaf8e76 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 _0x28b9=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x28b9,0x190));var _0x928b=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x28b9[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0x928b('0x0'));var util=require(_0x928b('0x1'));var logger=require(_0x928b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x928b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x928b('0x4'));var rimraf=require(_0x928b('0x5'));var config=require(_0x928b('0x6'));var attributes=require(_0x928b('0x7'));module[_0x928b('0x8')]=function(_0x2078d0,_0x329ece){return _0x2078d0[_0x928b('0x9')](_0x928b('0xa'),attributes,{'tableName':_0x928b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa369=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks'];(function(_0x3e508b,_0x24f3cf){var _0x1331f9=function(_0x4eb1e7){while(--_0x4eb1e7){_0x3e508b['push'](_0x3e508b['shift']());}};_0x1331f9(++_0x24f3cf);}(_0xa369,0x1ad));var _0x9a36=function(_0x39e547,_0x331d7d){_0x39e547=_0x39e547-0x0;var _0x26978e=_0xa369[_0x39e547];return _0x26978e;};'use strict';var _=require(_0x9a36('0x0'));var util=require(_0x9a36('0x1'));var logger=require('../../config/logger')(_0x9a36('0x2'));var moment=require(_0x9a36('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a36('0x4'));var fs=require('fs');var path=require(_0x9a36('0x5'));var rimraf=require(_0x9a36('0x6'));var config=require(_0x9a36('0x7'));var attributes=require(_0x9a36('0x8'));module[_0x9a36('0x9')]=function(_0x3a4e12,_0x32f9dd){return _0x3a4e12['define']('Trunk',attributes,{'tableName':_0x9a36('0xa'),'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 414e625..2ded265 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 _0xfaa9=['message','result','catch','Trunk','findAll','raw','options','where','attributes','limit','map','model','include','GetTrunk','ShowTrunk','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1ef911,_0x32a38b){var _0x5297f4=function(_0x3b1134){while(--_0x3b1134){_0x1ef911['push'](_0x1ef911['shift']());}};_0x5297f4(++_0x32a38b);}(_0xfaa9,0x190));var _0x9faa=function(_0x1f2f8,_0x35c8e6){_0x1f2f8=_0x1f2f8-0x0;var _0x1f02ff=_0xfaa9[_0x1f2f8];return _0x1f02ff;};'use strict';var _=require('lodash');var util=require(_0x9faa('0x0'));var moment=require('moment');var BPromise=require(_0x9faa('0x1'));var rs=require(_0x9faa('0x2'));var fs=require('fs');var Redis=require(_0x9faa('0x3'));var db=require(_0x9faa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9faa('0x5'))(_0x9faa('0x6'));var config=require('../../config/environment');var jayson=require(_0x9faa('0x7'));var client=jayson['client'][_0x9faa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f1680,_0x4a5079,_0x3f4fbd){return new BPromise(function(_0x29f6e6,_0x3f9e8f){return client['request'](_0x5f1680,_0x3f4fbd)[_0x9faa('0x9')](function(_0x58a221){logger[_0x9faa('0xa')](_0x9faa('0xb'),_0x4a5079,_0x9faa('0xc'));logger[_0x9faa('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4a5079,_0x9faa('0xc'),JSON[_0x9faa('0xe')](_0x58a221));if(_0x58a221[_0x9faa('0xf')]){if(_0x58a221[_0x9faa('0xf')]['code']===0x1f4){logger[_0x9faa('0xf')]('Trunk,\x20%s,\x20%s',_0x4a5079,_0x58a221[_0x9faa('0xf')][_0x9faa('0x10')]);return _0x3f9e8f(_0x58a221[_0x9faa('0xf')]['message']);}logger['error'](_0x9faa('0xb'),_0x4a5079,_0x58a221[_0x9faa('0xf')][_0x9faa('0x10')]);return _0x29f6e6(_0x58a221['error'][_0x9faa('0x10')]);}else{logger[_0x9faa('0xa')]('Trunk,\x20%s,\x20%s',_0x4a5079,'request\x20sent');_0x29f6e6(_0x58a221[_0x9faa('0x11')]['message']);}})[_0x9faa('0x12')](function(_0x2fb053){logger[_0x9faa('0xf')]('Trunk,\x20%s,\x20%s',_0x4a5079,_0x2fb053);_0x3f9e8f(_0x2fb053);});});}exports['GetTrunk']=function(_0xe81104){var _0x362a1d=this;return new Promise(function(_0x2b369a,_0x461545){return db[_0x9faa('0x13')][_0x9faa('0x14')]({'raw':_0xe81104['options']?_0xe81104['options'][_0x9faa('0x15')]===undefined?!![]:![]:!![],'where':_0xe81104[_0x9faa('0x16')]?_0xe81104['options'][_0x9faa('0x17')]||null:null,'attributes':_0xe81104['options']?_0xe81104['options'][_0x9faa('0x18')]||null:null,'limit':_0xe81104['options']?_0xe81104['options'][_0x9faa('0x19')]||null:null,'include':_0xe81104[_0x9faa('0x16')]?_0xe81104['options']['include']?_[_0x9faa('0x1a')](_0xe81104[_0x9faa('0x16')]['include'],function(_0x41ad12){return{'model':db[_0x41ad12[_0x9faa('0x1b')]],'as':_0x41ad12['as'],'attributes':_0x41ad12['attributes'],'include':_0x41ad12[_0x9faa('0x1c')]?_[_0x9faa('0x1a')](_0x41ad12[_0x9faa('0x1c')],function(_0x3af7fe){return{'model':db[_0x3af7fe[_0x9faa('0x1b')]],'as':_0x3af7fe['as'],'attributes':_0x3af7fe[_0x9faa('0x18')],'include':_0x3af7fe[_0x9faa('0x1c')]?_[_0x9faa('0x1a')](_0x3af7fe['include'],function(_0x405efc){return{'model':db[_0x405efc[_0x9faa('0x1b')]],'as':_0x405efc['as'],'attributes':_0x405efc[_0x9faa('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d4fe2){logger[_0x9faa('0xa')]('GetTrunk',_0xe81104);logger['debug'](_0x9faa('0x1d'),_0xe81104,JSON['stringify'](_0x3d4fe2));_0x2b369a(_0x3d4fe2);})[_0x9faa('0x12')](function(_0x4a099b){logger['error'](_0x9faa('0x1d'),_0x4a099b[_0x9faa('0x10')],_0xe81104);_0x461545(_0x362a1d['error'](0x1f4,_0x4a099b[_0x9faa('0x10')]));});});};exports[_0x9faa('0x1e')]=function(_0x26b5d3){var _0x2c2471=this;return new Promise(function(_0x99f732,_0xa92791){return db[_0x9faa('0x13')][_0x9faa('0x1f')]({'raw':_0x26b5d3[_0x9faa('0x16')]?_0x26b5d3['options'][_0x9faa('0x15')]===undefined?!![]:![]:!![],'where':_0x26b5d3['options']?_0x26b5d3['options'][_0x9faa('0x17')]||null:null,'attributes':_0x26b5d3[_0x9faa('0x16')]?_0x26b5d3['options'][_0x9faa('0x18')]||null:null,'include':_0x26b5d3['options']?_0x26b5d3[_0x9faa('0x16')][_0x9faa('0x1c')]?_['map'](_0x26b5d3[_0x9faa('0x16')][_0x9faa('0x1c')],function(_0x18259e){return{'model':db[_0x18259e[_0x9faa('0x1b')]],'as':_0x18259e['as'],'attributes':_0x18259e['attributes'],'include':_0x18259e[_0x9faa('0x1c')]?_['map'](_0x18259e[_0x9faa('0x1c')],function(_0x940711){return{'model':db[_0x940711[_0x9faa('0x1b')]],'as':_0x940711['as'],'attributes':_0x940711[_0x9faa('0x18')],'include':_0x940711[_0x9faa('0x1c')]?_[_0x9faa('0x1a')](_0x940711['include'],function(_0x37c273){return{'model':db[_0x37c273[_0x9faa('0x1b')]],'as':_0x37c273['as'],'attributes':_0x37c273['attributes']};}):[]};}):[]};}):[]:[]})[_0x9faa('0x9')](function(_0xf7305a){logger[_0x9faa('0xa')]('ShowTrunk',_0x26b5d3);logger['debug'](_0x9faa('0x1e'),_0x26b5d3,JSON['stringify'](_0xf7305a));_0x99f732(_0xf7305a);})[_0x9faa('0x12')](function(_0x1b9930){logger[_0x9faa('0xf')](_0x9faa('0x1e'),_0x1b9930[_0x9faa('0x10')],_0x26b5d3);_0xa92791(_0x2c2471[_0x9faa('0xf')](0x1f4,_0x1b9930[_0x9faa('0x10')]));});});}; \ No newline at end of file +var _0xb098=['error','code','message','catch','GetTrunk','Trunk','findAll','options','attributes','include','map','model','debug','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xb098,0x186));var _0x8b09=function(_0x131d7d,_0x4be746){_0x131d7d=_0x131d7d-0x0;var _0x591115=_0xb098[_0x131d7d];return _0x591115;};'use strict';var _=require(_0x8b09('0x0'));var util=require(_0x8b09('0x1'));var moment=require(_0x8b09('0x2'));var BPromise=require(_0x8b09('0x3'));var rs=require(_0x8b09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b09('0x5'))['db'];var utils=require(_0x8b09('0x6'));var logger=require('../../config/logger')(_0x8b09('0x7'));var config=require(_0x8b09('0x8'));var jayson=require(_0x8b09('0x9'));var client=jayson[_0x8b09('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc43a24,_0x4d9ed8,_0x250b65){return new BPromise(function(_0x3d0b87,_0x3a41d6){return client[_0x8b09('0xb')](_0xc43a24,_0x250b65)[_0x8b09('0xc')](function(_0x98bcc){logger[_0x8b09('0xd')](_0x8b09('0xe'),_0x4d9ed8,_0x8b09('0xf'));logger['debug'](_0x8b09('0x10'),_0x4d9ed8,_0x8b09('0xf'),JSON[_0x8b09('0x11')](_0x98bcc));if(_0x98bcc[_0x8b09('0x12')]){if(_0x98bcc[_0x8b09('0x12')][_0x8b09('0x13')]===0x1f4){logger[_0x8b09('0x12')](_0x8b09('0xe'),_0x4d9ed8,_0x98bcc[_0x8b09('0x12')][_0x8b09('0x14')]);return _0x3a41d6(_0x98bcc[_0x8b09('0x12')][_0x8b09('0x14')]);}logger['error'](_0x8b09('0xe'),_0x4d9ed8,_0x98bcc['error'][_0x8b09('0x14')]);return _0x3d0b87(_0x98bcc[_0x8b09('0x12')][_0x8b09('0x14')]);}else{logger[_0x8b09('0xd')](_0x8b09('0xe'),_0x4d9ed8,_0x8b09('0xf'));_0x3d0b87(_0x98bcc['result'][_0x8b09('0x14')]);}})[_0x8b09('0x15')](function(_0x4a9272){logger[_0x8b09('0x12')](_0x8b09('0xe'),_0x4d9ed8,_0x4a9272);_0x3a41d6(_0x4a9272);});});}exports[_0x8b09('0x16')]=function(_0x2cecc7){var _0x2c5980=this;return new Promise(function(_0x39189a,_0x16e033){return db[_0x8b09('0x17')][_0x8b09('0x18')]({'raw':_0x2cecc7[_0x8b09('0x19')]?_0x2cecc7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2cecc7[_0x8b09('0x19')]?_0x2cecc7[_0x8b09('0x19')]['where']||null:null,'attributes':_0x2cecc7[_0x8b09('0x19')]?_0x2cecc7[_0x8b09('0x19')][_0x8b09('0x1a')]||null:null,'limit':_0x2cecc7[_0x8b09('0x19')]?_0x2cecc7[_0x8b09('0x19')]['limit']||null:null,'include':_0x2cecc7['options']?_0x2cecc7['options'][_0x8b09('0x1b')]?_[_0x8b09('0x1c')](_0x2cecc7[_0x8b09('0x19')][_0x8b09('0x1b')],function(_0x5d5f0f){return{'model':db[_0x5d5f0f[_0x8b09('0x1d')]],'as':_0x5d5f0f['as'],'attributes':_0x5d5f0f[_0x8b09('0x1a')],'include':_0x5d5f0f['include']?_[_0x8b09('0x1c')](_0x5d5f0f[_0x8b09('0x1b')],function(_0x4a22fe){return{'model':db[_0x4a22fe['model']],'as':_0x4a22fe['as'],'attributes':_0x4a22fe[_0x8b09('0x1a')],'include':_0x4a22fe['include']?_[_0x8b09('0x1c')](_0x4a22fe[_0x8b09('0x1b')],function(_0x1a64c8){return{'model':db[_0x1a64c8['model']],'as':_0x1a64c8['as'],'attributes':_0x1a64c8[_0x8b09('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8b09('0xc')](function(_0x57fa8d){logger[_0x8b09('0xd')]('GetTrunk',_0x2cecc7);logger[_0x8b09('0x1e')](_0x8b09('0x16'),_0x2cecc7,JSON[_0x8b09('0x11')](_0x57fa8d));_0x39189a(_0x57fa8d);})[_0x8b09('0x15')](function(_0x5af56a){logger[_0x8b09('0x12')]('GetTrunk',_0x5af56a[_0x8b09('0x14')],_0x2cecc7);_0x16e033(_0x2c5980[_0x8b09('0x12')](0x1f4,_0x5af56a['message']));});});};exports[_0x8b09('0x1f')]=function(_0x95d52){var _0x519835=this;return new Promise(function(_0x1268fb,_0x484bfc){return db['Trunk'][_0x8b09('0x20')]({'raw':_0x95d52[_0x8b09('0x19')]?_0x95d52[_0x8b09('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x95d52['options']?_0x95d52['options'][_0x8b09('0x21')]||null:null,'attributes':_0x95d52[_0x8b09('0x19')]?_0x95d52['options'][_0x8b09('0x1a')]||null:null,'include':_0x95d52[_0x8b09('0x19')]?_0x95d52[_0x8b09('0x19')][_0x8b09('0x1b')]?_[_0x8b09('0x1c')](_0x95d52[_0x8b09('0x19')][_0x8b09('0x1b')],function(_0x40df78){return{'model':db[_0x40df78[_0x8b09('0x1d')]],'as':_0x40df78['as'],'attributes':_0x40df78[_0x8b09('0x1a')],'include':_0x40df78[_0x8b09('0x1b')]?_['map'](_0x40df78['include'],function(_0x1f4244){return{'model':db[_0x1f4244['model']],'as':_0x1f4244['as'],'attributes':_0x1f4244[_0x8b09('0x1a')],'include':_0x1f4244[_0x8b09('0x1b')]?_[_0x8b09('0x1c')](_0x1f4244[_0x8b09('0x1b')],function(_0x1f50dd){return{'model':db[_0x1f50dd[_0x8b09('0x1d')]],'as':_0x1f50dd['as'],'attributes':_0x1f50dd[_0x8b09('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a420){logger['info']('ShowTrunk',_0x95d52);logger['debug'](_0x8b09('0x1f'),_0x95d52,JSON[_0x8b09('0x11')](_0x11a420));_0x1268fb(_0x11a420);})[_0x8b09('0x15')](function(_0x42ba87){logger['error'](_0x8b09('0x1f'),_0x42ba87[_0x8b09('0x14')],_0x95d52);_0x484bfc(_0x519835[_0x8b09('0x12')](0x1f4,_0x42ba87['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index fb10b35..32a165c 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 _0x766e=['../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','exports','express','Router'];(function(_0xd08d8e,_0x6c6949){var _0x4d7895=function(_0x3fa76d){while(--_0x3fa76d){_0xd08d8e['push'](_0xd08d8e['shift']());}};_0x4d7895(++_0x6c6949);}(_0x766e,0x6e));var _0xe766=function(_0x34827d,_0x216e99){_0x34827d=_0x34827d-0x0;var _0x7a060a=_0x766e[_0x34827d];return _0x7a060a;};'use strict';var express=require(_0xe766('0x0'));var router=express[_0xe766('0x1')]();var auth=require(_0xe766('0x2'));var controller=require(_0xe766('0x3'));router['put'](_0xe766('0x4'),auth[_0xe766('0x5')](),controller['update']);module[_0xe766('0x6')]=router; \ No newline at end of file +var _0xd40e=['exports','express','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xd40e,0x1eb));var _0xed40=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0xd40e[_0x540dcb];return _0x49353c;};'use strict';var express=require(_0xed40('0x0'));var router=express['Router']();var auth=require(_0xed40('0x1'));var controller=require(_0xed40('0x2'));router[_0xed40('0x3')](_0xed40('0x4'),auth[_0xed40('0x5')](),controller['update']);module[_0xed40('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 6ad1b50..020001c 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 _0xa659=['UserId','sequelize','warning','info','debug','exports','ENUM','error','TEXT','INTEGER'];(function(_0x215f58,_0x515104){var _0x55bd2b=function(_0x7a3947){while(--_0x7a3947){_0x215f58['push'](_0x215f58['shift']());}};_0x55bd2b(++_0x515104);}(_0xa659,0x1cd));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9a65('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x9a65('0x1'),_0x9a65('0x2'),_0x9a65('0x3')];module[_0x9a65('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x9a65('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x9a65('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x9a65('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x9a65('0x8')],'unique':_0x9a65('0x9')}}; \ No newline at end of file +var _0x2e0a=['UserId','sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN','INTEGER'];(function(_0x4f531c,_0x4866f9){var _0x56a2f1=function(_0x519b72){while(--_0x519b72){_0x4f531c['push'](_0x4f531c['shift']());}};_0x56a2f1(++_0x4866f9);}(_0x2e0a,0x83));var _0xa2e0=function(_0xbae6d9,_0x580b07){_0xbae6d9=_0xbae6d9-0x0;var _0x395786=_0x2e0a[_0xbae6d9];return _0x395786;};'use strict';var Sequelize=require(_0xa2e0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa2e0('0x1'),_0xa2e0('0x2'),_0xa2e0('0x3'),_0xa2e0('0x4')];module[_0xa2e0('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa2e0('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa2e0('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa2e0('0x8')],'unique':_0xa2e0('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 7735178..8d915b7 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 _0x9ade=['sendStatus','error','name','send','user','role','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','catch','lodash','ioredis','../../config/environment','socket.io-emitter','redis','defaults','localhost','status','update','then'];(function(_0x4c869c,_0x1ab794){var _0x33dfa6=function(_0x1c92a1){while(--_0x1c92a1){_0x4c869c['push'](_0x4c869c['shift']());}};_0x33dfa6(++_0x1ab794);}(_0x9ade,0x107));var _0xe9ad=function(_0x575a16,_0x18eefa){_0x575a16=_0x575a16-0x0;var _0x298d59=_0x9ade[_0x575a16];return _0x298d59;};'use strict';var _=require(_0xe9ad('0x0'));var Redis=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xe9ad('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xe9ad('0x3'))(new Redis(config[_0xe9ad('0x4')]));require('./user-setting.socket')['register'](socket);config[_0xe9ad('0x4')]=_[_0xe9ad('0x5')](config[_0xe9ad('0x4')],{'host':_0xe9ad('0x6'),'port':0x18eb});function respondWithResult(_0x308564,_0x6ede7f){_0x6ede7f=_0x6ede7f||0xc8;return function(_0xb4b663){if(_0xb4b663){return _0x308564[_0xe9ad('0x7')](_0x6ede7f)['json'](_0xb4b663);}};}function saveUpdates(_0x123083){return function(_0x38310c){if(_0x38310c){return _0x38310c[_0xe9ad('0x8')](_0x123083)[_0xe9ad('0x9')](function(_0x268c04){return _0x268c04;});}return null;};}function handleEntityNotFound(_0x25927c){return function(_0x16ef20){if(!_0x16ef20){_0x25927c[_0xe9ad('0xa')](0x194);}return _0x16ef20;};}function handleError(_0x2d1ed2,_0xc02836){_0xc02836=_0xc02836||0x1f4;return function(_0x1aec2b){logger[_0xe9ad('0xb')](_0x1aec2b['stack']);if(_0x1aec2b[_0xe9ad('0xc')]){delete _0x1aec2b[_0xe9ad('0xc')];}_0x2d1ed2[_0xe9ad('0x7')](_0xc02836)[_0xe9ad('0xd')](_0x1aec2b);};}exports['update']=function(_0x30246c,_0x1c29d5){if(_0x30246c[_0xe9ad('0xe')][_0xe9ad('0xf')]!=='admin')throw new Error(_0xe9ad('0x10'));if(isNaN(Number(_0x30246c['params']['id'])))throw new Error(_0xe9ad('0x11'));return db['UserSetting'][_0xe9ad('0x12')]({'where':{'id':_0x30246c[_0xe9ad('0x13')]['id']}})[_0xe9ad('0x9')](handleEntityNotFound(_0x1c29d5,null))[_0xe9ad('0x9')](saveUpdates(_0x30246c['body'],null))[_0xe9ad('0x9')](respondWithResult(_0x1c29d5,null))[_0xe9ad('0x14')](handleError(_0x1c29d5,null));}; \ No newline at end of file +var _0xfc1e=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x3b364c,_0x2d2137){var _0x35d512=function(_0x1ee8b7){while(--_0x1ee8b7){_0x3b364c['push'](_0x3b364c['shift']());}};_0x35d512(++_0x2d2137);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xfc1e[_0x4de586];return _0x46baf5;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require('../../config/logger')(_0xefc1('0x0'));var config=require(_0xefc1('0x1'));var db=require(_0xefc1('0x2'))['db'];var socket=require(_0xefc1('0x3'))(new Redis(config[_0xefc1('0x4')]));require('./user-setting.socket')[_0xefc1('0x5')](socket);config[_0xefc1('0x4')]=_['defaults'](config['redis'],{'host':_0xefc1('0x6'),'port':0x18eb});function respondWithResult(_0x38927c,_0x44d15b){_0x44d15b=_0x44d15b||0xc8;return function(_0x3ff4a7){if(_0x3ff4a7){return _0x38927c[_0xefc1('0x7')](_0x44d15b)[_0xefc1('0x8')](_0x3ff4a7);}};}function saveUpdates(_0x322b65){return function(_0x428b19){if(_0x428b19){return _0x428b19[_0xefc1('0x9')](_0x322b65)[_0xefc1('0xa')](function(_0x1d10bc){return _0x1d10bc;});}return null;};}function handleEntityNotFound(_0x4caf4f){return function(_0x3759d2){if(!_0x3759d2){_0x4caf4f[_0xefc1('0xb')](0x194);}return _0x3759d2;};}function handleError(_0x1826a4,_0x1f4846){_0x1f4846=_0x1f4846||0x1f4;return function(_0x17ef51){logger[_0xefc1('0xc')](_0x17ef51[_0xefc1('0xd')]);if(_0x17ef51[_0xefc1('0xe')]){delete _0x17ef51[_0xefc1('0xe')];}_0x1826a4[_0xefc1('0x7')](_0x1f4846)[_0xefc1('0xf')](_0x17ef51);};}exports['update']=function(_0x404e21,_0x27381c){if(_0x404e21[_0xefc1('0x10')][_0xefc1('0x11')]!==_0xefc1('0x12'))throw new Error(_0xefc1('0x13'));if(isNaN(Number(_0x404e21[_0xefc1('0x14')]['id'])))throw new Error(_0xefc1('0x15'));return db['UserSetting'][_0xefc1('0x16')]({'where':{'id':_0x404e21[_0xefc1('0x14')]['id']}})[_0xefc1('0xa')](handleEntityNotFound(_0x27381c,null))['then'](saveUpdates(_0x404e21[_0xefc1('0x17')],null))[_0xefc1('0xa')](respondWithResult(_0x27381c,null))[_0xefc1('0x18')](handleError(_0x27381c,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 821e81d..187dd3c 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 _0x4fe3=['../../mysqldb','UserSetting','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fe3,0xdb));var _0x34fe=function(_0x48beb8,_0x4e3744){_0x48beb8=_0x48beb8-0x0;var _0x2979b4=_0x4fe3[_0x48beb8];return _0x2979b4;};'use strict';var EventEmitter=require(_0x34fe('0x0'));var UserSetting=require(_0x34fe('0x1'))['db'][_0x34fe('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34fe('0x3'),'afterUpdate':_0x34fe('0x4'),'afterDestroy':_0x34fe('0x5')};function emitEvent(_0x3ebc99){return function(_0x277dd6,_0x4e9cd1,_0x48ec8c){UserSettingEvents[_0x34fe('0x6')](_0x3ebc99+':'+_0x277dd6['id'],_0x277dd6);UserSettingEvents[_0x34fe('0x6')](_0x3ebc99,_0x277dd6);_0x48ec8c(null);};}for(var e in events){if(events[_0x34fe('0x7')](e)){var event=events[e];UserSetting[_0x34fe('0x8')](e,emitEvent(event));}}module[_0x34fe('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x66ef=['UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x15d638,_0x5a37f5){var _0x4c6449=function(_0x4167e8){while(--_0x4167e8){_0x15d638['push'](_0x15d638['shift']());}};_0x4c6449(++_0x5a37f5);}(_0x66ef,0x6c));var _0xf66e=function(_0x19957b,_0xe4795f){_0x19957b=_0x19957b-0x0;var _0x5f027c=_0x66ef[_0x19957b];return _0x5f027c;};'use strict';var EventEmitter=require(_0xf66e('0x0'));var UserSetting=require(_0xf66e('0x1'))['db'][_0xf66e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf66e('0x3')](0x0);var events={'afterCreate':_0xf66e('0x4'),'afterUpdate':_0xf66e('0x5'),'afterDestroy':_0xf66e('0x6')};function emitEvent(_0x17d4b6){return function(_0x39e43e,_0x158b82,_0x529e72){UserSettingEvents['emit'](_0x17d4b6+':'+_0x39e43e['id'],_0x39e43e);UserSettingEvents[_0xf66e('0x7')](_0x17d4b6,_0x39e43e);_0x529e72(null);};}for(var e in events){if(events[_0xf66e('0x8')](e)){var event=events[e];UserSetting[_0xf66e('0x9')](e,emitEvent(event));}}module[_0xf66e('0xa')]=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 d804272..a1a0f56 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 _0xae60=['./user-setting.attributes','exports','UserSetting','user_settings','clientSideLoggingEnabledSince'];(function(_0x13d295,_0x554e2f){var _0x4bbffc=function(_0x3785da){while(--_0x3785da){_0x13d295['push'](_0x13d295['shift']());}};_0x4bbffc(++_0x554e2f);}(_0xae60,0x1c7));var _0x0ae6=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xae60[_0x220f3f];return _0x1f170e;};'use strict';var attributes=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]=function(_0xd68d7e){return _0xd68d7e['define'](_0x0ae6('0x2'),attributes,{'tableName':_0x0ae6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d388d){if(!_0x2d388d['clientSideLoggingEnabled'])_0x2d388d[_0x0ae6('0x4')]=null;else if(_0x2d388d[_0x0ae6('0x4')]===null)_0x2d388d['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x4899=['./user-setting.attributes','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x46095f,_0x2834e6){var _0x2250ec=function(_0x382121){while(--_0x382121){_0x46095f['push'](_0x46095f['shift']());}};_0x2250ec(++_0x2834e6);}(_0x4899,0x74));var _0x9489=function(_0x34c471,_0x1b9761){_0x34c471=_0x34c471-0x0;var _0x47035c=_0x4899[_0x34c471];return _0x47035c;};'use strict';var attributes=require(_0x9489('0x0'));module['exports']=function(_0x3bf332){return _0x3bf332['define'](_0x9489('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6a6532){if(!_0x6a6532[_0x9489('0x2')])_0x6a6532[_0x9489('0x3')]=null;else if(_0x6a6532[_0x9489('0x3')]===null)_0x6a6532[_0x9489('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 6fe06a4..1ea1b8f 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 _0x33d5=['user-setting:','remove','user-setting:update','emit','user-setting:update:user-','UserId','register','length'];(function(_0x4ed06d,_0x2bcc89){var _0x623af0=function(_0x13bd9e){while(--_0x13bd9e){_0x4ed06d['push'](_0x4ed06d['shift']());}};_0x623af0(++_0x2bcc89);}(_0x33d5,0x149));var _0x533d=function(_0x3f9b1d,_0x21b2a8){_0x3f9b1d=_0x3f9b1d-0x0;var _0x4acf85=_0x33d5[_0x3f9b1d];return _0x4acf85;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x533d('0x0'),'update'];function createListener(_0x99599a,_0x1a72bc){return function(_0x10a8f7){_0x1a72bc['emit'](_0x99599a,_0x10a8f7);if(_0x99599a===_0x533d('0x1')){_0x1a72bc[_0x533d('0x2')](_0x533d('0x3')+_0x10a8f7[_0x533d('0x4')],_0x10a8f7);}};}exports[_0x533d('0x5')]=function(_0x22f46b){for(var _0x71e3c4=0x0,_0x50e5fd=events[_0x533d('0x6')];_0x71e3c4<_0x50e5fd;_0x71e3c4++){var _0x2019b1=events[_0x71e3c4];var _0xc2c88e=createListener(_0x533d('0x7')+_0x2019b1,_0x22f46b);UserSettingEvents['on'](_0x2019b1,_0xc2c88e);}}; \ No newline at end of file +var _0x5ed0=['user-setting:update:user-','length','user-setting:','save','remove','update','emit','user-setting:update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5ed0,0xcb));var _0x05ed=function(_0x26fb6c,_0x5e2871){_0x26fb6c=_0x26fb6c-0x0;var _0x584765=_0x5ed0[_0x26fb6c];return _0x584765;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x05ed('0x0'),_0x05ed('0x1'),_0x05ed('0x2')];function createListener(_0x3b4f3d,_0x33254c){return function(_0x1ce7b1){_0x33254c[_0x05ed('0x3')](_0x3b4f3d,_0x1ce7b1);if(_0x3b4f3d===_0x05ed('0x4')){_0x33254c['emit'](_0x05ed('0x5')+_0x1ce7b1['UserId'],_0x1ce7b1);}};}exports['register']=function(_0x23f54a){for(var _0x7d2372=0x0,_0x31bfa4=events[_0x05ed('0x6')];_0x7d2372<_0x31bfa4;_0x7d2372++){var _0x1dbd21=events[_0x7d2372];var _0x4d50bb=createListener(_0x05ed('0x7')+_0x1dbd21,_0x23f54a);UserSettingEvents['on'](_0x1dbd21,_0x4d50bb);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7b8bb12..2628f01 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 _0x5f36=['removeQueues','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','messengerSoundNotification','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','put','/:id/password','changePassword','delete'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x5f36,0x81));var _0x65f3=function(_0x414797,_0x2a5f0b){_0x414797=_0x414797-0x0;var _0x2bb375=_0x5f36[_0x414797];return _0x2bb375;};'use strict';var multer=require('multer');var util=require(_0x65f3('0x0'));var path=require(_0x65f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x65f3('0x2'));var router=express['Router']();var fs_extra=require(_0x65f3('0x3'));var auth=require(_0x65f3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x65f3('0x5'));var controller=require(_0x65f3('0x6'));router['get']('/',auth[_0x65f3('0x7')](),controller[_0x65f3('0x8')]);router[_0x65f3('0x9')]('/describe',auth[_0x65f3('0x7')](),controller[_0x65f3('0xa')]);router[_0x65f3('0x9')](_0x65f3('0xb'),auth['isAuthenticated'](),controller['whoami']);router[_0x65f3('0x9')](_0x65f3('0xc'),auth[_0x65f3('0x7')](),controller[_0x65f3('0xd')]);router[_0x65f3('0x9')](_0x65f3('0xe'),auth[_0x65f3('0x7')](),controller['show']);router['get']('/:id/avatar',controller[_0x65f3('0xf')]);router[_0x65f3('0x9')](_0x65f3('0x10'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x11')]);router[_0x65f3('0x9')]('/:id/contacts',auth[_0x65f3('0x7')](),controller[_0x65f3('0x12')]);router[_0x65f3('0x9')](_0x65f3('0x13'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x14')]);router['get'](_0x65f3('0x15'),auth[_0x65f3('0x7')](),controller['getVoiceQueuesRt']);router[_0x65f3('0x9')](_0x65f3('0x16'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x17')]);router[_0x65f3('0x9')](_0x65f3('0x18'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x19')]);router[_0x65f3('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x65f3('0x1a')]);router[_0x65f3('0x9')](_0x65f3('0x1b'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x1c')]);router[_0x65f3('0x9')](_0x65f3('0x1d'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x1e')]);router[_0x65f3('0x9')]('/:id/mail/interactions',auth[_0x65f3('0x7')](),controller[_0x65f3('0x1f')]);router[_0x65f3('0x9')](_0x65f3('0x20'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x21')]);router['get'](_0x65f3('0x22'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x23')]);router[_0x65f3('0x9')]('/:id/whatsapp/interactions',auth[_0x65f3('0x7')](),controller['getWhatsappInteractions']);router[_0x65f3('0x9')](_0x65f3('0x24'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x25')]);router[_0x65f3('0x9')](_0x65f3('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0x65f3('0x9')](_0x65f3('0x27'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x28')]);router[_0x65f3('0x9')](_0x65f3('0x29'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x2a')]);router[_0x65f3('0x9')]('/:id/fax_accounts',auth[_0x65f3('0x7')](),controller[_0x65f3('0x2b')]);router[_0x65f3('0x9')](_0x65f3('0x2c'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x2d')]);router[_0x65f3('0x9')]('/:id/openchannel_accounts',auth[_0x65f3('0x7')](),controller[_0x65f3('0x2e')]);router[_0x65f3('0x9')](_0x65f3('0x2f'),auth['isAuthenticated'](),controller[_0x65f3('0x30')]);router[_0x65f3('0x9')]('/:id/chat_websites',auth[_0x65f3('0x7')](),controller[_0x65f3('0x31')]);router['get'](_0x65f3('0x32'),auth[_0x65f3('0x7')](),controller['getWhatsappAccounts']);router[_0x65f3('0x9')](_0x65f3('0x33'),auth[_0x65f3('0x7')](),controller['getScheduledCalls']);router[_0x65f3('0x9')](_0x65f3('0x34'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x35')]);router[_0x65f3('0x36')](_0x65f3('0x37'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x38')]);router[_0x65f3('0x36')]('/',auth[_0x65f3('0x7')](),controller[_0x65f3('0x39')]);router[_0x65f3('0x36')](_0x65f3('0x3a'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x3b')]);router[_0x65f3('0x36')](_0x65f3('0x13'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x3c')]);var upload=multer({'storage':multer[_0x65f3('0x3d')]({'destination':function(_0x93d89f,_0x2d6fed,_0x242b12){_0x242b12(null,path[_0x65f3('0x3e')](config[_0x65f3('0x3f')],_0x65f3('0x40')));},'filename':function(_0x48d31e,_0x13953c,_0x51df76){_0x51df76(null,util[_0x65f3('0x41')](_0x65f3('0x42'),Date[_0x65f3('0x43')](),_0x13953c[_0x65f3('0x44')]));}})});router[_0x65f3('0x36')](_0x65f3('0x45'),upload[_0x65f3('0x46')]('file'),controller['addAvatar']);router[_0x65f3('0x36')](_0x65f3('0x47'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x48')]);router[_0x65f3('0x36')](_0x65f3('0x49'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x4a')]);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0x65f3('0x4b')]);router['post'](_0x65f3('0x4c'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x4d')]);router['post'](_0x65f3('0x24'),auth['isAuthenticated'](),controller['addTeams']);router[_0x65f3('0x36')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x65f3('0x4e')]);router[_0x65f3('0x36')](_0x65f3('0x4f'),auth['isAuthenticated'](),controller[_0x65f3('0x50')]);router[_0x65f3('0x36')](_0x65f3('0x51'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x52')]);router[_0x65f3('0x36')](_0x65f3('0x53'),auth[_0x65f3('0x7')](),controller['addSmsInteractions']);router[_0x65f3('0x36')](_0x65f3('0x54'),auth['isAuthenticated'](),controller[_0x65f3('0x55')]);router['post'](_0x65f3('0x56'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x57')]);router[_0x65f3('0x36')](_0x65f3('0x58'),auth[_0x65f3('0x7')](),controller['addFaxAccounts']);router[_0x65f3('0x36')](_0x65f3('0x2c'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x59')]);router[_0x65f3('0x36')](_0x65f3('0x5a'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x5b')]);router[_0x65f3('0x36')](_0x65f3('0x2f'),auth[_0x65f3('0x7')](),controller['addSmsAccounts']);router[_0x65f3('0x36')](_0x65f3('0x5c'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x5d')]);router[_0x65f3('0x36')](_0x65f3('0x32'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x5e')]);router[_0x65f3('0x36')]('/:id/api_key',auth[_0x65f3('0x7')](),controller['createApiKey']);router[_0x65f3('0x5f')](_0x65f3('0xe'),auth[_0x65f3('0x7')](),controller['update']);router[_0x65f3('0x5f')](_0x65f3('0x60'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x61')]);router[_0x65f3('0x62')](_0x65f3('0x13'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x63')]);router[_0x65f3('0x62')](_0x65f3('0x24'),auth[_0x65f3('0x7')](),controller['removeTeams']);router[_0x65f3('0x62')](_0x65f3('0xe'),auth[_0x65f3('0x7')](),controller['destroy']);router[_0x65f3('0x62')](_0x65f3('0x64'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x65')]);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x65f3('0x62')](_0x65f3('0x51'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x66')]);router[_0x65f3('0x62')](_0x65f3('0x53'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x67')]);router[_0x65f3('0x62')](_0x65f3('0x54'),auth['isAuthenticated'](),controller[_0x65f3('0x68')]);router[_0x65f3('0x62')](_0x65f3('0x56'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x69')]);router[_0x65f3('0x62')]('/:id/fax_accounts',auth[_0x65f3('0x7')](),controller[_0x65f3('0x6a')]);router[_0x65f3('0x62')]('/:id/mail_accounts',auth[_0x65f3('0x7')](),controller[_0x65f3('0x6b')]);router['delete'](_0x65f3('0x5a'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x6c')]);router[_0x65f3('0x62')](_0x65f3('0x2f'),auth['isAuthenticated'](),controller[_0x65f3('0x6d')]);router['delete']('/:id/chat_websites',auth[_0x65f3('0x7')](),controller[_0x65f3('0x6e')]);router[_0x65f3('0x62')](_0x65f3('0x32'),auth[_0x65f3('0x7')](),controller[_0x65f3('0x6f')]);router[_0x65f3('0x62')](_0x65f3('0x34'),auth[_0x65f3('0x7')](),controller['removeApiKey']);router[_0x65f3('0x36')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x65f3('0x70')]);module[_0x65f3('0x71')]=router; \ No newline at end of file +var _0xc73f=['removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions'];(function(_0x59c543,_0x12cbf2){var _0x44548a=function(_0x1b752f){while(--_0x1b752f){_0x59c543['push'](_0x59c543['shift']());}};_0x44548a(++_0x12cbf2);}(_0xc73f,0xe2));var _0xfc73=function(_0x1241bb,_0x2a59d1){_0x1241bb=_0x1241bb-0x0;var _0x2db34b=_0xc73f[_0x1241bb];return _0x2db34b;};'use strict';var multer=require(_0xfc73('0x0'));var util=require(_0xfc73('0x1'));var path=require('path');var timeout=require(_0xfc73('0x2'));var express=require(_0xfc73('0x3'));var router=express[_0xfc73('0x4')]();var fs_extra=require(_0xfc73('0x5'));var auth=require(_0xfc73('0x6'));var interaction=require(_0xfc73('0x7'));var config=require('../../config/environment');var controller=require(_0xfc73('0x8'));router['get']('/',auth[_0xfc73('0x9')](),controller[_0xfc73('0xa')]);router[_0xfc73('0xb')](_0xfc73('0xc'),auth[_0xfc73('0x9')](),controller[_0xfc73('0xd')]);router[_0xfc73('0xb')]('/whoami',auth[_0xfc73('0x9')](),controller[_0xfc73('0xe')]);router[_0xfc73('0xb')]('/presence',auth[_0xfc73('0x9')](),controller['getPresence']);router[_0xfc73('0xb')](_0xfc73('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xfc73('0xb')](_0xfc73('0x10'),controller[_0xfc73('0x11')]);router[_0xfc73('0xb')](_0xfc73('0x12'),auth[_0xfc73('0x9')](),controller['getOpenTabs']);router[_0xfc73('0xb')]('/:id/contacts',auth[_0xfc73('0x9')](),controller[_0xfc73('0x13')]);router[_0xfc73('0xb')](_0xfc73('0x14'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x15')]);router['get'](_0xfc73('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router['get'](_0xfc73('0x17'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x18')]);router[_0xfc73('0xb')](_0xfc73('0x19'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x1a')]);router[_0xfc73('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xfc73('0x1b')]);router[_0xfc73('0xb')](_0xfc73('0x1c'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x1d')]);router['get'](_0xfc73('0x1e'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x1f')]);router[_0xfc73('0xb')](_0xfc73('0x20'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x21')]);router[_0xfc73('0xb')]('/:id/sms/interactions',auth[_0xfc73('0x9')](),controller[_0xfc73('0x22')]);router[_0xfc73('0xb')](_0xfc73('0x23'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x24')]);router[_0xfc73('0xb')](_0xfc73('0x25'),auth[_0xfc73('0x9')](),controller['getWhatsappInteractions']);router[_0xfc73('0xb')](_0xfc73('0x26'),auth[_0xfc73('0x9')](),controller['getTeams']);router[_0xfc73('0xb')](_0xfc73('0x27'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x28')]);router[_0xfc73('0xb')]('/:id/agents',auth[_0xfc73('0x9')](),controller['getAgents']);router[_0xfc73('0xb')](_0xfc73('0x29'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x2a')]);router[_0xfc73('0xb')](_0xfc73('0x2b'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x2c')]);router['get']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xfc73('0x2d')]);router[_0xfc73('0xb')](_0xfc73('0x2e'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x2f')]);router[_0xfc73('0xb')](_0xfc73('0x30'),auth[_0xfc73('0x9')](),controller['getSmsAccounts']);router[_0xfc73('0xb')](_0xfc73('0x31'),auth['isAuthenticated'](),controller[_0xfc73('0x32')]);router[_0xfc73('0xb')](_0xfc73('0x33'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x34')]);router[_0xfc73('0xb')](_0xfc73('0x35'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xfc73('0xb')](_0xfc73('0x36'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x37')]);router[_0xfc73('0x38')]('/:id/contacts',auth[_0xfc73('0x9')](),controller['addContacts']);router[_0xfc73('0x38')]('/',auth[_0xfc73('0x9')](),controller[_0xfc73('0x39')]);router[_0xfc73('0x38')](_0xfc73('0x3a'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x3b')]);router[_0xfc73('0x38')]('/:id/queues',auth['isAuthenticated'](),controller[_0xfc73('0x3c')]);var upload=multer({'storage':multer[_0xfc73('0x3d')]({'destination':function(_0x48ad0f,_0x22bd51,_0x38930a){_0x38930a(null,path['join'](config[_0xfc73('0x3e')],_0xfc73('0x3f')));},'filename':function(_0x19e946,_0x35ddb7,_0x23b53a){_0x23b53a(null,util[_0xfc73('0x40')](_0xfc73('0x41'),Date[_0xfc73('0x42')](),_0x35ddb7[_0xfc73('0x43')]));}})});router[_0xfc73('0x38')](_0xfc73('0x10'),upload[_0xfc73('0x44')](_0xfc73('0x45')),controller['addAvatar']);router[_0xfc73('0x38')](_0xfc73('0x46'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x47')]);router[_0xfc73('0x38')](_0xfc73('0x48'),auth[_0xfc73('0x9')](),controller['logout']);router[_0xfc73('0x38')](_0xfc73('0x49'),auth[_0xfc73('0x9')](),controller['pause']);router[_0xfc73('0x38')](_0xfc73('0x4a'),auth[_0xfc73('0x9')](),controller['unpause']);router[_0xfc73('0x38')](_0xfc73('0x26'),auth['isAuthenticated'](),controller['addTeams']);router[_0xfc73('0x38')]('/:id/chat_interactions',auth[_0xfc73('0x9')](),controller[_0xfc73('0x4b')]);router[_0xfc73('0x38')](_0xfc73('0x4c'),auth[_0xfc73('0x9')](),controller['addMailInteractions']);router[_0xfc73('0x38')](_0xfc73('0x4d'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x4e')]);router[_0xfc73('0x38')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xfc73('0x4f')]);router[_0xfc73('0x38')](_0xfc73('0x50'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x51')]);router[_0xfc73('0x38')](_0xfc73('0x52'),auth[_0xfc73('0x9')](),controller['addWhatsappInteractions']);router[_0xfc73('0x38')](_0xfc73('0x2b'),auth['isAuthenticated'](),controller[_0xfc73('0x53')]);router['post'](_0xfc73('0x54'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x55')]);router['post'](_0xfc73('0x2e'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x56')]);router['post'](_0xfc73('0x30'),auth['isAuthenticated'](),controller[_0xfc73('0x57')]);router[_0xfc73('0x38')](_0xfc73('0x31'),auth[_0xfc73('0x9')](),controller['addChatWebsites']);router[_0xfc73('0x38')](_0xfc73('0x33'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x58')]);router['post'](_0xfc73('0x36'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x59')]);router['put']('/:id',auth[_0xfc73('0x9')](),controller['update']);router[_0xfc73('0x5a')](_0xfc73('0x5b'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x5c')]);router[_0xfc73('0x5d')](_0xfc73('0x14'),auth['isAuthenticated'](),controller[_0xfc73('0x5e')]);router[_0xfc73('0x5d')](_0xfc73('0x26'),auth['isAuthenticated'](),controller[_0xfc73('0x5f')]);router[_0xfc73('0x5d')]('/:id',auth[_0xfc73('0x9')](),controller[_0xfc73('0x60')]);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xfc73('0x61')]);router['delete'](_0xfc73('0x4c'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xfc73('0x5d')](_0xfc73('0x4d'),auth['isAuthenticated'](),controller[_0xfc73('0x62')]);router[_0xfc73('0x5d')](_0xfc73('0x63'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x64')]);router[_0xfc73('0x5d')](_0xfc73('0x50'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x65')]);router['delete'](_0xfc73('0x52'),auth[_0xfc73('0x9')](),controller['removeWhatsappInteractions']);router['delete'](_0xfc73('0x2b'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x66')]);router[_0xfc73('0x5d')](_0xfc73('0x54'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x67')]);router[_0xfc73('0x5d')](_0xfc73('0x2e'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x68')]);router[_0xfc73('0x5d')](_0xfc73('0x30'),auth['isAuthenticated'](),controller[_0xfc73('0x69')]);router[_0xfc73('0x5d')](_0xfc73('0x31'),auth[_0xfc73('0x9')](),controller['removeChatWebsites']);router[_0xfc73('0x5d')](_0xfc73('0x33'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x6a')]);router[_0xfc73('0x5d')](_0xfc73('0x36'),auth[_0xfc73('0x9')](),controller[_0xfc73('0x6b')]);router[_0xfc73('0x38')]('/:id/messengerSoundNotification',auth[_0xfc73('0x9')](),controller['messengerSoundNotification']);module[_0xfc73('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9710d3f..40be5d7 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 _0x7e8b=['dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','dtlssetup','/etc/pki/tls/certs/motion.crt','TEXT','permissions','VIRTUAL','string','true','screenrecording','blocked','blockedAt','util','lodash','exports','STRING','name','setDataValue','fullname','format','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','uas','fingerprint','certificate','passive','nonat','update,nonat','get','isArray','udp','wss','avpf','force_avp','icesupport','dtlsenable'];(function(_0xaaf335,_0x1d6e75){var _0x3c6c9c=function(_0x55363b){while(--_0x55363b){_0xaaf335['push'](_0xaaf335['shift']());}};_0x3c6c9c(++_0x1d6e75);}(_0x7e8b,0xb7));var _0xb7e8=function(_0x5ca927,_0x38c385){_0x5ca927=_0x5ca927-0x0;var _0x1eb900=_0x7e8b[_0x5ca927];return _0x1eb900;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xb7e8('0x0'));var _=require(_0xb7e8('0x1'));module[_0xb7e8('0x2')]={'name':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':![],'unique':_0xb7e8('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5de437){this[_0xb7e8('0x5')](_0xb7e8('0x4'),_0x5de437);this['setDataValue']('defaultuser',_0x5de437);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':![],'set':function(_0x14fb77){this['setDataValue'](_0xb7e8('0x6'),_0x14fb77);this[_0xb7e8('0x5')]('callerid',util[_0xb7e8('0x7')]('\x22%s\x22\x20<%s>',_0x14fb77,this[_0xb7e8('0x8')](_0xb7e8('0x9'))));}},'alias':{'type':Sequelize[_0xb7e8('0x3')]},'email':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':![],'unique':_0xb7e8('0xa'),'validate':{'isEmail':!![]},'set':function(_0x406e00){if(_0x406e00){this[_0xb7e8('0x5')](_0xb7e8('0xa'),_0x406e00[_0xb7e8('0xb')]());}}},'role':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0xd'),'user',_0xb7e8('0xe'),_0xb7e8('0xf')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb7e8('0x3')],'defaultValue':_0xb7e8('0x10')},'internal':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x44fb6b){this['setDataValue'](_0xb7e8('0x9'),_0x44fb6b);this['setDataValue'](_0xb7e8('0x12'),_0x44fb6b);this[_0xb7e8('0x5')](_0xb7e8('0x13'),util['format']('\x22%s\x22\x20<%s>',this['getDataValue']('fullname'),_0x44fb6b));}},'salt':{'type':Sequelize[_0xb7e8('0x3')]},'phone':{'type':Sequelize[_0xb7e8('0x3')]},'mobile':{'type':Sequelize[_0xb7e8('0x3')]},'address':{'type':Sequelize[_0xb7e8('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb7e8('0x3')]},'country':{'type':Sequelize[_0xb7e8('0x3')]},'online':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb7e8('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb7e8('0x3')],'defaultValue':_0xb7e8('0x16')},'lastPauseAt':{'type':Sequelize[_0xb7e8('0x15')]},'chatCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![],'defaultValue':_0xb7e8('0x17')},'ipaddr':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb7e8('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0xb7e8('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb7e8('0x19')},'callingpres':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x1a'),_0xb7e8('0x1b'),_0xb7e8('0x1c'),_0xb7e8('0x1d'),_0xb7e8('0x1e'),'PROHIB_PASSED_SCREEN',_0xb7e8('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x9d1ae7){this[_0xb7e8('0x5')](_0xb7e8('0x20'),_0x9d1ae7?_0x9d1ae7[_0xb7e8('0x21')](','):null);},'get':function(){return this[_0xb7e8('0x8')](_0xb7e8('0x20'))?this['getDataValue']('transport')[_0xb7e8('0x22')](','):null;},'comment':_0xb7e8('0x23')},'dtmfmode':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x24'),_0xb7e8('0x25'),_0xb7e8('0x26'),_0xb7e8('0x27'),_0xb7e8('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no','nonat',_0xb7e8('0x2a'),_0xb7e8('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x52f71e){this[_0xb7e8('0x5')](_0xb7e8('0x2c'),_0x52f71e?_0x52f71e[_0xb7e8('0x21')](','):null);},'get':function(){return this[_0xb7e8('0x8')](_0xb7e8('0x2c'))?this[_0xb7e8('0x8')](_0xb7e8('0x2c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb7e8('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb7e8('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb7e8('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb7e8('0x3')]},'disallow':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7e8('0x2d'),'set':function(_0x5da04b){this['setDataValue'](_0xb7e8('0x2e'),_0x5da04b?_0x5da04b['join'](';'):_0xb7e8('0x2d'));},'get':function(){return this[_0xb7e8('0x8')](_0xb7e8('0x2e'))?this[_0xb7e8('0x8')](_0xb7e8('0x2e'))[_0xb7e8('0x22')](';'):null;},'comment':_0xb7e8('0x2f')},'autoframing':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![],'set':function(_0x1647c6){this['setDataValue']('insecure',_0x1647c6?_0x1647c6[_0xb7e8('0x21')](','):null);},'get':function(){return this[_0xb7e8('0x8')](_0xb7e8('0x30'))?this['getDataValue'](_0xb7e8('0x30'))['split'](','):null;},'comment':_0xb7e8('0x31')},'trustrpid':{'type':Sequelize[_0xb7e8('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no',_0xb7e8('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![],'defaultValue':_0xb7e8('0x33')},'amaflags':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':_0xb7e8('0x29')},'busylevel':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xb7e8('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb7e8('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb7e8('0xc')]('accept',_0xb7e8('0x34'),_0xb7e8('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x36'),'uas'),'allowNull':!![],'defaultValue':_0xb7e8('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':_0xb7e8('0x29')},'keepalive':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb7e8('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no',_0xb7e8('0x38'),_0xb7e8('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xb7e8('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb7e8('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb7e8('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xb7e8('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb7e8('0xc')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb7e8('0xc')](_0xb7e8('0x29'),'no',_0xb7e8('0x3b'),'update',_0xb7e8('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb7e8('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xb7e8('0x15')]},'passwordResetAt':{'type':Sequelize[_0xb7e8('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0,'set':function(_0x31204c){this['setDataValue']('showWebBar',_0x31204c);var _0x526563=this[_0xb7e8('0x3d')]({'plain':!![]});switch(_0x31204c){case 0x0:case 0x1:var _0x407982=_0x526563['transport']?_[_0xb7e8('0x3e')](_0x526563['transport'])?_0x526563[_0xb7e8('0x20')][_0xb7e8('0x21')]():_0x526563[_0xb7e8('0x20')]:_0xb7e8('0x3f');if(_0x407982===_0xb7e8('0x40')){_0x407982=_0xb7e8('0x3f');}this[_0xb7e8('0x5')]('transport',_0x407982);this[_0xb7e8('0x5')]('encryption','no');this['setDataValue'](_0xb7e8('0x41'),null);this[_0xb7e8('0x5')](_0xb7e8('0x42'),null);this[_0xb7e8('0x5')](_0xb7e8('0x43'),null);this[_0xb7e8('0x5')](_0xb7e8('0x44'),null);this[_0xb7e8('0x5')](_0xb7e8('0x45'),null);this[_0xb7e8('0x5')]('dtlssetup',null);this[_0xb7e8('0x5')](_0xb7e8('0x46'),null);this[_0xb7e8('0x5')](_0xb7e8('0x47'),null);this['setDataValue'](_0xb7e8('0x48'),'no');break;case 0x2:this['setDataValue'](_0xb7e8('0x20'),_0xb7e8('0x40'));this[_0xb7e8('0x5')](_0xb7e8('0x49'),_0xb7e8('0x29'));this[_0xb7e8('0x5')]('avpf',_0xb7e8('0x29'));this[_0xb7e8('0x5')](_0xb7e8('0x42'),_0xb7e8('0x29'));this[_0xb7e8('0x5')](_0xb7e8('0x43'),_0xb7e8('0x29'));this[_0xb7e8('0x5')]('dtlsenable',_0xb7e8('0x29'));this['setDataValue'](_0xb7e8('0x45'),'no');this['setDataValue'](_0xb7e8('0x4a'),'actpass');this['setDataValue'](_0xb7e8('0x46'),_0x526563['dtlscertfile']||_0xb7e8('0x4b'));this[_0xb7e8('0x5')](_0xb7e8('0x47'),_0x526563[_0xb7e8('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xb7e8('0x48'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xb7e8('0x4c')],'set':function(_0x5e0800){this['setDataValue'](_0xb7e8('0x4d'),_0x5e0800?_0x5e0800[_0xb7e8('0x21')](','):[]);},'get':function(){return this[_0xb7e8('0x8')](_0xb7e8('0x4d'))?_['map'](this[_0xb7e8('0x8')](_0xb7e8('0x4d'))[_0xb7e8('0x22')](','),function(_0x9364d7){return parseInt(_0x9364d7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb7e8('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb7e8('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb7e8('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb7e8('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb7e8('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb7e8('0x4e')],'get':function(){return this[_0xb7e8('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb7e8('0x8')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb7e8('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb7e8('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x222629){if(typeof _0x222629===_0xb7e8('0x4f')){var _0x2205b9=_0x222629==='1'?!![]:_0x222629==='0'?![]:_0x222629===_0xb7e8('0x50')?!![]:_0x222629==='false'?![]:![];this[_0xb7e8('0x5')](_0xb7e8('0x51'),_0x2205b9);}else{this[_0xb7e8('0x5')](_0xb7e8('0x51'),_0x222629);}}},'blocked':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![],'set':function(_0x4dc4d3){this['setDataValue'](_0xb7e8('0x52'),_0x4dc4d3);if(_0x4dc4d3===!![]){this[_0xb7e8('0x5')](_0xb7e8('0x53'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xb7e8('0x5')](_0xb7e8('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0xb7e8('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb7e8('0x11')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb7e8('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xb7e8('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0xa031=['PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','certificate','active','update','TEXT','showWebBar','isArray','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x58bf37,_0x5c2a54){var _0x3fc1c5=function(_0x1e6a61){while(--_0x1e6a61){_0x58bf37['push'](_0x58bf37['shift']());}};_0x3fc1c5(++_0x5c2a54);}(_0xa031,0x8b));var _0x1a03=function(_0x407935,_0x28d521){_0x407935=_0x407935-0x0;var _0x17a97b=_0xa031[_0x407935];return _0x17a97b;};'use strict';var Sequelize=require(_0x1a03('0x0'));var moment=require(_0x1a03('0x1'));var util=require(_0x1a03('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'unique':_0x1a03('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2029bc){this[_0x1a03('0x5')]('name',_0x2029bc);this[_0x1a03('0x5')](_0x1a03('0x6'),_0x2029bc);},'comment':_0x1a03('0x7')},'fullname':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'set':function(_0x52c4e3){this['setDataValue'](_0x1a03('0x8'),_0x52c4e3);this[_0x1a03('0x5')](_0x1a03('0x9'),util[_0x1a03('0xa')](_0x1a03('0xb'),_0x52c4e3,this[_0x1a03('0xc')](_0x1a03('0xd'))));}},'alias':{'type':Sequelize[_0x1a03('0x3')]},'email':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'unique':_0x1a03('0xe'),'validate':{'isEmail':!![]},'set':function(_0xa9f6b7){if(_0xa9f6b7){this['setDataValue'](_0x1a03('0xe'),_0xa9f6b7['toLowerCase']());}}},'role':{'type':Sequelize[_0x1a03('0xf')]('admin',_0x1a03('0x10'),_0x1a03('0x11'),_0x1a03('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1a03('0x3')],'defaultValue':_0x1a03('0x13')},'internal':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':![],'unique':_0x1a03('0xd'),'set':function(_0x201c35){this[_0x1a03('0x5')](_0x1a03('0xd'),_0x201c35);this['setDataValue'](_0x1a03('0x15'),_0x201c35);this[_0x1a03('0x5')]('callerid',util[_0x1a03('0xa')](_0x1a03('0xb'),this[_0x1a03('0xc')](_0x1a03('0x8')),_0x201c35));}},'salt':{'type':Sequelize[_0x1a03('0x3')]},'phone':{'type':Sequelize[_0x1a03('0x3')]},'mobile':{'type':Sequelize[_0x1a03('0x3')]},'address':{'type':Sequelize[_0x1a03('0x3')]},'zipcode':{'type':Sequelize[_0x1a03('0x3')]},'userpic':{'type':Sequelize[_0x1a03('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x1a03('0x17')},'lastPauseAt':{'type':Sequelize[_0x1a03('0x18')]},'chatCapacity':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1a03('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1a03('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'defaultValue':_0x1a03('0x19')},'ipaddr':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x1a03('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x1a'),'user',_0x1a03('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'defaultValue':_0x1a03('0x1c')},'callingpres':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x1d'),'ALLOWED_PASSED_SCREEN',_0x1a03('0x1e'),_0x1a03('0x1f'),_0x1a03('0x20'),_0x1a03('0x21'),_0x1a03('0x22'),_0x1a03('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'defaultValue':_0x1a03('0x24'),'set':function(_0x51ab02){this[_0x1a03('0x5')](_0x1a03('0x25'),_0x51ab02?_0x51ab02[_0x1a03('0x26')](','):null);},'get':function(){return this[_0x1a03('0xc')](_0x1a03('0x25'))?this[_0x1a03('0xc')](_0x1a03('0x25'))[_0x1a03('0x27')](','):null;},'comment':_0x1a03('0x28')},'dtmfmode':{'type':Sequelize[_0x1a03('0xf')]('rfc2833',_0x1a03('0x29'),_0x1a03('0x2a'),_0x1a03('0x2b'),_0x1a03('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no',_0x1a03('0x2e'),'update',_0x1a03('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x59d96a){this[_0x1a03('0x5')](_0x1a03('0x30'),_0x59d96a?_0x59d96a['join'](','):null);},'get':function(){return this[_0x1a03('0xc')](_0x1a03('0x30'))?this['getDataValue'](_0x1a03('0x30'))[_0x1a03('0x27')](','):null;},'comment':_0x1a03('0x31')},'callgroup':{'type':Sequelize[_0x1a03('0x3')]},'namedcallgroup':{'type':Sequelize[_0x1a03('0x3')]},'pickupgroup':{'type':Sequelize[_0x1a03('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1a03('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1a03('0x3')]},'disallow':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'defaultValue':_0x1a03('0x32')},'allow':{'type':Sequelize[_0x1a03('0x3')],'allowNull':![],'defaultValue':_0x1a03('0x33'),'set':function(_0x2c46bc){this[_0x1a03('0x5')](_0x1a03('0x34'),_0x2c46bc?_0x2c46bc[_0x1a03('0x26')](';'):_0x1a03('0x33'));},'get':function(){return this[_0x1a03('0xc')]('allow')?this[_0x1a03('0xc')](_0x1a03('0x34'))[_0x1a03('0x27')](';'):null;},'comment':_0x1a03('0x35')},'autoframing':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'set':function(_0x22edfb){this[_0x1a03('0x5')](_0x1a03('0x36'),_0x22edfb?_0x22edfb['join'](','):null);},'get':function(){return this['getDataValue'](_0x1a03('0x36'))?this[_0x1a03('0xc')](_0x1a03('0x36'))[_0x1a03('0x27')](','):null;},'comment':_0x1a03('0x37')},'trustrpid':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no',_0x1a03('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x1a03('0x2d')},'busylevel':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no',_0x1a03('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1a03('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x3a'),'refuse',_0x1a03('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x3c'),_0x1a03('0x3d')),'allowNull':!![],'defaultValue':_0x1a03('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1a03('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1a03('0xf')]('yes','no','fingerprint',_0x1a03('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x3f'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1a03('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1a03('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1a03('0x2d'),'no',_0x1a03('0x2e'),_0x1a03('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1a03('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1a03('0x18')]},'passwordResetAt':{'type':Sequelize[_0x1a03('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1a03('0x41')]},'showWebBar':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0,'set':function(_0x3a71aa){this[_0x1a03('0x5')](_0x1a03('0x42'),_0x3a71aa);var _0xc77b82=this['get']({'plain':!![]});switch(_0x3a71aa){case 0x0:case 0x1:var _0x4c482e=_0xc77b82[_0x1a03('0x25')]?_[_0x1a03('0x43')](_0xc77b82['transport'])?_0xc77b82[_0x1a03('0x25')][_0x1a03('0x26')]():_0xc77b82['transport']:_0x1a03('0x24');if(_0x4c482e==='wss'){_0x4c482e=_0x1a03('0x24');}this[_0x1a03('0x5')]('transport',_0x4c482e);this[_0x1a03('0x5')](_0x1a03('0x44'),'no');this[_0x1a03('0x5')](_0x1a03('0x45'),null);this[_0x1a03('0x5')](_0x1a03('0x46'),null);this[_0x1a03('0x5')](_0x1a03('0x47'),null);this[_0x1a03('0x5')]('dtlsenable',null);this['setDataValue']('dtlsverify',null);this[_0x1a03('0x5')](_0x1a03('0x48'),null);this[_0x1a03('0x5')](_0x1a03('0x49'),null);this[_0x1a03('0x5')]('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x1a03('0x5')](_0x1a03('0x25'),'wss');this[_0x1a03('0x5')](_0x1a03('0x44'),_0x1a03('0x2d'));this['setDataValue']('avpf',_0x1a03('0x2d'));this[_0x1a03('0x5')](_0x1a03('0x46'),_0x1a03('0x2d'));this[_0x1a03('0x5')](_0x1a03('0x47'),_0x1a03('0x2d'));this[_0x1a03('0x5')](_0x1a03('0x4a'),_0x1a03('0x2d'));this[_0x1a03('0x5')](_0x1a03('0x4b'),'no');this[_0x1a03('0x5')](_0x1a03('0x48'),'actpass');this[_0x1a03('0x5')]('dtlscertfile',_0xc77b82[_0x1a03('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x1a03('0x5')](_0x1a03('0x4c'),_0xc77b82[_0x1a03('0x4c')]||'/etc/pki/tls/private/motion.key');this[_0x1a03('0x5')](_0x1a03('0x4d'),_0x1a03('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x1a03('0x41')],'set':function(_0x184e40){this['setDataValue'](_0x1a03('0x4e'),_0x184e40?_0x184e40[_0x1a03('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0x1a03('0x4e'))?_['map'](this[_0x1a03('0xc')]('permissions')['split'](','),function(_0x390a6b){return parseInt(_0x390a6b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1a03('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1a03('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1a03('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1a03('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1a03('0xf')](_0x1a03('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1a03('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1a03('0xc')](_0x1a03('0x4f'))?this[_0x1a03('0xc')](_0x1a03('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1a03('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x26fa3d){if(typeof _0x26fa3d===_0x1a03('0x50')){var _0x7907c0=_0x26fa3d==='1'?!![]:_0x26fa3d==='0'?![]:_0x26fa3d===_0x1a03('0x51')?!![]:_0x26fa3d===_0x1a03('0x52')?![]:![];this[_0x1a03('0x5')](_0x1a03('0x53'),_0x7907c0);}else{this[_0x1a03('0x5')](_0x1a03('0x53'),_0x26fa3d);}}},'blocked':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![],'set':function(_0x1d0975){this[_0x1a03('0x5')](_0x1a03('0x54'),_0x1d0975);if(_0x1d0975===!![]){this[_0x1a03('0x5')](_0x1a03('0x55'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0x1a03('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x1a03('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x1a03('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1a03('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1a03('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 01229c9..55d6941 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 _0xda75=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Unauthorized','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','remove','toLowerCase','emit','Queue:remove','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','includeAll','List','Tags','tag','getQueues','model','Queue','rawAttributes','filters','intersection','fields','order','sort','pick','merge','options','Unknown\x20role','nolimit','getVoiceQueuesRt','keys','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','loginInPause','intrf','user:%s','x-forwarded-for','connection','remoteAddress','getVoiceQueues','upsert','MemberReport','forEach','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','YYYY-MM-DD\x20HH:mm:ss','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','lastPauseAt','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','flattenDeep','addAgent','Voice','getDataValue','removeTeams','isArray','removeAgent','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','unknown','ringing','teams','queues','inbound','flatten','lower','col','asc','desc','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','lodash','squel','../../components/auth/service','../../components/contacts','../../config/logger','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','agent','userNotification:recalc:','destroy','then','get','admin','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','role','name','UserProfileResource','error','stack','send','User','fieldName','type','key','password','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','where','count','query','include','userSetting','true','UserSetting','attributes','findAll','rows','openTabs','length','push','dataValues','sms','fax','mail','openchannel','whatsapp','show','params','find','chat','all','body','catch','describe','addContacts','ids','internal','findById','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','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled'];(function(_0x2140a2,_0x537416){var _0x1dd6e=function(_0x24e44e){while(--_0x24e44e){_0x2140a2['push'](_0x2140a2['shift']());}};_0x1dd6e(++_0x537416);}(_0xda75,0x10b));var _0x5da7=function(_0x5c8949,_0x5d8182){_0x5c8949=_0x5c8949-0x0;var _0x886e7e=_0xda75[_0x5c8949];return _0x886e7e;};'use strict';var moment=require('moment');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x5da7('0x0'));var squel=require(_0x5da7('0x1'));var Redis=require('ioredis');var authService=require(_0x5da7('0x2'));var contacts=require(_0x5da7('0x3'));var qs=require('../../components/parsers/qs');var rta=require('../../components/realtime/agents');var logger=require(_0x5da7('0x4'))('api');var utils=require('../../config/utils');var config=require(_0x5da7('0x5'));var licenseUtil=require(_0x5da7('0x6'));var APIBadRequestError=require(_0x5da7('0x7'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x5da7('0x8')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x5da7('0x9'))['db'];var socket=require(_0x5da7('0xa'))(new Redis(config[_0x5da7('0xb')]));require(_0x5da7('0xc'))[_0x5da7('0xd')](socket);config['redis']=_['defaults'](config['redis'],{'host':_0x5da7('0xe'),'port':0x18eb});var values;function respondWithStatusCode(_0x31ee21,_0x390a20){_0x390a20=_0x390a20||0xcc;return function(_0x196f97){if(_0x196f97){return _0x31ee21[_0x5da7('0xf')](_0x390a20);}return _0x31ee21[_0x5da7('0x10')](_0x390a20)[_0x5da7('0x11')]();};}function respondWithResult(_0x204ceb,_0x99afdd){_0x99afdd=_0x99afdd||0xc8;return function(_0x14923d){if(_0x14923d){return _0x204ceb['status'](_0x99afdd)[_0x5da7('0x12')](_0x14923d);}};}function respondWithFilteredResult(_0x16cd1c,_0x45b900){return function(_0x31eafd){if(_0x31eafd){var _0x451e9c=typeof _0x45b900[_0x5da7('0x13')]===_0x5da7('0x14')&&typeof _0x45b900['limit']===_0x5da7('0x14');var _0x17f408=_0x31eafd['count'];var _0x35f61a=_0x451e9c?0x0:_0x45b900[_0x5da7('0x13')];var _0x58d191=_0x451e9c?_0x31eafd['count']:_0x45b900[_0x5da7('0x13')]+_0x45b900[_0x5da7('0x15')];var _0x1fe7bc;if(_0x58d191>=_0x17f408){_0x58d191=_0x17f408;_0x1fe7bc=0xc8;}else{_0x1fe7bc=0xce;}_0x16cd1c['status'](_0x1fe7bc);return _0x16cd1c[_0x5da7('0x16')](_0x5da7('0x17'),_0x35f61a+'-'+_0x58d191+'/'+_0x17f408)[_0x5da7('0x12')](_0x31eafd);}return null;};}function saveUpdates(_0x399dad){return function(_0x7199da){if(_0x7199da){return _0x7199da[_0x5da7('0x18')](_0x399dad)['then'](function(_0x32d4c2){if(_0x32d4c2['role']===_0x5da7('0x19')){socket['emit'](_0x5da7('0x1a')+_0x32d4c2['id'],_0x32d4c2);}return _0x32d4c2;});}return null;};}function removeEntity(_0x386171){return function(_0x59d2e9){if(_0x59d2e9){return _0x59d2e9[_0x5da7('0x1b')]()[_0x5da7('0x1c')](function(){var _0x1409b3=_0x59d2e9[_0x5da7('0x1d')]({'plain':!![]});if(_0x1409b3['role']===_0x5da7('0x1e'))return;var _0x21942e=[{'name':'Users','value':_0x5da7('0x1f'),'ignore':!![]},{'name':_0x5da7('0x20'),'value':'agent','ignore':![]},{'name':_0x5da7('0x21'),'value':_0x5da7('0x22'),'ignore':![]}];var _0xad054e=_(_0x21942e)[_0x5da7('0x23')](_0x5da7('0x24'))[_0x5da7('0x25')]('value')[_0x5da7('0x26')]();if(_[_0x5da7('0x27')](_0xad054e,_0x1409b3[_0x5da7('0x28')])){return;}var _0x59a15b=_['find'](_0x21942e,[_0x5da7('0x26'),_0x1409b3[_0x5da7('0x28')]])[_0x5da7('0x29')];return db[_0x5da7('0x2a')][_0x5da7('0x1b')]({'where':{'type':_0x59a15b,'resourceId':_0x1409b3['id']}})[_0x5da7('0x1c')](function(){return _0x59d2e9;});})[_0x5da7('0x1c')](function(){_0x386171[_0x5da7('0x10')](0xcc)[_0x5da7('0x11')]();});}};}function handleEntityNotFound(_0x29c386){return function(_0x3d1bce){if(!_0x3d1bce){_0x29c386['sendStatus'](0x194);}return _0x3d1bce;};}function handleError(_0x467a4f,_0x2f4cdd){_0x2f4cdd=_0x2f4cdd||0x1f4;return function(_0x5aa2b3){logger[_0x5da7('0x2b')](_0x5aa2b3[_0x5da7('0x2c')]);if(_0x5aa2b3['name']){delete _0x5aa2b3[_0x5da7('0x29')];}_0x467a4f[_0x5da7('0x10')](_0x2f4cdd)[_0x5da7('0x2d')](_0x5aa2b3);};}function getUserAttributes(){return _(db[_0x5da7('0x2e')]['rawAttributes'])['map'](function(_0x5b5fe6){return{'name':_0x5b5fe6[_0x5da7('0x2f')],'type':_0x5b5fe6[_0x5da7('0x30')][_0x5da7('0x31')]};})['filter'](function(_0x2aa171){return![_0x5da7('0x32'),'salt',_0x5da7('0x33'),_0x5da7('0x34'),_0x5da7('0x35'),_0x5da7('0x36')][_0x5da7('0x27')](_0x2aa171[_0x5da7('0x29')]);})['value']();}exports[_0x5da7('0x37')]=function(_0x468468,_0x3905cd){var _0x30d6f8={},_0x163e57={'count':0x0,'rows':[]};var _0x3c664e=getUserAttributes();_0x30d6f8=qs['getOptions'](_0x3c664e,_0x468468);var _0x231a3a={'where':_0x30d6f8[_0x5da7('0x38')]};return db[_0x5da7('0x2e')][_0x5da7('0x39')](_0x231a3a)[_0x5da7('0x1c')](function(_0x170f2f){_0x163e57[_0x5da7('0x39')]=_0x170f2f;if(_0x468468[_0x5da7('0x3a')]['includeAll']){_0x30d6f8[_0x5da7('0x3b')]=[{'all':!![]}];}if(_0x468468[_0x5da7('0x3a')][_0x5da7('0x3c')]===_0x5da7('0x3d')){_0x30d6f8[_0x5da7('0x3b')]=[{'model':db[_0x5da7('0x3e')],'as':_0x5da7('0x3c')}];}if(!_[_0x5da7('0x27')](_0x30d6f8[_0x5da7('0x3f')],'id')){_0x30d6f8['attributes']['push']('id');}return db[_0x5da7('0x2e')][_0x5da7('0x40')](_0x30d6f8);})[_0x5da7('0x1c')](function(_0x1e1e88){_0x163e57[_0x5da7('0x41')]=_0x1e1e88;if(_0x468468[_0x5da7('0x3a')][_0x5da7('0x42')]===_0x5da7('0x3d')){var _0x250e0e=[];for(var _0x584180=0x0;_0x584180<_0x163e57['rows'][_0x5da7('0x43')];_0x584180++){_0x250e0e[_0x5da7('0x44')](get_open_tabs('chat',_0x163e57[_0x5da7('0x41')][_0x584180][_0x5da7('0x45')]));_0x250e0e[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x46'),_0x163e57[_0x5da7('0x41')][_0x584180][_0x5da7('0x45')]));_0x250e0e['push'](get_open_tabs(_0x5da7('0x47'),_0x163e57[_0x5da7('0x41')][_0x584180]['dataValues']));_0x250e0e[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x48'),_0x163e57[_0x5da7('0x41')][_0x584180][_0x5da7('0x45')]));_0x250e0e[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x49'),_0x163e57[_0x5da7('0x41')][_0x584180][_0x5da7('0x45')]));_0x250e0e[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x4a'),_0x163e57[_0x5da7('0x41')][_0x584180][_0x5da7('0x45')]));}return Promise['all'](_0x250e0e)[_0x5da7('0x1c')](function(){return _0x163e57;});}else{return _0x163e57;}})[_0x5da7('0x1c')](respondWithFilteredResult(_0x3905cd,_0x30d6f8))['catch'](handleError(_0x3905cd,null));};exports[_0x5da7('0x4b')]=function(_0xc394a1,_0x5a697c){var _0x470282=getUserAttributes();_0xc394a1[_0x5da7('0x3a')]['id']=_0xc394a1[_0x5da7('0x4c')]['id'];var _0x1138a5=qs['getOptions'](_0x470282,_0xc394a1);if(_0xc394a1[_0x5da7('0x3a')]['includeAll']){_0x1138a5[_0x5da7('0x3b')]=[{'all':!![]}];}if(_0xc394a1[_0x5da7('0x3a')][_0x5da7('0x3c')]===_0x5da7('0x3d')){_0x1138a5[_0x5da7('0x3b')]=[{'model':db[_0x5da7('0x3e')],'as':_0x5da7('0x3c')}];}_0x1138a5=_['merge']({},_0x1138a5,_0xc394a1['options']);if(!_[_0x5da7('0x27')](_0x1138a5[_0x5da7('0x3f')],'id')){_0x1138a5[_0x5da7('0x3f')][_0x5da7('0x44')]('id');}return db[_0x5da7('0x2e')][_0x5da7('0x4d')](_0x1138a5)[_0x5da7('0x1c')](handleEntityNotFound(_0x5a697c,null))[_0x5da7('0x1c')](function(_0x24b9ef){var _0x2bc1fc=[];values=_0x24b9ef;if(_0xc394a1[_0x5da7('0x3a')][_0x5da7('0x42')]==='true'){_0x2bc1fc[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x4e'),_0x24b9ef['dataValues']));_0x2bc1fc[_0x5da7('0x44')](get_open_tabs('sms',_0x24b9ef[_0x5da7('0x45')]));_0x2bc1fc[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x49'),_0x24b9ef[_0x5da7('0x45')]));_0x2bc1fc[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x4a'),_0x24b9ef['dataValues']));_0x2bc1fc['push'](get_open_tabs(_0x5da7('0x47'),_0x24b9ef[_0x5da7('0x45')]));_0x2bc1fc[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x48'),_0x24b9ef['dataValues']));return Promise[_0x5da7('0x4f')](_0x2bc1fc);}else{return values;}})['then'](function(){return values;})[_0x5da7('0x1c')](respondWithResult(_0x5a697c,null))['catch'](handleError(_0x5a697c,null));};exports[_0x5da7('0x18')]=function(_0x1a8b78,_0xd1aee7){if(_0x1a8b78['body']['id']){delete _0x1a8b78[_0x5da7('0x50')]['id'];}delete _0x1a8b78[_0x5da7('0x50')]['role'];return db['User'][_0x5da7('0x4d')]({'where':{'id':_0x1a8b78[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0xd1aee7,null))[_0x5da7('0x1c')](saveUpdates(_0x1a8b78[_0x5da7('0x50')],null))[_0x5da7('0x1c')](respondWithResult(_0xd1aee7,null))[_0x5da7('0x51')](handleError(_0xd1aee7,null));};exports['describe']=function(_0x443b30,_0x53e3af){return db[_0x5da7('0x2e')][_0x5da7('0x52')]()[_0x5da7('0x1c')](respondWithResult(_0x53e3af,null))['catch'](handleError(_0x53e3af,null));};exports[_0x5da7('0x53')]=function(_0x3220fa,_0x3c6604){return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x3220fa['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x3c6604,null))[_0x5da7('0x1c')](function(_0x6af17d){if(_0x6af17d){return _0x6af17d['addContacts'](_0x3220fa[_0x5da7('0x50')][_0x5da7('0x54')],_['omit'](_0x3220fa[_0x5da7('0x50')],[_0x5da7('0x54'),'id'])||{});}})['then'](respondWithResult(_0x3c6604,null))['catch'](handleError(_0x3c6604,null));};function validateUser(_0x34fbc0){return new Promise(function(_0x17712a,_0x191ee0){if(_0x34fbc0[_0x5da7('0x55')])return _0x17712a(_0x34fbc0);return db['Setting'][_0x5da7('0x56')](0x1)['then'](function(_0x8f0edf){if(_0x8f0edf[_0x5da7('0x57')])authService[_0x5da7('0x58')](_0x34fbc0[_0x5da7('0x32')]);db[_0x5da7('0x2e')][_0x5da7('0x59')](_0x5da7('0x55'))[_0x5da7('0x1c')](function(_0x1de14a){if(_[_0x5da7('0x5a')](_0x1de14a)){_0x34fbc0['internal']=_0x8f0edf[_0x5da7('0x5b')]||0x1;return;}if(_['isNil'](_0x8f0edf[_0x5da7('0x5b')])||_0x8f0edf[_0x5da7('0x5b')]===_0x1de14a){_0x34fbc0['internal']=_0x1de14a+0x1;return;}if(_0x8f0edf[_0x5da7('0x5b')]>_0x1de14a){_0x34fbc0['internal']=_0x8f0edf[_0x5da7('0x5b')];return;}return db[_0x5da7('0x5c')][_0x5da7('0x3a')](_0x5da7('0x5d'),{'type':db[_0x5da7('0x5c')][_0x5da7('0x5e')][_0x5da7('0x5f')]})['then'](function(_0x3e3dcd){if(_0x3e3dcd&&_0x3e3dcd[_0x5da7('0x43')]){for(var _0x21280b=0x0,_0x28ce68=_0x3e3dcd[_0x5da7('0x43')];_0x21280b<_0x28ce68&&_[_0x5da7('0x5a')](_0x34fbc0['internal']);_0x21280b++){if(_0x8f0edf[_0x5da7('0x5b')]<=_0x3e3dcd[_0x21280b][_0x5da7('0x60')]){_0x34fbc0['internal']=_0x3e3dcd[_0x21280b][_0x5da7('0x60')];}else if(_0x8f0edf[_0x5da7('0x5b')]>_0x3e3dcd[_0x21280b][_0x5da7('0x60')]&&_0x8f0edf['min_internal']<=_0x3e3dcd[_0x21280b]['to']){_0x34fbc0[_0x5da7('0x55')]=_0x8f0edf[_0x5da7('0x5b')];}}}if(_[_0x5da7('0x5a')](_0x34fbc0[_0x5da7('0x55')])){_0x34fbc0['internal']=_0x1de14a+0x1;}return _0x17712a(_0x34fbc0);});});})[_0x5da7('0x51')](function(_0x159922){_0x191ee0(_0x159922);});});}function updateUser(_0x1a9aba){return new Promise(function(_0x2af7e7,_0x2dbb77){try{if(_0x1a9aba[_0x5da7('0x61')]){_0x1a9aba[_0x5da7('0x62')]=_0x1a9aba[_0x5da7('0x55')];_0x1a9aba[_0x5da7('0x63')]={'mailbox':_0x1a9aba[_0x5da7('0x55')],'password':_0x1a9aba[_0x5da7('0x32')],'fullname':_0x1a9aba[_0x5da7('0x64')],'email':_0x1a9aba[_0x5da7('0x65')]};}if(_0x1a9aba[_0x5da7('0x28')]===_0x5da7('0x19')){if(!_0x1a9aba[_0x5da7('0x66')])_0x1a9aba[_0x5da7('0x66')]=['101',_0x5da7('0x67'),_0x5da7('0x68'),_0x5da7('0x69'),_0x5da7('0x6a'),_0x5da7('0x6b'),_0x5da7('0x6c'),_0x5da7('0x6d'),_0x5da7('0x6e'),'108','109',_0x5da7('0x6f'),_0x5da7('0x70'),_0x5da7('0x71'),_0x5da7('0x72')];}_0x2af7e7(_0x1a9aba);}catch(_0x18b6b0){_0x2dbb77(_0x18b6b0);}});}exports[_0x5da7('0x73')]=function(_0x56ad3b,_0x490eb0){if(_0x56ad3b[_0x5da7('0x1f')]['role']===_0x5da7('0x19'))throw new Error('Unauthorized');if(_0x56ad3b[_0x5da7('0x50')][_0x5da7('0x28')]==='user'&&_0x56ad3b['user']['role']!==_0x5da7('0x1e')){throw new Error(_0x5da7('0x74'));}if(_0x56ad3b[_0x5da7('0x50')][_0x5da7('0x28')]==='admin'&&_0x56ad3b['user']['role']!==_0x5da7('0x1e')){throw new Error(_0x5da7('0x75'));}return licenseUtil[_0x5da7('0x76')]([_0x56ad3b['body']])[_0x5da7('0x1c')](function(){return validateUser(_0x56ad3b[_0x5da7('0x50')]);})['then'](function(_0x4e08a1){return updateUser(_0x4e08a1)[_0x5da7('0x1c')](function(_0x1c3006){if(_0x1c3006[_0x5da7('0x28')]===_0x5da7('0x1e')){_0x1c3006['settingsEnabled']=_0x56ad3b[_0x5da7('0x1f')][_0x5da7('0x77')];delete _0x1c3006[_0x5da7('0x78')];}return _0x1c3006;});})['then'](function(_0x4f95bf){return db['User'][_0x5da7('0x73')](_0x4f95bf,{'include':[{'model':db['VoiceMail'],'as':_0x5da7('0x63')}]});})[_0x5da7('0x1c')](function(_0x199559){if(_0x56ad3b['body'][_0x5da7('0x28')]===_0x5da7('0x1f'))return _0x199559;if(_0x56ad3b['user'][_0x5da7('0x28')]!=='user')return _0x199559;return db['UserProfileSection'][_0x5da7('0x4d')]({'where':{'name':_0x199559[_0x5da7('0x28')]===_0x5da7('0x19')?'Agents':'Telephones','userProfileId':_0x56ad3b[_0x5da7('0x1f')][_0x5da7('0x78')]},'raw':!![]})[_0x5da7('0x1c')](function(_0x4a089d){if(!_0x4a089d||_0x4a089d[_0x5da7('0x79')]!=0x0)return _0x199559;return db['UserProfileResource']['create']({'name':_0x199559[_0x5da7('0x29')],'resourceId':_0x199559['id'],'type':_0x4a089d[_0x5da7('0x29')],'sectionId':_0x4a089d['id']},{})[_0x5da7('0x1c')](function(){return _0x199559;});})['catch'](function(_0x44fee3){logger[_0x5da7('0x2b')](_0x5da7('0x7a'),_0x44fee3);throw _0x44fee3;});})['then'](respondWithResult(_0x490eb0,0xc9))[_0x5da7('0x51')](handleError(_0x490eb0,null));};exports[_0x5da7('0x7b')]=function(_0x3f612c,_0x4030fe){var _0x51356a=_0x3f612c[_0x5da7('0x50')];var _0x1b199d=[];if(_0x3f612c[_0x5da7('0x1f')][_0x5da7('0x28')]===_0x5da7('0x19'))throw new Error('Unauthorized');if(_[_0x5da7('0x7c')](_0x51356a,[_0x5da7('0x28'),'user'])&&_0x3f612c['user']['role']!==_0x5da7('0x1e')){throw new Error(_0x5da7('0x74'));}if(_['some'](_0x51356a,['role',_0x5da7('0x1e')])&&_0x3f612c[_0x5da7('0x1f')][_0x5da7('0x28')]!==_0x5da7('0x1e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x51356a)[_0x5da7('0x1c')](function(){return validateUser(_0x51356a[0x0]);})[_0x5da7('0x1c')](function(){for(var _0x671799=0x1;_0x671799<_0x51356a[_0x5da7('0x43')];_0x671799++){var _0x23cbc1=_0x51356a[_0x671799-0x1][_0x5da7('0x55')];if(!_0x51356a[_0x671799][_0x5da7('0x55')])_0x51356a[_0x671799][_0x5da7('0x55')]=_0x23cbc1+0x1;_0x1b199d[_0x5da7('0x44')](validateUser(_0x51356a[_0x671799]));}return Promise[_0x5da7('0x4f')](_0x1b199d);})['then'](function(){_0x1b199d=[];for(var _0x2a83d8=0x0;_0x2a83d8<_0x51356a[_0x5da7('0x43')];_0x2a83d8++){_0x1b199d[_0x5da7('0x44')](updateUser(_0x51356a[_0x2a83d8]));}return Promise[_0x5da7('0x4f')](_0x1b199d);})[_0x5da7('0x1c')](function(){_0x1b199d=_0x51356a[_0x5da7('0x25')](function(_0x56fb20){return db['User']['create'](_0x56fb20,{'include':[{'model':db[_0x5da7('0x63')],'as':_0x5da7('0x63')}]})[_0x5da7('0x1c')](function(_0xf811b7){_0x56fb20['id']=_0xf811b7['id'];return _0x56fb20;});});return Promise['all'](_0x1b199d);})['then'](function(_0x7210e7){if(_0x3f612c['body']['role']==='user')return _0x7210e7;if(_0x3f612c[_0x5da7('0x1f')][_0x5da7('0x28')]!=='user')return _0x7210e7;var _0xbff021=_[_0x5da7('0x7c')](_0x7210e7,function(_0x3b0d86){return _0x3b0d86['role']===_0x5da7('0x19')||_0x3b0d86['role']===_0x5da7('0x22');});if(!_0xbff021)return _0x7210e7;return db['UserProfileSection'][_0x5da7('0x40')]({'where':{'name':{'$or':['Agents',_0x5da7('0x21')]},'userProfileId':_0x3f612c[_0x5da7('0x1f')]['userProfileId']},'raw':!![]})[_0x5da7('0x1c')](function(_0x5c34a4){if(_[_0x5da7('0x7d')](_0x5c34a4)||!_[_0x5da7('0x7c')](_0x5c34a4,[_0x5da7('0x79'),0x0]))return _0x7210e7;_0x1b199d=[];var _0x2c05fb=_(_0x5c34a4)['map'](function(_0x519b33){if(_0x519b33[_0x5da7('0x79')]===0x1)return;return _0x519b33[_0x5da7('0x29')]===_0x5da7('0x20')?_0x5da7('0x19'):'telephone';})[_0x5da7('0x7e')]()['value']();for(var _0x373943=0x0;_0x373943<_0x7210e7[_0x5da7('0x43')];_0x373943++){if(!_[_0x5da7('0x27')](_0x2c05fb,_0x7210e7[_0x373943][_0x5da7('0x28')]))return;var _0x48a3e3=_0x7210e7[_0x373943][_0x5da7('0x28')]===_0x5da7('0x19')?_0x5da7('0x20'):_0x5da7('0x21');_0x1b199d[_0x5da7('0x44')](db['UserProfileResource'][_0x5da7('0x73')]({'name':_0x7210e7[_0x373943][_0x5da7('0x29')],'resourceId':_0x7210e7[_0x373943]['id'],'type':_0x48a3e3,'sectionId':_[_0x5da7('0x4d')](_0x5c34a4,[_0x5da7('0x29'),_0x48a3e3])['id']},{}));}return Promise[_0x5da7('0x4f')](_0x1b199d);});})['then'](respondWithResult(_0x4030fe,0xc9))[_0x5da7('0x51')](handleError(_0x4030fe,null));};exports[_0x5da7('0x7f')]=function(_0x3a6744,_0x2f00de){if(_0x3a6744['body']['id']){delete _0x3a6744[_0x5da7('0x50')]['id'];}return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x3a6744[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](function(_0x3413d3){if(!_0x3413d3)return null;if(_0x3413d3['id']===_0x3a6744[_0x5da7('0x1f')]['id']){if(!_0x3a6744[_0x5da7('0x50')]['oldPassword']||!_0x3a6744['body'][_0x5da7('0x80')]){throw new db[(_0x5da7('0x81'))][(_0x5da7('0x82'))](_0x5da7('0x83'));}if(!_0x3413d3[_0x5da7('0x84')](_0x3a6744['body'][_0x5da7('0x85')])){throw new db['Sequelize'][(_0x5da7('0x82'))](_0x5da7('0x86'));}if(_0x3a6744['body'][_0x5da7('0x85')]===_0x3a6744[_0x5da7('0x50')][_0x5da7('0x80')]){throw new db[(_0x5da7('0x81'))][(_0x5da7('0x82'))](_0x5da7('0x87'));}}else if(_0x3a6744['user']['role']===_0x5da7('0x1e')){if(!_0x3a6744[_0x5da7('0x50')][_0x5da7('0x80')]){throw new db[(_0x5da7('0x81'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3a6744['user']['role']===_0x5da7('0x1f')){if(!_0x3a6744[_0x5da7('0x50')]['newPassword']){throw new db['Sequelize'][(_0x5da7('0x82'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3413d3[_0x5da7('0x28')]!==_0x5da7('0x19')){throw new db['Sequelize'][(_0x5da7('0x82'))](_0x5da7('0x88'));}}else{throw new db[(_0x5da7('0x81'))][(_0x5da7('0x82'))](_0x5da7('0x88'));}return _0x3413d3;})[_0x5da7('0x1c')](handleEntityNotFound(_0x2f00de,null))[_0x5da7('0x1c')](function(_0x303478){return db[_0x5da7('0x89')][_0x5da7('0x8a')]({'attributes':['id','securePassword',_0x5da7('0x8b'),_0x5da7('0x8c')]})[_0x5da7('0x1c')](function(_0x7f2d6e){if(_0x7f2d6e['securePassword'])authService[_0x5da7('0x58')](_0x3a6744[_0x5da7('0x50')]['newPassword']);if(!_0x7f2d6e[_0x5da7('0x8b')]||!_0x303478[_0x5da7('0x33')])return _0x303478;authService[_0x5da7('0x8d')](_0x3a6744[_0x5da7('0x50')]['newPassword'],_0x303478['previousPasswords'],_0x7f2d6e[_0x5da7('0x8c')]);return _0x303478;})[_0x5da7('0x1c')](saveUpdates({'password':_0x3a6744[_0x5da7('0x50')]['newPassword'],'passwordResetAt':_0x3a6744[_0x5da7('0x1f')]['id']==_0x3a6744[_0x5da7('0x4c')]['id']?moment():null,'previousPasswords':authService[_0x5da7('0x8e')](_0x3a6744[_0x5da7('0x50')][_0x5da7('0x80')],_0x303478[_0x5da7('0x33')])},null));})[_0x5da7('0x1c')](respondWithResult(_0x2f00de,null))[_0x5da7('0x51')](handleError(_0x2f00de,null));};exports[_0x5da7('0x8f')]=function(_0x5a96a7,_0x25294a){var _0x15921f=_0x5a96a7[_0x5da7('0x50')][_0x5da7('0x90')];return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x5a96a7[_0x5da7('0x4c')]['id']},'attributes':['id','name',_0x5da7('0x28'),_0x5da7('0x91'),'loginInPause',_0x5da7('0x92'),_0x5da7('0x93')]})['then'](handleEntityNotFound(_0x25294a,null))[_0x5da7('0x1c')](function(_0x4e19a0){if(_0x4e19a0){if(!utils[_0x5da7('0x94')](_0x15921f)){throw new db['Sequelize'][(_0x5da7('0x82'))](_0x5da7('0x95'));}return _0x4e19a0[_0x5da7('0x96')+_[_0x5da7('0x97')](_0x15921f['toLowerCase']())+_0x5da7('0x98')](_0x5a96a7[_0x5da7('0x50')][_0x5da7('0x54')],{'penalty':_0x5a96a7[_0x5da7('0x50')]['penalty']||0x0})[_0x5da7('0x99')](function(_0x2fab5b){for(var _0x1a8682=0x0;_0x1a8682<_0x5a96a7['body'][_0x5da7('0x54')][_0x5da7('0x43')];_0x1a8682+=0x1){var _0x172083={'UserId':Number(_0x5a96a7['params']['id'])};_0x172083[_[_0x5da7('0x97')](_0x15921f['toLowerCase']())+_0x5da7('0x9a')]=Number(_0x5a96a7[_0x5da7('0x50')][_0x5da7('0x54')][_0x1a8682]);socket['emit'](_0x5da7('0x1f')+_[_0x5da7('0x97')](_0x15921f['toLowerCase']())+_0x5da7('0x9b'),_0x172083);}return _0x2fab5b;})['then'](function(){if(_0x15921f===_0x5da7('0x9c')){return db[_0x5da7('0x9d')][_0x5da7('0x40')]({'where':{'id':_0x5a96a7[_0x5da7('0x50')]['ids']||[]},'raw':!![],'attributes':['id',_0x5da7('0x29')]});}})[_0x5da7('0x1c')](function(_0x53b708){var _0x24e808=_0x4e19a0[_0x5da7('0x1d')]({'plain':!![]});var _0x4a1f37=[];if(_0x15921f===_0x5da7('0x9c')&&_0x24e808[_0x5da7('0x28')]==='agent'&&_0x24e808['online']){for(let _0x42443f=0x0;_0x42443f<_0x53b708[_0x5da7('0x43')];_0x42443f+=0x1){_0x4a1f37[_0x5da7('0x44')]({'membername':_0x24e808['name'],'UserId':_0x24e808['id'],'queue_name':_0x53b708[_0x42443f][_0x5da7('0x29')],'VoiceQueueId':_0x53b708[_0x42443f]['id'],'interface':_[_0x5da7('0x5a')](_0x24e808[_0x5da7('0x93')])?util[_0x5da7('0x9e')](_0x5da7('0x9f'),_0x24e808[_0x5da7('0x29')]):_0x24e808[_0x5da7('0x93')],'paused':_0x24e808[_0x5da7('0x92')]||![],'penalty':_0x5a96a7[_0x5da7('0x50')][_0x5da7('0xa0')]||0x0});}return Promise['all'](_0x4a1f37['map'](function(_0x5a1d05){return db[_0x5da7('0xa1')]['upsert'](_0x5a1d05);}));}return _0x4e19a0;});}})[_0x5da7('0x1c')](respondWithStatusCode(_0x25294a,null))[_0x5da7('0x51')](handleError(_0x25294a,null));};exports['removeQueues']=function(_0x392790,_0x3afc4e){var _0x48030c,_0x2bedce;return db['User']['find']({'where':{'id':_0x392790[_0x5da7('0x4c')]['id']},'attributes':['id',_0x5da7('0x29'),_0x5da7('0x28')]})['then'](handleEntityNotFound(_0x3afc4e,null))[_0x5da7('0x1c')](function(_0x1c27a1){if(_0x1c27a1){_0x48030c=_0x1c27a1;if(!_0x392790['query'][_0x5da7('0x90')]||!utils[_0x5da7('0x94')](_0x392790['query'][_0x5da7('0x90')])){throw new db[(_0x5da7('0x81'))][(_0x5da7('0x82'))](_0x5da7('0x95'));}return _0x1c27a1[_0x5da7('0xa2')+_['capitalize'](_0x392790[_0x5da7('0x3a')][_0x5da7('0x90')][_0x5da7('0xa3')]())+'Queues'](_0x392790[_0x5da7('0x3a')][_0x5da7('0x54')]);}})[_0x5da7('0x1c')](function(_0x1b5a9b){if(_['isArray'](_0x392790[_0x5da7('0x3a')][_0x5da7('0x54')])){for(var _0xec9be8=0x0;_0xec9be8<_0x392790['query'][_0x5da7('0x54')]['length'];_0xec9be8+=0x1){_0x2bedce={'UserId':Number(_0x392790[_0x5da7('0x4c')]['id'])};_0x2bedce[_[_0x5da7('0x97')](_0x392790[_0x5da7('0x3a')][_0x5da7('0x90')]['toLowerCase']())+_0x5da7('0x9a')]=Number(_0x392790[_0x5da7('0x3a')]['ids'][_0xec9be8]);socket[_0x5da7('0xa4')](_0x5da7('0x1f')+_[_0x5da7('0x97')](_0x392790[_0x5da7('0x3a')][_0x5da7('0x90')]['toLowerCase']())+_0x5da7('0xa5'),_0x2bedce);}}else{_0x2bedce={'UserId':Number(_0x392790[_0x5da7('0x4c')]['id'])};_0x2bedce[_['capitalize'](_0x392790[_0x5da7('0x3a')][_0x5da7('0x90')][_0x5da7('0xa3')]())+'QueueId']=Number(_0x392790['query'][_0x5da7('0x54')]);socket[_0x5da7('0xa4')](_0x5da7('0x1f')+_[_0x5da7('0x97')](_0x392790['query'][_0x5da7('0x90')]['toLowerCase']())+_0x5da7('0xa5'),_0x2bedce);}return _0x1b5a9b;})[_0x5da7('0x1c')](function(){if(_0x392790[_0x5da7('0x3a')][_0x5da7('0x90')]===_0x5da7('0x9c')){return db[_0x5da7('0xa1')]['destroy']({'where':{'UserId':_0x392790[_0x5da7('0x4c')]['id'],'VoiceQueueId':_0x392790[_0x5da7('0x3a')][_0x5da7('0x54')]},'individualHooks':!![]})[_0x5da7('0x1c')](function(){return _0x48030c;});}return _0x48030c;})[_0x5da7('0x1c')](respondWithStatusCode(_0x3afc4e,null))[_0x5da7('0x51')](handleError(_0x3afc4e,null));};exports[_0x5da7('0xa6')]=function(_0x2e021c,_0x211799){_0x2e021c['body'][_0x5da7('0xa7')]=_0x2e021c[_0x5da7('0xa8')]['filename'];return db[_0x5da7('0x2e')]['find']({'where':{'id':_0x2e021c[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x211799,null))[_0x5da7('0x1c')](saveUpdates(_0x2e021c[_0x5da7('0x50')],null))['then'](respondWithResult(_0x211799,null))[_0x5da7('0x51')](handleError(_0x211799,null));};exports[_0x5da7('0xa9')]=function(_0x60712,_0x523ba8){var _0x433a0f=path[_0x5da7('0xaa')](config[_0x5da7('0xab')],_0x5da7('0xac'));return db[_0x5da7('0x2e')]['find']({'where':{'id':_0x60712[_0x5da7('0x4c')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x523ba8,null))[_0x5da7('0x1c')](function(_0x5044cd){if(_0x5044cd){if(_[_0x5da7('0x5a')](_0x5044cd[_0x5da7('0xa7')])){return _0x523ba8[_0x5da7('0xad')](_0x433a0f);}else{if(!fs[_0x5da7('0xae')](path[_0x5da7('0xaa')](config['root'],_0x5da7('0xaf'),_0x5044cd[_0x5da7('0xa7')]))){return _0x523ba8[_0x5da7('0xad')](_0x433a0f);}return _0x523ba8[_0x5da7('0xad')](path[_0x5da7('0xaa')](config[_0x5da7('0xab')],_0x5da7('0xaf'),_0x5044cd['userpic']));}}})[_0x5da7('0x51')](handleError(_0x523ba8,null));};exports[_0x5da7('0xb0')]=function(_0x381213,_0x16a0e4){return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x381213[_0x5da7('0x4c')]['id']},'attributes':['id']})[_0x5da7('0x1c')](handleEntityNotFound(_0x16a0e4,null))[_0x5da7('0x1c')](function(_0x8b104e){var _0x160b8c=[];values=_0x8b104e[_0x5da7('0x45')];_0x160b8c['push'](get_open_tabs(_0x5da7('0x4e'),_0x8b104e[_0x5da7('0x45')]));_0x160b8c['push'](get_open_tabs('sms',_0x8b104e[_0x5da7('0x45')]));_0x160b8c[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x49'),_0x8b104e[_0x5da7('0x45')]));_0x160b8c[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x4a'),_0x8b104e[_0x5da7('0x45')]));_0x160b8c[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x47'),_0x8b104e[_0x5da7('0x45')]));_0x160b8c[_0x5da7('0x44')](get_open_tabs(_0x5da7('0x48'),_0x8b104e[_0x5da7('0x45')]));return Promise[_0x5da7('0x4f')](_0x160b8c);})[_0x5da7('0x1c')](function(_0x4957cc){if(_0x4957cc){var _0x52e3d8=_[_0x5da7('0x25')](values['ChatOpenTabs'],function(_0x5051ce){return{'channel':'CHAT','id':_0x5051ce['id'],'createdAt':_0x5051ce[_0x5da7('0xb1')]};});var _0x4cbd81=_[_0x5da7('0x25')](values[_0x5da7('0xb2')],function(_0x3cbe31){return{'channel':_0x5da7('0xb3'),'id':_0x3cbe31['id'],'createdAt':_0x3cbe31[_0x5da7('0xb1')]};});var _0x4611f8=_[_0x5da7('0x25')](values['OpenchannelOpenTabs'],function(_0x3eb82c){return{'channel':_0x5da7('0xb4'),'id':_0x3eb82c['id'],'createdAt':_0x3eb82c[_0x5da7('0xb1')]};});var _0xf41283=_['map'](values['MailOpenTabs'],function(_0x511be1){return{'channel':_0x5da7('0xb5'),'id':_0x511be1['id'],'createdAt':_0x511be1[_0x5da7('0xb1')]};});var _0x49128f=_['map'](values[_0x5da7('0xb6')],function(_0x2cf436){return{'channel':_0x5da7('0xb7'),'id':_0x2cf436['id'],'createdAt':_0x2cf436[_0x5da7('0xb1')]};});var _0x5aa175=_['map'](values[_0x5da7('0xb8')],function(_0x4cb773){return{'channel':_0x5da7('0xb9'),'id':_0x4cb773['id'],'createdAt':_0x4cb773[_0x5da7('0xb1')]};});var _0x36bfa8=_[_0x5da7('0xba')](_0x52e3d8,_0x4cbd81,_0x4611f8,_0xf41283,_0x49128f,_0x5aa175);var _0x13390d={'count':_0x36bfa8[_0x5da7('0x43')],'rows':_0x36bfa8};return _0x13390d;}else return null;})['then'](respondWithResult(_0x16a0e4,null))['catch'](handleError(_0x16a0e4,null));};exports[_0x5da7('0xbb')]=function(_0x150876,_0x144ad5){var _0x4d6649={};return db[_0x5da7('0x2e')]['findOne']({'where':{'id':_0x150876['params']['id']}})[_0x5da7('0x1c')](function(_0x69b7ff){if(!_0x69b7ff){throw new APINotFoundError(util[_0x5da7('0x9e')](_0x5da7('0xbc'),_0x150876['params']['id']));}return contacts[_0x5da7('0x52')]();})[_0x5da7('0x1c')](function(_0x3ee1cb){_0x150876[_0x5da7('0x3a')][_0x5da7('0x2e')]=_0x150876[_0x5da7('0x4c')]['id'];_0x4d6649=qs['getOptions'](_0x3ee1cb,_0x150876);if(_0x150876['query'][_0x5da7('0xbd')](_0x5da7('0xbe'))){_0x4d6649[_0x5da7('0x3b')]=[{'model':db['CmList'],'as':_0x5da7('0xbf'),'required':![]},{'model':db['Tag'],'as':_0x5da7('0xc0'),'attributes':['id','name','color'],'where':_0x150876[_0x5da7('0x3a')][_0x5da7('0xc1')]?{'id':_0x150876['query']['tag']}:undefined,'required':_0x150876[_0x5da7('0x3a')][_0x5da7('0xc1')]?!![]:![]}];}return contacts[_0x5da7('0x40')](_0x150876[_0x5da7('0x3a')],_0x150876[_0x5da7('0x1f')],_0x4d6649,_0x3ee1cb);})[_0x5da7('0x1c')](respondWithFilteredResult(_0x144ad5,_0x4d6649))[_0x5da7('0x51')](APIHandleError(_0x144ad5));};exports[_0x5da7('0xc2')]=function(_0x491d40,_0x537d25){var _0x895ef8;var _0x41a0d3={};var _0x5426fe;return db[_0x5da7('0x2e')]['findOne']({'where':{'id':_0x491d40['params']['id']},'attributes':['id','name',_0x5da7('0x28')]})['then'](handleEntityNotFound(_0x537d25,null))[_0x5da7('0x1c')](function(_0x4f402f){if(!utils[_0x5da7('0x94')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x90')])){throw new db[(_0x5da7('0x81'))][(_0x5da7('0x82'))](_0x5da7('0x95'));}_0x895ef8=_0x4f402f;var _0x28dac7={};_0x28dac7[_0x5da7('0xc3')]=_['keys'](db[_[_0x5da7('0x97')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x90')])+_0x5da7('0xc4')][_0x5da7('0xc5')]);_0x28dac7[_0x5da7('0x3a')]=_['keys'](_0x491d40[_0x5da7('0x3a')]);_0x28dac7[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x28dac7[_0x5da7('0xc3')],_0x28dac7['query']);_0x41a0d3[_0x5da7('0x3f')]=_['intersection'](_0x28dac7[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x41a0d3[_0x5da7('0x3f')]=_0x41a0d3[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x41a0d3['attributes']:_0x28dac7['model'];_0x41a0d3[_0x5da7('0xc9')]=qs['sort'](_0x491d40[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x41a0d3[_0x5da7('0x38')]=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x491d40['query'],_0x28dac7[_0x5da7('0xc6')]));if(_0x491d40[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x41a0d3[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x41a0d3[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x41a0d3['attributes'],function(_0x47cdc9){var _0x975e1e={};_0x975e1e[_0x47cdc9]={'$like':'%'+_0x491d40[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x975e1e;})});}_0x41a0d3=_[_0x5da7('0xcc')]({},_0x41a0d3,_0x491d40[_0x5da7('0xcd')]);switch(_0x895ef8['role']){case _0x5da7('0x1e'):return db[_[_0x5da7('0x97')](_0x491d40[_0x5da7('0x3a')]['channel'])+_0x5da7('0xc4')][_0x5da7('0x40')](_0x41a0d3);case _0x5da7('0x1f'):case _0x5da7('0x19'):return _0x895ef8[_0x5da7('0x1d')+_[_0x5da7('0x97')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x90')])+_0x5da7('0x98')](_0x41a0d3);default:throw new db[(_0x5da7('0x81'))]['ValidationError'](_0x5da7('0xce'));}})[_0x5da7('0x1c')](function(_0xb683f3){_0x5426fe=_0xb683f3[_0x5da7('0x43')];if(!_0x491d40[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x41a0d3[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x491d40['query'][_0x5da7('0x15')]);_0x41a0d3[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x13')]);}switch(_0x895ef8[_0x5da7('0x28')]){case _0x5da7('0x1e'):return db[_[_0x5da7('0x97')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x90')])+'Queue'][_0x5da7('0x40')](_0x41a0d3);case _0x5da7('0x1f'):case'agent':return _0x895ef8[_0x5da7('0x1d')+_[_0x5da7('0x97')](_0x491d40[_0x5da7('0x3a')][_0x5da7('0x90')])+_0x5da7('0x98')](_0x41a0d3);}})[_0x5da7('0x1c')](function(_0x21bb23){return{'count':_0x5426fe,'rows':_0x21bb23};})[_0x5da7('0x1c')](respondWithResult(_0x537d25,null))[_0x5da7('0x51')](handleError(_0x537d25,null));};exports[_0x5da7('0xd0')]=function(_0x2d5698,_0x5254e8){var _0x3a242f={};var _0x47c585={};var _0x4abf4b;var _0x25215d;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x2d5698[_0x5da7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5254e8,null))[_0x5da7('0x1c')](function(_0x3f538a){if(_0x3f538a){_0x4abf4b=_0x3f538a;_0x47c585[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db[_0x5da7('0xa1')][_0x5da7('0xc5')]);_0x47c585[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x2d5698[_0x5da7('0x3a')]);_0x47c585[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x47c585[_0x5da7('0xc3')],_0x47c585['query']);_0x3a242f[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x47c585['model'],qs[_0x5da7('0xc8')](_0x2d5698[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x3a242f[_0x5da7('0x3f')]=_0x3a242f[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x3a242f[_0x5da7('0x3f')]:_0x47c585[_0x5da7('0xc3')];_0x3a242f['order']=qs['sort'](_0x2d5698[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x3a242f[_0x5da7('0x38')]=qs['filters'](_[_0x5da7('0xcb')](_0x2d5698[_0x5da7('0x3a')],_0x47c585[_0x5da7('0xc6')]));if(_0x2d5698[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x3a242f[_0x5da7('0x38')]=_['merge'](_0x3a242f[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x3a242f[_0x5da7('0x3f')],function(_0x4856a7){var _0x1f7b3={};_0x1f7b3[_0x4856a7]={'$like':'%'+_0x2d5698[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x1f7b3;})});}_0x3a242f=_['merge']({},_0x3a242f,_0x2d5698['options']);return _0x4abf4b[_0x5da7('0xd0')](_0x3a242f);}})[_0x5da7('0x1c')](function(_0x18bdb6){if(_0x18bdb6){_0x25215d=_0x18bdb6[_0x5da7('0x43')];if(!_0x2d5698[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x3a242f[_0x5da7('0x15')]=qs['limit'](_0x2d5698[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x3a242f[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x2d5698['query'][_0x5da7('0x13')]);}return _0x4abf4b[_0x5da7('0xd0')](_0x3a242f);}})[_0x5da7('0x1c')](function(_0x1082f8){if(_0x1082f8){return _0x1082f8?{'count':_0x25215d,'rows':_0x1082f8}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x5254e8,null))[_0x5da7('0x51')](handleError(_0x5254e8,null));};exports[_0x5da7('0xd2')]=function(_0x5ae25a,_0x4c2ee0){var _0xc0754a={};var _0x1f51a5={};var _0x2ca1b2;var _0x33586a;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x5ae25a['params']['id']}})['then'](handleEntityNotFound(_0x4c2ee0,null))[_0x5da7('0x1c')](function(_0x20c5d4){if(_0x20c5d4){_0x2ca1b2=_0x20c5d4;_0x1f51a5['model']=_[_0x5da7('0xd1')](db[_0x5da7('0xd3')]['rawAttributes']);_0x1f51a5[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x5ae25a[_0x5da7('0x3a')]);_0x1f51a5[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x1f51a5[_0x5da7('0xc3')],_0x1f51a5['query']);_0xc0754a['attributes']=_[_0x5da7('0xc7')](_0x1f51a5['model'],qs[_0x5da7('0xc8')](_0x5ae25a[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0xc0754a[_0x5da7('0x3f')]=_0xc0754a[_0x5da7('0x3f')][_0x5da7('0x43')]?_0xc0754a[_0x5da7('0x3f')]:_0x1f51a5['model'];_0xc0754a[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x5ae25a['query'][_0x5da7('0xca')]);_0xc0754a[_0x5da7('0x38')]=qs[_0x5da7('0xc6')](_['pick'](_0x5ae25a[_0x5da7('0x3a')],_0x1f51a5['filters']));if(_0x5ae25a['query']['filter']){_0xc0754a[_0x5da7('0x38')]=_['merge'](_0xc0754a[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0xc0754a[_0x5da7('0x3f')],function(_0x9034d3){var _0x4451db={};_0x4451db[_0x9034d3]={'$like':'%'+_0x5ae25a['query'][_0x5da7('0x23')]+'%'};return _0x4451db;})});}_0xc0754a=_[_0x5da7('0xcc')]({},_0xc0754a,_0x5ae25a[_0x5da7('0xcd')]);return _0x2ca1b2[_0x5da7('0xd2')](_0xc0754a);}})[_0x5da7('0x1c')](function(_0x1333f6){if(_0x1333f6){_0x33586a=_0x1333f6['length'];if(!_0x5ae25a[_0x5da7('0x3a')]['hasOwnProperty'](_0x5da7('0xcf'))){_0xc0754a[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x5ae25a['query'][_0x5da7('0x15')]);_0xc0754a[_0x5da7('0x13')]=qs['offset'](_0x5ae25a[_0x5da7('0x3a')][_0x5da7('0x13')]);}return _0x2ca1b2[_0x5da7('0xd2')](_0xc0754a);}})[_0x5da7('0x1c')](function(_0x210ff2){if(_0x210ff2){return _0x210ff2?{'count':_0x33586a,'rows':_0x210ff2}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x4c2ee0,null))[_0x5da7('0x51')](handleError(_0x4c2ee0,null));};exports[_0x5da7('0xd4')]=function(_0x4296ef,_0x19ba49){var _0x3cfbd3={'raw':!![],'where':{}};var _0x37414d={};var _0x13108a={'count':0x0,'rows':[]};return db['User'][_0x5da7('0x8a')]({'where':{'id':_0x4296ef[_0x5da7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x19ba49,null))[_0x5da7('0x1c')](function(_0x548eed){if(_0x548eed){_0x37414d[_0x5da7('0xc3')]=_['keys'](db[_0x5da7('0xd5')][_0x5da7('0xc5')]);_0x37414d['query']=_[_0x5da7('0xd1')](_0x4296ef['query']);_0x37414d['filters']=_[_0x5da7('0xc7')](_0x37414d[_0x5da7('0xc3')],_0x37414d[_0x5da7('0x3a')]);_0x3cfbd3[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x37414d['model'],qs[_0x5da7('0xc8')](_0x4296ef[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x3cfbd3[_0x5da7('0x3f')]=_0x3cfbd3['attributes'][_0x5da7('0x43')]?_0x3cfbd3[_0x5da7('0x3f')]:_0x37414d[_0x5da7('0xc3')];if(!_0x4296ef[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x3cfbd3[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x4296ef[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x3cfbd3[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x4296ef[_0x5da7('0x3a')][_0x5da7('0x13')]);}_0x3cfbd3[_0x5da7('0xc9')]=qs['sort'](_0x4296ef['query'][_0x5da7('0xca')]);_0x3cfbd3['where']=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x4296ef['query'],_0x37414d['filters']));_0x3cfbd3[_0x5da7('0x38')][_0x5da7('0xd6')]=_0x548eed['id'];if(_0x4296ef[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x3cfbd3[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x3cfbd3['where'],{'$or':_[_0x5da7('0x25')](_0x3cfbd3[_0x5da7('0x3f')],function(_0x4cf85f){var _0x148735={};_0x148735[_0x4cf85f]={'$like':'%'+_0x4296ef[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x148735;})});}_0x3cfbd3=_[_0x5da7('0xcc')]({},_0x3cfbd3,_0x4296ef[_0x5da7('0xcd')]);return db[_0x5da7('0xd5')][_0x5da7('0x39')]({'where':_0x3cfbd3[_0x5da7('0x38')]})[_0x5da7('0x1c')](function(_0x2f95af){_0x13108a[_0x5da7('0x39')]=_0x2f95af;if(_0x4296ef['query']['includeAll']){_0x3cfbd3[_0x5da7('0x3b')]=[{'all':!![]}];}return db[_0x5da7('0xd5')][_0x5da7('0x40')](_0x3cfbd3);})[_0x5da7('0x1c')](function(_0x3e210b){_0x13108a[_0x5da7('0x41')]=_0x3e210b;return _0x13108a;});}})[_0x5da7('0x1c')](respondWithFilteredResult(_0x19ba49,_0x3cfbd3))['catch'](handleError(_0x19ba49,null));};exports['getScreenRecordings']=function(_0x2c4431,_0x2d5a1e){var _0x1de082={'raw':!![],'where':{}};var _0x41c23b={};var _0x20bb11={'count':0x0,'rows':[]};return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x2c4431[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x2d5a1e,null))[_0x5da7('0x1c')](function(_0x108840){if(_0x108840){_0x41c23b[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db[_0x5da7('0xd7')][_0x5da7('0xc5')]);_0x41c23b['query']=_['keys'](_0x2c4431[_0x5da7('0x3a')]);_0x41c23b['filters']=_[_0x5da7('0xc7')](_0x41c23b[_0x5da7('0xc3')],_0x41c23b[_0x5da7('0x3a')]);_0x1de082[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x41c23b[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x2c4431['query'][_0x5da7('0xc8')]));_0x1de082[_0x5da7('0x3f')]=_0x1de082[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x1de082[_0x5da7('0x3f')]:_0x41c23b[_0x5da7('0xc3')];if(!_0x2c4431[_0x5da7('0x3a')]['hasOwnProperty']('nolimit')){_0x1de082[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x2c4431[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x1de082['offset']=qs[_0x5da7('0x13')](_0x2c4431[_0x5da7('0x3a')]['offset']);}_0x1de082[_0x5da7('0xc9')]=qs['sort'](_0x2c4431[_0x5da7('0x3a')]['sort']);_0x1de082[_0x5da7('0x38')]=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x2c4431[_0x5da7('0x3a')],_0x41c23b[_0x5da7('0xc6')]));_0x1de082[_0x5da7('0x38')]['UserId']=_0x108840['id'];if(_0x2c4431[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x1de082[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x1de082['where'],{'$or':_[_0x5da7('0x25')](_0x1de082[_0x5da7('0x3f')],function(_0x8e0aa){var _0x4f6e0a={};_0x4f6e0a[_0x8e0aa]={'$like':'%'+_0x2c4431['query'][_0x5da7('0x23')]+'%'};return _0x4f6e0a;})});}_0x1de082=_[_0x5da7('0xcc')]({},_0x1de082,_0x2c4431[_0x5da7('0xcd')]);return db['ScreenRecording'][_0x5da7('0x39')]({'where':_0x1de082[_0x5da7('0x38')]})[_0x5da7('0x1c')](function(_0x35e75){_0x20bb11['count']=_0x35e75;if(_0x2c4431[_0x5da7('0x3a')][_0x5da7('0xbe')]){_0x1de082[_0x5da7('0x3b')]=[{'all':!![]}];}return db[_0x5da7('0xd7')][_0x5da7('0x40')](_0x1de082);})[_0x5da7('0x1c')](function(_0x3773d1){_0x20bb11['rows']=_0x3773d1;return _0x20bb11;});}})['then'](respondWithFilteredResult(_0x2d5a1e,_0x1de082))[_0x5da7('0x51')](handleError(_0x2d5a1e,null));};exports[_0x5da7('0xd8')]=function(_0x9a5e2f,_0x2b2fb3){var _0x2f0fd5={};var _0x28072a={};var _0xc8d607;var _0xede188;return db['User']['findOne']({'where':{'id':_0x9a5e2f['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x2b2fb3,null))['then'](function(_0x2129e2){if(_0x2129e2){_0xc8d607=_0x2129e2;_0x28072a[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db[_0x5da7('0xd9')][_0x5da7('0xc5')]);_0x28072a[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x9a5e2f[_0x5da7('0x3a')]);_0x28072a[_0x5da7('0xc6')]=_['intersection'](_0x28072a[_0x5da7('0xc3')],_0x28072a[_0x5da7('0x3a')]);_0x2f0fd5[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x28072a[_0x5da7('0xc3')],qs['fields'](_0x9a5e2f[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x2f0fd5[_0x5da7('0x3f')]=_0x2f0fd5[_0x5da7('0x3f')]['length']?_0x2f0fd5[_0x5da7('0x3f')]:_0x28072a[_0x5da7('0xc3')];_0x2f0fd5['order']=qs[_0x5da7('0xca')](_0x9a5e2f['query'][_0x5da7('0xca')]);_0x2f0fd5['where']=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x9a5e2f[_0x5da7('0x3a')],_0x28072a[_0x5da7('0xc6')]));if(_0x9a5e2f[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x2f0fd5[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x2f0fd5[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x2f0fd5[_0x5da7('0x3f')],function(_0x2f8f55){var _0x30a7be={};_0x30a7be[_0x2f8f55]={'$like':'%'+_0x9a5e2f['query'][_0x5da7('0x23')]+'%'};return _0x30a7be;})});}_0x2f0fd5=_[_0x5da7('0xcc')]({},_0x2f0fd5,_0x9a5e2f[_0x5da7('0xcd')]);return _0xc8d607[_0x5da7('0xd8')](_0x2f0fd5);}})[_0x5da7('0x1c')](function(_0x241300){if(_0x241300){_0xede188=_0x241300['length'];if(!_0x9a5e2f[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x2f0fd5[_0x5da7('0x15')]=qs['limit'](_0x9a5e2f[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x2f0fd5[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x9a5e2f[_0x5da7('0x3a')][_0x5da7('0x13')]);}return _0xc8d607['getChatInteractions'](_0x2f0fd5);}})['then'](function(_0xbb442){if(_0xbb442){return _0xbb442?{'count':_0xede188,'rows':_0xbb442}:null;}})['then'](respondWithResult(_0x2b2fb3,null))[_0x5da7('0x51')](handleError(_0x2b2fb3,null));};exports[_0x5da7('0xda')]=function(_0x94a05a,_0x5c3f22){var _0x35d743={};var _0x35d315={};var _0xdf9a2b;var _0x3effef;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x94a05a[_0x5da7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c3f22,null))[_0x5da7('0x1c')](function(_0x20c7ed){if(_0x20c7ed){_0xdf9a2b=_0x20c7ed;_0x35d315['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x35d315[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x94a05a['query']);_0x35d315['filters']=_['intersection'](_0x35d315[_0x5da7('0xc3')],_0x35d315[_0x5da7('0x3a')]);_0x35d743[_0x5da7('0x3f')]=_['intersection'](_0x35d315[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x94a05a['query'][_0x5da7('0xc8')]));_0x35d743[_0x5da7('0x3f')]=_0x35d743['attributes']['length']?_0x35d743[_0x5da7('0x3f')]:_0x35d315['model'];_0x35d743[_0x5da7('0xc9')]=qs['sort'](_0x94a05a[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x35d743['where']=qs[_0x5da7('0xc6')](_['pick'](_0x94a05a[_0x5da7('0x3a')],_0x35d315[_0x5da7('0xc6')]));if(_0x94a05a['query'][_0x5da7('0x23')]){_0x35d743[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x35d743[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x35d743[_0x5da7('0x3f')],function(_0xd5628){var _0x2ccc4b={};_0x2ccc4b[_0xd5628]={'$like':'%'+_0x94a05a[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x2ccc4b;})});}_0x35d743=_[_0x5da7('0xcc')]({},_0x35d743,_0x94a05a[_0x5da7('0xcd')]);return _0xdf9a2b[_0x5da7('0xda')](_0x35d743);}})[_0x5da7('0x1c')](function(_0x1fe64a){if(_0x1fe64a){_0x3effef=_0x1fe64a[_0x5da7('0x43')];if(!_0x94a05a[_0x5da7('0x3a')][_0x5da7('0xbd')]('nolimit')){_0x35d743[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x94a05a[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x35d743[_0x5da7('0x13')]=qs['offset'](_0x94a05a['query']['offset']);}return _0xdf9a2b['getOpenchannelInteractions'](_0x35d743);}})[_0x5da7('0x1c')](function(_0x5b61d0){if(_0x5b61d0){return _0x5b61d0?{'count':_0x3effef,'rows':_0x5b61d0}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x5c3f22,null))[_0x5da7('0x51')](handleError(_0x5c3f22,null));};exports[_0x5da7('0xdb')]=function(_0x30962d,_0x15ca68){var _0x4de7bc={'raw':!![],'where':{}};var _0x28f85c={};var _0xf60741={'count':0x0,'rows':[]};return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x30962d[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x15ca68,null))[_0x5da7('0x1c')](function(_0x15b805){if(_0x15b805){_0x28f85c[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db[_0x5da7('0xdc')][_0x5da7('0xc5')]);_0x28f85c[_0x5da7('0x3a')]=_['keys'](_0x30962d[_0x5da7('0x3a')]);_0x28f85c[_0x5da7('0xc6')]=_['intersection'](_0x28f85c[_0x5da7('0xc3')],_0x28f85c['query']);_0x4de7bc[_0x5da7('0x3f')]=_['intersection'](_0x28f85c[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x30962d['query'][_0x5da7('0xc8')]));_0x4de7bc[_0x5da7('0x3f')]=_0x4de7bc[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x4de7bc[_0x5da7('0x3f')]:_0x28f85c[_0x5da7('0xc3')];if(!_0x30962d['query'][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x4de7bc['limit']=qs[_0x5da7('0x15')](_0x30962d[_0x5da7('0x3a')]['limit']);_0x4de7bc[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x30962d[_0x5da7('0x3a')][_0x5da7('0x13')]);}_0x4de7bc[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x30962d[_0x5da7('0x3a')]['sort']);_0x4de7bc[_0x5da7('0x38')]=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x30962d[_0x5da7('0x3a')],_0x28f85c[_0x5da7('0xc6')]));_0x4de7bc[_0x5da7('0x38')][_0x5da7('0xd6')]=_0x15b805['id'];if(_0x30962d[_0x5da7('0x3a')]['filter']){_0x4de7bc[_0x5da7('0x38')]=_['merge'](_0x4de7bc[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x4de7bc[_0x5da7('0x3f')],function(_0x5e65f8){var _0x406ea5={};_0x406ea5[_0x5e65f8]={'$like':'%'+_0x30962d[_0x5da7('0x3a')]['filter']+'%'};return _0x406ea5;})});}_0x4de7bc=_[_0x5da7('0xcc')]({},_0x4de7bc,_0x30962d[_0x5da7('0xcd')]);return db[_0x5da7('0xdc')][_0x5da7('0x39')]({'where':_0x4de7bc['where']})[_0x5da7('0x1c')](function(_0xd26b37){_0xf60741[_0x5da7('0x39')]=_0xd26b37;if(_0x30962d['query']['includeAll']){_0x4de7bc['include']=[{'all':!![]}];}return db['MailInteraction'][_0x5da7('0x40')](_0x4de7bc);})[_0x5da7('0x1c')](function(_0x327023){_0xf60741[_0x5da7('0x41')]=_0x327023;return _0xf60741;});}})[_0x5da7('0x1c')](respondWithFilteredResult(_0x15ca68,_0x4de7bc))[_0x5da7('0x51')](handleError(_0x15ca68,null));};exports[_0x5da7('0xdd')]=function(_0x3398bd,_0x170db9){var _0x3fc2e1={};var _0x5016cb={};var _0xa82cf3;var _0x3e2a87;return db[_0x5da7('0x2e')]['findOne']({'where':{'id':_0x3398bd['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x170db9,null))[_0x5da7('0x1c')](function(_0x15d8e6){if(_0x15d8e6){_0xa82cf3=_0x15d8e6;_0x5016cb['model']=_['keys'](db['SmsInteraction'][_0x5da7('0xc5')]);_0x5016cb[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x3398bd[_0x5da7('0x3a')]);_0x5016cb['filters']=_['intersection'](_0x5016cb[_0x5da7('0xc3')],_0x5016cb['query']);_0x3fc2e1['attributes']=_[_0x5da7('0xc7')](_0x5016cb['model'],qs['fields'](_0x3398bd['query'][_0x5da7('0xc8')]));_0x3fc2e1[_0x5da7('0x3f')]=_0x3fc2e1[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x3fc2e1['attributes']:_0x5016cb['model'];_0x3fc2e1[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x3398bd[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x3fc2e1[_0x5da7('0x38')]=qs[_0x5da7('0xc6')](_['pick'](_0x3398bd['query'],_0x5016cb['filters']));if(_0x3398bd['query'][_0x5da7('0x23')]){_0x3fc2e1['where']=_[_0x5da7('0xcc')](_0x3fc2e1[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x3fc2e1['attributes'],function(_0x527e2f){var _0x4e9021={};_0x4e9021[_0x527e2f]={'$like':'%'+_0x3398bd[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x4e9021;})});}_0x3fc2e1=_[_0x5da7('0xcc')]({},_0x3fc2e1,_0x3398bd[_0x5da7('0xcd')]);return _0xa82cf3[_0x5da7('0xdd')](_0x3fc2e1);}})[_0x5da7('0x1c')](function(_0x270156){if(_0x270156){_0x3e2a87=_0x270156[_0x5da7('0x43')];if(!_0x3398bd['query'][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x3fc2e1['limit']=qs[_0x5da7('0x15')](_0x3398bd['query'][_0x5da7('0x15')]);_0x3fc2e1[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x3398bd[_0x5da7('0x3a')][_0x5da7('0x13')]);}return _0xa82cf3[_0x5da7('0xdd')](_0x3fc2e1);}})[_0x5da7('0x1c')](function(_0x5cfeb2){if(_0x5cfeb2){return _0x5cfeb2?{'count':_0x3e2a87,'rows':_0x5cfeb2}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x170db9,null))['catch'](handleError(_0x170db9,null));};exports[_0x5da7('0xde')]=function(_0x22047d,_0x427f5e){var _0x4191d5={};var _0x118812={};var _0x36f868;var _0x474c83;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x22047d['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x427f5e,null))[_0x5da7('0x1c')](function(_0x482be5){if(_0x482be5){_0x36f868=_0x482be5;_0x118812['model']=_[_0x5da7('0xd1')](db[_0x5da7('0xdf')][_0x5da7('0xc5')]);_0x118812[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x22047d[_0x5da7('0x3a')]);_0x118812[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x118812['model'],_0x118812['query']);_0x4191d5[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x118812[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x22047d[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x4191d5[_0x5da7('0x3f')]=_0x4191d5['attributes'][_0x5da7('0x43')]?_0x4191d5[_0x5da7('0x3f')]:_0x118812['model'];_0x4191d5[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x22047d[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x4191d5['where']=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x22047d[_0x5da7('0x3a')],_0x118812[_0x5da7('0xc6')]));if(_0x22047d['query'][_0x5da7('0x23')]){_0x4191d5['where']=_[_0x5da7('0xcc')](_0x4191d5[_0x5da7('0x38')],{'$or':_['map'](_0x4191d5[_0x5da7('0x3f')],function(_0x46743b){var _0x217177={};_0x217177[_0x46743b]={'$like':'%'+_0x22047d[_0x5da7('0x3a')]['filter']+'%'};return _0x217177;})});}_0x4191d5=_[_0x5da7('0xcc')]({},_0x4191d5,_0x22047d[_0x5da7('0xcd')]);return _0x36f868[_0x5da7('0xde')](_0x4191d5);}})[_0x5da7('0x1c')](function(_0xf07d20){if(_0xf07d20){_0x474c83=_0xf07d20[_0x5da7('0x43')];if(!_0x22047d['query']['hasOwnProperty'](_0x5da7('0xcf'))){_0x4191d5[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x22047d[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x4191d5[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x22047d['query'][_0x5da7('0x13')]);}return _0x36f868[_0x5da7('0xde')](_0x4191d5);}})['then'](function(_0x36bb47){if(_0x36bb47){return _0x36bb47?{'count':_0x474c83,'rows':_0x36bb47}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x427f5e,null))['catch'](handleError(_0x427f5e,null));};exports[_0x5da7('0xe0')]=function(_0x14185c,_0x3da78b){var _0x429c06={};var _0x5dc41f={};var _0x64b34c;var _0x217b09;return db['User'][_0x5da7('0x8a')]({'where':{'id':_0x14185c[_0x5da7('0x4c')]['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x3da78b,null))[_0x5da7('0x1c')](function(_0x3ab032){if(_0x3ab032){_0x64b34c=_0x3ab032;_0x5dc41f[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db['WhatsappInteraction'][_0x5da7('0xc5')]);_0x5dc41f[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x14185c[_0x5da7('0x3a')]);_0x5dc41f[_0x5da7('0xc6')]=_['intersection'](_0x5dc41f[_0x5da7('0xc3')],_0x5dc41f[_0x5da7('0x3a')]);_0x429c06[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x5dc41f[_0x5da7('0xc3')],qs['fields'](_0x14185c[_0x5da7('0x3a')]['fields']));_0x429c06[_0x5da7('0x3f')]=_0x429c06[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x429c06[_0x5da7('0x3f')]:_0x5dc41f[_0x5da7('0xc3')];_0x429c06['order']=qs[_0x5da7('0xca')](_0x14185c[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x429c06[_0x5da7('0x38')]=qs['filters'](_[_0x5da7('0xcb')](_0x14185c[_0x5da7('0x3a')],_0x5dc41f[_0x5da7('0xc6')]));if(_0x14185c[_0x5da7('0x3a')]['filter']){_0x429c06['where']=_['merge'](_0x429c06[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x429c06[_0x5da7('0x3f')],function(_0x5048eb){var _0x4e3d08={};_0x4e3d08[_0x5048eb]={'$like':'%'+_0x14185c[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x4e3d08;})});}_0x429c06=_['merge']({},_0x429c06,_0x14185c[_0x5da7('0xcd')]);return _0x64b34c[_0x5da7('0xe0')](_0x429c06);}})['then'](function(_0x31d720){if(_0x31d720){_0x217b09=_0x31d720[_0x5da7('0x43')];if(!_0x14185c[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x429c06[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x14185c[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x429c06[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x14185c[_0x5da7('0x3a')][_0x5da7('0x13')]);}return _0x64b34c[_0x5da7('0xe0')](_0x429c06);}})[_0x5da7('0x1c')](function(_0x4d76e4){if(_0x4d76e4){return _0x4d76e4?{'count':_0x217b09,'rows':_0x4d76e4}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x3da78b,null))[_0x5da7('0x51')](handleError(_0x3da78b,null));};exports[_0x5da7('0xe1')]=function(_0x3f56c8,_0x2adc5f,_0x4fd861){var _0x5bdd59;var _0x41abae;var _0x14683c;var _0x3ea199=!_[_0x5da7('0x5a')](_0x3f56c8[_0x5da7('0x4c')]['id'])?_0x3f56c8[_0x5da7('0x4c')]['id']:!_[_0x5da7('0x5a')](_0x3f56c8[_0x5da7('0x1f')]['id'])?_0x3f56c8[_0x5da7('0x1f')]['id']:null;return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x3ea199,'role':{'$or':[_0x5da7('0x1e'),_0x5da7('0x1f'),_0x5da7('0x19')]}},'attributes':['id',_0x5da7('0x29'),_0x5da7('0xe2'),'mobile','role',_0x5da7('0x55'),_0x5da7('0xe3')]})['then'](function(_0x1ca888){if(_0x1ca888){if(_0x1ca888[_0x5da7('0x28')]===_0x5da7('0x19')){_0x5bdd59=_0x1ca888;if(_0x3f56c8[_0x5da7('0x50')][_0x5da7('0x93')]){_0x14683c=util[_0x5da7('0x9e')]('LOCAL/%s@from-sip/n',_0x5bdd59[_0x3f56c8[_0x5da7('0x50')][_0x5da7('0x93')]]);}else if(_0x3f56c8[_0x5da7('0x50')][_0x5da7('0xe4')]){_0x14683c=util[_0x5da7('0x9e')](_0x5da7('0x9f'),_0x3f56c8['body']['intrf']);}else{_0x14683c=util[_0x5da7('0x9e')]('SIP/%s',_0x5bdd59[_0x5da7('0x29')]);}socket['to'](util['format'](_0x5da7('0xe5'),_0x5bdd59['name']))['emit']('user:forcelogout',{'user':{'id':_0x5bdd59['id'],'name':_0x5bdd59['name']},'ip':_0x3f56c8['headers'][_0x5da7('0xe6')]||_0x3f56c8[_0x5da7('0xe7')]['remoteAddress']||_0x3f56c8['socket'][_0x5da7('0xe8')]||_0x3f56c8[_0x5da7('0xe7')]['socket'][_0x5da7('0xe8')]});return db[_0x5da7('0xa1')][_0x5da7('0x1b')]({'where':{'membername':_0x5bdd59['name']},'individualHooks':!![]});}}else{throw new db[(_0x5da7('0x81'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x5bdd59){return _0x5bdd59[_0x5da7('0xe9')]({'raw':!![]});}})[_0x5da7('0x1c')](function(_0x4eaca7){if(_0x5bdd59){if(_0x4eaca7){_0x41abae=_0x4eaca7;if(_0x41abae[_0x5da7('0x43')]){var _0x66a7e6=_0x41abae[_0x5da7('0x25')](function(_0x16f4b8){var _0x6aec13={'membername':_0x5bdd59['name'],'UserId':_0x5bdd59['id'],'queue_name':_0x16f4b8[_0x5da7('0x29')],'VoiceQueueId':_0x16f4b8['id'],'interface':_0x14683c,'paused':_0x5bdd59[_0x5da7('0xe3')]||![],'penalty':_0x16f4b8['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x5da7('0xea')](_0x6aec13);});return Promise['all'](_0x66a7e6);}}}})[_0x5da7('0x1c')](function(){if(_0x5bdd59){return db[_0x5da7('0xeb')][_0x5da7('0x40')]({'where':{'membername':_0x5bdd59[_0x5da7('0x29')],'exitAt':null}});}})[_0x5da7('0x1c')](function(_0x36c320){if(_0x5bdd59){var _0xf05b07=[];_0x36c320[_0x5da7('0xec')](function(_0x44b450){_0xf05b07[_0x5da7('0x44')](_0x44b450[_0x5da7('0x18')]({'exitAt':moment()[_0x5da7('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5da7('0x4f')](_0xf05b07);}})[_0x5da7('0x1c')](function(){if(_0x5bdd59){var _0x5d11fc=[];var _0x431e22=[];var _0x3b0410=utils[_0x5da7('0xed')]();var _0x2b19f2={'membername':_0x5bdd59['name'],'interface':_0x14683c,'enterAt':moment()[_0x5da7('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5bdd59[_0x5da7('0x28')],'internal':_0x5bdd59['internal']};_0x3b0410[_0x5da7('0xec')](function(_0x48ed54){_0x5d11fc[_0x5da7('0x44')](_[_0x5da7('0xcc')]({'channel':_0x48ed54,'type':_0x5da7('0xee'),'data1':_0x3f56c8['body'][_0x5da7('0xef')],'data2':_0x14683c},_0x2b19f2));if(_0x5bdd59['loginInPause']){_0x431e22[_0x5da7('0x44')](_['merge']({'channel':_0x48ed54,'type':_0x5da7('0xf0'),'data1':'LOGININPAUSE'},_0x2b19f2));}});return db[_0x5da7('0xeb')][_0x5da7('0x7b')](_0x5d11fc['concat'](_0x431e22),{'individualHooks':!![]});}})[_0x5da7('0x1c')](function(){if(_0x5bdd59){return _0x5bdd59['update']({'online':!![],'lastLoginAt':moment()[_0x5da7('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5bdd59[_0x5da7('0xe3')]||![],'mailPause':_0x5bdd59['loginInPause']||![],'chatPause':_0x5bdd59[_0x5da7('0xe3')]||![],'faxPause':_0x5bdd59['loginInPause']||![],'smsPause':_0x5bdd59['loginInPause']||![],'openchannelPause':_0x5bdd59[_0x5da7('0xe3')]||![],'whatsappPause':_0x5bdd59[_0x5da7('0xe3')]||![],'pauseType':_0x5bdd59[_0x5da7('0xe3')]?_0x5da7('0xf1'):null,'interface':_0x14683c,'lastPauseAt':moment()[_0x5da7('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x5da7('0x1c')](function(_0x52336b){if(_0x3f56c8[_0x5da7('0xf2')]){return _0x4fd861();}else{return Promise[_0x5da7('0xf3')](_0x52336b)[_0x5da7('0x1c')](respondWithResult(_0x2adc5f,null));}})[_0x5da7('0x51')](handleError(_0x2adc5f,null));};exports[_0x5da7('0xf4')]=function(_0x2ae93d,_0x1ec3c2){var _0x54af8e;return db['User'][_0x5da7('0x4d')]({'where':{'id':_0x2ae93d[_0x5da7('0x4c')]['id'],'role':_0x5da7('0x19')},'attributes':['id','name',_0x5da7('0x28')]})[_0x5da7('0x1c')](handleEntityNotFound(_0x1ec3c2,null))[_0x5da7('0x1c')](function(_0x1891fe){if(_0x1891fe){_0x54af8e=_0x1891fe;return db[_0x5da7('0xa1')][_0x5da7('0x1b')]({'where':{'membername':_0x54af8e['name']},'individualHooks':!![]});}})[_0x5da7('0x1c')](function(){return db[_0x5da7('0xeb')][_0x5da7('0x40')]({'where':{'membername':_0x54af8e[_0x5da7('0x29')],'exitAt':null}});})[_0x5da7('0x1c')](function(_0xe6b6ea){var _0x1dcb35=[];_0xe6b6ea[_0x5da7('0xec')](function(_0x181e18){_0x1dcb35[_0x5da7('0x44')](_0x181e18[_0x5da7('0x18')]({'exitAt':moment()['format'](_0x5da7('0xf5'))}));});return Promise[_0x5da7('0x4f')](_0x1dcb35);})['then'](function(){return _0x54af8e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1ec3c2,null))['catch'](handleError(_0x1ec3c2,null));};exports[_0x5da7('0xf6')]=function(_0x343305,_0x2ea44f){var _0x1efc7a;return db[_0x5da7('0xa1')][_0x5da7('0x18')]({'paused':0x1},{'where':{'UserId':_0x343305[_0x5da7('0x4c')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x5da7('0x2e')][_0x5da7('0x4d')]({'where':{'id':_0x343305[_0x5da7('0x4c')]['id'],'role':'agent'},'attributes':['id',_0x5da7('0x29'),_0x5da7('0x28'),_0x5da7('0x55'),'interface',_0x5da7('0x91')]});})[_0x5da7('0x1c')](handleEntityNotFound(_0x2ea44f,null))[_0x5da7('0x1c')](function(_0x679285){if(_0x679285){_0x1efc7a=_0x679285;return db[_0x5da7('0xeb')][_0x5da7('0x40')]({'where':{'membername':_0x1efc7a[_0x5da7('0x29')],'type':'PAUSE','exitAt':null}});}})[_0x5da7('0x1c')](function(_0x51406c){if(_0x51406c['length']){var _0x9370c0=moment()[_0x5da7('0x9e')](_0x5da7('0xf5'));for(var _0x44f717=0x0,_0x2b571a=_0x51406c['length'];_0x44f717<_0x2b571a;_0x44f717++){_0x51406c[_0x44f717][_0x5da7('0xf7')]({'exitAt':_0x9370c0});}}})['then'](function(){var _0x441a3f=[];var _0x3f4987=utils[_0x5da7('0xed')]();_0x3f4987['forEach'](function(_0x44c793){_0x441a3f[_0x5da7('0x44')]({'channel':_0x44c793,'membername':_0x1efc7a[_0x5da7('0x29')],'interface':_[_0x5da7('0x5a')](_0x1efc7a['interface'])?util['format'](_0x5da7('0x9f'),_0x1efc7a[_0x5da7('0x29')]):_0x1efc7a[_0x5da7('0x93')],'type':_0x5da7('0xf0'),'enterAt':moment()[_0x5da7('0x9e')](_0x5da7('0xf5')),'data1':_0x343305[_0x5da7('0x50')][_0x5da7('0x30')]||_0x5da7('0xf8'),'role':_0x1efc7a['role'],'internal':_0x1efc7a[_0x5da7('0x55')]});});return db['MemberReport'][_0x5da7('0x7b')](_0x441a3f,{'individualHooks':!![]});})[_0x5da7('0x1c')](function(){return _0x1efc7a[_0x5da7('0x18')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x343305[_0x5da7('0x50')][_0x5da7('0x30')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x5da7('0x9e')](_0x5da7('0xf5'))});})[_0x5da7('0x1c')](respondWithResult(_0x2ea44f,null))[_0x5da7('0x51')](handleError(_0x2ea44f,null));};exports[_0x5da7('0xf9')]=function(_0x2fc74a,_0x50a2f5){if(_0x2fc74a[_0x5da7('0x50')][_0x5da7('0x90')]&&!utils['isValidChannel'](_0x2fc74a[_0x5da7('0x50')][_0x5da7('0x90')])){throw new APIBadRequestError(util[_0x5da7('0x9e')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2fc74a[_0x5da7('0x50')][_0x5da7('0x90')]));}return db[_0x5da7('0x2e')]['find']({'where':{'id':_0x2fc74a[_0x5da7('0x4c')]['id']},'attributes':['id',_0x5da7('0x29'),'role',_0x5da7('0x55'),'interface',_0x5da7('0x91'),'voicePause',_0x5da7('0xfa'),_0x5da7('0xfb'),_0x5da7('0xfc'),_0x5da7('0xfd'),'smsPause',_0x5da7('0xfe'),'pauseType',_0x5da7('0xff')]})[_0x5da7('0x1c')](function(_0x6ac3d7){if(!_0x6ac3d7){throw new APINotFoundError(util[_0x5da7('0x9e')](_0x5da7('0xbc'),_0x2fc74a[_0x5da7('0x4c')]['id']));}return _0x6ac3d7[_0x5da7('0xf9')](_0x2fc74a[_0x5da7('0x50')][_0x5da7('0x90')]);})[_0x5da7('0x1c')](respondWithResult(_0x50a2f5,null))[_0x5da7('0x51')](APIHandleError(_0x50a2f5));};exports[_0x5da7('0x100')]=function(_0x46f881,_0x266f73){var _0x3aba3f={};var _0x5ce44b={};var _0x45d404;var _0x2eb9ee;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x46f881['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x266f73,null))['then'](function(_0x19fcf6){if(_0x19fcf6){_0x45d404=_0x19fcf6;_0x5ce44b[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db['Team']['rawAttributes']);_0x5ce44b[_0x5da7('0x3a')]=_[_0x5da7('0xd1')](_0x46f881[_0x5da7('0x3a')]);_0x5ce44b[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x5ce44b[_0x5da7('0xc3')],_0x5ce44b[_0x5da7('0x3a')]);_0x3aba3f['attributes']=_[_0x5da7('0xc7')](_0x5ce44b[_0x5da7('0xc3')],qs[_0x5da7('0xc8')](_0x46f881[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x3aba3f[_0x5da7('0x3f')]=_0x3aba3f['attributes']['length']?_0x3aba3f[_0x5da7('0x3f')]:_0x5ce44b['model'];_0x3aba3f[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x46f881['query']['sort']);_0x3aba3f['where']=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x46f881['query'],_0x5ce44b[_0x5da7('0xc6')]));if(_0x46f881['query'][_0x5da7('0x23')]){_0x3aba3f[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x3aba3f[_0x5da7('0x38')],{'$or':_['map'](_0x3aba3f[_0x5da7('0x3f')],function(_0x5757f5){var _0x357297={};_0x357297[_0x5757f5]={'$like':'%'+_0x46f881[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x357297;})});}_0x3aba3f=_[_0x5da7('0xcc')]({},_0x3aba3f,_0x46f881[_0x5da7('0xcd')]);return _0x45d404['getTeams'](_0x3aba3f);}})['then'](function(_0x429a68){if(_0x429a68){_0x2eb9ee=_0x429a68[_0x5da7('0x43')];if(!_0x46f881['query'][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x3aba3f[_0x5da7('0x15')]=qs[_0x5da7('0x15')](_0x46f881[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x3aba3f[_0x5da7('0x13')]=qs[_0x5da7('0x13')](_0x46f881['query'][_0x5da7('0x13')]);}return _0x45d404[_0x5da7('0x100')](_0x3aba3f);}})['then'](function(_0x2e3320){if(_0x2e3320){return _0x2e3320?{'count':_0x2eb9ee,'rows':_0x2e3320}:null;}})['then'](respondWithResult(_0x266f73,null))[_0x5da7('0x51')](handleError(_0x266f73,null));};exports[_0x5da7('0x101')]=function(_0x7a0785,_0x117694){var _0x21bfed=_0x7a0785['params']['id'];var _0xddfb5=_0x7a0785['body']?_0x7a0785[_0x5da7('0x50')][_0x5da7('0x54')]:null;var _0x1e8e94=[];return Promise[_0x5da7('0xf3')]()[_0x5da7('0x1c')](function(){if(!_0xddfb5)throw new APIBadRequestError(_0x5da7('0x102'));})['then'](function(){return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x21bfed}});})[_0x5da7('0x1c')](function(_0x2d464c){if(!_0x2d464c)throw new APINotFoundError(util['format'](_0x5da7('0xbc'),_0x7a0785[_0x5da7('0x4c')]['id']));return db['sequelize'][_0x5da7('0x103')](function(_0x9b73c7){return _0x2d464c[_0x5da7('0x101')](_0xddfb5,{'transaction':_0x9b73c7})['then'](function(){return db[_0x5da7('0x104')][_0x5da7('0x40')]({'where':{'id':{'$in':_0xddfb5}}});})[_0x5da7('0x1c')](function(_0x4972ea){var _0x441833=_[_0x5da7('0x25')](_0x4972ea,function(_0x382b22){return _0x382b22[_0x5da7('0x105')]();});return Promise[_0x5da7('0x4f')](_0x441833);})['then'](function(_0x400915){_0x1e8e94=_[_0x5da7('0x106')](_0x400915);var _0x262e59=_[_0x5da7('0x25')](_0x1e8e94,function(_0x4daa4d){return _0x4daa4d[_0x5da7('0x107')](_0x2d464c['id'],{'transaction':_0x9b73c7});});return Promise[_0x5da7('0x4f')](_0x262e59);})[_0x5da7('0x1c')](function(){if(!_0x2d464c['online'])return;var _0x564d66=_['filter'](_0x1e8e94,function(_0x2c4410){return _0x2c4410['getDataValue'](_0x5da7('0x90'))===_0x5da7('0x108');});var _0x216c81=_['map'](_0x564d66,function(_0x3dcbbc){return db[_0x5da7('0xa1')]['upsert']({'membername':_0x2d464c[_0x5da7('0x29')],'UserId':_0x2d464c['id'],'queue_name':_0x3dcbbc[_0x5da7('0x29')],'VoiceQueueId':_0x3dcbbc['id'],'interface':_['isNil'](_0x2d464c[_0x5da7('0x93')])?util[_0x5da7('0x9e')](_0x5da7('0x9f'),_0x2d464c[_0x5da7('0x29')]):_0x2d464c[_0x5da7('0x93')],'paused':_0x2d464c[_0x5da7('0x92')]||![],'penalty':_0x2d464c[_0x5da7('0xa0')]},{'transaction':_0x9b73c7});});return Promise[_0x5da7('0x4f')](_0x216c81);})['then'](function(){return db['TeamVoicePrefix'][_0x5da7('0x40')]({'where':{'teamId':{'$in':_0xddfb5}}});})[_0x5da7('0x1c')](function(_0x2f4a3b){var _0x37bf25=_['map'](_0x2f4a3b,function(_0x31a5cb){return db['UserVoicePrefix']['create']({'UserId':_0x2d464c['id'],'VoicePrefixId':_0x31a5cb['VoicePrefixId']},{'transaction':_0x9b73c7});});return Promise['all'](_0x37bf25);});});})[_0x5da7('0x1c')](function(){for(var _0x1e2af2=0x0;_0x1e2af2<_0x1e8e94['length'];_0x1e2af2++){var _0x4ddc29=_0x1e8e94[_0x1e2af2][_0x5da7('0x109')](_0x5da7('0x90'));var _0x1a0451=_0x4ddc29+_0x5da7('0x9a');socket[_0x5da7('0xa4')]('user'+_0x4ddc29+'Queue:save',{'UserId':_0x21bfed,['queueField']:_0x1e8e94[_0x1e2af2]['id']});}})[_0x5da7('0x1c')](respondWithStatusCode(_0x117694,null))['catch'](APIHandleError(_0x117694));};exports[_0x5da7('0x10a')]=function(_0x33f83f,_0x2aae0a){var _0xac7d8e=_0x33f83f[_0x5da7('0x4c')]['id'];var _0x169b55=null;if(_0x33f83f[_0x5da7('0x3a')]['ids']){_0x169b55=_[_0x5da7('0x10b')](_0x33f83f[_0x5da7('0x3a')][_0x5da7('0x54')])?_0x33f83f['query'][_0x5da7('0x54')]:[_0x33f83f[_0x5da7('0x3a')][_0x5da7('0x54')]];}var _0x23636c=[];return Promise[_0x5da7('0xf3')]()[_0x5da7('0x1c')](function(){if(!_0x169b55)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x5da7('0x2e')]['findOne']({'where':{'id':_0xac7d8e}});})[_0x5da7('0x1c')](function(_0x5cd8f7){if(!_0x5cd8f7)throw new APINotFoundError(util[_0x5da7('0x9e')](_0x5da7('0xbc'),_0x33f83f[_0x5da7('0x4c')]['id']));return db['sequelize'][_0x5da7('0x103')](function(_0x4a78d8){return _0x5cd8f7[_0x5da7('0x10a')](_0x169b55,{'transaction':_0x4a78d8})['then'](function(){return db[_0x5da7('0x104')][_0x5da7('0x40')]({'where':{'id':{'$in':_0x169b55}}});})[_0x5da7('0x1c')](function(_0x2ecb06){var _0x474409=_[_0x5da7('0x25')](_0x2ecb06,function(_0x3e6432){return _0x3e6432[_0x5da7('0x105')]();});return Promise[_0x5da7('0x4f')](_0x474409);})[_0x5da7('0x1c')](function(_0x488bef){_0x23636c=_[_0x5da7('0x106')](_0x488bef);var _0x48918a=_[_0x5da7('0x25')](_0x23636c,function(_0x143117){return _0x143117[_0x5da7('0x10c')](_0x5cd8f7['id'],{'transaction':_0x4a78d8});});return Promise[_0x5da7('0x4f')](_0x48918a);})[_0x5da7('0x1c')](function(){if(!_0x5cd8f7[_0x5da7('0x91')])return;var _0x1dc0dc=_[_0x5da7('0x23')](_0x23636c,function(_0x2e30a1){return _0x2e30a1[_0x5da7('0x109')](_0x5da7('0x90'))===_0x5da7('0x108');});var _0x20b576=_['map'](_0x1dc0dc,function(_0x724fb){return db['UserVoiceQueueRt'][_0x5da7('0x1b')]({'where':{'VoiceQueueId':_0x724fb['id'],'UserId':_0x5cd8f7['id']},'transaction':_0x4a78d8});});return Promise[_0x5da7('0x4f')](_0x20b576);})[_0x5da7('0x1c')](function(){return db[_0x5da7('0x10d')]['findAll']({'where':{'teamId':{'$in':_0x169b55}}});})[_0x5da7('0x1c')](function(_0x5f28fe){var _0x58a397=_[_0x5da7('0x25')](_0x5f28fe,function(_0x5d669c){return db[_0x5da7('0x10e')]['destroy']({'where':{'UserId':_0x5cd8f7['id'],'VoicePrefixId':_0x5d669c[_0x5da7('0x10f')]}},{'transaction':_0x4a78d8});});return Promise['all'](_0x58a397);});});})[_0x5da7('0x1c')](function(){for(var _0x307056=0x0;_0x307056<_0x23636c[_0x5da7('0x43')];_0x307056++){var _0xf9a008=_0x23636c[_0x307056][_0x5da7('0x109')](_0x5da7('0x90'));var _0x17cc57=_0xf9a008+'QueueId';socket[_0x5da7('0xa4')]('user'+_0xf9a008+_0x5da7('0xa5'),{'UserId':_0xac7d8e,['queueField']:_0x23636c[_0x307056]['id']});}})[_0x5da7('0x1c')](respondWithStatusCode(_0x2aae0a,null))[_0x5da7('0x51')](APIHandleError(_0x2aae0a));};exports['getLists']=function(_0x33e739,_0x1f3c82){var _0x4acbd1={};var _0x1d823c={};var _0x30adf1;var _0x43bd7e;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x33e739['params']['id']}})[_0x5da7('0x1c')](handleEntityNotFound(_0x1f3c82,null))['then'](function(_0x2c0e3d){if(_0x2c0e3d){_0x30adf1=_0x2c0e3d;_0x1d823c[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db[_0x5da7('0x110')]['rawAttributes']);_0x1d823c[_0x5da7('0x3a')]=_['keys'](_0x33e739[_0x5da7('0x3a')]);_0x1d823c[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x1d823c[_0x5da7('0xc3')],_0x1d823c[_0x5da7('0x3a')]);_0x4acbd1[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x1d823c['model'],qs['fields'](_0x33e739[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x4acbd1[_0x5da7('0x3f')]=_0x4acbd1[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x4acbd1[_0x5da7('0x3f')]:_0x1d823c[_0x5da7('0xc3')];_0x4acbd1['order']=qs[_0x5da7('0xca')](_0x33e739[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x4acbd1['where']=qs['filters'](_[_0x5da7('0xcb')](_0x33e739[_0x5da7('0x3a')],_0x1d823c[_0x5da7('0xc6')]));if(_0x33e739[_0x5da7('0x3a')][_0x5da7('0x23')]){_0x4acbd1[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x4acbd1[_0x5da7('0x38')],{'$or':_[_0x5da7('0x25')](_0x4acbd1[_0x5da7('0x3f')],function(_0x256527){var _0x32015e={};_0x32015e[_0x256527]={'$like':'%'+_0x33e739[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x32015e;})});}_0x4acbd1=_[_0x5da7('0xcc')]({},_0x4acbd1,_0x33e739[_0x5da7('0xcd')]);return _0x30adf1[_0x5da7('0x111')](_0x4acbd1);}})[_0x5da7('0x1c')](function(_0x5827d3){if(_0x5827d3){_0x43bd7e=_0x5827d3[_0x5da7('0x43')];if(!_0x33e739[_0x5da7('0x3a')][_0x5da7('0xbd')](_0x5da7('0xcf'))){_0x4acbd1[_0x5da7('0x15')]=qs['limit'](_0x33e739[_0x5da7('0x3a')][_0x5da7('0x15')]);_0x4acbd1[_0x5da7('0x13')]=qs['offset'](_0x33e739[_0x5da7('0x3a')]['offset']);}return _0x30adf1[_0x5da7('0x111')](_0x4acbd1);}})[_0x5da7('0x1c')](function(_0x55f4a0){if(_0x55f4a0){return _0x55f4a0?{'count':_0x43bd7e,'rows':_0x55f4a0}:null;}})[_0x5da7('0x1c')](respondWithResult(_0x1f3c82,null))[_0x5da7('0x51')](handleError(_0x1f3c82,null));};exports[_0x5da7('0x112')]=function(_0x20118d,_0x24d52c){var _0x261732={};var _0x59ba8e={};var _0x226b0a;return db[_0x5da7('0x2e')][_0x5da7('0x8a')]({'where':{'id':_0x20118d[_0x5da7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24d52c,null))['then'](function(_0x533f4b){if(_0x533f4b){_0x226b0a=_0x533f4b;_0x59ba8e[_0x5da7('0xc3')]=_[_0x5da7('0xd1')](db['User'][_0x5da7('0xc5')]);_0x59ba8e[_0x5da7('0x3a')]=_['keys'](_0x20118d[_0x5da7('0x3a')]);_0x59ba8e[_0x5da7('0xc6')]=_[_0x5da7('0xc7')](_0x59ba8e[_0x5da7('0xc3')],_0x59ba8e['query']);_0x261732[_0x5da7('0x3f')]=_[_0x5da7('0xc7')](_0x59ba8e[_0x5da7('0xc3')],qs['fields'](_0x20118d[_0x5da7('0x3a')][_0x5da7('0xc8')]));_0x261732['attributes']=_0x261732[_0x5da7('0x3f')][_0x5da7('0x43')]?_0x261732[_0x5da7('0x3f')]:_0x59ba8e['model'];_0x261732[_0x5da7('0xc9')]=qs[_0x5da7('0xca')](_0x20118d[_0x5da7('0x3a')][_0x5da7('0xca')]);_0x261732['where']=qs[_0x5da7('0xc6')](_[_0x5da7('0xcb')](_0x20118d['query'],_0x59ba8e[_0x5da7('0xc6')]));if(_0x20118d['query'][_0x5da7('0x23')]){_0x261732[_0x5da7('0x38')]=_[_0x5da7('0xcc')](_0x261732['where'],{'$or':_[_0x5da7('0x25')](_0x261732['attributes'],function(_0x258e71){var _0x2447dc={};_0x2447dc[_0x258e71]={'$like':'%'+_0x20118d[_0x5da7('0x3a')][_0x5da7('0x23')]+'%'};return _0x2447dc;})});}_0x261732[_0x5da7('0xc3')]=db[_0x5da7('0x2e')];_0x261732['as']='Agents';_0x261732=_['merge']({},_0x261732,_0x20118d[_0x5da7('0xcd')]);return _0x226b0a[_0x5da7('0xe9')]({'include':[_0x261732]});}})['then'](function(_0x44eb6d){if(_0x44eb6d){var _0x4c02a9={},_0x4b3d5e=[];for(var _0x43880c=0x0;_0x43880c<_0x44eb6d[_0x5da7('0x43')];_0x43880c+=0x1){for(var _0x41aa2c=0x0,_0x15cf40;_0x41aa2c<_0x44eb6d[_0x43880c][_0x5da7('0x20')]['length'];_0x41aa2c+=0x1){_0x15cf40=_0x44eb6d[_0x43880c][_0x5da7('0x20')][_0x41aa2c][_0x5da7('0x1d')]({'plain':!![]});_0x4c02a9[_0x15cf40['id']]=_0x15cf40;}}_0x4c02a9=_[_0x5da7('0x113')](_0x4c02a9);for(var _0x2d7bed=qs[_0x5da7('0x13')](_0x20118d[_0x5da7('0x3a')][_0x5da7('0x13')]);_0x2d7bed<_0x4c02a9['length']&&_0x4b3d5e[_0x5da7('0x43')]=_0xb9805a){_0x3e4ec1=_0xb9805a;_0x362453=0xc8;}else{_0x362453=0xce;}_0x36b1b4[_0x652f('0x14')](_0x362453);return _0x36b1b4[_0x652f('0x19')]('Content-Range',_0x2c2b3b+'-'+_0x3e4ec1+'/'+_0xb9805a)[_0x652f('0x1a')](_0x101493);}return null;};}function saveUpdates(_0x443951){return function(_0x268557){if(_0x268557){return _0x268557[_0x652f('0x1b')](_0x443951)[_0x652f('0x1c')](function(_0x52342a){if(_0x52342a[_0x652f('0x1d')]===_0x652f('0x1e')){socket[_0x652f('0x1f')](_0x652f('0x20')+_0x52342a['id'],_0x52342a);}return _0x52342a;});}return null;};}function removeEntity(_0x3251cb){return function(_0x4980bd){if(_0x4980bd){return _0x4980bd[_0x652f('0x21')]()[_0x652f('0x1c')](function(){var _0x1386d8=_0x4980bd['get']({'plain':!![]});if(_0x1386d8[_0x652f('0x1d')]===_0x652f('0x22'))return;var _0x2a3e14=[{'name':'Users','value':_0x652f('0x23'),'ignore':!![]},{'name':'Agents','value':_0x652f('0x1e'),'ignore':![]},{'name':_0x652f('0x24'),'value':'telephone','ignore':![]}];var _0x2184c7=_(_0x2a3e14)[_0x652f('0x25')](_0x652f('0x26'))[_0x652f('0x27')](_0x652f('0x28'))[_0x652f('0x28')]();if(_['includes'](_0x2184c7,_0x1386d8[_0x652f('0x1d')])){return;}var _0x2dd58f=_[_0x652f('0x29')](_0x2a3e14,[_0x652f('0x28'),_0x1386d8[_0x652f('0x1d')]])[_0x652f('0x2a')];return db[_0x652f('0x2b')][_0x652f('0x21')]({'where':{'type':_0x2dd58f,'resourceId':_0x1386d8['id']}})[_0x652f('0x1c')](function(){return _0x4980bd;});})[_0x652f('0x1c')](function(){_0x3251cb[_0x652f('0x14')](0xcc)[_0x652f('0x2c')]();});}};}function handleEntityNotFound(_0x98e85a){return function(_0x542412){if(!_0x542412){_0x98e85a['sendStatus'](0x194);}return _0x542412;};}function handleError(_0x34799e,_0x31c9b1){_0x31c9b1=_0x31c9b1||0x1f4;return function(_0x4943a0){logger[_0x652f('0x2d')](_0x4943a0[_0x652f('0x2e')]);if(_0x4943a0[_0x652f('0x2a')]){delete _0x4943a0[_0x652f('0x2a')];}_0x34799e[_0x652f('0x14')](_0x31c9b1)[_0x652f('0x2f')](_0x4943a0);};}function getUserAttributes(){return _(db[_0x652f('0x30')][_0x652f('0x31')])[_0x652f('0x27')](function(_0x4b6afa){return{'name':_0x4b6afa['fieldName'],'type':_0x4b6afa['type']['key']};})[_0x652f('0x25')](function(_0x9c2f21){return!['password',_0x652f('0x32'),_0x652f('0x33'),_0x652f('0x34'),_0x652f('0x35'),'md5secret'][_0x652f('0x36')](_0x9c2f21[_0x652f('0x2a')]);})[_0x652f('0x28')]();}exports[_0x652f('0x37')]=function(_0x33da07,_0x527274){var _0x78f870={},_0x1cb420={'count':0x0,'rows':[]};var _0x4cb6c7=getUserAttributes();_0x78f870=qs[_0x652f('0x38')](_0x4cb6c7,_0x33da07);var _0x13b33c={'where':_0x78f870[_0x652f('0x39')]};return db[_0x652f('0x30')][_0x652f('0x17')](_0x13b33c)['then'](function(_0x20eaeb){_0x1cb420[_0x652f('0x17')]=_0x20eaeb;if(_0x33da07[_0x652f('0x3a')]['includeAll']){_0x78f870['include']=[{'all':!![]}];}if(_0x33da07[_0x652f('0x3a')][_0x652f('0x3b')]==='true'){_0x78f870[_0x652f('0x3c')]=[{'model':db[_0x652f('0x3d')],'as':_0x652f('0x3b')}];}if(!_[_0x652f('0x36')](_0x78f870[_0x652f('0x3e')],'id')){_0x78f870['attributes']['push']('id');}return db['User'][_0x652f('0x3f')](_0x78f870);})['then'](function(_0x14c5f6){_0x1cb420[_0x652f('0x40')]=_0x14c5f6;if(_0x33da07[_0x652f('0x3a')][_0x652f('0x41')]==='true'){var _0xd479b5=[];for(var _0x12e6dd=0x0;_0x12e6dd<_0x1cb420['rows'][_0x652f('0x42')];_0x12e6dd++){_0xd479b5[_0x652f('0x43')](get_open_tabs(_0x652f('0x44'),_0x1cb420[_0x652f('0x40')][_0x12e6dd][_0x652f('0x45')]));_0xd479b5[_0x652f('0x43')](get_open_tabs(_0x652f('0x46'),_0x1cb420[_0x652f('0x40')][_0x12e6dd]['dataValues']));_0xd479b5[_0x652f('0x43')](get_open_tabs(_0x652f('0x47'),_0x1cb420[_0x652f('0x40')][_0x12e6dd][_0x652f('0x45')]));_0xd479b5['push'](get_open_tabs(_0x652f('0x48'),_0x1cb420['rows'][_0x12e6dd][_0x652f('0x45')]));_0xd479b5['push'](get_open_tabs(_0x652f('0x49'),_0x1cb420[_0x652f('0x40')][_0x12e6dd]['dataValues']));_0xd479b5[_0x652f('0x43')](get_open_tabs(_0x652f('0x4a'),_0x1cb420['rows'][_0x12e6dd][_0x652f('0x45')]));}return Promise['all'](_0xd479b5)[_0x652f('0x1c')](function(){return _0x1cb420;});}else{return _0x1cb420;}})[_0x652f('0x1c')](respondWithFilteredResult(_0x527274,_0x78f870))[_0x652f('0x4b')](handleError(_0x527274,null));};exports['show']=function(_0x34ec9b,_0x26da9e){var _0x582d62=getUserAttributes();_0x34ec9b[_0x652f('0x3a')]['id']=_0x34ec9b[_0x652f('0x4c')]['id'];var _0x272315=qs[_0x652f('0x38')](_0x582d62,_0x34ec9b);if(_0x34ec9b['query'][_0x652f('0x4d')]){_0x272315[_0x652f('0x3c')]=[{'all':!![]}];}if(_0x34ec9b['query'][_0x652f('0x3b')]===_0x652f('0x4e')){_0x272315['include']=[{'model':db[_0x652f('0x3d')],'as':_0x652f('0x3b')}];}_0x272315=_['merge']({},_0x272315,_0x34ec9b[_0x652f('0x4f')]);if(!_['includes'](_0x272315[_0x652f('0x3e')],'id')){_0x272315[_0x652f('0x3e')][_0x652f('0x43')]('id');}return db[_0x652f('0x30')]['find'](_0x272315)[_0x652f('0x1c')](handleEntityNotFound(_0x26da9e,null))[_0x652f('0x1c')](function(_0x4571ee){var _0x3991b7=[];values=_0x4571ee;if(_0x34ec9b[_0x652f('0x3a')]['openTabs']===_0x652f('0x4e')){_0x3991b7[_0x652f('0x43')](get_open_tabs(_0x652f('0x44'),_0x4571ee['dataValues']));_0x3991b7[_0x652f('0x43')](get_open_tabs(_0x652f('0x46'),_0x4571ee[_0x652f('0x45')]));_0x3991b7[_0x652f('0x43')](get_open_tabs(_0x652f('0x49'),_0x4571ee[_0x652f('0x45')]));_0x3991b7['push'](get_open_tabs(_0x652f('0x4a'),_0x4571ee[_0x652f('0x45')]));_0x3991b7[_0x652f('0x43')](get_open_tabs(_0x652f('0x47'),_0x4571ee[_0x652f('0x45')]));_0x3991b7['push'](get_open_tabs(_0x652f('0x48'),_0x4571ee[_0x652f('0x45')]));return Promise[_0x652f('0x50')](_0x3991b7);}else{return values;}})[_0x652f('0x1c')](function(){return values;})[_0x652f('0x1c')](respondWithResult(_0x26da9e,null))[_0x652f('0x4b')](handleError(_0x26da9e,null));};exports[_0x652f('0x1b')]=function(_0x371886,_0x15be56){if(_0x371886['body']['id']){delete _0x371886['body']['id'];}delete _0x371886['body'][_0x652f('0x1d')];return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x371886[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x15be56,null))['then'](saveUpdates(_0x371886[_0x652f('0x51')],null))[_0x652f('0x1c')](respondWithResult(_0x15be56,null))[_0x652f('0x4b')](handleError(_0x15be56,null));};exports[_0x652f('0x52')]=function(_0x467484,_0x1ae701){return db[_0x652f('0x30')][_0x652f('0x52')]()[_0x652f('0x1c')](respondWithResult(_0x1ae701,null))[_0x652f('0x4b')](handleError(_0x1ae701,null));};exports[_0x652f('0x53')]=function(_0x1f23c6,_0x12f2d0){return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x1f23c6[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x12f2d0,null))['then'](function(_0x24790b){if(_0x24790b){return _0x24790b[_0x652f('0x53')](_0x1f23c6[_0x652f('0x51')]['ids'],_[_0x652f('0x54')](_0x1f23c6['body'],['ids','id'])||{});}})[_0x652f('0x1c')](respondWithResult(_0x12f2d0,null))[_0x652f('0x4b')](handleError(_0x12f2d0,null));};function validateUser(_0x560015){return new Promise(function(_0x2a066f,_0x4e2add){if(_0x560015[_0x652f('0x55')])return _0x2a066f(_0x560015);return db[_0x652f('0x56')][_0x652f('0x57')](0x1)['then'](function(_0x4ea4af){if(_0x4ea4af[_0x652f('0x58')])authService[_0x652f('0x59')](_0x560015[_0x652f('0x5a')]);db[_0x652f('0x30')]['max'](_0x652f('0x55'))['then'](function(_0x1ccfd1){if(_[_0x652f('0x5b')](_0x1ccfd1)){_0x560015[_0x652f('0x55')]=_0x4ea4af[_0x652f('0x5c')]||0x1;return;}if(_[_0x652f('0x5b')](_0x4ea4af['min_internal'])||_0x4ea4af['min_internal']===_0x1ccfd1){_0x560015[_0x652f('0x55')]=_0x1ccfd1+0x1;return;}if(_0x4ea4af[_0x652f('0x5c')]>_0x1ccfd1){_0x560015['internal']=_0x4ea4af[_0x652f('0x5c')];return;}return db['sequelize'][_0x652f('0x3a')](_0x652f('0x5d'),{'type':db[_0x652f('0x5e')][_0x652f('0x5f')][_0x652f('0x60')]})[_0x652f('0x1c')](function(_0x1b5397){if(_0x1b5397&&_0x1b5397[_0x652f('0x42')]){for(var _0x1e8e5e=0x0,_0x557bfe=_0x1b5397[_0x652f('0x42')];_0x1e8e5e<_0x557bfe&&_[_0x652f('0x5b')](_0x560015[_0x652f('0x55')]);_0x1e8e5e++){if(_0x4ea4af['min_internal']<=_0x1b5397[_0x1e8e5e]['from']){_0x560015[_0x652f('0x55')]=_0x1b5397[_0x1e8e5e]['from'];}else if(_0x4ea4af[_0x652f('0x5c')]>_0x1b5397[_0x1e8e5e]['from']&&_0x4ea4af[_0x652f('0x5c')]<=_0x1b5397[_0x1e8e5e]['to']){_0x560015['internal']=_0x4ea4af['min_internal'];}}}if(_[_0x652f('0x5b')](_0x560015['internal'])){_0x560015[_0x652f('0x55')]=_0x1ccfd1+0x1;}return _0x2a066f(_0x560015);});});})[_0x652f('0x4b')](function(_0x334c9d){_0x4e2add(_0x334c9d);});});}function updateUser(_0x44b590){return new Promise(function(_0x34d702,_0x1e3ba8){try{if(_0x44b590[_0x652f('0x61')]){_0x44b590[_0x652f('0x62')]=_0x44b590[_0x652f('0x55')];_0x44b590[_0x652f('0x63')]={'mailbox':_0x44b590[_0x652f('0x55')],'password':_0x44b590['password'],'fullname':_0x44b590['fullname'],'email':_0x44b590['email']};}if(_0x44b590[_0x652f('0x1d')]===_0x652f('0x1e')){if(!_0x44b590[_0x652f('0x64')])_0x44b590[_0x652f('0x64')]=[_0x652f('0x65'),_0x652f('0x66'),_0x652f('0x67'),'113',_0x652f('0x68'),_0x652f('0x69'),'105',_0x652f('0x6a'),_0x652f('0x6b'),_0x652f('0x6c'),_0x652f('0x6d'),_0x652f('0x6e'),_0x652f('0x6f'),'114',_0x652f('0x70')];}_0x34d702(_0x44b590);}catch(_0x1f32e2){_0x1e3ba8(_0x1f32e2);}});}exports[_0x652f('0x71')]=function(_0x322971,_0x449d06){if(_0x322971[_0x652f('0x23')][_0x652f('0x1d')]===_0x652f('0x1e'))throw new Error('Unauthorized');if(_0x322971[_0x652f('0x51')][_0x652f('0x1d')]==='user'&&_0x322971[_0x652f('0x23')][_0x652f('0x1d')]!==_0x652f('0x22')){throw new Error(_0x652f('0x72'));}if(_0x322971[_0x652f('0x51')][_0x652f('0x1d')]===_0x652f('0x22')&&_0x322971[_0x652f('0x23')]['role']!==_0x652f('0x22')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x652f('0x73')]([_0x322971[_0x652f('0x51')]])[_0x652f('0x1c')](function(){return validateUser(_0x322971[_0x652f('0x51')]);})['then'](function(_0x386402){return updateUser(_0x386402)[_0x652f('0x1c')](function(_0x1d26f8){if(_0x1d26f8[_0x652f('0x1d')]===_0x652f('0x22')){_0x1d26f8[_0x652f('0x74')]=_0x322971[_0x652f('0x23')][_0x652f('0x74')];delete _0x1d26f8[_0x652f('0x75')];}return _0x1d26f8;});})[_0x652f('0x1c')](function(_0x28b6bf){return db[_0x652f('0x30')][_0x652f('0x71')](_0x28b6bf,{'include':[{'model':db['VoiceMail'],'as':_0x652f('0x63')}]});})[_0x652f('0x1c')](function(_0xd6de66){if(_0x322971[_0x652f('0x51')][_0x652f('0x1d')]==='user')return _0xd6de66;if(_0x322971['user'][_0x652f('0x1d')]!==_0x652f('0x23'))return _0xd6de66;return db[_0x652f('0x76')][_0x652f('0x29')]({'where':{'name':_0xd6de66[_0x652f('0x1d')]===_0x652f('0x1e')?_0x652f('0x77'):_0x652f('0x24'),'userProfileId':_0x322971[_0x652f('0x23')]['userProfileId']},'raw':!![]})[_0x652f('0x1c')](function(_0x3df690){if(!_0x3df690||_0x3df690[_0x652f('0x78')]!=0x0)return _0xd6de66;return db['UserProfileResource'][_0x652f('0x71')]({'name':_0xd6de66[_0x652f('0x2a')],'resourceId':_0xd6de66['id'],'type':_0x3df690['name'],'sectionId':_0x3df690['id']},{})[_0x652f('0x1c')](function(){return _0xd6de66;});})[_0x652f('0x4b')](function(_0x35f2c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35f2c8);throw _0x35f2c8;});})[_0x652f('0x1c')](respondWithResult(_0x449d06,0xc9))[_0x652f('0x4b')](handleError(_0x449d06,null));};exports[_0x652f('0x79')]=function(_0x290d63,_0x13689b){var _0x5c3094=_0x290d63[_0x652f('0x51')];var _0x1cab27=[];if(_0x290d63['user']['role']==='agent')throw new Error('Unauthorized');if(_[_0x652f('0x7a')](_0x5c3094,[_0x652f('0x1d'),_0x652f('0x23')])&&_0x290d63[_0x652f('0x23')][_0x652f('0x1d')]!==_0x652f('0x22')){throw new Error(_0x652f('0x72'));}if(_[_0x652f('0x7a')](_0x5c3094,[_0x652f('0x1d'),_0x652f('0x22')])&&_0x290d63[_0x652f('0x23')]['role']!==_0x652f('0x22')){throw new Error(_0x652f('0x7b'));}return licenseUtil[_0x652f('0x73')](_0x5c3094)[_0x652f('0x1c')](function(){return validateUser(_0x5c3094[0x0]);})[_0x652f('0x1c')](function(){for(var _0x1fcdb1=0x1;_0x1fcdb1<_0x5c3094[_0x652f('0x42')];_0x1fcdb1++){var _0x13307b=_0x5c3094[_0x1fcdb1-0x1][_0x652f('0x55')];if(!_0x5c3094[_0x1fcdb1]['internal'])_0x5c3094[_0x1fcdb1][_0x652f('0x55')]=_0x13307b+0x1;_0x1cab27[_0x652f('0x43')](validateUser(_0x5c3094[_0x1fcdb1]));}return Promise[_0x652f('0x50')](_0x1cab27);})[_0x652f('0x1c')](function(){_0x1cab27=[];for(var _0x4f234f=0x0;_0x4f234f<_0x5c3094[_0x652f('0x42')];_0x4f234f++){_0x1cab27[_0x652f('0x43')](updateUser(_0x5c3094[_0x4f234f]));}return Promise[_0x652f('0x50')](_0x1cab27);})[_0x652f('0x1c')](function(){_0x1cab27=_0x5c3094[_0x652f('0x27')](function(_0xfde93a){return db[_0x652f('0x30')][_0x652f('0x71')](_0xfde93a,{'include':[{'model':db[_0x652f('0x63')],'as':_0x652f('0x63')}]})[_0x652f('0x1c')](function(_0x210d30){_0xfde93a['id']=_0x210d30['id'];return _0xfde93a;});});return Promise[_0x652f('0x50')](_0x1cab27);})[_0x652f('0x1c')](function(_0x547bd5){if(_0x290d63['body'][_0x652f('0x1d')]==='user')return _0x547bd5;if(_0x290d63[_0x652f('0x23')][_0x652f('0x1d')]!=='user')return _0x547bd5;var _0x44936b=_[_0x652f('0x7a')](_0x547bd5,function(_0x469e3d){return _0x469e3d['role']===_0x652f('0x1e')||_0x469e3d['role']===_0x652f('0x7c');});if(!_0x44936b)return _0x547bd5;return db[_0x652f('0x76')][_0x652f('0x3f')]({'where':{'name':{'$or':[_0x652f('0x77'),_0x652f('0x24')]},'userProfileId':_0x290d63[_0x652f('0x23')][_0x652f('0x75')]},'raw':!![]})[_0x652f('0x1c')](function(_0x2b695d){if(_[_0x652f('0x7d')](_0x2b695d)||!_['some'](_0x2b695d,[_0x652f('0x78'),0x0]))return _0x547bd5;_0x1cab27=[];var _0x5707f6=_(_0x2b695d)['map'](function(_0x47f206){if(_0x47f206['autoAssociation']===0x1)return;return _0x47f206[_0x652f('0x2a')]===_0x652f('0x77')?'agent':_0x652f('0x7c');})['compact']()['value']();for(var _0x565abf=0x0;_0x565abf<_0x547bd5[_0x652f('0x42')];_0x565abf++){if(!_[_0x652f('0x36')](_0x5707f6,_0x547bd5[_0x565abf]['role']))return;var _0x26d72d=_0x547bd5[_0x565abf][_0x652f('0x1d')]===_0x652f('0x1e')?_0x652f('0x77'):'Telephones';_0x1cab27['push'](db[_0x652f('0x2b')][_0x652f('0x71')]({'name':_0x547bd5[_0x565abf][_0x652f('0x2a')],'resourceId':_0x547bd5[_0x565abf]['id'],'type':_0x26d72d,'sectionId':_[_0x652f('0x29')](_0x2b695d,['name',_0x26d72d])['id']},{}));}return Promise[_0x652f('0x50')](_0x1cab27);});})[_0x652f('0x1c')](respondWithResult(_0x13689b,0xc9))['catch'](handleError(_0x13689b,null));};exports[_0x652f('0x7e')]=function(_0x421354,_0x55274a){if(_0x421354[_0x652f('0x51')]['id']){delete _0x421354['body']['id'];}return db['User']['find']({'where':{'id':_0x421354[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](function(_0x16dbaf){if(!_0x16dbaf)return null;if(_0x16dbaf['id']===_0x421354[_0x652f('0x23')]['id']){if(!_0x421354[_0x652f('0x51')][_0x652f('0x7f')]||!_0x421354[_0x652f('0x51')][_0x652f('0x80')]){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))](_0x652f('0x83'));}if(!_0x16dbaf[_0x652f('0x84')](_0x421354[_0x652f('0x51')][_0x652f('0x7f')])){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))]('Wrong\x20credentials');}if(_0x421354[_0x652f('0x51')]['oldPassword']===_0x421354[_0x652f('0x51')][_0x652f('0x80')]){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))](_0x652f('0x85'));}}else if(_0x421354[_0x652f('0x23')]['role']===_0x652f('0x22')){if(!_0x421354['body']['newPassword']){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))](_0x652f('0x86'));}}else if(_0x421354[_0x652f('0x23')][_0x652f('0x1d')]===_0x652f('0x23')){if(!_0x421354[_0x652f('0x51')][_0x652f('0x80')]){throw new db['Sequelize'][(_0x652f('0x82'))](_0x652f('0x86'));}if(_0x16dbaf[_0x652f('0x1d')]!=='agent'){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))](_0x652f('0x87'));}}else{throw new db[(_0x652f('0x81'))]['ValidationError'](_0x652f('0x87'));}return _0x16dbaf;})[_0x652f('0x1c')](handleEntityNotFound(_0x55274a,null))[_0x652f('0x1c')](function(_0x1fc6a1){return db[_0x652f('0x56')][_0x652f('0x88')]({'attributes':['id',_0x652f('0x58'),_0x652f('0x89'),_0x652f('0x8a')]})['then'](function(_0x5699cf){if(_0x5699cf[_0x652f('0x58')])authService[_0x652f('0x59')](_0x421354['body'][_0x652f('0x80')]);if(!_0x5699cf[_0x652f('0x89')]||!_0x1fc6a1[_0x652f('0x33')])return _0x1fc6a1;authService[_0x652f('0x8b')](_0x421354['body'][_0x652f('0x80')],_0x1fc6a1[_0x652f('0x33')],_0x5699cf[_0x652f('0x8a')]);return _0x1fc6a1;})[_0x652f('0x1c')](saveUpdates({'password':_0x421354['body']['newPassword'],'passwordResetAt':_0x421354[_0x652f('0x23')]['id']==_0x421354[_0x652f('0x4c')]['id']?moment():null,'previousPasswords':authService[_0x652f('0x8c')](_0x421354[_0x652f('0x51')][_0x652f('0x80')],_0x1fc6a1[_0x652f('0x33')])},null));})[_0x652f('0x1c')](respondWithResult(_0x55274a,null))['catch'](handleError(_0x55274a,null));};exports[_0x652f('0x8d')]=function(_0xc75da,_0x5e18b1){var _0x50fd46=_0xc75da['body']['channel'];return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0xc75da[_0x652f('0x4c')]['id']},'attributes':['id',_0x652f('0x2a'),'role',_0x652f('0x8e'),'loginInPause','voicePause',_0x652f('0x8f')]})['then'](handleEntityNotFound(_0x5e18b1,null))[_0x652f('0x1c')](function(_0x29b1fd){if(_0x29b1fd){if(!utils['isValidChannel'](_0x50fd46)){throw new db[(_0x652f('0x81'))]['ValidationError'](_0x652f('0x90'));}return _0x29b1fd[_0x652f('0x91')+_[_0x652f('0x92')](_0x50fd46[_0x652f('0x93')]())+_0x652f('0x94')](_0xc75da[_0x652f('0x51')]['ids'],{'penalty':_0xc75da[_0x652f('0x51')][_0x652f('0x95')]||0x0})[_0x652f('0x96')](function(_0x172c0d){for(var _0x465110=0x0;_0x465110<_0xc75da['body'][_0x652f('0x97')][_0x652f('0x42')];_0x465110+=0x1){var _0xaba013={'UserId':Number(_0xc75da[_0x652f('0x4c')]['id'])};_0xaba013[_[_0x652f('0x92')](_0x50fd46[_0x652f('0x93')]())+_0x652f('0x98')]=Number(_0xc75da['body'][_0x652f('0x97')][_0x465110]);socket['emit'](_0x652f('0x23')+_[_0x652f('0x92')](_0x50fd46[_0x652f('0x93')]())+_0x652f('0x99'),_0xaba013);}return _0x172c0d;})[_0x652f('0x1c')](function(){if(_0x50fd46==='voice'){return db['VoiceQueue'][_0x652f('0x3f')]({'where':{'id':_0xc75da[_0x652f('0x51')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x652f('0x1c')](function(_0x7b1988){var _0x3f3118=_0x29b1fd[_0x652f('0x9a')]({'plain':!![]});var _0x28feee=[];if(_0x50fd46===_0x652f('0x9b')&&_0x3f3118[_0x652f('0x1d')]===_0x652f('0x1e')&&_0x3f3118[_0x652f('0x8e')]){for(let _0x17abd3=0x0;_0x17abd3<_0x7b1988[_0x652f('0x42')];_0x17abd3+=0x1){_0x28feee['push']({'membername':_0x3f3118['name'],'UserId':_0x3f3118['id'],'queue_name':_0x7b1988[_0x17abd3]['name'],'VoiceQueueId':_0x7b1988[_0x17abd3]['id'],'interface':_[_0x652f('0x5b')](_0x3f3118[_0x652f('0x8f')])?util[_0x652f('0x9c')](_0x652f('0x9d'),_0x3f3118['name']):_0x3f3118[_0x652f('0x8f')],'paused':_0x3f3118[_0x652f('0x9e')]||![],'penalty':_0xc75da[_0x652f('0x51')][_0x652f('0x95')]||0x0});}return Promise[_0x652f('0x50')](_0x28feee[_0x652f('0x27')](function(_0x3d7a3b){return db[_0x652f('0x9f')][_0x652f('0xa0')](_0x3d7a3b);}));}return _0x29b1fd;});}})[_0x652f('0x1c')](respondWithStatusCode(_0x5e18b1,null))[_0x652f('0x4b')](handleError(_0x5e18b1,null));};exports[_0x652f('0xa1')]=function(_0x3126a8,_0x239732){var _0x23f5cb,_0x2467d0;return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x3126a8[_0x652f('0x4c')]['id']},'attributes':['id',_0x652f('0x2a'),_0x652f('0x1d')]})[_0x652f('0x1c')](handleEntityNotFound(_0x239732,null))['then'](function(_0x1a7927){if(_0x1a7927){_0x23f5cb=_0x1a7927;if(!_0x3126a8[_0x652f('0x3a')]['channel']||!utils[_0x652f('0xa2')](_0x3126a8[_0x652f('0x3a')]['channel'])){throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))]('Unknown\x20channel');}return _0x1a7927[_0x652f('0xa3')+_[_0x652f('0x92')](_0x3126a8['query']['channel'][_0x652f('0x93')]())+_0x652f('0x94')](_0x3126a8['query'][_0x652f('0x97')]);}})['then'](function(_0x57fe03){if(_['isArray'](_0x3126a8[_0x652f('0x3a')][_0x652f('0x97')])){for(var _0x50ea0e=0x0;_0x50ea0e<_0x3126a8['query']['ids'][_0x652f('0x42')];_0x50ea0e+=0x1){_0x2467d0={'UserId':Number(_0x3126a8[_0x652f('0x4c')]['id'])};_0x2467d0[_[_0x652f('0x92')](_0x3126a8[_0x652f('0x3a')]['channel']['toLowerCase']())+'QueueId']=Number(_0x3126a8[_0x652f('0x3a')]['ids'][_0x50ea0e]);socket[_0x652f('0x1f')](_0x652f('0x23')+_['capitalize'](_0x3126a8[_0x652f('0x3a')]['channel']['toLowerCase']())+_0x652f('0xa4'),_0x2467d0);}}else{_0x2467d0={'UserId':Number(_0x3126a8[_0x652f('0x4c')]['id'])};_0x2467d0[_[_0x652f('0x92')](_0x3126a8['query'][_0x652f('0xa5')][_0x652f('0x93')]())+_0x652f('0x98')]=Number(_0x3126a8[_0x652f('0x3a')][_0x652f('0x97')]);socket[_0x652f('0x1f')]('user'+_[_0x652f('0x92')](_0x3126a8[_0x652f('0x3a')]['channel'][_0x652f('0x93')]())+_0x652f('0xa4'),_0x2467d0);}return _0x57fe03;})[_0x652f('0x1c')](function(){if(_0x3126a8[_0x652f('0x3a')][_0x652f('0xa5')]===_0x652f('0x9b')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x3126a8[_0x652f('0x4c')]['id'],'VoiceQueueId':_0x3126a8[_0x652f('0x3a')][_0x652f('0x97')]},'individualHooks':!![]})[_0x652f('0x1c')](function(){return _0x23f5cb;});}return _0x23f5cb;})[_0x652f('0x1c')](respondWithStatusCode(_0x239732,null))[_0x652f('0x4b')](handleError(_0x239732,null));};exports[_0x652f('0xa6')]=function(_0x5008e3,_0x250e93){_0x5008e3[_0x652f('0x51')][_0x652f('0xa7')]=_0x5008e3['file'][_0x652f('0xa8')];return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x5008e3[_0x652f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x250e93,null))[_0x652f('0x1c')](saveUpdates(_0x5008e3[_0x652f('0x51')],null))[_0x652f('0x1c')](respondWithResult(_0x250e93,null))[_0x652f('0x4b')](handleError(_0x250e93,null));};exports[_0x652f('0xa9')]=function(_0x175c44,_0x568fae){var _0x22951b=path['join'](config['root'],_0x652f('0xaa'));return db['User'][_0x652f('0x29')]({'where':{'id':_0x175c44[_0x652f('0x4c')]['id']},'attributes':['id',_0x652f('0xa7')],'raw':!![]})[_0x652f('0x1c')](handleEntityNotFound(_0x568fae,null))[_0x652f('0x1c')](function(_0xe528cc){if(_0xe528cc){if(_[_0x652f('0x5b')](_0xe528cc[_0x652f('0xa7')])){return _0x568fae[_0x652f('0xab')](_0x22951b);}else{if(!fs[_0x652f('0xac')](path[_0x652f('0xad')](config[_0x652f('0xae')],_0x652f('0xaf'),_0xe528cc[_0x652f('0xa7')]))){return _0x568fae[_0x652f('0xab')](_0x22951b);}return _0x568fae['download'](path[_0x652f('0xad')](config['root'],'server/files/images/',_0xe528cc['userpic']));}}})['catch'](handleError(_0x568fae,null));};exports[_0x652f('0xb0')]=function(_0x15d065,_0x37866c){return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x15d065['params']['id']},'attributes':['id']})[_0x652f('0x1c')](handleEntityNotFound(_0x37866c,null))[_0x652f('0x1c')](function(_0x5cc4e5){var _0x20c458=[];values=_0x5cc4e5[_0x652f('0x45')];_0x20c458[_0x652f('0x43')](get_open_tabs('chat',_0x5cc4e5[_0x652f('0x45')]));_0x20c458[_0x652f('0x43')](get_open_tabs(_0x652f('0x46'),_0x5cc4e5[_0x652f('0x45')]));_0x20c458['push'](get_open_tabs(_0x652f('0x49'),_0x5cc4e5[_0x652f('0x45')]));_0x20c458['push'](get_open_tabs(_0x652f('0x4a'),_0x5cc4e5[_0x652f('0x45')]));_0x20c458['push'](get_open_tabs(_0x652f('0x47'),_0x5cc4e5[_0x652f('0x45')]));_0x20c458[_0x652f('0x43')](get_open_tabs(_0x652f('0x48'),_0x5cc4e5[_0x652f('0x45')]));return Promise[_0x652f('0x50')](_0x20c458);})['then'](function(_0xd77cd){if(_0xd77cd){var _0xfefaa3=_[_0x652f('0x27')](values['ChatOpenTabs'],function(_0x158ea2){return{'channel':'CHAT','id':_0x158ea2['id'],'createdAt':_0x158ea2[_0x652f('0xb1')]};});var _0x41166d=_[_0x652f('0x27')](values[_0x652f('0xb2')],function(_0x5c61aa){return{'channel':_0x652f('0xb3'),'id':_0x5c61aa['id'],'createdAt':_0x5c61aa['createdAt']};});var _0x450eae=_['map'](values[_0x652f('0xb4')],function(_0xbd4913){return{'channel':_0x652f('0xb5'),'id':_0xbd4913['id'],'createdAt':_0xbd4913[_0x652f('0xb1')]};});var _0xcbb356=_[_0x652f('0x27')](values[_0x652f('0xb6')],function(_0x481885){return{'channel':_0x652f('0xb7'),'id':_0x481885['id'],'createdAt':_0x481885['createdAt']};});var _0x3f49c5=_[_0x652f('0x27')](values[_0x652f('0xb8')],function(_0x33b4a9){return{'channel':_0x652f('0xb9'),'id':_0x33b4a9['id'],'createdAt':_0x33b4a9[_0x652f('0xb1')]};});var _0x32b6a0=_['map'](values[_0x652f('0xba')],function(_0xd01b0f){return{'channel':_0x652f('0xbb'),'id':_0xd01b0f['id'],'createdAt':_0xd01b0f[_0x652f('0xb1')]};});var _0x2fb68e=_[_0x652f('0xbc')](_0xfefaa3,_0x41166d,_0x450eae,_0xcbb356,_0x3f49c5,_0x32b6a0);var _0x162a14={'count':_0x2fb68e[_0x652f('0x42')],'rows':_0x2fb68e};return _0x162a14;}else return null;})[_0x652f('0x1c')](respondWithResult(_0x37866c,null))[_0x652f('0x4b')](handleError(_0x37866c,null));};exports[_0x652f('0xbd')]=function(_0x1abacb,_0x547739){var _0x46176a={};return db['User'][_0x652f('0x88')]({'where':{'id':_0x1abacb[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](function(_0x8ab95e){if(!_0x8ab95e){throw new APINotFoundError(util[_0x652f('0x9c')](_0x652f('0xbe'),_0x1abacb[_0x652f('0x4c')]['id']));}return contacts[_0x652f('0x52')]();})[_0x652f('0x1c')](function(_0x2894b7){_0x1abacb[_0x652f('0x3a')][_0x652f('0x30')]=_0x1abacb[_0x652f('0x4c')]['id'];_0x46176a=qs[_0x652f('0x38')](_0x2894b7,_0x1abacb);if(_0x1abacb[_0x652f('0x3a')][_0x652f('0xbf')]('includeAll')){_0x46176a[_0x652f('0x3c')]=[{'model':db[_0x652f('0xc0')],'as':'List','required':![]},{'model':db[_0x652f('0xc1')],'as':_0x652f('0xc2'),'attributes':['id',_0x652f('0x2a'),_0x652f('0xc3')],'where':_0x1abacb[_0x652f('0x3a')]['tag']?{'id':_0x1abacb['query']['tag']}:undefined,'required':_0x1abacb[_0x652f('0x3a')][_0x652f('0xc4')]?!![]:![]}];}return contacts[_0x652f('0x3f')](_0x1abacb[_0x652f('0x3a')],_0x1abacb[_0x652f('0x23')],_0x46176a,_0x2894b7);})[_0x652f('0x1c')](respondWithFilteredResult(_0x547739,_0x46176a))[_0x652f('0x4b')](APIHandleError(_0x547739));};exports[_0x652f('0xc5')]=function(_0x24490c,_0x5df8e2){var _0x409305;var _0x83465e={};var _0x2e0af2;return db[_0x652f('0x30')]['findOne']({'where':{'id':_0x24490c[_0x652f('0x4c')]['id']},'attributes':['id',_0x652f('0x2a'),'role']})[_0x652f('0x1c')](handleEntityNotFound(_0x5df8e2,null))['then'](function(_0x5d8183){if(!utils[_0x652f('0xa2')](_0x24490c[_0x652f('0x3a')][_0x652f('0xa5')])){throw new db['Sequelize'][(_0x652f('0x82'))]('Unknown\x20channel');}_0x409305=_0x5d8183;var _0x492f7e={};_0x492f7e['model']=_[_0x652f('0xc6')](db[_[_0x652f('0x92')](_0x24490c['query'][_0x652f('0xa5')])+_0x652f('0xc7')]['rawAttributes']);_0x492f7e[_0x652f('0x3a')]=_['keys'](_0x24490c[_0x652f('0x3a')]);_0x492f7e[_0x652f('0xc8')]=_['intersection'](_0x492f7e[_0x652f('0xc9')],_0x492f7e[_0x652f('0x3a')]);_0x83465e['attributes']=_[_0x652f('0xca')](_0x492f7e[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0x24490c[_0x652f('0x3a')][_0x652f('0xcb')]));_0x83465e[_0x652f('0x3e')]=_0x83465e[_0x652f('0x3e')]['length']?_0x83465e[_0x652f('0x3e')]:_0x492f7e[_0x652f('0xc9')];_0x83465e[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x24490c['query'][_0x652f('0xcd')]);_0x83465e['where']=qs[_0x652f('0xc8')](_['pick'](_0x24490c[_0x652f('0x3a')],_0x492f7e[_0x652f('0xc8')]));if(_0x24490c[_0x652f('0x3a')][_0x652f('0x25')]){_0x83465e['where']=_['merge'](_0x83465e['where'],{'$or':_[_0x652f('0x27')](_0x83465e['attributes'],function(_0x6151a3){var _0x52e2bf={};_0x52e2bf[_0x6151a3]={'$like':'%'+_0x24490c[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x52e2bf;})});}_0x83465e=_['merge']({},_0x83465e,_0x24490c[_0x652f('0x4f')]);switch(_0x409305['role']){case _0x652f('0x22'):return db[_['capitalize'](_0x24490c[_0x652f('0x3a')][_0x652f('0xa5')])+_0x652f('0xc7')][_0x652f('0x3f')](_0x83465e);case'user':case _0x652f('0x1e'):return _0x409305['get'+_['capitalize'](_0x24490c[_0x652f('0x3a')][_0x652f('0xa5')])+'Queues'](_0x83465e);default:throw new db[(_0x652f('0x81'))][(_0x652f('0x82'))](_0x652f('0xce'));}})[_0x652f('0x1c')](function(_0x42598c){_0x2e0af2=_0x42598c[_0x652f('0x42')];if(!_0x24490c['query'][_0x652f('0xbf')](_0x652f('0xcf'))){_0x83465e['limit']=qs['limit'](_0x24490c[_0x652f('0x3a')]['limit']);_0x83465e['offset']=qs[_0x652f('0x18')](_0x24490c[_0x652f('0x3a')][_0x652f('0x18')]);}switch(_0x409305[_0x652f('0x1d')]){case'admin':return db[_[_0x652f('0x92')](_0x24490c['query']['channel'])+_0x652f('0xc7')][_0x652f('0x3f')](_0x83465e);case _0x652f('0x23'):case _0x652f('0x1e'):return _0x409305[_0x652f('0x9a')+_[_0x652f('0x92')](_0x24490c[_0x652f('0x3a')][_0x652f('0xa5')])+_0x652f('0x94')](_0x83465e);}})[_0x652f('0x1c')](function(_0xd9ebc3){return{'count':_0x2e0af2,'rows':_0xd9ebc3};})[_0x652f('0x1c')](respondWithResult(_0x5df8e2,null))[_0x652f('0x4b')](handleError(_0x5df8e2,null));};exports[_0x652f('0xd0')]=function(_0x24bd26,_0x46b4b5){var _0x5e87f7={};var _0x5a3543={};var _0xd37f1;var _0x39a84c;return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x24bd26['params']['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x46b4b5,null))[_0x652f('0x1c')](function(_0xc78cd9){if(_0xc78cd9){_0xd37f1=_0xc78cd9;_0x5a3543[_0x652f('0xc9')]=_['keys'](db[_0x652f('0x9f')]['rawAttributes']);_0x5a3543[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x24bd26[_0x652f('0x3a')]);_0x5a3543[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x5a3543['model'],_0x5a3543[_0x652f('0x3a')]);_0x5e87f7[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x5a3543['model'],qs[_0x652f('0xcb')](_0x24bd26['query'][_0x652f('0xcb')]));_0x5e87f7[_0x652f('0x3e')]=_0x5e87f7[_0x652f('0x3e')]['length']?_0x5e87f7[_0x652f('0x3e')]:_0x5a3543[_0x652f('0xc9')];_0x5e87f7[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x24bd26['query'][_0x652f('0xcd')]);_0x5e87f7[_0x652f('0x39')]=qs['filters'](_[_0x652f('0xd1')](_0x24bd26[_0x652f('0x3a')],_0x5a3543[_0x652f('0xc8')]));if(_0x24bd26['query'][_0x652f('0x25')]){_0x5e87f7[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x5e87f7[_0x652f('0x39')],{'$or':_['map'](_0x5e87f7[_0x652f('0x3e')],function(_0x1d96a9){var _0x4e1bd5={};_0x4e1bd5[_0x1d96a9]={'$like':'%'+_0x24bd26[_0x652f('0x3a')]['filter']+'%'};return _0x4e1bd5;})});}_0x5e87f7=_['merge']({},_0x5e87f7,_0x24bd26[_0x652f('0x4f')]);return _0xd37f1[_0x652f('0xd0')](_0x5e87f7);}})[_0x652f('0x1c')](function(_0x59a0a4){if(_0x59a0a4){_0x39a84c=_0x59a0a4[_0x652f('0x42')];if(!_0x24bd26[_0x652f('0x3a')]['hasOwnProperty'](_0x652f('0xcf'))){_0x5e87f7[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x24bd26[_0x652f('0x3a')][_0x652f('0x16')]);_0x5e87f7[_0x652f('0x18')]=qs[_0x652f('0x18')](_0x24bd26[_0x652f('0x3a')][_0x652f('0x18')]);}return _0xd37f1[_0x652f('0xd0')](_0x5e87f7);}})[_0x652f('0x1c')](function(_0x189f4e){if(_0x189f4e){return _0x189f4e?{'count':_0x39a84c,'rows':_0x189f4e}:null;}})[_0x652f('0x1c')](respondWithResult(_0x46b4b5,null))['catch'](handleError(_0x46b4b5,null));};exports[_0x652f('0xd3')]=function(_0xf6670e,_0x461fc1){var _0x19e5e0={};var _0x221619={};var _0x253606;var _0x33f7e6;return db['User'][_0x652f('0x88')]({'where':{'id':_0xf6670e[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x461fc1,null))[_0x652f('0x1c')](function(_0x4c84d0){if(_0x4c84d0){_0x253606=_0x4c84d0;_0x221619[_0x652f('0xc9')]=_[_0x652f('0xc6')](db[_0x652f('0xd4')][_0x652f('0x31')]);_0x221619[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0xf6670e[_0x652f('0x3a')]);_0x221619[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x221619['model'],_0x221619[_0x652f('0x3a')]);_0x19e5e0[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x221619[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0xf6670e[_0x652f('0x3a')][_0x652f('0xcb')]));_0x19e5e0[_0x652f('0x3e')]=_0x19e5e0[_0x652f('0x3e')]['length']?_0x19e5e0['attributes']:_0x221619[_0x652f('0xc9')];_0x19e5e0[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0xf6670e['query'][_0x652f('0xcd')]);_0x19e5e0[_0x652f('0x39')]=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0xf6670e[_0x652f('0x3a')],_0x221619[_0x652f('0xc8')]));if(_0xf6670e[_0x652f('0x3a')]['filter']){_0x19e5e0[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x19e5e0[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x19e5e0[_0x652f('0x3e')],function(_0x521bf9){var _0x1d72e9={};_0x1d72e9[_0x521bf9]={'$like':'%'+_0xf6670e[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x1d72e9;})});}_0x19e5e0=_[_0x652f('0xd2')]({},_0x19e5e0,_0xf6670e[_0x652f('0x4f')]);return _0x253606[_0x652f('0xd3')](_0x19e5e0);}})[_0x652f('0x1c')](function(_0x25598c){if(_0x25598c){_0x33f7e6=_0x25598c['length'];if(!_0xf6670e[_0x652f('0x3a')][_0x652f('0xbf')]('nolimit')){_0x19e5e0[_0x652f('0x16')]=qs[_0x652f('0x16')](_0xf6670e[_0x652f('0x3a')][_0x652f('0x16')]);_0x19e5e0['offset']=qs[_0x652f('0x18')](_0xf6670e[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x253606[_0x652f('0xd3')](_0x19e5e0);}})[_0x652f('0x1c')](function(_0x361fbb){if(_0x361fbb){return _0x361fbb?{'count':_0x33f7e6,'rows':_0x361fbb}:null;}})['then'](respondWithResult(_0x461fc1,null))[_0x652f('0x4b')](handleError(_0x461fc1,null));};exports[_0x652f('0xd5')]=function(_0x3f2b42,_0x4e79b3){var _0x3969a7={'raw':!![],'where':{}};var _0x140709={};var _0x3fd17e={'count':0x0,'rows':[]};return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x3f2b42[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x4e79b3,null))[_0x652f('0x1c')](function(_0xad97f8){if(_0xad97f8){_0x140709['model']=_[_0x652f('0xc6')](db['VoiceRecording'][_0x652f('0x31')]);_0x140709['query']=_['keys'](_0x3f2b42[_0x652f('0x3a')]);_0x140709[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x140709[_0x652f('0xc9')],_0x140709[_0x652f('0x3a')]);_0x3969a7[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x140709[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0x3f2b42[_0x652f('0x3a')][_0x652f('0xcb')]));_0x3969a7[_0x652f('0x3e')]=_0x3969a7['attributes'][_0x652f('0x42')]?_0x3969a7[_0x652f('0x3e')]:_0x140709['model'];if(!_0x3f2b42[_0x652f('0x3a')]['hasOwnProperty'](_0x652f('0xcf'))){_0x3969a7['limit']=qs[_0x652f('0x16')](_0x3f2b42[_0x652f('0x3a')][_0x652f('0x16')]);_0x3969a7[_0x652f('0x18')]=qs[_0x652f('0x18')](_0x3f2b42[_0x652f('0x3a')][_0x652f('0x18')]);}_0x3969a7['order']=qs[_0x652f('0xcd')](_0x3f2b42['query']['sort']);_0x3969a7[_0x652f('0x39')]=qs['filters'](_[_0x652f('0xd1')](_0x3f2b42[_0x652f('0x3a')],_0x140709[_0x652f('0xc8')]));_0x3969a7['where'][_0x652f('0xd6')]=_0xad97f8['id'];if(_0x3f2b42[_0x652f('0x3a')][_0x652f('0x25')]){_0x3969a7[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x3969a7[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x3969a7['attributes'],function(_0x444517){var _0x2d4b11={};_0x2d4b11[_0x444517]={'$like':'%'+_0x3f2b42[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x2d4b11;})});}_0x3969a7=_['merge']({},_0x3969a7,_0x3f2b42[_0x652f('0x4f')]);return db[_0x652f('0xd7')][_0x652f('0x17')]({'where':_0x3969a7[_0x652f('0x39')]})['then'](function(_0x27bdd8){_0x3fd17e[_0x652f('0x17')]=_0x27bdd8;if(_0x3f2b42[_0x652f('0x3a')][_0x652f('0x4d')]){_0x3969a7[_0x652f('0x3c')]=[{'all':!![]}];}return db[_0x652f('0xd7')][_0x652f('0x3f')](_0x3969a7);})[_0x652f('0x1c')](function(_0x1c1224){_0x3fd17e[_0x652f('0x40')]=_0x1c1224;return _0x3fd17e;});}})[_0x652f('0x1c')](respondWithFilteredResult(_0x4e79b3,_0x3969a7))[_0x652f('0x4b')](handleError(_0x4e79b3,null));};exports[_0x652f('0xd8')]=function(_0x24fff2,_0x1134c7){var _0x37d98d={'raw':!![],'where':{}};var _0x37ca19={};var _0x1f2d9f={'count':0x0,'rows':[]};return db[_0x652f('0x30')]['findOne']({'where':{'id':_0x24fff2[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x1134c7,null))[_0x652f('0x1c')](function(_0x3c6234){if(_0x3c6234){_0x37ca19['model']=_[_0x652f('0xc6')](db[_0x652f('0xd9')][_0x652f('0x31')]);_0x37ca19[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x24fff2[_0x652f('0x3a')]);_0x37ca19[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x37ca19[_0x652f('0xc9')],_0x37ca19['query']);_0x37d98d[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x37ca19[_0x652f('0xc9')],qs['fields'](_0x24fff2[_0x652f('0x3a')][_0x652f('0xcb')]));_0x37d98d[_0x652f('0x3e')]=_0x37d98d[_0x652f('0x3e')][_0x652f('0x42')]?_0x37d98d[_0x652f('0x3e')]:_0x37ca19[_0x652f('0xc9')];if(!_0x24fff2[_0x652f('0x3a')][_0x652f('0xbf')]('nolimit')){_0x37d98d[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x24fff2[_0x652f('0x3a')][_0x652f('0x16')]);_0x37d98d[_0x652f('0x18')]=qs[_0x652f('0x18')](_0x24fff2[_0x652f('0x3a')][_0x652f('0x18')]);}_0x37d98d['order']=qs[_0x652f('0xcd')](_0x24fff2[_0x652f('0x3a')][_0x652f('0xcd')]);_0x37d98d['where']=qs['filters'](_[_0x652f('0xd1')](_0x24fff2[_0x652f('0x3a')],_0x37ca19[_0x652f('0xc8')]));_0x37d98d['where'][_0x652f('0xd6')]=_0x3c6234['id'];if(_0x24fff2[_0x652f('0x3a')]['filter']){_0x37d98d[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x37d98d[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x37d98d[_0x652f('0x3e')],function(_0x4ce01a){var _0x59f18a={};_0x59f18a[_0x4ce01a]={'$like':'%'+_0x24fff2['query'][_0x652f('0x25')]+'%'};return _0x59f18a;})});}_0x37d98d=_[_0x652f('0xd2')]({},_0x37d98d,_0x24fff2[_0x652f('0x4f')]);return db[_0x652f('0xd9')]['count']({'where':_0x37d98d[_0x652f('0x39')]})['then'](function(_0x31a425){_0x1f2d9f[_0x652f('0x17')]=_0x31a425;if(_0x24fff2[_0x652f('0x3a')][_0x652f('0x4d')]){_0x37d98d[_0x652f('0x3c')]=[{'all':!![]}];}return db[_0x652f('0xd9')][_0x652f('0x3f')](_0x37d98d);})['then'](function(_0x8c31c7){_0x1f2d9f['rows']=_0x8c31c7;return _0x1f2d9f;});}})[_0x652f('0x1c')](respondWithFilteredResult(_0x1134c7,_0x37d98d))[_0x652f('0x4b')](handleError(_0x1134c7,null));};exports[_0x652f('0xda')]=function(_0x2e47d3,_0x426bca){var _0x4e9cd8={};var _0x29c4ab={};var _0x117e71;var _0x2df737;return db['User']['findOne']({'where':{'id':_0x2e47d3[_0x652f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x426bca,null))[_0x652f('0x1c')](function(_0x5e3bde){if(_0x5e3bde){_0x117e71=_0x5e3bde;_0x29c4ab[_0x652f('0xc9')]=_['keys'](db['ChatInteraction'][_0x652f('0x31')]);_0x29c4ab['query']=_['keys'](_0x2e47d3['query']);_0x29c4ab[_0x652f('0xc8')]=_['intersection'](_0x29c4ab[_0x652f('0xc9')],_0x29c4ab[_0x652f('0x3a')]);_0x4e9cd8[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x29c4ab['model'],qs[_0x652f('0xcb')](_0x2e47d3[_0x652f('0x3a')][_0x652f('0xcb')]));_0x4e9cd8['attributes']=_0x4e9cd8[_0x652f('0x3e')][_0x652f('0x42')]?_0x4e9cd8[_0x652f('0x3e')]:_0x29c4ab['model'];_0x4e9cd8[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x2e47d3[_0x652f('0x3a')][_0x652f('0xcd')]);_0x4e9cd8[_0x652f('0x39')]=qs['filters'](_['pick'](_0x2e47d3[_0x652f('0x3a')],_0x29c4ab[_0x652f('0xc8')]));if(_0x2e47d3[_0x652f('0x3a')][_0x652f('0x25')]){_0x4e9cd8[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x4e9cd8[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x4e9cd8[_0x652f('0x3e')],function(_0x133981){var _0xfccd5c={};_0xfccd5c[_0x133981]={'$like':'%'+_0x2e47d3[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0xfccd5c;})});}_0x4e9cd8=_[_0x652f('0xd2')]({},_0x4e9cd8,_0x2e47d3[_0x652f('0x4f')]);return _0x117e71[_0x652f('0xda')](_0x4e9cd8);}})[_0x652f('0x1c')](function(_0x109e07){if(_0x109e07){_0x2df737=_0x109e07[_0x652f('0x42')];if(!_0x2e47d3[_0x652f('0x3a')]['hasOwnProperty']('nolimit')){_0x4e9cd8[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x2e47d3[_0x652f('0x3a')][_0x652f('0x16')]);_0x4e9cd8['offset']=qs[_0x652f('0x18')](_0x2e47d3[_0x652f('0x3a')]['offset']);}return _0x117e71[_0x652f('0xda')](_0x4e9cd8);}})[_0x652f('0x1c')](function(_0x338bd3){if(_0x338bd3){return _0x338bd3?{'count':_0x2df737,'rows':_0x338bd3}:null;}})[_0x652f('0x1c')](respondWithResult(_0x426bca,null))[_0x652f('0x4b')](handleError(_0x426bca,null));};exports['getOpenchannelInteractions']=function(_0x33c461,_0xbc3220){var _0x24fcee={};var _0x34020d={};var _0x182b80;var _0x585c26;return db[_0x652f('0x30')]['findOne']({'where':{'id':_0x33c461[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0xbc3220,null))['then'](function(_0x29ccda){if(_0x29ccda){_0x182b80=_0x29ccda;_0x34020d[_0x652f('0xc9')]=_[_0x652f('0xc6')](db[_0x652f('0xdb')]['rawAttributes']);_0x34020d['query']=_[_0x652f('0xc6')](_0x33c461['query']);_0x34020d['filters']=_['intersection'](_0x34020d[_0x652f('0xc9')],_0x34020d[_0x652f('0x3a')]);_0x24fcee[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x34020d['model'],qs[_0x652f('0xcb')](_0x33c461[_0x652f('0x3a')][_0x652f('0xcb')]));_0x24fcee[_0x652f('0x3e')]=_0x24fcee[_0x652f('0x3e')][_0x652f('0x42')]?_0x24fcee['attributes']:_0x34020d[_0x652f('0xc9')];_0x24fcee[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x33c461[_0x652f('0x3a')][_0x652f('0xcd')]);_0x24fcee[_0x652f('0x39')]=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0x33c461[_0x652f('0x3a')],_0x34020d['filters']));if(_0x33c461[_0x652f('0x3a')][_0x652f('0x25')]){_0x24fcee[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x24fcee[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x24fcee[_0x652f('0x3e')],function(_0x58f494){var _0x5f21bf={};_0x5f21bf[_0x58f494]={'$like':'%'+_0x33c461[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x5f21bf;})});}_0x24fcee=_[_0x652f('0xd2')]({},_0x24fcee,_0x33c461[_0x652f('0x4f')]);return _0x182b80['getOpenchannelInteractions'](_0x24fcee);}})[_0x652f('0x1c')](function(_0xe4ea74){if(_0xe4ea74){_0x585c26=_0xe4ea74['length'];if(!_0x33c461['query'][_0x652f('0xbf')]('nolimit')){_0x24fcee[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x33c461['query'][_0x652f('0x16')]);_0x24fcee[_0x652f('0x18')]=qs['offset'](_0x33c461[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x182b80[_0x652f('0xdc')](_0x24fcee);}})['then'](function(_0x1cce3e){if(_0x1cce3e){return _0x1cce3e?{'count':_0x585c26,'rows':_0x1cce3e}:null;}})['then'](respondWithResult(_0xbc3220,null))[_0x652f('0x4b')](handleError(_0xbc3220,null));};exports[_0x652f('0xdd')]=function(_0xfc9841,_0x384a43){var _0x3c20c8={'raw':!![],'where':{}};var _0x87bb4={};var _0x352120={'count':0x0,'rows':[]};return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0xfc9841[_0x652f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x384a43,null))[_0x652f('0x1c')](function(_0x8a6123){if(_0x8a6123){_0x87bb4[_0x652f('0xc9')]=_['keys'](db['MailInteraction'][_0x652f('0x31')]);_0x87bb4[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0xfc9841['query']);_0x87bb4[_0x652f('0xc8')]=_['intersection'](_0x87bb4[_0x652f('0xc9')],_0x87bb4[_0x652f('0x3a')]);_0x3c20c8[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x87bb4[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0xfc9841[_0x652f('0x3a')][_0x652f('0xcb')]));_0x3c20c8['attributes']=_0x3c20c8[_0x652f('0x3e')][_0x652f('0x42')]?_0x3c20c8[_0x652f('0x3e')]:_0x87bb4[_0x652f('0xc9')];if(!_0xfc9841[_0x652f('0x3a')][_0x652f('0xbf')](_0x652f('0xcf'))){_0x3c20c8[_0x652f('0x16')]=qs[_0x652f('0x16')](_0xfc9841[_0x652f('0x3a')]['limit']);_0x3c20c8[_0x652f('0x18')]=qs['offset'](_0xfc9841[_0x652f('0x3a')][_0x652f('0x18')]);}_0x3c20c8[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0xfc9841[_0x652f('0x3a')]['sort']);_0x3c20c8[_0x652f('0x39')]=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0xfc9841[_0x652f('0x3a')],_0x87bb4['filters']));_0x3c20c8['where'][_0x652f('0xd6')]=_0x8a6123['id'];if(_0xfc9841[_0x652f('0x3a')][_0x652f('0x25')]){_0x3c20c8[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x3c20c8['where'],{'$or':_[_0x652f('0x27')](_0x3c20c8[_0x652f('0x3e')],function(_0x5bfcdc){var _0x57c84b={};_0x57c84b[_0x5bfcdc]={'$like':'%'+_0xfc9841['query'][_0x652f('0x25')]+'%'};return _0x57c84b;})});}_0x3c20c8=_[_0x652f('0xd2')]({},_0x3c20c8,_0xfc9841['options']);return db[_0x652f('0xde')][_0x652f('0x17')]({'where':_0x3c20c8[_0x652f('0x39')]})[_0x652f('0x1c')](function(_0x12391a){_0x352120[_0x652f('0x17')]=_0x12391a;if(_0xfc9841[_0x652f('0x3a')][_0x652f('0x4d')]){_0x3c20c8['include']=[{'all':!![]}];}return db['MailInteraction'][_0x652f('0x3f')](_0x3c20c8);})[_0x652f('0x1c')](function(_0x50e331){_0x352120['rows']=_0x50e331;return _0x352120;});}})[_0x652f('0x1c')](respondWithFilteredResult(_0x384a43,_0x3c20c8))[_0x652f('0x4b')](handleError(_0x384a43,null));};exports[_0x652f('0xdf')]=function(_0x680958,_0x585432){var _0x259ae4={};var _0x9059d1={};var _0x496823;var _0x5f2615;return db[_0x652f('0x30')]['findOne']({'where':{'id':_0x680958[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x585432,null))[_0x652f('0x1c')](function(_0x4e277e){if(_0x4e277e){_0x496823=_0x4e277e;_0x9059d1[_0x652f('0xc9')]=_['keys'](db['SmsInteraction'][_0x652f('0x31')]);_0x9059d1[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x680958[_0x652f('0x3a')]);_0x9059d1[_0x652f('0xc8')]=_['intersection'](_0x9059d1[_0x652f('0xc9')],_0x9059d1[_0x652f('0x3a')]);_0x259ae4[_0x652f('0x3e')]=_['intersection'](_0x9059d1[_0x652f('0xc9')],qs['fields'](_0x680958[_0x652f('0x3a')]['fields']));_0x259ae4[_0x652f('0x3e')]=_0x259ae4['attributes'][_0x652f('0x42')]?_0x259ae4[_0x652f('0x3e')]:_0x9059d1[_0x652f('0xc9')];_0x259ae4['order']=qs[_0x652f('0xcd')](_0x680958[_0x652f('0x3a')]['sort']);_0x259ae4[_0x652f('0x39')]=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0x680958[_0x652f('0x3a')],_0x9059d1[_0x652f('0xc8')]));if(_0x680958[_0x652f('0x3a')][_0x652f('0x25')]){_0x259ae4[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x259ae4[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x259ae4['attributes'],function(_0x5357c7){var _0x3f6c76={};_0x3f6c76[_0x5357c7]={'$like':'%'+_0x680958['query'][_0x652f('0x25')]+'%'};return _0x3f6c76;})});}_0x259ae4=_['merge']({},_0x259ae4,_0x680958['options']);return _0x496823[_0x652f('0xdf')](_0x259ae4);}})['then'](function(_0x57a4a6){if(_0x57a4a6){_0x5f2615=_0x57a4a6[_0x652f('0x42')];if(!_0x680958[_0x652f('0x3a')]['hasOwnProperty'](_0x652f('0xcf'))){_0x259ae4[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x680958[_0x652f('0x3a')][_0x652f('0x16')]);_0x259ae4[_0x652f('0x18')]=qs[_0x652f('0x18')](_0x680958[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x496823[_0x652f('0xdf')](_0x259ae4);}})[_0x652f('0x1c')](function(_0x47bb00){if(_0x47bb00){return _0x47bb00?{'count':_0x5f2615,'rows':_0x47bb00}:null;}})[_0x652f('0x1c')](respondWithResult(_0x585432,null))[_0x652f('0x4b')](handleError(_0x585432,null));};exports[_0x652f('0xe0')]=function(_0x5830ed,_0x1b3427){var _0x5c378d={};var _0x310369={};var _0x2ec0aa;var _0x444193;return db['User'][_0x652f('0x88')]({'where':{'id':_0x5830ed[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x1b3427,null))[_0x652f('0x1c')](function(_0x533518){if(_0x533518){_0x2ec0aa=_0x533518;_0x310369['model']=_[_0x652f('0xc6')](db[_0x652f('0xe1')][_0x652f('0x31')]);_0x310369[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x5830ed[_0x652f('0x3a')]);_0x310369[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x310369[_0x652f('0xc9')],_0x310369[_0x652f('0x3a')]);_0x5c378d[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x310369['model'],qs[_0x652f('0xcb')](_0x5830ed['query'][_0x652f('0xcb')]));_0x5c378d[_0x652f('0x3e')]=_0x5c378d[_0x652f('0x3e')]['length']?_0x5c378d[_0x652f('0x3e')]:_0x310369[_0x652f('0xc9')];_0x5c378d['order']=qs[_0x652f('0xcd')](_0x5830ed[_0x652f('0x3a')]['sort']);_0x5c378d[_0x652f('0x39')]=qs['filters'](_[_0x652f('0xd1')](_0x5830ed[_0x652f('0x3a')],_0x310369[_0x652f('0xc8')]));if(_0x5830ed[_0x652f('0x3a')][_0x652f('0x25')]){_0x5c378d[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x5c378d[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x5c378d[_0x652f('0x3e')],function(_0x292849){var _0x39528e={};_0x39528e[_0x292849]={'$like':'%'+_0x5830ed[_0x652f('0x3a')]['filter']+'%'};return _0x39528e;})});}_0x5c378d=_['merge']({},_0x5c378d,_0x5830ed['options']);return _0x2ec0aa[_0x652f('0xe0')](_0x5c378d);}})['then'](function(_0x5202ad){if(_0x5202ad){_0x444193=_0x5202ad['length'];if(!_0x5830ed[_0x652f('0x3a')][_0x652f('0xbf')](_0x652f('0xcf'))){_0x5c378d[_0x652f('0x16')]=qs['limit'](_0x5830ed['query'][_0x652f('0x16')]);_0x5c378d[_0x652f('0x18')]=qs[_0x652f('0x18')](_0x5830ed[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x2ec0aa['getFaxInteractions'](_0x5c378d);}})[_0x652f('0x1c')](function(_0x214826){if(_0x214826){return _0x214826?{'count':_0x444193,'rows':_0x214826}:null;}})[_0x652f('0x1c')](respondWithResult(_0x1b3427,null))['catch'](handleError(_0x1b3427,null));};exports[_0x652f('0xe2')]=function(_0x955a8c,_0x79d261){var _0x251cf0={};var _0x2e90a2={};var _0x303662;var _0x4ac6d8;return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x955a8c[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x79d261,null))[_0x652f('0x1c')](function(_0x5c3c2b){if(_0x5c3c2b){_0x303662=_0x5c3c2b;_0x2e90a2[_0x652f('0xc9')]=_[_0x652f('0xc6')](db[_0x652f('0xe3')][_0x652f('0x31')]);_0x2e90a2[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x955a8c['query']);_0x2e90a2[_0x652f('0xc8')]=_['intersection'](_0x2e90a2['model'],_0x2e90a2['query']);_0x251cf0[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x2e90a2[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0x955a8c['query'][_0x652f('0xcb')]));_0x251cf0[_0x652f('0x3e')]=_0x251cf0['attributes'][_0x652f('0x42')]?_0x251cf0['attributes']:_0x2e90a2['model'];_0x251cf0[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x955a8c['query'][_0x652f('0xcd')]);_0x251cf0[_0x652f('0x39')]=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0x955a8c['query'],_0x2e90a2[_0x652f('0xc8')]));if(_0x955a8c[_0x652f('0x3a')][_0x652f('0x25')]){_0x251cf0['where']=_[_0x652f('0xd2')](_0x251cf0[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x251cf0[_0x652f('0x3e')],function(_0x2aa99){var _0x4c046a={};_0x4c046a[_0x2aa99]={'$like':'%'+_0x955a8c[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x4c046a;})});}_0x251cf0=_[_0x652f('0xd2')]({},_0x251cf0,_0x955a8c['options']);return _0x303662[_0x652f('0xe2')](_0x251cf0);}})[_0x652f('0x1c')](function(_0x51f7e6){if(_0x51f7e6){_0x4ac6d8=_0x51f7e6[_0x652f('0x42')];if(!_0x955a8c[_0x652f('0x3a')][_0x652f('0xbf')](_0x652f('0xcf'))){_0x251cf0[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x955a8c[_0x652f('0x3a')][_0x652f('0x16')]);_0x251cf0[_0x652f('0x18')]=qs['offset'](_0x955a8c[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x303662[_0x652f('0xe2')](_0x251cf0);}})[_0x652f('0x1c')](function(_0xf793c){if(_0xf793c){return _0xf793c?{'count':_0x4ac6d8,'rows':_0xf793c}:null;}})[_0x652f('0x1c')](respondWithResult(_0x79d261,null))[_0x652f('0x4b')](handleError(_0x79d261,null));};exports[_0x652f('0xe4')]=function(_0x4b6855,_0x463bab,_0x2ccd84){var _0x2208f2;var _0x1e79d4;var _0x2e1b74;var _0x1dab4=!_[_0x652f('0x5b')](_0x4b6855[_0x652f('0x4c')]['id'])?_0x4b6855[_0x652f('0x4c')]['id']:!_[_0x652f('0x5b')](_0x4b6855[_0x652f('0x23')]['id'])?_0x4b6855[_0x652f('0x23')]['id']:null;return db['User'][_0x652f('0x29')]({'where':{'id':_0x1dab4,'role':{'$or':[_0x652f('0x22'),_0x652f('0x23'),_0x652f('0x1e')]}},'attributes':['id',_0x652f('0x2a'),_0x652f('0xe5'),_0x652f('0xe6'),_0x652f('0x1d'),_0x652f('0x55'),_0x652f('0xe7')]})['then'](function(_0x52119b){if(_0x52119b){if(_0x52119b[_0x652f('0x1d')]==='agent'){_0x2208f2=_0x52119b;if(_0x4b6855[_0x652f('0x51')][_0x652f('0x8f')]){_0x2e1b74=util[_0x652f('0x9c')](_0x652f('0xe8'),_0x2208f2[_0x4b6855['body'][_0x652f('0x8f')]]);}else if(_0x4b6855[_0x652f('0x51')][_0x652f('0xe9')]){_0x2e1b74=util[_0x652f('0x9c')](_0x652f('0x9d'),_0x4b6855[_0x652f('0x51')][_0x652f('0xe9')]);}else{_0x2e1b74=util[_0x652f('0x9c')]('SIP/%s',_0x2208f2[_0x652f('0x2a')]);}socket['to'](util[_0x652f('0x9c')](_0x652f('0xea'),_0x2208f2['name']))['emit'](_0x652f('0xeb'),{'user':{'id':_0x2208f2['id'],'name':_0x2208f2[_0x652f('0x2a')]},'ip':_0x4b6855[_0x652f('0xec')]['x-forwarded-for']||_0x4b6855['connection']['remoteAddress']||_0x4b6855[_0x652f('0xed')][_0x652f('0xee')]||_0x4b6855['connection'][_0x652f('0xed')][_0x652f('0xee')]});return db[_0x652f('0x9f')][_0x652f('0x21')]({'where':{'membername':_0x2208f2[_0x652f('0x2a')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x652f('0x82'))](_0x652f('0xef'));}})['then'](function(){if(_0x2208f2){return _0x2208f2['getVoiceQueues']({'raw':!![]});}})[_0x652f('0x1c')](function(_0x1bf914){if(_0x2208f2){if(_0x1bf914){_0x1e79d4=_0x1bf914;if(_0x1e79d4['length']){var _0x11992c=_0x1e79d4[_0x652f('0x27')](function(_0x2e1e7d){var _0x513f81={'membername':_0x2208f2[_0x652f('0x2a')],'UserId':_0x2208f2['id'],'queue_name':_0x2e1e7d[_0x652f('0x2a')],'VoiceQueueId':_0x2e1e7d['id'],'interface':_0x2e1b74,'paused':_0x2208f2[_0x652f('0xe7')]||![],'penalty':_0x2e1e7d[_0x652f('0xf0')]||0x0};return db[_0x652f('0x9f')]['upsert'](_0x513f81);});return Promise['all'](_0x11992c);}}}})[_0x652f('0x1c')](function(){if(_0x2208f2){return db[_0x652f('0xf1')][_0x652f('0x3f')]({'where':{'membername':_0x2208f2[_0x652f('0x2a')],'exitAt':null}});}})['then'](function(_0x40aa07){if(_0x2208f2){var _0x616c50=[];_0x40aa07[_0x652f('0xf2')](function(_0x53133b){_0x616c50['push'](_0x53133b['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x652f('0x50')](_0x616c50);}})[_0x652f('0x1c')](function(){if(_0x2208f2){var _0x4983d0=[];var _0x224fce=[];var _0x5545cd=utils['getChannels']();var _0xe5fc28={'membername':_0x2208f2['name'],'interface':_0x2e1b74,'enterAt':moment()['format'](_0x652f('0xf3')),'role':_0x2208f2[_0x652f('0x1d')],'internal':_0x2208f2['internal']};_0x5545cd['forEach'](function(_0x53aefc){_0x4983d0[_0x652f('0x43')](_[_0x652f('0xd2')]({'channel':_0x53aefc,'type':_0x652f('0xf4'),'data1':_0x4b6855[_0x652f('0x51')]['device'],'data2':_0x2e1b74},_0xe5fc28));if(_0x2208f2[_0x652f('0xe7')]){_0x224fce[_0x652f('0x43')](_[_0x652f('0xd2')]({'channel':_0x53aefc,'type':_0x652f('0xf5'),'data1':_0x652f('0xf6')},_0xe5fc28));}});return db['MemberReport'][_0x652f('0x79')](_0x4983d0[_0x652f('0xbc')](_0x224fce),{'individualHooks':!![]});}})[_0x652f('0x1c')](function(){if(_0x2208f2){return _0x2208f2['update']({'online':!![],'lastLoginAt':moment()['format'](_0x652f('0xf3')),'voicePause':_0x2208f2[_0x652f('0xe7')]||![],'mailPause':_0x2208f2[_0x652f('0xe7')]||![],'chatPause':_0x2208f2[_0x652f('0xe7')]||![],'faxPause':_0x2208f2['loginInPause']||![],'smsPause':_0x2208f2[_0x652f('0xe7')]||![],'openchannelPause':_0x2208f2['loginInPause']||![],'whatsappPause':_0x2208f2[_0x652f('0xe7')]||![],'pauseType':_0x2208f2['loginInPause']?_0x652f('0xf6'):null,'interface':_0x2e1b74,'lastPauseAt':moment()[_0x652f('0x9c')](_0x652f('0xf3'))});}})[_0x652f('0x1c')](function(_0x6cccf2){if(_0x4b6855[_0x652f('0xf7')]){return _0x2ccd84();}else{return Promise['resolve'](_0x6cccf2)['then'](respondWithResult(_0x463bab,null));}})[_0x652f('0x4b')](handleError(_0x463bab,null));};exports['logout']=function(_0x3767b9,_0x17a329){var _0x387565;return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0x3767b9['params']['id'],'role':_0x652f('0x1e')},'attributes':['id',_0x652f('0x2a'),_0x652f('0x1d')]})[_0x652f('0x1c')](handleEntityNotFound(_0x17a329,null))[_0x652f('0x1c')](function(_0x32f4d8){if(_0x32f4d8){_0x387565=_0x32f4d8;return db[_0x652f('0x9f')][_0x652f('0x21')]({'where':{'membername':_0x387565[_0x652f('0x2a')]},'individualHooks':!![]});}})[_0x652f('0x1c')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x387565[_0x652f('0x2a')],'exitAt':null}});})[_0x652f('0x1c')](function(_0x58b992){var _0x16cd70=[];_0x58b992['forEach'](function(_0x351552){_0x16cd70['push'](_0x351552[_0x652f('0x1b')]({'exitAt':moment()[_0x652f('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x16cd70);})['then'](function(){return _0x387565['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x17a329,null))['catch'](handleError(_0x17a329,null));};exports['pause']=function(_0xb5eece,_0x190ba7){var _0x3f6c69;return db[_0x652f('0x9f')][_0x652f('0x1b')]({'paused':0x1},{'where':{'UserId':_0xb5eece[_0x652f('0x4c')]['id']},'individualHooks':!![]})[_0x652f('0x1c')](function(){return db[_0x652f('0x30')][_0x652f('0x29')]({'where':{'id':_0xb5eece[_0x652f('0x4c')]['id'],'role':_0x652f('0x1e')},'attributes':['id',_0x652f('0x2a'),'role',_0x652f('0x55'),_0x652f('0x8f'),_0x652f('0x8e')]});})[_0x652f('0x1c')](handleEntityNotFound(_0x190ba7,null))[_0x652f('0x1c')](function(_0x3ec277){if(_0x3ec277){_0x3f6c69=_0x3ec277;return db[_0x652f('0xf1')][_0x652f('0x3f')]({'where':{'membername':_0x3f6c69['name'],'type':_0x652f('0xf5'),'exitAt':null}});}})[_0x652f('0x1c')](function(_0x293d8c){if(_0x293d8c['length']){var _0x5a2510=moment()['format'](_0x652f('0xf3'));for(var _0x2a93e9=0x0,_0x5c9ee1=_0x293d8c[_0x652f('0x42')];_0x2a93e9<_0x5c9ee1;_0x2a93e9++){_0x293d8c[_0x2a93e9][_0x652f('0xf8')]({'exitAt':_0x5a2510});}}})[_0x652f('0x1c')](function(){var _0x1651b5=[];var _0x23ce48=utils['getChannels']();_0x23ce48['forEach'](function(_0x271ccd){_0x1651b5['push']({'channel':_0x271ccd,'membername':_0x3f6c69['name'],'interface':_['isNil'](_0x3f6c69[_0x652f('0x8f')])?util[_0x652f('0x9c')](_0x652f('0x9d'),_0x3f6c69[_0x652f('0x2a')]):_0x3f6c69['interface'],'type':'PAUSE','enterAt':moment()[_0x652f('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xb5eece['body'][_0x652f('0xf9')]||_0x652f('0xfa'),'role':_0x3f6c69[_0x652f('0x1d')],'internal':_0x3f6c69[_0x652f('0x55')]});});return db[_0x652f('0xf1')][_0x652f('0x79')](_0x1651b5,{'individualHooks':!![]});})[_0x652f('0x1c')](function(){return _0x3f6c69[_0x652f('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xb5eece['body']['type']||_0x652f('0xfa'),'lastPauseAt':moment()[_0x652f('0x9c')](_0x652f('0xf3'))});})[_0x652f('0x1c')](respondWithResult(_0x190ba7,null))[_0x652f('0x4b')](handleError(_0x190ba7,null));};exports[_0x652f('0xfb')]=function(_0x277ae6,_0xb18944){if(_0x277ae6[_0x652f('0x51')][_0x652f('0xa5')]&&!utils[_0x652f('0xa2')](_0x277ae6[_0x652f('0x51')][_0x652f('0xa5')])){throw new APIBadRequestError(util[_0x652f('0x9c')](_0x652f('0xfc'),_0x277ae6[_0x652f('0x51')][_0x652f('0xa5')]));}return db[_0x652f('0x30')]['find']({'where':{'id':_0x277ae6['params']['id']},'attributes':['id',_0x652f('0x2a'),_0x652f('0x1d'),'internal',_0x652f('0x8f'),_0x652f('0x8e'),_0x652f('0x9e'),'mailPause',_0x652f('0xfd'),_0x652f('0xfe'),_0x652f('0xff'),_0x652f('0x100'),'whatsappPause',_0x652f('0x101'),_0x652f('0x102')]})['then'](function(_0xfdc267){if(!_0xfdc267){throw new APINotFoundError(util[_0x652f('0x9c')](_0x652f('0xbe'),_0x277ae6[_0x652f('0x4c')]['id']));}return _0xfdc267['unpause'](_0x277ae6[_0x652f('0x51')][_0x652f('0xa5')]);})[_0x652f('0x1c')](respondWithResult(_0xb18944,null))['catch'](APIHandleError(_0xb18944));};exports[_0x652f('0x103')]=function(_0x4823fb,_0xa697a1){var _0x4485ba={};var _0x1ec605={};var _0x1acfc6;var _0x345fa3;return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x4823fb[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0xa697a1,null))[_0x652f('0x1c')](function(_0xd60dde){if(_0xd60dde){_0x1acfc6=_0xd60dde;_0x1ec605['model']=_[_0x652f('0xc6')](db[_0x652f('0x104')][_0x652f('0x31')]);_0x1ec605[_0x652f('0x3a')]=_[_0x652f('0xc6')](_0x4823fb[_0x652f('0x3a')]);_0x1ec605[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x1ec605[_0x652f('0xc9')],_0x1ec605[_0x652f('0x3a')]);_0x4485ba[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x1ec605[_0x652f('0xc9')],qs[_0x652f('0xcb')](_0x4823fb[_0x652f('0x3a')][_0x652f('0xcb')]));_0x4485ba[_0x652f('0x3e')]=_0x4485ba['attributes'][_0x652f('0x42')]?_0x4485ba[_0x652f('0x3e')]:_0x1ec605[_0x652f('0xc9')];_0x4485ba[_0x652f('0xcc')]=qs[_0x652f('0xcd')](_0x4823fb['query']['sort']);_0x4485ba['where']=qs[_0x652f('0xc8')](_[_0x652f('0xd1')](_0x4823fb[_0x652f('0x3a')],_0x1ec605[_0x652f('0xc8')]));if(_0x4823fb[_0x652f('0x3a')]['filter']){_0x4485ba[_0x652f('0x39')]=_[_0x652f('0xd2')](_0x4485ba[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x4485ba[_0x652f('0x3e')],function(_0x353b26){var _0x3b64e0={};_0x3b64e0[_0x353b26]={'$like':'%'+_0x4823fb[_0x652f('0x3a')]['filter']+'%'};return _0x3b64e0;})});}_0x4485ba=_[_0x652f('0xd2')]({},_0x4485ba,_0x4823fb[_0x652f('0x4f')]);return _0x1acfc6[_0x652f('0x103')](_0x4485ba);}})[_0x652f('0x1c')](function(_0x5d37a9){if(_0x5d37a9){_0x345fa3=_0x5d37a9[_0x652f('0x42')];if(!_0x4823fb[_0x652f('0x3a')][_0x652f('0xbf')]('nolimit')){_0x4485ba[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x4823fb['query'][_0x652f('0x16')]);_0x4485ba['offset']=qs[_0x652f('0x18')](_0x4823fb[_0x652f('0x3a')][_0x652f('0x18')]);}return _0x1acfc6['getTeams'](_0x4485ba);}})[_0x652f('0x1c')](function(_0x2b9bd3){if(_0x2b9bd3){return _0x2b9bd3?{'count':_0x345fa3,'rows':_0x2b9bd3}:null;}})[_0x652f('0x1c')](respondWithResult(_0xa697a1,null))[_0x652f('0x4b')](handleError(_0xa697a1,null));};exports[_0x652f('0x105')]=function(_0x3f212d,_0x194ccc){var _0x372b18=_0x3f212d[_0x652f('0x4c')]['id'];var _0x509604=_0x3f212d[_0x652f('0x51')]?_0x3f212d[_0x652f('0x51')]['ids']:null;var _0xec3f52=[];return Promise[_0x652f('0x106')]()[_0x652f('0x1c')](function(){if(!_0x509604)throw new APIBadRequestError(_0x652f('0x107'));})[_0x652f('0x1c')](function(){return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x372b18}});})[_0x652f('0x1c')](function(_0x3ef334){if(!_0x3ef334)throw new APINotFoundError(util[_0x652f('0x9c')](_0x652f('0xbe'),_0x3f212d[_0x652f('0x4c')]['id']));return db[_0x652f('0x5e')][_0x652f('0x108')](function(_0x1ffa41){return _0x3ef334[_0x652f('0x105')](_0x509604,{'transaction':_0x1ffa41})[_0x652f('0x1c')](function(){return db[_0x652f('0x104')][_0x652f('0x3f')]({'where':{'id':{'$in':_0x509604}}});})['then'](function(_0x4aa346){var _0xf67fa9=_[_0x652f('0x27')](_0x4aa346,function(_0x56c5fe){return _0x56c5fe[_0x652f('0x109')]();});return Promise[_0x652f('0x50')](_0xf67fa9);})[_0x652f('0x1c')](function(_0x3b6d96){_0xec3f52=_['flattenDeep'](_0x3b6d96);var _0x3c00a2=_[_0x652f('0x27')](_0xec3f52,function(_0xdfddc6){return _0xdfddc6[_0x652f('0x10a')](_0x3ef334['id'],{'transaction':_0x1ffa41});});return Promise[_0x652f('0x50')](_0x3c00a2);})[_0x652f('0x1c')](function(){if(!_0x3ef334['online'])return;var _0x3cc10c=_[_0x652f('0x25')](_0xec3f52,function(_0xe16577){return _0xe16577[_0x652f('0x10b')](_0x652f('0xa5'))===_0x652f('0x10c');});var _0x5c8257=_['map'](_0x3cc10c,function(_0x509928){return db[_0x652f('0x9f')]['upsert']({'membername':_0x3ef334[_0x652f('0x2a')],'UserId':_0x3ef334['id'],'queue_name':_0x509928['name'],'VoiceQueueId':_0x509928['id'],'interface':_['isNil'](_0x3ef334[_0x652f('0x8f')])?util[_0x652f('0x9c')]('SIP/%s',_0x3ef334[_0x652f('0x2a')]):_0x3ef334[_0x652f('0x8f')],'paused':_0x3ef334[_0x652f('0x9e')]||![],'penalty':_0x3ef334[_0x652f('0x95')]},{'transaction':_0x1ffa41});});return Promise[_0x652f('0x50')](_0x5c8257);})['then'](function(){return db[_0x652f('0x10d')][_0x652f('0x3f')]({'where':{'teamId':{'$in':_0x509604}}});})[_0x652f('0x1c')](function(_0x561451){var _0x25bed8=_[_0x652f('0x27')](_0x561451,function(_0x1952f7){return db[_0x652f('0x10e')][_0x652f('0x71')]({'UserId':_0x3ef334['id'],'VoicePrefixId':_0x1952f7[_0x652f('0x10f')]},{'transaction':_0x1ffa41});});return Promise[_0x652f('0x50')](_0x25bed8);});});})[_0x652f('0x1c')](function(){for(var _0x31746d=0x0;_0x31746d<_0xec3f52[_0x652f('0x42')];_0x31746d++){var _0x5b0d96=_0xec3f52[_0x31746d][_0x652f('0x10b')](_0x652f('0xa5'));var _0x176751=_0x5b0d96+_0x652f('0x98');socket[_0x652f('0x1f')](_0x652f('0x23')+_0x5b0d96+'Queue:save',{'UserId':_0x372b18,['queueField']:_0xec3f52[_0x31746d]['id']});}})[_0x652f('0x1c')](respondWithStatusCode(_0x194ccc,null))[_0x652f('0x4b')](APIHandleError(_0x194ccc));};exports['removeTeams']=function(_0x2f665e,_0x1a2c63){var _0x1b7d51=_0x2f665e[_0x652f('0x4c')]['id'];var _0x2410c6=null;if(_0x2f665e[_0x652f('0x3a')][_0x652f('0x97')]){_0x2410c6=_['isArray'](_0x2f665e[_0x652f('0x3a')][_0x652f('0x97')])?_0x2f665e[_0x652f('0x3a')][_0x652f('0x97')]:[_0x2f665e[_0x652f('0x3a')][_0x652f('0x97')]];}var _0x62c8e0=[];return Promise['resolve']()[_0x652f('0x1c')](function(){if(!_0x2410c6)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x652f('0x1c')](function(){return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x1b7d51}});})[_0x652f('0x1c')](function(_0x3100bb){if(!_0x3100bb)throw new APINotFoundError(util[_0x652f('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2f665e[_0x652f('0x4c')]['id']));return db[_0x652f('0x5e')][_0x652f('0x108')](function(_0x1a8cf5){return _0x3100bb[_0x652f('0x110')](_0x2410c6,{'transaction':_0x1a8cf5})[_0x652f('0x1c')](function(){return db[_0x652f('0x104')][_0x652f('0x3f')]({'where':{'id':{'$in':_0x2410c6}}});})['then'](function(_0x4b98ca){var _0x5c66e2=_['map'](_0x4b98ca,function(_0x5276ab){return _0x5276ab[_0x652f('0x109')]();});return Promise['all'](_0x5c66e2);})['then'](function(_0x212591){_0x62c8e0=_['flattenDeep'](_0x212591);var _0x7e1c5a=_[_0x652f('0x27')](_0x62c8e0,function(_0x3e7710){return _0x3e7710[_0x652f('0x111')](_0x3100bb['id'],{'transaction':_0x1a8cf5});});return Promise[_0x652f('0x50')](_0x7e1c5a);})['then'](function(){if(!_0x3100bb[_0x652f('0x8e')])return;var _0x32a58a=_['filter'](_0x62c8e0,function(_0x1ba42d){return _0x1ba42d[_0x652f('0x10b')](_0x652f('0xa5'))===_0x652f('0x10c');});var _0x4c3e08=_[_0x652f('0x27')](_0x32a58a,function(_0x196d15){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x196d15['id'],'UserId':_0x3100bb['id']},'transaction':_0x1a8cf5});});return Promise[_0x652f('0x50')](_0x4c3e08);})['then'](function(){return db['TeamVoicePrefix'][_0x652f('0x3f')]({'where':{'teamId':{'$in':_0x2410c6}}});})[_0x652f('0x1c')](function(_0x16a1c4){var _0x333354=_[_0x652f('0x27')](_0x16a1c4,function(_0x7eda0e){return db['UserVoicePrefix'][_0x652f('0x21')]({'where':{'UserId':_0x3100bb['id'],'VoicePrefixId':_0x7eda0e[_0x652f('0x10f')]}},{'transaction':_0x1a8cf5});});return Promise[_0x652f('0x50')](_0x333354);});});})[_0x652f('0x1c')](function(){for(var _0x4f8ce0=0x0;_0x4f8ce0<_0x62c8e0[_0x652f('0x42')];_0x4f8ce0++){var _0x3039f2=_0x62c8e0[_0x4f8ce0][_0x652f('0x10b')](_0x652f('0xa5'));var _0x4713b4=_0x3039f2+_0x652f('0x98');socket[_0x652f('0x1f')](_0x652f('0x23')+_0x3039f2+_0x652f('0xa4'),{'UserId':_0x1b7d51,['queueField']:_0x62c8e0[_0x4f8ce0]['id']});}})[_0x652f('0x1c')](respondWithStatusCode(_0x1a2c63,null))['catch'](APIHandleError(_0x1a2c63));};exports[_0x652f('0x112')]=function(_0x2d97f3,_0x20fcd9){var _0x558d67={};var _0x4f2eef={};var _0xdb2ad1;var _0xa88098;return db[_0x652f('0x30')][_0x652f('0x88')]({'where':{'id':_0x2d97f3[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x20fcd9,null))[_0x652f('0x1c')](function(_0x37350b){if(_0x37350b){_0xdb2ad1=_0x37350b;_0x4f2eef[_0x652f('0xc9')]=_[_0x652f('0xc6')](db['CmList'][_0x652f('0x31')]);_0x4f2eef[_0x652f('0x3a')]=_['keys'](_0x2d97f3[_0x652f('0x3a')]);_0x4f2eef[_0x652f('0xc8')]=_['intersection'](_0x4f2eef[_0x652f('0xc9')],_0x4f2eef[_0x652f('0x3a')]);_0x558d67[_0x652f('0x3e')]=_[_0x652f('0xca')](_0x4f2eef['model'],qs['fields'](_0x2d97f3[_0x652f('0x3a')][_0x652f('0xcb')]));_0x558d67[_0x652f('0x3e')]=_0x558d67[_0x652f('0x3e')]['length']?_0x558d67['attributes']:_0x4f2eef[_0x652f('0xc9')];_0x558d67[_0x652f('0xcc')]=qs['sort'](_0x2d97f3[_0x652f('0x3a')]['sort']);_0x558d67[_0x652f('0x39')]=qs[_0x652f('0xc8')](_['pick'](_0x2d97f3[_0x652f('0x3a')],_0x4f2eef[_0x652f('0xc8')]));if(_0x2d97f3[_0x652f('0x3a')]['filter']){_0x558d67[_0x652f('0x39')]=_['merge'](_0x558d67[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x558d67[_0x652f('0x3e')],function(_0x383a94){var _0x44a824={};_0x44a824[_0x383a94]={'$like':'%'+_0x2d97f3['query'][_0x652f('0x25')]+'%'};return _0x44a824;})});}_0x558d67=_[_0x652f('0xd2')]({},_0x558d67,_0x2d97f3['options']);return _0xdb2ad1['getLists'](_0x558d67);}})[_0x652f('0x1c')](function(_0x2cca18){if(_0x2cca18){_0xa88098=_0x2cca18[_0x652f('0x42')];if(!_0x2d97f3['query'][_0x652f('0xbf')](_0x652f('0xcf'))){_0x558d67[_0x652f('0x16')]=qs[_0x652f('0x16')](_0x2d97f3[_0x652f('0x3a')]['limit']);_0x558d67['offset']=qs[_0x652f('0x18')](_0x2d97f3[_0x652f('0x3a')][_0x652f('0x18')]);}return _0xdb2ad1[_0x652f('0x112')](_0x558d67);}})['then'](function(_0x76f275){if(_0x76f275){return _0x76f275?{'count':_0xa88098,'rows':_0x76f275}:null;}})[_0x652f('0x1c')](respondWithResult(_0x20fcd9,null))[_0x652f('0x4b')](handleError(_0x20fcd9,null));};exports[_0x652f('0x113')]=function(_0x49246a,_0x4dfd64){var _0x5a057f={};var _0x54d766={};var _0xb5411e;return db[_0x652f('0x30')]['findOne']({'where':{'id':_0x49246a[_0x652f('0x4c')]['id']}})[_0x652f('0x1c')](handleEntityNotFound(_0x4dfd64,null))[_0x652f('0x1c')](function(_0x1f60eb){if(_0x1f60eb){_0xb5411e=_0x1f60eb;_0x54d766[_0x652f('0xc9')]=_['keys'](db[_0x652f('0x30')][_0x652f('0x31')]);_0x54d766['query']=_[_0x652f('0xc6')](_0x49246a[_0x652f('0x3a')]);_0x54d766[_0x652f('0xc8')]=_[_0x652f('0xca')](_0x54d766[_0x652f('0xc9')],_0x54d766[_0x652f('0x3a')]);_0x5a057f['attributes']=_[_0x652f('0xca')](_0x54d766[_0x652f('0xc9')],qs['fields'](_0x49246a[_0x652f('0x3a')]['fields']));_0x5a057f['attributes']=_0x5a057f[_0x652f('0x3e')][_0x652f('0x42')]?_0x5a057f[_0x652f('0x3e')]:_0x54d766[_0x652f('0xc9')];_0x5a057f['order']=qs['sort'](_0x49246a[_0x652f('0x3a')][_0x652f('0xcd')]);_0x5a057f[_0x652f('0x39')]=qs['filters'](_[_0x652f('0xd1')](_0x49246a[_0x652f('0x3a')],_0x54d766['filters']));if(_0x49246a['query'][_0x652f('0x25')]){_0x5a057f[_0x652f('0x39')]=_['merge'](_0x5a057f[_0x652f('0x39')],{'$or':_[_0x652f('0x27')](_0x5a057f[_0x652f('0x3e')],function(_0x3d0f08){var _0x456ff5={};_0x456ff5[_0x3d0f08]={'$like':'%'+_0x49246a[_0x652f('0x3a')][_0x652f('0x25')]+'%'};return _0x456ff5;})});}_0x5a057f['model']=db[_0x652f('0x30')];_0x5a057f['as']=_0x652f('0x77');_0x5a057f=_[_0x652f('0xd2')]({},_0x5a057f,_0x49246a[_0x652f('0x4f')]);return _0xb5411e[_0x652f('0x114')]({'include':[_0x5a057f]});}})[_0x652f('0x1c')](function(_0x2a9a40){if(_0x2a9a40){var _0x52e426={},_0x39574a=[];for(var _0x465a31=0x0;_0x465a31<_0x2a9a40[_0x652f('0x42')];_0x465a31+=0x1){for(var _0x36d7a6=0x0,_0x50126f;_0x36d7a6<_0x2a9a40[_0x465a31]['Agents']['length'];_0x36d7a6+=0x1){_0x50126f=_0x2a9a40[_0x465a31][_0x652f('0x77')][_0x36d7a6]['get']({'plain':!![]});_0x52e426[_0x50126f['id']]=_0x50126f;}}_0x52e426=_[_0x652f('0x115')](_0x52e426);for(var _0x419d67=qs[_0x652f('0x18')](_0x49246a['query']['offset']);_0x419d67<_0x52e426[_0x652f('0x42')]&&_0x39574a[_0x652f('0x42')]=_0x416142[_0x5cea('0x4f')]){throw new Error(_0x5cea('0x50'));}})['then'](function(){if(_0x4ade16){return db[_0x5cea('0x23')]['destroy']({'where':{'membername':_0x4ade16[_0x5cea('0x1d')]},'individualHooks':!![]});}})[_0x5cea('0x11')](function(){if(_0x4ade16){return _0x4ade16[_0x5cea('0x51')]({'raw':!![]});}})[_0x5cea('0x11')](function(_0x274914){if(_0x4ade16){if(_0x274914){var _0x1bb827=[];_0xddf03c=_0x274914;if(_0xddf03c[_0x5cea('0x27')]){for(var _0x1a820b=0x0;_0x1a820b<_0xddf03c['length'];_0x1a820b++){_0x1bb827[_0x5cea('0x2b')](db['UserVoiceQueueRt'][_0x5cea('0x52')]({'membername':_0x4ade16[_0x5cea('0x1d')],'UserId':_0x4ade16['id'],'queue_name':_0xddf03c[_0x1a820b][_0x5cea('0x1d')],'VoiceQueueId':_0xddf03c[_0x1a820b]['id'],'interface':_0x3ef21c,'paused':_0x4ade16[_0x5cea('0x53')]||![],'penalty':_0xddf03c[_0x1a820b][_0x5cea('0x54')]||0x0}));}return BPromise[_0x5cea('0x47')](_0x1bb827);}}}})[_0x5cea('0x11')](function(){if(_0x4ade16){return db[_0x5cea('0x25')][_0x5cea('0x26')]({'where':{'membername':_0x4ade16['name'],'exitAt':null}});}})[_0x5cea('0x11')](function(_0x160ca0){if(_0x4ade16){if(_0x160ca0&&_0x160ca0[_0x5cea('0x27')]){var _0x144e5c=[];_0x160ca0[_0x5cea('0x46')](function(_0x507693){_0x144e5c[_0x5cea('0x2b')](_0x507693[_0x5cea('0x24')]({'exitAt':moment()[_0x5cea('0x20')](_0x5cea('0x28'))}));});return BPromise[_0x5cea('0x47')](_0x144e5c);}}})['then'](function(){if(_0x4ade16){var _0x2a4ba1=[];var _0x19097b=[];var _0x1568f2=utils[_0x5cea('0x2a')]();var _0x2d5172={'membername':_0x4ade16[_0x5cea('0x1d')],'interface':_0x3ef21c,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4ade16[_0x5cea('0x1e')],'internal':_0x4ade16[_0x5cea('0x32')]};_0x1568f2[_0x5cea('0x46')](function(_0x4d2d63){_0x2a4ba1['push'](_[_0x5cea('0x55')]({'channel':_0x4d2d63,'type':_0x5cea('0x56'),'data1':_0x5cea('0x57'),'data2':_0x3ef21c},_0x2d5172));if(_0x4ade16[_0x5cea('0x53')]){_0x19097b[_0x5cea('0x2b')](_['merge']({'channel':_0x4d2d63,'type':_0x5cea('0x2e'),'data1':'LOGININPAUSE'},_0x2d5172));}});return db[_0x5cea('0x25')][_0x5cea('0x34')](_0x2a4ba1[_0x5cea('0x58')](_0x19097b),{'individualHooks':!![]});}})[_0x5cea('0x11')](function(){if(_0x4ade16){return _0x4ade16[_0x5cea('0x24')]({'online':!![],'lastLoginAt':moment()[_0x5cea('0x20')](_0x5cea('0x28')),'voicePause':_0x4ade16[_0x5cea('0x53')]||![],'mailPause':_0x4ade16[_0x5cea('0x53')]||![],'chatPause':_0x4ade16['loginInPause']||![],'faxPause':_0x4ade16['loginInPause']||![],'smsPause':_0x4ade16[_0x5cea('0x53')]||![],'openchannelPause':_0x4ade16[_0x5cea('0x53')]||![],'pauseType':_0x4ade16[_0x5cea('0x53')]?_0x5cea('0x59'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3ef21c});}})[_0x5cea('0x11')](function(_0x4c00a5){_0x17b1a8(_0x4c00a5);})[_0x5cea('0x14')](function(_0x379260){_0x4e9bd1(_0x443753[_0x5cea('0x16')](0x1f4,_0x379260[_0x5cea('0x15')]));});});}; \ No newline at end of file +var _0x2060=['LoginUser','mobile','phone','loginInPause','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./user.socket','register','User','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetUser','catch','error','message','ShowUser','debug','PauseUser','name','role','interface','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','forEach','SIP/%s','body','type','internal','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','params','unpause','system','LogoutUser','destroy','push','all'];(function(_0x1b8ad9,_0x301373){var _0x279227=function(_0x254c26){while(--_0x254c26){_0x1b8ad9['push'](_0x1b8ad9['shift']());}};_0x279227(++_0x301373);}(_0x2060,0x1b8));var _0x0206=function(_0x4f7a3e,_0x4a98ec){_0x4f7a3e=_0x4f7a3e-0x0;var _0x2c1189=_0x2060[_0x4f7a3e];return _0x2c1189;};'use strict';var _=require(_0x0206('0x0'));var util=require(_0x0206('0x1'));var moment=require(_0x0206('0x2'));var BPromise=require(_0x0206('0x3'));var Redis=require(_0x0206('0x4'));var db=require(_0x0206('0x5'))['db'];var utils=require(_0x0206('0x6'));var logger=require(_0x0206('0x7'))(_0x0206('0x8'));var config=require(_0x0206('0x9'));config[_0x0206('0xa')]=_['defaults'](config[_0x0206('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0206('0xb'))(new Redis(config[_0x0206('0xa')]));require(_0x0206('0xc'))[_0x0206('0xd')](socket);exports['GetUser']=function(_0x1ef095){var _0x356b65=this;return new Promise(function(_0x1f6043,_0x4a7cb3){return db[_0x0206('0xe')][_0x0206('0xf')]({'raw':_0x1ef095['options']?_0x1ef095[_0x0206('0x10')][_0x0206('0x11')]===undefined?!![]:![]:!![],'where':_0x1ef095[_0x0206('0x10')]?_0x1ef095[_0x0206('0x10')][_0x0206('0x12')]||null:null,'attributes':_0x1ef095[_0x0206('0x10')]?_0x1ef095[_0x0206('0x10')][_0x0206('0x13')]||null:null,'limit':_0x1ef095[_0x0206('0x10')]?_0x1ef095[_0x0206('0x10')][_0x0206('0x14')]||null:null,'include':_0x1ef095[_0x0206('0x10')]?_0x1ef095[_0x0206('0x10')][_0x0206('0x15')]?_[_0x0206('0x16')](_0x1ef095[_0x0206('0x10')]['include'],function(_0x150795){return{'model':db[_0x150795[_0x0206('0x17')]],'as':_0x150795['as'],'attributes':_0x150795[_0x0206('0x13')],'include':_0x150795[_0x0206('0x15')]?_[_0x0206('0x16')](_0x150795['include'],function(_0x2e17fd){return{'model':db[_0x2e17fd['model']],'as':_0x2e17fd['as'],'attributes':_0x2e17fd[_0x0206('0x13')],'include':_0x2e17fd[_0x0206('0x15')]?_[_0x0206('0x16')](_0x2e17fd[_0x0206('0x15')],function(_0x4a75b6){return{'model':db[_0x4a75b6['model']],'as':_0x4a75b6['as'],'attributes':_0x4a75b6[_0x0206('0x13')]};}):[]};}):[]};}):[]:[]})[_0x0206('0x18')](function(_0x435dfb){logger[_0x0206('0x19')](_0x0206('0x1a'),_0x1ef095);logger['debug'](_0x0206('0x1a'),_0x1ef095,JSON['stringify'](_0x435dfb));_0x1f6043(_0x435dfb);})[_0x0206('0x1b')](function(_0x2d129c){logger['error']('GetUser',_0x2d129c['message'],_0x1ef095);_0x4a7cb3(_0x356b65[_0x0206('0x1c')](0x1f4,_0x2d129c[_0x0206('0x1d')]));});});};exports[_0x0206('0x1e')]=function(_0x55e6d4){var _0x3df7c3=this;return new Promise(function(_0x156dc6,_0x32c86b){return db[_0x0206('0xe')]['find']({'raw':_0x55e6d4[_0x0206('0x10')]?_0x55e6d4['options'][_0x0206('0x11')]===undefined?!![]:![]:!![],'where':_0x55e6d4[_0x0206('0x10')]?_0x55e6d4[_0x0206('0x10')][_0x0206('0x12')]||null:null,'attributes':_0x55e6d4[_0x0206('0x10')]?_0x55e6d4['options'][_0x0206('0x13')]||null:null,'include':_0x55e6d4[_0x0206('0x10')]?_0x55e6d4[_0x0206('0x10')][_0x0206('0x15')]?_[_0x0206('0x16')](_0x55e6d4[_0x0206('0x10')]['include'],function(_0x491a51){return{'model':db[_0x491a51[_0x0206('0x17')]],'as':_0x491a51['as'],'attributes':_0x491a51['attributes'],'include':_0x491a51[_0x0206('0x15')]?_[_0x0206('0x16')](_0x491a51['include'],function(_0x187972){return{'model':db[_0x187972['model']],'as':_0x187972['as'],'attributes':_0x187972[_0x0206('0x13')],'include':_0x187972[_0x0206('0x15')]?_[_0x0206('0x16')](_0x187972['include'],function(_0x43750b){return{'model':db[_0x43750b[_0x0206('0x17')]],'as':_0x43750b['as'],'attributes':_0x43750b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0206('0x18')](function(_0x471c92){logger['info'](_0x0206('0x1e'),_0x55e6d4);logger[_0x0206('0x1f')](_0x0206('0x1e'),_0x55e6d4,JSON['stringify'](_0x471c92));_0x156dc6(_0x471c92);})[_0x0206('0x1b')](function(_0x374872){logger[_0x0206('0x1c')](_0x0206('0x1e'),_0x374872[_0x0206('0x1d')],_0x55e6d4);_0x32c86b(_0x3df7c3[_0x0206('0x1c')](0x1f4,_0x374872[_0x0206('0x1d')]));});});};exports[_0x0206('0x20')]=function(_0x4597b7){var _0x2c55cd;return db[_0x0206('0xe')]['find']({'where':_0x4597b7['options'][_0x0206('0x12')]||{},'attributes':['id',_0x0206('0x21'),_0x0206('0x22'),'internal',_0x0206('0x23')]})['then'](function(_0x1335ac){if(!_0x1335ac){throw new Error(util['format'](_0x0206('0x24'),_0x4597b7['params']['id']));}_0x2c55cd=_0x1335ac;return db[_0x0206('0x25')][_0x0206('0x26')]({'paused':0x1},{'where':{'UserId':_0x2c55cd['id']},'individualHooks':!![]});})[_0x0206('0x18')](function(){return db[_0x0206('0x27')]['findAll']({'where':{'membername':_0x2c55cd[_0x0206('0x21')],'type':_0x0206('0x28'),'exitAt':null}});})['then'](function(_0x1e6071){if(_0x1e6071&&_0x1e6071[_0x0206('0x29')]){var _0x3f635c=moment()[_0x0206('0x2a')](_0x0206('0x2b'));for(var _0x5947b7=0x0,_0xd6f263=_0x1e6071[_0x0206('0x29')];_0x5947b7<_0xd6f263;_0x5947b7++){_0x1e6071[_0x5947b7]['updateAttributes']({'exitAt':_0x3f635c});}}})[_0x0206('0x18')](function(){var _0x5f117c=[];var _0x1263d7=utils['getChannels']();_0x1263d7[_0x0206('0x2c')](function(_0x2f94a1){_0x5f117c['push']({'channel':_0x2f94a1,'membername':_0x2c55cd['name'],'interface':_['isNil'](_0x2c55cd[_0x0206('0x23')])?util[_0x0206('0x2a')](_0x0206('0x2d'),_0x2c55cd['name']):_0x2c55cd[_0x0206('0x23')],'type':_0x0206('0x28'),'enterAt':moment()[_0x0206('0x2a')](_0x0206('0x2b')),'data1':_0x4597b7[_0x0206('0x2e')][_0x0206('0x2f')]||'DEFAULT\x20PAUSE','role':_0x2c55cd['role'],'internal':_0x2c55cd[_0x0206('0x30')],'uniqueid':_0x4597b7[_0x0206('0x2e')]['uniqueid']||null});});return db['MemberReport'][_0x0206('0x31')](_0x5f117c,{'individualHooks':!![]});})['then'](function(){return _0x2c55cd[_0x0206('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4597b7[_0x0206('0x2e')][_0x0206('0x2f')]||_0x0206('0x32'),'lastPauseAt':moment()[_0x0206('0x2a')](_0x0206('0x2b'))});})[_0x0206('0x1b')](function(_0x1d74e7){throw _0x1d74e7;});};exports[_0x0206('0x33')]=function(_0x4f0303){return Promise[_0x0206('0x34')]()[_0x0206('0x18')](function(){if(_0x4f0303[_0x0206('0x2e')][_0x0206('0x35')]&&!utils['isValidChannel'](_0x4f0303[_0x0206('0x2e')]['channel'])){throw new Error(util[_0x0206('0x2a')](_0x0206('0x36'),_0x4f0303[_0x0206('0x2e')][_0x0206('0x35')]));}return db[_0x0206('0xe')][_0x0206('0x37')]({'where':_0x4f0303['options'][_0x0206('0x12')]||{},'attributes':['id',_0x0206('0x21'),_0x0206('0x22'),_0x0206('0x30'),_0x0206('0x23'),_0x0206('0x38'),'voicePause',_0x0206('0x39'),'chatPause',_0x0206('0x3a'),_0x0206('0x3b'),_0x0206('0x3c'),'whatsappPause',_0x0206('0x3d'),_0x0206('0x3e')]});})[_0x0206('0x18')](function(_0xdcea92){if(!_0xdcea92){throw new Error(util[_0x0206('0x2a')](_0x0206('0x24'),_0x4f0303[_0x0206('0x3f')]['id']));}return _0xdcea92[_0x0206('0x40')](_0x4f0303[_0x0206('0x2e')]['channel'],_0x0206('0x41'));})[_0x0206('0x1b')](function(_0x3b0eac){throw _0x3b0eac;});};exports[_0x0206('0x42')]=function(_0x254cb5){var _0x5645e3=this;return new Promise(function(_0x4eebd9,_0x4de5f7){var _0x3e4d6b;return db['User'][_0x0206('0x37')]({'where':_0x254cb5[_0x0206('0x10')]['where']||{},'attributes':['id',_0x0206('0x21')]})[_0x0206('0x18')](function(_0x21d075){if(_0x21d075){_0x3e4d6b=_0x21d075;return db[_0x0206('0x25')][_0x0206('0x43')]({'where':{'membername':_0x3e4d6b[_0x0206('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x3e4d6b){return db[_0x0206('0x27')][_0x0206('0xf')]({'where':{'membername':_0x3e4d6b[_0x0206('0x21')],'exitAt':null}});}})[_0x0206('0x18')](function(_0x2c2d34){if(_0x3e4d6b){if(_0x2c2d34&&_0x2c2d34[_0x0206('0x29')]){var _0x14c17b=[];_0x2c2d34[_0x0206('0x2c')](function(_0x3300cf){_0x14c17b[_0x0206('0x44')](_0x3300cf[_0x0206('0x26')]({'exitAt':moment()['format'](_0x0206('0x2b'))}));});return BPromise[_0x0206('0x45')](_0x14c17b);}}})['then'](function(){if(_0x3e4d6b){return _0x3e4d6b[_0x0206('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0206('0x18')](function(_0x5c6d5d){_0x4eebd9(_0x5c6d5d);})['catch'](function(_0x3e304b){_0x4de5f7(_0x5645e3[_0x0206('0x1c')](0x1f4,_0x3e304b['message']));});});};exports[_0x0206('0x46')]=function(_0xb29d7f){var _0x5c900f=this;return new Promise(function(_0xd1cfde,_0x712d4f){var _0x1d19b7;var _0x50e333;var _0x3c0225;var _0x3a02a5;return db['User'][_0x0206('0x37')]({'where':_0xb29d7f[_0x0206('0x10')][_0x0206('0x12')]||{},'attributes':['id',_0x0206('0x21'),'role',_0x0206('0x47'),_0x0206('0x48'),_0x0206('0x30'),_0x0206('0x49'),'interface']})[_0x0206('0x18')](function(_0x1fa702){if(_0x1fa702){_0x1d19b7=_0x1fa702;_0x3a02a5=_0xb29d7f[_0x0206('0x2e')]['interface']?_0xb29d7f['body']['interface']:util[_0x0206('0x2a')](_0x0206('0x2d'),_0x1d19b7[_0x0206('0x21')]);return db[_0x0206('0xe')]['count']({'where':{'role':_0x0206('0x4a'),'online':!![],'id':{'$ne':_0x1d19b7['id']}}});}})[_0x0206('0x18')](function(_0x3bcf8f){if(_0x3bcf8f){_0x3c0225=_0x3bcf8f;return require('../../config/license/util')[_0x0206('0x4b')]();}})['then'](function(_0x461356){if(_0x461356&&_0x461356[_0x0206('0x4c')]&&_0x3c0225>=_0x461356[_0x0206('0x4c')]){throw new Error(_0x0206('0x4d'));}})['then'](function(){if(_0x1d19b7){return db['UserVoiceQueueRt'][_0x0206('0x43')]({'where':{'membername':_0x1d19b7['name']},'individualHooks':!![]});}})[_0x0206('0x18')](function(){if(_0x1d19b7){return _0x1d19b7[_0x0206('0x4e')]({'raw':!![]});}})[_0x0206('0x18')](function(_0x5ae9cb){if(_0x1d19b7){if(_0x5ae9cb){var _0x57a588=[];_0x50e333=_0x5ae9cb;if(_0x50e333[_0x0206('0x29')]){for(var _0x21ef29=0x0;_0x21ef29<_0x50e333['length'];_0x21ef29++){_0x57a588['push'](db[_0x0206('0x25')][_0x0206('0x4f')]({'membername':_0x1d19b7[_0x0206('0x21')],'UserId':_0x1d19b7['id'],'queue_name':_0x50e333[_0x21ef29]['name'],'VoiceQueueId':_0x50e333[_0x21ef29]['id'],'interface':_0x3a02a5,'paused':_0x1d19b7[_0x0206('0x49')]||![],'penalty':_0x50e333[_0x21ef29][_0x0206('0x50')]||0x0}));}return BPromise[_0x0206('0x45')](_0x57a588);}}}})['then'](function(){if(_0x1d19b7){return db[_0x0206('0x27')][_0x0206('0xf')]({'where':{'membername':_0x1d19b7[_0x0206('0x21')],'exitAt':null}});}})[_0x0206('0x18')](function(_0x2be22b){if(_0x1d19b7){if(_0x2be22b&&_0x2be22b[_0x0206('0x29')]){var _0x459e1a=[];_0x2be22b[_0x0206('0x2c')](function(_0x3526da){_0x459e1a[_0x0206('0x44')](_0x3526da[_0x0206('0x26')]({'exitAt':moment()[_0x0206('0x2a')](_0x0206('0x2b'))}));});return BPromise[_0x0206('0x45')](_0x459e1a);}}})[_0x0206('0x18')](function(){if(_0x1d19b7){var _0x4b5147=[];var _0x1d5846=[];var _0x5b02cb=utils[_0x0206('0x51')]();var _0x369da1={'membername':_0x1d19b7[_0x0206('0x21')],'interface':_0x3a02a5,'enterAt':moment()[_0x0206('0x2a')](_0x0206('0x2b')),'role':_0x1d19b7[_0x0206('0x22')],'internal':_0x1d19b7[_0x0206('0x30')]};_0x5b02cb['forEach'](function(_0x3af33c){_0x4b5147[_0x0206('0x44')](_[_0x0206('0x52')]({'channel':_0x3af33c,'type':'LOGIN','data1':_0x0206('0x53'),'data2':_0x3a02a5},_0x369da1));if(_0x1d19b7['loginInPause']){_0x1d5846['push'](_[_0x0206('0x52')]({'channel':_0x3af33c,'type':'PAUSE','data1':_0x0206('0x54')},_0x369da1));}});return db[_0x0206('0x27')][_0x0206('0x31')](_0x4b5147['concat'](_0x1d5846),{'individualHooks':!![]});}})[_0x0206('0x18')](function(){if(_0x1d19b7){return _0x1d19b7[_0x0206('0x26')]({'online':!![],'lastLoginAt':moment()[_0x0206('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1d19b7['loginInPause']||![],'mailPause':_0x1d19b7['loginInPause']||![],'chatPause':_0x1d19b7[_0x0206('0x49')]||![],'faxPause':_0x1d19b7[_0x0206('0x49')]||![],'smsPause':_0x1d19b7[_0x0206('0x49')]||![],'openchannelPause':_0x1d19b7[_0x0206('0x49')]||![],'pauseType':_0x1d19b7[_0x0206('0x49')]?_0x0206('0x54'):null,'lastPauseAt':moment()[_0x0206('0x2a')](_0x0206('0x2b')),'interface':_0x3a02a5});}})[_0x0206('0x18')](function(_0x3837e9){_0xd1cfde(_0x3837e9);})[_0x0206('0x1b')](function(_0xb06ae3){_0x712d4f(_0x5c900f[_0x0206('0x1c')](0x1f4,_0xb06ae3[_0x0206('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f9fa6fb..3214410 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 _0x50e0=['emit','removeListener','register','user:','./user.events','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x50e0,0xa4));var _0x050e=function(_0x415939,_0x33ddbd){_0x415939=_0x415939-0x0;var _0xf244a1=_0x50e0[_0x415939];return _0xf244a1;};'use strict';var UserEvents=require(_0x050e('0x0'));var events=[_0x050e('0x1'),_0x050e('0x2'),_0x050e('0x3')];function createListener(_0x29e83a,_0x1102aa){return function(_0x3905b4){_0x1102aa[_0x050e('0x4')](_0x29e83a,_0x3905b4);};}function removeListener(_0x7a60bf,_0x4a0994){return function(){UserEvents[_0x050e('0x5')](_0x7a60bf,_0x4a0994);};}exports[_0x050e('0x6')]=function(_0x5d1839){for(var _0x2bbc2e=0x0,_0x478123=events['length'];_0x2bbc2e<_0x478123;_0x2bbc2e++){var _0x9816b3=events[_0x2bbc2e];var _0x507119=createListener(_0x050e('0x7')+_0x9816b3,_0x5d1839);UserEvents['on'](_0x9816b3,_0x507119);}}; \ No newline at end of file +var _0x6c51=['./user.events','save','remove'];(function(_0x57eed6,_0xa73815){var _0x184512=function(_0x131b67){while(--_0x131b67){_0x57eed6['push'](_0x57eed6['shift']());}};_0x184512(++_0xa73815);}(_0x6c51,0x1c2));var _0x16c5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6c51[_0x432682];return _0x463d05;};'use strict';var UserEvents=require(_0x16c5('0x0'));var events=[_0x16c5('0x1'),_0x16c5('0x2'),'update'];function createListener(_0x103a46,_0x5702cd){return function(_0x44721f){_0x5702cd['emit'](_0x103a46,_0x44721f);};}function removeListener(_0x30c95a,_0x2288aa){return function(){UserEvents['removeListener'](_0x30c95a,_0x2288aa);};}exports['register']=function(_0x1a3aab){for(var _0x33cc70=0x0,_0x3d4233=events['length'];_0x33cc70<_0x3d4233;_0x33cc70++){var _0x42bb33=events[_0x33cc70];var _0x139a34=createListener('user:'+_0x42bb33,_0x1a3aab);UserEvents['on'](_0x42bb33,_0x139a34);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 011de99..db3357d 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x35471a,_0x1e0e9a){var _0x198c11=function(_0xeb962f){while(--_0xeb962f){_0x35471a['push'](_0x35471a['shift']());}};_0x198c11(++_0x1e0e9a);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x58f14e,_0x2d6c63){var _0x92cfc4=function(_0x2796e2){while(--_0x2796e2){_0x58f14e['push'](_0x58f14e['shift']());}};_0x92cfc4(++_0x2d6c63);}(_0xe706,0xa3));var _0x6e70=function(_0x5c3993,_0x5b9b11){_0x5c3993=_0x5c3993-0x0;var _0x5144ab=_0xe706[_0x5c3993];return _0x5144ab;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 1f8a884..f291437 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 _0xfbd1=['exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfbd1,0x176));var _0x1fbd=function(_0x56dc8c,_0x1b15ca){_0x56dc8c=_0x56dc8c-0x0;var _0x166838=_0xfbd1[_0x56dc8c];return _0x166838;};'use strict';var Sequelize=require('sequelize');module[_0x1fbd('0x0')]={'penalty':{'type':Sequelize[_0x1fbd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dfd=['sequelize','exports','INTEGER'];(function(_0x37d4b9,_0x3447f4){var _0x1fc6c5=function(_0x422e35){while(--_0x422e35){_0x37d4b9['push'](_0x37d4b9['shift']());}};_0x1fc6c5(++_0x3447f4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'penalty':{'type':Sequelize[_0xd7df('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 542cc99..ed2b937 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 _0xd9e3=['bluebird','request-promise','path','../../config/environment','exports','UserChatQueue','user_has_chat_queues','lodash','util','api','moment'];(function(_0x1b55d7,_0x466f87){var _0x53fe33=function(_0x361057){while(--_0x361057){_0x1b55d7['push'](_0x1b55d7['shift']());}};_0x53fe33(++_0x466f87);}(_0xd9e3,0x1a9));var _0x3d9e=function(_0x2c1d50,_0x29bef5){_0x2c1d50=_0x2c1d50-0x0;var _0xe22c1d=_0xd9e3[_0x2c1d50];return _0xe22c1d;};'use strict';var _=require(_0x3d9e('0x0'));var util=require(_0x3d9e('0x1'));var logger=require('../../config/logger')(_0x3d9e('0x2'));var moment=require(_0x3d9e('0x3'));var BPromise=require(_0x3d9e('0x4'));var rp=require(_0x3d9e('0x5'));var fs=require('fs');var path=require(_0x3d9e('0x6'));var rimraf=require('rimraf');var config=require(_0x3d9e('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x3d9e('0x8')]=function(_0x457a2b,_0x2de431){return _0x457a2b['define'](_0x3d9e('0x9'),attributes,{'tableName':_0x3d9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf91c=['../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x203894,_0x2ed351){var _0x43e859=function(_0x255fcb){while(--_0x255fcb){_0x203894['push'](_0x203894['shift']());}};_0x43e859(++_0x2ed351);}(_0xf91c,0x159));var _0xcf91=function(_0x2776db,_0xfb2eda){_0x2776db=_0x2776db-0x0;var _0x572930=_0xf91c[_0x2776db];return _0x572930;};'use strict';var _=require(_0xcf91('0x0'));var util=require(_0xcf91('0x1'));var logger=require('../../config/logger')(_0xcf91('0x2'));var moment=require('moment');var BPromise=require(_0xcf91('0x3'));var rp=require(_0xcf91('0x4'));var fs=require('fs');var path=require(_0xcf91('0x5'));var rimraf=require(_0xcf91('0x6'));var config=require(_0xcf91('0x7'));var attributes=require(_0xcf91('0x8'));module['exports']=function(_0x416a04,_0x7fe85a){return _0x416a04[_0xcf91('0x9')](_0xcf91('0xa'),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 040af00..fd12024 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 _0xfd29=['../../mysqldb','../../config/logger','rpc','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfd29,0x9e));var _0x9fd2=function(_0x2ffc1e,_0x4ff0e1){_0x2ffc1e=_0x2ffc1e-0x0;var _0xe7269=_0xfd29[_0x2ffc1e];return _0xe7269;};'use strict';var _=require(_0x9fd2('0x0'));var util=require(_0x9fd2('0x1'));var moment=require('moment');var BPromise=require(_0x9fd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fd2('0x3'));var db=require(_0x9fd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fd2('0x5'))(_0x9fd2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x112d30,_0x22bbfd,_0x440580){return new BPromise(function(_0x4da159,_0x545aad){return client[_0x9fd2('0x7')](_0x112d30,_0x440580)['then'](function(_0x1c2425){logger[_0x9fd2('0x8')](_0x9fd2('0x9'),_0x22bbfd,_0x9fd2('0xa'));logger[_0x9fd2('0xb')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x22bbfd,'request\x20sent',JSON[_0x9fd2('0xc')](_0x1c2425));if(_0x1c2425[_0x9fd2('0xd')]){if(_0x1c2425['error'][_0x9fd2('0xe')]===0x1f4){logger[_0x9fd2('0xd')](_0x9fd2('0x9'),_0x22bbfd,_0x1c2425[_0x9fd2('0xd')][_0x9fd2('0xf')]);return _0x545aad(_0x1c2425[_0x9fd2('0xd')]['message']);}logger[_0x9fd2('0xd')](_0x9fd2('0x9'),_0x22bbfd,_0x1c2425[_0x9fd2('0xd')][_0x9fd2('0xf')]);return _0x4da159(_0x1c2425[_0x9fd2('0xd')][_0x9fd2('0xf')]);}else{logger[_0x9fd2('0x8')](_0x9fd2('0x9'),_0x22bbfd,_0x9fd2('0xa'));_0x4da159(_0x1c2425[_0x9fd2('0x10')]['message']);}})[_0x9fd2('0x11')](function(_0x51d3f3){logger[_0x9fd2('0xd')](_0x9fd2('0x9'),_0x22bbfd,_0x51d3f3);_0x545aad(_0x51d3f3);});});} \ No newline at end of file +var _0x607a=['http','request','then','info','debug','stringify','error','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x607a,0xd2));var _0xa607=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x607a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xa607('0x0'));var util=require(_0xa607('0x1'));var moment=require(_0xa607('0x2'));var BPromise=require(_0xa607('0x3'));var rs=require(_0xa607('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa607('0x5'))['db'];var utils=require(_0xa607('0x6'));var logger=require('../../config/logger')(_0xa607('0x7'));var config=require(_0xa607('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa607('0x9')][_0xa607('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f272,_0x14082c,_0x1e7232){return new BPromise(function(_0x1dab77,_0x160b0e){return client[_0xa607('0xb')](_0x24f272,_0x1e7232)[_0xa607('0xc')](function(_0x262383){logger[_0xa607('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x14082c,'request\x20sent');logger[_0xa607('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x14082c,'request\x20sent',JSON[_0xa607('0xf')](_0x262383));if(_0x262383['error']){if(_0x262383['error']['code']===0x1f4){logger[_0xa607('0x10')](_0xa607('0x11'),_0x14082c,_0x262383[_0xa607('0x10')][_0xa607('0x12')]);return _0x160b0e(_0x262383[_0xa607('0x10')][_0xa607('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x14082c,_0x262383['error'][_0xa607('0x12')]);return _0x1dab77(_0x262383[_0xa607('0x10')][_0xa607('0x12')]);}else{logger[_0xa607('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x14082c,'request\x20sent');_0x1dab77(_0x262383['result'][_0xa607('0x12')]);}})[_0xa607('0x13')](function(_0x1c3857){logger[_0xa607('0x10')](_0xa607('0x11'),_0x14082c,_0x1c3857);_0x160b0e(_0x1c3857);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d5a2229..c5ef71a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x43ab6e,_0x418236){var _0x32e476=function(_0x2f1213){while(--_0x2f1213){_0x43ab6e['push'](_0x43ab6e['shift']());}};_0x32e476(++_0x418236);}(_0xe706,0xa3));var _0x6e70=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xe706[_0x41582d];return _0x59c504;};'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(_0x31484d,_0x1cf7e7){var _0x273117=function(_0x3e5593){while(--_0x3e5593){_0x31484d['push'](_0x31484d['shift']());}};_0x273117(++_0x1cf7e7);}(_0x70e0,0x17b));var _0x070e=function(_0x4b3bd2,_0x544ac0){_0x4b3bd2=_0x4b3bd2-0x0;var _0x2a63ad=_0x70e0[_0x4b3bd2];return _0x2a63ad;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 99066ad..1d58361 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 _0x05c2=['sequelize','exports','INTEGER'];(function(_0x17da68,_0x2cd4d5){var _0x3522ed=function(_0xe2091c){while(--_0xe2091c){_0x17da68['push'](_0x17da68['shift']());}};_0x3522ed(++_0x2cd4d5);}(_0x05c2,0xbd));var _0x205c=function(_0x425bad,_0x3026f4){_0x425bad=_0x425bad-0x0;var _0x1ee813=_0x05c2[_0x425bad];return _0x1ee813;};'use strict';var Sequelize=require(_0x205c('0x0'));module[_0x205c('0x1')]={'penalty':{'type':Sequelize[_0x205c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x205c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd5f2=['STRING','exports','INTEGER'];(function(_0x28448f,_0x46f03a){var _0x2c652d=function(_0x1d3d0b){while(--_0x1d3d0b){_0x28448f['push'](_0x28448f['shift']());}};_0x2c652d(++_0x46f03a);}(_0xd5f2,0x187));var _0x2d5f=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xd5f2[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require('sequelize');module[_0x2d5f('0x0')]={'penalty':{'type':Sequelize[_0x2d5f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2d5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f46e22d..8881f76 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 _0xb69e=['moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x32a8a8,_0x340cd5){var _0x25837c=function(_0x4c81ec){while(--_0x4c81ec){_0x32a8a8['push'](_0x32a8a8['shift']());}};_0x25837c(++_0x340cd5);}(_0xb69e,0xef));var _0xeb69=function(_0x17f172,_0xd4ec0){_0x17f172=_0x17f172-0x0;var _0x3640e9=_0xb69e[_0x17f172];return _0x3640e9;};'use strict';var _=require(_0xeb69('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb69('0x1'));var BPromise=require(_0xeb69('0x2'));var rp=require(_0xeb69('0x3'));var fs=require('fs');var path=require(_0xeb69('0x4'));var rimraf=require('rimraf');var config=require(_0xeb69('0x5'));var attributes=require(_0xeb69('0x6'));module[_0xeb69('0x7')]=function(_0x3d6617,_0x4ebe98){return _0x3d6617[_0xeb69('0x8')](_0xeb69('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b3=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2a872f,_0x43794c){var _0x23cb26=function(_0xba1e46){while(--_0xba1e46){_0x2a872f['push'](_0x2a872f['shift']());}};_0x23cb26(++_0x43794c);}(_0x24b3,0x69));var _0x324b=function(_0x31438a,_0x4029b1){_0x31438a=_0x31438a-0x0;var _0x2d3206=_0x24b3[_0x31438a];return _0x2d3206;};'use strict';var _=require(_0x324b('0x0'));var util=require(_0x324b('0x1'));var logger=require(_0x324b('0x2'))(_0x324b('0x3'));var moment=require('moment');var BPromise=require(_0x324b('0x4'));var rp=require(_0x324b('0x5'));var fs=require('fs');var path=require(_0x324b('0x6'));var rimraf=require(_0x324b('0x7'));var config=require(_0x324b('0x8'));var attributes=require(_0x324b('0x9'));module[_0x324b('0xa')]=function(_0x6344cf,_0x53a537){return _0x6344cf[_0x324b('0xb')](_0x324b('0xc'),attributes,{'tableName':_0x324b('0xd'),'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 68002cd..4a5fc04 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 _0x98fa=['then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x32c9e2,_0x5614a8){var _0x585a55=function(_0x124ca8){while(--_0x124ca8){_0x32c9e2['push'](_0x32c9e2['shift']());}};_0x585a55(++_0x5614a8);}(_0x98fa,0x1d1));var _0xa98f=function(_0x2626e0,_0x146266){_0x2626e0=_0x2626e0-0x0;var _0x3fec4e=_0x98fa[_0x2626e0];return _0x3fec4e;};'use strict';var _=require('lodash');var util=require(_0xa98f('0x0'));var moment=require(_0xa98f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa98f('0x2'));var fs=require('fs');var Redis=require(_0xa98f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa98f('0x4'));var logger=require('../../config/logger')(_0xa98f('0x5'));var config=require(_0xa98f('0x6'));var jayson=require(_0xa98f('0x7'));var client=jayson[_0xa98f('0x8')][_0xa98f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x442ea1,_0x13f8af,_0x2ad5ca){return new BPromise(function(_0xb2be07,_0x4cdcfe){return client['request'](_0x442ea1,_0x2ad5ca)[_0xa98f('0xa')](function(_0x41e85d){logger['info'](_0xa98f('0xb'),_0x13f8af,_0xa98f('0xc'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x13f8af,'request\x20sent',JSON[_0xa98f('0xd')](_0x41e85d));if(_0x41e85d[_0xa98f('0xe')]){if(_0x41e85d[_0xa98f('0xe')][_0xa98f('0xf')]===0x1f4){logger[_0xa98f('0xe')](_0xa98f('0xb'),_0x13f8af,_0x41e85d[_0xa98f('0xe')][_0xa98f('0x10')]);return _0x4cdcfe(_0x41e85d['error'][_0xa98f('0x10')]);}logger[_0xa98f('0xe')](_0xa98f('0xb'),_0x13f8af,_0x41e85d[_0xa98f('0xe')][_0xa98f('0x10')]);return _0xb2be07(_0x41e85d['error'][_0xa98f('0x10')]);}else{logger[_0xa98f('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x13f8af,_0xa98f('0xc'));_0xb2be07(_0x41e85d['result']['message']);}})[_0xa98f('0x12')](function(_0xb3a6ca){logger[_0xa98f('0xe')](_0xa98f('0xb'),_0x13f8af,_0xb3a6ca);_0x4cdcfe(_0xb3a6ca);});});} \ No newline at end of file +var _0xfaa7=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x44a4f6,_0x15d381){var _0x1e3082=function(_0x2253d8){while(--_0x2253d8){_0x44a4f6['push'](_0x44a4f6['shift']());}};_0x1e3082(++_0x15d381);}(_0xfaa7,0x105));var _0x7faa=function(_0x58d302,_0x535dde){_0x58d302=_0x58d302-0x0;var _0xbc6cfd=_0xfaa7[_0x58d302];return _0xbc6cfd;};'use strict';var _=require(_0x7faa('0x0'));var util=require(_0x7faa('0x1'));var moment=require(_0x7faa('0x2'));var BPromise=require(_0x7faa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7faa('0x4'));var db=require(_0x7faa('0x5'))['db'];var utils=require(_0x7faa('0x6'));var logger=require(_0x7faa('0x7'))(_0x7faa('0x8'));var config=require(_0x7faa('0x9'));var jayson=require(_0x7faa('0xa'));var client=jayson[_0x7faa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17accf,_0x1b2bcd,_0x1b3bd6){return new BPromise(function(_0x720ef0,_0x407949){return client[_0x7faa('0xc')](_0x17accf,_0x1b3bd6)[_0x7faa('0xd')](function(_0x33fef7){logger[_0x7faa('0xe')](_0x7faa('0xf'),_0x1b2bcd,_0x7faa('0x10'));logger[_0x7faa('0x11')](_0x7faa('0x12'),_0x1b2bcd,_0x7faa('0x10'),JSON[_0x7faa('0x13')](_0x33fef7));if(_0x33fef7[_0x7faa('0x14')]){if(_0x33fef7[_0x7faa('0x14')]['code']===0x1f4){logger[_0x7faa('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x1b2bcd,_0x33fef7['error']['message']);return _0x407949(_0x33fef7['error'][_0x7faa('0x15')]);}logger[_0x7faa('0x14')](_0x7faa('0xf'),_0x1b2bcd,_0x33fef7['error'][_0x7faa('0x15')]);return _0x720ef0(_0x33fef7[_0x7faa('0x14')][_0x7faa('0x15')]);}else{logger['info'](_0x7faa('0xf'),_0x1b2bcd,_0x7faa('0x10'));_0x720ef0(_0x33fef7[_0x7faa('0x16')][_0x7faa('0x15')]);}})['catch'](function(_0x51e465){logger[_0x7faa('0x14')](_0x7faa('0xf'),_0x1b2bcd,_0x51e465);_0x407949(_0x51e465);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3643e75..0515e33 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x32c4ef,_0x35ce18){var _0x2f9c31=function(_0x33d4f3){while(--_0x33d4f3){_0x32c4ef['push'](_0x32c4ef['shift']());}};_0x2f9c31(++_0x35ce18);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fe567,_0x58c9b8){_0x4fe567=_0x4fe567-0x0;var _0x38b94f=_0xedd9[_0x4fe567];return _0x38b94f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xcbda08,_0x523f37){var _0x3f8713=function(_0x561b9d){while(--_0x561b9d){_0xcbda08['push'](_0xcbda08['shift']());}};_0x3f8713(++_0x523f37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8fe001c..fd5a694 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 _0x1f50=['exports','INTEGER','sequelize'];(function(_0x4071a0,_0x46991b){var _0xe8535b=function(_0x2938e3){while(--_0x2938e3){_0x4071a0['push'](_0x4071a0['shift']());}};_0xe8535b(++_0x46991b);}(_0x1f50,0xb9));var _0x01f5=function(_0x179604,_0x48c283){_0x179604=_0x179604-0x0;var _0x29b655=_0x1f50[_0x179604];return _0x29b655;};'use strict';var Sequelize=require(_0x01f5('0x0'));module[_0x01f5('0x1')]={'penalty':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x345e=['exports','INTEGER','sequelize'];(function(_0x2e3e92,_0x54a22d){var _0x2f7d06=function(_0x17d13b){while(--_0x17d13b){_0x2e3e92['push'](_0x2e3e92['shift']());}};_0x2f7d06(++_0x54a22d);}(_0x345e,0x12e));var _0xe345=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0x345e[_0x5b697a];return _0x5de43b;};'use strict';var Sequelize=require(_0xe345('0x0'));module[_0xe345('0x1')]={'penalty':{'type':Sequelize[_0xe345('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 631d202..2b956bc 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 _0xfb2f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x37b513,_0x3feef5){var _0x982a3c=function(_0x5d41dd){while(--_0x5d41dd){_0x37b513['push'](_0x37b513['shift']());}};_0x982a3c(++_0x3feef5);}(_0xfb2f,0xb4));var _0xffb2=function(_0x3b6b60,_0xcc40c0){_0x3b6b60=_0x3b6b60-0x0;var _0x175322=_0xfb2f[_0x3b6b60];return _0x175322;};'use strict';var _=require('lodash');var util=require(_0xffb2('0x0'));var logger=require('../../config/logger')(_0xffb2('0x1'));var moment=require(_0xffb2('0x2'));var BPromise=require(_0xffb2('0x3'));var rp=require(_0xffb2('0x4'));var fs=require('fs');var path=require(_0xffb2('0x5'));var rimraf=require(_0xffb2('0x6'));var config=require(_0xffb2('0x7'));var attributes=require(_0xffb2('0x8'));module[_0xffb2('0x9')]=function(_0x34e0fb,_0x587a46){return _0x34e0fb[_0xffb2('0xa')](_0xffb2('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe607=['user_has_mail_queues','lodash','util','api','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue'];(function(_0x1e5d53,_0x3169f3){var _0x344899=function(_0x45a560){while(--_0x45a560){_0x1e5d53['push'](_0x1e5d53['shift']());}};_0x344899(++_0x3169f3);}(_0xe607,0xd3));var _0x7e60=function(_0x1e333b,_0x3c91f3){_0x1e333b=_0x1e333b-0x0;var _0x32a2b7=_0xe607[_0x1e333b];return _0x32a2b7;};'use strict';var _=require(_0x7e60('0x0'));var util=require(_0x7e60('0x1'));var logger=require('../../config/logger')(_0x7e60('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e60('0x3'));var rimraf=require(_0x7e60('0x4'));var config=require(_0x7e60('0x5'));var attributes=require(_0x7e60('0x6'));module[_0x7e60('0x7')]=function(_0x40f3b7,_0x3b40d5){return _0x40f3b7['define'](_0x7e60('0x8'),attributes,{'tableName':_0x7e60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d940bde..27ad092 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x155f9e,_0x448e47){var _0x1d8e77=function(_0x1cc429){while(--_0x1cc429){_0x155f9e['push'](_0x155f9e['shift']());}};_0x1d8e77(++_0x448e47);}(_0xa41a,0x6b));var _0xaa41=function(_0x5531dd,_0x40ecec){_0x5531dd=_0x5531dd-0x0;var _0x35c630=_0xa41a[_0x5531dd];return _0x35c630;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1cb9,0x14e));var _0x91cb=function(_0x473545,_0x2142e3){_0x473545=_0x473545-0x0;var _0x26921d=_0x1cb9[_0x473545];return _0x26921d;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8763b9c..d208436 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 _0x7f25=['sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post'];(function(_0x4d8bf0,_0x21b6ee){var _0x1085db=function(_0x29d9b8){while(--_0x29d9b8){_0x4d8bf0['push'](_0x4d8bf0['shift']());}};_0x1085db(++_0x21b6ee);}(_0x7f25,0x12d));var _0x57f2=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x7f25[_0x7abd7];return _0x3a2577;};'use strict';var multer=require(_0x57f2('0x0'));var util=require(_0x57f2('0x1'));var path=require(_0x57f2('0x2'));var timeout=require(_0x57f2('0x3'));var express=require(_0x57f2('0x4'));var router=express[_0x57f2('0x5')]();var fs_extra=require(_0x57f2('0x6'));var auth=require(_0x57f2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x57f2('0x8'));var controller=require(_0x57f2('0x9'));router[_0x57f2('0xa')]('/',auth['isAuthenticated'](),controller[_0x57f2('0xb')]);module[_0x57f2('0xc')]=router; \ No newline at end of file +var _0x06ba=['post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x4aa941,_0x35b018){var _0x3cde98=function(_0x512043){while(--_0x512043){_0x4aa941['push'](_0x4aa941['shift']());}};_0x3cde98(++_0x35b018);}(_0x06ba,0xc6));var _0xa06b=function(_0x2ca4d8,_0x3c2ac6){_0x2ca4d8=_0x2ca4d8-0x0;var _0xadd4b4=_0x06ba[_0x2ca4d8];return _0xadd4b4;};'use strict';var multer=require(_0xa06b('0x0'));var util=require(_0xa06b('0x1'));var path=require(_0xa06b('0x2'));var timeout=require(_0xa06b('0x3'));var express=require('express');var router=express[_0xa06b('0x4')]();var fs_extra=require(_0xa06b('0x5'));var auth=require(_0xa06b('0x6'));var interaction=require(_0xa06b('0x7'));var config=require(_0xa06b('0x8'));var controller=require(_0xa06b('0x9'));router[_0xa06b('0xa')]('/',auth[_0xa06b('0xb')](),controller[_0xa06b('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5cb51c5..cb2b45d 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 _0xa283=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa283,0x6f));var _0x3a28=function(_0x40d80a,_0x4cfc84){_0x40d80a=_0x40d80a-0x0;var _0x59d850=_0xa283[_0x40d80a];return _0x59d850;};'use strict';var Sequelize=require(_0x3a28('0x0'));module[_0x3a28('0x1')]={'body':{'type':Sequelize[_0x3a28('0x2')]},'senderName':{'type':Sequelize[_0x3a28('0x3')]},'recipientsId':{'type':Sequelize[_0x3a28('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3a28('0x3')]},'beep':{'type':Sequelize[_0x3a28('0x4')]}}; \ No newline at end of file +var _0x0aa7=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5026ee,_0x50af2c){var _0x516b21=function(_0x8dbab7){while(--_0x8dbab7){_0x5026ee['push'](_0x5026ee['shift']());}};_0x516b21(++_0x50af2c);}(_0x0aa7,0xfa));var _0x70aa=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x0aa7[_0x5d8018];return _0x151ac4;};'use strict';var Sequelize=require(_0x70aa('0x0'));module[_0x70aa('0x1')]={'body':{'type':Sequelize[_0x70aa('0x2')]},'senderName':{'type':Sequelize[_0x70aa('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x70aa('0x3')]},'beep':{'type':Sequelize[_0x70aa('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index dffa909..9e98d03 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 _0x632a=['sequelize','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','render','html','startCase','model','toLowerCase','User','union','ids','queue','replace','all','flatten','getAgents','map','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join'];(function(_0x3ed9e4,_0x1530e7){var _0x249c51=function(_0x3d5e04){while(--_0x3d5e04){_0x3ed9e4['push'](_0x3ed9e4['shift']());}};_0x249c51(++_0x1530e7);}(_0x632a,0xe3));var _0xa632=function(_0x334660,_0x230f10){_0x334660=_0x334660-0x0;var _0x53a736=_0x632a[_0x334660];return _0x53a736;};'use strict';var emlformat=require(_0xa632('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa632('0x1'));var moment=require(_0xa632('0x2'));var BPromise=require(_0xa632('0x3'));var Mustache=require('mustache');var util=require(_0xa632('0x4'));var path=require(_0xa632('0x5'));var sox=require(_0xa632('0x6'));var csv=require(_0xa632('0x7'));var ejs=require(_0xa632('0x8'));var fs=require('fs');var fs_extra=require(_0xa632('0x9'));var _=require(_0xa632('0xa'));var squel=require(_0xa632('0xb'));var crypto=require(_0xa632('0xc'));var jsforce=require(_0xa632('0xd'));var deskjs=require(_0xa632('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa632('0xf'));var Redis=require(_0xa632('0x10'));var authService=require(_0xa632('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa632('0x12'));var logger=require(_0xa632('0x13'))(_0xa632('0x14'));var utils=require(_0xa632('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa632('0x16'));var db=require(_0xa632('0x17'))['db'];config[_0xa632('0x18')]=_[_0xa632('0x19')](config[_0xa632('0x18')],{'host':_0xa632('0x1a'),'port':0x18eb});var socket=require(_0xa632('0x1b'))(new Redis(config[_0xa632('0x18')]));require(_0xa632('0x1c'))['register'](socket);function respondWithStatusCode(_0x55645f,_0x14f656){_0x14f656=_0x14f656||0xcc;return function(_0x26b6b3){if(_0x26b6b3){return _0x55645f[_0xa632('0x1d')](_0x14f656);}return _0x55645f['status'](_0x14f656)['end']();};}function respondWithResult(_0x251009,_0x250096){_0x250096=_0x250096||0xc8;return function(_0x341171){if(_0x341171){return _0x251009['status'](_0x250096)['json'](_0x341171);}};}function respondWithFilteredResult(_0xbeae0b,_0x210911){return function(_0x20a22e){if(_0x20a22e){var _0x179b7d=typeof _0x210911[_0xa632('0x1e')]===_0xa632('0x1f')&&typeof _0x210911[_0xa632('0x20')]===_0xa632('0x1f');var _0x3ac400=_0x20a22e[_0xa632('0x21')];var _0x4a11be=_0x179b7d?0x0:_0x210911['offset'];var _0x165ef6=_0x179b7d?_0x20a22e['count']:_0x210911['offset']+_0x210911[_0xa632('0x20')];var _0x487c5e;if(_0x165ef6>=_0x3ac400){_0x165ef6=_0x3ac400;_0x487c5e=0xc8;}else{_0x487c5e=0xce;}_0xbeae0b[_0xa632('0x22')](_0x487c5e);return _0xbeae0b[_0xa632('0x23')](_0xa632('0x24'),_0x4a11be+'-'+_0x165ef6+'/'+_0x3ac400)[_0xa632('0x25')](_0x20a22e);}return null;};}function patchUpdates(_0x2b69d4){return function(_0x833bf6){try{jsonpatch[_0xa632('0x26')](_0x833bf6,_0x2b69d4,!![]);}catch(_0x451b68){return BPromise[_0xa632('0x27')](_0x451b68);}return _0x833bf6[_0xa632('0x28')]();};}function saveUpdates(_0x540161,_0x4a6619){return function(_0x1ccfd9){if(_0x1ccfd9){return _0x1ccfd9[_0xa632('0x29')](_0x540161)[_0xa632('0x2a')](function(_0x11e004){return _0x11e004;});}return null;};}function removeEntity(_0x1ec284,_0x22b82c){return function(_0x2ae9e1){if(_0x2ae9e1){return _0x2ae9e1[_0xa632('0x2b')]()[_0xa632('0x2a')](function(){_0x1ec284[_0xa632('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50adf7,_0x17a685){return function(_0x511912){if(!_0x511912){_0x50adf7['sendStatus'](0x194);}return _0x511912;};}function handleError(_0x177ccf,_0x2f4046){_0x2f4046=_0x2f4046||0x1f4;return function(_0x263529){logger['error'](_0x263529[_0xa632('0x2c')]);if(_0x263529[_0xa632('0x2d')]){delete _0x263529[_0xa632('0x2d')];}_0x177ccf[_0xa632('0x22')](_0x2f4046)[_0xa632('0x2e')](_0x263529);};}exports[_0xa632('0x2f')]=function(_0x4ce543,_0x4e0cc8,_0x4c3d97){if(!_0x4ce543[_0xa632('0x30')][_0xa632('0x31')](_0xa632('0x32'))&&!_0x4ce543['body'][_0xa632('0x31')](_0xa632('0x33'))){throw new db[(_0xa632('0x34'))][(_0xa632('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4ce543[_0xa632('0x30')][_0xa632('0x31')](_0xa632('0x33'))&&!_0x4ce543[_0xa632('0x30')][_0xa632('0x31')]('view')){throw new db[(_0xa632('0x34'))][(_0xa632('0x35'))](_0xa632('0x36'));}if(!_0x4ce543[_0xa632('0x30')]['hasOwnProperty'](_0xa632('0x37'))){throw new db[(_0xa632('0x34'))][(_0xa632('0x35'))](_0xa632('0x38'));}else{try{var _0x1e64e0=JSON[_0xa632('0x39')](_0x4ce543[_0xa632('0x30')][_0xa632('0x37')]);}catch(_0x24eac9){logger[_0xa632('0x3a')](_0x24eac9);throw new db[(_0xa632('0x34'))][(_0xa632('0x35'))](_0xa632('0x3b'));}var _0x1e04a3=[_0xa632('0x3c'),'faxqueue',_0xa632('0x3d'),_0xa632('0x3e'),_0xa632('0x3f'),_0xa632('0x40'),_0xa632('0x41'),'team',_0xa632('0x42')];if(_[_0xa632('0x43')](_0x1e64e0,function(_0x49710f){return!_[_0xa632('0x44')](_0x1e04a3,_0x49710f['model']['toLowerCase']());})){throw new db['Sequelize']['ValidationError'](_0xa632('0x45'));}}}var _0x13a993={};_0x13a993['senderName']=_0x4ce543[_0xa632('0x30')][_0xa632('0x31')](_0xa632('0x46'))?_0x4ce543[_0xa632('0x30')]['senderName']:_0x4ce543[_0xa632('0x42')][_0xa632('0x47')];_0x13a993[_0xa632('0x48')]=_[_0xa632('0x49')](_0x4ce543['body']['recipientsDescription'])?null:_0x4ce543[_0xa632('0x30')]['recipientsDescription'];_0x13a993[_0xa632('0x4a')]=_0x4ce543[_0xa632('0x30')][_0xa632('0x4a')]||![];_0x13a993[_0xa632('0x4b')]=_0x4ce543[_0xa632('0x42')]['id'];return getContent(_0x4ce543[_0xa632('0x30')])[_0xa632('0x2a')](function(_0x18b909){_0x13a993[_0xa632('0x30')]=_0x18b909;return getRecipients(_0x1e64e0);})['then'](function(_0x304b4d){_0x13a993[_0xa632('0x4c')]=_[_0xa632('0x4d')](_0x304b4d)[_0xa632('0x4e')](',');return db[_0xa632('0x4f')]['transaction'](function(_0x321b30){return db[_0xa632('0x50')]['create'](_0x13a993,{'raw':!![],'transaction':_0x321b30})[_0xa632('0x2a')](function(_0x3be0aa){var _0x3efa61={'sender':_0x13a993[_0xa632('0x46')],'description':_0x13a993['recipientsDescription'],'content':_0x13a993['body'],'beep':_0x13a993[_0xa632('0x4a')]};_0x304b4d[_0xa632('0x51')](function(_0x5abcc0){_0x3efa61[_0xa632('0x52')]=_0x5abcc0;socket[_0xa632('0x53')](_0xa632('0x54'),_0x3efa61);});return _0x3be0aa;});});})[_0xa632('0x2a')](respondWithResult(_0x4e0cc8,0xc9))[_0xa632('0x55')](handleError(_0x4e0cc8,null));};function getContent(_0x4ea717){return new BPromise(function(_0x53cdf8,_0x5f4a30){if(_0x4ea717[_0xa632('0x32')]){_0x53cdf8(_0x4ea717[_0xa632('0x32')]);return;}return db[_0xa632('0x56')][_0xa632('0x57')]({'attributes':['html'],'where':{'id':_0x4ea717[_0xa632('0x33')]},'raw':!![]})[_0xa632('0x2a')](function(_0x11f929){if(!_0x11f929)throw new db[(_0xa632('0x34'))][(_0xa632('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1c0503=Mustache[_0xa632('0x58')](_0x11f929[_0xa632('0x59')],_0x4ea717['view']);_0x53cdf8(_0x1c0503);})[_0xa632('0x55')](function(_0x2cd69d){_0x5f4a30(_0x2cd69d);});});}function getRecipients(_0x4abc0c){return new BPromise(function(_0x3d0913,_0x35a9e2){var _0x102676=[];var _0x51e77d=[];_0x4abc0c[_0xa632('0x51')](function(_0x2cb605){var _0x5aabb2=_[_0xa632('0x5a')](_0x2cb605[_0xa632('0x5b')][_0xa632('0x5c')]());if(_0x5aabb2===_0xa632('0x5d')){_0x102676=_[_0xa632('0x5e')](_0x102676,_0x2cb605[_0xa632('0x5f')]);}else{if(_['includes'](_0x5aabb2,_0xa632('0x60')))_0x5aabb2=_0x5aabb2[_0xa632('0x61')]('queue','Queue');_0x2cb605[_0xa632('0x5f')][_0xa632('0x51')](function(_0x207c7b){_0x51e77d['push'](getAgents(_0x5aabb2,_0x207c7b));});}});return BPromise[_0xa632('0x62')](_0x51e77d)[_0xa632('0x2a')](function(_0x533e2b){_0x102676=_[_0xa632('0x5e')](_0x102676,_[_0xa632('0x63')](_0x533e2b));_0x3d0913(_0x102676);})[_0xa632('0x55')](function(_0x20c1c2){_0x35a9e2(_0x20c1c2);});});}function getAgents(_0x4a5140,_0x97629c){return new BPromise(function(_0x40442f,_0x52840d){return db[_0x4a5140]['findOne']({'where':{'id':_0x97629c}})[_0xa632('0x2a')](function(_0x449694){return _0x449694[_0xa632('0x64')]({'attributes':['id'],'raw':!![]})[_0xa632('0x2a')](function(_0x4225f2){var _0xa718af=_[_0xa632('0x65')](_0x4225f2,'id');_0x40442f(_0xa718af);});})[_0xa632('0x55')](function(_0x53f431){_0x52840d(_0x53f431);});});} \ No newline at end of file +var _0x0dbd=['Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','beep','sortBy','join','sequelize','transaction','create','recipientsDescription','forEach','recipient','emit','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','queue','replace','Queue','push','all','catch','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId'];(function(_0x2bf5f6,_0x86e8c5){var _0x4e521a=function(_0x37560f){while(--_0x37560f){_0x2bf5f6['push'](_0x2bf5f6['shift']());}};_0x4e521a(++_0x86e8c5);}(_0x0dbd,0x1cc));var _0xd0db=function(_0x704a9,_0x63c62e){_0x704a9=_0x704a9-0x0;var _0x38c9eb=_0x0dbd[_0x704a9];return _0x38c9eb;};'use strict';var emlformat=require(_0xd0db('0x0'));var rimraf=require(_0xd0db('0x1'));var zipdir=require(_0xd0db('0x2'));var jsonpatch=require(_0xd0db('0x3'));var rp=require('request-promise');var moment=require(_0xd0db('0x4'));var BPromise=require(_0xd0db('0x5'));var Mustache=require('mustache');var util=require(_0xd0db('0x6'));var path=require(_0xd0db('0x7'));var sox=require(_0xd0db('0x8'));var csv=require(_0xd0db('0x9'));var ejs=require(_0xd0db('0xa'));var fs=require('fs');var fs_extra=require(_0xd0db('0xb'));var _=require('lodash');var squel=require(_0xd0db('0xc'));var crypto=require(_0xd0db('0xd'));var jsforce=require(_0xd0db('0xe'));var deskjs=require(_0xd0db('0xf'));var toCsv=require(_0xd0db('0x9'));var querystring=require(_0xd0db('0x10'));var Papa=require(_0xd0db('0x11'));var Redis=require(_0xd0db('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd0db('0x13'));var as=require(_0xd0db('0x14'));var hardwareService=require(_0xd0db('0x15'));var logger=require('../../config/logger')(_0xd0db('0x16'));var utils=require(_0xd0db('0x17'));var config=require(_0xd0db('0x18'));var licenseUtil=require(_0xd0db('0x19'));var db=require(_0xd0db('0x1a'))['db'];config[_0xd0db('0x1b')]=_[_0xd0db('0x1c')](config[_0xd0db('0x1b')],{'host':_0xd0db('0x1d'),'port':0x18eb});var socket=require(_0xd0db('0x1e'))(new Redis(config[_0xd0db('0x1b')]));require('./userNotification.socket')[_0xd0db('0x1f')](socket);function respondWithStatusCode(_0x1f3930,_0x5e1928){_0x5e1928=_0x5e1928||0xcc;return function(_0x270829){if(_0x270829){return _0x1f3930[_0xd0db('0x20')](_0x5e1928);}return _0x1f3930['status'](_0x5e1928)[_0xd0db('0x21')]();};}function respondWithResult(_0x15eece,_0x4f9996){_0x4f9996=_0x4f9996||0xc8;return function(_0x33c7fe){if(_0x33c7fe){return _0x15eece[_0xd0db('0x22')](_0x4f9996)[_0xd0db('0x23')](_0x33c7fe);}};}function respondWithFilteredResult(_0x570eaf,_0x554776){return function(_0x4eac70){if(_0x4eac70){var _0x2dfd89=typeof _0x554776[_0xd0db('0x24')]===_0xd0db('0x25')&&typeof _0x554776['limit']===_0xd0db('0x25');var _0x3b7f2d=_0x4eac70[_0xd0db('0x26')];var _0x434e77=_0x2dfd89?0x0:_0x554776[_0xd0db('0x24')];var _0x223255=_0x2dfd89?_0x4eac70[_0xd0db('0x26')]:_0x554776[_0xd0db('0x24')]+_0x554776['limit'];var _0x2a6f2d;if(_0x223255>=_0x3b7f2d){_0x223255=_0x3b7f2d;_0x2a6f2d=0xc8;}else{_0x2a6f2d=0xce;}_0x570eaf['status'](_0x2a6f2d);return _0x570eaf[_0xd0db('0x27')]('Content-Range',_0x434e77+'-'+_0x223255+'/'+_0x3b7f2d)[_0xd0db('0x23')](_0x4eac70);}return null;};}function patchUpdates(_0x9acec5){return function(_0x3e0f5e){try{jsonpatch[_0xd0db('0x28')](_0x3e0f5e,_0x9acec5,!![]);}catch(_0x390409){return BPromise[_0xd0db('0x29')](_0x390409);}return _0x3e0f5e[_0xd0db('0x2a')]();};}function saveUpdates(_0x3d5428,_0x1a796f){return function(_0x28660c){if(_0x28660c){return _0x28660c[_0xd0db('0x2b')](_0x3d5428)[_0xd0db('0x2c')](function(_0x3364a5){return _0x3364a5;});}return null;};}function removeEntity(_0xa41b92,_0x219ddf){return function(_0x3d0fd8){if(_0x3d0fd8){return _0x3d0fd8[_0xd0db('0x2d')]()[_0xd0db('0x2c')](function(){_0xa41b92[_0xd0db('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18d3fb,_0xe0167c){return function(_0x2a1790){if(!_0x2a1790){_0x18d3fb[_0xd0db('0x20')](0x194);}return _0x2a1790;};}function handleError(_0x55d9cf,_0x20658a){_0x20658a=_0x20658a||0x1f4;return function(_0x129b2b){logger[_0xd0db('0x2e')](_0x129b2b[_0xd0db('0x2f')]);if(_0x129b2b[_0xd0db('0x30')]){delete _0x129b2b['name'];}_0x55d9cf[_0xd0db('0x22')](_0x20658a)[_0xd0db('0x31')](_0x129b2b);};}exports[_0xd0db('0x32')]=function(_0x569961,_0xc3c3e5,_0x320648){if(!_0x569961[_0xd0db('0x33')][_0xd0db('0x34')](_0xd0db('0x35'))&&!_0x569961[_0xd0db('0x33')][_0xd0db('0x34')](_0xd0db('0x36'))){throw new db[(_0xd0db('0x37'))]['ValidationError'](_0xd0db('0x38'));}else{if(_0x569961[_0xd0db('0x33')]['hasOwnProperty'](_0xd0db('0x36'))&&!_0x569961[_0xd0db('0x33')][_0xd0db('0x34')](_0xd0db('0x39'))){throw new db[(_0xd0db('0x37'))][(_0xd0db('0x3a'))](_0xd0db('0x3b'));}if(!_0x569961['body']['hasOwnProperty'](_0xd0db('0x3c'))){throw new db['Sequelize'][(_0xd0db('0x3a'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x33f145=JSON[_0xd0db('0x3d')](_0x569961['body'][_0xd0db('0x3c')]);}catch(_0x3d1bcf){logger[_0xd0db('0x2e')](_0x3d1bcf);throw new db[(_0xd0db('0x37'))][(_0xd0db('0x3a'))](_0xd0db('0x3e'));}var _0x54b1ab=[_0xd0db('0x3f'),_0xd0db('0x40'),_0xd0db('0x41'),_0xd0db('0x42'),_0xd0db('0x43'),_0xd0db('0x44'),_0xd0db('0x45'),_0xd0db('0x46'),_0xd0db('0x47')];if(_[_0xd0db('0x48')](_0x33f145,function(_0x2d6a2d){return!_['includes'](_0x54b1ab,_0x2d6a2d[_0xd0db('0x49')][_0xd0db('0x4a')]());})){throw new db[(_0xd0db('0x37'))][(_0xd0db('0x3a'))](_0xd0db('0x4b'));}}}var _0x44659c={};_0x44659c[_0xd0db('0x4c')]=_0x569961[_0xd0db('0x33')][_0xd0db('0x34')](_0xd0db('0x4c'))?_0x569961[_0xd0db('0x33')][_0xd0db('0x4c')]:_0x569961[_0xd0db('0x47')][_0xd0db('0x4d')];_0x44659c['recipientsDescription']=_[_0xd0db('0x4e')](_0x569961['body']['recipientsDescription'])?null:_0x569961[_0xd0db('0x33')]['recipientsDescription'];_0x44659c[_0xd0db('0x4f')]=_0x569961[_0xd0db('0x33')][_0xd0db('0x4f')]||![];_0x44659c['SenderId']=_0x569961[_0xd0db('0x47')]['id'];return getContent(_0x569961[_0xd0db('0x33')])[_0xd0db('0x2c')](function(_0x18000f){_0x44659c['body']=_0x18000f;return getRecipients(_0x33f145);})['then'](function(_0x558cba){_0x44659c['recipientsId']=_[_0xd0db('0x50')](_0x558cba)[_0xd0db('0x51')](',');return db[_0xd0db('0x52')][_0xd0db('0x53')](function(_0x44f9ae){return db['UserNotification'][_0xd0db('0x54')](_0x44659c,{'raw':!![],'transaction':_0x44f9ae})[_0xd0db('0x2c')](function(_0x11b252){var _0x1aa399={'sender':_0x44659c['senderName'],'description':_0x44659c[_0xd0db('0x55')],'content':_0x44659c['body'],'beep':_0x44659c[_0xd0db('0x4f')]};_0x558cba[_0xd0db('0x56')](function(_0x40a4ea){_0x1aa399[_0xd0db('0x57')]=_0x40a4ea;socket[_0xd0db('0x58')]('userNotification:send',_0x1aa399);});return _0x11b252;});});})[_0xd0db('0x2c')](respondWithResult(_0xc3c3e5,0xc9))['catch'](handleError(_0xc3c3e5,null));};function getContent(_0x2dce2e){return new BPromise(function(_0x23956b,_0xa8a978){if(_0x2dce2e[_0xd0db('0x35')]){_0x23956b(_0x2dce2e[_0xd0db('0x35')]);return;}return db['Template']['findOne']({'attributes':['html'],'where':{'id':_0x2dce2e[_0xd0db('0x36')]},'raw':!![]})['then'](function(_0x3167f3){if(!_0x3167f3)throw new db[(_0xd0db('0x37'))][(_0xd0db('0x3a'))](_0xd0db('0x59'));var _0x441d2c=Mustache[_0xd0db('0x5a')](_0x3167f3[_0xd0db('0x5b')],_0x2dce2e[_0xd0db('0x39')]);_0x23956b(_0x441d2c);})['catch'](function(_0x19fbe4){_0xa8a978(_0x19fbe4);});});}function getRecipients(_0x44dcd7){return new BPromise(function(_0x545f68,_0x5cf237){var _0x4f6d27=[];var _0x4f7105=[];_0x44dcd7['forEach'](function(_0x5063ec){var _0x4f9a4a=_[_0xd0db('0x5c')](_0x5063ec[_0xd0db('0x49')][_0xd0db('0x4a')]());if(_0x4f9a4a===_0xd0db('0x5d')){_0x4f6d27=_[_0xd0db('0x5e')](_0x4f6d27,_0x5063ec[_0xd0db('0x5f')]);}else{if(_['includes'](_0x4f9a4a,_0xd0db('0x60')))_0x4f9a4a=_0x4f9a4a[_0xd0db('0x61')]('queue',_0xd0db('0x62'));_0x5063ec[_0xd0db('0x5f')]['forEach'](function(_0x499a7b){_0x4f7105[_0xd0db('0x63')](getAgents(_0x4f9a4a,_0x499a7b));});}});return BPromise[_0xd0db('0x64')](_0x4f7105)[_0xd0db('0x2c')](function(_0x1b3442){_0x4f6d27=_[_0xd0db('0x5e')](_0x4f6d27,_['flatten'](_0x1b3442));_0x545f68(_0x4f6d27);})[_0xd0db('0x65')](function(_0x2b77ab){_0x5cf237(_0x2b77ab);});});}function getAgents(_0x504a54,_0x15e0e9){return new BPromise(function(_0x59a481,_0x480c04){return db[_0x504a54]['findOne']({'where':{'id':_0x15e0e9}})[_0xd0db('0x2c')](function(_0x5711bb){return _0x5711bb[_0xd0db('0x66')]({'attributes':['id'],'raw':!![]})[_0xd0db('0x2c')](function(_0x3d4991){var _0x21aee1=_['map'](_0x3d4991,'id');_0x59a481(_0x21aee1);});})[_0xd0db('0x65')](function(_0x7b402f){_0x480c04(_0x7b402f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9948389..c88a717 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 _0x65d1=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x65d1,0xb5));var _0x165d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x65d1[_0x2763f2];return _0x3ef471;};'use strict';var EventEmitter=require(_0x165d('0x0'));var UserNotification=require(_0x165d('0x1'))['db'][_0x165d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x165d('0x3')](0x0);var events={'afterCreate':_0x165d('0x4'),'afterUpdate':_0x165d('0x5'),'afterDestroy':_0x165d('0x6')};function emitEvent(_0x405c7f){return function(_0x5ab446,_0x1c018e,_0x455efa){UserNotificationEvents['emit'](_0x405c7f+':'+_0x5ab446['id'],_0x5ab446);UserNotificationEvents[_0x165d('0x7')](_0x405c7f,_0x5ab446);_0x455efa(null);};}for(var e in events){if(events[_0x165d('0x8')](e)){var event=events[e];UserNotification[_0x165d('0x9')](e,emitEvent(event));}}module[_0x165d('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x7143=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x19e743,_0x161204){var _0x261d0f=function(_0x1eaa77){while(--_0x1eaa77){_0x19e743['push'](_0x19e743['shift']());}};_0x261d0f(++_0x161204);}(_0x7143,0x14c));var _0x3714=function(_0x5a34e9,_0x5c632a){_0x5a34e9=_0x5a34e9-0x0;var _0x7eb4e2=_0x7143[_0x5a34e9];return _0x7eb4e2;};'use strict';var EventEmitter=require(_0x3714('0x0'));var UserNotification=require(_0x3714('0x1'))['db'][_0x3714('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3714('0x3')](0x0);var events={'afterCreate':_0x3714('0x4'),'afterUpdate':_0x3714('0x5'),'afterDestroy':'remove'};function emitEvent(_0x26c41b){return function(_0x3d1374,_0x17488e,_0x5acfc8){UserNotificationEvents[_0x3714('0x6')](_0x26c41b+':'+_0x3d1374['id'],_0x3d1374);UserNotificationEvents[_0x3714('0x6')](_0x26c41b,_0x3d1374);_0x5acfc8(null);};}for(var e in events){if(events[_0x3714('0x7')](e)){var event=events[e];UserNotification[_0x3714('0x8')](e,emitEvent(event));}}module[_0x3714('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 06a1115..09e4b31 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 _0x46d9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x1600e0,_0x718987){var _0x27bc53=function(_0x37c8e1){while(--_0x37c8e1){_0x1600e0['push'](_0x1600e0['shift']());}};_0x27bc53(++_0x718987);}(_0x46d9,0x16a));var _0x946d=function(_0x22e436,_0x578fbf){_0x22e436=_0x22e436-0x0;var _0x328c08=_0x46d9[_0x22e436];return _0x328c08;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require(_0x946d('0x4'));var BPromise=require(_0x946d('0x5'));var rp=require(_0x946d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x946d('0x7'));var config=require(_0x946d('0x8'));var attributes=require(_0x946d('0x9'));module[_0x946d('0xa')]=function(_0x27bc4d,_0x35688c){return _0x27bc4d[_0x946d('0xb')](_0x946d('0xc'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x946d('0xd'),'collate':_0x946d('0xe')});}; \ No newline at end of file +var _0x5c63=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5c63,0x15a));var _0x35c6=function(_0x566b22,_0x5c26b7){_0x566b22=_0x566b22-0x0;var _0x16a6b1=_0x5c63[_0x566b22];return _0x16a6b1;};'use strict';var _=require(_0x35c6('0x0'));var util=require('util');var logger=require(_0x35c6('0x1'))(_0x35c6('0x2'));var moment=require(_0x35c6('0x3'));var BPromise=require(_0x35c6('0x4'));var rp=require(_0x35c6('0x5'));var fs=require('fs');var path=require(_0x35c6('0x6'));var rimraf=require(_0x35c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x35c6('0x8'));module[_0x35c6('0x9')]=function(_0x3866e2,_0x358202){return _0x3866e2[_0x35c6('0xa')](_0x35c6('0xb'),attributes,{'tableName':_0x35c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35c6('0xd'),'collate':_0x35c6('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b045df3..76ddfec 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 _0x3648=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x39d481,_0x23c1a2){var _0x3b22d0=function(_0xea81e6){while(--_0xea81e6){_0x39d481['push'](_0x39d481['shift']());}};_0x3b22d0(++_0x23c1a2);}(_0x3648,0x13a));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8364('0x0'));var util=require(_0x8364('0x1'));var moment=require(_0x8364('0x2'));var BPromise=require(_0x8364('0x3'));var rs=require(_0x8364('0x4'));var fs=require('fs');var Redis=require(_0x8364('0x5'));var db=require(_0x8364('0x6'))['db'];var utils=require(_0x8364('0x7'));var logger=require(_0x8364('0x8'))(_0x8364('0x9'));var config=require(_0x8364('0xa'));var jayson=require(_0x8364('0xb'));var client=jayson[_0x8364('0xc')][_0x8364('0xd')]({'port':0x232a});config[_0x8364('0xe')]=_[_0x8364('0xf')](config['redis'],{'host':_0x8364('0x10'),'port':0x18eb});var socket=require(_0x8364('0x11'))(new Redis(config[_0x8364('0xe')]));require(_0x8364('0x12'))[_0x8364('0x13')](socket);function respondWithRpcPromise(_0x2a8a88,_0x1b38e1,_0x3a67e2){return new BPromise(function(_0x1bee5d,_0xf969f1){return client[_0x8364('0x14')](_0x2a8a88,_0x3a67e2)['then'](function(_0x1274b3){logger[_0x8364('0x15')](_0x8364('0x16'),_0x1b38e1,_0x8364('0x17'));logger[_0x8364('0x18')](_0x8364('0x19'),_0x1b38e1,_0x8364('0x17'),JSON[_0x8364('0x1a')](_0x1274b3));if(_0x1274b3['error']){if(_0x1274b3[_0x8364('0x1b')][_0x8364('0x1c')]===0x1f4){logger[_0x8364('0x1b')](_0x8364('0x16'),_0x1b38e1,_0x1274b3[_0x8364('0x1b')][_0x8364('0x1d')]);return _0xf969f1(_0x1274b3[_0x8364('0x1b')][_0x8364('0x1d')]);}logger[_0x8364('0x1b')](_0x8364('0x16'),_0x1b38e1,_0x1274b3[_0x8364('0x1b')]['message']);return _0x1bee5d(_0x1274b3['error'][_0x8364('0x1d')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x1b38e1,_0x8364('0x17'));_0x1bee5d(_0x1274b3[_0x8364('0x1e')][_0x8364('0x1d')]);}})['catch'](function(_0x550d00){logger['error'](_0x8364('0x16'),_0x1b38e1,_0x550d00);_0xf969f1(_0x550d00);});});} \ No newline at end of file +var _0x2a6a=['debug','stringify','code','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x3f0ab4,_0x41d2af){var _0x1ed9eb=function(_0x49c911){while(--_0x49c911){_0x3f0ab4['push'](_0x3f0ab4['shift']());}};_0x1ed9eb(++_0x41d2af);}(_0x2a6a,0x133));var _0xa2a6=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x2a6a[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0xa2a6('0x0'));var util=require(_0xa2a6('0x1'));var moment=require(_0xa2a6('0x2'));var BPromise=require(_0xa2a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2a6('0x5'))(_0xa2a6('0x6'));var config=require(_0xa2a6('0x7'));var jayson=require(_0xa2a6('0x8'));var client=jayson[_0xa2a6('0x9')][_0xa2a6('0xa')]({'port':0x232a});config[_0xa2a6('0xb')]=_['defaults'](config[_0xa2a6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2a6('0xc'))(new Redis(config[_0xa2a6('0xb')]));require(_0xa2a6('0xd'))['register'](socket);function respondWithRpcPromise(_0x4da1cc,_0x4b9ea7,_0x440373){return new BPromise(function(_0xa3691c,_0x377ee4){return client[_0xa2a6('0xe')](_0x4da1cc,_0x440373)[_0xa2a6('0xf')](function(_0x53e9dd){logger['info'](_0xa2a6('0x10'),_0x4b9ea7,_0xa2a6('0x11'));logger[_0xa2a6('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4b9ea7,'request\x20sent',JSON[_0xa2a6('0x13')](_0x53e9dd));if(_0x53e9dd['error']){if(_0x53e9dd['error'][_0xa2a6('0x14')]===0x1f4){logger[_0xa2a6('0x15')](_0xa2a6('0x10'),_0x4b9ea7,_0x53e9dd[_0xa2a6('0x15')][_0xa2a6('0x16')]);return _0x377ee4(_0x53e9dd[_0xa2a6('0x15')]['message']);}logger[_0xa2a6('0x15')](_0xa2a6('0x10'),_0x4b9ea7,_0x53e9dd['error'][_0xa2a6('0x16')]);return _0xa3691c(_0x53e9dd[_0xa2a6('0x15')]['message']);}else{logger[_0xa2a6('0x17')]('UserNotification,\x20%s,\x20%s',_0x4b9ea7,_0xa2a6('0x11'));_0xa3691c(_0x53e9dd[_0xa2a6('0x18')][_0xa2a6('0x16')]);}})['catch'](function(_0x5002db){logger[_0xa2a6('0x15')]('UserNotification,\x20%s,\x20%s',_0x4b9ea7,_0x5002db);_0x377ee4(_0x5002db);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a03d5bc..b7d8c45 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 _0xefcd=['remove','update','emit','removeListener','register','length','userNotification:','save'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xefcd,0x14f));var _0xdefc=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xefcd[_0x1d1779];return _0x2377e9;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xdefc('0x0'),_0xdefc('0x1'),_0xdefc('0x2')];function createListener(_0x10c883,_0x413344){return function(_0x6f27af){_0x413344[_0xdefc('0x3')](_0x10c883,_0x6f27af);};}function removeListener(_0x452e37,_0x46c581){return function(){UserNotificationEvents[_0xdefc('0x4')](_0x452e37,_0x46c581);};}exports[_0xdefc('0x5')]=function(_0x1b4384){for(var _0x43f92c=0x0,_0x25bc57=events[_0xdefc('0x6')];_0x43f92c<_0x25bc57;_0x43f92c++){var _0x1dc2c6=events[_0x43f92c];var _0x14c0b5=createListener(_0xdefc('0x7')+_0x1dc2c6,_0x1b4384);UserNotificationEvents['on'](_0x1dc2c6,_0x14c0b5);}}; \ No newline at end of file +var _0x6dc1=['register','length','userNotification:','./userNotification.events','remove','removeListener'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x6dc1,0x183));var _0x16dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6dc1[_0x14add3];return _0x4a174f;};'use strict';var UserNotificationEvents=require(_0x16dc('0x0'));var events=['save',_0x16dc('0x1'),'update'];function createListener(_0x8c2b33,_0x334cc8){return function(_0x1fd162){_0x334cc8['emit'](_0x8c2b33,_0x1fd162);};}function removeListener(_0x32314b,_0x3d0fce){return function(){UserNotificationEvents[_0x16dc('0x2')](_0x32314b,_0x3d0fce);};}exports[_0x16dc('0x3')]=function(_0x21ffe3){for(var _0x31dd3a=0x0,_0x4d6e66=events[_0x16dc('0x4')];_0x31dd3a<_0x4d6e66;_0x31dd3a++){var _0x3b39ff=events[_0x31dd3a];var _0x1c25ba=createListener(_0x16dc('0x5')+_0x3b39ff,_0x21ffe3);UserNotificationEvents['on'](_0x3b39ff,_0x1c25ba);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7ca5c6a..6ee6879 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35b2fe,_0x22944a){var _0x3e1474=function(_0x141796){while(--_0x141796){_0x35b2fe['push'](_0x35b2fe['shift']());}};_0x3e1474(++_0x22944a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xcb91[_0x351509];return _0x4e9861;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3a01c7,_0x31cc45){var _0x2b6cdc=function(_0x3b54c7){while(--_0x3b54c7){_0x3a01c7['push'](_0x3a01c7['shift']());}};_0x2b6cdc(++_0x31cc45);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0xcb91[_0x5c14f6];return _0x4949b3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 548b05f..5fc408e 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 _0x8b80=['sequelize','INTEGER'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x8b80,0x16e));var _0x08b8=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8b80[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x08b8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x08b8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9df1=['INTEGER','sequelize','exports'];(function(_0xcf2382,_0x1da16e){var _0x1ade36=function(_0x2124a2){while(--_0x2124a2){_0xcf2382['push'](_0xcf2382['shift']());}};_0x1ade36(++_0x1da16e);}(_0x9df1,0xcd));var _0x19df=function(_0x3a8027,_0x1f77ab){_0x3a8027=_0x3a8027-0x0;var _0x5682fa=_0x9df1[_0x3a8027];return _0x5682fa;};'use strict';var Sequelize=require(_0x19df('0x0'));module[_0x19df('0x1')]={'penalty':{'type':Sequelize[_0x19df('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index b45e60d..0d7920e 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 _0x6a69=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash','../../config/logger','api','moment'];(function(_0x3b21fc,_0x2ed7bc){var _0x5c733c=function(_0x1a55cc){while(--_0x1a55cc){_0x3b21fc['push'](_0x3b21fc['shift']());}};_0x5c733c(++_0x2ed7bc);}(_0x6a69,0x1b4));var _0x96a6=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x6a69[_0x420b24];return _0x4da552;};'use strict';var _=require(_0x96a6('0x0'));var util=require('util');var logger=require(_0x96a6('0x1'))(_0x96a6('0x2'));var moment=require(_0x96a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x96a6('0x4'));var fs=require('fs');var path=require(_0x96a6('0x5'));var rimraf=require(_0x96a6('0x6'));var config=require(_0x96a6('0x7'));var attributes=require(_0x96a6('0x8'));module['exports']=function(_0x443750,_0x7043f1){return _0x443750[_0x96a6('0x9')](_0x96a6('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba7e=['util','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x1e1232,_0x4e2f0f){var _0x53fe02=function(_0x4c29d9){while(--_0x4c29d9){_0x1e1232['push'](_0x1e1232['shift']());}};_0x53fe02(++_0x4e2f0f);}(_0xba7e,0xcb));var _0xeba7=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0xba7e[_0x350343];return _0x9afc1c;};'use strict';var _=require('lodash');var util=require(_0xeba7('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeba7('0x1'));var fs=require('fs');var path=require(_0xeba7('0x2'));var rimraf=require(_0xeba7('0x3'));var config=require(_0xeba7('0x4'));var attributes=require(_0xeba7('0x5'));module['exports']=function(_0x1a53bb,_0x27403b){return _0x1a53bb[_0xeba7('0x6')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 49e8e31..b803217 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 _0xe7d2=['../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x317742,_0x23f94f){var _0x1d39a0=function(_0xd63d9d){while(--_0xd63d9d){_0x317742['push'](_0x317742['shift']());}};_0x1d39a0(++_0x23f94f);}(_0xe7d2,0x1af));var _0x2e7d=function(_0x2f81ef,_0x33953a){_0x2f81ef=_0x2f81ef-0x0;var _0x1ca14d=_0xe7d2[_0x2f81ef];return _0x1ca14d;};'use strict';var _=require(_0x2e7d('0x0'));var util=require(_0x2e7d('0x1'));var moment=require(_0x2e7d('0x2'));var BPromise=require(_0x2e7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7d('0x4'));var db=require(_0x2e7d('0x5'))['db'];var utils=require(_0x2e7d('0x6'));var logger=require(_0x2e7d('0x7'))(_0x2e7d('0x8'));var config=require(_0x2e7d('0x9'));var jayson=require(_0x2e7d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8f1f49,_0x4d9588,_0x553cac){return new BPromise(function(_0x59e9e3,_0x28f87d){return client[_0x2e7d('0xb')](_0x8f1f49,_0x553cac)[_0x2e7d('0xc')](function(_0x2c9ed8){logger[_0x2e7d('0xd')](_0x2e7d('0xe'),_0x4d9588,_0x2e7d('0xf'));logger[_0x2e7d('0x10')](_0x2e7d('0x11'),_0x4d9588,_0x2e7d('0xf'),JSON[_0x2e7d('0x12')](_0x2c9ed8));if(_0x2c9ed8[_0x2e7d('0x13')]){if(_0x2c9ed8['error'][_0x2e7d('0x14')]===0x1f4){logger[_0x2e7d('0x13')](_0x2e7d('0xe'),_0x4d9588,_0x2c9ed8['error'][_0x2e7d('0x15')]);return _0x28f87d(_0x2c9ed8[_0x2e7d('0x13')][_0x2e7d('0x15')]);}logger['error'](_0x2e7d('0xe'),_0x4d9588,_0x2c9ed8[_0x2e7d('0x13')][_0x2e7d('0x15')]);return _0x59e9e3(_0x2c9ed8[_0x2e7d('0x13')][_0x2e7d('0x15')]);}else{logger['info'](_0x2e7d('0xe'),_0x4d9588,'request\x20sent');_0x59e9e3(_0x2c9ed8['result'][_0x2e7d('0x15')]);}})['catch'](function(_0x560526){logger['error'](_0x2e7d('0xe'),_0x4d9588,_0x560526);_0x28f87d(_0x560526);});});} \ No newline at end of file +var _0xf0ae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x5c6d9d,_0x316952){var _0x151f8c=function(_0x2b4094){while(--_0x2b4094){_0x5c6d9d['push'](_0x5c6d9d['shift']());}};_0x151f8c(++_0x316952);}(_0xf0ae,0x14e));var _0xef0a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf0ae[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0xef0a('0x0'));var moment=require(_0xef0a('0x1'));var BPromise=require('bluebird');var rs=require(_0xef0a('0x2'));var fs=require('fs');var Redis=require(_0xef0a('0x3'));var db=require(_0xef0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef0a('0x5'))(_0xef0a('0x6'));var config=require(_0xef0a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef0a('0x8')][_0xef0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bc81e,_0x2625b4,_0x47c779){return new BPromise(function(_0x2db868,_0x31fd79){return client[_0xef0a('0xa')](_0x2bc81e,_0x47c779)['then'](function(_0x13b267){logger[_0xef0a('0xb')](_0xef0a('0xc'),_0x2625b4,_0xef0a('0xd'));logger[_0xef0a('0xe')](_0xef0a('0xf'),_0x2625b4,_0xef0a('0xd'),JSON[_0xef0a('0x10')](_0x13b267));if(_0x13b267['error']){if(_0x13b267[_0xef0a('0x11')][_0xef0a('0x12')]===0x1f4){logger[_0xef0a('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2625b4,_0x13b267[_0xef0a('0x11')]['message']);return _0x31fd79(_0x13b267[_0xef0a('0x11')]['message']);}logger[_0xef0a('0x11')](_0xef0a('0xc'),_0x2625b4,_0x13b267['error'][_0xef0a('0x13')]);return _0x2db868(_0x13b267[_0xef0a('0x11')][_0xef0a('0x13')]);}else{logger[_0xef0a('0xb')](_0xef0a('0xc'),_0x2625b4,'request\x20sent');_0x2db868(_0x13b267['result']['message']);}})[_0xef0a('0x14')](function(_0x4505b8){logger[_0xef0a('0x11')](_0xef0a('0xc'),_0x2625b4,_0x4505b8);_0x31fd79(_0x4505b8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2e10366..b8f03f5 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 _0xfb05=['exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources'];(function(_0x44bb9f,_0x132cdb){var _0x2f071b=function(_0xb31249){while(--_0xb31249){_0x44bb9f['push'](_0x44bb9f['shift']());}};_0x2f071b(++_0x132cdb);}(_0xfb05,0x1b4));var _0x5fb0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfb05[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5fb0('0x0'));var timeout=require(_0x5fb0('0x1'));var express=require(_0x5fb0('0x2'));var router=express[_0x5fb0('0x3')]();var fs_extra=require(_0x5fb0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fb0('0x5'));var controller=require('./userProfile.controller');router[_0x5fb0('0x6')]('/',auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x8')]);router[_0x5fb0('0x6')](_0x5fb0('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5fb0('0x6')](_0x5fb0('0xa'),auth['isAuthenticated'](),controller[_0x5fb0('0xb')]);router['get'](_0x5fb0('0xc'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0xd')]);router[_0x5fb0('0x6')](_0x5fb0('0xe'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0xf')]);router[_0x5fb0('0x10')]('/',auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x11')]);router[_0x5fb0('0x10')](_0x5fb0('0x12'),auth['isAuthenticated'](),controller[_0x5fb0('0x13')]);router['post'](_0x5fb0('0xc'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x14')]);router[_0x5fb0('0x10')](_0x5fb0('0xe'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x15')]);router[_0x5fb0('0x16')](_0x5fb0('0xa'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x17')]);router[_0x5fb0('0x18')](_0x5fb0('0xa'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x19')]);router['delete'](_0x5fb0('0xc'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x1a')]);router[_0x5fb0('0x18')](_0x5fb0('0xe'),auth[_0x5fb0('0x7')](),controller[_0x5fb0('0x1b')]);module[_0x5fb0('0x1c')]=router; \ No newline at end of file +var _0x8914=['getResources','post','addSections','put','update','delete','removeSections','removeResources','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x8914,0xcc));var _0x4891=function(_0x38be89,_0x4fa6ee){_0x38be89=_0x38be89-0x0;var _0x5ace4d=_0x8914[_0x38be89];return _0x5ace4d;};'use strict';var multer=require(_0x4891('0x0'));var util=require(_0x4891('0x1'));var path=require(_0x4891('0x2'));var timeout=require('connect-timeout');var express=require(_0x4891('0x3'));var router=express[_0x4891('0x4')]();var fs_extra=require(_0x4891('0x5'));var auth=require(_0x4891('0x6'));var interaction=require(_0x4891('0x7'));var config=require(_0x4891('0x8'));var controller=require(_0x4891('0x9'));router[_0x4891('0xa')]('/',auth[_0x4891('0xb')](),controller[_0x4891('0xc')]);router[_0x4891('0xa')](_0x4891('0xd'),auth[_0x4891('0xb')](),controller[_0x4891('0xe')]);router[_0x4891('0xa')](_0x4891('0xf'),auth[_0x4891('0xb')](),controller[_0x4891('0x10')]);router['get'](_0x4891('0x11'),auth[_0x4891('0xb')](),controller[_0x4891('0x12')]);router[_0x4891('0xa')](_0x4891('0x13'),auth[_0x4891('0xb')](),controller[_0x4891('0x14')]);router[_0x4891('0x15')]('/',auth[_0x4891('0xb')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x4891('0x15')](_0x4891('0x11'),auth[_0x4891('0xb')](),controller[_0x4891('0x16')]);router[_0x4891('0x15')]('/:id/resources',auth[_0x4891('0xb')](),controller['addResources']);router[_0x4891('0x17')](_0x4891('0xf'),auth[_0x4891('0xb')](),controller[_0x4891('0x18')]);router[_0x4891('0x19')]('/:id',auth[_0x4891('0xb')](),controller['destroy']);router[_0x4891('0x19')]('/:id/sections',auth['isAuthenticated'](),controller[_0x4891('0x1a')]);router['delete'](_0x4891('0x13'),auth[_0x4891('0xb')](),controller[_0x4891('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dd1ed7e..8ba3aff 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 _0x157c=['split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','join','crudPermissions'];(function(_0x389003,_0x56924b){var _0x4e1614=function(_0x161cee){while(--_0x161cee){_0x389003['push'](_0x389003['shift']());}};_0x4e1614(++_0x56924b);}(_0x157c,0x77));var _0xc157=function(_0x572706,_0xadcdb5){_0x572706=_0x572706-0x0;var _0x556ee9=_0x157c[_0x572706];return _0x556ee9;};'use strict';var Sequelize=require(_0xc157('0x0'));module[_0xc157('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc157('0x2')},'crudPermissions':{'type':Sequelize[_0xc157('0x3')],'set':function(_0x36dfc){this[_0xc157('0x4')]('crudPermissions',_0x36dfc?_0x36dfc[_0xc157('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xc157('0x6'))?this['getDataValue'](_0xc157('0x6'))[_0xc157('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc157('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc157('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2c67=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x1aa4bf,_0x3f7201){var _0x5a001c=function(_0x986b85){while(--_0x986b85){_0x1aa4bf['push'](_0x1aa4bf['shift']());}};_0x5a001c(++_0x3f7201);}(_0x2c67,0xd4));var _0x72c6=function(_0x2c74c9,_0x252a72){_0x2c74c9=_0x2c74c9-0x0;var _0xfa34ac=_0x2c67[_0x2c74c9];return _0xfa34ac;};'use strict';var Sequelize=require(_0x72c6('0x0'));module[_0x72c6('0x1')]={'name':{'type':Sequelize[_0x72c6('0x2')],'allowNull':![],'unique':_0x72c6('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x552ed1){this[_0x72c6('0x4')](_0x72c6('0x5'),_0x552ed1?_0x552ed1[_0x72c6('0x6')](''):[]);},'get':function(){return this[_0x72c6('0x7')](_0x72c6('0x5'))?this['getDataValue'](_0x72c6('0x5'))[_0x72c6('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x72c6('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x72c6('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9d3ecef..e9ae213 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 _0x5288=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','status','end','offset','undefined','set','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','map','UserProfile','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','findAll','catch','show','params','rawAttributes','includeAll','merge','find','create','body','clone','include','get','createdAt','updatedAt','crudPermissions','omit','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','UserProfileResource','Resources','destroy','describe','addSections','sequelize','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','findOne','forEach','push','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','limit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','moment','mustache','util','path'];(function(_0x4bf0a3,_0x375172){var _0x366e64=function(_0x1b0636){while(--_0x1b0636){_0x4bf0a3['push'](_0x4bf0a3['shift']());}};_0x366e64(++_0x375172);}(_0x5288,0xdc));var _0x8528=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x5288[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0x8528('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8528('0x1'));var rp=require('request-promise');var moment=require(_0x8528('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8528('0x3'));var util=require(_0x8528('0x4'));var path=require(_0x8528('0x5'));var sox=require(_0x8528('0x6'));var csv=require(_0x8528('0x7'));var ejs=require(_0x8528('0x8'));var fs=require('fs');var fs_extra=require(_0x8528('0x9'));var _=require(_0x8528('0xa'));var squel=require('squel');var crypto=require(_0x8528('0xb'));var jsforce=require(_0x8528('0xc'));var deskjs=require(_0x8528('0xd'));var toCsv=require(_0x8528('0x7'));var querystring=require(_0x8528('0xe'));var Papa=require('papaparse');var Redis=require(_0x8528('0xf'));var authService=require(_0x8528('0x10'));var qs=require(_0x8528('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8528('0x12'));var logger=require('../../config/logger')(_0x8528('0x13'));var utils=require(_0x8528('0x14'));var config=require(_0x8528('0x15'));var licenseUtil=require(_0x8528('0x16'));var db=require('../../mysqldb')['db'];config[_0x8528('0x17')]=_[_0x8528('0x18')](config[_0x8528('0x17')],{'host':_0x8528('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8528('0x17')]));require(_0x8528('0x1a'))['register'](socket);function respondWithStatusCode(_0x45b75a,_0xdbf7c1){_0xdbf7c1=_0xdbf7c1||0xcc;return function(_0x1d6ab2){if(_0x1d6ab2){return _0x45b75a['sendStatus'](_0xdbf7c1);}return _0x45b75a[_0x8528('0x1b')](_0xdbf7c1)[_0x8528('0x1c')]();};}function respondWithResult(_0x6adda9,_0x514512){_0x514512=_0x514512||0xc8;return function(_0x59147e){if(_0x59147e){return _0x6adda9[_0x8528('0x1b')](_0x514512)['json'](_0x59147e);}};}function respondWithFilteredResult(_0x28bc87,_0x27a3d0){return function(_0x44d36d){if(_0x44d36d){var _0x2782e5=typeof _0x27a3d0[_0x8528('0x1d')]==='undefined'&&typeof _0x27a3d0['limit']===_0x8528('0x1e');var _0x48c675=_0x44d36d['count'];var _0x4ed166=_0x2782e5?0x0:_0x27a3d0[_0x8528('0x1d')];var _0x2c06a1=_0x2782e5?_0x44d36d['count']:_0x27a3d0[_0x8528('0x1d')]+_0x27a3d0['limit'];var _0x47d913;if(_0x2c06a1>=_0x48c675){_0x2c06a1=_0x48c675;_0x47d913=0xc8;}else{_0x47d913=0xce;}_0x28bc87[_0x8528('0x1b')](_0x47d913);return _0x28bc87[_0x8528('0x1f')](_0x8528('0x20'),_0x4ed166+'-'+_0x2c06a1+'/'+_0x48c675)[_0x8528('0x21')](_0x44d36d);}return null;};}function patchUpdates(_0x520dfb){return function(_0x528a21){try{jsonpatch[_0x8528('0x22')](_0x528a21,_0x520dfb,!![]);}catch(_0x5c1b2b){return BPromise[_0x8528('0x23')](_0x5c1b2b);}return _0x528a21[_0x8528('0x24')]();};}function saveUpdates(_0x380eeb,_0x3d7593){return function(_0x12ca50){if(_0x12ca50){return _0x12ca50['update'](_0x380eeb)[_0x8528('0x25')](function(_0x44e552){return _0x44e552;});}return null;};}function removeEntity(_0xe08435,_0x4a2798){return function(_0x2838e3){if(_0x2838e3){return _0x2838e3['destroy']()[_0x8528('0x25')](function(){_0xe08435[_0x8528('0x1b')](0xcc)[_0x8528('0x1c')]();});}};}function handleEntityNotFound(_0x381d17,_0x1703e0){return function(_0x1309eb){if(!_0x1309eb){_0x381d17[_0x8528('0x26')](0x194);}return _0x1309eb;};}function handleError(_0x24b5c2,_0x5312d0){_0x5312d0=_0x5312d0||0x1f4;return function(_0x546320){logger['error'](_0x546320[_0x8528('0x27')]);if(_0x546320['name']){delete _0x546320[_0x8528('0x28')];}_0x24b5c2['status'](_0x5312d0)['send'](_0x546320);};}exports['index']=function(_0x2112a2,_0x158971){var _0x1f0ede={},_0x9d7aa7={},_0x4a1813={'count':0x0,'rows':[]};var _0x5d5cb8=_[_0x8528('0x29')](db[_0x8528('0x2a')]['rawAttributes'],function(_0x361cbd){return{'name':_0x361cbd[_0x8528('0x2b')],'type':_0x361cbd[_0x8528('0x2c')][_0x8528('0x2d')]};});_0x9d7aa7['model']=_[_0x8528('0x29')](_0x5d5cb8,_0x8528('0x28'));_0x9d7aa7[_0x8528('0x2e')]=_[_0x8528('0x2f')](_0x2112a2[_0x8528('0x2e')]);_0x9d7aa7[_0x8528('0x30')]=_[_0x8528('0x31')](_0x9d7aa7[_0x8528('0x32')],_0x9d7aa7['query']);_0x1f0ede[_0x8528('0x33')]=_['intersection'](_0x9d7aa7['model'],qs['fields'](_0x2112a2['query'][_0x8528('0x34')]));_0x1f0ede[_0x8528('0x33')]=_0x1f0ede[_0x8528('0x33')][_0x8528('0x35')]?_0x1f0ede[_0x8528('0x33')]:_0x9d7aa7['model'];if(!_0x2112a2[_0x8528('0x2e')][_0x8528('0x36')](_0x8528('0x37'))){_0x1f0ede['limit']=qs['limit'](_0x2112a2[_0x8528('0x2e')]['limit']);_0x1f0ede[_0x8528('0x1d')]=qs[_0x8528('0x1d')](_0x2112a2[_0x8528('0x2e')][_0x8528('0x1d')]);}_0x1f0ede[_0x8528('0x38')]=qs[_0x8528('0x39')](_0x2112a2['query'][_0x8528('0x39')]);_0x1f0ede['where']=qs[_0x8528('0x30')](_[_0x8528('0x3a')](_0x2112a2['query'],_0x9d7aa7[_0x8528('0x30')]),_0x5d5cb8);if(_0x2112a2['query'][_0x8528('0x3b')]){_0x1f0ede[_0x8528('0x3c')]=_['merge'](_0x1f0ede[_0x8528('0x3c')],{'$or':_[_0x8528('0x29')](_0x5d5cb8,function(_0x5054a3){if(_0x5054a3['type']!==_0x8528('0x3d')){var _0x50172a={};_0x50172a[_0x5054a3['name']]={'$like':'%'+_0x2112a2[_0x8528('0x2e')][_0x8528('0x3b')]+'%'};return _0x50172a;}})});}_0x1f0ede=_['merge']({},_0x1f0ede,_0x2112a2[_0x8528('0x3e')]);var _0x3c9db3={'where':_0x1f0ede[_0x8528('0x3c')]};return db[_0x8528('0x2a')][_0x8528('0x3f')](_0x3c9db3)['then'](function(_0x13cc86){_0x4a1813[_0x8528('0x3f')]=_0x13cc86;if(_0x2112a2[_0x8528('0x2e')]['includeAll']){_0x1f0ede['include']=[{'all':!![]}];}return db[_0x8528('0x2a')][_0x8528('0x40')](_0x1f0ede);})[_0x8528('0x25')](function(_0x224013){_0x4a1813['rows']=_0x224013;return _0x4a1813;})['then'](respondWithFilteredResult(_0x158971,_0x1f0ede))[_0x8528('0x41')](handleError(_0x158971,null));};exports[_0x8528('0x42')]=function(_0x24fde9,_0xbf669c){var _0x56d23d={'raw':![],'where':{'id':_0x24fde9[_0x8528('0x43')]['id']}},_0x59d18e={};_0x59d18e[_0x8528('0x32')]=_['keys'](db[_0x8528('0x2a')][_0x8528('0x44')]);_0x59d18e[_0x8528('0x2e')]=_[_0x8528('0x2f')](_0x24fde9[_0x8528('0x2e')]);_0x59d18e[_0x8528('0x30')]=_[_0x8528('0x31')](_0x59d18e['model'],_0x59d18e[_0x8528('0x2e')]);_0x56d23d[_0x8528('0x33')]=_['intersection'](_0x59d18e[_0x8528('0x32')],qs[_0x8528('0x34')](_0x24fde9[_0x8528('0x2e')][_0x8528('0x34')]));_0x56d23d[_0x8528('0x33')]=_0x56d23d[_0x8528('0x33')][_0x8528('0x35')]?_0x56d23d[_0x8528('0x33')]:_0x59d18e[_0x8528('0x32')];if(_0x24fde9[_0x8528('0x2e')][_0x8528('0x45')]){_0x56d23d['include']=[{'all':!![]}];}_0x56d23d=_[_0x8528('0x46')]({},_0x56d23d,_0x24fde9[_0x8528('0x3e')]);return db['UserProfile'][_0x8528('0x47')](_0x56d23d)[_0x8528('0x25')](handleEntityNotFound(_0xbf669c,null))[_0x8528('0x25')](respondWithResult(_0xbf669c,null))[_0x8528('0x41')](handleError(_0xbf669c,null));};exports['create']=function(_0xaa2b80,_0x3da62b){return db[_0x8528('0x2a')][_0x8528('0x48')](_0xaa2b80[_0x8528('0x49')],{})[_0x8528('0x25')](respondWithResult(_0x3da62b,0xc9))['catch'](handleError(_0x3da62b,null));};exports[_0x8528('0x4a')]=function(_0x448b34,_0x5154c8){var _0x31bb26={'where':{'id':_0x448b34[_0x8528('0x43')]['id']}},_0x2bb539={};_0x2bb539[_0x8528('0x32')]=_[_0x8528('0x2f')](db[_0x8528('0x2a')][_0x8528('0x44')]);_0x31bb26[_0x8528('0x33')]=_['intersection'](_0x2bb539[_0x8528('0x32')],qs[_0x8528('0x34')](_0x448b34[_0x8528('0x2e')][_0x8528('0x34')]));_0x31bb26[_0x8528('0x33')]=_0x31bb26[_0x8528('0x33')]['length']?_0x31bb26['attributes']:_0x2bb539['model'];if(_0x448b34['query']['includeAll']){_0x31bb26[_0x8528('0x4b')]=[{'all':!![]}];}_0x31bb26=_[_0x8528('0x46')]({},_0x31bb26,_0x448b34['options']);return db['UserProfile']['find'](_0x31bb26)['then'](handleEntityNotFound(_0x5154c8,null))[_0x8528('0x25')](function(_0x536979){if(_0x536979){var _0xb101b6=_0x536979[_0x8528('0x4c')]({'plain':!![]});_0xb101b6=qs['omit'](_0xb101b6,['id',_0x8528('0x4d'),_0x8528('0x4e'),_0x8528('0x4f')]);_0x448b34[_0x8528('0x49')]=_[_0x8528('0x50')](_0x448b34[_0x8528('0x49')],['id',_0x8528('0x4d'),_0x8528('0x4e')]);return db['sequelize'][_0x8528('0x51')](function(_0x1583e1){return db['UserProfile'][_0x8528('0x48')](_[_0x8528('0x46')](_0xb101b6,_0x448b34[_0x8528('0x49')]),{'include':_0x448b34[_0x8528('0x2e')][_0x8528('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x1583e1})[_0x8528('0x25')](function(_0x2a542f){var _0x12b2bf=_0x2a542f[_0x8528('0x4c')]({'plain':!![]});return db[_0x8528('0x52')][_0x8528('0x40')]({'where':{'userProfileId':_0x448b34[_0x8528('0x43')]['id']},'raw':!![]})[_0x8528('0x25')](function(_0x1cd4ee){if(_0x1cd4ee){return BPromise[_0x8528('0x53')](_0x1cd4ee,function(_0x58b056){return new BPromise(function(_0x1bb411,_0x5da174){if(_0x58b056[_0x8528('0x54')]===null||_0x58b056[_0x8528('0x54')]===0x1)_0x1bb411(null);return db['UserProfileResource'][_0x8528('0x40')]({'where':{'sectionId':_0x58b056['id']},'raw':!![]})[_0x8528('0x25')](function(_0x4d0b1f){var _0x319b5c=_[_0x8528('0x29')](_0x4d0b1f,function(_0x20f8aa){return qs[_0x8528('0x50')](_0x20f8aa,['id',_0x8528('0x4d'),'updatedAt',_0x8528('0x55')]);});_0x1bb411(_0x319b5c);})[_0x8528('0x41')](function(_0x1dd49f){_0x5da174(_0x1dd49f);});})[_0x8528('0x25')](function(_0x334c18){var _0x24ba1c=qs[_0x8528('0x50')](_0x58b056,['id',_0x8528('0x4d'),_0x8528('0x4e')]);_0x24ba1c[_0x8528('0x56')]=_0x12b2bf['id'];if(_0x334c18)_0x24ba1c['Resources']=_0x334c18;return _0x24ba1c;})[_0x8528('0x25')](function(_0x16a1bf){return db['UserProfileSection'][_0x8528('0x48')](_0x16a1bf,{'include':[{'model':db[_0x8528('0x57')],'as':_0x8528('0x58')}],'raw':!![],'transaction':_0x1583e1});});})[_0x8528('0x25')](function(){return _0x12b2bf;});}});});});}})[_0x8528('0x25')](respondWithResult(_0x5154c8,0xc9))[_0x8528('0x41')](handleError(_0x5154c8,null));};exports['update']=function(_0x403c58,_0x418bad){if(_0x403c58[_0x8528('0x49')]['id']){delete _0x403c58[_0x8528('0x49')]['id'];}return db[_0x8528('0x2a')][_0x8528('0x47')]({'where':{'id':_0x403c58[_0x8528('0x43')]['id']}})[_0x8528('0x25')](handleEntityNotFound(_0x418bad,null))['then'](saveUpdates(_0x403c58[_0x8528('0x49')],null))[_0x8528('0x25')](respondWithResult(_0x418bad,null))[_0x8528('0x41')](handleError(_0x418bad,null));};exports[_0x8528('0x59')]=function(_0x1ca5f0,_0x4c24d4){return db[_0x8528('0x2a')]['find']({'where':{'id':_0x1ca5f0[_0x8528('0x43')]['id']}})[_0x8528('0x25')](handleEntityNotFound(_0x4c24d4,null))['then'](removeEntity(_0x4c24d4,null))[_0x8528('0x41')](handleError(_0x4c24d4,null));};exports[_0x8528('0x5a')]=function(_0x2eff83,_0x4deed3){return db[_0x8528('0x2a')][_0x8528('0x5a')]()['then'](respondWithResult(_0x4deed3,null))['catch'](handleError(_0x4deed3,null));};exports[_0x8528('0x5b')]=function(_0x1715c4,_0x1e8ff9){var _0x2404ca=_0x1715c4[_0x8528('0x49')];return db[_0x8528('0x2a')]['find']({'where':{'id':_0x1715c4[_0x8528('0x43')]['id']}})[_0x8528('0x25')](handleEntityNotFound(_0x1e8ff9,null))[_0x8528('0x25')](function(_0x366bb6){if(_0x366bb6){return db[_0x8528('0x5c')][_0x8528('0x51')](function(_0x933ce4){return db['UserProfileSection'][_0x8528('0x59')]({'where':{'userProfileId':_0x1715c4[_0x8528('0x43')]['id'],'sectionId':_[_0x8528('0x29')](_0x2404ca,function(_0x1d3c4f){return _0x1d3c4f[_0x8528('0x55')];})},'transaction':_0x933ce4})[_0x8528('0x25')](function(){var _0x53d075=_[_0x8528('0x29')](_0x2404ca,function(_0xaa611a){_0xaa611a[_0x8528('0x56')]=_0x1715c4['params']['id'];return _0xaa611a;});var _0x213d44=[];return BPromise[_0x8528('0x53')](_0x53d075,function(_0x3d98ad){return db[_0x8528('0x52')][_0x8528('0x48')](_0x3d98ad,{'include':[{'model':db[_0x8528('0x57')],'as':_0x8528('0x58')}],'raw':!![],'transaction':_0x933ce4})[_0x8528('0x25')](function(_0x21d526){_0x213d44['push'](_0x21d526[_0x8528('0x4c')]({'plain':!![]}));});})[_0x8528('0x25')](function(){return _0x213d44;});});});}})[_0x8528('0x25')](function(_0x33ae19){return _0x33ae19;})[_0x8528('0x25')](respondWithResult(_0x1e8ff9,null))['catch'](handleError(_0x1e8ff9,null));};exports[_0x8528('0x5d')]=function(_0x1e355b,_0x180703){var _0x26a1f2;return db[_0x8528('0x2a')][_0x8528('0x47')]({'where':{'id':_0x1e355b[_0x8528('0x43')]['id']},'attributes':['id',_0x8528('0x28')]})[_0x8528('0x25')](handleEntityNotFound(_0x180703,null))[_0x8528('0x25')](function(_0x25fc71){if(_0x25fc71){_0x26a1f2=_0x25fc71;return db[_0x8528('0x52')][_0x8528('0x59')]({'where':{'userProfileId':_0x1e355b[_0x8528('0x43')]['id'],'sectionId':_0x1e355b[_0x8528('0x2e')][_0x8528('0x5e')]}});}})[_0x8528('0x25')](function(){return _0x26a1f2;})[_0x8528('0x25')](respondWithStatusCode(_0x180703,null))['catch'](handleError(_0x180703,null));};exports[_0x8528('0x5f')]=function(_0x28b211,_0x48f393){var _0x5048df=[];var _0x16c45c=[];return db['UserProfileSection'][_0x8528('0x40')]({'where':{'userProfileId':_0x28b211[_0x8528('0x43')]['id']},'raw':!![]})['then'](function(_0x4e4138){_0x5048df=_[_0x8528('0x3b')](_0x4e4138,function(_0x4b65ec){return _0x4b65ec[_0x8528('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x4b65ec[_0x8528('0x55')]);});if(!_[_0x8528('0x61')](_0x5048df)){return _[_0x8528('0x29')](_0x5048df,function(_0x3b49ae){return _0x3b49ae['sectionId'];});}else{return;}})[_0x8528('0x25')](function(_0xdb2677){if(_0xdb2677)_0x16c45c=_0xdb2677;if(_[_0x8528('0x62')](_0x16c45c,0x64)){var _0x2b21af=_['find'](_0x5048df,{'sectionId':0x64});return hasDefaultDashboard(_0x2b21af)[_0x8528('0x25')](function(_0x3a45b3){return _[_0x8528('0x29')](_0x5048df,function(_0x3a1960){if(_0x3a1960[_0x8528('0x55')]===0x64){_0x3a1960['subsections']=_0x3a45b3;}return _0x3a1960;});});}else{return;}})['then'](function(_0x199d7a){if(_0x199d7a)_0x5048df=_0x199d7a;if(_[_0x8528('0x62')](_0x16c45c,0x3eb)){var _0x23327d=_[_0x8528('0x47')](_0x5048df,{'sectionId':0x3eb});return getCustomDashboards(_0x23327d)[_0x8528('0x25')](function(_0x1ab469){return _['map'](_0x5048df,function(_0x1ff0d8){if(_0x23327d[_0x8528('0x60')]){if(_0x1ff0d8[_0x8528('0x55')]===0x3eb){_0x1ff0d8[_0x8528('0x63')]=_0x1ab469;}}else{if(_0x1ff0d8[_0x8528('0x55')]===0x64){if(!_0x1ff0d8[_0x8528('0x63')]){_0x1ff0d8[_0x8528('0x63')]=[];}_0x1ff0d8['subsections']=_0x1ff0d8[_0x8528('0x63')][_0x8528('0x64')](_0x1ab469);}}return _0x1ff0d8;});});}else{return;}})[_0x8528('0x25')](function(_0x57af2f){if(_0x57af2f)_0x5048df=_0x57af2f;if(_[_0x8528('0x62')](_0x16c45c,0x709)){var _0x225a03=_[_0x8528('0x47')](_0x5048df,{'sectionId':0x709});return getPlugins(_0x225a03)[_0x8528('0x25')](function(_0x150bbc){if(_0x225a03[_0x8528('0x60')]){return _[_0x8528('0x29')](_0x5048df,function(_0x39c23c){if(_0x39c23c[_0x8528('0x55')]===0x709){_0x39c23c[_0x8528('0x63')]=_0x150bbc;}return _0x39c23c;});}else{var _0x3136c4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x150bbc};var _0x13b602=_['map'](_0x5048df);_0x13b602['push'](_0x3136c4);return _0x13b602;}});}else{return;}})[_0x8528('0x25')](function(_0x4a05b0){if(_0x4a05b0)_0x5048df=_0x4a05b0;return _[_0x8528('0x3b')](_0x5048df,[_0x8528('0x60'),0x1]);})['then'](respondWithResult(_0x48f393,null))[_0x8528('0x41')](handleError(_0x48f393,null));};function hasDefaultDashboard(_0x3f9f37){var _0x2662cd=[0x65];return new BPromise(function(_0xcb584e,_0x15100c){try{if(_0x3f9f37[_0x8528('0x54')]){_0xcb584e(_0x2662cd);}else{return db['UserProfileResource'][_0x8528('0x65')]({'where':{'sectionId':_0x3f9f37['id']},'raw':!![]})[_0x8528('0x25')](function(_0x2a49ae){_0x2a49ae?_0xcb584e(_0x2662cd):_0xcb584e();});}}catch(_0x2d21b8){_0x15100c(_0x2d21b8);}});}function getCustomDashboards(_0x748dff){var _0xdb33b=[];return new BPromise(function(_0x12caa8,_0x4c4529){try{if(_0x748dff[_0x8528('0x54')]){return db['Dashboard'][_0x8528('0x40')]({'raw':!![]})[_0x8528('0x25')](function(_0x348d0d){_0x348d0d[_0x8528('0x66')](function(_0x1ddd6c){_0xdb33b[_0x8528('0x67')](_0x1ddd6c['id']+0x1869f);});_0x12caa8(_0xdb33b);});}else{return db['UserProfileResource'][_0x8528('0x40')]({'where':{'sectionId':_0x748dff['id']},'raw':!![]})['then'](function(_0x514a7c){_0x514a7c[_0x8528('0x66')](function(_0x3d3d3e){_0xdb33b[_0x8528('0x67')](_0x3d3d3e['resourceId']+0x1869f);});_0x12caa8(_0xdb33b);});}}catch(_0x1674dd){_0x4c4529(_0x1674dd);}});}function getPlugins(_0x261347){var _0x479be0=[];return new BPromise(function(_0x16d0ee,_0x463519){try{if(_0x261347[_0x8528('0x54')]){return db[_0x8528('0x68')][_0x8528('0x40')]({'raw':!![]})[_0x8528('0x25')](function(_0x15f8d8){_0x15f8d8['forEach'](function(_0xfe090f){_0x479be0['push'](_0xfe090f['id']+0x15b38);});_0x16d0ee(_0x479be0);});}else{return db[_0x8528('0x57')]['findAll']({'where':{'sectionId':_0x261347['id']},'raw':!![]})[_0x8528('0x25')](function(_0x2c0ce3){_0x2c0ce3[_0x8528('0x66')](function(_0x5e8d89){_0x479be0[_0x8528('0x67')](_0x5e8d89[_0x8528('0x69')]+0x15b38);});_0x16d0ee(_0x479be0);});}}catch(_0x23a9c4){_0x463519(_0x23a9c4);}});}exports[_0x8528('0x6a')]=function(_0x5f4af8,_0x52870e){return db[_0x8528('0x2a')][_0x8528('0x47')]({'where':{'id':_0x5f4af8[_0x8528('0x43')]['id']}})[_0x8528('0x25')](handleEntityNotFound(_0x52870e,null))[_0x8528('0x25')](function(_0x19829f){if(_0x19829f){return db[_0x8528('0x5c')][_0x8528('0x51')](function(_0x41d715){return db[_0x8528('0x52')][_0x8528('0x40')]({'where':{'userProfileId':_0x5f4af8['params']['id']},'attributes':['id'],'raw':!![]})[_0x8528('0x25')](function(_0x78bd14){if(_0x78bd14){return db[_0x8528('0x52')][_0x8528('0x59')]({'where':{'userProfileId':_0x5f4af8['params']['id'],'id':_[_0x8528('0x29')](_0x78bd14,function(_0xbddde8){return _0xbddde8['id'];})},'transaction':_0x41d715});}})[_0x8528('0x25')](function(_0x52c0be){var _0x5b2bb2=_[_0x8528('0x29')](_0x5f4af8[_0x8528('0x49')],function(_0x40d5f0){_0x40d5f0[_0x8528('0x56')]=_0x5f4af8['params']['id'];return _0x40d5f0;});return db[_0x8528('0x52')][_0x8528('0x6b')](_0x5b2bb2,{'raw':!![],'transaction':_0x41d715});})[_0x8528('0x25')](function(_0x2cca9c){var _0x32797a=_[_0x8528('0x3b')](_[_0x8528('0x29')](_0x2cca9c,function(_0x25edb7){return _0x25edb7[_0x8528('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x32797a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5f4af8[_0x8528('0x43')]['id'],'sectionId':_[_0x8528('0x29')](_0x32797a,function(_0x5d517c){return _0x5d517c[_0x8528('0x55')];})},'attributes':['id',_0x8528('0x55')],'raw':!![]})[_0x8528('0x25')](function(_0xceec63){var _0x59ba1b=_[_0x8528('0x29')](_0x5f4af8[_0x8528('0x49')],function(_0x4d11fa){_0x4d11fa[_0x8528('0x56')]=_0x5f4af8[_0x8528('0x43')]['id'];return _0x4d11fa;});return db[_0x8528('0x57')][_0x8528('0x6b')](_0x59ba1b,{'raw':!![],'transaction':_0x41d715});});}})[_0x8528('0x41')](handleError(_0x52870e,null));});}})['then'](function(_0x521ce4){var _0xa669=_[_0x8528('0x29')](_0x521ce4,function(_0xa7ba2c){return _0xa7ba2c[_0x8528('0x4c')]({'plain':!![]});});})[_0x8528('0x25')](respondWithResult(_0x52870e,null))['catch'](handleError(_0x52870e,null));};exports[_0x8528('0x6c')]=function(_0x1826df,_0x40d2b7,_0x3510c4){return db[_0x8528('0x2a')][_0x8528('0x47')]({'where':{'id':_0x1826df[_0x8528('0x43')]['id']}})[_0x8528('0x25')](handleEntityNotFound(_0x40d2b7,null))[_0x8528('0x25')](function(_0x486b49){if(_0x486b49){return _0x486b49['removeResources'](_0x1826df[_0x8528('0x2e')]['ids']);}})['then'](respondWithStatusCode(_0x40d2b7,null))[_0x8528('0x41')](handleError(_0x40d2b7,null));};exports[_0x8528('0x6d')]=function(_0x1aac9a,_0x158bb4){var _0x17b0ca={};if(!_0x1aac9a[_0x8528('0x2e')]['section'])throw new Error(_0x8528('0x6e'));if(!_0x1aac9a[_0x8528('0x2e')]['hasOwnProperty']('nolimit')){_0x17b0ca['limit']=qs[_0x8528('0x6f')](_0x1aac9a[_0x8528('0x2e')][_0x8528('0x6f')]);_0x17b0ca['offset']=qs[_0x8528('0x1d')](_0x1aac9a[_0x8528('0x2e')][_0x8528('0x1d')]);}return db[_0x8528('0x2a')][_0x8528('0x47')]({'where':{'id':_0x1aac9a[_0x8528('0x43')]['id']}})[_0x8528('0x25')](function(_0x5d53ff){if(!_0x5d53ff)throw new Error(_0x8528('0x70')+_0x1aac9a[_0x8528('0x43')]['id']);return db['UserProfile'][_0x8528('0x6d')](_0x1aac9a);})[_0x8528('0x25')](respondWithFilteredResult(_0x158bb4,_0x17b0ca))[_0x8528('0x41')](handleError(_0x158bb4,null));}; \ No newline at end of file +var _0xa37f=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','clone','length','get','omit','createdAt','crudPermissions','updatedAt','transaction','autoAssociation','userProfileId','Resources','find','describe','addSections','sequelize','sectionId','each','UserProfileSection','push','removeSections','getSections','enabled','includes','subsections','concat','findOne','forEach','resourceId','UserProfileResource','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4c556b,_0x527052){var _0x50b9bd=function(_0x4ea833){while(--_0x4ea833){_0x4c556b['push'](_0x4c556b['shift']());}};_0x50b9bd(++_0x527052);}(_0xa37f,0x66));var _0xfa37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa37f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfa37('0x0'));var rimraf=require(_0xfa37('0x1'));var zipdir=require(_0xfa37('0x2'));var jsonpatch=require(_0xfa37('0x3'));var rp=require(_0xfa37('0x4'));var moment=require(_0xfa37('0x5'));var BPromise=require(_0xfa37('0x6'));var Mustache=require('mustache');var util=require(_0xfa37('0x7'));var path=require(_0xfa37('0x8'));var sox=require(_0xfa37('0x9'));var csv=require(_0xfa37('0xa'));var ejs=require(_0xfa37('0xb'));var fs=require('fs');var fs_extra=require(_0xfa37('0xc'));var _=require(_0xfa37('0xd'));var squel=require(_0xfa37('0xe'));var crypto=require(_0xfa37('0xf'));var jsforce=require(_0xfa37('0x10'));var deskjs=require(_0xfa37('0x11'));var toCsv=require(_0xfa37('0xa'));var querystring=require(_0xfa37('0x12'));var Papa=require(_0xfa37('0x13'));var Redis=require(_0xfa37('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa37('0x15'));var logger=require(_0xfa37('0x16'))(_0xfa37('0x17'));var utils=require(_0xfa37('0x18'));var config=require(_0xfa37('0x19'));var licenseUtil=require(_0xfa37('0x1a'));var db=require(_0xfa37('0x1b'))['db'];config['redis']=_[_0xfa37('0x1c')](config[_0xfa37('0x1d')],{'host':_0xfa37('0x1e'),'port':0x18eb});var socket=require(_0xfa37('0x1f'))(new Redis(config['redis']));require(_0xfa37('0x20'))[_0xfa37('0x21')](socket);function respondWithStatusCode(_0x589b81,_0x52fe08){_0x52fe08=_0x52fe08||0xcc;return function(_0x5b48ec){if(_0x5b48ec){return _0x589b81[_0xfa37('0x22')](_0x52fe08);}return _0x589b81[_0xfa37('0x23')](_0x52fe08)[_0xfa37('0x24')]();};}function respondWithResult(_0xe2b8ca,_0x4d1bb0){_0x4d1bb0=_0x4d1bb0||0xc8;return function(_0x4910e8){if(_0x4910e8){return _0xe2b8ca[_0xfa37('0x23')](_0x4d1bb0)[_0xfa37('0x25')](_0x4910e8);}};}function respondWithFilteredResult(_0xd97794,_0x394183){return function(_0x40c568){if(_0x40c568){var _0x51835a=typeof _0x394183[_0xfa37('0x26')]==='undefined'&&typeof _0x394183[_0xfa37('0x27')]==='undefined';var _0x44bada=_0x40c568[_0xfa37('0x28')];var _0x23a2a8=_0x51835a?0x0:_0x394183['offset'];var _0x4ed7fe=_0x51835a?_0x40c568[_0xfa37('0x28')]:_0x394183[_0xfa37('0x26')]+_0x394183[_0xfa37('0x27')];var _0x1e7456;if(_0x4ed7fe>=_0x44bada){_0x4ed7fe=_0x44bada;_0x1e7456=0xc8;}else{_0x1e7456=0xce;}_0xd97794[_0xfa37('0x23')](_0x1e7456);return _0xd97794[_0xfa37('0x29')](_0xfa37('0x2a'),_0x23a2a8+'-'+_0x4ed7fe+'/'+_0x44bada)[_0xfa37('0x25')](_0x40c568);}return null;};}function patchUpdates(_0x558c7e){return function(_0x159c1f){try{jsonpatch[_0xfa37('0x2b')](_0x159c1f,_0x558c7e,!![]);}catch(_0x1dc40e){return BPromise['reject'](_0x1dc40e);}return _0x159c1f[_0xfa37('0x2c')]();};}function saveUpdates(_0x4da922,_0x14a216){return function(_0x48f117){if(_0x48f117){return _0x48f117[_0xfa37('0x2d')](_0x4da922)[_0xfa37('0x2e')](function(_0x349e94){return _0x349e94;});}return null;};}function removeEntity(_0x13eb53,_0x31cd68){return function(_0xc6f45a){if(_0xc6f45a){return _0xc6f45a[_0xfa37('0x2f')]()[_0xfa37('0x2e')](function(){_0x13eb53[_0xfa37('0x23')](0xcc)[_0xfa37('0x24')]();});}};}function handleEntityNotFound(_0x2554cc,_0xa30b94){return function(_0x3a8453){if(!_0x3a8453){_0x2554cc['sendStatus'](0x194);}return _0x3a8453;};}function handleError(_0x2107a6,_0x4a958e){_0x4a958e=_0x4a958e||0x1f4;return function(_0x56efa7){logger[_0xfa37('0x30')](_0x56efa7[_0xfa37('0x31')]);if(_0x56efa7[_0xfa37('0x32')]){delete _0x56efa7[_0xfa37('0x32')];}_0x2107a6[_0xfa37('0x23')](_0x4a958e)[_0xfa37('0x33')](_0x56efa7);};}exports['index']=function(_0x5ebf84,_0x5b8b08){var _0x4d3aab={},_0x3453ac={},_0x420d01={'count':0x0,'rows':[]};var _0x2035cc=_[_0xfa37('0x34')](db[_0xfa37('0x35')][_0xfa37('0x36')],function(_0x463eaf){return{'name':_0x463eaf[_0xfa37('0x37')],'type':_0x463eaf['type'][_0xfa37('0x38')]};});_0x3453ac[_0xfa37('0x39')]=_[_0xfa37('0x34')](_0x2035cc,'name');_0x3453ac['query']=_[_0xfa37('0x3a')](_0x5ebf84[_0xfa37('0x3b')]);_0x3453ac[_0xfa37('0x3c')]=_[_0xfa37('0x3d')](_0x3453ac['model'],_0x3453ac['query']);_0x4d3aab[_0xfa37('0x3e')]=_[_0xfa37('0x3d')](_0x3453ac[_0xfa37('0x39')],qs[_0xfa37('0x3f')](_0x5ebf84[_0xfa37('0x3b')][_0xfa37('0x3f')]));_0x4d3aab[_0xfa37('0x3e')]=_0x4d3aab[_0xfa37('0x3e')]['length']?_0x4d3aab[_0xfa37('0x3e')]:_0x3453ac[_0xfa37('0x39')];if(!_0x5ebf84[_0xfa37('0x3b')]['hasOwnProperty'](_0xfa37('0x40'))){_0x4d3aab['limit']=qs[_0xfa37('0x27')](_0x5ebf84[_0xfa37('0x3b')][_0xfa37('0x27')]);_0x4d3aab[_0xfa37('0x26')]=qs[_0xfa37('0x26')](_0x5ebf84[_0xfa37('0x3b')][_0xfa37('0x26')]);}_0x4d3aab['order']=qs[_0xfa37('0x41')](_0x5ebf84[_0xfa37('0x3b')][_0xfa37('0x41')]);_0x4d3aab['where']=qs[_0xfa37('0x3c')](_[_0xfa37('0x42')](_0x5ebf84[_0xfa37('0x3b')],_0x3453ac[_0xfa37('0x3c')]),_0x2035cc);if(_0x5ebf84[_0xfa37('0x3b')][_0xfa37('0x43')]){_0x4d3aab[_0xfa37('0x44')]=_[_0xfa37('0x45')](_0x4d3aab[_0xfa37('0x44')],{'$or':_[_0xfa37('0x34')](_0x2035cc,function(_0x290c59){if(_0x290c59[_0xfa37('0x46')]!==_0xfa37('0x47')){var _0x1b8adb={};_0x1b8adb[_0x290c59[_0xfa37('0x32')]]={'$like':'%'+_0x5ebf84[_0xfa37('0x3b')]['filter']+'%'};return _0x1b8adb;}})});}_0x4d3aab=_[_0xfa37('0x45')]({},_0x4d3aab,_0x5ebf84[_0xfa37('0x48')]);var _0x2f6f50={'where':_0x4d3aab['where']};return db[_0xfa37('0x35')]['count'](_0x2f6f50)[_0xfa37('0x2e')](function(_0x24e44f){_0x420d01[_0xfa37('0x28')]=_0x24e44f;if(_0x5ebf84['query'][_0xfa37('0x49')]){_0x4d3aab[_0xfa37('0x4a')]=[{'all':!![]}];}return db[_0xfa37('0x35')][_0xfa37('0x4b')](_0x4d3aab);})[_0xfa37('0x2e')](function(_0x438769){_0x420d01['rows']=_0x438769;return _0x420d01;})[_0xfa37('0x2e')](respondWithFilteredResult(_0x5b8b08,_0x4d3aab))[_0xfa37('0x4c')](handleError(_0x5b8b08,null));};exports[_0xfa37('0x4d')]=function(_0x19b7a2,_0x187022){var _0x365443={'raw':![],'where':{'id':_0x19b7a2[_0xfa37('0x4e')]['id']}},_0x3924be={};_0x3924be[_0xfa37('0x39')]=_[_0xfa37('0x3a')](db['UserProfile'][_0xfa37('0x36')]);_0x3924be[_0xfa37('0x3b')]=_[_0xfa37('0x3a')](_0x19b7a2[_0xfa37('0x3b')]);_0x3924be[_0xfa37('0x3c')]=_[_0xfa37('0x3d')](_0x3924be[_0xfa37('0x39')],_0x3924be[_0xfa37('0x3b')]);_0x365443[_0xfa37('0x3e')]=_[_0xfa37('0x3d')](_0x3924be[_0xfa37('0x39')],qs[_0xfa37('0x3f')](_0x19b7a2[_0xfa37('0x3b')][_0xfa37('0x3f')]));_0x365443[_0xfa37('0x3e')]=_0x365443[_0xfa37('0x3e')]['length']?_0x365443[_0xfa37('0x3e')]:_0x3924be[_0xfa37('0x39')];if(_0x19b7a2[_0xfa37('0x3b')][_0xfa37('0x49')]){_0x365443[_0xfa37('0x4a')]=[{'all':!![]}];}_0x365443=_[_0xfa37('0x45')]({},_0x365443,_0x19b7a2[_0xfa37('0x48')]);return db[_0xfa37('0x35')]['find'](_0x365443)['then'](handleEntityNotFound(_0x187022,null))[_0xfa37('0x2e')](respondWithResult(_0x187022,null))[_0xfa37('0x4c')](handleError(_0x187022,null));};exports['create']=function(_0x50aa9c,_0x5a22b5){return db[_0xfa37('0x35')][_0xfa37('0x4f')](_0x50aa9c[_0xfa37('0x50')],{})[_0xfa37('0x2e')](respondWithResult(_0x5a22b5,0xc9))[_0xfa37('0x4c')](handleError(_0x5a22b5,null));};exports[_0xfa37('0x51')]=function(_0x56dfe1,_0x5f3296){var _0x36dea6={'where':{'id':_0x56dfe1[_0xfa37('0x4e')]['id']}},_0x1364d1={};_0x1364d1[_0xfa37('0x39')]=_['keys'](db[_0xfa37('0x35')][_0xfa37('0x36')]);_0x36dea6[_0xfa37('0x3e')]=_[_0xfa37('0x3d')](_0x1364d1['model'],qs[_0xfa37('0x3f')](_0x56dfe1['query'][_0xfa37('0x3f')]));_0x36dea6[_0xfa37('0x3e')]=_0x36dea6[_0xfa37('0x3e')][_0xfa37('0x52')]?_0x36dea6[_0xfa37('0x3e')]:_0x1364d1['model'];if(_0x56dfe1[_0xfa37('0x3b')]['includeAll']){_0x36dea6[_0xfa37('0x4a')]=[{'all':!![]}];}_0x36dea6=_[_0xfa37('0x45')]({},_0x36dea6,_0x56dfe1[_0xfa37('0x48')]);return db[_0xfa37('0x35')]['find'](_0x36dea6)[_0xfa37('0x2e')](handleEntityNotFound(_0x5f3296,null))[_0xfa37('0x2e')](function(_0x187df1){if(_0x187df1){var _0x15ff1a=_0x187df1[_0xfa37('0x53')]({'plain':!![]});_0x15ff1a=qs[_0xfa37('0x54')](_0x15ff1a,['id',_0xfa37('0x55'),'updatedAt',_0xfa37('0x56')]);_0x56dfe1['body']=_[_0xfa37('0x54')](_0x56dfe1[_0xfa37('0x50')],['id',_0xfa37('0x55'),_0xfa37('0x57')]);return db['sequelize'][_0xfa37('0x58')](function(_0x46bbfc){return db[_0xfa37('0x35')][_0xfa37('0x4f')](_[_0xfa37('0x45')](_0x15ff1a,_0x56dfe1['body']),{'include':_0x56dfe1[_0xfa37('0x3b')][_0xfa37('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x46bbfc})['then'](function(_0x3ccb72){var _0x1eb630=_0x3ccb72['get']({'plain':!![]});return db['UserProfileSection'][_0xfa37('0x4b')]({'where':{'userProfileId':_0x56dfe1[_0xfa37('0x4e')]['id']},'raw':!![]})[_0xfa37('0x2e')](function(_0x4d57ed){if(_0x4d57ed){return BPromise['each'](_0x4d57ed,function(_0x15d099){return new BPromise(function(_0x3e550c,_0x40544e){if(_0x15d099[_0xfa37('0x59')]===null||_0x15d099[_0xfa37('0x59')]===0x1)_0x3e550c(null);return db['UserProfileResource'][_0xfa37('0x4b')]({'where':{'sectionId':_0x15d099['id']},'raw':!![]})['then'](function(_0x12502e){var _0x324557=_[_0xfa37('0x34')](_0x12502e,function(_0x1c79dc){return qs['omit'](_0x1c79dc,['id',_0xfa37('0x55'),_0xfa37('0x57'),'sectionId']);});_0x3e550c(_0x324557);})[_0xfa37('0x4c')](function(_0x11501d){_0x40544e(_0x11501d);});})[_0xfa37('0x2e')](function(_0x432a6e){var _0x2062fc=qs[_0xfa37('0x54')](_0x15d099,['id',_0xfa37('0x55'),_0xfa37('0x57')]);_0x2062fc[_0xfa37('0x5a')]=_0x1eb630['id'];if(_0x432a6e)_0x2062fc['Resources']=_0x432a6e;return _0x2062fc;})['then'](function(_0x5d89b9){return db['UserProfileSection'][_0xfa37('0x4f')](_0x5d89b9,{'include':[{'model':db['UserProfileResource'],'as':_0xfa37('0x5b')}],'raw':!![],'transaction':_0x46bbfc});});})[_0xfa37('0x2e')](function(){return _0x1eb630;});}});});});}})[_0xfa37('0x2e')](respondWithResult(_0x5f3296,0xc9))[_0xfa37('0x4c')](handleError(_0x5f3296,null));};exports[_0xfa37('0x2d')]=function(_0x595a00,_0x24afb6){if(_0x595a00[_0xfa37('0x50')]['id']){delete _0x595a00[_0xfa37('0x50')]['id'];}return db['UserProfile'][_0xfa37('0x5c')]({'where':{'id':_0x595a00['params']['id']}})[_0xfa37('0x2e')](handleEntityNotFound(_0x24afb6,null))[_0xfa37('0x2e')](saveUpdates(_0x595a00['body'],null))['then'](respondWithResult(_0x24afb6,null))['catch'](handleError(_0x24afb6,null));};exports[_0xfa37('0x2f')]=function(_0x4ebf6e,_0x25772c){return db[_0xfa37('0x35')][_0xfa37('0x5c')]({'where':{'id':_0x4ebf6e[_0xfa37('0x4e')]['id']}})[_0xfa37('0x2e')](handleEntityNotFound(_0x25772c,null))[_0xfa37('0x2e')](removeEntity(_0x25772c,null))['catch'](handleError(_0x25772c,null));};exports[_0xfa37('0x5d')]=function(_0x27f792,_0x1f836f){return db[_0xfa37('0x35')]['describe']()[_0xfa37('0x2e')](respondWithResult(_0x1f836f,null))[_0xfa37('0x4c')](handleError(_0x1f836f,null));};exports[_0xfa37('0x5e')]=function(_0x5436aa,_0x42a2a6){var _0x5d75d6=_0x5436aa['body'];return db[_0xfa37('0x35')]['find']({'where':{'id':_0x5436aa['params']['id']}})[_0xfa37('0x2e')](handleEntityNotFound(_0x42a2a6,null))[_0xfa37('0x2e')](function(_0x4b8e45){if(_0x4b8e45){return db[_0xfa37('0x5f')][_0xfa37('0x58')](function(_0x5ca211){return db['UserProfileSection'][_0xfa37('0x2f')]({'where':{'userProfileId':_0x5436aa[_0xfa37('0x4e')]['id'],'sectionId':_[_0xfa37('0x34')](_0x5d75d6,function(_0x388bd5){return _0x388bd5[_0xfa37('0x60')];})},'transaction':_0x5ca211})['then'](function(){var _0x6bc89e=_[_0xfa37('0x34')](_0x5d75d6,function(_0x517dbd){_0x517dbd[_0xfa37('0x5a')]=_0x5436aa[_0xfa37('0x4e')]['id'];return _0x517dbd;});var _0x21cb3a=[];return BPromise[_0xfa37('0x61')](_0x6bc89e,function(_0x4376b0){return db[_0xfa37('0x62')][_0xfa37('0x4f')](_0x4376b0,{'include':[{'model':db['UserProfileResource'],'as':_0xfa37('0x5b')}],'raw':!![],'transaction':_0x5ca211})[_0xfa37('0x2e')](function(_0x20db72){_0x21cb3a[_0xfa37('0x63')](_0x20db72[_0xfa37('0x53')]({'plain':!![]}));});})[_0xfa37('0x2e')](function(){return _0x21cb3a;});});});}})[_0xfa37('0x2e')](function(_0x5e34b3){return _0x5e34b3;})[_0xfa37('0x2e')](respondWithResult(_0x42a2a6,null))[_0xfa37('0x4c')](handleError(_0x42a2a6,null));};exports[_0xfa37('0x64')]=function(_0x3ffb05,_0x22a061){var _0x3eff05;return db['UserProfile'][_0xfa37('0x5c')]({'where':{'id':_0x3ffb05['params']['id']},'attributes':['id','name']})[_0xfa37('0x2e')](handleEntityNotFound(_0x22a061,null))[_0xfa37('0x2e')](function(_0x31c62d){if(_0x31c62d){_0x3eff05=_0x31c62d;return db[_0xfa37('0x62')]['destroy']({'where':{'userProfileId':_0x3ffb05[_0xfa37('0x4e')]['id'],'sectionId':_0x3ffb05[_0xfa37('0x3b')]['ids']}});}})[_0xfa37('0x2e')](function(){return _0x3eff05;})[_0xfa37('0x2e')](respondWithStatusCode(_0x22a061,null))[_0xfa37('0x4c')](handleError(_0x22a061,null));};exports[_0xfa37('0x65')]=function(_0x2835d8,_0xfd964b){var _0x522dbd=[];var _0x4e6870=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2835d8[_0xfa37('0x4e')]['id']},'raw':!![]})[_0xfa37('0x2e')](function(_0x23b0e2){_0x522dbd=_[_0xfa37('0x43')](_0x23b0e2,function(_0x1a4660){return _0x1a4660[_0xfa37('0x66')]===0x1||_[_0xfa37('0x67')]([0x3eb,0x709],_0x1a4660[_0xfa37('0x60')]);});if(!_['isEmpty'](_0x522dbd)){return _[_0xfa37('0x34')](_0x522dbd,function(_0x20feb9){return _0x20feb9[_0xfa37('0x60')];});}else{return;}})['then'](function(_0x58b56d){if(_0x58b56d)_0x4e6870=_0x58b56d;if(_[_0xfa37('0x67')](_0x4e6870,0x64)){var _0xce10cc=_[_0xfa37('0x5c')](_0x522dbd,{'sectionId':0x64});return hasDefaultDashboard(_0xce10cc)['then'](function(_0x26471e){return _['map'](_0x522dbd,function(_0x5d253c){if(_0x5d253c['sectionId']===0x64){_0x5d253c[_0xfa37('0x68')]=_0x26471e;}return _0x5d253c;});});}else{return;}})[_0xfa37('0x2e')](function(_0x4482e2){if(_0x4482e2)_0x522dbd=_0x4482e2;if(_['includes'](_0x4e6870,0x3eb)){var _0x505cf5=_['find'](_0x522dbd,{'sectionId':0x3eb});return getCustomDashboards(_0x505cf5)[_0xfa37('0x2e')](function(_0x25526c){return _[_0xfa37('0x34')](_0x522dbd,function(_0xfc6906){if(_0x505cf5[_0xfa37('0x66')]){if(_0xfc6906[_0xfa37('0x60')]===0x3eb){_0xfc6906[_0xfa37('0x68')]=_0x25526c;}}else{if(_0xfc6906[_0xfa37('0x60')]===0x64){if(!_0xfc6906[_0xfa37('0x68')]){_0xfc6906[_0xfa37('0x68')]=[];}_0xfc6906[_0xfa37('0x68')]=_0xfc6906[_0xfa37('0x68')][_0xfa37('0x69')](_0x25526c);}}return _0xfc6906;});});}else{return;}})[_0xfa37('0x2e')](function(_0x41216b){if(_0x41216b)_0x522dbd=_0x41216b;if(_[_0xfa37('0x67')](_0x4e6870,0x709)){var _0x305ab8=_[_0xfa37('0x5c')](_0x522dbd,{'sectionId':0x709});return getPlugins(_0x305ab8)['then'](function(_0x30d3a5){if(_0x305ab8['enabled']){return _[_0xfa37('0x34')](_0x522dbd,function(_0x112824){if(_0x112824[_0xfa37('0x60')]===0x709){_0x112824[_0xfa37('0x68')]=_0x30d3a5;}return _0x112824;});}else{var _0x5d5fcf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x30d3a5};var _0x175a74=_[_0xfa37('0x34')](_0x522dbd);_0x175a74['push'](_0x5d5fcf);return _0x175a74;}});}else{return;}})[_0xfa37('0x2e')](function(_0x16b0b2){if(_0x16b0b2)_0x522dbd=_0x16b0b2;return _['filter'](_0x522dbd,[_0xfa37('0x66'),0x1]);})[_0xfa37('0x2e')](respondWithResult(_0xfd964b,null))[_0xfa37('0x4c')](handleError(_0xfd964b,null));};function hasDefaultDashboard(_0x58963b){var _0x56ec28=[0x65];return new BPromise(function(_0x939e5,_0x18ceca){try{if(_0x58963b[_0xfa37('0x59')]){_0x939e5(_0x56ec28);}else{return db['UserProfileResource'][_0xfa37('0x6a')]({'where':{'sectionId':_0x58963b['id']},'raw':!![]})[_0xfa37('0x2e')](function(_0x3c1dea){_0x3c1dea?_0x939e5(_0x56ec28):_0x939e5();});}}catch(_0x45a5f4){_0x18ceca(_0x45a5f4);}});}function getCustomDashboards(_0x322bb7){var _0x260148=[];return new BPromise(function(_0x1db2b7,_0x14c98f){try{if(_0x322bb7['autoAssociation']){return db['Dashboard'][_0xfa37('0x4b')]({'raw':!![]})[_0xfa37('0x2e')](function(_0x311ab5){_0x311ab5[_0xfa37('0x6b')](function(_0x37d5ea){_0x260148[_0xfa37('0x63')](_0x37d5ea['id']+0x1869f);});_0x1db2b7(_0x260148);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x322bb7['id']},'raw':!![]})[_0xfa37('0x2e')](function(_0x207264){_0x207264[_0xfa37('0x6b')](function(_0x201e89){_0x260148['push'](_0x201e89[_0xfa37('0x6c')]+0x1869f);});_0x1db2b7(_0x260148);});}}catch(_0x4c3db6){_0x14c98f(_0x4c3db6);}});}function getPlugins(_0x250b4e){var _0x461d46=[];return new BPromise(function(_0xe320c0,_0x10358a){try{if(_0x250b4e['autoAssociation']){return db['Plugin'][_0xfa37('0x4b')]({'raw':!![]})[_0xfa37('0x2e')](function(_0x4801a0){_0x4801a0[_0xfa37('0x6b')](function(_0x97459a){_0x461d46[_0xfa37('0x63')](_0x97459a['id']+0x15b38);});_0xe320c0(_0x461d46);});}else{return db[_0xfa37('0x6d')][_0xfa37('0x4b')]({'where':{'sectionId':_0x250b4e['id']},'raw':!![]})[_0xfa37('0x2e')](function(_0x4d3782){_0x4d3782[_0xfa37('0x6b')](function(_0xd5683){_0x461d46[_0xfa37('0x63')](_0xd5683[_0xfa37('0x6c')]+0x15b38);});_0xe320c0(_0x461d46);});}}catch(_0x26c3a6){_0x10358a(_0x26c3a6);}});}exports[_0xfa37('0x6e')]=function(_0x23d4cb,_0x4bdb06){return db['UserProfile'][_0xfa37('0x5c')]({'where':{'id':_0x23d4cb[_0xfa37('0x4e')]['id']}})[_0xfa37('0x2e')](handleEntityNotFound(_0x4bdb06,null))[_0xfa37('0x2e')](function(_0x3614bb){if(_0x3614bb){return db[_0xfa37('0x5f')][_0xfa37('0x58')](function(_0x5cc61e){return db['UserProfileSection'][_0xfa37('0x4b')]({'where':{'userProfileId':_0x23d4cb[_0xfa37('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0xfa37('0x2e')](function(_0x2a8c34){if(_0x2a8c34){return db[_0xfa37('0x62')][_0xfa37('0x2f')]({'where':{'userProfileId':_0x23d4cb['params']['id'],'id':_[_0xfa37('0x34')](_0x2a8c34,function(_0x126b51){return _0x126b51['id'];})},'transaction':_0x5cc61e});}})['then'](function(_0x1578fb){var _0x8da991=_[_0xfa37('0x34')](_0x23d4cb[_0xfa37('0x50')],function(_0x5970af){_0x5970af[_0xfa37('0x5a')]=_0x23d4cb[_0xfa37('0x4e')]['id'];return _0x5970af;});return db[_0xfa37('0x62')][_0xfa37('0x6f')](_0x8da991,{'raw':!![],'transaction':_0x5cc61e});})[_0xfa37('0x2e')](function(_0x9423e4){var _0x7a286b=_[_0xfa37('0x43')](_['map'](_0x9423e4,function(_0x5dd7f0){return _0x5dd7f0['get']({'plain':!![]});}),{'includeAll':![]});if(_0x7a286b){return db[_0xfa37('0x62')]['findAll']({'where':{'userProfileId':_0x23d4cb[_0xfa37('0x4e')]['id'],'sectionId':_[_0xfa37('0x34')](_0x7a286b,function(_0x7fe8ab){return _0x7fe8ab[_0xfa37('0x60')];})},'attributes':['id',_0xfa37('0x60')],'raw':!![]})[_0xfa37('0x2e')](function(_0x5485e3){var _0xaaa4c1=_[_0xfa37('0x34')](_0x23d4cb['body'],function(_0x71a612){_0x71a612['userProfileId']=_0x23d4cb[_0xfa37('0x4e')]['id'];return _0x71a612;});return db[_0xfa37('0x6d')]['bulkCreate'](_0xaaa4c1,{'raw':!![],'transaction':_0x5cc61e});});}})[_0xfa37('0x4c')](handleError(_0x4bdb06,null));});}})[_0xfa37('0x2e')](function(_0x219db0){var _0x1604f6=_[_0xfa37('0x34')](_0x219db0,function(_0x27c89b){return _0x27c89b[_0xfa37('0x53')]({'plain':!![]});});})[_0xfa37('0x2e')](respondWithResult(_0x4bdb06,null))[_0xfa37('0x4c')](handleError(_0x4bdb06,null));};exports['removeResources']=function(_0x518267,_0x481c1,_0x3e34e0){return db[_0xfa37('0x35')][_0xfa37('0x5c')]({'where':{'id':_0x518267[_0xfa37('0x4e')]['id']}})[_0xfa37('0x2e')](handleEntityNotFound(_0x481c1,null))[_0xfa37('0x2e')](function(_0x3a89c4){if(_0x3a89c4){return _0x3a89c4[_0xfa37('0x70')](_0x518267['query']['ids']);}})['then'](respondWithStatusCode(_0x481c1,null))['catch'](handleError(_0x481c1,null));};exports[_0xfa37('0x71')]=function(_0x39f121,_0x240b14){var _0x537a8={};if(!_0x39f121['query']['section'])throw new Error(_0xfa37('0x72'));if(!_0x39f121[_0xfa37('0x3b')][_0xfa37('0x73')](_0xfa37('0x40'))){_0x537a8['limit']=qs['limit'](_0x39f121['query'][_0xfa37('0x27')]);_0x537a8[_0xfa37('0x26')]=qs[_0xfa37('0x26')](_0x39f121[_0xfa37('0x3b')][_0xfa37('0x26')]);}return db[_0xfa37('0x35')][_0xfa37('0x5c')]({'where':{'id':_0x39f121[_0xfa37('0x4e')]['id']}})[_0xfa37('0x2e')](function(_0x48458f){if(!_0x48458f)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x39f121[_0xfa37('0x4e')]['id']);return db[_0xfa37('0x35')][_0xfa37('0x71')](_0x39f121);})[_0xfa37('0x2e')](respondWithFilteredResult(_0x240b14,_0x537a8))['catch'](handleError(_0x240b14,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 443876a..ca26eea 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 _0x46cb=['update','remove','emit','hook','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x18dccf,_0x436c28){var _0x46577c=function(_0xfc0942){while(--_0xfc0942){_0x18dccf['push'](_0x18dccf['shift']());}};_0x46577c(++_0x436c28);}(_0x46cb,0x84));var _0xb46c=function(_0x191b40,_0xe86fd6){_0x191b40=_0x191b40-0x0;var _0xe3fe81=_0x46cb[_0x191b40];return _0xe3fe81;};'use strict';var EventEmitter=require(_0xb46c('0x0'));var UserProfile=require(_0xb46c('0x1'))['db'][_0xb46c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb46c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb46c('0x4'),'afterDestroy':_0xb46c('0x5')};function emitEvent(_0x704ab0){return function(_0x25157d,_0x5d3e63,_0x354f49){UserProfileEvents[_0xb46c('0x6')](_0x704ab0+':'+_0x25157d['id'],_0x25157d);UserProfileEvents[_0xb46c('0x6')](_0x704ab0,_0x25157d);_0x354f49(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb46c('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x761c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x465010,_0x269113){var _0x31f794=function(_0x52335a){while(--_0x52335a){_0x465010['push'](_0x465010['shift']());}};_0x31f794(++_0x269113);}(_0x761c,0x18a));var _0xc761=function(_0x5aabd2,_0x2b8c59){_0x5aabd2=_0x5aabd2-0x0;var _0x38a325=_0x761c[_0x5aabd2];return _0x38a325;};'use strict';var EventEmitter=require(_0xc761('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc761('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc761('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc761('0x3'),'afterDestroy':_0xc761('0x4')};function emitEvent(_0x15d8dc){return function(_0x4b63a5,_0x1bb07e,_0x4ec1c2){UserProfileEvents[_0xc761('0x5')](_0x15d8dc+':'+_0x4b63a5['id'],_0x4b63a5);UserProfileEvents[_0xc761('0x5')](_0x15d8dc,_0x4b63a5);_0x4ec1c2(null);};}for(var e in events){if(events[_0xc761('0x6')](e)){var event=events[e];UserProfile[_0xc761('0x7')](e,emitEvent(event));}}module[_0xc761('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 67fb51b..5e0e9e6 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 _0xcd8f=['length','push','UserProfileSection','find','params','ignore','union','autoAssociation','all','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','foreignKey','forEach','options','includeAll','default','type','DefaultReports','custom','rows','ids','customSorting','extraQueryConditions','count','include','Tag','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','fax','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','associatedResources','catch','model','map','resolve','UserProfileResource','then','AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','Schedule','sounds','tags','Template','triggers','Trigger','variables','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty'];(function(_0xe004a9,_0xd972d7){var _0x3a28df=function(_0x4715f4){while(--_0x4715f4){_0xe004a9['push'](_0xe004a9['shift']());}};_0x3a28df(++_0xd972d7);}(_0xcd8f,0xf2));var _0xfcd8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcd8f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfcd8('0x0'));var attributes=require(_0xfcd8('0x1'));var squel=require('squel');module[_0xfcd8('0x2')]=function(_0x5b6a9d){var _0x45e4ea=_0x5b6a9d[_0xfcd8('0x3')];function _0x35cc37(_0x5c179c,_0x10a4cc){return new Promise(function(_0x2c811b,_0x1f74c6){if(!_0x10a4cc)return _0x2c811b(null);var _0x358a89=_0x10a4cc[_0xfcd8('0x4')]?{[_0x10a4cc[_0xfcd8('0x4')][_0xfcd8('0x5')]]:_0x10a4cc[_0xfcd8('0x4')][_0xfcd8('0x6')]}:undefined;return _0x45e4ea[_0x5c179c][_0xfcd8('0x7')]({'where':_0x358a89,'raw':!![]})['then'](function(_0x40e726){_0x10a4cc[_0xfcd8('0x8')]=_['map'](_0x40e726,'id');_0x2c811b(_0x10a4cc);})[_0xfcd8('0x9')](function(_0xe6ab5f){_0x1f74c6(_0xe6ab5f);});});}function _0x28dcbb(_0x4062f6,_0x157e53){return new Promise(function(_0x46e6a5,_0x31809a){var _0x155979=_0x4062f6[_0xfcd8('0x4')]?{[_0x4062f6[_0xfcd8('0x4')][_0xfcd8('0x5')]]:_0x4062f6[_0xfcd8('0x4')]['value']}:undefined;return _0x45e4ea[_0x4062f6[_0xfcd8('0xa')]][_0xfcd8('0x7')]({'where':_0x155979,'raw':!![]})['then'](function(_0x3449f9){_0x157e53[_0xfcd8('0x8')]=_[_0xfcd8('0xb')](_0x3449f9,function(_0x24c853){return _0x24c853['name'];});_0x46e6a5(_0x157e53);})[_0xfcd8('0x9')](function(_0x37a305){_0x31809a(_0x37a305);});});}function _0x50afbe(_0xf244f3,_0x44fb12,_0x4f2dee){if(!_0x44fb12)return Promise[_0xfcd8('0xc')](null);return new Promise(function(_0x2c87bf,_0x514d92){return _0x45e4ea[_0xfcd8('0xd')][_0xfcd8('0x7')]({'where':{'sectionId':_0x44fb12['id']},'raw':!![]})[_0xfcd8('0xe')](function(_0x2bcbf0){if(_0xf244f3[_0xfcd8('0x5')]&&_0xf244f3[_0xfcd8('0x5')]!=='id'){_0x44fb12['associatedResources']=_[_0xfcd8('0xb')](_0x2bcbf0,function(_0x40d764){return _0x40d764[_0xf244f3[_0xfcd8('0x5')]];});}else{if(_0x4f2dee===_0xfcd8('0xf')){_0x44fb12[_0xfcd8('0x8')]=_['map'](_0x2bcbf0,function(_0x2ec87e){return{'id':_0x2ec87e[_0xfcd8('0x10')],'type':_0x2ec87e['type']};});}else{_0x44fb12[_0xfcd8('0x8')]=_[_0xfcd8('0xb')](_0x2bcbf0,function(_0x3ca507){return _0x3ca507['resourceId'];});}}_0x2c87bf(_0x44fb12);})['catch'](function(_0x529efd){_0x514d92(_0x529efd);});});}function _0x5abede(_0x401a07,_0x30eaf3){var _0x240afc={'parentSections':[]};switch(_0x401a07['toLowerCase']()){case _0xfcd8('0x11'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x13');break;case _0xfcd8('0x14'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x15');break;case _0xfcd8('0x16'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x17');_0x240afc[_0xfcd8('0x18')]=[{'name':_0xfcd8('0x19'),'field':_0xfcd8('0x1a'),'foreignKey':_0xfcd8('0x1b')}];break;case _0xfcd8('0x1c'):_0x240afc['childModel']=_0xfcd8('0x1d');break;case _0xfcd8('0x1e'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x1f');_0x240afc[_0xfcd8('0x18')]=[{'name':_0xfcd8('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0xfcd8('0x21'):_0x240afc['childModel']='CmList';break;case _0xfcd8('0x22'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x23');break;case _0xfcd8('0x24'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x25');break;case _0xfcd8('0x26'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x27');break;case _0xfcd8('0x28'):_0x240afc[_0xfcd8('0x12')]='ChatWebsite';break;case'faxqueues':_0x240afc[_0xfcd8('0x12')]='FaxQueue';break;case'faxaccounts':_0x240afc['childModel']=_0xfcd8('0x29');break;case _0xfcd8('0x2a'):case _0xfcd8('0x2b'):case _0xfcd8('0x2c'):_0x240afc['childModel']='VoiceExtension';break;case _0xfcd8('0x2d'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x2e');break;case _0xfcd8('0x2f'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x30');break;case _0xfcd8('0x31'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x32');_0x240afc[_0xfcd8('0x18')]=[{'name':'Agents','field':'name','foreignKey':'membername','model':_0xfcd8('0x33'),'filter':{'field':_0xfcd8('0x34'),'value':['agent']}},{'name':'Telephones','field':_0xfcd8('0x1a'),'foreignKey':'membername','model':_0xfcd8('0x33'),'filter':{'field':_0xfcd8('0x34'),'value':[_0xfcd8('0x35')]}},{'name':_0xfcd8('0x36'),'field':_0xfcd8('0x1a'),'foreignKey':_0xfcd8('0x37'),'model':_0xfcd8('0x38'),'filter':{'field':'type','value':[_0xfcd8('0x39')]}},{'name':_0xfcd8('0x3a'),'field':_0xfcd8('0x1a'),'foreignKey':_0xfcd8('0x37'),'model':_0xfcd8('0x38'),'filter':{'field':'type','value':[_0xfcd8('0x3b')]}}];break;case'musiconholds':_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x3c');break;case'chanspies':_0x240afc['childModel']=_0xfcd8('0x3d');break;case _0xfcd8('0x3e'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x3f');break;case _0xfcd8('0x40'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x41');break;case _0xfcd8('0x42'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x43');break;case'mailaccounts':_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x44');break;case _0xfcd8('0x45'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x46');break;case _0xfcd8('0x47'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x48');break;case _0xfcd8('0x49'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x4a');break;case'smsqueues':_0x240afc['childModel']=_0xfcd8('0x4b');break;case _0xfcd8('0x4c'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x4d');break;case'whatsappqueues':_0x240afc['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x4e');break;case _0xfcd8('0x4f'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x50');break;case _0xfcd8('0x51'):case _0xfcd8('0x52'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x38');if(_0x30eaf3){_0x240afc[_0xfcd8('0x18')]=[{'name':_0xfcd8('0x36')},{'name':_0xfcd8('0x3a')}];}break;case _0xfcd8('0x53'):case _0xfcd8('0x54'):case _0xfcd8('0x55'):_0x240afc[_0xfcd8('0x12')]='User';if(_0x30eaf3){_0x240afc[_0xfcd8('0x18')]=[{'name':_0xfcd8('0x56'),'filter':{'field':_0xfcd8('0x34'),'value':[_0xfcd8('0x57'),_0xfcd8('0x58')]},'ignore':!![]},{'name':_0xfcd8('0x59')},{'name':_0xfcd8('0x5a')}];}break;case _0xfcd8('0x5b'):_0x240afc['childModel']=_0xfcd8('0x5c');break;case _0xfcd8('0x5d'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x5e');break;case _0xfcd8('0x5f'):_0x240afc[_0xfcd8('0x12')]='FreshdeskAccount';break;case _0xfcd8('0x60'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x61');break;case _0xfcd8('0x62'):_0x240afc[_0xfcd8('0x12')]='DeskAccount';break;case _0xfcd8('0x63'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x64');break;case _0xfcd8('0x65'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x33');break;case _0xfcd8('0x66'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x67');break;case _0xfcd8('0x68'):_0x240afc['childModel']=_0xfcd8('0x69');break;case _0xfcd8('0x6a'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x6b');break;case'intervals':_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x6c');break;case _0xfcd8('0x6d'):_0x240afc[_0xfcd8('0x12')]='Pause';break;case _0xfcd8('0x6e'):_0x240afc['childModel']=_0xfcd8('0x6f');break;case _0xfcd8('0x70'):_0x240afc['childModel']='Sound';break;case _0xfcd8('0x71'):_0x240afc[_0xfcd8('0x12')]='Tag';break;case'templates':_0x240afc['childModel']=_0xfcd8('0x72');break;case _0xfcd8('0x73'):_0x240afc['childModel']=_0xfcd8('0x74');break;case'trunks':_0x240afc['childModel']='Trunk';break;case _0xfcd8('0x75'):_0x240afc[_0xfcd8('0x12')]='Variable';break;case _0xfcd8('0x76'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x77');break;case _0xfcd8('0x78'):_0x240afc['childModel']=_0xfcd8('0xf');_0x240afc['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfcd8('0x79')}];break;case _0xfcd8('0x7a'):_0x240afc[_0xfcd8('0x12')]=_0xfcd8('0x7b');break;}return _0x240afc;}function _0x3faf6f(_0xc3f40a,_0x4d292b){var _0x206ec7=_0xc3f40a[_0xfcd8('0x7c')](0x0)[_0xfcd8('0x7d')]()+_0xc3f40a[_0xfcd8('0x7e')](0x1);var _0x120463={'type':_0x45e4ea[_0xfcd8('0x7f')][_0xfcd8('0x80')]['SELECT'],'raw':!![]};return new Promise(function(_0x1c717c,_0x68c174){var _0x492fb1=squel[_0xfcd8('0x81')]()[_0xfcd8('0x5')](_0xfcd8('0x82')+_0x206ec7+_0xfcd8('0x83'),'id')[_0xfcd8('0x5')]('ui.createdAt')['from'](_0xfcd8('0x84')+_0xc3f40a+_0xfcd8('0x85'),'ui')[_0xfcd8('0x86')](_0xfcd8('0x87'),_0x4d292b['id']);return _0x45e4ea[_0xfcd8('0x88')][_0xfcd8('0x89')](_0x492fb1[_0xfcd8('0x8a')](),_0x120463)['then'](function(_0x42dfb2){_0x4d292b[_0x206ec7+'OpenTabs']=_0x42dfb2;_0x1c717c(_0x42dfb2);})[_0xfcd8('0x9')](function(_0x59875d){_0x68c174(_0x59875d);});});}return _0x5b6a9d[_0xfcd8('0x8b')](_0xfcd8('0x8c'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x117e61){var _0x3d3045=require(_0xfcd8('0x8d'));var _0x491eaa={'raw':_0x117e61[_0xfcd8('0x89')][_0xfcd8('0x8e')],'where':{}};var _0x4b2331={};var _0x1edcfe={'count':0x0,'rows':[]};var _0x259f1e=_0x117e61[_0xfcd8('0x89')]['section'];var _0x5b0895=_0x117e61['query'][_0xfcd8('0x8f')]||![];var _0x2d90d8=_0x5abede(_0x259f1e,_0x5b0895);if(!_0x2d90d8[_0xfcd8('0x12')])throw new Error(_0xfcd8('0x90')+_0x259f1e+'\x27');var _0x4f0b26=[{'name':_0x259f1e}];if(!_[_0xfcd8('0x91')](_0x2d90d8[_0xfcd8('0x18')]))_0x4f0b26=_0x2d90d8['parentSections'];var _0x2c74d4=[];for(var _0xcd0a44=0x0;_0xcd0a44<_0x4f0b26[_0xfcd8('0x92')];_0xcd0a44++){_0x2c74d4[_0xfcd8('0x93')](_0x45e4ea[_0xfcd8('0x94')][_0xfcd8('0x95')]({'where':{'userProfileId':_0x117e61[_0xfcd8('0x96')]['id'],'name':_0x4f0b26[_0xcd0a44][_0xfcd8('0x1a')]},'raw':!![]}));}return Promise['all'](_0x2c74d4)[_0xfcd8('0xe')](function(_0x34d533){var _0x1f1162=_[_0xfcd8('0x4')](_0x34d533,function(_0x2da8bd){return _0x2da8bd?_0x2da8bd:undefined;});var _0x31c1a2=_[_0xfcd8('0x4')](_0x4f0b26,[_0xfcd8('0x97'),!![]]);var _0x4ac0a7=_[_0xfcd8('0x91')](_0x1f1162)&&_['isEmpty'](_0x31c1a2)?null:_[_0xfcd8('0x98')](_0x31c1a2,_0x1f1162);if(!_0x4ac0a7)return null;var _0x6736c=[];for(var _0x55ec77=0x0;_0x55ec77<_0x4ac0a7[_0xfcd8('0x92')];_0x55ec77++){var _0x57fc66=_[_0xfcd8('0x95')](_0x4f0b26,function(_0x53793a){return _0x4ac0a7[_0x55ec77]?_0x53793a[_0xfcd8('0x1a')]===_0x4ac0a7[_0x55ec77][_0xfcd8('0x1a')]:null;});if(_0x57fc66){if(_0x4ac0a7[_0x55ec77][_0xfcd8('0x97')]){_0x6736c['push'](_0x35cc37(_0x2d90d8[_0xfcd8('0x12')],_0x4ac0a7[_0x55ec77]));}else{if(!_0x4ac0a7[_0x55ec77][_0xfcd8('0x99')]){_0x6736c[_0xfcd8('0x93')](_0x50afbe(_0x57fc66,_0x4ac0a7[_0x55ec77],_0x2d90d8[_0xfcd8('0x12')]));}else{if(_0x57fc66[_0xfcd8('0xa')]){_0x6736c[_0xfcd8('0x93')](_0x28dcbb(_0x57fc66,_0x4ac0a7[_0x55ec77]));}}}}}return Promise[_0xfcd8('0x9a')](_0x6736c);})[_0xfcd8('0xe')](function(_0x24babc){var _0x2d0fd2=_0x24babc;var _0x4fca32=null;if(_0x2d0fd2){_0x4fca32=_0x2d0fd2[_0xfcd8('0x92')]===0x1?_0x2d0fd2[0x0]:null;}if(!_0x4fca32&&!_0x2d0fd2)return _0x1edcfe;var _0x21a1d9=_0x45e4ea[_0x2d90d8['childModel']][_0xfcd8('0x9b')];_0x4b2331[_0xfcd8('0xa')]=_[_0xfcd8('0x9c')](_0x21a1d9);_0x4b2331['query']=_[_0xfcd8('0x9c')](_0x117e61[_0xfcd8('0x89')]);_0x4b2331[_0xfcd8('0x9d')]=_[_0xfcd8('0x9e')](_0x4b2331[_0xfcd8('0xa')],_0x4b2331[_0xfcd8('0x89')]);_0x491eaa['attributes']=_[_0xfcd8('0x9e')](_0x4b2331[_0xfcd8('0xa')],_0x3d3045[_0xfcd8('0x9f')](_0x117e61['query'][_0xfcd8('0x9f')]));_0x491eaa[_0xfcd8('0xa0')]=_0x491eaa[_0xfcd8('0xa0')][_0xfcd8('0x92')]?_0x491eaa[_0xfcd8('0xa0')]:_0x4b2331[_0xfcd8('0xa')];if(!_0x117e61['query'][_0xfcd8('0xa1')](_0xfcd8('0xa2'))){_0x491eaa['limit']=_0x3d3045[_0xfcd8('0xa3')](_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xa3')]);_0x491eaa[_0xfcd8('0xa4')]=_0x3d3045['offset'](_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xa4')]);}_0x491eaa[_0xfcd8('0xa5')]=_0x3d3045[_0xfcd8('0xa6')](_0x117e61[_0xfcd8('0x89')]['sort']);_0x491eaa[_0xfcd8('0x86')]=_0x3d3045[_0xfcd8('0x9d')](_[_0xfcd8('0xa7')](_0x117e61[_0xfcd8('0x89')],_0x4b2331['filters']));if(_0x117e61[_0xfcd8('0x89')]['filter']){_0x491eaa['where']=_[_0xfcd8('0xa8')](_0x491eaa[_0xfcd8('0x86')],{'$or':_[_0xfcd8('0xb')](_0x21a1d9,function(_0x23f111){if(_0x23f111['type']['key']!=='VIRTUAL'){var _0x199210={};_0x199210[_0x23f111[_0xfcd8('0x5')]]={'$like':'%'+_0x117e61[_0xfcd8('0x89')]['filter']+'%'};return _0x199210;}})});}var _0x6ead00=[];var _0x4ed78d=null;var _0x453e32={};if(_0x4fca32){_0x4ed78d=_[_0xfcd8('0x95')](_0x4f0b26,['name',_0x4fca32[_0xfcd8('0x1a')]]);if(_0x4ed78d[_0xfcd8('0x5')]){_0x453e32={};if(_0x2d90d8[_0xfcd8('0x12')]===_0xfcd8('0xf')){_0x453e32[_0x4ed78d[_0xfcd8('0xa9')]]=_[_0xfcd8('0xb')](_0x4fca32['associatedResources'],'id');}else{_0x453e32[_0x4ed78d[_0xfcd8('0xa9')]]=_0x4fca32[_0xfcd8('0x8')];}_0x6ead00[_0xfcd8('0x93')](_0x453e32);}else{_0x491eaa[_0xfcd8('0x86')]['id']=_0x4fca32[_0xfcd8('0x8')];}}else{for(var _0x3d59ec=0x0;_0x3d59ec<_0x2d0fd2[_0xfcd8('0x92')];_0x3d59ec++){_0x4ed78d=_[_0xfcd8('0x95')](_0x4f0b26,[_0xfcd8('0x1a'),_0x2d0fd2[_0x3d59ec][_0xfcd8('0x1a')]]);if(_0x4ed78d[_0xfcd8('0x5')]){_0x453e32={};_0x453e32[_0x4ed78d[_0xfcd8('0xa9')]]=_0x2d0fd2[_0x3d59ec][_0xfcd8('0x8')];_0x6ead00[_0xfcd8('0x93')](_0x453e32);}else{if(!_0x491eaa[_0xfcd8('0x86')]['id'])_0x491eaa[_0xfcd8('0x86')]['id']=[];_0x2d0fd2[_0x3d59ec][_0xfcd8('0x8')][_0xfcd8('0xaa')](function(_0x3ab21c){_0x491eaa[_0xfcd8('0x86')]['id'][_0xfcd8('0x93')](_0x3ab21c);});}}}if(!_[_0xfcd8('0x91')](_0x6ead00)){_0x491eaa['where']=_['merge'](_0x491eaa['where'],{'$and':{'$or':_0x6ead00}});}_0x491eaa=_[_0xfcd8('0xa8')]({},_0x491eaa,_0x117e61[_0xfcd8('0xab')]);if(_0x4fca32&&!_0x4fca32['autoAssociation']&&_0x2d90d8[_0xfcd8('0x12')]===_0xfcd8('0xf')){if(_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xac')]){_0x491eaa['include']=[{'all':!![]}];}return _0x45e4ea[_0x2d90d8[_0xfcd8('0x12')]]['findAll'](_0x491eaa)[_0xfcd8('0xe')](function(_0x49209e){var _0x475b1d=[];_0x49209e[_0xfcd8('0xaa')](function(_0x348bd8){var _0x2a807e;switch(_0x348bd8['reportType']){case _0xfcd8('0xad'):_0x2a807e=_[_0xfcd8('0x95')](_0x4fca32['associatedResources'],function(_0x6ed6da){return _0x6ed6da['id']===_0x348bd8['reportId']&&_0x6ed6da[_0xfcd8('0xae')]===_0xfcd8('0xaf');});break;case _0xfcd8('0xb0'):_0x2a807e=_[_0xfcd8('0x95')](_0x4fca32[_0xfcd8('0x8')],function(_0x2a31fd){return _0x2a31fd['id']===_0x348bd8[_0xfcd8('0x79')]&&_0x2a31fd[_0xfcd8('0xae')]==='CustomReports';});break;}if(_0x2a807e)_0x475b1d[_0xfcd8('0x93')](_0x348bd8);});_0x1edcfe['count']=_0x475b1d[_0xfcd8('0x92')];_0x1edcfe[_0xfcd8('0xb1')]=_0x475b1d;return _0x1edcfe;});}else{if(!_[_0xfcd8('0x91')](_0x117e61[_0xfcd8('0x89')]['ids'])){_0x491eaa[_0xfcd8('0x86')]['id']=_0x491eaa[_0xfcd8('0x86')]['id']?_['intersection'](_0x491eaa[_0xfcd8('0x86')]['id'],_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xb2')]):_0x117e61[_0xfcd8('0x89')]['ids'];if(_0x117e61['query'][_0xfcd8('0xb3')]){_0x491eaa[_0xfcd8('0xa5')]=_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xb3')];}}if(_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xb4')]){_0x491eaa[_0xfcd8('0x86')]=_[_0xfcd8('0xa8')](_0x491eaa[_0xfcd8('0x86')],{'$and':_0x117e61['query'][_0xfcd8('0xb4')]});}return _0x45e4ea[_0x2d90d8[_0xfcd8('0x12')]][_0xfcd8('0xb5')]({'where':_0x491eaa[_0xfcd8('0x86')]})[_0xfcd8('0xe')](function(_0x596176){_0x1edcfe['count']=_0x596176;if(_0x117e61['query']['includeAll']){if(_0x2d90d8[_0xfcd8('0x12')]===_0xfcd8('0x1f')){_0x491eaa[_0xfcd8('0xb6')]=[{'model':_0x45e4ea[_0xfcd8('0xb7')],'as':_0xfcd8('0xb8'),'attributes':['id',_0xfcd8('0x1a'),_0xfcd8('0xb9')],'required':_0x117e61[_0xfcd8('0x89')]['tag']?!![]:![]},{'model':_0x45e4ea[_0xfcd8('0xb7')],'as':_0xfcd8('0xba'),'attributes':['id',_0xfcd8('0x1a'),_0xfcd8('0xb9')],'through':_0x117e61['query']['tag']?{'attributes':[],'where':{'TagId':_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xbb')]||undefined}}:{},'required':_0x117e61['query'][_0xfcd8('0xbb')]?!![]:![]}];}else{_0x491eaa[_0xfcd8('0xb6')]=[{'all':!![]}];}}return _0x45e4ea[_0x2d90d8[_0xfcd8('0x12')]][_0xfcd8('0x7')](_0x491eaa);})[_0xfcd8('0xe')](function(_0x2104f7){_0x1edcfe[_0xfcd8('0xb1')]=_0x2104f7;if(_0x259f1e===_0xfcd8('0x59')&&_0x117e61[_0xfcd8('0x89')][_0xfcd8('0xbc')]===_0xfcd8('0xbd')){var _0x552895=[];for(var _0x47a62e=0x0;_0x47a62e<_0x1edcfe[_0xfcd8('0xb1')][_0xfcd8('0x92')];_0x47a62e++){_0x552895[_0xfcd8('0x93')](_0x3faf6f(_0xfcd8('0xbe'),_0x1edcfe[_0xfcd8('0xb1')][_0x47a62e][_0xfcd8('0xbf')]));_0x552895[_0xfcd8('0x93')](_0x3faf6f(_0xfcd8('0xc0'),_0x1edcfe[_0xfcd8('0xb1')][_0x47a62e][_0xfcd8('0xbf')]));_0x552895[_0xfcd8('0x93')](_0x3faf6f(_0xfcd8('0xc1'),_0x1edcfe[_0xfcd8('0xb1')][_0x47a62e]['dataValues']));_0x552895['push'](_0x3faf6f('mail',_0x1edcfe[_0xfcd8('0xb1')][_0x47a62e][_0xfcd8('0xbf')]));_0x552895['push'](_0x3faf6f('openchannel',_0x1edcfe[_0xfcd8('0xb1')][_0x47a62e][_0xfcd8('0xbf')]));_0x552895[_0xfcd8('0x93')](_0x3faf6f('whatsapp',_0x1edcfe['rows'][_0x47a62e][_0xfcd8('0xbf')]));}return Promise[_0xfcd8('0x9a')](_0x552895)['then'](function(){return _0x1edcfe;});}return _0x1edcfe;});}});}}});}; \ No newline at end of file +var _0x18a8=['define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','push','all','union','find','ignore','autoAssociation','length','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','openchannel','whatsapp','lodash','squel','exports','filter','field','findAll','then','associatedResources','map','catch','value','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','odbc','childModel','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','contacts','CmContact','parentSections','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','sounds','Sound','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x18a8,0xf9));var _0x818a=function(_0xb1de2d,_0x122dcc){_0xb1de2d=_0xb1de2d-0x0;var _0x1cdfaf=_0x18a8[_0xb1de2d];return _0x1cdfaf;};'use strict';var _=require(_0x818a('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x818a('0x1'));module[_0x818a('0x2')]=function(_0x488349){var _0x5c04ed=_0x488349['models'];function _0x3f739c(_0xbddbbd,_0x5cb1d2){return new Promise(function(_0x5e147b,_0x5ecb70){if(!_0x5cb1d2)return _0x5e147b(null);var _0x2dd0d7=_0x5cb1d2[_0x818a('0x3')]?{[_0x5cb1d2[_0x818a('0x3')][_0x818a('0x4')]]:_0x5cb1d2['filter']['value']}:undefined;return _0x5c04ed[_0xbddbbd][_0x818a('0x5')]({'where':_0x2dd0d7,'raw':!![]})[_0x818a('0x6')](function(_0x39908c){_0x5cb1d2[_0x818a('0x7')]=_[_0x818a('0x8')](_0x39908c,'id');_0x5e147b(_0x5cb1d2);})[_0x818a('0x9')](function(_0x3bab91){_0x5ecb70(_0x3bab91);});});}function _0x196dbc(_0x225218,_0x1d547d){return new Promise(function(_0x59d2e2,_0x3ce799){var _0x1d2101=_0x225218[_0x818a('0x3')]?{[_0x225218[_0x818a('0x3')][_0x818a('0x4')]]:_0x225218[_0x818a('0x3')][_0x818a('0xa')]}:undefined;return _0x5c04ed[_0x225218['model']]['findAll']({'where':_0x1d2101,'raw':!![]})[_0x818a('0x6')](function(_0x103e32){_0x1d547d['associatedResources']=_[_0x818a('0x8')](_0x103e32,function(_0x1278c7){return _0x1278c7[_0x818a('0xb')];});_0x59d2e2(_0x1d547d);})[_0x818a('0x9')](function(_0x20c6b1){_0x3ce799(_0x20c6b1);});});}function _0x111b55(_0x25d3f7,_0x5755a3,_0x3ac013){if(!_0x5755a3)return Promise[_0x818a('0xc')](null);return new Promise(function(_0x5ceae3,_0x5841ab){return _0x5c04ed['UserProfileResource']['findAll']({'where':{'sectionId':_0x5755a3['id']},'raw':!![]})['then'](function(_0x5cbdc1){if(_0x25d3f7[_0x818a('0x4')]&&_0x25d3f7['field']!=='id'){_0x5755a3[_0x818a('0x7')]=_[_0x818a('0x8')](_0x5cbdc1,function(_0x2de8e6){return _0x2de8e6[_0x25d3f7[_0x818a('0x4')]];});}else{if(_0x3ac013===_0x818a('0xd')){_0x5755a3[_0x818a('0x7')]=_[_0x818a('0x8')](_0x5cbdc1,function(_0x408d2e){return{'id':_0x408d2e[_0x818a('0xe')],'type':_0x408d2e[_0x818a('0xf')]};});}else{_0x5755a3['associatedResources']=_[_0x818a('0x8')](_0x5cbdc1,function(_0x4acc63){return _0x4acc63['resourceId'];});}}_0x5ceae3(_0x5755a3);})[_0x818a('0x9')](function(_0x4c7b01){_0x5841ab(_0x4c7b01);});});}function _0x3221ec(_0x2cb9ef,_0x16d31a){var _0x4dbda6={'parentSections':[]};switch(_0x2cb9ef[_0x818a('0x10')]()){case'squareprojects':_0x4dbda6['childModel']='SquareProject';break;case _0x818a('0x11'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x13');break;case _0x818a('0x14'):_0x4dbda6[_0x818a('0x12')]='SquareRecording';_0x4dbda6['parentSections']=[{'name':_0x818a('0x15'),'field':_0x818a('0xb'),'foreignKey':_0x818a('0x16')}];break;case'projects':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x17');break;case _0x818a('0x18'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x19');_0x4dbda6[_0x818a('0x1a')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x818a('0x1b'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x1c');break;case _0x818a('0x1d'):_0x4dbda6['childModel']='CmCompany';break;case _0x818a('0x1e'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x1f');break;case _0x818a('0x20'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x21');break;case _0x818a('0x22'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x23');break;case _0x818a('0x24'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x25');break;case'faxaccounts':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x26');break;case'inboundroutes':case _0x818a('0x27'):case _0x818a('0x28'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x29');break;case _0x818a('0x2a'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x2b');break;case _0x818a('0x2c'):_0x4dbda6[_0x818a('0x12')]='VoiceMail';break;case _0x818a('0x2d'):_0x4dbda6['childModel']=_0x818a('0x2e');_0x4dbda6[_0x818a('0x1a')]=[{'name':_0x818a('0x2f'),'field':_0x818a('0xb'),'foreignKey':_0x818a('0x30'),'model':_0x818a('0x31'),'filter':{'field':_0x818a('0x32'),'value':['agent']}},{'name':_0x818a('0x33'),'field':_0x818a('0xb'),'foreignKey':_0x818a('0x30'),'model':_0x818a('0x31'),'filter':{'field':_0x818a('0x32'),'value':[_0x818a('0x34')]}},{'name':_0x818a('0x35'),'field':_0x818a('0xb'),'foreignKey':_0x818a('0x36'),'model':_0x818a('0x37'),'filter':{'field':_0x818a('0xf'),'value':[_0x818a('0x38')]}},{'name':_0x818a('0x39'),'field':_0x818a('0xb'),'foreignKey':_0x818a('0x36'),'model':_0x818a('0x37'),'filter':{'field':'type','value':[_0x818a('0x3a')]}}];break;case'musiconholds':_0x4dbda6['childModel']=_0x818a('0x3b');break;case _0x818a('0x3c'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x3d');break;case'voiceprefixes':_0x4dbda6[_0x818a('0x12')]='VoicePrefix';break;case _0x818a('0x3e'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x3f');break;case _0x818a('0x40'):_0x4dbda6['childModel']=_0x818a('0x41');break;case _0x818a('0x42'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x43');break;case _0x818a('0x44'):_0x4dbda6[_0x818a('0x12')]='MailSubstatus';break;case'openchannelqueues':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x45');break;case _0x818a('0x46'):_0x4dbda6['childModel']=_0x818a('0x47');break;case _0x818a('0x48'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x49');break;case _0x818a('0x4a'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x4b');break;case _0x818a('0x4c'):_0x4dbda6[_0x818a('0x12')]='WhatsappQueue';break;case _0x818a('0x4d'):_0x4dbda6[_0x818a('0x12')]='WhatsappAccount';break;case _0x818a('0x4e'):_0x4dbda6['childModel']=_0x818a('0x4f');break;case _0x818a('0x50'):case _0x818a('0x51'):_0x4dbda6[_0x818a('0x12')]='VoiceQueue';if(_0x16d31a){_0x4dbda6[_0x818a('0x1a')]=[{'name':_0x818a('0x35')},{'name':_0x818a('0x39')}];}break;case'users':case _0x818a('0x52'):case _0x818a('0x53'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x31');if(_0x16d31a){_0x4dbda6[_0x818a('0x1a')]=[{'name':_0x818a('0x54'),'filter':{'field':'role','value':[_0x818a('0x55'),_0x818a('0x56')]},'ignore':!![]},{'name':_0x818a('0x2f')},{'name':'Telephones'}];}break;case _0x818a('0x57'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x58');break;case _0x818a('0x59'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x5a');break;case _0x818a('0x5b'):_0x4dbda6['childModel']=_0x818a('0x5c');break;case'sugarcrmaccounts':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x5d');break;case _0x818a('0x5e'):_0x4dbda6[_0x818a('0x12')]='DeskAccount';break;case _0x818a('0x5f'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x60');break;case _0x818a('0x61'):_0x4dbda6[_0x818a('0x12')]='User';break;case'cannedanswers':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x62');break;case _0x818a('0x63'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x64');break;case _0x818a('0x65'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x66');break;case _0x818a('0x67'):_0x4dbda6[_0x818a('0x12')]='Interval';break;case'pauses':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x68');break;case _0x818a('0x69'):_0x4dbda6['childModel']=_0x818a('0x6a');break;case _0x818a('0x6b'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x6c');break;case'tags':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x6d');break;case'templates':_0x4dbda6[_0x818a('0x12')]=_0x818a('0x6e');break;case _0x818a('0x6f'):_0x4dbda6['childModel']=_0x818a('0x70');break;case _0x818a('0x71'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x72');break;case _0x818a('0x73'):_0x4dbda6[_0x818a('0x12')]=_0x818a('0x74');break;case'plugins':_0x4dbda6[_0x818a('0x12')]='Plugin';break;case'extractedreports':_0x4dbda6[_0x818a('0x12')]=_0x818a('0xd');_0x4dbda6[_0x818a('0x1a')]=[{'name':_0x818a('0x75'),'field':'id','foreignKey':_0x818a('0x76')}];break;case _0x818a('0x77'):_0x4dbda6[_0x818a('0x12')]='AnalyticMetric';break;}return _0x4dbda6;}function _0x330eb0(_0x4b446b,_0x54ae65){var _0x323454=_0x4b446b[_0x818a('0x78')](0x0)[_0x818a('0x79')]()+_0x4b446b[_0x818a('0x7a')](0x1);var _0x4333b5={'type':_0x5c04ed[_0x818a('0x7b')][_0x818a('0x7c')][_0x818a('0x7d')],'raw':!![]};return new Promise(function(_0x839b2e,_0xc472f0){var _0x3e85f7=squel[_0x818a('0x7e')]()[_0x818a('0x4')]('ui.'+_0x323454+_0x818a('0x7f'),'id')[_0x818a('0x4')](_0x818a('0x80'))[_0x818a('0x81')](_0x818a('0x82')+_0x4b446b+_0x818a('0x83'),'ui')['where'](_0x818a('0x84'),_0x54ae65['id']);return _0x5c04ed[_0x818a('0x85')][_0x818a('0x86')](_0x3e85f7[_0x818a('0x87')](),_0x4333b5)[_0x818a('0x6')](function(_0x3c0f25){_0x54ae65[_0x323454+_0x818a('0x88')]=_0x3c0f25;_0x839b2e(_0x3c0f25);})[_0x818a('0x9')](function(_0x4b1e99){_0xc472f0(_0x4b1e99);});});}return _0x488349[_0x818a('0x89')](_0x818a('0x8a'),attributes,{'tableName':_0x818a('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4311f0){var _0xd68f6c=require(_0x818a('0x8c'));var _0x329369={'raw':_0x4311f0[_0x818a('0x86')][_0x818a('0x8d')],'where':{}};var _0x292d08={};var _0x1708f4={'count':0x0,'rows':[]};var _0x51bfa7=_0x4311f0[_0x818a('0x86')][_0x818a('0x8e')];var _0x26aa1e=_0x4311f0[_0x818a('0x86')]['mergeResources']||![];var _0x10b379=_0x3221ec(_0x51bfa7,_0x26aa1e);if(!_0x10b379[_0x818a('0x12')])throw new Error(_0x818a('0x8f')+_0x51bfa7+'\x27');var _0x62ddf0=[{'name':_0x51bfa7}];if(!_[_0x818a('0x90')](_0x10b379[_0x818a('0x1a')]))_0x62ddf0=_0x10b379[_0x818a('0x1a')];var _0x365c8d=[];for(var _0x3ea833=0x0;_0x3ea833<_0x62ddf0['length'];_0x3ea833++){_0x365c8d[_0x818a('0x91')](_0x5c04ed['UserProfileSection']['find']({'where':{'userProfileId':_0x4311f0['params']['id'],'name':_0x62ddf0[_0x3ea833][_0x818a('0xb')]},'raw':!![]}));}return Promise[_0x818a('0x92')](_0x365c8d)[_0x818a('0x6')](function(_0x5f17b6){var _0x30c10b=_[_0x818a('0x3')](_0x5f17b6,function(_0x31eff2){return _0x31eff2?_0x31eff2:undefined;});var _0x48f7cc=_[_0x818a('0x3')](_0x62ddf0,['ignore',!![]]);var _0x1b04fc=_[_0x818a('0x90')](_0x30c10b)&&_[_0x818a('0x90')](_0x48f7cc)?null:_[_0x818a('0x93')](_0x48f7cc,_0x30c10b);if(!_0x1b04fc)return null;var _0x317132=[];for(var _0x2d39e1=0x0;_0x2d39e1<_0x1b04fc['length'];_0x2d39e1++){var _0x41552d=_[_0x818a('0x94')](_0x62ddf0,function(_0x285727){return _0x1b04fc[_0x2d39e1]?_0x285727[_0x818a('0xb')]===_0x1b04fc[_0x2d39e1][_0x818a('0xb')]:null;});if(_0x41552d){if(_0x1b04fc[_0x2d39e1][_0x818a('0x95')]){_0x317132[_0x818a('0x91')](_0x3f739c(_0x10b379[_0x818a('0x12')],_0x1b04fc[_0x2d39e1]));}else{if(!_0x1b04fc[_0x2d39e1][_0x818a('0x96')]){_0x317132[_0x818a('0x91')](_0x111b55(_0x41552d,_0x1b04fc[_0x2d39e1],_0x10b379[_0x818a('0x12')]));}else{if(_0x41552d['model']){_0x317132[_0x818a('0x91')](_0x196dbc(_0x41552d,_0x1b04fc[_0x2d39e1]));}}}}}return Promise['all'](_0x317132);})[_0x818a('0x6')](function(_0x2c559b){var _0x383dae=_0x2c559b;var _0x48c3ce=null;if(_0x383dae){_0x48c3ce=_0x383dae[_0x818a('0x97')]===0x1?_0x383dae[0x0]:null;}if(!_0x48c3ce&&!_0x383dae)return _0x1708f4;var _0x1dd10e=_0x5c04ed[_0x10b379['childModel']]['rawAttributes'];_0x292d08['model']=_['keys'](_0x1dd10e);_0x292d08[_0x818a('0x86')]=_[_0x818a('0x98')](_0x4311f0[_0x818a('0x86')]);_0x292d08[_0x818a('0x99')]=_[_0x818a('0x9a')](_0x292d08[_0x818a('0x9b')],_0x292d08[_0x818a('0x86')]);_0x329369[_0x818a('0x9c')]=_[_0x818a('0x9a')](_0x292d08[_0x818a('0x9b')],_0xd68f6c['fields'](_0x4311f0[_0x818a('0x86')][_0x818a('0x9d')]));_0x329369[_0x818a('0x9c')]=_0x329369[_0x818a('0x9c')][_0x818a('0x97')]?_0x329369[_0x818a('0x9c')]:_0x292d08[_0x818a('0x9b')];if(!_0x4311f0['query'][_0x818a('0x9e')](_0x818a('0x9f'))){_0x329369[_0x818a('0xa0')]=_0xd68f6c[_0x818a('0xa0')](_0x4311f0[_0x818a('0x86')][_0x818a('0xa0')]);_0x329369[_0x818a('0xa1')]=_0xd68f6c[_0x818a('0xa1')](_0x4311f0[_0x818a('0x86')]['offset']);}_0x329369[_0x818a('0xa2')]=_0xd68f6c[_0x818a('0xa3')](_0x4311f0['query'][_0x818a('0xa3')]);_0x329369[_0x818a('0xa4')]=_0xd68f6c[_0x818a('0x99')](_[_0x818a('0xa5')](_0x4311f0[_0x818a('0x86')],_0x292d08['filters']));if(_0x4311f0[_0x818a('0x86')][_0x818a('0x3')]){_0x329369[_0x818a('0xa4')]=_[_0x818a('0xa6')](_0x329369[_0x818a('0xa4')],{'$or':_['map'](_0x1dd10e,function(_0x441b1f){if(_0x441b1f[_0x818a('0xf')][_0x818a('0xa7')]!==_0x818a('0xa8')){var _0x22da60={};_0x22da60[_0x441b1f[_0x818a('0x4')]]={'$like':'%'+_0x4311f0['query'][_0x818a('0x3')]+'%'};return _0x22da60;}})});}var _0x35e222=[];var _0x182a93=null;var _0x49e901={};if(_0x48c3ce){_0x182a93=_[_0x818a('0x94')](_0x62ddf0,[_0x818a('0xb'),_0x48c3ce[_0x818a('0xb')]]);if(_0x182a93['field']){_0x49e901={};if(_0x10b379['childModel']===_0x818a('0xd')){_0x49e901[_0x182a93['foreignKey']]=_[_0x818a('0x8')](_0x48c3ce[_0x818a('0x7')],'id');}else{_0x49e901[_0x182a93[_0x818a('0xa9')]]=_0x48c3ce['associatedResources'];}_0x35e222[_0x818a('0x91')](_0x49e901);}else{_0x329369[_0x818a('0xa4')]['id']=_0x48c3ce[_0x818a('0x7')];}}else{for(var _0x219ba3=0x0;_0x219ba3<_0x383dae[_0x818a('0x97')];_0x219ba3++){_0x182a93=_['find'](_0x62ddf0,[_0x818a('0xb'),_0x383dae[_0x219ba3]['name']]);if(_0x182a93['field']){_0x49e901={};_0x49e901[_0x182a93[_0x818a('0xa9')]]=_0x383dae[_0x219ba3][_0x818a('0x7')];_0x35e222[_0x818a('0x91')](_0x49e901);}else{if(!_0x329369[_0x818a('0xa4')]['id'])_0x329369[_0x818a('0xa4')]['id']=[];_0x383dae[_0x219ba3][_0x818a('0x7')][_0x818a('0xaa')](function(_0x3c3745){_0x329369[_0x818a('0xa4')]['id']['push'](_0x3c3745);});}}}if(!_['isEmpty'](_0x35e222)){_0x329369['where']=_[_0x818a('0xa6')](_0x329369['where'],{'$and':{'$or':_0x35e222}});}_0x329369=_[_0x818a('0xa6')]({},_0x329369,_0x4311f0['options']);if(_0x48c3ce&&!_0x48c3ce['autoAssociation']&&_0x10b379[_0x818a('0x12')]===_0x818a('0xd')){if(_0x4311f0[_0x818a('0x86')][_0x818a('0xab')]){_0x329369[_0x818a('0xac')]=[{'all':!![]}];}return _0x5c04ed[_0x10b379[_0x818a('0x12')]]['findAll'](_0x329369)['then'](function(_0x97634c){var _0x4b5eff=[];_0x97634c[_0x818a('0xaa')](function(_0x3342cf){var _0x44a473;switch(_0x3342cf[_0x818a('0xad')]){case'default':_0x44a473=_[_0x818a('0x94')](_0x48c3ce[_0x818a('0x7')],function(_0x136e95){return _0x136e95['id']===_0x3342cf[_0x818a('0x76')]&&_0x136e95[_0x818a('0xf')]===_0x818a('0xae');});break;case'custom':_0x44a473=_[_0x818a('0x94')](_0x48c3ce[_0x818a('0x7')],function(_0x126501){return _0x126501['id']===_0x3342cf[_0x818a('0x76')]&&_0x126501[_0x818a('0xf')]===_0x818a('0xaf');});break;}if(_0x44a473)_0x4b5eff[_0x818a('0x91')](_0x3342cf);});_0x1708f4[_0x818a('0xb0')]=_0x4b5eff[_0x818a('0x97')];_0x1708f4[_0x818a('0xb1')]=_0x4b5eff;return _0x1708f4;});}else{if(!_[_0x818a('0x90')](_0x4311f0[_0x818a('0x86')]['ids'])){_0x329369[_0x818a('0xa4')]['id']=_0x329369['where']['id']?_[_0x818a('0x9a')](_0x329369[_0x818a('0xa4')]['id'],_0x4311f0[_0x818a('0x86')][_0x818a('0xb2')]):_0x4311f0['query'][_0x818a('0xb2')];if(_0x4311f0[_0x818a('0x86')]['customSorting']){_0x329369[_0x818a('0xa2')]=_0x4311f0['query'][_0x818a('0xb3')];}}if(_0x4311f0[_0x818a('0x86')][_0x818a('0xb4')]){_0x329369['where']=_[_0x818a('0xa6')](_0x329369[_0x818a('0xa4')],{'$and':_0x4311f0[_0x818a('0x86')][_0x818a('0xb4')]});}return _0x5c04ed[_0x10b379['childModel']][_0x818a('0xb0')]({'where':_0x329369[_0x818a('0xa4')]})[_0x818a('0x6')](function(_0x552e31){_0x1708f4[_0x818a('0xb0')]=_0x552e31;if(_0x4311f0[_0x818a('0x86')]['includeAll']){if(_0x10b379['childModel']==='CmContact'){_0x329369[_0x818a('0xac')]=[{'model':_0x5c04ed[_0x818a('0x6d')],'as':_0x818a('0xb5'),'attributes':['id','name',_0x818a('0xb6')],'required':_0x4311f0[_0x818a('0x86')][_0x818a('0xb7')]?!![]:![]},{'model':_0x5c04ed[_0x818a('0x6d')],'as':_0x818a('0xb8'),'attributes':['id',_0x818a('0xb'),_0x818a('0xb6')],'through':_0x4311f0['query']['tag']?{'attributes':[],'where':{'TagId':_0x4311f0['query'][_0x818a('0xb7')]||undefined}}:{},'required':_0x4311f0[_0x818a('0x86')][_0x818a('0xb7')]?!![]:![]}];}else{_0x329369[_0x818a('0xac')]=[{'all':!![]}];}}return _0x5c04ed[_0x10b379['childModel']][_0x818a('0x5')](_0x329369);})[_0x818a('0x6')](function(_0x1d1d24){_0x1708f4[_0x818a('0xb1')]=_0x1d1d24;if(_0x51bfa7===_0x818a('0x2f')&&_0x4311f0[_0x818a('0x86')][_0x818a('0xb9')]===_0x818a('0xba')){var _0x1b305a=[];for(var _0x5d0f41=0x0;_0x5d0f41<_0x1708f4[_0x818a('0xb1')][_0x818a('0x97')];_0x5d0f41++){_0x1b305a[_0x818a('0x91')](_0x330eb0(_0x818a('0xbb'),_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));_0x1b305a[_0x818a('0x91')](_0x330eb0(_0x818a('0xbd'),_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));_0x1b305a[_0x818a('0x91')](_0x330eb0(_0x818a('0xbe'),_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));_0x1b305a['push'](_0x330eb0('mail',_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));_0x1b305a[_0x818a('0x91')](_0x330eb0(_0x818a('0xbf'),_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));_0x1b305a[_0x818a('0x91')](_0x330eb0(_0x818a('0xc0'),_0x1708f4[_0x818a('0xb1')][_0x5d0f41][_0x818a('0xbc')]));}return Promise[_0x818a('0x92')](_0x1b305a)[_0x818a('0x6')](function(){return _0x1708f4;});}return _0x1708f4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5d71853..5a92c8d 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 _0x2678=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x1ed361,_0x379be3){var _0x593ecc=function(_0x36b61f){while(--_0x36b61f){_0x1ed361['push'](_0x1ed361['shift']());}};_0x593ecc(++_0x379be3);}(_0x2678,0x1bb));var _0x8267=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x2678[_0x1559a5];return _0x17a783;};'use strict';var _=require('lodash');var util=require(_0x8267('0x0'));var moment=require(_0x8267('0x1'));var BPromise=require(_0x8267('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8267('0x3'));var logger=require(_0x8267('0x4'))(_0x8267('0x5'));var config=require('../../config/environment');var jayson=require(_0x8267('0x6'));var client=jayson[_0x8267('0x7')][_0x8267('0x8')]({'port':0x232a});config[_0x8267('0x9')]=_[_0x8267('0xa')](config[_0x8267('0x9')],{'host':_0x8267('0xb'),'port':0x18eb});var socket=require(_0x8267('0xc'))(new Redis(config['redis']));require(_0x8267('0xd'))[_0x8267('0xe')](socket);function respondWithRpcPromise(_0x54b450,_0x331200,_0x44661a){return new BPromise(function(_0x465b3d,_0x283fc4){return client[_0x8267('0xf')](_0x54b450,_0x44661a)['then'](function(_0x320830){logger[_0x8267('0x10')](_0x8267('0x11'),_0x331200,_0x8267('0x12'));logger[_0x8267('0x13')](_0x8267('0x14'),_0x331200,_0x8267('0x12'),JSON[_0x8267('0x15')](_0x320830));if(_0x320830[_0x8267('0x16')]){if(_0x320830[_0x8267('0x16')][_0x8267('0x17')]===0x1f4){logger['error'](_0x8267('0x11'),_0x331200,_0x320830['error'][_0x8267('0x18')]);return _0x283fc4(_0x320830[_0x8267('0x16')][_0x8267('0x18')]);}logger[_0x8267('0x16')]('UserProfile,\x20%s,\x20%s',_0x331200,_0x320830[_0x8267('0x16')]['message']);return _0x465b3d(_0x320830[_0x8267('0x16')][_0x8267('0x18')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x331200,_0x8267('0x12'));_0x465b3d(_0x320830[_0x8267('0x19')][_0x8267('0x18')]);}})[_0x8267('0x1a')](function(_0x4c5b8a){logger[_0x8267('0x16')]('UserProfile,\x20%s,\x20%s',_0x331200,_0x4c5b8a);_0x283fc4(_0x4c5b8a);});});} \ No newline at end of file +var _0x15b2=['localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x141486,_0x58ed56){var _0x1b5fb9=function(_0x273fc0){while(--_0x273fc0){_0x141486['push'](_0x141486['shift']());}};_0x1b5fb9(++_0x58ed56);}(_0x15b2,0x145));var _0x215b=function(_0x55036a,_0x1e43dc){_0x55036a=_0x55036a-0x0;var _0x2ebe00=_0x15b2[_0x55036a];return _0x2ebe00;};'use strict';var _=require('lodash');var util=require(_0x215b('0x0'));var moment=require('moment');var BPromise=require(_0x215b('0x1'));var rs=require(_0x215b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x215b('0x3'))['db'];var utils=require(_0x215b('0x4'));var logger=require(_0x215b('0x5'))(_0x215b('0x6'));var config=require('../../config/environment');var jayson=require(_0x215b('0x7'));var client=jayson['client'][_0x215b('0x8')]({'port':0x232a});config[_0x215b('0x9')]=_[_0x215b('0xa')](config[_0x215b('0x9')],{'host':_0x215b('0xb'),'port':0x18eb});var socket=require(_0x215b('0xc'))(new Redis(config['redis']));require(_0x215b('0xd'))[_0x215b('0xe')](socket);function respondWithRpcPromise(_0x50ef7a,_0x2f736e,_0x44bbd9){return new BPromise(function(_0x5578e4,_0x4de4ad){return client[_0x215b('0xf')](_0x50ef7a,_0x44bbd9)['then'](function(_0x401260){logger[_0x215b('0x10')]('UserProfile,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'),JSON['stringify'](_0x401260));if(_0x401260[_0x215b('0x12')]){if(_0x401260['error'][_0x215b('0x13')]===0x1f4){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260['error']['message']);return _0x4de4ad(_0x401260['error'][_0x215b('0x15')]);}logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260[_0x215b('0x12')][_0x215b('0x15')]);return _0x5578e4(_0x401260[_0x215b('0x12')][_0x215b('0x15')]);}else{logger['info'](_0x215b('0x14'),_0x2f736e,_0x215b('0x11'));_0x5578e4(_0x401260[_0x215b('0x16')][_0x215b('0x15')]);}})[_0x215b('0x17')](function(_0x4492da){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x4492da);_0x4de4ad(_0x4492da);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3038330..10c3ac4 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 _0xbd7e=['userProfile:','remove','update','emit','removeListener','register','length'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbd7e,0x16d));var _0xebd7=function(_0x19bba9,_0x2e69e7){_0x19bba9=_0x19bba9-0x0;var _0x32dca4=_0xbd7e[_0x19bba9];return _0x32dca4;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xebd7('0x0'),_0xebd7('0x1')];function createListener(_0x1e2a34,_0x30aa27){return function(_0x547fbc){_0x30aa27[_0xebd7('0x2')](_0x1e2a34,_0x547fbc);};}function removeListener(_0x380eca,_0x248b31){return function(){UserProfileEvents[_0xebd7('0x3')](_0x380eca,_0x248b31);};}exports[_0xebd7('0x4')]=function(_0x1d0795){for(var _0x25f19e=0x0,_0xaafed4=events[_0xebd7('0x5')];_0x25f19e<_0xaafed4;_0x25f19e++){var _0x2cb058=events[_0x25f19e];var _0x2c30cb=createListener(_0xebd7('0x6')+_0x2cb058,_0x1d0795);UserProfileEvents['on'](_0x2cb058,_0x2c30cb);}}; \ No newline at end of file +var _0x5af6=['save','remove','emit','removeListener','register','length','userProfile:'];(function(_0x24f8f0,_0x292aaa){var _0x475c53=function(_0xe51aa1){while(--_0xe51aa1){_0x24f8f0['push'](_0x24f8f0['shift']());}};_0x475c53(++_0x292aaa);}(_0x5af6,0x165));var _0x65af=function(_0x2a2f09,_0x1ceb22){_0x2a2f09=_0x2a2f09-0x0;var _0x337a57=_0x5af6[_0x2a2f09];return _0x337a57;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x65af('0x0'),_0x65af('0x1'),'update'];function createListener(_0x46eba4,_0x276fd5){return function(_0x3ca986){_0x276fd5[_0x65af('0x2')](_0x46eba4,_0x3ca986);};}function removeListener(_0xd418c4,_0x423847){return function(){UserProfileEvents[_0x65af('0x3')](_0xd418c4,_0x423847);};}exports[_0x65af('0x4')]=function(_0x298fd3){for(var _0x5cc090=0x0,_0x41c8e8=events[_0x65af('0x5')];_0x5cc090<_0x41c8e8;_0x5cc090++){var _0x3a6e4e=events[_0x5cc090];var _0x2a0fd1=createListener(_0x65af('0x6')+_0x3a6e4e,_0x298fd3);UserProfileEvents['on'](_0x3a6e4e,_0x2a0fd1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9579e7a..6ce3c71 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 _0x3297=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports'];(function(_0x1bf269,_0x299d6e){var _0xfddafb=function(_0x58f9df){while(--_0x58f9df){_0x1bf269['push'](_0x1bf269['shift']());}};_0xfddafb(++_0x299d6e);}(_0x3297,0x1b5));var _0x7329=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x3297[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require(_0x7329('0x0'));var path=require('path');var timeout=require(_0x7329('0x1'));var express=require(_0x7329('0x2'));var router=express[_0x7329('0x3')]();var fs_extra=require(_0x7329('0x4'));var auth=require(_0x7329('0x5'));var interaction=require(_0x7329('0x6'));var config=require('../../config/environment');var controller=require(_0x7329('0x7'));router[_0x7329('0x8')]('/',auth[_0x7329('0x9')](),controller[_0x7329('0xa')]);router[_0x7329('0x8')](_0x7329('0xb'),auth[_0x7329('0x9')](),controller['describe']);router['get'](_0x7329('0xc'),auth[_0x7329('0x9')](),controller[_0x7329('0xd')]);router[_0x7329('0xe')]('/',auth['isAuthenticated'](),controller[_0x7329('0xf')]);router[_0x7329('0x10')](_0x7329('0xc'),auth[_0x7329('0x9')](),controller['update']);router['delete'](_0x7329('0xc'),auth[_0x7329('0x9')](),controller[_0x7329('0x11')]);module[_0x7329('0x12')]=router; \ No newline at end of file +var _0x6bf0=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4d5dbc,_0x4f99d3){var _0x3aaa90=function(_0x3eabe4){while(--_0x3eabe4){_0x4d5dbc['push'](_0x4d5dbc['shift']());}};_0x3aaa90(++_0x4f99d3);}(_0x6bf0,0x6e));var _0x06bf=function(_0x19d433,_0x4b63f8){_0x19d433=_0x19d433-0x0;var _0x18d114=_0x6bf0[_0x19d433];return _0x18d114;};'use strict';var multer=require('multer');var util=require(_0x06bf('0x0'));var path=require(_0x06bf('0x1'));var timeout=require(_0x06bf('0x2'));var express=require(_0x06bf('0x3'));var router=express[_0x06bf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06bf('0x6'));var controller=require(_0x06bf('0x7'));router[_0x06bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x06bf('0x9')]);router[_0x06bf('0x8')](_0x06bf('0xa'),auth[_0x06bf('0xb')](),controller[_0x06bf('0xc')]);router[_0x06bf('0x8')](_0x06bf('0xd'),auth[_0x06bf('0xb')](),controller[_0x06bf('0xe')]);router[_0x06bf('0xf')]('/',auth['isAuthenticated'](),controller[_0x06bf('0x10')]);router[_0x06bf('0x11')]('/:id',auth[_0x06bf('0xb')](),controller[_0x06bf('0x12')]);router[_0x06bf('0x13')]('/:id',auth[_0x06bf('0xb')](),controller[_0x06bf('0x14')]);module[_0x06bf('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3bbec22..1e27b15 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 _0xeea4=['STRING','INTEGER','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xeea4,0x125));var _0x4eea=function(_0x32f970,_0xd35123){_0x32f970=_0x32f970-0x0;var _0xb884f2=_0xeea4[_0x32f970];return _0xb884f2;};'use strict';var Sequelize=require('sequelize');module[_0x4eea('0x0')]={'name':{'type':Sequelize[_0x4eea('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4eea('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4eea('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7cdf=['exports','STRING'];(function(_0x2416b9,_0x313d5d){var _0x9eefeb=function(_0x4265bd){while(--_0x4265bd){_0x2416b9['push'](_0x2416b9['shift']());}};_0x9eefeb(++_0x313d5d);}(_0x7cdf,0xa8));var _0xf7cd=function(_0x52eef7,_0x26fc76){_0x52eef7=_0x52eef7-0x0;var _0xad592d=_0x7cdf[_0x52eef7];return _0xad592d;};'use strict';var Sequelize=require('sequelize');module[_0xf7cd('0x0')]={'name':{'type':Sequelize[_0xf7cd('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xf7cd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5760b7c..31401c8 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 _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a37,0xb4));var _0x71a3=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1a37[_0x13b02f];return _0x12e9a6;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x177540,_0xf9994a){var _0x25d115=function(_0x31a7bd){while(--_0x31a7bd){_0x177540['push'](_0x177540['shift']());}};_0x25d115(++_0xf9994a);}(_0xd117,0x182));var _0x7d11=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0xd117[_0x1a27f3];return _0x3ce222;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b5e62f5..14e702b 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 _0x74ef=['moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','api'];(function(_0x562d8f,_0x44b846){var _0x58c863=function(_0x548ad4){while(--_0x548ad4){_0x562d8f['push'](_0x562d8f['shift']());}};_0x58c863(++_0x44b846);}(_0x74ef,0x123));var _0xf74e=function(_0xc691d8,_0x69a50a){_0xc691d8=_0xc691d8-0x0;var _0x307e60=_0x74ef[_0xc691d8];return _0x307e60;};'use strict';var _=require(_0xf74e('0x0'));var util=require(_0xf74e('0x1'));var logger=require('../../config/logger')(_0xf74e('0x2'));var moment=require(_0xf74e('0x3'));var BPromise=require(_0xf74e('0x4'));var rp=require(_0xf74e('0x5'));var fs=require('fs');var path=require(_0xf74e('0x6'));var rimraf=require('rimraf');var config=require(_0xf74e('0x7'));var attributes=require(_0xf74e('0x8'));module['exports']=function(_0x22024a,_0x29bc38){return _0x22024a[_0xf74e('0x9')](_0xf74e('0xa'),attributes,{'tableName':_0xf74e('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf74e('0xc'),_0xf74e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa79b=['rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','resourceId','lodash','moment','request-promise'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0xa79b,0x72));var _0xba79=function(_0x22df1e,_0xd0b7a7){_0x22df1e=_0x22df1e-0x0;var _0x8fc232=_0xa79b[_0x22df1e];return _0x8fc232;};'use strict';var _=require(_0xba79('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xba79('0x1'));var BPromise=require('bluebird');var rp=require(_0xba79('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba79('0x3'));var config=require(_0xba79('0x4'));var attributes=require(_0xba79('0x5'));module['exports']=function(_0x35d4d8,_0x4cd094){return _0x35d4d8['define'](_0xba79('0x6'),attributes,{'tableName':_0xba79('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xba79('0x8'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a5df53f..c50a758 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 _0x4cd0=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','UserProfileResource,\x20%s,\x20%s','error'];(function(_0x199548,_0x120011){var _0x222406=function(_0x5ce94d){while(--_0x5ce94d){_0x199548['push'](_0x199548['shift']());}};_0x222406(++_0x120011);}(_0x4cd0,0x1d7));var _0x04cd=function(_0x461865,_0x36465c){_0x461865=_0x461865-0x0;var _0x2b9631=_0x4cd0[_0x461865];return _0x2b9631;};'use strict';var _=require(_0x04cd('0x0'));var util=require('util');var moment=require(_0x04cd('0x1'));var BPromise=require(_0x04cd('0x2'));var rs=require(_0x04cd('0x3'));var fs=require('fs');var Redis=require(_0x04cd('0x4'));var db=require(_0x04cd('0x5'))['db'];var utils=require(_0x04cd('0x6'));var logger=require(_0x04cd('0x7'))(_0x04cd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x04cd('0x9')][_0x04cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4357,_0x50ab10,_0x5ec912){return new BPromise(function(_0x4eaa7b,_0x3e1225){return client['request'](_0x1b4357,_0x5ec912)[_0x04cd('0xb')](function(_0x3a43ab){logger[_0x04cd('0xc')](_0x04cd('0xd'),_0x50ab10,'request\x20sent');logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x50ab10,'request\x20sent',JSON['stringify'](_0x3a43ab));if(_0x3a43ab[_0x04cd('0xe')]){if(_0x3a43ab[_0x04cd('0xe')]['code']===0x1f4){logger[_0x04cd('0xe')](_0x04cd('0xd'),_0x50ab10,_0x3a43ab[_0x04cd('0xe')][_0x04cd('0xf')]);return _0x3e1225(_0x3a43ab[_0x04cd('0xe')][_0x04cd('0xf')]);}logger['error'](_0x04cd('0xd'),_0x50ab10,_0x3a43ab[_0x04cd('0xe')]['message']);return _0x4eaa7b(_0x3a43ab['error']['message']);}else{logger[_0x04cd('0xc')](_0x04cd('0xd'),_0x50ab10,'request\x20sent');_0x4eaa7b(_0x3a43ab[_0x04cd('0x10')][_0x04cd('0xf')]);}})[_0x04cd('0x11')](function(_0x312be6){logger[_0x04cd('0xe')](_0x04cd('0xd'),_0x50ab10,_0x312be6);_0x3e1225(_0x312be6);});});} \ No newline at end of file +var _0x52ec=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x8d3749,_0x3ede82){var _0x2f1b0a=function(_0x879dd){while(--_0x879dd){_0x8d3749['push'](_0x8d3749['shift']());}};_0x2f1b0a(++_0x3ede82);}(_0x52ec,0x104));var _0xc52e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x52ec[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xc52e('0x0'));var util=require(_0xc52e('0x1'));var moment=require(_0xc52e('0x2'));var BPromise=require(_0xc52e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc52e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc52e('0x5'));var logger=require(_0xc52e('0x6'))(_0xc52e('0x7'));var config=require(_0xc52e('0x8'));var jayson=require(_0xc52e('0x9'));var client=jayson['client'][_0xc52e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a670,_0x5df493,_0x1c75eb){return new BPromise(function(_0x3339c0,_0x1c61e5){return client['request'](_0x53a670,_0x1c75eb)[_0xc52e('0xb')](function(_0x5c282d){logger[_0xc52e('0xc')](_0xc52e('0xd'),_0x5df493,_0xc52e('0xe'));logger[_0xc52e('0xf')](_0xc52e('0x10'),_0x5df493,_0xc52e('0xe'),JSON['stringify'](_0x5c282d));if(_0x5c282d[_0xc52e('0x11')]){if(_0x5c282d[_0xc52e('0x11')][_0xc52e('0x12')]===0x1f4){logger[_0xc52e('0x11')](_0xc52e('0xd'),_0x5df493,_0x5c282d['error'][_0xc52e('0x13')]);return _0x1c61e5(_0x5c282d[_0xc52e('0x11')][_0xc52e('0x13')]);}logger['error'](_0xc52e('0xd'),_0x5df493,_0x5c282d[_0xc52e('0x11')]['message']);return _0x3339c0(_0x5c282d[_0xc52e('0x11')][_0xc52e('0x13')]);}else{logger[_0xc52e('0xc')](_0xc52e('0xd'),_0x5df493,_0xc52e('0xe'));_0x3339c0(_0x5c282d[_0xc52e('0x14')][_0xc52e('0x13')]);}})[_0xc52e('0x15')](function(_0x88320f){logger['error'](_0xc52e('0xd'),_0x5df493,_0x88320f);_0x1c61e5(_0x88320f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9172512..b79a14c 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 _0x1d39=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy'];(function(_0xf28749,_0x2616e1){var _0x2927ff=function(_0x170a5d){while(--_0x170a5d){_0xf28749['push'](_0xf28749['shift']());}};_0x2927ff(++_0x2616e1);}(_0x1d39,0x17d));var _0x91d3=function(_0x4033d1,_0x27917f){_0x4033d1=_0x4033d1-0x0;var _0x1c1b7d=_0x1d39[_0x4033d1];return _0x1c1b7d;};'use strict';var multer=require(_0x91d3('0x0'));var util=require(_0x91d3('0x1'));var path=require(_0x91d3('0x2'));var timeout=require(_0x91d3('0x3'));var express=require('express');var router=express[_0x91d3('0x4')]();var fs_extra=require(_0x91d3('0x5'));var auth=require(_0x91d3('0x6'));var interaction=require(_0x91d3('0x7'));var config=require(_0x91d3('0x8'));var controller=require('./userProfileSection.controller');router[_0x91d3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91d3('0x9')](_0x91d3('0xa'),auth[_0x91d3('0xb')](),controller[_0x91d3('0xc')]);router['get'](_0x91d3('0xd'),auth[_0x91d3('0xb')](),controller[_0x91d3('0xe')]);router[_0x91d3('0xf')]('/',auth[_0x91d3('0xb')](),controller[_0x91d3('0x10')]);router[_0x91d3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x91d3('0xd'),auth[_0x91d3('0xb')](),controller[_0x91d3('0x12')]);module[_0x91d3('0x13')]=router; \ No newline at end of file +var _0x474d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x18f2b2,_0x5509ff){var _0x432aeb=function(_0xbe94b6){while(--_0xbe94b6){_0x18f2b2['push'](_0x18f2b2['shift']());}};_0x432aeb(++_0x5509ff);}(_0x474d,0x1a1));var _0xd474=function(_0x59e7af,_0x10de5a){_0x59e7af=_0x59e7af-0x0;var _0x126a33=_0x474d[_0x59e7af];return _0x126a33;};'use strict';var multer=require(_0xd474('0x0'));var util=require(_0xd474('0x1'));var path=require(_0xd474('0x2'));var timeout=require(_0xd474('0x3'));var express=require(_0xd474('0x4'));var router=express[_0xd474('0x5')]();var fs_extra=require(_0xd474('0x6'));var auth=require(_0xd474('0x7'));var interaction=require(_0xd474('0x8'));var config=require(_0xd474('0x9'));var controller=require(_0xd474('0xa'));router[_0xd474('0xb')]('/',auth[_0xd474('0xc')](),controller['index']);router[_0xd474('0xb')](_0xd474('0xd'),auth[_0xd474('0xc')](),controller['describe']);router[_0xd474('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd474('0xe')]('/',auth[_0xd474('0xc')](),controller[_0xd474('0xf')]);router[_0xd474('0x10')]('/:id',auth[_0xd474('0xc')](),controller['update']);router[_0xd474('0x11')](_0xd474('0x12'),auth[_0xd474('0xc')](),controller[_0xd474('0x13')]);module[_0xd474('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f618d99..5fa8550 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 _0xed3c=['join','getDataValue','sequelize','exports','STRING','BOOLEAN','crudPermissions'];(function(_0x285dd6,_0x453154){var _0x128e84=function(_0x449c40){while(--_0x449c40){_0x285dd6['push'](_0x285dd6['shift']());}};_0x128e84(++_0x453154);}(_0xed3c,0x1a6));var _0xced3=function(_0x4230f4,_0x38625b){_0x4230f4=_0x4230f4-0x0;var _0x4a12ac=_0xed3c[_0x4230f4];return _0x4a12ac;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xced3('0x2')],'set':function(_0x5f03e0){this['setDataValue'](_0xced3('0x4'),_0x5f03e0?_0x5f03e0[_0xced3('0x5')](''):[]);},'get':function(){return this[_0xced3('0x6')](_0xced3('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x282b=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0xb91f02,_0x536bd1){var _0x3ebb99=function(_0x39f303){while(--_0x39f303){_0xb91f02['push'](_0xb91f02['shift']());}};_0x3ebb99(++_0x536bd1);}(_0x282b,0xec));var _0xb282=function(_0xec634d,_0x7e19f9){_0xec634d=_0xec634d-0x0;var _0x136c30=_0x282b[_0xec634d];return _0x136c30;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'name':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb282('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb282('0x2')],'set':function(_0x5cadd7){this[_0xb282('0x4')](_0xb282('0x5'),_0x5cadd7?_0x5cadd7[_0xb282('0x6')](''):[]);},'get':function(){return this[_0xb282('0x7')](_0xb282('0x5'))?this[_0xb282('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 329aaf9..aef63d5 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 _0x9aaf=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash'];(function(_0x4471e0,_0x57f0a4){var _0x56a1cf=function(_0x3f551a){while(--_0x3f551a){_0x4471e0['push'](_0x4471e0['shift']());}};_0x56a1cf(++_0x57f0a4);}(_0x9aaf,0x11f));var _0xf9aa=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x9aaf[_0x42bb6d];return _0x1db89b;};'use strict';var emlformat=require(_0xf9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9aa('0x2'));var moment=require(_0xf9aa('0x3'));var BPromise=require(_0xf9aa('0x4'));var Mustache=require(_0xf9aa('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf9aa('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf9aa('0x7'));var _=require(_0xf9aa('0x8'));var squel=require(_0xf9aa('0x9'));var crypto=require(_0xf9aa('0xa'));var jsforce=require(_0xf9aa('0xb'));var deskjs=require(_0xf9aa('0xc'));var toCsv=require(_0xf9aa('0x6'));var querystring=require(_0xf9aa('0xd'));var Papa=require(_0xf9aa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf9aa('0xf'));var as=require(_0xf9aa('0x10'));var hardwareService=require(_0xf9aa('0x11'));var logger=require(_0xf9aa('0x12'))(_0xf9aa('0x13'));var utils=require(_0xf9aa('0x14'));var config=require(_0xf9aa('0x15'));var licenseUtil=require(_0xf9aa('0x16'));var db=require(_0xf9aa('0x17'))['db'];function respondWithStatusCode(_0x9aead6,_0xe9802a){_0xe9802a=_0xe9802a||0xcc;return function(_0x2ba61a){if(_0x2ba61a){return _0x9aead6[_0xf9aa('0x18')](_0xe9802a);}return _0x9aead6[_0xf9aa('0x19')](_0xe9802a)[_0xf9aa('0x1a')]();};}function respondWithResult(_0x3f031b,_0x76c08f){_0x76c08f=_0x76c08f||0xc8;return function(_0x52c62f){if(_0x52c62f){return _0x3f031b['status'](_0x76c08f)['json'](_0x52c62f);}};}function respondWithFilteredResult(_0x379925,_0x4c2d0a){return function(_0x3f583a){if(_0x3f583a){var _0x5d8f3b=typeof _0x4c2d0a[_0xf9aa('0x1b')]===_0xf9aa('0x1c')&&typeof _0x4c2d0a[_0xf9aa('0x1d')]===_0xf9aa('0x1c');var _0x67f356=_0x3f583a[_0xf9aa('0x1e')];var _0x543ca7=_0x5d8f3b?0x0:_0x4c2d0a[_0xf9aa('0x1b')];var _0x20a08d=_0x5d8f3b?_0x3f583a[_0xf9aa('0x1e')]:_0x4c2d0a['offset']+_0x4c2d0a[_0xf9aa('0x1d')];var _0x2dd281;if(_0x20a08d>=_0x67f356){_0x20a08d=_0x67f356;_0x2dd281=0xc8;}else{_0x2dd281=0xce;}_0x379925[_0xf9aa('0x19')](_0x2dd281);return _0x379925[_0xf9aa('0x1f')](_0xf9aa('0x20'),_0x543ca7+'-'+_0x20a08d+'/'+_0x67f356)[_0xf9aa('0x21')](_0x3f583a);}return null;};}function patchUpdates(_0x39465b){return function(_0x2d4f80){try{jsonpatch[_0xf9aa('0x22')](_0x2d4f80,_0x39465b,!![]);}catch(_0x44726a){return BPromise[_0xf9aa('0x23')](_0x44726a);}return _0x2d4f80['save']();};}function saveUpdates(_0x179489,_0x288e09){return function(_0x4a1edc){if(_0x4a1edc){return _0x4a1edc[_0xf9aa('0x24')](_0x179489)[_0xf9aa('0x25')](function(_0x103798){return _0x103798;});}return null;};}function removeEntity(_0x22a7c9,_0x26a0a3){return function(_0x2e167a){if(_0x2e167a){return _0x2e167a[_0xf9aa('0x26')]()[_0xf9aa('0x25')](function(){_0x22a7c9[_0xf9aa('0x19')](0xcc)[_0xf9aa('0x1a')]();});}};}function handleEntityNotFound(_0x10c58,_0x47dc48){return function(_0x431211){if(!_0x431211){_0x10c58['sendStatus'](0x194);}return _0x431211;};}function handleError(_0x361440,_0x31c74b){_0x31c74b=_0x31c74b||0x1f4;return function(_0x17c2a0){logger['error'](_0x17c2a0[_0xf9aa('0x27')]);if(_0x17c2a0['name']){delete _0x17c2a0[_0xf9aa('0x28')];}_0x361440[_0xf9aa('0x19')](_0x31c74b)[_0xf9aa('0x29')](_0x17c2a0);};}exports[_0xf9aa('0x2a')]=function(_0x39f049,_0x1c9a1a){var _0xa4a987={},_0x591b1c={},_0x18970b={'count':0x0,'rows':[]};var _0x22991f=_[_0xf9aa('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x42f674){return{'name':_0x42f674[_0xf9aa('0x2c')],'type':_0x42f674['type']['key']};});_0x591b1c[_0xf9aa('0x2d')]=_[_0xf9aa('0x2b')](_0x22991f,_0xf9aa('0x28'));_0x591b1c[_0xf9aa('0x2e')]=_[_0xf9aa('0x2f')](_0x39f049[_0xf9aa('0x2e')]);_0x591b1c[_0xf9aa('0x30')]=_['intersection'](_0x591b1c[_0xf9aa('0x2d')],_0x591b1c[_0xf9aa('0x2e')]);_0xa4a987[_0xf9aa('0x31')]=_['intersection'](_0x591b1c['model'],qs[_0xf9aa('0x32')](_0x39f049[_0xf9aa('0x2e')][_0xf9aa('0x32')]));_0xa4a987[_0xf9aa('0x31')]=_0xa4a987[_0xf9aa('0x31')][_0xf9aa('0x33')]?_0xa4a987[_0xf9aa('0x31')]:_0x591b1c[_0xf9aa('0x2d')];if(!_0x39f049[_0xf9aa('0x2e')][_0xf9aa('0x34')]('nolimit')){_0xa4a987[_0xf9aa('0x1d')]=qs['limit'](_0x39f049[_0xf9aa('0x2e')][_0xf9aa('0x1d')]);_0xa4a987[_0xf9aa('0x1b')]=qs['offset'](_0x39f049['query'][_0xf9aa('0x1b')]);}_0xa4a987[_0xf9aa('0x35')]=qs[_0xf9aa('0x36')](_0x39f049[_0xf9aa('0x2e')]['sort']);_0xa4a987[_0xf9aa('0x37')]=qs['filters'](_[_0xf9aa('0x38')](_0x39f049['query'],_0x591b1c[_0xf9aa('0x30')]),_0x22991f);if(_0x39f049[_0xf9aa('0x2e')]['filter']){_0xa4a987[_0xf9aa('0x37')]=_[_0xf9aa('0x39')](_0xa4a987[_0xf9aa('0x37')],{'$or':_[_0xf9aa('0x2b')](_0x22991f,function(_0x4ae93f){if(_0x4ae93f[_0xf9aa('0x3a')]!==_0xf9aa('0x3b')){var _0x35b68a={};_0x35b68a[_0x4ae93f['name']]={'$like':'%'+_0x39f049['query']['filter']+'%'};return _0x35b68a;}})});}_0xa4a987=_[_0xf9aa('0x39')]({},_0xa4a987,_0x39f049[_0xf9aa('0x3c')]);var _0x2deac7={'where':_0xa4a987[_0xf9aa('0x37')]};return db[_0xf9aa('0x3d')][_0xf9aa('0x1e')](_0x2deac7)[_0xf9aa('0x25')](function(_0x441237){_0x18970b['count']=_0x441237;if(_0x39f049[_0xf9aa('0x2e')][_0xf9aa('0x3e')]){_0xa4a987[_0xf9aa('0x3f')]=[{'all':!![]}];}return db[_0xf9aa('0x3d')][_0xf9aa('0x40')](_0xa4a987);})[_0xf9aa('0x25')](function(_0x4d07f9){_0x18970b[_0xf9aa('0x41')]=_0x4d07f9;return _0x18970b;})[_0xf9aa('0x25')](respondWithFilteredResult(_0x1c9a1a,_0xa4a987))[_0xf9aa('0x42')](handleError(_0x1c9a1a,null));};exports[_0xf9aa('0x43')]=function(_0x522845,_0x36f603){var _0x1a1a4c={'raw':![],'where':{'id':_0x522845[_0xf9aa('0x44')]['id']}},_0x4bcc76={};_0x4bcc76[_0xf9aa('0x2d')]=_[_0xf9aa('0x2f')](db[_0xf9aa('0x3d')][_0xf9aa('0x45')]);_0x4bcc76[_0xf9aa('0x2e')]=_[_0xf9aa('0x2f')](_0x522845[_0xf9aa('0x2e')]);_0x4bcc76[_0xf9aa('0x30')]=_['intersection'](_0x4bcc76['model'],_0x4bcc76[_0xf9aa('0x2e')]);_0x1a1a4c[_0xf9aa('0x31')]=_[_0xf9aa('0x46')](_0x4bcc76[_0xf9aa('0x2d')],qs[_0xf9aa('0x32')](_0x522845[_0xf9aa('0x2e')][_0xf9aa('0x32')]));_0x1a1a4c[_0xf9aa('0x31')]=_0x1a1a4c[_0xf9aa('0x31')][_0xf9aa('0x33')]?_0x1a1a4c[_0xf9aa('0x31')]:_0x4bcc76[_0xf9aa('0x2d')];if(_0x522845[_0xf9aa('0x2e')][_0xf9aa('0x3e')]){_0x1a1a4c[_0xf9aa('0x3f')]=[{'all':!![]}];}_0x1a1a4c=_['merge']({},_0x1a1a4c,_0x522845[_0xf9aa('0x3c')]);return db[_0xf9aa('0x3d')][_0xf9aa('0x47')](_0x1a1a4c)[_0xf9aa('0x25')](handleEntityNotFound(_0x36f603,null))['then'](respondWithResult(_0x36f603,null))[_0xf9aa('0x42')](handleError(_0x36f603,null));};exports['create']=function(_0x136b51,_0x5e2960){return db[_0xf9aa('0x3d')]['create'](_0x136b51[_0xf9aa('0x48')],{})['then'](respondWithResult(_0x5e2960,0xc9))['catch'](handleError(_0x5e2960,null));};exports[_0xf9aa('0x24')]=function(_0x31cf54,_0xcb175f){if(_0x31cf54['body']['id']){delete _0x31cf54[_0xf9aa('0x48')]['id'];}return db[_0xf9aa('0x3d')][_0xf9aa('0x47')]({'where':{'id':_0x31cf54['params']['id']}})[_0xf9aa('0x25')](handleEntityNotFound(_0xcb175f,null))[_0xf9aa('0x25')](saveUpdates(_0x31cf54['body'],null))[_0xf9aa('0x25')](respondWithResult(_0xcb175f,null))['catch'](handleError(_0xcb175f,null));};exports['destroy']=function(_0x2175e9,_0x22c17d){return db[_0xf9aa('0x3d')][_0xf9aa('0x47')]({'where':{'id':_0x2175e9[_0xf9aa('0x44')]['id']}})[_0xf9aa('0x25')](handleEntityNotFound(_0x22c17d,null))[_0xf9aa('0x25')](removeEntity(_0x22c17d,null))[_0xf9aa('0x42')](handleError(_0x22c17d,null));};exports['describe']=function(_0x14a28b,_0x33456f){return db[_0xf9aa('0x3d')][_0xf9aa('0x49')]()[_0xf9aa('0x25')](respondWithResult(_0x33456f,null))[_0xf9aa('0x42')](handleError(_0x33456f,null));}; \ No newline at end of file +var _0xa700=['then','destroy','sendStatus','name','send','UserProfileSection','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','show','params','keys','includeAll','include','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update'];(function(_0x5374f5,_0x485d1c){var _0x31d14e=function(_0xdddfe8){while(--_0xdddfe8){_0x5374f5['push'](_0x5374f5['shift']());}};_0x31d14e(++_0x485d1c);}(_0xa700,0xad));var _0x0a70=function(_0x12de23,_0x15cdf8){_0x12de23=_0x12de23-0x0;var _0x5e8507=_0xa700[_0x12de23];return _0x5e8507;};'use strict';var emlformat=require(_0x0a70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a70('0x1'));var jsonpatch=require(_0x0a70('0x2'));var rp=require(_0x0a70('0x3'));var moment=require(_0x0a70('0x4'));var BPromise=require(_0x0a70('0x5'));var Mustache=require(_0x0a70('0x6'));var util=require(_0x0a70('0x7'));var path=require('path');var sox=require(_0x0a70('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a70('0x9'));var _=require(_0x0a70('0xa'));var squel=require(_0x0a70('0xb'));var crypto=require(_0x0a70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0a70('0xd'));var toCsv=require(_0x0a70('0xe'));var querystring=require(_0x0a70('0xf'));var Papa=require(_0x0a70('0x10'));var Redis=require(_0x0a70('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a70('0x12'));var hardwareService=require(_0x0a70('0x13'));var logger=require(_0x0a70('0x14'))('api');var utils=require(_0x0a70('0x15'));var config=require(_0x0a70('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x171625,_0xd74660){_0xd74660=_0xd74660||0xcc;return function(_0x550ca8){if(_0x550ca8){return _0x171625['sendStatus'](_0xd74660);}return _0x171625[_0x0a70('0x17')](_0xd74660)[_0x0a70('0x18')]();};}function respondWithResult(_0x597a05,_0x29f83d){_0x29f83d=_0x29f83d||0xc8;return function(_0xa56b1a){if(_0xa56b1a){return _0x597a05['status'](_0x29f83d)['json'](_0xa56b1a);}};}function respondWithFilteredResult(_0x49e76f,_0x2ff078){return function(_0x297a75){if(_0x297a75){var _0xef209b=typeof _0x2ff078[_0x0a70('0x19')]===_0x0a70('0x1a')&&typeof _0x2ff078[_0x0a70('0x1b')]===_0x0a70('0x1a');var _0x495b9f=_0x297a75[_0x0a70('0x1c')];var _0x1186ad=_0xef209b?0x0:_0x2ff078[_0x0a70('0x19')];var _0x87fb26=_0xef209b?_0x297a75[_0x0a70('0x1c')]:_0x2ff078[_0x0a70('0x19')]+_0x2ff078[_0x0a70('0x1b')];var _0x2bc5bf;if(_0x87fb26>=_0x495b9f){_0x87fb26=_0x495b9f;_0x2bc5bf=0xc8;}else{_0x2bc5bf=0xce;}_0x49e76f['status'](_0x2bc5bf);return _0x49e76f[_0x0a70('0x1d')](_0x0a70('0x1e'),_0x1186ad+'-'+_0x87fb26+'/'+_0x495b9f)[_0x0a70('0x1f')](_0x297a75);}return null;};}function patchUpdates(_0x211c66){return function(_0x420238){try{jsonpatch['apply'](_0x420238,_0x211c66,!![]);}catch(_0x3b9527){return BPromise['reject'](_0x3b9527);}return _0x420238[_0x0a70('0x20')]();};}function saveUpdates(_0x2d5236,_0x4b4fb3){return function(_0x73fa69){if(_0x73fa69){return _0x73fa69[_0x0a70('0x21')](_0x2d5236)[_0x0a70('0x22')](function(_0x45cd44){return _0x45cd44;});}return null;};}function removeEntity(_0x1475c2,_0xdb5cf1){return function(_0x45dc62){if(_0x45dc62){return _0x45dc62[_0x0a70('0x23')]()[_0x0a70('0x22')](function(){_0x1475c2[_0x0a70('0x17')](0xcc)[_0x0a70('0x18')]();});}};}function handleEntityNotFound(_0x528ecf,_0x5793c0){return function(_0x137530){if(!_0x137530){_0x528ecf[_0x0a70('0x24')](0x194);}return _0x137530;};}function handleError(_0x5e0e3b,_0xa028d9){_0xa028d9=_0xa028d9||0x1f4;return function(_0x21c4ef){logger['error'](_0x21c4ef['stack']);if(_0x21c4ef[_0x0a70('0x25')]){delete _0x21c4ef['name'];}_0x5e0e3b['status'](_0xa028d9)[_0x0a70('0x26')](_0x21c4ef);};}exports['index']=function(_0x3047da,_0x1d299b){var _0x31eaa7={},_0x4aad7a={},_0x41742c={'count':0x0,'rows':[]};var _0x3c14df=_['map'](db[_0x0a70('0x27')][_0x0a70('0x28')],function(_0x34126f){return{'name':_0x34126f[_0x0a70('0x29')],'type':_0x34126f[_0x0a70('0x2a')][_0x0a70('0x2b')]};});_0x4aad7a[_0x0a70('0x2c')]=_[_0x0a70('0x2d')](_0x3c14df,_0x0a70('0x25'));_0x4aad7a[_0x0a70('0x2e')]=_['keys'](_0x3047da[_0x0a70('0x2e')]);_0x4aad7a[_0x0a70('0x2f')]=_[_0x0a70('0x30')](_0x4aad7a[_0x0a70('0x2c')],_0x4aad7a[_0x0a70('0x2e')]);_0x31eaa7[_0x0a70('0x31')]=_[_0x0a70('0x30')](_0x4aad7a[_0x0a70('0x2c')],qs[_0x0a70('0x32')](_0x3047da[_0x0a70('0x2e')][_0x0a70('0x32')]));_0x31eaa7[_0x0a70('0x31')]=_0x31eaa7[_0x0a70('0x31')][_0x0a70('0x33')]?_0x31eaa7[_0x0a70('0x31')]:_0x4aad7a['model'];if(!_0x3047da['query']['hasOwnProperty'](_0x0a70('0x34'))){_0x31eaa7[_0x0a70('0x1b')]=qs[_0x0a70('0x1b')](_0x3047da[_0x0a70('0x2e')][_0x0a70('0x1b')]);_0x31eaa7[_0x0a70('0x19')]=qs[_0x0a70('0x19')](_0x3047da['query'][_0x0a70('0x19')]);}_0x31eaa7['order']=qs[_0x0a70('0x35')](_0x3047da[_0x0a70('0x2e')]['sort']);_0x31eaa7['where']=qs[_0x0a70('0x2f')](_[_0x0a70('0x36')](_0x3047da['query'],_0x4aad7a[_0x0a70('0x2f')]),_0x3c14df);if(_0x3047da[_0x0a70('0x2e')][_0x0a70('0x37')]){_0x31eaa7[_0x0a70('0x38')]=_[_0x0a70('0x39')](_0x31eaa7[_0x0a70('0x38')],{'$or':_[_0x0a70('0x2d')](_0x3c14df,function(_0x2d6bbc){if(_0x2d6bbc[_0x0a70('0x2a')]!==_0x0a70('0x3a')){var _0x181ac6={};_0x181ac6[_0x2d6bbc[_0x0a70('0x25')]]={'$like':'%'+_0x3047da['query']['filter']+'%'};return _0x181ac6;}})});}_0x31eaa7=_[_0x0a70('0x39')]({},_0x31eaa7,_0x3047da['options']);var _0x3b66ab={'where':_0x31eaa7[_0x0a70('0x38')]};return db[_0x0a70('0x27')][_0x0a70('0x1c')](_0x3b66ab)[_0x0a70('0x22')](function(_0x1ef912){_0x41742c[_0x0a70('0x1c')]=_0x1ef912;if(_0x3047da['query']['includeAll']){_0x31eaa7['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x31eaa7);})[_0x0a70('0x22')](function(_0x20c59b){_0x41742c['rows']=_0x20c59b;return _0x41742c;})[_0x0a70('0x22')](respondWithFilteredResult(_0x1d299b,_0x31eaa7))['catch'](handleError(_0x1d299b,null));};exports[_0x0a70('0x3b')]=function(_0xe9b9f8,_0x3a64d8){var _0x1bee5e={'raw':![],'where':{'id':_0xe9b9f8[_0x0a70('0x3c')]['id']}},_0x5b4d94={};_0x5b4d94[_0x0a70('0x2c')]=_[_0x0a70('0x3d')](db[_0x0a70('0x27')][_0x0a70('0x28')]);_0x5b4d94[_0x0a70('0x2e')]=_[_0x0a70('0x3d')](_0xe9b9f8[_0x0a70('0x2e')]);_0x5b4d94[_0x0a70('0x2f')]=_[_0x0a70('0x30')](_0x5b4d94[_0x0a70('0x2c')],_0x5b4d94[_0x0a70('0x2e')]);_0x1bee5e[_0x0a70('0x31')]=_[_0x0a70('0x30')](_0x5b4d94[_0x0a70('0x2c')],qs['fields'](_0xe9b9f8['query'][_0x0a70('0x32')]));_0x1bee5e[_0x0a70('0x31')]=_0x1bee5e[_0x0a70('0x31')][_0x0a70('0x33')]?_0x1bee5e[_0x0a70('0x31')]:_0x5b4d94[_0x0a70('0x2c')];if(_0xe9b9f8['query'][_0x0a70('0x3e')]){_0x1bee5e[_0x0a70('0x3f')]=[{'all':!![]}];}_0x1bee5e=_[_0x0a70('0x39')]({},_0x1bee5e,_0xe9b9f8['options']);return db[_0x0a70('0x27')][_0x0a70('0x40')](_0x1bee5e)['then'](handleEntityNotFound(_0x3a64d8,null))[_0x0a70('0x22')](respondWithResult(_0x3a64d8,null))['catch'](handleError(_0x3a64d8,null));};exports[_0x0a70('0x41')]=function(_0xc4e8a0,_0x1966b0){return db['UserProfileSection'][_0x0a70('0x41')](_0xc4e8a0[_0x0a70('0x42')],{})[_0x0a70('0x22')](respondWithResult(_0x1966b0,0xc9))[_0x0a70('0x43')](handleError(_0x1966b0,null));};exports[_0x0a70('0x21')]=function(_0x3673ee,_0x1e2d92){if(_0x3673ee[_0x0a70('0x42')]['id']){delete _0x3673ee[_0x0a70('0x42')]['id'];}return db[_0x0a70('0x27')]['find']({'where':{'id':_0x3673ee[_0x0a70('0x3c')]['id']}})[_0x0a70('0x22')](handleEntityNotFound(_0x1e2d92,null))['then'](saveUpdates(_0x3673ee[_0x0a70('0x42')],null))[_0x0a70('0x22')](respondWithResult(_0x1e2d92,null))[_0x0a70('0x43')](handleError(_0x1e2d92,null));};exports[_0x0a70('0x23')]=function(_0x429528,_0x3b6996){return db[_0x0a70('0x27')][_0x0a70('0x40')]({'where':{'id':_0x429528[_0x0a70('0x3c')]['id']}})[_0x0a70('0x22')](handleEntityNotFound(_0x3b6996,null))[_0x0a70('0x22')](removeEntity(_0x3b6996,null))[_0x0a70('0x43')](handleError(_0x3b6996,null));};exports['describe']=function(_0x119e98,_0x174d04){return db[_0x0a70('0x27')][_0x0a70('0x44')]()[_0x0a70('0x22')](respondWithResult(_0x174d04,null))[_0x0a70('0x43')](handleError(_0x174d04,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bbbcd54..aeeb740 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 _0x2d80=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xeab168,_0x30d561){var _0xbbf818=function(_0x40ed65){while(--_0x40ed65){_0xeab168['push'](_0xeab168['shift']());}};_0xbbf818(++_0x30d561);}(_0x2d80,0xac));var _0x02d8=function(_0xf7dd0f,_0x396c3b){_0xf7dd0f=_0xf7dd0f-0x0;var _0x3fc64b=_0x2d80[_0xf7dd0f];return _0x3fc64b;};'use strict';var _=require(_0x02d8('0x0'));var util=require(_0x02d8('0x1'));var logger=require(_0x02d8('0x2'))(_0x02d8('0x3'));var moment=require('moment');var BPromise=require(_0x02d8('0x4'));var rp=require(_0x02d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02d8('0x6'));var config=require(_0x02d8('0x7'));var attributes=require(_0x02d8('0x8'));module[_0x02d8('0x9')]=function(_0x4e4855,_0x3fd634){return _0x4e4855[_0x02d8('0xa')](_0x02d8('0xb'),attributes,{'tableName':_0x02d8('0xc'),'paranoid':![],'indexes':[{'name':_0x02d8('0xd'),'fields':['sectionId',_0x02d8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90d0=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','sectionId','userProfileId','../../config/logger','api'];(function(_0xd14d15,_0x4f0e99){var _0x19f7ed=function(_0x29f6c2){while(--_0x29f6c2){_0xd14d15['push'](_0xd14d15['shift']());}};_0x19f7ed(++_0x4f0e99);}(_0x90d0,0x10f));var _0x090d=function(_0x23b612,_0x440ea6){_0x23b612=_0x23b612-0x0;var _0x104bcb=_0x90d0[_0x23b612];return _0x104bcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x090d('0x0'))(_0x090d('0x1'));var moment=require('moment');var BPromise=require(_0x090d('0x2'));var rp=require(_0x090d('0x3'));var fs=require('fs');var path=require(_0x090d('0x4'));var rimraf=require(_0x090d('0x5'));var config=require(_0x090d('0x6'));var attributes=require(_0x090d('0x7'));module[_0x090d('0x8')]=function(_0x343d2d,_0x28cd8f){return _0x343d2d[_0x090d('0x9')](_0x090d('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x090d('0xb'),_0x090d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index adc5ba7..eb58b34 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 _0xcfdc=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x3d3345,_0x16e522){var _0x2684b2=function(_0x4c46f){while(--_0x4c46f){_0x3d3345['push'](_0x3d3345['shift']());}};_0x2684b2(++_0x16e522);}(_0xcfdc,0x14a));var _0xccfd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcfdc[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xccfd('0x0'));var util=require(_0xccfd('0x1'));var moment=require(_0xccfd('0x2'));var BPromise=require('bluebird');var rs=require(_0xccfd('0x3'));var fs=require('fs');var Redis=require(_0xccfd('0x4'));var db=require(_0xccfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xccfd('0x6'))(_0xccfd('0x7'));var config=require(_0xccfd('0x8'));var jayson=require(_0xccfd('0x9'));var client=jayson[_0xccfd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a5f1a,_0x269fd7,_0x291e66){return new BPromise(function(_0x579ab0,_0x42b6fe){return client[_0xccfd('0xb')](_0x2a5f1a,_0x291e66)['then'](function(_0xed8ba3){logger[_0xccfd('0xc')](_0xccfd('0xd'),_0x269fd7,_0xccfd('0xe'));logger[_0xccfd('0xf')](_0xccfd('0x10'),_0x269fd7,_0xccfd('0xe'),JSON[_0xccfd('0x11')](_0xed8ba3));if(_0xed8ba3[_0xccfd('0x12')]){if(_0xed8ba3['error'][_0xccfd('0x13')]===0x1f4){logger[_0xccfd('0x12')](_0xccfd('0xd'),_0x269fd7,_0xed8ba3[_0xccfd('0x12')]['message']);return _0x42b6fe(_0xed8ba3[_0xccfd('0x12')][_0xccfd('0x14')]);}logger['error'](_0xccfd('0xd'),_0x269fd7,_0xed8ba3[_0xccfd('0x12')][_0xccfd('0x14')]);return _0x579ab0(_0xed8ba3['error'][_0xccfd('0x14')]);}else{logger[_0xccfd('0xc')](_0xccfd('0xd'),_0x269fd7,_0xccfd('0xe'));_0x579ab0(_0xed8ba3[_0xccfd('0x15')][_0xccfd('0x14')]);}})[_0xccfd('0x16')](function(_0x4e52ff){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x269fd7,_0x4e52ff);_0x42b6fe(_0x4e52ff);});});} \ No newline at end of file +var _0x60fd=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x557a90,_0x41dc33){var _0x216edd=function(_0x110c55){while(--_0x110c55){_0x557a90['push'](_0x557a90['shift']());}};_0x216edd(++_0x41dc33);}(_0x60fd,0xf8));var _0xd60f=function(_0x1c8827,_0x3f29d5){_0x1c8827=_0x1c8827-0x0;var _0x24a8fd=_0x60fd[_0x1c8827];return _0x24a8fd;};'use strict';var _=require('lodash');var util=require(_0xd60f('0x0'));var moment=require(_0xd60f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd60f('0x2'));var db=require(_0xd60f('0x3'))['db'];var utils=require(_0xd60f('0x4'));var logger=require(_0xd60f('0x5'))(_0xd60f('0x6'));var config=require(_0xd60f('0x7'));var jayson=require(_0xd60f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa2a23,_0x2a8e4d,_0x349250){return new BPromise(function(_0x4b43ef,_0x4e78b2){return client['request'](_0xa2a23,_0x349250)[_0xd60f('0x9')](function(_0x354dbc){logger[_0xd60f('0xa')](_0xd60f('0xb'),_0x2a8e4d,_0xd60f('0xc'));logger[_0xd60f('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2a8e4d,_0xd60f('0xc'),JSON[_0xd60f('0xe')](_0x354dbc));if(_0x354dbc[_0xd60f('0xf')]){if(_0x354dbc[_0xd60f('0xf')]['code']===0x1f4){logger[_0xd60f('0xf')](_0xd60f('0xb'),_0x2a8e4d,_0x354dbc[_0xd60f('0xf')][_0xd60f('0x10')]);return _0x4e78b2(_0x354dbc[_0xd60f('0xf')][_0xd60f('0x10')]);}logger[_0xd60f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2a8e4d,_0x354dbc['error'][_0xd60f('0x10')]);return _0x4b43ef(_0x354dbc[_0xd60f('0xf')]['message']);}else{logger[_0xd60f('0xa')](_0xd60f('0xb'),_0x2a8e4d,_0xd60f('0xc'));_0x4b43ef(_0x354dbc[_0xd60f('0x11')]['message']);}})[_0xd60f('0x12')](function(_0x1b11fe){logger[_0xd60f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2a8e4d,_0x1b11fe);_0x4e78b2(_0x1b11fe);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d26c9b5..06d7659 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(_0x4668f1,_0x397925){var _0x3a8c2d=function(_0x27a7fe){while(--_0x27a7fe){_0x4668f1['push'](_0x4668f1['shift']());}};_0x3a8c2d(++_0x397925);}(_0xe706,0xa3));var _0x6e70=function(_0x30d3c1,_0xa3da89){_0x30d3c1=_0x30d3c1-0x0;var _0x571ee9=_0xe706[_0x30d3c1];return _0x571ee9;};'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(_0x2e5d49,_0x87141a){var _0x37d530=function(_0x5c8e1d){while(--_0x5c8e1d){_0x2e5d49['push'](_0x2e5d49['shift']());}};_0x37d530(++_0x87141a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8e462b0..3d4fe78 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 _0xd5f5=['sequelize','exports'];(function(_0x4dda69,_0x2a0fe4){var _0x9014a9=function(_0x3d2b40){while(--_0x3d2b40){_0x4dda69['push'](_0x4dda69['shift']());}};_0x9014a9(++_0x2a0fe4);}(_0xd5f5,0x1ca));var _0x5d5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd5f5[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x5d5f('0x0'));module[_0x5d5f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe67e=['exports','INTEGER'];(function(_0x40f14,_0x5b2816){var _0x256321=function(_0x48bffb){while(--_0x48bffb){_0x40f14['push'](_0x40f14['shift']());}};_0x256321(++_0x5b2816);}(_0xe67e,0x142));var _0xee67=function(_0x54c889,_0x5a11e7){_0x54c889=_0x54c889-0x0;var _0x5c733c=_0xe67e[_0x54c889];return _0x5c733c;};'use strict';var Sequelize=require('sequelize');module[_0xee67('0x0')]={'penalty':{'type':Sequelize[_0xee67('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 913a78f..a0a571f 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 _0xe61c=['api','moment','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','../../config/logger'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe61c,0xee));var _0xce61=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xe61c[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var logger=require(_0xce61('0x1'))(_0xce61('0x2'));var moment=require(_0xce61('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce61('0x4'));var rimraf=require('rimraf');var config=require(_0xce61('0x5'));var attributes=require(_0xce61('0x6'));module[_0xce61('0x7')]=function(_0x200b9a,_0x239319){return _0x200b9a[_0xce61('0x8')](_0xce61('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6365=['../../config/environment','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xda9b6,_0x54ea66){var _0x14f93c=function(_0x5d02c6){while(--_0x5d02c6){_0xda9b6['push'](_0xda9b6['shift']());}};_0x14f93c(++_0x54ea66);}(_0x6365,0x148));var _0x5636=function(_0x2ab091,_0x28fb3a){_0x2ab091=_0x2ab091-0x0;var _0x5d619f=_0x6365[_0x2ab091];return _0x5d619f;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var logger=require(_0x5636('0x2'))(_0x5636('0x3'));var moment=require('moment');var BPromise=require(_0x5636('0x4'));var rp=require(_0x5636('0x5'));var fs=require('fs');var path=require(_0x5636('0x6'));var rimraf=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x5636('0x9')]=function(_0x230d78,_0x2a12df){return _0x230d78[_0x5636('0xa')]('UserSmsQueue',attributes,{'tableName':_0x5636('0xb'),'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 e0b7271..fd61f94 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 _0xe769=['stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xe769,0x149));var _0x9e76=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0xe769[_0x3c62ab];return _0x536970;};'use strict';var _=require(_0x9e76('0x0'));var util=require(_0x9e76('0x1'));var moment=require(_0x9e76('0x2'));var BPromise=require(_0x9e76('0x3'));var rs=require(_0x9e76('0x4'));var fs=require('fs');var Redis=require(_0x9e76('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e76('0x6'));var logger=require(_0x9e76('0x7'))('rpc');var config=require(_0x9e76('0x8'));var jayson=require(_0x9e76('0x9'));var client=jayson[_0x9e76('0xa')][_0x9e76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35e207,_0x47fc76,_0xa0fc14){return new BPromise(function(_0x1e9271,_0x3748b3){return client[_0x9e76('0xc')](_0x35e207,_0xa0fc14)['then'](function(_0x1d7b2a){logger[_0x9e76('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x47fc76,'request\x20sent');logger[_0x9e76('0xe')](_0x9e76('0xf'),_0x47fc76,'request\x20sent',JSON[_0x9e76('0x10')](_0x1d7b2a));if(_0x1d7b2a[_0x9e76('0x11')]){if(_0x1d7b2a[_0x9e76('0x11')][_0x9e76('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x47fc76,_0x1d7b2a[_0x9e76('0x11')][_0x9e76('0x13')]);return _0x3748b3(_0x1d7b2a[_0x9e76('0x11')]['message']);}logger[_0x9e76('0x11')](_0x9e76('0x14'),_0x47fc76,_0x1d7b2a[_0x9e76('0x11')][_0x9e76('0x13')]);return _0x1e9271(_0x1d7b2a[_0x9e76('0x11')][_0x9e76('0x13')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x47fc76,_0x9e76('0x15'));_0x1e9271(_0x1d7b2a['result'][_0x9e76('0x13')]);}})[_0x9e76('0x16')](function(_0xe6b4dc){logger[_0x9e76('0x11')](_0x9e76('0x14'),_0x47fc76,_0xe6b4dc);_0x3748b3(_0xe6b4dc);});});} \ No newline at end of file +var _0x886c=['../../config/environment','jayson/promise','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4a4ffc,_0x33ad94){var _0x5d5308=function(_0x5ed4ec){while(--_0x5ed4ec){_0x4a4ffc['push'](_0x4a4ffc['shift']());}};_0x5d5308(++_0x33ad94);}(_0x886c,0x19b));var _0xc886=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x886c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc886('0x0'));var util=require('util');var moment=require(_0xc886('0x1'));var BPromise=require(_0xc886('0x2'));var rs=require(_0xc886('0x3'));var fs=require('fs');var Redis=require(_0xc886('0x4'));var db=require(_0xc886('0x5'))['db'];var utils=require(_0xc886('0x6'));var logger=require(_0xc886('0x7'))(_0xc886('0x8'));var config=require(_0xc886('0x9'));var jayson=require(_0xc886('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c4917,_0x255968,_0x3ed2d4){return new BPromise(function(_0x401596,_0x36e7b2){return client[_0xc886('0xb')](_0x4c4917,_0x3ed2d4)['then'](function(_0x26c214){logger[_0xc886('0xc')](_0xc886('0xd'),_0x255968,_0xc886('0xe'));logger[_0xc886('0xf')](_0xc886('0x10'),_0x255968,_0xc886('0xe'),JSON[_0xc886('0x11')](_0x26c214));if(_0x26c214[_0xc886('0x12')]){if(_0x26c214[_0xc886('0x12')]['code']===0x1f4){logger[_0xc886('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x255968,_0x26c214[_0xc886('0x12')][_0xc886('0x13')]);return _0x36e7b2(_0x26c214['error'][_0xc886('0x13')]);}logger[_0xc886('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x255968,_0x26c214['error'][_0xc886('0x13')]);return _0x401596(_0x26c214[_0xc886('0x12')][_0xc886('0x13')]);}else{logger[_0xc886('0xc')](_0xc886('0xd'),_0x255968,_0xc886('0xe'));_0x401596(_0x26c214[_0xc886('0x14')][_0xc886('0x13')]);}})['catch'](function(_0x42952d){logger[_0xc886('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x255968,_0x42952d);_0x36e7b2(_0x42952d);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f24f1d0..48930ee 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 _0x79d6=['sequelize','exports','INTEGER'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x79d6,0x16e));var _0x679d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79d6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x679d('0x0'));module[_0x679d('0x1')]={'UserId':{'type':Sequelize[_0x679d('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4638=['INTEGER'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4638,0x1b6));var _0x8463=function(_0x410f06,_0x3f7a14){_0x410f06=_0x410f06-0x0;var _0x31e4d0=_0x4638[_0x410f06];return _0x31e4d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x8463('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0c99fb9..1007997 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(_0x2204f6,_0x45307b){var _0x41ea7e=function(_0x1ded99){while(--_0x1ded99){_0x2204f6['push'](_0x2204f6['shift']());}};_0x41ea7e(++_0x45307b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x2f7e23,_0x4057b4){var _0x171fab=function(_0x21805a){while(--_0x21805a){_0x2f7e23['push'](_0x2f7e23['shift']());}};_0x171fab(++_0x4057b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 203c674..63d519b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x758330,_0x371099){var _0x25195e=function(_0x284d74){while(--_0x284d74){_0x758330['push'](_0x758330['shift']());}};_0x25195e(++_0x371099);}(_0xe706,0xa3));var _0x6e70=function(_0x533bcc,_0x1ba26f){_0x533bcc=_0x533bcc-0x0;var _0x364d38=_0xe706[_0x533bcc];return _0x364d38;};'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(_0x2006c8,_0x3f8dbb){var _0x57aac9=function(_0x5b6eaa){while(--_0x5b6eaa){_0x2006c8['push'](_0x2006c8['shift']());}};_0x57aac9(++_0x3f8dbb);}(_0xe706,0xa3));var _0x6e70=function(_0x219bdc,_0x2db0d9){_0x219bdc=_0x219bdc-0x0;var _0x2abdb6=_0xe706[_0x219bdc];return _0x2abdb6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c537974..a5084db 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 _0x7730=['sequelize','INTEGER'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0x7730,0x1e8));var _0x0773=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x7730[_0x446f11];return _0x385cb5;};'use strict';var Sequelize=require(_0x0773('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0773('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c48=['INTEGER','sequelize','exports'];(function(_0x3edf8e,_0x150db0){var _0x2f35d8=function(_0x3c14f7){while(--_0x3c14f7){_0x3edf8e['push'](_0x3edf8e['shift']());}};_0x2f35d8(++_0x150db0);}(_0x5c48,0x172));var _0x85c4=function(_0xecbbc1,_0x304db8){_0xecbbc1=_0xecbbc1-0x0;var _0x478187=_0x5c48[_0xecbbc1];return _0x478187;};'use strict';var Sequelize=require(_0x85c4('0x0'));module[_0x85c4('0x1')]={'penalty':{'type':Sequelize[_0x85c4('0x2')],'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 1bba3b0..564608b 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 _0xbee8=['user_has_voice_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x3c7a7d,_0x31b235){var _0x5dfc77=function(_0x2ef333){while(--_0x2ef333){_0x3c7a7d['push'](_0x3c7a7d['shift']());}};_0x5dfc77(++_0x31b235);}(_0xbee8,0x1b1));var _0x8bee=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0xbee8[_0x495b3d];return _0x4cb329;};'use strict';var _=require(_0x8bee('0x0'));var util=require('util');var logger=require(_0x8bee('0x1'))(_0x8bee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8bee('0x3'));var fs=require('fs');var path=require(_0x8bee('0x4'));var rimraf=require(_0x8bee('0x5'));var config=require(_0x8bee('0x6'));var attributes=require(_0x8bee('0x7'));module[_0x8bee('0x8')]=function(_0xd95435,_0x34c6b3){return _0xd95435[_0x8bee('0x9')](_0x8bee('0xa'),attributes,{'tableName':_0x8bee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbc4=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','lodash'];(function(_0x1a2ef3,_0x21186c){var _0x34f4a4=function(_0x277126){while(--_0x277126){_0x1a2ef3['push'](_0x1a2ef3['shift']());}};_0x34f4a4(++_0x21186c);}(_0xbbc4,0x19d));var _0x4bbc=function(_0x546619,_0x691490){_0x546619=_0x546619-0x0;var _0x5a770b=_0xbbc4[_0x546619];return _0x5a770b;};'use strict';var _=require(_0x4bbc('0x0'));var util=require('util');var logger=require(_0x4bbc('0x1'))(_0x4bbc('0x2'));var moment=require('moment');var BPromise=require(_0x4bbc('0x3'));var rp=require(_0x4bbc('0x4'));var fs=require('fs');var path=require(_0x4bbc('0x5'));var rimraf=require(_0x4bbc('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bbc('0x7'));module[_0x4bbc('0x8')]=function(_0x47871c,_0x24f681){return _0x47871c['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index fb4db06..ed9a351 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 _0xb816=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x14f48d,_0x63ce82){var _0x52403f=function(_0xaf369b){while(--_0xaf369b){_0x14f48d['push'](_0x14f48d['shift']());}};_0x52403f(++_0x63ce82);}(_0xb816,0x7d));var _0x6b81=function(_0x1d07b5,_0xa42ba6){_0x1d07b5=_0x1d07b5-0x0;var _0x4498fa=_0xb816[_0x1d07b5];return _0x4498fa;};'use strict';var _=require('lodash');var util=require(_0x6b81('0x0'));var moment=require(_0x6b81('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b81('0x2'));var fs=require('fs');var Redis=require(_0x6b81('0x3'));var db=require(_0x6b81('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b81('0x5'));var config=require(_0x6b81('0x6'));var jayson=require(_0x6b81('0x7'));var client=jayson[_0x6b81('0x8')][_0x6b81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57efcc,_0x142384,_0x21d452){return new BPromise(function(_0x143e78,_0x4293ff){return client[_0x6b81('0xa')](_0x57efcc,_0x21d452)[_0x6b81('0xb')](function(_0x511797){logger[_0x6b81('0xc')](_0x6b81('0xd'),_0x142384,_0x6b81('0xe'));logger['debug'](_0x6b81('0xf'),_0x142384,_0x6b81('0xe'),JSON[_0x6b81('0x10')](_0x511797));if(_0x511797[_0x6b81('0x11')]){if(_0x511797['error']['code']===0x1f4){logger[_0x6b81('0x11')](_0x6b81('0xd'),_0x142384,_0x511797['error'][_0x6b81('0x12')]);return _0x4293ff(_0x511797['error'][_0x6b81('0x12')]);}logger[_0x6b81('0x11')](_0x6b81('0xd'),_0x142384,_0x511797[_0x6b81('0x11')][_0x6b81('0x12')]);return _0x143e78(_0x511797[_0x6b81('0x11')]['message']);}else{logger['info'](_0x6b81('0xd'),_0x142384,_0x6b81('0xe'));_0x143e78(_0x511797['result'][_0x6b81('0x12')]);}})['catch'](function(_0x3af455){logger[_0x6b81('0x11')](_0x6b81('0xd'),_0x142384,_0x3af455);_0x4293ff(_0x3af455);});});} \ No newline at end of file +var _0xccf4=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d9a9c,_0x4b9195){var _0x37f388=function(_0x10cf6c){while(--_0x10cf6c){_0x3d9a9c['push'](_0x3d9a9c['shift']());}};_0x37f388(++_0x4b9195);}(_0xccf4,0x123));var _0x4ccf=function(_0x359555,_0x58ee05){_0x359555=_0x359555-0x0;var _0x579b5a=_0xccf4[_0x359555];return _0x579b5a;};'use strict';var _=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var moment=require(_0x4ccf('0x2'));var BPromise=require(_0x4ccf('0x3'));var rs=require(_0x4ccf('0x4'));var fs=require('fs');var Redis=require(_0x4ccf('0x5'));var db=require(_0x4ccf('0x6'))['db'];var utils=require(_0x4ccf('0x7'));var logger=require(_0x4ccf('0x8'))(_0x4ccf('0x9'));var config=require(_0x4ccf('0xa'));var jayson=require(_0x4ccf('0xb'));var client=jayson[_0x4ccf('0xc')][_0x4ccf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x229475,_0x2f9ee2,_0x10f5e7){return new BPromise(function(_0x3fe04c,_0x272534){return client[_0x4ccf('0xe')](_0x229475,_0x10f5e7)['then'](function(_0x285c06){logger[_0x4ccf('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f9ee2,_0x4ccf('0x10'));logger[_0x4ccf('0x11')](_0x4ccf('0x12'),_0x2f9ee2,_0x4ccf('0x10'),JSON[_0x4ccf('0x13')](_0x285c06));if(_0x285c06[_0x4ccf('0x14')]){if(_0x285c06[_0x4ccf('0x14')]['code']===0x1f4){logger[_0x4ccf('0x14')](_0x4ccf('0x15'),_0x2f9ee2,_0x285c06[_0x4ccf('0x14')]['message']);return _0x272534(_0x285c06[_0x4ccf('0x14')][_0x4ccf('0x16')]);}logger[_0x4ccf('0x14')](_0x4ccf('0x15'),_0x2f9ee2,_0x285c06[_0x4ccf('0x14')][_0x4ccf('0x16')]);return _0x3fe04c(_0x285c06[_0x4ccf('0x14')]['message']);}else{logger['info'](_0x4ccf('0x15'),_0x2f9ee2,_0x4ccf('0x10'));_0x3fe04c(_0x285c06[_0x4ccf('0x17')]['message']);}})[_0x4ccf('0x18')](function(_0x3ec4f7){logger[_0x4ccf('0x14')](_0x4ccf('0x15'),_0x2f9ee2,_0x3ec4f7);_0x272534(_0x3ec4f7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index fd0832c..e3bb230 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2afb08,_0x324211){var _0x38cc5a=function(_0x5ac471){while(--_0x5ac471){_0x2afb08['push'](_0x2afb08['shift']());}};_0x38cc5a(++_0x324211);}(_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');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5880fb,_0x184300){var _0x43a89e=function(_0xca2b1e){while(--_0xca2b1e){_0x5880fb['push'](_0x5880fb['shift']());}};_0x43a89e(++_0x184300);}(_0x70e0,0x17b));var _0x070e=function(_0x36f415,_0x5be13b){_0x36f415=_0x36f415-0x0;var _0x5beab7=_0x70e0[_0x36f415];return _0x5beab7;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6364675..a308d3f 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 _0x0f4c=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x324322,_0x48f3f6){var _0x684e37=function(_0x35ff7b){while(--_0x35ff7b){_0x324322['push'](_0x324322['shift']());}};_0x684e37(++_0x48f3f6);}(_0x0f4c,0x178));var _0xc0f4=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x0f4c[_0x12a2a6];return _0x1754ae;};'use strict';var Sequelize=require(_0xc0f4('0x0'));module[_0xc0f4('0x1')]={'uniqueid':{'type':Sequelize[_0xc0f4('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xc0f4('0x3')],'allowNull':![],'comment':_0xc0f4('0x4')},'UserId':{'type':Sequelize[_0xc0f4('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc0f4('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xc0f4('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc0f4('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc0f4('0x3')],'allowNull':![],'unique':_0xc0f4('0x5'),'comment':_0xc0f4('0x4')},'penalty':{'type':Sequelize[_0xc0f4('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc0f4('0x2')](0xb),'defaultValue':0x0,'comment':_0xc0f4('0x4')}}; \ No newline at end of file +var _0x71a0=['Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0x71a0,0xc7));var _0x071a=function(_0x1d4bc3,_0x42426d){_0x1d4bc3=_0x1d4bc3-0x0;var _0x32183d=_0x71a0[_0x1d4bc3];return _0x32183d;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x071a('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x071a('0x1')},'membername':{'type':Sequelize[_0x071a('0x2')],'allowNull':![],'comment':_0x071a('0x1')},'UserId':{'type':Sequelize[_0x071a('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x071a('0x2')],'allowNull':![],'unique':_0x071a('0x3'),'comment':_0x071a('0x1')},'VoiceQueueId':{'type':Sequelize[_0x071a('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x071a('0x2')],'allowNull':![],'unique':_0x071a('0x3'),'comment':_0x071a('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x071a('0x1')},'paused':{'type':Sequelize[_0x071a('0x0')](0xb),'defaultValue':0x0,'comment':_0x071a('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5d95a03..996e61d 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 _0xad51=['remove','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xad51,0xf2));var _0x1ad5=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xad51[_0x21c2c8];return _0x4dd745;};'use strict';var EventEmitter=require(_0x1ad5('0x0'));var UserVoiceQueueRt=require(_0x1ad5('0x1'))['db'][_0x1ad5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1ad5('0x3')](0x0);var events={'afterCreate':_0x1ad5('0x4'),'afterUpdate':_0x1ad5('0x5'),'afterDestroy':_0x1ad5('0x6')};function emitEvent(_0x5c078d){return function(_0x1ec131,_0xc4e73e,_0x4fa1f9){UserVoiceQueueRtEvents['emit'](_0x5c078d+':'+_0x1ec131['id'],_0x1ec131);UserVoiceQueueRtEvents['emit'](_0x5c078d,_0x1ec131);_0x4fa1f9(null);};}for(var e in events){if(events[_0x1ad5('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xad4f=['update','remove','emit','hasOwnProperty','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x50aa63,_0x370cd4){var _0x577eb4=function(_0x1f2a6e){while(--_0x1f2a6e){_0x50aa63['push'](_0x50aa63['shift']());}};_0x577eb4(++_0x370cd4);}(_0xad4f,0xc8));var _0xfad4=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xad4f[_0x433a86];return _0x23000c;};'use strict';var EventEmitter=require(_0xfad4('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xfad4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfad4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfad4('0x3'),'afterDestroy':_0xfad4('0x4')};function emitEvent(_0x235dd1){return function(_0x51ab46,_0x4018f0,_0x38393e){UserVoiceQueueRtEvents['emit'](_0x235dd1+':'+_0x51ab46['id'],_0x51ab46);UserVoiceQueueRtEvents[_0xfad4('0x5')](_0x235dd1,_0x51ab46);_0x38393e(null);};}for(var e in events){if(events[_0xfad4('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2314eaa..79e5d08 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 _0x3e11=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x8ae836,_0x5735d7){var _0x2f9136=function(_0x348a21){while(--_0x348a21){_0x8ae836['push'](_0x8ae836['shift']());}};_0x2f9136(++_0x5735d7);}(_0x3e11,0x19d));var _0x13e1=function(_0x860d9f,_0x5d386b){_0x860d9f=_0x860d9f-0x0;var _0x294aa0=_0x3e11[_0x860d9f];return _0x294aa0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13e1('0x0'))('api');var moment=require(_0x13e1('0x1'));var BPromise=require(_0x13e1('0x2'));var rp=require(_0x13e1('0x3'));var fs=require('fs');var path=require(_0x13e1('0x4'));var rimraf=require(_0x13e1('0x5'));var config=require(_0x13e1('0x6'));var attributes=require(_0x13e1('0x7'));module['exports']=function(_0x1dd5e4,_0x4fadf3){return _0x1dd5e4[_0x13e1('0x8')](_0x13e1('0x9'),attributes,{'tableName':_0x13e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x349a=['util','api','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x366776,_0x48f0bf){var _0x34e2ad=function(_0xb7dfb0){while(--_0xb7dfb0){_0x366776['push'](_0x366776['shift']());}};_0x34e2ad(++_0x48f0bf);}(_0x349a,0x1c1));var _0xa349=function(_0x27e9b3,_0x1b17af){_0x27e9b3=_0x27e9b3-0x0;var _0x553cac=_0x349a[_0x27e9b3];return _0x553cac;};'use strict';var _=require(_0xa349('0x0'));var util=require(_0xa349('0x1'));var logger=require('../../config/logger')(_0xa349('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa349('0x3'));var rimraf=require(_0xa349('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xa349('0x5')]=function(_0x579ffd,_0x1d78a3){return _0x579ffd[_0xa349('0x6')](_0xa349('0x7'),attributes,{'tableName':_0xa349('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index e005d99..2fb82a0 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 _0x30f4=['../../config/logger','rpc','../../config/environment','client','http','redis','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x30f4,0x13e));var _0x430f=function(_0x1f3ea3,_0x40e304){_0x1f3ea3=_0x1f3ea3-0x0;var _0x4ec563=_0x30f4[_0x1f3ea3];return _0x4ec563;};'use strict';var _=require(_0x430f('0x0'));var util=require(_0x430f('0x1'));var moment=require('moment');var BPromise=require(_0x430f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x430f('0x3'));var db=require(_0x430f('0x4'))['db'];var utils=require(_0x430f('0x5'));var logger=require(_0x430f('0x6'))(_0x430f('0x7'));var config=require(_0x430f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x430f('0x9')][_0x430f('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x430f('0xb')],{'host':_0x430f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x430f('0xb')]));require('./userVoiceQueueRt.socket')[_0x430f('0xd')](socket);function respondWithRpcPromise(_0x55651d,_0x1e21b5,_0x3c18cf){return new BPromise(function(_0x1e7629,_0xe1c4ba){return client[_0x430f('0xe')](_0x55651d,_0x3c18cf)[_0x430f('0xf')](function(_0xbb1605){logger[_0x430f('0x10')](_0x430f('0x11'),_0x1e21b5,'request\x20sent');logger['debug'](_0x430f('0x12'),_0x1e21b5,_0x430f('0x13'),JSON['stringify'](_0xbb1605));if(_0xbb1605[_0x430f('0x14')]){if(_0xbb1605['error'][_0x430f('0x15')]===0x1f4){logger['error'](_0x430f('0x11'),_0x1e21b5,_0xbb1605[_0x430f('0x14')][_0x430f('0x16')]);return _0xe1c4ba(_0xbb1605[_0x430f('0x14')][_0x430f('0x16')]);}logger[_0x430f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1e21b5,_0xbb1605[_0x430f('0x14')][_0x430f('0x16')]);return _0x1e7629(_0xbb1605['error'][_0x430f('0x16')]);}else{logger[_0x430f('0x10')](_0x430f('0x11'),_0x1e21b5,_0x430f('0x13'));_0x1e7629(_0xbb1605[_0x430f('0x17')][_0x430f('0x16')]);}})[_0x430f('0x18')](function(_0x2347a6){logger[_0x430f('0x14')](_0x430f('0x11'),_0x1e21b5,_0x2347a6);_0xe1c4ba(_0x2347a6);});});}exports[_0x430f('0x19')]=function(_0x3b4c6b){var _0x278089=this;return new Promise(function(_0x12dd49,_0x28d962){return db[_0x430f('0x1a')]['findAll']({'raw':_0x3b4c6b[_0x430f('0x1b')]?_0x3b4c6b[_0x430f('0x1b')][_0x430f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b4c6b[_0x430f('0x1b')]?_0x3b4c6b[_0x430f('0x1b')]['where']||null:null,'attributes':[[db[_0x430f('0x1d')]['fn'](_0x430f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x430f('0x1f')](_0x430f('0x20')))),_0x430f('0x21')]]})['then'](function(_0x3f2cf7){logger[_0x430f('0x10')](_0x430f('0x19'),_0x3b4c6b);logger[_0x430f('0x22')]('GetVoiceQueueRtPauses',_0x3b4c6b,JSON[_0x430f('0x23')](_0x3f2cf7));_0x12dd49(_0x3f2cf7);})[_0x430f('0x18')](function(_0x28d875){logger[_0x430f('0x14')](_0x430f('0x19'),_0x28d875[_0x430f('0x16')],_0x3b4c6b);_0x28d962(_0x278089[_0x430f('0x14')](0x1f4,_0x28d875[_0x430f('0x16')]));});});}; \ No newline at end of file +var _0x399c=['jayson/promise','client','http','redis','socket.io-emitter','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x19b09e,_0xd9c06c){var _0x4e7c81=function(_0x4772cc){while(--_0x4772cc){_0x19b09e['push'](_0x19b09e['shift']());}};_0x4e7c81(++_0xd9c06c);}(_0x399c,0x168));var _0xc399=function(_0x42a5dc,_0x5a8b65){_0x42a5dc=_0x42a5dc-0x0;var _0x301321=_0x399c[_0x42a5dc];return _0x301321;};'use strict';var _=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var moment=require(_0xc399('0x2'));var BPromise=require(_0xc399('0x3'));var rs=require(_0xc399('0x4'));var fs=require('fs');var Redis=require(_0xc399('0x5'));var db=require(_0xc399('0x6'))['db'];var utils=require(_0xc399('0x7'));var logger=require('../../config/logger')(_0xc399('0x8'));var config=require(_0xc399('0x9'));var jayson=require(_0xc399('0xa'));var client=jayson[_0xc399('0xb')][_0xc399('0xc')]({'port':0x232a});config[_0xc399('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc399('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xc399('0xf')](socket);function respondWithRpcPromise(_0x280658,_0x175d78,_0x4e5026){return new BPromise(function(_0x178e56,_0x265a36){return client['request'](_0x280658,_0x4e5026)['then'](function(_0x3457ef){logger[_0xc399('0x10')](_0xc399('0x11'),_0x175d78,_0xc399('0x12'));logger[_0xc399('0x13')](_0xc399('0x14'),_0x175d78,_0xc399('0x12'),JSON[_0xc399('0x15')](_0x3457ef));if(_0x3457ef[_0xc399('0x16')]){if(_0x3457ef['error'][_0xc399('0x17')]===0x1f4){logger[_0xc399('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x175d78,_0x3457ef[_0xc399('0x16')][_0xc399('0x18')]);return _0x265a36(_0x3457ef[_0xc399('0x16')]['message']);}logger[_0xc399('0x16')](_0xc399('0x11'),_0x175d78,_0x3457ef[_0xc399('0x16')][_0xc399('0x18')]);return _0x178e56(_0x3457ef[_0xc399('0x16')][_0xc399('0x18')]);}else{logger['info'](_0xc399('0x11'),_0x175d78,'request\x20sent');_0x178e56(_0x3457ef['result'][_0xc399('0x18')]);}})[_0xc399('0x19')](function(_0x776099){logger['error'](_0xc399('0x11'),_0x175d78,_0x776099);_0x265a36(_0x776099);});});}exports[_0xc399('0x1a')]=function(_0x1a0dbe){var _0x3159dd=this;return new Promise(function(_0x27119e,_0xbe8948){return db[_0xc399('0x1b')][_0xc399('0x1c')]({'raw':_0x1a0dbe[_0xc399('0x1d')]?_0x1a0dbe[_0xc399('0x1d')][_0xc399('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a0dbe[_0xc399('0x1d')]?_0x1a0dbe['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xc399('0x1f'),db[_0xc399('0x20')]['fn']('IF',db[_0xc399('0x20')][_0xc399('0x21')](_0xc399('0x22')))),_0xc399('0x23')]]})[_0xc399('0x24')](function(_0xc3e44e){logger['info']('GetVoiceQueueRtPauses',_0x1a0dbe);logger[_0xc399('0x13')](_0xc399('0x1a'),_0x1a0dbe,JSON[_0xc399('0x15')](_0xc3e44e));_0x27119e(_0xc3e44e);})[_0xc399('0x19')](function(_0x4affb6){logger[_0xc399('0x16')](_0xc399('0x1a'),_0x4affb6[_0xc399('0x18')],_0x1a0dbe);_0xbe8948(_0x3159dd['error'](0x1f4,_0x4affb6[_0xc399('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4eee8ee..b6e4a5c 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 _0x7edb=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x20e45c,_0x3bcc8d){var _0x5edab3=function(_0x351160){while(--_0x351160){_0x20e45c['push'](_0x20e45c['shift']());}};_0x5edab3(++_0x3bcc8d);}(_0x7edb,0x158));var _0xb7ed=function(_0x1903d6,_0x401b93){_0x1903d6=_0x1903d6-0x0;var _0x34c99d=_0x7edb[_0x1903d6];return _0x34c99d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb7ed('0x0'),_0xb7ed('0x1'),_0xb7ed('0x2')];function createListener(_0x37440f,_0x15d080){return function(_0x5a485a){_0x15d080[_0xb7ed('0x3')](_0x37440f,_0x5a485a);};}function removeListener(_0x595b65,_0x4c8316){return function(){UserVoiceQueueRtEvents[_0xb7ed('0x4')](_0x595b65,_0x4c8316);};}exports[_0xb7ed('0x5')]=function(_0x2aa67d){for(var _0x246cfa=0x0,_0x85fdf0=events[_0xb7ed('0x6')];_0x246cfa<_0x85fdf0;_0x246cfa++){var _0xac7ffe=events[_0x246cfa];var _0x3c991d=createListener(_0xb7ed('0x7')+_0xac7ffe,_0x2aa67d);UserVoiceQueueRtEvents['on'](_0xac7ffe,_0x3c991d);}}; \ No newline at end of file +var _0x9aac=['emit','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x9aac,0x135));var _0xc9aa=function(_0x5cfb4b,_0x4b2df4){_0x5cfb4b=_0x5cfb4b-0x0;var _0x152207=_0x9aac[_0x5cfb4b];return _0x152207;};'use strict';var UserVoiceQueueRtEvents=require(_0xc9aa('0x0'));var events=['save',_0xc9aa('0x1'),_0xc9aa('0x2')];function createListener(_0x57da2f,_0xaee75d){return function(_0x4e88d6){_0xaee75d[_0xc9aa('0x3')](_0x57da2f,_0x4e88d6);};}function removeListener(_0x5c8ce2,_0x28c49c){return function(){UserVoiceQueueRtEvents[_0xc9aa('0x4')](_0x5c8ce2,_0x28c49c);};}exports['register']=function(_0x280687){for(var _0x2f9029=0x0,_0x34beeb=events['length'];_0x2f9029<_0x34beeb;_0x2f9029++){var _0x2f3fde=events[_0x2f9029];var _0x24829f=createListener(_0xc9aa('0x5')+_0x2f3fde,_0x280687);UserVoiceQueueRtEvents['on'](_0x2f3fde,_0x24829f);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index fe6ba9c..c823dc2 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x545a69,_0x353dbd){var _0x219923=function(_0x355884){while(--_0x355884){_0x545a69['push'](_0x545a69['shift']());}};_0x219923(++_0x353dbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 37e7c21..de380ca 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 _0xf19b=['INTEGER','exports'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0xf19b,0x197));var _0xbf19=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf19b[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0xbf19('0x0')]={'penalty':{'type':Sequelize[_0xbf19('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a88=['exports','INTEGER','sequelize'];(function(_0x49ab55,_0x956e08){var _0x56d7a1=function(_0x3b4a27){while(--_0x3b4a27){_0x49ab55['push'](_0x49ab55['shift']());}};_0x56d7a1(++_0x956e08);}(_0x0a88,0x7a));var _0x80a8=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x0a88[_0x54de5d];return _0x1b349e;};'use strict';var Sequelize=require(_0x80a8('0x0'));module[_0x80a8('0x1')]={'penalty':{'type':Sequelize[_0x80a8('0x2')],'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 efa21dc..27ad6d7 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 _0x2c0c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger'];(function(_0x1e5a7e,_0x2415e3){var _0x4b7752=function(_0x2ca7bd){while(--_0x2ca7bd){_0x1e5a7e['push'](_0x1e5a7e['shift']());}};_0x4b7752(++_0x2415e3);}(_0x2c0c,0x11e));var _0xc2c0=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x2c0c[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0xc2c0('0x0'));var util=require('util');var logger=require(_0xc2c0('0x1'))(_0xc2c0('0x2'));var moment=require('moment');var BPromise=require(_0xc2c0('0x3'));var rp=require(_0xc2c0('0x4'));var fs=require('fs');var path=require(_0xc2c0('0x5'));var rimraf=require(_0xc2c0('0x6'));var config=require(_0xc2c0('0x7'));var attributes=require(_0xc2c0('0x8'));module['exports']=function(_0x19f784,_0x3311f6){return _0x19f784[_0xc2c0('0x9')](_0xc2c0('0xa'),attributes,{'tableName':_0xc2c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b10=['bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','../../config/logger'];(function(_0x1d0b24,_0x36d7da){var _0x320e51=function(_0x1fdda4){while(--_0x1fdda4){_0x1d0b24['push'](_0x1d0b24['shift']());}};_0x320e51(++_0x36d7da);}(_0x3b10,0x8a));var _0x03b1=function(_0x256734,_0x351d69){_0x256734=_0x256734-0x0;var _0x5e7c75=_0x3b10[_0x256734];return _0x5e7c75;};'use strict';var _=require(_0x03b1('0x0'));var util=require('util');var logger=require(_0x03b1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x03b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03b1('0x3'));var rimraf=require(_0x03b1('0x4'));var config=require(_0x03b1('0x5'));var attributes=require(_0x03b1('0x6'));module[_0x03b1('0x7')]=function(_0x5649b8,_0x54bd83){return _0x5649b8[_0x03b1('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x03b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7f94724..904c2d5 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 _0xe871=['request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x1bcf9d,_0x464439){var _0x51fc09=function(_0x507744){while(--_0x507744){_0x1bcf9d['push'](_0x1bcf9d['shift']());}};_0x51fc09(++_0x464439);}(_0xe871,0x1c4));var _0x1e87=function(_0x28af7a,_0x3a996d){_0x28af7a=_0x28af7a-0x0;var _0x327b92=_0xe871[_0x28af7a];return _0x327b92;};'use strict';var _=require(_0x1e87('0x0'));var util=require(_0x1e87('0x1'));var moment=require('moment');var BPromise=require(_0x1e87('0x2'));var rs=require(_0x1e87('0x3'));var fs=require('fs');var Redis=require(_0x1e87('0x4'));var db=require(_0x1e87('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e87('0x6'))('rpc');var config=require(_0x1e87('0x7'));var jayson=require(_0x1e87('0x8'));var client=jayson['client'][_0x1e87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdbc64e,_0xe294c,_0x2cf75e){return new BPromise(function(_0x53ebee,_0x2de24d){return client[_0x1e87('0xa')](_0xdbc64e,_0x2cf75e)[_0x1e87('0xb')](function(_0x39f146){logger[_0x1e87('0xc')](_0x1e87('0xd'),_0xe294c,_0x1e87('0xe'));logger['debug'](_0x1e87('0xf'),_0xe294c,'request\x20sent',JSON[_0x1e87('0x10')](_0x39f146));if(_0x39f146['error']){if(_0x39f146[_0x1e87('0x11')][_0x1e87('0x12')]===0x1f4){logger[_0x1e87('0x11')](_0x1e87('0xd'),_0xe294c,_0x39f146['error'][_0x1e87('0x13')]);return _0x2de24d(_0x39f146[_0x1e87('0x11')][_0x1e87('0x13')]);}logger[_0x1e87('0x11')](_0x1e87('0xd'),_0xe294c,_0x39f146[_0x1e87('0x11')][_0x1e87('0x13')]);return _0x53ebee(_0x39f146[_0x1e87('0x11')][_0x1e87('0x13')]);}else{logger['info'](_0x1e87('0xd'),_0xe294c,_0x1e87('0xe'));_0x53ebee(_0x39f146['result']['message']);}})[_0x1e87('0x14')](function(_0x1774bd){logger[_0x1e87('0x11')](_0x1e87('0xd'),_0xe294c,_0x1774bd);_0x2de24d(_0x1774bd);});});} \ No newline at end of file +var _0xd3d0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash'];(function(_0x5318e8,_0x101117){var _0x573b81=function(_0x388522){while(--_0x388522){_0x5318e8['push'](_0x5318e8['shift']());}};_0x573b81(++_0x101117);}(_0xd3d0,0x167));var _0x0d3d=function(_0x2b6bbc,_0x438a3a){_0x2b6bbc=_0x2b6bbc-0x0;var _0x5833d8=_0xd3d0[_0x2b6bbc];return _0x5833d8;};'use strict';var _=require(_0x0d3d('0x0'));var util=require(_0x0d3d('0x1'));var moment=require(_0x0d3d('0x2'));var BPromise=require(_0x0d3d('0x3'));var rs=require(_0x0d3d('0x4'));var fs=require('fs');var Redis=require(_0x0d3d('0x5'));var db=require(_0x0d3d('0x6'))['db'];var utils=require(_0x0d3d('0x7'));var logger=require(_0x0d3d('0x8'))(_0x0d3d('0x9'));var config=require(_0x0d3d('0xa'));var jayson=require(_0x0d3d('0xb'));var client=jayson['client'][_0x0d3d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dfee2,_0x81072d,_0x3def5f){return new BPromise(function(_0x5e8dce,_0x4ea3a6){return client['request'](_0x1dfee2,_0x3def5f)[_0x0d3d('0xd')](function(_0xe693ed){logger[_0x0d3d('0xe')](_0x0d3d('0xf'),_0x81072d,'request\x20sent');logger[_0x0d3d('0x10')](_0x0d3d('0x11'),_0x81072d,'request\x20sent',JSON[_0x0d3d('0x12')](_0xe693ed));if(_0xe693ed['error']){if(_0xe693ed[_0x0d3d('0x13')]['code']===0x1f4){logger[_0x0d3d('0x13')](_0x0d3d('0xf'),_0x81072d,_0xe693ed[_0x0d3d('0x13')][_0x0d3d('0x14')]);return _0x4ea3a6(_0xe693ed[_0x0d3d('0x13')]['message']);}logger[_0x0d3d('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x81072d,_0xe693ed[_0x0d3d('0x13')]['message']);return _0x5e8dce(_0xe693ed[_0x0d3d('0x13')][_0x0d3d('0x14')]);}else{logger[_0x0d3d('0xe')](_0x0d3d('0xf'),_0x81072d,_0x0d3d('0x15'));_0x5e8dce(_0xe693ed[_0x0d3d('0x16')][_0x0d3d('0x14')]);}})[_0x0d3d('0x17')](function(_0x46e9a3){logger[_0x0d3d('0x13')](_0x0d3d('0xf'),_0x81072d,_0x46e9a3);_0x4ea3a6(_0x46e9a3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ad5287a..678eadf 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 _0x3d6d=['./variable.controller','index','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x276e6b,_0x581bd0){var _0x6750b6=function(_0x1da324){while(--_0x1da324){_0x276e6b['push'](_0x276e6b['shift']());}};_0x6750b6(++_0x581bd0);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x5502a7,_0x325618){_0x5502a7=_0x5502a7-0x0;var _0x3946fa=_0x3d6d[_0x5502a7];return _0x3946fa;};'use strict';var multer=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var path=require(_0xd3d6('0x2'));var timeout=require(_0xd3d6('0x3'));var express=require(_0xd3d6('0x4'));var router=express[_0xd3d6('0x5')]();var fs_extra=require(_0xd3d6('0x6'));var auth=require(_0xd3d6('0x7'));var interaction=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var controller=require(_0xd3d6('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3d6('0xb')]);router[_0xd3d6('0xc')](_0xd3d6('0xd'),auth[_0xd3d6('0xe')](),controller[_0xd3d6('0xf')]);router['post']('/',auth[_0xd3d6('0xe')](),controller[_0xd3d6('0x10')]);router[_0xd3d6('0x11')](_0xd3d6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd3d6('0x12')](_0xd3d6('0xd'),auth[_0xd3d6('0xe')](),controller[_0xd3d6('0x13')]);module[_0xd3d6('0x14')]=router; \ No newline at end of file +var _0x292e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','exports','multer'];(function(_0x380c66,_0x59ac29){var _0x51ca79=function(_0xee504e){while(--_0xee504e){_0x380c66['push'](_0x380c66['shift']());}};_0x51ca79(++_0x59ac29);}(_0x292e,0xcb));var _0xe292=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x292e[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var path=require(_0xe292('0x2'));var timeout=require(_0xe292('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe292('0x4'));var auth=require(_0xe292('0x5'));var interaction=require(_0xe292('0x6'));var config=require(_0xe292('0x7'));var controller=require('./variable.controller');router[_0xe292('0x8')]('/',auth['isAuthenticated'](),controller[_0xe292('0x9')]);router[_0xe292('0x8')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xc')]);router[_0xe292('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe292('0xe')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xf')]);router['delete'](_0xe292('0xa'),auth[_0xe292('0xb')](),controller['destroy']);module[_0xe292('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ff41cc8..2866f50 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 _0xf41c=['exports','name'];(function(_0x550a17,_0x50fdd4){var _0x5b62bd=function(_0x357f42){while(--_0x357f42){_0x550a17['push'](_0x550a17['shift']());}};_0x5b62bd(++_0x50fdd4);}(_0xf41c,0x1a6));var _0xcf41=function(_0x573594,_0x3f98bd){_0x573594=_0x573594-0x0;var _0x4de4e7=_0xf41c[_0x573594];return _0x4de4e7;};'use strict';var Sequelize=require('sequelize');module[_0xcf41('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf41('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3c6=['name','sequelize','exports','STRING'];(function(_0x3ec509,_0x7aebad){var _0x1f343c=function(_0x1dbff9){while(--_0x1dbff9){_0x3ec509['push'](_0x3ec509['shift']());}};_0x1f343c(++_0x7aebad);}(_0xd3c6,0x121));var _0x6d3c=function(_0x1f1424,_0x3b8b85){_0x1f1424=_0x1f1424-0x0;var _0x178325=_0xd3c6[_0x1f1424];return _0x178325;};'use strict';var Sequelize=require(_0x6d3c('0x0'));module[_0x6d3c('0x1')]={'name':{'type':Sequelize[_0x6d3c('0x2')],'unique':_0x6d3c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6d3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c01c9d9..2f67750 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 _0xa5bc=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xa5bc,0x1dc));var _0xca5b=function(_0x149971,_0x24ff4d){_0x149971=_0x149971-0x0;var _0x567bc3=_0xa5bc[_0x149971];return _0x567bc3;};'use strict';var emlformat=require(_0xca5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca5b('0x1'));var jsonpatch=require(_0xca5b('0x2'));var rp=require(_0xca5b('0x3'));var moment=require('moment');var BPromise=require(_0xca5b('0x4'));var Mustache=require(_0xca5b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca5b('0x6'));var fs=require('fs');var fs_extra=require(_0xca5b('0x7'));var _=require(_0xca5b('0x8'));var squel=require('squel');var crypto=require(_0xca5b('0x9'));var jsforce=require(_0xca5b('0xa'));var deskjs=require(_0xca5b('0xb'));var toCsv=require(_0xca5b('0xc'));var querystring=require(_0xca5b('0xd'));var Papa=require(_0xca5b('0xe'));var Redis=require('ioredis');var authService=require(_0xca5b('0xf'));var qs=require(_0xca5b('0x10'));var as=require(_0xca5b('0x11'));var hardwareService=require(_0xca5b('0x12'));var logger=require(_0xca5b('0x13'))(_0xca5b('0x14'));var utils=require(_0xca5b('0x15'));var config=require(_0xca5b('0x16'));var licenseUtil=require(_0xca5b('0x17'));var db=require(_0xca5b('0x18'))['db'];function respondWithStatusCode(_0x28e9f4,_0x1be10c){_0x1be10c=_0x1be10c||0xcc;return function(_0x5ab565){if(_0x5ab565){return _0x28e9f4[_0xca5b('0x19')](_0x1be10c);}return _0x28e9f4['status'](_0x1be10c)['end']();};}function respondWithResult(_0x59cd8f,_0x5006df){_0x5006df=_0x5006df||0xc8;return function(_0x16c2fd){if(_0x16c2fd){return _0x59cd8f[_0xca5b('0x1a')](_0x5006df)[_0xca5b('0x1b')](_0x16c2fd);}};}function respondWithFilteredResult(_0x346f9d,_0x4a1841){return function(_0x6384bb){if(_0x6384bb){var _0x4a0aa5=typeof _0x4a1841[_0xca5b('0x1c')]===_0xca5b('0x1d')&&typeof _0x4a1841['limit']===_0xca5b('0x1d');var _0x43bbc9=_0x6384bb[_0xca5b('0x1e')];var _0x293d0f=_0x4a0aa5?0x0:_0x4a1841[_0xca5b('0x1c')];var _0x44134f=_0x4a0aa5?_0x6384bb[_0xca5b('0x1e')]:_0x4a1841['offset']+_0x4a1841[_0xca5b('0x1f')];var _0x23c79d;if(_0x44134f>=_0x43bbc9){_0x44134f=_0x43bbc9;_0x23c79d=0xc8;}else{_0x23c79d=0xce;}_0x346f9d[_0xca5b('0x1a')](_0x23c79d);return _0x346f9d[_0xca5b('0x20')]('Content-Range',_0x293d0f+'-'+_0x44134f+'/'+_0x43bbc9)[_0xca5b('0x1b')](_0x6384bb);}return null;};}function patchUpdates(_0x5a6520){return function(_0x466ad2){try{jsonpatch[_0xca5b('0x21')](_0x466ad2,_0x5a6520,!![]);}catch(_0x35076d){return BPromise['reject'](_0x35076d);}return _0x466ad2[_0xca5b('0x22')]();};}function saveUpdates(_0x233627,_0x1dc743){return function(_0x4063ff){if(_0x4063ff){return _0x4063ff[_0xca5b('0x23')](_0x233627)[_0xca5b('0x24')](function(_0x57bffa){return _0x57bffa;});}return null;};}function removeEntity(_0x4030ea,_0x30314b){return function(_0x3dc69d){if(_0x3dc69d){return _0x3dc69d['destroy']()[_0xca5b('0x24')](function(){var _0x2af75c=_0x3dc69d[_0xca5b('0x25')]({'plain':!![]});var _0x4e675f='Variables';return db[_0xca5b('0x26')][_0xca5b('0x27')]({'where':{'type':_0x4e675f,'resourceId':_0x2af75c['id']}})[_0xca5b('0x24')](function(){return _0x3dc69d;});})['then'](function(){_0x4030ea['status'](0xcc)[_0xca5b('0x28')]();});}};}function handleEntityNotFound(_0x475b5c,_0x203195){return function(_0x4c887a){if(!_0x4c887a){_0x475b5c[_0xca5b('0x19')](0x194);}return _0x4c887a;};}function handleError(_0xf3406d,_0x1bd32b){_0x1bd32b=_0x1bd32b||0x1f4;return function(_0x16d605){logger[_0xca5b('0x29')](_0x16d605[_0xca5b('0x2a')]);if(_0x16d605['name']){delete _0x16d605['name'];}_0xf3406d[_0xca5b('0x1a')](_0x1bd32b)[_0xca5b('0x2b')](_0x16d605);};}exports[_0xca5b('0x2c')]=function(_0x1b1090,_0x511b3d){var _0x1bd9ea={},_0x2c831a={},_0x225e09={'count':0x0,'rows':[]};var _0x4fe872=_[_0xca5b('0x2d')](db[_0xca5b('0x2e')][_0xca5b('0x2f')],function(_0x327957){return{'name':_0x327957[_0xca5b('0x30')],'type':_0x327957[_0xca5b('0x31')][_0xca5b('0x32')]};});_0x2c831a[_0xca5b('0x33')]=_[_0xca5b('0x2d')](_0x4fe872,_0xca5b('0x34'));_0x2c831a[_0xca5b('0x35')]=_[_0xca5b('0x36')](_0x1b1090[_0xca5b('0x35')]);_0x2c831a[_0xca5b('0x37')]=_[_0xca5b('0x38')](_0x2c831a[_0xca5b('0x33')],_0x2c831a[_0xca5b('0x35')]);_0x1bd9ea[_0xca5b('0x39')]=_[_0xca5b('0x38')](_0x2c831a[_0xca5b('0x33')],qs[_0xca5b('0x3a')](_0x1b1090[_0xca5b('0x35')][_0xca5b('0x3a')]));_0x1bd9ea[_0xca5b('0x39')]=_0x1bd9ea[_0xca5b('0x39')][_0xca5b('0x3b')]?_0x1bd9ea[_0xca5b('0x39')]:_0x2c831a[_0xca5b('0x33')];if(!_0x1b1090['query'][_0xca5b('0x3c')](_0xca5b('0x3d'))){_0x1bd9ea[_0xca5b('0x1f')]=qs[_0xca5b('0x1f')](_0x1b1090[_0xca5b('0x35')][_0xca5b('0x1f')]);_0x1bd9ea[_0xca5b('0x1c')]=qs[_0xca5b('0x1c')](_0x1b1090[_0xca5b('0x35')][_0xca5b('0x1c')]);}_0x1bd9ea[_0xca5b('0x3e')]=qs[_0xca5b('0x3f')](_0x1b1090[_0xca5b('0x35')][_0xca5b('0x3f')]);_0x1bd9ea[_0xca5b('0x40')]=qs['filters'](_[_0xca5b('0x41')](_0x1b1090[_0xca5b('0x35')],_0x2c831a[_0xca5b('0x37')]),_0x4fe872);if(_0x1b1090[_0xca5b('0x35')]['filter']){_0x1bd9ea[_0xca5b('0x40')]=_['merge'](_0x1bd9ea[_0xca5b('0x40')],{'$or':_[_0xca5b('0x2d')](_0x4fe872,function(_0x3450fc){if(_0x3450fc[_0xca5b('0x31')]!==_0xca5b('0x42')){var _0xf41de6={};_0xf41de6[_0x3450fc[_0xca5b('0x34')]]={'$like':'%'+_0x1b1090[_0xca5b('0x35')]['filter']+'%'};return _0xf41de6;}})});}_0x1bd9ea=_[_0xca5b('0x43')]({},_0x1bd9ea,_0x1b1090['options']);var _0x549d7a={'where':_0x1bd9ea[_0xca5b('0x40')]};return db[_0xca5b('0x2e')][_0xca5b('0x1e')](_0x549d7a)[_0xca5b('0x24')](function(_0x36d237){_0x225e09[_0xca5b('0x1e')]=_0x36d237;if(_0x1b1090[_0xca5b('0x35')][_0xca5b('0x44')]){_0x1bd9ea[_0xca5b('0x45')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x1bd9ea);})[_0xca5b('0x24')](function(_0xca57a3){_0x225e09['rows']=_0xca57a3;return _0x225e09;})[_0xca5b('0x24')](respondWithFilteredResult(_0x511b3d,_0x1bd9ea))[_0xca5b('0x46')](handleError(_0x511b3d,null));};exports['show']=function(_0x4afddd,_0x439b91){var _0x35a106={'raw':!![],'where':{'id':_0x4afddd[_0xca5b('0x47')]['id']}},_0x48d284={};_0x48d284[_0xca5b('0x33')]=_[_0xca5b('0x36')](db[_0xca5b('0x2e')][_0xca5b('0x2f')]);_0x48d284[_0xca5b('0x35')]=_[_0xca5b('0x36')](_0x4afddd[_0xca5b('0x35')]);_0x48d284[_0xca5b('0x37')]=_['intersection'](_0x48d284[_0xca5b('0x33')],_0x48d284[_0xca5b('0x35')]);_0x35a106['attributes']=_[_0xca5b('0x38')](_0x48d284[_0xca5b('0x33')],qs['fields'](_0x4afddd['query'][_0xca5b('0x3a')]));_0x35a106['attributes']=_0x35a106[_0xca5b('0x39')][_0xca5b('0x3b')]?_0x35a106[_0xca5b('0x39')]:_0x48d284[_0xca5b('0x33')];if(_0x4afddd[_0xca5b('0x35')]['includeAll']){_0x35a106[_0xca5b('0x45')]=[{'all':!![]}];}_0x35a106=_[_0xca5b('0x43')]({},_0x35a106,_0x4afddd[_0xca5b('0x48')]);return db[_0xca5b('0x2e')][_0xca5b('0x49')](_0x35a106)[_0xca5b('0x24')](handleEntityNotFound(_0x439b91,null))[_0xca5b('0x24')](respondWithResult(_0x439b91,null))[_0xca5b('0x46')](handleError(_0x439b91,null));};exports[_0xca5b('0x4a')]=function(_0x55c619,_0x55af5a){return db[_0xca5b('0x2e')][_0xca5b('0x4a')](_0x55c619[_0xca5b('0x4b')],{})['then'](function(_0x4a724a){var _0x4f557a=_0x55c619[_0xca5b('0x4c')][_0xca5b('0x25')]({'plain':!![]});if(!_0x4f557a)throw new Error(_0xca5b('0x4d'));if(_0x4f557a[_0xca5b('0x4e')]==='user'){var _0x3d4f63=_0x4a724a[_0xca5b('0x25')]({'plain':!![]});var _0x2cd52d=_0xca5b('0x4f');return db[_0xca5b('0x50')][_0xca5b('0x49')]({'where':{'name':_0x2cd52d,'userProfileId':_0x4f557a[_0xca5b('0x51')]},'raw':!![]})[_0xca5b('0x24')](function(_0x54c328){if(_0x54c328&&_0x54c328[_0xca5b('0x52')]===0x0){return db['UserProfileResource'][_0xca5b('0x4a')]({'name':_0x3d4f63[_0xca5b('0x34')],'resourceId':_0x3d4f63['id'],'type':_0x54c328[_0xca5b('0x34')],'sectionId':_0x54c328['id']},{})['then'](function(){return _0x4a724a;});}else{return _0x4a724a;}})[_0xca5b('0x46')](function(_0x30a3ee){logger[_0xca5b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30a3ee);throw _0x30a3ee;});}return _0x4a724a;})[_0xca5b('0x24')](respondWithResult(_0x55af5a,0xc9))[_0xca5b('0x46')](handleError(_0x55af5a,null));};exports[_0xca5b('0x23')]=function(_0xfe0acb,_0x35a49e){if(_0xfe0acb[_0xca5b('0x4b')]['id']){delete _0xfe0acb[_0xca5b('0x4b')]['id'];}return db[_0xca5b('0x2e')]['find']({'where':{'id':_0xfe0acb['params']['id']}})['then'](handleEntityNotFound(_0x35a49e,null))[_0xca5b('0x24')](saveUpdates(_0xfe0acb[_0xca5b('0x4b')],null))['then'](respondWithResult(_0x35a49e,null))[_0xca5b('0x46')](handleError(_0x35a49e,null));};exports['destroy']=function(_0x4c7fb2,_0x176e9c){return db[_0xca5b('0x2e')]['find']({'where':{'id':_0x4c7fb2[_0xca5b('0x47')]['id']}})[_0xca5b('0x24')](handleEntityNotFound(_0x176e9c,null))[_0xca5b('0x24')](removeEntity(_0x176e9c,null))[_0xca5b('0x46')](handleError(_0x176e9c,null));}; \ No newline at end of file +var _0xfa19=['get','Variables','UserProfileResource','end','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy'];(function(_0x11ec59,_0x5d9f81){var _0x5ed36d=function(_0x34d7d1){while(--_0x34d7d1){_0x11ec59['push'](_0x11ec59['shift']());}};_0x5ed36d(++_0x5d9f81);}(_0xfa19,0x12c));var _0x9fa1=function(_0x2eb066,_0x2cd4c4){_0x2eb066=_0x2eb066-0x0;var _0x5c87e6=_0xfa19[_0x2eb066];return _0x5c87e6;};'use strict';var emlformat=require(_0x9fa1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fa1('0x1'));var jsonpatch=require(_0x9fa1('0x2'));var rp=require(_0x9fa1('0x3'));var moment=require(_0x9fa1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fa1('0x5'));var util=require(_0x9fa1('0x6'));var path=require(_0x9fa1('0x7'));var sox=require(_0x9fa1('0x8'));var csv=require(_0x9fa1('0x9'));var ejs=require(_0x9fa1('0xa'));var fs=require('fs');var fs_extra=require(_0x9fa1('0xb'));var _=require(_0x9fa1('0xc'));var squel=require(_0x9fa1('0xd'));var crypto=require(_0x9fa1('0xe'));var jsforce=require(_0x9fa1('0xf'));var deskjs=require(_0x9fa1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9fa1('0x11'));var Redis=require('ioredis');var authService=require(_0x9fa1('0x12'));var qs=require(_0x9fa1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fa1('0x14'))(_0x9fa1('0x15'));var utils=require(_0x9fa1('0x16'));var config=require(_0x9fa1('0x17'));var licenseUtil=require(_0x9fa1('0x18'));var db=require(_0x9fa1('0x19'))['db'];function respondWithStatusCode(_0x3d3351,_0x812f6a){_0x812f6a=_0x812f6a||0xcc;return function(_0x363c83){if(_0x363c83){return _0x3d3351[_0x9fa1('0x1a')](_0x812f6a);}return _0x3d3351['status'](_0x812f6a)['end']();};}function respondWithResult(_0x30aed1,_0x5a0f08){_0x5a0f08=_0x5a0f08||0xc8;return function(_0x4d13c0){if(_0x4d13c0){return _0x30aed1[_0x9fa1('0x1b')](_0x5a0f08)['json'](_0x4d13c0);}};}function respondWithFilteredResult(_0x1eb6b0,_0xfa8932){return function(_0x3e1e1a){if(_0x3e1e1a){var _0x970b7e=typeof _0xfa8932[_0x9fa1('0x1c')]===_0x9fa1('0x1d')&&typeof _0xfa8932[_0x9fa1('0x1e')]==='undefined';var _0x2a7f0f=_0x3e1e1a[_0x9fa1('0x1f')];var _0x4b4715=_0x970b7e?0x0:_0xfa8932[_0x9fa1('0x1c')];var _0x275fdc=_0x970b7e?_0x3e1e1a[_0x9fa1('0x1f')]:_0xfa8932['offset']+_0xfa8932[_0x9fa1('0x1e')];var _0x4ec029;if(_0x275fdc>=_0x2a7f0f){_0x275fdc=_0x2a7f0f;_0x4ec029=0xc8;}else{_0x4ec029=0xce;}_0x1eb6b0[_0x9fa1('0x1b')](_0x4ec029);return _0x1eb6b0[_0x9fa1('0x20')](_0x9fa1('0x21'),_0x4b4715+'-'+_0x275fdc+'/'+_0x2a7f0f)[_0x9fa1('0x22')](_0x3e1e1a);}return null;};}function patchUpdates(_0x3be0eb){return function(_0x12622c){try{jsonpatch[_0x9fa1('0x23')](_0x12622c,_0x3be0eb,!![]);}catch(_0x49fde2){return BPromise[_0x9fa1('0x24')](_0x49fde2);}return _0x12622c['save']();};}function saveUpdates(_0x154be3,_0x52ea88){return function(_0x3cf6fe){if(_0x3cf6fe){return _0x3cf6fe[_0x9fa1('0x25')](_0x154be3)[_0x9fa1('0x26')](function(_0x53125a){return _0x53125a;});}return null;};}function removeEntity(_0x1f9582,_0xb65604){return function(_0x3686f9){if(_0x3686f9){return _0x3686f9[_0x9fa1('0x27')]()[_0x9fa1('0x26')](function(){var _0x34eb5c=_0x3686f9[_0x9fa1('0x28')]({'plain':!![]});var _0x5d0ddc=_0x9fa1('0x29');return db[_0x9fa1('0x2a')]['destroy']({'where':{'type':_0x5d0ddc,'resourceId':_0x34eb5c['id']}})['then'](function(){return _0x3686f9;});})[_0x9fa1('0x26')](function(){_0x1f9582[_0x9fa1('0x1b')](0xcc)[_0x9fa1('0x2b')]();});}};}function handleEntityNotFound(_0x3f2e62,_0x50a9e5){return function(_0xcf5d31){if(!_0xcf5d31){_0x3f2e62[_0x9fa1('0x1a')](0x194);}return _0xcf5d31;};}function handleError(_0x34f28c,_0x1db2d4){_0x1db2d4=_0x1db2d4||0x1f4;return function(_0x5d139b){logger['error'](_0x5d139b[_0x9fa1('0x2c')]);if(_0x5d139b[_0x9fa1('0x2d')]){delete _0x5d139b[_0x9fa1('0x2d')];}_0x34f28c[_0x9fa1('0x1b')](_0x1db2d4)[_0x9fa1('0x2e')](_0x5d139b);};}exports[_0x9fa1('0x2f')]=function(_0x58ccd1,_0x215e92){var _0x183a1b={},_0x29abab={},_0x226823={'count':0x0,'rows':[]};var _0x84ecf4=_[_0x9fa1('0x30')](db[_0x9fa1('0x31')][_0x9fa1('0x32')],function(_0x473daf){return{'name':_0x473daf[_0x9fa1('0x33')],'type':_0x473daf[_0x9fa1('0x34')][_0x9fa1('0x35')]};});_0x29abab['model']=_[_0x9fa1('0x30')](_0x84ecf4,_0x9fa1('0x2d'));_0x29abab[_0x9fa1('0x36')]=_[_0x9fa1('0x37')](_0x58ccd1[_0x9fa1('0x36')]);_0x29abab[_0x9fa1('0x38')]=_[_0x9fa1('0x39')](_0x29abab['model'],_0x29abab[_0x9fa1('0x36')]);_0x183a1b[_0x9fa1('0x3a')]=_[_0x9fa1('0x39')](_0x29abab[_0x9fa1('0x3b')],qs[_0x9fa1('0x3c')](_0x58ccd1['query']['fields']));_0x183a1b[_0x9fa1('0x3a')]=_0x183a1b[_0x9fa1('0x3a')]['length']?_0x183a1b[_0x9fa1('0x3a')]:_0x29abab['model'];if(!_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x3d')](_0x9fa1('0x3e'))){_0x183a1b[_0x9fa1('0x1e')]=qs[_0x9fa1('0x1e')](_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x1e')]);_0x183a1b['offset']=qs[_0x9fa1('0x1c')](_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x1c')]);}_0x183a1b[_0x9fa1('0x3f')]=qs['sort'](_0x58ccd1['query'][_0x9fa1('0x40')]);_0x183a1b[_0x9fa1('0x41')]=qs['filters'](_[_0x9fa1('0x42')](_0x58ccd1[_0x9fa1('0x36')],_0x29abab[_0x9fa1('0x38')]),_0x84ecf4);if(_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x43')]){_0x183a1b[_0x9fa1('0x41')]=_[_0x9fa1('0x44')](_0x183a1b[_0x9fa1('0x41')],{'$or':_['map'](_0x84ecf4,function(_0x3277f3){if(_0x3277f3[_0x9fa1('0x34')]!==_0x9fa1('0x45')){var _0xea408f={};_0xea408f[_0x3277f3[_0x9fa1('0x2d')]]={'$like':'%'+_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x43')]+'%'};return _0xea408f;}})});}_0x183a1b=_['merge']({},_0x183a1b,_0x58ccd1[_0x9fa1('0x46')]);var _0x20b387={'where':_0x183a1b['where']};return db[_0x9fa1('0x31')][_0x9fa1('0x1f')](_0x20b387)[_0x9fa1('0x26')](function(_0x3a00b7){_0x226823[_0x9fa1('0x1f')]=_0x3a00b7;if(_0x58ccd1[_0x9fa1('0x36')][_0x9fa1('0x47')]){_0x183a1b[_0x9fa1('0x48')]=[{'all':!![]}];}return db[_0x9fa1('0x31')][_0x9fa1('0x49')](_0x183a1b);})[_0x9fa1('0x26')](function(_0x53ed43){_0x226823[_0x9fa1('0x4a')]=_0x53ed43;return _0x226823;})[_0x9fa1('0x26')](respondWithFilteredResult(_0x215e92,_0x183a1b))[_0x9fa1('0x4b')](handleError(_0x215e92,null));};exports['show']=function(_0x375233,_0x1cb35a){var _0x236f3a={'raw':!![],'where':{'id':_0x375233[_0x9fa1('0x4c')]['id']}},_0x468aa5={};_0x468aa5[_0x9fa1('0x3b')]=_[_0x9fa1('0x37')](db['Variable'][_0x9fa1('0x32')]);_0x468aa5['query']=_['keys'](_0x375233['query']);_0x468aa5[_0x9fa1('0x38')]=_[_0x9fa1('0x39')](_0x468aa5[_0x9fa1('0x3b')],_0x468aa5[_0x9fa1('0x36')]);_0x236f3a['attributes']=_[_0x9fa1('0x39')](_0x468aa5[_0x9fa1('0x3b')],qs[_0x9fa1('0x3c')](_0x375233[_0x9fa1('0x36')][_0x9fa1('0x3c')]));_0x236f3a[_0x9fa1('0x3a')]=_0x236f3a[_0x9fa1('0x3a')]['length']?_0x236f3a['attributes']:_0x468aa5[_0x9fa1('0x3b')];if(_0x375233[_0x9fa1('0x36')][_0x9fa1('0x47')]){_0x236f3a['include']=[{'all':!![]}];}_0x236f3a=_['merge']({},_0x236f3a,_0x375233[_0x9fa1('0x46')]);return db['Variable']['find'](_0x236f3a)[_0x9fa1('0x26')](handleEntityNotFound(_0x1cb35a,null))['then'](respondWithResult(_0x1cb35a,null))[_0x9fa1('0x4b')](handleError(_0x1cb35a,null));};exports[_0x9fa1('0x4d')]=function(_0x27cd85,_0x4bccda){return db[_0x9fa1('0x31')][_0x9fa1('0x4d')](_0x27cd85[_0x9fa1('0x4e')],{})[_0x9fa1('0x26')](function(_0x2c5b42){var _0x479056=_0x27cd85['user'][_0x9fa1('0x28')]({'plain':!![]});if(!_0x479056)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x479056[_0x9fa1('0x4f')]===_0x9fa1('0x50')){var _0x310e62=_0x2c5b42[_0x9fa1('0x28')]({'plain':!![]});var _0x3cd322=_0x9fa1('0x29');return db['UserProfileSection'][_0x9fa1('0x51')]({'where':{'name':_0x3cd322,'userProfileId':_0x479056[_0x9fa1('0x52')]},'raw':!![]})[_0x9fa1('0x26')](function(_0x3de060){if(_0x3de060&&_0x3de060[_0x9fa1('0x53')]===0x0){return db[_0x9fa1('0x2a')]['create']({'name':_0x310e62['name'],'resourceId':_0x310e62['id'],'type':_0x3de060[_0x9fa1('0x2d')],'sectionId':_0x3de060['id']},{})[_0x9fa1('0x26')](function(){return _0x2c5b42;});}else{return _0x2c5b42;}})[_0x9fa1('0x4b')](function(_0x2366da){logger['error'](_0x9fa1('0x54'),_0x2366da);throw _0x2366da;});}return _0x2c5b42;})['then'](respondWithResult(_0x4bccda,0xc9))[_0x9fa1('0x4b')](handleError(_0x4bccda,null));};exports['update']=function(_0x3571f9,_0xbab52d){if(_0x3571f9[_0x9fa1('0x4e')]['id']){delete _0x3571f9[_0x9fa1('0x4e')]['id'];}return db['Variable']['find']({'where':{'id':_0x3571f9[_0x9fa1('0x4c')]['id']}})[_0x9fa1('0x26')](handleEntityNotFound(_0xbab52d,null))[_0x9fa1('0x26')](saveUpdates(_0x3571f9[_0x9fa1('0x4e')],null))[_0x9fa1('0x26')](respondWithResult(_0xbab52d,null))['catch'](handleError(_0xbab52d,null));};exports['destroy']=function(_0x33681d,_0x50341a){return db[_0x9fa1('0x31')][_0x9fa1('0x51')]({'where':{'id':_0x33681d['params']['id']}})[_0x9fa1('0x26')](handleEntityNotFound(_0x50341a,null))[_0x9fa1('0x26')](removeEntity(_0x50341a,null))[_0x9fa1('0x4b')](handleError(_0x50341a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dcdf8df..d9b2842 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 _0x10d2=['bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','api','moment'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x10d2,0x134));var _0x210d=function(_0x80e39b,_0x3376b8){_0x80e39b=_0x80e39b-0x0;var _0x10b224=_0x10d2[_0x80e39b];return _0x10b224;};'use strict';var _=require(_0x210d('0x0'));var util=require(_0x210d('0x1'));var logger=require('../../config/logger')(_0x210d('0x2'));var moment=require(_0x210d('0x3'));var BPromise=require(_0x210d('0x4'));var rp=require(_0x210d('0x5'));var fs=require('fs');var path=require(_0x210d('0x6'));var rimraf=require('rimraf');var config=require(_0x210d('0x7'));var attributes=require(_0x210d('0x8'));module[_0x210d('0x9')]=function(_0x24346e,_0x5a195a){return _0x24346e[_0x210d('0xa')](_0x210d('0xb'),attributes,{'tableName':_0x210d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c1b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger'];(function(_0x3cb53e,_0x1a6cfb){var _0x2548ce=function(_0x1a3638){while(--_0x1a3638){_0x3cb53e['push'](_0x3cb53e['shift']());}};_0x2548ce(++_0x1a6cfb);}(_0x1c1b,0x7b));var _0xb1c1=function(_0x508f55,_0x554fd7){_0x508f55=_0x508f55-0x0;var _0x42a1ee=_0x1c1b[_0x508f55];return _0x42a1ee;};'use strict';var _=require(_0xb1c1('0x0'));var util=require(_0xb1c1('0x1'));var logger=require(_0xb1c1('0x2'))(_0xb1c1('0x3'));var moment=require(_0xb1c1('0x4'));var BPromise=require(_0xb1c1('0x5'));var rp=require(_0xb1c1('0x6'));var fs=require('fs');var path=require(_0xb1c1('0x7'));var rimraf=require(_0xb1c1('0x8'));var config=require(_0xb1c1('0x9'));var attributes=require(_0xb1c1('0xa'));module[_0xb1c1('0xb')]=function(_0x3506f9,_0x5d48bf){return _0x3506f9[_0xb1c1('0xc')]('Variable',attributes,{'tableName':_0xb1c1('0xd'),'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 49a4bdc..9090d09 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x11748c,_0x87f9d7){var _0x341198=function(_0x3245ea){while(--_0x3245ea){_0x11748c['push'](_0x11748c['shift']());}};_0x341198(++_0x87f9d7);}(_0x814b,0x1a2));var _0xb814=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x814b[_0x2d982d];return _0x4f36b0;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x4897b5,_0x3d2e27){var _0x3adafe=function(_0x242665){while(--_0x242665){_0x4897b5['push'](_0x4897b5['shift']());}};_0x3adafe(++_0x3d2e27);}(_0xf494,0x1c6));var _0x4f49=function(_0x21dc86,_0x559f5a){_0x21dc86=_0x21dc86-0x0;var _0x317037=_0xf494[_0x21dc86];return _0x317037;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c1c4c9d..2c82db9 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 _0x1131=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','express'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x1131,0x10f));var _0x1113=function(_0x131034,_0x344d18){_0x131034=_0x131034-0x0;var _0x445d28=_0x1131[_0x131034];return _0x445d28;};'use strict';var express=require(_0x1113('0x0'));var router=express[_0x1113('0x1')]();var auth=require(_0x1113('0x2'));var controller=require(_0x1113('0x3'));router[_0x1113('0x4')]('/',controller[_0x1113('0x5')]);router[_0x1113('0x4')](_0x1113('0x6'),auth[_0x1113('0x7')](),auth['canUpdate'](),controller['fetch']);router['get'](_0x1113('0x8'),auth['isAuthenticated'](),auth[_0x1113('0x9')](),controller[_0x1113('0xa')]);router[_0x1113('0x4')](_0x1113('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1113('0xc')]);router[_0x1113('0x4')](_0x1113('0xd'),auth[_0x1113('0x7')](),controller[_0x1113('0xe')]);router[_0x1113('0x4')](_0x1113('0xf'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x76b0=['get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x76b0,0x1a0));var _0x076b=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x76b0[_0x4ae829];return _0x256b31;};'use strict';var express=require(_0x076b('0x0'));var router=express[_0x076b('0x1')]();var auth=require(_0x076b('0x2'));var controller=require(_0x076b('0x3'));router[_0x076b('0x4')]('/',controller[_0x076b('0x5')]);router[_0x076b('0x4')]('/fetch',auth[_0x076b('0x6')](),auth[_0x076b('0x7')](),controller[_0x076b('0x8')]);router[_0x076b('0x4')](_0x076b('0x9'),auth[_0x076b('0x6')](),auth[_0x076b('0x7')](),controller[_0x076b('0xa')]);router[_0x076b('0x4')](_0x076b('0xb'),auth[_0x076b('0x6')](),auth[_0x076b('0x7')](),controller[_0x076b('0xc')]);router['get']('/restart',auth[_0x076b('0x6')](),controller['restart']);router[_0x076b('0x4')](_0x076b('0xd'),controller['migrations']);module[_0x076b('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index aaae7b4..1440224 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 _0x51d7=['.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','tags','exports','2.0.0','json','status','fetch','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length','replace','push','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.','join','map'];(function(_0x555790,_0x5ed6c9){var _0x231650=function(_0x4260a1){while(--_0x4260a1){_0x555790['push'](_0x555790['shift']());}};_0x231650(++_0x5ed6c9);}(_0x51d7,0x18e));var _0x751d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x51d7[_0x19950b];return _0x3c6b41;};'use strict';var Umzug=require(_0x751d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x751d('0x1'));var pkginfo=require(_0x751d('0x2'))(module,_0x751d('0x3'));var compareVersions=require(_0x751d('0x4'));var exec=require(_0x751d('0x5'))[_0x751d('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x751d('0x7'));var pm2=require(_0x751d('0x8'));var logger=require(_0x751d('0x9'))(_0x751d('0xa'));var git=require(_0x751d('0xb'))(config['root']);exports[_0x751d('0xc')]=function(_0x4fd4e1,_0x42c5a9){var _0x22b224={'current':module['exports'][_0x751d('0x3')],'phonebar':0x2};if(_0x4fd4e1['query']&&_0x4fd4e1[_0x751d('0xd')][_0x751d('0xe')]){return git['fetch']()[_0x751d('0xf')](function(_0x64daac,_0x30be9a){_0x22b224[_0x751d('0xe')]=(_0x64daac?module[_0x751d('0x10')][_0x751d('0x3')]:_0x30be9a['latest'])||_0x751d('0x11');return _0x42c5a9['status'](0xc8)[_0x751d('0x12')](_0x22b224);});}else{return _0x42c5a9[_0x751d('0x13')](0xc8)[_0x751d('0x12')](_0x22b224);}};exports[_0x751d('0x14')]=function(_0x8efede,_0x1a6253){return git[_0x751d('0x14')]([_0x751d('0x15'),'master'],function(_0x3e7025){if(_0x3e7025){logger['error'](_0x3e7025);return _0x1a6253[_0x751d('0x13')](0x1f4)[_0x751d('0x12')](_0x3e7025);}logger[_0x751d('0x16')](_0x751d('0x17'));return _0x1a6253[_0x751d('0x13')](0xc8)[_0x751d('0x12')]({'output':_0x751d('0x18')});});};exports['reset']=function(_0x4cff66,_0x4a63c1){return git['reset']([_0x751d('0x19'),_0x751d('0x1a')],function(_0x59121a){if(_0x59121a){logger[_0x751d('0x1b')](_0x59121a);return _0x4a63c1[_0x751d('0x13')](0x1f4)[_0x751d('0x12')](_0x59121a);}logger[_0x751d('0x16')](_0x751d('0x1c'));return _0x4a63c1[_0x751d('0x13')](0xc8)['json']({'output':_0x751d('0x1d')});});};exports[_0x751d('0x1e')]=function(_0x45c9b5,_0x5722a6){exec('npm\x20install\x20--production',function(_0x4ea06d,_0x222212,_0x2719fd){logger[_0x751d('0x16')](_0x222212);logger[_0x751d('0x16')](_0x2719fd);if(_0x4ea06d){logger[_0x751d('0x1b')](_0x4ea06d);return _0x5722a6['status'](0x1f4)[_0x751d('0x12')](_0x4ea06d);}return _0x5722a6[_0x751d('0x13')](0xc8)['json']({'output':_0x222212});});};exports[_0x751d('0x1f')]=function(_0x9cdc07,_0x3f1785){return pm2['restart']('motion2')['then'](function(_0x1734bd){logger['info'](_0x751d('0x20'),_0x1734bd);return _0x3f1785['status'](0xc8)[_0x751d('0x12')]({'output':_0x751d('0x21')});})[_0x751d('0x22')](function(_0x2f09c9){logger[_0x751d('0x1b')](_0x2f09c9);return _0x3f1785[_0x751d('0x13')](0x1f4)[_0x751d('0x12')](_0x2f09c9);});};exports[_0x751d('0x23')]=function(_0x390442,_0x59e471){var _0x3afd79=fs[_0x751d('0x24')](path['join'](config[_0x751d('0x25')],_0x751d('0x26'),_0x751d('0x23')));var _0x1ffb29=[];for(var _0x365030=0x0;_0x365030<_0x3afd79[_0x751d('0x27')];_0x365030++){var _0x5ea95a=_0x3afd79[_0x365030][_0x751d('0x28')]('.js','');if(compareVersions(module[_0x751d('0x10')]['version'],_0x5ea95a)===-0x1){_0x1ffb29[_0x751d('0x29')](_0x5ea95a);}}if(_0x1ffb29[_0x751d('0x27')]){var _0x750ef9=_0x1ffb29[_0x751d('0x2a')](compareVersions);var _0x2b36b0=new Umzug({'storage':_0x751d('0x2b'),'storageOptions':{'model':db[_0x751d('0x2c')],'modelName':_0x751d('0x2c'),'columnName':_0x751d('0x3')},'migrations':{'params':[db[_0x751d('0x2b')][_0x751d('0x2d')](),db[_0x751d('0x2b')][_0x751d('0x2e')],function(){throw new Error(_0x751d('0x2f'));}],'path':path[_0x751d('0x30')](config[_0x751d('0x25')],'server',_0x751d('0x23')),'pattern':/\.js$/}});_0x2b36b0['up']({'migrations':_[_0x751d('0x31')](_0x750ef9,function(_0x3cff61){return _0x3cff61+_0x751d('0x32');})})[_0x751d('0x33')](function(){return _0x59e471['status'](0xc8)['json']({'output':_0x751d('0x34')+module[_0x751d('0x10')][_0x751d('0x3')]+_0x751d('0x35')+_[_0x751d('0x36')](_0x750ef9),'migrations':_[_0x751d('0x30')](_0x750ef9)});})[_0x751d('0x22')](function(_0x1e3623){if(_0x1e3623 instanceof db['sequelize']['UniqueConstraintError']){return _0x59e471[_0x751d('0x13')](0xc8)[_0x751d('0x12')]({'output':_0x751d('0x37')});}else{return _0x59e471['status'](0x1f4)[_0x751d('0x12')](_0x1e3623);}});}else{return _0x59e471[_0x751d('0x13')](0xc8)[_0x751d('0x12')]({'output':_0x751d('0x37')});}}; \ No newline at end of file +var _0x1192=['lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path'];(function(_0x6e6118,_0x24c254){var _0x24b995=function(_0x1444c9){while(--_0x1444c9){_0x6e6118['push'](_0x6e6118['shift']());}};_0x24b995(++_0x24c254);}(_0x1192,0xda));var _0x2119=function(_0x4e0964,_0x4c179b){_0x4e0964=_0x4e0964-0x0;var _0x34eadf=_0x1192[_0x4e0964];return _0x34eadf;};'use strict';var Umzug=require(_0x2119('0x0'));var path=require(_0x2119('0x1'));var fs=require('fs');var _=require(_0x2119('0x2'));var pkginfo=require(_0x2119('0x3'))(module,_0x2119('0x4'));var compareVersions=require(_0x2119('0x5'));var exec=require(_0x2119('0x6'))[_0x2119('0x7')];var db=require(_0x2119('0x8'))['db'];var config=require(_0x2119('0x9'));var pm2=require(_0x2119('0xa'));var logger=require('../../config/logger')(_0x2119('0xb'));var git=require('simple-git')(config[_0x2119('0xc')]);exports[_0x2119('0xd')]=function(_0x528bc2,_0xb988c3){var _0x7d9cfd={'current':module[_0x2119('0xe')][_0x2119('0x4')],'phonebar':0x2};if(_0x528bc2[_0x2119('0xf')]&&_0x528bc2[_0x2119('0xf')]['latest']){return git[_0x2119('0x10')]()[_0x2119('0x11')](function(_0x1f3382,_0x6131f){_0x7d9cfd[_0x2119('0x12')]=(_0x1f3382?module[_0x2119('0xe')][_0x2119('0x4')]:_0x6131f['latest'])||_0x2119('0x13');return _0xb988c3[_0x2119('0x14')](0xc8)[_0x2119('0x15')](_0x7d9cfd);});}else{return _0xb988c3[_0x2119('0x14')](0xc8)['json'](_0x7d9cfd);}};exports[_0x2119('0x10')]=function(_0x363b15,_0x3df580){return git[_0x2119('0x10')]([_0x2119('0x16'),_0x2119('0x17')],function(_0x1b7eed){if(_0x1b7eed){logger[_0x2119('0x18')](_0x1b7eed);return _0x3df580[_0x2119('0x14')](0x1f4)[_0x2119('0x15')](_0x1b7eed);}logger['info'](_0x2119('0x19'));return _0x3df580['status'](0xc8)['json']({'output':_0x2119('0x1a')});});};exports['reset']=function(_0x31192f,_0x4c0df0){return git['reset']([_0x2119('0x1b'),_0x2119('0x1c')],function(_0x3d6ffb){if(_0x3d6ffb){logger['error'](_0x3d6ffb);return _0x4c0df0[_0x2119('0x14')](0x1f4)[_0x2119('0x15')](_0x3d6ffb);}logger[_0x2119('0x1d')](_0x2119('0x1e'));return _0x4c0df0[_0x2119('0x14')](0xc8)[_0x2119('0x15')]({'output':_0x2119('0x1f')});});};exports['pull']=function(_0x3c29d7,_0x360ab3){exec(_0x2119('0x20'),function(_0x37b72b,_0x4f94ea,_0x4fad34){logger[_0x2119('0x1d')](_0x4f94ea);logger['info'](_0x4fad34);if(_0x37b72b){logger[_0x2119('0x18')](_0x37b72b);return _0x360ab3[_0x2119('0x14')](0x1f4)['json'](_0x37b72b);}return _0x360ab3[_0x2119('0x14')](0xc8)[_0x2119('0x15')]({'output':_0x4f94ea});});};exports['restart']=function(_0x26312f,_0x1db0da){return pm2[_0x2119('0x21')](_0x2119('0x22'))['then'](function(_0x39953b){logger[_0x2119('0x1d')](_0x2119('0x23'),_0x39953b);return _0x1db0da['status'](0xc8)[_0x2119('0x15')]({'output':_0x2119('0x24')});})[_0x2119('0x25')](function(_0x48b9cd){logger[_0x2119('0x18')](_0x48b9cd);return _0x1db0da[_0x2119('0x14')](0x1f4)[_0x2119('0x15')](_0x48b9cd);});};exports[_0x2119('0x26')]=function(_0x5351f1,_0x442fc6){var _0x342bbd=fs[_0x2119('0x27')](path['join'](config[_0x2119('0xc')],_0x2119('0x28'),_0x2119('0x26')));var _0x9e0f36=[];for(var _0x3afdf6=0x0;_0x3afdf6<_0x342bbd[_0x2119('0x29')];_0x3afdf6++){var _0x540457=_0x342bbd[_0x3afdf6][_0x2119('0x2a')]('.js','');if(compareVersions(module[_0x2119('0xe')][_0x2119('0x4')],_0x540457)===-0x1){_0x9e0f36[_0x2119('0x2b')](_0x540457);}}if(_0x9e0f36[_0x2119('0x29')]){var _0x3334f0=_0x9e0f36['sort'](compareVersions);var _0x537cfe=new Umzug({'storage':_0x2119('0x2c'),'storageOptions':{'model':db[_0x2119('0x2d')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x2119('0x2c')][_0x2119('0x2e')](),db[_0x2119('0x2c')]['constructor'],function(){throw new Error(_0x2119('0x2f'));}],'path':path[_0x2119('0x30')](config['root'],'server',_0x2119('0x26')),'pattern':/\.js$/}});_0x537cfe['up']({'migrations':_['map'](_0x3334f0,function(_0x19db0c){return _0x19db0c+_0x2119('0x31');})})[_0x2119('0x32')](function(){return _0x442fc6[_0x2119('0x14')](0xc8)['json']({'output':_0x2119('0x33')+module[_0x2119('0xe')]['version']+'\x20to\x20'+_[_0x2119('0x34')](_0x3334f0),'migrations':_[_0x2119('0x30')](_0x3334f0)});})[_0x2119('0x25')](function(_0x6a62e){if(_0x6a62e instanceof db[_0x2119('0x2c')][_0x2119('0x35')]){return _0x442fc6['status'](0xc8)['json']({'output':_0x2119('0x36')});}else{return _0x442fc6['status'](0x1f4)['json'](_0x6a62e);}});}else{return _0x442fc6[_0x2119('0x14')](0xc8)['json']({'output':_0x2119('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index e77eba5..1450193 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 _0xfe22=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','describe','show','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x451e1e,_0x123d75){var _0x4cfd6e=function(_0x188a4c){while(--_0x188a4c){_0x451e1e['push'](_0x451e1e['shift']());}};_0x4cfd6e(++_0x123d75);}(_0xfe22,0xad));var _0x2fe2=function(_0x3fab4a,_0x50eea0){_0x3fab4a=_0x3fab4a-0x0;var _0x37be5f=_0xfe22[_0x3fab4a];return _0x37be5f;};'use strict';var multer=require(_0x2fe2('0x0'));var util=require(_0x2fe2('0x1'));var path=require(_0x2fe2('0x2'));var timeout=require(_0x2fe2('0x3'));var express=require(_0x2fe2('0x4'));var router=express[_0x2fe2('0x5')]();var fs_extra=require(_0x2fe2('0x6'));var auth=require(_0x2fe2('0x7'));var interaction=require(_0x2fe2('0x8'));var config=require(_0x2fe2('0x9'));var controller=require(_0x2fe2('0xa'));router['get']('/',auth[_0x2fe2('0xb')](),controller[_0x2fe2('0xc')]);router[_0x2fe2('0xd')]('/describe',auth[_0x2fe2('0xb')](),controller[_0x2fe2('0xe')]);router[_0x2fe2('0xd')]('/:id',auth[_0x2fe2('0xb')](),controller[_0x2fe2('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2fe2('0x10')]);router[_0x2fe2('0x11')](_0x2fe2('0x12'),auth['isAuthenticated'](),controller[_0x2fe2('0x13')]);router['delete'](_0x2fe2('0x12'),auth[_0x2fe2('0xb')](),controller[_0x2fe2('0x14')]);module[_0x2fe2('0x15')]=router; \ No newline at end of file +var _0x583b=['isAuthenticated','describe','get','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','/describe'];(function(_0x3e469f,_0x1a4066){var _0x3b1e8f=function(_0x2640c2){while(--_0x2640c2){_0x3e469f['push'](_0x3e469f['shift']());}};_0x3b1e8f(++_0x1a4066);}(_0x583b,0x81));var _0xb583=function(_0x470346,_0x2854d3){_0x470346=_0x470346-0x0;var _0x5788c6=_0x583b[_0x470346];return _0x5788c6;};'use strict';var multer=require(_0xb583('0x0'));var util=require(_0xb583('0x1'));var path=require(_0xb583('0x2'));var timeout=require(_0xb583('0x3'));var express=require('express');var router=express[_0xb583('0x4')]();var fs_extra=require(_0xb583('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb583('0x6'));var config=require(_0xb583('0x7'));var controller=require(_0xb583('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb583('0x9')]);router['get'](_0xb583('0xa'),auth[_0xb583('0xb')](),controller[_0xb583('0xc')]);router[_0xb583('0xd')](_0xb583('0xe'),auth[_0xb583('0xb')](),controller['show']);router[_0xb583('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb583('0x10')](_0xb583('0xe'),auth[_0xb583('0xb')](),controller[_0xb583('0x11')]);router[_0xb583('0x12')]('/:id',auth[_0xb583('0xb')](),controller[_0xb583('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a71a946..32e5938 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaa8=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdaa8,0xe4));var _0x8daa=function(_0x20e1af,_0x3ebe95){_0x20e1af=_0x20e1af-0x0;var _0x572b6c=_0xdaa8[_0x20e1af];return _0x572b6c;};'use strict';var Sequelize=require(_0x8daa('0x0'));module[_0x8daa('0x1')]={'type':{'type':Sequelize[_0x8daa('0x2')]},'uniqueid':{'type':Sequelize[_0x8daa('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x8daa('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8daa('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8daa('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8daa('0x5')]},'agentacw':{'type':Sequelize[_0x8daa('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8daa('0x5')]},'reason':{'type':Sequelize[_0x8daa('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8daa('0x2')]},'channelstate':{'type':Sequelize[_0x8daa('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8daa('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8daa('0x2')]},'connectedlinename':{'type':Sequelize[_0x8daa('0x2')]},'language':{'type':Sequelize[_0x8daa('0x2')]},'accountcode':{'type':Sequelize[_0x8daa('0x2')]},'context':{'type':Sequelize[_0x8daa('0x2')]},'exten':{'type':Sequelize[_0x8daa('0x2')]},'priority':{'type':Sequelize[_0x8daa('0x2')]},'destchannel':{'type':Sequelize[_0x8daa('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8daa('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8daa('0x2')]},'destcalleridname':{'type':Sequelize[_0x8daa('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8daa('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8daa('0x2')]},'destcontext':{'type':Sequelize[_0x8daa('0x2')]},'destexten':{'type':Sequelize[_0x8daa('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8daa('0x2')],'comment':_0x8daa('0x6')},'transferexten':{'type':Sequelize[_0x8daa('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8daa('0x2')]},'agententerreason':{'type':Sequelize[_0x8daa('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa28=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x42a912,_0x188199){var _0x440e8f=function(_0x41a8b3){while(--_0x41a8b3){_0x42a912['push'](_0x42a912['shift']());}};_0x440e8f(++_0x188199);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xfa28[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0x8fa2('0x0'));module[_0x8fa2('0x1')]={'type':{'type':Sequelize[_0x8fa2('0x2')]},'uniqueid':{'type':Sequelize[_0x8fa2('0x2')]},'calleridnum':{'type':Sequelize[_0x8fa2('0x2')]},'calleridname':{'type':Sequelize[_0x8fa2('0x2')]},'queue':{'type':Sequelize[_0x8fa2('0x2')]},'interface':{'type':Sequelize[_0x8fa2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8fa2('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8fa2('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8fa2('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8fa2('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8fa2('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8fa2('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8fa2('0x5')]},'reason':{'type':Sequelize[_0x8fa2('0x2')]},'lastevent':{'type':Sequelize[_0x8fa2('0x2')]},'channel':{'type':Sequelize[_0x8fa2('0x2')]},'channelstate':{'type':Sequelize[_0x8fa2('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8fa2('0x2')]},'language':{'type':Sequelize[_0x8fa2('0x2')]},'accountcode':{'type':Sequelize[_0x8fa2('0x2')]},'context':{'type':Sequelize[_0x8fa2('0x2')]},'exten':{'type':Sequelize[_0x8fa2('0x2')]},'priority':{'type':Sequelize[_0x8fa2('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8fa2('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x8fa2('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8fa2('0x2')]},'destcalleridname':{'type':Sequelize[_0x8fa2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8fa2('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8fa2('0x2')]},'destcontext':{'type':Sequelize[_0x8fa2('0x2')]},'destexten':{'type':Sequelize[_0x8fa2('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8fa2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8fa2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8fa2('0x2')]},'transfer':{'type':Sequelize[_0x8fa2('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8fa2('0x2')],'comment':_0x8fa2('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8fa2('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 81de506..4f79bb3 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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 9d518de..e96e4a0 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 _0xc5c7=['request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x39eacd,_0x45be50){var _0x2e5859=function(_0x379e21){while(--_0x379e21){_0x39eacd['push'](_0x39eacd['shift']());}};_0x2e5859(++_0x45be50);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x46fa91,_0x213ec8){_0x46fa91=_0x46fa91-0x0;var _0x56c9a1=_0xc5c7[_0x46fa91];return _0x56c9a1;};'use strict';var _=require('lodash');var util=require(_0x7c5c('0x0'));var logger=require(_0x7c5c('0x1'))(_0x7c5c('0x2'));var moment=require(_0x7c5c('0x3'));var BPromise=require(_0x7c5c('0x4'));var rp=require(_0x7c5c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c5c('0x6'));var config=require(_0x7c5c('0x7'));var attributes=require(_0x7c5c('0x8'));module[_0x7c5c('0x9')]=function(_0x1dc034,_0x4dd500){return _0x1dc034['define'](_0x7c5c('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7c5c('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x14f5=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','util','api','moment','bluebird','path','rimraf'];(function(_0x2dbfa7,_0x1e0f4b){var _0x11b00d=function(_0x35dac5){while(--_0x35dac5){_0x2dbfa7['push'](_0x2dbfa7['shift']());}};_0x11b00d(++_0x1e0f4b);}(_0x14f5,0xae));var _0x514f=function(_0x36b4ba,_0x41534e){_0x36b4ba=_0x36b4ba-0x0;var _0x45517f=_0x14f5[_0x36b4ba];return _0x45517f;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var logger=require('../../config/logger')(_0x514f('0x1'));var moment=require(_0x514f('0x2'));var BPromise=require(_0x514f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x514f('0x4'));var rimraf=require(_0x514f('0x5'));var config=require('../../config/environment');var attributes=require(_0x514f('0x6'));module[_0x514f('0x7')]=function(_0xc2ca56,_0x434452){return _0xc2ca56[_0x514f('0x8')](_0x514f('0x9'),attributes,{'tableName':_0x514f('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x514f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2477398..5535451 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 _0xdc13=['debug','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceAgentReport','create','body','options','raw','then'];(function(_0x36ead7,_0xc7eae0){var _0x1c713a=function(_0x1b3fef){while(--_0x1b3fef){_0x36ead7['push'](_0x36ead7['shift']());}};_0x1c713a(++_0xc7eae0);}(_0xdc13,0xed));var _0x3dc1=function(_0x1aaf44,_0x2cbcf3){_0x1aaf44=_0x1aaf44-0x0;var _0x40f422=_0xdc13[_0x1aaf44];return _0x40f422;};'use strict';var _=require(_0x3dc1('0x0'));var util=require('util');var moment=require(_0x3dc1('0x1'));var BPromise=require('bluebird');var rs=require(_0x3dc1('0x2'));var fs=require('fs');var Redis=require(_0x3dc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dc1('0x4'));var logger=require(_0x3dc1('0x5'))(_0x3dc1('0x6'));var config=require('../../config/environment');var jayson=require(_0x3dc1('0x7'));var client=jayson[_0x3dc1('0x8')][_0x3dc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x419075,_0x1bb111,_0x2646ab){return new BPromise(function(_0x47d1b5,_0x4d0cab){return client[_0x3dc1('0xa')](_0x419075,_0x2646ab)['then'](function(_0x5c645d){logger['info'](_0x3dc1('0xb'),_0x1bb111,_0x3dc1('0xc'));logger['debug'](_0x3dc1('0xd'),_0x1bb111,_0x3dc1('0xc'),JSON[_0x3dc1('0xe')](_0x5c645d));if(_0x5c645d[_0x3dc1('0xf')]){if(_0x5c645d[_0x3dc1('0xf')][_0x3dc1('0x10')]===0x1f4){logger[_0x3dc1('0xf')](_0x3dc1('0xb'),_0x1bb111,_0x5c645d[_0x3dc1('0xf')][_0x3dc1('0x11')]);return _0x4d0cab(_0x5c645d[_0x3dc1('0xf')][_0x3dc1('0x11')]);}logger[_0x3dc1('0xf')](_0x3dc1('0xb'),_0x1bb111,_0x5c645d[_0x3dc1('0xf')][_0x3dc1('0x11')]);return _0x47d1b5(_0x5c645d[_0x3dc1('0xf')]['message']);}else{logger[_0x3dc1('0x12')](_0x3dc1('0xb'),_0x1bb111,_0x3dc1('0xc'));_0x47d1b5(_0x5c645d[_0x3dc1('0x13')][_0x3dc1('0x11')]);}})[_0x3dc1('0x14')](function(_0xa643c0){logger[_0x3dc1('0xf')](_0x3dc1('0xb'),_0x1bb111,_0xa643c0);_0x4d0cab(_0xa643c0);});});}exports['CreateVoiceAgentReport']=function(_0x2cc79c){var _0x59c4c7=this;return new Promise(function(_0x251aaf,_0x416363){return db[_0x3dc1('0x15')][_0x3dc1('0x16')](_0x2cc79c[_0x3dc1('0x17')],{'raw':_0x2cc79c[_0x3dc1('0x18')]?_0x2cc79c[_0x3dc1('0x18')][_0x3dc1('0x19')]===undefined?!![]:![]:!![]})[_0x3dc1('0x1a')](function(_0x227a0a){logger[_0x3dc1('0x12')]('CreateVoiceAgentReport',_0x2cc79c);logger[_0x3dc1('0x1b')](_0x3dc1('0x1c'),_0x2cc79c,JSON[_0x3dc1('0xe')](_0x227a0a));_0x251aaf(_0x227a0a);})[_0x3dc1('0x14')](function(_0x2e2122){logger[_0x3dc1('0xf')](_0x3dc1('0x1c'),_0x2e2122[_0x3dc1('0x11')],_0x2cc79c);_0x416363(_0x59c4c7['error'](0x1f4,_0x2e2122[_0x3dc1('0x11')]));});});};exports[_0x3dc1('0x1d')]=function(_0x3e10e1){var _0x2ca105=this;return new Promise(function(_0x5d1255,_0x4bd96c){return db[_0x3dc1('0x15')]['update'](_0x3e10e1['body'],{'raw':_0x3e10e1[_0x3dc1('0x18')]?_0x3e10e1[_0x3dc1('0x18')][_0x3dc1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e10e1[_0x3dc1('0x18')]?_0x3e10e1[_0x3dc1('0x18')][_0x3dc1('0x1e')]||null:null,'attributes':_0x3e10e1['options']?_0x3e10e1[_0x3dc1('0x18')][_0x3dc1('0x1f')]||null:null,'limit':_0x3e10e1[_0x3dc1('0x18')]?_0x3e10e1['options'][_0x3dc1('0x20')]||null:null})[_0x3dc1('0x1a')](function(_0x5c5a56){logger[_0x3dc1('0x12')](_0x3dc1('0x1d'),_0x3e10e1);logger[_0x3dc1('0x1b')]('UpdateVoiceAgentReport',_0x3e10e1,JSON[_0x3dc1('0xe')](_0x5c5a56));_0x5d1255(_0x5c5a56);})[_0x3dc1('0x14')](function(_0x7aa51e){logger['error']('UpdateVoiceAgentReport',_0x7aa51e[_0x3dc1('0x11')],_0x3e10e1);_0x4bd96c(_0x2ca105['error'](0x1f4,_0x7aa51e['message']));});});}; \ No newline at end of file +var _0x604b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','stringify','UpdateVoiceAgentReport','update','body','where','attributes','limit'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x604b,0xaf));var _0xb604=function(_0x2b958d,_0x1828c3){_0x2b958d=_0x2b958d-0x0;var _0xe2c3c4=_0x604b[_0x2b958d];return _0xe2c3c4;};'use strict';var _=require(_0xb604('0x0'));var util=require(_0xb604('0x1'));var moment=require(_0xb604('0x2'));var BPromise=require(_0xb604('0x3'));var rs=require(_0xb604('0x4'));var fs=require('fs');var Redis=require(_0xb604('0x5'));var db=require(_0xb604('0x6'))['db'];var utils=require(_0xb604('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb604('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb604('0x9')][_0xb604('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d2ca3,_0x7b6ce3,_0x5e71a1){return new BPromise(function(_0x3e0a13,_0xf8a9cf){return client[_0xb604('0xb')](_0x1d2ca3,_0x5e71a1)[_0xb604('0xc')](function(_0x21ae73){logger[_0xb604('0xd')](_0xb604('0xe'),_0x7b6ce3,_0xb604('0xf'));logger['debug'](_0xb604('0x10'),_0x7b6ce3,_0xb604('0xf'),JSON['stringify'](_0x21ae73));if(_0x21ae73[_0xb604('0x11')]){if(_0x21ae73[_0xb604('0x11')][_0xb604('0x12')]===0x1f4){logger['error'](_0xb604('0xe'),_0x7b6ce3,_0x21ae73[_0xb604('0x11')]['message']);return _0xf8a9cf(_0x21ae73[_0xb604('0x11')]['message']);}logger['error'](_0xb604('0xe'),_0x7b6ce3,_0x21ae73[_0xb604('0x11')]['message']);return _0x3e0a13(_0x21ae73[_0xb604('0x11')]['message']);}else{logger['info'](_0xb604('0xe'),_0x7b6ce3,_0xb604('0xf'));_0x3e0a13(_0x21ae73[_0xb604('0x13')][_0xb604('0x14')]);}})[_0xb604('0x15')](function(_0x486a1e){logger[_0xb604('0x11')](_0xb604('0xe'),_0x7b6ce3,_0x486a1e);_0xf8a9cf(_0x486a1e);});});}exports[_0xb604('0x16')]=function(_0x298eab){var _0x4c0655=this;return new Promise(function(_0x53c661,_0x285109){return db[_0xb604('0x17')][_0xb604('0x18')](_0x298eab['body'],{'raw':_0x298eab[_0xb604('0x19')]?_0x298eab[_0xb604('0x19')][_0xb604('0x1a')]===undefined?!![]:![]:!![]})[_0xb604('0xc')](function(_0x49e285){logger['info'](_0xb604('0x16'),_0x298eab);logger[_0xb604('0x1b')]('CreateVoiceAgentReport',_0x298eab,JSON[_0xb604('0x1c')](_0x49e285));_0x53c661(_0x49e285);})[_0xb604('0x15')](function(_0x1ddc53){logger[_0xb604('0x11')](_0xb604('0x16'),_0x1ddc53[_0xb604('0x14')],_0x298eab);_0x285109(_0x4c0655[_0xb604('0x11')](0x1f4,_0x1ddc53[_0xb604('0x14')]));});});};exports[_0xb604('0x1d')]=function(_0x1bd5d6){var _0x4a9abc=this;return new Promise(function(_0x2530cb,_0x49330c){return db['VoiceAgentReport'][_0xb604('0x1e')](_0x1bd5d6[_0xb604('0x1f')],{'raw':_0x1bd5d6[_0xb604('0x19')]?_0x1bd5d6[_0xb604('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd5d6[_0xb604('0x19')]?_0x1bd5d6[_0xb604('0x19')][_0xb604('0x20')]||null:null,'attributes':_0x1bd5d6[_0xb604('0x19')]?_0x1bd5d6[_0xb604('0x19')][_0xb604('0x21')]||null:null,'limit':_0x1bd5d6[_0xb604('0x19')]?_0x1bd5d6[_0xb604('0x19')][_0xb604('0x22')]||null:null})[_0xb604('0xc')](function(_0xfafaa7){logger[_0xb604('0xd')]('UpdateVoiceAgentReport',_0x1bd5d6);logger[_0xb604('0x1b')](_0xb604('0x1d'),_0x1bd5d6,JSON[_0xb604('0x1c')](_0xfafaa7));_0x2530cb(_0xfafaa7);})['catch'](function(_0x328fec){logger['error'](_0xb604('0x1d'),_0x328fec['message'],_0x1bd5d6);_0x49330c(_0x4a9abc[_0xb604('0x11')](0x1f4,_0x328fec['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f12a253..e1928aa 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 _0x5089=['show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x5089,0x1bb));var _0x9508=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x5089[_0x12e073];return _0x267748;};'use strict';var multer=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var path=require('path');var timeout=require(_0x9508('0x2'));var express=require(_0x9508('0x3'));var router=express[_0x9508('0x4')]();var fs_extra=require(_0x9508('0x5'));var auth=require(_0x9508('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9508('0x7'));var controller=require('./voiceCallReport.controller');router[_0x9508('0x8')]('/',auth[_0x9508('0x9')](),controller[_0x9508('0xa')]);router['get'](_0x9508('0xb'),auth[_0x9508('0x9')](),controller['describe']);router[_0x9508('0x8')](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0xd')]);router['post']('/',auth[_0x9508('0x9')](),controller[_0x9508('0xe')]);router[_0x9508('0xf')](_0x9508('0xc'),auth[_0x9508('0x9')](),controller[_0x9508('0x10')]);router['delete'](_0x9508('0xc'),auth['isAuthenticated'](),controller[_0x9508('0x11')]);module[_0x9508('0x12')]=router; \ No newline at end of file +var _0xdb94=['/describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','index','get'];(function(_0x3b43eb,_0x459e31){var _0x415773=function(_0x4e4b84){while(--_0x4e4b84){_0x3b43eb['push'](_0x3b43eb['shift']());}};_0x415773(++_0x459e31);}(_0xdb94,0xe5));var _0x4db9=function(_0x133fbc,_0x3c24b6){_0x133fbc=_0x133fbc-0x0;var _0x443d69=_0xdb94[_0x133fbc];return _0x443d69;};'use strict';var multer=require('multer');var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db9('0x2'));var router=express[_0x4db9('0x3')]();var fs_extra=require(_0x4db9('0x4'));var auth=require(_0x4db9('0x5'));var interaction=require(_0x4db9('0x6'));var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0xa')](_0x4db9('0xb'),auth[_0x4db9('0x8')](),controller['describe']);router[_0x4db9('0xa')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0xd')]);router[_0x4db9('0xe')]('/',auth['isAuthenticated'](),controller[_0x4db9('0xf')]);router[_0x4db9('0x10')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0x11')]);router[_0x4db9('0x12')]('/:id',auth[_0x4db9('0x8')](),controller[_0x4db9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6677a10..fe0999a 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 _0xc50c=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x5e20f2,_0x4734e7){var _0x516401=function(_0x248862){while(--_0x248862){_0x5e20f2['push'](_0x5e20f2['shift']());}};_0x516401(++_0x4734e7);}(_0xc50c,0x11d));var _0xcc50=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc50c[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xcc50('0x0'));module[_0xcc50('0x1')]={'uniqueid':{'type':Sequelize[_0xcc50('0x2')]},'type':{'type':Sequelize[_0xcc50('0x3')](_0xcc50('0x4'),_0xcc50('0x5'),_0xcc50('0x6'),_0xcc50('0x7'),_0xcc50('0x8'),_0xcc50('0x9'))},'tag':{'type':Sequelize[_0xcc50('0x2')]},'accountcode':{'type':Sequelize[_0xcc50('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xcc50('0x2')]},'destinationcontext':{'type':Sequelize[_0xcc50('0x2')]},'callerid':{'type':Sequelize[_0xcc50('0x2')]},'channel':{'type':Sequelize[_0xcc50('0x2')]},'destinationchannel':{'type':Sequelize[_0xcc50('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xcc50('0xa')]},'starttime':{'type':Sequelize[_0xcc50('0xb')]},'systemanswertime':{'type':Sequelize[_0xcc50('0xb')]},'answertime':{'type':Sequelize[_0xcc50('0xb')]},'endtime':{'type':Sequelize[_0xcc50('0xb')]},'duration':{'type':Sequelize[_0xcc50('0xc')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xcc50('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcc50('0x2')]},'amaflags':{'type':Sequelize[_0xcc50('0x2')]},'userfield':{'type':Sequelize[_0xcc50('0x2')]},'userDisposition':{'type':Sequelize[_0xcc50('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xcc50('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xcc50('0x2')]},'note':{'type':Sequelize[_0xcc50('0x2')]},'prefix':{'type':Sequelize[_0xcc50('0x2')]},'routeid':{'type':Sequelize[_0xcc50('0xc')]},'sipcallid':{'type':Sequelize[_0xcc50('0x2')]}}; \ No newline at end of file +var _0xa3a4=['sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xa3a4,0x6e));var _0x4a3a=function(_0x2374e5,_0x5d3d21){_0x2374e5=_0x2374e5-0x0;var _0x5ed037=_0xa3a4[_0x2374e5];return _0x5ed037;};'use strict';var Sequelize=require(_0x4a3a('0x0'));module[_0x4a3a('0x1')]={'uniqueid':{'type':Sequelize[_0x4a3a('0x2')]},'type':{'type':Sequelize[_0x4a3a('0x3')]('inbound',_0x4a3a('0x4'),_0x4a3a('0x5'),_0x4a3a('0x6'),_0x4a3a('0x7'),'dialer')},'tag':{'type':Sequelize[_0x4a3a('0x2')]},'accountcode':{'type':Sequelize[_0x4a3a('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x4a3a('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4a3a('0x2')]},'destinationchannel':{'type':Sequelize[_0x4a3a('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x4a3a('0x8')]},'systemanswertime':{'type':Sequelize[_0x4a3a('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4a3a('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x4a3a('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4a3a('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4a3a('0x2')]},'userDisposition':{'type':Sequelize[_0x4a3a('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4a3a('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x4a3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index bc88826..d4450da 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x581f13,_0x26d27e){var _0x48ceec=function(_0x48f8b1){while(--_0x48f8b1){_0x581f13['push'](_0x581f13['shift']());}};_0x48ceec(++_0x26d27e);}(_0xdb28,0x106));var _0x8db2=function(_0x19f95b,_0x8b6dab){_0x19f95b=_0x19f95b-0x0;var _0x2d580a=_0xdb28[_0x19f95b];return _0x2d580a;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0xadb5,0xad));var _0x5adb=function(_0x269266,_0x298d3e){_0x269266=_0x269266-0x0;var _0x41e277=_0xadb5[_0x269266];return _0x41e277;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 68261b7..359a9ff 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 _0x4b8f=['../../config/logger','api','moment','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util'];(function(_0x38b3cb,_0x4ad7b3){var _0x5a9a84=function(_0x237634){while(--_0x237634){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x5a9a84(++_0x4ad7b3);}(_0x4b8f,0x103));var _0xf4b8=function(_0x25e77c,_0x5bcfc6){_0x25e77c=_0x25e77c-0x0;var _0x928439=_0x4b8f[_0x25e77c];return _0x928439;};'use strict';var _=require('lodash');var util=require(_0xf4b8('0x0'));var logger=require(_0xf4b8('0x1'))(_0xf4b8('0x2'));var moment=require(_0xf4b8('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4b8('0x4'));var fs=require('fs');var path=require(_0xf4b8('0x5'));var rimraf=require(_0xf4b8('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4b8('0x7'));module[_0xf4b8('0x8')]=function(_0x1dd55a,_0x18622b){return _0x1dd55a[_0xf4b8('0x9')](_0xf4b8('0xa'),attributes,{'tableName':_0xf4b8('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf4b8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb311=['report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x2e2c4d,_0x1938aa){var _0x38c5b3=function(_0x4a1539){while(--_0x4a1539){_0x2e2c4d['push'](_0x2e2c4d['shift']());}};_0x38c5b3(++_0x1938aa);}(_0xb311,0x70));var _0x1b31=function(_0xf1acc4,_0x2dcd55){_0xf1acc4=_0xf1acc4-0x0;var _0x316822=_0xb311[_0xf1acc4];return _0x316822;};'use strict';var _=require(_0x1b31('0x0'));var util=require(_0x1b31('0x1'));var logger=require(_0x1b31('0x2'))(_0x1b31('0x3'));var moment=require(_0x1b31('0x4'));var BPromise=require(_0x1b31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b31('0x6'));var config=require(_0x1b31('0x7'));var attributes=require(_0x1b31('0x8'));module['exports']=function(_0x1ba4c7,_0x3d9f2c){return _0x1ba4c7['define']('VoiceCallReport',attributes,{'tableName':_0x1b31('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1b31('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index bfb0ad5..40c612e 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 _0x8ba5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','limit','include','map','attributes','model','CreateVoiceCallReport','VoiceCallReport','create','raw','then','UpdateVoiceCallReport','update','body','where','lodash','util'];(function(_0x2fc109,_0x24cc44){var _0x539883=function(_0x2a223e){while(--_0x2a223e){_0x2fc109['push'](_0x2fc109['shift']());}};_0x539883(++_0x24cc44);}(_0x8ba5,0x1de));var _0x58ba=function(_0x501932,_0x432837){_0x501932=_0x501932-0x0;var _0x1fe5eb=_0x8ba5[_0x501932];return _0x1fe5eb;};'use strict';var _=require(_0x58ba('0x0'));var util=require(_0x58ba('0x1'));var moment=require(_0x58ba('0x2'));var BPromise=require(_0x58ba('0x3'));var rs=require(_0x58ba('0x4'));var fs=require('fs');var Redis=require(_0x58ba('0x5'));var db=require(_0x58ba('0x6'))['db'];var utils=require(_0x58ba('0x7'));var logger=require('../../config/logger')(_0x58ba('0x8'));var config=require('../../config/environment');var jayson=require(_0x58ba('0x9'));var client=jayson['client'][_0x58ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b86bf,_0x5d7552,_0x523f81){return new BPromise(function(_0xe8eb2,_0x2c7b98){return client[_0x58ba('0xb')](_0x4b86bf,_0x523f81)['then'](function(_0x539652){logger['info'](_0x58ba('0xc'),_0x5d7552,'request\x20sent');logger[_0x58ba('0xd')](_0x58ba('0xe'),_0x5d7552,_0x58ba('0xf'),JSON[_0x58ba('0x10')](_0x539652));if(_0x539652[_0x58ba('0x11')]){if(_0x539652['error'][_0x58ba('0x12')]===0x1f4){logger[_0x58ba('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5d7552,_0x539652[_0x58ba('0x11')]['message']);return _0x2c7b98(_0x539652[_0x58ba('0x11')][_0x58ba('0x13')]);}logger[_0x58ba('0x11')](_0x58ba('0xc'),_0x5d7552,_0x539652['error'][_0x58ba('0x13')]);return _0xe8eb2(_0x539652[_0x58ba('0x11')][_0x58ba('0x13')]);}else{logger[_0x58ba('0x14')](_0x58ba('0xc'),_0x5d7552,_0x58ba('0xf'));_0xe8eb2(_0x539652[_0x58ba('0x15')]['message']);}})[_0x58ba('0x16')](function(_0x316651){logger['error'](_0x58ba('0xc'),_0x5d7552,_0x316651);_0x2c7b98(_0x316651);});});}exports[_0x58ba('0x17')]=function(_0x7bf943){var _0x5e685a=this;return new Promise(function(_0x15b1d8,_0x438bdb){return db['VoiceCallReport'][_0x58ba('0x18')]({'raw':_0x7bf943[_0x58ba('0x19')]?_0x7bf943[_0x58ba('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x7bf943[_0x58ba('0x19')]?_0x7bf943['options']['where']||null:null,'attributes':_0x7bf943[_0x58ba('0x19')]?_0x7bf943['options']['attributes']||null:null,'limit':_0x7bf943[_0x58ba('0x19')]?_0x7bf943[_0x58ba('0x19')][_0x58ba('0x1a')]||null:null,'include':_0x7bf943[_0x58ba('0x19')]?_0x7bf943['options'][_0x58ba('0x1b')]?_[_0x58ba('0x1c')](_0x7bf943[_0x58ba('0x19')]['include'],function(_0x522729){return{'model':db[_0x522729['model']],'as':_0x522729['as'],'attributes':_0x522729[_0x58ba('0x1d')],'include':_0x522729[_0x58ba('0x1b')]?_[_0x58ba('0x1c')](_0x522729[_0x58ba('0x1b')],function(_0x40e062){return{'model':db[_0x40e062['model']],'as':_0x40e062['as'],'attributes':_0x40e062[_0x58ba('0x1d')],'include':_0x40e062[_0x58ba('0x1b')]?_[_0x58ba('0x1c')](_0x40e062[_0x58ba('0x1b')],function(_0x57c997){return{'model':db[_0x57c997[_0x58ba('0x1e')]],'as':_0x57c997['as'],'attributes':_0x57c997[_0x58ba('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x388f5c){logger[_0x58ba('0x14')](_0x58ba('0x17'),_0x7bf943);logger['debug']('GetVoiceCallReport',_0x7bf943,JSON[_0x58ba('0x10')](_0x388f5c));_0x15b1d8(_0x388f5c);})['catch'](function(_0x10f986){logger[_0x58ba('0x11')](_0x58ba('0x17'),_0x10f986[_0x58ba('0x13')],_0x7bf943);_0x438bdb(_0x5e685a[_0x58ba('0x11')](0x1f4,_0x10f986[_0x58ba('0x13')]));});});};exports[_0x58ba('0x1f')]=function(_0x27672f){var _0x437b56=this;return new Promise(function(_0x305600,_0x2d9d2e){return db[_0x58ba('0x20')][_0x58ba('0x21')](_0x27672f['body'],{'raw':_0x27672f[_0x58ba('0x19')]?_0x27672f[_0x58ba('0x19')][_0x58ba('0x22')]===undefined?!![]:![]:!![]})[_0x58ba('0x23')](function(_0x2efc79){logger['info'](_0x58ba('0x1f'),_0x27672f);logger[_0x58ba('0xd')](_0x58ba('0x1f'),_0x27672f,JSON[_0x58ba('0x10')](_0x2efc79));_0x305600(_0x2efc79);})['catch'](function(_0x5d5bef){logger['error'](_0x58ba('0x1f'),_0x5d5bef[_0x58ba('0x13')],_0x27672f);_0x2d9d2e(_0x437b56[_0x58ba('0x11')](0x1f4,_0x5d5bef[_0x58ba('0x13')]));});});};exports[_0x58ba('0x24')]=function(_0xc4c899){var _0x807759=this;return new Promise(function(_0x407414,_0x5edc2e){return db[_0x58ba('0x20')][_0x58ba('0x25')](_0xc4c899[_0x58ba('0x26')],{'raw':_0xc4c899['options']?_0xc4c899['options'][_0x58ba('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc4c899[_0x58ba('0x19')]?_0xc4c899[_0x58ba('0x19')][_0x58ba('0x27')]||null:null,'attributes':_0xc4c899[_0x58ba('0x19')]?_0xc4c899['options'][_0x58ba('0x1d')]||null:null,'limit':_0xc4c899[_0x58ba('0x19')]?_0xc4c899['options'][_0x58ba('0x1a')]||null:null})[_0x58ba('0x23')](function(_0x484cc3){logger[_0x58ba('0x14')](_0x58ba('0x24'),_0xc4c899);logger[_0x58ba('0xd')](_0x58ba('0x24'),_0xc4c899,JSON[_0x58ba('0x10')](_0x484cc3));_0x407414(_0x484cc3);})[_0x58ba('0x16')](function(_0x561f93){logger[_0x58ba('0x11')]('UpdateVoiceCallReport',_0x561f93[_0x58ba('0x13')],_0xc4c899);_0x5edc2e(_0x807759[_0x58ba('0x11')](0x1f4,_0x561f93[_0x58ba('0x13')]));});});}; \ No newline at end of file +var _0xb20b=['catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','attributes','limit','map','include','model'];(function(_0x2a67dd,_0x224c5b){var _0x1d313f=function(_0x8d29cf){while(--_0x8d29cf){_0x2a67dd['push'](_0x2a67dd['shift']());}};_0x1d313f(++_0x224c5b);}(_0xb20b,0xe8));var _0xbb20=function(_0x2494ed,_0x2e1252){_0x2494ed=_0x2494ed-0x0;var _0x4897f8=_0xb20b[_0x2494ed];return _0x4897f8;};'use strict';var _=require(_0xbb20('0x0'));var util=require(_0xbb20('0x1'));var moment=require(_0xbb20('0x2'));var BPromise=require(_0xbb20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb20('0x4'));var db=require(_0xbb20('0x5'))['db'];var utils=require(_0xbb20('0x6'));var logger=require(_0xbb20('0x7'))(_0xbb20('0x8'));var config=require('../../config/environment');var jayson=require(_0xbb20('0x9'));var client=jayson[_0xbb20('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4497,_0x11a6a0,_0x3c5721){return new BPromise(function(_0x353487,_0x2f0f32){return client[_0xbb20('0xb')](_0x5d4497,_0x3c5721)[_0xbb20('0xc')](function(_0xb06c69){logger[_0xbb20('0xd')](_0xbb20('0xe'),_0x11a6a0,_0xbb20('0xf'));logger[_0xbb20('0x10')](_0xbb20('0x11'),_0x11a6a0,_0xbb20('0xf'),JSON[_0xbb20('0x12')](_0xb06c69));if(_0xb06c69[_0xbb20('0x13')]){if(_0xb06c69['error'][_0xbb20('0x14')]===0x1f4){logger[_0xbb20('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x11a6a0,_0xb06c69[_0xbb20('0x13')][_0xbb20('0x15')]);return _0x2f0f32(_0xb06c69[_0xbb20('0x13')]['message']);}logger[_0xbb20('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x11a6a0,_0xb06c69[_0xbb20('0x13')][_0xbb20('0x15')]);return _0x353487(_0xb06c69[_0xbb20('0x13')][_0xbb20('0x15')]);}else{logger[_0xbb20('0xd')](_0xbb20('0xe'),_0x11a6a0,_0xbb20('0xf'));_0x353487(_0xb06c69[_0xbb20('0x16')]['message']);}})['catch'](function(_0x345b70){logger[_0xbb20('0x13')](_0xbb20('0xe'),_0x11a6a0,_0x345b70);_0x2f0f32(_0x345b70);});});}exports[_0xbb20('0x17')]=function(_0xbf62d3){var _0x140ab1=this;return new Promise(function(_0x235151,_0x3a018b){return db[_0xbb20('0x18')][_0xbb20('0x19')]({'raw':_0xbf62d3['options']?_0xbf62d3['options'][_0xbb20('0x1a')]===undefined?!![]:![]:!![],'where':_0xbf62d3[_0xbb20('0x1b')]?_0xbf62d3[_0xbb20('0x1b')][_0xbb20('0x1c')]||null:null,'attributes':_0xbf62d3['options']?_0xbf62d3['options'][_0xbb20('0x1d')]||null:null,'limit':_0xbf62d3[_0xbb20('0x1b')]?_0xbf62d3[_0xbb20('0x1b')][_0xbb20('0x1e')]||null:null,'include':_0xbf62d3[_0xbb20('0x1b')]?_0xbf62d3[_0xbb20('0x1b')]['include']?_[_0xbb20('0x1f')](_0xbf62d3[_0xbb20('0x1b')][_0xbb20('0x20')],function(_0x5833ba){return{'model':db[_0x5833ba[_0xbb20('0x21')]],'as':_0x5833ba['as'],'attributes':_0x5833ba[_0xbb20('0x1d')],'include':_0x5833ba[_0xbb20('0x20')]?_[_0xbb20('0x1f')](_0x5833ba[_0xbb20('0x20')],function(_0x17ddb9){return{'model':db[_0x17ddb9[_0xbb20('0x21')]],'as':_0x17ddb9['as'],'attributes':_0x17ddb9[_0xbb20('0x1d')],'include':_0x17ddb9[_0xbb20('0x20')]?_[_0xbb20('0x1f')](_0x17ddb9[_0xbb20('0x20')],function(_0x483b14){return{'model':db[_0x483b14['model']],'as':_0x483b14['as'],'attributes':_0x483b14[_0xbb20('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b8dbd){logger['info'](_0xbb20('0x17'),_0xbf62d3);logger[_0xbb20('0x10')](_0xbb20('0x17'),_0xbf62d3,JSON[_0xbb20('0x12')](_0x5b8dbd));_0x235151(_0x5b8dbd);})[_0xbb20('0x22')](function(_0x236171){logger[_0xbb20('0x13')](_0xbb20('0x17'),_0x236171[_0xbb20('0x15')],_0xbf62d3);_0x3a018b(_0x140ab1['error'](0x1f4,_0x236171[_0xbb20('0x15')]));});});};exports[_0xbb20('0x23')]=function(_0x5bf6a1){var _0x161962=this;return new Promise(function(_0x1971a5,_0x5cc345){return db[_0xbb20('0x18')]['create'](_0x5bf6a1[_0xbb20('0x24')],{'raw':_0x5bf6a1[_0xbb20('0x1b')]?_0x5bf6a1[_0xbb20('0x1b')][_0xbb20('0x1a')]===undefined?!![]:![]:!![]})[_0xbb20('0xc')](function(_0x37c804){logger[_0xbb20('0xd')](_0xbb20('0x23'),_0x5bf6a1);logger[_0xbb20('0x10')](_0xbb20('0x23'),_0x5bf6a1,JSON[_0xbb20('0x12')](_0x37c804));_0x1971a5(_0x37c804);})[_0xbb20('0x22')](function(_0x386c95){logger[_0xbb20('0x13')]('CreateVoiceCallReport',_0x386c95[_0xbb20('0x15')],_0x5bf6a1);_0x5cc345(_0x161962[_0xbb20('0x13')](0x1f4,_0x386c95[_0xbb20('0x15')]));});});};exports[_0xbb20('0x25')]=function(_0x4c6e26){var _0xcf0c20=this;return new Promise(function(_0x327dd1,_0x4fa127){return db[_0xbb20('0x18')]['update'](_0x4c6e26[_0xbb20('0x24')],{'raw':_0x4c6e26[_0xbb20('0x1b')]?_0x4c6e26[_0xbb20('0x1b')][_0xbb20('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c6e26[_0xbb20('0x1b')]?_0x4c6e26[_0xbb20('0x1b')][_0xbb20('0x1c')]||null:null,'attributes':_0x4c6e26[_0xbb20('0x1b')]?_0x4c6e26[_0xbb20('0x1b')][_0xbb20('0x1d')]||null:null,'limit':_0x4c6e26['options']?_0x4c6e26[_0xbb20('0x1b')][_0xbb20('0x1e')]||null:null})[_0xbb20('0xc')](function(_0xd6d3d){logger['info'](_0xbb20('0x25'),_0x4c6e26);logger['debug'](_0xbb20('0x25'),_0x4c6e26,JSON[_0xbb20('0x12')](_0xd6d3d));_0x327dd1(_0xd6d3d);})[_0xbb20('0x22')](function(_0xb9e8ae){logger[_0xbb20('0x13')](_0xbb20('0x25'),_0xb9e8ae[_0xbb20('0x15')],_0x4c6e26);_0x4fa127(_0xcf0c20['error'](0x1f4,_0xb9e8ae[_0xbb20('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ffd771d..0eff429 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 _0x60bb=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express'];(function(_0x322306,_0x31fc80){var _0x4f9152=function(_0x565bbf){while(--_0x565bbf){_0x322306['push'](_0x322306['shift']());}};_0x4f9152(++_0x31fc80);}(_0x60bb,0x153));var _0xb60b=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x60bb[_0x2ae8ce];return _0x4bf686;};'use strict';var multer=require('multer');var util=require(_0xb60b('0x0'));var path=require(_0xb60b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb60b('0x2'));var router=express['Router']();var fs_extra=require(_0xb60b('0x3'));var auth=require(_0xb60b('0x4'));var interaction=require(_0xb60b('0x5'));var config=require('../../config/environment');var controller=require(_0xb60b('0x6'));router['get']('/',auth[_0xb60b('0x7')](),controller[_0xb60b('0x8')]);router[_0xb60b('0x9')](_0xb60b('0xa'),auth[_0xb60b('0x7')](),controller[_0xb60b('0xb')]);router[_0xb60b('0xc')]('/',auth[_0xb60b('0x7')](),controller[_0xb60b('0xd')]);router[_0xb60b('0xe')]('/:id',auth[_0xb60b('0x7')](),controller[_0xb60b('0xf')]);router[_0xb60b('0x10')](_0xb60b('0xa'),auth[_0xb60b('0x7')](),controller[_0xb60b('0x11')]);module[_0xb60b('0x12')]=router; \ No newline at end of file +var _0x2d18=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','destroy','exports','util','path'];(function(_0x8d4964,_0x6abf6){var _0x53470a=function(_0x256e76){while(--_0x256e76){_0x8d4964['push'](_0x8d4964['shift']());}};_0x53470a(++_0x6abf6);}(_0x2d18,0x1da));var _0x82d1=function(_0x451de2,_0x8767d0){_0x451de2=_0x451de2-0x0;var _0x12ad3e=_0x2d18[_0x451de2];return _0x12ad3e;};'use strict';var multer=require('multer');var util=require(_0x82d1('0x0'));var path=require(_0x82d1('0x1'));var timeout=require(_0x82d1('0x2'));var express=require(_0x82d1('0x3'));var router=express[_0x82d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x82d1('0x5'));var interaction=require(_0x82d1('0x6'));var config=require(_0x82d1('0x7'));var controller=require(_0x82d1('0x8'));router[_0x82d1('0x9')]('/',auth[_0x82d1('0xa')](),controller[_0x82d1('0xb')]);router['get'](_0x82d1('0xc'),auth[_0x82d1('0xa')](),controller['show']);router[_0x82d1('0xd')]('/',auth[_0x82d1('0xa')](),controller[_0x82d1('0xe')]);router['put']('/:id',auth[_0x82d1('0xa')](),controller['update']);router['delete'](_0x82d1('0xc'),auth['isAuthenticated'](),controller[_0x82d1('0xf')]);module[_0x82d1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 97b22e6..7c85271 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 _0xf51d=['exports','STRING','setDataValue','join','getDataValue','options','BOOLEAN','sequelize'];(function(_0x4be4e1,_0x77c306){var _0x1cf9c8=function(_0x3417e2){while(--_0x3417e2){_0x4be4e1['push'](_0x4be4e1['shift']());}};_0x1cf9c8(++_0x77c306);}(_0xf51d,0x9f));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdf51('0x0'));module[_0xdf51('0x1')]={'name':{'type':Sequelize[_0xdf51('0x2')]},'prefix':{'type':Sequelize[_0xdf51('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xdf51('0x2')],'set':function(_0x573320){this[_0xdf51('0x3')]('options',_0x573320?_0x573320[_0xdf51('0x4')](''):[]);},'get':function(){return this[_0xdf51('0x5')](_0xdf51('0x6'))?this[_0xdf51('0x5')](_0xdf51('0x6'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xdf51('0x2')]},'record':{'type':Sequelize[_0xdf51('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdf51('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd15c=['options','join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xd15c,0x19a));var _0xcd15=function(_0x132325,_0x1451d1){_0x132325=_0x132325-0x0;var _0x24e1c0=_0xd15c[_0x132325];return _0x24e1c0;};'use strict';var Sequelize=require('sequelize');module[_0xcd15('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xcd15('0x1')],'unique':_0xcd15('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x37bdbf){this[_0xcd15('0x3')](_0xcd15('0x4'),_0x37bdbf?_0x37bdbf[_0xcd15('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xcd15('0x6')](_0xcd15('0x4'))[_0xcd15('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcd15('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcd15('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 677bbf2..c70d358 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 _0x2621=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','then','ChanSpies','destroy','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','type','includeAll','include','findAll','length','merge','options','catch','create','body','user','get','role','userProfileId','autoAssociation'];(function(_0xdf949,_0x5e3931){var _0xaf727e=function(_0x509d82){while(--_0x509d82){_0xdf949['push'](_0xdf949['shift']());}};_0xaf727e(++_0x5e3931);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1262('0x0'));var rimraf=require(_0x1262('0x1'));var zipdir=require(_0x1262('0x2'));var jsonpatch=require(_0x1262('0x3'));var rp=require(_0x1262('0x4'));var moment=require(_0x1262('0x5'));var BPromise=require(_0x1262('0x6'));var Mustache=require(_0x1262('0x7'));var util=require(_0x1262('0x8'));var path=require(_0x1262('0x9'));var sox=require(_0x1262('0xa'));var csv=require(_0x1262('0xb'));var ejs=require(_0x1262('0xc'));var fs=require('fs');var fs_extra=require(_0x1262('0xd'));var _=require('lodash');var squel=require(_0x1262('0xe'));var crypto=require('crypto');var jsforce=require(_0x1262('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1262('0xb'));var querystring=require(_0x1262('0x10'));var Papa=require(_0x1262('0x11'));var Redis=require('ioredis');var authService=require(_0x1262('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1262('0x13'));var hardwareService=require(_0x1262('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1262('0x15'));var config=require(_0x1262('0x16'));var licenseUtil=require(_0x1262('0x17'));var db=require(_0x1262('0x18'))['db'];function respondWithStatusCode(_0x2fe558,_0x278fdb){_0x278fdb=_0x278fdb||0xcc;return function(_0x4d90df){if(_0x4d90df){return _0x2fe558[_0x1262('0x19')](_0x278fdb);}return _0x2fe558[_0x1262('0x1a')](_0x278fdb)[_0x1262('0x1b')]();};}function respondWithResult(_0x566bb2,_0x36b4ee){_0x36b4ee=_0x36b4ee||0xc8;return function(_0x3a66b0){if(_0x3a66b0){return _0x566bb2['status'](_0x36b4ee)['json'](_0x3a66b0);}};}function respondWithFilteredResult(_0x2d93a2,_0x4435c7){return function(_0x5a91b7){if(_0x5a91b7){var _0x66e634=typeof _0x4435c7['offset']===_0x1262('0x1c')&&typeof _0x4435c7[_0x1262('0x1d')]===_0x1262('0x1c');var _0x3ebd19=_0x5a91b7[_0x1262('0x1e')];var _0x347901=_0x66e634?0x0:_0x4435c7[_0x1262('0x1f')];var _0x548764=_0x66e634?_0x5a91b7['count']:_0x4435c7['offset']+_0x4435c7[_0x1262('0x1d')];var _0x5b25e4;if(_0x548764>=_0x3ebd19){_0x548764=_0x3ebd19;_0x5b25e4=0xc8;}else{_0x5b25e4=0xce;}_0x2d93a2['status'](_0x5b25e4);return _0x2d93a2['set'](_0x1262('0x20'),_0x347901+'-'+_0x548764+'/'+_0x3ebd19)[_0x1262('0x21')](_0x5a91b7);}return null;};}function patchUpdates(_0x51010a){return function(_0x2e7e16){try{jsonpatch[_0x1262('0x22')](_0x2e7e16,_0x51010a,!![]);}catch(_0x3120fb){return BPromise['reject'](_0x3120fb);}return _0x2e7e16['save']();};}function saveUpdates(_0x2162c1,_0x5b3e00){return function(_0x4db04d){if(_0x4db04d){return _0x4db04d['update'](_0x2162c1)[_0x1262('0x23')](function(_0x58cf78){return _0x58cf78;});}return null;};}function removeEntity(_0x5a8279,_0x2aa124){return function(_0x386b91){if(_0x386b91){return _0x386b91['destroy']()['then'](function(){var _0x3c4a9e=_0x386b91['get']({'plain':!![]});var _0x4e8b70=_0x1262('0x24');return db['UserProfileResource'][_0x1262('0x25')]({'where':{'type':_0x4e8b70,'resourceId':_0x3c4a9e['id']}})[_0x1262('0x23')](function(){return _0x386b91;});})[_0x1262('0x23')](function(){_0x5a8279[_0x1262('0x1a')](0xcc)[_0x1262('0x1b')]();});}};}function handleEntityNotFound(_0x3b6533,_0x3044f6){return function(_0x1229da){if(!_0x1229da){_0x3b6533[_0x1262('0x19')](0x194);}return _0x1229da;};}function handleError(_0x144086,_0x2ffd00){_0x2ffd00=_0x2ffd00||0x1f4;return function(_0x10034a){logger[_0x1262('0x26')](_0x10034a[_0x1262('0x27')]);if(_0x10034a[_0x1262('0x28')]){delete _0x10034a['name'];}_0x144086[_0x1262('0x1a')](_0x2ffd00)[_0x1262('0x29')](_0x10034a);};}exports['index']=function(_0x28d936,_0x53c596){var _0x17f972={},_0x214491={},_0x37e5a0={'count':0x0,'rows':[]};var _0x2fe4ba=_[_0x1262('0x2a')](db[_0x1262('0x2b')][_0x1262('0x2c')],function(_0x331bc7){return{'name':_0x331bc7[_0x1262('0x2d')],'type':_0x331bc7['type'][_0x1262('0x2e')]};});_0x214491[_0x1262('0x2f')]=_['map'](_0x2fe4ba,_0x1262('0x28'));_0x214491[_0x1262('0x30')]=_[_0x1262('0x31')](_0x28d936[_0x1262('0x30')]);_0x214491['filters']=_[_0x1262('0x32')](_0x214491[_0x1262('0x2f')],_0x214491[_0x1262('0x30')]);_0x17f972['attributes']=_[_0x1262('0x32')](_0x214491['model'],qs['fields'](_0x28d936['query'][_0x1262('0x33')]));_0x17f972[_0x1262('0x34')]=_0x17f972[_0x1262('0x34')]['length']?_0x17f972['attributes']:_0x214491[_0x1262('0x2f')];if(!_0x28d936[_0x1262('0x30')][_0x1262('0x35')](_0x1262('0x36'))){_0x17f972[_0x1262('0x1d')]=qs[_0x1262('0x1d')](_0x28d936[_0x1262('0x30')][_0x1262('0x1d')]);_0x17f972['offset']=qs['offset'](_0x28d936[_0x1262('0x30')][_0x1262('0x1f')]);}_0x17f972[_0x1262('0x37')]=qs['sort'](_0x28d936[_0x1262('0x30')]['sort']);_0x17f972[_0x1262('0x38')]=qs['filters'](_['pick'](_0x28d936['query'],_0x214491[_0x1262('0x39')]),_0x2fe4ba);if(_0x28d936[_0x1262('0x30')]['filter']){_0x17f972[_0x1262('0x38')]=_['merge'](_0x17f972[_0x1262('0x38')],{'$or':_[_0x1262('0x2a')](_0x2fe4ba,function(_0x49bcc2){if(_0x49bcc2[_0x1262('0x3a')]!=='VIRTUAL'){var _0x13cd38={};_0x13cd38[_0x49bcc2[_0x1262('0x28')]]={'$like':'%'+_0x28d936[_0x1262('0x30')]['filter']+'%'};return _0x13cd38;}})});}_0x17f972=_['merge']({},_0x17f972,_0x28d936['options']);var _0x205a98={'where':_0x17f972[_0x1262('0x38')]};return db[_0x1262('0x2b')][_0x1262('0x1e')](_0x205a98)[_0x1262('0x23')](function(_0x3aed24){_0x37e5a0[_0x1262('0x1e')]=_0x3aed24;if(_0x28d936[_0x1262('0x30')][_0x1262('0x3b')]){_0x17f972[_0x1262('0x3c')]=[{'all':!![]}];}return db[_0x1262('0x2b')][_0x1262('0x3d')](_0x17f972);})[_0x1262('0x23')](function(_0x541e56){_0x37e5a0['rows']=_0x541e56;return _0x37e5a0;})['then'](respondWithFilteredResult(_0x53c596,_0x17f972))['catch'](handleError(_0x53c596,null));};exports['show']=function(_0x5a784b,_0x240aa3){var _0x2da92a={'raw':![],'where':{'id':_0x5a784b['params']['id']}},_0x48a3b9={};_0x48a3b9[_0x1262('0x2f')]=_[_0x1262('0x31')](db[_0x1262('0x2b')]['rawAttributes']);_0x48a3b9[_0x1262('0x30')]=_[_0x1262('0x31')](_0x5a784b[_0x1262('0x30')]);_0x48a3b9[_0x1262('0x39')]=_[_0x1262('0x32')](_0x48a3b9[_0x1262('0x2f')],_0x48a3b9[_0x1262('0x30')]);_0x2da92a['attributes']=_[_0x1262('0x32')](_0x48a3b9[_0x1262('0x2f')],qs[_0x1262('0x33')](_0x5a784b[_0x1262('0x30')][_0x1262('0x33')]));_0x2da92a[_0x1262('0x34')]=_0x2da92a[_0x1262('0x34')][_0x1262('0x3e')]?_0x2da92a[_0x1262('0x34')]:_0x48a3b9['model'];if(_0x5a784b[_0x1262('0x30')][_0x1262('0x3b')]){_0x2da92a[_0x1262('0x3c')]=[{'all':!![]}];}_0x2da92a=_[_0x1262('0x3f')]({},_0x2da92a,_0x5a784b[_0x1262('0x40')]);return db[_0x1262('0x2b')]['find'](_0x2da92a)['then'](handleEntityNotFound(_0x240aa3,null))['then'](respondWithResult(_0x240aa3,null))[_0x1262('0x41')](handleError(_0x240aa3,null));};exports[_0x1262('0x42')]=function(_0x27269b,_0x61deec){return db[_0x1262('0x2b')][_0x1262('0x42')](_0x27269b[_0x1262('0x43')],{})[_0x1262('0x23')](function(_0x7d5ca0){var _0x57fbec=_0x27269b[_0x1262('0x44')][_0x1262('0x45')]({'plain':!![]});if(!_0x57fbec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57fbec[_0x1262('0x46')]===_0x1262('0x44')){var _0x46fd55=_0x7d5ca0[_0x1262('0x45')]({'plain':!![]});var _0xa819c6=_0x1262('0x24');return db['UserProfileSection']['find']({'where':{'name':_0xa819c6,'userProfileId':_0x57fbec[_0x1262('0x47')]},'raw':!![]})['then'](function(_0x2b19b2){if(_0x2b19b2&&_0x2b19b2[_0x1262('0x48')]===0x0){return db['UserProfileResource'][_0x1262('0x42')]({'name':_0x46fd55[_0x1262('0x28')],'resourceId':_0x46fd55['id'],'type':_0x2b19b2[_0x1262('0x28')],'sectionId':_0x2b19b2['id']},{})[_0x1262('0x23')](function(){return _0x7d5ca0;});}else{return _0x7d5ca0;}})[_0x1262('0x41')](function(_0x166cd0){logger[_0x1262('0x26')](_0x1262('0x49'),_0x166cd0);throw _0x166cd0;});}return _0x7d5ca0;})[_0x1262('0x23')](respondWithResult(_0x61deec,0xc9))[_0x1262('0x41')](handleError(_0x61deec,null));};exports[_0x1262('0x4a')]=function(_0x871365,_0x18c338){if(_0x871365[_0x1262('0x43')]['id']){delete _0x871365[_0x1262('0x43')]['id'];}return db['VoiceChanSpy'][_0x1262('0x4b')]({'where':{'id':_0x871365['params']['id']}})['then'](handleEntityNotFound(_0x18c338,null))[_0x1262('0x23')](saveUpdates(_0x871365[_0x1262('0x43')],null))[_0x1262('0x23')](respondWithResult(_0x18c338,null))[_0x1262('0x41')](handleError(_0x18c338,null));};exports['destroy']=function(_0x5a2cc4,_0x1599ab){return db[_0x1262('0x2b')][_0x1262('0x4b')]({'where':{'id':_0x5a2cc4[_0x1262('0x4c')]['id']}})[_0x1262('0x23')](handleEntityNotFound(_0x1599ab,null))['then'](removeEntity(_0x1599ab,null))[_0x1262('0x41')](handleError(_0x1599ab,null));}; \ No newline at end of file +var _0x220b=['findAll','rows','catch','show','params','intersection','includeAll','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','ChanSpies','destroy','sendStatus','stack','name','send','index','map','VoiceChanSpy','fieldName','query','keys','filters','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x9f4680,_0x58ab2d){var _0x38b131=function(_0x480941){while(--_0x480941){_0x9f4680['push'](_0x9f4680['shift']());}};_0x38b131(++_0x58ab2d);}(_0x220b,0x1a2));var _0xb220=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x220b[_0x34021d];return _0x16597b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528ce0,_0x59ef3e){_0x59ef3e=_0x59ef3e||0xcc;return function(_0x11229c){if(_0x11229c){return _0x528ce0['sendStatus'](_0x59ef3e);}return _0x528ce0[_0xb220('0x16')](_0x59ef3e)[_0xb220('0x17')]();};}function respondWithResult(_0x378a3b,_0x312c59){_0x312c59=_0x312c59||0xc8;return function(_0x576649){if(_0x576649){return _0x378a3b['status'](_0x312c59)[_0xb220('0x18')](_0x576649);}};}function respondWithFilteredResult(_0x1db409,_0x159eb7){return function(_0x2ee3d2){if(_0x2ee3d2){var _0x16a34b=typeof _0x159eb7[_0xb220('0x19')]===_0xb220('0x1a')&&typeof _0x159eb7[_0xb220('0x1b')]===_0xb220('0x1a');var _0x1416de=_0x2ee3d2[_0xb220('0x1c')];var _0x464ceb=_0x16a34b?0x0:_0x159eb7[_0xb220('0x19')];var _0x21cf2d=_0x16a34b?_0x2ee3d2[_0xb220('0x1c')]:_0x159eb7[_0xb220('0x19')]+_0x159eb7[_0xb220('0x1b')];var _0x1cc822;if(_0x21cf2d>=_0x1416de){_0x21cf2d=_0x1416de;_0x1cc822=0xc8;}else{_0x1cc822=0xce;}_0x1db409[_0xb220('0x16')](_0x1cc822);return _0x1db409[_0xb220('0x1d')](_0xb220('0x1e'),_0x464ceb+'-'+_0x21cf2d+'/'+_0x1416de)[_0xb220('0x18')](_0x2ee3d2);}return null;};}function patchUpdates(_0x213736){return function(_0x358035){try{jsonpatch['apply'](_0x358035,_0x213736,!![]);}catch(_0x45b406){return BPromise['reject'](_0x45b406);}return _0x358035[_0xb220('0x1f')]();};}function saveUpdates(_0x5c4d46,_0x3a1ad7){return function(_0x501f0f){if(_0x501f0f){return _0x501f0f[_0xb220('0x20')](_0x5c4d46)[_0xb220('0x21')](function(_0x2ddf73){return _0x2ddf73;});}return null;};}function removeEntity(_0x2f5a0d,_0x396c72){return function(_0x2975ff){if(_0x2975ff){return _0x2975ff['destroy']()[_0xb220('0x21')](function(){var _0x108450=_0x2975ff[_0xb220('0x22')]({'plain':!![]});var _0x1849c8=_0xb220('0x23');return db['UserProfileResource'][_0xb220('0x24')]({'where':{'type':_0x1849c8,'resourceId':_0x108450['id']}})[_0xb220('0x21')](function(){return _0x2975ff;});})['then'](function(){_0x2f5a0d[_0xb220('0x16')](0xcc)[_0xb220('0x17')]();});}};}function handleEntityNotFound(_0x19d0c4,_0x20b7e5){return function(_0x386778){if(!_0x386778){_0x19d0c4[_0xb220('0x25')](0x194);}return _0x386778;};}function handleError(_0x5c18cb,_0x3b4644){_0x3b4644=_0x3b4644||0x1f4;return function(_0x54c1b9){logger['error'](_0x54c1b9[_0xb220('0x26')]);if(_0x54c1b9[_0xb220('0x27')]){delete _0x54c1b9[_0xb220('0x27')];}_0x5c18cb[_0xb220('0x16')](_0x3b4644)[_0xb220('0x28')](_0x54c1b9);};}exports[_0xb220('0x29')]=function(_0x463e6a,_0x355525){var _0x44da01={},_0x436715={},_0x4e202c={'count':0x0,'rows':[]};var _0x2d98e5=_[_0xb220('0x2a')](db[_0xb220('0x2b')]['rawAttributes'],function(_0x5768eb){return{'name':_0x5768eb[_0xb220('0x2c')],'type':_0x5768eb['type']['key']};});_0x436715['model']=_[_0xb220('0x2a')](_0x2d98e5,_0xb220('0x27'));_0x436715[_0xb220('0x2d')]=_[_0xb220('0x2e')](_0x463e6a[_0xb220('0x2d')]);_0x436715[_0xb220('0x2f')]=_['intersection'](_0x436715['model'],_0x436715[_0xb220('0x2d')]);_0x44da01[_0xb220('0x30')]=_['intersection'](_0x436715[_0xb220('0x31')],qs['fields'](_0x463e6a[_0xb220('0x2d')][_0xb220('0x32')]));_0x44da01[_0xb220('0x30')]=_0x44da01[_0xb220('0x30')][_0xb220('0x33')]?_0x44da01['attributes']:_0x436715['model'];if(!_0x463e6a['query'][_0xb220('0x34')]('nolimit')){_0x44da01[_0xb220('0x1b')]=qs[_0xb220('0x1b')](_0x463e6a[_0xb220('0x2d')]['limit']);_0x44da01['offset']=qs[_0xb220('0x19')](_0x463e6a['query'][_0xb220('0x19')]);}_0x44da01[_0xb220('0x35')]=qs['sort'](_0x463e6a[_0xb220('0x2d')][_0xb220('0x36')]);_0x44da01[_0xb220('0x37')]=qs[_0xb220('0x2f')](_[_0xb220('0x38')](_0x463e6a[_0xb220('0x2d')],_0x436715[_0xb220('0x2f')]),_0x2d98e5);if(_0x463e6a[_0xb220('0x2d')][_0xb220('0x39')]){_0x44da01[_0xb220('0x37')]=_[_0xb220('0x3a')](_0x44da01[_0xb220('0x37')],{'$or':_[_0xb220('0x2a')](_0x2d98e5,function(_0x5ef350){if(_0x5ef350[_0xb220('0x3b')]!==_0xb220('0x3c')){var _0x1cca35={};_0x1cca35[_0x5ef350[_0xb220('0x27')]]={'$like':'%'+_0x463e6a[_0xb220('0x2d')]['filter']+'%'};return _0x1cca35;}})});}_0x44da01=_[_0xb220('0x3a')]({},_0x44da01,_0x463e6a[_0xb220('0x3d')]);var _0x2a5008={'where':_0x44da01[_0xb220('0x37')]};return db['VoiceChanSpy']['count'](_0x2a5008)[_0xb220('0x21')](function(_0x51fd4f){_0x4e202c['count']=_0x51fd4f;if(_0x463e6a[_0xb220('0x2d')]['includeAll']){_0x44da01['include']=[{'all':!![]}];}return db[_0xb220('0x2b')][_0xb220('0x3e')](_0x44da01);})[_0xb220('0x21')](function(_0x24d75c){_0x4e202c[_0xb220('0x3f')]=_0x24d75c;return _0x4e202c;})['then'](respondWithFilteredResult(_0x355525,_0x44da01))[_0xb220('0x40')](handleError(_0x355525,null));};exports[_0xb220('0x41')]=function(_0x458105,_0x284eb2){var _0x45c609={'raw':![],'where':{'id':_0x458105[_0xb220('0x42')]['id']}},_0x2689a1={};_0x2689a1[_0xb220('0x31')]=_[_0xb220('0x2e')](db['VoiceChanSpy']['rawAttributes']);_0x2689a1['query']=_[_0xb220('0x2e')](_0x458105[_0xb220('0x2d')]);_0x2689a1[_0xb220('0x2f')]=_[_0xb220('0x43')](_0x2689a1[_0xb220('0x31')],_0x2689a1[_0xb220('0x2d')]);_0x45c609[_0xb220('0x30')]=_[_0xb220('0x43')](_0x2689a1[_0xb220('0x31')],qs[_0xb220('0x32')](_0x458105[_0xb220('0x2d')][_0xb220('0x32')]));_0x45c609[_0xb220('0x30')]=_0x45c609['attributes'][_0xb220('0x33')]?_0x45c609[_0xb220('0x30')]:_0x2689a1['model'];if(_0x458105[_0xb220('0x2d')][_0xb220('0x44')]){_0x45c609[_0xb220('0x45')]=[{'all':!![]}];}_0x45c609=_[_0xb220('0x3a')]({},_0x45c609,_0x458105[_0xb220('0x3d')]);return db[_0xb220('0x2b')][_0xb220('0x46')](_0x45c609)[_0xb220('0x21')](handleEntityNotFound(_0x284eb2,null))[_0xb220('0x21')](respondWithResult(_0x284eb2,null))[_0xb220('0x40')](handleError(_0x284eb2,null));};exports['create']=function(_0x56fb72,_0x4d80f6){return db[_0xb220('0x2b')][_0xb220('0x47')](_0x56fb72[_0xb220('0x48')],{})[_0xb220('0x21')](function(_0x5c6c3d){var _0x4e0f01=_0x56fb72[_0xb220('0x49')][_0xb220('0x22')]({'plain':!![]});if(!_0x4e0f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e0f01['role']===_0xb220('0x49')){var _0x5ef174=_0x5c6c3d[_0xb220('0x22')]({'plain':!![]});var _0xa4ce65=_0xb220('0x23');return db[_0xb220('0x4a')][_0xb220('0x46')]({'where':{'name':_0xa4ce65,'userProfileId':_0x4e0f01[_0xb220('0x4b')]},'raw':!![]})['then'](function(_0x3e1156){if(_0x3e1156&&_0x3e1156[_0xb220('0x4c')]===0x0){return db[_0xb220('0x4d')][_0xb220('0x47')]({'name':_0x5ef174[_0xb220('0x27')],'resourceId':_0x5ef174['id'],'type':_0x3e1156[_0xb220('0x27')],'sectionId':_0x3e1156['id']},{})['then'](function(){return _0x5c6c3d;});}else{return _0x5c6c3d;}})['catch'](function(_0x179cc5){logger[_0xb220('0x4e')](_0xb220('0x4f'),_0x179cc5);throw _0x179cc5;});}return _0x5c6c3d;})[_0xb220('0x21')](respondWithResult(_0x4d80f6,0xc9))[_0xb220('0x40')](handleError(_0x4d80f6,null));};exports[_0xb220('0x20')]=function(_0x255b7b,_0xc92b82){if(_0x255b7b[_0xb220('0x48')]['id']){delete _0x255b7b[_0xb220('0x48')]['id'];}return db['VoiceChanSpy'][_0xb220('0x46')]({'where':{'id':_0x255b7b['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0xc92b82,null))[_0xb220('0x21')](saveUpdates(_0x255b7b[_0xb220('0x48')],null))[_0xb220('0x21')](respondWithResult(_0xc92b82,null))[_0xb220('0x40')](handleError(_0xc92b82,null));};exports[_0xb220('0x24')]=function(_0x22063c,_0x5e7a1f){return db['VoiceChanSpy'][_0xb220('0x46')]({'where':{'id':_0x22063c[_0xb220('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e7a1f,null))[_0xb220('0x21')](removeEntity(_0x5e7a1f,null))['catch'](handleError(_0x5e7a1f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b0fe09a..18378a4 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 _0x933e=['concat','internal','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','merge','ChanSpy','SIP/%s,%s','name','options','join','length'];(function(_0xeff820,_0x368857){var _0x5e7c01=function(_0x1e8548){while(--_0x1e8548){_0xeff820['push'](_0xeff820['shift']());}};_0x5e7c01(++_0x368857);}(_0x933e,0xe2));var _0xe933=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x933e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe933('0x0'));var util=require(_0xe933('0x1'));var BPromise=require(_0xe933('0x2'));var attributes=require(_0xe933('0x3'));var getUserApplications=function(_0x3cc1ed,_0x2192dc,_0x3575f0){var _0x1d9bd7=0x1;var _0x518a9e=[];var _0x3ac477={'context':_0x2192dc[_0xe933('0x4')]||_0xe933('0x5'),'exten':util[_0xe933('0x6')](_0xe933('0x7'),_0x3cc1ed[_0xe933('0x8')],_0x3575f0),'type':_0xe933('0x9'),'isApp':![],'ChanSpyId':_0x3cc1ed['id'],'UserId':_0x2192dc['id']};_0x518a9e[_0xe933('0xa')](_['merge']({'app':_0xe933('0xb'),'appdata':util['format'](_0xe933('0xc'),'chanspy'),'priority':_0x1d9bd7++},_0x3ac477));if(_0x3cc1ed[_0xe933('0xd')]){_0x518a9e[_0xe933('0xa')](_['merge']({'app':_0xe933('0xe'),'appdata':util[_0xe933('0x6')](_0xe933('0xf'),_0x3cc1ed['recordingFormat']),'priority':_0x1d9bd7++},_0x3ac477));}if(_0x3cc1ed[_0xe933('0x10')]){_0x518a9e[_0xe933('0xa')](_['merge']({'app':_0xe933('0x11'),'appdata':_0x3cc1ed[_0xe933('0x12')],'priority':_0x1d9bd7++},_0x3ac477));}_0x518a9e[_0xe933('0xa')](_[_0xe933('0x13')]({'app':_0xe933('0x14'),'appdata':util[_0xe933('0x6')](_0xe933('0x15'),_0x2192dc[_0xe933('0x16')],_0x3cc1ed[_0xe933('0x17')]?_0x3cc1ed['options'][_0xe933('0x18')](''):''),'priority':_0x1d9bd7++},_0x3ac477));if(_0x3cc1ed['record']){_0x518a9e[_0xe933('0xa')](_[_0xe933('0x13')]({'app':'StopMixMonitor','priority':_0x1d9bd7++},_0x3ac477));}return _0x518a9e;};var getChanSpyApplications=function(_0x5296e0,_0x16c87f){var _0x39faed=[];for(var _0x55ad2d=0x0,_0x26212d=0x1;_0x55ad2d<_0x16c87f[_0xe933('0x19')];_0x55ad2d++,_0x26212d=0x1){_0x39faed=_0x39faed[_0xe933('0x1a')](getUserApplications(_0x5296e0,_0x16c87f[_0x55ad2d],_0x16c87f[_0x55ad2d][_0xe933('0x1b')]));if(_0x16c87f[_0x55ad2d]['internal']!=_0x16c87f[_0x55ad2d][_0xe933('0x16')]){_0x39faed=_0x39faed[_0xe933('0x1a')](getUserApplications(_0x5296e0,_0x16c87f[_0x55ad2d],_0x16c87f[_0x55ad2d][_0xe933('0x16')]));}}return _0x39faed;};var getChanSpyPromise=function(_0x187b30,_0x3e46df){return new BPromise(function(_0x471d23,_0x21d1e0){return _0x187b30['User']['findAll']({'attributes':['id',_0xe933('0x16'),_0xe933('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xe933('0x1c')](function(_0x543e2f){if(_0x543e2f){return _0x471d23(getChanSpyApplications(_0x3e46df,_0x543e2f));}return _0x471d23([]);})[_0xe933('0x1d')](function(_0x4a3991){_0x21d1e0(_0x4a3991);});});};module[_0xe933('0x1e')]=function(_0x23feca,_0x2d02d3){var _0x1956e9=_0x23feca['models'];return _0x23feca[_0xe933('0x1f')](_0xe933('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x246818,_0x278222,_0x5073d1){return getChanSpyPromise(_0x1956e9,_0x246818)[_0xe933('0x1c')](function(_0x139f8a){if(_0x139f8a&&_0x139f8a['length']){return _0x1956e9[_0xe933('0x21')][_0xe933('0x22')](_0x139f8a);}})[_0xe933('0x1c')](function(){_0x5073d1();})['catch'](function(_0x5da4cb){_0x5073d1(_0x5da4cb);});},'afterUpdate':function(_0x901ba7,_0x1fadbb,_0x56840d){return _0x1956e9[_0xe933('0x21')][_0xe933('0x23')]({'where':{'ChanSpyId':_0x901ba7['id']}})[_0xe933('0x1c')](function(){return getChanSpyPromise(_0x1956e9,_0x901ba7);})['then'](function(_0x5f3e17){if(_0x5f3e17&&_0x5f3e17[_0xe933('0x19')]){return _0x1956e9['VoiceExtension']['bulkCreate'](_0x5f3e17);}})[_0xe933('0x1c')](function(){_0x56840d();})[_0xe933('0x1d')](function(_0xc5ac82){_0x56840d(_0xc5ac82);});},'afterDestroy':function(_0x40ecbe,_0xd99401,_0x362dd6){return _0x1956e9[_0xe933('0x21')][_0xe933('0x23')]({'where':{'ChanSpyId':_0x40ecbe['id']}})[_0xe933('0x1c')](function(){_0x362dd6();})['catch'](function(_0xc10883){_0x362dd6(_0xc10883);});}}});}; \ No newline at end of file +var _0x0ba9=['context','from-sip','%s%s','system','merge','Set','format','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','options','StopMixMonitor','concat','internal','name','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x19c47a,_0x197e41){var _0x1416d1=function(_0x359072){while(--_0x359072){_0x19c47a['push'](_0x19c47a['shift']());}};_0x1416d1(++_0x197e41);}(_0x0ba9,0x1ac));var _0x90ba=function(_0xc0eed3,_0x162ed5){_0xc0eed3=_0xc0eed3-0x0;var _0x558cf3=_0x0ba9[_0xc0eed3];return _0x558cf3;};'use strict';var _=require(_0x90ba('0x0'));var util=require(_0x90ba('0x1'));var BPromise=require(_0x90ba('0x2'));var attributes=require(_0x90ba('0x3'));var getUserApplications=function(_0x5cb34e,_0x348c2e,_0x289ad3){var _0x52dd59=0x1;var _0x139258=[];var _0x42a2cb={'context':_0x348c2e[_0x90ba('0x4')]||_0x90ba('0x5'),'exten':util['format'](_0x90ba('0x6'),_0x5cb34e['prefix'],_0x289ad3),'type':_0x90ba('0x7'),'isApp':![],'ChanSpyId':_0x5cb34e['id'],'UserId':_0x348c2e['id']};_0x139258['push'](_[_0x90ba('0x8')]({'app':_0x90ba('0x9'),'appdata':util[_0x90ba('0xa')](_0x90ba('0xb'),'chanspy'),'priority':_0x52dd59++},_0x42a2cb));if(_0x5cb34e[_0x90ba('0xc')]){_0x139258[_0x90ba('0xd')](_[_0x90ba('0x8')]({'app':_0x90ba('0xe'),'appdata':util['format'](_0x90ba('0xf'),_0x5cb34e[_0x90ba('0x10')]),'priority':_0x52dd59++},_0x42a2cb));}if(_0x5cb34e[_0x90ba('0x11')]){_0x139258['push'](_[_0x90ba('0x8')]({'app':_0x90ba('0x12'),'appdata':_0x5cb34e['password'],'priority':_0x52dd59++},_0x42a2cb));}_0x139258[_0x90ba('0xd')](_[_0x90ba('0x8')]({'app':_0x90ba('0x13'),'appdata':util[_0x90ba('0xa')](_0x90ba('0x14'),_0x348c2e['name'],_0x5cb34e[_0x90ba('0x15')]?_0x5cb34e[_0x90ba('0x15')]['join'](''):''),'priority':_0x52dd59++},_0x42a2cb));if(_0x5cb34e[_0x90ba('0xc')]){_0x139258[_0x90ba('0xd')](_[_0x90ba('0x8')]({'app':_0x90ba('0x16'),'priority':_0x52dd59++},_0x42a2cb));}return _0x139258;};var getChanSpyApplications=function(_0x3d5ec8,_0x328bd0){var _0x5a3230=[];for(var _0x28d0ae=0x0,_0x12f615=0x1;_0x28d0ae<_0x328bd0['length'];_0x28d0ae++,_0x12f615=0x1){_0x5a3230=_0x5a3230[_0x90ba('0x17')](getUserApplications(_0x3d5ec8,_0x328bd0[_0x28d0ae],_0x328bd0[_0x28d0ae][_0x90ba('0x18')]));if(_0x328bd0[_0x28d0ae][_0x90ba('0x18')]!=_0x328bd0[_0x28d0ae][_0x90ba('0x19')]){_0x5a3230=_0x5a3230['concat'](getUserApplications(_0x3d5ec8,_0x328bd0[_0x28d0ae],_0x328bd0[_0x28d0ae]['name']));}}return _0x5a3230;};var getChanSpyPromise=function(_0x173800,_0x6e42f0){return new BPromise(function(_0xbc2681,_0xd88a37){return _0x173800['User']['findAll']({'attributes':['id',_0x90ba('0x19'),'internal'],'where':{'role':_0x90ba('0x1a'),'chanspy':!![]},'raw':!![]})[_0x90ba('0x1b')](function(_0x4fa337){if(_0x4fa337){return _0xbc2681(getChanSpyApplications(_0x6e42f0,_0x4fa337));}return _0xbc2681([]);})[_0x90ba('0x1c')](function(_0x1a8350){_0xd88a37(_0x1a8350);});});};module['exports']=function(_0x19aecb,_0x40204e){var _0x39cf42=_0x19aecb[_0x90ba('0x1d')];return _0x19aecb[_0x90ba('0x1e')](_0x90ba('0x1f'),attributes,{'tableName':_0x90ba('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x29cf94,_0x588d55,_0x26fcc2){return getChanSpyPromise(_0x39cf42,_0x29cf94)[_0x90ba('0x1b')](function(_0x2582d5){if(_0x2582d5&&_0x2582d5[_0x90ba('0x21')]){return _0x39cf42[_0x90ba('0x22')]['bulkCreate'](_0x2582d5);}})[_0x90ba('0x1b')](function(){_0x26fcc2();})['catch'](function(_0x25d136){_0x26fcc2(_0x25d136);});},'afterUpdate':function(_0x599d56,_0xbc8ae1,_0xb3420d){return _0x39cf42['VoiceExtension'][_0x90ba('0x23')]({'where':{'ChanSpyId':_0x599d56['id']}})[_0x90ba('0x1b')](function(){return getChanSpyPromise(_0x39cf42,_0x599d56);})[_0x90ba('0x1b')](function(_0x15f280){if(_0x15f280&&_0x15f280[_0x90ba('0x21')]){return _0x39cf42['VoiceExtension']['bulkCreate'](_0x15f280);}})[_0x90ba('0x1b')](function(){_0xb3420d();})[_0x90ba('0x1c')](function(_0x3d87db){_0xb3420d(_0x3d87db);});},'afterDestroy':function(_0x1787d2,_0x3bacf5,_0x573b9c){return _0x39cf42[_0x90ba('0x22')][_0x90ba('0x23')]({'where':{'ChanSpyId':_0x1787d2['id']}})[_0x90ba('0x1b')](function(){_0x573b9c();})[_0x90ba('0x1c')](function(_0x50eb52){_0x573b9c(_0x50eb52);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index acdc776..48e145a 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 _0x9434=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x469214,_0x234477){var _0x57e3c3=function(_0x5ccf9a){while(--_0x5ccf9a){_0x469214['push'](_0x469214['shift']());}};_0x57e3c3(++_0x234477);}(_0x9434,0x168));var _0x4943=function(_0x5186dd,_0x4c1f1d){_0x5186dd=_0x5186dd-0x0;var _0x3da7c1=_0x9434[_0x5186dd];return _0x3da7c1;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var moment=require(_0x4943('0x2'));var BPromise=require(_0x4943('0x3'));var rs=require(_0x4943('0x4'));var fs=require('fs');var Redis=require(_0x4943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4943('0x6'));var logger=require(_0x4943('0x7'))('rpc');var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson['client'][_0x4943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a55a,_0x4da494,_0x3ae08d){return new BPromise(function(_0x2f4119,_0x1876eb){return client[_0x4943('0xb')](_0x56a55a,_0x3ae08d)[_0x4943('0xc')](function(_0x553991){logger['info'](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));logger[_0x4943('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4da494,_0x4943('0xe'),JSON[_0x4943('0x10')](_0x553991));if(_0x553991['error']){if(_0x553991[_0x4943('0x11')]['code']===0x1f4){logger['error'](_0x4943('0xd'),_0x4da494,_0x553991[_0x4943('0x11')][_0x4943('0x12')]);return _0x1876eb(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}logger[_0x4943('0x11')](_0x4943('0xd'),_0x4da494,_0x553991['error'][_0x4943('0x12')]);return _0x2f4119(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}else{logger[_0x4943('0x13')](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));_0x2f4119(_0x553991['result'][_0x4943('0x12')]);}})[_0x4943('0x14')](function(_0xb08628){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4da494,_0xb08628);_0x1876eb(_0xb08628);});});} \ No newline at end of file +var _0x0713=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x390d5b,_0x3068ce){var _0x4458df=function(_0x1532b3){while(--_0x1532b3){_0x390d5b['push'](_0x390d5b['shift']());}};_0x4458df(++_0x3068ce);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b92fe3f..554e5e3 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 _0x4170=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x4170,0xb7));var _0x0417=function(_0xac2821,_0x136c33){_0xac2821=_0xac2821-0x0;var _0x1f4d3f=_0x4170[_0xac2821];return _0x1f4d3f;};'use strict';var multer=require(_0x0417('0x0'));var util=require('util');var path=require(_0x0417('0x1'));var timeout=require(_0x0417('0x2'));var express=require(_0x0417('0x3'));var router=express['Router']();var fs_extra=require(_0x0417('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0417('0x5'));var config=require(_0x0417('0x6'));var controller=require(_0x0417('0x7'));router[_0x0417('0x8')]('/',auth[_0x0417('0x9')](),controller[_0x0417('0xa')]);router['get'](_0x0417('0xb'),auth['isAuthenticated'](),controller[_0x0417('0xc')]);router[_0x0417('0xd')]('/',auth[_0x0417('0x9')](),controller[_0x0417('0xe')]);router[_0x0417('0xf')](_0x0417('0xb'),auth[_0x0417('0x9')](),controller[_0x0417('0x10')]);router[_0x0417('0x11')](_0x0417('0xb'),auth[_0x0417('0x9')](),controller[_0x0417('0x12')]);module[_0x0417('0x13')]=router; \ No newline at end of file +var _0xe754=['post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','./voiceContext.controller','get','isAuthenticated','/:id','show'];(function(_0xdbcae9,_0x1d44d7){var _0x4aa73f=function(_0x4be47d){while(--_0x4be47d){_0xdbcae9['push'](_0xdbcae9['shift']());}};_0x4aa73f(++_0x1d44d7);}(_0xe754,0x117));var _0x4e75=function(_0x491f73,_0x4bce92){_0x491f73=_0x491f73-0x0;var _0x56ac3a=_0xe754[_0x491f73];return _0x56ac3a;};'use strict';var multer=require('multer');var util=require(_0x4e75('0x0'));var path=require('path');var timeout=require(_0x4e75('0x1'));var express=require('express');var router=express[_0x4e75('0x2')]();var fs_extra=require(_0x4e75('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e75('0x4'));router[_0x4e75('0x5')]('/',auth[_0x4e75('0x6')](),controller['index']);router[_0x4e75('0x5')](_0x4e75('0x7'),auth[_0x4e75('0x6')](),controller[_0x4e75('0x8')]);router[_0x4e75('0x9')]('/',auth[_0x4e75('0x6')](),controller[_0x4e75('0xa')]);router[_0x4e75('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4e75('0xc')]);router[_0x4e75('0xd')](_0x4e75('0x7'),auth[_0x4e75('0x6')](),controller[_0x4e75('0xe')]);module[_0x4e75('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 0f74d19..28adac2 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 _0xc784=['name','sequelize','exports','STRING'];(function(_0x4a80f6,_0x3d43ad){var _0x5bc762=function(_0x1ad68a){while(--_0x1ad68a){_0x4a80f6['push'](_0x4a80f6['shift']());}};_0x5bc762(++_0x3d43ad);}(_0xc784,0xc5));var _0x4c78=function(_0x2c11e2,_0x55d16e){_0x2c11e2=_0x2c11e2-0x0;var _0x2e8d1b=_0xc784[_0x2c11e2];return _0x2e8d1b;};'use strict';var Sequelize=require(_0x4c78('0x0'));module[_0x4c78('0x1')]={'name':{'type':Sequelize[_0x4c78('0x2')],'unique':_0x4c78('0x3')},'description':{'type':Sequelize[_0x4c78('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x08a1=['name','BOOLEAN','sequelize','exports'];(function(_0x221599,_0x47e0d0){var _0x472ef8=function(_0x2f9851){while(--_0x2f9851){_0x221599['push'](_0x221599['shift']());}};_0x472ef8(++_0x47e0d0);}(_0x08a1,0xea));var _0x108a=function(_0x4dcba1,_0x46312f){_0x4dcba1=_0x4dcba1-0x0;var _0xe1043b=_0x08a1[_0x4dcba1];return _0xe1043b;};'use strict';var Sequelize=require(_0x108a('0x0'));module[_0x108a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x108a('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x108a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 98726d8..0d618a9 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 _0xa006=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','Contexts','then','stack','name','index','map','VoiceContext','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','join','render','/etc/asterisk/extensions_xcally_contexts.conf','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x16aba8,_0xcff23c){var _0x4aff0b=function(_0x5b60c2){while(--_0x5b60c2){_0x16aba8['push'](_0x16aba8['shift']());}};_0x4aff0b(++_0xcff23c);}(_0xa006,0x19a));var _0x6a00=function(_0x2df749,_0x25aa1d){_0x2df749=_0x2df749-0x0;var _0x480a97=_0xa006[_0x2df749];return _0x480a97;};'use strict';var emlformat=require(_0x6a00('0x0'));var rimraf=require(_0x6a00('0x1'));var zipdir=require(_0x6a00('0x2'));var jsonpatch=require(_0x6a00('0x3'));var rp=require(_0x6a00('0x4'));var moment=require(_0x6a00('0x5'));var BPromise=require(_0x6a00('0x6'));var Mustache=require(_0x6a00('0x7'));var util=require('util');var path=require(_0x6a00('0x8'));var sox=require(_0x6a00('0x9'));var csv=require(_0x6a00('0xa'));var ejs=require(_0x6a00('0xb'));var fs=require('fs');var fs_extra=require(_0x6a00('0xc'));var _=require('lodash');var squel=require(_0x6a00('0xd'));var crypto=require(_0x6a00('0xe'));var jsforce=require(_0x6a00('0xf'));var deskjs=require(_0x6a00('0x10'));var toCsv=require(_0x6a00('0xa'));var querystring=require(_0x6a00('0x11'));var Papa=require('papaparse');var Redis=require(_0x6a00('0x12'));var authService=require(_0x6a00('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a00('0x14'));var logger=require(_0x6a00('0x15'))(_0x6a00('0x16'));var utils=require(_0x6a00('0x17'));var config=require(_0x6a00('0x18'));var licenseUtil=require(_0x6a00('0x19'));var db=require(_0x6a00('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x6a00('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5bb724,_0x4318c3,_0xab18e1,_0x1a86b7){return new BPromise(function(_0x2586e2,_0x5dac2f){var _0x56a454=_0x1a86b7||client;return _0x56a454['request'](_0x5bb724,_0xab18e1)['then'](function(_0x31065a){logger[_0x6a00('0x1c')](_0x6a00('0x1d'),_0x4318c3,_0x6a00('0x1e'));logger[_0x6a00('0x1f')](_0x6a00('0x20'),_0x4318c3,_0x6a00('0x1e'),JSON[_0x6a00('0x21')](_0x31065a));if(_0x31065a[_0x6a00('0x22')]){if(_0x31065a[_0x6a00('0x22')]['code']===0x1f4){logger[_0x6a00('0x22')](_0x6a00('0x1d'),_0x4318c3,_0x31065a[_0x6a00('0x22')][_0x6a00('0x23')]);return _0x5dac2f(_0x31065a[_0x6a00('0x22')]['message']);}logger[_0x6a00('0x22')](_0x6a00('0x1d'),_0x4318c3,_0x31065a['error'][_0x6a00('0x23')]);return _0x2586e2(_0x31065a[_0x6a00('0x22')][_0x6a00('0x23')]);}else{logger[_0x6a00('0x1c')](_0x6a00('0x1d'),_0x4318c3,'request\x20sent');_0x2586e2(_0x31065a[_0x6a00('0x24')][_0x6a00('0x23')]);}})[_0x6a00('0x25')](function(_0xaa061d){logger[_0x6a00('0x22')](_0x6a00('0x1d'),_0x4318c3,_0xaa061d);_0x5dac2f(_0xaa061d);});});}function respondWithStatusCode(_0x3b6e05,_0x28614c){_0x28614c=_0x28614c||0xcc;return function(_0x231e7b){if(_0x231e7b){return _0x3b6e05[_0x6a00('0x26')](_0x28614c);}return _0x3b6e05['status'](_0x28614c)[_0x6a00('0x27')]();};}function respondWithResult(_0x4ee7e0,_0x2e55a7){_0x2e55a7=_0x2e55a7||0xc8;return function(_0x3aa2d1){if(_0x3aa2d1){return _0x4ee7e0[_0x6a00('0x28')](_0x2e55a7)['json'](_0x3aa2d1);}};}function respondWithFilteredResult(_0x230142,_0x5bb6f7){return function(_0x35dc39){if(_0x35dc39){var _0x2d7f69=typeof _0x5bb6f7[_0x6a00('0x29')]===_0x6a00('0x2a')&&typeof _0x5bb6f7[_0x6a00('0x2b')]==='undefined';var _0x5c0e75=_0x35dc39[_0x6a00('0x2c')];var _0x4bf86d=_0x2d7f69?0x0:_0x5bb6f7[_0x6a00('0x29')];var _0xf24e3c=_0x2d7f69?_0x35dc39[_0x6a00('0x2c')]:_0x5bb6f7[_0x6a00('0x29')]+_0x5bb6f7[_0x6a00('0x2b')];var _0x54de64;if(_0xf24e3c>=_0x5c0e75){_0xf24e3c=_0x5c0e75;_0x54de64=0xc8;}else{_0x54de64=0xce;}_0x230142['status'](_0x54de64);return _0x230142[_0x6a00('0x2d')](_0x6a00('0x2e'),_0x4bf86d+'-'+_0xf24e3c+'/'+_0x5c0e75)[_0x6a00('0x2f')](_0x35dc39);}return null;};}function patchUpdates(_0x17b8c0){return function(_0x26bcd1){try{jsonpatch[_0x6a00('0x30')](_0x26bcd1,_0x17b8c0,!![]);}catch(_0x4c1820){return BPromise[_0x6a00('0x31')](_0x4c1820);}return _0x26bcd1[_0x6a00('0x32')]();};}function saveUpdates(_0x2584a7,_0x1701e6){return function(_0x47d723){if(_0x47d723){return _0x47d723[_0x6a00('0x33')](_0x2584a7)['then'](function(_0x312005){return _0x312005;});}return null;};}function removeEntity(_0x2aec38,_0x477596){return function(_0x215704){if(_0x215704){return _0x215704['destroy']()['then'](function(){var _0x12ba45=_0x215704['get']({'plain':!![]});var _0x2c1e6c=_0x6a00('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x2c1e6c,'resourceId':_0x12ba45['id']}})[_0x6a00('0x35')](function(){return _0x215704;});})[_0x6a00('0x35')](function(){_0x2aec38[_0x6a00('0x28')](0xcc)[_0x6a00('0x27')]();});}};}function handleEntityNotFound(_0x37c451,_0x27535b){return function(_0x3b5009){if(!_0x3b5009){_0x37c451[_0x6a00('0x26')](0x194);}return _0x3b5009;};}function handleError(_0x3332a9,_0x447e23){_0x447e23=_0x447e23||0x1f4;return function(_0x2d9a7c){logger[_0x6a00('0x22')](_0x2d9a7c[_0x6a00('0x36')]);if(_0x2d9a7c[_0x6a00('0x37')]){delete _0x2d9a7c[_0x6a00('0x37')];}_0x3332a9['status'](_0x447e23)['send'](_0x2d9a7c);};}exports[_0x6a00('0x38')]=function(_0x33aa9c,_0x1729ef){var _0xb32cca={},_0x1972b8={},_0x16da4f={'count':0x0,'rows':[]};var _0x20d1cc=_[_0x6a00('0x39')](db[_0x6a00('0x3a')]['rawAttributes'],function(_0x4f8e3d){return{'name':_0x4f8e3d[_0x6a00('0x3b')],'type':_0x4f8e3d[_0x6a00('0x3c')][_0x6a00('0x3d')]};});_0x1972b8['model']=_[_0x6a00('0x39')](_0x20d1cc,'name');_0x1972b8[_0x6a00('0x3e')]=_[_0x6a00('0x3f')](_0x33aa9c[_0x6a00('0x3e')]);_0x1972b8[_0x6a00('0x40')]=_[_0x6a00('0x41')](_0x1972b8[_0x6a00('0x42')],_0x1972b8[_0x6a00('0x3e')]);_0xb32cca[_0x6a00('0x43')]=_[_0x6a00('0x41')](_0x1972b8[_0x6a00('0x42')],qs[_0x6a00('0x44')](_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x44')]));_0xb32cca[_0x6a00('0x43')]=_0xb32cca[_0x6a00('0x43')][_0x6a00('0x45')]?_0xb32cca[_0x6a00('0x43')]:_0x1972b8[_0x6a00('0x42')];if(!_0x33aa9c['query'][_0x6a00('0x46')](_0x6a00('0x47'))){_0xb32cca[_0x6a00('0x2b')]=qs[_0x6a00('0x2b')](_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x2b')]);_0xb32cca[_0x6a00('0x29')]=qs[_0x6a00('0x29')](_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x29')]);}_0xb32cca[_0x6a00('0x48')]=qs['sort'](_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x49')]);_0xb32cca[_0x6a00('0x4a')]=qs[_0x6a00('0x40')](_['pick'](_0x33aa9c['query'],_0x1972b8[_0x6a00('0x40')]),_0x20d1cc);if(_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x4b')]){_0xb32cca[_0x6a00('0x4a')]=_[_0x6a00('0x4c')](_0xb32cca[_0x6a00('0x4a')],{'$or':_['map'](_0x20d1cc,function(_0xda167c){if(_0xda167c[_0x6a00('0x3c')]!==_0x6a00('0x4d')){var _0x459dfa={};_0x459dfa[_0xda167c['name']]={'$like':'%'+_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x4b')]+'%'};return _0x459dfa;}})});}_0xb32cca=_['merge']({},_0xb32cca,_0x33aa9c[_0x6a00('0x4e')]);var _0x22b2ba={'where':_0xb32cca[_0x6a00('0x4a')]};return db[_0x6a00('0x3a')][_0x6a00('0x2c')](_0x22b2ba)['then'](function(_0x51fcfa){_0x16da4f['count']=_0x51fcfa;if(_0x33aa9c[_0x6a00('0x3e')][_0x6a00('0x4f')]){_0xb32cca['include']=[{'all':!![]}];}return db[_0x6a00('0x3a')][_0x6a00('0x50')](_0xb32cca);})[_0x6a00('0x35')](function(_0x392710){_0x16da4f[_0x6a00('0x51')]=_0x392710;return _0x16da4f;})['then'](respondWithFilteredResult(_0x1729ef,_0xb32cca))['catch'](handleError(_0x1729ef,null));};exports[_0x6a00('0x52')]=function(_0x3baa98,_0x31810f){var _0x159eb4={'raw':![],'where':{'id':_0x3baa98[_0x6a00('0x53')]['id']}},_0x3eb2c8={};_0x3eb2c8[_0x6a00('0x42')]=_[_0x6a00('0x3f')](db[_0x6a00('0x3a')][_0x6a00('0x54')]);_0x3eb2c8[_0x6a00('0x3e')]=_[_0x6a00('0x3f')](_0x3baa98[_0x6a00('0x3e')]);_0x3eb2c8['filters']=_[_0x6a00('0x41')](_0x3eb2c8[_0x6a00('0x42')],_0x3eb2c8[_0x6a00('0x3e')]);_0x159eb4['attributes']=_[_0x6a00('0x41')](_0x3eb2c8[_0x6a00('0x42')],qs[_0x6a00('0x44')](_0x3baa98[_0x6a00('0x3e')][_0x6a00('0x44')]));_0x159eb4['attributes']=_0x159eb4[_0x6a00('0x43')][_0x6a00('0x45')]?_0x159eb4[_0x6a00('0x43')]:_0x3eb2c8[_0x6a00('0x42')];if(_0x3baa98[_0x6a00('0x3e')][_0x6a00('0x4f')]){_0x159eb4['include']=[{'all':!![]}];}_0x159eb4=_['merge']({},_0x159eb4,_0x3baa98[_0x6a00('0x4e')]);return db[_0x6a00('0x3a')][_0x6a00('0x55')](_0x159eb4)[_0x6a00('0x35')](handleEntityNotFound(_0x31810f,null))['then'](respondWithResult(_0x31810f,null))[_0x6a00('0x25')](handleError(_0x31810f,null));};exports[_0x6a00('0x56')]=function(_0x3a4354,_0xc8ca14,_0x1e4054){var _0x1a0a4c;return db[_0x6a00('0x3a')]['create'](_0x3a4354[_0x6a00('0x57')],{'raw':!![]})[_0x6a00('0x35')](function(_0x196180){_0x1a0a4c=_0x196180;return db[_0x6a00('0x3a')][_0x6a00('0x50')]({'raw':!![]});})['then'](function(_0x349400){var _0x55e053=fs[_0x6a00('0x58')](path['join'](config[_0x6a00('0x59')],_0x6a00('0x5a')),_0x6a00('0x5b'));var _0x4a5311=ejs['render'](_0x55e053,{'contexts':_0x349400||[]});fs[_0x6a00('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4a5311);})[_0x6a00('0x35')](function(){return respondWithRpcPromise(_0x6a00('0x5d'),_0x6a00('0x56'),{'module':_0x6a00('0x5e')});})[_0x6a00('0x35')](function(){var _0x53f19a=_0x3a4354[_0x6a00('0x5f')][_0x6a00('0x60')]({'plain':!![]});if(!_0x53f19a)throw new Error(_0x6a00('0x61'));if(_0x53f19a[_0x6a00('0x62')]===_0x6a00('0x5f')){var _0x3f6d85=_0x1a0a4c[_0x6a00('0x60')]({'plain':!![]});return db[_0x6a00('0x63')][_0x6a00('0x55')]({'where':{'name':'Contexts','userProfileId':_0x53f19a[_0x6a00('0x64')]},'raw':!![]})[_0x6a00('0x35')](function(_0x23b3c4){if(_0x23b3c4&&_0x23b3c4[_0x6a00('0x65')]===0x0){return db[_0x6a00('0x66')][_0x6a00('0x56')]({'name':_0x3f6d85[_0x6a00('0x37')],'resourceId':_0x3f6d85['id'],'type':_0x23b3c4[_0x6a00('0x37')],'sectionId':_0x23b3c4['id']},{})['then'](function(){return _0x1a0a4c;});}else{return _0x1a0a4c;}})[_0x6a00('0x25')](function(_0x4dc236){logger[_0x6a00('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dc236);throw _0x4dc236;});}return _0x1a0a4c;})['then'](respondWithResult(_0xc8ca14,0xc9))[_0x6a00('0x25')](handleError(_0xc8ca14,null));};exports[_0x6a00('0x33')]=function(_0x59c9da,_0x4d84b3,_0x2743c3){var _0x26464a;return db[_0x6a00('0x3a')][_0x6a00('0x55')]({'where':{'id':_0x59c9da[_0x6a00('0x53')]['id']}})[_0x6a00('0x35')](handleEntityNotFound(_0x4d84b3,null))['then'](saveUpdates(_0x59c9da[_0x6a00('0x57')],null))[_0x6a00('0x35')](function(_0x164f48){if(_0x164f48){_0x26464a=_0x164f48;return db[_0x6a00('0x3a')][_0x6a00('0x50')]({'raw':!![]});}})[_0x6a00('0x35')](function(_0x113ddc){var _0xe79444=fs[_0x6a00('0x58')](path[_0x6a00('0x67')](config[_0x6a00('0x59')],_0x6a00('0x5a')),'utf8');var _0x5245d7=ejs[_0x6a00('0x68')](_0xe79444,{'contexts':_0x113ddc||[]});fs[_0x6a00('0x5c')](_0x6a00('0x69'),_0x5245d7);})[_0x6a00('0x35')](function(){return respondWithRpcPromise(_0x6a00('0x5d'),_0x6a00('0x33'),{'module':'chan_sip.so'});})[_0x6a00('0x35')](function(){return _0x26464a;})[_0x6a00('0x35')](respondWithResult(_0x4d84b3,null))['catch'](handleError(_0x4d84b3,null));};exports[_0x6a00('0x6a')]=function(_0x23d1e1,_0x5302d8,_0x112654){var _0x3fa7a7;return db[_0x6a00('0x3a')][_0x6a00('0x55')]({'where':{'id':_0x23d1e1[_0x6a00('0x53')]['id']}})['then'](handleEntityNotFound(_0x5302d8,null))[_0x6a00('0x35')](removeEntity(_0x5302d8,null))[_0x6a00('0x35')](function(){return db[_0x6a00('0x3a')][_0x6a00('0x50')]({'raw':!![]});})[_0x6a00('0x35')](function(_0x4d0cf4){var _0x35797f=fs[_0x6a00('0x58')](path[_0x6a00('0x67')](config[_0x6a00('0x59')],_0x6a00('0x5a')),_0x6a00('0x5b'));var _0x380059=ejs[_0x6a00('0x68')](_0x35797f,{'contexts':_0x4d0cf4});fs[_0x6a00('0x5c')](_0x6a00('0x69'),_0x380059);return respondWithRpcPromise(_0x6a00('0x5d'),_0x6a00('0x6a'),{'module':_0x6a00('0x5e')});})[_0x6a00('0x25')](handleError(_0x5302d8,null));}; \ No newline at end of file +var _0xd5e2=['autoAssociation','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','VoiceContext','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','get','role','UserProfileSection','find','Contexts'];(function(_0x92ec83,_0x209090){var _0x5b134d=function(_0x56aecb){while(--_0x56aecb){_0x92ec83['push'](_0x92ec83['shift']());}};_0x5b134d(++_0x209090);}(_0xd5e2,0xd1));var _0x2d5e=function(_0x4dfe7f,_0x119573){_0x4dfe7f=_0x4dfe7f-0x0;var _0x943afe=_0xd5e2[_0x4dfe7f];return _0x943afe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d5e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d5e('0x1'));var rp=require(_0x2d5e('0x2'));var moment=require(_0x2d5e('0x3'));var BPromise=require(_0x2d5e('0x4'));var Mustache=require(_0x2d5e('0x5'));var util=require(_0x2d5e('0x6'));var path=require(_0x2d5e('0x7'));var sox=require(_0x2d5e('0x8'));var csv=require(_0x2d5e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d5e('0xa'));var _=require('lodash');var squel=require(_0x2d5e('0xb'));var crypto=require(_0x2d5e('0xc'));var jsforce=require(_0x2d5e('0xd'));var deskjs=require(_0x2d5e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d5e('0xf'));var as=require(_0x2d5e('0x10'));var hardwareService=require(_0x2d5e('0x11'));var logger=require(_0x2d5e('0x12'))(_0x2d5e('0x13'));var utils=require(_0x2d5e('0x14'));var config=require(_0x2d5e('0x15'));var licenseUtil=require(_0x2d5e('0x16'));var db=require(_0x2d5e('0x17'))['db'];var jayson=require(_0x2d5e('0x18'));var client=jayson[_0x2d5e('0x19')][_0x2d5e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1a50fe,_0x2f37d7,_0x499cba,_0x4e3c8e){return new BPromise(function(_0xa5a55b,_0x1ac9a1){var _0x403d7d=_0x4e3c8e||client;return _0x403d7d[_0x2d5e('0x1b')](_0x1a50fe,_0x499cba)[_0x2d5e('0x1c')](function(_0x10c82c){logger[_0x2d5e('0x1d')](_0x2d5e('0x1e'),_0x2f37d7,_0x2d5e('0x1f'));logger[_0x2d5e('0x20')](_0x2d5e('0x21'),_0x2f37d7,_0x2d5e('0x1f'),JSON[_0x2d5e('0x22')](_0x10c82c));if(_0x10c82c[_0x2d5e('0x23')]){if(_0x10c82c[_0x2d5e('0x23')][_0x2d5e('0x24')]===0x1f4){logger[_0x2d5e('0x23')](_0x2d5e('0x1e'),_0x2f37d7,_0x10c82c[_0x2d5e('0x23')][_0x2d5e('0x25')]);return _0x1ac9a1(_0x10c82c[_0x2d5e('0x23')][_0x2d5e('0x25')]);}logger[_0x2d5e('0x23')](_0x2d5e('0x1e'),_0x2f37d7,_0x10c82c[_0x2d5e('0x23')][_0x2d5e('0x25')]);return _0xa5a55b(_0x10c82c[_0x2d5e('0x23')][_0x2d5e('0x25')]);}else{logger[_0x2d5e('0x1d')](_0x2d5e('0x1e'),_0x2f37d7,_0x2d5e('0x1f'));_0xa5a55b(_0x10c82c[_0x2d5e('0x26')][_0x2d5e('0x25')]);}})[_0x2d5e('0x27')](function(_0x5619c5){logger['error'](_0x2d5e('0x1e'),_0x2f37d7,_0x5619c5);_0x1ac9a1(_0x5619c5);});});}function respondWithStatusCode(_0x245578,_0x436b2b){_0x436b2b=_0x436b2b||0xcc;return function(_0x21f8fc){if(_0x21f8fc){return _0x245578[_0x2d5e('0x28')](_0x436b2b);}return _0x245578[_0x2d5e('0x29')](_0x436b2b)[_0x2d5e('0x2a')]();};}function respondWithResult(_0x3b4b65,_0x310da0){_0x310da0=_0x310da0||0xc8;return function(_0x4dd596){if(_0x4dd596){return _0x3b4b65[_0x2d5e('0x29')](_0x310da0)['json'](_0x4dd596);}};}function respondWithFilteredResult(_0x2f9343,_0x518499){return function(_0x454773){if(_0x454773){var _0x458e94=typeof _0x518499[_0x2d5e('0x2b')]===_0x2d5e('0x2c')&&typeof _0x518499[_0x2d5e('0x2d')]===_0x2d5e('0x2c');var _0x534422=_0x454773[_0x2d5e('0x2e')];var _0x228b21=_0x458e94?0x0:_0x518499[_0x2d5e('0x2b')];var _0x4361c9=_0x458e94?_0x454773[_0x2d5e('0x2e')]:_0x518499[_0x2d5e('0x2b')]+_0x518499['limit'];var _0x4a9857;if(_0x4361c9>=_0x534422){_0x4361c9=_0x534422;_0x4a9857=0xc8;}else{_0x4a9857=0xce;}_0x2f9343['status'](_0x4a9857);return _0x2f9343['set']('Content-Range',_0x228b21+'-'+_0x4361c9+'/'+_0x534422)[_0x2d5e('0x2f')](_0x454773);}return null;};}function patchUpdates(_0x3a971a){return function(_0x4e38a4){try{jsonpatch[_0x2d5e('0x30')](_0x4e38a4,_0x3a971a,!![]);}catch(_0x44e222){return BPromise[_0x2d5e('0x31')](_0x44e222);}return _0x4e38a4[_0x2d5e('0x32')]();};}function saveUpdates(_0x1f8d91,_0x47b36f){return function(_0x260c5b){if(_0x260c5b){return _0x260c5b[_0x2d5e('0x33')](_0x1f8d91)[_0x2d5e('0x1c')](function(_0x28bc08){return _0x28bc08;});}return null;};}function removeEntity(_0x100e9a,_0x5d1bed){return function(_0x30662e){if(_0x30662e){return _0x30662e[_0x2d5e('0x34')]()[_0x2d5e('0x1c')](function(){var _0x5c3eb7=_0x30662e['get']({'plain':!![]});var _0x468854='Contexts';return db[_0x2d5e('0x35')][_0x2d5e('0x34')]({'where':{'type':_0x468854,'resourceId':_0x5c3eb7['id']}})[_0x2d5e('0x1c')](function(){return _0x30662e;});})['then'](function(){_0x100e9a[_0x2d5e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5600bc,_0x48f820){return function(_0x44aa66){if(!_0x44aa66){_0x5600bc['sendStatus'](0x194);}return _0x44aa66;};}function handleError(_0x154baf,_0x288a7a){_0x288a7a=_0x288a7a||0x1f4;return function(_0x3ebe84){logger[_0x2d5e('0x23')](_0x3ebe84[_0x2d5e('0x36')]);if(_0x3ebe84[_0x2d5e('0x37')]){delete _0x3ebe84[_0x2d5e('0x37')];}_0x154baf[_0x2d5e('0x29')](_0x288a7a)[_0x2d5e('0x38')](_0x3ebe84);};}exports['index']=function(_0x47614b,_0x15b00a){var _0x34ef5a={},_0x557542={},_0x20a7d3={'count':0x0,'rows':[]};var _0x1315d9=_['map'](db[_0x2d5e('0x39')]['rawAttributes'],function(_0x4f61e8){return{'name':_0x4f61e8[_0x2d5e('0x3a')],'type':_0x4f61e8[_0x2d5e('0x3b')][_0x2d5e('0x3c')]};});_0x557542['model']=_[_0x2d5e('0x3d')](_0x1315d9,'name');_0x557542[_0x2d5e('0x3e')]=_['keys'](_0x47614b[_0x2d5e('0x3e')]);_0x557542[_0x2d5e('0x3f')]=_[_0x2d5e('0x40')](_0x557542[_0x2d5e('0x41')],_0x557542['query']);_0x34ef5a[_0x2d5e('0x42')]=_[_0x2d5e('0x40')](_0x557542[_0x2d5e('0x41')],qs[_0x2d5e('0x43')](_0x47614b[_0x2d5e('0x3e')][_0x2d5e('0x43')]));_0x34ef5a[_0x2d5e('0x42')]=_0x34ef5a['attributes'][_0x2d5e('0x44')]?_0x34ef5a[_0x2d5e('0x42')]:_0x557542[_0x2d5e('0x41')];if(!_0x47614b[_0x2d5e('0x3e')][_0x2d5e('0x45')](_0x2d5e('0x46'))){_0x34ef5a['limit']=qs[_0x2d5e('0x2d')](_0x47614b['query'][_0x2d5e('0x2d')]);_0x34ef5a[_0x2d5e('0x2b')]=qs[_0x2d5e('0x2b')](_0x47614b['query'][_0x2d5e('0x2b')]);}_0x34ef5a[_0x2d5e('0x47')]=qs['sort'](_0x47614b['query'][_0x2d5e('0x48')]);_0x34ef5a['where']=qs[_0x2d5e('0x3f')](_['pick'](_0x47614b[_0x2d5e('0x3e')],_0x557542[_0x2d5e('0x3f')]),_0x1315d9);if(_0x47614b[_0x2d5e('0x3e')][_0x2d5e('0x49')]){_0x34ef5a[_0x2d5e('0x4a')]=_[_0x2d5e('0x4b')](_0x34ef5a[_0x2d5e('0x4a')],{'$or':_[_0x2d5e('0x3d')](_0x1315d9,function(_0x575aef){if(_0x575aef['type']!==_0x2d5e('0x4c')){var _0x55f5bf={};_0x55f5bf[_0x575aef[_0x2d5e('0x37')]]={'$like':'%'+_0x47614b[_0x2d5e('0x3e')][_0x2d5e('0x49')]+'%'};return _0x55f5bf;}})});}_0x34ef5a=_[_0x2d5e('0x4b')]({},_0x34ef5a,_0x47614b[_0x2d5e('0x4d')]);var _0x409138={'where':_0x34ef5a[_0x2d5e('0x4a')]};return db[_0x2d5e('0x39')][_0x2d5e('0x2e')](_0x409138)[_0x2d5e('0x1c')](function(_0x1978a){_0x20a7d3[_0x2d5e('0x2e')]=_0x1978a;if(_0x47614b[_0x2d5e('0x3e')][_0x2d5e('0x4e')]){_0x34ef5a['include']=[{'all':!![]}];}return db[_0x2d5e('0x39')][_0x2d5e('0x4f')](_0x34ef5a);})[_0x2d5e('0x1c')](function(_0x201f0c){_0x20a7d3[_0x2d5e('0x50')]=_0x201f0c;return _0x20a7d3;})[_0x2d5e('0x1c')](respondWithFilteredResult(_0x15b00a,_0x34ef5a))[_0x2d5e('0x27')](handleError(_0x15b00a,null));};exports[_0x2d5e('0x51')]=function(_0x30baeb,_0x371b78){var _0x4856bf={'raw':![],'where':{'id':_0x30baeb[_0x2d5e('0x52')]['id']}},_0x4f18a4={};_0x4f18a4['model']=_[_0x2d5e('0x53')](db['VoiceContext'][_0x2d5e('0x54')]);_0x4f18a4[_0x2d5e('0x3e')]=_[_0x2d5e('0x53')](_0x30baeb[_0x2d5e('0x3e')]);_0x4f18a4[_0x2d5e('0x3f')]=_[_0x2d5e('0x40')](_0x4f18a4[_0x2d5e('0x41')],_0x4f18a4[_0x2d5e('0x3e')]);_0x4856bf[_0x2d5e('0x42')]=_['intersection'](_0x4f18a4[_0x2d5e('0x41')],qs['fields'](_0x30baeb[_0x2d5e('0x3e')][_0x2d5e('0x43')]));_0x4856bf[_0x2d5e('0x42')]=_0x4856bf[_0x2d5e('0x42')]['length']?_0x4856bf[_0x2d5e('0x42')]:_0x4f18a4[_0x2d5e('0x41')];if(_0x30baeb['query'][_0x2d5e('0x4e')]){_0x4856bf[_0x2d5e('0x55')]=[{'all':!![]}];}_0x4856bf=_['merge']({},_0x4856bf,_0x30baeb['options']);return db[_0x2d5e('0x39')]['find'](_0x4856bf)['then'](handleEntityNotFound(_0x371b78,null))['then'](respondWithResult(_0x371b78,null))['catch'](handleError(_0x371b78,null));};exports['create']=function(_0x12f46c,_0x37c02e,_0x4b1c01){var _0x1171e1;return db[_0x2d5e('0x39')]['create'](_0x12f46c[_0x2d5e('0x56')],{'raw':!![]})[_0x2d5e('0x1c')](function(_0x2b365b){_0x1171e1=_0x2b365b;return db[_0x2d5e('0x39')][_0x2d5e('0x4f')]({'raw':!![]});})[_0x2d5e('0x1c')](function(_0x247b13){var _0x5d8840=fs[_0x2d5e('0x57')](path[_0x2d5e('0x58')](config['root'],_0x2d5e('0x59')),_0x2d5e('0x5a'));var _0x50d2fe=ejs[_0x2d5e('0x5b')](_0x5d8840,{'contexts':_0x247b13||[]});fs[_0x2d5e('0x5c')](_0x2d5e('0x5d'),_0x50d2fe);})[_0x2d5e('0x1c')](function(){return respondWithRpcPromise(_0x2d5e('0x5e'),_0x2d5e('0x5f'),{'module':_0x2d5e('0x60')});})[_0x2d5e('0x1c')](function(){var _0x102a64=_0x12f46c[_0x2d5e('0x61')][_0x2d5e('0x62')]({'plain':!![]});if(!_0x102a64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102a64[_0x2d5e('0x63')]===_0x2d5e('0x61')){var _0x2c46f6=_0x1171e1[_0x2d5e('0x62')]({'plain':!![]});return db[_0x2d5e('0x64')][_0x2d5e('0x65')]({'where':{'name':_0x2d5e('0x66'),'userProfileId':_0x102a64['userProfileId']},'raw':!![]})[_0x2d5e('0x1c')](function(_0x19363a){if(_0x19363a&&_0x19363a[_0x2d5e('0x67')]===0x0){return db['UserProfileResource'][_0x2d5e('0x5f')]({'name':_0x2c46f6[_0x2d5e('0x37')],'resourceId':_0x2c46f6['id'],'type':_0x19363a[_0x2d5e('0x37')],'sectionId':_0x19363a['id']},{})[_0x2d5e('0x1c')](function(){return _0x1171e1;});}else{return _0x1171e1;}})['catch'](function(_0x25d653){logger[_0x2d5e('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25d653);throw _0x25d653;});}return _0x1171e1;})[_0x2d5e('0x1c')](respondWithResult(_0x37c02e,0xc9))[_0x2d5e('0x27')](handleError(_0x37c02e,null));};exports[_0x2d5e('0x33')]=function(_0x443812,_0x135b08,_0x4f96d8){var _0x1c55f6;return db['VoiceContext'][_0x2d5e('0x65')]({'where':{'id':_0x443812['params']['id']}})[_0x2d5e('0x1c')](handleEntityNotFound(_0x135b08,null))[_0x2d5e('0x1c')](saveUpdates(_0x443812[_0x2d5e('0x56')],null))[_0x2d5e('0x1c')](function(_0x222862){if(_0x222862){_0x1c55f6=_0x222862;return db[_0x2d5e('0x39')][_0x2d5e('0x4f')]({'raw':!![]});}})[_0x2d5e('0x1c')](function(_0x5f2aae){var _0x2009b1=fs[_0x2d5e('0x57')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x2d5e('0x5a'));var _0x4a83c2=ejs[_0x2d5e('0x5b')](_0x2009b1,{'contexts':_0x5f2aae||[]});fs[_0x2d5e('0x5c')](_0x2d5e('0x5d'),_0x4a83c2);})[_0x2d5e('0x1c')](function(){return respondWithRpcPromise('Reload',_0x2d5e('0x33'),{'module':_0x2d5e('0x60')});})[_0x2d5e('0x1c')](function(){return _0x1c55f6;})[_0x2d5e('0x1c')](respondWithResult(_0x135b08,null))[_0x2d5e('0x27')](handleError(_0x135b08,null));};exports[_0x2d5e('0x34')]=function(_0x2bd1dc,_0x15dde4,_0x172b6b){var _0x5dc294;return db[_0x2d5e('0x39')][_0x2d5e('0x65')]({'where':{'id':_0x2bd1dc['params']['id']}})[_0x2d5e('0x1c')](handleEntityNotFound(_0x15dde4,null))[_0x2d5e('0x1c')](removeEntity(_0x15dde4,null))[_0x2d5e('0x1c')](function(){return db[_0x2d5e('0x39')]['findAll']({'raw':!![]});})[_0x2d5e('0x1c')](function(_0x55ac21){var _0x4833e5=fs[_0x2d5e('0x57')](path[_0x2d5e('0x58')](config['root'],_0x2d5e('0x59')),_0x2d5e('0x5a'));var _0x190c98=ejs['render'](_0x4833e5,{'contexts':_0x55ac21});fs[_0x2d5e('0x5c')](_0x2d5e('0x5d'),_0x190c98);return respondWithRpcPromise(_0x2d5e('0x5e'),'destroy',{'module':_0x2d5e('0x60')});})[_0x2d5e('0x27')](handleError(_0x15dde4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d697ac8..919496b 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 _0x6fb6=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x3fd8d3,_0x4d5b2e){var _0x51e8df=function(_0x3e9033){while(--_0x3e9033){_0x3fd8d3['push'](_0x3fd8d3['shift']());}};_0x51e8df(++_0x4d5b2e);}(_0x6fb6,0x139));var _0x66fb=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x6fb6[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x66fb('0x0'));var util=require(_0x66fb('0x1'));var logger=require(_0x66fb('0x2'))(_0x66fb('0x3'));var moment=require('moment');var BPromise=require(_0x66fb('0x4'));var rp=require(_0x66fb('0x5'));var fs=require('fs');var path=require(_0x66fb('0x6'));var rimraf=require(_0x66fb('0x7'));var config=require(_0x66fb('0x8'));var attributes=require(_0x66fb('0x9'));module[_0x66fb('0xa')]=function(_0xed5518,_0x5e3db2){return _0xed5518[_0x66fb('0xb')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ef=['VoiceContext','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x158307,_0x3a34c7){var _0x3dc1ab=function(_0x53f4f7){while(--_0x53f4f7){_0x158307['push'](_0x158307['shift']());}};_0x3dc1ab(++_0x3a34c7);}(_0x95ef,0x119));var _0xf95e=function(_0xf5a661,_0x35d9ba){_0xf5a661=_0xf5a661-0x0;var _0x3f37db=_0x95ef[_0xf5a661];return _0x3f37db;};'use strict';var _=require(_0xf95e('0x0'));var util=require('util');var logger=require(_0xf95e('0x1'))('api');var moment=require(_0xf95e('0x2'));var BPromise=require(_0xf95e('0x3'));var rp=require(_0xf95e('0x4'));var fs=require('fs');var path=require(_0xf95e('0x5'));var rimraf=require(_0xf95e('0x6'));var config=require(_0xf95e('0x7'));var attributes=require('./voiceContext.attributes');module[_0xf95e('0x8')]=function(_0x210873,_0x5148d9){return _0x210873['define'](_0xf95e('0x9'),attributes,{'tableName':'voice_contexts','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 c767fd5..94350d2 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 _0x6da9=['../../config/environment','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xfcd7a4,_0x4cb41d){var _0x2286b6=function(_0x176fb6){while(--_0x176fb6){_0xfcd7a4['push'](_0xfcd7a4['shift']());}};_0x2286b6(++_0x4cb41d);}(_0x6da9,0x161));var _0x96da=function(_0xee219,_0x5f31dd){_0xee219=_0xee219-0x0;var _0x23c3b4=_0x6da9[_0xee219];return _0x23c3b4;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var moment=require(_0x96da('0x2'));var BPromise=require(_0x96da('0x3'));var rs=require(_0x96da('0x4'));var fs=require('fs');var Redis=require(_0x96da('0x5'));var db=require(_0x96da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96da('0x7'));var jayson=require(_0x96da('0x8'));var client=jayson[_0x96da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc4b0,_0x5d7737,_0x161249){return new BPromise(function(_0x45ee2f,_0x3b0883){return client['request'](_0x1bc4b0,_0x161249)['then'](function(_0x4ed0c1){logger[_0x96da('0xa')](_0x96da('0xb'),_0x5d7737,_0x96da('0xc'));logger['debug'](_0x96da('0xd'),_0x5d7737,_0x96da('0xc'),JSON['stringify'](_0x4ed0c1));if(_0x4ed0c1[_0x96da('0xe')]){if(_0x4ed0c1[_0x96da('0xe')][_0x96da('0xf')]===0x1f4){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);return _0x3b0883(_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);}logger['error'](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')]['message']);return _0x45ee2f(_0x4ed0c1['error'][_0x96da('0x10')]);}else{logger[_0x96da('0xa')]('VoiceContext,\x20%s,\x20%s',_0x5d7737,_0x96da('0xc'));_0x45ee2f(_0x4ed0c1['result'][_0x96da('0x10')]);}})[_0x96da('0x11')](function(_0x2d6d15){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x2d6d15);_0x3b0883(_0x2d6d15);});});} \ No newline at end of file +var _0x6002=['client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0x6002,0x103));var _0x2600=function(_0x424800,_0x173bce){_0x424800=_0x424800-0x0;var _0x13e2f4=_0x6002[_0x424800];return _0x13e2f4;};'use strict';var _=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var moment=require('moment');var BPromise=require(_0x2600('0x2'));var rs=require(_0x2600('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2600('0x4'))['db'];var utils=require(_0x2600('0x5'));var logger=require(_0x2600('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2600('0x7')][_0x2600('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x557d06,_0x5b167d,_0x515353){return new BPromise(function(_0x4bd85b,_0x571677){return client[_0x2600('0x9')](_0x557d06,_0x515353)[_0x2600('0xa')](function(_0xd42bdb){logger[_0x2600('0xb')](_0x2600('0xc'),_0x5b167d,_0x2600('0xd'));logger['debug'](_0x2600('0xe'),_0x5b167d,_0x2600('0xd'),JSON[_0x2600('0xf')](_0xd42bdb));if(_0xd42bdb[_0x2600('0x10')]){if(_0xd42bdb[_0x2600('0x10')]['code']===0x1f4){logger[_0x2600('0x10')]('VoiceContext,\x20%s,\x20%s',_0x5b167d,_0xd42bdb['error'][_0x2600('0x11')]);return _0x571677(_0xd42bdb[_0x2600('0x10')][_0x2600('0x11')]);}logger[_0x2600('0x10')]('VoiceContext,\x20%s,\x20%s',_0x5b167d,_0xd42bdb['error']['message']);return _0x4bd85b(_0xd42bdb[_0x2600('0x10')][_0x2600('0x11')]);}else{logger['info'](_0x2600('0xc'),_0x5b167d,_0x2600('0xd'));_0x4bd85b(_0xd42bdb['result'][_0x2600('0x11')]);}})[_0x2600('0x12')](function(_0x200d55){logger['error'](_0x2600('0xc'),_0x5b167d,_0x200d55);_0x571677(_0x200d55);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 638a15e..c8387ba 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 _0x0b94=['./voiceDialReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x28cbf6,_0x1c6582){var _0x58e1ba=function(_0x15cce2){while(--_0x15cce2){_0x28cbf6['push'](_0x28cbf6['shift']());}};_0x58e1ba(++_0x1c6582);}(_0x0b94,0x91));var _0x40b9=function(_0x319269,_0x1d1cc2){_0x319269=_0x319269-0x0;var _0x19e2aa=_0x0b94[_0x319269];return _0x19e2aa;};'use strict';var multer=require(_0x40b9('0x0'));var util=require(_0x40b9('0x1'));var path=require(_0x40b9('0x2'));var timeout=require(_0x40b9('0x3'));var express=require(_0x40b9('0x4'));var router=express[_0x40b9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x40b9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x40b9('0x7'));router[_0x40b9('0x8')]('/',auth['isAuthenticated'](),controller[_0x40b9('0x9')]);router[_0x40b9('0x8')](_0x40b9('0xa'),auth[_0x40b9('0xb')](),controller['describe']);router[_0x40b9('0x8')](_0x40b9('0xc'),auth[_0x40b9('0xb')](),controller[_0x40b9('0xd')]);router[_0x40b9('0xe')]('/',auth[_0x40b9('0xb')](),controller[_0x40b9('0xf')]);router[_0x40b9('0x10')](_0x40b9('0xc'),auth[_0x40b9('0xb')](),controller[_0x40b9('0x11')]);router['delete'](_0x40b9('0xc'),auth[_0x40b9('0xb')](),controller['destroy']);module[_0x40b9('0x12')]=router; \ No newline at end of file +var _0x1cd6=['post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x9a8008,_0x41e9b9){var _0x237aa6=function(_0x340636){while(--_0x340636){_0x9a8008['push'](_0x9a8008['shift']());}};_0x237aa6(++_0x41e9b9);}(_0x1cd6,0x1eb));var _0x61cd=function(_0x1f9a3b,_0x1197a6){_0x1f9a3b=_0x1f9a3b-0x0;var _0x4a29d6=_0x1cd6[_0x1f9a3b];return _0x4a29d6;};'use strict';var multer=require(_0x61cd('0x0'));var util=require('util');var path=require(_0x61cd('0x1'));var timeout=require('connect-timeout');var express=require(_0x61cd('0x2'));var router=express[_0x61cd('0x3')]();var fs_extra=require(_0x61cd('0x4'));var auth=require(_0x61cd('0x5'));var interaction=require(_0x61cd('0x6'));var config=require(_0x61cd('0x7'));var controller=require(_0x61cd('0x8'));router[_0x61cd('0x9')]('/',auth[_0x61cd('0xa')](),controller[_0x61cd('0xb')]);router[_0x61cd('0x9')](_0x61cd('0xc'),auth[_0x61cd('0xa')](),controller['describe']);router[_0x61cd('0x9')](_0x61cd('0xd'),auth[_0x61cd('0xa')](),controller[_0x61cd('0xe')]);router[_0x61cd('0xf')]('/',auth['isAuthenticated'](),controller[_0x61cd('0x10')]);router[_0x61cd('0x11')](_0x61cd('0xd'),auth['isAuthenticated'](),controller[_0x61cd('0x12')]);router[_0x61cd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x61cd('0x14')]);module[_0x61cd('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 6736677..2515192 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1d7e99,_0x4403d8){_0x1d7e99=_0x1d7e99-0x0;var _0x37fd61=_0x8ef6[_0x1d7e99];return _0x37fd61;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2207bc,_0x31007b){_0x2207bc=_0x2207bc-0x0;var _0x417364=_0xd6d6[_0x2207bc];return _0x417364;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d5e0a19..e2b0a8d 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 _0x5665=['offset','undefined','limit','count','set','apply','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x3171a9,_0x4adaf6){var _0x167743=function(_0x1d922f){while(--_0x1d922f){_0x3171a9['push'](_0x3171a9['shift']());}};_0x167743(++_0x4adaf6);}(_0x5665,0xbb));var _0x5566=function(_0x95e807,_0x1256ef){_0x95e807=_0x95e807-0x0;var _0x165af5=_0x5665[_0x95e807];return _0x165af5;};'use strict';var emlformat=require(_0x5566('0x0'));var rimraf=require(_0x5566('0x1'));var zipdir=require(_0x5566('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5566('0x3'));var moment=require(_0x5566('0x4'));var BPromise=require(_0x5566('0x5'));var Mustache=require(_0x5566('0x6'));var util=require(_0x5566('0x7'));var path=require('path');var sox=require(_0x5566('0x8'));var csv=require(_0x5566('0x9'));var ejs=require(_0x5566('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(_0x5566('0xb'));var deskjs=require(_0x5566('0xc'));var toCsv=require(_0x5566('0x9'));var querystring=require(_0x5566('0xd'));var Papa=require(_0x5566('0xe'));var Redis=require(_0x5566('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5566('0x10'));var as=require(_0x5566('0x11'));var hardwareService=require(_0x5566('0x12'));var logger=require(_0x5566('0x13'))(_0x5566('0x14'));var utils=require(_0x5566('0x15'));var config=require(_0x5566('0x16'));var licenseUtil=require(_0x5566('0x17'));var db=require(_0x5566('0x18'))['db'];function respondWithStatusCode(_0x2c9070,_0x4513f3){_0x4513f3=_0x4513f3||0xcc;return function(_0x402310){if(_0x402310){return _0x2c9070[_0x5566('0x19')](_0x4513f3);}return _0x2c9070[_0x5566('0x1a')](_0x4513f3)[_0x5566('0x1b')]();};}function respondWithResult(_0x1b3008,_0x69bd12){_0x69bd12=_0x69bd12||0xc8;return function(_0x26b9d8){if(_0x26b9d8){return _0x1b3008[_0x5566('0x1a')](_0x69bd12)[_0x5566('0x1c')](_0x26b9d8);}};}function respondWithFilteredResult(_0x3aab8e,_0x1db5e5){return function(_0x114c98){if(_0x114c98){var _0x6e8aad=typeof _0x1db5e5[_0x5566('0x1d')]===_0x5566('0x1e')&&typeof _0x1db5e5[_0x5566('0x1f')]===_0x5566('0x1e');var _0x1ce58f=_0x114c98[_0x5566('0x20')];var _0x22d12f=_0x6e8aad?0x0:_0x1db5e5['offset'];var _0x2e909b=_0x6e8aad?_0x114c98[_0x5566('0x20')]:_0x1db5e5[_0x5566('0x1d')]+_0x1db5e5['limit'];var _0x1e3dc6;if(_0x2e909b>=_0x1ce58f){_0x2e909b=_0x1ce58f;_0x1e3dc6=0xc8;}else{_0x1e3dc6=0xce;}_0x3aab8e['status'](_0x1e3dc6);return _0x3aab8e[_0x5566('0x21')]('Content-Range',_0x22d12f+'-'+_0x2e909b+'/'+_0x1ce58f)['json'](_0x114c98);}return null;};}function patchUpdates(_0x514fe6){return function(_0x1adb9b){try{jsonpatch[_0x5566('0x22')](_0x1adb9b,_0x514fe6,!![]);}catch(_0x508ed6){return BPromise['reject'](_0x508ed6);}return _0x1adb9b['save']();};}function saveUpdates(_0x42e090,_0x4558fb){return function(_0x2b8232){if(_0x2b8232){return _0x2b8232[_0x5566('0x23')](_0x42e090)['then'](function(_0xb370ee){return _0xb370ee;});}return null;};}function removeEntity(_0x3f9215,_0x4705c9){return function(_0x59af67){if(_0x59af67){return _0x59af67['destroy']()[_0x5566('0x24')](function(){_0x3f9215[_0x5566('0x1a')](0xcc)[_0x5566('0x1b')]();});}};}function handleEntityNotFound(_0x58a5c9,_0x1cf427){return function(_0x24c2d6){if(!_0x24c2d6){_0x58a5c9[_0x5566('0x19')](0x194);}return _0x24c2d6;};}function handleError(_0x1d3575,_0x471797){_0x471797=_0x471797||0x1f4;return function(_0x4d7d61){logger['error'](_0x4d7d61[_0x5566('0x25')]);if(_0x4d7d61[_0x5566('0x26')]){delete _0x4d7d61[_0x5566('0x26')];}_0x1d3575[_0x5566('0x1a')](_0x471797)[_0x5566('0x27')](_0x4d7d61);};}exports[_0x5566('0x28')]=function(_0x165090,_0x3c5e25){var _0x27ab5d={},_0x3d9e0d={},_0x5aafb8={'count':0x0,'rows':[]};var _0xe7d0bf=_[_0x5566('0x29')](db['VoiceDialReport'][_0x5566('0x2a')],function(_0x20a9f1){return{'name':_0x20a9f1['fieldName'],'type':_0x20a9f1[_0x5566('0x2b')][_0x5566('0x2c')]};});_0x3d9e0d[_0x5566('0x2d')]=_['map'](_0xe7d0bf,_0x5566('0x26'));_0x3d9e0d[_0x5566('0x2e')]=_[_0x5566('0x2f')](_0x165090[_0x5566('0x2e')]);_0x3d9e0d[_0x5566('0x30')]=_[_0x5566('0x31')](_0x3d9e0d[_0x5566('0x2d')],_0x3d9e0d[_0x5566('0x2e')]);_0x27ab5d[_0x5566('0x32')]=_['intersection'](_0x3d9e0d['model'],qs['fields'](_0x165090['query'][_0x5566('0x33')]));_0x27ab5d[_0x5566('0x32')]=_0x27ab5d[_0x5566('0x32')]['length']?_0x27ab5d[_0x5566('0x32')]:_0x3d9e0d[_0x5566('0x2d')];if(!_0x165090[_0x5566('0x2e')]['hasOwnProperty'](_0x5566('0x34'))){_0x27ab5d[_0x5566('0x1f')]=qs[_0x5566('0x1f')](_0x165090['query'][_0x5566('0x1f')]);_0x27ab5d[_0x5566('0x1d')]=qs[_0x5566('0x1d')](_0x165090[_0x5566('0x2e')]['offset']);}_0x27ab5d[_0x5566('0x35')]=qs['sort'](_0x165090[_0x5566('0x2e')][_0x5566('0x36')]);_0x27ab5d[_0x5566('0x37')]=qs['filters'](_[_0x5566('0x38')](_0x165090['query'],_0x3d9e0d[_0x5566('0x30')]),_0xe7d0bf);if(_0x165090['query'][_0x5566('0x39')]){_0x27ab5d[_0x5566('0x37')]=_[_0x5566('0x3a')](_0x27ab5d[_0x5566('0x37')],{'$or':_[_0x5566('0x29')](_0xe7d0bf,function(_0x68e193){if(_0x68e193['type']!==_0x5566('0x3b')){var _0x314734={};_0x314734[_0x68e193[_0x5566('0x26')]]={'$like':'%'+_0x165090[_0x5566('0x2e')][_0x5566('0x39')]+'%'};return _0x314734;}})});}_0x27ab5d=_['merge']({},_0x27ab5d,_0x165090[_0x5566('0x3c')]);var _0x3babde={'where':_0x27ab5d[_0x5566('0x37')]};return db[_0x5566('0x3d')][_0x5566('0x20')](_0x3babde)[_0x5566('0x24')](function(_0x466410){_0x5aafb8[_0x5566('0x20')]=_0x466410;if(_0x165090[_0x5566('0x2e')][_0x5566('0x3e')]){_0x27ab5d[_0x5566('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x5566('0x40')](_0x27ab5d);})[_0x5566('0x24')](function(_0x4793b5){_0x5aafb8[_0x5566('0x41')]=_0x4793b5;return _0x5aafb8;})[_0x5566('0x24')](respondWithFilteredResult(_0x3c5e25,_0x27ab5d))[_0x5566('0x42')](handleError(_0x3c5e25,null));};exports[_0x5566('0x43')]=function(_0x12e7e0,_0x1051f7){var _0x7a3bed={'raw':!![],'where':{'id':_0x12e7e0[_0x5566('0x44')]['id']}},_0x57e924={};_0x57e924[_0x5566('0x2d')]=_[_0x5566('0x2f')](db[_0x5566('0x3d')][_0x5566('0x2a')]);_0x57e924[_0x5566('0x2e')]=_[_0x5566('0x2f')](_0x12e7e0[_0x5566('0x2e')]);_0x57e924[_0x5566('0x30')]=_[_0x5566('0x31')](_0x57e924[_0x5566('0x2d')],_0x57e924['query']);_0x7a3bed[_0x5566('0x32')]=_[_0x5566('0x31')](_0x57e924['model'],qs['fields'](_0x12e7e0[_0x5566('0x2e')][_0x5566('0x33')]));_0x7a3bed[_0x5566('0x32')]=_0x7a3bed[_0x5566('0x32')]['length']?_0x7a3bed[_0x5566('0x32')]:_0x57e924['model'];if(_0x12e7e0['query'][_0x5566('0x3e')]){_0x7a3bed[_0x5566('0x3f')]=[{'all':!![]}];}_0x7a3bed=_[_0x5566('0x3a')]({},_0x7a3bed,_0x12e7e0['options']);return db[_0x5566('0x3d')][_0x5566('0x45')](_0x7a3bed)[_0x5566('0x24')](handleEntityNotFound(_0x1051f7,null))[_0x5566('0x24')](respondWithResult(_0x1051f7,null))[_0x5566('0x42')](handleError(_0x1051f7,null));};exports['create']=function(_0x3296f0,_0x534e6c){return db[_0x5566('0x3d')][_0x5566('0x46')](_0x3296f0['body'],{})[_0x5566('0x24')](respondWithResult(_0x534e6c,0xc9))[_0x5566('0x42')](handleError(_0x534e6c,null));};exports[_0x5566('0x23')]=function(_0x446440,_0x4fd283){if(_0x446440[_0x5566('0x47')]['id']){delete _0x446440[_0x5566('0x47')]['id'];}return db[_0x5566('0x3d')][_0x5566('0x45')]({'where':{'id':_0x446440[_0x5566('0x44')]['id']}})[_0x5566('0x24')](handleEntityNotFound(_0x4fd283,null))[_0x5566('0x24')](saveUpdates(_0x446440['body'],null))[_0x5566('0x24')](respondWithResult(_0x4fd283,null))['catch'](handleError(_0x4fd283,null));};exports['destroy']=function(_0x4a8a23,_0x225259){return db['VoiceDialReport']['find']({'where':{'id':_0x4a8a23[_0x5566('0x44')]['id']}})[_0x5566('0x24')](handleEntityNotFound(_0x225259,null))[_0x5566('0x24')](removeEntity(_0x225259,null))['catch'](handleError(_0x225259,null));};exports['describe']=function(_0x385086,_0x3d10f3){return db[_0x5566('0x3d')]['describe']()['then'](respondWithResult(_0x3d10f3,null))[_0x5566('0x42')](handleError(_0x3d10f3,null));}; \ No newline at end of file +var _0x47fe=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','apply','save','update','destroy','then','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','VoiceDialReport','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','rimraf','request-promise','bluebird','util'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x47fe,0x150));var _0xe47f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x47fe[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe47f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe47f('0x1'));var moment=require('moment');var BPromise=require(_0xe47f('0x2'));var Mustache=require('mustache');var util=require(_0xe47f('0x3'));var path=require('path');var sox=require(_0xe47f('0x4'));var csv=require(_0xe47f('0x5'));var ejs=require(_0xe47f('0x6'));var fs=require('fs');var fs_extra=require(_0xe47f('0x7'));var _=require(_0xe47f('0x8'));var squel=require(_0xe47f('0x9'));var crypto=require('crypto');var jsforce=require(_0xe47f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe47f('0x5'));var querystring=require(_0xe47f('0xb'));var Papa=require(_0xe47f('0xc'));var Redis=require('ioredis');var authService=require(_0xe47f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe47f('0xe'))('api');var utils=require(_0xe47f('0xf'));var config=require(_0xe47f('0x10'));var licenseUtil=require(_0xe47f('0x11'));var db=require(_0xe47f('0x12'))['db'];function respondWithStatusCode(_0x2c91eb,_0x3c608e){_0x3c608e=_0x3c608e||0xcc;return function(_0x335ea6){if(_0x335ea6){return _0x2c91eb[_0xe47f('0x13')](_0x3c608e);}return _0x2c91eb['status'](_0x3c608e)['end']();};}function respondWithResult(_0xa0974a,_0x33f319){_0x33f319=_0x33f319||0xc8;return function(_0x3d3131){if(_0x3d3131){return _0xa0974a['status'](_0x33f319)[_0xe47f('0x14')](_0x3d3131);}};}function respondWithFilteredResult(_0x393a16,_0x17729e){return function(_0x9132f9){if(_0x9132f9){var _0x329de5=typeof _0x17729e[_0xe47f('0x15')]===_0xe47f('0x16')&&typeof _0x17729e['limit']===_0xe47f('0x16');var _0xea940d=_0x9132f9[_0xe47f('0x17')];var _0x14a6bb=_0x329de5?0x0:_0x17729e[_0xe47f('0x15')];var _0x3d5590=_0x329de5?_0x9132f9[_0xe47f('0x17')]:_0x17729e['offset']+_0x17729e[_0xe47f('0x18')];var _0x45e3e1;if(_0x3d5590>=_0xea940d){_0x3d5590=_0xea940d;_0x45e3e1=0xc8;}else{_0x45e3e1=0xce;}_0x393a16['status'](_0x45e3e1);return _0x393a16['set']('Content-Range',_0x14a6bb+'-'+_0x3d5590+'/'+_0xea940d)[_0xe47f('0x14')](_0x9132f9);}return null;};}function patchUpdates(_0x33b923){return function(_0x163fcd){try{jsonpatch[_0xe47f('0x19')](_0x163fcd,_0x33b923,!![]);}catch(_0x49a6c3){return BPromise['reject'](_0x49a6c3);}return _0x163fcd[_0xe47f('0x1a')]();};}function saveUpdates(_0x2447f1,_0x280f62){return function(_0x552024){if(_0x552024){return _0x552024[_0xe47f('0x1b')](_0x2447f1)['then'](function(_0x1a1422){return _0x1a1422;});}return null;};}function removeEntity(_0x5f3ec1,_0x355d0d){return function(_0x2d61a6){if(_0x2d61a6){return _0x2d61a6[_0xe47f('0x1c')]()[_0xe47f('0x1d')](function(){_0x5f3ec1[_0xe47f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf747,_0x1529d9){return function(_0x13fdbe){if(!_0x13fdbe){_0x4bf747[_0xe47f('0x13')](0x194);}return _0x13fdbe;};}function handleError(_0x413fe1,_0x4a71c3){_0x4a71c3=_0x4a71c3||0x1f4;return function(_0x425ff9){logger[_0xe47f('0x1f')](_0x425ff9[_0xe47f('0x20')]);if(_0x425ff9[_0xe47f('0x21')]){delete _0x425ff9[_0xe47f('0x21')];}_0x413fe1[_0xe47f('0x1e')](_0x4a71c3)[_0xe47f('0x22')](_0x425ff9);};}exports[_0xe47f('0x23')]=function(_0x4c813e,_0x26f60c){var _0xcd61b8={},_0x2f926d={},_0x1806c4={'count':0x0,'rows':[]};var _0x14019e=_[_0xe47f('0x24')](db['VoiceDialReport'][_0xe47f('0x25')],function(_0xc62dfe){return{'name':_0xc62dfe[_0xe47f('0x26')],'type':_0xc62dfe[_0xe47f('0x27')][_0xe47f('0x28')]};});_0x2f926d[_0xe47f('0x29')]=_[_0xe47f('0x24')](_0x14019e,_0xe47f('0x21'));_0x2f926d[_0xe47f('0x2a')]=_['keys'](_0x4c813e[_0xe47f('0x2a')]);_0x2f926d[_0xe47f('0x2b')]=_['intersection'](_0x2f926d['model'],_0x2f926d[_0xe47f('0x2a')]);_0xcd61b8[_0xe47f('0x2c')]=_[_0xe47f('0x2d')](_0x2f926d['model'],qs[_0xe47f('0x2e')](_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x2e')]));_0xcd61b8[_0xe47f('0x2c')]=_0xcd61b8[_0xe47f('0x2c')][_0xe47f('0x2f')]?_0xcd61b8['attributes']:_0x2f926d[_0xe47f('0x29')];if(!_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x30')](_0xe47f('0x31'))){_0xcd61b8[_0xe47f('0x18')]=qs[_0xe47f('0x18')](_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x18')]);_0xcd61b8[_0xe47f('0x15')]=qs[_0xe47f('0x15')](_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x15')]);}_0xcd61b8[_0xe47f('0x32')]=qs[_0xe47f('0x33')](_0x4c813e['query'][_0xe47f('0x33')]);_0xcd61b8['where']=qs[_0xe47f('0x2b')](_['pick'](_0x4c813e[_0xe47f('0x2a')],_0x2f926d[_0xe47f('0x2b')]),_0x14019e);if(_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x34')]){_0xcd61b8['where']=_[_0xe47f('0x35')](_0xcd61b8['where'],{'$or':_[_0xe47f('0x24')](_0x14019e,function(_0x4df20c){if(_0x4df20c[_0xe47f('0x27')]!==_0xe47f('0x36')){var _0x387824={};_0x387824[_0x4df20c['name']]={'$like':'%'+_0x4c813e[_0xe47f('0x2a')][_0xe47f('0x34')]+'%'};return _0x387824;}})});}_0xcd61b8=_[_0xe47f('0x35')]({},_0xcd61b8,_0x4c813e[_0xe47f('0x37')]);var _0x1979d2={'where':_0xcd61b8['where']};return db[_0xe47f('0x38')][_0xe47f('0x17')](_0x1979d2)[_0xe47f('0x1d')](function(_0x19b083){_0x1806c4['count']=_0x19b083;if(_0x4c813e[_0xe47f('0x2a')]['includeAll']){_0xcd61b8[_0xe47f('0x39')]=[{'all':!![]}];}return db[_0xe47f('0x38')][_0xe47f('0x3a')](_0xcd61b8);})[_0xe47f('0x1d')](function(_0xffa646){_0x1806c4[_0xe47f('0x3b')]=_0xffa646;return _0x1806c4;})[_0xe47f('0x1d')](respondWithFilteredResult(_0x26f60c,_0xcd61b8))[_0xe47f('0x3c')](handleError(_0x26f60c,null));};exports['show']=function(_0x49e460,_0x22e844){var _0xb00a5a={'raw':!![],'where':{'id':_0x49e460[_0xe47f('0x3d')]['id']}},_0x5a048f={};_0x5a048f[_0xe47f('0x29')]=_[_0xe47f('0x3e')](db[_0xe47f('0x38')][_0xe47f('0x25')]);_0x5a048f[_0xe47f('0x2a')]=_[_0xe47f('0x3e')](_0x49e460['query']);_0x5a048f['filters']=_[_0xe47f('0x2d')](_0x5a048f[_0xe47f('0x29')],_0x5a048f[_0xe47f('0x2a')]);_0xb00a5a[_0xe47f('0x2c')]=_[_0xe47f('0x2d')](_0x5a048f[_0xe47f('0x29')],qs[_0xe47f('0x2e')](_0x49e460[_0xe47f('0x2a')][_0xe47f('0x2e')]));_0xb00a5a[_0xe47f('0x2c')]=_0xb00a5a[_0xe47f('0x2c')][_0xe47f('0x2f')]?_0xb00a5a[_0xe47f('0x2c')]:_0x5a048f[_0xe47f('0x29')];if(_0x49e460[_0xe47f('0x2a')][_0xe47f('0x3f')]){_0xb00a5a['include']=[{'all':!![]}];}_0xb00a5a=_[_0xe47f('0x35')]({},_0xb00a5a,_0x49e460[_0xe47f('0x37')]);return db['VoiceDialReport'][_0xe47f('0x40')](_0xb00a5a)['then'](handleEntityNotFound(_0x22e844,null))['then'](respondWithResult(_0x22e844,null))['catch'](handleError(_0x22e844,null));};exports[_0xe47f('0x41')]=function(_0x436e13,_0x458cef){return db['VoiceDialReport'][_0xe47f('0x41')](_0x436e13[_0xe47f('0x42')],{})[_0xe47f('0x1d')](respondWithResult(_0x458cef,0xc9))['catch'](handleError(_0x458cef,null));};exports[_0xe47f('0x1b')]=function(_0x447a1b,_0x58a3d2){if(_0x447a1b[_0xe47f('0x42')]['id']){delete _0x447a1b[_0xe47f('0x42')]['id'];}return db[_0xe47f('0x38')]['find']({'where':{'id':_0x447a1b[_0xe47f('0x3d')]['id']}})[_0xe47f('0x1d')](handleEntityNotFound(_0x58a3d2,null))[_0xe47f('0x1d')](saveUpdates(_0x447a1b[_0xe47f('0x42')],null))[_0xe47f('0x1d')](respondWithResult(_0x58a3d2,null))['catch'](handleError(_0x58a3d2,null));};exports[_0xe47f('0x1c')]=function(_0x298915,_0x5f001b){return db['VoiceDialReport'][_0xe47f('0x40')]({'where':{'id':_0x298915[_0xe47f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5f001b,null))[_0xe47f('0x1d')](removeEntity(_0x5f001b,null))['catch'](handleError(_0x5f001b,null));};exports[_0xe47f('0x43')]=function(_0x29c43b,_0x1e40b3){return db[_0xe47f('0x38')]['describe']()[_0xe47f('0x1d')](respondWithResult(_0x1e40b3,null))[_0xe47f('0x3c')](handleError(_0x1e40b3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 23359f1..5e244b0 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 _0x8187=['../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5143a1,_0x391649){var _0x380dc9=function(_0xae5ac2){while(--_0xae5ac2){_0x5143a1['push'](_0x5143a1['shift']());}};_0x380dc9(++_0x391649);}(_0x8187,0x102));var _0x7818=function(_0x593c95,_0x21eea8){_0x593c95=_0x593c95-0x0;var _0x30cb5f=_0x8187[_0x593c95];return _0x30cb5f;};'use strict';var _=require('lodash');var util=require(_0x7818('0x0'));var logger=require(_0x7818('0x1'))(_0x7818('0x2'));var moment=require('moment');var BPromise=require(_0x7818('0x3'));var rp=require(_0x7818('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7818('0x5'));var config=require(_0x7818('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x7818('0x7')]=function(_0x4f7b39,_0x466f83){return _0x4f7b39[_0x7818('0x8')](_0x7818('0x9'),attributes,{'tableName':_0x7818('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7818('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','report_dial','uniqueid','util','../../config/logger','api','moment'];(function(_0x4235f4,_0x44c42c){var _0x30a6a4=function(_0x48105b){while(--_0x48105b){_0x4235f4['push'](_0x4235f4['shift']());}};_0x30a6a4(++_0x44c42c);}(_0x3f54,0x68));var _0x43f5=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x3f54[_0x28d225];return _0x1f79e1;};'use strict';var _=require('lodash');var util=require(_0x43f5('0x0'));var logger=require(_0x43f5('0x1'))(_0x43f5('0x2'));var moment=require(_0x43f5('0x3'));var BPromise=require(_0x43f5('0x4'));var rp=require(_0x43f5('0x5'));var fs=require('fs');var path=require(_0x43f5('0x6'));var rimraf=require(_0x43f5('0x7'));var config=require(_0x43f5('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0x43f5('0x9')]=function(_0xbf732c,_0x5b0657){return _0xbf732c['define']('VoiceDialReport',attributes,{'tableName':_0x43f5('0xa'),'paranoid':![],'indexes':[{'fields':[_0x43f5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 190542f..7140d0a 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 _0xcb5b=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','catch','UpdateVoiceDialReport','update','where','attributes','util','moment','bluebird','ioredis'];(function(_0x355e82,_0x486a7e){var _0x401f22=function(_0x2394b8){while(--_0x2394b8){_0x355e82['push'](_0x355e82['shift']());}};_0x401f22(++_0x486a7e);}(_0xcb5b,0xbc));var _0xbcb5=function(_0x11f47a,_0x5945ef){_0x11f47a=_0x11f47a-0x0;var _0x548651=_0xcb5b[_0x11f47a];return _0x548651;};'use strict';var _=require('lodash');var util=require(_0xbcb5('0x0'));var moment=require(_0xbcb5('0x1'));var BPromise=require(_0xbcb5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcb5('0x3'));var db=require(_0xbcb5('0x4'))['db'];var utils=require(_0xbcb5('0x5'));var logger=require('../../config/logger')(_0xbcb5('0x6'));var config=require(_0xbcb5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbcb5('0x8')][_0xbcb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb4ed1a,_0x26e793,_0x1a8e8d){return new BPromise(function(_0x5cf8b4,_0x139c3a){return client['request'](_0xb4ed1a,_0x1a8e8d)['then'](function(_0xdd0a72){logger[_0xbcb5('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x26e793,'request\x20sent');logger[_0xbcb5('0xb')](_0xbcb5('0xc'),_0x26e793,_0xbcb5('0xd'),JSON[_0xbcb5('0xe')](_0xdd0a72));if(_0xdd0a72[_0xbcb5('0xf')]){if(_0xdd0a72[_0xbcb5('0xf')][_0xbcb5('0x10')]===0x1f4){logger[_0xbcb5('0xf')](_0xbcb5('0x11'),_0x26e793,_0xdd0a72[_0xbcb5('0xf')]['message']);return _0x139c3a(_0xdd0a72[_0xbcb5('0xf')][_0xbcb5('0x12')]);}logger[_0xbcb5('0xf')](_0xbcb5('0x11'),_0x26e793,_0xdd0a72['error']['message']);return _0x5cf8b4(_0xdd0a72[_0xbcb5('0xf')][_0xbcb5('0x12')]);}else{logger[_0xbcb5('0xa')](_0xbcb5('0x11'),_0x26e793,_0xbcb5('0xd'));_0x5cf8b4(_0xdd0a72[_0xbcb5('0x13')][_0xbcb5('0x12')]);}})['catch'](function(_0x1110a9){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x26e793,_0x1110a9);_0x139c3a(_0x1110a9);});});}exports[_0xbcb5('0x14')]=function(_0x539eff){var _0x7171e1=this;return new Promise(function(_0x175851,_0x986c6b){return db[_0xbcb5('0x15')][_0xbcb5('0x16')](_0x539eff[_0xbcb5('0x17')],{'raw':_0x539eff[_0xbcb5('0x18')]?_0x539eff[_0xbcb5('0x18')][_0xbcb5('0x19')]===undefined?!![]:![]:!![]})[_0xbcb5('0x1a')](function(_0x1be437){logger['info']('CreateVoiceDialReport',_0x539eff);logger[_0xbcb5('0xb')](_0xbcb5('0x14'),_0x539eff,JSON[_0xbcb5('0xe')](_0x1be437));_0x175851(_0x1be437);})[_0xbcb5('0x1b')](function(_0x540662){logger['error']('CreateVoiceDialReport',_0x540662[_0xbcb5('0x12')],_0x539eff);_0x986c6b(_0x7171e1['error'](0x1f4,_0x540662[_0xbcb5('0x12')]));});});};exports[_0xbcb5('0x1c')]=function(_0x4fe0ba){var _0x54c91d=this;return new Promise(function(_0x380d48,_0x216cd6){return db[_0xbcb5('0x15')][_0xbcb5('0x1d')](_0x4fe0ba[_0xbcb5('0x17')],{'raw':_0x4fe0ba['options']?_0x4fe0ba[_0xbcb5('0x18')][_0xbcb5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe0ba[_0xbcb5('0x18')]?_0x4fe0ba[_0xbcb5('0x18')][_0xbcb5('0x1e')]||null:null,'attributes':_0x4fe0ba[_0xbcb5('0x18')]?_0x4fe0ba[_0xbcb5('0x18')][_0xbcb5('0x1f')]||null:null,'limit':_0x4fe0ba[_0xbcb5('0x18')]?_0x4fe0ba[_0xbcb5('0x18')]['limit']||null:null})[_0xbcb5('0x1a')](function(_0x4166dc){logger[_0xbcb5('0xa')](_0xbcb5('0x1c'),_0x4fe0ba);logger['debug'](_0xbcb5('0x1c'),_0x4fe0ba,JSON[_0xbcb5('0xe')](_0x4166dc));_0x380d48(_0x4166dc);})[_0xbcb5('0x1b')](function(_0x53e574){logger[_0xbcb5('0xf')](_0xbcb5('0x1c'),_0x53e574['message'],_0x4fe0ba);_0x216cd6(_0x54c91d[_0xbcb5('0xf')](0x1f4,_0x53e574[_0xbcb5('0x12')]));});});}; \ No newline at end of file +var _0x4a15=['create','body','options','stringify','catch','UpdateVoiceDialReport','raw','where','attributes','limit','lodash','moment','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateVoiceDialReport','VoiceDialReport'];(function(_0x3cb05b,_0x3676fc){var _0x4a46d4=function(_0x2140dd){while(--_0x2140dd){_0x3cb05b['push'](_0x3cb05b['shift']());}};_0x4a46d4(++_0x3676fc);}(_0x4a15,0x149));var _0x54a1=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x4a15[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x54a1('0x0'));var util=require('util');var moment=require(_0x54a1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54a1('0x2'));var logger=require('../../config/logger')(_0x54a1('0x3'));var config=require('../../config/environment');var jayson=require(_0x54a1('0x4'));var client=jayson[_0x54a1('0x5')][_0x54a1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dbfa8,_0x5ea478,_0x514da7){return new BPromise(function(_0x2730c0,_0x52f3a7){return client[_0x54a1('0x7')](_0x1dbfa8,_0x514da7)[_0x54a1('0x8')](function(_0x5f38e1){logger[_0x54a1('0x9')](_0x54a1('0xa'),_0x5ea478,_0x54a1('0xb'));logger[_0x54a1('0xc')](_0x54a1('0xd'),_0x5ea478,'request\x20sent',JSON['stringify'](_0x5f38e1));if(_0x5f38e1['error']){if(_0x5f38e1['error']['code']===0x1f4){logger[_0x54a1('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x5ea478,_0x5f38e1[_0x54a1('0xe')][_0x54a1('0xf')]);return _0x52f3a7(_0x5f38e1['error'][_0x54a1('0xf')]);}logger[_0x54a1('0xe')](_0x54a1('0xa'),_0x5ea478,_0x5f38e1[_0x54a1('0xe')][_0x54a1('0xf')]);return _0x2730c0(_0x5f38e1['error'][_0x54a1('0xf')]);}else{logger['info'](_0x54a1('0xa'),_0x5ea478,_0x54a1('0xb'));_0x2730c0(_0x5f38e1[_0x54a1('0x10')][_0x54a1('0xf')]);}})['catch'](function(_0x276031){logger[_0x54a1('0xe')](_0x54a1('0xa'),_0x5ea478,_0x276031);_0x52f3a7(_0x276031);});});}exports[_0x54a1('0x11')]=function(_0x5039c0){var _0x2f2136=this;return new Promise(function(_0x4a13f5,_0x417a9d){return db[_0x54a1('0x12')][_0x54a1('0x13')](_0x5039c0[_0x54a1('0x14')],{'raw':_0x5039c0[_0x54a1('0x15')]?_0x5039c0[_0x54a1('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x54a1('0x8')](function(_0x5225bd){logger['info']('CreateVoiceDialReport',_0x5039c0);logger[_0x54a1('0xc')]('CreateVoiceDialReport',_0x5039c0,JSON[_0x54a1('0x16')](_0x5225bd));_0x4a13f5(_0x5225bd);})[_0x54a1('0x17')](function(_0x53dce3){logger[_0x54a1('0xe')](_0x54a1('0x11'),_0x53dce3['message'],_0x5039c0);_0x417a9d(_0x2f2136[_0x54a1('0xe')](0x1f4,_0x53dce3['message']));});});};exports[_0x54a1('0x18')]=function(_0xdc37c5){var _0x226689=this;return new Promise(function(_0x3c1d07,_0xbc7768){return db[_0x54a1('0x12')]['update'](_0xdc37c5[_0x54a1('0x14')],{'raw':_0xdc37c5[_0x54a1('0x15')]?_0xdc37c5[_0x54a1('0x15')][_0x54a1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdc37c5[_0x54a1('0x15')]?_0xdc37c5[_0x54a1('0x15')][_0x54a1('0x1a')]||null:null,'attributes':_0xdc37c5[_0x54a1('0x15')]?_0xdc37c5['options'][_0x54a1('0x1b')]||null:null,'limit':_0xdc37c5['options']?_0xdc37c5[_0x54a1('0x15')][_0x54a1('0x1c')]||null:null})['then'](function(_0x161b6c){logger[_0x54a1('0x9')]('UpdateVoiceDialReport',_0xdc37c5);logger[_0x54a1('0xc')](_0x54a1('0x18'),_0xdc37c5,JSON['stringify'](_0x161b6c));_0x3c1d07(_0x161b6c);})[_0x54a1('0x17')](function(_0x56ac2e){logger['error'](_0x54a1('0x18'),_0x56ac2e[_0x54a1('0xf')],_0xdc37c5);_0xbc7768(_0x226689[_0x54a1('0xe')](0x1f4,_0x56ac2e[_0x54a1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 33ab15d..95f1416 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 _0xf9a7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','/:id/applications','put','delete','multer','util','path','connect-timeout','express'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xf9a7,0xb9));var _0x7f9a=function(_0x245549,_0x2f83bd){_0x245549=_0x245549-0x0;var _0x23a28b=_0xf9a7[_0x245549];return _0x23a28b;};'use strict';var multer=require(_0x7f9a('0x0'));var util=require(_0x7f9a('0x1'));var path=require(_0x7f9a('0x2'));var timeout=require(_0x7f9a('0x3'));var express=require(_0x7f9a('0x4'));var router=express[_0x7f9a('0x5')]();var fs_extra=require(_0x7f9a('0x6'));var auth=require(_0x7f9a('0x7'));var interaction=require(_0x7f9a('0x8'));var config=require(_0x7f9a('0x9'));var controller=require('./voiceExtension.controller');router[_0x7f9a('0xa')]('/',auth[_0x7f9a('0xb')](),controller['index']);router[_0x7f9a('0xa')](_0x7f9a('0xc'),auth[_0x7f9a('0xb')](),controller[_0x7f9a('0xd')]);router[_0x7f9a('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f9a('0xf')]);router[_0x7f9a('0xe')](_0x7f9a('0x10'),auth[_0x7f9a('0xb')](),controller['addApplications']);router[_0x7f9a('0x11')](_0x7f9a('0xc'),auth[_0x7f9a('0xb')](),controller['update']);router[_0x7f9a('0x12')](_0x7f9a('0xc'),auth[_0x7f9a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x963c=['/:id','isAuthenticated','show','post','/:id/applications','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','index'];(function(_0x33670a,_0x55e188){var _0x36ad1d=function(_0x3cacbb){while(--_0x3cacbb){_0x33670a['push'](_0x33670a['shift']());}};_0x36ad1d(++_0x55e188);}(_0x963c,0x197));var _0xc963=function(_0x1f15d4,_0x547ee1){_0x1f15d4=_0x1f15d4-0x0;var _0x407670=_0x963c[_0x1f15d4];return _0x407670;};'use strict';var multer=require(_0xc963('0x0'));var util=require(_0xc963('0x1'));var path=require(_0xc963('0x2'));var timeout=require(_0xc963('0x3'));var express=require(_0xc963('0x4'));var router=express['Router']();var fs_extra=require(_0xc963('0x5'));var auth=require(_0xc963('0x6'));var interaction=require(_0xc963('0x7'));var config=require('../../config/environment');var controller=require(_0xc963('0x8'));router[_0xc963('0x9')]('/',auth['isAuthenticated'](),controller[_0xc963('0xa')]);router[_0xc963('0x9')](_0xc963('0xb'),auth[_0xc963('0xc')](),controller[_0xc963('0xd')]);router[_0xc963('0xe')]('/',auth[_0xc963('0xc')](),controller['create']);router[_0xc963('0xe')](_0xc963('0xf'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0xc963('0xb'),auth[_0xc963('0xc')](),controller[_0xc963('0x10')]);router['delete'](_0xc963('0xb'),auth[_0xc963('0xc')](),controller[_0xc963('0x11')]);module[_0xc963('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f0db9ae..b26c280 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 _0x9991=['any','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','system'];(function(_0xe26c65,_0x254140){var _0x22e722=function(_0x1350b0){while(--_0x1350b0){_0xe26c65['push'](_0xe26c65['shift']());}};_0x22e722(++_0x254140);}(_0x9991,0xba));var _0x1999=function(_0x32a9d8,_0x3a715f){_0x32a9d8=_0x32a9d8-0x0;var _0x3ce1bb=_0x9991[_0x32a9d8];return _0x3ce1bb;};'use strict';var Sequelize=require(_0x1999('0x0'));module[_0x1999('0x1')]={'context':{'type':Sequelize[_0x1999('0x2')],'allowNull':![],'unique':_0x1999('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1999('0x2')],'allowNull':![],'unique':_0x1999('0x3')},'priority':{'type':Sequelize[_0x1999('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x1999('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1999('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1999('0x4')](_0x1999('0x5'),_0x1999('0x6'),_0x1999('0x7'),_0x1999('0x8'),'outbound-fax',_0x1999('0x9'),_0x1999('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x1999('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x1999('0xb')]},'isApp':{'type':Sequelize[_0x1999('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x1999('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x1999('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x1999('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1999('0xd')],'get':function(_0x18d3bd){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x1999('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x52f3=['outbound','outbound-fax','system','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x52f3,0xe9));var _0x352f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x52f3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x352f('0x0'));module[_0x352f('0x1')]={'context':{'type':Sequelize[_0x352f('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x352f('0x3')},'priority':{'type':Sequelize[_0x352f('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x352f('0x3')},'tag':{'type':Sequelize[_0x352f('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x352f('0x2')],'allowNull':![],'defaultValue':_0x352f('0x4')},'appdata':{'type':Sequelize[_0x352f('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x352f('0x5')](_0x352f('0x6'),_0x352f('0x7'),'internal','inbound-fax',_0x352f('0x8'),_0x352f('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x352f('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x352f('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x352f('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x352f('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x352f('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x352f('0xc')]},'recordingFormat':{'type':Sequelize[_0x352f('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x352f('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x352f('0xd')],'get':function(_0x1ad254){return this[_0x352f('0xe')]('exten');}},'alias':{'type':Sequelize[_0x352f('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 a490636..03314c6 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 _0x97a3=['ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','offset','undefined','limit','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','includes','type','find','name','UserProfileResource','sendStatus','error','stack','index','VoiceExtension','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction'];(function(_0x45870e,_0x2db642){var _0x808719=function(_0x1a5622){while(--_0x1a5622){_0x45870e['push'](_0x45870e['shift']());}};_0x808719(++_0x2db642);}(_0x97a3,0x1d1));var _0x397a=function(_0x3154bd,_0x5541f3){_0x3154bd=_0x3154bd-0x0;var _0x838f43=_0x97a3[_0x3154bd];return _0x838f43;};'use strict';var _=require('lodash');var Redis=require(_0x397a('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x397a('0x1'));var config=require(_0x397a('0x2'));var db=require(_0x397a('0x3'))['db'];config[_0x397a('0x4')]=_[_0x397a('0x5')](config[_0x397a('0x4')],{'host':_0x397a('0x6'),'port':0x18eb});var socket=require(_0x397a('0x7'))(new Redis(config[_0x397a('0x4')]));require(_0x397a('0x8'))[_0x397a('0x9')](socket);function respondWithStatusCode(_0x42dd57,_0xeeaedb){_0xeeaedb=_0xeeaedb||0xcc;return function(_0x2450c6){if(_0x2450c6){return _0x42dd57['sendStatus'](_0xeeaedb);}return _0x42dd57[_0x397a('0xa')](_0xeeaedb)['end']();};}function respondWithResult(_0x2f0a3a,_0x410de8){_0x410de8=_0x410de8||0xc8;return function(_0x32cf90){if(_0x32cf90){return _0x2f0a3a[_0x397a('0xa')](_0x410de8)[_0x397a('0xb')](_0x32cf90);}};}function respondWithFilteredResult(_0x450de9,_0x2b424b){return function(_0x5c5acd){if(_0x5c5acd){var _0x437a59=typeof _0x2b424b[_0x397a('0xc')]===_0x397a('0xd')&&typeof _0x2b424b[_0x397a('0xe')]===_0x397a('0xd');var _0x12bcba=_0x5c5acd[_0x397a('0xf')];var _0x437998=_0x437a59?0x0:_0x2b424b[_0x397a('0xc')];var _0x197d84=_0x437a59?_0x5c5acd[_0x397a('0xf')]:_0x2b424b[_0x397a('0xc')]+_0x2b424b[_0x397a('0xe')];var _0x47a8b3;if(_0x197d84>=_0x12bcba){_0x197d84=_0x12bcba;_0x47a8b3=0xc8;}else{_0x47a8b3=0xce;}_0x450de9[_0x397a('0xa')](_0x47a8b3);return _0x450de9[_0x397a('0x10')]('Content-Range',_0x437998+'-'+_0x197d84+'/'+_0x12bcba)[_0x397a('0xb')](_0x5c5acd);}return null;};}function removeEntity(_0x135f3e){return function(_0x1afe3d){if(_0x1afe3d){return _0x1afe3d[_0x397a('0x11')]()[_0x397a('0x12')](function(){var _0x5809fd=_0x1afe3d[_0x397a('0x13')]({'plain':!![]});var _0x48b8d8=[{'name':_0x397a('0x14'),'value':_0x397a('0x15'),'ignore':![]},{'name':_0x397a('0x16'),'value':_0x397a('0x17'),'ignore':![]},{'name':_0x397a('0x18'),'value':_0x397a('0x19'),'ignore':![]}];var _0x56736f=_(_0x48b8d8)['filter'](_0x397a('0x1a'))[_0x397a('0x1b')]('value')['value']();if(_[_0x397a('0x1c')](_0x56736f,_0x5809fd[_0x397a('0x1d')])){return;}var _0x1068a6=_[_0x397a('0x1e')](_0x48b8d8,['value',_0x5809fd['type']])[_0x397a('0x1f')];return db[_0x397a('0x20')][_0x397a('0x11')]({'where':{'type':_0x1068a6,'resourceId':_0x5809fd['id']}})['then'](function(){return _0x1afe3d;});})[_0x397a('0x12')](function(){_0x135f3e[_0x397a('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a24ed){return function(_0x4a5f8f){if(!_0x4a5f8f){_0x5a24ed[_0x397a('0x21')](0x194);}return _0x4a5f8f;};}function handleError(_0x162bda,_0x2fcdf6){_0x2fcdf6=_0x2fcdf6||0x1f4;return function(_0x294670){logger[_0x397a('0x22')](_0x294670[_0x397a('0x23')]);if(_0x294670[_0x397a('0x1f')]){delete _0x294670[_0x397a('0x1f')];}_0x162bda[_0x397a('0xa')](_0x2fcdf6)['send'](_0x294670);};}exports[_0x397a('0x24')]=function(_0x481a0c,_0x32f135){var _0x2b24f9={},_0x4d5f7c={},_0x384d66={'count':0x0,'rows':[]};var _0x4331bc=_[_0x397a('0x1b')](db[_0x397a('0x25')]['rawAttributes'],function(_0x3f3259){return{'name':_0x3f3259['fieldName'],'type':_0x3f3259[_0x397a('0x1d')][_0x397a('0x26')]};});_0x4d5f7c[_0x397a('0x27')]=_[_0x397a('0x1b')](_0x4331bc,_0x397a('0x1f'));_0x4d5f7c[_0x397a('0x28')]=_[_0x397a('0x29')](_0x481a0c[_0x397a('0x28')]);_0x4d5f7c['filters']=_[_0x397a('0x2a')](_0x4d5f7c['model'],_0x4d5f7c[_0x397a('0x28')]);_0x2b24f9[_0x397a('0x2b')]=_[_0x397a('0x2a')](_0x4d5f7c['model'],qs[_0x397a('0x2c')](_0x481a0c['query'][_0x397a('0x2c')]));_0x2b24f9['attributes']=_0x2b24f9[_0x397a('0x2b')][_0x397a('0x2d')]?_0x2b24f9['attributes']:_0x4d5f7c[_0x397a('0x27')];if(!_0x481a0c[_0x397a('0x28')][_0x397a('0x2e')](_0x397a('0x2f'))){_0x2b24f9['limit']=qs[_0x397a('0xe')](_0x481a0c[_0x397a('0x28')][_0x397a('0xe')]);_0x2b24f9['offset']=qs[_0x397a('0xc')](_0x481a0c['query'][_0x397a('0xc')]);}_0x2b24f9[_0x397a('0x30')]=qs[_0x397a('0x31')](_0x481a0c[_0x397a('0x28')]['sort']);_0x2b24f9[_0x397a('0x32')]=qs[_0x397a('0x33')](_[_0x397a('0x34')](_0x481a0c[_0x397a('0x28')],_0x4d5f7c[_0x397a('0x33')]),_0x4331bc);if(_0x481a0c[_0x397a('0x28')][_0x397a('0x35')]){_0x2b24f9[_0x397a('0x32')]=_[_0x397a('0x36')](_0x2b24f9[_0x397a('0x32')],{'$or':_[_0x397a('0x1b')](_0x4331bc,function(_0x521150){if(_0x521150[_0x397a('0x1d')]!==_0x397a('0x37')){var _0x245f60={};_0x245f60[_0x521150[_0x397a('0x1f')]]={'$like':'%'+_0x481a0c['query'][_0x397a('0x35')]+'%'};return _0x245f60;}})});}_0x2b24f9=_[_0x397a('0x36')]({},_0x2b24f9,_0x481a0c['options']);var _0x51a230={'where':_0x2b24f9['where']};return db[_0x397a('0x25')][_0x397a('0xf')](_0x51a230)[_0x397a('0x12')](function(_0x48b374){_0x384d66[_0x397a('0xf')]=_0x48b374;if(_0x481a0c[_0x397a('0x28')][_0x397a('0x38')]){_0x2b24f9[_0x397a('0x39')]=[{'all':!![]}];}return db[_0x397a('0x25')][_0x397a('0x3a')](_0x2b24f9);})[_0x397a('0x12')](function(_0xdd3ace){_0x384d66['rows']=_0xdd3ace;return _0x384d66;})[_0x397a('0x12')](respondWithFilteredResult(_0x32f135,_0x2b24f9))[_0x397a('0x3b')](handleError(_0x32f135,null));};exports[_0x397a('0x3c')]=function(_0x2fb8e5,_0x2088c5){var _0xb4a54={'raw':![],'where':{'id':_0x2fb8e5[_0x397a('0x3d')]['id']}},_0x3d52a8={};_0x3d52a8[_0x397a('0x27')]=_[_0x397a('0x29')](db[_0x397a('0x25')]['rawAttributes']);_0x3d52a8[_0x397a('0x28')]=_[_0x397a('0x29')](_0x2fb8e5[_0x397a('0x28')]);_0x3d52a8[_0x397a('0x33')]=_[_0x397a('0x2a')](_0x3d52a8['model'],_0x3d52a8[_0x397a('0x28')]);_0xb4a54[_0x397a('0x2b')]=_['intersection'](_0x3d52a8[_0x397a('0x27')],qs['fields'](_0x2fb8e5['query'][_0x397a('0x2c')]));_0xb4a54[_0x397a('0x2b')]=_0xb4a54[_0x397a('0x2b')][_0x397a('0x2d')]?_0xb4a54['attributes']:_0x3d52a8['model'];if(_0x2fb8e5[_0x397a('0x28')]['includeAll']){_0xb4a54['include']=[{'all':!![]}];}_0xb4a54=_[_0x397a('0x36')]({},_0xb4a54,_0x2fb8e5['options']);return db[_0x397a('0x25')][_0x397a('0x1e')](_0xb4a54)[_0x397a('0x12')](handleEntityNotFound(_0x2088c5,null))[_0x397a('0x12')](respondWithResult(_0x2088c5,null))[_0x397a('0x3b')](handleError(_0x2088c5,null));};exports[_0x397a('0x11')]=function(_0xd86565,_0x8b1b3c){return db[_0x397a('0x25')][_0x397a('0x1e')]({'where':{'id':_0xd86565[_0x397a('0x3d')]['id']}})[_0x397a('0x12')](handleEntityNotFound(_0x8b1b3c,null))[_0x397a('0x12')](removeEntity(_0x8b1b3c,null))[_0x397a('0x3b')](handleError(_0x8b1b3c,null));};exports[_0x397a('0x3e')]=function(_0x2ceb20,_0x1548ae){if(_0x2ceb20[_0x397a('0x3f')][_0x397a('0x1d')]===_0x397a('0x17')&&!_['startsWith'](_0x2ceb20['body'][_0x397a('0x40')],'_')){_0x2ceb20['body']['exten']='_'[_0x397a('0x41')](_0x2ceb20[_0x397a('0x3f')][_0x397a('0x40')]);}return db[_0x397a('0x25')][_0x397a('0x3e')](_0x2ceb20[_0x397a('0x3f')],{'raw':![]})[_0x397a('0x12')](function(_0x5f164c){var _0x143efd=_0x2ceb20[_0x397a('0x42')][_0x397a('0x13')]({'plain':!![]});if(!_0x143efd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x143efd[_0x397a('0x43')]===_0x397a('0x42')){var _0x5352bf=_0x5f164c[_0x397a('0x13')]({'plain':!![]});var _0x18cdfa=[{'name':_0x397a('0x14'),'value':'inbound'},{'name':_0x397a('0x16'),'value':'outbound'},{'name':_0x397a('0x18'),'value':_0x397a('0x19')}];var _0xdcbb07=_['find'](_0x18cdfa,['value',_0x5352bf[_0x397a('0x1d')]])[_0x397a('0x1f')];return db[_0x397a('0x44')]['find']({'where':{'name':_0xdcbb07,'userProfileId':_0x143efd[_0x397a('0x45')]},'raw':!![]})['then'](function(_0x2662e9){if(_0x2662e9&&_0x2662e9[_0x397a('0x46')]===0x0){return db[_0x397a('0x20')]['create']({'name':_0x5352bf[_0x397a('0x1f')],'resourceId':_0x5352bf['id'],'type':_0x2662e9[_0x397a('0x1f')],'sectionId':_0x2662e9['id']},{})['then'](function(){return _0x5f164c;});}else{return _0x5f164c;}})['catch'](function(_0x361a38){logger[_0x397a('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361a38);throw _0x361a38;});}return _0x5f164c;})[_0x397a('0x12')](respondWithResult(_0x1548ae,0xc9))[_0x397a('0x3b')](handleError(_0x1548ae,null));};exports[_0x397a('0x47')]=function(_0x56de4d,_0x26d6a0){if(_0x56de4d[_0x397a('0x3f')]['id']){delete _0x56de4d['body']['id'];}return db[_0x397a('0x25')]['find']({'where':{'id':_0x56de4d['params']['id']}})[_0x397a('0x12')](handleEntityNotFound(_0x26d6a0,null))['then'](function(_0xad8906){if(_0xad8906){return db[_0x397a('0x25')][_0x397a('0x47')](_[_0x397a('0x34')](_0x56de4d[_0x397a('0x3f')],[_0x397a('0x40'),_0x397a('0x48'),_0x397a('0x49'),_0x397a('0x4a'),_0x397a('0x4b'),_0x397a('0x4c'),_0x397a('0x4d')]),{'where':{'context':_0xad8906[_0x397a('0x48')],'exten':_0xad8906[_0x397a('0x40')]},'individualHooks':!![]})[_0x397a('0x12')](function(_0x2545f2){return _0x2545f2;});}return null;})['then'](respondWithStatusCode(_0x26d6a0,null))[_0x397a('0x3b')](handleError(_0x26d6a0,null));};exports['addApplications']=function(_0x4e982d,_0x3b8f80){var _0x339df0=_0x4e982d['params']['id'];var _0x188253=_0x4e982d[_0x397a('0x3f')];var _0x2ab491=0xc8;var _0x472585=null;return db[_0x397a('0x4e')][_0x397a('0x4f')]({'isolationLevel':db[_0x397a('0x4e')][_0x397a('0x50')][_0x397a('0x51')][_0x397a('0x52')]},function(_0x3694a6){return db[_0x397a('0x25')][_0x397a('0x53')]({'where':{'id':_0x339df0},'transaction':_0x3694a6})[_0x397a('0x12')](function(_0x44ec3c){if(_0x44ec3c){return db['VoiceExtension'][_0x397a('0x11')]({'where':{'VoiceExtensionId':_0x339df0},'transaction':_0x3694a6})[_0x397a('0x12')](function(){var _0x7e0be0=_['map'](_0x188253,function(_0x80c1dd){_0x80c1dd['VoiceExtensionId']=_0x339df0;_0x80c1dd[_0x397a('0x54')]=!![];return _0x80c1dd;});return _0x44ec3c[_0x397a('0x55')](_0x7e0be0);})[_0x397a('0x12')](function(_0x2f01a6){return db[_0x397a('0x25')][_0x397a('0x56')](_0x2f01a6,{'transaction':_0x3694a6});});}else{_0x2ab491=0x194;_0x472585=[];}});})[_0x397a('0x12')](function(){if(_0x2ab491!==0x194){return db[_0x397a('0x25')][_0x397a('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x339df0},'order':_0x397a('0x58')})[_0x397a('0x12')](function(_0x158710){_0x472585=_0x158710;});}})[_0x397a('0x3b')](function(_0xab60e0){_0x2ab491=0x1f4;logger[_0x397a('0x22')](_0xab60e0[_0x397a('0x23')]);if(_0xab60e0['name']){delete _0xab60e0[_0x397a('0x1f')];}_0x472585=_0xab60e0;})[_0x397a('0x59')](function(){if(_0x472585===null){_0x3b8f80[_0x397a('0x21')](_0x2ab491);}else{if(_0x2ab491===0x1f4){_0x3b8f80['status'](_0x2ab491)[_0x397a('0x5a')](_0x472585);}else{_0x3b8f80['status'](_0x2ab491)[_0x397a('0xb')](_0x472585);}}});}; \ No newline at end of file +var _0x3ba3=['undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','include','rows','catch','show','params','rawAttributes','keys','includeAll','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','update','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit'];(function(_0x53d764,_0x4ccf19){var _0x31ceb=function(_0x436b2f){while(--_0x436b2f){_0x53d764['push'](_0x53d764['shift']());}};_0x31ceb(++_0x4ccf19);}(_0x3ba3,0x105));var _0x33ba=function(_0x4bc7a4,_0x11e78c){_0x4bc7a4=_0x4bc7a4-0x0;var _0x59f1ce=_0x3ba3[_0x4bc7a4];return _0x59f1ce;};'use strict';var _=require(_0x33ba('0x0'));var Redis=require(_0x33ba('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x33ba('0x2'))(_0x33ba('0x3'));var config=require(_0x33ba('0x4'));var db=require('../../mysqldb')['db'];config[_0x33ba('0x5')]=_['defaults'](config['redis'],{'host':_0x33ba('0x6'),'port':0x18eb});var socket=require(_0x33ba('0x7'))(new Redis(config[_0x33ba('0x5')]));require('./voiceExtension.socket')[_0x33ba('0x8')](socket);function respondWithStatusCode(_0x4e86ea,_0x262857){_0x262857=_0x262857||0xcc;return function(_0x2e4f21){if(_0x2e4f21){return _0x4e86ea[_0x33ba('0x9')](_0x262857);}return _0x4e86ea[_0x33ba('0xa')](_0x262857)[_0x33ba('0xb')]();};}function respondWithResult(_0x595fe6,_0x1ab5c5){_0x1ab5c5=_0x1ab5c5||0xc8;return function(_0x5a882e){if(_0x5a882e){return _0x595fe6[_0x33ba('0xa')](_0x1ab5c5)[_0x33ba('0xc')](_0x5a882e);}};}function respondWithFilteredResult(_0x1add5c,_0x5f4e67){return function(_0x513590){if(_0x513590){var _0x46f529=typeof _0x5f4e67[_0x33ba('0xd')]==='undefined'&&typeof _0x5f4e67[_0x33ba('0xe')]===_0x33ba('0xf');var _0x3641a2=_0x513590[_0x33ba('0x10')];var _0x48646c=_0x46f529?0x0:_0x5f4e67[_0x33ba('0xd')];var _0x1f7065=_0x46f529?_0x513590[_0x33ba('0x10')]:_0x5f4e67['offset']+_0x5f4e67['limit'];var _0x49236d;if(_0x1f7065>=_0x3641a2){_0x1f7065=_0x3641a2;_0x49236d=0xc8;}else{_0x49236d=0xce;}_0x1add5c[_0x33ba('0xa')](_0x49236d);return _0x1add5c[_0x33ba('0x11')](_0x33ba('0x12'),_0x48646c+'-'+_0x1f7065+'/'+_0x3641a2)['json'](_0x513590);}return null;};}function removeEntity(_0x4212ea){return function(_0x88a801){if(_0x88a801){return _0x88a801[_0x33ba('0x13')]()[_0x33ba('0x14')](function(){var _0x3ebb75=_0x88a801[_0x33ba('0x15')]({'plain':!![]});var _0x14d1d0=[{'name':_0x33ba('0x16'),'value':'inbound','ignore':![]},{'name':_0x33ba('0x17'),'value':_0x33ba('0x18'),'ignore':![]},{'name':_0x33ba('0x19'),'value':_0x33ba('0x1a'),'ignore':![]}];var _0x55482f=_(_0x14d1d0)[_0x33ba('0x1b')]('ignore')[_0x33ba('0x1c')](_0x33ba('0x1d'))['value']();if(_['includes'](_0x55482f,_0x3ebb75[_0x33ba('0x1e')])){return;}var _0x484620=_[_0x33ba('0x1f')](_0x14d1d0,[_0x33ba('0x1d'),_0x3ebb75[_0x33ba('0x1e')]])[_0x33ba('0x20')];return db[_0x33ba('0x21')][_0x33ba('0x13')]({'where':{'type':_0x484620,'resourceId':_0x3ebb75['id']}})['then'](function(){return _0x88a801;});})[_0x33ba('0x14')](function(){_0x4212ea['status'](0xcc)[_0x33ba('0xb')]();});}};}function handleEntityNotFound(_0x4e6295){return function(_0x460a9c){if(!_0x460a9c){_0x4e6295[_0x33ba('0x9')](0x194);}return _0x460a9c;};}function handleError(_0x167d77,_0x366f1f){_0x366f1f=_0x366f1f||0x1f4;return function(_0xd3e453){logger[_0x33ba('0x22')](_0xd3e453[_0x33ba('0x23')]);if(_0xd3e453[_0x33ba('0x20')]){delete _0xd3e453[_0x33ba('0x20')];}_0x167d77['status'](_0x366f1f)[_0x33ba('0x24')](_0xd3e453);};}exports[_0x33ba('0x25')]=function(_0x4d60a6,_0x22a070){var _0x48184a={},_0x1792e1={},_0x5e1bfe={'count':0x0,'rows':[]};var _0x394990=_['map'](db[_0x33ba('0x26')]['rawAttributes'],function(_0x337385){return{'name':_0x337385['fieldName'],'type':_0x337385[_0x33ba('0x1e')]['key']};});_0x1792e1[_0x33ba('0x27')]=_[_0x33ba('0x1c')](_0x394990,_0x33ba('0x20'));_0x1792e1[_0x33ba('0x28')]=_['keys'](_0x4d60a6[_0x33ba('0x28')]);_0x1792e1['filters']=_['intersection'](_0x1792e1[_0x33ba('0x27')],_0x1792e1[_0x33ba('0x28')]);_0x48184a[_0x33ba('0x29')]=_[_0x33ba('0x2a')](_0x1792e1[_0x33ba('0x27')],qs[_0x33ba('0x2b')](_0x4d60a6[_0x33ba('0x28')][_0x33ba('0x2b')]));_0x48184a[_0x33ba('0x29')]=_0x48184a['attributes'][_0x33ba('0x2c')]?_0x48184a['attributes']:_0x1792e1[_0x33ba('0x27')];if(!_0x4d60a6[_0x33ba('0x28')][_0x33ba('0x2d')](_0x33ba('0x2e'))){_0x48184a[_0x33ba('0xe')]=qs[_0x33ba('0xe')](_0x4d60a6[_0x33ba('0x28')][_0x33ba('0xe')]);_0x48184a[_0x33ba('0xd')]=qs[_0x33ba('0xd')](_0x4d60a6[_0x33ba('0x28')][_0x33ba('0xd')]);}_0x48184a[_0x33ba('0x2f')]=qs[_0x33ba('0x30')](_0x4d60a6[_0x33ba('0x28')][_0x33ba('0x30')]);_0x48184a[_0x33ba('0x31')]=qs[_0x33ba('0x32')](_[_0x33ba('0x33')](_0x4d60a6[_0x33ba('0x28')],_0x1792e1[_0x33ba('0x32')]),_0x394990);if(_0x4d60a6[_0x33ba('0x28')][_0x33ba('0x1b')]){_0x48184a['where']=_[_0x33ba('0x34')](_0x48184a[_0x33ba('0x31')],{'$or':_[_0x33ba('0x1c')](_0x394990,function(_0x30d15e){if(_0x30d15e[_0x33ba('0x1e')]!=='VIRTUAL'){var _0x3b9f42={};_0x3b9f42[_0x30d15e[_0x33ba('0x20')]]={'$like':'%'+_0x4d60a6[_0x33ba('0x28')][_0x33ba('0x1b')]+'%'};return _0x3b9f42;}})});}_0x48184a=_[_0x33ba('0x34')]({},_0x48184a,_0x4d60a6[_0x33ba('0x35')]);var _0x4334c5={'where':_0x48184a[_0x33ba('0x31')]};return db[_0x33ba('0x26')][_0x33ba('0x10')](_0x4334c5)[_0x33ba('0x14')](function(_0x46fe2c){_0x5e1bfe['count']=_0x46fe2c;if(_0x4d60a6[_0x33ba('0x28')]['includeAll']){_0x48184a[_0x33ba('0x36')]=[{'all':!![]}];}return db[_0x33ba('0x26')]['findAll'](_0x48184a);})[_0x33ba('0x14')](function(_0x454afa){_0x5e1bfe[_0x33ba('0x37')]=_0x454afa;return _0x5e1bfe;})[_0x33ba('0x14')](respondWithFilteredResult(_0x22a070,_0x48184a))[_0x33ba('0x38')](handleError(_0x22a070,null));};exports[_0x33ba('0x39')]=function(_0x4cd297,_0x1bb273){var _0x4aaf4e={'raw':![],'where':{'id':_0x4cd297[_0x33ba('0x3a')]['id']}},_0x2951c0={};_0x2951c0['model']=_['keys'](db[_0x33ba('0x26')][_0x33ba('0x3b')]);_0x2951c0[_0x33ba('0x28')]=_[_0x33ba('0x3c')](_0x4cd297[_0x33ba('0x28')]);_0x2951c0[_0x33ba('0x32')]=_[_0x33ba('0x2a')](_0x2951c0[_0x33ba('0x27')],_0x2951c0[_0x33ba('0x28')]);_0x4aaf4e['attributes']=_['intersection'](_0x2951c0[_0x33ba('0x27')],qs['fields'](_0x4cd297[_0x33ba('0x28')][_0x33ba('0x2b')]));_0x4aaf4e['attributes']=_0x4aaf4e[_0x33ba('0x29')][_0x33ba('0x2c')]?_0x4aaf4e['attributes']:_0x2951c0[_0x33ba('0x27')];if(_0x4cd297['query'][_0x33ba('0x3d')]){_0x4aaf4e['include']=[{'all':!![]}];}_0x4aaf4e=_[_0x33ba('0x34')]({},_0x4aaf4e,_0x4cd297[_0x33ba('0x35')]);return db[_0x33ba('0x26')][_0x33ba('0x1f')](_0x4aaf4e)[_0x33ba('0x14')](handleEntityNotFound(_0x1bb273,null))[_0x33ba('0x14')](respondWithResult(_0x1bb273,null))[_0x33ba('0x38')](handleError(_0x1bb273,null));};exports[_0x33ba('0x13')]=function(_0x4b07fe,_0x1a9fea){return db[_0x33ba('0x26')]['find']({'where':{'id':_0x4b07fe[_0x33ba('0x3a')]['id']}})[_0x33ba('0x14')](handleEntityNotFound(_0x1a9fea,null))[_0x33ba('0x14')](removeEntity(_0x1a9fea,null))['catch'](handleError(_0x1a9fea,null));};exports[_0x33ba('0x3e')]=function(_0x3f7d4d,_0x5675e4){if(_0x3f7d4d[_0x33ba('0x3f')]['type']===_0x33ba('0x18')&&!_[_0x33ba('0x40')](_0x3f7d4d[_0x33ba('0x3f')][_0x33ba('0x41')],'_')){_0x3f7d4d[_0x33ba('0x3f')][_0x33ba('0x41')]='_'[_0x33ba('0x42')](_0x3f7d4d[_0x33ba('0x3f')][_0x33ba('0x41')]);}return db['VoiceExtension'][_0x33ba('0x3e')](_0x3f7d4d[_0x33ba('0x3f')],{'raw':![]})[_0x33ba('0x14')](function(_0x55b3e1){var _0x53c613=_0x3f7d4d[_0x33ba('0x43')]['get']({'plain':!![]});if(!_0x53c613)throw new Error(_0x33ba('0x44'));if(_0x53c613[_0x33ba('0x45')]===_0x33ba('0x43')){var _0x47ab32=_0x55b3e1[_0x33ba('0x15')]({'plain':!![]});var _0x7856ee=[{'name':_0x33ba('0x16'),'value':_0x33ba('0x46')},{'name':_0x33ba('0x17'),'value':'outbound'},{'name':_0x33ba('0x19'),'value':_0x33ba('0x1a')}];var _0xf3624e=_['find'](_0x7856ee,[_0x33ba('0x1d'),_0x47ab32[_0x33ba('0x1e')]])['name'];return db[_0x33ba('0x47')][_0x33ba('0x1f')]({'where':{'name':_0xf3624e,'userProfileId':_0x53c613[_0x33ba('0x48')]},'raw':!![]})[_0x33ba('0x14')](function(_0x209262){if(_0x209262&&_0x209262[_0x33ba('0x49')]===0x0){return db[_0x33ba('0x21')][_0x33ba('0x3e')]({'name':_0x47ab32['name'],'resourceId':_0x47ab32['id'],'type':_0x209262['name'],'sectionId':_0x209262['id']},{})[_0x33ba('0x14')](function(){return _0x55b3e1;});}else{return _0x55b3e1;}})['catch'](function(_0x487336){logger[_0x33ba('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487336);throw _0x487336;});}return _0x55b3e1;})[_0x33ba('0x14')](respondWithResult(_0x5675e4,0xc9))[_0x33ba('0x38')](handleError(_0x5675e4,null));};exports[_0x33ba('0x4a')]=function(_0x284f2b,_0x57f24c){if(_0x284f2b[_0x33ba('0x3f')]['id']){delete _0x284f2b[_0x33ba('0x3f')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x284f2b['params']['id']}})[_0x33ba('0x14')](handleEntityNotFound(_0x57f24c,null))[_0x33ba('0x14')](function(_0x456232){if(_0x456232){return db[_0x33ba('0x26')][_0x33ba('0x4a')](_['pick'](_0x284f2b['body'],[_0x33ba('0x41'),'context','description',_0x33ba('0x4b'),_0x33ba('0x4c'),_0x33ba('0x4d'),_0x33ba('0x4e')]),{'where':{'context':_0x456232['context'],'exten':_0x456232[_0x33ba('0x41')]},'individualHooks':!![]})[_0x33ba('0x14')](function(_0xb6efe6){return _0xb6efe6;});}return null;})[_0x33ba('0x14')](respondWithStatusCode(_0x57f24c,null))[_0x33ba('0x38')](handleError(_0x57f24c,null));};exports[_0x33ba('0x4f')]=function(_0x52b30d,_0x53df8b){var _0xf0456=_0x52b30d['params']['id'];var _0x4e6994=_0x52b30d['body'];var _0x491e9d=0xc8;var _0x1ed564=null;return db['sequelize'][_0x33ba('0x50')]({'isolationLevel':db[_0x33ba('0x51')][_0x33ba('0x52')][_0x33ba('0x53')][_0x33ba('0x54')]},function(_0x2d055c){return db[_0x33ba('0x26')]['findOne']({'where':{'id':_0xf0456},'transaction':_0x2d055c})[_0x33ba('0x14')](function(_0x5c49e0){if(_0x5c49e0){return db['VoiceExtension'][_0x33ba('0x13')]({'where':{'VoiceExtensionId':_0xf0456},'transaction':_0x2d055c})[_0x33ba('0x14')](function(){var _0x5bed2d=_[_0x33ba('0x1c')](_0x4e6994,function(_0x1f5daa){_0x1f5daa[_0x33ba('0x55')]=_0xf0456;_0x1f5daa[_0x33ba('0x56')]=!![];return _0x1f5daa;});return _0x5c49e0[_0x33ba('0x57')](_0x5bed2d);})['then'](function(_0x3c5755){return db['VoiceExtension'][_0x33ba('0x58')](_0x3c5755,{'transaction':_0x2d055c});});}else{_0x491e9d=0x194;_0x1ed564=[];}});})[_0x33ba('0x14')](function(){if(_0x491e9d!==0x194){return db[_0x33ba('0x26')][_0x33ba('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0xf0456},'order':_0x33ba('0x5a')})[_0x33ba('0x14')](function(_0x4f862b){_0x1ed564=_0x4f862b;});}})[_0x33ba('0x38')](function(_0x22cfab){_0x491e9d=0x1f4;logger[_0x33ba('0x22')](_0x22cfab['stack']);if(_0x22cfab['name']){delete _0x22cfab[_0x33ba('0x20')];}_0x1ed564=_0x22cfab;})[_0x33ba('0x5b')](function(){if(_0x1ed564===null){_0x53df8b['sendStatus'](_0x491e9d);}else{if(_0x491e9d===0x1f4){_0x53df8b[_0x33ba('0xa')](_0x491e9d)[_0x33ba('0x24')](_0x1ed564);}else{_0x53df8b[_0x33ba('0xa')](_0x491e9d)[_0x33ba('0xc')](_0x1ed564);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4611e0a..59a1e59 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 _0xa9d8=['hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x4b8c94,_0x5bdb3c){var _0x1a2ec3=function(_0x1a4121){while(--_0x1a4121){_0x4b8c94['push'](_0x4b8c94['shift']());}};_0x1a2ec3(++_0x5bdb3c);}(_0xa9d8,0x110));var _0x8a9d=function(_0x46b7df,_0x4ebda9){_0x46b7df=_0x46b7df-0x0;var _0xc77e86=_0xa9d8[_0x46b7df];return _0xc77e86;};'use strict';var EventEmitter=require(_0x8a9d('0x0'));var VoiceExtension=require(_0x8a9d('0x1'))['db'][_0x8a9d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a9d('0x3'),'afterUpdate':_0x8a9d('0x4'),'afterDestroy':_0x8a9d('0x5')};function emitEvent(_0x139cd0){return function(_0x57df9f,_0x39fad5,_0x259980){VoiceExtensionEvents['emit'](_0x139cd0+':'+_0x57df9f['id'],_0x57df9f);VoiceExtensionEvents[_0x8a9d('0x6')](_0x139cd0,_0x57df9f);_0x259980(null);};}for(var e in events){if(events[_0x8a9d('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x8a9d('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2775=['setMaxListeners','save','update','remove','exports','events','../../mysqldb'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x2775,0x163));var _0x5277=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x2775[_0x45783c];return _0x1161da;};'use strict';var EventEmitter=require(_0x5277('0x0'));var VoiceExtension=require(_0x5277('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5277('0x2')](0x0);var events={'afterCreate':_0x5277('0x3'),'afterUpdate':_0x5277('0x4'),'afterDestroy':_0x5277('0x5')};function emitEvent(_0x7a24a8){return function(_0xbc00e1,_0x2813df,_0x5e2daa){VoiceExtensionEvents['emit'](_0x7a24a8+':'+_0xbc00e1['id'],_0xbc00e1);VoiceExtensionEvents['emit'](_0x7a24a8,_0xbc00e1);_0x5e2daa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x5277('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 153fe9c..fd76b06 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 _0xc878=['U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','exports','type','Set','context','exten','alias','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','split','length','name','param','prefix','phone','SIP','indexOf'];(function(_0x21ac2d,_0x5e6552){var _0x3c4ccc=function(_0x585c71){while(--_0x585c71){_0x21ac2d['push'](_0x21ac2d['shift']());}};_0x3c4ccc(++_0x5e6552);}(_0xc878,0x10f));var _0x8c87=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xc878[_0x24f326];return _0x488e2d;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x8c87('0x0')]=function(_0x1fb20e){var _0x36d359=_0x1fb20e['models'];function _0x41ad8c(_0x484c96){var _0x3c61dc=0x2;var _0x73db00=[{'type':_0x484c96[_0x8c87('0x1')],'app':_0x8c87('0x2'),'appdata':'CDR(type)='+_0x484c96[_0x8c87('0x1')],'context':_0x484c96[_0x8c87('0x3')],'exten':_0x484c96[_0x8c87('0x4')],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']},{'type':_0x484c96[_0x8c87('0x1')],'app':_0x484c96[_0x8c87('0x5')]?_0x8c87('0x2'):'NoOp','appdata':_0x484c96[_0x8c87('0x5')]?_0x8c87('0x6')+_0x484c96['alias']:'No\x20alias\x20set','context':_0x484c96[_0x8c87('0x3')],'exten':_0x484c96[_0x8c87('0x4')],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']}];if(_0x484c96['type']===_0x8c87('0x7')){_0x73db00[_0x8c87('0x8')]({'type':_0x8c87('0x7'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x9')+_0x484c96['id'],'context':_0x484c96['context'],'exten':_0x484c96['exten'],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']});}_0x73db00[_0x8c87('0x8')]({'type':_0x484c96[_0x8c87('0x1')],'app':_0x8c87('0x2'),'appdata':_0x8c87('0xa'),'context':_0x484c96[_0x8c87('0x3')],'exten':_0x484c96[_0x8c87('0x4')],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']},{'type':_0x484c96['type'],'app':_0x8c87('0x2'),'appdata':_0x8c87('0xb'),'context':_0x484c96[_0x8c87('0x3')],'exten':_0x484c96['exten'],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']},{'type':_0x484c96[_0x8c87('0x1')],'app':_0x8c87('0x2'),'appdata':'MONITOR_OPTIONS=ab','context':_0x484c96['context'],'exten':_0x484c96['exten'],'priority':_0x3c61dc++,'VoiceExtensionId':_0x484c96['id']});return _0x73db00;}function _0x21d87f(_0x55d0ce){var _0x1cc5a3=0x2;var _0x3b7fd3=[{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0xd'),'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':'outbound','app':_0x55d0ce[_0x8c87('0x5')]?_0x8c87('0x2'):'NoOp','appdata':_0x55d0ce[_0x8c87('0x5')]?_0x8c87('0x6')+_0x55d0ce[_0x8c87('0x5')]:_0x8c87('0xe'),'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce['exten'],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0xf')+(_0x55d0ce[_0x8c87('0x10')]?_0x8c87('0x11')+_0x55d0ce[_0x8c87('0x10')]+'}':_0x8c87('0x12')),'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x9')+_0x55d0ce['id'],'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce['exten'],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1cc5a3+0x2)+'):Goto('+(_0x1cc5a3+0x1)+')','context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce['exten'],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x55d0ce[_0x8c87('0x10')]?'CDR(prefix)=${EXTEN:0:'+_0x55d0ce[_0x8c87('0x10')]+'}':_0x8c87('0x13'),'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x55d0ce['context'],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x14'),'context':_0x55d0ce['context'],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x15')+_0x55d0ce['id'],'context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']}];if(_0x55d0ce['hasOwnProperty'](_0x8c87('0x16'))&&_0x55d0ce[_0x8c87('0x16')]!==_0x8c87('0x17')){_0x3b7fd3['push']({'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x18'),'context':_0x55d0ce['context'],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']},{'type':_0x8c87('0xc'),'app':_0x8c87('0x2'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x55d0ce[_0x8c87('0x16')]||'wav','context':_0x55d0ce[_0x8c87('0x3')],'exten':_0x55d0ce[_0x8c87('0x4')],'priority':_0x1cc5a3++,'VoiceExtensionId':_0x55d0ce['id']});}return _0x3b7fd3;}function _0x3acc3f(_0x360f18,_0x4610dd){var _0x4dec51=[{'name':_0x8c87('0x19'),'param':0x0},{'name':_0x8c87('0x1a'),'param':0x1},{'name':_0x8c87('0x1b'),'param':0x2},{'name':_0x8c87('0x1c'),'param':0x3}];var _0x271c58={};var _0xaf8333=_0x4610dd[_0x8c87('0x1d')](',');var _0x136383=[];for(var _0x153180=0x0;_0x153180<_0x4dec51[_0x8c87('0x1e')];_0x153180++){switch(_0x4dec51[_0x153180][_0x8c87('0x1f')]){case _0x8c87('0x19'):_0x271c58[_0x8c87('0x19')]=_0xaf8333[_0x4dec51[_0x153180][_0x8c87('0x20')]][_0x8c87('0x1d')]('/')[0x1];_0x271c58['phone']=_0xaf8333[_0x4dec51[_0x153180][_0x8c87('0x20')]][_0x8c87('0x1d')]('/')[0x2];_0x271c58[_0x8c87('0x21')]=_0x271c58[_0x8c87('0x22')]?_0x271c58[_0x8c87('0x22')]['split']('$')[0x0]:undefined;_0x271c58[_0x8c87('0x22')]=_0x360f18[_0x8c87('0x10')]?(_0x271c58[_0x8c87('0x21')]||'')+'${EXTEN:'+_0x360f18[_0x8c87('0x10')]+'}':(_0x271c58['prefix']||'')+_0x8c87('0x12');_0x136383[_0x4dec51[_0x153180][_0x8c87('0x20')]]=[_0x8c87('0x23'),_0x271c58[_0x8c87('0x19')],_0x271c58[_0x8c87('0x22')]]['join']('/');break;case _0x8c87('0x1b'):_0x271c58[_0x8c87('0x1b')]=_0xaf8333[_0x4dec51[_0x153180][_0x8c87('0x20')]];if(_0x360f18[_0x8c87('0x16')]!==_0x8c87('0x17')){if(_0x271c58['options'][_0x8c87('0x24')](_0x8c87('0x25'))<0x0){_0x271c58[_0x8c87('0x1b')]+='U(xcally-mixmonitor-context)';}}else{_0x271c58[_0x8c87('0x1b')]=_0x271c58[_0x8c87('0x1b')][_0x8c87('0x26')](_0x8c87('0x25'),'');}_0x136383[_0x4dec51[_0x153180][_0x8c87('0x20')]]=_0x271c58[_0x8c87('0x1b')];break;default:_0x136383[_0x4dec51[_0x153180][_0x8c87('0x20')]]=_0xaf8333[_0x4dec51[_0x153180][_0x8c87('0x20')]];}}return _0x136383[_0x8c87('0x27')](',');}function _0xe3a625(_0x33cd19,_0x4bc1c0,_0x4e79af){return new Promise(function(_0x4a6ff5,_0x3edf08){var _0x3a783f=[];if(_[_0x8c87('0x28')](_0x4bc1c0))return _0x4a6ff5(_0x3a783f);_0x36d359['Interval'][_0x8c87('0x29')]({'attributes':['id',_0x8c87('0x2a'),_0x8c87('0x2b')],'raw':!![]})['then'](function(_0x31eaef){for(var _0x42b270=0x0,_0x3e4f64=0x0;_0x42b270<_0x4bc1c0[_0x8c87('0x1e')];_0x42b270++,_0x3e4f64=0x0){var _0x1975a3=_0x4bc1c0[_0x42b270];var _0xf48879=[];var _0x3ee6b9=[];delete _0x1975a3['id'];if(_0x1975a3[_0x8c87('0x2a')]!==_0x8c87('0x2c')){_0x1975a3[_0x8c87('0x2d')]=[_0x1975a3[_0x8c87('0x2a')]];}else{_0x1975a3['intervals']=_0x1975a3['IntervalId']?_[_0x8c87('0x2e')](_[_0x8c87('0x2f')](_0x31eaef,{'IntervalId':_0x1975a3[_0x8c87('0x2b')]}),_0x8c87('0x2a')):[];}_0x1975a3[_0x8c87('0x3')]=_0x33cd19['context'];_0x1975a3[_0x8c87('0x4')]=_0x33cd19[_0x8c87('0x4')];if(_0x1975a3[_0x8c87('0x1')])_0x1975a3['type']=_0x1975a3[_0x8c87('0x1')][_0x8c87('0x30')]();if(_0x33cd19['type']==='outbound'){if(_0x1975a3[_0x8c87('0x31')]('tag')&&_0x1975a3[_0x8c87('0x32')]&&_0x1975a3[_0x8c87('0x32')]!=='--'){_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3['type'][_0x8c87('0x30')](),'app':'Set','appdata':'CDR(tag)='+_0x1975a3[_0x8c87('0x32')],'context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19[_0x8c87('0x4')],'priority':_0x1975a3[_0x8c87('0x2d')]['length']+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});}_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3[_0x8c87('0x1')]['toLowerCase'](),'app':_0x8c87('0x33'),'appdata':_0x8c87('0x34')+(_0x1975a3['callerID']?_0x8c87('0x35')+_0x1975a3['callerID']+')':_0x8c87('0x36')),'context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19['exten'],'priority':_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});}else{if(_0x1975a3[_0x8c87('0x31')](_0x8c87('0x37'))){if([_0x8c87('0x38'),_0x8c87('0x39')][_0x8c87('0x3a')](_0x1975a3[_0x8c87('0x3b')]['toLowerCase']())&&_0x1975a3[_0x8c87('0x3c')]!=='custom'){if(_0x1975a3['answer']){_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3[_0x8c87('0x1')][_0x8c87('0x30')](),'app':_0x8c87('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19['exten'],'priority':_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});_0xf48879['push']({'type':_0x1975a3[_0x8c87('0x1')]['toLowerCase'](),'app':'Set','appdata':_0x8c87('0x3d'),'context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19[_0x8c87('0x4')],'priority':_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});}else{_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3[_0x8c87('0x1')][_0x8c87('0x30')](),'app':_0x8c87('0x33'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19[_0x8c87('0x4')],'priority':_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3[_0x8c87('0x1')][_0x8c87('0x30')](),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x3e'),'context':_0x33cd19['context'],'exten':_0x33cd19[_0x8c87('0x4')],'priority':_0x1975a3[_0x8c87('0x2d')]['length']+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});}}}}for(var _0x2d53e3=0x0;_0x2d53e3<_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')];_0x2d53e3++){var _0x278d61=_0x4e79af+_0x1975a3[_0x8c87('0x2d')]['length'];var _0x1c1d3c=_0x2d53e3===_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]-0x1?_0x4e79af+_0xf48879[_0x8c87('0x1e')]+_0x3ee6b9['length']+0x2:_0x4e79af+_0x2d53e3+0x1;_0xf48879[_0x8c87('0x3f')](_0x2d53e3,0x0,{'type':_0x33cd19['type'],'app':_0x8c87('0x40'),'appdata':_0x1975a3['intervals'][_0x2d53e3]+'?'+_0x33cd19[_0x8c87('0x3')]+',${EXTEN},'+_0x278d61+':'+_0x33cd19['context']+_0x8c87('0x41')+_0x1c1d3c,'exten':_0x33cd19[_0x8c87('0x4')],'context':_0x33cd19[_0x8c87('0x3')],'priority':_0x4e79af+_0x2d53e3,'VoiceExtensionId':_0x33cd19['id']});}if(_0x1975a3[_0x8c87('0x3c')]==='outboundDial'){_0x1975a3['appdata']=_0x3acc3f(_0x33cd19,_0x1975a3[_0x8c87('0x42')]);}if(_0x1975a3[_0x8c87('0x3c')]===_0x8c87('0x43')){_0xf48879[_0x8c87('0x8')]({'type':_0x1975a3[_0x8c87('0x1')][_0x8c87('0x30')](),'app':_0x8c87('0x2'),'appdata':_0x8c87('0x44'),'context':_0x33cd19[_0x8c87('0x3')],'exten':_0x33cd19[_0x8c87('0x4')],'priority':_0x1975a3[_0x8c87('0x2d')][_0x8c87('0x1e')]+_0x4e79af+_0x3e4f64++,'VoiceExtensionId':_0x33cd19['id']});}_0x1975a3[_0x8c87('0x45')]=_0xf48879[_0x8c87('0x1e')]?_['last'](_0xf48879)[_0x8c87('0x45')]+0x1:_0x4e79af;_0x3a783f=_[_0x8c87('0x46')](_0x3a783f,_0xf48879,[_0x1975a3],_0x3ee6b9);_0x4e79af=_[_0x8c87('0x47')](_0x3a783f)[_0x8c87('0x45')]+0x1;}return _0x4a6ff5(_0x3a783f);})[_0x8c87('0x48')](function(_0x100dc2){_0x3edf08(_0x100dc2);});});}return _0x1fb20e[_0x8c87('0x49')](_0x8c87('0x4a'),attributes,{'tableName':_0x8c87('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x321c1f){var _0x16de40=this[_0x8c87('0x4c')]({'plain':!![]});var _0xe6d0b3=_0x16de40[_0x8c87('0x1')]===_0x8c87('0xc')?_0x21d87f(_0x16de40):_0x41ad8c(_0x16de40);return _0xe3a625(_0x16de40,_0x321c1f,_['last'](_0xe6d0b3)[_0x8c87('0x45')]+0x1)['then'](function(_0x10c5b1){var _0x47e555=_[_0x8c87('0x46')](_0xe6d0b3,_0x10c5b1);_0x47e555['push']({'type':_0x16de40['type'],'app':'Hangup','exten':_0x16de40[_0x8c87('0x4')],'context':_0x16de40[_0x8c87('0x3')],'priority':_['last'](_0x47e555)[_0x8c87('0x45')]+0x1,'VoiceExtensionId':_0x16de40['id']});return _0x47e555;});}}});}; \ No newline at end of file +var _0x422c=['get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','split','length','phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','last','priority','concat','catch','define','VoiceExtension'];(function(_0x3d9e39,_0x11d9ee){var _0x4bb3ec=function(_0x4c0ac4){while(--_0x4c0ac4){_0x3d9e39['push'](_0x3d9e39['shift']());}};_0x4bb3ec(++_0x11d9ee);}(_0x422c,0x1ee));var _0xc422=function(_0x5a15b1,_0x202388){_0x5a15b1=_0x5a15b1-0x0;var _0x4c2df7=_0x422c[_0x5a15b1];return _0x4c2df7;};'use strict';var _=require(_0xc422('0x0'));var attributes=require(_0xc422('0x1'));module['exports']=function(_0x5d9d59){var _0x55cdad=_0x5d9d59[_0xc422('0x2')];function _0x2fb911(_0x27185c){var _0x588269=0x2;var _0xf914c0=[{'type':_0x27185c[_0xc422('0x3')],'app':_0xc422('0x4'),'appdata':_0xc422('0x5')+_0x27185c['type'],'context':_0x27185c['context'],'exten':_0x27185c[_0xc422('0x6')],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']},{'type':_0x27185c[_0xc422('0x3')],'app':_0x27185c[_0xc422('0x7')]?_0xc422('0x4'):_0xc422('0x8'),'appdata':_0x27185c[_0xc422('0x7')]?_0xc422('0x9')+_0x27185c['alias']:_0xc422('0xa'),'context':_0x27185c['context'],'exten':_0x27185c[_0xc422('0x6')],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']}];if(_0x27185c[_0xc422('0x3')]===_0xc422('0xb')){_0xf914c0[_0xc422('0xc')]({'type':_0xc422('0xb'),'app':_0xc422('0x4'),'appdata':_0xc422('0xd')+_0x27185c['id'],'context':_0x27185c[_0xc422('0xe')],'exten':_0x27185c['exten'],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']});}_0xf914c0['push']({'type':_0x27185c[_0xc422('0x3')],'app':_0xc422('0x4'),'appdata':_0xc422('0xf'),'context':_0x27185c[_0xc422('0xe')],'exten':_0x27185c['exten'],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']},{'type':_0x27185c[_0xc422('0x3')],'app':'Set','appdata':_0xc422('0x10'),'context':_0x27185c[_0xc422('0xe')],'exten':_0x27185c['exten'],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']},{'type':_0x27185c['type'],'app':_0xc422('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x27185c[_0xc422('0xe')],'exten':_0x27185c[_0xc422('0x6')],'priority':_0x588269++,'VoiceExtensionId':_0x27185c['id']});return _0xf914c0;}function _0x54f51c(_0x1b8744){var _0x2a313e=0x2;var _0x2c166f=[{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':_0xc422('0x12'),'context':_0x1b8744['context'],'exten':_0x1b8744['exten'],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0x1b8744[_0xc422('0x7')]?_0xc422('0x4'):_0xc422('0x8'),'appdata':_0x1b8744['alias']?'CDR(routeAlias)='+_0x1b8744['alias']:_0xc422('0xa'),'context':_0x1b8744['context'],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':'CDR(destination)='+(_0x1b8744['cutdigits']?_0xc422('0x13')+_0x1b8744[_0xc422('0x14')]+'}':_0xc422('0x15')),'context':_0x1b8744['context'],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':_0xc422('0xd')+_0x1b8744['id'],'context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744['exten'],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x16'),'appdata':_0xc422('0x17')+(_0x2a313e+0x2)+_0xc422('0x18')+(_0x2a313e+0x1)+')','context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':'outbound','app':'Set','appdata':_0x1b8744[_0xc422('0x14')]?_0xc422('0x19')+_0x1b8744[_0xc422('0x14')]+'}':_0xc422('0x1a'),'context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744['exten'],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':_0xc422('0xf'),'context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':_0xc422('0x1b'),'context':_0x1b8744['context'],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':'Set','appdata':_0xc422('0x1c')+_0x1b8744['id'],'context':_0x1b8744['context'],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']}];if(_0x1b8744[_0xc422('0x1d')](_0xc422('0x1e'))&&_0x1b8744[_0xc422('0x1e')]!==_0xc422('0x1f')){_0x2c166f[_0xc422('0xc')]({'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':_0xc422('0x20'),'context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']},{'type':_0xc422('0x11'),'app':_0xc422('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1b8744[_0xc422('0x1e')]||_0xc422('0x21'),'context':_0x1b8744[_0xc422('0xe')],'exten':_0x1b8744[_0xc422('0x6')],'priority':_0x2a313e++,'VoiceExtensionId':_0x1b8744['id']});}return _0x2c166f;}function _0x3708dc(_0x381953,_0xc939a1){var _0x40aead=[{'name':_0xc422('0x22'),'param':0x0},{'name':_0xc422('0x23'),'param':0x1},{'name':_0xc422('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x3ba70b={};var _0x135d3b=_0xc939a1[_0xc422('0x25')](',');var _0x21813c=[];for(var _0x17dc29=0x0;_0x17dc29<_0x40aead[_0xc422('0x26')];_0x17dc29++){switch(_0x40aead[_0x17dc29]['name']){case _0xc422('0x22'):_0x3ba70b[_0xc422('0x22')]=_0x135d3b[_0x40aead[_0x17dc29]['param']][_0xc422('0x25')]('/')[0x1];_0x3ba70b[_0xc422('0x27')]=_0x135d3b[_0x40aead[_0x17dc29][_0xc422('0x28')]][_0xc422('0x25')]('/')[0x2];_0x3ba70b[_0xc422('0x29')]=_0x3ba70b['phone']?_0x3ba70b[_0xc422('0x27')][_0xc422('0x25')]('$')[0x0]:undefined;_0x3ba70b['phone']=_0x381953[_0xc422('0x14')]?(_0x3ba70b[_0xc422('0x29')]||'')+'${EXTEN:'+_0x381953[_0xc422('0x14')]+'}':(_0x3ba70b[_0xc422('0x29')]||'')+'${EXTEN}';_0x21813c[_0x40aead[_0x17dc29][_0xc422('0x28')]]=[_0xc422('0x2a'),_0x3ba70b[_0xc422('0x22')],_0x3ba70b[_0xc422('0x27')]][_0xc422('0x2b')]('/');break;case'options':_0x3ba70b[_0xc422('0x24')]=_0x135d3b[_0x40aead[_0x17dc29]['param']];if(_0x381953[_0xc422('0x1e')]!=='none'){if(_0x3ba70b[_0xc422('0x24')][_0xc422('0x2c')](_0xc422('0x2d'))<0x0){_0x3ba70b['options']+=_0xc422('0x2d');}}else{_0x3ba70b['options']=_0x3ba70b[_0xc422('0x24')]['replace'](_0xc422('0x2d'),'');}_0x21813c[_0x40aead[_0x17dc29][_0xc422('0x28')]]=_0x3ba70b[_0xc422('0x24')];break;default:_0x21813c[_0x40aead[_0x17dc29]['param']]=_0x135d3b[_0x40aead[_0x17dc29]['param']];}}return _0x21813c[_0xc422('0x2b')](',');}function _0x49c6ab(_0x581dbe,_0x4df2cf,_0x212778){return new Promise(function(_0x2c927d,_0x595290){var _0x856866=[];if(_['isEmpty'](_0x4df2cf))return _0x2c927d(_0x856866);_0x55cdad[_0xc422('0x2e')][_0xc422('0x2f')]({'attributes':['id',_0xc422('0x30'),_0xc422('0x31')],'raw':!![]})[_0xc422('0x32')](function(_0x2c1ee8){for(var _0x3aec3f=0x0,_0x4de282=0x0;_0x3aec3f<_0x4df2cf[_0xc422('0x26')];_0x3aec3f++,_0x4de282=0x0){var _0xf96875=_0x4df2cf[_0x3aec3f];var _0x31a4c7=[];var _0x43c614=[];delete _0xf96875['id'];if(_0xf96875[_0xc422('0x30')]!==_0xc422('0x33')){_0xf96875['intervals']=[_0xf96875[_0xc422('0x30')]];}else{_0xf96875[_0xc422('0x34')]=_0xf96875[_0xc422('0x31')]?_[_0xc422('0x35')](_[_0xc422('0x36')](_0x2c1ee8,{'IntervalId':_0xf96875['IntervalId']}),_0xc422('0x30')):[];}_0xf96875[_0xc422('0xe')]=_0x581dbe[_0xc422('0xe')];_0xf96875['exten']=_0x581dbe['exten'];if(_0xf96875['type'])_0xf96875[_0xc422('0x3')]=_0xf96875[_0xc422('0x3')][_0xc422('0x37')]();if(_0x581dbe[_0xc422('0x3')]===_0xc422('0x11')){if(_0xf96875[_0xc422('0x1d')]('tag')&&_0xf96875[_0xc422('0x38')]&&_0xf96875[_0xc422('0x38')]!=='--'){_0x31a4c7[_0xc422('0xc')]({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':'Set','appdata':'CDR(tag)='+_0xf96875[_0xc422('0x38')],'context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe['exten'],'priority':_0xf96875[_0xc422('0x34')][_0xc422('0x26')]+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});}_0x31a4c7[_0xc422('0xc')]({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':'ExecIf','appdata':_0xc422('0x39')+(_0xf96875[_0xc422('0x3a')]?'Set(CALLERID(all)='+_0xf96875[_0xc422('0x3a')]+')':_0xc422('0x3b')),'context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe['exten'],'priority':_0xf96875['intervals']['length']+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});}else{if(_0xf96875[_0xc422('0x1d')]('answer')){if([_0xc422('0x3c'),_0xc422('0x3d')][_0xc422('0x3e')](_0xf96875['app']['toLowerCase']())&&_0xf96875['appType']!==_0xc422('0x3f')){if(_0xf96875['answer']){_0x31a4c7[_0xc422('0xc')]({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':_0xc422('0x16'),'appdata':_0xc422('0x40'),'context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe[_0xc422('0x6')],'priority':_0xf96875[_0xc422('0x34')][_0xc422('0x26')]+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});_0x31a4c7['push']({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':_0xc422('0x4'),'appdata':_0xc422('0x41'),'context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe[_0xc422('0x6')],'priority':_0xf96875[_0xc422('0x34')][_0xc422('0x26')]+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});}else{_0x31a4c7[_0xc422('0xc')]({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':_0xc422('0x16'),'appdata':_0xc422('0x42'),'context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe[_0xc422('0x6')],'priority':_0xf96875[_0xc422('0x34')][_0xc422('0x26')]+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});_0x31a4c7['push']({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':_0xc422('0x4'),'appdata':_0xc422('0x43'),'context':_0x581dbe['context'],'exten':_0x581dbe[_0xc422('0x6')],'priority':_0xf96875[_0xc422('0x34')][_0xc422('0x26')]+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});}}}}for(var _0x5c283e=0x0;_0x5c283e<_0xf96875[_0xc422('0x34')]['length'];_0x5c283e++){var _0xf74eea=_0x212778+_0xf96875[_0xc422('0x34')][_0xc422('0x26')];var _0xe1abe3=_0x5c283e===_0xf96875['intervals'][_0xc422('0x26')]-0x1?_0x212778+_0x31a4c7[_0xc422('0x26')]+_0x43c614['length']+0x2:_0x212778+_0x5c283e+0x1;_0x31a4c7[_0xc422('0x44')](_0x5c283e,0x0,{'type':_0x581dbe[_0xc422('0x3')],'app':'GotoIfTime','appdata':_0xf96875[_0xc422('0x34')][_0x5c283e]+'?'+_0x581dbe['context']+_0xc422('0x45')+_0xf74eea+':'+_0x581dbe['context']+_0xc422('0x45')+_0xe1abe3,'exten':_0x581dbe['exten'],'context':_0x581dbe[_0xc422('0xe')],'priority':_0x212778+_0x5c283e,'VoiceExtensionId':_0x581dbe['id']});}if(_0xf96875[_0xc422('0x46')]===_0xc422('0x47')){_0xf96875[_0xc422('0x48')]=_0x3708dc(_0x581dbe,_0xf96875['appdata']);}if(_0xf96875[_0xc422('0x46')]===_0xc422('0x49')){_0x31a4c7[_0xc422('0xc')]({'type':_0xf96875[_0xc422('0x3')][_0xc422('0x37')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x581dbe[_0xc422('0xe')],'exten':_0x581dbe[_0xc422('0x6')],'priority':_0xf96875['intervals']['length']+_0x212778+_0x4de282++,'VoiceExtensionId':_0x581dbe['id']});}_0xf96875['priority']=_0x31a4c7['length']?_[_0xc422('0x4a')](_0x31a4c7)[_0xc422('0x4b')]+0x1:_0x212778;_0x856866=_[_0xc422('0x4c')](_0x856866,_0x31a4c7,[_0xf96875],_0x43c614);_0x212778=_['last'](_0x856866)[_0xc422('0x4b')]+0x1;}return _0x2c927d(_0x856866);})[_0xc422('0x4d')](function(_0x5b6fb9){_0x595290(_0x5b6fb9);});});}return _0x5d9d59[_0xc422('0x4e')](_0xc422('0x4f'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x12caa1){var _0x2633d2=this[_0xc422('0x50')]({'plain':!![]});var _0x1c048f=_0x2633d2[_0xc422('0x3')]==='outbound'?_0x54f51c(_0x2633d2):_0x2fb911(_0x2633d2);return _0x49c6ab(_0x2633d2,_0x12caa1,_[_0xc422('0x4a')](_0x1c048f)[_0xc422('0x4b')]+0x1)['then'](function(_0x38b5db){var _0x48be6b=_[_0xc422('0x4c')](_0x1c048f,_0x38b5db);_0x48be6b['push']({'type':_0x2633d2[_0xc422('0x3')],'app':_0xc422('0x51'),'exten':_0x2633d2[_0xc422('0x6')],'context':_0x2633d2['context'],'priority':_[_0xc422('0x4a')](_0x48be6b)[_0xc422('0x4b')]+0x1,'VoiceExtensionId':_0x2633d2['id']});return _0x48be6b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 17e41e7..e107075 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 _0xf95f=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf95f,0x142));var _0xff95=function(_0x1d7d0c,_0x3ef4fd){_0x1d7d0c=_0x1d7d0c-0x0;var _0x18705d=_0xf95f[_0x1d7d0c];return _0x18705d;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var moment=require(_0xff95('0x2'));var BPromise=require(_0xff95('0x3'));var rs=require(_0xff95('0x4'));var fs=require('fs');var Redis=require(_0xff95('0x5'));var db=require(_0xff95('0x6'))['db'];var utils=require(_0xff95('0x7'));var logger=require(_0xff95('0x8'))('rpc');var config=require(_0xff95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff95('0xa')]['http']({'port':0x232a});config[_0xff95('0xb')]=_[_0xff95('0xc')](config[_0xff95('0xb')],{'host':_0xff95('0xd'),'port':0x18eb});var socket=require(_0xff95('0xe'))(new Redis(config[_0xff95('0xb')]));require(_0xff95('0xf'))[_0xff95('0x10')](socket);function respondWithRpcPromise(_0x522870,_0x50293a,_0x405908){return new BPromise(function(_0x4547b5,_0x3e5d26){return client[_0xff95('0x11')](_0x522870,_0x405908)[_0xff95('0x12')](function(_0x4245a4){logger[_0xff95('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x50293a,'request\x20sent');logger[_0xff95('0x14')](_0xff95('0x15'),_0x50293a,'request\x20sent',JSON[_0xff95('0x16')](_0x4245a4));if(_0x4245a4['error']){if(_0x4245a4['error']['code']===0x1f4){logger[_0xff95('0x17')](_0xff95('0x18'),_0x50293a,_0x4245a4[_0xff95('0x17')][_0xff95('0x19')]);return _0x3e5d26(_0x4245a4[_0xff95('0x17')][_0xff95('0x19')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x50293a,_0x4245a4[_0xff95('0x17')][_0xff95('0x19')]);return _0x4547b5(_0x4245a4[_0xff95('0x17')][_0xff95('0x19')]);}else{logger[_0xff95('0x13')](_0xff95('0x18'),_0x50293a,'request\x20sent');_0x4547b5(_0x4245a4[_0xff95('0x1a')][_0xff95('0x19')]);}})[_0xff95('0x1b')](function(_0x49f1fb){logger['error'](_0xff95('0x18'),_0x50293a,_0x49f1fb);_0x3e5d26(_0x49f1fb);});});}exports['GetVoiceExtension']=function(_0x379bba){var _0x1661b9=this;return new Promise(function(_0x3a3f10,_0x40ebfd){return db[_0xff95('0x1c')][_0xff95('0x1d')]({'raw':_0x379bba[_0xff95('0x1e')]?_0x379bba[_0xff95('0x1e')][_0xff95('0x1f')]===undefined?!![]:![]:!![],'where':_0x379bba[_0xff95('0x1e')]?_0x379bba[_0xff95('0x1e')]['where']||null:null,'attributes':_0x379bba[_0xff95('0x1e')]?_0x379bba[_0xff95('0x1e')][_0xff95('0x20')]||null:null,'limit':_0x379bba[_0xff95('0x1e')]?_0x379bba[_0xff95('0x1e')][_0xff95('0x21')]||null:null,'include':_0x379bba[_0xff95('0x1e')]?_0x379bba[_0xff95('0x1e')][_0xff95('0x22')]?_[_0xff95('0x23')](_0x379bba['options']['include'],function(_0x50a5c2){return{'model':db[_0x50a5c2['model']],'as':_0x50a5c2['as'],'attributes':_0x50a5c2[_0xff95('0x20')],'include':_0x50a5c2[_0xff95('0x22')]?_[_0xff95('0x23')](_0x50a5c2[_0xff95('0x22')],function(_0x2b98e0){return{'model':db[_0x2b98e0['model']],'as':_0x2b98e0['as'],'attributes':_0x2b98e0[_0xff95('0x20')],'include':_0x2b98e0[_0xff95('0x22')]?_[_0xff95('0x23')](_0x2b98e0[_0xff95('0x22')],function(_0x2528a4){return{'model':db[_0x2528a4[_0xff95('0x24')]],'as':_0x2528a4['as'],'attributes':_0x2528a4[_0xff95('0x20')]};}):[]};}):[]};}):[]:[]})[_0xff95('0x12')](function(_0x2c0f2c){logger['info'](_0xff95('0x25'),_0x379bba);logger[_0xff95('0x14')]('GetVoiceExtension',_0x379bba,JSON[_0xff95('0x16')](_0x2c0f2c));_0x3a3f10(_0x2c0f2c);})['catch'](function(_0x369036){logger['error']('GetVoiceExtension',_0x369036[_0xff95('0x19')],_0x379bba);_0x40ebfd(_0x1661b9[_0xff95('0x17')](0x1f4,_0x369036[_0xff95('0x19')]));});});}; \ No newline at end of file +var _0xda19=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','map','model','include','catch','util','moment','randomstring'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xda19,0xd5));var _0x9da1=function(_0x31d397,_0x2c9ad6){_0x31d397=_0x31d397-0x0;var _0x28d2cc=_0xda19[_0x31d397];return _0x28d2cc;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});config[_0x9da1('0xa')]=_[_0x9da1('0xb')](config[_0x9da1('0xa')],{'host':_0x9da1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9da1('0xd')](socket);function respondWithRpcPromise(_0x493d0b,_0x33cfe5,_0x1cca84){return new BPromise(function(_0x3ba3d3,_0x1ab988){return client[_0x9da1('0xe')](_0x493d0b,_0x1cca84)[_0x9da1('0xf')](function(_0x9fd032){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x33cfe5,_0x9da1('0x10'));logger['debug'](_0x9da1('0x11'),_0x33cfe5,_0x9da1('0x10'),JSON[_0x9da1('0x12')](_0x9fd032));if(_0x9fd032[_0x9da1('0x13')]){if(_0x9fd032['error'][_0x9da1('0x14')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x1ab988(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x3ba3d3(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}else{logger[_0x9da1('0x17')](_0x9da1('0x16'),_0x33cfe5,_0x9da1('0x10'));_0x3ba3d3(_0x9fd032[_0x9da1('0x18')]['message']);}})['catch'](function(_0x17205d){logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x17205d);_0x1ab988(_0x17205d);});});}exports[_0x9da1('0x19')]=function(_0x40a967){var _0x3b1645=this;return new Promise(function(_0xe56279,_0x47e5cf){return db[_0x9da1('0x1a')][_0x9da1('0x1b')]({'raw':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')][_0x9da1('0x1d')]===undefined?!![]:![]:!![],'where':_0x40a967['options']?_0x40a967['options'][_0x9da1('0x1e')]||null:null,'attributes':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')][_0x9da1('0x1f')]||null:null,'limit':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')]['limit']||null:null,'include':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')]['include']?_[_0x9da1('0x20')](_0x40a967[_0x9da1('0x1c')]['include'],function(_0x2fd49c){return{'model':db[_0x2fd49c[_0x9da1('0x21')]],'as':_0x2fd49c['as'],'attributes':_0x2fd49c['attributes'],'include':_0x2fd49c[_0x9da1('0x22')]?_[_0x9da1('0x20')](_0x2fd49c['include'],function(_0x5c09ed){return{'model':db[_0x5c09ed[_0x9da1('0x21')]],'as':_0x5c09ed['as'],'attributes':_0x5c09ed[_0x9da1('0x1f')],'include':_0x5c09ed['include']?_[_0x9da1('0x20')](_0x5c09ed['include'],function(_0x5a6f2d){return{'model':db[_0x5a6f2d['model']],'as':_0x5a6f2d['as'],'attributes':_0x5a6f2d[_0x9da1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9da1('0xf')](function(_0x24c6d5){logger[_0x9da1('0x17')](_0x9da1('0x19'),_0x40a967);logger['debug'](_0x9da1('0x19'),_0x40a967,JSON['stringify'](_0x24c6d5));_0xe56279(_0x24c6d5);})[_0x9da1('0x23')](function(_0x235ced){logger['error'](_0x9da1('0x19'),_0x235ced[_0x9da1('0x15')],_0x40a967);_0x47e5cf(_0x3b1645['error'](0x1f4,_0x235ced[_0x9da1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 094c983..52db51f 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x155962,_0x43833e){var _0x459bbc=function(_0x4098db){while(--_0x4098db){_0x155962['push'](_0x155962['shift']());}};_0x459bbc(++_0x43833e);}(_0xe14b,0x93));var _0xbe14=function(_0x1104ba,_0x285acf){_0x1104ba=_0x1104ba-0x0;var _0x101f49=_0xe14b[_0x1104ba];return _0x101f49;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x1eb9c3,_0x315f58){var _0x45d671=function(_0x524706){while(--_0x524706){_0x1eb9c3['push'](_0x1eb9c3['shift']());}};_0x45d671(++_0x315f58);}(_0x1261,0x144));var _0x1126=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x1261[_0x3bd52b];return _0x1e5b89;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f2e1977..61e11b6 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 _0x323f=['show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id'];(function(_0x52c6d1,_0x580e60){var _0x48ed03=function(_0x4ef00f){while(--_0x4ef00f){_0x52c6d1['push'](_0x52c6d1['shift']());}};_0x48ed03(++_0x580e60);}(_0x323f,0x1ee));var _0xf323=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x323f[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x13')](_0xf323('0xb'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);module[_0xf323('0x15')]=router; \ No newline at end of file +var _0x1883=['index','/:id','/:id/messages','getMessages','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','isAuthenticated'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x1883,0xab));var _0x3188=function(_0x5c71fc,_0x497862){_0x5c71fc=_0x5c71fc-0x0;var _0x326bd4=_0x1883[_0x5c71fc];return _0x326bd4;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b06c0db..662ca00 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 _0x6858=['setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6858,0x164));var _0x8685=function(_0x80d7ff,_0x4932a2){_0x80d7ff=_0x80d7ff-0x0;var _0x37a6c7=_0x6858[_0x80d7ff];return _0x37a6c7;};'use strict';var Sequelize=require(_0x8685('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8685('0x1')],'defaultValue':_0x8685('0x2'),'unique':_0x8685('0x3')},'mailbox':{'type':Sequelize[_0x8685('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8685('0x3')},'password':{'type':Sequelize[_0x8685('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4c7c51){this[_0x8685('0x4')]('email',typeof _0x4c7c51===_0x8685('0x5')&&_0x4c7c51[_0x8685('0x6')]()?_0x4c7c51['trim']():null);}},'pager':{'type':Sequelize[_0x8685('0x1')]},'tz':{'type':Sequelize[_0x8685('0x1')],'defaultValue':_0x8685('0x7')},'attach':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':_0x8685('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8685('0x9'),'no'),'defaultValue':_0x8685('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8685('0x1')]},'callback':{'type':Sequelize[_0x8685('0x1')]},'review':{'type':Sequelize[_0x8685('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x8685('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x8685('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8685('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8685('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':_0x8685('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8685('0x8')](_0x8685('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x8685('0xb')},'emailsubject':{'type':Sequelize[_0x8685('0x1')]},'emailbody':{'type':Sequelize[_0x8685('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8685('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8685('0xd')],'get':function(){return this[_0x8685('0xe')](_0x8685('0xf'))+_0x8685('0x10')+this['getDataValue'](_0x8685('0x11'));}}}; \ No newline at end of file +var _0xcef9=['fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','ENUM','yes','TIMESTAMP','INTEGER','getDataValue'];(function(_0x1fe641,_0x4c1aa4){var _0x9cb23e=function(_0x447df5){while(--_0x447df5){_0x1fe641['push'](_0x1fe641['shift']());}};_0x9cb23e(++_0x4c1aa4);}(_0xcef9,0xf2));var _0x9cef=function(_0x24770c,_0x518686){_0x24770c=_0x24770c-0x0;var _0x6c1399=_0xcef9[_0x24770c];return _0x6c1399;};'use strict';var Sequelize=require(_0x9cef('0x0'));module[_0x9cef('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9cef('0x2')],'defaultValue':_0x9cef('0x3'),'unique':_0x9cef('0x4')},'mailbox':{'type':Sequelize[_0x9cef('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x9cef('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9cef('0x2')],'validate':{'isEmail':!![]},'set':function(_0x36bd65){this[_0x9cef('0x5')](_0x9cef('0x6'),typeof _0x36bd65===_0x9cef('0x7')&&_0x36bd65['trim']()?_0x36bd65['trim']():null);}},'pager':{'type':Sequelize[_0x9cef('0x2')]},'tz':{'type':Sequelize[_0x9cef('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x9cef('0x8')]('yes','no'),'defaultValue':_0x9cef('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x9cef('0x9'),'no'),'defaultValue':_0x9cef('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9cef('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9cef('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9cef('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':_0x9cef('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9cef('0x8')](_0x9cef('0x9'),'no'),'defaultValue':_0x9cef('0x9'),'allowNull':![]},'stamp':{'type':_0x9cef('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9cef('0x2')]},'maxsecs':{'type':Sequelize[_0x9cef('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9cef('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9cef('0xc')](_0x9cef('0xd'))+_0x9cef('0xe')+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e271bab..93ccddb 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 _0x0565=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','Voicemails','sendStatus','stack','name','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','update','findOne','VoiceMailMessage','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x32c012,_0xe3c576){var _0x48562e=function(_0x505228){while(--_0x505228){_0x32c012['push'](_0x32c012['shift']());}};_0x48562e(++_0xe3c576);}(_0x0565,0xf2));var _0x5056=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0565[_0x3e44fa];return _0x2a0aba;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){var _0x37f7b5=_0x29e166['get']({'plain':!![]});var _0x267048=_0x5056('0x25');return db['UserProfileResource'][_0x5056('0x24')]({'where':{'type':_0x267048,'resourceId':_0x37f7b5['id']}})['then'](function(){return _0x29e166;});})[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)[_0x5056('0x1a')]();});}};}function handleEntityNotFound(_0x2b8fab,_0x45f600){return function(_0x50f2a8){if(!_0x50f2a8){_0x2b8fab[_0x5056('0x26')](0x194);}return _0x50f2a8;};}function handleError(_0x346e9e,_0x14cb84){_0x14cb84=_0x14cb84||0x1f4;return function(_0x2ac79a){logger['error'](_0x2ac79a[_0x5056('0x27')]);if(_0x2ac79a['name']){delete _0x2ac79a[_0x5056('0x28')];}_0x346e9e['status'](_0x14cb84)['send'](_0x2ac79a);};}exports['index']=function(_0x113be0,_0x252f75){var _0x482939={},_0x27f4be={},_0x2c5728={'count':0x0,'rows':[]};var _0x9e2986=_[_0x5056('0x29')](db[_0x5056('0x2a')][_0x5056('0x2b')],function(_0x173fac){return{'name':_0x173fac[_0x5056('0x2c')],'type':_0x173fac[_0x5056('0x2d')][_0x5056('0x2e')]};});_0x27f4be[_0x5056('0x2f')]=_['map'](_0x9e2986,'name');_0x27f4be[_0x5056('0x30')]=_[_0x5056('0x31')](_0x113be0['query']);_0x27f4be[_0x5056('0x32')]=_[_0x5056('0x33')](_0x27f4be['model'],_0x27f4be[_0x5056('0x30')]);_0x482939[_0x5056('0x34')]=_[_0x5056('0x33')](_0x27f4be[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x113be0[_0x5056('0x30')][_0x5056('0x35')]));_0x482939[_0x5056('0x34')]=_0x482939[_0x5056('0x34')][_0x5056('0x36')]?_0x482939[_0x5056('0x34')]:_0x27f4be[_0x5056('0x2f')];if(!_0x113be0[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x482939['limit']=qs[_0x5056('0x1d')](_0x113be0['query'][_0x5056('0x1d')]);_0x482939[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x113be0[_0x5056('0x30')]['offset']);}_0x482939[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x113be0['query'][_0x5056('0x3a')]);_0x482939['where']=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x113be0[_0x5056('0x30')],_0x27f4be['filters']),_0x9e2986);if(_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]){_0x482939[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x482939[_0x5056('0x3d')],{'$or':_[_0x5056('0x29')](_0x9e2986,function(_0x1aa311){if(_0x1aa311[_0x5056('0x2d')]!==_0x5056('0x3f')){var _0x430db0={};_0x430db0[_0x1aa311[_0x5056('0x28')]]={'$like':'%'+_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]+'%'};return _0x430db0;}})});}_0x482939=_[_0x5056('0x3e')]({},_0x482939,_0x113be0[_0x5056('0x40')]);var _0x351ebd={'where':_0x482939['where']};return db['VoiceMail'][_0x5056('0x1f')](_0x351ebd)[_0x5056('0x23')](function(_0x6946b4){_0x2c5728[_0x5056('0x1f')]=_0x6946b4;if(_0x113be0[_0x5056('0x30')][_0x5056('0x41')]){_0x482939[_0x5056('0x42')]=[{'all':!![]}];}return db[_0x5056('0x2a')]['findAll'](_0x482939);})['then'](function(_0x68a385){_0x2c5728[_0x5056('0x43')]=_0x68a385;return _0x2c5728;})[_0x5056('0x23')](respondWithFilteredResult(_0x252f75,_0x482939))['catch'](handleError(_0x252f75,null));};exports[_0x5056('0x44')]=function(_0x5b99e9,_0x285fee){var _0x40375b={'raw':!![],'where':{'id':_0x5b99e9[_0x5056('0x45')]['id']}},_0x2ef93e={};_0x2ef93e[_0x5056('0x2f')]=_[_0x5056('0x31')](db['VoiceMail'][_0x5056('0x2b')]);_0x2ef93e[_0x5056('0x30')]=_[_0x5056('0x31')](_0x5b99e9['query']);_0x2ef93e['filters']=_['intersection'](_0x2ef93e['model'],_0x2ef93e[_0x5056('0x30')]);_0x40375b[_0x5056('0x34')]=_[_0x5056('0x33')](_0x2ef93e[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x5b99e9['query']['fields']));_0x40375b[_0x5056('0x34')]=_0x40375b[_0x5056('0x34')][_0x5056('0x36')]?_0x40375b[_0x5056('0x34')]:_0x2ef93e[_0x5056('0x2f')];if(_0x5b99e9[_0x5056('0x30')][_0x5056('0x41')]){_0x40375b['include']=[{'all':!![]}];}_0x40375b=_['merge']({},_0x40375b,_0x5b99e9[_0x5056('0x40')]);return db[_0x5056('0x2a')]['find'](_0x40375b)[_0x5056('0x23')](handleEntityNotFound(_0x285fee,null))[_0x5056('0x23')](respondWithResult(_0x285fee,null))['catch'](handleError(_0x285fee,null));};exports['create']=function(_0x83d8e4,_0x1ab1a9){return db['VoiceMail']['create'](_0x83d8e4[_0x5056('0x46')],{})[_0x5056('0x23')](function(_0x528575){var _0x5c3f73=_0x83d8e4[_0x5056('0x47')][_0x5056('0x48')]({'plain':!![]});if(!_0x5c3f73)throw new Error(_0x5056('0x49'));if(_0x5c3f73[_0x5056('0x4a')]===_0x5056('0x47')){var _0xdf427c=_0x528575[_0x5056('0x48')]({'plain':!![]});var _0x366ba2=_0x5056('0x25');return db[_0x5056('0x4b')][_0x5056('0x4c')]({'where':{'name':_0x366ba2,'userProfileId':_0x5c3f73[_0x5056('0x4d')]},'raw':!![]})[_0x5056('0x23')](function(_0x327821){if(_0x327821&&_0x327821[_0x5056('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf427c[_0x5056('0x28')],'resourceId':_0xdf427c['id'],'type':_0x327821[_0x5056('0x28')],'sectionId':_0x327821['id']},{})[_0x5056('0x23')](function(){return _0x528575;});}else{return _0x528575;}})[_0x5056('0x4f')](function(_0x35776b){logger[_0x5056('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35776b);throw _0x35776b;});}return _0x528575;})[_0x5056('0x23')](respondWithResult(_0x1ab1a9,0xc9))[_0x5056('0x4f')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x51')]=function(_0x3d22cc,_0x1ff74a){if(_0x3d22cc[_0x5056('0x46')]['id']){delete _0x3d22cc[_0x5056('0x46')]['id'];}return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x3d22cc[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x1ff74a,null))[_0x5056('0x23')](saveUpdates(_0x3d22cc[_0x5056('0x46')],null))['then'](respondWithResult(_0x1ff74a,null))[_0x5056('0x4f')](handleError(_0x1ff74a,null));};exports[_0x5056('0x24')]=function(_0x2df8e8,_0x5363fd){return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x2df8e8[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x5363fd,null))['then'](removeEntity(_0x5363fd,null))['catch'](handleError(_0x5363fd,null));};exports['getMessages']=function(_0x427007,_0x55ae24,_0x1934e1){return db[_0x5056('0x2a')][_0x5056('0x52')]({'where':{'id':_0x427007[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x55ae24,null))[_0x5056('0x23')](function(_0x5330b4){var _0x48568b;var _0x25da13={},_0x333d22={};_0x333d22['model']=_[_0x5056('0x31')](db[_0x5056('0x53')][_0x5056('0x2b')]);_0x333d22[_0x5056('0x30')]=_[_0x5056('0x31')](_0x427007['query']);_0x333d22[_0x5056('0x32')]=_[_0x5056('0x33')](_0x333d22['model'],_0x333d22[_0x5056('0x30')]);_0x25da13[_0x5056('0x34')]=_[_0x5056('0x33')](_0x333d22[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x427007[_0x5056('0x30')][_0x5056('0x35')]));_0x25da13[_0x5056('0x34')]=_0x25da13[_0x5056('0x34')][_0x5056('0x36')]?_0x25da13[_0x5056('0x34')]:_0x333d22[_0x5056('0x2f')];if(!_0x427007[_0x5056('0x30')]['hasOwnProperty'](_0x5056('0x38'))){_0x25da13[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x427007[_0x5056('0x30')][_0x5056('0x1d')]);_0x25da13[_0x5056('0x1c')]=qs['offset'](_0x427007[_0x5056('0x30')]['offset']);}_0x25da13[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x427007['query']['sort']);_0x25da13[_0x5056('0x3d')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x427007[_0x5056('0x30')],_0x333d22['filters']));if(_0x427007['query'][_0x5056('0x3c')]){_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13['where'],{'$or':_[_0x5056('0x29')](_0x25da13['attributes'],function(_0x57cb62){var _0x1bfae9={};_0x1bfae9[_0x57cb62]={'$like':'%'+_0x427007[_0x5056('0x30')]['filter']+'%'};return _0x1bfae9;})});}_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13[_0x5056('0x3d')],{'mailboxuser':_0x5330b4[_0x5056('0x54')]});_0x25da13=_[_0x5056('0x3e')]({},_0x25da13,_0x427007[_0x5056('0x40')]);return db[_0x5056('0x53')]['findAndCountAll'](_0x25da13)[_0x5056('0x23')](respondWithFilteredResult(_0x55ae24,_0x25da13));})[_0x5056('0x4f')](handleError(_0x55ae24,null));}; \ No newline at end of file +var _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dacf7,_0x538753){var _0x2b01a6=function(_0x140db5){while(--_0x140db5){_0x3dacf7['push'](_0x3dacf7['shift']());}};_0x2b01a6(++_0x538753);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x38ae49,_0x544243){_0x38ae49=_0x38ae49-0x0;var _0xe77ddc=_0x9ffd[_0x38ae49];return _0xe77ddc;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index dc7ae5a..8a0b1e4 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 _0xe788=['request-promise','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','../../config/logger','api','bluebird'];(function(_0x2176b1,_0x5d535d){var _0x58cd62=function(_0x330b30){while(--_0x330b30){_0x2176b1['push'](_0x2176b1['shift']());}};_0x58cd62(++_0x5d535d);}(_0xe788,0x64));var _0x8e78=function(_0x23173b,_0x861f47){_0x23173b=_0x23173b-0x0;var _0x437a43=_0xe788[_0x23173b];return _0x437a43;};'use strict';var _=require(_0x8e78('0x0'));var util=require('util');var logger=require(_0x8e78('0x1'))(_0x8e78('0x2'));var moment=require('moment');var BPromise=require(_0x8e78('0x3'));var rp=require(_0x8e78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e78('0x5'));var config=require(_0x8e78('0x6'));var attributes=require(_0x8e78('0x7'));module['exports']=function(_0x5c616d,_0x44295a){return _0x5c616d[_0x8e78('0x8')](_0x8e78('0x9'),attributes,{'tableName':_0x8e78('0xa'),'paranoid':![],'indexes':[{'name':_0x8e78('0xb'),'fields':[_0x8e78('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1163=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger'];(function(_0xffea60,_0xea178d){var _0x137ec1=function(_0x3b5f7b){while(--_0x3b5f7b){_0xffea60['push'](_0xffea60['shift']());}};_0x137ec1(++_0xea178d);}(_0x1163,0xb4));var _0x3116=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x1163[_0x3eb450];return _0x2c4cfd;};'use strict';var _=require('lodash');var util=require(_0x3116('0x0'));var logger=require(_0x3116('0x1'))(_0x3116('0x2'));var moment=require(_0x3116('0x3'));var BPromise=require(_0x3116('0x4'));var rp=require(_0x3116('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3116('0x6'));var config=require(_0x3116('0x7'));var attributes=require('./voiceMail.attributes');module[_0x3116('0x8')]=function(_0x5d82e5,_0x3df76c){return _0x5d82e5[_0x3116('0x9')]('VoiceMail',attributes,{'tableName':_0x3116('0xa'),'paranoid':![],'indexes':[{'name':_0x3116('0xb'),'fields':[_0x3116('0xc'),_0x3116('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 259a9e3..ccdb0b4 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 _0x6532=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x6532,0x15f));var _0x2653=function(_0x4a5cce,_0x34265f){_0x4a5cce=_0x4a5cce-0x0;var _0x347252=_0x6532[_0x4a5cce];return _0x347252;};'use strict';var _=require(_0x2653('0x0'));var util=require(_0x2653('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2653('0x2'));var fs=require('fs');var Redis=require(_0x2653('0x3'));var db=require(_0x2653('0x4'))['db'];var utils=require(_0x2653('0x5'));var logger=require(_0x2653('0x6'))(_0x2653('0x7'));var config=require(_0x2653('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2653('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dd275,_0xc46682,_0x4c64bb){return new BPromise(function(_0x138a0c,_0x46163e){return client[_0x2653('0xa')](_0x1dd275,_0x4c64bb)[_0x2653('0xb')](function(_0x58c431){logger[_0x2653('0xc')](_0x2653('0xd'),_0xc46682,_0x2653('0xe'));logger[_0x2653('0xf')](_0x2653('0x10'),_0xc46682,_0x2653('0xe'),JSON['stringify'](_0x58c431));if(_0x58c431[_0x2653('0x11')]){if(_0x58c431['error'][_0x2653('0x12')]===0x1f4){logger[_0x2653('0x11')]('VoiceMail,\x20%s,\x20%s',_0xc46682,_0x58c431[_0x2653('0x11')]['message']);return _0x46163e(_0x58c431[_0x2653('0x11')][_0x2653('0x13')]);}logger[_0x2653('0x11')](_0x2653('0xd'),_0xc46682,_0x58c431[_0x2653('0x11')]['message']);return _0x138a0c(_0x58c431[_0x2653('0x11')]['message']);}else{logger[_0x2653('0xc')](_0x2653('0xd'),_0xc46682,_0x2653('0xe'));_0x138a0c(_0x58c431[_0x2653('0x14')][_0x2653('0x13')]);}})[_0x2653('0x15')](function(_0x1bd299){logger[_0x2653('0x11')](_0x2653('0xd'),_0xc46682,_0x1bd299);_0x46163e(_0x1bd299);});});} \ No newline at end of file +var _0x1d65=['VoiceMail,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55e6c0,_0x4cd562){var _0x343775=function(_0x40186e){while(--_0x40186e){_0x55e6c0['push'](_0x55e6c0['shift']());}};_0x343775(++_0x4cd562);}(_0x1d65,0x15d));var _0x51d6=function(_0x1e9140,_0x44060d){_0x1e9140=_0x1e9140-0x0;var _0xf84e09=_0x1d65[_0x1e9140];return _0xf84e09;};'use strict';var _=require('lodash');var util=require(_0x51d6('0x0'));var moment=require(_0x51d6('0x1'));var BPromise=require(_0x51d6('0x2'));var rs=require(_0x51d6('0x3'));var fs=require('fs');var Redis=require(_0x51d6('0x4'));var db=require(_0x51d6('0x5'))['db'];var utils=require(_0x51d6('0x6'));var logger=require(_0x51d6('0x7'))('rpc');var config=require(_0x51d6('0x8'));var jayson=require(_0x51d6('0x9'));var client=jayson[_0x51d6('0xa')][_0x51d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6190e7,_0x13f9b9,_0x22fa2e){return new BPromise(function(_0x8eb536,_0x52bdf9){return client[_0x51d6('0xc')](_0x6190e7,_0x22fa2e)[_0x51d6('0xd')](function(_0x4d8786){logger['info']('VoiceMail,\x20%s,\x20%s',_0x13f9b9,_0x51d6('0xe'));logger[_0x51d6('0xf')](_0x51d6('0x10'),_0x13f9b9,_0x51d6('0xe'),JSON[_0x51d6('0x11')](_0x4d8786));if(_0x4d8786[_0x51d6('0x12')]){if(_0x4d8786['error']['code']===0x1f4){logger[_0x51d6('0x12')]('VoiceMail,\x20%s,\x20%s',_0x13f9b9,_0x4d8786['error']['message']);return _0x52bdf9(_0x4d8786[_0x51d6('0x12')]['message']);}logger[_0x51d6('0x12')](_0x51d6('0x13'),_0x13f9b9,_0x4d8786[_0x51d6('0x12')]['message']);return _0x8eb536(_0x4d8786[_0x51d6('0x12')][_0x51d6('0x14')]);}else{logger['info'](_0x51d6('0x13'),_0x13f9b9,_0x51d6('0xe'));_0x8eb536(_0x4d8786[_0x51d6('0x15')][_0x51d6('0x14')]);}})[_0x51d6('0x16')](function(_0x413a21){logger['error'](_0x51d6('0x13'),_0x13f9b9,_0x413a21);_0x52bdf9(_0x413a21);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 93599ef..de82837 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 _0x2cdf=['put','update','delete','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x4fccad,_0x3447af){var _0x9646ea=function(_0xde4e5f){while(--_0xde4e5f){_0x4fccad['push'](_0x4fccad['shift']());}};_0x9646ea(++_0x3447af);}(_0x2cdf,0xc1));var _0xf2cd=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2cdf[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0xf2cd('0x0'));var util=require(_0xf2cd('0x1'));var path=require(_0xf2cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2cd('0x3'));var router=express[_0xf2cd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf2cd('0x5'));var config=require(_0xf2cd('0x6'));var controller=require(_0xf2cd('0x7'));router[_0xf2cd('0x8')]('/',auth[_0xf2cd('0x9')](),controller[_0xf2cd('0xa')]);router[_0xf2cd('0x8')](_0xf2cd('0xb'),auth[_0xf2cd('0x9')](),controller[_0xf2cd('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf2cd('0xd')]);router[_0xf2cd('0xe')]('/',auth[_0xf2cd('0x9')](),controller[_0xf2cd('0xf')]);router[_0xf2cd('0x10')](_0xf2cd('0xb'),auth[_0xf2cd('0x9')](),controller[_0xf2cd('0x11')]);router[_0xf2cd('0x12')]('/:id',auth[_0xf2cd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3da7=['show','/:id/download','download','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x23d2bf,_0x1b1f6a){var _0x48ad94=function(_0x16d30e){while(--_0x16d30e){_0x23d2bf['push'](_0x23d2bf['shift']());}};_0x48ad94(++_0x1b1f6a);}(_0x3da7,0x181));var _0x73da=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3da7[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x73da('0x0'));var util=require(_0x73da('0x1'));var path=require(_0x73da('0x2'));var timeout=require(_0x73da('0x3'));var express=require(_0x73da('0x4'));var router=express['Router']();var fs_extra=require(_0x73da('0x5'));var auth=require(_0x73da('0x6'));var interaction=require(_0x73da('0x7'));var config=require(_0x73da('0x8'));var controller=require(_0x73da('0x9'));router[_0x73da('0xa')]('/',auth[_0x73da('0xb')](),controller[_0x73da('0xc')]);router[_0x73da('0xa')](_0x73da('0xd'),auth[_0x73da('0xb')](),controller[_0x73da('0xe')]);router[_0x73da('0xa')](_0x73da('0xf'),auth['isAuthenticated'](),controller[_0x73da('0x10')]);router['post']('/',auth[_0x73da('0xb')](),controller['create']);router[_0x73da('0x11')](_0x73da('0xd'),auth[_0x73da('0xb')](),controller[_0x73da('0x12')]);router[_0x73da('0x13')](_0x73da('0xd'),auth[_0x73da('0xb')](),controller[_0x73da('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index dbeaf87..2d5380e 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 _0x191d=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x3165b3,_0x11688c){var _0x5ba829=function(_0x1a7e3d){while(--_0x1a7e3d){_0x3165b3['push'](_0x3165b3['shift']());}};_0x5ba829(++_0x11688c);}(_0x191d,0x1d8));var _0xd191=function(_0x285edf,_0x434efc){_0x285edf=_0x285edf-0x0;var _0x5403e1=_0x191d[_0x285edf];return _0x5403e1;};'use strict';var Sequelize=require(_0xd191('0x0'));module[_0xd191('0x1')]={'name':{'type':Sequelize[_0xd191('0x2')],'get':function(_0x2242a3){return this[_0xd191('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xd191('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xd191('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xd191('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd191('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd191('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd191('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xd191('0x6')](_0xd191('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd191('0x8'),'defaultValue':Sequelize[_0xd191('0x9')](_0xd191('0xa'))}}; \ No newline at end of file +var _0x50ba=['literal','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x14e8c2,_0x5760ed){var _0x503465=function(_0x3d795c){while(--_0x3d795c){_0x14e8c2['push'](_0x14e8c2['shift']());}};_0x503465(++_0x5760ed);}(_0x50ba,0x1c8));var _0xa50b=function(_0x169f86,_0xadf81f){_0x169f86=_0x169f86-0x0;var _0x30cced=_0x50ba[_0x169f86];return _0x30cced;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x49dde9){return this[_0xa50b('0x0')]('id');}},'msgnum':{'type':Sequelize[_0xa50b('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa50b('0x3')](_0xa50b('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':''},'stamp':{'type':_0xa50b('0x5'),'defaultValue':Sequelize[_0xa50b('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index bd134e4..c244d69 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 _0xb5bd=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','map','VoiceMailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb5bd,0x96));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdb5b('0x0'));var rimraf=require(_0xdb5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb5b('0x2'));var rp=require(_0xdb5b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdb5b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdb5b('0x5'));var csv=require(_0xdb5b('0x6'));var ejs=require(_0xdb5b('0x7'));var fs=require('fs');var fs_extra=require(_0xdb5b('0x8'));var _=require(_0xdb5b('0x9'));var squel=require(_0xdb5b('0xa'));var crypto=require('crypto');var jsforce=require(_0xdb5b('0xb'));var deskjs=require(_0xdb5b('0xc'));var toCsv=require(_0xdb5b('0x6'));var querystring=require(_0xdb5b('0xd'));var Papa=require(_0xdb5b('0xe'));var Redis=require('ioredis');var authService=require(_0xdb5b('0xf'));var qs=require(_0xdb5b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb5b('0x11'));var logger=require(_0xdb5b('0x12'))(_0xdb5b('0x13'));var utils=require(_0xdb5b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb5b('0x15'));var db=require(_0xdb5b('0x16'))['db'];function respondWithStatusCode(_0xaba59b,_0x46ff9b){_0x46ff9b=_0x46ff9b||0xcc;return function(_0x2d5fc0){if(_0x2d5fc0){return _0xaba59b['sendStatus'](_0x46ff9b);}return _0xaba59b[_0xdb5b('0x17')](_0x46ff9b)[_0xdb5b('0x18')]();};}function respondWithResult(_0x552b31,_0x372a07){_0x372a07=_0x372a07||0xc8;return function(_0x4ea943){if(_0x4ea943){return _0x552b31['status'](_0x372a07)[_0xdb5b('0x19')](_0x4ea943);}};}function respondWithFilteredResult(_0x1752c9,_0x773390){return function(_0x34264c){if(_0x34264c){var _0xe1d88b=typeof _0x773390[_0xdb5b('0x1a')]===_0xdb5b('0x1b')&&typeof _0x773390['limit']===_0xdb5b('0x1b');var _0x51a295=_0x34264c[_0xdb5b('0x1c')];var _0x536d3a=_0xe1d88b?0x0:_0x773390[_0xdb5b('0x1a')];var _0x51443b=_0xe1d88b?_0x34264c[_0xdb5b('0x1c')]:_0x773390['offset']+_0x773390[_0xdb5b('0x1d')];var _0x32e0f9;if(_0x51443b>=_0x51a295){_0x51443b=_0x51a295;_0x32e0f9=0xc8;}else{_0x32e0f9=0xce;}_0x1752c9[_0xdb5b('0x17')](_0x32e0f9);return _0x1752c9[_0xdb5b('0x1e')](_0xdb5b('0x1f'),_0x536d3a+'-'+_0x51443b+'/'+_0x51a295)[_0xdb5b('0x19')](_0x34264c);}return null;};}function patchUpdates(_0x525e23){return function(_0x1e4e6a){try{jsonpatch[_0xdb5b('0x20')](_0x1e4e6a,_0x525e23,!![]);}catch(_0x2f5174){return BPromise[_0xdb5b('0x21')](_0x2f5174);}return _0x1e4e6a[_0xdb5b('0x22')]();};}function saveUpdates(_0x43677f,_0x347606){return function(_0x3ae221){if(_0x3ae221){return _0x3ae221[_0xdb5b('0x23')](_0x43677f)[_0xdb5b('0x24')](function(_0x151a87){return _0x151a87;});}return null;};}function removeEntity(_0x32626b,_0xee3058){return function(_0x5cb2da){if(_0x5cb2da){return _0x5cb2da[_0xdb5b('0x25')]()[_0xdb5b('0x24')](function(){_0x32626b[_0xdb5b('0x17')](0xcc)[_0xdb5b('0x18')]();});}};}function handleEntityNotFound(_0x587fcf,_0x1da9ca){return function(_0x2db17b){if(!_0x2db17b){_0x587fcf[_0xdb5b('0x26')](0x194);}return _0x2db17b;};}function handleError(_0xb69148,_0x1403a7){_0x1403a7=_0x1403a7||0x1f4;return function(_0x154077){logger['error'](_0x154077['stack']);if(_0x154077[_0xdb5b('0x27')]){delete _0x154077[_0xdb5b('0x27')];}_0xb69148[_0xdb5b('0x17')](_0x1403a7)[_0xdb5b('0x28')](_0x154077);};}exports['index']=function(_0x313f56,_0x2bae79){var _0x3e997f={},_0x425706={},_0x55ef3d={'count':0x0,'rows':[]};var _0x30a60b=_[_0xdb5b('0x29')](db[_0xdb5b('0x2a')][_0xdb5b('0x2b')],function(_0x51fc4){return{'name':_0x51fc4['fieldName'],'type':_0x51fc4[_0xdb5b('0x2c')][_0xdb5b('0x2d')]};});_0x425706[_0xdb5b('0x2e')]=_['differenceBy'](_[_0xdb5b('0x29')](_0x30a60b,_0xdb5b('0x27')),['name']);_0x425706[_0xdb5b('0x2f')]=_[_0xdb5b('0x30')](_0x313f56[_0xdb5b('0x2f')]);_0x425706[_0xdb5b('0x31')]=_['intersection'](_0x425706[_0xdb5b('0x2e')],_0x425706[_0xdb5b('0x2f')]);_0x3e997f['attributes']=_[_0xdb5b('0x32')](_0x425706[_0xdb5b('0x2e')],qs[_0xdb5b('0x33')](_0x313f56['query'][_0xdb5b('0x33')]));_0x3e997f[_0xdb5b('0x34')]=_0x3e997f[_0xdb5b('0x34')][_0xdb5b('0x35')]?_0x3e997f[_0xdb5b('0x34')]:_0x425706[_0xdb5b('0x2e')];if(!_0x313f56[_0xdb5b('0x2f')]['hasOwnProperty']('nolimit')){_0x3e997f[_0xdb5b('0x1d')]=qs[_0xdb5b('0x1d')](_0x313f56['query'][_0xdb5b('0x1d')]);_0x3e997f[_0xdb5b('0x1a')]=qs['offset'](_0x313f56[_0xdb5b('0x2f')][_0xdb5b('0x1a')]);}_0x3e997f[_0xdb5b('0x36')]=qs[_0xdb5b('0x37')](_0x313f56[_0xdb5b('0x2f')][_0xdb5b('0x37')]);_0x3e997f['where']=qs[_0xdb5b('0x31')](_['pick'](_0x313f56['query'],_0x425706[_0xdb5b('0x31')]),_0x30a60b);if(_0x313f56[_0xdb5b('0x2f')][_0xdb5b('0x38')]){_0x3e997f[_0xdb5b('0x39')]=_[_0xdb5b('0x3a')](_0x3e997f[_0xdb5b('0x39')],{'$or':_[_0xdb5b('0x29')](_0x30a60b,function(_0x246038){if(_0x246038['type']!==_0xdb5b('0x3b')){var _0x711b9={};_0x711b9[_0x246038['name']]={'$like':'%'+_0x313f56['query'][_0xdb5b('0x38')]+'%'};return _0x711b9;}})});}_0x3e997f=_[_0xdb5b('0x3a')]({},_0x3e997f,_0x313f56[_0xdb5b('0x3c')]);var _0x316328={'where':_0x3e997f[_0xdb5b('0x39')]};return db[_0xdb5b('0x2a')]['count'](_0x316328)[_0xdb5b('0x24')](function(_0xa2a37){_0x55ef3d[_0xdb5b('0x1c')]=_0xa2a37;if(_0x313f56['query'][_0xdb5b('0x3d')]){_0x3e997f[_0xdb5b('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xdb5b('0x3f')](_0x3e997f);})[_0xdb5b('0x24')](function(_0x25821d){_0x55ef3d[_0xdb5b('0x40')]=_0x25821d;return _0x55ef3d;})[_0xdb5b('0x24')](respondWithFilteredResult(_0x2bae79,_0x3e997f))[_0xdb5b('0x41')](handleError(_0x2bae79,null));};exports[_0xdb5b('0x42')]=function(_0x35a466,_0x293383){var _0x2ac968={'raw':!![],'where':{'id':_0x35a466[_0xdb5b('0x43')]['id']}},_0x3ac96c={};_0x3ac96c['model']=_[_0xdb5b('0x30')](db[_0xdb5b('0x2a')][_0xdb5b('0x2b')]);_0x3ac96c['query']=_['keys'](_0x35a466[_0xdb5b('0x2f')]);_0x3ac96c[_0xdb5b('0x31')]=_[_0xdb5b('0x32')](_0x3ac96c['model'],_0x3ac96c[_0xdb5b('0x2f')]);_0x2ac968[_0xdb5b('0x34')]=_[_0xdb5b('0x32')](_0x3ac96c['model'],qs[_0xdb5b('0x33')](_0x35a466[_0xdb5b('0x2f')][_0xdb5b('0x33')]));_0x2ac968[_0xdb5b('0x34')]=_0x2ac968['attributes'][_0xdb5b('0x35')]?_0x2ac968[_0xdb5b('0x34')]:_0x3ac96c[_0xdb5b('0x2e')];if(_0x35a466['query'][_0xdb5b('0x3d')]){_0x2ac968['include']=[{'all':!![]}];}_0x2ac968=_[_0xdb5b('0x3a')]({},_0x2ac968,_0x35a466[_0xdb5b('0x3c')]);return db[_0xdb5b('0x2a')][_0xdb5b('0x44')](_0x2ac968)[_0xdb5b('0x24')](handleEntityNotFound(_0x293383,null))['then'](respondWithResult(_0x293383,null))['catch'](handleError(_0x293383,null));};exports['create']=function(_0x384650,_0x2019a4){return db[_0xdb5b('0x2a')][_0xdb5b('0x45')](_0x384650[_0xdb5b('0x46')],{})[_0xdb5b('0x24')](respondWithResult(_0x2019a4,0xc9))[_0xdb5b('0x41')](handleError(_0x2019a4,null));};exports[_0xdb5b('0x23')]=function(_0x51da53,_0x11c2e0){if(_0x51da53[_0xdb5b('0x46')]['id']){delete _0x51da53['body']['id'];}return db[_0xdb5b('0x2a')][_0xdb5b('0x44')]({'where':{'id':_0x51da53['params']['id']}})[_0xdb5b('0x24')](handleEntityNotFound(_0x11c2e0,null))[_0xdb5b('0x24')](saveUpdates(_0x51da53[_0xdb5b('0x46')],null))[_0xdb5b('0x24')](respondWithResult(_0x11c2e0,null))['catch'](handleError(_0x11c2e0,null));};exports[_0xdb5b('0x25')]=function(_0x58adab,_0x4704c4){return db[_0xdb5b('0x2a')]['find']({'where':{'id':_0x58adab[_0xdb5b('0x43')]['id']}})[_0xdb5b('0x24')](handleEntityNotFound(_0x4704c4,null))['then'](removeEntity(_0x4704c4,null))[_0xdb5b('0x41')](handleError(_0x4704c4,null));};exports['download']=function(_0x3d64d9,_0x22c92b,_0x10d4cf){return db[_0xdb5b('0x2a')]['find']({'where':{'id':_0x3d64d9[_0xdb5b('0x43')]['id']},'attributes':['id',_0xdb5b('0x47'),'msg_id']})['then'](handleEntityNotFound(_0x22c92b,null))[_0xdb5b('0x24')](function(_0x57a8ec){if(_0x57a8ec){if(!_0x57a8ec[_0xdb5b('0x47')]){throw new db[(_0xdb5b('0x48'))][(_0xdb5b('0x49'))](_0xdb5b('0x4a'));}var _0x1fa8d7={'Content-Type':_0xdb5b('0x4b'),'Content-Disposition':_0xdb5b('0x4c')};if(_0x57a8ec[_0xdb5b('0x4d')]){_0x1fa8d7[_0xdb5b('0x4e')]=_0xdb5b('0x4f')+_0x57a8ec[_0xdb5b('0x4d')]+_0xdb5b('0x50');}_0x22c92b['set'](_0x1fa8d7);return _0x22c92b[_0xdb5b('0x28')](new Buffer(_0x57a8ec[_0xdb5b('0x47')]));}})[_0xdb5b('0x41')](handleError(_0x22c92b,null));}; \ No newline at end of file +var _0xfe4e=['attachment;\x20filename=\x22','.wav\x22','send','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','index','map','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','rows','catch','params','VoiceMailMessage','rawAttributes','includeAll','include','find','create','body','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment'];(function(_0x5f1669,_0x54ed18){var _0x29a800=function(_0x27b3b5){while(--_0x27b3b5){_0x5f1669['push'](_0x5f1669['shift']());}};_0x29a800(++_0x54ed18);}(_0xfe4e,0x1ac));var _0xefe4=function(_0x58c48d,_0x1a2ce1){_0x58c48d=_0x58c48d-0x0;var _0x451050=_0xfe4e[_0x58c48d];return _0x451050;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefe4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefe4('0x1'));var rp=require(_0xefe4('0x2'));var moment=require('moment');var BPromise=require(_0xefe4('0x3'));var Mustache=require(_0xefe4('0x4'));var util=require(_0xefe4('0x5'));var path=require(_0xefe4('0x6'));var sox=require(_0xefe4('0x7'));var csv=require(_0xefe4('0x8'));var ejs=require(_0xefe4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xefe4('0xa'));var crypto=require(_0xefe4('0xb'));var jsforce=require(_0xefe4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xefe4('0x8'));var querystring=require(_0xefe4('0xd'));var Papa=require('papaparse');var Redis=require(_0xefe4('0xe'));var authService=require(_0xefe4('0xf'));var qs=require(_0xefe4('0x10'));var as=require(_0xefe4('0x11'));var hardwareService=require(_0xefe4('0x12'));var logger=require('../../config/logger')(_0xefe4('0x13'));var utils=require(_0xefe4('0x14'));var config=require(_0xefe4('0x15'));var licenseUtil=require(_0xefe4('0x16'));var db=require(_0xefe4('0x17'))['db'];function respondWithStatusCode(_0x3c0dbc,_0x2cde8e){_0x2cde8e=_0x2cde8e||0xcc;return function(_0x23c662){if(_0x23c662){return _0x3c0dbc[_0xefe4('0x18')](_0x2cde8e);}return _0x3c0dbc[_0xefe4('0x19')](_0x2cde8e)[_0xefe4('0x1a')]();};}function respondWithResult(_0x59d161,_0x148d8a){_0x148d8a=_0x148d8a||0xc8;return function(_0x6df94a){if(_0x6df94a){return _0x59d161[_0xefe4('0x19')](_0x148d8a)[_0xefe4('0x1b')](_0x6df94a);}};}function respondWithFilteredResult(_0x4059e7,_0x4030c0){return function(_0x575c05){if(_0x575c05){var _0x14e055=typeof _0x4030c0[_0xefe4('0x1c')]===_0xefe4('0x1d')&&typeof _0x4030c0[_0xefe4('0x1e')]==='undefined';var _0x124f0f=_0x575c05[_0xefe4('0x1f')];var _0x104b53=_0x14e055?0x0:_0x4030c0['offset'];var _0x131515=_0x14e055?_0x575c05['count']:_0x4030c0['offset']+_0x4030c0[_0xefe4('0x1e')];var _0x1a7069;if(_0x131515>=_0x124f0f){_0x131515=_0x124f0f;_0x1a7069=0xc8;}else{_0x1a7069=0xce;}_0x4059e7[_0xefe4('0x19')](_0x1a7069);return _0x4059e7[_0xefe4('0x20')]('Content-Range',_0x104b53+'-'+_0x131515+'/'+_0x124f0f)[_0xefe4('0x1b')](_0x575c05);}return null;};}function patchUpdates(_0x5f4b48){return function(_0x42dbee){try{jsonpatch[_0xefe4('0x21')](_0x42dbee,_0x5f4b48,!![]);}catch(_0xb82804){return BPromise['reject'](_0xb82804);}return _0x42dbee['save']();};}function saveUpdates(_0x1ce7ab,_0xeb3db5){return function(_0x58323c){if(_0x58323c){return _0x58323c[_0xefe4('0x22')](_0x1ce7ab)[_0xefe4('0x23')](function(_0x2cd64a){return _0x2cd64a;});}return null;};}function removeEntity(_0x513736,_0x4dcdc4){return function(_0x4cb686){if(_0x4cb686){return _0x4cb686['destroy']()[_0xefe4('0x23')](function(){_0x513736[_0xefe4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9ab9,_0x3f958d){return function(_0x373300){if(!_0x373300){_0x2f9ab9[_0xefe4('0x18')](0x194);}return _0x373300;};}function handleError(_0x32bc9b,_0x269b1e){_0x269b1e=_0x269b1e||0x1f4;return function(_0x30c282){logger[_0xefe4('0x24')](_0x30c282[_0xefe4('0x25')]);if(_0x30c282[_0xefe4('0x26')]){delete _0x30c282['name'];}_0x32bc9b[_0xefe4('0x19')](_0x269b1e)['send'](_0x30c282);};}exports[_0xefe4('0x27')]=function(_0x42877f,_0xf949e1){var _0x531a4a={},_0x2efca2={},_0x2034e8={'count':0x0,'rows':[]};var _0x41964d=_[_0xefe4('0x28')](db['VoiceMailMessage']['rawAttributes'],function(_0x421528){return{'name':_0x421528[_0xefe4('0x29')],'type':_0x421528[_0xefe4('0x2a')][_0xefe4('0x2b')]};});_0x2efca2[_0xefe4('0x2c')]=_[_0xefe4('0x2d')](_[_0xefe4('0x28')](_0x41964d,_0xefe4('0x26')),['name']);_0x2efca2['query']=_[_0xefe4('0x2e')](_0x42877f[_0xefe4('0x2f')]);_0x2efca2[_0xefe4('0x30')]=_[_0xefe4('0x31')](_0x2efca2[_0xefe4('0x2c')],_0x2efca2[_0xefe4('0x2f')]);_0x531a4a['attributes']=_[_0xefe4('0x31')](_0x2efca2[_0xefe4('0x2c')],qs[_0xefe4('0x32')](_0x42877f[_0xefe4('0x2f')][_0xefe4('0x32')]));_0x531a4a[_0xefe4('0x33')]=_0x531a4a[_0xefe4('0x33')][_0xefe4('0x34')]?_0x531a4a[_0xefe4('0x33')]:_0x2efca2['model'];if(!_0x42877f['query'][_0xefe4('0x35')](_0xefe4('0x36'))){_0x531a4a[_0xefe4('0x1e')]=qs[_0xefe4('0x1e')](_0x42877f[_0xefe4('0x2f')]['limit']);_0x531a4a[_0xefe4('0x1c')]=qs[_0xefe4('0x1c')](_0x42877f[_0xefe4('0x2f')][_0xefe4('0x1c')]);}_0x531a4a[_0xefe4('0x37')]=qs[_0xefe4('0x38')](_0x42877f[_0xefe4('0x2f')]['sort']);_0x531a4a['where']=qs['filters'](_[_0xefe4('0x39')](_0x42877f[_0xefe4('0x2f')],_0x2efca2[_0xefe4('0x30')]),_0x41964d);if(_0x42877f[_0xefe4('0x2f')]['filter']){_0x531a4a[_0xefe4('0x3a')]=_[_0xefe4('0x3b')](_0x531a4a['where'],{'$or':_[_0xefe4('0x28')](_0x41964d,function(_0x5f2a60){if(_0x5f2a60[_0xefe4('0x2a')]!==_0xefe4('0x3c')){var _0x1eeb56={};_0x1eeb56[_0x5f2a60[_0xefe4('0x26')]]={'$like':'%'+_0x42877f[_0xefe4('0x2f')][_0xefe4('0x3d')]+'%'};return _0x1eeb56;}})});}_0x531a4a=_[_0xefe4('0x3b')]({},_0x531a4a,_0x42877f[_0xefe4('0x3e')]);var _0x17d0b6={'where':_0x531a4a[_0xefe4('0x3a')]};return db['VoiceMailMessage'][_0xefe4('0x1f')](_0x17d0b6)['then'](function(_0x1c5cd1){_0x2034e8[_0xefe4('0x1f')]=_0x1c5cd1;if(_0x42877f['query']['includeAll']){_0x531a4a['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x531a4a);})['then'](function(_0xa88532){_0x2034e8[_0xefe4('0x3f')]=_0xa88532;return _0x2034e8;})[_0xefe4('0x23')](respondWithFilteredResult(_0xf949e1,_0x531a4a))[_0xefe4('0x40')](handleError(_0xf949e1,null));};exports['show']=function(_0xd6dfc9,_0x51756f){var _0x82be26={'raw':!![],'where':{'id':_0xd6dfc9[_0xefe4('0x41')]['id']}},_0x5b8dec={};_0x5b8dec[_0xefe4('0x2c')]=_[_0xefe4('0x2e')](db[_0xefe4('0x42')][_0xefe4('0x43')]);_0x5b8dec[_0xefe4('0x2f')]=_[_0xefe4('0x2e')](_0xd6dfc9[_0xefe4('0x2f')]);_0x5b8dec[_0xefe4('0x30')]=_[_0xefe4('0x31')](_0x5b8dec[_0xefe4('0x2c')],_0x5b8dec[_0xefe4('0x2f')]);_0x82be26['attributes']=_[_0xefe4('0x31')](_0x5b8dec[_0xefe4('0x2c')],qs[_0xefe4('0x32')](_0xd6dfc9[_0xefe4('0x2f')][_0xefe4('0x32')]));_0x82be26[_0xefe4('0x33')]=_0x82be26[_0xefe4('0x33')][_0xefe4('0x34')]?_0x82be26['attributes']:_0x5b8dec[_0xefe4('0x2c')];if(_0xd6dfc9[_0xefe4('0x2f')][_0xefe4('0x44')]){_0x82be26[_0xefe4('0x45')]=[{'all':!![]}];}_0x82be26=_[_0xefe4('0x3b')]({},_0x82be26,_0xd6dfc9[_0xefe4('0x3e')]);return db[_0xefe4('0x42')][_0xefe4('0x46')](_0x82be26)[_0xefe4('0x23')](handleEntityNotFound(_0x51756f,null))[_0xefe4('0x23')](respondWithResult(_0x51756f,null))[_0xefe4('0x40')](handleError(_0x51756f,null));};exports[_0xefe4('0x47')]=function(_0x5b23e6,_0x53875b){return db[_0xefe4('0x42')][_0xefe4('0x47')](_0x5b23e6[_0xefe4('0x48')],{})[_0xefe4('0x23')](respondWithResult(_0x53875b,0xc9))['catch'](handleError(_0x53875b,null));};exports[_0xefe4('0x22')]=function(_0x2efe78,_0xb38463){if(_0x2efe78[_0xefe4('0x48')]['id']){delete _0x2efe78['body']['id'];}return db[_0xefe4('0x42')][_0xefe4('0x46')]({'where':{'id':_0x2efe78[_0xefe4('0x41')]['id']}})['then'](handleEntityNotFound(_0xb38463,null))['then'](saveUpdates(_0x2efe78[_0xefe4('0x48')],null))[_0xefe4('0x23')](respondWithResult(_0xb38463,null))[_0xefe4('0x40')](handleError(_0xb38463,null));};exports[_0xefe4('0x49')]=function(_0x170f5f,_0x3ec59f){return db[_0xefe4('0x42')]['find']({'where':{'id':_0x170f5f[_0xefe4('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ec59f,null))[_0xefe4('0x23')](removeEntity(_0x3ec59f,null))[_0xefe4('0x40')](handleError(_0x3ec59f,null));};exports[_0xefe4('0x4a')]=function(_0x347c54,_0x5c0f0b,_0x399ab7){return db['VoiceMailMessage'][_0xefe4('0x46')]({'where':{'id':_0x347c54['params']['id']},'attributes':['id','recording',_0xefe4('0x4b')]})[_0xefe4('0x23')](handleEntityNotFound(_0x5c0f0b,null))[_0xefe4('0x23')](function(_0x528edd){if(_0x528edd){if(!_0x528edd[_0xefe4('0x4c')]){throw new db[(_0xefe4('0x4d'))][(_0xefe4('0x4e'))](_0xefe4('0x4f'));}var _0x3cb655={'Content-Type':_0xefe4('0x50'),'Content-Disposition':_0xefe4('0x51')};if(_0x528edd[_0xefe4('0x4b')]){_0x3cb655['Content-Disposition']=_0xefe4('0x52')+_0x528edd['msg_id']+_0xefe4('0x53');}_0x5c0f0b[_0xefe4('0x20')](_0x3cb655);return _0x5c0f0b[_0xefe4('0x54')](new Buffer(_0x528edd[_0xefe4('0x4c')]));}})[_0xefe4('0x40')](handleError(_0x5c0f0b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4425df3..ba6bede 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 _0xdd9f=['../../config/environment','exports','define','voice_voicemail_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x280aa3,_0x52cb30){var _0xace5e5=function(_0x2e45f7){while(--_0x2e45f7){_0x280aa3['push'](_0x280aa3['shift']());}};_0xace5e5(++_0x52cb30);}(_0xdd9f,0x1a8));var _0xfdd9=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xdd9f[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xfdd9('0x0'));var util=require(_0xfdd9('0x1'));var logger=require(_0xfdd9('0x2'))(_0xfdd9('0x3'));var moment=require(_0xfdd9('0x4'));var BPromise=require(_0xfdd9('0x5'));var rp=require(_0xfdd9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdd9('0x7'));var config=require(_0xfdd9('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xfdd9('0x9')]=function(_0x50508f,_0x174bd0){return _0x50508f[_0xfdd9('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xfdd9('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x2231=['./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x2231,0x9b));var _0x1223=function(_0x5537e6,_0xddf3dc){_0x5537e6=_0x5537e6-0x0;var _0x44115a=_0x2231[_0x5537e6];return _0x44115a;};'use strict';var _=require('lodash');var util=require(_0x1223('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1223('0x1'));var rp=require(_0x1223('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1223('0x3'));var config=require(_0x1223('0x4'));var attributes=require(_0x1223('0x5'));module[_0x1223('0x6')]=function(_0x2a355f,_0x53a9f5){return _0x2a355f['define'](_0x1223('0x7'),attributes,{'tableName':_0x1223('0x8'),'paranoid':![],'indexes':[{'name':_0x1223('0x9'),'fields':[_0x1223('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 51a1df1..eb3994d 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 _0x1ccd=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','ioredis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1ccd,0x9c));var _0xd1cc=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x1ccd[_0x254d9f];return _0x1eedb9;};'use strict';var _=require(_0xd1cc('0x0'));var util=require(_0xd1cc('0x1'));var moment=require('moment');var BPromise=require(_0xd1cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1cc('0x4'));var logger=require(_0xd1cc('0x5'))('rpc');var config=require(_0xd1cc('0x6'));var jayson=require(_0xd1cc('0x7'));var client=jayson[_0xd1cc('0x8')][_0xd1cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x99cefa,_0x13eb35,_0x368d51){return new BPromise(function(_0xccf27c,_0xb8bd42){return client[_0xd1cc('0xa')](_0x99cefa,_0x368d51)['then'](function(_0x10dc25){logger[_0xd1cc('0xb')](_0xd1cc('0xc'),_0x13eb35,_0xd1cc('0xd'));logger[_0xd1cc('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x13eb35,_0xd1cc('0xd'),JSON[_0xd1cc('0xf')](_0x10dc25));if(_0x10dc25['error']){if(_0x10dc25[_0xd1cc('0x10')][_0xd1cc('0x11')]===0x1f4){logger[_0xd1cc('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x13eb35,_0x10dc25[_0xd1cc('0x10')][_0xd1cc('0x12')]);return _0xb8bd42(_0x10dc25[_0xd1cc('0x10')][_0xd1cc('0x12')]);}logger[_0xd1cc('0x10')](_0xd1cc('0xc'),_0x13eb35,_0x10dc25['error'][_0xd1cc('0x12')]);return _0xccf27c(_0x10dc25['error'][_0xd1cc('0x12')]);}else{logger[_0xd1cc('0xb')](_0xd1cc('0xc'),_0x13eb35,'request\x20sent');_0xccf27c(_0x10dc25[_0xd1cc('0x13')][_0xd1cc('0x12')]);}})['catch'](function(_0x1e84a8){logger[_0xd1cc('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x13eb35,_0x1e84a8);_0xb8bd42(_0x1e84a8);});});} \ No newline at end of file +var _0x5cd4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x55d852,_0x2bdf2d){var _0x50e811=function(_0x3f2ad3){while(--_0x3f2ad3){_0x55d852['push'](_0x55d852['shift']());}};_0x50e811(++_0x2bdf2d);}(_0x5cd4,0x89));var _0x45cd=function(_0x3039b8,_0x350f8f){_0x3039b8=_0x3039b8-0x0;var _0x1fbdc3=_0x5cd4[_0x3039b8];return _0x1fbdc3;};'use strict';var _=require(_0x45cd('0x0'));var util=require(_0x45cd('0x1'));var moment=require('moment');var BPromise=require(_0x45cd('0x2'));var rs=require(_0x45cd('0x3'));var fs=require('fs');var Redis=require(_0x45cd('0x4'));var db=require(_0x45cd('0x5'))['db'];var utils=require(_0x45cd('0x6'));var logger=require(_0x45cd('0x7'))(_0x45cd('0x8'));var config=require(_0x45cd('0x9'));var jayson=require(_0x45cd('0xa'));var client=jayson[_0x45cd('0xb')][_0x45cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x487242,_0xbddd8,_0x1cac71){return new BPromise(function(_0x204257,_0x22292c){return client['request'](_0x487242,_0x1cac71)[_0x45cd('0xd')](function(_0x176185){logger[_0x45cd('0xe')](_0x45cd('0xf'),_0xbddd8,_0x45cd('0x10'));logger[_0x45cd('0x11')](_0x45cd('0x12'),_0xbddd8,'request\x20sent',JSON[_0x45cd('0x13')](_0x176185));if(_0x176185[_0x45cd('0x14')]){if(_0x176185[_0x45cd('0x14')][_0x45cd('0x15')]===0x1f4){logger['error'](_0x45cd('0xf'),_0xbddd8,_0x176185['error'][_0x45cd('0x16')]);return _0x22292c(_0x176185[_0x45cd('0x14')][_0x45cd('0x16')]);}logger['error'](_0x45cd('0xf'),_0xbddd8,_0x176185[_0x45cd('0x14')]['message']);return _0x204257(_0x176185['error'][_0x45cd('0x16')]);}else{logger[_0x45cd('0xe')](_0x45cd('0xf'),_0xbddd8,_0x45cd('0x10'));_0x204257(_0x176185['result'][_0x45cd('0x16')]);}})[_0x45cd('0x17')](function(_0x309448){logger[_0x45cd('0x14')](_0x45cd('0xf'),_0xbddd8,_0x309448);_0x22292c(_0x309448);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5fe38d7..9d9ac2b 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 _0x753c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','create','post','update','delete','destroy','/:id/sounds/:id2','removeSound','multer'];(function(_0x1ebc3a,_0x4cf08a){var _0x12d4dc=function(_0x22312b){while(--_0x22312b){_0x1ebc3a['push'](_0x1ebc3a['shift']());}};_0x12d4dc(++_0x4cf08a);}(_0x753c,0xce));var _0xc753=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x753c[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xc753('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc753('0x1'));var express=require(_0xc753('0x2'));var router=express[_0xc753('0x3')]();var fs_extra=require(_0xc753('0x4'));var auth=require(_0xc753('0x5'));var interaction=require(_0xc753('0x6'));var config=require(_0xc753('0x7'));var controller=require(_0xc753('0x8'));router[_0xc753('0x9')]('/',auth['isAuthenticated'](),controller[_0xc753('0xa')]);router[_0xc753('0x9')](_0xc753('0xb'),auth[_0xc753('0xc')](),controller[_0xc753('0xd')]);router['get'](_0xc753('0xe'),auth['isAuthenticated'](),controller[_0xc753('0xf')]);router['post']('/',auth[_0xc753('0xc')](),controller[_0xc753('0x10')]);router[_0xc753('0x11')](_0xc753('0xe'),auth[_0xc753('0xc')](),controller['addSound']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc753('0x12')]);router[_0xc753('0x13')](_0xc753('0xb'),auth['isAuthenticated'](),controller[_0xc753('0x14')]);router[_0xc753('0x13')](_0xc753('0x15'),auth['isAuthenticated'](),controller[_0xc753('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4b15=['put','update','delete','destroy','/:id/sounds/:id2','removeSound','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','getSounds','create','post','/:id/sounds'];(function(_0x2b5e25,_0x1396a7){var _0x1df0d3=function(_0x1b774b){while(--_0x1b774b){_0x2b5e25['push'](_0x2b5e25['shift']());}};_0x1df0d3(++_0x1396a7);}(_0x4b15,0x1e9));var _0x54b1=function(_0x34bbf0,_0x22cf51){_0x34bbf0=_0x34bbf0-0x0;var _0x2d1e12=_0x4b15[_0x34bbf0];return _0x2d1e12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x54b1('0x0'));var timeout=require(_0x54b1('0x1'));var express=require('express');var router=express[_0x54b1('0x2')]();var fs_extra=require(_0x54b1('0x3'));var auth=require(_0x54b1('0x4'));var interaction=require(_0x54b1('0x5'));var config=require(_0x54b1('0x6'));var controller=require(_0x54b1('0x7'));router[_0x54b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x54b1('0x9')]);router[_0x54b1('0x8')](_0x54b1('0xa'),auth[_0x54b1('0xb')](),controller[_0x54b1('0xc')]);router[_0x54b1('0x8')]('/:id/sounds',auth[_0x54b1('0xb')](),controller[_0x54b1('0xd')]);router['post']('/',auth[_0x54b1('0xb')](),controller[_0x54b1('0xe')]);router[_0x54b1('0xf')](_0x54b1('0x10'),auth[_0x54b1('0xb')](),controller['addSound']);router[_0x54b1('0x11')]('/:id',auth[_0x54b1('0xb')](),controller[_0x54b1('0x12')]);router[_0x54b1('0x13')](_0x54b1('0xa'),auth[_0x54b1('0xb')](),controller[_0x54b1('0x14')]);router[_0x54b1('0x13')](_0x54b1('0x15'),auth['isAuthenticated'](),controller[_0x54b1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 84ea57b..a81a132 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 _0x54e6=['mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','quietmp3nb','quietmp3'];(function(_0x12c4ea,_0x39fde7){var _0x1b96c6=function(_0x2de1b6){while(--_0x2de1b6){_0x12c4ea['push'](_0x12c4ea['shift']());}};_0x1b96c6(++_0x39fde7);}(_0x54e6,0x1f2));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x654e('0x0'));module[_0x654e('0x1')]={'name':{'type':Sequelize[_0x654e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x654e('0x3')](_0x654e('0x4'),_0x654e('0x5'),'mp3nb',_0x654e('0x6'),_0x654e('0x7'),_0x654e('0x8')),'allowNull':!![],'defaultValue':_0x654e('0x5')},'directory':{'type':Sequelize[_0x654e('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x654e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x654e('0x2')],'allowNull':!![]},'stamp':{'type':_0x654e('0x9')},'defaultEntry':{'type':Sequelize[_0x654e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x41d4=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM'];(function(_0x122886,_0x11ecaa){var _0x5e8e4f=function(_0x1ead07){while(--_0x1ead07){_0x122886['push'](_0x122886['shift']());}};_0x5e8e4f(++_0x11ecaa);}(_0x41d4,0xcc));var _0x441d=function(_0x4250fa,_0x47f2ff){_0x4250fa=_0x4250fa-0x0;var _0x592c36=_0x41d4[_0x4250fa];return _0x592c36;};'use strict';var Sequelize=require(_0x441d('0x0'));module['exports']={'name':{'type':Sequelize[_0x441d('0x1')],'allowNull':![],'unique':_0x441d('0x2')},'mode':{'type':Sequelize[_0x441d('0x3')]('custom','files','mp3nb','quietmp3nb','quietmp3',_0x441d('0x4')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x441d('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x441d('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x441d('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x441d('0x1')],'allowNull':!![],'defaultValue':_0x441d('0x5')},'format':{'type':Sequelize[_0x441d('0x1')],'allowNull':!![]},'stamp':{'type':_0x441d('0x6')},'defaultEntry':{'type':Sequelize[_0x441d('0x7')],'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 bd377dd..672b69d 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 _0x4e93=['transaction','mode','files','directory','root','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','ValidationError','message','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize','removeSound','id2','getSounds','eml-format','rimraf','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','get','MusicOnHolds','UserProfileResource','destroy','then','end','error','stack','VoiceMusicOnHold','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','params','fields','find','update','body','create'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4e93,0x92));var _0x34e9=function(_0x3bc022,_0x398082){_0x3bc022=_0x3bc022-0x0;var _0x4a19c6=_0x4e93[_0x3bc022];return _0x4a19c6;};'use strict';var emlformat=require(_0x34e9('0x0'));var rimraf=require(_0x34e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34e9('0x2'));var rp=require(_0x34e9('0x3'));var moment=require('moment');var BPromise=require(_0x34e9('0x4'));var Mustache=require(_0x34e9('0x5'));var util=require(_0x34e9('0x6'));var path=require(_0x34e9('0x7'));var sox=require(_0x34e9('0x8'));var csv=require(_0x34e9('0x9'));var ejs=require(_0x34e9('0xa'));var fs=require('fs');var fs_extra=require(_0x34e9('0xb'));var _=require(_0x34e9('0xc'));var squel=require(_0x34e9('0xd'));var crypto=require(_0x34e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x34e9('0xf'));var toCsv=require(_0x34e9('0x9'));var querystring=require(_0x34e9('0x10'));var Papa=require(_0x34e9('0x11'));var Redis=require('ioredis');var authService=require(_0x34e9('0x12'));var qs=require(_0x34e9('0x13'));var as=require(_0x34e9('0x14'));var hardwareService=require(_0x34e9('0x15'));var logger=require(_0x34e9('0x16'))(_0x34e9('0x17'));var utils=require(_0x34e9('0x18'));var config=require(_0x34e9('0x19'));var licenseUtil=require(_0x34e9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499dca,_0x21b0a1){_0x21b0a1=_0x21b0a1||0xcc;return function(_0x13c7e1){if(_0x13c7e1){return _0x499dca[_0x34e9('0x1b')](_0x21b0a1);}return _0x499dca[_0x34e9('0x1c')](_0x21b0a1)['end']();};}function respondWithResult(_0x53dff2,_0x5868e2){_0x5868e2=_0x5868e2||0xc8;return function(_0x4d62fa){if(_0x4d62fa){return _0x53dff2['status'](_0x5868e2)['json'](_0x4d62fa);}};}function respondWithFilteredResult(_0x503cb3,_0x3acc7f){return function(_0x3ed172){if(_0x3ed172){var _0x1904eb=typeof _0x3acc7f[_0x34e9('0x1d')]===_0x34e9('0x1e')&&typeof _0x3acc7f[_0x34e9('0x1f')]===_0x34e9('0x1e');var _0x537092=_0x3ed172[_0x34e9('0x20')];var _0x94a3ac=_0x1904eb?0x0:_0x3acc7f[_0x34e9('0x1d')];var _0x49f7bc=_0x1904eb?_0x3ed172[_0x34e9('0x20')]:_0x3acc7f[_0x34e9('0x1d')]+_0x3acc7f[_0x34e9('0x1f')];var _0x5d4cd2;if(_0x49f7bc>=_0x537092){_0x49f7bc=_0x537092;_0x5d4cd2=0xc8;}else{_0x5d4cd2=0xce;}_0x503cb3['status'](_0x5d4cd2);return _0x503cb3[_0x34e9('0x21')](_0x34e9('0x22'),_0x94a3ac+'-'+_0x49f7bc+'/'+_0x537092)[_0x34e9('0x23')](_0x3ed172);}return null;};}function patchUpdates(_0x5783e4){return function(_0x4b5ea9){try{jsonpatch[_0x34e9('0x24')](_0x4b5ea9,_0x5783e4,!![]);}catch(_0x275a34){return BPromise[_0x34e9('0x25')](_0x275a34);}return _0x4b5ea9[_0x34e9('0x26')]();};}function saveUpdates(_0x565206,_0x193773){return function(_0xfc3ff1){if(_0xfc3ff1){return _0xfc3ff1['update'](_0x565206)['then'](function(_0x38d4d0){return _0x38d4d0;});}return null;};}function removeEntity(_0x33a0aa,_0x24ee87){return function(_0x22974f){if(_0x22974f){return _0x22974f['destroy']()['then'](function(){var _0x593376=_0x22974f[_0x34e9('0x27')]({'plain':!![]});var _0x1decb5=_0x34e9('0x28');return db[_0x34e9('0x29')][_0x34e9('0x2a')]({'where':{'type':_0x1decb5,'resourceId':_0x593376['id']}})[_0x34e9('0x2b')](function(){return _0x22974f;});})[_0x34e9('0x2b')](function(){_0x33a0aa[_0x34e9('0x1c')](0xcc)[_0x34e9('0x2c')]();});}};}function handleEntityNotFound(_0x214dd8,_0x575c22){return function(_0x14f2d6){if(!_0x14f2d6){_0x214dd8[_0x34e9('0x1b')](0x194);}return _0x14f2d6;};}function handleError(_0x260d74,_0x3f1cbe){_0x3f1cbe=_0x3f1cbe||0x1f4;return function(_0x1963ea){logger[_0x34e9('0x2d')](_0x1963ea[_0x34e9('0x2e')]);if(_0x1963ea['name']){delete _0x1963ea['name'];}_0x260d74[_0x34e9('0x1c')](_0x3f1cbe)['send'](_0x1963ea);};}exports['index']=function(_0x4f369d,_0x246d83){var _0x277062={},_0x2f438f={},_0x42d558={'count':0x0,'rows':[]};var _0x42c61e=_['map'](db[_0x34e9('0x2f')][_0x34e9('0x30')],function(_0x5cce68){return{'name':_0x5cce68[_0x34e9('0x31')],'type':_0x5cce68[_0x34e9('0x32')]['key']};});_0x2f438f[_0x34e9('0x33')]=_['map'](_0x42c61e,_0x34e9('0x34'));_0x2f438f['query']=_[_0x34e9('0x35')](_0x4f369d[_0x34e9('0x36')]);_0x2f438f['filters']=_[_0x34e9('0x37')](_0x2f438f['model'],_0x2f438f[_0x34e9('0x36')]);_0x277062['attributes']=_[_0x34e9('0x37')](_0x2f438f['model'],qs['fields'](_0x4f369d[_0x34e9('0x36')]['fields']));_0x277062[_0x34e9('0x38')]=_0x277062[_0x34e9('0x38')][_0x34e9('0x39')]?_0x277062[_0x34e9('0x38')]:_0x2f438f[_0x34e9('0x33')];if(!_0x4f369d['query'][_0x34e9('0x3a')](_0x34e9('0x3b'))){_0x277062[_0x34e9('0x1f')]=qs['limit'](_0x4f369d['query'][_0x34e9('0x1f')]);_0x277062[_0x34e9('0x1d')]=qs[_0x34e9('0x1d')](_0x4f369d[_0x34e9('0x36')][_0x34e9('0x1d')]);}_0x277062[_0x34e9('0x3c')]=qs[_0x34e9('0x3d')](_0x4f369d[_0x34e9('0x36')]['sort']);delete _0x4f369d[_0x34e9('0x36')][_0x34e9('0x3d')];_0x277062[_0x34e9('0x3e')]=qs[_0x34e9('0x3f')](_[_0x34e9('0x40')](_0x4f369d[_0x34e9('0x36')],_0x2f438f[_0x34e9('0x3f')]),_0x42c61e);if(_0x4f369d['query']['filter']){_0x277062[_0x34e9('0x3e')]=_[_0x34e9('0x41')](_0x277062[_0x34e9('0x3e')],{'$or':_[_0x34e9('0x42')](_0x42c61e,function(_0x5b53db){if(_0x5b53db[_0x34e9('0x32')]!==_0x34e9('0x43')){var _0x414239={};_0x414239[_0x5b53db[_0x34e9('0x34')]]={'$like':'%'+_0x4f369d[_0x34e9('0x36')][_0x34e9('0x44')]+'%'};return _0x414239;}})});}_0x277062=_[_0x34e9('0x41')]({},_0x277062,_0x4f369d[_0x34e9('0x45')]);var _0x4734cf={'where':_0x277062['where']};return db[_0x34e9('0x2f')]['count'](_0x4734cf)[_0x34e9('0x2b')](function(_0x2889bb){_0x42d558[_0x34e9('0x20')]=_0x2889bb;if(_0x4f369d['query']['includeAll']){_0x277062[_0x34e9('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x34e9('0x47')](_0x277062);})[_0x34e9('0x2b')](function(_0x30d210){_0x42d558[_0x34e9('0x48')]=_0x30d210;return _0x42d558;})[_0x34e9('0x2b')](respondWithFilteredResult(_0x246d83,_0x277062))[_0x34e9('0x49')](handleError(_0x246d83,null));};exports['show']=function(_0x376bd1,_0x4e74af){var _0x36ca3b={'raw':![],'where':{'id':_0x376bd1[_0x34e9('0x4a')]['id']}},_0x2c17b={};_0x2c17b['model']=_[_0x34e9('0x35')](db['VoiceMusicOnHold'][_0x34e9('0x30')]);_0x2c17b[_0x34e9('0x36')]=_[_0x34e9('0x35')](_0x376bd1[_0x34e9('0x36')]);_0x2c17b[_0x34e9('0x3f')]=_[_0x34e9('0x37')](_0x2c17b[_0x34e9('0x33')],_0x2c17b[_0x34e9('0x36')]);_0x36ca3b[_0x34e9('0x38')]=_['intersection'](_0x2c17b['model'],qs[_0x34e9('0x4b')](_0x376bd1['query'][_0x34e9('0x4b')]));_0x36ca3b['attributes']=_0x36ca3b[_0x34e9('0x38')]['length']?_0x36ca3b[_0x34e9('0x38')]:_0x2c17b[_0x34e9('0x33')];if(_0x376bd1['query']['includeAll']){_0x36ca3b[_0x34e9('0x46')]=[{'all':!![]}];}_0x36ca3b=_[_0x34e9('0x41')]({},_0x36ca3b,_0x376bd1[_0x34e9('0x45')]);return db[_0x34e9('0x2f')][_0x34e9('0x4c')](_0x36ca3b)[_0x34e9('0x2b')](handleEntityNotFound(_0x4e74af,null))[_0x34e9('0x2b')](respondWithResult(_0x4e74af,null))[_0x34e9('0x49')](handleError(_0x4e74af,null));};exports[_0x34e9('0x4d')]=function(_0x4ee767,_0xc664a){if(_0x4ee767[_0x34e9('0x4e')]['id']){delete _0x4ee767[_0x34e9('0x4e')]['id'];}return db[_0x34e9('0x2f')][_0x34e9('0x4c')]({'where':{'id':_0x4ee767['params']['id']}})['then'](handleEntityNotFound(_0xc664a,null))['then'](saveUpdates(_0x4ee767[_0x34e9('0x4e')],null))[_0x34e9('0x2b')](respondWithResult(_0xc664a,null))['catch'](handleError(_0xc664a,null));};exports[_0x34e9('0x4f')]=function(_0x2aa1f4,_0x480720,_0x2fa256){return db['sequelize'][_0x34e9('0x50')](function(_0x12fc6d){if(_0x2aa1f4[_0x34e9('0x4e')][_0x34e9('0x51')]===_0x34e9('0x52')){_0x2aa1f4[_0x34e9('0x4e')][_0x34e9('0x53')]=path['join'](config[_0x34e9('0x54')],'server/files/moh',_0x2aa1f4['body'][_0x34e9('0x34')]);}return db[_0x34e9('0x2f')][_0x34e9('0x4f')](_0x2aa1f4[_0x34e9('0x4e')],{'transaction':_0x12fc6d})[_0x34e9('0x2b')](function(_0x105fa2){if(_0x2aa1f4[_0x34e9('0x4e')][_0x34e9('0x51')]===_0x34e9('0x52')){fs[_0x34e9('0x55')](_0x105fa2[_0x34e9('0x53')],parseInt('0777',0x8));}var _0x1e491b=_0x2aa1f4['user'][_0x34e9('0x27')]({'plain':!![]});if(!_0x1e491b)throw new Error(_0x34e9('0x56'));if(_0x1e491b[_0x34e9('0x57')]===_0x34e9('0x58')){var _0x292966=_0x105fa2[_0x34e9('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x34e9('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1e491b[_0x34e9('0x59')]},'raw':!![]})['then'](function(_0x28d38a){if(_0x28d38a&&_0x28d38a[_0x34e9('0x5a')]===0x0){return db[_0x34e9('0x29')]['create']({'name':_0x292966[_0x34e9('0x34')],'resourceId':_0x292966['id'],'type':_0x28d38a[_0x34e9('0x34')],'sectionId':_0x28d38a['id']},{})['then'](function(){return _0x105fa2;});}else{return _0x105fa2;}})[_0x34e9('0x49')](function(_0x4a3190){logger[_0x34e9('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3190);});}return _0x105fa2;});})[_0x34e9('0x2b')](respondWithResult(_0x480720,0xc9))[_0x34e9('0x49')](handleError(_0x480720,null));};exports[_0x34e9('0x2a')]=function(_0x4887c2,_0x1d81f5,_0x36c4a0){var _0x45e819;return db[_0x34e9('0x2f')]['find']({'where':{'id':_0x4887c2[_0x34e9('0x4a')]['id']}})[_0x34e9('0x2b')](function(_0x4d6bc1){if(_0x4d6bc1){return db[_0x34e9('0x5b')][_0x34e9('0x50')](function(_0xfba721){return _0x4d6bc1['destroy']({'transaction':_0xfba721,'raw':!![]})[_0x34e9('0x2b')](function(_0x513bf5){if(_0x513bf5[_0x34e9('0x53')]){fs[_0x34e9('0x5c')](_0x513bf5['directory'])[_0x34e9('0x5d')](function(_0xadd66d){fs[_0x34e9('0x5e')](path[_0x34e9('0x5f')](_0x513bf5[_0x34e9('0x53')],_0xadd66d));});fs['rmdirSync'](_0x513bf5[_0x34e9('0x53')]);}return _0x513bf5;});})[_0x34e9('0x49')](function(_0x2fc73c){throw new db['Sequelize'][(_0x34e9('0x60'))](_0x2fc73c[_0x34e9('0x61')]);});}})['then'](handleEntityNotFound(_0x1d81f5,null))[_0x34e9('0x2b')](removeEntity(_0x1d81f5,null))[_0x34e9('0x49')](handleError(_0x1d81f5,null));};exports['addSound']=function(_0x4f0db1,_0x343412,_0x1eac11){return db[_0x34e9('0x5b')]['transaction'](function(_0x3eff59){var _0x4082d3;return db[_0x34e9('0x2f')][_0x34e9('0x4c')]({'where':{'id':_0x4f0db1[_0x34e9('0x4a')]['id']}})[_0x34e9('0x2b')](function(_0x4e2088){if(_0x4e2088){_0x4082d3=_0x4e2088;return _0x4e2088['addSound'](_0x4f0db1[_0x34e9('0x4e')]['id'],{'transaction':_0x3eff59});}})[_0x34e9('0x2b')](function(_0x26b153){if(_0x26b153){return db[_0x34e9('0x62')][_0x34e9('0x63')]({'where':{'id':_0x4f0db1[_0x34e9('0x4e')]['id']},'attributes':['id',_0x34e9('0x34'),_0x34e9('0x64'),'converted_format',_0x34e9('0x65')],'raw':!![]});}})['then'](function(_0x5e1eb8){if(_0x5e1eb8){var _0x320538=path[_0x34e9('0x5f')](config[_0x34e9('0x54')],_0x34e9('0x66'),util[_0x34e9('0x67')](_0x34e9('0x68'),path[_0x34e9('0x69')](_0x5e1eb8[_0x34e9('0x64')],path[_0x34e9('0x6a')](_0x5e1eb8[_0x34e9('0x64')])),_0x5e1eb8[_0x34e9('0x6b')]));var _0x3c71d1=path['join'](config['root'],'server/files/moh',_0x4082d3['name'],util[_0x34e9('0x67')](_0x34e9('0x68'),_0x5e1eb8[_0x34e9('0x34')],_0x5e1eb8[_0x34e9('0x6b')]));fs[_0x34e9('0x6c')](_0x320538,_0x3c71d1);return _0x5e1eb8;}})['catch'](function(_0x3c2c61){throw new db[(_0x34e9('0x6d'))][(_0x34e9('0x60'))](_0x3c2c61[_0x34e9('0x61')]);});})['then'](handleEntityNotFound(_0x343412,null))[_0x34e9('0x2b')](respondWithResult(_0x343412,0xc9))[_0x34e9('0x49')](handleError(_0x343412,null));};exports[_0x34e9('0x6e')]=function(_0xf1cdde,_0x427090,_0x4834e1){return db['sequelize']['transaction'](function(_0x1cc98e){var _0xe68a80;return db['VoiceMusicOnHold'][_0x34e9('0x63')]({'where':{'id':_0xf1cdde[_0x34e9('0x4a')]['id']}})[_0x34e9('0x2b')](handleEntityNotFound(_0x427090,null))[_0x34e9('0x2b')](function(_0x249f1e){if(_0x249f1e){_0xe68a80=_0x249f1e;return _0x249f1e[_0x34e9('0x6e')](_0xf1cdde[_0x34e9('0x4a')]['id2']);}})[_0x34e9('0x2b')](function(_0x28fa2e){if(_0x28fa2e){return db[_0x34e9('0x62')]['findOne']({'where':{'id':_0xf1cdde[_0x34e9('0x4a')][_0x34e9('0x6f')]},'attributes':['id','name',_0x34e9('0x64'),'converted_format',_0x34e9('0x65')],'raw':!![]});}})[_0x34e9('0x2b')](function(_0x256589){if(_0x256589){fs[_0x34e9('0x5e')](path[_0x34e9('0x5f')](_0xe68a80[_0x34e9('0x53')],util[_0x34e9('0x67')](_0x34e9('0x68'),_0x256589[_0x34e9('0x34')],_0x256589[_0x34e9('0x6b')])));return _0x256589;}})[_0x34e9('0x49')](function(_0x5a0c22){throw new db[(_0x34e9('0x6d'))][(_0x34e9('0x60'))](_0x5a0c22[_0x34e9('0x61')]);});})[_0x34e9('0x2b')](handleEntityNotFound(_0x427090,null))[_0x34e9('0x2b')](respondWithStatusCode(_0x427090,0xcc))[_0x34e9('0x49')](handleError(_0x427090,null));};exports[_0x34e9('0x70')]=function(_0x58ead8,_0x2d631b,_0x102052){var _0x484d9f={};var _0x167ba8={};var _0x30aa88;var _0x118007;return db[_0x34e9('0x2f')][_0x34e9('0x63')]({'where':{'id':_0x58ead8[_0x34e9('0x4a')]['id']}})[_0x34e9('0x2b')](handleEntityNotFound(_0x2d631b,null))[_0x34e9('0x2b')](function(_0x5c586c){if(_0x5c586c){_0x30aa88=_0x5c586c;_0x167ba8[_0x34e9('0x33')]=_[_0x34e9('0x35')](db[_0x34e9('0x62')][_0x34e9('0x30')]);_0x167ba8[_0x34e9('0x36')]=_[_0x34e9('0x35')](_0x58ead8[_0x34e9('0x36')]);_0x167ba8[_0x34e9('0x3f')]=_[_0x34e9('0x37')](_0x167ba8[_0x34e9('0x33')],_0x167ba8[_0x34e9('0x36')]);_0x484d9f[_0x34e9('0x38')]=_['intersection'](_0x167ba8[_0x34e9('0x33')],qs[_0x34e9('0x4b')](_0x58ead8[_0x34e9('0x36')][_0x34e9('0x4b')]));_0x484d9f[_0x34e9('0x38')]=_0x484d9f[_0x34e9('0x38')][_0x34e9('0x39')]?_0x484d9f[_0x34e9('0x38')]:_0x167ba8['model'];_0x484d9f['order']=qs[_0x34e9('0x3d')](_0x58ead8[_0x34e9('0x36')]['sort']);_0x484d9f[_0x34e9('0x3e')]=qs[_0x34e9('0x3f')](_[_0x34e9('0x40')](_0x58ead8[_0x34e9('0x36')],_0x167ba8['filters']));if(_0x58ead8['query'][_0x34e9('0x44')]){_0x484d9f[_0x34e9('0x3e')]=_['merge'](_0x484d9f[_0x34e9('0x3e')],{'$or':_[_0x34e9('0x42')](_0x484d9f[_0x34e9('0x38')],function(_0x593d72){var _0x2557c2={};_0x2557c2[_0x593d72]={'$like':'%'+_0x58ead8[_0x34e9('0x36')][_0x34e9('0x44')]+'%'};return _0x2557c2;})});}_0x484d9f=_[_0x34e9('0x41')]({},_0x484d9f,_0x58ead8['options']);return _0x30aa88[_0x34e9('0x70')](_0x484d9f);}})[_0x34e9('0x2b')](function(_0x10042e){if(_0x10042e){_0x118007=_0x10042e[_0x34e9('0x39')];if(!_0x58ead8[_0x34e9('0x36')][_0x34e9('0x3a')]('nolimit')){_0x484d9f['limit']=qs[_0x34e9('0x1f')](_0x58ead8[_0x34e9('0x36')][_0x34e9('0x1f')]);_0x484d9f[_0x34e9('0x1d')]=qs[_0x34e9('0x1d')](_0x58ead8[_0x34e9('0x36')][_0x34e9('0x1d')]);}return _0x30aa88[_0x34e9('0x70')](_0x484d9f);}})['then'](function(_0x4427d7){if(_0x4427d7){return _0x4427d7?{'count':_0x118007,'rows':_0x4427d7}:null;}})[_0x34e9('0x2b')](respondWithResult(_0x2d631b,null))[_0x34e9('0x49')](handleError(_0x2d631b,null));}; \ No newline at end of file +var _0x141d=['options','includeAll','findAll','rows','catch','show','find','body','create','sequelize','transaction','mode','join','server/files/moh','files','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','directory','readdirSync','rmdirSync','ValidationError','addSound','createdAt','root','server/files/sounds/converted','basename','save_name','converted_format','format','%s.%s','symlinkSync','Sequelize','message','removeSound','findOne','id2','Sound','unlinkSync','getSounds','rawAttributes','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x16b09c,_0x330071){var _0x1bc758=function(_0x9a9685){while(--_0x9a9685){_0x16b09c['push'](_0x16b09c['shift']());}};_0x1bc758(++_0x330071);}(_0x141d,0x17f));var _0xd141=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x141d[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xd141('0x0'));var rimraf=require(_0xd141('0x1'));var zipdir=require(_0xd141('0x2'));var jsonpatch=require(_0xd141('0x3'));var rp=require(_0xd141('0x4'));var moment=require(_0xd141('0x5'));var BPromise=require(_0xd141('0x6'));var Mustache=require(_0xd141('0x7'));var util=require(_0xd141('0x8'));var path=require(_0xd141('0x9'));var sox=require('sox');var csv=require(_0xd141('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd141('0xb'));var crypto=require(_0xd141('0xc'));var jsforce=require(_0xd141('0xd'));var deskjs=require(_0xd141('0xe'));var toCsv=require(_0xd141('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd141('0xf'));var authService=require(_0xd141('0x10'));var qs=require(_0xd141('0x11'));var as=require(_0xd141('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd141('0x13'))(_0xd141('0x14'));var utils=require(_0xd141('0x15'));var config=require(_0xd141('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd141('0x17'))['db'];function respondWithStatusCode(_0x482533,_0x23bcf1){_0x23bcf1=_0x23bcf1||0xcc;return function(_0x1bfc28){if(_0x1bfc28){return _0x482533[_0xd141('0x18')](_0x23bcf1);}return _0x482533['status'](_0x23bcf1)[_0xd141('0x19')]();};}function respondWithResult(_0x3da94b,_0x1b49b9){_0x1b49b9=_0x1b49b9||0xc8;return function(_0x449a02){if(_0x449a02){return _0x3da94b[_0xd141('0x1a')](_0x1b49b9)['json'](_0x449a02);}};}function respondWithFilteredResult(_0x54be33,_0x717a8b){return function(_0x358c3e){if(_0x358c3e){var _0x9aaa9d=typeof _0x717a8b[_0xd141('0x1b')]===_0xd141('0x1c')&&typeof _0x717a8b[_0xd141('0x1d')]===_0xd141('0x1c');var _0x2181f9=_0x358c3e[_0xd141('0x1e')];var _0x3a8595=_0x9aaa9d?0x0:_0x717a8b[_0xd141('0x1b')];var _0x3d13b1=_0x9aaa9d?_0x358c3e['count']:_0x717a8b[_0xd141('0x1b')]+_0x717a8b[_0xd141('0x1d')];var _0x4daf3b;if(_0x3d13b1>=_0x2181f9){_0x3d13b1=_0x2181f9;_0x4daf3b=0xc8;}else{_0x4daf3b=0xce;}_0x54be33['status'](_0x4daf3b);return _0x54be33['set'](_0xd141('0x1f'),_0x3a8595+'-'+_0x3d13b1+'/'+_0x2181f9)['json'](_0x358c3e);}return null;};}function patchUpdates(_0x52583f){return function(_0x287ef6){try{jsonpatch['apply'](_0x287ef6,_0x52583f,!![]);}catch(_0x463400){return BPromise['reject'](_0x463400);}return _0x287ef6[_0xd141('0x20')]();};}function saveUpdates(_0x5302c9,_0x56c3f4){return function(_0x2e83dc){if(_0x2e83dc){return _0x2e83dc[_0xd141('0x21')](_0x5302c9)[_0xd141('0x22')](function(_0x710c07){return _0x710c07;});}return null;};}function removeEntity(_0x1e0142,_0x54fb87){return function(_0x59827a){if(_0x59827a){return _0x59827a[_0xd141('0x23')]()['then'](function(){var _0xb71018=_0x59827a['get']({'plain':!![]});var _0x174097=_0xd141('0x24');return db[_0xd141('0x25')][_0xd141('0x23')]({'where':{'type':_0x174097,'resourceId':_0xb71018['id']}})['then'](function(){return _0x59827a;});})['then'](function(){_0x1e0142[_0xd141('0x1a')](0xcc)[_0xd141('0x19')]();});}};}function handleEntityNotFound(_0x45b557,_0x466b84){return function(_0x84b1d1){if(!_0x84b1d1){_0x45b557[_0xd141('0x18')](0x194);}return _0x84b1d1;};}function handleError(_0x22f9a8,_0x245139){_0x245139=_0x245139||0x1f4;return function(_0x40c19e){logger[_0xd141('0x26')](_0x40c19e[_0xd141('0x27')]);if(_0x40c19e[_0xd141('0x28')]){delete _0x40c19e[_0xd141('0x28')];}_0x22f9a8['status'](_0x245139)[_0xd141('0x29')](_0x40c19e);};}exports[_0xd141('0x2a')]=function(_0x481353,_0x447b05){var _0x1d106c={},_0x211672={},_0x10dcd2={'count':0x0,'rows':[]};var _0x42d650=_[_0xd141('0x2b')](db[_0xd141('0x2c')]['rawAttributes'],function(_0x3000ae){return{'name':_0x3000ae['fieldName'],'type':_0x3000ae['type']['key']};});_0x211672[_0xd141('0x2d')]=_[_0xd141('0x2b')](_0x42d650,_0xd141('0x28'));_0x211672['query']=_[_0xd141('0x2e')](_0x481353['query']);_0x211672[_0xd141('0x2f')]=_[_0xd141('0x30')](_0x211672[_0xd141('0x2d')],_0x211672[_0xd141('0x31')]);_0x1d106c[_0xd141('0x32')]=_[_0xd141('0x30')](_0x211672['model'],qs[_0xd141('0x33')](_0x481353[_0xd141('0x31')][_0xd141('0x33')]));_0x1d106c[_0xd141('0x32')]=_0x1d106c[_0xd141('0x32')][_0xd141('0x34')]?_0x1d106c[_0xd141('0x32')]:_0x211672[_0xd141('0x2d')];if(!_0x481353[_0xd141('0x31')]['hasOwnProperty'](_0xd141('0x35'))){_0x1d106c[_0xd141('0x1d')]=qs[_0xd141('0x1d')](_0x481353[_0xd141('0x31')]['limit']);_0x1d106c['offset']=qs['offset'](_0x481353['query'][_0xd141('0x1b')]);}_0x1d106c['order']=qs[_0xd141('0x36')](_0x481353[_0xd141('0x31')][_0xd141('0x36')]);delete _0x481353['query'][_0xd141('0x36')];_0x1d106c[_0xd141('0x37')]=qs[_0xd141('0x2f')](_[_0xd141('0x38')](_0x481353[_0xd141('0x31')],_0x211672[_0xd141('0x2f')]),_0x42d650);if(_0x481353[_0xd141('0x31')][_0xd141('0x39')]){_0x1d106c[_0xd141('0x37')]=_[_0xd141('0x3a')](_0x1d106c[_0xd141('0x37')],{'$or':_[_0xd141('0x2b')](_0x42d650,function(_0x489d3b){if(_0x489d3b[_0xd141('0x3b')]!==_0xd141('0x3c')){var _0x36d4a7={};_0x36d4a7[_0x489d3b['name']]={'$like':'%'+_0x481353['query'][_0xd141('0x39')]+'%'};return _0x36d4a7;}})});}_0x1d106c=_[_0xd141('0x3a')]({},_0x1d106c,_0x481353[_0xd141('0x3d')]);var _0x133cb5={'where':_0x1d106c[_0xd141('0x37')]};return db[_0xd141('0x2c')][_0xd141('0x1e')](_0x133cb5)[_0xd141('0x22')](function(_0x34fd8a){_0x10dcd2['count']=_0x34fd8a;if(_0x481353[_0xd141('0x31')][_0xd141('0x3e')]){_0x1d106c['include']=[{'all':!![]}];}return db[_0xd141('0x2c')][_0xd141('0x3f')](_0x1d106c);})[_0xd141('0x22')](function(_0x1aa68e){_0x10dcd2[_0xd141('0x40')]=_0x1aa68e;return _0x10dcd2;})[_0xd141('0x22')](respondWithFilteredResult(_0x447b05,_0x1d106c))[_0xd141('0x41')](handleError(_0x447b05,null));};exports[_0xd141('0x42')]=function(_0x22fd33,_0x21cb8b){var _0x16d0f6={'raw':![],'where':{'id':_0x22fd33['params']['id']}},_0x3d1c71={};_0x3d1c71['model']=_[_0xd141('0x2e')](db[_0xd141('0x2c')]['rawAttributes']);_0x3d1c71[_0xd141('0x31')]=_[_0xd141('0x2e')](_0x22fd33[_0xd141('0x31')]);_0x3d1c71[_0xd141('0x2f')]=_[_0xd141('0x30')](_0x3d1c71['model'],_0x3d1c71[_0xd141('0x31')]);_0x16d0f6['attributes']=_[_0xd141('0x30')](_0x3d1c71['model'],qs[_0xd141('0x33')](_0x22fd33[_0xd141('0x31')][_0xd141('0x33')]));_0x16d0f6[_0xd141('0x32')]=_0x16d0f6[_0xd141('0x32')][_0xd141('0x34')]?_0x16d0f6[_0xd141('0x32')]:_0x3d1c71[_0xd141('0x2d')];if(_0x22fd33[_0xd141('0x31')]['includeAll']){_0x16d0f6['include']=[{'all':!![]}];}_0x16d0f6=_[_0xd141('0x3a')]({},_0x16d0f6,_0x22fd33[_0xd141('0x3d')]);return db[_0xd141('0x2c')][_0xd141('0x43')](_0x16d0f6)['then'](handleEntityNotFound(_0x21cb8b,null))[_0xd141('0x22')](respondWithResult(_0x21cb8b,null))[_0xd141('0x41')](handleError(_0x21cb8b,null));};exports[_0xd141('0x21')]=function(_0x6995cb,_0x17f4fe){if(_0x6995cb[_0xd141('0x44')]['id']){delete _0x6995cb[_0xd141('0x44')]['id'];}return db['VoiceMusicOnHold'][_0xd141('0x43')]({'where':{'id':_0x6995cb['params']['id']}})[_0xd141('0x22')](handleEntityNotFound(_0x17f4fe,null))[_0xd141('0x22')](saveUpdates(_0x6995cb['body'],null))['then'](respondWithResult(_0x17f4fe,null))[_0xd141('0x41')](handleError(_0x17f4fe,null));};exports[_0xd141('0x45')]=function(_0x5a4c68,_0x444c4e,_0x23a91f){return db[_0xd141('0x46')][_0xd141('0x47')](function(_0x4a3918){if(_0x5a4c68['body'][_0xd141('0x48')]==='files'){_0x5a4c68['body']['directory']=path[_0xd141('0x49')](config['root'],_0xd141('0x4a'),_0x5a4c68['body'][_0xd141('0x28')]);}return db[_0xd141('0x2c')][_0xd141('0x45')](_0x5a4c68[_0xd141('0x44')],{'transaction':_0x4a3918})[_0xd141('0x22')](function(_0x20f41a){if(_0x5a4c68[_0xd141('0x44')]['mode']===_0xd141('0x4b')){fs[_0xd141('0x4c')](_0x20f41a['directory'],parseInt(_0xd141('0x4d'),0x8));}var _0x1a1d95=_0x5a4c68['user'][_0xd141('0x4e')]({'plain':!![]});if(!_0x1a1d95)throw new Error(_0xd141('0x4f'));if(_0x1a1d95[_0xd141('0x50')]==='user'){var _0x14ec97=_0x20f41a[_0xd141('0x4e')]({'plain':!![]});return db[_0xd141('0x51')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x1a1d95[_0xd141('0x52')]},'raw':!![]})[_0xd141('0x22')](function(_0x29e6ea){if(_0x29e6ea&&_0x29e6ea[_0xd141('0x53')]===0x0){return db[_0xd141('0x25')]['create']({'name':_0x14ec97[_0xd141('0x28')],'resourceId':_0x14ec97['id'],'type':_0x29e6ea[_0xd141('0x28')],'sectionId':_0x29e6ea['id']},{})['then'](function(){return _0x20f41a;});}else{return _0x20f41a;}})['catch'](function(_0x37191c){logger['error'](_0xd141('0x54'),_0x37191c);});}return _0x20f41a;});})[_0xd141('0x22')](respondWithResult(_0x444c4e,0xc9))[_0xd141('0x41')](handleError(_0x444c4e,null));};exports['destroy']=function(_0x2ff7bb,_0xcce320,_0xfddefc){var _0x4a4bb6;return db[_0xd141('0x2c')][_0xd141('0x43')]({'where':{'id':_0x2ff7bb[_0xd141('0x55')]['id']}})[_0xd141('0x22')](function(_0x1a62ae){if(_0x1a62ae){return db[_0xd141('0x46')]['transaction'](function(_0x164287){return _0x1a62ae['destroy']({'transaction':_0x164287,'raw':!![]})[_0xd141('0x22')](function(_0x47d4a1){if(_0x47d4a1[_0xd141('0x56')]){fs[_0xd141('0x57')](_0x47d4a1[_0xd141('0x56')])['forEach'](function(_0x1593df){fs['unlinkSync'](path['join'](_0x47d4a1[_0xd141('0x56')],_0x1593df));});fs[_0xd141('0x58')](_0x47d4a1[_0xd141('0x56')]);}return _0x47d4a1;});})['catch'](function(_0x1c03d4){throw new db['Sequelize'][(_0xd141('0x59'))](_0x1c03d4['message']);});}})[_0xd141('0x22')](handleEntityNotFound(_0xcce320,null))[_0xd141('0x22')](removeEntity(_0xcce320,null))['catch'](handleError(_0xcce320,null));};exports[_0xd141('0x5a')]=function(_0x3df252,_0x48a49a,_0x349009){return db[_0xd141('0x46')][_0xd141('0x47')](function(_0x55d76d){var _0x56cd6c;return db[_0xd141('0x2c')][_0xd141('0x43')]({'where':{'id':_0x3df252['params']['id']}})['then'](function(_0x3e50da){if(_0x3e50da){_0x56cd6c=_0x3e50da;return _0x3e50da[_0xd141('0x5a')](_0x3df252[_0xd141('0x44')]['id'],{'transaction':_0x55d76d});}})[_0xd141('0x22')](function(_0xbca677){if(_0xbca677){return db['Sound']['findOne']({'where':{'id':_0x3df252[_0xd141('0x44')]['id']},'attributes':['id',_0xd141('0x28'),'save_name','converted_format',_0xd141('0x5b')],'raw':!![]});}})[_0xd141('0x22')](function(_0x164cb0){if(_0x164cb0){var _0x1117fb=path['join'](config[_0xd141('0x5c')],_0xd141('0x5d'),util['format']('%s.%s',path[_0xd141('0x5e')](_0x164cb0['save_name'],path['extname'](_0x164cb0[_0xd141('0x5f')])),_0x164cb0[_0xd141('0x60')]));var _0x189d54=path[_0xd141('0x49')](config['root'],_0xd141('0x4a'),_0x56cd6c[_0xd141('0x28')],util[_0xd141('0x61')](_0xd141('0x62'),_0x164cb0[_0xd141('0x28')],_0x164cb0[_0xd141('0x60')]));fs[_0xd141('0x63')](_0x1117fb,_0x189d54);return _0x164cb0;}})['catch'](function(_0x418192){throw new db[(_0xd141('0x64'))][(_0xd141('0x59'))](_0x418192[_0xd141('0x65')]);});})[_0xd141('0x22')](handleEntityNotFound(_0x48a49a,null))[_0xd141('0x22')](respondWithResult(_0x48a49a,0xc9))['catch'](handleError(_0x48a49a,null));};exports[_0xd141('0x66')]=function(_0x47bb97,_0x45f7f1,_0x3e0bf5){return db[_0xd141('0x46')]['transaction'](function(_0x87172){var _0x5ed9d4;return db['VoiceMusicOnHold'][_0xd141('0x67')]({'where':{'id':_0x47bb97[_0xd141('0x55')]['id']}})[_0xd141('0x22')](handleEntityNotFound(_0x45f7f1,null))['then'](function(_0xf8aaa){if(_0xf8aaa){_0x5ed9d4=_0xf8aaa;return _0xf8aaa[_0xd141('0x66')](_0x47bb97['params'][_0xd141('0x68')]);}})[_0xd141('0x22')](function(_0x376143){if(_0x376143){return db[_0xd141('0x69')][_0xd141('0x67')]({'where':{'id':_0x47bb97[_0xd141('0x55')][_0xd141('0x68')]},'attributes':['id',_0xd141('0x28'),_0xd141('0x5f'),_0xd141('0x60'),_0xd141('0x5b')],'raw':!![]});}})[_0xd141('0x22')](function(_0x24c6d8){if(_0x24c6d8){fs[_0xd141('0x6a')](path[_0xd141('0x49')](_0x5ed9d4['directory'],util[_0xd141('0x61')]('%s.%s',_0x24c6d8[_0xd141('0x28')],_0x24c6d8[_0xd141('0x60')])));return _0x24c6d8;}})[_0xd141('0x41')](function(_0x418a95){throw new db[(_0xd141('0x64'))][(_0xd141('0x59'))](_0x418a95[_0xd141('0x65')]);});})[_0xd141('0x22')](handleEntityNotFound(_0x45f7f1,null))[_0xd141('0x22')](respondWithStatusCode(_0x45f7f1,0xcc))['catch'](handleError(_0x45f7f1,null));};exports[_0xd141('0x6b')]=function(_0x302a07,_0x4bc7d1,_0x1d65a8){var _0x4ea95e={};var _0x1403af={};var _0xdb49fb;var _0x47a20b;return db['VoiceMusicOnHold'][_0xd141('0x67')]({'where':{'id':_0x302a07[_0xd141('0x55')]['id']}})['then'](handleEntityNotFound(_0x4bc7d1,null))[_0xd141('0x22')](function(_0x9d3202){if(_0x9d3202){_0xdb49fb=_0x9d3202;_0x1403af['model']=_[_0xd141('0x2e')](db['Sound'][_0xd141('0x6c')]);_0x1403af[_0xd141('0x31')]=_[_0xd141('0x2e')](_0x302a07[_0xd141('0x31')]);_0x1403af['filters']=_['intersection'](_0x1403af['model'],_0x1403af['query']);_0x4ea95e[_0xd141('0x32')]=_[_0xd141('0x30')](_0x1403af[_0xd141('0x2d')],qs[_0xd141('0x33')](_0x302a07[_0xd141('0x31')][_0xd141('0x33')]));_0x4ea95e['attributes']=_0x4ea95e['attributes']['length']?_0x4ea95e[_0xd141('0x32')]:_0x1403af['model'];_0x4ea95e[_0xd141('0x6d')]=qs[_0xd141('0x36')](_0x302a07[_0xd141('0x31')][_0xd141('0x36')]);_0x4ea95e[_0xd141('0x37')]=qs[_0xd141('0x2f')](_[_0xd141('0x38')](_0x302a07[_0xd141('0x31')],_0x1403af[_0xd141('0x2f')]));if(_0x302a07[_0xd141('0x31')][_0xd141('0x39')]){_0x4ea95e['where']=_[_0xd141('0x3a')](_0x4ea95e[_0xd141('0x37')],{'$or':_[_0xd141('0x2b')](_0x4ea95e[_0xd141('0x32')],function(_0x2fdef0){var _0x1eb65d={};_0x1eb65d[_0x2fdef0]={'$like':'%'+_0x302a07['query'][_0xd141('0x39')]+'%'};return _0x1eb65d;})});}_0x4ea95e=_[_0xd141('0x3a')]({},_0x4ea95e,_0x302a07[_0xd141('0x3d')]);return _0xdb49fb['getSounds'](_0x4ea95e);}})[_0xd141('0x22')](function(_0x4bfc86){if(_0x4bfc86){_0x47a20b=_0x4bfc86['length'];if(!_0x302a07[_0xd141('0x31')][_0xd141('0x6e')](_0xd141('0x35'))){_0x4ea95e['limit']=qs[_0xd141('0x1d')](_0x302a07[_0xd141('0x31')]['limit']);_0x4ea95e[_0xd141('0x1b')]=qs[_0xd141('0x1b')](_0x302a07[_0xd141('0x31')][_0xd141('0x1b')]);}return _0xdb49fb[_0xd141('0x6b')](_0x4ea95e);}})[_0xd141('0x22')](function(_0x1a233e){if(_0x1a233e){return _0x1a233e?{'count':_0x47a20b,'rows':_0x1a233e}:null;}})[_0xd141('0x22')](respondWithResult(_0x4bc7d1,null))[_0xd141('0x41')](handleError(_0x4bc7d1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4ff4189..70b27d0 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 _0x5aa2=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','request-promise'];(function(_0x4535f5,_0x363565){var _0xc28b0d=function(_0x421a74){while(--_0x421a74){_0x4535f5['push'](_0x4535f5['shift']());}};_0xc28b0d(++_0x363565);}(_0x5aa2,0x1b8));var _0x25aa=function(_0x2ce80a,_0x18c122){_0x2ce80a=_0x2ce80a-0x0;var _0x29b1d6=_0x5aa2[_0x2ce80a];return _0x29b1d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x25aa('0x0'))(_0x25aa('0x1'));var moment=require(_0x25aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x25aa('0x3'));var fs=require('fs');var path=require(_0x25aa('0x4'));var rimraf=require(_0x25aa('0x5'));var config=require(_0x25aa('0x6'));var attributes=require(_0x25aa('0x7'));module[_0x25aa('0x8')]=function(_0x51f35e,_0x2dd2b0){return _0x51f35e[_0x25aa('0x9')](_0x25aa('0xa'),attributes,{'tableName':_0x25aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09c9=['api','moment','bluebird','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','../../config/logger'];(function(_0x2586fd,_0x44b427){var _0x429532=function(_0x28ce9e){while(--_0x28ce9e){_0x2586fd['push'](_0x2586fd['shift']());}};_0x429532(++_0x44b427);}(_0x09c9,0x116));var _0x909c=function(_0x2da3cc,_0x2087e9){_0x2da3cc=_0x2da3cc-0x0;var _0x3f4e76=_0x09c9[_0x2da3cc];return _0x3f4e76;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x909c('0x0'))(_0x909c('0x1'));var moment=require(_0x909c('0x2'));var BPromise=require(_0x909c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x909c('0x4'));var attributes=require(_0x909c('0x5'));module[_0x909c('0x6')]=function(_0x15770b,_0x2cc6c5){return _0x15770b[_0x909c('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0x909c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 52ab1e4..6f51794 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x40b2c0,_0xc68d4a){var _0x57f629=function(_0x624e10){while(--_0x624e10){_0x40b2c0['push'](_0x40b2c0['shift']());}};_0x57f629(++_0xc68d4a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x492da9,_0x5e590d){var _0x546b36=function(_0x205038){while(--_0x205038){_0x492da9['push'](_0x492da9['shift']());}};_0x546b36(++_0x5e590d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a39f34c..3a5b0aa 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 _0xf6c1=['/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xf6c1,0x99));var _0x1f6c=function(_0x1eda8e,_0x6abe55){_0x1eda8e=_0x1eda8e-0x0;var _0x498600=_0xf6c1[_0x1eda8e];return _0x498600;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f6c('0x0'));var timeout=require(_0x1f6c('0x1'));var express=require(_0x1f6c('0x2'));var router=express['Router']();var fs_extra=require(_0x1f6c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1f6c('0x4'));var config=require(_0x1f6c('0x5'));var controller=require(_0x1f6c('0x6'));router[_0x1f6c('0x7')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x9')]);router['get'](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xb')]);router[_0x1f6c('0x7')](_0x1f6c('0xc'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xd')]);router[_0x1f6c('0x7')](_0x1f6c('0xe'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x1f6c('0xf'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x10')]);router[_0x1f6c('0x11')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x12')]);router['post'](_0x1f6c('0xe'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x13')]);router[_0x1f6c('0x11')](_0x1f6c('0xf'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x14')]);router[_0x1f6c('0x15')]('/:id',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x16')]);router[_0x1f6c('0x17')](_0x1f6c('0xc'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x18')]);router['delete']('/:id/users',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x19')]);router['delete'](_0x1f6c('0xf'),auth['isAuthenticated'](),controller[_0x1f6c('0x1a')]);module[_0x1f6c('0x1b')]=router; \ No newline at end of file +var _0x0851=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put'];(function(_0x24e3e8,_0x397e35){var _0x38aba0=function(_0x2ac22d){while(--_0x2ac22d){_0x24e3e8['push'](_0x24e3e8['shift']());}};_0x38aba0(++_0x397e35);}(_0x0851,0x8a));var _0x1085=function(_0x44fee6,_0x4afc8d){_0x44fee6=_0x44fee6-0x0;var _0x23662d=_0x0851[_0x44fee6];return _0x23662d;};'use strict';var multer=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var path=require(_0x1085('0x2'));var timeout=require(_0x1085('0x3'));var express=require('express');var router=express[_0x1085('0x4')]();var fs_extra=require(_0x1085('0x5'));var auth=require(_0x1085('0x6'));var interaction=require(_0x1085('0x7'));var config=require(_0x1085('0x8'));var controller=require(_0x1085('0x9'));router[_0x1085('0xa')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0xc')]);router[_0x1085('0xa')](_0x1085('0xd'),auth[_0x1085('0xb')](),controller['describe']);router['get'](_0x1085('0xe'),auth[_0x1085('0xb')](),controller[_0x1085('0xf')]);router[_0x1085('0xa')](_0x1085('0x10'),auth[_0x1085('0xb')](),controller['getAgents']);router[_0x1085('0xa')](_0x1085('0x11'),auth[_0x1085('0xb')](),controller[_0x1085('0x12')]);router[_0x1085('0x13')]('/',auth[_0x1085('0xb')](),controller[_0x1085('0x14')]);router[_0x1085('0x13')](_0x1085('0x10'),auth[_0x1085('0xb')](),controller[_0x1085('0x15')]);router['post'](_0x1085('0x11'),auth['isAuthenticated'](),controller[_0x1085('0x16')]);router[_0x1085('0x17')](_0x1085('0xe'),auth['isAuthenticated'](),controller[_0x1085('0x18')]);router[_0x1085('0x19')](_0x1085('0xe'),auth[_0x1085('0xb')](),controller['destroy']);router[_0x1085('0x19')]('/:id/users',auth[_0x1085('0xb')](),controller['removeAgents']);router[_0x1085('0x19')](_0x1085('0x11'),auth[_0x1085('0xb')](),controller['removeTeams']);module[_0x1085('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c36eb49..a0a373f 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 _0xea14=['VIRTUAL','system-','INTEGER','sequelize','exports','STRING','name'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0xea14,0x73));var _0x4ea1=function(_0x1e5e53,_0x2adca4){_0x1e5e53=_0x1e5e53-0x0;var _0xb94f86=_0xea14[_0x1e5e53];return _0xb94f86;};'use strict';var Sequelize=require(_0x4ea1('0x0'));module[_0x4ea1('0x1')]={'name':{'type':Sequelize[_0x4ea1('0x2')],'allowNull':![],'unique':_0x4ea1('0x3')},'prefix':{'type':Sequelize[_0x4ea1('0x4')],'get':function(_0x4dca8a){return _0x4ea1('0x5')+this['getDataValue'](_0x4ea1('0x3'))+'-';}},'description':{'type':Sequelize[_0x4ea1('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x4ea1('0x6')]}}; \ No newline at end of file +var _0xcb54=['sequelize','exports','STRING','name','VIRTUAL'];(function(_0x11a2dd,_0x5bf4bc){var _0x4bc0e2=function(_0x54f2a7){while(--_0x54f2a7){_0x11a2dd['push'](_0x11a2dd['shift']());}};_0x4bc0e2(++_0x5bf4bc);}(_0xcb54,0x118));var _0x4cb5=function(_0x108273,_0x5e4e06){_0x108273=_0x108273-0x0;var _0x58bd50=_0xcb54[_0x108273];return _0x58bd50;};'use strict';var Sequelize=require(_0x4cb5('0x0'));module[_0x4cb5('0x1')]={'name':{'type':Sequelize[_0x4cb5('0x2')],'allowNull':![],'unique':_0x4cb5('0x3')},'prefix':{'type':Sequelize[_0x4cb5('0x4')],'get':function(_0x19c81f){return'system-'+this['getDataValue'](_0x4cb5('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x4cb5('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a6a05d7..482c6f4 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 _0x9f0e=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','key','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','options','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','order','pick','getAgents','getTeams','Team','User','Agents','flatMap','addTeams','each','TeamVoicePrefix','upsert','forEach','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','undefined'];(function(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0x9f0e,0x116));var _0xe9f0=function(_0x43bca9,_0x48d8dd){_0x43bca9=_0x43bca9-0x0;var _0x2b37a7=_0x9f0e[_0x43bca9];return _0x2b37a7;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];config['redis']=_[_0xe9f0('0x19')](config[_0xe9f0('0x1a')],{'host':_0xe9f0('0x1b'),'port':0x18eb});var socket=require(_0xe9f0('0x1c'))(new Redis(config['redis']));require(_0xe9f0('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e3ba8,_0x23914b){_0x23914b=_0x23914b||0xcc;return function(_0x3800e8){if(_0x3800e8){return _0x1e3ba8['sendStatus'](_0x23914b);}return _0x1e3ba8[_0xe9f0('0x1e')](_0x23914b)[_0xe9f0('0x1f')]();};}function respondWithResult(_0x2e68ef,_0x598eee){_0x598eee=_0x598eee||0xc8;return function(_0xaa7aa6){if(_0xaa7aa6){return _0x2e68ef[_0xe9f0('0x1e')](_0x598eee)[_0xe9f0('0x20')](_0xaa7aa6);}};}function respondWithFilteredResult(_0xd71ac8,_0x3ed69a){return function(_0x2ab12b){if(_0x2ab12b){var _0x3da237=typeof _0x3ed69a['offset']===_0xe9f0('0x21')&&typeof _0x3ed69a[_0xe9f0('0x22')]===_0xe9f0('0x21');var _0x5c4182=_0x2ab12b[_0xe9f0('0x23')];var _0x30b8c7=_0x3da237?0x0:_0x3ed69a[_0xe9f0('0x24')];var _0x43f399=_0x3da237?_0x2ab12b['count']:_0x3ed69a[_0xe9f0('0x24')]+_0x3ed69a[_0xe9f0('0x22')];var _0x583687;if(_0x43f399>=_0x5c4182){_0x43f399=_0x5c4182;_0x583687=0xc8;}else{_0x583687=0xce;}_0xd71ac8['status'](_0x583687);return _0xd71ac8['set'](_0xe9f0('0x25'),_0x30b8c7+'-'+_0x43f399+'/'+_0x5c4182)[_0xe9f0('0x20')](_0x2ab12b);}return null;};}function patchUpdates(_0x1211ae){return function(_0x316cdf){try{jsonpatch[_0xe9f0('0x26')](_0x316cdf,_0x1211ae,!![]);}catch(_0x4a5c27){return BPromise[_0xe9f0('0x27')](_0x4a5c27);}return _0x316cdf[_0xe9f0('0x28')]();};}function saveUpdates(_0x437d43,_0x10801b){return function(_0x3ca991){if(_0x3ca991){return _0x3ca991[_0xe9f0('0x29')](_0x437d43)[_0xe9f0('0x2a')](function(_0x1321bb){return _0x1321bb;});}return null;};}function removeEntity(_0x3c4ba9,_0x3fce54){return function(_0x48128a){if(_0x48128a){return _0x48128a[_0xe9f0('0x2b')]()[_0xe9f0('0x2a')](function(){var _0x2ddfba=_0x48128a[_0xe9f0('0x2c')]({'plain':!![]});var _0x4cf1b1=_0xe9f0('0x2d');return db[_0xe9f0('0x2e')][_0xe9f0('0x2b')]({'where':{'type':_0x4cf1b1,'resourceId':_0x2ddfba['id']}})[_0xe9f0('0x2a')](function(){return _0x48128a;});})[_0xe9f0('0x2a')](function(){_0x3c4ba9['status'](0xcc)[_0xe9f0('0x1f')]();});}};}function handleEntityNotFound(_0xdc16bc,_0x44fb5b){return function(_0xab3d81){if(!_0xab3d81){_0xdc16bc[_0xe9f0('0x2f')](0x194);}return _0xab3d81;};}function handleError(_0xd19788,_0x1d788a){_0x1d788a=_0x1d788a||0x1f4;return function(_0x2efd33){logger[_0xe9f0('0x30')](_0x2efd33[_0xe9f0('0x31')]);if(_0x2efd33[_0xe9f0('0x32')]){delete _0x2efd33[_0xe9f0('0x32')];}_0xd19788[_0xe9f0('0x1e')](_0x1d788a)[_0xe9f0('0x33')](_0x2efd33);};}exports[_0xe9f0('0x34')]=function(_0x2097c4,_0x80e3ac){var _0x3e1846={},_0x2e7535={},_0x19d799={'count':0x0,'rows':[]};var _0x4089cc=_[_0xe9f0('0x35')](db[_0xe9f0('0x36')][_0xe9f0('0x37')],function(_0x5480ce){return{'name':_0x5480ce['fieldName'],'type':_0x5480ce['type'][_0xe9f0('0x38')]};});_0x2e7535['model']=_[_0xe9f0('0x35')](_0x4089cc,_0xe9f0('0x32'));_0x2e7535['query']=_[_0xe9f0('0x39')](_0x2097c4['query']);_0x2e7535['filters']=_['intersection'](_0x2e7535[_0xe9f0('0x3a')],_0x2e7535[_0xe9f0('0x3b')]);_0x3e1846['attributes']=_[_0xe9f0('0x3c')](_0x2e7535[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2097c4['query']['fields']));_0x3e1846[_0xe9f0('0x3e')]=_0x3e1846[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x3e1846['attributes']:_0x2e7535[_0xe9f0('0x3a')];if(!_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x40')](_0xe9f0('0x41'))){_0x3e1846[_0xe9f0('0x22')]=qs['limit'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x3e1846[_0xe9f0('0x24')]=qs['offset'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}_0x3e1846['order']=qs[_0xe9f0('0x42')](_0x2097c4['query'][_0xe9f0('0x42')]);_0x3e1846['where']=qs['filters'](_['pick'](_0x2097c4['query'],_0x2e7535['filters']),_0x4089cc);if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x3e1846[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x3e1846[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0x4089cc,function(_0x3d4eb7){if(_0x3d4eb7[_0xe9f0('0x46')]!==_0xe9f0('0x47')){var _0x4e1c68={};_0x4e1c68[_0x3d4eb7[_0xe9f0('0x32')]]={'$like':'%'+_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x4e1c68;}})});}_0x3e1846=_['merge']({},_0x3e1846,_0x2097c4['options']);var _0x3cbf49={'where':_0x3e1846['where']};return db[_0xe9f0('0x36')][_0xe9f0('0x23')](_0x3cbf49)[_0xe9f0('0x2a')](function(_0x42d9d2){_0x19d799['count']=_0x42d9d2;if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x3e1846[_0xe9f0('0x49')]=[{'all':!![]}];}return db[_0xe9f0('0x36')][_0xe9f0('0x4a')](_0x3e1846);})['then'](function(_0x60a40d){_0x19d799[_0xe9f0('0x4b')]=_0x60a40d;return _0x19d799;})[_0xe9f0('0x2a')](respondWithFilteredResult(_0x80e3ac,_0x3e1846))[_0xe9f0('0x4c')](handleError(_0x80e3ac,null));};exports[_0xe9f0('0x4d')]=function(_0x4ffc17,_0x3a8d1d){var _0x54ab8f={'raw':![],'where':{'id':_0x4ffc17[_0xe9f0('0x4e')]['id']}},_0x54e432={};_0x54e432[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x36')][_0xe9f0('0x37')]);_0x54e432[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x4ffc17[_0xe9f0('0x3b')]);_0x54e432[_0xe9f0('0x4f')]=_[_0xe9f0('0x3c')](_0x54e432['model'],_0x54e432[_0xe9f0('0x3b')]);_0x54ab8f['attributes']=_[_0xe9f0('0x3c')](_0x54e432['model'],qs[_0xe9f0('0x3d')](_0x4ffc17['query'][_0xe9f0('0x3d')]));_0x54ab8f[_0xe9f0('0x3e')]=_0x54ab8f[_0xe9f0('0x3e')]['length']?_0x54ab8f[_0xe9f0('0x3e')]:_0x54e432[_0xe9f0('0x3a')];if(_0x4ffc17[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x54ab8f[_0xe9f0('0x49')]=[{'all':!![]}];}_0x54ab8f=_[_0xe9f0('0x45')]({},_0x54ab8f,_0x4ffc17[_0xe9f0('0x50')]);return db[_0xe9f0('0x36')][_0xe9f0('0x51')](_0x54ab8f)[_0xe9f0('0x2a')](handleEntityNotFound(_0x3a8d1d,null))[_0xe9f0('0x2a')](respondWithResult(_0x3a8d1d,null))[_0xe9f0('0x4c')](handleError(_0x3a8d1d,null));};exports['destroy']=function(_0x55e898,_0x31aa19){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x55e898['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x31aa19,null))['then'](removeEntity(_0x31aa19,null))[_0xe9f0('0x4c')](handleError(_0x31aa19,null));};exports[_0xe9f0('0x52')]=function(_0x31770f,_0x4e8416){return db['VoicePrefix'][_0xe9f0('0x52')]()[_0xe9f0('0x2a')](respondWithResult(_0x4e8416,null))['catch'](handleError(_0x4e8416,null));};exports[_0xe9f0('0x53')]=function(_0xafb4d7,_0x33f26c){var _0xa26972;return db['sequelize'][_0xe9f0('0x54')](function(_0x3a5d19){return db[_0xe9f0('0x36')][_0xe9f0('0x53')](_0xafb4d7[_0xe9f0('0x55')],{'transaction':_0x3a5d19})[_0xe9f0('0x2a')](function(_0x1cba23){_0xa26972=_0x1cba23[_0xe9f0('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xe9f0('0x51')]({'where':{'id':_0xa26972[_0xe9f0('0x56')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x4728e7){return createVoicePrefixExtensions(_0xa26972,_0x4728e7,_0x3a5d19);});});})[_0xe9f0('0x2a')](function(){var _0xe67052=_0xafb4d7[_0xe9f0('0x57')][_0xe9f0('0x2c')]({'plain':!![]});if(!_0xe67052)throw new Error(_0xe9f0('0x58'));if(_0xe67052[_0xe9f0('0x59')]===_0xe9f0('0x57')){var _0x3c26ac=_0xa26972;return db[_0xe9f0('0x5a')][_0xe9f0('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0xe67052[_0xe9f0('0x5b')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x52bcce){if(_0x52bcce&&_0x52bcce['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9f0('0x53')]({'name':_0x3c26ac['name'],'resourceId':_0x3c26ac['id'],'type':_0x52bcce[_0xe9f0('0x32')],'sectionId':_0x52bcce['id']},{})[_0xe9f0('0x2a')](function(){return _0xa26972;});}else{return _0xa26972;}})[_0xe9f0('0x4c')](function(_0x4c983e){logger[_0xe9f0('0x30')](_0xe9f0('0x5c'),_0x4c983e);throw _0x4c983e;});}return _0xa26972;})[_0xe9f0('0x2a')](respondWithResult(_0x33f26c,null))[_0xe9f0('0x4c')](handleError(_0x33f26c,null));};function Extension(_0x4bb39d,_0x392eae,_0x3a05e7,_0x28a66e){this[_0xe9f0('0x5d')]='from-sip';this['exten']=_0x4bb39d;this[_0xe9f0('0x5e')]=_0x3a05e7;this[_0xe9f0('0x46')]=_0xe9f0('0x5f');this[_0xe9f0('0x60')]=_0xe9f0('0x61');this['priority']=_0x392eae;this[_0xe9f0('0x62')]=_0x28a66e;}function createVoicePrefixExtensions(_0x55ce2d,_0x16b3c0,_0x5858a9){return new BPromise(function(_0x7c05aa,_0x15ece3){var _0x8b26f2=new Extension(formatPrefixName(_0x55ce2d[_0xe9f0('0x63')]),0x1,_0xe9f0('0x64'),'Voice\x20Prefix');_0x8b26f2['VoicePrefixId']=_0x55ce2d['id'];return db['VoiceExtension'][_0xe9f0('0x53')](_0x8b26f2,{'transaction':_0x5858a9})[_0xe9f0('0x2a')](function(_0x4f6f7c){var _0x2fd3b2=_0x4f6f7c['get']({'plain':!![]});var _0x4f6a5b=_[_0xe9f0('0x35')](addVoicePrefixExtensions(_0x55ce2d,_0x16b3c0),function(_0x329e9e){_0x329e9e[_0xe9f0('0x56')]=_0x2fd3b2['id'];_0x329e9e[_0xe9f0('0x65')]=_0x55ce2d['id'];return _0x329e9e;});return db[_0xe9f0('0x66')][_0xe9f0('0x67')](_0x4f6a5b,{'transaction':_0x5858a9})['then'](function(_0x5e4ad4){if(!_0x5e4ad4){return _0x15ece3(_0xe9f0('0x68'));}else{return _0x7c05aa(_0x5e4ad4);}})[_0xe9f0('0x4c')](function(_0x12d40a){return _0x15ece3(_0x12d40a);});});;});};function addVoicePrefixExtensions(_0x1f57a1,_0x55dae1){var _0xb9b439=[];var _0x83dea9=formatPrefixName(_0x1f57a1[_0xe9f0('0x63')]);_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x2,_0xe9f0('0x6a'),_0xe9f0('0x6b')+_0x1f57a1['name']));if(_0x1f57a1[_0xe9f0('0x6c')]){_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x3,_0xe9f0('0x6a'),_0xe9f0('0x6d')+_0x1f57a1[_0xe9f0('0x6c')]));}else{_0xb9b439['push'](new Extension(_0x83dea9,0x3,_0xe9f0('0x64'),_0xe9f0('0x6e')));}_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x4,_0xe9f0('0x6f'),_0x55dae1[_0xe9f0('0x5d')]+','+_0xe9f0('0x70')+(0x8+_0x1f57a1[_0xe9f0('0x32')][_0xe9f0('0x3f')])+'}'+','+0x1));return _0xb9b439;}function formatPrefixName(_0x2eaead){var _0x27e6bc='_';for(var _0xeaab41=0x0;_0xeaab41<_0x2eaead[_0xe9f0('0x3f')];_0xeaab41++){if(_0x2eaead['charAt'](_0xeaab41)=='-'){_0x27e6bc+=_0x2eaead[_0xe9f0('0x71')](_0xeaab41);}else{_0x27e6bc+='['+_0x2eaead[_0xe9f0('0x71')](_0xeaab41)+']';}}_0x27e6bc+='.';return _0x27e6bc;}exports[_0xe9f0('0x29')]=function(_0x116ec5,_0x3c700e,_0x2428aa){var _0x158e44=_0x116ec5['body'];_0x158e44[_0xe9f0('0x63')]=_0xe9f0('0x72')+_0x158e44['name']+'-';return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x442b78){return db['VoicePrefix'][_0xe9f0('0x29')](_0x158e44,{'where':{'id':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension'][_0xe9f0('0x2b')]({'where':{'VoicePrefixId':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x158e44[_0xe9f0('0x56')]},'raw':!![]})['then'](function(_0x386d7b){return createVoicePrefixExtensions(_0x158e44,_0x386d7b,_0x442b78);});});});})[_0xe9f0('0x2a')](function(){return db['VoicePrefix'][_0xe9f0('0x74')](_0x158e44['id']);})[_0xe9f0('0x2a')](respondWithResult(_0x3c700e,null))[_0xe9f0('0x4c')](handleError(_0x3c700e,null));};exports[_0xe9f0('0x75')]=function(_0x161ee4,_0x8096c2,_0x42e4e9){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x161ee4['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x8096c2,null))[_0xe9f0('0x2a')](function(_0xe7fdb){if(_0xe7fdb){return _0xe7fdb[_0xe9f0('0x75')](_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')],_[_0xe9f0('0x77')](_0x161ee4[_0xe9f0('0x55')],['ids','id'])||{})[_0xe9f0('0x78')](function(_0x17c18c){for(var _0x2ce60c=0x0;_0x2ce60c<_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')][_0xe9f0('0x3f')];_0x2ce60c+=0x1){socket['emit'](_0xe9f0('0x79'),{'UserId':Number(_0x161ee4['body']['ids'][_0x2ce60c]),'VoicePrefixId':Number(_0x161ee4['params']['id'])});}return _0x17c18c;});}})[_0xe9f0('0x2a')](respondWithResult(_0x8096c2,null))[_0xe9f0('0x4c')](handleError(_0x8096c2,null));};exports[_0xe9f0('0x7a')]=function(_0x3b5b57,_0x2bf006,_0x8f8df5){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x3b5b57[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf006,null))[_0xe9f0('0x2a')](function(_0x29eee2){if(_0x29eee2){return _0x29eee2[_0xe9f0('0x7a')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])[_0xe9f0('0x2a')](function(){if(_[_0xe9f0('0x7b')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])){for(var _0x1a4217=0x0;_0x1a4217<_0x3b5b57['query']['ids'][_0xe9f0('0x3f')];_0x1a4217+=0x1){socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')][_0x1a4217]),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}}else{socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57['query']['ids']),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x2bf006,null))['catch'](handleError(_0x2bf006,null));};exports['getAgents']=function(_0x2c9d84,_0x145040,_0x3ed26a){var _0xab92b={};var _0x2f73cd={};var _0x5553df;var _0x20c026;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x2c9d84[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x145040,null))[_0xe9f0('0x2a')](function(_0x2aca09){if(_0x2aca09){_0x5553df=_0x2aca09;_0x2f73cd['model']=_['keys'](db['User'][_0xe9f0('0x37')]);_0x2f73cd[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x2c9d84[_0xe9f0('0x3b')]);_0x2f73cd['filters']=_[_0xe9f0('0x3c')](_0x2f73cd['model'],_0x2f73cd[_0xe9f0('0x3b')]);_0xab92b['attributes']=_[_0xe9f0('0x3c')](_0x2f73cd[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0xab92b[_0xe9f0('0x3e')]=_0xab92b['attributes'][_0xe9f0('0x3f')]?_0xab92b[_0xe9f0('0x3e')]:_0x2f73cd[_0xe9f0('0x3a')];_0xab92b[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x2c9d84['query'][_0xe9f0('0x42')]);_0xab92b[_0xe9f0('0x44')]=qs['filters'](_[_0xe9f0('0x80')](_0x2c9d84['query'],_0x2f73cd[_0xe9f0('0x4f')]));if(_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0xab92b['where']=_[_0xe9f0('0x45')](_0xab92b[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0xab92b['attributes'],function(_0x2a5d79){var _0x473f78={};_0x473f78[_0x2a5d79]={'$like':'%'+_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x473f78;})});}_0xab92b=_[_0xe9f0('0x45')]({},_0xab92b,_0x2c9d84[_0xe9f0('0x50')]);return _0x5553df[_0xe9f0('0x81')](_0xab92b);}})['then'](function(_0x4a416c){if(_0x4a416c){_0x20c026=_0x4a416c[_0xe9f0('0x3f')];if(!_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x40')]('nolimit')){_0xab92b[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0xab92b['offset']=qs['offset'](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}return _0x5553df['getAgents'](_0xab92b);}})[_0xe9f0('0x2a')](function(_0x5b26b1){if(_0x5b26b1){return _0x5b26b1?{'count':_0x20c026,'rows':_0x5b26b1}:null;}})['then'](respondWithResult(_0x145040,null))[_0xe9f0('0x4c')](handleError(_0x145040,null));};exports[_0xe9f0('0x82')]=function(_0x77b59d,_0x32ad0e,_0x10c4cf){var _0x563f55={};var _0x5761d3={};var _0x3e323e;var _0x41c1a9;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x77b59d[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32ad0e,null))['then'](function(_0x5ae1ce){if(_0x5ae1ce){_0x3e323e=_0x5ae1ce;_0x5761d3[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x83')][_0xe9f0('0x37')]);_0x5761d3[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x77b59d[_0xe9f0('0x3b')]);_0x5761d3[_0xe9f0('0x4f')]=_['intersection'](_0x5761d3['model'],_0x5761d3[_0xe9f0('0x3b')]);_0x563f55[_0xe9f0('0x3e')]=_[_0xe9f0('0x3c')](_0x5761d3[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0x563f55[_0xe9f0('0x3e')]=_0x563f55[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x563f55[_0xe9f0('0x3e')]:_0x5761d3[_0xe9f0('0x3a')];_0x563f55[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x77b59d['query'][_0xe9f0('0x42')]);_0x563f55[_0xe9f0('0x44')]=qs[_0xe9f0('0x4f')](_[_0xe9f0('0x80')](_0x77b59d[_0xe9f0('0x3b')],_0x5761d3[_0xe9f0('0x4f')]));if(_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x563f55[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x563f55[_0xe9f0('0x44')],{'$or':_['map'](_0x563f55[_0xe9f0('0x3e')],function(_0x2b9c16){var _0x41ef5b={};_0x41ef5b[_0x2b9c16]={'$like':'%'+_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x41ef5b;})});}_0x563f55=_[_0xe9f0('0x45')]({},_0x563f55,_0x77b59d[_0xe9f0('0x50')]);return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x5c5ac9){if(_0x5c5ac9){_0x41c1a9=_0x5c5ac9[_0xe9f0('0x3f')];if(!_0x77b59d[_0xe9f0('0x3b')]['hasOwnProperty']('nolimit')){_0x563f55[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x563f55[_0xe9f0('0x24')]=qs[_0xe9f0('0x24')](_0x77b59d['query'][_0xe9f0('0x24')]);}return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x4d59c0){if(_0x4d59c0){return _0x4d59c0?{'count':_0x41c1a9,'rows':_0x4d59c0}:null;}})[_0xe9f0('0x2a')](respondWithResult(_0x32ad0e,null))[_0xe9f0('0x4c')](handleError(_0x32ad0e,null));};exports['addTeams']=function(_0x17013a,_0x63e374,_0x34eda8){var _0x5a38f4=_0x17013a[_0xe9f0('0x55')][_0xe9f0('0x76')];var _0x2a607b;return db[_0xe9f0('0x83')]['findAll']({'where':{'id':_0x5a38f4},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id',_0xe9f0('0x32'),'online','voicePause','interface'],'raw':!![]}]})[_0xe9f0('0x2a')](function(_0x58db9d){if(_0x58db9d){_0x2a607b=_0x58db9d;var _0x4820a1=_[_0xe9f0('0x86')](_0x58db9d,function(_0x4cd8bc){var _0x1b2532=_0x4cd8bc[_0xe9f0('0x2c')]({'plain':!![]});return _0x1b2532[_0xe9f0('0x85')];});return db[_0xe9f0('0x36')]['find']({'where':{'id':_0x17013a[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x231d94){return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x25c2f6){return _0x231d94[_0xe9f0('0x87')](_0x5a38f4,{'transaction':_0x25c2f6})[_0xe9f0('0x2a')](function(){return BPromise[_0xe9f0('0x88')](_0x2a607b,function(_0x2cd0a5){return db[_0xe9f0('0x89')][_0xe9f0('0x8a')]({'TeamId':_0x2cd0a5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},{'transaction':_0x25c2f6});});})['then'](function(){return BPromise[_0xe9f0('0x88')](_0x4820a1,function(_0x1d8fb5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x1d8fb5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},'transaction':_0x25c2f6});});})[_0xe9f0('0x2a')](function(){_0x4820a1[_0xe9f0('0x8b')](function(_0x1c0db4){socket['emit'](_0xe9f0('0x79'),{'UserId':_0x1c0db4['id'],'VoicePrefixId':_0x231d94['id']});});});});});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x63e374,null))[_0xe9f0('0x4c')](handleError(_0x63e374,null));};exports['removeTeams']=function(_0x448834,_0x116aec,_0x4398fd){return db[_0xe9f0('0x83')][_0xe9f0('0x4a')]({'where':{'id':_0x448834['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id'],'raw':!![]}]})[_0xe9f0('0x2a')](handleEntityNotFound(_0x116aec,null))[_0xe9f0('0x2a')](function(_0x13ad0d){var _0x1b4977=_[_0xe9f0('0x35')](_0x13ad0d,'id');var _0x34f99d=[];var _0x5ae9f1=[];var _0x1aacfa=squel['select']();_0x1aacfa['field'](_0xe9f0('0x8c'))[_0xe9f0('0x8d')](_0xe9f0('0x8e'),'tq')['join'](_0xe9f0('0x8f'),'ut',_0xe9f0('0x90'))['where'](_0xe9f0('0x91'),_0x448834[_0xe9f0('0x4e')]['id']);for(var _0x14e369=0x0;_0x14e369<_0x13ad0d[_0xe9f0('0x3f')];_0x14e369+=0x1){let _0x56e09f=_0x13ad0d[_0x14e369];for(var _0x25750e=0x0;_0x25750e<_0x56e09f['Agents'][_0xe9f0('0x3f')];_0x25750e+=0x1){let _0x56e47c=_0x56e09f['Agents'][_0x25750e];var _0x58d863=_0x1aacfa[_0xe9f0('0x92')]();_0x58d863[_0xe9f0('0x44')]('ut.UserId\x20=\x20?',_0x56e47c['id']);_0x5ae9f1[_0xe9f0('0x69')](db[_0xe9f0('0x73')][_0xe9f0('0x3b')](_0x58d863[_0xe9f0('0x93')](),{'type':db[_0xe9f0('0x73')][_0xe9f0('0x94')][_0xe9f0('0x95')]})['then'](function(_0x5b10a5){if(_0x5b10a5[_0xe9f0('0x3f')]===0x1){return _0x56e47c['id'];}else{var _0x32eb6c=_['every'](_[_0xe9f0('0x35')](_0x5b10a5,_0xe9f0('0x96')),function(_0x96e959){return _['includes'](_0x1b4977,_0x96e959);});if(_0x32eb6c){return _0x56e47c['id'];}}}));}}return BPromise[_0xe9f0('0x97')](_0x5ae9f1)[_0xe9f0('0x2a')](function(_0x59fbca){_0x34f99d=_(_0x34f99d)[_0xe9f0('0x98')](_0x59fbca)['compact']()[_0xe9f0('0x99')]();return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x448834[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x305d2f){return db['sequelize'][_0xe9f0('0x54')](function(_0x17f9bd){return _0x305d2f[_0xe9f0('0x9a')](_0x448834[_0xe9f0('0x3b')][_0xe9f0('0x76')],{'transaction':_0x17f9bd})[_0xe9f0('0x2a')](function(){if(!_[_0xe9f0('0x9b')](_0x34f99d)){return _0x305d2f['removeAgents'](_0x34f99d,{'transaction':_0x17f9bd});}})['then'](function(){_0x34f99d[_0xe9f0('0x8b')](function(_0x3e8745){socket['emit'](_0xe9f0('0x7d'),{'UserId':_0x3e8745,'VoicePrefixId':_0x305d2f['id']});});});});});});})['then'](respondWithStatusCode(_0x116aec,null))[_0xe9f0('0x4c')](handleError(_0x116aec,null));}; \ No newline at end of file +var _0xb62e=['all','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','SELECT','every','TeamId','includes'];(function(_0x59511e,_0x5ba550){var _0x4f8db9=function(_0x24ae1f){while(--_0x24ae1f){_0x59511e['push'](_0x59511e['shift']());}};_0x4f8db9(++_0x5ba550);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1b')]=_[_0xeb62('0x1c')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1b')]));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);function respondWithStatusCode(_0x4da178,_0x26c3fd){_0x26c3fd=_0x26c3fd||0xcc;return function(_0x195837){if(_0x195837){return _0x4da178[_0xeb62('0x20')](_0x26c3fd);}return _0x4da178['status'](_0x26c3fd)[_0xeb62('0x21')]();};}function respondWithResult(_0x15b3e8,_0x184106){_0x184106=_0x184106||0xc8;return function(_0x353e2c){if(_0x353e2c){return _0x15b3e8[_0xeb62('0x22')](_0x184106)[_0xeb62('0x23')](_0x353e2c);}};}function respondWithFilteredResult(_0x1fb460,_0x1324d7){return function(_0x39b138){if(_0x39b138){var _0x27fd84=typeof _0x1324d7[_0xeb62('0x24')]===_0xeb62('0x25')&&typeof _0x1324d7[_0xeb62('0x26')]==='undefined';var _0x38c5e4=_0x39b138[_0xeb62('0x27')];var _0x332396=_0x27fd84?0x0:_0x1324d7[_0xeb62('0x24')];var _0x425817=_0x27fd84?_0x39b138[_0xeb62('0x27')]:_0x1324d7[_0xeb62('0x24')]+_0x1324d7['limit'];var _0x599d0b;if(_0x425817>=_0x38c5e4){_0x425817=_0x38c5e4;_0x599d0b=0xc8;}else{_0x599d0b=0xce;}_0x1fb460[_0xeb62('0x22')](_0x599d0b);return _0x1fb460[_0xeb62('0x28')](_0xeb62('0x29'),_0x332396+'-'+_0x425817+'/'+_0x38c5e4)[_0xeb62('0x23')](_0x39b138);}return null;};}function patchUpdates(_0x122b15){return function(_0x4cafcf){try{jsonpatch['apply'](_0x4cafcf,_0x122b15,!![]);}catch(_0x4664ce){return BPromise[_0xeb62('0x2a')](_0x4664ce);}return _0x4cafcf[_0xeb62('0x2b')]();};}function saveUpdates(_0x395b70,_0x55a169){return function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0xeb62('0x2c')](_0x395b70)['then'](function(_0x448327){return _0x448327;});}return null;};}function removeEntity(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(_0x516a72){return _0x516a72[_0xeb62('0x2d')]()[_0xeb62('0x2e')](function(){var _0x46d1bb=_0x516a72['get']({'plain':!![]});var _0x3ef784=_0xeb62('0x2f');return db[_0xeb62('0x30')][_0xeb62('0x2d')]({'where':{'type':_0x3ef784,'resourceId':_0x46d1bb['id']}})[_0xeb62('0x2e')](function(){return _0x516a72;});})[_0xeb62('0x2e')](function(){_0x4b0f46['status'](0xcc)[_0xeb62('0x21')]();});}};}function handleEntityNotFound(_0x1616ee,_0x57169a){return function(_0x157474){if(!_0x157474){_0x1616ee[_0xeb62('0x20')](0x194);}return _0x157474;};}function handleError(_0x2c967c,_0x2c308c){_0x2c308c=_0x2c308c||0x1f4;return function(_0x235448){logger['error'](_0x235448['stack']);if(_0x235448[_0xeb62('0x31')]){delete _0x235448[_0xeb62('0x31')];}_0x2c967c[_0xeb62('0x22')](_0x2c308c)[_0xeb62('0x32')](_0x235448);};}exports[_0xeb62('0x33')]=function(_0x2ad3ec,_0x1ae51e){var _0x4be25d={},_0x411062={},_0x47a94b={'count':0x0,'rows':[]};var _0x555db1=_[_0xeb62('0x34')](db[_0xeb62('0x35')]['rawAttributes'],function(_0x1ade38){return{'name':_0x1ade38['fieldName'],'type':_0x1ade38[_0xeb62('0x36')][_0xeb62('0x37')]};});_0x411062['model']=_[_0xeb62('0x34')](_0x555db1,_0xeb62('0x31'));_0x411062['query']=_[_0xeb62('0x38')](_0x2ad3ec[_0xeb62('0x39')]);_0x411062[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x411062['model'],_0x411062[_0xeb62('0x39')]);_0x4be25d[_0xeb62('0x3c')]=_['intersection'](_0x411062['model'],qs[_0xeb62('0x3d')](_0x2ad3ec[_0xeb62('0x39')]['fields']));_0x4be25d[_0xeb62('0x3c')]=_0x4be25d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x4be25d[_0xeb62('0x3c')]:_0x411062[_0xeb62('0x3f')];if(!_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x40')]('nolimit')){_0x4be25d['limit']=qs[_0xeb62('0x26')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x26')]);_0x4be25d[_0xeb62('0x24')]=qs['offset'](_0x2ad3ec[_0xeb62('0x39')]['offset']);}_0x4be25d[_0xeb62('0x41')]=qs[_0xeb62('0x42')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x42')]);_0x4be25d[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x2ad3ec[_0xeb62('0x39')],_0x411062['filters']),_0x555db1);if(_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x45')]){_0x4be25d[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0x4be25d['where'],{'$or':_['map'](_0x555db1,function(_0x46a560){if(_0x46a560[_0xeb62('0x36')]!=='VIRTUAL'){var _0x1f7036={};_0x1f7036[_0x46a560[_0xeb62('0x31')]]={'$like':'%'+_0x2ad3ec['query'][_0xeb62('0x45')]+'%'};return _0x1f7036;}})});}_0x4be25d=_['merge']({},_0x4be25d,_0x2ad3ec[_0xeb62('0x47')]);var _0x47b815={'where':_0x4be25d[_0xeb62('0x43')]};return db['VoicePrefix'][_0xeb62('0x27')](_0x47b815)[_0xeb62('0x2e')](function(_0x317f50){_0x47a94b['count']=_0x317f50;if(_0x2ad3ec['query'][_0xeb62('0x48')]){_0x4be25d[_0xeb62('0x49')]=[{'all':!![]}];}return db[_0xeb62('0x35')][_0xeb62('0x4a')](_0x4be25d);})[_0xeb62('0x2e')](function(_0x4afd5e){_0x47a94b[_0xeb62('0x4b')]=_0x4afd5e;return _0x47a94b;})['then'](respondWithFilteredResult(_0x1ae51e,_0x4be25d))[_0xeb62('0x4c')](handleError(_0x1ae51e,null));};exports['show']=function(_0xeeced2,_0x4d2f80){var _0x26c77d={'raw':![],'where':{'id':_0xeeced2[_0xeb62('0x4d')]['id']}},_0x4dbcac={};_0x4dbcac[_0xeb62('0x3f')]=_[_0xeb62('0x38')](db[_0xeb62('0x35')][_0xeb62('0x4e')]);_0x4dbcac[_0xeb62('0x39')]=_['keys'](_0xeeced2[_0xeb62('0x39')]);_0x4dbcac[_0xeb62('0x3a')]=_['intersection'](_0x4dbcac['model'],_0x4dbcac['query']);_0x26c77d['attributes']=_[_0xeb62('0x3b')](_0x4dbcac[_0xeb62('0x3f')],qs['fields'](_0xeeced2[_0xeb62('0x39')][_0xeb62('0x3d')]));_0x26c77d[_0xeb62('0x3c')]=_0x26c77d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x26c77d['attributes']:_0x4dbcac[_0xeb62('0x3f')];if(_0xeeced2['query'][_0xeb62('0x48')]){_0x26c77d[_0xeb62('0x49')]=[{'all':!![]}];}_0x26c77d=_[_0xeb62('0x46')]({},_0x26c77d,_0xeeced2[_0xeb62('0x47')]);return db[_0xeb62('0x35')][_0xeb62('0x4f')](_0x26c77d)[_0xeb62('0x2e')](handleEntityNotFound(_0x4d2f80,null))[_0xeb62('0x2e')](respondWithResult(_0x4d2f80,null))[_0xeb62('0x4c')](handleError(_0x4d2f80,null));};exports[_0xeb62('0x2d')]=function(_0xe13846,_0x13e102){return db['VoicePrefix'][_0xeb62('0x4f')]({'where':{'id':_0xe13846['params']['id']}})['then'](handleEntityNotFound(_0x13e102,null))[_0xeb62('0x2e')](removeEntity(_0x13e102,null))[_0xeb62('0x4c')](handleError(_0x13e102,null));};exports['describe']=function(_0x373505,_0x462760){return db['VoicePrefix'][_0xeb62('0x50')]()[_0xeb62('0x2e')](respondWithResult(_0x462760,null))[_0xeb62('0x4c')](handleError(_0x462760,null));};exports[_0xeb62('0x51')]=function(_0xe71e83,_0x1e6238){var _0x351027;return db[_0xeb62('0x52')]['transaction'](function(_0x3e2be9){return db['VoicePrefix'][_0xeb62('0x51')](_0xe71e83[_0xeb62('0x53')],{'transaction':_0x3e2be9})[_0xeb62('0x2e')](function(_0x289af0){_0x351027=_0x289af0[_0xeb62('0x54')]({'plain':!![]});return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x351027[_0xeb62('0x56')]},'raw':!![]})['then'](function(_0x4d31a1){return createVoicePrefixExtensions(_0x351027,_0x4d31a1,_0x3e2be9);});});})['then'](function(){var _0x5033eb=_0xe71e83[_0xeb62('0x57')]['get']({'plain':!![]});if(!_0x5033eb)throw new Error(_0xeb62('0x58'));if(_0x5033eb['role']===_0xeb62('0x57')){var _0x342768=_0x351027;return db[_0xeb62('0x59')]['find']({'where':{'name':_0xeb62('0x2f'),'userProfileId':_0x5033eb[_0xeb62('0x5a')]},'raw':!![]})['then'](function(_0x35982a){if(_0x35982a&&_0x35982a[_0xeb62('0x5b')]===0x0){return db[_0xeb62('0x30')][_0xeb62('0x51')]({'name':_0x342768['name'],'resourceId':_0x342768['id'],'type':_0x35982a[_0xeb62('0x31')],'sectionId':_0x35982a['id']},{})[_0xeb62('0x2e')](function(){return _0x351027;});}else{return _0x351027;}})['catch'](function(_0x2eba52){logger[_0xeb62('0x5c')](_0xeb62('0x5d'),_0x2eba52);throw _0x2eba52;});}return _0x351027;})[_0xeb62('0x2e')](respondWithResult(_0x1e6238,null))[_0xeb62('0x4c')](handleError(_0x1e6238,null));};function Extension(_0x46da69,_0x3e55bf,_0x1b354d,_0x222d0c){this[_0xeb62('0x5e')]=_0xeb62('0x5f');this[_0xeb62('0x60')]=_0x46da69;this[_0xeb62('0x61')]=_0x1b354d;this[_0xeb62('0x36')]=_0xeb62('0x62');this[_0xeb62('0x63')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3e55bf;this['appdata']=_0x222d0c;}function createVoicePrefixExtensions(_0x5b28ec,_0x279b83,_0x5f363d){return new BPromise(function(_0x10cc40,_0x136d81){var _0x5b8c4=new Extension(formatPrefixName(_0x5b28ec[_0xeb62('0x64')]),0x1,_0xeb62('0x65'),_0xeb62('0x66'));_0x5b8c4[_0xeb62('0x67')]=_0x5b28ec['id'];return db[_0xeb62('0x55')][_0xeb62('0x51')](_0x5b8c4,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x52dfbd){var _0x113302=_0x52dfbd[_0xeb62('0x54')]({'plain':!![]});var _0x42e992=_[_0xeb62('0x34')](addVoicePrefixExtensions(_0x5b28ec,_0x279b83),function(_0x4aba1f){_0x4aba1f[_0xeb62('0x56')]=_0x113302['id'];_0x4aba1f[_0xeb62('0x67')]=_0x5b28ec['id'];return _0x4aba1f;});return db[_0xeb62('0x55')][_0xeb62('0x68')](_0x42e992,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x1679a7){if(!_0x1679a7){return _0x136d81(_0xeb62('0x69'));}else{return _0x10cc40(_0x1679a7);}})[_0xeb62('0x4c')](function(_0x2e1fb8){return _0x136d81(_0x2e1fb8);});});;});};function addVoicePrefixExtensions(_0x2b788e,_0x1d8675){var _0x510275=[];var _0x110224=formatPrefixName(_0x2b788e[_0xeb62('0x64')]);_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x2,_0xeb62('0x6b'),_0xeb62('0x6c')+_0x2b788e[_0xeb62('0x31')]));if(_0x2b788e[_0xeb62('0x6d')]){_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x6b'),_0xeb62('0x6e')+_0x2b788e['callerIdAll']));}else{_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x65'),_0xeb62('0x6f')));}_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x4,'goto',_0x1d8675[_0xeb62('0x5e')]+','+_0xeb62('0x70')+(0x8+_0x2b788e[_0xeb62('0x31')][_0xeb62('0x3e')])+'}'+','+0x1));return _0x510275;}function formatPrefixName(_0xc81d4c){var _0x32642f='_';for(var _0x48488c=0x0;_0x48488c<_0xc81d4c[_0xeb62('0x3e')];_0x48488c++){if(_0xc81d4c[_0xeb62('0x71')](_0x48488c)=='-'){_0x32642f+=_0xc81d4c[_0xeb62('0x71')](_0x48488c);}else{_0x32642f+='['+_0xc81d4c[_0xeb62('0x71')](_0x48488c)+']';}}_0x32642f+='.';return _0x32642f;}exports[_0xeb62('0x2c')]=function(_0x28d0ff,_0x2e4502,_0x313d33){var _0x233715=_0x28d0ff[_0xeb62('0x53')];_0x233715[_0xeb62('0x64')]=_0xeb62('0x72')+_0x233715[_0xeb62('0x31')]+'-';return db[_0xeb62('0x52')][_0xeb62('0x73')](function(_0x2bbbff){return db['VoicePrefix'][_0xeb62('0x2c')](_0x233715,{'where':{'id':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x2d')]({'where':{'VoicePrefixId':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x233715[_0xeb62('0x56')]},'raw':!![]})[_0xeb62('0x2e')](function(_0x206e77){return createVoicePrefixExtensions(_0x233715,_0x206e77,_0x2bbbff);});});});})[_0xeb62('0x2e')](function(){return db[_0xeb62('0x35')][_0xeb62('0x74')](_0x233715['id']);})[_0xeb62('0x2e')](respondWithResult(_0x2e4502,null))[_0xeb62('0x4c')](handleError(_0x2e4502,null));};exports[_0xeb62('0x75')]=function(_0x146174,_0x910940,_0x4c6b69){return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146174['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x910940,null))['then'](function(_0x32679a){if(_0x32679a){return _0x32679a[_0xeb62('0x75')](_0x146174[_0xeb62('0x53')][_0xeb62('0x76')],_[_0xeb62('0x77')](_0x146174[_0xeb62('0x53')],['ids','id'])||{})[_0xeb62('0x78')](function(_0x4fc07f){for(var _0x42ee4d=0x0;_0x42ee4d<_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x42ee4d+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':Number(_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0x42ee4d]),'VoicePrefixId':Number(_0x146174[_0xeb62('0x4d')]['id'])});}return _0x4fc07f;});}})['then'](respondWithResult(_0x910940,null))[_0xeb62('0x4c')](handleError(_0x910940,null));};exports[_0xeb62('0x7a')]=function(_0x8a8ef3,_0x7ca547,_0x16c28d){return db[_0xeb62('0x35')]['find']({'where':{'id':_0x8a8ef3['params']['id']}})['then'](handleEntityNotFound(_0x7ca547,null))['then'](function(_0x5bf6f6){if(_0x5bf6f6){return _0x5bf6f6[_0xeb62('0x7a')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])[_0xeb62('0x2e')](function(){if(_[_0xeb62('0x7b')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])){for(var _0x1c01ae=0x0;_0x1c01ae<_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x1c01ae+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0x1c01ae]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}}else{socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x7ca547,null))[_0xeb62('0x4c')](handleError(_0x7ca547,null));};exports[_0xeb62('0x7d')]=function(_0x17beef,_0x45b2a3,_0x42c384){var _0xfff29b={};var _0x1cbfab={};var _0x29648f;var _0x2f5f2f;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x17beef['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x45b2a3,null))[_0xeb62('0x2e')](function(_0x48dcf6){if(_0x48dcf6){_0x29648f=_0x48dcf6;_0x1cbfab[_0xeb62('0x3f')]=_['keys'](db['User'][_0xeb62('0x4e')]);_0x1cbfab[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x17beef[_0xeb62('0x39')]);_0x1cbfab['filters']=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],_0x1cbfab['query']);_0xfff29b[_0xeb62('0x3c')]=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x17beef[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xfff29b[_0xeb62('0x3c')]=_0xfff29b[_0xeb62('0x3c')]['length']?_0xfff29b[_0xeb62('0x3c')]:_0x1cbfab[_0xeb62('0x3f')];_0xfff29b['order']=qs[_0xeb62('0x42')](_0x17beef['query']['sort']);_0xfff29b[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x17beef[_0xeb62('0x39')],_0x1cbfab[_0xeb62('0x3a')]));if(_0x17beef['query'][_0xeb62('0x45')]){_0xfff29b[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0xfff29b[_0xeb62('0x43')],{'$or':_[_0xeb62('0x34')](_0xfff29b[_0xeb62('0x3c')],function(_0x401ad1){var _0x50170b={};_0x50170b[_0x401ad1]={'$like':'%'+_0x17beef['query']['filter']+'%'};return _0x50170b;})});}_0xfff29b=_[_0xeb62('0x46')]({},_0xfff29b,_0x17beef[_0xeb62('0x47')]);return _0x29648f[_0xeb62('0x7d')](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x599418){if(_0x599418){_0x2f5f2f=_0x599418[_0xeb62('0x3e')];if(!_0x17beef['query']['hasOwnProperty'](_0xeb62('0x7f'))){_0xfff29b[_0xeb62('0x26')]=qs['limit'](_0x17beef[_0xeb62('0x39')]['limit']);_0xfff29b[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x17beef[_0xeb62('0x39')]['offset']);}return _0x29648f['getAgents'](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x276e06){if(_0x276e06){return _0x276e06?{'count':_0x2f5f2f,'rows':_0x276e06}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x45b2a3,null))['catch'](handleError(_0x45b2a3,null));};exports[_0xeb62('0x80')]=function(_0x162993,_0x3f5c93,_0x3b15ec){var _0xca3f0e={};var _0x2e4d99={};var _0x518655;var _0x4cd599;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x162993['params']['id']}})['then'](handleEntityNotFound(_0x3f5c93,null))[_0xeb62('0x2e')](function(_0x49d2c7){if(_0x49d2c7){_0x518655=_0x49d2c7;_0x2e4d99['model']=_['keys'](db[_0xeb62('0x81')]['rawAttributes']);_0x2e4d99[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x162993[_0xeb62('0x39')]);_0x2e4d99[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x2e4d99[_0xeb62('0x3f')],_0x2e4d99[_0xeb62('0x39')]);_0xca3f0e['attributes']=_['intersection'](_0x2e4d99[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x162993[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xca3f0e[_0xeb62('0x3c')]=_0xca3f0e['attributes'][_0xeb62('0x3e')]?_0xca3f0e[_0xeb62('0x3c')]:_0x2e4d99[_0xeb62('0x3f')];_0xca3f0e['order']=qs[_0xeb62('0x42')](_0x162993['query'][_0xeb62('0x42')]);_0xca3f0e[_0xeb62('0x43')]=qs['filters'](_['pick'](_0x162993[_0xeb62('0x39')],_0x2e4d99[_0xeb62('0x3a')]));if(_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]){_0xca3f0e['where']=_[_0xeb62('0x46')](_0xca3f0e[_0xeb62('0x43')],{'$or':_['map'](_0xca3f0e['attributes'],function(_0x12adf6){var _0x1b9569={};_0x1b9569[_0x12adf6]={'$like':'%'+_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]+'%'};return _0x1b9569;})});}_0xca3f0e=_[_0xeb62('0x46')]({},_0xca3f0e,_0x162993[_0xeb62('0x47')]);return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})[_0xeb62('0x2e')](function(_0x144bc8){if(_0x144bc8){_0x4cd599=_0x144bc8[_0xeb62('0x3e')];if(!_0x162993[_0xeb62('0x39')][_0xeb62('0x40')](_0xeb62('0x7f'))){_0xca3f0e[_0xeb62('0x26')]=qs[_0xeb62('0x26')](_0x162993[_0xeb62('0x39')]['limit']);_0xca3f0e[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x162993[_0xeb62('0x39')][_0xeb62('0x24')]);}return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})['then'](function(_0x54984f){if(_0x54984f){return _0x54984f?{'count':_0x4cd599,'rows':_0x54984f}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x3f5c93,null))[_0xeb62('0x4c')](handleError(_0x3f5c93,null));};exports[_0xeb62('0x82')]=function(_0x3d957d,_0x5af4d7,_0x3a0b12){var _0x5f2c1e=_0x3d957d[_0xeb62('0x53')][_0xeb62('0x76')];var _0x3409db;return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x5f2c1e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x83'),'attributes':['id',_0xeb62('0x31'),'online',_0xeb62('0x84'),'interface'],'raw':!![]}]})[_0xeb62('0x2e')](function(_0x43107d){if(_0x43107d){_0x3409db=_0x43107d;var _0x2e503b=_[_0xeb62('0x85')](_0x43107d,function(_0x45a197){var _0x3394e6=_0x45a197['get']({'plain':!![]});return _0x3394e6['Agents'];});return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x3d957d[_0xeb62('0x4d')]['id']}})[_0xeb62('0x2e')](function(_0x582217){return db['sequelize'][_0xeb62('0x73')](function(_0x527de3){return _0x582217[_0xeb62('0x82')](_0x5f2c1e,{'transaction':_0x527de3})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x3409db,function(_0x5e43f0){return db[_0xeb62('0x87')][_0xeb62('0x88')]({'TeamId':_0x5e43f0['id'],'VoicePrefixId':_0x3d957d[_0xeb62('0x4d')]['id']},{'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x2e503b,function(_0x10731b){return db[_0xeb62('0x89')][_0xeb62('0x8a')]({'where':{'UserId':_0x10731b['id'],'VoicePrefixId':_0x3d957d['params']['id']},'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){_0x2e503b[_0xeb62('0x8b')](function(_0x35d372){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':_0x35d372['id'],'VoicePrefixId':_0x582217['id']});});});});});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x5af4d7,null))[_0xeb62('0x4c')](handleError(_0x5af4d7,null));};exports[_0xeb62('0x8c')]=function(_0x146c7e,_0x24c285,_0x59bb00){return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')]},'attributes':['id'],'include':[{'model':db[_0xeb62('0x8d')],'as':_0xeb62('0x83'),'attributes':['id'],'raw':!![]}]})[_0xeb62('0x2e')](handleEntityNotFound(_0x24c285,null))[_0xeb62('0x2e')](function(_0x30625f){var _0x94d0c9=_['map'](_0x30625f,'id');var _0x3ae667=[];var _0x3338ba=[];var _0x50cf9b=squel['select']();_0x50cf9b[_0xeb62('0x8e')](_0xeb62('0x8f'))[_0xeb62('0x90')](_0xeb62('0x91'),'tq')[_0xeb62('0x92')](_0xeb62('0x93'),'ut',_0xeb62('0x94'))[_0xeb62('0x43')](_0xeb62('0x95'),_0x146c7e['params']['id']);for(var _0x535e7a=0x0;_0x535e7a<_0x30625f[_0xeb62('0x3e')];_0x535e7a+=0x1){let _0x43daef=_0x30625f[_0x535e7a];for(var _0x58ffb2=0x0;_0x58ffb2<_0x43daef['Agents'][_0xeb62('0x3e')];_0x58ffb2+=0x1){let _0x341bd8=_0x43daef[_0xeb62('0x83')][_0x58ffb2];var _0x55ef9d=_0x50cf9b['clone']();_0x55ef9d[_0xeb62('0x43')]('ut.UserId\x20=\x20?',_0x341bd8['id']);_0x3338ba[_0xeb62('0x6a')](db[_0xeb62('0x52')][_0xeb62('0x39')](_0x55ef9d['toString'](),{'type':db['sequelize']['QueryTypes'][_0xeb62('0x96')]})[_0xeb62('0x2e')](function(_0x3517db){if(_0x3517db[_0xeb62('0x3e')]===0x1){return _0x341bd8['id'];}else{var _0x5bd3b6=_[_0xeb62('0x97')](_[_0xeb62('0x34')](_0x3517db,_0xeb62('0x98')),function(_0x22eb23){return _[_0xeb62('0x99')](_0x94d0c9,_0x22eb23);});if(_0x5bd3b6){return _0x341bd8['id'];}}}));}}return BPromise[_0xeb62('0x9a')](_0x3338ba)[_0xeb62('0x2e')](function(_0x394573){_0x3ae667=_(_0x3ae667)['union'](_0x394573)[_0xeb62('0x9b')]()[_0xeb62('0x9c')]();return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146c7e['params']['id']}})[_0xeb62('0x2e')](function(_0x1f84f0){return db['sequelize'][_0xeb62('0x73')](function(_0x26b456){return _0x1f84f0[_0xeb62('0x8c')](_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')],{'transaction':_0x26b456})[_0xeb62('0x2e')](function(){if(!_[_0xeb62('0x9d')](_0x3ae667)){return _0x1f84f0['removeAgents'](_0x3ae667,{'transaction':_0x26b456});}})[_0xeb62('0x2e')](function(){_0x3ae667['forEach'](function(_0x3578a9){socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':_0x3578a9,'VoicePrefixId':_0x1f84f0['id']});});});});});});})['then'](respondWithStatusCode(_0x24c285,null))['catch'](handleError(_0x24c285,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 83b2d56..082ca15 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 _0x2d61=['update','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2d61,0x92));var _0x12d6=function(_0x30b992,_0x3c099d){_0x30b992=_0x30b992-0x0;var _0x590b44=_0x2d61[_0x30b992];return _0x590b44;};'use strict';var EventEmitter=require(_0x12d6('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x12d6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x12d6('0x2')](0x0);var events={'afterCreate':_0x12d6('0x3'),'afterUpdate':_0x12d6('0x4'),'afterDestroy':_0x12d6('0x5')};function emitEvent(_0x1a8ae1){return function(_0x4b81c4,_0x14e30c,_0x36600e){VoicePrefixEvents[_0x12d6('0x6')](_0x1a8ae1+':'+_0x4b81c4['id'],_0x4b81c4);VoicePrefixEvents[_0x12d6('0x6')](_0x1a8ae1,_0x4b81c4);_0x36600e(null);};}for(var e in events){if(events[_0x12d6('0x7')](e)){var event=events[e];VoicePrefix[_0x12d6('0x8')](e,emitEvent(event));}}module[_0x12d6('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x96ce=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3896d0,_0xee750d){var _0x1ccb1f=function(_0x3a6138){while(--_0x3a6138){_0x3896d0['push'](_0x3896d0['shift']());}};_0x1ccb1f(++_0xee750d);}(_0x96ce,0xd2));var _0xe96c=function(_0x49e489,_0x198e41){_0x49e489=_0x49e489-0x0;var _0xcc7a16=_0x96ce[_0x49e489];return _0xcc7a16;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xe96c('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe96c('0x1')](0x0);var events={'afterCreate':_0xe96c('0x2'),'afterUpdate':_0xe96c('0x3'),'afterDestroy':_0xe96c('0x4')};function emitEvent(_0x285b69){return function(_0x4c9404,_0x122f43,_0x50a8d6){VoicePrefixEvents[_0xe96c('0x5')](_0x285b69+':'+_0x4c9404['id'],_0x4c9404);VoicePrefixEvents[_0xe96c('0x5')](_0x285b69,_0x4c9404);_0x50a8d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xe96c('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 1c9d37e..dffa0cd 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 _0xa4b3=['voice_prefixes','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa4b3,0xd9));var _0x3a4b=function(_0x5a5de5,_0x2cc3c4){_0x5a5de5=_0x5a5de5-0x0;var _0x188f25=_0xa4b3[_0x5a5de5];return _0x188f25;};'use strict';var _=require(_0x3a4b('0x0'));var util=require(_0x3a4b('0x1'));var logger=require(_0x3a4b('0x2'))(_0x3a4b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a4b('0x4'));var fs=require('fs');var path=require(_0x3a4b('0x5'));var rimraf=require(_0x3a4b('0x6'));var config=require(_0x3a4b('0x7'));var attributes=require(_0x3a4b('0x8'));module['exports']=function(_0x5ba71f,_0x52d3ab){return _0x5ba71f[_0x3a4b('0x9')](_0x3a4b('0xa'),attributes,{'tableName':_0x3a4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9238=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','lodash','util','../../config/logger'];(function(_0x38da4d,_0x2e0982){var _0xbed138=function(_0xf8feee){while(--_0xf8feee){_0x38da4d['push'](_0x38da4d['shift']());}};_0xbed138(++_0x2e0982);}(_0x9238,0x8c));var _0x8923=function(_0x1cee8c,_0x4d7638){_0x1cee8c=_0x1cee8c-0x0;var _0x203eef=_0x9238[_0x1cee8c];return _0x203eef;};'use strict';var _=require(_0x8923('0x0'));var util=require(_0x8923('0x1'));var logger=require(_0x8923('0x2'))(_0x8923('0x3'));var moment=require('moment');var BPromise=require(_0x8923('0x4'));var rp=require(_0x8923('0x5'));var fs=require('fs');var path=require(_0x8923('0x6'));var rimraf=require(_0x8923('0x7'));var config=require(_0x8923('0x8'));var attributes=require(_0x8923('0x9'));module['exports']=function(_0xfb4af9,_0x599c4a){return _0xfb4af9['define'](_0x8923('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ca1b149..8dafffd 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 _0x3914=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','register','request'];(function(_0x3ec63e,_0x5bda12){var _0x43c4b0=function(_0x5310f8){while(--_0x5310f8){_0x3ec63e['push'](_0x3ec63e['shift']());}};_0x43c4b0(++_0x5bda12);}(_0x3914,0xeb));var _0x4391=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3914[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var moment=require('moment');var BPromise=require(_0x4391('0x2'));var rs=require(_0x4391('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4391('0x4'))['db'];var utils=require(_0x4391('0x5'));var logger=require(_0x4391('0x6'))('rpc');var config=require(_0x4391('0x7'));var jayson=require(_0x4391('0x8'));var client=jayson['client'][_0x4391('0x9')]({'port':0x232a});config['redis']=_[_0x4391('0xa')](config['redis'],{'host':_0x4391('0xb'),'port':0x18eb});var socket=require(_0x4391('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x4391('0xd')](socket);function respondWithRpcPromise(_0x1b726e,_0x3539e3,_0x537a92){return new BPromise(function(_0x2dc345,_0x2e2293){return client[_0x4391('0xe')](_0x1b726e,_0x537a92)[_0x4391('0xf')](function(_0x5c932f){logger[_0x4391('0x10')](_0x4391('0x11'),_0x3539e3,_0x4391('0x12'));logger[_0x4391('0x13')](_0x4391('0x14'),_0x3539e3,_0x4391('0x12'),JSON[_0x4391('0x15')](_0x5c932f));if(_0x5c932f[_0x4391('0x16')]){if(_0x5c932f['error'][_0x4391('0x17')]===0x1f4){logger[_0x4391('0x16')](_0x4391('0x11'),_0x3539e3,_0x5c932f[_0x4391('0x16')]['message']);return _0x2e2293(_0x5c932f[_0x4391('0x16')]['message']);}logger[_0x4391('0x16')](_0x4391('0x11'),_0x3539e3,_0x5c932f[_0x4391('0x16')][_0x4391('0x18')]);return _0x2dc345(_0x5c932f[_0x4391('0x16')][_0x4391('0x18')]);}else{logger[_0x4391('0x10')](_0x4391('0x11'),_0x3539e3,'request\x20sent');_0x2dc345(_0x5c932f['result'][_0x4391('0x18')]);}})['catch'](function(_0x42454e){logger[_0x4391('0x16')](_0x4391('0x11'),_0x3539e3,_0x42454e);_0x2e2293(_0x42454e);});});} \ No newline at end of file +var _0xf02c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0xf02c,0x92));var _0xcf02=function(_0x182853,_0x173df6){_0x182853=_0x182853-0x0;var _0x423498=_0xf02c[_0x182853];return _0x423498;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});config[_0xcf02('0xe')]=_['defaults'](config[_0xcf02('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf02('0xf'))[_0xcf02('0x10')](socket);function respondWithRpcPromise(_0x1411e5,_0x1c9cda,_0x5bd27c){return new BPromise(function(_0x70fe11,_0x2c0978){return client[_0xcf02('0x11')](_0x1411e5,_0x5bd27c)['then'](function(_0x48c0d8){logger[_0xcf02('0x12')](_0xcf02('0x13'),_0x1c9cda,_0xcf02('0x14'));logger[_0xcf02('0x15')](_0xcf02('0x16'),_0x1c9cda,'request\x20sent',JSON[_0xcf02('0x17')](_0x48c0d8));if(_0x48c0d8[_0xcf02('0x18')]){if(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x19')]===0x1f4){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x48c0d8[_0xcf02('0x18')]['message']);return _0x2c0978(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}logger[_0xcf02('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x1c9cda,_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);return _0x70fe11(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1c9cda,'request\x20sent');_0x70fe11(_0x48c0d8[_0xcf02('0x1b')]['message']);}})[_0xcf02('0x1c')](function(_0x1cac37){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x1cac37);_0x2c0978(_0x1cac37);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a80928c..59a03ef 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 _0xe58a=['remove','emit','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xe58a,0x9f));var _0xae58=function(_0xf36735,_0x5a8bcb){_0xf36735=_0xf36735-0x0;var _0x33ec1b=_0xe58a[_0xf36735];return _0x33ec1b;};'use strict';var VoicePrefixEvents=require(_0xae58('0x0'));var events=[_0xae58('0x1'),_0xae58('0x2'),'update'];function createListener(_0x224996,_0x508cff){return function(_0x5e74b5){_0x508cff[_0xae58('0x3')](_0x224996,_0x5e74b5);};}function removeListener(_0x4a8df4,_0x4df1a3){return function(){VoicePrefixEvents[_0xae58('0x4')](_0x4a8df4,_0x4df1a3);};}exports['register']=function(_0x198e0c){for(var _0x29749a=0x0,_0x2bd284=events[_0xae58('0x5')];_0x29749a<_0x2bd284;_0x29749a++){var _0x703a03=events[_0x29749a];var _0x7cb067=createListener(_0xae58('0x6')+_0x703a03,_0x198e0c);VoicePrefixEvents['on'](_0x703a03,_0x7cb067);}}; \ No newline at end of file +var _0x43b1=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x4cd96e,_0x220bba){var _0x37c2da=function(_0xbe1e0e){while(--_0xbe1e0e){_0x4cd96e['push'](_0x4cd96e['shift']());}};_0x37c2da(++_0x220bba);}(_0x43b1,0x7d));var _0x143b=function(_0x24553a,_0x543350){_0x24553a=_0x24553a-0x0;var _0x35381f=_0x43b1[_0x24553a];return _0x35381f;};'use strict';var VoicePrefixEvents=require(_0x143b('0x0'));var events=[_0x143b('0x1'),_0x143b('0x2'),'update'];function createListener(_0xb377ea,_0x4976d0){return function(_0x1e1282){_0x4976d0[_0x143b('0x3')](_0xb377ea,_0x1e1282);};}function removeListener(_0x223e86,_0x1552bc){return function(){VoicePrefixEvents[_0x143b('0x4')](_0x223e86,_0x1552bc);};}exports[_0x143b('0x5')]=function(_0x4be3bc){for(var _0x263d20=0x0,_0x2236ae=events[_0x143b('0x6')];_0x263d20<_0x2236ae;_0x263d20++){var _0x519333=events[_0x263d20];var _0x453a09=createListener(_0x143b('0x7')+_0x519333,_0x4be3bc);VoicePrefixEvents['on'](_0x519333,_0x453a09);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b98859c..ecada28 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xb10b,0x12a));var _0xbb10=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0xb10b[_0x53f715];return _0x16c757;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xb10b[_0x5d6c3e];return _0x44ecb7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9ab0f4d..74d1040 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 _0x756e=['Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','ENUM','inbound','default','ringall','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.'];(function(_0x57c7e4,_0x1d27cd){var _0x5db19d=function(_0x539090){while(--_0x539090){_0x57c7e4['push'](_0x57c7e4['shift']());}};_0x5db19d(++_0x1d27cd);}(_0x756e,0xb5));var _0xe756=function(_0x5250f2,_0x360337){_0x5250f2=_0x5250f2-0x0;var _0x41c5a7=_0x756e[_0x5250f2];return _0x41c5a7;};'use strict';var Sequelize=require('sequelize');module[_0xe756('0x0')]={'name':{'type':Sequelize[_0xe756('0x1')],'allowNull':![],'unique':_0xe756('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe756('0x3')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xe756('0x4')},'musiconhold':{'type':Sequelize[_0xe756('0x1')],'defaultValue':_0xe756('0x5')},'announce':{'type':Sequelize[_0xe756('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe756('0x3')]('rr',_0xe756('0x6'),'leastrecent',_0xe756('0x7'),_0xe756('0x8'),_0xe756('0x9'),'linear','wrandom',_0xe756('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0xd33c05){this[_0xe756('0xb')](_0xe756('0xc'),_0xd33c05?_0xd33c05:_0xe756('0x9'));},'get':function(){var _0x3d1947=this[_0xe756('0xd')](_0xe756('0xe'));var _0x2619dc=this[_0xe756('0xd')]('dialMethod');var _0x24d3b8=this[_0xe756('0xd')](_0xe756('0xc'));if(_0x3d1947==='outbound'){if(_0x2619dc===_0xe756('0xf')){return null;}if(_0x2619dc===_0xe756('0x10')&&!['rrmemory',_0xe756('0x11')][_0xe756('0x12')](_0x24d3b8)){this[_0xe756('0xb')](_0xe756('0xc'),'rrmemory');}}return _0x24d3b8;}},'servicelevel':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe756('0x1')]},'weight':{'type':Sequelize[_0xe756('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':_0xe756('0x14')},'autopause':{'type':Sequelize[_0xe756('0x3')]('yes','no',_0xe756('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe756('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xe756('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe756('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe756('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xe756('0x14'),'no'),'defaultValue':_0xe756('0x14')},'announce_holdtime':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no',_0xe756('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe756('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xe756('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe756('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe756('0x1')]},'queue_youarenext':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe756('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe756('0x1')]},'queue_quantity1':{'type':Sequelize[_0xe756('0x1')]},'queue_quantity2':{'type':Sequelize[_0xe756('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xe756('0x1')]},'queue_less_than':{'type':Sequelize[_0xe756('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x54001f){this[_0xe756('0xb')](_0xe756('0x17'),_0x54001f?_0x54001f[_0xe756('0x18')](','):[]);},'get':function(){return this[_0xe756('0xd')](_0xe756('0x17'))?this[_0xe756('0xd')](_0xe756('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xe756('0x1')],'defaultValue':_0xe756('0x14'),'set':function(_0x57c063){this['setDataValue']('joinempty',_0x57c063?_0x57c063[_0xe756('0x18')](','):undefined);},'get':function(){return this[_0xe756('0xd')](_0xe756('0x19'))?this[_0xe756('0xd')](_0xe756('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe756('0x1')],'defaultValue':'no','set':function(_0x2d9886){this[_0xe756('0xb')](_0xe756('0x1a'),_0x2d9886?_0x2d9886['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xe756('0x1a'))?this[_0xe756('0xd')](_0xe756('0x1a'))[_0xe756('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe756('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe756('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xe756('0x1c')],'defaultValue':0x0,'set':function(_0x374c45){this[_0xe756('0xb')](_0xe756('0x1d'),_0x374c45);if(_0x374c45){if(this[_0xe756('0xd')]('wrapuptime')<0x2){this[_0xe756('0xb')](_0xe756('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe756('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe756('0x1c')],'defaultValue':0x0,'comment':_0xe756('0x1f')},'dialMethod':{'type':Sequelize[_0xe756('0x3')]('preview',_0xe756('0x20'),'power',_0xe756('0x21'),_0xe756('0x10')),'defaultValue':_0xe756('0x20'),'comment':_0xe756('0x22')},'dialLimitChannel':{'type':Sequelize[_0xe756('0x13')](0x4)[_0xe756('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xe756('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe756('0x24')},'dialPowerLevel':{'type':Sequelize[_0xe756('0x25')](0x2)[_0xe756('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe756('0x26'),_0xe756('0x27')),'defaultValue':_0xe756('0x27'),'comment':_0xe756('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe756('0x25')](0x2)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe756('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe756('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe756('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe756('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xe756('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0xe756('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xe756('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe756('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'comment':_0xe756('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe756('0x30')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe756('0x31')},'dialTimezone':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe756('0x1')],'defaultValue':_0xe756('0x32')},'dialPrefix':{'type':Sequelize[_0xe756('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x33'),_0xe756('0x34'),_0xe756('0x35')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe756('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe756('0x36')},'dialAMDGreeting':{'type':Sequelize[_0xe756('0x13')](0x9)[_0xe756('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe756('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe756('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe756('0x13')](0x9)[_0xe756('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe756('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe756('0x13')](0x9)[_0xe756('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe756('0x13')](0x9)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe756('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe756('0x13')](0x5)[_0xe756('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe756('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe756('0x13')](0x9)[_0xe756('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe756('0x3b')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xe756('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe756('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xe756('0x1c')],'defaultValue':0x0,'comment':_0xe756('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe756('0x3')](_0xe756('0x3e'),_0xe756('0x3f')),'defaultValue':_0xe756('0x3e')},'dialQueueProject2':{'type':Sequelize[_0xe756('0x1')],'comment':_0xe756('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe756('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe756('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe756('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe756('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe756('0x13')](0x3)[_0xe756('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe756('0x13')](0x5)[_0xe756('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe756('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe756('0x13')],'allowNull':!![],'comment':_0xe756('0x47')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe756('0x48'),'set':function(_0x5bcf09){if(!_0x5bcf09)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe756('0xb')](_0xe756('0x49'),_0x5bcf09);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe756('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe756('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe756('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0xff25=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xff25,0x135));var _0x5ff2=function(_0x2dd61d,_0x161481){_0x2dd61d=_0x2dd61d-0x0;var _0x2ad4a8=_0xff25[_0x2dd61d];return _0x2ad4a8;};'use strict';var Sequelize=require(_0x5ff2('0x0'));module[_0x5ff2('0x1')]={'name':{'type':Sequelize[_0x5ff2('0x2')],'allowNull':![],'unique':_0x5ff2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5ff2('0x4'),_0x5ff2('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':_0x5ff2('0x6')},'announce':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5ff2('0x7')]('rr',_0x5ff2('0x8'),_0x5ff2('0x9'),'fewestcalls',_0x5ff2('0xa'),_0x5ff2('0xb'),_0x5ff2('0xc'),_0x5ff2('0xd'),_0x5ff2('0xe')),'allowNull':![],'defaultValue':_0x5ff2('0x8'),'set':function(_0xe7491a){this['setDataValue'](_0x5ff2('0xf'),_0xe7491a?_0xe7491a:_0x5ff2('0xb'));},'get':function(){var _0x2c66ca=this[_0x5ff2('0x10')](_0x5ff2('0x11'));var _0x1d615b=this[_0x5ff2('0x10')](_0x5ff2('0x12'));var _0x51f477=this[_0x5ff2('0x10')](_0x5ff2('0xf'));if(_0x2c66ca===_0x5ff2('0x5')){if(_0x1d615b===_0x5ff2('0x13')){return null;}if(_0x1d615b===_0x5ff2('0x14')&&![_0x5ff2('0xb'),_0x5ff2('0x15')][_0x5ff2('0x16')](_0x51f477)){this[_0x5ff2('0x17')](_0x5ff2('0xf'),_0x5ff2('0xb'));}}return _0x51f477;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5ff2('0x18')](0xb)},'timeout':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x5ff2('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':_0x5ff2('0x19')},'autopause':{'type':Sequelize['ENUM'](_0x5ff2('0x19'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x5ff2('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x5ff2('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5ff2('0x7')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5ff2('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5ff2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5ff2('0x7')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':_0x5ff2('0x19')},'announce_holdtime':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5ff2('0x7')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x5ff2('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5ff2('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5ff2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x5ff2('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x5ff2('0x2')]},'queue_less_than':{'type':Sequelize[_0x5ff2('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x513804){this[_0x5ff2('0x17')](_0x5ff2('0x1a'),_0x513804?_0x513804[_0x5ff2('0x1b')](','):[]);},'get':function(){return this[_0x5ff2('0x10')](_0x5ff2('0x1a'))?this[_0x5ff2('0x10')](_0x5ff2('0x1a'))[_0x5ff2('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':_0x5ff2('0x19'),'set':function(_0x3462b7){this[_0x5ff2('0x17')](_0x5ff2('0x1d'),_0x3462b7?_0x3462b7['join'](','):undefined);},'get':function(){return this[_0x5ff2('0x10')](_0x5ff2('0x1d'))?this[_0x5ff2('0x10')](_0x5ff2('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':'no','set':function(_0x3b9b9f){this[_0x5ff2('0x17')](_0x5ff2('0x1e'),_0x3b9b9f?_0x3b9b9f[_0x5ff2('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x5ff2('0x1e'))?this['getDataValue'](_0x5ff2('0x1e'))[_0x5ff2('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5ff2('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5ff2('0x7')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5ff2('0x2')]},'description':{'type':Sequelize[_0x5ff2('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x24ced8){this[_0x5ff2('0x17')]('acw',_0x24ced8);if(_0x24ced8){if(this['getDataValue']('wrapuptime')<0x2){this['setDataValue'](_0x5ff2('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':0x0,'comment':_0x5ff2('0x21')},'dialMethod':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x13'),_0x5ff2('0x22'),_0x5ff2('0x23'),'predictive',_0x5ff2('0x14')),'defaultValue':_0x5ff2('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x5ff2('0x18')](0x4)[_0x5ff2('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5ff2('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x5ff2('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x5ff2('0x26'),'dropRate'),'defaultValue':_0x5ff2('0x27'),'comment':_0x5ff2('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5ff2('0x29')](0x2)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5ff2('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5ff2('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5ff2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5ff2('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':'tTxX','comment':_0x5ff2('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x5ff2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x5ff2('0x2')],'comment':_0x5ff2('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5ff2('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5ff2('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5ff2('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':_0x5ff2('0x34')},'dialPrefix':{'type':Sequelize[_0x5ff2('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5ff2('0x7')](_0x5ff2('0x35'),'never','onlyIfOpen'),'defaultValue':_0x5ff2('0x35')},'dialAMDActive':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':0x0,'comment':_0x5ff2('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x5ff2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5ff2('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x5ff2('0x18')](0x9)[_0x5ff2('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5ff2('0x18')](0x9)[_0x5ff2('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5ff2('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5ff2('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5ff2('0x18')](0x9)[_0x5ff2('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5ff2('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5ff2('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5ff2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5ff2('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0x5ff2('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5ff2('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5ff2('0x3d'),_0x5ff2('0x3e')),'defaultValue':_0x5ff2('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x5ff2('0x2')],'comment':_0x5ff2('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5ff2('0x3f')},'dialCutDigit':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5ff2('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5ff2('0x42')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5ff2('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)[_0x5ff2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5ff2('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5ff2('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5ff2('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ff2('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':![],'comment':_0x5ff2('0x49'),'set':function(_0x44c12d){if(!_0x44c12d)this[_0x5ff2('0x17')]('mandatoryDispositionPauseId',null);this[_0x5ff2('0x17')](_0x5ff2('0x4a'),_0x44c12d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5ff2('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5ff2('0x18')](0x3)[_0x5ff2('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 18d12ba..ddd1db7 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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x27bca8,_0x191f63){var _0x370163=function(_0x1329f8){while(--_0x1329f8){_0x27bca8['push'](_0x27bca8['shift']());}};_0x370163(++_0x191f63);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file +var _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x3267ff,_0x177378){var _0xa98fd8=function(_0x21f86e){while(--_0x21f86e){_0x3267ff['push'](_0x3267ff['shift']());}};_0xa98fd8(++_0x177378);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3071cf2..b35ad81 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 _0x1f8d=['emit','exports','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x32b010,_0x1ad95e){var _0xd87995=function(_0x231b7c){while(--_0x231b7c){_0x32b010['push'](_0x32b010['shift']());}};_0xd87995(++_0x1ad95e);}(_0x1f8d,0x1e2));var _0xd1f8=function(_0x1df740,_0x64862f){_0x1df740=_0x1df740-0x0;var _0xf2b262=_0x1f8d[_0x1df740];return _0xf2b262;};'use strict';var EventEmitter=require(_0xd1f8('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xd1f8('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd1f8('0x2')](0x0);var events={'afterCreate':_0xd1f8('0x3'),'afterUpdate':_0xd1f8('0x4'),'afterDestroy':_0xd1f8('0x5')};function emitEvent(_0x3d95ed){return function(_0xbe7c09,_0x53e8a6,_0x882646){VoiceQueueEvents[_0xd1f8('0x6')](_0x3d95ed+':'+_0xbe7c09['id'],_0xbe7c09);VoiceQueueEvents[_0xd1f8('0x6')](_0x3d95ed,_0xbe7c09);_0x882646(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd1f8('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xe3d1=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2330d9,_0x29ea2e){var _0x2df07e=function(_0x59ec1a){while(--_0x59ec1a){_0x2330d9['push'](_0x2330d9['shift']());}};_0x2df07e(++_0x29ea2e);}(_0xe3d1,0x1a8));var _0x1e3d=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0xe3d1[_0x4ded65];return _0x5864fb;};'use strict';var EventEmitter=require(_0x1e3d('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1e3d('0x1')](0x0);var events={'afterCreate':_0x1e3d('0x2'),'afterUpdate':_0x1e3d('0x3'),'afterDestroy':_0x1e3d('0x4')};function emitEvent(_0x53d50c){return function(_0x24aa74,_0x1e58a7,_0x1ecad8){VoiceQueueEvents[_0x1e3d('0x5')](_0x53d50c+':'+_0x24aa74['id'],_0x24aa74);VoiceQueueEvents[_0x1e3d('0x5')](_0x53d50c,_0x24aa74);_0x1ecad8(null);};}for(var e in events){if(events[_0x1e3d('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x1e3d('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index cdde35c..f6b9d62 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x455555,_0x2147fd){var _0x3cb183=function(_0x516a72){while(--_0x516a72){_0x455555['push'](_0x455555['shift']());}};_0x3cb183(++_0x2147fd);}(_0x70e0,0x17b));var _0x070e=function(_0x62eac5,_0x2cc74c){_0x62eac5=_0x62eac5-0x0;var _0x2045e5=_0x70e0[_0x62eac5];return _0x2045e5;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x46f62c,_0x49eb41){var _0x46d994=function(_0x225d69){while(--_0x225d69){_0x46f62c['push'](_0x46f62c['shift']());}};_0x46d994(++_0x49eb41);}(_0x70e0,0x17b));var _0x070e=function(_0x1a9de5,_0x27cec3){_0x1a9de5=_0x1a9de5-0x0;var _0x3f03e9=_0x70e0[_0x1a9de5];return _0x3f03e9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0e62aee..bf3211f 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 _0xfce7=['VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowVoiceQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4aa3e0,_0x57011f){var _0x2bdea7=function(_0x50bee5){while(--_0x50bee5){_0x4aa3e0['push'](_0x4aa3e0['shift']());}};_0x2bdea7(++_0x57011f);}(_0xfce7,0xbc));var _0x7fce=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xfce7[_0x2543d6];return _0x55213c;};'use strict';var _=require(_0x7fce('0x0'));var util=require(_0x7fce('0x1'));var moment=require(_0x7fce('0x2'));var BPromise=require('bluebird');var rs=require(_0x7fce('0x3'));var fs=require('fs');var Redis=require(_0x7fce('0x4'));var db=require(_0x7fce('0x5'))['db'];var utils=require(_0x7fce('0x6'));var logger=require(_0x7fce('0x7'))(_0x7fce('0x8'));var config=require('../../config/environment');var jayson=require(_0x7fce('0x9'));var client=jayson[_0x7fce('0xa')][_0x7fce('0xb')]({'port':0x232a});config['redis']=_[_0x7fce('0xc')](config[_0x7fce('0xd')],{'host':_0x7fce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fce('0xd')]));require(_0x7fce('0xf'))['register'](socket);function respondWithRpcPromise(_0x15a250,_0x5a3fb3,_0x597e5c){return new BPromise(function(_0x528d4f,_0xb0a922){return client[_0x7fce('0x10')](_0x15a250,_0x597e5c)[_0x7fce('0x11')](function(_0x478877){logger[_0x7fce('0x12')](_0x7fce('0x13'),_0x5a3fb3,_0x7fce('0x14'));logger[_0x7fce('0x15')](_0x7fce('0x16'),_0x5a3fb3,'request\x20sent',JSON[_0x7fce('0x17')](_0x478877));if(_0x478877[_0x7fce('0x18')]){if(_0x478877['error'][_0x7fce('0x19')]===0x1f4){logger[_0x7fce('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x5a3fb3,_0x478877[_0x7fce('0x18')][_0x7fce('0x1a')]);return _0xb0a922(_0x478877[_0x7fce('0x18')][_0x7fce('0x1a')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5a3fb3,_0x478877[_0x7fce('0x18')][_0x7fce('0x1a')]);return _0x528d4f(_0x478877[_0x7fce('0x18')]['message']);}else{logger[_0x7fce('0x12')](_0x7fce('0x13'),_0x5a3fb3,_0x7fce('0x14'));_0x528d4f(_0x478877[_0x7fce('0x1b')][_0x7fce('0x1a')]);}})[_0x7fce('0x1c')](function(_0x36b9db){logger['error'](_0x7fce('0x13'),_0x5a3fb3,_0x36b9db);_0xb0a922(_0x36b9db);});});}exports[_0x7fce('0x1d')]=function(_0xe859dd){var _0x4dc6ac=this;return new Promise(function(_0x43b437,_0x47209c){return db[_0x7fce('0x1e')][_0x7fce('0x1f')]({'raw':_0xe859dd[_0x7fce('0x20')]?_0xe859dd[_0x7fce('0x20')][_0x7fce('0x21')]===undefined?!![]:![]:!![],'where':_0xe859dd['options']?_0xe859dd['options'][_0x7fce('0x22')]||null:null,'attributes':_0xe859dd['options']?_0xe859dd['options'][_0x7fce('0x23')]||null:null,'limit':_0xe859dd[_0x7fce('0x20')]?_0xe859dd[_0x7fce('0x20')][_0x7fce('0x24')]||null:null,'include':_0xe859dd[_0x7fce('0x20')]?_0xe859dd[_0x7fce('0x20')][_0x7fce('0x25')]?_['map'](_0xe859dd[_0x7fce('0x20')][_0x7fce('0x25')],function(_0x37dd86){return{'model':db[_0x37dd86[_0x7fce('0x26')]],'as':_0x37dd86['as'],'attributes':_0x37dd86[_0x7fce('0x23')],'include':_0x37dd86['include']?_[_0x7fce('0x27')](_0x37dd86['include'],function(_0x202da5){return{'model':db[_0x202da5['model']],'as':_0x202da5['as'],'attributes':_0x202da5['attributes'],'include':_0x202da5[_0x7fce('0x25')]?_[_0x7fce('0x27')](_0x202da5[_0x7fce('0x25')],function(_0x55ea06){return{'model':db[_0x55ea06[_0x7fce('0x26')]],'as':_0x55ea06['as'],'attributes':_0x55ea06[_0x7fce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5048ac){logger[_0x7fce('0x12')]('GetVoiceQueue',_0xe859dd);logger[_0x7fce('0x15')]('GetVoiceQueue',_0xe859dd,JSON[_0x7fce('0x17')](_0x5048ac));_0x43b437(_0x5048ac);})[_0x7fce('0x1c')](function(_0x9e5fe2){logger[_0x7fce('0x18')](_0x7fce('0x1d'),_0x9e5fe2[_0x7fce('0x1a')],_0xe859dd);_0x47209c(_0x4dc6ac[_0x7fce('0x18')](0x1f4,_0x9e5fe2[_0x7fce('0x1a')]));});});};exports[_0x7fce('0x28')]=function(_0x330286){var _0x25f652=this;return new Promise(function(_0x45753d,_0x2dda72){return db[_0x7fce('0x1e')][_0x7fce('0x29')]({'raw':_0x330286[_0x7fce('0x20')]?_0x330286['options']['raw']===undefined?!![]:![]:!![],'where':_0x330286[_0x7fce('0x20')]?_0x330286[_0x7fce('0x20')]['where']||null:null,'attributes':_0x330286[_0x7fce('0x20')]?_0x330286[_0x7fce('0x20')][_0x7fce('0x23')]||null:null,'include':_0x330286[_0x7fce('0x20')]?_0x330286['options'][_0x7fce('0x25')]?_[_0x7fce('0x27')](_0x330286[_0x7fce('0x20')][_0x7fce('0x25')],function(_0x279e3c){return{'model':db[_0x279e3c['model']],'as':_0x279e3c['as'],'attributes':_0x279e3c[_0x7fce('0x23')],'include':_0x279e3c[_0x7fce('0x25')]?_['map'](_0x279e3c[_0x7fce('0x25')],function(_0x97942c){return{'model':db[_0x97942c[_0x7fce('0x26')]],'as':_0x97942c['as'],'attributes':_0x97942c[_0x7fce('0x23')],'include':_0x97942c[_0x7fce('0x25')]?_['map'](_0x97942c[_0x7fce('0x25')],function(_0x1319d9){return{'model':db[_0x1319d9[_0x7fce('0x26')]],'as':_0x1319d9['as'],'attributes':_0x1319d9[_0x7fce('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7fce('0x11')](function(_0x502c19){logger['info']('ShowVoiceQueue',_0x330286);logger[_0x7fce('0x15')]('ShowVoiceQueue',_0x330286,JSON[_0x7fce('0x17')](_0x502c19));_0x45753d(_0x502c19);})[_0x7fce('0x1c')](function(_0x122566){logger[_0x7fce('0x18')]('ShowVoiceQueue',_0x122566[_0x7fce('0x1a')],_0x330286);_0x2dda72(_0x25f652[_0x7fce('0x18')](0x1f4,_0x122566[_0x7fce('0x1a')]));});});}; \ No newline at end of file +var _0x6d48=['findAll','options','where','limit','include','map','attributes','model','info','stringify','ShowVoiceQueue','VoiceQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetVoiceQueue'];(function(_0x204aba,_0x29005e){var _0x3c42ed=function(_0x9001b0){while(--_0x9001b0){_0x204aba['push'](_0x204aba['shift']());}};_0x3c42ed(++_0x29005e);}(_0x6d48,0x126));var _0x86d4=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0x6d48[_0x90e575];return _0x1aae60;};'use strict';var _=require('lodash');var util=require(_0x86d4('0x0'));var moment=require(_0x86d4('0x1'));var BPromise=require(_0x86d4('0x2'));var rs=require(_0x86d4('0x3'));var fs=require('fs');var Redis=require(_0x86d4('0x4'));var db=require(_0x86d4('0x5'))['db'];var utils=require(_0x86d4('0x6'));var logger=require(_0x86d4('0x7'))(_0x86d4('0x8'));var config=require(_0x86d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x86d4('0xa')][_0x86d4('0xb')]({'port':0x232a});config[_0x86d4('0xc')]=_[_0x86d4('0xd')](config[_0x86d4('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86d4('0xc')]));require(_0x86d4('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e3fe5,_0x1f98aa,_0x5d9502){return new BPromise(function(_0x2325be,_0x1180f9){return client[_0x86d4('0xf')](_0x1e3fe5,_0x5d9502)[_0x86d4('0x10')](function(_0x34e300){logger['info'](_0x86d4('0x11'),_0x1f98aa,'request\x20sent');logger[_0x86d4('0x12')](_0x86d4('0x13'),_0x1f98aa,'request\x20sent',JSON['stringify'](_0x34e300));if(_0x34e300[_0x86d4('0x14')]){if(_0x34e300[_0x86d4('0x14')]['code']===0x1f4){logger[_0x86d4('0x14')](_0x86d4('0x11'),_0x1f98aa,_0x34e300['error']['message']);return _0x1180f9(_0x34e300[_0x86d4('0x14')]['message']);}logger['error'](_0x86d4('0x11'),_0x1f98aa,_0x34e300['error'][_0x86d4('0x15')]);return _0x2325be(_0x34e300['error'][_0x86d4('0x15')]);}else{logger['info'](_0x86d4('0x11'),_0x1f98aa,_0x86d4('0x16'));_0x2325be(_0x34e300[_0x86d4('0x17')]['message']);}})[_0x86d4('0x18')](function(_0x11dab2){logger[_0x86d4('0x14')](_0x86d4('0x11'),_0x1f98aa,_0x11dab2);_0x1180f9(_0x11dab2);});});}exports[_0x86d4('0x19')]=function(_0x53fc9b){var _0x5e3ff3=this;return new Promise(function(_0x1ae8ad,_0x1f7f51){return db['VoiceQueue'][_0x86d4('0x1a')]({'raw':_0x53fc9b[_0x86d4('0x1b')]?_0x53fc9b[_0x86d4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x53fc9b['options']?_0x53fc9b[_0x86d4('0x1b')][_0x86d4('0x1c')]||null:null,'attributes':_0x53fc9b[_0x86d4('0x1b')]?_0x53fc9b[_0x86d4('0x1b')]['attributes']||null:null,'limit':_0x53fc9b[_0x86d4('0x1b')]?_0x53fc9b['options'][_0x86d4('0x1d')]||null:null,'include':_0x53fc9b[_0x86d4('0x1b')]?_0x53fc9b['options'][_0x86d4('0x1e')]?_[_0x86d4('0x1f')](_0x53fc9b[_0x86d4('0x1b')][_0x86d4('0x1e')],function(_0x283404){return{'model':db[_0x283404['model']],'as':_0x283404['as'],'attributes':_0x283404[_0x86d4('0x20')],'include':_0x283404[_0x86d4('0x1e')]?_['map'](_0x283404[_0x86d4('0x1e')],function(_0x2f57f1){return{'model':db[_0x2f57f1[_0x86d4('0x21')]],'as':_0x2f57f1['as'],'attributes':_0x2f57f1[_0x86d4('0x20')],'include':_0x2f57f1['include']?_['map'](_0x2f57f1[_0x86d4('0x1e')],function(_0x19b4ac){return{'model':db[_0x19b4ac[_0x86d4('0x21')]],'as':_0x19b4ac['as'],'attributes':_0x19b4ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x86d4('0x10')](function(_0x204e9d){logger[_0x86d4('0x22')](_0x86d4('0x19'),_0x53fc9b);logger[_0x86d4('0x12')](_0x86d4('0x19'),_0x53fc9b,JSON[_0x86d4('0x23')](_0x204e9d));_0x1ae8ad(_0x204e9d);})['catch'](function(_0x35bd8f){logger[_0x86d4('0x14')](_0x86d4('0x19'),_0x35bd8f[_0x86d4('0x15')],_0x53fc9b);_0x1f7f51(_0x5e3ff3[_0x86d4('0x14')](0x1f4,_0x35bd8f['message']));});});};exports[_0x86d4('0x24')]=function(_0x344420){var _0x4e229b=this;return new Promise(function(_0x4556f4,_0x8b6943){return db[_0x86d4('0x25')][_0x86d4('0x26')]({'raw':_0x344420[_0x86d4('0x1b')]?_0x344420['options'][_0x86d4('0x27')]===undefined?!![]:![]:!![],'where':_0x344420['options']?_0x344420[_0x86d4('0x1b')][_0x86d4('0x1c')]||null:null,'attributes':_0x344420[_0x86d4('0x1b')]?_0x344420['options'][_0x86d4('0x20')]||null:null,'include':_0x344420['options']?_0x344420[_0x86d4('0x1b')]['include']?_['map'](_0x344420[_0x86d4('0x1b')]['include'],function(_0x272fca){return{'model':db[_0x272fca['model']],'as':_0x272fca['as'],'attributes':_0x272fca[_0x86d4('0x20')],'include':_0x272fca[_0x86d4('0x1e')]?_['map'](_0x272fca[_0x86d4('0x1e')],function(_0x1efbf6){return{'model':db[_0x1efbf6[_0x86d4('0x21')]],'as':_0x1efbf6['as'],'attributes':_0x1efbf6[_0x86d4('0x20')],'include':_0x1efbf6[_0x86d4('0x1e')]?_[_0x86d4('0x1f')](_0x1efbf6[_0x86d4('0x1e')],function(_0x1a12b4){return{'model':db[_0x1a12b4['model']],'as':_0x1a12b4['as'],'attributes':_0x1a12b4[_0x86d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x86d4('0x10')](function(_0x2819d3){logger['info'](_0x86d4('0x24'),_0x344420);logger[_0x86d4('0x12')](_0x86d4('0x24'),_0x344420,JSON[_0x86d4('0x23')](_0x2819d3));_0x4556f4(_0x2819d3);})['catch'](function(_0x3c0abc){logger[_0x86d4('0x14')](_0x86d4('0x24'),_0x3c0abc['message'],_0x344420);_0x8b6943(_0x4e229b[_0x86d4('0x14')](0x1f4,_0x3c0abc[_0x86d4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index df3c242..e43da44 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 _0xf672=['./voiceQueue.events','save','update','emit','length','voiceQueue:'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xf672,0x108));var _0x2f67=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf672[_0x49b207];return _0x2dc8fa;};'use strict';var VoiceQueueEvents=require(_0x2f67('0x0'));var events=[_0x2f67('0x1'),'remove',_0x2f67('0x2')];function createListener(_0x1e87e9,_0x598294){return function(_0x334b27){_0x598294[_0x2f67('0x3')](_0x1e87e9,_0x334b27);};}function removeListener(_0x2eab1c,_0x2b13ba){return function(){VoiceQueueEvents['removeListener'](_0x2eab1c,_0x2b13ba);};}exports['register']=function(_0x8ab808){for(var _0xb60e3a=0x0,_0x121644=events[_0x2f67('0x4')];_0xb60e3a<_0x121644;_0xb60e3a++){var _0x2a342a=events[_0xb60e3a];var _0x5bf081=createListener(_0x2f67('0x5')+_0x2a342a,_0x8ab808);VoiceQueueEvents['on'](_0x2a342a,_0x5bf081);}}; \ No newline at end of file +var _0x2036=['length','voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register'];(function(_0x49b3a6,_0x1115c3){var _0x4cd6bd=function(_0x310ba9){while(--_0x310ba9){_0x49b3a6['push'](_0x49b3a6['shift']());}};_0x4cd6bd(++_0x1115c3);}(_0x2036,0x19a));var _0x6203=function(_0x4452fe,_0x52ed57){_0x4452fe=_0x4452fe-0x0;var _0x1a15a8=_0x2036[_0x4452fe];return _0x1a15a8;};'use strict';var VoiceQueueEvents=require(_0x6203('0x0'));var events=[_0x6203('0x1'),_0x6203('0x2'),'update'];function createListener(_0x5f5d9c,_0x591739){return function(_0x1d970a){_0x591739[_0x6203('0x3')](_0x5f5d9c,_0x1d970a);};}function removeListener(_0x1f9cee,_0x358177){return function(){VoiceQueueEvents[_0x6203('0x4')](_0x1f9cee,_0x358177);};}exports[_0x6203('0x5')]=function(_0x444d4e){for(var _0x4c50ac=0x0,_0x6a647=events[_0x6203('0x6')];_0x4c50ac<_0x6a647;_0x4c50ac++){var _0x455035=events[_0x4c50ac];var _0x134874=createListener(_0x6203('0x7')+_0x455035,_0x444d4e);VoiceQueueEvents['on'](_0x455035,_0x134874);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b188cc3..b6f2009 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 _0x997b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','post','create','put','delete','/:id','destroy','multer'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x997b,0x1e3));var _0xb997=function(_0x2ccba8,_0x40ca85){_0x2ccba8=_0x2ccba8-0x0;var _0x370893=_0x997b[_0x2ccba8];return _0x370893;};'use strict';var multer=require(_0xb997('0x0'));var util=require('util');var path=require(_0xb997('0x1'));var timeout=require(_0xb997('0x2'));var express=require(_0xb997('0x3'));var router=express[_0xb997('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb997('0x5'));var interaction=require(_0xb997('0x6'));var config=require(_0xb997('0x7'));var controller=require(_0xb997('0x8'));router[_0xb997('0x9')]('/',auth[_0xb997('0xa')](),controller[_0xb997('0xb')]);router[_0xb997('0x9')]('/describe',auth[_0xb997('0xa')](),controller[_0xb997('0xc')]);router[_0xb997('0x9')](_0xb997('0xd'),auth[_0xb997('0xa')](),controller[_0xb997('0xe')]);router[_0xb997('0x9')]('/:id',auth[_0xb997('0xa')](),controller[_0xb997('0xf')]);router[_0xb997('0x10')]('/',auth[_0xb997('0xa')](),controller[_0xb997('0x11')]);router[_0xb997('0x12')]('/:id',auth[_0xb997('0xa')](),controller['update']);router[_0xb997('0x13')](_0xb997('0x14'),auth[_0xb997('0xa')](),controller[_0xb997('0x15')]);module['exports']=router; \ No newline at end of file +var _0x74e6=['create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74e6,0x123));var _0x674e=function(_0x5e2229,_0x297a48){_0x5e2229=_0x5e2229-0x0;var _0x14cb86=_0x74e6[_0x5e2229];return _0x14cb86;};'use strict';var multer=require(_0x674e('0x0'));var util=require('util');var path=require(_0x674e('0x1'));var timeout=require(_0x674e('0x2'));var express=require(_0x674e('0x3'));var router=express[_0x674e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x674e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x674e('0x6'));var controller=require(_0x674e('0x7'));router[_0x674e('0x8')]('/',auth[_0x674e('0x9')](),controller[_0x674e('0xa')]);router[_0x674e('0x8')](_0x674e('0xb'),auth[_0x674e('0x9')](),controller['describe']);router['get'](_0x674e('0xc'),auth[_0x674e('0x9')](),controller[_0x674e('0xd')]);router[_0x674e('0x8')](_0x674e('0xe'),auth[_0x674e('0x9')](),controller[_0x674e('0xf')]);router[_0x674e('0x10')]('/',auth[_0x674e('0x9')](),controller[_0x674e('0x11')]);router['put'](_0x674e('0xe'),auth[_0x674e('0x9')](),controller[_0x674e('0x12')]);router[_0x674e('0x13')](_0x674e('0xe'),auth['isAuthenticated'](),controller[_0x674e('0x14')]);module[_0x674e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5b683aa..c9be428 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 _0x7f52=['BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','getDataValue','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x7f52,0x18b));var _0x27f5=function(_0x1390a0,_0x499668){_0x1390a0=_0x1390a0-0x0;var _0x359f67=_0x7f52[_0x1390a0];return _0x359f67;};'use strict';var Sequelize=require(_0x27f5('0x0'));var moment=require(_0x27f5('0x1'));module[_0x27f5('0x2')]={'type':{'type':Sequelize[_0x27f5('0x3')]},'uniqueid':{'type':Sequelize[_0x27f5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x27f5('0x3')]},'queue':{'type':Sequelize[_0x27f5('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4b04c2){var _0x35acdf=moment(_0x4b04c2);var _0x1003fd=moment(this[_0x27f5('0x4')]('queuecallerjoinAt'))[_0x27f5('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5a0de5=_0x35acdf['diff'](_0x1003fd,_0x27f5('0x6'));this[_0x27f5('0x7')](_0x27f5('0x8'),_0x4b04c2);this[_0x27f5('0x7')](_0x27f5('0x9'),_0x5a0de5||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x27f5('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x27f5('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x27f5('0xc')]},'queuecallercomplete':{'type':Sequelize[_0x27f5('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x27f5('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x27f5('0xc')]},'queuecallerexitreason':{'type':Sequelize[_0x27f5('0x3')],'comment':_0x27f5('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x27f5('0x3')]},'connectedlinename':{'type':Sequelize[_0x27f5('0x3')]},'accountcode':{'type':Sequelize[_0x27f5('0x3')]},'context':{'type':Sequelize[_0x27f5('0x3')]},'exten':{'type':Sequelize[_0x27f5('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x27f5('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x27f5('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x27f5('0x3')]},'transfer':{'type':Sequelize[_0x27f5('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x27f5('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x27f5('0x3')]},'secondDisposition':{'type':Sequelize[_0x27f5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x27f5('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x27f5('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x27f5('0x3')]}}; \ No newline at end of file +var _0xf688=['moment','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xf688,0x1b2));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8f68('0x0'));var moment=require(_0x8f68('0x1'));module['exports']={'type':{'type':Sequelize[_0x8f68('0x2')]},'uniqueid':{'type':Sequelize[_0x8f68('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8f68('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x8f68('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x8f68('0x3')],'set':function(_0x2fbb3e){var _0x11592f=moment(_0x2fbb3e);var _0x57064f=moment(this[_0x8f68('0x4')]('queuecallerjoinAt'))[_0x8f68('0x5')](_0x8f68('0x6'));var _0x2af257=_0x11592f[_0x8f68('0x7')](_0x57064f,'seconds');this[_0x8f68('0x8')](_0x8f68('0x9'),_0x2fbb3e);this[_0x8f68('0x8')](_0x8f68('0xa'),_0x2af257||null);}},'position':{'type':Sequelize[_0x8f68('0xb')]},'count':{'type':Sequelize[_0x8f68('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x8f68('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8f68('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8f68('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x8f68('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x8f68('0x2')],'comment':_0x8f68('0xd')},'originalposition':{'type':Sequelize[_0x8f68('0xb')]},'channel':{'type':Sequelize[_0x8f68('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8f68('0x2')]},'connectedlinename':{'type':Sequelize[_0x8f68('0x2')]},'accountcode':{'type':Sequelize[_0x8f68('0x2')]},'context':{'type':Sequelize[_0x8f68('0x2')]},'exten':{'type':Sequelize[_0x8f68('0x2')]},'priority':{'type':Sequelize[_0x8f68('0x2')]},'holdtime':{'type':Sequelize[_0x8f68('0xb')]},'mohtime':{'type':Sequelize[_0x8f68('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8f68('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x8f68('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8f68('0x2')],'comment':_0x8f68('0xe')},'transferexten':{'type':Sequelize[_0x8f68('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8f68('0x2')]},'disposition':{'type':Sequelize[_0x8f68('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8f68('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x8f68('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x8f68('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 482dd09..650c4e7 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 _0xfbd4=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','intersection','length','find','create','body','update','params','describe','hasOwnProperty','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','VoiceQueueReport','rawAttributes','type','key','model','query','filters','fields','attributes','nolimit','order','sort','where'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0xfbd4,0xb7));var _0x4fbd=function(_0x3af5d2,_0x19ed6f){_0x3af5d2=_0x3af5d2-0x0;var _0x1a0af1=_0xfbd4[_0x3af5d2];return _0x1a0af1;};'use strict';var emlformat=require(_0x4fbd('0x0'));var rimraf=require(_0x4fbd('0x1'));var zipdir=require(_0x4fbd('0x2'));var jsonpatch=require(_0x4fbd('0x3'));var rp=require(_0x4fbd('0x4'));var moment=require(_0x4fbd('0x5'));var BPromise=require(_0x4fbd('0x6'));var Mustache=require('mustache');var util=require(_0x4fbd('0x7'));var path=require(_0x4fbd('0x8'));var sox=require(_0x4fbd('0x9'));var csv=require(_0x4fbd('0xa'));var ejs=require(_0x4fbd('0xb'));var fs=require('fs');var fs_extra=require(_0x4fbd('0xc'));var _=require(_0x4fbd('0xd'));var squel=require(_0x4fbd('0xe'));var crypto=require('crypto');var jsforce=require(_0x4fbd('0xf'));var deskjs=require(_0x4fbd('0x10'));var toCsv=require(_0x4fbd('0xa'));var querystring=require(_0x4fbd('0x11'));var Papa=require('papaparse');var Redis=require(_0x4fbd('0x12'));var authService=require(_0x4fbd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4fbd('0x14'));var hardwareService=require(_0x4fbd('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4fbd('0x16'));var config=require(_0x4fbd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4fbd('0x18')]=_[_0x4fbd('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fbd('0x18')]));require('./voiceQueueReport.socket')[_0x4fbd('0x1a')](socket);function respondWithStatusCode(_0x3c8f85,_0x1f24f9){_0x1f24f9=_0x1f24f9||0xcc;return function(_0x55cd74){if(_0x55cd74){return _0x3c8f85['sendStatus'](_0x1f24f9);}return _0x3c8f85[_0x4fbd('0x1b')](_0x1f24f9)[_0x4fbd('0x1c')]();};}function respondWithResult(_0x46ed0b,_0x263a33){_0x263a33=_0x263a33||0xc8;return function(_0x2c1546){if(_0x2c1546){return _0x46ed0b[_0x4fbd('0x1b')](_0x263a33)[_0x4fbd('0x1d')](_0x2c1546);}};}function respondWithFilteredResult(_0x3c44b4,_0x428db6){return function(_0x49870a){if(_0x49870a){var _0x45dfa9=typeof _0x428db6[_0x4fbd('0x1e')]===_0x4fbd('0x1f')&&typeof _0x428db6[_0x4fbd('0x20')]===_0x4fbd('0x1f');var _0x218007=_0x49870a[_0x4fbd('0x21')];var _0x36d567=_0x45dfa9?0x0:_0x428db6['offset'];var _0x4eec96=_0x45dfa9?_0x49870a[_0x4fbd('0x21')]:_0x428db6[_0x4fbd('0x1e')]+_0x428db6[_0x4fbd('0x20')];var _0x50a627;if(_0x4eec96>=_0x218007){_0x4eec96=_0x218007;_0x50a627=0xc8;}else{_0x50a627=0xce;}_0x3c44b4['status'](_0x50a627);return _0x3c44b4[_0x4fbd('0x22')](_0x4fbd('0x23'),_0x36d567+'-'+_0x4eec96+'/'+_0x218007)[_0x4fbd('0x1d')](_0x49870a);}return null;};}function patchUpdates(_0x3e506d){return function(_0x33e7a8){try{jsonpatch[_0x4fbd('0x24')](_0x33e7a8,_0x3e506d,!![]);}catch(_0x3e787f){return BPromise[_0x4fbd('0x25')](_0x3e787f);}return _0x33e7a8[_0x4fbd('0x26')]();};}function saveUpdates(_0x32718b,_0x508b99){return function(_0x2bf87a){if(_0x2bf87a){return _0x2bf87a['update'](_0x32718b)[_0x4fbd('0x27')](function(_0x4c966e){return _0x4c966e;});}return null;};}function removeEntity(_0x3c4107,_0x439c93){return function(_0x51204b){if(_0x51204b){return _0x51204b[_0x4fbd('0x28')]()[_0x4fbd('0x27')](function(){_0x3c4107['status'](0xcc)[_0x4fbd('0x1c')]();});}};}function handleEntityNotFound(_0x19c5df,_0x4a68f5){return function(_0x1d5372){if(!_0x1d5372){_0x19c5df[_0x4fbd('0x29')](0x194);}return _0x1d5372;};}function handleError(_0x4e9735,_0x10b7b3){_0x10b7b3=_0x10b7b3||0x1f4;return function(_0x188ae0){logger[_0x4fbd('0x2a')](_0x188ae0[_0x4fbd('0x2b')]);if(_0x188ae0['name']){delete _0x188ae0[_0x4fbd('0x2c')];}_0x4e9735[_0x4fbd('0x1b')](_0x10b7b3)[_0x4fbd('0x2d')](_0x188ae0);};}exports['index']=function(_0x542c59,_0x1b27e5){var _0x41d77f={},_0x34bdf7={},_0x41eee8={'count':0x0,'rows':[]};var _0x430466=_[_0x4fbd('0x2e')](db[_0x4fbd('0x2f')][_0x4fbd('0x30')],function(_0x31e94d){return{'name':_0x31e94d['fieldName'],'type':_0x31e94d[_0x4fbd('0x31')][_0x4fbd('0x32')]};});_0x34bdf7[_0x4fbd('0x33')]=_[_0x4fbd('0x2e')](_0x430466,_0x4fbd('0x2c'));_0x34bdf7['query']=_['keys'](_0x542c59[_0x4fbd('0x34')]);_0x34bdf7[_0x4fbd('0x35')]=_['intersection'](_0x34bdf7[_0x4fbd('0x33')],_0x34bdf7[_0x4fbd('0x34')]);_0x41d77f['attributes']=_['intersection'](_0x34bdf7[_0x4fbd('0x33')],qs[_0x4fbd('0x36')](_0x542c59[_0x4fbd('0x34')][_0x4fbd('0x36')]));_0x41d77f[_0x4fbd('0x37')]=_0x41d77f[_0x4fbd('0x37')]['length']?_0x41d77f[_0x4fbd('0x37')]:_0x34bdf7[_0x4fbd('0x33')];if(!_0x542c59['query']['hasOwnProperty'](_0x4fbd('0x38'))){_0x41d77f[_0x4fbd('0x20')]=qs['limit'](_0x542c59[_0x4fbd('0x34')][_0x4fbd('0x20')]);_0x41d77f[_0x4fbd('0x1e')]=qs['offset'](_0x542c59['query'][_0x4fbd('0x1e')]);}_0x41d77f[_0x4fbd('0x39')]=qs[_0x4fbd('0x3a')](_0x542c59[_0x4fbd('0x34')][_0x4fbd('0x3a')]);_0x41d77f[_0x4fbd('0x3b')]=qs[_0x4fbd('0x35')](_[_0x4fbd('0x3c')](_0x542c59[_0x4fbd('0x34')],_0x34bdf7['filters']),_0x430466);if(_0x542c59[_0x4fbd('0x34')]['filter']){_0x41d77f[_0x4fbd('0x3b')]=_[_0x4fbd('0x3d')](_0x41d77f['where'],{'$or':_[_0x4fbd('0x2e')](_0x430466,function(_0x5a6051){if(_0x5a6051[_0x4fbd('0x31')]!==_0x4fbd('0x3e')){var _0x2b78d0={};_0x2b78d0[_0x5a6051['name']]={'$like':'%'+_0x542c59[_0x4fbd('0x34')][_0x4fbd('0x3f')]+'%'};return _0x2b78d0;}})});}_0x41d77f=_[_0x4fbd('0x3d')]({},_0x41d77f,_0x542c59[_0x4fbd('0x40')]);var _0x465093={'where':_0x41d77f[_0x4fbd('0x3b')]};return db[_0x4fbd('0x2f')][_0x4fbd('0x21')](_0x465093)[_0x4fbd('0x27')](function(_0xf8d99c){_0x41eee8[_0x4fbd('0x21')]=_0xf8d99c;if(_0x542c59[_0x4fbd('0x34')][_0x4fbd('0x41')]){_0x41d77f[_0x4fbd('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x4fbd('0x43')](_0x41d77f);})['then'](function(_0x401baa){_0x41eee8[_0x4fbd('0x44')]=_0x401baa;return _0x41eee8;})['then'](respondWithFilteredResult(_0x1b27e5,_0x41d77f))[_0x4fbd('0x45')](handleError(_0x1b27e5,null));};exports['show']=function(_0x4f3307,_0x9875d2){var _0xa2ad2={'raw':![],'where':{'id':_0x4f3307['params']['id']}},_0x202577={};_0x202577[_0x4fbd('0x33')]=_['keys'](db[_0x4fbd('0x2f')][_0x4fbd('0x30')]);_0x202577[_0x4fbd('0x34')]=_[_0x4fbd('0x46')](_0x4f3307[_0x4fbd('0x34')]);_0x202577[_0x4fbd('0x35')]=_['intersection'](_0x202577[_0x4fbd('0x33')],_0x202577[_0x4fbd('0x34')]);_0xa2ad2[_0x4fbd('0x37')]=_[_0x4fbd('0x47')](_0x202577['model'],qs[_0x4fbd('0x36')](_0x4f3307[_0x4fbd('0x34')]['fields']));_0xa2ad2['attributes']=_0xa2ad2['attributes'][_0x4fbd('0x48')]?_0xa2ad2[_0x4fbd('0x37')]:_0x202577[_0x4fbd('0x33')];if(_0x4f3307[_0x4fbd('0x34')][_0x4fbd('0x41')]){_0xa2ad2[_0x4fbd('0x42')]=[{'all':!![]}];}_0xa2ad2=_[_0x4fbd('0x3d')]({},_0xa2ad2,_0x4f3307[_0x4fbd('0x40')]);return db[_0x4fbd('0x2f')][_0x4fbd('0x49')](_0xa2ad2)['then'](handleEntityNotFound(_0x9875d2,null))['then'](respondWithResult(_0x9875d2,null))[_0x4fbd('0x45')](handleError(_0x9875d2,null));};exports[_0x4fbd('0x4a')]=function(_0x5744f4,_0xa6433c){return db[_0x4fbd('0x2f')]['create'](_0x5744f4[_0x4fbd('0x4b')],{})[_0x4fbd('0x27')](respondWithResult(_0xa6433c,0xc9))[_0x4fbd('0x45')](handleError(_0xa6433c,null));};exports[_0x4fbd('0x4c')]=function(_0x48757b,_0x5e3e35){if(_0x48757b[_0x4fbd('0x4b')]['id']){delete _0x48757b['body']['id'];}return db['VoiceQueueReport'][_0x4fbd('0x49')]({'where':{'id':_0x48757b[_0x4fbd('0x4d')]['id']}})[_0x4fbd('0x27')](handleEntityNotFound(_0x5e3e35,null))['then'](saveUpdates(_0x48757b['body'],null))[_0x4fbd('0x27')](respondWithResult(_0x5e3e35,null))[_0x4fbd('0x45')](handleError(_0x5e3e35,null));};exports[_0x4fbd('0x28')]=function(_0x18e5d5,_0x4e45d2){return db['VoiceQueueReport'][_0x4fbd('0x49')]({'where':{'id':_0x18e5d5['params']['id']}})[_0x4fbd('0x27')](handleEntityNotFound(_0x4e45d2,null))['then'](removeEntity(_0x4e45d2,null))[_0x4fbd('0x45')](handleError(_0x4e45d2,null));};exports[_0x4fbd('0x4e')]=function(_0x4dfb91,_0x501df6){return db[_0x4fbd('0x2f')][_0x4fbd('0x4e')]()['then'](respondWithResult(_0x501df6,null))[_0x4fbd('0x45')](handleError(_0x501df6,null));};exports['getVoiceQueuesReport']=function(_0x475e90,_0x2f2c53){var _0x39c431={},_0x267555={},_0x33380c={'count':0x0,'rows':[]};_0x267555[_0x4fbd('0x33')]=_['keys'](db['VoiceQueueReport'][_0x4fbd('0x30')]);_0x267555[_0x4fbd('0x34')]=_[_0x4fbd('0x46')](_0x475e90['query']);_0x267555['filters']=_[_0x4fbd('0x47')](_0x267555['model'],_0x267555['query']);_0x39c431[_0x4fbd('0x37')]=_[_0x4fbd('0x47')](_0x267555[_0x4fbd('0x33')],qs['fields'](_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x36')]));_0x39c431[_0x4fbd('0x37')]=_0x39c431['attributes'][_0x4fbd('0x48')]?_0x39c431[_0x4fbd('0x37')]:_0x267555[_0x4fbd('0x33')];if(!_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x4f')]('nolimit')){_0x39c431[_0x4fbd('0x20')]=qs[_0x4fbd('0x20')](_0x475e90[_0x4fbd('0x34')]['limit']);_0x39c431['offset']=qs[_0x4fbd('0x1e')](_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x1e')]);}_0x39c431[_0x4fbd('0x39')]=qs[_0x4fbd('0x3a')](_0x475e90['query'][_0x4fbd('0x3a')]);_0x39c431[_0x4fbd('0x3b')]=qs[_0x4fbd('0x35')](_[_0x4fbd('0x3c')](_0x475e90[_0x4fbd('0x34')],_0x267555[_0x4fbd('0x35')]));if(_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x3f')]){_0x39c431[_0x4fbd('0x3b')]=_['merge'](_0x39c431[_0x4fbd('0x3b')],{'$or':_['map'](_0x39c431['attributes'],function(_0x35bb10){var _0x263c84={};_0x263c84[_0x35bb10]={'$like':'%'+_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x3f')]+'%'};return _0x263c84;})});}_0x39c431=_['merge']({},_0x39c431,_0x475e90[_0x4fbd('0x40')]);var _0x39edef={'where':_0x39c431['where']};return db[_0x4fbd('0x2f')][_0x4fbd('0x21')](_0x39edef)['then'](function(_0x26042b){_0x33380c[_0x4fbd('0x21')]=_0x26042b;if(_0x475e90[_0x4fbd('0x34')][_0x4fbd('0x41')]){_0x39c431[_0x4fbd('0x42')]=[{'all':!![]}];}return db[_0x4fbd('0x2f')][_0x4fbd('0x43')](_0x39c431);})[_0x4fbd('0x27')](function(_0x2cfdba){_0x33380c[_0x4fbd('0x44')]=_0x2cfdba;return _0x33380c;})[_0x4fbd('0x27')](respondWithFilteredResult(_0x2f2c53,_0x39c431,_0x4fbd('0x50')))[_0x4fbd('0x45')](handleError(_0x2f2c53,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x8eef=['redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','hasOwnProperty','pick','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x43b9e6,_0x5b5c87){var _0xcbfdbe=function(_0x2fc050){while(--_0x2fc050){_0x43b9e6['push'](_0x43b9e6['shift']());}};_0xcbfdbe(++_0x5b5c87);}(_0x8eef,0x1da));var _0xf8ee=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8eef[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf8ee('0x0'));var rimraf=require(_0xf8ee('0x1'));var zipdir=require(_0xf8ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8ee('0x3'));var moment=require(_0xf8ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8ee('0x5'));var util=require('util');var path=require(_0xf8ee('0x6'));var sox=require(_0xf8ee('0x7'));var csv=require(_0xf8ee('0x8'));var ejs=require(_0xf8ee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8ee('0xa'));var squel=require('squel');var crypto=require(_0xf8ee('0xb'));var jsforce=require(_0xf8ee('0xc'));var deskjs=require(_0xf8ee('0xd'));var toCsv=require(_0xf8ee('0x8'));var querystring=require(_0xf8ee('0xe'));var Papa=require(_0xf8ee('0xf'));var Redis=require('ioredis');var authService=require(_0xf8ee('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf8ee('0x11'));var hardwareService=require(_0xf8ee('0x12'));var logger=require(_0xf8ee('0x13'))(_0xf8ee('0x14'));var utils=require(_0xf8ee('0x15'));var config=require(_0xf8ee('0x16'));var licenseUtil=require(_0xf8ee('0x17'));var db=require('../../mysqldb')['db'];config[_0xf8ee('0x18')]=_[_0xf8ee('0x19')](config[_0xf8ee('0x18')],{'host':_0xf8ee('0x1a'),'port':0x18eb});var socket=require(_0xf8ee('0x1b'))(new Redis(config['redis']));require(_0xf8ee('0x1c'))['register'](socket);function respondWithStatusCode(_0x6c4c1c,_0x5457a7){_0x5457a7=_0x5457a7||0xcc;return function(_0x5988a5){if(_0x5988a5){return _0x6c4c1c[_0xf8ee('0x1d')](_0x5457a7);}return _0x6c4c1c[_0xf8ee('0x1e')](_0x5457a7)[_0xf8ee('0x1f')]();};}function respondWithResult(_0x23303b,_0x5e906d){_0x5e906d=_0x5e906d||0xc8;return function(_0x3a9b45){if(_0x3a9b45){return _0x23303b[_0xf8ee('0x1e')](_0x5e906d)[_0xf8ee('0x20')](_0x3a9b45);}};}function respondWithFilteredResult(_0x5beb7b,_0xe89758){return function(_0x9a1528){if(_0x9a1528){var _0x263dd5=typeof _0xe89758[_0xf8ee('0x21')]===_0xf8ee('0x22')&&typeof _0xe89758[_0xf8ee('0x23')]===_0xf8ee('0x22');var _0x3d651a=_0x9a1528[_0xf8ee('0x24')];var _0x213fe3=_0x263dd5?0x0:_0xe89758[_0xf8ee('0x21')];var _0x41593e=_0x263dd5?_0x9a1528[_0xf8ee('0x24')]:_0xe89758['offset']+_0xe89758['limit'];var _0x3b399a;if(_0x41593e>=_0x3d651a){_0x41593e=_0x3d651a;_0x3b399a=0xc8;}else{_0x3b399a=0xce;}_0x5beb7b['status'](_0x3b399a);return _0x5beb7b[_0xf8ee('0x25')](_0xf8ee('0x26'),_0x213fe3+'-'+_0x41593e+'/'+_0x3d651a)[_0xf8ee('0x20')](_0x9a1528);}return null;};}function patchUpdates(_0x48e070){return function(_0x5c563f){try{jsonpatch['apply'](_0x5c563f,_0x48e070,!![]);}catch(_0x3aa6c2){return BPromise['reject'](_0x3aa6c2);}return _0x5c563f[_0xf8ee('0x27')]();};}function saveUpdates(_0x50ea19,_0x2d7a1a){return function(_0x599d5c){if(_0x599d5c){return _0x599d5c[_0xf8ee('0x28')](_0x50ea19)['then'](function(_0x58384f){return _0x58384f;});}return null;};}function removeEntity(_0x2dea72,_0xb22be3){return function(_0x39e94d){if(_0x39e94d){return _0x39e94d[_0xf8ee('0x29')]()[_0xf8ee('0x2a')](function(){_0x2dea72['status'](0xcc)[_0xf8ee('0x1f')]();});}};}function handleEntityNotFound(_0x3e2ea5,_0xee5704){return function(_0x1fa6e8){if(!_0x1fa6e8){_0x3e2ea5['sendStatus'](0x194);}return _0x1fa6e8;};}function handleError(_0xe0946f,_0x15dcb7){_0x15dcb7=_0x15dcb7||0x1f4;return function(_0x5af13d){logger[_0xf8ee('0x2b')](_0x5af13d[_0xf8ee('0x2c')]);if(_0x5af13d['name']){delete _0x5af13d[_0xf8ee('0x2d')];}_0xe0946f[_0xf8ee('0x1e')](_0x15dcb7)[_0xf8ee('0x2e')](_0x5af13d);};}exports[_0xf8ee('0x2f')]=function(_0x4ee053,_0x187bdc){var _0x722fad={},_0x23bd6c={},_0x300b29={'count':0x0,'rows':[]};var _0x5f16ad=_[_0xf8ee('0x30')](db[_0xf8ee('0x31')][_0xf8ee('0x32')],function(_0x50c5fa){return{'name':_0x50c5fa[_0xf8ee('0x33')],'type':_0x50c5fa[_0xf8ee('0x34')]['key']};});_0x23bd6c[_0xf8ee('0x35')]=_[_0xf8ee('0x30')](_0x5f16ad,_0xf8ee('0x2d'));_0x23bd6c[_0xf8ee('0x36')]=_[_0xf8ee('0x37')](_0x4ee053[_0xf8ee('0x36')]);_0x23bd6c[_0xf8ee('0x38')]=_[_0xf8ee('0x39')](_0x23bd6c[_0xf8ee('0x35')],_0x23bd6c['query']);_0x722fad['attributes']=_['intersection'](_0x23bd6c[_0xf8ee('0x35')],qs[_0xf8ee('0x3a')](_0x4ee053['query'][_0xf8ee('0x3a')]));_0x722fad[_0xf8ee('0x3b')]=_0x722fad[_0xf8ee('0x3b')][_0xf8ee('0x3c')]?_0x722fad['attributes']:_0x23bd6c[_0xf8ee('0x35')];if(!_0x4ee053[_0xf8ee('0x36')]['hasOwnProperty'](_0xf8ee('0x3d'))){_0x722fad[_0xf8ee('0x23')]=qs[_0xf8ee('0x23')](_0x4ee053['query'][_0xf8ee('0x23')]);_0x722fad[_0xf8ee('0x21')]=qs[_0xf8ee('0x21')](_0x4ee053[_0xf8ee('0x36')][_0xf8ee('0x21')]);}_0x722fad[_0xf8ee('0x3e')]=qs['sort'](_0x4ee053[_0xf8ee('0x36')][_0xf8ee('0x3f')]);_0x722fad[_0xf8ee('0x40')]=qs[_0xf8ee('0x38')](_['pick'](_0x4ee053[_0xf8ee('0x36')],_0x23bd6c['filters']),_0x5f16ad);if(_0x4ee053[_0xf8ee('0x36')]['filter']){_0x722fad[_0xf8ee('0x40')]=_[_0xf8ee('0x41')](_0x722fad[_0xf8ee('0x40')],{'$or':_[_0xf8ee('0x30')](_0x5f16ad,function(_0x2f8265){if(_0x2f8265[_0xf8ee('0x34')]!==_0xf8ee('0x42')){var _0x1e6695={};_0x1e6695[_0x2f8265[_0xf8ee('0x2d')]]={'$like':'%'+_0x4ee053['query'][_0xf8ee('0x43')]+'%'};return _0x1e6695;}})});}_0x722fad=_['merge']({},_0x722fad,_0x4ee053[_0xf8ee('0x44')]);var _0x2eba24={'where':_0x722fad[_0xf8ee('0x40')]};return db['VoiceQueueReport'][_0xf8ee('0x24')](_0x2eba24)[_0xf8ee('0x2a')](function(_0x4673e0){_0x300b29[_0xf8ee('0x24')]=_0x4673e0;if(_0x4ee053[_0xf8ee('0x36')][_0xf8ee('0x45')]){_0x722fad[_0xf8ee('0x46')]=[{'all':!![]}];}return db[_0xf8ee('0x31')][_0xf8ee('0x47')](_0x722fad);})['then'](function(_0x52ea57){_0x300b29[_0xf8ee('0x48')]=_0x52ea57;return _0x300b29;})[_0xf8ee('0x2a')](respondWithFilteredResult(_0x187bdc,_0x722fad))['catch'](handleError(_0x187bdc,null));};exports[_0xf8ee('0x49')]=function(_0x336ace,_0x4ff37b){var _0x587fa6={'raw':![],'where':{'id':_0x336ace[_0xf8ee('0x4a')]['id']}},_0x257040={};_0x257040[_0xf8ee('0x35')]=_[_0xf8ee('0x37')](db[_0xf8ee('0x31')]['rawAttributes']);_0x257040['query']=_[_0xf8ee('0x37')](_0x336ace[_0xf8ee('0x36')]);_0x257040['filters']=_[_0xf8ee('0x39')](_0x257040['model'],_0x257040[_0xf8ee('0x36')]);_0x587fa6[_0xf8ee('0x3b')]=_['intersection'](_0x257040[_0xf8ee('0x35')],qs['fields'](_0x336ace[_0xf8ee('0x36')]['fields']));_0x587fa6[_0xf8ee('0x3b')]=_0x587fa6['attributes'][_0xf8ee('0x3c')]?_0x587fa6[_0xf8ee('0x3b')]:_0x257040[_0xf8ee('0x35')];if(_0x336ace[_0xf8ee('0x36')][_0xf8ee('0x45')]){_0x587fa6['include']=[{'all':!![]}];}_0x587fa6=_[_0xf8ee('0x41')]({},_0x587fa6,_0x336ace[_0xf8ee('0x44')]);return db['VoiceQueueReport'][_0xf8ee('0x4b')](_0x587fa6)[_0xf8ee('0x2a')](handleEntityNotFound(_0x4ff37b,null))[_0xf8ee('0x2a')](respondWithResult(_0x4ff37b,null))['catch'](handleError(_0x4ff37b,null));};exports['create']=function(_0x104dc3,_0x43e36d){return db[_0xf8ee('0x31')][_0xf8ee('0x4c')](_0x104dc3[_0xf8ee('0x4d')],{})[_0xf8ee('0x2a')](respondWithResult(_0x43e36d,0xc9))[_0xf8ee('0x4e')](handleError(_0x43e36d,null));};exports[_0xf8ee('0x28')]=function(_0x3d4b46,_0x161c7a){if(_0x3d4b46[_0xf8ee('0x4d')]['id']){delete _0x3d4b46[_0xf8ee('0x4d')]['id'];}return db['VoiceQueueReport'][_0xf8ee('0x4b')]({'where':{'id':_0x3d4b46['params']['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0x161c7a,null))['then'](saveUpdates(_0x3d4b46[_0xf8ee('0x4d')],null))['then'](respondWithResult(_0x161c7a,null))['catch'](handleError(_0x161c7a,null));};exports[_0xf8ee('0x29')]=function(_0x12aa77,_0x4a4431){return db['VoiceQueueReport'][_0xf8ee('0x4b')]({'where':{'id':_0x12aa77[_0xf8ee('0x4a')]['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0x4a4431,null))['then'](removeEntity(_0x4a4431,null))[_0xf8ee('0x4e')](handleError(_0x4a4431,null));};exports[_0xf8ee('0x4f')]=function(_0x4ab70b,_0xb53fe0){return db['VoiceQueueReport']['describe']()['then'](respondWithResult(_0xb53fe0,null))[_0xf8ee('0x4e')](handleError(_0xb53fe0,null));};exports['getVoiceQueuesReport']=function(_0x4c31eb,_0x1578a5){var _0x1ca77e={},_0x5f2bf0={},_0x1041a6={'count':0x0,'rows':[]};_0x5f2bf0['model']=_[_0xf8ee('0x37')](db['VoiceQueueReport'][_0xf8ee('0x32')]);_0x5f2bf0[_0xf8ee('0x36')]=_[_0xf8ee('0x37')](_0x4c31eb[_0xf8ee('0x36')]);_0x5f2bf0[_0xf8ee('0x38')]=_['intersection'](_0x5f2bf0[_0xf8ee('0x35')],_0x5f2bf0[_0xf8ee('0x36')]);_0x1ca77e[_0xf8ee('0x3b')]=_['intersection'](_0x5f2bf0[_0xf8ee('0x35')],qs[_0xf8ee('0x3a')](_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x3a')]));_0x1ca77e[_0xf8ee('0x3b')]=_0x1ca77e[_0xf8ee('0x3b')][_0xf8ee('0x3c')]?_0x1ca77e[_0xf8ee('0x3b')]:_0x5f2bf0[_0xf8ee('0x35')];if(!_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x50')]('nolimit')){_0x1ca77e[_0xf8ee('0x23')]=qs['limit'](_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x23')]);_0x1ca77e[_0xf8ee('0x21')]=qs['offset'](_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x21')]);}_0x1ca77e[_0xf8ee('0x3e')]=qs[_0xf8ee('0x3f')](_0x4c31eb['query'][_0xf8ee('0x3f')]);_0x1ca77e[_0xf8ee('0x40')]=qs[_0xf8ee('0x38')](_[_0xf8ee('0x51')](_0x4c31eb[_0xf8ee('0x36')],_0x5f2bf0[_0xf8ee('0x38')]));if(_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x43')]){_0x1ca77e[_0xf8ee('0x40')]=_[_0xf8ee('0x41')](_0x1ca77e[_0xf8ee('0x40')],{'$or':_[_0xf8ee('0x30')](_0x1ca77e[_0xf8ee('0x3b')],function(_0x5f57e2){var _0x525dc8={};_0x525dc8[_0x5f57e2]={'$like':'%'+_0x4c31eb[_0xf8ee('0x36')][_0xf8ee('0x43')]+'%'};return _0x525dc8;})});}_0x1ca77e=_[_0xf8ee('0x41')]({},_0x1ca77e,_0x4c31eb['options']);var _0x5ec260={'where':_0x1ca77e['where']};return db['VoiceQueueReport'][_0xf8ee('0x24')](_0x5ec260)[_0xf8ee('0x2a')](function(_0x21875b){_0x1041a6[_0xf8ee('0x24')]=_0x21875b;if(_0x4c31eb[_0xf8ee('0x36')]['includeAll']){_0x1ca77e[_0xf8ee('0x46')]=[{'all':!![]}];}return db[_0xf8ee('0x31')][_0xf8ee('0x47')](_0x1ca77e);})[_0xf8ee('0x2a')](function(_0x59fd22){_0x1041a6['rows']=_0x59fd22;return _0x1041a6;})[_0xf8ee('0x2a')](respondWithFilteredResult(_0x1578a5,_0x1ca77e,_0xf8ee('0x52')))[_0xf8ee('0x4e')](handleError(_0x1578a5,null,_0xf8ee('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 21a854a..f6149e1 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 _0xc1de=['save','update','remove','emit','hook','setMaxListeners'];(function(_0x81119e,_0x1789cc){var _0x26bc19=function(_0x1ecaaf){while(--_0x1ecaaf){_0x81119e['push'](_0x81119e['shift']());}};_0x26bc19(++_0x1789cc);}(_0xc1de,0x113));var _0xec1d=function(_0x7719f3,_0x405137){_0x7719f3=_0x7719f3-0x0;var _0x18bb08=_0xc1de[_0x7719f3];return _0x18bb08;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xec1d('0x0')](0x0);var events={'afterCreate':_0xec1d('0x1'),'afterUpdate':_0xec1d('0x2'),'afterDestroy':_0xec1d('0x3')};function emitEvent(_0xe43c00){return function(_0xffc108,_0x198818,_0x1e505d){VoiceQueueReportEvents[_0xec1d('0x4')](_0xe43c00+':'+_0xffc108['id'],_0xffc108);VoiceQueueReportEvents[_0xec1d('0x4')](_0xe43c00,_0xffc108);_0x1e505d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xec1d('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x8cd2=['exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x479164,_0x5f33a0){var _0x40c9d3=function(_0x56ad0b){while(--_0x56ad0b){_0x479164['push'](_0x479164['shift']());}};_0x40c9d3(++_0x5f33a0);}(_0x8cd2,0x12a));var _0x28cd=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0x8cd2[_0x19d350];return _0x3bfc8d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x28cd('0x0'))['db'][_0x28cd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x28cd('0x2')](0x0);var events={'afterCreate':_0x28cd('0x3'),'afterUpdate':_0x28cd('0x4'),'afterDestroy':_0x28cd('0x5')};function emitEvent(_0x145560){return function(_0x44a438,_0x479796,_0x5c0677){VoiceQueueReportEvents['emit'](_0x145560+':'+_0x44a438['id'],_0x44a438);VoiceQueueReportEvents['emit'](_0x145560,_0x44a438);_0x5c0677(null);};}for(var e in events){if(events[_0x28cd('0x6')](e)){var event=events[e];VoiceQueueReport[_0x28cd('0x7')](e,emitEvent(event));}}module[_0x28cd('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7b89319..c62fc1b 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 _0x826b=['report_queue','uniqueid','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueueReport'];(function(_0x121983,_0x582f88){var _0x31a81e=function(_0x427c29){while(--_0x427c29){_0x121983['push'](_0x121983['shift']());}};_0x31a81e(++_0x582f88);}(_0x826b,0x12e));var _0xb826=function(_0x3deea2,_0x59665f){_0x3deea2=_0x3deea2-0x0;var _0x274ca2=_0x826b[_0x3deea2];return _0x274ca2;};'use strict';var _=require(_0xb826('0x0'));var util=require(_0xb826('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb826('0x2'));var BPromise=require(_0xb826('0x3'));var rp=require(_0xb826('0x4'));var fs=require('fs');var path=require(_0xb826('0x5'));var rimraf=require(_0xb826('0x6'));var config=require(_0xb826('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x88e402,_0x561948){return _0x88e402[_0xb826('0x8')](_0xb826('0x9'),attributes,{'tableName':_0xb826('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb826('0xb')]},{'fields':[_0xb826('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5e=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','api','moment','request-promise','path'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9f5e,0x167));var _0xe9f5=function(_0x50c8bd,_0x36cd13){_0x50c8bd=_0x50c8bd-0x0;var _0x3aff8b=_0x9f5e[_0x50c8bd];return _0x3aff8b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe9f5('0x0'));var moment=require(_0xe9f5('0x1'));var BPromise=require('bluebird');var rp=require(_0xe9f5('0x2'));var fs=require('fs');var path=require(_0xe9f5('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9f5('0x4'));module[_0xe9f5('0x5')]=function(_0x11e3dd,_0x2cce1a){return _0x11e3dd[_0xe9f5('0x6')](_0xe9f5('0x7'),attributes,{'tableName':_0xe9f5('0x8'),'paranoid':![],'indexes':[{'fields':[_0xe9f5('0x9')]},{'fields':[_0xe9f5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0cdd610..0d888ec 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 _0x8fd7=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','where','UpdateVoiceQueueReport','lodash','util','moment'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x8fd7,0x1a1));var _0x78fd=function(_0x1f0a7c,_0x49568d){_0x1f0a7c=_0x1f0a7c-0x0;var _0x4ae6bb=_0x8fd7[_0x1f0a7c];return _0x4ae6bb;};'use strict';var _=require(_0x78fd('0x0'));var util=require(_0x78fd('0x1'));var moment=require(_0x78fd('0x2'));var BPromise=require(_0x78fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78fd('0x4'))['db'];var utils=require(_0x78fd('0x5'));var logger=require(_0x78fd('0x6'))(_0x78fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x78fd('0x8'));var client=jayson[_0x78fd('0x9')][_0x78fd('0xa')]({'port':0x232a});config[_0x78fd('0xb')]=_['defaults'](config[_0x78fd('0xb')],{'host':_0x78fd('0xc'),'port':0x18eb});var socket=require(_0x78fd('0xd'))(new Redis(config[_0x78fd('0xb')]));require(_0x78fd('0xe'))[_0x78fd('0xf')](socket);function respondWithRpcPromise(_0x42d2b9,_0x3aa148,_0x27a09a){return new BPromise(function(_0x2adac2,_0x3f7a27){return client['request'](_0x42d2b9,_0x27a09a)[_0x78fd('0x10')](function(_0x328fd7){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x3aa148,'request\x20sent');logger[_0x78fd('0x11')](_0x78fd('0x12'),_0x3aa148,_0x78fd('0x13'),JSON[_0x78fd('0x14')](_0x328fd7));if(_0x328fd7[_0x78fd('0x15')]){if(_0x328fd7[_0x78fd('0x15')]['code']===0x1f4){logger[_0x78fd('0x15')](_0x78fd('0x16'),_0x3aa148,_0x328fd7['error']['message']);return _0x3f7a27(_0x328fd7[_0x78fd('0x15')][_0x78fd('0x17')]);}logger[_0x78fd('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3aa148,_0x328fd7[_0x78fd('0x15')][_0x78fd('0x17')]);return _0x2adac2(_0x328fd7['error']['message']);}else{logger[_0x78fd('0x18')](_0x78fd('0x16'),_0x3aa148,_0x78fd('0x13'));_0x2adac2(_0x328fd7[_0x78fd('0x19')][_0x78fd('0x17')]);}})[_0x78fd('0x1a')](function(_0x34c27e){logger[_0x78fd('0x15')](_0x78fd('0x16'),_0x3aa148,_0x34c27e);_0x3f7a27(_0x34c27e);});});}exports['GetVoiceQueueReport']=function(_0x179a1f){var _0x47830a=this;return new Promise(function(_0x565df6,_0x5041b3){return db[_0x78fd('0x1b')][_0x78fd('0x1c')]({'raw':_0x179a1f['options']?_0x179a1f[_0x78fd('0x1d')][_0x78fd('0x1e')]===undefined?!![]:![]:!![],'where':_0x179a1f[_0x78fd('0x1d')]?_0x179a1f[_0x78fd('0x1d')]['where']||null:null,'attributes':_0x179a1f[_0x78fd('0x1d')]?_0x179a1f['options'][_0x78fd('0x1f')]||null:null,'limit':_0x179a1f[_0x78fd('0x1d')]?_0x179a1f['options'][_0x78fd('0x20')]||null:null,'include':_0x179a1f[_0x78fd('0x1d')]?_0x179a1f[_0x78fd('0x1d')][_0x78fd('0x21')]?_[_0x78fd('0x22')](_0x179a1f[_0x78fd('0x1d')]['include'],function(_0x49fd93){return{'model':db[_0x49fd93[_0x78fd('0x23')]],'as':_0x49fd93['as'],'attributes':_0x49fd93[_0x78fd('0x1f')],'include':_0x49fd93[_0x78fd('0x21')]?_[_0x78fd('0x22')](_0x49fd93['include'],function(_0x22b2d0){return{'model':db[_0x22b2d0[_0x78fd('0x23')]],'as':_0x22b2d0['as'],'attributes':_0x22b2d0[_0x78fd('0x1f')],'include':_0x22b2d0[_0x78fd('0x21')]?_['map'](_0x22b2d0[_0x78fd('0x21')],function(_0x18d6b8){return{'model':db[_0x18d6b8['model']],'as':_0x18d6b8['as'],'attributes':_0x18d6b8[_0x78fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x78fd('0x10')](function(_0x1c14c7){logger[_0x78fd('0x18')](_0x78fd('0x24'),_0x179a1f);logger['debug']('GetVoiceQueueReport',_0x179a1f,JSON['stringify'](_0x1c14c7));_0x565df6(_0x1c14c7);})[_0x78fd('0x1a')](function(_0x1e9f3e){logger[_0x78fd('0x15')](_0x78fd('0x24'),_0x1e9f3e['message'],_0x179a1f);_0x5041b3(_0x47830a[_0x78fd('0x15')](0x1f4,_0x1e9f3e['message']));});});};exports[_0x78fd('0x25')]=function(_0x38299c){var _0x5352f6=this;return new Promise(function(_0x2f01ad,_0x3647e2){return db['VoiceQueueReport'][_0x78fd('0x26')](_0x38299c[_0x78fd('0x27')],{'raw':_0x38299c[_0x78fd('0x1d')]?_0x38299c[_0x78fd('0x1d')][_0x78fd('0x1e')]===undefined?!![]:![]:!![]})[_0x78fd('0x10')](function(_0x15fe4f){logger[_0x78fd('0x18')](_0x78fd('0x25'),_0x38299c);logger['debug'](_0x78fd('0x25'),_0x38299c,JSON[_0x78fd('0x14')](_0x15fe4f));_0x2f01ad(_0x15fe4f);})[_0x78fd('0x1a')](function(_0x157fd3){logger['error'](_0x78fd('0x25'),_0x157fd3[_0x78fd('0x17')],_0x38299c);_0x3647e2(_0x5352f6[_0x78fd('0x15')](0x1f4,_0x157fd3[_0x78fd('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x4481a8){var _0x1a443a=this;return new Promise(function(_0x1c1985,_0x329ccd){return db[_0x78fd('0x1b')]['update'](_0x4481a8[_0x78fd('0x27')],{'raw':_0x4481a8[_0x78fd('0x1d')]?_0x4481a8[_0x78fd('0x1d')][_0x78fd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4481a8[_0x78fd('0x1d')]?_0x4481a8[_0x78fd('0x1d')][_0x78fd('0x28')]||null:null,'attributes':_0x4481a8[_0x78fd('0x1d')]?_0x4481a8['options'][_0x78fd('0x1f')]||null:null,'limit':_0x4481a8[_0x78fd('0x1d')]?_0x4481a8[_0x78fd('0x1d')][_0x78fd('0x20')]||null:null})[_0x78fd('0x10')](function(_0xdac177){logger['info'](_0x78fd('0x29'),_0x4481a8);logger[_0x78fd('0x11')](_0x78fd('0x29'),_0x4481a8,JSON['stringify'](_0xdac177));_0x1c1985(_0xdac177);})[_0x78fd('0x1a')](function(_0x5ebea3){logger[_0x78fd('0x15')](_0x78fd('0x29'),_0x5ebea3['message'],_0x4481a8);_0x329ccd(_0x1a443a[_0x78fd('0x15')](0x1f4,_0x5ebea3[_0x78fd('0x17')]));});});}; \ No newline at end of file +var _0xb1f9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','util','ioredis'];(function(_0x4427bc,_0x4b4cf5){var _0x4f4cd1=function(_0x4281ef){while(--_0x4281ef){_0x4427bc['push'](_0x4427bc['shift']());}};_0x4f4cd1(++_0x4b4cf5);}(_0xb1f9,0xa5));var _0x9b1f=function(_0x530f56,_0x113947){_0x530f56=_0x530f56-0x0;var _0x336b81=_0xb1f9[_0x530f56];return _0x336b81;};'use strict';var _=require(_0x9b1f('0x0'));var util=require(_0x9b1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b1f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b1f('0x3'));var logger=require(_0x9b1f('0x4'))('rpc');var config=require(_0x9b1f('0x5'));var jayson=require(_0x9b1f('0x6'));var client=jayson[_0x9b1f('0x7')][_0x9b1f('0x8')]({'port':0x232a});config[_0x9b1f('0x9')]=_[_0x9b1f('0xa')](config[_0x9b1f('0x9')],{'host':_0x9b1f('0xb'),'port':0x18eb});var socket=require(_0x9b1f('0xc'))(new Redis(config[_0x9b1f('0x9')]));require('./voiceQueueReport.socket')[_0x9b1f('0xd')](socket);function respondWithRpcPromise(_0x10f6c5,_0x4c4210,_0x330a8e){return new BPromise(function(_0x2006ac,_0x49038a){return client['request'](_0x10f6c5,_0x330a8e)[_0x9b1f('0xe')](function(_0x4f5638){logger[_0x9b1f('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x4c4210,_0x9b1f('0x10'));logger[_0x9b1f('0x11')](_0x9b1f('0x12'),_0x4c4210,_0x9b1f('0x10'),JSON[_0x9b1f('0x13')](_0x4f5638));if(_0x4f5638[_0x9b1f('0x14')]){if(_0x4f5638[_0x9b1f('0x14')][_0x9b1f('0x15')]===0x1f4){logger[_0x9b1f('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4c4210,_0x4f5638[_0x9b1f('0x14')][_0x9b1f('0x16')]);return _0x49038a(_0x4f5638['error'][_0x9b1f('0x16')]);}logger[_0x9b1f('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4c4210,_0x4f5638['error'][_0x9b1f('0x16')]);return _0x2006ac(_0x4f5638['error'][_0x9b1f('0x16')]);}else{logger[_0x9b1f('0xf')](_0x9b1f('0x17'),_0x4c4210,_0x9b1f('0x10'));_0x2006ac(_0x4f5638[_0x9b1f('0x18')][_0x9b1f('0x16')]);}})[_0x9b1f('0x19')](function(_0x163271){logger['error'](_0x9b1f('0x17'),_0x4c4210,_0x163271);_0x49038a(_0x163271);});});}exports[_0x9b1f('0x1a')]=function(_0x2b719c){var _0x52a452=this;return new Promise(function(_0x2ec6c6,_0x4ae7fb){return db['VoiceQueueReport'][_0x9b1f('0x1b')]({'raw':_0x2b719c[_0x9b1f('0x1c')]?_0x2b719c[_0x9b1f('0x1c')][_0x9b1f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b719c[_0x9b1f('0x1c')]?_0x2b719c['options']['where']||null:null,'attributes':_0x2b719c[_0x9b1f('0x1c')]?_0x2b719c[_0x9b1f('0x1c')][_0x9b1f('0x1e')]||null:null,'limit':_0x2b719c[_0x9b1f('0x1c')]?_0x2b719c[_0x9b1f('0x1c')][_0x9b1f('0x1f')]||null:null,'include':_0x2b719c[_0x9b1f('0x1c')]?_0x2b719c['options'][_0x9b1f('0x20')]?_[_0x9b1f('0x21')](_0x2b719c[_0x9b1f('0x1c')][_0x9b1f('0x20')],function(_0x3d225f){return{'model':db[_0x3d225f[_0x9b1f('0x22')]],'as':_0x3d225f['as'],'attributes':_0x3d225f['attributes'],'include':_0x3d225f[_0x9b1f('0x20')]?_[_0x9b1f('0x21')](_0x3d225f['include'],function(_0x4b0c2f){return{'model':db[_0x4b0c2f[_0x9b1f('0x22')]],'as':_0x4b0c2f['as'],'attributes':_0x4b0c2f['attributes'],'include':_0x4b0c2f['include']?_[_0x9b1f('0x21')](_0x4b0c2f[_0x9b1f('0x20')],function(_0x44df9e){return{'model':db[_0x44df9e['model']],'as':_0x44df9e['as'],'attributes':_0x44df9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b1f('0xe')](function(_0x13b7c8){logger[_0x9b1f('0xf')](_0x9b1f('0x1a'),_0x2b719c);logger[_0x9b1f('0x11')](_0x9b1f('0x1a'),_0x2b719c,JSON[_0x9b1f('0x13')](_0x13b7c8));_0x2ec6c6(_0x13b7c8);})[_0x9b1f('0x19')](function(_0x53d036){logger[_0x9b1f('0x14')](_0x9b1f('0x1a'),_0x53d036[_0x9b1f('0x16')],_0x2b719c);_0x4ae7fb(_0x52a452['error'](0x1f4,_0x53d036[_0x9b1f('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x20fe94){var _0x324c1e=this;return new Promise(function(_0x99b15e,_0x8e794b){return db[_0x9b1f('0x23')][_0x9b1f('0x24')](_0x20fe94[_0x9b1f('0x25')],{'raw':_0x20fe94[_0x9b1f('0x1c')]?_0x20fe94[_0x9b1f('0x1c')][_0x9b1f('0x1d')]===undefined?!![]:![]:!![]})[_0x9b1f('0xe')](function(_0xceb17b){logger['info'](_0x9b1f('0x26'),_0x20fe94);logger[_0x9b1f('0x11')](_0x9b1f('0x26'),_0x20fe94,JSON['stringify'](_0xceb17b));_0x99b15e(_0xceb17b);})[_0x9b1f('0x19')](function(_0x2842ca){logger[_0x9b1f('0x14')](_0x9b1f('0x26'),_0x2842ca[_0x9b1f('0x16')],_0x20fe94);_0x8e794b(_0x324c1e[_0x9b1f('0x14')](0x1f4,_0x2842ca[_0x9b1f('0x16')]));});});};exports[_0x9b1f('0x27')]=function(_0x5c9d0f){var _0x154489=this;return new Promise(function(_0x13d416,_0x3cc7ef){return db[_0x9b1f('0x23')][_0x9b1f('0x28')](_0x5c9d0f[_0x9b1f('0x25')],{'raw':_0x5c9d0f['options']?_0x5c9d0f[_0x9b1f('0x1c')][_0x9b1f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9d0f[_0x9b1f('0x1c')]?_0x5c9d0f[_0x9b1f('0x1c')][_0x9b1f('0x29')]||null:null,'attributes':_0x5c9d0f[_0x9b1f('0x1c')]?_0x5c9d0f['options'][_0x9b1f('0x1e')]||null:null,'limit':_0x5c9d0f['options']?_0x5c9d0f[_0x9b1f('0x1c')]['limit']||null:null})['then'](function(_0x1c7dea){logger[_0x9b1f('0xf')](_0x9b1f('0x27'),_0x5c9d0f);logger[_0x9b1f('0x11')]('UpdateVoiceQueueReport',_0x5c9d0f,JSON[_0x9b1f('0x13')](_0x1c7dea));_0x13d416(_0x1c7dea);})[_0x9b1f('0x19')](function(_0x503969){logger[_0x9b1f('0x14')]('UpdateVoiceQueueReport',_0x503969['message'],_0x5c9d0f);_0x3cc7ef(_0x154489[_0x9b1f('0x14')](0x1f4,_0x503969[_0x9b1f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2c142f6..dcc632e 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 _0x4491=['remove','emit','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x345209,_0x26625d){var _0x35f98c=function(_0x14837e){while(--_0x14837e){_0x345209['push'](_0x345209['shift']());}};_0x35f98c(++_0x26625d);}(_0x4491,0x1bb));var _0x1449=function(_0x4192bf,_0x5b37d1){_0x4192bf=_0x4192bf-0x0;var _0x409dcf=_0x4491[_0x4192bf];return _0x409dcf;};'use strict';var VoiceQueueReportEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){VoiceQueueReportEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);VoiceQueueReportEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file +var _0xd56f=['remove','emit','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x4db483,_0x5293a9){var _0x401534=function(_0x15d072){while(--_0x15d072){_0x4db483['push'](_0x4db483['shift']());}};_0x401534(++_0x5293a9);}(_0xd56f,0xe8));var _0xfd56=function(_0x23c550,_0x7e41c4){_0x23c550=_0x23c550-0x0;var _0x5635b1=_0xd56f[_0x23c550];return _0x5635b1;};'use strict';var VoiceQueueReportEvents=require(_0xfd56('0x0'));var events=[_0xfd56('0x1'),_0xfd56('0x2'),'update'];function createListener(_0x4299d1,_0x5b83cb){return function(_0x1b786e){_0x5b83cb[_0xfd56('0x3')](_0x4299d1,_0x1b786e);};}function removeListener(_0x529405,_0x27ff71){return function(){VoiceQueueReportEvents['removeListener'](_0x529405,_0x27ff71);};}exports['register']=function(_0x2454ba){for(var _0x1b0f15=0x0,_0x19a142=events[_0xfd56('0x4')];_0x1b0f15<_0x19a142;_0x1b0f15++){var _0x27c05a=events[_0x1b0f15];var _0x2cf392=createListener(_0xfd56('0x5')+_0x27c05a,_0x2454ba);VoiceQueueReportEvents['on'](_0x27c05a,_0x2cf392);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fd03c3e..a8d332a 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 _0x1cd5=['isAuthenticated','index','/:id','create','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x336d41,_0x3c5c0f){var _0x4818d5=function(_0x368dfd){while(--_0x368dfd){_0x336d41['push'](_0x336d41['shift']());}};_0x4818d5(++_0x3c5c0f);}(_0x1cd5,0x107));var _0x51cd=function(_0x3616bc,_0x4b2b8e){_0x3616bc=_0x3616bc-0x0;var _0xd72166=_0x1cd5[_0x3616bc];return _0xd72166;};'use strict';var multer=require('multer');var util=require(_0x51cd('0x0'));var path=require('path');var timeout=require(_0x51cd('0x1'));var express=require(_0x51cd('0x2'));var router=express['Router']();var fs_extra=require(_0x51cd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51cd('0x4'));var config=require(_0x51cd('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x51cd('0x6')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x8')]);router[_0x51cd('0x6')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['show']);router['post']('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0xa')]);router['put'](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xb')]);router[_0x51cd('0xc')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xd')]);module[_0x51cd('0xe')]=router; \ No newline at end of file +var _0x186a=['post','create','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x16139d,_0x2072b0){var _0x28ef10=function(_0x5901e7){while(--_0x5901e7){_0x16139d['push'](_0x16139d['shift']());}};_0x28ef10(++_0x2072b0);}(_0x186a,0x15c));var _0xa186=function(_0x25d05a,_0x3db953){_0x25d05a=_0x25d05a-0x0;var _0x53a466=_0x186a[_0x25d05a];return _0x53a466;};'use strict';var multer=require(_0xa186('0x0'));var util=require(_0xa186('0x1'));var path=require(_0xa186('0x2'));var timeout=require('connect-timeout');var express=require(_0xa186('0x3'));var router=express[_0xa186('0x4')]();var fs_extra=require(_0xa186('0x5'));var auth=require(_0xa186('0x6'));var interaction=require(_0xa186('0x7'));var config=require(_0xa186('0x8'));var controller=require(_0xa186('0x9'));router[_0xa186('0xa')]('/',auth[_0xa186('0xb')](),controller[_0xa186('0xc')]);router[_0xa186('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa186('0xd')]('/',auth[_0xa186('0xb')](),controller[_0xa186('0xe')]);router[_0xa186('0xf')]('/:id',auth[_0xa186('0xb')](),controller['update']);router['delete'](_0xa186('0x10'),auth[_0xa186('0xb')](),controller[_0xa186('0x11')]);module[_0xa186('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b3fb680..1c55968 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 _0xfeba=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x28a611,_0x3102f9){var _0x3b87b4=function(_0x125d1f){while(--_0x125d1f){_0x28a611['push'](_0x28a611['shift']());}};_0x3b87b4(++_0x3102f9);}(_0xfeba,0x1ca));var _0xafeb=function(_0x2ba08d,_0x33204f){_0x2ba08d=_0x2ba08d-0x0;var _0x282cf1=_0xfeba[_0x2ba08d];return _0x282cf1;};'use strict';var Sequelize=require(_0xafeb('0x0'));var moment=require('moment');module[_0xafeb('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xafeb('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xafeb('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xafeb('0x4'))}}; \ No newline at end of file +var _0x2adc=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','literal'];(function(_0x3905da,_0xcfe5f1){var _0x34f4fc=function(_0x4c76c6){while(--_0x4c76c6){_0x3905da['push'](_0x3905da['shift']());}};_0x34f4fc(++_0xcfe5f1);}(_0x2adc,0xaf));var _0xc2ad=function(_0x2edefe,_0x3802ff){_0x2edefe=_0x2edefe-0x0;var _0xff9cfa=_0x2adc[_0x2edefe];return _0xff9cfa;};'use strict';var Sequelize=require(_0xc2ad('0x0'));var moment=require(_0xc2ad('0x1'));module[_0xc2ad('0x2')]={'time':{'type':Sequelize[_0xc2ad('0x3')]},'callid':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc2ad('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc2ad('0x4')](_0xc2ad('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e21b31b..02975bc 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 _0x9cc0=['show','params','include','merge','options','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','update','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','includeAll','findAll','rows','catch'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x9cc0,0x16c));var _0x09cc=function(_0x4a7b46,_0x5e916c){_0x4a7b46=_0x4a7b46-0x0;var _0x436bee=_0x9cc0[_0x4a7b46];return _0x436bee;};'use strict';var emlformat=require(_0x09cc('0x0'));var rimraf=require(_0x09cc('0x1'));var zipdir=require(_0x09cc('0x2'));var jsonpatch=require(_0x09cc('0x3'));var rp=require(_0x09cc('0x4'));var moment=require(_0x09cc('0x5'));var BPromise=require(_0x09cc('0x6'));var Mustache=require('mustache');var util=require(_0x09cc('0x7'));var path=require('path');var sox=require(_0x09cc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09cc('0x9'));var _=require(_0x09cc('0xa'));var squel=require(_0x09cc('0xb'));var crypto=require(_0x09cc('0xc'));var jsforce=require(_0x09cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x09cc('0xe'));var querystring=require(_0x09cc('0xf'));var Papa=require(_0x09cc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x09cc('0x11'));var as=require(_0x09cc('0x12'));var hardwareService=require(_0x09cc('0x13'));var logger=require(_0x09cc('0x14'))(_0x09cc('0x15'));var utils=require(_0x09cc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x09cc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336ba4,_0x44025e){_0x44025e=_0x44025e||0xcc;return function(_0x129164){if(_0x129164){return _0x336ba4[_0x09cc('0x18')](_0x44025e);}return _0x336ba4[_0x09cc('0x19')](_0x44025e)[_0x09cc('0x1a')]();};}function respondWithResult(_0xba8145,_0x2f17b7){_0x2f17b7=_0x2f17b7||0xc8;return function(_0x42cc0a){if(_0x42cc0a){return _0xba8145['status'](_0x2f17b7)[_0x09cc('0x1b')](_0x42cc0a);}};}function respondWithFilteredResult(_0x5e81c5,_0x564b8b){return function(_0xf020df){if(_0xf020df){var _0x5060ca=typeof _0x564b8b['offset']===_0x09cc('0x1c')&&typeof _0x564b8b[_0x09cc('0x1d')]===_0x09cc('0x1c');var _0x1bf99d=_0xf020df['count'];var _0x36144f=_0x5060ca?0x0:_0x564b8b[_0x09cc('0x1e')];var _0x248fdb=_0x5060ca?_0xf020df[_0x09cc('0x1f')]:_0x564b8b[_0x09cc('0x1e')]+_0x564b8b[_0x09cc('0x1d')];var _0x2a1b19;if(_0x248fdb>=_0x1bf99d){_0x248fdb=_0x1bf99d;_0x2a1b19=0xc8;}else{_0x2a1b19=0xce;}_0x5e81c5[_0x09cc('0x19')](_0x2a1b19);return _0x5e81c5['set']('Content-Range',_0x36144f+'-'+_0x248fdb+'/'+_0x1bf99d)['json'](_0xf020df);}return null;};}function patchUpdates(_0x4529d5){return function(_0x3c69a1){try{jsonpatch[_0x09cc('0x20')](_0x3c69a1,_0x4529d5,!![]);}catch(_0x2a0598){return BPromise[_0x09cc('0x21')](_0x2a0598);}return _0x3c69a1['save']();};}function saveUpdates(_0x50c3e9,_0x2f3db4){return function(_0x108d88){if(_0x108d88){return _0x108d88[_0x09cc('0x22')](_0x50c3e9)[_0x09cc('0x23')](function(_0x207130){return _0x207130;});}return null;};}function removeEntity(_0x489545,_0x3a0966){return function(_0x54adaf){if(_0x54adaf){return _0x54adaf['destroy']()[_0x09cc('0x23')](function(){_0x489545['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcb5eab,_0x63fef2){return function(_0x1be4c8){if(!_0x1be4c8){_0xcb5eab[_0x09cc('0x18')](0x194);}return _0x1be4c8;};}function handleError(_0x31fec2,_0x3cc331){_0x3cc331=_0x3cc331||0x1f4;return function(_0x5f8cd5){logger[_0x09cc('0x24')](_0x5f8cd5[_0x09cc('0x25')]);if(_0x5f8cd5[_0x09cc('0x26')]){delete _0x5f8cd5['name'];}_0x31fec2['status'](_0x3cc331)[_0x09cc('0x27')](_0x5f8cd5);};}exports['index']=function(_0x1291b4,_0x3dae56){var _0xce4000={},_0x1d7ea2={},_0x5dc25c={'count':0x0,'rows':[]};var _0x43f3f2=_[_0x09cc('0x28')](db[_0x09cc('0x29')][_0x09cc('0x2a')],function(_0x1b647a){return{'name':_0x1b647a[_0x09cc('0x2b')],'type':_0x1b647a[_0x09cc('0x2c')]['key']};});_0x1d7ea2[_0x09cc('0x2d')]=_[_0x09cc('0x28')](_0x43f3f2,_0x09cc('0x26'));_0x1d7ea2[_0x09cc('0x2e')]=_[_0x09cc('0x2f')](_0x1291b4[_0x09cc('0x2e')]);_0x1d7ea2[_0x09cc('0x30')]=_[_0x09cc('0x31')](_0x1d7ea2[_0x09cc('0x2d')],_0x1d7ea2[_0x09cc('0x2e')]);_0xce4000[_0x09cc('0x32')]=_[_0x09cc('0x31')](_0x1d7ea2['model'],qs[_0x09cc('0x33')](_0x1291b4[_0x09cc('0x2e')][_0x09cc('0x33')]));_0xce4000[_0x09cc('0x32')]=_0xce4000[_0x09cc('0x32')][_0x09cc('0x34')]?_0xce4000[_0x09cc('0x32')]:_0x1d7ea2[_0x09cc('0x2d')];if(!_0x1291b4[_0x09cc('0x2e')]['hasOwnProperty'](_0x09cc('0x35'))){_0xce4000[_0x09cc('0x1d')]=qs[_0x09cc('0x1d')](_0x1291b4[_0x09cc('0x2e')][_0x09cc('0x1d')]);_0xce4000[_0x09cc('0x1e')]=qs[_0x09cc('0x1e')](_0x1291b4[_0x09cc('0x2e')][_0x09cc('0x1e')]);}_0xce4000['order']=qs[_0x09cc('0x36')](_0x1291b4['query'][_0x09cc('0x36')]);_0xce4000[_0x09cc('0x37')]=qs[_0x09cc('0x30')](_[_0x09cc('0x38')](_0x1291b4[_0x09cc('0x2e')],_0x1d7ea2['filters']),_0x43f3f2);if(_0x1291b4[_0x09cc('0x2e')][_0x09cc('0x39')]){_0xce4000[_0x09cc('0x37')]=_['merge'](_0xce4000[_0x09cc('0x37')],{'$or':_[_0x09cc('0x28')](_0x43f3f2,function(_0x5a4da7){if(_0x5a4da7['type']!=='VIRTUAL'){var _0x220a7e={};_0x220a7e[_0x5a4da7[_0x09cc('0x26')]]={'$like':'%'+_0x1291b4[_0x09cc('0x2e')][_0x09cc('0x39')]+'%'};return _0x220a7e;}})});}_0xce4000=_['merge']({},_0xce4000,_0x1291b4['options']);var _0x587104={'where':_0xce4000['where']};return db[_0x09cc('0x29')][_0x09cc('0x1f')](_0x587104)[_0x09cc('0x23')](function(_0x3b1082){_0x5dc25c['count']=_0x3b1082;if(_0x1291b4['query'][_0x09cc('0x3a')]){_0xce4000['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x09cc('0x3b')](_0xce4000);})[_0x09cc('0x23')](function(_0x35a58d){_0x5dc25c[_0x09cc('0x3c')]=_0x35a58d;return _0x5dc25c;})[_0x09cc('0x23')](respondWithFilteredResult(_0x3dae56,_0xce4000))[_0x09cc('0x3d')](handleError(_0x3dae56,null));};exports[_0x09cc('0x3e')]=function(_0x3a6c43,_0x31457f){var _0x2c8bab={'raw':!![],'where':{'id':_0x3a6c43[_0x09cc('0x3f')]['id']}},_0x5794f5={};_0x5794f5[_0x09cc('0x2d')]=_[_0x09cc('0x2f')](db['VoiceQueuesLog']['rawAttributes']);_0x5794f5['query']=_['keys'](_0x3a6c43['query']);_0x5794f5[_0x09cc('0x30')]=_[_0x09cc('0x31')](_0x5794f5[_0x09cc('0x2d')],_0x5794f5[_0x09cc('0x2e')]);_0x2c8bab[_0x09cc('0x32')]=_['intersection'](_0x5794f5['model'],qs[_0x09cc('0x33')](_0x3a6c43[_0x09cc('0x2e')][_0x09cc('0x33')]));_0x2c8bab['attributes']=_0x2c8bab[_0x09cc('0x32')][_0x09cc('0x34')]?_0x2c8bab[_0x09cc('0x32')]:_0x5794f5['model'];if(_0x3a6c43['query'][_0x09cc('0x3a')]){_0x2c8bab[_0x09cc('0x40')]=[{'all':!![]}];}_0x2c8bab=_[_0x09cc('0x41')]({},_0x2c8bab,_0x3a6c43[_0x09cc('0x42')]);return db['VoiceQueuesLog']['find'](_0x2c8bab)[_0x09cc('0x23')](handleEntityNotFound(_0x31457f,null))[_0x09cc('0x23')](respondWithResult(_0x31457f,null))[_0x09cc('0x3d')](handleError(_0x31457f,null));};exports[_0x09cc('0x43')]=function(_0xd4df88,_0x5ae88e){return db[_0x09cc('0x29')][_0x09cc('0x43')](_0xd4df88[_0x09cc('0x44')],{})[_0x09cc('0x23')](respondWithResult(_0x5ae88e,0xc9))[_0x09cc('0x3d')](handleError(_0x5ae88e,null));};exports['update']=function(_0x4cc9e8,_0x406e23){if(_0x4cc9e8[_0x09cc('0x44')]['id']){delete _0x4cc9e8[_0x09cc('0x44')]['id'];}return db[_0x09cc('0x29')]['find']({'where':{'id':_0x4cc9e8[_0x09cc('0x3f')]['id']}})[_0x09cc('0x23')](handleEntityNotFound(_0x406e23,null))['then'](saveUpdates(_0x4cc9e8[_0x09cc('0x44')],null))['then'](respondWithResult(_0x406e23,null))[_0x09cc('0x3d')](handleError(_0x406e23,null));};exports[_0x09cc('0x45')]=function(_0x2702ab,_0x560161){return db[_0x09cc('0x29')][_0x09cc('0x46')]({'where':{'id':_0x2702ab[_0x09cc('0x3f')]['id']}})[_0x09cc('0x23')](handleEntityNotFound(_0x560161,null))[_0x09cc('0x23')](removeEntity(_0x560161,null))['catch'](handleError(_0x560161,null));}; \ No newline at end of file +var _0x3de3=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3de3,0x1aa));var _0x33de=function(_0x5b74e8,_0x5cf545){_0x5b74e8=_0x5b74e8-0x0;var _0x354ae8=_0x3de3[_0x5b74e8];return _0x354ae8;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require(_0x33de('0x1'));var zipdir=require(_0x33de('0x2'));var jsonpatch=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var moment=require(_0x33de('0x5'));var BPromise=require(_0x33de('0x6'));var Mustache=require(_0x33de('0x7'));var util=require(_0x33de('0x8'));var path=require('path');var sox=require(_0x33de('0x9'));var csv=require(_0x33de('0xa'));var ejs=require(_0x33de('0xb'));var fs=require('fs');var fs_extra=require(_0x33de('0xc'));var _=require('lodash');var squel=require(_0x33de('0xd'));var crypto=require(_0x33de('0xe'));var jsforce=require(_0x33de('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0xa'));var querystring=require('querystring');var Papa=require(_0x33de('0x10'));var Redis=require(_0x33de('0x11'));var authService=require(_0x33de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x33de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33de('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x33de('0x15'));var licenseUtil=require(_0x33de('0x16'));var db=require(_0x33de('0x17'))['db'];function respondWithStatusCode(_0x4e627a,_0x18d8c5){_0x18d8c5=_0x18d8c5||0xcc;return function(_0x2fa892){if(_0x2fa892){return _0x4e627a[_0x33de('0x18')](_0x18d8c5);}return _0x4e627a[_0x33de('0x19')](_0x18d8c5)['end']();};}function respondWithResult(_0x5ec59c,_0x3b031e){_0x3b031e=_0x3b031e||0xc8;return function(_0x2e1468){if(_0x2e1468){return _0x5ec59c[_0x33de('0x19')](_0x3b031e)[_0x33de('0x1a')](_0x2e1468);}};}function respondWithFilteredResult(_0x1704e0,_0x42b6fd){return function(_0x192b8c){if(_0x192b8c){var _0xbf3e0=typeof _0x42b6fd[_0x33de('0x1b')]===_0x33de('0x1c')&&typeof _0x42b6fd[_0x33de('0x1d')]===_0x33de('0x1c');var _0x5cb2d0=_0x192b8c[_0x33de('0x1e')];var _0x43b505=_0xbf3e0?0x0:_0x42b6fd[_0x33de('0x1b')];var _0x37cf07=_0xbf3e0?_0x192b8c[_0x33de('0x1e')]:_0x42b6fd[_0x33de('0x1b')]+_0x42b6fd['limit'];var _0xe1ec63;if(_0x37cf07>=_0x5cb2d0){_0x37cf07=_0x5cb2d0;_0xe1ec63=0xc8;}else{_0xe1ec63=0xce;}_0x1704e0[_0x33de('0x19')](_0xe1ec63);return _0x1704e0[_0x33de('0x1f')](_0x33de('0x20'),_0x43b505+'-'+_0x37cf07+'/'+_0x5cb2d0)['json'](_0x192b8c);}return null;};}function patchUpdates(_0xca4e47){return function(_0x2bfd1d){try{jsonpatch['apply'](_0x2bfd1d,_0xca4e47,!![]);}catch(_0x493219){return BPromise[_0x33de('0x21')](_0x493219);}return _0x2bfd1d['save']();};}function saveUpdates(_0x104bc7,_0xb9ea81){return function(_0x2170cd){if(_0x2170cd){return _0x2170cd[_0x33de('0x22')](_0x104bc7)['then'](function(_0x243150){return _0x243150;});}return null;};}function removeEntity(_0x36b354,_0x18d69d){return function(_0x4139ae){if(_0x4139ae){return _0x4139ae[_0x33de('0x23')]()[_0x33de('0x24')](function(){_0x36b354[_0x33de('0x19')](0xcc)[_0x33de('0x25')]();});}};}function handleEntityNotFound(_0x43b23d,_0x3ada74){return function(_0xff1a02){if(!_0xff1a02){_0x43b23d[_0x33de('0x18')](0x194);}return _0xff1a02;};}function handleError(_0x18abb5,_0x4245fd){_0x4245fd=_0x4245fd||0x1f4;return function(_0x2438ad){logger['error'](_0x2438ad['stack']);if(_0x2438ad[_0x33de('0x26')]){delete _0x2438ad[_0x33de('0x26')];}_0x18abb5[_0x33de('0x19')](_0x4245fd)[_0x33de('0x27')](_0x2438ad);};}exports[_0x33de('0x28')]=function(_0x30d622,_0x771187){var _0x56482f={},_0x44c417={},_0xc8faf6={'count':0x0,'rows':[]};var _0x39b002=_['map'](db[_0x33de('0x29')][_0x33de('0x2a')],function(_0x1cb120){return{'name':_0x1cb120[_0x33de('0x2b')],'type':_0x1cb120['type']['key']};});_0x44c417[_0x33de('0x2c')]=_[_0x33de('0x2d')](_0x39b002,_0x33de('0x26'));_0x44c417[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x30d622['query']);_0x44c417[_0x33de('0x30')]=_[_0x33de('0x31')](_0x44c417['model'],_0x44c417[_0x33de('0x2e')]);_0x56482f[_0x33de('0x32')]=_[_0x33de('0x31')](_0x44c417['model'],qs[_0x33de('0x33')](_0x30d622['query'][_0x33de('0x33')]));_0x56482f[_0x33de('0x32')]=_0x56482f[_0x33de('0x32')][_0x33de('0x34')]?_0x56482f['attributes']:_0x44c417['model'];if(!_0x30d622[_0x33de('0x2e')][_0x33de('0x35')]('nolimit')){_0x56482f[_0x33de('0x1d')]=qs['limit'](_0x30d622['query'][_0x33de('0x1d')]);_0x56482f[_0x33de('0x1b')]=qs[_0x33de('0x1b')](_0x30d622[_0x33de('0x2e')][_0x33de('0x1b')]);}_0x56482f[_0x33de('0x36')]=qs[_0x33de('0x37')](_0x30d622[_0x33de('0x2e')][_0x33de('0x37')]);_0x56482f[_0x33de('0x38')]=qs[_0x33de('0x30')](_[_0x33de('0x39')](_0x30d622[_0x33de('0x2e')],_0x44c417[_0x33de('0x30')]),_0x39b002);if(_0x30d622['query'][_0x33de('0x3a')]){_0x56482f[_0x33de('0x38')]=_['merge'](_0x56482f[_0x33de('0x38')],{'$or':_[_0x33de('0x2d')](_0x39b002,function(_0x33b5fa){if(_0x33b5fa[_0x33de('0x3b')]!==_0x33de('0x3c')){var _0x2b1c8e={};_0x2b1c8e[_0x33b5fa[_0x33de('0x26')]]={'$like':'%'+_0x30d622[_0x33de('0x2e')][_0x33de('0x3a')]+'%'};return _0x2b1c8e;}})});}_0x56482f=_[_0x33de('0x3d')]({},_0x56482f,_0x30d622[_0x33de('0x3e')]);var _0x23eff4={'where':_0x56482f[_0x33de('0x38')]};return db[_0x33de('0x29')]['count'](_0x23eff4)['then'](function(_0x314ed7){_0xc8faf6['count']=_0x314ed7;if(_0x30d622[_0x33de('0x2e')][_0x33de('0x3f')]){_0x56482f[_0x33de('0x40')]=[{'all':!![]}];}return db[_0x33de('0x29')]['findAll'](_0x56482f);})[_0x33de('0x24')](function(_0x1b9ba3){_0xc8faf6[_0x33de('0x41')]=_0x1b9ba3;return _0xc8faf6;})[_0x33de('0x24')](respondWithFilteredResult(_0x771187,_0x56482f))[_0x33de('0x42')](handleError(_0x771187,null));};exports[_0x33de('0x43')]=function(_0x342fa8,_0x162337){var _0x3a22b9={'raw':!![],'where':{'id':_0x342fa8[_0x33de('0x44')]['id']}},_0x1a5ea9={};_0x1a5ea9[_0x33de('0x2c')]=_[_0x33de('0x2f')](db[_0x33de('0x29')]['rawAttributes']);_0x1a5ea9[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x342fa8[_0x33de('0x2e')]);_0x1a5ea9[_0x33de('0x30')]=_['intersection'](_0x1a5ea9['model'],_0x1a5ea9[_0x33de('0x2e')]);_0x3a22b9[_0x33de('0x32')]=_[_0x33de('0x31')](_0x1a5ea9[_0x33de('0x2c')],qs['fields'](_0x342fa8['query'][_0x33de('0x33')]));_0x3a22b9[_0x33de('0x32')]=_0x3a22b9[_0x33de('0x32')][_0x33de('0x34')]?_0x3a22b9['attributes']:_0x1a5ea9[_0x33de('0x2c')];if(_0x342fa8[_0x33de('0x2e')][_0x33de('0x3f')]){_0x3a22b9['include']=[{'all':!![]}];}_0x3a22b9=_[_0x33de('0x3d')]({},_0x3a22b9,_0x342fa8[_0x33de('0x3e')]);return db[_0x33de('0x29')][_0x33de('0x45')](_0x3a22b9)[_0x33de('0x24')](handleEntityNotFound(_0x162337,null))[_0x33de('0x24')](respondWithResult(_0x162337,null))['catch'](handleError(_0x162337,null));};exports['create']=function(_0x332601,_0x563802){return db[_0x33de('0x29')][_0x33de('0x46')](_0x332601[_0x33de('0x47')],{})[_0x33de('0x24')](respondWithResult(_0x563802,0xc9))[_0x33de('0x42')](handleError(_0x563802,null));};exports[_0x33de('0x22')]=function(_0x1a6b56,_0x1780b4){if(_0x1a6b56['body']['id']){delete _0x1a6b56[_0x33de('0x47')]['id'];}return db[_0x33de('0x29')]['find']({'where':{'id':_0x1a6b56[_0x33de('0x44')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0x1780b4,null))[_0x33de('0x24')](saveUpdates(_0x1a6b56['body'],null))['then'](respondWithResult(_0x1780b4,null))[_0x33de('0x42')](handleError(_0x1780b4,null));};exports['destroy']=function(_0x2338ed,_0x5996d2){return db[_0x33de('0x29')][_0x33de('0x45')]({'where':{'id':_0x2338ed['params']['id']}})['then'](handleEntityNotFound(_0x5996d2,null))[_0x33de('0x24')](removeEntity(_0x5996d2,null))['catch'](handleError(_0x5996d2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9eca517..4a54767 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 _0x6ab8=['./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x576c39,_0x5eb4b9){var _0xcd98b=function(_0x344984){while(--_0x344984){_0x576c39['push'](_0x576c39['shift']());}};_0xcd98b(++_0x5eb4b9);}(_0x6ab8,0x66));var _0x86ab=function(_0x63fb83,_0x3efac2){_0x63fb83=_0x63fb83-0x0;var _0x3aaba7=_0x6ab8[_0x63fb83];return _0x3aaba7;};'use strict';var _=require(_0x86ab('0x0'));var util=require(_0x86ab('0x1'));var logger=require(_0x86ab('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86ab('0x3'));var fs=require('fs');var path=require(_0x86ab('0x4'));var rimraf=require(_0x86ab('0x5'));var config=require('../../config/environment');var attributes=require(_0x86ab('0x6'));module[_0x86ab('0x7')]=function(_0x17eaad,_0x198d60){return _0x17eaad[_0x86ab('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x86ab('0x9'),'paranoid':![],'indexes':[{'name':_0x86ab('0xa'),'fields':[_0x86ab('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xcc41=['api','moment','bluebird','../../config/environment','exports','VoiceQueuesLog','voice_queues_log','dtm','lodash','util','../../config/logger'];(function(_0x14909a,_0x40cd3e){var _0x3914f8=function(_0x51b034){while(--_0x51b034){_0x14909a['push'](_0x14909a['shift']());}};_0x3914f8(++_0x40cd3e);}(_0xcc41,0x13c));var _0x1cc4=function(_0x1a71ef,_0x31ed01){_0x1a71ef=_0x1a71ef-0x0;var _0x1899f7=_0xcc41[_0x1a71ef];return _0x1899f7;};'use strict';var _=require(_0x1cc4('0x0'));var util=require(_0x1cc4('0x1'));var logger=require(_0x1cc4('0x2'))(_0x1cc4('0x3'));var moment=require(_0x1cc4('0x4'));var BPromise=require(_0x1cc4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1cc4('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x1cc4('0x7')]=function(_0x30c848,_0x42839a){return _0x30c848['define'](_0x1cc4('0x8'),attributes,{'tableName':_0x1cc4('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x1cc4('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index c97dd7e..e6fe69b 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 _0xc0e6=['error','VoiceQueuesLog,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x3d87d0,_0x5338cf){var _0x32156e=function(_0x299c9c){while(--_0x299c9c){_0x3d87d0['push'](_0x3d87d0['shift']());}};_0x32156e(++_0x5338cf);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xc0e6[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x6c0e('0x0'));var moment=require('moment');var BPromise=require(_0x6c0e('0x1'));var rs=require(_0x6c0e('0x2'));var fs=require('fs');var Redis=require(_0x6c0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c0e('0x4'))(_0x6c0e('0x5'));var config=require(_0x6c0e('0x6'));var jayson=require(_0x6c0e('0x7'));var client=jayson[_0x6c0e('0x8')][_0x6c0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3534c6,_0x10f3fd,_0x3e6bdf){return new BPromise(function(_0x2d1e43,_0x16988a){return client[_0x6c0e('0xa')](_0x3534c6,_0x3e6bdf)[_0x6c0e('0xb')](function(_0x227170){logger[_0x6c0e('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x10f3fd,_0x6c0e('0xd'));logger[_0x6c0e('0xe')](_0x6c0e('0xf'),_0x10f3fd,'request\x20sent',JSON['stringify'](_0x227170));if(_0x227170[_0x6c0e('0x10')]){if(_0x227170[_0x6c0e('0x10')]['code']===0x1f4){logger['error'](_0x6c0e('0x11'),_0x10f3fd,_0x227170['error']['message']);return _0x16988a(_0x227170[_0x6c0e('0x10')][_0x6c0e('0x12')]);}logger[_0x6c0e('0x10')](_0x6c0e('0x11'),_0x10f3fd,_0x227170[_0x6c0e('0x10')][_0x6c0e('0x12')]);return _0x2d1e43(_0x227170['error'][_0x6c0e('0x12')]);}else{logger[_0x6c0e('0xc')](_0x6c0e('0x11'),_0x10f3fd,'request\x20sent');_0x2d1e43(_0x227170['result'][_0x6c0e('0x12')]);}})['catch'](function(_0x2f065d){logger[_0x6c0e('0x10')](_0x6c0e('0x11'),_0x10f3fd,_0x2f065d);_0x16988a(_0x2f065d);});});} \ No newline at end of file +var _0x8482=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8482,0x14e));var _0x2848=function(_0x53c45b,_0x11b3a1){_0x53c45b=_0x53c45b-0x0;var _0x396922=_0x8482[_0x53c45b];return _0x396922;};'use strict';var _=require('lodash');var util=require(_0x2848('0x0'));var moment=require(_0x2848('0x1'));var BPromise=require(_0x2848('0x2'));var rs=require(_0x2848('0x3'));var fs=require('fs');var Redis=require(_0x2848('0x4'));var db=require(_0x2848('0x5'))['db'];var utils=require(_0x2848('0x6'));var logger=require(_0x2848('0x7'))(_0x2848('0x8'));var config=require(_0x2848('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2848('0xa')][_0x2848('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x503238,_0xeca507,_0x48c0f3){return new BPromise(function(_0x53c865,_0xff7900){return client['request'](_0x503238,_0x48c0f3)[_0x2848('0xc')](function(_0x4a117b){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xeca507,_0x2848('0xd'));logger[_0x2848('0xe')](_0x2848('0xf'),_0xeca507,_0x2848('0xd'),JSON[_0x2848('0x10')](_0x4a117b));if(_0x4a117b[_0x2848('0x11')]){if(_0x4a117b['error']['code']===0x1f4){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0xff7900(_0x4a117b[_0x2848('0x11')][_0x2848('0x13')]);}logger[_0x2848('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0x53c865(_0x4a117b[_0x2848('0x11')]['message']);}else{logger[_0x2848('0x14')](_0x2848('0x12'),_0xeca507,_0x2848('0xd'));_0x53c865(_0x4a117b['result']['message']);}})['catch'](function(_0x5f5616){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x5f5616);_0xff7900(_0x5f5616);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 496e4a8..b6eaeec 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 _0xb39c=['express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','update','delete','destroy','multer','util','connect-timeout'];(function(_0x48973b,_0x4a6d0c){var _0x3de455=function(_0x156ccf){while(--_0x156ccf){_0x48973b['push'](_0x48973b['shift']());}};_0x3de455(++_0x4a6d0c);}(_0xb39c,0x135));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcb39('0x0'));var util=require(_0xcb39('0x1'));var path=require('path');var timeout=require(_0xcb39('0x2'));var express=require(_0xcb39('0x3'));var router=express[_0xcb39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb39('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcb39('0x6'));var controller=require(_0xcb39('0x7'));router[_0xcb39('0x8')]('/',auth[_0xcb39('0x9')](),controller[_0xcb39('0xa')]);router[_0xcb39('0x8')](_0xcb39('0xb'),auth[_0xcb39('0x9')](),controller[_0xcb39('0xc')]);router[_0xcb39('0x8')](_0xcb39('0xd'),auth['isAuthenticated'](),controller[_0xcb39('0xe')]);router[_0xcb39('0x8')]('/:id/download',auth[_0xcb39('0x9')](),controller[_0xcb39('0xf')]);router[_0xcb39('0x8')](_0xcb39('0x10'),controller[_0xcb39('0x11')]);router['get'](_0xcb39('0x12'),auth[_0xcb39('0x9')](),controller[_0xcb39('0x13')]);router['post']('/',auth[_0xcb39('0x9')](),controller[_0xcb39('0x14')]);router[_0xcb39('0x15')](_0xcb39('0x12'),auth['isAuthenticated'](),controller[_0xcb39('0x16')]);router['put']('/:id',auth[_0xcb39('0x9')](),controller[_0xcb39('0x17')]);router[_0xcb39('0x18')](_0xcb39('0xd'),auth[_0xcb39('0x9')](),controller[_0xcb39('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6940=['create','post','runTranscribe','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated','get','/describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6940,0x1b1));var _0x0694=function(_0x480e21,_0x6d0437){_0x480e21=_0x480e21-0x0;var _0xbea80=_0x6940[_0x480e21];return _0xbea80;};'use strict';var multer=require(_0x0694('0x0'));var util=require(_0x0694('0x1'));var path=require('path');var timeout=require(_0x0694('0x2'));var express=require(_0x0694('0x3'));var router=express[_0x0694('0x4')]();var fs_extra=require(_0x0694('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0694('0x6'));var controller=require(_0x0694('0x7'));router['get']('/',auth[_0x0694('0x8')](),controller['index']);router[_0x0694('0x9')](_0x0694('0xa'),auth[_0x0694('0x8')](),controller['describe']);router[_0x0694('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0694('0xb')]);router[_0x0694('0x9')](_0x0694('0xc'),auth[_0x0694('0x8')](),controller[_0x0694('0xd')]);router[_0x0694('0x9')](_0x0694('0xe'),controller[_0x0694('0xf')]);router[_0x0694('0x9')](_0x0694('0x10'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0x0694('0x11')]);router[_0x0694('0x12')](_0x0694('0x10'),auth['isAuthenticated'](),controller[_0x0694('0x13')]);router[_0x0694('0x14')](_0x0694('0x15'),auth[_0x0694('0x8')](),controller['update']);router[_0x0694('0x16')](_0x0694('0x15'),auth[_0x0694('0x8')](),controller[_0x0694('0x17')]);module[_0x0694('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3109b7a..e5c08c5 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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 2f99775..331af9f 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 _0xe52a=['findAll','rows','catch','show','params','intersection','merge','find','create','body','describe','download','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','col','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','language','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','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','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x303131,_0x35a7da){var _0x52a74b=function(_0xac270b){while(--_0xac270b){_0x303131['push'](_0x303131['shift']());}};_0x52a74b(++_0x35a7da);}(_0xe52a,0xec));var _0xae52=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xe52a[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0xae52('0x0'));var rimraf=require(_0xae52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae52('0x2'));var rp=require(_0xae52('0x3'));var moment=require(_0xae52('0x4'));var BPromise=require(_0xae52('0x5'));var Mustache=require(_0xae52('0x6'));var util=require(_0xae52('0x7'));var path=require(_0xae52('0x8'));var sox=require(_0xae52('0x9'));var csv=require(_0xae52('0xa'));var ejs=require(_0xae52('0xb'));var fs=require('fs');var fs_extra=require(_0xae52('0xc'));var _=require('lodash');var squel=require(_0xae52('0xd'));var crypto=require(_0xae52('0xe'));var jsforce=require(_0xae52('0xf'));var deskjs=require(_0xae52('0x10'));var toCsv=require(_0xae52('0xa'));var querystring=require(_0xae52('0x11'));var Papa=require(_0xae52('0x12'));var AWS=require(_0xae52('0x13'));var uuidv4=require(_0xae52('0x14'));var Redis=require('ioredis');var authService=require(_0xae52('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xae52('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae52('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xae52('0x18'));var licenseUtil=require(_0xae52('0x19'));var db=require(_0xae52('0x1a'))['db'];function respondWithStatusCode(_0x351e78,_0x46a333){_0x46a333=_0x46a333||0xcc;return function(_0x14aac9){if(_0x14aac9){return _0x351e78[_0xae52('0x1b')](_0x46a333);}return _0x351e78['status'](_0x46a333)[_0xae52('0x1c')]();};}function respondWithResult(_0xea9745,_0x3978a6){_0x3978a6=_0x3978a6||0xc8;return function(_0x230a55){if(_0x230a55){return _0xea9745[_0xae52('0x1d')](_0x3978a6)[_0xae52('0x1e')](_0x230a55);}};}function respondWithFilteredResult(_0x3cb325,_0x52c8be){return function(_0x31fd68){if(_0x31fd68){var _0x463699=typeof _0x52c8be['offset']==='undefined'&&typeof _0x52c8be[_0xae52('0x1f')]==='undefined';var _0x522169=_0x31fd68[_0xae52('0x20')];var _0x495ac6=_0x463699?0x0:_0x52c8be['offset'];var _0x60158c=_0x463699?_0x31fd68[_0xae52('0x20')]:_0x52c8be[_0xae52('0x21')]+_0x52c8be[_0xae52('0x1f')];var _0x28bde9;if(_0x60158c>=_0x522169){_0x60158c=_0x522169;_0x28bde9=0xc8;}else{_0x28bde9=0xce;}_0x3cb325[_0xae52('0x1d')](_0x28bde9);return _0x3cb325['set']('Content-Range',_0x495ac6+'-'+_0x60158c+'/'+_0x522169)[_0xae52('0x1e')](_0x31fd68);}return null;};}function patchUpdates(_0x28c150){return function(_0x2a3b1d){try{jsonpatch[_0xae52('0x22')](_0x2a3b1d,_0x28c150,!![]);}catch(_0x2653d5){return BPromise[_0xae52('0x23')](_0x2653d5);}return _0x2a3b1d[_0xae52('0x24')]();};}function saveUpdates(_0x229f2,_0x2ed9f3){return function(_0xea3192){if(_0xea3192){return _0xea3192[_0xae52('0x25')](_0x229f2)[_0xae52('0x26')](function(_0x263d8e){return _0x263d8e;});}return null;};}function removeEntity(_0x1cd535,_0x5c14a4){return function(_0x146413){if(_0x146413){return _0x146413[_0xae52('0x27')]()[_0xae52('0x26')](function(){_0x1cd535[_0xae52('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511513,_0x12cc05){return function(_0x4e9f18){if(!_0x4e9f18){_0x511513['sendStatus'](0x194);}return _0x4e9f18;};}function handleError(_0x450610,_0x4bde49){_0x4bde49=_0x4bde49||0x1f4;return function(_0x25bb70){logger[_0xae52('0x28')](_0x25bb70[_0xae52('0x29')]);if(_0x25bb70['name']){delete _0x25bb70[_0xae52('0x2a')];}_0x450610[_0xae52('0x1d')](_0x4bde49)['send'](_0x25bb70);};}exports[_0xae52('0x2b')]=function(_0x687696,_0x7035fc){var _0x3b149a={},_0x3a1661={},_0x48e6e4={'count':0x0,'rows':[]};var _0x4ccb83=_[_0xae52('0x2c')](db[_0xae52('0x2d')][_0xae52('0x2e')],function(_0x5f0073){return{'name':_0x5f0073[_0xae52('0x2f')],'type':_0x5f0073[_0xae52('0x30')][_0xae52('0x31')]};});_0x3a1661[_0xae52('0x32')]=_[_0xae52('0x33')](_[_0xae52('0x2c')](_0x4ccb83,_0xae52('0x2a')),['format']);_0x3a1661[_0xae52('0x34')]=_[_0xae52('0x35')](_0x687696[_0xae52('0x34')]);_0x3a1661['filters']=_['intersection'](_0x3a1661[_0xae52('0x32')],_0x3a1661[_0xae52('0x34')]);_0x3b149a[_0xae52('0x36')]=_['intersection'](_0x3a1661['model'],qs[_0xae52('0x37')](_0x687696[_0xae52('0x34')]['fields']));_0x3b149a[_0xae52('0x36')]=_0x3b149a[_0xae52('0x36')][_0xae52('0x38')]?_0x3b149a[_0xae52('0x36')]:_0x3a1661[_0xae52('0x32')];if(!_0x687696[_0xae52('0x34')][_0xae52('0x39')](_0xae52('0x3a'))){_0x3b149a['limit']=qs[_0xae52('0x1f')](_0x687696[_0xae52('0x34')][_0xae52('0x1f')]);_0x3b149a[_0xae52('0x21')]=qs['offset'](_0x687696[_0xae52('0x34')][_0xae52('0x21')]);}_0x3b149a[_0xae52('0x3b')]=qs['sort'](_0x687696[_0xae52('0x34')]['sort']);_0x3b149a[_0xae52('0x3c')]=qs[_0xae52('0x3d')](_[_0xae52('0x3e')](_0x687696[_0xae52('0x34')],_0x3a1661['filters']),_0x4ccb83);if(_0x687696[_0xae52('0x34')][_0xae52('0x3f')]){_0x3b149a['where']=_['merge'](_0x3b149a[_0xae52('0x3c')],{'$or':_[_0xae52('0x2c')](_0x4ccb83,function(_0xf52abe){if(_0xf52abe['type']!==_0xae52('0x40')){var _0x55c2ce={};_0x55c2ce[_0xf52abe[_0xae52('0x2a')]]={'$like':'%'+_0x687696[_0xae52('0x34')][_0xae52('0x3f')]+'%'};return _0x55c2ce;}})});}_0x3b149a=_['merge']({},_0x3b149a,_0x687696[_0xae52('0x41')]);var _0x4b655a={'where':_0x3b149a[_0xae52('0x3c')]};return db[_0xae52('0x2d')]['count'](_0x4b655a)[_0xae52('0x26')](function(_0x252d68){_0x48e6e4[_0xae52('0x20')]=_0x252d68;if(_0x687696[_0xae52('0x34')][_0xae52('0x42')]){_0x3b149a[_0xae52('0x43')]=[{'all':!![]}];}return db[_0xae52('0x2d')][_0xae52('0x44')](_0x3b149a);})[_0xae52('0x26')](function(_0x433e64){_0x48e6e4[_0xae52('0x45')]=_0x433e64;return _0x48e6e4;})[_0xae52('0x26')](respondWithFilteredResult(_0x7035fc,_0x3b149a))[_0xae52('0x46')](handleError(_0x7035fc,null));};exports[_0xae52('0x47')]=function(_0x4c4cf8,_0x342181){var _0x38aa1b={'raw':![],'where':{'id':_0x4c4cf8[_0xae52('0x48')]['id']}},_0x4d33f3={};_0x4d33f3['model']=_['keys'](db['VoiceRecording'][_0xae52('0x2e')]);_0x4d33f3[_0xae52('0x34')]=_[_0xae52('0x35')](_0x4c4cf8['query']);_0x4d33f3['filters']=_[_0xae52('0x49')](_0x4d33f3['model'],_0x4d33f3['query']);_0x38aa1b[_0xae52('0x36')]=_[_0xae52('0x49')](_0x4d33f3[_0xae52('0x32')],qs[_0xae52('0x37')](_0x4c4cf8[_0xae52('0x34')][_0xae52('0x37')]));_0x38aa1b['attributes']=_0x38aa1b[_0xae52('0x36')][_0xae52('0x38')]?_0x38aa1b[_0xae52('0x36')]:_0x4d33f3[_0xae52('0x32')];if(_0x4c4cf8[_0xae52('0x34')][_0xae52('0x42')]){_0x38aa1b[_0xae52('0x43')]=[{'all':!![]}];}_0x38aa1b=_[_0xae52('0x4a')]({},_0x38aa1b,_0x4c4cf8[_0xae52('0x41')]);return db[_0xae52('0x2d')][_0xae52('0x4b')](_0x38aa1b)[_0xae52('0x26')](handleEntityNotFound(_0x342181,null))[_0xae52('0x26')](respondWithResult(_0x342181,null))[_0xae52('0x46')](handleError(_0x342181,null));};exports[_0xae52('0x4c')]=function(_0x2c2be0,_0xc3f588){return db[_0xae52('0x2d')][_0xae52('0x4c')](_0x2c2be0[_0xae52('0x4d')],{})['then'](respondWithResult(_0xc3f588,0xc9))[_0xae52('0x46')](handleError(_0xc3f588,null));};exports[_0xae52('0x25')]=function(_0x36154e,_0x2467d6){if(_0x36154e['body']['id']){delete _0x36154e['body']['id'];}return db['VoiceRecording'][_0xae52('0x4b')]({'where':{'id':_0x36154e['params']['id']}})['then'](handleEntityNotFound(_0x2467d6,null))['then'](saveUpdates(_0x36154e[_0xae52('0x4d')],null))[_0xae52('0x26')](respondWithResult(_0x2467d6,null))[_0xae52('0x46')](handleError(_0x2467d6,null));};exports['describe']=function(_0x2f8992,_0x35ec91){return db[_0xae52('0x2d')][_0xae52('0x4e')]()[_0xae52('0x26')](respondWithResult(_0x35ec91,null))[_0xae52('0x46')](handleError(_0x35ec91,null));};exports[_0xae52('0x4f')]=function(_0x3fca68,_0x564d1b,_0x5d61de){var _0x5d3454=require('../../components/encryptor');var _0x5de48f=![];var _0x12286e={};if(_0x3fca68[_0xae52('0x34')]['type']&&_0x3fca68[_0xae52('0x34')][_0xae52('0x30')]==='uniqueid'){_0x12286e[_0xae52('0x50')]=_0x3fca68[_0xae52('0x48')]['id'];}else{_0x12286e['id']=_0x3fca68[_0xae52('0x48')]['id'];}return db[_0xae52('0x2d')]['find']({'where':_0x12286e,'attributes':['id',_0xae52('0x51')],'raw':!![]})[_0xae52('0x26')](handleEntityNotFound(_0x564d1b,null))[_0xae52('0x26')](function(_0x4be659){if(_0x4be659){var _0x24c105=_0x4be659['value'];var _0x43cba8=util[_0xae52('0x52')](_0xae52('0x53'),_0x24c105);if(fs['existsSync'](_0x43cba8)){_0x5de48f=!![];return _0x5d3454[_0xae52('0x54')](_0x43cba8,_0x24c105,config[_0xae52('0x55')][_0xae52('0x56')])['then'](function(){return _0x4be659;});}return _0x4be659;}})['then'](function(_0x3162c6){if(_0x3162c6){var _0x60a50b=_0x3162c6['value'];if(!fs[_0xae52('0x57')](_0x60a50b)){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))](_0xae52('0x5a'));}if(_0x3162c6['filename']){return _0x564d1b[_0xae52('0x4f')](_0x60a50b,_0x3162c6[_0xae52('0x5b')]+path[_0xae52('0x5c')](_0x60a50b),function(){if(_0x5de48f){fs[_0xae52('0x5d')](_0x60a50b);}});}else{return _0x564d1b[_0xae52('0x4f')](_0x60a50b,function(_0x4b50c5){if(_0x5de48f){fs[_0xae52('0x5d')](_0x60a50b);}});}}})[_0xae52('0x46')](function(_0x4f381a){if(_0x4f381a[_0xae52('0x5e')]===_0xae52('0x5a')){_0x564d1b[_0xae52('0x1d')](0x194)[_0xae52('0x5f')]('Not\x20found');}else{return handleError(_0x564d1b,null);}});};exports[_0xae52('0x60')]=function(_0x128098,_0x109fd6,_0x2125ea){var _0x5ae438=require('../../components/encryptor');var _0x494482=![];var _0x55abd7={'$and':[db[_0xae52('0x61')]['where'](db[_0xae52('0x61')]['fn']('MD5',db[_0xae52('0x61')][_0xae52('0x62')](_0xae52('0x50'))),_0x128098[_0xae52('0x34')]['token'])]};if(_0x128098[_0xae52('0x34')][_0xae52('0x30')]&&_0x128098[_0xae52('0x34')]['type']===_0xae52('0x50')){_0x55abd7[_0xae52('0x63')]['push']({'uniqueid':_0x128098[_0xae52('0x48')]['id']});}else{_0x55abd7['$and'][_0xae52('0x64')]({'id':_0x128098[_0xae52('0x48')]['id']});}return db[_0xae52('0x2d')][_0xae52('0x4b')]({'where':_0x55abd7,'attributes':['id',_0xae52('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x109fd6,null))[_0xae52('0x26')](function(_0x19b645){if(_0x19b645){var _0x27092d=util[_0xae52('0x52')](_0xae52('0x53'),_0x19b645[_0xae52('0x51')]);if(fs['existsSync'](_0x27092d)){_0x494482=!![];return _0x5ae438['decryptFile'](_0x27092d,_0x19b645[_0xae52('0x51')],config[_0xae52('0x55')]['recording'])[_0xae52('0x26')](function(){return _0x19b645;});}return _0x19b645;}})[_0xae52('0x26')](function(_0x4b6bcb){if(_0x4b6bcb){if(!fs['existsSync'](_0x4b6bcb[_0xae52('0x51')])){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))](_0xae52('0x5a'));}if(_0x4b6bcb['filename']){return _0x109fd6[_0xae52('0x4f')](_0x4b6bcb[_0xae52('0x51')],_0x4b6bcb['filename']+path[_0xae52('0x5c')](_0x4b6bcb[_0xae52('0x51')]),function(){if(_0x494482){fs[_0xae52('0x5d')](_0x4b6bcb['value']);}});}else{return _0x109fd6[_0xae52('0x4f')](_0x4b6bcb[_0xae52('0x51')],function(_0x4eeeca){if(_0x494482){fs[_0xae52('0x5d')](_0x4b6bcb['value']);}});}}})[_0xae52('0x46')](handleError(_0x109fd6,null));};exports[_0xae52('0x27')]=function(_0x51653f,_0x2c6863){return db[_0xae52('0x2d')]['find']({'where':{'id':_0x51653f['params']['id']}})[_0xae52('0x26')](function(_0x54eb49){if(_[_0xae52('0x65')](_0x54eb49)){throw new ReferenceError(_0xae52('0x66'));}return _0x54eb49;})[_0xae52('0x26')](function(_0x1d360a){var _0x41d4f2=_0x1d360a[_0xae52('0x51')];logger[_0xae52('0x67')](_0xae52('0x68'),_0x41d4f2);if(!_[_0xae52('0x65')](_0x1d360a[_0xae52('0x51')])&&fs[_0xae52('0x57')](_0x41d4f2)){logger[_0xae52('0x67')](_0xae52('0x69')+_0x41d4f2+_0xae52('0x6a'));fs[_0xae52('0x6b')](_0x41d4f2);}_0x41d4f2=_0x41d4f2+_0xae52('0x6c');if(!_[_0xae52('0x65')](_0x1d360a[_0xae52('0x51')])&&fs[_0xae52('0x57')](_0x41d4f2)){logger[_0xae52('0x67')](_0xae52('0x69')+_0x41d4f2+_0xae52('0x6a'));fs[_0xae52('0x6b')](_0x41d4f2);}return _0x1d360a;})[_0xae52('0x26')](function(_0x35ffd8){if(!_0x35ffd8)throw new InternalError();return _0x35ffd8[_0xae52('0x27')]();})[_0xae52('0x26')](function(){_0x2c6863[_0xae52('0x1d')](0xcc)[_0xae52('0x1c')]();})['catch'](handleError(_0x2c6863,null));};function getBucketslist(_0x228d88,_0x1dffbf,_0x569861){return new Promise(function(_0x3e6365,_0x4f281f){var _0x286d7f=new AWS['S3']({'accessKeyId':_0x1dffbf,'secretAccessKey':_0x228d88,'region':_0x569861});_0x286d7f['listBuckets']({},function(_0xe3bda9,_0x593e6a){if(_0xe3bda9){return _0x4f281f(_0xe3bda9);}else{return _0x3e6365(_0x593e6a);}});});}function createBucket(_0x1f748d,_0x4d5b9a,_0x4d977f,_0x41aed3){return new Promise(function(_0xb5c27e,_0x458587){var _0x4ef9a5=new AWS['S3']({'accessKeyId':_0x4d5b9a,'secretAccessKey':_0x1f748d,'region':_0x4d977f});_0x4ef9a5[_0xae52('0x6d')]({'Bucket':_0x41aed3},function(_0x2fbd91,_0x3af29c){if(_0x2fbd91){return _0x458587(_0x2fbd91);}else{return _0xb5c27e(_0x3af29c);}});});}function uploadFile(_0x428c05,_0x47e3d9,_0x2dffaf,_0x308d0e,_0x5b233a,_0x385a6f){return new Promise(function(_0x37cc39,_0x4aecb2){var _0x3b197b=new AWS['S3']({'accessKeyId':_0x47e3d9,'secretAccessKey':_0x428c05,'region':_0x2dffaf});_0x3b197b['upload']({'Bucket':_0x308d0e,'Key':_0x5b233a,'Body':_0x385a6f},function(_0x85c8e1,_0x1b8291){if(_0x85c8e1){return _0x4aecb2(_0x85c8e1);}else{return _0x37cc39(_0x1b8291);}});});}function startTranscribe(_0x46c598,_0x495f72,_0x54025c,_0x1fe43e,_0x3c52e4,_0x2b4304){return new Promise(function(_0xff0cb6,_0x422759){var _0x1e73eb=new AWS['TranscribeService']({'accessKeyId':_0x495f72,'secretAccessKey':_0x46c598,'region':_0x54025c});_0x1e73eb[_0xae52('0x6e')]({'TranscriptionJobName':_0x1fe43e,'LanguageCode':_0x3c52e4,'Media':{'MediaFileUri':_0x2b4304}},function(_0x535094,_0x22616e){if(_0x535094){return _0x422759(_0x535094);}else{return _0xff0cb6(_0x22616e);}});});}function transcribe(_0x59b855,_0x36db12,_0x8d35f1,_0x4d3504,_0x4ed254,_0x2eb221,_0x2eba9f){return new Promise(function(_0x5b8e46,_0x34f058){var _0x20c70e={};logger[_0xae52('0x67')](util[_0xae52('0x52')](_0xae52('0x6f'),_0x59b855,_0x4ed254));return uploadFile(_0x36db12,_0x8d35f1,_0x4d3504,_0x4ed254,path['basename'](_0x2eb221),fs['readFileSync'](_0x2eb221))[_0xae52('0x26')](function(_0xf6a559){logger['info'](util[_0xae52('0x52')](_0xae52('0x70'),_0x59b855,_0x4ed254,_0xf6a559['Location']));_0x20c70e['bucket']=_0xf6a559[_0xae52('0x71')];_0x20c70e[_0xae52('0x72')]=_0xf6a559[_0xae52('0x73')];logger['info'](util[_0xae52('0x52')](_0xae52('0x74'),_0x59b855));return startTranscribe(_0x36db12,_0x8d35f1,_0x4d3504,uuidv4(),_0x2eba9f,_0xf6a559[_0xae52('0x73')]);})[_0xae52('0x26')](function(_0x4588e3){logger[_0xae52('0x67')](util['format'](_0xae52('0x75'),_0x59b855,_0x4588e3[_0xae52('0x76')]['TranscriptionJobName']));_0x20c70e[_0xae52('0x77')]=_0x4588e3[_0xae52('0x76')][_0xae52('0x78')];_0x20c70e[_0xae52('0x79')]=_0x4588e3[_0xae52('0x76')][_0xae52('0x7a')];return _0x5b8e46(_0x20c70e);})[_0xae52('0x46')](function(_0x3f6298){return _0x34f058(_0x3f6298);});});}exports[_0xae52('0x7b')]=function(_0x7df24e,_0xd11c71,_0x48b556){var _0x424f15;var _0x27f16a;var _0x41c818;var _0x4aab54=require(_0xae52('0x7c'));return db['VoiceRecording']['findOne']({'where':{'id':_0x7df24e['params']['id']}})[_0xae52('0x26')](function(_0x296e09){if(_0x296e09){var _0xaf6d1b=util[_0xae52('0x52')](_0xae52('0x53'),_0x296e09[_0xae52('0x51')]);if(fs[_0xae52('0x57')](_0xaf6d1b)){cypher=!![];return _0x4aab54[_0xae52('0x54')](_0xaf6d1b,_0x296e09[_0xae52('0x51')],config[_0xae52('0x55')][_0xae52('0x56')])[_0xae52('0x26')](function(){return _0x296e09;});}return _0x296e09;}})[_0xae52('0x26')](function(_0x499553){if(!_0x499553){throw new db['Sequelize'][(_0xae52('0x59'))](_0xae52('0x7d'));}_0x27f16a=_0x499553;return db[_0xae52('0x7e')][_0xae52('0x7f')]({'where':{'id':0x1}});})[_0xae52('0x26')](handleEntityNotFound(_0xd11c71,null))[_0xae52('0x26')](function(_0x872c6c){if(_0x872c6c){_0x424f15=_0x872c6c;if(!_0x424f15[_0xae52('0x80')]||!_0x424f15[_0xae52('0x81')]||!_0x424f15[_0xae52('0x82')]||!_0x424f15['language']||!_0x424f15[_0xae52('0x83')]){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))](_0xae52('0x84'));}if(_0x7df24e['body'][_0xae52('0x85')]&&(!_0x424f15[_0xae52('0x86')]||!_0x424f15['sentimentAccountId']||!_0x424f15['sentimentRegion']||!_0x424f15[_0xae52('0x87')]||!_0x424f15[_0xae52('0x83')])){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xae52('0x88')]['findOne']({'where':{'id':_0x424f15[_0xae52('0x81')]}});}})[_0xae52('0x26')](function(_0x9e1bc6){if(!_0x9e1bc6){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x9e1bc6[_0xae52('0x89')]||!_0x9e1bc6[_0xae52('0x8a')]){throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))](_0xae52('0x8b'));}_0x41c818=_0x9e1bc6;return getBucketslist(_0x41c818['data1'],_0x41c818['data2'],_0x424f15[_0xae52('0x82')]);})[_0xae52('0x26')](function(_0x52b94e){if(_0x52b94e&&_0x52b94e[_0xae52('0x8c')]){var _0xb94d15=_[_0xae52('0x4b')](_0x52b94e[_0xae52('0x8c')],function(_0x14e617){return _0x14e617[_0xae52('0x8d')]===_0x424f15[_0xae52('0x83')];});if(!_0xb94d15){logger[_0xae52('0x67')](util[_0xae52('0x52')](_0xae52('0x8e'),_0x7df24e['params']['id'],_0x424f15[_0xae52('0x83')]));return createBucket(_0x41c818['data1'],_0x41c818[_0xae52('0x8a')],_0x424f15[_0xae52('0x82')],_0x424f15[_0xae52('0x83')]);}logger[_0xae52('0x67')](util[_0xae52('0x52')](_0xae52('0x8f'),_0x7df24e[_0xae52('0x48')]['id'],_0x424f15['bucket']));return;}})[_0xae52('0x26')](function(_0x465710){if(_0x27f16a['transcribeStatus']===_0xae52('0x90')){return transcribe(_0x7df24e[_0xae52('0x48')]['id'],_0x41c818[_0xae52('0x89')],_0x41c818['data2'],_0x424f15['transcribeRegion'],_0x424f15['bucket'],_0x27f16a[_0xae52('0x51')],_0x424f15[_0xae52('0x87')]);}else{logger[_0xae52('0x67')](util[_0xae52('0x52')](_0xae52('0x91'),_0x7df24e[_0xae52('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xae52('0x26')](function(_0x41be9f){if(_0x41be9f){_0x41be9f[_0xae52('0x92')]=_0x7df24e[_0xae52('0x4d')][_0xae52('0x85')];return _0x27f16a[_0xae52('0x93')](_0x41be9f);}})[_0xae52('0x26')](respondWithResult(_0xd11c71,null))[_0xae52('0x46')](handleError(_0xd11c71,null));};function writeFile(_0x83247d,_0x1a4b94){return new Promise(function(_0x18640b,_0x5194cb){fs['writeFile'](_0x1a4b94,_0x83247d,function(_0x121219,_0x57c2ae){if(_0x121219){return _0x5194cb(_0x121219);}else{return _0x18640b(_0x57c2ae);}});});}exports['downloadTranscribe']=function(_0x5f4eff,_0x3335f0,_0x38c014){return db['VoiceRecording'][_0xae52('0x7f')]({'where':{'id':_0x5f4eff[_0xae52('0x48')]['id']}})['then'](handleEntityNotFound(_0x3335f0))[_0xae52('0x26')](function(_0x5c98f9){if(_0x5c98f9&&_0x5c98f9['fileText']){var _0x55b0b7=_0x5c98f9[_0xae52('0x94')];var _0x526a38=config[_0xae52('0x95')]+_0xae52('0x96')+_0x5c98f9['id']+_0xae52('0x97');if(fs[_0xae52('0x57')](_0x526a38)){return _0x526a38;}return writeFile(_0x55b0b7,_0x526a38)[_0xae52('0x26')](function(){return _0x526a38;});}else{throw new db[(_0xae52('0x58'))][(_0xae52('0x59'))]('Transcript\x20not\x20available');}})[_0xae52('0x26')](function(_0x3ee0ef){return _0x3335f0[_0xae52('0x4f')](_0x3ee0ef);})[_0xae52('0x46')](handleError(_0x3335f0));}; \ No newline at end of file +var _0x2bb0=['name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','map','type','VIRTUAL','options','rows','catch','show','length','include','find','create','body','describe','../../components/encryptor','uniqueid','params','value','format','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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)','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','stack'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2bb0,0xf6));var _0x02bb=function(_0x3d5041,_0x49f2f8){_0x3d5041=_0x3d5041-0x0;var _0x52181f=_0x2bb0[_0x3d5041];return _0x52181f;};'use strict';var emlformat=require(_0x02bb('0x0'));var rimraf=require(_0x02bb('0x1'));var zipdir=require(_0x02bb('0x2'));var jsonpatch=require(_0x02bb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02bb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02bb('0x5'));var sox=require(_0x02bb('0x6'));var csv=require('to-csv');var ejs=require(_0x02bb('0x7'));var fs=require('fs');var fs_extra=require(_0x02bb('0x8'));var _=require(_0x02bb('0x9'));var squel=require(_0x02bb('0xa'));var crypto=require('crypto');var jsforce=require(_0x02bb('0xb'));var deskjs=require(_0x02bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x02bb('0xd'));var Papa=require('papaparse');var AWS=require(_0x02bb('0xe'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x02bb('0xf'));var as=require(_0x02bb('0x10'));var hardwareService=require(_0x02bb('0x11'));var logger=require(_0x02bb('0x12'))(_0x02bb('0x13'));var utils=require(_0x02bb('0x14'));var config=require(_0x02bb('0x15'));var licenseUtil=require(_0x02bb('0x16'));var db=require(_0x02bb('0x17'))['db'];function respondWithStatusCode(_0x410748,_0x131e4d){_0x131e4d=_0x131e4d||0xcc;return function(_0x18f633){if(_0x18f633){return _0x410748[_0x02bb('0x18')](_0x131e4d);}return _0x410748[_0x02bb('0x19')](_0x131e4d)['end']();};}function respondWithResult(_0x59f091,_0x577bd5){_0x577bd5=_0x577bd5||0xc8;return function(_0x3bb85f){if(_0x3bb85f){return _0x59f091[_0x02bb('0x19')](_0x577bd5)['json'](_0x3bb85f);}};}function respondWithFilteredResult(_0xf0cd7a,_0x29046c){return function(_0x251045){if(_0x251045){var _0x1920e1=typeof _0x29046c[_0x02bb('0x1a')]===_0x02bb('0x1b')&&typeof _0x29046c[_0x02bb('0x1c')]===_0x02bb('0x1b');var _0x526d42=_0x251045[_0x02bb('0x1d')];var _0x1106d8=_0x1920e1?0x0:_0x29046c[_0x02bb('0x1a')];var _0x4f9107=_0x1920e1?_0x251045[_0x02bb('0x1d')]:_0x29046c[_0x02bb('0x1a')]+_0x29046c[_0x02bb('0x1c')];var _0xc01739;if(_0x4f9107>=_0x526d42){_0x4f9107=_0x526d42;_0xc01739=0xc8;}else{_0xc01739=0xce;}_0xf0cd7a[_0x02bb('0x19')](_0xc01739);return _0xf0cd7a['set']('Content-Range',_0x1106d8+'-'+_0x4f9107+'/'+_0x526d42)[_0x02bb('0x1e')](_0x251045);}return null;};}function patchUpdates(_0x2e43f1){return function(_0xd94cf0){try{jsonpatch[_0x02bb('0x1f')](_0xd94cf0,_0x2e43f1,!![]);}catch(_0x27ef89){return BPromise[_0x02bb('0x20')](_0x27ef89);}return _0xd94cf0[_0x02bb('0x21')]();};}function saveUpdates(_0x305bec,_0x5ef0c9){return function(_0xf243af){if(_0xf243af){return _0xf243af[_0x02bb('0x22')](_0x305bec)[_0x02bb('0x23')](function(_0x5cad1d){return _0x5cad1d;});}return null;};}function removeEntity(_0x3aa24a,_0x3e838f){return function(_0x3f1ceb){if(_0x3f1ceb){return _0x3f1ceb[_0x02bb('0x24')]()[_0x02bb('0x23')](function(){_0x3aa24a[_0x02bb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f38be,_0x51922e){return function(_0x49c5b8){if(!_0x49c5b8){_0x2f38be[_0x02bb('0x18')](0x194);}return _0x49c5b8;};}function handleError(_0x5bcbd3,_0x2b0c77){_0x2b0c77=_0x2b0c77||0x1f4;return function(_0x2e9d95){logger['error'](_0x2e9d95[_0x02bb('0x25')]);if(_0x2e9d95[_0x02bb('0x26')]){delete _0x2e9d95[_0x02bb('0x26')];}_0x5bcbd3[_0x02bb('0x19')](_0x2b0c77)[_0x02bb('0x27')](_0x2e9d95);};}exports[_0x02bb('0x28')]=function(_0x257586,_0x30c98d){var _0x4492ac={},_0xaaaec7={},_0x4aba9c={'count':0x0,'rows':[]};var _0x23c4aa=_['map'](db[_0x02bb('0x29')][_0x02bb('0x2a')],function(_0x3e15ea){return{'name':_0x3e15ea[_0x02bb('0x2b')],'type':_0x3e15ea['type'][_0x02bb('0x2c')]};});_0xaaaec7[_0x02bb('0x2d')]=_[_0x02bb('0x2e')](_['map'](_0x23c4aa,_0x02bb('0x26')),['format']);_0xaaaec7[_0x02bb('0x2f')]=_[_0x02bb('0x30')](_0x257586[_0x02bb('0x2f')]);_0xaaaec7['filters']=_[_0x02bb('0x31')](_0xaaaec7[_0x02bb('0x2d')],_0xaaaec7[_0x02bb('0x2f')]);_0x4492ac[_0x02bb('0x32')]=_[_0x02bb('0x31')](_0xaaaec7[_0x02bb('0x2d')],qs[_0x02bb('0x33')](_0x257586[_0x02bb('0x2f')][_0x02bb('0x33')]));_0x4492ac[_0x02bb('0x32')]=_0x4492ac[_0x02bb('0x32')]['length']?_0x4492ac[_0x02bb('0x32')]:_0xaaaec7[_0x02bb('0x2d')];if(!_0x257586['query'][_0x02bb('0x34')]('nolimit')){_0x4492ac[_0x02bb('0x1c')]=qs[_0x02bb('0x1c')](_0x257586['query'][_0x02bb('0x1c')]);_0x4492ac[_0x02bb('0x1a')]=qs[_0x02bb('0x1a')](_0x257586[_0x02bb('0x2f')]['offset']);}_0x4492ac[_0x02bb('0x35')]=qs[_0x02bb('0x36')](_0x257586[_0x02bb('0x2f')][_0x02bb('0x36')]);_0x4492ac['where']=qs[_0x02bb('0x37')](_[_0x02bb('0x38')](_0x257586[_0x02bb('0x2f')],_0xaaaec7[_0x02bb('0x37')]),_0x23c4aa);if(_0x257586['query']['filter']){_0x4492ac[_0x02bb('0x39')]=_[_0x02bb('0x3a')](_0x4492ac['where'],{'$or':_[_0x02bb('0x3b')](_0x23c4aa,function(_0x531328){if(_0x531328[_0x02bb('0x3c')]!==_0x02bb('0x3d')){var _0x5e4eb0={};_0x5e4eb0[_0x531328['name']]={'$like':'%'+_0x257586[_0x02bb('0x2f')]['filter']+'%'};return _0x5e4eb0;}})});}_0x4492ac=_[_0x02bb('0x3a')]({},_0x4492ac,_0x257586[_0x02bb('0x3e')]);var _0x1adfc7={'where':_0x4492ac[_0x02bb('0x39')]};return db[_0x02bb('0x29')]['count'](_0x1adfc7)[_0x02bb('0x23')](function(_0x5094e8){_0x4aba9c['count']=_0x5094e8;if(_0x257586[_0x02bb('0x2f')]['includeAll']){_0x4492ac['include']=[{'all':!![]}];}return db[_0x02bb('0x29')]['findAll'](_0x4492ac);})[_0x02bb('0x23')](function(_0xb29e7b){_0x4aba9c[_0x02bb('0x3f')]=_0xb29e7b;return _0x4aba9c;})[_0x02bb('0x23')](respondWithFilteredResult(_0x30c98d,_0x4492ac))[_0x02bb('0x40')](handleError(_0x30c98d,null));};exports[_0x02bb('0x41')]=function(_0x47967c,_0x75db17){var _0x42898c={'raw':![],'where':{'id':_0x47967c['params']['id']}},_0x5086a1={};_0x5086a1[_0x02bb('0x2d')]=_['keys'](db[_0x02bb('0x29')]['rawAttributes']);_0x5086a1[_0x02bb('0x2f')]=_['keys'](_0x47967c[_0x02bb('0x2f')]);_0x5086a1['filters']=_['intersection'](_0x5086a1[_0x02bb('0x2d')],_0x5086a1[_0x02bb('0x2f')]);_0x42898c[_0x02bb('0x32')]=_[_0x02bb('0x31')](_0x5086a1[_0x02bb('0x2d')],qs[_0x02bb('0x33')](_0x47967c[_0x02bb('0x2f')][_0x02bb('0x33')]));_0x42898c['attributes']=_0x42898c[_0x02bb('0x32')][_0x02bb('0x42')]?_0x42898c['attributes']:_0x5086a1['model'];if(_0x47967c[_0x02bb('0x2f')]['includeAll']){_0x42898c[_0x02bb('0x43')]=[{'all':!![]}];}_0x42898c=_[_0x02bb('0x3a')]({},_0x42898c,_0x47967c['options']);return db[_0x02bb('0x29')][_0x02bb('0x44')](_0x42898c)['then'](handleEntityNotFound(_0x75db17,null))[_0x02bb('0x23')](respondWithResult(_0x75db17,null))[_0x02bb('0x40')](handleError(_0x75db17,null));};exports[_0x02bb('0x45')]=function(_0x2d1edf,_0x10647e){return db[_0x02bb('0x29')][_0x02bb('0x45')](_0x2d1edf[_0x02bb('0x46')],{})['then'](respondWithResult(_0x10647e,0xc9))[_0x02bb('0x40')](handleError(_0x10647e,null));};exports[_0x02bb('0x22')]=function(_0x4221c1,_0x5480c3){if(_0x4221c1[_0x02bb('0x46')]['id']){delete _0x4221c1['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x4221c1['params']['id']}})[_0x02bb('0x23')](handleEntityNotFound(_0x5480c3,null))[_0x02bb('0x23')](saveUpdates(_0x4221c1[_0x02bb('0x46')],null))[_0x02bb('0x23')](respondWithResult(_0x5480c3,null))[_0x02bb('0x40')](handleError(_0x5480c3,null));};exports[_0x02bb('0x47')]=function(_0x1b23e5,_0x5e09d4){return db[_0x02bb('0x29')][_0x02bb('0x47')]()[_0x02bb('0x23')](respondWithResult(_0x5e09d4,null))[_0x02bb('0x40')](handleError(_0x5e09d4,null));};exports['download']=function(_0x4574e9,_0x4f044e,_0x5f2877){var _0x389884=require(_0x02bb('0x48'));var _0x50353b=![];var _0x54ced3={};if(_0x4574e9[_0x02bb('0x2f')][_0x02bb('0x3c')]&&_0x4574e9[_0x02bb('0x2f')][_0x02bb('0x3c')]===_0x02bb('0x49')){_0x54ced3[_0x02bb('0x49')]=_0x4574e9[_0x02bb('0x4a')]['id'];}else{_0x54ced3['id']=_0x4574e9[_0x02bb('0x4a')]['id'];}return db[_0x02bb('0x29')][_0x02bb('0x44')]({'where':_0x54ced3,'attributes':['id',_0x02bb('0x4b')],'raw':!![]})[_0x02bb('0x23')](handleEntityNotFound(_0x4f044e,null))['then'](function(_0x20c9c4){if(_0x20c9c4){var _0x20e61f=_0x20c9c4[_0x02bb('0x4b')];var _0x1cf9dd=util[_0x02bb('0x4c')]('%s.cypher',_0x20e61f);if(fs[_0x02bb('0x4d')](_0x1cf9dd)){_0x50353b=!![];return _0x389884[_0x02bb('0x4e')](_0x1cf9dd,_0x20e61f,config[_0x02bb('0x4f')]['recording'])[_0x02bb('0x23')](function(){return _0x20c9c4;});}return _0x20c9c4;}})[_0x02bb('0x23')](function(_0x32bfac){if(_0x32bfac){var _0xbdb1d9=_0x32bfac[_0x02bb('0x4b')];if(!fs['existsSync'](_0xbdb1d9)){throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))]('VoiceRecording\x20not\x20found');}if(_0x32bfac[_0x02bb('0x52')]){return _0x4f044e[_0x02bb('0x53')](_0xbdb1d9,_0x32bfac[_0x02bb('0x52')]+path[_0x02bb('0x54')](_0xbdb1d9),function(){if(_0x50353b){fs['unlink'](_0xbdb1d9);}});}else{return _0x4f044e[_0x02bb('0x53')](_0xbdb1d9,function(_0x300a8c){if(_0x50353b){fs[_0x02bb('0x55')](_0xbdb1d9);}});}}})['catch'](function(_0x3fe0da){if(_0x3fe0da[_0x02bb('0x56')]===_0x02bb('0x57')){_0x4f044e[_0x02bb('0x19')](0x194)['send'](_0x02bb('0x58'));}else{return handleError(_0x4f044e,null);}});};exports['downloads']=function(_0x2e7f34,_0x8710f8,_0x55e2ed){var _0x4d43e0=require(_0x02bb('0x48'));var _0x535e24=![];var _0x31f67a={'$and':[db[_0x02bb('0x59')][_0x02bb('0x39')](db[_0x02bb('0x59')]['fn'](_0x02bb('0x5a'),db[_0x02bb('0x59')][_0x02bb('0x5b')](_0x02bb('0x49'))),_0x2e7f34['query'][_0x02bb('0x5c')])]};if(_0x2e7f34['query'][_0x02bb('0x3c')]&&_0x2e7f34[_0x02bb('0x2f')][_0x02bb('0x3c')]===_0x02bb('0x49')){_0x31f67a[_0x02bb('0x5d')]['push']({'uniqueid':_0x2e7f34['params']['id']});}else{_0x31f67a[_0x02bb('0x5d')][_0x02bb('0x5e')]({'id':_0x2e7f34['params']['id']});}return db[_0x02bb('0x29')][_0x02bb('0x44')]({'where':_0x31f67a,'attributes':['id',_0x02bb('0x4b')],'raw':!![]})[_0x02bb('0x23')](handleEntityNotFound(_0x8710f8,null))[_0x02bb('0x23')](function(_0x1c9f5a){if(_0x1c9f5a){var _0x24a7e5=util[_0x02bb('0x4c')](_0x02bb('0x5f'),_0x1c9f5a[_0x02bb('0x4b')]);if(fs[_0x02bb('0x4d')](_0x24a7e5)){_0x535e24=!![];return _0x4d43e0[_0x02bb('0x4e')](_0x24a7e5,_0x1c9f5a[_0x02bb('0x4b')],config[_0x02bb('0x4f')]['recording'])[_0x02bb('0x23')](function(){return _0x1c9f5a;});}return _0x1c9f5a;}})[_0x02bb('0x23')](function(_0x15c3d9){if(_0x15c3d9){if(!fs[_0x02bb('0x4d')](_0x15c3d9[_0x02bb('0x4b')])){throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))](_0x02bb('0x57'));}if(_0x15c3d9[_0x02bb('0x52')]){return _0x8710f8[_0x02bb('0x53')](_0x15c3d9[_0x02bb('0x4b')],_0x15c3d9[_0x02bb('0x52')]+path[_0x02bb('0x54')](_0x15c3d9[_0x02bb('0x4b')]),function(){if(_0x535e24){fs[_0x02bb('0x55')](_0x15c3d9['value']);}});}else{return _0x8710f8[_0x02bb('0x53')](_0x15c3d9[_0x02bb('0x4b')],function(_0x4035c9){if(_0x535e24){fs[_0x02bb('0x55')](_0x15c3d9[_0x02bb('0x4b')]);}});}}})[_0x02bb('0x40')](handleError(_0x8710f8,null));};exports['destroy']=function(_0x3d2e33,_0x119cba){return db[_0x02bb('0x29')][_0x02bb('0x44')]({'where':{'id':_0x3d2e33[_0x02bb('0x4a')]['id']}})[_0x02bb('0x23')](function(_0x5a16fe){if(_[_0x02bb('0x60')](_0x5a16fe)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5a16fe;})['then'](function(_0x5ec741){var _0x1c2cf8=_0x5ec741[_0x02bb('0x4b')];logger[_0x02bb('0x61')](_0x02bb('0x62'),_0x1c2cf8);if(!_['isNil'](_0x5ec741[_0x02bb('0x4b')])&&fs[_0x02bb('0x4d')](_0x1c2cf8)){logger[_0x02bb('0x61')](_0x02bb('0x63')+_0x1c2cf8+_0x02bb('0x64'));fs[_0x02bb('0x65')](_0x1c2cf8);}_0x1c2cf8=_0x1c2cf8+_0x02bb('0x66');if(!_['isNil'](_0x5ec741[_0x02bb('0x4b')])&&fs[_0x02bb('0x4d')](_0x1c2cf8)){logger['info'](_0x02bb('0x63')+_0x1c2cf8+_0x02bb('0x64'));fs[_0x02bb('0x65')](_0x1c2cf8);}return _0x5ec741;})[_0x02bb('0x23')](function(_0x2e5a0e){if(!_0x2e5a0e)throw new InternalError();return _0x2e5a0e[_0x02bb('0x24')]();})['then'](function(){_0x119cba[_0x02bb('0x19')](0xcc)['end']();})[_0x02bb('0x40')](handleError(_0x119cba,null));};function getBucketslist(_0x54572d,_0x57991a,_0x2955c4){return new Promise(function(_0x7b1ddb,_0x4136b2){var _0x35f401=new AWS['S3']({'accessKeyId':_0x57991a,'secretAccessKey':_0x54572d,'region':_0x2955c4});_0x35f401[_0x02bb('0x67')]({},function(_0x27389f,_0x980468){if(_0x27389f){return _0x4136b2(_0x27389f);}else{return _0x7b1ddb(_0x980468);}});});}function createBucket(_0x18bb92,_0x1594f7,_0x4f128a,_0x5bdc65){return new Promise(function(_0x2cbd84,_0x4ef5b8){var _0x227aa2=new AWS['S3']({'accessKeyId':_0x1594f7,'secretAccessKey':_0x18bb92,'region':_0x4f128a});_0x227aa2[_0x02bb('0x68')]({'Bucket':_0x5bdc65},function(_0x5c632d,_0x1759dc){if(_0x5c632d){return _0x4ef5b8(_0x5c632d);}else{return _0x2cbd84(_0x1759dc);}});});}function uploadFile(_0x4385b8,_0x577551,_0x4a10d3,_0x395c14,_0x163bb6,_0x156869){return new Promise(function(_0x48eba9,_0x52e47c){var _0x594525=new AWS['S3']({'accessKeyId':_0x577551,'secretAccessKey':_0x4385b8,'region':_0x4a10d3});_0x594525[_0x02bb('0x69')]({'Bucket':_0x395c14,'Key':_0x163bb6,'Body':_0x156869},function(_0x6eb65,_0x3a2c2f){if(_0x6eb65){return _0x52e47c(_0x6eb65);}else{return _0x48eba9(_0x3a2c2f);}});});}function startTranscribe(_0x497b9e,_0x5952dd,_0x4a8c3f,_0x13ea68,_0xd25cd,_0x434423){return new Promise(function(_0x406f6a,_0x3476c3){var _0x2a5b49=new AWS[(_0x02bb('0x6a'))]({'accessKeyId':_0x5952dd,'secretAccessKey':_0x497b9e,'region':_0x4a8c3f});_0x2a5b49[_0x02bb('0x6b')]({'TranscriptionJobName':_0x13ea68,'LanguageCode':_0xd25cd,'Media':{'MediaFileUri':_0x434423}},function(_0x25bcea,_0x435981){if(_0x25bcea){return _0x3476c3(_0x25bcea);}else{return _0x406f6a(_0x435981);}});});}function transcribe(_0x30424a,_0x3e5eeb,_0x50a39e,_0x5e1099,_0x5609d6,_0x1a416d,_0x202227){return new Promise(function(_0x338503,_0x302365){var _0xb87d59={};logger[_0x02bb('0x61')](util['format'](_0x02bb('0x6c'),_0x30424a,_0x5609d6));return uploadFile(_0x3e5eeb,_0x50a39e,_0x5e1099,_0x5609d6,path[_0x02bb('0x6d')](_0x1a416d),fs['readFileSync'](_0x1a416d))[_0x02bb('0x23')](function(_0x22474f){logger[_0x02bb('0x61')](util[_0x02bb('0x4c')](_0x02bb('0x6e'),_0x30424a,_0x5609d6,_0x22474f['Location']));_0xb87d59[_0x02bb('0x6f')]=_0x22474f[_0x02bb('0x70')];_0xb87d59['location']=_0x22474f['Location'];logger[_0x02bb('0x61')](util['format'](_0x02bb('0x71'),_0x30424a));return startTranscribe(_0x3e5eeb,_0x50a39e,_0x5e1099,uuidv4(),_0x202227,_0x22474f['Location']);})[_0x02bb('0x23')](function(_0x3cb2f7){logger[_0x02bb('0x61')](util[_0x02bb('0x4c')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x30424a,_0x3cb2f7['TranscriptionJob'][_0x02bb('0x72')]));_0xb87d59[_0x02bb('0x73')]=_0x3cb2f7[_0x02bb('0x74')][_0x02bb('0x72')];_0xb87d59['transcribeStatus']=_0x3cb2f7['TranscriptionJob'][_0x02bb('0x75')];return _0x338503(_0xb87d59);})['catch'](function(_0x475f41){return _0x302365(_0x475f41);});});}exports[_0x02bb('0x76')]=function(_0x433e7d,_0x40fd47,_0x306e91){var _0x54aa8c;var _0x9f1ede;var _0x51a8fd;var _0x2ee654=require(_0x02bb('0x48'));return db[_0x02bb('0x29')][_0x02bb('0x77')]({'where':{'id':_0x433e7d[_0x02bb('0x4a')]['id']}})['then'](function(_0x43e6ef){if(_0x43e6ef){var _0x520180=util[_0x02bb('0x4c')](_0x02bb('0x5f'),_0x43e6ef[_0x02bb('0x4b')]);if(fs[_0x02bb('0x4d')](_0x520180)){cypher=!![];return _0x2ee654['decryptFile'](_0x520180,_0x43e6ef['value'],config[_0x02bb('0x4f')]['recording'])[_0x02bb('0x23')](function(){return _0x43e6ef;});}return _0x43e6ef;}})[_0x02bb('0x23')](function(_0x4ce20d){if(!_0x4ce20d){throw new db['Sequelize'][(_0x02bb('0x51'))](_0x02bb('0x78'));}_0x9f1ede=_0x4ce20d;return db[_0x02bb('0x79')][_0x02bb('0x77')]({'where':{'id':0x1}});})[_0x02bb('0x23')](handleEntityNotFound(_0x40fd47,null))[_0x02bb('0x23')](function(_0x5d00f8){if(_0x5d00f8){_0x54aa8c=_0x5d00f8;if(!_0x54aa8c[_0x02bb('0x7a')]||!_0x54aa8c[_0x02bb('0x7b')]||!_0x54aa8c[_0x02bb('0x7c')]||!_0x54aa8c[_0x02bb('0x7d')]||!_0x54aa8c[_0x02bb('0x6f')]){throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))]('Transcribe\x20not\x20configured');}if(_0x433e7d['body']['runSentiment']&&(!_0x54aa8c[_0x02bb('0x7e')]||!_0x54aa8c['sentimentAccountId']||!_0x54aa8c['sentimentRegion']||!_0x54aa8c[_0x02bb('0x7d')]||!_0x54aa8c[_0x02bb('0x6f')])){throw new db['Sequelize']['ValidationError'](_0x02bb('0x7f'));}return db['CloudProvider'][_0x02bb('0x77')]({'where':{'id':_0x54aa8c[_0x02bb('0x7b')]}});}})[_0x02bb('0x23')](function(_0x26b3cd){if(!_0x26b3cd){throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x26b3cd[_0x02bb('0x80')]||!_0x26b3cd[_0x02bb('0x81')]){throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x51a8fd=_0x26b3cd;return getBucketslist(_0x51a8fd[_0x02bb('0x80')],_0x51a8fd[_0x02bb('0x81')],_0x54aa8c[_0x02bb('0x7c')]);})[_0x02bb('0x23')](function(_0x3d849c){if(_0x3d849c&&_0x3d849c[_0x02bb('0x82')]){var _0x1bd85e=_[_0x02bb('0x44')](_0x3d849c['Buckets'],function(_0x32dc1a){return _0x32dc1a[_0x02bb('0x83')]===_0x54aa8c['bucket'];});if(!_0x1bd85e){logger[_0x02bb('0x61')](util[_0x02bb('0x4c')](_0x02bb('0x84'),_0x433e7d[_0x02bb('0x4a')]['id'],_0x54aa8c[_0x02bb('0x6f')]));return createBucket(_0x51a8fd[_0x02bb('0x80')],_0x51a8fd[_0x02bb('0x81')],_0x54aa8c[_0x02bb('0x7c')],_0x54aa8c['bucket']);}logger[_0x02bb('0x61')](util[_0x02bb('0x4c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x433e7d[_0x02bb('0x4a')]['id'],_0x54aa8c[_0x02bb('0x6f')]));return;}})[_0x02bb('0x23')](function(_0x4acddc){if(_0x9f1ede['transcribeStatus']===_0x02bb('0x85')){return transcribe(_0x433e7d['params']['id'],_0x51a8fd[_0x02bb('0x80')],_0x51a8fd[_0x02bb('0x81')],_0x54aa8c[_0x02bb('0x7c')],_0x54aa8c[_0x02bb('0x6f')],_0x9f1ede[_0x02bb('0x4b')],_0x54aa8c[_0x02bb('0x7d')]);}else{logger[_0x02bb('0x61')](util['format'](_0x02bb('0x86'),_0x433e7d[_0x02bb('0x4a')]['id']));return{'transcribeStatus':_0x02bb('0x87')};}})[_0x02bb('0x23')](function(_0xa73d98){if(_0xa73d98){_0xa73d98[_0x02bb('0x88')]=_0x433e7d[_0x02bb('0x46')][_0x02bb('0x89')];return _0x9f1ede[_0x02bb('0x8a')](_0xa73d98);}})[_0x02bb('0x23')](respondWithResult(_0x40fd47,null))[_0x02bb('0x40')](handleError(_0x40fd47,null));};function writeFile(_0x5d8c2c,_0x16a3a2){return new Promise(function(_0x13f3a4,_0x334d34){fs[_0x02bb('0x8b')](_0x16a3a2,_0x5d8c2c,function(_0x6f79c2,_0x458077){if(_0x6f79c2){return _0x334d34(_0x6f79c2);}else{return _0x13f3a4(_0x458077);}});});}exports['downloadTranscribe']=function(_0x4bbe4c,_0x3e6c84,_0xedd5fb){return db[_0x02bb('0x29')][_0x02bb('0x77')]({'where':{'id':_0x4bbe4c[_0x02bb('0x4a')]['id']}})[_0x02bb('0x23')](handleEntityNotFound(_0x3e6c84))['then'](function(_0x16e10e){if(_0x16e10e&&_0x16e10e['fileText']){var _0x631561=_0x16e10e['fileText'];var _0x3f2a05=config['root']+_0x02bb('0x8c')+_0x16e10e['id']+'.txt';if(fs[_0x02bb('0x4d')](_0x3f2a05)){return _0x3f2a05;}return writeFile(_0x631561,_0x3f2a05)['then'](function(){return _0x3f2a05;});}else{throw new db[(_0x02bb('0x50'))][(_0x02bb('0x51'))](_0x02bb('0x8d'));}})['then'](function(_0x39f23c){return _0x3e6c84[_0x02bb('0x53')](_0x39f23c);})[_0x02bb('0x40')](handleError(_0x3e6c84));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6424450..4dd4920 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 _0x4711=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x5a64eb,_0x286782){var _0x3ad930=function(_0x36a52f){while(--_0x36a52f){_0x5a64eb['push'](_0x5a64eb['shift']());}};_0x3ad930(++_0x286782);}(_0x4711,0x10c));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0x1471('0x0'));module[_0x1471('0x1')]=function(_0x130bf6,_0x3ff2f1){return _0x130bf6[_0x1471('0x2')](_0x1471('0x3'),attributes,{'tableName':_0x1471('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1471('0x5')]},{'name':'transcribeStatus','fields':[_0x1471('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c4=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x393d4e,_0x206d55){var _0x13cd48=function(_0x5f4b86){while(--_0x5f4b86){_0x393d4e['push'](_0x393d4e['shift']());}};_0x13cd48(++_0x206d55);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x1b7d53,_0xee7979){_0x1b7d53=_0x1b7d53-0x0;var _0x30727a=_0xc1c4[_0x1b7d53];return _0x30727a;};'use strict';var attributes=require(_0x4c1c('0x0'));module[_0x4c1c('0x1')]=function(_0x2fb284,_0x1c91ef){return _0x2fb284[_0x4c1c('0x2')](_0x4c1c('0x3'),attributes,{'tableName':_0x4c1c('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4c1c('0x5')]},{'name':_0x4c1c('0x6'),'fields':[_0x4c1c('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b01d2e7..0882c84 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 _0xed1c=['jayson/promise','client','http','request','then','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','catch','UpdateVoiceRecording','VoiceRecording','body','options','where','attributes','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4eaa9c,_0x3a879a){var _0x46b796=function(_0x41f4bc){while(--_0x41f4bc){_0x4eaa9c['push'](_0x4eaa9c['shift']());}};_0x46b796(++_0x3a879a);}(_0xed1c,0xe4));var _0xced1=function(_0x39bdc0,_0xccf66c){_0x39bdc0=_0x39bdc0-0x0;var _0x5bd988=_0xed1c[_0x39bdc0];return _0x5bd988;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['update'](_0x5a563a[_0xced1('0x16')],{'raw':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a['options']?_0x5a563a[_0xced1('0x17')][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x17')]?_0x5a563a['options']['limit']||null:null})[_0xced1('0xa')](function(_0x41ee91){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger[_0xced1('0x1a')]('UpdateVoiceRecording',_0x5a563a,JSON[_0xced1('0xe')](_0x41ee91));_0x2a92c8(_0x41ee91);})[_0xced1('0x13')](function(_0x4ea85e){logger['error'](_0xced1('0x14'),_0x4ea85e[_0xced1('0x11')],_0x5a563a);_0x111fb0(_0x56fc50[_0xced1('0xf')](0x1f4,_0x4ea85e[_0xced1('0x11')]));});});};exports[_0xced1('0x1b')]=function(_0x25b6e7){var _0x50c543=this;return new Promise(function(_0x181f6e,_0xf51411){var _0x43cdec=require(_0xced1('0x1c'));var _0x34dd2e;return db[_0xced1('0x1d')][_0xced1('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xced1('0xa')](function(_0x4ef64e){_0x34dd2e=_0x4ef64e;return db[_0xced1('0x15')][_0xced1('0x1f')](_0x25b6e7[_0xced1('0x16')]);})[_0xced1('0xa')](function(_0x5f03cc){if(_0x34dd2e['callRecordingEncryption']&&fs[_0xced1('0x20')](_0x5f03cc[_0xced1('0x21')])){var _0x2bc785=util['format']('%s.cypher',_0x5f03cc['value']);return _0x43cdec[_0xced1('0x22')](_0x5f03cc[_0xced1('0x21')],_0x2bc785,config[_0xced1('0x23')][_0xced1('0x24')])['then'](function(){fs[_0xced1('0x25')](_0x5f03cc[_0xced1('0x21')]);logger[_0xced1('0xb')](_0xced1('0x26'));return _0x5f03cc;});}return _0x5f03cc;})[_0xced1('0xa')](function(_0x33ac43){logger[_0xced1('0xb')]('CreateVoiceRecording',_0x25b6e7);logger['debug'](_0xced1('0x1b'),_0x25b6e7,JSON[_0xced1('0xe')](_0x33ac43));_0x181f6e(_0x33ac43);})[_0xced1('0x13')](function(_0x7ebeb3){logger[_0xced1('0xf')](_0xced1('0x1b'),_0x7ebeb3['message'],_0x25b6e7);_0xf51411(_0x50c543['error'](0x1f4,_0x7ebeb3['message']));});});}; \ No newline at end of file +var _0xed1c=['jayson/promise','client','http','request','then','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','catch','UpdateVoiceRecording','VoiceRecording','body','options','where','attributes','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xed1c,0xe4));var _0xced1=function(_0x26bc2a,_0x56e986){_0x26bc2a=_0x26bc2a-0x0;var _0x10118d=_0xed1c[_0x26bc2a];return _0x10118d;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['update'](_0x5a563a[_0xced1('0x16')],{'raw':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a['options']?_0x5a563a[_0xced1('0x17')][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x17')]?_0x5a563a['options']['limit']||null:null})[_0xced1('0xa')](function(_0x41ee91){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger[_0xced1('0x1a')]('UpdateVoiceRecording',_0x5a563a,JSON[_0xced1('0xe')](_0x41ee91));_0x2a92c8(_0x41ee91);})[_0xced1('0x13')](function(_0x4ea85e){logger['error'](_0xced1('0x14'),_0x4ea85e[_0xced1('0x11')],_0x5a563a);_0x111fb0(_0x56fc50[_0xced1('0xf')](0x1f4,_0x4ea85e[_0xced1('0x11')]));});});};exports[_0xced1('0x1b')]=function(_0x25b6e7){var _0x50c543=this;return new Promise(function(_0x181f6e,_0xf51411){var _0x43cdec=require(_0xced1('0x1c'));var _0x34dd2e;return db[_0xced1('0x1d')][_0xced1('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xced1('0xa')](function(_0x4ef64e){_0x34dd2e=_0x4ef64e;return db[_0xced1('0x15')][_0xced1('0x1f')](_0x25b6e7[_0xced1('0x16')]);})[_0xced1('0xa')](function(_0x5f03cc){if(_0x34dd2e['callRecordingEncryption']&&fs[_0xced1('0x20')](_0x5f03cc[_0xced1('0x21')])){var _0x2bc785=util['format']('%s.cypher',_0x5f03cc['value']);return _0x43cdec[_0xced1('0x22')](_0x5f03cc[_0xced1('0x21')],_0x2bc785,config[_0xced1('0x23')][_0xced1('0x24')])['then'](function(){fs[_0xced1('0x25')](_0x5f03cc[_0xced1('0x21')]);logger[_0xced1('0xb')](_0xced1('0x26'));return _0x5f03cc;});}return _0x5f03cc;})[_0xced1('0xa')](function(_0x33ac43){logger[_0xced1('0xb')]('CreateVoiceRecording',_0x25b6e7);logger['debug'](_0xced1('0x1b'),_0x25b6e7,JSON[_0xced1('0xe')](_0x33ac43));_0x181f6e(_0x33ac43);})[_0xced1('0x13')](function(_0x7ebeb3){logger[_0xced1('0xf')](_0xced1('0x1b'),_0x7ebeb3['message'],_0x25b6e7);_0xf51411(_0x50c543['error'](0x1f4,_0x7ebeb3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c39f113..4bc29ff 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 _0xf785=['put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','describe','show','post','create'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xf785,0x1d8));var _0x5f78=function(_0x324fa3,_0x13e74a){_0x324fa3=_0x324fa3-0x0;var _0x340963=_0xf785[_0x324fa3];return _0x340963;};'use strict';var multer=require(_0x5f78('0x0'));var util=require('util');var path=require(_0x5f78('0x1'));var timeout=require(_0x5f78('0x2'));var express=require(_0x5f78('0x3'));var router=express[_0x5f78('0x4')]();var fs_extra=require(_0x5f78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f78('0x6'));var config=require('../../config/environment');var controller=require(_0x5f78('0x7'));router[_0x5f78('0x8')]('/',auth[_0x5f78('0x9')](),controller['index']);router['get']('/describe',auth[_0x5f78('0x9')](),controller[_0x5f78('0xa')]);router[_0x5f78('0x8')]('/:id',auth[_0x5f78('0x9')](),controller[_0x5f78('0xb')]);router[_0x5f78('0xc')]('/',auth[_0x5f78('0x9')](),controller[_0x5f78('0xd')]);router[_0x5f78('0xe')](_0x5f78('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5f78('0xf'),auth[_0x5f78('0x9')](),controller[_0x5f78('0x10')]);module[_0x5f78('0x11')]=router; \ No newline at end of file +var _0xb699=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb699,0xea));var _0x9b69=function(_0x33b6f7,_0x55def2){_0x33b6f7=_0x33b6f7-0x0;var _0x5e14c9=_0xb699[_0x33b6f7];return _0x5e14c9;};'use strict';var multer=require(_0x9b69('0x0'));var util=require('util');var path=require(_0x9b69('0x1'));var timeout=require(_0x9b69('0x2'));var express=require(_0x9b69('0x3'));var router=express[_0x9b69('0x4')]();var fs_extra=require(_0x9b69('0x5'));var auth=require(_0x9b69('0x6'));var interaction=require(_0x9b69('0x7'));var config=require(_0x9b69('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x9b69('0x9')]('/',auth[_0x9b69('0xa')](),controller[_0x9b69('0xb')]);router[_0x9b69('0x9')](_0x9b69('0xc'),auth[_0x9b69('0xa')](),controller[_0x9b69('0xd')]);router[_0x9b69('0x9')]('/:id',auth[_0x9b69('0xa')](),controller['show']);router[_0x9b69('0xe')]('/',auth[_0x9b69('0xa')](),controller['create']);router[_0x9b69('0xf')](_0x9b69('0x10'),auth[_0x9b69('0xa')](),controller[_0x9b69('0x11')]);router[_0x9b69('0x12')]('/:id',auth[_0x9b69('0xa')](),controller[_0x9b69('0x13')]);module[_0x9b69('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e57f74c..0939919 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 _0xcd27=['blind','attended','STRING','exports','ENUM'];(function(_0x35da1e,_0x1acfce){var _0x20d02e=function(_0x480f20){while(--_0x480f20){_0x35da1e['push'](_0x35da1e['shift']());}};_0x20d02e(++_0x1acfce);}(_0xcd27,0x1e3));var _0x7cd2=function(_0x431586,_0xc876f4){_0x431586=_0x431586-0x0;var _0x40ad1b=_0xcd27[_0x431586];return _0x40ad1b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7cd2('0x0')]={'type':{'type':Sequelize[_0x7cd2('0x1')](_0x7cd2('0x2'),_0x7cd2('0x3'))},'result':{'type':Sequelize[_0x7cd2('0x4')]},'transfererchannel':{'type':Sequelize[_0x7cd2('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7cd2('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7cd2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7cd2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x7cd2('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x7cd2('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7cd2('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7cd2('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x7cd2('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7cd2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7cd2('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x7cd2('0x4')]},'extension':{'type':Sequelize[_0x7cd2('0x4')]}}; \ No newline at end of file +var _0x58e9=['blind','attended','STRING','moment','exports','ENUM'];(function(_0x2d58dc,_0x518125){var _0x3fb49f=function(_0x1bcdf7){while(--_0x1bcdf7){_0x2d58dc['push'](_0x2d58dc['shift']());}};_0x3fb49f(++_0x518125);}(_0x58e9,0x13b));var _0x958e=function(_0x48053c,_0x2c9f86){_0x48053c=_0x48053c-0x0;var _0x21900d=_0x58e9[_0x48053c];return _0x21900d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x958e('0x0'));module[_0x958e('0x1')]={'type':{'type':Sequelize[_0x958e('0x2')](_0x958e('0x3'),_0x958e('0x4'))},'result':{'type':Sequelize[_0x958e('0x5')]},'transfererchannel':{'type':Sequelize[_0x958e('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x958e('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x958e('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x958e('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x958e('0x5')]},'transferercontext':{'type':Sequelize[_0x958e('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x958e('0x5')]},'transfereechannel':{'type':Sequelize[_0x958e('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x958e('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x958e('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x958e('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x958e('0x5')]},'transfereecontext':{'type':Sequelize[_0x958e('0x5')]},'transfereeexten':{'type':Sequelize[_0x958e('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x958e('0x5')]},'isexternal':{'type':Sequelize[_0x958e('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x958e('0x5')]},'extension':{'type':Sequelize[_0x958e('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7b9f7bd..082149c 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 _0x4a20=['count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','nolimit','sort','filters','pick','filter','where','merge','options'];(function(_0x4b4b06,_0x27f28b){var _0x477a49=function(_0x4e8300){while(--_0x4e8300){_0x4b4b06['push'](_0x4b4b06['shift']());}};_0x477a49(++_0x27f28b);}(_0x4a20,0xaf));var _0x04a2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4a20[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x04a2('0x0'));var rimraf=require(_0x04a2('0x1'));var zipdir=require(_0x04a2('0x2'));var jsonpatch=require(_0x04a2('0x3'));var rp=require(_0x04a2('0x4'));var moment=require(_0x04a2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x04a2('0x6'));var util=require(_0x04a2('0x7'));var path=require(_0x04a2('0x8'));var sox=require(_0x04a2('0x9'));var csv=require(_0x04a2('0xa'));var ejs=require(_0x04a2('0xb'));var fs=require('fs');var fs_extra=require(_0x04a2('0xc'));var _=require(_0x04a2('0xd'));var squel=require(_0x04a2('0xe'));var crypto=require(_0x04a2('0xf'));var jsforce=require(_0x04a2('0x10'));var deskjs=require(_0x04a2('0x11'));var toCsv=require(_0x04a2('0xa'));var querystring=require(_0x04a2('0x12'));var Papa=require(_0x04a2('0x13'));var Redis=require(_0x04a2('0x14'));var authService=require(_0x04a2('0x15'));var qs=require(_0x04a2('0x16'));var as=require(_0x04a2('0x17'));var hardwareService=require(_0x04a2('0x18'));var logger=require(_0x04a2('0x19'))(_0x04a2('0x1a'));var utils=require(_0x04a2('0x1b'));var config=require(_0x04a2('0x1c'));var licenseUtil=require(_0x04a2('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45867f,_0x46799b){_0x46799b=_0x46799b||0xcc;return function(_0x56ba9f){if(_0x56ba9f){return _0x45867f['sendStatus'](_0x46799b);}return _0x45867f['status'](_0x46799b)[_0x04a2('0x1e')]();};}function respondWithResult(_0x19f151,_0x330e3c){_0x330e3c=_0x330e3c||0xc8;return function(_0x34b2a9){if(_0x34b2a9){return _0x19f151[_0x04a2('0x1f')](_0x330e3c)[_0x04a2('0x20')](_0x34b2a9);}};}function respondWithFilteredResult(_0x702cce,_0x45f3b4){return function(_0x39296d){if(_0x39296d){var _0x392b15=typeof _0x45f3b4[_0x04a2('0x21')]===_0x04a2('0x22')&&typeof _0x45f3b4[_0x04a2('0x23')]===_0x04a2('0x22');var _0x11f671=_0x39296d['count'];var _0x2b8e02=_0x392b15?0x0:_0x45f3b4[_0x04a2('0x21')];var _0x1c04b3=_0x392b15?_0x39296d['count']:_0x45f3b4[_0x04a2('0x21')]+_0x45f3b4[_0x04a2('0x23')];var _0x55dce1;if(_0x1c04b3>=_0x11f671){_0x1c04b3=_0x11f671;_0x55dce1=0xc8;}else{_0x55dce1=0xce;}_0x702cce[_0x04a2('0x1f')](_0x55dce1);return _0x702cce['set'](_0x04a2('0x24'),_0x2b8e02+'-'+_0x1c04b3+'/'+_0x11f671)[_0x04a2('0x20')](_0x39296d);}return null;};}function patchUpdates(_0x3f706c){return function(_0x2e5e17){try{jsonpatch[_0x04a2('0x25')](_0x2e5e17,_0x3f706c,!![]);}catch(_0x4deae8){return BPromise[_0x04a2('0x26')](_0x4deae8);}return _0x2e5e17['save']();};}function saveUpdates(_0x465932,_0x5f4149){return function(_0x416d4e){if(_0x416d4e){return _0x416d4e[_0x04a2('0x27')](_0x465932)[_0x04a2('0x28')](function(_0x1b3fd8){return _0x1b3fd8;});}return null;};}function removeEntity(_0x2b3deb,_0x14c207){return function(_0x832184){if(_0x832184){return _0x832184[_0x04a2('0x29')]()[_0x04a2('0x28')](function(){_0x2b3deb[_0x04a2('0x1f')](0xcc)[_0x04a2('0x1e')]();});}};}function handleEntityNotFound(_0x22c14a,_0x18519f){return function(_0xba8c03){if(!_0xba8c03){_0x22c14a[_0x04a2('0x2a')](0x194);}return _0xba8c03;};}function handleError(_0x19a0ad,_0x502cc9){_0x502cc9=_0x502cc9||0x1f4;return function(_0x49f090){logger[_0x04a2('0x2b')](_0x49f090[_0x04a2('0x2c')]);if(_0x49f090[_0x04a2('0x2d')]){delete _0x49f090['name'];}_0x19a0ad[_0x04a2('0x1f')](_0x502cc9)[_0x04a2('0x2e')](_0x49f090);};}exports[_0x04a2('0x2f')]=function(_0x50c1cb,_0x25e314){var _0x3806af={},_0x844877={},_0x29b9b3={'count':0x0,'rows':[]};var _0x2a4260=_[_0x04a2('0x30')](db[_0x04a2('0x31')][_0x04a2('0x32')],function(_0x4e25df){return{'name':_0x4e25df[_0x04a2('0x33')],'type':_0x4e25df[_0x04a2('0x34')][_0x04a2('0x35')]};});_0x844877['model']=_[_0x04a2('0x30')](_0x2a4260,_0x04a2('0x2d'));_0x844877['query']=_[_0x04a2('0x36')](_0x50c1cb[_0x04a2('0x37')]);_0x844877['filters']=_[_0x04a2('0x38')](_0x844877[_0x04a2('0x39')],_0x844877[_0x04a2('0x37')]);_0x3806af[_0x04a2('0x3a')]=_[_0x04a2('0x38')](_0x844877[_0x04a2('0x39')],qs[_0x04a2('0x3b')](_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x3b')]));_0x3806af['attributes']=_0x3806af[_0x04a2('0x3a')]['length']?_0x3806af[_0x04a2('0x3a')]:_0x844877['model'];if(!_0x50c1cb[_0x04a2('0x37')]['hasOwnProperty'](_0x04a2('0x3c'))){_0x3806af[_0x04a2('0x23')]=qs[_0x04a2('0x23')](_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x23')]);_0x3806af['offset']=qs[_0x04a2('0x21')](_0x50c1cb['query'][_0x04a2('0x21')]);}_0x3806af['order']=qs['sort'](_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x3d')]);_0x3806af['where']=qs[_0x04a2('0x3e')](_[_0x04a2('0x3f')](_0x50c1cb[_0x04a2('0x37')],_0x844877[_0x04a2('0x3e')]),_0x2a4260);if(_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x40')]){_0x3806af[_0x04a2('0x41')]=_[_0x04a2('0x42')](_0x3806af[_0x04a2('0x41')],{'$or':_[_0x04a2('0x30')](_0x2a4260,function(_0x21dfd4){if(_0x21dfd4[_0x04a2('0x34')]!=='VIRTUAL'){var _0x47ef81={};_0x47ef81[_0x21dfd4[_0x04a2('0x2d')]]={'$like':'%'+_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x40')]+'%'};return _0x47ef81;}})});}_0x3806af=_[_0x04a2('0x42')]({},_0x3806af,_0x50c1cb[_0x04a2('0x43')]);var _0x22f0d2={'where':_0x3806af[_0x04a2('0x41')]};return db[_0x04a2('0x31')][_0x04a2('0x44')](_0x22f0d2)['then'](function(_0x1514e5){_0x29b9b3['count']=_0x1514e5;if(_0x50c1cb[_0x04a2('0x37')][_0x04a2('0x45')]){_0x3806af[_0x04a2('0x46')]=[{'all':!![]}];}return db[_0x04a2('0x31')][_0x04a2('0x47')](_0x3806af);})[_0x04a2('0x28')](function(_0x1503e5){_0x29b9b3[_0x04a2('0x48')]=_0x1503e5;return _0x29b9b3;})['then'](respondWithFilteredResult(_0x25e314,_0x3806af))[_0x04a2('0x49')](handleError(_0x25e314,null));};exports[_0x04a2('0x4a')]=function(_0x1defac,_0x2ad739){var _0x14b415={'raw':!![],'where':{'id':_0x1defac[_0x04a2('0x4b')]['id']}},_0x31f867={};_0x31f867[_0x04a2('0x39')]=_['keys'](db['VoiceTransferReport'][_0x04a2('0x32')]);_0x31f867[_0x04a2('0x37')]=_['keys'](_0x1defac[_0x04a2('0x37')]);_0x31f867['filters']=_[_0x04a2('0x38')](_0x31f867[_0x04a2('0x39')],_0x31f867['query']);_0x14b415[_0x04a2('0x3a')]=_['intersection'](_0x31f867[_0x04a2('0x39')],qs[_0x04a2('0x3b')](_0x1defac[_0x04a2('0x37')][_0x04a2('0x3b')]));_0x14b415[_0x04a2('0x3a')]=_0x14b415[_0x04a2('0x3a')][_0x04a2('0x4c')]?_0x14b415['attributes']:_0x31f867[_0x04a2('0x39')];if(_0x1defac[_0x04a2('0x37')][_0x04a2('0x45')]){_0x14b415[_0x04a2('0x46')]=[{'all':!![]}];}_0x14b415=_[_0x04a2('0x42')]({},_0x14b415,_0x1defac[_0x04a2('0x43')]);return db[_0x04a2('0x31')]['find'](_0x14b415)[_0x04a2('0x28')](handleEntityNotFound(_0x2ad739,null))['then'](respondWithResult(_0x2ad739,null))[_0x04a2('0x49')](handleError(_0x2ad739,null));};exports[_0x04a2('0x4d')]=function(_0x121a9c,_0x164f03){return db['VoiceTransferReport'][_0x04a2('0x4d')](_0x121a9c[_0x04a2('0x4e')],{})[_0x04a2('0x28')](respondWithResult(_0x164f03,0xc9))[_0x04a2('0x49')](handleError(_0x164f03,null));};exports[_0x04a2('0x27')]=function(_0x314eed,_0x1ab796){if(_0x314eed[_0x04a2('0x4e')]['id']){delete _0x314eed[_0x04a2('0x4e')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x314eed[_0x04a2('0x4b')]['id']}})[_0x04a2('0x28')](handleEntityNotFound(_0x1ab796,null))[_0x04a2('0x28')](saveUpdates(_0x314eed[_0x04a2('0x4e')],null))[_0x04a2('0x28')](respondWithResult(_0x1ab796,null))['catch'](handleError(_0x1ab796,null));};exports[_0x04a2('0x29')]=function(_0x12ec38,_0x13782a){return db['VoiceTransferReport'][_0x04a2('0x4f')]({'where':{'id':_0x12ec38[_0x04a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13782a,null))[_0x04a2('0x28')](removeEntity(_0x13782a,null))[_0x04a2('0x49')](handleError(_0x13782a,null));};exports[_0x04a2('0x50')]=function(_0x1a4b3a,_0x40cec6){return db[_0x04a2('0x31')][_0x04a2('0x50')]()[_0x04a2('0x28')](respondWithResult(_0x40cec6,null))[_0x04a2('0x49')](handleError(_0x40cec6,null));}; \ No newline at end of file +var _0xe8bc=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','offset','count'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xe8bc,0x79));var _0xce8b=function(_0x563606,_0x109d21){_0x563606=_0x563606-0x0;var _0xa9d124=_0xe8bc[_0x563606];return _0xa9d124;};'use strict';var emlformat=require(_0xce8b('0x0'));var rimraf=require(_0xce8b('0x1'));var zipdir=require(_0xce8b('0x2'));var jsonpatch=require(_0xce8b('0x3'));var rp=require(_0xce8b('0x4'));var moment=require(_0xce8b('0x5'));var BPromise=require(_0xce8b('0x6'));var Mustache=require(_0xce8b('0x7'));var util=require(_0xce8b('0x8'));var path=require('path');var sox=require(_0xce8b('0x9'));var csv=require(_0xce8b('0xa'));var ejs=require(_0xce8b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce8b('0xc'));var squel=require(_0xce8b('0xd'));var crypto=require(_0xce8b('0xe'));var jsforce=require(_0xce8b('0xf'));var deskjs=require(_0xce8b('0x10'));var toCsv=require(_0xce8b('0xa'));var querystring=require(_0xce8b('0x11'));var Papa=require(_0xce8b('0x12'));var Redis=require(_0xce8b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce8b('0x14'));var hardwareService=require(_0xce8b('0x15'));var logger=require(_0xce8b('0x16'))(_0xce8b('0x17'));var utils=require(_0xce8b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce8b('0x19'))['db'];function respondWithStatusCode(_0x4b8fb2,_0x3c127b){_0x3c127b=_0x3c127b||0xcc;return function(_0x5ab076){if(_0x5ab076){return _0x4b8fb2['sendStatus'](_0x3c127b);}return _0x4b8fb2[_0xce8b('0x1a')](_0x3c127b)['end']();};}function respondWithResult(_0x2c3b28,_0x595c52){_0x595c52=_0x595c52||0xc8;return function(_0x3fb7ce){if(_0x3fb7ce){return _0x2c3b28[_0xce8b('0x1a')](_0x595c52)[_0xce8b('0x1b')](_0x3fb7ce);}};}function respondWithFilteredResult(_0x4efc3f,_0x4f1e17){return function(_0x30f434){if(_0x30f434){var _0x15e855=typeof _0x4f1e17['offset']===_0xce8b('0x1c')&&typeof _0x4f1e17['limit']===_0xce8b('0x1c');var _0x203c00=_0x30f434['count'];var _0x3d79ce=_0x15e855?0x0:_0x4f1e17[_0xce8b('0x1d')];var _0x37bfa5=_0x15e855?_0x30f434[_0xce8b('0x1e')]:_0x4f1e17['offset']+_0x4f1e17[_0xce8b('0x1f')];var _0x57f178;if(_0x37bfa5>=_0x203c00){_0x37bfa5=_0x203c00;_0x57f178=0xc8;}else{_0x57f178=0xce;}_0x4efc3f[_0xce8b('0x1a')](_0x57f178);return _0x4efc3f[_0xce8b('0x20')](_0xce8b('0x21'),_0x3d79ce+'-'+_0x37bfa5+'/'+_0x203c00)[_0xce8b('0x1b')](_0x30f434);}return null;};}function patchUpdates(_0x1e9afe){return function(_0x536f72){try{jsonpatch[_0xce8b('0x22')](_0x536f72,_0x1e9afe,!![]);}catch(_0x194a5e){return BPromise[_0xce8b('0x23')](_0x194a5e);}return _0x536f72[_0xce8b('0x24')]();};}function saveUpdates(_0x18d307,_0x2e0e99){return function(_0x5f46ca){if(_0x5f46ca){return _0x5f46ca[_0xce8b('0x25')](_0x18d307)[_0xce8b('0x26')](function(_0x30a7b4){return _0x30a7b4;});}return null;};}function removeEntity(_0x346bd4,_0x9524d){return function(_0x22dadc){if(_0x22dadc){return _0x22dadc[_0xce8b('0x27')]()[_0xce8b('0x26')](function(){_0x346bd4[_0xce8b('0x1a')](0xcc)[_0xce8b('0x28')]();});}};}function handleEntityNotFound(_0x481c96,_0x8dad3b){return function(_0x17b671){if(!_0x17b671){_0x481c96['sendStatus'](0x194);}return _0x17b671;};}function handleError(_0x3e7a81,_0x417b72){_0x417b72=_0x417b72||0x1f4;return function(_0x149fc9){logger[_0xce8b('0x29')](_0x149fc9[_0xce8b('0x2a')]);if(_0x149fc9['name']){delete _0x149fc9[_0xce8b('0x2b')];}_0x3e7a81['status'](_0x417b72)[_0xce8b('0x2c')](_0x149fc9);};}exports[_0xce8b('0x2d')]=function(_0x99e535,_0x2f7104){var _0x375094={},_0x3a62ea={},_0x1b75da={'count':0x0,'rows':[]};var _0xbd6922=_[_0xce8b('0x2e')](db[_0xce8b('0x2f')][_0xce8b('0x30')],function(_0x14482d){return{'name':_0x14482d[_0xce8b('0x31')],'type':_0x14482d[_0xce8b('0x32')][_0xce8b('0x33')]};});_0x3a62ea[_0xce8b('0x34')]=_[_0xce8b('0x2e')](_0xbd6922,_0xce8b('0x2b'));_0x3a62ea[_0xce8b('0x35')]=_[_0xce8b('0x36')](_0x99e535['query']);_0x3a62ea['filters']=_[_0xce8b('0x37')](_0x3a62ea['model'],_0x3a62ea[_0xce8b('0x35')]);_0x375094['attributes']=_[_0xce8b('0x37')](_0x3a62ea[_0xce8b('0x34')],qs[_0xce8b('0x38')](_0x99e535[_0xce8b('0x35')][_0xce8b('0x38')]));_0x375094[_0xce8b('0x39')]=_0x375094['attributes'][_0xce8b('0x3a')]?_0x375094[_0xce8b('0x39')]:_0x3a62ea[_0xce8b('0x34')];if(!_0x99e535[_0xce8b('0x35')]['hasOwnProperty']('nolimit')){_0x375094[_0xce8b('0x1f')]=qs[_0xce8b('0x1f')](_0x99e535[_0xce8b('0x35')][_0xce8b('0x1f')]);_0x375094[_0xce8b('0x1d')]=qs['offset'](_0x99e535['query'][_0xce8b('0x1d')]);}_0x375094[_0xce8b('0x3b')]=qs[_0xce8b('0x3c')](_0x99e535[_0xce8b('0x35')][_0xce8b('0x3c')]);_0x375094[_0xce8b('0x3d')]=qs[_0xce8b('0x3e')](_['pick'](_0x99e535[_0xce8b('0x35')],_0x3a62ea[_0xce8b('0x3e')]),_0xbd6922);if(_0x99e535[_0xce8b('0x35')][_0xce8b('0x3f')]){_0x375094[_0xce8b('0x3d')]=_[_0xce8b('0x40')](_0x375094[_0xce8b('0x3d')],{'$or':_['map'](_0xbd6922,function(_0x4c94f2){if(_0x4c94f2[_0xce8b('0x32')]!==_0xce8b('0x41')){var _0xba687f={};_0xba687f[_0x4c94f2[_0xce8b('0x2b')]]={'$like':'%'+_0x99e535['query']['filter']+'%'};return _0xba687f;}})});}_0x375094=_[_0xce8b('0x40')]({},_0x375094,_0x99e535['options']);var _0x3cf8c6={'where':_0x375094['where']};return db[_0xce8b('0x2f')][_0xce8b('0x1e')](_0x3cf8c6)[_0xce8b('0x26')](function(_0x128ebc){_0x1b75da[_0xce8b('0x1e')]=_0x128ebc;if(_0x99e535[_0xce8b('0x35')][_0xce8b('0x42')]){_0x375094[_0xce8b('0x43')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xce8b('0x44')](_0x375094);})['then'](function(_0x32a2cd){_0x1b75da['rows']=_0x32a2cd;return _0x1b75da;})[_0xce8b('0x26')](respondWithFilteredResult(_0x2f7104,_0x375094))[_0xce8b('0x45')](handleError(_0x2f7104,null));};exports[_0xce8b('0x46')]=function(_0x532d11,_0x1526e2){var _0x45d3ed={'raw':!![],'where':{'id':_0x532d11[_0xce8b('0x47')]['id']}},_0x5def20={};_0x5def20[_0xce8b('0x34')]=_[_0xce8b('0x36')](db[_0xce8b('0x2f')]['rawAttributes']);_0x5def20['query']=_[_0xce8b('0x36')](_0x532d11[_0xce8b('0x35')]);_0x5def20[_0xce8b('0x3e')]=_['intersection'](_0x5def20[_0xce8b('0x34')],_0x5def20['query']);_0x45d3ed[_0xce8b('0x39')]=_[_0xce8b('0x37')](_0x5def20['model'],qs[_0xce8b('0x38')](_0x532d11[_0xce8b('0x35')][_0xce8b('0x38')]));_0x45d3ed['attributes']=_0x45d3ed[_0xce8b('0x39')][_0xce8b('0x3a')]?_0x45d3ed[_0xce8b('0x39')]:_0x5def20['model'];if(_0x532d11[_0xce8b('0x35')][_0xce8b('0x42')]){_0x45d3ed['include']=[{'all':!![]}];}_0x45d3ed=_[_0xce8b('0x40')]({},_0x45d3ed,_0x532d11['options']);return db['VoiceTransferReport'][_0xce8b('0x48')](_0x45d3ed)['then'](handleEntityNotFound(_0x1526e2,null))['then'](respondWithResult(_0x1526e2,null))[_0xce8b('0x45')](handleError(_0x1526e2,null));};exports[_0xce8b('0x49')]=function(_0x3a3d73,_0x2b4204){return db[_0xce8b('0x2f')][_0xce8b('0x49')](_0x3a3d73[_0xce8b('0x4a')],{})[_0xce8b('0x26')](respondWithResult(_0x2b4204,0xc9))[_0xce8b('0x45')](handleError(_0x2b4204,null));};exports[_0xce8b('0x25')]=function(_0x66faa6,_0x59c66f){if(_0x66faa6['body']['id']){delete _0x66faa6[_0xce8b('0x4a')]['id'];}return db[_0xce8b('0x2f')]['find']({'where':{'id':_0x66faa6[_0xce8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x59c66f,null))[_0xce8b('0x26')](saveUpdates(_0x66faa6[_0xce8b('0x4a')],null))[_0xce8b('0x26')](respondWithResult(_0x59c66f,null))['catch'](handleError(_0x59c66f,null));};exports[_0xce8b('0x27')]=function(_0x4dfc8e,_0x31b2a2){return db[_0xce8b('0x2f')][_0xce8b('0x48')]({'where':{'id':_0x4dfc8e[_0xce8b('0x47')]['id']}})[_0xce8b('0x26')](handleEntityNotFound(_0x31b2a2,null))[_0xce8b('0x26')](removeEntity(_0x31b2a2,null))[_0xce8b('0x45')](handleError(_0x31b2a2,null));};exports[_0xce8b('0x4b')]=function(_0x1d9a1e,_0x354156){return db[_0xce8b('0x2f')][_0xce8b('0x4b')]()[_0xce8b('0x26')](respondWithResult(_0x354156,null))[_0xce8b('0x45')](handleError(_0x354156,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6e546e6..bafb858 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 _0xa163=['api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','util','../../config/logger'];(function(_0x5d90d2,_0x4f83d2){var _0x602662=function(_0x35b6f6){while(--_0x35b6f6){_0x5d90d2['push'](_0x5d90d2['shift']());}};_0x602662(++_0x4f83d2);}(_0xa163,0x127));var _0x3a16=function(_0xd5c80e,_0x22b848){_0xd5c80e=_0xd5c80e-0x0;var _0x168f97=_0xa163[_0xd5c80e];return _0x168f97;};'use strict';var _=require('lodash');var util=require(_0x3a16('0x0'));var logger=require(_0x3a16('0x1'))(_0x3a16('0x2'));var moment=require(_0x3a16('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a16('0x4'));var fs=require('fs');var path=require(_0x3a16('0x5'));var rimraf=require(_0x3a16('0x6'));var config=require('../../config/environment');var attributes=require(_0x3a16('0x7'));module['exports']=function(_0x93e399,_0x319426){return _0x93e399[_0x3a16('0x8')](_0x3a16('0x9'),attributes,{'tableName':_0x3a16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9cd=['report_call_transfer','api','moment','bluebird','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x3ce51c,_0x32b1ba){var _0x52b298=function(_0x3c5e91){while(--_0x3c5e91){_0x3ce51c['push'](_0x3ce51c['shift']());}};_0x52b298(++_0x32b1ba);}(_0xa9cd,0xd3));var _0xda9c=function(_0x24bcb0,_0x45f822){_0x24bcb0=_0x24bcb0-0x0;var _0x2ebd9c=_0xa9cd[_0x24bcb0];return _0x2ebd9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xda9c('0x0'));var moment=require(_0xda9c('0x1'));var BPromise=require(_0xda9c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda9c('0x3'));var rimraf=require(_0xda9c('0x4'));var config=require('../../config/environment');var attributes=require(_0xda9c('0x5'));module[_0xda9c('0x6')]=function(_0x3a0791,_0x458475){return _0x3a0791[_0xda9c('0x7')](_0xda9c('0x8'),attributes,{'tableName':_0xda9c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 2368321..c93e598 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 _0x8fe7=['request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x24879e,_0x149278){var _0x47563d=function(_0x305d96){while(--_0x305d96){_0x24879e['push'](_0x24879e['shift']());}};_0x47563d(++_0x149278);}(_0x8fe7,0xe7));var _0x78fe=function(_0x5ee1a1,_0x55e0fd){_0x5ee1a1=_0x5ee1a1-0x0;var _0x4f1d5b=_0x8fe7[_0x5ee1a1];return _0x4f1d5b;};'use strict';var _=require(_0x78fe('0x0'));var util=require(_0x78fe('0x1'));var moment=require('moment');var BPromise=require(_0x78fe('0x2'));var rs=require(_0x78fe('0x3'));var fs=require('fs');var Redis=require(_0x78fe('0x4'));var db=require(_0x78fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x78fe('0x6'))(_0x78fe('0x7'));var config=require(_0x78fe('0x8'));var jayson=require(_0x78fe('0x9'));var client=jayson[_0x78fe('0xa')][_0x78fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49b4dc,_0x2bd579,_0x14ad06){return new BPromise(function(_0xb52c61,_0x6a1b1c){return client[_0x78fe('0xc')](_0x49b4dc,_0x14ad06)['then'](function(_0x34dc32){logger[_0x78fe('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x2bd579,_0x78fe('0xe'));logger[_0x78fe('0xf')](_0x78fe('0x10'),_0x2bd579,_0x78fe('0xe'),JSON[_0x78fe('0x11')](_0x34dc32));if(_0x34dc32[_0x78fe('0x12')]){if(_0x34dc32[_0x78fe('0x12')][_0x78fe('0x13')]===0x1f4){logger[_0x78fe('0x12')](_0x78fe('0x14'),_0x2bd579,_0x34dc32[_0x78fe('0x12')][_0x78fe('0x15')]);return _0x6a1b1c(_0x34dc32[_0x78fe('0x12')][_0x78fe('0x15')]);}logger[_0x78fe('0x12')](_0x78fe('0x14'),_0x2bd579,_0x34dc32[_0x78fe('0x12')][_0x78fe('0x15')]);return _0xb52c61(_0x34dc32[_0x78fe('0x12')][_0x78fe('0x15')]);}else{logger['info'](_0x78fe('0x14'),_0x2bd579,'request\x20sent');_0xb52c61(_0x34dc32['result']['message']);}})['catch'](function(_0x34c67b){logger[_0x78fe('0x12')](_0x78fe('0x14'),_0x2bd579,_0x34c67b);_0x6a1b1c(_0x34c67b);});});}exports[_0x78fe('0x16')]=function(_0x1a7f47){var _0x49cea7=this;return new Promise(function(_0x19965e,_0x5ad4af){return db[_0x78fe('0x17')][_0x78fe('0x18')](_0x1a7f47['body'],{'raw':_0x1a7f47[_0x78fe('0x19')]?_0x1a7f47['options'][_0x78fe('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x23a18d){logger[_0x78fe('0xd')](_0x78fe('0x16'),_0x1a7f47);logger[_0x78fe('0xf')]('CreateVoiceTransferReport',_0x1a7f47,JSON['stringify'](_0x23a18d));_0x19965e(_0x23a18d);})['catch'](function(_0x48a54e){logger[_0x78fe('0x12')](_0x78fe('0x16'),_0x48a54e[_0x78fe('0x15')],_0x1a7f47);_0x5ad4af(_0x49cea7[_0x78fe('0x12')](0x1f4,_0x48a54e[_0x78fe('0x15')]));});});}; \ No newline at end of file +var _0x6424=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6424,0xbe));var _0x4642=function(_0x288545,_0xff2646){_0x288545=_0x288545-0x0;var _0x185119=_0x6424[_0x288545];return _0x185119;};'use strict';var _=require('lodash');var util=require(_0x4642('0x0'));var moment=require(_0x4642('0x1'));var BPromise=require(_0x4642('0x2'));var rs=require(_0x4642('0x3'));var fs=require('fs');var Redis=require(_0x4642('0x4'));var db=require(_0x4642('0x5'))['db'];var utils=require(_0x4642('0x6'));var logger=require(_0x4642('0x7'))(_0x4642('0x8'));var config=require(_0x4642('0x9'));var jayson=require(_0x4642('0xa'));var client=jayson[_0x4642('0xb')][_0x4642('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb574f9,_0x4b63b4,_0x43c5c0){return new BPromise(function(_0x19cbc8,_0x2f4c4f){return client[_0x4642('0xd')](_0xb574f9,_0x43c5c0)[_0x4642('0xe')](function(_0x5e08c8){logger[_0x4642('0xf')](_0x4642('0x10'),_0x4b63b4,'request\x20sent');logger[_0x4642('0x11')](_0x4642('0x12'),_0x4b63b4,_0x4642('0x13'),JSON[_0x4642('0x14')](_0x5e08c8));if(_0x5e08c8[_0x4642('0x15')]){if(_0x5e08c8['error'][_0x4642('0x16')]===0x1f4){logger['error'](_0x4642('0x10'),_0x4b63b4,_0x5e08c8[_0x4642('0x15')]['message']);return _0x2f4c4f(_0x5e08c8[_0x4642('0x15')][_0x4642('0x17')]);}logger['error'](_0x4642('0x10'),_0x4b63b4,_0x5e08c8[_0x4642('0x15')][_0x4642('0x17')]);return _0x19cbc8(_0x5e08c8[_0x4642('0x15')][_0x4642('0x17')]);}else{logger['info'](_0x4642('0x10'),_0x4b63b4,_0x4642('0x13'));_0x19cbc8(_0x5e08c8[_0x4642('0x18')][_0x4642('0x17')]);}})[_0x4642('0x19')](function(_0x33e889){logger[_0x4642('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b63b4,_0x33e889);_0x2f4c4f(_0x33e889);});});}exports[_0x4642('0x1a')]=function(_0x163e32){var _0x31cb91=this;return new Promise(function(_0x5c36a4,_0x416b95){return db['VoiceTransferReport'][_0x4642('0x1b')](_0x163e32[_0x4642('0x1c')],{'raw':_0x163e32[_0x4642('0x1d')]?_0x163e32[_0x4642('0x1d')][_0x4642('0x1e')]===undefined?!![]:![]:!![]})[_0x4642('0xe')](function(_0x153dca){logger[_0x4642('0xf')](_0x4642('0x1a'),_0x163e32);logger[_0x4642('0x11')]('CreateVoiceTransferReport',_0x163e32,JSON[_0x4642('0x14')](_0x153dca));_0x5c36a4(_0x153dca);})['catch'](function(_0x5a40c4){logger[_0x4642('0x15')](_0x4642('0x1a'),_0x5a40c4[_0x4642('0x17')],_0x163e32);_0x416b95(_0x31cb91['error'](0x1f4,_0x5a40c4[_0x4642('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f80d9ba..c9414a9 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 _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0xcf416f,_0x9aaf52){var _0x4b4d70=function(_0x1db437){while(--_0x1db437){_0xcf416f['push'](_0xcf416f['shift']());}};_0x4b4d70(++_0x9aaf52);}(_0xe706,0xa3));var _0x6e70=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0xe706[_0x3fc287];return _0x33af9f;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x38a210,_0x4fa880){var _0x218aaa=function(_0x3a8e0a){while(--_0x3a8e0a){_0x38a210['push'](_0x38a210['shift']());}};_0x218aaa(++_0x4fa880);}(_0x54ef,0x112));var _0xf54e=function(_0x321d4a,_0x4c6227){_0x321d4a=_0x321d4a-0x0;var _0x5d37e5=_0x54ef[_0x321d4a];return _0x5d37e5;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index afa7012..2de4df0 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 _0xd691=['conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','error','stack','name','status','send','NotFound','then','message','result','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','sessionId','user:%s','catch','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference'];(function(_0x3316e2,_0x412d24){var _0x2d4387=function(_0x2e294b){while(--_0x2e294b){_0x3316e2['push'](_0x3316e2['shift']());}};_0x2d4387(++_0x412d24);}(_0xd691,0xe6));var _0x1d69=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xd691[_0x18cac4];return _0x2227c6;};'use strict';var path=require(_0x1d69('0x0'));var fs=require('fs');var _=require(_0x1d69('0x1'));var db=require(_0x1d69('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x1d69('0x3'));var BPromise=require(_0x1d69('0x4'));var jayson=require(_0x1d69('0x5'));var amiClient=jayson[_0x1d69('0x6')][_0x1d69('0x7')]({'port':0x232a});var logger=require(_0x1d69('0x8'))(_0x1d69('0x9'));var Redis=require(_0x1d69('0xa'));config[_0x1d69('0xb')]=_[_0x1d69('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1d69('0xd'))(new Redis(config['redis']));var Schema=require(_0x1d69('0xe'));var originateValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'callNumber':{'type':_0x1d69('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x1d69('0x11')},'callbackUrl':{'type':_0x1d69('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':[!![],_0x1d69('0x12')]},'transferNumber':{'type':_0x1d69('0x11'),'required':[!![],_0x1d69('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]}});function emit(_0x29dd32,_0x5fe486,_0x3ec720){logger[_0x1d69('0x14')](_0x29dd32,_0x5fe486,JSON['stringify'](_0x3ec720));io['to'](_0x29dd32)[_0x1d69('0x15')](_0x5fe486,_0x3ec720);}function handleError(_0xcf076b){return function(_0x34f6d4){console['log']('handleError:',_0x34f6d4,_0x34f6d4 instanceof RangeError);logger[_0x1d69('0x16')](_0x34f6d4[_0x1d69('0x17')]);if(_0x34f6d4 instanceof RangeError){if(_0x34f6d4[_0x1d69('0x18')]){delete _0x34f6d4['name'];}_0xcf076b[_0x1d69('0x19')](0x194)[_0x1d69('0x1a')](_0x34f6d4);}else{if(_0x34f6d4[_0x1d69('0x18')]){delete _0x34f6d4[_0x1d69('0x18')];}_0xcf076b[_0x1d69('0x19')](0x1f4)[_0x1d69('0x1a')](_0x34f6d4);}};}function checkError(){return function(_0x34c920){if(!_0x34c920){throw new RangeError(_0x1d69('0x1b'));}return _0x34c920;};}function respondWithRpcPromise(_0x5c90eb,_0x7821f8){return new BPromise(function(_0x122238,_0x1786e1){var _0x228d18=amiClient;return _0x228d18['request'](_0x5c90eb,_0x7821f8)[_0x1d69('0x1c')](function(_0x411ca0){if(_0x411ca0[_0x1d69('0x16')]){if(_0x411ca0['error']['code']===0x1f4){return _0x1786e1(_0x411ca0['error'][_0x1d69('0x1d')]);}return _0x122238(_0x411ca0[_0x1d69('0x16')][_0x1d69('0x1d')]);}else{_0x122238(_0x411ca0[_0x1d69('0x1e')]);}})['catch'](function(_0x3af518){_0x1786e1(_0x3af518);});});}function getAgent(_0x33b5e9){return db['User'][_0x1d69('0x1f')]({'where':{'id':_0x33b5e9,'role':_0x1d69('0x20')}})[_0x1d69('0x1c')](checkError());}function getAgentCheckSession(_0x30aefe,_0x2d3f2e){return new BPromise(function(_0x247130,_0x5cca6a){var _0x23043c=respondWithRpcPromise(_0x1d69('0x21'));var _0x3c6b2b=getAgent(_0x30aefe);Promise[_0x1d69('0x22')]([_0x23043c,_0x3c6b2b])[_0x1d69('0x1c')](function(_0x1e5818){var _0x2fd8d3=_0x1e5818[0x0];var _0x215052=_0x1e5818[0x1];var _0x156825=_[_0x1d69('0x23')](_0x2fd8d3[_0x1d69('0x24')],function(_0x5e8e8e){return _0x5e8e8e[_0x1d69('0x25')]==_0x215052['id']&&_0x5e8e8e['sessionId']==_0x2d3f2e;});if(_0x156825[_0x1d69('0x26')]==0x1){_0x247130(_0x215052);}else{_0x5cca6a(new RangeError(_0x1d69('0x27')+_0x2d3f2e+_0x1d69('0x28')));}});});}exports[_0x1d69('0x29')]=function(_0x582da2,_0x59b677){logger[_0x1d69('0x14')]('originate\x20fired:',_0x582da2[_0x1d69('0x2a')]);var _0x2db151=originateValidation[_0x1d69('0xe')](_0x582da2[_0x1d69('0x2a')]);if(_0x2db151[_0x1d69('0x26')]>0x0){return _0x59b677[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x2db151);}var _0x1894d9=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0xa0d7f9=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2d')];var _0x441d1c=_0x582da2['body'][_0x1d69('0x2e')];var _0x2cf204=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2f')];return getAgent(_0x1894d9)[_0x1d69('0x1c')](function(_0x4c8414){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x4c8414[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')]('user:%s',_0x4c8414[_0x1d69('0x18')]),_0x1d69('0x32'),{'callNumber':_0xa0d7f9,'callerId':_0x441d1c,'callbackUrl':_0x2cf204});return _0x59b677[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x33')});})['catch'](handleError(_0x59b677));};exports['hangup']=function(_0x49ce52,_0x896d0e){logger[_0x1d69('0x14')]('hangup\x20fired:',_0x49ce52[_0x1d69('0x2a')]);var _0x23335c=hangupValidation[_0x1d69('0xe')](_0x49ce52['body']);if(_0x23335c[_0x1d69('0x26')]>0x0){return _0x896d0e[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x23335c);}var _0x30be3e=_0x49ce52['body'][_0x1d69('0x2c')];var _0x353a83=_0x49ce52[_0x1d69('0x2a')][_0x1d69('0x34')];return getAgent(_0x30be3e)['then'](function(_0x1a46ae){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x1a46ae[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x1a46ae[_0x1d69('0x18')]),'webbar:hangup',{'sessionId':_0x353a83});return _0x896d0e[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0x1d69('0x36')](handleError(_0x896d0e));};exports['answer']=function(_0x11b2e0,_0x399609){logger[_0x1d69('0x14')](_0x1d69('0x37'),_0x11b2e0['body']);var _0x1d6fee=answerValidation[_0x1d69('0xe')](_0x11b2e0[_0x1d69('0x2a')]);if(_0x1d6fee['length']>0x0){return _0x399609[_0x1d69('0x19')](0x190)['json'](_0x1d6fee);}var _0x531387=_0x11b2e0[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0x5451b6=_0x11b2e0[_0x1d69('0x2a')]['sessionId'];return getAgent(_0x531387)[_0x1d69('0x1c')](function(_0x1dc676){logger['info'](_0x1d69('0x30'),_0x1dc676[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')]('user:%s',_0x1dc676[_0x1d69('0x18')]),_0x1d69('0x38'),{'sessionId':_0x5451b6});return _0x399609[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x39')});})[_0x1d69('0x36')](handleError(_0x399609));};exports[_0x1d69('0x3a')]=function(_0x746cdb,_0x357a76){logger[_0x1d69('0x14')](_0x1d69('0x3b'),_0x746cdb[_0x1d69('0x2a')]);var _0x2dbc0c=holdValidation[_0x1d69('0xe')](_0x746cdb[_0x1d69('0x2a')]);if(_0x2dbc0c[_0x1d69('0x26')]>0x0){return _0x357a76['status'](0x190)[_0x1d69('0x2b')](_0x2dbc0c);}var _0x11cf7c=_0x746cdb[_0x1d69('0x2a')]['userId'];var _0x4b38fd=_0x746cdb[_0x1d69('0x2a')]['sessionId'];return getAgent(_0x11cf7c)[_0x1d69('0x1c')](function(_0x370645){logger[_0x1d69('0x14')]('entityFound:',_0x370645['name']);emit(util[_0x1d69('0x31')]('user:%s',_0x370645[_0x1d69('0x18')]),'webbar:hold',{'sessionId':_0x4b38fd});return _0x357a76['status'](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x3c')});})[_0x1d69('0x36')](handleError(_0x357a76));};exports[_0x1d69('0x3d')]=function(_0x442041,_0x4e6453){logger[_0x1d69('0x14')](_0x1d69('0x3e'),_0x442041['body']);var _0x28bb7b=unholdValidation[_0x1d69('0xe')](_0x442041[_0x1d69('0x2a')]);if(_0x28bb7b[_0x1d69('0x26')]>0x0){return _0x4e6453['status'](0x190)[_0x1d69('0x2b')](_0x28bb7b);}var _0x5a4e1c=_0x442041[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0x37749b=_0x442041['body'][_0x1d69('0x34')];return getAgent(_0x5a4e1c)['then'](function(_0x2d90ec){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x2d90ec['name']);emit(util[_0x1d69('0x31')]('user:%s',_0x2d90ec[_0x1d69('0x18')]),_0x1d69('0x3f'),{'sessionId':_0x37749b});return _0x4e6453[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x40')});})[_0x1d69('0x36')](handleError(_0x4e6453));};exports[_0x1d69('0x41')]=function(_0x143fd9,_0x29502a){logger[_0x1d69('0x14')](_0x1d69('0x42'),_0x29502a[_0x1d69('0x2a')]);var _0x25f7e5=callsValidation[_0x1d69('0xe')](_0x143fd9[_0x1d69('0x2a')]);if(_0x25f7e5[_0x1d69('0x26')]>0x0){return _0x29502a[_0x1d69('0x19')](0x190)['json'](_0x25f7e5);}var _0x2d2a7f=_0x143fd9[_0x1d69('0x2a')]['userId'];var _0x76ead1=respondWithRpcPromise('VoiceChannels');var _0x3b26c6=getAgent(_0x2d2a7f);return Promise[_0x1d69('0x22')]([_0x76ead1,_0x3b26c6])['then'](function(_0x5bd4d0){var _0x1d33c2=_0x5bd4d0[0x0];var _0x3b705d=_0x5bd4d0[0x1];var _0x329076=_[_0x1d69('0x23')](_0x1d33c2['rows'],function(_0x402b3c){return _0x402b3c[_0x1d69('0x25')]==_0x3b705d['id'];});return _0x29502a[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'count':_0x329076[_0x1d69('0x26')],'rows':_0x329076});})[_0x1d69('0x36')](handleError(_0x29502a));};exports[_0x1d69('0x43')]=function(_0x323e7e,_0x8dcb5d){logger[_0x1d69('0x14')](_0x1d69('0x44'),_0x323e7e[_0x1d69('0x2a')]);var _0x362bdd=conferenceValidation['validate'](_0x323e7e[_0x1d69('0x2a')]);if(_0x362bdd[_0x1d69('0x26')]>0x0){return _0x8dcb5d[_0x1d69('0x19')](0x190)['json'](_0x362bdd);}var _0x44cd1c=_0x323e7e[_0x1d69('0x2a')][_0x1d69('0x2c')];return getAgent(_0x44cd1c)[_0x1d69('0x1c')](function(_0x8f8b31){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x8f8b31[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x8f8b31[_0x1d69('0x18')]),_0x1d69('0x45'));return _0x8dcb5d[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x46')});})['catch'](handleError(_0x8dcb5d));};exports[_0x1d69('0x47')]=function(_0x7bb6f5,_0x1df70c){logger[_0x1d69('0x14')](_0x1d69('0x48'),_0x7bb6f5['body']);var _0x38370e=transferValidation[_0x1d69('0xe')](_0x7bb6f5[_0x1d69('0x2a')]);if(_0x38370e['length']>0x0){return _0x1df70c[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x38370e);}var _0x2e34bc=_0x7bb6f5['body'][_0x1d69('0x2c')];var _0x331d1a=_0x7bb6f5['body'][_0x1d69('0x34')];var _0x5d5bc4=_0x7bb6f5['body'][_0x1d69('0x49')];return getAgent(_0x2e34bc)['then'](function(_0x18d13c){logger['info'](_0x1d69('0x30'),_0x18d13c[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x18d13c[_0x1d69('0x18')]),_0x1d69('0x4a'),{'sessionId':_0x331d1a,'transferNumber':_0x5d5bc4});return _0x1df70c['status'](0xc8)[_0x1d69('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x1d69('0x36')](handleError(_0x1df70c));}; \ No newline at end of file +var _0x303a=['answer','answer\x20fired:','webbar:answer','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transferNumber','path','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','log','error','name','status','NotFound','then','code','message','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callerId','callbackUrl','entityFound:','format','webbar:originate','catch','hangup','user:%s','webbar:hangup'];(function(_0x1d13d9,_0x10104e){var _0x3e6c3f=function(_0x2efc28){while(--_0x2efc28){_0x1d13d9['push'](_0x1d13d9['shift']());}};_0x3e6c3f(++_0x10104e);}(_0x303a,0x1a0));var _0xa303=function(_0x39e2d7,_0x1b15f6){_0x39e2d7=_0x39e2d7-0x0;var _0x413d0d=_0x303a[_0x39e2d7];return _0x413d0d;};'use strict';var path=require(_0xa303('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa303('0x1'))['db'];var config=require(_0xa303('0x2'));var util=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa303('0x5')][_0xa303('0x6')]({'port':0x232a});var logger=require(_0xa303('0x7'))(_0xa303('0x8'));var Redis=require(_0xa303('0x9'));config[_0xa303('0xa')]=_[_0xa303('0xb')](config[_0xa303('0xa')],{'host':_0xa303('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'callNumber':{'type':'string','required':[!![],_0xa303('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa303('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa303('0x10'),'required':[!![],_0xa303('0x11')]},'transferNumber':{'type':_0xa303('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]}});function emit(_0xd2e8ee,_0x1f3ede,_0x288596){logger[_0xa303('0x12')](_0xd2e8ee,_0x1f3ede,JSON[_0xa303('0x13')](_0x288596));io['to'](_0xd2e8ee)['emit'](_0x1f3ede,_0x288596);}function handleError(_0x28c164){return function(_0x54ca49){console[_0xa303('0x14')]('handleError:',_0x54ca49,_0x54ca49 instanceof RangeError);logger[_0xa303('0x15')](_0x54ca49['stack']);if(_0x54ca49 instanceof RangeError){if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x194)['send'](_0x54ca49);}else{if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x1f4)['send'](_0x54ca49);}};}function checkError(){return function(_0x282e25){if(!_0x282e25){throw new RangeError(_0xa303('0x18'));}return _0x282e25;};}function respondWithRpcPromise(_0x21deee,_0x904261){return new BPromise(function(_0x54b173,_0x14f9ab){var _0x2a2512=amiClient;return _0x2a2512['request'](_0x21deee,_0x904261)[_0xa303('0x19')](function(_0x27c1d7){if(_0x27c1d7[_0xa303('0x15')]){if(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1a')]===0x1f4){return _0x14f9ab(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}return _0x54b173(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}else{_0x54b173(_0x27c1d7['result']);}})['catch'](function(_0x4dad5b){_0x14f9ab(_0x4dad5b);});});}function getAgent(_0x58922f){return db['User'][_0xa303('0x1c')]({'where':{'id':_0x58922f,'role':_0xa303('0x1d')}})[_0xa303('0x19')](checkError());}function getAgentCheckSession(_0xbb93f0,_0x94d3e4){return new BPromise(function(_0x48e79f,_0x2d1341){var _0xb35c22=respondWithRpcPromise('VoiceChannels');var _0x221f59=getAgent(_0xbb93f0);Promise[_0xa303('0x1e')]([_0xb35c22,_0x221f59])[_0xa303('0x19')](function(_0x32dcfb){var _0x3c85de=_0x32dcfb[0x0];var _0x221007=_0x32dcfb[0x1];var _0x11b175=_[_0xa303('0x1f')](_0x3c85de[_0xa303('0x20')],function(_0x3383f4){return _0x3383f4[_0xa303('0x21')]==_0x221007['id']&&_0x3383f4[_0xa303('0x22')]==_0x94d3e4;});if(_0x11b175[_0xa303('0x23')]==0x1){_0x48e79f(_0x221007);}else{_0x2d1341(new RangeError(_0xa303('0x24')+_0x94d3e4+_0xa303('0x25')));}});});}exports[_0xa303('0x26')]=function(_0x228ae7,_0x5de180){logger['info'](_0xa303('0x27'),_0x228ae7[_0xa303('0x28')]);var _0xa69c59=originateValidation[_0xa303('0x29')](_0x228ae7['body']);if(_0xa69c59[_0xa303('0x23')]>0x0){return _0x5de180[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xa69c59);}var _0x1093e1=_0x228ae7['body'][_0xa303('0x2b')];var _0x37376d=_0x228ae7[_0xa303('0x28')]['callNumber'];var _0xd35249=_0x228ae7[_0xa303('0x28')][_0xa303('0x2c')];var _0x4a6328=_0x228ae7[_0xa303('0x28')][_0xa303('0x2d')];return getAgent(_0x1093e1)[_0xa303('0x19')](function(_0x5dea0a){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x5dea0a[_0xa303('0x16')]);emit(util[_0xa303('0x2f')]('user:%s',_0x5dea0a[_0xa303('0x16')]),_0xa303('0x30'),{'callNumber':_0x37376d,'callerId':_0xd35249,'callbackUrl':_0x4a6328});return _0x5de180[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0xa303('0x31')](handleError(_0x5de180));};exports[_0xa303('0x32')]=function(_0x22da2d,_0x16c680){logger[_0xa303('0x12')]('hangup\x20fired:',_0x22da2d['body']);var _0x992eb9=hangupValidation[_0xa303('0x29')](_0x22da2d[_0xa303('0x28')]);if(_0x992eb9['length']>0x0){return _0x16c680['status'](0x190)[_0xa303('0x2a')](_0x992eb9);}var _0x8a16a3=_0x22da2d[_0xa303('0x28')][_0xa303('0x2b')];var _0x569158=_0x22da2d['body'][_0xa303('0x22')];return getAgent(_0x8a16a3)[_0xa303('0x19')](function(_0x1c99b4){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x1c99b4['name']);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x1c99b4[_0xa303('0x16')]),_0xa303('0x34'),{'sessionId':_0x569158});return _0x16c680['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa303('0x31')](handleError(_0x16c680));};exports[_0xa303('0x35')]=function(_0x3aece5,_0x411b69){logger[_0xa303('0x12')](_0xa303('0x36'),_0x3aece5[_0xa303('0x28')]);var _0x1f4352=answerValidation[_0xa303('0x29')](_0x3aece5[_0xa303('0x28')]);if(_0x1f4352[_0xa303('0x23')]>0x0){return _0x411b69['status'](0x190)['json'](_0x1f4352);}var _0x45fb2f=_0x3aece5['body'][_0xa303('0x2b')];var _0x564d59=_0x3aece5[_0xa303('0x28')][_0xa303('0x22')];return getAgent(_0x45fb2f)[_0xa303('0x19')](function(_0x2c03fa){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x2c03fa[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x2c03fa[_0xa303('0x16')]),_0xa303('0x37'),{'sessionId':_0x564d59});return _0x411b69[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0xa303('0x31')](handleError(_0x411b69));};exports['hold']=function(_0x32b439,_0x11440f){logger[_0xa303('0x12')]('hold\x20fired:',_0x32b439['body']);var _0x9240e1=holdValidation[_0xa303('0x29')](_0x32b439[_0xa303('0x28')]);if(_0x9240e1[_0xa303('0x23')]>0x0){return _0x11440f[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x9240e1);}var _0x2f9f0b=_0x32b439[_0xa303('0x28')][_0xa303('0x2b')];var _0x4cbf30=_0x32b439['body'][_0xa303('0x22')];return getAgent(_0x2f9f0b)[_0xa303('0x19')](function(_0x532003){logger[_0xa303('0x12')]('entityFound:',_0x532003[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x532003[_0xa303('0x16')]),'webbar:hold',{'sessionId':_0x4cbf30});return _0x11440f[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x38')});})[_0xa303('0x31')](handleError(_0x11440f));};exports[_0xa303('0x39')]=function(_0x16242c,_0x538ef4){logger[_0xa303('0x12')](_0xa303('0x3a'),_0x16242c[_0xa303('0x28')]);var _0xe4a907=unholdValidation['validate'](_0x16242c['body']);if(_0xe4a907[_0xa303('0x23')]>0x0){return _0x538ef4[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xe4a907);}var _0x4bcee0=_0x16242c[_0xa303('0x28')]['userId'];var _0x5939ea=_0x16242c['body']['sessionId'];return getAgent(_0x4bcee0)[_0xa303('0x19')](function(_0xdc6eaf){logger['info'](_0xa303('0x2e'),_0xdc6eaf[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0xdc6eaf[_0xa303('0x16')]),'webbar:unhold',{'sessionId':_0x5939ea});return _0x538ef4[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x3b')});})[_0xa303('0x31')](handleError(_0x538ef4));};exports[_0xa303('0x3c')]=function(_0x53d9dc,_0x56bc98){logger[_0xa303('0x12')](_0xa303('0x3d'),_0x56bc98[_0xa303('0x28')]);var _0x87a096=callsValidation[_0xa303('0x29')](_0x53d9dc[_0xa303('0x28')]);if(_0x87a096[_0xa303('0x23')]>0x0){return _0x56bc98[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x87a096);}var _0x5d4a72=_0x53d9dc[_0xa303('0x28')][_0xa303('0x2b')];var _0x27471c=respondWithRpcPromise(_0xa303('0x3e'));var _0x47da3a=getAgent(_0x5d4a72);return Promise['all']([_0x27471c,_0x47da3a])[_0xa303('0x19')](function(_0x4db2e2){var _0x14861e=_0x4db2e2[0x0];var _0x44c8d3=_0x4db2e2[0x1];var _0x5272d7=_['filter'](_0x14861e[_0xa303('0x20')],function(_0x249378){return _0x249378['UserId']==_0x44c8d3['id'];});return _0x56bc98['status'](0xc8)['json']({'count':_0x5272d7[_0xa303('0x23')],'rows':_0x5272d7});})[_0xa303('0x31')](handleError(_0x56bc98));};exports[_0xa303('0x3f')]=function(_0x15f4e6,_0x28cd01){logger[_0xa303('0x12')](_0xa303('0x40'),_0x15f4e6[_0xa303('0x28')]);var _0x8aecd7=conferenceValidation['validate'](_0x15f4e6[_0xa303('0x28')]);if(_0x8aecd7[_0xa303('0x23')]>0x0){return _0x28cd01[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x8aecd7);}var _0x40e4b4=_0x15f4e6[_0xa303('0x28')]['userId'];return getAgent(_0x40e4b4)[_0xa303('0x19')](function(_0x558a2a){logger['info'](_0xa303('0x2e'),_0x558a2a[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x558a2a[_0xa303('0x16')]),_0xa303('0x41'));return _0x28cd01[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x28cd01));};exports['transfer']=function(_0x2e8100,_0x40550d){logger[_0xa303('0x12')]('transfer\x20fired:',_0x2e8100['body']);var _0x3b0f1e=transferValidation['validate'](_0x2e8100['body']);if(_0x3b0f1e['length']>0x0){return _0x40550d['status'](0x190)[_0xa303('0x2a')](_0x3b0f1e);}var _0x27474e=_0x2e8100[_0xa303('0x28')][_0xa303('0x2b')];var _0x3008ae=_0x2e8100[_0xa303('0x28')][_0xa303('0x22')];var _0x2e5a11=_0x2e8100['body'][_0xa303('0x42')];return getAgent(_0x27474e)[_0xa303('0x19')](function(_0x123d7f){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x123d7f[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x123d7f['name']),'webbar:transfer',{'sessionId':_0x3008ae,'transferNumber':_0x2e5a11});return _0x40550d[_0xa303('0x17')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x40550d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4257f50..bfec8d1 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 _0x1967=['addAnswer','addAgents','/:id/notify','notify','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create'];(function(_0x44c32a,_0x24747f){var _0x46ffd7=function(_0x535286){while(--_0x535286){_0x44c32a['push'](_0x44c32a['shift']());}};_0x46ffd7(++_0x24747f);}(_0x1967,0x173));var _0x7196=function(_0x4650d7,_0x412da1){_0x4650d7=_0x4650d7-0x0;var _0x4bad42=_0x1967[_0x4650d7];return _0x4bad42;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0xc')](_0x7196('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7196('0xc')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);router[_0x7196('0xc')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x15')]);router[_0x7196('0xc')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['getApplications']);router[_0x7196('0x17')]('/',auth[_0x7196('0xa')](),controller[_0x7196('0x18')]);router[_0x7196('0x17')]('/:id/dispositions',auth[_0x7196('0xa')](),controller['addDisposition']);router[_0x7196('0x17')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x19')]);router[_0x7196('0x17')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x1a')]);router[_0x7196('0x17')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['addApplications']);router['post'](_0x7196('0x1b'),controller[_0x7196('0x1c')]);router[_0x7196('0x17')]('/:id/send',auth[_0x7196('0xa')](),controller['send']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x1d')]);router['delete']('/:id',auth[_0x7196('0xa')](),controller[_0x7196('0x1e')]);router['delete'](_0x7196('0x11'),auth[_0x7196('0xa')](),controller[_0x7196('0x1f')]);router[_0x7196('0x20')](_0x7196('0x12'),auth['isAuthenticated'](),controller[_0x7196('0x21')]);router['delete'](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x22')]);module[_0x7196('0x23')]=router; \ No newline at end of file +var _0xd7d1=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','/:id/send','send','put','update'];(function(_0x2d1e21,_0x18f421){var _0x2cc28d=function(_0x38c907){while(--_0x38c907){_0x2d1e21['push'](_0x2d1e21['shift']());}};_0x2cc28d(++_0x18f421);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x57a7b3,_0x5c8ed8){_0x57a7b3=_0x57a7b3-0x0;var _0x3d9cca=_0xd7d1[_0x57a7b3];return _0x3d9cca;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getDispositions']);router[_0x1d7d('0xb')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0xb')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x14')]);router['get']('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d7d('0x16')]);router[_0x1d7d('0x17')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x18')]);router['post'](_0x1d7d('0x19'),auth[_0x1d7d('0xc')](),controller['addAnswer']);router[_0x1d7d('0x17')](_0x1d7d('0x13'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1a')]);router[_0x1d7d('0x17')]('/:id/applications',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1b')]);router['post']('/:id/notify',controller[_0x1d7d('0x1c')]);router[_0x1d7d('0x17')](_0x1d7d('0x1d'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1e')]);router[_0x1d7d('0x1f')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x20')]);router[_0x1d7d('0x21')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x22')]);router['delete']('/:id/dispositions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x23')]);router[_0x1d7d('0x21')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x24')]);router[_0x1d7d('0x21')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x25')]);module[_0x1d7d('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f46392c..e2c3918 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 _0x775c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','ENUM','twilio','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(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x775c,0x1af));var _0xc775=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x775c[_0x313df3];return _0x241d59;};'use strict';var Sequelize=require(_0xc775('0x0'));var rs=require(_0xc775('0x1'));module[_0xc775('0x2')]={'name':{'type':Sequelize[_0xc775('0x3')],'unique':_0xc775('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xc775('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc775('0x3')]},'type':{'type':Sequelize[_0xc775('0x5')](_0xc775('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xc775('0x3')]},'baseUrl':{'type':Sequelize[_0xc775('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc775('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc775('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc775('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc775('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc775('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc775('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc775('0x9')],'comment':_0xc775('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc775('0xb'),'set':function(_0x42d755){if(!_0x42d755){this[_0xc775('0xc')]('mandatoryDispositionPauseId',null);}this[_0xc775('0xc')]('mandatoryDisposition',_0x42d755);}},'description':{'type':Sequelize[_0xc775('0x3')]}}; \ No newline at end of file +var _0xf9bc=['generate','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x335d20,_0x5c40fe){var _0x5bfb2c=function(_0x374d49){while(--_0x374d49){_0x335d20['push'](_0x335d20['shift']());}};_0x5bfb2c(++_0x5c40fe);}(_0xf9bc,0x1ea));var _0xcf9b=function(_0x769935,_0x2311a5){_0x769935=_0x769935-0x0;var _0x24f62e=_0xf9bc[_0x769935];return _0x24f62e;};'use strict';var Sequelize=require(_0xcf9b('0x0'));var rs=require(_0xcf9b('0x1'));module[_0xcf9b('0x2')]={'name':{'type':Sequelize[_0xcf9b('0x3')],'unique':_0xcf9b('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xcf9b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xcf9b('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcf9b('0x5')]();}},'phone':{'type':Sequelize[_0xcf9b('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xcf9b('0x6'))},'accountSid':{'type':Sequelize[_0xcf9b('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcf9b('0x7');}},'notificationSound':{'type':Sequelize[_0xcf9b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xcf9b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcf9b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf9b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcf9b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xcf9b('0x8')],'defaultValue':![],'comment':_0xcf9b('0xb'),'set':function(_0x41e79c){if(!_0x41e79c){this[_0xcf9b('0xc')](_0xcf9b('0xd'),null);}this[_0xcf9b('0xc')](_0xcf9b('0xe'),_0x41e79c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 586bdc6..41a219f 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 _0x3cc6=['name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','type','options','where','WhatsappAccount','rows','show','includeAll','include','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','Pause','describe','addDisposition','WhatsappAccountId','findOne','hasOwnProperty','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','interaction','autoclose','*,*,*,*','created','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','to\x20is\x20mandatory','List','DESC','WhatsappInteraction','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','get','WhatsappAccounts'];(function(_0x298674,_0x3ef0df){var _0x42d879=function(_0x5bfec8){while(--_0x5bfec8){_0x298674['push'](_0x298674['shift']());}};_0x42d879(++_0x3ef0df);}(_0x3cc6,0x88));var _0x63cc=function(_0x713934,_0x5c4939){_0x713934=_0x713934-0x0;var _0xb5d617=_0x3cc6[_0x713934];return _0xb5d617;};'use strict';var emlformat=require(_0x63cc('0x0'));var rimraf=require(_0x63cc('0x1'));var zipdir=require(_0x63cc('0x2'));var jsonpatch=require(_0x63cc('0x3'));var rp=require(_0x63cc('0x4'));var moment=require(_0x63cc('0x5'));var BPromise=require(_0x63cc('0x6'));var Mustache=require('mustache');var util=require(_0x63cc('0x7'));var path=require('path');var sox=require(_0x63cc('0x8'));var csv=require(_0x63cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63cc('0xa'));var _=require(_0x63cc('0xb'));var squel=require(_0x63cc('0xc'));var crypto=require('crypto');var jsforce=require(_0x63cc('0xd'));var deskjs=require(_0x63cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x63cc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x63cc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x63cc('0x11'))(_0x63cc('0x12'));var utils=require('../../config/utils');var config=require(_0x63cc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x63cc('0x14'))['db'];config[_0x63cc('0x15')]=_[_0x63cc('0x16')](config[_0x63cc('0x15')],{'host':_0x63cc('0x17'),'port':0x18eb});var socket=require(_0x63cc('0x18'))(new Redis(config['redis']));require(_0x63cc('0x19'))[_0x63cc('0x1a')](socket);var jayson=require(_0x63cc('0x1b'));var client=jayson[_0x63cc('0x1c')][_0x63cc('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x29d7ab,_0x274eb3,_0x292414,_0x276cb8){return new BPromise(function(_0x514b22,_0x3dbd98){var _0x5690c3=_0x276cb8||client;return _0x5690c3[_0x63cc('0x1e')](_0x29d7ab,_0x292414)[_0x63cc('0x1f')](function(_0x3cd6cc){logger[_0x63cc('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x274eb3,_0x63cc('0x21'));logger[_0x63cc('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x274eb3,_0x63cc('0x21'),JSON[_0x63cc('0x23')](_0x3cd6cc));if(_0x3cd6cc[_0x63cc('0x24')]){if(_0x3cd6cc[_0x63cc('0x24')][_0x63cc('0x25')]===0x1f4){logger[_0x63cc('0x24')](_0x63cc('0x26'),_0x274eb3,_0x3cd6cc[_0x63cc('0x24')][_0x63cc('0x27')]);return _0x3dbd98(_0x3cd6cc[_0x63cc('0x24')][_0x63cc('0x27')]);}logger[_0x63cc('0x24')](_0x63cc('0x26'),_0x274eb3,_0x3cd6cc[_0x63cc('0x24')]['message']);return _0x514b22(_0x3cd6cc[_0x63cc('0x24')]['message']);}else{logger[_0x63cc('0x20')](_0x63cc('0x26'),_0x274eb3,'request\x20sent');_0x514b22(_0x3cd6cc[_0x63cc('0x28')][_0x63cc('0x27')]);}})[_0x63cc('0x29')](function(_0x48068f){logger[_0x63cc('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x274eb3,_0x48068f);_0x3dbd98(_0x48068f);});});}function respondWithStatusCode(_0x59de95,_0x11de2c){_0x11de2c=_0x11de2c||0xcc;return function(_0x33d3dd){if(_0x33d3dd){return _0x59de95[_0x63cc('0x2a')](_0x11de2c);}return _0x59de95[_0x63cc('0x2b')](_0x11de2c)['end']();};}function respondWithResult(_0x1ed85e,_0x347f10){_0x347f10=_0x347f10||0xc8;return function(_0x369928){if(_0x369928){return _0x1ed85e[_0x63cc('0x2b')](_0x347f10)[_0x63cc('0x2c')](_0x369928);}};}function respondWithFilteredResult(_0x3f9d08,_0x3614e5){return function(_0x3847f2){if(_0x3847f2){var _0x4c8c74=typeof _0x3614e5['offset']===_0x63cc('0x2d')&&typeof _0x3614e5[_0x63cc('0x2e')]==='undefined';var _0x36b843=_0x3847f2[_0x63cc('0x2f')];var _0x68ae01=_0x4c8c74?0x0:_0x3614e5[_0x63cc('0x30')];var _0x370ab3=_0x4c8c74?_0x3847f2['count']:_0x3614e5[_0x63cc('0x30')]+_0x3614e5[_0x63cc('0x2e')];var _0x508b72;if(_0x370ab3>=_0x36b843){_0x370ab3=_0x36b843;_0x508b72=0xc8;}else{_0x508b72=0xce;}_0x3f9d08[_0x63cc('0x2b')](_0x508b72);return _0x3f9d08[_0x63cc('0x31')](_0x63cc('0x32'),_0x68ae01+'-'+_0x370ab3+'/'+_0x36b843)[_0x63cc('0x2c')](_0x3847f2);}return null;};}function patchUpdates(_0x277e59){return function(_0x542e98){try{jsonpatch['apply'](_0x542e98,_0x277e59,!![]);}catch(_0x2998a6){return BPromise[_0x63cc('0x33')](_0x2998a6);}return _0x542e98[_0x63cc('0x34')]();};}function saveUpdates(_0x301a57,_0x486c89){return function(_0x15a03d){if(_0x15a03d){return _0x15a03d['update'](_0x301a57)[_0x63cc('0x1f')](function(_0x185374){return _0x185374;});}return null;};}function removeEntity(_0x18ac4d,_0xa838a7){return function(_0x5691cc){if(_0x5691cc){return _0x5691cc[_0x63cc('0x35')]()[_0x63cc('0x1f')](function(){var _0x4f033e=_0x5691cc[_0x63cc('0x36')]({'plain':!![]});var _0x4e07bc=_0x63cc('0x37');return db['UserProfileResource'][_0x63cc('0x35')]({'where':{'type':_0x4e07bc,'resourceId':_0x4f033e['id']}})[_0x63cc('0x1f')](function(){return _0x5691cc;});})[_0x63cc('0x1f')](function(){_0x18ac4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4502f4,_0x389665){return function(_0x52cbf4){if(!_0x52cbf4){_0x4502f4[_0x63cc('0x2a')](0x194);}return _0x52cbf4;};}function handleError(_0x185649,_0x50357d){_0x50357d=_0x50357d||0x1f4;return function(_0x198d40){logger[_0x63cc('0x24')](_0x198d40['stack']);if(_0x198d40[_0x63cc('0x38')]){delete _0x198d40[_0x63cc('0x38')];}_0x185649[_0x63cc('0x2b')](_0x50357d)[_0x63cc('0x39')](_0x198d40);};}exports['index']=function(_0x4ba607,_0x1facb6){var _0x3db030={'include':[{'model':db['Pause'],'as':_0x63cc('0x3a')}]},_0x1266ea={},_0x426d2c={'count':0x0,'rows':[]};var _0x37dbc8=_[_0x63cc('0x3b')](db['WhatsappAccount'][_0x63cc('0x3c')],function(_0x30b519){return{'name':_0x30b519[_0x63cc('0x3d')],'type':_0x30b519['type'][_0x63cc('0x3e')]};});_0x1266ea[_0x63cc('0x3f')]=_[_0x63cc('0x3b')](_0x37dbc8,_0x63cc('0x38'));_0x1266ea['query']=_[_0x63cc('0x40')](_0x4ba607[_0x63cc('0x41')]);_0x1266ea[_0x63cc('0x42')]=_[_0x63cc('0x43')](_0x1266ea['model'],_0x1266ea[_0x63cc('0x41')]);_0x3db030[_0x63cc('0x44')]=_['intersection'](_0x1266ea[_0x63cc('0x3f')],qs[_0x63cc('0x45')](_0x4ba607[_0x63cc('0x41')][_0x63cc('0x45')]));_0x3db030[_0x63cc('0x44')]=_0x3db030[_0x63cc('0x44')][_0x63cc('0x46')]?_0x3db030['attributes']:_0x1266ea[_0x63cc('0x3f')];if(!_0x4ba607['query']['hasOwnProperty'](_0x63cc('0x47'))){_0x3db030['limit']=qs[_0x63cc('0x2e')](_0x4ba607[_0x63cc('0x41')][_0x63cc('0x2e')]);_0x3db030['offset']=qs[_0x63cc('0x30')](_0x4ba607['query'][_0x63cc('0x30')]);}_0x3db030[_0x63cc('0x48')]=qs[_0x63cc('0x49')](_0x4ba607['query']['sort']);_0x3db030['where']=qs['filters'](_[_0x63cc('0x4a')](_0x4ba607[_0x63cc('0x41')],_0x1266ea['filters']),_0x37dbc8);if(_0x4ba607[_0x63cc('0x41')][_0x63cc('0x4b')]){_0x3db030['where']=_[_0x63cc('0x4c')](_0x3db030['where'],{'$or':_[_0x63cc('0x3b')](_0x37dbc8,function(_0x460d88){if(_0x460d88[_0x63cc('0x4d')]!=='VIRTUAL'){var _0x433955={};_0x433955[_0x460d88['name']]={'$like':'%'+_0x4ba607[_0x63cc('0x41')][_0x63cc('0x4b')]+'%'};return _0x433955;}})});}_0x3db030=_[_0x63cc('0x4c')]({},_0x3db030,_0x4ba607[_0x63cc('0x4e')]);var _0x240663={'where':_0x3db030[_0x63cc('0x4f')]};return db['WhatsappAccount'][_0x63cc('0x2f')](_0x240663)[_0x63cc('0x1f')](function(_0x53948c){_0x426d2c[_0x63cc('0x2f')]=_0x53948c;if(_0x4ba607[_0x63cc('0x41')]['includeAll']){_0x3db030['include']=[{'all':!![]}];}return db[_0x63cc('0x50')]['findAll'](_0x3db030);})['then'](function(_0x3863da){_0x426d2c[_0x63cc('0x51')]=_0x3863da;return _0x426d2c;})[_0x63cc('0x1f')](respondWithFilteredResult(_0x1facb6,_0x3db030))[_0x63cc('0x29')](handleError(_0x1facb6,null));};exports[_0x63cc('0x52')]=function(_0xfdca03,_0x3670eb){var _0x5ddb04={'raw':![],'where':{'id':_0xfdca03['params']['id']},'include':[{'model':db['Pause'],'as':_0x63cc('0x3a')}]},_0x147523={};_0x147523[_0x63cc('0x3f')]=_[_0x63cc('0x40')](db[_0x63cc('0x50')][_0x63cc('0x3c')]);_0x147523[_0x63cc('0x41')]=_[_0x63cc('0x40')](_0xfdca03[_0x63cc('0x41')]);_0x147523[_0x63cc('0x42')]=_[_0x63cc('0x43')](_0x147523[_0x63cc('0x3f')],_0x147523[_0x63cc('0x41')]);_0x5ddb04[_0x63cc('0x44')]=_[_0x63cc('0x43')](_0x147523[_0x63cc('0x3f')],qs[_0x63cc('0x45')](_0xfdca03[_0x63cc('0x41')]['fields']));_0x5ddb04[_0x63cc('0x44')]=_0x5ddb04[_0x63cc('0x44')][_0x63cc('0x46')]?_0x5ddb04[_0x63cc('0x44')]:_0x147523[_0x63cc('0x3f')];if(_0xfdca03[_0x63cc('0x41')][_0x63cc('0x53')]){_0x5ddb04[_0x63cc('0x54')]=[{'all':!![]}];}_0x5ddb04=_['merge']({},_0x5ddb04,_0xfdca03[_0x63cc('0x4e')]);return db[_0x63cc('0x50')][_0x63cc('0x55')](_0x5ddb04)['then'](handleEntityNotFound(_0x3670eb,null))[_0x63cc('0x1f')](respondWithResult(_0x3670eb,null))[_0x63cc('0x29')](handleError(_0x3670eb,null));};exports[_0x63cc('0x56')]=function(_0x2c4160,_0x12d465){return db['WhatsappAccount'][_0x63cc('0x56')](_0x2c4160['body'],{})[_0x63cc('0x1f')](function(_0x442853){var _0x3f6e66=_0x2c4160[_0x63cc('0x57')]['get']({'plain':!![]});if(!_0x3f6e66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f6e66[_0x63cc('0x58')]===_0x63cc('0x57')){var _0x19d50f=_0x442853[_0x63cc('0x36')]({'plain':!![]});var _0x2d669b=_0x63cc('0x37');return db[_0x63cc('0x59')]['find']({'where':{'name':_0x2d669b,'userProfileId':_0x3f6e66[_0x63cc('0x5a')]},'raw':!![]})[_0x63cc('0x1f')](function(_0x19a55b){if(_0x19a55b&&_0x19a55b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x19d50f[_0x63cc('0x38')],'resourceId':_0x19d50f['id'],'type':_0x19a55b['name'],'sectionId':_0x19a55b['id']},{})['then'](function(){return _0x442853;});}else{return _0x442853;}})[_0x63cc('0x29')](function(_0x494db4){logger[_0x63cc('0x24')](_0x63cc('0x5b'),_0x494db4);throw _0x494db4;});}return _0x442853;})[_0x63cc('0x1f')](respondWithResult(_0x12d465,0xc9))[_0x63cc('0x29')](handleError(_0x12d465,null));};exports[_0x63cc('0x5c')]=function(_0x13c6eb,_0x57f0f0){if(_0x13c6eb['body']['id']){delete _0x13c6eb[_0x63cc('0x5d')]['id'];}return db['WhatsappAccount'][_0x63cc('0x55')]({'where':{'id':_0x13c6eb[_0x63cc('0x5e')]['id']},'include':[{'model':db[_0x63cc('0x5f')],'as':_0x63cc('0x3a')}]})['then'](handleEntityNotFound(_0x57f0f0,null))[_0x63cc('0x1f')](saveUpdates(_0x13c6eb[_0x63cc('0x5d')],null))[_0x63cc('0x1f')](respondWithResult(_0x57f0f0,null))[_0x63cc('0x29')](handleError(_0x57f0f0,null));};exports[_0x63cc('0x35')]=function(_0x268bd8,_0x477cc6){return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x268bd8[_0x63cc('0x5e')]['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x477cc6,null))[_0x63cc('0x1f')](removeEntity(_0x477cc6,null))[_0x63cc('0x29')](handleError(_0x477cc6,null));};exports['describe']=function(_0x3d1087,_0x49592c){return db['WhatsappAccount'][_0x63cc('0x60')]()[_0x63cc('0x1f')](respondWithResult(_0x49592c,null))[_0x63cc('0x29')](handleError(_0x49592c,null));};exports[_0x63cc('0x61')]=function(_0x55f077,_0x5f05ea,_0x59e719){if(_0x55f077[_0x63cc('0x5d')]['id']){delete _0x55f077[_0x63cc('0x5d')]['id'];}return db['WhatsappAccount'][_0x63cc('0x55')]({'where':{'id':_0x55f077[_0x63cc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5f05ea,null))['then'](function(_0x4762a1){if(_0x4762a1){_0x55f077['body'][_0x63cc('0x62')]=_0x4762a1['id'];return db['Disposition'][_0x63cc('0x56')](_0x55f077[_0x63cc('0x5d')]);}})[_0x63cc('0x1f')](respondWithResult(_0x5f05ea,null))['catch'](handleError(_0x5f05ea,null));};exports['getDispositions']=function(_0x1beff4,_0x576fa9,_0x4f0634){var _0x250d74={'raw':![],'where':{}};var _0x240952={};var _0xe29ce8={'count':0x0,'rows':[]};return db[_0x63cc('0x50')][_0x63cc('0x63')]({'where':{'id':_0x1beff4[_0x63cc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x576fa9,null))[_0x63cc('0x1f')](function(_0x54eeb0){if(_0x54eeb0){_0x240952[_0x63cc('0x3f')]=_[_0x63cc('0x40')](db['Disposition'][_0x63cc('0x3c')]);_0x240952[_0x63cc('0x41')]=_[_0x63cc('0x40')](_0x1beff4['query']);_0x240952[_0x63cc('0x42')]=_['intersection'](_0x240952[_0x63cc('0x3f')],_0x240952[_0x63cc('0x41')]);_0x250d74['attributes']=_[_0x63cc('0x43')](_0x240952['model'],qs[_0x63cc('0x45')](_0x1beff4[_0x63cc('0x41')]['fields']));_0x250d74[_0x63cc('0x44')]=_0x250d74['attributes']['length']?_0x250d74[_0x63cc('0x44')]:_0x240952['model'];if(!_0x1beff4[_0x63cc('0x41')][_0x63cc('0x64')](_0x63cc('0x47'))){_0x250d74['limit']=qs[_0x63cc('0x2e')](_0x1beff4['query'][_0x63cc('0x2e')]);_0x250d74['offset']=qs[_0x63cc('0x30')](_0x1beff4['query'][_0x63cc('0x30')]);}_0x250d74[_0x63cc('0x48')]=qs[_0x63cc('0x49')](_0x1beff4[_0x63cc('0x41')]['sort']);_0x250d74['where']=qs['filters'](_[_0x63cc('0x4a')](_0x1beff4[_0x63cc('0x41')],_0x240952['filters']));_0x250d74[_0x63cc('0x4f')][_0x63cc('0x62')]=_0x54eeb0['id'];if(_0x1beff4[_0x63cc('0x41')][_0x63cc('0x4b')]){_0x250d74[_0x63cc('0x4f')]=_[_0x63cc('0x4c')](_0x250d74[_0x63cc('0x4f')],{'$or':_[_0x63cc('0x3b')](_0x250d74['attributes'],function(_0x261223){var _0xfb40f2={};_0xfb40f2[_0x261223]={'$like':'%'+_0x1beff4[_0x63cc('0x41')][_0x63cc('0x4b')]+'%'};return _0xfb40f2;})});}_0x250d74=_[_0x63cc('0x4c')]({},_0x250d74,_0x1beff4[_0x63cc('0x4e')]);return db[_0x63cc('0x65')][_0x63cc('0x2f')]({'where':_0x250d74[_0x63cc('0x4f')]})[_0x63cc('0x1f')](function(_0x16832d){_0xe29ce8[_0x63cc('0x2f')]=_0x16832d;if(_0x1beff4[_0x63cc('0x41')][_0x63cc('0x53')]){_0x250d74[_0x63cc('0x54')]=[{'all':!![]}];}return db[_0x63cc('0x65')][_0x63cc('0x66')](_0x250d74);})[_0x63cc('0x1f')](function(_0x3b5319){_0xe29ce8[_0x63cc('0x51')]=_0x3b5319;return _0xe29ce8;});}})[_0x63cc('0x1f')](respondWithFilteredResult(_0x576fa9,_0x250d74))['catch'](handleError(_0x576fa9,null));};exports['removeDispositions']=function(_0x4d7734,_0x4bd1fa,_0x52baa4){return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x4d7734['params']['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x4bd1fa,null))[_0x63cc('0x1f')](function(_0x141a4e){if(_0x141a4e){return _0x141a4e[_0x63cc('0x67')](_0x4d7734[_0x63cc('0x41')][_0x63cc('0x68')]);}})[_0x63cc('0x1f')](respondWithStatusCode(_0x4bd1fa,null))[_0x63cc('0x29')](handleError(_0x4bd1fa,null));};exports[_0x63cc('0x69')]=function(_0x77dc3e,_0x2c0212,_0x2688f9){if(_0x77dc3e[_0x63cc('0x5d')]['id']){delete _0x77dc3e['body']['id'];}return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x77dc3e['params']['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x2c0212,null))['then'](function(_0x2657dd){if(_0x2657dd){_0x77dc3e['body'][_0x63cc('0x62')]=_0x2657dd['id'];return db[_0x63cc('0x6a')][_0x63cc('0x56')](_0x77dc3e['body']);}})[_0x63cc('0x1f')](respondWithResult(_0x2c0212,null))[_0x63cc('0x29')](handleError(_0x2c0212,null));};exports[_0x63cc('0x6b')]=function(_0x321614,_0x3ee0af,_0x455060){var _0x2e554b={'raw':![],'where':{}};var _0x5d3ce0={};var _0x4bc3ef={'count':0x0,'rows':[]};return db[_0x63cc('0x50')][_0x63cc('0x63')]({'where':{'id':_0x321614['params']['id']}})['then'](handleEntityNotFound(_0x3ee0af,null))[_0x63cc('0x1f')](function(_0x1cebca){if(_0x1cebca){_0x5d3ce0[_0x63cc('0x3f')]=_[_0x63cc('0x40')](db[_0x63cc('0x6a')][_0x63cc('0x3c')]);_0x5d3ce0[_0x63cc('0x41')]=_[_0x63cc('0x40')](_0x321614[_0x63cc('0x41')]);_0x5d3ce0['filters']=_[_0x63cc('0x43')](_0x5d3ce0[_0x63cc('0x3f')],_0x5d3ce0[_0x63cc('0x41')]);_0x2e554b['attributes']=_['intersection'](_0x5d3ce0['model'],qs[_0x63cc('0x45')](_0x321614[_0x63cc('0x41')][_0x63cc('0x45')]));_0x2e554b[_0x63cc('0x44')]=_0x2e554b['attributes'][_0x63cc('0x46')]?_0x2e554b[_0x63cc('0x44')]:_0x5d3ce0[_0x63cc('0x3f')];if(!_0x321614[_0x63cc('0x41')][_0x63cc('0x64')]('nolimit')){_0x2e554b[_0x63cc('0x2e')]=qs[_0x63cc('0x2e')](_0x321614[_0x63cc('0x41')]['limit']);_0x2e554b[_0x63cc('0x30')]=qs[_0x63cc('0x30')](_0x321614['query']['offset']);}_0x2e554b['order']=qs[_0x63cc('0x49')](_0x321614[_0x63cc('0x41')][_0x63cc('0x49')]);_0x2e554b[_0x63cc('0x4f')]=qs['filters'](_[_0x63cc('0x4a')](_0x321614[_0x63cc('0x41')],_0x5d3ce0['filters']));_0x2e554b['where'][_0x63cc('0x62')]=_0x1cebca['id'];if(_0x321614[_0x63cc('0x41')][_0x63cc('0x4b')]){_0x2e554b[_0x63cc('0x4f')]=_[_0x63cc('0x4c')](_0x2e554b[_0x63cc('0x4f')],{'$or':_['map'](_0x2e554b[_0x63cc('0x44')],function(_0x5408d1){var _0x482368={};_0x482368[_0x5408d1]={'$like':'%'+_0x321614['query'][_0x63cc('0x4b')]+'%'};return _0x482368;})});}_0x2e554b=_[_0x63cc('0x4c')]({},_0x2e554b,_0x321614[_0x63cc('0x4e')]);return db[_0x63cc('0x6a')][_0x63cc('0x2f')]({'where':_0x2e554b[_0x63cc('0x4f')]})[_0x63cc('0x1f')](function(_0x14f6c6){_0x4bc3ef[_0x63cc('0x2f')]=_0x14f6c6;if(_0x321614[_0x63cc('0x41')][_0x63cc('0x53')]){_0x2e554b[_0x63cc('0x54')]=[{'all':!![]}];}return db[_0x63cc('0x6a')]['findAll'](_0x2e554b);})['then'](function(_0x5cfeb7){_0x4bc3ef[_0x63cc('0x51')]=_0x5cfeb7;return _0x4bc3ef;});}})['then'](respondWithFilteredResult(_0x3ee0af,_0x2e554b))[_0x63cc('0x29')](handleError(_0x3ee0af,null));};exports[_0x63cc('0x6c')]=function(_0x8c3344,_0x14dd34,_0x33237d){return db['WhatsappAccount'][_0x63cc('0x55')]({'where':{'id':_0x8c3344['params']['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x14dd34,null))[_0x63cc('0x1f')](function(_0x1de3b5){if(_0x1de3b5){return _0x1de3b5[_0x63cc('0x6c')](_0x8c3344[_0x63cc('0x41')][_0x63cc('0x68')]);}})[_0x63cc('0x1f')](respondWithStatusCode(_0x14dd34,null))[_0x63cc('0x29')](handleError(_0x14dd34,null));};exports[_0x63cc('0x6d')]=function(_0x1a098f,_0x3b266e,_0x2d8913){return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x1a098f['params']['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x3b266e,null))[_0x63cc('0x1f')](function(_0x5eb606){if(_0x5eb606){return _0x5eb606[_0x63cc('0x6d')](_0x1a098f[_0x63cc('0x5d')][_0x63cc('0x68')],_[_0x63cc('0x6e')](_0x1a098f[_0x63cc('0x5d')],[_0x63cc('0x68'),'id'])||{})[_0x63cc('0x6f')](function(_0x133e83){for(var _0x3bd2df=0x0;_0x3bd2df<_0x1a098f[_0x63cc('0x5d')][_0x63cc('0x68')][_0x63cc('0x46')];_0x3bd2df+=0x1){socket[_0x63cc('0x70')](_0x63cc('0x71'),{'UserId':Number(_0x1a098f[_0x63cc('0x5d')][_0x63cc('0x68')][_0x3bd2df]),'WhatsappAccountId':Number(_0x1a098f[_0x63cc('0x5e')]['id'])});}return _0x133e83;});}})[_0x63cc('0x1f')](respondWithResult(_0x3b266e,null))['catch'](handleError(_0x3b266e,null));};exports[_0x63cc('0x72')]=function(_0x40a5f7,_0x2ac11b,_0x5c486f){return db['WhatsappAccount'][_0x63cc('0x55')]({'where':{'id':_0x40a5f7[_0x63cc('0x5e')]['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x2ac11b,null))[_0x63cc('0x1f')](function(_0x4063a6){if(_0x4063a6){return _0x4063a6['removeAgents'](_0x40a5f7['query'][_0x63cc('0x68')])['then'](function(){if(_['isArray'](_0x40a5f7[_0x63cc('0x41')][_0x63cc('0x68')])){for(var _0x9cf6a9=0x0;_0x9cf6a9<_0x40a5f7[_0x63cc('0x41')][_0x63cc('0x68')]['length'];_0x9cf6a9+=0x1){socket[_0x63cc('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x40a5f7[_0x63cc('0x41')]['ids'][_0x9cf6a9]),'WhatsappAccountId':Number(_0x40a5f7[_0x63cc('0x5e')]['id'])});}}else{socket[_0x63cc('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x40a5f7['query'][_0x63cc('0x68')]),'WhatsappAccountId':Number(_0x40a5f7[_0x63cc('0x5e')]['id'])});}});}})[_0x63cc('0x1f')](respondWithStatusCode(_0x2ac11b,null))['catch'](handleError(_0x2ac11b,null));};exports[_0x63cc('0x73')]=function(_0x55d146,_0x142370,_0x564780){var _0x5f32d2={};var _0x35f8c9={};var _0x36029e;var _0x87770e;return db[_0x63cc('0x50')]['findOne']({'where':{'id':_0x55d146[_0x63cc('0x5e')]['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x142370,null))[_0x63cc('0x1f')](function(_0x2276a1){if(_0x2276a1){_0x36029e=_0x2276a1;_0x35f8c9[_0x63cc('0x3f')]=_['keys'](db[_0x63cc('0x74')]['rawAttributes']);_0x35f8c9['query']=_['keys'](_0x55d146[_0x63cc('0x41')]);_0x35f8c9['filters']=_[_0x63cc('0x43')](_0x35f8c9[_0x63cc('0x3f')],_0x35f8c9[_0x63cc('0x41')]);_0x5f32d2['attributes']=_['intersection'](_0x35f8c9['model'],qs['fields'](_0x55d146[_0x63cc('0x41')]['fields']));_0x5f32d2[_0x63cc('0x44')]=_0x5f32d2[_0x63cc('0x44')][_0x63cc('0x46')]?_0x5f32d2[_0x63cc('0x44')]:_0x35f8c9[_0x63cc('0x3f')];_0x5f32d2[_0x63cc('0x48')]=qs[_0x63cc('0x49')](_0x55d146['query'][_0x63cc('0x49')]);_0x5f32d2[_0x63cc('0x4f')]=qs[_0x63cc('0x42')](_[_0x63cc('0x4a')](_0x55d146['query'],_0x35f8c9['filters']));if(_0x55d146[_0x63cc('0x41')][_0x63cc('0x4b')]){_0x5f32d2[_0x63cc('0x4f')]=_[_0x63cc('0x4c')](_0x5f32d2[_0x63cc('0x4f')],{'$or':_[_0x63cc('0x3b')](_0x5f32d2[_0x63cc('0x44')],function(_0x5da6c6){var _0x5a9453={};_0x5a9453[_0x5da6c6]={'$like':'%'+_0x55d146[_0x63cc('0x41')][_0x63cc('0x4b')]+'%'};return _0x5a9453;})});}_0x5f32d2=_['merge']({},_0x5f32d2,_0x55d146['options']);return _0x36029e[_0x63cc('0x73')](_0x5f32d2);}})[_0x63cc('0x1f')](function(_0x178c49){if(_0x178c49){_0x87770e=_0x178c49[_0x63cc('0x46')];if(!_0x55d146[_0x63cc('0x41')][_0x63cc('0x64')](_0x63cc('0x47'))){_0x5f32d2[_0x63cc('0x2e')]=qs[_0x63cc('0x2e')](_0x55d146['query'][_0x63cc('0x2e')]);_0x5f32d2[_0x63cc('0x30')]=qs[_0x63cc('0x30')](_0x55d146['query'][_0x63cc('0x30')]);}return _0x36029e[_0x63cc('0x73')](_0x5f32d2);}})[_0x63cc('0x1f')](function(_0x4436c8){if(_0x4436c8){return _0x4436c8?{'count':_0x87770e,'rows':_0x4436c8}:null;}})[_0x63cc('0x1f')](respondWithResult(_0x142370,null))[_0x63cc('0x29')](handleError(_0x142370,null));};exports[_0x63cc('0x75')]=function(_0x27cd74,_0x5049fb){var _0xddf7ac=_0x27cd74[_0x63cc('0x5e')]['id'];var _0x25d203=_0x27cd74[_0x63cc('0x5d')];var _0x5133f2=0xc8;var _0x3f4696=null;return db[_0x63cc('0x76')][_0x63cc('0x77')]({'isolationLevel':db[_0x63cc('0x76')]['Transaction'][_0x63cc('0x78')][_0x63cc('0x79')]},function(_0x565d83){return db[_0x63cc('0x50')][_0x63cc('0x63')]({'where':{'id':_0xddf7ac},'transaction':_0x565d83})[_0x63cc('0x1f')](function(_0x583617){if(_0x583617){return db[_0x63cc('0x7a')][_0x63cc('0x35')]({'where':{'WhatsappAccountId':_0xddf7ac},'transaction':_0x565d83})[_0x63cc('0x1f')](function(){var _0x341ca0=_[_0x63cc('0x3b')](_0x25d203,function(_0x5d99e5){_0x5d99e5[_0x63cc('0x62')]=_0xddf7ac;return _0x5d99e5;});return db[_0x63cc('0x7a')][_0x63cc('0x7b')](_0x341ca0,{'transaction':_0x565d83});});}else{_0x5133f2=0x194;_0x3f4696=[];}});})[_0x63cc('0x1f')](function(){if(_0x5133f2!==0x194){return db[_0x63cc('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0xddf7ac},'order':_0x63cc('0x7c')})[_0x63cc('0x1f')](function(_0xa9dba5){_0x3f4696=_0xa9dba5;});}})[_0x63cc('0x29')](function(_0x452096){_0x5133f2=0x1f4;logger[_0x63cc('0x24')](_0x452096[_0x63cc('0x7d')]);if(_0x452096[_0x63cc('0x38')]){delete _0x452096[_0x63cc('0x38')];}_0x3f4696=_0x452096;})[_0x63cc('0x7e')](function(){if(_0x3f4696===null){_0x5049fb['sendStatus'](_0x5133f2);}else{if(_0x5133f2===0x1f4){_0x5049fb['status'](_0x5133f2)[_0x63cc('0x39')](_0x3f4696);}else{_0x5049fb[_0x63cc('0x2b')](_0x5133f2)[_0x63cc('0x2c')](_0x3f4696);}}});};exports['getApplications']=function(_0x57a5e9,_0x6f1f64,_0xc6e06a){var _0x34fb96={};var _0x52e66e={};var _0x4fb2b1;var _0x4d1d46;return db[_0x63cc('0x50')][_0x63cc('0x63')]({'where':{'id':_0x57a5e9['params']['id']}})[_0x63cc('0x1f')](handleEntityNotFound(_0x6f1f64,null))[_0x63cc('0x1f')](function(_0x4050d6){if(_0x4050d6){_0x4fb2b1=_0x4050d6;_0x52e66e[_0x63cc('0x3f')]=_['keys'](db[_0x63cc('0x7a')]['rawAttributes']);_0x52e66e[_0x63cc('0x41')]=_[_0x63cc('0x40')](_0x57a5e9[_0x63cc('0x41')]);_0x52e66e['filters']=_[_0x63cc('0x43')](_0x52e66e[_0x63cc('0x3f')],_0x52e66e[_0x63cc('0x41')]);_0x34fb96['attributes']=_[_0x63cc('0x43')](_0x52e66e[_0x63cc('0x3f')],qs['fields'](_0x57a5e9[_0x63cc('0x41')][_0x63cc('0x45')]));_0x34fb96['attributes']=_0x34fb96['attributes'][_0x63cc('0x46')]?_0x34fb96[_0x63cc('0x44')]:_0x52e66e['model'];_0x34fb96[_0x63cc('0x48')]=qs[_0x63cc('0x49')](_0x57a5e9[_0x63cc('0x41')][_0x63cc('0x49')]);_0x34fb96[_0x63cc('0x4f')]=qs['filters'](_[_0x63cc('0x4a')](_0x57a5e9[_0x63cc('0x41')],_0x52e66e[_0x63cc('0x42')]));if(_0x57a5e9[_0x63cc('0x41')][_0x63cc('0x4b')]){_0x34fb96['where']=_[_0x63cc('0x4c')](_0x34fb96['where'],{'$or':_[_0x63cc('0x3b')](_0x34fb96[_0x63cc('0x44')],function(_0x6e6e74){var _0x49d601={};_0x49d601[_0x6e6e74]={'$like':'%'+_0x57a5e9[_0x63cc('0x41')][_0x63cc('0x4b')]+'%'};return _0x49d601;})});}_0x34fb96=_['merge']({},_0x34fb96,_0x57a5e9[_0x63cc('0x4e')]);return _0x4fb2b1['getApplications'](_0x34fb96);}})[_0x63cc('0x1f')](function(_0x511783){if(_0x511783){_0x4d1d46=_0x511783[_0x63cc('0x46')];if(!_0x57a5e9['query']['hasOwnProperty'](_0x63cc('0x47'))){_0x34fb96[_0x63cc('0x2e')]=qs[_0x63cc('0x2e')](_0x57a5e9['query']['limit']);_0x34fb96[_0x63cc('0x30')]=qs['offset'](_0x57a5e9[_0x63cc('0x41')][_0x63cc('0x30')]);}return _0x4fb2b1['getApplications'](_0x34fb96);}})[_0x63cc('0x1f')](function(_0x4fb433){if(_0x4fb433){return _0x4fb433?{'count':_0x4d1d46,'rows':_0x4fb433}:null;}})['then'](respondWithResult(_0x6f1f64,null))[_0x63cc('0x29')](handleError(_0x6f1f64,null));};exports[_0x63cc('0x7f')]=function(_0x40d820,_0x1e7b6f,_0x7a0634){var _0x5f5d6a={'channel':_0x63cc('0x80')};var _0x2a9ec1=[];var _0x1d7216=[];var _0x5b9abe={};return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x40d820['params']['id']},'include':[{'model':db[_0x63cc('0x7a')],'as':_0x63cc('0x81')}]})['then'](handleEntityNotFound(_0x1e7b6f,null))['then'](function(_0x1f52c6){_0x5f5d6a[_0x63cc('0x82')]=_0x1f52c6;if(_0x5f5d6a[_0x63cc('0x82')]&&_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x4d')]===_0x63cc('0x83')&&_0x40d820[_0x63cc('0x5d')][_0x63cc('0x84')]){if(_0x40d820['body'][_0x63cc('0x84')][_0x63cc('0x46')]===0x0)return;if(_0x40d820[_0x63cc('0x5d')][_0x63cc('0x84')][0x0][_0x63cc('0x85')]!==_0x63cc('0x86'))return;return db[_0x63cc('0x87')]['update']({'read':!![],'readAt':_0x40d820['body'][_0x63cc('0x84')][0x0][_0x63cc('0x88')]},{'where':{'messageId':_0x40d820[_0x63cc('0x5d')]['statuses'][0x0][_0x63cc('0x89')]},'individualHooks':!![]})[_0x63cc('0x1f')](function(_0x3c20cf){return _0x1e7b6f[_0x63cc('0x2b')](0xc8)[_0x63cc('0x2c')](_0x3c20cf);});}_0x5f5d6a[_0x63cc('0x8a')]=_['orderBy'](_0x1f52c6[_0x63cc('0x81')],[_0x63cc('0x7c')],[_0x63cc('0x8b')]);if(_0x5f5d6a['account']['Applications']){delete _0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x81')];}return db[_0x63cc('0x8c')]['describe']()[_0x63cc('0x1f')](function(_0x407b54){if(!_0x407b54){throw new db[(_0x63cc('0x8d'))][(_0x63cc('0x8e'))](_0x63cc('0x8f'));}_0x2a9ec1=_[_0x63cc('0x90')](_[_0x63cc('0x40')](_0x407b54),[_0x63cc('0x91'),_0x63cc('0x92')]);_0x1d7216=_[_0x63cc('0x90')](_[_0x63cc('0x40')](_0x407b54),['createdAt',_0x63cc('0x92'),_0x63cc('0x93'),_0x63cc('0x94')]);_0x5f5d6a['body']={'mapKey':_0x63cc('0x95')};if(_0x5f5d6a['account']&&_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x4d')]===_0x63cc('0x96')){_0x5f5d6a['body'][_0x63cc('0x97')]=_0x40d820['body'][_0x63cc('0x98')]['replace'](_0x63cc('0x99'),'');_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x5d')]=_0x40d820['body'][_0x63cc('0x9a')];_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x9b')]=_0x40d820[_0x63cc('0x5d')][_0x63cc('0x9c')];}if(_0x5f5d6a[_0x63cc('0x82')]&&_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x4d')]===_0x63cc('0x83')){_0x5f5d6a['body']['from']=_0x40d820[_0x63cc('0x5d')][_0x63cc('0x9d')][0x0][_0x63cc('0x97')];_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x5d')]=_0x40d820[_0x63cc('0x5d')][_0x63cc('0x9d')][0x0][_0x63cc('0x27')][_0x63cc('0x5d')];_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x9b')]=_0x40d820['body'][_0x63cc('0x9d')][0x0]['message_id'];}if(_0x5f5d6a['body']['id']){delete _0x5f5d6a['body']['id'];}if(_[_0x63cc('0x9e')](_0x5f5d6a['body'][_0x63cc('0x97')])){throw new db[(_0x63cc('0x8d'))]['ValidationError'](_0x63cc('0x9f'));}if(_[_0x63cc('0x9e')](_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x5d')])||_0x5f5d6a['body'][_0x63cc('0x5d')]===''){throw new db[(_0x63cc('0x8d'))]['ValidationError'](_0x63cc('0xa0'));}if(_[_0x63cc('0x9e')](_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0xa1')])){throw new db[(_0x63cc('0x8d'))][(_0x63cc('0x8e'))](_0x63cc('0xa2')+_0x1d7216);}if(!_[_0x63cc('0xa3')](_0x1d7216,_0x5f5d6a['body'][_0x63cc('0xa1')])){throw new db['Sequelize'][(_0x63cc('0x8e'))](_0x63cc('0xa4')+_0x1d7216);}_0x5b9abe[_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0xa1')]]=_0x5f5d6a[_0x63cc('0x5d')]['from'];return db[_0x63cc('0xa5')][_0x63cc('0x55')]({'where':{'id':_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x94')]},'include':[{'model':db[_0x63cc('0x8c')],'as':_0x63cc('0xa6'),'where':_0x5b9abe,'limit':0x1,'order':[[_0x63cc('0x92'),'DESC']]}]});})['then'](handleEntityNotFound(_0x1e7b6f,null))[_0x63cc('0x1f')](function(_0x4d6811){if(_0x4d6811){_0x5f5d6a[_0x63cc('0xa7')]=_[_0x63cc('0x6e')](_0x4d6811,['Contacts']);if(_0x4d6811['Contacts'][_0x63cc('0x46')]){return _0x4d6811[_0x63cc('0xa6')][0x0];}var _0x53b947=_['defaults'](_0x5f5d6a[_0x63cc('0x5d')],{'firstName':_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x97')],'ListId':_0x4d6811['id']});_0x53b947[_0x5f5d6a['body']['mapKey']]=_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x97')];return db['CmContact'][_0x63cc('0x56')](_0x53b947,{'fields':_0x2a9ec1,'raw':!![]});}})[_0x63cc('0x1f')](handleEntityNotFound(_0x1e7b6f,null))[_0x63cc('0x1f')](function(_0x4779f5){if(_0x4779f5){_0x5f5d6a[_0x63cc('0xa8')]=_0x4779f5;var _0x1392f5={'ContactId':_0x4779f5['id'],'phone':_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x97')],'WhatsappAccountId':_0x40d820[_0x63cc('0x5e')]['id']};var _0x10fa2d={'ContactId':_0x4779f5['id'],'WhatsappAccountId':_0x40d820[_0x63cc('0x5e')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x63cc('0x55')]({'where':_0x10fa2d})[_0x63cc('0x1f')](function(_0x1e94ea){if(_0x1e94ea){return[_0x1e94ea,![]];}return db['WhatsappInteraction'][_0x63cc('0x56')](_0x1392f5)[_0x63cc('0x1f')](function(_0x496c90){return[_0x496c90,!![]];});});}})[_0x63cc('0x6f')](function(_0x46e15d,_0x5f44c6){_0x5f5d6a[_0x63cc('0xa9')]=_0x46e15d[_0x63cc('0x36')]({'plain':!![]});_0x5f5d6a[_0x63cc('0xa9')]['created']=![];if(_0x5f44c6){if(_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0xaa')]){_0x5f5d6a[_0x63cc('0x8a')]['push']({'id':0x0,'priority':_0x5f5d6a[_0x63cc('0x8a')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x63cc('0xab')});}_0x5f5d6a['interaction'][_0x63cc('0xac')]=!![];}return db[_0x63cc('0x87')][_0x63cc('0x56')]({'phone':_0x5f5d6a[_0x63cc('0x5d')]['from'],'messageId':_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0x9b')],'body':_0x5f5d6a[_0x63cc('0x5d')]['body'],'WhatsappAccountId':_0x40d820[_0x63cc('0x5e')]['id'],'WhatsappInteractionId':_0x46e15d['id'],'direction':'in','ContactId':_0x46e15d[_0x63cc('0xad')],'AttachmentId':_0x5f5d6a[_0x63cc('0x5d')][_0x63cc('0xae')]});})[_0x63cc('0x1f')](function(_0x1e655f){_0x5f5d6a[_0x63cc('0x27')]=_0x1e655f;if(_0x5f5d6a['interaction'][_0x63cc('0xaf')]){return db[_0x63cc('0x74')][_0x63cc('0x55')]({'attributes':['id',_0x63cc('0x38')],'where':{'id':_0x5f5d6a['interaction'][_0x63cc('0xaf')]}})[_0x63cc('0x1f')](function(_0x28b5ab){if(_0x28b5ab){_0x5f5d6a[_0x63cc('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x63cc('0xb0'),'appdata':_0x28b5ab[_0x63cc('0x38')]+','+(_0x5f5d6a[_0x63cc('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x63cc('0xab')});}return respondWithRpcPromise(_0x63cc('0xb1'),_0x63cc('0xb2'),_0x5f5d6a);});}return respondWithRpcPromise(_0x63cc('0xb1'),_0x63cc('0xb2'),_0x5f5d6a);})['then'](function(_0x1f1921){if(_0x1f1921){var _0x52a5e9=0xc8;var _0x277709=_0x63cc('0xb3');logger[_0x63cc('0x20')](_0x63cc('0xb4'),_0x277709,_0x52a5e9,_0x63cc('0xb5'));logger['debug'](_0x63cc('0xb6'),_0x277709,_0x52a5e9,'entity\x20found',JSON[_0x63cc('0x23')](_0x1f1921));if(_0x5f5d6a[_0x63cc('0x82')][_0x63cc('0x4d')]===_0x63cc('0x96')){return _0x1e7b6f[_0x63cc('0x2b')](_0x52a5e9)['set'](_0x63cc('0xb7'),'text/xml')[_0x63cc('0x39')]('\x0a');}else{return _0x1e7b6f[_0x63cc('0x2b')](_0x52a5e9)['json'](_0x1f1921);}}});})[_0x63cc('0x29')](handleError(_0x1e7b6f,null));};exports[_0x63cc('0x39')]=function(_0x46a227,_0x8d6bcf,_0x1d5bed){var _0x53eedd,_0xc952c,_0x3d8baf;if(_[_0x63cc('0x9e')](_0x46a227[_0x63cc('0x5d')][_0x63cc('0x5d')])||_0x46a227['body']['body']===''){throw new db['Sequelize'][(_0x63cc('0x8e'))](_0x63cc('0xa0'));}if(_[_0x63cc('0x9e')](_0x46a227['body']['to'])){throw new db[(_0x63cc('0x8d'))][(_0x63cc('0x8e'))](_0x63cc('0xb8'));}_0x53eedd=_0x46a227[_0x63cc('0x5d')]['to'];return db[_0x63cc('0x50')][_0x63cc('0x55')]({'where':{'id':_0x46a227[_0x63cc('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x63cc('0xb9'),'include':[{'model':db[_0x63cc('0x8c')],'as':_0x63cc('0xa6'),'where':{'mobile':_0x53eedd},'limit':0x1,'order':[[_0x63cc('0x92'),_0x63cc('0xba')]]}]}]})[_0x63cc('0x1f')](handleEntityNotFound(_0x8d6bcf,null))[_0x63cc('0x1f')](function(_0x2f5ae9){if(_0x2f5ae9&&_0x2f5ae9['List']){_0xc952c=_0x2f5ae9['get']({'plain':!![]});if(_0xc952c['List']&&_0xc952c[_0x63cc('0xb9')][_0x63cc('0xa6')][_0x63cc('0x46')]){return _0xc952c['List'][_0x63cc('0xa6')][0x0];}return db[_0x63cc('0x8c')]['create'](_[_0x63cc('0x16')](_0x46a227['body'],{'firstName':_0x53eedd,'mobile':_0x53eedd,'phone':_0x53eedd,'ListId':_0xc952c[_0x63cc('0x94')]}));}})[_0x63cc('0x1f')](handleEntityNotFound(_0x8d6bcf,null))['then'](function(_0x1fe794){if(_0x1fe794){_0x3d8baf=_0x1fe794;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x3d8baf['id'],'closed':![],'WhatsappAccountId':_0xc952c['id']}})[_0x63cc('0x1f')](function(_0x5835c){if(_0x5835c){return[_0x5835c,![]];}return db[_0x63cc('0xbb')][_0x63cc('0x56')]({'UserId':_0x46a227[_0x63cc('0x57')]['id'],'ContactId':_0x3d8baf['id'],'WhatsappAccountId':_0xc952c['id'],'phone':_0x53eedd,'firstMsgDirection':_0x63cc('0xbc'),'Messages':[_[_0x63cc('0x4c')](_0x46a227['body'],{'read':![],'body':_0x46a227['body'][_0x63cc('0x5d')],'phone':_0x53eedd,'WhatsappAccountId':_0xc952c['id'],'UserId':_0x46a227[_0x63cc('0x57')]['id'],'ContactId':_0x3d8baf['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x63cc('0xbd')}]})['then'](function(_0x277b98){return[_0x277b98,!![]];});});}})['spread'](function(_0x2afa6b,_0x58fc8e){if(_0x58fc8e){return _0x2afa6b;}return db['WhatsappMessage'][_0x63cc('0x56')](_[_0x63cc('0x4c')](_0x46a227['body'],{'read':![],'body':_0x46a227[_0x63cc('0x5d')][_0x63cc('0x5d')],'phone':_0x53eedd,'WhatsappAccountId':_0xc952c['id'],'WhatsappInteractionId':_0x2afa6b['id'],'UserId':_0x46a227[_0x63cc('0x57')]['id'],'ContactId':_0x3d8baf['id']}))[_0x63cc('0x1f')](function(_0x2ba400){_0x2afa6b[_0x63cc('0xbe')][_0x63cc('0xbd')]=[];_0x2afa6b['dataValues'][_0x63cc('0xbd')][_0x63cc('0xbf')](_0x2ba400[_0x63cc('0xbe')]);return _0x2afa6b;});})[_0x63cc('0x1f')](respondWithResult(_0x8d6bcf,null))['catch'](handleError(_0x8d6bcf,null));}; \ No newline at end of file +var _0xaf08=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','findOne','length','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','stack','finally','send','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','update','timestamp','message_id','applications','asc','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','agent','startRouting','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x166310,_0x49c9f4){var _0xd24eb8=function(_0x2b1aa8){while(--_0x2b1aa8){_0x166310['push'](_0x166310['shift']());}};_0xd24eb8(++_0x49c9f4);}(_0xaf08,0x178));var _0x8af0=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xaf08[_0xfbdff6];return _0x4cb9be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8af0('0x0'));var zipdir=require(_0x8af0('0x1'));var jsonpatch=require(_0x8af0('0x2'));var rp=require('request-promise');var moment=require(_0x8af0('0x3'));var BPromise=require(_0x8af0('0x4'));var Mustache=require(_0x8af0('0x5'));var util=require(_0x8af0('0x6'));var path=require(_0x8af0('0x7'));var sox=require('sox');var csv=require(_0x8af0('0x8'));var ejs=require(_0x8af0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8af0('0xa'));var squel=require(_0x8af0('0xb'));var crypto=require(_0x8af0('0xc'));var jsforce=require(_0x8af0('0xd'));var deskjs=require(_0x8af0('0xe'));var toCsv=require(_0x8af0('0x8'));var querystring=require(_0x8af0('0xf'));var Papa=require(_0x8af0('0x10'));var Redis=require(_0x8af0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8af0('0x12'));var as=require(_0x8af0('0x13'));var hardwareService=require(_0x8af0('0x14'));var logger=require('../../config/logger')(_0x8af0('0x15'));var utils=require(_0x8af0('0x16'));var config=require(_0x8af0('0x17'));var licenseUtil=require(_0x8af0('0x18'));var db=require(_0x8af0('0x19'))['db'];config[_0x8af0('0x1a')]=_[_0x8af0('0x1b')](config[_0x8af0('0x1a')],{'host':_0x8af0('0x1c'),'port':0x18eb});var socket=require(_0x8af0('0x1d'))(new Redis(config['redis']));require(_0x8af0('0x1e'))[_0x8af0('0x1f')](socket);var jayson=require(_0x8af0('0x20'));var client=jayson[_0x8af0('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4c5a88,_0x571204,_0x4978af,_0x31d561){return new BPromise(function(_0x4a65c9,_0x5a73b7){var _0x1b45fe=_0x31d561||client;return _0x1b45fe[_0x8af0('0x22')](_0x4c5a88,_0x4978af)[_0x8af0('0x23')](function(_0x45449e){logger[_0x8af0('0x24')](_0x8af0('0x25'),_0x571204,_0x8af0('0x26'));logger[_0x8af0('0x27')](_0x8af0('0x28'),_0x571204,_0x8af0('0x26'),JSON[_0x8af0('0x29')](_0x45449e));if(_0x45449e[_0x8af0('0x2a')]){if(_0x45449e[_0x8af0('0x2a')][_0x8af0('0x2b')]===0x1f4){logger[_0x8af0('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x571204,_0x45449e[_0x8af0('0x2a')][_0x8af0('0x2c')]);return _0x5a73b7(_0x45449e[_0x8af0('0x2a')][_0x8af0('0x2c')]);}logger[_0x8af0('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x571204,_0x45449e[_0x8af0('0x2a')][_0x8af0('0x2c')]);return _0x4a65c9(_0x45449e[_0x8af0('0x2a')]['message']);}else{logger[_0x8af0('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x571204,'request\x20sent');_0x4a65c9(_0x45449e[_0x8af0('0x2d')][_0x8af0('0x2c')]);}})['catch'](function(_0x2522a1){logger[_0x8af0('0x2a')](_0x8af0('0x25'),_0x571204,_0x2522a1);_0x5a73b7(_0x2522a1);});});}function respondWithStatusCode(_0x531058,_0x328667){_0x328667=_0x328667||0xcc;return function(_0x3ac5be){if(_0x3ac5be){return _0x531058[_0x8af0('0x2e')](_0x328667);}return _0x531058[_0x8af0('0x2f')](_0x328667)[_0x8af0('0x30')]();};}function respondWithResult(_0x559e2e,_0x3f8a71){_0x3f8a71=_0x3f8a71||0xc8;return function(_0x36a5af){if(_0x36a5af){return _0x559e2e['status'](_0x3f8a71)['json'](_0x36a5af);}};}function respondWithFilteredResult(_0x5cfe35,_0x261406){return function(_0x4f7b9a){if(_0x4f7b9a){var _0x5a4c57=typeof _0x261406[_0x8af0('0x31')]===_0x8af0('0x32')&&typeof _0x261406['limit']===_0x8af0('0x32');var _0x2489f9=_0x4f7b9a[_0x8af0('0x33')];var _0x54a331=_0x5a4c57?0x0:_0x261406[_0x8af0('0x31')];var _0xe6027b=_0x5a4c57?_0x4f7b9a['count']:_0x261406['offset']+_0x261406[_0x8af0('0x34')];var _0x38948c;if(_0xe6027b>=_0x2489f9){_0xe6027b=_0x2489f9;_0x38948c=0xc8;}else{_0x38948c=0xce;}_0x5cfe35['status'](_0x38948c);return _0x5cfe35[_0x8af0('0x35')](_0x8af0('0x36'),_0x54a331+'-'+_0xe6027b+'/'+_0x2489f9)[_0x8af0('0x37')](_0x4f7b9a);}return null;};}function patchUpdates(_0x2b9ca8){return function(_0x509124){try{jsonpatch[_0x8af0('0x38')](_0x509124,_0x2b9ca8,!![]);}catch(_0x10d32d){return BPromise[_0x8af0('0x39')](_0x10d32d);}return _0x509124[_0x8af0('0x3a')]();};}function saveUpdates(_0xc34f12,_0x346730){return function(_0x3ab803){if(_0x3ab803){return _0x3ab803['update'](_0xc34f12)[_0x8af0('0x23')](function(_0x35cef0){return _0x35cef0;});}return null;};}function removeEntity(_0x3e8e02,_0x2135dd){return function(_0x40109f){if(_0x40109f){return _0x40109f[_0x8af0('0x3b')]()['then'](function(){var _0x19d1de=_0x40109f[_0x8af0('0x3c')]({'plain':!![]});var _0x1e3008=_0x8af0('0x3d');return db[_0x8af0('0x3e')]['destroy']({'where':{'type':_0x1e3008,'resourceId':_0x19d1de['id']}})[_0x8af0('0x23')](function(){return _0x40109f;});})[_0x8af0('0x23')](function(){_0x3e8e02['status'](0xcc)[_0x8af0('0x30')]();});}};}function handleEntityNotFound(_0x5570a1,_0x14a2cc){return function(_0x62be8b){if(!_0x62be8b){_0x5570a1[_0x8af0('0x2e')](0x194);}return _0x62be8b;};}function handleError(_0x2c78a0,_0x7af838){_0x7af838=_0x7af838||0x1f4;return function(_0x332372){logger[_0x8af0('0x2a')](_0x332372['stack']);if(_0x332372['name']){delete _0x332372[_0x8af0('0x3f')];}_0x2c78a0[_0x8af0('0x2f')](_0x7af838)['send'](_0x332372);};}exports[_0x8af0('0x40')]=function(_0x53409d,_0x57aa47){var _0x3d4305={'include':[{'model':db[_0x8af0('0x41')],'as':_0x8af0('0x42')}]},_0x14156b={},_0x281ee6={'count':0x0,'rows':[]};var _0x411f56=_[_0x8af0('0x43')](db[_0x8af0('0x44')][_0x8af0('0x45')],function(_0x2676b5){return{'name':_0x2676b5[_0x8af0('0x46')],'type':_0x2676b5['type']['key']};});_0x14156b[_0x8af0('0x47')]=_[_0x8af0('0x43')](_0x411f56,'name');_0x14156b['query']=_[_0x8af0('0x48')](_0x53409d[_0x8af0('0x49')]);_0x14156b[_0x8af0('0x4a')]=_[_0x8af0('0x4b')](_0x14156b[_0x8af0('0x47')],_0x14156b[_0x8af0('0x49')]);_0x3d4305['attributes']=_[_0x8af0('0x4b')](_0x14156b['model'],qs[_0x8af0('0x4c')](_0x53409d[_0x8af0('0x49')][_0x8af0('0x4c')]));_0x3d4305['attributes']=_0x3d4305['attributes']['length']?_0x3d4305[_0x8af0('0x4d')]:_0x14156b['model'];if(!_0x53409d[_0x8af0('0x49')]['hasOwnProperty'](_0x8af0('0x4e'))){_0x3d4305[_0x8af0('0x34')]=qs[_0x8af0('0x34')](_0x53409d[_0x8af0('0x49')][_0x8af0('0x34')]);_0x3d4305[_0x8af0('0x31')]=qs['offset'](_0x53409d[_0x8af0('0x49')][_0x8af0('0x31')]);}_0x3d4305[_0x8af0('0x4f')]=qs['sort'](_0x53409d[_0x8af0('0x49')][_0x8af0('0x50')]);_0x3d4305['where']=qs[_0x8af0('0x4a')](_[_0x8af0('0x51')](_0x53409d[_0x8af0('0x49')],_0x14156b[_0x8af0('0x4a')]),_0x411f56);if(_0x53409d[_0x8af0('0x49')][_0x8af0('0x52')]){_0x3d4305[_0x8af0('0x53')]=_[_0x8af0('0x54')](_0x3d4305[_0x8af0('0x53')],{'$or':_[_0x8af0('0x43')](_0x411f56,function(_0x13c310){if(_0x13c310[_0x8af0('0x55')]!==_0x8af0('0x56')){var _0x25401d={};_0x25401d[_0x13c310[_0x8af0('0x3f')]]={'$like':'%'+_0x53409d[_0x8af0('0x49')][_0x8af0('0x52')]+'%'};return _0x25401d;}})});}_0x3d4305=_[_0x8af0('0x54')]({},_0x3d4305,_0x53409d[_0x8af0('0x57')]);var _0x5539ad={'where':_0x3d4305[_0x8af0('0x53')]};return db[_0x8af0('0x44')][_0x8af0('0x33')](_0x5539ad)['then'](function(_0x1070a2){_0x281ee6[_0x8af0('0x33')]=_0x1070a2;if(_0x53409d['query'][_0x8af0('0x58')]){_0x3d4305[_0x8af0('0x59')]=[{'all':!![]}];}return db[_0x8af0('0x44')]['findAll'](_0x3d4305);})[_0x8af0('0x23')](function(_0x2d9a98){_0x281ee6[_0x8af0('0x5a')]=_0x2d9a98;return _0x281ee6;})['then'](respondWithFilteredResult(_0x57aa47,_0x3d4305))['catch'](handleError(_0x57aa47,null));};exports['show']=function(_0x94c1a7,_0x3f0a3d){var _0x10c147={'raw':![],'where':{'id':_0x94c1a7['params']['id']},'include':[{'model':db[_0x8af0('0x41')],'as':'mandatoryDispositionPause'}]},_0x4aea31={};_0x4aea31['model']=_[_0x8af0('0x48')](db[_0x8af0('0x44')]['rawAttributes']);_0x4aea31[_0x8af0('0x49')]=_[_0x8af0('0x48')](_0x94c1a7['query']);_0x4aea31[_0x8af0('0x4a')]=_[_0x8af0('0x4b')](_0x4aea31[_0x8af0('0x47')],_0x4aea31['query']);_0x10c147[_0x8af0('0x4d')]=_['intersection'](_0x4aea31['model'],qs[_0x8af0('0x4c')](_0x94c1a7[_0x8af0('0x49')][_0x8af0('0x4c')]));_0x10c147[_0x8af0('0x4d')]=_0x10c147[_0x8af0('0x4d')]['length']?_0x10c147['attributes']:_0x4aea31[_0x8af0('0x47')];if(_0x94c1a7[_0x8af0('0x49')][_0x8af0('0x58')]){_0x10c147[_0x8af0('0x59')]=[{'all':!![]}];}_0x10c147=_[_0x8af0('0x54')]({},_0x10c147,_0x94c1a7['options']);return db[_0x8af0('0x44')][_0x8af0('0x5b')](_0x10c147)[_0x8af0('0x23')](handleEntityNotFound(_0x3f0a3d,null))[_0x8af0('0x23')](respondWithResult(_0x3f0a3d,null))[_0x8af0('0x5c')](handleError(_0x3f0a3d,null));};exports['create']=function(_0x3cba03,_0x19f4ca){return db[_0x8af0('0x44')][_0x8af0('0x5d')](_0x3cba03[_0x8af0('0x5e')],{})['then'](function(_0x559b5f){var _0xa930cd=_0x3cba03[_0x8af0('0x5f')][_0x8af0('0x3c')]({'plain':!![]});if(!_0xa930cd)throw new Error(_0x8af0('0x60'));if(_0xa930cd[_0x8af0('0x61')]===_0x8af0('0x5f')){var _0x46688f=_0x559b5f['get']({'plain':!![]});var _0x5a1d2f='WhatsappAccounts';return db[_0x8af0('0x62')][_0x8af0('0x5b')]({'where':{'name':_0x5a1d2f,'userProfileId':_0xa930cd['userProfileId']},'raw':!![]})['then'](function(_0x5006b9){if(_0x5006b9&&_0x5006b9['autoAssociation']===0x0){return db[_0x8af0('0x3e')][_0x8af0('0x5d')]({'name':_0x46688f[_0x8af0('0x3f')],'resourceId':_0x46688f['id'],'type':_0x5006b9[_0x8af0('0x3f')],'sectionId':_0x5006b9['id']},{})[_0x8af0('0x23')](function(){return _0x559b5f;});}else{return _0x559b5f;}})[_0x8af0('0x5c')](function(_0x5d1250){logger[_0x8af0('0x2a')](_0x8af0('0x63'),_0x5d1250);throw _0x5d1250;});}return _0x559b5f;})['then'](respondWithResult(_0x19f4ca,0xc9))[_0x8af0('0x5c')](handleError(_0x19f4ca,null));};exports['update']=function(_0x5d1427,_0x42770f){if(_0x5d1427[_0x8af0('0x5e')]['id']){delete _0x5d1427[_0x8af0('0x5e')]['id'];}return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x5d1427[_0x8af0('0x64')]['id']},'include':[{'model':db[_0x8af0('0x41')],'as':_0x8af0('0x42')}]})[_0x8af0('0x23')](handleEntityNotFound(_0x42770f,null))[_0x8af0('0x23')](saveUpdates(_0x5d1427[_0x8af0('0x5e')],null))[_0x8af0('0x23')](respondWithResult(_0x42770f,null))[_0x8af0('0x5c')](handleError(_0x42770f,null));};exports['destroy']=function(_0x40d269,_0x2826bc){return db['WhatsappAccount']['find']({'where':{'id':_0x40d269[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x2826bc,null))[_0x8af0('0x23')](removeEntity(_0x2826bc,null))['catch'](handleError(_0x2826bc,null));};exports[_0x8af0('0x65')]=function(_0x47fd87,_0x2789ac){return db[_0x8af0('0x44')][_0x8af0('0x65')]()['then'](respondWithResult(_0x2789ac,null))[_0x8af0('0x5c')](handleError(_0x2789ac,null));};exports[_0x8af0('0x66')]=function(_0x5c7fca,_0x2dd554,_0x240838){if(_0x5c7fca[_0x8af0('0x5e')]['id']){delete _0x5c7fca[_0x8af0('0x5e')]['id'];}return db['WhatsappAccount'][_0x8af0('0x5b')]({'where':{'id':_0x5c7fca[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x2dd554,null))[_0x8af0('0x23')](function(_0xb3aaa2){if(_0xb3aaa2){_0x5c7fca[_0x8af0('0x5e')][_0x8af0('0x67')]=_0xb3aaa2['id'];return db[_0x8af0('0x68')][_0x8af0('0x5d')](_0x5c7fca['body']);}})[_0x8af0('0x23')](respondWithResult(_0x2dd554,null))[_0x8af0('0x5c')](handleError(_0x2dd554,null));};exports['getDispositions']=function(_0xb10f15,_0x50ac09,_0x923957){var _0x2ce3c7={'raw':![],'where':{}};var _0x18c597={};var _0x4ce5c6={'count':0x0,'rows':[]};return db[_0x8af0('0x44')][_0x8af0('0x69')]({'where':{'id':_0xb10f15[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x50ac09,null))[_0x8af0('0x23')](function(_0x5ba0d9){if(_0x5ba0d9){_0x18c597[_0x8af0('0x47')]=_[_0x8af0('0x48')](db['Disposition'][_0x8af0('0x45')]);_0x18c597['query']=_[_0x8af0('0x48')](_0xb10f15[_0x8af0('0x49')]);_0x18c597[_0x8af0('0x4a')]=_[_0x8af0('0x4b')](_0x18c597[_0x8af0('0x47')],_0x18c597[_0x8af0('0x49')]);_0x2ce3c7[_0x8af0('0x4d')]=_[_0x8af0('0x4b')](_0x18c597[_0x8af0('0x47')],qs[_0x8af0('0x4c')](_0xb10f15['query'][_0x8af0('0x4c')]));_0x2ce3c7[_0x8af0('0x4d')]=_0x2ce3c7[_0x8af0('0x4d')][_0x8af0('0x6a')]?_0x2ce3c7[_0x8af0('0x4d')]:_0x18c597[_0x8af0('0x47')];if(!_0xb10f15[_0x8af0('0x49')][_0x8af0('0x6b')](_0x8af0('0x4e'))){_0x2ce3c7[_0x8af0('0x34')]=qs['limit'](_0xb10f15[_0x8af0('0x49')][_0x8af0('0x34')]);_0x2ce3c7[_0x8af0('0x31')]=qs[_0x8af0('0x31')](_0xb10f15[_0x8af0('0x49')][_0x8af0('0x31')]);}_0x2ce3c7[_0x8af0('0x4f')]=qs[_0x8af0('0x50')](_0xb10f15[_0x8af0('0x49')][_0x8af0('0x50')]);_0x2ce3c7[_0x8af0('0x53')]=qs[_0x8af0('0x4a')](_['pick'](_0xb10f15[_0x8af0('0x49')],_0x18c597['filters']));_0x2ce3c7['where'][_0x8af0('0x67')]=_0x5ba0d9['id'];if(_0xb10f15[_0x8af0('0x49')][_0x8af0('0x52')]){_0x2ce3c7[_0x8af0('0x53')]=_[_0x8af0('0x54')](_0x2ce3c7['where'],{'$or':_[_0x8af0('0x43')](_0x2ce3c7[_0x8af0('0x4d')],function(_0x1d1626){var _0x110b98={};_0x110b98[_0x1d1626]={'$like':'%'+_0xb10f15['query'][_0x8af0('0x52')]+'%'};return _0x110b98;})});}_0x2ce3c7=_[_0x8af0('0x54')]({},_0x2ce3c7,_0xb10f15['options']);return db[_0x8af0('0x68')]['count']({'where':_0x2ce3c7[_0x8af0('0x53')]})[_0x8af0('0x23')](function(_0x657da2){_0x4ce5c6[_0x8af0('0x33')]=_0x657da2;if(_0xb10f15[_0x8af0('0x49')][_0x8af0('0x58')]){_0x2ce3c7[_0x8af0('0x59')]=[{'all':!![]}];}return db[_0x8af0('0x68')][_0x8af0('0x6c')](_0x2ce3c7);})[_0x8af0('0x23')](function(_0x5109f3){_0x4ce5c6[_0x8af0('0x5a')]=_0x5109f3;return _0x4ce5c6;});}})['then'](respondWithFilteredResult(_0x50ac09,_0x2ce3c7))[_0x8af0('0x5c')](handleError(_0x50ac09,null));};exports['removeDispositions']=function(_0x3588eb,_0x4c5e3d,_0x451fdf){return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x3588eb[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x4c5e3d,null))[_0x8af0('0x23')](function(_0x24c24a){if(_0x24c24a){return _0x24c24a[_0x8af0('0x6d')](_0x3588eb[_0x8af0('0x49')][_0x8af0('0x6e')]);}})[_0x8af0('0x23')](respondWithStatusCode(_0x4c5e3d,null))[_0x8af0('0x5c')](handleError(_0x4c5e3d,null));};exports[_0x8af0('0x6f')]=function(_0x479043,_0x1e1269,_0x2fdd08){if(_0x479043[_0x8af0('0x5e')]['id']){delete _0x479043['body']['id'];}return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x479043['params']['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x1e1269,null))[_0x8af0('0x23')](function(_0x351404){if(_0x351404){_0x479043[_0x8af0('0x5e')][_0x8af0('0x67')]=_0x351404['id'];return db[_0x8af0('0x70')]['create'](_0x479043[_0x8af0('0x5e')]);}})[_0x8af0('0x23')](respondWithResult(_0x1e1269,null))[_0x8af0('0x5c')](handleError(_0x1e1269,null));};exports[_0x8af0('0x71')]=function(_0x410443,_0x280c14,_0x59000f){var _0x6a2d7c={'raw':![],'where':{}};var _0x4c00a={};var _0x138557={'count':0x0,'rows':[]};return db[_0x8af0('0x44')]['findOne']({'where':{'id':_0x410443['params']['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x280c14,null))['then'](function(_0x51a245){if(_0x51a245){_0x4c00a[_0x8af0('0x47')]=_[_0x8af0('0x48')](db[_0x8af0('0x70')][_0x8af0('0x45')]);_0x4c00a['query']=_['keys'](_0x410443['query']);_0x4c00a[_0x8af0('0x4a')]=_[_0x8af0('0x4b')](_0x4c00a['model'],_0x4c00a[_0x8af0('0x49')]);_0x6a2d7c[_0x8af0('0x4d')]=_['intersection'](_0x4c00a[_0x8af0('0x47')],qs[_0x8af0('0x4c')](_0x410443[_0x8af0('0x49')][_0x8af0('0x4c')]));_0x6a2d7c[_0x8af0('0x4d')]=_0x6a2d7c[_0x8af0('0x4d')]['length']?_0x6a2d7c[_0x8af0('0x4d')]:_0x4c00a[_0x8af0('0x47')];if(!_0x410443[_0x8af0('0x49')][_0x8af0('0x6b')](_0x8af0('0x4e'))){_0x6a2d7c[_0x8af0('0x34')]=qs['limit'](_0x410443['query'][_0x8af0('0x34')]);_0x6a2d7c[_0x8af0('0x31')]=qs[_0x8af0('0x31')](_0x410443[_0x8af0('0x49')][_0x8af0('0x31')]);}_0x6a2d7c['order']=qs[_0x8af0('0x50')](_0x410443[_0x8af0('0x49')][_0x8af0('0x50')]);_0x6a2d7c[_0x8af0('0x53')]=qs[_0x8af0('0x4a')](_[_0x8af0('0x51')](_0x410443['query'],_0x4c00a[_0x8af0('0x4a')]));_0x6a2d7c[_0x8af0('0x53')][_0x8af0('0x67')]=_0x51a245['id'];if(_0x410443[_0x8af0('0x49')][_0x8af0('0x52')]){_0x6a2d7c['where']=_[_0x8af0('0x54')](_0x6a2d7c['where'],{'$or':_[_0x8af0('0x43')](_0x6a2d7c[_0x8af0('0x4d')],function(_0x10ddc8){var _0x1e4ea3={};_0x1e4ea3[_0x10ddc8]={'$like':'%'+_0x410443['query'][_0x8af0('0x52')]+'%'};return _0x1e4ea3;})});}_0x6a2d7c=_[_0x8af0('0x54')]({},_0x6a2d7c,_0x410443[_0x8af0('0x57')]);return db[_0x8af0('0x70')]['count']({'where':_0x6a2d7c['where']})[_0x8af0('0x23')](function(_0x2ce725){_0x138557[_0x8af0('0x33')]=_0x2ce725;if(_0x410443['query'][_0x8af0('0x58')]){_0x6a2d7c[_0x8af0('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x6a2d7c);})['then'](function(_0x89caa0){_0x138557[_0x8af0('0x5a')]=_0x89caa0;return _0x138557;});}})[_0x8af0('0x23')](respondWithFilteredResult(_0x280c14,_0x6a2d7c))['catch'](handleError(_0x280c14,null));};exports[_0x8af0('0x72')]=function(_0x3b5ef2,_0x15aa30,_0x592804){return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x3b5ef2[_0x8af0('0x64')]['id']}})['then'](handleEntityNotFound(_0x15aa30,null))[_0x8af0('0x23')](function(_0x419ed8){if(_0x419ed8){return _0x419ed8[_0x8af0('0x72')](_0x3b5ef2['query'][_0x8af0('0x6e')]);}})[_0x8af0('0x23')](respondWithStatusCode(_0x15aa30,null))[_0x8af0('0x5c')](handleError(_0x15aa30,null));};exports[_0x8af0('0x73')]=function(_0x395906,_0xe6a3fb,_0x3c7ba6){return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x395906[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0xe6a3fb,null))[_0x8af0('0x23')](function(_0x612899){if(_0x612899){return _0x612899['addAgents'](_0x395906[_0x8af0('0x5e')][_0x8af0('0x6e')],_[_0x8af0('0x74')](_0x395906[_0x8af0('0x5e')],[_0x8af0('0x6e'),'id'])||{})[_0x8af0('0x75')](function(_0x4475e7){for(var _0x20e542=0x0;_0x20e542<_0x395906[_0x8af0('0x5e')][_0x8af0('0x6e')][_0x8af0('0x6a')];_0x20e542+=0x1){socket[_0x8af0('0x76')]('userWhatsappAccount:save',{'UserId':Number(_0x395906[_0x8af0('0x5e')][_0x8af0('0x6e')][_0x20e542]),'WhatsappAccountId':Number(_0x395906[_0x8af0('0x64')]['id'])});}return _0x4475e7;});}})[_0x8af0('0x23')](respondWithResult(_0xe6a3fb,null))[_0x8af0('0x5c')](handleError(_0xe6a3fb,null));};exports['removeAgents']=function(_0x252f5b,_0x2ac3e4,_0x4bbd1e){return db['WhatsappAccount'][_0x8af0('0x5b')]({'where':{'id':_0x252f5b[_0x8af0('0x64')]['id']}})['then'](handleEntityNotFound(_0x2ac3e4,null))[_0x8af0('0x23')](function(_0x127351){if(_0x127351){return _0x127351[_0x8af0('0x77')](_0x252f5b[_0x8af0('0x49')][_0x8af0('0x6e')])[_0x8af0('0x23')](function(){if(_[_0x8af0('0x78')](_0x252f5b[_0x8af0('0x49')][_0x8af0('0x6e')])){for(var _0x1b5e60=0x0;_0x1b5e60<_0x252f5b['query'][_0x8af0('0x6e')]['length'];_0x1b5e60+=0x1){socket[_0x8af0('0x76')](_0x8af0('0x79'),{'UserId':Number(_0x252f5b[_0x8af0('0x49')][_0x8af0('0x6e')][_0x1b5e60]),'WhatsappAccountId':Number(_0x252f5b[_0x8af0('0x64')]['id'])});}}else{socket[_0x8af0('0x76')](_0x8af0('0x79'),{'UserId':Number(_0x252f5b['query'][_0x8af0('0x6e')]),'WhatsappAccountId':Number(_0x252f5b[_0x8af0('0x64')]['id'])});}});}})[_0x8af0('0x23')](respondWithStatusCode(_0x2ac3e4,null))[_0x8af0('0x5c')](handleError(_0x2ac3e4,null));};exports[_0x8af0('0x7a')]=function(_0x1bb22d,_0x251f7a,_0x24516e){var _0x476745={};var _0x314fbe={};var _0x14df13;var _0x51c280;return db[_0x8af0('0x44')][_0x8af0('0x69')]({'where':{'id':_0x1bb22d[_0x8af0('0x64')]['id']}})['then'](handleEntityNotFound(_0x251f7a,null))[_0x8af0('0x23')](function(_0x59b080){if(_0x59b080){_0x14df13=_0x59b080;_0x314fbe['model']=_[_0x8af0('0x48')](db['User'][_0x8af0('0x45')]);_0x314fbe['query']=_[_0x8af0('0x48')](_0x1bb22d[_0x8af0('0x49')]);_0x314fbe['filters']=_[_0x8af0('0x4b')](_0x314fbe[_0x8af0('0x47')],_0x314fbe[_0x8af0('0x49')]);_0x476745['attributes']=_[_0x8af0('0x4b')](_0x314fbe['model'],qs[_0x8af0('0x4c')](_0x1bb22d[_0x8af0('0x49')][_0x8af0('0x4c')]));_0x476745[_0x8af0('0x4d')]=_0x476745[_0x8af0('0x4d')]['length']?_0x476745[_0x8af0('0x4d')]:_0x314fbe[_0x8af0('0x47')];_0x476745[_0x8af0('0x4f')]=qs[_0x8af0('0x50')](_0x1bb22d['query'][_0x8af0('0x50')]);_0x476745['where']=qs[_0x8af0('0x4a')](_[_0x8af0('0x51')](_0x1bb22d[_0x8af0('0x49')],_0x314fbe[_0x8af0('0x4a')]));if(_0x1bb22d[_0x8af0('0x49')][_0x8af0('0x52')]){_0x476745['where']=_[_0x8af0('0x54')](_0x476745[_0x8af0('0x53')],{'$or':_[_0x8af0('0x43')](_0x476745[_0x8af0('0x4d')],function(_0x37eff9){var _0xebb91={};_0xebb91[_0x37eff9]={'$like':'%'+_0x1bb22d[_0x8af0('0x49')]['filter']+'%'};return _0xebb91;})});}_0x476745=_['merge']({},_0x476745,_0x1bb22d[_0x8af0('0x57')]);return _0x14df13[_0x8af0('0x7a')](_0x476745);}})[_0x8af0('0x23')](function(_0x2ce3cc){if(_0x2ce3cc){_0x51c280=_0x2ce3cc[_0x8af0('0x6a')];if(!_0x1bb22d[_0x8af0('0x49')]['hasOwnProperty'](_0x8af0('0x4e'))){_0x476745[_0x8af0('0x34')]=qs['limit'](_0x1bb22d[_0x8af0('0x49')][_0x8af0('0x34')]);_0x476745[_0x8af0('0x31')]=qs[_0x8af0('0x31')](_0x1bb22d[_0x8af0('0x49')][_0x8af0('0x31')]);}return _0x14df13['getAgents'](_0x476745);}})[_0x8af0('0x23')](function(_0xd30e9b){if(_0xd30e9b){return _0xd30e9b?{'count':_0x51c280,'rows':_0xd30e9b}:null;}})[_0x8af0('0x23')](respondWithResult(_0x251f7a,null))['catch'](handleError(_0x251f7a,null));};exports[_0x8af0('0x7b')]=function(_0x5a1dba,_0x290340){var _0x36fe07=_0x5a1dba['params']['id'];var _0x53b4ac=_0x5a1dba['body'];var _0x588556=0xc8;var _0x44dad2=null;return db[_0x8af0('0x7c')]['transaction']({'isolationLevel':db[_0x8af0('0x7c')][_0x8af0('0x7d')][_0x8af0('0x7e')]['READ_COMMITTED']},function(_0x3034da){return db[_0x8af0('0x44')][_0x8af0('0x69')]({'where':{'id':_0x36fe07},'transaction':_0x3034da})[_0x8af0('0x23')](function(_0x477bfa){if(_0x477bfa){return db['WhatsappApplication'][_0x8af0('0x3b')]({'where':{'WhatsappAccountId':_0x36fe07},'transaction':_0x3034da})[_0x8af0('0x23')](function(){var _0x1644ac=_[_0x8af0('0x43')](_0x53b4ac,function(_0x4c3095){_0x4c3095['WhatsappAccountId']=_0x36fe07;return _0x4c3095;});return db[_0x8af0('0x7f')]['bulkCreate'](_0x1644ac,{'transaction':_0x3034da});});}else{_0x588556=0x194;_0x44dad2=[];}});})['then'](function(){if(_0x588556!==0x194){return db[_0x8af0('0x7f')][_0x8af0('0x80')]({'where':{'WhatsappAccountId':_0x36fe07},'order':_0x8af0('0x81')})['then'](function(_0x2e3dfa){_0x44dad2=_0x2e3dfa;});}})[_0x8af0('0x5c')](function(_0x416260){_0x588556=0x1f4;logger[_0x8af0('0x2a')](_0x416260[_0x8af0('0x82')]);if(_0x416260[_0x8af0('0x3f')]){delete _0x416260[_0x8af0('0x3f')];}_0x44dad2=_0x416260;})[_0x8af0('0x83')](function(){if(_0x44dad2===null){_0x290340[_0x8af0('0x2e')](_0x588556);}else{if(_0x588556===0x1f4){_0x290340[_0x8af0('0x2f')](_0x588556)[_0x8af0('0x84')](_0x44dad2);}else{_0x290340[_0x8af0('0x2f')](_0x588556)[_0x8af0('0x37')](_0x44dad2);}}});};exports[_0x8af0('0x85')]=function(_0x878aef,_0x5143bb,_0x33fa4a){var _0x2c3c38={};var _0xe9c9ce={};var _0x1fec25;var _0x33d256;return db[_0x8af0('0x44')][_0x8af0('0x69')]({'where':{'id':_0x878aef[_0x8af0('0x64')]['id']}})[_0x8af0('0x23')](handleEntityNotFound(_0x5143bb,null))[_0x8af0('0x23')](function(_0x5343bf){if(_0x5343bf){_0x1fec25=_0x5343bf;_0xe9c9ce[_0x8af0('0x47')]=_[_0x8af0('0x48')](db[_0x8af0('0x7f')][_0x8af0('0x45')]);_0xe9c9ce[_0x8af0('0x49')]=_['keys'](_0x878aef[_0x8af0('0x49')]);_0xe9c9ce[_0x8af0('0x4a')]=_[_0x8af0('0x4b')](_0xe9c9ce[_0x8af0('0x47')],_0xe9c9ce[_0x8af0('0x49')]);_0x2c3c38['attributes']=_[_0x8af0('0x4b')](_0xe9c9ce[_0x8af0('0x47')],qs[_0x8af0('0x4c')](_0x878aef[_0x8af0('0x49')]['fields']));_0x2c3c38[_0x8af0('0x4d')]=_0x2c3c38['attributes'][_0x8af0('0x6a')]?_0x2c3c38[_0x8af0('0x4d')]:_0xe9c9ce['model'];_0x2c3c38['order']=qs[_0x8af0('0x50')](_0x878aef[_0x8af0('0x49')][_0x8af0('0x50')]);_0x2c3c38[_0x8af0('0x53')]=qs['filters'](_['pick'](_0x878aef[_0x8af0('0x49')],_0xe9c9ce[_0x8af0('0x4a')]));if(_0x878aef[_0x8af0('0x49')][_0x8af0('0x52')]){_0x2c3c38[_0x8af0('0x53')]=_[_0x8af0('0x54')](_0x2c3c38[_0x8af0('0x53')],{'$or':_['map'](_0x2c3c38[_0x8af0('0x4d')],function(_0x4ddbcc){var _0x4886d3={};_0x4886d3[_0x4ddbcc]={'$like':'%'+_0x878aef[_0x8af0('0x49')][_0x8af0('0x52')]+'%'};return _0x4886d3;})});}_0x2c3c38=_[_0x8af0('0x54')]({},_0x2c3c38,_0x878aef[_0x8af0('0x57')]);return _0x1fec25[_0x8af0('0x85')](_0x2c3c38);}})[_0x8af0('0x23')](function(_0x5e4df7){if(_0x5e4df7){_0x33d256=_0x5e4df7['length'];if(!_0x878aef['query']['hasOwnProperty']('nolimit')){_0x2c3c38[_0x8af0('0x34')]=qs[_0x8af0('0x34')](_0x878aef[_0x8af0('0x49')][_0x8af0('0x34')]);_0x2c3c38[_0x8af0('0x31')]=qs[_0x8af0('0x31')](_0x878aef[_0x8af0('0x49')][_0x8af0('0x31')]);}return _0x1fec25[_0x8af0('0x85')](_0x2c3c38);}})['then'](function(_0x179c86){if(_0x179c86){return _0x179c86?{'count':_0x33d256,'rows':_0x179c86}:null;}})[_0x8af0('0x23')](respondWithResult(_0x5143bb,null))['catch'](handleError(_0x5143bb,null));};exports[_0x8af0('0x86')]=function(_0x44cb6a,_0x50ac11,_0x2fc107){var _0x413091={'channel':'whatsapp'};var _0x390fed=[];var _0x36041b=[];var _0x5964c8={};return db['WhatsappAccount'][_0x8af0('0x5b')]({'where':{'id':_0x44cb6a['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x8af0('0x87')}]})[_0x8af0('0x23')](handleEntityNotFound(_0x50ac11,null))[_0x8af0('0x23')](function(_0x2e6f29){_0x413091[_0x8af0('0x88')]=_0x2e6f29;if(_0x413091[_0x8af0('0x88')]&&_0x413091[_0x8af0('0x88')][_0x8af0('0x55')]===_0x8af0('0x89')&&_0x44cb6a[_0x8af0('0x5e')][_0x8af0('0x8a')]){if(_0x44cb6a[_0x8af0('0x5e')][_0x8af0('0x8a')]['length']===0x0)return;if(_0x44cb6a[_0x8af0('0x5e')][_0x8af0('0x8a')][0x0][_0x8af0('0x8b')]!==_0x8af0('0x8c'))return;return db[_0x8af0('0x8d')][_0x8af0('0x8e')]({'read':!![],'readAt':_0x44cb6a[_0x8af0('0x5e')][_0x8af0('0x8a')][0x0][_0x8af0('0x8f')]},{'where':{'messageId':_0x44cb6a['body'][_0x8af0('0x8a')][0x0][_0x8af0('0x90')]},'individualHooks':!![]})[_0x8af0('0x23')](function(_0x1ee78b){return _0x50ac11[_0x8af0('0x2f')](0xc8)[_0x8af0('0x37')](_0x1ee78b);});}_0x413091[_0x8af0('0x91')]=_['orderBy'](_0x2e6f29[_0x8af0('0x87')],[_0x8af0('0x81')],[_0x8af0('0x92')]);if(_0x413091[_0x8af0('0x88')][_0x8af0('0x87')]){delete _0x413091[_0x8af0('0x88')][_0x8af0('0x87')];}return db['CmContact'][_0x8af0('0x65')]()[_0x8af0('0x23')](function(_0x310271){if(!_0x310271){throw new db['Sequelize'][(_0x8af0('0x93'))](_0x8af0('0x94'));}_0x390fed=_['difference'](_['keys'](_0x310271),[_0x8af0('0x95'),_0x8af0('0x96')]);_0x36041b=_[_0x8af0('0x97')](_[_0x8af0('0x48')](_0x310271),[_0x8af0('0x95'),'updatedAt',_0x8af0('0x98'),_0x8af0('0x99')]);_0x413091[_0x8af0('0x5e')]={'mapKey':_0x8af0('0x9a')};if(_0x413091['account']&&_0x413091[_0x8af0('0x88')][_0x8af0('0x55')]===_0x8af0('0x9b')){_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')]=_0x44cb6a[_0x8af0('0x5e')]['From'][_0x8af0('0x9d')](_0x8af0('0x9e'),'');_0x413091[_0x8af0('0x5e')][_0x8af0('0x5e')]=_0x44cb6a['body'][_0x8af0('0x9f')];_0x413091['body'][_0x8af0('0xa0')]=_0x44cb6a['body'][_0x8af0('0xa1')];}if(_0x413091[_0x8af0('0x88')]&&_0x413091[_0x8af0('0x88')]['type']===_0x8af0('0x89')){_0x413091['body'][_0x8af0('0x9c')]=_0x44cb6a['body'][_0x8af0('0xa2')][0x0][_0x8af0('0x9c')];_0x413091[_0x8af0('0x5e')][_0x8af0('0x5e')]=_0x44cb6a['body'][_0x8af0('0xa2')][0x0][_0x8af0('0x2c')][_0x8af0('0x5e')];_0x413091[_0x8af0('0x5e')][_0x8af0('0xa0')]=_0x44cb6a['body'][_0x8af0('0xa2')][0x0][_0x8af0('0x90')];}if(_0x413091[_0x8af0('0x5e')]['id']){delete _0x413091[_0x8af0('0x5e')]['id'];}if(_[_0x8af0('0xa3')](_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')])){throw new db[(_0x8af0('0xa4'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x413091[_0x8af0('0x5e')][_0x8af0('0x5e')])||_0x413091[_0x8af0('0x5e')][_0x8af0('0x5e')]===''){throw new db[(_0x8af0('0xa4'))]['ValidationError'](_0x8af0('0xa5'));}if(_[_0x8af0('0xa3')](_0x413091[_0x8af0('0x5e')]['mapKey'])){throw new db[(_0x8af0('0xa4'))][(_0x8af0('0x93'))](_0x8af0('0xa6')+_0x36041b);}if(!_[_0x8af0('0xa7')](_0x36041b,_0x413091['body']['mapKey'])){throw new db['Sequelize'][(_0x8af0('0x93'))](_0x8af0('0xa8')+_0x36041b);}_0x5964c8[_0x413091['body'][_0x8af0('0xa9')]]=_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')];return db[_0x8af0('0xaa')][_0x8af0('0x5b')]({'where':{'id':_0x413091[_0x8af0('0x88')]['ListId']},'include':[{'model':db[_0x8af0('0xab')],'as':_0x8af0('0xac'),'where':_0x5964c8,'limit':0x1,'order':[[_0x8af0('0x96'),_0x8af0('0xad')]]}]});})[_0x8af0('0x23')](handleEntityNotFound(_0x50ac11,null))[_0x8af0('0x23')](function(_0x5b73ee){if(_0x5b73ee){_0x413091['list']=_[_0x8af0('0x74')](_0x5b73ee,[_0x8af0('0xac')]);if(_0x5b73ee[_0x8af0('0xac')][_0x8af0('0x6a')]){return _0x5b73ee['Contacts'][0x0];}var _0x4ecd0c=_['defaults'](_0x413091['body'],{'firstName':_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')],'ListId':_0x5b73ee['id']});_0x4ecd0c[_0x413091['body'][_0x8af0('0xa9')]]=_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')];return db['CmContact']['create'](_0x4ecd0c,{'fields':_0x390fed,'raw':!![]});}})[_0x8af0('0x23')](handleEntityNotFound(_0x50ac11,null))[_0x8af0('0x23')](function(_0x431c94){if(_0x431c94){_0x413091['contact']=_0x431c94;var _0x9d2a4f={'ContactId':_0x431c94['id'],'phone':_0x413091[_0x8af0('0x5e')]['from'],'WhatsappAccountId':_0x44cb6a[_0x8af0('0x64')]['id']};var _0x1d7237={'ContactId':_0x431c94['id'],'WhatsappAccountId':_0x44cb6a['params']['id'],'closed':![]};return db[_0x8af0('0xae')][_0x8af0('0x5b')]({'where':_0x1d7237})[_0x8af0('0x23')](function(_0x776f84){if(_0x776f84){return[_0x776f84,![]];}return db[_0x8af0('0xae')][_0x8af0('0x5d')](_0x9d2a4f)[_0x8af0('0x23')](function(_0x3ea1be){return[_0x3ea1be,!![]];});});}})[_0x8af0('0x75')](function(_0x1b765d,_0x4a46fd){_0x413091[_0x8af0('0xaf')]=_0x1b765d['get']({'plain':!![]});_0x413091['interaction'][_0x8af0('0xb0')]=![];if(_0x4a46fd){if(_0x413091[_0x8af0('0x88')][_0x8af0('0xb1')]){_0x413091[_0x8af0('0x91')][_0x8af0('0xb2')]({'id':0x0,'priority':_0x413091[_0x8af0('0x91')][_0x8af0('0x6a')]+0x1,'app':_0x8af0('0xb3'),'appdata':'unmanaged','interval':_0x8af0('0xb4')});}_0x413091[_0x8af0('0xaf')][_0x8af0('0xb0')]=!![];}return db['WhatsappMessage'][_0x8af0('0x5d')]({'phone':_0x413091[_0x8af0('0x5e')][_0x8af0('0x9c')],'messageId':_0x413091[_0x8af0('0x5e')][_0x8af0('0xa0')],'body':_0x413091['body'][_0x8af0('0x5e')],'WhatsappAccountId':_0x44cb6a[_0x8af0('0x64')]['id'],'WhatsappInteractionId':_0x1b765d['id'],'direction':'in','ContactId':_0x1b765d[_0x8af0('0xb5')],'AttachmentId':_0x413091['body'][_0x8af0('0xb6')]});})[_0x8af0('0x23')](function(_0x521bde){_0x413091[_0x8af0('0x2c')]=_0x521bde;if(_0x413091[_0x8af0('0xaf')][_0x8af0('0xb7')]){return db['User'][_0x8af0('0x5b')]({'attributes':['id',_0x8af0('0x3f')],'where':{'id':_0x413091[_0x8af0('0xaf')][_0x8af0('0xb7')]}})[_0x8af0('0x23')](function(_0x22a258){if(_0x22a258){_0x413091[_0x8af0('0x91')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8af0('0xb8'),'appdata':_0x22a258[_0x8af0('0x3f')]+','+(_0x413091[_0x8af0('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x8af0('0xb4')});}return respondWithRpcPromise('Start',_0x8af0('0xb9'),_0x413091);});}return respondWithRpcPromise(_0x8af0('0xba'),_0x8af0('0xb9'),_0x413091);})[_0x8af0('0x23')](function(_0x58ba00){if(_0x58ba00){var _0x26b6ed=0xc8;var _0x17a3ce=_0x8af0('0xbb');logger[_0x8af0('0x24')](_0x8af0('0x28'),_0x17a3ce,_0x26b6ed,_0x8af0('0xbc'));logger[_0x8af0('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x17a3ce,_0x26b6ed,_0x8af0('0xbc'),JSON['stringify'](_0x58ba00));if(_0x413091[_0x8af0('0x88')][_0x8af0('0x55')]===_0x8af0('0x9b')){return _0x50ac11[_0x8af0('0x2f')](_0x26b6ed)[_0x8af0('0x35')](_0x8af0('0xbd'),_0x8af0('0xbe'))[_0x8af0('0x84')](_0x8af0('0xbf'));}else{return _0x50ac11[_0x8af0('0x2f')](_0x26b6ed)['json'](_0x58ba00);}}});})['catch'](handleError(_0x50ac11,null));};exports[_0x8af0('0x84')]=function(_0x24021f,_0x1cc313,_0x10bbab){var _0x49a355,_0x520cb1,_0x95198f;if(_['isNil'](_0x24021f[_0x8af0('0x5e')]['body'])||_0x24021f['body']['body']===''){throw new db[(_0x8af0('0xa4'))][(_0x8af0('0x93'))](_0x8af0('0xa5'));}if(_[_0x8af0('0xa3')](_0x24021f[_0x8af0('0x5e')]['to'])){throw new db['Sequelize'][(_0x8af0('0x93'))](_0x8af0('0xc0'));}_0x49a355=_0x24021f[_0x8af0('0x5e')]['to'];return db[_0x8af0('0x44')][_0x8af0('0x5b')]({'where':{'id':_0x24021f[_0x8af0('0x64')]['id']},'include':[{'model':db[_0x8af0('0xaa')],'as':_0x8af0('0xc1'),'include':[{'model':db[_0x8af0('0xab')],'as':_0x8af0('0xac'),'where':{'mobile':_0x49a355},'limit':0x1,'order':[[_0x8af0('0x96'),_0x8af0('0xad')]]}]}]})[_0x8af0('0x23')](handleEntityNotFound(_0x1cc313,null))[_0x8af0('0x23')](function(_0x35203d){if(_0x35203d&&_0x35203d[_0x8af0('0xc1')]){_0x520cb1=_0x35203d[_0x8af0('0x3c')]({'plain':!![]});if(_0x520cb1['List']&&_0x520cb1[_0x8af0('0xc1')][_0x8af0('0xac')][_0x8af0('0x6a')]){return _0x520cb1[_0x8af0('0xc1')][_0x8af0('0xac')][0x0];}return db[_0x8af0('0xab')][_0x8af0('0x5d')](_['defaults'](_0x24021f[_0x8af0('0x5e')],{'firstName':_0x49a355,'mobile':_0x49a355,'phone':_0x49a355,'ListId':_0x520cb1[_0x8af0('0x99')]}));}})[_0x8af0('0x23')](handleEntityNotFound(_0x1cc313,null))[_0x8af0('0x23')](function(_0x3228ab){if(_0x3228ab){_0x95198f=_0x3228ab;return db[_0x8af0('0xae')][_0x8af0('0x5b')]({'where':{'ContactId':_0x95198f['id'],'closed':![],'WhatsappAccountId':_0x520cb1['id']}})[_0x8af0('0x23')](function(_0x1db0b9){if(_0x1db0b9){return[_0x1db0b9,![]];}return db[_0x8af0('0xae')][_0x8af0('0x5d')]({'UserId':_0x24021f[_0x8af0('0x5f')]['id'],'ContactId':_0x95198f['id'],'WhatsappAccountId':_0x520cb1['id'],'phone':_0x49a355,'firstMsgDirection':'out','Messages':[_[_0x8af0('0x54')](_0x24021f['body'],{'read':![],'body':_0x24021f[_0x8af0('0x5e')][_0x8af0('0x5e')],'phone':_0x49a355,'WhatsappAccountId':_0x520cb1['id'],'UserId':_0x24021f[_0x8af0('0x5f')]['id'],'ContactId':_0x95198f['id']})]},{'include':[{'model':db[_0x8af0('0x8d')],'as':_0x8af0('0xc2')}]})[_0x8af0('0x23')](function(_0x1677d8){return[_0x1677d8,!![]];});});}})[_0x8af0('0x75')](function(_0x212d38,_0x4a5b14){if(_0x4a5b14){return _0x212d38;}return db[_0x8af0('0x8d')][_0x8af0('0x5d')](_['merge'](_0x24021f[_0x8af0('0x5e')],{'read':![],'body':_0x24021f['body'][_0x8af0('0x5e')],'phone':_0x49a355,'WhatsappAccountId':_0x520cb1['id'],'WhatsappInteractionId':_0x212d38['id'],'UserId':_0x24021f[_0x8af0('0x5f')]['id'],'ContactId':_0x95198f['id']}))[_0x8af0('0x23')](function(_0x421c1a){_0x212d38[_0x8af0('0xc3')][_0x8af0('0xc2')]=[];_0x212d38[_0x8af0('0xc3')][_0x8af0('0xc2')]['push'](_0x421c1a[_0x8af0('0xc3')]);return _0x212d38;});})[_0x8af0('0x23')](respondWithResult(_0x1cc313,null))[_0x8af0('0x5c')](handleError(_0x1cc313,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8f0def3..b620d80 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 _0x9cbb=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xd098,_0x2cd295){var _0x216e38=function(_0x5d2b96){while(--_0x5d2b96){_0xd098['push'](_0xd098['shift']());}};_0x216e38(++_0x2cd295);}(_0x9cbb,0x16a));var _0xb9cb=function(_0xa9c94,_0x420fa9){_0xa9c94=_0xa9c94-0x0;var _0x587e7f=_0x9cbb[_0xa9c94];return _0x587e7f;};'use strict';var EventEmitter=require(_0xb9cb('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb9cb('0x1')](0x0);var events={'afterCreate':_0xb9cb('0x2'),'afterUpdate':_0xb9cb('0x3'),'afterDestroy':_0xb9cb('0x4')};function emitEvent(_0x12cd13){return function(_0x1100d3,_0x45f393,_0x8b2348){WhatsappAccountEvents[_0xb9cb('0x5')](_0x12cd13+':'+_0x1100d3['id'],_0x1100d3);WhatsappAccountEvents[_0xb9cb('0x5')](_0x12cd13,_0x1100d3);_0x8b2348(null);};}for(var e in events){if(events[_0xb9cb('0x6')](e)){var event=events[e];WhatsappAccount[_0xb9cb('0x7')](e,emitEvent(event));}}module[_0xb9cb('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd5ae=['update','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0xfd9239,_0x2fea4f){var _0x48f447=function(_0x49af16){while(--_0x49af16){_0xfd9239['push'](_0xfd9239['shift']());}};_0x48f447(++_0x2fea4f);}(_0xd5ae,0x198));var _0xed5a=function(_0x188f87,_0x53afb3){_0x188f87=_0x188f87-0x0;var _0x509f08=_0xd5ae[_0x188f87];return _0x509f08;};'use strict';var EventEmitter=require(_0xed5a('0x0'));var WhatsappAccount=require(_0xed5a('0x1'))['db'][_0xed5a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xed5a('0x3')](0x0);var events={'afterCreate':_0xed5a('0x4'),'afterUpdate':_0xed5a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3245b3){return function(_0x2a82a9,_0x28382d,_0x453e73){WhatsappAccountEvents['emit'](_0x3245b3+':'+_0x2a82a9['id'],_0x2a82a9);WhatsappAccountEvents['emit'](_0x3245b3,_0x2a82a9);_0x453e73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xed5a('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2219a5f..e726a83 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 _0xe2fb=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2fb,0x9e));var _0xbe2f=function(_0x257b7b,_0x1f0dbf){_0x257b7b=_0x257b7b-0x0;var _0x4f2420=_0xe2fb[_0x257b7b];return _0x4f2420;};'use strict';var _=require(_0xbe2f('0x0'));var util=require(_0xbe2f('0x1'));var logger=require(_0xbe2f('0x2'))(_0xbe2f('0x3'));var moment=require(_0xbe2f('0x4'));var BPromise=require(_0xbe2f('0x5'));var rp=require(_0xbe2f('0x6'));var fs=require('fs');var path=require(_0xbe2f('0x7'));var rimraf=require('rimraf');var config=require(_0xbe2f('0x8'));var attributes=require(_0xbe2f('0x9'));module[_0xbe2f('0xa')]=function(_0x20b86d,_0x6e5a55){return _0x20b86d[_0xbe2f('0xb')](_0xbe2f('0xc'),attributes,{'tableName':_0xbe2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf656=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash'];(function(_0x26e2e6,_0x2fe553){var _0x2c304f=function(_0x1cd128){while(--_0x1cd128){_0x26e2e6['push'](_0x26e2e6['shift']());}};_0x2c304f(++_0x2fe553);}(_0xf656,0x18b));var _0x6f65=function(_0x5e7674,_0x192d83){_0x5e7674=_0x5e7674-0x0;var _0x4e56b0=_0xf656[_0x5e7674];return _0x4e56b0;};'use strict';var _=require(_0x6f65('0x0'));var util=require(_0x6f65('0x1'));var logger=require(_0x6f65('0x2'))(_0x6f65('0x3'));var moment=require('moment');var BPromise=require(_0x6f65('0x4'));var rp=require(_0x6f65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f65('0x6'));var config=require(_0x6f65('0x7'));var attributes=require(_0x6f65('0x8'));module[_0x6f65('0x9')]=function(_0x4198ab,_0x50d343){return _0x4198ab[_0x6f65('0xa')]('WhatsappAccount',attributes,{'tableName':_0x6f65('0xb'),'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 583bfec..feeadf1 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 _0x5611=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','raw','options','where','include','map','model','attributes','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5611,0xcc));var _0x1561=function(_0x1afb67,_0x33e35d){_0x1afb67=_0x1afb67-0x0;var _0x52263a=_0x5611[_0x1afb67];return _0x52263a;};'use strict';var _=require(_0x1561('0x0'));var util=require('util');var moment=require(_0x1561('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1561('0x2'));var db=require(_0x1561('0x3'))['db'];var utils=require(_0x1561('0x4'));var logger=require(_0x1561('0x5'))('rpc');var config=require(_0x1561('0x6'));var jayson=require(_0x1561('0x7'));var client=jayson[_0x1561('0x8')][_0x1561('0x9')]({'port':0x232a});config[_0x1561('0xa')]=_['defaults'](config[_0x1561('0xa')],{'host':_0x1561('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1561('0xa')]));require(_0x1561('0xc'))[_0x1561('0xd')](socket);function respondWithRpcPromise(_0xc047a9,_0x2efbfd,_0x4dbdc7){return new BPromise(function(_0x3fdeac,_0x2ebeb0){return client[_0x1561('0xe')](_0xc047a9,_0x4dbdc7)[_0x1561('0xf')](function(_0x47e36f){logger[_0x1561('0x10')](_0x1561('0x11'),_0x2efbfd,'request\x20sent');logger[_0x1561('0x12')](_0x1561('0x13'),_0x2efbfd,_0x1561('0x14'),JSON[_0x1561('0x15')](_0x47e36f));if(_0x47e36f[_0x1561('0x16')]){if(_0x47e36f['error'][_0x1561('0x17')]===0x1f4){logger[_0x1561('0x16')](_0x1561('0x11'),_0x2efbfd,_0x47e36f[_0x1561('0x16')][_0x1561('0x18')]);return _0x2ebeb0(_0x47e36f['error'][_0x1561('0x18')]);}logger['error'](_0x1561('0x11'),_0x2efbfd,_0x47e36f[_0x1561('0x16')][_0x1561('0x18')]);return _0x3fdeac(_0x47e36f['error'][_0x1561('0x18')]);}else{logger[_0x1561('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x2efbfd,_0x1561('0x14'));_0x3fdeac(_0x47e36f[_0x1561('0x19')][_0x1561('0x18')]);}})[_0x1561('0x1a')](function(_0x1178f5){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2efbfd,_0x1178f5);_0x2ebeb0(_0x1178f5);});});}exports[_0x1561('0x1b')]=function(_0xad03e7){var _0x499e41=this;return new Promise(function(_0x42789e,_0x5b4e6b){return db['WhatsappAccount'][_0x1561('0x1c')]({'raw':_0xad03e7['options']?_0xad03e7['options'][_0x1561('0x1d')]===undefined?!![]:![]:!![],'where':_0xad03e7[_0x1561('0x1e')]?_0xad03e7['options'][_0x1561('0x1f')]||null:null,'attributes':_0xad03e7[_0x1561('0x1e')]?_0xad03e7[_0x1561('0x1e')]['attributes']||null:null,'include':_0xad03e7[_0x1561('0x1e')]?_0xad03e7[_0x1561('0x1e')][_0x1561('0x20')]?_[_0x1561('0x21')](_0xad03e7[_0x1561('0x1e')][_0x1561('0x20')],function(_0x337eaa){return{'model':db[_0x337eaa['model']],'as':_0x337eaa['as'],'attributes':_0x337eaa['attributes'],'include':_0x337eaa[_0x1561('0x20')]?_['map'](_0x337eaa[_0x1561('0x20')],function(_0x33f537){return{'model':db[_0x33f537['model']],'as':_0x33f537['as'],'attributes':_0x33f537['attributes'],'include':_0x33f537[_0x1561('0x20')]?_[_0x1561('0x21')](_0x33f537['include'],function(_0x32dfb5){return{'model':db[_0x32dfb5[_0x1561('0x22')]],'as':_0x32dfb5['as'],'attributes':_0x32dfb5[_0x1561('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd33acc){logger[_0x1561('0x10')](_0x1561('0x1b'),_0xad03e7);logger['debug'](_0x1561('0x1b'),_0xad03e7,JSON[_0x1561('0x15')](_0xd33acc));_0x42789e(_0xd33acc);})[_0x1561('0x1a')](function(_0x30d06d){logger[_0x1561('0x16')](_0x1561('0x1b'),_0x30d06d[_0x1561('0x18')],_0xad03e7);_0x5b4e6b(_0x499e41[_0x1561('0x16')](0x1f4,_0x30d06d[_0x1561('0x18')]));});});}; \ No newline at end of file +var _0x8138=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x8138,0x1da));var _0x8813=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x8138[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x8813('0x0'));var util=require('util');var moment=require(_0x8813('0x1'));var BPromise=require(_0x8813('0x2'));var rs=require(_0x8813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8813('0x4'))['db'];var utils=require(_0x8813('0x5'));var logger=require(_0x8813('0x6'))(_0x8813('0x7'));var config=require(_0x8813('0x8'));var jayson=require(_0x8813('0x9'));var client=jayson[_0x8813('0xa')][_0x8813('0xb')]({'port':0x232a});config[_0x8813('0xc')]=_[_0x8813('0xd')](config[_0x8813('0xc')],{'host':_0x8813('0xe'),'port':0x18eb});var socket=require(_0x8813('0xf'))(new Redis(config[_0x8813('0xc')]));require(_0x8813('0x10'))[_0x8813('0x11')](socket);function respondWithRpcPromise(_0x344d18,_0x2729c5,_0x550d42){return new BPromise(function(_0x3bf067,_0xa8ee6d){return client['request'](_0x344d18,_0x550d42)['then'](function(_0x7acb02){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2729c5,_0x8813('0x12'));logger['debug'](_0x8813('0x13'),_0x2729c5,_0x8813('0x12'),JSON[_0x8813('0x14')](_0x7acb02));if(_0x7acb02['error']){if(_0x7acb02[_0x8813('0x15')][_0x8813('0x16')]===0x1f4){logger[_0x8813('0x15')](_0x8813('0x17'),_0x2729c5,_0x7acb02['error'][_0x8813('0x18')]);return _0xa8ee6d(_0x7acb02[_0x8813('0x15')][_0x8813('0x18')]);}logger[_0x8813('0x15')](_0x8813('0x17'),_0x2729c5,_0x7acb02['error'][_0x8813('0x18')]);return _0x3bf067(_0x7acb02[_0x8813('0x15')][_0x8813('0x18')]);}else{logger[_0x8813('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x2729c5,_0x8813('0x12'));_0x3bf067(_0x7acb02[_0x8813('0x1a')][_0x8813('0x18')]);}})[_0x8813('0x1b')](function(_0x54970e){logger[_0x8813('0x15')](_0x8813('0x17'),_0x2729c5,_0x54970e);_0xa8ee6d(_0x54970e);});});}exports[_0x8813('0x1c')]=function(_0x1511ec){var _0x5ecbf5=this;return new Promise(function(_0x47aac9,_0x18eeb6){return db['WhatsappAccount'][_0x8813('0x1d')]({'raw':_0x1511ec[_0x8813('0x1e')]?_0x1511ec['options'][_0x8813('0x1f')]===undefined?!![]:![]:!![],'where':_0x1511ec[_0x8813('0x1e')]?_0x1511ec[_0x8813('0x1e')][_0x8813('0x20')]||null:null,'attributes':_0x1511ec[_0x8813('0x1e')]?_0x1511ec['options']['attributes']||null:null,'include':_0x1511ec['options']?_0x1511ec[_0x8813('0x1e')][_0x8813('0x21')]?_[_0x8813('0x22')](_0x1511ec[_0x8813('0x1e')][_0x8813('0x21')],function(_0x3c945a){return{'model':db[_0x3c945a['model']],'as':_0x3c945a['as'],'attributes':_0x3c945a['attributes'],'include':_0x3c945a[_0x8813('0x21')]?_['map'](_0x3c945a[_0x8813('0x21')],function(_0x362a7c){return{'model':db[_0x362a7c[_0x8813('0x23')]],'as':_0x362a7c['as'],'attributes':_0x362a7c[_0x8813('0x24')],'include':_0x362a7c[_0x8813('0x21')]?_[_0x8813('0x22')](_0x362a7c['include'],function(_0x4909dd){return{'model':db[_0x4909dd[_0x8813('0x23')]],'as':_0x4909dd['as'],'attributes':_0x4909dd[_0x8813('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f855b){logger[_0x8813('0x19')](_0x8813('0x1c'),_0x1511ec);logger['debug'](_0x8813('0x1c'),_0x1511ec,JSON[_0x8813('0x14')](_0x1f855b));_0x47aac9(_0x1f855b);})[_0x8813('0x1b')](function(_0x2b3db4){logger['error'](_0x8813('0x1c'),_0x2b3db4[_0x8813('0x18')],_0x1511ec);_0x18eeb6(_0x5ecbf5[_0x8813('0x15')](0x1f4,_0x2b3db4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0f20ada..5675cac 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 _0x1a02=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x31c0e5,_0x472b48){var _0x16dce4=function(_0x3fe675){while(--_0x3fe675){_0x31c0e5['push'](_0x31c0e5['shift']());}};_0x16dce4(++_0x472b48);}(_0x1a02,0x1bd));var _0x21a0=function(_0x500869,_0x11c14f){_0x500869=_0x500869-0x0;var _0x467750=_0x1a02[_0x500869];return _0x467750;};'use strict';var WhatsappAccountEvents=require(_0x21a0('0x0'));var events=[_0x21a0('0x1'),_0x21a0('0x2'),_0x21a0('0x3')];function createListener(_0xcc64a5,_0xf71914){return function(_0x5d9cd8){_0xf71914[_0x21a0('0x4')](_0xcc64a5,_0x5d9cd8);};}function removeListener(_0x2f17c7,_0x3aae82){return function(){WhatsappAccountEvents[_0x21a0('0x5')](_0x2f17c7,_0x3aae82);};}exports[_0x21a0('0x6')]=function(_0x792f99){for(var _0x8b576=0x0,_0x107bbe=events[_0x21a0('0x7')];_0x8b576<_0x107bbe;_0x8b576++){var _0x19ffe0=events[_0x8b576];var _0x2e6278=createListener(_0x21a0('0x8')+_0x19ffe0,_0x792f99);WhatsappAccountEvents['on'](_0x19ffe0,_0x2e6278);}}; \ No newline at end of file +var _0x35ca=['./whatsappAccount.events','remove','update','removeListener','length','whatsappAccount:'];(function(_0x23c19c,_0x4870e1){var _0x1d4972=function(_0xc0af0e){while(--_0xc0af0e){_0x23c19c['push'](_0x23c19c['shift']());}};_0x1d4972(++_0x4870e1);}(_0x35ca,0x19e));var _0xa35c=function(_0x1eb32a,_0x5497a2){_0x1eb32a=_0x1eb32a-0x0;var _0x29c755=_0x35ca[_0x1eb32a];return _0x29c755;};'use strict';var WhatsappAccountEvents=require(_0xa35c('0x0'));var events=['save',_0xa35c('0x1'),_0xa35c('0x2')];function createListener(_0x14f73e,_0x560ae2){return function(_0x570b3a){_0x560ae2['emit'](_0x14f73e,_0x570b3a);};}function removeListener(_0x122c63,_0x16d46a){return function(){WhatsappAccountEvents[_0xa35c('0x3')](_0x122c63,_0x16d46a);};}exports['register']=function(_0x11a770){for(var _0x4a1701=0x0,_0x33c845=events[_0xa35c('0x4')];_0x4a1701<_0x33c845;_0x4a1701++){var _0x4e17df=events[_0x4a1701];var _0x5ad669=createListener(_0xa35c('0x5')+_0x4e17df,_0x11a770);WhatsappAccountEvents['on'](_0x4e17df,_0x5ad669);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4f2caaf..976855c 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 _0xfc41=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0xfc41,0x147));var _0x1fc4=function(_0x583a07,_0x37e707){_0x583a07=_0x583a07-0x0;var _0x16d549=_0xfc41[_0x583a07];return _0x16d549;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1fc4('0x0'));var timeout=require(_0x1fc4('0x1'));var express=require(_0x1fc4('0x2'));var router=express[_0x1fc4('0x3')]();var fs_extra=require(_0x1fc4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1fc4('0x5'));var config=require(_0x1fc4('0x6'));var controller=require(_0x1fc4('0x7'));router[_0x1fc4('0x8')]('/',auth[_0x1fc4('0x9')](),controller[_0x1fc4('0xa')]);router['get'](_0x1fc4('0xb'),auth['isAuthenticated'](),controller[_0x1fc4('0xc')]);router[_0x1fc4('0xd')]('/',auth[_0x1fc4('0x9')](),controller[_0x1fc4('0xe')]);router[_0x1fc4('0xf')](_0x1fc4('0xb'),auth[_0x1fc4('0x9')](),controller[_0x1fc4('0x10')]);router[_0x1fc4('0x11')](_0x1fc4('0xb'),auth['isAuthenticated'](),controller[_0x1fc4('0x12')]);module[_0x1fc4('0x13')]=router; \ No newline at end of file +var _0xe11c=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','create','put','update'];(function(_0x9e7a94,_0x9eb1d4){var _0xf71758=function(_0x17dec5){while(--_0x17dec5){_0x9e7a94['push'](_0x9e7a94['shift']());}};_0xf71758(++_0x9eb1d4);}(_0xe11c,0x115));var _0xce11=function(_0x5052d,_0x1703a6){_0x5052d=_0x5052d-0x0;var _0x6612f5=_0xe11c[_0x5052d];return _0x6612f5;};'use strict';var multer=require(_0xce11('0x0'));var util=require(_0xce11('0x1'));var path=require(_0xce11('0x2'));var timeout=require(_0xce11('0x3'));var express=require('express');var router=express[_0xce11('0x4')]();var fs_extra=require(_0xce11('0x5'));var auth=require(_0xce11('0x6'));var interaction=require(_0xce11('0x7'));var config=require(_0xce11('0x8'));var controller=require(_0xce11('0x9'));router[_0xce11('0xa')]('/',auth[_0xce11('0xb')](),controller[_0xce11('0xc')]);router[_0xce11('0xa')]('/:id',auth[_0xce11('0xb')](),controller['show']);router[_0xce11('0xd')]('/',auth[_0xce11('0xb')](),controller[_0xce11('0xe')]);router[_0xce11('0xf')]('/:id',auth[_0xce11('0xb')](),controller[_0xce11('0x10')]);router[_0xce11('0x11')](_0xce11('0x12'),auth[_0xce11('0xb')](),controller[_0xce11('0x13')]);module[_0xce11('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f22675d..93bafbf 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 _0x5e10=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x5e10,0x179));var _0x05e1=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5e10[_0x48d6a3];return _0x38bfa0;};'use strict';var Sequelize=require('sequelize');module[_0x05e1('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x05e1('0x1')],'allowNull':![],'defaultValue':_0x05e1('0x2')},'appdata':{'type':Sequelize[_0x05e1('0x3')]()},'description':{'type':Sequelize[_0x05e1('0x1')]},'interval':{'type':Sequelize[_0x05e1('0x1')],'defaultValue':_0x05e1('0x4')}}; \ No newline at end of file +var _0xe23f=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xe23f,0x89));var _0xfe23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe23f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe23('0x0'));module[_0xfe23('0x1')]={'priority':{'type':Sequelize[_0xfe23('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfe23('0x3')],'allowNull':![],'defaultValue':_0xfe23('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfe23('0x3')]},'interval':{'type':Sequelize[_0xfe23('0x3')],'defaultValue':_0xfe23('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 783e87a..5f2b925 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 _0x1921=['WhatsappApplication','includeAll','include','findAll','rows','catch','show','length','options','create','body','find','destroy','params','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'];(function(_0x4da339,_0x4f55b5){var _0x39e7e3=function(_0x1ff751){while(--_0x1ff751){_0x4da339['push'](_0x4da339['shift']());}};_0x39e7e3(++_0x4f55b5);}(_0x1921,0xf2));var _0x1192=function(_0x5d1798,_0x326967){_0x5d1798=_0x5d1798-0x0;var _0x3d66c9=_0x1921[_0x5d1798];return _0x3d66c9;};'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['WhatsappApplication']['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['WhatsappApplication']['find']({'where':{'id':_0xcdda33[_0x1192('0x4b')]['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x5b735c,null))[_0x1192('0x25')](removeEntity(_0x5b735c,null))['catch'](handleError(_0x5b735c,null));}; \ No newline at end of file +var _0x5d59=['moment','bluebird','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x22d96a,_0xc41557){var _0x1a7a2b=function(_0x265893){while(--_0x265893){_0x22d96a['push'](_0x22d96a['shift']());}};_0x1a7a2b(++_0xc41557);}(_0x5d59,0x15f));var _0x95d5=function(_0x240700,_0x13e7d9){_0x240700=_0x240700-0x0;var _0x51530c=_0x5d59[_0x240700];return _0x51530c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95d5('0x0'));var zipdir=require(_0x95d5('0x1'));var jsonpatch=require(_0x95d5('0x2'));var rp=require(_0x95d5('0x3'));var moment=require(_0x95d5('0x4'));var BPromise=require(_0x95d5('0x5'));var Mustache=require('mustache');var util=require(_0x95d5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x95d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95d5('0x8'));var squel=require(_0x95d5('0x9'));var crypto=require(_0x95d5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95d5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x95d5('0xc'));var Papa=require('papaparse');var Redis=require(_0x95d5('0xd'));var authService=require(_0x95d5('0xe'));var qs=require(_0x95d5('0xf'));var as=require(_0x95d5('0x10'));var hardwareService=require(_0x95d5('0x11'));var logger=require(_0x95d5('0x12'))(_0x95d5('0x13'));var utils=require(_0x95d5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x95d5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47fb16,_0x12b0ff){_0x12b0ff=_0x12b0ff||0xcc;return function(_0x30ad51){if(_0x30ad51){return _0x47fb16[_0x95d5('0x16')](_0x12b0ff);}return _0x47fb16[_0x95d5('0x17')](_0x12b0ff)['end']();};}function respondWithResult(_0x33d769,_0x2ce559){_0x2ce559=_0x2ce559||0xc8;return function(_0x3c0c3e){if(_0x3c0c3e){return _0x33d769[_0x95d5('0x17')](_0x2ce559)[_0x95d5('0x18')](_0x3c0c3e);}};}function respondWithFilteredResult(_0x3a59df,_0x3d8de7){return function(_0x1f03eb){if(_0x1f03eb){var _0x14d8a9=typeof _0x3d8de7['offset']==='undefined'&&typeof _0x3d8de7[_0x95d5('0x19')]==='undefined';var _0x34a382=_0x1f03eb[_0x95d5('0x1a')];var _0x5bdf14=_0x14d8a9?0x0:_0x3d8de7[_0x95d5('0x1b')];var _0x3793eb=_0x14d8a9?_0x1f03eb[_0x95d5('0x1a')]:_0x3d8de7[_0x95d5('0x1b')]+_0x3d8de7[_0x95d5('0x19')];var _0x11e905;if(_0x3793eb>=_0x34a382){_0x3793eb=_0x34a382;_0x11e905=0xc8;}else{_0x11e905=0xce;}_0x3a59df['status'](_0x11e905);return _0x3a59df[_0x95d5('0x1c')](_0x95d5('0x1d'),_0x5bdf14+'-'+_0x3793eb+'/'+_0x34a382)[_0x95d5('0x18')](_0x1f03eb);}return null;};}function patchUpdates(_0x5bd58d){return function(_0x5e8a19){try{jsonpatch[_0x95d5('0x1e')](_0x5e8a19,_0x5bd58d,!![]);}catch(_0x4023d3){return BPromise['reject'](_0x4023d3);}return _0x5e8a19[_0x95d5('0x1f')]();};}function saveUpdates(_0x2557e7,_0x2ca4b6){return function(_0x51ba73){if(_0x51ba73){return _0x51ba73[_0x95d5('0x20')](_0x2557e7)['then'](function(_0x5a5a7e){return _0x5a5a7e;});}return null;};}function removeEntity(_0x4f64ac,_0x554f4d){return function(_0x588825){if(_0x588825){return _0x588825['destroy']()[_0x95d5('0x21')](function(){_0x4f64ac[_0x95d5('0x17')](0xcc)[_0x95d5('0x22')]();});}};}function handleEntityNotFound(_0x260582,_0x54f64c){return function(_0x3fe6ef){if(!_0x3fe6ef){_0x260582[_0x95d5('0x16')](0x194);}return _0x3fe6ef;};}function handleError(_0x316d19,_0x1b8d73){_0x1b8d73=_0x1b8d73||0x1f4;return function(_0xe12a95){logger[_0x95d5('0x23')](_0xe12a95[_0x95d5('0x24')]);if(_0xe12a95[_0x95d5('0x25')]){delete _0xe12a95[_0x95d5('0x25')];}_0x316d19[_0x95d5('0x17')](_0x1b8d73)['send'](_0xe12a95);};}exports['index']=function(_0xd9b81c,_0x18121f){var _0x256727={},_0x5dfe00={},_0x1c8626={'count':0x0,'rows':[]};var _0x4e6f3b=_[_0x95d5('0x26')](db['WhatsappApplication'][_0x95d5('0x27')],function(_0x14b058){return{'name':_0x14b058[_0x95d5('0x28')],'type':_0x14b058[_0x95d5('0x29')][_0x95d5('0x2a')]};});_0x5dfe00[_0x95d5('0x2b')]=_[_0x95d5('0x26')](_0x4e6f3b,_0x95d5('0x25'));_0x5dfe00['query']=_['keys'](_0xd9b81c['query']);_0x5dfe00[_0x95d5('0x2c')]=_[_0x95d5('0x2d')](_0x5dfe00[_0x95d5('0x2b')],_0x5dfe00[_0x95d5('0x2e')]);_0x256727[_0x95d5('0x2f')]=_[_0x95d5('0x2d')](_0x5dfe00['model'],qs[_0x95d5('0x30')](_0xd9b81c[_0x95d5('0x2e')][_0x95d5('0x30')]));_0x256727[_0x95d5('0x2f')]=_0x256727[_0x95d5('0x2f')][_0x95d5('0x31')]?_0x256727[_0x95d5('0x2f')]:_0x5dfe00[_0x95d5('0x2b')];if(!_0xd9b81c[_0x95d5('0x2e')]['hasOwnProperty']('nolimit')){_0x256727[_0x95d5('0x19')]=qs[_0x95d5('0x19')](_0xd9b81c[_0x95d5('0x2e')][_0x95d5('0x19')]);_0x256727['offset']=qs[_0x95d5('0x1b')](_0xd9b81c['query'][_0x95d5('0x1b')]);}_0x256727[_0x95d5('0x32')]=qs[_0x95d5('0x33')](_0xd9b81c['query'][_0x95d5('0x33')]);_0x256727[_0x95d5('0x34')]=qs[_0x95d5('0x2c')](_[_0x95d5('0x35')](_0xd9b81c[_0x95d5('0x2e')],_0x5dfe00[_0x95d5('0x2c')]),_0x4e6f3b);if(_0xd9b81c['query'][_0x95d5('0x36')]){_0x256727[_0x95d5('0x34')]=_[_0x95d5('0x37')](_0x256727[_0x95d5('0x34')],{'$or':_[_0x95d5('0x26')](_0x4e6f3b,function(_0x236e98){if(_0x236e98[_0x95d5('0x29')]!==_0x95d5('0x38')){var _0x172396={};_0x172396[_0x236e98[_0x95d5('0x25')]]={'$like':'%'+_0xd9b81c['query']['filter']+'%'};return _0x172396;}})});}_0x256727=_[_0x95d5('0x37')]({},_0x256727,_0xd9b81c[_0x95d5('0x39')]);var _0x28a05e={'where':_0x256727[_0x95d5('0x34')]};return db[_0x95d5('0x3a')]['count'](_0x28a05e)[_0x95d5('0x21')](function(_0xc7b674){_0x1c8626[_0x95d5('0x1a')]=_0xc7b674;if(_0xd9b81c[_0x95d5('0x2e')][_0x95d5('0x3b')]){_0x256727[_0x95d5('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x95d5('0x3d')](_0x256727);})[_0x95d5('0x21')](function(_0xb00cd0){_0x1c8626[_0x95d5('0x3e')]=_0xb00cd0;return _0x1c8626;})[_0x95d5('0x21')](respondWithFilteredResult(_0x18121f,_0x256727))[_0x95d5('0x3f')](handleError(_0x18121f,null));};exports[_0x95d5('0x40')]=function(_0x344d4f,_0x2baab8){var _0x5bc9c8={'raw':!![],'where':{'id':_0x344d4f[_0x95d5('0x41')]['id']}},_0x37238b={};_0x37238b[_0x95d5('0x2b')]=_[_0x95d5('0x42')](db['WhatsappApplication'][_0x95d5('0x27')]);_0x37238b['query']=_[_0x95d5('0x42')](_0x344d4f[_0x95d5('0x2e')]);_0x37238b[_0x95d5('0x2c')]=_[_0x95d5('0x2d')](_0x37238b[_0x95d5('0x2b')],_0x37238b['query']);_0x5bc9c8[_0x95d5('0x2f')]=_[_0x95d5('0x2d')](_0x37238b[_0x95d5('0x2b')],qs[_0x95d5('0x30')](_0x344d4f[_0x95d5('0x2e')][_0x95d5('0x30')]));_0x5bc9c8[_0x95d5('0x2f')]=_0x5bc9c8[_0x95d5('0x2f')]['length']?_0x5bc9c8['attributes']:_0x37238b[_0x95d5('0x2b')];if(_0x344d4f[_0x95d5('0x2e')][_0x95d5('0x3b')]){_0x5bc9c8['include']=[{'all':!![]}];}_0x5bc9c8=_[_0x95d5('0x37')]({},_0x5bc9c8,_0x344d4f[_0x95d5('0x39')]);return db['WhatsappApplication'][_0x95d5('0x43')](_0x5bc9c8)['then'](handleEntityNotFound(_0x2baab8,null))[_0x95d5('0x21')](respondWithResult(_0x2baab8,null))[_0x95d5('0x3f')](handleError(_0x2baab8,null));};exports[_0x95d5('0x44')]=function(_0x13419e,_0x2ebc44){return db[_0x95d5('0x3a')][_0x95d5('0x44')](_0x13419e[_0x95d5('0x45')],{})['then'](respondWithResult(_0x2ebc44,0xc9))['catch'](handleError(_0x2ebc44,null));};exports[_0x95d5('0x20')]=function(_0x1d24e8,_0x1f7efd){if(_0x1d24e8[_0x95d5('0x45')]['id']){delete _0x1d24e8[_0x95d5('0x45')]['id'];}return db['WhatsappApplication'][_0x95d5('0x43')]({'where':{'id':_0x1d24e8[_0x95d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f7efd,null))[_0x95d5('0x21')](saveUpdates(_0x1d24e8[_0x95d5('0x45')],null))['then'](respondWithResult(_0x1f7efd,null))[_0x95d5('0x3f')](handleError(_0x1f7efd,null));};exports[_0x95d5('0x46')]=function(_0x170116,_0x4cceae){return db[_0x95d5('0x3a')][_0x95d5('0x43')]({'where':{'id':_0x170116['params']['id']}})[_0x95d5('0x21')](handleEntityNotFound(_0x4cceae,null))[_0x95d5('0x21')](removeEntity(_0x4cceae,null))['catch'](handleError(_0x4cceae,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3766a89..7e6d295 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 _0x2fed=['path','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1d5bde,_0x62725){var _0x82284e=function(_0x4e922b){while(--_0x4e922b){_0x1d5bde['push'](_0x1d5bde['shift']());}};_0x82284e(++_0x62725);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4d43b0,_0x33e0b0){_0x4d43b0=_0x4d43b0-0x0;var _0x252713=_0x2fed[_0x4d43b0];return _0x252713;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd2fe('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3fc6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x5dbe03,_0x2941ff){var _0x8f51a9=function(_0x9fc00e){while(--_0x9fc00e){_0x5dbe03['push'](_0x5dbe03['shift']());}};_0x8f51a9(++_0x2941ff);}(_0x3fc6,0x159));var _0x63fc=function(_0x289913,_0x18543f){_0x289913=_0x289913-0x0;var _0x5b5f22=_0x3fc6[_0x289913];return _0x5b5f22;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('api');var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require(_0x63fc('0x5'));var fs=require('fs');var path=require(_0x63fc('0x6'));var rimraf=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xdb65b8,_0x7d24f){return _0xdb65b8[_0x63fc('0x9')]('WhatsappApplication',attributes,{'tableName':_0x63fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63fc('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8dcc49f..88a0503 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x84581d,_0x36c660){var _0x3a6e63=function(_0xb86326){while(--_0xb86326){_0x84581d['push'](_0x84581d['shift']());}};_0x3a6e63(++_0x36c660);}(_0x032e,0x124));var _0xe032=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x032e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file +var _0xb903=['http','request','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dad6e,_0x4c8e77){var _0x3208de=function(_0x10977e){while(--_0x10977e){_0x3dad6e['push'](_0x3dad6e['shift']());}};_0x3208de(++_0x4c8e77);}(_0xb903,0x185));var _0x3b90=function(_0x592be9,_0x59bc97){_0x592be9=_0x592be9-0x0;var _0x2a82f0=_0xb903[_0x592be9];return _0x2a82f0;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index edf193b..2310928 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 _0x126e=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x126e,0x108));var _0xe126=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x126e[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/describe',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0x9')](_0xe126('0xd'),auth[_0xe126('0xa')](),controller['show']);router[_0xe126('0x9')](_0xe126('0xe'),auth['isAuthenticated'](),controller[_0xe126('0xf')]);router[_0xe126('0x9')]('/:id/download',auth[_0xe126('0xa')](),controller['download']);router[_0xe126('0x10')]('/',auth['isAuthenticated'](),controller[_0xe126('0x11')]);router[_0xe126('0x10')](_0xe126('0xe'),auth[_0xe126('0xa')](),controller[_0xe126('0x12')]);router[_0xe126('0x10')](_0xe126('0x13'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),'whatsappinteraction:addtags'),controller[_0xe126('0x16')]);router[_0xe126('0x17')](_0xe126('0xd'),auth[_0xe126('0xa')](),interaction['tracked'](_0xe126('0x15'),_0xe126('0x18')),controller[_0xe126('0x19')]);router['delete'](_0xe126('0xd'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),_0xe126('0x1a')),controller[_0xe126('0x1b')]);router[_0xe126('0x1c')](_0xe126('0x13'),auth[_0xe126('0xa')](),controller[_0xe126('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xda19,0xd5));var _0x9da1=function(_0x4b7e36,_0x2f52f2){_0x4b7e36=_0x4b7e36-0x0;var _0x100162=_0xda19[_0x4b7e36];return _0x100162;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 2586614..78d1a64 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 _0x251b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x13f4a8,_0x83a13a){var _0x5985ad=function(_0x51eac5){while(--_0x51eac5){_0x13f4a8['push'](_0x13f4a8['shift']());}};_0x5985ad(++_0x83a13a);}(_0x251b,0x185));var _0xb251=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x251b[_0x411e71];return _0x226ae3;};'use strict';var Sequelize=require(_0xb251('0x0'));var moment=require(_0xb251('0x1'));module[_0xb251('0x2')]={'closed':{'type':Sequelize[_0xb251('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb251('0x4')]},'disposition':{'type':Sequelize[_0xb251('0x5')]},'secondDisposition':{'type':Sequelize[_0xb251('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb251('0x5')]},'note':{'type':Sequelize[_0xb251('0x5')]},'phone':{'type':Sequelize[_0xb251('0x5')]},'read1stAt':{'type':Sequelize[_0xb251('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb251('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb251('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb251('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb251('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4300=['out','BOOLEAN','sequelize','STRING','ENUM','DATE'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4300,0x1a6));var _0x0430=function(_0x3fe5ff,_0x5c16e6){_0x3fe5ff=_0x3fe5ff-0x0;var _0x5910dd=_0x4300[_0x3fe5ff];return _0x5910dd;};'use strict';var Sequelize=require(_0x0430('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0430('0x1')]},'secondDisposition':{'type':Sequelize[_0x0430('0x1')]},'thirdDisposition':{'type':Sequelize[_0x0430('0x1')]},'note':{'type':Sequelize[_0x0430('0x1')]},'phone':{'type':Sequelize[_0x0430('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0430('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0430('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0430('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0430('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1ccb9bb..79b1963 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 _0xca8a=['tmp','root','format','transcript-%d-%s.zip','push','User','firstName','lastName','Attachment','Messages','createdAt','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','disposition','existsSync','pipe','createWriteStream','basename','direction','out','Contact','secret','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','show','params','model','keys','filters','attributes','intersection','fields','length','merge','options','find','catch','body','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','where','pick','WhatsappInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','server','files'];(function(_0xec9e46,_0x4ea470){var _0x5c8bdc=function(_0x1138f9){while(--_0x1138f9){_0xec9e46['push'](_0xec9e46['shift']());}};_0x5c8bdc(++_0x4ea470);}(_0xca8a,0xa3));var _0xaca8=function(_0x418a5a,_0x2a82f2){_0x418a5a=_0x418a5a-0x0;var _0x1ebd86=_0xca8a[_0x418a5a];return _0x1ebd86;};'use strict';var rimraf=require(_0xaca8('0x0'));var zipdir=require('zip-dir');var moment=require(_0xaca8('0x1'));var BPromise=require(_0xaca8('0x2'));var util=require('util');var path=require(_0xaca8('0x3'));var ejs=require(_0xaca8('0x4'));var fs=require('fs');var _=require(_0xaca8('0x5'));var Redis=require('ioredis');var interaction=require(_0xaca8('0x6'));var qs=require(_0xaca8('0x7'));var pdf=require(_0xaca8('0x8'));var logger=require('../../config/logger')(_0xaca8('0x9'));var config=require(_0xaca8('0xa'));var db=require(_0xaca8('0xb'))['db'];config[_0xaca8('0xc')]=_[_0xaca8('0xd')](config[_0xaca8('0xc')],{'host':_0xaca8('0xe'),'port':0x18eb});var socket=require(_0xaca8('0xf'))(new Redis(config[_0xaca8('0xc')]));require(_0xaca8('0x10'))[_0xaca8('0x11')](socket);function respondWithStatusCode(_0x32e49e,_0x37ee3a){_0x37ee3a=_0x37ee3a||0xcc;return function(_0x4718e8){if(_0x4718e8){return _0x32e49e[_0xaca8('0x12')](_0x37ee3a);}return _0x32e49e[_0xaca8('0x13')](_0x37ee3a)[_0xaca8('0x14')]();};}function respondWithResult(_0x311a21,_0x117763){_0x117763=_0x117763||0xc8;return function(_0x1a1869){if(_0x1a1869){return _0x311a21[_0xaca8('0x13')](_0x117763)[_0xaca8('0x15')](_0x1a1869);}};}function respondWithFilteredResult(_0x27eaf8,_0x302afb){return function(_0x2b1817){if(_0x2b1817){var _0x4ea877=typeof _0x302afb[_0xaca8('0x16')]===_0xaca8('0x17')&&typeof _0x302afb[_0xaca8('0x18')]===_0xaca8('0x17');var _0x2a01b6=_0x2b1817['count'];var _0x378c89=_0x4ea877?0x0:_0x302afb[_0xaca8('0x16')];var _0x174b34=_0x4ea877?_0x2b1817[_0xaca8('0x19')]:_0x302afb[_0xaca8('0x16')]+_0x302afb[_0xaca8('0x18')];var _0x1c6604;if(_0x174b34>=_0x2a01b6){_0x174b34=_0x2a01b6;_0x1c6604=0xc8;}else{_0x1c6604=0xce;}_0x27eaf8[_0xaca8('0x13')](_0x1c6604);return _0x27eaf8[_0xaca8('0x1a')](_0xaca8('0x1b'),_0x378c89+'-'+_0x174b34+'/'+_0x2a01b6)['json'](_0x2b1817);}return null;};}function saveUpdates(_0x5408dd){return function(_0xc0164){if(_0xc0164){return _0xc0164[_0xaca8('0x1c')](_0x5408dd)[_0xaca8('0x1d')](function(_0xa68ac2){return _0xa68ac2;});}return null;};}function removeEntity(_0x2d5fa3){return function(_0x2782fe){if(_0x2782fe){return _0x2782fe[_0xaca8('0x1e')]()['then'](function(){_0x2d5fa3[_0xaca8('0x13')](0xcc)[_0xaca8('0x14')]();});}};}function handleEntityNotFound(_0x51f0d9){return function(_0x1fb91c){if(!_0x1fb91c){_0x51f0d9['sendStatus'](0x194);}return _0x1fb91c;};}function handleError(_0x3606a4,_0x24a6ed){_0x24a6ed=_0x24a6ed||0x1f4;return function(_0x386eeb){logger['error'](_0x386eeb[_0xaca8('0x1f')]);if(_0x386eeb[_0xaca8('0x20')]){delete _0x386eeb[_0xaca8('0x20')];}_0x3606a4['status'](_0x24a6ed)[_0xaca8('0x21')](_0x386eeb);};}exports[_0xaca8('0x22')]=function(_0x43cb50,_0x39b710){var _0x1cbad1={};var _0x5c8fa5=_['map'](db[_0xaca8('0x23')][_0xaca8('0x24')],function(_0x349782){return{'name':_0x349782[_0xaca8('0x25')],'type':_0x349782[_0xaca8('0x26')][_0xaca8('0x27')]};});_0x1cbad1=qs['getOptions'](_0x5c8fa5,_0x43cb50);return interaction[_0xaca8('0x28')](_0xaca8('0x29'),_0x43cb50[_0xaca8('0x2a')],_0x43cb50[_0xaca8('0x2b')],_0x1cbad1,_0x5c8fa5)['then'](respondWithFilteredResult(_0x39b710,_0x1cbad1))['catch'](handleError(_0x39b710,null));};exports[_0xaca8('0x2c')]=function(_0xfd388f,_0x54325e){var _0x2c9dc3={'raw':![],'where':{'id':_0xfd388f[_0xaca8('0x2d')]['id']}},_0x1fa5c6={};_0x1fa5c6[_0xaca8('0x2e')]=_[_0xaca8('0x2f')](db[_0xaca8('0x23')]['rawAttributes']);_0x1fa5c6[_0xaca8('0x2a')]=_[_0xaca8('0x2f')](_0xfd388f['query']);_0x1fa5c6[_0xaca8('0x30')]=_['intersection'](_0x1fa5c6[_0xaca8('0x2e')],_0x1fa5c6['query']);_0x2c9dc3[_0xaca8('0x31')]=_[_0xaca8('0x32')](_0x1fa5c6[_0xaca8('0x2e')],qs[_0xaca8('0x33')](_0xfd388f[_0xaca8('0x2a')][_0xaca8('0x33')]));_0x2c9dc3['attributes']=_0x2c9dc3['attributes'][_0xaca8('0x34')]?_0x2c9dc3[_0xaca8('0x31')]:_0x1fa5c6['model'];if(_0xfd388f[_0xaca8('0x2a')]['includeAll']){_0x2c9dc3['include']=[{'all':!![]}];}_0x2c9dc3=_[_0xaca8('0x35')]({},_0x2c9dc3,_0xfd388f[_0xaca8('0x36')]);return db['WhatsappInteraction'][_0xaca8('0x37')](_0x2c9dc3)[_0xaca8('0x1d')](handleEntityNotFound(_0x54325e,null))['then'](respondWithResult(_0x54325e,null))[_0xaca8('0x38')](handleError(_0x54325e,null));};exports['create']=function(_0xec53df,_0x42d6cd){return db['WhatsappInteraction']['create'](_0xec53df[_0xaca8('0x39')],{})['then'](respondWithResult(_0x42d6cd,0xc9))['catch'](handleError(_0x42d6cd,null));};exports[_0xaca8('0x1c')]=function(_0x6fe64f,_0xf711c8){if(_0x6fe64f['body']['id']){delete _0x6fe64f[_0xaca8('0x39')]['id'];}return db[_0xaca8('0x23')][_0xaca8('0x37')]({'where':{'id':_0x6fe64f[_0xaca8('0x2d')]['id']}})[_0xaca8('0x1d')](handleEntityNotFound(_0xf711c8,null))[_0xaca8('0x1d')](saveUpdates(_0x6fe64f[_0xaca8('0x39')],null))[_0xaca8('0x1d')](respondWithResult(_0xf711c8,null))[_0xaca8('0x38')](handleError(_0xf711c8,null));};exports[_0xaca8('0x1e')]=function(_0x4333c2,_0x13041a){return db['WhatsappInteraction'][_0xaca8('0x37')]({'where':{'id':_0x4333c2['params']['id']}})[_0xaca8('0x1d')](handleEntityNotFound(_0x13041a,null))[_0xaca8('0x1d')](removeEntity(_0x13041a,null))[_0xaca8('0x38')](handleError(_0x13041a,null));};exports[_0xaca8('0x3a')]=function(_0xb51a56,_0x148758){return db['WhatsappInteraction'][_0xaca8('0x3a')]()[_0xaca8('0x1d')](respondWithResult(_0x148758,null))[_0xaca8('0x38')](handleError(_0x148758,null));};exports[_0xaca8('0x3b')]=function(_0x109958,_0x299786){return db[_0xaca8('0x3c')][_0xaca8('0x37')]({'where':{'id':_0x109958[_0xaca8('0x2d')]['id']}})['then'](handleEntityNotFound(_0x299786,null))[_0xaca8('0x1d')](function(_0x4b55a2){if(_0x4b55a2){return _0x4b55a2['addMessage'](_0x109958['body'][_0xaca8('0x3d')],_[_0xaca8('0x3e')](_0x109958['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x299786,null))[_0xaca8('0x38')](handleError(_0x299786,null));};exports['getMessages']=function(_0x2392d5,_0x21be84){var _0x55af36={'raw':![],'where':{}};var _0x3f5436={};var _0x25dbcf={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xaca8('0x3f')]({'where':{'id':_0x2392d5['params']['id']}})[_0xaca8('0x1d')](handleEntityNotFound(_0x21be84,null))[_0xaca8('0x1d')](function(_0x1447fb){if(_0x1447fb){_0x3f5436[_0xaca8('0x2e')]=_['keys'](db[_0xaca8('0x3c')][_0xaca8('0x24')]);_0x3f5436[_0xaca8('0x2a')]=_['keys'](_0x2392d5[_0xaca8('0x2a')]);_0x3f5436[_0xaca8('0x30')]=_[_0xaca8('0x32')](_0x3f5436[_0xaca8('0x2e')],_0x3f5436[_0xaca8('0x2a')]);_0x55af36[_0xaca8('0x31')]=_[_0xaca8('0x32')](_0x3f5436[_0xaca8('0x2e')],qs['fields'](_0x2392d5[_0xaca8('0x2a')]['fields']));_0x55af36['attributes']=_0x55af36[_0xaca8('0x31')][_0xaca8('0x34')]?_0x55af36[_0xaca8('0x31')]:_0x3f5436[_0xaca8('0x2e')];if(!_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x40')]('nolimit')){_0x55af36[_0xaca8('0x18')]=qs[_0xaca8('0x18')](_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x18')]);_0x55af36[_0xaca8('0x16')]=qs[_0xaca8('0x16')](_0x2392d5['query']['offset']);}_0x55af36['order']=qs['sort'](_0x2392d5[_0xaca8('0x2a')]['sort']);_0x55af36[_0xaca8('0x41')]=qs['filters'](_[_0xaca8('0x42')](_0x2392d5[_0xaca8('0x2a')],_0x3f5436[_0xaca8('0x30')]));_0x55af36['where'][_0xaca8('0x43')]=_0x1447fb['id'];if(_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x44')]){_0x55af36[_0xaca8('0x41')]=_[_0xaca8('0x35')](_0x55af36[_0xaca8('0x41')],{'$or':_[_0xaca8('0x45')](_0x55af36['attributes'],function(_0x31d669){var _0x9b7f13={};_0x9b7f13[_0x31d669]={'$like':'%'+_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x44')]+'%'};return _0x9b7f13;})});}if(_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x46')]){var _0x1371f4=_0x2392d5[_0xaca8('0x2a')][_0xaca8('0x46')][_0xaca8('0x47')](',');var _0x586a55={};_0x586a55[_0x1371f4[0x0]]={'$gte':moment(_0x1371f4[0x1])['format'](_0xaca8('0x48'))};_0x55af36[_0xaca8('0x41')]=_[_0xaca8('0x35')](_0x55af36[_0xaca8('0x41')],_0x586a55);}_0x55af36=_['merge']({},_0x55af36,_0x2392d5[_0xaca8('0x36')]);return db[_0xaca8('0x3c')][_0xaca8('0x19')]({'where':_0x55af36[_0xaca8('0x41')]})[_0xaca8('0x1d')](function(_0xd17112){_0x25dbcf[_0xaca8('0x19')]=_0xd17112;if(_0x2392d5['query'][_0xaca8('0x49')]){_0x55af36[_0xaca8('0x4a')]=[{'all':!![]}];}return db[_0xaca8('0x3c')][_0xaca8('0x28')](_0x55af36);})[_0xaca8('0x1d')](function(_0x3428d9){_0x25dbcf[_0xaca8('0x4b')]=_0x3428d9;return _0x25dbcf;});}})[_0xaca8('0x1d')](respondWithFilteredResult(_0x21be84,_0x55af36))[_0xaca8('0x38')](handleError(_0x21be84,null));};exports['addTags']=function(_0x245739,_0x55ed7c){return db[_0xaca8('0x23')][_0xaca8('0x37')]({'where':{'id':_0x245739['params']['id']}})[_0xaca8('0x1d')](handleEntityNotFound(_0x55ed7c,null))[_0xaca8('0x1d')](function(_0x1d3985){if(_0x1d3985){return _0x1d3985[_0xaca8('0x4c')](_0x245739[_0xaca8('0x39')][_0xaca8('0x3d')],_[_0xaca8('0x3e')](_0x245739[_0xaca8('0x39')],[_0xaca8('0x3d'),'id'])||{})['spread'](function(){return db[_0xaca8('0x4d')][_0xaca8('0x28')]({'attributes':['id',_0xaca8('0x20'),_0xaca8('0x4e')],'where':{'id':_0x245739['body'][_0xaca8('0x3d')]}});})[_0xaca8('0x1d')](function(_0x4e7977){socket[_0xaca8('0x4f')](_0xaca8('0x50'),{'id':Number(_0x245739[_0xaca8('0x2d')]['id']),'tags':_0x4e7977||[]});return{'id':Number(_0x245739[_0xaca8('0x2d')]['id']),'tags':_0x4e7977||[]};});}})[_0xaca8('0x1d')](respondWithResult(_0x55ed7c,null))[_0xaca8('0x38')](handleError(_0x55ed7c,null));};exports['removeTags']=function(_0x1f75bf,_0x345763){return db[_0xaca8('0x23')][_0xaca8('0x37')]({'where':{'id':_0x1f75bf[_0xaca8('0x2d')]['id']}})[_0xaca8('0x1d')](handleEntityNotFound(_0x345763,null))[_0xaca8('0x1d')](function(_0x446236){if(_0x446236){return _0x446236[_0xaca8('0x51')](_0x1f75bf['query']['ids']);}})[_0xaca8('0x1d')](respondWithStatusCode(_0x345763,null))[_0xaca8('0x38')](handleError(_0x345763,null));};exports[_0xaca8('0x52')]=function(_0x1c6778,_0x9dbdb9){var _0x1dc747=moment()['unix']()[_0xaca8('0x53')]();var _0x3d7854=path[_0xaca8('0x54')](config['root'],_0xaca8('0x55'),_0xaca8('0x56'),_0xaca8('0x57'));var _0x2e8566=path[_0xaca8('0x54')](config[_0xaca8('0x58')],'server','files','attachments');var _0x382d32=path[_0xaca8('0x54')](_0x3d7854,_0x1dc747);var _0x208b63=util[_0xaca8('0x59')](_0xaca8('0x5a'),_0x1c6778['params']['id'],_0x1dc747);var _0xd8fca7=path['join'](_0x3d7854,_0x208b63);var _0x377cf9=[];_0x377cf9[_0xaca8('0x5b')]({'model':db[_0xaca8('0x5c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x377cf9[_0xaca8('0x5b')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xaca8('0x5d'),_0xaca8('0x5e')],'raw':!![]});if(_0x1c6778[_0xaca8('0x2a')]['attachments']){_0x377cf9[_0xaca8('0x5b')]({'model':db[_0xaca8('0x5f')],'as':'Attachment','raw':!![]});}var _0x481930=[{'model':db[_0xaca8('0x3c')],'as':_0xaca8('0x60'),'attributes':['id','body',_0xaca8('0x61'),'direction','secret',_0xaca8('0x62')],'include':_0x377cf9}];_0x481930[_0xaca8('0x5b')]({'model':db[_0xaca8('0x63')],'as':_0xaca8('0x64'),'attributes':['id',_0xaca8('0x20')]});_0x481930[_0xaca8('0x5b')]({'model':db[_0xaca8('0x5c')],'as':_0xaca8('0x65'),'attributes':['id',_0xaca8('0x66')]});return db[_0xaca8('0x23')][_0xaca8('0x37')]({'where':{'id':_0x1c6778['params']['id']},'include':_0x481930})[_0xaca8('0x1d')](handleEntityNotFound(_0x9dbdb9,null))[_0xaca8('0x1d')](function(_0x6b7626){if(_0x6b7626){var _0x3797f2=_0x6b7626[_0xaca8('0x67')]({'plain':!![]});fs[_0xaca8('0x68')](_0x382d32);var _0x5c91f5={'channel':_0xaca8('0x69'),'account':_0x3797f2[_0xaca8('0x64')]['name'],'agent':_0x3797f2[_0xaca8('0x65')]?_0x3797f2[_0xaca8('0x65')][_0xaca8('0x66')]:_0xaca8('0x6a'),'createdAt':moment(_0x3797f2[_0xaca8('0x61')])[_0xaca8('0x59')](_0xaca8('0x48'))[_0xaca8('0x53')](),'closedAt':_0x3797f2[_0xaca8('0x6b')]?moment(_0x3797f2['closedAt'])['format'](_0xaca8('0x48'))[_0xaca8('0x53')]():'','disposition':_0x3797f2[_0xaca8('0x6c')],'messages':_(_0x3797f2[_0xaca8('0x60')])[_0xaca8('0x44')]({'secret':![]})['map'](function(_0x1f206c){if(_0x1f206c[_0xaca8('0x5f')]){var _0x422846=path[_0xaca8('0x54')](_0x2e8566,_0x1f206c[_0xaca8('0x5f')]['basename']);if(fs[_0xaca8('0x6d')](_0x422846)){fs['createReadStream'](_0x422846)[_0xaca8('0x6e')](fs[_0xaca8('0x6f')](path[_0xaca8('0x54')](_0x382d32,_0x1f206c[_0xaca8('0x5f')][_0xaca8('0x70')])));}}return{'date':moment(_0x1f206c[_0xaca8('0x61')])['format'](_0xaca8('0x48'))[_0xaca8('0x53')](),'sender':_0x1f206c[_0xaca8('0x71')]===_0xaca8('0x72')?_0x1f206c[_0xaca8('0x5c')]?_0x1f206c[_0xaca8('0x5c')][_0xaca8('0x66')]:'System':_0x1f206c[_0xaca8('0x73')]['firstName']+(_0x1f206c['Contact'][_0xaca8('0x5e')]?'\x20'+_0x1f206c[_0xaca8('0x73')][_0xaca8('0x5e')]:''),'body':_0x1f206c[_0xaca8('0x5f')]?_0x1f206c[_0xaca8('0x5f')][_0xaca8('0x70')]:_0x1f206c[_0xaca8('0x39')],'direction':_0x1f206c[_0xaca8('0x71')]===_0xaca8('0x72')?'A':'C','secret':_0x1f206c[_0xaca8('0x74')],'read':_0x1f206c[_0xaca8('0x62')],'attachment':_0x1f206c['Attachment']};})[_0xaca8('0x75')]()};return ejs['renderFile'](path[_0xaca8('0x54')](config[_0xaca8('0x58')],_0xaca8('0x55'),_0xaca8('0x76'),_0xaca8('0x77')),{'interaction':_0x5c91f5})[_0xaca8('0x1d')](function(_0x45353f){var _0x235d6b=path[_0xaca8('0x54')](_0x382d32,_0xaca8('0x78')+_0x3797f2['id']+'-'+_0x1dc747+'.pdf');var _0x396fca={'path':_0x235d6b,'channel':_0xaca8('0x69'),'interactionId':_0x3797f2['id']};return pdf[_0xaca8('0x79')](_0x45353f,_0x396fca);})[_0xaca8('0x1d')](function(){return new BPromise(function(_0x39bfb8,_0x147b64){zipdir(_0x382d32,{'saveTo':_0xd8fca7},function(_0x1be15d,_0x1776db){if(_0x1be15d)return _0x147b64(_0x1be15d);return _0x39bfb8(_0x1776db);});})[_0xaca8('0x1d')](function(){return new BPromise(function(_0x22f8f0,_0x24ac91){rimraf(_0x382d32,function(_0x1107f3){if(_0x1107f3)_0x24ac91(_0x1107f3);return _0x22f8f0();});});})[_0xaca8('0x1d')](function(){return _0x9dbdb9[_0xaca8('0x52')](_0xd8fca7,_0x208b63,function(_0x5856da){if(_0x5856da){console[_0xaca8('0x7a')](_0xaca8('0x7b'),_0x5856da);}else{fs[_0xaca8('0x7c')](_0xd8fca7);}});});});}else{return _0x9dbdb9['sendStatus'](0xc8);}})[_0xaca8('0x38')](handleError(_0x9dbdb9,null));}; \ No newline at end of file +var _0x4a5f=['query','catch','params','model','keys','filters','intersection','fields','attributes','includeAll','include','options','find','create','body','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','length','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','split','rows','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','server','tmp','root','files','attachments','format','transcript-%d-%s.zip','User','push','Contact','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','fullname','get','mkdirSync','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','toString','disposition','basename','createReadStream','pipe','createWriteStream','System','firstName','lastName','out','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','then','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp'];(function(_0x34bcf6,_0x2cc521){var _0x54adc9=function(_0x2a8f15){while(--_0x2a8f15){_0x34bcf6['push'](_0x34bcf6['shift']());}};_0x54adc9(++_0x2cc521);}(_0x4a5f,0xda));var _0xf4a5=function(_0x422ccf,_0x444ffd){_0x422ccf=_0x422ccf-0x0;var _0x36aeef=_0x4a5f[_0x422ccf];return _0x36aeef;};'use strict';var rimraf=require(_0xf4a5('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf4a5('0x1'));var BPromise=require(_0xf4a5('0x2'));var util=require(_0xf4a5('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf4a5('0x4'));var Redis=require(_0xf4a5('0x5'));var interaction=require(_0xf4a5('0x6'));var qs=require(_0xf4a5('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xf4a5('0x8'))('api');var config=require(_0xf4a5('0x9'));var db=require(_0xf4a5('0xa'))['db'];config[_0xf4a5('0xb')]=_[_0xf4a5('0xc')](config[_0xf4a5('0xb')],{'host':_0xf4a5('0xd'),'port':0x18eb});var socket=require(_0xf4a5('0xe'))(new Redis(config[_0xf4a5('0xb')]));require(_0xf4a5('0xf'))[_0xf4a5('0x10')](socket);function respondWithStatusCode(_0x2dc6fc,_0x3410ed){_0x3410ed=_0x3410ed||0xcc;return function(_0x57a02f){if(_0x57a02f){return _0x2dc6fc[_0xf4a5('0x11')](_0x3410ed);}return _0x2dc6fc[_0xf4a5('0x12')](_0x3410ed)[_0xf4a5('0x13')]();};}function respondWithResult(_0x53fc3a,_0x5eaab7){_0x5eaab7=_0x5eaab7||0xc8;return function(_0x16910f){if(_0x16910f){return _0x53fc3a[_0xf4a5('0x12')](_0x5eaab7)[_0xf4a5('0x14')](_0x16910f);}};}function respondWithFilteredResult(_0x23d0f4,_0x243595){return function(_0x419fa9){if(_0x419fa9){var _0x3cd73f=typeof _0x243595[_0xf4a5('0x15')]===_0xf4a5('0x16')&&typeof _0x243595[_0xf4a5('0x17')]===_0xf4a5('0x16');var _0x5376c8=_0x419fa9[_0xf4a5('0x18')];var _0x16dea2=_0x3cd73f?0x0:_0x243595[_0xf4a5('0x15')];var _0xfc34c=_0x3cd73f?_0x419fa9[_0xf4a5('0x18')]:_0x243595[_0xf4a5('0x15')]+_0x243595[_0xf4a5('0x17')];var _0x575438;if(_0xfc34c>=_0x5376c8){_0xfc34c=_0x5376c8;_0x575438=0xc8;}else{_0x575438=0xce;}_0x23d0f4['status'](_0x575438);return _0x23d0f4['set']('Content-Range',_0x16dea2+'-'+_0xfc34c+'/'+_0x5376c8)[_0xf4a5('0x14')](_0x419fa9);}return null;};}function saveUpdates(_0x25651c){return function(_0x343769){if(_0x343769){return _0x343769[_0xf4a5('0x19')](_0x25651c)['then'](function(_0x313d93){return _0x313d93;});}return null;};}function removeEntity(_0x559074){return function(_0x5df2d8){if(_0x5df2d8){return _0x5df2d8[_0xf4a5('0x1a')]()[_0xf4a5('0x1b')](function(){_0x559074[_0xf4a5('0x12')](0xcc)[_0xf4a5('0x13')]();});}};}function handleEntityNotFound(_0x33b181){return function(_0x57f7d2){if(!_0x57f7d2){_0x33b181[_0xf4a5('0x11')](0x194);}return _0x57f7d2;};}function handleError(_0x5b0405,_0x145b84){_0x145b84=_0x145b84||0x1f4;return function(_0x672eab){logger[_0xf4a5('0x1c')](_0x672eab[_0xf4a5('0x1d')]);if(_0x672eab[_0xf4a5('0x1e')]){delete _0x672eab[_0xf4a5('0x1e')];}_0x5b0405[_0xf4a5('0x12')](_0x145b84)['send'](_0x672eab);};}exports[_0xf4a5('0x1f')]=function(_0x5cf583,_0x53f461){var _0x1403d0={};var _0x31180a=_[_0xf4a5('0x20')](db[_0xf4a5('0x21')][_0xf4a5('0x22')],function(_0x267fa0){return{'name':_0x267fa0[_0xf4a5('0x23')],'type':_0x267fa0[_0xf4a5('0x24')][_0xf4a5('0x25')]};});_0x1403d0=qs['getOptions'](_0x31180a,_0x5cf583);return interaction[_0xf4a5('0x26')](_0xf4a5('0x27'),_0x5cf583[_0xf4a5('0x28')],_0x5cf583['user'],_0x1403d0,_0x31180a)[_0xf4a5('0x1b')](respondWithFilteredResult(_0x53f461,_0x1403d0))[_0xf4a5('0x29')](handleError(_0x53f461,null));};exports['show']=function(_0x4b54d7,_0x3e6fcd){var _0x179f39={'raw':![],'where':{'id':_0x4b54d7[_0xf4a5('0x2a')]['id']}},_0x172190={};_0x172190[_0xf4a5('0x2b')]=_[_0xf4a5('0x2c')](db[_0xf4a5('0x21')][_0xf4a5('0x22')]);_0x172190[_0xf4a5('0x28')]=_[_0xf4a5('0x2c')](_0x4b54d7['query']);_0x172190[_0xf4a5('0x2d')]=_[_0xf4a5('0x2e')](_0x172190['model'],_0x172190[_0xf4a5('0x28')]);_0x179f39['attributes']=_[_0xf4a5('0x2e')](_0x172190[_0xf4a5('0x2b')],qs[_0xf4a5('0x2f')](_0x4b54d7[_0xf4a5('0x28')][_0xf4a5('0x2f')]));_0x179f39['attributes']=_0x179f39[_0xf4a5('0x30')]['length']?_0x179f39[_0xf4a5('0x30')]:_0x172190[_0xf4a5('0x2b')];if(_0x4b54d7[_0xf4a5('0x28')][_0xf4a5('0x31')]){_0x179f39[_0xf4a5('0x32')]=[{'all':!![]}];}_0x179f39=_['merge']({},_0x179f39,_0x4b54d7[_0xf4a5('0x33')]);return db[_0xf4a5('0x21')][_0xf4a5('0x34')](_0x179f39)[_0xf4a5('0x1b')](handleEntityNotFound(_0x3e6fcd,null))[_0xf4a5('0x1b')](respondWithResult(_0x3e6fcd,null))[_0xf4a5('0x29')](handleError(_0x3e6fcd,null));};exports['create']=function(_0x404a37,_0x5ccabf){return db[_0xf4a5('0x21')][_0xf4a5('0x35')](_0x404a37[_0xf4a5('0x36')],{})[_0xf4a5('0x1b')](respondWithResult(_0x5ccabf,0xc9))['catch'](handleError(_0x5ccabf,null));};exports[_0xf4a5('0x19')]=function(_0x8d76fe,_0x2b2a06){if(_0x8d76fe[_0xf4a5('0x36')]['id']){delete _0x8d76fe[_0xf4a5('0x36')]['id'];}return db[_0xf4a5('0x21')][_0xf4a5('0x34')]({'where':{'id':_0x8d76fe[_0xf4a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2b2a06,null))[_0xf4a5('0x1b')](saveUpdates(_0x8d76fe[_0xf4a5('0x36')],null))['then'](respondWithResult(_0x2b2a06,null))['catch'](handleError(_0x2b2a06,null));};exports[_0xf4a5('0x1a')]=function(_0x1e4daf,_0x404d05){return db[_0xf4a5('0x21')]['find']({'where':{'id':_0x1e4daf[_0xf4a5('0x2a')]['id']}})[_0xf4a5('0x1b')](handleEntityNotFound(_0x404d05,null))[_0xf4a5('0x1b')](removeEntity(_0x404d05,null))['catch'](handleError(_0x404d05,null));};exports[_0xf4a5('0x37')]=function(_0x3a8af6,_0xe7ff8e){return db[_0xf4a5('0x21')][_0xf4a5('0x37')]()['then'](respondWithResult(_0xe7ff8e,null))[_0xf4a5('0x29')](handleError(_0xe7ff8e,null));};exports[_0xf4a5('0x38')]=function(_0x5e58a0,_0x36f4b4){return db['WhatsappMessage'][_0xf4a5('0x34')]({'where':{'id':_0x5e58a0['params']['id']}})[_0xf4a5('0x1b')](handleEntityNotFound(_0x36f4b4,null))[_0xf4a5('0x1b')](function(_0x2328eb){if(_0x2328eb){return _0x2328eb['addMessage'](_0x5e58a0[_0xf4a5('0x36')][_0xf4a5('0x39')],_['omit'](_0x5e58a0[_0xf4a5('0x36')],['ids','id'])||{});}})[_0xf4a5('0x1b')](respondWithResult(_0x36f4b4,null))[_0xf4a5('0x29')](handleError(_0x36f4b4,null));};exports[_0xf4a5('0x3a')]=function(_0x189efa,_0x3d9519){var _0x2406f2={'raw':![],'where':{}};var _0x32cacf={};var _0x2663c6={'count':0x0,'rows':[]};return db[_0xf4a5('0x21')][_0xf4a5('0x3b')]({'where':{'id':_0x189efa['params']['id']}})[_0xf4a5('0x1b')](handleEntityNotFound(_0x3d9519,null))['then'](function(_0x12067a){if(_0x12067a){_0x32cacf[_0xf4a5('0x2b')]=_[_0xf4a5('0x2c')](db[_0xf4a5('0x3c')][_0xf4a5('0x22')]);_0x32cacf[_0xf4a5('0x28')]=_[_0xf4a5('0x2c')](_0x189efa[_0xf4a5('0x28')]);_0x32cacf['filters']=_[_0xf4a5('0x2e')](_0x32cacf[_0xf4a5('0x2b')],_0x32cacf[_0xf4a5('0x28')]);_0x2406f2['attributes']=_[_0xf4a5('0x2e')](_0x32cacf['model'],qs['fields'](_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x2f')]));_0x2406f2[_0xf4a5('0x30')]=_0x2406f2[_0xf4a5('0x30')][_0xf4a5('0x3d')]?_0x2406f2[_0xf4a5('0x30')]:_0x32cacf['model'];if(!_0x189efa['query'][_0xf4a5('0x3e')](_0xf4a5('0x3f'))){_0x2406f2[_0xf4a5('0x17')]=qs['limit'](_0x189efa['query']['limit']);_0x2406f2['offset']=qs[_0xf4a5('0x15')](_0x189efa['query']['offset']);}_0x2406f2[_0xf4a5('0x40')]=qs[_0xf4a5('0x41')](_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x41')]);_0x2406f2[_0xf4a5('0x42')]=qs['filters'](_['pick'](_0x189efa[_0xf4a5('0x28')],_0x32cacf[_0xf4a5('0x2d')]));_0x2406f2[_0xf4a5('0x42')][_0xf4a5('0x43')]=_0x12067a['id'];if(_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x44')]){_0x2406f2[_0xf4a5('0x42')]=_[_0xf4a5('0x45')](_0x2406f2[_0xf4a5('0x42')],{'$or':_[_0xf4a5('0x20')](_0x2406f2[_0xf4a5('0x30')],function(_0x476995){var _0xf8b39f={};_0xf8b39f[_0x476995]={'$like':'%'+_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x44')]+'%'};return _0xf8b39f;})});}if(_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x46')]){var _0x21ec4c=_0x189efa['query'][_0xf4a5('0x46')][_0xf4a5('0x47')](',');var _0x1fe9c9={};_0x1fe9c9[_0x21ec4c[0x0]]={'$gte':moment(_0x21ec4c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2406f2[_0xf4a5('0x42')]=_['merge'](_0x2406f2['where'],_0x1fe9c9);}_0x2406f2=_[_0xf4a5('0x45')]({},_0x2406f2,_0x189efa['options']);return db[_0xf4a5('0x3c')][_0xf4a5('0x18')]({'where':_0x2406f2[_0xf4a5('0x42')]})[_0xf4a5('0x1b')](function(_0x12f74f){_0x2663c6[_0xf4a5('0x18')]=_0x12f74f;if(_0x189efa[_0xf4a5('0x28')][_0xf4a5('0x31')]){_0x2406f2[_0xf4a5('0x32')]=[{'all':!![]}];}return db[_0xf4a5('0x3c')]['findAll'](_0x2406f2);})[_0xf4a5('0x1b')](function(_0x428cde){_0x2663c6[_0xf4a5('0x48')]=_0x428cde;return _0x2663c6;});}})['then'](respondWithFilteredResult(_0x3d9519,_0x2406f2))[_0xf4a5('0x29')](handleError(_0x3d9519,null));};exports[_0xf4a5('0x49')]=function(_0x2470a0,_0x2cdad9){return db[_0xf4a5('0x21')]['find']({'where':{'id':_0x2470a0[_0xf4a5('0x2a')]['id']}})[_0xf4a5('0x1b')](handleEntityNotFound(_0x2cdad9,null))[_0xf4a5('0x1b')](function(_0x5e9bde){if(_0x5e9bde){return _0x5e9bde[_0xf4a5('0x4a')](_0x2470a0[_0xf4a5('0x36')][_0xf4a5('0x39')],_[_0xf4a5('0x4b')](_0x2470a0[_0xf4a5('0x36')],[_0xf4a5('0x39'),'id'])||{})[_0xf4a5('0x4c')](function(){return db[_0xf4a5('0x4d')][_0xf4a5('0x26')]({'attributes':['id',_0xf4a5('0x1e'),_0xf4a5('0x4e')],'where':{'id':_0x2470a0['body'][_0xf4a5('0x39')]}});})[_0xf4a5('0x1b')](function(_0x18575d){socket[_0xf4a5('0x4f')](_0xf4a5('0x50'),{'id':Number(_0x2470a0['params']['id']),'tags':_0x18575d||[]});return{'id':Number(_0x2470a0[_0xf4a5('0x2a')]['id']),'tags':_0x18575d||[]};});}})['then'](respondWithResult(_0x2cdad9,null))[_0xf4a5('0x29')](handleError(_0x2cdad9,null));};exports[_0xf4a5('0x51')]=function(_0x1d3511,_0x26dbcc){return db[_0xf4a5('0x21')]['find']({'where':{'id':_0x1d3511['params']['id']}})[_0xf4a5('0x1b')](handleEntityNotFound(_0x26dbcc,null))[_0xf4a5('0x1b')](function(_0x1511ee){if(_0x1511ee){return _0x1511ee['removeTags'](_0x1d3511['query'][_0xf4a5('0x39')]);}})[_0xf4a5('0x1b')](respondWithStatusCode(_0x26dbcc,null))[_0xf4a5('0x29')](handleError(_0x26dbcc,null));};exports[_0xf4a5('0x52')]=function(_0x29f155,_0x2cfb3f){var _0x3c9e46=moment()['unix']()['toString']();var _0x193124=path[_0xf4a5('0x53')](config['root'],_0xf4a5('0x54'),'files',_0xf4a5('0x55'));var _0x280d21=path[_0xf4a5('0x53')](config[_0xf4a5('0x56')],'server',_0xf4a5('0x57'),_0xf4a5('0x58'));var _0x57c889=path['join'](_0x193124,_0x3c9e46);var _0x48c381=util[_0xf4a5('0x59')](_0xf4a5('0x5a'),_0x29f155['params']['id'],_0x3c9e46);var _0x1299e4=path[_0xf4a5('0x53')](_0x193124,_0x48c381);var _0xba7dd5=[];_0xba7dd5['push']({'model':db[_0xf4a5('0x5b')],'as':_0xf4a5('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0xba7dd5[_0xf4a5('0x5c')]({'model':db['CmContact'],'as':_0xf4a5('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x29f155[_0xf4a5('0x28')][_0xf4a5('0x58')]){_0xba7dd5['push']({'model':db[_0xf4a5('0x5e')],'as':_0xf4a5('0x5e'),'raw':!![]});}var _0x17c1a8=[{'model':db[_0xf4a5('0x3c')],'as':_0xf4a5('0x5f'),'attributes':['id',_0xf4a5('0x36'),_0xf4a5('0x60'),_0xf4a5('0x61'),_0xf4a5('0x62'),'read'],'include':_0xba7dd5}];_0x17c1a8[_0xf4a5('0x5c')]({'model':db[_0xf4a5('0x63')],'as':_0xf4a5('0x64'),'attributes':['id',_0xf4a5('0x1e')]});_0x17c1a8[_0xf4a5('0x5c')]({'model':db[_0xf4a5('0x5b')],'as':'Owner','attributes':['id',_0xf4a5('0x65')]});return db[_0xf4a5('0x21')][_0xf4a5('0x34')]({'where':{'id':_0x29f155[_0xf4a5('0x2a')]['id']},'include':_0x17c1a8})[_0xf4a5('0x1b')](handleEntityNotFound(_0x2cfb3f,null))['then'](function(_0x46ec69){if(_0x46ec69){var _0xd57202=_0x46ec69[_0xf4a5('0x66')]({'plain':!![]});fs[_0xf4a5('0x67')](_0x57c889);var _0xd1a757={'channel':_0xf4a5('0x68'),'account':_0xd57202[_0xf4a5('0x64')]['name'],'agent':_0xd57202['Owner']?_0xd57202[_0xf4a5('0x69')][_0xf4a5('0x65')]:_0xf4a5('0x6a'),'createdAt':moment(_0xd57202[_0xf4a5('0x60')])[_0xf4a5('0x59')](_0xf4a5('0x6b'))['toString'](),'closedAt':_0xd57202[_0xf4a5('0x6c')]?moment(_0xd57202[_0xf4a5('0x6d')])[_0xf4a5('0x59')](_0xf4a5('0x6b'))[_0xf4a5('0x6e')]():'','disposition':_0xd57202[_0xf4a5('0x6f')],'messages':_(_0xd57202[_0xf4a5('0x5f')])[_0xf4a5('0x44')]({'secret':![]})[_0xf4a5('0x20')](function(_0x5048e8){if(_0x5048e8[_0xf4a5('0x5e')]){var _0x551d61=path[_0xf4a5('0x53')](_0x280d21,_0x5048e8['Attachment'][_0xf4a5('0x70')]);if(fs['existsSync'](_0x551d61)){fs[_0xf4a5('0x71')](_0x551d61)[_0xf4a5('0x72')](fs[_0xf4a5('0x73')](path[_0xf4a5('0x53')](_0x57c889,_0x5048e8[_0xf4a5('0x5e')]['basename'])));}}return{'date':moment(_0x5048e8['createdAt'])['format'](_0xf4a5('0x6b'))[_0xf4a5('0x6e')](),'sender':_0x5048e8[_0xf4a5('0x61')]==='out'?_0x5048e8[_0xf4a5('0x5b')]?_0x5048e8[_0xf4a5('0x5b')][_0xf4a5('0x65')]:_0xf4a5('0x74'):_0x5048e8[_0xf4a5('0x5d')][_0xf4a5('0x75')]+(_0x5048e8[_0xf4a5('0x5d')][_0xf4a5('0x76')]?'\x20'+_0x5048e8[_0xf4a5('0x5d')]['lastName']:''),'body':_0x5048e8[_0xf4a5('0x5e')]?_0x5048e8[_0xf4a5('0x5e')][_0xf4a5('0x70')]:_0x5048e8['body'],'direction':_0x5048e8[_0xf4a5('0x61')]===_0xf4a5('0x77')?'A':'C','secret':_0x5048e8[_0xf4a5('0x62')],'read':_0x5048e8[_0xf4a5('0x78')],'attachment':_0x5048e8[_0xf4a5('0x5e')]};})['value']()};return ejs[_0xf4a5('0x79')](path[_0xf4a5('0x53')](config[_0xf4a5('0x56')],_0xf4a5('0x54'),_0xf4a5('0x7a'),_0xf4a5('0x7b')),{'interaction':_0xd1a757})[_0xf4a5('0x1b')](function(_0x3b9d27){var _0x5e5081=path['join'](_0x57c889,_0xf4a5('0x7c')+_0xd57202['id']+'-'+_0x3c9e46+_0xf4a5('0x7d'));var _0x3e854f={'path':_0x5e5081,'channel':_0xf4a5('0x68'),'interactionId':_0xd57202['id']};return pdf[_0xf4a5('0x7e')](_0x3b9d27,_0x3e854f);})[_0xf4a5('0x1b')](function(){return new BPromise(function(_0x3481ff,_0x662c8){zipdir(_0x57c889,{'saveTo':_0x1299e4},function(_0x44ba47,_0x5d1065){if(_0x44ba47)return _0x662c8(_0x44ba47);return _0x3481ff(_0x5d1065);});})[_0xf4a5('0x1b')](function(){return new BPromise(function(_0x37e9c6,_0x2c1fc0){rimraf(_0x57c889,function(_0x1b45d9){if(_0x1b45d9)_0x2c1fc0(_0x1b45d9);return _0x37e9c6();});});})[_0xf4a5('0x1b')](function(){return _0x2cfb3f['download'](_0x1299e4,_0x48c381,function(_0x2a4b3d){if(_0x2a4b3d){console['log'](_0xf4a5('0x7f'),_0x2a4b3d);}else{fs[_0xf4a5('0x80')](_0x1299e4);}});});});}else{return _0x2cfb3f[_0xf4a5('0x11')](0xc8);}})[_0xf4a5('0x29')](handleError(_0x2cfb3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 7baa3c6..c56edef 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 _0x0490=['findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x0490,0x147));var _0x0049=function(_0x2468ed,_0x569854){_0x2468ed=_0x2468ed-0x0;var _0x9a3f2c=_0x0490[_0x2468ed];return _0x9a3f2c;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x0049('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0049('0x1'),'afterUpdate':_0x0049('0x2'),'afterDestroy':_0x0049('0x3')};function emitEvent(_0x1f3b3c){return function(_0x2872ec,_0x4a59b9,_0x2957b6){_0x2872ec[_0x0049('0x4')]({'attributes':['id'],'raw':!![]})[_0x0049('0x5')](function(_0x57fca5){_0x2872ec[_0x0049('0x6')](_0x0049('0x7'),_0x57fca5[_0x0049('0x8')](function(_0x58f233){return{'id':_0x58f233['id']};}));return WhatsappMessage[_0x0049('0x9')]({'where':{'WhatsappInteractionId':_0x2872ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0049('0x5')](function(_0x4165c2){_0x2872ec[_0x0049('0x6')](_0x0049('0xa'),_0x4165c2[_0x0049('0xb')]);WhatsappInteractionEvents[_0x0049('0xc')](_0x1f3b3c+':'+_0x2872ec['id'],_0x2872ec);WhatsappInteractionEvents[_0x0049('0xc')](_0x1f3b3c,_0x2872ec);_0x2957b6(null);})[_0x0049('0xd')](_0x2957b6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x0049('0xe')](e,emitEvent(event));}}module[_0x0049('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1a83=['map','findAll','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x491fcd,_0x37e98e){var _0x32b059=function(_0x58fec2){while(--_0x58fec2){_0x491fcd['push'](_0x491fcd['shift']());}};_0x32b059(++_0x37e98e);}(_0x1a83,0x1c0));var _0x31a8=function(_0x4992f2,_0x4aaa3a){_0x4992f2=_0x4992f2-0x0;var _0x5bda79=_0x1a83[_0x4992f2];return _0x5bda79;};'use strict';var EventEmitter=require(_0x31a8('0x0'));var WhatsappInteraction=require(_0x31a8('0x1'))['db'][_0x31a8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x31a8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a8('0x4'),'afterUpdate':_0x31a8('0x5'),'afterDestroy':_0x31a8('0x6')};function emitEvent(_0x26aa71){return function(_0x4f18c3,_0x5e07ea,_0xde01e8){_0x4f18c3[_0x31a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x31a8('0x8')](function(_0x2c4b45){_0x4f18c3[_0x31a8('0x9')](_0x31a8('0xa'),_0x2c4b45[_0x31a8('0xb')](function(_0x12e5c8){return{'id':_0x12e5c8['id']};}));return WhatsappMessage[_0x31a8('0xc')]({'where':{'WhatsappInteractionId':_0x4f18c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31a8('0x8')](function(_0x4f1881){_0x4f18c3[_0x31a8('0x9')]('unreadMessages',_0x4f1881['length']);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71+':'+_0x4f18c3['id'],_0x4f18c3);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71,_0x4f18c3);_0xde01e8(null);})['catch'](_0xde01e8(null));};}for(var e in events){if(events[_0x31a8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x31a8('0xf')](e,emitEvent(event));}}module[_0x31a8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7ce6395..19dcbc6 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 _0xfc98=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x4888f6,_0x1ba211){var _0x2affe1=function(_0x30b7ec){while(--_0x30b7ec){_0x4888f6['push'](_0x4888f6['shift']());}};_0x2affe1(++_0x1ba211);}(_0xfc98,0x194));var _0x8fc9=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xfc98[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x8fc9('0x0'));var util=require('util');var logger=require(_0x8fc9('0x1'))(_0x8fc9('0x2'));var moment=require(_0x8fc9('0x3'));var BPromise=require(_0x8fc9('0x4'));var rp=require(_0x8fc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8fc9('0x6'));var config=require(_0x8fc9('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x8fc9('0x8')]=function(_0x5c2c2c,_0x292bca){return _0x5c2c2c[_0x8fc9('0x9')](_0x8fc9('0xa'),attributes,{'tableName':_0x8fc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fbce0,_0x34a203,_0x564d87){if(_0x2fbce0['changed']('closed')){_0x2fbce0[_0x8fc9('0xc')]=moment()[_0x8fc9('0xd')](_0x8fc9('0xe'));}_0x564d87(null,_0x2fbce0);}}});}; \ No newline at end of file +var _0xa006=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x533e94,_0x55d1f8){var _0x33a357=function(_0x1dc542){while(--_0x1dc542){_0x533e94['push'](_0x533e94['shift']());}};_0x33a357(++_0x55d1f8);}(_0xa006,0x17a));var _0x6a00=function(_0x373e37,_0x437e6d){_0x373e37=_0x373e37-0x0;var _0x541c9a=_0xa006[_0x373e37];return _0x541c9a;};'use strict';var _=require(_0x6a00('0x0'));var util=require(_0x6a00('0x1'));var logger=require(_0x6a00('0x2'))(_0x6a00('0x3'));var moment=require(_0x6a00('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a00('0x6'));var config=require(_0x6a00('0x7'));var attributes=require(_0x6a00('0x8'));module[_0x6a00('0x9')]=function(_0x3e07a1,_0x5d200d){return _0x3e07a1[_0x6a00('0xa')](_0x6a00('0xb'),attributes,{'tableName':_0x6a00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x199af7,_0x497c08,_0x35d6ab){if(_0x199af7[_0x6a00('0xd')](_0x6a00('0xe'))){_0x199af7['closedAt']=moment()[_0x6a00('0xf')](_0x6a00('0x10'));}_0x35d6ab(null,_0x199af7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 78269d8..65ccd93 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 _0x732c=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','WhatsappInteraction','options','raw','limit','catch','UpdateWhatsappInteraction','where','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x5b36aa,_0x190f31){var _0x238af9=function(_0x7efcd5){while(--_0x7efcd5){_0x5b36aa['push'](_0x5b36aa['shift']());}};_0x238af9(++_0x190f31);}(_0x732c,0x104));var _0xc732=function(_0x3ffcc8,_0x39c30f){_0x3ffcc8=_0x3ffcc8-0x0;var _0x42fad8=_0x732c[_0x3ffcc8];return _0x42fad8;};'use strict';var _=require(_0xc732('0x0'));var util=require(_0xc732('0x1'));var moment=require(_0xc732('0x2'));var BPromise=require(_0xc732('0x3'));var rs=require(_0xc732('0x4'));var fs=require('fs');var Redis=require(_0xc732('0x5'));var db=require(_0xc732('0x6'))['db'];var utils=require(_0xc732('0x7'));var logger=require(_0xc732('0x8'))(_0xc732('0x9'));var config=require(_0xc732('0xa'));var jayson=require(_0xc732('0xb'));var client=jayson['client'][_0xc732('0xc')]({'port':0x232a});config['redis']=_[_0xc732('0xd')](config['redis'],{'host':_0xc732('0xe'),'port':0x18eb});var socket=require(_0xc732('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xc732('0x10')](socket);function respondWithRpcPromise(_0x16670d,_0x3c629c,_0x4c349d){return new BPromise(function(_0x547765,_0x4e451d){return client[_0xc732('0x11')](_0x16670d,_0x4c349d)[_0xc732('0x12')](function(_0x471591){logger[_0xc732('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c629c,'request\x20sent');logger[_0xc732('0x14')](_0xc732('0x15'),_0x3c629c,_0xc732('0x16'),JSON[_0xc732('0x17')](_0x471591));if(_0x471591['error']){if(_0x471591[_0xc732('0x18')][_0xc732('0x19')]===0x1f4){logger[_0xc732('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c629c,_0x471591[_0xc732('0x18')][_0xc732('0x1a')]);return _0x4e451d(_0x471591['error'][_0xc732('0x1a')]);}logger[_0xc732('0x18')](_0xc732('0x1b'),_0x3c629c,_0x471591[_0xc732('0x18')][_0xc732('0x1a')]);return _0x547765(_0x471591[_0xc732('0x18')][_0xc732('0x1a')]);}else{logger[_0xc732('0x13')](_0xc732('0x1b'),_0x3c629c,_0xc732('0x16'));_0x547765(_0x471591[_0xc732('0x1c')][_0xc732('0x1a')]);}})['catch'](function(_0x101e2c){logger[_0xc732('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c629c,_0x101e2c);_0x4e451d(_0x101e2c);});});}exports['UpdateWhatsappInteraction']=function(_0x349564){var _0x302f2a=this;return new Promise(function(_0x2bf446,_0x24182e){return db[_0xc732('0x1d')]['update'](_0x349564['body'],{'raw':_0x349564[_0xc732('0x1e')]?_0x349564['options'][_0xc732('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x349564[_0xc732('0x1e')]?_0x349564[_0xc732('0x1e')]['where']||null:null,'attributes':_0x349564[_0xc732('0x1e')]?_0x349564['options']['attributes']||null:null,'limit':_0x349564[_0xc732('0x1e')]?_0x349564[_0xc732('0x1e')][_0xc732('0x20')]||null:null})['then'](function(_0x16671c){logger[_0xc732('0x13')]('UpdateWhatsappInteraction',_0x349564);logger[_0xc732('0x14')]('UpdateWhatsappInteraction',_0x349564,JSON[_0xc732('0x17')](_0x16671c));_0x2bf446(_0x16671c);})[_0xc732('0x21')](function(_0x1deb51){logger[_0xc732('0x18')](_0xc732('0x22'),_0x1deb51[_0xc732('0x1a')],_0x349564);_0x24182e(_0x302f2a[_0xc732('0x18')](0x1f4,_0x1deb51[_0xc732('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x52f112){return new Promise(function(_0x596652,_0x47973f){return db['WhatsappInteraction']['find']({'where':_0x52f112[_0xc732('0x1e')]?_0x52f112[_0xc732('0x1e')][_0xc732('0x23')]||null:null})[_0xc732('0x12')](function(_0xc0cb15){if(_0xc0cb15){return _0xc0cb15['addTags'](_0x52f112[_0xc732('0x24')][_0xc732('0x25')],_['omit'](_0x52f112['body'],['ids','id'])||{});}})[_0xc732('0x26')](function(_0x3112ac){logger[_0xc732('0x13')](_0xc732('0x27'),_0x52f112);logger[_0xc732('0x14')](_0xc732('0x27'),_0x52f112,JSON[_0xc732('0x17')](_0x3112ac));_0x596652(_0x3112ac);})['catch'](function(_0x11fb2d){logger[_0xc732('0x18')]('AddTags',_0x11fb2d[_0xc732('0x1a')],_0x52f112);_0x47973f(_this[_0xc732('0x18')](0x1f4,_0x11fb2d[_0xc732('0x1a')]));});});}; \ No newline at end of file +var _0xbd8e=['WhatsappInteraction','find','addTags','ids','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','then','AddTagsToWhatsappInteraction'];(function(_0xec53e7,_0x4ba16b){var _0x323257=function(_0x59eca6){while(--_0x59eca6){_0xec53e7['push'](_0xec53e7['shift']());}};_0x323257(++_0x4ba16b);}(_0xbd8e,0x1bf));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require(_0xebd8('0x2'));var BPromise=require(_0xebd8('0x3'));var rs=require(_0xebd8('0x4'));var fs=require('fs');var Redis=require(_0xebd8('0x5'));var db=require(_0xebd8('0x6'))['db'];var utils=require(_0xebd8('0x7'));var logger=require(_0xebd8('0x8'))(_0xebd8('0x9'));var config=require(_0xebd8('0xa'));var jayson=require(_0xebd8('0xb'));var client=jayson[_0xebd8('0xc')][_0xebd8('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xebd8('0xe')],{'host':_0xebd8('0xf'),'port':0x18eb});var socket=require(_0xebd8('0x10'))(new Redis(config['redis']));require(_0xebd8('0x11'))[_0xebd8('0x12')](socket);function respondWithRpcPromise(_0x190c2b,_0x25ec0d,_0x3020d8){return new BPromise(function(_0x3db06f,_0x1ce0bf){return client['request'](_0x190c2b,_0x3020d8)['then'](function(_0x5ec907){logger['info'](_0xebd8('0x13'),_0x25ec0d,_0xebd8('0x14'));logger[_0xebd8('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x25ec0d,_0xebd8('0x14'),JSON[_0xebd8('0x16')](_0x5ec907));if(_0x5ec907[_0xebd8('0x17')]){if(_0x5ec907[_0xebd8('0x17')][_0xebd8('0x18')]===0x1f4){logger['error'](_0xebd8('0x13'),_0x25ec0d,_0x5ec907[_0xebd8('0x17')][_0xebd8('0x19')]);return _0x1ce0bf(_0x5ec907['error'][_0xebd8('0x19')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x25ec0d,_0x5ec907['error'][_0xebd8('0x19')]);return _0x3db06f(_0x5ec907['error'][_0xebd8('0x19')]);}else{logger['info'](_0xebd8('0x13'),_0x25ec0d,'request\x20sent');_0x3db06f(_0x5ec907[_0xebd8('0x1a')][_0xebd8('0x19')]);}})[_0xebd8('0x1b')](function(_0xea525d){logger[_0xebd8('0x17')](_0xebd8('0x13'),_0x25ec0d,_0xea525d);_0x1ce0bf(_0xea525d);});});}exports[_0xebd8('0x1c')]=function(_0x213f1c){var _0x356d0e=this;return new Promise(function(_0x2fc787,_0x2e6a41){return db['WhatsappInteraction'][_0xebd8('0x1d')](_0x213f1c[_0xebd8('0x1e')],{'raw':_0x213f1c[_0xebd8('0x1f')]?_0x213f1c['options'][_0xebd8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x213f1c[_0xebd8('0x1f')]?_0x213f1c[_0xebd8('0x1f')][_0xebd8('0x21')]||null:null,'attributes':_0x213f1c[_0xebd8('0x1f')]?_0x213f1c[_0xebd8('0x1f')]['attributes']||null:null,'limit':_0x213f1c[_0xebd8('0x1f')]?_0x213f1c[_0xebd8('0x1f')][_0xebd8('0x22')]||null:null})[_0xebd8('0x23')](function(_0x6e966c){logger['info']('UpdateWhatsappInteraction',_0x213f1c);logger[_0xebd8('0x15')]('UpdateWhatsappInteraction',_0x213f1c,JSON[_0xebd8('0x16')](_0x6e966c));_0x2fc787(_0x6e966c);})['catch'](function(_0xb6762c){logger['error'](_0xebd8('0x1c'),_0xb6762c[_0xebd8('0x19')],_0x213f1c);_0x2e6a41(_0x356d0e[_0xebd8('0x17')](0x1f4,_0xb6762c[_0xebd8('0x19')]));});});};exports[_0xebd8('0x24')]=function(_0x33fb8a){return new Promise(function(_0x301275,_0x5e7585){return db[_0xebd8('0x25')][_0xebd8('0x26')]({'where':_0x33fb8a[_0xebd8('0x1f')]?_0x33fb8a[_0xebd8('0x1f')][_0xebd8('0x21')]||null:null})['then'](function(_0x440c10){if(_0x440c10){return _0x440c10[_0xebd8('0x27')](_0x33fb8a['body'][_0xebd8('0x28')],_['omit'](_0x33fb8a['body'],[_0xebd8('0x28'),'id'])||{});}})[_0xebd8('0x29')](function(_0x53899d){logger[_0xebd8('0x2a')]('AddTags',_0x33fb8a);logger['debug'](_0xebd8('0x2b'),_0x33fb8a,JSON[_0xebd8('0x16')](_0x53899d));_0x301275(_0x53899d);})[_0xebd8('0x1b')](function(_0x49d88e){logger['error'](_0xebd8('0x2b'),_0x49d88e['message'],_0x33fb8a);_0x5e7585(_this[_0xebd8('0x17')](0x1f4,_0x49d88e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 21615bd..4f2203d 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 _0xb667=['remove','emit','length','whatsappInteraction:'];(function(_0x13e135,_0x1d6c38){var _0x5284c3=function(_0xc9321b){while(--_0xc9321b){_0x13e135['push'](_0x13e135['shift']());}};_0x5284c3(++_0x1d6c38);}(_0xb667,0xf8));var _0x7b66=function(_0x5322d4,_0x2dfb5a){_0x5322d4=_0x5322d4-0x0;var _0x2d2d51=_0xb667[_0x5322d4];return _0x2d2d51;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7b66('0x0'),'update'];function createListener(_0x2413af,_0x5b99d4){return function(_0x406ee4){_0x5b99d4[_0x7b66('0x1')](_0x2413af,_0x406ee4);};}function removeListener(_0x22cb83,_0x36561e){return function(){WhatsappInteractionEvents['removeListener'](_0x22cb83,_0x36561e);};}exports['register']=function(_0x28f220){for(var _0x3ad47e=0x0,_0x2c9374=events[_0x7b66('0x2')];_0x3ad47e<_0x2c9374;_0x3ad47e++){var _0x456ba8=events[_0x3ad47e];var _0x1cee15=createListener(_0x7b66('0x3')+_0x456ba8,_0x28f220);WhatsappInteractionEvents['on'](_0x456ba8,_0x1cee15);}}; \ No newline at end of file +var _0xacc7=['emit','removeListener','register','length','save','remove','update'];(function(_0x2a506b,_0x38e9c3){var _0x51558d=function(_0x291dcc){while(--_0x291dcc){_0x2a506b['push'](_0x2a506b['shift']());}};_0x51558d(++_0x38e9c3);}(_0xacc7,0x193));var _0x7acc=function(_0x551b1c,_0x3584f9){_0x551b1c=_0x551b1c-0x0;var _0x131273=_0xacc7[_0x551b1c];return _0x131273;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x7acc('0x0'),_0x7acc('0x1'),_0x7acc('0x2')];function createListener(_0x1cc39e,_0x9803f7){return function(_0x28efc0){_0x9803f7[_0x7acc('0x3')](_0x1cc39e,_0x28efc0);};}function removeListener(_0x4b4575,_0x2e6e0a){return function(){WhatsappInteractionEvents[_0x7acc('0x4')](_0x4b4575,_0x2e6e0a);};}exports[_0x7acc('0x5')]=function(_0x11879e){for(var _0x4d702b=0x0,_0x110be6=events[_0x7acc('0x6')];_0x4d702b<_0x110be6;_0x4d702b++){var _0x380de9=events[_0x4d702b];var _0xe0465b=createListener('whatsappInteraction:'+_0x380de9,_0x11879e);WhatsappInteractionEvents['on'](_0x380de9,_0xe0465b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d057b28..0d721ee 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 _0x8717=['whatsappmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','post','tracked','whatsapp'];(function(_0x27c3ea,_0x4920ca){var _0x24215a=function(_0x4096c2){while(--_0x4096c2){_0x27c3ea['push'](_0x27c3ea['shift']());}};_0x24215a(++_0x4920ca);}(_0x8717,0x13f));var _0x7871=function(_0x57ed15,_0x2c4588){_0x57ed15=_0x57ed15-0x0;var _0x18be3c=_0x8717[_0x57ed15];return _0x18be3c;};'use strict';var multer=require('multer');var util=require(_0x7871('0x0'));var path=require(_0x7871('0x1'));var timeout=require(_0x7871('0x2'));var express=require(_0x7871('0x3'));var router=express[_0x7871('0x4')]();var fs_extra=require(_0x7871('0x5'));var auth=require(_0x7871('0x6'));var interaction=require(_0x7871('0x7'));var config=require(_0x7871('0x8'));var controller=require(_0x7871('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7871('0xa')](_0x7871('0xb'),auth[_0x7871('0xc')](),controller['describe']);router[_0x7871('0xa')](_0x7871('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7871('0xe')]('/',auth[_0x7871('0xc')](),interaction[_0x7871('0xf')](_0x7871('0x10'),_0x7871('0x11')),controller[_0x7871('0x12')]);router[_0x7871('0xe')](_0x7871('0x13'),controller[_0x7871('0x14')]);router[_0x7871('0x15')](_0x7871('0xd'),auth[_0x7871('0xc')](),controller[_0x7871('0x16')]);router[_0x7871('0x15')]('/:id/accept',auth[_0x7871('0xc')](),controller[_0x7871('0x17')]);router[_0x7871('0x15')](_0x7871('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x7871('0x19')](_0x7871('0xd'),auth[_0x7871('0xc')](),controller[_0x7871('0x1a')]);module[_0x7871('0x1b')]=router; \ No newline at end of file +var _0x6e5a=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','reject'];(function(_0x2af0e2,_0x57b20d){var _0x3d82bd=function(_0x135e37){while(--_0x135e37){_0x2af0e2['push'](_0x2af0e2['shift']());}};_0x3d82bd(++_0x57b20d);}(_0x6e5a,0x13a));var _0xa6e5=function(_0x2947a2,_0xaf51b3){_0x2947a2=_0x2947a2-0x0;var _0xba1efe=_0x6e5a[_0x2947a2];return _0xba1efe;};'use strict';var multer=require(_0xa6e5('0x0'));var util=require(_0xa6e5('0x1'));var path=require(_0xa6e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6e5('0x3'));var router=express[_0xa6e5('0x4')]();var fs_extra=require(_0xa6e5('0x5'));var auth=require(_0xa6e5('0x6'));var interaction=require(_0xa6e5('0x7'));var config=require('../../config/environment');var controller=require(_0xa6e5('0x8'));router[_0xa6e5('0x9')]('/',auth[_0xa6e5('0xa')](),controller[_0xa6e5('0xb')]);router[_0xa6e5('0x9')]('/describe',auth[_0xa6e5('0xa')](),controller['describe']);router[_0xa6e5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa6e5('0xc')]);router[_0xa6e5('0xd')]('/',auth[_0xa6e5('0xa')](),interaction['tracked'](_0xa6e5('0xe'),_0xa6e5('0xf')),controller[_0xa6e5('0x10')]);router[_0xa6e5('0xd')](_0xa6e5('0x11'),controller[_0xa6e5('0x12')]);router[_0xa6e5('0x13')](_0xa6e5('0x14'),auth[_0xa6e5('0xa')](),controller[_0xa6e5('0x15')]);router['put'](_0xa6e5('0x16'),auth[_0xa6e5('0xa')](),controller['accept']);router[_0xa6e5('0x13')]('/:id/reject',auth[_0xa6e5('0xa')](),controller[_0xa6e5('0x17')]);router[_0xa6e5('0x18')]('/:id',auth[_0xa6e5('0xa')](),controller['destroy']);module[_0xa6e5('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1c644aa..10c0d5d 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 _0x14f8=['BOOLEAN','STRING','exports','TEXT','medium'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x14f8,0x66));var _0x814f=function(_0x3d8213,_0x41fca1){_0x3d8213=_0x3d8213-0x0;var _0x595c27=_0x14f8[_0x3d8213];return _0x595c27;};'use strict';var Sequelize=require('sequelize');module[_0x814f('0x0')]={'body':{'type':Sequelize[_0x814f('0x1')](_0x814f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x814f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x814f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x814f('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x814f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x814f('0x1')]}}; \ No newline at end of file +var _0xb613=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x15678a,_0x5bd4e7){var _0x47200c=function(_0x525309){while(--_0x525309){_0x15678a['push'](_0x15678a['shift']());}};_0x47200c(++_0x5bd4e7);}(_0xb613,0x152));var _0x3b61=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xb613[_0xb68772];return _0x4189bb;};'use strict';var Sequelize=require('sequelize');module[_0x3b61('0x0')]={'body':{'type':Sequelize[_0x3b61('0x1')](_0x3b61('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3b61('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b61('0x4')]('in',_0x3b61('0x5')),'defaultValue':_0x3b61('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b61('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3b61('0x7')]},'secret':{'type':Sequelize[_0x3b61('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3b61('0x6')]},'providerResponse':{'type':Sequelize[_0x3b61('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 96feb84..33b4191 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 _0x9d5b=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','WhatsappMessage','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','params','model','includeAll','create','body','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','inspect','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x4871e5,_0x510f48){var _0x1be1f4=function(_0x12e1e7){while(--_0x12e1e7){_0x4871e5['push'](_0x4871e5['shift']());}};_0x1be1f4(++_0x510f48);}(_0x9d5b,0x170));var _0xb9d5=function(_0x1d5a7c,_0x2217ef){_0x1d5a7c=_0x1d5a7c-0x0;var _0x45f5a2=_0x9d5b[_0x1d5a7c];return _0x45f5a2;};'use strict';var emlformat=require(_0xb9d5('0x0'));var rimraf=require(_0xb9d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d5('0x2'));var rp=require(_0xb9d5('0x3'));var moment=require(_0xb9d5('0x4'));var BPromise=require(_0xb9d5('0x5'));var Mustache=require(_0xb9d5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb9d5('0x7'));var csv=require(_0xb9d5('0x8'));var ejs=require(_0xb9d5('0x9'));var fs=require('fs');var fs_extra=require(_0xb9d5('0xa'));var _=require(_0xb9d5('0xb'));var squel=require(_0xb9d5('0xc'));var crypto=require(_0xb9d5('0xd'));var jsforce=require(_0xb9d5('0xe'));var deskjs=require(_0xb9d5('0xf'));var toCsv=require(_0xb9d5('0x8'));var querystring=require(_0xb9d5('0x10'));var Papa=require(_0xb9d5('0x11'));var Redis=require(_0xb9d5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb9d5('0x13'));var as=require(_0xb9d5('0x14'));var hardwareService=require(_0xb9d5('0x15'));var logger=require(_0xb9d5('0x16'))(_0xb9d5('0x17'));var utils=require('../../config/utils');var config=require(_0xb9d5('0x18'));var licenseUtil=require(_0xb9d5('0x19'));var db=require(_0xb9d5('0x1a'))['db'];config[_0xb9d5('0x1b')]=_[_0xb9d5('0x1c')](config['redis'],{'host':_0xb9d5('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9d5('0x1b')]));require(_0xb9d5('0x1e'))['register'](socket);var jayson=require(_0xb9d5('0x1f'));var client=jayson[_0xb9d5('0x20')][_0xb9d5('0x21')]({'port':0x232c});var client9002=jayson[_0xb9d5('0x20')][_0xb9d5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb2945e,_0x52c699,_0x4de534,_0x24d550){return new BPromise(function(_0x5d24fe,_0xefdff2){var _0x680ac3=_0x24d550||client;return _0x680ac3['request'](_0xb2945e,_0x4de534)['then'](function(_0x331776){logger[_0xb9d5('0x22')](_0xb9d5('0x23'),_0x52c699,_0xb9d5('0x24'));logger[_0xb9d5('0x25')](_0xb9d5('0x26'),_0x52c699,'request\x20sent',JSON[_0xb9d5('0x27')](_0x331776));if(_0x331776[_0xb9d5('0x28')]){if(_0x331776[_0xb9d5('0x28')][_0xb9d5('0x29')]===0x1f4){logger[_0xb9d5('0x28')](_0xb9d5('0x23'),_0x52c699,_0x331776['error'][_0xb9d5('0x2a')]);return _0xefdff2(_0x331776['error']['message']);}logger['error'](_0xb9d5('0x23'),_0x52c699,_0x331776[_0xb9d5('0x28')][_0xb9d5('0x2a')]);return _0x5d24fe(_0x331776[_0xb9d5('0x28')][_0xb9d5('0x2a')]);}else{logger[_0xb9d5('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x52c699,'request\x20sent');_0x5d24fe(_0x331776[_0xb9d5('0x2b')][_0xb9d5('0x2a')]);}})[_0xb9d5('0x2c')](function(_0x541ed7){logger[_0xb9d5('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x52c699,_0x541ed7);_0xefdff2(_0x541ed7);});});}function respondWithStatusCode(_0x148745,_0x17cc2c){_0x17cc2c=_0x17cc2c||0xcc;return function(_0x290afa){if(_0x290afa){return _0x148745[_0xb9d5('0x2d')](_0x17cc2c);}return _0x148745[_0xb9d5('0x2e')](_0x17cc2c)[_0xb9d5('0x2f')]();};}function respondWithResult(_0x4ae713,_0x195dbb){_0x195dbb=_0x195dbb||0xc8;return function(_0x2756a2){if(_0x2756a2){return _0x4ae713[_0xb9d5('0x2e')](_0x195dbb)[_0xb9d5('0x30')](_0x2756a2);}};}function respondWithFilteredResult(_0x168851,_0x406bbe){return function(_0x2b2834){if(_0x2b2834){var _0x26ec1e=typeof _0x406bbe[_0xb9d5('0x31')]===_0xb9d5('0x32')&&typeof _0x406bbe['limit']===_0xb9d5('0x32');var _0x57d45f=_0x2b2834['count'];var _0x1829b6=_0x26ec1e?0x0:_0x406bbe[_0xb9d5('0x31')];var _0x277f68=_0x26ec1e?_0x2b2834[_0xb9d5('0x33')]:_0x406bbe['offset']+_0x406bbe[_0xb9d5('0x34')];var _0x1543a5;if(_0x277f68>=_0x57d45f){_0x277f68=_0x57d45f;_0x1543a5=0xc8;}else{_0x1543a5=0xce;}_0x168851[_0xb9d5('0x2e')](_0x1543a5);return _0x168851[_0xb9d5('0x35')](_0xb9d5('0x36'),_0x1829b6+'-'+_0x277f68+'/'+_0x57d45f)['json'](_0x2b2834);}return null;};}function patchUpdates(_0x153b44){return function(_0x45e526){try{jsonpatch[_0xb9d5('0x37')](_0x45e526,_0x153b44,!![]);}catch(_0x526ecc){return BPromise[_0xb9d5('0x38')](_0x526ecc);}return _0x45e526[_0xb9d5('0x39')]();};}function saveUpdates(_0x35ae0b,_0x1a6afe){return function(_0x24dd63){if(_0x24dd63){return _0x24dd63[_0xb9d5('0x3a')](_0x35ae0b)['then'](function(_0x15cde5){return _0x15cde5;});}return null;};}function removeEntity(_0x1e513a,_0x527038){return function(_0x5917f2){if(_0x5917f2){return _0x5917f2[_0xb9d5('0x3b')]()[_0xb9d5('0x3c')](function(){_0x1e513a[_0xb9d5('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e419,_0x1a0357){return function(_0x10c3c7){if(!_0x10c3c7){_0x10e419['sendStatus'](0x194);}return _0x10c3c7;};}function handleError(_0x1d376c,_0x4891f5){_0x4891f5=_0x4891f5||0x1f4;return function(_0x49eef9){logger[_0xb9d5('0x28')](_0x49eef9[_0xb9d5('0x3d')]);if(_0x49eef9[_0xb9d5('0x3e')]){delete _0x49eef9[_0xb9d5('0x3e')];}_0x1d376c['status'](_0x4891f5)['send'](_0x49eef9);};}exports['index']=function(_0x2964d4,_0x2adcfb){var _0x20881c={},_0x43ea6f={},_0x235d43={'count':0x0,'rows':[]};var _0x30d50e=_[_0xb9d5('0x3f')](db[_0xb9d5('0x40')][_0xb9d5('0x41')],function(_0x28ab32){return{'name':_0x28ab32['fieldName'],'type':_0x28ab32[_0xb9d5('0x42')][_0xb9d5('0x43')]};});_0x43ea6f['model']=_[_0xb9d5('0x3f')](_0x30d50e,_0xb9d5('0x3e'));_0x43ea6f[_0xb9d5('0x44')]=_[_0xb9d5('0x45')](_0x2964d4['query']);_0x43ea6f[_0xb9d5('0x46')]=_[_0xb9d5('0x47')](_0x43ea6f['model'],_0x43ea6f['query']);_0x20881c['attributes']=_[_0xb9d5('0x47')](_0x43ea6f['model'],qs[_0xb9d5('0x48')](_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x48')]));_0x20881c[_0xb9d5('0x49')]=_0x20881c[_0xb9d5('0x49')][_0xb9d5('0x4a')]?_0x20881c[_0xb9d5('0x49')]:_0x43ea6f['model'];if(!_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x4b')](_0xb9d5('0x4c'))){_0x20881c[_0xb9d5('0x34')]=qs[_0xb9d5('0x34')](_0x2964d4['query']['limit']);_0x20881c[_0xb9d5('0x31')]=qs[_0xb9d5('0x31')](_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x31')]);}_0x20881c['order']=qs['sort'](_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x4d')]);_0x20881c[_0xb9d5('0x4e')]=qs[_0xb9d5('0x46')](_['pick'](_0x2964d4[_0xb9d5('0x44')],_0x43ea6f[_0xb9d5('0x46')]),_0x30d50e);if(_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x4f')]){_0x20881c['where']=_[_0xb9d5('0x50')](_0x20881c[_0xb9d5('0x4e')],{'$or':_[_0xb9d5('0x3f')](_0x30d50e,function(_0x230f6c){if(_0x230f6c[_0xb9d5('0x42')]!=='VIRTUAL'){var _0x3a4221={};_0x3a4221[_0x230f6c[_0xb9d5('0x3e')]]={'$like':'%'+_0x2964d4[_0xb9d5('0x44')][_0xb9d5('0x4f')]+'%'};return _0x3a4221;}})});}_0x20881c=_['merge']({},_0x20881c,_0x2964d4[_0xb9d5('0x51')]);var _0x338006={'where':_0x20881c[_0xb9d5('0x4e')]};return db[_0xb9d5('0x40')][_0xb9d5('0x33')](_0x338006)[_0xb9d5('0x3c')](function(_0x39e4a7){_0x235d43[_0xb9d5('0x33')]=_0x39e4a7;if(_0x2964d4[_0xb9d5('0x44')]['includeAll']){_0x20881c[_0xb9d5('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xb9d5('0x53')](_0x20881c);})[_0xb9d5('0x3c')](function(_0x4ba3d0){_0x235d43['rows']=_0x4ba3d0;return _0x235d43;})[_0xb9d5('0x3c')](respondWithFilteredResult(_0x2adcfb,_0x20881c))[_0xb9d5('0x2c')](handleError(_0x2adcfb,null));};exports['show']=function(_0x55c742,_0x46e067){var _0xf0ada3={'raw':!![],'where':{'id':_0x55c742[_0xb9d5('0x54')]['id']}},_0xd67460={};_0xd67460[_0xb9d5('0x55')]=_[_0xb9d5('0x45')](db['WhatsappMessage']['rawAttributes']);_0xd67460['query']=_[_0xb9d5('0x45')](_0x55c742[_0xb9d5('0x44')]);_0xd67460[_0xb9d5('0x46')]=_[_0xb9d5('0x47')](_0xd67460[_0xb9d5('0x55')],_0xd67460[_0xb9d5('0x44')]);_0xf0ada3[_0xb9d5('0x49')]=_[_0xb9d5('0x47')](_0xd67460['model'],qs[_0xb9d5('0x48')](_0x55c742[_0xb9d5('0x44')][_0xb9d5('0x48')]));_0xf0ada3[_0xb9d5('0x49')]=_0xf0ada3[_0xb9d5('0x49')][_0xb9d5('0x4a')]?_0xf0ada3[_0xb9d5('0x49')]:_0xd67460['model'];if(_0x55c742[_0xb9d5('0x44')][_0xb9d5('0x56')]){_0xf0ada3['include']=[{'all':!![]}];}_0xf0ada3=_[_0xb9d5('0x50')]({},_0xf0ada3,_0x55c742['options']);return db[_0xb9d5('0x40')]['find'](_0xf0ada3)[_0xb9d5('0x3c')](handleEntityNotFound(_0x46e067,null))[_0xb9d5('0x3c')](respondWithResult(_0x46e067,null))[_0xb9d5('0x2c')](handleError(_0x46e067,null));};exports[_0xb9d5('0x57')]=function(_0x404c12,_0x2f2d48){return db[_0xb9d5('0x40')]['create'](_0x404c12['body'],{})[_0xb9d5('0x3c')](respondWithResult(_0x2f2d48,0xc9))[_0xb9d5('0x2c')](handleError(_0x2f2d48,null));};exports['update']=function(_0x24f596,_0x4630ee){if(_0x24f596[_0xb9d5('0x58')]['id']){delete _0x24f596[_0xb9d5('0x58')]['id'];}return db[_0xb9d5('0x40')][_0xb9d5('0x59')]({'where':{'id':_0x24f596[_0xb9d5('0x54')]['id']}})[_0xb9d5('0x3c')](handleEntityNotFound(_0x4630ee,null))[_0xb9d5('0x3c')](saveUpdates(_0x24f596[_0xb9d5('0x58')],null))[_0xb9d5('0x3c')](respondWithResult(_0x4630ee,null))[_0xb9d5('0x2c')](handleError(_0x4630ee,null));};exports['destroy']=function(_0x46d145,_0x13e6fc){return db[_0xb9d5('0x40')][_0xb9d5('0x59')]({'where':{'id':_0x46d145[_0xb9d5('0x54')]['id']}})[_0xb9d5('0x3c')](handleEntityNotFound(_0x13e6fc,null))[_0xb9d5('0x3c')](removeEntity(_0x13e6fc,null))['catch'](handleError(_0x13e6fc,null));};exports[_0xb9d5('0x5a')]=function(_0x3685bf,_0x3fbf6b){return db[_0xb9d5('0x40')][_0xb9d5('0x5a')]()[_0xb9d5('0x3c')](respondWithResult(_0x3fbf6b,null))[_0xb9d5('0x2c')](handleError(_0x3fbf6b,null));};var interaction_log=require(_0xb9d5('0x16'))(_0xb9d5('0x5b'));exports[_0xb9d5('0x5c')]=function(_0x4bd66e,_0x1e9a49,_0x27fb86){var _0x3cc267={'agent':{},'channel':_0xb9d5('0x5d')};if(_0x4bd66e['body']['id']){delete _0x4bd66e[_0xb9d5('0x58')]['id'];}_0x4bd66e[_0xb9d5('0x58')]['read']=!![];_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x5e')]=moment()[_0xb9d5('0x5f')](_0xb9d5('0x60'));_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')]=_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')]||_0x4bd66e['user']['id'];_0x3cc267['agent']['id']=_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')];return db[_0xb9d5('0x40')][_0xb9d5('0x59')]({'where':{'id':_0x4bd66e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e9a49,null))[_0xb9d5('0x3c')](saveUpdates(_0x4bd66e[_0xb9d5('0x58')],null))[_0xb9d5('0x3c')](function(_0x3f4a9c){if(_0x3f4a9c){_0x3cc267[_0xb9d5('0x2a')]=_0x3f4a9c[_0xb9d5('0x62')]({'plain':!![]});return db[_0xb9d5('0x63')][_0xb9d5('0x59')]({'where':{'id':_0x3f4a9c[_0xb9d5('0x64')]}});}return null;})[_0xb9d5('0x3c')](handleEntityNotFound(_0x1e9a49,null))[_0xb9d5('0x3c')](function(_0x29d277){if(_0x29d277){return _0x29d277[_0xb9d5('0x3a')]({'UserId':_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')],'read1stAt':_[_0xb9d5('0x65')](_0x29d277['read1stAt'])?moment()[_0xb9d5('0x5f')](_0xb9d5('0x60')):undefined});}return null;})[_0xb9d5('0x3c')](function(_0x18bcc2){if(_0x18bcc2){_0x3cc267[_0xb9d5('0x66')]=_0x18bcc2[_0xb9d5('0x62')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4bd66e[_0xb9d5('0x67')]['id'],_0x4bd66e[_0xb9d5('0x67')][_0xb9d5('0x3e')],_0x4bd66e['user'][_0xb9d5('0x68')],_0x3cc267['interaction']['id'],_0x4bd66e[_0xb9d5('0x58')]?JSON['stringify'](_0x4bd66e['body']):_0xb9d5('0x69'));return respondWithRpcPromise(_0xb9d5('0x6a'),_0xb9d5('0x6b'),_0x3cc267);}return null;})[_0xb9d5('0x3c')](function(_0xe19dfc){var _0x4921d7=_0xb9d5('0x6c')+_0xe19dfc['message'][_0xb9d5('0x6d')];return db['sequelize'][_0xb9d5('0x44')](_0x4921d7,{'type':db[_0xb9d5('0x6e')][_0xb9d5('0x6f')][_0xb9d5('0x70')],'raw':!![]})[_0xb9d5('0x3c')](function(_0x31ae71){return _0x31ae71;});})['then'](function(_0x2c222d){if(_0x2c222d){_0x3cc267[_0xb9d5('0x2a')]['contact']=_0x2c222d[0x0];if(!_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')])return;return db[_0xb9d5('0x71')][_0xb9d5('0x59')]({'where':{'id':_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x61')],'role':_0xb9d5('0x72')},'attributes':['id','name',_0xb9d5('0x73'),_0xb9d5('0x74'),'internal'],'raw':!![]});}return null;})[_0xb9d5('0x3c')](function(_0x1e53db){if(!_0x1e53db)return null;_0x3cc267[_0xb9d5('0x2a')]['agent']=_0x1e53db;return _0x3cc267;})[_0xb9d5('0x3c')](function(_0x5a3dde){if(_0x5a3dde){if(_0x4bd66e[_0xb9d5('0x58')][_0xb9d5('0x75')]){_0x3cc267[_0xb9d5('0x2a')][_0xb9d5('0x76')]=util[_0xb9d5('0x5f')](_0xb9d5('0x77'),_0x4bd66e['user'][_0xb9d5('0x3e')]);_0x3cc267[_0xb9d5('0x2a')][_0xb9d5('0x78')]=_0x3cc267['channel'];_0x3cc267[_0xb9d5('0x2a')][_0xb9d5('0x79')]=_0x3cc267[_0xb9d5('0x78')];_0x3cc267['message'][_0xb9d5('0x7a')]='accept';return respondWithRpcPromise('EventManager',_0xb9d5('0x7b'),{'event':_0xb9d5('0x7c'),'message':_0x3cc267[_0xb9d5('0x2a')]},client9002)[_0xb9d5('0x3c')](function(){return _0x3cc267;});}return _0x3cc267;}return null;})[_0xb9d5('0x3c')](respondWithResult(_0x1e9a49,null))['catch'](handleError(_0x1e9a49,null));};var interaction_log=require(_0xb9d5('0x16'))(_0xb9d5('0x5b'));exports[_0xb9d5('0x38')]=function(_0x42951e,_0x42c002,_0x2c2726){var _0x451d1d={'agent':{},'channel':_0xb9d5('0x5d')};if(_0x42951e[_0xb9d5('0x58')]['id']){delete _0x42951e[_0xb9d5('0x58')]['id'];}_0x42951e[_0xb9d5('0x58')][_0xb9d5('0x61')]=_0x42951e['body'][_0xb9d5('0x61')]||_0x42951e[_0xb9d5('0x67')]['id'];_0x451d1d[_0xb9d5('0x72')]['id']=_0x42951e['body']['UserId'];return db['WhatsappMessage'][_0xb9d5('0x59')]({'where':{'id':_0x42951e[_0xb9d5('0x54')]['id'],'UserId':null}})[_0xb9d5('0x3c')](handleEntityNotFound(_0x42c002,null))['then'](function(_0x165f3a){if(_0x165f3a){_0x451d1d['message']=_0x165f3a[_0xb9d5('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x165f3a[_0xb9d5('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x42c002,null))['then'](function(_0x46248a){if(_0x46248a){_0x451d1d[_0xb9d5('0x66')]=_0x46248a[_0xb9d5('0x62')]({'plain':!![]});interaction_log[_0xb9d5('0x22')](_0xb9d5('0x7d'),_0x42951e[_0xb9d5('0x67')]['id'],_0x42951e[_0xb9d5('0x67')]['name'],_0x42951e['user'][_0xb9d5('0x68')],_0x451d1d['interaction']['id'],_0x42951e[_0xb9d5('0x58')]?JSON[_0xb9d5('0x27')](_0x42951e['body']):'null');return respondWithRpcPromise(_0xb9d5('0x7e'),'rejectMessage',_0x451d1d);}return null;})[_0xb9d5('0x3c')](function(_0x5bb2ec){var _0x294ad1=_0xb9d5('0x6c')+_0x5bb2ec[_0xb9d5('0x2a')]['ContactId'];return db['sequelize'][_0xb9d5('0x44')](_0x294ad1,{'type':db[_0xb9d5('0x6e')][_0xb9d5('0x6f')][_0xb9d5('0x70')],'raw':!![]})['then'](function(_0x897df5){return _0x897df5;});})['then'](function(_0x3052b7){if(_0x3052b7){_0x451d1d[_0xb9d5('0x2a')][_0xb9d5('0x7f')]=_0x3052b7[0x0];if(!_0x42951e[_0xb9d5('0x58')][_0xb9d5('0x61')])return;return db[_0xb9d5('0x71')][_0xb9d5('0x59')]({'where':{'id':_0x42951e[_0xb9d5('0x58')][_0xb9d5('0x61')],'role':'agent'},'attributes':['id',_0xb9d5('0x3e'),_0xb9d5('0x73'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x396925){if(!_0x396925)return null;_0x451d1d[_0xb9d5('0x2a')][_0xb9d5('0x72')]=_0x396925;return _0x451d1d;})[_0xb9d5('0x3c')](function(_0x45bc5a){if(_0x45bc5a){_0x45bc5a[_0xb9d5('0x2a')][_0xb9d5('0x76')]=util[_0xb9d5('0x5f')]('SIP/%s',_0x42951e[_0xb9d5('0x67')][_0xb9d5('0x3e')]);_0x45bc5a[_0xb9d5('0x2a')][_0xb9d5('0x78')]=_0x451d1d[_0xb9d5('0x78')];_0x45bc5a['message'][_0xb9d5('0x79')]=_0x451d1d['channel'];_0x45bc5a['message']['event']='reject';respondWithRpcPromise(_0xb9d5('0x7b'),_0xb9d5('0x7b'),{'event':_0xb9d5('0x80'),'message':_0x45bc5a[_0xb9d5('0x2a')]},client9002);return _0x451d1d;}return null;})[_0xb9d5('0x3c')](respondWithResult(_0x42c002,null))[_0xb9d5('0x2c')](handleError(_0x42c002,null));};exports[_0xb9d5('0x2e')]=function(_0x3862e9,_0x6c962a,_0x2e8889){if(_0x3862e9[_0xb9d5('0x58')]['id']){delete _0x3862e9[_0xb9d5('0x58')]['id'];}var _0x30cf7d;return db[_0xb9d5('0x40')][_0xb9d5('0x59')]({'where':{'id':_0x3862e9['params']['id']}})[_0xb9d5('0x3c')](handleEntityNotFound(_0x6c962a,null))[_0xb9d5('0x3c')](function(_0x465e4e){if(_0x465e4e){_0x30cf7d=_0x465e4e;return db[_0xb9d5('0x81')]['find']({'where':{'id':_0x465e4e[_0xb9d5('0x82')]}});}})[_0xb9d5('0x3c')](handleEntityNotFound(_0x6c962a,null))[_0xb9d5('0x3c')](function(_0x396007){if(_0x396007){logger[_0xb9d5('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xb9d5('0x83'),_0x396007[_0xb9d5('0x42')],util['inspect'](_0x3862e9[_0xb9d5('0x58')],{'showHidden':![],'depth':null}));switch(_0x396007['type']){case _0xb9d5('0x84'):if(_0x3862e9[_0xb9d5('0x58')][_0xb9d5('0x85')]&&_0x3862e9['body'][_0xb9d5('0x85')]===_0x30cf7d[_0xb9d5('0x86')]&&_0x3862e9[_0xb9d5('0x58')][_0xb9d5('0x87')]&&_0x3862e9[_0xb9d5('0x58')][_0xb9d5('0x87')]===_0xb9d5('0x88')){return _0x30cf7d[_0xb9d5('0x3a')]({'read':!![]});}else{logger[_0xb9d5('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0xb9d5('0x89')](_0x3862e9[_0xb9d5('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x30cf7d;}})[_0xb9d5('0x3c')](respondWithResult(_0x6c962a,null))[_0xb9d5('0x2c')](handleError(_0x6c962a,null));}; \ No newline at end of file +var _0xae74=['WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','create','update','body','params','describe','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','format','interaction','[WHATSAPPMESSAGE: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','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','fullname','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae74,0x66));var _0x4ae7=function(_0xac60cf,_0x4d8cf3){_0xac60cf=_0xac60cf-0x0;var _0x39dacd=_0xae74[_0xac60cf];return _0x39dacd;};'use strict';var emlformat=require(_0x4ae7('0x0'));var rimraf=require(_0x4ae7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae7('0x2'));var moment=require('moment');var BPromise=require(_0x4ae7('0x3'));var Mustache=require(_0x4ae7('0x4'));var util=require(_0x4ae7('0x5'));var path=require(_0x4ae7('0x6'));var sox=require(_0x4ae7('0x7'));var csv=require(_0x4ae7('0x8'));var ejs=require(_0x4ae7('0x9'));var fs=require('fs');var fs_extra=require(_0x4ae7('0xa'));var _=require(_0x4ae7('0xb'));var squel=require(_0x4ae7('0xc'));var crypto=require(_0x4ae7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4ae7('0xe'));var toCsv=require(_0x4ae7('0x8'));var querystring=require(_0x4ae7('0xf'));var Papa=require(_0x4ae7('0x10'));var Redis=require('ioredis');var authService=require(_0x4ae7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ae7('0x12'));var logger=require(_0x4ae7('0x13'))(_0x4ae7('0x14'));var utils=require(_0x4ae7('0x15'));var config=require(_0x4ae7('0x16'));var licenseUtil=require(_0x4ae7('0x17'));var db=require(_0x4ae7('0x18'))['db'];config[_0x4ae7('0x19')]=_[_0x4ae7('0x1a')](config[_0x4ae7('0x19')],{'host':_0x4ae7('0x1b'),'port':0x18eb});var socket=require(_0x4ae7('0x1c'))(new Redis(config[_0x4ae7('0x19')]));require(_0x4ae7('0x1d'))['register'](socket);var jayson=require(_0x4ae7('0x1e'));var client=jayson['client'][_0x4ae7('0x1f')]({'port':0x232c});var client9002=jayson[_0x4ae7('0x20')][_0x4ae7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1ef974,_0x6f6986,_0x51bd47,_0x198a1f){return new BPromise(function(_0x3c851d,_0x1c287a){var _0x2e7f73=_0x198a1f||client;return _0x2e7f73[_0x4ae7('0x21')](_0x1ef974,_0x51bd47)[_0x4ae7('0x22')](function(_0x3b4695){logger['info'](_0x4ae7('0x23'),_0x6f6986,_0x4ae7('0x24'));logger[_0x4ae7('0x25')](_0x4ae7('0x26'),_0x6f6986,_0x4ae7('0x24'),JSON['stringify'](_0x3b4695));if(_0x3b4695[_0x4ae7('0x27')]){if(_0x3b4695['error']['code']===0x1f4){logger['error'](_0x4ae7('0x23'),_0x6f6986,_0x3b4695[_0x4ae7('0x27')]['message']);return _0x1c287a(_0x3b4695[_0x4ae7('0x27')][_0x4ae7('0x28')]);}logger['error'](_0x4ae7('0x23'),_0x6f6986,_0x3b4695[_0x4ae7('0x27')][_0x4ae7('0x28')]);return _0x3c851d(_0x3b4695['error']['message']);}else{logger[_0x4ae7('0x29')](_0x4ae7('0x23'),_0x6f6986,_0x4ae7('0x24'));_0x3c851d(_0x3b4695[_0x4ae7('0x2a')][_0x4ae7('0x28')]);}})[_0x4ae7('0x2b')](function(_0x542d35){logger[_0x4ae7('0x27')](_0x4ae7('0x23'),_0x6f6986,_0x542d35);_0x1c287a(_0x542d35);});});}function respondWithStatusCode(_0x1a986a,_0x5c4d04){_0x5c4d04=_0x5c4d04||0xcc;return function(_0x53ab3d){if(_0x53ab3d){return _0x1a986a[_0x4ae7('0x2c')](_0x5c4d04);}return _0x1a986a[_0x4ae7('0x2d')](_0x5c4d04)[_0x4ae7('0x2e')]();};}function respondWithResult(_0x3004e8,_0x2a2148){_0x2a2148=_0x2a2148||0xc8;return function(_0x17c700){if(_0x17c700){return _0x3004e8[_0x4ae7('0x2d')](_0x2a2148)[_0x4ae7('0x2f')](_0x17c700);}};}function respondWithFilteredResult(_0x2f07f1,_0x4c1589){return function(_0x3d4d24){if(_0x3d4d24){var _0x34a9f6=typeof _0x4c1589[_0x4ae7('0x30')]===_0x4ae7('0x31')&&typeof _0x4c1589[_0x4ae7('0x32')]===_0x4ae7('0x31');var _0x461828=_0x3d4d24['count'];var _0x5003bf=_0x34a9f6?0x0:_0x4c1589[_0x4ae7('0x30')];var _0xa9489f=_0x34a9f6?_0x3d4d24[_0x4ae7('0x33')]:_0x4c1589['offset']+_0x4c1589[_0x4ae7('0x32')];var _0x8419e7;if(_0xa9489f>=_0x461828){_0xa9489f=_0x461828;_0x8419e7=0xc8;}else{_0x8419e7=0xce;}_0x2f07f1[_0x4ae7('0x2d')](_0x8419e7);return _0x2f07f1[_0x4ae7('0x34')](_0x4ae7('0x35'),_0x5003bf+'-'+_0xa9489f+'/'+_0x461828)[_0x4ae7('0x2f')](_0x3d4d24);}return null;};}function patchUpdates(_0x162db8){return function(_0x4d7abd){try{jsonpatch[_0x4ae7('0x36')](_0x4d7abd,_0x162db8,!![]);}catch(_0x121cdb){return BPromise['reject'](_0x121cdb);}return _0x4d7abd[_0x4ae7('0x37')]();};}function saveUpdates(_0x2988b0,_0x2953fe){return function(_0x4467c3){if(_0x4467c3){return _0x4467c3['update'](_0x2988b0)[_0x4ae7('0x22')](function(_0x128cd1){return _0x128cd1;});}return null;};}function removeEntity(_0x4b0a60,_0x5ac788){return function(_0x21c21f){if(_0x21c21f){return _0x21c21f[_0x4ae7('0x38')]()[_0x4ae7('0x22')](function(){_0x4b0a60[_0x4ae7('0x2d')](0xcc)[_0x4ae7('0x2e')]();});}};}function handleEntityNotFound(_0x66368,_0x1abb6d){return function(_0x20a736){if(!_0x20a736){_0x66368[_0x4ae7('0x2c')](0x194);}return _0x20a736;};}function handleError(_0xe9f97e,_0x25a9bc){_0x25a9bc=_0x25a9bc||0x1f4;return function(_0x3d7902){logger[_0x4ae7('0x27')](_0x3d7902[_0x4ae7('0x39')]);if(_0x3d7902[_0x4ae7('0x3a')]){delete _0x3d7902[_0x4ae7('0x3a')];}_0xe9f97e['status'](_0x25a9bc)[_0x4ae7('0x3b')](_0x3d7902);};}exports[_0x4ae7('0x3c')]=function(_0x52ae0f,_0x4ef49c){var _0x1bbf46={},_0x55073b={},_0x2d71f0={'count':0x0,'rows':[]};var _0x3caf78=_[_0x4ae7('0x3d')](db[_0x4ae7('0x3e')][_0x4ae7('0x3f')],function(_0x577585){return{'name':_0x577585['fieldName'],'type':_0x577585[_0x4ae7('0x40')][_0x4ae7('0x41')]};});_0x55073b[_0x4ae7('0x42')]=_[_0x4ae7('0x3d')](_0x3caf78,_0x4ae7('0x3a'));_0x55073b[_0x4ae7('0x43')]=_[_0x4ae7('0x44')](_0x52ae0f[_0x4ae7('0x43')]);_0x55073b[_0x4ae7('0x45')]=_['intersection'](_0x55073b['model'],_0x55073b['query']);_0x1bbf46[_0x4ae7('0x46')]=_[_0x4ae7('0x47')](_0x55073b['model'],qs[_0x4ae7('0x48')](_0x52ae0f['query'][_0x4ae7('0x48')]));_0x1bbf46[_0x4ae7('0x46')]=_0x1bbf46[_0x4ae7('0x46')][_0x4ae7('0x49')]?_0x1bbf46[_0x4ae7('0x46')]:_0x55073b[_0x4ae7('0x42')];if(!_0x52ae0f[_0x4ae7('0x43')][_0x4ae7('0x4a')](_0x4ae7('0x4b'))){_0x1bbf46[_0x4ae7('0x32')]=qs['limit'](_0x52ae0f[_0x4ae7('0x43')]['limit']);_0x1bbf46[_0x4ae7('0x30')]=qs[_0x4ae7('0x30')](_0x52ae0f[_0x4ae7('0x43')][_0x4ae7('0x30')]);}_0x1bbf46['order']=qs[_0x4ae7('0x4c')](_0x52ae0f[_0x4ae7('0x43')][_0x4ae7('0x4c')]);_0x1bbf46[_0x4ae7('0x4d')]=qs[_0x4ae7('0x45')](_['pick'](_0x52ae0f[_0x4ae7('0x43')],_0x55073b['filters']),_0x3caf78);if(_0x52ae0f[_0x4ae7('0x43')][_0x4ae7('0x4e')]){_0x1bbf46[_0x4ae7('0x4d')]=_['merge'](_0x1bbf46[_0x4ae7('0x4d')],{'$or':_[_0x4ae7('0x3d')](_0x3caf78,function(_0x33d8ba){if(_0x33d8ba[_0x4ae7('0x40')]!==_0x4ae7('0x4f')){var _0x3db63d={};_0x3db63d[_0x33d8ba[_0x4ae7('0x3a')]]={'$like':'%'+_0x52ae0f[_0x4ae7('0x43')][_0x4ae7('0x4e')]+'%'};return _0x3db63d;}})});}_0x1bbf46=_[_0x4ae7('0x50')]({},_0x1bbf46,_0x52ae0f[_0x4ae7('0x51')]);var _0x53f658={'where':_0x1bbf46['where']};return db[_0x4ae7('0x3e')][_0x4ae7('0x33')](_0x53f658)[_0x4ae7('0x22')](function(_0x14e5ff){_0x2d71f0['count']=_0x14e5ff;if(_0x52ae0f[_0x4ae7('0x43')]['includeAll']){_0x1bbf46[_0x4ae7('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4ae7('0x53')](_0x1bbf46);})[_0x4ae7('0x22')](function(_0x1d8db2){_0x2d71f0[_0x4ae7('0x54')]=_0x1d8db2;return _0x2d71f0;})[_0x4ae7('0x22')](respondWithFilteredResult(_0x4ef49c,_0x1bbf46))[_0x4ae7('0x2b')](handleError(_0x4ef49c,null));};exports[_0x4ae7('0x55')]=function(_0x48cd02,_0x4eea6b){var _0x5ed441={'raw':!![],'where':{'id':_0x48cd02['params']['id']}},_0x46e96d={};_0x46e96d[_0x4ae7('0x42')]=_[_0x4ae7('0x44')](db[_0x4ae7('0x3e')][_0x4ae7('0x3f')]);_0x46e96d[_0x4ae7('0x43')]=_[_0x4ae7('0x44')](_0x48cd02[_0x4ae7('0x43')]);_0x46e96d[_0x4ae7('0x45')]=_[_0x4ae7('0x47')](_0x46e96d[_0x4ae7('0x42')],_0x46e96d['query']);_0x5ed441[_0x4ae7('0x46')]=_[_0x4ae7('0x47')](_0x46e96d[_0x4ae7('0x42')],qs['fields'](_0x48cd02['query'][_0x4ae7('0x48')]));_0x5ed441[_0x4ae7('0x46')]=_0x5ed441[_0x4ae7('0x46')][_0x4ae7('0x49')]?_0x5ed441[_0x4ae7('0x46')]:_0x46e96d['model'];if(_0x48cd02['query'][_0x4ae7('0x56')]){_0x5ed441[_0x4ae7('0x52')]=[{'all':!![]}];}_0x5ed441=_['merge']({},_0x5ed441,_0x48cd02[_0x4ae7('0x51')]);return db[_0x4ae7('0x3e')][_0x4ae7('0x57')](_0x5ed441)[_0x4ae7('0x22')](handleEntityNotFound(_0x4eea6b,null))[_0x4ae7('0x22')](respondWithResult(_0x4eea6b,null))[_0x4ae7('0x2b')](handleError(_0x4eea6b,null));};exports[_0x4ae7('0x58')]=function(_0x28835b,_0x2509c5){return db[_0x4ae7('0x3e')][_0x4ae7('0x58')](_0x28835b['body'],{})['then'](respondWithResult(_0x2509c5,0xc9))[_0x4ae7('0x2b')](handleError(_0x2509c5,null));};exports[_0x4ae7('0x59')]=function(_0x5e43ba,_0x34867b){if(_0x5e43ba[_0x4ae7('0x5a')]['id']){delete _0x5e43ba[_0x4ae7('0x5a')]['id'];}return db['WhatsappMessage'][_0x4ae7('0x57')]({'where':{'id':_0x5e43ba[_0x4ae7('0x5b')]['id']}})[_0x4ae7('0x22')](handleEntityNotFound(_0x34867b,null))[_0x4ae7('0x22')](saveUpdates(_0x5e43ba['body'],null))[_0x4ae7('0x22')](respondWithResult(_0x34867b,null))[_0x4ae7('0x2b')](handleError(_0x34867b,null));};exports[_0x4ae7('0x38')]=function(_0x126be4,_0x8442f){return db['WhatsappMessage']['find']({'where':{'id':_0x126be4[_0x4ae7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x8442f,null))[_0x4ae7('0x22')](removeEntity(_0x8442f,null))[_0x4ae7('0x2b')](handleError(_0x8442f,null));};exports[_0x4ae7('0x5c')]=function(_0x4b4c14,_0x5eb86c){return db[_0x4ae7('0x3e')][_0x4ae7('0x5c')]()[_0x4ae7('0x22')](respondWithResult(_0x5eb86c,null))[_0x4ae7('0x2b')](handleError(_0x5eb86c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x53b4e9,_0x5c5fef,_0x4d8e1a){var _0xfd9dee={'agent':{},'channel':'whatsapp'};if(_0x53b4e9[_0x4ae7('0x5a')]['id']){delete _0x53b4e9[_0x4ae7('0x5a')]['id'];}_0x53b4e9[_0x4ae7('0x5a')]['read']=!![];_0x53b4e9['body'][_0x4ae7('0x5d')]=moment()['format'](_0x4ae7('0x5e'));_0x53b4e9[_0x4ae7('0x5a')][_0x4ae7('0x5f')]=_0x53b4e9[_0x4ae7('0x5a')][_0x4ae7('0x5f')]||_0x53b4e9[_0x4ae7('0x60')]['id'];_0xfd9dee[_0x4ae7('0x61')]['id']=_0x53b4e9[_0x4ae7('0x5a')][_0x4ae7('0x5f')];return db[_0x4ae7('0x3e')]['find']({'where':{'id':_0x53b4e9['params']['id'],'UserId':null}})[_0x4ae7('0x22')](handleEntityNotFound(_0x5c5fef,null))[_0x4ae7('0x22')](saveUpdates(_0x53b4e9[_0x4ae7('0x5a')],null))[_0x4ae7('0x22')](function(_0x475a3b){if(_0x475a3b){_0xfd9dee['message']=_0x475a3b[_0x4ae7('0x62')]({'plain':!![]});return db[_0x4ae7('0x63')][_0x4ae7('0x57')]({'where':{'id':_0x475a3b[_0x4ae7('0x64')]}});}return null;})[_0x4ae7('0x22')](handleEntityNotFound(_0x5c5fef,null))['then'](function(_0x4a2f30){if(_0x4a2f30){return _0x4a2f30[_0x4ae7('0x59')]({'UserId':_0x53b4e9['body'][_0x4ae7('0x5f')],'read1stAt':_['isNil'](_0x4a2f30['read1stAt'])?moment()[_0x4ae7('0x65')](_0x4ae7('0x5e')):undefined});}return null;})[_0x4ae7('0x22')](function(_0x51cf15){if(_0x51cf15){_0xfd9dee[_0x4ae7('0x66')]=_0x51cf15['get']({'plain':!![]});interaction_log['info'](_0x4ae7('0x67'),_0x53b4e9['user']['id'],_0x53b4e9[_0x4ae7('0x60')]['name'],_0x53b4e9['user'][_0x4ae7('0x68')],_0xfd9dee[_0x4ae7('0x66')]['id'],_0x53b4e9[_0x4ae7('0x5a')]?JSON[_0x4ae7('0x69')](_0x53b4e9[_0x4ae7('0x5a')]):_0x4ae7('0x6a'));return respondWithRpcPromise(_0x4ae7('0x6b'),_0x4ae7('0x6c'),_0xfd9dee);}return null;})[_0x4ae7('0x22')](function(_0x1c1af8){var _0xf0468d=_0x4ae7('0x6d')+_0x1c1af8['message'][_0x4ae7('0x6e')];return db[_0x4ae7('0x6f')][_0x4ae7('0x43')](_0xf0468d,{'type':db['Sequelize']['QueryTypes'][_0x4ae7('0x70')],'raw':!![]})[_0x4ae7('0x22')](function(_0x3e6074){return _0x3e6074;});})[_0x4ae7('0x22')](function(_0x41cff4){if(_0x41cff4){_0xfd9dee[_0x4ae7('0x28')][_0x4ae7('0x71')]=_0x41cff4[0x0];if(!_0x53b4e9['body']['UserId'])return;return db[_0x4ae7('0x72')][_0x4ae7('0x57')]({'where':{'id':_0x53b4e9['body'][_0x4ae7('0x5f')],'role':_0x4ae7('0x61')},'attributes':['id',_0x4ae7('0x3a'),'fullname',_0x4ae7('0x73'),_0x4ae7('0x74')],'raw':!![]});}return null;})[_0x4ae7('0x22')](function(_0xb4ee1d){if(!_0xb4ee1d)return null;_0xfd9dee[_0x4ae7('0x28')][_0x4ae7('0x61')]=_0xb4ee1d;return _0xfd9dee;})[_0x4ae7('0x22')](function(_0x2f9f60){if(_0x2f9f60){if(_0x53b4e9[_0x4ae7('0x5a')]['manual']){_0xfd9dee[_0x4ae7('0x28')][_0x4ae7('0x75')]=util[_0x4ae7('0x65')](_0x4ae7('0x76'),_0x53b4e9[_0x4ae7('0x60')][_0x4ae7('0x3a')]);_0xfd9dee[_0x4ae7('0x28')]['channel']=_0xfd9dee[_0x4ae7('0x77')];_0xfd9dee[_0x4ae7('0x28')][_0x4ae7('0x78')]=_0xfd9dee[_0x4ae7('0x77')];_0xfd9dee[_0x4ae7('0x28')][_0x4ae7('0x79')]=_0x4ae7('0x7a');return respondWithRpcPromise(_0x4ae7('0x7b'),_0x4ae7('0x7b'),{'event':_0x4ae7('0x7c'),'message':_0xfd9dee[_0x4ae7('0x28')]},client9002)[_0x4ae7('0x22')](function(){return _0xfd9dee;});}return _0xfd9dee;}return null;})[_0x4ae7('0x22')](respondWithResult(_0x5c5fef,null))[_0x4ae7('0x2b')](handleError(_0x5c5fef,null));};var interaction_log=require(_0x4ae7('0x13'))('whatsapp-interactions');exports[_0x4ae7('0x7d')]=function(_0x3a49b6,_0x383330,_0x574be3){var _0x5b458e={'agent':{},'channel':_0x4ae7('0x7e')};if(_0x3a49b6[_0x4ae7('0x5a')]['id']){delete _0x3a49b6[_0x4ae7('0x5a')]['id'];}_0x3a49b6[_0x4ae7('0x5a')]['UserId']=_0x3a49b6[_0x4ae7('0x5a')]['UserId']||_0x3a49b6[_0x4ae7('0x60')]['id'];_0x5b458e['agent']['id']=_0x3a49b6[_0x4ae7('0x5a')]['UserId'];return db['WhatsappMessage'][_0x4ae7('0x57')]({'where':{'id':_0x3a49b6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x383330,null))[_0x4ae7('0x22')](function(_0x22ebeb){if(_0x22ebeb){_0x5b458e['message']=_0x22ebeb[_0x4ae7('0x62')]({'plain':!![]});return db[_0x4ae7('0x63')][_0x4ae7('0x57')]({'where':{'id':_0x22ebeb[_0x4ae7('0x64')]}});}return null;})[_0x4ae7('0x22')](handleEntityNotFound(_0x383330,null))['then'](function(_0x475a78){if(_0x475a78){_0x5b458e[_0x4ae7('0x66')]=_0x475a78[_0x4ae7('0x62')]({'plain':!![]});interaction_log[_0x4ae7('0x29')](_0x4ae7('0x7f'),_0x3a49b6[_0x4ae7('0x60')]['id'],_0x3a49b6[_0x4ae7('0x60')][_0x4ae7('0x3a')],_0x3a49b6[_0x4ae7('0x60')][_0x4ae7('0x68')],_0x5b458e[_0x4ae7('0x66')]['id'],_0x3a49b6[_0x4ae7('0x5a')]?JSON['stringify'](_0x3a49b6[_0x4ae7('0x5a')]):'null');return respondWithRpcPromise(_0x4ae7('0x80'),'rejectMessage',_0x5b458e);}return null;})[_0x4ae7('0x22')](function(_0x1cc4f0){var _0x23a60a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1cc4f0[_0x4ae7('0x28')]['ContactId'];return db[_0x4ae7('0x6f')][_0x4ae7('0x43')](_0x23a60a,{'type':db[_0x4ae7('0x81')]['QueryTypes']['SELECT'],'raw':!![]})[_0x4ae7('0x22')](function(_0x18042b){return _0x18042b;});})[_0x4ae7('0x22')](function(_0x1d8bdc){if(_0x1d8bdc){_0x5b458e['message']['contact']=_0x1d8bdc[0x0];if(!_0x3a49b6[_0x4ae7('0x5a')][_0x4ae7('0x5f')])return;return db[_0x4ae7('0x72')][_0x4ae7('0x57')]({'where':{'id':_0x3a49b6['body'][_0x4ae7('0x5f')],'role':_0x4ae7('0x61')},'attributes':['id',_0x4ae7('0x3a'),_0x4ae7('0x82'),_0x4ae7('0x73'),'internal'],'raw':!![]});}return null;})[_0x4ae7('0x22')](function(_0x92f9e9){if(!_0x92f9e9)return null;_0x5b458e[_0x4ae7('0x28')][_0x4ae7('0x61')]=_0x92f9e9;return _0x5b458e;})[_0x4ae7('0x22')](function(_0x5419ab){if(_0x5419ab){_0x5419ab['message'][_0x4ae7('0x75')]=util[_0x4ae7('0x65')]('SIP/%s',_0x3a49b6['user'][_0x4ae7('0x3a')]);_0x5419ab[_0x4ae7('0x28')]['channel']=_0x5b458e[_0x4ae7('0x77')];_0x5419ab[_0x4ae7('0x28')][_0x4ae7('0x78')]=_0x5b458e[_0x4ae7('0x77')];_0x5419ab['message'][_0x4ae7('0x79')]=_0x4ae7('0x7d');respondWithRpcPromise(_0x4ae7('0x7b'),_0x4ae7('0x7b'),{'event':'rejectmessage','message':_0x5419ab[_0x4ae7('0x28')]},client9002);return _0x5b458e;}return null;})[_0x4ae7('0x22')](respondWithResult(_0x383330,null))['catch'](handleError(_0x383330,null));};exports[_0x4ae7('0x2d')]=function(_0x30d414,_0xbc0813,_0x2baa3e){if(_0x30d414[_0x4ae7('0x5a')]['id']){delete _0x30d414['body']['id'];}var _0x3bd137;return db[_0x4ae7('0x3e')]['find']({'where':{'id':_0x30d414['params']['id']}})['then'](handleEntityNotFound(_0xbc0813,null))[_0x4ae7('0x22')](function(_0x406bd8){if(_0x406bd8){_0x3bd137=_0x406bd8;return db[_0x4ae7('0x83')][_0x4ae7('0x57')]({'where':{'id':_0x406bd8['WhatsappAccountId']}});}})[_0x4ae7('0x22')](handleEntityNotFound(_0xbc0813,null))[_0x4ae7('0x22')](function(_0x516134){if(_0x516134){logger[_0x4ae7('0x25')](_0x4ae7('0x84'),_0x4ae7('0x2d'),_0x4ae7('0x85'),_0x516134['type'],util[_0x4ae7('0x86')](_0x30d414['body'],{'showHidden':![],'depth':null}));switch(_0x516134[_0x4ae7('0x40')]){case _0x4ae7('0x87'):if(_0x30d414[_0x4ae7('0x5a')][_0x4ae7('0x88')]&&_0x30d414[_0x4ae7('0x5a')][_0x4ae7('0x88')]===_0x3bd137['messageId']&&_0x30d414[_0x4ae7('0x5a')][_0x4ae7('0x89')]&&_0x30d414[_0x4ae7('0x5a')][_0x4ae7('0x89')]===_0x4ae7('0x8a')){return _0x3bd137[_0x4ae7('0x59')]({'read':!![]});}else{logger[_0x4ae7('0x27')](_0x4ae7('0x8b'),_0x4ae7('0x2d'),_0x4ae7('0x87'),util['inspect'](_0x30d414[_0x4ae7('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3bd137;}})[_0x4ae7('0x22')](respondWithResult(_0xbc0813,null))[_0x4ae7('0x2b')](handleError(_0xbc0813,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9c4878f..5d3d236 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 _0x74f0=['hasOwnProperty','hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74f0,0xf3));var _0x074f=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x74f0[_0x1b5a5a];return _0x42b32d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x074f('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x074f('0x1'),'afterUpdate':_0x074f('0x2'),'afterDestroy':_0x074f('0x3')};function emitEvent(_0x3fd9ba){return function(_0x4e4b99,_0x51fbdc,_0x3d8d87){WhatsappMessageEvents[_0x074f('0x4')](_0x3fd9ba+':'+_0x4e4b99['id'],_0x4e4b99);WhatsappMessageEvents[_0x074f('0x4')](_0x3fd9ba,_0x4e4b99);_0x3d8d87(null);};}for(var e in events){if(events[_0x074f('0x5')](e)){var event=events[e];WhatsappMessage[_0x074f('0x6')](e,emitEvent(event));}}module[_0x074f('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x9f4d=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x411069,_0x16ae05){_0x411069=_0x411069-0x0;var _0x68c645=_0x9f4d[_0x411069];return _0x68c645;};'use strict';var EventEmitter=require(_0xd9f4('0x0'));var WhatsappMessage=require(_0xd9f4('0x1'))['db'][_0xd9f4('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd9f4('0x3')](0x0);var events={'afterCreate':_0xd9f4('0x4'),'afterUpdate':_0xd9f4('0x5'),'afterDestroy':_0xd9f4('0x6')};function emitEvent(_0x273eb9){return function(_0x7dccea,_0x5e0ab0,_0x2c39cb){WhatsappMessageEvents['emit'](_0x273eb9+':'+_0x7dccea['id'],_0x7dccea);WhatsappMessageEvents[_0xd9f4('0x7')](_0x273eb9,_0x7dccea);_0x2c39cb(null);};}for(var e in events){if(events[_0xd9f4('0x8')](e)){var event=events[e];WhatsappMessage[_0xd9f4('0x9')](e,emitEvent(event));}}module[_0xd9f4('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d3fbe64..8928eb3 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 _0xb311=['FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body'];(function(_0x4b19a6,_0x2ccf60){var _0x2c16fd=function(_0x5de92b){while(--_0x5de92b){_0x4b19a6['push'](_0x4b19a6['shift']());}};_0x2c16fd(++_0x2ccf60);}(_0xb311,0xad));var _0x1b31=function(_0x429184,_0x19b6fd){_0x429184=_0x429184-0x0;var _0x3520ef=_0xb311[_0x429184];return _0x3520ef;};'use strict';var _=require(_0x1b31('0x0'));var util=require(_0x1b31('0x1'));var logger=require(_0x1b31('0x2'))(_0x1b31('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b31('0x4'));var fetch=require(_0x1b31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b31('0x6'));var config=require(_0x1b31('0x7'));var attributes=require(_0x1b31('0x8'));module[_0x1b31('0x9')]=function(_0x4b1f45,_0x417466){return _0x4b1f45[_0x1b31('0xa')](_0x1b31('0xb'),attributes,{'tableName':_0x1b31('0xc'),'paranoid':![],'indexes':[{'name':_0x1b31('0xd'),'fields':['messageId']},{'name':_0x1b31('0xe'),'fields':[_0x1b31('0xf')],'type':_0x1b31('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c5e2d,_0x4d162b,_0x207cf6){var _0x3f39fb=_0x4b1f45['models'];var _0x1c07d3=_0x5c5e2d[_0x1b31('0x11')]({'plain':!![]});if(_0x1c07d3[_0x1b31('0x12')]['toLowerCase']()==='in'||_0x1c07d3[_0x1b31('0x12')][_0x1b31('0x13')]()==='out'&&!_0x1c07d3[_0x1b31('0x14')]&&!_[_0x1b31('0x15')](_0x1c07d3[_0x1b31('0x16')])){_0x3f39fb[_0x1b31('0x17')][_0x1b31('0x18')]({'where':{'id':_0x1c07d3[_0x1b31('0x19')]}})[_0x1b31('0x1a')](function(_0x3ff979){if(_0x3ff979){_0x3ff979[_0x1b31('0x1b')]({'lastMsgAt':_0x1c07d3[_0x1b31('0x1c')],'lastMsgDirection':_0x1c07d3[_0x1b31('0x12')][_0x1b31('0x13')]()});}})[_0x1b31('0x1d')](function(_0xf52d3a){console[_0x1b31('0x1e')](_0xf52d3a);});}if(_0x1c07d3['direction']===_0x1b31('0x1f')&&!_0x1c07d3[_0x1b31('0x14')]){var _0x557324;_0x3f39fb[_0x1b31('0x20')][_0x1b31('0x21')]({'where':{'id':_0x1c07d3['WhatsappAccountId']},'raw':!![]})[_0x1b31('0x1a')](function(_0x5de2ce){_0x557324=_0x5de2ce;if(_0x557324&&_0x557324[_0x1b31('0x22')]){switch(_0x557324[_0x1b31('0x22')]){case _0x1b31('0x23'):var _0x500e91=require(_0x1b31('0x23'));if(_0x557324[_0x1b31('0x24')]&&_0x557324[_0x1b31('0x25')]&&_0x557324[_0x1b31('0x26')]){var _0x20bc6e=new _0x500e91(_0x557324[_0x1b31('0x24')],_0x557324[_0x1b31('0x25')]);_0x20bc6e[_0x1b31('0x27')][_0x1b31('0x28')]({'body':_0x1c07d3[_0x1b31('0xf')],'to':'whatsapp:'+_0x1c07d3[_0x1b31('0x26')],'from':_0x1b31('0x29')+_0x557324[_0x1b31('0x26')],'statusCallback':_0x557324[_0x1b31('0x2a')]+_0x1b31('0x2b')+_0x1c07d3['id']+_0x1b31('0x2c')+_0x557324[_0x1b31('0x2d')]})[_0x1b31('0x1a')](function(_0x26870f){if(_0x26870f[_0x1b31('0x2e')]){return _0x5c5e2d['update']({'messageId':_0x26870f['sid']});}})[_0x1b31('0x1d')](function(_0x95d0df){logger[_0x1b31('0x1e')](_0x1b31('0x2f'),_0x1b31('0x30'),_0x1b31('0x23'),util[_0x1b31('0x31')](_0x95d0df,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1b31('0x30'),_0x1b31('0x23'),_0x1b31('0x32'));}break;case'sinch':var _0x202e6d=_0x557324[_0x1b31('0x24')];var _0x483562=_0x557324[_0x1b31('0x25')];var _0x46fd56=_0x557324[_0x1b31('0x33')]+'/whatsapp/v1/'+_0x202e6d+_0x1b31('0x34');var _0x4e1510={'to':[_0x1c07d3[_0x1b31('0x26')]],'message':{'type':_0x1b31('0x35'),'text':_0x1c07d3['body']}};var _0x4316d0={'method':_0x1b31('0x36'),'uri':_0x46fd56,'headers':{'Authorization':_0x1b31('0x37')+_0x483562,'Content-Type':_0x1b31('0x38')},'body':_0x4e1510,'json':!![]};rp(_0x4316d0)[_0x1b31('0x1a')](function(_0x125cdb){if(_0x125cdb[_0x1b31('0x39')][0x0][_0x1b31('0x3a')]){return _0x5c5e2d['update']({'messageId':_0x125cdb['statuses'][0x0][_0x1b31('0x3a')]});}})[_0x1b31('0x1d')](function(_0x4979a1){logger[_0x1b31('0x3b')](_0x1b31('0x3c'),_0x4979a1);});break;}}})['finally'](function(){_0x207cf6();});}else{_0x207cf6();}}},'charset':_0x1b31('0x3d'),'collate':_0x1b31('0x3e')});}; \ No newline at end of file +var _0x28ab=['secret','WhatsappInteraction','findOne','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x4c65a3,_0x5bc267){var _0x9b7de3=function(_0x477d2b){while(--_0x477d2b){_0x4c65a3['push'](_0x4c65a3['shift']());}};_0x9b7de3(++_0x5bc267);}(_0x28ab,0x166));var _0xb28a=function(_0x166c20,_0x3ab439){_0x166c20=_0x166c20-0x0;var _0x1339ca=_0x28ab[_0x166c20];return _0x1339ca;};'use strict';var _=require('lodash');var util=require(_0xb28a('0x0'));var logger=require(_0xb28a('0x1'))(_0xb28a('0x2'));var moment=require(_0xb28a('0x3'));var BPromise=require('bluebird');var rp=require(_0xb28a('0x4'));var fetch=require(_0xb28a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb28a('0x6'));var attributes=require(_0xb28a('0x7'));module[_0xb28a('0x8')]=function(_0x5c84f3,_0x2609e6){return _0x5c84f3[_0xb28a('0x9')]('WhatsappMessage',attributes,{'tableName':_0xb28a('0xa'),'paranoid':![],'indexes':[{'name':_0xb28a('0xb'),'fields':[_0xb28a('0xb')]},{'name':_0xb28a('0xc'),'fields':[_0xb28a('0xd')],'type':_0xb28a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f2d42,_0x3282de,_0x50acb2){var _0x4db6de=_0x5c84f3[_0xb28a('0xf')];var _0x40b7da=_0x1f2d42[_0xb28a('0x10')]({'plain':!![]});if(_0x40b7da[_0xb28a('0x11')]['toLowerCase']()==='in'||_0x40b7da['direction'][_0xb28a('0x12')]()===_0xb28a('0x13')&&!_0x40b7da[_0xb28a('0x14')]&&!_['isNil'](_0x40b7da['UserId'])){_0x4db6de[_0xb28a('0x15')][_0xb28a('0x16')]({'where':{'id':_0x40b7da['WhatsappInteractionId']}})[_0xb28a('0x17')](function(_0x309fe0){if(_0x309fe0){_0x309fe0[_0xb28a('0x18')]({'lastMsgAt':_0x40b7da[_0xb28a('0x19')],'lastMsgDirection':_0x40b7da[_0xb28a('0x11')][_0xb28a('0x12')]()});}})[_0xb28a('0x1a')](function(_0x52bfba){console['error'](_0x52bfba);});}if(_0x40b7da['direction']==='out'&&!_0x40b7da[_0xb28a('0x14')]){var _0x21a8f0;_0x4db6de[_0xb28a('0x1b')][_0xb28a('0x1c')]({'where':{'id':_0x40b7da[_0xb28a('0x1d')]},'raw':!![]})[_0xb28a('0x17')](function(_0x205c6f){_0x21a8f0=_0x205c6f;if(_0x21a8f0&&_0x21a8f0['type']){switch(_0x21a8f0['type']){case _0xb28a('0x1e'):var _0x590180=require(_0xb28a('0x1e'));if(_0x21a8f0[_0xb28a('0x1f')]&&_0x21a8f0[_0xb28a('0x20')]&&_0x21a8f0[_0xb28a('0x21')]){var _0xf4cb26=new _0x590180(_0x21a8f0[_0xb28a('0x1f')],_0x21a8f0[_0xb28a('0x20')]);_0xf4cb26['messages'][_0xb28a('0x22')]({'body':_0x40b7da[_0xb28a('0xd')],'to':_0xb28a('0x23')+_0x40b7da[_0xb28a('0x21')],'from':_0xb28a('0x23')+_0x21a8f0['phone'],'statusCallback':_0x21a8f0[_0xb28a('0x24')]+_0xb28a('0x25')+_0x40b7da['id']+'/status?token='+_0x21a8f0[_0xb28a('0x26')]})[_0xb28a('0x17')](function(_0x3552bd){if(_0x3552bd[_0xb28a('0x27')]){return _0x1f2d42[_0xb28a('0x18')]({'messageId':_0x3552bd[_0xb28a('0x27')]});}})[_0xb28a('0x1a')](function(_0x14a53a){logger[_0xb28a('0x28')](_0xb28a('0x29'),'afterCreate','twilio',util[_0xb28a('0x2a')](_0x14a53a,{'showHidden':![],'depth':null}));});}else{logger[_0xb28a('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb28a('0x1e'),_0xb28a('0x2b'));}break;case'sinch':var _0x54ca02=_0x21a8f0[_0xb28a('0x1f')];var _0x2c123f=_0x21a8f0['authToken'];var _0x217684=_0x21a8f0['baseUrl']+_0xb28a('0x2c')+_0x54ca02+'/messages/';var _0x34310d={'to':[_0x40b7da[_0xb28a('0x21')]],'message':{'type':_0xb28a('0x2d'),'text':_0x40b7da[_0xb28a('0xd')]}};var _0x250d4f={'method':_0xb28a('0x2e'),'uri':_0x217684,'headers':{'Authorization':_0xb28a('0x2f')+_0x2c123f,'Content-Type':_0xb28a('0x30')},'body':_0x34310d,'json':!![]};rp(_0x250d4f)[_0xb28a('0x17')](function(_0x27b668){if(_0x27b668[_0xb28a('0x31')][0x0]['message_id']){return _0x1f2d42[_0xb28a('0x18')]({'messageId':_0x27b668[_0xb28a('0x31')][0x0]['message_id']});}})[_0xb28a('0x1a')](function(_0x10745c){logger[_0xb28a('0x32')](_0xb28a('0x33'),_0x10745c);});break;}}})['finally'](function(){_0x50acb2();});}else{_0x50acb2();}}},'charset':_0xb28a('0x34'),'collate':_0xb28a('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 78c4bcb..ee155fe 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 _0x5c68=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','options','util','moment','bluebird'];(function(_0xef0d9e,_0x55589d){var _0x2914ad=function(_0x1f2c6e){while(--_0x1f2c6e){_0xef0d9e['push'](_0xef0d9e['shift']());}};_0x2914ad(++_0x55589d);}(_0x5c68,0x71));var _0x85c6=function(_0x569b5c,_0x2bb790){_0x569b5c=_0x569b5c-0x0;var _0x86c7ff=_0x5c68[_0x569b5c];return _0x86c7ff;};'use strict';var _=require('lodash');var util=require(_0x85c6('0x0'));var moment=require(_0x85c6('0x1'));var BPromise=require(_0x85c6('0x2'));var rs=require(_0x85c6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85c6('0x5'));var config=require(_0x85c6('0x6'));var jayson=require(_0x85c6('0x7'));var client=jayson[_0x85c6('0x8')][_0x85c6('0x9')]({'port':0x232a});config[_0x85c6('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85c6('0xb'))(new Redis(config[_0x85c6('0xa')]));require(_0x85c6('0xc'))[_0x85c6('0xd')](socket);function respondWithRpcPromise(_0x3ae5e9,_0x3d3036,_0x49d1e3){return new BPromise(function(_0x17e133,_0x477024){return client[_0x85c6('0xe')](_0x3ae5e9,_0x49d1e3)[_0x85c6('0xf')](function(_0x57759c){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3d3036,_0x85c6('0x10'));logger[_0x85c6('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3d3036,_0x85c6('0x10'),JSON[_0x85c6('0x12')](_0x57759c));if(_0x57759c[_0x85c6('0x13')]){if(_0x57759c[_0x85c6('0x13')][_0x85c6('0x14')]===0x1f4){logger[_0x85c6('0x13')](_0x85c6('0x15'),_0x3d3036,_0x57759c[_0x85c6('0x13')]['message']);return _0x477024(_0x57759c[_0x85c6('0x13')][_0x85c6('0x16')]);}logger[_0x85c6('0x13')](_0x85c6('0x15'),_0x3d3036,_0x57759c[_0x85c6('0x13')][_0x85c6('0x16')]);return _0x17e133(_0x57759c[_0x85c6('0x13')][_0x85c6('0x16')]);}else{logger[_0x85c6('0x17')](_0x85c6('0x15'),_0x3d3036,_0x85c6('0x10'));_0x17e133(_0x57759c[_0x85c6('0x18')]['message']);}})[_0x85c6('0x19')](function(_0x589c58){logger[_0x85c6('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x3d3036,_0x589c58);_0x477024(_0x589c58);});});}exports[_0x85c6('0x1a')]=function(_0x3d52ae){var _0x2296f3=this;return new Promise(function(_0x34a439,_0x243f04){return db[_0x85c6('0x1b')]['create'](_0x3d52ae['body'],{'raw':_0x3d52ae['options']?_0x3d52ae[_0x85c6('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x114cad){logger[_0x85c6('0x17')](_0x85c6('0x1a'),_0x3d52ae);logger[_0x85c6('0x11')](_0x85c6('0x1a'),_0x3d52ae,JSON[_0x85c6('0x12')](_0x114cad));_0x34a439(_0x114cad);})['catch'](function(_0x4618aa){logger[_0x85c6('0x13')](_0x85c6('0x1a'),_0x4618aa[_0x85c6('0x16')],_0x3d52ae);_0x243f04(_0x2296f3[_0x85c6('0x13')](0x1f4,_0x4618aa['message']));});});}; \ No newline at end of file +var _0x11d8=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register'];(function(_0xad13de,_0x40c6d5){var _0x27553a=function(_0x441bb8){while(--_0x441bb8){_0xad13de['push'](_0xad13de['shift']());}};_0x27553a(++_0x40c6d5);}(_0x11d8,0xd2));var _0x811d=function(_0x136616,_0xba44d){_0x136616=_0x136616-0x0;var _0x329ecd=_0x11d8[_0x136616];return _0x329ecd;};'use strict';var _=require('lodash');var util=require(_0x811d('0x0'));var moment=require('moment');var BPromise=require(_0x811d('0x1'));var rs=require(_0x811d('0x2'));var fs=require('fs');var Redis=require(_0x811d('0x3'));var db=require(_0x811d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x811d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x811d('0x6')][_0x811d('0x7')]({'port':0x232a});config['redis']=_[_0x811d('0x8')](config['redis'],{'host':_0x811d('0x9'),'port':0x18eb});var socket=require(_0x811d('0xa'))(new Redis(config[_0x811d('0xb')]));require(_0x811d('0xc'))[_0x811d('0xd')](socket);function respondWithRpcPromise(_0x140427,_0x54a9f0,_0x5405fe){return new BPromise(function(_0x213086,_0x4fa973){return client[_0x811d('0xe')](_0x140427,_0x5405fe)[_0x811d('0xf')](function(_0x463fef){logger[_0x811d('0x10')](_0x811d('0x11'),_0x54a9f0,_0x811d('0x12'));logger[_0x811d('0x13')](_0x811d('0x14'),_0x54a9f0,_0x811d('0x12'),JSON[_0x811d('0x15')](_0x463fef));if(_0x463fef[_0x811d('0x16')]){if(_0x463fef[_0x811d('0x16')][_0x811d('0x17')]===0x1f4){logger[_0x811d('0x16')](_0x811d('0x11'),_0x54a9f0,_0x463fef[_0x811d('0x16')][_0x811d('0x18')]);return _0x4fa973(_0x463fef[_0x811d('0x16')][_0x811d('0x18')]);}logger[_0x811d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x54a9f0,_0x463fef[_0x811d('0x16')][_0x811d('0x18')]);return _0x213086(_0x463fef[_0x811d('0x16')]['message']);}else{logger[_0x811d('0x10')](_0x811d('0x11'),_0x54a9f0,_0x811d('0x12'));_0x213086(_0x463fef['result'][_0x811d('0x18')]);}})[_0x811d('0x19')](function(_0x4542cf){logger[_0x811d('0x16')](_0x811d('0x11'),_0x54a9f0,_0x4542cf);_0x4fa973(_0x4542cf);});});}exports[_0x811d('0x1a')]=function(_0x350760){var _0x5588fe=this;return new Promise(function(_0x429234,_0x574b12){return db[_0x811d('0x1b')][_0x811d('0x1c')](_0x350760[_0x811d('0x1d')],{'raw':_0x350760['options']?_0x350760[_0x811d('0x1e')][_0x811d('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1a5d3b){logger[_0x811d('0x10')](_0x811d('0x1a'),_0x350760);logger[_0x811d('0x13')](_0x811d('0x1a'),_0x350760,JSON[_0x811d('0x15')](_0x1a5d3b));_0x429234(_0x1a5d3b);})[_0x811d('0x19')](function(_0x4b8a19){logger[_0x811d('0x16')](_0x811d('0x1a'),_0x4b8a19[_0x811d('0x18')],_0x350760);_0x574b12(_0x5588fe[_0x811d('0x16')](0x1f4,_0x4b8a19['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 28e4157..a9f8c59 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 _0x40a9=['register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x40a9,0xb1));var _0x940a=function(_0x336d2d,_0x1b0c2f){_0x336d2d=_0x336d2d-0x0;var _0x38b9f4=_0x40a9[_0x336d2d];return _0x38b9f4;};'use strict';var WhatsappMessageEvents=require(_0x940a('0x0'));var events=[_0x940a('0x1'),'remove',_0x940a('0x2')];function createListener(_0x2ed490,_0x26ef3d){return function(_0x5b4956){_0x26ef3d['emit'](_0x2ed490,_0x5b4956);};}function removeListener(_0x3847ca,_0x12ad58){return function(){WhatsappMessageEvents['removeListener'](_0x3847ca,_0x12ad58);};}exports[_0x940a('0x3')]=function(_0x18328c){for(var _0x477a44=0x0,_0x407309=events[_0x940a('0x4')];_0x477a44<_0x407309;_0x477a44++){var _0x5187a3=events[_0x477a44];var _0x39c45=createListener(_0x940a('0x5')+_0x5187a3,_0x18328c);WhatsappMessageEvents['on'](_0x5187a3,_0x39c45);}}; \ No newline at end of file +var _0xdefd=['save','update','length'];(function(_0x5f0305,_0x4bdfa8){var _0x344ecf=function(_0x4c5d5b){while(--_0x4c5d5b){_0x5f0305['push'](_0x5f0305['shift']());}};_0x344ecf(++_0x4bdfa8);}(_0xdefd,0x1e3));var _0xddef=function(_0x1fd65a,_0x2abb3a){_0x1fd65a=_0x1fd65a-0x0;var _0xc750fe=_0xdefd[_0x1fd65a];return _0xc750fe;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xddef('0x0'),'remove',_0xddef('0x1')];function createListener(_0xc29ef,_0x4ec924){return function(_0x3b8bd6){_0x4ec924['emit'](_0xc29ef,_0x3b8bd6);};}function removeListener(_0x46042e,_0x2342d8){return function(){WhatsappMessageEvents['removeListener'](_0x46042e,_0x2342d8);};}exports['register']=function(_0xf92253){for(var _0x46e629=0x0,_0x12ccea=events[_0xddef('0x2')];_0x46e629<_0x12ccea;_0x46e629++){var _0x45d932=events[_0x46e629];var _0x49ccfb=createListener('whatsappMessage:'+_0x45d932,_0xf92253);WhatsappMessageEvents['on'](_0x45d932,_0x49ccfb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 003bf5a..69ad42a 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 _0x0e8a=['get','isAuthenticated','index','describe','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0e8a,0x17e));var _0xa0e8=function(_0x5a7b40,_0x585230){_0x5a7b40=_0x5a7b40-0x0;var _0x463559=_0x0e8a[_0x5a7b40];return _0x463559;};'use strict';var multer=require(_0xa0e8('0x0'));var util=require(_0xa0e8('0x1'));var path=require(_0xa0e8('0x2'));var timeout=require(_0xa0e8('0x3'));var express=require(_0xa0e8('0x4'));var router=express['Router']();var fs_extra=require(_0xa0e8('0x5'));var auth=require(_0xa0e8('0x6'));var interaction=require(_0xa0e8('0x7'));var config=require(_0xa0e8('0x8'));var controller=require(_0xa0e8('0x9'));router[_0xa0e8('0xa')]('/',auth[_0xa0e8('0xb')](),controller[_0xa0e8('0xc')]);router['get']('/describe',auth[_0xa0e8('0xb')](),controller[_0xa0e8('0xd')]);router[_0xa0e8('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa0e8('0xa')](_0xa0e8('0xe'),auth[_0xa0e8('0xb')](),controller[_0xa0e8('0xf')]);router['get'](_0xa0e8('0x10'),auth[_0xa0e8('0xb')](),controller['getTeams']);router[_0xa0e8('0xa')](_0xa0e8('0x11'),auth[_0xa0e8('0xb')](),controller['getAgents']);router[_0xa0e8('0x12')]('/',auth[_0xa0e8('0xb')](),controller[_0xa0e8('0x13')]);router[_0xa0e8('0x12')](_0xa0e8('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa0e8('0x12')](_0xa0e8('0x11'),auth[_0xa0e8('0xb')](),controller[_0xa0e8('0x14')]);router['put'](_0xa0e8('0x15'),auth[_0xa0e8('0xb')](),controller[_0xa0e8('0x16')]);router[_0xa0e8('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xa0e8('0x18')]);router[_0xa0e8('0x17')]('/:id/teams',auth[_0xa0e8('0xb')](),controller[_0xa0e8('0x19')]);router[_0xa0e8('0x17')](_0xa0e8('0x11'),auth[_0xa0e8('0xb')](),controller[_0xa0e8('0x1a')]);module[_0xa0e8('0x1b')]=router; \ No newline at end of file +var _0xdc8c=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdc8c,0x88));var _0xcdc8=function(_0x5f15c3,_0x5657e1){_0x5f15c3=_0x5f15c3-0x0;var _0x48405e=_0xdc8c[_0x5f15c3];return _0x48405e;};'use strict';var multer=require('multer');var util=require(_0xcdc8('0x0'));var path=require(_0xcdc8('0x1'));var timeout=require(_0xcdc8('0x2'));var express=require(_0xcdc8('0x3'));var router=express[_0xcdc8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcdc8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc8('0x6'));var controller=require(_0xcdc8('0x7'));router[_0xcdc8('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdc8('0x9')]);router[_0xcdc8('0x8')](_0xcdc8('0xa'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0xc')]);router['get']('/:id',auth[_0xcdc8('0xb')](),controller[_0xcdc8('0xd')]);router[_0xcdc8('0x8')]('/:id/members',auth[_0xcdc8('0xb')](),controller[_0xcdc8('0xe')]);router[_0xcdc8('0x8')](_0xcdc8('0xf'),auth['isAuthenticated'](),controller[_0xcdc8('0x10')]);router[_0xcdc8('0x8')](_0xcdc8('0x11'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x12')]);router[_0xcdc8('0x13')]('/',auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x14')]);router[_0xcdc8('0x13')](_0xcdc8('0xf'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x15')]);router[_0xcdc8('0x13')](_0xcdc8('0x11'),auth[_0xcdc8('0xb')](),controller['addAgents']);router[_0xcdc8('0x16')](_0xcdc8('0x17'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x18')]);router[_0xcdc8('0x19')]('/:id',auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x1a')]);router['delete'](_0xcdc8('0xf'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x1b')]);router['delete'](_0xcdc8('0x11'),auth[_0xcdc8('0xb')](),controller[_0xcdc8('0x1c')]);module[_0xcdc8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fa79d48..743a9e0 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 _0xacfe=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xacfe,0xfd));var _0xeacf=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xacfe[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeacf('0x0')],'unique':_0xeacf('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeacf('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeacf('0x3')](_0xeacf('0x4'),_0xeacf('0x5'),_0xeacf('0x6'))},'description':{'type':Sequelize[_0xeacf('0x0')]}}; \ No newline at end of file +var _0x220b=['name','INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x9530c0,_0x46e8a4){var _0x4e0098=function(_0x3b688f){while(--_0x3b688f){_0x9530c0['push'](_0x9530c0['shift']());}};_0x4e0098(++_0x46e8a4);}(_0x220b,0x1a2));var _0xb220=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x220b[_0x3acee8];return _0x5046cc;};'use strict';var Sequelize=require('sequelize');module[_0xb220('0x0')]={'name':{'type':Sequelize[_0xb220('0x1')],'unique':_0xb220('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb220('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb220('0x4'),'beepall',_0xb220('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e17ea08..3b10579 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 _0xc757=['toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','get','UserProfileResource','then','error','stack','name','send','map','WhatsappQueue','type','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','fields','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','options','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Agents','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize'];(function(_0x2cf095,_0x1a7f9b){var _0x22d68f=function(_0xd8d382){while(--_0xd8d382){_0x2cf095['push'](_0x2cf095['shift']());}};_0x22d68f(++_0x1a7f9b);}(_0xc757,0x104));var _0x7c75=function(_0xfa20e5,_0x138144){_0xfa20e5=_0xfa20e5-0x0;var _0x598bd7=_0xc757[_0xfa20e5];return _0x598bd7;};'use strict';var BPromise=require(_0x7c75('0x0'));var util=require(_0x7c75('0x1'));var _=require(_0x7c75('0x2'));var squel=require(_0x7c75('0x3'));var Redis=require('ioredis');var qs=require(_0x7c75('0x4'));var logger=require('../../config/logger')(_0x7c75('0x5'));var config=require(_0x7c75('0x6'));var db=require(_0x7c75('0x7'))['db'];config[_0x7c75('0x8')]=_[_0x7c75('0x9')](config[_0x7c75('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7c75('0xa')](socket);function respondWithStatusCode(_0x3eacce,_0x4866fb){_0x4866fb=_0x4866fb||0xcc;return function(_0x4f0823){if(_0x4f0823){return _0x3eacce[_0x7c75('0xb')](_0x4866fb);}return _0x3eacce[_0x7c75('0xc')](_0x4866fb)[_0x7c75('0xd')]();};}function respondWithResult(_0x2cf8c1,_0x267722){_0x267722=_0x267722||0xc8;return function(_0x296bfa){if(_0x296bfa){return _0x2cf8c1[_0x7c75('0xc')](_0x267722)[_0x7c75('0xe')](_0x296bfa);}};}function respondWithFilteredResult(_0x53b979,_0x1a4dd6){return function(_0x2eb70e){if(_0x2eb70e){var _0xd992f7=typeof _0x1a4dd6['offset']===_0x7c75('0xf')&&typeof _0x1a4dd6[_0x7c75('0x10')]===_0x7c75('0xf');var _0x3027ee=_0x2eb70e[_0x7c75('0x11')];var _0x5090f6=_0xd992f7?0x0:_0x1a4dd6[_0x7c75('0x12')];var _0x2d7d19=_0xd992f7?_0x2eb70e[_0x7c75('0x11')]:_0x1a4dd6['offset']+_0x1a4dd6[_0x7c75('0x10')];var _0x1527b3;if(_0x2d7d19>=_0x3027ee){_0x2d7d19=_0x3027ee;_0x1527b3=0xc8;}else{_0x1527b3=0xce;}_0x53b979[_0x7c75('0xc')](_0x1527b3);return _0x53b979[_0x7c75('0x13')]('Content-Range',_0x5090f6+'-'+_0x2d7d19+'/'+_0x3027ee)[_0x7c75('0xe')](_0x2eb70e);}return null;};}function saveUpdates(_0x5f4dae){return function(_0x2fee17){if(_0x2fee17){return _0x2fee17[_0x7c75('0x14')](_0x5f4dae)['then'](function(_0x546abe){return _0x546abe;});}return null;};}function removeEntity(_0x1c29e3){return function(_0x5d8d39){if(_0x5d8d39){return _0x5d8d39[_0x7c75('0x15')]()['then'](function(){var _0x516221=_0x5d8d39[_0x7c75('0x16')]({'plain':!![]});var _0x439f48='WhatsappQueues';return db[_0x7c75('0x17')]['destroy']({'where':{'type':_0x439f48,'resourceId':_0x516221['id']}})[_0x7c75('0x18')](function(){return _0x5d8d39;});})[_0x7c75('0x18')](function(){_0x1c29e3['status'](0xcc)[_0x7c75('0xd')]();});}};}function handleEntityNotFound(_0x338a96){return function(_0x367dc5){if(!_0x367dc5){_0x338a96[_0x7c75('0xb')](0x194);}return _0x367dc5;};}function handleError(_0x5e5ff0,_0x54a7db){_0x54a7db=_0x54a7db||0x1f4;return function(_0xdec81b){logger[_0x7c75('0x19')](_0xdec81b[_0x7c75('0x1a')]);if(_0xdec81b['name']){delete _0xdec81b[_0x7c75('0x1b')];}_0x5e5ff0[_0x7c75('0xc')](_0x54a7db)[_0x7c75('0x1c')](_0xdec81b);};}exports['index']=function(_0x46249a,_0x215b0b){var _0x2510b3={};var _0x41ef14={'count':0x0,'rows':[]};var _0x5e0d4a=_[_0x7c75('0x1d')](db[_0x7c75('0x1e')]['rawAttributes'],function(_0x1a278e){return{'name':_0x1a278e['fieldName'],'type':_0x1a278e[_0x7c75('0x1f')][_0x7c75('0x20')]};});_0x2510b3=qs[_0x7c75('0x21')](_0x5e0d4a,_0x46249a);var _0x217dbd={'where':_0x2510b3[_0x7c75('0x22')]};return db[_0x7c75('0x1e')]['count'](_0x217dbd)[_0x7c75('0x18')](function(_0x243f26){_0x41ef14[_0x7c75('0x11')]=_0x243f26;_0x2510b3[_0x7c75('0x23')]=qs[_0x7c75('0x23')](_0x46249a[_0x7c75('0x24')]);return db[_0x7c75('0x1e')][_0x7c75('0x25')](_0x2510b3);})[_0x7c75('0x18')](function(_0x2362cb){_0x41ef14[_0x7c75('0x26')]=_0x2362cb;return _0x41ef14;})['then'](respondWithFilteredResult(_0x215b0b,_0x2510b3))[_0x7c75('0x27')](handleError(_0x215b0b,null));};exports['show']=function(_0x48d859,_0x14c28b){var _0x16b805={'raw':!![],'where':{'id':_0x48d859[_0x7c75('0x28')]['id']}},_0x1fa941={};_0x1fa941[_0x7c75('0x29')]=_[_0x7c75('0x2a')](db[_0x7c75('0x1e')][_0x7c75('0x2b')]);_0x1fa941[_0x7c75('0x24')]=_[_0x7c75('0x2a')](_0x48d859[_0x7c75('0x24')]);_0x1fa941[_0x7c75('0x2c')]=_[_0x7c75('0x2d')](_0x1fa941[_0x7c75('0x29')],_0x1fa941['query']);_0x16b805[_0x7c75('0x2e')]=_['intersection'](_0x1fa941[_0x7c75('0x29')],qs['fields'](_0x48d859[_0x7c75('0x24')]['fields']));_0x16b805[_0x7c75('0x2e')]=_0x16b805['attributes'][_0x7c75('0x2f')]?_0x16b805[_0x7c75('0x2e')]:_0x1fa941[_0x7c75('0x29')];if(_0x48d859[_0x7c75('0x24')][_0x7c75('0x30')]){_0x16b805[_0x7c75('0x23')]=[{'all':!![]}];}_0x16b805=_[_0x7c75('0x31')]({},_0x16b805,_0x48d859['options']);return db['WhatsappQueue'][_0x7c75('0x32')](_0x16b805)[_0x7c75('0x18')](handleEntityNotFound(_0x14c28b,null))[_0x7c75('0x18')](respondWithResult(_0x14c28b,null))[_0x7c75('0x27')](handleError(_0x14c28b,null));};exports[_0x7c75('0x33')]=function(_0x16c1a3,_0x38aae9){return db[_0x7c75('0x1e')][_0x7c75('0x33')](_0x16c1a3[_0x7c75('0x34')],{})[_0x7c75('0x18')](function(_0x3a6b2b){var _0x2ffdca=_0x16c1a3[_0x7c75('0x35')]['get']({'plain':!![]});if(!_0x2ffdca)throw new Error(_0x7c75('0x36'));if(_0x2ffdca[_0x7c75('0x37')]===_0x7c75('0x35')){var _0x5533a2=_0x3a6b2b['get']({'plain':!![]});var _0x345329='WhatsappQueues';return db[_0x7c75('0x38')][_0x7c75('0x32')]({'where':{'name':_0x345329,'userProfileId':_0x2ffdca[_0x7c75('0x39')]},'raw':!![]})[_0x7c75('0x18')](function(_0x142ae8){if(_0x142ae8&&_0x142ae8[_0x7c75('0x3a')]===0x0){return db[_0x7c75('0x17')]['create']({'name':_0x5533a2['name'],'resourceId':_0x5533a2['id'],'type':_0x142ae8['name'],'sectionId':_0x142ae8['id']},{})[_0x7c75('0x18')](function(){return _0x3a6b2b;});}else{return _0x3a6b2b;}})['catch'](function(_0x744d71){logger[_0x7c75('0x19')](_0x7c75('0x3b'),_0x744d71);throw _0x744d71;});}return _0x3a6b2b;})[_0x7c75('0x18')](respondWithResult(_0x38aae9,0xc9))['catch'](handleError(_0x38aae9,null));};exports['update']=function(_0x23f784,_0x3d1a7c){if(_0x23f784[_0x7c75('0x34')]['id']){delete _0x23f784[_0x7c75('0x34')]['id'];}return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0x23f784[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x3d1a7c,null))[_0x7c75('0x18')](saveUpdates(_0x23f784[_0x7c75('0x34')],null))['then'](respondWithResult(_0x3d1a7c,null))[_0x7c75('0x27')](handleError(_0x3d1a7c,null));};exports[_0x7c75('0x15')]=function(_0x3a40f9,_0x57aa90){return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0x3a40f9[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x57aa90,null))['then'](removeEntity(_0x57aa90,null))[_0x7c75('0x27')](handleError(_0x57aa90,null));};exports[_0x7c75('0x3c')]=function(_0x4a1924,_0x49ea00){return db['WhatsappQueue'][_0x7c75('0x3c')]()[_0x7c75('0x18')](respondWithResult(_0x49ea00,null))[_0x7c75('0x27')](handleError(_0x49ea00,null));};exports[_0x7c75('0x3d')]=function(_0x3ef738,_0x553937){var _0x5c127a={'raw':!![],'where':{}},_0x5139f5={},_0xbee26b;return db[_0x7c75('0x1e')][_0x7c75('0x3e')]({'where':{'id':_0x3ef738[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x553937,null))[_0x7c75('0x18')](function(_0x19cd88){if(_0x19cd88){_0xbee26b=_0x19cd88[_0x7c75('0x16')]({'plain':!![]});_0x5139f5[_0x7c75('0x29')]=_[_0x7c75('0x2a')](db[_0x7c75('0x3f')][_0x7c75('0x2b')]);_0x5139f5[_0x7c75('0x24')]=_['keys'](_0x3ef738[_0x7c75('0x24')]);_0x5139f5['filters']=_[_0x7c75('0x2d')](_0x5139f5[_0x7c75('0x29')],_0x5139f5[_0x7c75('0x24')]);_0x5c127a[_0x7c75('0x2e')]=_['intersection'](_0x5139f5[_0x7c75('0x29')],qs[_0x7c75('0x40')](_0x3ef738[_0x7c75('0x24')][_0x7c75('0x40')]));_0x5c127a[_0x7c75('0x2e')]=_0x5c127a[_0x7c75('0x2e')][_0x7c75('0x2f')]?_0x5c127a[_0x7c75('0x2e')]:_0x5139f5[_0x7c75('0x29')];if(!_0x3ef738['query'][_0x7c75('0x41')](_0x7c75('0x42'))){_0x5c127a['limit']=qs[_0x7c75('0x10')](_0x3ef738[_0x7c75('0x24')][_0x7c75('0x10')]);_0x5c127a[_0x7c75('0x12')]=qs[_0x7c75('0x12')](_0x3ef738[_0x7c75('0x24')][_0x7c75('0x12')]);}_0x5c127a[_0x7c75('0x43')]=qs[_0x7c75('0x44')](_0x3ef738[_0x7c75('0x24')][_0x7c75('0x44')]);_0x5c127a[_0x7c75('0x22')]=qs[_0x7c75('0x2c')](_[_0x7c75('0x45')](_0x3ef738[_0x7c75('0x24')],_0x5139f5['filters']));_0x5c127a[_0x7c75('0x22')][_0x7c75('0x46')]=_0x19cd88['id'];if(_0x3ef738[_0x7c75('0x24')]['filter']){_0x5c127a[_0x7c75('0x22')]=_[_0x7c75('0x31')](_0x5c127a[_0x7c75('0x22')],{'$or':_[_0x7c75('0x1d')](_0x5c127a[_0x7c75('0x2e')],function(_0x10828b){var _0x5a8a2a={};_0x5a8a2a[_0x10828b]={'$like':'%'+_0x3ef738[_0x7c75('0x24')][_0x7c75('0x47')]+'%'};return _0x5a8a2a;})});}_0x5c127a=_[_0x7c75('0x31')]({},_0x5c127a,_0x3ef738[_0x7c75('0x48')]);return db[_0x7c75('0x3f')][_0x7c75('0x25')](_0x5c127a);}})[_0x7c75('0x18')](function(_0xe8b9d5){if(_0xe8b9d5){return db[_0x7c75('0x49')][_0x7c75('0x4a')]({'where':{'id':_[_0x7c75('0x1d')](_0xe8b9d5,_0x7c75('0x4b')),'role':'agent'},'attributes':['id',_0x7c75('0x1b'),_0x7c75('0x4c'),_0x7c75('0x4d'),_0x7c75('0x4e')]});}})[_0x7c75('0x18')](function(_0x194f10){if(_0x194f10){return{'count':_0x194f10[_0x7c75('0x11')],'rows':_[_0x7c75('0x1d')](_0x194f10[_0x7c75('0x26')],function(_0x152764){return{'membername':_0x152764['name'],'UserId':_0x152764['id'],'queue_name':_0xbee26b[_0x7c75('0x1b')],'WhatsappQueueId':_0xbee26b['id'],'interface':util[_0x7c75('0x4f')](_0x7c75('0x50'),'SIP',_0x152764[_0x7c75('0x1b')]),'penalty':0x0,'paused':_0x152764[_0x7c75('0x4c')],'createdAt':_0x152764[_0x7c75('0x4e')],'updatedAt':_0x152764[_0x7c75('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x553937,_0x5c127a))[_0x7c75('0x27')](handleError(_0x553937,null));};exports[_0x7c75('0x51')]=function(_0x2459e7,_0x24e3e3){var _0x2bbc78={};var _0x1a7db0={};var _0x14531e;var _0x2823b9;return db['WhatsappQueue'][_0x7c75('0x3e')]({'where':{'id':_0x2459e7[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x24e3e3,null))[_0x7c75('0x18')](function(_0x344cee){if(_0x344cee){_0x14531e=_0x344cee;_0x1a7db0[_0x7c75('0x29')]=_[_0x7c75('0x2a')](db[_0x7c75('0x52')][_0x7c75('0x2b')]);_0x1a7db0[_0x7c75('0x24')]=_[_0x7c75('0x2a')](_0x2459e7[_0x7c75('0x24')]);_0x1a7db0[_0x7c75('0x2c')]=_[_0x7c75('0x2d')](_0x1a7db0['model'],_0x1a7db0[_0x7c75('0x24')]);_0x2bbc78['attributes']=_['intersection'](_0x1a7db0[_0x7c75('0x29')],qs[_0x7c75('0x40')](_0x2459e7[_0x7c75('0x24')][_0x7c75('0x40')]));_0x2bbc78['attributes']=_0x2bbc78['attributes'][_0x7c75('0x2f')]?_0x2bbc78['attributes']:_0x1a7db0[_0x7c75('0x29')];_0x2bbc78[_0x7c75('0x43')]=qs['sort'](_0x2459e7[_0x7c75('0x24')][_0x7c75('0x44')]);_0x2bbc78[_0x7c75('0x22')]=qs[_0x7c75('0x2c')](_[_0x7c75('0x45')](_0x2459e7[_0x7c75('0x24')],_0x1a7db0['filters']));if(_0x2459e7['query'][_0x7c75('0x47')]){_0x2bbc78['where']=_[_0x7c75('0x31')](_0x2bbc78['where'],{'$or':_['map'](_0x2bbc78['attributes'],function(_0xf3838a){var _0x34b1d3={};_0x34b1d3[_0xf3838a]={'$like':'%'+_0x2459e7['query']['filter']+'%'};return _0x34b1d3;})});}_0x2bbc78=_[_0x7c75('0x31')]({},_0x2bbc78,_0x2459e7[_0x7c75('0x48')]);return _0x14531e[_0x7c75('0x51')](_0x2bbc78);}})['then'](function(_0x55be37){if(_0x55be37){_0x2823b9=_0x55be37[_0x7c75('0x2f')];if(!_0x2459e7[_0x7c75('0x24')][_0x7c75('0x41')](_0x7c75('0x42'))){_0x2bbc78['limit']=qs['limit'](_0x2459e7[_0x7c75('0x24')]['limit']);_0x2bbc78['offset']=qs[_0x7c75('0x12')](_0x2459e7[_0x7c75('0x24')][_0x7c75('0x12')]);}return _0x14531e[_0x7c75('0x51')](_0x2bbc78);}})[_0x7c75('0x18')](function(_0x3c30b0){if(_0x3c30b0){return _0x3c30b0?{'count':_0x2823b9,'rows':_0x3c30b0}:null;}})['then'](respondWithResult(_0x24e3e3,null))[_0x7c75('0x27')](handleError(_0x24e3e3,null));};exports[_0x7c75('0x53')]=function(_0x45e9e0,_0x1115c3){var _0x41543d=_0x45e9e0[_0x7c75('0x34')][_0x7c75('0x54')];return db['Team'][_0x7c75('0x25')]({'where':{'id':_0x41543d},'attributes':['id'],'include':[{'model':db[_0x7c75('0x49')],'as':'Agents','attributes':['id','name',_0x7c75('0x55'),_0x7c75('0x56'),_0x7c75('0x57')],'raw':!![]}]})['then'](function(_0x97caef){if(_0x97caef){var _0x3a96fa=_[_0x7c75('0x58')](_0x97caef,function(_0x235b02){var _0x537a5a=_0x235b02['get']({'plain':!![]});return _0x537a5a['Agents'];});return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0x45e9e0[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](function(_0x24ca7c){return db['sequelize'][_0x7c75('0x59')](function(_0x3270cb){return _0x24ca7c[_0x7c75('0x53')](_0x41543d,{'transaction':_0x3270cb})[_0x7c75('0x18')](function(){return BPromise[_0x7c75('0x5a')](_0x3a96fa,function(_0x788232){return db[_0x7c75('0x3f')][_0x7c75('0x5b')]({'where':{'UserId':_0x788232['id'],'WhatsappQueueId':_0x45e9e0[_0x7c75('0x28')]['id']},'transaction':_0x3270cb});});})[_0x7c75('0x18')](function(){_0x3a96fa[_0x7c75('0x5c')](function(_0x20b3ae){socket[_0x7c75('0x5d')](_0x7c75('0x5e'),{'UserId':_0x20b3ae['id'],'WhatsappQueueId':_0x24ca7c['id']});});});});});}})[_0x7c75('0x18')](respondWithStatusCode(_0x1115c3,null))[_0x7c75('0x27')](handleError(_0x1115c3,null));};exports[_0x7c75('0x5f')]=function(_0xed68f0,_0x4b901f){return db['Team'][_0x7c75('0x25')]({'where':{'id':_0xed68f0['query'][_0x7c75('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7c75('0x60'),'attributes':['id'],'raw':!![]}]})[_0x7c75('0x18')](handleEntityNotFound(_0x4b901f,null))[_0x7c75('0x18')](function(_0x490a66){var _0x28b3f3=_[_0x7c75('0x1d')](_0x490a66,'id');var _0x3dd4ec=[];var _0x5aefd1=[];var _0x37869a=squel['select']();_0x37869a[_0x7c75('0x61')](_0x7c75('0x62'))['from'](_0x7c75('0x63'),'tq')[_0x7c75('0x64')](_0x7c75('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7c75('0x22')](_0x7c75('0x66'),_0xed68f0[_0x7c75('0x28')]['id']);for(var _0x117086=0x0;_0x117086<_0x490a66[_0x7c75('0x2f')];_0x117086+=0x1){let _0x2af088=_0x490a66[_0x117086];for(var _0x5b0b3f=0x0;_0x5b0b3f<_0x2af088[_0x7c75('0x60')][_0x7c75('0x2f')];_0x5b0b3f+=0x1){let _0x50877a=_0x2af088[_0x7c75('0x60')][_0x5b0b3f];var _0x9c0dce=_0x37869a['clone']();_0x9c0dce[_0x7c75('0x22')](_0x7c75('0x67'),_0x50877a['id']);_0x5aefd1[_0x7c75('0x68')](db[_0x7c75('0x69')]['query'](_0x9c0dce[_0x7c75('0x6a')](),{'type':db[_0x7c75('0x69')]['QueryTypes'][_0x7c75('0x6b')]})[_0x7c75('0x18')](function(_0x490743){if(_0x490743[_0x7c75('0x2f')]===0x1){return _0x50877a['id'];}else{var _0xf80c4a=_['every'](_[_0x7c75('0x1d')](_0x490743,_0x7c75('0x6c')),function(_0x2f7467){return _[_0x7c75('0x6d')](_0x28b3f3,_0x2f7467);});if(_0xf80c4a){return _0x50877a['id'];}}}));}}return BPromise[_0x7c75('0x6e')](_0x5aefd1)[_0x7c75('0x18')](function(_0x1af392){_0x3dd4ec=_(_0x3dd4ec)[_0x7c75('0x6f')](_0x1af392)[_0x7c75('0x70')]()[_0x7c75('0x71')]();return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0xed68f0['params']['id']}})[_0x7c75('0x18')](function(_0x52409d){return db['sequelize'][_0x7c75('0x59')](function(_0x9d5028){return _0x52409d['removeTeams'](_0xed68f0[_0x7c75('0x24')][_0x7c75('0x54')],{'transaction':_0x9d5028})[_0x7c75('0x18')](function(){if(!_[_0x7c75('0x72')](_0x3dd4ec)){return _0x52409d['removeAgents'](_0x3dd4ec,{'transaction':_0x9d5028});}})[_0x7c75('0x18')](function(){_0x3dd4ec[_0x7c75('0x5c')](function(_0xc2fcee){socket[_0x7c75('0x5d')]('userWhatsappQueue:remove',{'UserId':_0xc2fcee,'WhatsappQueueId':_0x52409d['id']});});});});});});})[_0x7c75('0x18')](respondWithStatusCode(_0x4b901f,null))['catch'](handleError(_0x4b901f,null));};exports[_0x7c75('0x73')]=function(_0xe59cce,_0x33bf98){return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0xe59cce[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x33bf98,null))[_0x7c75('0x18')](function(_0x44d61a){if(_0x44d61a){return _0x44d61a['addAgents'](_0xe59cce[_0x7c75('0x34')]['ids'],_[_0x7c75('0x74')](_0xe59cce[_0x7c75('0x34')],[_0x7c75('0x54'),'id'])||{})[_0x7c75('0x75')](function(_0x3b7920){for(var _0xb9c45=0x0;_0xb9c45<_0xe59cce[_0x7c75('0x34')][_0x7c75('0x54')][_0x7c75('0x2f')];_0xb9c45+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0xe59cce[_0x7c75('0x34')]['ids'][_0xb9c45]),'WhatsappQueueId':Number(_0xe59cce[_0x7c75('0x28')]['id'])});}return _0x3b7920;});}})['then'](respondWithResult(_0x33bf98,null))[_0x7c75('0x27')](handleError(_0x33bf98,null));};exports[_0x7c75('0x76')]=function(_0x5aedf9,_0x3047a1){return db[_0x7c75('0x1e')][_0x7c75('0x32')]({'where':{'id':_0x5aedf9[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x3047a1,null))[_0x7c75('0x18')](function(_0x546de5){if(_0x546de5){return _0x546de5[_0x7c75('0x76')](_0x5aedf9['query'][_0x7c75('0x54')])[_0x7c75('0x18')](function(){if(_[_0x7c75('0x77')](_0x5aedf9[_0x7c75('0x24')][_0x7c75('0x54')])){for(var _0x18af91=0x0;_0x18af91<_0x5aedf9[_0x7c75('0x24')][_0x7c75('0x54')][_0x7c75('0x2f')];_0x18af91+=0x1){socket[_0x7c75('0x5d')](_0x7c75('0x78'),{'UserId':Number(_0x5aedf9['query'][_0x7c75('0x54')][_0x18af91]),'WhatsappQueueId':Number(_0x5aedf9[_0x7c75('0x28')]['id'])});}}else{socket[_0x7c75('0x5d')](_0x7c75('0x78'),{'UserId':Number(_0x5aedf9[_0x7c75('0x24')][_0x7c75('0x54')]),'WhatsappQueueId':Number(_0x5aedf9[_0x7c75('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x3047a1,null))[_0x7c75('0x27')](handleError(_0x3047a1,null));};exports[_0x7c75('0x79')]=function(_0x5ef844,_0x499b94){var _0x108985={};var _0x44e45c={};var _0x329faf;var _0x3c8850;return db['WhatsappQueue'][_0x7c75('0x3e')]({'where':{'id':_0x5ef844[_0x7c75('0x28')]['id']}})[_0x7c75('0x18')](handleEntityNotFound(_0x499b94,null))['then'](function(_0x1b43b2){if(_0x1b43b2){_0x329faf=_0x1b43b2;_0x44e45c[_0x7c75('0x29')]=_['keys'](db[_0x7c75('0x49')][_0x7c75('0x2b')]);_0x44e45c[_0x7c75('0x24')]=_[_0x7c75('0x2a')](_0x5ef844[_0x7c75('0x24')]);_0x44e45c[_0x7c75('0x2c')]=_['intersection'](_0x44e45c['model'],_0x44e45c[_0x7c75('0x24')]);_0x108985[_0x7c75('0x2e')]=_[_0x7c75('0x2d')](_0x44e45c['model'],qs[_0x7c75('0x40')](_0x5ef844[_0x7c75('0x24')]['fields']));_0x108985['attributes']=_0x108985['attributes'][_0x7c75('0x2f')]?_0x108985[_0x7c75('0x2e')]:_0x44e45c[_0x7c75('0x29')];_0x108985[_0x7c75('0x43')]=qs[_0x7c75('0x44')](_0x5ef844[_0x7c75('0x24')][_0x7c75('0x44')]);_0x108985['where']=qs[_0x7c75('0x2c')](_[_0x7c75('0x45')](_0x5ef844['query'],_0x44e45c['filters']));if(_0x5ef844[_0x7c75('0x24')][_0x7c75('0x47')]){_0x108985['where']=_[_0x7c75('0x31')](_0x108985[_0x7c75('0x22')],{'$or':_[_0x7c75('0x1d')](_0x108985['attributes'],function(_0x36bdc5){var _0x33ef5e={};_0x33ef5e[_0x36bdc5]={'$like':'%'+_0x5ef844[_0x7c75('0x24')][_0x7c75('0x47')]+'%'};return _0x33ef5e;})});}_0x108985=_[_0x7c75('0x31')]({},_0x108985,_0x5ef844[_0x7c75('0x48')]);return _0x329faf['getAgents'](_0x108985);}})[_0x7c75('0x18')](function(_0x4d2ef3){if(_0x4d2ef3){_0x3c8850=_0x4d2ef3['length'];if(!_0x5ef844[_0x7c75('0x24')]['hasOwnProperty'](_0x7c75('0x42'))){_0x108985['limit']=qs[_0x7c75('0x10')](_0x5ef844[_0x7c75('0x24')][_0x7c75('0x10')]);_0x108985[_0x7c75('0x12')]=qs[_0x7c75('0x12')](_0x5ef844[_0x7c75('0x24')][_0x7c75('0x12')]);}return _0x329faf['getAgents'](_0x108985);}})[_0x7c75('0x18')](function(_0x5b310a){if(_0x5b310a){return _0x5b310a?{'count':_0x3c8850,'rows':_0x5b310a}:null;}})[_0x7c75('0x18')](respondWithResult(_0x499b94,null))[_0x7c75('0x27')](handleError(_0x499b94,null));}; \ No newline at end of file +var _0x2570=['squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','UserProfileResource','error','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','rows','show','keys','filters','intersection','model','fields','attributes','length','includeAll','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserWhatsappQueue','hasOwnProperty','sort','where','WhatsappQueueId','filter','merge','options','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','order','pick','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','removeAgents','spread','isArray','userWhatsappQueue:remove','getAgents','util','lodash'];(function(_0x47ac31,_0x4a602a){var _0x15e26e=function(_0x5390a2){while(--_0x5390a2){_0x47ac31['push'](_0x47ac31['shift']());}};_0x15e26e(++_0x4a602a);}(_0x2570,0x1d6));var _0x0257=function(_0x312b89,_0x3ed2c2){_0x312b89=_0x312b89-0x0;var _0x5c0d3e=_0x2570[_0x312b89];return _0x5c0d3e;};'use strict';var BPromise=require('bluebird');var util=require(_0x0257('0x0'));var _=require(_0x0257('0x1'));var squel=require(_0x0257('0x2'));var Redis=require(_0x0257('0x3'));var qs=require(_0x0257('0x4'));var logger=require(_0x0257('0x5'))(_0x0257('0x6'));var config=require(_0x0257('0x7'));var db=require(_0x0257('0x8'))['db'];config[_0x0257('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0257('0x9')]));require('./whatsappQueue.socket')[_0x0257('0xa')](socket);function respondWithStatusCode(_0x549f78,_0x1d02c5){_0x1d02c5=_0x1d02c5||0xcc;return function(_0x5ea4bd){if(_0x5ea4bd){return _0x549f78['sendStatus'](_0x1d02c5);}return _0x549f78[_0x0257('0xb')](_0x1d02c5)[_0x0257('0xc')]();};}function respondWithResult(_0x1db39e,_0x1b82d4){_0x1b82d4=_0x1b82d4||0xc8;return function(_0x5c8f25){if(_0x5c8f25){return _0x1db39e[_0x0257('0xb')](_0x1b82d4)[_0x0257('0xd')](_0x5c8f25);}};}function respondWithFilteredResult(_0x329d23,_0x142a1e){return function(_0x306936){if(_0x306936){var _0x1da2f3=typeof _0x142a1e['offset']===_0x0257('0xe')&&typeof _0x142a1e['limit']===_0x0257('0xe');var _0x58af6e=_0x306936[_0x0257('0xf')];var _0x5fdb0e=_0x1da2f3?0x0:_0x142a1e[_0x0257('0x10')];var _0x5ade87=_0x1da2f3?_0x306936[_0x0257('0xf')]:_0x142a1e[_0x0257('0x10')]+_0x142a1e[_0x0257('0x11')];var _0x357d2d;if(_0x5ade87>=_0x58af6e){_0x5ade87=_0x58af6e;_0x357d2d=0xc8;}else{_0x357d2d=0xce;}_0x329d23['status'](_0x357d2d);return _0x329d23[_0x0257('0x12')](_0x0257('0x13'),_0x5fdb0e+'-'+_0x5ade87+'/'+_0x58af6e)[_0x0257('0xd')](_0x306936);}return null;};}function saveUpdates(_0x28b666){return function(_0x1f80a7){if(_0x1f80a7){return _0x1f80a7[_0x0257('0x14')](_0x28b666)[_0x0257('0x15')](function(_0x19520c){return _0x19520c;});}return null;};}function removeEntity(_0x215ae4){return function(_0x237421){if(_0x237421){return _0x237421[_0x0257('0x16')]()[_0x0257('0x15')](function(){var _0x3c2de5=_0x237421['get']({'plain':!![]});var _0xac3e39='WhatsappQueues';return db[_0x0257('0x17')][_0x0257('0x16')]({'where':{'type':_0xac3e39,'resourceId':_0x3c2de5['id']}})['then'](function(){return _0x237421;});})[_0x0257('0x15')](function(){_0x215ae4['status'](0xcc)[_0x0257('0xc')]();});}};}function handleEntityNotFound(_0x16099e){return function(_0x41bb9c){if(!_0x41bb9c){_0x16099e['sendStatus'](0x194);}return _0x41bb9c;};}function handleError(_0x4090f1,_0x577e63){_0x577e63=_0x577e63||0x1f4;return function(_0x403c8a){logger[_0x0257('0x18')](_0x403c8a['stack']);if(_0x403c8a[_0x0257('0x19')]){delete _0x403c8a[_0x0257('0x19')];}_0x4090f1[_0x0257('0xb')](_0x577e63)['send'](_0x403c8a);};}exports[_0x0257('0x1a')]=function(_0x57bece,_0x280b87){var _0x431111={};var _0x28316e={'count':0x0,'rows':[]};var _0x3fdd93=_[_0x0257('0x1b')](db[_0x0257('0x1c')][_0x0257('0x1d')],function(_0x44ee64){return{'name':_0x44ee64[_0x0257('0x1e')],'type':_0x44ee64['type'][_0x0257('0x1f')]};});_0x431111=qs[_0x0257('0x20')](_0x3fdd93,_0x57bece);var _0x285b07={'where':_0x431111['where']};return db['WhatsappQueue'][_0x0257('0xf')](_0x285b07)[_0x0257('0x15')](function(_0x4b2c5c){_0x28316e[_0x0257('0xf')]=_0x4b2c5c;_0x431111['include']=qs[_0x0257('0x21')](_0x57bece[_0x0257('0x22')]);return db[_0x0257('0x1c')][_0x0257('0x23')](_0x431111);})[_0x0257('0x15')](function(_0x51a050){_0x28316e[_0x0257('0x24')]=_0x51a050;return _0x28316e;})['then'](respondWithFilteredResult(_0x280b87,_0x431111))['catch'](handleError(_0x280b87,null));};exports[_0x0257('0x25')]=function(_0x20ae57,_0x2cc822){var _0x34fffa={'raw':!![],'where':{'id':_0x20ae57['params']['id']}},_0xaaeb97={};_0xaaeb97['model']=_[_0x0257('0x26')](db[_0x0257('0x1c')][_0x0257('0x1d')]);_0xaaeb97[_0x0257('0x22')]=_[_0x0257('0x26')](_0x20ae57[_0x0257('0x22')]);_0xaaeb97[_0x0257('0x27')]=_['intersection'](_0xaaeb97['model'],_0xaaeb97['query']);_0x34fffa['attributes']=_[_0x0257('0x28')](_0xaaeb97[_0x0257('0x29')],qs['fields'](_0x20ae57[_0x0257('0x22')][_0x0257('0x2a')]));_0x34fffa[_0x0257('0x2b')]=_0x34fffa[_0x0257('0x2b')][_0x0257('0x2c')]?_0x34fffa[_0x0257('0x2b')]:_0xaaeb97[_0x0257('0x29')];if(_0x20ae57[_0x0257('0x22')][_0x0257('0x2d')]){_0x34fffa['include']=[{'all':!![]}];}_0x34fffa=_['merge']({},_0x34fffa,_0x20ae57['options']);return db[_0x0257('0x1c')][_0x0257('0x2e')](_0x34fffa)[_0x0257('0x15')](handleEntityNotFound(_0x2cc822,null))[_0x0257('0x15')](respondWithResult(_0x2cc822,null))['catch'](handleError(_0x2cc822,null));};exports[_0x0257('0x2f')]=function(_0x13d757,_0x41e123){return db[_0x0257('0x1c')]['create'](_0x13d757[_0x0257('0x30')],{})[_0x0257('0x15')](function(_0x18ffa9){var _0x873197=_0x13d757[_0x0257('0x31')]['get']({'plain':!![]});if(!_0x873197)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x873197[_0x0257('0x32')]==='user'){var _0xaed364=_0x18ffa9[_0x0257('0x33')]({'plain':!![]});var _0x48a996='WhatsappQueues';return db[_0x0257('0x34')][_0x0257('0x2e')]({'where':{'name':_0x48a996,'userProfileId':_0x873197[_0x0257('0x35')]},'raw':!![]})[_0x0257('0x15')](function(_0x32ad25){if(_0x32ad25&&_0x32ad25[_0x0257('0x36')]===0x0){return db[_0x0257('0x17')][_0x0257('0x2f')]({'name':_0xaed364[_0x0257('0x19')],'resourceId':_0xaed364['id'],'type':_0x32ad25[_0x0257('0x19')],'sectionId':_0x32ad25['id']},{})[_0x0257('0x15')](function(){return _0x18ffa9;});}else{return _0x18ffa9;}})[_0x0257('0x37')](function(_0x3c8d53){logger[_0x0257('0x18')](_0x0257('0x38'),_0x3c8d53);throw _0x3c8d53;});}return _0x18ffa9;})[_0x0257('0x15')](respondWithResult(_0x41e123,0xc9))[_0x0257('0x37')](handleError(_0x41e123,null));};exports[_0x0257('0x14')]=function(_0x14c7ff,_0x3d6bdf){if(_0x14c7ff['body']['id']){delete _0x14c7ff[_0x0257('0x30')]['id'];}return db[_0x0257('0x1c')]['find']({'where':{'id':_0x14c7ff[_0x0257('0x39')]['id']}})[_0x0257('0x15')](handleEntityNotFound(_0x3d6bdf,null))['then'](saveUpdates(_0x14c7ff[_0x0257('0x30')],null))[_0x0257('0x15')](respondWithResult(_0x3d6bdf,null))[_0x0257('0x37')](handleError(_0x3d6bdf,null));};exports[_0x0257('0x16')]=function(_0x52971,_0x2c331c){return db[_0x0257('0x1c')][_0x0257('0x2e')]({'where':{'id':_0x52971[_0x0257('0x39')]['id']}})[_0x0257('0x15')](handleEntityNotFound(_0x2c331c,null))['then'](removeEntity(_0x2c331c,null))[_0x0257('0x37')](handleError(_0x2c331c,null));};exports[_0x0257('0x3a')]=function(_0x1d7e8b,_0x3de64e){return db[_0x0257('0x1c')][_0x0257('0x3a')]()[_0x0257('0x15')](respondWithResult(_0x3de64e,null))['catch'](handleError(_0x3de64e,null));};exports[_0x0257('0x3b')]=function(_0x1cf503,_0xe84a74){var _0x291e83={'raw':!![],'where':{}},_0x27bc1d={},_0x4d9e17;return db[_0x0257('0x1c')]['findOne']({'where':{'id':_0x1cf503[_0x0257('0x39')]['id']}})[_0x0257('0x15')](handleEntityNotFound(_0xe84a74,null))[_0x0257('0x15')](function(_0x3c3103){if(_0x3c3103){_0x4d9e17=_0x3c3103[_0x0257('0x33')]({'plain':!![]});_0x27bc1d[_0x0257('0x29')]=_[_0x0257('0x26')](db[_0x0257('0x3c')]['rawAttributes']);_0x27bc1d[_0x0257('0x22')]=_[_0x0257('0x26')](_0x1cf503[_0x0257('0x22')]);_0x27bc1d[_0x0257('0x27')]=_[_0x0257('0x28')](_0x27bc1d[_0x0257('0x29')],_0x27bc1d[_0x0257('0x22')]);_0x291e83[_0x0257('0x2b')]=_[_0x0257('0x28')](_0x27bc1d[_0x0257('0x29')],qs[_0x0257('0x2a')](_0x1cf503[_0x0257('0x22')][_0x0257('0x2a')]));_0x291e83['attributes']=_0x291e83[_0x0257('0x2b')][_0x0257('0x2c')]?_0x291e83[_0x0257('0x2b')]:_0x27bc1d[_0x0257('0x29')];if(!_0x1cf503[_0x0257('0x22')][_0x0257('0x3d')]('nolimit')){_0x291e83[_0x0257('0x11')]=qs[_0x0257('0x11')](_0x1cf503[_0x0257('0x22')][_0x0257('0x11')]);_0x291e83['offset']=qs[_0x0257('0x10')](_0x1cf503[_0x0257('0x22')]['offset']);}_0x291e83['order']=qs['sort'](_0x1cf503['query'][_0x0257('0x3e')]);_0x291e83[_0x0257('0x3f')]=qs['filters'](_['pick'](_0x1cf503[_0x0257('0x22')],_0x27bc1d[_0x0257('0x27')]));_0x291e83[_0x0257('0x3f')][_0x0257('0x40')]=_0x3c3103['id'];if(_0x1cf503['query'][_0x0257('0x41')]){_0x291e83['where']=_['merge'](_0x291e83[_0x0257('0x3f')],{'$or':_[_0x0257('0x1b')](_0x291e83[_0x0257('0x2b')],function(_0x3ca36a){var _0x511e3f={};_0x511e3f[_0x3ca36a]={'$like':'%'+_0x1cf503['query']['filter']+'%'};return _0x511e3f;})});}_0x291e83=_[_0x0257('0x42')]({},_0x291e83,_0x1cf503[_0x0257('0x43')]);return db[_0x0257('0x3c')][_0x0257('0x23')](_0x291e83);}})[_0x0257('0x15')](function(_0x4b9c07){if(_0x4b9c07){return db[_0x0257('0x44')]['findAndCountAll']({'where':{'id':_[_0x0257('0x1b')](_0x4b9c07,_0x0257('0x45')),'role':_0x0257('0x46')},'attributes':['id','name','whatsappPause',_0x0257('0x47'),_0x0257('0x48')]});}})[_0x0257('0x15')](function(_0x191fcb){if(_0x191fcb){return{'count':_0x191fcb['count'],'rows':_[_0x0257('0x1b')](_0x191fcb[_0x0257('0x24')],function(_0xc54689){return{'membername':_0xc54689[_0x0257('0x19')],'UserId':_0xc54689['id'],'queue_name':_0x4d9e17[_0x0257('0x19')],'WhatsappQueueId':_0x4d9e17['id'],'interface':util[_0x0257('0x49')](_0x0257('0x4a'),_0x0257('0x4b'),_0xc54689[_0x0257('0x19')]),'penalty':0x0,'paused':_0xc54689[_0x0257('0x4c')],'createdAt':_0xc54689[_0x0257('0x48')],'updatedAt':_0xc54689[_0x0257('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0257('0x15')](respondWithFilteredResult(_0xe84a74,_0x291e83))[_0x0257('0x37')](handleError(_0xe84a74,null));};exports[_0x0257('0x4d')]=function(_0x338659,_0x399837){var _0x29b677={};var _0x1c040a={};var _0x9cacaf;var _0x4b7822;return db[_0x0257('0x1c')][_0x0257('0x4e')]({'where':{'id':_0x338659[_0x0257('0x39')]['id']}})[_0x0257('0x15')](handleEntityNotFound(_0x399837,null))[_0x0257('0x15')](function(_0x40644c){if(_0x40644c){_0x9cacaf=_0x40644c;_0x1c040a[_0x0257('0x29')]=_[_0x0257('0x26')](db[_0x0257('0x4f')][_0x0257('0x1d')]);_0x1c040a['query']=_[_0x0257('0x26')](_0x338659[_0x0257('0x22')]);_0x1c040a[_0x0257('0x27')]=_[_0x0257('0x28')](_0x1c040a[_0x0257('0x29')],_0x1c040a[_0x0257('0x22')]);_0x29b677['attributes']=_[_0x0257('0x28')](_0x1c040a[_0x0257('0x29')],qs['fields'](_0x338659['query'][_0x0257('0x2a')]));_0x29b677[_0x0257('0x2b')]=_0x29b677[_0x0257('0x2b')][_0x0257('0x2c')]?_0x29b677[_0x0257('0x2b')]:_0x1c040a[_0x0257('0x29')];_0x29b677[_0x0257('0x50')]=qs[_0x0257('0x3e')](_0x338659[_0x0257('0x22')][_0x0257('0x3e')]);_0x29b677[_0x0257('0x3f')]=qs[_0x0257('0x27')](_[_0x0257('0x51')](_0x338659['query'],_0x1c040a[_0x0257('0x27')]));if(_0x338659['query'][_0x0257('0x41')]){_0x29b677['where']=_[_0x0257('0x42')](_0x29b677[_0x0257('0x3f')],{'$or':_[_0x0257('0x1b')](_0x29b677['attributes'],function(_0x58b52d){var _0x2ea44d={};_0x2ea44d[_0x58b52d]={'$like':'%'+_0x338659[_0x0257('0x22')][_0x0257('0x41')]+'%'};return _0x2ea44d;})});}_0x29b677=_[_0x0257('0x42')]({},_0x29b677,_0x338659['options']);return _0x9cacaf[_0x0257('0x4d')](_0x29b677);}})[_0x0257('0x15')](function(_0x5146f9){if(_0x5146f9){_0x4b7822=_0x5146f9[_0x0257('0x2c')];if(!_0x338659[_0x0257('0x22')][_0x0257('0x3d')](_0x0257('0x52'))){_0x29b677[_0x0257('0x11')]=qs[_0x0257('0x11')](_0x338659[_0x0257('0x22')]['limit']);_0x29b677[_0x0257('0x10')]=qs[_0x0257('0x10')](_0x338659[_0x0257('0x22')][_0x0257('0x10')]);}return _0x9cacaf[_0x0257('0x4d')](_0x29b677);}})[_0x0257('0x15')](function(_0x11cedc){if(_0x11cedc){return _0x11cedc?{'count':_0x4b7822,'rows':_0x11cedc}:null;}})[_0x0257('0x15')](respondWithResult(_0x399837,null))[_0x0257('0x37')](handleError(_0x399837,null));};exports[_0x0257('0x53')]=function(_0xd59238,_0x1b2755){var _0x562821=_0xd59238['body'][_0x0257('0x54')];return db[_0x0257('0x4f')][_0x0257('0x23')]({'where':{'id':_0x562821},'attributes':['id'],'include':[{'model':db[_0x0257('0x44')],'as':_0x0257('0x55'),'attributes':['id',_0x0257('0x19'),_0x0257('0x56'),_0x0257('0x57'),_0x0257('0x58')],'raw':!![]}]})[_0x0257('0x15')](function(_0x134c6c){if(_0x134c6c){var _0x1986fc=_[_0x0257('0x59')](_0x134c6c,function(_0x212f9d){var _0x238270=_0x212f9d[_0x0257('0x33')]({'plain':!![]});return _0x238270['Agents'];});return db[_0x0257('0x1c')][_0x0257('0x2e')]({'where':{'id':_0xd59238[_0x0257('0x39')]['id']}})['then'](function(_0x66ed8c){return db[_0x0257('0x5a')][_0x0257('0x5b')](function(_0x4e0aab){return _0x66ed8c['addTeams'](_0x562821,{'transaction':_0x4e0aab})['then'](function(){return BPromise[_0x0257('0x5c')](_0x1986fc,function(_0x32b19e){return db['UserWhatsappQueue'][_0x0257('0x5d')]({'where':{'UserId':_0x32b19e['id'],'WhatsappQueueId':_0xd59238[_0x0257('0x39')]['id']},'transaction':_0x4e0aab});});})[_0x0257('0x15')](function(){_0x1986fc[_0x0257('0x5e')](function(_0x459c4f){socket[_0x0257('0x5f')](_0x0257('0x60'),{'UserId':_0x459c4f['id'],'WhatsappQueueId':_0x66ed8c['id']});});});});});}})['then'](respondWithStatusCode(_0x1b2755,null))[_0x0257('0x37')](handleError(_0x1b2755,null));};exports[_0x0257('0x61')]=function(_0x23275c,_0x55ddc0){return db[_0x0257('0x4f')][_0x0257('0x23')]({'where':{'id':_0x23275c[_0x0257('0x22')][_0x0257('0x54')]},'attributes':['id'],'include':[{'model':db[_0x0257('0x44')],'as':_0x0257('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x55ddc0,null))[_0x0257('0x15')](function(_0x17eb9c){var _0xfc18=_[_0x0257('0x1b')](_0x17eb9c,'id');var _0x158f1a=[];var _0x5b67e7=[];var _0x1a4f6b=squel[_0x0257('0x62')]();_0x1a4f6b['field']('tq.TeamId')[_0x0257('0x63')](_0x0257('0x64'),'tq')[_0x0257('0x65')]('user_has_teams','ut',_0x0257('0x66'))[_0x0257('0x3f')]('WhatsappQueueId\x20=\x20?',_0x23275c[_0x0257('0x39')]['id']);for(var _0x4565e4=0x0;_0x4565e4<_0x17eb9c['length'];_0x4565e4+=0x1){let _0x2594aa=_0x17eb9c[_0x4565e4];for(var _0x100776=0x0;_0x100776<_0x2594aa[_0x0257('0x55')][_0x0257('0x2c')];_0x100776+=0x1){let _0x31d376=_0x2594aa[_0x0257('0x55')][_0x100776];var _0x47b82e=_0x1a4f6b[_0x0257('0x67')]();_0x47b82e[_0x0257('0x3f')](_0x0257('0x68'),_0x31d376['id']);_0x5b67e7[_0x0257('0x69')](db[_0x0257('0x5a')][_0x0257('0x22')](_0x47b82e['toString'](),{'type':db[_0x0257('0x5a')][_0x0257('0x6a')][_0x0257('0x6b')]})[_0x0257('0x15')](function(_0x51e86f){if(_0x51e86f['length']===0x1){return _0x31d376['id'];}else{var _0x509e1e=_[_0x0257('0x6c')](_[_0x0257('0x1b')](_0x51e86f,'TeamId'),function(_0x3ccfae){return _['includes'](_0xfc18,_0x3ccfae);});if(_0x509e1e){return _0x31d376['id'];}}}));}}return BPromise[_0x0257('0x6d')](_0x5b67e7)[_0x0257('0x15')](function(_0x35e69e){_0x158f1a=_(_0x158f1a)[_0x0257('0x6e')](_0x35e69e)[_0x0257('0x6f')]()[_0x0257('0x70')]();return db[_0x0257('0x1c')][_0x0257('0x2e')]({'where':{'id':_0x23275c[_0x0257('0x39')]['id']}})[_0x0257('0x15')](function(_0x182b71){return db[_0x0257('0x5a')][_0x0257('0x5b')](function(_0x44cb45){return _0x182b71[_0x0257('0x61')](_0x23275c[_0x0257('0x22')][_0x0257('0x54')],{'transaction':_0x44cb45})[_0x0257('0x15')](function(){if(!_['isEmpty'](_0x158f1a)){return _0x182b71[_0x0257('0x71')](_0x158f1a,{'transaction':_0x44cb45});}})['then'](function(){_0x158f1a[_0x0257('0x5e')](function(_0x2adbca){socket[_0x0257('0x5f')]('userWhatsappQueue:remove',{'UserId':_0x2adbca,'WhatsappQueueId':_0x182b71['id']});});});});});});})[_0x0257('0x15')](respondWithStatusCode(_0x55ddc0,null))[_0x0257('0x37')](handleError(_0x55ddc0,null));};exports['addAgents']=function(_0x3746e2,_0x22949b){return db[_0x0257('0x1c')][_0x0257('0x2e')]({'where':{'id':_0x3746e2['params']['id']}})['then'](handleEntityNotFound(_0x22949b,null))['then'](function(_0x30242b){if(_0x30242b){return _0x30242b['addAgents'](_0x3746e2['body']['ids'],_['omit'](_0x3746e2['body'],[_0x0257('0x54'),'id'])||{})[_0x0257('0x72')](function(_0xf60b9f){for(var _0x102921=0x0;_0x102921<_0x3746e2[_0x0257('0x30')][_0x0257('0x54')][_0x0257('0x2c')];_0x102921+=0x1){socket[_0x0257('0x5f')](_0x0257('0x60'),{'UserId':Number(_0x3746e2[_0x0257('0x30')][_0x0257('0x54')][_0x102921]),'WhatsappQueueId':Number(_0x3746e2[_0x0257('0x39')]['id'])});}return _0xf60b9f;});}})[_0x0257('0x15')](respondWithResult(_0x22949b,null))[_0x0257('0x37')](handleError(_0x22949b,null));};exports[_0x0257('0x71')]=function(_0x2b8625,_0x40d2c0){return db[_0x0257('0x1c')]['find']({'where':{'id':_0x2b8625['params']['id']}})[_0x0257('0x15')](handleEntityNotFound(_0x40d2c0,null))['then'](function(_0x1f2a49){if(_0x1f2a49){return _0x1f2a49[_0x0257('0x71')](_0x2b8625[_0x0257('0x22')][_0x0257('0x54')])['then'](function(){if(_[_0x0257('0x73')](_0x2b8625[_0x0257('0x22')][_0x0257('0x54')])){for(var _0x45bbdf=0x0;_0x45bbdf<_0x2b8625['query']['ids']['length'];_0x45bbdf+=0x1){socket[_0x0257('0x5f')](_0x0257('0x74'),{'UserId':Number(_0x2b8625[_0x0257('0x22')][_0x0257('0x54')][_0x45bbdf]),'WhatsappQueueId':Number(_0x2b8625['params']['id'])});}}else{socket[_0x0257('0x5f')](_0x0257('0x74'),{'UserId':Number(_0x2b8625[_0x0257('0x22')][_0x0257('0x54')]),'WhatsappQueueId':Number(_0x2b8625[_0x0257('0x39')]['id'])});}});}})['then'](respondWithStatusCode(_0x40d2c0,null))[_0x0257('0x37')](handleError(_0x40d2c0,null));};exports[_0x0257('0x75')]=function(_0x55d342,_0x33d606){var _0x4add6c={};var _0x5ccca2={};var _0x14c232;var _0x2be952;return db[_0x0257('0x1c')][_0x0257('0x4e')]({'where':{'id':_0x55d342[_0x0257('0x39')]['id']}})[_0x0257('0x15')](handleEntityNotFound(_0x33d606,null))['then'](function(_0x49a662){if(_0x49a662){_0x14c232=_0x49a662;_0x5ccca2[_0x0257('0x29')]=_[_0x0257('0x26')](db[_0x0257('0x44')][_0x0257('0x1d')]);_0x5ccca2['query']=_[_0x0257('0x26')](_0x55d342[_0x0257('0x22')]);_0x5ccca2[_0x0257('0x27')]=_[_0x0257('0x28')](_0x5ccca2[_0x0257('0x29')],_0x5ccca2['query']);_0x4add6c[_0x0257('0x2b')]=_[_0x0257('0x28')](_0x5ccca2[_0x0257('0x29')],qs[_0x0257('0x2a')](_0x55d342['query'][_0x0257('0x2a')]));_0x4add6c[_0x0257('0x2b')]=_0x4add6c[_0x0257('0x2b')]['length']?_0x4add6c[_0x0257('0x2b')]:_0x5ccca2[_0x0257('0x29')];_0x4add6c[_0x0257('0x50')]=qs[_0x0257('0x3e')](_0x55d342['query'][_0x0257('0x3e')]);_0x4add6c[_0x0257('0x3f')]=qs[_0x0257('0x27')](_['pick'](_0x55d342[_0x0257('0x22')],_0x5ccca2[_0x0257('0x27')]));if(_0x55d342['query'][_0x0257('0x41')]){_0x4add6c[_0x0257('0x3f')]=_[_0x0257('0x42')](_0x4add6c['where'],{'$or':_[_0x0257('0x1b')](_0x4add6c[_0x0257('0x2b')],function(_0x1fdb9b){var _0x53d294={};_0x53d294[_0x1fdb9b]={'$like':'%'+_0x55d342['query'][_0x0257('0x41')]+'%'};return _0x53d294;})});}_0x4add6c=_[_0x0257('0x42')]({},_0x4add6c,_0x55d342[_0x0257('0x43')]);return _0x14c232[_0x0257('0x75')](_0x4add6c);}})['then'](function(_0x4379a2){if(_0x4379a2){_0x2be952=_0x4379a2[_0x0257('0x2c')];if(!_0x55d342['query'][_0x0257('0x3d')](_0x0257('0x52'))){_0x4add6c[_0x0257('0x11')]=qs[_0x0257('0x11')](_0x55d342['query'][_0x0257('0x11')]);_0x4add6c[_0x0257('0x10')]=qs['offset'](_0x55d342[_0x0257('0x22')][_0x0257('0x10')]);}return _0x14c232[_0x0257('0x75')](_0x4add6c);}})['then'](function(_0x6d92c0){if(_0x6d92c0){return _0x6d92c0?{'count':_0x2be952,'rows':_0x6d92c0}:null;}})['then'](respondWithResult(_0x33d606,null))[_0x0257('0x37')](handleError(_0x33d606,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 03d997c..d263a6a 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 _0x7544=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x3e8ba7,_0x4e38cf){var _0x164910=function(_0x2fd6d8){while(--_0x2fd6d8){_0x3e8ba7['push'](_0x3e8ba7['shift']());}};_0x164910(++_0x4e38cf);}(_0x7544,0xa7));var _0x4754=function(_0x519183,_0x2e4494){_0x519183=_0x519183-0x0;var _0x59cad6=_0x7544[_0x519183];return _0x59cad6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x4754('0x0'))['db'][_0x4754('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4754('0x2')](0x0);var events={'afterCreate':_0x4754('0x3'),'afterUpdate':_0x4754('0x4'),'afterDestroy':_0x4754('0x5')};function emitEvent(_0x505804){return function(_0x5ddfed,_0x21e252,_0x5da5db){WhatsappQueueEvents[_0x4754('0x6')](_0x505804+':'+_0x5ddfed['id'],_0x5ddfed);WhatsappQueueEvents['emit'](_0x505804,_0x5ddfed);_0x5da5db(null);};}for(var e in events){if(events[_0x4754('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x4754('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa950=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46d000,_0xea4ec7){var _0x5d671d=function(_0x4d644d){while(--_0x4d644d){_0x46d000['push'](_0x46d000['shift']());}};_0x5d671d(++_0xea4ec7);}(_0xa950,0x15e));var _0x0a95=function(_0x531abf,_0x357f11){_0x531abf=_0x531abf-0x0;var _0x4db744=_0xa950[_0x531abf];return _0x4db744;};'use strict';var EventEmitter=require(_0x0a95('0x0'));var WhatsappQueue=require(_0x0a95('0x1'))['db'][_0x0a95('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0a95('0x3')](0x0);var events={'afterCreate':_0x0a95('0x4'),'afterUpdate':_0x0a95('0x5'),'afterDestroy':_0x0a95('0x6')};function emitEvent(_0x41a341){return function(_0x46ad35,_0x5ecd16,_0x5e191f){WhatsappQueueEvents['emit'](_0x41a341+':'+_0x46ad35['id'],_0x46ad35);WhatsappQueueEvents[_0x0a95('0x7')](_0x41a341,_0x46ad35);_0x5e191f(null);};}for(var e in events){if(events[_0x0a95('0x8')](e)){var event=events[e];WhatsappQueue[_0x0a95('0x9')](e,emitEvent(event));}}module[_0x0a95('0xa')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fceca6a..22c10f6 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 _0x9e6e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x13b2ee,_0x1b348b){var _0x1b86b5=function(_0x5e79eb){while(--_0x5e79eb){_0x13b2ee['push'](_0x13b2ee['shift']());}};_0x1b86b5(++_0x1b348b);}(_0x9e6e,0xcf));var _0xe9e6=function(_0x6fa1c9,_0x1834f2){_0x6fa1c9=_0x6fa1c9-0x0;var _0x3ebf6f=_0x9e6e[_0x6fa1c9];return _0x3ebf6f;};'use strict';var _=require(_0xe9e6('0x0'));var util=require(_0xe9e6('0x1'));var logger=require(_0xe9e6('0x2'))(_0xe9e6('0x3'));var moment=require(_0xe9e6('0x4'));var BPromise=require(_0xe9e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9e6('0x6'));var rimraf=require(_0xe9e6('0x7'));var config=require(_0xe9e6('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xe9e6('0x9')]=function(_0x4eb025,_0x6d682f){return _0x4eb025[_0xe9e6('0xa')](_0xe9e6('0xb'),attributes,{'tableName':_0xe9e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65ae=['./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x65ae,0x163));var _0xe65a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65ae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe65a('0x0'));var util=require(_0xe65a('0x1'));var logger=require(_0xe65a('0x2'))(_0xe65a('0x3'));var moment=require(_0xe65a('0x4'));var BPromise=require('bluebird');var rp=require(_0xe65a('0x5'));var fs=require('fs');var path=require(_0xe65a('0x6'));var rimraf=require('rimraf');var config=require(_0xe65a('0x7'));var attributes=require(_0xe65a('0x8'));module['exports']=function(_0x19948f,_0x40738c){return _0x19948f['define'](_0xe65a('0x9'),attributes,{'tableName':_0xe65a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c729abb..2454072 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 _0xb11c=['../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','where','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x1a26bf,_0xeb141e){var _0x285507=function(_0x3eed2a){while(--_0x3eed2a){_0x1a26bf['push'](_0x1a26bf['shift']());}};_0x285507(++_0xeb141e);}(_0xb11c,0xbd));var _0xcb11=function(_0x4a1fe7,_0x280da6){_0x4a1fe7=_0x4a1fe7-0x0;var _0xe63034=_0xb11c[_0x4a1fe7];return _0xe63034;};'use strict';var _=require(_0xcb11('0x0'));var util=require(_0xcb11('0x1'));var moment=require(_0xcb11('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb11('0x3'));var fs=require('fs');var Redis=require(_0xcb11('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb11('0x5'));var logger=require(_0xcb11('0x6'))('rpc');var config=require(_0xcb11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcb11('0x8')][_0xcb11('0x9')]({'port':0x232a});config[_0xcb11('0xa')]=_[_0xcb11('0xb')](config[_0xcb11('0xa')],{'host':_0xcb11('0xc'),'port':0x18eb});var socket=require(_0xcb11('0xd'))(new Redis(config[_0xcb11('0xa')]));require(_0xcb11('0xe'))['register'](socket);function respondWithRpcPromise(_0x1dca1d,_0x55f495,_0x5c4ffc){return new BPromise(function(_0x48cc55,_0x5006c8){return client['request'](_0x1dca1d,_0x5c4ffc)[_0xcb11('0xf')](function(_0x206a2b){logger[_0xcb11('0x10')](_0xcb11('0x11'),_0x55f495,_0xcb11('0x12'));logger[_0xcb11('0x13')](_0xcb11('0x14'),_0x55f495,'request\x20sent',JSON[_0xcb11('0x15')](_0x206a2b));if(_0x206a2b[_0xcb11('0x16')]){if(_0x206a2b['error'][_0xcb11('0x17')]===0x1f4){logger[_0xcb11('0x16')](_0xcb11('0x11'),_0x55f495,_0x206a2b[_0xcb11('0x16')][_0xcb11('0x18')]);return _0x5006c8(_0x206a2b[_0xcb11('0x16')]['message']);}logger[_0xcb11('0x16')](_0xcb11('0x11'),_0x55f495,_0x206a2b[_0xcb11('0x16')]['message']);return _0x48cc55(_0x206a2b['error']['message']);}else{logger[_0xcb11('0x10')](_0xcb11('0x11'),_0x55f495,_0xcb11('0x12'));_0x48cc55(_0x206a2b[_0xcb11('0x19')][_0xcb11('0x18')]);}})['catch'](function(_0x5e9cea){logger[_0xcb11('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x55f495,_0x5e9cea);_0x5006c8(_0x5e9cea);});});}exports[_0xcb11('0x1a')]=function(_0x44dc84){var _0x4b76ec=this;return new Promise(function(_0x1f3a5e,_0x5f01b5){return db[_0xcb11('0x1b')]['findAll']({'raw':_0x44dc84[_0xcb11('0x1c')]?_0x44dc84[_0xcb11('0x1c')][_0xcb11('0x1d')]===undefined?!![]:![]:!![],'where':_0x44dc84[_0xcb11('0x1c')]?_0x44dc84['options']['where']||null:null,'attributes':_0x44dc84[_0xcb11('0x1c')]?_0x44dc84[_0xcb11('0x1c')][_0xcb11('0x1e')]||null:null,'limit':_0x44dc84[_0xcb11('0x1c')]?_0x44dc84[_0xcb11('0x1c')][_0xcb11('0x1f')]||null:null,'include':_0x44dc84[_0xcb11('0x1c')]?_0x44dc84[_0xcb11('0x1c')][_0xcb11('0x20')]?_['map'](_0x44dc84[_0xcb11('0x1c')][_0xcb11('0x20')],function(_0x293e97){return{'model':db[_0x293e97[_0xcb11('0x21')]],'as':_0x293e97['as'],'attributes':_0x293e97['attributes'],'include':_0x293e97[_0xcb11('0x20')]?_[_0xcb11('0x22')](_0x293e97[_0xcb11('0x20')],function(_0x5f39cd){return{'model':db[_0x5f39cd[_0xcb11('0x21')]],'as':_0x5f39cd['as'],'attributes':_0x5f39cd[_0xcb11('0x1e')],'include':_0x5f39cd['include']?_[_0xcb11('0x22')](_0x5f39cd['include'],function(_0x4c0a4d){return{'model':db[_0x4c0a4d['model']],'as':_0x4c0a4d['as'],'attributes':_0x4c0a4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb11('0xf')](function(_0x41bbcb){logger[_0xcb11('0x10')]('GetWhatsappQueue',_0x44dc84);logger[_0xcb11('0x13')](_0xcb11('0x1a'),_0x44dc84,JSON[_0xcb11('0x15')](_0x41bbcb));_0x1f3a5e(_0x41bbcb);})[_0xcb11('0x23')](function(_0x475c23){logger[_0xcb11('0x16')](_0xcb11('0x1a'),_0x475c23['message'],_0x44dc84);_0x5f01b5(_0x4b76ec[_0xcb11('0x16')](0x1f4,_0x475c23['message']));});});};exports[_0xcb11('0x24')]=function(_0x22c22a){var _0x7088be=this;return new Promise(function(_0x4a26c8,_0x3b9eea){return db['WhatsappQueue'][_0xcb11('0x25')]({'raw':_0x22c22a[_0xcb11('0x1c')]?_0x22c22a[_0xcb11('0x1c')][_0xcb11('0x1d')]===undefined?!![]:![]:!![],'where':_0x22c22a[_0xcb11('0x1c')]?_0x22c22a['options'][_0xcb11('0x26')]||null:null,'attributes':_0x22c22a[_0xcb11('0x1c')]?_0x22c22a['options'][_0xcb11('0x1e')]||null:null,'include':_0x22c22a[_0xcb11('0x1c')]?_0x22c22a['options']['include']?_[_0xcb11('0x22')](_0x22c22a[_0xcb11('0x1c')][_0xcb11('0x20')],function(_0x46b59f){return{'model':db[_0x46b59f[_0xcb11('0x21')]],'as':_0x46b59f['as'],'attributes':_0x46b59f[_0xcb11('0x1e')],'include':_0x46b59f[_0xcb11('0x20')]?_[_0xcb11('0x22')](_0x46b59f['include'],function(_0x1eb352){return{'model':db[_0x1eb352[_0xcb11('0x21')]],'as':_0x1eb352['as'],'attributes':_0x1eb352[_0xcb11('0x1e')],'include':_0x1eb352['include']?_[_0xcb11('0x22')](_0x1eb352[_0xcb11('0x20')],function(_0x233b08){return{'model':db[_0x233b08[_0xcb11('0x21')]],'as':_0x233b08['as'],'attributes':_0x233b08[_0xcb11('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcb11('0xf')](function(_0x351813){logger[_0xcb11('0x10')](_0xcb11('0x24'),_0x22c22a);logger[_0xcb11('0x13')](_0xcb11('0x24'),_0x22c22a,JSON[_0xcb11('0x15')](_0x351813));_0x4a26c8(_0x351813);})[_0xcb11('0x23')](function(_0x278286){logger[_0xcb11('0x16')](_0xcb11('0x24'),_0x278286[_0xcb11('0x18')],_0x22c22a);_0x3b9eea(_0x7088be[_0xcb11('0x16')](0x1f4,_0x278286[_0xcb11('0x18')]));});});}; \ No newline at end of file +var _0x37f6=['jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','model','attributes','include','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x4ef417,_0x405e40){var _0x3d20bc=function(_0x75f6b9){while(--_0x75f6b9){_0x4ef417['push'](_0x4ef417['shift']());}};_0x3d20bc(++_0x405e40);}(_0x37f6,0xe9));var _0x637f=function(_0x11262c,_0x20d80b){_0x11262c=_0x11262c-0x0;var _0x23977b=_0x37f6[_0x11262c];return _0x23977b;};'use strict';var _=require(_0x637f('0x0'));var util=require(_0x637f('0x1'));var moment=require(_0x637f('0x2'));var BPromise=require('bluebird');var rs=require(_0x637f('0x3'));var fs=require('fs');var Redis=require(_0x637f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x637f('0x5'));var logger=require('../../config/logger')(_0x637f('0x6'));var config=require('../../config/environment');var jayson=require(_0x637f('0x7'));var client=jayson[_0x637f('0x8')][_0x637f('0x9')]({'port':0x232a});config[_0x637f('0xa')]=_[_0x637f('0xb')](config[_0x637f('0xa')],{'host':_0x637f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x637f('0xa')]));require('./whatsappQueue.socket')[_0x637f('0xd')](socket);function respondWithRpcPromise(_0x447e99,_0x2aa0d7,_0x30bb6d){return new BPromise(function(_0x3607b3,_0x1c5328){return client[_0x637f('0xe')](_0x447e99,_0x30bb6d)[_0x637f('0xf')](function(_0x1ea1f6){logger[_0x637f('0x10')](_0x637f('0x11'),_0x2aa0d7,_0x637f('0x12'));logger[_0x637f('0x13')](_0x637f('0x14'),_0x2aa0d7,_0x637f('0x12'),JSON[_0x637f('0x15')](_0x1ea1f6));if(_0x1ea1f6['error']){if(_0x1ea1f6[_0x637f('0x16')][_0x637f('0x17')]===0x1f4){logger['error'](_0x637f('0x11'),_0x2aa0d7,_0x1ea1f6['error'][_0x637f('0x18')]);return _0x1c5328(_0x1ea1f6[_0x637f('0x16')][_0x637f('0x18')]);}logger[_0x637f('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2aa0d7,_0x1ea1f6[_0x637f('0x16')][_0x637f('0x18')]);return _0x3607b3(_0x1ea1f6[_0x637f('0x16')][_0x637f('0x18')]);}else{logger['info'](_0x637f('0x11'),_0x2aa0d7,_0x637f('0x12'));_0x3607b3(_0x1ea1f6[_0x637f('0x19')]['message']);}})['catch'](function(_0x5f2975){logger['error'](_0x637f('0x11'),_0x2aa0d7,_0x5f2975);_0x1c5328(_0x5f2975);});});}exports[_0x637f('0x1a')]=function(_0x148f5f){var _0x15dafb=this;return new Promise(function(_0x2937e5,_0x5f14f4){return db[_0x637f('0x1b')][_0x637f('0x1c')]({'raw':_0x148f5f[_0x637f('0x1d')]?_0x148f5f['options'][_0x637f('0x1e')]===undefined?!![]:![]:!![],'where':_0x148f5f[_0x637f('0x1d')]?_0x148f5f[_0x637f('0x1d')][_0x637f('0x1f')]||null:null,'attributes':_0x148f5f[_0x637f('0x1d')]?_0x148f5f['options']['attributes']||null:null,'limit':_0x148f5f[_0x637f('0x1d')]?_0x148f5f[_0x637f('0x1d')][_0x637f('0x20')]||null:null,'include':_0x148f5f[_0x637f('0x1d')]?_0x148f5f[_0x637f('0x1d')]['include']?_[_0x637f('0x21')](_0x148f5f[_0x637f('0x1d')]['include'],function(_0x189e99){return{'model':db[_0x189e99[_0x637f('0x22')]],'as':_0x189e99['as'],'attributes':_0x189e99[_0x637f('0x23')],'include':_0x189e99['include']?_[_0x637f('0x21')](_0x189e99[_0x637f('0x24')],function(_0x33cc70){return{'model':db[_0x33cc70[_0x637f('0x22')]],'as':_0x33cc70['as'],'attributes':_0x33cc70[_0x637f('0x23')],'include':_0x33cc70['include']?_[_0x637f('0x21')](_0x33cc70[_0x637f('0x24')],function(_0x371dd7){return{'model':db[_0x371dd7[_0x637f('0x22')]],'as':_0x371dd7['as'],'attributes':_0x371dd7[_0x637f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1982a5){logger[_0x637f('0x10')]('GetWhatsappQueue',_0x148f5f);logger[_0x637f('0x13')](_0x637f('0x1a'),_0x148f5f,JSON[_0x637f('0x15')](_0x1982a5));_0x2937e5(_0x1982a5);})[_0x637f('0x25')](function(_0x2e7f50){logger[_0x637f('0x16')](_0x637f('0x1a'),_0x2e7f50[_0x637f('0x18')],_0x148f5f);_0x5f14f4(_0x15dafb['error'](0x1f4,_0x2e7f50[_0x637f('0x18')]));});});};exports[_0x637f('0x26')]=function(_0x1c6bf2){var _0x24043c=this;return new Promise(function(_0x326d4e,_0x4d8f07){return db[_0x637f('0x1b')][_0x637f('0x27')]({'raw':_0x1c6bf2['options']?_0x1c6bf2[_0x637f('0x1d')][_0x637f('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c6bf2[_0x637f('0x1d')]?_0x1c6bf2[_0x637f('0x1d')]['where']||null:null,'attributes':_0x1c6bf2['options']?_0x1c6bf2[_0x637f('0x1d')][_0x637f('0x23')]||null:null,'include':_0x1c6bf2[_0x637f('0x1d')]?_0x1c6bf2[_0x637f('0x1d')][_0x637f('0x24')]?_['map'](_0x1c6bf2['options'][_0x637f('0x24')],function(_0x5d4818){return{'model':db[_0x5d4818[_0x637f('0x22')]],'as':_0x5d4818['as'],'attributes':_0x5d4818[_0x637f('0x23')],'include':_0x5d4818[_0x637f('0x24')]?_[_0x637f('0x21')](_0x5d4818[_0x637f('0x24')],function(_0x3d67b7){return{'model':db[_0x3d67b7['model']],'as':_0x3d67b7['as'],'attributes':_0x3d67b7[_0x637f('0x23')],'include':_0x3d67b7[_0x637f('0x24')]?_['map'](_0x3d67b7[_0x637f('0x24')],function(_0x40781e){return{'model':db[_0x40781e['model']],'as':_0x40781e['as'],'attributes':_0x40781e[_0x637f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x637f('0xf')](function(_0x196f0a){logger['info'](_0x637f('0x26'),_0x1c6bf2);logger['debug'](_0x637f('0x26'),_0x1c6bf2,JSON[_0x637f('0x15')](_0x196f0a));_0x326d4e(_0x196f0a);})['catch'](function(_0x22dbbe){logger[_0x637f('0x16')]('ShowWhatsappQueue',_0x22dbbe[_0x637f('0x18')],_0x1c6bf2);_0x4d8f07(_0x24043c['error'](0x1f4,_0x22dbbe['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 939474d..9529476 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 _0x2505=['save','remove','update','emit','removeListener','length','./whatsappQueue.events'];(function(_0x56b1aa,_0x526389){var _0x9489ab=function(_0x896e5c){while(--_0x896e5c){_0x56b1aa['push'](_0x56b1aa['shift']());}};_0x9489ab(++_0x526389);}(_0x2505,0x179));var _0x5250=function(_0x174446,_0xbf45c){_0x174446=_0x174446-0x0;var _0x160b4a=_0x2505[_0x174446];return _0x160b4a;};'use strict';var WhatsappQueueEvents=require(_0x5250('0x0'));var events=[_0x5250('0x1'),_0x5250('0x2'),_0x5250('0x3')];function createListener(_0x5b5b27,_0x4de0ab){return function(_0x52841f){_0x4de0ab[_0x5250('0x4')](_0x5b5b27,_0x52841f);};}function removeListener(_0x2cce94,_0x2d4f0c){return function(){WhatsappQueueEvents[_0x5250('0x5')](_0x2cce94,_0x2d4f0c);};}exports['register']=function(_0x3c0853){for(var _0x4cc68a=0x0,_0x2efe19=events[_0x5250('0x6')];_0x4cc68a<_0x2efe19;_0x4cc68a++){var _0x4a586f=events[_0x4cc68a];var _0xcc2160=createListener('whatsappQueue:'+_0x4a586f,_0x3c0853);WhatsappQueueEvents['on'](_0x4a586f,_0xcc2160);}}; \ No newline at end of file +var _0x92e1=['remove','update','emit','removeListener','register','./whatsappQueue.events'];(function(_0xbf519c,_0x3a9494){var _0x181c16=function(_0x5348d9){while(--_0x5348d9){_0xbf519c['push'](_0xbf519c['shift']());}};_0x181c16(++_0x3a9494);}(_0x92e1,0x83));var _0x192e=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x92e1[_0xd93b26];return _0x25f668;};'use strict';var WhatsappQueueEvents=require(_0x192e('0x0'));var events=['save',_0x192e('0x1'),_0x192e('0x2')];function createListener(_0x15b6fa,_0xb54e){return function(_0x1e2362){_0xb54e[_0x192e('0x3')](_0x15b6fa,_0x1e2362);};}function removeListener(_0x213661,_0x14fd2e){return function(){WhatsappQueueEvents[_0x192e('0x4')](_0x213661,_0x14fd2e);};}exports[_0x192e('0x5')]=function(_0xd7ef3b){for(var _0x24bf75=0x0,_0x46eacc=events['length'];_0x24bf75<_0x46eacc;_0x24bf75++){var _0x3a83f7=events[_0x24bf75];var _0xca3904=createListener('whatsappQueue:'+_0x3a83f7,_0xd7ef3b);WhatsappQueueEvents['on'](_0x3a83f7,_0xca3904);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0f9fc12..4780d25 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 _0x879a=['get','index','isAuthenticated','describe','/:id','post','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x4271f1,_0xdbdc80){var _0x1bc9c9=function(_0x463d31){while(--_0x463d31){_0x4271f1['push'](_0x4271f1['shift']());}};_0x1bc9c9(++_0xdbdc80);}(_0x879a,0x183));var _0xa879=function(_0x4368f3,_0x2a0241){_0x4368f3=_0x4368f3-0x0;var _0x45a571=_0x879a[_0x4368f3];return _0x45a571;};'use strict';var multer=require(_0xa879('0x0'));var util=require('util');var path=require(_0xa879('0x1'));var timeout=require(_0xa879('0x2'));var express=require(_0xa879('0x3'));var router=express[_0xa879('0x4')]();var fs_extra=require(_0xa879('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa879('0x6'));var config=require(_0xa879('0x7'));var controller=require(_0xa879('0x8'));router[_0xa879('0x9')]('/',auth['isAuthenticated'](),controller[_0xa879('0xa')]);router['get']('/describe',auth[_0xa879('0xb')](),controller[_0xa879('0xc')]);router[_0xa879('0x9')](_0xa879('0xd'),auth[_0xa879('0xb')](),controller['show']);router[_0xa879('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa879('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa879('0xf')](_0xa879('0xd'),auth[_0xa879('0xb')](),controller[_0xa879('0x10')]);module[_0xa879('0x11')]=router; \ No newline at end of file +var _0x28e9=['/:id','show','post','create','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x1b1a84,_0x1cf20a){var _0x15e3c9=function(_0xcee68d){while(--_0xcee68d){_0x1b1a84['push'](_0x1b1a84['shift']());}};_0x15e3c9(++_0x1cf20a);}(_0x28e9,0x137));var _0x928e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x28e9[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x928e('0x0'));var util=require(_0x928e('0x1'));var path=require(_0x928e('0x2'));var timeout=require(_0x928e('0x3'));var express=require(_0x928e('0x4'));var router=express[_0x928e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x928e('0x6'));var interaction=require(_0x928e('0x7'));var config=require('../../config/environment');var controller=require(_0x928e('0x8'));router[_0x928e('0x9')]('/',auth[_0x928e('0xa')](),controller['index']);router['get'](_0x928e('0xb'),auth[_0x928e('0xa')](),controller['describe']);router['get'](_0x928e('0xc'),auth[_0x928e('0xa')](),controller[_0x928e('0xd')]);router[_0x928e('0xe')]('/',auth[_0x928e('0xa')](),controller[_0x928e('0xf')]);router['put'](_0x928e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x928e('0x10')](_0x928e('0xc'),auth[_0x928e('0xa')](),controller['destroy']);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 e92a16b..765d4ae 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x41c697,_0x1f851d){var _0xe9e995=function(_0x139874){while(--_0x139874){_0x41c697['push'](_0x41c697['shift']());}};_0xe9e995(++_0x1f851d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5853ad,_0x517ee7){var _0x5469ed=function(_0x23f9fe){while(--_0x23f9fe){_0x5853ad['push'](_0x5853ad['shift']());}};_0x5469ed(++_0x517ee7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index fc5abd1..b11464d 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 _0xdd4f=['intersection','includeAll','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys'];(function(_0x54a6c1,_0x267e43){var _0x5205de=function(_0xf9899d){while(--_0xf9899d){_0x54a6c1['push'](_0x54a6c1['shift']());}};_0x5205de(++_0x267e43);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2eaaa4,_0x3e8bab){_0x2eaaa4=_0x2eaaa4-0x0;var _0x420fab=_0xdd4f[_0x2eaaa4];return _0x420fab;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];function respondWithStatusCode(_0x3f07f1,_0x4565e6){_0x4565e6=_0x4565e6||0xcc;return function(_0x1bf37b){if(_0x1bf37b){return _0x3f07f1['sendStatus'](_0x4565e6);}return _0x3f07f1[_0xfdd4('0x17')](_0x4565e6)[_0xfdd4('0x18')]();};}function respondWithResult(_0x227099,_0x57b21f){_0x57b21f=_0x57b21f||0xc8;return function(_0x1b7da1){if(_0x1b7da1){return _0x227099['status'](_0x57b21f)[_0xfdd4('0x19')](_0x1b7da1);}};}function respondWithFilteredResult(_0x42c3a8,_0x2f34ec){return function(_0x431255){if(_0x431255){var _0x37b05f=typeof _0x2f34ec['offset']==='undefined'&&typeof _0x2f34ec['limit']===_0xfdd4('0x1a');var _0x216c7e=_0x431255[_0xfdd4('0x1b')];var _0x2ccc88=_0x37b05f?0x0:_0x2f34ec[_0xfdd4('0x1c')];var _0x33d752=_0x37b05f?_0x431255[_0xfdd4('0x1b')]:_0x2f34ec[_0xfdd4('0x1c')]+_0x2f34ec[_0xfdd4('0x1d')];var _0x52ce34;if(_0x33d752>=_0x216c7e){_0x33d752=_0x216c7e;_0x52ce34=0xc8;}else{_0x52ce34=0xce;}_0x42c3a8[_0xfdd4('0x17')](_0x52ce34);return _0x42c3a8[_0xfdd4('0x1e')](_0xfdd4('0x1f'),_0x2ccc88+'-'+_0x33d752+'/'+_0x216c7e)[_0xfdd4('0x19')](_0x431255);}return null;};}function patchUpdates(_0x1454f1){return function(_0x29cc8d){try{jsonpatch[_0xfdd4('0x20')](_0x29cc8d,_0x1454f1,!![]);}catch(_0x34dfa8){return BPromise['reject'](_0x34dfa8);}return _0x29cc8d[_0xfdd4('0x21')]();};}function saveUpdates(_0x17302b,_0x2a24e8){return function(_0x16e81b){if(_0x16e81b){return _0x16e81b[_0xfdd4('0x22')](_0x17302b)[_0xfdd4('0x23')](function(_0x451767){return _0x451767;});}return null;};}function removeEntity(_0x277ec1,_0x538b00){return function(_0x1e14da){if(_0x1e14da){return _0x1e14da[_0xfdd4('0x24')]()[_0xfdd4('0x23')](function(){_0x277ec1['status'](0xcc)[_0xfdd4('0x18')]();});}};}function handleEntityNotFound(_0x39b712,_0xf9c346){return function(_0x2f8268){if(!_0x2f8268){_0x39b712[_0xfdd4('0x25')](0x194);}return _0x2f8268;};}function handleError(_0x4a8790,_0x18bafb){_0x18bafb=_0x18bafb||0x1f4;return function(_0x2c88ad){logger[_0xfdd4('0x26')](_0x2c88ad[_0xfdd4('0x27')]);if(_0x2c88ad[_0xfdd4('0x28')]){delete _0x2c88ad[_0xfdd4('0x28')];}_0x4a8790[_0xfdd4('0x17')](_0x18bafb)[_0xfdd4('0x29')](_0x2c88ad);};}exports['index']=function(_0xcbd1fb,_0x39981f){var _0x385a68={},_0xef012e={},_0x2207ae={'count':0x0,'rows':[]};var _0x4a36a2=_[_0xfdd4('0x2a')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')],function(_0x2bb793){return{'name':_0x2bb793[_0xfdd4('0x2d')],'type':_0x2bb793['type'][_0xfdd4('0x2e')]};});_0xef012e[_0xfdd4('0x2f')]=_[_0xfdd4('0x2a')](_0x4a36a2,'name');_0xef012e[_0xfdd4('0x30')]=_['keys'](_0xcbd1fb[_0xfdd4('0x30')]);_0xef012e[_0xfdd4('0x31')]=_['intersection'](_0xef012e['model'],_0xef012e[_0xfdd4('0x30')]);_0x385a68[_0xfdd4('0x32')]=_['intersection'](_0xef012e['model'],qs[_0xfdd4('0x33')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x385a68[_0xfdd4('0x32')]=_0x385a68[_0xfdd4('0x32')][_0xfdd4('0x34')]?_0x385a68[_0xfdd4('0x32')]:_0xef012e[_0xfdd4('0x2f')];if(!_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x35')](_0xfdd4('0x36'))){_0x385a68[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1d')]);_0x385a68[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1c')]);}_0x385a68[_0xfdd4('0x37')]=qs[_0xfdd4('0x38')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x38')]);_0x385a68[_0xfdd4('0x39')]=qs[_0xfdd4('0x31')](_[_0xfdd4('0x3a')](_0xcbd1fb['query'],_0xef012e[_0xfdd4('0x31')]),_0x4a36a2);if(_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x3b')]){_0x385a68[_0xfdd4('0x39')]=_[_0xfdd4('0x3c')](_0x385a68[_0xfdd4('0x39')],{'$or':_['map'](_0x4a36a2,function(_0x245ce4){if(_0x245ce4['type']!==_0xfdd4('0x3d')){var _0x2c5199={};_0x2c5199[_0x245ce4[_0xfdd4('0x28')]]={'$like':'%'+_0xcbd1fb[_0xfdd4('0x30')]['filter']+'%'};return _0x2c5199;}})});}_0x385a68=_[_0xfdd4('0x3c')]({},_0x385a68,_0xcbd1fb[_0xfdd4('0x3e')]);var _0x1040e8={'where':_0x385a68[_0xfdd4('0x39')]};return db[_0xfdd4('0x2b')][_0xfdd4('0x1b')](_0x1040e8)[_0xfdd4('0x23')](function(_0x55fcec){_0x2207ae[_0xfdd4('0x1b')]=_0x55fcec;if(_0xcbd1fb[_0xfdd4('0x30')]['includeAll']){_0x385a68[_0xfdd4('0x3f')]=[{'all':!![]}];}return db[_0xfdd4('0x2b')][_0xfdd4('0x40')](_0x385a68);})[_0xfdd4('0x23')](function(_0x5173db){_0x2207ae[_0xfdd4('0x41')]=_0x5173db;return _0x2207ae;})[_0xfdd4('0x23')](respondWithFilteredResult(_0x39981f,_0x385a68))[_0xfdd4('0x42')](handleError(_0x39981f,null));};exports[_0xfdd4('0x43')]=function(_0x362c4f,_0x496747){var _0x1411e0={'raw':!![],'where':{'id':_0x362c4f[_0xfdd4('0x44')]['id']}},_0x23af2a={};_0x23af2a[_0xfdd4('0x2f')]=_[_0xfdd4('0x45')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')]);_0x23af2a['query']=_[_0xfdd4('0x45')](_0x362c4f['query']);_0x23af2a[_0xfdd4('0x31')]=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],_0x23af2a[_0xfdd4('0x30')]);_0x1411e0['attributes']=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],qs['fields'](_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x1411e0['attributes']=_0x1411e0[_0xfdd4('0x32')]['length']?_0x1411e0['attributes']:_0x23af2a['model'];if(_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x47')]){_0x1411e0[_0xfdd4('0x3f')]=[{'all':!![]}];}_0x1411e0=_['merge']({},_0x1411e0,_0x362c4f[_0xfdd4('0x3e')]);return db[_0xfdd4('0x2b')]['find'](_0x1411e0)[_0xfdd4('0x23')](handleEntityNotFound(_0x496747,null))[_0xfdd4('0x23')](respondWithResult(_0x496747,null))[_0xfdd4('0x42')](handleError(_0x496747,null));};exports[_0xfdd4('0x48')]=function(_0x746f6a,_0x3817fe){return db[_0xfdd4('0x2b')][_0xfdd4('0x48')](_0x746f6a[_0xfdd4('0x49')],{})[_0xfdd4('0x23')](respondWithResult(_0x3817fe,0xc9))[_0xfdd4('0x42')](handleError(_0x3817fe,null));};exports[_0xfdd4('0x22')]=function(_0x300965,_0x3c0ee1){if(_0x300965['body']['id']){delete _0x300965['body']['id'];}return db[_0xfdd4('0x2b')][_0xfdd4('0x4a')]({'where':{'id':_0x300965[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x3c0ee1,null))['then'](saveUpdates(_0x300965[_0xfdd4('0x49')],null))[_0xfdd4('0x23')](respondWithResult(_0x3c0ee1,null))['catch'](handleError(_0x3c0ee1,null));};exports['destroy']=function(_0x53c66d,_0x51dd34){return db['WhatsappQueueReport'][_0xfdd4('0x4a')]({'where':{'id':_0x53c66d[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x51dd34,null))[_0xfdd4('0x23')](removeEntity(_0x51dd34,null))[_0xfdd4('0x42')](handleError(_0x51dd34,null));};exports[_0xfdd4('0x4b')]=function(_0x4d0332,_0x17bbab){return db[_0xfdd4('0x2b')][_0xfdd4('0x4b')]()[_0xfdd4('0x23')](respondWithResult(_0x17bbab,null))['catch'](handleError(_0x17bbab,null));}; \ No newline at end of file +var _0x6b20=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x13e42b,_0x140460){var _0x21308d=function(_0x5781e9){while(--_0x5781e9){_0x13e42b['push'](_0x13e42b['shift']());}};_0x21308d(++_0x140460);}(_0x6b20,0xd1));var _0x06b2=function(_0x2e6414,_0x21a4de){_0x2e6414=_0x2e6414-0x0;var _0x5c5da0=_0x6b20[_0x2e6414];return _0x5c5da0;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];function respondWithStatusCode(_0x44a9b4,_0x810a12){_0x810a12=_0x810a12||0xcc;return function(_0x3039c9){if(_0x3039c9){return _0x44a9b4[_0x06b2('0x17')](_0x810a12);}return _0x44a9b4[_0x06b2('0x18')](_0x810a12)[_0x06b2('0x19')]();};}function respondWithResult(_0xa81f11,_0x2822e9){_0x2822e9=_0x2822e9||0xc8;return function(_0x26faee){if(_0x26faee){return _0xa81f11['status'](_0x2822e9)[_0x06b2('0x1a')](_0x26faee);}};}function respondWithFilteredResult(_0xaee98c,_0x47496c){return function(_0x3830e9){if(_0x3830e9){var _0xef0466=typeof _0x47496c[_0x06b2('0x1b')]==='undefined'&&typeof _0x47496c[_0x06b2('0x1c')]===_0x06b2('0x1d');var _0x525945=_0x3830e9[_0x06b2('0x1e')];var _0x594b48=_0xef0466?0x0:_0x47496c['offset'];var _0x192270=_0xef0466?_0x3830e9[_0x06b2('0x1e')]:_0x47496c[_0x06b2('0x1b')]+_0x47496c[_0x06b2('0x1c')];var _0x4c4e21;if(_0x192270>=_0x525945){_0x192270=_0x525945;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0xaee98c[_0x06b2('0x18')](_0x4c4e21);return _0xaee98c[_0x06b2('0x1f')](_0x06b2('0x20'),_0x594b48+'-'+_0x192270+'/'+_0x525945)[_0x06b2('0x1a')](_0x3830e9);}return null;};}function patchUpdates(_0xe28985){return function(_0x368ad8){try{jsonpatch[_0x06b2('0x21')](_0x368ad8,_0xe28985,!![]);}catch(_0x5ca622){return BPromise[_0x06b2('0x22')](_0x5ca622);}return _0x368ad8[_0x06b2('0x23')]();};}function saveUpdates(_0xb05f65,_0x208384){return function(_0x4e2a4c){if(_0x4e2a4c){return _0x4e2a4c['update'](_0xb05f65)[_0x06b2('0x24')](function(_0xb5231e){return _0xb5231e;});}return null;};}function removeEntity(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(_0x5e40f2){return _0x5e40f2[_0x06b2('0x25')]()[_0x06b2('0x24')](function(){_0x4fc95f[_0x06b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4382ce,_0x306ce){return function(_0xc65820){if(!_0xc65820){_0x4382ce[_0x06b2('0x17')](0x194);}return _0xc65820;};}function handleError(_0x1173fc,_0x4f5e90){_0x4f5e90=_0x4f5e90||0x1f4;return function(_0xbb00ea){logger[_0x06b2('0x26')](_0xbb00ea[_0x06b2('0x27')]);if(_0xbb00ea[_0x06b2('0x28')]){delete _0xbb00ea[_0x06b2('0x28')];}_0x1173fc[_0x06b2('0x18')](_0x4f5e90)['send'](_0xbb00ea);};}exports[_0x06b2('0x29')]=function(_0x2a3228,_0x2720fa){var _0x13c0eb={},_0x1f02d8={},_0x1bfaa9={'count':0x0,'rows':[]};var _0x3668bb=_['map'](db[_0x06b2('0x2a')][_0x06b2('0x2b')],function(_0x1637c2){return{'name':_0x1637c2[_0x06b2('0x2c')],'type':_0x1637c2[_0x06b2('0x2d')][_0x06b2('0x2e')]};});_0x1f02d8[_0x06b2('0x2f')]=_[_0x06b2('0x30')](_0x3668bb,'name');_0x1f02d8[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2a3228[_0x06b2('0x31')]);_0x1f02d8[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x1f02d8[_0x06b2('0x2f')],_0x1f02d8[_0x06b2('0x31')]);_0x13c0eb['attributes']=_['intersection'](_0x1f02d8[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2a3228[_0x06b2('0x31')]['fields']));_0x13c0eb[_0x06b2('0x36')]=_0x13c0eb[_0x06b2('0x36')][_0x06b2('0x37')]?_0x13c0eb[_0x06b2('0x36')]:_0x1f02d8[_0x06b2('0x2f')];if(!_0x2a3228[_0x06b2('0x31')]['hasOwnProperty'](_0x06b2('0x38'))){_0x13c0eb[_0x06b2('0x1c')]=qs[_0x06b2('0x1c')](_0x2a3228['query'][_0x06b2('0x1c')]);_0x13c0eb[_0x06b2('0x1b')]=qs['offset'](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x1b')]);}_0x13c0eb[_0x06b2('0x39')]=qs[_0x06b2('0x3a')](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3a')]);_0x13c0eb[_0x06b2('0x3b')]=qs[_0x06b2('0x33')](_[_0x06b2('0x3c')](_0x2a3228[_0x06b2('0x31')],_0x1f02d8[_0x06b2('0x33')]),_0x3668bb);if(_0x2a3228[_0x06b2('0x31')]['filter']){_0x13c0eb[_0x06b2('0x3b')]=_['merge'](_0x13c0eb['where'],{'$or':_[_0x06b2('0x30')](_0x3668bb,function(_0x4e92e0){if(_0x4e92e0[_0x06b2('0x2d')]!=='VIRTUAL'){var _0x35e29c={};_0x35e29c[_0x4e92e0[_0x06b2('0x28')]]={'$like':'%'+_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3d')]+'%'};return _0x35e29c;}})});}_0x13c0eb=_[_0x06b2('0x3e')]({},_0x13c0eb,_0x2a3228['options']);var _0x404eab={'where':_0x13c0eb[_0x06b2('0x3b')]};return db[_0x06b2('0x2a')][_0x06b2('0x1e')](_0x404eab)[_0x06b2('0x24')](function(_0x39fd60){_0x1bfaa9['count']=_0x39fd60;if(_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3f')]){_0x13c0eb['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x06b2('0x40')](_0x13c0eb);})[_0x06b2('0x24')](function(_0x286c9b){_0x1bfaa9[_0x06b2('0x41')]=_0x286c9b;return _0x1bfaa9;})[_0x06b2('0x24')](respondWithFilteredResult(_0x2720fa,_0x13c0eb))[_0x06b2('0x42')](handleError(_0x2720fa,null));};exports[_0x06b2('0x43')]=function(_0x2ff968,_0x2e2a80){var _0x117bf4={'raw':!![],'where':{'id':_0x2ff968[_0x06b2('0x44')]['id']}},_0x1d7750={};_0x1d7750[_0x06b2('0x2f')]=_[_0x06b2('0x32')](db[_0x06b2('0x2a')][_0x06b2('0x2b')]);_0x1d7750[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2ff968[_0x06b2('0x31')]);_0x1d7750['filters']=_[_0x06b2('0x34')](_0x1d7750[_0x06b2('0x2f')],_0x1d7750[_0x06b2('0x31')]);_0x117bf4[_0x06b2('0x36')]=_['intersection'](_0x1d7750[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2ff968['query'][_0x06b2('0x35')]));_0x117bf4[_0x06b2('0x36')]=_0x117bf4['attributes'][_0x06b2('0x37')]?_0x117bf4[_0x06b2('0x36')]:_0x1d7750['model'];if(_0x2ff968['query']['includeAll']){_0x117bf4[_0x06b2('0x45')]=[{'all':!![]}];}_0x117bf4=_[_0x06b2('0x3e')]({},_0x117bf4,_0x2ff968[_0x06b2('0x46')]);return db[_0x06b2('0x2a')][_0x06b2('0x47')](_0x117bf4)['then'](handleEntityNotFound(_0x2e2a80,null))['then'](respondWithResult(_0x2e2a80,null))[_0x06b2('0x42')](handleError(_0x2e2a80,null));};exports[_0x06b2('0x48')]=function(_0x979759,_0x1f4d89){return db[_0x06b2('0x2a')][_0x06b2('0x48')](_0x979759['body'],{})[_0x06b2('0x24')](respondWithResult(_0x1f4d89,0xc9))[_0x06b2('0x42')](handleError(_0x1f4d89,null));};exports[_0x06b2('0x49')]=function(_0x33f72e,_0x146c5c){if(_0x33f72e[_0x06b2('0x4a')]['id']){delete _0x33f72e['body']['id'];}return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x33f72e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x146c5c,null))['then'](saveUpdates(_0x33f72e[_0x06b2('0x4a')],null))[_0x06b2('0x24')](respondWithResult(_0x146c5c,null))[_0x06b2('0x42')](handleError(_0x146c5c,null));};exports[_0x06b2('0x25')]=function(_0x546c9e,_0x346f04){return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x546c9e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x346f04,null))[_0x06b2('0x24')](removeEntity(_0x346f04,null))[_0x06b2('0x42')](handleError(_0x346f04,null));};exports[_0x06b2('0x4b')]=function(_0x568091,_0x33bc8e){return db[_0x06b2('0x2a')][_0x06b2('0x4b')]()[_0x06b2('0x24')](respondWithResult(_0x33bc8e,null))[_0x06b2('0x42')](handleError(_0x33bc8e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 5014490..da77238 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 _0x5de2=['exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x1a6bfc,_0x640fcb){var _0x4b27b5=function(_0x42a524){while(--_0x42a524){_0x1a6bfc['push'](_0x1a6bfc['shift']());}};_0x4b27b5(++_0x640fcb);}(_0x5de2,0xf6));var _0x25de=function(_0x4b0870,_0x524997){_0x4b0870=_0x4b0870-0x0;var _0x1f0fa5=_0x5de2[_0x4b0870];return _0x1f0fa5;};'use strict';var _=require(_0x25de('0x0'));var util=require(_0x25de('0x1'));var logger=require(_0x25de('0x2'))('api');var moment=require(_0x25de('0x3'));var BPromise=require(_0x25de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25de('0x5'));var config=require(_0x25de('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x25de('0x7')]=function(_0x1dc21c,_0x5d8739){return _0x1dc21c[_0x25de('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x25de('0x9'),'paranoid':![],'indexes':[{'name':_0x25de('0xa'),'fields':[_0x25de('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x543a=['exports','WhatsappQueueReport','uniqueid','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x543a,0x17f));var _0xa543=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x543a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa543('0x0'))('api');var moment=require(_0xa543('0x1'));var BPromise=require(_0xa543('0x2'));var rp=require(_0xa543('0x3'));var fs=require('fs');var path=require(_0xa543('0x4'));var rimraf=require(_0xa543('0x5'));var config=require(_0xa543('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0xa543('0x7')]=function(_0x3d781a,_0x1cbc3f){return _0x3d781a['define'](_0xa543('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa543('0x9'),'fields':[_0xa543('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bf8483e..38f5ccd 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 _0xf1fd=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result'];(function(_0x197f4d,_0x263cf7){var _0x5c80fd=function(_0x4f7907){while(--_0x4f7907){_0x197f4d['push'](_0x197f4d['shift']());}};_0x5c80fd(++_0x263cf7);}(_0xf1fd,0x1dc));var _0xdf1f=function(_0x548af0,_0x2f9fd8){_0x548af0=_0x548af0-0x0;var _0x595aeb=_0xf1fd[_0x548af0];return _0x595aeb;};'use strict';var _=require(_0xdf1f('0x0'));var util=require(_0xdf1f('0x1'));var moment=require(_0xdf1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf1f('0x3'));var fs=require('fs');var Redis=require(_0xdf1f('0x4'));var db=require(_0xdf1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf1f('0x6'))(_0xdf1f('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf1f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3abb8a,_0x3667f4,_0x38c8fe){return new BPromise(function(_0xc6668a,_0x5dccf4){return client[_0xdf1f('0x9')](_0x3abb8a,_0x38c8fe)[_0xdf1f('0xa')](function(_0x21f7c0){logger[_0xdf1f('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3667f4,_0xdf1f('0xc'));logger[_0xdf1f('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3667f4,_0xdf1f('0xc'),JSON[_0xdf1f('0xe')](_0x21f7c0));if(_0x21f7c0[_0xdf1f('0xf')]){if(_0x21f7c0[_0xdf1f('0xf')][_0xdf1f('0x10')]===0x1f4){logger[_0xdf1f('0xf')](_0xdf1f('0x11'),_0x3667f4,_0x21f7c0[_0xdf1f('0xf')]['message']);return _0x5dccf4(_0x21f7c0[_0xdf1f('0xf')][_0xdf1f('0x12')]);}logger[_0xdf1f('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3667f4,_0x21f7c0[_0xdf1f('0xf')][_0xdf1f('0x12')]);return _0xc6668a(_0x21f7c0[_0xdf1f('0xf')][_0xdf1f('0x12')]);}else{logger[_0xdf1f('0xb')](_0xdf1f('0x11'),_0x3667f4,_0xdf1f('0xc'));_0xc6668a(_0x21f7c0[_0xdf1f('0x13')]['message']);}})[_0xdf1f('0x14')](function(_0x55644d){logger[_0xdf1f('0xf')](_0xdf1f('0x11'),_0x3667f4,_0x55644d);_0x5dccf4(_0x55644d);});});}exports[_0xdf1f('0x15')]=function(_0x1c19f1){var _0x230c2e=this;return new Promise(function(_0x5dfada,_0x1e2f41){return db[_0xdf1f('0x16')][_0xdf1f('0x17')](_0x1c19f1[_0xdf1f('0x18')],{'raw':_0x1c19f1['options']?_0x1c19f1[_0xdf1f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdf1f('0xa')](function(_0x463986){logger['info'](_0xdf1f('0x15'),_0x1c19f1);logger['debug'](_0xdf1f('0x15'),_0x1c19f1,JSON[_0xdf1f('0xe')](_0x463986));_0x5dfada(_0x463986);})['catch'](function(_0x266364){logger['error'](_0xdf1f('0x15'),_0x266364[_0xdf1f('0x12')],_0x1c19f1);_0x1e2f41(_0x230c2e[_0xdf1f('0xf')](0x1f4,_0x266364[_0xdf1f('0x12')]));});});};exports[_0xdf1f('0x1a')]=function(_0x32614f){var _0x244bf6=this;return new Promise(function(_0x3428ad,_0x59e26b){return db[_0xdf1f('0x16')][_0xdf1f('0x1b')](_0x32614f[_0xdf1f('0x18')],{'raw':_0x32614f[_0xdf1f('0x19')]?_0x32614f[_0xdf1f('0x19')][_0xdf1f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32614f[_0xdf1f('0x19')]?_0x32614f[_0xdf1f('0x19')]['where']||null:null,'attributes':_0x32614f[_0xdf1f('0x19')]?_0x32614f['options'][_0xdf1f('0x1d')]||null:null,'limit':_0x32614f[_0xdf1f('0x19')]?_0x32614f['options'][_0xdf1f('0x1e')]||null:null})[_0xdf1f('0xa')](function(_0x10a5b7){logger[_0xdf1f('0xb')](_0xdf1f('0x1a'),_0x32614f);logger['debug'](_0xdf1f('0x1a'),_0x32614f,JSON[_0xdf1f('0xe')](_0x10a5b7));_0x3428ad(_0x10a5b7);})[_0xdf1f('0x14')](function(_0x494463){logger[_0xdf1f('0xf')](_0xdf1f('0x1a'),_0x494463[_0xdf1f('0x12')],_0x32614f);_0x59e26b(_0x244bf6[_0xdf1f('0xf')](0x1f4,_0x494463['message']));});});}; \ No newline at end of file +var _0x51ec=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappQueueReport','options','then','UpdateWhatsappQueueReport','update','body','where','attributes','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x51ec,0x156));var _0xc51e=function(_0x4ea4a6,_0xa3636e){_0x4ea4a6=_0x4ea4a6-0x0;var _0x4f45c6=_0x51ec[_0x4ea4a6];return _0x4f45c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc51e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc51e('0x1'))['db'];var utils=require(_0xc51e('0x2'));var logger=require('../../config/logger')(_0xc51e('0x3'));var config=require(_0xc51e('0x4'));var jayson=require(_0xc51e('0x5'));var client=jayson['client'][_0xc51e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4bf4bf,_0x506b12,_0x30b8be){return new BPromise(function(_0xf7081b,_0x1eb90e){return client['request'](_0x4bf4bf,_0x30b8be)['then'](function(_0x4df526){logger[_0xc51e('0x7')](_0xc51e('0x8'),_0x506b12,'request\x20sent');logger[_0xc51e('0x9')](_0xc51e('0xa'),_0x506b12,_0xc51e('0xb'),JSON[_0xc51e('0xc')](_0x4df526));if(_0x4df526[_0xc51e('0xd')]){if(_0x4df526['error']['code']===0x1f4){logger[_0xc51e('0xd')](_0xc51e('0x8'),_0x506b12,_0x4df526[_0xc51e('0xd')][_0xc51e('0xe')]);return _0x1eb90e(_0x4df526['error']['message']);}logger[_0xc51e('0xd')](_0xc51e('0x8'),_0x506b12,_0x4df526[_0xc51e('0xd')][_0xc51e('0xe')]);return _0xf7081b(_0x4df526[_0xc51e('0xd')][_0xc51e('0xe')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x506b12,'request\x20sent');_0xf7081b(_0x4df526[_0xc51e('0xf')][_0xc51e('0xe')]);}})[_0xc51e('0x10')](function(_0x89b7a3){logger[_0xc51e('0xd')](_0xc51e('0x8'),_0x506b12,_0x89b7a3);_0x1eb90e(_0x89b7a3);});});}exports[_0xc51e('0x11')]=function(_0x14d7d5){var _0x55bc66=this;return new Promise(function(_0x2e0158,_0x2e2029){return db['WhatsappQueueReport']['create'](_0x14d7d5['body'],{'raw':_0x14d7d5[_0xc51e('0x12')]?_0x14d7d5[_0xc51e('0x12')]['raw']===undefined?!![]:![]:!![]})[_0xc51e('0x13')](function(_0x4ebeba){logger[_0xc51e('0x7')](_0xc51e('0x11'),_0x14d7d5);logger['debug'](_0xc51e('0x11'),_0x14d7d5,JSON['stringify'](_0x4ebeba));_0x2e0158(_0x4ebeba);})[_0xc51e('0x10')](function(_0x208a01){logger['error']('CreateWhatsappQueueReport',_0x208a01[_0xc51e('0xe')],_0x14d7d5);_0x2e2029(_0x55bc66[_0xc51e('0xd')](0x1f4,_0x208a01[_0xc51e('0xe')]));});});};exports[_0xc51e('0x14')]=function(_0x50c3ad){var _0x30292c=this;return new Promise(function(_0x42bcfe,_0x8c9037){return db['WhatsappQueueReport'][_0xc51e('0x15')](_0x50c3ad[_0xc51e('0x16')],{'raw':_0x50c3ad[_0xc51e('0x12')]?_0x50c3ad[_0xc51e('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c3ad['options']?_0x50c3ad[_0xc51e('0x12')][_0xc51e('0x17')]||null:null,'attributes':_0x50c3ad[_0xc51e('0x12')]?_0x50c3ad['options'][_0xc51e('0x18')]||null:null,'limit':_0x50c3ad[_0xc51e('0x12')]?_0x50c3ad[_0xc51e('0x12')]['limit']||null:null})[_0xc51e('0x13')](function(_0x5f23c1){logger[_0xc51e('0x7')](_0xc51e('0x14'),_0x50c3ad);logger['debug'](_0xc51e('0x14'),_0x50c3ad,JSON[_0xc51e('0xc')](_0x5f23c1));_0x42bcfe(_0x5f23c1);})[_0xc51e('0x10')](function(_0x654a61){logger[_0xc51e('0xd')](_0xc51e('0x14'),_0x654a61[_0xc51e('0xe')],_0x50c3ad);_0x8c9037(_0x30292c[_0xc51e('0xd')](0x1f4,_0x654a61[_0xc51e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 199fd36..f8726b9 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 _0xec96=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x3ac312,_0x5d3903){var _0x36b673=function(_0x254b25){while(--_0x254b25){_0x3ac312['push'](_0x3ac312['shift']());}};_0x36b673(++_0x5d3903);}(_0xec96,0x18c));var _0x6ec9=function(_0x466fbb,_0x5e4a13){_0x466fbb=_0x466fbb-0x0;var _0xfa7f8d=_0xec96[_0x466fbb];return _0xfa7f8d;};'use strict';var multer=require(_0x6ec9('0x0'));var util=require('util');var path=require(_0x6ec9('0x1'));var timeout=require(_0x6ec9('0x2'));var express=require(_0x6ec9('0x3'));var router=express[_0x6ec9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ec9('0x5'));var interaction=require(_0x6ec9('0x6'));var config=require(_0x6ec9('0x7'));var controller=require(_0x6ec9('0x8'));router[_0x6ec9('0x9')]('/',auth['isAuthenticated'](),controller[_0x6ec9('0xa')]);router['get'](_0x6ec9('0xb'),auth[_0x6ec9('0xc')](),controller[_0x6ec9('0xd')]);router['get'](_0x6ec9('0xe'),auth[_0x6ec9('0xc')](),controller[_0x6ec9('0xf')]);router[_0x6ec9('0x10')]('/',auth[_0x6ec9('0xc')](),controller[_0x6ec9('0x11')]);router[_0x6ec9('0x12')](_0x6ec9('0xe'),auth[_0x6ec9('0xc')](),controller[_0x6ec9('0x13')]);router[_0x6ec9('0x14')]('/:id',auth[_0x6ec9('0xc')](),controller[_0x6ec9('0x15')]);module[_0x6ec9('0x16')]=router; \ No newline at end of file +var _0xf5ac=['express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout'];(function(_0x31ffb7,_0x135a9f){var _0x59f45e=function(_0x377070){while(--_0x377070){_0x31ffb7['push'](_0x31ffb7['shift']());}};_0x59f45e(++_0x135a9f);}(_0xf5ac,0x1e2));var _0xcf5a=function(_0x11af50,_0x2b783c){_0x11af50=_0x11af50-0x0;var _0x13e5ff=_0xf5ac[_0x11af50];return _0x13e5ff;};'use strict';var multer=require(_0xcf5a('0x0'));var util=require(_0xcf5a('0x1'));var path=require(_0xcf5a('0x2'));var timeout=require(_0xcf5a('0x3'));var express=require(_0xcf5a('0x4'));var router=express['Router']();var fs_extra=require(_0xcf5a('0x5'));var auth=require(_0xcf5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf5a('0x7'));var controller=require(_0xcf5a('0x8'));router[_0xcf5a('0x9')]('/',auth[_0xcf5a('0xa')](),controller['index']);router[_0xcf5a('0x9')](_0xcf5a('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xcf5a('0xc'),auth[_0xcf5a('0xa')](),controller[_0xcf5a('0xd')]);router[_0xcf5a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf5a('0xf')]);router[_0xcf5a('0x10')]('/:id',auth[_0xcf5a('0xa')](),controller['update']);router['delete'](_0xcf5a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcf5a('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ad12371..67d1c2e 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 _0xbc87=['exports','ENUM','account','agent','queue','sequelize'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x35dc0e,_0x23393b){_0x35dc0e=_0x35dc0e-0x0;var _0x42c591=_0xbc87[_0x35dc0e];return _0x42c591;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module[_0x7bc8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7bc8('0x2')](_0x7bc8('0x3'),_0x7bc8('0x4'),_0x7bc8('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8c11=['sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0xd1f39a,_0x41079c){var _0x2da90d=function(_0x5b6a23){while(--_0x5b6a23){_0xd1f39a['push'](_0xd1f39a['shift']());}};_0x2da90d(++_0x41079c);}(_0x8c11,0xf5));var _0x18c1=function(_0x3a7c20,_0x5a5252){_0x3a7c20=_0x3a7c20-0x0;var _0x44bf45=_0x8c11[_0x3a7c20];return _0x44bf45;};'use strict';var Sequelize=require(_0x18c1('0x0'));module[_0x18c1('0x1')]={'uniqueid':{'type':Sequelize[_0x18c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x18c1('0x3')](_0x18c1('0x4'),_0x18c1('0x5'),_0x18c1('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7434d04..92235ca 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 _0xe172=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','WhatsappTransferReport','findAll','rows','catch','show','params','includeAll','include','options','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe172,0x1bb));var _0x2e17=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xe172[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x2e17('0x0'));var rimraf=require(_0x2e17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e17('0x2'));var rp=require(_0x2e17('0x3'));var moment=require('moment');var BPromise=require(_0x2e17('0x4'));var Mustache=require('mustache');var util=require(_0x2e17('0x5'));var path=require(_0x2e17('0x6'));var sox=require(_0x2e17('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e17('0x8'));var _=require(_0x2e17('0x9'));var squel=require(_0x2e17('0xa'));var crypto=require(_0x2e17('0xb'));var jsforce=require(_0x2e17('0xc'));var deskjs=require(_0x2e17('0xd'));var toCsv=require(_0x2e17('0xe'));var querystring=require(_0x2e17('0xf'));var Papa=require(_0x2e17('0x10'));var Redis=require(_0x2e17('0x11'));var authService=require(_0x2e17('0x12'));var qs=require(_0x2e17('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e17('0x14'));var logger=require(_0x2e17('0x15'))('api');var utils=require(_0x2e17('0x16'));var config=require(_0x2e17('0x17'));var licenseUtil=require(_0x2e17('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392b41,_0x14ee53){_0x14ee53=_0x14ee53||0xcc;return function(_0x3746c8){if(_0x3746c8){return _0x392b41[_0x2e17('0x19')](_0x14ee53);}return _0x392b41[_0x2e17('0x1a')](_0x14ee53)[_0x2e17('0x1b')]();};}function respondWithResult(_0x6d0a20,_0x3bc097){_0x3bc097=_0x3bc097||0xc8;return function(_0x9eee33){if(_0x9eee33){return _0x6d0a20[_0x2e17('0x1a')](_0x3bc097)[_0x2e17('0x1c')](_0x9eee33);}};}function respondWithFilteredResult(_0x362317,_0x5dc063){return function(_0x3d3f32){if(_0x3d3f32){var _0x5685f5=typeof _0x5dc063['offset']===_0x2e17('0x1d')&&typeof _0x5dc063[_0x2e17('0x1e')]===_0x2e17('0x1d');var _0x11c215=_0x3d3f32[_0x2e17('0x1f')];var _0x532f89=_0x5685f5?0x0:_0x5dc063[_0x2e17('0x20')];var _0x1d8640=_0x5685f5?_0x3d3f32[_0x2e17('0x1f')]:_0x5dc063['offset']+_0x5dc063[_0x2e17('0x1e')];var _0x381f10;if(_0x1d8640>=_0x11c215){_0x1d8640=_0x11c215;_0x381f10=0xc8;}else{_0x381f10=0xce;}_0x362317[_0x2e17('0x1a')](_0x381f10);return _0x362317['set'](_0x2e17('0x21'),_0x532f89+'-'+_0x1d8640+'/'+_0x11c215)[_0x2e17('0x1c')](_0x3d3f32);}return null;};}function patchUpdates(_0xa75a6f){return function(_0x17c610){try{jsonpatch[_0x2e17('0x22')](_0x17c610,_0xa75a6f,!![]);}catch(_0x9ad5c6){return BPromise[_0x2e17('0x23')](_0x9ad5c6);}return _0x17c610[_0x2e17('0x24')]();};}function saveUpdates(_0x3bad28,_0x3d7f8d){return function(_0x2e8883){if(_0x2e8883){return _0x2e8883['update'](_0x3bad28)[_0x2e17('0x25')](function(_0x557a66){return _0x557a66;});}return null;};}function removeEntity(_0x9649a1,_0x8dffe7){return function(_0x4bcf06){if(_0x4bcf06){return _0x4bcf06['destroy']()['then'](function(){_0x9649a1[_0x2e17('0x1a')](0xcc)[_0x2e17('0x1b')]();});}};}function handleEntityNotFound(_0x1f0cd5,_0xedb860){return function(_0x581da7){if(!_0x581da7){_0x1f0cd5['sendStatus'](0x194);}return _0x581da7;};}function handleError(_0x1397a1,_0x292818){_0x292818=_0x292818||0x1f4;return function(_0x716df8){logger[_0x2e17('0x26')](_0x716df8['stack']);if(_0x716df8[_0x2e17('0x27')]){delete _0x716df8[_0x2e17('0x27')];}_0x1397a1['status'](_0x292818)['send'](_0x716df8);};}exports[_0x2e17('0x28')]=function(_0x3dd210,_0x4e1f47){var _0x2f5a5f={},_0x209c00={},_0x503f34={'count':0x0,'rows':[]};var _0x29b951=_[_0x2e17('0x29')](db['WhatsappTransferReport'][_0x2e17('0x2a')],function(_0x55047c){return{'name':_0x55047c[_0x2e17('0x2b')],'type':_0x55047c[_0x2e17('0x2c')][_0x2e17('0x2d')]};});_0x209c00[_0x2e17('0x2e')]=_[_0x2e17('0x29')](_0x29b951,'name');_0x209c00[_0x2e17('0x2f')]=_[_0x2e17('0x30')](_0x3dd210[_0x2e17('0x2f')]);_0x209c00[_0x2e17('0x31')]=_['intersection'](_0x209c00['model'],_0x209c00[_0x2e17('0x2f')]);_0x2f5a5f[_0x2e17('0x32')]=_[_0x2e17('0x33')](_0x209c00[_0x2e17('0x2e')],qs['fields'](_0x3dd210[_0x2e17('0x2f')][_0x2e17('0x34')]));_0x2f5a5f[_0x2e17('0x32')]=_0x2f5a5f['attributes'][_0x2e17('0x35')]?_0x2f5a5f['attributes']:_0x209c00[_0x2e17('0x2e')];if(!_0x3dd210[_0x2e17('0x2f')][_0x2e17('0x36')](_0x2e17('0x37'))){_0x2f5a5f[_0x2e17('0x1e')]=qs[_0x2e17('0x1e')](_0x3dd210[_0x2e17('0x2f')]['limit']);_0x2f5a5f[_0x2e17('0x20')]=qs[_0x2e17('0x20')](_0x3dd210['query'][_0x2e17('0x20')]);}_0x2f5a5f['order']=qs[_0x2e17('0x38')](_0x3dd210[_0x2e17('0x2f')][_0x2e17('0x38')]);_0x2f5a5f['where']=qs[_0x2e17('0x31')](_['pick'](_0x3dd210[_0x2e17('0x2f')],_0x209c00['filters']),_0x29b951);if(_0x3dd210['query'][_0x2e17('0x39')]){_0x2f5a5f[_0x2e17('0x3a')]=_[_0x2e17('0x3b')](_0x2f5a5f['where'],{'$or':_['map'](_0x29b951,function(_0x920b87){if(_0x920b87[_0x2e17('0x2c')]!==_0x2e17('0x3c')){var _0x5d5b7c={};_0x5d5b7c[_0x920b87[_0x2e17('0x27')]]={'$like':'%'+_0x3dd210[_0x2e17('0x2f')][_0x2e17('0x39')]+'%'};return _0x5d5b7c;}})});}_0x2f5a5f=_[_0x2e17('0x3b')]({},_0x2f5a5f,_0x3dd210['options']);var _0x53149b={'where':_0x2f5a5f[_0x2e17('0x3a')]};return db[_0x2e17('0x3d')][_0x2e17('0x1f')](_0x53149b)['then'](function(_0x49cb1c){_0x503f34['count']=_0x49cb1c;if(_0x3dd210[_0x2e17('0x2f')]['includeAll']){_0x2f5a5f['include']=[{'all':!![]}];}return db[_0x2e17('0x3d')][_0x2e17('0x3e')](_0x2f5a5f);})['then'](function(_0xd4c2ed){_0x503f34[_0x2e17('0x3f')]=_0xd4c2ed;return _0x503f34;})[_0x2e17('0x25')](respondWithFilteredResult(_0x4e1f47,_0x2f5a5f))[_0x2e17('0x40')](handleError(_0x4e1f47,null));};exports[_0x2e17('0x41')]=function(_0x3daf22,_0x3715ca){var _0x56be42={'raw':!![],'where':{'id':_0x3daf22[_0x2e17('0x42')]['id']}},_0x2b2f0c={};_0x2b2f0c[_0x2e17('0x2e')]=_[_0x2e17('0x30')](db[_0x2e17('0x3d')][_0x2e17('0x2a')]);_0x2b2f0c['query']=_['keys'](_0x3daf22['query']);_0x2b2f0c[_0x2e17('0x31')]=_[_0x2e17('0x33')](_0x2b2f0c['model'],_0x2b2f0c[_0x2e17('0x2f')]);_0x56be42[_0x2e17('0x32')]=_[_0x2e17('0x33')](_0x2b2f0c[_0x2e17('0x2e')],qs[_0x2e17('0x34')](_0x3daf22[_0x2e17('0x2f')]['fields']));_0x56be42[_0x2e17('0x32')]=_0x56be42['attributes'][_0x2e17('0x35')]?_0x56be42[_0x2e17('0x32')]:_0x2b2f0c[_0x2e17('0x2e')];if(_0x3daf22[_0x2e17('0x2f')][_0x2e17('0x43')]){_0x56be42[_0x2e17('0x44')]=[{'all':!![]}];}_0x56be42=_[_0x2e17('0x3b')]({},_0x56be42,_0x3daf22[_0x2e17('0x45')]);return db[_0x2e17('0x3d')][_0x2e17('0x46')](_0x56be42)[_0x2e17('0x25')](handleEntityNotFound(_0x3715ca,null))[_0x2e17('0x25')](respondWithResult(_0x3715ca,null))[_0x2e17('0x40')](handleError(_0x3715ca,null));};exports[_0x2e17('0x47')]=function(_0x331b75,_0x20de7b){return db['WhatsappTransferReport'][_0x2e17('0x47')](_0x331b75['body'],{})[_0x2e17('0x25')](respondWithResult(_0x20de7b,0xc9))[_0x2e17('0x40')](handleError(_0x20de7b,null));};exports[_0x2e17('0x48')]=function(_0x3d1d72,_0x229f09){if(_0x3d1d72[_0x2e17('0x49')]['id']){delete _0x3d1d72['body']['id'];}return db[_0x2e17('0x3d')][_0x2e17('0x46')]({'where':{'id':_0x3d1d72[_0x2e17('0x42')]['id']}})['then'](handleEntityNotFound(_0x229f09,null))[_0x2e17('0x25')](saveUpdates(_0x3d1d72[_0x2e17('0x49')],null))[_0x2e17('0x25')](respondWithResult(_0x229f09,null))['catch'](handleError(_0x229f09,null));};exports['destroy']=function(_0x5c99ce,_0xc75b81){return db['WhatsappTransferReport'][_0x2e17('0x46')]({'where':{'id':_0x5c99ce[_0x2e17('0x42')]['id']}})[_0x2e17('0x25')](handleEntityNotFound(_0xc75b81,null))[_0x2e17('0x25')](removeEntity(_0xc75b81,null))['catch'](handleError(_0xc75b81,null));};exports[_0x2e17('0x4a')]=function(_0x3c460f,_0xd1cb0d){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0xd1cb0d,null))[_0x2e17('0x40')](handleError(_0xd1cb0d,null));}; \ No newline at end of file +var _0xd00d=['send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name'];(function(_0x85953f,_0x2decd2){var _0x35a9c5=function(_0x474e91){while(--_0x474e91){_0x85953f['push'](_0x85953f['shift']());}};_0x35a9c5(++_0x2decd2);}(_0xd00d,0xec));var _0xdd00=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xd00d[_0x28509b];return _0x1e0b6;};'use strict';var emlformat=require(_0xdd00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd00('0x1'));var jsonpatch=require(_0xdd00('0x2'));var rp=require(_0xdd00('0x3'));var moment=require('moment');var BPromise=require(_0xdd00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd00('0x5'));var sox=require('sox');var csv=require(_0xdd00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd00('0x7'));var _=require(_0xdd00('0x8'));var squel=require(_0xdd00('0x9'));var crypto=require(_0xdd00('0xa'));var jsforce=require(_0xdd00('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd00('0x6'));var querystring=require(_0xdd00('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd00('0xd'));var as=require(_0xdd00('0xe'));var hardwareService=require(_0xdd00('0xf'));var logger=require(_0xdd00('0x10'))(_0xdd00('0x11'));var utils=require(_0xdd00('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xdd00('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32364f,_0x3a1e4){_0x3a1e4=_0x3a1e4||0xcc;return function(_0x2e83c0){if(_0x2e83c0){return _0x32364f['sendStatus'](_0x3a1e4);}return _0x32364f[_0xdd00('0x14')](_0x3a1e4)[_0xdd00('0x15')]();};}function respondWithResult(_0x5e3933,_0x588a38){_0x588a38=_0x588a38||0xc8;return function(_0x46b34f){if(_0x46b34f){return _0x5e3933[_0xdd00('0x14')](_0x588a38)[_0xdd00('0x16')](_0x46b34f);}};}function respondWithFilteredResult(_0x4d513d,_0x45ba69){return function(_0x1fd65b){if(_0x1fd65b){var _0x4ff724=typeof _0x45ba69[_0xdd00('0x17')]==='undefined'&&typeof _0x45ba69[_0xdd00('0x18')]===_0xdd00('0x19');var _0x5a1043=_0x1fd65b[_0xdd00('0x1a')];var _0x22ab50=_0x4ff724?0x0:_0x45ba69[_0xdd00('0x17')];var _0x4a1952=_0x4ff724?_0x1fd65b[_0xdd00('0x1a')]:_0x45ba69[_0xdd00('0x17')]+_0x45ba69[_0xdd00('0x18')];var _0x41bf7a;if(_0x4a1952>=_0x5a1043){_0x4a1952=_0x5a1043;_0x41bf7a=0xc8;}else{_0x41bf7a=0xce;}_0x4d513d[_0xdd00('0x14')](_0x41bf7a);return _0x4d513d[_0xdd00('0x1b')](_0xdd00('0x1c'),_0x22ab50+'-'+_0x4a1952+'/'+_0x5a1043)[_0xdd00('0x16')](_0x1fd65b);}return null;};}function patchUpdates(_0x3ccac7){return function(_0x2fa202){try{jsonpatch[_0xdd00('0x1d')](_0x2fa202,_0x3ccac7,!![]);}catch(_0x24ca20){return BPromise[_0xdd00('0x1e')](_0x24ca20);}return _0x2fa202[_0xdd00('0x1f')]();};}function saveUpdates(_0x2a7ae0,_0x517305){return function(_0xe4d2c){if(_0xe4d2c){return _0xe4d2c['update'](_0x2a7ae0)[_0xdd00('0x20')](function(_0x3952b8){return _0x3952b8;});}return null;};}function removeEntity(_0x2756b9,_0x1ece14){return function(_0x844ed8){if(_0x844ed8){return _0x844ed8[_0xdd00('0x21')]()[_0xdd00('0x20')](function(){_0x2756b9[_0xdd00('0x14')](0xcc)[_0xdd00('0x15')]();});}};}function handleEntityNotFound(_0x1abca3,_0x141d4e){return function(_0x33e860){if(!_0x33e860){_0x1abca3['sendStatus'](0x194);}return _0x33e860;};}function handleError(_0x425c5d,_0x44be4c){_0x44be4c=_0x44be4c||0x1f4;return function(_0x3828c7){logger[_0xdd00('0x22')](_0x3828c7['stack']);if(_0x3828c7[_0xdd00('0x23')]){delete _0x3828c7[_0xdd00('0x23')];}_0x425c5d[_0xdd00('0x14')](_0x44be4c)[_0xdd00('0x24')](_0x3828c7);};}exports['index']=function(_0x3b301e,_0x2ce5c6){var _0x7ffd96={},_0x380866={},_0x15a398={'count':0x0,'rows':[]};var _0x349471=_[_0xdd00('0x25')](db['WhatsappTransferReport'][_0xdd00('0x26')],function(_0x2dbe56){return{'name':_0x2dbe56[_0xdd00('0x27')],'type':_0x2dbe56['type']['key']};});_0x380866[_0xdd00('0x28')]=_[_0xdd00('0x25')](_0x349471,_0xdd00('0x23'));_0x380866[_0xdd00('0x29')]=_[_0xdd00('0x2a')](_0x3b301e[_0xdd00('0x29')]);_0x380866[_0xdd00('0x2b')]=_[_0xdd00('0x2c')](_0x380866[_0xdd00('0x28')],_0x380866[_0xdd00('0x29')]);_0x7ffd96['attributes']=_[_0xdd00('0x2c')](_0x380866[_0xdd00('0x28')],qs['fields'](_0x3b301e[_0xdd00('0x29')]['fields']));_0x7ffd96['attributes']=_0x7ffd96['attributes'][_0xdd00('0x2d')]?_0x7ffd96[_0xdd00('0x2e')]:_0x380866[_0xdd00('0x28')];if(!_0x3b301e['query'][_0xdd00('0x2f')]('nolimit')){_0x7ffd96[_0xdd00('0x18')]=qs[_0xdd00('0x18')](_0x3b301e[_0xdd00('0x29')][_0xdd00('0x18')]);_0x7ffd96['offset']=qs[_0xdd00('0x17')](_0x3b301e[_0xdd00('0x29')][_0xdd00('0x17')]);}_0x7ffd96[_0xdd00('0x30')]=qs[_0xdd00('0x31')](_0x3b301e['query'][_0xdd00('0x31')]);_0x7ffd96[_0xdd00('0x32')]=qs[_0xdd00('0x2b')](_[_0xdd00('0x33')](_0x3b301e[_0xdd00('0x29')],_0x380866[_0xdd00('0x2b')]),_0x349471);if(_0x3b301e[_0xdd00('0x29')][_0xdd00('0x34')]){_0x7ffd96[_0xdd00('0x32')]=_[_0xdd00('0x35')](_0x7ffd96[_0xdd00('0x32')],{'$or':_[_0xdd00('0x25')](_0x349471,function(_0x34f4c3){if(_0x34f4c3['type']!=='VIRTUAL'){var _0x4eb395={};_0x4eb395[_0x34f4c3['name']]={'$like':'%'+_0x3b301e[_0xdd00('0x29')]['filter']+'%'};return _0x4eb395;}})});}_0x7ffd96=_['merge']({},_0x7ffd96,_0x3b301e[_0xdd00('0x36')]);var _0x3fada9={'where':_0x7ffd96[_0xdd00('0x32')]};return db[_0xdd00('0x37')][_0xdd00('0x1a')](_0x3fada9)[_0xdd00('0x20')](function(_0x17752f){_0x15a398['count']=_0x17752f;if(_0x3b301e[_0xdd00('0x29')][_0xdd00('0x38')]){_0x7ffd96[_0xdd00('0x39')]=[{'all':!![]}];}return db[_0xdd00('0x37')][_0xdd00('0x3a')](_0x7ffd96);})[_0xdd00('0x20')](function(_0x34fc24){_0x15a398[_0xdd00('0x3b')]=_0x34fc24;return _0x15a398;})[_0xdd00('0x20')](respondWithFilteredResult(_0x2ce5c6,_0x7ffd96))[_0xdd00('0x3c')](handleError(_0x2ce5c6,null));};exports[_0xdd00('0x3d')]=function(_0x55dccc,_0x3dcaad){var _0x3f0040={'raw':!![],'where':{'id':_0x55dccc[_0xdd00('0x3e')]['id']}},_0x4a4bb8={};_0x4a4bb8['model']=_[_0xdd00('0x2a')](db[_0xdd00('0x37')][_0xdd00('0x26')]);_0x4a4bb8['query']=_['keys'](_0x55dccc[_0xdd00('0x29')]);_0x4a4bb8[_0xdd00('0x2b')]=_[_0xdd00('0x2c')](_0x4a4bb8[_0xdd00('0x28')],_0x4a4bb8['query']);_0x3f0040[_0xdd00('0x2e')]=_['intersection'](_0x4a4bb8[_0xdd00('0x28')],qs['fields'](_0x55dccc[_0xdd00('0x29')][_0xdd00('0x3f')]));_0x3f0040[_0xdd00('0x2e')]=_0x3f0040[_0xdd00('0x2e')][_0xdd00('0x2d')]?_0x3f0040['attributes']:_0x4a4bb8[_0xdd00('0x28')];if(_0x55dccc[_0xdd00('0x29')][_0xdd00('0x38')]){_0x3f0040[_0xdd00('0x39')]=[{'all':!![]}];}_0x3f0040=_[_0xdd00('0x35')]({},_0x3f0040,_0x55dccc[_0xdd00('0x36')]);return db[_0xdd00('0x37')][_0xdd00('0x40')](_0x3f0040)['then'](handleEntityNotFound(_0x3dcaad,null))['then'](respondWithResult(_0x3dcaad,null))[_0xdd00('0x3c')](handleError(_0x3dcaad,null));};exports['create']=function(_0x3f9e8b,_0x20500a){return db[_0xdd00('0x37')][_0xdd00('0x41')](_0x3f9e8b['body'],{})[_0xdd00('0x20')](respondWithResult(_0x20500a,0xc9))[_0xdd00('0x3c')](handleError(_0x20500a,null));};exports['update']=function(_0x265b19,_0x2388a3){if(_0x265b19[_0xdd00('0x42')]['id']){delete _0x265b19[_0xdd00('0x42')]['id'];}return db[_0xdd00('0x37')]['find']({'where':{'id':_0x265b19[_0xdd00('0x3e')]['id']}})[_0xdd00('0x20')](handleEntityNotFound(_0x2388a3,null))[_0xdd00('0x20')](saveUpdates(_0x265b19[_0xdd00('0x42')],null))[_0xdd00('0x20')](respondWithResult(_0x2388a3,null))[_0xdd00('0x3c')](handleError(_0x2388a3,null));};exports[_0xdd00('0x21')]=function(_0x1dec7d,_0x4e730e){return db[_0xdd00('0x37')][_0xdd00('0x40')]({'where':{'id':_0x1dec7d[_0xdd00('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e730e,null))[_0xdd00('0x20')](removeEntity(_0x4e730e,null))[_0xdd00('0x3c')](handleError(_0x4e730e,null));};exports[_0xdd00('0x43')]=function(_0x134c86,_0x1eeac0){return db[_0xdd00('0x37')][_0xdd00('0x43')]()[_0xdd00('0x20')](respondWithResult(_0x1eeac0,null))[_0xdd00('0x3c')](handleError(_0x1eeac0,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 137d9de..a39265f 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 _0xf8ea=['lodash','../../config/logger','api','moment','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid'];(function(_0x476705,_0x34fe4c){var _0x520734=function(_0x178f06){while(--_0x178f06){_0x476705['push'](_0x476705['shift']());}};_0x520734(++_0x34fe4c);}(_0xf8ea,0x197));var _0xaf8e=function(_0x178001,_0x5af99f){_0x178001=_0x178001-0x0;var _0x2e786e=_0xf8ea[_0x178001];return _0x2e786e;};'use strict';var _=require(_0xaf8e('0x0'));var util=require('util');var logger=require(_0xaf8e('0x1'))(_0xaf8e('0x2'));var moment=require(_0xaf8e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf8e('0x4'));var rimraf=require(_0xaf8e('0x5'));var config=require('../../config/environment');var attributes=require(_0xaf8e('0x6'));module[_0xaf8e('0x7')]=function(_0x2a337c,_0x5640b2){return _0x2a337c[_0xaf8e('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xaf8e('0x9'),'paranoid':![],'indexes':[{'name':_0xaf8e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ca=['bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x8d6ae0,_0x34531a){var _0x502eef=function(_0x1b5987){while(--_0x1b5987){_0x8d6ae0['push'](_0x8d6ae0['shift']());}};_0x502eef(++_0x34531a);}(_0xb7ca,0xd9));var _0xab7c=function(_0x74281b,_0x4c7de4){_0x74281b=_0x74281b-0x0;var _0xb3d601=_0xb7ca[_0x74281b];return _0xb3d601;};'use strict';var _=require(_0xab7c('0x0'));var util=require('util');var logger=require(_0xab7c('0x1'))(_0xab7c('0x2'));var moment=require(_0xab7c('0x3'));var BPromise=require(_0xab7c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab7c('0x5'));var rimraf=require(_0xab7c('0x6'));var config=require(_0xab7c('0x7'));var attributes=require(_0xab7c('0x8'));module['exports']=function(_0x49234e,_0x60700){return _0x49234e[_0xab7c('0x9')](_0xab7c('0xa'),attributes,{'tableName':_0xab7c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xab7c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cd9dfad..c049c36 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 _0x02b6=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2ec694,_0x4c93df){var _0x4955d0=function(_0xf1fb2a){while(--_0xf1fb2a){_0x2ec694['push'](_0x2ec694['shift']());}};_0x4955d0(++_0x4c93df);}(_0x02b6,0x16b));var _0x602b=function(_0x89b22a,_0x3d6a06){_0x89b22a=_0x89b22a-0x0;var _0x3a4ac7=_0x02b6[_0x89b22a];return _0x3a4ac7;};'use strict';var _=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var moment=require(_0x602b('0x2'));var BPromise=require(_0x602b('0x3'));var rs=require(_0x602b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x602b('0x5'));var logger=require(_0x602b('0x6'))(_0x602b('0x7'));var config=require(_0x602b('0x8'));var jayson=require(_0x602b('0x9'));var client=jayson['client'][_0x602b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49cc27,_0x116bbc,_0x50cb39){return new BPromise(function(_0x4ec13d,_0x2c7321){return client['request'](_0x49cc27,_0x50cb39)[_0x602b('0xb')](function(_0x4b9520){logger[_0x602b('0xc')](_0x602b('0xd'),_0x116bbc,_0x602b('0xe'));logger['debug'](_0x602b('0xf'),_0x116bbc,'request\x20sent',JSON[_0x602b('0x10')](_0x4b9520));if(_0x4b9520[_0x602b('0x11')]){if(_0x4b9520['error'][_0x602b('0x12')]===0x1f4){logger[_0x602b('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x116bbc,_0x4b9520['error']['message']);return _0x2c7321(_0x4b9520['error'][_0x602b('0x13')]);}logger['error'](_0x602b('0xd'),_0x116bbc,_0x4b9520[_0x602b('0x11')][_0x602b('0x13')]);return _0x4ec13d(_0x4b9520[_0x602b('0x11')][_0x602b('0x13')]);}else{logger[_0x602b('0xc')](_0x602b('0xd'),_0x116bbc,_0x602b('0xe'));_0x4ec13d(_0x4b9520['result'][_0x602b('0x13')]);}})[_0x602b('0x14')](function(_0x5e00b1){logger[_0x602b('0x11')](_0x602b('0xd'),_0x116bbc,_0x5e00b1);_0x2c7321(_0x5e00b1);});});} \ No newline at end of file +var _0x09c3=['rpc','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x567866,_0x3799f4){var _0x35d2cc=function(_0xadec8f){while(--_0xadec8f){_0x567866['push'](_0x567866['shift']());}};_0x35d2cc(++_0x3799f4);}(_0x09c3,0x13d));var _0x309c=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x09c3[_0x548627];return _0x844a84;};'use strict';var _=require(_0x309c('0x0'));var util=require(_0x309c('0x1'));var moment=require('moment');var BPromise=require(_0x309c('0x2'));var rs=require(_0x309c('0x3'));var fs=require('fs');var Redis=require(_0x309c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x309c('0x5'))(_0x309c('0x6'));var config=require('../../config/environment');var jayson=require(_0x309c('0x7'));var client=jayson[_0x309c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c463,_0x27f8da,_0x59fdd8){return new BPromise(function(_0x362715,_0x5e0c54){return client['request'](_0x14c463,_0x59fdd8)[_0x309c('0x9')](function(_0x3e76e1){logger[_0x309c('0xa')](_0x309c('0xb'),_0x27f8da,_0x309c('0xc'));logger[_0x309c('0xd')](_0x309c('0xe'),_0x27f8da,_0x309c('0xc'),JSON['stringify'](_0x3e76e1));if(_0x3e76e1[_0x309c('0xf')]){if(_0x3e76e1[_0x309c('0xf')]['code']===0x1f4){logger[_0x309c('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x27f8da,_0x3e76e1['error'][_0x309c('0x10')]);return _0x5e0c54(_0x3e76e1[_0x309c('0xf')]['message']);}logger[_0x309c('0xf')](_0x309c('0xb'),_0x27f8da,_0x3e76e1[_0x309c('0xf')]['message']);return _0x362715(_0x3e76e1[_0x309c('0xf')][_0x309c('0x10')]);}else{logger['info'](_0x309c('0xb'),_0x27f8da,'request\x20sent');_0x362715(_0x3e76e1[_0x309c('0x11')][_0x309c('0x10')]);}})[_0x309c('0x12')](function(_0x397998){logger[_0x309c('0xf')](_0x309c('0xb'),_0x27f8da,_0x397998);_0x5e0c54(_0x397998);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6ac1723..7aa1af1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bdc=['default','then','listen','start','info','exitCode','number','length','name','Online\x20apps:','filter','online','join','Offline\x20apps:','map','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB'];(function(_0x2d061c,_0x48e86c){var _0x2f1dfd=function(_0x38238c){while(--_0x38238c){_0x2d061c['push'](_0x2d061c['shift']());}};_0x2f1dfd(++_0x48e86c);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x349c76,_0x3729ba){_0x349c76=_0x349c76-0x0;var _0x5dd3bd=_0x6bdc[_0x349c76];return _0x5dd3bd;};'use strict';var _=require(_0xc6bd('0x0'));var db=require(_0xc6bd('0x1'))['db'];var seedDb=require(_0xc6bd('0x2'));var checkLicense=require(_0xc6bd('0x3'));var rpc=require(_0xc6bd('0x4'));var config=require(_0xc6bd('0x5'));var logger=require(_0xc6bd('0x6'))(_0xc6bd('0x7'));var pm2=require(_0xc6bd('0x8'));var pm2Config=require(_0xc6bd('0x9'));var schedule=require('./config/schedule');var chat=require(_0xc6bd('0xa'));var whatsapp=require(_0xc6bd('0xb'));var transcribe=require(_0xc6bd('0xc'));var provider=require(_0xc6bd('0xd'));function main(){return db[_0xc6bd('0xe')][_0xc6bd('0xf')]()['then'](function(){if(config[_0xc6bd('0x10')]){return seedDb[_0xc6bd('0x11')]();}})[_0xc6bd('0x12')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0xc6bd('0x13')]();})['then'](function(_0x3fdffe){logger['info'](_0x3fdffe);return chat[_0xc6bd('0x14')]();})[_0xc6bd('0x12')](function(){return whatsapp[_0xc6bd('0x14')]();})[_0xc6bd('0x12')](function(){return schedule[_0xc6bd('0x14')]();})[_0xc6bd('0x12')](function(){return transcribe[_0xc6bd('0x14')]();})[_0xc6bd('0x12')](function(){return provider[_0xc6bd('0x14')]();})[_0xc6bd('0x12')](function(_0xbfc32f){logger[_0xc6bd('0x15')](_0xbfc32f);return pm2[_0xc6bd('0x14')](pm2Config);})[_0xc6bd('0x12')](function(_0x54e9ce){var _0x3642bf=_0x54e9ce['filter'](function(_0x4c2a73){return typeof _0x4c2a73[_0xc6bd('0x16')]===_0xc6bd('0x17')&&_0x4c2a73[_0xc6bd('0x16')]>=0x0;});if(_0x3642bf[_0xc6bd('0x18')]>0x0){throw new Error(_0x3642bf[_0xc6bd('0x18')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3642bf,function(_0x40df04){return'\x22'+_0x40df04['pm2_env'][_0xc6bd('0x19')]+'\x22';}));}logger[_0xc6bd('0x15')](_0xc6bd('0x1a'),_['map'](_[_0xc6bd('0x1b')](_0x54e9ce,{'status':_0xc6bd('0x1c')}),_0xc6bd('0x19'))[_0xc6bd('0x1d')]());logger[_0xc6bd('0x15')](_0xc6bd('0x1e'),_[_0xc6bd('0x1f')](_[_0xc6bd('0x1b')](_0x54e9ce,function(_0x53c9a0){return _0x53c9a0[_0xc6bd('0x20')]!=='online';}),'name')['join']()||_0xc6bd('0x21'));console[_0xc6bd('0x22')](_0xc6bd('0x23'));})[_0xc6bd('0x24')](function(_0x232a6e){console['log'](_0xc6bd('0x25'),_0x232a6e);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x232a6e);process[_0xc6bd('0x26')](0x1);});}main(); \ No newline at end of file +var _0x09f4=['join','map','status','online','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','seedDB','default','start','info','filter','exitCode','number','length','name','Online\x20apps:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x09f4,0xe4));var _0x409f=function(_0x1e35fd,_0x2205bd){_0x1e35fd=_0x1e35fd-0x0;var _0xdf57bd=_0x09f4[_0x1e35fd];return _0xdf57bd;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x409f('0x0'));var checkLicense=require(_0x409f('0x1'));var rpc=require(_0x409f('0x2'));var config=require(_0x409f('0x3'));var logger=require(_0x409f('0x4'))(_0x409f('0x5'));var pm2=require(_0x409f('0x6'));var pm2Config=require(_0x409f('0x7'));var schedule=require(_0x409f('0x8'));var chat=require(_0x409f('0x9'));var whatsapp=require(_0x409f('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x409f('0xb')][_0x409f('0xc')]()[_0x409f('0xd')](function(){if(config[_0x409f('0xe')]){return seedDb[_0x409f('0xf')]();}})[_0x409f('0xd')](function(){return checkLicense[_0x409f('0xf')]();})[_0x409f('0xd')](function(){return rpc['listen']();})[_0x409f('0xd')](function(_0x4a8658){logger['info'](_0x4a8658);return chat[_0x409f('0x10')]();})[_0x409f('0xd')](function(){return whatsapp[_0x409f('0x10')]();})['then'](function(){return schedule['start']();})[_0x409f('0xd')](function(){return transcribe[_0x409f('0x10')]();})[_0x409f('0xd')](function(){return provider[_0x409f('0x10')]();})[_0x409f('0xd')](function(_0x3234c3){logger[_0x409f('0x11')](_0x3234c3);return pm2['start'](pm2Config);})[_0x409f('0xd')](function(_0x55e557){var _0x3ec157=_0x55e557[_0x409f('0x12')](function(_0x5edeaf){return typeof _0x5edeaf[_0x409f('0x13')]===_0x409f('0x14')&&_0x5edeaf[_0x409f('0x13')]>=0x0;});if(_0x3ec157[_0x409f('0x15')]>0x0){throw new Error(_0x3ec157[_0x409f('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3ec157,function(_0x54b98a){return'\x22'+_0x54b98a['pm2_env'][_0x409f('0x16')]+'\x22';}));}logger[_0x409f('0x11')](_0x409f('0x17'),_['map'](_[_0x409f('0x12')](_0x55e557,{'status':'online'}),_0x409f('0x16'))[_0x409f('0x18')]());logger['info']('Offline\x20apps:',_[_0x409f('0x19')](_['filter'](_0x55e557,function(_0x4098f3){return _0x4098f3[_0x409f('0x1a')]!==_0x409f('0x1b');}),'name')[_0x409f('0x18')]()||_0x409f('0x1c'));console['log'](_0x409f('0x1d'));})[_0x409f('0x1e')](function(_0x477c97){console[_0x409f('0x1f')](_0x409f('0x20'),_0x477c97);logger[_0x409f('0x21')](_0x409f('0x22'),_0x477c97);process[_0x409f('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d8b1079..878ed5e 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 _0xb7e7=['join','promisify','secret','payload','options','verify','hex','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','Basic','User','authenticate','pass','Wrong\x20credentials.','user','startsWith','Bearer','query','apikey','getUuid','then','find','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','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','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','unshift'];(function(_0xae7bc4,_0x355383){var _0x2155cb=function(_0x511743){while(--_0x511743){_0xae7bc4['push'](_0xae7bc4['shift']());}};_0x2155cb(++_0x355383);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'use strict';var db=require(_0x7b7e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x7b7e('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x7b7e('0x2'));var _=require('lodash');var jwt=require(_0x7b7e('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x7b7e('0x4'));var basicAuth=require(_0x7b7e('0x5'));var crypto=require(_0x7b7e('0x6'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0x7b7e('0x7'));var validateJwt=expressJwt({'secret':config[_0x7b7e('0x8')][_0x7b7e('0x9')]});var userAttributes=['id','role',_0x7b7e('0xa'),_0x7b7e('0xb'),_0x7b7e('0xc'),_0x7b7e('0xd'),_0x7b7e('0xe'),_0x7b7e('0xf'),_0x7b7e('0x10'),'voicePause',_0x7b7e('0x11'),_0x7b7e('0x12'),_0x7b7e('0x13'),_0x7b7e('0x14'),_0x7b7e('0x15'),_0x7b7e('0x16'),_0x7b7e('0x17'),_0x7b7e('0x18'),_0x7b7e('0x19'),'crudPermissions',_0x7b7e('0x1a'),_0x7b7e('0x1b'),'alias',_0x7b7e('0x1c'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x7b7e('0x1d'),_0x7b7e('0x1e'),_0x7b7e('0x1f'),_0x7b7e('0x20'),_0x7b7e('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x7b7e('0x22'),_0x7b7e('0x23'),_0x7b7e('0x24'),_0x7b7e('0x25'),_0x7b7e('0x26'),_0x7b7e('0x27'),_0x7b7e('0x28'),_0x7b7e('0x29'),_0x7b7e('0x2a'),_0x7b7e('0x2b'),_0x7b7e('0x2c'),_0x7b7e('0x2d'),_0x7b7e('0x2e'),_0x7b7e('0x2f'),_0x7b7e('0x30'),_0x7b7e('0x31'),_0x7b7e('0x32'),'openchannelAutoanswer',_0x7b7e('0x33'),_0x7b7e('0x34'),_0x7b7e('0x35'),'whatsappAutoanswer',_0x7b7e('0x36'),_0x7b7e('0x37')];exports[_0x7b7e('0x38')]=function(){return this[_0x7b7e('0x39')](!![])[_0x7b7e('0x3a')](function(_0x303d8c,_0x28bf43,_0x10a66a){if(_0x303d8c['user']){_0x10a66a();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x303d8c[_0x7b7e('0x3b')]['id']},'attributes':['id',_0x7b7e('0x3c'),_0x7b7e('0x3d')],'raw':!![]})['then'](function(_0x51d3b1){if(_0x51d3b1&&_0x51d3b1['closed']){return _0x28bf43[_0x7b7e('0x3e')](_0x51d3b1[_0x7b7e('0x3d')]===_0x7b7e('0x3f')?0x195:0x193)[_0x7b7e('0x40')]({'message':_0x51d3b1[_0x7b7e('0x3d')]==='unmanaged'?_0x7b7e('0x41'):_0x7b7e('0x42')});}else{_0x10a66a();}})['catch'](function(_0x57b9da){_0x10a66a(_0x57b9da);});}});};exports['isAuthenticated']=function isAuthenticated(_0x12ef0b){return compose()[_0x7b7e('0x3a')](function(_0x503625,_0x3db8c4,_0x51d4b5){var _0x1b4341;if(_0x503625[_0x7b7e('0x43')][_0x7b7e('0x44')]){if(_['startsWith'](_0x503625[_0x7b7e('0x43')][_0x7b7e('0x44')],_0x7b7e('0x45'))){var _0x326dd2=basicAuth(_0x503625);db[_0x7b7e('0x46')]['find']({'where':{'name':_0x326dd2[_0x7b7e('0xb')]}})['then'](function(_0x23a453){if(!_0x23a453||!_0x23a453[_0x7b7e('0x47')](_0x326dd2[_0x7b7e('0x48')])){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x49')});}_0x503625[_0x7b7e('0x4a')]={'id':_0x23a453['id']};_0x51d4b5();})['catch'](function(_0x5227a7){_0x51d4b5(_0x5227a7);});}else if(_[_0x7b7e('0x4b')](_0x503625[_0x7b7e('0x43')]['authorization'],_0x7b7e('0x4c'))){validateJwt(_0x503625,_0x3db8c4,_0x51d4b5);}else{if(_0x12ef0b){_0x51d4b5();}else{return _0x3db8c4[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x503625[_0x7b7e('0x4d')][_0x7b7e('0x4e')]){try{var _0x187184={'audience':hardwareConf[_0x7b7e('0x4f')](),'issuer':hardwareConf[_0x7b7e('0x4f')]()};verifyJwt(_0x503625[_0x7b7e('0x4d')][_0x7b7e('0x4e')],_0x187184)[_0x7b7e('0x50')](function(_0x44497c){return db[_0x7b7e('0x46')][_0x7b7e('0x51')]({'where':{'id':_0x44497c[_0x7b7e('0x52')]}})[_0x7b7e('0x50')](function(_0xdcb8ef){_0x1b4341=_0xdcb8ef;return db[_0x7b7e('0x53')][_0x7b7e('0x54')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7b7e('0x55')],'raw':!![]});})[_0x7b7e('0x50')](function(_0xb20532){if(!_0x1b4341||!_[_0x7b7e('0x56')](_0x1b4341[_0x7b7e('0x57')],_0x44497c[_0x7b7e('0x58')])){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x59')});}if(_0x1b4341[_0x7b7e('0x5a')]){return _0x3db8c4['status'](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});}if(_0x1b4341[_0x7b7e('0x5c')]){if(_0xb20532[_0x7b7e('0x55')]>0x0){if(moment(_0x1b4341['blockedAt'])[_0x7b7e('0x5d')](_0xb20532[_0x7b7e('0x55')],_0x7b7e('0x5e'))>moment()){return _0x3db8c4['status'](0x191)['json']({'message':_0x7b7e('0x5b')});}}else{return _0x3db8c4['status'](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});}}_0x503625['user']={'id':_0x1b4341['id']};_0x51d4b5();});})[_0x7b7e('0x5f')](function(){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});});}catch(_0x38d32f){_0x51d4b5(_0x38d32f);}}else if(_0x12ef0b){_0x51d4b5();}else{return _0x3db8c4[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':_0x7b7e('0x60')});}})[_0x7b7e('0x3a')](function(_0x525a74,_0x5d61c1,_0x25b41e){if(_0x525a74['user']){db[_0x7b7e('0x46')]['find']({'where':{'id':_0x525a74['user']['id']},'attributes':userAttributes})[_0x7b7e('0x50')](function(_0x48252a){if(!_0x48252a){return _0x5d61c1[_0x7b7e('0x3e')](0x194)['json']({'message':_0x7b7e('0x61')});}_0x525a74[_0x7b7e('0x4a')]=_0x48252a;_0x25b41e();})[_0x7b7e('0x5f')](function(_0x231fdf){_0x25b41e(_0x231fdf);});}else if(_0x12ef0b){_0x25b41e();}else{return _0x5d61c1['status'](0x194)[_0x7b7e('0x40')]({'message':_0x7b7e('0x62')});}});};exports[_0x7b7e('0x63')]=function canUpdate(){return compose()[_0x7b7e('0x3a')](function(_0x3e4f21,_0xccdfc7,_0x5e8572){return licenseUtil['getLicense']()['then'](function(_0xc5280c){if(_0xc5280c[_0x7b7e('0x64')]){_0x5e8572();}else{return _0xccdfc7[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':_0x7b7e('0x65')});}})[_0x7b7e('0x5f')](function(_0x57380f){_0x5e8572(_0x57380f);});});};exports[_0x7b7e('0x66')]=function isWebrtcLicence(){return compose()[_0x7b7e('0x3a')](function(_0x5a0832,_0x5efcb8,_0x1dcb88){return licenseUtil[_0x7b7e('0x67')]()[_0x7b7e('0x50')](function(_0x378a29){if(_0x378a29[_0x7b7e('0x68')]){_0x1dcb88();}else{return _0x5efcb8[_0x7b7e('0x3e')](0x193)['json']({'message':_0x7b7e('0x65')});}})['catch'](function(_0x402793){_0x1dcb88(_0x402793);});});};exports[_0x7b7e('0x69')]=function(_0x2ea2b2,_0x5874e2,_0x58e4e6){_0x2ea2b2[_0x7b7e('0x69')]=!![];return _0x58e4e6();};exports[_0x7b7e('0x6a')]=function signToken(_0x45e0cf){return signJwt(_0x45e0cf);};exports[_0x7b7e('0x6b')]=function(_0x1f9d0f,_0x5cce7c){if(!_0x1f9d0f[_0x7b7e('0x4a')]){return _0x5cce7c[_0x7b7e('0x3e')](0x194)[_0x7b7e('0x40')]({'message':_0x7b7e('0x6c')});}var _0x4767f0={'payload':{'id':_0x1f9d0f['user']['id'],'role':_0x1f9d0f[_0x7b7e('0x4a')][_0x7b7e('0x6d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4767f0)[_0x7b7e('0x50')](function(_0x3280fa){_0x5cce7c[_0x7b7e('0x6e')](_0x7b7e('0x6f'),_0x3280fa);_0x5cce7c[_0x7b7e('0x70')]('/dashboards/general');})[_0x7b7e('0x5f')](function(_0x5d7c89){return _0x5cce7c[_0x7b7e('0x3e')](0x1f4)[_0x7b7e('0x71')](_0x5d7c89);});};exports['retrieveApiKey']=function(_0x36f1be){if(_[_0x7b7e('0x72')](_0x36f1be[_0x7b7e('0x57')])||_[_0x7b7e('0x72')](_0x36f1be[_0x7b7e('0x73')])){return null;}else{return createJwt(_0x36f1be);}};exports[_0x7b7e('0x74')]=function(_0x337d06){_0x337d06['apiKeyNonce']=generateNonce();_0x337d06[_0x7b7e('0x73')]=generateIssuedAt();return createJwt(_0x337d06);};exports[_0x7b7e('0x75')]=function(_0x96752e,_0x24481a){var _0x5b9ab5=_0x96752e['query']['apikey'];if(_0x5b9ab5){var _0x2471ad={'nonce':_0x24481a[_0x7b7e('0x57')],'iat':_0x24481a[_0x7b7e('0x73')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5b9ab5,_0x2471ad)[_0x7b7e('0x50')](function(){return generateApiKey(_0x24481a);});}else{throw{'message':_0x7b7e('0x76')};}};exports['validatePasswordPattern']=function(_0xf54f87){var _0xbe02ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xbe02ed[_0x7b7e('0x77')](_0xf54f87))throw new db['Sequelize'][(_0x7b7e('0x78'))](_0x7b7e('0x79'));return;};exports['validatePasswordHistory']=function(_0x25c933,_0x441c3c,_0x1d7db1){var _0x267aef=encryptor[_0x7b7e('0x7a')](_0x441c3c)[_0x7b7e('0x7b')](',');for(var _0x39eaf8=0x0;_0x39eaf8<_0x1d7db1;_0x39eaf8++){if(!_0x267aef[_0x39eaf8])break;if(_0x25c933[_0x7b7e('0x7c')]()===_0x267aef[_0x39eaf8][_0x7b7e('0x7c')]()){var _0x5509ad=util[_0x7b7e('0x7d')](_0x7b7e('0x7e'),_0x1d7db1);if(_0x1d7db1===0x1){_0x5509ad='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x7b7e('0x7f'))][(_0x7b7e('0x78'))](_0x5509ad);}}return;};exports[_0x7b7e('0x80')]=function(_0x59f2df,_0x1729e0){var _0x4fc349=_0x1729e0?encryptor[_0x7b7e('0x7a')](_0x1729e0)[_0x7b7e('0x7b')](','):[];if(_0x4fc349['length']===0x5){_0x4fc349[_0x7b7e('0x81')](-0x1,0x1);}_0x4fc349[_0x7b7e('0x82')](_0x59f2df);return encryptor['encryptString'](_0x4fc349[_0x7b7e('0x83')](','));};function signJwt(_0x369103){var _0x1d43af=BPromise[_0x7b7e('0x84')](jwt['sign'],{'context':jwt});var _0x101896=_0x369103[_0x7b7e('0x85')]||config[_0x7b7e('0x8')][_0x7b7e('0x9')];return new BPromise(function(_0x2dc7ad,_0x1b97d6){_0x1d43af(_0x369103[_0x7b7e('0x86')],_0x101896,_0x369103[_0x7b7e('0x87')])[_0x7b7e('0x50')](function(_0x13c676){_0x2dc7ad(_0x13c676);})['catch'](function(_0x191179){_0x1b97d6(_0x191179);});});}function verifyJwt(_0x5dde68,_0x53e2f7,_0x2b105a){var _0x7cbe6c=BPromise[_0x7b7e('0x84')](jwt[_0x7b7e('0x88')],{'context':jwt});var _0x5cd4ae=_0x2b105a||config[_0x7b7e('0x8')][_0x7b7e('0x9')];return new BPromise(function(_0x3f2825,_0x3d4b2d){_0x7cbe6c(_0x5dde68,_0x5cd4ae,_0x53e2f7)[_0x7b7e('0x50')](function(_0x2b2afd){_0x3f2825(_0x2b2afd);})['catch'](function(_0x1ebd58){_0x3d4b2d(_0x1ebd58);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x7b7e('0x89'));}function generateIssuedAt(){return Math['floor'](Date[_0x7b7e('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x3c3d29){var _0x148dde={'payload':{'iat':_0x3c3d29['apiKeyIat'],'nonce':_0x3c3d29[_0x7b7e('0x57')]},'options':{'algorithm':_0x7b7e('0x8b'),'subject':_0x3c3d29['id']['toString'](),'issuer':hardwareConf[_0x7b7e('0x4f')](),'audience':hardwareConf[_0x7b7e('0x4f')]()}};return signJwt(_0x148dde)[_0x7b7e('0x50')](function(_0x430033){return{'iat':_0x3c3d29[_0x7b7e('0x73')],'nonce':_0x3c3d29[_0x7b7e('0x57')],'token':_0x430033};});} \ No newline at end of file +var _0x3423=['session','role','fullname','name','internal','email','md5secret','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','pass','status','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','secret','payload','options','verify','randomBytes','floor','now','toString','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets'];(function(_0x484bb6,_0x262d47){var _0x211d8e=function(_0x113ca8){while(--_0x113ca8){_0x484bb6['push'](_0x484bb6['shift']());}};_0x211d8e(++_0x262d47);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x3342('0x0'));var licenseUtil=require(_0x3342('0x1'));var encryptor=require(_0x3342('0x2'));var _=require(_0x3342('0x3'));var jwt=require(_0x3342('0x4'));var expressJwt=require(_0x3342('0x5'));var compose=require(_0x3342('0x6'));var basicAuth=require(_0x3342('0x7'));var crypto=require(_0x3342('0x8'));var BPromise=require(_0x3342('0x9'));var util=require(_0x3342('0xa'));var moment=require(_0x3342('0xb'));var validateJwt=expressJwt({'secret':config[_0x3342('0xc')][_0x3342('0xd')]});var userAttributes=['id',_0x3342('0xe'),_0x3342('0xf'),_0x3342('0x10'),_0x3342('0x11'),_0x3342('0x12'),'userpic','permissions',_0x3342('0x13'),'voicePause','chatPause','mailPause','faxPause',_0x3342('0x14'),_0x3342('0x15'),'pauseType',_0x3342('0x16'),'lastLoginAt',_0x3342('0x17'),_0x3342('0x18'),'allowmessenger',_0x3342('0x19'),_0x3342('0x1a'),_0x3342('0x1b'),_0x3342('0x1c'),_0x3342('0x1d'),_0x3342('0x1e'),_0x3342('0x1f'),'phoneBarEnableSettings',_0x3342('0x20'),_0x3342('0x21'),'phoneBarRemoteControl',_0x3342('0x22'),_0x3342('0x23'),'interface','userProfileId',_0x3342('0x24'),_0x3342('0x25'),_0x3342('0x26'),_0x3342('0x27'),_0x3342('0x28'),_0x3342('0x29'),_0x3342('0x2a'),_0x3342('0x2b'),_0x3342('0x2c'),'chatAutoanswerDelay',_0x3342('0x2d'),_0x3342('0x2e'),_0x3342('0x2f'),'smsAutoanswerDelay',_0x3342('0x30'),_0x3342('0x31'),'faxAutoanswer',_0x3342('0x32'),_0x3342('0x33'),'whatsappAutoanswerDelay',_0x3342('0x34')];exports['isChatInteractionAuthorized']=function(){return this[_0x3342('0x35')](!![])[_0x3342('0x36')](function(_0xa23053,_0x2dbad1,_0xd2b87d){if(_0xa23053[_0x3342('0x37')]){_0xd2b87d();}else{return db[_0x3342('0x38')][_0x3342('0x39')]({'where':{'id':_0xa23053['params']['id']},'attributes':['id',_0x3342('0x3a'),'disposition'],'raw':!![]})['then'](function(_0x986ab0){if(_0x986ab0&&_0x986ab0['closed']){return _0x2dbad1['status'](_0x986ab0[_0x3342('0x3b')]==='unmanaged'?0x195:0x193)[_0x3342('0x3c')]({'message':_0x986ab0['disposition']==='unmanaged'?'Unmanaged.':_0x3342('0x3d')});}else{_0xd2b87d();}})[_0x3342('0x3e')](function(_0x1dd607){_0xd2b87d(_0x1dd607);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc275a1){return compose()[_0x3342('0x36')](function(_0x1cc542,_0x272a52,_0x4fbfb7){var _0x27e25b;if(_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')]){if(_[_0x3342('0x41')](_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')],_0x3342('0x42'))){var _0x47b2a0=basicAuth(_0x1cc542);db[_0x3342('0x43')]['find']({'where':{'name':_0x47b2a0[_0x3342('0x10')]}})[_0x3342('0x44')](function(_0x508f87){if(!_0x508f87||!_0x508f87[_0x3342('0x45')](_0x47b2a0[_0x3342('0x46')])){return _0x272a52[_0x3342('0x47')](0x191)[_0x3342('0x3c')]({'message':'Wrong\x20credentials.'});}_0x1cc542[_0x3342('0x37')]={'id':_0x508f87['id']};_0x4fbfb7();})[_0x3342('0x3e')](function(_0x311cfe){_0x4fbfb7(_0x311cfe);});}else if(_[_0x3342('0x41')](_0x1cc542[_0x3342('0x3f')][_0x3342('0x40')],_0x3342('0x48'))){validateJwt(_0x1cc542,_0x272a52,_0x4fbfb7);}else{if(_0xc275a1){_0x4fbfb7();}else{return _0x272a52[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':_0x3342('0x49')});}}}else if(_0x1cc542[_0x3342('0x4a')][_0x3342('0x4b')]){try{var _0x5aea96={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3342('0x4c')]()};verifyJwt(_0x1cc542['query'][_0x3342('0x4b')],_0x5aea96)[_0x3342('0x44')](function(_0x1a74d3){return db[_0x3342('0x43')][_0x3342('0x4d')]({'where':{'id':_0x1a74d3[_0x3342('0x4e')]}})[_0x3342('0x44')](function(_0x5d460c){_0x27e25b=_0x5d460c;return db[_0x3342('0x4f')][_0x3342('0x39')]({'where':{'id':0x1},'attributes':[_0x3342('0x50'),_0x3342('0x51')],'raw':!![]});})[_0x3342('0x44')](function(_0x5bd5eb){if(!_0x27e25b||!_[_0x3342('0x52')](_0x27e25b['apiKeyNonce'],_0x1a74d3[_0x3342('0x53')])){return _0x272a52[_0x3342('0x47')](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x54')});}if(_0x27e25b['disabled']){return _0x272a52[_0x3342('0x47')](0x191)['json']({'message':_0x3342('0x55')});}if(_0x27e25b[_0x3342('0x56')]){if(_0x5bd5eb[_0x3342('0x51')]>0x0){if(moment(_0x27e25b[_0x3342('0x57')])[_0x3342('0x58')](_0x5bd5eb[_0x3342('0x51')],_0x3342('0x59'))>moment()){return _0x272a52['status'](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x55')});}}else{return _0x272a52['status'](0x191)[_0x3342('0x3c')]({'message':_0x3342('0x55')});}}_0x1cc542['user']={'id':_0x27e25b['id']};_0x4fbfb7();});})[_0x3342('0x3e')](function(){return _0x272a52[_0x3342('0x47')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5acb74){_0x4fbfb7(_0x5acb74);}}else if(_0xc275a1){_0x4fbfb7();}else{return _0x272a52[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})[_0x3342('0x36')](function(_0x2a1f7e,_0x2944ab,_0x17fd01){if(_0x2a1f7e[_0x3342('0x37')]){db[_0x3342('0x43')][_0x3342('0x4d')]({'where':{'id':_0x2a1f7e[_0x3342('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5a787b){if(!_0x5a787b){return _0x2944ab[_0x3342('0x47')](0x194)[_0x3342('0x3c')]({'message':_0x3342('0x5a')});}_0x2a1f7e[_0x3342('0x37')]=_0x5a787b;_0x17fd01();})[_0x3342('0x3e')](function(_0x414fcb){_0x17fd01(_0x414fcb);});}else if(_0xc275a1){_0x17fd01();}else{return _0x2944ab['status'](0x194)[_0x3342('0x3c')]({'message':_0x3342('0x5b')});}});};exports[_0x3342('0x5c')]=function canUpdate(){return compose()[_0x3342('0x36')](function(_0x64e352,_0x365d6f,_0x5e2c66){return licenseUtil[_0x3342('0x5d')]()['then'](function(_0x6090bd){if(_0x6090bd[_0x3342('0x5e')]){_0x5e2c66();}else{return _0x365d6f[_0x3342('0x47')](0x193)[_0x3342('0x3c')]({'message':'Forbidden'});}})[_0x3342('0x3e')](function(_0x16e970){_0x5e2c66(_0x16e970);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x3342('0x36')](function(_0x302159,_0x169549,_0x16cebb){return licenseUtil['getLicense']()[_0x3342('0x44')](function(_0x2453a9){if(_0x2453a9['webrtc']){_0x16cebb();}else{return _0x169549[_0x3342('0x47')](0x193)['json']({'message':'Forbidden'});}})[_0x3342('0x3e')](function(_0x706154){_0x16cebb(_0x706154);});});};exports[_0x3342('0x5f')]=function(_0x296cbb,_0x23925e,_0x171387){_0x296cbb[_0x3342('0x5f')]=!![];return _0x171387();};exports['signToken']=function signToken(_0x4e6be0){return signJwt(_0x4e6be0);};exports[_0x3342('0x60')]=function(_0x5a9e40,_0x26251c){if(!_0x5a9e40['user']){return _0x26251c['status'](0x194)['json']({'message':_0x3342('0x61')});}var _0x23f623={'payload':{'id':_0x5a9e40[_0x3342('0x37')]['id'],'role':_0x5a9e40[_0x3342('0x37')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x23f623)[_0x3342('0x44')](function(_0x3a6597){_0x26251c['cookie'](_0x3342('0x62'),_0x3a6597);_0x26251c[_0x3342('0x63')](_0x3342('0x64'));})['catch'](function(_0x189b68){return _0x26251c[_0x3342('0x47')](0x1f4)[_0x3342('0x65')](_0x189b68);});};exports[_0x3342('0x66')]=function(_0x250e6a){if(_['isNil'](_0x250e6a[_0x3342('0x67')])||_[_0x3342('0x68')](_0x250e6a[_0x3342('0x69')])){return null;}else{return createJwt(_0x250e6a);}};exports[_0x3342('0x6a')]=function(_0x16d966){_0x16d966[_0x3342('0x67')]=generateNonce();_0x16d966[_0x3342('0x69')]=generateIssuedAt();return createJwt(_0x16d966);};exports[_0x3342('0x6b')]=function(_0x16a4be,_0x542181){var _0x218181=_0x16a4be['query'][_0x3342('0x4b')];if(_0x218181){var _0x524fb6={'nonce':_0x542181['apiKeyNonce'],'iat':_0x542181['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3342('0x4c')]()};return verifyJwt(_0x218181,_0x524fb6)[_0x3342('0x44')](function(){return generateApiKey(_0x542181);});}else{throw{'message':_0x3342('0x6c')};}};exports[_0x3342('0x6d')]=function(_0x3d9be7){var _0x163d76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x163d76[_0x3342('0x6e')](_0x3d9be7))throw new db[(_0x3342('0x6f'))][(_0x3342('0x70'))](_0x3342('0x71'));return;};exports[_0x3342('0x72')]=function(_0x561812,_0x47d138,_0x11719c){var _0x53e54b=encryptor[_0x3342('0x73')](_0x47d138)['split'](',');for(var _0x4c777e=0x0;_0x4c777e<_0x11719c;_0x4c777e++){if(!_0x53e54b[_0x4c777e])break;if(_0x561812[_0x3342('0x74')]()===_0x53e54b[_0x4c777e][_0x3342('0x74')]()){var _0x16e692=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x11719c);if(_0x11719c===0x1){_0x16e692=_0x3342('0x75');}throw new db[(_0x3342('0x6f'))]['ValidationError'](_0x16e692);}}return;};exports[_0x3342('0x76')]=function(_0x219a17,_0x372af5){var _0x4d3660=_0x372af5?encryptor[_0x3342('0x73')](_0x372af5)[_0x3342('0x77')](','):[];if(_0x4d3660[_0x3342('0x78')]===0x5){_0x4d3660[_0x3342('0x79')](-0x1,0x1);}_0x4d3660[_0x3342('0x7a')](_0x219a17);return encryptor[_0x3342('0x7b')](_0x4d3660[_0x3342('0x7c')](','));};function signJwt(_0x57942a){var _0x4bc9a9=BPromise[_0x3342('0x7d')](jwt['sign'],{'context':jwt});var _0x25fa01=_0x57942a[_0x3342('0x7e')]||config[_0x3342('0xc')][_0x3342('0xd')];return new BPromise(function(_0xe9b979,_0x5d8a9d){_0x4bc9a9(_0x57942a[_0x3342('0x7f')],_0x25fa01,_0x57942a[_0x3342('0x80')])['then'](function(_0x14e56b){_0xe9b979(_0x14e56b);})[_0x3342('0x3e')](function(_0x10842c){_0x5d8a9d(_0x10842c);});});}function verifyJwt(_0x2858a6,_0x1ba552,_0x3a82c8){var _0x19fcc5=BPromise[_0x3342('0x7d')](jwt[_0x3342('0x81')],{'context':jwt});var _0x36eec8=_0x3a82c8||config[_0x3342('0xc')][_0x3342('0xd')];return new BPromise(function(_0x3b01a3,_0x58cbdd){_0x19fcc5(_0x2858a6,_0x36eec8,_0x1ba552)['then'](function(_0x146ffc){_0x3b01a3(_0x146ffc);})[_0x3342('0x3e')](function(_0x14193b){_0x58cbdd(_0x14193b);});});}function generateNonce(){return crypto[_0x3342('0x82')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x3342('0x83')](Date[_0x3342('0x84')]()/0x3e8)[_0x3342('0x85')]();}function createJwt(_0x2aed01){var _0xbc9035={'payload':{'iat':_0x2aed01[_0x3342('0x69')],'nonce':_0x2aed01[_0x3342('0x67')]},'options':{'algorithm':_0x3342('0x86'),'subject':_0x2aed01['id'][_0x3342('0x85')](),'issuer':hardwareConf[_0x3342('0x4c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xbc9035)[_0x3342('0x44')](function(_0x5e2ff3){return{'iat':_0x2aed01[_0x3342('0x69')],'nonce':_0x2aed01[_0x3342('0x67')],'token':_0x5e2ff3};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3b6737b..1c004a2 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 _0xb9d3=['count','User','clause','rows','catch','CmContact','describe','keys','cf_','CmCustomField','findOne','all','length','fieldType','type','map','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts'];(function(_0x3bd146,_0x39d7a7){var _0x3578a6=function(_0x552de5){while(--_0x552de5){_0x3bd146['push'](_0x3bd146['shift']());}};_0x3578a6(++_0x39d7a7);}(_0xb9d3,0x191));var _0x3b9d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb9d3[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x3b9d('0x0'))['db'];exports[_0x3b9d('0x1')]=function(_0x33a429,_0x137769,_0x6726f2,_0x5c223c){var _0x5d452c={'count':0x0,'rows':[]};var _0x26b298=sqlUtils[_0x3b9d('0x2')](_0x137769,_0x33a429);if(_0x26b298){return Promise['resolve'](_0x5d452c);}var _0x954de8=sqlUtils['getContactsSubquery']();var _0x2b8fe9={};var _0x50cdd5=![];var _0x231fac=![];return Promise[_0x3b9d('0x3')]()[_0x3b9d('0x4')](function(){if(_0x33a429[_0x3b9d('0x5')]){return sqlUtils[_0x3b9d('0x6')](_0x33a429[_0x3b9d('0x5')],_0x5c223c);}else{return sqlUtils[_0x3b9d('0x7')](_0x33a429,_0x5c223c);}})[_0x3b9d('0x4')](function(_0x1a48b2){_0x954de8[_0x3b9d('0x8')](_0x1a48b2[_0x3b9d('0x9')]);_0x954de8[_0x3b9d('0x8')](_0x1a48b2[_0x3b9d('0xa')]);_0x954de8['where'](_0x1a48b2[_0x3b9d('0xb')]);_0x954de8[_0x3b9d('0x8')](_0x1a48b2[_0x3b9d('0xc')]['clause']);_0x2b8fe9=_0x1a48b2[_0x3b9d('0xd')];_0x231fac=_0x1a48b2['user'][_0x3b9d('0xe')];return sqlUtils[_0x3b9d('0xf')](_0x137769,_0x33a429,_0x231fac);})[_0x3b9d('0x4')](function(_0x123bc5){_0x954de8[_0x3b9d('0x8')](_0x123bc5);var _0x4c22a5=_0x33a429[_0x3b9d('0x5')]?_0x2b8fe9[_0x3b9d('0x10')]:_0x33a429[_0x3b9d('0x11')];_0x50cdd5=_0x4c22a5?!![]:![];return sqlUtils[_0x3b9d('0x12')](_0x954de8,_0x4c22a5);})['then'](function(_0x403dec){_0x5d452c[_0x3b9d('0x13')]=_0x403dec;if(_0x5d452c[_0x3b9d('0x13')]===0x0){return;}if(_0x33a429[_0x3b9d('0x14')]){_0x231fac=!![];}return sqlUtils['buildContactsQuery'](_0x954de8,_0x33a429['fields'],_0x6726f2,_0x50cdd5,_0x2b8fe9[_0x3b9d('0x15')],_0x231fac);})[_0x3b9d('0x4')](function(_0x30ce5d){if(!_0x30ce5d){return[];}return sqlUtils['getFilteredContacts'](_0x30ce5d,_0x33a429,_0x6726f2);})[_0x3b9d('0x4')](function(_0x4574bf){_0x5d452c[_0x3b9d('0x16')]=_0x4574bf;return _0x5d452c;})[_0x3b9d('0x17')](function(_0x278281){throw _0x278281;});};exports['describe']=function(){var _0x5ba829={};var _0x3e1094=[];return db[_0x3b9d('0x18')][_0x3b9d('0x19')]()[_0x3b9d('0x4')](function(_0xe3ebe3){_0x5ba829=_0xe3ebe3;var _0x46c41d=Object[_0x3b9d('0x1a')](_0x5ba829)['filter'](function(_0x13e7a1){return _['startsWith'](_0x13e7a1,_0x3b9d('0x1b'))?_0x13e7a1:undefined;});var _0x2250b6=_0x46c41d['map'](function(_0x22e206){return db[_0x3b9d('0x1c')][_0x3b9d('0x1d')]({'where':{'id':_0x22e206['slice'](0x3)},'raw':!![]});});return Promise[_0x3b9d('0x1e')](_0x2250b6);})['then'](function(_0x4d3d13){for(var _0x45952a=0x0;_0x45952a<_0x4d3d13[_0x3b9d('0x1f')];_0x45952a++){if(_0x4d3d13[_0x45952a]){var _0x68ff4c=_0x3b9d('0x1b')+_0x4d3d13[_0x45952a]['id'];_0x5ba829[_0x68ff4c][_0x3b9d('0x20')]=_0x4d3d13[_0x45952a][_0x3b9d('0x21')];}}_0x3e1094=_[_0x3b9d('0x22')](Object[_0x3b9d('0x1a')](_0x5ba829),function(_0x2bf09f){return{'name':_0x2bf09f,'type':_0x5ba829[_0x2bf09f]['type']};});return _0x3e1094;})[_0x3b9d('0x17')](function(_0x2aa3c6){throw _0x2aa3c6;});}; \ No newline at end of file +var _0x7825=['type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','then','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','user','clause','checkListsRestrictions','search','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','filter','startsWith','CmCustomField','findOne','slice','all','length','fieldType'];(function(_0x1398b1,_0x5e0318){var _0x3ee504=function(_0x163c9e){while(--_0x163c9e){_0x1398b1['push'](_0x1398b1['shift']());}};_0x3ee504(++_0x5e0318);}(_0x7825,0x1c9));var _0x5782=function(_0x326558,_0x4a22a1){_0x326558=_0x326558-0x0;var _0x5cd3a0=_0x7825[_0x326558];return _0x5cd3a0;};'use strict';var _=require('lodash');var sqlUtils=require(_0x5782('0x0'));var db=require(_0x5782('0x1'))['db'];exports[_0x5782('0x2')]=function(_0x158329,_0x40a754,_0x9b9091,_0x1281c3){var _0x4286ea={'count':0x0,'rows':[]};var _0x12099c=sqlUtils[_0x5782('0x3')](_0x40a754,_0x158329);if(_0x12099c){return Promise['resolve'](_0x4286ea);}var _0xb8232f=sqlUtils[_0x5782('0x4')]();var _0x50e5f9={};var _0x64b567=![];var _0x5ab4af=![];return Promise['resolve']()[_0x5782('0x5')](function(){if(_0x158329['search']){return sqlUtils[_0x5782('0x6')](_0x158329['search'],_0x1281c3);}else{return sqlUtils[_0x5782('0x7')](_0x158329,_0x1281c3);}})[_0x5782('0x5')](function(_0x453037){_0xb8232f[_0x5782('0x8')](_0x453037[_0x5782('0x9')]);_0xb8232f[_0x5782('0x8')](_0x453037[_0x5782('0xa')]);_0xb8232f['where'](_0x453037['filter']);_0xb8232f['where'](_0x453037[_0x5782('0xb')][_0x5782('0xc')]);_0x50e5f9=_0x453037['tags'];_0x5ab4af=_0x453037['user']['skip'];return sqlUtils[_0x5782('0xd')](_0x40a754,_0x158329,_0x5ab4af);})['then'](function(_0xace869){_0xb8232f[_0x5782('0x8')](_0xace869);var _0x15db1f=_0x158329[_0x5782('0xe')]?_0x50e5f9['ids']:_0x158329[_0x5782('0xf')];_0x64b567=_0x15db1f?!![]:![];return sqlUtils[_0x5782('0x10')](_0xb8232f,_0x15db1f);})[_0x5782('0x5')](function(_0x4f5515){_0x4286ea[_0x5782('0x11')]=_0x4f5515;if(_0x4286ea[_0x5782('0x11')]===0x0){return;}if(_0x158329['User']){_0x5ab4af=!![];}return sqlUtils[_0x5782('0x12')](_0xb8232f,_0x158329[_0x5782('0xa')],_0x9b9091,_0x64b567,_0x50e5f9['clause'],_0x5ab4af);})[_0x5782('0x5')](function(_0x301c24){if(!_0x301c24){return[];}return sqlUtils[_0x5782('0x13')](_0x301c24,_0x158329,_0x9b9091);})[_0x5782('0x5')](function(_0xf66a99){_0x4286ea[_0x5782('0x14')]=_0xf66a99;return _0x4286ea;})[_0x5782('0x15')](function(_0x4b281b){throw _0x4b281b;});};exports[_0x5782('0x16')]=function(){var _0x1e9b9a={};var _0x19a0eb=[];return db[_0x5782('0x17')][_0x5782('0x16')]()[_0x5782('0x5')](function(_0x1896c7){_0x1e9b9a=_0x1896c7;var _0x9032c8=Object[_0x5782('0x18')](_0x1e9b9a)[_0x5782('0x19')](function(_0x7c6dc){return _[_0x5782('0x1a')](_0x7c6dc,'cf_')?_0x7c6dc:undefined;});var _0x433d50=_0x9032c8['map'](function(_0x49c7d1){return db[_0x5782('0x1b')][_0x5782('0x1c')]({'where':{'id':_0x49c7d1[_0x5782('0x1d')](0x3)},'raw':!![]});});return Promise[_0x5782('0x1e')](_0x433d50);})['then'](function(_0x446b12){for(var _0x2ada5d=0x0;_0x2ada5d<_0x446b12[_0x5782('0x1f')];_0x2ada5d++){if(_0x446b12[_0x2ada5d]){var _0x5f3b3f='cf_'+_0x446b12[_0x2ada5d]['id'];_0x1e9b9a[_0x5f3b3f][_0x5782('0x20')]=_0x446b12[_0x2ada5d][_0x5782('0x21')];}}_0x19a0eb=_[_0x5782('0x22')](Object['keys'](_0x1e9b9a),function(_0xedea8b){return{'name':_0xedea8b,'type':_0x1e9b9a[_0xedea8b]['type']};});return _0x19a0eb;})[_0x5782('0x15')](function(_0x6498a9){throw _0x6498a9;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index cff89e3..32cb1ad 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 _0xb0c8=['createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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','isNumeric','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?','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','start','value','end','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','skip','some','name','compact','push','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','color','Sequelize','QueryTypes','SELECT','CmContact','query','toString','COUNT(*)','c.id','isEmpty','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','email','CompanyId'];(function(_0x4e5e30,_0x2257aa){var _0x31a015=function(_0x1e0939){while(--_0x1e0939){_0x4e5e30['push'](_0x4e5e30['shift']());}};_0x31a015(++_0x2257aa);}(_0xb0c8,0x1a6));var _0x8b0c=function(_0xdaaebe,_0x5cc671){_0xdaaebe=_0xdaaebe-0x0;var _0x524a5a=_0xb0c8[_0xdaaebe];return _0x524a5a;};'use strict';var _=require(_0x8b0c('0x0'));var squel=require(_0x8b0c('0x1'));var as=require(_0x8b0c('0x2'));var qs=require(_0x8b0c('0x3'));var utils=require(_0x8b0c('0x4'));var db=require(_0x8b0c('0x5'))['db'];function skipContactsQuery(_0x5b7ca4,_0x254607){var _0x49c271=![];if(_0x5b7ca4[_0x8b0c('0x6')]===_0x8b0c('0x7')&&!_0x254607['search']&&!_0x254607[_0x8b0c('0x8')]&&_0x254607[_0x8b0c('0x9')]!==_0x8b0c('0xa')){_0x49c271=!![];}return _0x49c271;}function getContactsSubquery(){return squel[_0x8b0c('0xb')]()[_0x8b0c('0xc')]('cm_contacts','c')[_0x8b0c('0xd')](_0x8b0c('0xe'));}function applyJoinClauses(_0x2b0e00,_0x4e2dbf){var _0x25784c=_0x4e2dbf?'c':_0x8b0c('0xf');_0x2b0e00[_0x8b0c('0x10')](_0x8b0c('0x11'),'uc',_0x8b0c('0x12')+_0x25784c+'.id')[_0x8b0c('0x10')](_0x8b0c('0x13'),'ct',_0x8b0c('0x14')+_0x25784c+_0x8b0c('0x15'))[_0x8b0c('0x10')](_0x8b0c('0x16'),'t',_0x8b0c('0x17'));return _0x2b0e00;}function addFieldsToQuery(_0x4ecefa,_0x57aaec,_0x55f0ba,_0x144d75,_0x2f7f6c){var _0x2cfb6d=_0x2f7f6c?'c':'subqry';if(!_0x57aaec){_0x57aaec=['id',_0x8b0c('0x18'),_0x8b0c('0x19'),'phone',_0x8b0c('0x1a'),_0x8b0c('0x1b'),_0x8b0c('0x1c'),'ListId',_0x8b0c('0x1d'),_0x8b0c('0x1e'),_0x8b0c('0x1f'),_0x8b0c('0x20'),_0x8b0c('0x21')];}else if(!_0x57aaec[_0x8b0c('0x22')]('id')){_0x57aaec['push']('id');}var _0x49e56a=_0x55f0ba&&_0x2f7f6c||!_0x55f0ba&&!_0x2f7f6c;if(_0x144d75){_0x49e56a=_0x144d75&&_0x2f7f6c||!_0x144d75&&!_0x2f7f6c;}_0x57aaec[_0x8b0c('0x23')](function(_0x4868f3){if(_0x4868f3==='TagIds'){if(_0x49e56a){_0x4ecefa[_0x8b0c('0x24')](_0x8b0c('0x25'),_0x4868f3);}else if(_0x55f0ba||_0x144d75){_0x4ecefa[_0x8b0c('0x24')](_0x2cfb6d+'.'+_0x4868f3);}}else{_0x4ecefa[_0x8b0c('0x24')](_0x2cfb6d+'.'+_0x4868f3);}});return _0x4ecefa;}function getSqlClauses(){var _0x2b7853={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x8b0c('0x26')](),'tags':{'clause':squel[_0x8b0c('0x26')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x2b7853;}function parseTagParameter(_0x42de50){var _0x2124ea=squel[_0x8b0c('0x26')]();if(_0x42de50){var _0xeca8f7=utils['getSelectedTags'](_0x42de50);_0xeca8f7[_0x8b0c('0x23')](function(_0x131ece){_0x2124ea['or'](_0x8b0c('0x27'),'%,'+_0x131ece+',%');});}return _0x2124ea;}function parseSearchFilter(_0x2957d0){var _0x237cd5=squel[_0x8b0c('0x26')]();if(_0x2957d0){var _0x18bfee=_0x2957d0[_0x8b0c('0x28')]('\x5c','\x5c\x5c')[_0x8b0c('0x28')](/'/g,'\x27\x27');if(_0x18bfee[_0x8b0c('0x29')]('\x20')[_0x8b0c('0x2a')]>0x1){_0x237cd5['or'](_0x8b0c('0x2b'),qs[_0x8b0c('0x2c')](_0x18bfee,!![]),null);}else{if(qs[_0x8b0c('0x2d')](_0x18bfee)){_0x237cd5['or'](_0x8b0c('0x2e'),_0x18bfee+'%');_0x237cd5['or'](_0x8b0c('0x2f'),_0x18bfee+'%');_0x237cd5['or'](_0x8b0c('0x30'),_0x18bfee+'%');_0x237cd5['or'](_0x8b0c('0x31'),_0x18bfee+'%');}else if(qs[_0x8b0c('0x32')](_0x18bfee)){_0x237cd5['or'](_0x8b0c('0x33'),_0x18bfee+'%');}else{_0x237cd5['or'](_0x8b0c('0x34'),'%'+_0x18bfee+'%');_0x237cd5['or'](_0x8b0c('0x35'),'%'+_0x18bfee+'%');_0x237cd5['or'](_0x8b0c('0x33'),'%'+_0x18bfee+'%');}}}return _0x237cd5;}function parseAdvancedSearchFilter(_0x3a7c0f,_0x3217c1){var _0x43817c=getSqlClauses();var _0x37261f=as['parseSearch'](_0x3a7c0f);var _0x243a0e=_0x37261f[_0x8b0c('0x36')];for(var _0x3f2405=0x0;_0x3f2405<_0x37261f['conditions'][_0x8b0c('0x2a')];_0x3f2405++){var _0x9a6770=_0x37261f[_0x8b0c('0x37')][_0x3f2405];var _0x5979fd='c';var _0x395661=_[_0x8b0c('0x38')](_0x3217c1,['name',_0x9a6770['field']]);if(_0x395661){if(_0x9a6770[_0x8b0c('0x24')]===_0x8b0c('0x39')||_0x395661[_0x8b0c('0x3a')]===_0x8b0c('0x3b')){_0x9a6770[_0x8b0c('0x3c')]=_0x8b0c('0x3d');}var _0x2918cc=as[_0x8b0c('0x3e')](_0x5979fd,_0x395661[_0x8b0c('0x3f')],_0x9a6770);_0x43817c['default'][_0x243a0e](_0x2918cc['text'],_0x2918cc['value'][_0x8b0c('0x40')],_0x2918cc[_0x8b0c('0x41')][_0x8b0c('0x42')]);}else{if(_0x9a6770['field']==='Tag'){var _0x5eae8e=_0x9a6770[_0x8b0c('0x41')]['split'](',')[_0x8b0c('0x43')](function(_0x573969){return Number(_0x573969);});var _0x2278e3=parseTagParameter(_0x5eae8e);_0x43817c[_0x8b0c('0x44')][_0x8b0c('0x45')][_0x8b0c('0x46')](_0x2278e3);_0x43817c['tags'][_0x8b0c('0x47')]=_0x5eae8e;}else if(_0x9a6770[_0x8b0c('0x24')]===_0x8b0c('0x48')){_0x43817c['user'][_0x8b0c('0x45')][_0x8b0c('0x46')](_0x8b0c('0x49'),_0x9a6770[_0x8b0c('0x41')]);_0x43817c['user'][_0x8b0c('0x4a')]=!![];}}}return _0x43817c;}function parseModelFields(_0x426395,_0x36ad9e){var _0x268759=squel[_0x8b0c('0x26')]();var _0x3ef85c=_(_0x426395)['keys']()['map'](function(_0x519b78){return _[_0x8b0c('0x4b')](_0x36ad9e,[_0x8b0c('0x4c'),_0x519b78])?_0x519b78:undefined;})[_0x8b0c('0x4d')]()['value']();if(_0x426395['Contact']){_0x3ef85c[_0x8b0c('0x4e')](_0x8b0c('0x4f'));}if(_0x426395['User']){_0x3ef85c['push']('User');}if(_0x3ef85c[_0x8b0c('0x2a')]>0x0){_0x3ef85c[_0x8b0c('0x23')](function(_0x2ce5cc){if(_0x2ce5cc===_0x8b0c('0x8')){_0x268759[_0x8b0c('0x46')](_0x8b0c('0x50'),[][_0x8b0c('0x51')](_0x426395[_0x2ce5cc]));}else if(_0x2ce5cc===_0x8b0c('0x4f')){var _0x52a7a3='%'+_0x426395[_0x2ce5cc]+'%';_0x268759[_0x8b0c('0x46')](_0x8b0c('0x52'),_0x52a7a3);}else if(_0x2ce5cc===_0x8b0c('0x48')){_0x268759[_0x8b0c('0x46')]('uc.UserId\x20=\x20?',_0x426395[_0x2ce5cc]);}else{_0x268759[_0x8b0c('0x46')]('c.'+_0x2ce5cc+_0x8b0c('0x53'),_0x426395[_0x2ce5cc]);}});}return _0x268759;}function parseQueryParameters(_0x10c7bc,_0x350a0e){var _0x4f2eec=getSqlClauses();return Promise[_0x8b0c('0x54')]()['then'](function(){return parseModelFields(_0x10c7bc,_0x350a0e);})[_0x8b0c('0x55')](function(_0x1c66a9){_0x4f2eec['fields'][_0x8b0c('0x46')](_0x1c66a9);return parseTagParameter(_0x10c7bc[_0x8b0c('0x56')]);})[_0x8b0c('0x55')](function(_0x3d08c0){_0x4f2eec['tags'][_0x8b0c('0x45')][_0x8b0c('0x46')](_0x3d08c0);return parseSearchFilter(_0x10c7bc['filter']);})[_0x8b0c('0x55')](function(_0x118f64){_0x4f2eec[_0x8b0c('0x57')]=_0x118f64;return _0x4f2eec;});}function checkListsRestrictions(_0x23e882,_0x131fd3,_0x72ef93){var _0x2d1a10=squel[_0x8b0c('0x26')]();return Promise[_0x8b0c('0x54')]()['then'](function(){if(_0x131fd3[_0x8b0c('0x58')]&&_0x23e882[_0x8b0c('0x6')]===_0x8b0c('0x7')&&!_0x72ef93){return _0x23e882[_0x8b0c('0x59')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1ba63f){if(_0x1ba63f){if(_0x1ba63f['length']===0x0){_0x2d1a10[_0x8b0c('0x46')](_0x8b0c('0x5a'));}else{_0x2d1a10[_0x8b0c('0x46')](_0x8b0c('0x50'),_[_0x8b0c('0x43')](_0x1ba63f,'id'));}}})[_0x8b0c('0x55')](function(){return _0x2d1a10;});}function buildContactsQuery(_0x1866f3,_0x43534a,_0x5d90ff,_0x54a03e,_0x19a4a1,_0x5e7575){if(_0x43534a){_0x43534a=_0x5d90ff[_0x8b0c('0x5b')];}_0x1866f3=addFieldsToQuery(_0x1866f3,_0x43534a,_0x54a03e,_0x5e7575,!![]);var _0x5e8897=squel[_0x8b0c('0xb')]();_0x5e8897=addFieldsToQuery(_0x5e8897,_0x43534a,_0x54a03e,_0x5e7575,![]);if(_0x54a03e||_0x5e7575){_0x1866f3=applyJoinClauses(_0x1866f3,!![]);_0x1866f3[_0x8b0c('0x5c')]('c.id');if(_0x5d90ff['limit']){_0x5e8897[_0x8b0c('0x5d')](_0x5d90ff[_0x8b0c('0x5d')]);}if(_0x5d90ff[_0x8b0c('0x5e')]){_0x5e8897[_0x8b0c('0x5e')](_0x5d90ff['offset']);}}else{_0x5e8897=applyJoinClauses(_0x5e8897,![]);_0x5e8897['group'](_0x8b0c('0x5f'));if(_0x5d90ff[_0x8b0c('0x5d')]){_0x1866f3[_0x8b0c('0x5d')](_0x5d90ff['limit']);}if(_0x5d90ff['offset']){_0x1866f3[_0x8b0c('0x5e')](_0x5d90ff[_0x8b0c('0x5e')]);}}_0x5e8897[_0x8b0c('0x60')](_0x19a4a1);if(_0x5d90ff[_0x8b0c('0x61')]){_0x5d90ff[_0x8b0c('0x61')][_0x8b0c('0x23')](function(_0x201115){_0x1866f3[_0x8b0c('0x61')]('c.'+_0x201115[0x0],_0x201115[0x1]===_0x8b0c('0x62')?![]:!![]);_0x5e8897[_0x8b0c('0x61')](_0x8b0c('0x63')+_0x201115[0x0],_0x201115[0x1]===_0x8b0c('0x62')?![]:!![]);});}_0x5e8897[_0x8b0c('0xc')](_0x1866f3,_0x8b0c('0xf'));return _0x5e8897;}function getFilteredContacts(_0x6514b5){var _0x2aeec0=[];return db[_0x8b0c('0x64')]['findAll']({'attributes':['id',_0x8b0c('0x4c'),_0x8b0c('0x65')],'raw':!![]})[_0x8b0c('0x55')](function(_0x1226eb){_0x2aeec0=_['keyBy'](_0x1226eb,'id');var _0xaace44={'type':db[_0x8b0c('0x66')][_0x8b0c('0x67')][_0x8b0c('0x68')],'model':db[_0x8b0c('0x69')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x8b0c('0x6a')](_0x6514b5[_0x8b0c('0x6b')](),_0xaace44);})[_0x8b0c('0x55')](function(_0x4ad82f){_0x4ad82f[_0x8b0c('0x23')](function(_0x5af930){if(_0x5af930[_0x8b0c('0x21')]){_0x5af930['Tags']=[];_0x5af930[_0x8b0c('0x21')][_0x8b0c('0x29')](',')[_0x8b0c('0x23')](function(_0x2f1e05){_0x5af930['Tags']['push'](_0x2aeec0[_0x2f1e05]);});}delete _0x5af930[_0x8b0c('0x21')];});return _0x4ad82f;});}function countFilteredContacts(_0x19ca13,_0x108f01){var _0x5b638e=_0x19ca13['clone']();_0x5b638e[_0x8b0c('0x24')](_0x8b0c('0x6c'));_0x5b638e=applyJoinClauses(_0x5b638e,!![]);_0x19ca13[_0x8b0c('0x5c')](_0x8b0c('0x6d'));var _0x381520=utils['getSelectedTags'](_0x108f01);if(!_[_0x8b0c('0x6e')](_0x381520)){_0x5b638e[_0x8b0c('0xd')]('t.id\x20IN\x20?',_0x381520);}var _0x52bd52={'type':db[_0x8b0c('0x66')]['QueryTypes'][_0x8b0c('0x68')],'raw':!![]};return db[_0x8b0c('0x6f')][_0x8b0c('0x6a')](_0x5b638e[_0x8b0c('0x6b')](),_0x52bd52)[_0x8b0c('0x55')](function(_0x4292d8){return _0x4292d8[0x0][_0x8b0c('0x6c')];});}module[_0x8b0c('0x70')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x6b75=['User','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','c.ListId\x20IS\x20NULL','group','limit','offset','subqry.id','having','order','DESC','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','c.id','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','ListId','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','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','sqlOperator','conditions','length','find','name','dateOfBirth','datetime','castTo','buildExpression','default','text','value','end','Tag','map','tags','and','ids','clause','uc.UserId\x20=\x20?','user','skip','some','compact','Contact'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x6b75,0xef));var _0x56b7=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x6b75[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x56b7('0x0'));var squel=require(_0x56b7('0x1'));var as=require(_0x56b7('0x2'));var qs=require('../parsers/qs');var utils=require(_0x56b7('0x3'));var db=require(_0x56b7('0x4'))['db'];function skipContactsQuery(_0x393c3f,_0x5c6487){var _0x318f5d=![];if(_0x393c3f[_0x56b7('0x5')]===_0x56b7('0x6')&&!_0x5c6487[_0x56b7('0x7')]&&!_0x5c6487['ListId']&&_0x5c6487[_0x56b7('0x8')]!==_0x56b7('0x9')){_0x318f5d=!![];}return _0x318f5d;}function getContactsSubquery(){return squel[_0x56b7('0xa')]()['from'](_0x56b7('0xb'),'c')[_0x56b7('0xc')](_0x56b7('0xd'));}function applyJoinClauses(_0x5b9752,_0x122c8d){var _0x239218=_0x122c8d?'c':_0x56b7('0xe');_0x5b9752['left_join'](_0x56b7('0xf'),'uc',_0x56b7('0x10')+_0x239218+_0x56b7('0x11'))[_0x56b7('0x12')]('cm_contact_has_tags','ct',_0x56b7('0x13')+_0x239218+'.id')[_0x56b7('0x12')](_0x56b7('0x14'),'t',_0x56b7('0x15'));return _0x5b9752;}function addFieldsToQuery(_0x152b4b,_0x18fd92,_0x42c850,_0x3b4749,_0x2dc022){var _0x5b1e09=_0x2dc022?'c':_0x56b7('0xe');if(!_0x18fd92){_0x18fd92=['id',_0x56b7('0x16'),_0x56b7('0x17'),_0x56b7('0x18'),'mobile','fax','email',_0x56b7('0x19'),_0x56b7('0x1a'),_0x56b7('0x1b'),'updatedAt',_0x56b7('0x1c'),_0x56b7('0x1d')];}else if(!_0x18fd92[_0x56b7('0x1e')]('id')){_0x18fd92[_0x56b7('0x1f')]('id');}var _0x1caea6=_0x42c850&&_0x2dc022||!_0x42c850&&!_0x2dc022;if(_0x3b4749){_0x1caea6=_0x3b4749&&_0x2dc022||!_0x3b4749&&!_0x2dc022;}_0x18fd92[_0x56b7('0x20')](function(_0x481084){if(_0x481084==='TagIds'){if(_0x1caea6){_0x152b4b[_0x56b7('0x21')](_0x56b7('0x22'),_0x481084);}else if(_0x42c850||_0x3b4749){_0x152b4b['field'](_0x5b1e09+'.'+_0x481084);}}else{_0x152b4b['field'](_0x5b1e09+'.'+_0x481084);}});return _0x152b4b;}function getSqlClauses(){var _0x2b731f={'default':squel[_0x56b7('0x23')](),'fields':squel[_0x56b7('0x23')](),'filter':squel[_0x56b7('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x56b7('0x23')](),'skip':![]}};return _0x2b731f;}function parseTagParameter(_0x1a7703){var _0x235d0d=squel[_0x56b7('0x23')]();if(_0x1a7703){var _0x55b3c3=utils[_0x56b7('0x24')](_0x1a7703);_0x55b3c3['forEach'](function(_0x5dc4d5){_0x235d0d['or'](_0x56b7('0x25'),'%,'+_0x5dc4d5+',%');});}return _0x235d0d;}function parseSearchFilter(_0x50ca12){var _0x5d9b8c=squel[_0x56b7('0x23')]();if(_0x50ca12){var _0x3f313d=_0x50ca12[_0x56b7('0x26')]('\x5c','\x5c\x5c')[_0x56b7('0x26')](/'/g,'\x27\x27');if(_0x3f313d['split']('\x20')['length']>0x1){_0x5d9b8c['or'](_0x56b7('0x27'),qs[_0x56b7('0x28')](_0x3f313d,!![]),null);}else{if(qs[_0x56b7('0x29')](_0x3f313d)){_0x5d9b8c['or'](_0x56b7('0x2a'),_0x3f313d+'%');_0x5d9b8c['or']('c.phone\x20LIKE\x20?',_0x3f313d+'%');_0x5d9b8c['or'](_0x56b7('0x2b'),_0x3f313d+'%');_0x5d9b8c['or'](_0x56b7('0x2c'),_0x3f313d+'%');}else if(qs[_0x56b7('0x2d')](_0x3f313d)){_0x5d9b8c['or'](_0x56b7('0x2e'),_0x3f313d+'%');}else{_0x5d9b8c['or'](_0x56b7('0x2f'),'%'+_0x3f313d+'%');_0x5d9b8c['or']('c.lastName\x20LIKE\x20?','%'+_0x3f313d+'%');_0x5d9b8c['or']('c.email\x20LIKE\x20?','%'+_0x3f313d+'%');}}}return _0x5d9b8c;}function parseAdvancedSearchFilter(_0x288d17,_0x32e96e){var _0x7c40e6=getSqlClauses();var _0x399c91=as['parseSearch'](_0x288d17);var _0x525547=_0x399c91[_0x56b7('0x30')];for(var _0x4be955=0x0;_0x4be955<_0x399c91[_0x56b7('0x31')][_0x56b7('0x32')];_0x4be955++){var _0x301751=_0x399c91[_0x56b7('0x31')][_0x4be955];var _0x2d016e='c';var _0x5868f2=_[_0x56b7('0x33')](_0x32e96e,[_0x56b7('0x34'),_0x301751[_0x56b7('0x21')]]);if(_0x5868f2){if(_0x301751[_0x56b7('0x21')]===_0x56b7('0x35')||_0x5868f2['fieldType']===_0x56b7('0x36')){_0x301751[_0x56b7('0x37')]='DATE';}var _0x301ad6=as[_0x56b7('0x38')](_0x2d016e,_0x5868f2['type'],_0x301751);_0x7c40e6[_0x56b7('0x39')][_0x525547](_0x301ad6[_0x56b7('0x3a')],_0x301ad6[_0x56b7('0x3b')]['start'],_0x301ad6[_0x56b7('0x3b')][_0x56b7('0x3c')]);}else{if(_0x301751[_0x56b7('0x21')]===_0x56b7('0x3d')){var _0x5b6cdb=_0x301751[_0x56b7('0x3b')]['split'](',')[_0x56b7('0x3e')](function(_0x5ea109){return Number(_0x5ea109);});var _0x18237b=parseTagParameter(_0x5b6cdb);_0x7c40e6[_0x56b7('0x3f')]['clause'][_0x56b7('0x40')](_0x18237b);_0x7c40e6[_0x56b7('0x3f')][_0x56b7('0x41')]=_0x5b6cdb;}else if(_0x301751[_0x56b7('0x21')]==='User'){_0x7c40e6['user'][_0x56b7('0x42')][_0x56b7('0x40')](_0x56b7('0x43'),_0x301751[_0x56b7('0x3b')]);_0x7c40e6[_0x56b7('0x44')][_0x56b7('0x45')]=!![];}}}return _0x7c40e6;}function parseModelFields(_0x2b43f9,_0x143ad0){var _0xe5901f=squel[_0x56b7('0x23')]();var _0x58dc55=_(_0x2b43f9)['keys']()['map'](function(_0x143c47){return _[_0x56b7('0x46')](_0x143ad0,[_0x56b7('0x34'),_0x143c47])?_0x143c47:undefined;})[_0x56b7('0x47')]()[_0x56b7('0x3b')]();if(_0x2b43f9[_0x56b7('0x48')]){_0x58dc55[_0x56b7('0x1f')]('Contact');}if(_0x2b43f9[_0x56b7('0x49')]){_0x58dc55[_0x56b7('0x1f')](_0x56b7('0x49'));}if(_0x58dc55[_0x56b7('0x32')]>0x0){_0x58dc55[_0x56b7('0x20')](function(_0x597874){if(_0x597874==='ListId'){_0xe5901f[_0x56b7('0x40')](_0x56b7('0x4a'),[]['concat'](_0x2b43f9[_0x597874]));}else if(_0x597874===_0x56b7('0x48')){var _0x1b724e='%'+_0x2b43f9[_0x597874]+'%';_0xe5901f[_0x56b7('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x1b724e);}else if(_0x597874===_0x56b7('0x49')){_0xe5901f[_0x56b7('0x40')]('uc.UserId\x20=\x20?',_0x2b43f9[_0x597874]);}else{_0xe5901f['and']('c.'+_0x597874+_0x56b7('0x4b'),_0x2b43f9[_0x597874]);}});}return _0xe5901f;}function parseQueryParameters(_0xb7a341,_0x49843a){var _0x38d929=getSqlClauses();return Promise[_0x56b7('0x4c')]()[_0x56b7('0x4d')](function(){return parseModelFields(_0xb7a341,_0x49843a);})[_0x56b7('0x4d')](function(_0x17a51f){_0x38d929[_0x56b7('0x4e')][_0x56b7('0x40')](_0x17a51f);return parseTagParameter(_0xb7a341['tag']);})[_0x56b7('0x4d')](function(_0x4353bd){_0x38d929[_0x56b7('0x3f')][_0x56b7('0x42')]['and'](_0x4353bd);return parseSearchFilter(_0xb7a341['filter']);})[_0x56b7('0x4d')](function(_0x11b974){_0x38d929['filter']=_0x11b974;return _0x38d929;});}function checkListsRestrictions(_0x1028ea,_0x2d42e0,_0x5d9321){var _0x454661=squel[_0x56b7('0x23')]();return Promise[_0x56b7('0x4c')]()[_0x56b7('0x4d')](function(){if(_0x2d42e0[_0x56b7('0x7')]&&_0x1028ea[_0x56b7('0x5')]===_0x56b7('0x6')&&!_0x5d9321){return _0x1028ea['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1bbb19){if(_0x1bbb19){if(_0x1bbb19[_0x56b7('0x32')]===0x0){_0x454661[_0x56b7('0x40')](_0x56b7('0x4f'));}else{_0x454661['and'](_0x56b7('0x4a'),_['map'](_0x1bbb19,'id'));}}})[_0x56b7('0x4d')](function(){return _0x454661;});}function buildContactsQuery(_0x1644b4,_0xfc8cc4,_0x14ff99,_0x3d960a,_0x4ccc28,_0x10e19b){if(_0xfc8cc4){_0xfc8cc4=_0x14ff99['attributes'];}_0x1644b4=addFieldsToQuery(_0x1644b4,_0xfc8cc4,_0x3d960a,_0x10e19b,!![]);var _0x8db4ff=squel['select']();_0x8db4ff=addFieldsToQuery(_0x8db4ff,_0xfc8cc4,_0x3d960a,_0x10e19b,![]);if(_0x3d960a||_0x10e19b){_0x1644b4=applyJoinClauses(_0x1644b4,!![]);_0x1644b4[_0x56b7('0x50')]('c.id');if(_0x14ff99[_0x56b7('0x51')]){_0x8db4ff[_0x56b7('0x51')](_0x14ff99[_0x56b7('0x51')]);}if(_0x14ff99['offset']){_0x8db4ff[_0x56b7('0x52')](_0x14ff99[_0x56b7('0x52')]);}}else{_0x8db4ff=applyJoinClauses(_0x8db4ff,![]);_0x8db4ff[_0x56b7('0x50')](_0x56b7('0x53'));if(_0x14ff99['limit']){_0x1644b4[_0x56b7('0x51')](_0x14ff99[_0x56b7('0x51')]);}if(_0x14ff99[_0x56b7('0x52')]){_0x1644b4[_0x56b7('0x52')](_0x14ff99[_0x56b7('0x52')]);}}_0x8db4ff[_0x56b7('0x54')](_0x4ccc28);if(_0x14ff99[_0x56b7('0x55')]){_0x14ff99[_0x56b7('0x55')][_0x56b7('0x20')](function(_0x2e41c6){_0x1644b4[_0x56b7('0x55')]('c.'+_0x2e41c6[0x0],_0x2e41c6[0x1]===_0x56b7('0x56')?![]:!![]);_0x8db4ff[_0x56b7('0x55')]('subqry.'+_0x2e41c6[0x0],_0x2e41c6[0x1]===_0x56b7('0x56')?![]:!![]);});}_0x8db4ff[_0x56b7('0x57')](_0x1644b4,'subqry');return _0x8db4ff;}function getFilteredContacts(_0x13f03e){var _0x5b9d7c=[];return db[_0x56b7('0x3d')][_0x56b7('0x58')]({'attributes':['id','name',_0x56b7('0x59')],'raw':!![]})[_0x56b7('0x4d')](function(_0x54edbe){_0x5b9d7c=_[_0x56b7('0x5a')](_0x54edbe,'id');var _0x577e5f={'type':db[_0x56b7('0x5b')][_0x56b7('0x5c')][_0x56b7('0x5d')],'model':db[_0x56b7('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x56b7('0x5f')](_0x13f03e[_0x56b7('0x60')](),_0x577e5f);})['then'](function(_0x1f9beb){_0x1f9beb['forEach'](function(_0x4d2aff){if(_0x4d2aff[_0x56b7('0x1d')]){_0x4d2aff[_0x56b7('0x61')]=[];_0x4d2aff[_0x56b7('0x1d')]['split'](',')[_0x56b7('0x20')](function(_0x2e2e09){_0x4d2aff[_0x56b7('0x61')][_0x56b7('0x1f')](_0x5b9d7c[_0x2e2e09]);});}delete _0x4d2aff[_0x56b7('0x1d')];});return _0x1f9beb;});}function countFilteredContacts(_0x3c956b,_0x5e672d){var _0x4605df=_0x3c956b[_0x56b7('0x62')]();_0x4605df[_0x56b7('0x21')](_0x56b7('0x63'));_0x4605df=applyJoinClauses(_0x4605df,!![]);_0x3c956b[_0x56b7('0x50')](_0x56b7('0x64'));var _0x21ab65=utils[_0x56b7('0x24')](_0x5e672d);if(!_['isEmpty'](_0x21ab65)){_0x4605df[_0x56b7('0xc')](_0x56b7('0x65'),_0x21ab65);}var _0x49e69={'type':db[_0x56b7('0x5b')][_0x56b7('0x5c')][_0x56b7('0x5d')],'raw':!![]};return db[_0x56b7('0x66')]['query'](_0x4605df[_0x56b7('0x60')](),_0x49e69)[_0x56b7('0x4d')](function(_0x35e332){return _0x35e332[0x0][_0x56b7('0x63')];});}module[_0x56b7('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5785548..5161a18 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 _0xb189=['update','close','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','write','final','binary','end','unlink','decryptFile','createDecipher'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb189,0x107));var _0x9b18=function(_0x508148,_0x593cca){_0x508148=_0x508148-0x0;var _0x481752=_0xb189[_0x508148];return _0x481752;};'use strict';var crypto=require(_0x9b18('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x9b18('0x1'));var config=require(_0x9b18('0x2'));var logger=require('../../config/logger')(_0x9b18('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9b18('0x4')][_0x9b18('0x5')],'algorithm':_0x9b18('0x6')};const fileOptions={'algorithm':_0x9b18('0x7')};if(config[_0x9b18('0x8')]&&config[_0x9b18('0x8')][_0x9b18('0x9')]){var isSupported=isAlgorithmSupported(config[_0x9b18('0x8')][_0x9b18('0x9')]);if(isSupported){fileOptions[_0x9b18('0x9')]=config['encrypt'][_0x9b18('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x9b18('0x8')][_0x9b18('0x9')],_0x9b18('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x204259){return AES_SUPPORTED_RX['test'](_0x204259);}function getSupportedCiphers(){return crypto[_0x9b18('0xb')]()[_0x9b18('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x207a80){return getSupportedCiphers()['indexOf'](_0x207a80)>-0x1;}function combineOptions(_0x88752a){var _0x1bbfe2={};for(var _0x2dfcfe in fileOptions){if(fileOptions[_0x9b18('0xd')](_0x2dfcfe)){_0x1bbfe2[_0x2dfcfe]=fileOptions[_0x2dfcfe];}}if(_0x88752a){for(var _0x1acba4 in _0x88752a){if(_0x88752a['hasOwnProperty'](_0x1acba4)){_0x1bbfe2[_0x1acba4]=_0x88752a[_0x1acba4];}}}return _0x1bbfe2;}exports[_0x9b18('0xe')]=function(_0xff6d9f,_0x5965a7,_0x5cf14a,_0x5add8a){return new BPromise(function(_0x10eb0a,_0x48c091){_0x5add8a=combineOptions(_0x5add8a);var _0x4b4fd0=new Buffer(_0x5cf14a);var _0xe894a7=fs[_0x9b18('0xf')](_0xff6d9f);var _0x53cc68=fs[_0x9b18('0x10')](_0x5965a7);var _0x550f73=crypto['createCipher'](_0x5add8a[_0x9b18('0x9')],_0x4b4fd0);_0xe894a7['on'](_0x9b18('0x11'),function(_0x4af593){var _0x566e3d=new Buffer(_0x550f73['update'](_0x4af593),'binary');_0x53cc68[_0x9b18('0x12')](_0x566e3d);});_0xe894a7['on']('end',function(){try{var _0x3046df=new Buffer(_0x550f73[_0x9b18('0x13')](_0x9b18('0x14')),_0x9b18('0x14'));_0x53cc68[_0x9b18('0x12')](_0x3046df);_0x53cc68[_0x9b18('0x15')]();_0x53cc68['on']('close',function(){return _0x10eb0a(_0x5965a7);});}catch(_0x689f4c){fs[_0x9b18('0x16')](_0x5965a7);return _0x48c091(_0x689f4c);}});});};exports[_0x9b18('0x17')]=function(_0x16c106,_0x43cd1b,_0x3de88c,_0x27efde){return new BPromise(function(_0x232dd6,_0x19ad13){_0x27efde=combineOptions(_0x27efde);var _0x139455=new Buffer(_0x3de88c);var _0x2fb54a=fs['createReadStream'](_0x16c106);var _0xa7eb58=fs[_0x9b18('0x10')](_0x43cd1b);var _0x4563a4=crypto[_0x9b18('0x18')](_0x27efde[_0x9b18('0x9')],_0x139455);_0x2fb54a['on'](_0x9b18('0x11'),function(_0x43dae6){var _0x37e64d=new Buffer(_0x4563a4[_0x9b18('0x19')](_0x43dae6),_0x9b18('0x14'));_0xa7eb58[_0x9b18('0x12')](_0x37e64d);});_0x2fb54a['on'](_0x9b18('0x15'),function(){try{var _0x20ac5e=new Buffer(_0x4563a4[_0x9b18('0x13')](_0x9b18('0x14')),'binary');_0xa7eb58[_0x9b18('0x12')](_0x20ac5e);_0xa7eb58[_0x9b18('0x15')]();_0xa7eb58['on'](_0x9b18('0x1a'),function(){return _0x232dd6(_0x43cd1b);});}catch(_0xf60227){fs[_0x9b18('0x16')](_0x43cd1b);return _0x19ad13(_0xf60227);}});});};exports[_0x9b18('0x1b')]=function(_0xbbdb4a,_0x217a27,_0x52681f){var _0x53995d=_0x52681f||stringOptions['algorithm'];var _0x865aaf=_0x217a27||stringOptions[_0x9b18('0x1c')];var _0x29c914=crypto['createCipher'](_0x53995d,_0x865aaf);var _0x43c534=_0x29c914['update'](_0xbbdb4a,_0x9b18('0x1d'),'base64');_0x43c534+=_0x29c914[_0x9b18('0x13')](_0x9b18('0x1e'));return _0x43c534;};exports[_0x9b18('0x1f')]=function(_0x266705,_0x286d9e,_0x31cbd8){var _0x459ded=_0x31cbd8||stringOptions[_0x9b18('0x9')];var _0x1c8244=_0x286d9e||stringOptions[_0x9b18('0x1c')];var _0x2e4e7f=crypto[_0x9b18('0x18')](_0x459ded,_0x1c8244);var _0x1cf477=_0x2e4e7f['update'](_0x266705,_0x9b18('0x1e'),_0x9b18('0x1d'));_0x1cf477+=_0x2e4e7f[_0x9b18('0x13')](_0x9b18('0x1d'));return _0x1cf477;}; \ No newline at end of file +var _0x2734=['encryptString','secret','utf8','base64','crypto','bluebird','lodash','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','binary','end','final','close','unlink','decryptFile','createDecipher','update','write'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x2734,0x124));var _0x4273=function(_0x4c293,_0x4abfaf){_0x4c293=_0x4c293-0x0;var _0x6a1f64=_0x2734[_0x4c293];return _0x6a1f64;};'use strict';var crypto=require(_0x4273('0x0'));var fs=require('fs');var BPromise=require(_0x4273('0x1'));var _=require(_0x4273('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x4273('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4273('0x4')][_0x4273('0x5')],'algorithm':_0x4273('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x4273('0x7')]&&config[_0x4273('0x7')][_0x4273('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4273('0x7')][_0x4273('0x8')]);if(isSupported){fileOptions[_0x4273('0x8')]=config[_0x4273('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4273('0x9')](',\x20');logger['error'](config[_0x4273('0x7')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4f0571){return AES_SUPPORTED_RX[_0x4273('0xa')](_0x4f0571);}function getSupportedCiphers(){return crypto[_0x4273('0xb')]()[_0x4273('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x305b7c){return getSupportedCiphers()[_0x4273('0xd')](_0x305b7c)>-0x1;}function combineOptions(_0x8ff72){var _0x92c586={};for(var _0x14dff7 in fileOptions){if(fileOptions['hasOwnProperty'](_0x14dff7)){_0x92c586[_0x14dff7]=fileOptions[_0x14dff7];}}if(_0x8ff72){for(var _0x21800a in _0x8ff72){if(_0x8ff72[_0x4273('0xe')](_0x21800a)){_0x92c586[_0x21800a]=_0x8ff72[_0x21800a];}}}return _0x92c586;}exports['encryptFile']=function(_0x3cc7b0,_0x5447be,_0x1b7a59,_0x49c1c9){return new BPromise(function(_0x37823b,_0x24363e){_0x49c1c9=combineOptions(_0x49c1c9);var _0x363a73=new Buffer(_0x1b7a59);var _0x440c98=fs[_0x4273('0xf')](_0x3cc7b0);var _0x27a5e5=fs[_0x4273('0x10')](_0x5447be);var _0x57c685=crypto[_0x4273('0x11')](_0x49c1c9[_0x4273('0x8')],_0x363a73);_0x440c98['on'](_0x4273('0x12'),function(_0x1cea78){var _0x16a973=new Buffer(_0x57c685['update'](_0x1cea78),_0x4273('0x13'));_0x27a5e5['write'](_0x16a973);});_0x440c98['on'](_0x4273('0x14'),function(){try{var _0x412f63=new Buffer(_0x57c685[_0x4273('0x15')]('binary'),'binary');_0x27a5e5['write'](_0x412f63);_0x27a5e5[_0x4273('0x14')]();_0x27a5e5['on'](_0x4273('0x16'),function(){return _0x37823b(_0x5447be);});}catch(_0x2a0d1d){fs[_0x4273('0x17')](_0x5447be);return _0x24363e(_0x2a0d1d);}});});};exports[_0x4273('0x18')]=function(_0x511215,_0x4e3edd,_0x194b87,_0x3fe401){return new BPromise(function(_0x206964,_0x5ac6ec){_0x3fe401=combineOptions(_0x3fe401);var _0x5d32d6=new Buffer(_0x194b87);var _0x3b913e=fs[_0x4273('0xf')](_0x511215);var _0x117b4e=fs[_0x4273('0x10')](_0x4e3edd);var _0x5075ee=crypto[_0x4273('0x19')](_0x3fe401['algorithm'],_0x5d32d6);_0x3b913e['on']('data',function(_0x55f815){var _0x3f6ed9=new Buffer(_0x5075ee[_0x4273('0x1a')](_0x55f815),_0x4273('0x13'));_0x117b4e[_0x4273('0x1b')](_0x3f6ed9);});_0x3b913e['on'](_0x4273('0x14'),function(){try{var _0x567bb7=new Buffer(_0x5075ee[_0x4273('0x15')](_0x4273('0x13')),_0x4273('0x13'));_0x117b4e[_0x4273('0x1b')](_0x567bb7);_0x117b4e['end']();_0x117b4e['on']('close',function(){return _0x206964(_0x4e3edd);});}catch(_0xab62cc){fs[_0x4273('0x17')](_0x4e3edd);return _0x5ac6ec(_0xab62cc);}});});};exports[_0x4273('0x1c')]=function(_0x3a6334,_0x27fc54,_0x3d6c09){var _0x3fe03c=_0x3d6c09||stringOptions[_0x4273('0x8')];var _0x11a6d0=_0x27fc54||stringOptions[_0x4273('0x1d')];var _0x2a839f=crypto[_0x4273('0x11')](_0x3fe03c,_0x11a6d0);var _0x2e4211=_0x2a839f[_0x4273('0x1a')](_0x3a6334,_0x4273('0x1e'),_0x4273('0x1f'));_0x2e4211+=_0x2a839f[_0x4273('0x15')]('base64');return _0x2e4211;};exports['decryptString']=function(_0x9c8240,_0x2dd2b8,_0x3d7c77){var _0x551afa=_0x3d7c77||stringOptions[_0x4273('0x8')];var _0x4e9f5d=_0x2dd2b8||stringOptions[_0x4273('0x1d')];var _0x31c993=crypto[_0x4273('0x19')](_0x551afa,_0x4e9f5d);var _0xf62491=_0x31c993[_0x4273('0x1a')](_0x9c8240,_0x4273('0x1f'),_0x4273('0x1e'));_0xf62491+=_0x31c993[_0x4273('0x15')]('utf8');return _0xf62491;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e1b9f58..ec5a301 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 _0x4d69=['splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x4d69,0x83));var _0x94d6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4d69[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x94d6('0x0'));var path=require('path');var _=require(_0x94d6('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x94d6('0x2'));var zipdir=require(_0x94d6('0x3'));var rimraf=require('rimraf');var db=require(_0x94d6('0x4'))['db'];var dbH=require(_0x94d6('0x4'))[_0x94d6('0x5')];var logger=require(_0x94d6('0x6'))(_0x94d6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x94d6('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x94d6('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x252433,_0x47ea15){var _0x27776b={'status':_0x252433};var _0x45bcbe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47ea15){_0x27776b['savename']=_0x47ea15;}return db[_0x94d6('0x9')][_0x94d6('0xa')](_0x27776b,_0x45bcbe);}function main(){var _0x1288b1=0x1388;var _0x563cbe;logger[_0x94d6('0xb')](util['format'](_0x94d6('0xc'),EXTRACTED_REPORT_ID,_0x94d6('0xd')));return db[_0x94d6('0xe')][_0x94d6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x94d6('0x10')]})['then'](function(_0x8f641a){if(_0x8f641a){_0x563cbe=_0x8f641a;_0x1288b1=_0x563cbe[_0x94d6('0x10')]||0x1388;}})[_0x94d6('0x11')](function(){return dbH[_0x94d6('0x12')][_0x94d6('0x13')](util[_0x94d6('0x14')](_0x94d6('0x15'),QUERY),{'type':dbH[_0x94d6('0x12')][_0x94d6('0x16')]['SELECT']});})[_0x94d6('0x11')](function(_0x3b7c14){if(!_0x3b7c14[0x0][_0x94d6('0x17')]){return analyticExtractedReport('Empty');}var _0x3fd704=[];var _0x5d7966=0x0;if(_0x563cbe[_0x94d6('0x18')]){if(_0x3b7c14&&_0x3b7c14[_0x94d6('0x19')]){var _0x413437=_[_0x94d6('0x1a')](_0x3b7c14[0x0][_0x94d6('0x17')]/_0x1288b1);var _0x1c2e78=Number[_0x94d6('0x1b')](_0x3b7c14[0x0][_0x94d6('0x17')]/_0x1288b1)?_0x3b7c14[0x0]['num']%_0x1288b1:0x0;_0x413437[_0x94d6('0x1c')](function(_0x28c513){if(_0x28c513>0x0){_0x5d7966+=_0x1288b1;}_0x3fd704['push'](dbH['sequelize'][_0x94d6('0x13')](util['format'](_0x94d6('0x1d'),QUERY,_0x1288b1,_0x5d7966),{'type':dbH[_0x94d6('0x12')][_0x94d6('0x16')][_0x94d6('0x1e')]}));});if(_0x1c2e78>0x0){_0x5d7966+=_0x1288b1;_0x3fd704[_0x94d6('0x1f')](dbH['sequelize']['query'](util['format'](_0x94d6('0x1d'),QUERY,_0x1c2e78,_0x5d7966),{'type':dbH[_0x94d6('0x12')][_0x94d6('0x16')][_0x94d6('0x1e')]}));}}}else{_0x3fd704[_0x94d6('0x1f')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x94d6('0x16')][_0x94d6('0x1e')]}));}var _0x14b8b6=path[_0x94d6('0x20')](PATH);var _0x4225a0=path['basename'](PATH,_0x94d6('0x21'));var _0x4c5f42=_0x563cbe[_0x94d6('0x18')]&&_0x3fd704[_0x94d6('0x19')]>0x1;var _0x30face=[];if(!fs[_0x94d6('0x22')](path[_0x94d6('0x23')](_0x14b8b6,_0x4225a0))&&_0x4c5f42){fs[_0x94d6('0x24')](path['join'](_0x14b8b6,_0x4225a0));}return BPromise[_0x94d6('0x25')](_0x3fd704,function(_0x167dc0){_0x30face[_0x94d6('0x1f')](_0x167dc0);})[_0x94d6('0x11')](function(){for(var _0x137784=0x0;_0x137784<_0x30face['length'];_0x137784+=0x1){var _0x3f829c;var _0x359d0d=_0x30face[_0x137784];if(_0x4c5f42){_0x3f829c=path[_0x94d6('0x23')](_0x14b8b6,_0x4225a0,util[_0x94d6('0x14')]('%s%d.%s',_0x4225a0,_0x137784,_0x94d6('0x26')));}else{_0x3f829c=path['join'](_0x14b8b6,util[_0x94d6('0x14')](_0x94d6('0x27'),_0x4225a0,_0x94d6('0x26')));}fs[_0x94d6('0x28')](_0x3f829c,csv(_0x359d0d));}})[_0x94d6('0x11')](function(){if(_0x4c5f42){return new Promise(function(_0x48331f){zipdir(path[_0x94d6('0x23')](_0x14b8b6,_0x4225a0),{'saveTo':path[_0x94d6('0x23')](_0x14b8b6,util[_0x94d6('0x14')]('%s.%s',_0x4225a0,_0x94d6('0x29')))},function(_0xa17d79,_0xfea242){rimraf(path['join'](_0x14b8b6,_0x4225a0),function(){});_0x48331f(_0x94d6('0x2a'));});});}})[_0x94d6('0x11')](function(){logger[_0x94d6('0xb')](util[_0x94d6('0x14')](_0x94d6('0x2b'),EXTRACTED_REPORT_ID,_0x94d6('0xd')));return analyticExtractedReport(_0x94d6('0x2c'),_0x4c5f42?util[_0x94d6('0x14')](_0x94d6('0x27'),_0x4225a0,_0x4c5f42?_0x94d6('0x29'):_0x94d6('0x26')):null);});})[_0x94d6('0x2d')](function(_0x8747e3){logger[_0x94d6('0xb')](util[_0x94d6('0x14')](_0x94d6('0x2e'),EXTRACTED_REPORT_ID,_0x94d6('0xd')),util['inspect'](_0x8747e3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x94d6('0x2f'));})['finally'](function(){process[_0x94d6('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2d00=['splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','length','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d00,0x7e));var _0x02d0=function(_0x519ef0,_0x46b0f4){_0x519ef0=_0x519ef0-0x0;var _0x515dda=_0x2d00[_0x519ef0];return _0x515dda;};'use strict';var util=require(_0x02d0('0x0'));var path=require(_0x02d0('0x1'));var _=require(_0x02d0('0x2'));var csv=require(_0x02d0('0x3'));var fs=require('fs');var BPromise=require(_0x02d0('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x02d0('0x5'));var db=require(_0x02d0('0x6'))['db'];var dbH=require(_0x02d0('0x6'))[_0x02d0('0x7')];var logger=require('../../config/logger')(_0x02d0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x02d0('0x9')][0x2]);var QUERY=process[_0x02d0('0x9')][0x3];var PATH=process[_0x02d0('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc820cb,_0xc57c3b){var _0x5ea8b6={'status':_0xc820cb};var _0x8ee35e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xc57c3b){_0x5ea8b6['savename']=_0xc57c3b;}return db[_0x02d0('0xa')][_0x02d0('0xb')](_0x5ea8b6,_0x8ee35e);}function main(){var _0x1763f6=0x1388;var _0x3b7fdf;logger[_0x02d0('0xc')](util[_0x02d0('0xd')](_0x02d0('0xe'),EXTRACTED_REPORT_ID,_0x02d0('0xf')));return db['Setting'][_0x02d0('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x02d0('0x11')](function(_0x215475){if(_0x215475){_0x3b7fdf=_0x215475;_0x1763f6=_0x3b7fdf[_0x02d0('0x12')]||0x1388;}})[_0x02d0('0x11')](function(){return dbH['sequelize'][_0x02d0('0x13')](util['format'](_0x02d0('0x14'),QUERY),{'type':dbH[_0x02d0('0x15')][_0x02d0('0x16')][_0x02d0('0x17')]});})[_0x02d0('0x11')](function(_0x45fb8d){if(!_0x45fb8d[0x0][_0x02d0('0x18')]){return analyticExtractedReport(_0x02d0('0x19'));}var _0x4a843c=[];var _0x46be90=0x0;if(_0x3b7fdf[_0x02d0('0x1a')]){if(_0x45fb8d&&_0x45fb8d['length']){var _0x5911ed=_[_0x02d0('0x1b')](_0x45fb8d[0x0]['num']/_0x1763f6);var _0x365901=Number[_0x02d0('0x1c')](_0x45fb8d[0x0][_0x02d0('0x18')]/_0x1763f6)?_0x45fb8d[0x0][_0x02d0('0x18')]%_0x1763f6:0x0;_0x5911ed[_0x02d0('0x1d')](function(_0x2b4017){if(_0x2b4017>0x0){_0x46be90+=_0x1763f6;}_0x4a843c[_0x02d0('0x1e')](dbH[_0x02d0('0x15')][_0x02d0('0x13')](util['format'](_0x02d0('0x1f'),QUERY,_0x1763f6,_0x46be90),{'type':dbH[_0x02d0('0x15')][_0x02d0('0x16')][_0x02d0('0x17')]}));});if(_0x365901>0x0){_0x46be90+=_0x1763f6;_0x4a843c[_0x02d0('0x1e')](dbH[_0x02d0('0x15')]['query'](util[_0x02d0('0xd')](_0x02d0('0x1f'),QUERY,_0x365901,_0x46be90),{'type':dbH[_0x02d0('0x15')]['QueryTypes'][_0x02d0('0x17')]}));}}}else{_0x4a843c[_0x02d0('0x1e')](dbH[_0x02d0('0x15')][_0x02d0('0x13')](QUERY,{'type':dbH['sequelize'][_0x02d0('0x16')][_0x02d0('0x17')]}));}var _0x5df2b4=path['dirname'](PATH);var _0x41c670=path['basename'](PATH,_0x02d0('0x20'));var _0x2373b3=_0x3b7fdf[_0x02d0('0x1a')]&&_0x4a843c[_0x02d0('0x21')]>0x1;var _0x4f68ef=[];if(!fs[_0x02d0('0x22')](path[_0x02d0('0x23')](_0x5df2b4,_0x41c670))&&_0x2373b3){fs['mkdirSync'](path[_0x02d0('0x23')](_0x5df2b4,_0x41c670));}return BPromise['each'](_0x4a843c,function(_0x45a910){_0x4f68ef[_0x02d0('0x1e')](_0x45a910);})['then'](function(){for(var _0x444e08=0x0;_0x444e08<_0x4f68ef[_0x02d0('0x21')];_0x444e08+=0x1){var _0x197dc5;var _0x3f6da8=_0x4f68ef[_0x444e08];if(_0x2373b3){_0x197dc5=path[_0x02d0('0x23')](_0x5df2b4,_0x41c670,util['format'](_0x02d0('0x24'),_0x41c670,_0x444e08,_0x02d0('0x25')));}else{_0x197dc5=path[_0x02d0('0x23')](_0x5df2b4,util[_0x02d0('0xd')](_0x02d0('0x26'),_0x41c670,_0x02d0('0x25')));}fs[_0x02d0('0x27')](_0x197dc5,csv(_0x3f6da8));}})[_0x02d0('0x11')](function(){if(_0x2373b3){return new Promise(function(_0x5a75cc){zipdir(path['join'](_0x5df2b4,_0x41c670),{'saveTo':path[_0x02d0('0x23')](_0x5df2b4,util[_0x02d0('0xd')](_0x02d0('0x26'),_0x41c670,_0x02d0('0x28')))},function(_0x295aa8,_0x3c4d32){rimraf(path[_0x02d0('0x23')](_0x5df2b4,_0x41c670),function(){});_0x5a75cc(_0x02d0('0x29'));});});}})[_0x02d0('0x11')](function(){logger[_0x02d0('0xc')](util[_0x02d0('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x02d0('0x2a'),_0x2373b3?util[_0x02d0('0xd')](_0x02d0('0x26'),_0x41c670,_0x2373b3?_0x02d0('0x28'):'csv'):null);});})[_0x02d0('0x2b')](function(_0x13e225){logger[_0x02d0('0xc')](util[_0x02d0('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x02d0('0xf')),util[_0x02d0('0x2c')](_0x13e225,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x02d0('0x2d'));})[_0x02d0('0x2e')](function(){process[_0x02d0('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a4684fa..bd93c69 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 _0x2cea=['startDate','pageBreak','before','margin','landscape','footer','Arial','black','right','num','Empty','Setting','split','then','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','info','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','fill','length','auto','push','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name'];(function(_0xd0a0ae,_0x239a61){var _0x4da1a4=function(_0x10554c){while(--_0x10554c){_0xd0a0ae['push'](_0xd0a0ae['shift']());}};_0x4da1a4(++_0x239a61);}(_0x2cea,0x13f));var _0xa2ce=function(_0xbe3ef8,_0x2a9242){_0xbe3ef8=_0xbe3ef8-0x0;var _0x191461=_0x2cea[_0xbe3ef8];return _0x191461;};'use strict';var _=require(_0xa2ce('0x0'));var fs=require('fs');var util=require(_0xa2ce('0x1'));var path=require(_0xa2ce('0x2'));var moment=require(_0xa2ce('0x3'));var htmlToPdfmake=require(_0xa2ce('0x4'));var PdfPrinter=require(_0xa2ce('0x5'));var zipdir=require(_0xa2ce('0x6'));var rimraf=require(_0xa2ce('0x7'));var JSDOM=require(_0xa2ce('0x8'))['JSDOM'];var window=new JSDOM('')[_0xa2ce('0x9')];var BPromise=require('bluebird');var db=require(_0xa2ce('0xa'))['db'];var dbH=require(_0xa2ce('0xa'))[_0xa2ce('0xb')];var logger=require(_0xa2ce('0xc'))(_0xa2ce('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa2ce('0xe')][0x2]);var QUERY=process[_0xa2ce('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xa2ce('0xe')][0x5];var FORMAT=_0xa2ce('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c0fb6,_0x5dd024){var _0x2c7944={'status':_0x3c0fb6};var _0x50a050={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5dd024){_0x2c7944[_0xa2ce('0x10')]=_0x5dd024;}return db['AnalyticExtractedReport'][_0xa2ce('0x11')](_0x2c7944,_0x50a050);}function getHeaders(_0x17634b){return _[_0xa2ce('0x12')](_0x17634b,function(_0x37c1e2){return{'text':_0x37c1e2,'style':_0xa2ce('0x13')};});}function getRows(_0xa21ac8,_0x29f0e4){return _[_0xa2ce('0x12')](_0x29f0e4,function(_0x43ab65){return _(_0x43ab65)[_0xa2ce('0x14')](_0xa21ac8)[_0xa2ce('0x12')](function(_0x1bcf97){return _0x1bcf97?_[_0xa2ce('0x15')](_0x1bcf97):'';})['value']();});}function createTable(_0x1509f9,_0x3e38f9){var _0x1bc548={'widths':_[_0xa2ce('0x16')](Array(_0x1509f9[_0xa2ce('0x17')]),0x91),'heights':function(_0x29ed06){return _0x29ed06===0x0?_0xa2ce('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x33d171=getHeaders(_0x1509f9);_0x1bc548['body'][_0xa2ce('0x19')](_0x33d171);var _0x4fd07b=getRows(_0x1509f9,_0x3e38f9);_0x1bc548[_0xa2ce('0x1a')]=_0x1bc548[_0xa2ce('0x1a')][_0xa2ce('0x1b')](_0x4fd07b);return _0x1bc548;}function createTables(_0x1c3a31){var _0x2d83be=[];var _0x4c924a=_[_0xa2ce('0x1c')](Object[_0xa2ce('0x1d')](_0x1c3a31[0x0]),0x5);_0x4c924a['forEach'](function(_0x3a319a){_0x2d83be[_0xa2ce('0x19')](createTable(_0x3a319a,_0x1c3a31));});return _0x2d83be;}function getPDFDocDefinition(_0x865781){var _0x59906c=util[_0xa2ce('0x1e')](_0xa2ce('0x1f'),NAME,EXTRACTED_REPORT[_0xa2ce('0x20')],moment(EXTRACTED_REPORT[_0xa2ce('0x21')])[_0xa2ce('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa2ce('0x1e')](FORMAT));var _0x4badc8=[];for(var _0x216d5a=0x0;_0x216d5a<_0x865781[_0xa2ce('0x17')];_0x216d5a++){var _0x343706=[];if(_0x216d5a===0x0){_0x343706[_0xa2ce('0x19')]({'text':_0x59906c,'style':'header'});}var _0x1a43bc={'table':_0x865781[_0x216d5a]};if(_0x216d5a>0x0){_0x1a43bc[_0xa2ce('0x22')]=_0xa2ce('0x23');_0x1a43bc[_0xa2ce('0x24')]=[0x0,0x46,0x0,0x0];}_0x343706[_0xa2ce('0x19')](_0x1a43bc);_0x4badc8['push'](_0x343706);}return{'pageSize':'A4','pageOrientation':_0xa2ce('0x25'),'content':_0x4badc8,'footer':function(_0x357a18,_0x20ff7a){return{'text':_0x357a18['toString']()+'\x20/\x20'+_0x20ff7a,'style':_0xa2ce('0x26')};},'defaultStyle':{'font':_0xa2ce('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa2ce('0x28')},'footer':{'alignment':_0xa2ce('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3448f9){var _0x1093b1=0x1388;var _0x1830a1;if(!_0x3448f9[0x0][_0xa2ce('0x2a')]){return analyticExtractedReport(_0xa2ce('0x2b'));}return db[_0xa2ce('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa2ce('0x2d'),'splitSizePdf']})['then'](function(_0x57eece){if(_0x57eece){_0x1830a1=_0x57eece;_0x1093b1=_0x1830a1['splitSizePdf']||0x3e8;}})[_0xa2ce('0x2e')](function(){var _0x283538=[];var _0x474daf=0x0;if(_0x1830a1[_0xa2ce('0x2d')]){if(_0x3448f9&&_0x3448f9[_0xa2ce('0x17')]){var _0x437e41=_[_0xa2ce('0x2f')](_0x3448f9[0x0][_0xa2ce('0x2a')]/_0x1093b1);var _0xb2f7a=Number[_0xa2ce('0x30')](_0x3448f9[0x0][_0xa2ce('0x2a')]/_0x1093b1)?_0x3448f9[0x0][_0xa2ce('0x2a')]%_0x1093b1:0x0;_0x437e41[_0xa2ce('0x31')](function(_0x1fdd6e){if(_0x1fdd6e>0x0){_0x474daf+=_0x1093b1;}_0x283538[_0xa2ce('0x19')](dbH[_0xa2ce('0x32')][_0xa2ce('0x33')](util[_0xa2ce('0x1e')](_0xa2ce('0x34'),QUERY,_0x1093b1,_0x474daf),{'type':dbH[_0xa2ce('0x32')][_0xa2ce('0x35')][_0xa2ce('0x36')]}));});if(_0xb2f7a>0x0){_0x474daf+=_0x1093b1;_0x283538[_0xa2ce('0x19')](dbH['sequelize'][_0xa2ce('0x33')](util[_0xa2ce('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb2f7a,_0x474daf),{'type':dbH[_0xa2ce('0x32')][_0xa2ce('0x35')]['SELECT']}));}}}else{_0x283538[_0xa2ce('0x19')](dbH['sequelize'][_0xa2ce('0x33')](QUERY,{'type':dbH['sequelize'][_0xa2ce('0x35')][_0xa2ce('0x36')]}));}var _0x25bda4=path[_0xa2ce('0x37')](PATH);var _0x5764f7=path[_0xa2ce('0x38')](PATH,'.pdf');var _0x31d279=_0x1830a1['split']&&_0x283538[_0xa2ce('0x17')]>0x1;var _0x4a88c5=[];if(!fs[_0xa2ce('0x39')](path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7))&&_0x31d279){fs[_0xa2ce('0x3b')](path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7));}return BPromise[_0xa2ce('0x3c')](_0x283538,function(_0x29a0cc){_0x4a88c5['push'](_0x29a0cc);})[_0xa2ce('0x2e')](function(){var _0x221c7e=[];for(var _0x3f2019=0x0;_0x3f2019<_0x4a88c5[_0xa2ce('0x17')];_0x3f2019+=0x1){var _0x59ed6b=_0x4a88c5[_0x3f2019];var _0x57386d=createTables(_['flatten'](_0x59ed6b));var _0x1ebb0a;var _0x221f79=getPDFDocDefinition(_0x57386d);var _0x21617a=getPDFPrinter();var _0xcf4712=_0x21617a[_0xa2ce('0x3d')](_0x221f79);if(_0x31d279){_0x1ebb0a=path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7,util['format'](_0xa2ce('0x3e'),_0x5764f7,_0x3f2019,_0xa2ce('0x3f')));}else{_0x1ebb0a=path[_0xa2ce('0x3a')](_0x25bda4,util['format']('%s.%s',_0x5764f7,_0xa2ce('0x3f')));}_0x221c7e[_0xa2ce('0x19')](writePDFDocument(_0xcf4712,_0x1ebb0a));}return Promise['all'](_0x221c7e);})[_0xa2ce('0x2e')](function(){if(_0x31d279){return new Promise(function(_0x40f9d9){zipdir(path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7),{'saveTo':path[_0xa2ce('0x3a')](_0x25bda4,util[_0xa2ce('0x1e')](_0xa2ce('0x40'),_0x5764f7,_0xa2ce('0x41')))},function(){rimraf(path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7),function(){});_0x40f9d9('zip\x20finished');});});}})['then'](function(){if(!_0x31d279)return;rimraf(path[_0xa2ce('0x3a')](_0x25bda4,_0x5764f7),function(){});})[_0xa2ce('0x2e')](function(){logger[_0xa2ce('0x42')](util[_0xa2ce('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x31d279?util[_0xa2ce('0x1e')]('%s.%s',_0x5764f7,_0x31d279?_0xa2ce('0x41'):_0xa2ce('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa2ce('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa2ce('0x43')));return db['AnalyticExtractedReport'][_0xa2ce('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa2ce('0x2e')](function(_0x2db891){EXTRACTED_REPORT=_0x2db891;return dbH[_0xa2ce('0x32')][_0xa2ce('0x33')](util[_0xa2ce('0x1e')](_0xa2ce('0x45'),QUERY),{'type':dbH[_0xa2ce('0x32')][_0xa2ce('0x35')]['SELECT']});})[_0xa2ce('0x2e')](extractReport)[_0xa2ce('0x46')](function(_0x5e2979){logger[_0xa2ce('0x42')](util[_0xa2ce('0x1e')](_0xa2ce('0x47'),EXTRACTED_REPORT_ID,'PDF'),util[_0xa2ce('0x48')](_0x5e2979,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa2ce('0x49')](function(){process[_0xa2ce('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x51a94e=new PdfPrinter({'Arial':{'normal':__dirname+_0xa2ce('0x4b'),'bold':__dirname+_0xa2ce('0x4c'),'italics':__dirname+_0xa2ce('0x4d'),'bolditalics':__dirname+_0xa2ce('0x4e')}});return _0x51a94e;}function getPDFDocDefinitionFromHTML(_0x36b2f5,_0x1a4768){var _0x2a2fd4=util[_0xa2ce('0x1e')]('%s\x20#%d',_0x1a4768['channel'],_0x1a4768[_0xa2ce('0x4f')]);var _0xe64d4d=moment()[_0xa2ce('0x1e')]('YYYY-MM-DD')[_0xa2ce('0x15')]();var _0x2c1cab=htmlToPdfmake(_0x36b2f5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c1cab],'defaultStyle':{'font':_0xa2ce('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa2ce('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa2ce('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa2ce('0x50')}},'header':function(){return[{'text':_0xa2ce('0x51'),'style':_0xa2ce('0x52')}];},'footer':function(_0x1e7ea9,_0x1f712b){return[{'text':util[_0xa2ce('0x1e')](_0xa2ce('0x53'),_0x2a2fd4,_0x1e7ea9,_0x1f712b,_0xe64d4d),'style':_0xa2ce('0x26')}];}};}function writePDFDocument(_0x216669,_0x47a12d){return new Promise(function(_0x3a37c7,_0x2cb3e6){var _0x57a581=_0x216669[_0xa2ce('0x54')](fs[_0xa2ce('0x55')](_0x47a12d));_0x57a581['on'](_0xa2ce('0x56'),function(){_0x3a37c7('finish');});_0x57a581['on']('error',function(_0x22a337){_0x2cb3e6(_0x22a337);});_0x216669['end']();});}exports[_0xa2ce('0x57')]=function(_0x1f5ce2,_0x40d36f){var _0x155c22=getPDFPrinter();var _0x1aeefd=getPDFDocDefinitionFromHTML(_0x1f5ce2,_0x40d36f);var _0x407d81=_0x155c22[_0xa2ce('0x3d')](_0x1aeefd);return writePDFDocument(_0x407d81,_0x40d36f[_0xa2ce('0x2')])[_0xa2ce('0x46')](function(_0x40aeff){throw _0x40aeff;});}; \ No newline at end of file +var _0x9751=['pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Setting','find','then','splitSizePdf','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','join','each','flatten','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake'];(function(_0xa6ec3f,_0x13bc99){var _0x1d55e2=function(_0x253954){while(--_0x253954){_0xa6ec3f['push'](_0xa6ec3f['shift']());}};_0x1d55e2(++_0x13bc99);}(_0x9751,0x112));var _0x1975=function(_0x454b36,_0x74cac4){_0x454b36=_0x454b36-0x0;var _0x389b43=_0x9751[_0x454b36];return _0x389b43;};'use strict';var _=require(_0x1975('0x0'));var fs=require('fs');var util=require(_0x1975('0x1'));var path=require(_0x1975('0x2'));var moment=require(_0x1975('0x3'));var htmlToPdfmake=require(_0x1975('0x4'));var PdfPrinter=require(_0x1975('0x5'));var zipdir=require(_0x1975('0x6'));var rimraf=require(_0x1975('0x7'));var JSDOM=require(_0x1975('0x8'))[_0x1975('0x9')];var window=new JSDOM('')[_0x1975('0xa')];var BPromise=require('bluebird');var db=require(_0x1975('0xb'))['db'];var dbH=require(_0x1975('0xb'))[_0x1975('0xc')];var logger=require(_0x1975('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1975('0xe')][0x2]);var QUERY=process[_0x1975('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x1975('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x102072,_0x5d1b5e){var _0x3b1685={'status':_0x102072};var _0x5673c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5d1b5e){_0x3b1685[_0x1975('0x10')]=_0x5d1b5e;}return db[_0x1975('0x11')][_0x1975('0x12')](_0x3b1685,_0x5673c0);}function getHeaders(_0x3093db){return _[_0x1975('0x13')](_0x3093db,function(_0x2938fb){return{'text':_0x2938fb,'style':'tableHeader'};});}function getRows(_0x5bf2c4,_0x4db09a){return _['map'](_0x4db09a,function(_0x343dd0){return _(_0x343dd0)[_0x1975('0x14')](_0x5bf2c4)[_0x1975('0x13')](function(_0x1a967f){return _0x1a967f?_[_0x1975('0x15')](_0x1a967f):'';})['value']();});}function createTable(_0x3538c3,_0x1b7355){var _0x1058a2={'widths':_[_0x1975('0x16')](Array(_0x3538c3[_0x1975('0x17')]),0x91),'heights':function(_0x274cb6){return _0x274cb6===0x0?_0x1975('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x49304a=getHeaders(_0x3538c3);_0x1058a2[_0x1975('0x19')][_0x1975('0x1a')](_0x49304a);var _0x574068=getRows(_0x3538c3,_0x1b7355);_0x1058a2[_0x1975('0x19')]=_0x1058a2[_0x1975('0x19')]['concat'](_0x574068);return _0x1058a2;}function createTables(_0x424535){var _0x3f47f8=[];var _0x20b458=_[_0x1975('0x1b')](Object[_0x1975('0x1c')](_0x424535[0x0]),0x5);_0x20b458[_0x1975('0x1d')](function(_0x2986be){_0x3f47f8[_0x1975('0x1a')](createTable(_0x2986be,_0x424535));});return _0x3f47f8;}function getPDFDocDefinition(_0x78a320){var _0x75aa36=util[_0x1975('0x1e')](_0x1975('0x1f'),NAME,EXTRACTED_REPORT[_0x1975('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0x1975('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x1975('0x1e')](FORMAT));var _0x5ee83=[];for(var _0x1b848c=0x0;_0x1b848c<_0x78a320[_0x1975('0x17')];_0x1b848c++){var _0xa6c6f4=[];if(_0x1b848c===0x0){_0xa6c6f4['push']({'text':_0x75aa36,'style':_0x1975('0x21')});}var _0x2d84fc={'table':_0x78a320[_0x1b848c]};if(_0x1b848c>0x0){_0x2d84fc[_0x1975('0x22')]=_0x1975('0x23');_0x2d84fc[_0x1975('0x24')]=[0x0,0x46,0x0,0x0];}_0xa6c6f4[_0x1975('0x1a')](_0x2d84fc);_0x5ee83[_0x1975('0x1a')](_0xa6c6f4);}return{'pageSize':'A4','pageOrientation':_0x1975('0x25'),'content':_0x5ee83,'footer':function(_0x1b3378,_0x50e616){return{'text':_0x1b3378[_0x1975('0x15')]()+_0x1975('0x26')+_0x50e616,'style':_0x1975('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1975('0x28')},'footer':{'alignment':_0x1975('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3d1763){var _0x281fdd=0x1388;var _0x337427;if(!_0x3d1763[0x0][_0x1975('0x2a')]){return analyticExtractedReport('Empty');}return db[_0x1975('0x2b')][_0x1975('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x1975('0x2d')](function(_0x71b743){if(_0x71b743){_0x337427=_0x71b743;_0x281fdd=_0x337427[_0x1975('0x2e')]||0x3e8;}})['then'](function(){var _0x5324e4=[];var _0x2ed128=0x0;if(_0x337427[_0x1975('0x2f')]){if(_0x3d1763&&_0x3d1763['length']){var _0x181e49=_[_0x1975('0x30')](_0x3d1763[0x0]['num']/_0x281fdd);var _0x26d085=Number[_0x1975('0x31')](_0x3d1763[0x0]['num']/_0x281fdd)?_0x3d1763[0x0][_0x1975('0x2a')]%_0x281fdd:0x0;_0x181e49['forEach'](function(_0x4e5143){if(_0x4e5143>0x0){_0x2ed128+=_0x281fdd;}_0x5324e4[_0x1975('0x1a')](dbH[_0x1975('0x32')][_0x1975('0x33')](util[_0x1975('0x1e')](_0x1975('0x34'),QUERY,_0x281fdd,_0x2ed128),{'type':dbH[_0x1975('0x32')]['QueryTypes']['SELECT']}));});if(_0x26d085>0x0){_0x2ed128+=_0x281fdd;_0x5324e4[_0x1975('0x1a')](dbH[_0x1975('0x32')][_0x1975('0x33')](util[_0x1975('0x1e')](_0x1975('0x34'),QUERY,_0x26d085,_0x2ed128),{'type':dbH['sequelize']['QueryTypes'][_0x1975('0x35')]}));}}}else{_0x5324e4['push'](dbH[_0x1975('0x32')][_0x1975('0x33')](QUERY,{'type':dbH[_0x1975('0x32')][_0x1975('0x36')][_0x1975('0x35')]}));}var _0x1b1f6d=path[_0x1975('0x37')](PATH);var _0x54bc9b=path['basename'](PATH,'.pdf');var _0x34c39d=_0x337427[_0x1975('0x2f')]&&_0x5324e4[_0x1975('0x17')]>0x1;var _0x371e5e=[];if(!fs['existsSync'](path[_0x1975('0x38')](_0x1b1f6d,_0x54bc9b))&&_0x34c39d){fs['mkdirSync'](path['join'](_0x1b1f6d,_0x54bc9b));}return BPromise[_0x1975('0x39')](_0x5324e4,function(_0x3c2f33){_0x371e5e[_0x1975('0x1a')](_0x3c2f33);})['then'](function(){var _0x14e478=[];for(var _0x3293b6=0x0;_0x3293b6<_0x371e5e['length'];_0x3293b6+=0x1){var _0xe41667=_0x371e5e[_0x3293b6];var _0x5c3fef=createTables(_[_0x1975('0x3a')](_0xe41667));var _0x3dbe1f;var _0x3f0a5d=getPDFDocDefinition(_0x5c3fef);var _0x3a238c=getPDFPrinter();var _0xdac494=_0x3a238c['createPdfKitDocument'](_0x3f0a5d);if(_0x34c39d){_0x3dbe1f=path['join'](_0x1b1f6d,_0x54bc9b,util['format'](_0x1975('0x3b'),_0x54bc9b,_0x3293b6,'pdf'));}else{_0x3dbe1f=path[_0x1975('0x38')](_0x1b1f6d,util[_0x1975('0x1e')](_0x1975('0x3c'),_0x54bc9b,_0x1975('0x3d')));}_0x14e478['push'](writePDFDocument(_0xdac494,_0x3dbe1f));}return Promise[_0x1975('0x3e')](_0x14e478);})[_0x1975('0x2d')](function(){if(_0x34c39d){return new Promise(function(_0x1f3f65){zipdir(path[_0x1975('0x38')](_0x1b1f6d,_0x54bc9b),{'saveTo':path['join'](_0x1b1f6d,util['format'](_0x1975('0x3c'),_0x54bc9b,_0x1975('0x3f')))},function(){rimraf(path['join'](_0x1b1f6d,_0x54bc9b),function(){});_0x1f3f65(_0x1975('0x40'));});});}})['then'](function(){if(!_0x34c39d)return;rimraf(path['join'](_0x1b1f6d,_0x54bc9b),function(){});})['then'](function(){logger['info'](util[_0x1975('0x1e')](_0x1975('0x41'),EXTRACTED_REPORT_ID,_0x1975('0x42')));return analyticExtractedReport(_0x1975('0x43'),_0x34c39d?util[_0x1975('0x1e')](_0x1975('0x3c'),_0x54bc9b,_0x34c39d?_0x1975('0x3f'):_0x1975('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1975('0x44')](util['format'](_0x1975('0x45'),EXTRACTED_REPORT_ID,_0x1975('0x42')));return db[_0x1975('0x11')][_0x1975('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x60f98e){EXTRACTED_REPORT=_0x60f98e;return dbH[_0x1975('0x32')]['query'](util[_0x1975('0x1e')](_0x1975('0x47'),QUERY),{'type':dbH[_0x1975('0x32')]['QueryTypes'][_0x1975('0x35')]});})[_0x1975('0x2d')](extractReport)[_0x1975('0x48')](function(_0x41c6c8){logger[_0x1975('0x44')](util[_0x1975('0x1e')](_0x1975('0x49'),EXTRACTED_REPORT_ID,_0x1975('0x42')),util[_0x1975('0x4a')](_0x41c6c8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1975('0x4b'));})[_0x1975('0x4c')](function(){process[_0x1975('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3501f9=new PdfPrinter({'Arial':{'normal':__dirname+_0x1975('0x4e'),'bold':__dirname+_0x1975('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1975('0x50')}});return _0x3501f9;}function getPDFDocDefinitionFromHTML(_0x397bb9,_0x39fad6){var _0xdd3109=util['format']('%s\x20#%d',_0x39fad6[_0x1975('0x51')],_0x39fad6[_0x1975('0x52')]);var _0x9dd8ed=moment()[_0x1975('0x1e')](_0x1975('0x53'))[_0x1975('0x15')]();var _0x24d2c0=htmlToPdfmake(_0x397bb9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x24d2c0],'defaultStyle':{'font':_0x1975('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1975('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1975('0x55')}},'header':function(){return[{'text':_0x1975('0x56'),'style':_0x1975('0x21')}];},'footer':function(_0x14cc21,_0x2d0e6c){return[{'text':util['format'](_0x1975('0x57'),_0xdd3109,_0x14cc21,_0x2d0e6c,_0x9dd8ed),'style':_0x1975('0x27')}];}};}function writePDFDocument(_0x1355b5,_0x20fea1){return new Promise(function(_0x42d31c,_0x33fd8a){var _0x66594d=_0x1355b5['pipe'](fs['createWriteStream'](_0x20fea1));_0x66594d['on'](_0x1975('0x58'),function(){_0x42d31c(_0x1975('0x58'));});_0x66594d['on'](_0x1975('0x59'),function(_0x35119e){_0x33fd8a(_0x35119e);});_0x1355b5[_0x1975('0x5a')]();});}exports[_0x1975('0x5b')]=function(_0x149832,_0x206d83){var _0x4582bb=getPDFPrinter();var _0x371609=getPDFDocDefinitionFromHTML(_0x149832,_0x206d83);var _0x267b82=_0x4582bb[_0x1975('0x5c')](_0x371609);return writePDFDocument(_0x267b82,_0x206d83['path'])['catch'](function(_0xf0518b){throw _0xf0518b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 260fefa..40a594b 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 _0x86e6=['argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','then','Empty','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x86e6,0x1c2));var _0x686e=function(_0x4fc950,_0x578ece){_0x4fc950=_0x4fc950-0x0;var _0x936099=_0x86e6[_0x4fc950];return _0x936099;};'use strict';var util=require(_0x686e('0x0'));var path=require('path');var _=require(_0x686e('0x1'));var fs=require('fs');var json2xls=require(_0x686e('0x2'));var BPromise=require(_0x686e('0x3'));var zipdir=require(_0x686e('0x4'));var rimraf=require(_0x686e('0x5'));var db=require(_0x686e('0x6'))['db'];var dbH=require(_0x686e('0x6'))['dbH'];var logger=require(_0x686e('0x7'))(_0x686e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x686e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x686e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x38e24e,_0x2ef32a){var _0xa0d70b={'status':_0x38e24e};var _0xa0011b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ef32a){_0xa0d70b[_0x686e('0xa')]=_0x2ef32a;}return db[_0x686e('0xb')][_0x686e('0xc')](_0xa0d70b,_0xa0011b);}function main(){var _0x905399=0x1388;var _0x2ef402;logger[_0x686e('0xd')](util[_0x686e('0xe')](_0x686e('0xf'),EXTRACTED_REPORT_ID,_0x686e('0x10')));return db['Setting'][_0x686e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x686e('0x12'),_0x686e('0x13')]})['then'](function(_0x2ae388){if(_0x2ae388){_0x2ef402=_0x2ae388;_0x905399=_0x2ef402[_0x686e('0x13')]||0x1388;}})['then'](function(){return dbH[_0x686e('0x14')]['query'](util[_0x686e('0xe')](_0x686e('0x15'),QUERY),{'type':dbH[_0x686e('0x14')]['QueryTypes'][_0x686e('0x16')]});})[_0x686e('0x17')](function(_0x3c2f9d){if(!_0x3c2f9d[0x0]['num']){return analyticExtractedReport(_0x686e('0x18'));}var _0x358d54=[];var _0x23dc67=0x0;if(_0x2ef402[_0x686e('0x12')]){if(_0x3c2f9d&&_0x3c2f9d[_0x686e('0x19')]){var _0x4a5199=_[_0x686e('0x1a')](_0x3c2f9d[0x0][_0x686e('0x1b')]/_0x905399);var _0x32b25e=Number[_0x686e('0x1c')](_0x3c2f9d[0x0][_0x686e('0x1b')]/_0x905399)?_0x3c2f9d[0x0]['num']%_0x905399:0x0;_0x4a5199[_0x686e('0x1d')](function(_0x58c430){if(_0x58c430>0x0){_0x23dc67+=_0x905399;}_0x358d54[_0x686e('0x1e')](dbH['sequelize'][_0x686e('0x1f')](util['format'](_0x686e('0x20'),QUERY,_0x905399,_0x23dc67),{'type':dbH['sequelize'][_0x686e('0x21')][_0x686e('0x16')]}));});if(_0x32b25e>0x0){_0x23dc67+=_0x905399;_0x358d54['push'](dbH['sequelize'][_0x686e('0x1f')](util[_0x686e('0xe')](_0x686e('0x20'),QUERY,_0x32b25e,_0x23dc67),{'type':dbH['sequelize']['QueryTypes'][_0x686e('0x16')]}));}}}else{_0x358d54[_0x686e('0x1e')](dbH[_0x686e('0x14')][_0x686e('0x1f')](QUERY,{'type':dbH[_0x686e('0x14')][_0x686e('0x21')][_0x686e('0x16')]}));}var _0x20d55e=path[_0x686e('0x22')](PATH);var _0x2f9cf9=path['basename'](PATH,'.xlsx');var _0x3e2040=_0x2ef402[_0x686e('0x12')]&&_0x358d54[_0x686e('0x19')]>0x1;var _0x51775b=[];if(!fs['existsSync'](path['join'](_0x20d55e,_0x2f9cf9))&&_0x3e2040){fs[_0x686e('0x23')](path[_0x686e('0x24')](_0x20d55e,_0x2f9cf9));}return BPromise[_0x686e('0x25')](_0x358d54,function(_0x5b527e){_0x51775b[_0x686e('0x1e')](_0x5b527e);})['then'](function(){for(var _0x278093=0x0;_0x278093<_0x51775b[_0x686e('0x19')];_0x278093+=0x1){var _0xf3be03;var _0x4f2a7e=_0x51775b[_0x278093];if(_0x3e2040){_0xf3be03=path[_0x686e('0x24')](_0x20d55e,_0x2f9cf9,util[_0x686e('0xe')](_0x686e('0x26'),_0x2f9cf9,_0x278093,'xlsx'));}else{_0xf3be03=path[_0x686e('0x24')](_0x20d55e,util[_0x686e('0xe')](_0x686e('0x27'),_0x2f9cf9,_0x686e('0x28')));}fs[_0x686e('0x29')](_0xf3be03,json2xls(_0x4f2a7e),_0x686e('0x2a'));}})['then'](function(){if(_0x3e2040){return new Promise(function(_0x4894f0){zipdir(path[_0x686e('0x24')](_0x20d55e,_0x2f9cf9),{'saveTo':path[_0x686e('0x24')](_0x20d55e,util['format'](_0x686e('0x27'),_0x2f9cf9,_0x686e('0x2b')))},function(_0x4965c5,_0x51a953){rimraf(path['join'](_0x20d55e,_0x2f9cf9),function(){});_0x4894f0(_0x686e('0x2c'));});});}})[_0x686e('0x17')](function(){logger[_0x686e('0xd')](util['format'](_0x686e('0x2d'),EXTRACTED_REPORT_ID,_0x686e('0x10')));return analyticExtractedReport(_0x686e('0x2e'),_0x3e2040?util[_0x686e('0xe')](_0x686e('0x27'),_0x2f9cf9,_0x3e2040?'zip':_0x686e('0x28')):null);});})[_0x686e('0x2f')](function(_0x1043f7){logger['info'](util[_0x686e('0xe')](_0x686e('0x30'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x686e('0x31')](_0x1043f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x686e('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x49db=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','length','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49db,0xc5));var _0xb49d=function(_0x3c8b0f,_0x3fb253){_0x3c8b0f=_0x3c8b0f-0x0;var _0x7c5b52=_0x49db[_0x3c8b0f];return _0x7c5b52;};'use strict';var util=require(_0xb49d('0x0'));var path=require(_0xb49d('0x1'));var _=require(_0xb49d('0x2'));var fs=require('fs');var json2xls=require(_0xb49d('0x3'));var BPromise=require(_0xb49d('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xb49d('0x5'));var db=require(_0xb49d('0x6'))['db'];var dbH=require(_0xb49d('0x6'))['dbH'];var logger=require(_0xb49d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb49d('0x8')][0x3];var PATH=process[_0xb49d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x15f52f,_0x572ee4){var _0x12e114={'status':_0x15f52f};var _0x128caa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x572ee4){_0x12e114[_0xb49d('0x9')]=_0x572ee4;}return db[_0xb49d('0xa')][_0xb49d('0xb')](_0x12e114,_0x128caa);}function main(){var _0x66c2be=0x1388;var _0x54f285;logger['info'](util[_0xb49d('0xc')](_0xb49d('0xd'),EXTRACTED_REPORT_ID,_0xb49d('0xe')));return db[_0xb49d('0xf')][_0xb49d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb49d('0x11'),_0xb49d('0x12')]})[_0xb49d('0x13')](function(_0x2a0c8b){if(_0x2a0c8b){_0x54f285=_0x2a0c8b;_0x66c2be=_0x54f285['splitSizeXlsx']||0x1388;}})[_0xb49d('0x13')](function(){return dbH[_0xb49d('0x14')][_0xb49d('0x15')](util[_0xb49d('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb49d('0x14')][_0xb49d('0x16')]['SELECT']});})[_0xb49d('0x13')](function(_0x1f569f){if(!_0x1f569f[0x0][_0xb49d('0x17')]){return analyticExtractedReport(_0xb49d('0x18'));}var _0x1491fb=[];var _0x270298=0x0;if(_0x54f285[_0xb49d('0x11')]){if(_0x1f569f&&_0x1f569f['length']){var _0x1da77c=_[_0xb49d('0x19')](_0x1f569f[0x0][_0xb49d('0x17')]/_0x66c2be);var _0xf0bdff=Number['isInteger'](_0x1f569f[0x0]['num']/_0x66c2be)?_0x1f569f[0x0][_0xb49d('0x17')]%_0x66c2be:0x0;_0x1da77c[_0xb49d('0x1a')](function(_0x29df1c){if(_0x29df1c>0x0){_0x270298+=_0x66c2be;}_0x1491fb[_0xb49d('0x1b')](dbH[_0xb49d('0x14')]['query'](util[_0xb49d('0xc')](_0xb49d('0x1c'),QUERY,_0x66c2be,_0x270298),{'type':dbH[_0xb49d('0x14')][_0xb49d('0x16')][_0xb49d('0x1d')]}));});if(_0xf0bdff>0x0){_0x270298+=_0x66c2be;_0x1491fb[_0xb49d('0x1b')](dbH[_0xb49d('0x14')][_0xb49d('0x15')](util[_0xb49d('0xc')](_0xb49d('0x1c'),QUERY,_0xf0bdff,_0x270298),{'type':dbH[_0xb49d('0x14')][_0xb49d('0x16')][_0xb49d('0x1d')]}));}}}else{_0x1491fb[_0xb49d('0x1b')](dbH[_0xb49d('0x14')][_0xb49d('0x15')](QUERY,{'type':dbH[_0xb49d('0x14')][_0xb49d('0x16')][_0xb49d('0x1d')]}));}var _0x1ae086=path[_0xb49d('0x1e')](PATH);var _0x395c9f=path['basename'](PATH,_0xb49d('0x1f'));var _0x4b7134=_0x54f285[_0xb49d('0x11')]&&_0x1491fb[_0xb49d('0x20')]>0x1;var _0x56163c=[];if(!fs[_0xb49d('0x21')](path[_0xb49d('0x22')](_0x1ae086,_0x395c9f))&&_0x4b7134){fs[_0xb49d('0x23')](path[_0xb49d('0x22')](_0x1ae086,_0x395c9f));}return BPromise[_0xb49d('0x24')](_0x1491fb,function(_0x2276ba){_0x56163c['push'](_0x2276ba);})[_0xb49d('0x13')](function(){for(var _0xf734e1=0x0;_0xf734e1<_0x56163c[_0xb49d('0x20')];_0xf734e1+=0x1){var _0x37901b;var _0x420e63=_0x56163c[_0xf734e1];if(_0x4b7134){_0x37901b=path[_0xb49d('0x22')](_0x1ae086,_0x395c9f,util[_0xb49d('0xc')]('%s%d.%s',_0x395c9f,_0xf734e1,_0xb49d('0x25')));}else{_0x37901b=path['join'](_0x1ae086,util[_0xb49d('0xc')](_0xb49d('0x26'),_0x395c9f,_0xb49d('0x25')));}fs[_0xb49d('0x27')](_0x37901b,json2xls(_0x420e63),_0xb49d('0x28'));}})[_0xb49d('0x13')](function(){if(_0x4b7134){return new Promise(function(_0xd6d0b){zipdir(path['join'](_0x1ae086,_0x395c9f),{'saveTo':path[_0xb49d('0x22')](_0x1ae086,util[_0xb49d('0xc')](_0xb49d('0x26'),_0x395c9f,'zip'))},function(_0x5cc4e5,_0x29fda6){rimraf(path[_0xb49d('0x22')](_0x1ae086,_0x395c9f),function(){});_0xd6d0b(_0xb49d('0x29'));});});}})[_0xb49d('0x13')](function(){logger[_0xb49d('0x2a')](util[_0xb49d('0xc')](_0xb49d('0x2b'),EXTRACTED_REPORT_ID,_0xb49d('0xe')));return analyticExtractedReport('Completed',_0x4b7134?util['format'](_0xb49d('0x26'),_0x395c9f,_0x4b7134?'zip':'xlsx'):null);});})['catch'](function(_0x423399){logger[_0xb49d('0x2a')](util[_0xb49d('0xc')](_0xb49d('0x2c'),EXTRACTED_REPORT_ID,_0xb49d('0xe')),util[_0xb49d('0x2d')](_0x423399,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb49d('0x2e')](function(){process[_0xb49d('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 d1d393d..ee175c4 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 _0x4269=['inbound','CDR(routeid)=','outbound','${EXTEN:','cutdigits','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','context','VoiceExtensionId'];(function(_0xa2f589,_0x45bafd){var _0x5eef54=function(_0x351e55){while(--_0x351e55){_0xa2f589['push'](_0xa2f589['shift']());}};_0x5eef54(++_0x45bafd);}(_0x4269,0xee));var _0x9426=function(_0x1da7b,_0x3ce5ec){_0x1da7b=_0x1da7b-0x0;var _0x4bf8e3=_0x4269[_0x1da7b];return _0x4bf8e3;};'use strict';var _=require(_0x9426('0x0'));var util=require(_0x9426('0x1'));function rewrite(_0x381953,_0x284a07){var _0x119ed1=this;return _0x381953['models'][_0x9426('0x2')][_0x9426('0x3')]({'raw':!![]})[_0x9426('0x4')](function(_0x3abdd3){_0x119ed1[_0x9426('0x5')]=_0x3abdd3;return _0x381953['models'][_0x9426('0x6')][_0x9426('0x3')]({'where':{'IntervalId':_0x284a07[_0x9426('0x7')]},'raw':!![]});})['then'](function(_0x4864a6){return _0x381953[_0x9426('0x8')][_0x9426('0x6')][_0x9426('0x3')]({'where':{'exten':{'$in':_[_0x9426('0x9')](_[_0x9426('0xa')](_0x4864a6,_0x9426('0xb')))}},'order':[{'raw':_0x9426('0xc')}],'raw':!![]});})[_0x9426('0x4')](function(_0x21af05){var _0x5606bb=_[_0x9426('0xd')](_0x21af05,{'priority':'1'});var _0x5f90aa=_[_0x9426('0xd')](_0x21af05,{'isApp':0x1});var _0x2c28ef=_[_0x9426('0xe')](_0x5f90aa,_0x9426('0xb'));var _0x4972c2=[_0x9426('0xf'),_0x9426('0x10')];var _0x1c7b66=[];var _0x21bb49=[];for(var _0x14efef in _0x2c28ef){if(_0x2c28ef[_0x9426('0x11')](_0x14efef)){_0x119ed1[_0x9426('0x12')]=0x2;_0x119ed1[_0x9426('0x13')]=[];_0x119ed1[_0x9426('0x14')]=_['find'](_0x5606bb,{'exten':_0x2c28ef[_0x14efef][0x0]['exten']});_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':util['format']('CDR(type)=%s',_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')]),'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1[_0x9426('0x12')]++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});if(_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')]===_0x9426('0x1a')){_0x119ed1[_0x9426('0x13')]['push']({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x9426('0x1b')+_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')],'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1[_0x9426('0x12')]++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});}else if(_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')]===_0x9426('0x1c')){if(_0x119ed1['extension']){_0x119ed1[_0x9426('0x13')]['push']({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':'CDR(destination)='+(_0x119ed1['extension']['cutdigits']?_0x9426('0x1d')+_0x119ed1[_0x9426('0x14')][_0x9426('0x1e')]+'}':'${EXTEN}'),'context':_0x2c28ef[_0x14efef][0x0]['context'],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1[_0x9426('0x12')]++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0]['VoiceExtensionId']});}_0x119ed1['extensions'][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x9426('0x1b')+_0x2c28ef[_0x14efef][0x0]['VoiceExtensionId'],'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1[_0x9426('0x12')]++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0]['VoiceExtensionId']});var _0x5027a4=_0x119ed1['priority']++;_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5027a4+0x2)+_0x9426('0x1f')+(_0x5027a4+0x1)+')','context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0]['exten'],'priority':_0x5027a4,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});if(_0x119ed1['extension']){_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x119ed1[_0x9426('0x14')][_0x9426('0x1e')]?_0x9426('0x20')+_0x119ed1['extension'][_0x9426('0x1e')]+'}':_0x9426('0x21'),'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0]['exten'],'priority':_0x119ed1[_0x9426('0x12')]++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0]['VoiceExtensionId']});}_0x119ed1[_0x9426('0x13')]['push']({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':'outboundrouteid='+_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')],'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});if(_0x119ed1[_0x9426('0x14')]&&_0x119ed1[_0x9426('0x14')][_0x9426('0x11')]('recordingFormat')&&_0x119ed1['extension'][_0x9426('0x22')]!==_0x9426('0x23')){_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0]['type'],'app':_0x9426('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});_0x119ed1[_0x9426('0x13')]['push']({'type':_0x2c28ef[_0x14efef][0x0]['type'],'app':'Set','appdata':_0x9426('0x24')+_0x119ed1[_0x9426('0x14')]['recordingFormat']||_0x9426('0x25'),'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});}}_0x119ed1['extensions'][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x9426('0x26'),'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});_0x119ed1[_0x9426('0x13')]['push']({'type':_0x2c28ef[_0x14efef][0x0][_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'exten':_0x2c28ef[_0x14efef][0x0][_0x9426('0xb')],'priority':_0x119ed1['priority']++,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});for(var _0x12ce6b=0x0,_0x2debc0=0x0;_0x12ce6b<_0x2c28ef[_0x14efef][_0x9426('0x27')];_0x12ce6b+=0x1,_0x2debc0=0x0){var _0x5ed3a6=_0x2c28ef[_0x14efef][_0x12ce6b];if(_0x5ed3a6[_0x9426('0x16')]){_0x5ed3a6[_0x9426('0x16')]=_0x5ed3a6[_0x9426('0x16')][_0x9426('0x28')]();}var _0x51ae81=[];var _0x15e454=[];delete _0x5ed3a6['id'];delete _0x5ed3a6['createdAt'];delete _0x5ed3a6[_0x9426('0x29')];var _0x103b36=_0x5ed3a6[_0x9426('0x2a')]!==_0x9426('0x2b')?[_0x5ed3a6['interval']]:_0x5ed3a6[_0x9426('0x7')]?_[_0x9426('0xa')](_[_0x9426('0xd')](_0x119ed1[_0x9426('0x5')],{'IntervalId':_0x5ed3a6['IntervalId']}),_0x9426('0x2a')):[];if(_0x5ed3a6[_0x9426('0x11')](_0x9426('0x2c'))){if(_0x5ed3a6['tag']&&_0x5ed3a6[_0x9426('0x2c')]!=='--'){_0x51ae81[_0x9426('0x15')]({'type':_0x5ed3a6[_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x9426('0x2d')+_0x5ed3a6[_0x9426('0x2c')],'context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36[_0x9426('0x27')]+_0x119ed1[_0x9426('0x12')]+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});}}if(_0x5ed3a6[_0x9426('0x16')]===_0x9426('0x1c')&&_0x5ed3a6[_0x9426('0x11')](_0x9426('0x2e'))){if(_0x5ed3a6[_0x9426('0x2e')]){_0x51ae81[_0x9426('0x15')]({'type':_0x5ed3a6[_0x9426('0x16')],'app':_0x9426('0x2f'),'appdata':_0x9426('0x30')+_0x5ed3a6[_0x9426('0x2e')]+')','context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6['exten'],'priority':_0x103b36['length']+_0x119ed1[_0x9426('0x12')]+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});}else{_0x51ae81['push']({'type':_0x5ed3a6['type'],'app':_0x9426('0x2f'),'appdata':_0x9426('0x31'),'context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36['length']+_0x119ed1[_0x9426('0x12')]+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});}}if(_0x5ed3a6['hasOwnProperty'](_0x9426('0x32'))){if(_0x4972c2[_0x9426('0x33')](_0x5ed3a6[_0x9426('0x34')][_0x9426('0x28')]())>=0x0&&_0x5ed3a6['appType']!==_0x9426('0x35')){if(_0x5ed3a6['answer']){_0x51ae81[_0x9426('0x15')]({'type':_0x5ed3a6['type'],'app':'ExecIf','appdata':_0x9426('0x36'),'context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36['length']+_0x119ed1[_0x9426('0x12')]+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6['VoiceExtensionId']});_0x51ae81[_0x9426('0x15')]({'type':_0x5ed3a6[_0x9426('0x16')],'app':'Set','appdata':_0x9426('0x37'),'context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36[_0x9426('0x27')]+_0x119ed1['priority']+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});}else{_0x51ae81[_0x9426('0x15')]({'type':_0x5ed3a6[_0x9426('0x16')],'app':_0x9426('0x2f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5ed3a6['context'],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36[_0x9426('0x27')]+_0x119ed1[_0x9426('0x12')]+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});_0x51ae81['push']({'type':_0x5ed3a6[_0x9426('0x16')],'app':_0x9426('0x17'),'appdata':_0x9426('0x38'),'context':_0x5ed3a6[_0x9426('0x18')],'exten':_0x5ed3a6[_0x9426('0xb')],'priority':_0x103b36[_0x9426('0x27')]+_0x119ed1['priority']+_0x2debc0++,'VoiceExtensionId':_0x5ed3a6[_0x9426('0x19')]});}}}for(var _0x582247=0x0;_0x582247<_0x103b36['length'];_0x582247+=0x1){var _0x5561ed=_0x119ed1[_0x9426('0x12')]+_0x103b36[_0x9426('0x27')];var _0x46edd9=_0x582247===_0x103b36[_0x9426('0x27')]-0x1?_0x119ed1[_0x9426('0x12')]+_0x51ae81['length']+_0x15e454[_0x9426('0x27')]+0x2:_0x119ed1[_0x9426('0x12')]+_0x582247+0x1;_0x51ae81[_0x9426('0x39')](_0x582247,0x0,{'type':_0x5ed3a6[_0x9426('0x16')],'app':_0x9426('0x3a'),'appdata':_0x103b36[_0x582247]+'?'+_0x5ed3a6['context']+',${EXTEN},'+_0x5561ed+':'+_0x5ed3a6[_0x9426('0x18')]+_0x9426('0x3b')+_0x46edd9,'exten':_0x5ed3a6[_0x9426('0xb')],'context':_0x5ed3a6[_0x9426('0x18')],'priority':_0x119ed1[_0x9426('0x12')]+_0x582247,'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});}_0x5ed3a6[_0x9426('0x12')]=_0x51ae81[_0x9426('0x27')]?_[_0x9426('0x3c')](_0x51ae81)['priority']+0x1:_0x119ed1[_0x9426('0x12')];_0x119ed1[_0x9426('0x12')]=(_0x15e454[_0x9426('0x27')]?_[_0x9426('0x3c')](_0x15e454)[_0x9426('0x12')]:_0x5ed3a6[_0x9426('0x12')])+0x1;_0x119ed1['extensions']=_['concat'](_0x119ed1[_0x9426('0x13')],_0x51ae81,[_0x5ed3a6],_0x15e454);}_0x119ed1[_0x9426('0x13')][_0x9426('0x15')]({'type':_0x2c28ef[_0x14efef][0x0]['type'],'app':'Hangup','exten':_0x2c28ef[_0x14efef][0x0]['exten'],'context':_0x2c28ef[_0x14efef][0x0][_0x9426('0x18')],'priority':_0x119ed1[_0x9426('0x12')],'VoiceExtensionId':_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]});_0x1c7b66[_0x9426('0x15')](_0x2c28ef[_0x14efef][0x0][_0x9426('0x19')]);_0x21bb49=_[_0x9426('0x3d')](_0x21bb49,_0x119ed1['extensions']);}}return _0x381953['transaction'](function(_0x458b51){return _0x381953['models']['VoiceExtension'][_0x9426('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1c7b66}},'transaction':_0x458b51})['then'](function(_0x47bcc7){return _0x381953[_0x9426('0x8')][_0x9426('0x6')]['bulkCreate'](_['sortBy'](_0x21bb49,'priority'),{'transaction':_0x458b51});});});})[_0x9426('0x3f')](function(_0x5df934){console[_0x9426('0x40')](_0x5df934);});}exports[_0x9426('0x41')]=rewrite; \ No newline at end of file +var _0x0040=['findAll','then','intervals','VoiceExtension','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','hasOwnProperty','priority','extensions','extension','find','push','type','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','Set','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','interval','map','tag','CDR(tag)=','length','outbound','callerID','answer','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval'];(function(_0x48ec15,_0x5bd1cd){var _0x56fcdc=function(_0x5cab0b){while(--_0x5cab0b){_0x48ec15['push'](_0x48ec15['shift']());}};_0x56fcdc(++_0x5bd1cd);}(_0x0040,0x1d1));var _0x0004=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0x0040[_0x1df5cd];return _0xf6df9b;};'use strict';var _=require(_0x0004('0x0'));var util=require(_0x0004('0x1'));function rewrite(_0x720efd,_0x545925){var _0x4faf7e=this;return _0x720efd[_0x0004('0x2')][_0x0004('0x3')][_0x0004('0x4')]({'raw':!![]})[_0x0004('0x5')](function(_0x10a1b1){_0x4faf7e[_0x0004('0x6')]=_0x10a1b1;return _0x720efd[_0x0004('0x2')][_0x0004('0x7')]['findAll']({'where':{'IntervalId':_0x545925[_0x0004('0x8')]},'raw':!![]});})[_0x0004('0x5')](function(_0x4cf457){return _0x720efd['models'][_0x0004('0x7')][_0x0004('0x4')]({'where':{'exten':{'$in':_[_0x0004('0x9')](_['map'](_0x4cf457,'exten'))}},'order':[{'raw':_0x0004('0xa')}],'raw':!![]});})['then'](function(_0x13ad85){var _0x43a237=_[_0x0004('0xb')](_0x13ad85,{'priority':'1'});var _0x3a2517=_['filter'](_0x13ad85,{'isApp':0x1});var _0xb096ff=_[_0x0004('0xc')](_0x3a2517,_0x0004('0xd'));var _0xd09c32=['queue','playback'];var _0x229869=[];var _0x2abe8b=[];for(var _0x158670 in _0xb096ff){if(_0xb096ff[_0x0004('0xe')](_0x158670)){_0x4faf7e[_0x0004('0xf')]=0x2;_0x4faf7e[_0x0004('0x10')]=[];_0x4faf7e[_0x0004('0x11')]=_[_0x0004('0x12')](_0x43a237,{'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')]});_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':'Set','appdata':util['format'](_0x0004('0x15'),_0xb096ff[_0x158670][0x0]['type']),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});if(_0xb096ff[_0x158670][0x0][_0x0004('0x14')]===_0x0004('0x18')){_0x4faf7e[_0x0004('0x10')]['push']({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':'Set','appdata':_0x0004('0x19')+_0xb096ff[_0x158670][0x0][_0x0004('0x17')],'context':_0xb096ff[_0x158670][0x0]['context'],'exten':_0xb096ff[_0x158670][0x0]['exten'],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});}else if(_0xb096ff[_0x158670][0x0][_0x0004('0x14')]==='outbound'){if(_0x4faf7e[_0x0004('0x11')]){_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0]['type'],'app':'Set','appdata':_0x0004('0x1a')+(_0x4faf7e[_0x0004('0x11')]['cutdigits']?_0x0004('0x1b')+_0x4faf7e[_0x0004('0x11')][_0x0004('0x1c')]+'}':_0x0004('0x1d')),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e['priority']++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});}_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x0004('0x19')+_0xb096ff[_0x158670][0x0][_0x0004('0x17')],'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e['priority']++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});var _0x27b5e1=_0x4faf7e[_0x0004('0xf')]++;_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0]['type'],'app':_0x0004('0x1f'),'appdata':_0x0004('0x20')+(_0x27b5e1+0x2)+'):Goto('+(_0x27b5e1+0x1)+')','context':_0xb096ff[_0x158670][0x0]['context'],'exten':_0xb096ff[_0x158670][0x0]['exten'],'priority':_0x27b5e1,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});if(_0x4faf7e[_0x0004('0x11')]){_0x4faf7e['extensions'][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x4faf7e[_0x0004('0x11')]['cutdigits']?_0x0004('0x21')+_0x4faf7e[_0x0004('0x11')][_0x0004('0x1c')]+'}':_0x0004('0x22'),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0]['exten'],'priority':_0x4faf7e['priority']++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});}_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':'outboundrouteid='+_0xb096ff[_0x158670][0x0][_0x0004('0x17')],'context':_0xb096ff[_0x158670][0x0]['context'],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});if(_0x4faf7e[_0x0004('0x11')]&&_0x4faf7e['extension'][_0x0004('0xe')](_0x0004('0x23'))&&_0x4faf7e[_0x0004('0x11')][_0x0004('0x23')]!=='none'){_0x4faf7e[_0x0004('0x10')]['push']({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':'Set','appdata':_0x0004('0x24')+_0x4faf7e['extension']['recordingFormat']||_0x0004('0x25'),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e['priority']++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});}}_0x4faf7e[_0x0004('0x10')]['push']({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x0004('0x26'),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0]['exten'],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});_0x4faf7e[_0x0004('0x10')]['push']({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x0004('0x27'),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x0004('0x28'),'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'priority':_0x4faf7e[_0x0004('0xf')]++,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});for(var _0x1eb314=0x0,_0x1e8f2c=0x0;_0x1eb314<_0xb096ff[_0x158670]['length'];_0x1eb314+=0x1,_0x1e8f2c=0x0){var _0xbeb239=_0xb096ff[_0x158670][_0x1eb314];if(_0xbeb239['type']){_0xbeb239[_0x0004('0x14')]=_0xbeb239[_0x0004('0x14')][_0x0004('0x29')]();}var _0x3e2e77=[];var _0xfc5083=[];delete _0xbeb239['id'];delete _0xbeb239['createdAt'];delete _0xbeb239[_0x0004('0x2a')];var _0x1a4868=_0xbeb239[_0x0004('0x2b')]!=='*,*,*,*'?[_0xbeb239[_0x0004('0x2b')]]:_0xbeb239[_0x0004('0x8')]?_[_0x0004('0x2c')](_[_0x0004('0xb')](_0x4faf7e[_0x0004('0x6')],{'IntervalId':_0xbeb239[_0x0004('0x8')]}),'interval'):[];if(_0xbeb239[_0x0004('0xe')]('tag')){if(_0xbeb239[_0x0004('0x2d')]&&_0xbeb239[_0x0004('0x2d')]!=='--'){_0x3e2e77[_0x0004('0x13')]({'type':_0xbeb239['type'],'app':_0x0004('0x1e'),'appdata':_0x0004('0x2e')+_0xbeb239[_0x0004('0x2d')],'context':_0xbeb239[_0x0004('0x16')],'exten':_0xbeb239[_0x0004('0xd')],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e[_0x0004('0xf')]+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239['VoiceExtensionId']});}}if(_0xbeb239[_0x0004('0x14')]===_0x0004('0x30')&&_0xbeb239['hasOwnProperty']('callerID')){if(_0xbeb239[_0x0004('0x31')]){_0x3e2e77[_0x0004('0x13')]({'type':_0xbeb239[_0x0004('0x14')],'app':_0x0004('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xbeb239[_0x0004('0x31')]+')','context':_0xbeb239[_0x0004('0x16')],'exten':_0xbeb239['exten'],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e['priority']+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239[_0x0004('0x17')]});}else{_0x3e2e77['push']({'type':_0xbeb239[_0x0004('0x14')],'app':_0x0004('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xbeb239[_0x0004('0x16')],'exten':_0xbeb239['exten'],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e[_0x0004('0xf')]+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239[_0x0004('0x17')]});}}if(_0xbeb239[_0x0004('0xe')](_0x0004('0x32'))){if(_0xd09c32['indexOf'](_0xbeb239[_0x0004('0x33')][_0x0004('0x29')]())>=0x0&&_0xbeb239[_0x0004('0x34')]!=='custom'){if(_0xbeb239[_0x0004('0x32')]){_0x3e2e77[_0x0004('0x13')]({'type':_0xbeb239[_0x0004('0x14')],'app':_0x0004('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xbeb239['context'],'exten':_0xbeb239[_0x0004('0xd')],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e[_0x0004('0xf')]+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239[_0x0004('0x17')]});_0x3e2e77[_0x0004('0x13')]({'type':_0xbeb239[_0x0004('0x14')],'app':_0x0004('0x1e'),'appdata':_0x0004('0x35'),'context':_0xbeb239[_0x0004('0x16')],'exten':_0xbeb239['exten'],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e[_0x0004('0xf')]+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239[_0x0004('0x17')]});}else{_0x3e2e77['push']({'type':_0xbeb239[_0x0004('0x14')],'app':_0x0004('0x1f'),'appdata':_0x0004('0x36'),'context':_0xbeb239[_0x0004('0x16')],'exten':_0xbeb239[_0x0004('0xd')],'priority':_0x1a4868['length']+_0x4faf7e[_0x0004('0xf')]+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239['VoiceExtensionId']});_0x3e2e77[_0x0004('0x13')]({'type':_0xbeb239['type'],'app':'Set','appdata':_0x0004('0x37'),'context':_0xbeb239['context'],'exten':_0xbeb239['exten'],'priority':_0x1a4868[_0x0004('0x2f')]+_0x4faf7e['priority']+_0x1e8f2c++,'VoiceExtensionId':_0xbeb239[_0x0004('0x17')]});}}}for(var _0x106b17=0x0;_0x106b17<_0x1a4868['length'];_0x106b17+=0x1){var _0x26ea1d=_0x4faf7e[_0x0004('0xf')]+_0x1a4868[_0x0004('0x2f')];var _0x3c8d54=_0x106b17===_0x1a4868['length']-0x1?_0x4faf7e[_0x0004('0xf')]+_0x3e2e77[_0x0004('0x2f')]+_0xfc5083['length']+0x2:_0x4faf7e[_0x0004('0xf')]+_0x106b17+0x1;_0x3e2e77['splice'](_0x106b17,0x0,{'type':_0xbeb239['type'],'app':_0x0004('0x38'),'appdata':_0x1a4868[_0x106b17]+'?'+_0xbeb239[_0x0004('0x16')]+_0x0004('0x39')+_0x26ea1d+':'+_0xbeb239[_0x0004('0x16')]+',${EXTEN},'+_0x3c8d54,'exten':_0xbeb239[_0x0004('0xd')],'context':_0xbeb239[_0x0004('0x16')],'priority':_0x4faf7e[_0x0004('0xf')]+_0x106b17,'VoiceExtensionId':_0xb096ff[_0x158670][0x0]['VoiceExtensionId']});}_0xbeb239[_0x0004('0xf')]=_0x3e2e77[_0x0004('0x2f')]?_[_0x0004('0x3a')](_0x3e2e77)[_0x0004('0xf')]+0x1:_0x4faf7e['priority'];_0x4faf7e[_0x0004('0xf')]=(_0xfc5083[_0x0004('0x2f')]?_[_0x0004('0x3a')](_0xfc5083)[_0x0004('0xf')]:_0xbeb239[_0x0004('0xf')])+0x1;_0x4faf7e[_0x0004('0x10')]=_[_0x0004('0x3b')](_0x4faf7e[_0x0004('0x10')],_0x3e2e77,[_0xbeb239],_0xfc5083);}_0x4faf7e[_0x0004('0x10')][_0x0004('0x13')]({'type':_0xb096ff[_0x158670][0x0][_0x0004('0x14')],'app':_0x0004('0x3c'),'exten':_0xb096ff[_0x158670][0x0][_0x0004('0xd')],'context':_0xb096ff[_0x158670][0x0][_0x0004('0x16')],'priority':_0x4faf7e[_0x0004('0xf')],'VoiceExtensionId':_0xb096ff[_0x158670][0x0][_0x0004('0x17')]});_0x229869[_0x0004('0x13')](_0xb096ff[_0x158670][0x0][_0x0004('0x17')]);_0x2abe8b=_[_0x0004('0x3b')](_0x2abe8b,_0x4faf7e['extensions']);}}return _0x720efd[_0x0004('0x3d')](function(_0x875443){return _0x720efd['models']['VoiceExtension'][_0x0004('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x229869}},'transaction':_0x875443})['then'](function(_0x39ba97){return _0x720efd[_0x0004('0x2')][_0x0004('0x7')]['bulkCreate'](_[_0x0004('0x3f')](_0x2abe8b,'priority'),{'transaction':_0x875443});});});})[_0x0004('0x40')](function(_0x4ab137){console[_0x0004('0x41')](_0x4ab137);});}exports[_0x0004('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 425e782..1141212 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 _0xb047=['create','keys','pick','catch','stringify','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','into','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','always','push','sequelize','query','VoiceQueueId','then','onlyIfOpen','VoiceQueue','BlackLists','all','Lists','CampaignId','Campaign','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact'];(function(_0x48e667,_0xf3cde8){var _0x5e76e2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x48e667['push'](_0x48e667['shift']());}};_0x5e76e2(++_0xf3cde8);}(_0xb047,0x18d));var _0x7b04=function(_0x14e7bc,_0x6156da){_0x14e7bc=_0x14e7bc-0x0;var _0xfc8a9f=_0xb047[_0x14e7bc];return _0xfc8a9f;};'use strict';var BPromise=require(_0x7b04('0x0'));var util=require(_0x7b04('0x1'));var _=require(_0x7b04('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b04('0x3'));var Redis=require(_0x7b04('0x4'));var db=require(_0x7b04('0x5'))['db'];var config=require(_0x7b04('0x6'));var logger=require(_0x7b04('0x7'))(_0x7b04('0x8'));config[_0x7b04('0x9')]=_[_0x7b04('0xa')](config[_0x7b04('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b04('0xb'))(new Redis(config[_0x7b04('0x9')]));require(_0x7b04('0xc'))[_0x7b04('0xd')](socket);try{if(!process['argv'][0x2]||process[_0x7b04('0xe')][0x2]==='undefined'||process['argv'][0x2]===_0x7b04('0xf')){throw new Error(_0x7b04('0x10'));}var FILEPATH=process[_0x7b04('0xe')][0x2];if(!process[_0x7b04('0xe')][0x3]||process[_0x7b04('0xe')][0x3]===_0x7b04('0x11')||process[_0x7b04('0xe')][0x3]===_0x7b04('0xf')||!process[_0x7b04('0xe')][0x4]||process[_0x7b04('0xe')][0x4]==='undefined'||process[_0x7b04('0xe')][0x4]===_0x7b04('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x7b04('0xe')][0x3][_0x7b04('0x12')](','),process[_0x7b04('0xe')][0x4][_0x7b04('0x12')](','));if(!process[_0x7b04('0xe')][0x5]||process[_0x7b04('0xe')][0x5]===_0x7b04('0x11')||process['argv'][0x5]===_0x7b04('0xf')){throw new Error(_0x7b04('0x13'));}var LISTID=process[_0x7b04('0xe')][0x5];var COMPANYID=process[_0x7b04('0xe')][0x6]&&process[_0x7b04('0xe')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x7b04('0xf')?process[_0x7b04('0xe')][0x6]:null;var DUPLICATES=process[_0x7b04('0xe')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x7b04('0xe')][0x7]!=='null'?process[_0x7b04('0xe')][0x7]:null;if(!process[_0x7b04('0xe')][0x8]||process[_0x7b04('0xe')][0x8]===_0x7b04('0x11')||process[_0x7b04('0xe')][0x8]===_0x7b04('0xf')){throw new Error(_0x7b04('0x14'));}var SOCKET_TIMESTAMP=process[_0x7b04('0xe')][0x8];}catch(_0x4fd6f0){logger[_0x7b04('0x15')](_0x4fd6f0);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(_0x2489a3,_0x4510ac,_0x462fdb,_0x264ba1){var _0x123642={'message':_0x4510ac};_0x123642[_0x2489a3]=!![];if(_0x462fdb){_0x123642[_0x7b04('0x16')]=_0x462fdb;}if(_0x264ba1){_0x123642[_0x7b04('0x17')]=_0x264ba1;}return _0x123642;}function isEmail(_0x50ed07){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))*$/[_0x7b04('0x18')](_0x50ed07);}function checkRow(_0x14fce6,_0x241a91,_0x4927a8){return new BPromise(function(_0x53b905,_0x3deb76){if(_[_0x7b04('0x19')](_0x14fce6)){return _0x3deb76(handleCheckRowError(_0x7b04('0x15'),_0x7b04('0x1a'),null,_0x4927a8));}if(_0x14fce6['errors']&&_0x14fce6[_0x7b04('0x1b')][_0x7b04('0x1c')]){var _0x4f785e=_[_0x7b04('0x1d')](_0x14fce6[_0x7b04('0x1b')],'message')[_0x7b04('0x1e')](';');return _0x3deb76(handleCheckRowError('error',_0x4f785e,null,_0x4927a8));}var _0xcd2a9b={};for(var _0x42a9a9 in FIELDS){if(FIELDS[_0x7b04('0x1f')](_0x42a9a9)&&FIELDS[_0x42a9a9]){_0xcd2a9b[_0x42a9a9]=_0x14fce6[_0x7b04('0x20')][0x0][FIELDS[_0x42a9a9]]||_0x14fce6['data'][0x0]['\ufeff'+FIELDS[_0x42a9a9]];}}if(!_0xcd2a9b['firstName']){return _0x3deb76(handleCheckRowError(_0x7b04('0x15'),'firstName\x20not\x20specified!',null,_0x4927a8));}if(!_0xcd2a9b[_0x7b04('0x21')]){return _0x3deb76(handleCheckRowError(_0x7b04('0x15'),_0x7b04('0x22'),null,_0x4927a8));}if(_0xcd2a9b[_0x7b04('0x23')]){var _0xea5133=moment(_0xcd2a9b[_0x7b04('0x23')],_0x7b04('0x24'));if(!_0xea5133[_0x7b04('0x25')]()){return _0x3deb76(handleCheckRowError('error',_0x7b04('0x26'),null,_0x4927a8));}}if(_0xcd2a9b[_0x7b04('0x27')]){if(!isEmail(_0xcd2a9b[_0x7b04('0x27')])){return _0x3deb76(handleCheckRowError(_0x7b04('0x15'),_0x7b04('0x28'),null,_0x4927a8));}}_0xcd2a9b[_0x7b04('0x29')]=LISTID;_0xcd2a9b[_0x7b04('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b04('0x1c')]&&_0x241a91){var _0x4b68ac={};for(var _0x53400=0x0,_0x14b060=DUPLICATES[_0x7b04('0x1c')];_0x53400<_0x14b060;_0x53400+=0x1){_0x4b68ac[DUPLICATES[_0x53400]]=_0xcd2a9b[DUPLICATES[_0x53400]];}var _0x3cbf9b=_[_0x7b04('0x2b')](_0x241a91,_0x4b68ac);if(_0x3cbf9b){return _0x3deb76(handleCheckRowError(_0x7b04('0x2c'),_0x7b04('0x2d'),_0x3cbf9b,_0x4927a8));}}return db[_0x7b04('0x2e')][_0x7b04('0x2f')](_0xcd2a9b,{'raw':!![],'hooks':![],'fields':_[_0x7b04('0x30')](_0xcd2a9b)})['then'](function(_0x185a7b){if(DUPLICATES&&DUPLICATES[_0x7b04('0x1c')]&&_0x241a91){_0x241a91['push'](_[_0x7b04('0x31')](_0xcd2a9b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x185a7b['id'];return _0x53b905();})[_0x7b04('0x32')](function(_0x2be948){return _0x3deb76(handleCheckRowError(_0x7b04('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2be948['message']||JSON[_0x7b04('0x33')](_0x2be948)),null,_0x4927a8));});});}function checkHopper(){function _0xf9e2f5(){return function(_0x24b88b){logger[_0x7b04('0x15')]('cmContact','checkHopper',util[_0x7b04('0x34')](_0x24b88b,{'showHidden':![],'depth':null}));};}var _0x2bd380=function(_0x35a8cf,_0x50dd66){var _0x8a3fa5=squel[_0x7b04('0x35')]()['into'](_0x7b04('0x36'))[_0x7b04('0x37')]([_0x7b04('0x21'),_0x7b04('0x38'),_0x7b04('0x39'),'ListId',_0x50dd66,_0x7b04('0x3a'),_0x7b04('0x3b')],squel['select']()[_0x7b04('0x3c')](_0x7b04('0x21'),_0x7b04('0x21'))[_0x7b04('0x3c')](_0x7b04('0x3d'),'scheduledAt')[_0x7b04('0x3c')]('id',_0x7b04('0x39'))[_0x7b04('0x3c')](LISTID[_0x7b04('0x3e')](),_0x7b04('0x29'))[_0x7b04('0x3c')](_0x35a8cf['id'][_0x7b04('0x3e')](),_0x50dd66)['field']('NOW()','createdAt')['field'](_0x7b04('0x3d'),_0x7b04('0x3b'))[_0x7b04('0x3f')](_0x7b04('0x40'))['where'](_0x7b04('0x41'))[_0x7b04('0x42')]('ListId\x20=\x20?',LISTID[_0x7b04('0x3e')]())[_0x7b04('0x42')](_0x7b04('0x43'))[_0x7b04('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7b04('0x44')]()[_0x7b04('0x3c')](_0x7b04('0x21'))[_0x7b04('0x3f')](_0x7b04('0x36'))[_0x7b04('0x42')](_0x50dd66+_0x7b04('0x45'),_0x35a8cf['id']['toString']())))[_0x7b04('0x3e')]();return _0x8a3fa5;};var _0x2168d4=function(_0x541a12,_0x43766d){var _0x20c3ad=squel[_0x7b04('0x35')]()[_0x7b04('0x46')](_0x7b04('0x36'))['fromQuery']([_0x7b04('0x21'),_0x7b04('0x38'),'ContactId',_0x7b04('0x29'),_0x43766d,_0x7b04('0x3a'),_0x7b04('0x3b')],squel[_0x7b04('0x44')]()['field'](_0x7b04('0x21'),_0x7b04('0x21'))['field'](_0x7b04('0x3d'),_0x7b04('0x38'))[_0x7b04('0x3c')]('id',_0x7b04('0x39'))[_0x7b04('0x3c')](LISTID['toString'](),_0x7b04('0x29'))['field'](_0x541a12['id'][_0x7b04('0x3e')](),_0x43766d)[_0x7b04('0x3c')](_0x7b04('0x3d'),_0x7b04('0x3a'))[_0x7b04('0x3c')](_0x7b04('0x3d'),'updatedAt')['from'](_0x7b04('0x40'))[_0x7b04('0x42')](_0x7b04('0x41'))[_0x7b04('0x42')](_0x7b04('0x47'),LISTID[_0x7b04('0x3e')]())[_0x7b04('0x42')](_0x7b04('0x48'),squel[_0x7b04('0x49')](hopperContacts))[_0x7b04('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x7b04('0x42')](_0x7b04('0x4a'),squel['select']()[_0x7b04('0x3c')](_0x7b04('0x4b'))[_0x7b04('0x3f')](_0x7b04('0x4c'))['where'](_0x43766d+_0x7b04('0x45'),_0x541a12['id'][_0x7b04('0x3e')]()))['where'](_0x7b04('0x4a'),squel[_0x7b04('0x44')]()[_0x7b04('0x3c')](_0x7b04('0x21'))['from'](_0x7b04('0x36'))['where'](_0x43766d+_0x7b04('0x45'),_0x541a12['id']['toString']())))[_0x7b04('0x3e')]();return _0x20c3ad;};function _0x5f4054(_0x1b3cce,_0x8c524d){var _0x277db0=squel[_0x7b04('0x35')]()['into'](_0x7b04('0x36'))[_0x7b04('0x37')]([_0x7b04('0x21'),'scheduledAt',_0x7b04('0x39'),_0x7b04('0x29'),_0x8c524d,'createdAt',_0x7b04('0x3b')],squel[_0x7b04('0x44')]()[_0x7b04('0x3c')](_0x7b04('0x21'),_0x7b04('0x21'))['field'](_0x7b04('0x3d'),_0x7b04('0x38'))['field']('id',_0x7b04('0x39'))[_0x7b04('0x3c')](LISTID[_0x7b04('0x3e')](),_0x7b04('0x29'))[_0x7b04('0x3c')](_0x1b3cce['id'][_0x7b04('0x3e')](),_0x8c524d)[_0x7b04('0x3c')]('NOW()','createdAt')['field'](_0x7b04('0x3d'),'updatedAt')[_0x7b04('0x3f')](_0x7b04('0x40'))[_0x7b04('0x42')](_0x7b04('0x41'))[_0x7b04('0x42')](_0x7b04('0x47'),LISTID[_0x7b04('0x3e')]())[_0x7b04('0x42')](_0x7b04('0x48'),squel['str'](hopperContacts))[_0x7b04('0x42')](_0x7b04('0x43')))[_0x7b04('0x3e')]();return _0x277db0;}function _0x1266aa(_0xa2139,_0x3a5310){var _0x989e42=squel[_0x7b04('0x35')]()[_0x7b04('0x46')](_0x7b04('0x4d'))[_0x7b04('0x37')](['phone',_0x7b04('0x39'),_0x7b04('0x29'),_0x3a5310,_0x7b04('0x3a'),_0x7b04('0x3b')],squel[_0x7b04('0x44')]()[_0x7b04('0x3c')](_0x7b04('0x21'),_0x7b04('0x21'))[_0x7b04('0x3c')]('id','ContactId')['field'](LISTID[_0x7b04('0x3e')](),_0x7b04('0x29'))['field'](_0xa2139['id'][_0x7b04('0x3e')](),_0x3a5310)['field'](_0x7b04('0x3d'),_0x7b04('0x3a'))[_0x7b04('0x3c')](_0x7b04('0x3d'),'updatedAt')[_0x7b04('0x3f')](_0x7b04('0x40'))['where'](_0x7b04('0x41'))['where']('ListId\x20=\x20?',LISTID[_0x7b04('0x3e')]())['where'](_0x7b04('0x48'),squel[_0x7b04('0x49')](hopperContacts))[_0x7b04('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x7b04('0x3e')]();return _0x989e42;}return db['VoiceQueue'][_0x7b04('0x4e')]({'where':{'type':_0x7b04('0x4f')},'attributes':['id',_0x7b04('0x50')],'include':[{'model':db[_0x7b04('0x51')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x1b68fb){var _0x486e10=[];if(_0x1b68fb){var _0x4452d8;for(var _0xc9bc=0x0,_0x2f26ce;_0xc9bc<_0x1b68fb[_0x7b04('0x1c')];_0xc9bc+=0x1){_0x2f26ce=_0x1b68fb[_0xc9bc][_0x7b04('0x52')]({'plain':!![]});switch(_0x2f26ce[_0x7b04('0x50')]){case _0x7b04('0x53'):_0x486e10[_0x7b04('0x54')](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x2168d4(_0x2f26ce,_0x7b04('0x57')))[_0x7b04('0x58')](function(){})[_0x7b04('0x32')](_0xf9e2f5()));break;case _0x7b04('0x59'):_0x486e10[_0x7b04('0x54')](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x2bd380(_0x2f26ce,_0x7b04('0x57')))[_0x7b04('0x58')](function(){})[_0x7b04('0x32')](_0xf9e2f5()));break;default:_0x486e10['push'](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x5f4054(_0x2f26ce,_0x7b04('0x57')))[_0x7b04('0x58')](function(){})[_0x7b04('0x32')](_0xf9e2f5()));}}}return _0x486e10;})['all']()[_0x7b04('0x58')](function(){return db[_0x7b04('0x5a')][_0x7b04('0x4e')]({'where':{'type':_0x7b04('0x4f')},'attributes':['id'],'include':[{'model':db[_0x7b04('0x51')],'as':_0x7b04('0x5b'),'where':{'id':LISTID}}]})[_0x7b04('0x58')](function(_0x3189fa){var _0x492d66=[];if(_0x3189fa){var _0xba4c9a;for(var _0x1ac2b4=0x0,_0x361245;_0x1ac2b4<_0x3189fa[_0x7b04('0x1c')];_0x1ac2b4+=0x1){_0x361245=_0x3189fa[_0x1ac2b4][_0x7b04('0x52')]({'plain':!![]});_0x492d66[_0x7b04('0x54')](db['sequelize'][_0x7b04('0x56')](_0x1266aa(_0x361245,_0x7b04('0x57')))[_0x7b04('0x58')](function(){})['catch'](_0xf9e2f5()));}}return _0x492d66;})[_0x7b04('0x5c')]();})[_0x7b04('0x58')](function(){return db['Campaign'][_0x7b04('0x4e')]({'attributes':['id',_0x7b04('0x50')],'include':[{'model':db[_0x7b04('0x51')],'as':_0x7b04('0x5d'),'where':{'id':LISTID}}]})['then'](function(_0x5bfa48){var _0x31f383=[];if(_0x5bfa48){for(var _0x2312d9=0x0,_0x50426e;_0x2312d9<_0x5bfa48[_0x7b04('0x1c')];_0x2312d9+=0x1){_0x50426e=_0x5bfa48[_0x2312d9][_0x7b04('0x52')]({'plain':!![]});switch(_0x50426e[_0x7b04('0x50')]){case _0x7b04('0x53'):_0x31f383['push'](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x2168d4(_0x50426e,'CampaignId'))[_0x7b04('0x58')](function(){})[_0x7b04('0x32')](_0xf9e2f5()));break;case _0x7b04('0x59'):_0x31f383[_0x7b04('0x54')](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x2bd380(_0x50426e,'CampaignId'))[_0x7b04('0x58')](function(){})[_0x7b04('0x32')](_0xf9e2f5()));break;default:_0x31f383['push'](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x5f4054(_0x50426e,_0x7b04('0x5e')))['then'](function(){})[_0x7b04('0x32')](_0xf9e2f5()));}}}return _0x31f383;})['all']();})[_0x7b04('0x58')](function(){return db[_0x7b04('0x5f')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b04('0x5b'),'where':{'id':LISTID}}]})[_0x7b04('0x58')](function(_0x19a7c7){var _0x110715=[];if(_0x19a7c7){for(var _0x5889f2=0x0,_0x51035d;_0x5889f2<_0x19a7c7[_0x7b04('0x1c')];_0x5889f2+=0x1){_0x51035d=_0x19a7c7[_0x5889f2][_0x7b04('0x52')]({'plain':!![]});_0x110715[_0x7b04('0x54')](db[_0x7b04('0x55')][_0x7b04('0x56')](_0x1266aa(_0x51035d,_0x7b04('0x5e')))[_0x7b04('0x58')](function(){})['catch'](_0xf9e2f5()));}}return _0x110715;})[_0x7b04('0x5c')]();})[_0x7b04('0x32')](function(_0x2f0feb){logger['error']('cmContact,\x20%s,\x20%s',_0x7b04('0x60'),_0x2f0feb[_0x7b04('0x61')]);});}var processPromises=function(_0x37ee12){return BPromise['all'](promises)[_0x7b04('0x58')](function(_0x2ff731){})['catch'](function(_0x1d1370){logger['error'](_0x7b04('0x62'),JSON[_0x7b04('0x33')](_0x1d1370));})['finally'](function(){socket[_0x7b04('0x63')](_0x7b04('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x37ee12){return _0x37ee12['resume']();}});};var endCsv=function(){return BPromise[_0x7b04('0x65')]()[_0x7b04('0x58')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x7b04('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b04('0x66')](FILEPATH);}catch(_0x485e5d){logger[_0x7b04('0x15')](_0x7b04('0x67'),JSON[_0x7b04('0x33')](_0x485e5d));}finally{process[_0x7b04('0x68')](0x0);}});};process['on'](_0x7b04('0x69'),function(){logger[_0x7b04('0x6a')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b04('0x65')]()[_0x7b04('0x58')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b04('0x12')](',');return db[_0x7b04('0x2e')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b04('0x58')](function(_0x409fbd){var _0x874f23=fs[_0x7b04('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b04('0x6c')](_0x874f23,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2482fe,_0x221cc0){total+=0x1;var _0x3154f8=total;promises['push'](checkRow(_0x2482fe,_0x409fbd,_0x3154f8)[_0x7b04('0x58')](function(){success+=0x1;})[_0x7b04('0x32')](function(_0x21876d){if(_0x21876d[_0x7b04('0x15')]){errors+=0x1;delete _0x21876d['error'];}else if(_0x21876d[_0x7b04('0x2c')]){duplicates+=0x1;delete _0x21876d[_0x7b04('0x2c')];}rows[_0x7b04('0x54')](_0x21876d);}));if(total%0xc8===0x0){_0x221cc0[_0x7b04('0x6d')]();return processPromises(_0x221cc0);}},'complete':function(){return processPromises()[_0x7b04('0x58')](function(){logger[_0x7b04('0x6a')](_0x7b04('0x6e'));endCsv();});},'error':function(_0xcb69c6,_0x127f06){logger[_0x7b04('0x6a')]('CSV\x20parse\x20error',JSON['stringify'](_0xcb69c6));endCsv();}});})[_0x7b04('0x32')](function(_0x4d04d9){logger[_0x7b04('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x7b04('0x33')](_0x4d04d9));});}main(); \ No newline at end of file +var _0x4c44=['CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','defaults','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','calleridnum','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','sequelize','query','VoiceQueueId','CmList','BlackLists','get','all','onlyIfOpen','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info'];(function(_0x21e7d8,_0x558fb4){var _0x21057d=function(_0x26084b){while(--_0x26084b){_0x21e7d8['push'](_0x21e7d8['shift']());}};_0x21057d(++_0x558fb4);}(_0x4c44,0x153));var _0x44c4=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x4c44[_0x132d12];return _0x1c3163;};'use strict';var BPromise=require('bluebird');var util=require(_0x44c4('0x0'));var _=require(_0x44c4('0x1'));var fs=require('fs');var squel=require(_0x44c4('0x2'));var Papa=require(_0x44c4('0x3'));var Redis=require(_0x44c4('0x4'));var db=require(_0x44c4('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x44c4('0x6'))(_0x44c4('0x7'));config['redis']=_[_0x44c4('0x8')](config[_0x44c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44c4('0xa'))[_0x44c4('0xb')](socket);try{if(!process[_0x44c4('0xc')][0x2]||process['argv'][0x2]===_0x44c4('0xd')||process[_0x44c4('0xc')][0x2]===_0x44c4('0xe')){throw new Error(_0x44c4('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0x44c4('0xc')][0x3]||process[_0x44c4('0xc')][0x3]===_0x44c4('0xd')||process['argv'][0x3]===_0x44c4('0xe')||!process[_0x44c4('0xc')][0x4]||process['argv'][0x4]==='undefined'||process[_0x44c4('0xc')][0x4]===_0x44c4('0xe')){throw new Error(_0x44c4('0x10'));}var FIELDS=_[_0x44c4('0x11')](process['argv'][0x3][_0x44c4('0x12')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x44c4('0xc')][0x5]==='undefined'||process[_0x44c4('0xc')][0x5]===_0x44c4('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x44c4('0xc')][0x5];var COMPANYID=process[_0x44c4('0xc')][0x6]&&process['argv'][0x6]!==_0x44c4('0xd')&&process[_0x44c4('0xc')][0x6]!=='null'?process[_0x44c4('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x44c4('0xc')][0x7]!==_0x44c4('0xd')&&process[_0x44c4('0xc')][0x7]!=='null'?process[_0x44c4('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0x44c4('0xc')][0x8]===_0x44c4('0xd')||process[_0x44c4('0xc')][0x8]===_0x44c4('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x44c4('0xc')][0x8];}catch(_0x5a052c){logger[_0x44c4('0x13')](_0x5a052c);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(_0x1eaf55,_0x485f53,_0x1df21e,_0x4760d1){var _0x36b29c={'message':_0x485f53};_0x36b29c[_0x1eaf55]=!![];if(_0x1df21e){_0x36b29c[_0x44c4('0x14')]=_0x1df21e;}if(_0x4760d1){_0x36b29c['index']=_0x4760d1;}return _0x36b29c;}function isEmail(_0x5009e8){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))*$/[_0x44c4('0x15')](_0x5009e8);}function checkRow(_0x1f25c0,_0x18c31b,_0x2ef265){return new BPromise(function(_0x30cf11,_0x2a97ab){if(_[_0x44c4('0x16')](_0x1f25c0)){return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),_0x44c4('0x17'),null,_0x2ef265));}if(_0x1f25c0[_0x44c4('0x18')]&&_0x1f25c0[_0x44c4('0x18')]['length']){var _0x52a081=_[_0x44c4('0x19')](_0x1f25c0['errors'],'message')[_0x44c4('0x1a')](';');return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),_0x52a081,null,_0x2ef265));}var _0x23b467={};for(var _0x209fef in FIELDS){if(FIELDS[_0x44c4('0x1b')](_0x209fef)&&FIELDS[_0x209fef]){_0x23b467[_0x209fef]=_0x1f25c0[_0x44c4('0x1c')][0x0][FIELDS[_0x209fef]]||_0x1f25c0[_0x44c4('0x1c')][0x0]['\ufeff'+FIELDS[_0x209fef]];}}if(!_0x23b467[_0x44c4('0x1d')]){return _0x2a97ab(handleCheckRowError('error',_0x44c4('0x1e'),null,_0x2ef265));}if(!_0x23b467['phone']){return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),_0x44c4('0x1f'),null,_0x2ef265));}if(_0x23b467[_0x44c4('0x20')]){var _0x27493a=moment(_0x23b467[_0x44c4('0x20')],'YYYY-MM-DD');if(!_0x27493a[_0x44c4('0x21')]()){return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),_0x44c4('0x22'),null,_0x2ef265));}}if(_0x23b467[_0x44c4('0x23')]){if(!isEmail(_0x23b467[_0x44c4('0x23')])){return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),'email\x20format\x20is\x20not\x20valid!',null,_0x2ef265));}}_0x23b467['ListId']=LISTID;_0x23b467[_0x44c4('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x44c4('0x25')]&&_0x18c31b){var _0x4e0c82={};for(var _0x179231=0x0,_0x26cd85=DUPLICATES['length'];_0x179231<_0x26cd85;_0x179231+=0x1){_0x4e0c82[DUPLICATES[_0x179231]]=_0x23b467[DUPLICATES[_0x179231]];}var _0xacaf23=_[_0x44c4('0x26')](_0x18c31b,_0x4e0c82);if(_0xacaf23){return _0x2a97ab(handleCheckRowError(_0x44c4('0x27'),_0x44c4('0x28'),_0xacaf23,_0x2ef265));}}return db[_0x44c4('0x29')]['create'](_0x23b467,{'raw':!![],'hooks':![],'fields':_[_0x44c4('0x2a')](_0x23b467)})[_0x44c4('0x2b')](function(_0x3be18f){if(DUPLICATES&&DUPLICATES[_0x44c4('0x25')]&&_0x18c31b){_0x18c31b[_0x44c4('0x2c')](_['pick'](_0x23b467,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3be18f['id'];return _0x30cf11();})[_0x44c4('0x2d')](function(_0x2b9a0b){return _0x2a97ab(handleCheckRowError(_0x44c4('0x13'),_0x44c4('0x2e')+(_0x2b9a0b[_0x44c4('0x2f')]||JSON[_0x44c4('0x30')](_0x2b9a0b)),null,_0x2ef265));});});}function checkHopper(){function _0x5c8894(){return function(_0x2dc247){logger[_0x44c4('0x13')](_0x44c4('0x31'),'checkHopper',util[_0x44c4('0x32')](_0x2dc247,{'showHidden':![],'depth':null}));};}var _0x4d2b58=function(_0x112481,_0x46544d){var _0x401b79=squel[_0x44c4('0x33')]()[_0x44c4('0x34')](_0x44c4('0x35'))[_0x44c4('0x36')]([_0x44c4('0x37'),_0x44c4('0x38'),'ContactId',_0x44c4('0x39'),_0x46544d,_0x44c4('0x3a'),_0x44c4('0x3b')],squel[_0x44c4('0x3c')]()[_0x44c4('0x3d')](_0x44c4('0x37'),_0x44c4('0x37'))[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x38'))[_0x44c4('0x3d')]('id',_0x44c4('0x3f'))[_0x44c4('0x3d')](LISTID[_0x44c4('0x40')](),_0x44c4('0x39'))[_0x44c4('0x3d')](_0x112481['id']['toString'](),_0x46544d)[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x3a'))[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x3b'))[_0x44c4('0x41')](_0x44c4('0x42'))['where'](_0x44c4('0x43'))['where'](_0x44c4('0x44'),LISTID[_0x44c4('0x40')]())[_0x44c4('0x45')](_0x44c4('0x46'))['where'](_0x44c4('0x47'),squel[_0x44c4('0x3c')]()[_0x44c4('0x3d')](_0x44c4('0x37'))['from']('cm_hopper')['where'](_0x46544d+_0x44c4('0x48'),_0x112481['id']['toString']())))[_0x44c4('0x40')]();return _0x401b79;};var _0x23af75=function(_0x26fcd8,_0x332acd){var _0x59a207=squel[_0x44c4('0x33')]()[_0x44c4('0x34')](_0x44c4('0x35'))[_0x44c4('0x36')]([_0x44c4('0x37'),_0x44c4('0x38'),_0x44c4('0x3f'),_0x44c4('0x39'),_0x332acd,_0x44c4('0x3a'),_0x44c4('0x3b')],squel[_0x44c4('0x3c')]()[_0x44c4('0x3d')](_0x44c4('0x37'),'phone')[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x38'))[_0x44c4('0x3d')]('id',_0x44c4('0x3f'))['field'](LISTID[_0x44c4('0x40')](),'ListId')[_0x44c4('0x3d')](_0x26fcd8['id'][_0x44c4('0x40')](),_0x332acd)['field'](_0x44c4('0x3e'),_0x44c4('0x3a'))[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x3b'))[_0x44c4('0x41')](_0x44c4('0x42'))['where'](_0x44c4('0x43'))[_0x44c4('0x45')](_0x44c4('0x44'),LISTID[_0x44c4('0x40')]())['where'](_0x44c4('0x49'),squel['str'](hopperContacts))['where'](_0x44c4('0x46'))[_0x44c4('0x45')](_0x44c4('0x47'),squel[_0x44c4('0x3c')]()[_0x44c4('0x3d')](_0x44c4('0x4a'))[_0x44c4('0x41')]('cm_hopper_final')[_0x44c4('0x45')](_0x332acd+_0x44c4('0x48'),_0x26fcd8['id'][_0x44c4('0x40')]()))[_0x44c4('0x45')](_0x44c4('0x47'),squel[_0x44c4('0x3c')]()['field']('phone')[_0x44c4('0x41')](_0x44c4('0x35'))[_0x44c4('0x45')](_0x332acd+_0x44c4('0x48'),_0x26fcd8['id'][_0x44c4('0x40')]())))[_0x44c4('0x40')]();return _0x59a207;};function _0xd61c(_0x30e1b9,_0x550e1b){var _0xd03b48=squel[_0x44c4('0x33')]()[_0x44c4('0x34')](_0x44c4('0x35'))[_0x44c4('0x36')](['phone',_0x44c4('0x38'),_0x44c4('0x3f'),_0x44c4('0x39'),_0x550e1b,_0x44c4('0x3a'),_0x44c4('0x3b')],squel['select']()[_0x44c4('0x3d')](_0x44c4('0x37'),_0x44c4('0x37'))[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x38'))[_0x44c4('0x3d')]('id',_0x44c4('0x3f'))[_0x44c4('0x3d')](LISTID[_0x44c4('0x40')](),_0x44c4('0x39'))[_0x44c4('0x3d')](_0x30e1b9['id'][_0x44c4('0x40')](),_0x550e1b)[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x3a'))[_0x44c4('0x3d')](_0x44c4('0x3e'),_0x44c4('0x3b'))[_0x44c4('0x41')](_0x44c4('0x42'))['where'](_0x44c4('0x43'))[_0x44c4('0x45')](_0x44c4('0x44'),LISTID[_0x44c4('0x40')]())[_0x44c4('0x45')]('id\x20IN\x20?',squel[_0x44c4('0x4b')](hopperContacts))[_0x44c4('0x45')](_0x44c4('0x46')))[_0x44c4('0x40')]();return _0xd03b48;}function _0x1e646a(_0xb4ea82,_0x2742ae){var _0x56e576=squel[_0x44c4('0x33')]()[_0x44c4('0x34')]('cm_hopper_black')[_0x44c4('0x36')]([_0x44c4('0x37'),_0x44c4('0x3f'),_0x44c4('0x39'),_0x2742ae,_0x44c4('0x3a'),_0x44c4('0x3b')],squel[_0x44c4('0x3c')]()[_0x44c4('0x3d')](_0x44c4('0x37'),_0x44c4('0x37'))['field']('id',_0x44c4('0x3f'))[_0x44c4('0x3d')](LISTID[_0x44c4('0x40')](),_0x44c4('0x39'))[_0x44c4('0x3d')](_0xb4ea82['id']['toString'](),_0x2742ae)['field'](_0x44c4('0x3e'),_0x44c4('0x3a'))[_0x44c4('0x3d')]('NOW()',_0x44c4('0x3b'))[_0x44c4('0x41')](_0x44c4('0x42'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x44c4('0x40')]())[_0x44c4('0x45')](_0x44c4('0x49'),squel[_0x44c4('0x4b')](hopperContacts))[_0x44c4('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x44c4('0x40')]();return _0x56e576;}return db[_0x44c4('0x4c')][_0x44c4('0x4d')]({'where':{'type':_0x44c4('0x4e')},'attributes':['id',_0x44c4('0x4f')],'include':[{'model':db['CmList'],'as':_0x44c4('0x50'),'where':{'id':LISTID}}]})[_0x44c4('0x2b')](function(_0x718acb){var _0x2dc195=[];if(_0x718acb){var _0x4ddf25;for(var _0x46ebe1=0x0,_0x257acc;_0x46ebe1<_0x718acb[_0x44c4('0x25')];_0x46ebe1+=0x1){_0x257acc=_0x718acb[_0x46ebe1]['get']({'plain':!![]});switch(_0x257acc[_0x44c4('0x4f')]){case _0x44c4('0x51'):_0x2dc195[_0x44c4('0x2c')](db[_0x44c4('0x52')][_0x44c4('0x53')](_0x23af75(_0x257acc,_0x44c4('0x54')))[_0x44c4('0x2b')](function(){})[_0x44c4('0x2d')](_0x5c8894()));break;case'onlyIfOpen':_0x2dc195['push'](db[_0x44c4('0x52')]['query'](_0x4d2b58(_0x257acc,_0x44c4('0x54')))['then'](function(){})[_0x44c4('0x2d')](_0x5c8894()));break;default:_0x2dc195[_0x44c4('0x2c')](db[_0x44c4('0x52')][_0x44c4('0x53')](_0xd61c(_0x257acc,'VoiceQueueId'))[_0x44c4('0x2b')](function(){})[_0x44c4('0x2d')](_0x5c8894()));}}}return _0x2dc195;})['all']()[_0x44c4('0x2b')](function(){return db[_0x44c4('0x4c')][_0x44c4('0x4d')]({'where':{'type':_0x44c4('0x4e')},'attributes':['id'],'include':[{'model':db[_0x44c4('0x55')],'as':_0x44c4('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x5d3a82){var _0x5aeec1=[];if(_0x5d3a82){var _0x310ed7;for(var _0x354cd2=0x0,_0x4822a0;_0x354cd2<_0x5d3a82[_0x44c4('0x25')];_0x354cd2+=0x1){_0x4822a0=_0x5d3a82[_0x354cd2][_0x44c4('0x57')]({'plain':!![]});_0x5aeec1[_0x44c4('0x2c')](db[_0x44c4('0x52')][_0x44c4('0x53')](_0x1e646a(_0x4822a0,'VoiceQueueId'))['then'](function(){})[_0x44c4('0x2d')](_0x5c8894()));}}return _0x5aeec1;})[_0x44c4('0x58')]();})[_0x44c4('0x2b')](function(){return db['Campaign'][_0x44c4('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x44c4('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x44c4('0x2b')](function(_0x584a11){var _0x2de5e4=[];if(_0x584a11){for(var _0x201b4c=0x0,_0x5ee181;_0x201b4c<_0x584a11[_0x44c4('0x25')];_0x201b4c+=0x1){_0x5ee181=_0x584a11[_0x201b4c]['get']({'plain':!![]});switch(_0x5ee181[_0x44c4('0x4f')]){case'always':_0x2de5e4[_0x44c4('0x2c')](db[_0x44c4('0x52')][_0x44c4('0x53')](_0x23af75(_0x5ee181,'CampaignId'))[_0x44c4('0x2b')](function(){})[_0x44c4('0x2d')](_0x5c8894()));break;case _0x44c4('0x59'):_0x2de5e4[_0x44c4('0x2c')](db[_0x44c4('0x52')]['query'](_0x4d2b58(_0x5ee181,_0x44c4('0x5a')))[_0x44c4('0x2b')](function(){})[_0x44c4('0x2d')](_0x5c8894()));break;default:_0x2de5e4['push'](db[_0x44c4('0x52')]['query'](_0xd61c(_0x5ee181,_0x44c4('0x5a')))[_0x44c4('0x2b')](function(){})[_0x44c4('0x2d')](_0x5c8894()));}}}return _0x2de5e4;})['all']();})[_0x44c4('0x2b')](function(){return db[_0x44c4('0x5b')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x19a18c){var _0x11afff=[];if(_0x19a18c){for(var _0x4186f7=0x0,_0x3dcf06;_0x4186f7<_0x19a18c[_0x44c4('0x25')];_0x4186f7+=0x1){_0x3dcf06=_0x19a18c[_0x4186f7][_0x44c4('0x57')]({'plain':!![]});_0x11afff[_0x44c4('0x2c')](db[_0x44c4('0x52')]['query'](_0x1e646a(_0x3dcf06,'CampaignId'))[_0x44c4('0x2b')](function(){})['catch'](_0x5c8894()));}}return _0x11afff;})[_0x44c4('0x58')]();})[_0x44c4('0x2d')](function(_0x3d6d68){logger[_0x44c4('0x13')](_0x44c4('0x5c'),_0x44c4('0x5d'),_0x3d6d68['message']);});}var processPromises=function(_0x1caba1){return BPromise['all'](promises)[_0x44c4('0x2b')](function(_0x46e30b){})[_0x44c4('0x2d')](function(_0x55b661){logger['error'](_0x44c4('0x5e'),JSON[_0x44c4('0x30')](_0x55b661));})[_0x44c4('0x5f')](function(){socket[_0x44c4('0x60')](_0x44c4('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1caba1){return _0x1caba1[_0x44c4('0x62')]();}});};var endCsv=function(){return BPromise[_0x44c4('0x63')]()[_0x44c4('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x44c4('0x2b')](function(){socket[_0x44c4('0x60')](_0x44c4('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x44c4('0x64')](FILEPATH);}catch(_0x1b7592){logger[_0x44c4('0x13')](_0x44c4('0x65'),JSON[_0x44c4('0x30')](_0x1b7592));}finally{process[_0x44c4('0x66')](0x0);}});};process['on'](_0x44c4('0x67'),function(){logger[_0x44c4('0x68')](_0x44c4('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0x44c4('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x44c4('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb1c85f){var _0x4b4673=fs[_0x44c4('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x44c4('0x6b')](_0x4b4673,{'header':!![],'skipEmptyLines':!![],'step':function(_0x19754f,_0x26fc28){total+=0x1;var _0x72d47b=total;promises['push'](checkRow(_0x19754f,_0xb1c85f,_0x72d47b)[_0x44c4('0x2b')](function(){success+=0x1;})[_0x44c4('0x2d')](function(_0x36d481){if(_0x36d481[_0x44c4('0x13')]){errors+=0x1;delete _0x36d481[_0x44c4('0x13')];}else if(_0x36d481['duplicate']){duplicates+=0x1;delete _0x36d481[_0x44c4('0x27')];}rows['push'](_0x36d481);}));if(total%0xc8===0x0){_0x26fc28['pause']();return processPromises(_0x26fc28);}},'complete':function(){return processPromises()[_0x44c4('0x2b')](function(){logger['info'](_0x44c4('0x6c'));endCsv();});},'error':function(_0x5e50ad,_0x6c4867){logger[_0x44c4('0x68')](_0x44c4('0x6d'),JSON['stringify'](_0x5e50ad));endCsv();}});})[_0x44c4('0x2d')](function(_0x561d24){logger[_0x44c4('0x13')](_0x44c4('0x6e'),JSON[_0x44c4('0x30')](_0x561d24));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 55a0a48..bf10e29 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 _0x16e6=['campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','name','_description','parse','createReadStream','rows','data','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(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','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','length','split','isNil','findOne','CmContactHasItem','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','toString','cm_contacts.priority','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','code','message','sequelize','query','spread','catch','campaigns.id'];(function(_0x17cdd6,_0x94ae6d){var _0x42970a=function(_0x54904a){while(--_0x54904a){_0x17cdd6['push'](_0x17cdd6['shift']());}};_0x42970a(++_0x94ae6d);}(_0x16e6,0x10e));var _0x616e=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x16e6[_0x553150];return _0x18193d;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x616e('0x0'));var Papa=require(_0x616e('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x616e('0x2'));var squel=require(_0x616e('0x3'));var Redis=require(_0x616e('0x4'));var db=require(_0x616e('0x5'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x616e('0x6'))(_0x616e('0x7'));config[_0x616e('0x8')]=_['defaults'](config[_0x616e('0x8')],{'host':_0x616e('0x9'),'port':0x18eb});var socket=require(_0x616e('0xa'))(new Redis(config[_0x616e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x616e('0xb')](_0x616e('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5a3e74){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))*$/[_0x616e('0xd')](_0x5a3e74);}function selectNotIn(_0x2f1833,_0x385617,_0x131156,_0x53f389,_0x9cc400){return squel[_0x616e('0xe')]()[_0x616e('0xf')](_0x616e('0x10'))['from'](_0x53f389)[_0x616e('0x11')](_0x385617,null,_0x385617+_0x616e('0x12')+_0x53f389+'.'+_0x131156)[_0x616e('0x13')](_0x53f389+'.'+_0x131156+_0x616e('0x14')+_0x2f1833+'.'+_0x131156)[_0x616e('0x13')](_0x385617+_0x616e('0x15')+_0x9cc400[_0x616e('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43f989,_0xdbf1bf){promisesAdditionalPhones=[];return db['CmContact'][_0x616e('0x16')]({'raw':!![],'attributes':['id',_0x616e('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x616e('0x18')](function(_0x3119b7){if(_0x3119b7!==null){var _0x5edbf5=[];for(var _0x28fe42=0x0;_0x28fe42<_0x3119b7['length'];_0x28fe42++){var _0x585b78=_0x3119b7[_0x28fe42];_0x5edbf5[_0x616e('0x19')](insertAdditionalPhones(_0x585b78));}}Promise[_0x616e('0x1a')](_0x5edbf5)[_0x616e('0x18')](function(){_0x43f989({'val':0x1});});});});}function insertAdditionalPhones(_0x60b79d){return new Promise(function(_0x49b4a8,_0x4978e8){var _0x5cfc24=_0x60b79d['AdditionalPhones'];var _0x827e59=_0x5cfc24['split'](';');var _0x9587c5=[];orderBy=0x0;for(var _0x460951=0x0;_0x460951<_0x827e59[_0x616e('0x1b')];_0x460951++){_0x9587c5[_0x616e('0x19')](splitAdditionalPhone(_0x60b79d['id'],_0x827e59[_0x460951]));}Promise['all'](_0x9587c5)['then'](function(){_0x49b4a8({'val':_0x827e59['length']});});});}function splitAdditionalPhone(_0x7a3a9a,_0x3468b2){return new Promise(function(_0xba514c,_0x50a33b){var _0xa75b5d=_0x3468b2[_0x616e('0x1c')](':');var _0x4f4450=_0xa75b5d[0x0];var _0x13e74d=_0xa75b5d[0x1];if(!_[_0x616e('0x1d')](_0x13e74d)){var _0x31204a=_0x13e74d[_0x616e('0x1c')]('|');var _0x9fc987=[];for(var _0xd931cd=0x0;_0xd931cd<_0x31204a[_0x616e('0x1b')];_0xd931cd++){if(_0x31204a[_0xd931cd]!==''){var _0x50a968=_['filter'](promisesAdditionalPhones,{'contactId':_0x7a3a9a,'phone':_0x31204a[_0xd931cd]});if(_0x50a968[_0x616e('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x7a3a9a,'contactTypeId':_0x4f4450,'phone':_0x31204a[_0xd931cd],'orderBy':orderBy});}}}_0xba514c({'ok':0x1});}else _0xba514c({'res':0x0});});}function createAdditionalPhone(_0x233c1c,_0x50e702,_0x2d1fc5,_0x1fa645){var _0xdeb35b='';var _0x34d967='';var _0x3fbfcc=_0x2d1fc5[_0x616e('0x1c')]('§');_0xdeb35b=_0x3fbfcc[0x0];if(_0x3fbfcc[_0x616e('0x1b')]==0x2)_0x34d967=_0x3fbfcc[0x1];return new Promise(function(_0x1834d1,_0x10ec5c){return db['CmContactHasItem'][_0x616e('0x1e')]({'where':{'CmContactId':_0x233c1c,'item':_0xdeb35b}})['then'](function(_0x46a3f7){if(_0x46a3f7){return db[_0x616e('0x1f')][_0x616e('0x20')]({'ItemTypeId':_0x50e702,'description':_0x34d967,'OrderBy':_0x1fa645},{'where':{'CmContactId':_0x233c1c,'item':_0xdeb35b}})[_0x616e('0x18')](function(_0xb31489){_0x1834d1({'res':_0x616e('0x21')});});}else{return db[_0x616e('0x1f')][_0x616e('0x22')]({'CmContactId':_0x233c1c,'item':_0xdeb35b,'description':_0x34d967,'ItemTypeId':_0x50e702,'OrderBy':_0x1fa645,'ItemClass':_0x616e('0x23')})[_0x616e('0x18')](function(_0xb10f8d){_0x1834d1({'res':'inserted'});});}});});}function insertCmHopper(_0x966efe,_0x2ea104,_0x5b668d,_0x43023c,_0x21a7fa){var _0x553a5f=[_0x616e('0x24'),'cm_contacts.scheduledat',_0x616e('0x25'),_0x616e('0x26'),_0x2ea104+'.'+_0x43023c,'cm_contacts.createdAt',_0x616e('0x27'),'cm_contacts.priority',_0x616e('0x28'),'\x22'+_0x21a7fa+'\x22'];return squel[_0x616e('0x29')]()[_0x616e('0x2a')](_0x616e('0x2b'))[_0x616e('0x2c')](['phone',_0x616e('0x2d'),_0x616e('0x2e'),_0x616e('0x2f'),_0x43023c,_0x616e('0x30'),_0x616e('0x31'),_0x616e('0x32'),_0x616e('0x33'),_0x616e('0x34')],squel['select']()[_0x616e('0x35')](_0x553a5f)[_0x616e('0x36')](_0x2ea104)[_0x616e('0x11')](_0x616e('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x2ea104+_0x616e('0x38'))[_0x616e('0x11')](_0x5b668d,null,_0x5b668d+_0x616e('0x12')+_0x2ea104+'.'+_0x43023c)[_0x616e('0x13')](_0x2ea104+_0x616e('0x39'),_0x966efe)[_0x616e('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x616e('0x3a'),selectNotIn(_0x2ea104,_0x5b668d,_0x43023c,'cm_hopper',[_0x616e('0x3b'),_0x616e('0x3c')]))[_0x616e('0x13')](_0x616e('0x3a'),selectNotIn(_0x2ea104,_0x5b668d,_0x43023c,_0x616e('0x2b'),[_0x616e('0x3b')])))['toString']();}function insertCmHopperBlack(_0x4a725e,_0x4c3184,_0x42ed42,_0x28aa1c){var _0x23cd28=['cm_contacts.phone',_0x616e('0x25'),_0x616e('0x26'),_0x4c3184+'.'+_0x28aa1c,_0x616e('0x3d'),_0x616e('0x27')];return squel['insert']()['into'](_0x616e('0x3e'))['fromQuery']([_0x616e('0x10'),_0x616e('0x2e'),_0x616e('0x2f'),_0x28aa1c,_0x616e('0x30'),'updatedAt'],squel[_0x616e('0xe')]()[_0x616e('0x35')](_0x23cd28)[_0x616e('0x36')](_0x4c3184)[_0x616e('0x11')](_0x616e('0x37'),null,_0x616e('0x3f')+_0x4c3184+_0x616e('0x38'))[_0x616e('0x11')](_0x42ed42,null,_0x42ed42+_0x616e('0x12')+_0x4c3184+'.'+_0x28aa1c)['where'](_0x4c3184+_0x616e('0x39'),_0x4a725e)[_0x616e('0x13')](_0x616e('0x40'),NOW)[_0x616e('0x13')](_0x616e('0x3a'),squel['select']()[_0x616e('0xf')]('phone')[_0x616e('0x36')](_0x616e('0x3e'))[_0x616e('0x13')](_0x616e('0x41'),_0x4a725e)[_0x616e('0x13')](_0x28aa1c+_0x616e('0x14')+_0x4c3184+'.'+_0x28aa1c)))[_0x616e('0x42')]();}function insertTzCmHopper(_0x4b6022,_0x5568da,_0x186a65,_0xeed797,_0x1b3e5c,_0x47a17f){var _0x3d55be=[_0x616e('0x24'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x47a17f+'.offset-cm_contacts.utcOffset\x20minute)',_0x616e('0x25'),_0x616e('0x26'),_0x5568da+'.'+_0xeed797,_0x616e('0x3d'),_0x616e('0x27'),_0x616e('0x43'),_0x616e('0x28'),'\x22'+_0x1b3e5c+'\x22'];var _0x2246a6=squel['insert']()['into'](_0x616e('0x2b'))['fromQuery']([_0x616e('0x10'),'scheduledat',_0x616e('0x2e'),'ListId',_0xeed797,_0x616e('0x30'),_0x616e('0x31'),_0x616e('0x32'),_0x616e('0x33'),'recallme'],squel[_0x616e('0xe')]()[_0x616e('0x35')](_0x3d55be)[_0x616e('0x36')](_0x5568da)[_0x616e('0x11')](_0x616e('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x5568da+_0x616e('0x38'))[_0x616e('0x11')](_0x186a65,null,_0x186a65+_0x616e('0x12')+_0x5568da+'.'+_0xeed797)[_0x616e('0x11')](_0x47a17f,null,_0x47a17f+_0x616e('0x12')+_0x5568da+'.'+_0xeed797)['where'](_0x5568da+_0x616e('0x39'),_0x4b6022)[_0x616e('0x13')](_0x616e('0x40'),NOW)[_0x616e('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5568da,_0x186a65,_0xeed797,'cm_hopper',[_0x616e('0x3b'),_0x616e('0x3c')]))[_0x616e('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5568da,_0x186a65,_0xeed797,_0x616e('0x2b'),[_0x616e('0x3b')])))['toString']();return _0x2246a6;}function insertTzCmHopperBlack(_0x44ce32,_0x412239,_0x1ab3f0,_0x140b99){var _0x1a4ac1=['cm_contacts.phone','cm_contacts.id',_0x616e('0x26'),_0x412239+'.'+_0x140b99,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x616e('0x29')]()[_0x616e('0x2a')](_0x616e('0x3e'))[_0x616e('0x2c')](['phone',_0x616e('0x2e'),_0x616e('0x2f'),_0x140b99,'createdAt',_0x616e('0x31')],squel[_0x616e('0xe')]()[_0x616e('0x35')](_0x1a4ac1)[_0x616e('0x36')](_0x412239)['join'](_0x616e('0x37'),null,_0x616e('0x3f')+_0x412239+_0x616e('0x38'))[_0x616e('0x11')](_0x1ab3f0,null,_0x1ab3f0+_0x616e('0x12')+_0x412239+'.'+_0x140b99)[_0x616e('0x13')](_0x412239+_0x616e('0x39'),_0x44ce32)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x616e('0x13')](_0x616e('0x3a'),squel[_0x616e('0xe')]()[_0x616e('0xf')](_0x616e('0x10'))[_0x616e('0x36')](_0x616e('0x3e'))[_0x616e('0x13')](_0x616e('0x41'),_0x44ce32)['where'](_0x140b99+_0x616e('0x14')+_0x412239+'.'+_0x140b99)))[_0x616e('0x42')]();}function insertCmHopperAdditionalPhones(_0x384bca){var _0x3cfacc=[_0x616e('0x44'),_0x616e('0x45'),_0x616e('0x46'),_0x616e('0x47'),_0x616e('0x48')];return squel[_0x616e('0x29')]()['into'](_0x616e('0x49'))[_0x616e('0x2c')]([_0x616e('0x4a'),_0x616e('0x10'),_0x616e('0x4b'),'createdAt','updatedAt'],squel[_0x616e('0xe')]()['fields'](_0x3cfacc)[_0x616e('0x36')](_0x616e('0x2b'))[_0x616e('0x11')](_0x616e('0x37'),null,_0x616e('0x4c'))['join']('cm_contact_has_items',null,_0x616e('0x4d'))[_0x616e('0x13')](_0x616e('0x4e'),_0x384bca)['where'](_0x616e('0x40'),NOW))[_0x616e('0x42')]();}function insertCmContact(_0xc7f0a2,_0x4e5c85,_0x3c3f17,_0x2c0f93){var _0x4ce3d6=_[_0x616e('0x4f')](_[_0x616e('0x50')](_0x2c0f93),[_0x616e('0x2f'),_0x616e('0x51'),_0x616e('0x30'),_0x616e('0x31'),_0x616e('0x52')]);return squel[_0x616e('0x29')]()[_0x616e('0x2a')](_0x616e('0x37'))[_0x616e('0x2c')](_0x4ce3d6,squel[_0x616e('0xe')]()['fields'](_0x4ce3d6)[_0x616e('0x36')](_0x4e5c85)['where']('('+_0x3c3f17[_0x616e('0x11')](',')+_0x616e('0x53'),squel[_0x616e('0xe')]()[_0x616e('0x35')](_0x3c3f17)[_0x616e('0x36')](_0x616e('0x37'))[_0x616e('0x13')](_0x616e('0x41'),_0xc7f0a2)[_0x616e('0x13')](_0x616e('0x54')))[_0x616e('0x13')](_0x616e('0x55'),squel[_0x616e('0xe')]()[_0x616e('0xf')](_0x616e('0x56'),_0x616e('0x57'))['from'](_0x4e5c85)[_0x616e('0x58')](_0x3c3f17[_0x616e('0x11')](','))))[_0x616e('0x42')]();}function handleStop(){logger[_0x616e('0x59')](_0x616e('0x5a'));stopped=!![];}function handleUncaughtException(_0xd83057){logger[_0x616e('0x5b')](_0xd83057['message']);process['exit'](0x1);}function handleError(_0x13c87b,_0x2b4ee6){stats[_0x616e('0x5c')]['push']({'name':_0x2b4ee6[_0x616e('0x5d')],'message':_0x2b4ee6[_0x616e('0x5e')],'row':_0x13c87b});}function handleQuery(_0x423d55){logger[_0x616e('0x59')](_0x423d55);return db[_0x616e('0x5f')][_0x616e('0x60')](_0x423d55)[_0x616e('0x61')](function(_0x5db29a){results[_0x616e('0x19')](_0x5db29a);})[_0x616e('0x62')](function(_0x10d889){logger[_0x616e('0x5b')](_0x10d889['message']);});}function updateTzCampaigns(_0x7445f){return new Promise(function(_0x557cc9,_0x38b94f){var _0x1f6571=squel['select']()['fields']([_0x616e('0x63'),'campaigns.dialTimezone'])[_0x616e('0x36')](_0x616e('0x64'))['join'](_0x616e('0x65'),null,_0x616e('0x66'))[_0x616e('0x13')]('campaigns_has_cm_lists.CmListId='+_0x7445f);db[_0x616e('0x5f')][_0x616e('0x60')](_0x1f6571[_0x616e('0x42')]())[_0x616e('0x61')](function(_0x4a93dc){var _0x479b7c=[];for(var _0x36d40f=0x0;_0x36d40f<_0x4a93dc[_0x616e('0x1b')];_0x36d40f++){_0x479b7c[_0x616e('0x19')](getTimezoneData(_0x4a93dc[_0x36d40f],tmp_campaigns));}BPromise[_0x616e('0x1a')](_0x479b7c)[_0x616e('0x18')](function(){_0x557cc9({'val':0x1});});})[_0x616e('0x62')](function(_0x1050b4){logger[_0x616e('0x5b')](_0x1050b4[_0x616e('0x5e')]);_0x557cc9({'val':0x0});});});}function updateTzVoiceQueues(_0x286a3c){return new Promise(function(_0x548f77,_0xdd1f03){var _0x43c733=squel[_0x616e('0xe')]()[_0x616e('0x35')]([_0x616e('0x67'),_0x616e('0x68')])[_0x616e('0x36')](_0x616e('0x69'))[_0x616e('0x11')](_0x616e('0x6a'),null,_0x616e('0x6b'))['where'](_0x616e('0x6c')+_0x286a3c);db[_0x616e('0x5f')]['query'](_0x43c733[_0x616e('0x42')]())[_0x616e('0x61')](function(_0xf4285c){var _0x34900d=[];for(var _0x3c9fd3=0x0;_0x3c9fd3<_0xf4285c[_0x616e('0x1b')];_0x3c9fd3++){_0x34900d[_0x616e('0x19')](getTimezoneData(_0xf4285c[_0x3c9fd3],tmp_voice_queues));}BPromise[_0x616e('0x1a')](_0x34900d)[_0x616e('0x18')](function(){_0x548f77({'val':0x1});});})[_0x616e('0x62')](function(_0x307973){logger[_0x616e('0x5b')](_0x307973['message']);_0x548f77({'val':0x0});});});}function getTimezoneData(_0x403d6b,_0x5edcec){return new Promise(function(_0x2edfdf,_0x384215){var _0x37a115=shared[_0x616e('0x6d')];var _0x214fb8=_0x37a115[_0x403d6b[_0x616e('0x6e')]];if(_[_0x616e('0x1d')](_0x214fb8)){_0x2edfdf({'ret':0x1});}else{var _0x409c3d=_0x214fb8[_0x616e('0x6f')];var _0x411305=squel['insert']()['into'](_0x5edcec)['set']('id',_0x403d6b['id'])[_0x616e('0x70')](_0x616e('0x71'),_0x409c3d)[_0x616e('0x70')](_0x616e('0x6e'),_0x403d6b['dialTimezone'])[_0x616e('0x42')]();return db[_0x616e('0x5f')][_0x616e('0x60')](_0x411305)[_0x616e('0x61')](function(_0xe1434d){_0x2edfdf({'ret':0x1});})[_0x616e('0x62')](function(_0x64b346){logger[_0x616e('0x5b')](_0x64b346['message']);_0x384215({'ret':0x1});});}});}function handleTZQuery(_0x2df9d5){logger[_0x616e('0x59')](_0x2df9d5);return db[_0x616e('0x5f')]['query'](_0x2df9d5)['spread'](function(_0x463e63){})[_0x616e('0x62')](function(_0x2b4e48){logger[_0x616e('0x5b')](_0x2b4e48[_0x616e('0x5e')]);});}function main(_0x3515b2,_0x445013,_0x393a39,_0x2e1b46){logger[_0x616e('0x59')](_0x616e('0x72'),_0x3515b2,JSON[_0x616e('0x73')](_0x445013));process[_0x616e('0x74')](_0x616e('0x75'));var _0x18e11f=_0x445013[_0x616e('0x76')];var _0x31ab70=_[_0x616e('0x77')](_0x18e11f);var _0x149901=_0x445013[_0x616e('0x78')];var _0x4b667e=path[_0x616e('0x11')](config[_0x616e('0x79')],_0x616e('0x7a'),_0x149901+_0x616e('0x7b'));hasTZ=_[_0x616e('0x50')](_0x18e11f)[_0x616e('0x7c')](_0x616e('0x6e'));var _0x37006f=_[_0x616e('0x50')](_0x18e11f)[_0x616e('0x11')]();logger['info'](_0x616e('0x7d'),_0x37006f);db['ContactItemType'][_0x616e('0x16')]({'raw':!![],'attributes':['id',_0x616e('0x7e')]})[_0x616e('0x18')](function(_0x48fe58){for(var _0x14d4f8=0x0;_0x14d4f8<_0x48fe58['length'];_0x14d4f8++){if(_0x48fe58[_0x14d4f8]['name']in _0x18e11f){contactItemTypes[_0x616e('0x19')](_0x48fe58[_0x14d4f8]);delete _0x31ab70[_0x48fe58[_0x14d4f8][_0x616e('0x7e')]];hasAdditionalPhones=!![];}for(var _0xf6ac1d in _0x18e11f){if(_0x48fe58[_0x14d4f8]['name']+_0x616e('0x7f')===_0xf6ac1d){phoneDescriptions[_0x616e('0x19')]({'itemTypeId':_0x48fe58[_0x14d4f8]['id'],'description':_0xf6ac1d});delete _0x31ab70[_0xf6ac1d];}}}if(hasAdditionalPhones)_0x31ab70[_0x616e('0x17')]='';var _0x3f154e=_[_0x616e('0x50')](_0x31ab70)[_0x616e('0x11')]();logger[_0x616e('0x59')]('header',_0x3f154e);fs['writeFileSync'](_0x4b667e,_0x3f154e+'\x0a');Papa[_0x616e('0x80')](fs[_0x616e('0x81')](_0x3515b2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x37fd7c,_0x295745){try{for(var _0x3a176d=0x0,_0x552762=[];_0x3a176d<_0x37fd7c['data'][_0x616e('0x1b')];_0x3a176d++){stats[_0x616e('0x82')]+=0x1;if(_0x37fd7c[_0x616e('0x5c')][_0x3a176d]){handleError(_0x37fd7c[_0x616e('0x83')][_0x3a176d],_0x37fd7c['errors'][_0x3a176d]);}else{var _0x131369=[];var _0x5deaf0=[];var _0xd4bd41={};for(var _0x4b0d9d in _0x18e11f){let _0x32cde0=contactItemTypes[_0x616e('0x84')](_0x466613=>_0x466613['name']===_0x4b0d9d);let _0x5f351d=contactItemTypes[_0x616e('0x84')](_0x404bdf=>_0x404bdf[_0x616e('0x7e')]+_0x616e('0x7f')===_0x4b0d9d);if(_[_0x616e('0x1d')](_0x32cde0)&&_[_0x616e('0x1d')](_0x5f351d)){if(_0x18e11f[_0x616e('0x85')](_0x4b0d9d)){if(_0x37fd7c[_0x616e('0x83')][_0x3a176d][_0x18e11f[_0x4b0d9d]]){var _0x5703ee=_[_0x616e('0x86')](_0x37fd7c[_0x616e('0x83')][_0x3a176d][_0x18e11f[_0x4b0d9d]][_0x616e('0x87')](/"/g,'\x27'));switch(_0x4b0d9d){case _0x616e('0x2d'):var _0x12412e=moment(_0x5703ee,_0x616e('0xc'),!![]);if(_0x12412e[_0x616e('0x88')]()){_0x552762[_0x616e('0x19')]('\x22'+_0x5703ee+'\x22');}else{_0x131369[_0x616e('0x19')](_0x616e('0x89'));}break;case _0x616e('0x32'):var _0x4aa317=parseInt(_0x5703ee);_0x5703ee=_['isNaN'](_0x4aa317)||_0x4aa317<0x0||_0x4aa317>0x4?_0x2e1b46?0x3:0x2:_0x4aa317;_0x552762[_0x616e('0x19')]('\x22'+_0x5703ee+'\x22');break;case _0x616e('0x33'):var _0x4e4d56=parseInt(_0x5703ee);if(_['isNumber'](_0x4e4d56)&&_[_0x616e('0x7c')](_0x393a39,_0x4e4d56)){_0x552762[_0x616e('0x19')]('\x22'+_0x4e4d56+'\x22');}else{_0x131369[_0x616e('0x19')](_0x616e('0x8a'));}break;case _0x616e('0x8b'):if(isEmail(_0x5703ee)){_0x552762[_0x616e('0x19')]('\x22'+_0x5703ee+'\x22');}else{_0x131369['push'](_0x616e('0x8c'));}break;case _0x616e('0x8d'):var _0x924728=moment(_0x5703ee,_0x616e('0x8e'),!![]);if(_0x924728[_0x616e('0x88')]()){_0x552762[_0x616e('0x19')]('\x22'+_0x5703ee+'\x22');}else{_0x131369[_0x616e('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x616e('0x6e'):var _0x5d3d50=shared['timezones'];var _0x14fe43=_0x5d3d50[_0x5703ee];if(!_[_0x616e('0x1d')](_0x14fe43)){var _0x5dbb3a=_0x14fe43[_0x616e('0x6f')];_0x552762['push']('\x22'+_0x5703ee+'\x22');_0x552762[_0x616e('0x19')]('\x22'+_0x5dbb3a+'\x22');}break;default:_0x552762[_0x616e('0x19')]('\x22'+_0x5703ee+'\x22');}}else{switch(_0x4b0d9d){case _0x616e('0x8f'):case'phone':_0x131369[_0x616e('0x19')](_0x4b0d9d+'\x20not\x20specified');break;default:_0x552762[_0x616e('0x19')]('\x22\x22');}}}}else{var _0x17ad7e='';if(!_[_0x616e('0x1d')](_0x32cde0)){if(!_0xd4bd41['hasOwnProperty'](_0x32cde0['id'])){if(!_[_0x616e('0x1d')](_0x37fd7c[_0x616e('0x83')][_0x3a176d][_0x18e11f[_0x4b0d9d]])){var _0x5703ee=_[_0x616e('0x86')](_0x37fd7c['data'][_0x3a176d][_0x18e11f[_0x4b0d9d]][_0x616e('0x87')](/"/g,'\x27'));var _0x138baa=phoneDescriptions[_0x616e('0x84')](_0x178d4a=>_0x178d4a[_0x616e('0x90')]===_0x32cde0['id']);if(!_[_0x616e('0x1d')](_0x138baa)){var _0x53f052=_['trim'](_0x37fd7c['data'][_0x3a176d][_0x18e11f[_0x138baa[_0x616e('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x616e('0x1d')](_0x53f052))_0x5703ee=_0x5703ee+'§'+_0x53f052;}if(_0x17ad7e=='')_0x17ad7e=_0x5703ee;else _0x17ad7e+='|'+_0x5703ee;}_0x5deaf0[_0x616e('0x19')](_0x32cde0['id']+':'+_0x17ad7e);_0xd4bd41[_0x32cde0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x552762[_0x616e('0x19')]('\x22'+_0x5deaf0[_0x616e('0x11')](';')+'\x22');}if(_0x131369['length']){handleError(_0x37fd7c[_0x616e('0x83')][_0x3a176d],{'code':_0x616e('0x92'),'message':_0x131369[_0x616e('0x11')]()});}else{fs[_0x616e('0x93')](_0x4b667e,_0x552762[_0x616e('0x11')]()+'\x0a');}_0x552762=[];}if(!(stats[_0x616e('0x82')]%0xc8)){socket[_0x616e('0x94')](_0x616e('0x95')+_0x149901,stats);stats[_0x616e('0x5c')]=[];}}if(stopped){logger['info'](_0x616e('0x96'));_0x295745[_0x616e('0x97')]();}}catch(_0xf30bfc){handleError(_0x37fd7c['data'][_0x3a176d],{'code':'SystemError','message':_0xf30bfc[_0x616e('0x5e')]});logger[_0x616e('0x5b')](_0x616e('0x98'),_0xf30bfc[_0x616e('0x5e')]);}},'complete':function(){try{var _0x42d2c7=[];var _0x2b0ddb=[];var _0x208f50=_0x616e('0x37');if(_0x445013[_0x616e('0x99')]&&_0x445013['duplicates']['length']){_0x208f50='cm_contacts_'+_0x149901;_0x42d2c7[_0x616e('0x19')](_0x616e('0x9a')+_0x208f50+_0x616e('0x9b'));}tmp_campaigns=_0x616e('0x9c')+_0x149901;tmp_voice_queues='voice_queues_'+_0x149901;_0x2b0ddb[_0x616e('0x19')](_0x616e('0x9a')+tmp_campaigns+_0x616e('0x9d'));_0x2b0ddb[_0x616e('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x616e('0x9d'));BPromise[_0x616e('0x9e')](_0x2b0ddb,handleTZQuery)[_0x616e('0x18')](function(_0x233237){updateTzCampaigns(_0x445013['ListId'])[_0x616e('0x18')](function(_0x5f4711){updateTzVoiceQueues(_0x445013[_0x616e('0x2f')])[_0x616e('0x18')](function(_0x140160){if(hasTZ)_0x3f154e=_0x3f154e[_0x616e('0x87')]('dialTimezone',_0x616e('0x9f'));var _0x665538=util[_0x616e('0xb')](_0x616e('0xa0'),_0x4b667e,_0x208f50,_0x3f154e,_0x445013['ListId'],_0x445013['CompanyId']||null,NOW,NOW);if(_[_0x616e('0x1d')](_0x18e11f[_0x616e('0x2d')])){_0x665538+=',\x20scheduledAt\x20=\x20NOW()';}_0x42d2c7[_0x616e('0x19')](_0x665538);if(_0x445013['duplicates']&&_0x445013[_0x616e('0x99')][_0x616e('0x1b')]){_0x42d2c7[_0x616e('0x19')](insertCmContact(_0x445013[_0x616e('0x2f')],_0x208f50,_0x445013[_0x616e('0x99')],_0x18e11f));_0x42d2c7['push'](_0x616e('0xa1')+_0x208f50+';');}BPromise[_0x616e('0x9e')](_0x42d2c7,handleQuery)['then'](function(_0x32c96d){BPromise[_0x616e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x42d2c7=[];for(var _0x2ba730=0x0;_0x2ba730\x20\x20','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','length','push','all','split','CmContactHasItem','findOne','update','updated','create','then','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','into','cm_hopper_black','ContactId','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','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','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc4cf,0x1ae));var _0xfc4c=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xc4cf[_0x26f702];return _0x11417d;};'use strict';var fs=require('fs');var path=require(_0xfc4c('0x0'));var _=require(_0xfc4c('0x1'));var Papa=require('papaparse');var util=require(_0xfc4c('0x2'));var BPromise=require(_0xfc4c('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xfc4c('0x4'));var db=require(_0xfc4c('0x5'))['db'];var config=require(_0xfc4c('0x6'));var shared=require(_0xfc4c('0x7'));var logger=require(_0xfc4c('0x8'))(_0xfc4c('0x9'));config[_0xfc4c('0xa')]=_[_0xfc4c('0xb')](config[_0xfc4c('0xa')],{'host':_0xfc4c('0xc'),'port':0x18eb});var socket=require(_0xfc4c('0xd'))(new Redis(config[_0xfc4c('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfc4c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xfc4c('0xf'));function isEmail(_0x3af84b){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'](_0x3af84b);}function selectNotIn(_0x12d790,_0x34abb0,_0xc441c2,_0x167f7d,_0x11466f){return squel[_0xfc4c('0x10')]()['field'](_0xfc4c('0x11'))[_0xfc4c('0x12')](_0x167f7d)[_0xfc4c('0x13')](_0x34abb0,null,_0x34abb0+_0xfc4c('0x14')+_0x167f7d+'.'+_0xc441c2)[_0xfc4c('0x15')](_0x167f7d+'.'+_0xc441c2+_0xfc4c('0x16')+_0x12d790+'.'+_0xc441c2)[_0xfc4c('0x15')](_0x34abb0+'.dialCheckDuplicateType\x20IN\x20('+_0x11466f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2a27f2,_0x3037e9){promisesAdditionalPhones=[];return db[_0xfc4c('0x17')][_0xfc4c('0x18')]({'raw':!![],'attributes':['id',_0xfc4c('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x16da53){if(_0x16da53!==null){var _0x5802eb=[];for(var _0x2b3926=0x0;_0x2b3926<_0x16da53[_0xfc4c('0x1a')];_0x2b3926++){var _0x217f4d=_0x16da53[_0x2b3926];_0x5802eb[_0xfc4c('0x1b')](insertAdditionalPhones(_0x217f4d));}}Promise[_0xfc4c('0x1c')](_0x5802eb)['then'](function(){_0x2a27f2({'val':0x1});});});});}function insertAdditionalPhones(_0x2a7f2a){return new Promise(function(_0x2851b6,_0x532640){var _0x5c26dd=_0x2a7f2a['AdditionalPhones'];var _0x1ad2e4=_0x5c26dd[_0xfc4c('0x1d')](';');var _0x28fec8=[];orderBy=0x0;for(var _0x3fe70f=0x0;_0x3fe70f<_0x1ad2e4[_0xfc4c('0x1a')];_0x3fe70f++){_0x28fec8[_0xfc4c('0x1b')](splitAdditionalPhone(_0x2a7f2a['id'],_0x1ad2e4[_0x3fe70f]));}Promise[_0xfc4c('0x1c')](_0x28fec8)['then'](function(){_0x2851b6({'val':_0x1ad2e4['length']});});});}function splitAdditionalPhone(_0x4cd7e9,_0x4e6434){return new Promise(function(_0x4ed639,_0x22a50e){var _0x4c5105=_0x4e6434[_0xfc4c('0x1d')](':');var _0x42f049=_0x4c5105[0x0];var _0x43d37b=_0x4c5105[0x1];if(!_['isNil'](_0x43d37b)){var _0xc4bbf3=_0x43d37b[_0xfc4c('0x1d')]('|');var _0x13579a=[];for(var _0xe58d08=0x0;_0xe58d08<_0xc4bbf3[_0xfc4c('0x1a')];_0xe58d08++){if(_0xc4bbf3[_0xe58d08]!==''){var _0x54efbd=_['filter'](promisesAdditionalPhones,{'contactId':_0x4cd7e9,'phone':_0xc4bbf3[_0xe58d08]});if(_0x54efbd[_0xfc4c('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xfc4c('0x1b')]({'contactId':_0x4cd7e9,'contactTypeId':_0x42f049,'phone':_0xc4bbf3[_0xe58d08],'orderBy':orderBy});}}}_0x4ed639({'ok':0x1});}else _0x4ed639({'res':0x0});});}function createAdditionalPhone(_0x51fd3f,_0x4e86d6,_0x3438a4,_0x16bc97){var _0x26b204='';var _0x282ded='';var _0x4b7a38=_0x3438a4[_0xfc4c('0x1d')]('§');_0x26b204=_0x4b7a38[0x0];if(_0x4b7a38[_0xfc4c('0x1a')]==0x2)_0x282ded=_0x4b7a38[0x1];return new Promise(function(_0x21e723,_0x544f57){return db[_0xfc4c('0x1e')][_0xfc4c('0x1f')]({'where':{'CmContactId':_0x51fd3f,'item':_0x26b204}})['then'](function(_0x2dd225){if(_0x2dd225){return db[_0xfc4c('0x1e')][_0xfc4c('0x20')]({'ItemTypeId':_0x4e86d6,'description':_0x282ded,'OrderBy':_0x16bc97},{'where':{'CmContactId':_0x51fd3f,'item':_0x26b204}})['then'](function(_0x12e063){_0x21e723({'res':_0xfc4c('0x21')});});}else{return db[_0xfc4c('0x1e')][_0xfc4c('0x22')]({'CmContactId':_0x51fd3f,'item':_0x26b204,'description':_0x282ded,'ItemTypeId':_0x4e86d6,'OrderBy':_0x16bc97,'ItemClass':'PHONE'})[_0xfc4c('0x23')](function(_0x2f2927){_0x21e723({'res':'inserted'});});}});});}function insertCmHopper(_0x489b25,_0x1d848f,_0x2a70a3,_0x3222d7,_0x9571c7){var _0xdc618f=[_0xfc4c('0x24'),_0xfc4c('0x25'),'cm_contacts.id',_0xfc4c('0x26'),_0x1d848f+'.'+_0x3222d7,_0xfc4c('0x27'),_0xfc4c('0x28'),'cm_contacts.priority',_0xfc4c('0x29'),'\x22'+_0x9571c7+'\x22'];return squel[_0xfc4c('0x2a')]()['into']('cm_hopper')[_0xfc4c('0x2b')]([_0xfc4c('0x11'),_0xfc4c('0x2c'),'ContactId',_0xfc4c('0x2d'),_0x3222d7,_0xfc4c('0x2e'),_0xfc4c('0x2f'),_0xfc4c('0x30'),_0xfc4c('0x31'),_0xfc4c('0x32')],squel[_0xfc4c('0x10')]()[_0xfc4c('0x33')](_0xdc618f)[_0xfc4c('0x12')](_0x1d848f)[_0xfc4c('0x13')](_0xfc4c('0x34'),null,_0xfc4c('0x35')+_0x1d848f+_0xfc4c('0x36'))[_0xfc4c('0x13')](_0x2a70a3,null,_0x2a70a3+'.id\x20=\x20'+_0x1d848f+'.'+_0x3222d7)[_0xfc4c('0x15')](_0x1d848f+_0xfc4c('0x37'),_0x489b25)[_0xfc4c('0x15')](_0xfc4c('0x38'),NOW)['where'](_0xfc4c('0x39'),selectNotIn(_0x1d848f,_0x2a70a3,_0x3222d7,_0xfc4c('0x3a'),[_0xfc4c('0x3b'),_0xfc4c('0x3c')]))[_0xfc4c('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d848f,_0x2a70a3,_0x3222d7,_0xfc4c('0x3a'),[_0xfc4c('0x3b')])))[_0xfc4c('0x3d')]();}function insertCmHopperBlack(_0x54de1d,_0xc21a8,_0x5558df,_0x30fd58){var _0xb0759c=[_0xfc4c('0x24'),_0xfc4c('0x3e'),_0xfc4c('0x26'),_0xc21a8+'.'+_0x30fd58,_0xfc4c('0x27'),_0xfc4c('0x28')];return squel['insert']()[_0xfc4c('0x3f')](_0xfc4c('0x40'))[_0xfc4c('0x2b')]([_0xfc4c('0x11'),_0xfc4c('0x41'),_0xfc4c('0x2d'),_0x30fd58,_0xfc4c('0x2e'),_0xfc4c('0x2f')],squel[_0xfc4c('0x10')]()[_0xfc4c('0x33')](_0xb0759c)['from'](_0xc21a8)[_0xfc4c('0x13')](_0xfc4c('0x34'),null,_0xfc4c('0x35')+_0xc21a8+_0xfc4c('0x36'))[_0xfc4c('0x13')](_0x5558df,null,_0x5558df+_0xfc4c('0x14')+_0xc21a8+'.'+_0x30fd58)[_0xfc4c('0x15')](_0xc21a8+'.CmListId\x20=\x20?',_0x54de1d)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfc4c('0x15')](_0xfc4c('0x39'),squel['select']()[_0xfc4c('0x42')](_0xfc4c('0x11'))[_0xfc4c('0x12')](_0xfc4c('0x40'))['where'](_0xfc4c('0x43'),_0x54de1d)[_0xfc4c('0x15')](_0x30fd58+_0xfc4c('0x16')+_0xc21a8+'.'+_0x30fd58)))['toString']();}function insertTzCmHopper(_0xa8b7ff,_0x83b618,_0x52e047,_0x10a179,_0x2ac6a6,_0xa13948){var _0xc03606=[_0xfc4c('0x24'),_0xfc4c('0x44')+_0xa13948+_0xfc4c('0x45'),_0xfc4c('0x3e'),_0xfc4c('0x26'),_0x83b618+'.'+_0x10a179,_0xfc4c('0x27'),_0xfc4c('0x28'),_0xfc4c('0x46'),_0xfc4c('0x29'),'\x22'+_0x2ac6a6+'\x22'];var _0x343d7b=squel[_0xfc4c('0x2a')]()[_0xfc4c('0x3f')](_0xfc4c('0x3a'))[_0xfc4c('0x2b')](['phone',_0xfc4c('0x2c'),_0xfc4c('0x41'),_0xfc4c('0x2d'),_0x10a179,_0xfc4c('0x2e'),_0xfc4c('0x2f'),'priority','UserId',_0xfc4c('0x32')],squel[_0xfc4c('0x10')]()['fields'](_0xc03606)[_0xfc4c('0x12')](_0x83b618)['join'](_0xfc4c('0x34'),null,_0xfc4c('0x35')+_0x83b618+_0xfc4c('0x36'))[_0xfc4c('0x13')](_0x52e047,null,_0x52e047+_0xfc4c('0x14')+_0x83b618+'.'+_0x10a179)[_0xfc4c('0x13')](_0xa13948,null,_0xa13948+_0xfc4c('0x14')+_0x83b618+'.'+_0x10a179)[_0xfc4c('0x15')](_0x83b618+_0xfc4c('0x37'),_0xa8b7ff)[_0xfc4c('0x15')](_0xfc4c('0x38'),NOW)[_0xfc4c('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x83b618,_0x52e047,_0x10a179,'cm_hopper',[_0xfc4c('0x3b'),_0xfc4c('0x3c')]))[_0xfc4c('0x15')](_0xfc4c('0x39'),selectNotIn(_0x83b618,_0x52e047,_0x10a179,_0xfc4c('0x3a'),[_0xfc4c('0x3b')])))[_0xfc4c('0x3d')]();return _0x343d7b;}function insertTzCmHopperBlack(_0x31ce7a,_0x586cb9,_0x43306e,_0x149599){var _0x5c029b=[_0xfc4c('0x24'),_0xfc4c('0x3e'),_0xfc4c('0x26'),_0x586cb9+'.'+_0x149599,_0xfc4c('0x27'),'cm_contacts.updatedAt'];return squel[_0xfc4c('0x2a')]()[_0xfc4c('0x3f')]('cm_hopper_black')[_0xfc4c('0x2b')](['phone',_0xfc4c('0x41'),_0xfc4c('0x2d'),_0x149599,'createdAt','updatedAt'],squel['select']()[_0xfc4c('0x33')](_0x5c029b)[_0xfc4c('0x12')](_0x586cb9)[_0xfc4c('0x13')](_0xfc4c('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x586cb9+'.CmListId')[_0xfc4c('0x13')](_0x43306e,null,_0x43306e+_0xfc4c('0x14')+_0x586cb9+'.'+_0x149599)['where'](_0x586cb9+_0xfc4c('0x37'),_0x31ce7a)[_0xfc4c('0x15')](_0xfc4c('0x38'),NOW)[_0xfc4c('0x15')](_0xfc4c('0x39'),squel[_0xfc4c('0x10')]()[_0xfc4c('0x42')](_0xfc4c('0x11'))[_0xfc4c('0x12')](_0xfc4c('0x40'))['where'](_0xfc4c('0x43'),_0x31ce7a)['where'](_0x149599+_0xfc4c('0x16')+_0x586cb9+'.'+_0x149599)))[_0xfc4c('0x3d')]();}function insertCmHopperAdditionalPhones(_0x39adfe){var _0x576e26=[_0xfc4c('0x47'),_0xfc4c('0x48'),_0xfc4c('0x49'),'cm_contact_has_items.createdAt',_0xfc4c('0x4a')];return squel[_0xfc4c('0x2a')]()[_0xfc4c('0x3f')](_0xfc4c('0x4b'))[_0xfc4c('0x2b')](['CmHopperId',_0xfc4c('0x11'),_0xfc4c('0x4c'),'createdAt','updatedAt'],squel['select']()[_0xfc4c('0x33')](_0x576e26)[_0xfc4c('0x12')](_0xfc4c('0x3a'))['join'](_0xfc4c('0x34'),null,_0xfc4c('0x4d'))[_0xfc4c('0x13')](_0xfc4c('0x4e'),null,_0xfc4c('0x4f'))[_0xfc4c('0x15')](_0xfc4c('0x50'),_0x39adfe)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0xfc4c('0x3d')]();}function insertCmContact(_0x19ac28,_0xf07c62,_0x18788c,_0x14dd44){var _0x326ea9=_[_0xfc4c('0x51')](_['keys'](_0x14dd44),[_0xfc4c('0x2d'),_0xfc4c('0x52'),_0xfc4c('0x2e'),_0xfc4c('0x2f'),_0xfc4c('0x53')]);return squel[_0xfc4c('0x2a')]()['into'](_0xfc4c('0x34'))[_0xfc4c('0x2b')](_0x326ea9,squel['select']()[_0xfc4c('0x33')](_0x326ea9)[_0xfc4c('0x12')](_0xf07c62)[_0xfc4c('0x15')]('('+_0x18788c[_0xfc4c('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xfc4c('0x10')]()['fields'](_0x18788c)[_0xfc4c('0x12')](_0xfc4c('0x34'))['where']('ListId\x20=\x20?',_0x19ac28)[_0xfc4c('0x15')](_0xfc4c('0x54')))['where'](_0xfc4c('0x55'),squel['select']()[_0xfc4c('0x42')]('MIN(id)',_0xfc4c('0x56'))[_0xfc4c('0x12')](_0xf07c62)['group'](_0x18788c[_0xfc4c('0x13')](','))))[_0xfc4c('0x3d')]();}function handleStop(){logger[_0xfc4c('0x57')](_0xfc4c('0x58'));stopped=!![];}function handleUncaughtException(_0x244f55){logger[_0xfc4c('0x59')](_0x244f55[_0xfc4c('0x5a')]);process[_0xfc4c('0x5b')](0x1);}function handleError(_0x8b934a,_0x268cd1){stats[_0xfc4c('0x5c')][_0xfc4c('0x1b')]({'name':_0x268cd1[_0xfc4c('0x5d')],'message':_0x268cd1[_0xfc4c('0x5a')],'row':_0x8b934a});}function handleQuery(_0x593d64){logger[_0xfc4c('0x57')](_0x593d64);return db[_0xfc4c('0x5e')][_0xfc4c('0x5f')](_0x593d64)[_0xfc4c('0x60')](function(_0x4c5130){results[_0xfc4c('0x1b')](_0x4c5130);})[_0xfc4c('0x61')](function(_0x448a1a){logger[_0xfc4c('0x59')](_0x448a1a[_0xfc4c('0x5a')]);});}function updateTzCampaigns(_0x532c61){return new Promise(function(_0x50faa8,_0x4d5a06){var _0x21bff6=squel[_0xfc4c('0x10')]()[_0xfc4c('0x33')](['campaigns.id',_0xfc4c('0x62')])[_0xfc4c('0x12')]('campaigns')[_0xfc4c('0x13')](_0xfc4c('0x63'),null,_0xfc4c('0x64'))['where'](_0xfc4c('0x65')+_0x532c61);db[_0xfc4c('0x5e')][_0xfc4c('0x5f')](_0x21bff6[_0xfc4c('0x3d')]())['spread'](function(_0x4629b4){var _0x2baef3=[];for(var _0x2402f7=0x0;_0x2402f7<_0x4629b4['length'];_0x2402f7++){_0x2baef3[_0xfc4c('0x1b')](getTimezoneData(_0x4629b4[_0x2402f7],tmp_campaigns));}BPromise['all'](_0x2baef3)[_0xfc4c('0x23')](function(){_0x50faa8({'val':0x1});});})[_0xfc4c('0x61')](function(_0x1465d8){logger['error'](_0x1465d8[_0xfc4c('0x5a')]);_0x50faa8({'val':0x0});});});}function updateTzVoiceQueues(_0x26743a){return new Promise(function(_0xddf50b,_0x4096e4){var _0x34b77c=squel[_0xfc4c('0x10')]()['fields']([_0xfc4c('0x66'),_0xfc4c('0x67')])[_0xfc4c('0x12')](_0xfc4c('0x68'))[_0xfc4c('0x13')](_0xfc4c('0x69'),null,_0xfc4c('0x6a'))['where'](_0xfc4c('0x6b')+_0x26743a);db['sequelize'][_0xfc4c('0x5f')](_0x34b77c[_0xfc4c('0x3d')]())['spread'](function(_0xe40cdf){var _0x59e6eb=[];for(var _0x273737=0x0;_0x273737<_0xe40cdf[_0xfc4c('0x1a')];_0x273737++){_0x59e6eb[_0xfc4c('0x1b')](getTimezoneData(_0xe40cdf[_0x273737],tmp_voice_queues));}BPromise[_0xfc4c('0x1c')](_0x59e6eb)['then'](function(){_0xddf50b({'val':0x1});});})['catch'](function(_0x35ff55){logger[_0xfc4c('0x59')](_0x35ff55['message']);_0xddf50b({'val':0x0});});});}function getTimezoneData(_0x41da25,_0x2c0708){return new Promise(function(_0x401d52,_0x224f24){var _0x2569c8=shared[_0xfc4c('0x6c')];var _0x15ead8=_0x2569c8[_0x41da25[_0xfc4c('0x6d')]];if(_['isNil'](_0x15ead8)){_0x401d52({'ret':0x1});}else{var _0xfb6fdf=_0x15ead8[_0xfc4c('0x6e')];var _0x4369b3=squel[_0xfc4c('0x2a')]()['into'](_0x2c0708)['set']('id',_0x41da25['id'])[_0xfc4c('0x6f')](_0xfc4c('0x70'),_0xfb6fdf)[_0xfc4c('0x6f')](_0xfc4c('0x6d'),_0x41da25[_0xfc4c('0x6d')])['toString']();return db[_0xfc4c('0x5e')][_0xfc4c('0x5f')](_0x4369b3)[_0xfc4c('0x60')](function(_0x400375){_0x401d52({'ret':0x1});})[_0xfc4c('0x61')](function(_0x175ea4){logger[_0xfc4c('0x59')](_0x175ea4[_0xfc4c('0x5a')]);_0x224f24({'ret':0x1});});}});}function handleTZQuery(_0x141087){logger['info'](_0x141087);return db[_0xfc4c('0x5e')][_0xfc4c('0x5f')](_0x141087)[_0xfc4c('0x60')](function(_0x38cd0b){})[_0xfc4c('0x61')](function(_0x3a326e){logger[_0xfc4c('0x59')](_0x3a326e[_0xfc4c('0x5a')]);});}function main(_0x3105a6,_0x577e7a,_0x5b4a62,_0xafd10e){logger[_0xfc4c('0x57')](_0xfc4c('0x71'),_0x3105a6,JSON['stringify'](_0x577e7a));process[_0xfc4c('0x72')](_0xfc4c('0x73'));var _0x3b0354=_0x577e7a[_0xfc4c('0x74')];var _0x25142d=_[_0xfc4c('0x75')](_0x3b0354);var _0x3a8d5e=_0x577e7a['socket_timestamp'];var _0x180783=path['join'](config[_0xfc4c('0x76')],_0xfc4c('0x77'),_0x3a8d5e+_0xfc4c('0x78'));hasTZ=_[_0xfc4c('0x79')](_0x3b0354)[_0xfc4c('0x7a')]('dialTimezone');var _0x22d192=_[_0xfc4c('0x79')](_0x3b0354)[_0xfc4c('0x13')]();logger['info'](_0xfc4c('0x7b'),_0x22d192);db['ContactItemType'][_0xfc4c('0x18')]({'raw':!![],'attributes':['id',_0xfc4c('0x7c')]})[_0xfc4c('0x23')](function(_0x3417cb){for(var _0x5f2cd3=0x0;_0x5f2cd3<_0x3417cb[_0xfc4c('0x1a')];_0x5f2cd3++){if(_0x3417cb[_0x5f2cd3][_0xfc4c('0x7c')]in _0x3b0354){contactItemTypes[_0xfc4c('0x1b')](_0x3417cb[_0x5f2cd3]);delete _0x25142d[_0x3417cb[_0x5f2cd3][_0xfc4c('0x7c')]];hasAdditionalPhones=!![];}for(var _0x2e858e in _0x3b0354){if(_0x3417cb[_0x5f2cd3][_0xfc4c('0x7c')]+_0xfc4c('0x7d')===_0x2e858e){phoneDescriptions[_0xfc4c('0x1b')]({'itemTypeId':_0x3417cb[_0x5f2cd3]['id'],'description':_0x2e858e});delete _0x25142d[_0x2e858e];}}}if(hasAdditionalPhones)_0x25142d[_0xfc4c('0x19')]='';var _0x46a397=_[_0xfc4c('0x79')](_0x25142d)[_0xfc4c('0x13')]();logger[_0xfc4c('0x57')]('header',_0x46a397);fs[_0xfc4c('0x7e')](_0x180783,_0x46a397+'\x0a');Papa[_0xfc4c('0x7f')](fs[_0xfc4c('0x80')](_0x3105a6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x358a11,_0x1d2336){try{for(var _0x4b0723=0x0,_0x206d58=[];_0x4b0723<_0x358a11[_0xfc4c('0x81')]['length'];_0x4b0723++){stats[_0xfc4c('0x82')]+=0x1;if(_0x358a11['errors'][_0x4b0723]){handleError(_0x358a11[_0xfc4c('0x81')][_0x4b0723],_0x358a11['errors'][_0x4b0723]);}else{var _0xe63000=[];var _0x37df1e=[];var _0x3c59f2={};for(var _0xc4adfa in _0x3b0354){let _0x259a29=contactItemTypes[_0xfc4c('0x83')](_0x4832c9=>_0x4832c9[_0xfc4c('0x7c')]===_0xc4adfa);let _0x1280ba=contactItemTypes[_0xfc4c('0x83')](_0xba870a=>_0xba870a[_0xfc4c('0x7c')]+'_description'===_0xc4adfa);if(_[_0xfc4c('0x84')](_0x259a29)&&_[_0xfc4c('0x84')](_0x1280ba)){if(_0x3b0354[_0xfc4c('0x85')](_0xc4adfa)){if(_0x358a11['data'][_0x4b0723][_0x3b0354[_0xc4adfa]]){var _0x26fa92=_['trim'](_0x358a11[_0xfc4c('0x81')][_0x4b0723][_0x3b0354[_0xc4adfa]][_0xfc4c('0x86')](/"/g,'\x27'));switch(_0xc4adfa){case _0xfc4c('0x2c'):var _0x3f2ed7=moment(_0x26fa92,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3f2ed7[_0xfc4c('0x87')]()){_0x206d58['push']('\x22'+_0x26fa92+'\x22');}else{_0xe63000['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xfc4c('0x30'):var _0xfa4d01=parseInt(_0x26fa92);_0x26fa92=_[_0xfc4c('0x88')](_0xfa4d01)||_0xfa4d01<0x0||_0xfa4d01>0x4?_0xafd10e?0x3:0x2:_0xfa4d01;_0x206d58['push']('\x22'+_0x26fa92+'\x22');break;case'UserId':var _0x33b0c1=parseInt(_0x26fa92);if(_[_0xfc4c('0x89')](_0x33b0c1)&&_['includes'](_0x5b4a62,_0x33b0c1)){_0x206d58['push']('\x22'+_0x33b0c1+'\x22');}else{_0xe63000[_0xfc4c('0x1b')](_0xfc4c('0x8a'));}break;case _0xfc4c('0x8b'):if(isEmail(_0x26fa92)){_0x206d58['push']('\x22'+_0x26fa92+'\x22');}else{_0xe63000['push'](_0xfc4c('0x8c'));}break;case'dateOfBirth':var _0x1592fe=moment(_0x26fa92,_0xfc4c('0x8d'),!![]);if(_0x1592fe[_0xfc4c('0x87')]()){_0x206d58[_0xfc4c('0x1b')]('\x22'+_0x26fa92+'\x22');}else{_0xe63000[_0xfc4c('0x1b')](_0xfc4c('0x8e'));}break;case'dialTimezone':var _0x5f56a6=shared[_0xfc4c('0x6c')];var _0x16c2ba=_0x5f56a6[_0x26fa92];if(!_['isNil'](_0x16c2ba)){var _0x4e4134=_0x16c2ba[_0xfc4c('0x6e')];_0x206d58[_0xfc4c('0x1b')]('\x22'+_0x26fa92+'\x22');_0x206d58[_0xfc4c('0x1b')]('\x22'+_0x4e4134+'\x22');}break;default:_0x206d58[_0xfc4c('0x1b')]('\x22'+_0x26fa92+'\x22');}}else{switch(_0xc4adfa){case _0xfc4c('0x8f'):case _0xfc4c('0x11'):_0xe63000[_0xfc4c('0x1b')](_0xc4adfa+'\x20not\x20specified');break;default:_0x206d58[_0xfc4c('0x1b')]('\x22\x22');}}}}else{var _0x370f11='';if(!_[_0xfc4c('0x84')](_0x259a29)){if(!_0x3c59f2[_0xfc4c('0x85')](_0x259a29['id'])){if(!_['isNil'](_0x358a11[_0xfc4c('0x81')][_0x4b0723][_0x3b0354[_0xc4adfa]])){var _0x26fa92=_['trim'](_0x358a11[_0xfc4c('0x81')][_0x4b0723][_0x3b0354[_0xc4adfa]][_0xfc4c('0x86')](/"/g,'\x27'));var _0xb1f417=phoneDescriptions[_0xfc4c('0x83')](_0xcdc2b1=>_0xcdc2b1['itemTypeId']===_0x259a29['id']);if(!_[_0xfc4c('0x84')](_0xb1f417)){var _0x3de0c5=_[_0xfc4c('0x90')](_0x358a11[_0xfc4c('0x81')][_0x4b0723][_0x3b0354[_0xb1f417['description']]][_0xfc4c('0x86')](/"/g,'\x27'));if(!_[_0xfc4c('0x84')](_0x3de0c5))_0x26fa92=_0x26fa92+'§'+_0x3de0c5;}if(_0x370f11=='')_0x370f11=_0x26fa92;else _0x370f11+='|'+_0x26fa92;}_0x37df1e[_0xfc4c('0x1b')](_0x259a29['id']+':'+_0x370f11);_0x3c59f2[_0x259a29['id']]=0x1;}}}}if(hasAdditionalPhones){_0x206d58[_0xfc4c('0x1b')]('\x22'+_0x37df1e[_0xfc4c('0x13')](';')+'\x22');}if(_0xe63000['length']){handleError(_0x358a11[_0xfc4c('0x81')][_0x4b0723],{'code':_0xfc4c('0x91'),'message':_0xe63000['join']()});}else{fs[_0xfc4c('0x92')](_0x180783,_0x206d58['join']()+'\x0a');}_0x206d58=[];}if(!(stats['rows']%0xc8)){socket[_0xfc4c('0x93')](_0xfc4c('0x94')+_0x3a8d5e,stats);stats['errors']=[];}}if(stopped){logger[_0xfc4c('0x57')](_0xfc4c('0x95'));_0x1d2336['abort']();}}catch(_0x319916){handleError(_0x358a11[_0xfc4c('0x81')][_0x4b0723],{'code':_0xfc4c('0x96'),'message':_0x319916[_0xfc4c('0x5a')]});logger[_0xfc4c('0x59')](_0xfc4c('0x97'),_0x319916[_0xfc4c('0x5a')]);}},'complete':function(){try{var _0xf6ce78=[];var _0x1c3980=[];var _0x1b3b26='cm_contacts';if(_0x577e7a['duplicates']&&_0x577e7a[_0xfc4c('0x98')]['length']){_0x1b3b26=_0xfc4c('0x99')+_0x3a8d5e;_0xf6ce78[_0xfc4c('0x1b')](_0xfc4c('0x9a')+_0x1b3b26+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfc4c('0x9b')+_0x3a8d5e;tmp_voice_queues=_0xfc4c('0x9c')+_0x3a8d5e;_0x1c3980['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0xfc4c('0x9d'));_0x1c3980['push'](_0xfc4c('0x9a')+tmp_voice_queues+_0xfc4c('0x9d'));BPromise[_0xfc4c('0x9e')](_0x1c3980,handleTZQuery)[_0xfc4c('0x23')](function(_0x50129f){updateTzCampaigns(_0x577e7a[_0xfc4c('0x2d')])[_0xfc4c('0x23')](function(_0x553e0b){updateTzVoiceQueues(_0x577e7a['ListId'])[_0xfc4c('0x23')](function(_0x165b0c){if(hasTZ)_0x46a397=_0x46a397[_0xfc4c('0x86')]('dialTimezone',_0xfc4c('0x9f'));var _0x13d8de=util[_0xfc4c('0xe')](_0xfc4c('0xa0'),_0x180783,_0x1b3b26,_0x46a397,_0x577e7a[_0xfc4c('0x2d')],_0x577e7a[_0xfc4c('0x52')]||null,NOW,NOW);if(_[_0xfc4c('0x84')](_0x3b0354['scheduledat'])){_0x13d8de+=_0xfc4c('0xa1');}_0xf6ce78['push'](_0x13d8de);if(_0x577e7a[_0xfc4c('0x98')]&&_0x577e7a[_0xfc4c('0x98')][_0xfc4c('0x1a')]){_0xf6ce78[_0xfc4c('0x1b')](insertCmContact(_0x577e7a[_0xfc4c('0x2d')],_0x1b3b26,_0x577e7a['duplicates'],_0x3b0354));_0xf6ce78[_0xfc4c('0x1b')]('DROP\x20TABLE\x20'+_0x1b3b26+';');}BPromise[_0xfc4c('0x9e')](_0xf6ce78,handleQuery)[_0xfc4c('0x23')](function(_0x1c9875){BPromise[_0xfc4c('0x1c')]([handleAdditionalPhones()])['then'](function(){_0xf6ce78=[];for(var _0x1e28ec=0x0;_0x1e28ec\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','push','all','catch','error','message','AdditionalPhones','split','then','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','into'];(function(_0x526818,_0x30c916){var _0x44c7e3=function(_0x364d90){while(--_0x364d90){_0x526818['push'](_0x526818['shift']());}};_0x44c7e3(++_0x30c916);}(_0x4c8c,0x1b3));var _0xc4c8=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x4c8c[_0x152136];return _0x20df44;};'use strict';var fs=require('fs');var path=require(_0xc4c8('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xc4c8('0x1'));var BPromise=require(_0xc4c8('0x2'));var moment=require(_0xc4c8('0x3'));var squel=require('squel');var Redis=require(_0xc4c8('0x4'));var db=require(_0xc4c8('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xc4c8('0x6'))(_0xc4c8('0x7'));config['redis']=_[_0xc4c8('0x8')](config[_0xc4c8('0x9')],{'host':_0xc4c8('0xa'),'port':0x18eb});var socket=require(_0xc4c8('0xb'))(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()[_0xc4c8('0xc')](_0xc4c8('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0xc4c8('0xc')](_0xc4c8('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x490934){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))*$/[_0xc4c8('0xf')](_0x490934);}function selectNotIn(_0x36c0fb,_0x3b36c0,_0x32186d,_0x3672ee,_0x3b496d){return squel[_0xc4c8('0x10')]()[_0xc4c8('0x11')](_0xc4c8('0x12'))['from'](_0x3672ee)[_0xc4c8('0x13')](_0x3b36c0,null,_0x3b36c0+_0xc4c8('0x14')+_0x3672ee+'.'+_0x32186d)[_0xc4c8('0x15')](_0x3672ee+'.'+_0x32186d+_0xc4c8('0x16')+_0x36c0fb+'.'+_0x32186d)[_0xc4c8('0x15')](_0x3b36c0+_0xc4c8('0x17')+_0x3b496d[_0xc4c8('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x28f922,_0x21e464){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xc4c8('0x18')](_0xc4c8('0x19')+tempTableName)[_0xc4c8('0x1a')](function(_0x5b48dd){if(_0x5b48dd!==null){var _0x5cd439=[];for(var _0x44a59d=0x0;_0x44a59d<_0x5b48dd[_0xc4c8('0x1b')];_0x44a59d++){var _0x4ef1ad=_0x5b48dd[_0x44a59d];if(!_[_0xc4c8('0x1c')](_0x4ef1ad[_0xc4c8('0x12')])){if(!_[_0xc4c8('0x1c')](_0x4ef1ad['AdditionalPhones']))_0x5cd439[_0xc4c8('0x1d')](insertAdditionalPhones(_0x4ef1ad));promisesContact[_0xc4c8('0x1d')]({'contact':_0x4ef1ad});}}}Promise[_0xc4c8('0x1e')](_0x5cd439)['then'](function(){_0x28f922({'val':0x1});});})[_0xc4c8('0x1f')](function(_0x1cdf77){logger[_0xc4c8('0x20')](_0x1cdf77[_0xc4c8('0x21')]);});});}function insertAdditionalPhones(_0x511ff0){return new Promise(function(_0xda36da,_0x53ddfd){var _0x5374a7=_0x511ff0[_0xc4c8('0x22')];if(_[_0xc4c8('0x1c')](_0x5374a7))_0x53ddfd({'val':0x0});else{var _0x4961c7=_0x5374a7[_0xc4c8('0x23')](';');var _0x148215=[];orderBy=0x0;for(var _0x1f9b68=0x0;_0x1f9b68<_0x4961c7[_0xc4c8('0x1b')];_0x1f9b68++){_0x148215[_0xc4c8('0x1d')](splitAdditionalPhone(_0x511ff0['id'],_0x4961c7[_0x1f9b68]));}Promise[_0xc4c8('0x1e')](_0x148215)[_0xc4c8('0x24')](function(){_0xda36da({'val':_0x4961c7[_0xc4c8('0x1b')]});});}});}function splitAdditionalPhone(_0xedf812,_0x249f7c){return new Promise(function(_0x1c7998,_0x2a0939){var _0x1e2a01=_0x249f7c[_0xc4c8('0x23')](':');var _0x55982c=_0x1e2a01[0x0];var _0x314abd=_0x1e2a01[0x1];if(_0x314abd!==''){var _0x684f8=_0x314abd[_0xc4c8('0x23')]('|');var _0xe02a47=[];for(var _0x4ae459=0x0;_0x4ae459<_0x684f8[_0xc4c8('0x1b')];_0x4ae459++){if(_0x684f8[_0x4ae459]!==''){var _0x4d2bef=_[_0xc4c8('0x25')](promisesAdditionalPhones,{'contactId':_0xedf812,'phone':_0x684f8[_0x4ae459]});if(_0x4d2bef[_0xc4c8('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xc4c8('0x1d')]({'contactId':_0xedf812,'contactTypeId':_0x55982c,'phone':_0x684f8[_0x4ae459],'orderBy':orderBy});}}}_0x1c7998({'ok':0x1});}else _0x1c7998({'res':0x0});});}function createAdditionalPhone(_0x4eced0,_0xd5106a,_0x3e7b5b,_0x13f00f){var _0x6f916c='';var _0x58d14b='';var _0x126939=_0x3e7b5b[_0xc4c8('0x23')]('§');_0x6f916c=_0x126939[0x0];if(_0x126939[_0xc4c8('0x1b')]==0x2)_0x58d14b=_0x126939[0x1];return new Promise(function(_0x48e08c,_0xa9b2c2){return db[_0xc4c8('0x26')][_0xc4c8('0x27')]({'where':{'CmContactId':_0x4eced0,'item':_0x6f916c}})[_0xc4c8('0x24')](function(_0x55195a){if(_0x55195a){return db[_0xc4c8('0x26')][_0xc4c8('0x28')]({'ItemTypeId':_0xd5106a,'description':_0x58d14b,'OrderBy':_0x13f00f},{'where':{'CmContactId':_0x4eced0,'item':_0x6f916c}})['then'](function(_0xeb3d6c){_0x48e08c({'res':_0xc4c8('0x29')});});}else{return db[_0xc4c8('0x26')][_0xc4c8('0x2a')]({'CmContactId':_0x4eced0,'item':_0x6f916c,'ItemTypeId':_0xd5106a,'description':_0x58d14b,'OrderBy':_0x13f00f,'ItemClass':_0xc4c8('0x2b')})[_0xc4c8('0x24')](function(_0x370c5c){_0x48e08c({'res':_0xc4c8('0x2c')});});}});});}function updateContact(_0x2553ed){return new Promise(function(_0x43c253,_0x2e2f19){var _0x5338ef=_0x2553ed['id'];delete _0x2553ed['id'];return db[_0xc4c8('0x2d')][_0xc4c8('0x28')](_0x2553ed,{'where':{'id':_0x5338ef}})[_0xc4c8('0x24')](function(_0x396a29){updatedRows+=0x1;return db[_0xc4c8('0x2e')]['update']({'phone':_0x2553ed[_0xc4c8('0x12')]},{'where':{'ContactId':_0x5338ef}})[_0xc4c8('0x24')](function(_0x524a95){_0x43c253({'ret':'OK'});});});});}function insertCmHopper(_0x547c97,_0x4e118b,_0x789d2,_0x40ed33,_0xe0c85f){var _0x36b357=[_0xc4c8('0x2f'),_0xc4c8('0x30'),_0xc4c8('0x31'),_0xc4c8('0x32'),_0x4e118b+'.'+_0x40ed33,_0xc4c8('0x33'),'cm_contacts.updatedAt','cm_contacts.priority',_0xc4c8('0x34'),'\x22'+_0xe0c85f+'\x22'];return squel['insert']()[_0xc4c8('0x35')]('cm_hopper')[_0xc4c8('0x36')]([_0xc4c8('0x12'),_0xc4c8('0x37'),'ContactId','ListId',_0x40ed33,_0xc4c8('0x38'),_0xc4c8('0x39'),_0xc4c8('0x3a'),_0xc4c8('0x3b'),_0xc4c8('0x3c')],squel[_0xc4c8('0x10')]()['fields'](_0x36b357)[_0xc4c8('0x3d')](_0x4e118b)[_0xc4c8('0x13')](_0xc4c8('0x3e'),null,_0xc4c8('0x3f')+_0x4e118b+_0xc4c8('0x40'))[_0xc4c8('0x13')](_0x789d2,null,_0x789d2+_0xc4c8('0x14')+_0x4e118b+'.'+_0x40ed33)[_0xc4c8('0x15')](_0x4e118b+'.CmListId\x20=\x20?',_0x547c97)[_0xc4c8('0x15')](_0xc4c8('0x41'),NOW)[_0xc4c8('0x15')](_0xc4c8('0x42'),selectNotIn(_0x4e118b,_0x789d2,_0x40ed33,'cm_hopper',[_0xc4c8('0x43'),_0xc4c8('0x44')]))[_0xc4c8('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4e118b,_0x789d2,_0x40ed33,_0xc4c8('0x45'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x392f9c,_0x3310c4,_0xe41e6f,_0x9aebe){var _0x47180a=[_0xc4c8('0x2f'),_0xc4c8('0x31'),_0xc4c8('0x32'),_0x3310c4+'.'+_0x9aebe,_0xc4c8('0x33'),_0xc4c8('0x46')];return squel['insert']()[_0xc4c8('0x35')](_0xc4c8('0x47'))['fromQuery']([_0xc4c8('0x12'),_0xc4c8('0x48'),_0xc4c8('0x49'),_0x9aebe,'createdAt','updatedAt'],squel[_0xc4c8('0x10')]()[_0xc4c8('0x4a')](_0x47180a)[_0xc4c8('0x3d')](_0x3310c4)[_0xc4c8('0x13')](_0xc4c8('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x3310c4+_0xc4c8('0x40'))[_0xc4c8('0x13')](_0xe41e6f,null,_0xe41e6f+_0xc4c8('0x14')+_0x3310c4+'.'+_0x9aebe)['where'](_0x3310c4+'.CmListId\x20=\x20?',_0x392f9c)[_0xc4c8('0x15')](_0xc4c8('0x41'),NOW)[_0xc4c8('0x15')](_0xc4c8('0x42'),squel[_0xc4c8('0x10')]()[_0xc4c8('0x11')]('phone')[_0xc4c8('0x3d')](_0xc4c8('0x47'))[_0xc4c8('0x15')]('ListId\x20=\x20?',_0x392f9c)[_0xc4c8('0x15')](_0x9aebe+_0xc4c8('0x4b'),_0x3310c4+'.'+_0x9aebe)))[_0xc4c8('0x4c')]();}function insertCmHopperAdditionalPhones(_0x538dec){var _0x650344=[_0xc4c8('0x4d'),_0xc4c8('0x4e'),_0xc4c8('0x4f'),'cm_contact_has_items.createdAt',_0xc4c8('0x50')];return squel[_0xc4c8('0x51')]()[_0xc4c8('0x35')](_0xc4c8('0x52'))[_0xc4c8('0x36')]([_0xc4c8('0x53'),_0xc4c8('0x12'),_0xc4c8('0x54'),_0xc4c8('0x38'),_0xc4c8('0x39')],squel[_0xc4c8('0x10')]()[_0xc4c8('0x4a')](_0x650344)[_0xc4c8('0x3d')](_0xc4c8('0x45'))[_0xc4c8('0x13')](_0xc4c8('0x3e'),null,_0xc4c8('0x55'))[_0xc4c8('0x13')](_0xc4c8('0x56'),null,_0xc4c8('0x57'))['where'](_0xc4c8('0x58'),_0x538dec)[_0xc4c8('0x15')](_0xc4c8('0x41'),NOW))[_0xc4c8('0x4c')]();}function insertCmContact(_0x33b638,_0x234f9e,_0x3f8e49,_0x1d7dc3){var _0x1f695a=_['concat'](_[_0xc4c8('0x59')](_0x1d7dc3),[_0xc4c8('0x49'),'CompanyId',_0xc4c8('0x38'),_0xc4c8('0x39')]);return squel[_0xc4c8('0x51')]()[_0xc4c8('0x35')](_0xc4c8('0x3e'))[_0xc4c8('0x36')](_0x1f695a,squel[_0xc4c8('0x10')]()[_0xc4c8('0x4a')](_0x1f695a)[_0xc4c8('0x3d')](_0x234f9e)['where']('('+_0x3f8e49[_0xc4c8('0x13')](',')+_0xc4c8('0x5a'),squel[_0xc4c8('0x10')]()[_0xc4c8('0x4a')](_0x3f8e49)['from'](_0xc4c8('0x3e'))[_0xc4c8('0x15')]('ListId\x20=\x20?',_0x33b638))[_0xc4c8('0x15')]('id\x20IN\x20?',squel[_0xc4c8('0x10')]()[_0xc4c8('0x11')](_0xc4c8('0x5b'),'min_id')[_0xc4c8('0x3d')](_0x234f9e)[_0xc4c8('0x5c')](_0x3f8e49[_0xc4c8('0x13')](','))))[_0xc4c8('0x4c')]();}function handleStop(){logger[_0xc4c8('0x5d')](_0xc4c8('0x5e'));stopped=!![];}function handleUncaughtException(_0x5b401c){logger[_0xc4c8('0x20')](_0x5b401c['message']);process[_0xc4c8('0x5f')](0x1);}function handleError(_0x57b37d,_0x2aa5c0){stats[_0xc4c8('0x60')]['push']({'name':_0x2aa5c0[_0xc4c8('0x61')],'message':_0x2aa5c0[_0xc4c8('0x21')],'row':_0x57b37d});}function handleQuery(_0x3c76cf){logger['info'](_0x3c76cf);return db[_0xc4c8('0x62')][_0xc4c8('0x18')](_0x3c76cf)[_0xc4c8('0x1a')](function(_0x378635){results[_0xc4c8('0x1d')](_0x378635);})[_0xc4c8('0x1f')](function(_0x4c2ca4){logger['error'](_0x4c2ca4['message']);});}function main(_0x2b9c07,_0x11b52e,_0x4fd9bd,_0x52554e){logger[_0xc4c8('0x5d')](_0xc4c8('0x63'),_0x2b9c07,JSON[_0xc4c8('0x64')](_0x11b52e));process[_0xc4c8('0x65')](_0xc4c8('0x66'));var _0x2c6af1=_0x11b52e[_0xc4c8('0x67')];var _0x18af80=_[_0xc4c8('0x68')](_0x2c6af1);var _0x29ef70=_0x11b52e[_0xc4c8('0x69')];var _0x414a21=path[_0xc4c8('0x13')](config[_0xc4c8('0x6a')],_0xc4c8('0x6b'),_0x29ef70+_0xc4c8('0x6c'));logger[_0xc4c8('0x5d')](_0xc4c8('0x6d'),_0x11b52e);db[_0xc4c8('0x6e')][_0xc4c8('0x6f')]({'raw':!![],'attributes':['id',_0xc4c8('0x70')]})[_0xc4c8('0x24')](function(_0xac2575){for(var _0x58c224=0x0;_0x58c224<_0xac2575[_0xc4c8('0x1b')];_0x58c224++){if(_0xac2575[_0x58c224][_0xc4c8('0x70')]in _0x2c6af1){contactItemTypes[_0xc4c8('0x1d')](_0xac2575[_0x58c224]);delete _0x18af80[_0xac2575[_0x58c224][_0xc4c8('0x70')]];hasAdditionalPhones=!![];}for(var _0x5c2459 in _0x2c6af1){if(_0xac2575[_0x58c224][_0xc4c8('0x70')]+'_description'===_0x5c2459){phoneDescriptions[_0xc4c8('0x1d')]({'itemTypeId':_0xac2575[_0x58c224]['id'],'description':_0x5c2459});delete _0x18af80[_0x5c2459];}}}if(hasAdditionalPhones)_0x18af80['AdditionalPhones']='';var _0x52c15b=_[_0xc4c8('0x59')](_0x18af80)[_0xc4c8('0x13')]();logger['info'](_0xc4c8('0x71'),_0x52c15b);fs['writeFileSync'](_0x414a21,_0x52c15b+'\x0a');Papa['parse'](fs[_0xc4c8('0x72')](_0x2b9c07),{'header':!![],'skipEmptyLines':!![],'step':function(_0x184487,_0x26836b){try{for(var _0x311593=0x0,_0xa6490=[];_0x311593<_0x184487[_0xc4c8('0x73')][_0xc4c8('0x1b')];_0x311593++){stats[_0xc4c8('0x74')]+=0x1;if(_0x184487[_0xc4c8('0x60')][_0x311593]){handleError(_0x184487[_0xc4c8('0x73')][_0x311593],_0x184487['errors'][_0x311593]);}else{var _0x5aa94e=[];var _0x2a58c1=[];var _0x180c3c={};for(var _0x41f81f in _0x2c6af1){let _0x4061f3=contactItemTypes['find'](_0x13d4ad=>_0x13d4ad['name']===_0x41f81f);let _0xb97e8e=contactItemTypes[_0xc4c8('0x75')](_0x1c9512=>_0x1c9512[_0xc4c8('0x70')]+_0xc4c8('0x76')===_0x41f81f);if(_[_0xc4c8('0x1c')](_0x4061f3)&&_[_0xc4c8('0x1c')](_0xb97e8e)){if(_0x2c6af1[_0xc4c8('0x77')](_0x41f81f)){if(_0x184487['data'][_0x311593][_0x2c6af1[_0x41f81f]]){var _0x11a58b=_[_0xc4c8('0x78')](_0x184487[_0xc4c8('0x73')][_0x311593][_0x2c6af1[_0x41f81f]][_0xc4c8('0x79')](/"/g,'\x27'));switch(_0x41f81f){case'scheduledat':var _0x25b977=moment(_0x11a58b,_0xc4c8('0xd'),!![]);if(_0x25b977[_0xc4c8('0x7a')]()){_0xa6490[_0xc4c8('0x1d')]('\x22'+_0x11a58b+'\x22');}else{_0x5aa94e[_0xc4c8('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4bc64b=parseInt(_0x11a58b);_0x11a58b=_[_0xc4c8('0x7b')](_0x4bc64b)||_0x4bc64b<0x0||_0x4bc64b>0x4?_0x52554e?0x3:0x2:_0x4bc64b;_0xa6490[_0xc4c8('0x1d')]('\x22'+_0x11a58b+'\x22');break;case _0xc4c8('0x3b'):var _0x1add7f=parseInt(_0x11a58b);if(_[_0xc4c8('0x7c')](_0x1add7f)&&_[_0xc4c8('0x7d')](_0x4fd9bd,_0x1add7f)){_0xa6490['push']('\x22'+_0x1add7f+'\x22');}else{_0x5aa94e['push'](_0xc4c8('0x7e'));}break;case'email':if(isEmail(_0x11a58b)){_0xa6490[_0xc4c8('0x1d')]('\x22'+_0x11a58b+'\x22');}else{_0x5aa94e['push'](_0xc4c8('0x7f'));}break;case'dateOfBirth':var _0x262017=moment(_0x11a58b,_0xc4c8('0x80'),!![]);if(_0x262017[_0xc4c8('0x7a')]()){_0xa6490[_0xc4c8('0x1d')]('\x22'+_0x11a58b+'\x22');}else{_0x5aa94e[_0xc4c8('0x1d')](_0xc4c8('0x81'));}break;default:_0xa6490[_0xc4c8('0x1d')]('\x22'+_0x11a58b+'\x22');}}else{switch(_0x41f81f){case _0xc4c8('0x82'):case _0xc4c8('0x12'):_0x5aa94e[_0xc4c8('0x1d')](_0x41f81f+'\x20not\x20specified');break;default:_0xa6490['push']('\x22\x22');}}}}else{var _0xd2f198='';if(!_[_0xc4c8('0x1c')](_0x4061f3)){if(!_0x180c3c['hasOwnProperty'](_0x4061f3['id'])){for(var _0xc342bc=0x0;_0xc342bc<_0x2c6af1[_0x41f81f][_0xc4c8('0x1b')];_0xc342bc++){var _0x11a58b=_[_0xc4c8('0x78')](_0x184487['data'][_0x311593][_0x2c6af1[_0x41f81f][_0xc342bc]][_0xc4c8('0x79')](/"/g,'\x27'));var _0x1d64ab=phoneDescriptions[_0xc4c8('0x75')](_0x4ce247=>_0x4ce247[_0xc4c8('0x83')]===_0x4061f3['id']);if(!_[_0xc4c8('0x1c')](_0x1d64ab)){var _0x4e57ac=_[_0xc4c8('0x78')](_0x184487['data'][_0x311593][_0x2c6af1[_0x1d64ab[_0xc4c8('0x84')]][0x0]][_0xc4c8('0x79')](/"/g,'\x27'));if(!_[_0xc4c8('0x1c')](_0x4e57ac))_0x11a58b=_0x11a58b+'§'+_0x4e57ac;}if(_0xd2f198=='')_0xd2f198=_0x11a58b;else _0xd2f198+='|'+_0x11a58b;}_0x2a58c1['push'](_0x4061f3['id']+':'+_0xd2f198);_0x180c3c[_0x4061f3['id']]=0x1;}}}}if(hasAdditionalPhones){_0xa6490['push']('\x22'+_0x2a58c1['join'](';')+'\x22');}if(_0x5aa94e[_0xc4c8('0x1b')]){handleError(_0x184487[_0xc4c8('0x73')][_0x311593],{'code':_0xc4c8('0x85'),'message':_0x5aa94e['join']()});}else{fs[_0xc4c8('0x86')](_0x414a21,_0xa6490[_0xc4c8('0x13')]()+'\x0a');}_0xa6490=[];}if(!(stats[_0xc4c8('0x74')]%0xc8)){socket[_0xc4c8('0x87')](_0xc4c8('0x88')+_0x29ef70,stats);stats[_0xc4c8('0x60')]=[];}}if(stopped){logger['info'](_0xc4c8('0x89'));_0x26836b[_0xc4c8('0x8a')]();}}catch(_0x7bf6f8){handleError(_0x184487['data'][_0x311593],{'code':_0xc4c8('0x8b'),'message':_0x7bf6f8['message']});logger[_0xc4c8('0x20')](_0xc4c8('0x8c'),_0x7bf6f8[_0xc4c8('0x21')]);}},'complete':function(){try{var _0x38a847=[];var _0x1d0ac1=tempTableName;_0x38a847[_0xc4c8('0x1d')]('CREATE\x20TABLE\x20'+_0x1d0ac1+_0xc4c8('0x8d'));logger[_0xc4c8('0x5d')](_0xc4c8('0x8e'),contactItemTypes[_0xc4c8('0x1b')]);var _0x446acc=util[_0xc4c8('0xc')](_0xc4c8('0x8f'),_0x414a21,_0x1d0ac1,_0x52c15b,_0x11b52e[_0xc4c8('0x49')],_0x11b52e[_0xc4c8('0x90')]||null,NOW,NOW);if(_[_0xc4c8('0x1c')](_0x2c6af1[_0xc4c8('0x37')])){_0x446acc+=',\x20scheduledAt\x20=\x20NOW()';}_0x38a847[_0xc4c8('0x1d')](_0x446acc);BPromise[_0xc4c8('0x91')](_0x38a847,handleQuery)[_0xc4c8('0x24')](function(_0x38dedb){BPromise[_0xc4c8('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x38a847=[];for(var _0x5ec23c=0x0;_0x5ec23c\x20\x20','root','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','import','redis','socket.io-emitter','cm_contacts_temp_','YYYYMMDDHHmmss','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','catch','error','split','all','then','findOne','CmContactHasItem','update','create','PHONE','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','updatedAt','priority','select','fields','cm_contacts','.CmListId\x20=\x20?','\x22always\x22','toString','cm_hopper_black','ListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\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_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','message','exit','errors','sequelize','query','stringify','send','binding','clone','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','createReadStream'];(function(_0x172920,_0x588d39){var _0x53667f=function(_0x4a7342){while(--_0x4a7342){_0x172920['push'](_0x172920['shift']());}};_0x53667f(++_0x588d39);}(_0xcb49,0x156));var _0x9cb4=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xcb49[_0x3da707];return _0x342ee7;};'use strict';var fs=require('fs');var path=require(_0x9cb4('0x0'));var _=require('lodash');var Papa=require(_0x9cb4('0x1'));var util=require(_0x9cb4('0x2'));var BPromise=require(_0x9cb4('0x3'));var moment=require(_0x9cb4('0x4'));var squel=require(_0x9cb4('0x5'));var Redis=require(_0x9cb4('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x9cb4('0x7'));config['redis']=_['defaults'](config[_0x9cb4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cb4('0x9'))(new Redis(config[_0x9cb4('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x9cb4('0xa')+moment()['format'](_0x9cb4('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3a0d67){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'](_0x3a0d67);}function selectNotIn(_0x4b5440,_0x9d00fb,_0x246869,_0x3a9174,_0x240e5e){return squel['select']()[_0x9cb4('0xc')]('phone')[_0x9cb4('0xd')](_0x3a9174)[_0x9cb4('0xe')](_0x9d00fb,null,_0x9d00fb+_0x9cb4('0xf')+_0x3a9174+'.'+_0x246869)[_0x9cb4('0x10')](_0x3a9174+'.'+_0x246869+_0x9cb4('0x11')+_0x4b5440+'.'+_0x246869)['where'](_0x9d00fb+_0x9cb4('0x12')+_0x240e5e[_0x9cb4('0xe')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x47f68b,_0xdf0cf){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x9cb4('0x13')+tempTableName)[_0x9cb4('0x14')](function(_0x33c673){if(_0x33c673!==null){var _0x3a18d0=[];for(var _0x5db0b5=0x0;_0x5db0b5<_0x33c673[_0x9cb4('0x15')];_0x5db0b5++){var _0x2c2d14=_0x33c673[_0x5db0b5];if(!_[_0x9cb4('0x16')](_0x2c2d14[_0x9cb4('0x17')])){if(!_['isNil'](_0x2c2d14[_0x9cb4('0x18')]))_0x3a18d0[_0x9cb4('0x19')](insertAdditionalPhones(_0x2c2d14));promisesContact[_0x9cb4('0x19')]({'contact':_0x2c2d14});}}}Promise['all'](_0x3a18d0)['then'](function(){_0x47f68b({'val':0x1});});})[_0x9cb4('0x1a')](function(_0x59251f){logger[_0x9cb4('0x1b')](_0x59251f['message']);});});}function insertAdditionalPhones(_0x16d639){return new Promise(function(_0x5b90d4,_0x37ee39){var _0x14ca3b=_0x16d639[_0x9cb4('0x18')];if(_[_0x9cb4('0x16')](_0x14ca3b))_0x37ee39({'val':0x0});else{var _0x27122e=_0x14ca3b[_0x9cb4('0x1c')](';');var _0x5eafaf=[];orderBy=0x0;for(var _0x25f263=0x0;_0x25f263<_0x27122e[_0x9cb4('0x15')];_0x25f263++){_0x5eafaf[_0x9cb4('0x19')](splitAdditionalPhone(_0x16d639['id'],_0x27122e[_0x25f263]));}Promise[_0x9cb4('0x1d')](_0x5eafaf)[_0x9cb4('0x1e')](function(){_0x5b90d4({'val':_0x27122e[_0x9cb4('0x15')]});});}});}function splitAdditionalPhone(_0x3f9437,_0x1c3735){return new Promise(function(_0x23a30d,_0x1a6c1e){var _0x5c2e9f=_0x1c3735[_0x9cb4('0x1c')](':');var _0xc53600=_0x5c2e9f[0x0];var _0x579b03=_0x5c2e9f[0x1];if(_0x579b03!==''){var _0x212ba3=_0x579b03[_0x9cb4('0x1c')]('|');var _0x372f2f=[];for(var _0x5c3f51=0x0;_0x5c3f51<_0x212ba3[_0x9cb4('0x15')];_0x5c3f51++){if(_0x212ba3[_0x5c3f51]!==''){var _0x2b7894=_['filter'](promisesAdditionalPhones,{'contactId':_0x3f9437,'phone':_0x212ba3[_0x5c3f51]});if(_0x2b7894[_0x9cb4('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0x9cb4('0x19')]({'contactId':_0x3f9437,'contactTypeId':_0xc53600,'phone':_0x212ba3[_0x5c3f51],'orderBy':orderBy});}}}_0x23a30d({'ok':0x1});}else _0x23a30d({'res':0x0});});}function createAdditionalPhone(_0x33526b,_0x27e7a0,_0x286714,_0x35c799){var _0x1802b5='';var _0x2dab89='';var _0x518c9e=_0x286714['split']('§');_0x1802b5=_0x518c9e[0x0];if(_0x518c9e[_0x9cb4('0x15')]==0x2)_0x2dab89=_0x518c9e[0x1];return new Promise(function(_0x8cac01,_0x8959e2){return db['CmContactHasItem'][_0x9cb4('0x1f')]({'where':{'CmContactId':_0x33526b,'item':_0x1802b5}})[_0x9cb4('0x1e')](function(_0x3d47aa){if(_0x3d47aa){return db[_0x9cb4('0x20')][_0x9cb4('0x21')]({'ItemTypeId':_0x27e7a0,'description':_0x2dab89,'OrderBy':_0x35c799},{'where':{'CmContactId':_0x33526b,'item':_0x1802b5}})['then'](function(_0x5d89ab){_0x8cac01({'res':'updated'});});}else{return db[_0x9cb4('0x20')][_0x9cb4('0x22')]({'CmContactId':_0x33526b,'item':_0x1802b5,'ItemTypeId':_0x27e7a0,'description':_0x2dab89,'OrderBy':_0x35c799,'ItemClass':_0x9cb4('0x23')})['then'](function(_0xce8234){_0x8cac01({'res':'inserted'});});}});});}function updateContact(_0x573612){return new Promise(function(_0x3e6ca6,_0x4f001a){var _0x463aa8=_0x573612['id'];delete _0x573612['id'];return db[_0x9cb4('0x24')][_0x9cb4('0x21')](_0x573612,{'where':{'id':_0x463aa8}})[_0x9cb4('0x1e')](function(_0x33d0b8){updatedRows+=0x1;return db[_0x9cb4('0x25')][_0x9cb4('0x21')]({'phone':_0x573612[_0x9cb4('0x17')]},{'where':{'ContactId':_0x463aa8}})[_0x9cb4('0x1e')](function(_0x23d336){_0x3e6ca6({'ret':'OK'});});});});}function insertCmHopper(_0x255818,_0x3caa2d,_0xd95489,_0x2e2bc4,_0x247cf5){var _0x49d559=['cm_contacts.phone',_0x9cb4('0x26'),_0x9cb4('0x27'),'cm_contacts.ListId',_0x3caa2d+'.'+_0x2e2bc4,_0x9cb4('0x28'),_0x9cb4('0x29'),_0x9cb4('0x2a'),_0x9cb4('0x2b'),'\x22'+_0x247cf5+'\x22'];return squel[_0x9cb4('0x2c')]()[_0x9cb4('0x2d')](_0x9cb4('0x2e'))[_0x9cb4('0x2f')]([_0x9cb4('0x17'),_0x9cb4('0x30'),_0x9cb4('0x31'),'ListId',_0x2e2bc4,'createdAt',_0x9cb4('0x32'),_0x9cb4('0x33'),'UserId','recallme'],squel[_0x9cb4('0x34')]()[_0x9cb4('0x35')](_0x49d559)[_0x9cb4('0xd')](_0x3caa2d)['join'](_0x9cb4('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3caa2d+'.CmListId')[_0x9cb4('0xe')](_0xd95489,null,_0xd95489+_0x9cb4('0xf')+_0x3caa2d+'.'+_0x2e2bc4)[_0x9cb4('0x10')](_0x3caa2d+_0x9cb4('0x37'),_0x255818)[_0x9cb4('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9cb4('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3caa2d,_0xd95489,_0x2e2bc4,'cm_hopper',[_0x9cb4('0x38'),'\x22onlyIfOpen\x22']))[_0x9cb4('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3caa2d,_0xd95489,_0x2e2bc4,_0x9cb4('0x2e'),[_0x9cb4('0x38')])))[_0x9cb4('0x39')]();}function insertCmHopperBlack(_0x7adebd,_0x3d6d1a,_0x3b5c5f,_0x259e2d){var _0x502f89=['cm_contacts.phone',_0x9cb4('0x27'),'cm_contacts.ListId',_0x3d6d1a+'.'+_0x259e2d,_0x9cb4('0x28'),_0x9cb4('0x29')];return squel[_0x9cb4('0x2c')]()[_0x9cb4('0x2d')](_0x9cb4('0x3a'))['fromQuery']([_0x9cb4('0x17'),_0x9cb4('0x31'),_0x9cb4('0x3b'),_0x259e2d,'createdAt',_0x9cb4('0x32')],squel[_0x9cb4('0x34')]()[_0x9cb4('0x35')](_0x502f89)[_0x9cb4('0xd')](_0x3d6d1a)[_0x9cb4('0xe')](_0x9cb4('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3d6d1a+'.CmListId')['join'](_0x3b5c5f,null,_0x3b5c5f+_0x9cb4('0xf')+_0x3d6d1a+'.'+_0x259e2d)['where'](_0x3d6d1a+_0x9cb4('0x37'),_0x7adebd)[_0x9cb4('0x10')](_0x9cb4('0x3c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9cb4('0x34')]()['field']('phone')['from'](_0x9cb4('0x3a'))[_0x9cb4('0x10')](_0x9cb4('0x3d'),_0x7adebd)[_0x9cb4('0x10')](_0x259e2d+_0x9cb4('0x3e'),_0x3d6d1a+'.'+_0x259e2d)))[_0x9cb4('0x39')]();}function insertCmHopperAdditionalPhones(_0x225500){var _0x3c1be9=[_0x9cb4('0x3f'),_0x9cb4('0x40'),'cm_contact_has_items.OrderBy',_0x9cb4('0x41'),_0x9cb4('0x42')];return squel[_0x9cb4('0x2c')]()['into'](_0x9cb4('0x43'))[_0x9cb4('0x2f')]([_0x9cb4('0x44'),_0x9cb4('0x17'),_0x9cb4('0x45'),'createdAt',_0x9cb4('0x32')],squel['select']()[_0x9cb4('0x35')](_0x3c1be9)[_0x9cb4('0xd')](_0x9cb4('0x2e'))[_0x9cb4('0xe')](_0x9cb4('0x36'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x9cb4('0xe')](_0x9cb4('0x46'),null,_0x9cb4('0x47'))[_0x9cb4('0x10')](_0x9cb4('0x48'),_0x225500)[_0x9cb4('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x416deb,_0x1af150,_0x5f1e5a,_0x3bbb1d){var _0x213d82=_[_0x9cb4('0x49')](_[_0x9cb4('0x4a')](_0x3bbb1d),[_0x9cb4('0x3b'),_0x9cb4('0x4b'),'createdAt',_0x9cb4('0x32')]);return squel['insert']()[_0x9cb4('0x2d')]('cm_contacts')[_0x9cb4('0x2f')](_0x213d82,squel[_0x9cb4('0x34')]()[_0x9cb4('0x35')](_0x213d82)['from'](_0x1af150)['where']('('+_0x5f1e5a[_0x9cb4('0xe')](',')+')\x20NOT\x20IN\x20?',squel[_0x9cb4('0x34')]()[_0x9cb4('0x35')](_0x5f1e5a)[_0x9cb4('0xd')](_0x9cb4('0x36'))[_0x9cb4('0x10')]('ListId\x20=\x20?',_0x416deb))['where'](_0x9cb4('0x4c'),squel[_0x9cb4('0x34')]()[_0x9cb4('0xc')](_0x9cb4('0x4d'),_0x9cb4('0x4e'))['from'](_0x1af150)['group'](_0x5f1e5a['join'](','))))[_0x9cb4('0x39')]();}function handleStop(){logger[_0x9cb4('0x4f')](_0x9cb4('0x50'));stopped=!![];}function handleUncaughtException(_0x50decb){logger['error'](_0x50decb[_0x9cb4('0x51')]);process[_0x9cb4('0x52')](0x1);}function handleError(_0x1a4abc,_0x56dbee){stats[_0x9cb4('0x53')][_0x9cb4('0x19')]({'name':_0x56dbee['code'],'message':_0x56dbee[_0x9cb4('0x51')],'row':_0x1a4abc});}function handleQuery(_0x13a948){logger[_0x9cb4('0x4f')](_0x13a948);return db[_0x9cb4('0x54')][_0x9cb4('0x55')](_0x13a948)[_0x9cb4('0x14')](function(_0x258b48){results[_0x9cb4('0x19')](_0x258b48);})[_0x9cb4('0x1a')](function(_0x5e467f){logger[_0x9cb4('0x1b')](_0x5e467f[_0x9cb4('0x51')]);});}function main(_0x4efbaa,_0x4f7106,_0x177bab,_0x3a9e7f){logger[_0x9cb4('0x4f')]('main',_0x4efbaa,JSON[_0x9cb4('0x56')](_0x4f7106));process[_0x9cb4('0x57')]('start');var _0x3a562c=_0x4f7106[_0x9cb4('0x58')];var _0x1b258c=_[_0x9cb4('0x59')](_0x3a562c);var _0x3b35d0=_0x4f7106['socket_timestamp'];var _0x4fb50b=path[_0x9cb4('0xe')](config['root'],_0x9cb4('0x5a'),_0x3b35d0+_0x9cb4('0x5b'));logger[_0x9cb4('0x4f')](_0x9cb4('0x5c'),_0x4f7106);db['ContactItemType'][_0x9cb4('0x5d')]({'raw':!![],'attributes':['id',_0x9cb4('0x5e')]})[_0x9cb4('0x1e')](function(_0x49ee5b){for(var _0x365c7d=0x0;_0x365c7d<_0x49ee5b[_0x9cb4('0x15')];_0x365c7d++){if(_0x49ee5b[_0x365c7d][_0x9cb4('0x5e')]in _0x3a562c){contactItemTypes[_0x9cb4('0x19')](_0x49ee5b[_0x365c7d]);delete _0x1b258c[_0x49ee5b[_0x365c7d][_0x9cb4('0x5e')]];hasAdditionalPhones=!![];}for(var _0xf753d7 in _0x3a562c){if(_0x49ee5b[_0x365c7d]['name']+_0x9cb4('0x5f')===_0xf753d7){phoneDescriptions[_0x9cb4('0x19')]({'itemTypeId':_0x49ee5b[_0x365c7d]['id'],'description':_0xf753d7});delete _0x1b258c[_0xf753d7];}}}if(hasAdditionalPhones)_0x1b258c[_0x9cb4('0x18')]='';var _0x42e6fd=_['keys'](_0x1b258c)[_0x9cb4('0xe')]();logger['info'](_0x9cb4('0x60'),_0x42e6fd);fs[_0x9cb4('0x61')](_0x4fb50b,_0x42e6fd+'\x0a');Papa['parse'](fs[_0x9cb4('0x62')](_0x4efbaa),{'header':!![],'skipEmptyLines':!![],'step':function(_0x50d853,_0x253d28){try{for(var _0x2941df=0x0,_0x5dfbd1=[];_0x2941df<_0x50d853[_0x9cb4('0x63')]['length'];_0x2941df++){stats['rows']+=0x1;if(_0x50d853[_0x9cb4('0x53')][_0x2941df]){handleError(_0x50d853[_0x9cb4('0x63')][_0x2941df],_0x50d853['errors'][_0x2941df]);}else{var _0x47d96d=[];var _0x2c0426=[];var _0xb96cf0={};for(var _0x433b50 in _0x3a562c){let _0x55f840=contactItemTypes[_0x9cb4('0x64')](_0x16f488=>_0x16f488[_0x9cb4('0x5e')]===_0x433b50);let _0x2233f7=contactItemTypes[_0x9cb4('0x64')](_0x42c108=>_0x42c108[_0x9cb4('0x5e')]+_0x9cb4('0x5f')===_0x433b50);if(_[_0x9cb4('0x16')](_0x55f840)&&_[_0x9cb4('0x16')](_0x2233f7)){if(_0x3a562c[_0x9cb4('0x65')](_0x433b50)){if(_0x50d853[_0x9cb4('0x63')][_0x2941df][_0x3a562c[_0x433b50]]){var _0x3e3fe9=_[_0x9cb4('0x66')](_0x50d853['data'][_0x2941df][_0x3a562c[_0x433b50]]['replace'](/"/g,'\x27'));switch(_0x433b50){case _0x9cb4('0x30'):var _0x3e146f=moment(_0x3e3fe9,_0x9cb4('0x67'),!![]);if(_0x3e146f[_0x9cb4('0x68')]()){_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x3e3fe9+'\x22');}else{_0x47d96d[_0x9cb4('0x19')](_0x9cb4('0x69'));}break;case _0x9cb4('0x33'):var _0x8e778d=parseInt(_0x3e3fe9);_0x3e3fe9=_['isNaN'](_0x8e778d)||_0x8e778d<0x0||_0x8e778d>0x4?_0x3a9e7f?0x3:0x2:_0x8e778d;_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x3e3fe9+'\x22');break;case _0x9cb4('0x6a'):var _0x169a5c=parseInt(_0x3e3fe9);if(_['isNumber'](_0x169a5c)&&_[_0x9cb4('0x6b')](_0x177bab,_0x169a5c)){_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x169a5c+'\x22');}else{_0x47d96d[_0x9cb4('0x19')](_0x9cb4('0x6c'));}break;case _0x9cb4('0x6d'):if(isEmail(_0x3e3fe9)){_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x3e3fe9+'\x22');}else{_0x47d96d[_0x9cb4('0x19')](_0x9cb4('0x6e'));}break;case'dateOfBirth':var _0x32f851=moment(_0x3e3fe9,'YYYY-MM-DD',!![]);if(_0x32f851['isValid']()){_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x3e3fe9+'\x22');}else{_0x47d96d[_0x9cb4('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x3e3fe9+'\x22');}}else{switch(_0x433b50){case _0x9cb4('0x6f'):case _0x9cb4('0x17'):_0x47d96d[_0x9cb4('0x19')](_0x433b50+'\x20not\x20specified');break;default:_0x5dfbd1[_0x9cb4('0x19')]('\x22\x22');}}}}else{var _0x2132f9='';if(!_[_0x9cb4('0x16')](_0x55f840)){if(!_0xb96cf0[_0x9cb4('0x65')](_0x55f840['id'])){for(var _0x128ef0=0x0;_0x128ef0<_0x3a562c[_0x433b50][_0x9cb4('0x15')];_0x128ef0++){var _0x3e3fe9=_['trim'](_0x50d853[_0x9cb4('0x63')][_0x2941df][_0x3a562c[_0x433b50][_0x128ef0]][_0x9cb4('0x70')](/"/g,'\x27'));var _0x1a0063=phoneDescriptions[_0x9cb4('0x64')](_0x54fec9=>_0x54fec9[_0x9cb4('0x71')]===_0x55f840['id']);if(!_[_0x9cb4('0x16')](_0x1a0063)){var _0x56af1c=_[_0x9cb4('0x66')](_0x50d853[_0x9cb4('0x63')][_0x2941df][_0x3a562c[_0x1a0063[_0x9cb4('0x72')]][0x0]][_0x9cb4('0x70')](/"/g,'\x27'));if(!_[_0x9cb4('0x16')](_0x56af1c))_0x3e3fe9=_0x3e3fe9+'§'+_0x56af1c;}if(_0x2132f9=='')_0x2132f9=_0x3e3fe9;else _0x2132f9+='|'+_0x3e3fe9;}_0x2c0426[_0x9cb4('0x19')](_0x55f840['id']+':'+_0x2132f9);_0xb96cf0[_0x55f840['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5dfbd1[_0x9cb4('0x19')]('\x22'+_0x2c0426['join'](';')+'\x22');}if(_0x47d96d[_0x9cb4('0x15')]){handleError(_0x50d853[_0x9cb4('0x63')][_0x2941df],{'code':_0x9cb4('0x73'),'message':_0x47d96d[_0x9cb4('0xe')]()});}else{fs[_0x9cb4('0x74')](_0x4fb50b,_0x5dfbd1[_0x9cb4('0xe')]()+'\x0a');}_0x5dfbd1=[];}if(!(stats[_0x9cb4('0x75')]%0xc8)){socket[_0x9cb4('0x76')]('contact:import:'+_0x3b35d0,stats);stats[_0x9cb4('0x53')]=[];}}if(stopped){logger[_0x9cb4('0x4f')](_0x9cb4('0x77'));_0x253d28[_0x9cb4('0x78')]();}}catch(_0x3ec1e6){handleError(_0x50d853[_0x9cb4('0x63')][_0x2941df],{'code':_0x9cb4('0x79'),'message':_0x3ec1e6[_0x9cb4('0x51')]});logger[_0x9cb4('0x1b')]('step',_0x3ec1e6[_0x9cb4('0x51')]);}},'complete':function(){try{var _0xd18a08=[];var _0xba7171=tempTableName;_0xd18a08[_0x9cb4('0x19')](_0x9cb4('0x7a')+_0xba7171+_0x9cb4('0x7b'));logger[_0x9cb4('0x4f')](_0x9cb4('0x7c'),contactItemTypes['length']);var _0x222b82=util[_0x9cb4('0x7d')](_0x9cb4('0x7e'),_0x4fb50b,_0xba7171,_0x42e6fd,_0x4f7106[_0x9cb4('0x3b')],_0x4f7106[_0x9cb4('0x4b')]||null,NOW,NOW);if(_[_0x9cb4('0x16')](_0x3a562c[_0x9cb4('0x30')])){_0x222b82+=_0x9cb4('0x7f');}_0xd18a08[_0x9cb4('0x19')](_0x222b82);BPromise[_0x9cb4('0x80')](_0xd18a08,handleQuery)[_0x9cb4('0x1e')](function(_0x22f9a8){BPromise['all']([handleAdditionalPhones()])[_0x9cb4('0x1e')](function(){_0xd18a08=[];for(var _0x5c0a1b=0x0;_0x5c0a1b\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.disposition','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','sequelize','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','role','agent','select','field','name','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','getAccountFK','interactions','cm_contacts'];(function(_0x1a6fb4,_0x561bfe){var _0x217739=function(_0x5c159b){while(--_0x5c159b){_0x1a6fb4['push'](_0x1a6fb4['shift']());}};_0x217739(++_0x561bfe);}(_0x01d7,0x8b));var _0x701d=function(_0x40d603,_0x586fd1){_0x40d603=_0x40d603-0x0;var _0x18fb27=_0x01d7[_0x40d603];return _0x18fb27;};'use strict';var _=require(_0x701d('0x0'));var squel=require('squel');var as=require(_0x701d('0x1'));var qs=require(_0x701d('0x2'));var updateInteraction=require(_0x701d('0x3'))[_0x701d('0x4')];var utils=require(_0x701d('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4599f7,_0x2bfef6,_0x35a83f){var _0x44c281=![];var _0x33e9c6=utils['getAccountFK'](_0x4599f7);if(_0x2bfef6[_0x701d('0x6')]===_0x701d('0x7')&&!_0x35a83f['search']&&!_0x35a83f[_0x33e9c6]){_0x44c281=!![];}return _0x44c281;}function getTagsQuery(){return squel[_0x701d('0x8')]()[_0x701d('0x9')]('id')['field'](_0x701d('0xa'))[_0x701d('0x9')]('color')[_0x701d('0xb')](_0x701d('0xc'));}function getUsersQuery(_0x3f12ea,_0x178c7b){var _0x2bd07d=utils[_0x701d('0xd')](_0x3f12ea);var _0x2fcfac=_0x701d('0xe')+_0x3f12ea+_0x701d('0xf');var _0x58c1b6=squel[_0x701d('0x8')]()[_0x701d('0x9')](_0x701d('0x10'))['field'](_0x701d('0x11'))[_0x701d('0x9')](_0x701d('0x12')+_0x2bd07d)[_0x701d('0xb')](_0x2fcfac,'ui')[_0x701d('0x13')](_0x701d('0x14'),'u',_0x701d('0x15'));if(_0x178c7b[_0x701d('0x16')]>0x0){_0x58c1b6[_0x701d('0x17')](_0x701d('0x12')+_0x2bd07d+'\x20IN\x20?',_[_0x701d('0x18')](_0x178c7b,'id'));}return _0x58c1b6;}function getInteractionsQuery(_0x2fb577){var _0x2b7e4e=utils[_0x701d('0x19')](_0x2fb577);var _0x1cd963=utils[_0x701d('0x1a')](_0x2fb577);var _0x2bd6ea=utils[_0x701d('0xd')](_0x2fb577);return squel[_0x701d('0x8')]()[_0x701d('0xb')](_0x2b7e4e[_0x701d('0x1b')],'i')[_0x701d('0x13')](_0x701d('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x701d('0x13')](_0x701d('0x14'),'o',_0x701d('0x1d'))[_0x701d('0x13')](_0x2b7e4e['accounts'],'a',_0x701d('0x1e')+_0x1cd963)[_0x701d('0x13')](_0x2b7e4e['messages'],'me',_0x701d('0x1f')+_0x2bd6ea+_0x701d('0x20'))[_0x701d('0x13')](_0x2b7e4e[_0x701d('0x21')],'it','it.'+_0x2bd6ea+_0x701d('0x20'))['left_join'](_0x701d('0xc'),'t',_0x701d('0x22'));}function getSqlClauses(){var _0xa45517={'body':squel[_0x701d('0x23')](),'contact':squel[_0x701d('0x23')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x701d('0x23')](),'read':squel[_0x701d('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x701d('0x23')]()};return _0xa45517;}function parseTagParameter(_0x3d616){var _0x998277=squel[_0x701d('0x23')]();if(_0x3d616){var _0x58483f=utils[_0x701d('0x24')](_0x3d616);_0x58483f['forEach'](function(_0x50b582){_0x998277['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50b582+',%');});}return _0x998277;}function parseReadParameter(_0x83e259){var _0x20d9d1='';if(_0x83e259){_0x20d9d1=_0x701d('0x25');if(_0x83e259==='1'){_0x20d9d1=_0x20d9d1[_0x701d('0x26')](_0x701d('0x27'),'=');}else{_0x20d9d1=_0x20d9d1[_0x701d('0x26')]('{OPERATOR}','>');}}return _0x20d9d1;}function parseSearchFilter(_0x52fa72,_0x226078){var _0x579146=squel['expr']();if(_0x226078){var _0x4f42a1=_0x226078['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x701d('0x28')](_0x4f42a1)){_0x579146['or'](_0x701d('0x29'),_0x4f42a1+'%');if(['sms',_0x701d('0x2a')][_0x701d('0x2b')](_0x52fa72)){_0x579146['or'](_0x701d('0x2c'),_0x4f42a1+'%');}else if(_0x52fa72===_0x701d('0x2d')){_0x579146['or'](_0x701d('0x2e'),_0x4f42a1+'%');}else if(_0x52fa72===_0x701d('0x2f')){_0x579146['or'](_0x701d('0x30'),_0x4f42a1+'%');}}else if(_0x52fa72===_0x701d('0x31')&&qs[_0x701d('0x32')](_0x4f42a1)){_0x579146['or'](_0x701d('0x33'),_0x4f42a1+'%');}else{if(_0x52fa72===_0x701d('0x31')){_0x579146['or'](_0x701d('0x34'),qs[_0x701d('0x35')](_0x4f42a1,!![]))['or'](_0x701d('0x36'),qs['getFullTextValue'](_0x4f42a1));}else if(_0x52fa72!==_0x701d('0x2d')){_0x579146['or'](_0x701d('0x37'),qs[_0x701d('0x35')](_0x4f42a1));}_0x579146['or'](_0x701d('0x38'),qs[_0x701d('0x35')](_0x4f42a1,!![]),null);}}return _0x579146;}function parseAdvancedSearchFilter(_0x3ffc80,_0x2527fc){var _0x2a1364=getSqlClauses();var _0x17690e=as[_0x701d('0x39')](_0x3ffc80);var _0x365a67=_0x17690e[_0x701d('0x3a')];for(var _0xc4fbea=0x0;_0xc4fbea<_0x17690e[_0x701d('0x3b')][_0x701d('0x16')];_0xc4fbea++){var _0x52883b=_0x17690e[_0x701d('0x3b')][_0xc4fbea];var _0x46a351='i';var _0x2b0f13=_['find'](_0x2527fc,[_0x701d('0xa'),_0x52883b[_0x701d('0x9')]]);if(_0x2b0f13){var _0x33aa20=as[_0x701d('0x3c')](_0x46a351,_0x2b0f13[_0x701d('0x3d')],_0x52883b);_0x2a1364[_0x701d('0x3e')][_0x365a67](_0x33aa20[_0x701d('0x3f')],_0x33aa20[_0x701d('0x40')][_0x701d('0x41')],_0x33aa20[_0x701d('0x40')][_0x701d('0x42')]);}else{switch(_0x52883b['field']){case _0x701d('0x43'):var _0x46e0c4=parseReadParameter(_0x52883b[_0x701d('0x40')]);_0x2a1364[_0x701d('0x44')][_0x701d('0x45')](_0x46e0c4);break;case _0x701d('0x46'):if(_0x52883b[_0x701d('0x47')]===_0x701d('0x48')){if(_0x52883b[_0x701d('0x40')]['split']('\x20')['length']>0x1){_0x2a1364[_0x701d('0x49')][_0x365a67](_0x701d('0x38'),qs['getFullTextValue'](_0x52883b[_0x701d('0x40')],!![]),null);}else{var _0x30e83d='%'+_0x52883b['value']+'%';_0x2a1364[_0x701d('0x49')][_0x365a67]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x30e83d,_0x30e83d,_0x30e83d);}}else{_0x2b0f13=_[_0x701d('0x4a')](_0x2527fc,['name',_0x701d('0x4b')]);_0x52883b[_0x701d('0x9')]=_0x701d('0x4b');_0x33aa20=as[_0x701d('0x3c')](_0x46a351,_0x2b0f13['type'],_0x52883b);_0x2a1364[_0x701d('0x49')][_0x365a67](_0x33aa20[_0x701d('0x3f')],_0x33aa20[_0x701d('0x40')][_0x701d('0x41')],_0x33aa20['value'][_0x701d('0x42')]);}break;case _0x701d('0x4c'):var _0x3cbdde=_0x52883b[_0x701d('0x40')][_0x701d('0x4d')](',')[_0x701d('0x18')](function(_0x2fef73){return Number(_0x2fef73);});var _0xa83ff6=parseTagParameter(_0x3cbdde);_0x2a1364[_0x701d('0x4e')][_0x701d('0x4f')]['and'](_0xa83ff6);_0x2a1364['tags'][_0x701d('0x50')]=_0x3cbdde;break;case _0x701d('0x51'):if(_0x52883b[_0x701d('0x47')]===_0x701d('0x48')){_0x2a1364[_0x701d('0x52')][_0x365a67](_0x701d('0x53'),'%'+_0x52883b['value']+'%',null);}else{_0x2b0f13=_[_0x701d('0x4a')](_0x2527fc,[_0x701d('0xa'),'UserId']);_0x52883b['field']='UserId';_0x33aa20=as['buildExpression'](_0x46a351,_0x2b0f13[_0x701d('0x3d')],_0x52883b);_0x2a1364[_0x701d('0x52')][_0x365a67](_0x33aa20[_0x701d('0x3f')],_0x33aa20[_0x701d('0x40')][_0x701d('0x41')],_0x33aa20['value']['end']);}break;case _0x701d('0x54'):case _0x701d('0x55'):_0x33aa20=as['buildExpression']('me',null,_0x52883b);_0x2a1364[_0x701d('0x54')][_0x365a67](_0x33aa20[_0x701d('0x3f')],_0x33aa20['value'][_0x701d('0x41')],_0x33aa20['value'][_0x701d('0x42')]);break;}}}return _0x2a1364;}function parseModelFields(_0x40282f,_0x46477e,_0x11a6bf){var _0x101681=utils[_0x701d('0x1a')](_0x40282f);var _0x31121e=squel[_0x701d('0x23')]();var _0x2542f7=_(_0x46477e)[_0x701d('0x56')]()[_0x701d('0x18')](function(_0x5c14d2){return _[_0x701d('0x57')](_0x11a6bf,[_0x701d('0xa'),_0x5c14d2])?_0x5c14d2:undefined;})[_0x701d('0x58')]()[_0x701d('0x40')]();if(_0x2542f7[_0x701d('0x16')]>0x0){_0x2542f7[_0x701d('0x59')](function(_0x4fd225){if(_0x4fd225===_0x101681){_0x31121e[_0x701d('0x45')]('i.'+_0x101681+'\x20IN\x20?',[][_0x701d('0x5a')](_0x46477e[_0x4fd225]));}else if(_0x4fd225===_0x701d('0x5b')){var _0x5776fb=JSON[_0x701d('0x5c')](_0x46477e[_0x4fd225])['$gte'];var _0xd9a469=JSON[_0x701d('0x5c')](_0x46477e[_0x4fd225])['$lte'];_0x31121e[_0x701d('0x45')](_0x701d('0x5d'),_0x5776fb,_0xd9a469);}else{if(_0x46477e[_0x4fd225]===_0x701d('0x5e')){_0x31121e[_0x701d('0x45')]('i.'+_0x4fd225+_0x701d('0x5f'));}else{_0x31121e[_0x701d('0x45')]('i.'+_0x4fd225+_0x701d('0x60'),_0x46477e[_0x4fd225]);}}});}return _0x31121e;}function parseQueryParameters(_0xbcde40,_0x2a82bd,_0x20ab0d){var _0x166e90=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0xbcde40,_0x2a82bd,_0x20ab0d);})[_0x701d('0x61')](function(_0x46e624){_0x166e90['fields'][_0x701d('0x45')](_0x46e624);return parseReadParameter(_0x2a82bd[_0x701d('0x44')]);})[_0x701d('0x61')](function(_0x21e3be){_0x166e90['read'][_0x701d('0x45')](_0x21e3be);return parseTagParameter(_0x2a82bd[_0x701d('0x62')]);})[_0x701d('0x61')](function(_0x52f019){_0x166e90['tags'][_0x701d('0x4f')][_0x701d('0x45')](_0x52f019);return parseSearchFilter(_0xbcde40,_0x2a82bd[_0x701d('0x63')]);})['then'](function(_0x5f4d9f){_0x166e90[_0x701d('0x63')]=_0x5f4d9f;return _0x166e90;});}function checkAccountsRestrictions(_0x2ea3f1,_0x31227c,_0x1b6037){var _0x727461=utils[_0x701d('0x1a')](_0x2ea3f1);var _0x7f2805='get'+_['capitalize'](_0x2ea3f1)+(_0x2ea3f1===_0x701d('0x64')?_0x701d('0x65'):_0x701d('0x66'));var _0x384779=squel[_0x701d('0x23')]();return Promise[_0x701d('0x67')]()[_0x701d('0x61')](function(){if(_0x1b6037['search']&&_0x31227c['role']===_0x701d('0x7')){return _0x31227c[_0x7f2805]({'attributes':['id'],'raw':!![]});}})[_0x701d('0x61')](function(_0x1461b5){if(_0x1461b5){if(_0x1461b5[_0x701d('0x16')]===0x0){_0x384779[_0x701d('0x45')]('i.'+_0x727461+_0x701d('0x5f'));}else{_0x384779[_0x701d('0x45')]('i.'+_0x727461+_0x701d('0x68'),_[_0x701d('0x18')](_0x1461b5,'id'));}}else if(!_0x1b6037[_0x727461]){_0x384779[_0x701d('0x45')]('i.'+_0x727461+'\x20IS\x20NOT\x20NULL');}})[_0x701d('0x61')](function(){return _0x384779;});}function getClosedOrderClause(_0x1893b8,_0x4e511e){var _0x2d1f5c='';var _0x3f6d1c=[_0x701d('0x69'),_0x701d('0x6a'),'i.disposition'];if(_0x1893b8===_0x701d('0x31')){_0x3f6d1c[_0x701d('0x6b')](_0x701d('0x6c'));}if(_0x4e511e['closed']==='0'&&_0x1893b8===_0x701d('0x31')){_0x2d1f5c='i.substatus';}else{if(_0x4e511e[_0x701d('0x6d')]==='1'){_0x3f6d1c[_0x701d('0x6e')]();}_0x2d1f5c=_0x701d('0x6f')+_0x3f6d1c['join'](',\x20')+')';}return _0x2d1f5c;}function getFilteredInteractions(_0x19f2aa,_0x2bf136,_0x1f5b8f,_0x2b146a){var _0x4e3ffa=utils[_0x701d('0xd')](_0x19f2aa);var _0x2ad851=_['capitalize'](_0x19f2aa)+_0x701d('0x70');var _0x59ba30=[];var _0x405ff7=getTagsQuery();var _0x4bab0e={'type':db[_0x701d('0x71')][_0x701d('0x72')]['SELECT'],'raw':!![]};var _0x2fd53d=[];var _0x44975b=[];return db['sequelize']['query'](_0x405ff7[_0x701d('0x73')](),_0x4bab0e)[_0x701d('0x61')](function(_0x4845db){_0x59ba30=_[_0x701d('0x74')](_0x4845db,'id');_0x4bab0e=_[_0x701d('0x75')](_0x4bab0e,{'model':db[_0x2ad851],'mapToModel':!![],'nest':!![]});if(_0x1f5b8f['fields']){_0x2b146a[_0x701d('0x76')]['forEach'](function(_0x5de339){_0x2bf136[_0x701d('0x9')]('i.'+_0x5de339);});}else{_0x2bf136[_0x701d('0x9')](_0x701d('0x77'),_0x701d('0x43'));_0x2bf136['field'](_0x701d('0x78'),_0x701d('0x79'));_0x2bf136[_0x701d('0x9')]('a.mandatoryDisposition',_0x701d('0x7a'));if(_0x19f2aa===_0x701d('0x31')){_0x2bf136['field'](_0x701d('0x7b'),_0x701d('0x7c'));_0x2bf136[_0x701d('0x9')](_0x701d('0x7d'),_0x701d('0x7e'));_0x2bf136[_0x701d('0x9')]('i.id');_0x2bf136['field'](_0x701d('0x7f'));_0x2bf136['field'](_0x701d('0x80'));_0x2bf136[_0x701d('0x9')](_0x701d('0x81'));_0x2bf136[_0x701d('0x9')](_0x701d('0x82'));_0x2bf136['field'](_0x701d('0x83'));_0x2bf136['field']('i.lastMsgAt');_0x2bf136[_0x701d('0x9')]('i.lastMsgDirection');_0x2bf136[_0x701d('0x9')](_0x701d('0x84'));_0x2bf136[_0x701d('0x9')](_0x701d('0x85'));_0x2bf136[_0x701d('0x9')](_0x701d('0x6a'));_0x2bf136['field'](_0x701d('0x69'));_0x2bf136[_0x701d('0x9')](_0x701d('0x6c'));_0x2bf136[_0x701d('0x9')](_0x701d('0x86'));_0x2bf136[_0x701d('0x9')]('i.ContactId');_0x2bf136[_0x701d('0x9')](_0x701d('0x87'));_0x2bf136['field'](_0x701d('0x88'));}else if(_0x19f2aa===_0x701d('0x2f')){_0x2bf136['field'](_0x701d('0x89'),'contactName');}else{_0x2bf136[_0x701d('0x9')](_0x701d('0x8a'),_0x701d('0x7e'));}if(_0x19f2aa!==_0x701d('0x31')){_0x2bf136['field'](_0x701d('0x8b'));}_0x2bf136[_0x701d('0x9')](_0x701d('0x8c'),_0x701d('0x8d'));_0x2bf136[_0x701d('0x9')]('c.lastName',_0x701d('0x8e'));_0x2bf136[_0x701d('0x9')](_0x701d('0x8f'),'Contact.email');_0x2bf136[_0x701d('0x9')](_0x701d('0x90'),_0x701d('0x91'));_0x2bf136[_0x701d('0x9')]('c.mobile',_0x701d('0x92'));_0x2bf136[_0x701d('0x9')](_0x701d('0x93'),_0x701d('0x94'));_0x2bf136[_0x701d('0x9')](_0x701d('0x95'),_0x701d('0x96'));_0x2bf136[_0x701d('0x9')](_0x701d('0x97'),_0x701d('0x98'));_0x2bf136[_0x701d('0x9')](_0x701d('0x99'),_0x701d('0x9a'));}if(_0x2b146a[_0x701d('0x9b')]){_0x2bf136[_0x701d('0x9b')](_0x2b146a[_0x701d('0x9b')]);}if(_0x2b146a[_0x701d('0x9c')]){_0x2bf136[_0x701d('0x9c')](_0x2b146a[_0x701d('0x9c')]);}return db['sequelize'][_0x701d('0x9d')](_0x2bf136[_0x701d('0x73')](),_0x4bab0e);})[_0x701d('0x61')](function(_0x4d2a06){_0x2fd53d=_0x4d2a06;var _0x387dbe=getUsersQuery(_0x19f2aa,_0x2fd53d);return db[_0x701d('0x9e')]['query'](_0x387dbe[_0x701d('0x73')](),_0x4bab0e);})['then'](function(_0x86e698){_0x44975b=_[_0x701d('0x9f')](_0x86e698,_0x4e3ffa);if(_0x19f2aa===_0x701d('0x31')){return db[_0x701d('0xa0')][_0x701d('0xa1')]({'attributes':[_0x701d('0xa2')],'raw':!![]});}})[_0x701d('0x61')](function(_0x5ea959){var _0x258db7=_0x5ea959?_0x5ea959[_0x701d('0xa2')]:undefined;var _0x3d383d=_0x2fd53d[_0x701d('0x18')](function(_0x4aed43){return updateInteraction(_0x4aed43,_0x59ba30,_0x44975b,_0x258db7);});return Promise['all'](_0x3d383d);});}function countFilteredInteractions(_0x4ce717,_0x2e734e){var _0x4f6f6a=_0x4ce717[_0x701d('0xa3')]();_0x4f6f6a[_0x701d('0x9')](_0x701d('0xa4'));_0x4f6f6a[_0x701d('0x9')](_0x701d('0x77'),_0x701d('0x43'));var _0x326d97=utils['getSelectedTags'](_0x2e734e);if(!_['isEmpty'](_0x326d97)){_0x4f6f6a[_0x701d('0x17')](_0x701d('0xa5'),_0x326d97);}var _0x2771c6={'type':db[_0x701d('0x71')][_0x701d('0x72')][_0x701d('0xa6')],'raw':!![]};return db[_0x701d('0x9e')][_0x701d('0x9d')](_0x4f6f6a['toString'](),_0x2771c6);}module[_0x701d('0xa7')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xada0=['and','Contact','$substring','split','contact','ContactId','text','Tag','clause','tags','ids','User','operator','user','UserId','end','body','plainBody','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','query','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','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.closed','i.closedAt','i.lastMsgAt','i.subject','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','Sequelize','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','start','value','read'];(function(_0x57f6ad,_0x4795b6){var _0x425c09=function(_0xac3ba6){while(--_0xac3ba6){_0x57f6ad['push'](_0x57f6ad['shift']());}};_0x425c09(++_0x4795b6);}(_0xada0,0x1a0));var _0x0ada=function(_0x3b4963,_0x3b3515){_0x3b4963=_0x3b4963-0x0;var _0x5b14ca=_0xada0[_0x3b4963];return _0x5b14ca;};'use strict';var _=require('lodash');var squel=require(_0x0ada('0x0'));var as=require(_0x0ada('0x1'));var qs=require(_0x0ada('0x2'));var updateInteraction=require(_0x0ada('0x3'))[_0x0ada('0x4')];var utils=require(_0x0ada('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x264623,_0x42ea14,_0x281d69){var _0x33ffb6=![];var _0xf761a1=utils[_0x0ada('0x6')](_0x264623);if(_0x42ea14[_0x0ada('0x7')]===_0x0ada('0x8')&&!_0x281d69[_0x0ada('0x9')]&&!_0x281d69[_0xf761a1]){_0x33ffb6=!![];}return _0x33ffb6;}function getTagsQuery(){return squel[_0x0ada('0xa')]()[_0x0ada('0xb')]('id')['field']('name')['field'](_0x0ada('0xc'))[_0x0ada('0xd')](_0x0ada('0xe'));}function getUsersQuery(_0x4e42a9,_0x293e5c){var _0x2b3ef5=utils[_0x0ada('0xf')](_0x4e42a9);var _0xda6b7b='user_has_'+_0x4e42a9+_0x0ada('0x10');var _0x2fdbc4=squel[_0x0ada('0xa')]()[_0x0ada('0xb')](_0x0ada('0x11'))[_0x0ada('0xb')](_0x0ada('0x12'))['field'](_0x0ada('0x13')+_0x2b3ef5)['from'](_0xda6b7b,'ui')[_0x0ada('0x14')](_0x0ada('0x15'),'u',_0x0ada('0x16'));if(_0x293e5c[_0x0ada('0x17')]>0x0){_0x2fdbc4[_0x0ada('0x18')]('ui.'+_0x2b3ef5+_0x0ada('0x19'),_[_0x0ada('0x1a')](_0x293e5c,'id'));}return _0x2fdbc4;}function getInteractionsQuery(_0x44b94a){var _0x11dbd4=utils['getInteractionsTables'](_0x44b94a);var _0x56cf77=utils[_0x0ada('0x6')](_0x44b94a);var _0x20d6b8=utils['getInteractionFK'](_0x44b94a);return squel[_0x0ada('0xa')]()[_0x0ada('0xd')](_0x11dbd4[_0x0ada('0x1b')],'i')['left_join'](_0x0ada('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0ada('0x14')](_0x0ada('0x15'),'o',_0x0ada('0x1d'))[_0x0ada('0x14')](_0x11dbd4[_0x0ada('0x1e')],'a',_0x0ada('0x1f')+_0x56cf77)[_0x0ada('0x14')](_0x11dbd4['messages'],'me',_0x0ada('0x20')+_0x20d6b8+'\x20=\x20i.id')[_0x0ada('0x14')](_0x11dbd4['interactionsTags'],'it',_0x0ada('0x21')+_0x20d6b8+_0x0ada('0x22'))[_0x0ada('0x14')]('tools_tags','t',_0x0ada('0x23'));}function getSqlClauses(){var _0x386d49={'body':squel[_0x0ada('0x24')](),'contact':squel[_0x0ada('0x24')](),'default':squel['expr'](),'fields':squel[_0x0ada('0x24')](),'filter':squel[_0x0ada('0x24')](),'read':squel[_0x0ada('0x24')](),'tags':{'clause':squel[_0x0ada('0x24')](),'ids':null},'user':squel['expr']()};return _0x386d49;}function parseTagParameter(_0x47bac7){var _0x2b45ca=squel[_0x0ada('0x24')]();if(_0x47bac7){var _0x5cbc18=utils[_0x0ada('0x25')](_0x47bac7);_0x5cbc18[_0x0ada('0x26')](function(_0x1a69e6){_0x2b45ca['or'](_0x0ada('0x27'),'%,'+_0x1a69e6+',%');});}return _0x2b45ca;}function parseReadParameter(_0x2167cb){var _0x5ca616='';if(_0x2167cb){_0x5ca616=_0x0ada('0x28');if(_0x2167cb==='1'){_0x5ca616=_0x5ca616[_0x0ada('0x29')]('{OPERATOR}','=');}else{_0x5ca616=_0x5ca616[_0x0ada('0x29')](_0x0ada('0x2a'),'>');}}return _0x5ca616;}function parseSearchFilter(_0x5a8ba8,_0x5202fe){var _0x176cca=squel['expr']();if(_0x5202fe){var _0x4220d2=_0x5202fe['replace']('\x5c','\x5c\x5c')[_0x0ada('0x29')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4220d2)){_0x176cca['or'](_0x0ada('0x2b'),_0x4220d2+'%');if([_0x0ada('0x2c'),_0x0ada('0x2d')][_0x0ada('0x2e')](_0x5a8ba8)){_0x176cca['or']('i.phone\x20LIKE\x20?',_0x4220d2+'%');}else if(_0x5a8ba8===_0x0ada('0x2f')){_0x176cca['or'](_0x0ada('0x30'),_0x4220d2+'%');}else if(_0x5a8ba8===_0x0ada('0x31')){_0x176cca['or'](_0x0ada('0x32'),_0x4220d2+'%');}}else if(_0x5a8ba8==='mail'&&qs[_0x0ada('0x33')](_0x4220d2)){_0x176cca['or'](_0x0ada('0x34'),_0x4220d2+'%');}else{if(_0x5a8ba8===_0x0ada('0x35')){_0x176cca['or'](_0x0ada('0x36'),qs[_0x0ada('0x37')](_0x4220d2,!![]))['or'](_0x0ada('0x38'),qs[_0x0ada('0x37')](_0x4220d2));}else if(_0x5a8ba8!=='fax'){_0x176cca['or'](_0x0ada('0x39'),qs[_0x0ada('0x37')](_0x4220d2));}_0x176cca['or'](_0x0ada('0x3a'),qs[_0x0ada('0x37')](_0x4220d2,!![]),null);}}return _0x176cca;}function parseAdvancedSearchFilter(_0x48906c,_0x28dc85){var _0xa656f6=getSqlClauses();var _0xf771db=as[_0x0ada('0x3b')](_0x48906c);var _0xc5ab23=_0xf771db[_0x0ada('0x3c')];for(var _0x7042e5=0x0;_0x7042e5<_0xf771db[_0x0ada('0x3d')][_0x0ada('0x17')];_0x7042e5++){var _0x3cf110=_0xf771db['conditions'][_0x7042e5];var _0xe8790d='i';var _0x6e1eea=_[_0x0ada('0x3e')](_0x28dc85,[_0x0ada('0x3f'),_0x3cf110[_0x0ada('0xb')]]);if(_0x6e1eea){var _0x3486be=as[_0x0ada('0x40')](_0xe8790d,_0x6e1eea[_0x0ada('0x41')],_0x3cf110);_0xa656f6[_0x0ada('0x42')][_0xc5ab23](_0x3486be['text'],_0x3486be['value'][_0x0ada('0x43')],_0x3486be[_0x0ada('0x44')]['end']);}else{switch(_0x3cf110[_0x0ada('0xb')]){case'unreadMessages':var _0x41ca1d=parseReadParameter(_0x3cf110[_0x0ada('0x44')]);_0xa656f6[_0x0ada('0x45')][_0x0ada('0x46')](_0x41ca1d);break;case _0x0ada('0x47'):if(_0x3cf110['operator']===_0x0ada('0x48')){if(_0x3cf110[_0x0ada('0x44')][_0x0ada('0x49')]('\x20')['length']>0x1){_0xa656f6['contact'][_0xc5ab23](_0x0ada('0x3a'),qs[_0x0ada('0x37')](_0x3cf110[_0x0ada('0x44')],!![]),null);}else{var _0x4ef854='%'+_0x3cf110[_0x0ada('0x44')]+'%';_0xa656f6[_0x0ada('0x4a')][_0xc5ab23]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4ef854,_0x4ef854,_0x4ef854);}}else{_0x6e1eea=_[_0x0ada('0x3e')](_0x28dc85,['name',_0x0ada('0x4b')]);_0x3cf110[_0x0ada('0xb')]=_0x0ada('0x4b');_0x3486be=as['buildExpression'](_0xe8790d,_0x6e1eea[_0x0ada('0x41')],_0x3cf110);_0xa656f6[_0x0ada('0x4a')][_0xc5ab23](_0x3486be[_0x0ada('0x4c')],_0x3486be['value'][_0x0ada('0x43')],_0x3486be['value']['end']);}break;case _0x0ada('0x4d'):var _0x4249d6=_0x3cf110[_0x0ada('0x44')]['split'](',')[_0x0ada('0x1a')](function(_0x454563){return Number(_0x454563);});var _0x382548=parseTagParameter(_0x4249d6);_0xa656f6['tags'][_0x0ada('0x4e')][_0x0ada('0x46')](_0x382548);_0xa656f6[_0x0ada('0x4f')][_0x0ada('0x50')]=_0x4249d6;break;case _0x0ada('0x51'):if(_0x3cf110[_0x0ada('0x52')]===_0x0ada('0x48')){_0xa656f6[_0x0ada('0x53')][_0xc5ab23]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3cf110['value']+'%',null);}else{_0x6e1eea=_[_0x0ada('0x3e')](_0x28dc85,['name',_0x0ada('0x54')]);_0x3cf110[_0x0ada('0xb')]=_0x0ada('0x54');_0x3486be=as[_0x0ada('0x40')](_0xe8790d,_0x6e1eea[_0x0ada('0x41')],_0x3cf110);_0xa656f6[_0x0ada('0x53')][_0xc5ab23](_0x3486be['text'],_0x3486be['value'][_0x0ada('0x43')],_0x3486be[_0x0ada('0x44')][_0x0ada('0x55')]);}break;case _0x0ada('0x56'):case _0x0ada('0x57'):_0x3486be=as['buildExpression']('me',null,_0x3cf110);_0xa656f6[_0x0ada('0x56')][_0xc5ab23](_0x3486be[_0x0ada('0x4c')],_0x3486be[_0x0ada('0x44')][_0x0ada('0x43')],_0x3486be[_0x0ada('0x44')]['end']);break;}}}return _0xa656f6;}function parseModelFields(_0x45bcbe,_0xca77f4,_0xcb1643){var _0x1e8cfa=utils['getAccountFK'](_0x45bcbe);var _0x1056af=squel['expr']();var _0x26db25=_(_0xca77f4)['keys']()['map'](function(_0x6f4f86){return _['some'](_0xcb1643,[_0x0ada('0x3f'),_0x6f4f86])?_0x6f4f86:undefined;})[_0x0ada('0x58')]()[_0x0ada('0x44')]();if(_0x26db25[_0x0ada('0x17')]>0x0){_0x26db25['forEach'](function(_0x59e38b){if(_0x59e38b===_0x1e8cfa){_0x1056af[_0x0ada('0x46')]('i.'+_0x1e8cfa+_0x0ada('0x19'),[][_0x0ada('0x59')](_0xca77f4[_0x59e38b]));}else if(_0x59e38b===_0x0ada('0x5a')){var _0x4bed8f=JSON[_0x0ada('0x5b')](_0xca77f4[_0x59e38b])[_0x0ada('0x5c')];var _0x582edb=JSON['parse'](_0xca77f4[_0x59e38b])[_0x0ada('0x5d')];_0x1056af[_0x0ada('0x46')](_0x0ada('0x5e'),_0x4bed8f,_0x582edb);}else{if(_0xca77f4[_0x59e38b]===_0x0ada('0x5f')){_0x1056af['and']('i.'+_0x59e38b+'\x20IS\x20NULL');}else{_0x1056af[_0x0ada('0x46')]('i.'+_0x59e38b+_0x0ada('0x60'),_0xca77f4[_0x59e38b]);}}});}return _0x1056af;}function parseQueryParameters(_0x494ebd,_0x327b29,_0x382ea9){var _0x37b790=getSqlClauses();return Promise[_0x0ada('0x61')]()[_0x0ada('0x62')](function(){return parseModelFields(_0x494ebd,_0x327b29,_0x382ea9);})[_0x0ada('0x62')](function(_0x5a9375){_0x37b790[_0x0ada('0x63')][_0x0ada('0x46')](_0x5a9375);return parseReadParameter(_0x327b29['read']);})[_0x0ada('0x62')](function(_0x80a662){_0x37b790[_0x0ada('0x45')]['and'](_0x80a662);return parseTagParameter(_0x327b29['tag']);})[_0x0ada('0x62')](function(_0x8e9ec4){_0x37b790[_0x0ada('0x4f')][_0x0ada('0x4e')][_0x0ada('0x46')](_0x8e9ec4);return parseSearchFilter(_0x494ebd,_0x327b29[_0x0ada('0x64')]);})['then'](function(_0x1c6b79){_0x37b790['filter']=_0x1c6b79;return _0x37b790;});}function checkAccountsRestrictions(_0x46bbc8,_0x4b312a,_0x37df15){var _0x4ebbd8=utils[_0x0ada('0x6')](_0x46bbc8);var _0x2ad7b0=_0x0ada('0x65')+_[_0x0ada('0x66')](_0x46bbc8)+(_0x46bbc8===_0x0ada('0x67')?_0x0ada('0x68'):_0x0ada('0x69'));var _0x4f49fc=squel['expr']();return Promise[_0x0ada('0x61')]()[_0x0ada('0x62')](function(){if(_0x37df15[_0x0ada('0x9')]&&_0x4b312a[_0x0ada('0x7')]===_0x0ada('0x8')){return _0x4b312a[_0x2ad7b0]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x51a91f){if(_0x51a91f){if(_0x51a91f[_0x0ada('0x17')]===0x0){_0x4f49fc[_0x0ada('0x46')]('i.'+_0x4ebbd8+_0x0ada('0x6a'));}else{_0x4f49fc[_0x0ada('0x46')]('i.'+_0x4ebbd8+_0x0ada('0x19'),_[_0x0ada('0x1a')](_0x51a91f,'id'));}}else if(!_0x37df15[_0x4ebbd8]){_0x4f49fc[_0x0ada('0x46')]('i.'+_0x4ebbd8+_0x0ada('0x6b'));}})[_0x0ada('0x62')](function(){return _0x4f49fc;});}function getClosedOrderClause(_0x2f4984,_0x48c63a){var _0x4df144='';var _0x174841=[_0x0ada('0x6c'),'i.secondDisposition',_0x0ada('0x6d')];if(_0x2f4984===_0x0ada('0x35')){_0x174841['unshift'](_0x0ada('0x6e'));}if(_0x48c63a[_0x0ada('0x6f')]==='0'&&_0x2f4984===_0x0ada('0x35')){_0x4df144=_0x0ada('0x6e');}else{if(_0x48c63a[_0x0ada('0x6f')]==='1'){_0x174841[_0x0ada('0x70')]();}_0x4df144=_0x0ada('0x71')+_0x174841[_0x0ada('0x72')](',\x20')+')';}return _0x4df144;}function getFilteredInteractions(_0x4a5568,_0x97a781,_0x1f10e2,_0x2dc8d1){var _0x53cbf3=utils[_0x0ada('0xf')](_0x4a5568);var _0x10a106=_[_0x0ada('0x66')](_0x4a5568)+_0x0ada('0x73');var _0x284235=[];var _0x5edb08=getTagsQuery();var _0x42fa9b={'type':db['Sequelize'][_0x0ada('0x74')][_0x0ada('0x75')],'raw':!![]};var _0x1e6db1=[];var _0x323de5=[];return db[_0x0ada('0x76')][_0x0ada('0x77')](_0x5edb08['toString'](),_0x42fa9b)[_0x0ada('0x62')](function(_0xa6760f){_0x284235=_[_0x0ada('0x78')](_0xa6760f,'id');_0x42fa9b=_['merge'](_0x42fa9b,{'model':db[_0x10a106],'mapToModel':!![],'nest':!![]});if(_0x1f10e2[_0x0ada('0x63')]){_0x2dc8d1[_0x0ada('0x79')][_0x0ada('0x26')](function(_0x4dce36){_0x97a781['field']('i.'+_0x4dce36);});}else{_0x97a781['field'](_0x0ada('0x7a'),_0x0ada('0x7b'));_0x97a781[_0x0ada('0xb')](_0x0ada('0x7c'),_0x0ada('0x7d'));_0x97a781[_0x0ada('0xb')]('a.mandatoryDisposition',_0x0ada('0x7e'));if(_0x4a5568===_0x0ada('0x35')){_0x97a781[_0x0ada('0xb')](_0x0ada('0x7f'),_0x0ada('0x80'));_0x97a781['field'](_0x0ada('0x81'),'contactName');_0x97a781['field']('i.id');_0x97a781[_0x0ada('0xb')]('i.createdAt');_0x97a781[_0x0ada('0xb')]('i.updatedAt');_0x97a781['field'](_0x0ada('0x82'));_0x97a781[_0x0ada('0xb')](_0x0ada('0x83'));_0x97a781[_0x0ada('0xb')]('i.attach');_0x97a781[_0x0ada('0xb')](_0x0ada('0x84'));_0x97a781[_0x0ada('0xb')]('i.lastMsgDirection');_0x97a781[_0x0ada('0xb')](_0x0ada('0x85'));_0x97a781[_0x0ada('0xb')](_0x0ada('0x6d'));_0x97a781[_0x0ada('0xb')]('i.secondDisposition');_0x97a781[_0x0ada('0xb')]('i.thirdDisposition');_0x97a781['field']('i.substatus');_0x97a781['field']('i.to');_0x97a781[_0x0ada('0xb')](_0x0ada('0x86'));_0x97a781[_0x0ada('0xb')]('i.MailAccountId');_0x97a781['field'](_0x0ada('0x87'));}else if(_0x4a5568===_0x0ada('0x31')){_0x97a781['field'](_0x0ada('0x88'),'contactName');}else{_0x97a781[_0x0ada('0xb')](_0x0ada('0x89'),'contactName');}if(_0x4a5568!==_0x0ada('0x35')){_0x97a781[_0x0ada('0xb')](_0x0ada('0x8a'));}_0x97a781[_0x0ada('0xb')](_0x0ada('0x8b'),_0x0ada('0x8c'));_0x97a781[_0x0ada('0xb')]('c.lastName','Contact.lastName');_0x97a781[_0x0ada('0xb')](_0x0ada('0x8d'),'Contact.email');_0x97a781[_0x0ada('0xb')](_0x0ada('0x8e'),_0x0ada('0x8f'));_0x97a781['field'](_0x0ada('0x90'),_0x0ada('0x91'));_0x97a781[_0x0ada('0xb')]('c.fax',_0x0ada('0x92'));_0x97a781[_0x0ada('0xb')]('o.fullname',_0x0ada('0x93'));_0x97a781[_0x0ada('0xb')](_0x0ada('0x94'),_0x0ada('0x95'));_0x97a781[_0x0ada('0xb')](_0x0ada('0x96'),_0x0ada('0x97'));}if(_0x2dc8d1[_0x0ada('0x98')]){_0x97a781[_0x0ada('0x98')](_0x2dc8d1[_0x0ada('0x98')]);}if(_0x2dc8d1['offset']){_0x97a781[_0x0ada('0x99')](_0x2dc8d1[_0x0ada('0x99')]);}return db['sequelize'][_0x0ada('0x77')](_0x97a781[_0x0ada('0x9a')](),_0x42fa9b);})[_0x0ada('0x62')](function(_0x335327){_0x1e6db1=_0x335327;var _0x258047=getUsersQuery(_0x4a5568,_0x1e6db1);return db['sequelize'][_0x0ada('0x77')](_0x258047['toString'](),_0x42fa9b);})[_0x0ada('0x62')](function(_0x1b3e52){_0x323de5=_[_0x0ada('0x9b')](_0x1b3e52,_0x53cbf3);if(_0x4a5568===_0x0ada('0x35')){return db[_0x0ada('0x9c')]['findOne']({'attributes':[_0x0ada('0x9d')],'raw':!![]});}})[_0x0ada('0x62')](function(_0x44dac8){var _0x2cd08d=_0x44dac8?_0x44dac8[_0x0ada('0x9d')]:undefined;var _0x1175c2=_0x1e6db1['map'](function(_0x171f32){return updateInteraction(_0x171f32,_0x284235,_0x323de5,_0x2cd08d);});return Promise['all'](_0x1175c2);});}function countFilteredInteractions(_0x4dd262,_0x528a30){var _0x28e58f=_0x4dd262[_0x0ada('0x9e')]();_0x28e58f[_0x0ada('0xb')](_0x0ada('0x9f'));_0x28e58f[_0x0ada('0xb')](_0x0ada('0x7a'),'unreadMessages');var _0x2cff43=utils[_0x0ada('0x25')](_0x528a30);if(!_['isEmpty'](_0x2cff43)){_0x28e58f[_0x0ada('0x18')](_0x0ada('0xa0'),_0x2cff43);}var _0xef661={'type':db[_0x0ada('0xa1')][_0x0ada('0x74')]['SELECT'],'raw':!![]};return db[_0x0ada('0x76')]['query'](_0x28e58f[_0x0ada('0x9a')](),_0xef661);}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 8e1ca35..18fb819 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 _0x4085=['TagIds','Tags','lodash','../../mysqldb','map','fullname','split','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','out','plainBody','-id','then','trimStart','catch','Users'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4085,0x1c4));var _0x5408=function(_0x27da07,_0x5e244f){_0x27da07=_0x27da07-0x0;var _0x504cbd=_0x4085[_0x27da07];return _0x504cbd;};'use strict';var _=require(_0x5408('0x0'));var db=require(_0x5408('0x1'))['db'];function getInteractionUsers(_0xb08273,_0x18e325){return new Promise(function(_0x44b09b,_0x328826){try{var _0x4055a3=[];if(_0x18e325[_0xb08273]){_0x4055a3=_0x18e325[_0xb08273][_0x5408('0x2')](function(_0x46c377){return{'id':_0x46c377['id'],'fullname':_0x46c377[_0x5408('0x3')]};});}return _0x44b09b(_0x4055a3);}catch(_0x18e781){_0x328826(_0x18e781);}});}function getInteractionTags(_0x1a1059,_0x68a327){var _0x6aed1d=[];if(_0x1a1059){_0x1a1059[_0x5408('0x4')](',')['forEach'](function(_0x5e5374){_0x6aed1d[_0x5408('0x5')](_0x68a327[_0x5e5374]);});}return _0x6aed1d;}function updateWaitingCounter(_0x38fa89){if(_0x38fa89[_0x5408('0x6')]){_0x38fa89[_0x5408('0x6')]-=0x1;}}function updateInteractionCounters(_0x32418b){_0x32418b[_0x5408('0x6')]=0x0;_0x32418b['talking']=0x0;_0x32418b[_0x5408('0x7')]=0x0;_0x32418b[_0x5408('0x8')]=0x0;_0x32418b[_0x5408('0x9')]=0x0;_0x32418b[_0x5408('0xa')]=0x0;if(_0x32418b[_0x5408('0xb')]){if(_0x32418b[_0x5408('0xc')]===_0x5408('0x9')){_0x32418b[_0x5408('0x9')]+=0x1;updateWaitingCounter(_0x32418b);}if(_0x32418b[_0x5408('0xd')]){_0x32418b[_0x5408('0x7')]+=0x1;if(_0x32418b['talking']){_0x32418b[_0x5408('0xe')]-=0x1;}}else{if(_0x32418b[_0x5408('0xc')]){_0x32418b[_0x5408('0x8')]+=0x1;updateWaitingCounter(_0x32418b);}}}else{if(!_0x32418b[_0x5408('0xd')]){_0x32418b[_0x5408('0x6')]+=0x1;}if(_0x32418b[_0x5408('0xd')]){_0x32418b[_0x5408('0xe')]+=0x1;updateWaitingCounter(_0x32418b);}}_0x32418b[_0x5408('0xa')]+=0x1;return _0x32418b;}function getLastMessageText(_0x37c12c){return db[_0x5408('0xf')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x37c12c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5408('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5408('0x11')],'order':_0x5408('0x12'),'raw':!![]})[_0x5408('0x13')](function(_0xfcc47e){if(_0xfcc47e&&_0xfcc47e[_0x5408('0x11')]){_0x37c12c['lastMsgText']=_[_0x5408('0x14')](_0xfcc47e[_0x5408('0x11')]);}return _0x37c12c;})[_0x5408('0x15')](function(_0x5b370a){throw _0x5b370a;});}exports['updateInteraction']=function(_0x4ec3ed,_0x21864b,_0x46f022,_0x44041f){return new Promise(function(_0x569195,_0x30a852){return getInteractionUsers(_0x4ec3ed['id'],_0x46f022)[_0x5408('0x13')](function(_0x220662){_0x4ec3ed[_0x5408('0x16')]=_0x220662;return getInteractionTags(_0x4ec3ed[_0x5408('0x17')],_0x21864b);})['then'](function(_0x30d529){_0x4ec3ed[_0x5408('0x18')]=_0x30d529;delete _0x4ec3ed['TagIds'];return updateInteractionCounters(_0x4ec3ed);})[_0x5408('0x13')](function(_0x5987b3){if(_0x44041f){return getLastMessageText(_0x5987b3);}else{return _0x5987b3;}})[_0x5408('0x13')](function(_0x405c5f){_0x569195(_0x405c5f);})[_0x5408('0x15')](function(_0x31e7d5){_0x30a852(_0x31e7d5);});});}; \ No newline at end of file +var _0x1dcc=['waiting','talking','unmanaged','abandoned','total','closed','disposition','UserId','answered','MailMessage','out','plainBody','trimStart','updateInteraction','then','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push'];(function(_0x4ea63b,_0x2dd830){var _0x9fc41e=function(_0xc4f9f3){while(--_0xc4f9f3){_0x4ea63b['push'](_0x4ea63b['shift']());}};_0x9fc41e(++_0x2dd830);}(_0x1dcc,0x157));var _0xc1dc=function(_0x198d69,_0x2764){_0x198d69=_0x198d69-0x0;var _0x5b8bf0=_0x1dcc[_0x198d69];return _0x5b8bf0;};'use strict';var _=require(_0xc1dc('0x0'));var db=require(_0xc1dc('0x1'))['db'];function getInteractionUsers(_0x538423,_0x1197a0){return new Promise(function(_0x143a93,_0x3bca13){try{var _0x52eff3=[];if(_0x1197a0[_0x538423]){_0x52eff3=_0x1197a0[_0x538423][_0xc1dc('0x2')](function(_0x29eb67){return{'id':_0x29eb67['id'],'fullname':_0x29eb67[_0xc1dc('0x3')]};});}return _0x143a93(_0x52eff3);}catch(_0x5e5976){_0x3bca13(_0x5e5976);}});}function getInteractionTags(_0x4d84d9,_0x5763ca){var _0x440416=[];if(_0x4d84d9){_0x4d84d9[_0xc1dc('0x4')](',')[_0xc1dc('0x5')](function(_0x4f75fe){_0x440416[_0xc1dc('0x6')](_0x5763ca[_0x4f75fe]);});}return _0x440416;}function updateWaitingCounter(_0x11fb76){if(_0x11fb76[_0xc1dc('0x7')]){_0x11fb76['waiting']-=0x1;}}function updateInteractionCounters(_0x390965){_0x390965['waiting']=0x0;_0x390965[_0xc1dc('0x8')]=0x0;_0x390965['answered']=0x0;_0x390965[_0xc1dc('0x9')]=0x0;_0x390965[_0xc1dc('0xa')]=0x0;_0x390965[_0xc1dc('0xb')]=0x0;if(_0x390965[_0xc1dc('0xc')]){if(_0x390965[_0xc1dc('0xd')]==='abandoned'){_0x390965[_0xc1dc('0xa')]+=0x1;updateWaitingCounter(_0x390965);}if(_0x390965[_0xc1dc('0xe')]){_0x390965[_0xc1dc('0xf')]+=0x1;if(_0x390965['talking']){_0x390965[_0xc1dc('0x8')]-=0x1;}}else{if(_0x390965[_0xc1dc('0xd')]){_0x390965['unmanaged']+=0x1;updateWaitingCounter(_0x390965);}}}else{if(!_0x390965['UserId']){_0x390965[_0xc1dc('0x7')]+=0x1;}if(_0x390965[_0xc1dc('0xe')]){_0x390965[_0xc1dc('0x8')]+=0x1;updateWaitingCounter(_0x390965);}}_0x390965[_0xc1dc('0xb')]+=0x1;return _0x390965;}function getLastMessageText(_0x1fb27f){return db[_0xc1dc('0x10')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1fb27f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc1dc('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc1dc('0x12')],'order':'-id','raw':!![]})['then'](function(_0x32b71b){if(_0x32b71b&&_0x32b71b[_0xc1dc('0x12')]){_0x1fb27f['lastMsgText']=_[_0xc1dc('0x13')](_0x32b71b[_0xc1dc('0x12')]);}return _0x1fb27f;})['catch'](function(_0x1b9acf){throw _0x1b9acf;});}exports[_0xc1dc('0x14')]=function(_0xe7d9b0,_0x434c29,_0x234f5d,_0xc8869d){return new Promise(function(_0x4fcf92,_0x5f3838){return getInteractionUsers(_0xe7d9b0['id'],_0x234f5d)[_0xc1dc('0x15')](function(_0x1a188f){_0xe7d9b0[_0xc1dc('0x16')]=_0x1a188f;return getInteractionTags(_0xe7d9b0[_0xc1dc('0x17')],_0x434c29);})[_0xc1dc('0x15')](function(_0x38b1c5){_0xe7d9b0[_0xc1dc('0x18')]=_0x38b1c5;delete _0xe7d9b0[_0xc1dc('0x17')];return updateInteractionCounters(_0xe7d9b0);})[_0xc1dc('0x15')](function(_0x32bcd2){if(_0xc8869d){return getLastMessageText(_0x32bcd2);}else{return _0x32bcd2;}})[_0xc1dc('0x15')](function(_0x49b653){_0x4fcf92(_0x49b653);})['catch'](function(_0xf146db){_0x5f3838(_0xf146db);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 3ae282f..2cf7481 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 _0x6ae6=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','chat','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role'];(function(_0x4e566c,_0x16e04c){var _0x31947e=function(_0x2479a3){while(--_0x2479a3){_0x4e566c['push'](_0x4e566c['shift']());}};_0x31947e(++_0x16e04c);}(_0x6ae6,0x18a));var _0x66ae=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x6ae6[_0x4a6cf8];return _0x22205e;};'use strict';var _=require(_0x66ae('0x0'));var db=require(_0x66ae('0x1'))['db'];var loggers={'openchannel':require(_0x66ae('0x2'))(_0x66ae('0x3')),'mail':require('../../config/logger')(_0x66ae('0x4')),'fax':require(_0x66ae('0x2'))('fax-interactions'),'sms':require(_0x66ae('0x2'))(_0x66ae('0x5')),'chat':require(_0x66ae('0x2'))(_0x66ae('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x253c14){return _['capitalize'](_0x253c14)+(_0x253c14===_0x66ae('0x7')?'Website':'Account')+'Id';}function getInteractionFK(_0x3d8179){return _[_0x66ae('0x8')](_0x3d8179)+_0x66ae('0x9');}function getInteractionId(_0x5c1ec4,_0x514ba6,_0x29bf9f){if(_0x5c1ec4&&_0x5c1ec4[_[_0x66ae('0xa')](_0x29bf9f)+_0x66ae('0x9')]){return _0x5c1ec4[_[_0x66ae('0xa')](_0x29bf9f)+_0x66ae('0x9')];}else if(_0x5c1ec4&&_0x5c1ec4['id']){return _0x5c1ec4['id'];}else if(_0x514ba6&&_0x514ba6['id']){return _0x514ba6['id'];}else{return _0x66ae('0xb');}}function getInteractionsTables(_0x3cf0f7){return{'accounts':_0x3cf0f7+'_'+(_0x3cf0f7===_0x66ae('0x7')?_0x66ae('0xc'):_0x66ae('0xd')),'interactions':_0x3cf0f7+_0x66ae('0xe'),'interactionsTags':_0x3cf0f7+_0x66ae('0xf'),'messages':_0x3cf0f7+_0x66ae('0x10'),'userInteractions':_0x66ae('0x11')+_0x3cf0f7+_0x66ae('0xe')};}function getSelectedTags(_0xa753ba){var _0x2484a3=[];if(_0xa753ba){_0x2484a3=Array[_0x66ae('0x12')](_0xa753ba)?_0xa753ba:[_0xa753ba];}return _0x2484a3;}function log(_0x25d214,_0x251ffa,_0x1c34ee,_0x51e844,_0xc9f52d,_0x197ee4){loggers[_0xc9f52d['toLowerCase']()][_0x25d214](_0x66ae('0x13'),_0x197ee4[_0x66ae('0x14')](),_0x251ffa?_0x251ffa['id']:null,_0x251ffa?_0x251ffa['name']:null,_0x251ffa?_0x251ffa[_0x66ae('0x15')]:null,getInteractionId(_0x1c34ee,_0x51e844,_0xc9f52d),_0x1c34ee?JSON[_0x66ae('0x16')](_0x1c34ee):_0x66ae('0x17'));}function updateUser(_0x3379e5,_0x137f6f,_0x4bd144,_0x457482,_0x3ec47c){db[_[_0x66ae('0xa')](_0x457482)+_0x66ae('0x18')][_0x66ae('0x19')]({'where':{'id':getInteractionId(_0x137f6f,_0x4bd144,_0x457482)}})[_0x66ae('0x1a')](function(_0x58a311){if(_0x58a311){return _0x58a311[_0x66ae('0x1b')]({'UserId':_0x3379e5?_0x3379e5['id']:null});}})[_0x66ae('0x1a')](function(_0x49b95c){if(_0x49b95c){log(_0x66ae('0x1c'),_0x3379e5,_0x137f6f,_0x4bd144,_0x457482,_0x3ec47c);}})[_0x66ae('0x1d')](function(){log(_0x66ae('0x1e'),_0x3379e5,_0x137f6f,_0x4bd144,_0x457482,_0x3ec47c);});}module[_0x66ae('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xaf81=['unknown','websites','accounts','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','findOne','then','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf81,0x109));var _0x1af8=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xaf81[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x1af8('0x0'));var db=require(_0x1af8('0x1'))['db'];var loggers={'openchannel':require(_0x1af8('0x2'))(_0x1af8('0x3')),'mail':require(_0x1af8('0x2'))(_0x1af8('0x4')),'fax':require(_0x1af8('0x2'))(_0x1af8('0x5')),'sms':require(_0x1af8('0x2'))(_0x1af8('0x6')),'chat':require('../../config/logger')(_0x1af8('0x7')),'whatsapp':require(_0x1af8('0x2'))(_0x1af8('0x8'))};function getAccountFK(_0x28e0f1){return _['capitalize'](_0x28e0f1)+(_0x28e0f1===_0x1af8('0x9')?_0x1af8('0xa'):_0x1af8('0xb'))+'Id';}function getInteractionFK(_0x26aba4){return _[_0x1af8('0xc')](_0x26aba4)+_0x1af8('0xd');}function getInteractionId(_0x59d38a,_0x46f8ae,_0x334023){if(_0x59d38a&&_0x59d38a[_[_0x1af8('0xe')](_0x334023)+_0x1af8('0xd')]){return _0x59d38a[_['upperFirst'](_0x334023)+'InteractionId'];}else if(_0x59d38a&&_0x59d38a['id']){return _0x59d38a['id'];}else if(_0x46f8ae&&_0x46f8ae['id']){return _0x46f8ae['id'];}else{return _0x1af8('0xf');}}function getInteractionsTables(_0x623911){return{'accounts':_0x623911+'_'+(_0x623911===_0x1af8('0x9')?_0x1af8('0x10'):_0x1af8('0x11')),'interactions':_0x623911+'_interactions','interactionsTags':_0x623911+'_interaction_has_tags','messages':_0x623911+'_messages','userInteractions':_0x1af8('0x12')+_0x623911+'_interactions'};}function getSelectedTags(_0x1ee600){var _0x367521=[];if(_0x1ee600){_0x367521=Array[_0x1af8('0x13')](_0x1ee600)?_0x1ee600:[_0x1ee600];}return _0x367521;}function log(_0x253246,_0x2386a1,_0x499c45,_0xb0dd44,_0x6a6fdb,_0x2d041a){loggers[_0x6a6fdb[_0x1af8('0x14')]()][_0x253246](_0x1af8('0x15'),_0x2d041a[_0x1af8('0x16')](),_0x2386a1?_0x2386a1['id']:null,_0x2386a1?_0x2386a1['name']:null,_0x2386a1?_0x2386a1[_0x1af8('0x17')]:null,getInteractionId(_0x499c45,_0xb0dd44,_0x6a6fdb),_0x499c45?JSON['stringify'](_0x499c45):_0x1af8('0x18'));}function updateUser(_0x157d2e,_0x12dcbe,_0xb2288,_0x5e6981,_0x116d00){db[_[_0x1af8('0xe')](_0x5e6981)+_0x1af8('0x19')][_0x1af8('0x1a')]({'where':{'id':getInteractionId(_0x12dcbe,_0xb2288,_0x5e6981)}})[_0x1af8('0x1b')](function(_0xda16b5){if(_0xda16b5){return _0xda16b5['update']({'UserId':_0x157d2e?_0x157d2e['id']:null});}})['then'](function(_0x3e49e4){if(_0x3e49e4){log('info',_0x157d2e,_0x12dcbe,_0xb2288,_0x5e6981,_0x116d00);}})['catch'](function(){log('error',_0x157d2e,_0x12dcbe,_0xb2288,_0x5e6981,_0x116d00);});}module['exports']={'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 b63e22d..9307042 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 _0x9baf=['utf8','final','parse','hasOwnProperty','use','License','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','createDecipher','%s:%s:%s','base64'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9baf,0x13d));var _0xf9ba=function(_0x4668e3,_0x465bdc){_0x4668e3=_0x4668e3-0x0;var _0x20c896=_0x9baf[_0x4668e3];return _0x20c896;};'use strict';var crypto=require('crypto');var util=require(_0xf9ba('0x0'));var compose=require(_0xf9ba('0x1'));var db=require(_0xf9ba('0x2'))['db'];var config=require(_0xf9ba('0x3'));function getValueFromLicense(_0x4b158d,_0x2b479f){if(_0x4b158d&&_0x2b479f){if(_0x2b479f[_0xf9ba('0x4')]&&_0x2b479f['license']){var _0x4b5a07=_0x2b479f[_0xf9ba('0x4')];var _0x1491d4=_0x2b479f['license'];var _0x4bf0bb=_0x4b5a07['split']('-')[0x4];var _0x48a92e=_0x4b5a07['split']('-')[0x0];var _0x3b318d=crypto[_0xf9ba('0x5')]('aes-256-ctr',util['format'](_0xf9ba('0x6'),_0x4bf0bb,_0x4b5a07,_0x48a92e));var _0x2cb585=_0x3b318d['update'](_0x1491d4,_0xf9ba('0x7'),_0xf9ba('0x8'));_0x2cb585+=_0x3b318d[_0xf9ba('0x9')](_0xf9ba('0x8'));var _0x2638e7=JSON[_0xf9ba('0xa')](_0x2cb585);return _0x2638e7[_0xf9ba('0xb')](_0x4b158d)?_0x2638e7[_0x4b158d]:null;}}return null;}function isLimit(_0x4e343f,_0x8eb3a4,_0x4c6dbe,_0x268bae){var _0x250a27=_0x8eb3a4;return compose()[_0xf9ba('0xc')](function(_0x421754,_0x367f92,_0x9bf18e){return db[_0xf9ba('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5927e7){var _0x4f0983=getValueFromLicense(_0x4e343f,_0x5927e7);return _0x4f0983?_0x4f0983:_0x250a27;})[_0xf9ba('0xe')](function(_0x119165){_0x250a27=_0x119165;return _0x4c6dbe[_0xf9ba('0xf')](_0x268bae);})['then'](function(_0xc80937){if(_0xc80937>=_0x250a27){return _0x367f92[_0xf9ba('0x10')](0x193)['json']({'message':util[_0xf9ba('0x11')](_0xf9ba('0x12'),_0x4e343f)});}_0x9bf18e();})[_0xf9ba('0x13')](function(_0x2fbea3){_0x9bf18e(_0x2fbea3);});});}function isUserLimit(){return isLimit(_0xf9ba('0x14'),0x1,db[_0xf9ba('0x15')],{'where':{'$or':[{'role':_0xf9ba('0x16')},{'role':_0xf9ba('0x17')}]}});}exports[_0xf9ba('0x18')]=isUserLimit; \ No newline at end of file +var _0x36d1=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','count','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','util','../../mysqldb','data1','license','split'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x36d1,0x7d));var _0x136d=function(_0x356d48,_0x22feba){_0x356d48=_0x356d48-0x0;var _0x3427c1=_0x36d1[_0x356d48];return _0x3427c1;};'use strict';var crypto=require('crypto');var util=require(_0x136d('0x0'));var compose=require('composable-middleware');var db=require(_0x136d('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1b2ca9,_0x2da110){if(_0x1b2ca9&&_0x2da110){if(_0x2da110[_0x136d('0x2')]&&_0x2da110['license']){var _0x36214c=_0x2da110[_0x136d('0x2')];var _0x29987b=_0x2da110[_0x136d('0x3')];var _0x8a53fc=_0x36214c[_0x136d('0x4')]('-')[0x4];var _0x5c5851=_0x36214c[_0x136d('0x4')]('-')[0x0];var _0x44330a=crypto[_0x136d('0x5')](_0x136d('0x6'),util[_0x136d('0x7')](_0x136d('0x8'),_0x8a53fc,_0x36214c,_0x5c5851));var _0x24e985=_0x44330a[_0x136d('0x9')](_0x29987b,_0x136d('0xa'),_0x136d('0xb'));_0x24e985+=_0x44330a[_0x136d('0xc')](_0x136d('0xb'));var _0x29dbbc=JSON[_0x136d('0xd')](_0x24e985);return _0x29dbbc['hasOwnProperty'](_0x1b2ca9)?_0x29dbbc[_0x1b2ca9]:null;}}return null;}function isLimit(_0x427a4f,_0xdc1226,_0x3346f6,_0x167477){var _0x16097c=_0xdc1226;return compose()[_0x136d('0xe')](function(_0x301995,_0x11c89b,_0x15b270){return db[_0x136d('0xf')][_0x136d('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2e8679){var _0x181998=getValueFromLicense(_0x427a4f,_0x2e8679);return _0x181998?_0x181998:_0x16097c;})['then'](function(_0x55f80b){_0x16097c=_0x55f80b;return _0x3346f6[_0x136d('0x11')](_0x167477);})[_0x136d('0x12')](function(_0x23b3e7){if(_0x23b3e7>=_0x16097c){return _0x11c89b[_0x136d('0x13')](0x193)['json']({'message':util[_0x136d('0x7')](_0x136d('0x14'),_0x427a4f)});}_0x15b270();})[_0x136d('0x15')](function(_0x2d8ac7){_0x15b270(_0x2d8ac7);});});}function isUserLimit(){return isLimit(_0x136d('0x16'),0x1,db[_0x136d('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x136d('0x18')}]}});}exports[_0x136d('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f289cf3..194b5cb 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 _0xd472=['hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','map','conditions','push','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$endsWith','$lt','<\x20?','$gt','>\x20?','<=\x20?','start','$startsWith','DATE','utcOffset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd472,0x107));var _0x2d47=function(_0x5211af,_0x47205a){_0x5211af=_0x5211af-0x0;var _0x595156=_0xd472[_0x5211af];return _0x595156;};'use strict';var _=require(_0x2d47('0x0'));var moment=require(_0x2d47('0x1'));exports['parseSearch']=function(_0x4cb95a){var _0x3f8a91={'conditions':[]};_0x3f8a91['sqlOperator']=_[_0x2d47('0x2')](_0x4cb95a,_0x2d47('0x3'))?'or':_0x2d47('0x4');var _0x1fa0d2=_0x4cb95a[_0x2d47('0x5')](_0x2d47('0x6'),'')[_0x2d47('0x5')]('[$or]','')[_0x2d47('0x7')]('||');for(var _0x1e7c40=0x0;_0x1e7c40<_0x1fa0d2[_0x2d47('0x8')];_0x1e7c40++){var _0x3eaab7=_0x1fa0d2[_0x1e7c40][_0x2d47('0x7')](':=');var _0x51b7ba=_0x3eaab7[0x0];var _0x3783da=_0x3eaab7['slice'](0x1);_0x3783da[_0x2d47('0x9')](function(_0x52dcbe){var _0x61ce44=_0x52dcbe[_0x2d47('0x7')]('[')[_0x2d47('0xa')]();var _0x5649dd=_0x52dcbe[_0x2d47('0xb')](/\[(.*?)\]/g);_0x5649dd[_0x2d47('0x9')](function(_0x45f0c3){var _0x352df1=_0x45f0c3['split']('[')[_0x2d47('0xc')](function(_0x1a8026){return _0x1a8026[_0x2d47('0xd')](']')>-0x1;})[_0x2d47('0xe')](function(_0x46c2ff){return _0x46c2ff[_0x2d47('0x7')](']')[0x0];})[0x0];_0x3f8a91[_0x2d47('0xf')][_0x2d47('0x10')]({'field':_0x51b7ba,'operator':_0x61ce44,'value':_0x352df1});});});}return _0x3f8a91;};exports['buildExpression']=function(_0x4fd143,_0x49e693,_0x1e891e){var _0x9de9b8={};if(_0x49e693==='DATE'){if(_0x1e891e[_0x2d47('0x11')]===_0x2d47('0x12')){_0x1e891e[_0x2d47('0x11')]=_0x2d47('0x13');_0x1e891e[_0x2d47('0x14')]+=','+_0x1e891e['value'];}else if(_[_0x2d47('0x15')](['$gt',_0x2d47('0x16')],_0x1e891e[_0x2d47('0x11')])){_0x1e891e[_0x2d47('0x14')]=moment(_0x1e891e[_0x2d47('0x14')])[_0x2d47('0x17')](0x1,_0x2d47('0x18'))[_0x2d47('0x19')](_0x2d47('0x1a'));}}if(_0x1e891e[_0x2d47('0x1b')]){_0x49e693=_0x1e891e[_0x2d47('0x1b')];_0x9de9b8[_0x2d47('0x1c')]=_0x2d47('0x1d')+_0x4fd143+'.'+_0x1e891e[_0x2d47('0x1e')]+_0x2d47('0x1f')+_0x1e891e[_0x2d47('0x1b')]+')\x20'+parseOperator(_0x1e891e[_0x2d47('0x11')]);}else{_0x9de9b8[_0x2d47('0x1c')]=_0x4fd143+'.'+_0x1e891e[_0x2d47('0x1e')]+'\x20'+parseOperator(_0x1e891e['operator']);}if(_[_0x2d47('0x15')]([_0x2d47('0x20'),_0x2d47('0x21')],_0x1e891e[_0x2d47('0x11')]))_0x9de9b8['text']='('+_0x9de9b8[_0x2d47('0x1c')]+'\x20OR\x20'+_0x4fd143+'.'+_0x1e891e['field']+'\x20IS\x20NULL)';_0x9de9b8[_0x2d47('0x14')]=parseValue(_0x49e693,_0x1e891e[_0x2d47('0x11')],_0x1e891e['value']);return _0x9de9b8;};function parseOperator(_0x26fd39){var _0x1092b4;switch(_0x26fd39){case _0x2d47('0x22'):_0x1092b4=_0x2d47('0x23');break;case _0x2d47('0x21'):_0x1092b4=_0x2d47('0x24');break;case _0x2d47('0x12'):_0x1092b4=_0x2d47('0x25');break;case _0x2d47('0x20'):_0x1092b4='<>\x20?';break;case _0x2d47('0x26'):case'$startsWith':case _0x2d47('0x27'):_0x1092b4='LIKE\x20?';break;case _0x2d47('0x28'):_0x1092b4=_0x2d47('0x29');break;case _0x2d47('0x2a'):_0x1092b4=_0x2d47('0x2b');break;case _0x2d47('0x16'):_0x1092b4=_0x2d47('0x2c');break;case'$gte':_0x1092b4='>=\x20?';break;case'$between':_0x1092b4='BETWEEN\x20?\x20AND\x20?';break;}return _0x1092b4;}function parseValue(_0x76ed7d,_0x560656,_0x2a3d22){var _0x1d30e5={'start':undefined,'end':undefined};switch(_0x560656){case _0x2d47('0x22'):case'$notIn':_0x1d30e5['start']=_0x2a3d22[_0x2d47('0x7')](',');break;case _0x2d47('0x26'):_0x1d30e5[_0x2d47('0x2d')]='%'+_0x2a3d22+'%';break;case _0x2d47('0x2e'):_0x1d30e5[_0x2d47('0x2d')]=_0x2a3d22+'%';break;case _0x2d47('0x27'):_0x1d30e5['start']='%'+_0x2a3d22;break;case _0x2d47('0x13'):var _0x4a895c=_0x2a3d22[_0x2d47('0x7')](',');var _0x2a3d22=_0x4a895c[_0x2d47('0xa')]();var _0x5455b7=_0x4a895c['pop']();if(_0x76ed7d===_0x2d47('0x2f')){_0x2a3d22=moment(_0x2a3d22)[_0x2d47('0x30')](0x0,!![])[_0x2d47('0x19')]();_0x5455b7=moment(_0x5455b7)[_0x2d47('0x30')](0x0,!![])[_0x2d47('0x17')](0x17,_0x2d47('0x31'))['add'](0x3b,_0x2d47('0x32'))['add'](0x3b,_0x2d47('0x33'))[_0x2d47('0x19')]();}_0x1d30e5={'start':_0x2a3d22,'end':_0x5455b7};break;default:_0x1d30e5[_0x2d47('0x2d')]=_0x2a3d22;break;}return _0x1d30e5;} \ No newline at end of file +var _0x5334=['[$and]','split','length','slice','forEach','shift','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','format','add','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5334,0x65));var _0x4533=function(_0xa36887,_0x36a350){_0xa36887=_0xa36887-0x0;var _0x14cd1b=_0x5334[_0xa36887];return _0x14cd1b;};'use strict';var _=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));exports['parseSearch']=function(_0x3fa5aa){var _0x4db56d={'conditions':[]};_0x4db56d[_0x4533('0x2')]=_[_0x4533('0x3')](_0x3fa5aa,_0x4533('0x4'))?'or':_0x4533('0x5');var _0x2dc30e=_0x3fa5aa[_0x4533('0x6')](_0x4533('0x7'),'')[_0x4533('0x6')](_0x4533('0x4'),'')[_0x4533('0x8')]('||');for(var _0x378a6e=0x0;_0x378a6e<_0x2dc30e[_0x4533('0x9')];_0x378a6e++){var _0xfd27ed=_0x2dc30e[_0x378a6e][_0x4533('0x8')](':=');var _0x3eb388=_0xfd27ed[0x0];var _0x29dc06=_0xfd27ed[_0x4533('0xa')](0x1);_0x29dc06[_0x4533('0xb')](function(_0x4b6e2a){var _0x3ae0e2=_0x4b6e2a['split']('[')[_0x4533('0xc')]();var _0x561d83=_0x4b6e2a['match'](/\[(.*?)\]/g);_0x561d83[_0x4533('0xb')](function(_0x4abe7b){var _0x43410c=_0x4abe7b[_0x4533('0x8')]('[')['filter'](function(_0x56f306){return _0x56f306[_0x4533('0xd')](']')>-0x1;})['map'](function(_0x68d1a0){return _0x68d1a0[_0x4533('0x8')](']')[0x0];})[0x0];_0x4db56d[_0x4533('0xe')][_0x4533('0xf')]({'field':_0x3eb388,'operator':_0x3ae0e2,'value':_0x43410c});});});}return _0x4db56d;};exports[_0x4533('0x10')]=function(_0x37f2b2,_0x3b579f,_0x2a3959){var _0x301504={};if(_0x3b579f===_0x4533('0x11')){if(_0x2a3959[_0x4533('0x12')]===_0x4533('0x13')){_0x2a3959[_0x4533('0x12')]=_0x4533('0x14');_0x2a3959[_0x4533('0x15')]+=','+_0x2a3959[_0x4533('0x15')];}else if(_[_0x4533('0x16')]([_0x4533('0x17'),_0x4533('0x18')],_0x2a3959[_0x4533('0x12')])){_0x2a3959[_0x4533('0x15')]=moment(_0x2a3959[_0x4533('0x15')])['add'](0x1,_0x4533('0x19'))['format'](_0x4533('0x1a'));}}if(_0x2a3959['castTo']){_0x3b579f=_0x2a3959[_0x4533('0x1b')];_0x301504[_0x4533('0x1c')]='CAST('+_0x37f2b2+'.'+_0x2a3959[_0x4533('0x1d')]+_0x4533('0x1e')+_0x2a3959[_0x4533('0x1b')]+')\x20'+parseOperator(_0x2a3959[_0x4533('0x12')]);}else{_0x301504[_0x4533('0x1c')]=_0x37f2b2+'.'+_0x2a3959[_0x4533('0x1d')]+'\x20'+parseOperator(_0x2a3959[_0x4533('0x12')]);}if(_[_0x4533('0x16')]([_0x4533('0x1f'),_0x4533('0x20')],_0x2a3959[_0x4533('0x12')]))_0x301504[_0x4533('0x1c')]='('+_0x301504[_0x4533('0x1c')]+_0x4533('0x21')+_0x37f2b2+'.'+_0x2a3959[_0x4533('0x1d')]+_0x4533('0x22');_0x301504['value']=parseValue(_0x3b579f,_0x2a3959[_0x4533('0x12')],_0x2a3959[_0x4533('0x15')]);return _0x301504;};function parseOperator(_0x22e8fb){var _0x56bc0e;switch(_0x22e8fb){case _0x4533('0x23'):_0x56bc0e=_0x4533('0x24');break;case _0x4533('0x20'):_0x56bc0e='NOT\x20IN\x20?';break;case'$eq':_0x56bc0e=_0x4533('0x25');break;case _0x4533('0x1f'):_0x56bc0e=_0x4533('0x26');break;case _0x4533('0x27'):case _0x4533('0x28'):case'$endsWith':_0x56bc0e=_0x4533('0x29');break;case'$lt':_0x56bc0e='<\x20?';break;case _0x4533('0x17'):_0x56bc0e=_0x4533('0x2a');break;case _0x4533('0x18'):_0x56bc0e=_0x4533('0x2b');break;case'$gte':_0x56bc0e='>=\x20?';break;case _0x4533('0x14'):_0x56bc0e=_0x4533('0x2c');break;}return _0x56bc0e;}function parseValue(_0x4ebf7a,_0x50c2b1,_0x1a976b){var _0x188e78={'start':undefined,'end':undefined};switch(_0x50c2b1){case'$in':case'$notIn':_0x188e78['start']=_0x1a976b[_0x4533('0x8')](',');break;case _0x4533('0x27'):_0x188e78[_0x4533('0x2d')]='%'+_0x1a976b+'%';break;case'$startsWith':_0x188e78[_0x4533('0x2d')]=_0x1a976b+'%';break;case _0x4533('0x2e'):_0x188e78[_0x4533('0x2d')]='%'+_0x1a976b;break;case _0x4533('0x14'):var _0x4083cf=_0x1a976b[_0x4533('0x8')](',');var _0x1a976b=_0x4083cf['shift']();var _0x28dbf6=_0x4083cf[_0x4533('0x2f')]();if(_0x4ebf7a==='DATE'){_0x1a976b=moment(_0x1a976b)[_0x4533('0x30')](0x0,!![])[_0x4533('0x31')]();_0x28dbf6=moment(_0x28dbf6)['utcOffset'](0x0,!![])[_0x4533('0x32')](0x17,_0x4533('0x33'))[_0x4533('0x32')](0x3b,_0x4533('0x34'))[_0x4533('0x32')](0x3b,_0x4533('0x35'))['format']();}_0x188e78={'start':_0x1a976b,'end':_0x28dbf6};break;default:_0x188e78[_0x4533('0x2d')]=_0x1a976b;break;}return _0x188e78;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 996109e..937a1c2 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 _0x8734=['type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','sort','map','indexOf','cast','col','unsigned','DESC','priority','ASC','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','{EXPR}','forEach','replace','push','join','query','$id','intersection','attributes','nolimit','limit','offset','order','pick','filter','columns','value','where','merge','VIRTUAL','options','includeAll','include','lodash','moment','../../mysqldb','parse','keys','includes','model','alias','raw','fields','filters','isEmpty'];(function(_0x408264,_0x1389d1){var _0x116f46=function(_0xa4bd77){while(--_0xa4bd77){_0x408264['push'](_0x408264['shift']());}};_0x116f46(++_0x1389d1);}(_0x8734,0x134));var _0x4873=function(_0xcedf57,_0x335b10){_0xcedf57=_0xcedf57-0x0;var _0x35eccf=_0x8734[_0xcedf57];return _0x35eccf;};'use strict';var _=require(_0x4873('0x0'));var sequelize=require('sequelize');var moment=require(_0x4873('0x1'));var db=require(_0x4873('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x270283){var _0x354735=['ne'];try{var _0x4eb8ad=JSON[_0x4873('0x3')](_0x270283);var _0x5bcb32=Object[_0x4873('0x4')](_0x4eb8ad)[0x0];return _0x354735[_0x4873('0x5')](_0x5bcb32);}catch(_0x53c67d){return![];}}function getOperatorValue(_0xb44024){var _0x4b5d88=JSON['parse'](_0xb44024);var _0x567400=Object[_0x4873('0x4')](_0x4b5d88)[0x0];var _0x54fdb5=_0x4b5d88[_0x567400];return{['$'+_0x567400]:_0x54fdb5};}function parseIncludeModel(_0x2833e5){var _0x13a874=JSON[_0x4873('0x3')](_0x2833e5);return{'model':db[_0x13a874[_0x4873('0x6')]],'as':_0x13a874[_0x4873('0x7')],'attributes':_0x13a874['fields'],'raw':_0x13a874[_0x4873('0x8')]};}exports[_0x4873('0x9')]=function(_0x4a8588){var _0x12e20b=null;if(_0x4a8588){_0x12e20b=_0x4a8588['split'](',');}return _0x12e20b;};exports[_0x4873('0xa')]=function(_0x28f72c,_0x116aa6){var _0x53287b={};if(!_[_0x4873('0xb')](_0x28f72c)){_['forOwn'](_0x28f72c,function(_0x17ccfc,_0x327062){try{if(_0x116aa6){var _0xbb8c60=_['find'](_0x116aa6,{'name':_0x327062})||{};if(hasSequelizeOperator(_0x17ccfc)){_0x53287b[_0x327062]=getOperatorValue(_0x17ccfc);}else if(_0xbb8c60[_0x4873('0xc')]===_0x4873('0xd')&&_[_0x4873('0xe')](_0x17ccfc)){var _0x1b1031=JSON['parse'](_0x17ccfc);var _0x4f725d={'$gte':moment(moment(_0x1b1031[_0x4873('0xf')])[_0x4873('0x10')](_0x4873('0x11')))[_0x4873('0x12')]()['format'](),'$lte':moment(moment(_0x1b1031[_0x4873('0x13')])[_0x4873('0x10')]('YYYY-MM-DD'))['utc']()[_0x4873('0x14')](0x1,'s')[_0x4873('0x10')]()};_0x53287b[_0x327062]=_0x4f725d;}else if(_0xbb8c60[_0x4873('0x15')]===_0x4873('0x16')){_0x53287b[_0x327062]=_0x17ccfc;}else{_0x53287b[_0x327062]=_[_0x4873('0x17')](_0x17ccfc)?_0x17ccfc:JSON[_0x4873('0x3')](_0x17ccfc);}}else{_0x53287b[_0x327062]=_['isArray'](_0x17ccfc)?_0x17ccfc:JSON['parse'](_0x17ccfc);}}catch(_0x132e28){_0x53287b[_0x327062]=_0x17ccfc[_0x4873('0x18')](',');}});}return _0x53287b;};exports['limit']=function(_0x2009c4){_0x2009c4=parseInt(_0x2009c4,0xa);if(!_0x2009c4||_0x2009c4<0x0){_0x2009c4=LIMIT_VALUE;}return _0x2009c4;};exports['offset']=function(_0x316799){_0x316799=parseInt(_0x316799,0xa);if(!_0x316799||_0x316799<0x0){_0x316799=0x0;}return _0x316799;};exports[_0x4873('0x19')]=function(_0x362eb7){var _0x35ac4e,_0x51d5cb=null;if(_0x362eb7){_0x35ac4e=_0x362eb7[_0x4873('0x18')](',');_0x51d5cb=_[_0x4873('0x1a')](_0x35ac4e,function(_0x1baee1){if(_0x1baee1[_0x4873('0x1b')]('-')===0x0){return[_0x1baee1==='priority'?sequelize[_0x4873('0x1c')](sequelize[_0x4873('0x1d')]('priority'),_0x4873('0x1e')):_0x1baee1['substr'](0x1),_0x4873('0x1f')];}else{return[_0x1baee1===_0x4873('0x20')?sequelize[_0x4873('0x1c')](sequelize[_0x4873('0x1d')](_0x4873('0x20')),_0x4873('0x1e')):_0x1baee1,_0x4873('0x21')];}});}return _0x51d5cb;};exports['omit']=function(_0x545f75,_0x335814){if(_['isEmpty'](_0x545f75)){return _0x545f75;}if(_[_0x4873('0x17')](_0x545f75)){for(var _0x1cb289=0x0;_0x1cb289<_0x545f75[_0x4873('0x22')];_0x1cb289+=0x1){_0x545f75[_0x1cb289]=this[_0x4873('0x23')](_0x545f75[_0x1cb289],_0x335814);}return _0x545f75;}if(!_[_0x4873('0x24')](_0x545f75)){return _0x545f75;}if(_[_0x4873('0x25')](_0x335814)){_0x335814=[_0x335814];}if(!_[_0x4873('0x17')](_0x335814)){return _0x545f75;}for(var _0x430ca4=0x0;_0x430ca4<_0x335814[_0x4873('0x22')];_0x430ca4+=0x1){_['unset'](_0x545f75,_0x335814[_0x430ca4]);}for(var _0x16d8ab in _0x545f75){if(_0x545f75[_0x4873('0x26')](_0x16d8ab)){_0x545f75[_0x16d8ab]=this['omit'](_0x545f75[_0x16d8ab],_0x335814);}}return _0x545f75;};exports[_0x4873('0x27')]=function(_0x3fe786){return _0x3fe786[_0x4873('0x28')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x3f7c9a){return _0x3f7c9a['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xe6c543,_0x491e18){var _0x1c8a41=[];var _0x2a0be9=/[ `!@#$%^&*()_\-?~]/;var _0x42fe96=_0x491e18?'\x22{EXPR}\x22':_0x4873('0x29');_0xe6c543['split'](/[ ,]+/)[_0x4873('0x2a')](function(_0x221a35){_0x221a35=_0x221a35[_0x4873('0x2b')](/([^:]")"+/g,'$1');_0x221a35='+'+_0x221a35+'*';var _0x504c27=_0x221a35[_0x4873('0x28')](_0x2a0be9);if(_0x504c27){_0x221a35='\x22'+_0x221a35+'\x22';}_0x1c8a41[_0x4873('0x2c')](_0x221a35);});_0x42fe96=_0x42fe96[_0x4873('0x2b')](_0x4873('0x29'),_0x1c8a41[_0x4873('0x2d')]('\x20'));return _0x42fe96;};exports['getOptions']=function(_0x116082,_0x3274c1,_0x735543){var _0x41497b={},_0x353508={};if(_0x3274c1['query']['$id']){_0x3274c1[_0x4873('0x2e')]['id']=_0x3274c1[_0x4873('0x2e')]['$id'];delete _0x3274c1['query'][_0x4873('0x2f')];}_0x41497b[_0x4873('0x6')]=_[_0x4873('0x1a')](_0x116082,_0x4873('0x15'));_0x41497b[_0x4873('0x2e')]=_[_0x4873('0x4')](_0x3274c1[_0x4873('0x2e')]);_0x41497b[_0x4873('0xa')]=_[_0x4873('0x30')](_0x41497b[_0x4873('0x6')],_0x41497b[_0x4873('0x2e')]);_0x353508['attributes']=_[_0x4873('0x30')](_0x41497b['model'],this['fields'](_0x3274c1[_0x4873('0x2e')][_0x4873('0x9')]));_0x353508[_0x4873('0x31')]=_0x353508['attributes'][_0x4873('0x22')]?_0x353508[_0x4873('0x31')]:_0x41497b[_0x4873('0x6')];if(!_0x3274c1['query'][_0x4873('0x26')](_0x4873('0x32'))){_0x353508[_0x4873('0x33')]=this[_0x4873('0x33')](_0x3274c1[_0x4873('0x2e')]['limit']);_0x353508[_0x4873('0x34')]=this['offset'](_0x3274c1[_0x4873('0x2e')][_0x4873('0x34')]);}_0x353508[_0x4873('0x35')]=this[_0x4873('0x19')](_0x3274c1['query']['sort']);_0x353508['where']=this[_0x4873('0xa')](_[_0x4873('0x36')](_0x3274c1['query'],_0x41497b['filters']),_0x116082);if(_0x3274c1['query']['filter']){var _0x4a4aff=_0x116082;var _0x106d3b=_0x3274c1[_0x4873('0x2e')][_0x4873('0x37')];if(typeof _0x106d3b==='object'){_0x4a4aff=_[_0x4873('0x37')](_0x116082,function(_0x335390){return _['includes'](_0x106d3b[_0x4873('0x38')],_0x335390[_0x4873('0x15')]);});_0x106d3b=_0x106d3b[_0x4873('0x39')];}_0x353508[_0x4873('0x3a')]=_[_0x4873('0x3b')](_0x353508[_0x4873('0x3a')],{'$or':_['map'](_0x4a4aff,function(_0x37a3b5){if(_0x37a3b5['type']!==_0x4873('0x3c')){if(_0x735543){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0x37a3b5['name'])),{'$like':sequelize['fn']('lower','%'+_0x3274c1[_0x4873('0x2e')][_0x4873('0x37')]+'%')});}else{var _0x238c1f={};_0x238c1f[_0x37a3b5['name']]={'$like':'%'+_0x3274c1[_0x4873('0x2e')]['filter']+'%'};return _0x238c1f;}}})});}_0x353508=_[_0x4873('0x3b')]({},_0x353508,_0x3274c1[_0x4873('0x3d')]);return _0x353508;};exports['include']=function(_0x3d8d13){var _0x28ee0f=[];if(_0x3d8d13[_0x4873('0x3e')]){_0x28ee0f[_0x4873('0x2c')]({'all':!![]});}else if(_0x3d8d13[_0x4873('0x3f')]){if(Array[_0x4873('0x17')](_0x3d8d13[_0x4873('0x3f')])){_0x28ee0f=Object[_0x4873('0x4')](_0x3d8d13[_0x4873('0x3f')])[_0x4873('0x1a')](function(_0x59ce40){return parseIncludeModel(_0x3d8d13['include'][_0x59ce40]);});}else{var _0x35eac7=parseIncludeModel(_0x3d8d13[_0x4873('0x3f')]);_0x28ee0f[_0x4873('0x2c')](_0x35eac7);}}return _0x28ee0f;}; \ No newline at end of file +var _0xfa45=['isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','query','intersection','attributes','hasOwnProperty','order','sort','where','filter','object','value','merge','type','VIRTUAL','lower','options','include','lodash','sequelize','moment','../../mysqldb','includes','parse','keys','model','fields','raw','split','filters','forOwn','find','DATE','isPlainObject','format','$lte','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','map','priority','col','unsigned','substr','cast','omit','isEmpty','length','isObject','unset'];(function(_0x2a2e9b,_0x1814c2){var _0x136aa4=function(_0x4fa4c5){while(--_0x4fa4c5){_0x2a2e9b['push'](_0x2a2e9b['shift']());}};_0x136aa4(++_0x1814c2);}(_0xfa45,0x11b));var _0x5fa4=function(_0xdcec9d,_0x556909){_0xdcec9d=_0xdcec9d-0x0;var _0x322685=_0xfa45[_0xdcec9d];return _0x322685;};'use strict';var _=require(_0x5fa4('0x0'));var sequelize=require(_0x5fa4('0x1'));var moment=require(_0x5fa4('0x2'));var db=require(_0x5fa4('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x46c739){var _0x2d966c=['ne'];try{var _0x1e88c8=JSON['parse'](_0x46c739);var _0x2b3824=Object['keys'](_0x1e88c8)[0x0];return _0x2d966c[_0x5fa4('0x4')](_0x2b3824);}catch(_0x39c22a){return![];}}function getOperatorValue(_0x1121f8){var _0x260b0d=JSON[_0x5fa4('0x5')](_0x1121f8);var _0x465a79=Object[_0x5fa4('0x6')](_0x260b0d)[0x0];var _0x108de1=_0x260b0d[_0x465a79];return{['$'+_0x465a79]:_0x108de1};}function parseIncludeModel(_0xeb788d){var _0xb708a2=JSON['parse'](_0xeb788d);return{'model':db[_0xb708a2[_0x5fa4('0x7')]],'as':_0xb708a2['alias'],'attributes':_0xb708a2[_0x5fa4('0x8')],'raw':_0xb708a2[_0x5fa4('0x9')]};}exports[_0x5fa4('0x8')]=function(_0x1776e1){var _0x2d2fea=null;if(_0x1776e1){_0x2d2fea=_0x1776e1[_0x5fa4('0xa')](',');}return _0x2d2fea;};exports[_0x5fa4('0xb')]=function(_0x18ae74,_0x4a4568){var _0x25a267={};if(!_['isEmpty'](_0x18ae74)){_[_0x5fa4('0xc')](_0x18ae74,function(_0x2eeea3,_0x3edf92){try{if(_0x4a4568){var _0x1e10b2=_[_0x5fa4('0xd')](_0x4a4568,{'name':_0x3edf92})||{};if(hasSequelizeOperator(_0x2eeea3)){_0x25a267[_0x3edf92]=getOperatorValue(_0x2eeea3);}else if(_0x1e10b2['type']===_0x5fa4('0xe')&&_[_0x5fa4('0xf')](_0x2eeea3)){var _0x4e1008=JSON[_0x5fa4('0x5')](_0x2eeea3);var _0x40ce98={'$gte':moment(moment(_0x4e1008['$gte'])[_0x5fa4('0x10')]('YYYY-MM-DD'))['utc']()[_0x5fa4('0x10')](),'$lte':moment(moment(_0x4e1008[_0x5fa4('0x11')])[_0x5fa4('0x10')](_0x5fa4('0x12')))[_0x5fa4('0x13')]()[_0x5fa4('0x14')](0x1,'s')['format']()};_0x25a267[_0x3edf92]=_0x40ce98;}else if(_0x1e10b2[_0x5fa4('0x15')]===_0x5fa4('0x16')){_0x25a267[_0x3edf92]=_0x2eeea3;}else{_0x25a267[_0x3edf92]=_[_0x5fa4('0x17')](_0x2eeea3)?_0x2eeea3:JSON[_0x5fa4('0x5')](_0x2eeea3);}}else{_0x25a267[_0x3edf92]=_[_0x5fa4('0x17')](_0x2eeea3)?_0x2eeea3:JSON[_0x5fa4('0x5')](_0x2eeea3);}}catch(_0x339f79){_0x25a267[_0x3edf92]=_0x2eeea3[_0x5fa4('0xa')](',');}});}return _0x25a267;};exports[_0x5fa4('0x18')]=function(_0x1b50c6){_0x1b50c6=parseInt(_0x1b50c6,0xa);if(!_0x1b50c6||_0x1b50c6<0x0){_0x1b50c6=LIMIT_VALUE;}return _0x1b50c6;};exports[_0x5fa4('0x19')]=function(_0x3cadd1){_0x3cadd1=parseInt(_0x3cadd1,0xa);if(!_0x3cadd1||_0x3cadd1<0x0){_0x3cadd1=0x0;}return _0x3cadd1;};exports['sort']=function(_0x5f4400){var _0x22eea4,_0x3b23d6=null;if(_0x5f4400){_0x22eea4=_0x5f4400[_0x5fa4('0xa')](',');_0x3b23d6=_[_0x5fa4('0x1a')](_0x22eea4,function(_0x4a480e){if(_0x4a480e['indexOf']('-')===0x0){return[_0x4a480e===_0x5fa4('0x1b')?sequelize['cast'](sequelize[_0x5fa4('0x1c')](_0x5fa4('0x1b')),_0x5fa4('0x1d')):_0x4a480e[_0x5fa4('0x1e')](0x1),'DESC'];}else{return[_0x4a480e===_0x5fa4('0x1b')?sequelize[_0x5fa4('0x1f')](sequelize[_0x5fa4('0x1c')](_0x5fa4('0x1b')),'unsigned'):_0x4a480e,'ASC'];}});}return _0x3b23d6;};exports[_0x5fa4('0x20')]=function(_0x46a1d9,_0x6a602d){if(_[_0x5fa4('0x21')](_0x46a1d9)){return _0x46a1d9;}if(_['isArray'](_0x46a1d9)){for(var _0x34006f=0x0;_0x34006f<_0x46a1d9[_0x5fa4('0x22')];_0x34006f+=0x1){_0x46a1d9[_0x34006f]=this[_0x5fa4('0x20')](_0x46a1d9[_0x34006f],_0x6a602d);}return _0x46a1d9;}if(!_[_0x5fa4('0x23')](_0x46a1d9)){return _0x46a1d9;}if(_['isString'](_0x6a602d)){_0x6a602d=[_0x6a602d];}if(!_['isArray'](_0x6a602d)){return _0x46a1d9;}for(var _0x27dcff=0x0;_0x27dcff<_0x6a602d[_0x5fa4('0x22')];_0x27dcff+=0x1){_[_0x5fa4('0x24')](_0x46a1d9,_0x6a602d[_0x27dcff]);}for(var _0x34d33a in _0x46a1d9){if(_0x46a1d9['hasOwnProperty'](_0x34d33a)){_0x46a1d9[_0x34d33a]=this[_0x5fa4('0x20')](_0x46a1d9[_0x34d33a],_0x6a602d);}}return _0x46a1d9;};exports[_0x5fa4('0x25')]=function(_0x14ea77){return _0x14ea77[_0x5fa4('0x26')](RegExp(_0x5fa4('0x27')))?!![]:![];};exports[_0x5fa4('0x28')]=function(_0x2c5397){return _0x2c5397[_0x5fa4('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x5fa4('0x29')]=function(_0x5b79dc,_0x2c4abf){var _0xcec07d=[];var _0x32ff87=/[ `!@#$%^&*()_\-?~]/;var _0x55acac=_0x2c4abf?_0x5fa4('0x2a'):_0x5fa4('0x2b');_0x5b79dc[_0x5fa4('0xa')](/[ ,]+/)[_0x5fa4('0x2c')](function(_0x3156ad){_0x3156ad=_0x3156ad[_0x5fa4('0x2d')](/([^:]")"+/g,'$1');_0x3156ad='+'+_0x3156ad+'*';var _0x4d6854=_0x3156ad[_0x5fa4('0x26')](_0x32ff87);if(_0x4d6854){_0x3156ad='\x22'+_0x3156ad+'\x22';}_0xcec07d[_0x5fa4('0x2e')](_0x3156ad);});_0x55acac=_0x55acac[_0x5fa4('0x2d')](_0x5fa4('0x2b'),_0xcec07d[_0x5fa4('0x2f')]('\x20'));return _0x55acac;};exports['getOptions']=function(_0x8e50c1,_0x2c31f8,_0x51f03d){var _0x254ec8={},_0x508ff7={};if(_0x2c31f8[_0x5fa4('0x30')]['$id']){_0x2c31f8[_0x5fa4('0x30')]['id']=_0x2c31f8[_0x5fa4('0x30')]['$id'];delete _0x2c31f8['query']['$id'];}_0x254ec8[_0x5fa4('0x7')]=_[_0x5fa4('0x1a')](_0x8e50c1,_0x5fa4('0x15'));_0x254ec8[_0x5fa4('0x30')]=_['keys'](_0x2c31f8['query']);_0x254ec8[_0x5fa4('0xb')]=_[_0x5fa4('0x31')](_0x254ec8[_0x5fa4('0x7')],_0x254ec8['query']);_0x508ff7[_0x5fa4('0x32')]=_[_0x5fa4('0x31')](_0x254ec8[_0x5fa4('0x7')],this['fields'](_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x8')]));_0x508ff7['attributes']=_0x508ff7[_0x5fa4('0x32')]['length']?_0x508ff7[_0x5fa4('0x32')]:_0x254ec8[_0x5fa4('0x7')];if(!_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x33')]('nolimit')){_0x508ff7[_0x5fa4('0x18')]=this[_0x5fa4('0x18')](_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x18')]);_0x508ff7['offset']=this[_0x5fa4('0x19')](_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x19')]);}_0x508ff7[_0x5fa4('0x34')]=this[_0x5fa4('0x35')](_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x35')]);_0x508ff7[_0x5fa4('0x36')]=this[_0x5fa4('0xb')](_['pick'](_0x2c31f8[_0x5fa4('0x30')],_0x254ec8[_0x5fa4('0xb')]),_0x8e50c1);if(_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x37')]){var _0x3b94be=_0x8e50c1;var _0x282257=_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x37')];if(typeof _0x282257===_0x5fa4('0x38')){_0x3b94be=_[_0x5fa4('0x37')](_0x8e50c1,function(_0x724049){return _[_0x5fa4('0x4')](_0x282257['columns'],_0x724049[_0x5fa4('0x15')]);});_0x282257=_0x282257[_0x5fa4('0x39')];}_0x508ff7[_0x5fa4('0x36')]=_[_0x5fa4('0x3a')](_0x508ff7[_0x5fa4('0x36')],{'$or':_['map'](_0x3b94be,function(_0x874059){if(_0x874059[_0x5fa4('0x3b')]!==_0x5fa4('0x3c')){if(_0x51f03d){return sequelize[_0x5fa4('0x36')](sequelize['fn'](_0x5fa4('0x3d'),sequelize[_0x5fa4('0x1c')](_0x874059[_0x5fa4('0x15')])),{'$like':sequelize['fn'](_0x5fa4('0x3d'),'%'+_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x37')]+'%')});}else{var _0x5ce2fa={};_0x5ce2fa[_0x874059[_0x5fa4('0x15')]]={'$like':'%'+_0x2c31f8[_0x5fa4('0x30')][_0x5fa4('0x37')]+'%'};return _0x5ce2fa;}}})});}_0x508ff7=_[_0x5fa4('0x3a')]({},_0x508ff7,_0x2c31f8[_0x5fa4('0x3e')]);return _0x508ff7;};exports[_0x5fa4('0x3f')]=function(_0x619891){var _0x5db853=[];if(_0x619891['includeAll']){_0x5db853[_0x5fa4('0x2e')]({'all':!![]});}else if(_0x619891['include']){if(Array[_0x5fa4('0x17')](_0x619891[_0x5fa4('0x3f')])){_0x5db853=Object[_0x5fa4('0x6')](_0x619891[_0x5fa4('0x3f')])[_0x5fa4('0x1a')](function(_0x259eb8){return parseIncludeModel(_0x619891[_0x5fa4('0x3f')][_0x259eb8]);});}else{var _0x571cd2=parseIncludeModel(_0x619891[_0x5fa4('0x3f')]);_0x5db853[_0x5fa4('0x2e')](_0x571cd2);}}return _0x5db853;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index c231713..91dfa31 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 _0x42c9=['chatStatus','openchannelStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','faxStatus','mailStatus','smsStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','openchannelPause','smsPause','find','globalStatus','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','pauseType','toLowerCase','online','lastPauseAt','address','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x42c9,0x134));var _0x942c=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x42c9[_0x421c56];return _0x49b244;};'use strict';var _=require('lodash');var jayson=require(_0x942c('0x0'));var db=require(_0x942c('0x1'))['db'];var amiClient=jayson[_0x942c('0x2')][_0x942c('0x3')]({'port':0x232a});var routingClient=jayson[_0x942c('0x2')][_0x942c('0x3')]({'port':0x232c});function isAgentPaused(_0x238eb3,_0x1c8244){var _0x3db3fb=[_0x238eb3[_0x942c('0x4')],_0x238eb3['faxPause'],_0x238eb3[_0x942c('0x5')],_0x238eb3['openchannelPause'],_0x238eb3['smsPause'],_0x238eb3[_0x942c('0x6')],_0x238eb3[_0x942c('0x7')]];if(!_0x1c8244)return _[_0x942c('0x8')](_0x3db3fb);var _0x3bebe2=_[_0x942c('0x9')](_0x3db3fb);return _0x3bebe2[_0x942c('0xa')]>0x0&&_0x3bebe2[_0x942c('0xa')]<_0x3db3fb[_0x942c('0xa')]?!![]:![];}function isIdle(_0x3bb966){return _0x3bb966===_0x942c('0xb')||_0x3bb966===_0x942c('0xc')||_0x3bb966==='unavailable'||_0x3bb966===_0x942c('0xd')||_[_0x942c('0xe')](_0x3bb966);}function isAgentIdle(_0x445ca2){if(_0x445ca2[_0x942c('0xf')]!==_0x942c('0xb')&&_0x445ca2[_0x942c('0x6')]){_0x445ca2[_0x942c('0xf')]='pause';return![];}return _[_0x942c('0x8')]([_0x445ca2['chatStatus'],_0x445ca2[_0x942c('0x10')],_0x445ca2[_0x942c('0x11')],_0x445ca2['openchannelStatus'],_0x445ca2[_0x942c('0x12')],_0x445ca2[_0x942c('0xf')],_0x445ca2['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x942c('0x13'),{})[_0x942c('0x14')](function(_0x4782ba){if(_0x4782ba[_0x942c('0x15')]){throw new Error(_0x942c('0x16'));}var _0x3dd56c=_0x4782ba[_0x942c('0x17')];return routingClient['request'](_0x942c('0x13'),{})['then'](function(_0x3001bb){if(_0x3001bb['error']){throw new Error(_0x942c('0x18'));}var _0x223568=_0x3001bb[_0x942c('0x17')];return _[_0x942c('0x19')]({},_0x3dd56c,_0x223568);});})[_0x942c('0x1a')](function(_0x412eeb){throw _0x412eeb;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0xc05ca0){var _0x306906=_0x942c('0xc');if(isAgentPaused(_0xc05ca0))_0x306906=_0x942c('0x1b');else if(isAgentPaused(_0xc05ca0,!![]))_0x306906='*pause';else if(isAgentIdle(_0xc05ca0))_0x306906='idle';else _0x306906=_0x942c('0x1c');return _0x306906;}exports[_0x942c('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x3a0699,_0x49685d){var _0x48187f=_[_0x942c('0x1e')](_0x3a0699)?_0x3a0699:[_0x3a0699];var _0x3af94f=_[_0x942c('0x1f')](_0x49685d)+_0x942c('0x20');var _0x215f37=_[_0x942c('0x21')](_0x48187f,function(_0x4ee63e){return db[_0x3af94f][_0x942c('0x22')]({'where':{'id':_0x4ee63e}})['then'](function(_0x3b182d){if(!_0x3b182d)return[];return _0x3b182d[_0x942c('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x942c('0x24')](_0x215f37)[_0x942c('0x14')](function(_0x40bd53){var _0x16c45e=_(_0x40bd53)[_0x942c('0x25')]()['map']('id')[_0x942c('0x26')]()[_0x942c('0x27')]();return _0x16c45e;});}exports[_0x942c('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5c451f,_0x13b27a,_0x1a07c2){try{if(_0x13b27a[_0x942c('0xa')]>0x0){_0x5c451f=_0x5c451f[_0x942c('0x9')](function(_0x360e7b){return _0x13b27a[_0x942c('0x29')](_0x360e7b['id']);});}var _0x552d76=_0x5c451f[_0x942c('0x9')](function(_0xbff122){var _0x1be596=_0x942c('0x1c');if(isAgentIdle(_0xbff122)){_0x1be596=_0x942c('0xb');}return _0x1be596===_0x1a07c2;});return _['map'](_0x552d76,'id');}catch(_0x141b05){throw _0x141b05;}}exports[_0x942c('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x152919,_0x2fb78f,_0x4b1ae6){return Promise[_0x942c('0x2b')]()['then'](function(){if(_0x2fb78f[_0x942c('0xa')]>0x0){_0x152919=_0x152919[_0x942c('0x9')](function(_0x2b4a69){return _0x2fb78f['includes'](_0x2b4a69['id']);});}return _0x152919;})[_0x942c('0x14')](function(){return db[_0x942c('0x2c')][_0x942c('0x2d')]({'attributes':['id',_0x942c('0x2e'),_0x942c('0x2f'),_0x942c('0x4'),'faxPause',_0x942c('0x5'),_0x942c('0x30'),_0x942c('0x31'),_0x942c('0x6'),'whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x942c('0x21')](_0x152919,'id')}},'raw':!![]});})[_0x942c('0x14')](function(_0x1102f5){return _0x1102f5['map'](function(_0x43e0e3){var _0x5ec4bf=_[_0x942c('0x32')](_0x152919,['id',_0x43e0e3['id']]);var _0x43d247=filterAgentAttributes(_0x5ec4bf);_['merge'](_0x43e0e3,_0x43d247);_0x43e0e3[_0x942c('0x33')]=getAgentStatus(_0x43e0e3);return _0x43e0e3;});})[_0x942c('0x14')](function(_0x1f55b8){var _0x1b9d3c=sortAgentsByStatus(_0x1f55b8,_0x4b1ae6);return _[_0x942c('0x21')](_0x1b9d3c,'id');})[_0x942c('0x1a')](function(_0x9af3e4){throw _0x9af3e4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x178fa9){var _0x2bc6f8={'fields':[],'order':null};var _0x4908c3=_0x178fa9['split'](',');_0x2bc6f8[_0x942c('0x34')]=_[_0x942c('0x9')](_0x4908c3,function(_0x1e4278){if(!_0x1e4278[_0x942c('0x29')](_0x942c('0x33'))){return!![];}_0x2bc6f8[_0x942c('0x35')]=_[_0x942c('0x36')](_0x1e4278,'-')?_0x942c('0x37'):'ASC';return![];});return _0x2bc6f8;}exports[_0x942c('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x360ba6){if(!_0x360ba6){_0x360ba6=_0x942c('0x39');}if(_0x360ba6[_0x942c('0x29')](_0x942c('0x2f'))&&!_0x360ba6[_0x942c('0x29')](_0x942c('0x3a'))){var _0x2dc61b=_0x360ba6[_0x942c('0x3b')](0x0,_0x360ba6[_0x942c('0x3c')](_0x942c('0x2f')));_0x360ba6+=','+_0x2dc61b+'internal';}return _0x360ba6;}exports[_0x942c('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x3de1e2,_0x92d613){var _0x50928d=_0x3de1e2[_0x942c('0x3e')](function(_0x1a3269,_0x5d5b96){if(_0x1a3269[_0x942c('0x33')]===_0x5d5b96['globalStatus']){if(_0x1a3269[_0x942c('0x33')]===_0x942c('0x1b')){if(_0x92d613===_0x942c('0x37')){return(_0x1a3269['pauseType']||'')<(_0x5d5b96[_0x942c('0x3f')]||'')||_0x1a3269[_0x942c('0x2f')][_0x942c('0x40')]()>_0x5d5b96[_0x942c('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1a3269['pauseType']||'')<(_0x5d5b96[_0x942c('0x3f')]||'')||_0x1a3269[_0x942c('0x2f')]['toLowerCase']()>_0x5d5b96[_0x942c('0x2f')][_0x942c('0x40')]()?-0x1:0x1;}}else{if(_0x92d613===_0x942c('0x37')){return _0x1a3269['fullname']['toLowerCase']()<_0x5d5b96[_0x942c('0x2f')][_0x942c('0x40')]()?0x1:-0x1;}else{return _0x1a3269['fullname'][_0x942c('0x40')]()<_0x5d5b96['fullname'][_0x942c('0x40')]()?-0x1:0x1;}}}else{if(_0x92d613===_0x942c('0x37')){return _0x1a3269[_0x942c('0x33')]<_0x5d5b96[_0x942c('0x33')]?0x1:-0x1;}else{return _0x1a3269['globalStatus']<_0x5d5b96[_0x942c('0x33')]?-0x1:0x1;}}});return _0x50928d;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x12de73){var _0x59937e=['userpic',_0x942c('0x41'),'lastLoginAt',_0x942c('0x42'),_0x942c('0x3f'),'lastPauseAt',_0x942c('0x3a'),_0x942c('0x43'),_0x942c('0x4'),'openchannelPause',_0x942c('0x5'),_0x942c('0x31'),_0x942c('0x7'),_0x942c('0x44'),'voicePause',_0x942c('0x45'),_0x942c('0x46'),_0x942c('0x47'),_0x942c('0x48'),'whatsappCapacity',_0x942c('0x49'),_0x942c('0x4a'),_0x942c('0x4b'),_0x942c('0x4c'),_0x942c('0x4d'),_0x942c('0x4e'),_0x942c('0x4f'),_0x942c('0x50'),_0x942c('0x51'),_0x942c('0x11'),_0x942c('0x12'),_0x942c('0x52'),_0x942c('0x10'),_0x942c('0xf'),_0x942c('0x53'),_0x942c('0x54'),_0x942c('0x55'),_0x942c('0x56'),_0x942c('0x57'),_0x942c('0x58'),_0x942c('0x59'),_0x942c('0x5a'),_0x942c('0x5b'),_0x942c('0x5c'),_0x942c('0x5d'),_0x942c('0x5e'),_0x942c('0x5f')];var _0x2571b1=[_0x942c('0x4'),_0x942c('0x30'),'mailPause',_0x942c('0x31'),'whatsappPause',_0x942c('0x44'),_0x942c('0x6'),_0x942c('0x41')];var _0x17bea4=_(_0x12de73)['omit'](_0x2571b1)[_0x942c('0x60')](_0x59937e)['value']();return _0x17bea4;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x0ed5=['online','lastLoginAt','lastPauseAt','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','smsStatus','voiceStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','filter','length','unknown','unavailable','idle','voicePause','every','chatStatus','faxStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','busy','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','pauseType','catch','getSortedAgentsIdsByStatus','split','globalStatus','order','startsWith','DESC','ASC','fullname,internal','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ed5,0x1f2));var _0x50ed=function(_0x355e50,_0x50535f){_0x355e50=_0x355e50-0x0;var _0x4f04fd=_0x0ed5[_0x355e50];return _0x4f04fd;};'use strict';var _=require('lodash');var jayson=require(_0x50ed('0x0'));var db=require(_0x50ed('0x1'))['db'];var amiClient=jayson[_0x50ed('0x2')][_0x50ed('0x3')]({'port':0x232a});var routingClient=jayson[_0x50ed('0x2')][_0x50ed('0x3')]({'port':0x232c});function isAgentPaused(_0x2e47a3,_0x342a5d){var _0x375ac8=[_0x2e47a3['chatPause'],_0x2e47a3[_0x50ed('0x4')],_0x2e47a3[_0x50ed('0x5')],_0x2e47a3[_0x50ed('0x6')],_0x2e47a3[_0x50ed('0x7')],_0x2e47a3['voicePause'],_0x2e47a3[_0x50ed('0x8')]];if(!_0x342a5d)return _['every'](_0x375ac8);var _0x29affb=_[_0x50ed('0x9')](_0x375ac8);return _0x29affb[_0x50ed('0xa')]>0x0&&_0x29affb['length']<_0x375ac8[_0x50ed('0xa')]?!![]:![];}function isIdle(_0x3b44c0){return _0x3b44c0==='idle'||_0x3b44c0===_0x50ed('0xb')||_0x3b44c0===_0x50ed('0xc')||_0x3b44c0==='ringing'||_['isNil'](_0x3b44c0);}function isAgentIdle(_0x16625b){if(_0x16625b['voiceStatus']!==_0x50ed('0xd')&&_0x16625b[_0x50ed('0xe')]){_0x16625b['voiceStatus']='pause';return![];}return _[_0x50ed('0xf')]([_0x16625b[_0x50ed('0x10')],_0x16625b[_0x50ed('0x11')],_0x16625b['mailStatus'],_0x16625b['openchannelStatus'],_0x16625b['smsStatus'],_0x16625b['voiceStatus'],_0x16625b[_0x50ed('0x12')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x50ed('0x13')](_0x50ed('0x14'),{})[_0x50ed('0x15')](function(_0x34c9c8){if(_0x34c9c8[_0x50ed('0x16')]){throw new Error(_0x50ed('0x17'));}var _0x38a208=_0x34c9c8[_0x50ed('0x18')];return routingClient[_0x50ed('0x13')](_0x50ed('0x14'),{})[_0x50ed('0x15')](function(_0xe3e012){if(_0xe3e012[_0x50ed('0x16')]){throw new Error(_0x50ed('0x19'));}var _0x107747=_0xe3e012[_0x50ed('0x18')];return _['merge']({},_0x38a208,_0x107747);});})['catch'](function(_0x43f5d5){throw _0x43f5d5;});}exports[_0x50ed('0x1a')]=getRealtimeAgents;function getAgentStatus(_0x3339c2){var _0x3b0588=_0x50ed('0xb');if(isAgentPaused(_0x3339c2))_0x3b0588=_0x50ed('0x1b');else if(isAgentPaused(_0x3339c2,!![]))_0x3b0588=_0x50ed('0x1c');else if(isAgentIdle(_0x3339c2))_0x3b0588=_0x50ed('0xd');else _0x3b0588='busy';return _0x3b0588;}exports[_0x50ed('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x2cf910,_0x58753f){var _0x332c61=_[_0x50ed('0x1e')](_0x2cf910)?_0x2cf910:[_0x2cf910];var _0x4249bb=_[_0x50ed('0x1f')](_0x58753f)+_0x50ed('0x20');var _0x3aed2f=_[_0x50ed('0x21')](_0x332c61,function(_0x1db15a){return db[_0x4249bb]['findOne']({'where':{'id':_0x1db15a}})[_0x50ed('0x15')](function(_0x105272){if(!_0x105272)return[];return _0x105272[_0x50ed('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x50ed('0x23')](_0x3aed2f)['then'](function(_0x23501f){var _0x973c8b=_(_0x23501f)[_0x50ed('0x24')]()[_0x50ed('0x21')]('id')[_0x50ed('0x25')]()[_0x50ed('0x26')]();return _0x973c8b;});}exports[_0x50ed('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4593b0,_0x5b9019,_0x3e2c1f){try{if(_0x5b9019[_0x50ed('0xa')]>0x0){_0x4593b0=_0x4593b0[_0x50ed('0x9')](function(_0x124183){return _0x5b9019[_0x50ed('0x28')](_0x124183['id']);});}var _0x34cc8=_0x4593b0[_0x50ed('0x9')](function(_0x5e5244){var _0x32b145=_0x50ed('0x29');if(isAgentIdle(_0x5e5244)){_0x32b145=_0x50ed('0xd');}return _0x32b145===_0x3e2c1f;});return _[_0x50ed('0x21')](_0x34cc8,'id');}catch(_0xf0943){throw _0xf0943;}}exports[_0x50ed('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x139b71,_0x58f91f,_0x53f2bb){return Promise[_0x50ed('0x2b')]()['then'](function(){if(_0x58f91f[_0x50ed('0xa')]>0x0){_0x139b71=_0x139b71[_0x50ed('0x9')](function(_0x277f90){return _0x58f91f['includes'](_0x277f90['id']);});}return _0x139b71;})[_0x50ed('0x15')](function(){return db[_0x50ed('0x2c')][_0x50ed('0x2d')]({'attributes':['id','name',_0x50ed('0x2e'),_0x50ed('0x2f'),_0x50ed('0x4'),_0x50ed('0x5'),_0x50ed('0x6'),_0x50ed('0x7'),_0x50ed('0xe'),_0x50ed('0x8'),_0x50ed('0x30')],'where':{'id':{'$in':_[_0x50ed('0x21')](_0x139b71,'id')}},'raw':!![]});})[_0x50ed('0x15')](function(_0x4746a6){return _0x4746a6['map'](function(_0x5e0c15){var _0x28c40f=_['find'](_0x139b71,['id',_0x5e0c15['id']]);var _0x263f80=filterAgentAttributes(_0x28c40f);_['merge'](_0x5e0c15,_0x263f80);_0x5e0c15['globalStatus']=getAgentStatus(_0x5e0c15);return _0x5e0c15;});})[_0x50ed('0x15')](function(_0x41b73c){var _0x59b342=sortAgentsByStatus(_0x41b73c,_0x53f2bb);return _[_0x50ed('0x21')](_0x59b342,'id');})[_0x50ed('0x31')](function(_0x3cfb10){throw _0x3cfb10;});}exports[_0x50ed('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x204e4d){var _0x5a0ca2={'fields':[],'order':null};var _0xbd9c5b=_0x204e4d[_0x50ed('0x33')](',');_0x5a0ca2['fields']=_['filter'](_0xbd9c5b,function(_0x2b394e){if(!_0x2b394e[_0x50ed('0x28')](_0x50ed('0x34'))){return!![];}_0x5a0ca2[_0x50ed('0x35')]=_[_0x50ed('0x36')](_0x2b394e,'-')?_0x50ed('0x37'):_0x50ed('0x38');return![];});return _0x5a0ca2;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x285803){if(!_0x285803){_0x285803=_0x50ed('0x39');}if(_0x285803['includes'](_0x50ed('0x2e'))&&!_0x285803[_0x50ed('0x28')]('internal')){var _0x25a12d=_0x285803[_0x50ed('0x3a')](0x0,_0x285803[_0x50ed('0x3b')](_0x50ed('0x2e')));_0x285803+=','+_0x25a12d+_0x50ed('0x3c');}return _0x285803;}exports[_0x50ed('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x469501,_0x2c2a0e){var _0x378094=_0x469501[_0x50ed('0x3e')](function(_0x252ef4,_0x160318){if(_0x252ef4[_0x50ed('0x34')]===_0x160318[_0x50ed('0x34')]){if(_0x252ef4[_0x50ed('0x34')]==='pause'){if(_0x2c2a0e===_0x50ed('0x37')){return(_0x252ef4[_0x50ed('0x30')]||'')<(_0x160318[_0x50ed('0x30')]||'')||_0x252ef4[_0x50ed('0x2e')][_0x50ed('0x3f')]()>_0x160318[_0x50ed('0x2e')][_0x50ed('0x3f')]()?0x1:-0x1;}else{return(_0x252ef4[_0x50ed('0x30')]||'')<(_0x160318[_0x50ed('0x30')]||'')||_0x252ef4['fullname'][_0x50ed('0x3f')]()>_0x160318[_0x50ed('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x2c2a0e===_0x50ed('0x37')){return _0x252ef4['fullname'][_0x50ed('0x3f')]()<_0x160318[_0x50ed('0x2e')][_0x50ed('0x3f')]()?0x1:-0x1;}else{return _0x252ef4['fullname'][_0x50ed('0x3f')]()<_0x160318['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2c2a0e===_0x50ed('0x37')){return _0x252ef4[_0x50ed('0x34')]<_0x160318['globalStatus']?0x1:-0x1;}else{return _0x252ef4[_0x50ed('0x34')]<_0x160318['globalStatus']?-0x1:0x1;}}});return _0x378094;}exports[_0x50ed('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x14b74c){var _0x39961=[_0x50ed('0x41'),_0x50ed('0x42'),_0x50ed('0x43'),_0x50ed('0x44'),_0x50ed('0x30'),'lastPauseAt','internal','address',_0x50ed('0x2f'),'openchannelPause',_0x50ed('0x5'),'smsPause',_0x50ed('0x8'),_0x50ed('0x4'),_0x50ed('0xe'),_0x50ed('0x45'),'openchannelCapacity',_0x50ed('0x46'),_0x50ed('0x47'),_0x50ed('0x48'),_0x50ed('0x49'),_0x50ed('0x4a'),_0x50ed('0x4b'),_0x50ed('0x4c'),_0x50ed('0x4d'),'whatsappCurrentCapacity',_0x50ed('0x4e'),_0x50ed('0x10'),_0x50ed('0x4f'),_0x50ed('0x50'),_0x50ed('0x51'),_0x50ed('0x12'),'faxStatus',_0x50ed('0x52'),_0x50ed('0x53'),'openchannelStatusTime',_0x50ed('0x54'),_0x50ed('0x55'),_0x50ed('0x56'),_0x50ed('0x57'),'voiceStatusTime','queue',_0x50ed('0x58'),'screenrecording',_0x50ed('0x59'),_0x50ed('0x5a'),_0x50ed('0x5b')];var _0x1c2594=[_0x50ed('0x2f'),'openchannelPause',_0x50ed('0x5'),_0x50ed('0x7'),_0x50ed('0x8'),'faxPause','voicePause','online'];var _0x53f187=_(_0x14b74c)[_0x50ed('0x5c')](_0x1c2594)[_0x50ed('0x5d')](_0x39961)[_0x50ed('0x26')]();return _0x53f187;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 8a43a4f..42944fb 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0d5=['util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveIntervalMaxThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','format','result','getRealtimeQueues','concat','outbound','get','loggedIn','find','initializeQueues','lodash','jayson/promise'];(function(_0x35806d,_0x5889aa){var _0x23625d=function(_0xd07dbb){while(--_0xd07dbb){_0x35806d['push'](_0x35806d['shift']());}};_0x23625d(++_0x5889aa);}(_0xc0d5,0x1e2));var _0x5c0d=function(_0x314903,_0xcec7a5){_0x314903=_0x314903-0x0;var _0x2991c3=_0xc0d5[_0x314903];return _0x2991c3;};'use strict';var _=require(_0x5c0d('0x0'));var jayson=require(_0x5c0d('0x1'));var util=require(_0x5c0d('0x2'));var amiClient=jayson[_0x5c0d('0x3')][_0x5c0d('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x5c0d('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x5c0d('0x5'),'loggedIn',_0x5c0d('0x6'),_0x5c0d('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x5c0d('0x8'),_0x5c0d('0x9'),_0x5c0d('0xa'),_0x5c0d('0xb'),'notInUse',_0x5c0d('0xc'),_0x5c0d('0xd'),_0x5c0d('0xe'),'talking',_0x5c0d('0xf'),_0x5c0d('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x5c0d('0x11'),_0x5c0d('0x12'),_0x5c0d('0x13'),_0x5c0d('0x14'),'dialActive','dialMethod',_0x5c0d('0x15'),_0x5c0d('0x16'),_0x5c0d('0x17'),_0x5c0d('0x18'),_0x5c0d('0x19'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval',_0x5c0d('0x1a'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x5c0d('0x1b'),_0x5c0d('0x1c'),_0x5c0d('0x1d'),_0x5c0d('0x1e'),_0x5c0d('0x1f')];function getRealtimeQueues(_0x406c80,_0x37d8e7){var _0x33bd68=_0x37d8e7===_0x5c0d('0x20')?amiClient:routingClient;return _0x33bd68[_0x5c0d('0x21')](_['startCase'](_0x37d8e7)+_0x5c0d('0x22'),_0x406c80)['then'](function(_0x49178a){if(_0x49178a['error'])throw new Error(util[_0x5c0d('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x37d8e7));return _0x49178a[_0x5c0d('0x24')];})['catch'](function(_0x423e48){throw _0x423e48;});}exports[_0x5c0d('0x25')]=getRealtimeQueues;function initializeQueues(_0x1bc4e2,_0x264ba6,_0x582cd3,_0x3d1465){var _0x33810b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x582cd3===_0x5c0d('0x20')){if(_0x3d1465==='inbound'){_0x33810b=_0x33810b[_0x5c0d('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3d1465===_0x5c0d('0x27')){_0x33810b=_0x33810b[_0x5c0d('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1bc4e2['map'](function(_0x3c02df){var _0x578c72=_0x3c02df[_0x5c0d('0x28')]({'plain':!![]});_0x578c72[_0x5c0d('0x6')]=0x0;_0x578c72[_0x5c0d('0xb')]=0x0;_0x578c72[_0x5c0d('0x29')]=0x0;_0x578c72[_0x5c0d('0x5')]=0x0;_0x578c72[_0x5c0d('0x7')]=0x0;if(_0x582cd3===_0x5c0d('0x20')){_0x578c72['talking']=0x0;_0x578c72[_0x5c0d('0x8')]=0x0;if(_0x3d1465===_0x5c0d('0x27')){_0x578c72[_0x5c0d('0x11')]=0x0;_0x578c72[_0x5c0d('0x12')]=0x0;}}var _0xac18dc=_[_0x5c0d('0x2a')](_0x264ba6,['id',_0x578c72['id']]);if(_0xac18dc){_['merge'](_0x578c72,_['pick'](_0xac18dc,_0x33810b));}return _0x578c72;});}exports[_0x5c0d('0x2b')]=initializeQueues; \ No newline at end of file +var _0xa4c8=['startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','outbound','map','get','loggedInDb','pTalking','find','merge','pick','lodash','jayson/promise','http','client','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0xa4c8,0x17e));var _0x8a4c=function(_0x53815c,_0x3fa23b){_0x53815c=_0x53815c-0x0;var _0x3e45db=_0xa4c8[_0x53815c];return _0x3e45db;};'use strict';var _=require(_0x8a4c('0x0'));var jayson=require(_0x8a4c('0x1'));var util=require('util');var amiClient=jayson['client'][_0x8a4c('0x2')]({'port':0x232a});var routingClient=jayson[_0x8a4c('0x3')][_0x8a4c('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8a4c('0x4'),_0x8a4c('0x5'),_0x8a4c('0x6'),_0x8a4c('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8a4c('0x8'),_0x8a4c('0x9'),_0x8a4c('0xa'),'loggedInDb',_0x8a4c('0xb'),_0x8a4c('0xc'),_0x8a4c('0xd'),_0x8a4c('0xe'),_0x8a4c('0xf'),_0x8a4c('0x10'),_0x8a4c('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x8a4c('0x12'),_0x8a4c('0x13'),'statusMessage',_0x8a4c('0x14'),_0x8a4c('0x15'),'Trunk',_0x8a4c('0x16'),_0x8a4c('0x17'),_0x8a4c('0x18'),_0x8a4c('0x19'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval',_0x8a4c('0x1a'),'dialPredictiveIntervalMinThreshold',_0x8a4c('0x1b'),_0x8a4c('0x1c'),_0x8a4c('0x1d'),_0x8a4c('0x1e'),_0x8a4c('0x1f'),_0x8a4c('0x20'),_0x8a4c('0x21')];function getRealtimeQueues(_0x522958,_0x17d1f6){var _0x1ff1a2=_0x17d1f6==='voice'?amiClient:routingClient;return _0x1ff1a2['request'](_[_0x8a4c('0x22')](_0x17d1f6)+_0x8a4c('0x23'),_0x522958)[_0x8a4c('0x24')](function(_0x16e25d){if(_0x16e25d['error'])throw new Error(util['format'](_0x8a4c('0x25'),_0x17d1f6));return _0x16e25d[_0x8a4c('0x26')];})[_0x8a4c('0x27')](function(_0x3595b9){throw _0x3595b9;});}exports[_0x8a4c('0x28')]=getRealtimeQueues;function initializeQueues(_0x44993b,_0x4e7aa2,_0x381aae,_0x51db99){var _0x41abf3=DEFAULT_QUEUE_ATTRIBUTES;if(_0x381aae===_0x8a4c('0x29')){if(_0x51db99===_0x8a4c('0x2a')){_0x41abf3=_0x41abf3[_0x8a4c('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x51db99===_0x8a4c('0x2c')){_0x41abf3=_0x41abf3['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x44993b[_0x8a4c('0x2d')](function(_0x8c6dcd){var _0x1a1492=_0x8c6dcd[_0x8a4c('0x2e')]({'plain':!![]});_0x1a1492[_0x8a4c('0x6')]=0x0;_0x1a1492[_0x8a4c('0x2f')]=0x0;_0x1a1492[_0x8a4c('0x5')]=0x0;_0x1a1492[_0x8a4c('0x4')]=0x0;_0x1a1492[_0x8a4c('0x7')]=0x0;if(_0x381aae==='voice'){_0x1a1492[_0x8a4c('0xf')]=0x0;_0x1a1492[_0x8a4c('0x8')]=0x0;if(_0x51db99==='outbound'){_0x1a1492[_0x8a4c('0x30')]=0x0;_0x1a1492[_0x8a4c('0x12')]=0x0;}}var _0x40951d=_[_0x8a4c('0x31')](_0x4e7aa2,['id',_0x1a1492['id']]);if(_0x40951d){_[_0x8a4c('0x32')](_0x1a1492,_[_0x8a4c('0x33')](_0x40951d,_0x41abf3));}return _0x1a1492;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ad461d8..217de17 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(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x4f1713,_0x4abfb7){var _0x4726f6=function(_0x357997){while(--_0x357997){_0x4f1713['push'](_0x4f1713['shift']());}};_0x4726f6(++_0x4abfb7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 b1fc417..8c47e64 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 _0x22be=['crypto','bimedia-machine-uuid','child_process','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','update','substring','lodash'];(function(_0x13c3c3,_0x3c741e){var _0x301a43=function(_0xbab2aa){while(--_0xbab2aa){_0x13c3c3['push'](_0x13c3c3['shift']());}};_0x301a43(++_0x3c741e);}(_0x22be,0xb3));var _0xe22b=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x22be[_0x13f980];return _0x27153c;};'use strict';var _=require(_0xe22b('0x0'));var os=require('os');var crypto=require(_0xe22b('0x1'));var machine=require(_0xe22b('0x2'));var exec=require(_0xe22b('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x55806a=[];var _0x5a81c2=os['networkInterfaces']();var _0x47a03a=_[_0xe22b('0x4')](_[_0xe22b('0x5')](_0x5a81c2));for(var _0x5265c2=0x0;_0x5265c2<_0x47a03a[_0xe22b('0x6')];_0x5265c2++){var _0x18009a=_0x5a81c2[_0x47a03a[_0x5265c2]][_0xe22b('0x7')](function(_0x5b948a){return _0x5b948a[_0xe22b('0x8')]===_0xe22b('0x9')&&_0x5b948a[_0xe22b('0xa')]===![];});_0x55806a=_0x55806a[_0xe22b('0xb')](_0x18009a);}return _0x55806a;}function getFirstInterface(){var _0x475a93=_['head'](getInterfaces());return{'macAddress':_0x475a93&&_0x475a93[_0xe22b('0xc')]?_0x475a93['mac']:_0xe22b('0xd'),'ipAddress':_0x475a93&&_0x475a93[_0xe22b('0xe')]?_0x475a93[_0xe22b('0xe')]:_0xe22b('0xf')};}exports[_0xe22b('0x10')]=getFirstInterface;function getCPUhash(){var _0xc79990=_[_0xe22b('0x4')](os[_0xe22b('0x11')]()[_0xe22b('0x12')](function(_0x534aca){return _0x534aca[_0xe22b('0x13')];}))[_0xe22b('0x14')](':');return crypto[_0xe22b('0x15')](_0xe22b('0x16'))['update'](_0xc79990)[_0xe22b('0x17')](_0xe22b('0x18'));}exports[_0xe22b('0x19')]=function(){var _0x8c8e9d=os[_0xe22b('0x1a')]();var _0x1f4d90=/[0-9a-f-]{36}/;if(config[_0xe22b('0x1b')]&&_0x1f4d90[_0xe22b('0x1c')](config[_0xe22b('0x1b')])){return config['licenseToken'];}else if(_0x8c8e9d===_0xe22b('0x1d')){return exec(_0xe22b('0x1e'),{'encoding':_0xe22b('0x1f')})['replace']('\x0d\x0a','');}else{var _0x360822=getFirstInterface();var _0x4bbe89=getCPUhash();var _0x4543a9=_0x4bbe89+'|'+os['hostname']()+'|'+_0x360822[_0xe22b('0x20')]+'|'+_0x360822[_0xe22b('0x21')];var _0x34ae63=crypto[_0xe22b('0x15')]('md5')[_0xe22b('0x22')](_0x4543a9)[_0xe22b('0x17')](_0xe22b('0x18'));return _0x34ae63['substring'](0x0,0x8)+'-'+_0x34ae63[_0xe22b('0x23')](0x8,0xc)+'-'+_0x34ae63[_0xe22b('0x23')](0xc,0x10)+'-'+_0x34ae63[_0xe22b('0x23')](0x10,0x14)+'-'+_0x34ae63['substring'](0x14);}}; \ No newline at end of file +var _0xe21e=['IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter'];(function(_0x14f91f,_0x28a7b7){var _0xc49c1a=function(_0x172c91){while(--_0x172c91){_0x14f91f['push'](_0x14f91f['shift']());}};_0xc49c1a(++_0x28a7b7);}(_0xe21e,0x190));var _0xee21=function(_0x42ffb1,_0x292a43){_0x42ffb1=_0x42ffb1-0x0;var _0xad63ab=_0xe21e[_0x42ffb1];return _0xad63ab;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xee21('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xee21('0x1'))[_0xee21('0x2')];var config=require(_0xee21('0x3'));function getInterfaces(){var _0xf8cb0b=[];var _0x26163d=os[_0xee21('0x4')]();var _0x299671=_[_0xee21('0x5')](_[_0xee21('0x6')](_0x26163d));for(var _0xca9b5f=0x0;_0xca9b5f<_0x299671['length'];_0xca9b5f++){var _0x20e1ce=_0x26163d[_0x299671[_0xca9b5f]][_0xee21('0x7')](function(_0x41fe24){return _0x41fe24['family']===_0xee21('0x8')&&_0x41fe24[_0xee21('0x9')]===![];});_0xf8cb0b=_0xf8cb0b[_0xee21('0xa')](_0x20e1ce);}return _0xf8cb0b;}function getFirstInterface(){var _0x6e6470=_['head'](getInterfaces());return{'macAddress':_0x6e6470&&_0x6e6470['mac']?_0x6e6470[_0xee21('0xb')]:_0xee21('0xc'),'ipAddress':_0x6e6470&&_0x6e6470['address']?_0x6e6470[_0xee21('0xd')]:_0xee21('0xe')};}exports[_0xee21('0xf')]=getFirstInterface;function getCPUhash(){var _0x2f6fca=_['orderBy'](os[_0xee21('0x10')]()[_0xee21('0x11')](function(_0x11a77b){return _0x11a77b[_0xee21('0x12')];}))[_0xee21('0x13')](':');return crypto[_0xee21('0x14')](_0xee21('0x15'))[_0xee21('0x16')](_0x2f6fca)[_0xee21('0x17')](_0xee21('0x18'));}exports['getUuid']=function(){var _0x32e12a=os[_0xee21('0x19')]();var _0x39375f=/[0-9a-f-]{36}/;if(config[_0xee21('0x1a')]&&_0x39375f[_0xee21('0x1b')](config[_0xee21('0x1a')])){return config[_0xee21('0x1a')];}else if(_0x32e12a===_0xee21('0x1c')){return exec(_0xee21('0x1d'),{'encoding':_0xee21('0x1e')})['replace']('\x0d\x0a','');}else{var _0x4ba4d9=getFirstInterface();var _0x2ccd07=getCPUhash();var _0x4e6e87=_0x2ccd07+'|'+os['hostname']()+'|'+_0x4ba4d9[_0xee21('0x1f')]+'|'+_0x4ba4d9[_0xee21('0x20')];var _0x132ed6=crypto[_0xee21('0x14')]('md5')[_0xee21('0x16')](_0x4e6e87)[_0xee21('0x17')](_0xee21('0x18'));return _0x132ed6[_0xee21('0x21')](0x0,0x8)+'-'+_0x132ed6[_0xee21('0x21')](0x8,0xc)+'-'+_0x132ed6[_0xee21('0x21')](0xc,0x10)+'-'+_0x132ed6['substring'](0x10,0x14)+'-'+_0x132ed6[_0xee21('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4e42c2f..fbc1100 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 _0x9e93=['license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','bluebird','pkginfo','version','../logger'];(function(_0x267caa,_0x36ef2f){var _0x3900e4=function(_0x36d202){while(--_0x36d202){_0x267caa['push'](_0x267caa['shift']());}};_0x3900e4(++_0x36ef2f);}(_0x9e93,0x1f3));var _0x39e9=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x9e93[_0x145b3c];return _0x1b6e36;};'use strict';var util=require('util');var moment=require(_0x39e9('0x0'));var rp=require('request-promise');var BPromise=require(_0x39e9('0x1'));var pkginfo=require(_0x39e9('0x2'))(module,_0x39e9('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x39e9('0x4'))(_0x39e9('0x5'));var HOST=_0x39e9('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc51565){return new BPromise(function(_0x29ea14,_0xbe87b8){var _0x4b46ee=util['format'](_0x39e9('0x7'),HOST,_0xc51565,module[_0x39e9('0x8')][_0x39e9('0x3')]);if(oldToken){_0x4b46ee=util['format'](_0x39e9('0x9'),HOST,_0xc51565,module['exports'][_0x39e9('0x3')],oldToken);}var _0x1ffcc3={'uri':_0x4b46ee,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1ffcc3)[_0x39e9('0xa')](function(_0x41060d){_0x29ea14(_0x41060d);})[_0x39e9('0xb')](function(_0x45f221){_0xbe87b8(_0x45f221);});});}function manageLicense(_0x9b8d30,_0xf3a1dd){var _0x460824=_0xf3a1dd['get']({'plain':!![]});if(!isOldTokenSent&&_0x460824[_0x39e9('0xc')]!==_0x9b8d30&&!_0x460824[_0x39e9('0xd')]){oldToken=_0x460824[_0x39e9('0xc')];}httpRequest(_0x9b8d30)[_0x39e9('0xa')](function(_0x34fd8d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x34fd8d[_0x39e9('0xe')]){isOldTokenSent=![];if(!_0x460824['license']&&_0x460824[_0x39e9('0x5')]!=_0x34fd8d['license']||_0x460824[_0x39e9('0x5')]&&_0x460824[_0x39e9('0xd')]){logger[_0x39e9('0xf')](_0x39e9('0x10'));}if(_0x460824[_0x39e9('0x5')]&&!_0x460824[_0x39e9('0xd')]&&_0x460824['license']!=_0x34fd8d[_0x39e9('0x5')]){logger[_0x39e9('0xf')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x460824[_0x39e9('0x5')]&&!_0x460824['data2']&&_0x460824[_0x39e9('0x5')]==_0x34fd8d['license']){return _0xf3a1dd;}return _0xf3a1dd[_0x39e9('0x11')]({'data1':_0x9b8d30,'data2':null,'license':_0x34fd8d['license']});}else{if(_0x34fd8d[_0x39e9('0x5')]||_0x460824[_0x39e9('0x5')]){if(!_0x460824['data2']){if(_0x460824[_0x39e9('0xc')]==_0x9b8d30){GRAY_PERIOD_REASON=_0x39e9('0x12');logger[_0x39e9('0xf')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x39e9('0x13');logger[_0x39e9('0xf')](_0x39e9('0x14'),_0x460824['data1'],_0x9b8d30);}logger[_0x39e9('0xf')](_0x39e9('0x15'),GRAY_PERIOD_REASON[_0x39e9('0x16')](),moment()[_0x39e9('0x17')](_0x39e9('0x18')));return _0xf3a1dd[_0x39e9('0x11')]({'data2':encryptor[_0x39e9('0x19')](moment()[_0x39e9('0x17')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x39e9('0x1a')](encryptor[_0x39e9('0x1b')](_0x460824[_0x39e9('0xd')]),_0x39e9('0x1c'))>DAYS){logger[_0x39e9('0xf')](_0x39e9('0x1d'),moment()[_0x39e9('0x17')](_0x39e9('0x18')));isOldTokenSent=![];return _0xf3a1dd[_0x39e9('0x11')]({'data1':_0x9b8d30,'data2':null,'license':null});}}}else{if(_0x460824['data1']!=_0x9b8d30){logger[_0x39e9('0xf')](_0x39e9('0x14'),_0x460824[_0x39e9('0xc')],_0x9b8d30);return _0xf3a1dd['update']({'data1':_0x9b8d30,'data2':null,'license':null});}}}return _0xf3a1dd;})[_0x39e9('0xa')](function(_0x1fa785){_0xf3a1dd=_0x1fa785;})[_0x39e9('0xb')](function(_0x29045a){logger['error'](_0x29045a[_0x39e9('0x1e')]);})[_0x39e9('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x39e9('0x20')](),_0xf3a1dd);},TIME);});}function defaultLicense(){var _0x3a5f02=hardware[_0x39e9('0x20')]();if(_0x3a5f02){return db[_0x39e9('0x21')][_0x39e9('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x3a5f02}})['spread'](function(_0x29a116,_0xeb9d29){logger[_0x39e9('0xf')](_0x39e9('0x23'),_0x3a5f02);manageLicense(_0x3a5f02,_0x29a116);})['catch'](function(_0xf38b55){logger['error'](_0xf38b55[_0x39e9('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc15c=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','get','data1','data2','active','info'];(function(_0x352e59,_0x2cf9ca){var _0x22ba56=function(_0x9ef78d){while(--_0x9ef78d){_0x352e59['push'](_0x352e59['shift']());}};_0x22ba56(++_0x2cf9ca);}(_0xc15c,0xd0));var _0xcc15=function(_0x3e73da,_0x3f20fe){_0x3e73da=_0x3e73da-0x0;var _0x27e40d=_0xc15c[_0x3e73da];return _0x27e40d;};'use strict';var util=require(_0xcc15('0x0'));var moment=require(_0xcc15('0x1'));var rp=require(_0xcc15('0x2'));var BPromise=require(_0xcc15('0x3'));var pkginfo=require(_0xcc15('0x4'))(module,_0xcc15('0x5'));var db=require(_0xcc15('0x6'))['db'];var encryptor=require(_0xcc15('0x7'));var hardware=require(_0xcc15('0x8'));var logger=require('../logger')(_0xcc15('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x42620d){return new BPromise(function(_0x4d8fc0,_0x48378f){var _0x2ab7a5=util[_0xcc15('0xa')](_0xcc15('0xb'),HOST,_0x42620d,module[_0xcc15('0xc')]['version']);if(oldToken){_0x2ab7a5=util[_0xcc15('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x42620d,module[_0xcc15('0xc')][_0xcc15('0x5')],oldToken);}var _0x550b40={'uri':_0x2ab7a5,'method':_0xcc15('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x550b40)[_0xcc15('0xe')](function(_0x35f657){_0x4d8fc0(_0x35f657);})['catch'](function(_0xce381c){_0x48378f(_0xce381c);});});}function manageLicense(_0x1e3e2a,_0x52c8f1){var _0x557a0b=_0x52c8f1[_0xcc15('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x557a0b[_0xcc15('0x10')]!==_0x1e3e2a&&!_0x557a0b[_0xcc15('0x11')]){oldToken=_0x557a0b[_0xcc15('0x10')];}httpRequest(_0x1e3e2a)[_0xcc15('0xe')](function(_0x3d543c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3d543c[_0xcc15('0x12')]){isOldTokenSent=![];if(!_0x557a0b['license']&&_0x557a0b[_0xcc15('0x9')]!=_0x3d543c['license']||_0x557a0b[_0xcc15('0x9')]&&_0x557a0b[_0xcc15('0x11')]){logger[_0xcc15('0x13')](_0xcc15('0x14'));}if(_0x557a0b[_0xcc15('0x9')]&&!_0x557a0b['data2']&&_0x557a0b[_0xcc15('0x9')]!=_0x3d543c[_0xcc15('0x9')]){logger[_0xcc15('0x13')](_0xcc15('0x15'));}if(_0x557a0b[_0xcc15('0x9')]&&!_0x557a0b[_0xcc15('0x11')]&&_0x557a0b['license']==_0x3d543c[_0xcc15('0x9')]){return _0x52c8f1;}return _0x52c8f1[_0xcc15('0x16')]({'data1':_0x1e3e2a,'data2':null,'license':_0x3d543c[_0xcc15('0x9')]});}else{if(_0x3d543c['license']||_0x557a0b[_0xcc15('0x9')]){if(!_0x557a0b[_0xcc15('0x11')]){if(_0x557a0b['data1']==_0x1e3e2a){GRAY_PERIOD_REASON=_0xcc15('0x17');logger[_0xcc15('0x13')](_0xcc15('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x557a0b[_0xcc15('0x10')],_0x1e3e2a);}logger[_0xcc15('0x13')](_0xcc15('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xcc15('0xa')](_0xcc15('0x1a')));return _0x52c8f1[_0xcc15('0x16')]({'data2':encryptor[_0xcc15('0x1b')](moment()[_0xcc15('0xa')](_0xcc15('0x1a')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x557a0b[_0xcc15('0x11')]),_0xcc15('0x1c'))>DAYS){logger[_0xcc15('0x13')](_0xcc15('0x1d'),moment()[_0xcc15('0xa')](_0xcc15('0x1a')));isOldTokenSent=![];return _0x52c8f1[_0xcc15('0x16')]({'data1':_0x1e3e2a,'data2':null,'license':null});}}}else{if(_0x557a0b[_0xcc15('0x10')]!=_0x1e3e2a){logger[_0xcc15('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x557a0b[_0xcc15('0x10')],_0x1e3e2a);return _0x52c8f1[_0xcc15('0x16')]({'data1':_0x1e3e2a,'data2':null,'license':null});}}}return _0x52c8f1;})[_0xcc15('0xe')](function(_0x37cc69){_0x52c8f1=_0x37cc69;})[_0xcc15('0x1e')](function(_0x5c7577){logger[_0xcc15('0x1f')](_0x5c7577['message']);})[_0xcc15('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xcc15('0x21')](),_0x52c8f1);},TIME);});}function defaultLicense(){var _0x3f7122=hardware[_0xcc15('0x21')]();if(_0x3f7122){return db['License'][_0xcc15('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x3f7122}})['spread'](function(_0x3b23b5,_0x797b9c){logger[_0xcc15('0x13')](_0xcc15('0x23'),_0x3f7122);manageLicense(_0x3f7122,_0x3b23b5);})['catch'](function(_0x4bd2bb){logger[_0xcc15('0x1f')](_0x4bd2bb[_0xcc15('0x24')]);});}}exports[_0xcc15('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 752a88f..4796967 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 _0x0f1d=['users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','gray','grayReason','machineUuid','disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','telephone'];(function(_0x27ea4b,_0x4706bc){var _0x22a413=function(_0x249ab9){while(--_0x249ab9){_0x27ea4b['push'](_0x27ea4b['shift']());}};_0x22a413(++_0x4706bc);}(_0x0f1d,0x19c));var _0xd0f1=function(_0x3f330e,_0x4d3abd){_0x3f330e=_0x3f330e-0x0;var _0x11c1d1=_0x0f1d[_0x3f330e];return _0x11c1d1;};'use strict';var util=require(_0xd0f1('0x0'));var _=require(_0xd0f1('0x1'));var moment=require(_0xd0f1('0x2'));var BPromise=require(_0xd0f1('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xd0f1('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0f1('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd0f1('0x6'),'machineUuid':hardware[_0xd0f1('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0f1('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd0f1('0x8'),'machineUuid':hardware[_0xd0f1('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x300fc8){return new BPromise(function(_0x57785b,_0x5af532){return db[_0xd0f1('0x9')]['find'](_[_0xd0f1('0xa')](_0x300fc8,{'raw':!![],'where':{'id':0x1}}))[_0xd0f1('0xb')](function(_0x3840ce){return checkLicense(_0x3840ce,null);})[_0xd0f1('0xb')](function(_0x17bf76){_0x57785b(_0x17bf76);return;})[_0xd0f1('0xc')](function(_0x1c32b8){_0x5af532(_0x1c32b8);});});}function checkLicense(_0x40dc29,_0x54f03c){if(!_0x40dc29){demoLicense[_0xd0f1('0xd')]=_0x40dc29[_0xd0f1('0xe')];return demoLicense;}try{var _0x3744d5=_0x54f03c||_0x40dc29[_0xd0f1('0xf')];if(_[_0xd0f1('0x10')](_0x3744d5)){throw new Error(_0xd0f1('0x11'));}var _0x19cffa=_0x40dc29['data1'];var _0x1d8302=_0x40dc29['data2'];var _0x111c3b=_0x19cffa[_0xd0f1('0x12')]('-')[0x4];var _0x1274bc=_0x19cffa[_0xd0f1('0x12')]('-')[0x0];var _0x51cfe4=encryptor[_0xd0f1('0x13')](_0x3744d5,util[_0xd0f1('0x14')](_0xd0f1('0x15'),_0x111c3b,_0x19cffa,_0x1274bc));var _0x16e61e=JSON[_0xd0f1('0x16')](_0x51cfe4);_0x16e61e[_0xd0f1('0x17')]=![];_0x16e61e[_0xd0f1('0xd')]=_0x19cffa;_0x16e61e['machineUuid']=hardware[_0xd0f1('0x7')]();if(_0x1d8302){var _0x389993=encryptor[_0xd0f1('0x13')](_0x1d8302);_0x16e61e[_0xd0f1('0x18')]=_0x389993;_0x16e61e['deadline']=moment(_0x389993)['add'](0x7,'days')[_0xd0f1('0x14')]();_0x16e61e[_0xd0f1('0x19')]=_0x16e61e['uuid']!=_0x16e61e[_0xd0f1('0x1a')]?'changed':_0xd0f1('0x1b');}return _0x16e61e;}catch(_0x4fa2ec){breakingLicense[_0xd0f1('0xd')]=_0x40dc29[_0xd0f1('0xe')];breakingLicense[_0xd0f1('0x1c')]=_0x4fa2ec['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x573793,_0x2741c3){getLicense()[_0xd0f1('0xb')](function(_0x413786){return db['User'][_0xd0f1('0x1d')]({'attributes':[_0xd0f1('0x1e'),[db['sequelize']['fn'](_0xd0f1('0x1f'),db[_0xd0f1('0x20')][_0xd0f1('0x21')]('role')),_0xd0f1('0x22')]],'group':_0xd0f1('0x1e'),'where':{'role':{'$or':[_0xd0f1('0x23'),_0xd0f1('0x24'),_0xd0f1('0x25')]}},'raw':!![]})[_0xd0f1('0xb')](function(_0x5b8ed1){var _0x50683e={'user':_0x413786[_0xd0f1('0x26')]||0x0,'telephone':_0x413786[_0xd0f1('0x27')]||0x0};_0x5b8ed1[_0xd0f1('0x28')](function(_0x4a1024){var _0x39b182=_0x4a1024['role']===_0xd0f1('0x23')?_0xd0f1('0x24'):_0x4a1024[_0xd0f1('0x1e')];_0x50683e[_0x39b182]-=_0x4a1024[_0xd0f1('0x22')];if(_0x50683e[_0x39b182]<0x0)_0x50683e[_0x39b182]=0x0;});_0x573793(_0x50683e);return;});})['catch'](function(_0x3986a0){_0x2741c3(_0x3986a0);});});}function checkUserLimits(_0x54e258){return new BPromise(function(_0x3a33c6,_0x684990){getLimits()[_0xd0f1('0xb')](function(_0x3d951c){var _0x448d10=_[_0xd0f1('0x29')](_['countBy'](_0x54e258,_0xd0f1('0x1e')),['admin','user',_0xd0f1('0x25')]);var _0x33f413=(_0x448d10[_0xd0f1('0x23')]||0x0)+(_0x448d10[_0xd0f1('0x24')]||0x0);var _0x49dbcd=_0x448d10[_0xd0f1('0x25')]||0x0;if(_0x33f413>_0x3d951c[_0xd0f1('0x24')])return _0x684990(_0xd0f1('0x2a'));if(_0x49dbcd>_0x3d951c[_0xd0f1('0x25')])return _0x684990(_0xd0f1('0x2b'));return _0x3a33c6();})[_0xd0f1('0xc')](function(_0x1fe91e){_0x684990(_0x1fe91e);});});}module[_0xd0f1('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa99e=['getUuid','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','uuid','machineUuid','gray','deadline','add','format','grayReason','changed','disabled','message','User','findAll','sequelize','col','role','admin','user','telephone','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xa99e,0x180));var _0xea99=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0xa99e[_0x2f16e5];return _0x5d082a;};'use strict';var util=require('util');var _=require(_0xea99('0x0'));var moment=require(_0xea99('0x1'));var BPromise=require(_0xea99('0x2'));var hardware=require(_0xea99('0x3'));var encryptor=require(_0xea99('0x4'));var db=require(_0xea99('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xea99('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xea99('0x7'),'machineUuid':hardware[_0xea99('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xea99('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x43a905){return new BPromise(function(_0x1e3677,_0x292b89){return db[_0xea99('0x9')][_0xea99('0xa')](_[_0xea99('0xb')](_0x43a905,{'raw':!![],'where':{'id':0x1}}))[_0xea99('0xc')](function(_0x4bd542){return checkLicense(_0x4bd542,null);})[_0xea99('0xc')](function(_0x4a8dfa){_0x1e3677(_0x4a8dfa);return;})[_0xea99('0xd')](function(_0xbdac61){_0x292b89(_0xbdac61);});});}function checkLicense(_0x189498,_0x59d5a2){if(!_0x189498){demoLicense['uuid']=_0x189498[_0xea99('0xe')];return demoLicense;}try{var _0x39004b=_0x59d5a2||_0x189498[_0xea99('0xf')];if(_[_0xea99('0x10')](_0x39004b)){throw new Error(_0xea99('0x11'));}var _0x163826=_0x189498[_0xea99('0xe')];var _0x3a598f=_0x189498[_0xea99('0x12')];var _0x451717=_0x163826[_0xea99('0x13')]('-')[0x4];var _0x454a66=_0x163826[_0xea99('0x13')]('-')[0x0];var _0x2fc35c=encryptor[_0xea99('0x14')](_0x39004b,util['format'](_0xea99('0x15'),_0x451717,_0x163826,_0x454a66));var _0x1e41d3=JSON[_0xea99('0x16')](_0x2fc35c);_0x1e41d3['demo']=![];_0x1e41d3[_0xea99('0x17')]=_0x163826;_0x1e41d3[_0xea99('0x18')]=hardware[_0xea99('0x8')]();if(_0x3a598f){var _0x58ac51=encryptor[_0xea99('0x14')](_0x3a598f);_0x1e41d3[_0xea99('0x19')]=_0x58ac51;_0x1e41d3[_0xea99('0x1a')]=moment(_0x58ac51)[_0xea99('0x1b')](0x7,'days')[_0xea99('0x1c')]();_0x1e41d3[_0xea99('0x1d')]=_0x1e41d3[_0xea99('0x17')]!=_0x1e41d3['machineUuid']?_0xea99('0x1e'):_0xea99('0x1f');}return _0x1e41d3;}catch(_0x3b677b){breakingLicense[_0xea99('0x17')]=_0x189498[_0xea99('0xe')];breakingLicense[_0xea99('0x20')]=_0x3b677b[_0xea99('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5c5d5f,_0x35684c){getLicense()[_0xea99('0xc')](function(_0x315430){return db[_0xea99('0x21')][_0xea99('0x22')]({'attributes':['role',[db[_0xea99('0x23')]['fn']('COUNT',db['sequelize'][_0xea99('0x24')](_0xea99('0x25'))),'count']],'group':_0xea99('0x25'),'where':{'role':{'$or':[_0xea99('0x26'),_0xea99('0x27'),_0xea99('0x28')]}},'raw':!![]})['then'](function(_0x25316b){var _0x15350f={'user':_0x315430['users']||0x0,'telephone':_0x315430[_0xea99('0x29')]||0x0};_0x25316b[_0xea99('0x2a')](function(_0xd834a){var _0x522ecb=_0xd834a[_0xea99('0x25')]===_0xea99('0x26')?'user':_0xd834a[_0xea99('0x25')];_0x15350f[_0x522ecb]-=_0xd834a[_0xea99('0x2b')];if(_0x15350f[_0x522ecb]<0x0)_0x15350f[_0x522ecb]=0x0;});_0x5c5d5f(_0x15350f);return;});})[_0xea99('0xd')](function(_0x37f822){_0x35684c(_0x37f822);});});}function checkUserLimits(_0x15b554){return new BPromise(function(_0x15456f,_0x428faf){getLimits()[_0xea99('0xc')](function(_0x35ce27){var _0x5cf972=_[_0xea99('0x2c')](_[_0xea99('0x2d')](_0x15b554,'role'),[_0xea99('0x26'),_0xea99('0x27'),_0xea99('0x28')]);var _0x3d68bf=(_0x5cf972['admin']||0x0)+(_0x5cf972[_0xea99('0x27')]||0x0);var _0x1caad1=_0x5cf972['telephone']||0x0;if(_0x3d68bf>_0x35ce27[_0xea99('0x27')])return _0x428faf(_0xea99('0x2e'));if(_0x1caad1>_0x35ce27[_0xea99('0x28')])return _0x428faf(_0xea99('0x2f'));return _0x15456f();})[_0xea99('0xd')](function(_0x2ad1c6){_0x428faf(_0x2ad1c6);});});}module[_0xea99('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index ca65632..bae9c7a 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 _0x3de3=['exports','myappanuglar-secret','app-id'];(function(_0x376a3c,_0x50a8a6){var _0x539ccf=function(_0x3dbfd7){while(--_0x3dbfd7){_0x376a3c['push'](_0x376a3c['shift']());}};_0x539ccf(++_0x50a8a6);}(_0x3de3,0x1ce));var _0x33de=function(_0x251c97,_0x19c9aa){_0x251c97=_0x251c97-0x0;var _0x3b9bbe=_0x3de3[_0x251c97];return _0x3b9bbe;};'use strict';module[_0x33de('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x33de('0x1'),'GOOGLE_ID':_0x33de('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x57ca=['http://localhost:9000','myappanuglar-secret','secret'];(function(_0x3cf2ce,_0x4a34f6){var _0x47d881=function(_0x1fb7d3){while(--_0x1fb7d3){_0x3cf2ce['push'](_0x3cf2ce['shift']());}};_0x47d881(++_0x4a34f6);}(_0x57ca,0x108));var _0xa57c=function(_0x1439a9,_0x5806ba){_0x1439a9=_0x1439a9-0x0;var _0x332509=_0x57ca[_0x1439a9];return _0x332509;};'use strict';module['exports']={'DOMAIN':_0xa57c('0x0'),'SESSION_SECRET':_0xa57c('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa57c('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3d7c16c..59c7d98 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01b3=['../utils/loggers','fileLogger'];(function(_0x484355,_0x487092){var _0x4aaeb3=function(_0x5e232b){while(--_0x5e232b){_0x484355['push'](_0x484355['shift']());}};_0x4aaeb3(++_0x487092);}(_0x01b3,0x6e));var _0x301b=function(_0x39e2e1,_0x300418){_0x39e2e1=_0x39e2e1-0x0;var _0x208522=_0x01b3[_0x39e2e1];return _0x208522;};'use strict';var fileLogger=require(_0x301b('0x0'))[_0x301b('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x778f=['fileLogger','exports','../utils/loggers'];(function(_0xc5bcea,_0xc6c0aa){var _0x4f2f4a=function(_0xae141e){while(--_0xae141e){_0xc5bcea['push'](_0xc5bcea['shift']());}};_0x4f2f4a(++_0xc6c0aa);}(_0x778f,0xe9));var _0xf778=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x778f[_0x525c7b];return _0x27b33e;};'use strict';var fileLogger=require(_0xf778('0x0'))[_0xf778('0x1')];module[_0xf778('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index bd3a05b..ecf0bbf 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 _0x921e=['agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','../../config/environment','root','legacy-libs','join','../../services/express/index.js'];(function(_0x99bde6,_0x586d99){var _0xc3264b=function(_0x21768d){while(--_0x21768d){_0x99bde6['push'](_0x99bde6['shift']());}};_0xc3264b(++_0x586d99);}(_0x921e,0xf7));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var cfg=require(_0xe921('0x0'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0xe921('0x1')],_0xe921('0x2')))};var pm2config={'apps':[{'name':'express','script':path[_0xe921('0x3')](__dirname,_0xe921('0x4')),'env':env},{'name':'ami','script':path[_0xe921('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xe921('0x5'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xe921('0x6'),'script':path['join'](__dirname,_0xe921('0x7')),'env':env},{'name':_0xe921('0x8'),'script':path[_0xe921('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xe921('0x9'),'script':path[_0xe921('0x3')](__dirname,_0xe921('0xa')),'env':env}]};module[_0xe921('0xb')]=pm2config; \ No newline at end of file +var _0x0039=['root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','resolve','join'];(function(_0x150014,_0x527643){var _0x20da3f=function(_0x25e66d){while(--_0x25e66d){_0x150014['push'](_0x150014['shift']());}};_0x20da3f(++_0x527643);}(_0x0039,0x11d));var _0x9003=function(_0x462774,_0x4953d2){_0x462774=_0x462774-0x0;var _0x280503=_0x0039[_0x462774];return _0x280503;};'use strict';var path=require(_0x9003('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x9003('0x1')](path[_0x9003('0x2')](cfg[_0x9003('0x3')],_0x9003('0x4')))};var pm2config={'apps':[{'name':_0x9003('0x5'),'script':path[_0x9003('0x2')](__dirname,_0x9003('0x6')),'env':env},{'name':'ami','script':path[_0x9003('0x2')](__dirname,_0x9003('0x7')),'env':env},{'name':_0x9003('0x8'),'script':path[_0x9003('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x9003('0x9'),'script':path[_0x9003('0x2')](__dirname,_0x9003('0xa')),'env':env},{'name':_0x9003('0xb'),'script':path[_0x9003('0x2')](__dirname,_0x9003('0xc')),'env':env},{'name':_0x9003('0xd'),'script':path[_0x9003('0x2')](__dirname,_0x9003('0xe')),'env':env}]};module[_0x9003('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 52c3f76..6ca104c 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 _0x2995=['describe','delete','dump','saved','pm2','./config','connect','connected','start','then','disconnect','restart','list'];(function(_0x213f3d,_0x31c31f){var _0x238251=function(_0x222903){while(--_0x222903){_0x213f3d['push'](_0x213f3d['shift']());}};_0x238251(++_0x31c31f);}(_0x2995,0x93));var _0x5299=function(_0x3f94d6,_0x393461){_0x3f94d6=_0x3f94d6-0x0;var _0x4dc053=_0x2995[_0x3f94d6];return _0x4dc053;};'use strict';var pm2=require(_0x5299('0x0'));var BPromise=require('bluebird');var config=require(_0x5299('0x1'));function connect(){return new BPromise(function(_0x17ecdb,_0x2977f8){return pm2[_0x5299('0x2')](function(_0x47ad37){if(_0x47ad37){return _0x2977f8(_0x47ad37);}return _0x17ecdb(_0x5299('0x3'));});});};exports[_0x5299('0x4')]=function(_0x28c462){return connect()[_0x5299('0x5')](function(){return new BPromise(function(_0x513379,_0x122b6f){return pm2['start'](_0x28c462,function(_0x55c2d8,_0x569c0a){if(_0x55c2d8){return _0x122b6f(_0x55c2d8);}pm2[_0x5299('0x6')]();return _0x513379(_0x569c0a);});});});};exports['stop']=function(_0x1467e6){return connect()[_0x5299('0x5')](function(){return new BPromise(function(_0x4d7c71,_0x2bd339){return pm2['stop'](_0x1467e6,function(_0x2e85d8,_0x3a528b){if(_0x2e85d8){return _0x2bd339(_0x2e85d8);}pm2[_0x5299('0x6')]();return _0x4d7c71(_0x3a528b);});});});};exports['restart']=function(_0x499360){return connect()['then'](function(){return new BPromise(function(_0x46668b,_0x5836ed){return pm2[_0x5299('0x7')](_0x499360,function(_0x7fd35d,_0x470d26){if(_0x7fd35d){return _0x5836ed(_0x7fd35d);}pm2[_0x5299('0x6')]();return _0x46668b(_0x470d26);});});});};exports[_0x5299('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x61992a,_0x45de80){return pm2[_0x5299('0x8')](function(_0x1929c9,_0x2044d8){if(_0x1929c9){return _0x45de80(_0x1929c9);}pm2['disconnect']();return _0x61992a(_0x2044d8);});});});};exports[_0x5299('0x9')]=function(_0x555e6f){return connect()[_0x5299('0x5')](function(){return new BPromise(function(_0x5e9e5b,_0x54aeb7){return pm2[_0x5299('0x9')](_0x555e6f,function(_0x3c3738,_0x25f482){if(_0x3c3738){return _0x54aeb7(_0x3c3738);}pm2[_0x5299('0x6')]();return _0x5e9e5b(_0x25f482);});});});};exports[_0x5299('0xa')]=function(_0x2df41f){return connect()[_0x5299('0x5')](function(){return new BPromise(function(_0x218025,_0x4a594a){return pm2[_0x5299('0xa')](_0x2df41f,function(_0x3fac4e,_0x10b1ba){if(_0x3fac4e){return _0x4a594a(_0x3fac4e);}pm2[_0x5299('0x6')]();return _0x218025(_0x10b1ba);});});});};exports[_0x5299('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x28152d,_0x572e09){return pm2[_0x5299('0xb')](function(_0x5d5bbc){if(_0x5d5bbc){return _0x572e09(_0x5d5bbc);}return _0x28152d(_0x5299('0xc'));});});});}; \ No newline at end of file +var _0x8fa0=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','delete','dump','saved'];(function(_0x56d344,_0x26fa8e){var _0x82e07c=function(_0x52e8a7){while(--_0x52e8a7){_0x56d344['push'](_0x56d344['shift']());}};_0x82e07c(++_0x26fa8e);}(_0x8fa0,0x16c));var _0x08fa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8fa0[_0x21a9d9];return _0x46adce;};'use strict';var pm2=require(_0x08fa('0x0'));var BPromise=require(_0x08fa('0x1'));var config=require(_0x08fa('0x2'));function connect(){return new BPromise(function(_0x4c1542,_0x519996){return pm2[_0x08fa('0x3')](function(_0x5dc1da){if(_0x5dc1da){return _0x519996(_0x5dc1da);}return _0x4c1542(_0x08fa('0x4'));});});};exports[_0x08fa('0x5')]=function(_0x573c3b){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x1e9d4f,_0x47fd9c){return pm2[_0x08fa('0x5')](_0x573c3b,function(_0x1b4695,_0x3892fe){if(_0x1b4695){return _0x47fd9c(_0x1b4695);}pm2[_0x08fa('0x7')]();return _0x1e9d4f(_0x3892fe);});});});};exports[_0x08fa('0x8')]=function(_0x44534a){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x207f78,_0x2eca9c){return pm2[_0x08fa('0x8')](_0x44534a,function(_0x29fd23,_0x3eb3ab){if(_0x29fd23){return _0x2eca9c(_0x29fd23);}pm2[_0x08fa('0x7')]();return _0x207f78(_0x3eb3ab);});});});};exports[_0x08fa('0x9')]=function(_0x5cb900){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x204791,_0x130e79){return pm2[_0x08fa('0x9')](_0x5cb900,function(_0x461036,_0x302bd0){if(_0x461036){return _0x130e79(_0x461036);}pm2[_0x08fa('0x7')]();return _0x204791(_0x302bd0);});});});};exports[_0x08fa('0xa')]=function(){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x5e1bb6,_0x308542){return pm2[_0x08fa('0xa')](function(_0x35ec57,_0x158b81){if(_0x35ec57){return _0x308542(_0x35ec57);}pm2['disconnect']();return _0x5e1bb6(_0x158b81);});});});};exports['describe']=function(_0x1518a4){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x5ab0d9,_0x15b306){return pm2['describe'](_0x1518a4,function(_0x4a4089,_0x1593b8){if(_0x4a4089){return _0x15b306(_0x4a4089);}pm2['disconnect']();return _0x5ab0d9(_0x1593b8);});});});};exports[_0x08fa('0xb')]=function(_0x49c49b){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x1b2fac,_0xdab159){return pm2[_0x08fa('0xb')](_0x49c49b,function(_0x3e2672,_0x3a3c79){if(_0x3e2672){return _0xdab159(_0x3e2672);}pm2['disconnect']();return _0x1b2fac(_0x3a3c79);});});});};exports[_0x08fa('0xc')]=function(){return connect()[_0x08fa('0x6')](function(){return new BPromise(function(_0x4c68b4,_0x4e959a){return pm2['dump'](function(_0x4bf03c){if(_0x4bf03c){return _0x4e959a(_0x4bf03c);}return _0x4c68b4(_0x08fa('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 93b475a..e1f2e16 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 _0xf61a=['ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xf61a,0x1cc));var _0xaf61=function(_0x14dfb1,_0x47b89b){_0x14dfb1=_0x14dfb1-0x0;var _0x1e9aec=_0xf61a[_0x14dfb1];return _0x1e9aec;};'use strict';var _=require(_0xaf61('0x0'));var moment=require(_0xaf61('0x1'));var Redis=require(_0xaf61('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0xaf61('0x3'))['db'];var logger=require(_0xaf61('0x4'))(_0xaf61('0x5'));config[_0xaf61('0x6')]=_[_0xaf61('0x7')](config[_0xaf61('0x6')],{'host':_0xaf61('0x8'),'port':0x18eb});var io=require(_0xaf61('0x9'))(new Redis(config[_0xaf61('0x6')]));function closeInteractions(){var _0x3c9c57=0x0;var _0xa1f9d1=[];return db[_0xaf61('0xa')][_0xaf61('0xb')]({'raw':!![],'attributes':['id',_0xaf61('0xc')],'where':{'id':0x1}})[_0xaf61('0xd')](function(_0xa50020){_0x3c9c57=_0xa50020[_0xaf61('0xc')];if(_0x3c9c57){return db[_0xaf61('0xe')][_0xaf61('0xf')]({'raw':!![],'attributes':['id',_0xaf61('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xa50020[_0xaf61('0xc')],_0xaf61('0x11'))}}});}else{return[];}})[_0xaf61('0xd')](function(_0x19c5f2){if(_0x19c5f2&&_0x19c5f2[_0xaf61('0x12')]){_0xa1f9d1=_[_0xaf61('0x13')](_0x19c5f2||[],'id');logger[_0xaf61('0x14')](_0xaf61('0x15'),_0xa1f9d1[_0xaf61('0x16')]());return db[_0xaf61('0xe')][_0xaf61('0x17')]({'closeReason':_0xaf61('0x18'),'disposition':_0xaf61('0x19'),'closed':!![],'closedAt':moment()['format'](_0xaf61('0x1a'))},{'where':{'id':_0xa1f9d1}});}})[_0xaf61('0xd')](function(){if(_0xa1f9d1&&_0xa1f9d1[_0xaf61('0x12')]){logger[_0xaf61('0x14')](_0xaf61('0x1b'),_0xa1f9d1[_0xaf61('0x16')]());for(var _0x158bde=0x0;_0x158bde<_0xa1f9d1[_0xaf61('0x12')];_0x158bde++){io['emit']('chatInteraction:update',{'id':_0xa1f9d1[_0x158bde],'closed':!![]});}}})[_0xaf61('0x1c')](function(_0x2665a7){logger[_0xaf61('0x1d')](_0xaf61('0x1e'),_0x2665a7?util[_0xaf61('0x1f')](_0x2665a7,{'showHidden':![],'depth':null}):'');});}exports[_0xaf61('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5d00=['schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0xaeb36b,_0x13ccd6){var _0x3174b0=function(_0xf0b043){while(--_0xf0b043){_0xaeb36b['push'](_0xaeb36b['shift']());}};_0x3174b0(++_0x13ccd6);}(_0x5d00,0x165));var _0x05d0=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x5d00[_0xc82d1a];return _0x32fad2;};'use strict';var _=require('lodash');var moment=require(_0x05d0('0x0'));var Redis=require(_0x05d0('0x1'));var util=require(_0x05d0('0x2'));var config=require(_0x05d0('0x3'));var db=require(_0x05d0('0x4'))['db'];var logger=require(_0x05d0('0x5'))(_0x05d0('0x6'));config[_0x05d0('0x7')]=_[_0x05d0('0x8')](config[_0x05d0('0x7')],{'host':_0x05d0('0x9'),'port':0x18eb});var io=require(_0x05d0('0xa'))(new Redis(config[_0x05d0('0x7')]));function closeInteractions(){var _0x4eb025=0x0;var _0x49a674=[];return db[_0x05d0('0xb')][_0x05d0('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x05d0('0xd')](function(_0x370e35){_0x4eb025=_0x370e35[_0x05d0('0xe')];if(_0x4eb025){return db[_0x05d0('0xf')]['findAll']({'raw':!![],'attributes':['id',_0x05d0('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x05d0('0x11')](_0x370e35['chatTimeout'],_0x05d0('0x12'))}}});}else{return[];}})[_0x05d0('0xd')](function(_0x5b58b1){if(_0x5b58b1&&_0x5b58b1['length']){_0x49a674=_[_0x05d0('0x13')](_0x5b58b1||[],'id');logger[_0x05d0('0x14')](_0x05d0('0x15'),_0x49a674[_0x05d0('0x16')]());return db[_0x05d0('0xf')][_0x05d0('0x17')]({'closeReason':'system','disposition':_0x05d0('0x18'),'closed':!![],'closedAt':moment()[_0x05d0('0x19')](_0x05d0('0x1a'))},{'where':{'id':_0x49a674}});}})['then'](function(){if(_0x49a674&&_0x49a674['length']){logger[_0x05d0('0x14')](_0x05d0('0x1b'),_0x49a674[_0x05d0('0x16')]());for(var _0x2cefb6=0x0;_0x2cefb6<_0x49a674['length'];_0x2cefb6++){io[_0x05d0('0x1c')](_0x05d0('0x1d'),{'id':_0x49a674[_0x2cefb6],'closed':!![]});}}})['catch'](function(_0xd8b51d){logger['error'](_0x05d0('0x1e'),_0xd8b51d?util[_0x05d0('0x1f')](_0xd8b51d,{'showHidden':![],'depth':null}):'');});}exports[_0x05d0('0x20')]=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 efbbe0f..94adf11 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 _0x93a7=['exports'];(function(_0x2d4340,_0x14bd7f){var _0x5a2e9e=function(_0x2ea64f){while(--_0x2ea64f){_0x2d4340['push'](_0x2d4340['shift']());}};_0x5a2e9e(++_0x14bd7f);}(_0x93a7,0xbd));var _0x793a=function(_0x13154d,_0x2c74d6){_0x13154d=_0x13154d-0x0;var _0x175ee1=_0x93a7[_0x13154d];return _0x175ee1;};'use strict';function start(){var _0x39a5df=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x39a5df['startAllRefreshIntervals']();}module[_0x793a('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xb800=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1e7d13,_0x4ef02e){var _0x31e8bb=function(_0x21693a){while(--_0x21693a){_0x1e7d13['push'](_0x1e7d13['shift']());}};_0x31e8bb(++_0x4ef02e);}(_0xb800,0x67));var _0x0b80=function(_0x2969ff,_0x3a343c){_0x2969ff=_0x2969ff-0x0;var _0x1af0b1=_0xb800[_0x2969ff];return _0x1af0b1;};'use strict';function start(){var _0x1b891d=require(_0x0b80('0x0'));return _0x1b891d['startAllRefreshIntervals']();}module[_0x0b80('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 7bfec29..5f7d278 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 _0x2d1b=['cron','active','isBetween','startAt','add\x20cron','stop\x20cron','update','update\x20cron','start','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','info','email\x20sent','catch','error','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job'];(function(_0x5a6e9f,_0x45b335){var _0x3dd5c4=function(_0x5e37a7){while(--_0x5e37a7){_0x5a6e9f['push'](_0x5a6e9f['shift']());}};_0x3dd5c4(++_0x45b335);}(_0x2d1b,0x1c6));var _0xb2d1=function(_0x2e36c3,_0x129288){_0x2e36c3=_0x2e36c3-0x0;var _0x13a75e=_0x2d1b[_0x2e36c3];return _0x13a75e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xb2d1('0x0'));var _=require(_0xb2d1('0x1'));var moment=require(_0xb2d1('0x2'));var CronJobManager=require(_0xb2d1('0x3'));var jayson=require(_0xb2d1('0x4'));var BPromise=require(_0xb2d1('0x5'));var logger=require(_0xb2d1('0x6'))('schedule');var db=require(_0xb2d1('0x7'))['db'];var analyticCustomReportController=require(_0xb2d1('0x8'));var analyticDefaultReportController=require(_0xb2d1('0x9'));var client=jayson['client'][_0xb2d1('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5c179b,_0x23da61){return function(){logger['info'](_0xb2d1('0xb'),_0x5c179b[_0xb2d1('0xc')]);var _0xcb7598=!![];var _0x245027=_0x5c179b[_0xb2d1('0xd')][_0xb2d1('0xe')]();var _0x29409a={'account':_0x245027,'message':{'from':util[_0xb2d1('0xf')](_0xb2d1('0x10'),_0x5c179b[_0xb2d1('0xd')][_0xb2d1('0x11')],_0x5c179b[_0xb2d1('0xd')][_0xb2d1('0xc')]||_0x5c179b[_0xb2d1('0xd')]['Smtp'][_0xb2d1('0x12')]),'to':_0x5c179b['email'],'cc':_0x5c179b['cc'],'bcc':_0x5c179b[_0xb2d1('0x13')],'subject':util[_0xb2d1('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x23da61['name'],_0x5c179b[_0xb2d1('0x14')],_0x5c179b[_0xb2d1('0x15')])}};var _0x23c6d5=path['join'](__dirname,_0xb2d1('0x16'));var _0x3667c2=_0x23da61[_0xb2d1('0x17')];var _0x3959e0=util[_0xb2d1('0xf')](_0xb2d1('0x18'),path[_0xb2d1('0x19')](_0x23da61[_0xb2d1('0x17')],path['extname'](_0x23da61['savename'])),_0xb2d1('0x1a'));var _0x3f59f3=path[_0xb2d1('0x1b')](_0x23c6d5,_0x3667c2);var _0x3c6610=path[_0xb2d1('0x1b')](_0x23c6d5,_0x3959e0);if(fs[_0xb2d1('0x1c')](_0x3f59f3)){_0x23da61[_0xb2d1('0x1d')]=_0xb2d1('0x1e');_0x29409a[_0xb2d1('0x1f')][_0xb2d1('0x20')]=[{'filename':_0x3667c2,'path':_0x3f59f3}];_0x29409a['message'][_0xb2d1('0x21')]=util[_0xb2d1('0xf')](_0xb2d1('0x22'),JSON[_0xb2d1('0x23')](_0x23da61,null,0x2));}else if(fs['existsSync'](_0x3c6610)){_0x23da61[_0xb2d1('0x1d')]=_0xb2d1('0x1e');_0x29409a[_0xb2d1('0x1f')][_0xb2d1('0x20')]=[{'filename':_0x3959e0,'path':_0x3c6610}];}else{_0x29409a[_0xb2d1('0x1f')][_0xb2d1('0x21')]=_0xb2d1('0x24');if(!_0x5c179b[_0xb2d1('0x25')]){_0xcb7598=![];logger['info'](_0xb2d1('0x26'));}}if(_0xcb7598){return client[_0xb2d1('0x27')](_0xb2d1('0x28'),_0x29409a)[_0xb2d1('0x29')](function(_0x427d0d){if(_0x427d0d['error']){return logger['error'](_0xb2d1('0x2a'),JSON[_0xb2d1('0x23')](_0x427d0d));}return logger[_0xb2d1('0x2b')](_0xb2d1('0x2c'));})[_0xb2d1('0x2d')](function(_0x248c74){return logger[_0xb2d1('0x2e')]('error\x20mail',JSON['stringify'](_0x248c74));});}};}function handleError(){return function(_0x45a468){return logger[_0xb2d1('0x2e')](JSON['stringify'](_0x45a468));};}function handleResult(_0x460575){return function(_0x28569d){logger['info'](_0xb2d1('0x2f'),JSON['stringify'](_0x28569d));if(_0x460575['MailAccount']&&_0x460575[_0xb2d1('0xd')][_0xb2d1('0x30')]&&!_[_0xb2d1('0x31')](_0x460575['email'])){setTimeout(handleSendEmail(_0x460575,_0x28569d),0x3c*0x3e8);}};}function handleJob(_0x2df563){return function(){try{if(_[_0xb2d1('0x31')](_0x2df563['subtractNumber'])){return logger[_0xb2d1('0x2b')](_0xb2d1('0x32'));}if(_[_0xb2d1('0x31')](_0x2df563['subtractUnit'])){return logger[_0xb2d1('0x2b')](_0xb2d1('0x33'));}var _0x3ce419={'startDate':moment()[_0xb2d1('0x34')](_0x2df563[_0xb2d1('0x14')],_0x2df563['subtractUnit'])[_0xb2d1('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb2d1('0xf')](_0xb2d1('0x35')),'type':_0xb2d1('0x36'),'output':_0x2df563[_0xb2d1('0x37')],'name':_0x2df563['name']};if(!_[_0xb2d1('0x31')](_0x2df563[_0xb2d1('0x38')])){logger[_0xb2d1('0x2b')](_0xb2d1('0x39'),_0x2df563['DefaultReportId']);return analyticDefaultReportController[_0xb2d1('0x3a')]({'id':_0x2df563[_0xb2d1('0x38')]},_0x3ce419)[_0xb2d1('0x29')](handleResult(_0x2df563))['catch'](handleError());}if(!_[_0xb2d1('0x31')](_0x2df563['CustomReportId'])){logger['info'](_0xb2d1('0x3b'),_0x2df563[_0xb2d1('0x3c')]);return analyticCustomReportController[_0xb2d1('0x3a')]({'id':_0x2df563[_0xb2d1('0x3c')]},_0x3ce419)[_0xb2d1('0x29')](handleResult(_0x2df563))[_0xb2d1('0x2d')](handleError());}}catch(_0x207ea5){logger[_0xb2d1('0x2e')](JSON[_0xb2d1('0x23')](_0x207ea5));}return logger[_0xb2d1('0x2b')](_0xb2d1('0x3d'));};}function getJobs(_0x13820f){var _0x55b6ab={};if(_0x13820f){_0x55b6ab['id']=_0x13820f;}return db[_0xb2d1('0x3e')][_0xb2d1('0x3f')]({'where':_0x55b6ab,'include':[{'model':db['MailAccount'],'attributes':['id',_0xb2d1('0x11'),'email'],'include':[{'model':db[_0xb2d1('0x40')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xb2d1('0x41')}]}]}]})[_0xb2d1('0x29')](function(_0x1617fe){var _0x2d33e4=_[_0xb2d1('0x42')](manager[_0xb2d1('0x43')]);var _0x3a0419=_['map'](_0x1617fe,function(_0x3baa57){return _0x3baa57['id'][_0xb2d1('0x44')]();});var _0x515dcb=_[_0xb2d1('0x45')](_0x1617fe,function(_0x45481f){return _0x45481f['id']['toString']();});var _0x2b91ef=_0x13820f?_0x3a0419:_[_0xb2d1('0x46')](_0x3a0419,_0x2d33e4);var _0x4a3075=_[_0xb2d1('0x47')](_0x3a0419,_0x2d33e4);var _0x5a6cff=_[_0xb2d1('0x46')](_0x2d33e4,_0x3a0419);var _0x4461bc;var _0x5263ef;for(_0x4461bc=0x0;_0x4461bc<_0x5a6cff['length']&&!_0x13820f;_0x4461bc+=0x1){_0x5263ef=_0x5a6cff[_0x4461bc][_0xb2d1('0x44')]();if(manager[_0xb2d1('0x48')](_0x5263ef)){manager[_0xb2d1('0x49')](_0x5263ef);manager[_0xb2d1('0x4a')](_0x5263ef);logger['info'](_0xb2d1('0x4b'),_0x5263ef);}}logger[_0xb2d1('0x2b')]('toRun',JSON[_0xb2d1('0x23')](_0x2b91ef));for(_0x4461bc=0x0;_0x4461bc<_0x2b91ef[_0xb2d1('0x4c')];_0x4461bc+=0x1){_0x5263ef=_0x2b91ef[_0x4461bc][_0xb2d1('0x44')]();logger[_0xb2d1('0x2b')]('index',_0x5263ef);if(_0x13820f){logger[_0xb2d1('0x2b')](_0xb2d1('0x4d'),_0x13820f);logger[_0xb2d1('0x2b')](JSON['stringify'](_0x515dcb[_0x5263ef]));BPromise[_0xb2d1('0x4e')]()[_0xb2d1('0x29')](handleJob(_0x515dcb[_0x5263ef]));logger[_0xb2d1('0x2b')](_0xb2d1('0x4f'),_0x515dcb[_0x5263ef]['name'],_0x515dcb[_0x5263ef][_0xb2d1('0x50')]);}else if(_0x515dcb[_0x5263ef][_0xb2d1('0x50')]&&_0x515dcb[_0x5263ef][_0xb2d1('0x51')]&&moment()[_0xb2d1('0x52')](_0x515dcb[_0x5263ef][_0xb2d1('0x53')],_0x515dcb[_0x5263ef]['endAt'])){manager['add'](_0x5263ef,_0x515dcb[_0x5263ef][_0xb2d1('0x50')],handleJob(_0x515dcb[_0x5263ef]));manager['start'](_0x5263ef);logger[_0xb2d1('0x2b')](_0xb2d1('0x54'),_0x515dcb[_0x5263ef][_0xb2d1('0x11')],_0x515dcb[_0x5263ef][_0xb2d1('0x50')]);}else if(manager['exists'](_0x5263ef)){manager[_0xb2d1('0x49')](_0x5263ef);manager[_0xb2d1('0x4a')](_0x5263ef);logger['info'](_0xb2d1('0x55'),_0x515dcb[_0x5263ef][_0xb2d1('0x11')],_0x515dcb[_0x5263ef][_0xb2d1('0x50')]);}}for(_0x4461bc=0x0,_0x5263ef;_0x4461bc<_0x4a3075[_0xb2d1('0x4c')]&&!_0x13820f;_0x4461bc+=0x1){_0x5263ef=_0x4a3075[_0x4461bc][_0xb2d1('0x44')]();if(manager['exists'](_0x5263ef)){if(_0x515dcb[_0x5263ef]['cron']&&_0x515dcb[_0x5263ef][_0xb2d1('0x51')]&&moment()[_0xb2d1('0x52')](_0x515dcb[_0x5263ef][_0xb2d1('0x53')],_0x515dcb[_0x5263ef]['endAt'])){manager[_0xb2d1('0x56')](_0x5263ef,_0x515dcb[_0x5263ef][_0xb2d1('0x50')],handleJob(_0x515dcb[_0x5263ef]));logger[_0xb2d1('0x2b')](_0xb2d1('0x57'),_0x515dcb[_0x5263ef]['name'],_0x515dcb[_0x5263ef]['cron']);}else{manager['stop'](_0x5263ef);manager[_0xb2d1('0x4a')](_0x5263ef);logger[_0xb2d1('0x2b')](_0xb2d1('0x55'),_0x515dcb[_0x5263ef][_0xb2d1('0x11')],_0x515dcb[_0x5263ef][_0xb2d1('0x50')]);}}}})[_0xb2d1('0x2d')](function(_0x5add6c){logger[_0xb2d1('0x2e')](JSON[_0xb2d1('0x23')](_0x5add6c));});}exports['run']=function(_0x235895){return getJobs(_0x235895);};exports[_0xb2d1('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8da5=['MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','add\x20cron','active','startAt','update','update\x20cron','stop\x20cron','run','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','join','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll'];(function(_0x399b24,_0x2d6c6a){var _0x5971c7=function(_0x268fa7){while(--_0x268fa7){_0x399b24['push'](_0x399b24['shift']());}};_0x5971c7(++_0x2d6c6a);}(_0x8da5,0x186));var _0x58da=function(_0x56aeb4,_0x2510c7){_0x56aeb4=_0x56aeb4-0x0;var _0x30ddf5=_0x8da5[_0x56aeb4];return _0x30ddf5;};'use strict';var fs=require('fs');var util=require(_0x58da('0x0'));var path=require(_0x58da('0x1'));var _=require(_0x58da('0x2'));var moment=require('moment');var CronJobManager=require(_0x58da('0x3'));var jayson=require(_0x58da('0x4'));var BPromise=require(_0x58da('0x5'));var logger=require(_0x58da('0x6'))(_0x58da('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x58da('0x8'));var analyticDefaultReportController=require(_0x58da('0x9'));var client=jayson[_0x58da('0xa')][_0x58da('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xb4add4,_0x570c87){return function(){logger[_0x58da('0xc')](_0x58da('0xd'),_0xb4add4[_0x58da('0xe')]);var _0x5991bf=!![];var _0x448ee3=_0xb4add4[_0x58da('0xf')][_0x58da('0x10')]();var _0x133383={'account':_0x448ee3,'message':{'from':util['format'](_0x58da('0x11'),_0xb4add4['MailAccount'][_0x58da('0x12')],_0xb4add4[_0x58da('0xf')][_0x58da('0xe')]||_0xb4add4[_0x58da('0xf')][_0x58da('0x13')][_0x58da('0x14')]),'to':_0xb4add4[_0x58da('0xe')],'cc':_0xb4add4['cc'],'bcc':_0xb4add4[_0x58da('0x15')],'subject':util[_0x58da('0x16')](_0x58da('0x17'),_0x570c87[_0x58da('0x12')],_0xb4add4['subtractNumber'],_0xb4add4[_0x58da('0x18')])}};var _0x52fdba=path['join'](__dirname,_0x58da('0x19'));var _0x36ef6d=_0x570c87[_0x58da('0x1a')];var _0x4e9c53=util[_0x58da('0x16')](_0x58da('0x1b'),path['basename'](_0x570c87[_0x58da('0x1a')],path['extname'](_0x570c87[_0x58da('0x1a')])),'zip');var _0x58c86d=path[_0x58da('0x1c')](_0x52fdba,_0x36ef6d);var _0x270ad1=path[_0x58da('0x1c')](_0x52fdba,_0x4e9c53);if(fs[_0x58da('0x1d')](_0x58c86d)){_0x570c87['status']=_0x58da('0x1e');_0x133383[_0x58da('0x1f')][_0x58da('0x20')]=[{'filename':_0x36ef6d,'path':_0x58c86d}];_0x133383[_0x58da('0x1f')][_0x58da('0x21')]=util[_0x58da('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x58da('0x22')](_0x570c87,null,0x2));}else if(fs[_0x58da('0x1d')](_0x270ad1)){_0x570c87[_0x58da('0x23')]=_0x58da('0x1e');_0x133383['message'][_0x58da('0x20')]=[{'filename':_0x4e9c53,'path':_0x270ad1}];}else{_0x133383[_0x58da('0x1f')][_0x58da('0x21')]=_0x58da('0x24');if(!_0xb4add4[_0x58da('0x25')]){_0x5991bf=![];logger[_0x58da('0xc')](_0x58da('0x26'));}}if(_0x5991bf){return client[_0x58da('0x27')](_0x58da('0x28'),_0x133383)['then'](function(_0x486c67){if(_0x486c67[_0x58da('0x29')]){return logger['error']('error\x20mail',JSON[_0x58da('0x22')](_0x486c67));}return logger[_0x58da('0xc')](_0x58da('0x2a'));})[_0x58da('0x2b')](function(_0x417f98){return logger[_0x58da('0x29')](_0x58da('0x2c'),JSON[_0x58da('0x22')](_0x417f98));});}};}function handleError(){return function(_0xd10845){return logger[_0x58da('0x29')](JSON[_0x58da('0x22')](_0xd10845));};}function handleResult(_0x5a128e){return function(_0x4c4e09){logger['info'](_0x58da('0x2d'),JSON[_0x58da('0x22')](_0x4c4e09));if(_0x5a128e[_0x58da('0xf')]&&_0x5a128e[_0x58da('0xf')]['Smtp']&&!_[_0x58da('0x2e')](_0x5a128e[_0x58da('0xe')])){setTimeout(handleSendEmail(_0x5a128e,_0x4c4e09),0x3c*0x3e8);}};}function handleJob(_0x534c89){return function(){try{if(_['isNil'](_0x534c89['subtractNumber'])){return logger[_0x58da('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x58da('0x2e')](_0x534c89[_0x58da('0x18')])){return logger[_0x58da('0xc')](_0x58da('0x2f'));}var _0x686768={'startDate':moment()[_0x58da('0x30')](_0x534c89[_0x58da('0x31')],_0x534c89[_0x58da('0x18')])[_0x58da('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x58da('0x16')](_0x58da('0x32')),'type':_0x58da('0x33'),'output':_0x534c89['output'],'name':_0x534c89[_0x58da('0x12')]};if(!_['isNil'](_0x534c89[_0x58da('0x34')])){logger[_0x58da('0xc')](_0x58da('0x35'),_0x534c89[_0x58da('0x34')]);return analyticDefaultReportController[_0x58da('0x36')]({'id':_0x534c89[_0x58da('0x34')]},_0x686768)[_0x58da('0x37')](handleResult(_0x534c89))[_0x58da('0x2b')](handleError());}if(!_[_0x58da('0x2e')](_0x534c89[_0x58da('0x38')])){logger[_0x58da('0xc')](_0x58da('0x39'),_0x534c89[_0x58da('0x38')]);return analyticCustomReportController[_0x58da('0x36')]({'id':_0x534c89['CustomReportId']},_0x686768)[_0x58da('0x37')](handleResult(_0x534c89))[_0x58da('0x2b')](handleError());}}catch(_0x550be5){logger['error'](JSON['stringify'](_0x550be5));}return logger[_0x58da('0xc')](_0x58da('0x3a'));};}function getJobs(_0x435232){var _0x2c7df8={};if(_0x435232){_0x2c7df8['id']=_0x435232;}return db['Schedule'][_0x58da('0x3b')]({'where':_0x2c7df8,'include':[{'model':db[_0x58da('0xf')],'attributes':['id',_0x58da('0x12'),'email'],'include':[{'model':db[_0x58da('0x3c')],'as':_0x58da('0x13'),'include':[{'model':db[_0x58da('0x3d')],'as':_0x58da('0x3d')}]}]}]})[_0x58da('0x37')](function(_0x102780){var _0x4a9441=_[_0x58da('0x3e')](manager['jobs']);var _0x12fef0=_[_0x58da('0x3f')](_0x102780,function(_0x342c4f){return _0x342c4f['id']['toString']();});var _0x1b17f2=_[_0x58da('0x40')](_0x102780,function(_0x4c8e50){return _0x4c8e50['id'][_0x58da('0x41')]();});var _0x235df4=_0x435232?_0x12fef0:_[_0x58da('0x42')](_0x12fef0,_0x4a9441);var _0x167738=_[_0x58da('0x43')](_0x12fef0,_0x4a9441);var _0x37c209=_['difference'](_0x4a9441,_0x12fef0);var _0x17d982;var _0x32c7dd;for(_0x17d982=0x0;_0x17d982<_0x37c209[_0x58da('0x44')]&&!_0x435232;_0x17d982+=0x1){_0x32c7dd=_0x37c209[_0x17d982][_0x58da('0x41')]();if(manager[_0x58da('0x45')](_0x32c7dd)){manager[_0x58da('0x46')](_0x32c7dd);manager[_0x58da('0x47')](_0x32c7dd);logger[_0x58da('0xc')](_0x58da('0x48'),_0x32c7dd);}}logger['info'](_0x58da('0x49'),JSON[_0x58da('0x22')](_0x235df4));for(_0x17d982=0x0;_0x17d982<_0x235df4['length'];_0x17d982+=0x1){_0x32c7dd=_0x235df4[_0x17d982][_0x58da('0x41')]();logger[_0x58da('0xc')](_0x58da('0x4a'),_0x32c7dd);if(_0x435232){logger['info'](_0x58da('0x4b'),_0x435232);logger[_0x58da('0xc')](JSON[_0x58da('0x22')](_0x1b17f2[_0x32c7dd]));BPromise[_0x58da('0x4c')]()['then'](handleJob(_0x1b17f2[_0x32c7dd]));logger[_0x58da('0xc')](_0x58da('0x4d'),_0x1b17f2[_0x32c7dd][_0x58da('0x12')],_0x1b17f2[_0x32c7dd]['cron']);}else if(_0x1b17f2[_0x32c7dd][_0x58da('0x4e')]&&_0x1b17f2[_0x32c7dd]['active']&&moment()[_0x58da('0x4f')](_0x1b17f2[_0x32c7dd]['startAt'],_0x1b17f2[_0x32c7dd][_0x58da('0x50')])){manager[_0x58da('0x51')](_0x32c7dd,_0x1b17f2[_0x32c7dd][_0x58da('0x4e')],handleJob(_0x1b17f2[_0x32c7dd]));manager['start'](_0x32c7dd);logger[_0x58da('0xc')](_0x58da('0x52'),_0x1b17f2[_0x32c7dd][_0x58da('0x12')],_0x1b17f2[_0x32c7dd]['cron']);}else if(manager[_0x58da('0x45')](_0x32c7dd)){manager[_0x58da('0x46')](_0x32c7dd);manager[_0x58da('0x47')](_0x32c7dd);logger['info']('stop\x20cron',_0x1b17f2[_0x32c7dd]['name'],_0x1b17f2[_0x32c7dd][_0x58da('0x4e')]);}}for(_0x17d982=0x0,_0x32c7dd;_0x17d982<_0x167738[_0x58da('0x44')]&&!_0x435232;_0x17d982+=0x1){_0x32c7dd=_0x167738[_0x17d982]['toString']();if(manager[_0x58da('0x45')](_0x32c7dd)){if(_0x1b17f2[_0x32c7dd][_0x58da('0x4e')]&&_0x1b17f2[_0x32c7dd][_0x58da('0x53')]&&moment()[_0x58da('0x4f')](_0x1b17f2[_0x32c7dd][_0x58da('0x54')],_0x1b17f2[_0x32c7dd][_0x58da('0x50')])){manager[_0x58da('0x55')](_0x32c7dd,_0x1b17f2[_0x32c7dd][_0x58da('0x4e')],handleJob(_0x1b17f2[_0x32c7dd]));logger[_0x58da('0xc')](_0x58da('0x56'),_0x1b17f2[_0x32c7dd]['name'],_0x1b17f2[_0x32c7dd][_0x58da('0x4e')]);}else{manager[_0x58da('0x46')](_0x32c7dd);manager['deleteJob'](_0x32c7dd);logger[_0x58da('0xc')](_0x58da('0x57'),_0x1b17f2[_0x32c7dd][_0x58da('0x12')],_0x1b17f2[_0x32c7dd]['cron']);}}}})[_0x58da('0x2b')](function(_0x367a23){logger[_0x58da('0x29')](JSON[_0x58da('0x22')](_0x367a23));});}exports[_0x58da('0x58')]=function(_0x18c1b4){return getJobs(_0x18c1b4);};exports[_0x58da('0x59')]=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 8efcc01..b110083 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 _0x5eb1=['data1','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','then','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','bucket','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','catch','SequelizeValidationError','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','forEach','push','all','name','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5eb1,0x7c));var _0x15eb=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x5eb1[_0x262323];return _0xa963c3;};var _=require('lodash');var AWS=require(_0x15eb('0x0'));var rp=require(_0x15eb('0x1'));var util=require(_0x15eb('0x2'));var BPromise=require(_0x15eb('0x3'));var db=require(_0x15eb('0x4'))['db'];var logger=require(_0x15eb('0x5'))('transcribe');function getTranscriptionJob(_0x3ba774,_0x19d816,_0x1f38c6,_0x46b053){return new Promise(function(_0x47e341,_0x1be042){var _0x212692=new AWS['TranscribeService']({'accessKeyId':_0x19d816,'secretAccessKey':_0x3ba774,'region':_0x1f38c6});_0x212692[_0x15eb('0x6')]({'TranscriptionJobName':_0x46b053},function(_0x160879,_0x730b12){if(_0x160879){return _0x1be042(_0x160879);}else{return _0x47e341(_0x730b12);}});});}function sentiment(_0x400f7d,_0x2c144a,_0x2ad2c1,_0x412db6,_0x1481ae){return new Promise(function(_0x295e45,_0x31e040){var _0x3f08c1=new AWS[(_0x15eb('0x7'))]({'accessKeyId':_0x2c144a,'secretAccessKey':_0x400f7d,'region':_0x2ad2c1});_0x3f08c1[_0x15eb('0x8')]({'Text':_0x412db6,'LanguageCode':_0x1481ae['substring'](0x0,0x2)},function(_0x296012,_0x4c814c){if(_0x296012){return _0x31e040(_0x296012);}else{return _0x295e45(_0x4c814c);}});});}function checkTranscribeJob(_0x5e678a,_0x498a0c,_0xda1ddf){var _0x330436;return new BPromise(function(_0x430ea8,_0x3c9a77){logger['info'](util[_0x15eb('0x9')](_0x15eb('0xa'),_0x5e678a['id'],_0x5e678a[_0x15eb('0xb')]));return getTranscriptionJob(_0xda1ddf[_0x15eb('0xc')],_0xda1ddf['data2'],_0x498a0c['transcribeRegion'],_0x5e678a['transcribeName'])['then'](function(_0x1188e0){logger['info'](util['format'](_0x15eb('0xd'),_0x5e678a['id'],_0x5e678a['transcribeName'],_0x1188e0[_0x15eb('0xe')]['TranscriptionJobStatus']));if(!_0x5e678a[_0x15eb('0xf')]){switch(_0x1188e0['TranscriptionJob'][_0x15eb('0x10')]){case _0x15eb('0x11'):var _0x5cc4b1={'transcribeStatus':_0x1188e0[_0x15eb('0xe')][_0x15eb('0x10')],'fileUri':_0x1188e0['TranscriptionJob'][_0x15eb('0x12')][_0x15eb('0x13')]};logger[_0x15eb('0x14')](util[_0x15eb('0x9')](_0x15eb('0x15'),_0x5e678a['id']));return rp({'uri':_0x1188e0[_0x15eb('0xe')]['Transcript'][_0x15eb('0x13')],'json':!![]})['then'](function(_0x2603fe){logger['info'](util[_0x15eb('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5e678a['id']));if(_0x2603fe&&_0x2603fe[_0x15eb('0x16')]&&_0x2603fe[_0x15eb('0x16')][_0x15eb('0x17')]&&_0x2603fe[_0x15eb('0x16')][_0x15eb('0x17')][_0x15eb('0x18')]){_0x5cc4b1[_0x15eb('0xf')]='';for(var _0x44207c=0x0;_0x44207c<_0x2603fe[_0x15eb('0x16')][_0x15eb('0x17')]['length'];_0x44207c++){_0x5cc4b1[_0x15eb('0xf')]+=_0x2603fe[_0x15eb('0x16')][_0x15eb('0x17')][_0x44207c][_0x15eb('0x19')]+'';}}return _0x5e678a[_0x15eb('0x1a')](_0x5cc4b1);})[_0x15eb('0x1b')](function(){logger[_0x15eb('0x14')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5e678a['id']));if(!_0x5e678a[_0x15eb('0x1c')]){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))](_0x15eb('0x1f'));}if(!_0x498a0c['sentiment']||!_0x498a0c[_0x15eb('0x20')]||!_0x498a0c['sentimentRegion']||!_0x498a0c[_0x15eb('0x21')]||!_0x498a0c['bucket']){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))](_0x15eb('0x22'));}if(!_0x5cc4b1[_0x15eb('0xf')]){throw new Error(_0x15eb('0x23'));}if(_0x498a0c[_0x15eb('0x20')]===_0xda1ddf['id']){return _0xda1ddf;}else{return db['CloudProvider'][_0x15eb('0x24')]({'where':{'id':_settings[_0x15eb('0x20')]}});}})[_0x15eb('0x1b')](function(_0x586a8e){if(!_0x586a8e){throw new db['Sequelize'][(_0x15eb('0x1e'))](_0x15eb('0x25'));}if(!_0x586a8e['data1']||!_0x586a8e['data2']){throw new db['Sequelize'][(_0x15eb('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x330436=_0x586a8e;logger[_0x15eb('0x14')](util[_0x15eb('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5e678a['id']));return sentiment(_0x330436[_0x15eb('0xc')],_0x330436[_0x15eb('0x26')],_0x498a0c[_0x15eb('0x27')],_0x5cc4b1[_0x15eb('0xf')],_0x498a0c[_0x15eb('0x21')]);})[_0x15eb('0x1b')](function(_0x5706b9){logger[_0x15eb('0x14')](util[_0x15eb('0x9')](_0x15eb('0x28'),_0x5e678a['id']));return _0x5e678a[_0x15eb('0x1a')]({'sentiment':_0x5706b9[_0x15eb('0x29')],'sPositive':_0x5706b9['SentimentScore'][_0x15eb('0x2a')],'sNegative':_0x5706b9[_0x15eb('0x2b')]['Negative'],'sMixed':_0x5706b9[_0x15eb('0x2b')][_0x15eb('0x2c')],'sNeutral':_0x5706b9['SentimentScore'][_0x15eb('0x2d')]});})['then'](function(){logger[_0x15eb('0x14')](util['format'](_0x15eb('0x2e'),_0x5e678a['id']));_0x430ea8();});case'FAILED':return _0x5e678a[_0x15eb('0x1a')]({'transcribeStatus':_0x15eb('0x2f'),'failureReason':_0x1188e0['TranscriptionJob']['FailureReason']})[_0x15eb('0x1b')](function(){logger[_0x15eb('0x14')](util[_0x15eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5e678a['id']));_0x430ea8();});default:logger[_0x15eb('0x14')](util['format'](_0x15eb('0x30'),_0x5e678a['id']));break;}}else{return BPromise['resolve']()[_0x15eb('0x1b')](function(){if(!_0x5e678a[_0x15eb('0x1c')]){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))](_0x15eb('0x1f'));}if(!_0x498a0c[_0x15eb('0x31')]||!_0x498a0c[_0x15eb('0x20')]||!_0x498a0c[_0x15eb('0x27')]||!_0x498a0c[_0x15eb('0x21')]||!_0x498a0c[_0x15eb('0x32')]){throw new db[(_0x15eb('0x1d'))]['ValidationError'](_0x15eb('0x22'));}if(!_0x5e678a[_0x15eb('0xf')]){throw new Error(_0x15eb('0x23'));}if(_0x498a0c[_0x15eb('0x20')]===_0xda1ddf['id']){return _0xda1ddf;}else{return db['CloudProvider'][_0x15eb('0x24')]({'where':{'id':_settings[_0x15eb('0x20')]}});}})[_0x15eb('0x1b')](function(_0x180370){if(!_0x180370){throw new db[(_0x15eb('0x1d'))]['ValidationError'](_0x15eb('0x25'));}if(!_0x180370[_0x15eb('0xc')]||!_0x180370['data2']){throw new db['Sequelize'][(_0x15eb('0x1e'))](_0x15eb('0x33'));}_0x330436=_0x180370;logger[_0x15eb('0x14')](util['format'](_0x15eb('0x34'),_0x5e678a['id']));return sentiment(_0x330436[_0x15eb('0xc')],_0x330436['data2'],_0x498a0c[_0x15eb('0x27')],_0x5e678a[_0x15eb('0xf')],_0x498a0c[_0x15eb('0x21')]);})[_0x15eb('0x1b')](function(_0x2197c3){logger[_0x15eb('0x14')](util['format'](_0x15eb('0x28'),_0x5e678a['id']));return _0x5e678a[_0x15eb('0x1a')]({'sentiment':_0x2197c3['Sentiment'],'sPositive':_0x2197c3[_0x15eb('0x2b')][_0x15eb('0x2a')],'sNegative':_0x2197c3[_0x15eb('0x2b')][_0x15eb('0x35')],'sMixed':_0x2197c3[_0x15eb('0x2b')][_0x15eb('0x2c')],'sNeutral':_0x2197c3['SentimentScore'][_0x15eb('0x2d')],'transcribeStatus':'COMPLETED'});})[_0x15eb('0x1b')](function(){logger['info'](util['format'](_0x15eb('0x2e'),_0x5e678a['id']));_0x430ea8();});}})[_0x15eb('0x36')](function(_0x38adc0){if(_0x38adc0){if(!_0x38adc0['name']||_0x38adc0['name']!==_0x15eb('0x37')){logger['error'](util[_0x15eb('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5e678a['id']),util[_0x15eb('0x38')](_0x38adc0,{'showHidden':![],'depth':null}));}}_0x430ea8();});});}function checkTranscribe(){var _0x472317;var _0x2457f5;var _0x50d0a;return db['VoiceRecording'][_0x15eb('0x39')]({'where':{'transcribeStatus':_0x15eb('0x3a')}})['then'](function(_0x475f2f){if(!_0x475f2f||!_0x475f2f[_0x15eb('0x18')]){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))](_0x15eb('0x3b'));}_0x472317=_0x475f2f;return db[_0x15eb('0x3c')][_0x15eb('0x24')]({'where':{'id':0x1}});})[_0x15eb('0x1b')](function(_0x33e324){if(!_0x33e324){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))]('Settings\x20not\x20available');}_0x2457f5=_0x33e324;if(!_0x2457f5[_0x15eb('0x3d')]||!_0x2457f5[_0x15eb('0x3e')]||!_0x2457f5['transcribeRegion']||!_0x2457f5[_0x15eb('0x21')]||!_0x2457f5[_0x15eb('0x32')]){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x15eb('0x24')]({'where':{'id':_0x2457f5[_0x15eb('0x3e')]}});})[_0x15eb('0x1b')](function(_0x5ba037){if(!_0x5ba037){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ba037[_0x15eb('0xc')]||!_0x5ba037[_0x15eb('0x26')]){throw new db[(_0x15eb('0x1d'))][(_0x15eb('0x1e'))](_0x15eb('0x33'));}_0x50d0a=_0x5ba037;var _0x2f29c7=[];_0x472317[_0x15eb('0x3f')](function(_0x47cb11){_0x2f29c7[_0x15eb('0x40')](checkTranscribeJob(_0x47cb11,_0x2457f5,_0x50d0a));});return BPromise[_0x15eb('0x41')](_0x2f29c7);})['catch'](function(_0x140973){if(_0x140973){if(!_0x140973[_0x15eb('0x42')]||_0x140973[_0x15eb('0x42')]!==_0x15eb('0x37')){logger['error'](util['inspect'](_0x140973,{'showHidden':![],'depth':null}));}}});}exports[_0x15eb('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8efc=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','sentiment','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','bucket','transcribeAccountId','push','all','inspect','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x11b12c,_0x970de4){var _0x4fd9f4=function(_0x412dd8){while(--_0x412dd8){_0x11b12c['push'](_0x11b12c['shift']());}};_0x4fd9f4(++_0x970de4);}(_0x8efc,0xb3));var _0xc8ef=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0x8efc[_0x6899c7];return _0x5186ee;};var _=require('lodash');var AWS=require(_0xc8ef('0x0'));var rp=require(_0xc8ef('0x1'));var util=require(_0xc8ef('0x2'));var BPromise=require(_0xc8ef('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc8ef('0x4'))(_0xc8ef('0x5'));function getTranscriptionJob(_0x33b9c9,_0x50d1f6,_0x2910b5,_0x3c6189){return new Promise(function(_0x1cd466,_0x13b433){var _0x576ff9=new AWS[(_0xc8ef('0x6'))]({'accessKeyId':_0x50d1f6,'secretAccessKey':_0x33b9c9,'region':_0x2910b5});_0x576ff9[_0xc8ef('0x7')]({'TranscriptionJobName':_0x3c6189},function(_0x1c8931,_0x489778){if(_0x1c8931){return _0x13b433(_0x1c8931);}else{return _0x1cd466(_0x489778);}});});}function sentiment(_0x11f3ba,_0x443ee3,_0x1a9a5f,_0xcc3c21,_0x56cfb1){return new Promise(function(_0x315d93,_0x574588){var _0x45dbd3=new AWS[(_0xc8ef('0x8'))]({'accessKeyId':_0x443ee3,'secretAccessKey':_0x11f3ba,'region':_0x1a9a5f});_0x45dbd3[_0xc8ef('0x9')]({'Text':_0xcc3c21,'LanguageCode':_0x56cfb1[_0xc8ef('0xa')](0x0,0x2)},function(_0xa76b59,_0x44d7da){if(_0xa76b59){return _0x574588(_0xa76b59);}else{return _0x315d93(_0x44d7da);}});});}function checkTranscribeJob(_0x18213f,_0x1c6744,_0xb90ed0){var _0x15669b;return new BPromise(function(_0x3e7c04,_0x1207d8){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0xd'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')]));return getTranscriptionJob(_0xb90ed0[_0xc8ef('0xf')],_0xb90ed0[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x11')],_0x18213f[_0xc8ef('0xe')])[_0xc8ef('0x12')](function(_0x45eb4b){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x13'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')],_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]));if(!_0x18213f[_0xc8ef('0x16')]){switch(_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]){case _0xc8ef('0x17'):var _0x3591c={'transcribeStatus':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x15')],'fileUri':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x18')]['TranscriptFileUri']};logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x19'),_0x18213f['id']));return rp({'uri':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x18')][_0xc8ef('0x1a')],'json':!![]})[_0xc8ef('0x12')](function(_0x4c57e3){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x1b'),_0x18213f['id']));if(_0x4c57e3&&_0x4c57e3['results']&&_0x4c57e3[_0xc8ef('0x1c')]['transcripts']&&_0x4c57e3['results']['transcripts']['length']){_0x3591c[_0xc8ef('0x16')]='';for(var _0x128556=0x0;_0x128556<_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0xc8ef('0x1e')];_0x128556++){_0x3591c[_0xc8ef('0x16')]+=_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0x128556][_0xc8ef('0x1f')]+'';}}return _0x18213f[_0xc8ef('0x20')](_0x3591c);})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));if(!_0x18213f['tempSentiment']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744['sentiment']||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744['sentimentRegion']||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x26'));}if(!_0x3591c[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc8ef('0x12')](function(_0x3bde31){if(!_0x3bde31){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x29'));}if(!_0x3bde31[_0xc8ef('0xf')]||!_0x3bde31[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x2a'));}_0x15669b=_0x3bde31;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x2b')],_0x3591c[_0xc8ef('0x16')],_0x1c6744['language']);})[_0xc8ef('0x12')](function(_0x1890de){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f['update']({'sentiment':_0x1890de['Sentiment'],'sPositive':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x1890de[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x1890de['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x30')]});})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});case _0xc8ef('0x31'):return _0x18213f[_0xc8ef('0x20')]({'transcribeStatus':_0xc8ef('0x31'),'failureReason':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x32')]})['then'](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x18213f['id']));_0x3e7c04();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x18213f['id']));break;}}else{return BPromise[_0xc8ef('0x33')]()['then'](function(){if(!_0x18213f[_0xc8ef('0x34')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744[_0xc8ef('0x35')]||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744[_0xc8ef('0x2b')]||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x26'));}if(!_0x18213f[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings[_0xc8ef('0x24')]}});}})[_0xc8ef('0x12')](function(_0x351109){if(!_0x351109){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x29'));}if(!_0x351109['data1']||!_0x351109[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x15669b=_0x351109;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b['data2'],_0x1c6744[_0xc8ef('0x2b')],_0x18213f[_0xc8ef('0x16')],_0x1c6744[_0xc8ef('0x25')]);})['then'](function(_0x5b1ef1){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f[_0xc8ef('0x20')]({'sentiment':_0x5b1ef1[_0xc8ef('0x36')],'sPositive':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x5b1ef1[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x5b1ef1['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x30')],'transcribeStatus':_0xc8ef('0x17')});})[_0xc8ef('0x12')](function(){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});}})[_0xc8ef('0x37')](function(_0xc932df){if(_0xc932df){if(!_0xc932df['name']||_0xc932df[_0xc8ef('0x38')]!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util['format'](_0xc8ef('0x3b'),_0x18213f['id']),util['inspect'](_0xc932df,{'showHidden':![],'depth':null}));}}_0x3e7c04();});});}function checkTranscribe(){var _0x7e5c5a;var _0x52eac7;var _0x3dbb7a;return db[_0xc8ef('0x3c')][_0xc8ef('0x3d')]({'where':{'transcribeStatus':_0xc8ef('0x3e')}})[_0xc8ef('0x12')](function(_0x3e0398){if(!_0x3e0398||!_0x3e0398[_0xc8ef('0x1e')]){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x3f'));}_0x7e5c5a=_0x3e0398;return db[_0xc8ef('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0xe997a){if(!_0xe997a){throw new db['Sequelize'][(_0xc8ef('0x23'))]('Settings\x20not\x20available');}_0x52eac7=_0xe997a;if(!_0x52eac7[_0xc8ef('0x5')]||!_0x52eac7['transcribeAccountId']||!_0x52eac7[_0xc8ef('0x11')]||!_0x52eac7[_0xc8ef('0x25')]||!_0x52eac7[_0xc8ef('0x41')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_0x52eac7[_0xc8ef('0x42')]}});})[_0xc8ef('0x12')](function(_0x1b460a){if(!_0x1b460a){throw new db[(_0xc8ef('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1b460a[_0xc8ef('0xf')]||!_0x1b460a[_0xc8ef('0x10')]){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x2a'));}_0x3dbb7a=_0x1b460a;var _0x1cfab1=[];_0x7e5c5a['forEach'](function(_0x479742){_0x1cfab1[_0xc8ef('0x43')](checkTranscribeJob(_0x479742,_0x52eac7,_0x3dbb7a));});return BPromise[_0xc8ef('0x44')](_0x1cfab1);})[_0xc8ef('0x37')](function(_0xb58103){if(_0xb58103){if(!_0xb58103[_0xc8ef('0x38')]||_0xb58103['name']!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util[_0xc8ef('0x45')](_0xb58103,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 70dfb44..b5052bd 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 _0x777d=['then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x777d,0x1e0));var _0xd777=function(_0x31d6c2,_0x422dcd){_0x31d6c2=_0x31d6c2-0x0;var _0x295dd0=_0x777d[_0x31d6c2];return _0x295dd0;};'use strict';var _=require(_0xd777('0x0'));var moment=require('moment');var Redis=require(_0xd777('0x1'));var util=require(_0xd777('0x2'));var config=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var logger=require(_0xd777('0x5'))(_0xd777('0x6'));config[_0xd777('0x7')]=_[_0xd777('0x8')](config[_0xd777('0x7')],{'host':_0xd777('0x9'),'port':0x18eb});var io=require(_0xd777('0xa'))(new Redis(config[_0xd777('0x7')]));function closeInteractions(){var _0x32b89c=[];return db[_0xd777('0xb')][_0xd777('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd777('0xd')](0x18,_0xd777('0xe'))}}})[_0xd777('0xf')](function(_0x4dfc23){if(_0x4dfc23&&_0x4dfc23[_0xd777('0x10')]){_0x32b89c=_['map'](_0x4dfc23||[],'id');logger['info'](_0xd777('0x11'),_0x32b89c[_0xd777('0x12')]());return db['WhatsappInteraction'][_0xd777('0x13')]({'closeReason':_0xd777('0x14'),'disposition':_0xd777('0x15'),'closed':!![],'closedAt':moment()[_0xd777('0x16')](_0xd777('0x17'))},{'where':{'id':_0x32b89c}});}})[_0xd777('0xf')](function(){if(_0x32b89c&&_0x32b89c[_0xd777('0x10')]){logger[_0xd777('0x18')](_0xd777('0x19'),_0x32b89c[_0xd777('0x12')]());for(var _0x24b1dd=0x0;_0x24b1dd<_0x32b89c['length'];_0x24b1dd++){io[_0xd777('0x1a')](_0xd777('0x1b'),{'id':_0x32b89c[_0x24b1dd],'closed':!![]});}}})[_0xd777('0x1c')](function(_0x3e128f){logger[_0xd777('0x1d')](_0xd777('0x1e'),_0x3e128f?util[_0xd777('0x1f')](_0x3e128f,{'showHidden':![],'depth':null}):'');});}exports[_0xd777('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb724=['system','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','update'];(function(_0x51bdcf,_0x2a8db8){var _0x1f5c10=function(_0x3c2728){while(--_0x3c2728){_0x51bdcf['push'](_0x51bdcf['shift']());}};_0x1f5c10(++_0x2a8db8);}(_0xb724,0x19f));var _0x4b72=function(_0x5f32ed,_0x4af48a){_0x5f32ed=_0x5f32ed-0x0;var _0x373ffb=_0xb724[_0x5f32ed];return _0x373ffb;};'use strict';var _=require(_0x4b72('0x0'));var moment=require(_0x4b72('0x1'));var Redis=require('ioredis');var util=require(_0x4b72('0x2'));var config=require('../../config/environment');var db=require(_0x4b72('0x3'))['db'];var logger=require('../logger')(_0x4b72('0x4'));config['redis']=_[_0x4b72('0x5')](config['redis'],{'host':_0x4b72('0x6'),'port':0x18eb});var io=require(_0x4b72('0x7'))(new Redis(config[_0x4b72('0x8')]));function closeInteractions(){var _0x2b9673=[];return db[_0x4b72('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x4b72('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4b72('0xb')](0x18,_0x4b72('0xc'))}}})[_0x4b72('0xd')](function(_0x269b4a){if(_0x269b4a&&_0x269b4a[_0x4b72('0xe')]){_0x2b9673=_['map'](_0x269b4a||[],'id');logger['info'](_0x4b72('0xf'),_0x2b9673['join']());return db[_0x4b72('0x9')][_0x4b72('0x10')]({'closeReason':_0x4b72('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x4b72('0x12'))},{'where':{'id':_0x2b9673}});}})['then'](function(){if(_0x2b9673&&_0x2b9673[_0x4b72('0xe')]){logger[_0x4b72('0x13')](_0x4b72('0x14'),_0x2b9673[_0x4b72('0x15')]());for(var _0x30a968=0x0;_0x30a968<_0x2b9673[_0x4b72('0xe')];_0x30a968++){io[_0x4b72('0x16')](_0x4b72('0x17'),{'id':_0x2b9673[_0x30a968],'closed':!![]});}}})['catch'](function(_0x4ae3e0){logger[_0x4b72('0x18')](_0x4b72('0x19'),_0x4ae3e0?util['inspect'](_0x4ae3e0,{'showHidden':![],'depth':null}):'');});}exports[_0x4b72('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 222e704..f967292 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89f5=['@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','CmHopper','log','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x6d033b,_0x28cdef){var _0x323e7a=function(_0x3458d5){while(--_0x3458d5){_0x6d033b['push'](_0x6d033b['shift']());}};_0x323e7a(++_0x28cdef);}(_0x89f5,0x163));var _0x589f=function(_0x26ad12,_0x28ae3b){_0x26ad12=_0x26ad12-0x0;var _0x5032be=_0x89f5[_0x26ad12];return _0x5032be;};'use strict';var util=require(_0x589f('0x0'));var db=require(_0x589f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x589f('0x2')]({'id':i,'firstName':_0x589f('0x3')+i,'lastName':_0x589f('0x4')+i,'phone':0xf879fb460+i,'email':_0x589f('0x5')+i+_0x589f('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x589f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x589f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x589f('0x7')](),'updatedAt':Date[_0x589f('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x589f('0x3')+i,'lastName':_0x589f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x589f('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x589f('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x589f('0x7')](),'updatedAt':Date[_0x589f('0x7')]()});}db[_0x589f('0x8')][_0x589f('0x9')]({'where':{}})[_0x589f('0xa')](function(){return db[_0x589f('0x8')][_0x589f('0xb')](contacts);})[_0x589f('0xa')](function(){console['log'](_0x589f('0xc'),'contacts1');return db[_0x589f('0xd')][_0x589f('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x589f('0xb')](hopper);})[_0x589f('0xa')](function(){console[_0x589f('0xe')](_0x589f('0xc'),_0x589f('0xf'));return db[_0x589f('0x8')][_0x589f('0xb')](contacts2);})[_0x589f('0xa')](function(){console[_0x589f('0xe')]('finished\x20populating',_0x589f('0x10'));return db[_0x589f('0xd')][_0x589f('0xb')](hopper2);})[_0x589f('0xa')](function(){console[_0x589f('0xe')](_0x589f('0xc'),_0x589f('0x11'));})[_0x589f('0x12')](function(_0x244a83){console['log'](_0x244a83);}); \ No newline at end of file +var _0x72ed=['now','destroy','CmContact','then','finished\x20populating','CmHopper','bulkCreate','log','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0x72ed,0xc0));var _0xd72e=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x72ed[_0x4e9d3c];return _0x2d0825;};'use strict';var util=require(_0xd72e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd72e('0x1')]({'id':i,'firstName':_0xd72e('0x2')+i,'lastName':_0xd72e('0x3')+i,'phone':0xf879fb460+i,'email':_0xd72e('0x4')+i+_0xd72e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd72e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd72e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd72e('0x1')]({'id':i,'firstName':_0xd72e('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd72e('0x4')+i+_0xd72e('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd72e('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd72e('0x6')]()});}db['CmContact'][_0xd72e('0x7')]({'where':{}})['then'](function(){return db[_0xd72e('0x8')]['bulkCreate'](contacts);})[_0xd72e('0x9')](function(){console['log'](_0xd72e('0xa'),'contacts1');return db[_0xd72e('0xb')][_0xd72e('0x7')]({'where':{}});})['then'](function(){return db[_0xd72e('0xb')][_0xd72e('0xc')](hopper);})[_0xd72e('0x9')](function(){console[_0xd72e('0xd')](_0xd72e('0xa'),_0xd72e('0xe'));return db['CmContact']['bulkCreate'](contacts2);})[_0xd72e('0x9')](function(){console[_0xd72e('0xd')](_0xd72e('0xa'),_0xd72e('0xf'));return db['CmHopper'][_0xd72e('0xc')](hopper2);})[_0xd72e('0x9')](function(){console[_0xd72e('0xd')](_0xd72e('0xa'),_0xd72e('0x10'));})[_0xd72e('0x11')](function(_0x240a5b){console[_0xd72e('0xd')](_0x240a5b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1358ff9..934b126 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3aeb=['agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','util','../mysqldb','push','format'];(function(_0x2b093d,_0x49ba43){var _0x90e5bd=function(_0x583994){while(--_0x583994){_0x2b093d['push'](_0x2b093d['shift']());}};_0x90e5bd(++_0x49ba43);}(_0x3aeb,0x114));var _0xb3ae=function(_0x2065f7,_0x2f3111){_0x2065f7=_0x2065f7-0x0;var _0xdbb6fe=_0x3aeb[_0x2065f7];return _0xdbb6fe;};'use strict';var util=require(_0xb3ae('0x0'));var db=require(_0xb3ae('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb3ae('0x2')]({'name':util[_0xb3ae('0x3')]('%s%s',_0xb3ae('0x4'),i),'fullname':util[_0xb3ae('0x3')](_0xb3ae('0x5'),_0xb3ae('0x4'),i),'email':util['format'](_0xb3ae('0x6'),_0xb3ae('0x4'),i),'role':_0xb3ae('0x4'),'password':_0xb3ae('0x7'),'internal':0xfa0+i,'type':_0xb3ae('0x8'),'transport':[_0xb3ae('0x9'),'ws',_0xb3ae('0xa')],'disallow':[_0xb3ae('0xb')],'allow':[_0xb3ae('0xc')],'defaultuser':util[_0xb3ae('0x3')](_0xb3ae('0x5'),_0xb3ae('0x4'),i),'encryption':_0xb3ae('0xd'),'avpf':_0xb3ae('0xd'),'force_avp':_0xb3ae('0xd'),'icesupport':_0xb3ae('0xd'),'dtlsenable':_0xb3ae('0xd'),'dtlsverify':'no','dtlscertfile':_0xb3ae('0xe'),'dtlsprivatekey':_0xb3ae('0xf'),'dtlssetup':'actpass','callerid':util[_0xb3ae('0x3')](_0xb3ae('0x10'),util['format'](_0xb3ae('0x5'),_0xb3ae('0x4'),i),0xfa0+i)});}db[_0xb3ae('0x11')]['bulkCreate'](users)[_0xb3ae('0x12')](function(){console[_0xb3ae('0x13')]('add\x20user');})['catch'](function(_0xc2ef48){console['log'](_0xc2ef48);}); \ No newline at end of file +var _0x0145=['%s%s','agent','%s%s@xcally.com','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format'];(function(_0x5cdebc,_0x21810f){var _0x4c56c7=function(_0xe0e6e){while(--_0xe0e6e){_0x5cdebc['push'](_0x5cdebc['shift']());}};_0x4c56c7(++_0x21810f);}(_0x0145,0xed));var _0x5014=function(_0x13350d,_0x55acc9){_0x13350d=_0x13350d-0x0;var _0x5c7f99=_0x0145[_0x13350d];return _0x5c7f99;};'use strict';var util=require(_0x5014('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5014('0x1')]({'name':util[_0x5014('0x2')](_0x5014('0x3'),_0x5014('0x4'),i),'fullname':util[_0x5014('0x2')](_0x5014('0x3'),_0x5014('0x4'),i),'email':util['format'](_0x5014('0x5'),'agent',i),'role':_0x5014('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x5014('0x6'),'ws','wss'],'disallow':[_0x5014('0x7')],'allow':[_0x5014('0x8')],'defaultuser':util[_0x5014('0x2')](_0x5014('0x3'),_0x5014('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0x5014('0x9'),'icesupport':'yes','dtlsenable':_0x5014('0x9'),'dtlsverify':'no','dtlscertfile':_0x5014('0xa'),'dtlsprivatekey':_0x5014('0xb'),'dtlssetup':_0x5014('0xc'),'callerid':util[_0x5014('0x2')](_0x5014('0xd'),util[_0x5014('0x2')](_0x5014('0x3'),_0x5014('0x4'),i),0xfa0+i)});}db[_0x5014('0xe')][_0x5014('0xf')](users)[_0x5014('0x10')](function(){console[_0x5014('0x11')](_0x5014('0x12'));})[_0x5014('0x13')](function(_0x276a67){console[_0x5014('0x11')](_0x276a67);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0e2bbf6..a179c67 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','role','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','SmsQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','then','where','Campaign'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c39ae,_0x4f9763){_0x3c39ae=_0x3c39ae-0x0;var _0x24a2a0=_0x2ef3[_0x3c39ae];return _0x24a2a0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var db=require(_0x32ef('0x3'))['db'];var config=require(_0x32ef('0x4'));var queryQueues={'attributes':['id',_0x32ef('0x5')],'include':[{'as':'Agents','model':db[_0x32ef('0x6')],'attributes':['id',_0x32ef('0x5'),'role'],'raw':!![],'where':{'role':_0x32ef('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':_0x32ef('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x32ef('0x5'),_0x32ef('0x8')],'where':{'type':_0x32ef('0x9')}};function getAssociatedResources(_0x298066,_0x2484a0,_0x2bbb50){return db[_0x32ef('0xa')][_0x32ef('0xb')]({'where':{'name':_0x298066,'userProfileId':_0x2484a0},'raw':!![]})['then'](function(_0x5780e9){if(_0x5780e9){if(_0x5780e9[_0x32ef('0xc')]){switch(_0x298066){case _0x32ef('0xd'):case _0x32ef('0xe'):case _0x32ef('0xf'):case'SmsQueues':case _0x32ef('0x10'):case'OpenchannelQueues':case _0x32ef('0x11'):return db[_0x2bbb50]['findAll'](queryQueues);case _0x32ef('0x12'):return db[_0x2bbb50][_0x32ef('0x13')](queryTelephones);case'Trunks':return db[_0x2bbb50]['findAll'](queryTrunks);case _0x32ef('0x14'):return db[_0x2bbb50]['findAll'](queryCampaigns);}}else{return db[_0x32ef('0x15')][_0x32ef('0x13')]({'attributes':[_0x32ef('0x16')],'where':{'sectionId':_0x5780e9['id']},'raw':!![]})[_0x32ef('0x17')](function(_0x57aff1){if(_0x57aff1){var _0x55bf0b={'where':{'id':_['map'](_0x57aff1,_0x32ef('0x16'))},'raw':!![]};switch(_0x2bbb50){case _0x32ef('0x6'):_0x55bf0b[_0x32ef('0x18')]['role']='telephone';break;case _0x32ef('0x19'):_0x55bf0b[_0x32ef('0x18')][_0x32ef('0x8')]='ivr';break;}return db[_0x2bbb50][_0x32ef('0x13')](_0x55bf0b);}else{return[];}});}}else{return[];}})[_0x32ef('0x17')](function(_0x4f4c98){return _0x4f4c98;});}function joinOrLeaveQueues(_0x304505,_0x314ef1,_0x26aff3,_0x251084){_0x304505[_0x314ef1](util[_0x32ef('0x1a')](_0x32ef('0x1b'),_0x26aff3,_0x251084['name']));if(_0x251084[_0x32ef('0x1c')]){for(var _0x5cc3ef=0x0;_0x5cc3ef<_0x251084[_0x32ef('0x1c')][_0x32ef('0x1d')];_0x5cc3ef+=0x1){_0x304505[_0x314ef1](util['format'](_0x32ef('0x1e'),_0x251084[_0x32ef('0x1c')][_0x5cc3ef][_0x32ef('0x5')]));}}}function joinOrLeave(_0x55f7f2,_0x57f5e5,_0x22f2d7){var _0xb30fab;if(_0x55f7f2[_0x32ef('0x1f')]['query']['id']){db['User'][_0x32ef('0x20')]({'attributes':['id','name','role',_0x32ef('0x21')],'where':{'id':_0x55f7f2[_0x32ef('0x1f')][_0x32ef('0x22')]['id']},'include':[{'model':db[_0x32ef('0x23')],'as':_0x32ef('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x25')],'as':_0x32ef('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x27')],'as':_0x32ef('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x29')],'as':_0x32ef('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2c')],'as':_0x32ef('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x12de1a){if(_0x12de1a){_0xb30fab=_0x12de1a;_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x12de1a[_0x32ef('0x5')]));var _0x50a95b=[];switch(_0x12de1a[_0x32ef('0x2e')]){case _0x32ef('0x2f'):_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));if(queryQueues[_0x32ef('0x32')](_0x32ef('0x33'))){delete queryQueues[_0x32ef('0x33')];}_0x50a95b['push'](db[_0x32ef('0x34')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x36')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x37')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x38')]['findAll'](queryQueues));_0x50a95b['push'](db[_0x32ef('0x39')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3a')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3b')][_0x32ef('0x13')](queryQueues));_0x50a95b['push'](db['User']['findAll'](queryTelephones));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3c')][_0x32ef('0x13')](queryTrunks));_0x50a95b['push'](db['Campaign'][_0x32ef('0x13')](queryCampaigns));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x6')]['findAll'](queryAgents));break;case'user':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xd'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x34')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xe'),_0x12de1a[_0x32ef('0x21')],'ChatQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xf'),_0x12de1a[_0x32ef('0x21')],'FaxQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3d'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x38')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x10'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x39')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3e'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3a')));_0x50a95b['push'](getAssociatedResources(_0x32ef('0x11'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3b')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x12'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x6')));_0x50a95b['push'](getAssociatedResources('Trunks',_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3c')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x14'),_0x12de1a['userProfileId'],_0x32ef('0x19')));_0x50a95b[_0x32ef('0x35')](db['User'][_0x32ef('0x13')](queryAgents));break;case'agent':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x3f')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x40')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x41')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a['getSmsQueues']({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x42')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x43')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x44')]({'attributes':['id',_0x32ef('0x5')]}));break;}return BPromise[_0x32ef('0x45')](_0x50a95b);}})['then'](function(_0x5cb6fc){if(_0x5cb6fc&&_0x5cb6fc[_0x32ef('0x1d')]){for(var _0x270826=0x0;_0x270826<_0x5cb6fc[_0x32ef('0x1d')];_0x270826+=0x1){for(var _0x13b270=0x0;_0x13b270<_0x5cb6fc[_0x270826][_0x32ef('0x1d')];_0x13b270+=0x1){switch(_0x270826){case 0x0:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x46'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x1:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x47'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x2:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x48'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x3:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x49'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x4:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4a'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x5:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4b'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x6:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4c'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x7:if(_0xb30fab[_0x32ef('0x2e')]!=='agent')_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4d'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x8:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x9:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4f'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x8')],_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0xa:_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;}}}}})[_0x32ef('0x17')](function(){if(_0x57f5e5==='leave'){var _0x515ac9=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x24')],'id');return _0xb30fab[_0x32ef('0x51')](_0x515ac9)[_0x32ef('0x17')](function(){for(var _0x34bd3e=0x0;_0x34bd3e<_0x515ac9[_0x32ef('0x1d')];_0x34bd3e+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x53'),{'ChatInteractionId':Number(_0x515ac9[_0x34bd3e]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x3697a7=_['map'](_0xb30fab[_0x32ef('0x26')],'id');return _0xb30fab[_0x32ef('0x55')](_0x3697a7)[_0x32ef('0x17')](function(){for(var _0x3fe01f=0x0;_0x3fe01f<_0x3697a7[_0x32ef('0x1d')];_0x3fe01f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3697a7[_0x3fe01f]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x31d5d8=_['map'](_0xb30fab[_0x32ef('0x28')],'id');return _0xb30fab['removeFaxInteractions'](_0x31d5d8)[_0x32ef('0x17')](function(){for(var _0xbe35b=0x0;_0xbe35b<_0x31d5d8['length'];_0xbe35b+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x31d5d8[_0xbe35b]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x2bff39=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x2a')],'id');return _0xb30fab[_0x32ef('0x56')](_0x2bff39)[_0x32ef('0x17')](function(){for(var _0x56260f=0x0;_0x56260f<_0x2bff39['length'];_0x56260f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2bff39[_0x56260f]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x89d0b3=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x57')],'id');return _0xb30fab[_0x32ef('0x58')](_0x89d0b3)[_0x32ef('0x17')](function(){for(var _0x316547=0x0;_0x316547<_0x89d0b3[_0x32ef('0x1d')];_0x316547+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x59'),{'OpenchannelInteractionId':Number(_0x89d0b3[_0x316547]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5==='leave'){var _0x120d9d=_[_0x32ef('0x50')](_0xb30fab['WhatsappInteractions'],'id');return _0xb30fab[_0x32ef('0x5a')](_0x120d9d)[_0x32ef('0x17')](function(){for(var _0x2b5703=0x0;_0x2b5703<_0x120d9d['length'];_0x2b5703+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x5b'),{'WhatsappInteractionId':Number(_0x120d9d[_0x2b5703]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x5c')](function(_0x52dfe0){_0x55f7f2['log'](_0x52dfe0);});}}function onDisconnect(_0x13ea1a,_0x47d8bf){joinOrLeave(_0x13ea1a,_0x32ef('0x54'),_0x47d8bf);}function onConnect(_0x5bb114){joinOrLeave(_0x5bb114,'join');}exports[_0x32ef('0x5d')]=function(_0x208989){_0x208989['on'](_0x32ef('0x5e'),function(_0x5dca6a){_0x5dca6a[_0x32ef('0x5f')](0x0);_0x5dca6a[_0x32ef('0x60')]=_0x5dca6a[_0x32ef('0x61')]['connection'][_0x32ef('0x62')]+':'+_0x5dca6a[_0x32ef('0x61')]['connection']['remotePort'];_0x5dca6a[_0x32ef('0x63')]=new Date();_0x5dca6a[_0x32ef('0x64')]=function(_0x2518a0){console[_0x32ef('0x64')](_0x32ef('0x65')+_0x5dca6a[_0x32ef('0x66')]['name']+'['+_0x5dca6a[_0x32ef('0x60')]+']',_0x2518a0);};_0x5dca6a['on'](_0x32ef('0x67'),function(){onDisconnect(_0x5dca6a,_0x208989);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x68'));});onConnect(_0x5dca6a);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x69'));});}; \ No newline at end of file +var _0xdbb9=['FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','ChatQueues','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','type','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','ivr','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x5671ed,_0x2464a6){_0x5671ed=_0x5671ed-0x0;var _0x295d6b=_0xdbb9[_0x5671ed];return _0x295d6b;};'use strict';var _=require('lodash');var util=require(_0x9dbb('0x0'));var BPromise=require(_0x9dbb('0x1'));var db=require(_0x9dbb('0x2'))['db'];var config=require(_0x9dbb('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x9dbb('0x4'),'model':db[_0x9dbb('0x5')],'attributes':['id',_0x9dbb('0x6'),_0x9dbb('0x7')],'raw':!![],'where':{'role':_0x9dbb('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9dbb('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x9dbb('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9dbb('0x6'),_0x9dbb('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x59b2fc,_0x2ea515,_0x3b7ecc){return db[_0x9dbb('0xa')]['findOne']({'where':{'name':_0x59b2fc,'userProfileId':_0x2ea515},'raw':!![]})[_0x9dbb('0xb')](function(_0x22f3b0){if(_0x22f3b0){if(_0x22f3b0[_0x9dbb('0xc')]){switch(_0x59b2fc){case _0x9dbb('0xd'):case'ChatQueues':case _0x9dbb('0xe'):case _0x9dbb('0xf'):case _0x9dbb('0x10'):case _0x9dbb('0x11'):case _0x9dbb('0x12'):return db[_0x3b7ecc][_0x9dbb('0x13')](queryQueues);case _0x9dbb('0x14'):return db[_0x3b7ecc][_0x9dbb('0x13')](queryTelephones);case _0x9dbb('0x15'):return db[_0x3b7ecc][_0x9dbb('0x13')](queryTrunks);case _0x9dbb('0x16'):return db[_0x3b7ecc][_0x9dbb('0x13')](queryCampaigns);}}else{return db[_0x9dbb('0x17')][_0x9dbb('0x13')]({'attributes':[_0x9dbb('0x18')],'where':{'sectionId':_0x22f3b0['id']},'raw':!![]})[_0x9dbb('0xb')](function(_0x528110){if(_0x528110){var _0x1366b2={'where':{'id':_[_0x9dbb('0x19')](_0x528110,_0x9dbb('0x18'))},'raw':!![]};switch(_0x3b7ecc){case _0x9dbb('0x5'):_0x1366b2[_0x9dbb('0x1a')]['role']=_0x9dbb('0x1b');break;case _0x9dbb('0x1c'):_0x1366b2[_0x9dbb('0x1a')][_0x9dbb('0x9')]=_0x9dbb('0x1d');break;}return db[_0x3b7ecc]['findAll'](_0x1366b2);}else{return[];}});}}else{return[];}})[_0x9dbb('0xb')](function(_0x4bb2e4){return _0x4bb2e4;});}function joinOrLeaveQueues(_0x3de435,_0x50b668,_0x5b0cde,_0x5d8250){_0x3de435[_0x50b668](util[_0x9dbb('0x1e')](_0x9dbb('0x1f'),_0x5b0cde,_0x5d8250[_0x9dbb('0x6')]));if(_0x5d8250['Agents']){for(var _0x50e5e3=0x0;_0x50e5e3<_0x5d8250['Agents'][_0x9dbb('0x20')];_0x50e5e3+=0x1){_0x3de435[_0x50b668](util[_0x9dbb('0x1e')]('user:%s',_0x5d8250['Agents'][_0x50e5e3]['name']));}}}function joinOrLeave(_0x3de932,_0x245d12,_0x10c06a){var _0x55e2ef;if(_0x3de932[_0x9dbb('0x21')][_0x9dbb('0x22')]['id']){db[_0x9dbb('0x5')][_0x9dbb('0x23')]({'attributes':['id',_0x9dbb('0x6'),_0x9dbb('0x7'),_0x9dbb('0x24')],'where':{'id':_0x3de932[_0x9dbb('0x21')][_0x9dbb('0x22')]['id']},'include':[{'model':db[_0x9dbb('0x25')],'as':_0x9dbb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x9dbb('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9dbb('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9dbb('0x29')],'as':_0x9dbb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x9dbb('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x25555c){if(_0x25555c){_0x55e2ef=_0x25555c;_0x3de932[_0x245d12](util[_0x9dbb('0x1e')]('user:%s',_0x25555c[_0x9dbb('0x6')]));var _0x2a82f0=[];switch(_0x25555c['role']){case _0x9dbb('0x2c'):_0x3de932[_0x245d12](_0x9dbb('0x2d'));_0x3de932[_0x245d12](_0x9dbb('0x2e'));if(queryQueues['hasOwnProperty'](_0x9dbb('0x2f'))){delete queryQueues['include'];}_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x31')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x32')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x33')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x34')]['findAll'](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x35')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x36')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x37')][_0x9dbb('0x13')](queryQueues));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x5')][_0x9dbb('0x13')](queryTelephones));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x38')][_0x9dbb('0x13')](queryTrunks));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x1c')]['findAll'](queryCampaigns));_0x2a82f0[_0x9dbb('0x30')](db[_0x9dbb('0x5')][_0x9dbb('0x13')](queryAgents));break;case'user':_0x3de932[_0x245d12](_0x9dbb('0x2d'));_0x3de932[_0x245d12](_0x9dbb('0x2e'));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0xd'),_0x25555c[_0x9dbb('0x24')],_0x9dbb('0x31')));_0x2a82f0['push'](getAssociatedResources(_0x9dbb('0x39'),_0x25555c['userProfileId'],_0x9dbb('0x32')));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0xe'),_0x25555c[_0x9dbb('0x24')],'FaxQueue'));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources('SmsQueues',_0x25555c[_0x9dbb('0x24')],'SmsQueue'));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0x10'),_0x25555c[_0x9dbb('0x24')],_0x9dbb('0x35')));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources('OpenchannelQueues',_0x25555c[_0x9dbb('0x24')],'OpenchannelQueue'));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0x12'),_0x25555c[_0x9dbb('0x24')],_0x9dbb('0x37')));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0x14'),_0x25555c[_0x9dbb('0x24')],'User'));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources('Trunks',_0x25555c[_0x9dbb('0x24')],_0x9dbb('0x38')));_0x2a82f0[_0x9dbb('0x30')](getAssociatedResources(_0x9dbb('0x16'),_0x25555c['userProfileId'],_0x9dbb('0x1c')));_0x2a82f0['push'](db[_0x9dbb('0x5')]['findAll'](queryAgents));break;case _0x9dbb('0x8'):_0x3de932[_0x245d12](_0x9dbb('0x2d'));_0x3de932[_0x245d12]('voice:outbound');_0x2a82f0['push'](_0x25555c[_0x9dbb('0x3a')]({'attributes':['id',_0x9dbb('0x6')]}));_0x2a82f0[_0x9dbb('0x30')](_0x25555c[_0x9dbb('0x3b')]({'attributes':['id',_0x9dbb('0x6')]}));_0x2a82f0[_0x9dbb('0x30')](_0x25555c[_0x9dbb('0x3c')]({'attributes':['id',_0x9dbb('0x6')]}));_0x2a82f0[_0x9dbb('0x30')](_0x25555c['getSmsQueues']({'attributes':['id',_0x9dbb('0x6')]}));_0x2a82f0['push'](_0x25555c[_0x9dbb('0x3d')]({'attributes':['id',_0x9dbb('0x6')]}));_0x2a82f0[_0x9dbb('0x30')](_0x25555c[_0x9dbb('0x3e')]({'attributes':['id','name']}));_0x2a82f0[_0x9dbb('0x30')](_0x25555c['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x9dbb('0x3f')](_0x2a82f0);}})[_0x9dbb('0xb')](function(_0x7674b4){if(_0x7674b4&&_0x7674b4[_0x9dbb('0x20')]){for(var _0x3c1b1c=0x0;_0x3c1b1c<_0x7674b4[_0x9dbb('0x20')];_0x3c1b1c+=0x1){for(var _0x48ee1a=0x0;_0x48ee1a<_0x7674b4[_0x3c1b1c][_0x9dbb('0x20')];_0x48ee1a+=0x1){switch(_0x3c1b1c){case 0x0:joinOrLeaveQueues(_0x3de932,_0x245d12,'voice',_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x1:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x40'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x2:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x41'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x3:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x42'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x4:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x43'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x5:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x44'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x6:joinOrLeaveQueues(_0x3de932,_0x245d12,_0x9dbb('0x45'),_0x7674b4[_0x3c1b1c][_0x48ee1a]);break;case 0x7:if(_0x55e2ef[_0x9dbb('0x7')]!==_0x9dbb('0x8'))_0x3de932[_0x245d12](util['format'](_0x9dbb('0x46'),_0x7674b4[_0x3c1b1c][_0x48ee1a]['name']));break;case 0x8:if(_0x55e2ef[_0x9dbb('0x7')]!==_0x9dbb('0x8'))_0x3de932[_0x245d12](util['format'](_0x9dbb('0x47'),_0x7674b4[_0x3c1b1c][_0x48ee1a]['name']));break;case 0x9:if(_0x55e2ef['role']!=='agent')_0x3de932[_0x245d12](util[_0x9dbb('0x1e')](_0x9dbb('0x48'),_0x7674b4[_0x3c1b1c][_0x48ee1a]['type'],_0x7674b4[_0x3c1b1c][_0x48ee1a][_0x9dbb('0x6')]));break;case 0xa:_0x3de932[_0x245d12](util['format'](_0x9dbb('0x49'),_0x7674b4[_0x3c1b1c][_0x48ee1a][_0x9dbb('0x6')]));break;}}}}})[_0x9dbb('0xb')](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0x3c7d16=_[_0x9dbb('0x19')](_0x55e2ef['ChatInteractions'],'id');return _0x55e2ef['removeChatInteractions'](_0x3c7d16)[_0x9dbb('0xb')](function(){for(var _0x5bd673=0x0;_0x5bd673<_0x3c7d16['length'];_0x5bd673+=0x1){_0x10c06a[_0x9dbb('0x4b')](_0x9dbb('0x4c'),{'ChatInteractionId':Number(_0x3c7d16[_0x5bd673]),'UserId':Number(_0x55e2ef['id'])});}});}})[_0x9dbb('0xb')](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0x4dd410=_[_0x9dbb('0x19')](_0x55e2ef[_0x9dbb('0x4d')],'id');return _0x55e2ef[_0x9dbb('0x4e')](_0x4dd410)['then'](function(){for(var _0x4d0030=0x0;_0x4d0030<_0x4dd410['length'];_0x4d0030+=0x1){_0x10c06a[_0x9dbb('0x4b')](_0x9dbb('0x4f'),{'MailInteractionId':Number(_0x4dd410[_0x4d0030]),'UserId':Number(_0x55e2ef['id'])});}});}})[_0x9dbb('0xb')](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0x46c48d=_[_0x9dbb('0x19')](_0x55e2ef[_0x9dbb('0x50')],'id');return _0x55e2ef[_0x9dbb('0x51')](_0x46c48d)[_0x9dbb('0xb')](function(){for(var _0x3a34ea=0x0;_0x3a34ea<_0x46c48d[_0x9dbb('0x20')];_0x3a34ea+=0x1){_0x10c06a[_0x9dbb('0x4b')](_0x9dbb('0x52'),{'FaxInteractionId':Number(_0x46c48d[_0x3a34ea]),'UserId':Number(_0x55e2ef['id'])});}});}})['then'](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0xc92dce=_[_0x9dbb('0x19')](_0x55e2ef[_0x9dbb('0x2a')],'id');return _0x55e2ef['removeSmsInteractions'](_0xc92dce)[_0x9dbb('0xb')](function(){for(var _0x29fd8e=0x0;_0x29fd8e<_0xc92dce[_0x9dbb('0x20')];_0x29fd8e+=0x1){_0x10c06a['emit'](_0x9dbb('0x53'),{'SmsInteractionId':Number(_0xc92dce[_0x29fd8e]),'UserId':Number(_0x55e2ef['id'])});}});}})[_0x9dbb('0xb')](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0x44b8c6=_['map'](_0x55e2ef[_0x9dbb('0x2b')],'id');return _0x55e2ef[_0x9dbb('0x54')](_0x44b8c6)[_0x9dbb('0xb')](function(){for(var _0x3696d6=0x0;_0x3696d6<_0x44b8c6[_0x9dbb('0x20')];_0x3696d6+=0x1){_0x10c06a['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x44b8c6[_0x3696d6]),'UserId':Number(_0x55e2ef['id'])});}});}})['then'](function(){if(_0x245d12===_0x9dbb('0x4a')){var _0x11d777=_[_0x9dbb('0x19')](_0x55e2ef[_0x9dbb('0x55')],'id');return _0x55e2ef['removeWhatsappInteractions'](_0x11d777)[_0x9dbb('0xb')](function(){for(var _0x3f0017=0x0;_0x3f0017<_0x11d777[_0x9dbb('0x20')];_0x3f0017+=0x1){_0x10c06a[_0x9dbb('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x11d777[_0x3f0017]),'UserId':Number(_0x55e2ef['id'])});}});}})[_0x9dbb('0x56')](function(_0xfc9f9c){_0x3de932[_0x9dbb('0x57')](_0xfc9f9c);});}}function onDisconnect(_0x40921c,_0x52bb0c){joinOrLeave(_0x40921c,_0x9dbb('0x4a'),_0x52bb0c);}function onConnect(_0x75ed7e){joinOrLeave(_0x75ed7e,_0x9dbb('0x58'));}exports['default']=function(_0x354461){_0x354461['on'](_0x9dbb('0x59'),function(_0x20bdc8){_0x20bdc8[_0x9dbb('0x5a')](0x0);_0x20bdc8[_0x9dbb('0x5b')]=_0x20bdc8[_0x9dbb('0x5c')]['connection'][_0x9dbb('0x5d')]+':'+_0x20bdc8[_0x9dbb('0x5c')]['connection'][_0x9dbb('0x5e')];_0x20bdc8[_0x9dbb('0x5f')]=new Date();_0x20bdc8[_0x9dbb('0x57')]=function(_0x5543e1){console[_0x9dbb('0x57')](_0x9dbb('0x60')+_0x20bdc8[_0x9dbb('0x61')][_0x9dbb('0x6')]+'['+_0x20bdc8['address']+']',_0x5543e1);};_0x20bdc8['on'](_0x9dbb('0x62'),function(){onDisconnect(_0x20bdc8,_0x354461);_0x20bdc8[_0x9dbb('0x57')](_0x9dbb('0x63'));});onConnect(_0x20bdc8);_0x20bdc8[_0x9dbb('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 53b759e..1fd8f53 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 _0x86e1=['name','incomingmessage','AfterCreateMessage','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterCreate','changed','closed','substatus','agent','AfterUpdate','User','find','fullname','email','internal','length','hasOwnProperty','model','hook','callback','util','../../mysqldb','triggers','client','http','Chat','ChatInteraction','newinteraction','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s'];(function(_0x1b8ef8,_0x5974af){var _0x5979dc=function(_0x490627){while(--_0x490627){_0x1b8ef8['push'](_0x1b8ef8['shift']());}};_0x5979dc(++_0x5974af);}(_0x86e1,0xf7));var _0x186e=function(_0x3b8341,_0x566ec4){_0x3b8341=_0x3b8341-0x0;var _0x57fc0a=_0x86e1[_0x3b8341];return _0x57fc0a;};'use strict';var util=require(_0x186e('0x0'));var db=require(_0x186e('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x186e('0x2'));var client=jayson[_0x186e('0x3')][_0x186e('0x4')]({'port':0x232a});var triggers=[{'channel':_0x186e('0x5'),'model':_0x186e('0x6'),'event':'afterCreate','condition':_0x186e('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0x186e('0x6'),'event':'afterUpdate','condition':_0x186e('0x8'),'callback':afterUpdate},{'channel':_0x186e('0x5'),'model':_0x186e('0x9'),'event':_0x186e('0xa'),'condition':_0x186e('0xb'),'callback':afterCreateMessage},{'channel':_0x186e('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x186e('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x186e('0xc'),'model':'SmsInteraction','event':_0x186e('0xa'),'condition':_0x186e('0x7'),'callback':afterCreate},{'channel':_0x186e('0xc'),'model':_0x186e('0xd'),'event':_0x186e('0xe'),'condition':_0x186e('0x8'),'callback':afterUpdate},{'channel':_0x186e('0xc'),'model':_0x186e('0xf'),'event':'afterCreate','condition':_0x186e('0xb'),'callback':afterCreateMessage},{'channel':_0x186e('0x10'),'model':_0x186e('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x186e('0x11'),'event':_0x186e('0xe'),'condition':_0x186e('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x186e('0x12'),'event':_0x186e('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x186e('0x13'),'model':_0x186e('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x186e('0x13'),'model':'FaxInteraction','event':_0x186e('0xe'),'condition':_0x186e('0x8'),'callback':afterUpdate},{'channel':_0x186e('0x13'),'model':_0x186e('0x15'),'event':_0x186e('0xa'),'condition':_0x186e('0xb'),'callback':afterCreateMessage},{'channel':_0x186e('0x16'),'model':_0x186e('0x17'),'event':_0x186e('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x186e('0x16'),'model':'MailInteraction','event':_0x186e('0xe'),'condition':_0x186e('0x8'),'callback':afterUpdate},{'channel':_0x186e('0x16'),'model':'MailMessage','event':_0x186e('0xa'),'condition':_0x186e('0xb'),'callback':afterCreateMessage},{'channel':_0x186e('0x18'),'model':_0x186e('0x19'),'event':'afterCreate','condition':_0x186e('0x7'),'callback':afterCreate},{'channel':_0x186e('0x18'),'model':'OpenchannelInteraction','event':_0x186e('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x186e('0x18'),'model':_0x186e('0x1a'),'event':'afterCreate','condition':_0x186e('0xb'),'callback':afterCreateMessage}];function request(_0x46dfd1){return client[_0x186e('0x1b')]('EventManager',_0x46dfd1)[_0x186e('0x1c')](function(_0x38f70f){logger[_0x186e('0x1d')](_0x186e('0x1e'),_0x186e('0x1f'),_0x38f70f);if(_0x38f70f[_0x186e('0x20')]){if(_0x38f70f[_0x186e('0x20')][_0x186e('0x21')]===0x1f4){logger[_0x186e('0x20')](_0x186e('0x1e'),_0x186e('0x1f'),_0x38f70f[_0x186e('0x20')]);}}})[_0x186e('0x22')](function(_0x107573){logger[_0x186e('0x20')]('Trigger,\x20%s',_0x186e('0x1f'),_0x107573);});}function afterCreateMessage(_0xf0d049){return function(_0x310219){_0x310219=_0x310219[_0x186e('0x23')]({'plain':!![]});_0x310219[_0x186e('0x24')]=_0xf0d049;_0x310219[_0x186e('0x25')]=_0xf0d049;_0x310219[_0x186e('0x26')]=_0x310219[_0x186e('0x27')];Promise[_0x186e('0x28')]()[_0x186e('0x1c')](function(){if(typeof _0x310219[_0x186e('0x29')]===_0x186e('0x2a'))return null;var _0x52f01a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x310219[_0x186e('0x29')];return db[_0x186e('0x2b')][_0x186e('0x2c')](_0x52f01a,{'type':db[_0x186e('0x2d')][_0x186e('0x2e')][_0x186e('0x2f')],'raw':!![]});})['then'](function(_0x2c7877){if(_0x2c7877){_0x310219[_0x186e('0x30')]=_0x2c7877[0x0];}if(typeof _0x310219[_0x186e('0x31')]==='undefined')return;return getAgent(_0x310219[_0x186e('0x31')]);})['then'](function(_0x4ee940){if(_0x4ee940){_0x310219[_0x186e('0x32')]=util[_0x186e('0x33')](_0x186e('0x34'),_0x4ee940[_0x186e('0x35')]);_0x310219['agent']=_0x4ee940;_0x310219['channel']=_0xf0d049;return request({'event':_0x186e('0x36'),'message':_0x310219});}else{return request({'event':'outgoingmessage','message':_0x310219});}})[_0x186e('0x22')](function(_0x53d936){logger[_0x186e('0x20')](_0x186e('0x1e'),_0x186e('0x37'),_0x53d936);});};}function afterCreateOfflineMessage(_0x43a6ef){return function(_0x4543d6){_0x4543d6=_0x4543d6[_0x186e('0x23')]({'plain':!![]});_0x4543d6[_0x186e('0x24')]=_0x43a6ef;_0x4543d6[_0x186e('0x25')]=_0x43a6ef;_0x4543d6[_0x186e('0x26')]=_0x186e('0x38');return request({'event':_0x4543d6[_0x186e('0x26')],'message':_0x4543d6});};}function afterCreate(_0x48b099,_0x4ab718){return function(_0x1cd04b){_0x1cd04b=_0x1cd04b[_0x186e('0x23')]({'plain':!![]});_0x1cd04b[_0x186e('0x24')]=_0x48b099;_0x1cd04b['motionChannel']=_0x48b099;_0x1cd04b[_0x186e('0x26')]=_0x186e('0x39');Promise[_0x186e('0x28')]()[_0x186e('0x1c')](function(){var _0xc60588=_0x186e('0x3a')+_0x1cd04b[_0x186e('0x29')];return db['sequelize'][_0x186e('0x2c')](_0xc60588,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]});})[_0x186e('0x1c')](function(_0x442ca7){if(_0x442ca7){_0x1cd04b[_0x186e('0x30')]=_0x442ca7[0x0];}if(typeof _0x1cd04b[_0x186e('0x31')]===_0x186e('0x2a'))return;return getAgent(_0x1cd04b[_0x186e('0x31')]);})['then'](function(_0x400e03){if(_0x400e03){_0x1cd04b['interface']=util[_0x186e('0x33')]('SIP/%s',_0x400e03[_0x186e('0x35')]);_0x1cd04b['agent']=_0x400e03;}return request({'event':_0x4ab718,'message':_0x1cd04b});})[_0x186e('0x22')](function(_0x4f49cb){logger[_0x186e('0x20')](_0x186e('0x1e'),_0x186e('0x3b'),_0x4f49cb);});};}function afterUpdate(_0x59f0bf){return function(_0x36da00){var _0x580648=_0x36da00[_0x186e('0x3c')](_0x186e('0x3d'))&&_0x36da00[_0x186e('0x3d')];var _0x2862e1=_0x36da00[_0x186e('0x3c')]('substatus');if(_0x580648||_0x2862e1){var _0x25a8b2=_0x580648?_0x186e('0x8'):_0x186e('0x3e');var _0x3b3383=_0x36da00[_0x186e('0x23')]({'plain':!![]});_0x3b3383[_0x186e('0x24')]=_0x59f0bf;_0x3b3383[_0x186e('0x25')]=_0x59f0bf;_0x3b3383[_0x186e('0x26')]=_0x580648?_0x186e('0x3d'):_0x186e('0x3e');var _0x16dd27=_0x186e('0x3a')+_0x3b3383[_0x186e('0x29')];return db['sequelize']['query'](_0x16dd27,{'type':db[_0x186e('0x2d')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x2bf0ca){if(_0x2bf0ca){_0x3b3383['contact']=_0x2bf0ca[0x0];}if(typeof _0x3b3383[_0x186e('0x31')]===_0x186e('0x2a'))return;return getAgent(_0x3b3383[_0x186e('0x31')]);})[_0x186e('0x1c')](function(_0x20e1b2){if(_0x20e1b2){_0x3b3383[_0x186e('0x32')]=util['format'](_0x186e('0x34'),_0x20e1b2[_0x186e('0x35')]);_0x3b3383[_0x186e('0x3f')]=_0x20e1b2;}return request({'event':_0x25a8b2,'message':_0x3b3383});})[_0x186e('0x22')](function(_0x363d28){logger[_0x186e('0x20')](_0x186e('0x1e'),_0x186e('0x40'),_0x363d28);});}};}function getAgent(_0x2a24d5){return db[_0x186e('0x41')][_0x186e('0x42')]({'where':{'id':_0x2a24d5},'attributes':['id','name',_0x186e('0x43'),_0x186e('0x44'),_0x186e('0x45')],'raw':!![]})['then'](function(_0x27140e){return _0x27140e;});}exports['default']=function(){for(var _0x1bb604=0x0;_0x1bb604=_0x2610a9[_0x86d9('0x14')]){throw Error(_0x86d9('0x15'));}_0x16a08b(_0x293c6a);})['catch'](function(_0x11caf7){_0xbce3bd(_0x11caf7);});});}; \ No newline at end of file +var _0x5dac=['lodash','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','catch'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x5dac,0x138));var _0xc5da=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5dac[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xc5da('0x0'));var BPromise=require(_0xc5da('0x1'));var db=require(_0xc5da('0x2'))['db'];var util=require(_0xc5da('0x3'));var channels=['voice',_0xc5da('0x4'),_0xc5da('0x5'),_0xc5da('0x6'),_0xc5da('0x7'),_0xc5da('0x8'),'openchannel'];exports[_0xc5da('0x9')]=function(){return channels;};exports[_0xc5da('0xa')]=function(_0x5f2202){_0x5f2202=_0x5f2202[_0xc5da('0xb')]();return _['includes'](channels,_0x5f2202);};exports[_0xc5da('0xc')]=function(_0x148e8d,_0x46c4a3,_0x2dd4f5,_0x4caaf1){var _0x4ac60b={'loginAttempts':_0x46c4a3,'blocked':_0x2dd4f5};if(!_[_0xc5da('0xd')](_0x4caaf1)){_0x4ac60b[_0xc5da('0xe')]=_0x4caaf1;}return _0x148e8d[_0xc5da('0xf')](_0x4ac60b);};exports[_0xc5da('0x10')]=function(_0x38c612){return new BPromise(function(_0x3debde,_0x7345bc){var _0x174699=0x0;if(_0x38c612[_0xc5da('0x11')]!==_0xc5da('0x12')){_0x3debde(_0x38c612);}db[_0xc5da('0x13')][_0xc5da('0x14')]({'where':{'role':_0xc5da('0x12'),'online':!![],'id':{'$ne':_0x38c612['id']}}})[_0xc5da('0x15')](function(_0x2c3717){_0x174699=_0x2c3717;return util['getLicense']();})[_0xc5da('0x15')](function(_0x5534a8){if(_0x5534a8&&_0x5534a8[_0xc5da('0x16')]&&_0x174699>=_0x5534a8[_0xc5da('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3debde(_0x38c612);})[_0xc5da('0x17')](function(_0x4def9a){_0x7345bc(_0x4def9a);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 14805a7..2d9a98e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Entity\x20not\x20found'];(function(_0x11b032,_0x5dd4ca){var _0x37ca0a=function(_0x5e2cd7){while(--_0x5e2cd7){_0x11b032['push'](_0x11b032['shift']());}};_0x37ca0a(++_0x5dd4ca);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xaa88[_0x2e2681];return _0x368a64;};'use strict';var util=require(_0x8aa8('0x0'));var logger=require(_0x8aa8('0x1'))(_0x8aa8('0x2'));var APIError=function(_0x51c79b,_0x4aee38){this[_0x8aa8('0x3')]=_0x51c79b||_0x8aa8('0x4');this[_0x8aa8('0x5')]=_0x4aee38||_0x8aa8('0x6');util[_0x8aa8('0x7')](APIError,Error);};var APIBadRequestError=function(_0x350e8b){this['message']=_0x350e8b||'Bad\x20Request';this[_0x8aa8('0x5')]='Bad\x20Request';util[_0x8aa8('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ed84d){this[_0x8aa8('0x3')]=_0x1ed84d||_0x8aa8('0x8');this['name']=_0x8aa8('0x9');util[_0x8aa8('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x224f25){switch(_0x224f25){case'Bad\x20Request':return 0x190;case _0x8aa8('0xa'),_0x8aa8('0xb'):return 0x193;case _0x8aa8('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x33cc5c){return function(_0x583688){logger[_0x8aa8('0xc')](_0x583688[_0x8aa8('0xd')]);var _0x50787d=getStatusCode(_0x583688[_0x8aa8('0x5')]);if(_0x583688[_0x8aa8('0x5')])delete _0x583688[_0x8aa8('0x5')];return _0x33cc5c['status'](_0x50787d)[_0x8aa8('0xe')](_0x583688);};}module[_0x8aa8('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb43b=['error','status','util','../config/logger','message','name','Error','inherits','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found'];(function(_0x4d7500,_0xc6bd4a){var _0x2e0d02=function(_0x16cb8b){while(--_0x16cb8b){_0x4d7500['push'](_0x4d7500['shift']());}};_0x2e0d02(++_0xc6bd4a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x556088,_0x324e0b){_0x556088=_0x556088-0x0;var _0xd0d2f4=_0xb43b[_0x556088];return _0xd0d2f4;};'use strict';var util=require(_0xbb43('0x0'));var logger=require(_0xbb43('0x1'))('api');var APIError=function(_0x1bdcfc,_0x1995f8){this[_0xbb43('0x2')]=_0x1bdcfc||'Internal\x20Server\x20Error';this[_0xbb43('0x3')]=_0x1995f8||_0xbb43('0x4');util[_0xbb43('0x5')](APIError,Error);};var APIBadRequestError=function(_0x16432a){this['message']=_0x16432a||'Bad\x20Request';this[_0xbb43('0x3')]='Bad\x20Request';util[_0xbb43('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ccd49){this[_0xbb43('0x2')]=_0x1ccd49||_0xbb43('0x6');this[_0xbb43('0x3')]='Not\x20Found';util[_0xbb43('0x5')](APINotFoundError,APIError);};function getStatusCode(_0xf54ac5){switch(_0xf54ac5){case'Bad\x20Request':return 0x190;case _0xbb43('0x7'),_0xbb43('0x8'):return 0x193;case _0xbb43('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x5e3611){return function(_0xfac791){logger[_0xbb43('0xa')](_0xfac791['stack']);var _0x36a473=getStatusCode(_0xfac791[_0xbb43('0x3')]);if(_0xfac791['name'])delete _0xfac791['name'];return _0x5e3611[_0xbb43('0xb')](_0x36a473)['send'](_0xfac791);};}module['exports']={'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 7b9d4cb..9c86d50 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fe7=['status','json','exports'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x3fe7,0x125));var _0x73fe=function(_0x4d121d,_0x3fe733){_0x4d121d=_0x4d121d-0x0;var _0xffa031=_0x3fe7[_0x4d121d];return _0xffa031;};'use strict';module[_0x73fe('0x0')][0x194]=function pageNotFound(_0x2a6cbc,_0x160d2b){var _0x1e0c85='404';var _0x421c71=0x194;var _0x498b0e={'status':_0x421c71};_0x160d2b[_0x73fe('0x1')](_0x498b0e['status']);_0x160d2b['render'](_0x1e0c85,{},function(_0x2a89b0,_0x269f7b){if(_0x2a89b0){return _0x160d2b['status'](_0x498b0e[_0x73fe('0x1')])[_0x73fe('0x2')](_0x498b0e);}_0x160d2b['send'](_0x269f7b);});}; \ No newline at end of file +var _0x5cfa=['render','status','send','exports'];(function(_0x3329b3,_0xef489b){var _0x59add5=function(_0x590947){while(--_0x590947){_0x3329b3['push'](_0x3329b3['shift']());}};_0x59add5(++_0xef489b);}(_0x5cfa,0x1bb));var _0xa5cf=function(_0x1bd844,_0x38cf59){_0x1bd844=_0x1bd844-0x0;var _0x3f4c2e=_0x5cfa[_0x1bd844];return _0x3f4c2e;};'use strict';module[_0xa5cf('0x0')][0x194]=function pageNotFound(_0x25a1ac,_0x5e8752){var _0x163d78='404';var _0x1caec8=0x194;var _0x54e0d0={'status':_0x1caec8};_0x5e8752['status'](_0x54e0d0['status']);_0x5e8752[_0xa5cf('0x1')](_0x163d78,{},function(_0x24c2a8,_0x42e8d9){if(_0x24c2a8){return _0x5e8752[_0xa5cf('0x2')](_0x54e0d0[_0xa5cf('0x2')])['json'](_0x54e0d0);}_0x5e8752[_0xa5cf('0x3')](_0x42e8d9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8f75026..71a969d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','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','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','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','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../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','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','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','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','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','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../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','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b119864..885cbe5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29c0=['./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/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/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./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/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.2.0','/plugins','route','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x29c0,0xc3));var _0x029c=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x29c0[_0x55f8b4];return _0x2475f9;};'use strict';var path=require(_0x029c('0x0'));var express=require(_0x029c('0x1'));var errors=require(_0x029c('0x2'));var config=require(_0x029c('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x029c('0x4'));exports[_0x029c('0x5')]=function(_0x8132d6){return setupLoggers(_0x8132d6)[_0x029c('0x6')](function(){_0x8132d6['use']('/api/users',require('./api/user'));_0x8132d6[_0x029c('0x7')](_0x029c('0x8'),require(_0x029c('0x9')));_0x8132d6[_0x029c('0x7')](_0x029c('0xa'),require(_0x029c('0xb')));_0x8132d6[_0x029c('0x7')](_0x029c('0xc'),require(_0x029c('0xd')));_0x8132d6[_0x029c('0x7')]('/api/voice/mohs',require(_0x029c('0xe')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf'),require(_0x029c('0x10')));_0x8132d6[_0x029c('0x7')]('/api/voice/recordings',require(_0x029c('0x11')));_0x8132d6[_0x029c('0x7')](_0x029c('0x12'),require(_0x029c('0x13')));_0x8132d6['use']('/api/voice/mails',require(_0x029c('0x14')));_0x8132d6[_0x029c('0x7')](_0x029c('0x15'),require(_0x029c('0x16')));_0x8132d6[_0x029c('0x7')](_0x029c('0x17'),require(_0x029c('0x18')));_0x8132d6['use'](_0x029c('0x19'),require('./api/voiceDialReport'));_0x8132d6[_0x029c('0x7')](_0x029c('0x1a'),require(_0x029c('0x1b')));_0x8132d6[_0x029c('0x7')](_0x029c('0x1c'),require(_0x029c('0x1d')));_0x8132d6[_0x029c('0x7')](_0x029c('0x1e'),require(_0x029c('0x1f')));_0x8132d6['use'](_0x029c('0x20'),require(_0x029c('0x21')));_0x8132d6[_0x029c('0x7')](_0x029c('0x22'),require(_0x029c('0x23')));_0x8132d6[_0x029c('0x7')](_0x029c('0x24'),require(_0x029c('0x25')));_0x8132d6[_0x029c('0x7')]('/api/mail/accounts',require(_0x029c('0x26')));_0x8132d6[_0x029c('0x7')](_0x029c('0x27'),require(_0x029c('0x28')));_0x8132d6[_0x029c('0x7')](_0x029c('0x29'),require(_0x029c('0x2a')));_0x8132d6['use'](_0x029c('0x2b'),require(_0x029c('0x2c')));_0x8132d6[_0x029c('0x7')](_0x029c('0x2d'),require(_0x029c('0x2e')));_0x8132d6[_0x029c('0x7')](_0x029c('0x2f'),require(_0x029c('0x30')));_0x8132d6[_0x029c('0x7')](_0x029c('0x31'),require(_0x029c('0x32')));_0x8132d6[_0x029c('0x7')]('/api/dashboards',require(_0x029c('0x33')));_0x8132d6['use'](_0x029c('0x34'),require(_0x029c('0x35')));_0x8132d6[_0x029c('0x7')]('/api/fax/accounts',require(_0x029c('0x36')));_0x8132d6[_0x029c('0x7')](_0x029c('0x37'),require(_0x029c('0x38')));_0x8132d6[_0x029c('0x7')](_0x029c('0x39'),require(_0x029c('0x3a')));_0x8132d6[_0x029c('0x7')](_0x029c('0x3b'),require(_0x029c('0x3c')));_0x8132d6[_0x029c('0x7')]('/api/fax/queues',require(_0x029c('0x3d')));_0x8132d6[_0x029c('0x7')]('/api/fax/reports/queue',require(_0x029c('0x3e')));_0x8132d6[_0x029c('0x7')](_0x029c('0x3f'),require(_0x029c('0x40')));_0x8132d6[_0x029c('0x7')](_0x029c('0x41'),require(_0x029c('0x42')));_0x8132d6['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x8132d6[_0x029c('0x7')](_0x029c('0x43'),require(_0x029c('0x44')));_0x8132d6['use']('/api/sms/queues',require(_0x029c('0x45')));_0x8132d6[_0x029c('0x7')](_0x029c('0x46'),require(_0x029c('0x47')));_0x8132d6[_0x029c('0x7')](_0x029c('0x48'),require(_0x029c('0x49')));_0x8132d6['use'](_0x029c('0x4a'),require('./api/openchannelInteraction'));_0x8132d6[_0x029c('0x7')](_0x029c('0x4b'),require('./api/openchannelMessage'));_0x8132d6['use']('/api/openchannel/queues',require(_0x029c('0x4c')));_0x8132d6[_0x029c('0x7')](_0x029c('0x4d'),require('./api/chatWebsite'));_0x8132d6[_0x029c('0x7')](_0x029c('0x4e'),require(_0x029c('0x4f')));_0x8132d6[_0x029c('0x7')](_0x029c('0x50'),require('./api/chatApplication'));_0x8132d6[_0x029c('0x7')](_0x029c('0x51'),require(_0x029c('0x52')));_0x8132d6[_0x029c('0x7')]('/api/chat/messages',require('./api/chatMessage'));_0x8132d6['use'](_0x029c('0x53'),require(_0x029c('0x54')));_0x8132d6[_0x029c('0x7')]('/api/chat/queues',require(_0x029c('0x55')));_0x8132d6[_0x029c('0x7')]('/api/chat/groups',require(_0x029c('0x56')));_0x8132d6[_0x029c('0x7')](_0x029c('0x57'),require(_0x029c('0x58')));_0x8132d6[_0x029c('0x7')]('/api/cm/companies',require(_0x029c('0x59')));_0x8132d6['use'](_0x029c('0x5a'),require(_0x029c('0x5b')));_0x8132d6[_0x029c('0x7')](_0x029c('0x5c'),require(_0x029c('0x5d')));_0x8132d6[_0x029c('0x7')]('/api/cm/hopper_black',require(_0x029c('0x5e')));_0x8132d6[_0x029c('0x7')](_0x029c('0x5f'),require(_0x029c('0x60')));_0x8132d6[_0x029c('0x7')](_0x029c('0x61'),require(_0x029c('0x62')));_0x8132d6[_0x029c('0x7')](_0x029c('0x63'),require('./api/cmCustomField'));_0x8132d6[_0x029c('0x7')](_0x029c('0x64'),require(_0x029c('0x65')));_0x8132d6[_0x029c('0x7')](_0x029c('0x66'),require(_0x029c('0x67')));_0x8132d6[_0x029c('0x7')](_0x029c('0x68'),require(_0x029c('0x69')));_0x8132d6['use']('/api/dispositions',require(_0x029c('0x6a')));_0x8132d6[_0x029c('0x7')](_0x029c('0x6b'),require('./api/condition'));_0x8132d6[_0x029c('0x7')](_0x029c('0x6c'),require(_0x029c('0x6d')));_0x8132d6[_0x029c('0x7')](_0x029c('0x6e'),require(_0x029c('0x6f')));_0x8132d6[_0x029c('0x7')](_0x029c('0x70'),require('./api/cdr'));_0x8132d6[_0x029c('0x7')](_0x029c('0x71'),require('./api/voiceQueuesLog'));_0x8132d6[_0x029c('0x7')]('/api/schedules',require('./api/schedule'));_0x8132d6[_0x029c('0x7')]('/api/sounds',require('./api/sound'));_0x8132d6[_0x029c('0x7')](_0x029c('0x72'),require(_0x029c('0x73')));_0x8132d6['use'](_0x029c('0x74'),require(_0x029c('0x75')));_0x8132d6[_0x029c('0x7')]('/api/cm_contact_has_items',require(_0x029c('0x76')));_0x8132d6[_0x029c('0x7')](_0x029c('0x77'),require('./api/cmHopperAdditionalPhone'));_0x8132d6[_0x029c('0x7')](_0x029c('0x78'),require(_0x029c('0x79')));_0x8132d6[_0x029c('0x7')](_0x029c('0x7a'),require(_0x029c('0x7b')));_0x8132d6['use'](_0x029c('0x7c'),require(_0x029c('0x7d')));_0x8132d6[_0x029c('0x7')]('/api/integrations',require(_0x029c('0x7e')));_0x8132d6['use'](_0x029c('0x7f'),require('./api/integrationReport'));_0x8132d6['use'](_0x029c('0x80'),require(_0x029c('0x81')));_0x8132d6[_0x029c('0x7')](_0x029c('0x82'),require('./api/analyticDefaultReport'));_0x8132d6[_0x029c('0x7')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x8132d6['use'](_0x029c('0x83'),require('./api/analyticMetric'));_0x8132d6['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x8132d6[_0x029c('0x7')](_0x029c('0x84'),require(_0x029c('0x85')));_0x8132d6[_0x029c('0x7')](_0x029c('0x86'),require(_0x029c('0x87')));_0x8132d6[_0x029c('0x7')](_0x029c('0x88'),require(_0x029c('0x89')));_0x8132d6[_0x029c('0x7')](_0x029c('0x8a'),require(_0x029c('0x8b')));_0x8132d6[_0x029c('0x7')](_0x029c('0x8c'),require(_0x029c('0x8d')));_0x8132d6[_0x029c('0x7')]('/api/integrations/sugarcrm/configurations',require(_0x029c('0x8e')));_0x8132d6[_0x029c('0x7')](_0x029c('0x8f'),require(_0x029c('0x90')));_0x8132d6[_0x029c('0x7')](_0x029c('0x91'),require(_0x029c('0x92')));_0x8132d6[_0x029c('0x7')]('/api/integrations/desk/configurations',require(_0x029c('0x93')));_0x8132d6[_0x029c('0x7')](_0x029c('0x94'),require(_0x029c('0x95')));_0x8132d6[_0x029c('0x7')](_0x029c('0x96'),require(_0x029c('0x97')));_0x8132d6[_0x029c('0x7')](_0x029c('0x98'),require(_0x029c('0x99')));_0x8132d6[_0x029c('0x7')]('/api/integrations/zoho/fields',require(_0x029c('0x9a')));_0x8132d6[_0x029c('0x7')](_0x029c('0x9b'),require(_0x029c('0x9c')));_0x8132d6[_0x029c('0x7')](_0x029c('0x9d'),require(_0x029c('0x9e')));_0x8132d6[_0x029c('0x7')](_0x029c('0x9f'),require(_0x029c('0xa0')));_0x8132d6[_0x029c('0x7')](_0x029c('0xa1'),require(_0x029c('0xa2')));_0x8132d6[_0x029c('0x7')](_0x029c('0xa3'),require(_0x029c('0xa4')));_0x8132d6[_0x029c('0x7')](_0x029c('0xa5'),require('./api/intFreshdeskField'));_0x8132d6[_0x029c('0x7')](_0x029c('0xa6'),require(_0x029c('0xa7')));_0x8132d6['use'](_0x029c('0xa8'),require('./api/intVtigerConfiguration'));_0x8132d6[_0x029c('0x7')]('/api/integrations/vtiger/fields',require(_0x029c('0xa9')));_0x8132d6['use'](_0x029c('0xaa'),require(_0x029c('0xab')));_0x8132d6[_0x029c('0x7')](_0x029c('0xac'),require('./api/intServicenowConfiguration'));_0x8132d6[_0x029c('0x7')](_0x029c('0xad'),require('./api/intServicenowField'));_0x8132d6[_0x029c('0x7')](_0x029c('0xae'),require(_0x029c('0xaf')));_0x8132d6[_0x029c('0x7')](_0x029c('0xb0'),require('./api/intDynamics365Configuration'));_0x8132d6[_0x029c('0x7')]('/api/integrations/dynamics365/fields',require(_0x029c('0xb1')));_0x8132d6[_0x029c('0x7')](_0x029c('0xb2'),require(_0x029c('0xb3')));_0x8132d6['use'](_0x029c('0xb4'),require('./api/intFreshsalesConfiguration'));_0x8132d6[_0x029c('0x7')](_0x029c('0xb5'),require(_0x029c('0xb6')));_0x8132d6[_0x029c('0x7')](_0x029c('0xb7'),require(_0x029c('0xb8')));_0x8132d6['use'](_0x029c('0xb9'),require(_0x029c('0xba')));_0x8132d6['use'](_0x029c('0xbb'),require('./api/chatInternalMessage'));_0x8132d6[_0x029c('0x7')](_0x029c('0xbc'),require(_0x029c('0xbd')));_0x8132d6[_0x029c('0x7')](_0x029c('0xbe'),require(_0x029c('0xbf')));_0x8132d6['use'](_0x029c('0xc0'),require(_0x029c('0xc1')));_0x8132d6[_0x029c('0x7')](_0x029c('0xc2'),require(_0x029c('0xc3')));_0x8132d6[_0x029c('0x7')]('/api/square/reports',require(_0x029c('0xc4')));_0x8132d6['use'](_0x029c('0xc5'),require(_0x029c('0xc6')));_0x8132d6[_0x029c('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x8132d6['use'](_0x029c('0xc7'),require(_0x029c('0xc8')));_0x8132d6['use'](_0x029c('0xc9'),require(_0x029c('0xca')));_0x8132d6[_0x029c('0x7')](_0x029c('0xcb'),require('./api/squareProject'));_0x8132d6[_0x029c('0x7')]('/api/square/recordings',require(_0x029c('0xcc')));_0x8132d6[_0x029c('0x7')](_0x029c('0xcd'),require(_0x029c('0xce')));_0x8132d6[_0x029c('0x7')](_0x029c('0xcf'),require(_0x029c('0xd0')));_0x8132d6['use']('/api/license',require(_0x029c('0xd1')));_0x8132d6['use'](_0x029c('0xd2'),require(_0x029c('0xd3')));_0x8132d6[_0x029c('0x7')](_0x029c('0xd4'),require(_0x029c('0xd5')));_0x8132d6['use']('/api/attachments',require(_0x029c('0xd6')));_0x8132d6[_0x029c('0x7')](_0x029c('0xd7'),require(_0x029c('0xd8')));_0x8132d6[_0x029c('0x7')](_0x029c('0xd9'),require(_0x029c('0xda')));_0x8132d6['use']('/api/chat/reports/transfer',require(_0x029c('0xdb')));_0x8132d6[_0x029c('0x7')](_0x029c('0xdc'),require('./api/faxTransferReport'));_0x8132d6[_0x029c('0x7')](_0x029c('0xdd'),require(_0x029c('0xde')));_0x8132d6[_0x029c('0x7')](_0x029c('0xdf'),require(_0x029c('0xe0')));_0x8132d6[_0x029c('0x7')]('/api/cm/lists',require('./api/cmList'));_0x8132d6['use'](_0x029c('0xe1'),require(_0x029c('0xe2')));_0x8132d6['use'](_0x029c('0xe3'),require(_0x029c('0xe4')));_0x8132d6['use'](_0x029c('0xe5'),require('./api/userProfileSection'));_0x8132d6['use'](_0x029c('0xe6'),require(_0x029c('0xe7')));_0x8132d6['use']('/api/userNotifications',require(_0x029c('0xe8')));_0x8132d6[_0x029c('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x8132d6['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x8132d6[_0x029c('0x7')]('/api/whatsapp/interactions',require(_0x029c('0xe9')));_0x8132d6[_0x029c('0x7')](_0x029c('0xea'),require(_0x029c('0xeb')));_0x8132d6[_0x029c('0x7')](_0x029c('0xec'),require(_0x029c('0xed')));_0x8132d6[_0x029c('0x7')](_0x029c('0xee'),require(_0x029c('0xef')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf0'),require(_0x029c('0xf1')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf2'),require(_0x029c('0xf3')));_0x8132d6[_0x029c('0x7')]('/api/realtime',require(_0x029c('0xf4')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf5'),require(_0x029c('0xf6')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf7'),require(_0x029c('0xf8')));_0x8132d6[_0x029c('0x7')](_0x029c('0xf9'),require(_0x029c('0xfa')));_0x8132d6[_0x029c('0x7')](_0x029c('0xfb'),require(_0x029c('0xfc')));_0x8132d6[_0x029c('0x7')](_0x029c('0xfd'),require(_0x029c('0xfe')));_0x8132d6[_0x029c('0x7')](_0x029c('0xff'),require(_0x029c('0x100')));_0x8132d6[_0x029c('0x7')](_0x029c('0x101'),require(_0x029c('0x102')));_0x8132d6[_0x029c('0x7')](_0x029c('0x103'),require(_0x029c('0x104')));_0x8132d6[_0x029c('0x7')](_0x029c('0x105'),require('./api/pm2'));_0x8132d6[_0x029c('0x7')](_0x029c('0x106'),require('./api/webbar'));_0x8132d6[_0x029c('0x7')](_0x029c('0x107'),clientSideLogs);_0x8132d6[_0x029c('0x7')](_0x029c('0x108'),express[_0x029c('0x109')](path[_0x029c('0x10a')](config[_0x029c('0x10b')],_0x029c('0x108'))));_0x8132d6[_0x029c('0x7')](_0x029c('0x10c'),express[_0x029c('0x109')](path['join'](config[_0x029c('0x10b')],_0x029c('0x10c'))));_0x8132d6['use'](_0x029c('0x10d'),express[_0x029c('0x109')](path[_0x029c('0x10a')](config['root'],_0x029c('0x10d'))));_0x8132d6[_0x029c('0x7')](_0x029c('0x10e'),express[_0x029c('0x109')](path[_0x029c('0x10a')](config[_0x029c('0x10b')],_0x029c('0x10f'),_0x029c('0x110'))));_0x8132d6[_0x029c('0x7')](_0x029c('0x111'),express[_0x029c('0x109')](path['join'](config['root'],'/server/files/plugins')));_0x8132d6[_0x029c('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x029c('0x113')](errors[0x194]);_0x8132d6[_0x029c('0x112')]('/*')['get'](function(_0x18a06e,_0x427aca){_0x427aca['sendFile'](path[_0x029c('0x114')](_0x8132d6[_0x029c('0x113')](_0x029c('0x115'))+_0x029c('0x116')));});return _0x8132d6;});}; \ No newline at end of file +var _0x5e87=['/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.2.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/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/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x5e87,0x1a9));var _0x75e8=function(_0x2f98d5,_0x8e5af5){_0x2f98d5=_0x2f98d5-0x0;var _0x120a58=_0x5e87[_0x2f98d5];return _0x120a58;};'use strict';var path=require(_0x75e8('0x0'));var express=require(_0x75e8('0x1'));var errors=require(_0x75e8('0x2'));var config=require(_0x75e8('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x75e8('0x4')];var clientSideLogs=require(_0x75e8('0x5'));exports[_0x75e8('0x6')]=function(_0x561395){return setupLoggers(_0x561395)[_0x75e8('0x7')](function(){_0x561395[_0x75e8('0x8')](_0x75e8('0x9'),require(_0x75e8('0xa')));_0x561395[_0x75e8('0x8')](_0x75e8('0xb'),require(_0x75e8('0xc')));_0x561395[_0x75e8('0x8')](_0x75e8('0xd'),require(_0x75e8('0xe')));_0x561395[_0x75e8('0x8')]('/api/voice/extensions',require(_0x75e8('0xf')));_0x561395[_0x75e8('0x8')]('/api/voice/mohs',require(_0x75e8('0x10')));_0x561395['use']('/api/voice/queues',require(_0x75e8('0x11')));_0x561395[_0x75e8('0x8')](_0x75e8('0x12'),require('./api/voiceRecording'));_0x561395[_0x75e8('0x8')](_0x75e8('0x13'),require('./api/screenRecording'));_0x561395[_0x75e8('0x8')]('/api/voice/mails',require(_0x75e8('0x14')));_0x561395['use'](_0x75e8('0x15'),require(_0x75e8('0x16')));_0x561395['use'](_0x75e8('0x17'),require(_0x75e8('0x18')));_0x561395[_0x75e8('0x8')](_0x75e8('0x19'),require(_0x75e8('0x1a')));_0x561395[_0x75e8('0x8')](_0x75e8('0x1b'),require('./api/voiceAgentReport'));_0x561395[_0x75e8('0x8')]('/api/voice/queues/reports',require(_0x75e8('0x1c')));_0x561395[_0x75e8('0x8')](_0x75e8('0x1d'),require(_0x75e8('0x1e')));_0x561395['use'](_0x75e8('0x1f'),require(_0x75e8('0x20')));_0x561395[_0x75e8('0x8')](_0x75e8('0x21'),require('./api/voiceTransferReport'));_0x561395['use'](_0x75e8('0x22'),require('./api/mailServerOut'));_0x561395[_0x75e8('0x8')]('/api/mail/accounts',require(_0x75e8('0x23')));_0x561395[_0x75e8('0x8')](_0x75e8('0x24'),require(_0x75e8('0x25')));_0x561395['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x561395[_0x75e8('0x8')](_0x75e8('0x26'),require(_0x75e8('0x27')));_0x561395[_0x75e8('0x8')](_0x75e8('0x28'),require(_0x75e8('0x29')));_0x561395[_0x75e8('0x8')](_0x75e8('0x2a'),require(_0x75e8('0x2b')));_0x561395['use'](_0x75e8('0x2c'),require('./api/mailQueueReport'));_0x561395[_0x75e8('0x8')]('/api/dashboards',require(_0x75e8('0x2d')));_0x561395['use'](_0x75e8('0x2e'),require(_0x75e8('0x2f')));_0x561395[_0x75e8('0x8')]('/api/fax/accounts',require(_0x75e8('0x30')));_0x561395[_0x75e8('0x8')](_0x75e8('0x31'),require(_0x75e8('0x32')));_0x561395[_0x75e8('0x8')](_0x75e8('0x33'),require(_0x75e8('0x34')));_0x561395[_0x75e8('0x8')](_0x75e8('0x35'),require(_0x75e8('0x36')));_0x561395['use'](_0x75e8('0x37'),require('./api/faxQueue'));_0x561395['use'](_0x75e8('0x38'),require(_0x75e8('0x39')));_0x561395[_0x75e8('0x8')](_0x75e8('0x3a'),require(_0x75e8('0x3b')));_0x561395['use']('/api/sms/applications',require('./api/smsApplication'));_0x561395['use'](_0x75e8('0x3c'),require(_0x75e8('0x3d')));_0x561395['use']('/api/sms/messages',require(_0x75e8('0x3e')));_0x561395[_0x75e8('0x8')](_0x75e8('0x3f'),require(_0x75e8('0x40')));_0x561395[_0x75e8('0x8')](_0x75e8('0x41'),require(_0x75e8('0x42')));_0x561395[_0x75e8('0x8')](_0x75e8('0x43'),require(_0x75e8('0x44')));_0x561395[_0x75e8('0x8')]('/api/openchannel/interactions',require(_0x75e8('0x45')));_0x561395[_0x75e8('0x8')](_0x75e8('0x46'),require(_0x75e8('0x47')));_0x561395['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x561395[_0x75e8('0x8')](_0x75e8('0x48'),require(_0x75e8('0x49')));_0x561395[_0x75e8('0x8')](_0x75e8('0x4a'),require(_0x75e8('0x4b')));_0x561395['use']('/api/chat/applications',require(_0x75e8('0x4c')));_0x561395[_0x75e8('0x8')](_0x75e8('0x4d'),require(_0x75e8('0x4e')));_0x561395[_0x75e8('0x8')](_0x75e8('0x4f'),require(_0x75e8('0x50')));_0x561395[_0x75e8('0x8')](_0x75e8('0x51'),require(_0x75e8('0x52')));_0x561395[_0x75e8('0x8')](_0x75e8('0x53'),require(_0x75e8('0x54')));_0x561395['use'](_0x75e8('0x55'),require('./api/chatGroup'));_0x561395[_0x75e8('0x8')](_0x75e8('0x56'),require(_0x75e8('0x57')));_0x561395[_0x75e8('0x8')](_0x75e8('0x58'),require(_0x75e8('0x59')));_0x561395[_0x75e8('0x8')](_0x75e8('0x5a'),require(_0x75e8('0x5b')));_0x561395['use']('/api/cm/hopper',require(_0x75e8('0x5c')));_0x561395[_0x75e8('0x8')](_0x75e8('0x5d'),require(_0x75e8('0x5e')));_0x561395['use']('/api/cm/hopper_final',require(_0x75e8('0x5f')));_0x561395['use'](_0x75e8('0x60'),require(_0x75e8('0x61')));_0x561395[_0x75e8('0x8')](_0x75e8('0x62'),require(_0x75e8('0x63')));_0x561395[_0x75e8('0x8')](_0x75e8('0x64'),require(_0x75e8('0x65')));_0x561395[_0x75e8('0x8')](_0x75e8('0x66'),require(_0x75e8('0x67')));_0x561395[_0x75e8('0x8')](_0x75e8('0x68'),require(_0x75e8('0x69')));_0x561395['use'](_0x75e8('0x6a'),require(_0x75e8('0x6b')));_0x561395[_0x75e8('0x8')](_0x75e8('0x6c'),require(_0x75e8('0x6d')));_0x561395[_0x75e8('0x8')]('/api/intervals',require(_0x75e8('0x6e')));_0x561395[_0x75e8('0x8')](_0x75e8('0x6f'),require('./api/pause'));_0x561395['use'](_0x75e8('0x70'),require('./api/cdr'));_0x561395[_0x75e8('0x8')](_0x75e8('0x71'),require('./api/voiceQueuesLog'));_0x561395['use'](_0x75e8('0x72'),require(_0x75e8('0x73')));_0x561395[_0x75e8('0x8')](_0x75e8('0x74'),require('./api/sound'));_0x561395[_0x75e8('0x8')](_0x75e8('0x75'),require(_0x75e8('0x76')));_0x561395['use'](_0x75e8('0x77'),require('./api/contactItemType'));_0x561395[_0x75e8('0x8')](_0x75e8('0x78'),require(_0x75e8('0x79')));_0x561395[_0x75e8('0x8')](_0x75e8('0x7a'),require('./api/cmHopperAdditionalPhone'));_0x561395['use'](_0x75e8('0x7b'),require('./api/template'));_0x561395['use'](_0x75e8('0x7c'),require('./api/trigger'));_0x561395[_0x75e8('0x8')](_0x75e8('0x7d'),require(_0x75e8('0x7e')));_0x561395[_0x75e8('0x8')](_0x75e8('0x7f'),require(_0x75e8('0x80')));_0x561395[_0x75e8('0x8')](_0x75e8('0x81'),require(_0x75e8('0x82')));_0x561395['use']('/api/analytics/custom_reports',require(_0x75e8('0x83')));_0x561395[_0x75e8('0x8')]('/api/analytics/default_reports',require(_0x75e8('0x84')));_0x561395['use'](_0x75e8('0x85'),require(_0x75e8('0x86')));_0x561395[_0x75e8('0x8')](_0x75e8('0x87'),require(_0x75e8('0x88')));_0x561395['use'](_0x75e8('0x89'),require('./api/analyticFieldReport'));_0x561395['use'](_0x75e8('0x8a'),require(_0x75e8('0x8b')));_0x561395[_0x75e8('0x8')]('/api/integrations/salesforce/accounts',require(_0x75e8('0x8c')));_0x561395[_0x75e8('0x8')](_0x75e8('0x8d'),require(_0x75e8('0x8e')));_0x561395[_0x75e8('0x8')](_0x75e8('0x8f'),require(_0x75e8('0x90')));_0x561395['use'](_0x75e8('0x91'),require(_0x75e8('0x92')));_0x561395[_0x75e8('0x8')](_0x75e8('0x93'),require(_0x75e8('0x94')));_0x561395['use'](_0x75e8('0x95'),require('./api/intSugarcrmField'));_0x561395[_0x75e8('0x8')](_0x75e8('0x96'),require('./api/intDeskAccount'));_0x561395['use'](_0x75e8('0x97'),require('./api/intDeskConfiguration'));_0x561395[_0x75e8('0x8')]('/api/integrations/desk/fields',require(_0x75e8('0x98')));_0x561395[_0x75e8('0x8')](_0x75e8('0x99'),require(_0x75e8('0x9a')));_0x561395[_0x75e8('0x8')](_0x75e8('0x9b'),require(_0x75e8('0x9c')));_0x561395[_0x75e8('0x8')](_0x75e8('0x9d'),require(_0x75e8('0x9e')));_0x561395[_0x75e8('0x8')]('/api/integrations/zendesk/accounts',require(_0x75e8('0x9f')));_0x561395[_0x75e8('0x8')](_0x75e8('0xa0'),require(_0x75e8('0xa1')));_0x561395['use'](_0x75e8('0xa2'),require(_0x75e8('0xa3')));_0x561395[_0x75e8('0x8')](_0x75e8('0xa4'),require(_0x75e8('0xa5')));_0x561395['use'](_0x75e8('0xa6'),require(_0x75e8('0xa7')));_0x561395[_0x75e8('0x8')](_0x75e8('0xa8'),require(_0x75e8('0xa9')));_0x561395['use']('/api/integrations/vtiger/accounts',require(_0x75e8('0xaa')));_0x561395[_0x75e8('0x8')](_0x75e8('0xab'),require('./api/intVtigerConfiguration'));_0x561395[_0x75e8('0x8')](_0x75e8('0xac'),require(_0x75e8('0xad')));_0x561395[_0x75e8('0x8')](_0x75e8('0xae'),require(_0x75e8('0xaf')));_0x561395['use'](_0x75e8('0xb0'),require(_0x75e8('0xb1')));_0x561395[_0x75e8('0x8')]('/api/integrations/servicenow/fields',require(_0x75e8('0xb2')));_0x561395[_0x75e8('0x8')](_0x75e8('0xb3'),require(_0x75e8('0xb4')));_0x561395[_0x75e8('0x8')](_0x75e8('0xb5'),require(_0x75e8('0xb6')));_0x561395[_0x75e8('0x8')](_0x75e8('0xb7'),require('./api/intDynamics365Field'));_0x561395[_0x75e8('0x8')](_0x75e8('0xb8'),require(_0x75e8('0xb9')));_0x561395[_0x75e8('0x8')]('/api/integrations/freshsales/configurations',require(_0x75e8('0xba')));_0x561395[_0x75e8('0x8')](_0x75e8('0xbb'),require(_0x75e8('0xbc')));_0x561395[_0x75e8('0x8')](_0x75e8('0xbd'),require(_0x75e8('0xbe')));_0x561395[_0x75e8('0x8')](_0x75e8('0xbf'),require(_0x75e8('0xc0')));_0x561395[_0x75e8('0x8')]('/api/chat/internal/messages',require(_0x75e8('0xc1')));_0x561395[_0x75e8('0x8')](_0x75e8('0xc2'),require('./api/jscriptyAnswerReport'));_0x561395[_0x75e8('0x8')](_0x75e8('0xc3'),require(_0x75e8('0xc4')));_0x561395['use'](_0x75e8('0xc5'),require('./api/jscriptySessionReport'));_0x561395[_0x75e8('0x8')](_0x75e8('0xc6'),require(_0x75e8('0xc7')));_0x561395[_0x75e8('0x8')](_0x75e8('0xc8'),require(_0x75e8('0xc9')));_0x561395[_0x75e8('0x8')](_0x75e8('0xca'),require('./api/squareReportDetail'));_0x561395[_0x75e8('0x8')](_0x75e8('0xcb'),require(_0x75e8('0xcc')));_0x561395[_0x75e8('0x8')](_0x75e8('0xcd'),require(_0x75e8('0xce')));_0x561395[_0x75e8('0x8')](_0x75e8('0xcf'),require(_0x75e8('0xd0')));_0x561395[_0x75e8('0x8')](_0x75e8('0xd1'),require(_0x75e8('0xd2')));_0x561395[_0x75e8('0x8')](_0x75e8('0xd3'),require('./api/squareRecording'));_0x561395[_0x75e8('0x8')]('/api/square/messages',require(_0x75e8('0xd4')));_0x561395[_0x75e8('0x8')](_0x75e8('0xd5'),require('./api/team'));_0x561395[_0x75e8('0x8')](_0x75e8('0xd6'),require(_0x75e8('0xd7')));_0x561395[_0x75e8('0x8')](_0x75e8('0xd8'),require(_0x75e8('0xd9')));_0x561395[_0x75e8('0x8')](_0x75e8('0xda'),require(_0x75e8('0xdb')));_0x561395[_0x75e8('0x8')](_0x75e8('0xdc'),require(_0x75e8('0xdd')));_0x561395['use'](_0x75e8('0xde'),require(_0x75e8('0xdf')));_0x561395[_0x75e8('0x8')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x561395[_0x75e8('0x8')]('/api/chat/reports/transfer',require(_0x75e8('0xe0')));_0x561395[_0x75e8('0x8')](_0x75e8('0xe1'),require(_0x75e8('0xe2')));_0x561395[_0x75e8('0x8')]('/api/openchannel/reports/transfer',require(_0x75e8('0xe3')));_0x561395['use'](_0x75e8('0xe4'),require(_0x75e8('0xe5')));_0x561395['use'](_0x75e8('0xe6'),require(_0x75e8('0xe7')));_0x561395[_0x75e8('0x8')](_0x75e8('0xe8'),require(_0x75e8('0xe9')));_0x561395[_0x75e8('0x8')](_0x75e8('0xea'),require('./api/userProfile'));_0x561395[_0x75e8('0x8')](_0x75e8('0xeb'),require(_0x75e8('0xec')));_0x561395['use'](_0x75e8('0xed'),require('./api/userProfileResource'));_0x561395[_0x75e8('0x8')](_0x75e8('0xee'),require('./api/userNotification'));_0x561395[_0x75e8('0x8')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x561395[_0x75e8('0x8')](_0x75e8('0xef'),require(_0x75e8('0xf0')));_0x561395[_0x75e8('0x8')](_0x75e8('0xf1'),require(_0x75e8('0xf2')));_0x561395['use'](_0x75e8('0xf3'),require(_0x75e8('0xf4')));_0x561395[_0x75e8('0x8')]('/api/whatsapp/reports/queue',require(_0x75e8('0xf5')));_0x561395['use']('/api/whatsapp/reports/transfer',require(_0x75e8('0xf6')));_0x561395[_0x75e8('0x8')]('/api/whatsapp/queues',require(_0x75e8('0xf7')));_0x561395[_0x75e8('0x8')](_0x75e8('0xf8'),require(_0x75e8('0xf9')));_0x561395[_0x75e8('0x8')](_0x75e8('0xfa'),require('./api/realtime'));_0x561395[_0x75e8('0x8')](_0x75e8('0xfb'),require(_0x75e8('0xfc')));_0x561395[_0x75e8('0x8')](_0x75e8('0xfd'),require(_0x75e8('0xfe')));_0x561395[_0x75e8('0x8')](_0x75e8('0xff'),require(_0x75e8('0x100')));_0x561395[_0x75e8('0x8')]('/api/auth/activedirectory',require(_0x75e8('0x101')));_0x561395[_0x75e8('0x8')](_0x75e8('0x102'),require(_0x75e8('0x103')));_0x561395[_0x75e8('0x8')]('/api/rpc',require('./api/rpc'));_0x561395[_0x75e8('0x8')](_0x75e8('0x104'),require(_0x75e8('0x105')));_0x561395[_0x75e8('0x8')]('/api/system',require(_0x75e8('0x106')));_0x561395[_0x75e8('0x8')](_0x75e8('0x107'),require(_0x75e8('0x108')));_0x561395[_0x75e8('0x8')]('/api/webbar',require(_0x75e8('0x109')));_0x561395['use'](_0x75e8('0x10a'),clientSideLogs);_0x561395[_0x75e8('0x8')]('/apidoc',express[_0x75e8('0x10b')](path[_0x75e8('0x10c')](config[_0x75e8('0x10d')],_0x75e8('0x10e'))));_0x561395[_0x75e8('0x8')](_0x75e8('0x10f'),express['static'](path['join'](config[_0x75e8('0x10d')],_0x75e8('0x10f'))));_0x561395['use'](_0x75e8('0x110'),express[_0x75e8('0x10b')](path[_0x75e8('0x10c')](config['root'],_0x75e8('0x110'))));_0x561395[_0x75e8('0x8')](_0x75e8('0x111'),express['static'](path[_0x75e8('0x10c')](config[_0x75e8('0x10d')],_0x75e8('0x112'),_0x75e8('0x113'))));_0x561395[_0x75e8('0x8')](_0x75e8('0x114'),express[_0x75e8('0x10b')](path[_0x75e8('0x10c')](config['root'],_0x75e8('0x115'))));_0x561395[_0x75e8('0x116')](_0x75e8('0x117'))[_0x75e8('0x118')](errors[0x194]);_0x561395[_0x75e8('0x116')]('/*')['get'](function(_0x1edd36,_0x4fcda2){_0x4fcda2[_0x75e8('0x119')](path['resolve'](_0x561395[_0x75e8('0x118')](_0x75e8('0x11a'))+'/index.html'));});return _0x561395;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 20926d5..88d596e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3089=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/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/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','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.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/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/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x216d92,_0x175fc2){var _0x28e363=function(_0x2788f7){while(--_0x2788f7){_0x216d92['push'](_0x216d92['shift']());}};_0x28e363(++_0x175fc2);}(_0x3089,0x19c));var _0x9308=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x3089[_0x521929];return _0x632436;};'use strict';var jayson=require(_0x9308('0x0'));var _=require(_0x9308('0x1'));var config=require(_0x9308('0x2'));exports[_0x9308('0x3')]=function(){return new Promise(function(_0x276181,_0x5708f4){var _0x526e6f={};_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/user/user.rpc'));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x5')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/voiceQueue/voiceQueue.rpc'));_0x526e6f=_['merge'](_0x526e6f,require('../api/voiceRecording/voiceRecording.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x6')));_0x526e6f=_['merge'](_0x526e6f,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x7')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x8')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x9')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0xa')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0xb')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0xc')));_0x526e6f=_['merge'](_0x526e6f,require('../api/mailAccount/mailAccount.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0xd')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0xe')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0xf')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x10')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x11')));_0x526e6f=_['merge'](_0x526e6f,require('../api/faxAccount/faxAccount.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x12')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x13')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/faxMessage/faxMessage.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x14')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x15')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x16')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x17')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x18')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/smsQueue/smsQueue.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x19')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x1a')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x1b')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x1c')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x1d')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x1e')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x1f')));_0x526e6f=_['merge'](_0x526e6f,require('../api/cmContact/cmContact.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x20')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x21')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x22')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x23')));_0x526e6f=_['merge'](_0x526e6f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/interval/interval.rpc'));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x24')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x25')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x26')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/template/template.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x27')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x28')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x29')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x2a')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x2b')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x2c')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x2d')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x2e')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x2f')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x30')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x31')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x32')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x33')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x34')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x35')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x36')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x37')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x38')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x39')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x3a')));_0x526e6f=_['merge'](_0x526e6f,require('../api/attachment/attachment.rpc'));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x3b')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x3c')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x3d')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x3e')));_0x526e6f=_['merge'](_0x526e6f,require(_0x9308('0x3f')));_0x526e6f=_[_0x9308('0x4')](_0x526e6f,require(_0x9308('0x40')));var _0xfba096=jayson['server'](_0x526e6f)[_0x9308('0x41')]();var _0x19c330=config['rpc']['port']||config[_0x9308('0x42')]+0x1;var _0x493817=config[_0x9308('0x43')]['ip']||_0x9308('0x44');_0xfba096['on']('error',function(_0x36ffe1){return _0x5708f4(_0x36ffe1);});_0xfba096['listen'](_0x19c330,_0x493817,function(){console[_0x9308('0x45')](_0x9308('0x46'),_0x493817,_0x19c330);require('../config/triggers')[_0x9308('0x47')]();return _0x276181(_0x9308('0x48')+_0x493817+':'+_0x19c330);});});}; \ No newline at end of file +var _0xcbcf=['../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/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','http','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','listen','merge','../api/user/user.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/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x5f0f75,_0x3c8bbe){var _0x5c1012=function(_0x4df013){while(--_0x4df013){_0x5f0f75['push'](_0x5f0f75['shift']());}};_0x5c1012(++_0x3c8bbe);}(_0xcbcf,0xae));var _0xfcbc=function(_0x314e69,_0x46c4d8){_0x314e69=_0x314e69-0x0;var _0x4558eb=_0xcbcf[_0x314e69];return _0x4558eb;};'use strict';var jayson=require(_0xfcbc('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0xfcbc('0x1')]=function(){return new Promise(function(_0x57f4bc,_0x5bf91d){var _0x146122={};_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x3')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/voiceExtension/voiceExtension.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/voiceQueue/voiceQueue.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x4')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x5')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x6')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x7')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x8')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x9')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0xa')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0xb')));_0x146122=_['merge'](_0x146122,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0xc')));_0x146122=_['merge'](_0x146122,require('../api/mailAccount/mailAccount.rpc'));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0xd')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/mailInteraction/mailInteraction.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0xe')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/mailApplication/mailApplication.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0xf')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x10')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x11')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x12')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x13')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x14')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/smsAccount/smsAccount.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x15')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/smsMessage/smsMessage.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x16')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x17')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x18')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x19')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x1a')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x1b')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x1c')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x1d')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x1e')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x1f')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x20')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x21')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x22')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x23')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x24')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x25')));_0x146122=_['merge'](_0x146122,require('../api/pause/pause.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x26')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x27')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x28')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x29')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x2a')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x2b')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x2c')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x2d')));_0x146122=_['merge'](_0x146122,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x2e')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x2f')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x30')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x31')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x32')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x33')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x34')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x35')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x36')));_0x146122=_['merge'](_0x146122,require('../api/squareProject/squareProject.rpc'));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x37')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x38')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x39')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require('../api/attachment/attachment.rpc'));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x3a')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x3b')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x3c')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x3d')));_0x146122=_[_0xfcbc('0x2')](_0x146122,require(_0xfcbc('0x3e')));_0x146122=_['merge'](_0x146122,require(_0xfcbc('0x3f')));var _0x21aa3d=jayson[_0xfcbc('0x40')](_0x146122)[_0xfcbc('0x41')]();var _0xf4d279=config['rpc']['port']||config[_0xfcbc('0x42')]+0x1;var _0x534745=config['rpc']['ip']||_0xfcbc('0x43');_0x21aa3d['on']('error',function(_0xc6dc6e){return _0x5bf91d(_0xc6dc6e);});_0x21aa3d[_0xfcbc('0x1')](_0xf4d279,_0x534745,function(){console[_0xfcbc('0x44')](_0xfcbc('0x45'),_0x534745,_0xf4d279);require(_0xfcbc('0x46'))[_0xfcbc('0x47')]();return _0x57f4bc(_0xfcbc('0x48')+_0x534745+':'+_0xf4d279);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f113799..ae1a9fd 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 _0xf7f4=['toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','EventEmitter','./reply','./error','call','setEncoding','setTimeout','headers','emit','ready','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','prototype','sendRequest','sync','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22'];(function(_0x1577d5,_0x459e81){var _0x45c557=function(_0x2d5a55){while(--_0x2d5a55){_0x1577d5['push'](_0x1577d5['shift']());}};_0x45c557(++_0x459e81);}(_0xf7f4,0x68));var _0x4f7f=function(_0xb2b81a,_0x5085ef){_0xb2b81a=_0xb2b81a-0x0;var _0x2dfb1e=_0xf7f4[_0xb2b81a];return _0x2dfb1e;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0x4f7f('0x0')];var AGIReply=require(_0x4f7f('0x1'));var AGIError=require(_0x4f7f('0x2'));function AGIChannel(_0x54fcd8){var _0x2bbb56=this,_0x565050=new AGIReply(),_0xcde69e=![],_0x302535={};EventEmitter[_0x4f7f('0x3')](_0x2bbb56);_0x54fcd8[_0x4f7f('0x4')]('utf8');_0x54fcd8[_0x4f7f('0x5')](0x8*0x3c*0x3c*0x3e8);_0x565050[_0x4f7f('0x4')]('utf8');_0x565050['on'](_0x4f7f('0x6'),function(_0x24ba8d){for(var _0x263097 in _0x24ba8d){_0x2bbb56[_0x263097]=_0x24ba8d[_0x263097];}_0x2bbb56[_0x4f7f('0x7')](_0x4f7f('0x8'));});_0x565050['on']('line',function(_0x21647d){if(_0x21647d[_0x4f7f('0x9')]()==_0x4f7f('0xa')){_0x2bbb56[_0x4f7f('0x7')](_0x4f7f('0xa'));return;}if(_0x21647d['substring'](0x0,0xb)==_0x4f7f('0xb')){_0xcde69e=!![];}if(_0xcde69e){_0x302535['rx']+=_0x21647d+'\x0a';if(_0x21647d['search'](_0x4f7f('0xc'))!=-0x1){_0xcde69e=![];}}else{_0x302535['rx']=_0x21647d;}if(_0xcde69e){return;}if(typeof _0x302535['cb']=='function'){var _0x3d03cb=_0x302535['rx'][_0x4f7f('0xd')](0x0,0x3),_0x25108c=null,_0x4a95cc=null;_0x3d03cb=parseInt(_0x3d03cb);if(isNaN(_0x3d03cb)){_0x302535['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4f7f('0xe')});return;}if(_0x3d03cb!=0xc8){_0x302535['cb'](null,{'code':_0x3d03cb,'result':-0x1,'extra':'KO'});return;}_0x25108c=_0x302535['rx']['substring'](0x4)[_0x4f7f('0xf')](_0x4f7f('0x10'),'');if(_0x25108c['indexOf']('\x20')!=-0x1){_0x25108c=_0x25108c['substr'](0x0,_0x25108c[_0x4f7f('0x11')]('\x20'));}if(_[_0x4f7f('0x12')](_0x25108c,'-1')){_0x25108c=parseInt(_0x25108c);}_0x4a95cc=_0x302535['rx'][_0x4f7f('0x13')]('\x20');if(_0x4a95cc[_0x4f7f('0x14')]==0x3){_0x4a95cc=_0x4a95cc[0x2][_0x4f7f('0xd')](0x1,_0x4a95cc[0x2][_0x4f7f('0x14')]-0x1);}else if(_0x4a95cc[_0x4f7f('0x14')]>0x3){var _0x1fa79f=/\((.+)\)/;var _0x5119f3=_0x302535['rx'][_0x4f7f('0x15')](_0x1fa79f);if(_0x5119f3){_0x4a95cc=_0x5119f3[0x1];}else{_0x4a95cc=null;}}else{_0x4a95cc=null;}_0x302535['cb'](null,{'code':_0x3d03cb,'result':_0x25108c,'extra':_0x4a95cc});}});_0x54fcd8['on'](_0x4f7f('0x16'),function(_0x5646d5){_0x2bbb56[_0x4f7f('0x7')](_0x4f7f('0x16'),new AGIError(_0x4f7f('0x17'),_0x5646d5[_0x4f7f('0x18')]));});_0x54fcd8['on'](_0x4f7f('0x19'),function(){_0x2bbb56[_0x4f7f('0x7')](_0x4f7f('0x19'),new AGIError(_0x4f7f('0x1a')));});_0x54fcd8['on']('timeout',function(){_0x2bbb56[_0x4f7f('0x7')](_0x4f7f('0x1b'),new AGIError(_0x4f7f('0x1c')));_0x54fcd8[_0x4f7f('0x1d')]();});_0x54fcd8[_0x4f7f('0x1e')](_0x565050);this[_0x4f7f('0x1f')]=function(_0xe76d41,_0x484d70){var _0xe76d41=_0xe76d41||'',_0x484d70=typeof _0x484d70==_0x4f7f('0x20')?_0x484d70:new Function();_0x302535={'tx':_0xe76d41,'rx':'','cb':_0x484d70};_0x54fcd8[_0x4f7f('0x21')](_0xe76d41+'\x0a');},this[_0x4f7f('0x19')]=function(){_0x54fcd8[_0x4f7f('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x23')]=function(_0x3bb497){return this[_0x4f7f('0x1f')][_0x4f7f('0x24')](this,_0x3bb497);};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x25')]=function(){return this[_0x4f7f('0x23')](_0x4f7f('0x26'));};AGIChannel['prototype'][_0x4f7f('0x27')]=function(_0x3d8d28,_0x1f9510,_0x4024b4){_0x3d8d28=_0x3d8d28===undefined?'beep':_0x3d8d28;_0x1f9510=_0x1f9510===undefined?'5':_0x1f9510;_0x4024b4=_0x4024b4===undefined?'1':_0x4024b4;return this[_0x4f7f('0x23')](util['format'](_0x4f7f('0x28'),_0x3d8d28,_0x1f9510*0x3e8,_0x4024b4));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x29')]=function(_0x179a34){_0x179a34=_0x179a34||_0x4f7f('0x2a');return this['sendRequest'](util[_0x4f7f('0x2b')]('VERBOSE\x20\x22%s\x22',_0x179a34));};AGIChannel['prototype']['exec']=function(_0x5ba008,_0x4ff76a){if(_[_0x4f7f('0x2c')](_0x4ff76a)){return this['sendRequest'](util[_0x4f7f('0x2b')](_0x4f7f('0x2d'),_0x5ba008,_0x4ff76a[_0x4f7f('0x2e')](',')));}return this['sendRequest'](util[_0x4f7f('0x2b')](_0x4f7f('0x2d'),_0x5ba008,_0x4ff76a));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x2f')]=function(_0x276c01){return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x30'),_0x276c01));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x31')]=function(_0xa01854){return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x32'),_0xa01854));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x33')]=function(_0x9ef42a){return this['sendRequest'](util[_0x4f7f('0x2b')](_0x4f7f('0x34'),_0x9ef42a));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0xa')]=function(){return this['sendRequest'](_0x4f7f('0x35'));};AGIChannel['prototype'][_0x4f7f('0x36')]=function(_0x49754e,_0x58d1e8){var _0x441ba8=_[_0x4f7f('0x37')](_0x58d1e8)||_[_0x4f7f('0x38')](_0x58d1e8)?_0x58d1e8['toString']():_0x58d1e8;return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x39'),_0x49754e,_0x441ba8?_0x441ba8[_0x4f7f('0x3a')]()[_0x4f7f('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x3b')]=function(_0x370d50,_0x33a28b){return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x3c'),_0x370d50,_0x33a28b));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x3d')]=function(_0xf66a14,_0x4071a1){return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x3e'),_0xf66a14,_0x4071a1));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x3f')]=function(_0x1dfeb3,_0x24b9ac){return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x40'),_0x1dfeb3,_0x24b9ac));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x41')]=function(_0x27a1bd,_0x5323b4,_0x115fc4){_0x5323b4=_0x5323b4||this[_0x4f7f('0x42')];_0x115fc4=_0x115fc4||0x1;this['setContext'](_0x27a1bd);this[_0x4f7f('0x31')](_0x5323b4);this[_0x4f7f('0x33')](_0x115fc4);return this[_0x4f7f('0x29')](util[_0x4f7f('0x2b')](_0x4f7f('0x43'),_0x27a1bd,_0x5323b4,_0x115fc4));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x44')]=function(_0x2b1764){return this[_0x4f7f('0x23')](util['format'](_0x4f7f('0x45'),_0x2b1764));};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x46')]=function(_0x7e033b,_0x5cad06,_0x4bc727,_0x2abea1,_0x36dc1a,_0x49bab8){_0x5cad06=_0x5cad06||_0x4f7f('0x47');_0x4bc727=_0x4bc727||'';_0x2abea1=_0x2abea1===undefined?-0x1:_0x2abea1==='-1'?-0x1:_0x2abea1*0x3e8;_0x36dc1a=_0x36dc1a===undefined?'':'s='+_0x36dc1a;_0x49bab8=_0x49bab8?_0x4f7f('0x48'):'';return this[_0x4f7f('0x23')](util[_0x4f7f('0x2b')](_0x4f7f('0x49'),_0x7e033b,_0x5cad06,_0x4bc727,_0x2abea1,_0x49bab8,_0x36dc1a));};AGIChannel['prototype']['streamFile']=function(_0xc61ba3,_0x33009d){_0x33009d=_0x33009d||'';return this['sendRequest'](util[_0x4f7f('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xc61ba3,_0x33009d));};AGIChannel['prototype'][_0x4f7f('0x4a')]=function(_0x3828cf){return this[_0x4f7f('0x4b')](_0x4f7f('0x4c'),_0x3828cf);};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x4d')]=function(_0x3c7188){return this[_0x4f7f('0x4b')](_0x4f7f('0x4e'),_0x3c7188);};AGIChannel[_0x4f7f('0x22')][_0x4f7f('0x16')]=function(_0x266fd2,_0x19afa0){this['noop'](util['format'](_0x4f7f('0x4f'),_0x266fd2['id'],_0x266fd2[_0x4f7f('0x50')],_0x19afa0));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x9e71=['520\x20End\x20of\x20proper','function','result=','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','util','lodash','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','ready','hangup','emit','substring','520-Invalid'];(function(_0x5f396f,_0x5d7e09){var _0x43f948=function(_0x344eb0){while(--_0x344eb0){_0x5f396f['push'](_0x5f396f['shift']());}};_0x43f948(++_0x5d7e09);}(_0x9e71,0x1a8));var _0x19e7=function(_0x1ad299,_0x520d99){_0x1ad299=_0x1ad299-0x0;var _0x5e7716=_0x9e71[_0x1ad299];return _0x5e7716;};'use strict';var util=require(_0x19e7('0x0'));var _=require(_0x19e7('0x1'));var EventEmitter=require('events')[_0x19e7('0x2')];var AGIReply=require(_0x19e7('0x3'));var AGIError=require(_0x19e7('0x4'));function AGIChannel(_0x4e8ca2){var _0x2677e5=this,_0x59fb78=new AGIReply(),_0x23c87f=![],_0x32a957={};EventEmitter[_0x19e7('0x5')](_0x2677e5);_0x4e8ca2['setEncoding'](_0x19e7('0x6'));_0x4e8ca2[_0x19e7('0x7')](0x8*0x3c*0x3c*0x3e8);_0x59fb78[_0x19e7('0x8')]('utf8');_0x59fb78['on']('headers',function(_0x5d6f3a){for(var _0x54bcae in _0x5d6f3a){_0x2677e5[_0x54bcae]=_0x5d6f3a[_0x54bcae];}_0x2677e5['emit'](_0x19e7('0x9'));});_0x59fb78['on']('line',function(_0x465c6a){if(_0x465c6a['toLowerCase']()==_0x19e7('0xa')){_0x2677e5[_0x19e7('0xb')](_0x19e7('0xa'));return;}if(_0x465c6a[_0x19e7('0xc')](0x0,0xb)==_0x19e7('0xd')){_0x23c87f=!![];}if(_0x23c87f){_0x32a957['rx']+=_0x465c6a+'\x0a';if(_0x465c6a['search'](_0x19e7('0xe'))!=-0x1){_0x23c87f=![];}}else{_0x32a957['rx']=_0x465c6a;}if(_0x23c87f){return;}if(typeof _0x32a957['cb']==_0x19e7('0xf')){var _0x53eef8=_0x32a957['rx'][_0x19e7('0xc')](0x0,0x3),_0x274ec3=null,_0x338da9=null;_0x53eef8=parseInt(_0x53eef8);if(isNaN(_0x53eef8)){_0x32a957['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x53eef8!=0xc8){_0x32a957['cb'](null,{'code':_0x53eef8,'result':-0x1,'extra':'KO'});return;}_0x274ec3=_0x32a957['rx'][_0x19e7('0xc')](0x4)['replace'](_0x19e7('0x10'),'');if(_0x274ec3['indexOf']('\x20')!=-0x1){_0x274ec3=_0x274ec3['substr'](0x0,_0x274ec3['indexOf']('\x20'));}if(_[_0x19e7('0x11')](_0x274ec3,'-1')){_0x274ec3=parseInt(_0x274ec3);}_0x338da9=_0x32a957['rx'][_0x19e7('0x12')]('\x20');if(_0x338da9[_0x19e7('0x13')]==0x3){_0x338da9=_0x338da9[0x2][_0x19e7('0xc')](0x1,_0x338da9[0x2][_0x19e7('0x13')]-0x1);}else if(_0x338da9[_0x19e7('0x13')]>0x3){var _0x18a9c4=/\((.+)\)/;var _0xff2874=_0x32a957['rx'][_0x19e7('0x14')](_0x18a9c4);if(_0xff2874){_0x338da9=_0xff2874[0x1];}else{_0x338da9=null;}}else{_0x338da9=null;}_0x32a957['cb'](null,{'code':_0x53eef8,'result':_0x274ec3,'extra':_0x338da9});}});_0x4e8ca2['on'](_0x19e7('0x15'),function(_0x56abca){_0x2677e5[_0x19e7('0xb')]('error',new AGIError(_0x19e7('0x16'),_0x56abca[_0x19e7('0x17')]));});_0x4e8ca2['on'](_0x19e7('0x18'),function(){_0x2677e5[_0x19e7('0xb')](_0x19e7('0x18'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4e8ca2['on'](_0x19e7('0x19'),function(){_0x2677e5['emit'](_0x19e7('0x19'),new AGIError(_0x19e7('0x1a')));_0x4e8ca2[_0x19e7('0x1b')]();});_0x4e8ca2[_0x19e7('0x1c')](_0x59fb78);this['command']=function(_0x557aeb,_0x4cc238){var _0x557aeb=_0x557aeb||'',_0x4cc238=typeof _0x4cc238==_0x19e7('0xf')?_0x4cc238:new Function();_0x32a957={'tx':_0x557aeb,'rx':'','cb':_0x4cc238};_0x4e8ca2[_0x19e7('0x1d')](_0x557aeb+'\x0a');},this['close']=function(){_0x4e8ca2[_0x19e7('0x1b')]();};}util[_0x19e7('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0x19e7('0x1f')]['sendRequest']=function(_0x3b9083){return this['command'][_0x19e7('0x20')](this,_0x3b9083);};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x21')]=function(){return this[_0x19e7('0x22')](_0x19e7('0x23'));};AGIChannel['prototype'][_0x19e7('0x24')]=function(_0x50f6fa,_0x3a0743,_0x278072){_0x50f6fa=_0x50f6fa===undefined?'beep':_0x50f6fa;_0x3a0743=_0x3a0743===undefined?'5':_0x3a0743;_0x278072=_0x278072===undefined?'1':_0x278072;return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x26'),_0x50f6fa,_0x3a0743*0x3e8,_0x278072));};AGIChannel[_0x19e7('0x1f')]['noop']=function(_0x1ca8ac){_0x1ca8ac=_0x1ca8ac||_0x19e7('0x27');return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x28'),_0x1ca8ac));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x29')]=function(_0x477adc,_0xf01344){if(_[_0x19e7('0x2a')](_0xf01344)){return this[_0x19e7('0x22')](util[_0x19e7('0x25')]('EXEC\x20%s\x20%s',_0x477adc,_0xf01344[_0x19e7('0x2b')](',')));}return this[_0x19e7('0x22')](util[_0x19e7('0x25')]('EXEC\x20%s\x20%s',_0x477adc,_0xf01344));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x2c')]=function(_0x182127){return this[_0x19e7('0x22')](util[_0x19e7('0x25')]('SET\x20CONTEXT\x20%s',_0x182127));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x2d')]=function(_0x3c0f8a){return this['sendRequest'](util[_0x19e7('0x25')](_0x19e7('0x2e'),_0x3c0f8a));};AGIChannel['prototype'][_0x19e7('0x2f')]=function(_0x2e7ee7){return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x30'),_0x2e7ee7));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0xa')]=function(){return this[_0x19e7('0x22')](_0x19e7('0x31'));};AGIChannel[_0x19e7('0x1f')]['setVariable']=function(_0x28a92a,_0x4b5d21){var _0x48307d=_[_0x19e7('0x32')](_0x4b5d21)||_[_0x19e7('0x33')](_0x4b5d21)?_0x4b5d21[_0x19e7('0x34')]():_0x4b5d21;return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x35'),_0x28a92a,_0x48307d?_0x48307d[_0x19e7('0x34')]()[_0x19e7('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x19e7('0x1f')]['sayNumber']=function(_0x49a7c4,_0x57ab89){return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x37'),_0x49a7c4,_0x57ab89));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x38')]=function(_0x36255c,_0xf9c870){return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x39'),_0x36255c,_0xf9c870));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x3a')]=function(_0x4f53ad,_0x5a8d70){return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x3b'),_0x4f53ad,_0x5a8d70));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x3c')]=function(_0x3ab188,_0x2afd59,_0x31ce07){_0x2afd59=_0x2afd59||this[_0x19e7('0x3d')];_0x31ce07=_0x31ce07||0x1;this['setContext'](_0x3ab188);this[_0x19e7('0x2d')](_0x2afd59);this[_0x19e7('0x2f')](_0x31ce07);return this['noop'](util['format'](_0x19e7('0x3e'),_0x3ab188,_0x2afd59,_0x31ce07));};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x3f')]=function(_0x148d1b){return this[_0x19e7('0x22')](util[_0x19e7('0x25')](_0x19e7('0x40'),_0x148d1b));};AGIChannel[_0x19e7('0x1f')]['recordFile']=function(_0x29eaed,_0x2dffae,_0x217bec,_0x5131f4,_0x6ffedb,_0x31dc62){_0x2dffae=_0x2dffae||_0x19e7('0x41');_0x217bec=_0x217bec||'';_0x5131f4=_0x5131f4===undefined?-0x1:_0x5131f4==='-1'?-0x1:_0x5131f4*0x3e8;_0x6ffedb=_0x6ffedb===undefined?'':'s='+_0x6ffedb;_0x31dc62=_0x31dc62?_0x19e7('0x42'):'';return this['sendRequest'](util[_0x19e7('0x25')](_0x19e7('0x43'),_0x29eaed,_0x2dffae,_0x217bec,_0x5131f4,_0x31dc62,_0x6ffedb));};AGIChannel[_0x19e7('0x1f')]['streamFile']=function(_0x3dc50c,_0x3039d4){_0x3039d4=_0x3039d4||'';return this['sendRequest'](util[_0x19e7('0x25')](_0x19e7('0x44'),_0x3dc50c,_0x3039d4));};AGIChannel[_0x19e7('0x1f')]['agi']=function(_0x127b19){return this[_0x19e7('0x29')]('AGI',_0x127b19);};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x45')]=function(_0x2dbcb9){return this[_0x19e7('0x29')](_0x19e7('0x46'),_0x2dbcb9);};AGIChannel[_0x19e7('0x1f')][_0x19e7('0x15')]=function(_0x401c66,_0x2c3a6d){this[_0x19e7('0x47')](util[_0x19e7('0x25')](_0x19e7('0x48'),_0x401c66['id'],_0x401c66['label'],_0x2c3a6d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bc51589..34049bf 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 _0x5974=['push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x141e5f,_0x216927){var _0x5bea96=function(_0x538c07){while(--_0x538c07){_0x141e5f['push'](_0x141e5f['shift']());}};_0x5bea96(++_0x216927);}(_0x5974,0x72));var _0x4597=function(_0x2a8122,_0xd957e){_0x2a8122=_0x2a8122-0x0;var _0x49a5c7=_0x5974[_0x2a8122];return _0x49a5c7;};'use strict';var util=require(_0x4597('0x0'));var error={'E_AGI_UNDEFINED':_0x4597('0x1'),'E_AGI_ARGUMENT_PORT':_0x4597('0x2'),'E_AGI_SERVER_ERROR':_0x4597('0x3'),'E_AGI_SERVER_CLOSE':_0x4597('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x4597('0x5'),'E_AGI_SOCKET_ERROR':_0x4597('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x4597('0x7'),'E_AGI_COMMAND_EMPTY':_0x4597('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4597('0x9'),'E_AGI_IVR_ENTRY':_0x4597('0xa')};function AGIError(_0x22dfb1){var _0x22dfb1=_0x22dfb1||null,_0x1acb0e=_0x1acb0e||[],_0x1ea500=0x1,_0x1116fc='';if(!error[_0x22dfb1]){_0x22dfb1=_0x4597('0xb');}_0x1acb0e[_0x4597('0xc')](error[_0x22dfb1]);while(arguments[_0x1ea500]){_0x1acb0e[_0x4597('0xc')](arguments[_0x1ea500]);_0x1ea500++;}_0x1116fc=util[_0x4597('0xd')][_0x4597('0xe')](util,_0x1acb0e);this[_0x4597('0xf')]=_0x1116fc;this[_0x4597('0x10')]=_0x22dfb1;}module[_0x4597('0x11')]=AGIError; \ No newline at end of file +var _0x41ad=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x41ad,0xa0));var _0xd41a=function(_0x467012,_0x5d20ff){_0x467012=_0x467012-0x0;var _0x5458d4=_0x41ad[_0x467012];return _0x5458d4;};'use strict';var util=require(_0xd41a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xd41a('0x1'),'E_AGI_SERVER_ERROR':_0xd41a('0x2'),'E_AGI_SERVER_CLOSE':_0xd41a('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xd41a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd41a('0x5'),'E_AGI_SOCKET_ERROR':_0xd41a('0x6'),'E_AGI_SOCKET_CLOSE':_0xd41a('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xd41a('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xd41a('0x9')};function AGIError(_0x1c9217){var _0x1c9217=_0x1c9217||null,_0x5ceea7=_0x5ceea7||[],_0x38dae5=0x1,_0x4981c0='';if(!error[_0x1c9217]){_0x1c9217=_0xd41a('0xa');}_0x5ceea7[_0xd41a('0xb')](error[_0x1c9217]);while(arguments[_0x38dae5]){_0x5ceea7['push'](arguments[_0x38dae5]);_0x38dae5++;}_0x4981c0=util[_0xd41a('0xc')][_0xd41a('0xd')](util,_0x5ceea7);this[_0xd41a('0xe')]=_0x4981c0;this[_0xd41a('0xf')]=_0x1c9217;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 11a2349..a455e6c 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 _0x2da9=['./error','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','projectUpdate','exports','lodash','EventEmitter','ioredis'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x2da9,0x169));var _0x92da=function(_0x241a3c,_0x5ccc74){_0x241a3c=_0x241a3c-0x0;var _0x3b4a43=_0x2da9[_0x241a3c];return _0x3b4a43;};'use strict';var _=require(_0x92da('0x0'));var EventEmitter=require('events')[_0x92da('0x1')];var Redis=require(_0x92da('0x2'));var AGIError=require(_0x92da('0x3'));var config=require('../../config/environment');config[_0x92da('0x4')]=_['defaults'](config['redis'],{'host':_0x92da('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x92da('0x4')]);sub[_0x92da('0x6')](_0x92da('0x7'),function(_0x63b014){if(_0x63b014)return eventEmitter[_0x92da('0x8')](_0x92da('0x9'),new AGIError(_0x92da('0xa'),_0x63b014));});sub['on']('message',function(_0x10efb2,_0x5f291a){if(_0x10efb2!==_0x92da('0x7'))return;try{var _0x499bdd=JSON['parse'](_0x5f291a);eventEmitter[_0x92da('0x8')](_0x92da('0xb'),_0x499bdd);}catch(_0x6698ba){eventEmitter[_0x92da('0x8')](_0x92da('0x9'),new AGIError(_0x92da('0xa'),_0x6698ba));}});module[_0x92da('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x48d5=['parse','projectUpdate','emit','exports','lodash','events','./error','../../config/environment','redis','defaults','localhost','agi','error','E_AGI_SERVER_ERROR'];(function(_0x3f0f1e,_0x759f34){var _0x2a847f=function(_0x1f127d){while(--_0x1f127d){_0x3f0f1e['push'](_0x3f0f1e['shift']());}};_0x2a847f(++_0x759f34);}(_0x48d5,0xf2));var _0x548d=function(_0x2f7bd9,_0xe151e6){_0x2f7bd9=_0x2f7bd9-0x0;var _0x59da8b=_0x48d5[_0x2f7bd9];return _0x59da8b;};'use strict';var _=require(_0x548d('0x0'));var EventEmitter=require(_0x548d('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x548d('0x2'));var config=require(_0x548d('0x3'));config[_0x548d('0x4')]=_[_0x548d('0x5')](config['redis'],{'host':_0x548d('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x548d('0x4')]);sub['subscribe'](_0x548d('0x7'),function(_0x118e9f){if(_0x118e9f)return eventEmitter['emit'](_0x548d('0x8'),new AGIError(_0x548d('0x9'),_0x118e9f));});sub['on']('message',function(_0x5d8920,_0x8eceff){if(_0x5d8920!==_0x548d('0x7'))return;try{var _0x3d7a9e=JSON[_0x548d('0xa')](_0x8eceff);eventEmitter['emit'](_0x548d('0xb'),_0x3d7a9e);}catch(_0xc1672f){eventEmitter[_0x548d('0xc')]('error',new AGIError(_0x548d('0x9'),_0xc1672f));}});module[_0x548d('0xd')]={'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 6cbf57c..1b23486 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 _0xfead=['addVertex','edges','addEdge','push','size','prototype','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','numberOfEdges'];(function(_0x106982,_0x5ec84d){var _0x1db2bf=function(_0x3bfb40){while(--_0x3bfb40){_0x106982['push'](_0x106982['shift']());}};_0x1db2bf(++_0x5ec84d);}(_0xfead,0x1c7));var _0xdfea=function(_0x5a2b60,_0x3fa4ae){_0x5a2b60=_0x5a2b60-0x0;var _0x3f7692=_0xfead[_0x5a2b60];return _0x3f7692;};'use strict';var _=require(_0xdfea('0x0'));var logger=require(_0xdfea('0x1'))(_0xdfea('0x2'));var verticesWithRetry=[_0xdfea('0x3'),'getdigits',_0xdfea('0x4')];var Graph=function(){this[_0xdfea('0x5')]={};this['edges']={};this[_0xdfea('0x6')]=0x0;};Graph['prototype'][_0xdfea('0x7')]=function(_0x27cedc){this[_0xdfea('0x5')][_0x27cedc['id']]=_0x27cedc;this[_0xdfea('0x8')][_0x27cedc['id']]=[];};Graph['prototype'][_0xdfea('0x9')]=function(_0x5dd28e,_0x5d6945,_0x362a01){this[_0xdfea('0x8')][_0x5dd28e][_0xdfea('0xa')]({'target':_0x5d6945,'condition':_0x362a01});this[_0xdfea('0x6')]+=0x1;};Graph['prototype'][_0xdfea('0xb')]=function(){return _[_0xdfea('0xb')](this[_0xdfea('0x5')]);};Graph[_0xdfea('0xc')][_0xdfea('0xd')]=function(){return this[_0xdfea('0x6')];};Graph['prototype'][_0xdfea('0xe')]=function(_0x33f625){return this['vertices'][_0x33f625];};Graph[_0xdfea('0xc')][_0xdfea('0xf')]=function(_0x310812,_0x388330){if(!this[_0xdfea('0x5')][_0x310812]){return logger['info'](_0xdfea('0x10'));}var _0x427162=_0x388330(this[_0xdfea('0x5')][_0x310812]);if(!_0x427162){return logger[_0xdfea('0x11')](_0xdfea('0x12'));}if(this[_0xdfea('0x8')][_0x310812][_0xdfea('0x13')]===0x0){return logger['info'](_0xdfea('0x14'));}for(var _0x2dbec6=0x0,_0x2b79ec=[],_0x448b38=![];_0x2dbec6\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables'];(function(_0x2b809a,_0x5a0d6a){var _0x33fa91=function(_0x595b68){while(--_0x595b68){_0x2b809a['push'](_0x2b809a['shift']());}};_0x33fa91(++_0x5a0d6a);}(_0xc4f9,0x1a3));var _0x9c4f=function(_0x544754,_0x386539){_0x544754=_0x544754-0x0;var _0x4dfea8=_0xc4f9[_0x544754];return _0x4dfea8;};'use strict';var _=require(_0x9c4f('0x0'));var syncho=require(_0x9c4f('0x1'));var util=require(_0x9c4f('0x2'));var config=require(_0x9c4f('0x3'));var logger=require(_0x9c4f('0x4'))(_0x9c4f('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9c4f('0x6'));var Project=require(_0x9c4f('0x7'));var AGIEmitter=require(_0x9c4f('0x8'))[_0x9c4f('0x9')];var projects=[];config[_0x9c4f('0x5')]=_[_0x9c4f('0xa')](config[_0x9c4f('0x5')],{'ip':_0x9c4f('0xb'),'port':0x11dd});AGIEmitter['on'](_0x9c4f('0xc'),projectUpdateHandler);function connectionHandler(_0x59ef07){process[_0x9c4f('0xd')](function(){syncho(function(){try{setChannelVariables(_0x59ef07);agiHandler(_0x59ef07);}catch(_0x297724){logger[_0x9c4f('0xe')](_0x297724[_0x9c4f('0xf')]);}});});}function projectUpdateHandler(_0x460320){try{var _0x49bf78=_[_0x9c4f('0x10')](projects,['id',_0x460320['id']]);if(_0x49bf78>-0x1){if(_0x460320[_0x9c4f('0x11')]===!![]){projects[_0x9c4f('0x12')](_0x49bf78,0x1);}else{projects[_0x49bf78]=_0x460320;}}else{projects['push'](_0x460320);}}catch(_0x42e5d3){logger[_0x9c4f('0xe')](_0x42e5d3['stack']);}}function listeningHandler(){console[_0x9c4f('0x13')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9c4f('0x5')]['port']);logger[_0x9c4f('0x14')](util[_0x9c4f('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x9c4f('0x5')]['ip'],config['agi'][_0x9c4f('0x16')]));}function errorHandler(_0x1dabdf){if(_0x1dabdf&&_0x1dabdf[_0x9c4f('0x17')]&&_0x1dabdf[_0x9c4f('0x18')]){logger[_0x9c4f('0xe')](util[_0x9c4f('0x15')](_0x9c4f('0x19'),_0x1dabdf['name'],_0x1dabdf[_0x9c4f('0x18')]));}else{logger[_0x9c4f('0xe')](util[_0x9c4f('0x15')](_0x9c4f('0x1a'),_0x1dabdf[_0x9c4f('0xf')]));}}function closeHandler(){logger[_0x9c4f('0x14')](util[_0x9c4f('0x15')](_0x9c4f('0x1b'),this[_0x9c4f('0x1c')],this[_0x9c4f('0x1d')],this[_0x9c4f('0x1e')],this[_0x9c4f('0x1f')],this[_0x9c4f('0x20')]));try{createSquareReport(this);}catch(_0x53f453){logger['error'](_0x53f453['stack']);}}function timeoutHandler(){logger[_0x9c4f('0x14')](util[_0x9c4f('0x15')](_0x9c4f('0x21'),this[_0x9c4f('0x1c')],this[_0x9c4f('0x1d')],this[_0x9c4f('0x1e')],this[_0x9c4f('0x1f')],this[_0x9c4f('0x20')]));}function hangupHandler(){logger['info'](util[_0x9c4f('0x15')](_0x9c4f('0x22'),this['arg_1'],this[_0x9c4f('0x1d')],this['callerid'],this[_0x9c4f('0x1f')],this['uniqueid']));this[_0x9c4f('0x23')]=!![];}function createSquareReport(_0x223543,_0x378436){rpc[_0x9c4f('0x24')](_0x223543)[_0x9c4f('0x25')](function(_0x25447e){if(_0x378436){_0x378436(null,_0x25447e);}})[_0x9c4f('0x26')](function(_0x11b573){if(_0x378436){_0x378436(null,_0x11b573);}});}function setChannelVariables(_0x4e93bf){for(var _0x2df837 in _0x4e93bf){if(_0x4e93bf[_0x9c4f('0x27')](_0x2df837)){if(_0x2df837[_0x9c4f('0x28')](_0x9c4f('0x29'))===0x0){_0x4e93bf[_0x2df837[_0x9c4f('0x2a')](0x4)]=_0x4e93bf[_0x2df837];delete _0x4e93bf[_0x2df837];}}}}function agiHandler(_0x4da109){logger[_0x9c4f('0x2b')](_0x9c4f('0x2c'),JSON[_0x9c4f('0x2d')](_0x4da109,null,0x2));logger[_0x9c4f('0x14')](util[_0x9c4f('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4da109['arg_1'],_0x4da109['calleridname'],_0x4da109[_0x9c4f('0x1e')],_0x4da109['dnid'],_0x4da109[_0x9c4f('0x20')]));_0x4da109['on']('error',errorHandler);_0x4da109['on'](_0x9c4f('0x2e'),closeHandler);_0x4da109['on'](_0x9c4f('0x2f'),timeoutHandler);_0x4da109[_0x9c4f('0x23')]=![];_0x4da109['on'](_0x9c4f('0x30'),hangupHandler);var _0x224613=_['find'](projects,['name',_0x4da109[_0x9c4f('0x1c')]]);if(!_0x224613)return Project['handleNotFound'](_0x4da109);if(!_0x224613[_0x9c4f('0x31')])return Project[_0x9c4f('0x32')](_0x4da109);return Project[_0x9c4f('0x33')](_0x224613,_0x4da109);}function main(){var _0x38719d;return utilLicense['getLicense']()[_0x9c4f('0x25')](function(_0x267001){if(!_0x267001)return;if(_0x267001[_0x9c4f('0x34')]){if(_0x267001[_0x9c4f('0x35')]&&_0x267001[_0x9c4f('0x35')]>0x0){logger[_0x9c4f('0x14')](util[_0x9c4f('0x15')](_0x9c4f('0x36'),_0x267001[_0x9c4f('0x35')]));_0x38719d=_0x267001[_0x9c4f('0x35')];}else{logger[_0x9c4f('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x9c4f('0x37'));_0x38719d=-0x1;}})[_0x9c4f('0x25')](function(){return Project['getAll']();})['then'](function(_0x5c22fd){projects=_0x5c22fd;return;})[_0x9c4f('0x26')](function(_0x56eb44){logger[_0x9c4f('0xe')]('[LICENSE]',_0x56eb44[_0x9c4f('0xf')]);})[_0x9c4f('0x38')](function(){var _0x469b36=require(_0x9c4f('0x39'))(config[_0x9c4f('0x5')][_0x9c4f('0x16')],config[_0x9c4f('0x5')]['ip'],_0x38719d);_0x469b36['on']('error',errorHandler);_0x469b36['on']('listening',listeningHandler);_0x469b36['on']('connection',connectionHandler);_0x469b36['on'](_0x9c4f('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x3272=['indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','name','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','./server','listening','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','agi','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','error','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','then','hasOwnProperty'];(function(_0x369492,_0xa2d5f5){var _0x1ea68e=function(_0x406441){while(--_0x406441){_0x369492['push'](_0x369492['shift']());}};_0x1ea68e(++_0xa2d5f5);}(_0x3272,0x17a));var _0x2327=function(_0x4d044f,_0x1b6abd){_0x4d044f=_0x4d044f-0x0;var _0x79647c=_0x3272[_0x4d044f];return _0x79647c;};'use strict';var _=require(_0x2327('0x0'));var syncho=require(_0x2327('0x1'));var util=require(_0x2327('0x2'));var config=require(_0x2327('0x3'));var logger=require(_0x2327('0x4'))('agi');var utilLicense=require(_0x2327('0x5'));var rpc=require('./rpc');var Project=require(_0x2327('0x6'));var AGIEmitter=require(_0x2327('0x7'))['EventEmitter'];var projects=[];config[_0x2327('0x8')]=_[_0x2327('0x9')](config[_0x2327('0x8')],{'ip':_0x2327('0xa'),'port':0x11dd});AGIEmitter['on'](_0x2327('0xb'),projectUpdateHandler);function connectionHandler(_0x172883){process[_0x2327('0xc')](function(){syncho(function(){try{setChannelVariables(_0x172883);agiHandler(_0x172883);}catch(_0x3393ff){logger['error'](_0x3393ff[_0x2327('0xd')]);}});});}function projectUpdateHandler(_0x2f0898){try{var _0x2034f4=_[_0x2327('0xe')](projects,['id',_0x2f0898['id']]);if(_0x2034f4>-0x1){if(_0x2f0898[_0x2327('0xf')]===!![]){projects['splice'](_0x2034f4,0x1);}else{projects[_0x2034f4]=_0x2f0898;}}else{projects[_0x2327('0x10')](_0x2f0898);}}catch(_0x384973){logger['error'](_0x384973[_0x2327('0xd')]);}}function listeningHandler(){console[_0x2327('0x11')](_0x2327('0x12'),config['agi'][_0x2327('0x13')]);logger[_0x2327('0x14')](util['format'](_0x2327('0x15'),config['agi']['ip'],config['agi'][_0x2327('0x13')]));}function errorHandler(_0x25352c){if(_0x25352c&&_0x25352c['name']&&_0x25352c[_0x2327('0x16')]){logger[_0x2327('0x17')](util[_0x2327('0x18')](_0x2327('0x19'),_0x25352c['name'],_0x25352c[_0x2327('0x16')]));}else{logger[_0x2327('0x17')](util['format'](_0x2327('0x1a'),_0x25352c[_0x2327('0xd')]));}}function closeHandler(){logger[_0x2327('0x14')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2327('0x1b')],this[_0x2327('0x1c')],this['callerid'],this[_0x2327('0x1d')],this[_0x2327('0x1e')]));try{createSquareReport(this);}catch(_0x514a4d){logger['error'](_0x514a4d['stack']);}}function timeoutHandler(){logger[_0x2327('0x14')](util[_0x2327('0x18')](_0x2327('0x1f'),this[_0x2327('0x1b')],this[_0x2327('0x1c')],this[_0x2327('0x20')],this['dnid'],this[_0x2327('0x1e')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2327('0x1b')],this[_0x2327('0x1c')],this['callerid'],this[_0x2327('0x1d')],this[_0x2327('0x1e')]));this['evtHangup']=!![];}function createSquareReport(_0x938cd7,_0x23491d){rpc['createSquareReport'](_0x938cd7)[_0x2327('0x21')](function(_0x5665a0){if(_0x23491d){_0x23491d(null,_0x5665a0);}})['catch'](function(_0x2831a1){if(_0x23491d){_0x23491d(null,_0x2831a1);}});}function setChannelVariables(_0x1b4c4a){for(var _0x46ef8c in _0x1b4c4a){if(_0x1b4c4a[_0x2327('0x22')](_0x46ef8c)){if(_0x46ef8c[_0x2327('0x23')](_0x2327('0x24'))===0x0){_0x1b4c4a[_0x46ef8c['substring'](0x4)]=_0x1b4c4a[_0x46ef8c];delete _0x1b4c4a[_0x46ef8c];}}}}function agiHandler(_0x1ab503){logger[_0x2327('0x25')](_0x2327('0x26'),JSON[_0x2327('0x27')](_0x1ab503,null,0x2));logger[_0x2327('0x14')](util[_0x2327('0x18')](_0x2327('0x28'),_0x1ab503['arg_1'],_0x1ab503['calleridname'],_0x1ab503[_0x2327('0x20')],_0x1ab503[_0x2327('0x1d')],_0x1ab503[_0x2327('0x1e')]));_0x1ab503['on'](_0x2327('0x17'),errorHandler);_0x1ab503['on'](_0x2327('0x29'),closeHandler);_0x1ab503['on'](_0x2327('0x2a'),timeoutHandler);_0x1ab503['evtHangup']=![];_0x1ab503['on']('hangup',hangupHandler);var _0x4b8bb9=_[_0x2327('0x2b')](projects,[_0x2327('0x2c'),_0x1ab503[_0x2327('0x1b')]]);if(!_0x4b8bb9)return Project[_0x2327('0x2d')](_0x1ab503);if(!_0x4b8bb9[_0x2327('0x2e')])return Project[_0x2327('0x2f')](_0x1ab503);return Project[_0x2327('0x30')](_0x4b8bb9,_0x1ab503);}function main(){var _0x469513;return utilLicense[_0x2327('0x31')]()[_0x2327('0x21')](function(_0x165cf6){if(!_0x165cf6)return;if(_0x165cf6[_0x2327('0x32')]){if(_0x165cf6['callysquare']&&_0x165cf6[_0x2327('0x33')]>0x0){logger[_0x2327('0x14')](util[_0x2327('0x18')](_0x2327('0x34'),_0x165cf6[_0x2327('0x33')]));_0x469513=_0x165cf6['callysquare'];}else{logger['info'](_0x2327('0x35'));}}else{logger[_0x2327('0x14')](_0x2327('0x36'));_0x469513=-0x1;}})[_0x2327('0x21')](function(){return Project[_0x2327('0x37')]();})[_0x2327('0x21')](function(_0x570e18){projects=_0x570e18;return;})[_0x2327('0x38')](function(_0x4ec2f9){logger[_0x2327('0x17')]('[LICENSE]',_0x4ec2f9['stack']);})['finally'](function(){var _0x3a5504=require(_0x2327('0x39'))(config[_0x2327('0x8')][_0x2327('0x13')],config[_0x2327('0x8')]['ip'],_0x469513);_0x3a5504['on']('error',errorHandler);_0x3a5504['on'](_0x2327('0x3a'),listeningHandler);_0x3a5504['on']('connection',connectionHandler);_0x3a5504['on'](_0x2327('0x29'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 36fdb34..d37adb7 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 _0x1181=['result','catch','sendMailMessage','bluebird','request','error'];(function(_0x48ad5a,_0x12018c){var _0x4c96bd=function(_0x39326c){while(--_0x39326c){_0x48ad5a['push'](_0x48ad5a['shift']());}};_0x4c96bd(++_0x12018c);}(_0x1181,0xab));var _0x1118=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x1181[_0x1dd532];return _0x3732aa;};'use strict';var BPromise=require(_0x1118('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x96c0b2,_0x538fe2){return new BPromise(function(_0x4e94da,_0x217dd4){return client[_0x1118('0x1')](_0x96c0b2,_0x538fe2)['then'](function(_0x2fa26d){if(_0x2fa26d['error']){return _0x217dd4(_0x2fa26d[_0x1118('0x2')]['message']);}else{return _0x4e94da(_0x2fa26d[_0x1118('0x3')]);}})[_0x1118('0x4')](function(_0x285c10){return _0x217dd4(_0x285c10);});});}exports[_0x1118('0x5')]=function(_0x111d58,_0x41cb91){return request('SendMail',{'account':_0x111d58,'message':_0x41cb91});}; \ No newline at end of file +var _0x3c86=['error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x3c86,0x132));var _0x63c8=function(_0x5d09b5,_0x4be39f){_0x5d09b5=_0x5d09b5-0x0;var _0x15ca70=_0x3c86[_0x5d09b5];return _0x15ca70;};'use strict';var BPromise=require(_0x63c8('0x0'));var jayson=require(_0x63c8('0x1'));var client=jayson[_0x63c8('0x2')][_0x63c8('0x3')]({'port':0x232b});function request(_0x2e03f2,_0x21d68b){return new BPromise(function(_0x3fcce2,_0xa67aa0){return client[_0x63c8('0x4')](_0x2e03f2,_0x21d68b)[_0x63c8('0x5')](function(_0x58e5d4){if(_0x58e5d4[_0x63c8('0x6')]){return _0xa67aa0(_0x58e5d4[_0x63c8('0x6')][_0x63c8('0x7')]);}else{return _0x3fcce2(_0x58e5d4[_0x63c8('0x8')]);}})[_0x63c8('0x9')](function(_0x74bfdb){return _0xa67aa0(_0x74bfdb);});});}exports[_0x63c8('0xa')]=function(_0x449497,_0x3cd498){return request(_0x63c8('0xb'),{'account':_0x449497,'message':_0x3cd498});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 3938dfd..ee159be 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 _0x60b6=['callerid','dnid','uniqueid','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','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','clear','arg_1','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x3e99bd,_0x4cd723){var _0x219738=function(_0x22561e){while(--_0x22561e){_0x3e99bd['push'](_0x3e99bd['shift']());}};_0x219738(++_0x4cd723);}(_0x60b6,0xc7));var _0x660b=function(_0x47d86e,_0x5d166e){_0x47d86e=_0x47d86e-0x0;var _0x4ff76e=_0x60b6[_0x47d86e];return _0x4ff76e;};'use strict';var _=require(_0x660b('0x0'));var moment=require(_0x660b('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0x660b('0x2'))(_0x660b('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x660b('0x4'));var Graph=require(_0x660b('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x660b('0x6')]()[_0x660b('0x7')](function(_0x2c7c4b){logger['error'](_0x660b('0x8'),_0x2c7c4b[_0x660b('0x9')]);return[];});}function addVertex(_0x274724,_0x5cabab,_0x43e394){_0x5cabab[_0x660b('0xa')]=_0x43e394;if(_0x5cabab[_0x660b('0xb')]('retry')){_0x5cabab[_0x660b('0xc')]=parseInt(_0x5cabab[_0x660b('0xd')],0xa);}_0x274724['addVertex'](_[_0x660b('0xe')](_0x5cabab,_0x660b('0xf')));}function initGraph(_0x2b254c,_0x4ce2c9){var _0x47ceb0=new Graph();for(var _0x5a17a2 in _0x2b254c){if(_0x2b254c['hasOwnProperty'](_0x5a17a2)){if(_[_0x660b('0x10')](_0x2b254c[_0x5a17a2])){for(var _0x2e830e=0x0;_0x2e830e<_0x2b254c[_0x5a17a2]['length'];_0x2e830e+=0x1){addVertex(_0x47ceb0,_0x2b254c[_0x5a17a2][_0x2e830e],_0x5a17a2);}}else{addVertex(_0x47ceb0,_0x2b254c[_0x5a17a2],_0x5a17a2);}}}for(var _0x38f386=0x0;_0x38f386<_0x4ce2c9[_0x660b('0x11')];_0x38f386+=0x1){if(_0x4ce2c9[_0x38f386][_0x660b('0x12')]&&_0x4ce2c9[_0x38f386][_0x660b('0x13')]){_0x47ceb0[_0x660b('0x14')](_0x4ce2c9[_0x38f386][_0x660b('0x12')],_0x4ce2c9[_0x38f386][_0x660b('0x13')],_0x4ce2c9[_0x38f386][_0x660b('0x15')]);}}return _0x47ceb0;}function getRoot(_0x45779a){return parser[_0x660b('0x16')](_0x45779a,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x8a2619){return util[_0x660b('0x17')](_0x8a2619,{'showHidden':![],'depth':null});}function initialize(_0x2ba138,_0x724d8d){var _0x4de833=getRoot(_0x2ba138[_0x660b('0x18')]);if(!_0x4de833||!_0x4de833[_0x660b('0x19')])return;var _0x59a90f,_0x5a58a,_0x18673b;logger[_0x660b('0x1a')]('root',JSON[_0x660b('0x1b')](_0x4de833,null,0x2));_0x724d8d[_0x660b('0x1c')]=moment()[_0x660b('0x1d')](_0x660b('0x1e'));_0x59a90f=initGraph(_[_0x660b('0xe')](_0x4de833,_0x660b('0xf')),_0x4de833['mxCell']);_0x5a58a=new Vertices(_0x724d8d,rpc,mailRpc);logger['info'](util['format'](_0x660b('0x1f'),_0x724d8d['arg_1'],_0x724d8d[_0x660b('0x20')],_0x724d8d[_0x660b('0x21')],_0x724d8d[_0x660b('0x22')],_0x724d8d[_0x660b('0x23')]));_0x59a90f['traverseBFS'](_0x4de833[_0x660b('0x19')]['id'],function(_0x58b11f){try{_0x58b11f=_0x5a58a['clear'](_0x58b11f);logger['debug'](_0x660b('0x24'),JSON[_0x660b('0x1b')](_0x58b11f,null,0x2));if(_0x58b11f[_0x660b('0xa')]===_0x660b('0x25')){logger[_0x660b('0x26')](_0x660b('0x27'));_0x724d8d[_0x660b('0x28')]=_0x58b11f['context']||_0x724d8d['context'];_0x724d8d[_0x660b('0x29')]=_0x58b11f['extension'];_0x724d8d[_0x660b('0x2a')]=_0x58b11f['priority']?_0x58b11f[_0x660b('0x2a')]-0x1:0x1;return null;}else if(_0x58b11f&&_0x5a58a[_0x58b11f[_0x660b('0xa')]]){_0x18673b=_0x5a58a[_0x58b11f[_0x660b('0xa')]](_0x58b11f);logger[_0x660b('0x26')](_0x660b('0x2b'),JSON[_0x660b('0x1b')](_0x18673b,null,0x2));if(_0x18673b&&_0x18673b[_0x660b('0x2c')]===AGI_CODE_SUCCESS&&_0x18673b[_0x660b('0x2d')]!==AGI_RESULT_ERROR&&!_0x724d8d['evtHangup']){logger[_0x660b('0x1a')](_0x660b('0x2b'),inspect(_0x18673b));return _[_0x660b('0x2e')](_0x18673b[_0x660b('0x2d')])?null:_0x18673b[_0x660b('0x2d')][_0x660b('0x2f')]();}else{logger['error'](_0x660b('0x2b'),inspect(_0x18673b));return null;}}else{logger[_0x660b('0x30')](_0x660b('0x31'));return null;}}catch(_0x3371ad){logger[_0x660b('0x30')](_0x3371ad[_0x660b('0x9')]);return null;}});if(_0x4de833[_0x660b('0x32')]){logger[_0x660b('0x26')](util['format'](_0x660b('0x33'),_0x724d8d['arg_1'],_0x724d8d['calleridname'],_0x724d8d['callerid'],_0x724d8d[_0x660b('0x22')],_0x724d8d[_0x660b('0x23')]));_0x59a90f['traverseBFS'](_0x4de833['finally']['id'],function(_0x7d5766){try{_0x7d5766=_0x5a58a[_0x660b('0x34')](_0x7d5766);logger[_0x660b('0x1a')]('vertex',JSON[_0x660b('0x1b')](_0x7d5766,null,0x2));if(_0x7d5766&&_0x5a58a[_0x7d5766[_0x660b('0xa')]]){_0x18673b=_0x5a58a[_0x7d5766[_0x660b('0xa')]](_0x7d5766);if(_0x18673b){logger['debug']('response',inspect(_0x18673b));return _[_0x660b('0x2e')](_0x18673b[_0x660b('0x2d')])?null:_0x18673b['result'][_0x660b('0x2f')]();}else{logger['error'](_0x660b('0x2b'),inspect(_0x18673b));return null;}}else{logger[_0x660b('0x30')]('agicommand\x20not\x20found');return null;}}catch(_0x133311){logger[_0x660b('0x30')](_0x133311[_0x660b('0x9')]);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x724d8d[_0x660b('0x35')],_0x724d8d[_0x660b('0x20')],_0x724d8d[_0x660b('0x21')],_0x724d8d['dnid'],_0x724d8d['uniqueid']));logger[_0x660b('0x26')](util[_0x660b('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x724d8d[_0x660b('0x28')],_0x724d8d[_0x660b('0x29')],parseInt(_0x724d8d[_0x660b('0x2a')],0xa)+0x1));_0x724d8d[_0x660b('0x36')](_0x724d8d['context'],_0x724d8d[_0x660b('0x29')],parseInt(_0x724d8d[_0x660b('0x2a')],0xa)+0x1);_0x724d8d[_0x660b('0x37')]();}function handleNotFound(_0x442c54){logger[_0x660b('0x30')](util['format'](_0x660b('0x38'),_0x442c54[_0x660b('0x35')]));_0x442c54[_0x660b('0x36')](_0x442c54['context'],_0x442c54[_0x660b('0x29')],parseInt(_0x442c54[_0x660b('0x2a')],0xa)+0x1);_0x442c54[_0x660b('0x37')]();}function handleUnpublished(_0x1e7350){logger[_0x660b('0x30')](util[_0x660b('0x1d')](_0x660b('0x39'),_0x1e7350[_0x660b('0x35')]));_0x1e7350[_0x660b('0x36')](_0x1e7350[_0x660b('0x28')],_0x1e7350[_0x660b('0x29')],parseInt(_0x1e7350[_0x660b('0x2a')],0xa)+0x1);_0x1e7350[_0x660b('0x37')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x5bb6=['./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','maxRetry','addVertex','omit','length','source','target','addEdge','value','toJson','inspect','production','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','traverseBFS','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','lodash','moment','xml2json','../../config/logger','./rpc','./mailRpc'];(function(_0x192426,_0x2dda84){var _0x2e22a6=function(_0xa17e0e){while(--_0xa17e0e){_0x192426['push'](_0x192426['shift']());}};_0x2e22a6(++_0x2dda84);}(_0x5bb6,0x1d2));var _0x65bb=function(_0x2935ed,_0x3dec0d){_0x2935ed=_0x2935ed-0x0;var _0x509007=_0x5bb6[_0x2935ed];return _0x509007;};'use strict';var _=require(_0x65bb('0x0'));var moment=require(_0x65bb('0x1'));var parser=require(_0x65bb('0x2'));var util=require('util');var logger=require(_0x65bb('0x3'))('agi');var rpc=require(_0x65bb('0x4'));var mailRpc=require(_0x65bb('0x5'));var Graph=require(_0x65bb('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x65bb('0x7')]()[_0x65bb('0x8')](function(_0x418c84){logger[_0x65bb('0x9')](_0x65bb('0xa'),_0x418c84['stack']);return[];});}function addVertex(_0x4eb9bf,_0x3c89c3,_0x577624){_0x3c89c3[_0x65bb('0xb')]=_0x577624;if(_0x3c89c3['hasOwnProperty'](_0x65bb('0xc'))){_0x3c89c3[_0x65bb('0xd')]=parseInt(_0x3c89c3['retry'],0xa);}_0x4eb9bf[_0x65bb('0xe')](_[_0x65bb('0xf')](_0x3c89c3,'mxCell'));}function initGraph(_0x34ec87,_0x3ec940){var _0x341028=new Graph();for(var _0xbce5e in _0x34ec87){if(_0x34ec87['hasOwnProperty'](_0xbce5e)){if(_['isArray'](_0x34ec87[_0xbce5e])){for(var _0x2b3015=0x0;_0x2b3015<_0x34ec87[_0xbce5e]['length'];_0x2b3015+=0x1){addVertex(_0x341028,_0x34ec87[_0xbce5e][_0x2b3015],_0xbce5e);}}else{addVertex(_0x341028,_0x34ec87[_0xbce5e],_0xbce5e);}}}for(var _0x5c78db=0x0;_0x5c78db<_0x3ec940[_0x65bb('0x10')];_0x5c78db+=0x1){if(_0x3ec940[_0x5c78db][_0x65bb('0x11')]&&_0x3ec940[_0x5c78db][_0x65bb('0x12')]){_0x341028[_0x65bb('0x13')](_0x3ec940[_0x5c78db][_0x65bb('0x11')],_0x3ec940[_0x5c78db][_0x65bb('0x12')],_0x3ec940[_0x5c78db][_0x65bb('0x14')]);}}return _0x341028;}function getRoot(_0x1d2402){return parser[_0x65bb('0x15')](_0x1d2402,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x404034){return util[_0x65bb('0x16')](_0x404034,{'showHidden':![],'depth':null});}function initialize(_0x410c11,_0xdd9de4){var _0x3f0ccf=getRoot(_0x410c11[_0x65bb('0x17')]);if(!_0x3f0ccf||!_0x3f0ccf[_0x65bb('0x18')])return;var _0x1eba09,_0xfd3830,_0x57c871;logger[_0x65bb('0x19')](_0x65bb('0x1a'),JSON[_0x65bb('0x1b')](_0x3f0ccf,null,0x2));_0xdd9de4[_0x65bb('0x1c')]=moment()['format'](_0x65bb('0x1d'));_0x1eba09=initGraph(_[_0x65bb('0xf')](_0x3f0ccf,_0x65bb('0x1e')),_0x3f0ccf['mxCell']);_0xfd3830=new Vertices(_0xdd9de4,rpc,mailRpc);logger['info'](util['format'](_0x65bb('0x1f'),_0xdd9de4[_0x65bb('0x20')],_0xdd9de4[_0x65bb('0x21')],_0xdd9de4[_0x65bb('0x22')],_0xdd9de4[_0x65bb('0x23')],_0xdd9de4['uniqueid']));_0x1eba09['traverseBFS'](_0x3f0ccf[_0x65bb('0x18')]['id'],function(_0x764018){try{_0x764018=_0xfd3830[_0x65bb('0x24')](_0x764018);logger[_0x65bb('0x19')](_0x65bb('0x25'),JSON[_0x65bb('0x1b')](_0x764018,null,0x2));if(_0x764018[_0x65bb('0xb')]===_0x65bb('0x26')){logger[_0x65bb('0x27')](_0x65bb('0x28'));_0xdd9de4['context']=_0x764018[_0x65bb('0x29')]||_0xdd9de4[_0x65bb('0x29')];_0xdd9de4[_0x65bb('0x2a')]=_0x764018[_0x65bb('0x2a')];_0xdd9de4['priority']=_0x764018[_0x65bb('0x2b')]?_0x764018['priority']-0x1:0x1;return null;}else if(_0x764018&&_0xfd3830[_0x764018[_0x65bb('0xb')]]){_0x57c871=_0xfd3830[_0x764018['agicommand']](_0x764018);logger[_0x65bb('0x27')](_0x65bb('0x2c'),JSON[_0x65bb('0x1b')](_0x57c871,null,0x2));if(_0x57c871&&_0x57c871[_0x65bb('0x2d')]===AGI_CODE_SUCCESS&&_0x57c871[_0x65bb('0x2e')]!==AGI_RESULT_ERROR&&!_0xdd9de4[_0x65bb('0x2f')]){logger[_0x65bb('0x19')](_0x65bb('0x2c'),inspect(_0x57c871));return _[_0x65bb('0x30')](_0x57c871[_0x65bb('0x2e')])?null:_0x57c871['result'][_0x65bb('0x31')]();}else{logger[_0x65bb('0x9')](_0x65bb('0x2c'),inspect(_0x57c871));return null;}}else{logger[_0x65bb('0x9')](_0x65bb('0x32'));return null;}}catch(_0x95b621){logger['error'](_0x95b621[_0x65bb('0x33')]);return null;}});if(_0x3f0ccf['finally']){logger[_0x65bb('0x27')](util[_0x65bb('0x34')](_0x65bb('0x35'),_0xdd9de4[_0x65bb('0x20')],_0xdd9de4['calleridname'],_0xdd9de4[_0x65bb('0x22')],_0xdd9de4[_0x65bb('0x23')],_0xdd9de4[_0x65bb('0x36')]));_0x1eba09[_0x65bb('0x37')](_0x3f0ccf['finally']['id'],function(_0x5518e8){try{_0x5518e8=_0xfd3830['clear'](_0x5518e8);logger[_0x65bb('0x19')]('vertex',JSON[_0x65bb('0x1b')](_0x5518e8,null,0x2));if(_0x5518e8&&_0xfd3830[_0x5518e8[_0x65bb('0xb')]]){_0x57c871=_0xfd3830[_0x5518e8[_0x65bb('0xb')]](_0x5518e8);if(_0x57c871){logger['debug']('response',inspect(_0x57c871));return _['isUndefined'](_0x57c871['result'])?null:_0x57c871[_0x65bb('0x2e')][_0x65bb('0x31')]();}else{logger[_0x65bb('0x9')](_0x65bb('0x2c'),inspect(_0x57c871));return null;}}else{logger[_0x65bb('0x9')](_0x65bb('0x32'));return null;}}catch(_0x40deea){logger[_0x65bb('0x9')](_0x40deea[_0x65bb('0x33')]);return null;}});}logger['info'](util[_0x65bb('0x34')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xdd9de4['arg_1'],_0xdd9de4['calleridname'],_0xdd9de4[_0x65bb('0x22')],_0xdd9de4['dnid'],_0xdd9de4[_0x65bb('0x36')]));logger[_0x65bb('0x27')](util[_0x65bb('0x34')](_0x65bb('0x38'),_0xdd9de4['context'],_0xdd9de4[_0x65bb('0x2a')],parseInt(_0xdd9de4[_0x65bb('0x2b')],0xa)+0x1));_0xdd9de4['continueAt'](_0xdd9de4[_0x65bb('0x29')],_0xdd9de4[_0x65bb('0x2a')],parseInt(_0xdd9de4[_0x65bb('0x2b')],0xa)+0x1);_0xdd9de4[_0x65bb('0x39')]();}function handleNotFound(_0x3c99e1){logger[_0x65bb('0x9')](util[_0x65bb('0x34')]('Project\x20%s\x20not\x20found',_0x3c99e1['arg_1']));_0x3c99e1[_0x65bb('0x3a')](_0x3c99e1[_0x65bb('0x29')],_0x3c99e1['extension'],parseInt(_0x3c99e1[_0x65bb('0x2b')],0xa)+0x1);_0x3c99e1[_0x65bb('0x39')]();}function handleUnpublished(_0x586349){logger[_0x65bb('0x9')](util[_0x65bb('0x34')]('Project\x20%s\x20not\x20published',_0x586349[_0x65bb('0x20')]));_0x586349[_0x65bb('0x3a')](_0x586349[_0x65bb('0x29')],_0x586349['extension'],parseInt(_0x586349['priority'],0xa)+0x1);_0x586349[_0x65bb('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6e0b03d..dc6ec06 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 _0xb689=['headers','indexOf','exports','util','stream','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','substring','split','slice','trim','length','emit'];(function(_0x4ac281,_0x5dc211){var _0x5ab36b=function(_0x3d4cdd){while(--_0x3d4cdd){_0x4ac281['push'](_0x4ac281['shift']());}};_0x5ab36b(++_0x5dc211);}(_0xb689,0x113));var _0x9b68=function(_0x13dabd,_0x1a105f){_0x13dabd=_0x13dabd-0x0;var _0x4ca273=_0xb689[_0x13dabd];return _0x4ca273;};'use strict';var util=require(_0x9b68('0x0'));var Transform=require(_0x9b68('0x1'))['Transform'];function AGIReply(_0x268451){Transform[_0x9b68('0x2')](this,_0x268451);this['_localBuffer']='';this[_0x9b68('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x9b68('0x4')][_0x9b68('0x5')]=function(_0x2a157e,_0x5658b2,_0x1139f2){var _0x136d42='\x0a',_0x10b3f5=['\x0a\x0a',_0x9b68('0x6')],_0x1eb7d1=-0x1,_0x26216c=-0x1,_0x404399='',_0x363984=0x0,_0x5b8414='',_0x37d8fd='';this[_0x9b68('0x7')]+=_0x2a157e['toString']();_0x5b8414=this[_0x9b68('0x7')];if(!this[_0x9b68('0x3')]){_0x363984=0x0;while(_0x10b3f5[_0x363984]){while((_0x26216c=_0x5b8414['indexOf'](_0x10b3f5[_0x363984]))!=-0x1){_0x404399=_0x10b3f5[_0x363984];_0x37d8fd=_0x5b8414['substring'](0x0,_0x26216c);_0x5b8414=_0x5b8414[_0x9b68('0x8')](_0x26216c+_0x404399['length']);var _0x132767=_0x37d8fd[_0x9b68('0x9')](_0x136d42),_0x232337=0x0,_0x34a267={},_0x1efae1='',_0x43a410='',_0x584969=-0x1;while(_0x132767[_0x232337]){_0x584969=_0x132767[_0x232337]['indexOf'](':');if(_0x584969!=-0x1){_0x1efae1=_0x132767[_0x232337][_0x9b68('0xa')](0x0,_0x584969)[_0x9b68('0xb')]();_0x43a410=_0x132767[_0x232337][_0x9b68('0xa')](_0x584969+0x1)[_0x9b68('0xb')]();if(_0x1efae1[_0x9b68('0xc')]>0x0){_0x34a267[_0x1efae1]=_0x43a410;}}else{}_0x232337++;}this[_0x9b68('0xd')](_0x9b68('0xe'),_0x34a267);this[_0x9b68('0x3')]=!![];}_0x363984++;}this[_0x9b68('0x7')]=_0x5b8414;}else{while((_0x1eb7d1=_0x5b8414[_0x9b68('0xf')](_0x136d42))!=-0x1){_0x37d8fd=_0x5b8414[_0x9b68('0x8')](0x0,_0x1eb7d1);this['emit']('line',_0x37d8fd);_0x5b8414=_0x5b8414[_0x9b68('0x8')](_0x1eb7d1+_0x136d42[_0x9b68('0xc')]);}this[_0x9b68('0x7')]=_0x5b8414;}_0x1139f2();};module[_0x9b68('0x10')]=AGIReply; \ No newline at end of file +var _0xbeec=['indexOf','slice','trim','emit','headers','line','exports','util','stream','Transform','call','_inBody','inherits','_transform','_localBuffer','toString','substring','length','split'];(function(_0xa983e6,_0xf3691c){var _0x5c546d=function(_0x15238f){while(--_0x15238f){_0xa983e6['push'](_0xa983e6['shift']());}};_0x5c546d(++_0xf3691c);}(_0xbeec,0xb2));var _0xcbee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeec[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xcbee('0x0'));var Transform=require(_0xcbee('0x1'))[_0xcbee('0x2')];function AGIReply(_0xcd9bb8){Transform[_0xcbee('0x3')](this,_0xcd9bb8);this['_localBuffer']='';this[_0xcbee('0x4')]=![];}util[_0xcbee('0x5')](AGIReply,Transform);AGIReply['prototype'][_0xcbee('0x6')]=function(_0x25b233,_0x7634f3,_0x275e25){var _0x8c20fa='\x0a',_0x472698=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3823bf=-0x1,_0x3a4a40=-0x1,_0x58b516='',_0x430f52=0x0,_0xf0c0fc='',_0x39d4b3='';this[_0xcbee('0x7')]+=_0x25b233[_0xcbee('0x8')]();_0xf0c0fc=this[_0xcbee('0x7')];if(!this[_0xcbee('0x4')]){_0x430f52=0x0;while(_0x472698[_0x430f52]){while((_0x3a4a40=_0xf0c0fc['indexOf'](_0x472698[_0x430f52]))!=-0x1){_0x58b516=_0x472698[_0x430f52];_0x39d4b3=_0xf0c0fc['substring'](0x0,_0x3a4a40);_0xf0c0fc=_0xf0c0fc[_0xcbee('0x9')](_0x3a4a40+_0x58b516[_0xcbee('0xa')]);var _0x560472=_0x39d4b3[_0xcbee('0xb')](_0x8c20fa),_0x5b256e=0x0,_0x4b95fc={},_0x49b2d7='',_0x16b8d7='',_0x26e4b2=-0x1;while(_0x560472[_0x5b256e]){_0x26e4b2=_0x560472[_0x5b256e][_0xcbee('0xc')](':');if(_0x26e4b2!=-0x1){_0x49b2d7=_0x560472[_0x5b256e][_0xcbee('0xd')](0x0,_0x26e4b2)['trim']();_0x16b8d7=_0x560472[_0x5b256e][_0xcbee('0xd')](_0x26e4b2+0x1)[_0xcbee('0xe')]();if(_0x49b2d7[_0xcbee('0xa')]>0x0){_0x4b95fc[_0x49b2d7]=_0x16b8d7;}}else{}_0x5b256e++;}this[_0xcbee('0xf')](_0xcbee('0x10'),_0x4b95fc);this[_0xcbee('0x4')]=!![];}_0x430f52++;}this[_0xcbee('0x7')]=_0xf0c0fc;}else{while((_0x3823bf=_0xf0c0fc['indexOf'](_0x8c20fa))!=-0x1){_0x39d4b3=_0xf0c0fc['substring'](0x0,_0x3823bf);this[_0xcbee('0xf')](_0xcbee('0x11'),_0x39d4b3);_0xf0c0fc=_0xf0c0fc[_0xcbee('0x9')](_0x3823bf+_0x8c20fa['length']);}this[_0xcbee('0x7')]=_0xf0c0fc;}_0x275e25();};module[_0xcbee('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 f892cb4..f1e20be 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 _0xa1fd=['LogoutUser','lodash','moment','jayson/promise','client','request','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','ShowUser','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','agentLogin','PauseUser','UnpauseUser','agentLogout'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x36f5b7,_0x1514ca){_0x36f5b7=_0x36f5b7-0x0;var _0x495dfb=_0xa1fd[_0x36f5b7];return _0x495dfb;};'use strict';var _=require(_0xda1f('0x0'));var moment=require(_0xda1f('0x1'));var jayson=require(_0xda1f('0x2'));var client=jayson[_0xda1f('0x3')]['http']({'port':0x2329});function request(_0x221036,_0xafa72c){return new Promise(function(_0x2ce9f4,_0x46b451){return client[_0xda1f('0x4')](_0x221036,_0xafa72c)['then'](function(_0x470569){if(_0x470569[_0xda1f('0x5')]){return _0x46b451(_0x470569[_0xda1f('0x5')]['message']);}else{return _0x2ce9f4(_0x470569[_0xda1f('0x6')]);}})[_0xda1f('0x7')](function(_0x199a8d){return _0x46b451(_0x199a8d);});});}exports[_0xda1f('0x8')]=function(){return request(_0xda1f('0x9'),{'options':{'raw':![],'attributes':['id',_0xda1f('0xa'),_0xda1f('0xb')]}});};exports[_0xda1f('0xc')]=function(_0x13467c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x13467c},'attributes':[_0xda1f('0xb')]}});};exports[_0xda1f('0xd')]=function(_0x20ab8b){return request(_0xda1f('0xe'),{'options':{'raw':![],'where':{'id':_0x20ab8b},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xda1f('0xf'),'as':_0xda1f('0xf')}]}],'attributes':['id',_0xda1f('0xa'),_0xda1f('0x10')],'smtp':!![]}});};exports[_0xda1f('0x11')]=function(_0x4ee57d){return request(_0xda1f('0x12'),{'options':{'where':{'id':_0x4ee57d},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x13')]=function(_0x306184){return request(_0xda1f('0x14'),{'options':{'where':{'id':_0x306184},'attributes':[_0xda1f('0xa')]}});};exports['getVariableById']=function(_0x77da5b){return request(_0xda1f('0x15'),{'options':{'where':{'id':_0x77da5b},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x16')]=function(_0x48f5d0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x48f5d0},'attributes':[_0xda1f('0x17')]}});};exports['getUserById']=function(_0x3424a1){return request(_0xda1f('0x18'),{'options':{'where':{'id':_0x3424a1},'attributes':[_0xda1f('0xa')]}});};exports['getContactByPhone']=function(_0xe81fc2){return request(_0xda1f('0x19'),{'options':{'where':{'phone':_0xe81fc2['phone']},'attributes':['id']}});};exports[_0xda1f('0x1a')]=function(_0x31cbba){return request('ShowTrunk',{'options':{'where':{'id':_0x31cbba},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x1b')]=function(_0x3977cf){return request(_0xda1f('0x1c'),{'options':{'where':{'id':_0x3977cf},'attributes':[_0xda1f('0x1d')]}});};exports[_0xda1f('0x1e')]=function(_0x1f6958){return request(_0xda1f('0x1f'),{'options':{'raw':![],'where':{'id':_0x1f6958},'include':[{'model':_0xda1f('0x20'),'as':_0xda1f('0x21')}]}});};exports[_0xda1f('0x22')]=function(_0xc76888){return request('ShowSmsAccount',{'options':{'where':{'id':_0xc76888},'attributes':['id',_0xda1f('0xa')]}});};exports['createSmsMessage']=function(_0x443fa1){return request('CreateSmsMessage',{'body':_0x443fa1});};exports[_0xda1f('0x23')]=function(_0x2d209d){return request('CreateSquareDetailsReport',{'body':_0x2d209d});};exports[_0xda1f('0x24')]=function(_0x146390){return request(_0xda1f('0x25'),{'body':_[_0xda1f('0x26')](_0x146390,{'project_name':_0x146390[_0xda1f('0x27')],'prev_project_name':_0x146390['arg_2']||'','is_subproject':_0x146390[_0xda1f('0x28')]?!![]:![],'leaveAt':moment()[_0xda1f('0x29')](_0xda1f('0x2a'))})});};exports[_0xda1f('0x2b')]=function(_0x54203a){return request(_0xda1f('0x2c'),{'body':_0x54203a});};exports[_0xda1f('0x2d')]=function(_0x4a994f){return request(_0xda1f('0x2e'),{'body':_0x4a994f});};exports['createCmContact']=function(_0x34459d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x34459d['phone'],'ListId':_0x34459d[_0xda1f('0x2f')]}}})['then'](function(_0x4d5bb0){if(_0x4d5bb0){return _0x4d5bb0;}return request(_0xda1f('0x30'),{'body':_0x34459d});});};exports[_0xda1f('0x31')]=function(_0x2188d9){return request('ShowPause',{'options':{'where':{'id':_0x2188d9},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x32')]=function(_0x5359a7,_0x1c8cfc){return request('LoginUser',{'body':{'interface':_0x1c8cfc},'options':{'where':_0x5359a7}});};exports['agentPause']=function(_0x4850d3,_0x90a7a3,_0x7f3b78){return request(_0xda1f('0x33'),{'body':{'type':_0x90a7a3,'uniqueid':_0x7f3b78},'options':{'where':_0x4850d3}});};exports['agentUnpause']=function(_0x30b8cf){return request(_0xda1f('0x34'),{'body':{},'options':{'where':_0x30b8cf}});};exports[_0xda1f('0x35')]=function(_0x481dc5){return request(_0xda1f('0x36'),{'body':{},'options':{'where':_0x481dc5}});}; \ No newline at end of file +var _0x0c2b=['createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording'];(function(_0x147b56,_0x409050){var _0x4bae17=function(_0x2e9acb){while(--_0x2e9acb){_0x147b56['push'](_0x147b56['shift']());}};_0x4bae17(++_0x409050);}(_0x0c2b,0x134));var _0xb0c2=function(_0x86d610,_0x258059){_0x86d610=_0x86d610-0x0;var _0x89ff1b=_0x0c2b[_0x86d610];return _0x89ff1b;};'use strict';var _=require(_0xb0c2('0x0'));var moment=require(_0xb0c2('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb0c2('0x2')]({'port':0x2329});function request(_0x4e9482,_0x359b0e){return new Promise(function(_0xb31d26,_0x44eec2){return client[_0xb0c2('0x3')](_0x4e9482,_0x359b0e)[_0xb0c2('0x4')](function(_0x48cd58){if(_0x48cd58['error']){return _0x44eec2(_0x48cd58[_0xb0c2('0x5')][_0xb0c2('0x6')]);}else{return _0xb31d26(_0x48cd58[_0xb0c2('0x7')]);}})[_0xb0c2('0x8')](function(_0x27e2fb){return _0x44eec2(_0x27e2fb);});});}exports[_0xb0c2('0x9')]=function(){return request(_0xb0c2('0xa'),{'options':{'raw':![],'attributes':['id',_0xb0c2('0xb'),'production']}});};exports[_0xb0c2('0xc')]=function(_0x28cf0b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x28cf0b},'attributes':['production']}});};exports['getMailAccountById']=function(_0x22e593){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x22e593},'include':[{'model':_0xb0c2('0xd'),'as':_0xb0c2('0xe'),'include':[{'model':'CloudProvider','as':_0xb0c2('0xf')}]}],'attributes':['id',_0xb0c2('0xb'),_0xb0c2('0x10')],'smtp':!![]}});};exports[_0xb0c2('0x11')]=function(_0x2e03bb){return request(_0xb0c2('0x12'),{'options':{'where':{'id':_0x2e03bb},'attributes':[_0xb0c2('0xb')]}});};exports[_0xb0c2('0x13')]=function(_0xafb89d){return request(_0xb0c2('0x14'),{'options':{'where':{'id':_0xafb89d},'attributes':[_0xb0c2('0xb')]}});};exports['getVariableById']=function(_0x465efc){return request(_0xb0c2('0x15'),{'options':{'where':{'id':_0x465efc},'attributes':[_0xb0c2('0xb')]}});};exports['getSquareOdbcById']=function(_0x572b19){return request(_0xb0c2('0x16'),{'options':{'where':{'id':_0x572b19},'attributes':[_0xb0c2('0x17')]}});};exports['getUserById']=function(_0x56d619){return request(_0xb0c2('0x18'),{'options':{'where':{'id':_0x56d619},'attributes':[_0xb0c2('0xb')]}});};exports[_0xb0c2('0x19')]=function(_0x2e0c73){return request('GetContactByPhone',{'options':{'where':{'phone':_0x2e0c73[_0xb0c2('0x1a')]},'attributes':['id']}});};exports[_0xb0c2('0x1b')]=function(_0x2c177b){return request(_0xb0c2('0x1c'),{'options':{'where':{'id':_0x2c177b},'attributes':['name']}});};exports[_0xb0c2('0x1d')]=function(_0x45fd70){return request(_0xb0c2('0x1e'),{'options':{'where':{'id':_0x45fd70},'attributes':['save_name']}});};exports[_0xb0c2('0x1f')]=function(_0x49cc6a){return request(_0xb0c2('0x20'),{'options':{'raw':![],'where':{'id':_0x49cc6a},'include':[{'model':'Interval','as':_0xb0c2('0x21')}]}});};exports[_0xb0c2('0x22')]=function(_0x3a4568){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3a4568},'attributes':['id',_0xb0c2('0xb')]}});};exports[_0xb0c2('0x23')]=function(_0x11ec98){return request(_0xb0c2('0x24'),{'body':_0x11ec98});};exports[_0xb0c2('0x25')]=function(_0x1c3a94){return request('CreateSquareDetailsReport',{'body':_0x1c3a94});};exports[_0xb0c2('0x26')]=function(_0x35377b){return request(_0xb0c2('0x27'),{'body':_[_0xb0c2('0x28')](_0x35377b,{'project_name':_0x35377b[_0xb0c2('0x29')],'prev_project_name':_0x35377b[_0xb0c2('0x2a')]||'','is_subproject':_0x35377b['arg_2']?!![]:![],'leaveAt':moment()[_0xb0c2('0x2b')](_0xb0c2('0x2c'))})});};exports['createSquareRecording']=function(_0x1b92c7){return request(_0xb0c2('0x2d'),{'body':_0x1b92c7});};exports[_0xb0c2('0x2e')]=function(_0x1766f7){return request(_0xb0c2('0x2f'),{'body':_0x1766f7});};exports[_0xb0c2('0x30')]=function(_0x5c6f6a){return request(_0xb0c2('0x31'),{'options':{'raw':![],'where':{'phone':_0x5c6f6a[_0xb0c2('0x1a')],'ListId':_0x5c6f6a['ListId']}}})[_0xb0c2('0x4')](function(_0x2effdf){if(_0x2effdf){return _0x2effdf;}return request(_0xb0c2('0x32'),{'body':_0x5c6f6a});});};exports[_0xb0c2('0x33')]=function(_0x1cb294){return request('ShowPause',{'options':{'where':{'id':_0x1cb294},'attributes':[_0xb0c2('0xb')]}});};exports[_0xb0c2('0x34')]=function(_0x501176,_0x3011c9){return request(_0xb0c2('0x35'),{'body':{'interface':_0x3011c9},'options':{'where':_0x501176}});};exports[_0xb0c2('0x36')]=function(_0xed5f65,_0x38f015,_0x4503ce){return request('PauseUser',{'body':{'type':_0x38f015,'uniqueid':_0x4503ce},'options':{'where':_0xed5f65}});};exports[_0xb0c2('0x37')]=function(_0x305c78){return request(_0xb0c2('0x38'),{'body':{},'options':{'where':_0x305c78}});};exports[_0xb0c2('0x39')]=function(_0x41dd23){return request(_0xb0c2('0x3a'),{'body':{},'options':{'where':_0x41dd23}});}; \ 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 bcb85cc..f546d5f 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 _0x0650=['exports','./polly'];(function(_0x604a42,_0x98c70a){var _0x557439=function(_0x5b0d99){while(--_0x5b0d99){_0x604a42['push'](_0x604a42['shift']());}};_0x557439(++_0x98c70a);}(_0x0650,0xed));var _0x0065=function(_0x3cd128,_0x4c36f5){_0x3cd128=_0x3cd128-0x0;var _0x1c3e99=_0x0650[_0x3cd128];return _0x1c3e99;};var polly=require(_0x0065('0x0'));var lex=require('./lex');module[_0x0065('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4cb5=['./lex','exports','./polly'];(function(_0x258d2a,_0x16ee9e){var _0x3fa65c=function(_0x595df2){while(--_0x595df2){_0x258d2a['push'](_0x258d2a['shift']());}};_0x3fa65c(++_0x16ee9e);}(_0x4cb5,0x8f));var _0x54cb=function(_0x14a1c0,_0xf02932){_0x14a1c0=_0x14a1c0-0x0;var _0x4249ec=_0x4cb5[_0x14a1c0];return _0x4249ec;};var polly=require(_0x54cb('0x0'));var lex=require(_0x54cb('0x1'));module[_0x54cb('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 6e0b00a..826e96b 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 _0xdace=['./lib/api'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xdace,0xc5));var _0xedac=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xdace[_0x6dd5c];return _0x5a87fa;};'use strict';var lex=require(_0xedac('0x0'));module['exports']=function(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2){return lex(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2);}; \ No newline at end of file +var _0x6324=['./lib/api','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6324,0x142));var _0x4632=function(_0x4b5bab,_0x1d73d4){_0x4b5bab=_0x4b5bab-0x0;var _0x5abd6b=_0x6324[_0x4b5bab];return _0x5abd6b;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ 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 531692e..e65db66 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(_0x51f90c,_0x1a61fa){var _0x5be98d=function(_0x3d9083){while(--_0x3d9083){_0x51f90c['push'](_0x51f90c['shift']());}};_0x5be98d(++_0x1a61fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xbd9f75,_0x419399){var _0x10c8ed=function(_0x50d70b){while(--_0x50d70b){_0xbd9f75['push'](_0xbd9f75['shift']());}};_0x10c8ed(++_0x419399);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 9512b11..cf9166d 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 _0x511c=['exports','./lib/api'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x511c,0x113));var _0xc511=function(_0x55bf96,_0x7267a7){_0x55bf96=_0x55bf96-0x0;var _0x5092ef=_0x511c[_0x55bf96];return _0x5092ef;};'use strict';var polly=require(_0xc511('0x0'));module[_0xc511('0x1')]=function(_0x2f7127,_0x2c5eb7,_0x4606ff,_0x41dbe9,_0x8b8c7d,_0x4e74c4,_0x50e94a){return polly(_0x2f7127,_0x2c5eb7,_0x4606ff,_0x41dbe9,_0x8b8c7d,_0x4e74c4,_0x50e94a);}; \ No newline at end of file +var _0xfff3=['./lib/api','exports'];(function(_0x119ea2,_0x21d670){var _0x3068b4=function(_0x3c2b9d){while(--_0x3c2b9d){_0x119ea2['push'](_0x119ea2['shift']());}};_0x3068b4(++_0x21d670);}(_0xfff3,0xf2));var _0x3fff=function(_0x531056,_0x5c3b5e){_0x531056=_0x531056-0x0;var _0x52a7ea=_0xfff3[_0x531056];return _0x52a7ea;};'use strict';var polly=require(_0x3fff('0x0'));module[_0x3fff('0x1')]=function(_0x4c718e,_0x34bb89,_0x20c803,_0x524876,_0x2c17ee,_0x228285,_0x464b4d){return polly(_0x4c718e,_0x34bb89,_0x20c803,_0x524876,_0x2c17ee,_0x228285,_0x464b4d);}; \ 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 50ca18a..ef38561 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 _0x1b64=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x1b64,0x1e3));var _0x41b6=function(_0x8cac8a,_0x29b03d){_0x8cac8a=_0x8cac8a-0x0;var _0x28bade=_0x1b64[_0x8cac8a];return _0x28bade;};'use strict';var fs=require('fs');var path=require(_0x41b6('0x0'));var BPromise=require(_0x41b6('0x1'));var rs=require(_0x41b6('0x2'));var AWS=require(_0x41b6('0x3'));function pollyResult(_0x4d7ee5,_0x5e79b3,_0x2b6a52){return new BPromise(function(_0x5bace7,_0x57fc41){_0x4d7ee5[_0x41b6('0x4')](_0x5e79b3,function(_0xda3d66,_0x902e6a){if(_0xda3d66){_0x57fc41(_0xda3d66);}else if(_0x902e6a){if(_0x902e6a[_0x41b6('0x5')]instanceof Buffer){fs[_0x41b6('0x6')](_0x2b6a52,_0x902e6a[_0x41b6('0x5')],function(_0x191aa1){if(_0x191aa1){_0x57fc41(_0x191aa1);}else{_0x5bace7();}});}else{_0x57fc41(new Error(_0x41b6('0x7')));}}else{_0x57fc41(new Error(_0x41b6('0x8')));}});});}module['exports']=function(_0x1a18d4,_0x1c4d2f,_0x25e130,_0x1d6ddf,_0x3824eb,_0xc3d5de,_0x1ac896){var _0x6c2227=new AWS[(_0x41b6('0x9'))]({'accessKeyId':_0x1a18d4,'secretAccessKey':_0x1c4d2f,'region':_0x25e130});var _0x3b7927={'Text':_0x3824eb,'TextType':_0xc3d5de||_0x41b6('0xa'),'OutputFormat':'mp3','VoiceId':_0x1d6ddf};return pollyResult(_0x6c2227,_0x3b7927,_0x1ac896);}; \ No newline at end of file +var _0x2a4a=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','randomstring','synthesizeSpeech'];(function(_0x15c211,_0x13093b){var _0x2fc84c=function(_0x37852d){while(--_0x37852d){_0x15c211['push'](_0x15c211['shift']());}};_0x2fc84c(++_0x13093b);}(_0x2a4a,0xb2));var _0xa2a4=function(_0x159d14,_0xfda679){_0x159d14=_0x159d14-0x0;var _0x51dc17=_0x2a4a[_0x159d14];return _0x51dc17;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xa2a4('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x4e5f18,_0x4c37b9,_0x33ed77){return new BPromise(function(_0x3f3700,_0x18456a){_0x4e5f18[_0xa2a4('0x1')](_0x4c37b9,function(_0x32ac15,_0x4a0728){if(_0x32ac15){_0x18456a(_0x32ac15);}else if(_0x4a0728){if(_0x4a0728[_0xa2a4('0x2')]instanceof Buffer){fs[_0xa2a4('0x3')](_0x33ed77,_0x4a0728[_0xa2a4('0x2')],function(_0x3cfe1d){if(_0x3cfe1d){_0x18456a(_0x3cfe1d);}else{_0x3f3700();}});}else{_0x18456a(new Error(_0xa2a4('0x4')));}}else{_0x18456a(new Error(_0xa2a4('0x5')));}});});}module[_0xa2a4('0x6')]=function(_0x1d75d1,_0x7349c4,_0x14d4ef,_0x5a2af3,_0x2454fc,_0x12f071,_0x5a2aa1){var _0xcd6053=new AWS[(_0xa2a4('0x7'))]({'accessKeyId':_0x1d75d1,'secretAccessKey':_0x7349c4,'region':_0x14d4ef});var _0x2a1980={'Text':_0x2454fc,'TextType':_0x12f071||'text','OutputFormat':_0xa2a4('0x8'),'VoiceId':_0x5a2af3};return pollyResult(_0xcd6053,_0x2a1980,_0x5a2aa1);}; \ 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 ed799e1..272d2e3 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 _0xa070=['./lib/api'];(function(_0xa7b569,_0x5c3b9d){var _0x1857a6=function(_0x257b82){while(--_0x257b82){_0xa7b569['push'](_0xa7b569['shift']());}};_0x1857a6(++_0x5c3b9d);}(_0xa070,0x153));var _0x0a07=function(_0x51b7e4,_0x4a976d){_0x51b7e4=_0x51b7e4-0x0;var _0x1fa227=_0xa070[_0x51b7e4];return _0x1fa227;};'use strict';var asr=require(_0x0a07('0x0'));module['exports']=function(_0x231a3c,_0x4bf47c,_0x512a64,_0x44309a){return asr(_0x231a3c,_0x4bf47c,_0x512a64);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0xbd5075,_0x32b814,_0x3510d7,_0xf0375b){return asr(_0xbd5075,_0x32b814,_0x3510d7);}; \ 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 787ba94..519321e 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 _0x8b7c=['length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x8b7c,0x119));var _0xc8b7=function(_0x34a087,_0x4bd68e){_0x34a087=_0x34a087-0x0;var _0x5c15d7=_0x8b7c[_0x34a087];return _0x5c15d7;};'use strict';var url=require(_0xc8b7('0x0'));var BPromise=require(_0xc8b7('0x1'));var fs=require('fs');var host=_0xc8b7('0x2');module[_0xc8b7('0x3')]=function(_0x2473cc,_0x47766d,_0x47089d){return new BPromise(function(_0x201c49,_0x4f66ab){var _0x85fa34;if(typeof _0x2473cc!==_0xc8b7('0x4')||_0x2473cc[_0xc8b7('0x5')]===0x0){return _0x4f66ab('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x47766d!==_0xc8b7('0x4')||_0x47766d[_0xc8b7('0x5')]===0x0){return _0x4f66ab(_0xc8b7('0x6'));}if(typeof _0x47089d!==_0xc8b7('0x7')&&(typeof _0x47089d!==_0xc8b7('0x4')||_0x47089d[_0xc8b7('0x5')]===0x0)){return _0x4f66ab('lang\x20should\x20be\x20a\x20string');}try{_0x85fa34=fs[_0xc8b7('0x8')](_0x2473cc)['toString'](_0xc8b7('0x9'));}catch(_0xf69f1f){return _0x4f66ab(_0xf69f1f);}return _0x201c49({'method':_0xc8b7('0xa'),'uri':host+_0xc8b7('0xb')+_0x47766d,'body':{'config':{'encoding':_0xc8b7('0xc'),'sampleRateHertz':'8000','languageCode':_0x47089d},'audio':{'content':_0x85fa34}},'json':!![]});});}; \ No newline at end of file +var _0xb469=['toString','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x430373,_0x5a8ffd){var _0x1706bc=function(_0x418067){while(--_0x418067){_0x430373['push'](_0x430373['shift']());}};_0x1706bc(++_0x5a8ffd);}(_0xb469,0x13b));var _0x9b46=function(_0x18597a,_0xa0d424){_0x18597a=_0x18597a-0x0;var _0x48db55=_0xb469[_0x18597a];return _0x48db55;};'use strict';var url=require(_0x9b46('0x0'));var BPromise=require(_0x9b46('0x1'));var fs=require('fs');var host=_0x9b46('0x2');module[_0x9b46('0x3')]=function(_0x1a41e8,_0x895347,_0x9212ae){return new BPromise(function(_0x52f688,_0x31f853){var _0x45322f;if(typeof _0x1a41e8!=='string'||_0x1a41e8[_0x9b46('0x4')]===0x0){return _0x31f853(_0x9b46('0x5'));}if(typeof _0x895347!=='string'||_0x895347[_0x9b46('0x4')]===0x0){return _0x31f853('key\x20should\x20be\x20a\x20string');}if(typeof _0x9212ae!=='undefined'&&(typeof _0x9212ae!==_0x9b46('0x6')||_0x9212ae['length']===0x0)){return _0x31f853(_0x9b46('0x7'));}try{_0x45322f=fs[_0x9b46('0x8')](_0x1a41e8)[_0x9b46('0x9')]('base64');}catch(_0x2eb390){return _0x31f853(_0x2eb390);}return _0x52f688({'method':'POST','uri':host+_0x9b46('0xa')+_0x895347,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x9b46('0xb'),'languageCode':_0x9212ae},'audio':{'content':_0x45322f}},'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 225a891..c667440 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 _0xcb4b=['exports','./asr'];(function(_0x330082,_0x5103f6){var _0x5df284=function(_0x69c728){while(--_0x69c728){_0x330082['push'](_0x330082['shift']());}};_0x5df284(++_0x5103f6);}(_0xcb4b,0x1a7));var _0xbcb4=function(_0x43894e,_0x4f1e86){_0x43894e=_0x43894e-0x0;var _0x5555f4=_0xcb4b[_0x43894e];return _0x5555f4;};var asr=require(_0xbcb4('0x0'));module[_0xbcb4('0x1')]={'asr':asr}; \ No newline at end of file +var _0x64c4=['exports','./asr'];(function(_0x570603,_0x4315c2){var _0x33d9ac=function(_0x125008){while(--_0x125008){_0x570603['push'](_0x570603['shift']());}};_0x33d9ac(++_0x4315c2);}(_0x64c4,0xf5));var _0x464c=function(_0x5966b4,_0x4b70c6){_0x5966b4=_0x5966b4-0x0;var _0x585a3c=_0x64c4[_0x5966b4];return _0x585a3c;};var asr=require(_0x464c('0x0'));module[_0x464c('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 c95595f..d6cfbf6 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 _0xed67=['text:synthesize','POST','audioContent','777','resolve','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','resolvedQuery','result','action','speech','code','metadata','endConversation','googleDialogflowV2','replace','detectIntent','queryResult','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','Data','apiai-promise','bluebird','dialogflow','http','https','path','querystring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3'];(function(_0x37fc62,_0x5120f9){var _0x58109b=function(_0x2a16a4){while(--_0x2a16a4){_0x37fc62['push'](_0x37fc62['shift']());}};_0x58109b(++_0x5120f9);}(_0xed67,0x1e7));var _0x7ed6=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xed67[_0x178f52];return _0x556f99;};'use strict';var apiai=require(_0x7ed6('0x0'));var BPromise=require(_0x7ed6('0x1'));var dialogflow=require(_0x7ed6('0x2'));var fs=require('fs');var http=require(_0x7ed6('0x3'));var https=require(_0x7ed6('0x4'));var md5=require('md5');var path=require(_0x7ed6('0x5'));var querystring=require(_0x7ed6('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x7ed6('0x7'));var tts=require(_0x7ed6('0x8'));var urlParse=require(_0x7ed6('0x9'))[_0x7ed6('0xa')];var util=require(_0x7ed6('0xb'));var aws=require(_0x7ed6('0xc'));var google=require(_0x7ed6('0xd'));var sestek=require(_0x7ed6('0xe'));var tilde=require('./tilde');var logger=require(_0x7ed6('0xf'))(_0x7ed6('0x10'));var ISPEECH_API=_0x7ed6('0x11');function downloadFile(_0xb45962,_0x3c0973){return new BPromise(function(_0x29c503,_0x405449){var _0x418938=urlParse(_0xb45962);var _0x78e008=_0x418938[_0x7ed6('0x12')]===_0x7ed6('0x13')?https:http;var _0x52b1b8={'host':_0x418938[_0x7ed6('0x14')],'path':_0x418938[_0x7ed6('0x5')],'headers':{'user-agent':_0x7ed6('0x15')}};_0x78e008[_0x7ed6('0x16')](_0x52b1b8,function(_0x578e6a){if(_0x578e6a['statusCode']!==0xc8){logger[_0x7ed6('0x17')](_0x7ed6('0x18')+_0xb45962+_0x7ed6('0x19')+_0x578e6a['statusCode']+'\x20('+_0x578e6a[_0x7ed6('0x1a')]+')');_0x405449(new Error('request\x20to\x20'+_0xb45962+_0x7ed6('0x19')+_0x578e6a[_0x7ed6('0x1b')]+'\x20('+_0x578e6a[_0x7ed6('0x1a')]+')'));return;}var _0x4fe232=fs['createWriteStream'](_0x3c0973);_0x4fe232['on'](_0x7ed6('0x1c'),function(){logger[_0x7ed6('0x1d')](_0x7ed6('0x1e'));_0x4fe232[_0x7ed6('0x1f')](_0x29c503);});_0x4fe232['on']('error',function(_0x236645){fs[_0x7ed6('0x20')](_0x3c0973);logger[_0x7ed6('0x17')](_0x7ed6('0x21'),_0x236645);_0x405449(_0x236645);});_0x578e6a[_0x7ed6('0x22')](_0x4fe232);})['on']('error',function(_0xf02234){logger[_0x7ed6('0x17')](_0xf02234);_0x405449(_0xf02234);})['end']();});}function uploadFile(_0x2fb937){return new BPromise(function(_0x45a820,_0x4a6caf){var _0x32f203=urlParse(_0x2fb937);var _0x37f972=_0x32f203[_0x7ed6('0x12')]===_0x7ed6('0x13')?https:http;var _0x5a084e={'host':_0x32f203[_0x7ed6('0x14')],'path':_0x32f203[_0x7ed6('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x37f972['get'](_0x5a084e,function(_0x59dc88){if(_0x59dc88['statusCode']!==0xc8){_0x4a6caf(new Error('request\x20to\x20'+_0x2fb937+_0x7ed6('0x19')+_0x59dc88[_0x7ed6('0x1b')]+'\x20('+_0x59dc88[_0x7ed6('0x1a')]+')'));return;}var _0x15bd79='';_0x59dc88['on'](_0x7ed6('0x23'),function(_0x1c4f9b){_0x15bd79+=_0x1c4f9b;});_0x59dc88['on'](_0x7ed6('0x24'),function(){_0x45a820(_0x15bd79);});})['on'](_0x7ed6('0x17'),function(_0x1e57c7){_0x4a6caf(_0x1e57c7);})[_0x7ed6('0x24')]();});}function convertFile(_0x394ee6,_0x32246f){return new BPromise(function(_0x4bede3,_0x32f40a){var _0x1f4bf0=sox[_0x7ed6('0x25')](_0x394ee6,_0x32246f,{'sampleRate':0x1f40,'format':_0x7ed6('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f4bf0['on'](_0x7ed6('0x17'),function(_0x19b01d){logger['error'](_0x7ed6('0x27'),_0x19b01d);_0x32f40a(_0x19b01d);});_0x1f4bf0['on'](_0x7ed6('0x24'),function(){logger['info'](_0x7ed6('0x28'));_0x4bede3();});_0x1f4bf0[_0x7ed6('0x29')]();});}function base64Decode(_0x16ab59,_0x48a73d){var _0x52b694=path['resolve'](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x2c'));fs['writeFileSync'](_0x52b694,_0x16ab59,_0x7ed6('0x2d'));return convertFile(_0x52b694,_0x48a73d)[_0x7ed6('0x2e')](function(){try{fs[_0x7ed6('0x20')](_0x52b694);fs['chmodSync'](_0x48a73d,'777');}catch(_0x60fa22){logger[_0x7ed6('0x17')](_0x60fa22);}return _0x48a73d[_0x7ed6('0x2f')]('.')[0x0];});}function base64Encode(_0x41da87){var _0x1a7fe3=fs[_0x7ed6('0x30')](_0x41da87);return new Buffer(_0x1a7fe3)[_0x7ed6('0x31')](_0x7ed6('0x2d'));}exports[_0x7ed6('0x32')]=function(_0x5a54e5,_0x38dc83,_0x3536c1,_0x457f5d,_0x15b0d6,_0x483375){var _0x3488eb,_0x50843b;var _0xde91=_0x7ed6('0x33');var _0x5206dc=_0x7ed6('0x34')+_0x5a54e5;var _0x265398={};if(_0x38dc83===_0x7ed6('0x35')){_0x265398['input']={'ssml':_0x3536c1};}else{_0x265398[_0x7ed6('0x36')]={'text':_0x3536c1};};_0x265398['voice']={'languageCode':_0x457f5d,'ssmlGender':_0x15b0d6};_0x265398[_0x7ed6('0x37')]={'audioEncoding':_0x7ed6('0x38'),'sampleRateHertz':0x1f40};var _0x4eaf45={'url':_0xde91+_0x7ed6('0x39')+_0x5206dc,'method':_0x7ed6('0x3a'),'json':!![],'body':_0x265398};return rp(_0x4eaf45)[_0x7ed6('0x2e')](function(_0x35688b){return new BPromise(function(_0x3e22fd,_0x309c5b){_0x3488eb=path['resolve'](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+'.mp3');var _0x97ec4b=Buffer['from'](_0x35688b[_0x7ed6('0x3b')],_0x7ed6('0x2d'));return fs['writeFile'](_0x3488eb,_0x97ec4b,function(_0x5e1f68){_0x309c5b(_0x5e1f68);},function(_0xc1aad8){fs['chmodSync'](_0x3488eb,_0x7ed6('0x3c'));_0x3e22fd(_0xc1aad8);});});})['then'](function(_0x11a570){_0x50843b=path[_0x7ed6('0x3d')](__dirname,'tmp',rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x2c'));return convertFile(_0x3488eb,_0x50843b);})[_0x7ed6('0x2e')](function(){try{fs['unlink'](_0x3488eb);fs[_0x7ed6('0x3e')](_0x50843b,_0x7ed6('0x3c'));}catch(_0x1f758c){logger[_0x7ed6('0x17')](_0x1f758c);}logger[_0x7ed6('0x1d')](_0x7ed6('0x3f'),_0x50843b[_0x7ed6('0x2f')]('.')[0x0]);return _0x50843b[_0x7ed6('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x5d5b60,_0x2d93df){var _0x3e9d7f=_0x7ed6('0x40');var _0x546626,_0x5d445b;var _0x2e557e;var _0x37f4dc={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3e9d7f,'headers':{'Content-Type':_0x7ed6('0x41')},'body':_0x7ed6('0x42')+encodeURIComponent(JSON[_0x7ed6('0x43')]([[['jQ1olc',JSON[_0x7ed6('0x43')]([_0x5d5b60,_0x2d93df||'en',![],_0x7ed6('0x44')]),null,_0x7ed6('0x45')]]]))};return rp(_0x37f4dc)[_0x7ed6('0x2e')](function(_0x2d3b1c){try{_0x2e557e=eval(_0x2d3b1c[_0x7ed6('0x46')](0x5))[0x0][0x2];}catch(_0x5658d2){throw new Error(_0x7ed6('0x47')+_0x2d3b1c[_0x7ed6('0x23')]);}if(!_0x2e557e){if(_0x5d5b60[_0x7ed6('0x48')]>0xc8){throw new Error(_0x7ed6('0x49'));}else{throw new Error(_0x7ed6('0x4a')+_0x2d93df+_0x7ed6('0x4b'));}}try{_0x2e557e=eval(_0x2e557e)[0x0];}catch(_0x4bca2a){throw new Error(_0x7ed6('0x47')+res[_0x7ed6('0x23')]);}const _0x538d68=_0x2e557e;_0x546626=path[_0x7ed6('0x3d')](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x4c'));fs[_0x7ed6('0x4d')](_0x546626,_0x2e557e,{'encoding':_0x7ed6('0x2d')});_0x5d445b=path['resolve'](__dirname,_0x7ed6('0x2a'),rs['generate'](0x4)+'.wav');return convertFile(_0x546626,_0x5d445b);})[_0x7ed6('0x2e')](function(){try{fs[_0x7ed6('0x20')](_0x546626);fs[_0x7ed6('0x3e')](_0x5d445b,_0x7ed6('0x3c'));}catch(_0x20d73f){logger[_0x7ed6('0x17')](_0x20d73f);}logger[_0x7ed6('0x1d')](_0x7ed6('0x4e'),_0x5d445b[_0x7ed6('0x2f')]('.')[0x0]);return _0x5d445b[_0x7ed6('0x2f')]('.')[0x0];});};exports[_0x7ed6('0x4f')]=function(_0x516f1b,_0x271b14,_0x1e2364){return google['asr'](_0x516f1b,_0x271b14,_0x1e2364)[_0x7ed6('0x2e')](function(_0x29fe5f){logger[_0x7ed6('0x1d')](_0x29fe5f[_0x7ed6('0x50')]);return rp(_0x29fe5f);})[_0x7ed6('0x2e')](function(_0x49de36){var _0x16ff60='';var _0x2cc1b2=0x0;try{fs[_0x7ed6('0x20')](_0x516f1b);}catch(_0x28bc67){logger['error'](_0x28bc67);}if(_0x49de36&&_0x49de36['results']){_0x16ff60=_0x49de36[_0x7ed6('0x51')][_0x7ed6('0x52')](function(_0x1c6575){return _0x1c6575&&_0x1c6575['alternatives'][0x0]&&_0x1c6575[_0x7ed6('0x53')][0x0][_0x7ed6('0x54')]?_0x1c6575[_0x7ed6('0x53')][0x0]['transcript']:'';})[_0x7ed6('0x55')]('\x0a');_0x2cc1b2=_0x49de36[_0x7ed6('0x51')][_0x7ed6('0x52')](function(_0x47d9f3){return _0x47d9f3&&_0x47d9f3[_0x7ed6('0x53')][0x0]&&_0x47d9f3[_0x7ed6('0x53')][0x0][_0x7ed6('0x56')]?_0x47d9f3[_0x7ed6('0x53')][0x0][_0x7ed6('0x56')]:0x0;})['join']('\x0a');}logger[_0x7ed6('0x1d')](_0x7ed6('0x57'),_0x16ff60);logger[_0x7ed6('0x1d')](_0x7ed6('0x58'),_0x2cc1b2);return{'transcript':_0x16ff60,'confidence':_0x2cc1b2};})[_0x7ed6('0x59')](function(_0x3ee17b){logger['error'](_0x7ed6('0x5a'),_0x3ee17b[_0x7ed6('0x1b')],_0x3ee17b['name'],_0x3ee17b[_0x7ed6('0x5b')]);});};exports[_0x7ed6('0x5c')]=function(_0x5d0a88,_0x3b0588,_0x42b462,_0x37acc7){var _0x5aa00d=apiai(_0x3b0588,{'language':_0x37acc7||'en'});return _0x5aa00d[_0x7ed6('0x5d')](_0x42b462,{'sessionId':md5(_0x5d0a88)})[_0x7ed6('0x2e')](function(_0x48e3e9){logger[_0x7ed6('0x1d')](JSON['stringify'](_0x48e3e9));return{'source':_0x48e3e9['result'][_0x7ed6('0x5e')],'resolvedQuery':_0x48e3e9['result'][_0x7ed6('0x5f')],'action':_0x48e3e9[_0x7ed6('0x60')][_0x7ed6('0x61')],'actionIncomplete':_0x48e3e9[_0x7ed6('0x60')]['actionIncomplete'],'speech':_0x48e3e9['result']['fulfillment'][_0x7ed6('0x62')],'score':_0x48e3e9['result']['score'],'statusCode':_0x48e3e9['status'][_0x7ed6('0x63')],'endConversation':_0x48e3e9['result'][_0x7ed6('0x64')][_0x7ed6('0x65')]||![],'isFallbackIntent':_0x48e3e9[_0x7ed6('0x60')][_0x7ed6('0x64')]['isFallbackIntent']};});};exports[_0x7ed6('0x66')]=function(_0x4dd480,_0x403241,_0x49cec1,_0x9070c3,_0x42ec9e,_0x3559b1){var _0x8bba5d=_0x9070c3[_0x7ed6('0x67')](/\\n/g,'\x0a');var _0x390019={'credentials':{'private_key':_0x8bba5d,'client_email':_0x49cec1}};var _0x1ea4c3=new dialogflow['SessionsClient'](_0x390019);var _0x374a42=_0x1ea4c3['sessionPath'](_0x403241,md5(_0x4dd480));var _0x2ddcce={'session':_0x374a42,'queryInput':{'text':{'text':_0x42ec9e,'languageCode':_0x3559b1}}};return _0x1ea4c3[_0x7ed6('0x68')](_0x2ddcce)[_0x7ed6('0x2e')](function(_0x5a7ff7){if(_0x5a7ff7&&_0x5a7ff7[_0x7ed6('0x48')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x7ed6('0x43')](_0x5a7ff7));var _0x16e7ee=_0x5a7ff7[0x0];if(_0x16e7ee){var _0x2365aa={'action':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x61')],'allRequiredParamsPresent':_0x16e7ee[_0x7ed6('0x69')]['allRequiredParamsPresent'],'endConversation':_0x16e7ee['queryResult']['diagnosticInfo']&&_0x16e7ee[_0x7ed6('0x69')]['diagnosticInfo'][_0x7ed6('0x6a')]?_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x6b')][_0x7ed6('0x6a')][_0x7ed6('0x6c')][_0x7ed6('0x6d')]:![],'fulfillmentText':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x6e')],'intentName':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x6f')]['name'],'intentDisplayName':_0x16e7ee['queryResult'][_0x7ed6('0x6f')]['displayName'],'isFallbackIntent':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x6f')][_0x7ed6('0x70')],'languageCode':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x71')],'queryText':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x72')],'responseId':_0x16e7ee[_0x7ed6('0x73')],'score':_0x16e7ee['queryResult'][_0x7ed6('0x74')],'speech':_0x16e7ee[_0x7ed6('0x69')][_0x7ed6('0x6e')],'providerResponse':JSON['stringify'](_0x5a7ff7)};return _0x2365aa;}}});};exports[_0x7ed6('0x75')]=function(_0x36fdb9,_0x523461,_0x4dde93,_0x10890c){return tilde[_0x7ed6('0x76')](_0x36fdb9,_0x523461,_0x4dde93,_0x10890c)[_0x7ed6('0x2e')](function(_0xdb48ee){try{fs[_0x7ed6('0x20')](_0x36fdb9);}catch(_0x4cc780){logger[_0x7ed6('0x17')](_0x4cc780);}logger[_0x7ed6('0x1d')]('Tilde\x20ASR\x20transcription',_0xdb48ee[_0x7ed6('0x54')]);logger['info'](_0x7ed6('0x77'),_0xdb48ee[_0x7ed6('0x56')]);return _0xdb48ee;});};exports[_0x7ed6('0x78')]=function(_0x4b362e,_0x1da35e,_0x37837c,_0x30fd13,_0x185a24,_0x4f68ab){var _0x32f168=path[_0x7ed6('0x3d')](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x4c'));var _0x70ce21;return aws[_0x7ed6('0x79')](_0x4b362e,_0x1da35e,_0x37837c,_0x30fd13,_0x185a24,_0x4f68ab,_0x32f168)['then'](function(){_0x70ce21=path[_0x7ed6('0x3d')](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x2c'));return convertFile(_0x32f168,_0x70ce21);})[_0x7ed6('0x2e')](function(){try{fs[_0x7ed6('0x20')](_0x32f168);fs[_0x7ed6('0x3e')](_0x70ce21,'777');}catch(_0x168f4f){logger['error'](_0x168f4f);}return _0x70ce21['split']('.')[0x0];});};exports['awsLex']=function(_0x9ccbe8,_0x4624f3,_0x252b6f,_0x353307,_0x59f00d,_0xfca537){return aws[_0x7ed6('0x7a')](_0x9ccbe8,_0x4624f3,_0x252b6f,_0x353307,_0x59f00d,_0xfca537)[_0x7ed6('0x2e')](function(_0xb7f894){logger[_0x7ed6('0x1d')](JSON[_0x7ed6('0x43')](_0xb7f894));return _0xb7f894;});};exports['ispeechTTS']=function(_0x414db9,_0x44d665,_0x3dc721,_0x4dc021){var _0x465174=util[_0x7ed6('0x7b')](_0x7ed6('0x7c'),ISPEECH_API,_0x414db9,encodeURIComponent(_0x44d665),_0x3dc721,_0x4dc021);var _0x1b861a=path[_0x7ed6('0x3d')](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x4c'));var _0x591793;return downloadFile(_0x465174,_0x1b861a)[_0x7ed6('0x2e')](function(){_0x591793=path[_0x7ed6('0x3d')](__dirname,'tmp',rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x2c'));return convertFile(_0x1b861a,_0x591793);})['then'](function(){try{fs['unlink'](_0x1b861a);fs[_0x7ed6('0x3e')](_0x591793,'777');}catch(_0x8cce8e){logger[_0x7ed6('0x17')](_0x8cce8e);}return _0x591793['split']('.')[0x0];});};exports[_0x7ed6('0x7d')]=function(_0x42b344,_0x123ac2,_0x37211b,_0x387a5a){var _0x3d2d39=util['format'](_0x7ed6('0x7e'),ISPEECH_API,_0x123ac2,_0x37211b,base64Encode(_0x42b344),_0x387a5a?util[_0x7ed6('0x7b')](_0x7ed6('0x7f'),encodeURIComponent(_0x387a5a)):_0x7ed6('0x80'));return uploadFile(_0x3d2d39)['then'](function(_0x1510be){return querystring['parse'](_0x1510be);});};exports[_0x7ed6('0x81')]=function(_0xb9efcd,_0x317ad2){return sestek[_0x7ed6('0x82')](_0xb9efcd,_0x317ad2)[_0x7ed6('0x2e')](function(_0x29d440){logger[_0x7ed6('0x1d')](JSON[_0x7ed6('0x43')](_0x29d440));var _0x2b2adf={'speech':_0x29d440[_0x7ed6('0x83')],'action':_0x29d440[_0x7ed6('0x84')]?_0x29d440[_0x7ed6('0x84')][_0x7ed6('0x85')]:undefined,'actiondata':_0x29d440[_0x7ed6('0x84')]?_0x29d440['channelData'][_0x7ed6('0x86')]:undefined};if(_0x29d440[_0x7ed6('0x84')]&&_0x29d440['channelData']['AudioFromTts']){return base64Decode(_0x29d440[_0x7ed6('0x84')]['AudioFromTts'][_0x7ed6('0x87')],path[_0x7ed6('0x3d')](__dirname,_0x7ed6('0x2a'),rs[_0x7ed6('0x2b')](0x4)+_0x7ed6('0x2c')))[_0x7ed6('0x2e')](function(_0x7a0e80){_0x2b2adf['audiofile']=_0x7a0e80;return _0x2b2adf;});}return _0x2b2adf;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x0c4e=['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','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','get','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','POST','resolve','from','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','null','generic','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','actionIncomplete','fulfillment','speech','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','action','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x0c4e,0x198));var _0xe0c4=function(_0x5ca5b8,_0x549e4e){_0x5ca5b8=_0x5ca5b8-0x0;var _0x55f45f=_0x0c4e[_0x5ca5b8];return _0x55f45f;};'use strict';var apiai=require(_0xe0c4('0x0'));var BPromise=require(_0xe0c4('0x1'));var dialogflow=require(_0xe0c4('0x2'));var fs=require('fs');var http=require(_0xe0c4('0x3'));var https=require('https');var md5=require('md5');var path=require(_0xe0c4('0x4'));var querystring=require(_0xe0c4('0x5'));var rp=require(_0xe0c4('0x6'));var rs=require('randomstring');var sox=require(_0xe0c4('0x7'));var tts=require(_0xe0c4('0x8'));var urlParse=require(_0xe0c4('0x9'))[_0xe0c4('0xa')];var util=require(_0xe0c4('0xb'));var aws=require(_0xe0c4('0xc'));var google=require(_0xe0c4('0xd'));var sestek=require(_0xe0c4('0xe'));var tilde=require(_0xe0c4('0xf'));var logger=require(_0xe0c4('0x10'))(_0xe0c4('0x11'));var ISPEECH_API=_0xe0c4('0x12');function downloadFile(_0x215b10,_0x417ca5){return new BPromise(function(_0x4616da,_0xc9103){var _0x16330e=urlParse(_0x215b10);var _0x35057=_0x16330e[_0xe0c4('0x13')]===_0xe0c4('0x14')?https:http;var _0x1aa878={'host':_0x16330e[_0xe0c4('0x15')],'path':_0x16330e['path'],'headers':{'user-agent':_0xe0c4('0x16')}};_0x35057['get'](_0x1aa878,function(_0x44e92d){if(_0x44e92d[_0xe0c4('0x17')]!==0xc8){logger['error'](_0xe0c4('0x18')+_0x215b10+_0xe0c4('0x19')+_0x44e92d['statusCode']+'\x20('+_0x44e92d[_0xe0c4('0x1a')]+')');_0xc9103(new Error(_0xe0c4('0x18')+_0x215b10+_0xe0c4('0x19')+_0x44e92d[_0xe0c4('0x17')]+'\x20('+_0x44e92d[_0xe0c4('0x1a')]+')'));return;}var _0x489b61=fs['createWriteStream'](_0x417ca5);_0x489b61['on'](_0xe0c4('0x1b'),function(){logger[_0xe0c4('0x1c')](_0xe0c4('0x1d'));_0x489b61['close'](_0x4616da);});_0x489b61['on'](_0xe0c4('0x1e'),function(_0x14f6e5){fs[_0xe0c4('0x1f')](_0x417ca5);logger[_0xe0c4('0x1e')](_0xe0c4('0x20'),_0x14f6e5);_0xc9103(_0x14f6e5);});_0x44e92d[_0xe0c4('0x21')](_0x489b61);})['on']('error',function(_0x5d73f8){logger[_0xe0c4('0x1e')](_0x5d73f8);_0xc9103(_0x5d73f8);})[_0xe0c4('0x22')]();});}function uploadFile(_0xb38981){return new BPromise(function(_0x1e7dd4,_0x5a3785){var _0x53a381=urlParse(_0xb38981);var _0x3270d6=_0x53a381[_0xe0c4('0x13')]==='https:'?https:http;var _0x66e540={'host':_0x53a381[_0xe0c4('0x15')],'path':_0x53a381[_0xe0c4('0x4')],'headers':{'user-agent':_0xe0c4('0x16')}};_0x3270d6[_0xe0c4('0x23')](_0x66e540,function(_0x2d9e44){if(_0x2d9e44['statusCode']!==0xc8){_0x5a3785(new Error(_0xe0c4('0x18')+_0xb38981+_0xe0c4('0x19')+_0x2d9e44[_0xe0c4('0x17')]+'\x20('+_0x2d9e44[_0xe0c4('0x1a')]+')'));return;}var _0x1d11ef='';_0x2d9e44['on']('data',function(_0x10f323){_0x1d11ef+=_0x10f323;});_0x2d9e44['on'](_0xe0c4('0x22'),function(){_0x1e7dd4(_0x1d11ef);});})['on']('error',function(_0x294ff2){_0x5a3785(_0x294ff2);})[_0xe0c4('0x22')]();});}function convertFile(_0x5665be,_0x509b70){return new BPromise(function(_0x44cca2,_0x394f22){var _0x29256d=sox['transcode'](_0x5665be,_0x509b70,{'sampleRate':0x1f40,'format':_0xe0c4('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29256d['on'](_0xe0c4('0x1e'),function(_0x5b2bf5){logger[_0xe0c4('0x1e')](_0xe0c4('0x25'),_0x5b2bf5);_0x394f22(_0x5b2bf5);});_0x29256d['on'](_0xe0c4('0x22'),function(){logger[_0xe0c4('0x1c')](_0xe0c4('0x26'));_0x44cca2();});_0x29256d[_0xe0c4('0x27')]();});}function base64Decode(_0x505d59,_0x3ac3f1){var _0x9cf2d0=path['resolve'](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x2a'));fs[_0xe0c4('0x2b')](_0x9cf2d0,_0x505d59,_0xe0c4('0x2c'));return convertFile(_0x9cf2d0,_0x3ac3f1)[_0xe0c4('0x2d')](function(){try{fs[_0xe0c4('0x1f')](_0x9cf2d0);fs[_0xe0c4('0x2e')](_0x3ac3f1,_0xe0c4('0x2f'));}catch(_0x336d30){logger[_0xe0c4('0x1e')](_0x336d30);}return _0x3ac3f1[_0xe0c4('0x30')]('.')[0x0];});}function base64Encode(_0x403602){var _0x27936d=fs[_0xe0c4('0x31')](_0x403602);return new Buffer(_0x27936d)[_0xe0c4('0x32')]('base64');}exports['googleCloudTTS']=function(_0x48dbf5,_0x31d90b,_0x4690a,_0x316fe1,_0x2a6e4b,_0x4bb0d6){var _0x17765d,_0x3b5968;var _0x3ba6a4=_0xe0c4('0x33');var _0x24e75c=_0xe0c4('0x34')+_0x48dbf5;var _0x49367a={};if(_0x31d90b==='ssml'){_0x49367a[_0xe0c4('0x35')]={'ssml':_0x4690a};}else{_0x49367a[_0xe0c4('0x35')]={'text':_0x4690a};};_0x49367a[_0xe0c4('0x36')]={'languageCode':_0x316fe1,'ssmlGender':_0x2a6e4b};_0x49367a['audioConfig']={'audioEncoding':_0xe0c4('0x37'),'sampleRateHertz':0x1f40};var _0x1776cb={'url':_0x3ba6a4+'text:synthesize'+_0x24e75c,'method':_0xe0c4('0x38'),'json':!![],'body':_0x49367a};return rp(_0x1776cb)['then'](function(_0x3cc3e5){return new BPromise(function(_0x5ea308,_0x2248a3){_0x17765d=path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+'.mp3');var _0x139e2f=Buffer[_0xe0c4('0x3a')](_0x3cc3e5['audioContent'],_0xe0c4('0x2c'));return fs[_0xe0c4('0x3b')](_0x17765d,_0x139e2f,function(_0x26b854){_0x2248a3(_0x26b854);},function(_0x43e40f){fs[_0xe0c4('0x2e')](_0x17765d,_0xe0c4('0x2f'));_0x5ea308(_0x43e40f);});});})['then'](function(_0x282e9b){_0x3b5968=path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x17765d,_0x3b5968);})['then'](function(){try{fs[_0xe0c4('0x1f')](_0x17765d);fs['chmodSync'](_0x3b5968,_0xe0c4('0x2f'));}catch(_0x34cb46){logger['error'](_0x34cb46);}logger['info'](_0xe0c4('0x3c'),_0x3b5968['split']('.')[0x0]);return _0x3b5968['split']('.')[0x0];});};exports['googleTTS']=function(_0x5129b6,_0x2357ab){var _0x14beb6=_0xe0c4('0x3d');var _0x307301,_0x1bbac1;var _0x343318;var _0x1fe546={'encoding':'utf8','method':_0xe0c4('0x38'),'timeout':0x2710,'url':_0x14beb6,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xe0c4('0x3e')+encodeURIComponent(JSON[_0xe0c4('0x3f')]([[['jQ1olc',JSON[_0xe0c4('0x3f')]([_0x5129b6,_0x2357ab||'en',![],_0xe0c4('0x40')]),null,_0xe0c4('0x41')]]]))};return rp(_0x1fe546)[_0xe0c4('0x2d')](function(_0x3f4482){try{_0x343318=eval(_0x3f4482['slice'](0x5))[0x0][0x2];}catch(_0x1cef6e){throw new Error('parse\x20response\x20failed:\x0a'+_0x3f4482[_0xe0c4('0x42')]);}if(!_0x343318){if(_0x5129b6[_0xe0c4('0x43')]>0xc8){throw new Error(_0xe0c4('0x44'));}else{throw new Error('lang\x20\x22'+_0x2357ab+_0xe0c4('0x45'));}}try{_0x343318=eval(_0x343318)[0x0];}catch(_0x24ce19){throw new Error(_0xe0c4('0x46')+res[_0xe0c4('0x42')]);}const _0x135e88=_0x343318;_0x307301=path['resolve'](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x47'));fs['writeFileSync'](_0x307301,_0x343318,{'encoding':_0xe0c4('0x2c')});_0x1bbac1=path[_0xe0c4('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0xe0c4('0x2a'));return convertFile(_0x307301,_0x1bbac1);})[_0xe0c4('0x2d')](function(){try{fs[_0xe0c4('0x1f')](_0x307301);fs[_0xe0c4('0x2e')](_0x1bbac1,_0xe0c4('0x2f'));}catch(_0x4bd93c){logger['error'](_0x4bd93c);}logger[_0xe0c4('0x1c')](_0xe0c4('0x48'),_0x1bbac1['split']('.')[0x0]);return _0x1bbac1[_0xe0c4('0x30')]('.')[0x0];});};exports[_0xe0c4('0x49')]=function(_0x4f1698,_0xc635d8,_0x547b5d){return google[_0xe0c4('0x4a')](_0x4f1698,_0xc635d8,_0x547b5d)[_0xe0c4('0x2d')](function(_0x5133c1){logger[_0xe0c4('0x1c')](_0x5133c1[_0xe0c4('0x4b')]);return rp(_0x5133c1);})[_0xe0c4('0x2d')](function(_0x5a05d1){var _0x3cc88d='';var _0xee4cbe=0x0;try{fs[_0xe0c4('0x1f')](_0x4f1698);}catch(_0x2739e5){logger['error'](_0x2739e5);}if(_0x5a05d1&&_0x5a05d1['results']){_0x3cc88d=_0x5a05d1[_0xe0c4('0x4c')]['map'](function(_0x4466c6){return _0x4466c6&&_0x4466c6[_0xe0c4('0x4d')][0x0]&&_0x4466c6[_0xe0c4('0x4d')][0x0][_0xe0c4('0x4e')]?_0x4466c6[_0xe0c4('0x4d')][0x0][_0xe0c4('0x4e')]:'';})[_0xe0c4('0x4f')]('\x0a');_0xee4cbe=_0x5a05d1['results'][_0xe0c4('0x50')](function(_0x30e754){return _0x30e754&&_0x30e754[_0xe0c4('0x4d')][0x0]&&_0x30e754[_0xe0c4('0x4d')][0x0][_0xe0c4('0x51')]?_0x30e754[_0xe0c4('0x4d')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xe0c4('0x1c')](_0xe0c4('0x52'),_0x3cc88d);logger[_0xe0c4('0x1c')](_0xe0c4('0x53'),_0xee4cbe);return{'transcript':_0x3cc88d,'confidence':_0xee4cbe};})[_0xe0c4('0x54')](function(_0x41bd82){logger[_0xe0c4('0x1e')](_0xe0c4('0x55'),_0x41bd82[_0xe0c4('0x17')],_0x41bd82[_0xe0c4('0x56')],_0x41bd82[_0xe0c4('0x57')]);});};exports[_0xe0c4('0x58')]=function(_0x40e43c,_0x2fc102,_0x4ae067,_0x369489){var _0x2b3c41=apiai(_0x2fc102,{'language':_0x369489||'en'});return _0x2b3c41['textRequest'](_0x4ae067,{'sessionId':md5(_0x40e43c)})[_0xe0c4('0x2d')](function(_0x3c76f8){logger['info'](JSON[_0xe0c4('0x3f')](_0x3c76f8));return{'source':_0x3c76f8['result'][_0xe0c4('0x59')],'resolvedQuery':_0x3c76f8[_0xe0c4('0x5a')]['resolvedQuery'],'action':_0x3c76f8[_0xe0c4('0x5a')]['action'],'actionIncomplete':_0x3c76f8[_0xe0c4('0x5a')][_0xe0c4('0x5b')],'speech':_0x3c76f8['result'][_0xe0c4('0x5c')][_0xe0c4('0x5d')],'score':_0x3c76f8[_0xe0c4('0x5a')]['score'],'statusCode':_0x3c76f8['status'][_0xe0c4('0x5e')],'endConversation':_0x3c76f8[_0xe0c4('0x5a')]['metadata'][_0xe0c4('0x5f')]||![],'isFallbackIntent':_0x3c76f8[_0xe0c4('0x5a')]['metadata'][_0xe0c4('0x60')]};});};exports[_0xe0c4('0x61')]=function(_0x3e8492,_0x1ffd2c,_0x19ba5f,_0x362208,_0x4bf311,_0xb3ef2c){var _0x100af0=_0x362208[_0xe0c4('0x62')](/\\n/g,'\x0a');var _0x3bf82d={'credentials':{'private_key':_0x100af0,'client_email':_0x19ba5f}};var _0xb309c4=new dialogflow[(_0xe0c4('0x63'))](_0x3bf82d);var _0x1e2682=_0xb309c4[_0xe0c4('0x64')](_0x1ffd2c,md5(_0x3e8492));var _0x342ba2={'session':_0x1e2682,'queryInput':{'text':{'text':_0x4bf311,'languageCode':_0xb3ef2c}}};return _0xb309c4[_0xe0c4('0x65')](_0x342ba2)['then'](function(_0x129645){if(_0x129645&&_0x129645[_0xe0c4('0x43')]){logger[_0xe0c4('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0xe0c4('0x3f')](_0x129645));var _0x24cc10=_0x129645[0x0];if(_0x24cc10){var _0x7b3dc1={'action':_0x24cc10['queryResult'][_0xe0c4('0x66')],'allRequiredParamsPresent':_0x24cc10[_0xe0c4('0x67')]['allRequiredParamsPresent'],'endConversation':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x68')]&&_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x68')][_0xe0c4('0x69')]?_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x68')][_0xe0c4('0x69')]['end_conversation'][_0xe0c4('0x6a')]:![],'fulfillmentText':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x6b')],'intentName':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x6c')][_0xe0c4('0x56')],'intentDisplayName':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x6c')][_0xe0c4('0x6d')],'isFallbackIntent':_0x24cc10['queryResult'][_0xe0c4('0x6c')][_0xe0c4('0x6e')],'languageCode':_0x24cc10[_0xe0c4('0x67')]['languageCode'],'queryText':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x6f')],'responseId':_0x24cc10[_0xe0c4('0x70')],'score':_0x24cc10[_0xe0c4('0x67')][_0xe0c4('0x71')],'speech':_0x24cc10[_0xe0c4('0x67')]['fulfillmentText'],'providerResponse':JSON[_0xe0c4('0x3f')](_0x129645)};return _0x7b3dc1;}}});};exports[_0xe0c4('0x72')]=function(_0x20fd1e,_0x123cfe,_0x39cbe5,_0x28d3f9){return tilde[_0xe0c4('0x4a')](_0x20fd1e,_0x123cfe,_0x39cbe5,_0x28d3f9)[_0xe0c4('0x2d')](function(_0x3ec265){try{fs[_0xe0c4('0x1f')](_0x20fd1e);}catch(_0x29e546){logger[_0xe0c4('0x1e')](_0x29e546);}logger[_0xe0c4('0x1c')](_0xe0c4('0x73'),_0x3ec265[_0xe0c4('0x4e')]);logger['info'](_0xe0c4('0x74'),_0x3ec265[_0xe0c4('0x51')]);return _0x3ec265;});};exports[_0xe0c4('0x75')]=function(_0x3adcf9,_0x5ec730,_0x5058cc,_0x21ca10,_0x430db5,_0x5955b8){var _0x19408a=path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x47'));var _0x4b7924;return aws[_0xe0c4('0x76')](_0x3adcf9,_0x5ec730,_0x5058cc,_0x21ca10,_0x430db5,_0x5955b8,_0x19408a)[_0xe0c4('0x2d')](function(){_0x4b7924=path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x2a'));return convertFile(_0x19408a,_0x4b7924);})[_0xe0c4('0x2d')](function(){try{fs[_0xe0c4('0x1f')](_0x19408a);fs[_0xe0c4('0x2e')](_0x4b7924,_0xe0c4('0x2f'));}catch(_0x414dfc){logger[_0xe0c4('0x1e')](_0x414dfc);}return _0x4b7924[_0xe0c4('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x49abcd,_0x1778fd,_0x3aae06,_0x2c9272,_0x9d8107,_0x1273ba){return aws['lex'](_0x49abcd,_0x1778fd,_0x3aae06,_0x2c9272,_0x9d8107,_0x1273ba)[_0xe0c4('0x2d')](function(_0x21b17b){logger['info'](JSON[_0xe0c4('0x3f')](_0x21b17b));return _0x21b17b;});};exports[_0xe0c4('0x77')]=function(_0x2fa29b,_0x4c1d1f,_0x1c5791,_0x36cad5){var _0x218ae8=util[_0xe0c4('0x78')](_0xe0c4('0x79'),ISPEECH_API,_0x2fa29b,encodeURIComponent(_0x4c1d1f),_0x1c5791,_0x36cad5);var _0x2dcee6=path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x47'));var _0x40770a;return downloadFile(_0x218ae8,_0x2dcee6)[_0xe0c4('0x2d')](function(){_0x40770a=path[_0xe0c4('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0xe0c4('0x2a'));return convertFile(_0x2dcee6,_0x40770a);})[_0xe0c4('0x2d')](function(){try{fs[_0xe0c4('0x1f')](_0x2dcee6);fs[_0xe0c4('0x2e')](_0x40770a,_0xe0c4('0x2f'));}catch(_0x1d230c){logger[_0xe0c4('0x1e')](_0x1d230c);}return _0x40770a[_0xe0c4('0x30')]('.')[0x0];});};exports[_0xe0c4('0x7a')]=function(_0x59a8c6,_0x463993,_0x3c998b,_0x4bd525){var _0x511528=util[_0xe0c4('0x78')](_0xe0c4('0x7b'),ISPEECH_API,_0x463993,_0x3c998b,base64Encode(_0x59a8c6),_0x4bd525?util[_0xe0c4('0x78')]('model=%s',encodeURIComponent(_0x4bd525)):_0xe0c4('0x7c'));return uploadFile(_0x511528)[_0xe0c4('0x2d')](function(_0x4daf87){return querystring[_0xe0c4('0xa')](_0x4daf87);});};exports[_0xe0c4('0x7d')]=function(_0x5adb51,_0x48c9cd){return sestek['nda'](_0x5adb51,_0x48c9cd)[_0xe0c4('0x2d')](function(_0x208920){logger['info'](JSON[_0xe0c4('0x3f')](_0x208920));var _0x447781={'speech':_0x208920[_0xe0c4('0x7e')],'action':_0x208920[_0xe0c4('0x7f')]?_0x208920['channelData'][_0xe0c4('0x80')]:undefined,'actiondata':_0x208920[_0xe0c4('0x7f')]?_0x208920[_0xe0c4('0x7f')]['CustomActionData']:undefined};if(_0x208920[_0xe0c4('0x7f')]&&_0x208920[_0xe0c4('0x7f')]['AudioFromTts']){return base64Decode(_0x208920[_0xe0c4('0x7f')][_0xe0c4('0x81')][_0xe0c4('0x82')],path[_0xe0c4('0x39')](__dirname,_0xe0c4('0x28'),rs[_0xe0c4('0x29')](0x4)+_0xe0c4('0x2a')))[_0xe0c4('0x2d')](function(_0x571778){_0x447781[_0xe0c4('0x83')]=_0x571778;return _0x447781;});}return _0x447781;});};exports['dirName']=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 28209a0..7572681 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 _0x7ced=['exports','./nda'];(function(_0x30441d,_0x2d6632){var _0x46fd35=function(_0x2f55a5){while(--_0x2f55a5){_0x30441d['push'](_0x30441d['shift']());}};_0x46fd35(++_0x2d6632);}(_0x7ced,0x11f));var _0xd7ce=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x7ced[_0x156a0d];return _0x98a9ba;};var nda=require(_0xd7ce('0x0'));module[_0xd7ce('0x1')]={'nda':nda}; \ No newline at end of file +var _0x84c6=['exports'];(function(_0x4fed97,_0x31cea3){var _0x5084db=function(_0x263072){while(--_0x263072){_0x4fed97['push'](_0x4fed97['shift']());}};_0x5084db(++_0x31cea3);}(_0x84c6,0xe7));var _0x684c=function(_0x5f4c80,_0x32886b){_0x5f4c80=_0x5f4c80-0x0;var _0x5175a7=_0x84c6[_0x5f4c80];return _0x5175a7;};var nda=require('./nda');module[_0x684c('0x0')]={'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 5238209..5c70eaa 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 _0x851d=['message','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','project','body','ProjectName','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','username','password','then','ndassistant_url','ndaactivity_type'];(function(_0x259880,_0x297792){var _0x247b4d=function(_0x158cc5){while(--_0x158cc5){_0x259880['push'](_0x259880['shift']());}};_0x247b4d(++_0x297792);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xd851('0x0'));var url=require('url');var logger=require(_0xd851('0x1'))(_0xd851('0x2'));module['exports']=function(_0x384e44,_0x16201e){var _0x2d20b1={'method':_0xd851('0x3'),'uri':url[_0xd851('0x4')](_0x16201e[_0xd851('0x5')],'/token'),'form':{'grant_type':'password','username':_0x16201e[_0xd851('0x6')],'password':_0x16201e[_0xd851('0x7')]},'json':!![]};return rp(_0x2d20b1)[_0xd851('0x8')](function(_0x2f9540){var _0x60bef0={'method':_0xd851('0x3'),'uri':url['resolve'](_0x16201e[_0xd851('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x16201e[_0xd851('0xa')]||_0xd851('0xb'),'channelId':'Nda','conversation':{'id':_0x384e44[_0xd851('0xc')]},'from':{'id':_0x384e44[_0xd851('0xd')],'name':_0x384e44[_0xd851('0xe')]},'recipient':{'id':_0x384e44[_0xd851('0xf')],'name':_0x384e44['extension']},'text':_0x16201e['text'],'channelData':{}},'headers':{'Authorization':_0xd851('0x10')+_0x2f9540[_0xd851('0x11')]},'json':!![]};if(_0x16201e[_0xd851('0x12')]){_0x60bef0[_0xd851('0x13')]['channelData'][_0xd851('0x14')]=_0x16201e[_0xd851('0x12')];}if(_0x16201e['ndagenerate_audio']=='1'){_0x60bef0[_0xd851('0x13')][_0xd851('0x15')][_0xd851('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x16201e[_0xd851('0x17')]){_0x60bef0[_0xd851('0x13')][_0xd851('0x15')][_0xd851('0x18')]=_0x16201e[_0xd851('0x17')];if(_0x16201e[_0xd851('0x19')]){_0x60bef0['body'][_0xd851('0x15')][_0xd851('0x1a')]=_0x16201e[_0xd851('0x19')];}}logger[_0xd851('0x1b')](JSON[_0xd851('0x1c')](_0x60bef0));return rp(_0x60bef0);});}; \ No newline at end of file +var _0x878f=['ndauth_url','/token','password','then','ndaactivity_type','message','Nda','callerid','calleridname','extension','Bearer\x20','access_token','project','channelData','ProjectName','body','AudioOutputSettings','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x1491f5,_0xfe3a61){var _0x45e165=function(_0x2116c4){while(--_0x2116c4){_0x1491f5['push'](_0x1491f5['shift']());}};_0x45e165(++_0xfe3a61);}(_0x878f,0x173));var _0xf878=function(_0x2229f8,_0x1d16c1){_0x2229f8=_0x2229f8-0x0;var _0x58479c=_0x878f[_0x2229f8];return _0x58479c;};'use strict';var rp=require('request-promise');var url=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));module[_0xf878('0x3')]=function(_0x1b3d0b,_0x3d74cf){var _0x9e6783={'method':_0xf878('0x4'),'uri':url[_0xf878('0x5')](_0x3d74cf[_0xf878('0x6')],_0xf878('0x7')),'form':{'grant_type':'password','username':_0x3d74cf['username'],'password':_0x3d74cf[_0xf878('0x8')]},'json':!![]};return rp(_0x9e6783)[_0xf878('0x9')](function(_0x59e564){var _0x52851e={'method':'POST','uri':url[_0xf878('0x5')](_0x3d74cf['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3d74cf[_0xf878('0xa')]||_0xf878('0xb'),'channelId':_0xf878('0xc'),'conversation':{'id':_0x1b3d0b['uniqueid']},'from':{'id':_0x1b3d0b[_0xf878('0xd')],'name':_0x1b3d0b[_0xf878('0xe')]},'recipient':{'id':_0x1b3d0b['dnid'],'name':_0x1b3d0b[_0xf878('0xf')]},'text':_0x3d74cf['text'],'channelData':{}},'headers':{'Authorization':_0xf878('0x10')+_0x59e564[_0xf878('0x11')]},'json':!![]};if(_0x3d74cf[_0xf878('0x12')]){_0x52851e['body'][_0xf878('0x13')][_0xf878('0x14')]=_0x3d74cf[_0xf878('0x12')];}if(_0x3d74cf['ndagenerate_audio']=='1'){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3d74cf['custom_action']){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x17')]=_0x3d74cf[_0xf878('0x18')];if(_0x3d74cf[_0xf878('0x19')]){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x1a')]=_0x3d74cf[_0xf878('0x19')];}}logger[_0xf878('0x1b')](JSON[_0xf878('0x1c')](_0x52851e));return rp(_0x52851e);});}; \ 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 e588791..187a563 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 _0xa5ab=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5ab,0x1bf));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xba5a('0x0'));module[_0xba5a('0x1')]=function(_0x57b836,_0x2eb140,_0x219a5a,_0x59c49d){return asr(_0x57b836,_0x2eb140,_0x219a5a,_0x59c49d);}; \ No newline at end of file +var _0x014d=['./lib/api'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x014d,0x159));var _0xd014=function(_0x5991f8,_0x5af487){_0x5991f8=_0x5991f8-0x0;var _0x7dc22d=_0x014d[_0x5991f8];return _0x7dc22d;};'use strict';var asr=require(_0xd014('0x0'));module['exports']=function(_0x32ded2,_0x358770,_0x417860,_0x56c9f6){return asr(_0x32ded2,_0x358770,_0x417860,_0x56c9f6);}; \ 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 afac13a..3202006 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 _0xfca6=['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','sha1','update','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','../../../../../../config/logger','exports','info'];(function(_0x4ea728,_0x3ba8a8){var _0x290764=function(_0x35f0e0){while(--_0x35f0e0){_0x4ea728['push'](_0x4ea728['shift']());}};_0x290764(++_0x3ba8a8);}(_0xfca6,0x1d0));var _0x6fca=function(_0x206917,_0x38ad99){_0x206917=_0x206917-0x0;var _0x2a2416=_0xfca6[_0x206917];return _0x2a2416;};'use strict';var BPromise=require(_0x6fca('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x6fca('0x1'))('agi');module[_0x6fca('0x2')]=function(_0x1280a2,_0x57243b,_0x1a2c0d,_0x300cc7){return new BPromise(function(_0x509961,_0x5690fb){logger[_0x6fca('0x3')](_0x6fca('0x4'),_0x300cc7||_0x6fca('0x5'));var _0x3c6bc5=new WebSocket(_0x300cc7||_0x6fca('0x5'),{'perMessageDeflate':![]});var _0x461a82='';var _0x2ea8ce='0';var _0x4302a7='1';var _0x41060e=_0x6fca('0x6');function _0x5d7ff9(_0x3cec63){var _0x35d5ce=crypto['createHash'](_0x6fca('0x7'));_0x35d5ce[_0x6fca('0x8')](_0x3cec63);return _0x35d5ce['digest']('hex');}function _0x3a7838(){try{logger['info'](_0x6fca('0x9'));var _0x21ac2e=moment()['unix']();var _0x30084f=_0x5d7ff9(_0x21ac2e+_0x57243b+_0x1a2c0d);_0x3c6bc5['send'](JSON[_0x6fca('0xa')]({'appID':_0x57243b,'timestamp':_0x21ac2e,'appKey':_0x30084f}));var _0x1c8252=fs[_0x6fca('0xb')](_0x1280a2);_0x1c8252['on'](_0x6fca('0xc'),function(_0xf73920){_0x3c6bc5[_0x6fca('0xd')](_0xf73920);});_0x1c8252['on'](_0x6fca('0xe'),function(){_0x3c6bc5[_0x6fca('0xd')](_0x6fca('0xf'));});}catch(_0x389ccd){logger[_0x6fca('0x10')](_0x6fca('0x11'),JSON['stringify'](_0x389ccd));_0x3c6bc5[_0x6fca('0x12')]();}}function _0x297bde(_0x89a8bf){try{if(_0x89a8bf){var _0x5f51a0=JSON[_0x6fca('0x13')](_0x89a8bf);switch(_0x5f51a0[_0x6fca('0x14')]){case 0x0:if(_0x5f51a0[_0x6fca('0x15')]){if(_0x5f51a0[_0x6fca('0x15')][_0x6fca('0x16')]){logger['info'](_0x6fca('0x17'),JSON[_0x6fca('0xa')](_0x5f51a0[_0x6fca('0x15')][_0x6fca('0x18')]));_0x461a82=_0x5f51a0[_0x6fca('0x15')][_0x6fca('0x18')][0x0]['transcript'];_0x2ea8ce=_0x5f51a0['result'][_0x6fca('0x18')][0x0][_0x6fca('0x19')];_0x4302a7='0';_0x41060e=_0x6fca('0x1a');_0x3c6bc5['terminate']();}}break;case 0x1:logger[_0x6fca('0x3')](_0x6fca('0x6'));_0x4302a7='1';_0x41060e='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x6fca('0x3')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4302a7='2';_0x41060e=_0x6fca('0x1b');break;case 0x9:logger[_0x6fca('0x3')](_0x6fca('0x1c'));_0x4302a7='9';_0x41060e=_0x6fca('0x1c');break;case 0xa:logger['info'](_0x6fca('0x1d'));_0x4302a7='10';_0x41060e=_0x6fca('0x1d');break;case 0xb:logger[_0x6fca('0x3')](_0x6fca('0x1e'));_0x4302a7='11';_0x41060e=_0x6fca('0x1e');}}}catch(_0x37cab7){logger['error'](_0x6fca('0x1f'),JSON[_0x6fca('0xa')](_0x37cab7));_0x3c6bc5['terminate']();}}function _0x4fd965(){logger[_0x6fca('0x3')]('Close\x20Tilde\x20ASR\x20socket');_0x509961({'transcript':_0x461a82,'confidence':_0x2ea8ce,'status':_0x4302a7,'status_message':_0x41060e});}function _0x9aeca(_0x3c2659){logger[_0x6fca('0x10')](_0x6fca('0x20'));if(!_[_0x6fca('0x21')](_0x3c2659)){logger[_0x6fca('0x10')](_[_0x6fca('0x22')](_0x3c2659)?JSON[_0x6fca('0xa')](_0x3c2659):_0x3c2659);}}_0x3c6bc5['on'](_0x6fca('0x23'),_0x3a7838);_0x3c6bc5['on']('message',_0x297bde);_0x3c6bc5['on'](_0x6fca('0xe'),_0x4fd965);_0x3c6bc5['on'](_0x6fca('0x10'),_0x9aeca);});}; \ No newline at end of file +var _0x751d=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','data','send','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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.'];(function(_0x13ed6f,_0x515c3c){var _0x3b42dd=function(_0x570416){while(--_0x570416){_0x13ed6f['push'](_0x13ed6f['shift']());}};_0x3b42dd(++_0x515c3c);}(_0x751d,0x1d9));var _0xd751=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x751d[_0x340380];return _0x49ce1c;};'use strict';var BPromise=require(_0xd751('0x0'));var _=require(_0xd751('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xd751('0x2'));var logger=require(_0xd751('0x3'))('agi');module[_0xd751('0x4')]=function(_0x35623b,_0x43f15f,_0x7033f1,_0x1a205b){return new BPromise(function(_0x3b3a76,_0x56dfdc){logger[_0xd751('0x5')](_0xd751('0x6'),_0x1a205b||_0xd751('0x7'));var _0x16408c=new WebSocket(_0x1a205b||_0xd751('0x7'),{'perMessageDeflate':![]});var _0x1be789='';var _0x36f0d9='0';var _0x2bc34d='1';var _0x26ee8f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5c2591(_0x49173b){var _0x6c27b3=crypto['createHash'](_0xd751('0x8'));_0x6c27b3['update'](_0x49173b);return _0x6c27b3[_0xd751('0x9')](_0xd751('0xa'));}function _0xdb4e3a(){try{logger[_0xd751('0x5')](_0xd751('0xb'));var _0xbc9579=moment()[_0xd751('0xc')]();var _0x3fd145=_0x5c2591(_0xbc9579+_0x43f15f+_0x7033f1);_0x16408c['send'](JSON['stringify']({'appID':_0x43f15f,'timestamp':_0xbc9579,'appKey':_0x3fd145}));var _0x16ad09=fs['createReadStream'](_0x35623b);_0x16ad09['on'](_0xd751('0xd'),function(_0x1e7384){_0x16408c[_0xd751('0xe')](_0x1e7384);});_0x16ad09['on'](_0xd751('0xf'),function(){_0x16408c['send'](_0xd751('0x10'));});}catch(_0x538871){logger[_0xd751('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xd751('0x12')](_0x538871));_0x16408c[_0xd751('0x13')]();}}function _0x443a08(_0x2f8dec){try{if(_0x2f8dec){var _0x16fa4f=JSON[_0xd751('0x14')](_0x2f8dec);switch(_0x16fa4f[_0xd751('0x15')]){case 0x0:if(_0x16fa4f[_0xd751('0x16')]){if(_0x16fa4f['result'][_0xd751('0x17')]){logger[_0xd751('0x5')](_0xd751('0x18'),JSON[_0xd751('0x12')](_0x16fa4f['result']['hypotheses']));_0x1be789=_0x16fa4f[_0xd751('0x16')][_0xd751('0x19')][0x0][_0xd751('0x1a')];_0x36f0d9=_0x16fa4f[_0xd751('0x16')][_0xd751('0x19')][0x0][_0xd751('0x1b')];_0x2bc34d='0';_0x26ee8f=_0xd751('0x1c');_0x16408c['terminate']();}}break;case 0x1:logger['info'](_0xd751('0x1d'));_0x2bc34d='1';_0x26ee8f=_0xd751('0x1d');break;case 0x2:logger[_0xd751('0x5')](_0xd751('0x1e'));_0x2bc34d='2';_0x26ee8f=_0xd751('0x1e');break;case 0x9:logger[_0xd751('0x5')](_0xd751('0x1f'));_0x2bc34d='9';_0x26ee8f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xd751('0x5')]('Authentication\x20failed.');_0x2bc34d='10';_0x26ee8f=_0xd751('0x20');break;case 0xb:logger[_0xd751('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2bc34d='11';_0x26ee8f=_0xd751('0x21');}}}catch(_0x5f3c34){logger[_0xd751('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xd751('0x12')](_0x5f3c34));_0x16408c[_0xd751('0x13')]();}}function _0x1f7ab0(){logger[_0xd751('0x5')](_0xd751('0x22'));_0x3b3a76({'transcript':_0x1be789,'confidence':_0x36f0d9,'status':_0x2bc34d,'status_message':_0x26ee8f});}function _0x2b6e7b(_0x20e333){logger[_0xd751('0x11')](_0xd751('0x23'));if(!_['isNil'](_0x20e333)){logger[_0xd751('0x11')](_[_0xd751('0x24')](_0x20e333)?JSON['stringify'](_0x20e333):_0x20e333);}}_0x16408c['on'](_0xd751('0x25'),_0xdb4e3a);_0x16408c['on'](_0xd751('0x26'),_0x443a08);_0x16408c['on'](_0xd751('0xf'),_0x1f7ab0);_0x16408c['on'](_0xd751('0x11'),_0x2b6e7b);});}; \ 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 f0ba558..65e3af7 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 _0xf312=['./asr'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf312,0x1aa));var _0x2f31=function(_0x7aa114,_0x59afeb){_0x7aa114=_0x7aa114-0x0;var _0x2d574d=_0xf312[_0x7aa114];return _0x2d574d;};var asr=require(_0x2f31('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xd8d9=['exports','./asr'];(function(_0x57246d,_0x2acd43){var _0x19b618=function(_0x191fbc){while(--_0x191fbc){_0x57246d['push'](_0x57246d['shift']());}};_0x19b618(++_0x2acd43);}(_0xd8d9,0x127));var _0x9d8d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xd8d9[_0x138f59];return _0x3d114d;};var asr=require(_0x9d8d('0x0'));module[_0x9d8d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d0011e0..04d66d4 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 _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x141529,_0x2f0d1d){var _0x2fbf88=function(_0x1aac56){while(--_0x1aac56){_0x141529['push'](_0x141529['shift']());}};_0x2fbf88(++_0x2f0d1d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ 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(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xe706,0xa3));var _0x6e70=function(_0xe74768,_0x4c0bf9){_0xe74768=_0xe74768-0x0;var _0x302e8a=_0xe706[_0xe74768];return _0x302e8a;};'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 c7002fc..09109d8 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 _0xe14d=['Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','number','timeout','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','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','ndassistant_url','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','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','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes'];(function(_0x30daf8,_0x13c823){var _0x365709=function(_0x59bbc1){while(--_0x59bbc1){_0x30daf8['push'](_0x30daf8['shift']());}};_0x365709(++_0x13c823);}(_0xe14d,0x1ee));var _0xde14=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe14d[_0x4dbaad];return _0x226c72;};'use strict';var fs=require('fs');var util=require(_0xde14('0x0'));var _=require(_0xde14('0x1'));var sh=require(_0xde14('0x2'));var odbc=require(_0xde14('0x3'))();var rs=require('randomstring');var moment=require(_0xde14('0x4'));var Mustache=require(_0xde14('0x5'));var rp=require('request-promise');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var scripts=require(_0xde14('0x9'));var FILES_PATH=_0xde14('0xa');var recursiveMapAttributes=[_0xde14('0xb'),'rawBody'];var verticesWithRetry=['menu',_0xde14('0xc'),_0xde14('0xd')];var AGIVertices=function(_0x2b0e7c,_0x9f13dc,_0xb25b00){this[_0xde14('0xe')]=_0x2b0e7c;this[_0xde14('0xf')]=_0x9f13dc;this[_0xde14('0x10')]=_0xb25b00;};AGIVertices['prototype'][_0xde14('0x11')]=function(_0xe785fb,_0x417269){this[_0xde14('0xf')][_0xde14('0x12')](_0xe785fb)[_0xde14('0x13')](function(_0x1a1c32){_0x417269(null,_0x1a1c32?_0x1a1c32[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x29e3ca){_0x417269(_0x29e3ca);});};AGIVertices[_0xde14('0x16')][_0xde14('0x17')]=function(_0x3521d4,_0x281c54){this[_0xde14('0xf')]['getVoiceQueueById'](_0x3521d4)['then'](function(_0x23c878){_0x281c54(null,_0x23c878?_0x23c878[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x4c86ff){_0x281c54(_0x4c86ff);});};AGIVertices[_0xde14('0x16')][_0xde14('0x18')]=function(_0x257390,_0x31902a){this[_0xde14('0xf')][_0xde14('0x19')](_0x257390)[_0xde14('0x13')](function(_0x6f6eea){_0x31902a(null,_0x6f6eea?_0x6f6eea[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x590a8b){_0x31902a(_0x590a8b);});};AGIVertices[_0xde14('0x16')][_0xde14('0x1a')]=function(_0x2eb8a8,_0x44ce4c){this['rpc'][_0xde14('0x1b')](_0x2eb8a8)['then'](function(_0x45d101){_0x44ce4c(null,_0x45d101?_0x45d101['dsn']:![]);})[_0xde14('0x15')](function(_0x30fcf1){_0x44ce4c(_0x30fcf1);});};AGIVertices[_0xde14('0x16')][_0xde14('0x1c')]=function(_0x39bdc5,_0x11a4d9){this[_0xde14('0xf')][_0xde14('0x1d')](_0x39bdc5)[_0xde14('0x13')](function(_0x163b79){_0x11a4d9(null,_0x163b79?_0x163b79[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x8f8033){_0x11a4d9(_0x8f8033);});};AGIVertices['prototype'][_0xde14('0x1e')]=function(_0x3ce77c,_0x24a390){this[_0xde14('0xf')][_0xde14('0x1f')](_0x3ce77c)[_0xde14('0x13')](function(_0x310d75){_0x24a390(null,_0x310d75?_0x310d75[_0xde14('0x14')]:![]);})[_0xde14('0x15')](function(_0x350a78){_0x24a390(_0x350a78);});};AGIVertices['prototype'][_0xde14('0x20')]=function(_0x1696ee,_0x3eaee5){var _0xf8279a=this;this['rpc'][_0xde14('0x21')](_0x1696ee)[_0xde14('0x13')](function(_0x30c4a8){_0x3eaee5(null,_0x30c4a8?_0xf8279a['getSoundPath'](_0x30c4a8[_0xde14('0x22')]):![]);})['catch'](function(_0x2760f9){_0x3eaee5(_0x2760f9);});};AGIVertices[_0xde14('0x16')][_0xde14('0x23')]=function(_0x1e7906,_0x2aca96){this[_0xde14('0xf')][_0xde14('0x24')](_0x1e7906)[_0xde14('0x13')](function(_0x4e7c5b){_0x2aca96(null,_0x4e7c5b?_0x4e7c5b:![]);})[_0xde14('0x15')](function(_0xbf49ac){_0x2aca96(_0xbf49ac);});};AGIVertices['prototype'][_0xde14('0x25')]=function(_0x4c9b15,_0x2e40ad,_0x44e88a){this[_0xde14('0x10')][_0xde14('0x25')](_0x4c9b15,_0x2e40ad)[_0xde14('0x13')](function(){_0x44e88a(null);})['catch'](function(_0x26dfa9){_0x44e88a(_0x26dfa9);});};AGIVertices[_0xde14('0x16')]['getIntervals']=function(_0x280238,_0x3c943b){this[_0xde14('0xf')][_0xde14('0x26')](_0x280238)[_0xde14('0x13')](function(_0xa41c1e){if(_0xa41c1e){if(_0xa41c1e[_0xde14('0x27')]){_0x3c943b(null,[_0xa41c1e[_0xde14('0x28')]]);}else{_0x3c943b(null,_[_0xde14('0x29')](_0xa41c1e['Intervals'],'interval'));}}else{_0x3c943b(null,![]);}})[_0xde14('0x15')](function(_0x403007){_0x3c943b(_0x403007);});};AGIVertices[_0xde14('0x16')][_0xde14('0x2a')]=function(_0x31cad4){return util[_0xde14('0x2b')](_0xde14('0x2c'),FILES_PATH,_0x31cad4);};AGIVertices[_0xde14('0x16')][_0xde14('0x2d')]=function(_0x4e33e0,_0x1854d3,_0x48c043){odbc['open'](_0x4e33e0,function(_0x4c1e37){if(_0x4c1e37){logger[_0xde14('0x2e')](_0xde14('0x2f'),_0x4c1e37);_0x48c043(_0x4c1e37);}else{logger[_0xde14('0x30')](_0xde14('0x31'));odbc[_0xde14('0x32')](_0x1854d3,function(_0x8b5bb4,_0x1e89b6){if(_0x8b5bb4){logger[_0xde14('0x30')]('Error\x20executing\x20query\x20%s',_0x1854d3);_0x48c043(_0x8b5bb4);}else{logger[_0xde14('0x30')](_0xde14('0x33'),_0x1854d3);odbc[_0xde14('0x34')](function(_0x2b3004){if(_0x2b3004){logger[_0xde14('0x2e')](_0xde14('0x35'),_0x2b3004);}_0x48c043(null,_0x1e89b6);});}});}});};AGIVertices[_0xde14('0x16')][_0xde14('0x36')]=function(_0x50db0d,_0x225164){this[_0xde14('0xf')][_0xde14('0x37')](_0x50db0d)[_0xde14('0x13')](function(_0x4f7141){_0x225164(null,_0x4f7141?_0x4f7141:![]);})['catch'](function(_0x75d4f1){_0x225164(_0x75d4f1);});};AGIVertices[_0xde14('0x16')][_0xde14('0x38')]=function(_0x171080,_0x401f7e){this['rpc'][_0xde14('0x38')](_0x171080)[_0xde14('0x13')](function(_0x1d3cc1){_0x401f7e(null,_0x1d3cc1);})['catch'](function(_0x46fb53){_0x401f7e(_0x46fb53);});};AGIVertices['prototype'][_0xde14('0x39')]=function(_0x51ace9,_0x102770,_0x117c64){this[_0xde14('0xf')][_0xde14('0x39')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'node':_0x51ace9[_0xde14('0x3b')],'application':_0x51ace9[_0xde14('0x3c')],'data':_0x102770||null,'project_name':this['channel'][_0xde14('0x3d')],'callerid':this['channel'][_0xde14('0x3e')]})['then'](function(_0x214b14){if(_0x117c64){_0x117c64(null,_0x214b14);}})[_0xde14('0x15')](function(_0x437466){if(_0x117c64){_0x117c64(_0x437466);}});};AGIVertices[_0xde14('0x16')][_0xde14('0x3f')]=function(_0x138d36,_0x442b3c,_0x2aadcf,_0x4f1b43){this[_0xde14('0xf')][_0xde14('0x3f')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'callerid':this['channel'][_0xde14('0x3e')],'calleridname':this[_0xde14('0xe')][_0xde14('0x40')],'context':this[_0xde14('0xe')][_0xde14('0x41')],'extension':this[_0xde14('0xe')]['extension'],'priority':this[_0xde14('0xe')]['priority'],'accountcode':this[_0xde14('0xe')][_0xde14('0x42')],'dnid':this['channel'][_0xde14('0x43')],'projectName':this[_0xde14('0xe')][_0xde14('0x3d')],'saveName':_0x442b3c,'filename':_0x138d36[_0xde14('0x44')]||_0x442b3c,'savePath':_0x2aadcf})[_0xde14('0x13')](function(_0x1c87e1){_0x4f1b43(null,_0x1c87e1);})[_0xde14('0x15')](function(_0x51f35f){_0x4f1b43(_0x51f35f);});};AGIVertices[_0xde14('0x16')]['createSquareMessage']=function(_0xfa80c8,_0x6aa9ab,_0x237be4,_0x235202,_0x2e6867){this[_0xde14('0xf')][_0xde14('0x45')]({'uniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'body':_0xfa80c8,'direction':_0x6aa9ab,'providerName':_0x237be4,'providerResponse':_0x235202})[_0xde14('0x13')](function(_0x5db8b5){if(_0x2e6867){_0x2e6867(null,_0x5db8b5);}})[_0xde14('0x15')](function(_0x1688c6){if(_0x2e6867){_0x2e6867(_0x1688c6);}});};AGIVertices[_0xde14('0x16')][_0xde14('0x46')]=function(_0x14b781,_0x4874ed){this[_0xde14('0xf')]['createCmContact']({'firstName':_[_0xde14('0x47')](_0x14b781[_0xde14('0x14')])||_[_0xde14('0x48')](_0x14b781[_0xde14('0x14')])?_0xde14('0x49')+Math['random']():_0x14b781['name'],'lastName':_[_0xde14('0x47')](_0x14b781['lastName'])||_[_0xde14('0x48')](_0x14b781[_0xde14('0x4a')])?null:_0x14b781[_0xde14('0x4a')],'phone':_0x14b781[_0xde14('0x4b')],'ListId':_0x14b781[_0xde14('0x4c')],'scheduledat':_0x14b781[_0xde14('0x4d')],'callbackUniqueid':this[_0xde14('0xe')][_0xde14('0x3a')],'tags':_0xde14('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0x14b781[_0xde14('0x4d')][_0xde14('0x4f')](),'priority':_0x14b781[_0xde14('0x50')]})[_0xde14('0x13')](function(_0x249ccc){_0x4874ed(null,_0x249ccc);})['catch'](function(_0xb2d69c){_0x4874ed(_0xb2d69c);});};AGIVertices['prototype'][_0xde14('0x51')]=function(_0x27fb42,_0x2526ca){this[_0xde14('0xf')][_0xde14('0x52')](_0x27fb42)[_0xde14('0x13')](function(_0x27ab1a){_0x2526ca(null,_0x27ab1a?_0x27ab1a[_0xde14('0x14')]:![]);})['catch'](function(_0x5a2753){_0x2526ca(_0x5a2753);});};AGIVertices['prototype'][_0xde14('0x53')]=function(_0x508f25,_0x596cd3,_0xc10000){var _0x20fd21={'role':_0xde14('0x54')};_0x20fd21[_0x508f25]=this[_0xde14('0xe')][_0xde14('0x3e')];this[_0xde14('0xf')][_0xde14('0x53')](_0x20fd21,_0x596cd3,this[_0xde14('0xe')][_0xde14('0x3a')])['then'](function(_0x6be331){_0xc10000(null,_[_0xde14('0x48')](_0x6be331)?![]:!![]);})[_0xde14('0x15')](function(_0x524e98){logger[_0xde14('0x2e')](_0x524e98);_0xc10000(null,![]);});};AGIVertices['prototype'][_0xde14('0x55')]=function(_0x32bffd,_0x40ab83){var _0x18eaf0={'role':_0xde14('0x54')};_0x18eaf0[_0x32bffd]=this[_0xde14('0xe')][_0xde14('0x3e')];this['rpc'][_0xde14('0x55')](_0x18eaf0)[_0xde14('0x13')](function(_0x1a0bb1){_0x40ab83(null,_[_0xde14('0x48')](_0x1a0bb1)?![]:!![]);})[_0xde14('0x15')](function(_0x70a2e1){logger[_0xde14('0x2e')](_0x70a2e1);_0x40ab83(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x4563ba,_0x19a162){var _0x3d37cc={'role':'agent'};_0x3d37cc[_0x4563ba]=this[_0xde14('0xe')][_0xde14('0x3e')];this[_0xde14('0xf')][_0xde14('0x56')](_0x3d37cc)['then'](function(_0x567180){_0x19a162(null,_[_0xde14('0x48')](_0x567180)?![]:!![]);})[_0xde14('0x15')](function(_0x30f228){logger[_0xde14('0x2e')](_0x30f228);_0x19a162(null,![]);});};AGIVertices[_0xde14('0x16')][_0xde14('0x57')]=function(_0x1bfe9b,_0x3641e3){var _0x408e7f={'role':_0xde14('0x54')};_0x408e7f[_0x1bfe9b]=this[_0xde14('0xe')][_0xde14('0x3e')];var _0x1ff577=_0x1bfe9b!=_0xde14('0x58')?util[_0xde14('0x2b')](_0xde14('0x59'),_0xde14('0x5a'),this[_0xde14('0xe')][_0xde14('0x3e')]):undefined;this[_0xde14('0xf')][_0xde14('0x57')](_0x408e7f,_0x1ff577)[_0xde14('0x13')](function(_0xfe7fcd){_0x3641e3(null,_['isNil'](_0xfe7fcd)?![]:!![]);})[_0xde14('0x15')](function(_0x55ddcf){logger[_0xde14('0x2e')](_0x55ddcf);_0x3641e3(null,![]);});};AGIVertices['prototype'][_0xde14('0x5b')]=function(_0xfa9c8d,_0x3aaba2){sh['exec'](_['trim'](_0xfa9c8d),function(_0x23d3e1,_0x18abd0){var _0x217a3d=_0x18abd0[_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3aaba2(null,_0x217a3d);});};AGIVertices['prototype'][_0xde14('0x5d')]=function(_0x3b4bc8,_0xa853de){scripts['googleCloudTTS'](_0x3b4bc8['apiKey'],_0x3b4bc8['google_cloud_tts_text_type']||'text',_0x3b4bc8[_0xde14('0x5e')],_0x3b4bc8[_0xde14('0x5f')]||_0xde14('0x60'),_0x3b4bc8['ssmlGender']||_0xde14('0x61'),_0x3b4bc8[_0xde14('0x62')]||_0xde14('0x63'))[_0xde14('0x13')](function(_0x37c412){_0xa853de(null,_0x37c412);})[_0xde14('0x15')](function(_0x545784){_0xa853de(_0x545784);});};AGIVertices['prototype'][_0xde14('0x64')]=function(_0x4474c2,_0x54aaa2){scripts[_0xde14('0x64')](_0x4474c2[_0xde14('0x5e')],_0x4474c2[_0xde14('0x65')]||'en',0x1)[_0xde14('0x13')](function(_0x32f022){_0x54aaa2(null,_0x32f022);})[_0xde14('0x15')](function(_0x2540df){_0x54aaa2(_0x2540df);});};AGIVertices['prototype']['restAPI']=function(_0x4800bf,_0x5d9fa3){var _0x3dbda9={'uri':_0x4800bf[_0xde14('0x66')],'method':_0x4800bf['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4800bf['timeout'])===_0xde14('0x67')&&parseInt(_0x4800bf[_0xde14('0x68')])>=0x1?parseInt(_0x4800bf[_0xde14('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xde14('0x69'),_0xde14('0x6a')],_0x3dbda9['method'][_0xde14('0x6b')]())){try{_0x3dbda9[_0xde14('0x6c')]=_0x4800bf[_0xde14('0x6d')]?JSON[_0xde14('0x6e')](_0x4800bf['rawBody']):{};}catch(_0x19887c){logger['error'](_0xde14('0x6f'),_0x19887c);}}try{_0x3dbda9[_0xde14('0x70')]=_0x4800bf[_0xde14('0xb')]?JSON['parse'](_0x4800bf[_0xde14('0xb')]):{};}catch(_0x3af215){logger[_0xde14('0x2e')](_0xde14('0x71'),_0x3af215);}if(_0x4800bf[_0xde14('0x72')]){try{var _0x54890a=require(_0x4800bf['computedVariables'])[_0xde14('0x73')](this,_0x3dbda9);_0x3dbda9[_0xde14('0x74')]=Mustache[_0xde14('0x75')](_0x4800bf['url'],_0x54890a,{},['$$','$$']);if(_0x3dbda9[_0xde14('0x70')]){_0x3dbda9[_0xde14('0x70')]=JSON[_0xde14('0x6e')](Mustache[_0xde14('0x75')](JSON[_0xde14('0x76')](_0x3dbda9[_0xde14('0x70')]),_0x54890a,{},['$$','$$']));}if(_0x3dbda9[_0xde14('0x6c')]){_0x3dbda9['body']=JSON[_0xde14('0x6e')](Mustache[_0xde14('0x75')](JSON[_0xde14('0x76')](_0x3dbda9[_0xde14('0x6c')]),_0x54890a,{},['$$','$$']));}}catch(_0x22bfc9){logger[_0xde14('0x2e')](_0xde14('0x77'),_0x22bfc9);}}rp(_0x3dbda9)['then'](function(_0x26fd01){var _0x1bdeae={'statusCode':_0x26fd01['statusCode']||0xc8,'statusMessage':_0x26fd01[_0xde14('0x78')]||'OK','headers':_0x26fd01['headers']||{},'body':_0x26fd01[_0xde14('0x6c')]||{}};_0x5d9fa3(null,_0x1bdeae);})['catch'](function(_0xfa8121){var _0xffbdf1={'statusCode':_0xfa8121[_0xde14('0x79')]||0x1f4,'statusMessage':_0xfa8121[_0xde14('0x7a')]||_0xde14('0x7b'),'headers':_0xfa8121[_0xde14('0x7c')]['headers']||{},'body':_0xfa8121[_0xde14('0x7c')][_0xde14('0x6c')]||{}};_0x5d9fa3(null,_0xffbdf1);});};AGIVertices[_0xde14('0x16')]['googleDialogflow']=function(_0x2542e1,_0x46f946){scripts[_0xde14('0x7d')](this['channel'][_0xde14('0x3a')],_0x2542e1[_0xde14('0x7e')],_0x2542e1[_0xde14('0x5e')],_0x2542e1['dialogflow_language']||'en')['then'](function(_0x495741){_0x46f946(null,_0x495741);})['catch'](function(_0x381d6d){_0x46f946(_0x381d6d);});};AGIVertices[_0xde14('0x16')]['googleDialogflowV2']=function(_0x36da22,_0xe16364){scripts[_0xde14('0x7f')](this[_0xde14('0xe')][_0xde14('0x3a')],_0x36da22['dialogflowV2_project_id'],_0x36da22[_0xde14('0x80')],_0x36da22[_0xde14('0x81')],_0x36da22[_0xde14('0x5e')],_0x36da22[_0xde14('0x82')]||'en')[_0xde14('0x13')](function(_0x3f49ea){_0xe16364(null,_0x3f49ea);})[_0xde14('0x15')](function(_0x3fb180){_0xe16364(_0x3fb180);});};AGIVertices['prototype'][_0xde14('0x83')]=function(_0x3f180b,_0xd9a97){scripts[_0xde14('0x83')](this[_0xde14('0xe')],_0x3f180b)[_0xde14('0x13')](function(_0x4fb108){_0xd9a97(null,_0x4fb108);})[_0xde14('0x15')](function(_0x54ec08){_0xd9a97(_0x54ec08);});};AGIVertices[_0xde14('0x16')][_0xde14('0x84')]=function(_0x54522f,_0xe0f167){scripts[_0xde14('0x84')](_0x54522f[_0xde14('0x7e')],_0x54522f[_0xde14('0x5e')],_0x54522f[_0xde14('0x85')]||_0xde14('0x60'),_0x54522f[_0xde14('0x86')])[_0xde14('0x13')](function(_0x1a3513){_0xe0f167(null,_0x1a3513);})[_0xde14('0x15')](function(_0xdec1bd){_0xe0f167(_0xdec1bd);});};AGIVertices[_0xde14('0x16')][_0xde14('0x87')]=function(_0x5a6f35,_0x56eb76,_0x41b62a){scripts[_0xde14('0x87')](_0x56eb76,_0x5a6f35['key'],_0x5a6f35[_0xde14('0x88')]||_0xde14('0x60'),this[_0xde14('0x89')](_0x5a6f35[_0xde14('0x8a')])?_0x5a6f35[_0xde14('0x8a')]:undefined)[_0xde14('0x13')](function(_0x2eb881){_0x41b62a(null,_0x2eb881);})[_0xde14('0x15')](function(_0x339371){_0x41b62a(_0x339371);});};AGIVertices['prototype']['awsPolly']=function(_0x324e4f,_0x23f9d9){scripts['awsPolly'](_0x324e4f[_0xde14('0x8b')],_0x324e4f[_0xde14('0x8c')],_0x324e4f['aws_polly_region'],_0x324e4f[_0xde14('0x8d')]||_0xde14('0x8e'),_0x324e4f['text'],_0x324e4f[_0xde14('0x8f')]||'text')[_0xde14('0x13')](function(_0x3ce6b8){_0x23f9d9(null,_0x3ce6b8);})[_0xde14('0x15')](function(_0x1a2494){_0x23f9d9(_0x1a2494);});};AGIVertices['prototype'][_0xde14('0x90')]=function(_0x22ff35,_0x467470){scripts['awsLex'](this[_0xde14('0xe')][_0xde14('0x3a')],_0x22ff35[_0xde14('0x8b')],_0x22ff35[_0xde14('0x8c')],_0x22ff35['aws_lex_region'],_0x22ff35[_0xde14('0x5e')],_0x22ff35[_0xde14('0x91')])['then'](function(_0x44d201){_0x467470(null,_0x44d201);})[_0xde14('0x15')](function(_0x69c01f){_0x467470(_0x69c01f);});};AGIVertices[_0xde14('0x16')][_0xde14('0x92')]=function(_0x476463,_0x27167e,_0x2b36e5){scripts['googleASR'](_0x27167e,_0x476463[_0xde14('0x7e')],_0x476463[_0xde14('0x93')]||_0xde14('0x60'))[_0xde14('0x13')](function(_0x59c555){_0x2b36e5(null,_0x59c555);})['catch'](function(_0x5717e0){_0x2b36e5(_0x5717e0);});};AGIVertices['prototype'][_0xde14('0x94')]=function(_0xb621ab,_0x1517fe,_0x51f886){scripts['tildeASR'](_0x1517fe,_0xb621ab[_0xde14('0x95')],_0xb621ab['appsecret'],_0xb621ab['uri'])['then'](function(_0x58be49){_0x51f886(null,_0x58be49);})[_0xde14('0x15')](function(_0x54fbea){_0x51f886(_0x54fbea);});};AGIVertices['prototype']['clear']=function(_0x487260){var _0x235239=_[_0xde14('0x96')](verticesWithRetry,_0x487260[_0xde14('0x3c')])?_0x487260:_[_0xde14('0x97')](_0x487260);for(var _0x3a2d9c in _0x235239){if(_0x235239[_0xde14('0x98')](_0x3a2d9c)){if(_0x235239[_0x3a2d9c]&&_['isString'](_0x235239[_0x3a2d9c])){if(_[_0xde14('0x96')](recursiveMapAttributes,_0x3a2d9c)){_0x235239[_0x3a2d9c]=this[_0xde14('0x99')](_0x235239[_0x3a2d9c]);}else{_0x235239[_0x3a2d9c]=this[_0xde14('0x9a')](_0x235239[_0x3a2d9c]);}}}}return _0x235239;};AGIVertices[_0xde14('0x16')][_0xde14('0x9b')]=function(_0x17fc25){for(var _0x991f3d in _0x17fc25){if(_0x17fc25[_0xde14('0x98')](_0x991f3d)){if(_[_0xde14('0x9c')](_0x17fc25[_0x991f3d])){this[_0xde14('0x9b')](_0x17fc25[_0x991f3d]);}else if(_[_0xde14('0x9d')](_0x17fc25[_0x991f3d])){for(var _0xe62f70=0x0;_0xe62f70<_0x17fc25[_0x991f3d][_0xde14('0x9e')];_0xe62f70++){this[_0xde14('0x9b')](_0x17fc25[_0x991f3d][_0xe62f70]);}}else if(_[_0xde14('0x9f')](_0x17fc25[_0x991f3d])){_0x17fc25[_0x991f3d]=this['replaceAllVariables'](_0x17fc25[_0x991f3d]);}}}};AGIVertices[_0xde14('0x16')][_0xde14('0xa0')]=function(_0x2b6562,_0x788855){for(var _0xe37a8a in _0x2b6562){if(_0x2b6562[_0xde14('0x98')](_0xe37a8a)){if(_['isPlainObject'](_0x2b6562[_0xe37a8a])){if(!_[_0xde14('0x47')](_0x2b6562[_0xe37a8a])){this[_0xde14('0xa0')](_0x2b6562[_0xe37a8a],util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a));}}else if(_['isArray'](_0x2b6562[_0xe37a8a])){for(var _0x485151=0x0;_0x485151<_0x2b6562[_0xe37a8a]['length'];_0x485151++){this[_0xde14('0xa0')](_0x2b6562[_0xe37a8a][_0x485151],util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a+'['+_0x485151+']'));}}else{if(!_[_0xde14('0x48')](_0x2b6562[_0xe37a8a])){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xa1'),_0x788855,_0xe37a8a),_0x2b6562[_0xe37a8a]);}}}}};AGIVertices[_0xde14('0x16')][_0xde14('0x99')]=function(_0xec6b8a){try{var _0xac2f9=JSON[_0xde14('0x6e')](_0xec6b8a);this[_0xde14('0x9b')](_0xac2f9);return JSON[_0xde14('0x76')](_0xac2f9);}catch(_0x36fefa){return this[_0xde14('0x9a')](_0xec6b8a);}};AGIVertices[_0xde14('0x16')]['replaceAllVariables']=function(_0x1ab722){var _0x52515f=_0x1ab722['split']('{');for(var _0x56a9d0=0x1;_0x56a9d0<_0x52515f['length'];_0x56a9d0+=0x1){var _0x1d95ff=_0x52515f[_0x56a9d0][_0xde14('0xa3')]('}');if(_0x1d95ff['length']>0x1){_0x1ab722=_0x1ab722[_0xde14('0xa4')]('{'+_0x1d95ff[0x0]+'}',this['channel'][_0xde14('0x11')](_0x1d95ff[0x0])[_0xde14('0xa5')]||_0x1d95ff[0x0]);}}if(_0x52515f['length']===0x1){return _0x1ab722[_0xde14('0x4f')]();}return this[_0xde14('0x9a')](_0x1ab722);};AGIVertices[_0xde14('0x16')][_0xde14('0xa6')]=function(_0x426727,_0x1db2f3){var _0x3bb899=this[_0xde14('0xe')][_0xde14('0x11')](_0x426727);if(_0x3bb899[_0xde14('0xa7')]===-0x1){return _0x3bb899;}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1db2f3,_0x3bb899[_0xde14('0xa5')]));return this['channel'][_0xde14('0xa2')](_0x1db2f3,_0x3bb899[_0xde14('0xa5')]);};AGIVertices[_0xde14('0x16')]['isConfigured']=function(_0x3d9ff9){return _0x3d9ff9&&_0x3d9ff9!=='0'&&_0x3d9ff9!=='-1'&&_0x3d9ff9!=='';};AGIVertices['prototype'][_0xde14('0xa8')]=function(_0x4bee01){this[_0xde14('0x39')][_0xde14('0x73')](this,_0x4bee01,'-');_0x4bee01[_0xde14('0xa9')]=_0x4bee01['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x3fb97c){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xaa'),_0x3fb97c['label']));if(!this[_0xde14('0x89')](_0x3fb97c[_0xde14('0x5e')])){return this['channel'][_0xde14('0xab')](_0xde14('0xac'));}var _0x4463ad='\x22'+_0x3fb97c[_0xde14('0x5e')]+'\x22';if(this[_0xde14('0x89')](_0x3fb97c[_0xde14('0x7c')])){_0x4463ad+=','+_0x3fb97c[_0xde14('0x7c')];}var _0x886c76=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x4463ad);if(_0x886c76[_0xde14('0xa7')]===-0x1){return _0x886c76;}return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xaf'),_0x4463ad));};AGIVertices[_0xde14('0x16')]['mrcprecog']=function(_0x5b7a88){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xb0'),_0x5b7a88[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x5b7a88[_0xde14('0xb1')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20grammar\x20configured');}var _0x3ad8de=_0x5b7a88[_0xde14('0xb1')];if(this[_0xde14('0x89')](_0x5b7a88[_0xde14('0x7c')])){_0x3ad8de+=','+_0x5b7a88[_0xde14('0x7c')];}var _0x4ccf2e=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xb2'),_0x3ad8de);if(_0x4ccf2e[_0xde14('0xa7')]===-0x1){return _0x4ccf2e;}var _0x2e4340=this[_0xde14('0xa6')](_0xde14('0xb3'),_0xde14('0xb4'));if(_0x2e4340[_0xde14('0xa7')]===-0x1){return _0x2e4340;}var _0x3af55d=this[_0xde14('0xa6')]('RECOG_INPUT()',_0xde14('0xb5'));if(_0x3af55d[_0xde14('0xa7')]===-0x1){return _0x3af55d;}var _0x4cb4ad=this['getAndSetVariable'](_0xde14('0xb6'),_0xde14('0xb7'));if(_0x4cb4ad[_0xde14('0xa7')]===-0x1){return _0x4cb4ad;}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0xb8'),_0x3ad8de));};AGIVertices[_0xde14('0x16')][_0xde14('0x7')]=function(_0x44181b){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xb9'),_0x44181b[_0xde14('0x3b')]));return this[_0xde14('0xe')][_0xde14('0x7')]([_0x44181b[_0xde14('0xba')],_0x44181b[_0xde14('0xbb')]]);};AGIVertices[_0xde14('0x16')][_0xde14('0xbc')]=function(_0x646fa9){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xbd'),_0x646fa9['label']));if(this['isConfigured'](_0x646fa9[_0xde14('0x68')])){logger[_0xde14('0x30')](util['format'](_0xde14('0xbe'),_0x646fa9['timeout']));var _0x593e49=this[_0xde14('0xe')]['wait'](_0x646fa9[_0xde14('0x68')]);if(_0x593e49[_0xde14('0xa7')]===-0x1){return _0x593e49;}}return this[_0xde14('0xe')][_0xde14('0xbc')]();};AGIVertices['prototype'][_0xde14('0x4e')]=function(_0x4821){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4821[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x4821[_0xde14('0x4c')])){return this['channel'][_0xde14('0x2e')](_0x4821,_0xde14('0xbf'));}_0x4821['scheduledAt']=moment();if(this[_0xde14('0x89')](_0x4821['delay'])){_0x4821[_0xde14('0x4d')]=moment()['add'](_0x4821[_0xde14('0xc0')],_0xde14('0xc1'));}if(!this[_0xde14('0x89')](_0x4821['callback_priority'])){_0x4821[_0xde14('0x50')]=0x2;}this[_0xde14('0x46')][_0xde14('0x73')](this,_0x4821);return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xc2'),_0x4821[_0xde14('0x4b')],_0x4821[_0xde14('0x4c')],_0x4821[_0xde14('0x4d')]));};AGIVertices['prototype'][_0xde14('0xc3')]=function(_0x11915d){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xc4'),_0x11915d[_0xde14('0x3b')]));var _0x19a4cc=this[_0xde14('0xe')][_0xde14('0xad')](_0x11915d[_0xde14('0xc5')],_0x11915d['options']);if(_0x19a4cc[_0xde14('0xa7')]===-0x1){return _0x19a4cc;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xc6'),_0x11915d[_0xde14('0xc5')],_0x11915d['options']));};AGIVertices[_0xde14('0x16')][_0xde14('0xc7')]=function(_0x24d95d){logger[_0xde14('0x30')](util['format'](_0xde14('0xc8'),_0x24d95d[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x24d95d[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}var _0x504dc3='\x22'+_0x24d95d['text']+'\x22';if(this['isConfigured'](_0x24d95d['options'])){_0x504dc3+=','+_0x24d95d[_0xde14('0x7c')];}var _0xd909e1=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x504dc3);if(_0xd909e1[_0xde14('0xa7')]===-0x1){return _0xd909e1;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xaf'),_0x504dc3));};AGIVertices[_0xde14('0x16')][_0xde14('0xc9')]=function(_0x32ee79){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xca'),_0x32ee79['label']));if(!this[_0xde14('0x89')](_0x32ee79[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}var _0x42641a='\x22'+_0x32ee79[_0xde14('0x5e')]+'\x22';if(this['isConfigured'](_0x32ee79['options'])){_0x42641a+=','+_0x32ee79['options'];}var _0x33275e=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xae'),_0x42641a);if(_0x33275e[_0xde14('0xa7')]===-0x1){return _0x33275e;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xaf'),_0x42641a));};AGIVertices[_0xde14('0x16')][_0xde14('0xcb')]=function(_0x28ccbe){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0xcc'),_0x28ccbe[_0xde14('0x3b')]));if(!this['isConfigured'](_0x28ccbe['grammar'])){return this['channel'][_0xde14('0xab')](_0xde14('0xcd'));}var _0x38e36b=_0x28ccbe['grammar'];if(this[_0xde14('0x89')](_0x28ccbe[_0xde14('0x7c')])){_0x38e36b+=','+_0x28ccbe['options'];}var _0x2f3517=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0xb2'),_0x38e36b);if(_0x2f3517[_0xde14('0xa7')]===-0x1){return _0x2f3517;}var _0x55de57=this[_0xde14('0xa6')](_0xde14('0xb3'),_0xde14('0xce'));if(_0x55de57[_0xde14('0xa7')]===-0x1){return _0x55de57;}var _0xb175c7=this[_0xde14('0xa6')](_0xde14('0xcf'),_0xde14('0xd0'));if(_0xb175c7[_0xde14('0xa7')]===-0x1){return _0xb175c7;}var _0x17e1ec=this[_0xde14('0xa6')]('RECOG_INSTANCE()',_0xde14('0xd1'));if(_0x17e1ec[_0xde14('0xa7')]===-0x1){return _0x17e1ec;}return this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xb8'),_0x38e36b));};AGIVertices['prototype'][_0xde14('0xd2')]=function(_0x561b66){logger['info'](util[_0xde14('0x2b')](_0xde14('0xd3'),_0x561b66[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x561b66[_0xde14('0xb1')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20grammar\x20configured');}var _0x539b35=_0x561b66[_0xde14('0xb1')];if(this['isConfigured'](_0x561b66[_0xde14('0x7c')])){_0x539b35+=','+_0x561b66[_0xde14('0x7c')];}var _0x54d129=this['channel'][_0xde14('0xad')]('MRCPRecog',_0x539b35);if(_0x54d129[_0xde14('0xa7')]===-0x1){return _0x54d129;}var _0x59bd39=this['getAndSetVariable'](_0xde14('0xb3'),'SESTEK_ASR_CONFIDENCE');if(_0x59bd39[_0xde14('0xa7')]===-0x1){return _0x59bd39;}var _0x24f9b2=this[_0xde14('0xa6')](_0xde14('0xcf'),_0xde14('0xd4'));if(_0x24f9b2[_0xde14('0xa7')]===-0x1){return _0x24f9b2;}var _0x195c0b=this[_0xde14('0xa6')](_0xde14('0xb6'),'SESTEK_ASR_INSTANCE');if(_0x195c0b[_0xde14('0xa7')]===-0x1){return _0x195c0b;}return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xb8'),_0x539b35));};AGIVertices[_0xde14('0x16')][_0xde14('0xd5')]=function(_0x33f562){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x33f562[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x33f562['odbc_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,'no\x20database\x20selected');}var _0x58387a=this[_0xde14('0x1a')][_0xde14('0x73')](this,_0x33f562[_0xde14('0xd6')]);if(!_0x58387a){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xd7'));}if(!this['isConfigured'](_0x33f562[_0xde14('0x32')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xd8'));}var _0x20ad12=_0x33f562[_0xde14('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xde14('0xab')](util['format'](_0xde14('0xd9'),_0x20ad12));var _0x1b39cf=this[_0xde14('0x2d')][_0xde14('0x73')](this,_0x58387a,_0x20ad12);this[_0xde14('0x39')][_0xde14('0x73')](this,_0x33f562,_0x20ad12);if(!this[_0xde14('0x89')](_0x33f562[_0xde14('0xda')])){return this['channel'][_0xde14('0xab')](_0xde14('0xdb'));}var _0x14b2ee=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x33f562[_0xde14('0xda')]);if(!_0x14b2ee){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x33f562,_0xde14('0xdc'));}var _0x2569f8=this;_0x1b39cf[_0xde14('0xdd')](function(_0x175a30,_0x4f0a67){Object[_0xde14('0xde')](_0x175a30)['forEach'](function(_0x113627){_0x2569f8[_0xde14('0xe')]['setVariable'](util['format'](_0xde14('0xdf'),_0x14b2ee,_0x4f0a67,_0x113627),_0x175a30[_0x113627]);});});this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xe0'),_0x14b2ee),_0x1b39cf[_0xde14('0x9e')]);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('variable\x20%s\x20set',_0x14b2ee));};AGIVertices[_0xde14('0x16')]['dial']=function(_0x39a7e7){logger[_0xde14('0xe1')](util[_0xde14('0x2b')](_0xde14('0xe2'),_0x39a7e7[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x39a7e7['sip_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x39a7e7,_0xde14('0xe3'));}var _0x1e1ae0=this[_0xde14('0x1c')]['sync'](this,_0x39a7e7[_0xde14('0xe4')]);if(!_0x1e1ae0){return this['channel']['error'](_0x39a7e7,_0xde14('0xe5'));}var _0x5263cc=this['channel'][_0xde14('0xad')]('DIAL',[util['format'](_0xde14('0xe6'),_0x1e1ae0),_0x39a7e7['timeout'],_0x39a7e7[_0xde14('0xe7')],_0x39a7e7[_0xde14('0x66')]]);if(_0x5263cc[_0xde14('0xa7')]===-0x1){return _0x5263cc;}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0xe8'),_0xde14('0xe9')));};AGIVertices[_0xde14('0x16')]['dialogflow']=function(_0x59640c){logger['info'](util['format'](_0xde14('0xea'),_0x59640c[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x59640c['key'])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xeb'));}if(!this['isConfigured'](_0x59640c[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x59640c);this['createSquareMessage'](_0x59640c[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0xed'),_0x59640c[_0xde14('0x5e')]));var _0x2c9d93=this['googleDialogflow'][_0xde14('0x73')](this,_0x59640c);if(_0x2c9d93){for(var _0x3b750d in _0x2c9d93){if(_0x2c9d93[_0xde14('0x98')](_0x3b750d)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0xee'),_0x3b750d['toUpperCase']()),_0x2c9d93[_0x3b750d]);}}this[_0xde14('0x45')](_0x2c9d93[_0xde14('0xef')],_0xde14('0xf0'),'dialogflow','');return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xf1'),_0x2c9d93[_0xde14('0xef')]));}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x59640c,_0xde14('0xf2'));};AGIVertices[_0xde14('0x16')][_0xde14('0xf3')]=function(_0x2e6993){logger['info'](util[_0xde14('0x2b')](_0xde14('0xf4'),_0x2e6993[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0xf5')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xf6'));}if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0x80')])){return this['channel'][_0xde14('0xab')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x2e6993[_0xde14('0x81')])){return this['channel'][_0xde14('0xab')](_0xde14('0xf7'));}if(!this[_0xde14('0x89')](_0x2e6993[_0xde14('0x82')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20anguage\x20configured');}if(!this[_0xde14('0x89')](_0x2e6993['text'])){return this['channel'][_0xde14('0xab')]('no\x20text\x20configured');}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x2e6993);this[_0xde14('0x45')](_0x2e6993[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x2e6993[_0xde14('0x5e')]));var _0x5464b8=this[_0xde14('0x7f')][_0xde14('0x73')](this,_0x2e6993);if(_0x5464b8){for(var _0x12f579 in _0x5464b8){if(_0x5464b8[_0xde14('0x98')](_0x12f579)){if(_0x12f579!==_0xde14('0xf8')){this[_0xde14('0xe')][_0xde14('0xa2')](util['format'](_0xde14('0xee'),_0x12f579[_0xde14('0x6b')]()),_0x5464b8[_0x12f579]);}}}this[_0xde14('0x45')](_0x5464b8['speech'],_0xde14('0xf0'),'dialogflowV2',_0x5464b8['providerResponse']);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xf9'),_0x5464b8[_0xde14('0xef')]));}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2e6993,_0xde14('0xfa'));};AGIVertices['prototype'][_0xde14('0xfb')]=function(_0x281010){logger['info'](util[_0xde14('0x2b')](_0xde14('0xfc'),_0x281010['label']));if(!this[_0xde14('0x89')](_0x281010[_0xde14('0xfd')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xde14('0x89')](_0x281010[_0xde14('0xfe')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xff'));}if(!this['isConfigured'](_0x281010[_0xde14('0x100')])){return this['channel'][_0xde14('0xab')](_0xde14('0x101'));}if(!this[_0xde14('0x89')](_0x281010[_0xde14('0x102')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this['channel'][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x281010);this['createSquareMessage'](_0x281010[_0xde14('0x5e')],'in','','');this['channel']['noop'](util[_0xde14('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x281010['text']));var _0x42137a=this[_0xde14('0x83')]['sync'](this,_0x281010);if(_0x42137a){for(var _0x1e4f3b in _0x42137a){if(_0x42137a[_0xde14('0x98')](_0x1e4f3b)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('SESTEK_NDA_%s',_0x1e4f3b['toUpperCase']()),_0x42137a[_0x1e4f3b]);}}this[_0xde14('0x45')](_0x42137a[_0xde14('0xef')],_0xde14('0xf0'),'sesteknda','');if(_0x42137a[_0xde14('0x103')]){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x104'),_0x42137a['audiofile']));var _0x533318=this[_0xde14('0xe')][_0xde14('0x105')](_0x42137a['audiofile']);try{fs['unlink'](_0x42137a[_0xde14('0x103')]+'.wav');}catch(_0x546b0f){logger[_0xde14('0x2e')](_0x546b0f);}return _0x533318;}else{return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x106'),_0x42137a[_0xde14('0xef')]));}}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x281010,_0xde14('0x107'));};AGIVertices[_0xde14('0x16')][_0xde14('0x108')]=function(_0x989ec7){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x109'),_0x989ec7['label']));return this[_0xde14('0xe')][_0xde14('0xab')]('end');};AGIVertices[_0xde14('0x16')][_0xde14('0x10a')]=function(_0x44cc13){logger['info'](util[_0xde14('0x2b')](_0xde14('0x10b'),_0x44cc13['label']));var _0x3907f9='';if(_0x44cc13[_0xde14('0x10c')]){if(!this[_0xde14('0x89')](_0x44cc13[_0xde14('0x10c')])){return this['channel']['error'](_0x44cc13,_0xde14('0x10d'));}else{var _0x1dcbe7=parseInt(_0x44cc13[_0xde14('0x10c')],0xa);if(isNaN(_0x1dcbe7)){_0x3907f9=_0x44cc13[_0xde14('0x10c')];}else{_0x3907f9=this[_0xde14('0x1e')][_0xde14('0x73')](this,_0x44cc13[_0xde14('0x10c')]);if(!_0x3907f9){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x44cc13,_0xde14('0x10e'));}}}}else if(_0x44cc13[_0xde14('0x10f')]){_0x3907f9=_0x44cc13[_0xde14('0x10f')];}else{return this['channel'][_0xde14('0x2e')](_0x44cc13,'no\x20trunk\x20selected');}var _0x2d70ae=this['channel'][_0xde14('0xad')](_0xde14('0xe9'),[util[_0xde14('0x2b')](_0xde14('0x110'),_0x3907f9,_0x44cc13[_0xde14('0x4b')]),_0x44cc13[_0xde14('0x68')],_0x44cc13[_0xde14('0xe7')],_0x44cc13[_0xde14('0x66')]]);if(_0x2d70ae[_0xde14('0xa7')]===-0x1){return _0x2d70ae;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Executed\x20command\x20%s',_0xde14('0xe9')));};AGIVertices[_0xde14('0x16')]['finally']=function(_0x20e2af){logger['info'](util['format'](_0xde14('0x111'),_0x20e2af[_0xde14('0x3b')]));return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x112'));};AGIVertices[_0xde14('0x16')][_0xde14('0xc')]=function(_0x17aec4){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x113'),_0x17aec4['label']));if(_0x17aec4[_0xde14('0xa9')]===0x0){return this[_0xde14('0xa8')](_0x17aec4);}_0x17aec4['retry']-=0x1;if(!this['isConfigured'](_0x17aec4[_0xde14('0x114')])){return this['channel']['error'](_0x17aec4,_0xde14('0x115'));}var _0x53371d=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x17aec4[_0xde14('0x114')]);if(!_0x53371d){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x17aec4,_0xde14('0x116'));}if(!this[_0xde14('0x89')](_0x17aec4[_0xde14('0xda')])){return this['channel'][_0xde14('0x2e')](_0xde14('0xdb'));}var _0x3a4ed2=this['channel'][_0xde14('0x117')](_0x53371d,_0x17aec4[_0xde14('0x118')],_0x17aec4[_0xde14('0x119')]);var _0x40b765=_0x3a4ed2[_0xde14('0xa7')]?_0x3a4ed2[_0xde14('0xa7')]['toString']():'';logger[_0xde14('0x30')](_0xde14('0x11a'),JSON['stringify'](_0x3a4ed2));if(_0x3a4ed2[_0xde14('0xa7')]===-0x1){this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x17aec4,_0x40b765);return _0x3a4ed2;}else if(_0x3a4ed2[_0xde14('0xa5')]===_0xde14('0x68')){_0x3a4ed2[_0xde14('0xa7')]=_0x40b765[_0xde14('0x9e')]>=parseInt(_0x17aec4[_0xde14('0x11b')])?'x':'i';}else{_0x3a4ed2[_0xde14('0xa7')]=_0x40b765[_0xde14('0x9e')]>=parseInt(_0x17aec4[_0xde14('0x11b')])&&_0x40b765[_0xde14('0x9e')]<=parseInt(_0x17aec4['maxdigit'])?'x':'i';}var _0x45cfb0=this['getVariable']['sync'](this,_0x17aec4[_0xde14('0xda')]);if(!_0x45cfb0){return this[_0xde14('0xe')]['error'](_0x17aec4,_0xde14('0xdc'));}this[_0xde14('0xe')]['setVariable'](_0x45cfb0,_0x40b765);if(this[_0xde14('0x89')](_0x17aec4[_0xde14('0x11c')])){var _0x4ee79f=parseInt(_0x17aec4[_0xde14('0x11c')],0xa);var _0x437f1b=rs['generate']({'charset':'*','length':_0x4ee79f});var _0x4ad0ad=_0x40b765[_0xde14('0x9e')];if(_0x4ad0ad>0x0){if(_0x4ad0ad>_0x4ee79f){this['createSquareDetailsReport']['sync'](this,_0x17aec4,_0x17aec4[_0xde14('0x11d')]===_0xde14('0x11e')?_0x437f1b+_0x40b765[_0xde14('0x11f')](_0x4ee79f):_0x40b765[_0xde14('0x11f')](0x0,_0x4ad0ad-_0x4ee79f)+_0x437f1b);}else{this[_0xde14('0x39')][_0xde14('0x73')](this,_0x17aec4,rs[_0xde14('0x120')]({'charset':'*','length':_0x4ad0ad}));}}else{this[_0xde14('0x39')][_0xde14('0x73')](this,_0x17aec4,'');}}else{this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x17aec4,_0x40b765);}return _0x3a4ed2;};AGIVertices[_0xde14('0x16')][_0xde14('0xd')]=function(_0x34347e){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x121'),_0x34347e[_0xde14('0x3b')]));return this['getdigits'](_0x34347e);};AGIVertices['prototype'][_0xde14('0x122')]=function(_0xa77a11){logger[_0xde14('0x30')](util['format'](_0xde14('0x123'),_0xa77a11[_0xde14('0x3b')]));this[_0xde14('0x39')][_0xde14('0x73')](this,_0xa77a11,_0xa77a11['goalname']);return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x124'),_0xa77a11[_0xde14('0x125')]));};AGIVertices['prototype'][_0xde14('0x126')]=function(_0x188fec){logger['info'](util[_0xde14('0x2b')](_0xde14('0x127'),_0x188fec[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x188fec[_0xde14('0x8b')])||!this[_0xde14('0x89')](_0x188fec[_0xde14('0x8c')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x128'));}if(!this[_0xde14('0x89')](_0x188fec[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20text\x20configured');}this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x129'),_0x188fec['text']));var _0x4f226d=this[_0xde14('0x12a')]['sync'](this,_0x188fec);if(_0x4f226d){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x12b'),_0x4f226d));var _0x3a7af3=this[_0xde14('0xe')][_0xde14('0x105')](_0x4f226d);try{fs[_0xde14('0x12c')](_0x4f226d+_0xde14('0x12d'));}catch(_0x2a9b06){logger[_0xde14('0x2e')](_0x2a9b06);}return _0x3a7af3;}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x188fec,_0xde14('0x12e'));};AGIVertices['prototype'][_0xde14('0x12f')]=function(_0x2418aa){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2418aa['label']));if(!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x8b')])||!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x8c')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2418aa[_0xde14('0x91')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x130'));}if(!this[_0xde14('0x89')](_0x2418aa[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xec')]=!![];this[_0xde14('0x39')](_0x2418aa);this[_0xde14('0x45')](_0x2418aa[_0xde14('0x5e')],'in','','');this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2418aa[_0xde14('0x5e')]));var _0xeccdec=this[_0xde14('0x90')][_0xde14('0x73')](this,_0x2418aa);if(_0xeccdec){for(var _0x35d2d1 in _0xeccdec){if(_0xeccdec[_0xde14('0x98')](_0x35d2d1)&&_[_0xde14('0x9f')](_0xeccdec[_0x35d2d1])){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('AWS_LEX_%s',_0x35d2d1[_0xde14('0x6b')]()),_0xeccdec[_0x35d2d1]);}}if(_[_0xde14('0x48')](_0xeccdec[_0xde14('0x7a')])){return this['channel']['noop'](_0xde14('0x131'));}else{this[_0xde14('0x45')](_0xeccdec[_0xde14('0x7a')],_0xde14('0xf0'),'amazonlex','');return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x132'),_0xeccdec[_0xde14('0x7a')]));}}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2418aa,_0xde14('0x133'));};AGIVertices['prototype'][_0xde14('0x134')]=function(_0x23f836){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x135'),_0x23f836['label'],_0x23f836[_0xde14('0x68')]));if(!this[_0xde14('0x89')](_0x23f836[_0xde14('0x7e')])){return this[_0xde14('0xe')][_0xde14('0xab')]('no\x20key\x20configured');}var _0x414d78=_0xde14('0x136');var _0x535874=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs[_0xde14('0x120')](0x4));var _0x4123ee=util['format'](_0xde14('0xa1'),_0x535874,_0x414d78);var _0x110ed9=!![];if(_0x23f836[_0xde14('0x138')]==='NOBEEP'){_0x110ed9=![];}var _0x5d1855=this[_0xde14('0xe')][_0xde14('0x139')](_0x535874,_0x414d78,_0x23f836[_0xde14('0x13a')],_0x23f836['timeout'],undefined,_0x110ed9);if(_0x5d1855[_0xde14('0xa7')]!==-0x1){this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x13b'),_0x4123ee));var _0x50fed2=this[_0xde14('0x92')][_0xde14('0x73')](this,_0x23f836,_0x4123ee);if(_0x50fed2){for(var _0x1bae5c in _0x50fed2){if(_0x50fed2[_0xde14('0x98')](_0x1bae5c)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x13c'),_0x1bae5c['toUpperCase']()),_0x50fed2[_0x1bae5c]);}}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x50fed2)));}}return _0x5d1855;};AGIVertices[_0xde14('0x16')][_0xde14('0x13d')]=function(_0x27ad9f){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x13e'),_0x27ad9f[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x27ad9f[_0xde14('0x95')])){return this[_0xde14('0xe')]['noop'](_0xde14('0x13f'));}if(!this[_0xde14('0x89')](_0x27ad9f[_0xde14('0x140')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x141'));}var _0x2e92ca=_0xde14('0x136');var _0x40a040=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs['generate'](0x4));var _0x369f0e=util[_0xde14('0x2b')](_0xde14('0xa1'),_0x40a040,_0x2e92ca);var _0x5eb127=!![];if(_0x27ad9f[_0xde14('0x138')]===_0xde14('0x142')){_0x5eb127=![];}var _0x456165=this[_0xde14('0xe')][_0xde14('0x139')](_0x40a040,_0x2e92ca,_0x27ad9f[_0xde14('0x13a')],_0x27ad9f[_0xde14('0x68')],undefined,_0x5eb127);if(_0x456165['result']!==-0x1){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x143'),_0x369f0e));var _0x1fe8b1=this['tildeASR']['sync'](this,_0x27ad9f,_0x369f0e);if(_0x1fe8b1){for(var _0x5a03a6 in _0x1fe8b1){if(_0x1fe8b1[_0xde14('0x98')](_0x5a03a6)){this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')]('TILDE_ASR_%s',_0x5a03a6[_0xde14('0x6b')]()),_0x1fe8b1[_0x5a03a6]);}}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x144'),JSON[_0xde14('0x76')](_0x1fe8b1)));}}return _0x456165;};AGIVertices[_0xde14('0x16')][_0xde14('0x145')]=function(_0x375d9f){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x146'),_0x375d9f[_0xde14('0x3b')]));return this[_0xde14('0xe')]['continueAt'](_0x375d9f[_0xde14('0x41')],_0x375d9f[_0xde14('0x147')],_0x375d9f[_0xde14('0x148')]);};AGIVertices[_0xde14('0x16')]['gotoif']=function(_0x45636b){logger['info'](util['format'](_0xde14('0x149'),_0x45636b['label']));if(!this[_0xde14('0x89')](_0x45636b[_0xde14('0x14a')])){return this[_0xde14('0xe')]['error'](_0x45636b,_0xde14('0x14b'));}try{var _0x4444a0=eval(_0x45636b[_0xde14('0x14a')])?_0xde14('0x14c'):'false';this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x14d'),_0x45636b['condition'],_0x4444a0));return{'code':0xc8,'result':_0x4444a0};}catch(_0x1475fa){return{'code':0xc8,'result':_0xde14('0x14e')};}};AGIVertices[_0xde14('0x16')][_0xde14('0x14f')]=function(_0xba6900){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x150'),_0xba6900[_0xde14('0x3b')]));if(!this['isConfigured'](_0xba6900[_0xde14('0x151')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0xba6900,_0xde14('0x152'));}var _0x39b35f=this[_0xde14('0x153')]['sync'](this,_0xba6900[_0xde14('0x151')]);if(!_0x39b35f){return this[_0xde14('0xe')]['error'](_0xba6900,_0xde14('0x154'));}for(var _0x3ccee7=0x0;_0x3ccee7<_0x39b35f[_0xde14('0x9e')];_0x3ccee7+=0x1){var _0x550992=this[_0xde14('0xe')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x39b35f[_0x3ccee7]));if(_0x550992[_0xde14('0xa7')]===-0x1){return _0x550992;}logger['info'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],_0x550992['extra']));if(_0x550992['extra']===_0xde14('0x14c')){logger['info'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],'true'));this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],'true'));return{'code':0xc8,'result':_0xde14('0x14c')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')]('IFTIME\x20%s\x20%s',_0x39b35f[_0x3ccee7],'false'));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x155'),_0x39b35f[_0x3ccee7],_0xde14('0x14e')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xde14('0x16')][_0xde14('0x156')]=function(_0x1a3d33){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1a3d33[_0xde14('0x3b')]));return this[_0xde14('0xe')]['hangup']();};AGIVertices[_0xde14('0x16')][_0xde14('0x157')]=function(_0x1c0813){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1c0813[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x1c0813[_0xde14('0x7e')])){return this[_0xde14('0xe')]['noop'](_0xde14('0xeb'));}var _0x59be8a=_0xde14('0x136');var _0x2d91e5=util[_0xde14('0x2b')](_0xde14('0x137'),FILES_PATH,rs[_0xde14('0x120')](0x4));var _0x326ab6=util[_0xde14('0x2b')](_0xde14('0xa1'),_0x2d91e5,_0x59be8a);var _0x1637dd=!![];if(_0x1c0813[_0xde14('0x138')]===_0xde14('0x142')){_0x1637dd=![];}var _0x1b2501=this['channel'][_0xde14('0x139')](_0x2d91e5,_0x59be8a,_0x1c0813['intKey'],_0x1c0813[_0xde14('0x68')],undefined,_0x1637dd);if(_0x1b2501[_0xde14('0xa7')]!==-0x1){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('ispeech\x20%s\x20file\x20created',_0x326ab6));var _0x3c2f49=this[_0xde14('0x87')]['sync'](this,_0x1c0813,_0x326ab6);if(_0x3c2f49){for(var _0x3a9df8 in _0x3c2f49){if(_0x3c2f49['hasOwnProperty'](_0x3a9df8)){this['channel'][_0xde14('0xa2')](util['format'](_0xde14('0x158'),_0x3a9df8['toUpperCase']()),_0x3c2f49[_0x3a9df8]);}}return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0x159'),JSON[_0xde14('0x76')](_0x3c2f49)));}}return _0x1b2501;};AGIVertices[_0xde14('0x16')][_0xde14('0x15a')]=function(_0x19c9b0){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x15b'),_0x19c9b0[_0xde14('0x3b')]));if(!this['isConfigured'](_0x19c9b0[_0xde14('0x7e')])){return this['channel']['noop'](_0xde14('0xeb'));}if(!this['isConfigured'](_0x19c9b0['text'])){return this['channel'][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x19c9b0[_0xde14('0x5e')]));var _0x5cb1e5=this['ispeechTTS']['sync'](this,_0x19c9b0);if(_0x5cb1e5){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x15c'),_0x5cb1e5));var _0x4697f=this[_0xde14('0xe')][_0xde14('0x105')](_0x5cb1e5,_0x19c9b0[_0xde14('0x13a')]);try{fs[_0xde14('0x12c')](_0x5cb1e5+_0xde14('0x12d'));}catch(_0x47baf5){logger[_0xde14('0x2e')](_0x47baf5);}return _0x4697f;}return this['channel']['error'](_0x19c9b0,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xde14('0x16')][_0xde14('0x15d')]=function(_0x2b950f){logger['info'](util[_0xde14('0x2b')](_0xde14('0x15e'),_0x2b950f['label']));if(!this[_0xde14('0x89')](_0x2b950f['findBy'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2b950f,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde14('0xe')][_0xde14('0x3e')],_0x2b950f['findBy']));var _0x4f2a56=this[_0xde14('0x57')][_0xde14('0x73')](this,_0x2b950f[_0xde14('0x160')]);if(_0x4f2a56){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')]['callerid'],_0x2b950f[_0xde14('0x160')]));this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x2b950f[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this[_0xde14('0xe')]['callerid'],_0x2b950f[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x2b950f['findBy']));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices[_0xde14('0x16')][_0xde14('0x165')]=function(_0x15ce1e){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x15ce1e[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x15ce1e[_0xde14('0x160')])){return this['channel'][_0xde14('0x2e')](_0x15ce1e,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));var _0x24d34c=this['agentLogout'][_0xde14('0x73')](this,_0x15ce1e[_0xde14('0x160')]);if(_0x24d34c){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x15ce1e[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x15ce1e['findBy']));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices[_0xde14('0x16')]['math']=function(_0x450446){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x166'),_0x450446[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x450446[_0xde14('0x167')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x450446,_0xde14('0x168'));}this['channel']['noop'](util['format'](_0xde14('0x169'),_0x450446['operation']));var _0x30596=eval(_0x450446[_0xde14('0x167')]);if(!this['isConfigured'](_0x450446['variable_id'])){return this[_0xde14('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5651bd=this[_0xde14('0x11')]['sync'](this,_0x450446['variable_id']);if(!_0x5651bd){return this['channel'][_0xde14('0x2e')](_0x450446,_0xde14('0xdc'));}if(_[_0xde14('0x9d')](_0x30596)){var _0x202b9b=this;_0x30596['forEach'](function(_0x51c122,_0x54f94a){_0x202b9b[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x16a'),_0x5651bd,_0x54f94a),_0x51c122);});return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')]('variable\x20%s[key]\x20set',_0x5651bd));}else{return this[_0xde14('0xe')][_0xde14('0xa2')](_0x5651bd,_0x30596);}};AGIVertices['prototype']['menu']=function(_0x521c39){logger[_0xde14('0x30')](util['format'](_0xde14('0x16b'),_0x521c39[_0xde14('0x3b')]));if(_0x521c39[_0xde14('0xa9')]===0x0){return this[_0xde14('0xa8')](_0x521c39);}_0x521c39[_0xde14('0xa9')]-=0x1;if(!this[_0xde14('0x89')](_0x521c39[_0xde14('0x114')])){return this[_0xde14('0xe')]['error'](_0x521c39,_0xde14('0x115'));}var _0x57ee7c=this['getSound']['sync'](this,_0x521c39[_0xde14('0x114')]);if(!_0x57ee7c){return this['channel'][_0xde14('0x2e')](_0x521c39,'no\x20file\x20audio\x20found');}var _0x3946de=this[_0xde14('0xe')][_0xde14('0x117')](_0x57ee7c,_0x521c39[_0xde14('0x118')],_0x521c39['digit']);var _0x287cfd=_0x3946de[_0xde14('0xa7')];if(_0x3946de['result']===-0x1){this[_0xde14('0x39')]['sync'](this,_0x521c39,'-1');return _0x3946de;}else if(_0x3946de[_0xde14('0xa5')]==='timeout'){_0x3946de[_0xde14('0xa7')]=_0x3946de[_0xde14('0xa7')][_0xde14('0x9e')]>0x0?_0x3946de['result']:'t';}else if(_[_0xde14('0x47')](_0x3946de[_0xde14('0xa7')])){_0x3946de['result']='#';_0x287cfd='#';}if(!this['isConfigured'](_0x521c39[_0xde14('0xda')])){this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xdb'));}else{var _0x111280=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x521c39[_0xde14('0xda')]);if(!_0x111280){return this['channel']['error'](_0x521c39,'no\x20variable\x20found');}this[_0xde14('0xe')][_0xde14('0xa2')](_0x111280,_0x287cfd);}this[_0xde14('0x39')]['sync'](this,_0x521c39,_0x287cfd);return _0x3946de;};AGIVertices[_0xde14('0x16')][_0xde14('0xab')]=function(_0x3cd310){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x16c'),_0x3cd310[_0xde14('0x3b')]));return this['channel'][_0xde14('0xab')](_0x3cd310[_0xde14('0x16d')]||_0x3cd310[_0xde14('0x3b')]);};AGIVertices[_0xde14('0x16')]['pause']=function(_0x6ebe80){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x6ebe80['label']));if(!this['isConfigured'](_0x6ebe80[_0xde14('0x160')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x6ebe80,'no\x20find\x20by\x20configured');}logger['info'](util[_0xde14('0x2b')](_0xde14('0x16e'),this['channel']['callerid'],_0x6ebe80[_0xde14('0x160')]));var _0x8c0dbf=this[_0xde14('0x51')]['sync'](this,_0x6ebe80[_0xde14('0x16f')]);var _0x3b2938=this['agentPause']['sync'](this,_0x6ebe80[_0xde14('0x160')],_0x8c0dbf);if(_0x3b2938){logger['info'](util[_0xde14('0x2b')](_0xde14('0x161'),this[_0xde14('0xe')]['callerid'],_0x6ebe80[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x163'),this['channel'][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x6ebe80[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices['prototype']['playback']=function(_0x1afe52){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1afe52[_0xde14('0x3b')]));if(!this['isConfigured'](_0x1afe52[_0xde14('0x114')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1afe52,_0xde14('0x115'));}var _0x51758f=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x1afe52[_0xde14('0x114')]);if(!_0x51758f){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1afe52,_0xde14('0x116'));}var _0x21d47f=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0x170'),[_0x51758f,_0x1afe52['opts']]);if(_0x21d47f[_0xde14('0xa7')]===-0x1){return _0x21d47f;}return this['channel']['noop'](util[_0xde14('0x2b')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x51758f));};AGIVertices[_0xde14('0x16')][_0xde14('0x171')]=function(_0x5a299e){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x172'),_0x5a299e[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x5a299e['queue_id'])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x5a299e,_0xde14('0x173'));}var _0x343bf9='';var _0x2fb734=parseInt(_0x5a299e[_0xde14('0x174')],0xa);if(isNaN(_0x2fb734)){_0x343bf9=_0x5a299e[_0xde14('0x174')];}else{_0x343bf9=this[_0xde14('0x17')][_0xde14('0x73')](this,_0x5a299e['queue_id']);if(!_0x343bf9){return this['channel'][_0xde14('0x2e')](_0x5a299e,_0xde14('0x175'));}}var _0x333eb7='';if(this[_0xde14('0x89')](_0x5a299e[_0xde14('0x114')])){var _0x8642b3=this[_0xde14('0x20')][_0xde14('0x73')](this,_0x5a299e[_0xde14('0x114')]);if(_0x8642b3){_0x333eb7=_0x8642b3;}}this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x5a299e,_0x343bf9);if(_0x5a299e[_0xde14('0xe7')][_0xde14('0x176')]('x')<0x0){_0x5a299e['opts']+='x';}if(_0x5a299e[_0xde14('0xe7')][_0xde14('0x176')]('X')<0x0){_0x5a299e[_0xde14('0xe7')]+='X';}this[_0xde14('0xe')][_0xde14('0xa2')](_0xde14('0x177'),_0x343bf9?_0x343bf9[_0xde14('0x178')]():'');var _0x4dd128=this[_0xde14('0xe')][_0xde14('0xad')](_0xde14('0x179'),[_0x343bf9,_0x5a299e[_0xde14('0xe7')],_0x5a299e[_0xde14('0x66')],_0x333eb7,_0x5a299e[_0xde14('0x68')],_0x5a299e[_0xde14('0x7')],_0x5a299e[_0xde14('0x17a')],_0x5a299e['gosub'],'',_0x5a299e[_0xde14('0x17b')]]);if(_0x4dd128[_0xde14('0xa7')]===-0x1){return _0x4dd128;}return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0xc6'),_0xde14('0x179'),_0x343bf9));};AGIVertices[_0xde14('0x16')]['record']=function(_0x3b92a1){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x17c'),_0x3b92a1[_0xde14('0x3b')]));var _0x594776=_0x3b92a1['recordingFormat']||_0xde14('0x136');var _0x455e36=util[_0xde14('0x2b')](_0xde14('0x17d'),this['channel'][_0xde14('0x3a')],rs[_0xde14('0x120')](0x5));var _0x33be53=util['format'](_0xde14('0x17e'),FILES_PATH,_0x455e36,_0x594776);var _0x49207f=util[_0xde14('0x2b')]('%s/recordings/%s',FILES_PATH,_0x455e36);this[_0xde14('0x3f')]['sync'](this,_0x3b92a1,_0x455e36,_0x33be53);this[_0xde14('0xe')]['setVariable'](_0xde14('0x17f'),_0x455e36);logger[_0xde14('0x30')](_0xde14('0x180'),_0x49207f,_0x594776,_0x3b92a1[_0xde14('0x181')],_0x3b92a1[_0xde14('0x68')]);return this['channel'][_0xde14('0x139')](_0x49207f,_0x594776,_0x3b92a1[_0xde14('0x181')],_0x3b92a1[_0xde14('0x68')],undefined,!![]);};AGIVertices[_0xde14('0x16')]['restapi']=function(_0x2e918b){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x182'),_0x2e918b[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2e918b[_0xde14('0x66')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x183'));}var _0x16f024=this['restAPI']['sync'](this,_0x2e918b);logger[_0xde14('0x30')](util['format'](_0xde14('0x184'),util[_0xde14('0x185')](_0x16f024,{'showHidden':![],'depth':null})));if(!this[_0xde14('0x89')](_0x2e918b[_0xde14('0xda')])){return this['channel']['noop'](_0xde14('0x186'));}var _0x16fb7e=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x2e918b[_0xde14('0xda')]);if(!_0x16fb7e){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2e918b,_0xde14('0xdc'));}this[_0xde14('0xe')][_0xde14('0xa2')](util[_0xde14('0x2b')](_0xde14('0x187'),_0x16fb7e),_0x16f024['statusCode']?_0x16f024[_0xde14('0x79')]:_0xde14('0x188'));this['channel'][_0xde14('0xa2')](util[_0xde14('0x2b')]('%s_STATUS_MESSAGE',_0x16fb7e),_0x16f024['statusMessage']?_0x16f024[_0xde14('0x78')]:'OK');if(_0x16f024['body']){try{this[_0xde14('0xa0')](_0x16f024[_0xde14('0x6c')],_0x16fb7e);}catch(_0x1bcfe9){logger[_0xde14('0x2e')](util[_0xde14('0x2b')](_0xde14('0x189'),_0x16fb7e));}}return this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x18a'),_0x16fb7e));};AGIVertices[_0xde14('0x16')][_0xde14('0x18b')]=function(_0x393003){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x18c'),_0x393003['label']));return this[_0xde14('0xe')]['sayDigits'](_0x393003[_0xde14('0x18d')][_0xde14('0x5c')](/\s+/g,''),_0x393003[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x18e')]=function(_0x469076){logger[_0xde14('0x30')](util['format'](_0xde14('0x18f'),_0x469076[_0xde14('0x3b')]));return this['channel']['sayNumber'](_0x469076[_0xde14('0x67')][_0xde14('0x5c')](/\s+/g,''),_0x469076[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x190')]=function(_0x21b30c){logger['info'](util[_0xde14('0x2b')](_0xde14('0x191'),_0x21b30c[_0xde14('0x3b')]));return this['channel'][_0xde14('0x192')](_0x21b30c['text'],_0x21b30c[_0xde14('0x181')]);};AGIVertices[_0xde14('0x16')][_0xde14('0x193')]=function(_0x46811a){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x194'),_0x46811a[_0xde14('0x3b')]));if(!this['isConfigured'](_0x46811a[_0xde14('0x195')])){return this[_0xde14('0xe')]['noop'](_0xde14('0x196'));}var _0x587f65=this['getMailAccount'][_0xde14('0x73')](this,_0x46811a[_0xde14('0x195')]);if(!_0x587f65||!_0x587f65[_0xde14('0x197')]){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x46811a,'no\x20mail\x20account\x20found');}var _0x19e117={'from':util[_0xde14('0x2b')](_0xde14('0x198'),_0x587f65[_0xde14('0x14')],_0x587f65[_0xde14('0x199')]||_0x587f65[_0xde14('0x197')][_0xde14('0x19a')]),'to':_0x46811a['to']||'','cc':_0x46811a['cc']||'','bcc':_0x46811a[_0xde14('0x19b')]||'','subject':_0x46811a[_0xde14('0x19c')],'html':_0x46811a['text'],'text':_0x46811a['text']};if(this[_0xde14('0x89')](_0x46811a[_0xde14('0x19d')])){}logger['debug'](_0xde14('0x19e'),JSON['stringify'](_0x19e117));this[_0xde14('0x39')][_0xde14('0x73')](this,_0x46811a,_0x46811a[_0xde14('0x195')]);this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x19f'),_0x587f65[_0xde14('0x14')]));this['sendMailMessage'][_0xde14('0x73')](this,_0x587f65[_0xde14('0x1a0')],_0x19e117);return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a1'));};AGIVertices[_0xde14('0x16')]['sendFax']=function(_0x8df4c6){logger['info'](util[_0xde14('0x2b')](_0xde14('0x1a2'),_0x8df4c6['label']));return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a3'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1a4')]=function(_0x7e6ec5){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x7e6ec5[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x7e6ec5['sms_account_id'])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1a5'));}var _0x6a02bb=this[_0xde14('0x36')][_0xde14('0x73')](this,_0x7e6ec5['sms_account_id']);if(!_0x6a02bb){return this[_0xde14('0xe')]['error'](_0x7e6ec5,_0xde14('0x1a6'));}var _0x1587a2={'body':_0x7e6ec5[_0xde14('0x1a7')],'phone':_0x7e6ec5['to']||'','SmsAccountId':_0x6a02bb['id']};logger['debug'](_0xde14('0x1a8'),JSON[_0xde14('0x76')](_0x1587a2));this['createSquareDetailsReport'][_0xde14('0x73')](this,_0x7e6ec5,_0x7e6ec5[_0xde14('0x1a9')]);this['channel'][_0xde14('0xab')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x6a02bb[_0xde14('0x14')]));this[_0xde14('0x38')]['sync'](this,_0x1587a2);return this['channel'][_0xde14('0xab')](_0xde14('0x1aa'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1ab')]=function(_0x3d7a0d){logger[_0xde14('0x30')](util['format'](_0xde14('0x1ac'),_0x3d7a0d[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x3d7a0d[_0xde14('0xda')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x3d7a0d,'no\x20variable\x20selected');}var _0x1ce2e1=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x3d7a0d[_0xde14('0xda')]);if(!_0x1ce2e1){return this[_0xde14('0xe')]['error'](_0x3d7a0d,_0xde14('0xdc'));}return this[_0xde14('0xe')][_0xde14('0xa2')](_0x1ce2e1,_0x3d7a0d['variable_value']);};AGIVertices[_0xde14('0x16')][_0xde14('0x1ad')]=function(_0x35f4ad){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1ae'),_0x35f4ad['label']));this[_0xde14('0xe')]['noop'](_0xde14('0x1af'));var _0x58a34d=this[_0xde14('0xe')][_0xde14('0x11')](_0xde14('0x1b0'));if(!_[_0xde14('0x47')](_0x58a34d[_0xde14('0xa5')])){this[_0xde14('0xe')][_0xde14('0x3a')]=_0x58a34d[_0xde14('0xa5')];}if(_0x35f4ad[_0xde14('0xbc')]===_0xde14('0x1b1')){this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1b2'));return this[_0xde14('0xe')][_0xde14('0xbc')]();}return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0x1b3'));};AGIVertices[_0xde14('0x16')][_0xde14('0x1b4')]=function(_0x1671fc){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1b5'),_0x1671fc['label']));if(!this[_0xde14('0x89')](_0x1671fc[_0xde14('0x1b6')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1671fc,'no\x20subproject\x20selected');}var _0x3c1f1b=this[_0xde14('0x18')][_0xde14('0x73')](this,_0x1671fc[_0xde14('0x1b6')]);if(!this['isConfigured'](_0x3c1f1b)){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x1671fc,util[_0xde14('0x2b')](_0xde14('0x1b7'),_0x1671fc[_0xde14('0x1b6')]));}if(_0x3c1f1b===this[_0xde14('0xe')]['arg_1']){return this['channel'][_0xde14('0x2e')](_0x1671fc,_0xde14('0x1b8'));}this[_0xde14('0x39')][_0xde14('0x73')](this,_0x1671fc,_0x3c1f1b);var _0x3f55c3=this[_0xde14('0xe')][_0xde14('0xad')]('AGI',util['format'](_0xde14('0x1b9'),config[_0xde14('0x7')]['host']||_0xde14('0x1ba'),_0x3c1f1b,this[_0xde14('0xe')]['arg_1']));if(_0x3f55c3[_0xde14('0xa7')]===-0x1){return _0x3f55c3;}return this['channel'][_0xde14('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0xde14('0x1bb'),_0x3c1f1b));};AGIVertices[_0xde14('0x16')][_0xde14('0x1bc')]=function(_0x218678){logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x1bd'),_0x218678[_0xde14('0x3b')]));var _0x1cfb4f=this[_0xde14('0x5b')][_0xde14('0x73')](this,_0x218678['command']);this[_0xde14('0x39')]['sync'](this,_0x218678,_0x218678[_0xde14('0xba')]);if(this[_0xde14('0x89')](_0x218678['variable_id'])){var _0x389d19=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x218678[_0xde14('0xda')]);if(_0x389d19){this[_0xde14('0xe')][_0xde14('0xa2')](_0x389d19,_0x1cfb4f);return this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1be'),_0x218678[_0xde14('0xba')],_0x389d19));}}return this[_0xde14('0xe')][_0xde14('0xab')](util['format'](_0xde14('0x1bf'),_0x218678[_0xde14('0xba')]));};AGIVertices[_0xde14('0x16')]['google_cloud_tts']=function(_0x3145c2){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3145c2[_0xde14('0x3b')]));_0x3145c2[_0xde14('0x5e')]=_0x3145c2[_0xde14('0x5e')][_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xde14('0x89')](_0x3145c2[_0xde14('0x1c0')])){return this['channel'][_0xde14('0xab')](_0xde14('0x1c1'));}if(!this[_0xde14('0x89')](_0x3145c2[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c2'),_0x3145c2[_0xde14('0x5e')]));var _0x396139=this[_0xde14('0x5d')][_0xde14('0x73')](this,_0x3145c2);if(_0x396139){this['channel'][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c3'),_0x396139));var _0x1a3199=this[_0xde14('0xe')][_0xde14('0x105')](_0x396139);try{fs['unlink'](_0x396139+_0xde14('0x12d'));}catch(_0x3ab726){logger[_0xde14('0x2e')](_0x3ab726);}return _0x1a3199;}return this['channel']['error'](_0x3145c2,_0xde14('0x1c4'));};AGIVertices['prototype'][_0xde14('0x1c5')]=function(_0x5e0f1d){logger[_0xde14('0x30')](util[_0xde14('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5e0f1d[_0xde14('0x3b')]));_0x5e0f1d[_0xde14('0x5e')]=_0x5e0f1d[_0xde14('0x5e')][_0xde14('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xde14('0x89')](_0x5e0f1d[_0xde14('0x5e')])){return this[_0xde14('0xe')][_0xde14('0xab')](_0xde14('0xac'));}this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c6'),_0x5e0f1d[_0xde14('0x5e')]));var _0x20c01f=this['googleTTS'][_0xde14('0x73')](this,_0x5e0f1d);if(_0x20c01f){this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x1c7'),_0x20c01f));var _0x5a121f=this[_0xde14('0xe')][_0xde14('0x105')](_0x20c01f);try{fs[_0xde14('0x12c')](_0x20c01f+_0xde14('0x12d'));}catch(_0x482555){logger[_0xde14('0x2e')](_0x482555);}return _0x5a121f;}return this[_0xde14('0xe')][_0xde14('0x2e')](_0x5e0f1d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0x406e2d){logger['info'](util[_0xde14('0x2b')](_0xde14('0x1c8'),_0x406e2d['label']));if(!this[_0xde14('0x89')](_0x406e2d[_0xde14('0x160')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x406e2d,_0xde14('0x15f'));}logger[_0xde14('0x30')](util[_0xde14('0x2b')](_0xde14('0x16e'),this[_0xde14('0xe')]['callerid'],_0x406e2d[_0xde14('0x160')]));var _0x310399=this[_0xde14('0x55')]['sync'](this,_0x406e2d[_0xde14('0x160')]);if(_0x310399){logger[_0xde14('0x30')](util['format'](_0xde14('0x161'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));this[_0xde14('0xe')][_0xde14('0xab')](util[_0xde14('0x2b')](_0xde14('0x161'),this['channel']['callerid'],_0x406e2d[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x162')};}else{logger['info'](util['format'](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));this[_0xde14('0xe')]['noop'](util['format'](_0xde14('0x163'),this[_0xde14('0xe')][_0xde14('0x3e')],_0x406e2d[_0xde14('0x160')]));return{'code':0xc8,'result':_0xde14('0x164')};}};AGIVertices['prototype'][_0xde14('0x1c9')]=function(_0x21758d){logger[_0xde14('0x30')](util['format'](_0xde14('0x1ca'),_0x21758d[_0xde14('0x3b')]));var _0x4a1953=this['channel'][_0xde14('0xad')](_0xde14('0x1cb'),[_0x21758d['mailbox'],_0x21758d[_0xde14('0x7c')]]);if(_0x4a1953[_0xde14('0xa7')]===-0x1){return _0x4a1953;}return this[_0xde14('0xe')]['noop'](util[_0xde14('0x2b')](_0xde14('0xc6'),_0xde14('0x1cb'),_0x21758d[_0xde14('0x1cc')]));};AGIVertices[_0xde14('0x16')][_0xde14('0x1cd')]=function(_0x2ab908){logger[_0xde14('0x30')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2ab908[_0xde14('0x3b')]));if(!this[_0xde14('0x89')](_0x2ab908[_0xde14('0xda')])){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2ab908,_0xde14('0x1ce'));}var _0x1ba06c=this[_0xde14('0x11')][_0xde14('0x73')](this,_0x2ab908['variable_id']);if(!_0x1ba06c){return this[_0xde14('0xe')][_0xde14('0x2e')](_0x2ab908,'no\x20variable\x20found');}var _0x4d2709=this[_0xde14('0xe')][_0xde14('0x11')](_0x1ba06c);return{'code':0xc8,'result':_0x4d2709[_0xde14('0xa5')]?_0x4d2709[_0xde14('0xa5')]:'-'};};String[_0xde14('0x16')]['replaceAll']=function(_0x3db640,_0x1cfd3c){return this[_0xde14('0xa3')](_0x3db640)['join'](_0x1cfd3c);};module[_0xde14('0x1cf')]=AGIVertices; \ No newline at end of file +var _0x9009=['Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','arg_1','callerid','createSquareRecording','calleridname','accountcode','file','createSquareMessage','createCmContact','random','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','result','Executed\x20command\x20MRCPSynth\x20%s','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','SIP/%s/%s','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','wav','%s/recordings/%s','NOBEEP','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','output','getPause','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','getSmsAccount','sms_text','debug','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s'];(function(_0x38490f,_0x18ebfe){var _0x2951f8=function(_0x129284){while(--_0x129284){_0x38490f['push'](_0x38490f['shift']());}};_0x2951f8(++_0x18ebfe);}(_0x9009,0x1d4));var _0x9900=function(_0x4758ba,_0x3e47b9){_0x4758ba=_0x4758ba-0x0;var _0xaaed38=_0x9009[_0x4758ba];return _0xaaed38;};'use strict';var fs=require('fs');var util=require(_0x9900('0x0'));var _=require('lodash');var sh=require(_0x9900('0x1'));var odbc=require(_0x9900('0x2'))();var rs=require('randomstring');var moment=require(_0x9900('0x3'));var Mustache=require(_0x9900('0x4'));var rp=require(_0x9900('0x5'));var logger=require(_0x9900('0x6'))('agi');var config=require(_0x9900('0x7'));var scripts=require(_0x9900('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x9900('0x9')];var verticesWithRetry=[_0x9900('0xa'),'getdigits',_0x9900('0xb')];var AGIVertices=function(_0x1f9558,_0x430661,_0x19bbc6){this['channel']=_0x1f9558;this[_0x9900('0xc')]=_0x430661;this[_0x9900('0xd')]=_0x19bbc6;};AGIVertices[_0x9900('0xe')][_0x9900('0xf')]=function(_0x1e4739,_0x590d75){this['rpc'][_0x9900('0x10')](_0x1e4739)[_0x9900('0x11')](function(_0x537c6f){_0x590d75(null,_0x537c6f?_0x537c6f['name']:![]);})[_0x9900('0x12')](function(_0x4e8312){_0x590d75(_0x4e8312);});};AGIVertices[_0x9900('0xe')][_0x9900('0x13')]=function(_0x1ff535,_0x2874fe){this[_0x9900('0xc')][_0x9900('0x14')](_0x1ff535)[_0x9900('0x11')](function(_0x7cab33){_0x2874fe(null,_0x7cab33?_0x7cab33[_0x9900('0x15')]:![]);})[_0x9900('0x12')](function(_0x375ee0){_0x2874fe(_0x375ee0);});};AGIVertices[_0x9900('0xe')][_0x9900('0x16')]=function(_0x3517b0,_0x356284){this[_0x9900('0xc')][_0x9900('0x17')](_0x3517b0)['then'](function(_0x51839f){_0x356284(null,_0x51839f?_0x51839f[_0x9900('0x15')]:![]);})[_0x9900('0x12')](function(_0x1bd7a3){_0x356284(_0x1bd7a3);});};AGIVertices[_0x9900('0xe')]['getSquareOdbc']=function(_0xe32f78,_0x57ae85){this['rpc'][_0x9900('0x18')](_0xe32f78)['then'](function(_0x312ebf){_0x57ae85(null,_0x312ebf?_0x312ebf['dsn']:![]);})['catch'](function(_0xd3c235){_0x57ae85(_0xd3c235);});};AGIVertices[_0x9900('0xe')][_0x9900('0x19')]=function(_0x276bce,_0x5ee4ad){this[_0x9900('0xc')][_0x9900('0x1a')](_0x276bce)[_0x9900('0x11')](function(_0x888599){_0x5ee4ad(null,_0x888599?_0x888599[_0x9900('0x15')]:![]);})['catch'](function(_0x37842b){_0x5ee4ad(_0x37842b);});};AGIVertices[_0x9900('0xe')]['getTrunk']=function(_0x3bfb16,_0x337b6a){this['rpc']['getTrunkById'](_0x3bfb16)[_0x9900('0x11')](function(_0x2ac147){_0x337b6a(null,_0x2ac147?_0x2ac147['name']:![]);})[_0x9900('0x12')](function(_0x4507a9){_0x337b6a(_0x4507a9);});};AGIVertices['prototype'][_0x9900('0x1b')]=function(_0x3b58ed,_0x23b696){var _0x13bad6=this;this[_0x9900('0xc')]['getSoundById'](_0x3b58ed)[_0x9900('0x11')](function(_0x44d775){_0x23b696(null,_0x44d775?_0x13bad6[_0x9900('0x1c')](_0x44d775[_0x9900('0x1d')]):![]);})[_0x9900('0x12')](function(_0x50f16a){_0x23b696(_0x50f16a);});};AGIVertices['prototype']['getMailAccount']=function(_0x39ac26,_0x3e9a9a){this['rpc'][_0x9900('0x1e')](_0x39ac26)[_0x9900('0x11')](function(_0x1b2aa0){_0x3e9a9a(null,_0x1b2aa0?_0x1b2aa0:![]);})['catch'](function(_0x4aa0f8){_0x3e9a9a(_0x4aa0f8);});};AGIVertices[_0x9900('0xe')][_0x9900('0x1f')]=function(_0xd2ae52,_0x3d7b26,_0x4a4a02){this['mailRpc'][_0x9900('0x1f')](_0xd2ae52,_0x3d7b26)[_0x9900('0x11')](function(){_0x4a4a02(null);})[_0x9900('0x12')](function(_0x278755){_0x4a4a02(_0x278755);});};AGIVertices[_0x9900('0xe')][_0x9900('0x20')]=function(_0x55edca,_0x36b258){this[_0x9900('0xc')][_0x9900('0x21')](_0x55edca)[_0x9900('0x11')](function(_0x29130c){if(_0x29130c){if(_0x29130c[_0x9900('0x22')]){_0x36b258(null,[_0x29130c['interval']]);}else{_0x36b258(null,_['map'](_0x29130c[_0x9900('0x23')],'interval'));}}else{_0x36b258(null,![]);}})[_0x9900('0x12')](function(_0x528bcc){_0x36b258(_0x528bcc);});};AGIVertices[_0x9900('0xe')][_0x9900('0x1c')]=function(_0x8afded){return util[_0x9900('0x24')](_0x9900('0x25'),FILES_PATH,_0x8afded);};AGIVertices[_0x9900('0xe')][_0x9900('0x26')]=function(_0x581e0b,_0x5bfb20,_0x51fadf){odbc[_0x9900('0x27')](_0x581e0b,function(_0xea402c){if(_0xea402c){logger['error'](_0x9900('0x28'),_0xea402c);_0x51fadf(_0xea402c);}else{logger[_0x9900('0x29')](_0x9900('0x2a'));odbc['query'](_0x5bfb20,function(_0x3c658d,_0x34c663){if(_0x3c658d){logger[_0x9900('0x29')](_0x9900('0x2b'),_0x5bfb20);_0x51fadf(_0x3c658d);}else{logger[_0x9900('0x29')](_0x9900('0x2c'),_0x5bfb20);odbc['close'](function(_0x33083b){if(_0x33083b){logger[_0x9900('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x33083b);}_0x51fadf(null,_0x34c663);});}});}});};AGIVertices[_0x9900('0xe')]['getSmsAccount']=function(_0x2cee90,_0xeb066e){this['rpc'][_0x9900('0x2e')](_0x2cee90)[_0x9900('0x11')](function(_0x2595cc){_0xeb066e(null,_0x2595cc?_0x2595cc:![]);})[_0x9900('0x12')](function(_0x3293ac){_0xeb066e(_0x3293ac);});};AGIVertices['prototype']['createSmsMessage']=function(_0x3b2e6e,_0x4d4130){this['rpc']['createSmsMessage'](_0x3b2e6e)['then'](function(_0x491baf){_0x4d4130(null,_0x491baf);})[_0x9900('0x12')](function(_0xadf82c){_0x4d4130(_0xadf82c);});};AGIVertices[_0x9900('0xe')][_0x9900('0x2f')]=function(_0x31c003,_0xb94a40,_0x3c1496){this[_0x9900('0xc')]['createSquareDetailsReport']({'uniqueid':this[_0x9900('0x30')][_0x9900('0x31')],'node':_0x31c003['label'],'application':_0x31c003['agicommand'],'data':_0xb94a40||null,'project_name':this[_0x9900('0x30')][_0x9900('0x32')],'callerid':this[_0x9900('0x30')][_0x9900('0x33')]})[_0x9900('0x11')](function(_0x2d375f){if(_0x3c1496){_0x3c1496(null,_0x2d375f);}})[_0x9900('0x12')](function(_0x45c40c){if(_0x3c1496){_0x3c1496(_0x45c40c);}});};AGIVertices['prototype'][_0x9900('0x34')]=function(_0x2180f1,_0x59e42d,_0x336485,_0x45ec31){this[_0x9900('0xc')][_0x9900('0x34')]({'uniqueid':this['channel'][_0x9900('0x31')],'callerid':this[_0x9900('0x30')]['callerid'],'calleridname':this[_0x9900('0x30')][_0x9900('0x35')],'context':this[_0x9900('0x30')]['context'],'extension':this[_0x9900('0x30')]['extension'],'priority':this[_0x9900('0x30')]['priority'],'accountcode':this[_0x9900('0x30')][_0x9900('0x36')],'dnid':this[_0x9900('0x30')]['dnid'],'projectName':this[_0x9900('0x30')]['arg_1'],'saveName':_0x59e42d,'filename':_0x2180f1[_0x9900('0x37')]||_0x59e42d,'savePath':_0x336485})[_0x9900('0x11')](function(_0x5ac239){_0x45ec31(null,_0x5ac239);})[_0x9900('0x12')](function(_0x20067e){_0x45ec31(_0x20067e);});};AGIVertices['prototype'][_0x9900('0x38')]=function(_0x29a185,_0x443265,_0x454f06,_0x3d26e3,_0x57f59a){this['rpc'][_0x9900('0x38')]({'uniqueid':this[_0x9900('0x30')][_0x9900('0x31')],'body':_0x29a185,'direction':_0x443265,'providerName':_0x454f06,'providerResponse':_0x3d26e3})[_0x9900('0x11')](function(_0x1c5297){if(_0x57f59a){_0x57f59a(null,_0x1c5297);}})['catch'](function(_0x4071af){if(_0x57f59a){_0x57f59a(_0x4071af);}});};AGIVertices[_0x9900('0xe')][_0x9900('0x39')]=function(_0x1c3b4d,_0x2f7f74){this[_0x9900('0xc')][_0x9900('0x39')]({'firstName':_['isEmpty'](_0x1c3b4d[_0x9900('0x15')])||_['isNil'](_0x1c3b4d['name'])?'callback_'+Math[_0x9900('0x3a')]():_0x1c3b4d['name'],'lastName':_[_0x9900('0x3b')](_0x1c3b4d[_0x9900('0x3c')])||_[_0x9900('0x3d')](_0x1c3b4d['lastName'])?null:_0x1c3b4d['lastName'],'phone':_0x1c3b4d[_0x9900('0x3e')],'ListId':_0x1c3b4d[_0x9900('0x3f')],'scheduledat':_0x1c3b4d[_0x9900('0x40')],'callbackUniqueid':this[_0x9900('0x30')][_0x9900('0x31')],'tags':_0x9900('0x41'),'description':_0x9900('0x42')+_0x1c3b4d[_0x9900('0x40')][_0x9900('0x43')](),'priority':_0x1c3b4d[_0x9900('0x44')]})[_0x9900('0x11')](function(_0x30c3b8){_0x2f7f74(null,_0x30c3b8);})[_0x9900('0x12')](function(_0x5a97fe){_0x2f7f74(_0x5a97fe);});};AGIVertices[_0x9900('0xe')]['getPause']=function(_0xc5adc6,_0x1c7cf4){this[_0x9900('0xc')]['getPauseById'](_0xc5adc6)[_0x9900('0x11')](function(_0x3ba5c1){_0x1c7cf4(null,_0x3ba5c1?_0x3ba5c1[_0x9900('0x15')]:![]);})[_0x9900('0x12')](function(_0x1e7fe2){_0x1c7cf4(_0x1e7fe2);});};AGIVertices[_0x9900('0xe')][_0x9900('0x45')]=function(_0x2b5bbf,_0x2f1f47,_0x286a65){var _0x50d4c9={'role':_0x9900('0x46')};_0x50d4c9[_0x2b5bbf]=this['channel'][_0x9900('0x33')];this[_0x9900('0xc')][_0x9900('0x45')](_0x50d4c9,_0x2f1f47,this[_0x9900('0x30')][_0x9900('0x31')])['then'](function(_0x3c8513){_0x286a65(null,_['isNil'](_0x3c8513)?![]:!![]);})[_0x9900('0x12')](function(_0x3c8597){logger[_0x9900('0x2d')](_0x3c8597);_0x286a65(null,![]);});};AGIVertices[_0x9900('0xe')][_0x9900('0x47')]=function(_0x59f886,_0x25ddb7){var _0x2a4fae={'role':_0x9900('0x46')};_0x2a4fae[_0x59f886]=this['channel'][_0x9900('0x33')];this[_0x9900('0xc')][_0x9900('0x47')](_0x2a4fae)[_0x9900('0x11')](function(_0x4271d3){_0x25ddb7(null,_[_0x9900('0x3d')](_0x4271d3)?![]:!![]);})[_0x9900('0x12')](function(_0x274c32){logger[_0x9900('0x2d')](_0x274c32);_0x25ddb7(null,![]);});};AGIVertices['prototype'][_0x9900('0x48')]=function(_0x5300ff,_0x398b9f){var _0xd752c3={'role':_0x9900('0x46')};_0xd752c3[_0x5300ff]=this[_0x9900('0x30')]['callerid'];this['rpc'][_0x9900('0x48')](_0xd752c3)['then'](function(_0x259629){_0x398b9f(null,_['isNil'](_0x259629)?![]:!![]);})[_0x9900('0x12')](function(_0x89f14a){logger[_0x9900('0x2d')](_0x89f14a);_0x398b9f(null,![]);});};AGIVertices[_0x9900('0xe')]['agentLogin']=function(_0x2169ca,_0x68f23a){var _0x4e98a7={'role':_0x9900('0x46')};_0x4e98a7[_0x2169ca]=this['channel'][_0x9900('0x33')];var _0x51f491=_0x2169ca!=_0x9900('0x49')?util['format'](_0x9900('0x4a'),_0x9900('0x4b'),this[_0x9900('0x30')]['callerid']):undefined;this[_0x9900('0xc')][_0x9900('0x4c')](_0x4e98a7,_0x51f491)[_0x9900('0x11')](function(_0x1b1b0f){_0x68f23a(null,_[_0x9900('0x3d')](_0x1b1b0f)?![]:!![]);})[_0x9900('0x12')](function(_0x182e98){logger[_0x9900('0x2d')](_0x182e98);_0x68f23a(null,![]);});};AGIVertices[_0x9900('0xe')][_0x9900('0x4d')]=function(_0x223f80,_0x3cc3ea){sh['exec'](_[_0x9900('0x4e')](_0x223f80),function(_0x1293e6,_0x444eb4){var _0x173f22=_0x444eb4[_0x9900('0x4f')](/(\r\n|\n|\r)/gm,'');_0x3cc3ea(null,_0x173f22);});};AGIVertices[_0x9900('0xe')][_0x9900('0x50')]=function(_0x503629,_0xc4515c){scripts['googleCloudTTS'](_0x503629[_0x9900('0x51')],_0x503629[_0x9900('0x52')]||_0x9900('0x53'),_0x503629['text'],_0x503629[_0x9900('0x54')]||_0x9900('0x55'),_0x503629[_0x9900('0x56')]||_0x9900('0x57'),_0x503629[_0x9900('0x58')]||_0x9900('0x59'))[_0x9900('0x11')](function(_0x1cc8ce){_0xc4515c(null,_0x1cc8ce);})[_0x9900('0x12')](function(_0x34c14a){_0xc4515c(_0x34c14a);});};AGIVertices[_0x9900('0xe')][_0x9900('0x5a')]=function(_0x3a4c4f,_0x30ab12){scripts[_0x9900('0x5a')](_0x3a4c4f[_0x9900('0x53')],_0x3a4c4f[_0x9900('0x5b')]||'en',0x1)[_0x9900('0x11')](function(_0x330e53){_0x30ab12(null,_0x330e53);})[_0x9900('0x12')](function(_0x562f73){_0x30ab12(_0x562f73);});};AGIVertices['prototype'][_0x9900('0x5c')]=function(_0xb3994c,_0x346b79){var _0x141c28={'uri':_0xb3994c['url'],'method':_0xb3994c[_0x9900('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xb3994c['timeout'])==='number'&&parseInt(_0xb3994c[_0x9900('0x5e')])>=0x1?parseInt(_0xb3994c['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9900('0x5f'),'PUT'],_0x141c28[_0x9900('0x5d')]['toUpperCase']())){try{_0x141c28[_0x9900('0x60')]=_0xb3994c[_0x9900('0x9')]?JSON[_0x9900('0x61')](_0xb3994c[_0x9900('0x9')]):{};}catch(_0x23ed57){logger['error'](_0x9900('0x62'),_0x23ed57);}}try{_0x141c28[_0x9900('0x63')]=_0xb3994c[_0x9900('0x64')]?JSON[_0x9900('0x61')](_0xb3994c[_0x9900('0x64')]):{};}catch(_0x513d9a){logger[_0x9900('0x2d')](_0x9900('0x65'),_0x513d9a);}if(_0xb3994c[_0x9900('0x66')]){try{var _0x385163=require(_0xb3994c[_0x9900('0x66')])['sync'](this,_0x141c28);_0x141c28['uri']=Mustache[_0x9900('0x67')](_0xb3994c['url'],_0x385163,{},['$$','$$']);if(_0x141c28[_0x9900('0x63')]){_0x141c28['headers']=JSON[_0x9900('0x61')](Mustache['render'](JSON[_0x9900('0x68')](_0x141c28['headers']),_0x385163,{},['$$','$$']));}if(_0x141c28[_0x9900('0x60')]){_0x141c28['body']=JSON[_0x9900('0x61')](Mustache['render'](JSON['stringify'](_0x141c28['body']),_0x385163,{},['$$','$$']));}}catch(_0x54e40c){logger[_0x9900('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x54e40c);}}rp(_0x141c28)[_0x9900('0x11')](function(_0x1dfa7f){var _0x469c1d={'statusCode':_0x1dfa7f[_0x9900('0x69')]||0xc8,'statusMessage':_0x1dfa7f[_0x9900('0x6a')]||'OK','headers':_0x1dfa7f[_0x9900('0x63')]||{},'body':_0x1dfa7f[_0x9900('0x60')]||{}};_0x346b79(null,_0x469c1d);})[_0x9900('0x12')](function(_0x4268b8){var _0x313088={'statusCode':_0x4268b8[_0x9900('0x69')]||0x1f4,'statusMessage':_0x4268b8[_0x9900('0x6b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4268b8[_0x9900('0x6c')][_0x9900('0x63')]||{},'body':_0x4268b8[_0x9900('0x6c')][_0x9900('0x60')]||{}};_0x346b79(null,_0x313088);});};AGIVertices[_0x9900('0xe')][_0x9900('0x6d')]=function(_0x4f2d6e,_0x48ec4c){scripts[_0x9900('0x6d')](this[_0x9900('0x30')][_0x9900('0x31')],_0x4f2d6e[_0x9900('0x6e')],_0x4f2d6e['text'],_0x4f2d6e[_0x9900('0x6f')]||'en')[_0x9900('0x11')](function(_0x39dae3){_0x48ec4c(null,_0x39dae3);})[_0x9900('0x12')](function(_0x3155f5){_0x48ec4c(_0x3155f5);});};AGIVertices['prototype'][_0x9900('0x70')]=function(_0x41fa83,_0x266d66){scripts[_0x9900('0x70')](this[_0x9900('0x30')][_0x9900('0x31')],_0x41fa83[_0x9900('0x71')],_0x41fa83[_0x9900('0x72')],_0x41fa83[_0x9900('0x73')],_0x41fa83[_0x9900('0x53')],_0x41fa83[_0x9900('0x74')]||'en')[_0x9900('0x11')](function(_0x2d27a3){_0x266d66(null,_0x2d27a3);})[_0x9900('0x12')](function(_0x4da60c){_0x266d66(_0x4da60c);});};AGIVertices[_0x9900('0xe')][_0x9900('0x75')]=function(_0x3220c4,_0x3b7b67){scripts[_0x9900('0x75')](this['channel'],_0x3220c4)[_0x9900('0x11')](function(_0x5f50f8){_0x3b7b67(null,_0x5f50f8);})[_0x9900('0x12')](function(_0x5a96eb){_0x3b7b67(_0x5a96eb);});};AGIVertices[_0x9900('0xe')][_0x9900('0x76')]=function(_0x2576bb,_0x283881){scripts['ispeechTTS'](_0x2576bb['key'],_0x2576bb[_0x9900('0x53')],_0x2576bb[_0x9900('0x77')]||_0x9900('0x55'),_0x2576bb[_0x9900('0x78')])[_0x9900('0x11')](function(_0x270c6a){_0x283881(null,_0x270c6a);})[_0x9900('0x12')](function(_0x2b1379){_0x283881(_0x2b1379);});};AGIVertices[_0x9900('0xe')][_0x9900('0x79')]=function(_0x4d9768,_0x598cad,_0x230885){scripts[_0x9900('0x79')](_0x598cad,_0x4d9768['key'],_0x4d9768[_0x9900('0x7a')]||_0x9900('0x55'),this[_0x9900('0x7b')](_0x4d9768[_0x9900('0x7c')])?_0x4d9768[_0x9900('0x7c')]:undefined)['then'](function(_0x24d6d6){_0x230885(null,_0x24d6d6);})['catch'](function(_0x3d2522){_0x230885(_0x3d2522);});};AGIVertices[_0x9900('0xe')][_0x9900('0x7d')]=function(_0x2dcc45,_0x14efdd){scripts[_0x9900('0x7d')](_0x2dcc45[_0x9900('0x7e')],_0x2dcc45['aws_secret_access_key'],_0x2dcc45[_0x9900('0x7f')],_0x2dcc45['aws_polly_voice']||_0x9900('0x80'),_0x2dcc45[_0x9900('0x53')],_0x2dcc45[_0x9900('0x81')]||_0x9900('0x53'))[_0x9900('0x11')](function(_0x41d8ed){_0x14efdd(null,_0x41d8ed);})[_0x9900('0x12')](function(_0x48008c){_0x14efdd(_0x48008c);});};AGIVertices[_0x9900('0xe')][_0x9900('0x82')]=function(_0x2ba70f,_0x1398c0){scripts[_0x9900('0x82')](this[_0x9900('0x30')]['uniqueid'],_0x2ba70f[_0x9900('0x7e')],_0x2ba70f['aws_secret_access_key'],_0x2ba70f['aws_lex_region'],_0x2ba70f[_0x9900('0x53')],_0x2ba70f[_0x9900('0x83')])[_0x9900('0x11')](function(_0x216252){_0x1398c0(null,_0x216252);})['catch'](function(_0x36cd5a){_0x1398c0(_0x36cd5a);});};AGIVertices[_0x9900('0xe')][_0x9900('0x84')]=function(_0x46e791,_0x3dd208,_0x46ec0c){scripts[_0x9900('0x84')](_0x3dd208,_0x46e791[_0x9900('0x6e')],_0x46e791[_0x9900('0x85')]||'en-US')[_0x9900('0x11')](function(_0xda6dcb){_0x46ec0c(null,_0xda6dcb);})[_0x9900('0x12')](function(_0x2d197e){_0x46ec0c(_0x2d197e);});};AGIVertices[_0x9900('0xe')][_0x9900('0x86')]=function(_0x1460d5,_0xca443e,_0x444aa3){scripts[_0x9900('0x86')](_0xca443e,_0x1460d5[_0x9900('0x87')],_0x1460d5[_0x9900('0x88')],_0x1460d5[_0x9900('0x89')])[_0x9900('0x11')](function(_0x1ca995){_0x444aa3(null,_0x1ca995);})[_0x9900('0x12')](function(_0x1ba44c){_0x444aa3(_0x1ba44c);});};AGIVertices[_0x9900('0xe')]['clear']=function(_0x492b76){var _0x36614b=_[_0x9900('0x8a')](verticesWithRetry,_0x492b76[_0x9900('0x8b')])?_0x492b76:_[_0x9900('0x8c')](_0x492b76);for(var _0x1e96e9 in _0x36614b){if(_0x36614b[_0x9900('0x8d')](_0x1e96e9)){if(_0x36614b[_0x1e96e9]&&_[_0x9900('0x8e')](_0x36614b[_0x1e96e9])){if(_[_0x9900('0x8a')](recursiveMapAttributes,_0x1e96e9)){_0x36614b[_0x1e96e9]=this[_0x9900('0x8f')](_0x36614b[_0x1e96e9]);}else{_0x36614b[_0x1e96e9]=this[_0x9900('0x90')](_0x36614b[_0x1e96e9]);}}}}return _0x36614b;};AGIVertices[_0x9900('0xe')][_0x9900('0x91')]=function(_0x4f6b70){for(var _0x3db63f in _0x4f6b70){if(_0x4f6b70[_0x9900('0x8d')](_0x3db63f)){if(_[_0x9900('0x92')](_0x4f6b70[_0x3db63f])){this[_0x9900('0x91')](_0x4f6b70[_0x3db63f]);}else if(_[_0x9900('0x93')](_0x4f6b70[_0x3db63f])){for(var _0x2ded93=0x0;_0x2ded93<_0x4f6b70[_0x3db63f][_0x9900('0x94')];_0x2ded93++){this[_0x9900('0x91')](_0x4f6b70[_0x3db63f][_0x2ded93]);}}else if(_[_0x9900('0x8e')](_0x4f6b70[_0x3db63f])){_0x4f6b70[_0x3db63f]=this[_0x9900('0x90')](_0x4f6b70[_0x3db63f]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x499232,_0x2e6ab9){for(var _0x13c078 in _0x499232){if(_0x499232[_0x9900('0x8d')](_0x13c078)){if(_['isPlainObject'](_0x499232[_0x13c078])){if(!_[_0x9900('0x3b')](_0x499232[_0x13c078])){this[_0x9900('0x95')](_0x499232[_0x13c078],util[_0x9900('0x24')](_0x9900('0x96'),_0x2e6ab9,_0x13c078));}}else if(_['isArray'](_0x499232[_0x13c078])){for(var _0x21e47a=0x0;_0x21e47a<_0x499232[_0x13c078][_0x9900('0x94')];_0x21e47a++){this[_0x9900('0x95')](_0x499232[_0x13c078][_0x21e47a],util[_0x9900('0x24')](_0x9900('0x96'),_0x2e6ab9,_0x13c078+'['+_0x21e47a+']'));}}else{if(!_['isNil'](_0x499232[_0x13c078])){this[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')]('%s.%s',_0x2e6ab9,_0x13c078),_0x499232[_0x13c078]);}}}}};AGIVertices['prototype'][_0x9900('0x8f')]=function(_0x482556){try{var _0x3bf43c=JSON[_0x9900('0x61')](_0x482556);this[_0x9900('0x91')](_0x3bf43c);return JSON[_0x9900('0x68')](_0x3bf43c);}catch(_0x3303f3){return this[_0x9900('0x90')](_0x482556);}};AGIVertices['prototype'][_0x9900('0x90')]=function(_0x4d63e1){var _0x3c11be=_0x4d63e1[_0x9900('0x98')]('{');for(var _0x371011=0x1;_0x371011<_0x3c11be[_0x9900('0x94')];_0x371011+=0x1){var _0x33a666=_0x3c11be[_0x371011][_0x9900('0x98')]('}');if(_0x33a666[_0x9900('0x94')]>0x1){_0x4d63e1=_0x4d63e1[_0x9900('0x99')]('{'+_0x33a666[0x0]+'}',this[_0x9900('0x30')][_0x9900('0xf')](_0x33a666[0x0])[_0x9900('0x9a')]||_0x33a666[0x0]);}}if(_0x3c11be[_0x9900('0x94')]===0x1){return _0x4d63e1[_0x9900('0x43')]();}return this[_0x9900('0x90')](_0x4d63e1);};AGIVertices[_0x9900('0xe')][_0x9900('0x9b')]=function(_0x1f18c8,_0x455bae){var _0x466bd5=this[_0x9900('0x30')][_0x9900('0xf')](_0x1f18c8);if(_0x466bd5['result']===-0x1){return _0x466bd5;}logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x9c'),_0x455bae,_0x466bd5[_0x9900('0x9a')]));return this[_0x9900('0x30')][_0x9900('0x97')](_0x455bae,_0x466bd5['extra']);};AGIVertices[_0x9900('0xe')][_0x9900('0x7b')]=function(_0x76e3ba){return _0x76e3ba&&_0x76e3ba!=='0'&&_0x76e3ba!=='-1'&&_0x76e3ba!=='';};AGIVertices[_0x9900('0xe')]['maxRetry']=function(_0x2a85de){this['createSquareDetailsReport'][_0x9900('0x9d')](this,_0x2a85de,'-');_0x2a85de[_0x9900('0x9e')]=_0x2a85de[_0x9900('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9900('0xe')][_0x9900('0xa0')]=function(_0x4ac96d){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0xa1'),_0x4ac96d[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x4ac96d[_0x9900('0x53')])){return this['channel'][_0x9900('0xa3')](_0x9900('0xa4'));}var _0x434713='\x22'+_0x4ac96d['text']+'\x22';if(this[_0x9900('0x7b')](_0x4ac96d[_0x9900('0x6c')])){_0x434713+=','+_0x4ac96d[_0x9900('0x6c')];}var _0x2447e0=this['channel'][_0x9900('0xa5')]('MRCPSynth',_0x434713);if(_0x2447e0[_0x9900('0xa6')]===-0x1){return _0x2447e0;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xa7'),_0x434713));};AGIVertices[_0x9900('0xe')]['mrcprecog']=function(_0x4eb3d9){logger[_0x9900('0x29')](util[_0x9900('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4eb3d9[_0x9900('0xa2')]));if(!this['isConfigured'](_0x4eb3d9['grammar'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa8'));}var _0xfcf977=_0x4eb3d9[_0x9900('0xa9')];if(this[_0x9900('0x7b')](_0x4eb3d9[_0x9900('0x6c')])){_0xfcf977+=','+_0x4eb3d9[_0x9900('0x6c')];}var _0xd35726=this[_0x9900('0x30')][_0x9900('0xa5')](_0x9900('0xaa'),_0xfcf977);if(_0xd35726[_0x9900('0xa6')]===-0x1){return _0xd35726;}var _0x55879b=this[_0x9900('0x9b')](_0x9900('0xab'),'MRCP_RECOG_CONFIDENCE');if(_0x55879b['result']===-0x1){return _0x55879b;}var _0x2b3366=this[_0x9900('0x9b')](_0x9900('0xac'),_0x9900('0xad'));if(_0x2b3366['result']===-0x1){return _0x2b3366;}var _0x299484=this[_0x9900('0x9b')](_0x9900('0xae'),_0x9900('0xaf'));if(_0x299484[_0x9900('0xa6')]===-0x1){return _0x299484;}return this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0xfcf977));};AGIVertices[_0x9900('0xe')][_0x9900('0xb0')]=function(_0x2f26e1){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0xb1'),_0x2f26e1[_0x9900('0xa2')]));return this[_0x9900('0x30')][_0x9900('0xb0')]([_0x2f26e1['command'],_0x2f26e1[_0x9900('0xb2')]]);};AGIVertices[_0x9900('0xe')][_0x9900('0xb3')]=function(_0xcec90a){logger[_0x9900('0x29')](util['format'](_0x9900('0xb4'),_0xcec90a[_0x9900('0xa2')]));if(this[_0x9900('0x7b')](_0xcec90a['timeout'])){logger[_0x9900('0x29')](util[_0x9900('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xcec90a[_0x9900('0x5e')]));var _0x5a731a=this['channel'][_0x9900('0xb5')](_0xcec90a[_0x9900('0x5e')]);if(_0x5a731a['result']===-0x1){return _0x5a731a;}}return this['channel'][_0x9900('0xb3')]();};AGIVertices['prototype'][_0x9900('0x41')]=function(_0x16b8a3){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0xb6'),_0x16b8a3[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x16b8a3[_0x9900('0x3f')])){return this['channel'][_0x9900('0x2d')](_0x16b8a3,_0x9900('0xb7'));}_0x16b8a3[_0x9900('0x40')]=moment();if(this[_0x9900('0x7b')](_0x16b8a3[_0x9900('0xb8')])){_0x16b8a3[_0x9900('0x40')]=moment()[_0x9900('0xb9')](_0x16b8a3[_0x9900('0xb8')],_0x9900('0xba'));}if(!this['isConfigured'](_0x16b8a3[_0x9900('0x44')])){_0x16b8a3[_0x9900('0x44')]=0x2;}this[_0x9900('0x39')][_0x9900('0x9d')](this,_0x16b8a3);return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xbb'),_0x16b8a3[_0x9900('0x3e')],_0x16b8a3[_0x9900('0x3f')],_0x16b8a3[_0x9900('0x40')]));};AGIVertices['prototype']['custom_app']=function(_0x4a6a54){logger['info'](util[_0x9900('0x24')](_0x9900('0xbc'),_0x4a6a54['label']));var _0x2488f0=this[_0x9900('0x30')][_0x9900('0xa5')](_0x4a6a54[_0x9900('0xbd')],_0x4a6a54[_0x9900('0x6c')]);if(_0x2488f0[_0x9900('0xa6')]===-0x1){return _0x2488f0;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xbe'),_0x4a6a54[_0x9900('0xbd')],_0x4a6a54['options']));};AGIVertices['prototype'][_0x9900('0xbf')]=function(_0x47296a){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0xc0'),_0x47296a['label']));if(!this[_0x9900('0x7b')](_0x47296a[_0x9900('0x53')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x390a2b='\x22'+_0x47296a[_0x9900('0x53')]+'\x22';if(this[_0x9900('0x7b')](_0x47296a[_0x9900('0x6c')])){_0x390a2b+=','+_0x47296a[_0x9900('0x6c')];}var _0x5a3334=this['channel'][_0x9900('0xa5')](_0x9900('0xc1'),_0x390a2b);if(_0x5a3334[_0x9900('0xa6')]===-0x1){return _0x5a3334;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xa7'),_0x390a2b));};AGIVertices[_0x9900('0xe')][_0x9900('0xc2')]=function(_0xf217b6){logger[_0x9900('0x29')](util['format'](_0x9900('0xc3'),_0xf217b6[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0xf217b6['text'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}var _0xa33426='\x22'+_0xf217b6[_0x9900('0x53')]+'\x22';if(this[_0x9900('0x7b')](_0xf217b6[_0x9900('0x6c')])){_0xa33426+=','+_0xf217b6[_0x9900('0x6c')];}var _0x62aca0=this['channel']['exec']('MRCPSynth',_0xa33426);if(_0x62aca0[_0x9900('0xa6')]===-0x1){return _0x62aca0;}return this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xa7'),_0xa33426));};AGIVertices['prototype'][_0x9900('0xc4')]=function(_0x430e7c){logger['info'](util[_0x9900('0x24')](_0x9900('0xc5'),_0x430e7c[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x430e7c[_0x9900('0xa9')])){return this[_0x9900('0x30')][_0x9900('0xa3')]('no\x20grammar\x20configured');}var _0x423323=_0x430e7c['grammar'];if(this['isConfigured'](_0x430e7c[_0x9900('0x6c')])){_0x423323+=','+_0x430e7c['options'];}var _0x42242=this[_0x9900('0x30')]['exec'](_0x9900('0xaa'),_0x423323);if(_0x42242[_0x9900('0xa6')]===-0x1){return _0x42242;}var _0x5779c4=this[_0x9900('0x9b')](_0x9900('0xab'),_0x9900('0xc6'));if(_0x5779c4[_0x9900('0xa6')]===-0x1){return _0x5779c4;}var _0x45ca6a=this[_0x9900('0x9b')](_0x9900('0xac'),_0x9900('0xc7'));if(_0x45ca6a[_0x9900('0xa6')]===-0x1){return _0x45ca6a;}var _0x409bdd=this[_0x9900('0x9b')]('RECOG_INSTANCE()',_0x9900('0xc8'));if(_0x409bdd[_0x9900('0xa6')]===-0x1){return _0x409bdd;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x423323));};AGIVertices[_0x9900('0xe')][_0x9900('0xc9')]=function(_0x5ba2f7){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0xca'),_0x5ba2f7['label']));if(!this['isConfigured'](_0x5ba2f7[_0x9900('0xa9')])){return this[_0x9900('0x30')]['noop'](_0x9900('0xa8'));}var _0x569ea6=_0x5ba2f7[_0x9900('0xa9')];if(this[_0x9900('0x7b')](_0x5ba2f7[_0x9900('0x6c')])){_0x569ea6+=','+_0x5ba2f7['options'];}var _0x32a71a=this['channel']['exec'](_0x9900('0xaa'),_0x569ea6);if(_0x32a71a[_0x9900('0xa6')]===-0x1){return _0x32a71a;}var _0x5dd956=this[_0x9900('0x9b')](_0x9900('0xab'),'SESTEK_ASR_CONFIDENCE');if(_0x5dd956['result']===-0x1){return _0x5dd956;}var _0x21edab=this['getAndSetVariable'](_0x9900('0xac'),_0x9900('0xcb'));if(_0x21edab['result']===-0x1){return _0x21edab;}var _0x547dfb=this['getAndSetVariable'](_0x9900('0xae'),_0x9900('0xcc'));if(_0x547dfb[_0x9900('0xa6')]===-0x1){return _0x547dfb;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xcd'),_0x569ea6));};AGIVertices[_0x9900('0xe')][_0x9900('0xce')]=function(_0x526cb1){logger['info'](util[_0x9900('0x24')](_0x9900('0xcf'),_0x526cb1['label']));if(!this[_0x9900('0x7b')](_0x526cb1['odbc_id'])){return this[_0x9900('0x30')]['error'](_0x526cb1,_0x9900('0xd0'));}var _0x41c48a=this['getSquareOdbc'][_0x9900('0x9d')](this,_0x526cb1[_0x9900('0xd1')]);if(!_0x41c48a){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x526cb1,_0x9900('0xd2'));}if(!this[_0x9900('0x7b')](_0x526cb1[_0x9900('0xd3')])){return this['channel'][_0x9900('0x2d')](_0x526cb1,_0x9900('0xd4'));}var _0x1acfff=_0x526cb1[_0x9900('0xd3')][_0x9900('0x4f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xd5'),_0x1acfff));var _0x1091a9=this[_0x9900('0x26')][_0x9900('0x9d')](this,_0x41c48a,_0x1acfff);this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x526cb1,_0x1acfff);if(!this[_0x9900('0x7b')](_0x526cb1['variable_id'])){return this['channel'][_0x9900('0xa3')](_0x9900('0xd6'));}var _0x47dd59=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x526cb1[_0x9900('0xd7')]);if(!_0x47dd59){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x526cb1,'no\x20variable\x20found');}var _0x157aca=this;_0x1091a9['forEach'](function(_0x3f109e,_0x52ef26){Object[_0x9900('0xd8')](_0x3f109e)['forEach'](function(_0x1f69e4){_0x157aca[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')]('%s[%s][%s]',_0x47dd59,_0x52ef26,_0x1f69e4),_0x3f109e[_0x1f69e4]);});});this[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')](_0x9900('0xd9'),_0x47dd59),_0x1091a9['length']);return this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0xda'),_0x47dd59));};AGIVertices[_0x9900('0xe')][_0x9900('0xdb')]=function(_0x243498){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x243498[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x243498['sip_id'])){return this['channel'][_0x9900('0x2d')](_0x243498,_0x9900('0xdc'));}var _0x405c18=this[_0x9900('0x19')][_0x9900('0x9d')](this,_0x243498['sip_id']);if(!_0x405c18){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x243498,_0x9900('0xdd'));}var _0x288a80=this[_0x9900('0x30')]['exec'](_0x9900('0xde'),[util['format'](_0x9900('0xdf'),_0x405c18),_0x243498[_0x9900('0x5e')],_0x243498[_0x9900('0xe0')],_0x243498['url']]);if(_0x288a80[_0x9900('0xa6')]===-0x1){return _0x288a80;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xe1'),_0x9900('0xde')));};AGIVertices[_0x9900('0xe')]['dialogflow']=function(_0x199cee){logger[_0x9900('0x29')](util['format'](_0x9900('0xe2'),_0x199cee[_0x9900('0xa2')]));if(!this['isConfigured'](_0x199cee[_0x9900('0x6e')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xe3'));}if(!this[_0x9900('0x7b')](_0x199cee['text'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}this[_0x9900('0x30')]['bot']=!![];this[_0x9900('0x2f')](_0x199cee);this[_0x9900('0x38')](_0x199cee[_0x9900('0x53')],'in','','');this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xe4'),_0x199cee[_0x9900('0x53')]));var _0x4ad947=this['googleDialogflow'][_0x9900('0x9d')](this,_0x199cee);if(_0x4ad947){for(var _0x105f9f in _0x4ad947){if(_0x4ad947[_0x9900('0x8d')](_0x105f9f)){this[_0x9900('0x30')]['setVariable'](util[_0x9900('0x24')](_0x9900('0xe5'),_0x105f9f[_0x9900('0xe6')]()),_0x4ad947[_0x105f9f]);}}this[_0x9900('0x38')](_0x4ad947[_0x9900('0xe7')],_0x9900('0xe8'),_0x9900('0xe9'),'');return this[_0x9900('0x30')]['noop'](util['format'](_0x9900('0xea'),_0x4ad947[_0x9900('0xe7')]));}return this[_0x9900('0x30')][_0x9900('0x2d')](_0x199cee,_0x9900('0xeb'));};AGIVertices[_0x9900('0xe')][_0x9900('0xec')]=function(_0x221527){logger['info'](util[_0x9900('0x24')](_0x9900('0xed'),_0x221527[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x221527[_0x9900('0x71')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xee'));}if(!this[_0x9900('0x7b')](_0x221527['client_email'])){return this[_0x9900('0x30')]['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x221527[_0x9900('0x73')])){return this['channel'][_0x9900('0xa3')](_0x9900('0xef'));}if(!this['isConfigured'](_0x221527['dialogflowV2_language'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xf0'));}if(!this[_0x9900('0x7b')](_0x221527[_0x9900('0x53')])){return this[_0x9900('0x30')][_0x9900('0xa3')]('no\x20text\x20configured');}this[_0x9900('0x30')]['bot']=!![];this[_0x9900('0x2f')](_0x221527);this['createSquareMessage'](_0x221527['text'],'in','','');this['channel'][_0x9900('0xa3')](util['format'](_0x9900('0xf1'),_0x221527[_0x9900('0x53')]));var _0x2c9798=this[_0x9900('0x70')][_0x9900('0x9d')](this,_0x221527);if(_0x2c9798){for(var _0x4f85cb in _0x2c9798){if(_0x2c9798['hasOwnProperty'](_0x4f85cb)){if(_0x4f85cb!==_0x9900('0xf2')){this['channel'][_0x9900('0x97')](util['format'](_0x9900('0xe5'),_0x4f85cb[_0x9900('0xe6')]()),_0x2c9798[_0x4f85cb]);}}}this['createSquareMessage'](_0x2c9798[_0x9900('0xe7')],_0x9900('0xe8'),_0x9900('0xec'),_0x2c9798[_0x9900('0xf2')]);return this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0xf3'),_0x2c9798[_0x9900('0xe7')]));}return this['channel'][_0x9900('0x2d')](_0x221527,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x9900('0xe')][_0x9900('0xf4')]=function(_0x36a691){logger['info'](util[_0x9900('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x36a691['label']));if(!this['isConfigured'](_0x36a691[_0x9900('0xf5')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xf6'));}if(!this['isConfigured'](_0x36a691[_0x9900('0xf7')])){return this['channel'][_0x9900('0xa3')]('no\x20username\x20configured');}if(!this[_0x9900('0x7b')](_0x36a691['password'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xf8'));}if(!this[_0x9900('0x7b')](_0x36a691['ndassistant_url'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}this[_0x9900('0x30')][_0x9900('0xf9')]=!![];this['createSquareDetailsReport'](_0x36a691);this[_0x9900('0x38')](_0x36a691[_0x9900('0x53')],'in','','');this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xfa'),_0x36a691[_0x9900('0x53')]));var _0x8da098=this['sestekNDA'][_0x9900('0x9d')](this,_0x36a691);if(_0x8da098){for(var _0x5df0ec in _0x8da098){if(_0x8da098[_0x9900('0x8d')](_0x5df0ec)){this[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')](_0x9900('0xfb'),_0x5df0ec[_0x9900('0xe6')]()),_0x8da098[_0x5df0ec]);}}this[_0x9900('0x38')](_0x8da098[_0x9900('0xe7')],_0x9900('0xe8'),_0x9900('0xf4'),'');if(_0x8da098[_0x9900('0xfc')]){this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xfd'),_0x8da098[_0x9900('0xfc')]));var _0x43ee5c=this[_0x9900('0x30')][_0x9900('0xfe')](_0x8da098[_0x9900('0xfc')]);try{fs[_0x9900('0xff')](_0x8da098[_0x9900('0xfc')]+_0x9900('0x100'));}catch(_0x55c685){logger[_0x9900('0x2d')](_0x55c685);}return _0x43ee5c;}else{return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')]('SestekNDA\x20Result\x20%s',_0x8da098[_0x9900('0xe7')]));}}return this[_0x9900('0x30')][_0x9900('0x2d')](_0x36a691,_0x9900('0x101'));};AGIVertices['prototype'][_0x9900('0x102')]=function(_0x41abf3){logger[_0x9900('0x29')](util[_0x9900('0x24')]('Enter\x20in\x20END\x20(%s)\x20block',_0x41abf3['label']));return this[_0x9900('0x30')]['noop'](_0x9900('0x102'));};AGIVertices[_0x9900('0xe')][_0x9900('0x103')]=function(_0x35bce7){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x104'),_0x35bce7[_0x9900('0xa2')]));var _0x36c837='';if(_0x35bce7[_0x9900('0x105')]){if(!this['isConfigured'](_0x35bce7[_0x9900('0x105')])){return this['channel'][_0x9900('0x2d')](_0x35bce7,_0x9900('0x106'));}else{var _0x20e958=parseInt(_0x35bce7[_0x9900('0x105')],0xa);if(isNaN(_0x20e958)){_0x36c837=_0x35bce7[_0x9900('0x105')];}else{_0x36c837=this[_0x9900('0x107')][_0x9900('0x9d')](this,_0x35bce7[_0x9900('0x105')]);if(!_0x36c837){return this['channel']['error'](_0x35bce7,'no\x20trunk\x20found');}}}}else if(_0x35bce7[_0x9900('0x108')]){_0x36c837=_0x35bce7[_0x9900('0x108')];}else{return this[_0x9900('0x30')]['error'](_0x35bce7,_0x9900('0x106'));}var _0x520e46=this[_0x9900('0x30')][_0x9900('0xa5')](_0x9900('0xde'),[util[_0x9900('0x24')](_0x9900('0x109'),_0x36c837,_0x35bce7[_0x9900('0x3e')]),_0x35bce7[_0x9900('0x5e')],_0x35bce7[_0x9900('0xe0')],_0x35bce7[_0x9900('0x10a')]]);if(_0x520e46[_0x9900('0xa6')]===-0x1){return _0x520e46;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xe1'),_0x9900('0xde')));};AGIVertices[_0x9900('0xe')][_0x9900('0x10b')]=function(_0x4dc2da){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x10c'),_0x4dc2da['label']));return this[_0x9900('0x30')]['noop'](_0x9900('0x10b'));};AGIVertices[_0x9900('0xe')]['getdigits']=function(_0x3c9127){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x10d'),_0x3c9127[_0x9900('0xa2')]));if(_0x3c9127[_0x9900('0x9e')]===0x0){return this[_0x9900('0x9f')](_0x3c9127);}_0x3c9127[_0x9900('0x9e')]-=0x1;if(!this[_0x9900('0x7b')](_0x3c9127[_0x9900('0x10e')])){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x3c9127,_0x9900('0x10f'));}var _0x43dbfe=this[_0x9900('0x1b')][_0x9900('0x9d')](this,_0x3c9127[_0x9900('0x10e')]);if(!_0x43dbfe){return this[_0x9900('0x30')]['error'](_0x3c9127,_0x9900('0x110'));}if(!this[_0x9900('0x7b')](_0x3c9127[_0x9900('0xd7')])){return this[_0x9900('0x30')]['error'](_0x9900('0xd6'));}var _0x212d1f=this['channel']['getData'](_0x43dbfe,_0x3c9127[_0x9900('0x111')],_0x3c9127[_0x9900('0x112')]);var _0x1482fc=_0x212d1f['result']?_0x212d1f[_0x9900('0xa6')]['toString']():'';logger[_0x9900('0x29')](_0x9900('0x113'),JSON[_0x9900('0x68')](_0x212d1f));if(_0x212d1f['result']===-0x1){this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x3c9127,_0x1482fc);return _0x212d1f;}else if(_0x212d1f[_0x9900('0x9a')]===_0x9900('0x5e')){_0x212d1f['result']=_0x1482fc[_0x9900('0x94')]>=parseInt(_0x3c9127[_0x9900('0x114')])?'x':'i';}else{_0x212d1f[_0x9900('0xa6')]=_0x1482fc[_0x9900('0x94')]>=parseInt(_0x3c9127[_0x9900('0x114')])&&_0x1482fc['length']<=parseInt(_0x3c9127['maxdigit'])?'x':'i';}var _0x49fc4c=this[_0x9900('0xf')]['sync'](this,_0x3c9127[_0x9900('0xd7')]);if(!_0x49fc4c){return this['channel'][_0x9900('0x2d')](_0x3c9127,_0x9900('0x115'));}this[_0x9900('0x30')]['setVariable'](_0x49fc4c,_0x1482fc);if(this[_0x9900('0x7b')](_0x3c9127[_0x9900('0x116')])){var _0x439236=parseInt(_0x3c9127[_0x9900('0x116')],0xa);var _0x1a0ce3=rs[_0x9900('0x117')]({'charset':'*','length':_0x439236});var _0x2ca337=_0x1482fc[_0x9900('0x94')];if(_0x2ca337>0x0){if(_0x2ca337>_0x439236){this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x3c9127,_0x3c9127[_0x9900('0x118')]==='first'?_0x1a0ce3+_0x1482fc[_0x9900('0x119')](_0x439236):_0x1482fc['substr'](0x0,_0x2ca337-_0x439236)+_0x1a0ce3);}else{this[_0x9900('0x2f')]['sync'](this,_0x3c9127,rs[_0x9900('0x117')]({'charset':'*','length':_0x2ca337}));}}else{this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x3c9127,'');}}else{this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x3c9127,_0x1482fc);}return _0x212d1f;};AGIVertices[_0x9900('0xe')][_0x9900('0xb')]=function(_0x354eef){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x11a'),_0x354eef[_0x9900('0xa2')]));return this[_0x9900('0x11b')](_0x354eef);};AGIVertices[_0x9900('0xe')]['goal']=function(_0x31a04a){logger[_0x9900('0x29')](util['format'](_0x9900('0x11c'),_0x31a04a[_0x9900('0xa2')]));this[_0x9900('0x2f')]['sync'](this,_0x31a04a,_0x31a04a[_0x9900('0x11d')]);return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x11e'),_0x31a04a[_0x9900('0x11d')]));};AGIVertices[_0x9900('0xe')][_0x9900('0x11f')]=function(_0x1acac6){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x120'),_0x1acac6[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x1acac6['aws_access_key_id'])||!this[_0x9900('0x7b')](_0x1acac6[_0x9900('0x121')])){return this[_0x9900('0x30')][_0x9900('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9900('0x7b')](_0x1acac6[_0x9900('0x53')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x1acac6[_0x9900('0x53')]));var _0xe2900=this[_0x9900('0x7d')]['sync'](this,_0x1acac6);if(_0xe2900){this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0x122'),_0xe2900));var _0x3edfb4=this['channel'][_0x9900('0xfe')](_0xe2900);try{fs[_0x9900('0xff')](_0xe2900+_0x9900('0x100'));}catch(_0x12ea3b){logger['error'](_0x12ea3b);}return _0x3edfb4;}return this[_0x9900('0x30')][_0x9900('0x2d')](_0x1acac6,_0x9900('0x123'));};AGIVertices[_0x9900('0xe')][_0x9900('0x124')]=function(_0xd352f4){logger[_0x9900('0x29')](util['format'](_0x9900('0x125'),_0xd352f4[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0xd352f4[_0x9900('0x7e')])||!this[_0x9900('0x7b')](_0xd352f4[_0x9900('0x121')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0x126'));}if(!this[_0x9900('0x7b')](_0xd352f4[_0x9900('0x83')])){return this[_0x9900('0x30')]['noop'](_0x9900('0x127'));}if(!this[_0x9900('0x7b')](_0xd352f4['text'])){return this[_0x9900('0x30')]['noop']('no\x20text\x20configured');}this[_0x9900('0x30')]['bot']=!![];this[_0x9900('0x2f')](_0xd352f4);this[_0x9900('0x38')](_0xd352f4[_0x9900('0x53')],'in','','');this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x128'),_0xd352f4['text']));var _0x17c0ca=this[_0x9900('0x82')][_0x9900('0x9d')](this,_0xd352f4);if(_0x17c0ca){for(var _0x348b40 in _0x17c0ca){if(_0x17c0ca['hasOwnProperty'](_0x348b40)&&_[_0x9900('0x8e')](_0x17c0ca[_0x348b40])){this[_0x9900('0x30')][_0x9900('0x97')](util['format']('AWS_LEX_%s',_0x348b40[_0x9900('0xe6')]()),_0x17c0ca[_0x348b40]);}}if(_[_0x9900('0x3d')](_0x17c0ca[_0x9900('0x6b')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0x129'));}else{this[_0x9900('0x38')](_0x17c0ca['message'],_0x9900('0xe8'),_0x9900('0x12a'),'');return this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x17c0ca[_0x9900('0x6b')]));}}return this[_0x9900('0x30')][_0x9900('0x2d')](_0xd352f4,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x9900('0x12b')]=function(_0x5408ab){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5408ab['label'],_0x5408ab[_0x9900('0x5e')]));if(!this[_0x9900('0x7b')](_0x5408ab['key'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xe3'));}var _0x4777cd=_0x9900('0x12c');var _0x134161=util[_0x9900('0x24')](_0x9900('0x12d'),FILES_PATH,rs[_0x9900('0x117')](0x4));var _0x4b991c=util[_0x9900('0x24')]('%s.%s',_0x134161,_0x4777cd);var _0x49f6c7=!![];if(_0x5408ab['beep']===_0x9900('0x12e')){_0x49f6c7=![];}var _0x11e6f2=this[_0x9900('0x30')]['recordFile'](_0x134161,_0x4777cd,_0x5408ab[_0x9900('0x12f')],_0x5408ab[_0x9900('0x5e')],undefined,_0x49f6c7);if(_0x11e6f2[_0x9900('0xa6')]!==-0x1){this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')]('google\x20%s\x20file\x20created',_0x4b991c));var _0x507c21=this[_0x9900('0x84')][_0x9900('0x9d')](this,_0x5408ab,_0x4b991c);if(_0x507c21){for(var _0x535841 in _0x507c21){if(_0x507c21[_0x9900('0x8d')](_0x535841)){this[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')](_0x9900('0x130'),_0x535841[_0x9900('0xe6')]()),_0x507c21[_0x535841]);}}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')]('GoogleASR\x20Result\x20%s',JSON[_0x9900('0x68')](_0x507c21)));}}return _0x11e6f2;};AGIVertices[_0x9900('0xe')][_0x9900('0x131')]=function(_0x295879){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x132'),_0x295879['label']));if(!this[_0x9900('0x7b')](_0x295879['appid'])){return this[_0x9900('0x30')][_0x9900('0xa3')]('no\x20appid\x20configured');}if(!this[_0x9900('0x7b')](_0x295879[_0x9900('0x88')])){return this[_0x9900('0x30')]['noop']('no\x20appsecret\x20configured');}var _0x2ba2d9=_0x9900('0x12c');var _0x36911e=util['format'](_0x9900('0x12d'),FILES_PATH,rs[_0x9900('0x117')](0x4));var _0x3e1e53=util[_0x9900('0x24')](_0x9900('0x96'),_0x36911e,_0x2ba2d9);var _0xeb19fa=!![];if(_0x295879[_0x9900('0x133')]===_0x9900('0x12e')){_0xeb19fa=![];}var _0x139f2c=this[_0x9900('0x30')][_0x9900('0x134')](_0x36911e,_0x2ba2d9,_0x295879['intKey'],_0x295879[_0x9900('0x5e')],undefined,_0xeb19fa);if(_0x139f2c[_0x9900('0xa6')]!==-0x1){this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x135'),_0x3e1e53));var _0x210e69=this[_0x9900('0x86')][_0x9900('0x9d')](this,_0x295879,_0x3e1e53);if(_0x210e69){for(var _0x49c34b in _0x210e69){if(_0x210e69[_0x9900('0x8d')](_0x49c34b)){this['channel']['setVariable'](util[_0x9900('0x24')](_0x9900('0x136'),_0x49c34b['toUpperCase']()),_0x210e69[_0x49c34b]);}}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x137'),JSON[_0x9900('0x68')](_0x210e69)));}}return _0x139f2c;};AGIVertices[_0x9900('0xe')][_0x9900('0x138')]=function(_0xf49145){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x139'),_0xf49145[_0x9900('0xa2')]));return this[_0x9900('0x30')][_0x9900('0x13a')](_0xf49145[_0x9900('0x13b')],_0xf49145['extension'],_0xf49145[_0x9900('0x13c')]);};AGIVertices['prototype'][_0x9900('0x13d')]=function(_0x269aee){logger['info'](util[_0x9900('0x24')](_0x9900('0x13e'),_0x269aee[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x269aee['condition'])){return this['channel'][_0x9900('0x2d')](_0x269aee,_0x9900('0x13f'));}try{var _0xffdac3=eval(_0x269aee[_0x9900('0x140')])?'true':_0x9900('0x141');this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x269aee[_0x9900('0x140')],_0xffdac3));return{'code':0xc8,'result':_0xffdac3};}catch(_0x2707a2){return{'code':0xc8,'result':_0x9900('0x141')};}};AGIVertices[_0x9900('0xe')][_0x9900('0x142')]=function(_0x48f457){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x143'),_0x48f457[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x48f457[_0x9900('0x144')])){return this['channel'][_0x9900('0x2d')](_0x48f457,_0x9900('0x145'));}var _0xe4d7d5=this[_0x9900('0x20')][_0x9900('0x9d')](this,_0x48f457[_0x9900('0x144')]);if(!_0xe4d7d5){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x48f457,'no\x20intervals\x20found');}for(var _0x5c1cdf=0x0;_0x5c1cdf<_0xe4d7d5[_0x9900('0x94')];_0x5c1cdf+=0x1){var _0x5e200a=this[_0x9900('0x30')][_0x9900('0xf')](util[_0x9900('0x24')](_0x9900('0x146'),_0xe4d7d5[_0x5c1cdf]));if(_0x5e200a['result']===-0x1){return _0x5e200a;}logger[_0x9900('0x29')](util[_0x9900('0x24')]('IFTIME\x20%s\x20%s',_0xe4d7d5[_0x5c1cdf],_0x5e200a[_0x9900('0x9a')]));if(_0x5e200a[_0x9900('0x9a')]==='true'){logger['info'](util[_0x9900('0x24')](_0x9900('0x147'),_0xe4d7d5[_0x5c1cdf],'true'));this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')]('IFTIME\x20%s\x20%s',_0xe4d7d5[_0x5c1cdf],_0x9900('0x148')));return{'code':0xc8,'result':_0x9900('0x148')};}else{logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x147'),_0xe4d7d5[_0x5c1cdf],_0x9900('0x141')));this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0x147'),_0xe4d7d5[_0x5c1cdf],_0x9900('0x141')));}}return{'code':0xc8,'result':_0x9900('0x141')};};AGIVertices[_0x9900('0xe')][_0x9900('0x149')]=function(_0x365977){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x14a'),_0x365977[_0x9900('0xa2')]));return this[_0x9900('0x30')][_0x9900('0x149')]();};AGIVertices['prototype']['ispeechasr']=function(_0x583c91){logger['info'](util[_0x9900('0x24')](_0x9900('0x14b'),_0x583c91[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x583c91[_0x9900('0x6e')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xe3'));}var _0x27a98f=_0x9900('0x12c');var _0x190087=util[_0x9900('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x9900('0x117')](0x4));var _0x5d5308=util[_0x9900('0x24')](_0x9900('0x96'),_0x190087,_0x27a98f);var _0x218ba7=!![];if(_0x583c91['beep']===_0x9900('0x12e')){_0x218ba7=![];}var _0x4cb6b6=this[_0x9900('0x30')][_0x9900('0x134')](_0x190087,_0x27a98f,_0x583c91[_0x9900('0x12f')],_0x583c91[_0x9900('0x5e')],undefined,_0x218ba7);if(_0x4cb6b6[_0x9900('0xa6')]!==-0x1){this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x14c'),_0x5d5308));var _0x4fca23=this[_0x9900('0x79')][_0x9900('0x9d')](this,_0x583c91,_0x5d5308);if(_0x4fca23){for(var _0x3c6c9e in _0x4fca23){if(_0x4fca23[_0x9900('0x8d')](_0x3c6c9e)){this[_0x9900('0x30')][_0x9900('0x97')](util[_0x9900('0x24')](_0x9900('0x14d'),_0x3c6c9e[_0x9900('0xe6')]()),_0x4fca23[_0x3c6c9e]);}}return this[_0x9900('0x30')]['noop'](util['format'](_0x9900('0x14e'),JSON[_0x9900('0x68')](_0x4fca23)));}}return _0x4cb6b6;};AGIVertices[_0x9900('0xe')][_0x9900('0x14f')]=function(_0x4b8bc6){logger['info'](util[_0x9900('0x24')](_0x9900('0x150'),_0x4b8bc6[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x4b8bc6[_0x9900('0x6e')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xe3'));}if(!this['isConfigured'](_0x4b8bc6['text'])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}this[_0x9900('0x30')][_0x9900('0xa3')](util['format'](_0x9900('0x151'),_0x4b8bc6['text']));var _0x1018af=this[_0x9900('0x76')][_0x9900('0x9d')](this,_0x4b8bc6);if(_0x1018af){this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x14c'),_0x1018af));var _0x300ee5=this['channel']['streamFile'](_0x1018af,_0x4b8bc6['intKey']);try{fs[_0x9900('0xff')](_0x1018af+_0x9900('0x100'));}catch(_0x583d17){logger[_0x9900('0x2d')](_0x583d17);}return _0x300ee5;}return this[_0x9900('0x30')][_0x9900('0x2d')](_0x4b8bc6,_0x9900('0x152'));};AGIVertices[_0x9900('0xe')][_0x9900('0x153')]=function(_0x420bef){logger[_0x9900('0x29')](util['format'](_0x9900('0x154'),_0x420bef[_0x9900('0xa2')]));if(!this['isConfigured'](_0x420bef[_0x9900('0x155')])){return this['channel'][_0x9900('0x2d')](_0x420bef,'no\x20find\x20by\x20configured');}logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x156'),this[_0x9900('0x30')][_0x9900('0x33')],_0x420bef[_0x9900('0x155')]));var _0x3b3609=this[_0x9900('0x4c')][_0x9900('0x9d')](this,_0x420bef[_0x9900('0x155')]);if(_0x3b3609){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x157'),this[_0x9900('0x30')][_0x9900('0x33')],_0x420bef['findBy']));this[_0x9900('0x30')][_0x9900('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9900('0x30')]['callerid'],_0x420bef[_0x9900('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x158'),this[_0x9900('0x30')][_0x9900('0x33')],_0x420bef['findBy']));this[_0x9900('0x30')][_0x9900('0xa3')](util['format'](_0x9900('0x158'),this['channel'][_0x9900('0x33')],_0x420bef[_0x9900('0x155')]));return{'code':0xc8,'result':_0x9900('0x159')};}};AGIVertices[_0x9900('0xe')][_0x9900('0x15a')]=function(_0x1ac2cd){logger['info'](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1ac2cd['label']));if(!this[_0x9900('0x7b')](_0x1ac2cd[_0x9900('0x155')])){return this['channel'][_0x9900('0x2d')](_0x1ac2cd,_0x9900('0x15b'));}logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x156'),this[_0x9900('0x30')][_0x9900('0x33')],_0x1ac2cd[_0x9900('0x155')]));var _0x2a4212=this[_0x9900('0x48')][_0x9900('0x9d')](this,_0x1ac2cd[_0x9900('0x155')]);if(_0x2a4212){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x157'),this[_0x9900('0x30')]['callerid'],_0x1ac2cd['findBy']));this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x157'),this[_0x9900('0x30')][_0x9900('0x33')],_0x1ac2cd[_0x9900('0x155')]));return{'code':0xc8,'result':_0x9900('0x15c')};}else{logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x158'),this[_0x9900('0x30')][_0x9900('0x33')],_0x1ac2cd[_0x9900('0x155')]));this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x158'),this[_0x9900('0x30')][_0x9900('0x33')],_0x1ac2cd['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9900('0xe')][_0x9900('0x15d')]=function(_0x34ddd9){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x15e'),_0x34ddd9[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x34ddd9[_0x9900('0x15f')])){return this['channel']['error'](_0x34ddd9,_0x9900('0x160'));}this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0x161'),_0x34ddd9[_0x9900('0x15f')]));var _0x35014f=eval(_0x34ddd9[_0x9900('0x15f')]);if(!this['isConfigured'](_0x34ddd9[_0x9900('0xd7')])){return this['channel'][_0x9900('0xa3')](_0x9900('0xd6'));}var _0x576bee=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x34ddd9[_0x9900('0xd7')]);if(!_0x576bee){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x34ddd9,_0x9900('0x115'));}if(_[_0x9900('0x93')](_0x35014f)){var _0x951fac=this;_0x35014f[_0x9900('0x162')](function(_0x1c8d6d,_0x402225){_0x951fac['channel'][_0x9900('0x97')](util['format']('%s[%s]',_0x576bee,_0x402225),_0x1c8d6d);});return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x163'),_0x576bee));}else{return this[_0x9900('0x30')][_0x9900('0x97')](_0x576bee,_0x35014f);}};AGIVertices[_0x9900('0xe')]['menu']=function(_0x27019b){logger[_0x9900('0x29')](util['format'](_0x9900('0x164'),_0x27019b[_0x9900('0xa2')]));if(_0x27019b[_0x9900('0x9e')]===0x0){return this['maxRetry'](_0x27019b);}_0x27019b[_0x9900('0x9e')]-=0x1;if(!this['isConfigured'](_0x27019b[_0x9900('0x10e')])){return this['channel'][_0x9900('0x2d')](_0x27019b,_0x9900('0x10f'));}var _0x284c0d=this[_0x9900('0x1b')]['sync'](this,_0x27019b[_0x9900('0x10e')]);if(!_0x284c0d){return this['channel'][_0x9900('0x2d')](_0x27019b,_0x9900('0x110'));}var _0x10a571=this[_0x9900('0x30')][_0x9900('0x165')](_0x284c0d,_0x27019b[_0x9900('0x111')],_0x27019b[_0x9900('0x166')]);var _0x4e9dac=_0x10a571[_0x9900('0xa6')];if(_0x10a571[_0x9900('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x9900('0x9d')](this,_0x27019b,'-1');return _0x10a571;}else if(_0x10a571[_0x9900('0x9a')]===_0x9900('0x5e')){_0x10a571['result']=_0x10a571[_0x9900('0xa6')][_0x9900('0x94')]>0x0?_0x10a571['result']:'t';}else if(_[_0x9900('0x3b')](_0x10a571[_0x9900('0xa6')])){_0x10a571[_0x9900('0xa6')]='#';_0x4e9dac='#';}if(!this[_0x9900('0x7b')](_0x27019b[_0x9900('0xd7')])){this['channel'][_0x9900('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2950cc=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x27019b[_0x9900('0xd7')]);if(!_0x2950cc){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x27019b,_0x9900('0x115'));}this[_0x9900('0x30')]['setVariable'](_0x2950cc,_0x4e9dac);}this['createSquareDetailsReport'][_0x9900('0x9d')](this,_0x27019b,_0x4e9dac);return _0x10a571;};AGIVertices['prototype'][_0x9900('0xa3')]=function(_0x38cacd){logger[_0x9900('0x29')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x38cacd['label']));return this['channel'][_0x9900('0xa3')](_0x38cacd[_0x9900('0x167')]||_0x38cacd[_0x9900('0xa2')]);};AGIVertices[_0x9900('0xe')]['pause']=function(_0x29261b){logger[_0x9900('0x29')](util[_0x9900('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x29261b[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x29261b[_0x9900('0x155')])){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x29261b,'no\x20find\x20by\x20configured');}logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x156'),this[_0x9900('0x30')][_0x9900('0x33')],_0x29261b[_0x9900('0x155')]));var _0x91d1dc=this[_0x9900('0x168')][_0x9900('0x9d')](this,_0x29261b['pause_id']);var _0x5b1886=this[_0x9900('0x45')][_0x9900('0x9d')](this,_0x29261b[_0x9900('0x155')],_0x91d1dc);if(_0x5b1886){logger['info'](util['format'](_0x9900('0x157'),this[_0x9900('0x30')][_0x9900('0x33')],_0x29261b[_0x9900('0x155')]));this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9900('0x30')]['callerid'],_0x29261b[_0x9900('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9900('0x29')](util[_0x9900('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9900('0x30')][_0x9900('0x33')],_0x29261b[_0x9900('0x155')]));this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x157'),this[_0x9900('0x30')]['callerid'],_0x29261b[_0x9900('0x155')]));return{'code':0xc8,'result':_0x9900('0x159')};}};AGIVertices[_0x9900('0xe')]['playback']=function(_0x19512f){logger['info'](util[_0x9900('0x24')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x19512f[_0x9900('0xa2')]));if(!this['isConfigured'](_0x19512f[_0x9900('0x10e')])){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x19512f,_0x9900('0x10f'));}var _0x5c0d3a=this['getSound'][_0x9900('0x9d')](this,_0x19512f[_0x9900('0x10e')]);if(!_0x5c0d3a){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x19512f,_0x9900('0x110'));}var _0x26b297=this[_0x9900('0x30')][_0x9900('0xa5')]('PLAYBACK',[_0x5c0d3a,_0x19512f['opts']]);if(_0x26b297[_0x9900('0xa6')]===-0x1){return _0x26b297;}return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xbe'),_0x9900('0x169'),_0x5c0d3a));};AGIVertices[_0x9900('0xe')]['queue']=function(_0x21315){logger['info'](util[_0x9900('0x24')](_0x9900('0x16a'),_0x21315[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x21315['queue_id'])){return this['channel'][_0x9900('0x2d')](_0x21315,'no\x20queue\x20selected');}var _0x3afbb2='';var _0x385b02=parseInt(_0x21315['queue_id'],0xa);if(isNaN(_0x385b02)){_0x3afbb2=_0x21315[_0x9900('0x16b')];}else{_0x3afbb2=this[_0x9900('0x13')][_0x9900('0x9d')](this,_0x21315['queue_id']);if(!_0x3afbb2){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x21315,'no\x20queue\x20found');}}var _0x437547='';if(this[_0x9900('0x7b')](_0x21315[_0x9900('0x10e')])){var _0x57deca=this[_0x9900('0x1b')][_0x9900('0x9d')](this,_0x21315[_0x9900('0x10e')]);if(_0x57deca){_0x437547=_0x57deca;}}this['createSquareDetailsReport']['sync'](this,_0x21315,_0x3afbb2);if(_0x21315[_0x9900('0xe0')]['indexOf']('x')<0x0){_0x21315['opts']+='x';}if(_0x21315[_0x9900('0xe0')][_0x9900('0x16c')]('X')<0x0){_0x21315[_0x9900('0xe0')]+='X';}this[_0x9900('0x30')][_0x9900('0x97')](_0x9900('0x16d'),_0x3afbb2?_0x3afbb2[_0x9900('0x16e')]():'');var _0x1ae03a=this[_0x9900('0x30')]['exec'](_0x9900('0x16f'),[_0x3afbb2,_0x21315['opts'],_0x21315[_0x9900('0x10a')],_0x437547,_0x21315[_0x9900('0x5e')],_0x21315[_0x9900('0xb0')],_0x21315[_0x9900('0x170')],_0x21315[_0x9900('0x171')],'',_0x21315[_0x9900('0x172')]]);if(_0x1ae03a['result']===-0x1){return _0x1ae03a;}return this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0xbe'),_0x9900('0x16f'),_0x3afbb2));};AGIVertices[_0x9900('0xe')][_0x9900('0x173')]=function(_0x109d66){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x174'),_0x109d66['label']));var _0x3cd74a=_0x109d66['recordingFormat']||_0x9900('0x12c');var _0x21c2e1=util[_0x9900('0x24')](_0x9900('0x175'),this[_0x9900('0x30')][_0x9900('0x31')],rs[_0x9900('0x117')](0x5));var _0x16d925=util['format'](_0x9900('0x176'),FILES_PATH,_0x21c2e1,_0x3cd74a);var _0x2e8694=util['format'](_0x9900('0x12d'),FILES_PATH,_0x21c2e1);this[_0x9900('0x34')][_0x9900('0x9d')](this,_0x109d66,_0x21c2e1,_0x16d925);this['channel'][_0x9900('0x97')](_0x9900('0x177'),_0x21c2e1);logger[_0x9900('0x29')](_0x9900('0x178'),_0x2e8694,_0x3cd74a,_0x109d66['escape_digits'],_0x109d66[_0x9900('0x5e')]);return this[_0x9900('0x30')][_0x9900('0x134')](_0x2e8694,_0x3cd74a,_0x109d66[_0x9900('0x179')],_0x109d66[_0x9900('0x5e')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x511832){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x17a'),_0x511832[_0x9900('0xa2')]));if(!this['isConfigured'](_0x511832[_0x9900('0x10a')])){return this[_0x9900('0x30')]['noop'](_0x9900('0x17b'));}var _0x106473=this['restAPI']['sync'](this,_0x511832);logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x17c'),util['inspect'](_0x106473,{'showHidden':![],'depth':null})));if(!this[_0x9900('0x7b')](_0x511832[_0x9900('0xd7')])){return this['channel'][_0x9900('0xa3')](_0x9900('0x17d'));}var _0x4d3a67=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x511832['variable_id']);if(!_0x4d3a67){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x511832,_0x9900('0x115'));}this[_0x9900('0x30')][_0x9900('0x97')](util['format']('%s_STATUS_CODE',_0x4d3a67),_0x106473[_0x9900('0x69')]?_0x106473[_0x9900('0x69')]:_0x9900('0x17e'));this['channel'][_0x9900('0x97')](util[_0x9900('0x24')](_0x9900('0x17f'),_0x4d3a67),_0x106473[_0x9900('0x6a')]?_0x106473[_0x9900('0x6a')]:'OK');if(_0x106473[_0x9900('0x60')]){try{this[_0x9900('0x95')](_0x106473[_0x9900('0x60')],_0x4d3a67);}catch(_0xb7b31){logger[_0x9900('0x2d')](util[_0x9900('0x24')](_0x9900('0x180'),_0x4d3a67));}}return this['channel'][_0x9900('0xa3')](util['format']('variable\x20%s\x20set',_0x4d3a67));};AGIVertices[_0x9900('0xe')][_0x9900('0x181')]=function(_0x4fb705){logger[_0x9900('0x29')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4fb705[_0x9900('0xa2')]));return this['channel'][_0x9900('0x182')](_0x4fb705[_0x9900('0x183')][_0x9900('0x4f')](/\s+/g,''),_0x4fb705[_0x9900('0x179')]);};AGIVertices[_0x9900('0xe')]['saynumber']=function(_0x5086d5){logger['info'](util[_0x9900('0x24')](_0x9900('0x184'),_0x5086d5[_0x9900('0xa2')]));return this[_0x9900('0x30')][_0x9900('0x185')](_0x5086d5[_0x9900('0x186')]['replace'](/\s+/g,''),_0x5086d5['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x2eead5){logger['info'](util[_0x9900('0x24')](_0x9900('0x187'),_0x2eead5['label']));return this[_0x9900('0x30')][_0x9900('0x188')](_0x2eead5[_0x9900('0x53')],_0x2eead5[_0x9900('0x179')]);};AGIVertices[_0x9900('0xe')][_0x9900('0x189')]=function(_0x13dd0e){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x18a'),_0x13dd0e[_0x9900('0xa2')]));if(!this['isConfigured'](_0x13dd0e[_0x9900('0x18b')])){return this[_0x9900('0x30')]['noop']('no\x20mail\x20account\x20configured');}var _0x38d206=this[_0x9900('0x18c')]['sync'](this,_0x13dd0e[_0x9900('0x18b')]);if(!_0x38d206||!_0x38d206[_0x9900('0x18d')]){return this['channel'][_0x9900('0x2d')](_0x13dd0e,_0x9900('0x18e'));}var _0xf2eea2={'from':util[_0x9900('0x24')]('\x22%s\x22\x20<%s>',_0x38d206[_0x9900('0x15')],_0x38d206[_0x9900('0x18f')]||_0x38d206[_0x9900('0x18d')]['user']),'to':_0x13dd0e['to']||'','cc':_0x13dd0e['cc']||'','bcc':_0x13dd0e[_0x9900('0x190')]||'','subject':_0x13dd0e['subject'],'html':_0x13dd0e[_0x9900('0x53')],'text':_0x13dd0e[_0x9900('0x53')]};if(this[_0x9900('0x7b')](_0x13dd0e[_0x9900('0x191')])){}logger['debug'](_0x9900('0x192'),JSON['stringify'](_0xf2eea2));this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x13dd0e,_0x13dd0e[_0x9900('0x18b')]);this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x193'),_0x38d206['name']));this['sendMailMessage'][_0x9900('0x9d')](this,_0x38d206[_0x9900('0x194')],_0xf2eea2);return this[_0x9900('0x30')][_0x9900('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9900('0xe')]['sendFax']=function(_0x39471d){logger[_0x9900('0x29')](util['format'](_0x9900('0x195'),_0x39471d[_0x9900('0xa2')]));return this[_0x9900('0x30')]['noop'](_0x9900('0x196'));};AGIVertices[_0x9900('0xe')][_0x9900('0x197')]=function(_0x1a04a7){logger[_0x9900('0x29')](util[_0x9900('0x24')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1a04a7[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x1a04a7[_0x9900('0x198')])){return this['channel'][_0x9900('0xa3')]('no\x20sms\x20account\x20configured');}var _0x14a0cf=this[_0x9900('0x199')][_0x9900('0x9d')](this,_0x1a04a7[_0x9900('0x198')]);if(!_0x14a0cf){return this['channel']['error'](_0x1a04a7,'no\x20sms\x20account\x20found');}var _0x5ee230={'body':_0x1a04a7[_0x9900('0x19a')],'phone':_0x1a04a7['to']||'','SmsAccountId':_0x14a0cf['id']};logger[_0x9900('0x19b')](_0x9900('0x19c'),JSON[_0x9900('0x68')](_0x5ee230));this['createSquareDetailsReport']['sync'](this,_0x1a04a7,_0x1a04a7[_0x9900('0x198')]);this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x14a0cf[_0x9900('0x15')]));this[_0x9900('0x19d')]['sync'](this,_0x5ee230);return this['channel'][_0x9900('0xa3')](_0x9900('0x19e'));};AGIVertices['prototype']['set']=function(_0x4039f8){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x19f'),_0x4039f8['label']));if(!this['isConfigured'](_0x4039f8['variable_id'])){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x4039f8,_0x9900('0x1a0'));}var _0x55145b=this['getVariable']['sync'](this,_0x4039f8['variable_id']);if(!_0x55145b){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x4039f8,_0x9900('0x115'));}return this[_0x9900('0x30')][_0x9900('0x97')](_0x55145b,_0x4039f8[_0x9900('0x1a1')]);};AGIVertices[_0x9900('0xe')][_0x9900('0x1a2')]=function(_0x2a338a){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x1a3'),_0x2a338a['label']));this[_0x9900('0x30')]['noop'](_0x9900('0x1a4'));var _0x10a4bf=this[_0x9900('0x30')][_0x9900('0xf')](_0x9900('0x1a5'));if(!_[_0x9900('0x3b')](_0x10a4bf['extra'])){this[_0x9900('0x30')][_0x9900('0x31')]=_0x10a4bf['extra'];}if(_0x2a338a[_0x9900('0xb3')]==='yes'){this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0x1a6'));return this[_0x9900('0x30')]['answer']();}return this[_0x9900('0x30')][_0x9900('0xa3')]('Skipped\x20Answer');};AGIVertices[_0x9900('0xe')]['subproject']=function(_0x47d9c8){logger[_0x9900('0x29')](util['format'](_0x9900('0x1a7'),_0x47d9c8[_0x9900('0xa2')]));if(!this['isConfigured'](_0x47d9c8[_0x9900('0x1a8')])){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x47d9c8,'no\x20subproject\x20selected');}var _0x5d7643=this[_0x9900('0x16')][_0x9900('0x9d')](this,_0x47d9c8[_0x9900('0x1a8')]);if(!this[_0x9900('0x7b')](_0x5d7643)){return this[_0x9900('0x30')]['error'](_0x47d9c8,util[_0x9900('0x24')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x47d9c8[_0x9900('0x1a8')]));}if(_0x5d7643===this['channel'][_0x9900('0x32')]){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x47d9c8,_0x9900('0x1a9'));}this[_0x9900('0x2f')][_0x9900('0x9d')](this,_0x47d9c8,_0x5d7643);var _0x56992b=this[_0x9900('0x30')][_0x9900('0xa5')](_0x9900('0x1aa'),util[_0x9900('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9900('0xb0')][_0x9900('0x1ab')]||'127.0.0.1',_0x5d7643,this['channel'][_0x9900('0x32')]));if(_0x56992b[_0x9900('0xa6')]===-0x1){return _0x56992b;}return this[_0x9900('0x30')][_0x9900('0xa3')](util['format'](_0x9900('0xbe'),'AGI',_0x5d7643));};AGIVertices[_0x9900('0xe')][_0x9900('0x1ac')]=function(_0x417b4c){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x1ad'),_0x417b4c['label']));var _0x16c8c6=this['shellCommand'][_0x9900('0x9d')](this,_0x417b4c[_0x9900('0x1ae')]);this[_0x9900('0x2f')]['sync'](this,_0x417b4c,_0x417b4c[_0x9900('0x1ae')]);if(this[_0x9900('0x7b')](_0x417b4c[_0x9900('0xd7')])){var _0x311041=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x417b4c['variable_id']);if(_0x311041){this[_0x9900('0x30')][_0x9900('0x97')](_0x311041,_0x16c8c6);return this[_0x9900('0x30')][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x1af'),_0x417b4c[_0x9900('0x1ae')],_0x311041));}}return this['channel']['noop'](util[_0x9900('0x24')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x417b4c[_0x9900('0x1ae')]));};AGIVertices[_0x9900('0xe')]['google_cloud_tts']=function(_0x2b85db){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x1b0'),_0x2b85db[_0x9900('0xa2')]));_0x2b85db[_0x9900('0x53')]=_0x2b85db[_0x9900('0x53')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9900('0x7b')](_0x2b85db[_0x9900('0x51')])){return this[_0x9900('0x30')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x9900('0x7b')](_0x2b85db['text'])){return this[_0x9900('0x30')][_0x9900('0xa3')]('no\x20text\x20configured');}this[_0x9900('0x30')][_0x9900('0xa3')](util['format'](_0x9900('0x1b1'),_0x2b85db[_0x9900('0x53')]));var _0xac7c58=this[_0x9900('0x50')][_0x9900('0x9d')](this,_0x2b85db);if(_0xac7c58){this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x1b2'),_0xac7c58));var _0x4accce=this[_0x9900('0x30')]['streamFile'](_0xac7c58);try{fs[_0x9900('0xff')](_0xac7c58+'.wav');}catch(_0x502faf){logger['error'](_0x502faf);}return _0x4accce;}return this[_0x9900('0x30')]['error'](_0x2b85db,_0x9900('0x1b3'));};AGIVertices[_0x9900('0xe')]['tts']=function(_0x3d84e8){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x1b4'),_0x3d84e8[_0x9900('0xa2')]));_0x3d84e8[_0x9900('0x53')]=_0x3d84e8[_0x9900('0x53')][_0x9900('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d84e8[_0x9900('0x53')])){return this[_0x9900('0x30')][_0x9900('0xa3')](_0x9900('0xa4'));}this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0x1b5'),_0x3d84e8[_0x9900('0x53')]));var _0x2b775a=this[_0x9900('0x5a')][_0x9900('0x9d')](this,_0x3d84e8);if(_0x2b775a){this[_0x9900('0x30')]['noop'](util[_0x9900('0x24')](_0x9900('0x1b6'),_0x2b775a));var _0x4e588f=this[_0x9900('0x30')][_0x9900('0xfe')](_0x2b775a);try{fs[_0x9900('0xff')](_0x2b775a+'.wav');}catch(_0x56a486){logger['error'](_0x56a486);}return _0x4e588f;}return this[_0x9900('0x30')]['error'](_0x3d84e8,_0x9900('0x1b7'));};AGIVertices['prototype'][_0x9900('0x1b8')]=function(_0x3938fc){logger[_0x9900('0x29')](util[_0x9900('0x24')](_0x9900('0x1b9'),_0x3938fc['label']));if(!this[_0x9900('0x7b')](_0x3938fc['findBy'])){return this[_0x9900('0x30')]['error'](_0x3938fc,_0x9900('0x15b'));}logger['info'](util[_0x9900('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9900('0x30')][_0x9900('0x33')],_0x3938fc[_0x9900('0x155')]));var _0x3ab0c1=this[_0x9900('0x47')][_0x9900('0x9d')](this,_0x3938fc[_0x9900('0x155')]);if(_0x3ab0c1){logger[_0x9900('0x29')](util[_0x9900('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9900('0x30')][_0x9900('0x33')],_0x3938fc['findBy']));this['channel'][_0x9900('0xa3')](util['format'](_0x9900('0x157'),this[_0x9900('0x30')][_0x9900('0x33')],_0x3938fc[_0x9900('0x155')]));return{'code':0xc8,'result':_0x9900('0x15c')};}else{logger[_0x9900('0x29')](util[_0x9900('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x9900('0x33')],_0x3938fc['findBy']));this['channel'][_0x9900('0xa3')](util[_0x9900('0x24')](_0x9900('0x158'),this[_0x9900('0x30')][_0x9900('0x33')],_0x3938fc[_0x9900('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9900('0xe')][_0x9900('0x1ba')]=function(_0x37fc31){logger[_0x9900('0x29')](util['format'](_0x9900('0x1bb'),_0x37fc31['label']));var _0x295a37=this[_0x9900('0x30')][_0x9900('0xa5')](_0x9900('0x1bc'),[_0x37fc31[_0x9900('0x1bd')],_0x37fc31[_0x9900('0x6c')]]);if(_0x295a37[_0x9900('0xa6')]===-0x1){return _0x295a37;}return this[_0x9900('0x30')][_0x9900('0xa3')](util['format'](_0x9900('0xbe'),'VOICEMAIL',_0x37fc31['mailbox']));};AGIVertices[_0x9900('0xe')][_0x9900('0x1be')]=function(_0x467351){logger[_0x9900('0x29')](util['format'](_0x9900('0x1bf'),_0x467351[_0x9900('0xa2')]));if(!this[_0x9900('0x7b')](_0x467351['variable_id'])){return this['channel']['error'](_0x467351,_0x9900('0x1a0'));}var _0x360059=this[_0x9900('0xf')][_0x9900('0x9d')](this,_0x467351[_0x9900('0xd7')]);if(!_0x360059){return this[_0x9900('0x30')][_0x9900('0x2d')](_0x467351,_0x9900('0x115'));}var _0x4cd694=this[_0x9900('0x30')][_0x9900('0xf')](_0x360059);return{'code':0xc8,'result':_0x4cd694[_0x9900('0x9a')]?_0x4cd694[_0x9900('0x9a')]:'-'};};String['prototype'][_0x9900('0x99')]=function(_0x491901,_0x5c7172){return this[_0x9900('0x98')](_0x491901)[_0x9900('0x1c0')](_0x5c7172);};module[_0x9900('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0859a30..368d33e 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 _0xc6ac=['moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash'];(function(_0x2af22b,_0x3a1381){var _0x341910=function(_0x3d3797){while(--_0x3d3797){_0x2af22b['push'](_0x2af22b['shift']());}};_0x341910(++_0x3a1381);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2e7d7c,_0x69e8bf){_0x2e7d7c=_0x2e7d7c-0x0;var _0x3e2a57=_0xc6ac[_0x2e7d7c];return _0x3e2a57;};'use strict';var _=require(_0xcc6a('0x0'));var moment=require(_0xcc6a('0x1'));var ami=require(_0xcc6a('0x2'));var logger=require(_0xcc6a('0x3'))(_0xcc6a('0x4'));var RpcUser=require(_0xcc6a('0x5'));var RpcVoiceAgentReport=require(_0xcc6a('0x6'));function Acw(_0x31bbcd){this[_0xcc6a('0x7')]=_0x31bbcd[_0xcc6a('0x7')];this[_0xcc6a('0x8')]=_0x31bbcd[_0xcc6a('0x8')];this[_0xcc6a('0x9')]=_0x31bbcd[_0xcc6a('0x9')];this['channels']={};ami['on'](_0xcc6a('0xa'),this[_0xcc6a('0xb')][_0xcc6a('0xc')](this));ami['on']('hanguprequest',this[_0xcc6a('0xd')][_0xcc6a('0xc')](this));ami['on'](_0xcc6a('0xe'),this[_0xcc6a('0xf')][_0xcc6a('0xc')](this));ami['on']('agentringnoanswer',this[_0xcc6a('0x10')][_0xcc6a('0xc')](this));ami['on'](_0xcc6a('0x11'),this['syncAttendedTransfer'][_0xcc6a('0xc')](this));ami['on'](_0xcc6a('0x12'),this[_0xcc6a('0x13')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xcc6a('0x14')][_0xcc6a('0xc')](this));}function getDiff(_0x4300c0){var _0x559a0a=moment()['milliseconds'](0x0);var _0x369dc1=moment(_0x4300c0)[_0xcc6a('0x15')](0x0);return _0x559a0a[_0xcc6a('0x16')](_0x369dc1,_0xcc6a('0x17'));}Acw[_0xcc6a('0x18')][_0xcc6a('0x19')]=function(_0x4133fa,_0x403b18){var _0x56ffb0=this;var _0x4e628f=getDiff(_0x56ffb0['timers'][_0x4133fa][_0xcc6a('0x1a')]);clearTimeout(_0x56ffb0[_0xcc6a('0x9')][_0x4133fa][_0xcc6a('0x1b')]);_0x56ffb0[_0xcc6a('0x9')][_0x4133fa][_0xcc6a('0x1b')]=![];return RpcVoiceAgentReport[_0xcc6a('0x1c')]({'acwtime':_0x4e628f},_0x56ffb0[_0xcc6a('0x9')][_0x4133fa][_0xcc6a('0x1d')],_0x4133fa)[_0xcc6a('0x1e')](function(_0x2a3994){logger[_0xcc6a('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x403b18,_0x4e628f,_0x2a3994);})[_0xcc6a('0x20')](function(_0x3e1fda){logger[_0xcc6a('0x21')](_0xcc6a('0x22'),_0x403b18,_0x3e1fda);})[_0xcc6a('0x23')](function(){delete _0x56ffb0[_0xcc6a('0x9')][_0x4133fa];});};Acw[_0xcc6a('0x18')][_0xcc6a('0x24')]=function(_0x2254a8){try{var _0x19d32c=this;var _0x329d17=this[_0xcc6a('0x25')][_0x2254a8]['interface'];var _0x41c4c8=this[_0xcc6a('0x25')][_0x2254a8][_0xcc6a('0x26')];var _0x581aae=this[_0xcc6a('0x7')][_0x41c4c8];var _0x294486=![];var _0x3a00e5=_0xcc6a('0x27');if(_0x581aae[_0xcc6a('0x28')]&&_0x581aae[_0xcc6a('0x29')]['name']){_0x294486=!![];_0x3a00e5=_0x581aae[_0xcc6a('0x29')][_0xcc6a('0x2a')];}if(!_0x19d32c[_0xcc6a('0x8')][_0x329d17]){return Promise['resolve']();}return RpcUser[_0xcc6a('0x2b')](_0x19d32c[_0xcc6a('0x8')][_0x329d17]['id'])['then'](function(_0xb377de){if(!_0xb377de||_0xb377de[_0xcc6a('0x2c')]){logger[_0xcc6a('0x1f')](_0xcc6a('0x2d'),_0x2254a8,_0x329d17,_0x41c4c8);return;}logger['info'](_0xcc6a('0x2e'),_0x2254a8,_0x329d17,_0x41c4c8);var _0x3cf14c=_0x19d32c[_0xcc6a('0x25')][_0x2254a8]['attended']&&_0x19d32c[_0xcc6a('0x25')][_0x2254a8]['destlinkedid']?_0x19d32c['channels'][_0x2254a8][_0xcc6a('0x2f')]:_0x2254a8;return RpcUser[_0xcc6a('0x30')](_0x19d32c[_0xcc6a('0x8')][_0x329d17],_0x3a00e5,_0x3cf14c);})[_0xcc6a('0x1e')](function(_0x2b575d){if(_0x294486||!_0x2b575d){return;}_0x19d32c[_0xcc6a('0x9')][_0x329d17]={};logger['info'](_0xcc6a('0x31'),_0x2254a8,_0x19d32c[_0xcc6a('0x7')][_0x41c4c8][_0xcc6a('0x32')],_0x329d17,_0x41c4c8);_0x19d32c[_0xcc6a('0x9')][_0x329d17][_0xcc6a('0x1b')]=setTimeout(_0x19d32c[_0xcc6a('0x33')][_0xcc6a('0xc')](_0x19d32c,_0x329d17),_0x19d32c[_0xcc6a('0x7')][_0x41c4c8]['acwTimeout']*0x3e8);_0x19d32c[_0xcc6a('0x9')][_0x329d17][_0xcc6a('0x1a')]=moment()[_0xcc6a('0x34')](_0xcc6a('0x35'));_0x19d32c[_0xcc6a('0x9')][_0x329d17][_0xcc6a('0x1d')]=_0x2254a8;_0x19d32c[_0xcc6a('0x9')][_0x329d17]['queue']=_0x41c4c8;_0x19d32c[_0xcc6a('0x9')][_0x329d17]['updateAcw']=_0x19d32c['updateAcw']['bind'](_0x19d32c,_0x329d17,_0x2254a8);})[_0xcc6a('0x20')](function(){logger[_0xcc6a('0x21')](_0xcc6a('0x31'),_0x2254a8,_0x19d32c[_0xcc6a('0x7')][_0x41c4c8][_0xcc6a('0x32')],_0x329d17,_0x41c4c8);})['finally'](function(){delete _0x19d32c['channels'][_0x2254a8];});}catch(_0x10f47d){logger[_0xcc6a('0x21')](_0xcc6a('0x36'),_0x10f47d['message']);}};Acw[_0xcc6a('0x18')][_0xcc6a('0x33')]=function(_0x7449c1){try{var _0xa326b2=this;if(_0xa326b2[_0xcc6a('0x9')][_0x7449c1]){_0xa326b2[_0xcc6a('0x9')][_0x7449c1][_0xcc6a('0x1b')]=![];var _0x18a252=_0xa326b2[_0xcc6a('0x9')][_0x7449c1][_0xcc6a('0x1d')];var _0x5b11c8=_0xa326b2[_0xcc6a('0x9')][_0x7449c1][_0xcc6a('0x26')];var _0x349f07=_0xa326b2[_0xcc6a('0x7')][_0x5b11c8][_0xcc6a('0x32')];logger[_0xcc6a('0x1f')](_0xcc6a('0x37'),_0x18a252,_0x7449c1);RpcUser['saveUnpause'](this['agents'][_0x7449c1]);RpcVoiceAgentReport[_0xcc6a('0x1c')]({'acwtime':_0x349f07,'agentacw':!![]},_0x18a252,_0x7449c1)[_0xcc6a('0x1e')](function(_0x16dde7){logger[_0xcc6a('0x1f')](_0xcc6a('0x38'),_0x18a252,_0x349f07,_0x16dde7);})[_0xcc6a('0x20')](function(_0x3273bc){logger[_0xcc6a('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x18a252,_0x3273bc);});}else{logger['error'](_0xcc6a('0x39'),_0x7449c1);if(_0xa326b2['timers']){logger['info']('[ACW][TIMERS]',JSON[_0xcc6a('0x3a')](_0xa326b2[_0xcc6a('0x9')]));}}}catch(_0xb42897){logger[_0xcc6a('0x21')](_0xcc6a('0x3b'),_0xb42897['message']);}};Acw[_0xcc6a('0x18')][_0xcc6a('0xb')]=function(_0x17e5a0){try{if(this[_0xcc6a('0x7')][_0x17e5a0[_0xcc6a('0x26')]]&&(this[_0xcc6a('0x7')][_0x17e5a0['queue']][_0xcc6a('0x4')]||this[_0xcc6a('0x7')][_0x17e5a0[_0xcc6a('0x26')]][_0xcc6a('0x28')])){if(this['agents'][_0x17e5a0[_0xcc6a('0x3c')]]){this['channels'][_0x17e5a0[_0xcc6a('0x1d')]]={'queue':_0x17e5a0[_0xcc6a('0x26')],'interface':_0x17e5a0[_0xcc6a('0x3c')],'destlinkedid':_0x17e5a0['destlinkedid']};}}}catch(_0x3c2cef){logger[_0xcc6a('0x21')](_0xcc6a('0x3d'),_0x3c2cef['message']);}};Acw['prototype'][_0xcc6a('0x14')]=function(_0x3b32c0){try{if(this[_0xcc6a('0x7')][_0x3b32c0[_0xcc6a('0x26')]]&&(this[_0xcc6a('0x7')][_0x3b32c0['queue']][_0xcc6a('0x4')]||this[_0xcc6a('0x7')][_0x3b32c0['queue']][_0xcc6a('0x28')])){if(this[_0xcc6a('0x8')][_0x3b32c0[_0xcc6a('0x3c')]]){this[_0xcc6a('0x25')][_0x3b32c0[_0xcc6a('0x1d')]]={'queue':_0x3b32c0[_0xcc6a('0x26')],'interface':_0x3b32c0['interface']};}}}catch(_0x4e1a0b){logger['error'](_0xcc6a('0x3e'),_0x4e1a0b[_0xcc6a('0x3f')]);}};Acw[_0xcc6a('0x18')][_0xcc6a('0xd')]=function(_0x4a25ce){try{if(this[_0xcc6a('0x25')][_0x4a25ce['uniqueid']]&&_[_0xcc6a('0x40')](this[_0xcc6a('0x25')][_0x4a25ce[_0xcc6a('0x1d')]][_0xcc6a('0x41')])){logger[_0xcc6a('0x1f')](_0xcc6a('0x42'),_0x4a25ce['uniqueid']);this[_0xcc6a('0x24')](_0x4a25ce[_0xcc6a('0x1d')]);}else if(this[_0xcc6a('0x25')][_0x4a25ce[_0xcc6a('0x43')]]&&_[_0xcc6a('0x40')](this[_0xcc6a('0x25')][_0x4a25ce[_0xcc6a('0x43')]][_0xcc6a('0x41')])){logger[_0xcc6a('0x1f')](_0xcc6a('0x44'),_0x4a25ce['linkedid']);this[_0xcc6a('0x24')](_0x4a25ce[_0xcc6a('0x43')]);}}catch(_0xbed299){logger[_0xcc6a('0x21')](_0xcc6a('0x45'),_0xbed299[_0xcc6a('0x3f')]);}};Acw['prototype']['syncHangup']=function(_0x5d5016){try{if(this['channels'][_0x5d5016[_0xcc6a('0x1d')]]&&this[_0xcc6a('0x25')][_0x5d5016[_0xcc6a('0x1d')]][_0xcc6a('0x41')]){logger[_0xcc6a('0x1f')](_0xcc6a('0x46'),_0x5d5016[_0xcc6a('0x1d')]);this[_0xcc6a('0x24')](_0x5d5016[_0xcc6a('0x1d')]);}else if(this[_0xcc6a('0x25')][_0x5d5016[_0xcc6a('0x43')]]&&this['channels'][_0x5d5016[_0xcc6a('0x43')]]['attended']){logger[_0xcc6a('0x1f')](_0xcc6a('0x47'),_0x5d5016[_0xcc6a('0x43')]);this['startAcw'](_0x5d5016[_0xcc6a('0x43')]);}}catch(_0x58ff89){logger[_0xcc6a('0x21')]('[ACW][syncHangup]\x20%s',_0x58ff89[_0xcc6a('0x3f')]);}};Acw[_0xcc6a('0x18')][_0xcc6a('0x48')]=function(_0xe212e8){try{if(!_[_0xcc6a('0x49')](this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4a')]])){this[_0xcc6a('0x24')](_0xe212e8['transfereeuniqueid']);if(this[_0xcc6a('0x25')][_0xe212e8['secondtransfereruniqueid']]){this[_0xcc6a('0x25')][_0xe212e8['secondtransfereruniqueid']][_0xcc6a('0x41')]=!![];this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4b')]]=this['channels'][_0xe212e8[_0xcc6a('0x4c')]];delete this['channels'][_0xe212e8['secondtransfereruniqueid']];}}else if(!_[_0xcc6a('0x49')](this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4b')]])){this[_0xcc6a('0x24')](_0xe212e8[_0xcc6a('0x4b')]);if(this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4d')]]){this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4d')]][_0xcc6a('0x41')]=!![];this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4a')]]=this[_0xcc6a('0x25')][_0xe212e8['origtransfereruniqueid']];delete this[_0xcc6a('0x25')][_0xe212e8[_0xcc6a('0x4d')]];}}}catch(_0x5ce4a3){logger[_0xcc6a('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x5ce4a3[_0xcc6a('0x3f')]);}};Acw[_0xcc6a('0x18')][_0xcc6a('0x13')]=function(_0x2ffe07){try{if(this[_0xcc6a('0x25')][_0x2ffe07[_0xcc6a('0x4e')]]){logger[_0xcc6a('0x1f')](_0xcc6a('0x4f'),JSON[_0xcc6a('0x3a')](_0x2ffe07[_0xcc6a('0x4e')]));this['startAcw'](_0x2ffe07['transfereruniqueid']);}else if(this['channels'][_0x2ffe07[_0xcc6a('0x50')]]){logger[_0xcc6a('0x1f')](_0xcc6a('0x51'),JSON['stringify'](_0x2ffe07[_0xcc6a('0x50')]));this[_0xcc6a('0x24')](_0x2ffe07[_0xcc6a('0x50')]);}}catch(_0x1556c0){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x1556c0[_0xcc6a('0x3f')]);}};Acw[_0xcc6a('0x18')][_0xcc6a('0x10')]=function(_0x386a74){try{if(this['voiceQueues'][_0x386a74[_0xcc6a('0x26')]]&&this[_0xcc6a('0x7')][_0x386a74[_0xcc6a('0x26')]][_0xcc6a('0x52')]===_0xcc6a('0x53')){if(this['agents'][_0x386a74['interface']]){logger[_0xcc6a('0x1f')](_0xcc6a('0x54'),_0x386a74[_0xcc6a('0x1d')],_0x386a74[_0xcc6a('0x3c')],_0x386a74['queue']);return RpcUser['savePause'](this[_0xcc6a('0x8')][_0x386a74[_0xcc6a('0x3c')]],_0xcc6a('0x55'),_0x386a74[_0xcc6a('0x1d')]);}}}catch(_0x517345){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x517345[_0xcc6a('0x3f')]);}};module[_0xcc6a('0x56')]=Acw; \ No newline at end of file +var _0x9505=['syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','channels','queue','voiceQueues','mandatoryDispositionPause','name','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','message','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview'];(function(_0x271eb6,_0x309c4a){var _0x52b40b=function(_0x4b5657){while(--_0x4b5657){_0x271eb6['push'](_0x271eb6['shift']());}};_0x52b40b(++_0x309c4a);}(_0x9505,0x1e5));var _0x5950=function(_0x4d00e9,_0x187625){_0x4d00e9=_0x4d00e9-0x0;var _0x5d8130=_0x9505[_0x4d00e9];return _0x5d8130;};'use strict';var _=require(_0x5950('0x0'));var moment=require(_0x5950('0x1'));var ami=require('../ami');var logger=require(_0x5950('0x2'))(_0x5950('0x3'));var RpcUser=require(_0x5950('0x4'));var RpcVoiceAgentReport=require(_0x5950('0x5'));function Acw(_0x1344e4){this['voiceQueues']=_0x1344e4['voiceQueues'];this[_0x5950('0x6')]=_0x1344e4[_0x5950('0x6')];this[_0x5950('0x7')]=_0x1344e4[_0x5950('0x7')];this['channels']={};ami['on']('agentconnect',this[_0x5950('0x8')][_0x5950('0x9')](this));ami['on'](_0x5950('0xa'),this[_0x5950('0xb')][_0x5950('0x9')](this));ami['on'](_0x5950('0xc'),this[_0x5950('0xd')][_0x5950('0x9')](this));ami['on'](_0x5950('0xe'),this['syncAgentRingNoAnswer'][_0x5950('0x9')](this));ami['on'](_0x5950('0xf'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x5950('0x10'),this[_0x5950('0x11')][_0x5950('0x9')](this));ami['on'](_0x5950('0x12'),this[_0x5950('0x13')][_0x5950('0x9')](this));}function getDiff(_0x17c263){var _0x38d757=moment()[_0x5950('0x14')](0x0);var _0x384e80=moment(_0x17c263)[_0x5950('0x14')](0x0);return _0x38d757[_0x5950('0x15')](_0x384e80,_0x5950('0x16'));}Acw[_0x5950('0x17')][_0x5950('0x18')]=function(_0xa6c598,_0x4ad4d8){var _0x3c469d=this;var _0x26f3c3=getDiff(_0x3c469d[_0x5950('0x7')][_0xa6c598][_0x5950('0x19')]);clearTimeout(_0x3c469d['timers'][_0xa6c598]['timer']);_0x3c469d[_0x5950('0x7')][_0xa6c598][_0x5950('0x1a')]=![];return RpcVoiceAgentReport[_0x5950('0x1b')]({'acwtime':_0x26f3c3},_0x3c469d[_0x5950('0x7')][_0xa6c598][_0x5950('0x1c')],_0xa6c598)['then'](function(_0x49bb78){logger[_0x5950('0x1d')](_0x5950('0x1e'),_0x4ad4d8,_0x26f3c3,_0x49bb78);})[_0x5950('0x1f')](function(_0x5bd90e){logger[_0x5950('0x20')](_0x5950('0x21'),_0x4ad4d8,_0x5bd90e);})['finally'](function(){delete _0x3c469d['timers'][_0xa6c598];});};Acw['prototype']['startAcw']=function(_0x3519da){try{var _0x110a57=this;var _0x66c416=this[_0x5950('0x22')][_0x3519da]['interface'];var _0x72bffe=this[_0x5950('0x22')][_0x3519da][_0x5950('0x23')];var _0x1bd0ad=this[_0x5950('0x24')][_0x72bffe];var _0x1bd3b3=![];var _0x4683fc='ACW';if(_0x1bd0ad['mandatoryDisposition']&&_0x1bd0ad[_0x5950('0x25')][_0x5950('0x26')]){_0x1bd3b3=!![];_0x4683fc=_0x1bd0ad[_0x5950('0x25')][_0x5950('0x26')];}if(!_0x110a57[_0x5950('0x6')][_0x66c416]){return Promise['resolve']();}return RpcUser['getAgent'](_0x110a57['agents'][_0x66c416]['id'])[_0x5950('0x27')](function(_0x2ca436){if(!_0x2ca436||_0x2ca436[_0x5950('0x28')]){logger[_0x5950('0x1d')](_0x5950('0x29'),_0x3519da,_0x66c416,_0x72bffe);return;}logger[_0x5950('0x1d')](_0x5950('0x2a'),_0x3519da,_0x66c416,_0x72bffe);var _0x2dfd08=_0x110a57[_0x5950('0x22')][_0x3519da][_0x5950('0x2b')]&&_0x110a57[_0x5950('0x22')][_0x3519da][_0x5950('0x2c')]?_0x110a57[_0x5950('0x22')][_0x3519da][_0x5950('0x2c')]:_0x3519da;return RpcUser[_0x5950('0x2d')](_0x110a57[_0x5950('0x6')][_0x66c416],_0x4683fc,_0x2dfd08);})[_0x5950('0x27')](function(_0x18a8ca){if(_0x1bd3b3||!_0x18a8ca){return;}_0x110a57[_0x5950('0x7')][_0x66c416]={};logger[_0x5950('0x1d')](_0x5950('0x2e'),_0x3519da,_0x110a57[_0x5950('0x24')][_0x72bffe][_0x5950('0x2f')],_0x66c416,_0x72bffe);_0x110a57[_0x5950('0x7')][_0x66c416][_0x5950('0x1a')]=setTimeout(_0x110a57[_0x5950('0x30')][_0x5950('0x9')](_0x110a57,_0x66c416),_0x110a57[_0x5950('0x24')][_0x72bffe]['acwTimeout']*0x3e8);_0x110a57[_0x5950('0x7')][_0x66c416][_0x5950('0x19')]=moment()[_0x5950('0x31')](_0x5950('0x32'));_0x110a57[_0x5950('0x7')][_0x66c416]['uniqueid']=_0x3519da;_0x110a57['timers'][_0x66c416][_0x5950('0x23')]=_0x72bffe;_0x110a57[_0x5950('0x7')][_0x66c416]['updateAcw']=_0x110a57[_0x5950('0x18')]['bind'](_0x110a57,_0x66c416,_0x3519da);})[_0x5950('0x1f')](function(){logger[_0x5950('0x20')](_0x5950('0x2e'),_0x3519da,_0x110a57['voiceQueues'][_0x72bffe][_0x5950('0x2f')],_0x66c416,_0x72bffe);})['finally'](function(){delete _0x110a57[_0x5950('0x22')][_0x3519da];});}catch(_0x112cf0){logger[_0x5950('0x20')](_0x5950('0x33'),_0x112cf0['message']);}};Acw[_0x5950('0x17')][_0x5950('0x30')]=function(_0x264e8f){try{var _0x4ad1e0=this;if(_0x4ad1e0[_0x5950('0x7')][_0x264e8f]){_0x4ad1e0[_0x5950('0x7')][_0x264e8f]['timer']=![];var _0x55d1c7=_0x4ad1e0['timers'][_0x264e8f][_0x5950('0x1c')];var _0x15d6ad=_0x4ad1e0[_0x5950('0x7')][_0x264e8f][_0x5950('0x23')];var _0x3a8ed0=_0x4ad1e0['voiceQueues'][_0x15d6ad]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x55d1c7,_0x264e8f);RpcUser[_0x5950('0x34')](this[_0x5950('0x6')][_0x264e8f]);RpcVoiceAgentReport[_0x5950('0x1b')]({'acwtime':_0x3a8ed0,'agentacw':!![]},_0x55d1c7,_0x264e8f)[_0x5950('0x27')](function(_0x49b807){logger[_0x5950('0x1d')](_0x5950('0x1e'),_0x55d1c7,_0x3a8ed0,_0x49b807);})['catch'](function(_0x2e6f8a){logger[_0x5950('0x20')](_0x5950('0x21'),_0x55d1c7,_0x2e6f8a);});}else{logger[_0x5950('0x20')](_0x5950('0x35'),_0x264e8f);if(_0x4ad1e0[_0x5950('0x7')]){logger[_0x5950('0x1d')]('[ACW][TIMERS]',JSON[_0x5950('0x36')](_0x4ad1e0['timers']));}}}catch(_0x27b4b2){logger[_0x5950('0x20')]('[ACW][STOP]\x20%s',_0x27b4b2[_0x5950('0x37')]);}};Acw[_0x5950('0x17')][_0x5950('0x8')]=function(_0x2e9950){try{if(this['voiceQueues'][_0x2e9950[_0x5950('0x23')]]&&(this[_0x5950('0x24')][_0x2e9950[_0x5950('0x23')]][_0x5950('0x3')]||this['voiceQueues'][_0x2e9950[_0x5950('0x23')]][_0x5950('0x38')])){if(this[_0x5950('0x6')][_0x2e9950['interface']]){this[_0x5950('0x22')][_0x2e9950['uniqueid']]={'queue':_0x2e9950[_0x5950('0x23')],'interface':_0x2e9950[_0x5950('0x39')],'destlinkedid':_0x2e9950[_0x5950('0x2c')]};}}}catch(_0x1cca0e){logger[_0x5950('0x20')](_0x5950('0x3a'),_0x1cca0e[_0x5950('0x37')]);}};Acw['prototype'][_0x5950('0x13')]=function(_0x1c5255){try{if(this[_0x5950('0x24')][_0x1c5255[_0x5950('0x23')]]&&(this[_0x5950('0x24')][_0x1c5255['queue']]['acw']||this[_0x5950('0x24')][_0x1c5255[_0x5950('0x23')]][_0x5950('0x38')])){if(this['agents'][_0x1c5255[_0x5950('0x39')]]){this[_0x5950('0x22')][_0x1c5255[_0x5950('0x1c')]]={'queue':_0x1c5255['queue'],'interface':_0x1c5255['interface']};}}}catch(_0x49f202){logger[_0x5950('0x20')](_0x5950('0x3b'),_0x49f202[_0x5950('0x37')]);}};Acw[_0x5950('0x17')][_0x5950('0xb')]=function(_0x287470){try{if(this[_0x5950('0x22')][_0x287470[_0x5950('0x1c')]]&&_[_0x5950('0x3c')](this['channels'][_0x287470[_0x5950('0x1c')]][_0x5950('0x2b')])){logger[_0x5950('0x1d')](_0x5950('0x3d'),_0x287470[_0x5950('0x1c')]);this[_0x5950('0x3e')](_0x287470[_0x5950('0x1c')]);}else if(this[_0x5950('0x22')][_0x287470[_0x5950('0x3f')]]&&_[_0x5950('0x3c')](this['channels'][_0x287470[_0x5950('0x3f')]][_0x5950('0x2b')])){logger[_0x5950('0x1d')](_0x5950('0x40'),_0x287470['linkedid']);this['startAcw'](_0x287470[_0x5950('0x3f')]);}}catch(_0x3a596b){logger['error'](_0x5950('0x41'),_0x3a596b[_0x5950('0x37')]);}};Acw[_0x5950('0x17')][_0x5950('0xd')]=function(_0x65ebd9){try{if(this[_0x5950('0x22')][_0x65ebd9['uniqueid']]&&this[_0x5950('0x22')][_0x65ebd9[_0x5950('0x1c')]]['attended']){logger[_0x5950('0x1d')](_0x5950('0x42'),_0x65ebd9[_0x5950('0x1c')]);this['startAcw'](_0x65ebd9[_0x5950('0x1c')]);}else if(this[_0x5950('0x22')][_0x65ebd9[_0x5950('0x3f')]]&&this[_0x5950('0x22')][_0x65ebd9[_0x5950('0x3f')]][_0x5950('0x2b')]){logger[_0x5950('0x1d')](_0x5950('0x43'),_0x65ebd9[_0x5950('0x3f')]);this['startAcw'](_0x65ebd9[_0x5950('0x3f')]);}}catch(_0x3c3572){logger[_0x5950('0x20')](_0x5950('0x44'),_0x3c3572[_0x5950('0x37')]);}};Acw[_0x5950('0x17')][_0x5950('0x45')]=function(_0x5cb5eb){try{if(!_[_0x5950('0x46')](this['channels'][_0x5cb5eb[_0x5950('0x47')]])){this['startAcw'](_0x5cb5eb[_0x5950('0x47')]);if(this[_0x5950('0x22')][_0x5cb5eb['secondtransfereruniqueid']]){this[_0x5950('0x22')][_0x5cb5eb['secondtransfereruniqueid']][_0x5950('0x2b')]=!![];this[_0x5950('0x22')][_0x5cb5eb['transfertargetuniqueid']]=this['channels'][_0x5cb5eb[_0x5950('0x48')]];delete this[_0x5950('0x22')][_0x5cb5eb[_0x5950('0x48')]];}}else if(!_[_0x5950('0x46')](this[_0x5950('0x22')][_0x5cb5eb[_0x5950('0x49')]])){this[_0x5950('0x3e')](_0x5cb5eb[_0x5950('0x49')]);if(this['channels'][_0x5cb5eb['origtransfereruniqueid']]){this[_0x5950('0x22')][_0x5cb5eb['origtransfereruniqueid']][_0x5950('0x2b')]=!![];this[_0x5950('0x22')][_0x5cb5eb[_0x5950('0x47')]]=this[_0x5950('0x22')][_0x5cb5eb[_0x5950('0x4a')]];delete this['channels'][_0x5cb5eb[_0x5950('0x4a')]];}}}catch(_0x13eec7){logger[_0x5950('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0x13eec7['message']);}};Acw[_0x5950('0x17')]['syncBlindTransfer']=function(_0x620668){try{if(this[_0x5950('0x22')][_0x620668['transfereruniqueid']]){logger[_0x5950('0x1d')](_0x5950('0x4b'),JSON[_0x5950('0x36')](_0x620668[_0x5950('0x4c')]));this[_0x5950('0x3e')](_0x620668[_0x5950('0x4c')]);}else if(this['channels'][_0x620668[_0x5950('0x4d')]]){logger[_0x5950('0x1d')](_0x5950('0x4e'),JSON['stringify'](_0x620668['transfererlinkedid']));this[_0x5950('0x3e')](_0x620668[_0x5950('0x4d')]);}}catch(_0x6e40df){logger[_0x5950('0x20')](_0x5950('0x4f'),_0x6e40df[_0x5950('0x37')]);}};Acw['prototype'][_0x5950('0x50')]=function(_0x2b6d12){try{if(this[_0x5950('0x24')][_0x2b6d12[_0x5950('0x23')]]&&this['voiceQueues'][_0x2b6d12[_0x5950('0x23')]][_0x5950('0x51')]==='all'){if(this[_0x5950('0x6')][_0x2b6d12['interface']]){logger[_0x5950('0x1d')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2b6d12[_0x5950('0x1c')],_0x2b6d12[_0x5950('0x39')],_0x2b6d12['queue']);return RpcUser[_0x5950('0x2d')](this[_0x5950('0x6')][_0x2b6d12[_0x5950('0x39')]],'Auto-Pause',_0x2b6d12[_0x5950('0x1c')]);}}}catch(_0x347400){logger[_0x5950('0x20')](_0x5950('0x52'),_0x347400[_0x5950('0x37')]);}};module[_0x5950('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 82a4a0b..4895d6f 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 _0xfa26=['port','username','keepConnected','Action','promisify','action','error','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','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfa26,0x1db));var _0x6fa2=function(_0x183cb7,_0x29d767){_0x183cb7=_0x183cb7-0x0;var _0x2da570=_0xfa26[_0x183cb7];return _0x2da570;};'use strict';var Manager=require(_0x6fa2('0x0'));var BPromise=require(_0x6fa2('0x1'));var util=require(_0x6fa2('0x2'));var logger=require('../../config/logger')(_0x6fa2('0x3'));var config=require(_0x6fa2('0x4'));var ami=new Manager(config[_0x6fa2('0x5')][_0x6fa2('0x6')],config[_0x6fa2('0x5')]['ip'],config['asterisk'][_0x6fa2('0x7')],config[_0x6fa2('0x5')]['password'],!![]);ami[_0x6fa2('0x8')]();ami[_0x6fa2('0x9')]=BPromise[_0x6fa2('0xa')](ami[_0x6fa2('0xb')]);function error(_0x50e458){logger[_0x6fa2('0xc')](util['format'](_0x6fa2('0xd'),config[_0x6fa2('0x5')]['username'],config[_0x6fa2('0x5')]['ip'],config[_0x6fa2('0x5')][_0x6fa2('0x6')],util[_0x6fa2('0xe')](_0x50e458,![],null)));}function close(){logger[_0x6fa2('0xc')](util[_0x6fa2('0xf')](_0x6fa2('0x10'),config[_0x6fa2('0x5')][_0x6fa2('0x7')],config[_0x6fa2('0x5')]['ip'],config['asterisk'][_0x6fa2('0x6')]));}ami[_0x6fa2('0x11')]=function(){return function(){return ami[_0x6fa2('0x9')]({'action':'sipshowregistry'});};};ami[_0x6fa2('0x12')]=function(){return function(){return ami[_0x6fa2('0x9')]({'action':_0x6fa2('0x13')});};};ami[_0x6fa2('0x14')]=function(){return function(){return ami[_0x6fa2('0x9')]({'action':_0x6fa2('0x15')});};};ami[_0x6fa2('0x16')]=function(){return function(){return ami[_0x6fa2('0x9')]({'action':_0x6fa2('0x17')});};};ami[_0x6fa2('0x18')]=function(){return function(){return ami[_0x6fa2('0x9')]({'action':_0x6fa2('0x19')});};};function connect(){logger[_0x6fa2('0x1a')](util['format'](_0x6fa2('0x1b'),config[_0x6fa2('0x5')]['username'],config[_0x6fa2('0x5')]['ip'],config['asterisk'][_0x6fa2('0x6')]));ami['once'](_0x6fa2('0xc'),error);ami[_0x6fa2('0x1c')]('close',close);}ami['on'](_0x6fa2('0x1d'),connect);ami['on'](_0x6fa2('0x1e'),function(_0x54f589){logger[_0x6fa2('0x1a')](util[_0x6fa2('0xf')](_0x6fa2('0x1f'),config[_0x6fa2('0x5')][_0x6fa2('0x7')],config[_0x6fa2('0x5')]['ip'],config[_0x6fa2('0x5')][_0x6fa2('0x6')],util[_0x6fa2('0xe')](_0x54f589,![],null)));});ami['on'](_0x6fa2('0x20'),function(){logger[_0x6fa2('0x1a')](util[_0x6fa2('0xf')](_0x6fa2('0x21'),config[_0x6fa2('0x5')][_0x6fa2('0x7')],config['asterisk']['ip'],config[_0x6fa2('0x5')][_0x6fa2('0x6')]));return Promise[_0x6fa2('0x22')]()[_0x6fa2('0x23')](ami[_0x6fa2('0x11')]())[_0x6fa2('0x23')](ami[_0x6fa2('0x12')]())[_0x6fa2('0x23')](ami[_0x6fa2('0x14')]())[_0x6fa2('0x23')](ami[_0x6fa2('0x16')]())[_0x6fa2('0x23')](ami[_0x6fa2('0x18')]())['catch'](function(_0x41d1eb){logger['error']('[ami.js][fullybooted]',util[_0x6fa2('0xe')](_0x41d1eb,{'showHidden':![],'depth':null}));});});ami[_0x6fa2('0x1c')](_0x6fa2('0xc'),error);ami[_0x6fa2('0x1c')]('close',close);module[_0x6fa2('0x24')]=ami; \ No newline at end of file +var _0x0821=['ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','[ami.js][fullybooted]','close','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0821,0xb7));var _0x1082=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x0821[_0x4bfac3];return _0x15f0f2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var logger=require('../../config/logger')(_0x1082('0x2'));var config=require(_0x1082('0x3'));var ami=new Manager(config[_0x1082('0x4')][_0x1082('0x5')],config['asterisk']['ip'],config['asterisk'][_0x1082('0x6')],config[_0x1082('0x4')][_0x1082('0x7')],!![]);ami[_0x1082('0x8')]();ami['Action']=BPromise[_0x1082('0x9')](ami['action']);function error(_0x3261e0){logger[_0x1082('0xa')](util[_0x1082('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x1082('0x4')][_0x1082('0x6')],config['asterisk']['ip'],config[_0x1082('0x4')]['port'],util['inspect'](_0x3261e0,![],null)));}function close(){logger[_0x1082('0xa')](util[_0x1082('0xb')](_0x1082('0xc'),config[_0x1082('0x4')][_0x1082('0x6')],config[_0x1082('0x4')]['ip'],config[_0x1082('0x4')][_0x1082('0x5')]));}ami[_0x1082('0xd')]=function(){return function(){return ami['Action']({'action':_0x1082('0xe')});};};ami[_0x1082('0xf')]=function(){return function(){return ami[_0x1082('0x10')]({'action':_0x1082('0x11')});};};ami[_0x1082('0x12')]=function(){return function(){return ami[_0x1082('0x10')]({'action':_0x1082('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x1082('0x14')});};};ami[_0x1082('0x15')]=function(){return function(){return ami['Action']({'action':_0x1082('0x16')});};};function connect(){logger[_0x1082('0x17')](util[_0x1082('0xb')](_0x1082('0x18'),config[_0x1082('0x4')][_0x1082('0x6')],config[_0x1082('0x4')]['ip'],config[_0x1082('0x4')][_0x1082('0x5')]));ami[_0x1082('0x19')](_0x1082('0xa'),error);ami[_0x1082('0x19')]('close',close);}ami['on'](_0x1082('0x1a'),connect);ami['on'](_0x1082('0x1b'),function(_0x1e6633){logger[_0x1082('0x17')](util[_0x1082('0xb')](_0x1082('0x1c'),config[_0x1082('0x4')][_0x1082('0x6')],config[_0x1082('0x4')]['ip'],config[_0x1082('0x4')][_0x1082('0x5')],util[_0x1082('0x1d')](_0x1e6633,![],null)));});ami['on'](_0x1082('0x1e'),function(){logger[_0x1082('0x17')](util['format'](_0x1082('0x1f'),config['asterisk'][_0x1082('0x6')],config[_0x1082('0x4')]['ip'],config[_0x1082('0x4')][_0x1082('0x5')]));return Promise['resolve']()[_0x1082('0x20')](ami['actionSipShowRegistry']())[_0x1082('0x20')](ami[_0x1082('0xf')]())[_0x1082('0x20')](ami[_0x1082('0x12')]())['then'](ami[_0x1082('0x21')]())[_0x1082('0x20')](ami['actionCoreShowChannels']())[_0x1082('0x22')](function(_0x431968){logger[_0x1082('0xa')](_0x1082('0x23'),util[_0x1082('0x1d')](_0x431968,{'showHidden':![],'depth':null}));});});ami[_0x1082('0x19')](_0x1082('0xa'),error);ami[_0x1082('0x19')](_0x1082('0x24'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index dacc513..1671110 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x575d6b,_0x3f86c1){var _0x2c9819=function(_0x556844){while(--_0x556844){_0x575d6b['push'](_0x575d6b['shift']());}};_0x2c9819(++_0x3f86c1);}(_0xaa88,0x137));var _0x8aa8=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xaa88[_0xe66cf2];return _0x2d84e7;};'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 +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x6e9649,_0x10416d){var _0x4aca71=function(_0x3a2d98){while(--_0x3a2d98){_0x6e9649['push'](_0x6e9649['shift']());}};_0x4aca71(++_0x10416d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cb3a7a1..bee0d50 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 _0xc60e=['\x20NOT\x20Active','campaign:ivr:%s','campaign:save','inspect','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','reachable','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','ifTime','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','content','true','catch','iftime\x20%s,%s','indexOf','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','dialMethod','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','TIMEOUT','dialQueueProject2','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','statedesc','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','isNil','locked','paused','stateinterface','rrmemory','strategy','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','preview','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','dialAMDActive','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','value','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','dialGlobalMaxRetry','dialMachineMaxRetry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','loggedIn','busyFactor','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','--------\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','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','exports','lodash','moment','ioredis','./utils','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','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','---------------------------','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---------','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','handlePredictive','stack','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals'];(function(_0x40fde7,_0x446e8d){var _0x25362d=function(_0x159bd1){while(--_0x159bd1){_0x40fde7['push'](_0x40fde7['shift']());}};_0x25362d(++_0x446e8d);}(_0xc60e,0x1ae));var _0xec60=function(_0x4e401c,_0x2fceb2){_0x4e401c=_0x4e401c-0x0;var _0x16bfd3=_0xc60e[_0x4e401c];return _0x16bfd3;};'use strict';var util=require('util');var _=require(_0xec60('0x0'));var uuid=require('uuid');var moment=require(_0xec60('0x1'));var rr=require('rr');var Redis=require(_0xec60('0x2'));var utils=require(_0xec60('0x3'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xec60('0x4'))(_0xec60('0x5'));var loggerBooked=require(_0xec60('0x4'))(_0xec60('0x6'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0xec60('0x4'))(_0xec60('0x7'));var loggerSyncQueueSummary=require(_0xec60('0x4'))(_0xec60('0x8'));var ami=require(_0xec60('0x9'));config[_0xec60('0xa')]=_[_0xec60('0xb')](config[_0xec60('0xa')],{'host':_0xec60('0xc'),'port':0x18eb});var io=require(_0xec60('0xd'))(new Redis(config[_0xec60('0xa')]));var cmHopper=require(_0xec60('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xec60('0xf'));var Interval=require('../rpc/interval');var Action=require(_0xec60('0x10'));var History=require('./models/history');var Final=require(_0xec60('0x11'));var AgentComplete=require(_0xec60('0x12'));var QueueCallerAbandon=require(_0xec60('0x13'));var Hangup=require(_0xec60('0x14'));var ipAgi=process[_0xec60('0x15')][_0xec60('0x16')]||_0xec60('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xec60('0x18')]['enqueue']=function(_0x1bd6ff){this[_0xec60('0x19')]=this['tail']?this[_0xec60('0x19')]['finally'](_0x1bd6ff):_0x1bd6ff();};function Dialer(_0x145977,_0x15ecbc){this['sequence']=new Sequence();this['preview']=_0x15ecbc;this[_0xec60('0x1a')]=_0x145977[_0xec60('0x1a')];this[_0xec60('0x1b')]=_0x145977[_0xec60('0x1b')];this[_0xec60('0x1c')]=_0x145977[_0xec60('0x1c')];this[_0xec60('0x1d')]=_0x145977['trunks'];this[_0xec60('0x1e')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xec60('0x1f')]={};this['contactsId']={};this[_0xec60('0x20')]={};this['optionPredictive']={};this[_0xec60('0x21')]={};this[_0xec60('0x22')]={};this[_0xec60('0x23')]={};this[_0xec60('0x24')]={};this['queueBookedRR']={};this[_0xec60('0x25')]={};ami['on']('agentconnect',this[_0xec60('0x26')][_0xec60('0x27')](this));ami['on'](_0xec60('0x28'),this[_0xec60('0x29')][_0xec60('0x27')](this));ami['on'](_0xec60('0x2a'),this[_0xec60('0x2b')][_0xec60('0x27')](this));ami['on'](_0xec60('0x2c'),this[_0xec60('0x2d')][_0xec60('0x27')](this));ami['on']('custom:queuesummary',this[_0xec60('0x8')][_0xec60('0x27')](this));ami['on'](_0xec60('0x2e'),this[_0xec60('0x2f')][_0xec60('0x27')](this));ami['on'](_0xec60('0x30'),this[_0xec60('0x31')][_0xec60('0x27')](this));ami['on'](_0xec60('0x32'),this[_0xec60('0x33')][_0xec60('0x27')](this));ami['on'](_0xec60('0x34'),this['syncVarSet'][_0xec60('0x27')](this));ami['on']('queuemember',this[_0xec60('0x35')][_0xec60('0x27')](this));ami['on'](_0xec60('0x36'),this[_0xec60('0x37')]['bind'](this));this['loopCampaigns']();this[_0xec60('0x38')]();RpcSetting[_0xec60('0x39')]()[_0xec60('0x3a')](function(_0x68e8e5){previewRecallmeReminderInterval=_0x68e8e5[_0xec60('0x3b')];});}function isNotNull(_0x2b1105){return _0x2b1105!==null&&!_[_0xec60('0x3c')](_0x2b1105);}function msgResponse(_0x2dbe32,_0x4895b8,_0x4e4ab7){return{'action':_0x2dbe32,'response':_0x4895b8,'message':_0x4e4ab7,'stack':_0x4e4ab7};}function emit(_0x588a80,_0x330132,_0x35d11f){io['to'](_0x588a80)[_0xec60('0x3d')](_0x330132,_0x35d11f);}function emitOutboundVoiceQueueSummary(_0x107e5c){if(_0x107e5c[_0xec60('0x3e')]==='outbound'){logger[_0xec60('0x3f')](_0xec60('0x40'),util['inspect'](_0x107e5c,{'showHidden':![],'depth':null}));emit(util[_0xec60('0x41')](_0xec60('0x42'),_0x107e5c[_0xec60('0x43')]),_0xec60('0x44'),_0x107e5c);}}function checkGetDataPredictive(_0x707309){if(isNotNull(_0x707309)&&!_[_0xec60('0x45')](_0x707309)){loggerPredictive[_0xec60('0x46')](_0xec60('0x47'));loggerPredictive[_0xec60('0x46')](_0xec60('0x48'),_0x707309[_0xec60('0x49')]);loggerPredictive[_0xec60('0x46')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x707309[_0xec60('0x4a')]);loggerPredictive[_0xec60('0x46')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x707309[_0xec60('0x4b')]);loggerPredictive[_0xec60('0x46')](_0xec60('0x4c'),_0x707309['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xec60('0x4d'),_0x707309[_0xec60('0x4e')]);loggerPredictive['info'](_0xec60('0x4f'),_0x707309['predictiveIntervalAvgTalktime']);loggerPredictive[_0xec60('0x46')](_0xec60('0x50'));if(_0x707309[_0xec60('0x49')]>0x0){if(!_[_0xec60('0x3c')](_0x707309['predictiveIntervalAvgTalktime'])&&_0x707309[_0xec60('0x51')]>0x0){return!![];}loggerPredictive[_0xec60('0x46')](_0xec60('0x52'));if(!_[_0xec60('0x3c')](_0x707309[_0xec60('0x4e')])&&_0x707309[_0xec60('0x4e')]>0x0){return!![];}loggerPredictive[_0xec60('0x46')](_0xec60('0x53'));}else{loggerPredictive[_0xec60('0x46')](_0xec60('0x54'));}}else{loggerPredictive['info'](_0xec60('0x55'));}return![];}function mergeDataErlangB(_0x42b5b8){return function(_0x4d9945){loggerPredictive[_0xec60('0x46')](_0xec60('0x56'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d9945['erlangCalls']);loggerPredictive[_0xec60('0x46')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d9945[_0xec60('0x57')]);loggerPredictive[_0xec60('0x46')](_0xec60('0x58'),_0x4d9945[_0xec60('0x59')]);loggerPredictive[_0xec60('0x46')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d9945[_0xec60('0x5a')]);loggerPredictive[_0xec60('0x46')](_0xec60('0x58'),_0x4d9945[_0xec60('0x59')]);loggerPredictive[_0xec60('0x46')]('---------------------------');_[_0xec60('0x5b')](_0x42b5b8,_0x4d9945);};}function ifInterval(_0x540338,_0xfa2733){if(_[_0xec60('0x3c')](_0xfa2733)){return![];}return utils[_0xec60('0x5c')](undefined,_0xfa2733)<_0x540338*0x3c;}function clearPredictiveAttributes(_0x152486){if(_0x152486['startProgressive']){_0x152486[_0xec60('0x22')]=undefined;loggerPredictive['debug'](_0x152486[_0xec60('0x43')],'startProgressive\x20value\x20cleared');}if(_0x152486[_0xec60('0x21')]){_0x152486[_0xec60('0x21')]=undefined;loggerPredictive[_0xec60('0x3f')](_0x152486[_0xec60('0x43')],'startPredictive\x20value\x20cleared');}if(_0x152486['handlePredictive']){clearInterval(_0x152486['handlePredictive']);_0x152486[_0xec60('0x5d')]=undefined;loggerPredictive[_0xec60('0x3f')](_0x152486[_0xec60('0x43')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1bff91,_0x48e093){return function(_0x2189b5){loggerPredictive['error'](_0x48e093['name'],_0x1bff91);loggerPredictive['error'](_0x2189b5[_0xec60('0x5e')]);clearPredictiveAttributes(_0x48e093);};}function loggerCatch(_0x5be35b){return function(_0x23a2fc){logger[_0xec60('0x5f')](_0x5be35b,util['inspect'](_0x23a2fc,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1d4d69,_0xdae392,_0x31b403){return function(_0x1c6bae){utils[_0xec60('0x60')](_0xdae392,_0x31b403,0x0);logger[_0xec60('0x5f')](_0x1d4d69,util['inspect'](_0x1c6bae,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x31bfe6){return function(_0x364ff5){if(isNotNull(_0x364ff5)&&isNotNull(_0x364ff5[0x0])){if(_0x364ff5[0x0][_0xec60('0x61')]>0x0){_0x31bfe6[_0xec60('0x62')]=utils[_0xec60('0x63')][_0xec60('0x64')];logger[_0xec60('0x46')](_0xec60('0x65')+_0x31bfe6[_0xec60('0x43')],_0x364ff5[0x0][_0xec60('0x61')],_0xec60('0x66'));}else{_0x31bfe6[_0xec60('0x62')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info'](_0xec60('0x67')+_0x31bfe6[_0xec60('0x43')]);}}};}function createObjHistory(_0x3abbcf,_0x50042e,_0x26f78e,_0x323285,_0x1a3522){_0x3abbcf[_0xec60('0x62')]=_0x26f78e;var _0x2ef05e=new Action(_0x3abbcf,_0x50042e);var _0x5a79b6=new History(_0x2ef05e);_0x5a79b6['state']=_0x323285;_0x5a79b6['statedesc']=_0x1a3522;_0x5a79b6['endtime']=_0x2ef05e[_0xec60('0x68')];return _0x5a79b6;}function unlockQueueStatus(_0x1ad303,_0x3c5660){setTimeout(function(){if(_['isUndefined'](_0x1ad303[_0xec60('0x69')])){loggerBooked['error'](_0xec60('0x6a'),_0x3c5660);}_0x1ad303['queueStatusComplete']=!![];loggerBooked[_0xec60('0x46')](_0xec60('0x6b'),_0x3c5660,JSON[_0xec60('0x6c')](_[_0xec60('0x6d')](_0x1ad303,[_0xec60('0x43'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x20eaf8){return function(){if(!isNotNull(_0x20eaf8[_0xec60('0x6e')])){_0x20eaf8['message']=utils['CAMPAIGN_STATUS'][_0xec60('0x6f')];throw _0x20eaf8['name']+_0xec60('0x70');}if(!isNotNull(_0x20eaf8[_0xec60('0x6e')]['Intervals'])){_0x20eaf8[_0xec60('0x62')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x20eaf8[_0xec60('0x43')]+_0xec60('0x70');}if(!isNotNull(_[_0xec60('0x45')](_0x20eaf8['Interval'][_0xec60('0x71')]))){_0x20eaf8[_0xec60('0x62')]=utils[_0xec60('0x63')][_0xec60('0x6f')];throw _0x20eaf8[_0xec60('0x43')]+_0xec60('0x70');}};}function checkIsIVRCampaignActive(_0x2ba159){return function(){if(!utils['isIVRCampaignActive'](_0x2ba159)){_0x2ba159[_0xec60('0x62')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x2ba159[_0xec60('0x43')]+_0xec60('0x72');}};}function emitCampaignSummary(_0xd03a73){if(utils['isIVRCampaign'](_0xd03a73)){emit(util[_0xec60('0x41')](_0xec60('0x73'),_0xd03a73['name']),_0xec60('0x74'),_0xd03a73);}}function loggerCatchQueueSummary(_0x22dcbe,_0x2577b1){return function(_0x2ded36){clearPredictiveAttributes(_0x2577b1);emitCampaignSummary(_0x2577b1);loggerSyncQueueSummary[_0xec60('0x3f')](_0x22dcbe,util[_0xec60('0x75')](_0x2ded36,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1c578a){if(_0x1c578a[_0xec60('0x76')]){if(_0x1c578a[_0xec60('0x77')]===0x0){_0x1c578a[_0xec60('0x76')]=![];_0x1c578a['message']=utils[_0xec60('0x63')][_0xec60('0x78')];loggerSyncQueueSummary['debug'](_0xec60('0x79'),_0x1c578a[_0xec60('0x43')],'is\x20not\x20active');}else{_0x1c578a[_0xec60('0x62')]=utils[_0xec60('0x63')][_0xec60('0x7a')];loggerSyncQueueSummary[_0xec60('0x3f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1c578a[_0xec60('0x43')],_0xec60('0x7b'));}emitCampaignSummary(_0x1c578a);}}function myreject(_0x3a8e7e){return function(_0xce34d7){return _0x3a8e7e(msgResponse(_0xec60('0x7c'),_0xec60('0x7d'),JSON[_0xec60('0x6c')](_0xce34d7)));};}Dialer[_0xec60('0x18')]['isTrunkReachable']=function(_0x2f8d3e){return!_[_0xec60('0x3c')](_0x2f8d3e)&&_0x2f8d3e&&!_[_0xec60('0x3c')](_0x2f8d3e[_0xec60('0x43')])&&!_[_0xec60('0x3c')](_0x2f8d3e[_0xec60('0x7e')])&&_0x2f8d3e[_0xec60('0x7e')]&&(this['trunks'][util[_0xec60('0x41')](_0xec60('0x7f'),_0x2f8d3e['name'])][_0xec60('0x80')]===_0xec60('0x81')||this[_0xec60('0x1d')][util['format'](_0xec60('0x7f'),_0x2f8d3e[_0xec60('0x43')])][_0xec60('0x80')]==='unmonitored');};Dialer[_0xec60('0x18')][_0xec60('0x82')]=function(_0x3ae1ab){var _0x2904fb=this;return function(){if(!_0x2904fb[_0xec60('0x83')](_0x3ae1ab[_0xec60('0x84')])){if(!_0x2904fb[_0xec60('0x83')](_0x3ae1ab[_0xec60('0x85')])){_0x3ae1ab[_0xec60('0x62')]=utils[_0xec60('0x63')]['TRUNK_NOT_REACHABLE'];throw _0x3ae1ab['name']+_0xec60('0x86');}}};};Dialer[_0xec60('0x18')]['checkIfTime']=function(_0x3a1672,_0x402db8,_0x30528b,_0x1b1386){var _0x260872=this;return function(){var _0x524513=!![];return _0x260872['ifTimeIvr'](_0x3a1672,_0x402db8,_0x30528b,_0x1b1386,_0x524513);};};Dialer[_0xec60('0x18')]['checkIfTimeIntervals']=function(_0x293035,_0x20d467,_0x11f83b,_0x66a8df){var _0x5b3a54=this;return function(){var _0x325a1b=![];return _0x5b3a54[_0xec60('0x87')](_0x293035['Intervals'],_0x20d467,_0x11f83b,_0x66a8df,_0x325a1b);};};Dialer[_0xec60('0x18')][_0xec60('0x87')]=function(_0x3c9be9,_0x1cb99f,_0x2ebe86,_0x1afd30,_0xa994fe){var _0xc08fb4=[];return new Promise(function(_0x1d33e5,_0x3f1685){if(!isNotNull(_0x3c9be9)){_0x1afd30['message']=utils[_0xec60('0x63')][_0xec60('0x6f')];return _0x3f1685(msgResponse(_0xec60('0x88'),'Failure',_0x2ebe86+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xec60('0x45')](_0x3c9be9)){_0x1afd30[_0xec60('0x62')]=utils['CAMPAIGN_STATUS'][_0xec60('0x89')];return _0x3f1685(msgResponse('ifTime',_0xec60('0x8a'),_0x2ebe86+_0xec60('0x8b')));}if(_0x1cb99f&&_['isUndefined'](config[_0xec60('0x8c')][_0x1cb99f])){_0x1afd30[_0xec60('0x62')]=utils['CAMPAIGN_STATUS'][_0xec60('0x8d')];return _0x3f1685(msgResponse(_0xec60('0x88'),_0xec60('0x8a'),_0x2ebe86+_0xec60('0x8e')+_0x1cb99f));}if(_[_0xec60('0x8f')](_0x3c9be9)){for(var _0x120de6=0x0;_0x120de6<_0x3c9be9[_0xec60('0x90')];_0x120de6+=0x1){_0xc08fb4[_0xec60('0x91')](ami[_0xec60('0x92')]({'action':_0xec60('0x93'),'command':util[_0xec60('0x41')]('iftime\x20%s,%s',_0x3c9be9[_0x120de6][_0xec60('0x94')],!_[_0xec60('0x3c')](config[_0xec60('0x8c')][_0x1cb99f])?_0x1cb99f:'')})['then'](function(_0x4c09c8){return _0x4c09c8[_0xec60('0x95')]['indexOf'](_0xec60('0x96'))>=0x0;})[_0xec60('0x97')](myreject(_0x3f1685)));}}else{_0xc08fb4[_0xec60('0x91')](ami[_0xec60('0x92')]({'action':_0xec60('0x93'),'command':util[_0xec60('0x41')](_0xec60('0x98'),_0x3c9be9,!_[_0xec60('0x3c')](config[_0xec60('0x8c')][_0x1cb99f])?_0x1cb99f:'')})[_0xec60('0x3a')](function(_0x2613a8){return _0x2613a8[_0xec60('0x95')][_0xec60('0x99')]('true')>=0x0;})[_0xec60('0x97')](myreject(_0x3f1685)));}Promise['all'](_0xc08fb4)[_0xec60('0x3a')](function(_0x505bdd){var _0x210cf2=_[_0xec60('0x9a')](_0x505bdd);if(_0x210cf2){return _0x1d33e5(_0x210cf2);}else{_0x1afd30['message']=_0xa994fe?utils['CAMPAIGN_STATUS'][_0xec60('0x9b')]:utils[_0xec60('0x63')][_0xec60('0x9c')];return _0x3f1685(msgResponse('[ifTime][promiseAll]',_0xec60('0x8a'),_0xec60('0x9d')+_0xa994fe+'\x20'+_0x2ebe86+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3c9be9,{'showHidden':![],'depth':null})+_0xec60('0x9e')+_0x1cb99f));}})[_0xec60('0x97')](function(_0x1e581f){return _0x3f1685(msgResponse(_0xec60('0x88'),_0xec60('0x8a'),JSON[_0xec60('0x6c')](_0x1e581f)));});});};Dialer['prototype'][_0xec60('0x9f')]=function(){var _0x312910=this;return cmHopper[_0xec60('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0xec60('0x3a')](function(){setInterval(function(){_0x312910[_0xec60('0xa1')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x9061c5=this;var _0x304235;for(var _0x17e724 in this['campaigns']){if(typeof this[_0xec60('0x1b')][_0x17e724]!==_0xec60('0xa2')){_0x304235=this[_0xec60('0x1b')][_0x17e724];if(utils[_0xec60('0xa3')](_0x304235)&&utils[_0xec60('0xa4')](_0x304235)){_0x304235[_0xec60('0x76')]=!![];Promise[_0xec60('0xa5')]()[_0xec60('0x3a')](checkIsIVRCampaignActive(_0x304235))[_0xec60('0x3a')](checkInterval(_0x304235))[_0xec60('0x3a')](_0x9061c5[_0xec60('0x82')](_0x304235))[_0xec60('0x3a')](_0x9061c5['checkIfTime'](_0x304235[_0xec60('0xa6')],_0x304235[_0xec60('0xa7')],_0x304235[_0xec60('0x43')],_0x304235))[_0xec60('0x3a')](_0x9061c5[_0xec60('0xa8')](_0x304235[_0xec60('0x6e')],_0x304235[_0xec60('0xa7')],_0x304235['name'],_0x304235))[_0xec60('0x3a')](_0x9061c5[_0xec60('0xa9')](_0x304235))[_0xec60('0x97')](loggerCatchQueueSummary(_0xec60('0xaa'),_0x304235));}else{notSendMessagesCampaign(_0x304235);}}}};Dialer['prototype']['checkDialMethod']=function(_0x38838c){if(_0x38838c['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x38838c);}switch(_0x38838c[_0xec60('0xab')]){case'progressive':this[_0xec60('0xac')](_0x38838c,0x1);break;case _0xec60('0xad'):this[_0xec60('0xac')](_0x38838c,_0x38838c[_0xec60('0xae')]);break;case _0xec60('0xaf'):this[_0xec60('0xaf')](_0x38838c);break;case'booked':this[_0xec60('0xac')](_0x38838c,0x1);break;default:logger[_0xec60('0x5f')]('Queue',_0x38838c['name'],_0xec60('0xb0'));}};Dialer[_0xec60('0x18')][_0xec60('0x88')]=function(_0x2e25a0,_0x207533){var _0x4f5dcd=_0x2e25a0[_0xec60('0xa7')];var _0x1e4988=_0x207533?_0x2e25a0[_0xec60('0xa6')]:_0x2e25a0['Interval']['Intervals'];logger[_0xec60('0xb1')](_0xec60('0xb2'),_0x1e4988,_0x4f5dcd,_0x2e25a0[_0xec60('0x43')],util[_0xec60('0x41')](_0xec60('0xb3'),_0x2e25a0[_0xec60('0x43')],_0x2e25a0['id']));var _0x435ea3=null;return Interval[_0xec60('0xb4')](_0x1e4988,_0x4f5dcd)['then'](function(_0x2ba925){if(_0x2ba925===!![]){return _0x2ba925;}else{_0x2e25a0[_0xec60('0x62')]=_0x207533?utils[_0xec60('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xec60('0x63')][_0xec60('0x9c')];_0x435ea3=msgResponse(_0xec60('0xb5'),_0xec60('0x8a'),'Global:\x20'+_0x207533+'\x20'+_0x2e25a0[_0xec60('0x43')]+_0xec60('0xb6')+util['inspect'](_0x1e4988,{'showHidden':![],'depth':null})+_0xec60('0x9e')+_0x4f5dcd);}if(_0x435ea3!==null){logger['silly'](_0xec60('0xb7'),_0x435ea3);_0x435ea3[_0xec60('0xb8')]=_0x207533;throw _0x435ea3;}})[_0xec60('0x97')](function(_0x50602f){logger[_0xec60('0x5f')]('AMI\x20IfTime',_0x50602f);throw msgResponse(_0xec60('0x7c'),_0xec60('0x7d'),util[_0xec60('0x75')](_0x50602f,{'showHidden':![],'depth':null}));});};Dialer[_0xec60('0x18')][_0xec60('0x26')]=function(_0xb98fc8){if(this['voiceQueues'][_0xb98fc8['queue']]){if(this[_0xec60('0x20')][_0xb98fc8[_0xec60('0xb9')]]&&this['uniqueId'][_0xb98fc8[_0xec60('0xb9')]][_0xec60('0x3e')]!==_0xec60('0xba')){this[_0xec60('0xbb')](this[_0xec60('0x1a')][_0xb98fc8['queue']]);this[_0xec60('0x20')][_0xb98fc8['uniqueid']][_0xec60('0xbc')]=moment()[_0xec60('0x41')](_0xec60('0xbd'));}}};Dialer[_0xec60('0x18')][_0xec60('0x2d')]=function(_0x523dcc){var _0x4c06cd=this[_0xec60('0x20')][_0x523dcc[_0xec60('0xb9')]];if(this[_0xec60('0x1a')][_0x523dcc[_0xec60('0xbe')]]){if(_0x4c06cd&&_0x4c06cd[_0xec60('0x3e')]!==_0xec60('0xba')){delete this[_0xec60('0x20')][_0x523dcc[_0xec60('0xb9')]];this[_0xec60('0x1a')][_0x523dcc[_0xec60('0xbe')]][_0xec60('0xbf')]+=0x1;var _0x228f65=new AgentComplete(_0x4c06cd,_0x523dcc);if(_0x523dcc[_0xec60('0xc0')]===_0xec60('0xc1')){_0x228f65[_0xec60('0xc2')]=this['voiceQueues'][_0x523dcc[_0xec60('0xbe')]]['dialQueueProject2']&&this[_0xec60('0x1a')][_0x523dcc['queue']]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xec60('0xc3')](_0x228f65)[_0xec60('0x97')](loggerCatch(_0xec60('0xc4')));hopperUtils[_0xec60('0xc5')](_0x228f65)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xec60('0x18')][_0xec60('0x29')]=function(_0x2cc83d){var _0xd0cb9f=this[_0xec60('0x20')][_0x2cc83d[_0xec60('0xb9')]];var _0x811d1e=this;var _0x3c1e2b=![];var _0x1ff4f4;var _0x30f9f2;if(this[_0xec60('0x1a')][_0x2cc83d['queue']]){if(_0xd0cb9f&&_0xd0cb9f[_0xec60('0x3e')]!=='ivr'){delete this[_0xec60('0x20')][_0x2cc83d[_0xec60('0xb9')]];this[_0xec60('0xbb')](this[_0xec60('0x1a')][_0x2cc83d['queue']]);_0xd0cb9f['droptime']=moment()['format'](_0xec60('0xbd'));var _0x232bc5=new QueueCallerAbandon(_0xd0cb9f,_0x2cc83d);if(utils[_0xec60('0x5c')](_0xd0cb9f[_0xec60('0xc6')],_0xd0cb9f[_0xec60('0xc7')])>=_0xd0cb9f[_0xec60('0xc8')]){this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0x4b')]+=0x1;this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xc9')]+=0x1;this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x232bc5[_0xec60('0xca')]=0xa;_0x232bc5['statedesc']=_0xec60('0xcb');_0x232bc5[_0xec60('0xcc')]=_0xec60('0xcd');_0x232bc5['agiafterat']=this['voiceQueues'][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xce')]?moment()[_0xec60('0x41')](_0xec60('0xbd')):undefined;_0x232bc5['countdropretry']+=0x1;_0x232bc5[_0xec60('0xcf')]+=0x1;_0x1ff4f4=this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xd0')];_0x30f9f2=this['voiceQueues'][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xd1')];hopperUtils[_0xec60('0xd2')](_0x232bc5,_0x232bc5[_0xec60('0xca')],_0xd0cb9f[_0xec60('0xd3')])['then'](function(_0x2a2869){_0x3c1e2b=_0x2a2869[_0xec60('0xd4')]==0x1;if(_0x232bc5['countdropretry']>=_0x811d1e[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xd5')]){_0x811d1e[_0xec60('0xd6')](_0x232bc5,_0x2a2869[_0xec60('0xd4')]);}else{hopperUtils[_0xec60('0xd7')]({'active':![],'countdropretry':_0x232bc5[_0xec60('0xd8')],'scheduledat':moment()[_0xec60('0xd9')](_0x811d1e[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xd0')],_0xec60('0xda'))[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0xd0cb9f[_0xec60('0xdb')],'ListId':_0xd0cb9f[_0xec60('0xdc')],'VoiceQueueId':_0xd0cb9f['VoiceQueueId']||undefined,'CampaignId':_0xd0cb9f[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0xde')));var _0x3e9a60=new History(_0x232bc5);_0x3e9a60[_0xec60('0xca')]=0xa;_0x3e9a60[_0xec60('0xdf')]='Drop';_0x3e9a60[_0xec60('0x68')]=moment()[_0xec60('0x41')](_0xec60('0xbd'));_0x3e9a60[_0xec60('0xe0')]=_0x3e9a60[_0xec60('0x68')];_0x3e9a60[_0xec60('0xe1')]=_0x232bc5[_0xec60('0xe1')];_0x3e9a60['calleridnum']=_0x232bc5[_0xec60('0xe2')];hopperUtils['createHistory'](_0x3e9a60)[_0xec60('0x97')](loggerCatch(_0xec60('0xe3')));}})[_0xec60('0x3a')](function(){if(_0x3c1e2b)hopperUtils[_0xec60('0xe4')](_0x232bc5,_0x1ff4f4,_0x30f9f2)['then'](function(){return 0x1;});});}else{this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xe5')]+=0x1;this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x232bc5[_0xec60('0xca')]=0xb;_0x232bc5[_0xec60('0xdf')]=_0xec60('0xe6');_0x232bc5[_0xec60('0xcc')]=_0xec60('0xe7');_0x232bc5['countabandonedretry']+=0x1;_0x232bc5[_0xec60('0xcf')]+=0x1;_0x1ff4f4=this[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xe8')];_0x30f9f2=this['voiceQueues'][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xd1')];hopperUtils[_0xec60('0xd2')](_0x232bc5,_0x232bc5['state'],_0xd0cb9f[_0xec60('0xd3')])[_0xec60('0x3a')](function(_0x5ee593){if(_0x232bc5[_0xec60('0xe9')]>=_0x811d1e[_0xec60('0x1a')][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xea')]){_0x811d1e['queueCallerAbandonCreateState'](_0x232bc5,_0x5ee593[_0xec60('0xd4')]);}else{hopperUtils[_0xec60('0xd7')]({'active':![],'countabandonedretry':_0x232bc5[_0xec60('0xe9')],'scheduledat':moment()['add'](_0x811d1e['voiceQueues'][_0x2cc83d[_0xec60('0xbe')]][_0xec60('0xe8')],'minutes')['format'](_0xec60('0xbd')),'ContactId':_0xd0cb9f[_0xec60('0xdb')],'ListId':_0xd0cb9f[_0xec60('0xdc')],'VoiceQueueId':_0xd0cb9f[_0xec60('0xeb')]||undefined,'CampaignId':_0xd0cb9f[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0xec')));var _0x1560cf=new History(_0x232bc5);_0x1560cf[_0xec60('0xca')]=0xb;_0x1560cf[_0xec60('0xdf')]=_0xec60('0xe6');_0x1560cf[_0xec60('0x68')]=moment()['format'](_0xec60('0xbd'));_0x1560cf['endtime']=_0x1560cf[_0xec60('0x68')];_0x1560cf[_0xec60('0xe1')]=_0x232bc5[_0xec60('0xe1')];_0x1560cf['calleridnum']=_0x232bc5[_0xec60('0xe2')];hopperUtils['createHistory'](_0x1560cf)[_0xec60('0x97')](loggerCatch(_0xec60('0xed')));}})[_0xec60('0x3a')](function(){if(_0x3c1e2b)hopperUtils[_0xec60('0xe4')](_0x232bc5,_0x1ff4f4,_0x30f9f2)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0xec60('0x33')]=function(_0x3e1a5c){if(this[_0xec60('0x1f')][_0x3e1a5c[_0xec60('0xb9')]]){this[_0xec60('0x1f')][_0x3e1a5c[_0xec60('0xb9')]][_0xec60('0xee')]=_0x3e1a5c['channel'];}if(this[_0xec60('0x20')][_0x3e1a5c[_0xec60('0xb9')]]){this[_0xec60('0x20')][_0x3e1a5c[_0xec60('0xb9')]][_0xec60('0xee')]=_0x3e1a5c['channel'];}};Dialer['prototype'][_0xec60('0x35')]=function(_0x15b792){if(!this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]]){return;}var _0x237027=this[_0xec60('0x1a')][this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]]['queue']]['strategy']||'rrmemory';if(_0x237027===_0xec60('0xf0')){if(this[_0xec60('0x1f')][_0x15b792['actionid']]&&_[_0xec60('0xf1')](this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]][_0xec60('0xf2')])&&_0x15b792[_0xec60('0x80')]==='1'&&_0x15b792[_0xec60('0xf3')]==='0'){if(this['agents'][_0x15b792['stateinterface']]){if(!this[_0xec60('0x1c')][_0x15b792[_0xec60('0xf4')]][_0xec60('0xf2')]){this[_0xec60('0x1c')][_0x15b792[_0xec60('0xf4')]][_0xec60('0xf2')]=!![];this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]]['locked']=!![];this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]][_0xec60('0xf4')]=_0x15b792['stateinterface'];}}}}else if(_0x237027===_0xec60('0xf5')){if(this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]]){if(this[_0xec60('0x1c')][_0x15b792[_0xec60('0xf4')]]){this['actions'][_0x15b792[_0xec60('0xef')]][_0xec60('0xf4')]=_0x15b792[_0xec60('0xf4')];if(_[_0xec60('0xf1')](this[_0xec60('0x24')][this[_0xec60('0x1f')][_0x15b792['actionid']][_0xec60('0xbe')]])){this[_0xec60('0x24')][this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]][_0xec60('0xbe')]]=[];}this[_0xec60('0x24')][this[_0xec60('0x1f')][_0x15b792[_0xec60('0xef')]][_0xec60('0xbe')]]['push'](_[_0xec60('0x5b')](_['pick'](this['actions'][_0x15b792[_0xec60('0xef')]],['idHopper',_0xec60('0xf4')]),{'status':_0x15b792['status'],'paused':_0x15b792[_0xec60('0xf3')]}));}}}};Dialer[_0xec60('0x18')][_0xec60('0x37')]=function(_0x2690ee){if(!this['actions'][_0x2690ee[_0xec60('0xef')]]){return;}var _0xc7097e=this;var _0x824048=this[_0xec60('0x1a')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]];var _0x483387=_0x824048[_0xec60('0xf6')]||_0xec60('0xf5');if(_0x483387===_0xec60('0xf0')){if(this[_0xec60('0x1f')][_0x2690ee['actionid']]&&this[_0xec60('0x1f')][_0x2690ee['actionid']][_0xec60('0xf4')]){this['preview'][_0xec60('0xf7')](this[_0xec60('0x1f')][_0x2690ee['actionid']][_0xec60('0xf8')],this['actions'][_0x2690ee[_0xec60('0xef')]]['stateinterface'])['catch'](function(_0x56673f){logger[_0xec60('0x5f')](_0xec60('0xf9'),util[_0xec60('0x75')](_0x56673f,{'showHidden':![],'depth':null}));})[_0xec60('0xfa')](function(){_0xc7097e[_0xec60('0xbb')](_0xc7097e[_0xec60('0x1a')][_0xc7097e['actions'][_0x2690ee[_0xec60('0xef')]]['queue']]);_0xc7097e[_0xec60('0x1c')][_0xc7097e[_0xec60('0x1f')][_0x2690ee['actionid']][_0xec60('0xf4')]][_0xec60('0xf2')]=![];delete _0xc7097e[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]];unlockQueueStatus(_0x824048);});}else{this['updateOriginated'](this[_0xec60('0x1a')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]]);hopperUtils[_0xec60('0xd7')]({'active':![],'ContactId':this[_0xec60('0x1f')][_0x2690ee['actionid']][_0xec60('0xdb')],'ListId':this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xdc')],'VoiceQueueId':this['actions'][_0x2690ee[_0xec60('0xef')]][_0xec60('0xeb')]||undefined,'CampaignId':this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]];unlockQueueStatus(_0x824048);}}else if(_0x483387===_0xec60('0xf5')){var _0x1e8525;if(this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]]&&!_[_0xec60('0x45')](this[_0xec60('0x24')][this['actions'][_0x2690ee['actionid']][_0xec60('0xbe')]])){if(this['queueBookedRR'][_0xc7097e['actions'][_0x2690ee['actionid']][_0xec60('0xbe')]]){this['queueBookedRR'][_0xc7097e[_0xec60('0x1f')][_0x2690ee['actionid']]['queue']]=this[_0xec60('0xfb')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]]?this[_0xec60('0xfb')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]]:this[_0xec60('0x24')][this[_0xec60('0x1f')][_0x2690ee['actionid']][_0xec60('0xbe')]]?this[_0xec60('0x24')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this['actions'][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]][_0xec60('0xfc')]=this[_0xec60('0xfb')][this[_0xec60('0x1f')][_0x2690ee[_0xec60('0xef')]][_0xec60('0xbe')]];for(var _0x158c19=0x0;_0x158c19=_0x790c0['dialGlobalMaxRetry']){_0x23fd04[_0xec60('0x122')](_0x2fa27f,_0x12ba35,_0x2d87f8,_0xec60('0x123'));}else{if(_0x2fa27f[_0xec60('0x11c')]>=_0x790c0['dialMachineMaxRetry']){_0x23fd04[_0xec60('0x124')](_0x2fa27f,_0x12ba35,_0x2d87f8,_0xec60('0x125'));}else{hopperUtils[_0xec60('0xd7')]({'active':![],'countmachineretry':_0x2fa27f[_0xec60('0x11c')],'scheduledat':moment()['add'](_0x790c0[_0xec60('0x126')],_0xec60('0xda'))['format'](_0xec60('0xbd')),'ContactId':_0x2fa27f[_0xec60('0xdb')],'ListId':_0x2fa27f['ListId'],'VoiceQueueId':_0x2fa27f[_0xec60('0xeb')]||undefined,'CampaignId':_0x2fa27f[_0xec60('0xdd')]||undefined})['catch'](loggerCatch(_0xec60('0x127')));_0x12ba35({'reschedule':0x1});}}});}if(_0x1ee34c[_0xec60('0x3e')]===_0xec60('0xba')&&this[_0xec60('0x1b')][_0x1ee34c[_0xec60('0xbe')]]['dialAMDActive']&&_0x37174e[_0xec60('0x128')]===_0xec60('0x129')){delete this[_0xec60('0x20')][_0x37174e[_0xec60('0xb9')]];this['updateOriginated'](this[_0xec60('0x1b')][_0x1ee34c[_0xec60('0xbe')]]);_0x4b0648=new Hangup(_0x1ee34c,_0x37174e);_0x4b0648[_0xec60('0xca')]=0x12;_0x4b0648[_0xec60('0xdf')]=_0xec60('0x112');_0x4b0648[_0xec60('0x113')]=_0xec60('0x11b');ami[_0xec60('0x3d')]('custom:amd',ut[_0xec60('0x114')](_0x4b0648,_0xec60('0x115')));this[_0xec60('0x116')](_0x4b0648,_0xec60('0x12a'),_0xec60('0x12b'));}if(_0x1ee34c[_0xec60('0x3e')]===_0xec60('0xba')&&this[_0xec60('0x1b')][_0x1ee34c[_0xec60('0xbe')]][_0xec60('0x110')]&&_0x37174e['value']==='MACHINE'){return new Promise(function(_0x15a2f2,_0x40cede){delete _0x23fd04[_0xec60('0x20')][_0x37174e[_0xec60('0xb9')]];_0x23fd04[_0xec60('0xbb')](_0x23fd04[_0xec60('0x1b')][_0x1ee34c[_0xec60('0xbe')]]);_0x23fd04[_0xec60('0x1b')][_0x1ee34c[_0xec60('0xbe')]][_0xec60('0xbf')]+=0x1;_0x23fd04['campaigns'][_0x1ee34c[_0xec60('0xbe')]][_0xec60('0x111')]+=0x1;var _0xe20f01=_0x23fd04[_0xec60('0x1b')][_0x1ee34c['queue']];var _0x230108=new Hangup(_0x1ee34c,_0x37174e);_0x230108[_0xec60('0xca')]=0x13;_0x230108[_0xec60('0xdf')]=_0xec60('0x11a');_0x230108[_0xec60('0x113')]=_0xec60('0x11b');_0x230108[_0xec60('0x11c')]+=0x1;_0x230108[_0xec60('0xcf')]+=0x1;_0x230108[_0xec60('0x115')]=!![];ami['emit']('custom:amd',ut[_0xec60('0x114')](_0x230108,_0xec60('0x115')));hopperUtils[_0xec60('0xc3')](_0x230108)[_0xec60('0x97')](loggerCatch(_0xec60('0x11d')));if(_0x230108[_0xec60('0x11e')]+_0x230108[_0xec60('0x12c')]+_0x230108[_0xec60('0x11f')]+_0x230108[_0xec60('0x120')]+_0x230108[_0xec60('0xd8')]+_0x230108['countabandonedretry']+_0x230108[_0xec60('0x11c')]+_0x230108[_0xec60('0x121')]>=_0xe20f01[_0xec60('0x12d')]){_0x23fd04[_0xec60('0x122')](_0x230108,_0x15a2f2,_0x40cede,_0xec60('0x123'));}else{if(_0x230108['countmachineretry']>=_0xe20f01[_0xec60('0x12e')]){_0x23fd04[_0xec60('0x124')](_0x230108,_0x15a2f2,_0x40cede,_0xec60('0x125'));}else{hopperUtils[_0xec60('0xd7')]({'active':![],'countmachineretry':_0x230108[_0xec60('0x11c')],'scheduledat':moment()[_0xec60('0xd9')](_0xe20f01[_0xec60('0x126')],_0xec60('0xda'))[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0x230108['ContactId'],'ListId':_0x230108[_0xec60('0xdc')],'VoiceQueueId':_0x230108['VoiceQueueId']||undefined,'CampaignId':_0x230108['CampaignId']||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0x127')));_0x15a2f2({'reschedule':0x1});}}});}}};Dialer[_0xec60('0x18')][_0xec60('0x31')]=function(_0x572452){var _0x3fb2b6=this[_0xec60('0x20')][_0x572452[_0xec60('0xb9')]];var _0x393cff;if(_0x3fb2b6&&_0x3fb2b6['type']===_0xec60('0xba')){delete this[_0xec60('0x20')][_0x572452[_0xec60('0xb9')]];this[_0xec60('0xbb')](this[_0xec60('0x1b')][_0x3fb2b6['queue']]);this[_0xec60('0x1b')][_0x3fb2b6['queue']]['ivrAnswerCallsDay']+=0x1;_0x393cff=new Hangup(_0x3fb2b6,_0x572452);hopperUtils['createHistory'](_0x393cff)[_0xec60('0x97')](loggerCatch(_0xec60('0x12f')));hopperUtils[_0xec60('0xc5')](_0x393cff)[_0xec60('0x97')](loggerCatch(_0xec60('0x130')));}if(_0x3fb2b6&&_0x3fb2b6[_0xec60('0x3e')]!==_0xec60('0xba')&&isNotNull(this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]][_0xec60('0x131')])){delete this[_0xec60('0x20')][_0x572452[_0xec60('0xb9')]];this['updateOriginated'](this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]]);this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]][_0xec60('0xbf')]+=0x1;this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]][_0xec60('0x111')]+=0x1;_0x393cff=new Hangup(_0x3fb2b6,_0x572452);_0x393cff[_0xec60('0xca')]=0x10;_0x393cff[_0xec60('0xdf')]=_0xec60('0x132');_0x393cff[_0xec60('0x113')]='AGI';hopperUtils[_0xec60('0xc3')](_0x393cff)['catch'](loggerCatch(_0xec60('0x12f')));hopperUtils[_0xec60('0xc5')](_0x393cff)[_0xec60('0x97')](loggerCatch(_0xec60('0x130')));}if(_0x3fb2b6&&_0x3fb2b6[_0xec60('0x3e')]!==_0xec60('0xba')&&!isNotNull(this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]][_0xec60('0x131')])){delete this[_0xec60('0x20')][_0x572452[_0xec60('0xb9')]];this[_0xec60('0xbb')](this[_0xec60('0x1a')][_0x3fb2b6[_0xec60('0xbe')]]);this['voiceQueues'][_0x3fb2b6['queue']][_0xec60('0x133')]+=0x1;_0x393cff=new Hangup(_0x3fb2b6,_0x572452);_0x393cff[_0xec60('0xca')]=0xc;_0x393cff[_0xec60('0xdf')]=_0x572452[_0xec60('0x134')];_0x393cff[_0xec60('0x113')]=_0xec60('0x135');hopperUtils['createHistory'](_0x393cff)[_0xec60('0x97')](loggerCatch(_0xec60('0x12f')));hopperUtils['moveContactManagedDialer'](_0x393cff)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xec60('0x18')][_0xec60('0x8')]=function(_0x3ab45c){var _0x5d4d62=this;if(!_0x5d4d62[_0xec60('0x25')][_0x3ab45c['name']]){_0x5d4d62[_0xec60('0x25')][_0x3ab45c[_0xec60('0x43')]]={'running':![]};}else if(_0x5d4d62[_0xec60('0x25')][_0x3ab45c[_0xec60('0x43')]][_0xec60('0x136')]===!![]){return;}else if(_0x5d4d62['queuesSummary'][_0x3ab45c[_0xec60('0x43')]][_0xec60('0x136')]===![]){_0x5d4d62['queuesSummary'][_0x3ab45c[_0xec60('0x43')]][_0xec60('0x136')]=!![];}var _0x15ffe1=_0x5d4d62[_0xec60('0x1a')][_0x3ab45c[_0xec60('0x43')]];var _0x1ac3a8=_0x15ffe1[_0xec60('0x62')]!==utils['CAMPAIGN_STATUS'][_0xec60('0x78')];var _0x24d631=utils[_0xec60('0x137')](_0x15ffe1);_0x15ffe1['statusMessage']=utils[_0xec60('0x138')](_0x15ffe1,_0x5d4d62[_0xec60('0x1d')]);Promise['resolve']()['then'](function(){if(_0x15ffe1['statusMessage']===utils[_0xec60('0x63')][_0xec60('0x78')]){if(_0x1ac3a8){clearPredictiveAttributes(_0x15ffe1);_0x3ab45c[_0xec60('0x21')]=undefined;_0x3ab45c['startProgressive']=undefined;}if(_0x15ffe1[_0xec60('0x139')]===utils[_0xec60('0x63')]['INACTIVE']){_0x3ab45c[_0xec60('0x13a')]=0x0;_0x3ab45c['paused']=0x0;_0x3ab45c[_0xec60('0x13b')]=0x0;_0x3ab45c[_0xec60('0x13c')]=0x0;_0x3ab45c['pTalking']=0x0;}}else if(_0x15ffe1['statusMessage']===utils[_0xec60('0x63')][_0xec60('0x13d')]&&!_0x24d631){return _0x5d4d62[_0xec60('0x88')](_0x15ffe1,!![])[_0xec60('0x3a')](function(){return _0x5d4d62['ifTime'](_0x15ffe1,![]);})[_0xec60('0x3a')](function(){return _0x5d4d62[_0xec60('0x13e')](_0x15ffe1);})[_0xec60('0x97')](function(_0xd43e33){loggerSyncQueueSummary[_0xec60('0x3f')](_0xec60('0x13f'),util[_0xec60('0x75')](_0xd43e33,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x15ffe1);});}else{clearPredictiveAttributes(_0x15ffe1);}})[_0xec60('0x3a')](function(){var _0x22f0ae=_0x3ab45c[_0xec60('0x140')](_0x15ffe1);if(_0x22f0ae||_0x15ffe1[_0xec60('0x141')]){_0x15ffe1[_0xec60('0x141')]=![];_0x3ab45c['updateReportFromOutboundQueue'](_0x15ffe1);Object[_0xec60('0x142')](_0x15ffe1,_0x3ab45c);emitOutboundVoiceQueueSummary(_0x3ab45c);}_0x5d4d62['queuesSummary'][_0x15ffe1[_0xec60('0x43')]]['running']=![];})[_0xec60('0x97')](function(_0x33e8c8){logger[_0xec60('0x5f')]('[syncQueueSummary]',util[_0xec60('0x75')](_0x33e8c8,{'showHidden':![],'depth':null}));_0x5d4d62[_0xec60('0x25')][_0x15ffe1[_0xec60('0x43')]]['running']=![];});};Dialer['prototype'][_0xec60('0x2f')]=_['throttle'](function(){var _0x248325=_[_0xec60('0x143')](this[_0xec60('0x1a')],function(_0x4bd8d5){return _0x4bd8d5['dialPreviewRecallmeReminder'];});var _0x40f2c5=_['filter'](this[_0xec60('0x1c')],function(_0x354720){return _0x354720[_0xec60('0x144')]&&_0x354720[_0xec60('0x80')]===_0xec60('0x81');});if(_0x248325[_0xec60('0x90')]>0x0&&_0x40f2c5[_0xec60('0x90')]>0x0){return Promise[_0xec60('0xa5')]()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x248325,'id'),previewRecallmeReminderInterval,_[_0xec60('0x145')](_0x40f2c5,'id')))[_0xec60('0x3a')](function(_0x43a021){for(var _0xa14287=0x0;_0xa14287<_0x43a021['length'];_0xa14287++){var _0x1e2ef4=_0x43a021[_0xa14287][_0xec60('0x146')]['name'];if(_0x1e2ef4)io['to'](util[_0xec60('0x41')](_0xec60('0x147'),_0x1e2ef4))[_0xec60('0x3d')](_0xec60('0x148'),{'hopper':_0x43a021[_0xa14287]});}})[_0xec60('0x97')](function(_0x12a02d){logger['error'](_0xec60('0x149'),_0x12a02d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xec60('0x18')][_0xec60('0x38')]=function(){var _0x37f79b=this;setInterval(function(){_0x37f79b[_0xec60('0x14a')](_0x37f79b[_0xec60('0x20')],_0xec60('0x14b'));_0x37f79b['clearZombieChannels'](_0x37f79b['actions'],_0xec60('0x14c'));},0x32c8);};Dialer[_0xec60('0x18')][_0xec60('0x14a')]=function(_0x251ee9,_0x93659e){var _0x3f968c=this;for(var _0x4b728e in _0x251ee9){if(typeof _0x251ee9[_0x4b728e]!==_0xec60('0xa2')){this[_0xec60('0x14d')][_0xec60('0x14e')](function(){if(!_[_0xec60('0xf1')](_0x251ee9[_0x4b728e])){return ami['Action']({'action':_0xec60('0x80'),'channel':_0x251ee9[_0x4b728e][_0xec60('0xee')]})[_0xec60('0x97')](function(_0x47bdf3){if(_0x47bdf3[_0xec60('0x62')]===_0xec60('0x14f')){setTimeout(function(){if(_0x251ee9[_0x4b728e]&&_0x251ee9[_0x4b728e]['type']!=='ivr'){_0x3f968c[_0xec60('0xbb')](_0x3f968c[_0xec60('0x1a')][_0x251ee9[_0x4b728e][_0xec60('0xbe')]]);logger[_0xec60('0x5f')](_0xec60('0x150'),_0x93659e,_0x4b728e,_0x251ee9[_0x4b728e][_0xec60('0xbe')]);delete _0x251ee9[_0x4b728e];}if(_0x251ee9[_0x4b728e]&&_0x251ee9[_0x4b728e][_0xec60('0x3e')]===_0xec60('0xba')){_0x3f968c[_0xec60('0xbb')](_0x3f968c[_0xec60('0x1b')][_0x251ee9[_0x4b728e][_0xec60('0xbe')]]);logger[_0xec60('0x5f')]('[Dialer][checkChannel][ivr]',_0x93659e,_0x4b728e,_0x251ee9[_0x4b728e][_0xec60('0xbe')]);delete _0x251ee9[_0x4b728e];}},0x2328);}});}});}}};Dialer['prototype'][_0xec60('0x151')]=function(_0x3509d1){return Promise[_0xec60('0xa5')]()['then'](voiceQueueRt[_0xec60('0x151')](_0x3509d1))[_0xec60('0x97')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xec60('0x18')][_0xec60('0xbb')]=function(_0x34b483){if(!_[_0xec60('0x3c')](_0x34b483)&&_0x34b483!==null){if(typeof _0x34b483[_0xec60('0x77')]!==_0xec60('0xa2')){if(_0x34b483[_0xec60('0x77')]>0x0){_0x34b483[_0xec60('0x77')]-=0x1;}else{logger[_0xec60('0x5f')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xec60('0x5f')](_0xec60('0x152'));}};Dialer[_0xec60('0x18')][_0xec60('0x153')]=function(_0x2920b0,_0xede56c){var _0x5db39d=this;return function(_0x11414d){_0x5db39d[_0xec60('0xbb')](_0xede56c);logger[_0xec60('0x5f')](_0x2920b0,util[_0xec60('0x75')](_0x11414d,{'showHidden':![],'depth':null}));};};Dialer[_0xec60('0x18')]['emptyContact']=function(_0x27cb33,_0x1f968d,_0x56b786){var _0x5a5580={'state':0x19,'statedesc':_0xec60('0x154')};this['updateOriginated'](_0x1f968d);this[_0xec60('0x116')](_[_0xec60('0x5b')](_0x5a5580,_['pick'](_0x56b786,[_0xec60('0xdb'),_0xec60('0xdc'),_0xec60('0x155'),_0xec60('0xeb'),'CampaignId'])),_0xec60('0x156'),_0xec60('0x157'));logger[_0xec60('0x5f')](_0x27cb33);};Dialer[_0xec60('0x18')][_0xec60('0x116')]=function(_0x164766,_0x164814,_0x48bf7e){hopperUtils[_0xec60('0xc3')](_0x164766)[_0xec60('0x97')](loggerCatch(_0x164814));hopperUtils[_0xec60('0xc5')](_0x164766)[_0xec60('0x97')](loggerCatch(_0x48bf7e));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x9d2d79,_0x5d31a3){hopperUtils[_0xec60('0xc3')](_0x9d2d79)[_0xec60('0x97')](loggerCatch(_0xec60('0xc4')));if(_0x5d31a3==0x0){hopperUtils['moveContactManagedDialer'](_0x9d2d79)['catch'](loggerCatch(_0xec60('0x158')));}};Dialer['prototype'][_0xec60('0x149')]=function(_0x3cfb0e){return Promise[_0xec60('0xa5')]()[_0xec60('0x3a')](cmHopper[_0xec60('0x159')](_0x3cfb0e['id'],previewRecallmeReminderInterval))[_0xec60('0x3a')](function(_0x43d526){for(var _0x390c0d=0x0;_0x390c0d<_0x43d526[_0xec60('0x90')];_0x390c0d++){var _0x3215d6=_0x43d526[_0x390c0d][_0xec60('0x146')][_0xec60('0x43')];if(_0x3215d6)io['to'](util['format'](_0xec60('0x147'),_0x3215d6))['emit'](_0xec60('0x148'),{'hopper':_0x43d526[_0x390c0d]});}})[_0xec60('0x97')](function(){});};Dialer[_0xec60('0x18')]['launchHandleIvr']=function(_0x5d6ad7){var _0x1bc0ca=this;return function(){_0x1bc0ca[_0xec60('0x15a')](_0x5d6ad7);};};Dialer[_0xec60('0x18')][_0xec60('0x15b')]=function(_0x1dc90c,_0x5125ef){var _0x482b9b=this;var _0x17a7fc=uuid['v4']();this[_0xec60('0x1f')][_0x17a7fc]=new Action(_0x1dc90c,_0x5125ef,_0x17a7fc);return new Promise(function(_0x3addda,_0x15f0bc){if(_[_0xec60('0x3c')](_0x1dc90c)&&typeof _0x1dc90c!==_0xec60('0x15c')){return _0x15f0bc(msgResponse(_0xec60('0x15d'),_0xec60('0x8a'),_0xec60('0x15e')));}if(_[_0xec60('0x3c')](_0x5125ef[_0xec60('0x15f')])||_0x5125ef[_0xec60('0x15f')]===null){return _0x15f0bc(msgResponse(_0xec60('0x15d'),_0xec60('0x8a'),'contact\x20is\x20undefine'));}var _0x2eaf1f={'XMD-CALLERID':_0x482b9b[_0xec60('0x1f')][_0x17a7fc][_0xec60('0x160')](),'XMD-AGI':_0x1dc90c[_0xec60('0x131')]?util['format'](_0xec60('0x161'),ipAgi,_0x1dc90c[_0xec60('0x131')]):_0xec60('0x162'),'XMD-AGIAFTER':_0x1dc90c[_0xec60('0xce')]?util[_0xec60('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1dc90c[_0xec60('0xce')]):_0xec60('0x162'),'XMD-QUEUE':utils[_0xec60('0x163')](_0x1dc90c)?util[_0xec60('0x41')](_0xec60('0x164'),_0x1dc90c['name'],_0x1dc90c[_0xec60('0x165')]||'',_0x1dc90c[_0xec60('0x166')]?'c':'',_0x1dc90c[_0xec60('0xc8')]||0x3):_0xec60('0x162'),'XMD-CONTACTID':_0x5125ef['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x482b9b[_0xec60('0x1f')][_0x17a7fc][_0xec60('0x160')](),'XMD-AMD':_0x1dc90c[_0xec60('0x110')]?_0xec60('0x13d'):_0xec60('0x162'),'XMD-DESTINATION':_0xec60('0x167')};if(_0x1dc90c[_0xec60('0x110')]){_0x2eaf1f['XMD-AMDINITIALSILENCE']=_0x1dc90c[_0xec60('0x168')]||0x9c4;_0x2eaf1f[_0xec60('0x169')]=_0x1dc90c[_0xec60('0x16a')]||0x5dc;_0x2eaf1f[_0xec60('0x16b')]=_0x1dc90c['dialAMDAfterGreetingSilence']||0x320;_0x2eaf1f[_0xec60('0x16c')]=_0x1dc90c[_0xec60('0x16d')]||0x1388;_0x2eaf1f[_0xec60('0x16e')]=_0x1dc90c[_0xec60('0x16f')]||0x64;_0x2eaf1f[_0xec60('0x170')]=_0x1dc90c['dialAMDBetweenWordsSilence']||0x32;_0x2eaf1f[_0xec60('0x171')]=_0x1dc90c['dialAMDMaximumNumberOfWords']||0x3;_0x2eaf1f[_0xec60('0x172')]=_0x1dc90c[_0xec60('0x173')]||0x100;_0x2eaf1f[_0xec60('0x174')]=_0x1dc90c[_0xec60('0x175')]||0x1388;}if(utils[_0xec60('0x163')](_0x1dc90c)){_0x2eaf1f[_0xec60('0x176')]=_0x5125ef[_0xec60('0xeb')];}else{_0x2eaf1f[_0xec60('0x177')]=_0x5125ef[_0xec60('0xdd')];}var _0x3b9d4d=utils[_0xec60('0x178')](_0x5125ef[_0xec60('0x179')]);Object[_0xec60('0x142')](_0x2eaf1f,_0x3b9d4d);var _0x4bc2a6=_0x482b9b[_0xec60('0x83')](_0x1dc90c[_0xec60('0x84')])?utils['getCallerId'](_0x1dc90c[_0xec60('0x84')][_0xec60('0x17a')],_0x1dc90c[_0xec60('0x17b')],_0x1dc90c[_0xec60('0x17c')]>0x0?utils[_0xec60('0x17d')](_0x1dc90c[_0xec60('0x17e')],_0x1dc90c['dialRandomLastDigitCallerIdNumber']):_0x1dc90c[_0xec60('0x17e')]):utils[_0xec60('0x17f')](_['isNil'](_0x1dc90c[_0xec60('0x85')])?_0x1dc90c[_0xec60('0x84')][_0xec60('0x17a')]:_0x1dc90c[_0xec60('0x85')]['callerid'],_0x1dc90c[_0xec60('0x17b')],_0x1dc90c[_0xec60('0x17c')]>0x0?utils[_0xec60('0x17d')](_0x1dc90c[_0xec60('0x17e')],_0x1dc90c[_0xec60('0x17c')]):_0x1dc90c['dialOriginateCallerIdNumber']);if(_0x4bc2a6){_0x2eaf1f['XMD-ORIGINATECALLERIDNAME']=_0x482b9b['actions'][_0x17a7fc][_0xec60('0x180')]=utils['extractCalleridName'](_0x4bc2a6);_0x2eaf1f[_0xec60('0x181')]=_0x5125ef['phone'];}_0x1dc90c['variables']=_0x2eaf1f;return ami[_0xec60('0x92')]({'actionid':_0x17a7fc,'action':'originate','channel':_0x482b9b[_0xec60('0x83')](_0x1dc90c[_0xec60('0x84')])?util[_0xec60('0x41')](_0xec60('0x182'),_0x1dc90c['Trunk'][_0xec60('0x43')],isNotNull(_0x1dc90c[_0xec60('0x183')])?_0x1dc90c[_0xec60('0x183')][_0xec60('0x184')]()||'':'',_0x1dc90c[_0xec60('0x185')]>0x0?_0x5125ef['phone'][_0xec60('0x186')](_0x1dc90c[_0xec60('0x185')]):_0x5125ef[_0xec60('0x15f')]):util[_0xec60('0x41')]('SIP/%s/%s%s',_['isNil'](_0x1dc90c[_0xec60('0x85')])?_0x1dc90c[_0xec60('0x84')][_0xec60('0x43')]:_0x1dc90c[_0xec60('0x85')][_0xec60('0x43')],isNotNull(_0x1dc90c['dialPrefix'])?_0x1dc90c[_0xec60('0x183')][_0xec60('0x184')]()||'':'',_0x1dc90c['dialCutDigit']>0x0?_0x5125ef[_0xec60('0x15f')][_0xec60('0x186')](_0x1dc90c[_0xec60('0x185')]):_0x5125ef['phone']),'callerid':_0x4bc2a6,'Exten':'xcally-motion-dialer','Context':_0xec60('0x187'),'Priority':'1','variable':_0x2eaf1f,'timeout':(_0x1dc90c[_0xec60('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17a7fc})[_0xec60('0x3a')](function(_0x38f095){return _0x3addda(_0x38f095);})[_0xec60('0x97')](function(_0x1b3095){_0x1dc90c['outboundOriginateFailureCallsDay']+=0x1;var _0x1baec9=new History(_0x482b9b['actions'][_0x17a7fc]);logger[_0xec60('0x5f')](util[_0xec60('0x41')]('[originateError]:\x20%s',JSON[_0xec60('0x6c')](_0x1b3095)));_0x1baec9[_0xec60('0xca')]=0xe;_0x1baec9['statedesc']=_0xec60('0x189');_0x1baec9[_0xec60('0x68')]=moment()[_0xec60('0x41')](_0xec60('0xbd'));_0x1baec9['endtime']=_0x1baec9[_0xec60('0x68')];hopperUtils[_0xec60('0xc3')](_0x1baec9)[_0xec60('0x97')](loggerCatch(_0xec60('0x18a')));_0x482b9b['moveContactManagedDialer'](_0x1baec9)['catch'](loggerCatch(_0xec60('0x18a')))[_0xec60('0xfa')](function(){delete _0x482b9b[_0xec60('0x1f')][_0x17a7fc];return _0x15f0bc(msgResponse(_0xec60('0x15d'),'Error',_0xec60('0x18b')));});});});};Dialer[_0xec60('0x18')][_0xec60('0x18c')]=function(_0x108a06,_0x56d4f6,_0x1e24f6){var _0x3b185e=new History(_0x56d4f6);if(_0x3b185e['countbusyretry']+_0x3b185e[_0xec60('0x12c')]+_0x3b185e['countnoanswerretry']+_0x3b185e[_0xec60('0x120')]+_0x3b185e[_0xec60('0xd8')]+_0x3b185e['countabandonedretry']+_0x3b185e['countmachineretry']+_0x3b185e[_0xec60('0x121')]>=_0x1e24f6[_0xec60('0x12d')]-0x1){return!![];}switch(_0x108a06){case 0x3:if(_0x3b185e[_0xec60('0x11f')]>=_0x1e24f6[_0xec60('0x18d')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countnoanswerretry':_0x3b185e[_0xec60('0x11f')]+=0x1,'scheduledat':moment()[_0xec60('0xd9')](_0x1e24f6[_0xec60('0x18e')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})['catch'](loggerCatch(_0xec60('0x18f')));break;case 0x5:if(_0x3b185e[_0xec60('0x11e')]>=_0x1e24f6[_0xec60('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3b185e[_0xec60('0x11e')]+=0x1,'scheduledat':moment()[_0xec60('0xd9')](_0x1e24f6['dialBusyRetryFrequency'],_0xec60('0xda'))[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0x191')));break;case 0x8:if(_0x3b185e[_0xec60('0x12c')]>=_0x1e24f6[_0xec60('0x192')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countcongestionretry':_0x3b185e[_0xec60('0x12c')]+=0x1,'scheduledat':moment()[_0xec60('0xd9')](_0x1e24f6[_0xec60('0x193')],_0xec60('0xda'))[_0xec60('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b185e['ContactId'],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3b185e['countnosuchnumberretry']>=_0x1e24f6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xec60('0xd7')]({'active':![],'countnosuchnumberretry':_0x3b185e[_0xec60('0x120')]+=0x1,'scheduledat':moment()['add'](_0x1e24f6['dialNoSuchNumberRetryFrequency'],_0xec60('0xda'))[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e[_0xec60('0xdc')],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})['catch'](loggerCatch(_0xec60('0x194')));}break;case 0xa:if(_0x3b185e[_0xec60('0xd8')]>=_0x1e24f6[_0xec60('0xd5')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countdropretry':_0x3b185e['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x1e24f6['dialDropRetryFrequency'],_0xec60('0xda'))[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e['VoiceQueueId']||undefined,'CampaignId':_0x3b185e['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3b185e[_0xec60('0xe9')]>=_0x1e24f6[_0xec60('0xea')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countabandonedretry':_0x3b185e['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x1e24f6['dialAbandonedRetryFrequency'],_0xec60('0xda'))[_0xec60('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3b185e[_0xec60('0x11c')]>=_0x1e24f6[_0xec60('0x12e')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countmachineretry':_0x3b185e[_0xec60('0x11c')]+=0x1,'scheduledat':moment()[_0xec60('0xd9')](_0x1e24f6[_0xec60('0x126')],_0xec60('0xda'))[_0xec60('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e['ListId'],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3b185e[_0xec60('0x121')]>=_0x1e24f6[_0xec60('0x195')]-0x1){return!![];}hopperUtils[_0xec60('0xd7')]({'active':![],'countagentrejectretry':_0x3b185e[_0xec60('0x121')]+=0x1,'scheduledat':moment()[_0xec60('0xd9')](_0x1e24f6[_0xec60('0x196')],'minutes')[_0xec60('0x41')](_0xec60('0xbd')),'ContactId':_0x3b185e[_0xec60('0xdb')],'ListId':_0x3b185e[_0xec60('0xdc')],'VoiceQueueId':_0x3b185e[_0xec60('0xeb')]||undefined,'CampaignId':_0x3b185e[_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xec60('0x18')][_0xec60('0x10b')]=function(_0x3539d0,_0x2a9ad3,_0x2eddaa){var _0x54ee95=this;var _0x3e2cb8=new History(_0x3539d0);var _0x5bee2a=![];var _0x29b8a8;var _0x7e057f;return new Promise(function(_0x40e1e9,_0x182cd3){if(_['isUndefined'](_0x2a9ad3)&&typeof _0x2a9ad3!==_0xec60('0x15c')){return _0x182cd3(msgResponse(_0xec60('0x197'),_0xec60('0x8a'),_0xec60('0x198')));}if(_['isUndefined'](_0x2eddaa)&&typeof _0x2eddaa!==_0xec60('0x15c')){return _0x182cd3(msgResponse(_0xec60('0x197'),_0xec60('0x8a'),_0xec60('0x199')));}hopperUtils['verifyAdditionalPhones'](_0x3e2cb8,_0x2eddaa[_0xec60('0xc0')],_0x2a9ad3)[_0xec60('0x3a')](function(_0x3cc366){if(_0x3cc366[_0xec60('0xd4')]==0x1)_0x5bee2a=!![];switch(_0x2eddaa['reason']){case'0':_0x2a9ad3['outboundNoSuchCallsDay']+=0x1;_0x3e2cb8[_0xec60('0xca')]=0x0;_0x3e2cb8[_0xec60('0xdf')]=_0xec60('0x19a');_0x3e2cb8[_0xec60('0x120')]+=0x1;_0x3e2cb8[_0xec60('0xcf')]+=0x1;ami[_0xec60('0x3d')](_0xec60('0x19b'),ut[_0xec60('0x114')](_0x3539d0,'nosuchnumber'));_0x29b8a8=_0x2a9ad3[_0xec60('0x19c')];_0x7e057f=_0x2a9ad3['callAdditionalPhoneAfterMin'];hopperUtils[_0xec60('0xc3')](_0x3e2cb8)['catch'](loggerCatch(_0xec60('0x11d')));if(_0x54ee95[_0xec60('0x18c')](0x0,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8[_0xec60('0x120')]>=_0x2a9ad3[_0xec60('0x19d')]){_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x19e'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x19e'));}}break;case'3':_0x2a9ad3[_0xec60('0x19f')]+=0x1;_0x3e2cb8['state']=0x3;_0x3e2cb8['statedesc']=_0xec60('0x1a0');_0x3e2cb8['countnoanswerretry']+=0x1;_0x3e2cb8[_0xec60('0xcf')]+=0x1;var _0x250a55=ut[_0xec60('0x1a1')](_0x3539d0,_0x2a9ad3);ami[_0xec60('0x3d')](_0xec60('0x1a2'),_0x250a55);_0x29b8a8=_0x2a9ad3[_0xec60('0x18e')];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];hopperUtils['createHistory'](_0x3e2cb8)[_0xec60('0x97')](loggerCatch(_0xec60('0x1a3')));if(_0x54ee95[_0xec60('0x18c')](0x3,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8['countnoanswerretry']>=_0x2a9ad3[_0xec60('0x18d')]){_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1a4'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1a4'));}}break;case'5':_0x2a9ad3[_0xec60('0x1a5')]+=0x1;_0x3e2cb8['state']=0x5;_0x3e2cb8[_0xec60('0xdf')]=_0xec60('0x1a6');_0x3e2cb8[_0xec60('0x11e')]+=0x1;_0x3e2cb8[_0xec60('0xcf')]+=0x1;ami[_0xec60('0x3d')]('custom:agentbusy',ut[_0xec60('0x114')](_0x3539d0,_0xec60('0x1a7')));_0x29b8a8=_0x2a9ad3[_0xec60('0x1a8')];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];hopperUtils[_0xec60('0xc3')](_0x3e2cb8)['catch'](loggerCatch(_0xec60('0x1a9')));if(_0x54ee95[_0xec60('0x18c')](0x5,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8['countbusyretry']>=_0x2a9ad3[_0xec60('0x190')]){_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1aa'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,'reason\x205\x20busy');}}break;case'8':_0x2a9ad3[_0xec60('0x1ab')]+=0x1;_0x3e2cb8['state']=0x8;_0x3e2cb8[_0xec60('0xdf')]=_0xec60('0x1ac');_0x3e2cb8[_0xec60('0x12c')]+=0x1;_0x3e2cb8['countglobal']+=0x1;_0x29b8a8=_0x2a9ad3['dialCongestionRetryFrequency'];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];ami['emit'](_0xec60('0x1ad'),ut[_0xec60('0x114')](_0x3539d0,_0xec60('0x1ae')));hopperUtils[_0xec60('0xc3')](_0x3e2cb8)[_0xec60('0x97')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x54ee95[_0xec60('0x18c')](0x8,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8['countcongestionretry']>=_0x2a9ad3[_0xec60('0x192')]){_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1af'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,'reason\x208\x20congestion');}}break;case'11':_0x2a9ad3['outboundAbandonedCallsDay']+=0x1;_0x3e2cb8[_0xec60('0xca')]=0xb;_0x3e2cb8['statedesc']=_0xec60('0xe6');_0x3e2cb8[_0xec60('0xe9')]+=0x1;_0x3e2cb8[_0xec60('0xcf')]+=0x1;_0x29b8a8=_0x2a9ad3[_0xec60('0xe8')];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];hopperUtils[_0xec60('0xc3')](_0x3e2cb8)[_0xec60('0x97')](loggerCatch(_0xec60('0xed')));if(_0x54ee95[_0xec60('0x18c')](0xb,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8[_0xec60('0xe9')]>=_0x2a9ad3[_0xec60('0xea')]){_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1b0'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1b0'));}}break;case'20':_0x2a9ad3['outboundRejectCallsDay']+=0x1;_0x3e2cb8[_0xec60('0xca')]=0x14;_0x3e2cb8[_0xec60('0xdf')]=_0xec60('0x1b1');_0x3e2cb8[_0xec60('0x121')]+=0x1;_0x3e2cb8['countglobal']+=0x1;_0x29b8a8=_0x2a9ad3[_0xec60('0x196')];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];ami[_0xec60('0x3d')](_0xec60('0x1b2'),ut[_0xec60('0x114')](_0x3539d0,_0xec60('0x1b3')));hopperUtils['createHistory'](_0x3e2cb8)[_0xec60('0x97')](loggerCatch(_0xec60('0x1b4')));if(_0x54ee95[_0xec60('0x18c')](0x14,_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8[_0xec60('0x121')]>=_0x2a9ad3['dialAgentRejectMaxRetry']){_0x54ee95['createStateFinal'](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0xec60('0x1b5'));}else{_0x54ee95[_0xec60('0x122')](_0x3e2cb8,_0x40e1e9,_0x182cd3,'reason\x2020\x20agentreject');}}break;default:_0x2a9ad3[_0xec60('0x133')]+=0x1;_0x3e2cb8[_0xec60('0xca')]=0xc;_0x3e2cb8[_0xec60('0xdf')]=_0x2eddaa[_0xec60('0xc0')];_0x29b8a8=_0x2a9ad3[_0xec60('0x196')];_0x7e057f=_0x2a9ad3[_0xec60('0xd1')];hopperUtils[_0xec60('0xc3')](_0x3e2cb8)['catch'](loggerCatch(_0xec60('0x1b6')));if(_0x54ee95['checkRetriveMax'](_0x2eddaa[_0xec60('0xc0')],_0x3539d0,_0x2a9ad3)&&!_0x5bee2a){if(_0x3e2cb8[_0xec60('0x11e')]+_0x3e2cb8['countcongestionretry']+_0x3e2cb8[_0xec60('0x11f')]+_0x3e2cb8[_0xec60('0x120')]+_0x3e2cb8[_0xec60('0xd8')]+_0x3e2cb8['countabandonedretry']+_0x3e2cb8[_0xec60('0x11c')]+_0x3e2cb8[_0xec60('0x121')]>=_0x2a9ad3['dialGlobalMaxRetry']){_0x54ee95['stateGlobal'](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0x2eddaa[_0xec60('0xc0')]);}else{_0x54ee95[_0xec60('0x124')](_0x3e2cb8,_0x40e1e9,_0x182cd3,_0x2eddaa[_0xec60('0xc0')]);}}}})[_0xec60('0x3a')](function(){if(_0x5bee2a){hopperUtils[_0xec60('0xe4')](_0x3e2cb8,_0x29b8a8,_0x7e057f)['then'](function(){return _0x40e1e9(0x1);});}});});};Dialer[_0xec60('0x18')][_0xec60('0x122')]=function(_0x490f4a,_0x27a6de,_0x225c9e,_0x21816f){var _0x8e1a8=new Final(_0x490f4a);_0x8e1a8['state']=0xf;_0x8e1a8[_0xec60('0xdf')]=_0xec60('0x1b7');this[_0xec60('0x124')](_0x8e1a8,_0x27a6de,_0x225c9e,_0x21816f);};Dialer['prototype'][_0xec60('0x124')]=function(_0x51751e,_0x4e3462,_0x576896,_0x2c9d8d){hopperUtils[_0xec60('0xc5')](_0x51751e)[_0xec60('0x3a')](function(){return _0x4e3462(msgResponse(_0xec60('0x197'),_0xec60('0x10a'),_0x2c9d8d));})[_0xec60('0x97')](function(){return _0x576896(msgResponse(_0xec60('0x1b8'),_0xec60('0x8a'),_0xec60('0x1b9')));});};Dialer[_0xec60('0x18')]['predictive']=function(_0x23d2da){var _0x4be3c=_0x23d2da[_0xec60('0x1ba')]/0x64;var _0x29f2ec=_0x23d2da[_0xec60('0xc9')]/(_0x23d2da[_0xec60('0xc9')]+_0x23d2da[_0xec60('0xbf')]);var _0x1e7222=Math[_0xec60('0x1bb')](_0x23d2da[_0xec60('0x1bc')]*(_0x23d2da[_0xec60('0x1bd')]/0x64));var _0x4100e6=Math[_0xec60('0x1bb')](_0x23d2da[_0xec60('0x1bc')]*(_0x23d2da[_0xec60('0x1be')]/0x64));var _0x512487=_0x23d2da['available']+_0x23d2da[_0xec60('0x13c')];var _0x3ad1c2=Math[_0xec60('0x1bf')](_0x23d2da['erlangCalls']*_0x23d2da[_0xec60('0x59')]*_0x23d2da[_0xec60('0x1c0')]*_0x23d2da[_0xec60('0x1c1')]);if(_[_0xec60('0x3c')](_0x23d2da[_0xec60('0x22')])){if(!_['isUndefined'](_0x23d2da['startPredictive'])){_0x23d2da[_0xec60('0x21')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xec60('0x1c2'));}if(!_[_0xec60('0x3c')](_0x23d2da['handlePredictive'])){loggerPredictive[_0xec60('0x5f')](_0xec60('0x1c3'),_0xec60('0x1c4'));clearInterval(_0x23d2da[_0xec60('0x5d')]);_0x23d2da['handlePredictive']=undefined;}_0x23d2da[_0xec60('0x22')]=moment()[_0xec60('0x41')](_0xec60('0xbd'));loggerPredictive[_0xec60('0x46')](_0x23d2da[_0xec60('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x23d2da[_0xec60('0x22')]);this[_0xec60('0xac')](_0x23d2da,0x1);}else if(ifInterval(_0x23d2da['dialPredictiveInterval'],_0x23d2da[_0xec60('0x22')])){this['handlePower'](_0x23d2da,0x1);loggerPredictiveCalls[_0xec60('0x46')](_0xec60('0x1c5'),_0x23d2da[_0xec60('0x22')],_0x23d2da['name']);_0x23d2da[_0xec60('0x1c6')]=0x0;_0x23d2da[_0xec60('0x1c7')]=0x0;}else if(_0x4be3c<_0x29f2ec&&_0x23d2da['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x23d2da);loggerPredictive[_0xec60('0x46')](_0xec60('0x1c8'),_0xec60('0x1c9'),_0x29f2ec,_0xec60('0x22'),_0x23d2da[_0xec60('0x43')]);}else if(_0x3ad1c2<_0x23d2da[_0xec60('0x1c7')]&&_0x23d2da['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x23d2da);loggerPredictive['info'](_0xec60('0x1ca'),'Max\x20Drop\x20',_0x3ad1c2,_0xec60('0x1cb'),_0x23d2da['predictiveIntervalErlangCallsDroppedCalls'],_0xec60('0x22'),_0x23d2da['name']);}else if(!ifInterval(_0x23d2da[_0xec60('0x1cc')],_0x23d2da[_0xec60('0x22')])&&_[_0xec60('0x3c')](_0x23d2da[_0xec60('0x21')])&&!_[_0xec60('0x3c')](_0x23d2da['startProgressive'])){_0x23d2da[_0xec60('0x21')]=moment()[_0xec60('0x41')](_0xec60('0xbd'));loggerPredictive['info'](_0x23d2da['name'],_0xec60('0x1cd'),_0x23d2da['startPredictive']);hopperUtils['avgHandleTime'](_0x23d2da['dialPredictiveInterval'])[_0xec60('0x3a')](this['getDataPredictive'](_0x23d2da))['then'](mergeDataErlangB(_0x23d2da))[_0xec60('0x3a')](this[_0xec60('0x1ce')](_0x23d2da))[_0xec60('0x97')](loggerCatchPredictive(_0xec60('0x1cf'),_0x23d2da));}else if(!ifInterval(_0x23d2da[_0xec60('0x1cc')],_0x23d2da[_0xec60('0x21')])){_0x23d2da[_0xec60('0x1c7')]=0x0;_0x23d2da[_0xec60('0x21')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xec60('0x46')](_0x23d2da['name'],_0xec60('0x1d0'),_0x23d2da[_0xec60('0x21')]);clearInterval(_0x23d2da[_0xec60('0x5d')]);_0x23d2da['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x23d2da[_0xec60('0x1cc')])['then'](this[_0xec60('0x1d1')](_0x23d2da))[_0xec60('0x3a')](mergeDataErlangB(_0x23d2da))[_0xec60('0x3a')](this['startMethodPredictive'](_0x23d2da))[_0xec60('0x97')](loggerCatchPredictive(_0xec60('0x1d2'),_0x23d2da));}else if(_0x23d2da[_0xec60('0x1bc')]&&_0x512487<_0x23d2da[_0xec60('0x1bc')]-_0x4100e6){clearPredictiveAttributes(_0x23d2da);loggerPredictive[_0xec60('0x46')](_0x23d2da[_0xec60('0x43')],_0xec60('0x1d3'),_0x512487,_0xec60('0x1d4'),_0x23d2da[_0xec60('0x1bc')],'-',_0x4100e6,'=',_0x23d2da[_0xec60('0x1bc')]-_0x4100e6,')');}else if(_0x23d2da[_0xec60('0x1bc')]&&_0x512487>_0x23d2da['predictiveIntervalAvailable']+_0x1e7222){clearPredictiveAttributes(_0x23d2da);loggerPredictive[_0xec60('0x46')](_0x23d2da[_0xec60('0x43')],_0xec60('0x1d3'),_0x512487,_0xec60('0x1d5'),_0x23d2da['predictiveIntervalAvailable'],'+',_0x1e7222,'=',_0x23d2da['predictiveIntervalAvailable']+_0x1e7222,')');}};Dialer['prototype'][_0xec60('0x1d1')]=function(_0xbdec0a){var _0x92a028=this;return function(_0x3afaa8){return new Promise(function(_0x529777,_0x38f765){_[_0xec60('0x5b')](_0xbdec0a,_0x3afaa8[0x0]);if(checkGetDataPredictive(_0x3afaa8[0x0])){var _0x169114=_0xbdec0a[_0xec60('0x1bc')]=_0xbdec0a[_0xec60('0x13c')]+_0xbdec0a[_0xec60('0x13a')];var _0x5c409b=_0xbdec0a['dialPredictiveInterval']*0x3c;var _0x3c1f2d=_0x3afaa8[0x0][_0xec60('0x51')]+_0x3afaa8[0x0][_0xec60('0x4e')];var _0x54fa17=(_0x3afaa8[0x0][_0xec60('0x4a')]+_0x3afaa8[0x0][_0xec60('0x4b')]+_0x3afaa8[0x0][_0xec60('0xe5')])/_0x3afaa8[0x0][_0xec60('0x49')];_0xbdec0a[_0xec60('0x1c0')]=_0x54fa17>0x0?_0x54fa17:0x1;switch(_0xbdec0a[_0xec60('0x1d6')]){case'dropRate':var _0x4627b2=_0xbdec0a['dialPredictiveOptimizationPercentage']/0x64;return _0x92a028[_0xec60('0x1d7')](_0x169114,_0x5c409b,_0x3c1f2d,_0x54fa17,_0x4627b2)[_0xec60('0x3a')](function(_0x202823){return _0x529777(_0x202823);});case _0xec60('0x1d8'):var _0x1661a3=_0xbdec0a[_0xec60('0x1ba')]/0x64;return _0x92a028['busyFactor'](_0x169114,_0x5c409b,_0x3c1f2d,_0x54fa17,_0x1661a3)[_0xec60('0x3a')](function(_0x32d7b5){return _0x529777(_0x32d7b5);});default:return _0x38f765(msgResponse(_0xec60('0x1d9'),'Failure',_0xec60('0x1da')));}}else{return _0x38f765(msgResponse(_0xec60('0x1d9'),_0xec60('0x8a'),'check\x20failure'));}});};};Dialer[_0xec60('0x18')][_0xec60('0x1db')]=function(_0x27cf7d){var _0x3b1379=this;return function(_0xeb2d69){return new Promise(function(_0x4b201e,_0x1da497){_[_0xec60('0x5b')](_0x27cf7d,_0xeb2d69[0x0]);if(checkGetDataPredictive(_0xeb2d69[0x0])){loggerPredictive[_0xec60('0x46')](JSON[_0xec60('0x6c')](_0xeb2d69[0x0]));if(_0x27cf7d[_0xec60('0x1d6')]==='dropRate'){return _0x3b1379['getVoiceQueueRtPauses'](_0x27cf7d['id'])['then'](function(_0x4707a3){var _0xc6d165=_0x27cf7d['loggedIn']-_0x4707a3[0x0][_0xec60('0x1dc')];var _0x2ba383=_0x27cf7d[_0xec60('0x1cc')]*0x3c;var _0x4528d8=_0xeb2d69[0x0][_0xec60('0x51')]+_0xeb2d69[0x0][_0xec60('0x4e')];var _0x12545e=(_0xeb2d69[0x0]['predictiveIntervalAnsweredCalls']+_0xeb2d69[0x0][_0xec60('0x4b')]+_0xeb2d69[0x0][_0xec60('0xe5')])/_0xeb2d69[0x0][_0xec60('0x49')];var _0x1a3d8e=_0x27cf7d[_0xec60('0x1ba')]/0x64;_0x27cf7d[_0xec60('0x1dd')]=_0x4707a3[0x0][_0xec60('0x1dc')]||0x0;_0x27cf7d[_0xec60('0x1c0')]=_0x12545e>0x0?_0x12545e:0x1;return _0x3b1379[_0xec60('0x1d7')](_0xc6d165,_0x2ba383,_0x4528d8,_0x12545e,_0x1a3d8e);})[_0xec60('0x3a')](function(_0x5c0c16){return _0x4b201e(_0x5c0c16);})[_0xec60('0x97')](function(_0x290ba4){return _0x1da497(msgResponse('[CatchErlangB]',_0xec60('0x8a'),JSON[_0xec60('0x6c')](_0x290ba4)));});}if(_0x27cf7d[_0xec60('0x1d6')]===_0xec60('0x1d8')){return _0x3b1379[_0xec60('0x151')](_0x27cf7d['id'])[_0xec60('0x3a')](function(_0x45ce2b){var _0x48dd63=_0x27cf7d[_0xec60('0x1de')]-_0x45ce2b[0x0][_0xec60('0x1dc')];var _0xc107af=_0x27cf7d['dialPredictiveInterval']*0x3c;var _0x408af4=_0xeb2d69[0x0][_0xec60('0x51')]+_0xeb2d69[0x0][_0xec60('0x4e')];var _0x31700d=(_0xeb2d69[0x0][_0xec60('0x4a')]+_0xeb2d69[0x0][_0xec60('0x4b')]+_0xeb2d69[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xeb2d69[0x0][_0xec60('0x49')];var _0x1cd211=_0x27cf7d['dialPredictiveOptimizationPercentage']/0x64;_0x27cf7d[_0xec60('0x1dd')]=_0x45ce2b[0x0]['outboundQueuePauses']||0x0;_0x27cf7d[_0xec60('0x1c0')]=_0x31700d>0x0?_0x31700d:0x1;return _0x3b1379[_0xec60('0x1df')](_0x48dd63,_0xc107af,_0x408af4,_0x31700d,_0x1cd211);})[_0xec60('0x3a')](function(_0x26f7b1){return _0x4b201e(_0x26f7b1);})[_0xec60('0x97')](function(_0x2fbaad){return _0x1da497(msgResponse('[CatchErlangB]',_0xec60('0x8a'),JSON[_0xec60('0x6c')](_0x2fbaad)));});}}else{return _0x1da497(msgResponse(_0xec60('0x1d9'),_0xec60('0x8a'),_0xec60('0x1e0')));}});};};Dialer[_0xec60('0x18')][_0xec60('0x1ce')]=function(_0x3f8f66){var _0x82de1e=this;return function(){var _0xe9fe9a=0x0;var _0x1e5489=Math[_0xec60('0x1bf')](_0x3f8f66[_0xec60('0x57')]*0x3e8);if(_0x1e5489>0x0){_0x1e5489=_0x1e5489<0x64?0x64:_0x1e5489;loggerPredictive[_0xec60('0x46')](_0x3f8f66[_0xec60('0x43')],_0xec60('0x1e1'),_0x1e5489,_0xec60('0x1e2'));_0x3f8f66[_0xec60('0x5d')]=setInterval(function(){_0x82de1e['handlePredictive'](_0x3f8f66);loggerPredictiveCalls[_0xec60('0x46')](_0xec60('0x1e3'),_0xe9fe9a+=0x1);},_0x1e5489);}else{loggerPredictive[_0xec60('0x46')](_0x3f8f66['name'],_0xec60('0x1e4'));}};};Dialer[_0xec60('0x18')]['checkContactBlack']=function(_0x1d668a,_0x28fd29){var _0x3f75af=this;return function(_0x591c2b){if(_[_0xec60('0x45')](_0x591c2b)){if(_['isNil'](_0x28fd29[_0xec60('0x155')])||!_0x28fd29[_0xec60('0x1e5')]){if(_0x1d668a[_0xec60('0xab')]===_0xec60('0x6')){_0x1d668a['queueStatusComplete']=_[_0xec60('0x3c')](_0x1d668a[_0xec60('0x69')])?!![]:_0x1d668a[_0xec60('0x69')];var _0x4f2251=uuid['v4']();_0x3f75af[_0xec60('0x1f')][_0x4f2251]=new Action(_0x1d668a,_0x28fd29,_0x4f2251);loggerBooked[_0xec60('0x46')](_0xec60('0x1e6'),_0x4f2251,_0xec60('0x1e7'),JSON[_0xec60('0x6c')](_0x1d668a['queueStatusComplete']),_0xec60('0x1e8'),_0x1d668a['name']);if(_0x1d668a[_0xec60('0x69')]){_0x1d668a[_0xec60('0x69')]=![];_0x3f75af[_0xec60('0x24')][_0x3f75af['actions'][_0x4f2251][_0xec60('0xbe')]]=[];ami[_0xec60('0x92')]({'actionid':_0x4f2251,'action':'queuestatus','queue':_0x1d668a['name']})[_0xec60('0x97')](function(){_0x3f75af[_0xec60('0xbb')](_0x1d668a);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3f75af[_0xec60('0x1f')][_0x4f2251][_0xec60('0xdb')],'ListId':_0x3f75af[_0xec60('0x1f')][_0x4f2251][_0xec60('0xdc')],'VoiceQueueId':_0x3f75af[_0xec60('0x1f')][_0x4f2251][_0xec60('0xeb')]||undefined,'CampaignId':_0x3f75af[_0xec60('0x1f')][_0x4f2251]['CampaignId']||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0x1e9')));delete _0x3f75af[_0xec60('0x1f')][_0x4f2251];});}else{loggerBooked[_0xec60('0x46')](_0xec60('0x1ea'),JSON[_0xec60('0x6c')](_0x1d668a[_0xec60('0x69')]),_0xec60('0x1e8'),_0x1d668a[_0xec60('0x43')]);_0x3f75af['updateOriginated'](_0x1d668a);hopperUtils[_0xec60('0xd7')]({'active':![],'ContactId':_0x3f75af[_0xec60('0x1f')][_0x4f2251]['ContactId'],'ListId':_0x3f75af[_0xec60('0x1f')][_0x4f2251][_0xec60('0xdc')],'VoiceQueueId':_0x3f75af['actions'][_0x4f2251][_0xec60('0xeb')]||undefined,'CampaignId':_0x3f75af['actions'][_0x4f2251][_0xec60('0xdd')]||undefined})[_0xec60('0x97')](loggerCatch(_0xec60('0x1e9')));delete _0x3f75af[_0xec60('0x1f')][_0x4f2251];}}else{return _0x3f75af['actionOriginate'](_0x1d668a,_0x28fd29);}}else{if(utils['getSeconds'](undefined,_0x28fd29[_0xec60('0x1eb')])<_0x1d668a[_0xec60('0x1ec')]*0x3c){if(_0x28fd29[_0xec60('0x146')]&&!_0x28fd29[_0xec60('0x146')][_0xec60('0x1ed')]){_0x3f75af[_0xec60('0x100')]['run'](_0x28fd29['id'])[_0xec60('0xfa')](function(){_0x3f75af[_0xec60('0xbb')](_0x1d668a);});}else{hopperUtils[_0xec60('0x1ee')]({'active':![]},_0x28fd29['id'],0x1)['finally'](function(){_0x3f75af[_0xec60('0xbb')](_0x1d668a);});}}else{_0x1d668a[_0xec60('0x1ef')]+=0x1;_0x3f75af['updateOriginated'](_0x1d668a);if(_0x1d668a[_0xec60('0x1f0')]){hopperUtils[_0xec60('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x28fd29[_0xec60('0xdb')],'ListId':_0x28fd29[_0xec60('0xdc')],'VoiceQueueId':_0x28fd29[_0xec60('0xeb')]||undefined,'CampaignId':_0x28fd29['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xec60('0xc3')](createObjHistory(_0x1d668a,_0x28fd29,utils[_0xec60('0x63')]['QUEUE_RECALL'],0x17,_0xec60('0x1f1')))['catch'](loggerCatch(_0xec60('0x1f2')));}else{_0x3f75af[_0xec60('0x116')](createObjHistory(_0x1d668a,_0x28fd29,utils[_0xec60('0x63')][_0xec60('0x1f3')],0x16,_0xec60('0x1f4')),_0xec60('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x1d668a[_0xec60('0x1f6')]+=0x1;_0x3f75af[_0xec60('0x116')](createObjHistory(_0x1d668a,_0x28fd29,utils[_0xec60('0x63')][_0xec60('0x1f7')],0xd,_0xec60('0x1f8')),_0xec60('0x1f9'),_0xec60('0x1fa'));throw'inBlackList';}};};Dialer[_0xec60('0x18')][_0xec60('0x15a')]=function(_0x5a10d5){var _0x11be28=this;var _0x2f2d0b=_0x5a10d5[_0xec60('0x1fb')]-_0x5a10d5[_0xec60('0x77')];emitCampaignSummary(_0x5a10d5);if(_0x2f2d0b>0x0&&_0x5a10d5[_0xec60('0x1fc')]==0x0){if(_0x2f2d0b>this[_0xec60('0x1e')]){_0x2f2d0b=this[_0xec60('0x1e')];}_0x5a10d5['temp']=0x1;hopperUtils[_0xec60('0x1fd')](_0x5a10d5,_0x2f2d0b)[_0xec60('0x3a')](function(_0x3a6517){_0x5a10d5[_0xec60('0x1fc')]=0x0;if(_0x3a6517){if(!utils[_0xec60('0x1fe')](_0x3a6517)){_0x5a10d5['message']=utils[_0xec60('0x63')][_0xec60('0x1ff')];logger[_0xec60('0x46')](_0xec60('0x200')+_0x5a10d5[_0xec60('0x43')]);}else{_0x5a10d5[_0xec60('0x77')]+=_0x3a6517[_0xec60('0x90')];_0x5a10d5[_0xec60('0x62')]=utils[_0xec60('0x63')][_0xec60('0x201')];for(var _0x2db1ad=0x0;_0x2db1ad<_0x3a6517[_0xec60('0x90')];_0x2db1ad+=0x1){_0x5a10d5[_0xec60('0x202')]+=0x1;if(_[_0xec60('0xf1')](_0x3a6517[_0x2db1ad])||_[_0xec60('0xf1')](_0x3a6517[_0x2db1ad][_0xec60('0x179')])||_[_0xec60('0xf1')](_0x3a6517[_0x2db1ad][_0xec60('0x15f')])){_0x11be28[_0xec60('0x203')](_0xec60('0x204'),_0x5a10d5,_0x3a6517[_0x2db1ad]);}else{hopperUtils[_0xec60('0x205')](_['pick'](_0x3a6517[_0x2db1ad],[_0xec60('0xdd'),_0xec60('0x15f')]))[_0xec60('0x3a')](_0x11be28[_0xec60('0x206')](_0x5a10d5,_0x3a6517[_0x2db1ad]))['catch'](_0x11be28['loggerHandler']('[actionOriginateIvr]\x20',_0x5a10d5));}}}}})[_0xec60('0x97')](loggerGetContactDialer('[getContactCampaign2]',_0x5a10d5,_0x2f2d0b));}};Dialer[_0xec60('0x18')][_0xec60('0xac')]=function(_0x137e47,_0x397e13){var _0x500f39=this;var _0x51671f=[];if(_0x397e13<0x1||_0x137e47[_0xec60('0xab')]===_0xec60('0x6')){_0x397e13=0x1;}var _0x727fd1=Math[_0xec60('0x1bf')](_0x137e47[_0xec60('0x13a')]*_0x397e13)-_0x137e47['originated'];if(_0x137e47['dialLimitQueue']>0x0){var _0x34a611=_0x137e47[_0xec60('0x207')]-_0x137e47[_0xec60('0x77')]-_0x137e47['talking']-_0x137e47[_0xec60('0x208')];if(_0x727fd1>_0x34a611){_0x727fd1=_0x34a611;}}if(_0x727fd1>0x0&&_0x137e47['temp']==0x0){if(_0x137e47[_0xec60('0xab')]==='booked'){_0x727fd1=0x1;}if(_0x727fd1>this[_0xec60('0x1e')]){_0x727fd1=this[_0xec60('0x1e')];}for(var _0x217966 in this['agents']){if(typeof this[_0xec60('0x1c')][_0x217966]!==_0xec60('0xa2')){if(this['agents'][_0x217966][_0xec60('0xca')]===_0xec60('0x209')&&this[_0xec60('0x1c')][_0x217966]['status']==='reachable'){_0x51671f[_0xec60('0x91')](this['agents'][_0x217966]['id']);}}}_0x137e47['temp']=0x1;hopperUtils[_0xec60('0x20a')](_0x137e47,_0x51671f,_0x727fd1)['then'](function(_0x48803b){_0x137e47['temp']=0x0;if(_0x48803b){if(!utils[_0xec60('0x1fe')](_0x48803b)){hopperUtils[_0xec60('0x20b')](_0x137e47)['then'](sendMessageReschedule(_0x137e47))[_0xec60('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x137e47[_0xec60('0x77')]+=_0x48803b['length'];_0x137e47['message']=_0x137e47[_0xec60('0xab')]===_0xec60('0x6')?utils[_0xec60('0x63')][_0xec60('0x13d')]:utils['CAMPAIGN_STATUS'][_0xec60('0x201')];for(var _0xed261b=0x0;_0xed261b<_0x48803b['length'];_0xed261b+=0x1){if(_[_0xec60('0xf1')](_0x48803b[_0xed261b])||_['isNil'](_0x48803b[_0xed261b][_0xec60('0x179')])||_[_0xec60('0xf1')](_0x48803b[_0xed261b]['phone'])){_0x500f39['emptyContact']('[actionOriginate]\x20',_0x137e47,_0x48803b[_0xed261b]);}else{hopperUtils[_0xec60('0x20c')](_[_0xec60('0x6d')](_0x48803b[_0xed261b],[_0xec60('0xeb'),'phone']))[_0xec60('0x3a')](_0x500f39['checkContactBlack'](_0x137e47,_0x48803b[_0xed261b]))[_0xec60('0x97')](_0x500f39[_0xec60('0x153')](_0xec60('0x204'),_0x137e47));}}}}})[_0xec60('0x97')](loggerGetContactDialer(_0xec60('0x20d'),_0x137e47,_0x727fd1));}};Dialer[_0xec60('0x18')][_0xec60('0x5d')]=function(_0x4640e4){if(_0x4640e4[_0xec60('0x207')]>0x0){var _0x24346e=_0x4640e4[_0xec60('0x207')]-_0x4640e4[_0xec60('0x77')]-_0x4640e4[_0xec60('0x13c')];if(_0x24346e>0x0&&_0x4640e4[_0xec60('0x1fc')]==0x0){this[_0xec60('0x20e')](_0x4640e4);}else{loggerPredictiveCalls[_0xec60('0x46')](_0xec60('0x20f'));}}else{this[_0xec60('0x20e')](_0x4640e4);}};Dialer[_0xec60('0x18')][_0xec60('0x20e')]=function(_0x1cafc5){var _0x362fa3=this;var _0x145fa0=[];_0x1cafc5['originated']+=0x1;for(var _0x399ea3 in this[_0xec60('0x1c')]){if(typeof this[_0xec60('0x1c')][_0x399ea3]!=='undefined'){if(this[_0xec60('0x1c')][_0x399ea3][_0xec60('0xca')]===_0xec60('0x209')&&this['agents'][_0x399ea3][_0xec60('0x80')]===_0xec60('0x81')){_0x145fa0[_0xec60('0x91')](this[_0xec60('0x1c')][_0x399ea3]['id']);}}}_0x1cafc5[_0xec60('0x1fc')]=0x1;return this[_0xec60('0x20a')](_0x1cafc5['id'],_0x145fa0,0x1,_0x1cafc5[_0xec60('0x210')],_0x1cafc5)['then'](function(_0x5c5a95){_0x1cafc5[_0xec60('0x1fc')]=0x1;if(_0x5c5a95){if(!utils[_0xec60('0x1fe')](_0x5c5a95)){utils[_0xec60('0x60')](_0x1cafc5,0x1,0x0);return hopperUtils[_0xec60('0x20b')](_0x1cafc5)['then'](sendMessageReschedule(_0x1cafc5))[_0xec60('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x1cafc5[_0xec60('0x62')]=utils[_0xec60('0x63')][_0xec60('0x201')];if(_['isNil'](_0x5c5a95[0x0])||_[_0xec60('0xf1')](_0x5c5a95[0x0]['Contact'])||_[_0xec60('0xf1')](_0x5c5a95[0x0][_0xec60('0x15f')])){_0x362fa3[_0xec60('0x203')]('[actionOriginate]\x20',_0x1cafc5,_0x5c5a95[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xec60('0x6d')](_0x5c5a95[0x0],[_0xec60('0xeb'),'phone']))[_0xec60('0x3a')](_0x362fa3[_0xec60('0x206')](_0x1cafc5,_0x5c5a95[0x0]))[_0xec60('0x97')](_0x362fa3[_0xec60('0x153')](_0xec60('0x211'),_0x1cafc5));}}}})[_0xec60('0x97')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1cafc5,0x1));};Dialer[_0xec60('0x18')][_0xec60('0x1d7')]=function(_0xf89898,_0x1dcb75,_0x21f553,_0x39059a,_0x24d6ad,_0x4bebf3){loggerPredictive['info'](_0xec60('0x212'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf89898);loggerPredictive[_0xec60('0x46')](_0xec60('0x213'),_0x1dcb75);loggerPredictive[_0xec60('0x46')](_0xec60('0x214'),_0x21f553);loggerPredictive[_0xec60('0x46')](_0xec60('0x215'),_0x39059a);loggerPredictive[_0xec60('0x46')](_0xec60('0x216'),_0x24d6ad);loggerPredictive[_0xec60('0x46')](_0xec60('0x50'));return new Promise(function(_0x2c3fd6,_0x577011){if(_0xf89898<=0x0||isNaN(_0xf89898)){return _0x577011(msgResponse(_0xec60('0x217'),'Error',_0xec60('0x218')+_0xf89898));}if(_0x21f553<=0x0||isNaN(_0x21f553)){return _0x577011(msgResponse(_0xec60('0x217'),_0xec60('0x7d'),_0xec60('0x219')+_0x21f553));}if(_0x39059a<=0x0||isNaN(_0x39059a)){return _0x577011(msgResponse('[abandonmentRate]',_0xec60('0x7d'),_0xec60('0x21a')+_0x39059a));}if(_0x1dcb75<=0x0||isNaN(_0x1dcb75)){return _0x577011(msgResponse('[abandonmentRate]',_0xec60('0x7d'),'interval\x20=\x20'+_0x1dcb75));}if(_0x24d6ad<=0x0||isNaN(_0x24d6ad)){return _0x577011(msgResponse(_0xec60('0x217'),_0xec60('0x7d'),'Amax\x20=\x20'+_0x24d6ad));}_0x4bebf3=_0x4bebf3||0x0;var _0x3e51cf=0x1/_0x21f553;var _0x4a0cd3=0x0;var _0x27852e=0x0;var _0x543326=0x0;var _0x19f358=0x0;for(var _0x4d7435=0x0;_0x543326<_0x24d6ad;_0x4d7435+=0x1){_0x27852e=_0x4d7435/_0x1dcb75;_0x4a0cd3=(_0x39059a*_0x27852e+_0x4bebf3)/_0x3e51cf;_0x543326=utils[_0xec60('0x21b')](_0x4a0cd3,_0xf89898);_0x19f358=_0x4a0cd3/_0xf89898*(0x1-utils['erlangb'](_0x4a0cd3,_0xf89898));}return _0x2c3fd6({'erlangCalls':_0x4d7435,'erlangCallToSecond':_0x1dcb75/_0x4d7435,'erlangAbandonmentRate':_0x543326,'erlangBusyFactor':_0x19f358});});};Dialer[_0xec60('0x18')][_0xec60('0x1df')]=function(_0x1d974a,_0x381402,_0x331c59,_0x398e98,_0x793f77,_0x275fe0){loggerPredictive[_0xec60('0x46')](_0xec60('0x21c'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d974a);loggerPredictive['info'](_0xec60('0x213'),_0x381402);loggerPredictive['info'](_0xec60('0x214'),_0x331c59);loggerPredictive['info'](_0xec60('0x215'),_0x398e98);loggerPredictive[_0xec60('0x46')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x793f77);loggerPredictive[_0xec60('0x46')]('---------------------------');return new Promise(function(_0x4e8bc9,_0x3e32ad){if(_0x1d974a<=0x0||isNaN(_0x1d974a)){return _0x3e32ad(msgResponse(_0xec60('0x21d'),_0xec60('0x7d'),_0xec60('0x218')+_0x1d974a));}if(_0x331c59<=0x0||isNaN(_0x331c59)){return _0x3e32ad(msgResponse(_0xec60('0x21d'),_0xec60('0x7d'),'Ts\x20=\x20'+_0x331c59));}if(_0x398e98<=0x0||isNaN(_0x398e98)){return _0x3e32ad(msgResponse(_0xec60('0x21d'),_0xec60('0x7d'),'p\x20=\x20'+_0x398e98));}if(_0x381402<=0x0||isNaN(_0x381402)){return _0x3e32ad(msgResponse(_0xec60('0x21d'),'Error',_0xec60('0x21e')+_0x381402));}if(_0x793f77<=0x0||isNaN(_0x793f77)){return _0x3e32ad(msgResponse('[busyFactor]',_0xec60('0x7d'),'Umin\x20=\x20'+_0x793f77));}_0x275fe0=_0x275fe0||0x0;var _0x311f0b=0x1/_0x331c59;var _0x48f889=0x0;var _0x432d6b=0x0;var _0x191f16=0x0;var _0x4ad9e8=0x0;for(var _0x260d7c=0x0;_0x4ad9e8<_0x793f77;_0x260d7c+=0x1){_0x432d6b=_0x260d7c/_0x381402;_0x48f889=(_0x398e98*_0x432d6b+_0x275fe0)/_0x311f0b;_0x191f16=utils[_0xec60('0x21b')](_0x48f889,_0x1d974a);_0x4ad9e8=_0x48f889/_0x1d974a*(0x1-utils[_0xec60('0x21b')](_0x48f889,_0x1d974a));}return _0x4e8bc9({'erlangCalls':_0x260d7c,'erlangCallToSecond':_0x381402/_0x260d7c,'erlangAbandonmentRate':_0x191f16,'erlangBusyFactor':_0x4ad9e8});});};module[_0xec60('0x21f')]=Dialer; \ No newline at end of file +var _0x2554=['isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','active','status','SIP/%s','isTrunkReachable','TrunkBackup','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','isArray','length','push','content','indexOf','catch','command','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','countdropretry','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','add','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','rrmemory','roundrobin','isNil','locked','stateinterface','idHopper','strategy','run','_rr','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','xcally-motion-dialer','HANGUP','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','outboundAnswerAgiCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','value','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','resolve','statusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[actions]','Action','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','[originate][error]','checkRetriveMax','countbusyretry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','nosuchnumber','callAdditionalPhoneAfterMin','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','checkContactEmpty','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\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','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','Amax\x20=\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','syncNewExten','varset','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','format','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\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','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','inspect','checkContactLowerLimitOriginate','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x2554,0x19e));var _0x4255=function(_0x5b4cdf,_0x4045f7){_0x5b4cdf=_0x5b4cdf-0x0;var _0x318361=_0x2554[_0x5b4cdf];return _0x318361;};'use strict';var util=require('util');var _=require(_0x4255('0x0'));var uuid=require(_0x4255('0x1'));var moment=require(_0x4255('0x2'));var rr=require('rr');var Redis=require(_0x4255('0x3'));var utils=require(_0x4255('0x4'));var hopperUtils=require(_0x4255('0x5'));var ut=require(_0x4255('0x6'));var config=require(_0x4255('0x7'));var logger=require(_0x4255('0x8'))(_0x4255('0x9'));var loggerBooked=require(_0x4255('0x8'))(_0x4255('0xa'));var loggerPredictive=require(_0x4255('0x8'))(_0x4255('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4255('0xc'));var loggerSyncQueueSummary=require(_0x4255('0x8'))(_0x4255('0xd'));var ami=require(_0x4255('0xe'));config['redis']=_[_0x4255('0xf')](config[_0x4255('0x10')],{'host':_0x4255('0x11'),'port':0x18eb});var io=require(_0x4255('0x12'))(new Redis(config[_0x4255('0x10')]));var cmHopper=require(_0x4255('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x4255('0x14'));var Action=require(_0x4255('0x15'));var History=require(_0x4255('0x16'));var Final=require(_0x4255('0x17'));var AgentComplete=require(_0x4255('0x18'));var QueueCallerAbandon=require(_0x4255('0x19'));var Hangup=require(_0x4255('0x1a'));var ipAgi=process['env'][_0x4255('0x1b')]||_0x4255('0x1c');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x4255('0x1d')]=function(_0x2f81cf){this[_0x4255('0x1e')]=this[_0x4255('0x1e')]?this[_0x4255('0x1e')][_0x4255('0x1f')](_0x2f81cf):_0x2f81cf();};function Dialer(_0x20e265,_0xb1abb7){this[_0x4255('0x20')]=new Sequence();this[_0x4255('0x21')]=_0xb1abb7;this[_0x4255('0x22')]=_0x20e265[_0x4255('0x22')];this[_0x4255('0x23')]=_0x20e265[_0x4255('0x23')];this[_0x4255('0x24')]=_0x20e265[_0x4255('0x24')];this[_0x4255('0x25')]=_0x20e265[_0x4255('0x25')];this[_0x4255('0x26')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x4255('0x27')]={};this[_0x4255('0x28')]={};this['optionPredictive']={};this[_0x4255('0x29')]={};this[_0x4255('0x2a')]={};this[_0x4255('0x2b')]={};this[_0x4255('0x2c')]={};this[_0x4255('0x2d')]={};this[_0x4255('0x2e')]={};ami['on']('agentconnect',this[_0x4255('0x2f')][_0x4255('0x30')](this));ami['on'](_0x4255('0x31'),this[_0x4255('0x32')][_0x4255('0x30')](this));ami['on'](_0x4255('0x33'),this[_0x4255('0x34')][_0x4255('0x30')](this));ami['on'](_0x4255('0x35'),this[_0x4255('0x36')][_0x4255('0x30')](this));ami['on']('custom:queuesummary',this[_0x4255('0xd')][_0x4255('0x30')](this));ami['on'](_0x4255('0x37'),this['syncQueueSummaryComplete'][_0x4255('0x30')](this));ami['on'](_0x4255('0x38'),this['syncHangup'][_0x4255('0x30')](this));ami['on']('newexten',this[_0x4255('0x39')]['bind'](this));ami['on'](_0x4255('0x3a'),this['syncVarSet'][_0x4255('0x30')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on']('queuestatuscomplete',this[_0x4255('0x3b')]['bind'](this));this[_0x4255('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x4255('0x3d')]()[_0x4255('0x3e')](function(_0x24ea9a){previewRecallmeReminderInterval=_0x24ea9a[_0x4255('0x3f')];});}function isNotNull(_0x17ac41){return _0x17ac41!==null&&!_[_0x4255('0x40')](_0x17ac41);}function msgResponse(_0x5e7c92,_0x53ce78,_0x20e2e5){return{'action':_0x5e7c92,'response':_0x53ce78,'message':_0x20e2e5,'stack':_0x20e2e5};}function emit(_0x28ef82,_0x38859a,_0x1b2151){io['to'](_0x28ef82)[_0x4255('0x41')](_0x38859a,_0x1b2151);}function emitOutboundVoiceQueueSummary(_0x2a469e){if(_0x2a469e[_0x4255('0x42')]===_0x4255('0x43')){logger[_0x4255('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x2a469e,{'showHidden':![],'depth':null}));emit(util[_0x4255('0x45')]('voice:queue:%s',_0x2a469e[_0x4255('0x46')]),_0x4255('0x47'),_0x2a469e);}}function checkGetDataPredictive(_0x1685ab){if(isNotNull(_0x1685ab)&&!_[_0x4255('0x48')](_0x1685ab)){loggerPredictive['info'](_0x4255('0x49'));loggerPredictive[_0x4255('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1685ab[_0x4255('0x4b')]);loggerPredictive['info'](_0x4255('0x4c'),_0x1685ab['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x4255('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1685ab['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x4255('0x4a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1685ab[_0x4255('0x4d')]);loggerPredictive[_0x4255('0x4a')](_0x4255('0x4e'),_0x1685ab[_0x4255('0x4f')]);loggerPredictive[_0x4255('0x4a')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1685ab[_0x4255('0x50')]);loggerPredictive[_0x4255('0x4a')](_0x4255('0x51'));if(_0x1685ab[_0x4255('0x4b')]>0x0){if(!_[_0x4255('0x40')](_0x1685ab[_0x4255('0x50')])&&_0x1685ab[_0x4255('0x50')]>0x0){return!![];}loggerPredictive[_0x4255('0x4a')](_0x4255('0x52'));if(!_['isUndefined'](_0x1685ab[_0x4255('0x4f')])&&_0x1685ab[_0x4255('0x4f')]>0x0){return!![];}loggerPredictive['info'](_0x4255('0x53'));}else{loggerPredictive[_0x4255('0x4a')](_0x4255('0x54'));}}else{loggerPredictive[_0x4255('0x4a')](_0x4255('0x55'));}return![];}function mergeDataErlangB(_0x3bd485){return function(_0x59e574){loggerPredictive[_0x4255('0x4a')](_0x4255('0x56'));loggerPredictive[_0x4255('0x4a')](_0x4255('0x57'),_0x59e574[_0x4255('0x58')]);loggerPredictive['info'](_0x4255('0x59'),_0x59e574[_0x4255('0x5a')]);loggerPredictive[_0x4255('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59e574[_0x4255('0x5b')]);loggerPredictive[_0x4255('0x4a')](_0x4255('0x5c'),_0x59e574['erlangBusyFactor']);loggerPredictive['info'](_0x4255('0x5d'),_0x59e574['erlangAbandonmentRate']);loggerPredictive[_0x4255('0x4a')](_0x4255('0x51'));_[_0x4255('0x5e')](_0x3bd485,_0x59e574);};}function ifInterval(_0x37dde6,_0x544df4){if(_['isUndefined'](_0x544df4)){return![];}return utils[_0x4255('0x5f')](undefined,_0x544df4)<_0x37dde6*0x3c;}function clearPredictiveAttributes(_0x22670d){if(_0x22670d[_0x4255('0x2a')]){_0x22670d['startProgressive']=undefined;loggerPredictive[_0x4255('0x44')](_0x22670d[_0x4255('0x46')],'startProgressive\x20value\x20cleared');}if(_0x22670d[_0x4255('0x29')]){_0x22670d[_0x4255('0x29')]=undefined;loggerPredictive[_0x4255('0x44')](_0x22670d[_0x4255('0x46')],_0x4255('0x60'));}if(_0x22670d['handlePredictive']){clearInterval(_0x22670d['handlePredictive']);_0x22670d[_0x4255('0x61')]=undefined;loggerPredictive[_0x4255('0x44')](_0x22670d['name'],_0x4255('0x62'));}}function loggerCatchPredictive(_0x428434,_0x4e0702){return function(_0xf8e8ab){loggerPredictive['error'](_0x4e0702[_0x4255('0x46')],_0x428434);loggerPredictive['error'](_0xf8e8ab[_0x4255('0x63')]);clearPredictiveAttributes(_0x4e0702);};}function loggerCatch(_0x5f1183){return function(_0x520acc){logger[_0x4255('0x64')](_0x5f1183,util[_0x4255('0x65')](_0x520acc,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x35be84,_0x281c4d,_0x45f0a9){return function(_0x2b2f76){utils[_0x4255('0x66')](_0x281c4d,_0x45f0a9,0x0);logger[_0x4255('0x64')](_0x35be84,util['inspect'](_0x2b2f76,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x330968){return function(_0xeac81b){if(isNotNull(_0xeac81b)&&isNotNull(_0xeac81b[0x0])){if(_0xeac81b[0x0][_0x4255('0x67')]>0x0){_0x330968['message']=utils['CAMPAIGN_STATUS'][_0x4255('0x68')];logger[_0x4255('0x4a')](_0x4255('0x69')+_0x330968[_0x4255('0x46')],_0xeac81b[0x0][_0x4255('0x67')],_0x4255('0x6a'));}else{_0x330968[_0x4255('0x6b')]=utils[_0x4255('0x6c')][_0x4255('0x6d')];logger[_0x4255('0x4a')](_0x4255('0x6e')+_0x330968['name']);}}};}function createObjHistory(_0x5be7a5,_0x284be6,_0x110001,_0x18fe44,_0xff441){_0x5be7a5[_0x4255('0x6b')]=_0x110001;var _0x3b4e4f=new Action(_0x5be7a5,_0x284be6);var _0x5e6775=new History(_0x3b4e4f);_0x5e6775[_0x4255('0x6f')]=_0x18fe44;_0x5e6775['statedesc']=_0xff441;_0x5e6775[_0x4255('0x70')]=_0x3b4e4f[_0x4255('0x71')];return _0x5e6775;}function unlockQueueStatus(_0x19530e,_0x59d5fb){setTimeout(function(){if(_[_0x4255('0x40')](_0x19530e[_0x4255('0x72')])){loggerBooked['error'](_0x4255('0x73'),_0x59d5fb);}_0x19530e[_0x4255('0x72')]=!![];loggerBooked[_0x4255('0x4a')](_0x4255('0x74'),_0x59d5fb,JSON[_0x4255('0x75')](_[_0x4255('0x76')](_0x19530e,[_0x4255('0x46'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x2d0638){return function(){if(!isNotNull(_0x2d0638[_0x4255('0x77')])){_0x2d0638[_0x4255('0x6b')]=utils[_0x4255('0x6c')][_0x4255('0x78')];throw _0x2d0638['name']+_0x4255('0x79');}if(!isNotNull(_0x2d0638[_0x4255('0x77')][_0x4255('0x7a')])){_0x2d0638[_0x4255('0x6b')]=utils[_0x4255('0x6c')]['NULL_INTERVAL'];throw _0x2d0638[_0x4255('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4255('0x48')](_0x2d0638[_0x4255('0x77')][_0x4255('0x7a')]))){_0x2d0638['message']=utils[_0x4255('0x6c')][_0x4255('0x78')];throw _0x2d0638[_0x4255('0x46')]+_0x4255('0x79');}};}function checkIsIVRCampaignActive(_0x157e28){return function(){if(!utils[_0x4255('0x7b')](_0x157e28)){_0x157e28['message']=utils[_0x4255('0x6c')][_0x4255('0x7c')];throw _0x157e28[_0x4255('0x46')]+_0x4255('0x7d');}};}function emitCampaignSummary(_0x460e66){if(utils[_0x4255('0x7e')](_0x460e66)){emit(util['format'](_0x4255('0x7f'),_0x460e66[_0x4255('0x46')]),'campaign:save',_0x460e66);}}function loggerCatchQueueSummary(_0xbc3a8f,_0x3febe6){return function(_0x44ff1a){clearPredictiveAttributes(_0x3febe6);emitCampaignSummary(_0x3febe6);loggerSyncQueueSummary[_0x4255('0x44')](_0xbc3a8f,util['inspect'](_0x44ff1a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5a3403){if(_0x5a3403[_0x4255('0x80')]){if(_0x5a3403[_0x4255('0x81')]===0x0){_0x5a3403[_0x4255('0x80')]=![];_0x5a3403[_0x4255('0x6b')]=utils[_0x4255('0x6c')][_0x4255('0x7c')];loggerSyncQueueSummary[_0x4255('0x44')](_0x4255('0x82'),_0x5a3403[_0x4255('0x46')],_0x4255('0x83'));}else{_0x5a3403[_0x4255('0x6b')]=utils['CAMPAIGN_STATUS'][_0x4255('0x84')];loggerSyncQueueSummary[_0x4255('0x44')](_0x4255('0x82'),_0x5a3403[_0x4255('0x46')],_0x4255('0x85'));}emitCampaignSummary(_0x5a3403);}}function myreject(_0xfd0b40){return function(_0x27b116){return _0xfd0b40(msgResponse(_0x4255('0x86'),_0x4255('0x87'),JSON['stringify'](_0x27b116)));};}Dialer[_0x4255('0x88')]['isTrunkReachable']=function(_0x3acac2){return!_[_0x4255('0x40')](_0x3acac2)&&_0x3acac2&&!_['isUndefined'](_0x3acac2[_0x4255('0x46')])&&!_['isUndefined'](_0x3acac2[_0x4255('0x89')])&&_0x3acac2['active']&&(this['trunks'][util[_0x4255('0x45')]('SIP/%s',_0x3acac2[_0x4255('0x46')])][_0x4255('0x8a')]==='reachable'||this[_0x4255('0x25')][util[_0x4255('0x45')](_0x4255('0x8b'),_0x3acac2['name'])][_0x4255('0x8a')]==='unmonitored');};Dialer[_0x4255('0x88')]['checkIsTrunkReachable']=function(_0x482da0){var _0x2aeb85=this;return function(){if(!_0x2aeb85[_0x4255('0x8c')](_0x482da0['Trunk'])){if(!_0x2aeb85[_0x4255('0x8c')](_0x482da0[_0x4255('0x8d')])){_0x482da0['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x482da0[_0x4255('0x46')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x4255('0x8e')]=function(_0x3bae74,_0x48b355,_0x393445,_0xc3ecc5){var _0x59cd48=this;return function(){var _0x7c1ded=!![];return _0x59cd48[_0x4255('0x8f')](_0x3bae74,_0x48b355,_0x393445,_0xc3ecc5,_0x7c1ded);};};Dialer[_0x4255('0x88')][_0x4255('0x90')]=function(_0x5ae769,_0x15bc12,_0x257a17,_0xabfd75){var _0x23b017=this;return function(){var _0x308948=![];return _0x23b017[_0x4255('0x8f')](_0x5ae769[_0x4255('0x7a')],_0x15bc12,_0x257a17,_0xabfd75,_0x308948);};};Dialer[_0x4255('0x88')][_0x4255('0x8f')]=function(_0x4b05b3,_0x2b9d65,_0x140081,_0x1015de,_0x21ad70){var _0x1d2625=[];return new Promise(function(_0x1eaab1,_0x1b395e){if(!isNotNull(_0x4b05b3)){_0x1015de[_0x4255('0x6b')]=utils[_0x4255('0x6c')][_0x4255('0x78')];return _0x1b395e(msgResponse('ifTime','Failure',_0x140081+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x4255('0x48')](_0x4b05b3)){_0x1015de[_0x4255('0x6b')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x1b395e(msgResponse('ifTime',_0x4255('0x91'),_0x140081+_0x4255('0x92')));}if(_0x2b9d65&&_[_0x4255('0x40')](config[_0x4255('0x93')][_0x2b9d65])){_0x1015de[_0x4255('0x6b')]=utils[_0x4255('0x6c')][_0x4255('0x94')];return _0x1b395e(msgResponse(_0x4255('0x95'),_0x4255('0x91'),_0x140081+_0x4255('0x96')+_0x2b9d65));}if(_[_0x4255('0x97')](_0x4b05b3)){for(var _0x39c285=0x0;_0x39c285<_0x4b05b3[_0x4255('0x98')];_0x39c285+=0x1){_0x1d2625[_0x4255('0x99')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x4b05b3[_0x39c285]['interval'],!_[_0x4255('0x40')](config[_0x4255('0x93')][_0x2b9d65])?_0x2b9d65:'')})['then'](function(_0x1c1549){return _0x1c1549[_0x4255('0x9a')][_0x4255('0x9b')]('true')>=0x0;})[_0x4255('0x9c')](myreject(_0x1b395e)));}}else{_0x1d2625['push'](ami['Action']({'action':_0x4255('0x9d'),'command':util[_0x4255('0x45')](_0x4255('0x9e'),_0x4b05b3,!_['isUndefined'](config[_0x4255('0x93')][_0x2b9d65])?_0x2b9d65:'')})[_0x4255('0x3e')](function(_0x1bb4b3){return _0x1bb4b3['content'][_0x4255('0x9b')]('true')>=0x0;})[_0x4255('0x9c')](myreject(_0x1b395e)));}Promise[_0x4255('0x9f')](_0x1d2625)[_0x4255('0x3e')](function(_0x32511b){var _0x4bae35=_[_0x4255('0xa0')](_0x32511b);if(_0x4bae35){return _0x1eaab1(_0x4bae35);}else{_0x1015de[_0x4255('0x6b')]=_0x21ad70?utils[_0x4255('0x6c')][_0x4255('0xa1')]:utils[_0x4255('0x6c')]['OVERTIME_INTERVAL'];return _0x1b395e(msgResponse(_0x4255('0xa2'),_0x4255('0x91'),_0x4255('0xa3')+_0x21ad70+'\x20'+_0x140081+_0x4255('0xa4')+util[_0x4255('0x65')](_0x4b05b3,{'showHidden':![],'depth':null})+_0x4255('0xa5')+_0x2b9d65));}})[_0x4255('0x9c')](function(_0x10c539){return _0x1b395e(msgResponse('ifTime',_0x4255('0x91'),JSON['stringify'](_0x10c539)));});});};Dialer[_0x4255('0x88')][_0x4255('0x3c')]=function(){var _0x155b8d=this;return cmHopper[_0x4255('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x4255('0x3e')](function(){setInterval(function(){_0x155b8d[_0x4255('0xa7')]();},0x3e8);});};Dialer['prototype'][_0x4255('0xa7')]=function(){var _0x480a04=this;var _0x22ddf2;for(var _0x6ac24f in this[_0x4255('0x23')]){if(typeof this[_0x4255('0x23')][_0x6ac24f]!==_0x4255('0xa8')){_0x22ddf2=this[_0x4255('0x23')][_0x6ac24f];if(utils[_0x4255('0x7e')](_0x22ddf2)&&utils[_0x4255('0x7b')](_0x22ddf2)){_0x22ddf2[_0x4255('0x80')]=!![];Promise['resolve']()[_0x4255('0x3e')](checkIsIVRCampaignActive(_0x22ddf2))['then'](checkInterval(_0x22ddf2))[_0x4255('0x3e')](_0x480a04[_0x4255('0xa9')](_0x22ddf2))['then'](_0x480a04[_0x4255('0x8e')](_0x22ddf2[_0x4255('0xaa')],_0x22ddf2[_0x4255('0xab')],_0x22ddf2['name'],_0x22ddf2))['then'](_0x480a04[_0x4255('0x90')](_0x22ddf2['Interval'],_0x22ddf2['dialTimezone'],_0x22ddf2[_0x4255('0x46')],_0x22ddf2))[_0x4255('0x3e')](_0x480a04['launchHandleIvr'](_0x22ddf2))[_0x4255('0x9c')](loggerCatchQueueSummary(_0x4255('0xac'),_0x22ddf2));}else{notSendMessagesCampaign(_0x22ddf2);}}}};Dialer[_0x4255('0x88')]['checkDialMethod']=function(_0x110a8e){if(_0x110a8e[_0x4255('0xad')]!=='predictive'){clearPredictiveAttributes(_0x110a8e);}switch(_0x110a8e['dialMethod']){case _0x4255('0xae'):this[_0x4255('0xaf')](_0x110a8e,0x1);break;case _0x4255('0xb0'):this[_0x4255('0xaf')](_0x110a8e,_0x110a8e[_0x4255('0xb1')]);break;case _0x4255('0xb'):this['predictive'](_0x110a8e);break;case _0x4255('0xa'):this[_0x4255('0xaf')](_0x110a8e,0x1);break;default:logger[_0x4255('0x64')](_0x4255('0xb2'),_0x110a8e[_0x4255('0x46')],_0x4255('0xb3'));}};Dialer[_0x4255('0x88')][_0x4255('0x95')]=function(_0x16e43a,_0x6721f0){var _0x33942d=_0x16e43a[_0x4255('0xab')];var _0x1dcd48=_0x6721f0?_0x16e43a['dialGlobalInterval']:_0x16e43a['Interval'][_0x4255('0x7a')];logger[_0x4255('0xb4')](_0x4255('0xb5'),_0x1dcd48,_0x33942d,_0x16e43a[_0x4255('0x46')],util[_0x4255('0x45')](_0x4255('0xb6'),_0x16e43a['name'],_0x16e43a['id']));var _0x113b26=null;return Interval['intervalIftime'](_0x1dcd48,_0x33942d)['then'](function(_0xb3660a){if(_0xb3660a===!![]){return _0xb3660a;}else{_0x16e43a[_0x4255('0x6b')]=_0x6721f0?utils[_0x4255('0x6c')][_0x4255('0xa1')]:utils[_0x4255('0x6c')]['OVERTIME_INTERVAL'];_0x113b26=msgResponse('[ifTime][promiseAll]',_0x4255('0x91'),'Global:\x20'+_0x6721f0+'\x20'+_0x16e43a[_0x4255('0x46')]+_0x4255('0xa4')+util[_0x4255('0x65')](_0x1dcd48,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x33942d);}if(_0x113b26!==null){logger[_0x4255('0xb4')](_0x4255('0xb7'),_0x113b26);_0x113b26[_0x4255('0xb8')]=_0x6721f0;throw _0x113b26;}})[_0x4255('0x9c')](function(_0x49f15e){logger[_0x4255('0x64')](_0x4255('0xb9'),_0x49f15e);throw msgResponse('[ifTime][Action]',_0x4255('0x87'),util['inspect'](_0x49f15e,{'showHidden':![],'depth':null}));});};Dialer[_0x4255('0x88')][_0x4255('0x2f')]=function(_0x13269c){if(this[_0x4255('0x22')][_0x13269c[_0x4255('0xba')]]){if(this[_0x4255('0x28')][_0x13269c['uniqueid']]&&this[_0x4255('0x28')][_0x13269c[_0x4255('0xbb')]][_0x4255('0x42')]!==_0x4255('0xbc')){this[_0x4255('0xbd')](this['voiceQueues'][_0x13269c['queue']]);this[_0x4255('0x28')][_0x13269c['uniqueid']][_0x4255('0xbe')]=moment()[_0x4255('0x45')](_0x4255('0xbf'));}}};Dialer[_0x4255('0x88')]['syncAgentComplete']=function(_0x4839bb){var _0x23f872=this[_0x4255('0x28')][_0x4839bb['uniqueid']];if(this['voiceQueues'][_0x4839bb[_0x4255('0xba')]]){if(_0x23f872&&_0x23f872[_0x4255('0x42')]!==_0x4255('0xbc')){delete this[_0x4255('0x28')][_0x4839bb[_0x4255('0xbb')]];this[_0x4255('0x22')][_0x4839bb[_0x4255('0xba')]][_0x4255('0xc0')]+=0x1;var _0x1cfbe8=new AgentComplete(_0x23f872,_0x4839bb);if(_0x4839bb['reason']==='agent'){_0x1cfbe8[_0x4255('0xc1')]=this[_0x4255('0x22')][_0x4839bb[_0x4255('0xba')]][_0x4255('0xc2')]&&this[_0x4255('0x22')][_0x4839bb[_0x4255('0xba')]][_0x4255('0xc3')]?moment()[_0x4255('0x45')](_0x4255('0xbf')):undefined;}hopperUtils[_0x4255('0xc4')](_0x1cfbe8)[_0x4255('0x9c')](loggerCatch(_0x4255('0xc5')));hopperUtils[_0x4255('0xc6')](_0x1cfbe8)[_0x4255('0x9c')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4255('0x88')][_0x4255('0x32')]=function(_0x448ef8){var _0x3446a5=this[_0x4255('0x28')][_0x448ef8[_0x4255('0xbb')]];var _0x52b882=this;var _0x15721e=![];var _0x407957;var _0x5340b6;if(this[_0x4255('0x22')][_0x448ef8[_0x4255('0xba')]]){if(_0x3446a5&&_0x3446a5[_0x4255('0x42')]!==_0x4255('0xbc')){delete this[_0x4255('0x28')][_0x448ef8[_0x4255('0xbb')]];this[_0x4255('0xbd')](this['voiceQueues'][_0x448ef8[_0x4255('0xba')]]);_0x3446a5[_0x4255('0xc7')]=moment()[_0x4255('0x45')](_0x4255('0xbf'));var _0x3cdb4a=new QueueCallerAbandon(_0x3446a5,_0x448ef8);if(utils[_0x4255('0x5f')](_0x3446a5[_0x4255('0xc7')],_0x3446a5[_0x4255('0xc8')])>=_0x3446a5['dialQueueTimeout']){this[_0x4255('0x22')][_0x448ef8[_0x4255('0xba')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x4255('0x22')][_0x448ef8['queue']][_0x4255('0xc9')]+=0x1;this['voiceQueues'][_0x448ef8['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3cdb4a[_0x4255('0x6f')]=0xa;_0x3cdb4a[_0x4255('0xca')]=_0x4255('0xcb');_0x3cdb4a[_0x4255('0xcc')]=_0x4255('0xcd');_0x3cdb4a[_0x4255('0xc1')]=this['voiceQueues'][_0x448ef8[_0x4255('0xba')]][_0x4255('0xc2')]?moment()['format'](_0x4255('0xbf')):undefined;_0x3cdb4a['countdropretry']+=0x1;_0x3cdb4a[_0x4255('0xce')]+=0x1;_0x407957=this['voiceQueues'][_0x448ef8['queue']][_0x4255('0xcf')];_0x5340b6=this['voiceQueues'][_0x448ef8[_0x4255('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x4255('0xd0')](_0x3cdb4a,_0x3cdb4a[_0x4255('0x6f')],_0x3446a5[_0x4255('0xd1')])[_0x4255('0x3e')](function(_0x23cbfa){_0x15721e=_0x23cbfa[_0x4255('0xd2')]==0x1;if(_0x3cdb4a['countdropretry']>=_0x52b882['voiceQueues'][_0x448ef8['queue']]['dialDropMaxRetry']){_0x52b882[_0x4255('0xd3')](_0x3cdb4a,_0x23cbfa[_0x4255('0xd2')]);}else{hopperUtils[_0x4255('0xd4')]({'active':![],'countdropretry':_0x3cdb4a[_0x4255('0xd5')],'scheduledat':moment()['add'](_0x52b882[_0x4255('0x22')][_0x448ef8['queue']][_0x4255('0xcf')],_0x4255('0xd6'))[_0x4255('0x45')](_0x4255('0xbf')),'ContactId':_0x3446a5[_0x4255('0xd7')],'ListId':_0x3446a5['ListId'],'VoiceQueueId':_0x3446a5[_0x4255('0xd8')]||undefined,'CampaignId':_0x3446a5[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0xda')));var _0x303900=new History(_0x3cdb4a);_0x303900['state']=0xa;_0x303900[_0x4255('0xca')]='Drop';_0x303900['starttime']=moment()[_0x4255('0x45')](_0x4255('0xbf'));_0x303900[_0x4255('0x70')]=_0x303900[_0x4255('0x71')];_0x303900['calleridname']=_0x3cdb4a[_0x4255('0xdb')];_0x303900['calleridnum']=_0x3cdb4a[_0x4255('0xdc')];hopperUtils[_0x4255('0xc4')](_0x303900)[_0x4255('0x9c')](loggerCatch(_0x4255('0xdd')));}})[_0x4255('0x3e')](function(){if(_0x15721e)hopperUtils[_0x4255('0xde')](_0x3cdb4a,_0x407957,_0x5340b6)[_0x4255('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x448ef8[_0x4255('0xba')]][_0x4255('0x4d')]+=0x1;this['voiceQueues'][_0x448ef8['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x3cdb4a[_0x4255('0x6f')]=0xb;_0x3cdb4a[_0x4255('0xca')]=_0x4255('0xdf');_0x3cdb4a[_0x4255('0xcc')]=_0x4255('0xe0');_0x3cdb4a[_0x4255('0xe1')]+=0x1;_0x3cdb4a[_0x4255('0xce')]+=0x1;_0x407957=this['voiceQueues'][_0x448ef8[_0x4255('0xba')]]['dialAbandonedRetryFrequency'];_0x5340b6=this[_0x4255('0x22')][_0x448ef8[_0x4255('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x4255('0xd0')](_0x3cdb4a,_0x3cdb4a[_0x4255('0x6f')],_0x3446a5[_0x4255('0xd1')])['then'](function(_0x365fe2){if(_0x3cdb4a['countabandonedretry']>=_0x52b882[_0x4255('0x22')][_0x448ef8['queue']][_0x4255('0xe2')]){_0x52b882[_0x4255('0xd3')](_0x3cdb4a,_0x365fe2[_0x4255('0xd2')]);}else{hopperUtils[_0x4255('0xd4')]({'active':![],'countabandonedretry':_0x3cdb4a[_0x4255('0xe1')],'scheduledat':moment()[_0x4255('0xe3')](_0x52b882['voiceQueues'][_0x448ef8[_0x4255('0xba')]]['dialAbandonedRetryFrequency'],'minutes')['format'](_0x4255('0xbf')),'ContactId':_0x3446a5[_0x4255('0xd7')],'ListId':_0x3446a5[_0x4255('0xe4')],'VoiceQueueId':_0x3446a5[_0x4255('0xd8')]||undefined,'CampaignId':_0x3446a5[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0xe5')));var _0x15f3a3=new History(_0x3cdb4a);_0x15f3a3[_0x4255('0x6f')]=0xb;_0x15f3a3[_0x4255('0xca')]='Abandoned';_0x15f3a3['starttime']=moment()['format'](_0x4255('0xbf'));_0x15f3a3[_0x4255('0x70')]=_0x15f3a3[_0x4255('0x71')];_0x15f3a3[_0x4255('0xdb')]=_0x3cdb4a[_0x4255('0xdb')];_0x15f3a3[_0x4255('0xdc')]=_0x3cdb4a[_0x4255('0xdc')];hopperUtils[_0x4255('0xc4')](_0x15f3a3)[_0x4255('0x9c')](loggerCatch(_0x4255('0xe6')));}})[_0x4255('0x3e')](function(){if(_0x15721e)hopperUtils[_0x4255('0xde')](_0x3cdb4a,_0x407957,_0x5340b6)['then'](function(){return 0x1;});});}}}};Dialer[_0x4255('0x88')][_0x4255('0x39')]=function(_0x4470b6){if(this[_0x4255('0xe7')][_0x4470b6[_0x4255('0xbb')]]){this[_0x4255('0xe7')][_0x4470b6['uniqueid']][_0x4255('0xe8')]=_0x4470b6[_0x4255('0xe8')];}if(this['uniqueId'][_0x4470b6[_0x4255('0xbb')]]){this['uniqueId'][_0x4470b6[_0x4255('0xbb')]][_0x4255('0xe8')]=_0x4470b6['channel'];}};Dialer['prototype'][_0x4255('0xe9')]=function(_0xda0911){if(!this['actions'][_0xda0911[_0x4255('0xea')]]){return;}var _0x44fc6e=this[_0x4255('0x22')][this['actions'][_0xda0911[_0x4255('0xea')]]['queue']]['strategy']||_0x4255('0xeb');if(_0x44fc6e===_0x4255('0xec')){if(this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]]&&_[_0x4255('0xed')](this[_0x4255('0xe7')][_0xda0911['actionid']][_0x4255('0xee')])&&_0xda0911[_0x4255('0x8a')]==='1'&&_0xda0911['paused']==='0'){if(this['agents'][_0xda0911[_0x4255('0xef')]]){if(!this[_0x4255('0x24')][_0xda0911[_0x4255('0xef')]][_0x4255('0xee')]){this[_0x4255('0x24')][_0xda0911[_0x4255('0xef')]][_0x4255('0xee')]=!![];this[_0x4255('0xe7')][_0xda0911['actionid']][_0x4255('0xee')]=!![];this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]]['stateinterface']=_0xda0911[_0x4255('0xef')];}}}}else if(_0x44fc6e===_0x4255('0xeb')){if(this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]]){if(this[_0x4255('0x24')][_0xda0911[_0x4255('0xef')]]){this[_0x4255('0xe7')][_0xda0911['actionid']][_0x4255('0xef')]=_0xda0911[_0x4255('0xef')];if(_[_0x4255('0xed')](this['queueBooked'][this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]][_0x4255('0xba')]])){this['queueBooked'][this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]][_0x4255('0xba')]]=[];}this[_0x4255('0x2c')][this['actions'][_0xda0911[_0x4255('0xea')]][_0x4255('0xba')]][_0x4255('0x99')](_[_0x4255('0x5e')](_[_0x4255('0x76')](this[_0x4255('0xe7')][_0xda0911[_0x4255('0xea')]],[_0x4255('0xf0'),_0x4255('0xef')]),{'status':_0xda0911[_0x4255('0x8a')],'paused':_0xda0911['paused']}));}}}};Dialer[_0x4255('0x88')][_0x4255('0x3b')]=function(_0x16e35f){if(!this[_0x4255('0xe7')][_0x16e35f['actionid']]){return;}var _0x4bcf09=this;var _0x308e03=this[_0x4255('0x22')][this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]];var _0x42d16e=_0x308e03[_0x4255('0xf1')]||_0x4255('0xeb');if(_0x42d16e==='roundrobin'){if(this['actions'][_0x16e35f['actionid']]&&this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xef')]){this[_0x4255('0x21')][_0x4255('0xf2')](this[_0x4255('0xe7')][_0x16e35f['actionid']][_0x4255('0xf0')],this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]]['stateinterface'])[_0x4255('0x9c')](function(_0x2e4e46){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x4255('0x65')](_0x2e4e46,{'showHidden':![],'depth':null}));})[_0x4255('0x1f')](function(){_0x4bcf09['updateOriginated'](_0x4bcf09['voiceQueues'][_0x4bcf09[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]]);_0x4bcf09['agents'][_0x4bcf09[_0x4255('0xe7')][_0x16e35f['actionid']]['stateinterface']]['locked']=![];delete _0x4bcf09[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]];unlockQueueStatus(_0x308e03);});}else{this[_0x4255('0xbd')](this[_0x4255('0x22')][this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x16e35f['actionid']][_0x4255('0xd7')],'ListId':this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]]['ListId'],'VoiceQueueId':this['actions'][_0x16e35f[_0x4255('0xea')]][_0x4255('0xd8')]||undefined,'CampaignId':this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x4255('0xe7')][_0x16e35f['actionid']];unlockQueueStatus(_0x308e03);}}else if(_0x42d16e===_0x4255('0xeb')){var _0x18a934;if(this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]]&&!_[_0x4255('0x48')](this[_0x4255('0x2c')][this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]])){if(this[_0x4255('0x2d')][_0x4bcf09[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]]){this['queueBookedRR'][_0x4bcf09[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]]=this[_0x4255('0x2d')][this['actions'][_0x16e35f['actionid']]['queue']]?this[_0x4255('0x2d')][this['actions'][_0x16e35f[_0x4255('0xea')]]['queue']]:this[_0x4255('0x2c')][this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]]?this[_0x4255('0x2c')][this[_0x4255('0xe7')][_0x16e35f[_0x4255('0xea')]]['queue']][_0x4255('0xf3')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x16e35f['actionid']][_0x4255('0xba')]][_0x4255('0xf3')]=this['queueBookedRR'][this['actions'][_0x16e35f[_0x4255('0xea')]][_0x4255('0xba')]];for(var _0x3305c9=0x0;_0x3305c9=_0x3d699a[_0x4255('0x115')]){_0x1f2542[_0x4255('0x116')](_0x22ca00,_0x22d281,_0x26e0e5,'reason19\x20machine....');}else{if(_0x22ca00['countmachineretry']>=_0x3d699a[_0x4255('0x117')]){_0x1f2542[_0x4255('0x118')](_0x22ca00,_0x22d281,_0x26e0e5,'reason\x2019\x20machine....');}else{hopperUtils[_0x4255('0xd4')]({'active':![],'countmachineretry':_0x22ca00['countmachineretry'],'scheduledat':moment()[_0x4255('0xe3')](_0x3d699a['dialMachineRetryFrequency'],_0x4255('0xd6'))[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22ca00[_0x4255('0xd7')],'ListId':_0x22ca00[_0x4255('0xe4')],'VoiceQueueId':_0x22ca00[_0x4255('0xd8')]||undefined,'CampaignId':_0x22ca00['CampaignId']||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x119')));_0x22d281({'reschedule':0x1});}}});}if(_0xa477bc[_0x4255('0x42')]===_0x4255('0xbc')&&this[_0x4255('0x23')][_0xa477bc[_0x4255('0xba')]]['dialAMDActive']&&_0x4f1a33[_0x4255('0x11a')]==='HANGUP'){delete this[_0x4255('0x28')][_0x4f1a33[_0x4255('0xbb')]];this[_0x4255('0xbd')](this['campaigns'][_0xa477bc[_0x4255('0xba')]]);_0x51d012=new Hangup(_0xa477bc,_0x4f1a33);_0x51d012[_0x4255('0x6f')]=0x12;_0x51d012['statedesc']=_0x4255('0x11b');_0x51d012[_0x4255('0x105')]=_0x4255('0x106');ami[_0x4255('0x41')](_0x4255('0x107'),ut[_0x4255('0x108')](_0x51d012,'amd'));this['saveInDb'](_0x51d012,_0x4255('0x11c'),_0x4255('0x11d'));}if(_0xa477bc[_0x4255('0x42')]===_0x4255('0xbc')&&this['campaigns'][_0xa477bc[_0x4255('0xba')]]['dialAMDActive']&&_0x4f1a33[_0x4255('0x11a')]==='MACHINE'){return new Promise(function(_0x467183,_0xe91d3d){delete _0x1f2542[_0x4255('0x28')][_0x4f1a33[_0x4255('0xbb')]];_0x1f2542['updateOriginated'](_0x1f2542[_0x4255('0x23')][_0xa477bc['queue']]);_0x1f2542[_0x4255('0x23')][_0xa477bc['queue']][_0x4255('0xc0')]+=0x1;_0x1f2542['campaigns'][_0xa477bc[_0x4255('0xba')]][_0x4255('0x10d')]+=0x1;var _0x5512a1=_0x1f2542['campaigns'][_0xa477bc['queue']];var _0x7b90a2=new Hangup(_0xa477bc,_0x4f1a33);_0x7b90a2['state']=0x13;_0x7b90a2['statedesc']=_0x4255('0x10e');_0x7b90a2['membername']=_0x4255('0x106');_0x7b90a2[_0x4255('0x10f')]+=0x1;_0x7b90a2['countglobal']+=0x1;_0x7b90a2['amd']=!![];ami[_0x4255('0x41')](_0x4255('0x107'),ut[_0x4255('0x108')](_0x7b90a2,_0x4255('0x109')));hopperUtils[_0x4255('0xc4')](_0x7b90a2)[_0x4255('0x9c')](loggerCatch(_0x4255('0x110')));if(_0x7b90a2['countbusyretry']+_0x7b90a2['countcongestionretry']+_0x7b90a2[_0x4255('0x112')]+_0x7b90a2[_0x4255('0x113')]+_0x7b90a2[_0x4255('0xd5')]+_0x7b90a2[_0x4255('0xe1')]+_0x7b90a2[_0x4255('0x10f')]+_0x7b90a2[_0x4255('0x114')]>=_0x5512a1['dialGlobalMaxRetry']){_0x1f2542[_0x4255('0x116')](_0x7b90a2,_0x467183,_0xe91d3d,_0x4255('0x11e'));}else{if(_0x7b90a2['countmachineretry']>=_0x5512a1['dialMachineMaxRetry']){_0x1f2542[_0x4255('0x118')](_0x7b90a2,_0x467183,_0xe91d3d,_0x4255('0x11f'));}else{hopperUtils[_0x4255('0xd4')]({'active':![],'countmachineretry':_0x7b90a2[_0x4255('0x10f')],'scheduledat':moment()[_0x4255('0xe3')](_0x5512a1[_0x4255('0x120')],_0x4255('0xd6'))[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x7b90a2['ContactId'],'ListId':_0x7b90a2[_0x4255('0xe4')],'VoiceQueueId':_0x7b90a2[_0x4255('0xd8')]||undefined,'CampaignId':_0x7b90a2[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x119')));_0x467183({'reschedule':0x1});}}});}}};Dialer[_0x4255('0x88')][_0x4255('0x121')]=function(_0x46aac7){var _0x565637=this['uniqueId'][_0x46aac7[_0x4255('0xbb')]];var _0xf495ae;if(_0x565637&&_0x565637[_0x4255('0x42')]===_0x4255('0xbc')){delete this[_0x4255('0x28')][_0x46aac7['uniqueid']];this['updateOriginated'](this[_0x4255('0x23')][_0x565637[_0x4255('0xba')]]);this[_0x4255('0x23')][_0x565637[_0x4255('0xba')]][_0x4255('0x122')]+=0x1;_0xf495ae=new Hangup(_0x565637,_0x46aac7);hopperUtils['createHistory'](_0xf495ae)['catch'](loggerCatch(_0x4255('0x123')));hopperUtils[_0x4255('0xc6')](_0xf495ae)[_0x4255('0x9c')](loggerCatch(_0x4255('0x124')));}if(_0x565637&&_0x565637[_0x4255('0x42')]!==_0x4255('0xbc')&&isNotNull(this[_0x4255('0x22')][_0x565637[_0x4255('0xba')]][_0x4255('0x125')])){delete this['uniqueId'][_0x46aac7[_0x4255('0xbb')]];this[_0x4255('0xbd')](this[_0x4255('0x22')][_0x565637[_0x4255('0xba')]]);this[_0x4255('0x22')][_0x565637[_0x4255('0xba')]][_0x4255('0xc0')]+=0x1;this[_0x4255('0x22')][_0x565637[_0x4255('0xba')]][_0x4255('0x10d')]+=0x1;_0xf495ae=new Hangup(_0x565637,_0x46aac7);_0xf495ae['state']=0x10;_0xf495ae[_0x4255('0xca')]=_0x4255('0x126');_0xf495ae[_0x4255('0x105')]='AGI';hopperUtils[_0x4255('0xc4')](_0xf495ae)[_0x4255('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x4255('0xc6')](_0xf495ae)[_0x4255('0x9c')](loggerCatch(_0x4255('0x124')));}if(_0x565637&&_0x565637[_0x4255('0x42')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x565637['queue']][_0x4255('0x125')])){delete this[_0x4255('0x28')][_0x46aac7[_0x4255('0xbb')]];this[_0x4255('0xbd')](this[_0x4255('0x22')][_0x565637[_0x4255('0xba')]]);this['voiceQueues'][_0x565637[_0x4255('0xba')]]['outboundUnknownCallsDay']+=0x1;_0xf495ae=new Hangup(_0x565637,_0x46aac7);_0xf495ae[_0x4255('0x6f')]=0xc;_0xf495ae[_0x4255('0xca')]=_0x46aac7[_0x4255('0x127')];_0xf495ae[_0x4255('0x105')]=_0x4255('0x128');hopperUtils[_0x4255('0xc4')](_0xf495ae)[_0x4255('0x9c')](loggerCatch(_0x4255('0x123')));hopperUtils[_0x4255('0xc6')](_0xf495ae)[_0x4255('0x9c')](loggerCatch(_0x4255('0x124')));}};Dialer[_0x4255('0x88')]['syncQueueSummary']=function(_0x33e4e6){var _0x3116fa=this;if(!_0x3116fa[_0x4255('0x2e')][_0x33e4e6[_0x4255('0x46')]]){_0x3116fa[_0x4255('0x2e')][_0x33e4e6[_0x4255('0x46')]]={'running':![]};}else if(_0x3116fa[_0x4255('0x2e')][_0x33e4e6['name']][_0x4255('0x129')]===!![]){return;}else if(_0x3116fa[_0x4255('0x2e')][_0x33e4e6[_0x4255('0x46')]][_0x4255('0x129')]===![]){_0x3116fa[_0x4255('0x2e')][_0x33e4e6[_0x4255('0x46')]][_0x4255('0x129')]=!![];}var _0x212eb3=_0x3116fa[_0x4255('0x22')][_0x33e4e6[_0x4255('0x46')]];var _0x15d4b4=_0x212eb3[_0x4255('0x6b')]!==utils[_0x4255('0x6c')][_0x4255('0x7c')];var _0x1ff787=utils[_0x4255('0x12a')](_0x212eb3);_0x212eb3['statusMessage']=utils[_0x4255('0x12b')](_0x212eb3,_0x3116fa['trunks']);Promise[_0x4255('0x12c')]()[_0x4255('0x3e')](function(){if(_0x212eb3[_0x4255('0x12d')]===utils[_0x4255('0x6c')]['INACTIVE']){if(_0x15d4b4){clearPredictiveAttributes(_0x212eb3);_0x33e4e6['startPredictive']=undefined;_0x33e4e6['startProgressive']=undefined;}if(_0x212eb3[_0x4255('0x12d')]===utils[_0x4255('0x6c')]['INACTIVE']){_0x33e4e6[_0x4255('0x12e')]=0x0;_0x33e4e6[_0x4255('0xf4')]=0x0;_0x33e4e6[_0x4255('0x12f')]=0x0;_0x33e4e6['talking']=0x0;_0x33e4e6['pTalking']=0x0;}}else if(_0x212eb3[_0x4255('0x12d')]===utils[_0x4255('0x6c')][_0x4255('0x130')]&&!_0x1ff787){return _0x3116fa[_0x4255('0x95')](_0x212eb3,!![])[_0x4255('0x3e')](function(){return _0x3116fa[_0x4255('0x95')](_0x212eb3,![]);})[_0x4255('0x3e')](function(){return _0x3116fa['checkDialMethod'](_0x212eb3);})[_0x4255('0x9c')](function(_0x7714a0){loggerSyncQueueSummary['debug'](_0x4255('0x131'),util[_0x4255('0x65')](_0x7714a0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x212eb3);});}else{clearPredictiveAttributes(_0x212eb3);}})['then'](function(){var _0x33430c=_0x33e4e6[_0x4255('0x132')](_0x212eb3);if(_0x33430c||_0x212eb3[_0x4255('0x133')]){_0x212eb3[_0x4255('0x133')]=![];_0x33e4e6[_0x4255('0x134')](_0x212eb3);Object[_0x4255('0x135')](_0x212eb3,_0x33e4e6);emitOutboundVoiceQueueSummary(_0x33e4e6);}_0x3116fa[_0x4255('0x2e')][_0x212eb3['name']]['running']=![];})['catch'](function(_0x31e5b8){logger[_0x4255('0x64')](_0x4255('0x131'),util[_0x4255('0x65')](_0x31e5b8,{'showHidden':![],'depth':null}));_0x3116fa[_0x4255('0x2e')][_0x212eb3[_0x4255('0x46')]]['running']=![];});};Dialer['prototype'][_0x4255('0x136')]=_[_0x4255('0x137')](function(){var _0x5d68fb=_[_0x4255('0x138')](this[_0x4255('0x22')],function(_0x4ae256){return _0x4ae256[_0x4255('0x139')];});var _0x411c4a=_[_0x4255('0x138')](this[_0x4255('0x24')],function(_0x19d79c){return _0x19d79c['online']&&_0x19d79c[_0x4255('0x8a')]===_0x4255('0x13a');});if(_0x5d68fb['length']>0x0&&_0x411c4a[_0x4255('0x98')]>0x0){return Promise[_0x4255('0x12c')]()['then'](cmHopper[_0x4255('0x13b')](_['map'](_0x5d68fb,'id'),previewRecallmeReminderInterval,_[_0x4255('0x13c')](_0x411c4a,'id')))[_0x4255('0x3e')](function(_0x4e893f){for(var _0x84cb6b=0x0;_0x84cb6b<_0x4e893f['length'];_0x84cb6b++){var _0x49c0a6=_0x4e893f[_0x84cb6b][_0x4255('0x13d')][_0x4255('0x46')];if(_0x49c0a6)io['to'](util[_0x4255('0x45')](_0x4255('0x13e'),_0x49c0a6))[_0x4255('0x41')]('user:dialPreviewRecallReminder',{'hopper':_0x4e893f[_0x84cb6b]});}})[_0x4255('0x9c')](function(_0x14255a){logger[_0x4255('0x64')](_0x4255('0x13f'),_0x14255a);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4255('0x88')]['loopClearZombieChannels']=function(){var _0x94a0e0=this;setInterval(function(){_0x94a0e0[_0x4255('0x140')](_0x94a0e0['uniqueId'],'[uniqueid]');_0x94a0e0[_0x4255('0x140')](_0x94a0e0[_0x4255('0xe7')],_0x4255('0x141'));},0x32c8);};Dialer[_0x4255('0x88')][_0x4255('0x140')]=function(_0x514af3,_0x4678ef){var _0x8b6f2c=this;for(var _0xd1e1e in _0x514af3){if(typeof _0x514af3[_0xd1e1e]!=='undefined'){this[_0x4255('0x20')]['enqueue'](function(){if(!_[_0x4255('0xed')](_0x514af3[_0xd1e1e])){return ami[_0x4255('0x142')]({'action':_0x4255('0x8a'),'channel':_0x514af3[_0xd1e1e]['channel']})[_0x4255('0x9c')](function(_0x54c954){if(_0x54c954[_0x4255('0x6b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x514af3[_0xd1e1e]&&_0x514af3[_0xd1e1e][_0x4255('0x42')]!==_0x4255('0xbc')){_0x8b6f2c['updateOriginated'](_0x8b6f2c[_0x4255('0x22')][_0x514af3[_0xd1e1e][_0x4255('0xba')]]);logger[_0x4255('0x64')](_0x4255('0x143'),_0x4678ef,_0xd1e1e,_0x514af3[_0xd1e1e]['queue']);delete _0x514af3[_0xd1e1e];}if(_0x514af3[_0xd1e1e]&&_0x514af3[_0xd1e1e][_0x4255('0x42')]===_0x4255('0xbc')){_0x8b6f2c[_0x4255('0xbd')](_0x8b6f2c[_0x4255('0x23')][_0x514af3[_0xd1e1e][_0x4255('0xba')]]);logger[_0x4255('0x64')](_0x4255('0x144'),_0x4678ef,_0xd1e1e,_0x514af3[_0xd1e1e][_0x4255('0xba')]);delete _0x514af3[_0xd1e1e];}},0x2328);}});}});}}};Dialer[_0x4255('0x88')]['getVoiceQueueRtPauses']=function(_0x426d20){return Promise[_0x4255('0x12c')]()[_0x4255('0x3e')](voiceQueueRt[_0x4255('0x145')](_0x426d20))[_0x4255('0x9c')](loggerCatch(_0x4255('0x146')));};Dialer['prototype'][_0x4255('0xbd')]=function(_0x2f658e){if(!_[_0x4255('0x40')](_0x2f658e)&&_0x2f658e!==null){if(typeof _0x2f658e[_0x4255('0x81')]!==_0x4255('0xa8')){if(_0x2f658e[_0x4255('0x81')]>0x0){_0x2f658e[_0x4255('0x81')]-=0x1;}else{logger[_0x4255('0x64')](_0x4255('0x147'));}}}else{logger[_0x4255('0x64')](_0x4255('0x148'));}};Dialer['prototype']['loggerHandler']=function(_0x2882a7,_0x184988){var _0xfdf5a0=this;return function(_0xa1e354){_0xfdf5a0[_0x4255('0xbd')](_0x184988);logger[_0x4255('0x64')](_0x2882a7,util[_0x4255('0x65')](_0xa1e354,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x5c7f3c,_0x40c8a2,_0x40bd82){var _0xac634d={'state':0x19,'statedesc':_0x4255('0x149')};this[_0x4255('0xbd')](_0x40c8a2);this['saveInDb'](_['merge'](_0xac634d,_[_0x4255('0x76')](_0x40bd82,['ContactId',_0x4255('0xe4'),'UserId',_0x4255('0xd8'),_0x4255('0xd9')])),_0x4255('0x14a'),'[emptyContact]');logger[_0x4255('0x64')](_0x5c7f3c);};Dialer['prototype']['saveInDb']=function(_0x118cd1,_0x134ed5,_0x2ca7ce){hopperUtils[_0x4255('0xc4')](_0x118cd1)[_0x4255('0x9c')](loggerCatch(_0x134ed5));hopperUtils[_0x4255('0xc6')](_0x118cd1)[_0x4255('0x9c')](loggerCatch(_0x2ca7ce));};Dialer[_0x4255('0x88')][_0x4255('0xd3')]=function(_0x4f411c,_0x929838){hopperUtils[_0x4255('0xc4')](_0x4f411c)[_0x4255('0x9c')](loggerCatch(_0x4255('0xc5')));if(_0x929838==0x0){hopperUtils[_0x4255('0xc6')](_0x4f411c)[_0x4255('0x9c')](loggerCatch(_0x4255('0x14b')));}};Dialer[_0x4255('0x88')][_0x4255('0x13f')]=function(_0x767d2e){return Promise['resolve']()[_0x4255('0x3e')](cmHopper[_0x4255('0x13b')](_0x767d2e['id'],previewRecallmeReminderInterval))[_0x4255('0x3e')](function(_0x3980e5){for(var _0x42f9e3=0x0;_0x42f9e3<_0x3980e5[_0x4255('0x98')];_0x42f9e3++){var _0x13fdd6=_0x3980e5[_0x42f9e3]['Agent'][_0x4255('0x46')];if(_0x13fdd6)io['to'](util[_0x4255('0x45')](_0x4255('0x13e'),_0x13fdd6))[_0x4255('0x41')](_0x4255('0x14c'),{'hopper':_0x3980e5[_0x42f9e3]});}})[_0x4255('0x9c')](function(){});};Dialer[_0x4255('0x88')][_0x4255('0x14d')]=function(_0x2c6bdd){var _0xb4ebc9=this;return function(){_0xb4ebc9[_0x4255('0x14e')](_0x2c6bdd);};};Dialer[_0x4255('0x88')][_0x4255('0x14f')]=function(_0x1b65b7,_0x198ac7){var _0x258e03=this;var _0x2b4d71=uuid['v4']();this[_0x4255('0xe7')][_0x2b4d71]=new Action(_0x1b65b7,_0x198ac7,_0x2b4d71);return new Promise(function(_0x59444f,_0x4eb69c){if(_[_0x4255('0x40')](_0x1b65b7)&&typeof _0x1b65b7!==_0x4255('0x150')){return _0x4eb69c(msgResponse(_0x4255('0x151'),'Failure',_0x4255('0x152')));}if(_[_0x4255('0x40')](_0x198ac7[_0x4255('0x153')])||_0x198ac7['phone']===null){return _0x4eb69c(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x9f5a10={'XMD-CALLERID':_0x258e03[_0x4255('0xe7')][_0x2b4d71][_0x4255('0x154')](),'XMD-AGI':_0x1b65b7[_0x4255('0x125')]?util['format'](_0x4255('0x155'),ipAgi,_0x1b65b7[_0x4255('0x125')]):_0x4255('0x156'),'XMD-AGIAFTER':_0x1b65b7['dialQueueProject2']?util[_0x4255('0x45')](_0x4255('0x155'),ipAgi,_0x1b65b7[_0x4255('0xc2')]):_0x4255('0x156'),'XMD-QUEUE':utils[_0x4255('0x157')](_0x1b65b7)?util['format'](_0x4255('0x158'),_0x1b65b7['name'],_0x1b65b7[_0x4255('0x159')]||'',_0x1b65b7[_0x4255('0xc3')]?'c':'',_0x1b65b7['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x198ac7[_0x4255('0xd7')],'XMD-CDRTYPE':_0x4255('0x9'),'CALLERID(all)':_0x258e03[_0x4255('0xe7')][_0x2b4d71]['getCaller'](),'XMD-AMD':_0x1b65b7[_0x4255('0x10c')]?'ACTIVE':_0x4255('0x156'),'XMD-DESTINATION':_0x4255('0x103')};if(_0x1b65b7[_0x4255('0x10c')]){_0x9f5a10['XMD-AMDINITIALSILENCE']=_0x1b65b7[_0x4255('0x15a')]||0x9c4;_0x9f5a10['XMD-AMDGREETING']=_0x1b65b7[_0x4255('0x15b')]||0x5dc;_0x9f5a10[_0x4255('0x15c')]=_0x1b65b7[_0x4255('0x15d')]||0x320;_0x9f5a10[_0x4255('0x15e')]=_0x1b65b7[_0x4255('0x15f')]||0x1388;_0x9f5a10[_0x4255('0x160')]=_0x1b65b7[_0x4255('0x161')]||0x64;_0x9f5a10[_0x4255('0x162')]=_0x1b65b7['dialAMDBetweenWordsSilence']||0x32;_0x9f5a10[_0x4255('0x163')]=_0x1b65b7[_0x4255('0x164')]||0x3;_0x9f5a10[_0x4255('0x165')]=_0x1b65b7[_0x4255('0x166')]||0x100;_0x9f5a10[_0x4255('0x167')]=_0x1b65b7['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x4255('0x157')](_0x1b65b7)){_0x9f5a10[_0x4255('0x168')]=_0x198ac7[_0x4255('0xd8')];}else{_0x9f5a10[_0x4255('0x169')]=_0x198ac7[_0x4255('0xd9')];}var _0x335ed3=utils[_0x4255('0x16a')](_0x198ac7[_0x4255('0x16b')]);Object[_0x4255('0x135')](_0x9f5a10,_0x335ed3);var _0x548159=_0x258e03[_0x4255('0x8c')](_0x1b65b7[_0x4255('0x16c')])?utils['getCallerId'](_0x1b65b7[_0x4255('0x16c')]['callerid'],_0x1b65b7[_0x4255('0x16d')],_0x1b65b7[_0x4255('0x16e')]>0x0?utils[_0x4255('0x16f')](_0x1b65b7['dialOriginateCallerIdNumber'],_0x1b65b7[_0x4255('0x16e')]):_0x1b65b7[_0x4255('0x170')]):utils[_0x4255('0x171')](_[_0x4255('0xed')](_0x1b65b7['TrunkBackup'])?_0x1b65b7[_0x4255('0x16c')][_0x4255('0x172')]:_0x1b65b7['TrunkBackup'][_0x4255('0x172')],_0x1b65b7[_0x4255('0x16d')],_0x1b65b7[_0x4255('0x16e')]>0x0?utils[_0x4255('0x16f')](_0x1b65b7[_0x4255('0x170')],_0x1b65b7['dialRandomLastDigitCallerIdNumber']):_0x1b65b7[_0x4255('0x170')]);if(_0x548159){_0x9f5a10['XMD-ORIGINATECALLERIDNAME']=_0x258e03[_0x4255('0xe7')][_0x2b4d71][_0x4255('0x173')]=utils[_0x4255('0x174')](_0x548159);_0x9f5a10[_0x4255('0x175')]=_0x198ac7[_0x4255('0x153')];}_0x1b65b7[_0x4255('0x176')]=_0x9f5a10;return ami[_0x4255('0x142')]({'actionid':_0x2b4d71,'action':'originate','channel':_0x258e03[_0x4255('0x8c')](_0x1b65b7[_0x4255('0x16c')])?util[_0x4255('0x45')]('SIP/%s/%s%s',_0x1b65b7[_0x4255('0x16c')]['name'],isNotNull(_0x1b65b7[_0x4255('0x177')])?_0x1b65b7['dialPrefix'][_0x4255('0x178')]()||'':'',_0x1b65b7[_0x4255('0x179')]>0x0?_0x198ac7[_0x4255('0x153')][_0x4255('0x17a')](_0x1b65b7[_0x4255('0x179')]):_0x198ac7[_0x4255('0x153')]):util[_0x4255('0x45')](_0x4255('0x17b'),_[_0x4255('0xed')](_0x1b65b7[_0x4255('0x8d')])?_0x1b65b7['Trunk'][_0x4255('0x46')]:_0x1b65b7['TrunkBackup']['name'],isNotNull(_0x1b65b7[_0x4255('0x177')])?_0x1b65b7[_0x4255('0x177')]['trim']()||'':'',_0x1b65b7[_0x4255('0x179')]>0x0?_0x198ac7[_0x4255('0x153')][_0x4255('0x17a')](_0x1b65b7[_0x4255('0x179')]):_0x198ac7[_0x4255('0x153')]),'callerid':_0x548159,'Exten':_0x4255('0x103'),'Context':_0x4255('0x17c'),'Priority':'1','variable':_0x9f5a10,'timeout':(_0x1b65b7[_0x4255('0x17d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2b4d71})[_0x4255('0x3e')](function(_0x208bf8){return _0x59444f(_0x208bf8);})['catch'](function(_0x3fe7e3){_0x1b65b7['outboundOriginateFailureCallsDay']+=0x1;var _0x53560e=new History(_0x258e03[_0x4255('0xe7')][_0x2b4d71]);logger['error'](util['format'](_0x4255('0x17e'),JSON[_0x4255('0x75')](_0x3fe7e3)));_0x53560e['state']=0xe;_0x53560e['statedesc']='OriginateError';_0x53560e[_0x4255('0x71')]=moment()[_0x4255('0x45')](_0x4255('0xbf'));_0x53560e[_0x4255('0x70')]=_0x53560e[_0x4255('0x71')];hopperUtils['createHistory'](_0x53560e)[_0x4255('0x9c')](loggerCatch(_0x4255('0x17f')));_0x258e03[_0x4255('0xc6')](_0x53560e)[_0x4255('0x9c')](loggerCatch(_0x4255('0x17f')))['finally'](function(){delete _0x258e03[_0x4255('0xe7')][_0x2b4d71];return _0x4eb69c(msgResponse(_0x4255('0x151'),_0x4255('0x87'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x4255('0x180')]=function(_0x1b8590,_0x48022b,_0x3cfd7c){var _0x243126=new History(_0x48022b);if(_0x243126[_0x4255('0x181')]+_0x243126[_0x4255('0x111')]+_0x243126[_0x4255('0x112')]+_0x243126[_0x4255('0x113')]+_0x243126[_0x4255('0xd5')]+_0x243126['countabandonedretry']+_0x243126['countmachineretry']+_0x243126[_0x4255('0x114')]>=_0x3cfd7c['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1b8590){case 0x3:if(_0x243126[_0x4255('0x112')]>=_0x3cfd7c['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countnoanswerretry':_0x243126[_0x4255('0x112')]+=0x1,'scheduledat':moment()['add'](_0x3cfd7c['dialNoAnswerRetryFrequency'],_0x4255('0xd6'))[_0x4255('0x45')](_0x4255('0xbf')),'ContactId':_0x243126[_0x4255('0xd7')],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x182')));break;case 0x5:if(_0x243126['countbusyretry']>=_0x3cfd7c['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countbusyretry':_0x243126[_0x4255('0x181')]+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c[_0x4255('0x183')],_0x4255('0xd6'))[_0x4255('0x45')](_0x4255('0xbf')),'ContactId':_0x243126[_0x4255('0xd7')],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126['VoiceQueueId']||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x184')));break;case 0x8:if(_0x243126[_0x4255('0x111')]>=_0x3cfd7c[_0x4255('0x185')]-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countcongestionretry':_0x243126['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c['dialCongestionRetryFrequency'],_0x4255('0xd6'))[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x243126['ContactId'],'ListId':_0x243126['ListId'],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x186')));break;case 0x0:if(_0x243126['countnosuchnumberretry']>=_0x3cfd7c['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x243126['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x3cfd7c[_0x4255('0x187')],'minutes')['format'](_0x4255('0xbf')),'ContactId':_0x243126[_0x4255('0xd7')],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})['catch'](loggerCatch(_0x4255('0x188')));}break;case 0xa:if(_0x243126['countdropretry']>=_0x3cfd7c[_0x4255('0x189')]-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countdropretry':_0x243126['countdropretry']+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c['dialDropRetryFrequency'],_0x4255('0xd6'))[_0x4255('0x45')](_0x4255('0xbf')),'ContactId':_0x243126[_0x4255('0xd7')],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0xda')));break;case 0xb:if(_0x243126[_0x4255('0xe1')]>=_0x3cfd7c['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countabandonedretry':_0x243126[_0x4255('0xe1')]+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c[_0x4255('0x18a')],_0x4255('0xd6'))[_0x4255('0x45')](_0x4255('0xbf')),'ContactId':_0x243126['ContactId'],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x243126['countmachineretry']>=_0x3cfd7c['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countmachineretry':_0x243126[_0x4255('0x10f')]+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c['dialMachineRetryFrequency'],'minutes')[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x243126[_0x4255('0xd7')],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126[_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x119')));break;case 0x14:if(_0x243126['countagentrejectretry']>=_0x3cfd7c[_0x4255('0x18b')]-0x1){return!![];}hopperUtils[_0x4255('0xd4')]({'active':![],'countagentrejectretry':_0x243126['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x4255('0xe3')](_0x3cfd7c[_0x4255('0x18c')],_0x4255('0xd6'))[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x243126['ContactId'],'ListId':_0x243126[_0x4255('0xe4')],'VoiceQueueId':_0x243126[_0x4255('0xd8')]||undefined,'CampaignId':_0x243126['CampaignId']||undefined})[_0x4255('0x9c')](loggerCatch(_0x4255('0x18d')));break;default:return!![];}};Dialer['prototype'][_0x4255('0xfe')]=function(_0x57f4a1,_0x5bc0cb,_0xbc928b){var _0x312e50=this;var _0x23892f=new History(_0x57f4a1);var _0x44e0e7=![];var _0x5e3d6f;var _0xa33867;return new Promise(function(_0x49ad52,_0x3799a7){if(_['isUndefined'](_0x5bc0cb)&&typeof _0x5bc0cb!==_0x4255('0x150')){return _0x3799a7(msgResponse(_0x4255('0x18e'),_0x4255('0x91'),'entity\x20is\x20undefine'));}if(_[_0x4255('0x40')](_0xbc928b)&&typeof _0xbc928b!==_0x4255('0x150')){return _0x3799a7(msgResponse('[callProgressDetecting]',_0x4255('0x91'),_0x4255('0x18f')));}hopperUtils[_0x4255('0xd0')](_0x23892f,_0xbc928b[_0x4255('0x190')],_0x5bc0cb)['then'](function(_0x3c54fb){if(_0x3c54fb['additional']==0x1)_0x44e0e7=!![];switch(_0xbc928b[_0x4255('0x190')]){case'0':_0x5bc0cb[_0x4255('0x191')]+=0x1;_0x23892f[_0x4255('0x6f')]=0x0;_0x23892f[_0x4255('0xca')]='NoSuchNumber';_0x23892f['countnosuchnumberretry']+=0x1;_0x23892f[_0x4255('0xce')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x57f4a1,_0x4255('0x192')));_0x5e3d6f=_0x5bc0cb[_0x4255('0x187')];_0xa33867=_0x5bc0cb[_0x4255('0x193')];hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x312e50['checkRetriveMax'](0x0,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f['countnosuchnumberretry']>=_0x5bc0cb[_0x4255('0x194')]){_0x312e50['createStateFinal'](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x195'));}else{_0x312e50[_0x4255('0x116')](_0x23892f,_0x49ad52,_0x3799a7,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5bc0cb[_0x4255('0x196')]+=0x1;_0x23892f[_0x4255('0x6f')]=0x3;_0x23892f[_0x4255('0xca')]='NoAnswer';_0x23892f[_0x4255('0x112')]+=0x1;_0x23892f[_0x4255('0xce')]+=0x1;var _0x3152e2=ut[_0x4255('0x197')](_0x57f4a1,_0x5bc0cb);ami['emit'](_0x4255('0x198'),_0x3152e2);_0x5e3d6f=_0x5bc0cb[_0x4255('0x199')];_0xa33867=_0x5bc0cb[_0x4255('0x193')];hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch(_0x4255('0x19a')));if(_0x312e50[_0x4255('0x180')](0x3,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f['countnoanswerretry']>=_0x5bc0cb[_0x4255('0x19b')]){_0x312e50[_0x4255('0x118')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x19c'));}else{_0x312e50[_0x4255('0x116')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x19c'));}}break;case'5':_0x5bc0cb[_0x4255('0x19d')]+=0x1;_0x23892f[_0x4255('0x6f')]=0x5;_0x23892f[_0x4255('0xca')]=_0x4255('0x19e');_0x23892f[_0x4255('0x181')]+=0x1;_0x23892f['countglobal']+=0x1;ami['emit'](_0x4255('0x19f'),ut['buildObj'](_0x57f4a1,'busy'));_0x5e3d6f=_0x5bc0cb[_0x4255('0x183')];_0xa33867=_0x5bc0cb[_0x4255('0x193')];hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch(_0x4255('0x1a0')));if(_0x312e50['checkRetriveMax'](0x5,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f[_0x4255('0x181')]>=_0x5bc0cb[_0x4255('0x1a1')]){_0x312e50[_0x4255('0x118')](_0x23892f,_0x49ad52,_0x3799a7,'reason\x205\x20busy');}else{_0x312e50['stateGlobal'](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1a2'));}}break;case'8':_0x5bc0cb[_0x4255('0x1a3')]+=0x1;_0x23892f[_0x4255('0x6f')]=0x8;_0x23892f['statedesc']=_0x4255('0x1a4');_0x23892f[_0x4255('0x111')]+=0x1;_0x23892f[_0x4255('0xce')]+=0x1;_0x5e3d6f=_0x5bc0cb[_0x4255('0x1a5')];_0xa33867=_0x5bc0cb[_0x4255('0x193')];ami[_0x4255('0x41')](_0x4255('0x1a6'),ut[_0x4255('0x108')](_0x57f4a1,'congestion'));hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x312e50[_0x4255('0x180')](0x8,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f['countcongestionretry']>=_0x5bc0cb[_0x4255('0x185')]){_0x312e50[_0x4255('0x118')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1a7'));}else{_0x312e50[_0x4255('0x116')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1a7'));}}break;case'11':_0x5bc0cb[_0x4255('0x1a8')]+=0x1;_0x23892f[_0x4255('0x6f')]=0xb;_0x23892f[_0x4255('0xca')]=_0x4255('0xdf');_0x23892f[_0x4255('0xe1')]+=0x1;_0x23892f['countglobal']+=0x1;_0x5e3d6f=_0x5bc0cb[_0x4255('0x18a')];_0xa33867=_0x5bc0cb[_0x4255('0x193')];hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch(_0x4255('0xe6')));if(_0x312e50['checkRetriveMax'](0xb,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f[_0x4255('0xe1')]>=_0x5bc0cb['dialAbandonedMaxRetry']){_0x312e50[_0x4255('0x118')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1a9'));}else{_0x312e50['stateGlobal'](_0x23892f,_0x49ad52,_0x3799a7,'reason\x2011\x20abandoned');}}break;case'20':_0x5bc0cb[_0x4255('0x1aa')]+=0x1;_0x23892f[_0x4255('0x6f')]=0x14;_0x23892f['statedesc']=_0x4255('0x1ab');_0x23892f[_0x4255('0x114')]+=0x1;_0x23892f[_0x4255('0xce')]+=0x1;_0x5e3d6f=_0x5bc0cb['dialAgentRejectRetryFrequency'];_0xa33867=_0x5bc0cb['callAdditionalPhoneAfterMin'];ami[_0x4255('0x41')](_0x4255('0x1ac'),ut[_0x4255('0x108')](_0x57f4a1,_0x4255('0x1ad')));hopperUtils['createHistory'](_0x23892f)[_0x4255('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x312e50[_0x4255('0x180')](0x14,_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f[_0x4255('0x114')]>=_0x5bc0cb['dialAgentRejectMaxRetry']){_0x312e50[_0x4255('0x118')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1ae'));}else{_0x312e50[_0x4255('0x116')](_0x23892f,_0x49ad52,_0x3799a7,_0x4255('0x1ae'));}}break;default:_0x5bc0cb[_0x4255('0x1af')]+=0x1;_0x23892f[_0x4255('0x6f')]=0xc;_0x23892f[_0x4255('0xca')]=_0xbc928b[_0x4255('0x190')];_0x5e3d6f=_0x5bc0cb['dialAgentRejectRetryFrequency'];_0xa33867=_0x5bc0cb[_0x4255('0x193')];hopperUtils[_0x4255('0xc4')](_0x23892f)[_0x4255('0x9c')](loggerCatch(_0x4255('0x1b0')));if(_0x312e50[_0x4255('0x180')](_0xbc928b[_0x4255('0x190')],_0x57f4a1,_0x5bc0cb)&&!_0x44e0e7){if(_0x23892f[_0x4255('0x181')]+_0x23892f['countcongestionretry']+_0x23892f[_0x4255('0x112')]+_0x23892f['countnosuchnumberretry']+_0x23892f['countdropretry']+_0x23892f['countabandonedretry']+_0x23892f['countmachineretry']+_0x23892f['countagentrejectretry']>=_0x5bc0cb[_0x4255('0x115')]){_0x312e50[_0x4255('0x116')](_0x23892f,_0x49ad52,_0x3799a7,_0xbc928b['reason']);}else{_0x312e50['createStateFinal'](_0x23892f,_0x49ad52,_0x3799a7,_0xbc928b['reason']);}}}})[_0x4255('0x3e')](function(){if(_0x44e0e7){hopperUtils['swapAdditionalPhones'](_0x23892f,_0x5e3d6f,_0xa33867)['then'](function(){return _0x49ad52(0x1);});}});});};Dialer[_0x4255('0x88')][_0x4255('0x116')]=function(_0xe548b9,_0x303a54,_0x107389,_0x5105ec){var _0x5abaae=new Final(_0xe548b9);_0x5abaae['state']=0xf;_0x5abaae[_0x4255('0xca')]='Global';this[_0x4255('0x118')](_0x5abaae,_0x303a54,_0x107389,_0x5105ec);};Dialer['prototype'][_0x4255('0x118')]=function(_0x165cc6,_0x47a782,_0x574cb8,_0x482232){hopperUtils[_0x4255('0xc6')](_0x165cc6)[_0x4255('0x3e')](function(){return _0x47a782(msgResponse(_0x4255('0x18e'),'Success',_0x482232));})[_0x4255('0x9c')](function(){return _0x574cb8(msgResponse(_0x4255('0x1b1'),_0x4255('0x91'),_0x4255('0x1b2')));});};Dialer[_0x4255('0x88')]['predictive']=function(_0x3d9371){var _0x4edc7a=_0x3d9371[_0x4255('0x1b3')]/0x64;var _0x2d846f=_0x3d9371[_0x4255('0xc9')]/(_0x3d9371[_0x4255('0xc9')]+_0x3d9371['outboundAnswerCallsDay']);var _0x5cd00e=Math[_0x4255('0x1b4')](_0x3d9371[_0x4255('0x1b5')]*(_0x3d9371[_0x4255('0x1b6')]/0x64));var _0x4fa0c8=Math[_0x4255('0x1b4')](_0x3d9371[_0x4255('0x1b5')]*(_0x3d9371[_0x4255('0x1b7')]/0x64));var _0x32107f=_0x3d9371[_0x4255('0x12e')]+_0x3d9371['talking'];var _0x303013=Math['floor'](_0x3d9371['erlangCalls']*_0x3d9371[_0x4255('0x5b')]*_0x3d9371[_0x4255('0x1b8')]*_0x3d9371[_0x4255('0x1b9')]);if(_['isUndefined'](_0x3d9371[_0x4255('0x2a')])){if(!_[_0x4255('0x40')](_0x3d9371[_0x4255('0x29')])){_0x3d9371[_0x4255('0x29')]=undefined;loggerPredictive['error'](_0x4255('0x1ba'),_0x4255('0x1bb'));}if(!_[_0x4255('0x40')](_0x3d9371[_0x4255('0x61')])){loggerPredictive[_0x4255('0x64')](_0x4255('0x1ba'),_0x4255('0x1bc'));clearInterval(_0x3d9371['handlePredictive']);_0x3d9371[_0x4255('0x61')]=undefined;}_0x3d9371[_0x4255('0x2a')]=moment()[_0x4255('0x45')](_0x4255('0xbf'));loggerPredictive[_0x4255('0x4a')](_0x3d9371[_0x4255('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x3d9371[_0x4255('0x2a')]);this['handlePower'](_0x3d9371,0x1);}else if(ifInterval(_0x3d9371[_0x4255('0x1bd')],_0x3d9371[_0x4255('0x2a')])){this[_0x4255('0xaf')](_0x3d9371,0x1);loggerPredictiveCalls['info'](_0x4255('0x1be'),_0x3d9371[_0x4255('0x2a')],_0x3d9371[_0x4255('0x46')]);_0x3d9371[_0x4255('0x58')]=0x0;_0x3d9371[_0x4255('0x1bf')]=0x0;}else if(_0x4edc7a<_0x2d846f&&_0x3d9371[_0x4255('0x1c0')]===_0x4255('0x1c1')){clearPredictiveAttributes(_0x3d9371);loggerPredictive[_0x4255('0x4a')](_0x4255('0x1c2'),_0x4255('0x1c3'),_0x2d846f,_0x4255('0x2a'),_0x3d9371[_0x4255('0x46')]);}else if(_0x303013<_0x3d9371[_0x4255('0x1bf')]&&_0x3d9371[_0x4255('0x1c0')]===_0x4255('0x1c1')){clearPredictiveAttributes(_0x3d9371);loggerPredictive['info'](_0x4255('0x1c4'),_0x4255('0x1c5'),_0x303013,_0x4255('0x1c6'),_0x3d9371[_0x4255('0x1bf')],_0x4255('0x2a'),_0x3d9371[_0x4255('0x46')]);}else if(!ifInterval(_0x3d9371['dialPredictiveInterval'],_0x3d9371[_0x4255('0x2a')])&&_['isUndefined'](_0x3d9371['startPredictive'])&&!_[_0x4255('0x40')](_0x3d9371[_0x4255('0x2a')])){_0x3d9371['startPredictive']=moment()[_0x4255('0x45')](_0x4255('0xbf'));loggerPredictive[_0x4255('0x4a')](_0x3d9371[_0x4255('0x46')],_0x4255('0x1c7'),_0x3d9371[_0x4255('0x29')]);hopperUtils[_0x4255('0x1c8')](_0x3d9371[_0x4255('0x1bd')])[_0x4255('0x3e')](this['getDataPredictive'](_0x3d9371))[_0x4255('0x3e')](mergeDataErlangB(_0x3d9371))[_0x4255('0x3e')](this[_0x4255('0x1c9')](_0x3d9371))[_0x4255('0x9c')](loggerCatchPredictive(_0x4255('0x1ca'),_0x3d9371));}else if(!ifInterval(_0x3d9371[_0x4255('0x1bd')],_0x3d9371[_0x4255('0x29')])){_0x3d9371[_0x4255('0x1bf')]=0x0;_0x3d9371[_0x4255('0x29')]=moment()[_0x4255('0x45')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4255('0x4a')](_0x3d9371[_0x4255('0x46')],_0x4255('0x1cb'),_0x3d9371['startPredictive']);clearInterval(_0x3d9371[_0x4255('0x61')]);_0x3d9371[_0x4255('0x61')]=undefined;hopperUtils[_0x4255('0x1c8')](_0x3d9371[_0x4255('0x1bd')])[_0x4255('0x3e')](this[_0x4255('0x1cc')](_0x3d9371))[_0x4255('0x3e')](mergeDataErlangB(_0x3d9371))[_0x4255('0x3e')](this['startMethodPredictive'](_0x3d9371))[_0x4255('0x9c')](loggerCatchPredictive(_0x4255('0x1cd'),_0x3d9371));}else if(_0x3d9371[_0x4255('0x1b5')]&&_0x32107f<_0x3d9371[_0x4255('0x1b5')]-_0x4fa0c8){clearPredictiveAttributes(_0x3d9371);loggerPredictive[_0x4255('0x4a')](_0x3d9371[_0x4255('0x46')],_0x4255('0x1ce'),_0x32107f,_0x4255('0x1cf'),_0x3d9371[_0x4255('0x1b5')],'-',_0x4fa0c8,'=',_0x3d9371[_0x4255('0x1b5')]-_0x4fa0c8,')');}else if(_0x3d9371['predictiveIntervalAvailable']&&_0x32107f>_0x3d9371['predictiveIntervalAvailable']+_0x5cd00e){clearPredictiveAttributes(_0x3d9371);loggerPredictive[_0x4255('0x4a')](_0x3d9371['name'],_0x4255('0x1ce'),_0x32107f,_0x4255('0x1d0'),_0x3d9371[_0x4255('0x1b5')],'+',_0x5cd00e,'=',_0x3d9371[_0x4255('0x1b5')]+_0x5cd00e,')');}};Dialer[_0x4255('0x88')][_0x4255('0x1cc')]=function(_0x452f0e){var _0x2bfe5e=this;return function(_0x55108c){return new Promise(function(_0xa8a27a,_0x5c5ff4){_[_0x4255('0x5e')](_0x452f0e,_0x55108c[0x0]);if(checkGetDataPredictive(_0x55108c[0x0])){var _0x517caa=_0x452f0e[_0x4255('0x1b5')]=_0x452f0e[_0x4255('0x1d1')]+_0x452f0e[_0x4255('0x12e')];var _0x4f2fff=_0x452f0e[_0x4255('0x1bd')]*0x3c;var _0x2e5ce3=_0x55108c[0x0]['predictiveIntervalAvgTalktime']+_0x55108c[0x0][_0x4255('0x4f')];var _0x1e4d1b=(_0x55108c[0x0][_0x4255('0x1d2')]+_0x55108c[0x0][_0x4255('0x1d3')]+_0x55108c[0x0][_0x4255('0x4d')])/_0x55108c[0x0][_0x4255('0x4b')];_0x452f0e[_0x4255('0x1b8')]=_0x1e4d1b>0x0?_0x1e4d1b:0x1;switch(_0x452f0e['dialPredictiveOptimization']){case'dropRate':var _0x47797f=_0x452f0e['dialPredictiveOptimizationPercentage']/0x64;return _0x2bfe5e[_0x4255('0x1d4')](_0x517caa,_0x4f2fff,_0x2e5ce3,_0x1e4d1b,_0x47797f)['then'](function(_0x5d212b){return _0xa8a27a(_0x5d212b);});case _0x4255('0x1d5'):var _0x258046=_0x452f0e[_0x4255('0x1b3')]/0x64;return _0x2bfe5e['busyFactor'](_0x517caa,_0x4f2fff,_0x2e5ce3,_0x1e4d1b,_0x258046)[_0x4255('0x3e')](function(_0x21bc90){return _0xa8a27a(_0x21bc90);});default:return _0x5c5ff4(msgResponse(_0x4255('0x1d6'),_0x4255('0x91'),'Unknown\x20Predictive'));}}else{return _0x5c5ff4(msgResponse(_0x4255('0x1d6'),_0x4255('0x91'),_0x4255('0x1d7')));}});};};Dialer[_0x4255('0x88')][_0x4255('0x1d8')]=function(_0x346756){var _0x4f88e4=this;return function(_0x246948){return new Promise(function(_0x4ae8fa,_0x36edb4){_[_0x4255('0x5e')](_0x346756,_0x246948[0x0]);if(checkGetDataPredictive(_0x246948[0x0])){loggerPredictive[_0x4255('0x4a')](JSON['stringify'](_0x246948[0x0]));if(_0x346756[_0x4255('0x1c0')]===_0x4255('0x1c1')){return _0x4f88e4[_0x4255('0x145')](_0x346756['id'])[_0x4255('0x3e')](function(_0x8df54c){var _0x420ecd=_0x346756[_0x4255('0x1d9')]-_0x8df54c[0x0]['outboundQueuePauses'];var _0x22eb8d=_0x346756[_0x4255('0x1bd')]*0x3c;var _0x8b905=_0x246948[0x0][_0x4255('0x50')]+_0x246948[0x0]['predictiveIntervalAvgHoldtime'];var _0x5c6741=(_0x246948[0x0]['predictiveIntervalAnsweredCalls']+_0x246948[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x246948[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x246948[0x0]['predictiveIntervalTotalCalls'];var _0x51f4be=_0x346756[_0x4255('0x1b3')]/0x64;_0x346756[_0x4255('0x1da')]=_0x8df54c[0x0][_0x4255('0x1db')]||0x0;_0x346756[_0x4255('0x1b8')]=_0x5c6741>0x0?_0x5c6741:0x1;return _0x4f88e4['abandonmentRate'](_0x420ecd,_0x22eb8d,_0x8b905,_0x5c6741,_0x51f4be);})['then'](function(_0x1645e4){return _0x4ae8fa(_0x1645e4);})[_0x4255('0x9c')](function(_0x421d05){return _0x36edb4(msgResponse(_0x4255('0x1dc'),_0x4255('0x91'),JSON['stringify'](_0x421d05)));});}if(_0x346756[_0x4255('0x1c0')]===_0x4255('0x1d5')){return _0x4f88e4[_0x4255('0x145')](_0x346756['id'])['then'](function(_0x12a01f){var _0x5c1525=_0x346756[_0x4255('0x1d9')]-_0x12a01f[0x0][_0x4255('0x1db')];var _0xa77048=_0x346756[_0x4255('0x1bd')]*0x3c;var _0x4541ed=_0x246948[0x0][_0x4255('0x50')]+_0x246948[0x0][_0x4255('0x4f')];var _0x4afdb6=(_0x246948[0x0][_0x4255('0x1d2')]+_0x246948[0x0][_0x4255('0x1d3')]+_0x246948[0x0][_0x4255('0x4d')])/_0x246948[0x0][_0x4255('0x4b')];var _0x39c733=_0x346756[_0x4255('0x1b3')]/0x64;_0x346756[_0x4255('0x1da')]=_0x12a01f[0x0][_0x4255('0x1db')]||0x0;_0x346756[_0x4255('0x1b8')]=_0x4afdb6>0x0?_0x4afdb6:0x1;return _0x4f88e4[_0x4255('0x1dd')](_0x5c1525,_0xa77048,_0x4541ed,_0x4afdb6,_0x39c733);})[_0x4255('0x3e')](function(_0x14d250){return _0x4ae8fa(_0x14d250);})[_0x4255('0x9c')](function(_0x255169){return _0x36edb4(msgResponse(_0x4255('0x1dc'),_0x4255('0x91'),JSON['stringify'](_0x255169)));});}}else{return _0x36edb4(msgResponse(_0x4255('0x1d6'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x4255('0x1c9')]=function(_0xdcf349){var _0x16bd11=this;return function(){var _0x1d172f=0x0;var _0x3a2515=Math[_0x4255('0x1de')](_0xdcf349[_0x4255('0x5a')]*0x3e8);if(_0x3a2515>0x0){_0x3a2515=_0x3a2515<0x64?0x64:_0x3a2515;loggerPredictive['info'](_0xdcf349['name'],_0x4255('0x1df'),_0x3a2515,_0x4255('0x1e0'));_0xdcf349[_0x4255('0x61')]=setInterval(function(){_0x16bd11['handlePredictive'](_0xdcf349);loggerPredictiveCalls[_0x4255('0x4a')](_0x4255('0x1e1'),_0x1d172f+=0x1);},_0x3a2515);}else{loggerPredictive['info'](_0xdcf349[_0x4255('0x46')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4255('0x88')][_0x4255('0x1e2')]=function(_0x119e73,_0x4259cb){var _0x3543b1=this;return function(_0x12d69c){if(_['isEmpty'](_0x12d69c)){if(_['isNil'](_0x4259cb[_0x4255('0x1e3')])||!_0x4259cb[_0x4255('0x1e4')]){if(_0x119e73['dialMethod']===_0x4255('0xa')){_0x119e73[_0x4255('0x72')]=_[_0x4255('0x40')](_0x119e73['queueStatusComplete'])?!![]:_0x119e73[_0x4255('0x72')];var _0x41ac6b=uuid['v4']();_0x3543b1[_0x4255('0xe7')][_0x41ac6b]=new Action(_0x119e73,_0x4259cb,_0x41ac6b);loggerBooked['info'](_0x4255('0x1e5'),_0x41ac6b,'queueStatusComplete:\x20',JSON['stringify'](_0x119e73[_0x4255('0x72')]),'Queue:\x20',_0x119e73['name']);if(_0x119e73[_0x4255('0x72')]){_0x119e73[_0x4255('0x72')]=![];_0x3543b1['queueBooked'][_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xba')]]=[];ami['Action']({'actionid':_0x41ac6b,'action':_0x4255('0x1e6'),'queue':_0x119e73[_0x4255('0x46')]})['catch'](function(){_0x3543b1[_0x4255('0xbd')](_0x119e73);hopperUtils[_0x4255('0xd4')]({'active':![],'ContactId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xd7')],'ListId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xe4')],'VoiceQueueId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xd8')]||undefined,'CampaignId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3543b1[_0x4255('0xe7')][_0x41ac6b];});}else{loggerBooked[_0x4255('0x4a')](_0x4255('0x1e7'),JSON[_0x4255('0x75')](_0x119e73[_0x4255('0x72')]),_0x4255('0x1e8'),_0x119e73[_0x4255('0x46')]);_0x3543b1['updateOriginated'](_0x119e73);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b]['ContactId'],'ListId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xe4')],'VoiceQueueId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xd8')]||undefined,'CampaignId':_0x3543b1[_0x4255('0xe7')][_0x41ac6b][_0x4255('0xd9')]||undefined})[_0x4255('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3543b1[_0x4255('0xe7')][_0x41ac6b];}}else{return _0x3543b1[_0x4255('0x14f')](_0x119e73,_0x4259cb);}}else{if(utils[_0x4255('0x5f')](undefined,_0x4259cb[_0x4255('0x1e9')])<_0x119e73[_0x4255('0x1ea')]*0x3c){if(_0x4259cb['Agent']&&!_0x4259cb[_0x4255('0x13d')][_0x4255('0x1eb')]){_0x3543b1[_0x4255('0x21')][_0x4255('0xf2')](_0x4259cb['id'])['finally'](function(){_0x3543b1[_0x4255('0xbd')](_0x119e73);});}else{hopperUtils[_0x4255('0x1ec')]({'active':![]},_0x4259cb['id'],0x1)[_0x4255('0x1f')](function(){_0x3543b1[_0x4255('0xbd')](_0x119e73);});}}else{_0x119e73['outboundReCallsDay']+=0x1;_0x3543b1['updateOriginated'](_0x119e73);if(_0x119e73[_0x4255('0x1ed')]){hopperUtils[_0x4255('0xd4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4259cb[_0x4255('0xd7')],'ListId':_0x4259cb['ListId'],'VoiceQueueId':_0x4259cb['VoiceQueueId']||undefined,'CampaignId':_0x4259cb['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x4255('0xc4')](createObjHistory(_0x119e73,_0x4259cb,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x4255('0x1ee')));}else{_0x3543b1[_0x4255('0x10a')](createObjHistory(_0x119e73,_0x4259cb,utils[_0x4255('0x6c')][_0x4255('0x1ef')],0x16,'RecallFailedTimeout'),_0x4255('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x119e73['outboundBlacklistCallsDay']+=0x1;_0x3543b1[_0x4255('0x10a')](createObjHistory(_0x119e73,_0x4259cb,utils['CAMPAIGN_STATUS'][_0x4255('0x1f1')],0xd,'Blacklist'),_0x4255('0x1f2'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x4255('0x88')]['handleIvr']=function(_0x45e66c){var _0x5712d9=this;var _0x5e9606=_0x45e66c[_0x4255('0x1f3')]-_0x45e66c[_0x4255('0x81')];emitCampaignSummary(_0x45e66c);if(_0x5e9606>0x0&&_0x45e66c[_0x4255('0x1f4')]==0x0){if(_0x5e9606>this[_0x4255('0x26')]){_0x5e9606=this[_0x4255('0x26')];}_0x45e66c[_0x4255('0x1f4')]=0x1;hopperUtils['getContactDialerIvr'](_0x45e66c,_0x5e9606)[_0x4255('0x3e')](function(_0x1acbbe){_0x45e66c[_0x4255('0x1f4')]=0x0;if(_0x1acbbe){if(!utils[_0x4255('0x1f5')](_0x1acbbe)){_0x45e66c['message']=utils[_0x4255('0x6c')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x45e66c[_0x4255('0x46')]);}else{_0x45e66c[_0x4255('0x81')]+=_0x1acbbe[_0x4255('0x98')];_0x45e66c[_0x4255('0x6b')]=utils[_0x4255('0x6c')]['RUNNING'];for(var _0x44002b=0x0;_0x44002b<_0x1acbbe[_0x4255('0x98')];_0x44002b+=0x1){_0x45e66c[_0x4255('0x1f6')]+=0x1;if(_[_0x4255('0xed')](_0x1acbbe[_0x44002b])||_[_0x4255('0xed')](_0x1acbbe[_0x44002b]['Contact'])||_[_0x4255('0xed')](_0x1acbbe[_0x44002b][_0x4255('0x153')])){_0x5712d9[_0x4255('0x1f7')](_0x4255('0x1f8'),_0x45e66c,_0x1acbbe[_0x44002b]);}else{hopperUtils[_0x4255('0x1f9')](_['pick'](_0x1acbbe[_0x44002b],[_0x4255('0xd9'),_0x4255('0x153')]))[_0x4255('0x3e')](_0x5712d9[_0x4255('0x1e2')](_0x45e66c,_0x1acbbe[_0x44002b]))[_0x4255('0x9c')](_0x5712d9[_0x4255('0x1fa')](_0x4255('0x1fb'),_0x45e66c));}}}}})['catch'](loggerGetContactDialer(_0x4255('0x1fc'),_0x45e66c,_0x5e9606));}};Dialer[_0x4255('0x88')][_0x4255('0xaf')]=function(_0x315b4d,_0x16bc91){var _0x4a5943=this;var _0x3056e3=[];if(_0x16bc91<0x1||_0x315b4d[_0x4255('0xad')]==='booked'){_0x16bc91=0x1;}var _0x38b51a=Math[_0x4255('0x1de')](_0x315b4d[_0x4255('0x12e')]*_0x16bc91)-_0x315b4d[_0x4255('0x81')];if(_0x315b4d[_0x4255('0x1fd')]>0x0){var _0x2cf7b8=_0x315b4d['dialLimitQueue']-_0x315b4d[_0x4255('0x81')]-_0x315b4d[_0x4255('0x1d1')]-_0x315b4d[_0x4255('0x1fe')];if(_0x38b51a>_0x2cf7b8){_0x38b51a=_0x2cf7b8;}}if(_0x38b51a>0x0&&_0x315b4d['temp']==0x0){if(_0x315b4d[_0x4255('0xad')]==='booked'){_0x38b51a=0x1;}if(_0x38b51a>this['maxNumberOriginate']){_0x38b51a=this[_0x4255('0x26')];}for(var _0x86c2a1 in this[_0x4255('0x24')]){if(typeof this[_0x4255('0x24')][_0x86c2a1]!==_0x4255('0xa8')){if(this['agents'][_0x86c2a1][_0x4255('0x6f')]===_0x4255('0x1ff')&&this['agents'][_0x86c2a1][_0x4255('0x8a')]===_0x4255('0x13a')){_0x3056e3[_0x4255('0x99')](this[_0x4255('0x24')][_0x86c2a1]['id']);}}}_0x315b4d['temp']=0x1;hopperUtils[_0x4255('0x200')](_0x315b4d,_0x3056e3,_0x38b51a)['then'](function(_0x195d7e){_0x315b4d[_0x4255('0x1f4')]=0x0;if(_0x195d7e){if(!utils['checkContactEmpty'](_0x195d7e)){hopperUtils['countReScheduled'](_0x315b4d)[_0x4255('0x3e')](sendMessageReschedule(_0x315b4d))[_0x4255('0x9c')](loggerCatch(_0x4255('0x201')));}else{_0x315b4d['originated']+=_0x195d7e[_0x4255('0x98')];_0x315b4d['message']=_0x315b4d[_0x4255('0xad')]===_0x4255('0xa')?utils[_0x4255('0x6c')][_0x4255('0x130')]:utils[_0x4255('0x6c')][_0x4255('0x202')];for(var _0x44e28c=0x0;_0x44e28c<_0x195d7e[_0x4255('0x98')];_0x44e28c+=0x1){if(_[_0x4255('0xed')](_0x195d7e[_0x44e28c])||_[_0x4255('0xed')](_0x195d7e[_0x44e28c][_0x4255('0x16b')])||_[_0x4255('0xed')](_0x195d7e[_0x44e28c]['phone'])){_0x4a5943[_0x4255('0x1f7')](_0x4255('0x1f8'),_0x315b4d,_0x195d7e[_0x44e28c]);}else{hopperUtils[_0x4255('0x203')](_[_0x4255('0x76')](_0x195d7e[_0x44e28c],[_0x4255('0xd8'),'phone']))[_0x4255('0x3e')](_0x4a5943[_0x4255('0x1e2')](_0x315b4d,_0x195d7e[_0x44e28c]))[_0x4255('0x9c')](_0x4a5943[_0x4255('0x1fa')]('[actionOriginate]\x20',_0x315b4d));}}}}})[_0x4255('0x9c')](loggerGetContactDialer(_0x4255('0x204'),_0x315b4d,_0x38b51a));}};Dialer[_0x4255('0x88')][_0x4255('0x61')]=function(_0x114298){if(_0x114298['dialLimitQueue']>0x0){var _0xa91e4b=_0x114298['dialLimitQueue']-_0x114298['originated']-_0x114298[_0x4255('0x1d1')];if(_0xa91e4b>0x0&&_0x114298[_0x4255('0x1f4')]==0x0){this[_0x4255('0x205')](_0x114298);}else{loggerPredictiveCalls[_0x4255('0x4a')](_0x4255('0x206'));}}else{this[_0x4255('0x205')](_0x114298);}};Dialer[_0x4255('0x88')][_0x4255('0x205')]=function(_0x4a04da){var _0x1ea2d6=this;var _0x6eea9e=[];_0x4a04da['originated']+=0x1;for(var _0x2544bf in this[_0x4255('0x24')]){if(typeof this[_0x4255('0x24')][_0x2544bf]!==_0x4255('0xa8')){if(this['agents'][_0x2544bf]['state']==='not_inuse'&&this[_0x4255('0x24')][_0x2544bf][_0x4255('0x8a')]===_0x4255('0x13a')){_0x6eea9e['push'](this[_0x4255('0x24')][_0x2544bf]['id']);}}}_0x4a04da[_0x4255('0x1f4')]=0x1;return this['getContactDialer'](_0x4a04da['id'],_0x6eea9e,0x1,_0x4a04da[_0x4255('0x207')],_0x4a04da)['then'](function(_0x205e60){_0x4a04da[_0x4255('0x1f4')]=0x1;if(_0x205e60){if(!utils[_0x4255('0x1f5')](_0x205e60)){utils[_0x4255('0x66')](_0x4a04da,0x1,0x0);return hopperUtils[_0x4255('0x208')](_0x4a04da)[_0x4255('0x3e')](sendMessageReschedule(_0x4a04da))[_0x4255('0x9c')](loggerCatch(_0x4255('0x201')));}else{_0x4a04da[_0x4255('0x6b')]=utils['CAMPAIGN_STATUS'][_0x4255('0x202')];if(_[_0x4255('0xed')](_0x205e60[0x0])||_[_0x4255('0xed')](_0x205e60[0x0][_0x4255('0x16b')])||_[_0x4255('0xed')](_0x205e60[0x0][_0x4255('0x153')])){_0x1ea2d6[_0x4255('0x1f7')](_0x4255('0x1f8'),_0x4a04da,_0x205e60[0x0]);}else{return hopperUtils[_0x4255('0x203')](_['pick'](_0x205e60[0x0],['VoiceQueueId',_0x4255('0x153')]))[_0x4255('0x3e')](_0x1ea2d6[_0x4255('0x1e2')](_0x4a04da,_0x205e60[0x0]))[_0x4255('0x9c')](_0x1ea2d6['loggerHandler'](_0x4255('0x209'),_0x4a04da));}}}})[_0x4255('0x9c')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4a04da,0x1));};Dialer[_0x4255('0x88')]['abandonmentRate']=function(_0x4dacfc,_0x16a1d4,_0x53330c,_0x503d92,_0x28a840,_0xb8a0c7){loggerPredictive[_0x4255('0x4a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x4255('0x4a')](_0x4255('0x20a'),_0x4dacfc);loggerPredictive[_0x4255('0x4a')](_0x4255('0x20b'),_0x16a1d4);loggerPredictive[_0x4255('0x4a')](_0x4255('0x20c'),_0x53330c);loggerPredictive[_0x4255('0x4a')]('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',_0x503d92);loggerPredictive[_0x4255('0x4a')](_0x4255('0x20d'),_0x28a840);loggerPredictive[_0x4255('0x4a')](_0x4255('0x51'));return new Promise(function(_0x5a859b,_0x31246f){if(_0x4dacfc<=0x0||isNaN(_0x4dacfc)){return _0x31246f(msgResponse(_0x4255('0x20e'),_0x4255('0x87'),_0x4255('0x20f')+_0x4dacfc));}if(_0x53330c<=0x0||isNaN(_0x53330c)){return _0x31246f(msgResponse('[abandonmentRate]',_0x4255('0x87'),'Ts\x20=\x20'+_0x53330c));}if(_0x503d92<=0x0||isNaN(_0x503d92)){return _0x31246f(msgResponse(_0x4255('0x20e'),'Error','p\x20=\x20'+_0x503d92));}if(_0x16a1d4<=0x0||isNaN(_0x16a1d4)){return _0x31246f(msgResponse(_0x4255('0x20e'),'Error','interval\x20=\x20'+_0x16a1d4));}if(_0x28a840<=0x0||isNaN(_0x28a840)){return _0x31246f(msgResponse(_0x4255('0x20e'),_0x4255('0x87'),_0x4255('0x210')+_0x28a840));}_0xb8a0c7=_0xb8a0c7||0x0;var _0x5690d9=0x1/_0x53330c;var _0x3711fb=0x0;var _0x1c445f=0x0;var _0x2746e3=0x0;var _0x1aa67b=0x0;for(var _0x3e1f99=0x0;_0x2746e3<_0x28a840;_0x3e1f99+=0x1){_0x1c445f=_0x3e1f99/_0x16a1d4;_0x3711fb=(_0x503d92*_0x1c445f+_0xb8a0c7)/_0x5690d9;_0x2746e3=utils['erlangb'](_0x3711fb,_0x4dacfc);_0x1aa67b=_0x3711fb/_0x4dacfc*(0x1-utils['erlangb'](_0x3711fb,_0x4dacfc));}return _0x5a859b({'erlangCalls':_0x3e1f99,'erlangCallToSecond':_0x16a1d4/_0x3e1f99,'erlangAbandonmentRate':_0x2746e3,'erlangBusyFactor':_0x1aa67b});});};Dialer[_0x4255('0x88')]['busyFactor']=function(_0x257442,_0x4ae300,_0x4ba953,_0x10e670,_0x3e6841,_0x5b4459){loggerPredictive[_0x4255('0x4a')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x4255('0x4a')](_0x4255('0x20a'),_0x257442);loggerPredictive[_0x4255('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ae300);loggerPredictive[_0x4255('0x4a')](_0x4255('0x20c'),_0x4ba953);loggerPredictive['info'](_0x4255('0x211'),_0x10e670);loggerPredictive['info'](_0x4255('0x212'),_0x3e6841);loggerPredictive[_0x4255('0x4a')](_0x4255('0x51'));return new Promise(function(_0x4a85c7,_0x3f0ce4){if(_0x257442<=0x0||isNaN(_0x257442)){return _0x3f0ce4(msgResponse('[busyFactor]',_0x4255('0x87'),_0x4255('0x20f')+_0x257442));}if(_0x4ba953<=0x0||isNaN(_0x4ba953)){return _0x3f0ce4(msgResponse(_0x4255('0x213'),'Error',_0x4255('0x214')+_0x4ba953));}if(_0x10e670<=0x0||isNaN(_0x10e670)){return _0x3f0ce4(msgResponse(_0x4255('0x213'),'Error',_0x4255('0x215')+_0x10e670));}if(_0x4ae300<=0x0||isNaN(_0x4ae300)){return _0x3f0ce4(msgResponse(_0x4255('0x213'),_0x4255('0x87'),_0x4255('0x216')+_0x4ae300));}if(_0x3e6841<=0x0||isNaN(_0x3e6841)){return _0x3f0ce4(msgResponse(_0x4255('0x213'),'Error','Umin\x20=\x20'+_0x3e6841));}_0x5b4459=_0x5b4459||0x0;var _0x5d9ced=0x1/_0x4ba953;var _0x5abbda=0x0;var _0x49bd9c=0x0;var _0x2a891c=0x0;var _0x4ca224=0x0;for(var _0x5963aa=0x0;_0x4ca224<_0x3e6841;_0x5963aa+=0x1){_0x49bd9c=_0x5963aa/_0x4ae300;_0x5abbda=(_0x10e670*_0x49bd9c+_0x5b4459)/_0x5d9ced;_0x2a891c=utils[_0x4255('0x217')](_0x5abbda,_0x257442);_0x4ca224=_0x5abbda/_0x257442*(0x1-utils[_0x4255('0x217')](_0x5abbda,_0x257442));}return _0x4a85c7({'erlangCalls':_0x5963aa,'erlangCallToSecond':_0x4ae300/_0x5963aa,'erlangAbandonmentRate':_0x2a891c,'erlangBusyFactor':_0x4ca224});});};module[_0x4255('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index e47cad0..1415c52 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef10=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','voiceQueue','name','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat'];(function(_0x52cbe0,_0x332b2e){var _0x4bb9da=function(_0x4f8008){while(--_0x4f8008){_0x52cbe0['push'](_0x52cbe0['shift']());}};_0x4bb9da(++_0x332b2e);}(_0xef10,0x119));var _0x0ef1=function(_0x4eaf5e,_0x1ad6aa){_0x4eaf5e=_0x4eaf5e-0x0;var _0x226a7e=_0xef10[_0x4eaf5e];return _0x226a7e;};'use strict';var util=require(_0x0ef1('0x0'));var _=require(_0x0ef1('0x1'));var moment=require('moment');function checkNameSurname(_0x2ef801,_0x4a9c4e,_0x251cd2){var _0x1b876c='';if(!_[_0x0ef1('0x2')](_0x4a9c4e)&&'string'===typeof _0x4a9c4e){_0x1b876c+=_0x4a9c4e;}if(!_[_0x0ef1('0x2')](_0x251cd2)&&'string'===typeof _0x251cd2){_0x1b876c+='\x20'+_0x251cd2;}if(_0x1b876c!==''){return _0x1b876c;}return _0x2ef801;}function Action(_0x1f0e85,_0x5f7ce7,_0x5290a2){this[_0x0ef1('0x3')]=_0x1f0e85;this['uniqueid']=_0x5290a2||undefined;this[_0x0ef1('0x4')]=checkNameSurname(_0x5f7ce7['Contact'][_0x0ef1('0x5')],_0x5f7ce7['Contact'][_0x0ef1('0x6')],_0x5f7ce7['Contact'][_0x0ef1('0x7')]);this[_0x0ef1('0x8')]=_0x5f7ce7[_0x0ef1('0x5')];this[_0x0ef1('0x9')]=_0x1f0e85[_0x0ef1('0x4')];this['active']=_0x5f7ce7['active']||![];this[_0x0ef1('0xa')]=_0x1f0e85[_0x0ef1('0xa')];this[_0x0ef1('0xb')]=_0x1f0e85['dialQueueTimeout']||0x3;this[_0x0ef1('0xc')]=_0x5f7ce7[_0x0ef1('0xc')];this['countbusyretry']=_0x5f7ce7[_0x0ef1('0xd')];this[_0x0ef1('0xe')]=_0x5f7ce7[_0x0ef1('0xe')];this[_0x0ef1('0xf')]=_0x5f7ce7[_0x0ef1('0xf')];this['countnosuchnumberretry']=_0x5f7ce7[_0x0ef1('0x10')];this[_0x0ef1('0x11')]=_0x5f7ce7[_0x0ef1('0x11')];this[_0x0ef1('0x12')]=_0x5f7ce7[_0x0ef1('0x12')];this[_0x0ef1('0x13')]=_0x5f7ce7['countmachineretry'];this[_0x0ef1('0x14')]=_0x5f7ce7[_0x0ef1('0x14')];this[_0x0ef1('0x15')]=_0x5f7ce7[_0x0ef1('0x15')];this[_0x0ef1('0x16')]=_0x5f7ce7[_0x0ef1('0x16')];this[_0x0ef1('0x17')]=_0x5f7ce7[_0x0ef1('0x17')];this['VoiceQueueId']=_0x5f7ce7[_0x0ef1('0x18')];this[_0x0ef1('0x19')]=_0x5f7ce7[_0x0ef1('0x19')];this[_0x0ef1('0x1a')]=_0x5f7ce7['id'];this[_0x0ef1('0x1b')]=_0x5f7ce7['Contact'][_0x0ef1('0x6')]||'';this['starttime']=moment()['format'](_0x0ef1('0x1c'));this[_0x0ef1('0x1d')]=_0x5f7ce7['callback'];this[_0x0ef1('0x1e')]=_0x5f7ce7[_0x0ef1('0x1e')];this[_0x0ef1('0x1f')]=_0x5f7ce7[_0x0ef1('0x1f')];this[_0x0ef1('0x20')]=_0x5f7ce7[_0x0ef1('0x20')];this[_0x0ef1('0x21')]='';this[_0x0ef1('0x22')]='';}Action[_0x0ef1('0x23')][_0x0ef1('0x24')]=function(){return util['format'](_0x0ef1('0x25'),this['name'],this[_0x0ef1('0x3')][_0x0ef1('0x26')]>0x0?this['number'][_0x0ef1('0x27')](this['voiceQueue']['dialCutDigit']):this['number']);};Action['prototype'][_0x0ef1('0x28')]=function(){return this[_0x0ef1('0x9')];};module[_0x0ef1('0x29')]=Action; \ No newline at end of file +var _0x613e=['util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','exports'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x613e,0x160));var _0xe613=function(_0x68d115,_0x43bbe9){_0x68d115=_0x68d115-0x0;var _0x43b58b=_0x613e[_0x68d115];return _0x43b58b;};'use strict';var util=require(_0xe613('0x0'));var _=require(_0xe613('0x1'));var moment=require(_0xe613('0x2'));function checkNameSurname(_0x545e58,_0x471911,_0x3469e1){var _0x1f3266='';if(!_[_0xe613('0x3')](_0x471911)&&_0xe613('0x4')===typeof _0x471911){_0x1f3266+=_0x471911;}if(!_[_0xe613('0x3')](_0x3469e1)&&_0xe613('0x4')===typeof _0x3469e1){_0x1f3266+='\x20'+_0x3469e1;}if(_0x1f3266!==''){return _0x1f3266;}return _0x545e58;}function Action(_0x2bee12,_0xcd211,_0x4358f5){this[_0xe613('0x5')]=_0x2bee12;this[_0xe613('0x6')]=_0x4358f5||undefined;this[_0xe613('0x7')]=checkNameSurname(_0xcd211[_0xe613('0x8')]['phone'],_0xcd211[_0xe613('0x8')][_0xe613('0x9')],_0xcd211['Contact']['lastName']);this[_0xe613('0xa')]=_0xcd211['phone'];this[_0xe613('0xb')]=_0x2bee12[_0xe613('0x7')];this[_0xe613('0xc')]=_0xcd211['active']||![];this[_0xe613('0xd')]=_0x2bee12[_0xe613('0xd')];this[_0xe613('0xe')]=_0x2bee12[_0xe613('0xe')]||0x3;this[_0xe613('0xf')]=_0xcd211[_0xe613('0xf')];this[_0xe613('0x10')]=_0xcd211[_0xe613('0x10')];this[_0xe613('0x11')]=_0xcd211[_0xe613('0x11')];this['countnoanswerretry']=_0xcd211[_0xe613('0x12')];this[_0xe613('0x13')]=_0xcd211[_0xe613('0x13')];this[_0xe613('0x14')]=_0xcd211[_0xe613('0x14')];this[_0xe613('0x15')]=_0xcd211[_0xe613('0x15')];this[_0xe613('0x16')]=_0xcd211[_0xe613('0x16')];this[_0xe613('0x17')]=_0xcd211[_0xe613('0x17')];this[_0xe613('0x18')]=_0xcd211['ContactId'];this['ListId']=_0xcd211[_0xe613('0x19')];this[_0xe613('0x1a')]=_0xcd211[_0xe613('0x1a')];this[_0xe613('0x1b')]=_0xcd211[_0xe613('0x1b')];this[_0xe613('0x1c')]=_0xcd211[_0xe613('0x1c')];this[_0xe613('0x1d')]=_0xcd211['id'];this[_0xe613('0x1e')]=_0xcd211[_0xe613('0x8')]['firstName']||'';this['starttime']=moment()[_0xe613('0x1f')](_0xe613('0x20'));this[_0xe613('0x21')]=_0xcd211[_0xe613('0x21')];this['callbackuniqueid']=_0xcd211['callbackuniqueid'];this['callbackat']=_0xcd211[_0xe613('0x22')];this[_0xe613('0x23')]=_0xcd211['recallme'];this[_0xe613('0x24')]='';this[_0xe613('0x25')]='';}Action['prototype'][_0xe613('0x26')]=function(){return util[_0xe613('0x1f')](_0xe613('0x27'),this[_0xe613('0x7')],this[_0xe613('0x5')][_0xe613('0x28')]>0x0?this[_0xe613('0xa')][_0xe613('0x29')](this[_0xe613('0x5')][_0xe613('0x28')]):this[_0xe613('0xa')]);};Action[_0xe613('0x2a')]['getQueue']=function(){return this['queue'];};module[_0xe613('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index addb10e..9ede8e0 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd2f=['moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','ringtime','starttime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x51dff3,_0x4fa8d2){var _0x2d729e=function(_0x440f08){while(--_0x440f08){_0x51dff3['push'](_0x51dff3['shift']());}};_0x2d729e(++_0x4fa8d2);}(_0xcd2f,0x1e0));var _0xfcd2=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xcd2f[_0x138adb];return _0x1b27f2;};'use strict';var moment=require(_0xfcd2('0x0'));var utils=require(_0xfcd2('0x1'));function AgentComplete(_0x2d8ab5,_0x2c1662){this[_0xfcd2('0x2')]=0x4;this['statedesc']=_0xfcd2('0x3');this[_0xfcd2('0x4')]=_0x2d8ab5[_0xfcd2('0x4')];this[_0xfcd2('0x5')]=_0x2d8ab5['type'];this[_0xfcd2('0x6')]=_0x2d8ab5[_0xfcd2('0x5')]===_0xfcd2('0x7')?'queue':_0x2d8ab5['type'];this['countbusyretry']=_0x2d8ab5['countbusyretry'];this[_0xfcd2('0x8')]=_0x2d8ab5['countcongestionretry'];this[_0xfcd2('0x9')]=_0x2d8ab5['countnoanswerretry'];this['countglobal']=_0x2d8ab5['countbusyretry']+_0x2d8ab5['countcongestionretry']+_0x2d8ab5[_0xfcd2('0x9')]+_0x2d8ab5[_0xfcd2('0xa')]+_0x2d8ab5['countdropretry']+_0x2d8ab5[_0xfcd2('0xb')]+_0x2d8ab5['countmachineretry']+_0x2d8ab5[_0xfcd2('0xc')];this[_0xfcd2('0xa')]=_0x2d8ab5[_0xfcd2('0xa')];this[_0xfcd2('0xd')]=_0x2d8ab5[_0xfcd2('0xd')];this['countabandonedretry']=_0x2d8ab5['countabandonedretry'];this['countmachineretry']=_0x2d8ab5['countmachineretry'];this[_0xfcd2('0xc')]=_0x2d8ab5[_0xfcd2('0xc')];this[_0xfcd2('0xe')]=_0x2c1662[_0xfcd2('0xe')];this[_0xfcd2('0xf')]=_0x2d8ab5[_0xfcd2('0x10')];this[_0xfcd2('0x11')]=_0x2d8ab5[_0xfcd2('0x12')];this['starttime']=_0x2d8ab5['starttime'];this[_0xfcd2('0x13')]=_0x2d8ab5[_0xfcd2('0x13')];this[_0xfcd2('0x14')]=_0x2d8ab5[_0xfcd2('0x14')];this[_0xfcd2('0x15')]=moment()[_0xfcd2('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfcd2('0x17')]=utils['getSeconds'](_0x2d8ab5['responsetime'],_0x2d8ab5[_0xfcd2('0x18')]);this['holdtime']=utils['getSeconds'](_0x2d8ab5['answertime'],_0x2d8ab5[_0xfcd2('0x13')]);this['talktime']=utils[_0xfcd2('0x19')](this['endtime'],_0x2d8ab5[_0xfcd2('0x14')]);this[_0xfcd2('0x1a')]=_0x2c1662['queue'];this[_0xfcd2('0x1b')]=_0x2c1662[_0xfcd2('0x1b')];this[_0xfcd2('0x1c')]=_0x2c1662[_0xfcd2('0x1c')];this[_0xfcd2('0x1d')]=_0x2d8ab5[_0xfcd2('0x1d')];this[_0xfcd2('0x1e')]=_0x2d8ab5[_0xfcd2('0x1e')];this[_0xfcd2('0x1f')]=_0x2d8ab5[_0xfcd2('0x1f')];this[_0xfcd2('0x20')]=_0x2d8ab5[_0xfcd2('0x20')];this[_0xfcd2('0x21')]=_0x2d8ab5['ContactId'];this['ListId']=_0x2d8ab5[_0xfcd2('0x22')];this[_0xfcd2('0x23')]=_0x2d8ab5[_0xfcd2('0x23')];this['VoiceQueueId']=_0x2d8ab5['VoiceQueueId'];this[_0xfcd2('0x24')]=_0x2d8ab5[_0xfcd2('0x24')];this[_0xfcd2('0x25')]=_0x2d8ab5[_0xfcd2('0x25')]||'';this[_0xfcd2('0x26')]=_0x2d8ab5[_0xfcd2('0x26')]||'';this[_0xfcd2('0x27')]=_0x2d8ab5[_0xfcd2('0x27')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x5f84=['calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5f84,0x1b9));var _0x45f8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5f84[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0x45f8('0x0'));var utils=require('../utils');function AgentComplete(_0x325cc6,_0x3e7352){this[_0x45f8('0x1')]=0x4;this[_0x45f8('0x2')]=_0x45f8('0x3');this[_0x45f8('0x4')]=_0x325cc6['scheduledat'];this['type']=_0x325cc6[_0x45f8('0x5')];this[_0x45f8('0x6')]=_0x325cc6[_0x45f8('0x5')]===_0x45f8('0x7')?_0x45f8('0x8'):_0x325cc6[_0x45f8('0x5')];this[_0x45f8('0x9')]=_0x325cc6[_0x45f8('0x9')];this['countcongestionretry']=_0x325cc6[_0x45f8('0xa')];this[_0x45f8('0xb')]=_0x325cc6[_0x45f8('0xb')];this[_0x45f8('0xc')]=_0x325cc6[_0x45f8('0x9')]+_0x325cc6[_0x45f8('0xa')]+_0x325cc6[_0x45f8('0xb')]+_0x325cc6[_0x45f8('0xd')]+_0x325cc6[_0x45f8('0xe')]+_0x325cc6['countabandonedretry']+_0x325cc6[_0x45f8('0xf')]+_0x325cc6['countagentrejectretry'];this[_0x45f8('0xd')]=_0x325cc6[_0x45f8('0xd')];this['countdropretry']=_0x325cc6['countdropretry'];this[_0x45f8('0x10')]=_0x325cc6[_0x45f8('0x10')];this[_0x45f8('0xf')]=_0x325cc6['countmachineretry'];this[_0x45f8('0x11')]=_0x325cc6[_0x45f8('0x11')];this[_0x45f8('0x12')]=_0x3e7352[_0x45f8('0x12')];this[_0x45f8('0x13')]=_0x325cc6[_0x45f8('0x14')];this[_0x45f8('0x15')]=_0x325cc6[_0x45f8('0x16')];this[_0x45f8('0x17')]=_0x325cc6['starttime'];this[_0x45f8('0x18')]=_0x325cc6['responsetime'];this[_0x45f8('0x19')]=_0x325cc6[_0x45f8('0x19')];this[_0x45f8('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x45f8('0x1b')]=utils[_0x45f8('0x1c')](_0x325cc6['responsetime'],_0x325cc6[_0x45f8('0x17')]);this[_0x45f8('0x1d')]=utils[_0x45f8('0x1c')](_0x325cc6[_0x45f8('0x19')],_0x325cc6['responsetime']);this[_0x45f8('0x1e')]=utils[_0x45f8('0x1c')](this[_0x45f8('0x1a')],_0x325cc6['answertime']);this[_0x45f8('0x8')]=_0x3e7352['queue'];this[_0x45f8('0x1f')]=_0x3e7352[_0x45f8('0x1f')];this[_0x45f8('0x20')]=_0x3e7352['reason'];this[_0x45f8('0x21')]=_0x325cc6[_0x45f8('0x21')];this['callbackuniqueid']=_0x325cc6[_0x45f8('0x22')];this[_0x45f8('0x23')]=_0x325cc6[_0x45f8('0x23')];this[_0x45f8('0x24')]=_0x325cc6[_0x45f8('0x24')];this[_0x45f8('0x25')]=_0x325cc6[_0x45f8('0x25')];this[_0x45f8('0x26')]=_0x325cc6[_0x45f8('0x26')];this[_0x45f8('0x27')]=_0x325cc6['UserId'];this['VoiceQueueId']=_0x325cc6[_0x45f8('0x28')];this['CampaignId']=_0x325cc6[_0x45f8('0x29')];this[_0x45f8('0x2a')]=_0x325cc6['originatecalleridnum']||'';this[_0x45f8('0x2b')]=_0x325cc6[_0x45f8('0x2b')]||'';this[_0x45f8('0x2c')]=_0x325cc6[_0x45f8('0x2c')];}module[_0x45f8('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index db7fdf7..be0e879 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e0a=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x0e0a,0x1cd));var _0xa0e0=function(_0x1db347,_0x50526b){_0x1db347=_0x1db347-0x0;var _0x4ec95f=_0x0e0a[_0x1db347];return _0x4ec95f;};'use strict';function Final(_0x4745b8){this[_0xa0e0('0x0')]=_0x4745b8[_0xa0e0('0x0')];this[_0xa0e0('0x1')]=_0x4745b8[_0xa0e0('0x1')];this[_0xa0e0('0x2')]=_0x4745b8['type'];this[_0xa0e0('0x3')]=_0x4745b8[_0xa0e0('0x2')]===_0xa0e0('0x4')?_0xa0e0('0x5'):_0x4745b8[_0xa0e0('0x2')];this[_0xa0e0('0x6')]=_0x4745b8['countbusyretry'];this[_0xa0e0('0x7')]=_0x4745b8[_0xa0e0('0x7')];this[_0xa0e0('0x8')]=_0x4745b8[_0xa0e0('0x8')];this['countglobal']=_0x4745b8[_0xa0e0('0x6')]+_0x4745b8[_0xa0e0('0x7')]+_0x4745b8[_0xa0e0('0x8')]+_0x4745b8[_0xa0e0('0x9')]+_0x4745b8['countdropretry']+_0x4745b8[_0xa0e0('0xa')]+_0x4745b8[_0xa0e0('0xb')]+_0x4745b8['countagentrejectretry'];this[_0xa0e0('0x9')]=_0x4745b8[_0xa0e0('0x9')];this[_0xa0e0('0xc')]=_0x4745b8[_0xa0e0('0xc')];this[_0xa0e0('0xa')]=_0x4745b8[_0xa0e0('0xa')];this['countmachineretry']=_0x4745b8[_0xa0e0('0xb')];this['countagentrejectretry']=_0x4745b8[_0xa0e0('0xd')];this[_0xa0e0('0x5')]=_0x4745b8[_0xa0e0('0x5')];this[_0xa0e0('0xe')]=_0x4745b8['calleridname'];this[_0xa0e0('0xf')]=_0x4745b8[_0xa0e0('0xf')];this[_0xa0e0('0x10')]=_0x4745b8[_0xa0e0('0x10')];this[_0xa0e0('0x11')]=_0x4745b8[_0xa0e0('0x11')];this[_0xa0e0('0x12')]=_0x4745b8['responsetime'];this['ringtime']=_0x4745b8[_0xa0e0('0x13')]||0x0;this[_0xa0e0('0x14')]=_0x4745b8[_0xa0e0('0x14')]||0x0;this['talktime']=_0x4745b8[_0xa0e0('0x15')]||0x0;this['callback']=_0x4745b8[_0xa0e0('0x16')];this[_0xa0e0('0x17')]=_0x4745b8[_0xa0e0('0x17')];this[_0xa0e0('0x18')]=_0x4745b8[_0xa0e0('0x18')];this['recallme']=_0x4745b8[_0xa0e0('0x19')];this['ContactId']=_0x4745b8[_0xa0e0('0x1a')];this[_0xa0e0('0x1b')]=_0x4745b8[_0xa0e0('0x1b')];this[_0xa0e0('0x1c')]=_0x4745b8[_0xa0e0('0x1c')];this['VoiceQueueId']=_0x4745b8['VoiceQueueId'];this['CampaignId']=_0x4745b8[_0xa0e0('0x1d')];this[_0xa0e0('0x1e')]=_0x4745b8[_0xa0e0('0x1e')]||'';this[_0xa0e0('0x1f')]=_0x4745b8[_0xa0e0('0x1f')]||'';this['state']=_0x4745b8[_0xa0e0('0x20')];this[_0xa0e0('0x21')]=_0x4745b8[_0xa0e0('0x21')];}module[_0xa0e0('0x22')]=Final; \ No newline at end of file +var _0xe8ca=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry'];(function(_0x4145fa,_0x1d94e1){var _0x50216d=function(_0x131cb9){while(--_0x131cb9){_0x4145fa['push'](_0x4145fa['shift']());}};_0x50216d(++_0x1d94e1);}(_0xe8ca,0xef));var _0xae8c=function(_0x1f0714,_0xde0530){_0x1f0714=_0x1f0714-0x0;var _0x33669d=_0xe8ca[_0x1f0714];return _0x33669d;};'use strict';function Final(_0x2a57a8){this[_0xae8c('0x0')]=_0x2a57a8['uniqueid'];this['scheduledat']=_0x2a57a8[_0xae8c('0x1')];this['type']=_0x2a57a8[_0xae8c('0x2')];this[_0xae8c('0x3')]=_0x2a57a8[_0xae8c('0x2')]===_0xae8c('0x4')?'queue':_0x2a57a8['type'];this[_0xae8c('0x5')]=_0x2a57a8[_0xae8c('0x5')];this[_0xae8c('0x6')]=_0x2a57a8['countcongestionretry'];this[_0xae8c('0x7')]=_0x2a57a8[_0xae8c('0x7')];this[_0xae8c('0x8')]=_0x2a57a8[_0xae8c('0x5')]+_0x2a57a8[_0xae8c('0x6')]+_0x2a57a8['countnoanswerretry']+_0x2a57a8[_0xae8c('0x9')]+_0x2a57a8[_0xae8c('0xa')]+_0x2a57a8[_0xae8c('0xb')]+_0x2a57a8[_0xae8c('0xc')]+_0x2a57a8[_0xae8c('0xd')];this[_0xae8c('0x9')]=_0x2a57a8[_0xae8c('0x9')];this[_0xae8c('0xa')]=_0x2a57a8['countdropretry'];this[_0xae8c('0xb')]=_0x2a57a8[_0xae8c('0xb')];this[_0xae8c('0xc')]=_0x2a57a8[_0xae8c('0xc')];this[_0xae8c('0xd')]=_0x2a57a8[_0xae8c('0xd')];this['queue']=_0x2a57a8[_0xae8c('0xe')];this[_0xae8c('0xf')]=_0x2a57a8[_0xae8c('0xf')];this['calleridnum']=_0x2a57a8[_0xae8c('0x10')];this[_0xae8c('0x11')]=_0x2a57a8[_0xae8c('0x11')];this['responsetime']=_0x2a57a8['responsetime'];this[_0xae8c('0x12')]=_0x2a57a8['responsetime'];this['ringtime']=_0x2a57a8[_0xae8c('0x13')]||0x0;this[_0xae8c('0x14')]=_0x2a57a8[_0xae8c('0x14')]||0x0;this[_0xae8c('0x15')]=_0x2a57a8[_0xae8c('0x15')]||0x0;this[_0xae8c('0x16')]=_0x2a57a8['callback'];this[_0xae8c('0x17')]=_0x2a57a8[_0xae8c('0x17')];this[_0xae8c('0x18')]=_0x2a57a8[_0xae8c('0x18')];this[_0xae8c('0x19')]=_0x2a57a8[_0xae8c('0x19')];this[_0xae8c('0x1a')]=_0x2a57a8[_0xae8c('0x1a')];this[_0xae8c('0x1b')]=_0x2a57a8[_0xae8c('0x1b')];this[_0xae8c('0x1c')]=_0x2a57a8[_0xae8c('0x1c')];this['VoiceQueueId']=_0x2a57a8[_0xae8c('0x1d')];this[_0xae8c('0x1e')]=_0x2a57a8[_0xae8c('0x1e')];this[_0xae8c('0x1f')]=_0x2a57a8[_0xae8c('0x1f')]||'';this['originatecalleridname']=_0x2a57a8['originatecalleridname']||'';this[_0xae8c('0x20')]=_0x2a57a8[_0xae8c('0x20')];this[_0xae8c('0x21')]=_0x2a57a8[_0xae8c('0x21')];}module[_0xae8c('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 7d52966..2e84e16 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5f9=['countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','amd','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0xb5f9,0x133));var _0x9b5f=function(_0x4472d0,_0x3346eb){_0x4472d0=_0x4472d0-0x0;var _0x460920=_0xb5f9[_0x4472d0];return _0x460920;};'use strict';var moment=require('moment');var utils=require(_0x9b5f('0x0'));function Hangup(_0x23b05a,_0x51d812){this['state']=0x4;this[_0x9b5f('0x1')]=_0x9b5f('0x2');this[_0x9b5f('0x3')]=_0x23b05a[_0x9b5f('0x3')];this[_0x9b5f('0x4')]=_0x23b05a['type'];this[_0x9b5f('0x5')]=_0x23b05a['type']==='outbound'?'queue':_0x23b05a[_0x9b5f('0x4')];this[_0x9b5f('0x6')]=_0x23b05a['amd']||![];this['countbusyretry']=_0x23b05a['countbusyretry'];this['countcongestionretry']=_0x23b05a[_0x9b5f('0x7')];this[_0x9b5f('0x8')]=_0x23b05a[_0x9b5f('0x8')];this[_0x9b5f('0x9')]=_0x23b05a['countbusyretry']+_0x23b05a[_0x9b5f('0x7')]+_0x23b05a[_0x9b5f('0x8')]+_0x23b05a[_0x9b5f('0xa')]+_0x23b05a['countdropretry']+_0x23b05a[_0x9b5f('0xb')]+_0x23b05a[_0x9b5f('0xc')]+_0x23b05a['countagentrejectretry'];this[_0x9b5f('0xa')]=_0x23b05a['countnosuchnumberretry'];this[_0x9b5f('0xd')]=_0x23b05a[_0x9b5f('0xd')];this[_0x9b5f('0xb')]=_0x23b05a['countabandonedretry'];this[_0x9b5f('0xc')]=_0x23b05a[_0x9b5f('0xc')];this[_0x9b5f('0xe')]=_0x23b05a[_0x9b5f('0xe')];this[_0x9b5f('0xf')]=_0x51d812['uniqueid'];this[_0x9b5f('0x10')]=_0x23b05a[_0x9b5f('0x11')];this[_0x9b5f('0x12')]=_0x23b05a[_0x9b5f('0x13')];this['starttime']=_0x23b05a[_0x9b5f('0x14')];this[_0x9b5f('0x15')]=_0x23b05a[_0x9b5f('0x15')];this[_0x9b5f('0x16')]=moment()[_0x9b5f('0x17')](_0x9b5f('0x18'));this[_0x9b5f('0x19')]=utils[_0x9b5f('0x1a')](_0x23b05a[_0x9b5f('0x15')],_0x23b05a[_0x9b5f('0x14')]);this[_0x9b5f('0x1b')]=0x0;this[_0x9b5f('0x1c')]=utils[_0x9b5f('0x1a')](this[_0x9b5f('0x16')],_0x23b05a['responsetime']);this[_0x9b5f('0x1d')]=_0x23b05a[_0x9b5f('0x1d')];this['membername']='IVR';this['reason']=_0x51d812['cause-txt'];this[_0x9b5f('0x1e')]=_0x23b05a[_0x9b5f('0x1e')];this[_0x9b5f('0x1f')]=_0x23b05a[_0x9b5f('0x1f')];this[_0x9b5f('0x20')]=_0x23b05a[_0x9b5f('0x20')];this['recallme']=_0x23b05a[_0x9b5f('0x21')];this[_0x9b5f('0x22')]=_0x23b05a['ContactId'];this[_0x9b5f('0x23')]=_0x23b05a[_0x9b5f('0x23')];this['UserId']=_0x23b05a[_0x9b5f('0x24')];this[_0x9b5f('0x25')]=_0x23b05a['VoiceQueueId'];this[_0x9b5f('0x26')]=_0x23b05a['CampaignId'];}module[_0x9b5f('0x27')]=Hangup; \ No newline at end of file +var _0x0983=['campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','endtime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type'];(function(_0x3b9ab5,_0x204a29){var _0x84b8e5=function(_0x485698){while(--_0x485698){_0x3b9ab5['push'](_0x3b9ab5['shift']());}};_0x84b8e5(++_0x204a29);}(_0x0983,0xd0));var _0x3098=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0983[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0x3098('0x0'));var utils=require(_0x3098('0x1'));function Hangup(_0x5f0955,_0xc8efd9){this[_0x3098('0x2')]=0x4;this[_0x3098('0x3')]=_0x3098('0x4');this['scheduledat']=_0x5f0955[_0x3098('0x5')];this[_0x3098('0x6')]=_0x5f0955['type'];this[_0x3098('0x7')]=_0x5f0955[_0x3098('0x6')]==='outbound'?_0x3098('0x8'):_0x5f0955['type'];this[_0x3098('0x9')]=_0x5f0955[_0x3098('0x9')]||![];this[_0x3098('0xa')]=_0x5f0955['countbusyretry'];this[_0x3098('0xb')]=_0x5f0955['countcongestionretry'];this[_0x3098('0xc')]=_0x5f0955[_0x3098('0xc')];this['countglobal']=_0x5f0955['countbusyretry']+_0x5f0955[_0x3098('0xb')]+_0x5f0955['countnoanswerretry']+_0x5f0955[_0x3098('0xd')]+_0x5f0955['countdropretry']+_0x5f0955[_0x3098('0xe')]+_0x5f0955[_0x3098('0xf')]+_0x5f0955[_0x3098('0x10')];this[_0x3098('0xd')]=_0x5f0955[_0x3098('0xd')];this[_0x3098('0x11')]=_0x5f0955['countdropretry'];this[_0x3098('0xe')]=_0x5f0955[_0x3098('0xe')];this[_0x3098('0xf')]=_0x5f0955[_0x3098('0xf')];this[_0x3098('0x10')]=_0x5f0955['countagentrejectretry'];this[_0x3098('0x12')]=_0xc8efd9[_0x3098('0x12')];this['calleridname']=_0x5f0955[_0x3098('0x13')];this[_0x3098('0x14')]=_0x5f0955[_0x3098('0x15')];this['starttime']=_0x5f0955[_0x3098('0x16')];this[_0x3098('0x17')]=_0x5f0955[_0x3098('0x17')];this['endtime']=moment()[_0x3098('0x18')](_0x3098('0x19'));this[_0x3098('0x1a')]=utils['getSeconds'](_0x5f0955[_0x3098('0x17')],_0x5f0955[_0x3098('0x16')]);this[_0x3098('0x1b')]=0x0;this[_0x3098('0x1c')]=utils[_0x3098('0x1d')](this[_0x3098('0x1e')],_0x5f0955[_0x3098('0x17')]);this[_0x3098('0x8')]=_0x5f0955[_0x3098('0x8')];this['membername']=_0x3098('0x1f');this[_0x3098('0x20')]=_0xc8efd9['cause-txt'];this[_0x3098('0x21')]=_0x5f0955[_0x3098('0x21')];this['callbackuniqueid']=_0x5f0955[_0x3098('0x22')];this[_0x3098('0x23')]=_0x5f0955['callbackat'];this[_0x3098('0x24')]=_0x5f0955[_0x3098('0x24')];this[_0x3098('0x25')]=_0x5f0955[_0x3098('0x25')];this[_0x3098('0x26')]=_0x5f0955[_0x3098('0x26')];this[_0x3098('0x27')]=_0x5f0955[_0x3098('0x27')];this[_0x3098('0x28')]=_0x5f0955[_0x3098('0x28')];this[_0x3098('0x29')]=_0x5f0955[_0x3098('0x29')];}module[_0x3098('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 52b5600..d2f6a5a 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f3a=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1f3a,0x1b6));var _0xa1f3=function(_0x2c5169,_0x21fa2f){_0x2c5169=_0x2c5169-0x0;var _0x3c6d1c=_0x1f3a[_0x2c5169];return _0x3c6d1c;};'use strict';var utils=require(_0xa1f3('0x0'));function History(_0x26f0ad){this[_0xa1f3('0x1')]=_0x26f0ad[_0xa1f3('0x1')];this[_0xa1f3('0x2')]=_0x26f0ad[_0xa1f3('0x2')]||undefined;this[_0xa1f3('0x3')]=_0x26f0ad[_0xa1f3('0x3')];this[_0xa1f3('0x4')]=_0x26f0ad[_0xa1f3('0x3')]==='outbound'?_0xa1f3('0x5'):_0x26f0ad[_0xa1f3('0x3')];this[_0xa1f3('0x6')]=_0x26f0ad[_0xa1f3('0x6')];this[_0xa1f3('0x7')]=_0x26f0ad[_0xa1f3('0x7')];this[_0xa1f3('0x8')]=_0x26f0ad[_0xa1f3('0x8')];this[_0xa1f3('0x9')]=_0x26f0ad['countbusyretry']+_0x26f0ad['countcongestionretry']+_0x26f0ad[_0xa1f3('0x8')]+_0x26f0ad[_0xa1f3('0xa')]+_0x26f0ad[_0xa1f3('0xb')]+_0x26f0ad[_0xa1f3('0xc')]+_0x26f0ad[_0xa1f3('0xd')]+_0x26f0ad[_0xa1f3('0xe')];this[_0xa1f3('0xa')]=_0x26f0ad[_0xa1f3('0xa')];this[_0xa1f3('0xb')]=_0x26f0ad[_0xa1f3('0xb')];this[_0xa1f3('0xc')]=_0x26f0ad[_0xa1f3('0xc')];this['countmachineretry']=_0x26f0ad['countmachineretry'];this[_0xa1f3('0xe')]=_0x26f0ad[_0xa1f3('0xe')];this[_0xa1f3('0x5')]=_0x26f0ad['queue'];this['calleridname']=_0x26f0ad[_0xa1f3('0xf')];this['calleridnum']=_0x26f0ad[_0xa1f3('0x10')];this[_0xa1f3('0x11')]=_0x26f0ad[_0xa1f3('0x11')];this[_0xa1f3('0x12')]=_0x26f0ad[_0xa1f3('0x12')];this['endtime']=_0x26f0ad[_0xa1f3('0x12')];this[_0xa1f3('0x13')]=utils['getSeconds'](_0x26f0ad['responsetime'],_0x26f0ad[_0xa1f3('0x11')]);this[_0xa1f3('0x14')]=0x0;this[_0xa1f3('0x15')]=0x0;this[_0xa1f3('0x16')]=_0x26f0ad[_0xa1f3('0x16')];this['callbackuniqueid']=_0x26f0ad[_0xa1f3('0x17')];this['callbackat']=_0x26f0ad[_0xa1f3('0x18')];this[_0xa1f3('0x19')]=_0x26f0ad[_0xa1f3('0x19')];this[_0xa1f3('0x1a')]=_0x26f0ad[_0xa1f3('0x1a')];this[_0xa1f3('0x1b')]=_0x26f0ad[_0xa1f3('0x1b')];this[_0xa1f3('0x1c')]=_0x26f0ad[_0xa1f3('0x1c')];this[_0xa1f3('0x1d')]=_0x26f0ad[_0xa1f3('0x1d')];this[_0xa1f3('0x1e')]=_0x26f0ad[_0xa1f3('0x1e')];this[_0xa1f3('0x1f')]=_0x26f0ad[_0xa1f3('0x1f')]||'';this[_0xa1f3('0x20')]=_0x26f0ad[_0xa1f3('0x20')]||'';this[_0xa1f3('0x21')]=_0x26f0ad[_0xa1f3('0x21')];this[_0xa1f3('0x22')]=_0x26f0ad[_0xa1f3('0x22')];}module[_0xa1f3('0x23')]=History; \ No newline at end of file +var _0xef4e=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback'];(function(_0x5dfcbc,_0x1a0450){var _0xac7f09=function(_0x31e738){while(--_0x31e738){_0x5dfcbc['push'](_0x5dfcbc['shift']());}};_0xac7f09(++_0x1a0450);}(_0xef4e,0x1c9));var _0xeef4=function(_0x1649fe,_0x5916da){_0x1649fe=_0x1649fe-0x0;var _0x473a67=_0xef4e[_0x1649fe];return _0x473a67;};'use strict';var utils=require(_0xeef4('0x0'));function History(_0x5dbe2d){this[_0xeef4('0x1')]=_0x5dbe2d[_0xeef4('0x1')];this['scheduledat']=_0x5dbe2d[_0xeef4('0x2')]||undefined;this['type']=_0x5dbe2d[_0xeef4('0x3')];this['campaigntype']=_0x5dbe2d[_0xeef4('0x3')]==='outbound'?_0xeef4('0x4'):_0x5dbe2d[_0xeef4('0x3')];this['countbusyretry']=_0x5dbe2d[_0xeef4('0x5')];this[_0xeef4('0x6')]=_0x5dbe2d[_0xeef4('0x6')];this['countnoanswerretry']=_0x5dbe2d[_0xeef4('0x7')];this[_0xeef4('0x8')]=_0x5dbe2d[_0xeef4('0x5')]+_0x5dbe2d['countcongestionretry']+_0x5dbe2d['countnoanswerretry']+_0x5dbe2d[_0xeef4('0x9')]+_0x5dbe2d['countdropretry']+_0x5dbe2d[_0xeef4('0xa')]+_0x5dbe2d['countmachineretry']+_0x5dbe2d[_0xeef4('0xb')];this[_0xeef4('0x9')]=_0x5dbe2d[_0xeef4('0x9')];this['countdropretry']=_0x5dbe2d[_0xeef4('0xc')];this['countabandonedretry']=_0x5dbe2d[_0xeef4('0xa')];this[_0xeef4('0xd')]=_0x5dbe2d['countmachineretry'];this[_0xeef4('0xb')]=_0x5dbe2d[_0xeef4('0xb')];this[_0xeef4('0x4')]=_0x5dbe2d[_0xeef4('0x4')];this[_0xeef4('0xe')]=_0x5dbe2d[_0xeef4('0xf')];this[_0xeef4('0x10')]=_0x5dbe2d[_0xeef4('0x11')];this[_0xeef4('0x12')]=_0x5dbe2d[_0xeef4('0x12')];this[_0xeef4('0x13')]=_0x5dbe2d['responsetime'];this[_0xeef4('0x14')]=_0x5dbe2d[_0xeef4('0x13')];this[_0xeef4('0x15')]=utils['getSeconds'](_0x5dbe2d[_0xeef4('0x13')],_0x5dbe2d['starttime']);this['holdtime']=0x0;this[_0xeef4('0x16')]=0x0;this['callback']=_0x5dbe2d[_0xeef4('0x17')];this[_0xeef4('0x18')]=_0x5dbe2d[_0xeef4('0x18')];this[_0xeef4('0x19')]=_0x5dbe2d['callbackat'];this[_0xeef4('0x1a')]=_0x5dbe2d[_0xeef4('0x1a')];this['ContactId']=_0x5dbe2d[_0xeef4('0x1b')];this[_0xeef4('0x1c')]=_0x5dbe2d[_0xeef4('0x1c')];this['UserId']=_0x5dbe2d[_0xeef4('0x1d')];this[_0xeef4('0x1e')]=_0x5dbe2d['VoiceQueueId'];this[_0xeef4('0x1f')]=_0x5dbe2d[_0xeef4('0x1f')];this['originatecalleridnum']=_0x5dbe2d[_0xeef4('0x20')]||'';this[_0xeef4('0x21')]=_0x5dbe2d[_0xeef4('0x21')]||'';this[_0xeef4('0x22')]=_0x5dbe2d[_0xeef4('0x22')];this[_0xeef4('0x23')]=_0x5dbe2d[_0xeef4('0x23')];}module[_0xeef4('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 9ef935f..53eb94b 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72ff=['calleridname','name','calleridnum','number','droptime','dropreason','endtime','getSeconds','responsetime','starttime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid'];(function(_0x3c106d,_0x30d6eb){var _0x1a55bf=function(_0x4a2a8b){while(--_0x4a2a8b){_0x3c106d['push'](_0x3c106d['shift']());}};_0x1a55bf(++_0x30d6eb);}(_0x72ff,0x1d6));var _0xf72f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x72ff[_0x397e5f];return _0x5302b8;};'use strict';var utils=require(_0xf72f('0x0'));function QueueCallerAbandon(_0x25c185,_0x49cc1d){this[_0xf72f('0x1')]=_0x25c185['scheduledat'];this[_0xf72f('0x2')]=_0x25c185['type'];this[_0xf72f('0x3')]=_0x25c185[_0xf72f('0x2')]===_0xf72f('0x4')?'queue':_0x25c185[_0xf72f('0x2')];this['countbusyretry']=_0x25c185[_0xf72f('0x5')];this[_0xf72f('0x6')]=_0x25c185[_0xf72f('0x6')];this[_0xf72f('0x7')]=_0x25c185[_0xf72f('0x7')];this['countglobal']=_0x25c185[_0xf72f('0x5')]+_0x25c185[_0xf72f('0x6')]+_0x25c185[_0xf72f('0x7')]+_0x25c185[_0xf72f('0x8')]+_0x25c185['countdropretry']+_0x25c185[_0xf72f('0x9')]+_0x25c185[_0xf72f('0xa')]+_0x25c185[_0xf72f('0xb')];this[_0xf72f('0x8')]=_0x25c185[_0xf72f('0x8')];this[_0xf72f('0xc')]=_0x25c185[_0xf72f('0xc')];this[_0xf72f('0x9')]=_0x25c185['countabandonedretry'];this['countmachineretry']=_0x25c185[_0xf72f('0xa')];this[_0xf72f('0xb')]=_0x25c185[_0xf72f('0xb')];this[_0xf72f('0xd')]=_0x49cc1d[_0xf72f('0xd')];this[_0xf72f('0xe')]=_0x25c185[_0xf72f('0xf')];this[_0xf72f('0x10')]=_0x25c185[_0xf72f('0x11')];this['starttime']=_0x25c185['starttime'];this['responsetime']=_0x25c185['responsetime'];this[_0xf72f('0x12')]=_0x25c185['droptime'];this[_0xf72f('0x13')]=_0x25c185['dropreason'];this[_0xf72f('0x14')]=this['droptime'];this['ringtime']=utils[_0xf72f('0x15')](_0x25c185[_0xf72f('0x16')],_0x25c185[_0xf72f('0x17')]);this[_0xf72f('0x18')]=utils[_0xf72f('0x15')](this['droptime'],_0x25c185[_0xf72f('0x16')]);this[_0xf72f('0x19')]=0x0;this[_0xf72f('0x1a')]=_0x49cc1d['queue'];this[_0xf72f('0x1b')]=_0x49cc1d[_0xf72f('0x1c')];this['reason']=_0x49cc1d[_0xf72f('0x1d')];this[_0xf72f('0x1e')]=_0x25c185['callback'];this[_0xf72f('0x1f')]=_0x25c185[_0xf72f('0x1f')];this[_0xf72f('0x20')]=_0x25c185[_0xf72f('0x20')];this[_0xf72f('0x21')]=_0x25c185[_0xf72f('0x21')];this['ContactId']=_0x25c185[_0xf72f('0x22')];this[_0xf72f('0x23')]=_0x25c185[_0xf72f('0x23')];this['UserId']=_0x25c185[_0xf72f('0x24')];this['VoiceQueueId']=_0x25c185['VoiceQueueId'];this['CampaignId']=_0x25c185[_0xf72f('0x25')];this[_0xf72f('0x26')]=_0x25c185['originatecalleridnum']||'';this['originatecalleridname']=_0x25c185[_0xf72f('0x27')]||'';this[_0xf72f('0x28')]=_0x25c185[_0xf72f('0x28')];this[_0xf72f('0x29')]=_0x25c185[_0xf72f('0x29')];this[_0xf72f('0x2a')]=_0x25c185[_0xf72f('0x2a')];}module[_0xf72f('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xbde4=['number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum'];(function(_0x2a140a,_0x3abf27){var _0x4269c1=function(_0x59268c){while(--_0x59268c){_0x2a140a['push'](_0x2a140a['shift']());}};_0x4269c1(++_0x3abf27);}(_0xbde4,0x180));var _0x4bde=function(_0x150e00,_0xe5b370){_0x150e00=_0x150e00-0x0;var _0x149128=_0xbde4[_0x150e00];return _0x149128;};'use strict';var utils=require(_0x4bde('0x0'));function QueueCallerAbandon(_0x4565eb,_0x376cc4){this[_0x4bde('0x1')]=_0x4565eb[_0x4bde('0x1')];this['type']=_0x4565eb['type'];this[_0x4bde('0x2')]=_0x4565eb[_0x4bde('0x3')]===_0x4bde('0x4')?_0x4bde('0x5'):_0x4565eb[_0x4bde('0x3')];this[_0x4bde('0x6')]=_0x4565eb[_0x4bde('0x6')];this[_0x4bde('0x7')]=_0x4565eb[_0x4bde('0x7')];this[_0x4bde('0x8')]=_0x4565eb[_0x4bde('0x8')];this['countglobal']=_0x4565eb[_0x4bde('0x6')]+_0x4565eb[_0x4bde('0x7')]+_0x4565eb[_0x4bde('0x8')]+_0x4565eb[_0x4bde('0x9')]+_0x4565eb[_0x4bde('0xa')]+_0x4565eb[_0x4bde('0xb')]+_0x4565eb[_0x4bde('0xc')]+_0x4565eb[_0x4bde('0xd')];this[_0x4bde('0x9')]=_0x4565eb[_0x4bde('0x9')];this['countdropretry']=_0x4565eb[_0x4bde('0xa')];this[_0x4bde('0xb')]=_0x4565eb[_0x4bde('0xb')];this[_0x4bde('0xc')]=_0x4565eb[_0x4bde('0xc')];this[_0x4bde('0xd')]=_0x4565eb['countagentrejectretry'];this[_0x4bde('0xe')]=_0x376cc4[_0x4bde('0xe')];this['calleridname']=_0x4565eb['name'];this[_0x4bde('0xf')]=_0x4565eb[_0x4bde('0x10')];this[_0x4bde('0x11')]=_0x4565eb[_0x4bde('0x11')];this[_0x4bde('0x12')]=_0x4565eb[_0x4bde('0x12')];this[_0x4bde('0x13')]=_0x4565eb['droptime'];this['dropreason']=_0x4565eb[_0x4bde('0x14')];this[_0x4bde('0x15')]=this[_0x4bde('0x13')];this['ringtime']=utils[_0x4bde('0x16')](_0x4565eb[_0x4bde('0x12')],_0x4565eb[_0x4bde('0x11')]);this[_0x4bde('0x17')]=utils['getSeconds'](this[_0x4bde('0x13')],_0x4565eb['responsetime']);this[_0x4bde('0x18')]=0x0;this[_0x4bde('0x5')]=_0x376cc4[_0x4bde('0x5')];this['membername']=_0x376cc4['connectedlinename'];this['reason']=_0x376cc4['reason'];this['callback']=_0x4565eb[_0x4bde('0x19')];this[_0x4bde('0x1a')]=_0x4565eb[_0x4bde('0x1a')];this[_0x4bde('0x1b')]=_0x4565eb[_0x4bde('0x1b')];this[_0x4bde('0x1c')]=_0x4565eb[_0x4bde('0x1c')];this[_0x4bde('0x1d')]=_0x4565eb['ContactId'];this[_0x4bde('0x1e')]=_0x4565eb[_0x4bde('0x1e')];this[_0x4bde('0x1f')]=_0x4565eb[_0x4bde('0x1f')];this[_0x4bde('0x20')]=_0x4565eb['VoiceQueueId'];this[_0x4bde('0x21')]=_0x4565eb[_0x4bde('0x21')];this[_0x4bde('0x22')]=_0x4565eb['originatecalleridnum']||'';this[_0x4bde('0x23')]=_0x4565eb[_0x4bde('0x23')]||'';this[_0x4bde('0x24')]=_0x4565eb[_0x4bde('0x24')];this[_0x4bde('0x25')]=_0x4565eb[_0x4bde('0x25')];this[_0x4bde('0x26')]=_0x4565eb[_0x4bde('0x26')];}module[_0x4bde('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 2e35520..24bdd91 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','error','[countReScheduled]','countReScheduled','[rescheduleContact]','unlockContact','moveContactManagedDialer'];(function(_0x1e4b38,_0x40c704){var _0x1c1126=function(_0x1edc4b){while(--_0x1edc4b){_0x1e4b38['push'](_0x1e4b38['shift']());}};_0x1c1126(++_0x40c704);}(_0x1883,0xab));var _0x3188=function(_0x124788,_0x360346){_0x124788=_0x124788-0x0;var _0x2f1a42=_0x1883[_0x124788];return _0x2f1a42;};'use strict';var util=require(_0x3188('0x0'));var logger=require(_0x3188('0x1'))(_0x3188('0x2'));var cmHopper=require(_0x3188('0x3'));var cmHopperAdditionalPhone=require(_0x3188('0x4'));var cmHopperBlack=require(_0x3188('0x5'));var cmHopperHistory=require(_0x3188('0x6'));function inspectError(_0x408500){return util[_0x3188('0x7')](_0x408500,{'showHidden':![],'depth':null});}function getContactDialer(_0x44afb8,_0x46216d,_0x345612){return cmHopper[_0x3188('0x8')](_0x44afb8['id'],_0x46216d,_0x345612,_0x44afb8[_0x3188('0x9')])[_0x3188('0xa')](function(_0x3ce7fd){_0x44afb8[_0x3188('0xb')]=0x0;logger['error'](_0x3188('0xc'),inspectError(_0x3ce7fd));});}exports[_0x3188('0x8')]=getContactDialer;function getContactDialerIvr(_0x53f5c0,_0x2213b5){return cmHopper['getContactDialerIvr'](_0x53f5c0['id'],_0x2213b5,_0x53f5c0[_0x3188('0x9')])[_0x3188('0xa')](function(_0x209e31){_0x53f5c0[_0x3188('0xb')]=0x0;logger['error'](_0x3188('0xd'),inspectError(_0x209e31));});}exports[_0x3188('0xe')]=getContactDialerIvr;function countReScheduled(_0x4dcadb){return cmHopper['countReScheduled'](_0x4dcadb)[_0x3188('0xa')](function(_0x45e94e){logger[_0x3188('0xf')](_0x3188('0x10'),inspectError(_0x45e94e));});}exports[_0x3188('0x11')]=countReScheduled;function rescheduleContact(_0xc01ce6){return cmHopper['rescheduleContact'](_0xc01ce6)[_0x3188('0xa')](function(_0x5e0044){logger['error'](_0x3188('0x12'),inspectError(_0x5e0044));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x54a87f,_0x32c239,_0x1beead){return cmHopper[_0x3188('0x13')](_0x54a87f,_0x32c239,_0x1beead)[_0x3188('0xa')](function(_0x145293){logger[_0x3188('0xf')]('[unlockContact]',inspectError(_0x145293));});}exports[_0x3188('0x13')]=unlockContact;function moveContactManagedDialer(_0x1c3598){return cmHopper[_0x3188('0x14')](_0x1c3598)[_0x3188('0xa')](function(_0x18a71a){logger[_0x3188('0xf')](_0x3188('0x15'),inspectError(_0x18a71a));});}exports[_0x3188('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x5bcbba){return cmHopperBlack[_0x3188('0x16')](_0x5bcbba)[_0x3188('0xa')](function(_0x5512f4){logger['error']('[checkIsBlackList]',inspectError(_0x5512f4));});}exports[_0x3188('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x8b207){return cmHopperBlack[_0x3188('0x17')](_0x8b207)['catch'](function(_0x48673c){logger[_0x3188('0xf')](_0x3188('0x18'),inspectError(_0x48673c));});}exports[_0x3188('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xaf6a8e,_0xb61717,_0x4bd5ee){return cmHopperAdditionalPhone[_0x3188('0x19')](_0xaf6a8e,_0xb61717,_0x4bd5ee)[_0x3188('0xa')](function(_0x5a2e67){logger[_0x3188('0xf')]('[verifyAdditionalPhone]',inspectError(_0x5a2e67));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x45ae2f,_0x129bd7,_0x87d5a3){return cmHopperAdditionalPhone[_0x3188('0x1a')](_0x45ae2f,_0x129bd7,_0x87d5a3)[_0x3188('0xa')](function(_0x2cd060){logger[_0x3188('0xf')](_0x3188('0x1b'),inspectError(_0x2cd060));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x2cc5d9){return cmHopperHistory[_0x3188('0x1c')](_0x2cc5d9)['catch'](function(_0xd3ee40){logger[_0x3188('0xf')](_0x3188('0x1d'),inspectError(_0xd3ee40));});}exports[_0x3188('0x1c')]=avgHandleTime;function createHistory(_0x20e6aa){return cmHopperHistory[_0x3188('0x1e')](_0x20e6aa)[_0x3188('0xa')](function(_0x472926){logger['error'](_0x3188('0x1f'),inspectError(_0x472926));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xc1c6=['verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','temp','error','[getContactDialer]','catch','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]'];(function(_0x5b4921,_0x42d7c6){var _0x326018=function(_0x1e78cd){while(--_0x1e78cd){_0x5b4921['push'](_0x5b4921['shift']());}};_0x326018(++_0x42d7c6);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x23d72a,_0x1d31f2){_0x23d72a=_0x23d72a-0x0;var _0x49dc21=_0xc1c6[_0x23d72a];return _0x49dc21;};'use strict';var util=require(_0x6c1c('0x0'));var logger=require(_0x6c1c('0x1'))(_0x6c1c('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x6c1c('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x6c1c('0x4'));function inspectError(_0x40ff59){return util[_0x6c1c('0x5')](_0x40ff59,{'showHidden':![],'depth':null});}function getContactDialer(_0x59f799,_0x56ed6f,_0x32af84){return cmHopper['getContactDialer'](_0x59f799['id'],_0x56ed6f,_0x32af84,_0x59f799[_0x6c1c('0x6')])['catch'](function(_0xe510ca){_0x59f799[_0x6c1c('0x7')]=0x0;logger[_0x6c1c('0x8')](_0x6c1c('0x9'),inspectError(_0xe510ca));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x35f9ab,_0x3ca985){return cmHopper['getContactDialerIvr'](_0x35f9ab['id'],_0x3ca985,_0x35f9ab[_0x6c1c('0x6')])[_0x6c1c('0xa')](function(_0xb3bd12){_0x35f9ab[_0x6c1c('0x7')]=0x0;logger['error'](_0x6c1c('0xb'),inspectError(_0xb3bd12));});}exports[_0x6c1c('0xc')]=getContactDialerIvr;function countReScheduled(_0x40cebf){return cmHopper['countReScheduled'](_0x40cebf)[_0x6c1c('0xa')](function(_0x12a9e6){logger[_0x6c1c('0x8')]('[countReScheduled]',inspectError(_0x12a9e6));});}exports[_0x6c1c('0xd')]=countReScheduled;function rescheduleContact(_0x5e64b7){return cmHopper[_0x6c1c('0xe')](_0x5e64b7)[_0x6c1c('0xa')](function(_0x2d279e){logger[_0x6c1c('0x8')](_0x6c1c('0xf'),inspectError(_0x2d279e));});}exports[_0x6c1c('0xe')]=rescheduleContact;function unlockContact(_0x297c33,_0x41aa74,_0x448f35){return cmHopper['unlockContact'](_0x297c33,_0x41aa74,_0x448f35)[_0x6c1c('0xa')](function(_0x174657){logger['error'](_0x6c1c('0x10'),inspectError(_0x174657));});}exports[_0x6c1c('0x11')]=unlockContact;function moveContactManagedDialer(_0x494ffc){return cmHopper[_0x6c1c('0x12')](_0x494ffc)['catch'](function(_0x338dc2){logger[_0x6c1c('0x8')]('[moveContactManagedDialer]',inspectError(_0x338dc2));});}exports[_0x6c1c('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x59ab38){return cmHopperBlack[_0x6c1c('0x13')](_0x59ab38)[_0x6c1c('0xa')](function(_0x23470e){logger[_0x6c1c('0x8')](_0x6c1c('0x14'),inspectError(_0x23470e));});}exports[_0x6c1c('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1993c5){return cmHopperBlack[_0x6c1c('0x15')](_0x1993c5)[_0x6c1c('0xa')](function(_0x19f4af){logger[_0x6c1c('0x8')](_0x6c1c('0x16'),inspectError(_0x19f4af));});}exports[_0x6c1c('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x9c6c55,_0x31fed2,_0x19c269){return cmHopperAdditionalPhone[_0x6c1c('0x17')](_0x9c6c55,_0x31fed2,_0x19c269)[_0x6c1c('0xa')](function(_0x3a3f13){logger[_0x6c1c('0x8')](_0x6c1c('0x18'),inspectError(_0x3a3f13));});}exports[_0x6c1c('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2ef382,_0x7ff10d,_0x18452d){return cmHopperAdditionalPhone[_0x6c1c('0x19')](_0x2ef382,_0x7ff10d,_0x18452d)[_0x6c1c('0xa')](function(_0x1b9d7d){logger[_0x6c1c('0x8')]('[swapAdditionalPhone]',inspectError(_0x1b9d7d));});}exports[_0x6c1c('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x4d73aa){return cmHopperHistory[_0x6c1c('0x1a')](_0x4d73aa)['catch'](function(_0xcd3179){logger['error'](_0x6c1c('0x1b'),inspectError(_0xcd3179));});}exports[_0x6c1c('0x1a')]=avgHandleTime;function createHistory(_0x504348){return cmHopperHistory[_0x6c1c('0x1c')](_0x504348)[_0x6c1c('0xa')](function(_0x4e13e3){logger[_0x6c1c('0x8')](_0x6c1c('0x1d'),inspectError(_0x4e13e3));});}exports[_0x6c1c('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b3b933c..7098bcd 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8b3=['checkContactEmpty','erlangb','tags','updatedAt','undefined','XMD-','toUpperCase','moment','util','../../../../config/logger','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length'];(function(_0x35414b,_0xf9f5d3){var _0xa5b3a=function(_0x3a2faf){while(--_0x3a2faf){_0x35414b['push'](_0x35414b['shift']());}};_0xa5b3a(++_0xf9f5d3);}(_0xa8b3,0x188));var _0x3a8b=function(_0x168289,_0xd1e311){_0x168289=_0x168289-0x0;var _0x4a169d=_0xa8b3[_0x168289];return _0x4a169d;};'use strict';var _=require('lodash');var moment=require(_0x3a8b('0x0'));var util=require(_0x3a8b('0x1'));var logger=require(_0x3a8b('0x2'))('dialer');var timezones=require(_0x3a8b('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x3a8b('0x4'),'CONTACTS_RESCHEDULED':_0x3a8b('0x5'),'DEACTIVATED':_0x3a8b('0x6'),'DISACTIVED':_0x3a8b('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x3a8b('0x8'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x3a8b('0x9'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x3a8b('0xa'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x3a8b('0xb'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x3a8b('0xc')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2b6484){return _0x2b6484[_0x3a8b('0xd')]==='preview';}exports[_0x3a8b('0xe')]=isPreviewCampaign;function isIVRCampaign(_0x4ec67f){return _0x4ec67f[_0x3a8b('0xf')]===_0x3a8b('0x10');}exports[_0x3a8b('0x11')]=isIVRCampaign;function isOutboundQueue(_0xcaeba5){return _0xcaeba5[_0x3a8b('0xf')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x2bcff8){return _0x2bcff8['dialActive'];}exports[_0x3a8b('0x12')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1ba68a){return _0x1ba68a[_0x3a8b('0x13')];}exports[_0x3a8b('0x14')]=isIVRCampaignActive;function getSeconds(_0x563160,_0x4fcd2d){var _0x51d22a=moment(_0x563160)[_0x3a8b('0x15')](0x0);var _0x1791e7=moment(_0x4fcd2d)[_0x3a8b('0x15')](0x0);return _0x51d22a[_0x3a8b('0x16')](_0x1791e7,'seconds');}exports[_0x3a8b('0x17')]=getSeconds;function hasQueueCampaignDataChanged(_0x3b1e97,_0x307429){var _0x4db9c4=![];var _0x523c40=_0x3b1e97[_0x3a8b('0xd')]!==_0x307429['dialMethod']||_0x3b1e97['dialActive']!==_0x307429['dialActive']||_0x3b1e97['message']!==_0x307429[_0x3a8b('0x18')];var _0x35e3a4=_0x3b1e97[_0x3a8b('0x19')]!==_0x307429[_0x3a8b('0x19')]||_0x3b1e97[_0x3a8b('0x1a')]!==_0x307429[_0x3a8b('0x1a')]||_0x3b1e97['loggedInDb']!==_0x307429[_0x3a8b('0x1b')]||_0x3b1e97[_0x3a8b('0x1c')]!==_0x307429[_0x3a8b('0x1c')]||_0x3b1e97[_0x3a8b('0x1d')]!==_0x307429['talking']||_0x3b1e97[_0x3a8b('0x1e')]!==_0x307429[_0x3a8b('0x1e')]||_0x3b1e97[_0x3a8b('0x1f')]!==_0x307429[_0x3a8b('0x1f')]||_0x3b1e97[_0x3a8b('0x20')]!==_0x307429[_0x3a8b('0x20')]||_0x3b1e97['originated']!==_0x307429[_0x3a8b('0x21')];if(_0x3b1e97[_0x3a8b('0x22')]&&_0x307429[_0x3a8b('0x22')]){_0x4db9c4=_0x3b1e97['Trunk'][_0x3a8b('0x23')]!==_0x307429['Trunk'][_0x3a8b('0x23')]||_0x3b1e97[_0x3a8b('0x22')][_0x3a8b('0x13')]!==_0x307429['Trunk'][_0x3a8b('0x13')];}return _0x523c40||_0x35e3a4||_0x4db9c4;}exports[_0x3a8b('0x24')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x40c328){var _0x6c4081=null;var _0xbe70cf=_0x40c328[_0x3a8b('0x25')];if(_[_0x3a8b('0x26')](_0x40c328[_0x3a8b('0x27')])||_['isNil'](_0x40c328[_0x3a8b('0x28')])||_[_0x3a8b('0x26')](_0x40c328[_0x3a8b('0x28')][_0x3a8b('0x29')])){_0x6c4081=CAMPAIGN_STATUS[_0x3a8b('0x2a')];}else if(_['isEmpty'](_0x40c328[_0x3a8b('0x27')])||_[_0x3a8b('0x2b')](_0x40c328[_0x3a8b('0x28')][_0x3a8b('0x29')])){_0x6c4081=CAMPAIGN_STATUS[_0x3a8b('0x2c')];}else if(_0xbe70cf&&!timezones[_0xbe70cf]){_0x6c4081=CAMPAIGN_STATUS[_0x3a8b('0x2d')];}return _0x6c4081;}function checkAnyValidTrunk(_0x42d4c0,_0x3e5cca){var _0x16f3e0=null;var _0x52d360=_0x3a8b('0x2e');var _0x30721a=[_0x3a8b('0x2f'),'unmonitored'];var _0x3e1905=!![];if(_0x42d4c0[_0x3a8b('0x22')]&&_0x42d4c0[_0x3a8b('0x22')]['active']){_0x52d360+=_0x42d4c0[_0x3a8b('0x22')][_0x3a8b('0x23')];_0x16f3e0=_0x3e5cca[_0x52d360];_0x3e1905=_0x30721a[_0x3a8b('0x30')](_0x16f3e0['status']);}else if(_0x42d4c0[_0x3a8b('0x31')]&&_0x42d4c0['TrunkBackup'][_0x3a8b('0x13')]){_0x52d360+=_0x42d4c0[_0x3a8b('0x31')][_0x3a8b('0x23')];_0x16f3e0=_0x3e5cca[_0x52d360];_0x3e1905=_0x30721a[_0x3a8b('0x30')](_0x16f3e0[_0x3a8b('0x32')]);}return _0x3e1905;}function getQueueCampaignStatusMessage(_0x5db978,_0x4b9b21){var _0xde53d3=CAMPAIGN_STATUS['ACTIVE'];var _0x1a27da=isPreviewCampaign(_0x5db978);if(!isQueueCampaignActive(_0x5db978)){if(_0x1a27da){_0xde53d3=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5db978['originated']===0x0&&_0x5db978['talking']===0x0&&_0x5db978[_0x3a8b('0x1f')]===0x0&&(_0x5db978[_0x3a8b('0x1e')]||0x0)===0x0){_0xde53d3=CAMPAIGN_STATUS[_0x3a8b('0x33')];}else{_0xde53d3=CAMPAIGN_STATUS[_0x3a8b('0x34')];}}}else if(_0x5db978[_0x3a8b('0x1a')]===0x0){_0xde53d3=CAMPAIGN_STATUS[_0x3a8b('0x35')];}else if(!checkAnyValidTrunk(_0x5db978,_0x4b9b21)){_0xde53d3=CAMPAIGN_STATUS[_0x3a8b('0x36')];}else if(!isPreviewCampaign(_0x5db978)){var _0x2bb046=checkAnyValidQueueCampaignInterval(_0x5db978);if(_0x2bb046){_0xde53d3=_0x2bb046;}}return _0xde53d3;}exports[_0x3a8b('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x520521){var _0x1acd40=CAMPAIGN_STATUS[_0x3a8b('0x34')];if(_0x520521[_0x3a8b('0x21')]===0x0&&_0x520521[_0x3a8b('0x1d')]===0x0&&_0x520521['waiting']===0x0&&(_0x520521[_0x3a8b('0x1e')]||0x0)===0x0){_0x1acd40=CAMPAIGN_STATUS[_0x3a8b('0x33')];}return _0x1acd40;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x26f3e8){var _0x4b784f=_0x26f3e8[_0x3a8b('0x38')](/"(.*?)"/);return _0x4b784f?_0x4b784f[0x1]:_0x26f3e8;}exports[_0x3a8b('0x39')]=extractCalleridName;function getCallerId(_0x2a13a0,_0x2b169c,_0x251b36){if(!_['isUndefined'](_0x251b36)&&typeof _0x251b36===_0x3a8b('0x3a')&&!_[_0x3a8b('0x2b')](_0x251b36)){if(!_[_0x3a8b('0x3b')](_0x2b169c)&&typeof _0x2b169c===_0x3a8b('0x3a')&&!_['isEmpty'](_0x2b169c)){return util[_0x3a8b('0x3c')](_0x3a8b('0x3d'),_0x2b169c,_0x251b36);}return util['format']('\x22%s\x22\x20<%s>',_0x251b36,_0x251b36);}if(!_[_0x3a8b('0x3b')](_0x2a13a0)&&typeof _0x2a13a0===_0x3a8b('0x3a')&&!_['isEmpty'](_0x2a13a0)){return _0x2a13a0;}return _0x3a8b('0x3e');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x28c60b,_0x44259b){var _0xc8befd;var _0x3e4cb7;var _0x3a77f5;if(_0x44259b<=0x0){_0x44259b=0x1;}_0xc8befd=new RegExp(_0x3a8b('0x3f')+_0x44259b+'}$');_0x3e4cb7=Math[_0x3a8b('0x40')](0xa,_0x44259b-0x1);_0x3a77f5=Math[_0x3a8b('0x40')](0xa,_0x44259b)-0x1;return util[_0x3a8b('0x3c')]('%s',_['replace'](_0x28c60b,_0xc8befd,_['random'](_0x3e4cb7,_0x3a77f5)[_0x3a8b('0x41')]()));}exports[_0x3a8b('0x42')]=getCallerIdRandom;function decrementOriginate(_0x9ba7c0){if(_0x9ba7c0[_0x3a8b('0x21')]&&_0x9ba7c0[_0x3a8b('0x21')]>0x0){_0x9ba7c0[_0x3a8b('0x21')]-=0x1;}else{logger[_0x3a8b('0x43')](_0x3a8b('0x44'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x3cb9cc){return _0x3cb9cc&&_0x3cb9cc[_0x3a8b('0x45')]>0x0;}exports[_0x3a8b('0x46')]=checkContactEmpty;function erlangb(_0x5b3c71,_0x32ce1a){if(_0x32ce1a===0x0){return 0x0;}var _0x580f9c=0x1;for(var _0x268100=0x1;_0x268100<=_0x32ce1a;_0x268100+=0x1){_0x580f9c=0x1+_0x580f9c*_0x268100/_0x5b3c71;}return 0x1/_0x580f9c;}exports[_0x3a8b('0x47')]=erlangb;function checkContactLowerLimitOriginate(_0x48fecd,_0x5333c3,_0x38dde7){if(_0x5333c3>_0x38dde7){for(var _0x550eee=0x0;_0x550eee<_0x5333c3-_0x38dde7;_0x550eee+=0x1){decrementOriginate(_0x48fecd);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x46e156){var _0x290e8c={};var _0x2201a3=['id','createdAt','description',_0x3a8b('0x48'),_0x3a8b('0x49')];if(_0x46e156){for(var _0x267d1f in _0x46e156){if(typeof _0x46e156[_0x267d1f]!==_0x3a8b('0x4a')){if(!_[_0x3a8b('0x26')](_0x46e156[_0x267d1f])&&!_0x2201a3['includes'](_0x267d1f)){_0x290e8c[util[_0x3a8b('0x3c')]('%s%s',_0x3a8b('0x4b'),_0x267d1f[_0x3a8b('0x4c')]())]=_0x46e156[_0x267d1f];}}}}return _0x290e8c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x96c1=['XMD-','toUpperCase','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','NULL_INTERVAL','isEmpty','dialGlobalInterval','Interval','Intervals','UNKNOWN_TIMEZONE','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','waiting','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','createdAt','description','tags','updatedAt','undefined','%s%s'];(function(_0x136bbf,_0x35fa43){var _0x1b0c30=function(_0x1ca554){while(--_0x1ca554){_0x136bbf['push'](_0x136bbf['shift']());}};_0x1b0c30(++_0x35fa43);}(_0x96c1,0x156));var _0x196c=function(_0x10d2f0,_0x38bf36){_0x10d2f0=_0x10d2f0-0x0;var _0x3fc66e=_0x96c1[_0x10d2f0];return _0x3fc66e;};'use strict';var _=require(_0x196c('0x0'));var moment=require(_0x196c('0x1'));var util=require('util');var logger=require(_0x196c('0x2'))(_0x196c('0x3'));var timezones=require(_0x196c('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x196c('0x5'),'BLACKLIST':_0x196c('0x6'),'CONTACTS_RESCHEDULED':_0x196c('0x7'),'DEACTIVATED':_0x196c('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x196c('0x9'),'INACTIVE':_0x196c('0xa'),'NO_AGENTS_LOGGED':_0x196c('0xb'),'NO_AVAILABLE_CONTACTS':_0x196c('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x196c('0xd'),'QUEUE_RECALL':_0x196c('0xe'),'RECALL_TIMEOUT':_0x196c('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x196c('0x10'),'UNREACHABLE_TRUNK':_0x196c('0x11')};exports[_0x196c('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x23c5cf){return _0x23c5cf[_0x196c('0x13')]===_0x196c('0x14');}exports[_0x196c('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x4ba5f3){return _0x4ba5f3[_0x196c('0x16')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x36e036){return _0x36e036[_0x196c('0x16')]===_0x196c('0x17');}exports[_0x196c('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x2fa2b4){return _0x2fa2b4[_0x196c('0x19')];}exports[_0x196c('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x58446c){return _0x58446c[_0x196c('0x1b')];}exports[_0x196c('0x1c')]=isIVRCampaignActive;function getSeconds(_0xfd7ecb,_0x5e065e){var _0x2f57e2=moment(_0xfd7ecb)[_0x196c('0x1d')](0x0);var _0x371ed0=moment(_0x5e065e)[_0x196c('0x1d')](0x0);return _0x2f57e2['diff'](_0x371ed0,_0x196c('0x1e'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4d7d0a,_0x25ca63){var _0x475d5a=![];var _0x289f2c=_0x4d7d0a[_0x196c('0x13')]!==_0x25ca63[_0x196c('0x13')]||_0x4d7d0a[_0x196c('0x19')]!==_0x25ca63[_0x196c('0x19')]||_0x4d7d0a[_0x196c('0x1f')]!==_0x25ca63[_0x196c('0x1f')];var _0x3d7880=_0x4d7d0a[_0x196c('0x20')]!==_0x25ca63[_0x196c('0x20')]||_0x4d7d0a['loggedIn']!==_0x25ca63[_0x196c('0x21')]||_0x4d7d0a['loggedInDb']!==_0x25ca63[_0x196c('0x22')]||_0x4d7d0a[_0x196c('0x23')]!==_0x25ca63[_0x196c('0x23')]||_0x4d7d0a[_0x196c('0x24')]!==_0x25ca63[_0x196c('0x24')]||_0x4d7d0a['pTalking']!==_0x25ca63[_0x196c('0x25')]||_0x4d7d0a['waiting']!==_0x25ca63['waiting']||_0x4d7d0a[_0x196c('0x26')]!==_0x25ca63[_0x196c('0x26')]||_0x4d7d0a[_0x196c('0x27')]!==_0x25ca63[_0x196c('0x27')];if(_0x4d7d0a[_0x196c('0x28')]&&_0x25ca63[_0x196c('0x28')]){_0x475d5a=_0x4d7d0a[_0x196c('0x28')][_0x196c('0x29')]!==_0x25ca63[_0x196c('0x28')][_0x196c('0x29')]||_0x4d7d0a[_0x196c('0x28')][_0x196c('0x1b')]!==_0x25ca63[_0x196c('0x28')][_0x196c('0x1b')];}return _0x289f2c||_0x3d7880||_0x475d5a;}exports[_0x196c('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x36d2a4){var _0x5a7e25=null;var _0x45ae43=_0x36d2a4[_0x196c('0x2b')];if(_[_0x196c('0x2c')](_0x36d2a4['dialGlobalInterval'])||_[_0x196c('0x2c')](_0x36d2a4['Interval'])||_[_0x196c('0x2c')](_0x36d2a4['Interval']['Intervals'])){_0x5a7e25=CAMPAIGN_STATUS[_0x196c('0x2d')];}else if(_[_0x196c('0x2e')](_0x36d2a4[_0x196c('0x2f')])||_[_0x196c('0x2e')](_0x36d2a4[_0x196c('0x30')][_0x196c('0x31')])){_0x5a7e25=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x45ae43&&!timezones[_0x45ae43]){_0x5a7e25=CAMPAIGN_STATUS[_0x196c('0x32')];}return _0x5a7e25;}function checkAnyValidTrunk(_0x11a4b2,_0x21a12b){var _0x14dacf=null;var _0x51fc55='SIP/';var _0x1d1b95=['reachable','unmonitored'];var _0x385dd4=!![];if(_0x11a4b2[_0x196c('0x28')]&&_0x11a4b2[_0x196c('0x28')][_0x196c('0x1b')]){_0x51fc55+=_0x11a4b2[_0x196c('0x28')][_0x196c('0x29')];_0x14dacf=_0x21a12b[_0x51fc55];_0x385dd4=_0x1d1b95[_0x196c('0x33')](_0x14dacf[_0x196c('0x34')]);}else if(_0x11a4b2['TrunkBackup']&&_0x11a4b2[_0x196c('0x35')][_0x196c('0x1b')]){_0x51fc55+=_0x11a4b2['TrunkBackup'][_0x196c('0x29')];_0x14dacf=_0x21a12b[_0x51fc55];_0x385dd4=_0x1d1b95['includes'](_0x14dacf[_0x196c('0x34')]);}return _0x385dd4;}function getQueueCampaignStatusMessage(_0x4eee45,_0xd4e4b3){var _0x23f937=CAMPAIGN_STATUS[_0x196c('0x5')];var _0x1ff9e0=isPreviewCampaign(_0x4eee45);if(!isQueueCampaignActive(_0x4eee45)){if(_0x1ff9e0){_0x23f937=CAMPAIGN_STATUS[_0x196c('0x36')];}else{if(_0x4eee45[_0x196c('0x27')]===0x0&&_0x4eee45['talking']===0x0&&_0x4eee45['waiting']===0x0&&(_0x4eee45[_0x196c('0x25')]||0x0)===0x0){_0x23f937=CAMPAIGN_STATUS[_0x196c('0x36')];}else{_0x23f937=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x4eee45[_0x196c('0x21')]===0x0){_0x23f937=CAMPAIGN_STATUS[_0x196c('0x37')];}else if(!checkAnyValidTrunk(_0x4eee45,_0xd4e4b3)){_0x23f937=CAMPAIGN_STATUS[_0x196c('0x38')];}else if(!isPreviewCampaign(_0x4eee45)){var _0x1097c2=checkAnyValidQueueCampaignInterval(_0x4eee45);if(_0x1097c2){_0x23f937=_0x1097c2;}}return _0x23f937;}exports[_0x196c('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3369b5){var _0x1c3d79=CAMPAIGN_STATUS[_0x196c('0x3a')];if(_0x3369b5['originated']===0x0&&_0x3369b5[_0x196c('0x24')]===0x0&&_0x3369b5[_0x196c('0x3b')]===0x0&&(_0x3369b5[_0x196c('0x25')]||0x0)===0x0){_0x1c3d79=CAMPAIGN_STATUS['INACTIVE'];}return _0x1c3d79;}exports[_0x196c('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2bf8a3){var _0x5606ef=_0x2bf8a3[_0x196c('0x3d')](/"(.*?)"/);return _0x5606ef?_0x5606ef[0x1]:_0x2bf8a3;}exports[_0x196c('0x3e')]=extractCalleridName;function getCallerId(_0x5c3b0f,_0xc2ed9e,_0x4b2cfc){if(!_[_0x196c('0x3f')](_0x4b2cfc)&&typeof _0x4b2cfc===_0x196c('0x40')&&!_[_0x196c('0x2e')](_0x4b2cfc)){if(!_['isUndefined'](_0xc2ed9e)&&typeof _0xc2ed9e===_0x196c('0x40')&&!_['isEmpty'](_0xc2ed9e)){return util[_0x196c('0x41')](_0x196c('0x42'),_0xc2ed9e,_0x4b2cfc);}return util[_0x196c('0x41')](_0x196c('0x42'),_0x4b2cfc,_0x4b2cfc);}if(!_[_0x196c('0x3f')](_0x5c3b0f)&&typeof _0x5c3b0f==='string'&&!_[_0x196c('0x2e')](_0x5c3b0f)){return _0x5c3b0f;}return _0x196c('0x43');}exports[_0x196c('0x44')]=getCallerId;function getCallerIdRandom(_0x4139be,_0x52c804){var _0x5a8af8;var _0x39a6c7;var _0x40c69a;if(_0x52c804<=0x0){_0x52c804=0x1;}_0x5a8af8=new RegExp(_0x196c('0x45')+_0x52c804+'}$');_0x39a6c7=Math[_0x196c('0x46')](0xa,_0x52c804-0x1);_0x40c69a=Math[_0x196c('0x46')](0xa,_0x52c804)-0x1;return util[_0x196c('0x41')]('%s',_[_0x196c('0x47')](_0x4139be,_0x5a8af8,_['random'](_0x39a6c7,_0x40c69a)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x437c03){if(_0x437c03['originated']&&_0x437c03[_0x196c('0x27')]>0x0){_0x437c03['originated']-=0x1;}else{logger[_0x196c('0x48')](_0x196c('0x49'));}}exports[_0x196c('0x4a')]=decrementOriginate;function checkContactEmpty(_0x2f1e93){return _0x2f1e93&&_0x2f1e93['length']>0x0;}exports[_0x196c('0x4b')]=checkContactEmpty;function erlangb(_0x2b54ca,_0x4d807d){if(_0x4d807d===0x0){return 0x0;}var _0x38422c=0x1;for(var _0x40ca4f=0x1;_0x40ca4f<=_0x4d807d;_0x40ca4f+=0x1){_0x38422c=0x1+_0x38422c*_0x40ca4f/_0x2b54ca;}return 0x1/_0x38422c;}exports[_0x196c('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x59e6c2,_0x364ce5,_0x31907e){if(_0x364ce5>_0x31907e){for(var _0x2806a7=0x0;_0x2806a7<_0x364ce5-_0x31907e;_0x2806a7+=0x1){decrementOriginate(_0x59e6c2);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5abba1){var _0x1ae3b1={};var _0x632347=['id',_0x196c('0x4d'),_0x196c('0x4e'),_0x196c('0x4f'),_0x196c('0x50')];if(_0x5abba1){for(var _0x42ae7d in _0x5abba1){if(typeof _0x5abba1[_0x42ae7d]!==_0x196c('0x51')){if(!_[_0x196c('0x2c')](_0x5abba1[_0x42ae7d])&&!_0x632347[_0x196c('0x33')](_0x42ae7d)){_0x1ae3b1[util[_0x196c('0x41')](_0x196c('0x52'),_0x196c('0x53'),_0x42ae7d[_0x196c('0x54')]())]=_0x5abba1[_0x42ae7d];}}}}return _0x1ae3b1;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 23b66dd..0add8a2 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(_0x1a63af,_0x56e665){var _0xc5c257=function(_0x34f9bd){while(--_0x34f9bd){_0x1a63af['push'](_0x1a63af['shift']());}};_0xc5c257(++_0x56e665);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x5cc90d,_0x9245a3){var _0x2fe7af=function(_0x48f3a6){while(--_0x48f3a6){_0x5cc90d['push'](_0x5cc90d['shift']());}};_0x2fe7af(++_0x9245a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 cd533d0..63d5790 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 _0x24f8=['[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally'];(function(_0xca54f9,_0x1d837b){var _0x183c63=function(_0x4729a8){while(--_0x4729a8){_0xca54f9['push'](_0xca54f9['shift']());}};_0x183c63(++_0x1d837b);}(_0x24f8,0x19b));var _0x824f=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x24f8[_0x430f44];return _0x1f6b0f;};'use strict';var util=require(_0x824f('0x0'));var _=require(_0x824f('0x1'));var BPromise=require(_0x824f('0x2'));var uuid=require(_0x824f('0x3'));var moment=require(_0x824f('0x4'));var path=require(_0x824f('0x5'));var tiff2pdf=require(_0x824f('0x6'));var gs=require(_0x824f('0x7'));var logger=require('../../../config/logger')(_0x824f('0x8'));var ami=require(_0x824f('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x824f('0xa'));var ut=require(_0x824f('0xb'));var Action=require(_0x824f('0xc'));var faxAccount=require(_0x824f('0xd'));var attachment=require(_0x824f('0xe'));var faxMessage=require(_0x824f('0xf'));function Fax(_0x5214fa){this[_0x824f('0x10')]={};this[_0x824f('0x11')]=_0x5214fa[_0x824f('0x11')];this[_0x824f('0x12')]=_0x5214fa[_0x824f('0x12')];this[_0x824f('0x13')]={};ami['on']('newchannel',this['syncNewchannel'][_0x824f('0x14')](this));ami['on'](_0x824f('0x15'),this[_0x824f('0x16')]['bind'](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on'](_0x824f('0x17'),this[_0x824f('0x18')][_0x824f('0x14')](this));ami['on'](_0x824f('0x19'),this[_0x824f('0x1a')][_0x824f('0x14')](this));ami['on'](_0x824f('0x1b'),this[_0x824f('0x1c')][_0x824f('0x14')](this));ami['on']('hangup',this[_0x824f('0x1d')]['bind'](this));ami['on'](_0x824f('0x1e'),this[_0x824f('0x1f')][_0x824f('0x14')](this));}Fax[_0x824f('0x20')][_0x824f('0x21')]=function(_0x31868a){if(_0x31868a[_0x824f('0x22')]==='from-voip-provider'){for(var _0x1967a0 in this[_0x824f('0x11')]){if(this[_0x824f('0x11')][_0x824f('0x23')](_0x1967a0)){if(_0x31868a[_0x824f('0x24')]===this[_0x824f('0x11')][_0x1967a0]['localstationid']){this[_0x824f('0x10')][_0x31868a[_0x824f('0x25')]]={};this[_0x824f('0x10')][_0x31868a[_0x824f('0x25')]]['channel']=_0x31868a['channel'];this['channels'][_0x31868a[_0x824f('0x25')]]['id']=this[_0x824f('0x11')][_0x1967a0]['id'];this['channels'][_0x31868a[_0x824f('0x25')]][_0x824f('0x26')]=this[_0x824f('0x11')][_0x1967a0][_0x824f('0x26')];logger[_0x824f('0x27')](_0x31868a[_0x824f('0x25')],_0x824f('0x28'));}}}}if(this[_0x824f('0x13')][_0x31868a['uniqueid']]){this[_0x824f('0x10')][_0x31868a[_0x824f('0x25')]]={};this[_0x824f('0x10')][_0x31868a[_0x824f('0x25')]][_0x824f('0x29')]=_0x31868a[_0x824f('0x29')];logger[_0x824f('0x27')](_0x31868a[_0x824f('0x25')],_0x824f('0x28'));}};Fax[_0x824f('0x20')]['syncVarSet']=function(_0x49d623){if(this[_0x824f('0x10')][_0x49d623[_0x824f('0x25')]]){for(var _0x669e01 in _0x49d623['variable']){if(_0x49d623[_0x824f('0x2a')]['hasOwnProperty'](_0x669e01)){this[_0x824f('0x10')][_0x49d623[_0x824f('0x25')]][_0x669e01]=_0x49d623[_0x824f('0x2b')];}}}};Fax[_0x824f('0x20')]['syncNewState']=function(_0x50b91f){if(this[_0x824f('0x10')][_0x50b91f[_0x824f('0x25')]]){this['channels'][_0x50b91f[_0x824f('0x25')]][_0x824f('0x2c')]=_0x50b91f[_0x824f('0x2c')];this[_0x824f('0x10')][_0x50b91f[_0x824f('0x25')]][_0x824f('0x2d')]=_0x50b91f[_0x824f('0x2d')];}};Fax[_0x824f('0x20')]['syncNewExten']=function(_0x2d862a){if(this[_0x824f('0x10')][_0x2d862a[_0x824f('0x25')]]){for(var _0x400566 in _0x2d862a[_0x824f('0x2a')]){if(_0x2d862a[_0x824f('0x2a')][_0x824f('0x23')](_0x400566)){this[_0x824f('0x10')][_0x2d862a[_0x824f('0x25')]][_0x400566]=_0x2d862a[_0x824f('0x2b')];}}}};Fax[_0x824f('0x20')][_0x824f('0x1a')]=function(_0x4db9c5){if(this[_0x824f('0x10')][_0x4db9c5[_0x824f('0x25')]]){this['channels'][_0x4db9c5[_0x824f('0x25')]][_0x824f('0x2e')]=_0x4db9c5[_0x824f('0x2e')];this['channels'][_0x4db9c5[_0x824f('0x25')]][_0x824f('0x2f')]=_0x4db9c5[_0x824f('0x2f')];this[_0x824f('0x10')][_0x4db9c5[_0x824f('0x25')]][_0x824f('0x30')]=_0x4db9c5[_0x824f('0x30')];this['channels'][_0x4db9c5[_0x824f('0x25')]]['filename']=_0x4db9c5[_0x824f('0x31')];logger[_0x824f('0x27')](_0x4db9c5[_0x824f('0x25')],_0x824f('0x32'));}};Fax['prototype'][_0x824f('0x1c')]=function(_0x1a28a4){var _0x17a106=this;if(this[_0x824f('0x10')][_0x1a28a4[_0x824f('0x25')]]){var _0x3b6fdf=this[_0x824f('0x10')][_0x1a28a4[_0x824f('0x25')]]['id'];this['channels'][_0x1a28a4['uniqueid']]['remotestationid']=_0x1a28a4['remotestationid'];this[_0x824f('0x10')][_0x1a28a4[_0x824f('0x25')]][_0x824f('0x33')]=_0x1a28a4['pagestransferred'];this['channels'][_0x1a28a4['uniqueid']][_0x824f('0x30')]=_0x1a28a4['localstationid'];this['channels'][_0x1a28a4[_0x824f('0x25')]]['resolution']=_0x1a28a4['resolution'];this[_0x824f('0x10')][_0x1a28a4[_0x824f('0x25')]]['transferrate']=_0x1a28a4[_0x824f('0x34')];this[_0x824f('0x10')][_0x1a28a4[_0x824f('0x25')]][_0x824f('0x31')]=_0x1a28a4[_0x824f('0x31')];this[_0x824f('0x10')][_0x1a28a4['uniqueid']][_0x824f('0x35')]=_0x1a28a4[_0x824f('0x35')];if(this[_0x824f('0x10')][_0x1a28a4['uniqueid']][_0x824f('0x33')]>0x0){tiff2pdf(_0x1a28a4[_0x824f('0x31')],_0x824f('0x36'),function(_0x2bed4a){logger[_0x824f('0x27')](_0x1a28a4['uniqueid'],_0x824f('0x37'),_0x2bed4a[_0x824f('0x38')]);attachment[_0x824f('0x39')]({'name':path[_0x824f('0x3a')](_0x1a28a4[_0x824f('0x31')])['name'],'basename':path[_0x824f('0x3a')](_0x1a28a4['filename'])['name']+_0x824f('0x3b'),'type':_0x824f('0x3c')})[_0x824f('0x3d')](function(_0x1c5e20){faxAccount[_0x824f('0x3e')](_0x3b6fdf,{'from':_0x1a28a4[_0x824f('0x35')],'mapKey':'fax','body':path[_0x824f('0x3a')](_0x1a28a4[_0x824f('0x31')])['name']+_0x824f('0x3b'),'AttachmentId':_0x1c5e20['id']})['catch'](function(_0x253865){logger[_0x824f('0x3f')](_0x1a28a4[_0x824f('0x25')],_0x824f('0x40'),JSON[_0x824f('0x41')](_0x253865));});})[_0x824f('0x42')](function(_0xc750c0){logger['error'](_0x1a28a4[_0x824f('0x25')],'\x20receiveFax\x20',JSON[_0x824f('0x41')](_0xc750c0));});});}logger[_0x824f('0x27')](_0x1a28a4[_0x824f('0x25')],_0x824f('0x43'));}};Fax[_0x824f('0x20')][_0x824f('0x1f')]=function(_0x5ceefe){if(this[_0x824f('0x13')][_0x5ceefe[_0x824f('0x25')]]){_[_0x824f('0x44')](this['channels'][_0x5ceefe['uniqueid']],_[_0x824f('0x45')](_0x5ceefe,['response',_0x824f('0x46')]));}};function updateStatus(_0x52ac48){if(_0x52ac48[_0x824f('0x47')]){faxMessage[_0x824f('0x48')](_0x52ac48[_0x824f('0x47')],{'failMessage':_0x824f('0x49')})['then'](function(_0x4867a4){ut[_0x824f('0x4a')]('[Fax][Message][Error][Updated]',_0x4867a4);})[_0x824f('0x42')](function(_0x39f317){ut[_0x824f('0x4a')](_0x824f('0x4b'),_0x39f317);});}else{ut['logger'](_0x824f('0x4c'));}}Fax[_0x824f('0x20')][_0x824f('0x4d')]=function(_0x101c05,_0x48d8ce,_0x343100){var _0x26ed64=this;var _0x48eb2e={};if(_0x48d8ce){_0x48eb2e={'read':_0x48d8ce};}else{_0x48eb2e={'failMessage':_0x343100};}if(this[_0x824f('0x13')][_0x101c05]['AttachmentId']){faxMessage['update'](this[_0x824f('0x13')][_0x101c05]['AttachmentId'],_0x48eb2e)[_0x824f('0x3d')](function(_0x3b4aa9){ut[_0x824f('0x4a')](_0x824f('0x4e'),_0x3b4aa9);})[_0x824f('0x42')](function(_0x171b04){ut['logger'](_0x824f('0x4f'),_0x171b04);})[_0x824f('0x50')](function(){delete _0x26ed64[_0x824f('0x10')][_0x101c05];delete _0x26ed64[_0x824f('0x13')][_0x101c05];});}else{ut[_0x824f('0x4a')](_0x824f('0x51'));delete this[_0x824f('0x10')][_0x101c05];delete this['actions'][_0x101c05];}};Fax[_0x824f('0x20')][_0x824f('0x1d')]=function(_0x8b5af){var _0x41cca8=this;if(this['channels'][_0x8b5af[_0x824f('0x25')]]){if(this[_0x824f('0x13')][_0x8b5af[_0x824f('0x25')]]){this['channels'][_0x8b5af[_0x824f('0x25')]]['id']=this[_0x824f('0x13')][_0x8b5af[_0x824f('0x25')]]['id'];this[_0x824f('0x10')][_0x8b5af['uniqueid']][_0x824f('0x26')]=this['actions'][_0x8b5af['uniqueid']][_0x824f('0x26')];}logger['info'](_0x8b5af[_0x824f('0x25')],this['actions'][_0x8b5af[_0x824f('0x25')]]?_0x824f('0x52'):_0x824f('0x53'),JSON[_0x824f('0x41')](this[_0x824f('0x10')][_0x8b5af['uniqueid']]));if(this['actions'][_0x8b5af['uniqueid']]){if(this[_0x824f('0x10')][_0x8b5af[_0x824f('0x25')]][_0x824f('0x54')]>0x0&&this[_0x824f('0x10')][_0x8b5af[_0x824f('0x25')]][_0x824f('0x19')]===_0x824f('0x55')){this['updateStatus'](_0x8b5af[_0x824f('0x25')],!![]);}else{this[_0x824f('0x4d')](_0x8b5af[_0x824f('0x25')],![],this[_0x824f('0x10')][_0x8b5af[_0x824f('0x25')]][_0x824f('0x56')]?_0x824f('0x57')+this['channels'][_0x8b5af['uniqueid']][_0x824f('0x56')]:_0x824f('0x58'));}}}};Fax[_0x824f('0x20')][_0x824f('0x59')]=function(_0x2efdbe){var _0xe4bd20=this;return new BPromise(function(_0x2da66a,_0x52b618){_0xe4bd20['execOriginate'](_0x2efdbe,_0xe4bd20[_0x824f('0x11')][_0x2efdbe[_0x824f('0x5a')]])[_0x824f('0x3d')](function(_0x1fa35e){ut[_0x824f('0x4a')](_0x824f('0x5b'),_0x1fa35e);_0x2da66a(ut['message']('Fax\x20received'));})[_0x824f('0x42')](function(_0x543acd){ut[_0x824f('0x4a')](_0x824f('0x5c'),_0x543acd);updateStatus(_0x2efdbe);_0x52b618(ut[_0x824f('0x38')](_0x824f('0x5d')));});});};Fax[_0x824f('0x20')][_0x824f('0x5e')]=function(_0x2b2ab9){var _0x1c40ae=this;return new BPromise(function(_0x16f654,_0x216e00){var _0x4d4e5b=_0x1c40ae[_0x824f('0x5f')](_0x1c40ae[_0x824f('0x11')][_0x2b2ab9[_0x824f('0x5a')]][_0x824f('0x60')],_0x2b2ab9);if(_0x4d4e5b[_0x824f('0x61')]){_0x16f654(ut['message'](_0x824f('0x62')));}else{_0x216e00(ut[_0x824f('0x38')](_0x4d4e5b['message']));}});};function originate(_0x1716a4,_0x2f25d9,_0x49ca78){return new BPromise(function(_0xb8a906,_0x35ffb3){if(_0x49ca78){var _0x8a4747=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x824f('0x3a')](_0x1716a4[_0x824f('0x5')])[_0x824f('0x26')],_0x1716a4[_0x824f('0x5')]);gs[_0x824f('0x63')](_0x8a4747)[_0x824f('0x3d')](function(){_0x1716a4['path']=util[_0x824f('0x64')](_0x824f('0x65'),path['parse'](_0x1716a4[_0x824f('0x5')])[_0x824f('0x66')],path[_0x824f('0x3a')](_0x1716a4[_0x824f('0x5')])[_0x824f('0x26')]);_0x2f25d9[_0x824f('0x67')]=_0x1716a4[_0x824f('0x5')];ut['logger'](_0x824f('0x68'),'');ami[_0x824f('0x69')](ut['variablesAction'](_0x1716a4,_0x2f25d9))[_0x824f('0x3d')](function(_0xccf769){_0xb8a906(_0xccf769);})[_0x824f('0x42')](function(_0x2ccfeb){_0x35ffb3(_0x2ccfeb);});})[_0x824f('0x42')](function(_0x10fa57){_0x35ffb3(_0x10fa57);});}else{ami[_0x824f('0x69')](ut[_0x824f('0x6a')](_0x1716a4,_0x2f25d9))[_0x824f('0x3d')](function(_0x26c12c){_0xb8a906(_0x26c12c);})['catch'](function(_0x2e3007){_0x35ffb3(_0x2e3007);});}});}Fax[_0x824f('0x20')]['execOriginate']=function(_0x1f6a5b,_0x4066f6){var _0xd68901=this;return new BPromise(function(_0x49fc04,_0x35f7c5){var _0x26aadc=uuid['v4']();var _0x3689e8=ut[_0x824f('0x6b')](_0x1f6a5b,_0x4066f6);_0xd68901[_0x824f('0x13')][_0x26aadc]=new Action(_0x26aadc,_0x4066f6,_0x1f6a5b);var _0xe4af9d=_0xd68901['actions'][_0x26aadc];if(path[_0x824f('0x3a')](_0x1f6a5b[_0x824f('0x5')])[_0x824f('0x6c')]===_0x824f('0x3b')){originate(_0xe4af9d,_0x3689e8,!![])[_0x824f('0x3d')](function(_0x3e7c50){_0x49fc04(_0x3e7c50);})['catch'](function(_0x59c46c){_0x35f7c5(_0x59c46c);});}else{originate(_0xe4af9d,_0x3689e8,![])['then'](function(_0x103aff){_0x49fc04(_0x103aff);})[_0x824f('0x42')](function(_0x432d4d){_0x35f7c5(_0x432d4d);});}});};Fax['prototype']['isTrunkReachable']=function(_0x4c06ae){return!_[_0x824f('0x6d')](_0x4c06ae)&&!_[_0x824f('0x6d')](_0x4c06ae[_0x824f('0x26')])&&!_[_0x824f('0x6d')](_0x4c06ae['active'])&&_0x4c06ae[_0x824f('0x6e')]&&!_['isNil'](this[_0x824f('0x12')][util[_0x824f('0x64')](_0x824f('0x6f'),_0x4c06ae['name'])])&&!_[_0x824f('0x6d')](this[_0x824f('0x12')][util[_0x824f('0x64')](_0x824f('0x6f'),_0x4c06ae[_0x824f('0x26')])]['status'])&&(this[_0x824f('0x12')][util[_0x824f('0x64')](_0x824f('0x6f'),_0x4c06ae[_0x824f('0x26')])][_0x824f('0x2f')]===_0x824f('0x70')||this[_0x824f('0x12')][util[_0x824f('0x64')](_0x824f('0x6f'),_0x4c06ae[_0x824f('0x26')])]['status']===_0x824f('0x71'));};Fax[_0x824f('0x20')]['checkTrunk']=function(_0x32dc8e,_0x521724){if(!this[_0x824f('0x72')](_0x32dc8e)){ut[_0x824f('0x4a')](_0x824f('0x73'),_['isNil'](_0x32dc8e)?'':_0x32dc8e['name']+_0x824f('0x74'));return{'isValid':![],'message':_0x824f('0x75')};}if(_[_0x824f('0x6d')](_0x521724[_0x824f('0x8')])){ut[_0x824f('0x4a')](_0x824f('0x76'),JSON[_0x824f('0x41')](_0x521724));return{'isValid':![],'message':_0x824f('0x77')};}if(_['isNil'](_0x521724[_0x824f('0x5')])){ut[_0x824f('0x4a')](_0x824f('0x78'),JSON[_0x824f('0x41')](_0x521724));return{'isValid':![],'message':_0x824f('0x79')};}return{'isValid':!![],'message':_0x824f('0x7a')};};module['exports']=Fax; \ No newline at end of file +var _0xa553=['isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','syncNewExten','faxstatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','FaxAccountId','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','Convert\x20pdf\x20to\x20tif','Action','addVariables'];(function(_0x490048,_0x32c740){var _0x34212d=function(_0x15f443){while(--_0x15f443){_0x490048['push'](_0x490048['shift']());}};_0x34212d(++_0x32c740);}(_0xa553,0x7f));var _0x3a55=function(_0x4c0f30,_0x26ff10){_0x4c0f30=_0x4c0f30-0x0;var _0x36a424=_0xa553[_0x4c0f30];return _0x36a424;};'use strict';var util=require('util');var _=require(_0x3a55('0x0'));var BPromise=require(_0x3a55('0x1'));var uuid=require(_0x3a55('0x2'));var moment=require('moment');var path=require(_0x3a55('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x3a55('0x4'));var logger=require(_0x3a55('0x5'))(_0x3a55('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x3a55('0x7'));var ut=require(_0x3a55('0x8'));var Action=require(_0x3a55('0x9'));var faxAccount=require(_0x3a55('0xa'));var attachment=require(_0x3a55('0xb'));var faxMessage=require(_0x3a55('0xc'));function Fax(_0x398180){this['channels']={};this['faxAccounts']=_0x398180[_0x3a55('0xd')];this[_0x3a55('0xe')]=_0x398180['trunks'];this[_0x3a55('0xf')]={};ami['on']('newchannel',this[_0x3a55('0x10')]['bind'](this));ami['on'](_0x3a55('0x11'),this[_0x3a55('0x12')][_0x3a55('0x13')](this));ami['on'](_0x3a55('0x14'),this[_0x3a55('0x15')][_0x3a55('0x13')](this));ami['on']('newexten',this[_0x3a55('0x16')][_0x3a55('0x13')](this));ami['on'](_0x3a55('0x17'),this['syncFaxStatus'][_0x3a55('0x13')](this));ami['on']('receivefax',this[_0x3a55('0x18')][_0x3a55('0x13')](this));ami['on'](_0x3a55('0x19'),this['syncHangup'][_0x3a55('0x13')](this));ami['on'](_0x3a55('0x1a'),this[_0x3a55('0x1b')][_0x3a55('0x13')](this));}Fax[_0x3a55('0x1c')][_0x3a55('0x10')]=function(_0x5593af){if(_0x5593af['context']==='from-voip-provider'){for(var _0x4a2d05 in this[_0x3a55('0xd')]){if(this[_0x3a55('0xd')][_0x3a55('0x1d')](_0x4a2d05)){if(_0x5593af[_0x3a55('0x1e')]===this[_0x3a55('0xd')][_0x4a2d05][_0x3a55('0x1f')]){this[_0x3a55('0x20')][_0x5593af[_0x3a55('0x21')]]={};this[_0x3a55('0x20')][_0x5593af[_0x3a55('0x21')]][_0x3a55('0x22')]=_0x5593af[_0x3a55('0x22')];this[_0x3a55('0x20')][_0x5593af[_0x3a55('0x21')]]['id']=this['faxAccounts'][_0x4a2d05]['id'];this[_0x3a55('0x20')][_0x5593af['uniqueid']][_0x3a55('0x23')]=this['faxAccounts'][_0x4a2d05][_0x3a55('0x23')];logger['info'](_0x5593af[_0x3a55('0x21')],_0x3a55('0x24'));}}}}if(this[_0x3a55('0xf')][_0x5593af[_0x3a55('0x21')]]){this[_0x3a55('0x20')][_0x5593af[_0x3a55('0x21')]]={};this[_0x3a55('0x20')][_0x5593af[_0x3a55('0x21')]][_0x3a55('0x22')]=_0x5593af[_0x3a55('0x22')];logger[_0x3a55('0x25')](_0x5593af[_0x3a55('0x21')],'\x20syncNewchannel\x20');}};Fax[_0x3a55('0x1c')]['syncVarSet']=function(_0x22c484){if(this[_0x3a55('0x20')][_0x22c484[_0x3a55('0x21')]]){for(var _0x46914a in _0x22c484[_0x3a55('0x26')]){if(_0x22c484[_0x3a55('0x26')][_0x3a55('0x1d')](_0x46914a)){this[_0x3a55('0x20')][_0x22c484[_0x3a55('0x21')]][_0x46914a]=_0x22c484[_0x3a55('0x27')];}}}};Fax[_0x3a55('0x1c')][_0x3a55('0x15')]=function(_0x4e0444){if(this['channels'][_0x4e0444[_0x3a55('0x21')]]){this[_0x3a55('0x20')][_0x4e0444[_0x3a55('0x21')]]['channelstate']=_0x4e0444[_0x3a55('0x28')];this[_0x3a55('0x20')][_0x4e0444[_0x3a55('0x21')]][_0x3a55('0x29')]=_0x4e0444[_0x3a55('0x29')];}};Fax[_0x3a55('0x1c')][_0x3a55('0x16')]=function(_0x531020){if(this[_0x3a55('0x20')][_0x531020[_0x3a55('0x21')]]){for(var _0x528b9d in _0x531020[_0x3a55('0x26')]){if(_0x531020[_0x3a55('0x26')][_0x3a55('0x1d')](_0x528b9d)){this['channels'][_0x531020[_0x3a55('0x21')]][_0x528b9d]=_0x531020[_0x3a55('0x27')];}}}};Fax['prototype'][_0x3a55('0x2a')]=function(_0x5a4090){if(this['channels'][_0x5a4090['uniqueid']]){this[_0x3a55('0x20')][_0x5a4090[_0x3a55('0x21')]]['operation']=_0x5a4090[_0x3a55('0x2b')];this[_0x3a55('0x20')][_0x5a4090[_0x3a55('0x21')]][_0x3a55('0x2c')]=_0x5a4090[_0x3a55('0x2c')];this[_0x3a55('0x20')][_0x5a4090[_0x3a55('0x21')]]['localstationid']=_0x5a4090[_0x3a55('0x1f')];this[_0x3a55('0x20')][_0x5a4090['uniqueid']]['filename']=_0x5a4090[_0x3a55('0x2d')];logger[_0x3a55('0x25')](_0x5a4090[_0x3a55('0x21')],_0x3a55('0x2e'));}};Fax['prototype']['syncReceiveFax']=function(_0x4600c2){var _0x2f33e8=this;if(this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]]){var _0x4f65fa=this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]]['id'];this['channels'][_0x4600c2[_0x3a55('0x21')]]['remotestationid']=_0x4600c2[_0x3a55('0x2f')];this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]][_0x3a55('0x30')]=_0x4600c2[_0x3a55('0x30')];this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]]['localstationid']=_0x4600c2[_0x3a55('0x1f')];this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]][_0x3a55('0x31')]=_0x4600c2[_0x3a55('0x31')];this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]][_0x3a55('0x32')]=_0x4600c2[_0x3a55('0x32')];this[_0x3a55('0x20')][_0x4600c2['uniqueid']][_0x3a55('0x2d')]=_0x4600c2[_0x3a55('0x2d')];this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]][_0x3a55('0x33')]=_0x4600c2[_0x3a55('0x33')];if(this[_0x3a55('0x20')][_0x4600c2[_0x3a55('0x21')]][_0x3a55('0x30')]>0x0){tiff2pdf(_0x4600c2[_0x3a55('0x2d')],_0x3a55('0x34'),function(_0x2dfe22){logger[_0x3a55('0x25')](_0x4600c2[_0x3a55('0x21')],'\x20result\x20conversion\x20file\x20',_0x2dfe22[_0x3a55('0x35')]);attachment['create']({'name':path[_0x3a55('0x36')](_0x4600c2[_0x3a55('0x2d')])[_0x3a55('0x23')],'basename':path[_0x3a55('0x36')](_0x4600c2[_0x3a55('0x2d')])[_0x3a55('0x23')]+_0x3a55('0x37'),'type':_0x3a55('0x38')})['then'](function(_0x301abd){faxAccount[_0x3a55('0x39')](_0x4f65fa,{'from':_0x4600c2['calleridnum'],'mapKey':_0x3a55('0x6'),'body':path[_0x3a55('0x36')](_0x4600c2[_0x3a55('0x2d')])['name']+_0x3a55('0x37'),'AttachmentId':_0x301abd['id']})[_0x3a55('0x3a')](function(_0x4ad8e8){logger[_0x3a55('0x3b')](_0x4600c2['uniqueid'],_0x3a55('0x3c'),JSON[_0x3a55('0x3d')](_0x4ad8e8));});})[_0x3a55('0x3a')](function(_0x264adc){logger[_0x3a55('0x3b')](_0x4600c2[_0x3a55('0x21')],_0x3a55('0x3e'),JSON[_0x3a55('0x3d')](_0x264adc));});});}logger['info'](_0x4600c2[_0x3a55('0x21')],_0x3a55('0x3e'));}};Fax[_0x3a55('0x1c')][_0x3a55('0x1b')]=function(_0x3bd8c1){if(this[_0x3a55('0xf')][_0x3bd8c1[_0x3a55('0x21')]]){_[_0x3a55('0x3f')](this[_0x3a55('0x20')][_0x3bd8c1[_0x3a55('0x21')]],_['pick'](_0x3bd8c1,[_0x3a55('0x40'),_0x3a55('0x41')]));}};function updateStatus(_0xb2cfac){if(_0xb2cfac['AttachmentId']){faxMessage[_0x3a55('0x42')](_0xb2cfac[_0x3a55('0x43')],{'failMessage':_0x3a55('0x44')})[_0x3a55('0x45')](function(_0x98f8aa){ut[_0x3a55('0x46')](_0x3a55('0x47'),_0x98f8aa);})[_0x3a55('0x3a')](function(_0x329c69){ut[_0x3a55('0x46')](_0x3a55('0x48'),_0x329c69);});}else{ut[_0x3a55('0x46')](_0x3a55('0x49'));}}Fax[_0x3a55('0x1c')][_0x3a55('0x4a')]=function(_0x5cf855,_0x172f63,_0x52d00b){var _0x5e85a3=this;var _0x18dac1={};if(_0x172f63){_0x18dac1={'read':_0x172f63};}else{_0x18dac1={'failMessage':_0x52d00b};}if(this[_0x3a55('0xf')][_0x5cf855][_0x3a55('0x43')]){faxMessage[_0x3a55('0x42')](this[_0x3a55('0xf')][_0x5cf855][_0x3a55('0x43')],_0x18dac1)['then'](function(_0x1caaeb){ut['logger'](_0x3a55('0x4b'),_0x1caaeb);})['catch'](function(_0xd9c268){ut[_0x3a55('0x46')](_0x3a55('0x4c'),_0xd9c268);})['finally'](function(){delete _0x5e85a3[_0x3a55('0x20')][_0x5cf855];delete _0x5e85a3[_0x3a55('0xf')][_0x5cf855];});}else{ut[_0x3a55('0x46')](_0x3a55('0x4d'));delete this['channels'][_0x5cf855];delete this[_0x3a55('0xf')][_0x5cf855];}};Fax[_0x3a55('0x1c')][_0x3a55('0x4e')]=function(_0x255f47){var _0x3da07d=this;if(this[_0x3a55('0x20')][_0x255f47[_0x3a55('0x21')]]){if(this[_0x3a55('0xf')][_0x255f47[_0x3a55('0x21')]]){this['channels'][_0x255f47[_0x3a55('0x21')]]['id']=this[_0x3a55('0xf')][_0x255f47[_0x3a55('0x21')]]['id'];this['channels'][_0x255f47[_0x3a55('0x21')]][_0x3a55('0x23')]=this[_0x3a55('0xf')][_0x255f47[_0x3a55('0x21')]]['name'];}logger[_0x3a55('0x25')](_0x255f47[_0x3a55('0x21')],this[_0x3a55('0xf')][_0x255f47[_0x3a55('0x21')]]?_0x3a55('0x4f'):_0x3a55('0x50'),JSON[_0x3a55('0x3d')](this[_0x3a55('0x20')][_0x255f47['uniqueid']]));if(this[_0x3a55('0xf')][_0x255f47[_0x3a55('0x21')]]){if(this[_0x3a55('0x20')][_0x255f47['uniqueid']][_0x3a55('0x51')]>0x0&&this[_0x3a55('0x20')][_0x255f47[_0x3a55('0x21')]][_0x3a55('0x17')]===_0x3a55('0x52')){this[_0x3a55('0x4a')](_0x255f47[_0x3a55('0x21')],!![]);}else{this['updateStatus'](_0x255f47[_0x3a55('0x21')],![],this[_0x3a55('0x20')][_0x255f47['uniqueid']][_0x3a55('0x53')]?_0x3a55('0x54')+this[_0x3a55('0x20')][_0x255f47[_0x3a55('0x21')]][_0x3a55('0x53')]:_0x3a55('0x55'));}}}};Fax[_0x3a55('0x1c')][_0x3a55('0x56')]=function(_0x421552){var _0x5352e8=this;return new BPromise(function(_0x55b0b5,_0x4e9c33){_0x5352e8[_0x3a55('0x57')](_0x421552,_0x5352e8[_0x3a55('0xd')][_0x421552['FaxAccountId']])[_0x3a55('0x45')](function(_0x5c2c31){ut['logger'](_0x3a55('0x58'),_0x5c2c31);_0x55b0b5(ut[_0x3a55('0x35')]('Fax\x20received'));})[_0x3a55('0x3a')](function(_0x388547){ut[_0x3a55('0x46')](_0x3a55('0x59'),_0x388547);updateStatus(_0x421552);_0x4e9c33(ut[_0x3a55('0x35')]('Fax\x20failed'));});});};Fax['prototype'][_0x3a55('0x5a')]=function(_0x478e7d){var _0x540741=this;return new BPromise(function(_0x613ad5,_0x2f12c2){var _0x171b51=_0x540741['checkTrunk'](_0x540741[_0x3a55('0xd')][_0x478e7d[_0x3a55('0x5b')]]['Trunk'],_0x478e7d);if(_0x171b51['isValid']){_0x613ad5(ut[_0x3a55('0x35')]('Trunk\x20Reachable'));}else{_0x2f12c2(ut[_0x3a55('0x35')](_0x171b51[_0x3a55('0x35')]));}});};function originate(_0x36ad1b,_0x2fe85d,_0x482c54){return new BPromise(function(_0x1c16ed,_0x516957){if(_0x482c54){var _0x2f54f6=util[_0x3a55('0x5c')](_0x3a55('0x5d'),path[_0x3a55('0x36')](_0x36ad1b[_0x3a55('0x3')])[_0x3a55('0x23')],_0x36ad1b[_0x3a55('0x3')]);gs[_0x3a55('0x5e')](_0x2f54f6)['then'](function(){_0x36ad1b['path']=util['format'](_0x3a55('0x5f'),path['parse'](_0x36ad1b[_0x3a55('0x3')])['dir'],path['parse'](_0x36ad1b[_0x3a55('0x3')])[_0x3a55('0x23')]);_0x2fe85d['XMF-PATH']=_0x36ad1b['path'];ut[_0x3a55('0x46')](_0x3a55('0x60'),'');ami[_0x3a55('0x61')](ut['variablesAction'](_0x36ad1b,_0x2fe85d))[_0x3a55('0x45')](function(_0x5eb230){_0x1c16ed(_0x5eb230);})[_0x3a55('0x3a')](function(_0x3462e7){_0x516957(_0x3462e7);});})[_0x3a55('0x3a')](function(_0x347609){_0x516957(_0x347609);});}else{ami[_0x3a55('0x61')](ut['variablesAction'](_0x36ad1b,_0x2fe85d))['then'](function(_0x18c784){_0x1c16ed(_0x18c784);})[_0x3a55('0x3a')](function(_0x1c468b){_0x516957(_0x1c468b);});}});}Fax[_0x3a55('0x1c')][_0x3a55('0x57')]=function(_0x116e72,_0x1ad246){var _0x7764f3=this;return new BPromise(function(_0x3e6949,_0x2418c0){var _0x49146f=uuid['v4']();var _0x1d3ba2=ut[_0x3a55('0x62')](_0x116e72,_0x1ad246);_0x7764f3[_0x3a55('0xf')][_0x49146f]=new Action(_0x49146f,_0x1ad246,_0x116e72);var _0x40f7c2=_0x7764f3[_0x3a55('0xf')][_0x49146f];if(path['parse'](_0x116e72[_0x3a55('0x3')])['ext']===_0x3a55('0x37')){originate(_0x40f7c2,_0x1d3ba2,!![])[_0x3a55('0x45')](function(_0x5d5e3f){_0x3e6949(_0x5d5e3f);})[_0x3a55('0x3a')](function(_0x26aa6a){_0x2418c0(_0x26aa6a);});}else{originate(_0x40f7c2,_0x1d3ba2,![])['then'](function(_0x17ae05){_0x3e6949(_0x17ae05);})[_0x3a55('0x3a')](function(_0x4dc212){_0x2418c0(_0x4dc212);});}});};Fax['prototype'][_0x3a55('0x63')]=function(_0x2d0703){return!_['isNil'](_0x2d0703)&&!_[_0x3a55('0x64')](_0x2d0703[_0x3a55('0x23')])&&!_[_0x3a55('0x64')](_0x2d0703[_0x3a55('0x65')])&&_0x2d0703[_0x3a55('0x65')]&&!_['isNil'](this[_0x3a55('0xe')][util[_0x3a55('0x5c')](_0x3a55('0x66'),_0x2d0703[_0x3a55('0x23')])])&&!_[_0x3a55('0x64')](this['trunks'][util[_0x3a55('0x5c')]('SIP/%s',_0x2d0703[_0x3a55('0x23')])]['status'])&&(this['trunks'][util[_0x3a55('0x5c')](_0x3a55('0x66'),_0x2d0703['name'])]['status']===_0x3a55('0x67')||this[_0x3a55('0xe')][util['format'](_0x3a55('0x66'),_0x2d0703[_0x3a55('0x23')])]['status']===_0x3a55('0x68'));};Fax[_0x3a55('0x1c')][_0x3a55('0x69')]=function(_0x4a416b,_0x1a3798){if(!this[_0x3a55('0x63')](_0x4a416b)){ut[_0x3a55('0x46')](_0x3a55('0x6a'),_[_0x3a55('0x64')](_0x4a416b)?'':_0x4a416b[_0x3a55('0x23')]+_0x3a55('0x6b'));return{'isValid':![],'message':_0x3a55('0x6c')};}if(_['isNil'](_0x1a3798[_0x3a55('0x6')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1a3798));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x1a3798[_0x3a55('0x3')])){ut[_0x3a55('0x46')](_0x3a55('0x6d'),JSON[_0x3a55('0x3d')](_0x1a3798));return{'isValid':![],'message':_0x3a55('0x6e')};}return{'isValid':!![],'message':_0x3a55('0x6f')};};module[_0x3a55('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8c15ca4..2258251 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 _0xe5ae=['../../../config/logger','preview','../rpc/faxAccount','error','inspect','resolve','then','notify','catch','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe5ae,0x15d));var _0xee5a=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xe5ae[_0x4392af];return _0x9fa8eb;};'use strict';var util=require(_0xee5a('0x0'));var BPromise=require('bluebird');var logger=require(_0xee5a('0x1'))(_0xee5a('0x2'));var _=require('lodash');var faxAccount=require(_0xee5a('0x3'));function loggerCatch(_0x288383){return function(_0x33e9f4){logger[_0xee5a('0x4')](_0x288383,util[_0xee5a('0x5')](_0x33e9f4,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x61609a,_0x4eb853){return BPromise[_0xee5a('0x6')]()[_0xee5a('0x7')](faxAccount[_0xee5a('0x8')](_0x61609a,_0x4eb853))[_0xee5a('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x7ecc=['notify','then','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x455e82,_0x522f6f){var _0x2d0520=function(_0x11556e){while(--_0x11556e){_0x455e82['push'](_0x455e82['shift']());}};_0x2d0520(++_0x522f6f);}(_0x7ecc,0xf4));var _0xc7ec=function(_0x2f691d,_0x1b8727){_0x2f691d=_0x2f691d-0x0;var _0x59e4ce=_0x7ecc[_0x2f691d];return _0x59e4ce;};'use strict';var util=require(_0xc7ec('0x0'));var BPromise=require(_0xc7ec('0x1'));var logger=require('../../../config/logger')(_0xc7ec('0x2'));var _=require(_0xc7ec('0x3'));var faxAccount=require(_0xc7ec('0x4'));function loggerCatch(_0x59f5ec){return function(_0x4a218d){logger['error'](_0x59f5ec,util[_0xc7ec('0x5')](_0x4a218d,{'showHidden':![],'depth':null}));};}exports[_0xc7ec('0x6')]=function(_0x1b76a5,_0x141008){return BPromise['resolve']()[_0xc7ec('0x7')](faxAccount[_0xc7ec('0x6')](_0x1b76a5,_0x141008))[_0xc7ec('0x8')](loggerCatch(_0xc7ec('0x9')));}; \ 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 bdeb83c..02229d7 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 _0x9e2b=['info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','exec','execute'];(function(_0x5c4e6f,_0x2a38de){var _0x598d7f=function(_0x163a08){while(--_0x163a08){_0x5c4e6f['push'](_0x5c4e6f['shift']());}};_0x598d7f(++_0x2a38de);}(_0x9e2b,0x1bc));var _0xb9e2=function(_0x1afa9d,_0xf4b0a4){_0x1afa9d=_0x1afa9d-0x0;var _0x5c050c=_0x9e2b[_0x1afa9d];return _0x5c050c;};'use strict';var util=require(_0xb9e2('0x0'));var logger=require(_0xb9e2('0x1'))(_0xb9e2('0x2'));var BPromise=require(_0xb9e2('0x3'));var exec=require('child_process')[_0xb9e2('0x4')];exports[_0xb9e2('0x5')]=function(_0x2a0775){return new BPromise(function(_0x3b5506,_0x3e519e){exec(_0x2a0775,function(_0x2b7675,_0x29e6da,_0x2c4f38){logger[_0xb9e2('0x6')](_0xb9e2('0x7'),_0x29e6da);if(_0x2b7675){logger[_0xb9e2('0x6')](_0xb9e2('0x7'),_0xb9e2('0x8'),util['inspect'](_0x2b7675,{'showHidden':![],'depth':null}),_0x29e6da,_0x2c4f38);_0x3e519e(_0x2b7675);}_0x3b5506(_0x29e6da);});});}; \ No newline at end of file +var _0xd740=['fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x3245a5,_0x3e0f39){var _0x52d66b=function(_0x4bf002){while(--_0x4bf002){_0x3245a5['push'](_0x3245a5['shift']());}};_0x52d66b(++_0x3e0f39);}(_0xd740,0x17a));var _0x0d74=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xd740[_0x1fa381];return _0x47eefe;};'use strict';var util=require(_0x0d74('0x0'));var logger=require(_0x0d74('0x1'))(_0x0d74('0x2'));var BPromise=require('bluebird');var exec=require(_0x0d74('0x3'))[_0x0d74('0x4')];exports[_0x0d74('0x5')]=function(_0x55497a){return new BPromise(function(_0x43dbaf,_0x157608){exec(_0x55497a,function(_0x292366,_0x969984,_0x5ceba8){logger[_0x0d74('0x6')](_0x0d74('0x7'),_0x969984);if(_0x292366){logger[_0x0d74('0x6')]('Exec\x20gs',_0x0d74('0x8'),util[_0x0d74('0x9')](_0x292366,{'showHidden':![],'depth':null}),_0x969984,_0x5ceba8);_0x157608(_0x292366);}_0x43dbaf(_0x969984);});});}; \ 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 490ba2f..05bc493 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 _0x5bfd=['maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x5bfd,0x184));var _0xd5bf=function(_0xa816e3,_0x447a6c){_0xa816e3=_0xa816e3-0x0;var _0x5d0103=_0x5bfd[_0xa816e3];return _0x5d0103;};'use strict';var util=require(_0xd5bf('0x0'));var _=require('lodash');var moment=require(_0xd5bf('0x1'));var logger=require(_0xd5bf('0x2'))(_0xd5bf('0x3'));exports[_0xd5bf('0x4')]=function(_0x12b0ca){return{'message':_0x12b0ca};};exports[_0xd5bf('0x5')]=function(_0x243224,_0x3a9a69){logger[_0xd5bf('0x6')](_0x243224,util[_0xd5bf('0x7')](_0x3a9a69,{'showHidden':![],'depth':null}));};exports[_0xd5bf('0x8')]=function(_0x4efb01,_0x50ce65){var _0x10050b={'XMF-ECM':_0x50ce65[_0xd5bf('0x9')],'XMF-HEADERINFO':_0x50ce65[_0xd5bf('0xa')],'XMF-MINRATE':_0x50ce65[_0xd5bf('0xb')],'XMF-MAXRATE':_0x50ce65[_0xd5bf('0xc')],'XMF-MODEM':util[_0xd5bf('0xd')](_0xd5bf('0xe'),_0x50ce65[_0xd5bf('0xf')]),'XMF-GATEWAY':_0x50ce65[_0xd5bf('0x10')],'XMF-FAXDETECT':_0x50ce65[_0xd5bf('0x11')],'XMF-T38TIMEOUT':_0x50ce65['t38timeout'],'XMF-LOCALSTATIONID':_0x50ce65[_0xd5bf('0x12')],'XMF-PATH':_0x4efb01[_0xd5bf('0x13')]};return _0x10050b;};exports[_0xd5bf('0x14')]=function(_0x7a7c75,_0x1c3ec5){return{'actionid':_0x7a7c75[_0xd5bf('0x15')],'action':'originate','channel':_0x7a7c75['channel'],'Exten':_0xd5bf('0x16'),'Context':_0xd5bf('0x17'),'Priority':'1','callerid':util[_0xd5bf('0xd')](_0xd5bf('0x18'),_0x7a7c75[_0xd5bf('0xa')]?_0x7a7c75[_0xd5bf('0xa')]:'',_0x7a7c75['localstationid']),'variable':_0x1c3ec5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x7a7c75['uniqueid']};}; \ No newline at end of file +var _0xc947=['lodash','moment','../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util'];(function(_0x9cc1d7,_0x126bd4){var _0x294e87=function(_0x272bd3){while(--_0x272bd3){_0x9cc1d7['push'](_0x9cc1d7['shift']());}};_0x294e87(++_0x126bd4);}(_0xc947,0x77));var _0x7c94=function(_0x4f8d49,_0x4f8675){_0x4f8d49=_0x4f8d49-0x0;var _0x30e4cc=_0xc947[_0x4f8d49];return _0x30e4cc;};'use strict';var util=require(_0x7c94('0x0'));var _=require(_0x7c94('0x1'));var moment=require(_0x7c94('0x2'));var logger=require(_0x7c94('0x3'))(_0x7c94('0x4'));exports['message']=function(_0x446abf){return{'message':_0x446abf};};exports[_0x7c94('0x5')]=function(_0x5478b5,_0x307b71){logger[_0x7c94('0x6')](_0x5478b5,util[_0x7c94('0x7')](_0x307b71,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1c79b7,_0x52d8fa){var _0x4bfa4e={'XMF-ECM':_0x52d8fa[_0x7c94('0x8')],'XMF-HEADERINFO':_0x52d8fa[_0x7c94('0x9')],'XMF-MINRATE':_0x52d8fa[_0x7c94('0xa')],'XMF-MAXRATE':_0x52d8fa[_0x7c94('0xb')],'XMF-MODEM':util[_0x7c94('0xc')](_0x7c94('0xd'),_0x52d8fa[_0x7c94('0xe')]),'XMF-GATEWAY':_0x52d8fa[_0x7c94('0xf')],'XMF-FAXDETECT':_0x52d8fa['faxdetect'],'XMF-T38TIMEOUT':_0x52d8fa[_0x7c94('0x10')],'XMF-LOCALSTATIONID':_0x52d8fa[_0x7c94('0x11')],'XMF-PATH':_0x1c79b7[_0x7c94('0x12')]};return _0x4bfa4e;};exports['variablesAction']=function(_0x2a0a5f,_0x241043){return{'actionid':_0x2a0a5f[_0x7c94('0x13')],'action':'originate','channel':_0x2a0a5f[_0x7c94('0x14')],'Exten':_0x7c94('0x15'),'Context':_0x7c94('0x16'),'Priority':'1','callerid':util['format'](_0x7c94('0x17'),_0x2a0a5f['headerinfo']?_0x2a0a5f[_0x7c94('0x9')]:'',_0x2a0a5f['localstationid']),'variable':_0x241043,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a0a5f[_0x7c94('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b7360ba..a8aae52 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 _0xd4d6=['getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','inspect','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xd4d6,0x1c0));var _0x6d4d=function(_0xf73c76,_0xab23f2){_0xf73c76=_0xf73c76-0x0;var _0x46787f=_0xd4d6[_0xf73c76];return _0x46787f;};'use strict';var util=require(_0x6d4d('0x0'));var moment=require(_0x6d4d('0x1'));var server=require(_0x6d4d('0x2'));var Realtime=require(_0x6d4d('0x3'));var Report=require(_0x6d4d('0x4'));var Acw=require(_0x6d4d('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x6d4d('0x6'));var Preview=require(_0x6d4d('0x7'));var Fax=require(_0x6d4d('0x8'));var user=require(_0x6d4d('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6d4d('0xa'));var voiceCallReport=require(_0x6d4d('0xb'));var trunk=require(_0x6d4d('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x6d4d('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6d4d('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6d4d('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x6d4d('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x6d4d('0x11'));var desk=require(_0x6d4d('0x12'));var zoho=require(_0x6d4d('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x6d4d('0x14'));var servicenow=require(_0x6d4d('0x15'));var dynamics365=require(_0x6d4d('0x16'));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(_0x6d4d('0x17'))(_0x6d4d('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6d4d('0x19')](_0x6d4d('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x6d4d('0x1b')](user['getAgents']())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x1c')]())[_0x6d4d('0x1b')](user['getTelephones']())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x1d')]())['then'](trunk[_0x6d4d('0x1e')]())['then'](realtime[_0x6d4d('0x1f')]())['then'](voiceQueue[_0x6d4d('0x20')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x21')]())[_0x6d4d('0x1b')](trigger[_0x6d4d('0x22')]())[_0x6d4d('0x1b')](realtime['initTriggers']())[_0x6d4d('0x1b')](template['getTemplates']())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x23')]())[_0x6d4d('0x1b')](zendesk[_0x6d4d('0x24')]())['then'](realtime[_0x6d4d('0x25')]())[_0x6d4d('0x1b')](salesforce[_0x6d4d('0x26')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x27')]())[_0x6d4d('0x1b')](sugarcrm[_0x6d4d('0x28')]())['then'](realtime[_0x6d4d('0x29')]())[_0x6d4d('0x1b')](freshdesk[_0x6d4d('0x2a')]())['then'](realtime[_0x6d4d('0x2b')]())[_0x6d4d('0x1b')](desk[_0x6d4d('0x2c')]())['then'](realtime[_0x6d4d('0x2d')]())['then'](zoho[_0x6d4d('0x2e')]())['then'](realtime[_0x6d4d('0x2f')]())[_0x6d4d('0x1b')](vtiger[_0x6d4d('0x30')]())['then'](realtime['initVtigerAccounts']())[_0x6d4d('0x1b')](freshsales[_0x6d4d('0x31')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x32')]())['then'](servicenow[_0x6d4d('0x33')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x34')]())['then'](dynamics365['getDynamics365Accounts']())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x35')]())[_0x6d4d('0x1b')](campaign[_0x6d4d('0x36')]())['then'](realtime[_0x6d4d('0x37')]())[_0x6d4d('0x1b')](voiceExtension[_0x6d4d('0x38')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x39')]())[_0x6d4d('0x1b')](faxAccount[_0x6d4d('0x3a')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x3b')]())[_0x6d4d('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x6d4d('0x3c')]()[_0x6d4d('0x1b')](voiceQueueReport[_0x6d4d('0x3d')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x3e')]())[_0x6d4d('0x1b')](cmHopperHistory[_0x6d4d('0x3f')]())[_0x6d4d('0x1b')](realtime['initVoiceQueueHopperHistory']())[_0x6d4d('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x6d4d('0x1b')](realtime['initCampaignHopperHistory']())[_0x6d4d('0x1b')](voiceCallReport[_0x6d4d('0x40')]())[_0x6d4d('0x1b')](realtime[_0x6d4d('0x41')]())[_0x6d4d('0x42')](function(_0x34486d){logger[_0x6d4d('0x43')](_0x6d4d('0x44'),util['inspect'](_0x34486d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6d4d('0x45')](realtime,preview,fax)[_0x6d4d('0x1b')](function(){return initRealtime();})[_0x6d4d('0x1b')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6d4d('0x42')](function(_0x2743fc){logger[_0x6d4d('0x43')]('[index.js][main]',util[_0x6d4d('0x46')](_0x2743fc,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x05a9=['getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues'];(function(_0x5e745e,_0xde2931){var _0x122dab=function(_0xe396a5){while(--_0xe396a5){_0x5e745e['push'](_0x5e745e['shift']());}};_0x122dab(++_0xde2931);}(_0x05a9,0xdd));var _0x905a=function(_0x335b17,_0x4777ac){_0x335b17=_0x335b17-0x0;var _0x1c6ec0=_0x05a9[_0x335b17];return _0x1c6ec0;};'use strict';var util=require(_0x905a('0x0'));var moment=require(_0x905a('0x1'));var server=require('./server');var Realtime=require(_0x905a('0x2'));var Report=require('./report');var Acw=require(_0x905a('0x3'));var Trigger=require(_0x905a('0x4'));var Dialer=require(_0x905a('0x5'));var Preview=require(_0x905a('0x6'));var Fax=require(_0x905a('0x7'));var user=require(_0x905a('0x8'));var voiceQueue=require(_0x905a('0x9'));var voiceQueueReport=require(_0x905a('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x905a('0xb'));var template=require(_0x905a('0xc'));var cmHopperHistory=require(_0x905a('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x905a('0xe'));var faxAccount=require(_0x905a('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x905a('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x905a('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x905a('0x12'));var vtiger=require(_0x905a('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x905a('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x905a('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x905a('0x16')](_0x905a('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x905a('0x16')](_0x905a('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x905a('0x18')]()['then'](user['getAgents']())[_0x905a('0x19')](realtime['initAgents']())['then'](user[_0x905a('0x1a')]())[_0x905a('0x19')](realtime[_0x905a('0x1b')]())[_0x905a('0x19')](trunk[_0x905a('0x1c')]())['then'](realtime[_0x905a('0x1d')]())[_0x905a('0x19')](voiceQueue[_0x905a('0x1e')]())[_0x905a('0x19')](realtime['initVoiceQueues']())[_0x905a('0x19')](trigger['getTriggers']())[_0x905a('0x19')](realtime['initTriggers']())[_0x905a('0x19')](template[_0x905a('0x1f')]())['then'](realtime[_0x905a('0x20')]())[_0x905a('0x19')](zendesk['getZendeskAccounts']())[_0x905a('0x19')](realtime['initZendeskAccounts']())[_0x905a('0x19')](salesforce[_0x905a('0x21')]())['then'](realtime[_0x905a('0x22')]())[_0x905a('0x19')](sugarcrm[_0x905a('0x23')]())[_0x905a('0x19')](realtime[_0x905a('0x24')]())['then'](freshdesk[_0x905a('0x25')]())[_0x905a('0x19')](realtime['initFreshdeskAccounts']())[_0x905a('0x19')](desk[_0x905a('0x26')]())[_0x905a('0x19')](realtime[_0x905a('0x27')]())[_0x905a('0x19')](zoho['getZohoAccounts']())[_0x905a('0x19')](realtime['initZohoAccounts']())['then'](vtiger['getVtigerAccounts']())['then'](realtime[_0x905a('0x28')]())[_0x905a('0x19')](freshsales['getFreshsalesAccounts']())[_0x905a('0x19')](realtime['initFreshsalesAccounts']())[_0x905a('0x19')](servicenow[_0x905a('0x29')]())[_0x905a('0x19')](realtime[_0x905a('0x2a')]())[_0x905a('0x19')](dynamics365[_0x905a('0x2b')]())['then'](realtime[_0x905a('0x2c')]())['then'](campaign[_0x905a('0x2d')]())[_0x905a('0x19')](realtime[_0x905a('0x2e')]())['then'](voiceExtension[_0x905a('0x2f')]())['then'](realtime[_0x905a('0x30')]())['then'](faxAccount[_0x905a('0x31')]())[_0x905a('0x19')](realtime[_0x905a('0x32')]())[_0x905a('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x905a('0x18')]()[_0x905a('0x19')](voiceQueueReport[_0x905a('0x33')]())[_0x905a('0x19')](realtime[_0x905a('0x34')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x905a('0x19')](realtime[_0x905a('0x35')]())['then'](cmHopperHistory[_0x905a('0x36')]())['then'](realtime[_0x905a('0x37')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x905a('0x19')](realtime['initVoiceCallReports']())[_0x905a('0x38')](function(_0x3f76ed){logger[_0x905a('0x39')](_0x905a('0x3a'),util[_0x905a('0x3b')](_0x3f76ed,{'showHidden':![],'depth':null}));});}function main(){return server[_0x905a('0x3c')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x905a('0x19')](function(){return initParams();})['then'](function(){report[_0x905a('0x3d')]();setInterval(initRealtime,0x1388);})[_0x905a('0x38')](function(_0x77f2d4){logger[_0x905a('0x39')](_0x905a('0x3e'),util[_0x905a('0x3b')](_0x77f2d4,{'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 d05b911..bda17f1 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 _0x3ee5=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','toLowerCase','not_inuse','idle','inuse','talking','toNumber','format','interface','user:%s','emit','user:ami:update','user:presence','exports','util','moment','../../../config/environment','redis','defaults','localhost'];(function(_0x1185ea,_0x3ec3d8){var _0x52c6f2=function(_0x595d42){while(--_0x595d42){_0x1185ea['push'](_0x1185ea['shift']());}};_0x52c6f2(++_0x3ec3d8);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x37fbe2,_0x4613dc){_0x37fbe2=_0x37fbe2-0x0;var _0x36f7fb=_0x3ee5[_0x37fbe2];return _0x36f7fb;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var moment=require(_0x53ee('0x1'));var Redis=require('ioredis');var config=require(_0x53ee('0x2'));config[_0x53ee('0x3')]=_[_0x53ee('0x4')](config[_0x53ee('0x3')],{'host':_0x53ee('0x5'),'port':0x18eb});var io=require(_0x53ee('0x6'))(new Redis(config[_0x53ee('0x3')]));function Agent(_0x26ea34){this['id']=_0x26ea34['id']||0x0;this[_0x53ee('0x7')]=_0x26ea34[_0x53ee('0x7')]||'';this[_0x53ee('0x8')]=_0x26ea34['email']||'';this[_0x53ee('0x9')]=_0x26ea34[_0x53ee('0x9')]||'';this[_0x53ee('0xa')]=_0x26ea34[_0x53ee('0xa')]||'';this[_0x53ee('0xb')]=_0x53ee('0xc');this[_0x53ee('0xd')]=0x0;this[_0x53ee('0xe')]=_0x53ee('0xc');this[_0x53ee('0xf')]='';this[_0x53ee('0x10')]='';this[_0x53ee('0x11')]='';this['interface']='';this['online']=_0x26ea34[_0x53ee('0x12')]||![];this[_0x53ee('0x13')]=_0x53ee('0xc');this[_0x53ee('0x14')]=0x0;this[_0x53ee('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x53ee('0x16')]=![];}Agent[_0x53ee('0x17')]['updateStatusRealtime']=function(_0x5b40ff){if(!_0x5b40ff[_0x53ee('0xb')]){return;}var _0x1a9dfd=null;var _0x90d870=_0x5b40ff['state'][_0x53ee('0x18')]();switch(_0x90d870){case _0x53ee('0x19'):_0x90d870=_0x53ee('0x1a');break;case _0x53ee('0x1b'):_0x90d870=_0x53ee('0x1c');break;}if(this[_0x53ee('0x13')]!==_0x90d870||_0x5b40ff['statePause']){_0x1a9dfd=_[_0x53ee('0x1d')](moment()[_0x53ee('0x1e')]('x'));}var _0x3d788e={'id':this['id'],'name':this[_0x53ee('0x7')],'email':this[_0x53ee('0x8')],'accountcode':this[_0x53ee('0x9')],'fullname':this[_0x53ee('0xa')],'state':this[_0x53ee('0xb')],'stateTime':this[_0x53ee('0xd')],'status':this[_0x53ee('0xe')],'address':this[_0x53ee('0xf')],'voiceStatus':_0x90d870||this[_0x53ee('0x13')],'voiceStatusTime':_0x1a9dfd||this[_0x53ee('0x14')],'voiceStatusCallerIdNumber':this[_0x53ee('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x53ee('0x1f')],'onhold':this['onhold']};if(this['voiceStatus']!==_0x90d870){this[_0x53ee('0x13')]=_0x90d870;io['to'](util[_0x53ee('0x1e')](_0x53ee('0x20'),_0x3d788e['name']))[_0x53ee('0x21')](_0x53ee('0x22'),_0x3d788e);io[_0x53ee('0x21')](_0x53ee('0x23'),_0x3d788e);}};module[_0x53ee('0x24')]=Agent; \ No newline at end of file +var _0x4a81=['accountcode','fullname','state','status','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','toLowerCase','not_inuse','idle','talking','toNumber','format','user:%s','emit','exports','lodash','util','moment','ioredis','defaults','localhost','socket.io-emitter','name','email'];(function(_0x12e161,_0x222b4d){var _0x4594b5=function(_0x480a56){while(--_0x480a56){_0x12e161['push'](_0x12e161['shift']());}};_0x4594b5(++_0x222b4d);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1761da,_0x5ceb40){_0x1761da=_0x1761da-0x0;var _0x53a968=_0x4a81[_0x1761da];return _0x53a968;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var moment=require(_0x14a8('0x2'));var Redis=require(_0x14a8('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x14a8('0x4')](config['redis'],{'host':_0x14a8('0x5'),'port':0x18eb});var io=require(_0x14a8('0x6'))(new Redis(config['redis']));function Agent(_0x5c04ef){this['id']=_0x5c04ef['id']||0x0;this[_0x14a8('0x7')]=_0x5c04ef['name']||'';this[_0x14a8('0x8')]=_0x5c04ef['email']||'';this[_0x14a8('0x9')]=_0x5c04ef[_0x14a8('0x9')]||'';this[_0x14a8('0xa')]=_0x5c04ef[_0x14a8('0xa')]||'';this[_0x14a8('0xb')]='unknown';this['stateTime']=0x0;this[_0x14a8('0xc')]=_0x14a8('0xd');this[_0x14a8('0xe')]='';this['phone']='';this[_0x14a8('0xf')]='';this[_0x14a8('0x10')]='';this[_0x14a8('0x11')]=_0x5c04ef[_0x14a8('0x11')]||![];this[_0x14a8('0x12')]=_0x14a8('0xd');this[_0x14a8('0x13')]=0x0;this[_0x14a8('0x14')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x14a8('0x15')]=![];}Agent[_0x14a8('0x16')]['updateStatusRealtime']=function(_0x19d25e){if(!_0x19d25e['state']){return;}var _0x3caa0d=null;var _0x3e3c3b=_0x19d25e[_0x14a8('0xb')][_0x14a8('0x17')]();switch(_0x3e3c3b){case _0x14a8('0x18'):_0x3e3c3b=_0x14a8('0x19');break;case'inuse':_0x3e3c3b=_0x14a8('0x1a');break;}if(this[_0x14a8('0x12')]!==_0x3e3c3b||_0x19d25e['statePause']){_0x3caa0d=_[_0x14a8('0x1b')](moment()['format']('x'));}var _0x98e1d5={'id':this['id'],'name':this[_0x14a8('0x7')],'email':this[_0x14a8('0x8')],'accountcode':this[_0x14a8('0x9')],'fullname':this[_0x14a8('0xa')],'state':this[_0x14a8('0xb')],'stateTime':this['stateTime'],'status':this[_0x14a8('0xc')],'address':this[_0x14a8('0xe')],'voiceStatus':_0x3e3c3b||this['voiceStatus'],'voiceStatusTime':_0x3caa0d||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x14a8('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x14a8('0x10')],'onhold':this['onhold']};if(this[_0x14a8('0x12')]!==_0x3e3c3b){this['voiceStatus']=_0x3e3c3b;io['to'](util[_0x14a8('0x1c')](_0x14a8('0x1d'),_0x98e1d5[_0x14a8('0x7')]))[_0x14a8('0x1e')]('user:ami:update',_0x98e1d5);io[_0x14a8('0x1e')]('user:presence',_0x98e1d5);}};module[_0x14a8('0x1f')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3886b78..c030733 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 _0xde44=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x1eaea2,_0x389ec2){var _0x3f1783=function(_0x45fdf3){while(--_0x45fdf3){_0x1eaea2['push'](_0x1eaea2['shift']());}};_0x3f1783(++_0x389ec2);}(_0xde44,0x1c8));var _0x4de4=function(_0x52e24d,_0x28632d){_0x52e24d=_0x52e24d-0x0;var _0x4fd3ac=_0xde44[_0x52e24d];return _0x4fd3ac;};'use strict';function Campaign(_0x5a133b){this['id']=_0x5a133b['id']||0x0;this[_0x4de4('0x0')]=_0x5a133b['name']||'';this[_0x4de4('0x1')]=_0x5a133b['type']||_0x4de4('0x2');this[_0x4de4('0x3')]=0x0;this['temp']=0x0;this[_0x4de4('0x4')]=0x0;this[_0x4de4('0x5')]=0x0;this[_0x4de4('0x6')]='';this[_0x4de4('0x7')]=!![];this[_0x4de4('0x8')]=_0x5a133b[_0x4de4('0x8')];this[_0x4de4('0x9')]=_0x5a133b[_0x4de4('0x9')];this[_0x4de4('0xa')]=_0x5a133b[_0x4de4('0xa')]||null;this[_0x4de4('0xb')]=_0x5a133b[_0x4de4('0xb')]?_0x5a133b[_0x4de4('0xb')]:null;this[_0x4de4('0xc')]=_0x5a133b[_0x4de4('0xc')];this[_0x4de4('0xd')]=_0x5a133b[_0x4de4('0xd')];this[_0x4de4('0xe')]=_0x5a133b[_0x4de4('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x5a133b[_0x4de4('0xf')];this[_0x4de4('0x10')]=_0x5a133b['dialCongestionRetryFrequency'];this[_0x4de4('0x11')]=_0x5a133b['dialBusyMaxRetry'];this[_0x4de4('0x12')]=_0x5a133b['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x5a133b[_0x4de4('0x13')];this['dialNoAnswerRetryFrequency']=_0x5a133b['dialNoAnswerRetryFrequency'];this[_0x4de4('0x14')]=_0x5a133b[_0x4de4('0x14')];this[_0x4de4('0x15')]=_0x5a133b['dialNoSuchNumberMaxRetry']||0x3;this[_0x4de4('0x16')]=_0x5a133b['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4de4('0x17')]=_0x5a133b[_0x4de4('0x17')]||0x3;this['dialDropRetryFrequency']=_0x5a133b[_0x4de4('0x18')]||0x96;this[_0x4de4('0x19')]=_0x5a133b['dialAbandonedMaxRetry']||0x3;this[_0x4de4('0x1a')]=_0x5a133b['dialAbandonedRetryFrequency']||0x96;this[_0x4de4('0x1b')]=_0x5a133b['dialMachineMaxRetry']||0x3;this[_0x4de4('0x1c')]=_0x5a133b[_0x4de4('0x1c')]||0x96;this[_0x4de4('0x1d')]=_0x5a133b[_0x4de4('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5a133b[_0x4de4('0x1e')]||0x96;this[_0x4de4('0x1f')]=_0x5a133b[_0x4de4('0x1f')]||_0x4de4('0x20');this[_0x4de4('0x21')]=_0x5a133b['dialPrefix']||undefined;this[_0x4de4('0x22')]=_0x5a133b[_0x4de4('0x22')]||undefined;this[_0x4de4('0x23')]=_0x5a133b[_0x4de4('0x23')]||undefined;this[_0x4de4('0x24')]=_0x5a133b[_0x4de4('0x24')]?_0x5a133b[_0x4de4('0x24')]:undefined;this[_0x4de4('0x25')]=_0x5a133b['Trunk']?_0x5a133b[_0x4de4('0x25')]:undefined;this[_0x4de4('0x26')]=_0x5a133b[_0x4de4('0x26')]?_0x5a133b['Interval']:undefined;this[_0x4de4('0x27')]=_0x5a133b['SquareProject']?_0x5a133b[_0x4de4('0x27')]:undefined;this[_0x4de4('0x28')]=_0x5a133b['SquareProject']?_0x5a133b['SquareProject'][_0x4de4('0x0')]:undefined;this[_0x4de4('0x29')]=_0x5a133b[_0x4de4('0x29')]||![];this[_0x4de4('0x2a')]=_0x5a133b[_0x4de4('0x2a')];this[_0x4de4('0x2b')]=_0x5a133b[_0x4de4('0x2b')];this[_0x4de4('0x2c')]=_0x5a133b['dialAMDAfterGreetingSilence'];this[_0x4de4('0x2d')]=_0x5a133b[_0x4de4('0x2d')];this[_0x4de4('0x2e')]=_0x5a133b[_0x4de4('0x2e')];this[_0x4de4('0x2f')]=_0x5a133b[_0x4de4('0x2f')];this[_0x4de4('0x30')]=_0x5a133b[_0x4de4('0x30')];this[_0x4de4('0x31')]=_0x5a133b[_0x4de4('0x31')];this['dialAMDMaximumWordLength']=_0x5a133b[_0x4de4('0x32')];}module[_0x4de4('0x33')]=Campaign; \ No newline at end of file +var _0xe9a9=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active'];(function(_0x1e5419,_0x2979d0){var _0x370980=function(_0x549762){while(--_0x549762){_0x1e5419['push'](_0x1e5419['shift']());}};_0x370980(++_0x2979d0);}(_0xe9a9,0x12f));var _0x9e9a=function(_0x5314d9,_0x70585a){_0x5314d9=_0x5314d9-0x0;var _0x145d41=_0xe9a9[_0x5314d9];return _0x145d41;};'use strict';function Campaign(_0x2a1df0){this['id']=_0x2a1df0['id']||0x0;this[_0x9e9a('0x0')]=_0x2a1df0[_0x9e9a('0x0')]||'';this[_0x9e9a('0x1')]=_0x2a1df0[_0x9e9a('0x1')]||_0x9e9a('0x2');this[_0x9e9a('0x3')]=0x0;this[_0x9e9a('0x4')]=0x0;this[_0x9e9a('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x9e9a('0x6')]='';this[_0x9e9a('0x7')]=!![];this[_0x9e9a('0x8')]=_0x2a1df0[_0x9e9a('0x8')];this[_0x9e9a('0x9')]=_0x2a1df0[_0x9e9a('0x9')];this['dialTimezone']=_0x2a1df0[_0x9e9a('0xa')]||null;this[_0x9e9a('0xb')]=_0x2a1df0[_0x9e9a('0xb')]?_0x2a1df0[_0x9e9a('0xb')]:null;this[_0x9e9a('0xc')]=_0x2a1df0[_0x9e9a('0xc')];this[_0x9e9a('0xd')]=_0x2a1df0[_0x9e9a('0xd')];this[_0x9e9a('0xe')]=_0x2a1df0[_0x9e9a('0xe')]||0x1e;this[_0x9e9a('0xf')]=_0x2a1df0[_0x9e9a('0xf')];this[_0x9e9a('0x10')]=_0x2a1df0[_0x9e9a('0x10')];this[_0x9e9a('0x11')]=_0x2a1df0[_0x9e9a('0x11')];this['dialBusyRetryFrequency']=_0x2a1df0[_0x9e9a('0x12')];this[_0x9e9a('0x13')]=_0x2a1df0['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x2a1df0[_0x9e9a('0x14')];this[_0x9e9a('0x15')]=_0x2a1df0[_0x9e9a('0x15')];this[_0x9e9a('0x16')]=_0x2a1df0[_0x9e9a('0x16')]||0x3;this[_0x9e9a('0x17')]=_0x2a1df0[_0x9e9a('0x17')]||0x96;this[_0x9e9a('0x18')]=_0x2a1df0[_0x9e9a('0x18')]||0x3;this[_0x9e9a('0x19')]=_0x2a1df0[_0x9e9a('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x2a1df0[_0x9e9a('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x2a1df0[_0x9e9a('0x1b')]||0x96;this[_0x9e9a('0x1c')]=_0x2a1df0[_0x9e9a('0x1c')]||0x3;this[_0x9e9a('0x1d')]=_0x2a1df0[_0x9e9a('0x1d')]||0x96;this[_0x9e9a('0x1e')]=_0x2a1df0[_0x9e9a('0x1e')]||0x3;this[_0x9e9a('0x1f')]=_0x2a1df0[_0x9e9a('0x1f')]||0x96;this[_0x9e9a('0x20')]=_0x2a1df0[_0x9e9a('0x20')]||_0x9e9a('0x21');this[_0x9e9a('0x22')]=_0x2a1df0['dialPrefix']||undefined;this[_0x9e9a('0x23')]=_0x2a1df0['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9e9a('0x24')]=_0x2a1df0[_0x9e9a('0x24')]||undefined;this[_0x9e9a('0x25')]=_0x2a1df0[_0x9e9a('0x25')]?_0x2a1df0[_0x9e9a('0x25')]:undefined;this[_0x9e9a('0x26')]=_0x2a1df0[_0x9e9a('0x26')]?_0x2a1df0['Trunk']:undefined;this[_0x9e9a('0x27')]=_0x2a1df0[_0x9e9a('0x27')]?_0x2a1df0['Interval']:undefined;this[_0x9e9a('0x28')]=_0x2a1df0['SquareProject']?_0x2a1df0[_0x9e9a('0x28')]:undefined;this[_0x9e9a('0x29')]=_0x2a1df0['SquareProject']?_0x2a1df0[_0x9e9a('0x28')]['name']:undefined;this[_0x9e9a('0x2a')]=_0x2a1df0[_0x9e9a('0x2a')]||![];this[_0x9e9a('0x2b')]=_0x2a1df0[_0x9e9a('0x2b')];this[_0x9e9a('0x2c')]=_0x2a1df0[_0x9e9a('0x2c')];this[_0x9e9a('0x2d')]=_0x2a1df0[_0x9e9a('0x2d')];this[_0x9e9a('0x2e')]=_0x2a1df0[_0x9e9a('0x2e')];this['dialAMDMinWordLength']=_0x2a1df0['dialAMDMinWordLength'];this[_0x9e9a('0x2f')]=_0x2a1df0[_0x9e9a('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x2a1df0[_0x9e9a('0x30')];this[_0x9e9a('0x31')]=_0x2a1df0[_0x9e9a('0x31')];this[_0x9e9a('0x32')]=_0x2a1df0[_0x9e9a('0x32')];}module[_0x9e9a('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7039cbe..1faf97a 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 _0xfd49=['connectedlinenum','connectedlinename','linkedid','answered','answertime','endtime','lastapplication','lastdata','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xfd49,0x91));var _0x9fd4=function(_0xaaffc9,_0x1db33d){_0xaaffc9=_0xaaffc9-0x0;var _0xf447d3=_0xfd49[_0xaaffc9];return _0xf447d3;};'use strict';function Channel(){this[_0x9fd4('0x0')]=null;this[_0x9fd4('0x1')]='';this[_0x9fd4('0x2')]='';this[_0x9fd4('0x3')]=0x0;this[_0x9fd4('0x4')]='';this[_0x9fd4('0x5')]=undefined;this[_0x9fd4('0x6')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0x9fd4('0x7')]=0x0;this['exten']=0x0;this[_0x9fd4('0x8')]=![];this[_0x9fd4('0x9')]=null;this[_0x9fd4('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x9fd4('0xb')]='';this[_0x9fd4('0xc')]='';this[_0x9fd4('0xd')]=0x0;this[_0x9fd4('0xe')]=0x0;this[_0x9fd4('0xf')]=0x0;this['type']=null;this[_0x9fd4('0x10')]=null;this['disposition']=null;this[_0x9fd4('0x11')]=![];this[_0x9fd4('0x12')]=null;this[_0x9fd4('0x13')]=null;this[_0x9fd4('0x14')]=[];this[_0x9fd4('0x15')]=undefined;this[_0x9fd4('0x16')]=undefined;this['transferType']=undefined;this[_0x9fd4('0x17')]=0x0;}module[_0x9fd4('0x18')]=Channel; \ No newline at end of file +var _0x6582=['accountcode','context','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x6582,0x108));var _0x2658=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0x6582[_0x35825e];return _0x4f4d90;};'use strict';function Channel(){this[_0x2658('0x0')]=null;this[_0x2658('0x1')]='';this[_0x2658('0x2')]='';this[_0x2658('0x3')]=0x0;this[_0x2658('0x4')]='';this['connectedlinenum']=undefined;this[_0x2658('0x5')]=undefined;this[_0x2658('0x6')]=0x0;this[_0x2658('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x2658('0x8')]=![];this[_0x2658('0x9')]=null;this[_0x2658('0xa')]=null;this[_0x2658('0xb')]=![];this[_0x2658('0xc')]=![];this[_0x2658('0xd')]='';this['lastdata']='';this[_0x2658('0xe')]=0x0;this[_0x2658('0xf')]=0x0;this[_0x2658('0x10')]=0x0;this[_0x2658('0x11')]=null;this[_0x2658('0x12')]=null;this[_0x2658('0x13')]=null;this[_0x2658('0x14')]=![];this[_0x2658('0x15')]=null;this[_0x2658('0x16')]=null;this['monitors']=[];this[_0x2658('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x2658('0x18')]=undefined;this[_0x2658('0x19')]=0x0;}module[_0x2658('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b069a3d..1ce3716 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 _0x91c6=['consumerSecret','token','type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey'];(function(_0x21f934,_0x4d0bc5){var _0x30dac2=function(_0x22f7c3){while(--_0x22f7c3){_0x21f934['push'](_0x21f934['shift']());}};_0x30dac2(++_0x4d0bc5);}(_0x91c6,0x13a));var _0x691c=function(_0x49e175,_0x4f25d3){_0x49e175=_0x49e175-0x0;var _0x4f3be8=_0x91c6[_0x49e175];return _0x4f3be8;};'use strict';function DeskAccount(_0x1e2b66){this['id']=_0x1e2b66['id']||0x0;this['name']=_0x1e2b66['name']||'';this['username']=_0x1e2b66[_0x691c('0x0')]||'';this['remoteUri']=_0x1e2b66[_0x691c('0x1')]||'';this[_0x691c('0x2')]=_0x1e2b66[_0x691c('0x2')]||'';this['password']=_0x1e2b66[_0x691c('0x3')]||'';this['consumerKey']=_0x1e2b66[_0x691c('0x4')]||'';this[_0x691c('0x5')]=_0x1e2b66[_0x691c('0x5')]||'';this[_0x691c('0x6')]=_0x1e2b66[_0x691c('0x6')]||'';this['tokenSecret']=_0x1e2b66['tokenSecret']||'';this[_0x691c('0x7')]=_0x1e2b66[_0x691c('0x7')]||'';this[_0x691c('0x8')]=_0x1e2b66[_0x691c('0x8')]||'';this[_0x691c('0x9')]=_0x1e2b66['Configurations']||{};}module[_0x691c('0xa')]=DeskAccount; \ No newline at end of file +var _0xb6f5=['token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x33469b,_0x310c2e){var _0x2ed784=function(_0x168ffd){while(--_0x168ffd){_0x33469b['push'](_0x33469b['shift']());}};_0x2ed784(++_0x310c2e);}(_0xb6f5,0x149));var _0x5b6f=function(_0x2bd4e3,_0x4d9b53){_0x2bd4e3=_0x2bd4e3-0x0;var _0x259f7c=_0xb6f5[_0x2bd4e3];return _0x259f7c;};'use strict';function DeskAccount(_0x41bb85){this['id']=_0x41bb85['id']||0x0;this[_0x5b6f('0x0')]=_0x41bb85[_0x5b6f('0x0')]||'';this[_0x5b6f('0x1')]=_0x41bb85[_0x5b6f('0x1')]||'';this[_0x5b6f('0x2')]=_0x41bb85[_0x5b6f('0x2')]||'';this['authType']=_0x41bb85[_0x5b6f('0x3')]||'';this[_0x5b6f('0x4')]=_0x41bb85[_0x5b6f('0x4')]||'';this[_0x5b6f('0x5')]=_0x41bb85[_0x5b6f('0x5')]||'';this[_0x5b6f('0x6')]=_0x41bb85[_0x5b6f('0x6')]||'';this[_0x5b6f('0x7')]=_0x41bb85[_0x5b6f('0x7')]||'';this[_0x5b6f('0x8')]=_0x41bb85[_0x5b6f('0x8')]||'';this['type']=_0x41bb85[_0x5b6f('0x9')]||'';this[_0x5b6f('0xa')]=_0x41bb85[_0x5b6f('0xa')]||'';this['Configurations']=_0x41bb85['Configurations']||{};}module[_0x5b6f('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d70f04d..0f6318d 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 _0xadf8=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xadf8,0x96));var _0x8adf=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0xadf8[_0x42e25e];return _0x1ed3a6;};'use strict';function Dynamics365Account(_0x92c477){this['id']=_0x92c477['id']||0x0;this[_0x8adf('0x0')]=_0x92c477[_0x8adf('0x0')]||'';this[_0x8adf('0x1')]=_0x92c477[_0x8adf('0x1')]||'';this[_0x8adf('0x2')]=_0x92c477[_0x8adf('0x2')]||'';this[_0x8adf('0x3')]=_0x92c477['remoteUri']||'';this[_0x8adf('0x4')]=_0x92c477['tenantId']||'';this['clientId']=_0x92c477[_0x8adf('0x5')]||'';this[_0x8adf('0x6')]=_0x92c477['clientSecret']||{};this[_0x8adf('0x7')]=_0x92c477['serverUrl']||'';this[_0x8adf('0x8')]=_0x92c477[_0x8adf('0x8')]||![];this[_0x8adf('0x9')]=_0x92c477[_0x8adf('0x9')]||{};this[_0x8adf('0xa')]=_0x92c477[_0x8adf('0xa')]||{};}module[_0x8adf('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xfe25=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','remoteUri','tenantId'];(function(_0x1750f1,_0x2c43b0){var _0x1c2624=function(_0x29efe9){while(--_0x29efe9){_0x1750f1['push'](_0x1750f1['shift']());}};_0x1c2624(++_0x2c43b0);}(_0xfe25,0x1d9));var _0x5fe2=function(_0x1e775f,_0x333454){_0x1e775f=_0x1e775f-0x0;var _0x1b350d=_0xfe25[_0x1e775f];return _0x1b350d;};'use strict';function Dynamics365Account(_0x4d1de0){this['id']=_0x4d1de0['id']||0x0;this['name']=_0x4d1de0[_0x5fe2('0x0')]||'';this[_0x5fe2('0x1')]=_0x4d1de0[_0x5fe2('0x1')]||'';this['password']=_0x4d1de0['password']||'';this['remoteUri']=_0x4d1de0[_0x5fe2('0x2')]||'';this[_0x5fe2('0x3')]=_0x4d1de0[_0x5fe2('0x3')]||'';this['clientId']=_0x4d1de0['clientId']||'';this[_0x5fe2('0x4')]=_0x4d1de0[_0x5fe2('0x4')]||{};this[_0x5fe2('0x5')]=_0x4d1de0[_0x5fe2('0x5')]||'';this[_0x5fe2('0x6')]=_0x4d1de0['modernAuthentication']||![];this[_0x5fe2('0x7')]=_0x4d1de0['Configurations']||{};this[_0x5fe2('0x8')]=_0x4d1de0[_0x5fe2('0x8')]||{};}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 026852c..d74bc3f 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 _0x191a=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x85f281,_0x1927fe){var _0xabd153=function(_0x7c774e){while(--_0x7c774e){_0x85f281['push'](_0x85f281['shift']());}};_0xabd153(++_0x1927fe);}(_0x191a,0xaa));var _0xa191=function(_0x9947e1,_0x3b8940){_0x9947e1=_0x9947e1-0x0;var _0x32e6c3=_0x191a[_0x9947e1];return _0x32e6c3;};'use strict';function FaxAccount(_0x51d0ea){this['id']=_0x51d0ea['id']||0x0;this[_0xa191('0x0')]=_0x51d0ea[_0xa191('0x0')]||'';this[_0xa191('0x1')]=_0x51d0ea[_0xa191('0x1')];this[_0xa191('0x2')]=_0x51d0ea[_0xa191('0x2')];this['headerinfo']=_0x51d0ea[_0xa191('0x3')];this[_0xa191('0x4')]=_0x51d0ea[_0xa191('0x4')];this[_0xa191('0x5')]=_0x51d0ea[_0xa191('0x5')]||0x960;this[_0xa191('0x6')]=_0x51d0ea[_0xa191('0x6')]||0x3840;this[_0xa191('0x7')]=_0x51d0ea['modem']||_0xa191('0x8');this[_0xa191('0x9')]=_0x51d0ea[_0xa191('0x9')]||'no';this[_0xa191('0xa')]=_0x51d0ea[_0xa191('0xa')]||'no';this[_0xa191('0xb')]=_0x51d0ea['t38timeout']||0x1388;this['tech']=_0x51d0ea[_0xa191('0xc')]||_0xa191('0xd');this[_0xa191('0xe')]=_0x51d0ea['Trunk']?_0x51d0ea[_0xa191('0xe')]:undefined;this['ListId']=_0x51d0ea['ListId'];this[_0xa191('0xf')]=_0x51d0ea[_0xa191('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xb8d3=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x217665,_0x556dde){var _0x5a4b5e=function(_0x39f4b8){while(--_0x39f4b8){_0x217665['push'](_0x217665['shift']());}};_0x5a4b5e(++_0x556dde);}(_0xb8d3,0x15c));var _0x3b8d=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0xb8d3[_0x387603];return _0x55ea9e;};'use strict';function FaxAccount(_0x1aa242){this['id']=_0x1aa242['id']||0x0;this[_0x3b8d('0x0')]=_0x1aa242[_0x3b8d('0x0')]||'';this[_0x3b8d('0x1')]=_0x1aa242['description'];this[_0x3b8d('0x2')]=_0x1aa242[_0x3b8d('0x2')];this[_0x3b8d('0x3')]=_0x1aa242[_0x3b8d('0x3')];this[_0x3b8d('0x4')]=_0x1aa242[_0x3b8d('0x4')];this[_0x3b8d('0x5')]=_0x1aa242[_0x3b8d('0x5')]||0x960;this[_0x3b8d('0x6')]=_0x1aa242[_0x3b8d('0x6')]||0x3840;this[_0x3b8d('0x7')]=_0x1aa242[_0x3b8d('0x7')]||'v17,v27,v29';this[_0x3b8d('0x8')]=_0x1aa242['gateway']||'no';this[_0x3b8d('0x9')]=_0x1aa242['faxdetect']||'no';this['t38timeout']=_0x1aa242[_0x3b8d('0xa')]||0x1388;this['tech']=_0x1aa242[_0x3b8d('0xb')]||_0x3b8d('0xc');this[_0x3b8d('0xd')]=_0x1aa242[_0x3b8d('0xd')]?_0x1aa242[_0x3b8d('0xd')]:undefined;this[_0x3b8d('0xe')]=_0x1aa242['ListId'];this['key']=_0x1aa242[_0x3b8d('0xf')];}module[_0x3b8d('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index da9a6c6..e247cd6 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 _0x1ebd=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x57f0ba,_0x4a81d1){var _0xd59e3f=function(_0x40f700){while(--_0x40f700){_0x57f0ba['push'](_0x57f0ba['shift']());}};_0xd59e3f(++_0x4a81d1);}(_0x1ebd,0x99));var _0xd1eb=function(_0x2e9383,_0x38b592){_0x2e9383=_0x2e9383-0x0;var _0x461038=_0x1ebd[_0x2e9383];return _0x461038;};'use strict';function FreshdeskAccount(_0x1b4496){this['id']=_0x1b4496['id']||0x0;this[_0xd1eb('0x0')]=_0x1b4496[_0xd1eb('0x0')]||'';this['username']=_0x1b4496['username']||'';this[_0xd1eb('0x1')]=_0x1b4496[_0xd1eb('0x2')]||'';this['remoteUri']=_0x1b4496[_0xd1eb('0x3')]||'';this['serverUrl']=_0x1b4496[_0xd1eb('0x4')]||'';this[_0xd1eb('0x5')]=_0x1b4496[_0xd1eb('0x5')]||{};}module[_0xd1eb('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x497a=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0xaa9958,_0x4a04cf){var _0x4d3863=function(_0x3a4b3d){while(--_0x3a4b3d){_0xaa9958['push'](_0xaa9958['shift']());}};_0x4d3863(++_0x4a04cf);}(_0x497a,0xf0));var _0xa497=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x497a[_0x599f41];return _0x2e4d58;};'use strict';function FreshdeskAccount(_0x25a61f){this['id']=_0x25a61f['id']||0x0;this[_0xa497('0x0')]=_0x25a61f[_0xa497('0x0')]||'';this[_0xa497('0x1')]=_0x25a61f[_0xa497('0x1')]||'';this[_0xa497('0x2')]=_0x25a61f[_0xa497('0x3')]||'';this[_0xa497('0x4')]=_0x25a61f[_0xa497('0x4')]||'';this['serverUrl']=_0x25a61f[_0xa497('0x5')]||'';this[_0xa497('0x6')]=_0x25a61f[_0xa497('0x6')]||{};}module[_0xa497('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index abecfec..ed54210 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 _0xff22=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x43fc45,_0x82ef82){var _0x4bbea0=function(_0x32447a){while(--_0x32447a){_0x43fc45['push'](_0x43fc45['shift']());}};_0x4bbea0(++_0x82ef82);}(_0xff22,0x1a0));var _0x2ff2=function(_0x28308e,_0x9b7bc3){_0x28308e=_0x28308e-0x0;var _0x48590b=_0xff22[_0x28308e];return _0x48590b;};'use strict';function FreshsalesAccount(_0x207439){this['id']=_0x207439['id']||0x0;this[_0x2ff2('0x0')]=_0x207439['name']||'';this[_0x2ff2('0x1')]=_0x207439[_0x2ff2('0x1')]||'';this[_0x2ff2('0x2')]=_0x207439[_0x2ff2('0x3')]||'';this[_0x2ff2('0x4')]=_0x207439[_0x2ff2('0x4')]||'';this[_0x2ff2('0x5')]=_0x207439[_0x2ff2('0x5')]||'';this[_0x2ff2('0x6')]=_0x207439['Configurations']||{};}module[_0x2ff2('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x3937=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x3937,0xbf));var _0x7393=function(_0x4f54e0,_0x106a19){_0x4f54e0=_0x4f54e0-0x0;var _0xf691b7=_0x3937[_0x4f54e0];return _0xf691b7;};'use strict';function FreshsalesAccount(_0x19b457){this['id']=_0x19b457['id']||0x0;this['name']=_0x19b457[_0x7393('0x0')]||'';this[_0x7393('0x1')]=_0x19b457['username']||'';this[_0x7393('0x2')]=_0x19b457['token']||'';this[_0x7393('0x3')]=_0x19b457['remoteUri']||'';this[_0x7393('0x4')]=_0x19b457[_0x7393('0x4')]||'';this[_0x7393('0x5')]=_0x19b457[_0x7393('0x5')]||{};}module[_0x7393('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9fea483..b851320 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 _0xd68b=['queuecallerexit','originalposition','connectedlinenum','accountcode','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','routealias','mohtime','type','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xe0e515,_0x342f1e){var _0x2575f7=function(_0x2e1bcd){while(--_0x2e1bcd){_0xe0e515['push'](_0xe0e515['shift']());}};_0x2575f7(++_0x342f1e);}(_0xd68b,0x12c));var _0xbd68=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0xd68b[_0x377ddf];return _0x5b8465;};'use strict';function QueueReport(){this[_0xbd68('0x0')]='inbound';this['uniqueid']='';this[_0xbd68('0x1')]='';this[_0xbd68('0x2')]='';this[_0xbd68('0x3')]='';this[_0xbd68('0x4')]=null;this[_0xbd68('0x5')]=null;this[_0xbd68('0x6')]=0x1;this[_0xbd68('0x7')]=0x1;this[_0xbd68('0x8')]=![];this[_0xbd68('0x9')]=null;this[_0xbd68('0xa')]=![];this[_0xbd68('0xb')]=null;this[_0xbd68('0xc')]=![];this['queuecallerexitAt']=null;this[_0xbd68('0xd')]=0x1;this['channel']='';this[_0xbd68('0xe')]='';this['connectedlinename']='';this[_0xbd68('0xf')]='';this['context']='';this[_0xbd68('0x10')]='';this[_0xbd68('0x11')]='';this[_0xbd68('0x12')]=0x0;this['assigned']=![];this[_0xbd68('0x13')]='';this[_0xbd68('0x14')]=_0xbd68('0x15');this[_0xbd68('0x16')]=null;this[_0xbd68('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1735=['exten','holdtime','assigned','routealias','mohtime','exports','type','inbound','calleridnum','calleridname','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x1b0a89,_0x5f4f8f){var _0x3800f0=function(_0x2765fb){while(--_0x2765fb){_0x1b0a89['push'](_0x1b0a89['shift']());}};_0x3800f0(++_0x5f4f8f);}(_0x1735,0xb1));var _0x5173=function(_0x22c3cb,_0x4430ef){_0x22c3cb=_0x22c3cb-0x0;var _0x80610c=_0x1735[_0x22c3cb];return _0x80610c;};'use strict';function QueueReport(){this[_0x5173('0x0')]=_0x5173('0x1');this['uniqueid']='';this[_0x5173('0x2')]='';this[_0x5173('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x5173('0x4')]=![];this[_0x5173('0x5')]=null;this[_0x5173('0x6')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x5173('0x7')]=null;this[_0x5173('0x8')]=0x1;this[_0x5173('0x9')]='';this[_0x5173('0xa')]='';this[_0x5173('0xb')]='';this[_0x5173('0xc')]='';this['context']='';this[_0x5173('0xd')]='';this['priority']='';this[_0x5173('0xe')]=0x0;this[_0x5173('0xf')]=![];this['lastAssignedTo']='';this['motionChannel']='voice';this[_0x5173('0x10')]=null;this[_0x5173('0x11')]=0x0;this['variables']={};}module[_0x5173('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 80e00c9..f815eb1 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 _0xafe1=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x45204b,_0x4a3838){var _0x6e889c=function(_0x41a6e5){while(--_0x41a6e5){_0x45204b['push'](_0x45204b['shift']());}};_0x6e889c(++_0x4a3838);}(_0xafe1,0x100));var _0x1afe=function(_0x56a4a4,_0x2e15e5){_0x56a4a4=_0x56a4a4-0x0;var _0x16d910=_0xafe1[_0x56a4a4];return _0x16d910;};'use strict';function SalesforceAccount(_0x55f937){this['id']=_0x55f937['id']||0x0;this[_0x1afe('0x0')]=_0x55f937['name']||'';this[_0x1afe('0x1')]=_0x55f937[_0x1afe('0x1')]||'';this[_0x1afe('0x2')]=_0x55f937[_0x1afe('0x2')]||'';this['password']=_0x55f937[_0x1afe('0x3')]||'';this[_0x1afe('0x4')]=_0x55f937[_0x1afe('0x4')]||'';this[_0x1afe('0x5')]=_0x55f937[_0x1afe('0x5')]||'';this[_0x1afe('0x6')]=_0x55f937[_0x1afe('0x6')]||'';this[_0x1afe('0x7')]=_0x55f937[_0x1afe('0x7')]||_0x1afe('0x8');this[_0x1afe('0x9')]=_0x55f937['serverUrl']||'';this[_0x1afe('0xa')]=_0x55f937[_0x1afe('0xa')]||{};}module[_0x1afe('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x5732=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5732,0x177));var _0x2573=function(_0x2b44a6,_0x56e651){_0x2b44a6=_0x2b44a6-0x0;var _0x47657a=_0x5732[_0x2b44a6];return _0x47657a;};'use strict';function SalesforceAccount(_0x3a1c4d){this['id']=_0x3a1c4d['id']||0x0;this[_0x2573('0x0')]=_0x3a1c4d[_0x2573('0x0')]||'';this[_0x2573('0x1')]=_0x3a1c4d[_0x2573('0x1')]||'';this['remoteUri']=_0x3a1c4d[_0x2573('0x2')]||'';this[_0x2573('0x3')]=_0x3a1c4d['password']||'';this[_0x2573('0x4')]=_0x3a1c4d[_0x2573('0x4')]||'';this[_0x2573('0x5')]=_0x3a1c4d[_0x2573('0x5')]||'';this['securityToken']=_0x3a1c4d[_0x2573('0x6')]||'';this[_0x2573('0x7')]=_0x3a1c4d[_0x2573('0x7')]||'integrationTab';this[_0x2573('0x8')]=_0x3a1c4d['serverUrl']||'';this[_0x2573('0x9')]=_0x3a1c4d[_0x2573('0x9')]||{};}module[_0x2573('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 9d0fd97..5ffe149 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 _0xf670=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xf670,0x196));var _0x0f67=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0xf670[_0x584308];return _0x45865b;};'use strict';function ServicenowAccount(_0xc85b4f){this['id']=_0xc85b4f['id']||0x0;this[_0x0f67('0x0')]=_0xc85b4f[_0x0f67('0x0')]||'';this[_0x0f67('0x1')]=_0xc85b4f[_0x0f67('0x1')]||'';this[_0x0f67('0x2')]=_0xc85b4f[_0x0f67('0x2')]||'';this[_0x0f67('0x3')]=_0xc85b4f[_0x0f67('0x3')]||'';this[_0x0f67('0x4')]=_0xc85b4f[_0x0f67('0x4')]||'';this[_0x0f67('0x5')]=_0xc85b4f[_0x0f67('0x5')]||{};}module[_0x0f67('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x1137=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x16f6a0,_0x3c6808){var _0x1fcc98=function(_0x5db941){while(--_0x5db941){_0x16f6a0['push'](_0x16f6a0['shift']());}};_0x1fcc98(++_0x3c6808);}(_0x1137,0xb7));var _0x7113=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1137[_0x5f309e];return _0x487b5e;};'use strict';function ServicenowAccount(_0x50ba6a){this['id']=_0x50ba6a['id']||0x0;this[_0x7113('0x0')]=_0x50ba6a[_0x7113('0x0')]||'';this[_0x7113('0x1')]=_0x50ba6a[_0x7113('0x1')]||'';this[_0x7113('0x2')]=_0x50ba6a[_0x7113('0x2')]||'';this[_0x7113('0x3')]=_0x50ba6a['remoteUri']||'';this[_0x7113('0x4')]=_0x50ba6a['serverUrl']||'';this[_0x7113('0x5')]=_0x50ba6a['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index bf924c5..ded06d5 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 _0xcfb5=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xcfb5,0x1d4));var _0x5cfb=function(_0x53ec11,_0x45c7fc){_0x53ec11=_0x53ec11-0x0;var _0x637888=_0xcfb5[_0x53ec11];return _0x637888;};'use strict';function SugarcrmAccount(_0x884235){this['id']=_0x884235['id']||0x0;this[_0x5cfb('0x0')]=_0x884235[_0x5cfb('0x0')]||'';this[_0x5cfb('0x1')]=_0x884235[_0x5cfb('0x1')]||'';this['password']=_0x884235[_0x5cfb('0x2')]||'';this[_0x5cfb('0x3')]=_0x884235[_0x5cfb('0x3')]||'';this[_0x5cfb('0x4')]=_0x884235[_0x5cfb('0x4')]||'';this[_0x5cfb('0x5')]=_0x884235[_0x5cfb('0x5')]||{};}module[_0x5cfb('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9042=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1e93d0,_0x4f54d8){var _0x130d19=function(_0x41d504){while(--_0x41d504){_0x1e93d0['push'](_0x1e93d0['shift']());}};_0x130d19(++_0x4f54d8);}(_0x9042,0xf5));var _0x2904=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x9042[_0x568a61];return _0x334c3b;};'use strict';function SugarcrmAccount(_0x4478c9){this['id']=_0x4478c9['id']||0x0;this[_0x2904('0x0')]=_0x4478c9['name']||'';this[_0x2904('0x1')]=_0x4478c9[_0x2904('0x1')]||'';this[_0x2904('0x2')]=_0x4478c9['password']||'';this['remoteUri']=_0x4478c9[_0x2904('0x3')]||'';this[_0x2904('0x4')]=_0x4478c9[_0x2904('0x4')]||'';this[_0x2904('0x5')]=_0x4478c9[_0x2904('0x5')]||{};}module[_0x2904('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index a0679dd..8b8d494 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 _0x987a=['unknown','status','address','exports','name','accountcode'];(function(_0x33ef34,_0x3c2afe){var _0x435c70=function(_0x2aa419){while(--_0x2aa419){_0x33ef34['push'](_0x33ef34['shift']());}};_0x435c70(++_0x3c2afe);}(_0x987a,0x17e));var _0xa987=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x987a[_0x2e4aa2];return _0x5e6092;};'use strict';function Telephone(_0x7d84cb){this['id']=_0x7d84cb['id']||0x0;this[_0xa987('0x0')]=_0x7d84cb[_0xa987('0x0')]||'';this[_0xa987('0x1')]=_0x7d84cb['accountcode']||'';this['state']=_0xa987('0x2');this['stateTime']=0x0;this[_0xa987('0x3')]=_0xa987('0x2');this[_0xa987('0x4')]='';}module[_0xa987('0x5')]=Telephone; \ No newline at end of file +var _0x4cf8=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x8e989b,_0x462c7a){var _0x5b8746=function(_0x431f62){while(--_0x431f62){_0x8e989b['push'](_0x8e989b['shift']());}};_0x5b8746(++_0x462c7a);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x4cf8[_0xb66df];return _0x42a702;};'use strict';function Telephone(_0x1bdc8b){this['id']=_0x1bdc8b['id']||0x0;this[_0x84cf('0x0')]=_0x1bdc8b[_0x84cf('0x0')]||'';this[_0x84cf('0x1')]=_0x1bdc8b[_0x84cf('0x1')]||'';this[_0x84cf('0x2')]=_0x84cf('0x3');this[_0x84cf('0x4')]=0x0;this[_0x84cf('0x5')]=_0x84cf('0x3');this[_0x84cf('0x6')]='';}module[_0x84cf('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e7c591e..c2bb560 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(_0x2c8c6d,_0x1e5cd7){var _0x1e8768=function(_0x114386){while(--_0x114386){_0x2c8c6d['push'](_0x2c8c6d['shift']());}};_0x1e8768(++_0x1e5cd7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bf1e0,_0x1580be){_0x3bf1e0=_0x3bf1e0-0x0;var _0x5a9ded=_0xb10b[_0x3bf1e0];return _0x5a9ded;};'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 _0xb10b=['name','html'];(function(_0x53b6c7,_0x5d1a6b){var _0x3c462b=function(_0x404c97){while(--_0x404c97){_0x53b6c7['push'](_0x53b6c7['shift']());}};_0x3c462b(++_0x5d1a6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xb10b[_0x2b3e7e];return _0x1e24b2;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 31697e8..8118e40 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(_0x20591e,_0x4be7c6){var _0x126a41=function(_0x591b60){while(--_0x591b60){_0x20591e['push'](_0x20591e['shift']());}};_0x126a41(++_0x4be7c6);}(_0x8603,0x190));var _0x3860=function(_0x3d5e7b,_0x5dfb41){_0x3d5e7b=_0x3d5e7b-0x0;var _0x4e0fe7=_0x8603[_0x3d5e7b];return _0x4e0fe7;};'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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 8ed3963..d9f7da5 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 _0xac11=['port','domainport','refresh','defaultuser','exports','active','name','state','stateTime','unknown','registry','indexOf','split','host'];(function(_0x5ec1df,_0x1cc7fc){var _0x40dbbd=function(_0x59c071){while(--_0x59c071){_0x5ec1df['push'](_0x5ec1df['shift']());}};_0x40dbbd(++_0x1cc7fc);}(_0xac11,0x1a9));var _0x1ac1=function(_0x3ae1b,_0x98d5f8){_0x3ae1b=_0x3ae1b-0x0;var _0x22435a=_0xac11[_0x3ae1b];return _0x22435a;};'use strict';function Trunk(_0x40a826){this['id']=_0x40a826['id']||0x0;this[_0x1ac1('0x0')]=_0x40a826[_0x1ac1('0x0')]||![];this['name']=_0x40a826[_0x1ac1('0x1')]||'';this[_0x1ac1('0x2')]='unknown';this[_0x1ac1('0x3')]=0x0;this['status']=_0x1ac1('0x4');this['registry']=_0x40a826[_0x1ac1('0x5')]&&_0x40a826[_0x1ac1('0x5')][_0x1ac1('0x6')](':')?_0x40a826['registry'][_0x1ac1('0x7')](':')[0x0]:'';this[_0x1ac1('0x8')]='';this[_0x1ac1('0x9')]='';this['domain']='';this[_0x1ac1('0xa')]='';this[_0x1ac1('0xb')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';this['defaultuser']=_0x40a826[_0x1ac1('0xc')]||'';}module[_0x1ac1('0xd')]=Trunk; \ No newline at end of file +var _0xe3f7=['name','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','registrationtime','defaultuser','exports','active'];(function(_0x137da3,_0xa6277a){var _0x1ac46c=function(_0x49e68b){while(--_0x49e68b){_0x137da3['push'](_0x137da3['shift']());}};_0x1ac46c(++_0xa6277a);}(_0xe3f7,0xa4));var _0x7e3f=function(_0x10bead,_0x25e36b){_0x10bead=_0x10bead-0x0;var _0x4d239c=_0xe3f7[_0x10bead];return _0x4d239c;};'use strict';function Trunk(_0xc538d8){this['id']=_0xc538d8['id']||0x0;this[_0x7e3f('0x0')]=_0xc538d8[_0x7e3f('0x0')]||![];this[_0x7e3f('0x1')]=_0xc538d8[_0x7e3f('0x1')]||'';this['state']=_0x7e3f('0x2');this[_0x7e3f('0x3')]=0x0;this[_0x7e3f('0x4')]='unknown';this['registry']=_0xc538d8['registry']&&_0xc538d8[_0x7e3f('0x5')][_0x7e3f('0x6')](':')?_0xc538d8[_0x7e3f('0x5')][_0x7e3f('0x7')](':')[0x0]:'';this[_0x7e3f('0x8')]='';this['port']='';this[_0x7e3f('0x9')]='';this[_0x7e3f('0xa')]='';this[_0x7e3f('0xb')]='';this['stateRegistry']=_0x7e3f('0x2');this[_0x7e3f('0xc')]='';this['address']='';this[_0x7e3f('0xd')]=_0xc538d8['defaultuser']||'';}module[_0x7e3f('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1ac4952..bf45b74 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 _0x0cfd=['recordingFormat','none','mandatoryDisposition','exports'];(function(_0x337976,_0x52fc92){var _0x1026cc=function(_0xb65748){while(--_0xb65748){_0x337976['push'](_0x337976['shift']());}};_0x1026cc(++_0x52fc92);}(_0x0cfd,0x13c));var _0xd0cf=function(_0x1f363e,_0x48eb87){_0x1f363e=_0x1f363e-0x0;var _0x4d3eea=_0x0cfd[_0x1f363e];return _0x4d3eea;};'use strict';function voiceExtension(_0x161bd2){this['id']=_0x161bd2['id']||0x0;this['exten']=_0x161bd2['exten']||'';this[_0xd0cf('0x0')]=_0x161bd2[_0xd0cf('0x0')]||_0xd0cf('0x1');this['mandatoryDisposition']=_0x161bd2[_0xd0cf('0x2')]||![];}module[_0xd0cf('0x3')]=voiceExtension; \ No newline at end of file +var _0xfc7d=['mandatoryDisposition','recordingFormat','none'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xfc7d,0x169));var _0xdfc7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfc7d[_0x3ab51d];return _0x29a04e;};'use strict';function voiceExtension(_0x5ca51e){this['id']=_0x5ca51e['id']||0x0;this['exten']=_0x5ca51e['exten']||'';this[_0xdfc7('0x0')]=_0x5ca51e['recordingFormat']||_0xdfc7('0x1');this[_0xdfc7('0x2')]=_0x5ca51e[_0xdfc7('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c278152..8b75162 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 _0xf9d5=['predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','acw','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls'];(function(_0x4d6624,_0x78b606){var _0x5dbb01=function(_0x54356e){while(--_0x54356e){_0x4d6624['push'](_0x4d6624['shift']());}};_0x5dbb01(++_0x78b606);}(_0xf9d5,0x122));var _0x5f9d=function(_0x7f99bd,_0x1f8654){_0x7f99bd=_0x7f99bd-0x0;var _0x24994d=_0xf9d5[_0x7f99bd];return _0x24994d;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x5f9d('0x0'),'gsm':_0x5f9d('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x5f9d('0x2'),'linear':_0x5f9d('0x3'),'random':_0x5f9d('0x4'),'ringall':_0x5f9d('0x5'),'rr':_0x5f9d('0x6'),'rrmemory':_0x5f9d('0x7'),'rrordered':_0x5f9d('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x1fc74c){this['id']=_0x1fc74c['id']||0x0;this['name']=_0x1fc74c[_0x5f9d('0x9')]||'';this[_0x5f9d('0xa')]=_0x1fc74c['monitor_format']||'';this[_0x5f9d('0xb')]=_0x1fc74c[_0x5f9d('0xb')]||_0x5f9d('0xc');this[_0x5f9d('0xd')]=0x0;this[_0x5f9d('0xe')]=0x0;this[_0x5f9d('0xf')]=0x0;this['sumDuration']=0x0;this[_0x5f9d('0x10')]=0x0;this[_0x5f9d('0x11')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x5f9d('0x12')]=0x0;this[_0x5f9d('0x13')]=0x0;this[_0x5f9d('0x14')]=0x0;this['invalid']=0x0;this[_0x5f9d('0x15')]=0x0;this[_0x5f9d('0x16')]=0x0;this[_0x5f9d('0x17')]=0x0;this[_0x5f9d('0x18')]=0x0;this['ringing']=0x0;this[_0x5f9d('0x19')]=0x0;this[_0x5f9d('0x1a')]=0x0;this[_0x5f9d('0x1b')]=0x0;this['unknown']=0x0;this[_0x5f9d('0x1c')]=_0x1fc74c[_0x5f9d('0x1c')]||![];this['acwTimeout']=_0x1fc74c['acwTimeout']||0xa;this[_0x5f9d('0x1d')]=_0x1fc74c[_0x5f9d('0x1d')]||'no';this[_0x5f9d('0x1e')]=!![];this[_0x5f9d('0x1f')]='';this[_0x5f9d('0x20')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x1fc74c[_0x5f9d('0x21')]||null;this['dialGlobalInterval']=_0x1fc74c[_0x5f9d('0x22')]?_0x1fc74c['dialGlobalInterval']:null;this[_0x5f9d('0x23')]=_0x1fc74c[_0x5f9d('0x23')];this[_0x5f9d('0x24')]=_0x1fc74c['dialMethod']||_0x5f9d('0x25');this[_0x5f9d('0x26')]=_0x1fc74c[_0x5f9d('0x26')]||0x0;this[_0x5f9d('0x27')]=_0x1fc74c[_0x5f9d('0x27')]||0x0;this[_0x5f9d('0x28')]=_0x1fc74c[_0x5f9d('0x28')]||0x1;this[_0x5f9d('0x29')]=_0x1fc74c[_0x5f9d('0x29')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x1fc74c['dialPredictiveOptimizationPercentage']||0.03;this[_0x5f9d('0x2a')]=_0x1fc74c['dialPredictiveInterval']||0x258;this[_0x5f9d('0x2b')]=_0x1fc74c['dialOriginateCallerIdName']||_0x5f9d('0x2c');this['dialOriginateCallerIdNumber']=_0x1fc74c['dialOriginateCallerIdNumber']||'anonymous';this[_0x5f9d('0x2d')]=_0x1fc74c[_0x5f9d('0x2d')]||0x1e;this[_0x5f9d('0x2e')]=_0x1fc74c[_0x5f9d('0x2e')]||'tTxX';this[_0x5f9d('0x2f')]=_0x1fc74c[_0x5f9d('0x2f')]||0x3;this[_0x5f9d('0x30')]=_0x1fc74c[_0x5f9d('0x30')]||undefined;this[_0x5f9d('0x31')]=_0x1fc74c[_0x5f9d('0x31')]||0x3;this[_0x5f9d('0x32')]=_0x1fc74c[_0x5f9d('0x32')]||0x96;this[_0x5f9d('0x33')]=_0x1fc74c[_0x5f9d('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x1fc74c[_0x5f9d('0x34')]||0x96;this[_0x5f9d('0x35')]=_0x1fc74c[_0x5f9d('0x35')]||0x3;this[_0x5f9d('0x36')]=_0x1fc74c[_0x5f9d('0x36')]||0x96;this[_0x5f9d('0x37')]=_0x1fc74c[_0x5f9d('0x37')]||0x3;this[_0x5f9d('0x38')]=_0x1fc74c[_0x5f9d('0x38')]||0x96;this['dialDropMaxRetry']=_0x1fc74c['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1fc74c[_0x5f9d('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x1fc74c[_0x5f9d('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x1fc74c[_0x5f9d('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x1fc74c[_0x5f9d('0x3c')]||0x3;this[_0x5f9d('0x3d')]=_0x1fc74c[_0x5f9d('0x3d')]||0x96;this[_0x5f9d('0x3e')]=_0x1fc74c[_0x5f9d('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1fc74c[_0x5f9d('0x3f')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1fc74c[_0x5f9d('0x40')]||0x3;this['dialGlobalMaxRetry']=_0x1fc74c[_0x5f9d('0x41')]||0x4;this[_0x5f9d('0x42')]=_0x1fc74c['Trunk']?_0x1fc74c[_0x5f9d('0x42')]:undefined;this[_0x5f9d('0x43')]=_0x1fc74c[_0x5f9d('0x43')]?_0x1fc74c['TrunkBackup']:undefined;this[_0x5f9d('0x44')]=_0x1fc74c[_0x5f9d('0x44')]||undefined;this[_0x5f9d('0x45')]=_0x1fc74c[_0x5f9d('0x45')]?_0x1fc74c[_0x5f9d('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x1fc74c[_0x5f9d('0x46')]||_0x5f9d('0x47');this[_0x5f9d('0x48')]=_0x1fc74c[_0x5f9d('0x48')]||undefined;this[_0x5f9d('0x49')]=_0x1fc74c[_0x5f9d('0x49')]||undefined;this['strategy']=strategy[_0x1fc74c[_0x5f9d('0x4a')]];this[_0x5f9d('0x4b')]=!![];this[_0x5f9d('0x4c')]=_0x1fc74c['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x1fc74c[_0x5f9d('0x4d')];this[_0x5f9d('0x4e')]=_0x1fc74c[_0x5f9d('0x4e')];this[_0x5f9d('0x4f')]=_0x1fc74c[_0x5f9d('0x4f')];this['dialAMDTotalAnalysisTime']=_0x1fc74c['dialAMDTotalAnalysisTime'];this[_0x5f9d('0x50')]=_0x1fc74c[_0x5f9d('0x50')];this['dialAMDBetweenWordsSilence']=_0x1fc74c[_0x5f9d('0x51')];this['dialAMDMaximumNumberOfWords']=_0x1fc74c[_0x5f9d('0x52')];this[_0x5f9d('0x53')]=_0x1fc74c['dialAMDSilenceThreshold'];this[_0x5f9d('0x54')]=_0x1fc74c[_0x5f9d('0x54')];this[_0x5f9d('0x55')]=0x0;this['pTalking']=0x0;this[_0x5f9d('0x56')]=_0x1fc74c[_0x5f9d('0x56')];this[_0x5f9d('0x57')]=0x0;this[_0x5f9d('0x58')]=0x0;this[_0x5f9d('0x59')]=0x0;this[_0x5f9d('0x5a')]=0x0;this[_0x5f9d('0x5b')]=0x0;this[_0x5f9d('0x5c')]=0x0;this[_0x5f9d('0x5d')]=0x0;this[_0x5f9d('0x5e')]=0x0;this[_0x5f9d('0x5f')]=0x0;this[_0x5f9d('0x60')]=0x0;this[_0x5f9d('0x61')]=0x0;this[_0x5f9d('0x62')]=0x0;this[_0x5f9d('0x63')]=0x0;this[_0x5f9d('0x64')]=0x0;this[_0x5f9d('0x65')]=undefined;this[_0x5f9d('0x66')]=undefined;this[_0x5f9d('0x67')]=undefined;this[_0x5f9d('0x68')]=1.05;this[_0x5f9d('0x69')]=0x0;this[_0x5f9d('0x6a')]=0x0;this[_0x5f9d('0x6b')]=0x0;this[_0x5f9d('0x6c')]=0x0;this[_0x5f9d('0x6d')]=0x0;this[_0x5f9d('0x6e')]=0x0;this[_0x5f9d('0x6f')]=0x0;this[_0x5f9d('0x70')]=0x0;this[_0x5f9d('0x71')]=_0x1fc74c[_0x5f9d('0x72')]||0x14;this['predictiveIntervalMinThreshold']=_0x1fc74c[_0x5f9d('0x72')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x5f9d('0x73')]=0x0;this[_0x5f9d('0x74')]=0x1;this[_0x5f9d('0x75')]=0x0;this[_0x5f9d('0x76')]=0x0;this[_0x5f9d('0x77')]=0x0;this[_0x5f9d('0x78')]=0x0;this[_0x5f9d('0x79')]=_0x1fc74c['dialRecallMeTimeout']||0x1e;this[_0x5f9d('0x7a')]=_0x1fc74c[_0x5f9d('0x7a')]||![];this[_0x5f9d('0x7b')]=!!_0x1fc74c['dialPreviewAutoRecallMe']||![];this[_0x5f9d('0x7c')]=!!_0x1fc74c['dialPreviewRecallmeReminder']||![];this[_0x5f9d('0x7d')]=_0x1fc74c[_0x5f9d('0x7d')]||undefined;this[_0x5f9d('0x7e')]=_0x1fc74c['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x1fc74c[_0x5f9d('0x7f')]||![];this[_0x5f9d('0xa')]=monitorFormat[_0x1fc74c['monitor_format']]?monitorFormat[_0x1fc74c[_0x5f9d('0xa')]]:undefined;this['mandatoryDisposition']=_0x1fc74c[_0x5f9d('0x80')]||![];this[_0x5f9d('0x81')]=_0x1fc74c[_0x5f9d('0x81')]?_0x1fc74c[_0x5f9d('0x81')]:undefined;this[_0x5f9d('0x82')]=![];}module[_0x5f9d('0x83')]=VoiceQueue; \ No newline at end of file +var _0x0a6b=['outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','wav','leastrecent','random','ringall','roundrobin','rrordered','name','monitor_format','type','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit'];(function(_0x1fc229,_0x56e71f){var _0x578509=function(_0xadf161){while(--_0xadf161){_0x1fc229['push'](_0x1fc229['shift']());}};_0x578509(++_0x56e71f);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x36f462,_0x1b611a){_0x36f462=_0x36f462-0x0;var _0x4c30d3=_0x0a6b[_0x36f462];return _0x4c30d3;};'use strict';var monitorFormat={'wav':_0xb0a6('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xb0a6('0x1'),'linear':'linear','random':_0xb0a6('0x2'),'ringall':_0xb0a6('0x3'),'rr':_0xb0a6('0x4'),'rrmemory':'rrmemory','rrordered':_0xb0a6('0x5'),'wrandom':'wrandom'};function VoiceQueue(_0xbbdf89){this['id']=_0xbbdf89['id']||0x0;this[_0xb0a6('0x6')]=_0xbbdf89['name']||'';this[_0xb0a6('0x7')]=_0xbbdf89[_0xb0a6('0x7')]||'';this[_0xb0a6('0x8')]=_0xbbdf89['type']||'inbound';this['waiting']=0x0;this[_0xb0a6('0x9')]=0x0;this[_0xb0a6('0xa')]=0x0;this[_0xb0a6('0xb')]=0x0;this[_0xb0a6('0xc')]=0x0;this['sumBillable']=0x0;this[_0xb0a6('0xd')]=0x0;this[_0xb0a6('0xe')]=0x0;this['available']=0x0;this[_0xb0a6('0xf')]=0x0;this[_0xb0a6('0x10')]=0x0;this[_0xb0a6('0x11')]=0x0;this[_0xb0a6('0x12')]=0x0;this[_0xb0a6('0x13')]=0x0;this[_0xb0a6('0x14')]=0x0;this[_0xb0a6('0x15')]=0x0;this[_0xb0a6('0x16')]=0x0;this[_0xb0a6('0x17')]=0x0;this[_0xb0a6('0x18')]=0x0;this['unavailable']=0x0;this[_0xb0a6('0x19')]=0x0;this['acw']=_0xbbdf89[_0xb0a6('0x1a')]||![];this['acwTimeout']=_0xbbdf89[_0xb0a6('0x1b')]||0xa;this['autopause']=_0xbbdf89[_0xb0a6('0x1c')]||'no';this[_0xb0a6('0x1d')]=!![];this[_0xb0a6('0x1e')]='';this['statusMessage']='';this['originated']=0x0;this[_0xb0a6('0x1f')]=0x0;this[_0xb0a6('0x20')]=_0xbbdf89[_0xb0a6('0x20')]||null;this[_0xb0a6('0x21')]=_0xbbdf89[_0xb0a6('0x21')]?_0xbbdf89[_0xb0a6('0x21')]:null;this['dialActive']=_0xbbdf89[_0xb0a6('0x22')];this[_0xb0a6('0x23')]=_0xbbdf89[_0xb0a6('0x23')]||_0xb0a6('0x24');this[_0xb0a6('0x25')]=_0xbbdf89[_0xb0a6('0x25')]||0x0;this['dialLimitQueue']=_0xbbdf89[_0xb0a6('0x26')]||0x0;this[_0xb0a6('0x27')]=_0xbbdf89[_0xb0a6('0x27')]||0x1;this[_0xb0a6('0x28')]=_0xbbdf89[_0xb0a6('0x28')]||_0xb0a6('0x29');this[_0xb0a6('0x2a')]=_0xbbdf89[_0xb0a6('0x2a')]||0.03;this['dialPredictiveInterval']=_0xbbdf89[_0xb0a6('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0xbbdf89[_0xb0a6('0x2c')]||_0xb0a6('0x2d');this['dialOriginateCallerIdNumber']=_0xbbdf89['dialOriginateCallerIdNumber']||_0xb0a6('0x2d');this[_0xb0a6('0x2e')]=_0xbbdf89['dialOriginateTimeout']||0x1e;this[_0xb0a6('0x2f')]=_0xbbdf89[_0xb0a6('0x2f')]||_0xb0a6('0x30');this[_0xb0a6('0x31')]=_0xbbdf89['dialQueueTimeout']||0x3;this['dialQueueProject']=_0xbbdf89[_0xb0a6('0x32')]||undefined;this[_0xb0a6('0x33')]=_0xbbdf89[_0xb0a6('0x33')]||0x3;this['dialCongestionRetryFrequency']=_0xbbdf89[_0xb0a6('0x34')]||0x96;this[_0xb0a6('0x35')]=_0xbbdf89[_0xb0a6('0x35')]||0x3;this[_0xb0a6('0x36')]=_0xbbdf89[_0xb0a6('0x36')]||0x96;this[_0xb0a6('0x37')]=_0xbbdf89[_0xb0a6('0x37')]||0x3;this[_0xb0a6('0x38')]=_0xbbdf89[_0xb0a6('0x38')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xbbdf89[_0xb0a6('0x39')]||0x3;this[_0xb0a6('0x3a')]=_0xbbdf89[_0xb0a6('0x3a')]||0x96;this['dialDropMaxRetry']=_0xbbdf89[_0xb0a6('0x3b')]||0x3;this['dialDropRetryFrequency']=_0xbbdf89[_0xb0a6('0x3c')]||0x96;this[_0xb0a6('0x3d')]=_0xbbdf89[_0xb0a6('0x3d')]||0x3;this[_0xb0a6('0x3e')]=_0xbbdf89[_0xb0a6('0x3e')]||0x96;this[_0xb0a6('0x3f')]=_0xbbdf89[_0xb0a6('0x3f')]||0x3;this[_0xb0a6('0x40')]=_0xbbdf89[_0xb0a6('0x40')]||0x96;this[_0xb0a6('0x41')]=_0xbbdf89['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0xbbdf89[_0xb0a6('0x42')]||0x96;this[_0xb0a6('0x43')]=_0xbbdf89[_0xb0a6('0x43')]||0x3;this[_0xb0a6('0x44')]=_0xbbdf89[_0xb0a6('0x44')]||0x4;this[_0xb0a6('0x45')]=_0xbbdf89[_0xb0a6('0x45')]?_0xbbdf89[_0xb0a6('0x45')]:undefined;this['TrunkBackup']=_0xbbdf89[_0xb0a6('0x46')]?_0xbbdf89[_0xb0a6('0x46')]:undefined;this['dialPrefix']=_0xbbdf89[_0xb0a6('0x47')]||undefined;this[_0xb0a6('0x48')]=_0xbbdf89['Interval']?_0xbbdf89['Interval']:undefined;this[_0xb0a6('0x49')]=_0xbbdf89[_0xb0a6('0x49')]||_0xb0a6('0x4a');this[_0xb0a6('0x4b')]=_0xbbdf89[_0xb0a6('0x4b')]||undefined;this[_0xb0a6('0x4c')]=_0xbbdf89['dialCutDigit']||undefined;this[_0xb0a6('0x4d')]=strategy[_0xbbdf89['strategy']];this[_0xb0a6('0x4e')]=!![];this[_0xb0a6('0x4f')]=_0xbbdf89['dialAMDActive']||![];this['dialAMDInitialSilence']=_0xbbdf89['dialAMDInitialSilence'];this[_0xb0a6('0x50')]=_0xbbdf89[_0xb0a6('0x50')];this[_0xb0a6('0x51')]=_0xbbdf89[_0xb0a6('0x51')];this[_0xb0a6('0x52')]=_0xbbdf89['dialAMDTotalAnalysisTime'];this[_0xb0a6('0x53')]=_0xbbdf89[_0xb0a6('0x53')];this[_0xb0a6('0x54')]=_0xbbdf89[_0xb0a6('0x54')];this['dialAMDMaximumNumberOfWords']=_0xbbdf89[_0xb0a6('0x55')];this[_0xb0a6('0x56')]=_0xbbdf89[_0xb0a6('0x56')];this[_0xb0a6('0x57')]=_0xbbdf89[_0xb0a6('0x57')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xb0a6('0x58')]=_0xbbdf89[_0xb0a6('0x58')];this[_0xb0a6('0x59')]=0x0;this[_0xb0a6('0x5a')]=0x0;this[_0xb0a6('0x5b')]=0x0;this[_0xb0a6('0x5c')]=0x0;this[_0xb0a6('0x5d')]=0x0;this[_0xb0a6('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xb0a6('0x5f')]=0x0;this[_0xb0a6('0x60')]=0x0;this[_0xb0a6('0x61')]=0x0;this[_0xb0a6('0x62')]=0x0;this[_0xb0a6('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0xb0a6('0x64')]=0x0;this['startProgressive']=undefined;this[_0xb0a6('0x65')]=undefined;this['handlePredictive']=undefined;this[_0xb0a6('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xb0a6('0x67')]=0x0;this[_0xb0a6('0x68')]=0x0;this[_0xb0a6('0x69')]=0x0;this[_0xb0a6('0x6a')]=0x0;this[_0xb0a6('0x6b')]=0x0;this[_0xb0a6('0x6c')]=0x0;this[_0xb0a6('0x6d')]=0x0;this[_0xb0a6('0x6e')]=_0xbbdf89[_0xb0a6('0x6f')]||0x14;this[_0xb0a6('0x70')]=_0xbbdf89[_0xb0a6('0x6f')]||0xa;this[_0xb0a6('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xb0a6('0x72')]=0x1;this[_0xb0a6('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0xb0a6('0x74')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb0a6('0x75')]=_0xbbdf89[_0xb0a6('0x75')]||0x1e;this[_0xb0a6('0x76')]=_0xbbdf89['dialRecallInQueue']||![];this[_0xb0a6('0x77')]=!!_0xbbdf89[_0xb0a6('0x77')]||![];this[_0xb0a6('0x78')]=!!_0xbbdf89[_0xb0a6('0x78')]||![];this[_0xb0a6('0x79')]=_0xbbdf89[_0xb0a6('0x79')]||undefined;this[_0xb0a6('0x7a')]=_0xbbdf89[_0xb0a6('0x7a')]||![];this['dialAgiAfterHangupAgent']=_0xbbdf89[_0xb0a6('0x7b')]||![];this[_0xb0a6('0x7')]=monitorFormat[_0xbbdf89[_0xb0a6('0x7')]]?monitorFormat[_0xbbdf89[_0xb0a6('0x7')]]:undefined;this['mandatoryDisposition']=_0xbbdf89['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0xbbdf89['mandatoryDispositionPause']?_0xbbdf89['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 147dd67..eb55f68 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf7=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','incall','status','dialMethod','booked','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','message','updateReportFromOutboundQueue','answered','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialOriginateCallerIdName'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x442f11,_0x31e94f){_0x442f11=_0x442f11-0x0;var _0x306c90=_0xdbf7[_0x442f11];return _0x306c90;};'use strict';var INBOUND_COUNTERS=[_0x7dbf('0x0'),_0x7dbf('0x1'),_0x7dbf('0x2'),_0x7dbf('0x3'),_0x7dbf('0x4'),_0x7dbf('0x5'),_0x7dbf('0x6')];var OUTBOUND_COUNTERS=[_0x7dbf('0x0'),'answered',_0x7dbf('0x7'),'loggedIn','loggedInDb',_0x7dbf('0x8'),_0x7dbf('0x9'),_0x7dbf('0xa'),_0x7dbf('0xb'),_0x7dbf('0xc'),_0x7dbf('0xd'),_0x7dbf('0xe'),_0x7dbf('0xf'),_0x7dbf('0x10'),_0x7dbf('0x11'),_0x7dbf('0x12'),_0x7dbf('0x3'),_0x7dbf('0x13'),_0x7dbf('0x5'),_0x7dbf('0x14'),'sumDuration',_0x7dbf('0x15'),_0x7dbf('0x6')];function VoiceQueueSummary(_0xdb72b0){this['id']=_0xdb72b0['id'];this[_0x7dbf('0x16')]=_0xdb72b0[_0x7dbf('0x16')];this[_0x7dbf('0x17')]=_0xdb72b0['strategy'];this[_0x7dbf('0x18')]=_0xdb72b0['abandoned']||0x0;this['answered']=_0xdb72b0['answered']||0x0;this['available']=_0xdb72b0[_0x7dbf('0x0')]||0x0;this[_0x7dbf('0x19')]=_0xdb72b0[_0x7dbf('0x19')]||0x0;this['inUse']=_0xdb72b0[_0x7dbf('0x7')]||0x0;this[_0x7dbf('0x1a')]=_0xdb72b0[_0x7dbf('0x1a')]||0x0;this['loggedIn']=_0xdb72b0[_0x7dbf('0x1')]||0x0;this[_0x7dbf('0x2')]=_0xdb72b0[_0x7dbf('0x2')]||0x0;this[_0x7dbf('0x1b')]=_0xdb72b0[_0x7dbf('0x1b')]||0x0;this[_0x7dbf('0x1c')]=_0xdb72b0[_0x7dbf('0x1c')]||0x0;this['paused']=_0xdb72b0[_0x7dbf('0x3')]||0x0;this['ringing']=_0xdb72b0[_0x7dbf('0x4')]||0x0;this['ringInUse']=_0xdb72b0[_0x7dbf('0x1d')];this[_0x7dbf('0x14')]=_0xdb72b0[_0x7dbf('0x14')];this[_0x7dbf('0x1e')]=_0xdb72b0['sumDuration'];this[_0x7dbf('0x1f')]=_0xdb72b0[_0x7dbf('0x1f')]||0x0;this[_0x7dbf('0x5')]=_0xdb72b0['talking']||0x0;this[_0x7dbf('0x15')]=_0xdb72b0[_0x7dbf('0x15')]||0x0;this[_0x7dbf('0x20')]=_0xdb72b0[_0x7dbf('0x20')];this[_0x7dbf('0x21')]=_0xdb72b0['unavailable']||0x0;this[_0x7dbf('0x22')]=_0xdb72b0[_0x7dbf('0x22')]||0x0;this[_0x7dbf('0x23')]=_0xdb72b0[_0x7dbf('0x23')]||0x0;this['waiting']=_0xdb72b0[_0x7dbf('0x6')]||0x0;if(_0xdb72b0[_0x7dbf('0x20')]===_0x7dbf('0x24')){this[_0x7dbf('0x13')]=_0xdb72b0[_0x7dbf('0x13')]||0x0;this[_0x7dbf('0x25')]=_0xdb72b0[_0x7dbf('0x25')];this['dialMethod']=_0xdb72b0['dialMethod'];this[_0x7dbf('0x26')]=_0xdb72b0[_0x7dbf('0x26')];this['dialOriginateCallerIdNumber']=_0xdb72b0[_0x7dbf('0x27')];this[_0x7dbf('0x28')]=_0xdb72b0[_0x7dbf('0x28')];this[_0x7dbf('0x29')]=_0xdb72b0['dialPrefix'];this[_0x7dbf('0x2a')]=_0xdb72b0['temp'];this[_0x7dbf('0x2b')]=_0xdb72b0['outboundAnswerAgiCallsDay'];this[_0x7dbf('0xa')]=_0xdb72b0[_0x7dbf('0xa')];this[_0x7dbf('0xb')]=_0xdb72b0[_0x7dbf('0xb')];this[_0x7dbf('0xc')]=_0xdb72b0[_0x7dbf('0xc')];this[_0x7dbf('0xd')]=_0xdb72b0[_0x7dbf('0xd')];this[_0x7dbf('0x2c')]=_0xdb72b0[_0x7dbf('0x2c')];this[_0x7dbf('0x2d')]=_0xdb72b0[_0x7dbf('0x2d')];this[_0x7dbf('0x2e')]=_0xdb72b0[_0x7dbf('0x2e')];this[_0x7dbf('0xe')]=_0xdb72b0['outboundNoAnswerCallsDay'];this[_0x7dbf('0xf')]=_0xdb72b0[_0x7dbf('0xf')];this[_0x7dbf('0x2f')]=_0xdb72b0[_0x7dbf('0x2f')];this[_0x7dbf('0x10')]=_0xdb72b0['outboundReCallsDay'];this[_0x7dbf('0x11')]=_0xdb72b0[_0x7dbf('0x11')];this[_0x7dbf('0x12')]=_0xdb72b0[_0x7dbf('0x12')];this[_0x7dbf('0x30')]=_0xdb72b0['predictiveIntervalAnsweredCalls'];this[_0x7dbf('0x31')]=_0xdb72b0[_0x7dbf('0x31')];this['predictiveIntervalAvgTalktime']=_0xdb72b0[_0x7dbf('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0xdb72b0[_0x7dbf('0x33')];this[_0x7dbf('0x34')]=_0xdb72b0[_0x7dbf('0x34')];this['predictiveIntervalErlangCalls']=_0xdb72b0[_0x7dbf('0x35')];this[_0x7dbf('0x36')]=_0xdb72b0['predictiveIntervalErlangCallsDroppedCalls'];this[_0x7dbf('0x37')]=_0xdb72b0[_0x7dbf('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0xdb72b0[_0x7dbf('0x38')];this['predictiveIntervalPauses']=_0xdb72b0[_0x7dbf('0x39')];this['predictiveIntervalAvailable']=_0xdb72b0[_0x7dbf('0x3a')];this[_0x7dbf('0x3b')]=_0xdb72b0[_0x7dbf('0x3b')];this[_0x7dbf('0x8')]=_0xdb72b0[_0x7dbf('0x8')];this[_0x7dbf('0x3c')]=_0xdb72b0['erlangCalls'];this['erlangCallToSecond']=_0xdb72b0[_0x7dbf('0x3d')];this[_0x7dbf('0x3e')]=_0xdb72b0['erlangAbandonmentRate'];this[_0x7dbf('0x3f')]=_0xdb72b0[_0x7dbf('0x3f')];this[_0x7dbf('0x40')]=_0xdb72b0['startPredictive'];this[_0x7dbf('0x41')]=_0xdb72b0[_0x7dbf('0x41')];this['message']=_0xdb72b0['message'];this[_0x7dbf('0x42')]=_0xdb72b0[_0x7dbf('0x42')];}if(_0xdb72b0[_0x7dbf('0x43')]){this['Trunk']={'id':_0xdb72b0['Trunk']['id'],'name':_0xdb72b0[_0x7dbf('0x43')][_0x7dbf('0x16')],'active':_0xdb72b0['Trunk'][_0x7dbf('0x44')],'callerid':_0xdb72b0['Trunk'][_0x7dbf('0x45')]};}}VoiceQueueSummary[_0x7dbf('0x46')][_0x7dbf('0x47')]=function(_0x4b0e38,_0xf26c22,_0x26d57c,_0x34314a){this[_0x7dbf('0x2')]=0x0;this[_0x7dbf('0x5')]=0x0;this[_0x7dbf('0x3')]=0x0;this[_0x7dbf('0x22')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0x7dbf('0x19')]=0x0;this[_0x7dbf('0x1a')]=0x0;this[_0x7dbf('0x21')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x7dbf('0x1b')]=0x0;if(_0x26d57c){if(_0x26d57c[_0x7dbf('0x0')]){this[_0x7dbf('0x0')]=Number(_0x26d57c[_0x7dbf('0x0')]);}if(_0x26d57c[_0x7dbf('0x48')]){this[_0x7dbf('0x1')]=Number(_0x26d57c[_0x7dbf('0x48')]);}if(_0x26d57c['callers']){this[_0x7dbf('0x6')]=Number(_0x26d57c[_0x7dbf('0x49')]);}}for(var _0x443cb9=0x0;_0x443cb9<_0x4b0e38[_0x7dbf('0x4a')];_0x443cb9++){var _0x54293c=_0xf26c22[_0x7dbf('0x4b')+_0x4b0e38[_0x443cb9]['name']];if(_0x54293c&&_0x54293c['online']){this['loggedInDb']+=0x1;}if(_0x4b0e38[_0x443cb9][_0x7dbf('0x4c')]==='1'){this[_0x7dbf('0x5')]+=0x1;}if(_0x4b0e38[_0x443cb9][_0x7dbf('0x3')]==='1'&&!['2','7','8']['includes'](_0x4b0e38[_0x443cb9][_0x7dbf('0x4d')])){this['paused']+=0x1;}switch(_0x4b0e38[_0x443cb9][_0x7dbf('0x4d')]){case'0':this[_0x7dbf('0x22')]+=0x1;break;case'1':this[_0x7dbf('0x1c')]+=0x1;break;case'2':this[_0x7dbf('0x7')]+=0x1;break;case'3':this[_0x7dbf('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x7dbf('0x21')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x7dbf('0x1d')]+=0x1;break;case'8':this[_0x7dbf('0x1b')]+=0x1;break;}}if(this[_0x7dbf('0x4e')]===_0x7dbf('0x4f')){var _0x301538=Object['keys'](_0x34314a);for(var _0x430d85=0x0;_0x430d85<_0x301538[_0x7dbf('0x4a')];_0x430d85++){var _0x39669b=_0x301538[_0x430d85];var _0x12bb14=_0x34314a[_0x39669b];if(_0x12bb14['queue']===this[_0x7dbf('0x16')]&&_0x12bb14[_0x7dbf('0x20')]===_0x7dbf('0x50')&&_0x12bb14[_0x7dbf('0x51')]===_0x7dbf('0x52')){this['talking']+=0x1;}}if(this[_0x7dbf('0x5')]>this[_0x7dbf('0x7')]){this[_0x7dbf('0x5')]=this['inUse'];}this[_0x7dbf('0x13')]=0x0;}return this;};VoiceQueueSummary[_0x7dbf('0x46')]['compareToInboundQueue']=function(_0x542918){var _0x23d1e2=![];if(_0x542918){_0x23d1e2=INBOUND_COUNTERS[_0x7dbf('0x53')](function(_0x3fdd5f){return this[_0x3fdd5f]!==_0x542918[_0x3fdd5f];},this);}return _0x23d1e2;};VoiceQueueSummary['prototype'][_0x7dbf('0x54')]=function(_0x5b6724){var _0x2920=![];var _0x4aeadc=![];var _0x55a204=![];if(_0x5b6724){_0x2920=this[_0x7dbf('0x4e')]!==_0x5b6724[_0x7dbf('0x4e')]||this[_0x7dbf('0x25')]!==_0x5b6724[_0x7dbf('0x25')]||this[_0x7dbf('0x55')]!==_0x5b6724[_0x7dbf('0x55')]||this[_0x7dbf('0x42')]!==_0x5b6724[_0x7dbf('0x42')];_0x4aeadc=OUTBOUND_COUNTERS[_0x7dbf('0x53')](function(_0x125cb3){return this[_0x125cb3]!==_0x5b6724[_0x125cb3];},this);if(this[_0x7dbf('0x43')]&&_0x5b6724[_0x7dbf('0x43')]){_0x55a204=this[_0x7dbf('0x43')][_0x7dbf('0x16')]!==_0x5b6724[_0x7dbf('0x43')]['name']||this[_0x7dbf('0x43')][_0x7dbf('0x44')]!==_0x5b6724['Trunk'][_0x7dbf('0x44')];}}return _0x2920||_0x4aeadc||_0x55a204;};VoiceQueueSummary['prototype'][_0x7dbf('0x56')]=function(_0x2c1c80){this[_0x7dbf('0x57')]=_0x2c1c80[_0x7dbf('0x57')];this['message']=_0x2c1c80['message'];this[_0x7dbf('0x42')]=_0x2c1c80[_0x7dbf('0x42')];this['originated']=_0x2c1c80['originated'];this[_0x7dbf('0x9')]=_0x2c1c80[_0x7dbf('0x9')];this[_0x7dbf('0xa')]=_0x2c1c80[_0x7dbf('0xa')];this[_0x7dbf('0xb')]=_0x2c1c80['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x2c1c80['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x2c1c80['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x2c1c80[_0x7dbf('0xe')];this[_0x7dbf('0xf')]=_0x2c1c80[_0x7dbf('0xf')];this[_0x7dbf('0x10')]=_0x2c1c80[_0x7dbf('0x10')];this['outboundRejectCallsDay']=_0x2c1c80[_0x7dbf('0x11')];this[_0x7dbf('0x12')]=_0x2c1c80[_0x7dbf('0x12')];this[_0x7dbf('0x14')]=_0x2c1c80[_0x7dbf('0x14')];this[_0x7dbf('0x1e')]=_0x2c1c80[_0x7dbf('0x1e')];this[_0x7dbf('0x15')]=_0x2c1c80['total'];if(this[_0x7dbf('0x4e')]===_0x7dbf('0x58')){this[_0x7dbf('0x13')]=_0x2c1c80['pTalking'];}};module[_0x7dbf('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0x2f74=['predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','online','status','booked','keys','queue','dialer','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','preview','exports','available','loggedInDb','paused','ringing','talking','waiting','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x4c7f8c,_0x13ebbd){var _0x4da110=function(_0x1a812f){while(--_0x1a812f){_0x4c7f8c['push'](_0x4c7f8c['shift']());}};_0x4da110(++_0x13ebbd);}(_0x2f74,0x7b));var _0x42f7=function(_0x1be5a6,_0x50dff7){_0x1be5a6=_0x1be5a6-0x0;var _0x1c3173=_0x2f74[_0x1be5a6];return _0x1c3173;};'use strict';var INBOUND_COUNTERS=[_0x42f7('0x0'),'loggedIn',_0x42f7('0x1'),_0x42f7('0x2'),_0x42f7('0x3'),_0x42f7('0x4'),_0x42f7('0x5')];var OUTBOUND_COUNTERS=[_0x42f7('0x0'),_0x42f7('0x6'),_0x42f7('0x7'),'loggedIn','loggedInDb','originated',_0x42f7('0x8'),_0x42f7('0x9'),_0x42f7('0xa'),_0x42f7('0xb'),_0x42f7('0xc'),_0x42f7('0xd'),_0x42f7('0xe'),_0x42f7('0xf'),'outboundRejectCallsDay',_0x42f7('0x10'),_0x42f7('0x2'),_0x42f7('0x11'),_0x42f7('0x4'),_0x42f7('0x12'),_0x42f7('0x13'),'total',_0x42f7('0x5')];function VoiceQueueSummary(_0x29c899){this['id']=_0x29c899['id'];this[_0x42f7('0x14')]=_0x29c899[_0x42f7('0x14')];this[_0x42f7('0x15')]=_0x29c899[_0x42f7('0x15')];this[_0x42f7('0x16')]=_0x29c899[_0x42f7('0x16')]||0x0;this['answered']=_0x29c899['answered']||0x0;this[_0x42f7('0x0')]=_0x29c899[_0x42f7('0x0')]||0x0;this[_0x42f7('0x17')]=_0x29c899[_0x42f7('0x17')]||0x0;this[_0x42f7('0x7')]=_0x29c899['inUse']||0x0;this[_0x42f7('0x18')]=_0x29c899['invalid']||0x0;this[_0x42f7('0x19')]=_0x29c899[_0x42f7('0x19')]||0x0;this[_0x42f7('0x1')]=_0x29c899[_0x42f7('0x1')]||0x0;this[_0x42f7('0x1a')]=_0x29c899[_0x42f7('0x1a')]||0x0;this[_0x42f7('0x1b')]=_0x29c899['notInUse']||0x0;this[_0x42f7('0x2')]=_0x29c899[_0x42f7('0x2')]||0x0;this[_0x42f7('0x3')]=_0x29c899[_0x42f7('0x3')]||0x0;this[_0x42f7('0x1c')]=_0x29c899[_0x42f7('0x1c')];this['sumBillable']=_0x29c899[_0x42f7('0x12')];this['sumDuration']=_0x29c899[_0x42f7('0x13')];this['sumHoldTime']=_0x29c899[_0x42f7('0x1d')]||0x0;this['talking']=_0x29c899['talking']||0x0;this['total']=_0x29c899[_0x42f7('0x1e')]||0x0;this[_0x42f7('0x1f')]=_0x29c899[_0x42f7('0x1f')];this[_0x42f7('0x20')]=_0x29c899[_0x42f7('0x20')]||0x0;this[_0x42f7('0x21')]=_0x29c899[_0x42f7('0x21')]||0x0;this[_0x42f7('0x22')]=_0x29c899[_0x42f7('0x22')]||0x0;this[_0x42f7('0x5')]=_0x29c899[_0x42f7('0x5')]||0x0;if(_0x29c899[_0x42f7('0x1f')]===_0x42f7('0x23')){this[_0x42f7('0x11')]=_0x29c899['pTalking']||0x0;this['dialActive']=_0x29c899[_0x42f7('0x24')];this[_0x42f7('0x25')]=_0x29c899[_0x42f7('0x25')];this[_0x42f7('0x26')]=_0x29c899[_0x42f7('0x26')];this[_0x42f7('0x27')]=_0x29c899[_0x42f7('0x27')];this[_0x42f7('0x28')]=_0x29c899[_0x42f7('0x28')];this[_0x42f7('0x29')]=_0x29c899['dialPrefix'];this['temp']=_0x29c899[_0x42f7('0x2a')];this[_0x42f7('0x2b')]=_0x29c899[_0x42f7('0x2b')];this['outboundAnswerCallsDay']=_0x29c899[_0x42f7('0x9')];this[_0x42f7('0xa')]=_0x29c899['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x29c899[_0x42f7('0xb')];this[_0x42f7('0xc')]=_0x29c899[_0x42f7('0xc')];this[_0x42f7('0x2c')]=_0x29c899[_0x42f7('0x2c')];this[_0x42f7('0x2d')]=_0x29c899[_0x42f7('0x2d')];this[_0x42f7('0x2e')]=_0x29c899[_0x42f7('0x2e')];this['outboundNoAnswerCallsDay']=_0x29c899[_0x42f7('0xd')];this[_0x42f7('0xe')]=_0x29c899[_0x42f7('0xe')];this[_0x42f7('0x2f')]=_0x29c899[_0x42f7('0x2f')];this['outboundReCallsDay']=_0x29c899[_0x42f7('0xf')];this[_0x42f7('0x30')]=_0x29c899[_0x42f7('0x30')];this[_0x42f7('0x10')]=_0x29c899['outboundUnknownCallsDay'];this[_0x42f7('0x31')]=_0x29c899['predictiveIntervalAnsweredCalls'];this[_0x42f7('0x32')]=_0x29c899[_0x42f7('0x32')];this[_0x42f7('0x33')]=_0x29c899[_0x42f7('0x33')];this[_0x42f7('0x34')]=_0x29c899[_0x42f7('0x34')];this[_0x42f7('0x35')]=_0x29c899['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x29c899[_0x42f7('0x36')];this[_0x42f7('0x37')]=_0x29c899['predictiveIntervalErlangCallsDroppedCalls'];this[_0x42f7('0x38')]=_0x29c899['predictiveIntervalHitRate'];this[_0x42f7('0x39')]=_0x29c899[_0x42f7('0x39')];this['predictiveIntervalPauses']=_0x29c899['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x29c899[_0x42f7('0x3a')];this['predictiveIntervalTotalCalls']=_0x29c899[_0x42f7('0x3b')];this[_0x42f7('0x3c')]=_0x29c899[_0x42f7('0x3c')];this[_0x42f7('0x3d')]=_0x29c899[_0x42f7('0x3d')];this['erlangCallToSecond']=_0x29c899[_0x42f7('0x3e')];this[_0x42f7('0x3f')]=_0x29c899['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x29c899[_0x42f7('0x40')];this[_0x42f7('0x41')]=_0x29c899[_0x42f7('0x41')];this[_0x42f7('0x42')]=_0x29c899[_0x42f7('0x42')];this[_0x42f7('0x43')]=_0x29c899['message'];this[_0x42f7('0x44')]=_0x29c899['statusMessage'];}if(_0x29c899[_0x42f7('0x45')]){this[_0x42f7('0x45')]={'id':_0x29c899[_0x42f7('0x45')]['id'],'name':_0x29c899['Trunk'][_0x42f7('0x14')],'active':_0x29c899['Trunk'][_0x42f7('0x46')],'callerid':_0x29c899[_0x42f7('0x45')][_0x42f7('0x47')]};}}VoiceQueueSummary['prototype'][_0x42f7('0x48')]=function(_0x443b6f,_0x5f2365,_0x10b418,_0x50ebf9){this[_0x42f7('0x1')]=0x0;this['talking']=0x0;this[_0x42f7('0x2')]=0x0;this[_0x42f7('0x21')]=0x0;this['notInUse']=0x0;this[_0x42f7('0x7')]=0x0;this[_0x42f7('0x17')]=0x0;this['invalid']=0x0;this[_0x42f7('0x20')]=0x0;this[_0x42f7('0x3')]=0x0;this[_0x42f7('0x1c')]=0x0;this[_0x42f7('0x1a')]=0x0;if(_0x10b418){if(_0x10b418[_0x42f7('0x0')]){this['available']=Number(_0x10b418[_0x42f7('0x0')]);}if(_0x10b418['loggedin']){this[_0x42f7('0x19')]=Number(_0x10b418[_0x42f7('0x49')]);}if(_0x10b418[_0x42f7('0x4a')]){this[_0x42f7('0x5')]=Number(_0x10b418['callers']);}}for(var _0x336a0b=0x0;_0x336a0b<_0x443b6f[_0x42f7('0x4b')];_0x336a0b++){var _0x1a4314=_0x5f2365[_0x42f7('0x4c')+_0x443b6f[_0x336a0b][_0x42f7('0x14')]];if(_0x1a4314&&_0x1a4314[_0x42f7('0x4d')]){this['loggedInDb']+=0x1;}if(_0x443b6f[_0x336a0b]['incall']==='1'){this[_0x42f7('0x4')]+=0x1;}if(_0x443b6f[_0x336a0b][_0x42f7('0x2')]==='1'&&!['2','7','8']['includes'](_0x443b6f[_0x336a0b][_0x42f7('0x4e')])){this[_0x42f7('0x2')]+=0x1;}switch(_0x443b6f[_0x336a0b][_0x42f7('0x4e')]){case'0':this[_0x42f7('0x21')]+=0x1;break;case'1':this[_0x42f7('0x1b')]+=0x1;break;case'2':this[_0x42f7('0x7')]+=0x1;break;case'3':this[_0x42f7('0x17')]+=0x1;break;case'4':this[_0x42f7('0x18')]+=0x1;break;case'5':this[_0x42f7('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x42f7('0x1c')]+=0x1;break;case'8':this[_0x42f7('0x1a')]+=0x1;break;}}if(this[_0x42f7('0x25')]===_0x42f7('0x4f')){var _0x253851=Object[_0x42f7('0x50')](_0x50ebf9);for(var _0x599365=0x0;_0x599365<_0x253851[_0x42f7('0x4b')];_0x599365++){var _0x58c6ca=_0x253851[_0x599365];var _0x258ed6=_0x50ebf9[_0x58c6ca];if(_0x258ed6[_0x42f7('0x51')]===this[_0x42f7('0x14')]&&_0x258ed6[_0x42f7('0x1f')]===_0x42f7('0x52')&&_0x258ed6[_0x42f7('0x53')]==='xcally-motion-preview'){this[_0x42f7('0x4')]+=0x1;}}if(this[_0x42f7('0x4')]>this['inUse']){this[_0x42f7('0x4')]=this['inUse'];}this[_0x42f7('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x42f7('0x54')][_0x42f7('0x55')]=function(_0x5df782){var _0x27f709=![];if(_0x5df782){_0x27f709=INBOUND_COUNTERS[_0x42f7('0x56')](function(_0x513c8c){return this[_0x513c8c]!==_0x5df782[_0x513c8c];},this);}return _0x27f709;};VoiceQueueSummary[_0x42f7('0x54')][_0x42f7('0x57')]=function(_0xbb1b9d){var _0x229c88=![];var _0x98bc95=![];var _0x3f1297=![];if(_0xbb1b9d){_0x229c88=this[_0x42f7('0x25')]!==_0xbb1b9d[_0x42f7('0x25')]||this[_0x42f7('0x24')]!==_0xbb1b9d[_0x42f7('0x24')]||this[_0x42f7('0x43')]!==_0xbb1b9d[_0x42f7('0x43')]||this[_0x42f7('0x44')]!==_0xbb1b9d['statusMessage'];_0x98bc95=OUTBOUND_COUNTERS[_0x42f7('0x56')](function(_0x50aace){return this[_0x50aace]!==_0xbb1b9d[_0x50aace];},this);if(this[_0x42f7('0x45')]&&_0xbb1b9d[_0x42f7('0x45')]){_0x3f1297=this[_0x42f7('0x45')][_0x42f7('0x14')]!==_0xbb1b9d[_0x42f7('0x45')][_0x42f7('0x14')]||this[_0x42f7('0x45')][_0x42f7('0x46')]!==_0xbb1b9d['Trunk'][_0x42f7('0x46')];}}return _0x229c88||_0x98bc95||_0x3f1297;};VoiceQueueSummary[_0x42f7('0x54')]['updateReportFromOutboundQueue']=function(_0x4e5211){this[_0x42f7('0x6')]=_0x4e5211['answered'];this['message']=_0x4e5211[_0x42f7('0x43')];this[_0x42f7('0x44')]=_0x4e5211['statusMessage'];this['originated']=_0x4e5211[_0x42f7('0x3c')];this['outboundAbandonedCallsDay']=_0x4e5211[_0x42f7('0x8')];this['outboundAnswerCallsDay']=_0x4e5211['outboundAnswerCallsDay'];this[_0x42f7('0xa')]=_0x4e5211[_0x42f7('0xa')];this['outboundBusyCallsDay']=_0x4e5211['outboundBusyCallsDay'];this[_0x42f7('0xc')]=_0x4e5211[_0x42f7('0xc')];this['outboundNoAnswerCallsDay']=_0x4e5211[_0x42f7('0xd')];this[_0x42f7('0xe')]=_0x4e5211[_0x42f7('0xe')];this[_0x42f7('0xf')]=_0x4e5211[_0x42f7('0xf')];this['outboundRejectCallsDay']=_0x4e5211[_0x42f7('0x30')];this['outboundUnknownCallsDay']=_0x4e5211[_0x42f7('0x10')];this[_0x42f7('0x12')]=_0x4e5211[_0x42f7('0x12')];this[_0x42f7('0x13')]=_0x4e5211[_0x42f7('0x13')];this[_0x42f7('0x1e')]=_0x4e5211[_0x42f7('0x1e')];if(this['dialMethod']===_0x42f7('0x58')){this[_0x42f7('0x11')]=_0x4e5211['pTalking'];}};module[_0x42f7('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f3344c0..4450b4b 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 _0xe42e=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5e3708,_0x4bb55d){var _0x13ab52=function(_0x24a7ed){while(--_0x24a7ed){_0x5e3708['push'](_0x5e3708['shift']());}};_0x13ab52(++_0x4bb55d);}(_0xe42e,0xbf));var _0xee42=function(_0x508e19,_0x210ba2){_0x508e19=_0x508e19-0x0;var _0x55ad5d=_0xe42e[_0x508e19];return _0x55ad5d;};'use strict';function VtigerAccount(_0x3c063f){this['id']=_0x3c063f['id']||0x0;this[_0xee42('0x0')]=_0x3c063f['name']||'';this[_0xee42('0x1')]=_0x3c063f[_0xee42('0x1')]||'';this[_0xee42('0x2')]=_0x3c063f[_0xee42('0x2')]||'';this['remoteUri']=_0x3c063f[_0xee42('0x3')]||'';this[_0xee42('0x4')]=_0x3c063f['serverUrl']||'';this[_0xee42('0x5')]=_0x3c063f['Configurations']||{};}module[_0xee42('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6765=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4ba811,_0x4428f2){var _0x3b616f=function(_0x5cc7e1){while(--_0x5cc7e1){_0x4ba811['push'](_0x4ba811['shift']());}};_0x3b616f(++_0x4428f2);}(_0x6765,0x10d));var _0x5676=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x6765[_0x16629d];return _0x56ccee;};'use strict';function VtigerAccount(_0x46fe76){this['id']=_0x46fe76['id']||0x0;this[_0x5676('0x0')]=_0x46fe76[_0x5676('0x0')]||'';this[_0x5676('0x1')]=_0x46fe76['username']||'';this[_0x5676('0x2')]=_0x46fe76[_0x5676('0x2')]||'';this['remoteUri']=_0x46fe76[_0x5676('0x3')]||'';this[_0x5676('0x4')]=_0x46fe76[_0x5676('0x4')]||'';this['Configurations']=_0x46fe76[_0x5676('0x5')]||{};}module[_0x5676('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 4524d5e..3cee2a6 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 _0x31e0=['Configurations','name','username','password','token','remoteUri','authType','type','serverUrl'];(function(_0x1c238f,_0x36012b){var _0x344288=function(_0x59127f){while(--_0x59127f){_0x1c238f['push'](_0x1c238f['shift']());}};_0x344288(++_0x36012b);}(_0x31e0,0x196));var _0x031e=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x31e0[_0x1573ea];return _0x51c0e2;};'use strict';function ZendeskAccount(_0x5dd6ee){this['id']=_0x5dd6ee['id']||0x0;this[_0x031e('0x0')]=_0x5dd6ee[_0x031e('0x0')]||'';this[_0x031e('0x1')]=_0x5dd6ee[_0x031e('0x1')]||'';this[_0x031e('0x2')]=_0x5dd6ee[_0x031e('0x2')]||'';this[_0x031e('0x3')]=_0x5dd6ee[_0x031e('0x3')]||'';this[_0x031e('0x4')]=_0x5dd6ee[_0x031e('0x4')]||'';this[_0x031e('0x5')]=_0x5dd6ee['authType']||'';this[_0x031e('0x6')]=_0x5dd6ee['type']||'integrationTab';this[_0x031e('0x7')]=_0x5dd6ee['serverUrl']||'';this[_0x031e('0x8')]=_0x5dd6ee['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x9437=['password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username'];(function(_0x24d76,_0x101680){var _0x470316=function(_0x25b693){while(--_0x25b693){_0x24d76['push'](_0x24d76['shift']());}};_0x470316(++_0x101680);}(_0x9437,0xc6));var _0x7943=function(_0x525c40,_0x37d16d){_0x525c40=_0x525c40-0x0;var _0x209f7f=_0x9437[_0x525c40];return _0x209f7f;};'use strict';function ZendeskAccount(_0x3057f6){this['id']=_0x3057f6['id']||0x0;this[_0x7943('0x0')]=_0x3057f6[_0x7943('0x0')]||'';this['username']=_0x3057f6[_0x7943('0x1')]||'';this[_0x7943('0x2')]=_0x3057f6[_0x7943('0x2')]||'';this['token']=_0x3057f6[_0x7943('0x3')]||'';this[_0x7943('0x4')]=_0x3057f6[_0x7943('0x4')]||'';this[_0x7943('0x5')]=_0x3057f6[_0x7943('0x5')]||'';this['type']=_0x3057f6[_0x7943('0x6')]||'integrationTab';this[_0x7943('0x7')]=_0x3057f6[_0x7943('0x7')]||'';this[_0x7943('0x8')]=_0x3057f6[_0x7943('0x8')]||{};}module[_0x7943('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 909cd62..5297e2e 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 _0xca1d=['description','host','zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports','name'];(function(_0x52c82b,_0xdcf0b){var _0x1ba0a0=function(_0x11bcb4){while(--_0x11bcb4){_0x52c82b['push'](_0x52c82b['shift']());}};_0x1ba0a0(++_0xdcf0b);}(_0xca1d,0xd1));var _0xdca1=function(_0x1a39de,_0x16c93f){_0x1a39de=_0x1a39de-0x0;var _0x43d6e2=_0xca1d[_0x1a39de];return _0x43d6e2;};'use strict';function ZohoAccount(_0xe893e7){this['id']=_0xe893e7['id']||0x0;this[_0xdca1('0x0')]=_0xe893e7[_0xdca1('0x0')]||'';this[_0xdca1('0x1')]=_0xe893e7[_0xdca1('0x1')]||'';this[_0xdca1('0x2')]=_0xe893e7[_0xdca1('0x2')]||'';this['zone']=_0xe893e7[_0xdca1('0x3')]||'';this[_0xdca1('0x4')]=_0xe893e7[_0xdca1('0x4')]||'';this[_0xdca1('0x5')]=_0xe893e7[_0xdca1('0x5')]||'';this[_0xdca1('0x6')]=_0xe893e7[_0xdca1('0x6')]||'';this['code']=_0xe893e7['code']||'';this[_0xdca1('0x7')]=_0xe893e7[_0xdca1('0x7')]||'';this[_0xdca1('0x8')]=_0xe893e7['Configurations']||{};}module[_0xdca1('0x9')]=ZohoAccount; \ No newline at end of file +var _0x3607=['exports','name','description','zone','clientId','clientSecret','code','refreshToken','Configurations'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x3607,0x1cc));var _0x7360=function(_0x42f36f,_0x378be9){_0x42f36f=_0x42f36f-0x0;var _0x19aff1=_0x3607[_0x42f36f];return _0x19aff1;};'use strict';function ZohoAccount(_0x19f2db){this['id']=_0x19f2db['id']||0x0;this[_0x7360('0x0')]=_0x19f2db[_0x7360('0x0')]||'';this[_0x7360('0x1')]=_0x19f2db[_0x7360('0x1')]||'';this['host']=_0x19f2db['host']||'';this[_0x7360('0x2')]=_0x19f2db[_0x7360('0x2')]||'';this[_0x7360('0x3')]=_0x19f2db[_0x7360('0x3')]||'';this['clientSecret']=_0x19f2db[_0x7360('0x4')]||'';this['serverUrl']=_0x19f2db['serverUrl']||'';this['code']=_0x19f2db[_0x7360('0x5')]||'';this[_0x7360('0x6')]=_0x19f2db[_0x7360('0x6')]||'';this[_0x7360('0x7')]=_0x19f2db[_0x7360('0x7')]||{};}module[_0x7360('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 27cc951..e0fc647 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 _0x47c5=['originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0x47c5,0x165));var _0x547c=function(_0x41f59e,_0x5e916a){_0x41f59e=_0x41f59e-0x0;var _0x1d5e3=_0x47c5[_0x41f59e];return _0x1d5e3;};'use strict';var util=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));function checkNameSurname(_0x123697,_0x5fe74c,_0x3260c8){var _0x500b86='';if(!_[_0x547c('0x3')](_0x5fe74c)&&_0x547c('0x4')===typeof _0x5fe74c){_0x500b86+=_0x5fe74c;}if(!_['isNil'](_0x3260c8)&&_0x547c('0x4')===typeof _0x3260c8){_0x500b86+='\x20'+_0x3260c8;}if(_0x500b86!==''){return _0x500b86;}return _0x123697;}function Action(_0x468220,_0x51ab7f,_0x2e5b57,_0x439f25,_0x381f2e){this[_0x547c('0x5')]=_0x2e5b57||undefined;this[_0x547c('0x6')]=_0x468220['id'];this[_0x547c('0x7')]=_0x51ab7f[_0x547c('0x8')];this[_0x547c('0x9')]=_0x51ab7f[_0x547c('0x9')];this[_0x547c('0xa')]=_0x547c('0x7');this[_0x547c('0xb')]=![];this[_0x547c('0xc')]=_[_0x547c('0x3')](_0x468220[_0x547c('0xd')])?undefined:_0x468220[_0x547c('0xd')][_0x547c('0x8')];this['channelAgent']=this[_0x547c('0xc')]?util[_0x547c('0xe')]('SIP/%s',this[_0x547c('0xc')]):_0x439f25||undefined;this[_0x547c('0xf')]=checkNameSurname(_0x468220[_0x547c('0x10')][_0x547c('0x11')],_0x468220[_0x547c('0x10')][_0x547c('0x12')],_0x468220[_0x547c('0x10')][_0x547c('0x13')]);this[_0x547c('0x14')]=_0x468220[_0x547c('0x14')]||![];this[_0x547c('0x15')]=_0x468220[_0x547c('0x11')];this[_0x547c('0x16')]=_0x468220[_0x547c('0x16')];this[_0x547c('0x17')]=_0x468220[_0x547c('0x17')]||0x0;this[_0x547c('0x18')]=_0x468220[_0x547c('0x18')]||0x0;this['countnoanswerretry']=_0x468220['countnoanswerretry']||0x0;this[_0x547c('0x19')]=(_0x468220[_0x547c('0x17')]||0x0)+(_0x468220[_0x547c('0x18')]||0x0)+(_0x468220['countnoanswerretry']||0x0)+(_0x468220[_0x547c('0x1a')]||0x0)+(_0x468220[_0x547c('0x1b')]||0x0)+(_0x468220[_0x547c('0x1c')]||0x0)+(_0x468220['countmachineretry']||0x0)+(_0x468220[_0x547c('0x1d')]||0x0);this[_0x547c('0x1a')]=_0x468220['countnosuchnumberretry']||0x0;this['countdropretry']=_0x468220[_0x547c('0x1b')]||0x0;this[_0x547c('0x1c')]=_0x468220['countabandonedretry']||0x0;this[_0x547c('0x1e')]=_0x468220[_0x547c('0x1e')]||0x0;this['countagentrejectretry']=_0x468220[_0x547c('0x1d')]||0x0;this[_0x547c('0x1f')]=_0x468220[_0x547c('0x1f')];this['callbackuniqueid']=_0x468220[_0x547c('0x20')];this[_0x547c('0x21')]=_0x468220[_0x547c('0x21')];this[_0x547c('0x22')]=_0x468220[_0x547c('0x22')];this[_0x547c('0x23')]=_0x468220[_0x547c('0x23')];this[_0x547c('0x24')]=_0x468220['ListId'];this[_0x547c('0x25')]=_['isNil'](_0x468220['Agent'])?_0x468220['UserId']:_0x468220['Agent']['id'];this[_0x547c('0x26')]=_0x468220['VoiceQueueId'];this[_0x547c('0x27')]='';this['originatecalleridname']='';}Action[_0x547c('0x28')]['getCaller']=function(){return util[_0x547c('0xe')](_0x547c('0x29'),this[_0x547c('0xf')],this[_0x547c('0x2a')]);};module[_0x547c('0x2b')]=Action; \ No newline at end of file +var _0x47c5=['originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5cb2eb,_0x544081){var _0xae80c0=function(_0x38ef17){while(--_0x38ef17){_0x5cb2eb['push'](_0x5cb2eb['shift']());}};_0xae80c0(++_0x544081);}(_0x47c5,0x165));var _0x547c=function(_0x348d2e,_0x2b7b9b){_0x348d2e=_0x348d2e-0x0;var _0x143ca5=_0x47c5[_0x348d2e];return _0x143ca5;};'use strict';var util=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));function checkNameSurname(_0x123697,_0x5fe74c,_0x3260c8){var _0x500b86='';if(!_[_0x547c('0x3')](_0x5fe74c)&&_0x547c('0x4')===typeof _0x5fe74c){_0x500b86+=_0x5fe74c;}if(!_['isNil'](_0x3260c8)&&_0x547c('0x4')===typeof _0x3260c8){_0x500b86+='\x20'+_0x3260c8;}if(_0x500b86!==''){return _0x500b86;}return _0x123697;}function Action(_0x468220,_0x51ab7f,_0x2e5b57,_0x439f25,_0x381f2e){this[_0x547c('0x5')]=_0x2e5b57||undefined;this[_0x547c('0x6')]=_0x468220['id'];this[_0x547c('0x7')]=_0x51ab7f[_0x547c('0x8')];this[_0x547c('0x9')]=_0x51ab7f[_0x547c('0x9')];this[_0x547c('0xa')]=_0x547c('0x7');this[_0x547c('0xb')]=![];this[_0x547c('0xc')]=_[_0x547c('0x3')](_0x468220[_0x547c('0xd')])?undefined:_0x468220[_0x547c('0xd')][_0x547c('0x8')];this['channelAgent']=this[_0x547c('0xc')]?util[_0x547c('0xe')]('SIP/%s',this[_0x547c('0xc')]):_0x439f25||undefined;this[_0x547c('0xf')]=checkNameSurname(_0x468220[_0x547c('0x10')][_0x547c('0x11')],_0x468220[_0x547c('0x10')][_0x547c('0x12')],_0x468220[_0x547c('0x10')][_0x547c('0x13')]);this[_0x547c('0x14')]=_0x468220[_0x547c('0x14')]||![];this[_0x547c('0x15')]=_0x468220[_0x547c('0x11')];this[_0x547c('0x16')]=_0x468220[_0x547c('0x16')];this[_0x547c('0x17')]=_0x468220[_0x547c('0x17')]||0x0;this[_0x547c('0x18')]=_0x468220[_0x547c('0x18')]||0x0;this['countnoanswerretry']=_0x468220['countnoanswerretry']||0x0;this[_0x547c('0x19')]=(_0x468220[_0x547c('0x17')]||0x0)+(_0x468220[_0x547c('0x18')]||0x0)+(_0x468220['countnoanswerretry']||0x0)+(_0x468220[_0x547c('0x1a')]||0x0)+(_0x468220[_0x547c('0x1b')]||0x0)+(_0x468220[_0x547c('0x1c')]||0x0)+(_0x468220['countmachineretry']||0x0)+(_0x468220[_0x547c('0x1d')]||0x0);this[_0x547c('0x1a')]=_0x468220['countnosuchnumberretry']||0x0;this['countdropretry']=_0x468220[_0x547c('0x1b')]||0x0;this[_0x547c('0x1c')]=_0x468220['countabandonedretry']||0x0;this[_0x547c('0x1e')]=_0x468220[_0x547c('0x1e')]||0x0;this['countagentrejectretry']=_0x468220[_0x547c('0x1d')]||0x0;this[_0x547c('0x1f')]=_0x468220[_0x547c('0x1f')];this['callbackuniqueid']=_0x468220[_0x547c('0x20')];this[_0x547c('0x21')]=_0x468220[_0x547c('0x21')];this[_0x547c('0x22')]=_0x468220[_0x547c('0x22')];this[_0x547c('0x23')]=_0x468220[_0x547c('0x23')];this[_0x547c('0x24')]=_0x468220['ListId'];this[_0x547c('0x25')]=_['isNil'](_0x468220['Agent'])?_0x468220['UserId']:_0x468220['Agent']['id'];this[_0x547c('0x26')]=_0x468220['VoiceQueueId'];this[_0x547c('0x27')]='';this['originatecalleridname']='';}Action[_0x547c('0x28')]['getCaller']=function(){return util[_0x547c('0xe')](_0x547c('0x29'),this[_0x547c('0xf')],this[_0x547c('0x2a')]);};module[_0x547c('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 a183c94..82dc75b 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 _0x090c=['totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','pTalking','[syncHangup][talking][increment]','custom:agentconnect','connect','custom:agentConnectPreview','complete','outboundAnswerCallsDay','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','BUSY','countbusyretry','dialBusyRetryFrequency','verifyAdditionalPhones','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','unlockAgent','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','pick','unlock','getContactPreview','recallme','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','syncHangupRequest','addVariable','filterKey','variable','keys','value','error','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','message','logger','CAMPAIGN_STATUS','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialMethod','dialActive','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','actions','queue','originated','stringify','dialAnswer','contactId','UserId','Action','status','channel','catch','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','custom:agentnosuchnumber','buildObj','nosuchnumber','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0x090c,0xc0));var _0xc090=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x090c[_0x3b7a0c];return _0x3bb70f;};'use strict';var util=require(_0xc090('0x0'));var _=require(_0xc090('0x1'));var uuid=require(_0xc090('0x2'));var moment=require(_0xc090('0x3'));var Redis=require('ioredis');var config=require(_0xc090('0x4'));var logger=require(_0xc090('0x5'))(_0xc090('0x6'));var loggerAction=require(_0xc090('0x5'))(_0xc090('0x7'));var ami=require(_0xc090('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xc090('0x9'));var Action=require(_0xc090('0xa'));var ut=require(_0xc090('0xb'));var utils=require(_0xc090('0xc'));config[_0xc090('0xd')]=_[_0xc090('0xe')](config[_0xc090('0xd')],{'host':_0xc090('0xf'),'port':0x18eb});var io=require(_0xc090('0x10'))(new Redis(config[_0xc090('0xd')]));var Sequence=function(){};Sequence[_0xc090('0x11')][_0xc090('0x12')]=function(_0x50abe6){this[_0xc090('0x13')]=this[_0xc090('0x13')]?this[_0xc090('0x13')][_0xc090('0x14')](_0x50abe6):_0x50abe6();};function Preview(_0x338527){this[_0xc090('0x15')]=new Sequence();this[_0xc090('0x16')]=_0x338527[_0xc090('0x17')];this[_0xc090('0x18')]=_0x338527['trunks'];this['actions']={};this[_0xc090('0x19')]=_0x338527[_0xc090('0x19')];this['clockClearZombieChannels']=0x0;ami['on'](_0xc090('0x1a'),this[_0xc090('0x1b')][_0xc090('0x1c')](this));ami['on'](_0xc090('0x1d'),this[_0xc090('0x1e')]['bind'](this));ami['on'](_0xc090('0x1f'),this['syncHangupRequest'][_0xc090('0x1c')](this));ami['on'](_0xc090('0x20'),this[_0xc090('0x21')]['bind'](this));ami['on']('newexten',this[_0xc090('0x22')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xc090('0x1c')](this));ami['on'](_0xc090('0x23'),this[_0xc090('0x24')][_0xc090('0x1c')](this));ami['on'](_0xc090('0x25'),this[_0xc090('0x26')][_0xc090('0x1c')](this));this[_0xc090('0x27')](this[_0xc090('0x16')]);}function emit(_0x2f050d,_0x36473f,_0x42f895){io['to'](_0x2f050d)[_0xc090('0x28')](_0x36473f,_0x42f895);}function emitVoiceQueueChannelRemove(_0x1749fe){logger['info'](_0xc090('0x29'),JSON['stringify'](_0x1749fe));emit(util[_0xc090('0x2a')](_0xc090('0x2b'),_0x1749fe[_0xc090('0x2c')]),_0xc090('0x2d'),_0x1749fe);io[_0xc090('0x28')](_0xc090('0x2e'),_0x1749fe);}function notSendMessagesQueue(_0x20fd2b){if(_0x20fd2b[_0xc090('0x2f')]){if(_0x20fd2b['originated']===0x0&&_0x20fd2b['pTalking']===0x0){_0x20fd2b[_0xc090('0x2f')]=![];_0x20fd2b[_0xc090('0x30')]=0x0;_0x20fd2b['paused']=0x0;_0x20fd2b[_0xc090('0x31')]=utils['CAMPAIGN_STATUS']['INACTIVE'];ut[_0xc090('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x20fd2b['name']+'\x20is\x20not\x20active');}else{_0x20fd2b[_0xc090('0x31')]=utils[_0xc090('0x33')][_0xc090('0x34')];ut[_0xc090('0x32')](_0xc090('0x35'),_0x20fd2b['name']+_0xc090('0x36'));}}}Preview[_0xc090('0x11')][_0xc090('0x27')]=function(){var _0x5a24d6=this;setInterval(function(){_0x5a24d6[_0xc090('0x37')]();},0x7cf);};Preview['prototype'][_0xc090('0x37')]=function(){var _0x36bd0=this[_0xc090('0x16')];this[_0xc090('0x38')]+=0x1;for(var _0x4541c5 in _0x36bd0){if(_0x36bd0['hasOwnProperty'](_0x4541c5)&&(_0x36bd0[_0x4541c5]['dialMethod']===_0xc090('0x6')||_0x36bd0[_0x4541c5]['dialMethod']===_0xc090('0x39'))&&_0x36bd0[_0x4541c5][_0xc090('0x3a')]===_0xc090('0x3b')){if(this[_0xc090('0x38')]>0x7){this[_0xc090('0x38')]=0x0;this[_0xc090('0x3c')]();}}if(_0x36bd0[_0xc090('0x3d')](_0x4541c5)&&_0x36bd0[_0x4541c5][_0xc090('0x3e')]==='preview'&&_0x36bd0[_0x4541c5][_0xc090('0x3a')]===_0xc090('0x3b')){if(_0x36bd0[_0x4541c5][_0xc090('0x3f')]){this[_0xc090('0x40')](_0x36bd0[_0x4541c5]);if(_0x36bd0[_0x4541c5]['dialPreviewAutoRecallMe'])this[_0xc090('0x41')](_0x36bd0[_0x4541c5]);}else{notSendMessagesQueue(_0x36bd0[_0x4541c5]);}}}};Preview[_0xc090('0x11')][_0xc090('0x42')]=function(_0x454486){var _0x19475c=this;this[_0xc090('0x15')][_0xc090('0x12')](function(){if(!_[_0xc090('0x43')](_0x19475c['actions'][_0x454486])){loggerAction[_0xc090('0x44')]('[clearZombieChannels][talking]',_0x454486,_0xc090('0x45'),_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x47')],'originated:\x20',JSON['stringify'](_0x19475c[_0xc090('0x16')][_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x47')]][_0xc090('0x48')]),'pTalking:\x20',JSON[_0xc090('0x49')](_0x19475c[_0xc090('0x16')][_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x47')]]['pTalking']),JSON[_0xc090('0x49')](_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x4a')]),JSON[_0xc090('0x49')](_['pick'](_0x19475c[_0xc090('0x46')][_0x454486],[_0xc090('0x4b'),_0xc090('0x4c'),'VoiceQueueId','ListId'])));return ami[_0xc090('0x4d')]({'action':_0xc090('0x4e'),'channel':_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x4f')]})[_0xc090('0x50')](function(_0x1264d2){if(_0x1264d2[_0xc090('0x31')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x19475c[_0xc090('0x46')][_0x454486]){ut[_0xc090('0x51')](_0x19475c[_0xc090('0x16')][_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x47')]],'[clearZombieChannel]');if(_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x4a')]===!![]){ut[_0xc090('0x52')](_0x19475c[_0xc090('0x16')][_0x19475c['actions'][_0x454486]['queue']],_0xc090('0x53'));ut[_0xc090('0x54')](_0xc090('0x55')+_0x454486,_0x19475c[_0xc090('0x46')][_0x454486][_0xc090('0x47')]);}ut['loggerError'](_0xc090('0x56')+_0x454486,_0x19475c[_0xc090('0x46')][_0x454486]['queue']);delete _0x19475c[_0xc090('0x46')][_0x454486];}},0x2328);}});}});};Preview[_0xc090('0x11')][_0xc090('0x3c')]=function(){var _0x595936=this;loggerAction[_0xc090('0x44')](_0xc090('0x57'),_[_0xc090('0x58')](this[_0xc090('0x46')]));for(var _0x1f1d86 in this['actions']){if(_0x595936[_0xc090('0x46')]['hasOwnProperty'](_0x1f1d86)){_0x595936[_0xc090('0x42')](_0x1f1d86);}}};Preview[_0xc090('0x11')][_0xc090('0x41')]=function(_0x371f8f){var _0xec6ee3=this;rpcDb[_0xc090('0x59')](_0x371f8f['id'],ut['agentReadyId'](this[_0xc090('0x19')]))[_0xc090('0x5a')](function(_0x4e418c){if(!_[_0xc090('0x43')](_0x4e418c)){for(var _0x2b0c03=0x0;_0x2b0c03<_0x4e418c[_0xc090('0x5b')];_0x2b0c03+=0x1){if(ut[_0xc090('0x5c')](_0x4e418c[_0x2b0c03][_0xc090('0x5d')])<_0x371f8f[_0xc090('0x5e')]*0x3c){if(_0x4e418c[_0x2b0c03][_0xc090('0x5f')]&&!_0x4e418c[_0x2b0c03][_0xc090('0x5f')][_0xc090('0x60')]){_0xec6ee3[_0xc090('0x61')](_0x4e418c[_0x2b0c03]['id'])['then'](ut['logger2'](_0xc090('0x62')))['catch'](ut[_0xc090('0x63')]('[RecallMe]'));}else{rpcDb[_0xc090('0x64')](_0x4e418c[_0x2b0c03]['id']);}}else{var _0xdd4df=new Action(_0x4e418c[_0x2b0c03],_0x371f8f);_0xdd4df[_0xc090('0x65')]=moment()['format'](_0xc090('0x66'));_0x371f8f[_0xc090('0x67')]+=0x1;ut['logCustomer'](_0xdd4df,0x17,'RecallInQueue');if(_0x371f8f[_0xc090('0x68')]){rpcDb[_0xc090('0x69')](ut['createBody'](_0x4e418c[_0x2b0c03]));rpcDb[_0xc090('0x6a')](_0xdd4df,_0xc090('0x6b'));}else{ut[_0xc090('0x6c')](_0xdd4df,0x16,'RecallFailedTimeout');rpcDb[_0xc090('0x6a')](_0xdd4df,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0xdd4df,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xc090('0x63')]('[getContactRecallMe]'));};Preview[_0xc090('0x11')][_0xc090('0x40')]=function(_0x40b341){_0x40b341[_0xc090('0x2f')]=!![];if(ut[_0xc090('0x6d')](_0x40b341[_0xc090('0x6e')])){_0x40b341[_0xc090('0x31')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0xc090('0x6f')](_0x40b341[_0xc090('0x3f')])){_0x40b341['message']=utils[_0xc090('0x33')][_0xc090('0x70')];}else if(!this[_0xc090('0x71')](_0x40b341[_0xc090('0x72')])){if(!this[_0xc090('0x71')](_0x40b341[_0xc090('0x73')])){_0x40b341[_0xc090('0x31')]=utils[_0xc090('0x33')][_0xc090('0x74')];}else{_0x40b341[_0xc090('0x31')]=utils[_0xc090('0x33')][_0xc090('0x75')];}}else{_0x40b341['message']=utils[_0xc090('0x33')][_0xc090('0x75')];}};Preview[_0xc090('0x11')][_0xc090('0x76')]=function(_0x28bd4e,_0x4db865,_0x3a3845){var _0x23e580=this;var _0x1b2c74=this['actions'][_0x4db865];var _0x105faa=this[_0xc090('0x16')][_0x1b2c74[_0xc090('0x47')]];var _0x1486de;var _0x29bbc9=![];var _0x22a11b=0x2;var _0x52d821=0x3;if(_0x105faa){switch(_0x3a3845){case'1':_0x105faa[_0xc090('0x77')]+=0x1;_0x1b2c74[_0xc090('0x78')]+=0x1;_0x1b2c74['countglobal']=ut['totalGlobal'](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0x0,'NoSuchNumber');ami['emit'](_0xc090('0x79'),ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0x7b')));rpcDb[_0xc090('0x6a')](_0x1b2c74,'[callProgressDetectingCustomer][logNoSuch]');_0x23e580['verifyAdditionalPhones'](_0x1b2c74,'0',_0x105faa)[_0xc090('0x5a')](function(_0x17ae4c){_0x29bbc9=_0x17ae4c[_0xc090('0x7c')]==0x1;_0x22a11b=_0x105faa[_0xc090('0x7d')];_0x52d821=_0x105faa[_0xc090('0x7e')];if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut['cloneAction'](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0x83'));}else{if(_0x1b2c74[_0xc090('0x78')]>=_0x105faa[_0xc090('0x84')]){rpcDb[_0xc090('0x82')](_0x1b2c74,_0xc090('0x83'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1b2c74,'countnosuchnumberretry',_0x105faa[_0xc090('0x7d')]),_0x1b2c74['unlockAgent'],_0x1b2c74[_0xc090('0x85')]);}}delete this[_0xc090('0x46')][_0x28bd4e[_0xc090('0x86')]];}else{_0x1b2c74[_0xc090('0x78')]++;logger[_0xc090('0x44')](_0xc090('0x87'),_0x1b2c74[_0xc090('0x78')]);logger[_0xc090('0x44')]('id',_0x1b2c74[_0xc090('0x88')]);_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74['idContact'],'field':{'countnosuchnumberretry':_0x1b2c74[_0xc090('0x78')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});break;case _0xc090('0x8b'):var _0x5064c8=moment()[_0xc090('0x2a')](_0xc090('0x66'));_0x1b2c74[_0xc090('0x8c')]=_0x5064c8;_0x1b2c74['answertime']=_0x5064c8;_0x1b2c74[_0xc090('0x4a')]=!![];_0x105faa[_0xc090('0x8d')]+=0x1;logger[_0xc090('0x44')](_0xc090('0x8e'),_0x1b2c74['uniqueid'],'\x20Queue',_0x105faa[_0xc090('0x2c')],'pTalking:\x20',_0x105faa['pTalking']);ami[_0xc090('0x28')](_0xc090('0x8f'),ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0x90'),this['campaignsPreview'][_0x1b2c74[_0xc090('0x47')]]));if(_0x105faa['acw']){ami[_0xc090('0x28')](_0xc090('0x91'),ut['buildAcw'](_0x1b2c74));}break;case'16':ami[_0xc090('0x28')]('custom:agentcomplete',ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0x92'),this[_0xc090('0x16')][_0x1b2c74['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x1b2c74,_0xc090('0x92')));_0x105faa[_0xc090('0x93')]+=0x1;_0x105faa[_0xc090('0x94')]+=0x1;_0x105faa[_0xc090('0x95')]+=0x1;ut[_0xc090('0x52')](_0x105faa,_0xc090('0x96'));_0x1b2c74[_0xc090('0x97')]=ut[_0xc090('0x7f')](_0x1b2c74);ut['logCustomer'](_0x1b2c74,0x4,_0xc090('0x98'));rpcDb[_0xc090('0x6a')](_0x1b2c74,_0xc090('0x99'));rpcDb[_0xc090('0x82')](_0x1b2c74,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xc090('0x9a')](_0x1b2c74);_0x105faa[_0xc090('0x9b')]+=_0x1b2c74[_0xc090('0x9c')];_0x105faa[_0xc090('0x9d')]+=_0x1b2c74['talktime'];logger['info'](_0xc090('0x9e'),_0x1b2c74[_0xc090('0x9f')],_0xc090('0xa0'),_0x105faa[_0xc090('0x2c')],_0xc090('0xa1'),_0x105faa[_0xc090('0x8d')]);delete this[_0xc090('0x46')][_0x28bd4e[_0xc090('0x86')]];break;case _0xc090('0xa2'):_0x105faa['outboundBusyCallsDay']+=0x1;_0x1b2c74[_0xc090('0xa3')]+=0x1;_0x1b2c74['countglobal']=ut['totalGlobal'](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0x5,'Busy');_0x22a11b=_0x105faa[_0xc090('0xa4')];_0x52d821=_0x105faa['callAdditionalPhoneAfterMin'];ami[_0xc090('0x28')]('custom:agentbusy',ut['buildObj'](_0x1b2c74,'busy'));rpcDb[_0xc090('0x6a')](_0x1b2c74,'[callProgressDetectingCustomer][logBusy]');_0x23e580[_0xc090('0xa5')](_0x1b2c74,'5',_0x105faa)[_0xc090('0x5a')](function(_0x256704){_0x29bbc9=_0x256704[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut['totalGlobal'](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0xa7'));}else{if(_0x1b2c74[_0xc090('0xa3')]>=_0x105faa[_0xc090('0xa8')]){rpcDb['createCustomerFinal'](_0x1b2c74,_0xc090('0xa9'));}else{rpcDb[_0xc090('0xaa')](ut[_0xc090('0xab')](_0x1b2c74,_0xc090('0xa3'),_0x105faa[_0xc090('0xa4')]),_0x1b2c74['unlockAgent'],_0x1b2c74[_0xc090('0x85')]);}}}else{_0x1b2c74[_0xc090('0xa3')]++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74['idContact'],'field':{'countbusyretry':_0x1b2c74[_0xc090('0xa3')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});break;case _0xc090('0xac'):_0x105faa[_0xc090('0xad')]+=0x1;_0x1b2c74['countnoanswerretry']+=0x1;_0x1b2c74[_0xc090('0x97')]=ut[_0xc090('0x7f')](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0x3,_0xc090('0xae'));_0x22a11b=_0x105faa[_0xc090('0xaf')];_0x52d821=_0x105faa[_0xc090('0x7e')];var _0x5a591b=ut[_0xc090('0xb0')](_0x1b2c74,_0x105faa);ami[_0xc090('0x28')](_0xc090('0xb1'),_0x5a591b);rpcDb[_0xc090('0x6a')](_0x1b2c74,_0xc090('0xb2'));_0x23e580['verifyAdditionalPhones'](_0x1b2c74,'3',_0x105faa)[_0xc090('0x5a')](function(_0x3432e6){_0x29bbc9=_0x3432e6[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa['dialGlobalMaxRetry']){_0x1486de=ut['cloneAction'](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb['createCustomerFinal'](_0x1486de,_0xc090('0xb3'));}else{if(_0x1b2c74['countnoanswerretry']>=_0x105faa['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x1b2c74,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xc090('0xab')](_0x1b2c74,_0xc090('0xb4'),_0x105faa['dialNoAnswerRetryFrequency']),_0x1b2c74[_0xc090('0xb5')],_0x1b2c74[_0xc090('0x85')]);}}}else{_0x1b2c74[_0xc090('0xb4')]++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74[_0xc090('0x88')],'field':{'countnoanswerretry':_0x1b2c74['countnoanswerretry']}})['then'](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});break;case _0xc090('0xb6'):_0x105faa[_0xc090('0xb7')]+=0x1;_0x1b2c74[_0xc090('0xb8')]+=0x1;_0x1b2c74[_0xc090('0x97')]=ut['totalGlobal'](_0x1b2c74);ut['logCustomer'](_0x1b2c74,0x8,_0xc090('0xb9'));_0x22a11b=_0x105faa[_0xc090('0xba')];_0x52d821=_0x105faa[_0xc090('0x7e')];ami[_0xc090('0x28')](_0xc090('0xbb'),ut['buildObj'](_0x1b2c74,'congestion'));rpcDb[_0xc090('0x6a')](_0x1b2c74,_0xc090('0xbc'));_0x23e580[_0xc090('0xa5')](_0x1b2c74,'8',_0x105faa)['then'](function(_0x1c5a76){_0x29bbc9=_0x1c5a76[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0xbd'));}else{if(_0x1b2c74['countcongestionretry']>=_0x105faa['dialCongestionMaxRetry']){rpcDb[_0xc090('0x82')](_0x1b2c74,_0xc090('0xbc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1b2c74,_0xc090('0xb8'),_0x105faa[_0xc090('0xa4')]),_0x1b2c74[_0xc090('0xb5')],_0x1b2c74[_0xc090('0x85')]);}}}else{_0x1b2c74['countcongestionretry']++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74['idContact'],'field':{'countcongestionretry':_0x1b2c74[_0xc090('0xb8')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});break;case _0xc090('0xbe'):_0x105faa[_0xc090('0xbf')]+=0x1;_0x1b2c74[_0xc090('0xc0')]+=0x1;_0x1b2c74[_0xc090('0x97')]=ut[_0xc090('0x7f')](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0x14,_0xc090('0xc1'));_0x22a11b=_0x105faa['dialAgentRejectRetryFrequency'];_0x52d821=_0x105faa[_0xc090('0x7e')];ami[_0xc090('0x28')](_0xc090('0xc2'),ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0xc3')));rpcDb['createCustomerHistory'](_0x1b2c74,_0xc090('0xc4'));_0x23e580[_0xc090('0xa5')](_0x1b2c74,'20',_0x105faa)[_0xc090('0x5a')](function(_0x6e39e){_0x29bbc9=_0x6e39e[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x1486de,_0xc090('0xc5'));}else{if(_0x1b2c74[_0xc090('0xc0')]>=_0x105faa[_0xc090('0xc6')]){rpcDb['createCustomerFinal'](_0x1b2c74,_0xc090('0xc5'));}else{rpcDb[_0xc090('0xaa')](ut[_0xc090('0xab')](_0x1b2c74,_0xc090('0xc0'),_0x105faa[_0xc090('0xc7')]),_0x1b2c74[_0xc090('0xb5')],_0x1b2c74[_0xc090('0x85')]);}}}else{_0x1b2c74['countnoanswerretry']++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74['idContact'],'field':{'countnoanswerretry':_0x1b2c74[_0xc090('0xb4')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)['then'](function(){});});}});break;case'ABANDONED':_0x105faa[_0xc090('0xc8')]+=0x1;_0x1b2c74[_0xc090('0xc9')]+=0x1;_0x1b2c74['countglobal']=ut[_0xc090('0x7f')](_0x1b2c74);ut['logCustomer'](_0x1b2c74,0xb,_0xc090('0xca'));rpcDb[_0xc090('0x6a')](_0x1b2c74,'[callProgressDetectingCustomer][logAbandoned]');_0x23e580['verifyAdditionalPhones'](_0x1b2c74,'11',_0x105faa)[_0xc090('0x5a')](function(_0x3b0a65){_0x29bbc9=_0x3b0a65[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut['totalGlobal'](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0xcb'));}else{if(_0x1b2c74[_0xc090('0xcc')]>=_0x105faa[_0xc090('0xcd')]){rpcDb[_0xc090('0x82')](_0x1b2c74,_0xc090('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0xc090('0xab')](_0x1b2c74,_0xc090('0xc9'),_0x105faa[_0xc090('0xce')]),_0x1b2c74[_0xc090('0xb5')],_0x1b2c74['activeContact']);}}}else{_0x1b2c74['countnoanswerretry']++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74[_0xc090('0x88')],'field':{'countnoanswerretry':_0x1b2c74[_0xc090('0xb4')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)['then'](function(){});});}});break;case'18':_0x105faa[_0xc090('0xcf')]+=0x1;_0x1b2c74[_0xc090('0xd0')]+=0x1;_0x1b2c74[_0xc090('0x97')]=ut[_0xc090('0x7f')](_0x1b2c74);ut['logCustomer'](_0x1b2c74,0x12,_0x28bd4e[_0xc090('0xd1')]||_0x28bd4e[_0xc090('0xd2')]);ami[_0xc090('0x28')](_0xc090('0xd3'),ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0xd4')));rpcDb['createCustomerHistory'](_0x1b2c74,'[callProgressDetectingCustomer][hangupInAMD]');_0x23e580[_0xc090('0xa5')](_0x1b2c74,'18',_0x105faa)[_0xc090('0x5a')](function(_0x56a018){_0x29bbc9=_0x56a018[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa['dialGlobalMaxRetry']){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0x12,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0xd5'));}else{rpcDb[_0xc090('0x82')](_0x1b2c74,_0xc090('0xd5'));}}else{_0x1b2c74[_0xc090('0xb4')]++;_0x23e580[_0xc090('0x89')]({'id':_0x1b2c74[_0xc090('0x88')],'field':{'countnoanswerretry':_0x1b2c74[_0xc090('0xb4')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});delete this[_0xc090('0x46')][_0x28bd4e[_0xc090('0x86')]];break;case'19':_0x105faa[_0xc090('0xcf')]+=0x1;_0x1b2c74[_0xc090('0x97')]=ut[_0xc090('0x7f')](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0x13,_0x28bd4e['cause-txt']||_0x28bd4e[_0xc090('0xd2')]);ami['emit']('custom:amd',ut[_0xc090('0x7a')](_0x1b2c74,_0xc090('0xd4')));rpcDb[_0xc090('0x6a')](_0x1b2c74,_0xc090('0xd6'));_0x23e580[_0xc090('0xa5')](_0x1b2c74,'18',_0x105faa)[_0xc090('0x5a')](function(_0x498aa1){_0x29bbc9=_0x498aa1[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut['cloneAction'](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb[_0xc090('0x82')](_0x1486de,_0xc090('0xd6'));}else{rpcDb[_0xc090('0x82')](_0x1b2c74,'[callProgressDetectingCustomer][machine]');}}else{_0x1b2c74[_0xc090('0xb4')]++;_0x23e580['incrementPreviewCounters']({'id':_0x1b2c74['idContact'],'field':{'countnoanswerretry':_0x1b2c74[_0xc090('0xb4')]}})[_0xc090('0x5a')](function(){_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});});}});delete this['actions'][_0x28bd4e[_0xc090('0x86')]];break;default:if(_0x1b2c74[_0xc090('0x4a')]){ut['decrementTalkink'](_0x105faa,_0xc090('0xd7'));ut[_0xc090('0x54')](_0xc090('0xd8')+_0x105faa[_0xc090('0x2c')],_0x28bd4e);}_0x105faa[_0xc090('0xcf')]+=0x1;_0x1b2c74[_0xc090('0x97')]=ut['totalGlobal'](_0x1b2c74);ut[_0xc090('0x6c')](_0x1b2c74,0xc,_0x28bd4e[_0xc090('0xd1')]||_0x28bd4e['dialstatus']);_0x22a11b=_0x105faa[_0xc090('0xc7')];_0x52d821=_0x105faa[_0xc090('0x7e')];rpcDb[_0xc090('0x6a')](_0x1b2c74,_0xc090('0xd9'));_0x23e580[_0xc090('0xa5')](_0x1b2c74,'20',_0x105faa)[_0xc090('0x5a')](function(_0x4528f1){_0x29bbc9=_0x4528f1[_0xc090('0x7c')]==0x1;if(!_0x29bbc9){if(ut[_0xc090('0x7f')](_0x1b2c74)>=_0x105faa[_0xc090('0x80')]){_0x1486de=ut[_0xc090('0xa6')](_0x1b2c74,0xf,_0xc090('0x81'));rpcDb['createCustomerFinal'](_0x1486de,_0xc090('0xda'));}else{rpcDb[_0xc090('0x82')](_0x1b2c74,_0xc090('0xda'));}delete this[_0xc090('0x46')][_0x28bd4e[_0xc090('0x86')]];}else{_0x23e580[_0xc090('0x8a')](_0x1b2c74,_0x22a11b,_0x52d821)[_0xc090('0x5a')](function(){});}});}if(!(_0x1b2c74[_0xc090('0x4a')]&&_0x3a3845==='16')){ut['updateOriginated'](_0x105faa,'[callProgressDetectingCustomer]');logger[_0xc090('0x44')]('[originated][decrement][callProgressDetectingCustomer]',_0x1b2c74['uniqueid'],_0xc090('0xa0'),_0x105faa['name'],_0xc090('0xdb'),_0x105faa['originated']);}if(_0x3a3845!==_0xc090('0x8b')){delete this[_0xc090('0x46')][_0x28bd4e['linkedid']];delete this[_0xc090('0x46')][_0x28bd4e['destlinkedid']];}_0x105faa['queueSummaryCountersUpdated']=!![];}};Preview[_0xc090('0x11')][_0xc090('0xdc')]=function(_0x4bc5e7,_0x5653f8,_0x31f9fc){if(_[_0xc090('0xdd')](_0x5653f8)&&_0xc090('0xde')!==typeof _0x5653f8){return;}if(_['isUndefined'](_0x31f9fc)&&'object'!==typeof _0x31f9fc){return;}switch(_0x31f9fc[_0xc090('0xdf')]){case'0':ut[_0xc090('0xe0')](_0x4bc5e7,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x4bc5e7,_0xc090('0xe1'));break;case'3':ut[_0xc090('0xe0')](_0x4bc5e7,0x3,_0xc090('0xae'));rpcDb[_0xc090('0xe2')](_0x4bc5e7,_0xc090('0xe3'));break;case'5':ut['logAgent'](_0x4bc5e7,0x5,'Busy');rpcDb[_0xc090('0xe2')](_0x4bc5e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc090('0xe0')](_0x4bc5e7,0x8,_0xc090('0xb9'));rpcDb[_0xc090('0xe2')](_0x4bc5e7,_0xc090('0xe4'));break;case'22':ut[_0xc090('0xe0')](_0x4bc5e7,0x16,_0xc090('0xe5'));rpcDb[_0xc090('0xe2')](_0x4bc5e7,_0xc090('0xe6'));break;default:ut['logAgent'](_0x4bc5e7,0xc,_0x31f9fc['reason']);rpcDb[_0xc090('0xe2')](_0x4bc5e7,_0xc090('0xe4'));}ut[_0xc090('0x51')](_0x5653f8,_0xc090('0xe7'));logger[_0xc090('0x44')](_0xc090('0xe8'),_0x4bc5e7['uniqueid'],_0xc090('0xa0'),_0x5653f8[_0xc090('0x2c')],_0xc090('0xdb'),_0x5653f8[_0xc090('0x48')]);delete this[_0xc090('0x46')][_0x4bc5e7[_0xc090('0x9f')]];};Preview[_0xc090('0x11')]['verifyAdditionalPhones']=function(_0x41b5c8,_0x217665,_0x19dfda){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x41b5c8,_0x217665,_0x19dfda)['catch'](logger[_0xc090('0x44')](_0xc090('0xe9')));};Preview[_0xc090('0x11')]['swapAdditionalPhones']=function(_0x599313,_0x1fa5a5,_0x852054){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x599313,_0x1fa5a5,_0x852054)[_0xc090('0x50')](logger[_0xc090('0x44')](_0xc090('0xea')));};Preview['prototype'][_0xc090('0x89')]=function(_0x28e23c){return Promise[_0xc090('0xeb')]()[_0xc090('0x5a')](cmHopperAdditionalPhone[_0xc090('0x89')](_0x28e23c))[_0xc090('0x50')](logger[_0xc090('0x44')](_0xc090('0xec')));};Preview[_0xc090('0x11')][_0xc090('0xed')]=function(_0x2f7b95,_0xbe1eb9,_0x131514,_0x5ff165,_0x24ac8d){var _0x3f11c2=this;return new Promise(function(_0x2fb694,_0x3115c7){if(_[_0xc090('0x43')](_0xbe1eb9)||_['isNil'](_0xbe1eb9[_0xc090('0xee')])||_[_0xc090('0x43')](_0xbe1eb9[_0xc090('0xef')])||_[_0xc090('0x43')](_0xbe1eb9['VoiceQueueId'])){_0x3115c7(ut[_0xc090('0x31')]('Contact\x20is\x20undefined',_0x5ff165,_0x24ac8d));return;}var _0x69a602=uuid['v4']();var _0xde0b47=_0x3f11c2[_0xc090('0x16')][_0xbe1eb9[_0xc090('0x45')][_0xc090('0x2c')]];var _0x104906=_0x131514?_0x3f11c2[_0xc090('0x19')][_0x131514]['id']:undefined;_0x3f11c2[_0xc090('0x46')][_0x69a602]=new Action(_0xbe1eb9,_0xde0b47,_0x69a602,_0x131514,_0x104906);var _0x521ac6=_0x3f11c2[_0xc090('0x46')][_0x69a602];_0x521ac6[_0xc090('0xb5')]=_0x5ff165;_0x521ac6[_0xc090('0x85')]=_0x24ac8d;_0x521ac6['lookAgent']=_0x131514;if(_[_0xc090('0xf0')](_0x2f7b95)){_0x3f11c2[_0xc090('0xf1')](_0x521ac6,_0xde0b47,_0xbe1eb9,_0x131514)[_0xc090('0x5a')](function(_0xb9702a){logger[_0xc090('0x44')](_0xc090('0xf2'),'Queue:\x20'+_0x521ac6[_0xc090('0x47')]+_0xc090('0xf3')+_0x521ac6[_0xc090('0x88')],JSON['stringify'](_0xb9702a));ami[_0xc090('0x28')](_0xc090('0xf4'),ut[_0xc090('0x7a')](_0x521ac6,'called',_0x3f11c2['campaignsPreview'][_0x521ac6[_0xc090('0x47')]]));_0x2fb694(ut['message'](_0xc090('0xf5')));})[_0xc090('0x50')](function(_0x64803f){ut['logger'](_0xc090('0xf6'),_0x64803f);_0x3115c7(ut[_0xc090('0x31')](_0xc090('0xf7'),_0x5ff165,_0x24ac8d));});}else{_0xde0b47[_0xc090('0xf8')]+=0x1;ut[_0xc090('0xf9')](_0x521ac6);rpcDb[_0xc090('0xfa')](_0x521ac6,_0xc090('0xfb'));delete _0x3f11c2[_0xc090('0x46')][_0x69a602];_0x3115c7(ut[_0xc090('0x31')](_0xc090('0xfc'),_0x5ff165,_0x24ac8d));}});};Preview[_0xc090('0x11')][_0xc090('0x71')]=function(_0x4f0f77){return!_[_0xc090('0x43')](_0x4f0f77)&&!_['isNil'](_0x4f0f77['name'])&&!_[_0xc090('0x43')](_0x4f0f77[_0xc090('0xfd')])&&_0x4f0f77['active']&&!_['isNil'](this[_0xc090('0x18')][util[_0xc090('0x2a')](_0xc090('0xfe'),_0x4f0f77[_0xc090('0x2c')])])&&!_[_0xc090('0x43')](this[_0xc090('0x18')][util[_0xc090('0x2a')](_0xc090('0xfe'),_0x4f0f77['name'])]['status'])&&(this[_0xc090('0x18')][util[_0xc090('0x2a')]('SIP/%s',_0x4f0f77[_0xc090('0x2c')])][_0xc090('0x4e')]===_0xc090('0xff')||this['trunks'][util[_0xc090('0x2a')](_0xc090('0xfe'),_0x4f0f77[_0xc090('0x2c')])]['status']===_0xc090('0x100'));};Preview[_0xc090('0x11')]['run']=function(_0x2486a9,_0x28d0fe){return this[_0xc090('0x101')](_0x2486a9,_0x28d0fe)['then'](function(_0x37606a){return _[_0xc090('0x102')](_0x37606a,[_0xc090('0x31')]);})['catch'](function(_0x377861){if(_0x377861[_0xc090('0x103')]){rpcDb['unlockContact'](_0x2486a9);}if(_0x377861[_0xc090('0xfd')]){rpcDb['disableContact'](_0x2486a9);}throw _[_0xc090('0x102')](_0x377861,['message']);});};Preview[_0xc090('0x11')][_0xc090('0x101')]=function(_0x3dcc6a,_0x111e2b){var _0xbf0579=this;var _0x1fd0de,_0x38a47c;return rpcDb[_0xc090('0x104')](_0x3dcc6a)[_0xc090('0x5a')](function(_0x5c478e){if(!_['isNil'](_0x5c478e[0x0])){_0x38a47c=_0x5c478e[0x0][_0xc090('0x105')]?![]:!![];_0x1fd0de=_0x5c478e[0x0]['recallme']?!![]:![];_0x1fd0de=_0x111e2b?!![]:_0x1fd0de;}var _0x5cfef5=_0xbf0579['validateContact'](_0x5c478e);if(_0x5cfef5['isValid']){rpcDb[_0xc090('0x106')](_[_0xc090('0x102')](_0x5c478e[0x0],[_0xc090('0x107'),_0xc090('0xef')]))[_0xc090('0x5a')](function(_0x3578f1){_0xbf0579[_0xc090('0xed')](_0x3578f1,_0x5c478e[0x0],_0x111e2b,_0x38a47c,_0x1fd0de)[_0xc090('0x5a')](function(_0x30565f){return _0x30565f;})[_0xc090('0x50')](function(_0x30c0df){throw _0x30c0df;});})['catch'](function(_0x87df11){ut[_0xc090('0x32')](_0xc090('0x108'),_0x87df11);throw ut[_0xc090('0x31')]('Call\x20unsuccessful',_0x38a47c,_0x1fd0de);});}else{throw ut[_0xc090('0x31')](_0x5cfef5[_0xc090('0x31')],_0x38a47c,_0x1fd0de);}})['catch'](function(_0x3df847){ut[_0xc090('0x32')](_0xc090('0x109'),_0x3df847);throw ut['message'](_0xc090('0x10a'),![],!![]);});};Preview[_0xc090('0x11')][_0xc090('0x10b')]=function(_0x14aa8b){if(_['isNil'](_0x14aa8b)||_[_0xc090('0xf0')](_0x14aa8b)||!_[_0xc090('0x43')](_0x14aa8b[0x0][_0xc090('0x5f')])&&_['isNil'](_0x14aa8b[0x0][_0xc090('0x5f')][_0xc090('0x2c')])){ut[_0xc090('0x32')]('[Preview][validateContact][Empty\x20Contact]',_0x14aa8b);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x508fdc=this['campaignsPreview'][_0x14aa8b[0x0][_0xc090('0x45')][_0xc090('0x2c')]];_0x508fdc[_0xc090('0x31')]=utils[_0xc090('0x33')][_0xc090('0x75')];if(_[_0xc090('0x43')](_0x508fdc)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x508fdc);return{'isValid':![],'message':_0xc090('0x10c')};}if(!this['isTrunkReachable'](_0x508fdc[_0xc090('0x72')])){ut[_0xc090('0x32')](_0xc090('0x10d'),'campaign\x20Name:\x20'+_0x508fdc[_0xc090('0x2c')]+_0xc090('0x10e'));if(!this[_0xc090('0x71')](_0x508fdc[_0xc090('0x73')])){ut[_0xc090('0x32')](_0xc090('0x10d'),_0x508fdc[_0xc090('0x2c')]+_0xc090('0x10f'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xc090('0x6f')](_0x508fdc[_0xc090('0x3f')])){ut[_0xc090('0x32')](_0xc090('0x110'),_0x508fdc['name']+_0xc090('0x111'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x508fdc[_0xc090('0x2c')]+_0xc090('0x111')};}return{'isValid':!![],'message':_0xc090('0x112')};};Preview[_0xc090('0x11')][_0xc090('0xf1')]=function(_0x525dbb,_0x4a6f20,_0x19dc5a,_0x20f998){var _0x4f0e47=this;return new Promise(function(_0x1ca998,_0x29bf3b){var _0x389d4a=_0x525dbb[_0xc090('0x9f')];var _0x25592d=_0x4f0e47[_0xc090('0x71')](_0x4a6f20[_0xc090('0x72')])?util[_0xc090('0x2a')](_0xc090('0x113'),_0x4a6f20[_0xc090('0x72')][_0xc090('0x2c')],_[_0xc090('0x43')](_0x4a6f20['dialPrefix'])?'':_0x4a6f20[_0xc090('0x114')][_0xc090('0x115')]()||'',_0x4a6f20['dialCutDigit']>0x0?_0x19dc5a[_0xc090('0xef')][_0xc090('0x116')](_0x4a6f20['dialCutDigit']):_0x19dc5a[_0xc090('0xef')]):util[_0xc090('0x2a')](_0xc090('0x113'),_[_0xc090('0x43')](_0x4a6f20['TrunkBackup'])?_0x4a6f20[_0xc090('0x72')][_0xc090('0x2c')]:_0x4a6f20[_0xc090('0x73')]['name'],_[_0xc090('0x43')](_0x4a6f20['dialPrefix'])?'':_0x4a6f20[_0xc090('0x114')][_0xc090('0x115')]()||'',_0x4a6f20[_0xc090('0x117')]>0x0?_0x19dc5a[_0xc090('0xef')][_0xc090('0x116')](_0x4a6f20[_0xc090('0x117')]):_0x19dc5a[_0xc090('0xef')]);var _0xf4c6cb=_0x4f0e47['isTrunkReachable'](_0x4a6f20[_0xc090('0x72')])?ut[_0xc090('0x118')](_0x4a6f20[_0xc090('0x72')][_0xc090('0x119')],_0x4a6f20[_0xc090('0x11a')],_0x4a6f20['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xc090('0x11b')](_0x4a6f20['dialOriginateCallerIdNumber'],_0x4a6f20[_0xc090('0x11c')]):_0x4a6f20['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x4a6f20[_0xc090('0x73')])?_0x4a6f20[_0xc090('0x72')]['callerid']:_0x4a6f20[_0xc090('0x73')][_0xc090('0x119')],_0x4a6f20[_0xc090('0x11a')],_0x4a6f20[_0xc090('0x11c')]>0x0?ut['getCallerIdRandom'](_0x4a6f20[_0xc090('0x11d')],_0x4a6f20['dialRandomLastDigitCallerIdNumber']):_0x4a6f20[_0xc090('0x11d')]);if(_0xf4c6cb){_0x525dbb[_0xc090('0x11e')]=ut[_0xc090('0x11f')](_0xf4c6cb);_0x525dbb['originatecalleridnum']=ut[_0xc090('0x120')](_0xf4c6cb);}var _0x4603f3=ut[_0xc090('0x121')](_0x4a6f20,_0x19dc5a,_0x25592d,_0xf4c6cb,_0x389d4a,_0x525dbb);var _0x4ac2d9=utils['setXMDContactVariables'](_0x19dc5a['Contact']);Object[_0xc090('0x122')](_0x4603f3,_0x4ac2d9);_[_0xc090('0x123')](_0x525dbb,ut[_0xc090('0x124')](_0x4603f3));_0x525dbb[_0xc090('0x65')]=moment()[_0xc090('0x2a')](_0xc090('0x66'));_0x4a6f20[_0xc090('0x125')]=_0x4603f3;var _0x3021d7=ut[_0xc090('0x126')](_0x525dbb,_0x4a6f20,_0x4603f3,_0x525dbb[_0xc090('0x85')],_0x20f998);return ami[_0xc090('0x4d')](_0x3021d7)[_0xc090('0x5a')](function(_0x4f4d6b){_0x4a6f20[_0xc090('0x48')]+=0x1;logger['info'](_0xc090('0x127'),_0x389d4a,'\x20Queue',_0x4a6f20['name'],_0xc090('0xdb'),_0x4a6f20['originated']);_0x1ca998(_0x4f4d6b);})[_0xc090('0x50')](function(_0x7cecf7){ut[_0xc090('0xe0')](_0x525dbb,0xe,_0xc090('0x128'));rpcDb[_0xc090('0xe2')](_0x525dbb,'[originateFailure][logOriginateFailure]');_0x29bf3b(_0x7cecf7);});});};Preview['prototype']['syncNewExten']=function(_0x56c0f8){if(this[_0xc090('0x46')][_0x56c0f8[_0xc090('0x86')]]){this[_0xc090('0x46')][_0x56c0f8[_0xc090('0x86')]]['channel']=_0x56c0f8['channel'];}};Preview[_0xc090('0x11')][_0xc090('0x1b')]=function(_0x2c7b8a){var _0xf2355e=this;var _0x22b18c=this[_0xc090('0x46')][_0x2c7b8a[_0xc090('0x129')]];if(_0x22b18c){if(_0x22b18c[_0xc090('0x12a')]&&this['agents'][_0x22b18c['lookAgent']]){ut[_0xc090('0x12b')](_0x22b18c,this[_0xc090('0x19')][_0x22b18c[_0xc090('0x12a')]]['name'],this['agents'][_0x22b18c[_0xc090('0x12a')]]['id']);}var _0x218d42=_['clone'](_0x22b18c);_0x218d42[_0xc090('0x8c')]=moment()[_0xc090('0x2a')](_0xc090('0x66'));var _0x23d54d=_0xf2355e[_0xc090('0x16')][_0x22b18c[_0xc090('0x47')]];if(ut['isFailure'](_0x2c7b8a['response'])){if(_0x22b18c[_0xc090('0xb5')]){rpcDb[_0xc090('0x12c')](_0x22b18c[_0xc090('0x88')]);}if(_0x22b18c['activeContact']){rpcDb['disableContact'](_0x22b18c[_0xc090('0x88')]);}ami[_0xc090('0x28')](_0xc090('0x12d'),ut[_0xc090('0x7a')](_0x22b18c,_0xc090('0x12e'),this[_0xc090('0x16')][_0x22b18c[_0xc090('0x47')]]));this[_0xc090('0xdc')](_0x218d42,_0x23d54d,_0x2c7b8a);}else{_0x22b18c[_0xc090('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0xc090('0xe0')](_0x218d42,0x4,'Answer');rpcDb[_0xc090('0xe2')](_0x218d42,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x1256a4){var _0x125b98=this[_0xc090('0x46')][_0x1256a4['linkedid']];var _0x5ce6fc;if(_0x125b98){_0x5ce6fc=this['campaignsPreview'][_0x125b98['queue']];logger['info'](_0xc090('0x12f'),_0x1256a4[_0xc090('0x86')],'\x20Queue',_0x5ce6fc[_0xc090('0x2c')],_0xc090('0xa1'),_0x5ce6fc[_0xc090('0x8d')]);}if(this[_0xc090('0x46')][_0x1256a4[_0xc090('0x86')]]&&_0x1256a4['linkedid']!==_0x1256a4['uniqueid']){if(_0x1256a4[_0xc090('0x130')]==='16'&&this[_0xc090('0x46')][_0x1256a4[_0xc090('0x86')]][_0xc090('0x4a')]){this['callProgressDetectingCustomer'](_0x1256a4,_0x1256a4['linkedid'],_0x1256a4[_0xc090('0x130')]);}else if(this[_0xc090('0x46')][_0x1256a4[_0xc090('0x86')]][_0xc090('0x4a')]){logger[_0xc090('0x44')](_0xc090('0x131'),_0x1256a4[_0xc090('0x86')],_0x1256a4[_0xc090('0x130')],_0xc090('0xa0'),_0x5ce6fc['name'],'pTalking:\x20',_0x5ce6fc['pTalking']);this[_0xc090('0x76')](_0x1256a4,_0x1256a4[_0xc090('0x86')],_0x1256a4[_0xc090('0x130')]);}}else if(_0x125b98&&_[_0xc090('0x43')](_0x125b98['statedesc'])&&_0x5ce6fc[_0xc090('0x132')]&&_0x1256a4[_0xc090('0x86')]===_0x1256a4['uniqueid']&&_[_0xc090('0x43')](_0x1256a4[_0xc090('0xdf')])&&_0x1256a4[_0xc090('0x130')]==='16'&&_0x1256a4['channelstate']==='6'&&_[_0xc090('0xdd')](_0x125b98[_0xc090('0x133')])){if(_0x125b98['unlockAgent']){rpcDb[_0xc090('0x12c')](_0x125b98['idContact']);}if(_0x125b98[_0xc090('0x85')]){rpcDb[_0xc090('0x64')](_0x125b98[_0xc090('0x88')]);}_0x1256a4[_0xc090('0xdf')]='22';this[_0xc090('0xdc')](_0x125b98,_0x5ce6fc,_0x1256a4);}else if(_0x125b98&&_0x125b98['transfer']){if(_0x1256a4['cause']==='16'&&this[_0xc090('0x46')][_0x1256a4[_0xc090('0x86')]]['dialAnswer']){logger[_0xc090('0x44')](_0xc090('0x134'),_0x1256a4['linkedid'],_0x1256a4[_0xc090('0x130')],_0xc090('0xa0'),_0x5ce6fc['name'],_0xc090('0xa1'),_0x5ce6fc[_0xc090('0x8d')]);this[_0xc090('0x76')](_0x1256a4,_0x1256a4[_0xc090('0x86')],_0x1256a4[_0xc090('0x130')]);}else if(this[_0xc090('0x46')][_0x1256a4[_0xc090('0x86')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x1256a4[_0xc090('0x86')],_0x1256a4[_0xc090('0x130')],_0xc090('0xa0'),_0x5ce6fc[_0xc090('0x2c')],_0xc090('0xa1'),_0x5ce6fc[_0xc090('0x8d')]);this[_0xc090('0x76')](_0x1256a4,_0x1256a4['linkedid'],_0x1256a4['cause']);}}};Preview[_0xc090('0x11')]['syncDialEnd']=function(_0x550c4e){if(this[_0xc090('0x46')][_0x550c4e['destlinkedid']]&&_0x550c4e[_0xc090('0x135')]!==_0x550c4e['destuniqueid']){this['callProgressDetectingCustomer'](_0x550c4e,_0x550c4e['destlinkedid'],_0x550c4e['dialstatus']);}};Preview[_0xc090('0x11')][_0xc090('0x136')]=function(_0x4f2c85){if(this[_0xc090('0x46')][_0x4f2c85[_0xc090('0x86')]]&&_0x4f2c85[_0xc090('0x86')]!==_0x4f2c85[_0xc090('0x9f')]&&!this['actions'][_0x4f2c85[_0xc090('0x86')]]['dialAnswer']){if(_0x4f2c85['cause']==='1'){this['callProgressDetectingCustomer'](_0x4f2c85,_0x4f2c85[_0xc090('0x86')],_0x4f2c85[_0xc090('0x130')]);}}};Preview[_0xc090('0x11')][_0xc090('0x137')]=function(_0x2ff5ac,_0x50304,_0x436f7d){if(this[_0xc090('0x46')][_0x2ff5ac]){if(_['isNil'](this[_0xc090('0x46')][_0x2ff5ac][_0xc090('0x125')])){this[_0xc090('0x46')][_0x2ff5ac]['variables']={};}this[_0xc090('0x46')][_0x2ff5ac]['variables'][_0x50304]=_0x436f7d;}};Preview['prototype']['syncVarSet']=function(_0x13917c){try{if(!_['isNil'](_0x13917c)){if(ut[_0xc090('0x138')](_['keys'](_0x13917c[_0xc090('0x139')])[0x0])){this['addVariable'](_0x13917c[_0xc090('0x9f')],_[_0xc090('0x13a')](_0x13917c[_0xc090('0x139')])[0x0],_0x13917c[_0xc090('0x13b')]);}}}catch(_0x13e4b4){logger[_0xc090('0x13c')]('[syncVarSet][Preview]',util['inspect'](_0x13e4b4,{'showHidden':![],'depth':null}));}};Preview[_0xc090('0x11')][_0xc090('0x24')]=function(_0x1b613f){if(_0x1b613f){if(this[_0xc090('0x46')][_0x1b613f[_0xc090('0x13d')]]){this[_0xc090('0x46')][_0x1b613f['transfertargetlinkedid']][_0xc090('0x133')]=!![];}}};Preview['prototype'][_0xc090('0x26')]=function(_0x1ad97b){if(_0x1ad97b){if(this[_0xc090('0x46')][_0x1ad97b[_0xc090('0x13e')]]){this['actions'][_0x1ad97b['transfererlinkedid']][_0xc090('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x61c4=['dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','Contact','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','isTrunkReachable','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','callerid','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','agents','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][cause]','destuniqueid','variables','keys','variable','addVariable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','\x20is\x20deactivated','syncCampaigns','prototype','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','verifyAdditionalPhones','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','unlockAgent','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety'];(function(_0x33ba6b,_0x3bfdb7){var _0x57eb9b=function(_0x100a2f){while(--_0x100a2f){_0x33ba6b['push'](_0x33ba6b['shift']());}};_0x57eb9b(++_0x3bfdb7);}(_0x61c4,0x79));var _0x461c=function(_0x2dbb75,_0x410be9){_0x2dbb75=_0x2dbb75-0x0;var _0x59ed4f=_0x61c4[_0x2dbb75];return _0x59ed4f;};'use strict';var util=require(_0x461c('0x0'));var _=require(_0x461c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x461c('0x2'));var config=require(_0x461c('0x3'));var logger=require('../../../config/logger')(_0x461c('0x4'));var loggerAction=require(_0x461c('0x5'))(_0x461c('0x6'));var ami=require(_0x461c('0x7'));var rpcDb=require(_0x461c('0x8'));var cmHopperAdditionalPhone=require(_0x461c('0x9'));var Action=require(_0x461c('0xa'));var ut=require('./util/util');var utils=require(_0x461c('0xb'));config[_0x461c('0xc')]=_[_0x461c('0xd')](config[_0x461c('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x461c('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x461c('0xe')]=function(_0x35531f){this[_0x461c('0xf')]=this[_0x461c('0xf')]?this[_0x461c('0xf')]['finally'](_0x35531f):_0x35531f();};function Preview(_0x3a6513){this[_0x461c('0x10')]=new Sequence();this[_0x461c('0x11')]=_0x3a6513[_0x461c('0x12')];this[_0x461c('0x13')]=_0x3a6513[_0x461c('0x13')];this[_0x461c('0x14')]={};this['agents']=_0x3a6513['agents'];this[_0x461c('0x15')]=0x0;ami['on'](_0x461c('0x16'),this[_0x461c('0x17')]['bind'](this));ami['on']('hangup',this[_0x461c('0x18')][_0x461c('0x19')](this));ami['on'](_0x461c('0x1a'),this[_0x461c('0x1b')][_0x461c('0x19')](this));ami['on'](_0x461c('0x1c'),this[_0x461c('0x1d')]['bind'](this));ami['on'](_0x461c('0x1e'),this['syncNewExten'][_0x461c('0x19')](this));ami['on'](_0x461c('0x1f'),this[_0x461c('0x20')][_0x461c('0x19')](this));ami['on']('attendedtransfer',this[_0x461c('0x21')][_0x461c('0x19')](this));ami['on']('blindtransfer',this[_0x461c('0x22')][_0x461c('0x19')](this));this[_0x461c('0x23')](this[_0x461c('0x11')]);}function emit(_0x4e0ba4,_0x288c9d,_0x2dbb6f){io['to'](_0x4e0ba4)[_0x461c('0x24')](_0x288c9d,_0x2dbb6f);}function emitVoiceQueueChannelRemove(_0x3c19c3){logger[_0x461c('0x25')](_0x461c('0x26'),JSON[_0x461c('0x27')](_0x3c19c3));emit(util[_0x461c('0x28')](_0x461c('0x29'),_0x3c19c3['name']),_0x461c('0x2a'),_0x3c19c3);io[_0x461c('0x24')](_0x461c('0x2b'),_0x3c19c3);}function notSendMessagesQueue(_0x578475){if(_0x578475[_0x461c('0x2c')]){if(_0x578475[_0x461c('0x2d')]===0x0&&_0x578475[_0x461c('0x2e')]===0x0){_0x578475[_0x461c('0x2c')]=![];_0x578475[_0x461c('0x2f')]=0x0;_0x578475['paused']=0x0;_0x578475['message']=utils[_0x461c('0x30')][_0x461c('0x31')];ut[_0x461c('0x32')](_0x461c('0x33'),_0x578475[_0x461c('0x34')]+_0x461c('0x35'));}else{_0x578475[_0x461c('0x36')]=utils[_0x461c('0x30')]['DEACTIVATED'];ut['logger'](_0x461c('0x33'),_0x578475[_0x461c('0x34')]+_0x461c('0x37'));}}}Preview['prototype'][_0x461c('0x23')]=function(){var _0x377734=this;setInterval(function(){_0x377734[_0x461c('0x38')]();},0x7cf);};Preview[_0x461c('0x39')][_0x461c('0x38')]=function(){var _0x18d92a=this[_0x461c('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x58820a in _0x18d92a){if(_0x18d92a[_0x461c('0x3a')](_0x58820a)&&(_0x18d92a[_0x58820a][_0x461c('0x3b')]==='preview'||_0x18d92a[_0x58820a][_0x461c('0x3b')]===_0x461c('0x3c'))&&_0x18d92a[_0x58820a][_0x461c('0x3d')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x461c('0x3e')]();}}if(_0x18d92a[_0x461c('0x3a')](_0x58820a)&&_0x18d92a[_0x58820a][_0x461c('0x3b')]===_0x461c('0x4')&&_0x18d92a[_0x58820a]['type']==='outbound'){if(_0x18d92a[_0x58820a]['dialActive']){this[_0x461c('0x3f')](_0x18d92a[_0x58820a]);if(_0x18d92a[_0x58820a][_0x461c('0x40')])this[_0x461c('0x41')](_0x18d92a[_0x58820a]);}else{notSendMessagesQueue(_0x18d92a[_0x58820a]);}}}};Preview[_0x461c('0x39')][_0x461c('0x42')]=function(_0x30486e){var _0x587629=this;this['sequence'][_0x461c('0xe')](function(){if(!_[_0x461c('0x43')](_0x587629['actions'][_0x30486e])){loggerAction['info'](_0x461c('0x44'),_0x30486e,_0x461c('0x45'),_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')],_0x461c('0x47'),JSON[_0x461c('0x27')](_0x587629[_0x461c('0x11')][_0x587629['actions'][_0x30486e][_0x461c('0x46')]]['originated']),_0x461c('0x48'),JSON['stringify'](_0x587629[_0x461c('0x11')][_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')]][_0x461c('0x2e')]),JSON[_0x461c('0x27')](_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x49')]),JSON[_0x461c('0x27')](_[_0x461c('0x4a')](_0x587629[_0x461c('0x14')][_0x30486e],[_0x461c('0x4b'),_0x461c('0x4c'),_0x461c('0x4d'),'ListId'])));return ami[_0x461c('0x4e')]({'action':'status','channel':_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x4f')]})[_0x461c('0x50')](function(_0x34584b){if(_0x34584b[_0x461c('0x36')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x587629[_0x461c('0x14')][_0x30486e]){ut[_0x461c('0x51')](_0x587629[_0x461c('0x11')][_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')]],_0x461c('0x52'));if(_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x49')]===!![]){ut[_0x461c('0x53')](_0x587629[_0x461c('0x11')][_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')]],_0x461c('0x52'));ut[_0x461c('0x54')](_0x461c('0x55')+_0x30486e,_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')]);}ut['loggerError'](_0x461c('0x56')+_0x30486e,_0x587629[_0x461c('0x14')][_0x30486e][_0x461c('0x46')]);delete _0x587629[_0x461c('0x14')][_0x30486e];}},0x2328);}});}});};Preview[_0x461c('0x39')][_0x461c('0x3e')]=function(){var _0x5eaa68=this;loggerAction[_0x461c('0x25')](_0x461c('0x57'),_[_0x461c('0x58')](this['actions']));for(var _0x388212 in this['actions']){if(_0x5eaa68[_0x461c('0x14')]['hasOwnProperty'](_0x388212)){_0x5eaa68[_0x461c('0x42')](_0x388212);}}};Preview[_0x461c('0x39')]['recallMe']=function(_0x4e76dc){var _0x948cf4=this;rpcDb[_0x461c('0x59')](_0x4e76dc['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x511a4d){if(!_[_0x461c('0x43')](_0x511a4d)){for(var _0x3f4b4f=0x0;_0x3f4b4f<_0x511a4d[_0x461c('0x5a')];_0x3f4b4f+=0x1){if(ut[_0x461c('0x5b')](_0x511a4d[_0x3f4b4f][_0x461c('0x5c')])<_0x4e76dc[_0x461c('0x5d')]*0x3c){if(_0x511a4d[_0x3f4b4f]['Agent']&&!_0x511a4d[_0x3f4b4f][_0x461c('0x5e')]['voicePause']){_0x948cf4[_0x461c('0x5f')](_0x511a4d[_0x3f4b4f]['id'])[_0x461c('0x60')](ut[_0x461c('0x61')](_0x461c('0x62')))[_0x461c('0x50')](ut[_0x461c('0x61')](_0x461c('0x62')));}else{rpcDb[_0x461c('0x63')](_0x511a4d[_0x3f4b4f]['id']);}}else{var _0x1d4a38=new Action(_0x511a4d[_0x3f4b4f],_0x4e76dc);_0x1d4a38[_0x461c('0x64')]=moment()['format'](_0x461c('0x65'));_0x4e76dc['outboundReCallsDay']+=0x1;ut[_0x461c('0x66')](_0x1d4a38,0x17,'RecallInQueue');if(_0x4e76dc[_0x461c('0x67')]){rpcDb['rescheduleContactInQueue'](ut[_0x461c('0x68')](_0x511a4d[_0x3f4b4f]));rpcDb[_0x461c('0x69')](_0x1d4a38,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x1d4a38,0x16,_0x461c('0x6a'));rpcDb[_0x461c('0x69')](_0x1d4a38,_0x461c('0x6b'));rpcDb[_0x461c('0x6c')](_0x1d4a38,_0x461c('0x6b'));}}}}})['catch'](ut['logger2'](_0x461c('0x6d')));};Preview[_0x461c('0x39')][_0x461c('0x3f')]=function(_0x573567){_0x573567[_0x461c('0x2c')]=!![];if(ut[_0x461c('0x6e')](_0x573567[_0x461c('0x6f')])){_0x573567['message']=utils[_0x461c('0x30')][_0x461c('0x70')];}else if(!ut[_0x461c('0x71')](_0x573567['dialActive'])){_0x573567['message']=utils['CAMPAIGN_STATUS'][_0x461c('0x31')];}else if(!this['isTrunkReachable'](_0x573567['Trunk'])){if(!this['isTrunkReachable'](_0x573567[_0x461c('0x72')])){_0x573567[_0x461c('0x36')]=utils[_0x461c('0x30')][_0x461c('0x73')];}else{_0x573567['message']=utils[_0x461c('0x30')]['ACTIVE'];}}else{_0x573567['message']=utils[_0x461c('0x30')][_0x461c('0x74')];}};Preview[_0x461c('0x39')][_0x461c('0x75')]=function(_0x29be40,_0x2bc97e,_0x4dde83){var _0x2de01b=this;var _0x2af4c6=this[_0x461c('0x14')][_0x2bc97e];var _0x4c3a55=this['campaignsPreview'][_0x2af4c6['queue']];var _0x505285;var _0x596358=![];var _0x541840=0x2;var _0x45638c=0x3;if(_0x4c3a55){switch(_0x4dde83){case'1':_0x4c3a55[_0x461c('0x76')]+=0x1;_0x2af4c6[_0x461c('0x77')]+=0x1;_0x2af4c6['countglobal']=ut[_0x461c('0x78')](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x0,_0x461c('0x79'));ami['emit'](_0x461c('0x7a'),ut['buildObj'](_0x2af4c6,_0x461c('0x7b')));rpcDb[_0x461c('0x69')](_0x2af4c6,'[callProgressDetectingCustomer][logNoSuch]');_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'0',_0x4c3a55)[_0x461c('0x60')](function(_0xc6949d){_0x596358=_0xc6949d['additional']==0x1;_0x541840=_0x4c3a55['dialNoSuchNumberRetryFrequency'];_0x45638c=_0x4c3a55['callAdditionalPhoneAfterMin'];if(!_0x596358){if(ut[_0x461c('0x78')](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut[_0x461c('0x7e')](_0x2af4c6,0xf,_0x461c('0x7f'));rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0x80'));}else{if(_0x2af4c6[_0x461c('0x77')]>=_0x4c3a55[_0x461c('0x81')]){rpcDb['createCustomerFinal'](_0x2af4c6,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x461c('0x82')](ut[_0x461c('0x83')](_0x2af4c6,_0x461c('0x77'),_0x4c3a55[_0x461c('0x84')]),_0x2af4c6['unlockAgent'],_0x2af4c6[_0x461c('0x85')]);}}delete this['actions'][_0x29be40[_0x461c('0x86')]];}else{_0x2af4c6[_0x461c('0x77')]++;logger[_0x461c('0x25')]('actioncountonusuch',_0x2af4c6['countnosuchnumberretry']);logger[_0x461c('0x25')]('id',_0x2af4c6[_0x461c('0x87')]);_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countnosuchnumberretry':_0x2af4c6[_0x461c('0x77')]}})[_0x461c('0x60')](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});break;case'ANSWER':var _0x1960e3=moment()[_0x461c('0x28')](_0x461c('0x65'));_0x2af4c6[_0x461c('0x8a')]=_0x1960e3;_0x2af4c6['answertime']=_0x1960e3;_0x2af4c6[_0x461c('0x49')]=!![];_0x4c3a55[_0x461c('0x2e')]+=0x1;logger[_0x461c('0x25')](_0x461c('0x8b'),_0x2af4c6[_0x461c('0x8c')],_0x461c('0x8d'),_0x4c3a55['name'],_0x461c('0x48'),_0x4c3a55[_0x461c('0x2e')]);ami[_0x461c('0x24')](_0x461c('0x8e'),ut[_0x461c('0x8f')](_0x2af4c6,'connect',this[_0x461c('0x11')][_0x2af4c6[_0x461c('0x46')]]));if(_0x4c3a55[_0x461c('0x90')]){ami[_0x461c('0x24')]('custom:agentConnectPreview',ut['buildAcw'](_0x2af4c6));}break;case'16':ami[_0x461c('0x24')](_0x461c('0x91'),ut[_0x461c('0x8f')](_0x2af4c6,'complete',this['campaignsPreview'][_0x2af4c6[_0x461c('0x46')]]));emitVoiceQueueChannelRemove(ut[_0x461c('0x8f')](_0x2af4c6,_0x461c('0x92')));_0x4c3a55[_0x461c('0x93')]+=0x1;_0x4c3a55[_0x461c('0x94')]+=0x1;_0x4c3a55['answered']+=0x1;ut[_0x461c('0x53')](_0x4c3a55,_0x461c('0x95'));_0x2af4c6[_0x461c('0x96')]=ut['totalGlobal'](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x4,_0x461c('0x97'));rpcDb[_0x461c('0x69')](_0x2af4c6,_0x461c('0x98'));rpcDb[_0x461c('0x6c')](_0x2af4c6,_0x461c('0x99'));rpcDb[_0x461c('0x9a')](_0x2af4c6);_0x4c3a55['sumDuration']+=_0x2af4c6[_0x461c('0x9b')];_0x4c3a55['sumBillable']+=_0x2af4c6['talktime'];logger[_0x461c('0x25')](_0x461c('0x9c'),_0x2af4c6[_0x461c('0x8c')],_0x461c('0x8d'),_0x4c3a55[_0x461c('0x34')],_0x461c('0x48'),_0x4c3a55[_0x461c('0x2e')]);delete this[_0x461c('0x14')][_0x29be40['linkedid']];break;case'BUSY':_0x4c3a55['outboundBusyCallsDay']+=0x1;_0x2af4c6[_0x461c('0x9d')]+=0x1;_0x2af4c6[_0x461c('0x96')]=ut[_0x461c('0x78')](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x5,_0x461c('0x9e'));_0x541840=_0x4c3a55[_0x461c('0x9f')];_0x45638c=_0x4c3a55['callAdditionalPhoneAfterMin'];ami[_0x461c('0x24')](_0x461c('0xa0'),ut['buildObj'](_0x2af4c6,_0x461c('0xa1')));rpcDb[_0x461c('0x69')](_0x2af4c6,'[callProgressDetectingCustomer][logBusy]');_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'5',_0x4c3a55)['then'](function(_0x3378db){_0x596358=_0x3378db[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut[_0x461c('0x78')](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut[_0x461c('0x7e')](_0x2af4c6,0xf,_0x461c('0x7f'));rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xa3'));}else{if(_0x2af4c6[_0x461c('0x9d')]>=_0x4c3a55[_0x461c('0xa4')]){rpcDb[_0x461c('0x6c')](_0x2af4c6,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x461c('0x82')](ut[_0x461c('0x83')](_0x2af4c6,_0x461c('0x9d'),_0x4c3a55['dialBusyRetryFrequency']),_0x2af4c6['unlockAgent'],_0x2af4c6['activeContact']);}}}else{_0x2af4c6['countbusyretry']++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countbusyretry':_0x2af4c6[_0x461c('0x9d')]}})[_0x461c('0x60')](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});break;case _0x461c('0xa5'):_0x4c3a55['outboundNoAnswerCallsDay']+=0x1;_0x2af4c6[_0x461c('0xa6')]+=0x1;_0x2af4c6[_0x461c('0x96')]=ut[_0x461c('0x78')](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x3,_0x461c('0xa7'));_0x541840=_0x4c3a55['dialNoAnswerRetryFrequency'];_0x45638c=_0x4c3a55[_0x461c('0xa8')];var _0xd1f977=ut[_0x461c('0xa9')](_0x2af4c6,_0x4c3a55);ami[_0x461c('0x24')](_0x461c('0xaa'),_0xd1f977);rpcDb['createCustomerHistory'](_0x2af4c6,_0x461c('0xab'));_0x2de01b['verifyAdditionalPhones'](_0x2af4c6,'3',_0x4c3a55)['then'](function(_0x155144){_0x596358=_0x155144[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut[_0x461c('0x78')](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut['cloneAction'](_0x2af4c6,0xf,_0x461c('0x7f'));rpcDb['createCustomerFinal'](_0x505285,_0x461c('0xac'));}else{if(_0x2af4c6[_0x461c('0xa6')]>=_0x4c3a55['dialNoAnswerMaxRetry']){rpcDb[_0x461c('0x6c')](_0x2af4c6,_0x461c('0xab'));}else{rpcDb[_0x461c('0x82')](ut['scheduledAt'](_0x2af4c6,_0x461c('0xa6'),_0x4c3a55[_0x461c('0xad')]),_0x2af4c6[_0x461c('0xae')],_0x2af4c6[_0x461c('0x85')]);}}}else{_0x2af4c6['countnoanswerretry']++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countnoanswerretry':_0x2af4c6[_0x461c('0xa6')]}})[_0x461c('0x60')](function(){_0x2de01b['swapAdditionalPhones'](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});break;case'CONGESTION':_0x4c3a55['outboundCongestionCallsDay']+=0x1;_0x2af4c6[_0x461c('0xaf')]+=0x1;_0x2af4c6[_0x461c('0x96')]=ut['totalGlobal'](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x8,_0x461c('0xb0'));_0x541840=_0x4c3a55[_0x461c('0xb1')];_0x45638c=_0x4c3a55[_0x461c('0xa8')];ami[_0x461c('0x24')](_0x461c('0xb2'),ut[_0x461c('0x8f')](_0x2af4c6,_0x461c('0xb3')));rpcDb[_0x461c('0x69')](_0x2af4c6,_0x461c('0xb4'));_0x2de01b['verifyAdditionalPhones'](_0x2af4c6,'8',_0x4c3a55)[_0x461c('0x60')](function(_0x578b28){_0x596358=_0x578b28[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut[_0x461c('0x78')](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut['cloneAction'](_0x2af4c6,0xf,'Global');rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xb5'));}else{if(_0x2af4c6[_0x461c('0xaf')]>=_0x4c3a55[_0x461c('0xb6')]){rpcDb['createCustomerFinal'](_0x2af4c6,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x461c('0x82')](ut[_0x461c('0x83')](_0x2af4c6,_0x461c('0xaf'),_0x4c3a55[_0x461c('0x9f')]),_0x2af4c6[_0x461c('0xae')],_0x2af4c6[_0x461c('0x85')]);}}}else{_0x2af4c6[_0x461c('0xaf')]++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countcongestionretry':_0x2af4c6[_0x461c('0xaf')]}})['then'](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});break;case'CANCEL':_0x4c3a55[_0x461c('0xb7')]+=0x1;_0x2af4c6[_0x461c('0xb8')]+=0x1;_0x2af4c6[_0x461c('0x96')]=ut[_0x461c('0x78')](_0x2af4c6);ut['logCustomer'](_0x2af4c6,0x14,'AgentReject');_0x541840=_0x4c3a55[_0x461c('0xb9')];_0x45638c=_0x4c3a55[_0x461c('0xa8')];ami[_0x461c('0x24')](_0x461c('0xba'),ut['buildObj'](_0x2af4c6,'agentreject'));rpcDb[_0x461c('0x69')](_0x2af4c6,_0x461c('0xbb'));_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'20',_0x4c3a55)[_0x461c('0x60')](function(_0x5ae965){_0x596358=_0x5ae965[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut['totalGlobal'](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut[_0x461c('0x7e')](_0x2af4c6,0x14,_0x461c('0xbc'));rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xbd'));}else{if(_0x2af4c6[_0x461c('0xb8')]>=_0x4c3a55[_0x461c('0xbe')]){rpcDb[_0x461c('0x6c')](_0x2af4c6,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x461c('0x82')](ut[_0x461c('0x83')](_0x2af4c6,_0x461c('0xb8'),_0x4c3a55[_0x461c('0xb9')]),_0x2af4c6[_0x461c('0xae')],_0x2af4c6['activeContact']);}}}else{_0x2af4c6[_0x461c('0xa6')]++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6['idContact'],'field':{'countnoanswerretry':_0x2af4c6[_0x461c('0xa6')]}})['then'](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)['then'](function(){});});}});break;case'ABANDONED':_0x4c3a55[_0x461c('0xbf')]+=0x1;_0x2af4c6[_0x461c('0xc0')]+=0x1;_0x2af4c6['countglobal']=ut['totalGlobal'](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0xb,'Abandoned');rpcDb[_0x461c('0x69')](_0x2af4c6,_0x461c('0xc1'));_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'11',_0x4c3a55)[_0x461c('0x60')](function(_0x1745fc){_0x596358=_0x1745fc[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut['totalGlobal'](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut['cloneAction'](_0x2af4c6,0xf,_0x461c('0x7f'));rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xc1'));}else{if(_0x2af4c6[_0x461c('0xc2')]>=_0x4c3a55[_0x461c('0xc3')]){rpcDb[_0x461c('0x6c')](_0x2af4c6,_0x461c('0xc1'));}else{rpcDb[_0x461c('0x82')](ut[_0x461c('0x83')](_0x2af4c6,_0x461c('0xc0'),_0x4c3a55[_0x461c('0xc4')]),_0x2af4c6[_0x461c('0xae')],_0x2af4c6[_0x461c('0x85')]);}}}else{_0x2af4c6[_0x461c('0xa6')]++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countnoanswerretry':_0x2af4c6[_0x461c('0xa6')]}})[_0x461c('0x60')](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});break;case'18':_0x4c3a55[_0x461c('0xc5')]+=0x1;_0x2af4c6[_0x461c('0xc6')]+=0x1;_0x2af4c6['countglobal']=ut[_0x461c('0x78')](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x12,_0x29be40[_0x461c('0xc7')]||_0x29be40[_0x461c('0xc8')]);ami['emit'](_0x461c('0xc9'),ut[_0x461c('0x8f')](_0x2af4c6,_0x461c('0xca')));rpcDb['createCustomerHistory'](_0x2af4c6,'[callProgressDetectingCustomer][hangupInAMD]');_0x2de01b['verifyAdditionalPhones'](_0x2af4c6,'18',_0x4c3a55)[_0x461c('0x60')](function(_0x4b963a){_0x596358=_0x4b963a['additional']==0x1;if(!_0x596358){if(ut['totalGlobal'](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut[_0x461c('0x7e')](_0x2af4c6,0x12,'Global');rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xcb'));}else{rpcDb[_0x461c('0x6c')](_0x2af4c6,_0x461c('0xcb'));}}else{_0x2af4c6['countnoanswerretry']++;_0x2de01b[_0x461c('0x88')]({'id':_0x2af4c6[_0x461c('0x87')],'field':{'countnoanswerretry':_0x2af4c6[_0x461c('0xa6')]}})[_0x461c('0x60')](function(){_0x2de01b['swapAdditionalPhones'](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});delete this['actions'][_0x29be40[_0x461c('0x86')]];break;case'19':_0x4c3a55['outboundUnknownCallsDay']+=0x1;_0x2af4c6[_0x461c('0x96')]=ut['totalGlobal'](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0x13,_0x29be40[_0x461c('0xc7')]||_0x29be40[_0x461c('0xc8')]);ami[_0x461c('0x24')](_0x461c('0xc9'),ut[_0x461c('0x8f')](_0x2af4c6,_0x461c('0xca')));rpcDb[_0x461c('0x69')](_0x2af4c6,_0x461c('0xcc'));_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'18',_0x4c3a55)['then'](function(_0x1330c6){_0x596358=_0x1330c6['additional']==0x1;if(!_0x596358){if(ut['totalGlobal'](_0x2af4c6)>=_0x4c3a55['dialGlobalMaxRetry']){_0x505285=ut['cloneAction'](_0x2af4c6,0xf,'Global');rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xcc'));}else{rpcDb[_0x461c('0x6c')](_0x2af4c6,_0x461c('0xcc'));}}else{_0x2af4c6['countnoanswerretry']++;_0x2de01b['incrementPreviewCounters']({'id':_0x2af4c6['idContact'],'field':{'countnoanswerretry':_0x2af4c6[_0x461c('0xa6')]}})[_0x461c('0x60')](function(){_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)[_0x461c('0x60')](function(){});});}});delete this[_0x461c('0x14')][_0x29be40['linkedid']];break;default:if(_0x2af4c6['dialAnswer']){ut[_0x461c('0x53')](_0x4c3a55,_0x461c('0xcd'));ut[_0x461c('0x54')](_0x461c('0xce')+_0x4c3a55[_0x461c('0x34')],_0x29be40);}_0x4c3a55[_0x461c('0xc5')]+=0x1;_0x2af4c6[_0x461c('0x96')]=ut[_0x461c('0x78')](_0x2af4c6);ut[_0x461c('0x66')](_0x2af4c6,0xc,_0x29be40[_0x461c('0xc7')]||_0x29be40[_0x461c('0xc8')]);_0x541840=_0x4c3a55[_0x461c('0xb9')];_0x45638c=_0x4c3a55[_0x461c('0xa8')];rpcDb['createCustomerHistory'](_0x2af4c6,_0x461c('0xcf'));_0x2de01b[_0x461c('0x7c')](_0x2af4c6,'20',_0x4c3a55)[_0x461c('0x60')](function(_0x2741c2){_0x596358=_0x2741c2[_0x461c('0xa2')]==0x1;if(!_0x596358){if(ut[_0x461c('0x78')](_0x2af4c6)>=_0x4c3a55[_0x461c('0x7d')]){_0x505285=ut[_0x461c('0x7e')](_0x2af4c6,0xf,_0x461c('0x7f'));rpcDb[_0x461c('0x6c')](_0x505285,_0x461c('0xd0'));}else{rpcDb[_0x461c('0x6c')](_0x2af4c6,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x29be40[_0x461c('0x86')]];}else{_0x2de01b[_0x461c('0x89')](_0x2af4c6,_0x541840,_0x45638c)['then'](function(){});}});}if(!(_0x2af4c6['dialAnswer']&&_0x4dde83==='16')){ut[_0x461c('0x51')](_0x4c3a55,_0x461c('0xd1'));logger[_0x461c('0x25')](_0x461c('0xd2'),_0x2af4c6[_0x461c('0x8c')],_0x461c('0x8d'),_0x4c3a55[_0x461c('0x34')],_0x461c('0x47'),_0x4c3a55['originated']);}if(_0x4dde83!==_0x461c('0xd3')){delete this[_0x461c('0x14')][_0x29be40['linkedid']];delete this[_0x461c('0x14')][_0x29be40[_0x461c('0xd4')]];}_0x4c3a55['queueSummaryCountersUpdated']=!![];}};Preview[_0x461c('0x39')][_0x461c('0xd5')]=function(_0x37d1e9,_0x1757e3,_0x34b00c){if(_[_0x461c('0xd6')](_0x1757e3)&&'object'!==typeof _0x1757e3){return;}if(_[_0x461c('0xd6')](_0x34b00c)&&_0x461c('0xd7')!==typeof _0x34b00c){return;}switch(_0x34b00c[_0x461c('0xd8')]){case'0':ut[_0x461c('0xd9')](_0x37d1e9,0x0,_0x461c('0x79'));rpcDb[_0x461c('0xda')](_0x37d1e9,_0x461c('0xdb'));break;case'3':ut['logAgent'](_0x37d1e9,0x3,_0x461c('0xa7'));rpcDb[_0x461c('0xda')](_0x37d1e9,_0x461c('0xdc'));break;case'5':ut[_0x461c('0xd9')](_0x37d1e9,0x5,_0x461c('0x9e'));rpcDb[_0x461c('0xda')](_0x37d1e9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x461c('0xd9')](_0x37d1e9,0x8,_0x461c('0xb0'));rpcDb[_0x461c('0xda')](_0x37d1e9,_0x461c('0xdd'));break;case'22':ut[_0x461c('0xd9')](_0x37d1e9,0x16,_0x461c('0xde'));rpcDb[_0x461c('0xda')](_0x37d1e9,_0x461c('0xdf'));break;default:ut[_0x461c('0xd9')](_0x37d1e9,0xc,_0x34b00c[_0x461c('0xd8')]);rpcDb[_0x461c('0xda')](_0x37d1e9,_0x461c('0xdd'));}ut[_0x461c('0x51')](_0x1757e3,_0x461c('0xe0'));logger[_0x461c('0x25')](_0x461c('0xe1'),_0x37d1e9['uniqueid'],_0x461c('0x8d'),_0x1757e3[_0x461c('0x34')],_0x461c('0x47'),_0x1757e3[_0x461c('0x2d')]);delete this['actions'][_0x37d1e9[_0x461c('0x8c')]];};Preview[_0x461c('0x39')][_0x461c('0x7c')]=function(_0x75a913,_0x5ab88b,_0x15726c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x75a913,_0x5ab88b,_0x15726c)[_0x461c('0x50')](logger[_0x461c('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x461c('0x39')][_0x461c('0x89')]=function(_0x150ca2,_0x17fc55,_0x47721a){return cmHopperAdditionalPhone[_0x461c('0x89')](_0x150ca2,_0x17fc55,_0x47721a)[_0x461c('0x50')](logger[_0x461c('0x25')](_0x461c('0xe2')));};Preview['prototype'][_0x461c('0x88')]=function(_0x203cb7){return Promise[_0x461c('0xe3')]()[_0x461c('0x60')](cmHopperAdditionalPhone[_0x461c('0x88')](_0x203cb7))[_0x461c('0x50')](logger[_0x461c('0x25')]('[incrementPreviewCounters]\x20'));};Preview['prototype']['checkInBlack']=function(_0x54140d,_0x26fbf2,_0x387924,_0x198630,_0x7cf61a){var _0x4ccfe9=this;return new Promise(function(_0x41adf8,_0x46705a){if(_[_0x461c('0x43')](_0x26fbf2)||_[_0x461c('0x43')](_0x26fbf2[_0x461c('0xe4')])||_[_0x461c('0x43')](_0x26fbf2['phone'])||_[_0x461c('0x43')](_0x26fbf2[_0x461c('0x4d')])){_0x46705a(ut[_0x461c('0x36')](_0x461c('0xe5'),_0x198630,_0x7cf61a));return;}var _0x1756b1=uuid['v4']();var _0x92e7b=_0x4ccfe9[_0x461c('0x11')][_0x26fbf2[_0x461c('0x45')][_0x461c('0x34')]];var _0x3d63bb=_0x387924?_0x4ccfe9['agents'][_0x387924]['id']:undefined;_0x4ccfe9[_0x461c('0x14')][_0x1756b1]=new Action(_0x26fbf2,_0x92e7b,_0x1756b1,_0x387924,_0x3d63bb);var _0x37e6f9=_0x4ccfe9[_0x461c('0x14')][_0x1756b1];_0x37e6f9['unlockAgent']=_0x198630;_0x37e6f9[_0x461c('0x85')]=_0x7cf61a;_0x37e6f9['lookAgent']=_0x387924;if(_[_0x461c('0xe6')](_0x54140d)){_0x4ccfe9[_0x461c('0xe7')](_0x37e6f9,_0x92e7b,_0x26fbf2,_0x387924)['then'](function(_0x1661d9){logger[_0x461c('0x25')](_0x461c('0xe8'),'Queue:\x20'+_0x37e6f9[_0x461c('0x46')]+_0x461c('0xe9')+_0x37e6f9['idContact'],JSON['stringify'](_0x1661d9));ami[_0x461c('0x24')]('custom:agentcalled',ut[_0x461c('0x8f')](_0x37e6f9,_0x461c('0xea'),_0x4ccfe9['campaignsPreview'][_0x37e6f9['queue']]));_0x41adf8(ut['message'](_0x461c('0xeb')));})['catch'](function(_0x1df3ef){ut[_0x461c('0x32')](_0x461c('0xec'),_0x1df3ef);_0x46705a(ut[_0x461c('0x36')]('Call\x20failed',_0x198630,_0x7cf61a));});}else{_0x92e7b['outboundBlacklistCallsDay']+=0x1;ut[_0x461c('0xed')](_0x37e6f9);rpcDb[_0x461c('0xee')](_0x37e6f9,_0x461c('0xef'));delete _0x4ccfe9[_0x461c('0x14')][_0x1756b1];_0x46705a(ut[_0x461c('0x36')]('Contact\x20in\x20black\x20List',_0x198630,_0x7cf61a));}});};Preview[_0x461c('0x39')]['isTrunkReachable']=function(_0x16d592){return!_[_0x461c('0x43')](_0x16d592)&&!_[_0x461c('0x43')](_0x16d592['name'])&&!_[_0x461c('0x43')](_0x16d592['active'])&&_0x16d592[_0x461c('0xf0')]&&!_[_0x461c('0x43')](this[_0x461c('0x13')][util['format']('SIP/%s',_0x16d592[_0x461c('0x34')])])&&!_[_0x461c('0x43')](this[_0x461c('0x13')][util[_0x461c('0x28')](_0x461c('0xf1'),_0x16d592['name'])][_0x461c('0xf2')])&&(this['trunks'][util[_0x461c('0x28')](_0x461c('0xf1'),_0x16d592[_0x461c('0x34')])][_0x461c('0xf2')]===_0x461c('0xf3')||this[_0x461c('0x13')][util['format'](_0x461c('0xf1'),_0x16d592['name'])][_0x461c('0xf2')]===_0x461c('0xf4'));};Preview[_0x461c('0x39')][_0x461c('0x5f')]=function(_0x409e2b,_0x647127){return this[_0x461c('0xf5')](_0x409e2b,_0x647127)[_0x461c('0x60')](function(_0x1be186){return _[_0x461c('0x4a')](_0x1be186,['message']);})[_0x461c('0x50')](function(_0x5818af){if(_0x5818af[_0x461c('0xf6')]){rpcDb[_0x461c('0xf7')](_0x409e2b);}if(_0x5818af[_0x461c('0xf0')]){rpcDb[_0x461c('0x63')](_0x409e2b);}throw _['pick'](_0x5818af,[_0x461c('0x36')]);});};Preview['prototype']['execRun']=function(_0x1815e0,_0x16a696){var _0xddfd9f=this;var _0x2f3c4a,_0x528575;return rpcDb[_0x461c('0xf8')](_0x1815e0)[_0x461c('0x60')](function(_0x143d50){if(!_['isNil'](_0x143d50[0x0])){_0x528575=_0x143d50[0x0]['recallme']?![]:!![];_0x2f3c4a=_0x143d50[0x0][_0x461c('0xf9')]?!![]:![];_0x2f3c4a=_0x16a696?!![]:_0x2f3c4a;}var _0x3c2dbf=_0xddfd9f[_0x461c('0xfa')](_0x143d50);if(_0x3c2dbf[_0x461c('0xfb')]){rpcDb['checkIsBlackList'](_[_0x461c('0x4a')](_0x143d50[0x0],[_0x461c('0x4d'),_0x461c('0xfc')]))[_0x461c('0x60')](function(_0xcd012e){_0xddfd9f['checkInBlack'](_0xcd012e,_0x143d50[0x0],_0x16a696,_0x528575,_0x2f3c4a)['then'](function(_0x412a95){return _0x412a95;})[_0x461c('0x50')](function(_0x4482da){throw _0x4482da;});})['catch'](function(_0x40d458){ut[_0x461c('0x32')](_0x461c('0xfd'),_0x40d458);throw ut['message'](_0x461c('0xfe'),_0x528575,_0x2f3c4a);});}else{throw ut[_0x461c('0x36')](_0x3c2dbf[_0x461c('0x36')],_0x528575,_0x2f3c4a);}})['catch'](function(_0x4054ba){ut[_0x461c('0x32')]('[Preview][getContactPreview]',_0x4054ba);throw ut[_0x461c('0x36')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x461c('0x39')]['validateContact']=function(_0x376517){if(_[_0x461c('0x43')](_0x376517)||_['isEmpty'](_0x376517)||!_['isNil'](_0x376517[0x0][_0x461c('0x5e')])&&_[_0x461c('0x43')](_0x376517[0x0][_0x461c('0x5e')]['name'])){ut[_0x461c('0x32')](_0x461c('0xff'),_0x376517);return{'isValid':![],'message':_0x461c('0x100')};}var _0x2f3a37=this[_0x461c('0x11')][_0x376517[0x0][_0x461c('0x45')][_0x461c('0x34')]];_0x2f3a37[_0x461c('0x36')]=utils[_0x461c('0x30')][_0x461c('0x74')];if(_[_0x461c('0x43')](_0x2f3a37)){ut[_0x461c('0x32')](_0x461c('0x101'),_0x2f3a37);return{'isValid':![],'message':_0x461c('0x102')};}if(!this['isTrunkReachable'](_0x2f3a37[_0x461c('0x103')])){ut[_0x461c('0x32')](_0x461c('0x104'),_0x461c('0x105')+_0x2f3a37[_0x461c('0x34')]+_0x461c('0x106'));if(!this[_0x461c('0x107')](_0x2f3a37[_0x461c('0x72')])){ut[_0x461c('0x32')](_0x461c('0x104'),_0x2f3a37['name']+_0x461c('0x108'));return{'isValid':![],'message':_0x461c('0x109')};}}if(!ut[_0x461c('0x71')](_0x2f3a37['dialActive'])){ut[_0x461c('0x32')](_0x461c('0x10a'),_0x2f3a37[_0x461c('0x34')]+_0x461c('0x10b'));return{'isValid':![],'message':_0x461c('0x105')+_0x2f3a37[_0x461c('0x34')]+_0x461c('0x10b')};}return{'isValid':!![],'message':_0x461c('0x10c')};};Preview[_0x461c('0x39')][_0x461c('0xe7')]=function(_0x53c014,_0x1fc8af,_0xc0918d,_0x45f197){var _0x54c28e=this;return new Promise(function(_0x5481b3,_0x68b2e7){var _0x50da91=_0x53c014[_0x461c('0x8c')];var _0x3a8bb5=_0x54c28e[_0x461c('0x107')](_0x1fc8af['Trunk'])?util[_0x461c('0x28')](_0x461c('0x10d'),_0x1fc8af[_0x461c('0x103')][_0x461c('0x34')],_[_0x461c('0x43')](_0x1fc8af[_0x461c('0x10e')])?'':_0x1fc8af[_0x461c('0x10e')][_0x461c('0x10f')]()||'',_0x1fc8af[_0x461c('0x110')]>0x0?_0xc0918d[_0x461c('0xfc')][_0x461c('0x111')](_0x1fc8af[_0x461c('0x110')]):_0xc0918d['phone']):util[_0x461c('0x28')](_0x461c('0x10d'),_[_0x461c('0x43')](_0x1fc8af[_0x461c('0x72')])?_0x1fc8af[_0x461c('0x103')][_0x461c('0x34')]:_0x1fc8af[_0x461c('0x72')][_0x461c('0x34')],_[_0x461c('0x43')](_0x1fc8af[_0x461c('0x10e')])?'':_0x1fc8af[_0x461c('0x10e')][_0x461c('0x10f')]()||'',_0x1fc8af[_0x461c('0x110')]>0x0?_0xc0918d[_0x461c('0xfc')][_0x461c('0x111')](_0x1fc8af[_0x461c('0x110')]):_0xc0918d['phone']);var _0x2559b1=_0x54c28e['isTrunkReachable'](_0x1fc8af[_0x461c('0x103')])?ut['getCallerId'](_0x1fc8af[_0x461c('0x103')]['callerid'],_0x1fc8af[_0x461c('0x112')],_0x1fc8af['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x461c('0x113')](_0x1fc8af[_0x461c('0x114')],_0x1fc8af[_0x461c('0x115')]):_0x1fc8af['dialOriginateCallerIdNumber']):ut[_0x461c('0x116')](_['isNil'](_0x1fc8af[_0x461c('0x72')])?_0x1fc8af['Trunk'][_0x461c('0x117')]:_0x1fc8af[_0x461c('0x72')][_0x461c('0x117')],_0x1fc8af['dialOriginateCallerIdName'],_0x1fc8af[_0x461c('0x115')]>0x0?ut[_0x461c('0x113')](_0x1fc8af['dialOriginateCallerIdNumber'],_0x1fc8af[_0x461c('0x115')]):_0x1fc8af[_0x461c('0x114')]);if(_0x2559b1){_0x53c014[_0x461c('0x118')]=ut['extractCalleridName'](_0x2559b1);_0x53c014[_0x461c('0x119')]=ut[_0x461c('0x11a')](_0x2559b1);}var _0x57b97f=ut[_0x461c('0x11b')](_0x1fc8af,_0xc0918d,_0x3a8bb5,_0x2559b1,_0x50da91,_0x53c014);var _0x399b6a=utils['setXMDContactVariables'](_0xc0918d[_0x461c('0xe4')]);Object[_0x461c('0x11c')](_0x57b97f,_0x399b6a);_[_0x461c('0x11d')](_0x53c014,ut[_0x461c('0x11e')](_0x57b97f));_0x53c014[_0x461c('0x64')]=moment()[_0x461c('0x28')](_0x461c('0x65'));_0x1fc8af['variables']=_0x57b97f;var _0x1fa046=ut[_0x461c('0x11f')](_0x53c014,_0x1fc8af,_0x57b97f,_0x53c014[_0x461c('0x85')],_0x45f197);return ami['Action'](_0x1fa046)[_0x461c('0x60')](function(_0x4b6328){_0x1fc8af['originated']+=0x1;logger[_0x461c('0x25')]('[originated][increment]',_0x50da91,_0x461c('0x8d'),_0x1fc8af[_0x461c('0x34')],'originated:\x20',_0x1fc8af[_0x461c('0x2d')]);_0x5481b3(_0x4b6328);})[_0x461c('0x50')](function(_0x4454cb){ut[_0x461c('0xd9')](_0x53c014,0xe,_0x461c('0x120'));rpcDb[_0x461c('0xda')](_0x53c014,_0x461c('0x121'));_0x68b2e7(_0x4454cb);});});};Preview[_0x461c('0x39')][_0x461c('0x122')]=function(_0x1f35a5){if(this[_0x461c('0x14')][_0x1f35a5['linkedid']]){this[_0x461c('0x14')][_0x1f35a5[_0x461c('0x86')]][_0x461c('0x4f')]=_0x1f35a5[_0x461c('0x4f')];}};Preview['prototype']['syncOriginateResponse']=function(_0x3538ee){var _0x161864=this;var _0x21fdcb=this[_0x461c('0x14')][_0x3538ee[_0x461c('0x123')]];if(_0x21fdcb){if(_0x21fdcb[_0x461c('0x124')]&&this[_0x461c('0x125')][_0x21fdcb['lookAgent']]){ut[_0x461c('0x126')](_0x21fdcb,this[_0x461c('0x125')][_0x21fdcb['lookAgent']][_0x461c('0x34')],this[_0x461c('0x125')][_0x21fdcb['lookAgent']]['id']);}var _0x4fbf31=_[_0x461c('0x127')](_0x21fdcb);_0x4fbf31[_0x461c('0x8a')]=moment()[_0x461c('0x28')](_0x461c('0x65'));var _0x5f3ba7=_0x161864['campaignsPreview'][_0x21fdcb[_0x461c('0x46')]];if(ut[_0x461c('0x128')](_0x3538ee[_0x461c('0x129')])){if(_0x21fdcb['unlockAgent']){rpcDb[_0x461c('0xf7')](_0x21fdcb['idContact']);}if(_0x21fdcb['activeContact']){rpcDb[_0x461c('0x63')](_0x21fdcb[_0x461c('0x87')]);}ami['emit'](_0x461c('0x12a'),ut[_0x461c('0x8f')](_0x21fdcb,_0x461c('0x12b'),this[_0x461c('0x11')][_0x21fdcb[_0x461c('0x46')]]));this[_0x461c('0xd5')](_0x4fbf31,_0x5f3ba7,_0x3538ee);}else{_0x21fdcb[_0x461c('0x64')]=moment()[_0x461c('0x28')](_0x461c('0x65'));ut[_0x461c('0xd9')](_0x4fbf31,0x4,_0x461c('0x97'));rpcDb[_0x461c('0xda')](_0x4fbf31,_0x461c('0x12c'));}}};Preview[_0x461c('0x39')]['syncHangup']=function(_0x3b1f66){var _0x307bef=this[_0x461c('0x14')][_0x3b1f66['linkedid']];var _0x259977;if(_0x307bef){_0x259977=this[_0x461c('0x11')][_0x307bef[_0x461c('0x46')]];logger[_0x461c('0x25')]('[syncHangup][talking]',_0x3b1f66[_0x461c('0x86')],_0x461c('0x8d'),_0x259977[_0x461c('0x34')],_0x461c('0x48'),_0x259977[_0x461c('0x2e')]);}if(this[_0x461c('0x14')][_0x3b1f66[_0x461c('0x86')]]&&_0x3b1f66['linkedid']!==_0x3b1f66[_0x461c('0x8c')]){if(_0x3b1f66[_0x461c('0x12d')]==='16'&&this[_0x461c('0x14')][_0x3b1f66[_0x461c('0x86')]][_0x461c('0x49')]){this[_0x461c('0x75')](_0x3b1f66,_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')]);}else if(this[_0x461c('0x14')][_0x3b1f66[_0x461c('0x86')]][_0x461c('0x49')]){logger['info']('[syncHangup][talking][cause]',_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')],_0x461c('0x8d'),_0x259977[_0x461c('0x34')],_0x461c('0x48'),_0x259977[_0x461c('0x2e')]);this[_0x461c('0x75')](_0x3b1f66,_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')]);}}else if(_0x307bef&&_[_0x461c('0x43')](_0x307bef[_0x461c('0x12e')])&&_0x259977[_0x461c('0x12f')]&&_0x3b1f66[_0x461c('0x86')]===_0x3b1f66[_0x461c('0x8c')]&&_[_0x461c('0x43')](_0x3b1f66[_0x461c('0xd8')])&&_0x3b1f66[_0x461c('0x12d')]==='16'&&_0x3b1f66[_0x461c('0x130')]==='6'&&_[_0x461c('0xd6')](_0x307bef[_0x461c('0x131')])){if(_0x307bef['unlockAgent']){rpcDb[_0x461c('0xf7')](_0x307bef['idContact']);}if(_0x307bef[_0x461c('0x85')]){rpcDb[_0x461c('0x63')](_0x307bef['idContact']);}_0x3b1f66['reason']='22';this[_0x461c('0xd5')](_0x307bef,_0x259977,_0x3b1f66);}else if(_0x307bef&&_0x307bef['transfer']){if(_0x3b1f66['cause']==='16'&&this[_0x461c('0x14')][_0x3b1f66[_0x461c('0x86')]]['dialAnswer']){logger[_0x461c('0x25')]('[syncHangup][talking][transfer]',_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')],_0x461c('0x8d'),_0x259977[_0x461c('0x34')],_0x461c('0x48'),_0x259977['pTalking']);this['callProgressDetectingCustomer'](_0x3b1f66,_0x3b1f66[_0x461c('0x86')],_0x3b1f66['cause']);}else if(this[_0x461c('0x14')][_0x3b1f66['linkedid']]['dialAnswer']){logger['info'](_0x461c('0x132'),_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')],_0x461c('0x8d'),_0x259977[_0x461c('0x34')],'pTalking:\x20',_0x259977[_0x461c('0x2e')]);this['callProgressDetectingCustomer'](_0x3b1f66,_0x3b1f66[_0x461c('0x86')],_0x3b1f66[_0x461c('0x12d')]);}}};Preview[_0x461c('0x39')]['syncDialEnd']=function(_0x1af6b0){if(this[_0x461c('0x14')][_0x1af6b0[_0x461c('0xd4')]]&&_0x1af6b0[_0x461c('0xd4')]!==_0x1af6b0[_0x461c('0x133')]){this[_0x461c('0x75')](_0x1af6b0,_0x1af6b0[_0x461c('0xd4')],_0x1af6b0['dialstatus']);}};Preview['prototype'][_0x461c('0x1b')]=function(_0x4a4d9b){if(this[_0x461c('0x14')][_0x4a4d9b[_0x461c('0x86')]]&&_0x4a4d9b['linkedid']!==_0x4a4d9b[_0x461c('0x8c')]&&!this[_0x461c('0x14')][_0x4a4d9b[_0x461c('0x86')]][_0x461c('0x49')]){if(_0x4a4d9b[_0x461c('0x12d')]==='1'){this['callProgressDetectingCustomer'](_0x4a4d9b,_0x4a4d9b[_0x461c('0x86')],_0x4a4d9b[_0x461c('0x12d')]);}}};Preview['prototype']['addVariable']=function(_0x52cd8b,_0x53ab40,_0x546cd1){if(this['actions'][_0x52cd8b]){if(_[_0x461c('0x43')](this['actions'][_0x52cd8b]['variables'])){this[_0x461c('0x14')][_0x52cd8b][_0x461c('0x134')]={};}this[_0x461c('0x14')][_0x52cd8b][_0x461c('0x134')][_0x53ab40]=_0x546cd1;}};Preview[_0x461c('0x39')]['syncVarSet']=function(_0x229f41){try{if(!_[_0x461c('0x43')](_0x229f41)){if(ut['filterKey'](_[_0x461c('0x135')](_0x229f41[_0x461c('0x136')])[0x0])){this[_0x461c('0x137')](_0x229f41['uniqueid'],_[_0x461c('0x135')](_0x229f41[_0x461c('0x136')])[0x0],_0x229f41[_0x461c('0x138')]);}}}catch(_0xd57b84){logger['error']('[syncVarSet][Preview]',util[_0x461c('0x139')](_0xd57b84,{'showHidden':![],'depth':null}));}};Preview[_0x461c('0x39')]['syncAttendedTransfer']=function(_0x16bea5){if(_0x16bea5){if(this[_0x461c('0x14')][_0x16bea5[_0x461c('0x13a')]]){this['actions'][_0x16bea5[_0x461c('0x13a')]][_0x461c('0x131')]=!![];}}};Preview['prototype'][_0x461c('0x22')]=function(_0x4a61ea){if(_0x4a61ea){if(this[_0x461c('0x14')][_0x4a61ea[_0x461c('0x13b')]]){this['actions'][_0x4a61ea[_0x461c('0x13b')]][_0x461c('0x131')]=!![];}}};module[_0x461c('0x13c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4ad9d5e..6b8844a 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 _0x9635=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20'];(function(_0x2144a8,_0x436318){var _0x4dfdf2=function(_0xe85c45){while(--_0xe85c45){_0x2144a8['push'](_0x2144a8['shift']());}};_0x4dfdf2(++_0x436318);}(_0x9635,0x123));var _0x5963=function(_0x441535,_0x75ada9){_0x441535=_0x441535-0x0;var _0x1c7967=_0x9635[_0x441535];return _0x1c7967;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x5963('0x0'));var cmHopper=require(_0x5963('0x1'));var cmHopperHistory=require(_0x5963('0x2'));var cmHopperBlack=require(_0x5963('0x3'));var agentReportPreview=require(_0x5963('0x4'));var voiceQueueReport=require(_0x5963('0x5'));function loggerCatch(_0x289b48){return function(_0x161ff1){logger[_0x5963('0x6')](_0x289b48,util[_0x5963('0x7')](_0x161ff1,{'showHidden':![],'depth':null}));};}function create(_0x1f8e4f){return cmHopperHistory[_0x5963('0x8')](_0x1f8e4f)['catch'](loggerCatch(_0x5963('0x9')));}function createAgent(_0x57e38c){return BPromise[_0x5963('0xa')]()[_0x5963('0xb')](agentReportPreview[_0x5963('0x8')](_0x57e38c))[_0x5963('0xc')](loggerCatch(_0x5963('0x9')));}function moveContact(_0x3497f4){return cmHopper['moveContactManagedDialer'](_0x3497f4,!![])['catch'](loggerCatch(_0x5963('0xd')));}exports[_0x5963('0xe')]=function(_0x5ac2bc){return cmHopperBlack[_0x5963('0xe')](_0x5ac2bc)['catch'](loggerCatch(_0x5963('0xf')));};exports[_0x5963('0x10')]=function(_0x32f309){return BPromise[_0x5963('0xa')]()[_0x5963('0xb')](cmHopper[_0x5963('0x10')](_0x32f309))[_0x5963('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0x5963('0x8')]=function(_0x374f39,_0x27be9d){create(_0x374f39)[_0x5963('0xc')](loggerCatch(_0x27be9d));moveContact(_0x374f39)[_0x5963('0xc')](loggerCatch(_0x27be9d));};exports[_0x5963('0x11')]=function(_0x331297,_0x2424e7){createAgent(_0x331297)[_0x5963('0xc')](loggerCatch(_0x2424e7));};exports[_0x5963('0x12')]=function(_0x1f5cc1,_0x5673dc){create(_0x1f5cc1)[_0x5963('0xc')](loggerCatch(_0x5673dc));};exports[_0x5963('0x13')]=function(_0x599cf1,_0xe2b06d){moveContact(_0x599cf1)[_0x5963('0xc')](loggerCatch(_0xe2b06d));};exports['rescheduleContact']=function(_0x38df23,_0x3df740,_0xe53d06){if(_0x3df740){_0x38df23['UserId']=null;}if(_0xe53d06){_0x38df23['active']=![];}return cmHopper['rescheduleContact'](_0x38df23)[_0x5963('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5963('0x14')]=function(_0x417eaf){return cmHopper[_0x5963('0x14')](_0x417eaf)[_0x5963('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x5963('0x15')]=function(_0x2f409e){return cmHopper[_0x5963('0x15')]({'UserId':null},_0x2f409e,0x1)['catch'](loggerCatch(_0x5963('0x16')));};exports[_0x5963('0x17')]=function(_0x1062df){return cmHopper['unlockContact']({'active':![]},_0x1062df,0x1)['catch'](loggerCatch(_0x5963('0x18')));};exports[_0x5963('0x19')]=function(_0x2d7636){var _0x4f5d60={};_0x4f5d60[_0x5963('0x1a')]=_0x2d7636['type'];_0x4f5d60[_0x5963('0x1b')]=_0x2d7636['uniqueid'];_0x4f5d60[_0x5963('0x1c')]=_0x2d7636[_0x5963('0x1c')];_0x4f5d60[_0x5963('0x1d')]=_0x2d7636[_0x5963('0x1d')];_0x4f5d60[_0x5963('0x1e')]=_0x2d7636['queue'];_0x4f5d60[_0x5963('0x1f')]=_0x2d7636[_0x5963('0x20')];_0x4f5d60[_0x5963('0x21')]=_0x2d7636[_0x5963('0x20')];_0x4f5d60['queuecallercomplete']=0x1;_0x4f5d60['queuecallercompleteAt']=_0x2d7636[_0x5963('0x22')];_0x4f5d60[_0x5963('0x23')]=_0x2d7636[_0x5963('0x24')];_0x4f5d60[_0x5963('0x25')]=_0x5963('0x26');_0x4f5d60['exten']=_0x5963('0x27');_0x4f5d60['holdtime']=0x0;_0x4f5d60[_0x5963('0x28')]=0x1;_0x4f5d60[_0x5963('0x29')]=_0x2d7636[_0x5963('0x24')];_0x4f5d60[_0x5963('0x2a')]=_0x5963('0x2b');return BPromise[_0x5963('0xa')]()[_0x5963('0xb')](voiceQueueReport['create'](_0x4f5d60))[_0x5963('0xc')](loggerCatch(_0x5963('0x2c')));};exports['getContactRecallMe']=function(_0x4019e4,_0x5457f3){return BPromise[_0x5963('0xa')]()[_0x5963('0xb')](cmHopper[_0x5963('0x2d')](_0x4019e4,_0x5457f3))[_0x5963('0xc')](loggerCatch(_0x5963('0x2e')));};exports[_0x5963('0x2f')]=function(_0x104c6d){return cmHopper['rescheduleContact'](_0x104c6d,!![],!![])[_0x5963('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x4778=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','connectedlinename','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0x4778,0x14b));var _0x8477=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4778[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require('util');var BPromise=require(_0x8477('0x0'));var logger=require(_0x8477('0x1'))(_0x8477('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8477('0x3'));var agentReportPreview=require(_0x8477('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x480a13){return function(_0x568513){logger[_0x8477('0x5')](_0x480a13,util['inspect'](_0x568513,{'showHidden':![],'depth':null}));};}function create(_0x2f96e2){return cmHopperHistory[_0x8477('0x6')](_0x2f96e2)[_0x8477('0x7')](loggerCatch(_0x8477('0x8')));}function createAgent(_0x251c6b){return BPromise[_0x8477('0x9')]()[_0x8477('0xa')](agentReportPreview['createHistory'](_0x251c6b))[_0x8477('0x7')](loggerCatch(_0x8477('0x8')));}function moveContact(_0x1fce82){return cmHopper['moveContactManagedDialer'](_0x1fce82,!![])[_0x8477('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8477('0xb')]=function(_0x43dc2a){return cmHopperBlack[_0x8477('0xb')](_0x43dc2a)[_0x8477('0x7')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8477('0xc')]=function(_0x88c423){return BPromise['resolve']()['then'](cmHopper[_0x8477('0xc')](_0x88c423))['catch'](loggerCatch(_0x8477('0xd')));};exports[_0x8477('0x6')]=function(_0x58ebb4,_0x17aa1e){create(_0x58ebb4)[_0x8477('0x7')](loggerCatch(_0x17aa1e));moveContact(_0x58ebb4)[_0x8477('0x7')](loggerCatch(_0x17aa1e));};exports[_0x8477('0xe')]=function(_0xdfaa9,_0x1b07a6){createAgent(_0xdfaa9)[_0x8477('0x7')](loggerCatch(_0x1b07a6));};exports[_0x8477('0xf')]=function(_0x50d0e1,_0x8d9a7c){create(_0x50d0e1)['catch'](loggerCatch(_0x8d9a7c));};exports[_0x8477('0x10')]=function(_0x2a0a23,_0x12340a){moveContact(_0x2a0a23)[_0x8477('0x7')](loggerCatch(_0x12340a));};exports['rescheduleContact']=function(_0x4e066f,_0x45e846,_0x4a9f0c){if(_0x45e846){_0x4e066f[_0x8477('0x11')]=null;}if(_0x4a9f0c){_0x4e066f[_0x8477('0x12')]=![];}return cmHopper[_0x8477('0x13')](_0x4e066f)[_0x8477('0x7')](loggerCatch(_0x8477('0x14')));};exports[_0x8477('0x15')]=function(_0x5a4955){return cmHopper['countReScheduled'](_0x5a4955)[_0x8477('0x7')](loggerCatch('[countReScheduled]\x20'));};exports[_0x8477('0x16')]=function(_0x27a157){return cmHopper[_0x8477('0x16')]({'UserId':null},_0x27a157,0x1)[_0x8477('0x7')](loggerCatch('[unlockContact]\x20'));};exports[_0x8477('0x17')]=function(_0x31cb8a){return cmHopper[_0x8477('0x16')]({'active':![]},_0x31cb8a,0x1)[_0x8477('0x7')](loggerCatch(_0x8477('0x18')));};exports[_0x8477('0x19')]=function(_0x1c5a1a){var _0x27f139={};_0x27f139['type']=_0x1c5a1a[_0x8477('0x1a')];_0x27f139[_0x8477('0x1b')]=_0x1c5a1a[_0x8477('0x1b')];_0x27f139[_0x8477('0x1c')]=_0x1c5a1a[_0x8477('0x1c')];_0x27f139[_0x8477('0x1d')]=_0x1c5a1a[_0x8477('0x1d')];_0x27f139[_0x8477('0x1e')]=_0x1c5a1a['queue'];_0x27f139[_0x8477('0x1f')]=_0x1c5a1a[_0x8477('0x20')];_0x27f139[_0x8477('0x21')]=_0x1c5a1a['answertime'];_0x27f139['queuecallercomplete']=0x1;_0x27f139['queuecallercompleteAt']=_0x1c5a1a['endtime'];_0x27f139[_0x8477('0x22')]=_0x1c5a1a['membername'];_0x27f139[_0x8477('0x23')]=_0x8477('0x24');_0x27f139['exten']=_0x8477('0x25');_0x27f139['holdtime']=0x0;_0x27f139[_0x8477('0x26')]=0x1;_0x27f139[_0x8477('0x27')]=_0x1c5a1a[_0x8477('0x28')];_0x27f139['queuecallerexitreason']=_0x8477('0x29');return BPromise[_0x8477('0x9')]()[_0x8477('0xa')](voiceQueueReport[_0x8477('0x2a')](_0x27f139))[_0x8477('0x7')](loggerCatch(_0x8477('0x2b')));};exports[_0x8477('0x2c')]=function(_0x1f5cc6,_0x44172c){return BPromise[_0x8477('0x9')]()[_0x8477('0xa')](cmHopper['getContactRecallMe'](_0x1f5cc6,_0x44172c))[_0x8477('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x8477('0x2d')]=function(_0x2e0cf1){return cmHopper[_0x8477('0x13')](_0x2e0cf1,!![],!![])[_0x8477('0x7')](loggerCatch(_0x8477('0x2e')));}; \ 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 34b1270..2647533 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 _0xf036=['countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','status','reachable','getDiff','milliseconds','diff','createBody','filterKey','idContact','dialAnswer','countglobal','callback','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','info','inspect','logger2','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','state','ringtime','getSeconds','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal'];(function(_0x342968,_0x401827){var _0x32f2de=function(_0x4e6eed){while(--_0x4e6eed){_0x342968['push'](_0x342968['shift']());}};_0x32f2de(++_0x401827);}(_0xf036,0xd9));var _0x6f03=function(_0x3b2430,_0x305349){_0x3b2430=_0x3b2430-0x0;var _0x5a6e6b=_0xf036[_0x3b2430];return _0x5a6e6b;};'use strict';var util=require(_0x6f03('0x0'));var _=require(_0x6f03('0x1'));var moment=require(_0x6f03('0x2'));var logger=require(_0x6f03('0x3'))('preview');var ipAgi=process['env'][_0x6f03('0x4')]||_0x6f03('0x5');var utils=require('../../dialer/utils');exports[_0x6f03('0x6')]=function(_0x3b971c){return function(_0x9d7669){logger[_0x6f03('0x7')](_0x3b971c,util['inspect'](_0x9d7669,{'showHidden':![],'depth':null}));};};exports[_0x6f03('0x8')]=function(_0x1dbfa5,_0x5d0257){logger[_0x6f03('0x9')](_0x1dbfa5,util[_0x6f03('0xa')](_0x5d0257,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3f2067,_0x73b437){logger['error'](_0x3f2067,util['inspect'](_0x73b437,{'showHidden':![],'depth':null}));};exports[_0x6f03('0xb')]=function(_0x23a799){return function(_0x1608d1){logger[_0x6f03('0x9')](_0x23a799,util[_0x6f03('0xa')](_0x1608d1,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xa38693,_0x140fdf,_0x3ce7e3){return{'message':_0xa38693,'unlock':_0x140fdf,'active':_0x3ce7e3};};exports[_0x6f03('0xc')]=function(_0x30d658,_0x174ff1,_0x1fe894){if(!_['isUndefined'](_0x1fe894)&&_0x6f03('0xd')===typeof _0x1fe894&&!_[_0x6f03('0xe')](_0x1fe894)){if(!_['isUndefined'](_0x174ff1)&&_0x6f03('0xd')===typeof _0x174ff1&&!_[_0x6f03('0xe')](_0x174ff1)){return util[_0x6f03('0xf')](_0x6f03('0x10'),_0x174ff1,_0x1fe894);}return util[_0x6f03('0xf')](_0x6f03('0x10'),_0x1fe894,_0x1fe894);}if(!_['isUndefined'](_0x30d658)&&_0x6f03('0xd')===typeof _0x30d658&&!_[_0x6f03('0xe')](_0x30d658)){return _0x30d658;}return _0x6f03('0x11');};exports[_0x6f03('0x12')]=function(_0x101a69){if(_[_0x6f03('0x13')](_0x101a69)){return![];}return _0x101a69;};exports[_0x6f03('0x14')]=function(_0x24c36c,_0x54ec8c,_0x1f5158,_0x49c861,_0x2f8814,_0x47591c){var _0x9d96fe={'XMD-QUEUE':_0x54ec8c[_0x6f03('0x15')]?_0x54ec8c[_0x6f03('0x15')][_0x6f03('0x16')]:'','XMD-CALLERID':_0x49c861,'XMD-CALLERID-PREVIEW':_0x47591c?util[_0x6f03('0xf')](_0x6f03('0x10'),_0x47591c[_0x6f03('0x17')],_0x47591c['calleridnum']):_0x49c861,'XMD-DIALID':_0x2f8814,'XMD-CONTACTID':_0x54ec8c[_0x6f03('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x49c861,'XMD-VOICEQUEUEID':_0x54ec8c[_0x6f03('0x19')],'XMD-DIALCHANNEL':_0x1f5158,'XMD-DIALTIMEOUT':_0x24c36c[_0x6f03('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x6f03('0xf')]('\x22rtTxX%s%s\x22',_0x24c36c['dialQueueProject2']?'g':'',_[_0x6f03('0xe')](_0x24c36c[_0x6f03('0x1b')])?'':_0x6f03('0x1c')),'XMD-DIALURL':_0x24c36c[_0x6f03('0x1d')]||'','XMD-AGI':_0x24c36c[_0x6f03('0x1e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x24c36c[_0x6f03('0x1e')]):_0x6f03('0x1f'),'XMD-AGIAFTER':_0x24c36c[_0x6f03('0x20')]?util[_0x6f03('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x24c36c[_0x6f03('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x47591c?_0x47591c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x47591c?_0x47591c[_0x6f03('0x21')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x6f03('0x22')};if(!_['isEmpty'](_0x24c36c[_0x6f03('0x1b')])){_0x9d96fe[util[_0x6f03('0xf')]('%s',_0x6f03('0x23'))]=_0x24c36c[_0x6f03('0x1b')];_0x9d96fe[util[_0x6f03('0xf')]('%s',_0x6f03('0x24'))]=_0x2f8814;}return _0x9d96fe;};exports[_0x6f03('0x25')]=function(_0x1d63d2){var _0x4ff4ae={};for(var _0x5b3c98 in _0x1d63d2){if(_0x1d63d2['hasOwnProperty'](_0x5b3c98)){_0x4ff4ae[util['format']('%s',_[_0x6f03('0x26')](_0x5b3c98))]=_0x1d63d2[_0x5b3c98];}}return{'variables':_0x4ff4ae};};exports[_0x6f03('0x27')]=function(_0x1ffc4f,_0x4420db){if(!_[_0x6f03('0x13')](_0x1ffc4f)){if(_0x1ffc4f['hasOwnProperty'](_0x6f03('0x28'))){if(_0x1ffc4f['originated']>0x0){_0x1ffc4f[_0x6f03('0x28')]-=0x1;}else{logger[_0x6f03('0x7')](_0x6f03('0x29'),_0x4420db);}}}else{logger[_0x6f03('0x7')](_0x6f03('0x2a'),_0x4420db);}};exports['logBlacklist']=function(_0x194878){var _0x27fe9c=moment()[_0x6f03('0xf')](_0x6f03('0x2b'));_0x194878['state']=0xd;_0x194878[_0x6f03('0x2c')]=_0x6f03('0x2d');_0x194878[_0x6f03('0x2e')]=_0x27fe9c;_0x194878[_0x6f03('0x2f')]=_0x27fe9c;_0x194878['endtime']=_0x27fe9c;};exports['logAgent']=function(_0x12a0ef,_0x1da85c,_0x424ccc){var _0x31d7a6=moment()[_0x6f03('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x12a0ef[_0x6f03('0x30')]=_0x1da85c;_0x12a0ef[_0x6f03('0x2c')]=_0x424ccc;_0x12a0ef[_0x6f03('0x2f')]=_0x31d7a6;_0x12a0ef[_0x6f03('0x31')]=utils[_0x6f03('0x32')](_0x12a0ef['responsetime'],_0x12a0ef[_0x6f03('0x2e')]);};exports[_0x6f03('0x33')]=function(_0x589a86,_0x144350,_0x31e377){_0x589a86[_0x6f03('0x34')]=_0x144350;_0x589a86[_0x6f03('0x35')]=_0x31e377;};exports['logCustomer']=function(_0x26c804,_0x271e6a,_0x280838){var _0x55b42b=moment()[_0x6f03('0xf')](_0x6f03('0x2b'));_0x26c804[_0x6f03('0x30')]=_0x271e6a;_0x26c804['statedesc']=_0x280838;_0x26c804[_0x6f03('0x2f')]=_0x26c804['responsetime']?_0x26c804[_0x6f03('0x2f')]:_0x55b42b;_0x26c804[_0x6f03('0x36')]=_0x26c804['endtime']?_0x26c804[_0x6f03('0x36')]:_0x55b42b;_0x26c804[_0x6f03('0x31')]=utils[_0x6f03('0x32')](_0x26c804[_0x6f03('0x2f')]||0x0,_0x26c804['starttime']||0x0);_0x26c804[_0x6f03('0x37')]=_0x26c804[_0x6f03('0x38')]?utils['getSeconds'](_0x26c804[_0x6f03('0x36')],_0x26c804[_0x6f03('0x38')]):0x0;};exports[_0x6f03('0x39')]=function(_0x3baef4){return _0x3baef4==='Failure';};exports[_0x6f03('0x3a')]=function(_0x17924d,_0x3a5e8b,_0x2c263e,_0x3bbdbd,_0x54f329){var _0x5c105c=_0x3bbdbd?_0x6f03('0x3b'):_0x17924d[_0x6f03('0x17')];_0x5c105c=_0x54f329?_0x6f03('0x3c'):_0x5c105c;return{'actionid':_0x17924d[_0x6f03('0x3d')],'action':_0x6f03('0x3e'),'channel':_0x17924d[_0x6f03('0x3f')],'callerid':util[_0x6f03('0xf')](_0x6f03('0x10'),_0x5c105c,_0x17924d[_0x6f03('0x40')]),'Exten':_0x6f03('0x41'),'Context':_0x6f03('0x42'),'Priority':'1','variable':_0x2c263e,'timeout':(_0x3a5e8b[_0x6f03('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17924d[_0x6f03('0x3d')]};};exports[_0x6f03('0x44')]=function(_0xb81bb6){return _0xb81bb6['countbusyretry']+_0xb81bb6[_0x6f03('0x45')]+_0xb81bb6[_0x6f03('0x46')]+_0xb81bb6[_0x6f03('0x47')]+_0xb81bb6[_0x6f03('0x48')];};exports[_0x6f03('0x49')]=function(_0x422046){var _0x4bb185=_[_0x6f03('0x4a')](_0x422046);_0x4bb185[_0x6f03('0x30')]=0xf;_0x4bb185[_0x6f03('0x2c')]=_0x6f03('0x4b');return _0x4bb185;};exports[_0x6f03('0x4c')]=function(_0xad1d45,_0x50fb63,_0xba6ecf){var _0x24a0da={};_0x24a0da[_0x50fb63]=_0xad1d45[_0x50fb63];_0x24a0da[_0x6f03('0x4d')]=![];_0x24a0da[_0x6f03('0x4e')]=moment()[_0x6f03('0x4f')](_0xba6ecf,_0x6f03('0x50'))[_0x6f03('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x24a0da['ContactId']=_0xad1d45[_0x6f03('0x18')];_0x24a0da[_0x6f03('0x51')]=_0xad1d45['ListId'];_0x24a0da[_0x6f03('0x19')]=_0xad1d45[_0x6f03('0x19')]||undefined;return _0x24a0da;};exports[_0x6f03('0x52')]=function(_0x54929f,_0x111f3f){if(!_[_0x6f03('0x13')](_0x54929f)){if(_0x54929f[_0x6f03('0x53')]>0x0){_0x54929f[_0x6f03('0x53')]-=0x1;}else{logger[_0x6f03('0x7')](_0x111f3f,_0x6f03('0x54'));}}else{logger[_0x6f03('0x7')](_0x111f3f,_0x6f03('0x55'));}};exports[_0x6f03('0x56')]=function(_0x141384){if(_0x141384<=0x0){return!![];}return![];};function buildObj(_0xd8e1c8,_0x426879,_0x45241d){_0xd8e1c8[_0x6f03('0x57')]=_0x426879;_0xd8e1c8[_0x6f03('0x16')]=_0xd8e1c8[_0x6f03('0x58')];_0xd8e1c8[_0x6f03('0x59')]=_0xd8e1c8[_0x6f03('0x3f')];_0xd8e1c8['motionChannel']=_0x6f03('0x5a');if(_0x45241d){_0xd8e1c8[_0x6f03('0x5b')]=_0x45241d['mandatoryDisposition'];}return _0xd8e1c8;}exports[_0x6f03('0x5c')]=buildObj;exports['buildAcw']=function(_0x213a3){var _0x3806e7={};_0x3806e7[_0x6f03('0x58')]=_0x213a3[_0x6f03('0x58')];_0x3806e7['interface']=_0x213a3['channelAgent'];_0x3806e7[_0x6f03('0x3d')]=_0x213a3[_0x6f03('0x3d')];return _0x3806e7;};exports[_0x6f03('0x5d')]=function(_0x1e5dc8){var _0x475b67=[];for(var _0x5eb627 in _0x1e5dc8){if(_0x1e5dc8[_0x6f03('0x5e')](_0x5eb627)){if(!_['isNil'](_0x1e5dc8[_0x5eb627])&&_0x1e5dc8[_0x5eb627][_0x6f03('0x30')]===_0x6f03('0x5f')&&_0x1e5dc8[_0x5eb627][_0x6f03('0x60')]===_0x6f03('0x61')){_0x475b67['push'](_0x1e5dc8[_0x5eb627]['id']);}}}return _0x475b67;};exports[_0x6f03('0x62')]=function(_0x770c9b){var _0x57cd2c=moment()[_0x6f03('0x63')](0x0);var _0x2336bc=moment(_0x770c9b)[_0x6f03('0x63')](0x0);return _0x57cd2c[_0x6f03('0x64')](_0x2336bc,'seconds');};exports[_0x6f03('0x65')]=function(_0x4d43f8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d43f8[_0x6f03('0x18')],'ListId':_0x4d43f8['ListId'],'VoiceQueueId':_0x4d43f8[_0x6f03('0x19')]||undefined,'CampaignId':_0x4d43f8['CampaignId']||undefined};};exports[_0x6f03('0x66')]=function(_0xb98ce0){if(_0xb98ce0==='uniqueid'||_0xb98ce0===_0x6f03('0x67')||_0xb98ce0===_0x6f03('0x58')||_0xb98ce0==='type'||_0xb98ce0==='campaigntype'||_0xb98ce0===_0x6f03('0x68')||_0xb98ce0===_0x6f03('0x34')||_0xb98ce0===_0x6f03('0x3f')||_0xb98ce0===_0x6f03('0x17')||_0xb98ce0==='active'||_0xb98ce0===_0x6f03('0x40')||_0xb98ce0==='scheduledat'||_0xb98ce0==='countbusyretry'||_0xb98ce0===_0x6f03('0x45')||_0xb98ce0===_0x6f03('0x46')||_0xb98ce0===_0x6f03('0x69')||_0xb98ce0===_0x6f03('0x6a')||_0xb98ce0==='callbackuniqueid'||_0xb98ce0==='callbackat'||_0xb98ce0===_0x6f03('0x6b')||_0xb98ce0===_0x6f03('0x18')||_0xb98ce0===_0x6f03('0x51')||_0xb98ce0==='UserId'||_0xb98ce0==='VoiceQueueId'||_0xb98ce0===_0x6f03('0x6c')||_0xb98ce0==='xmd-voicequeueid'||_0xb98ce0===_0x6f03('0x6d')||_0xb98ce0===_0x6f03('0x6e')||_0xb98ce0===_0x6f03('0x6f')||_0xb98ce0===_0x6f03('0x70')||_0xb98ce0===_0x6f03('0x71')||_0xb98ce0==='xmd-dialoptions'||_0xb98ce0===_0x6f03('0x72')||_0xb98ce0===_0x6f03('0x73')||_0xb98ce0===_0x6f03('0x74')||_0xb98ce0===_0x6f03('0x75')||_0xb98ce0==='xmd-callerid'||_0xb98ce0==='xmd-agiafter'||_0xb98ce0===_0x6f03('0x76')||_0xb98ce0===_0x6f03('0x77')||_0xb98ce0===_0x6f03('0x78')||_0xb98ce0===_0x6f03('0x79')||_0xb98ce0===_0x6f03('0x7a')||_0xb98ce0===_0x6f03('0x7b')||_0xb98ce0===_0x6f03('0x7c')||_0xb98ce0===_0x6f03('0x7d')||_0xb98ce0===_0x6f03('0x7e')||_0xb98ce0===_0x6f03('0x77')||_0xb98ce0===_0x6f03('0x78')||_0xb98ce0===_0x6f03('0x79')||_0xb98ce0===_0x6f03('0x7a')||_0xb98ce0==='rtpaudioqosloss'||_0xb98ce0===_0x6f03('0x7c')||_0xb98ce0===_0x6f03('0x7d')||_0xb98ce0===_0x6f03('0x7e')||_0xb98ce0===_0x6f03('0x7f')||_0xb98ce0===_0x6f03('0x80')||_0xb98ce0===_0x6f03('0x30')||_0xb98ce0===_0x6f03('0x2c')){return![];}return!![];};exports[_0x6f03('0x81')]=function(_0x27e6ea,_0x4f01e6){var _0x2ae59a,_0x5b1c16,_0xa644f8;if(_0x4f01e6<=0x0){_0x4f01e6=0x1;}_0x2ae59a=new RegExp(_0x6f03('0x82')+_0x4f01e6+'}$');_0x5b1c16=Math['pow'](0xa,_0x4f01e6-0x1);_0xa644f8=Math[_0x6f03('0x83')](0xa,_0x4f01e6)-0x1;return util['format']('%s',_[_0x6f03('0x84')](_0x27e6ea,_0x2ae59a,_[_0x6f03('0x85')](_0x5b1c16,_0xa644f8)));};exports[_0x6f03('0x86')]=function(_0x4df040){var _0x2716d2=_0x4df040[_0x6f03('0x87')](/"(.*?)"/);return _0x2716d2?_0x2716d2[0x1]:_0x4df040;};exports[_0x6f03('0x88')]=function(_0x1db0d4){var _0x441e5f=_0x1db0d4[_0x6f03('0x87')](/<(.*?)>/);return _0x441e5f?_0x441e5f[0x1]:_0x1db0d4;};function buildNoAnswerEventPayload(_0x4f27f0,_0x17d01b){var _0x1e567e=buildObj(_0x4f27f0,_0x6f03('0x89'));if(!_[_0x6f03('0xe')](_0x17d01b[_0x6f03('0x8a')])){Object[_0x6f03('0x8b')](_0x17d01b[_0x6f03('0x8a')])[_0x6f03('0x8c')](function(_0x5788f0){_0x1e567e[_0x5788f0[_0x6f03('0x8d')]()]=_0x17d01b[_0x6f03('0x8a')][_0x5788f0];});}return _0x1e567e;}exports[_0x6f03('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x4147=['logger','info','loggerError','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','logLookAgent','membername','UserId','logCustomer','ringtime','getSeconds','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','../../dialer/utils','loggerCatch','error','inspect'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4147,0x80));var _0x7414=function(_0xebec6b,_0x3e41f2){_0xebec6b=_0xebec6b-0x0;var _0x3e6edc=_0x4147[_0xebec6b];return _0x3e6edc;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7414('0x0'));var logger=require('../../../../config/logger')(_0x7414('0x1'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x7414('0x2'));exports[_0x7414('0x3')]=function(_0x887a55){return function(_0x41a869){logger[_0x7414('0x4')](_0x887a55,util[_0x7414('0x5')](_0x41a869,{'showHidden':![],'depth':null}));};};exports[_0x7414('0x6')]=function(_0x29d7cd,_0x596834){logger[_0x7414('0x7')](_0x29d7cd,util[_0x7414('0x5')](_0x596834,{'showHidden':![],'depth':null}));};exports[_0x7414('0x8')]=function(_0x4672d8,_0x35609a){logger[_0x7414('0x4')](_0x4672d8,util['inspect'](_0x35609a,{'showHidden':![],'depth':null}));};exports[_0x7414('0x9')]=function(_0x3c906a){return function(_0x1fff75){logger[_0x7414('0x7')](_0x3c906a,util['inspect'](_0x1fff75,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5d022e,_0x42ead1,_0x511045){return{'message':_0x5d022e,'unlock':_0x42ead1,'active':_0x511045};};exports['getCallerId']=function(_0x2568a7,_0x2c9dee,_0x16cd59){if(!_[_0x7414('0xa')](_0x16cd59)&&_0x7414('0xb')===typeof _0x16cd59&&!_['isEmpty'](_0x16cd59)){if(!_[_0x7414('0xa')](_0x2c9dee)&&'string'===typeof _0x2c9dee&&!_[_0x7414('0xc')](_0x2c9dee)){return util['format'](_0x7414('0xd'),_0x2c9dee,_0x16cd59);}return util[_0x7414('0xe')](_0x7414('0xd'),_0x16cd59,_0x16cd59);}if(!_[_0x7414('0xa')](_0x2568a7)&&_0x7414('0xb')===typeof _0x2568a7&&!_['isEmpty'](_0x2568a7)){return _0x2568a7;}return _0x7414('0xf');};exports[_0x7414('0x10')]=function(_0x1179fe){if(_[_0x7414('0x11')](_0x1179fe)){return![];}return _0x1179fe;};exports[_0x7414('0x12')]=function(_0x5aac9d,_0x599e02,_0x541e09,_0x28b1b2,_0x3f431d,_0x39a5f2){var _0x5cdd9c={'XMD-QUEUE':_0x599e02['Queue']?_0x599e02[_0x7414('0x13')]['name']:'','XMD-CALLERID':_0x28b1b2,'XMD-CALLERID-PREVIEW':_0x39a5f2?util['format'](_0x7414('0xd'),_0x39a5f2[_0x7414('0x14')],_0x39a5f2[_0x7414('0x15')]):_0x28b1b2,'XMD-DIALID':_0x3f431d,'XMD-CONTACTID':_0x599e02[_0x7414('0x16')],'XMD-CDRTYPE':_0x7414('0x17'),'CALLERID(all)':_0x28b1b2,'XMD-VOICEQUEUEID':_0x599e02[_0x7414('0x18')],'XMD-DIALCHANNEL':_0x541e09,'XMD-DIALTIMEOUT':_0x5aac9d[_0x7414('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x7414('0xe')]('\x22rtTxX%s%s\x22',_0x5aac9d[_0x7414('0x1a')]?'g':'',_[_0x7414('0xc')](_0x5aac9d[_0x7414('0x1b')])?'':_0x7414('0x1c')),'XMD-DIALURL':_0x5aac9d[_0x7414('0x1d')]||'','XMD-AGI':_0x5aac9d[_0x7414('0x1e')]?util[_0x7414('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5aac9d['dialQueueProject']):_0x7414('0x1f'),'XMD-AGIAFTER':_0x5aac9d[_0x7414('0x1a')]?util[_0x7414('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5aac9d[_0x7414('0x1a')]):_0x7414('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x39a5f2?_0x39a5f2[_0x7414('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x39a5f2?_0x39a5f2[_0x7414('0x21')]:'','XMD-DESTINATION':_0x7414('0x22'),'SIPADDHEADER':_0x7414('0x23')};if(!_[_0x7414('0xc')](_0x5aac9d[_0x7414('0x1b')])){_0x5cdd9c[util[_0x7414('0xe')]('%s',_0x7414('0x24'))]=_0x5aac9d[_0x7414('0x1b')];_0x5cdd9c[util[_0x7414('0xe')]('%s',_0x7414('0x25'))]=_0x3f431d;}return _0x5cdd9c;};exports['toLowerVariables']=function(_0x464a4f){var _0x1bab0c={};for(var _0x10994b in _0x464a4f){if(_0x464a4f[_0x7414('0x26')](_0x10994b)){_0x1bab0c[util[_0x7414('0xe')]('%s',_[_0x7414('0x27')](_0x10994b))]=_0x464a4f[_0x10994b];}}return{'variables':_0x1bab0c};};exports[_0x7414('0x28')]=function(_0x2c9919,_0x94e578){if(!_[_0x7414('0x11')](_0x2c9919)){if(_0x2c9919[_0x7414('0x26')](_0x7414('0x29'))){if(_0x2c9919[_0x7414('0x29')]>0x0){_0x2c9919[_0x7414('0x29')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x94e578);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x94e578);}};exports[_0x7414('0x2a')]=function(_0x3ac61f){var _0x45953f=moment()[_0x7414('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ac61f['state']=0xd;_0x3ac61f[_0x7414('0x2b')]=_0x7414('0x2c');_0x3ac61f[_0x7414('0x2d')]=_0x45953f;_0x3ac61f[_0x7414('0x2e')]=_0x45953f;_0x3ac61f[_0x7414('0x2f')]=_0x45953f;};exports[_0x7414('0x30')]=function(_0xc41154,_0x2a803d,_0x51e90a){var _0x3561c6=moment()[_0x7414('0xe')](_0x7414('0x31'));_0xc41154[_0x7414('0x32')]=_0x2a803d;_0xc41154[_0x7414('0x2b')]=_0x51e90a;_0xc41154[_0x7414('0x2e')]=_0x3561c6;_0xc41154['ringtime']=utils['getSeconds'](_0xc41154[_0x7414('0x2e')],_0xc41154[_0x7414('0x2d')]);};exports[_0x7414('0x33')]=function(_0x219572,_0x32038c,_0x5088c8){_0x219572[_0x7414('0x34')]=_0x32038c;_0x219572[_0x7414('0x35')]=_0x5088c8;};exports[_0x7414('0x36')]=function(_0x1d931a,_0x44ca25,_0x580bae){var _0x3326ce=moment()[_0x7414('0xe')](_0x7414('0x31'));_0x1d931a['state']=_0x44ca25;_0x1d931a[_0x7414('0x2b')]=_0x580bae;_0x1d931a[_0x7414('0x2e')]=_0x1d931a[_0x7414('0x2e')]?_0x1d931a[_0x7414('0x2e')]:_0x3326ce;_0x1d931a[_0x7414('0x2f')]=_0x1d931a['endtime']?_0x1d931a[_0x7414('0x2f')]:_0x3326ce;_0x1d931a[_0x7414('0x37')]=utils[_0x7414('0x38')](_0x1d931a[_0x7414('0x2e')]||0x0,_0x1d931a[_0x7414('0x2d')]||0x0);_0x1d931a[_0x7414('0x39')]=_0x1d931a[_0x7414('0x3a')]?utils[_0x7414('0x38')](_0x1d931a[_0x7414('0x2f')],_0x1d931a[_0x7414('0x3a')]):0x0;};exports[_0x7414('0x3b')]=function(_0x4bd95f){return _0x4bd95f===_0x7414('0x3c');};exports['variablesAction']=function(_0x644e98,_0x3b370d,_0x27bc79,_0x438cd8,_0x4323b7){var _0x37b053=_0x438cd8?_0x7414('0x3d'):_0x644e98[_0x7414('0x14')];_0x37b053=_0x4323b7?_0x7414('0x3e'):_0x37b053;return{'actionid':_0x644e98[_0x7414('0x3f')],'action':_0x7414('0x40'),'channel':_0x644e98[_0x7414('0x41')],'callerid':util[_0x7414('0xe')]('\x22%s\x22\x20<%s>',_0x37b053,_0x644e98['calleridnum']),'Exten':_0x7414('0x22'),'Context':'from-sip','Priority':'1','variable':_0x27bc79,'timeout':(_0x3b370d[_0x7414('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x644e98[_0x7414('0x3f')]};};exports[_0x7414('0x43')]=function(_0x4a8e0c){return _0x4a8e0c[_0x7414('0x44')]+_0x4a8e0c[_0x7414('0x45')]+_0x4a8e0c[_0x7414('0x46')]+_0x4a8e0c['countagentrejectretry']+_0x4a8e0c['countnosuchnumberretry'];};exports[_0x7414('0x47')]=function(_0xaeb14b){var _0xd3d0ed=_[_0x7414('0x48')](_0xaeb14b);_0xd3d0ed[_0x7414('0x32')]=0xf;_0xd3d0ed[_0x7414('0x2b')]='Global';return _0xd3d0ed;};exports[_0x7414('0x49')]=function(_0x5ef5c5,_0x1f1913,_0x1796af){var _0x4db562={};_0x4db562[_0x1f1913]=_0x5ef5c5[_0x1f1913];_0x4db562[_0x7414('0x4a')]=![];_0x4db562[_0x7414('0x4b')]=moment()[_0x7414('0x4c')](_0x1796af,_0x7414('0x4d'))['format'](_0x7414('0x31'));_0x4db562[_0x7414('0x16')]=_0x5ef5c5[_0x7414('0x16')];_0x4db562['ListId']=_0x5ef5c5['ListId'];_0x4db562[_0x7414('0x18')]=_0x5ef5c5[_0x7414('0x18')]||undefined;return _0x4db562;};exports[_0x7414('0x4e')]=function(_0x4e0872,_0x587321){if(!_[_0x7414('0x11')](_0x4e0872)){if(_0x4e0872['pTalking']>0x0){_0x4e0872['pTalking']-=0x1;}else{logger[_0x7414('0x4')](_0x587321,_0x7414('0x4f'));}}else{logger[_0x7414('0x4')](_0x587321,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x7414('0x50')]=function(_0x13f030){if(_0x13f030<=0x0){return!![];}return![];};function buildObj(_0x310b18,_0x48450c,_0x23194f){_0x310b18[_0x7414('0x51')]=_0x48450c;_0x310b18[_0x7414('0x52')]=_0x310b18[_0x7414('0x53')];_0x310b18[_0x7414('0x54')]=_0x310b18[_0x7414('0x41')];_0x310b18[_0x7414('0x55')]=_0x7414('0x56');if(_0x23194f){_0x310b18[_0x7414('0x57')]=_0x23194f[_0x7414('0x57')];}return _0x310b18;}exports[_0x7414('0x58')]=buildObj;exports[_0x7414('0x59')]=function(_0x345205){var _0x2d72ff={};_0x2d72ff[_0x7414('0x53')]=_0x345205['queue'];_0x2d72ff[_0x7414('0x54')]=_0x345205[_0x7414('0x41')];_0x2d72ff[_0x7414('0x3f')]=_0x345205['uniqueid'];return _0x2d72ff;};exports[_0x7414('0x5a')]=function(_0x9faa4b){var _0x44433f=[];for(var _0x43d37e in _0x9faa4b){if(_0x9faa4b[_0x7414('0x26')](_0x43d37e)){if(!_[_0x7414('0x11')](_0x9faa4b[_0x43d37e])&&_0x9faa4b[_0x43d37e][_0x7414('0x32')]===_0x7414('0x5b')&&_0x9faa4b[_0x43d37e][_0x7414('0x5c')]===_0x7414('0x5d')){_0x44433f['push'](_0x9faa4b[_0x43d37e]['id']);}}}return _0x44433f;};exports['getDiff']=function(_0x19e4e8){var _0x13bb1f=moment()['milliseconds'](0x0);var _0x301204=moment(_0x19e4e8)['milliseconds'](0x0);return _0x13bb1f[_0x7414('0x5e')](_0x301204,'seconds');};exports[_0x7414('0x5f')]=function(_0x3c9c59){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c9c59[_0x7414('0x16')],'ListId':_0x3c9c59['ListId'],'VoiceQueueId':_0x3c9c59[_0x7414('0x18')]||undefined,'CampaignId':_0x3c9c59[_0x7414('0x60')]||undefined};};exports[_0x7414('0x61')]=function(_0x58f0c9){if(_0x58f0c9==='uniqueid'||_0x58f0c9===_0x7414('0x62')||_0x58f0c9===_0x7414('0x53')||_0x58f0c9===_0x7414('0x63')||_0x58f0c9===_0x7414('0x64')||_0x58f0c9==='dialAnswer'||_0x58f0c9===_0x7414('0x34')||_0x58f0c9==='channelAgent'||_0x58f0c9==='calleridname'||_0x58f0c9==='active'||_0x58f0c9===_0x7414('0x15')||_0x58f0c9==='scheduledat'||_0x58f0c9===_0x7414('0x44')||_0x58f0c9===_0x7414('0x45')||_0x58f0c9===_0x7414('0x46')||_0x58f0c9===_0x7414('0x65')||_0x58f0c9===_0x7414('0x66')||_0x58f0c9===_0x7414('0x67')||_0x58f0c9===_0x7414('0x68')||_0x58f0c9===_0x7414('0x69')||_0x58f0c9===_0x7414('0x16')||_0x58f0c9==='ListId'||_0x58f0c9===_0x7414('0x35')||_0x58f0c9===_0x7414('0x18')||_0x58f0c9===_0x7414('0x6a')||_0x58f0c9==='xmd-voicequeueid'||_0x58f0c9===_0x7414('0x6b')||_0x58f0c9===_0x7414('0x6c')||_0x58f0c9==='xmd-listid'||_0x58f0c9==='xmd-dialurl'||_0x58f0c9===_0x7414('0x6d')||_0x58f0c9===_0x7414('0x6e')||_0x58f0c9===_0x7414('0x6f')||_0x58f0c9==='xmd-dialchannel'||_0x58f0c9==='xmd-contactid'||_0x58f0c9===_0x7414('0x70')||_0x58f0c9==='xmd-callerid'||_0x58f0c9===_0x7414('0x71')||_0x58f0c9==='xmd-agi'||_0x58f0c9===_0x7414('0x72')||_0x58f0c9==='rtpaudioqosbridged'||_0x58f0c9===_0x7414('0x73')||_0x58f0c9===_0x7414('0x74')||_0x58f0c9==='rtpaudioqosloss'||_0x58f0c9===_0x7414('0x75')||_0x58f0c9==='rtpaudioqosrtt'||_0x58f0c9===_0x7414('0x76')||_0x58f0c9===_0x7414('0x72')||_0x58f0c9===_0x7414('0x77')||_0x58f0c9===_0x7414('0x73')||_0x58f0c9==='rtpaudioqosjitterbridged'||_0x58f0c9===_0x7414('0x78')||_0x58f0c9===_0x7414('0x75')||_0x58f0c9===_0x7414('0x79')||_0x58f0c9===_0x7414('0x76')||_0x58f0c9==='bridgepeer'||_0x58f0c9==='bridgepvtcallid'||_0x58f0c9===_0x7414('0x32')||_0x58f0c9==='statedesc'){return![];}return!![];};exports[_0x7414('0x7a')]=function(_0xf82ac9,_0x4944fc){var _0x57b8da,_0x4634a4,_0x313afe;if(_0x4944fc<=0x0){_0x4944fc=0x1;}_0x57b8da=new RegExp(_0x7414('0x7b')+_0x4944fc+'}$');_0x4634a4=Math[_0x7414('0x7c')](0xa,_0x4944fc-0x1);_0x313afe=Math[_0x7414('0x7c')](0xa,_0x4944fc)-0x1;return util[_0x7414('0xe')]('%s',_['replace'](_0xf82ac9,_0x57b8da,_[_0x7414('0x7d')](_0x4634a4,_0x313afe)));};exports[_0x7414('0x7e')]=function(_0x5c7a73){var _0x584b74=_0x5c7a73['match'](/"(.*?)"/);return _0x584b74?_0x584b74[0x1]:_0x5c7a73;};exports['extractCalleridNumber']=function(_0x3b4251){var _0x36550d=_0x3b4251[_0x7414('0x7f')](/<(.*?)>/);return _0x36550d?_0x36550d[0x1]:_0x3b4251;};function buildNoAnswerEventPayload(_0x1fb09a,_0x1eb24f){var _0x5bb0b9=buildObj(_0x1fb09a,_0x7414('0x80'));if(!_[_0x7414('0xc')](_0x1eb24f[_0x7414('0x81')])){Object[_0x7414('0x82')](_0x1eb24f['variables'])[_0x7414('0x83')](function(_0x5ebe03){_0x5bb0b9[_0x5ebe03[_0x7414('0x84')]()]=_0x1eb24f[_0x7414('0x81')][_0x5ebe03];});}return _0x5bb0b9;}exports[_0x7414('0x85')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c6e689b..f378ad7 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 _0x07e7=['number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x4c1416,_0x88993d){var _0x4c32a6=function(_0x46e85e){while(--_0x46e85e){_0x4c1416['push'](_0x4c1416['shift']());}};_0x4c32a6(++_0x88993d);}(_0x07e7,0xc6));var _0x707e=function(_0x3468ee,_0x52e62f){_0x3468ee=_0x3468ee-0x0;var _0x14ab38=_0x07e7[_0x3468ee];return _0x14ab38;};'use strict';exports[_0x707e('0x0')]={'queue':{'type':_0x707e('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x707e('0x1'),'required':!![]},'penalty':{'type':_0x707e('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x707e('0x3')]={'queue':{'type':_0x707e('0x1'),'required':!![]},'interface':{'type':_0x707e('0x1'),'required':!![]}};exports[_0x707e('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x707e('0x5')},'reason':{'type':_0x707e('0x1'),'required':![]}};exports[_0x707e('0x6')]={'module':{'type':_0x707e('0x1'),'required':![]}};exports[_0x707e('0x7')]={'uniqueid':{'type':_0x707e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x707e('0x1'),'required':!![]},'filename':{'type':_0x707e('0x1')},'format':{'type':_0x707e('0x1')},'mixmonitorid':{'type':_0x707e('0x1')}};exports[_0x707e('0x8')]={'uniqueid':{'type':_0x707e('0x1'),'required':!![]}};exports[_0x707e('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x707e('0x1'),'required':!![]},'context':{'type':_0x707e('0x1')}}; \ No newline at end of file +var _0xed6b=['string','number','boolean','queueremove','reload','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x1ed198,_0x27f904){var _0x42507d=function(_0x105311){while(--_0x105311){_0x1ed198['push'](_0x1ed198['shift']());}};_0x42507d(++_0x27f904);}(_0xed6b,0xd7));var _0xbed6=function(_0x21dbc5,_0x1b24ad){_0x21dbc5=_0x21dbc5-0x0;var _0x2c73d3=_0xed6b[_0x21dbc5];return _0x2c73d3;};'use strict';exports[_0xbed6('0x0')]={'queue':{'type':_0xbed6('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xbed6('0x2'),'required':![]},'paused':{'type':_0xbed6('0x3'),'required':![]}};exports[_0xbed6('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xbed6('0x1'),'required':!![]},'paused':{'type':_0xbed6('0x3')},'reason':{'type':_0xbed6('0x1'),'required':![]}};exports[_0xbed6('0x5')]={'module':{'type':_0xbed6('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbed6('0x1'),'required':!![]}};exports[_0xbed6('0x6')]={'uniqueid':{'type':_0xbed6('0x1'),'required':!![]},'filename':{'type':_0xbed6('0x1')},'format':{'type':_0xbed6('0x1')},'mixmonitorid':{'type':_0xbed6('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xbed6('0x1'),'required':!![]}};exports[_0xbed6('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbed6('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 21c12ab..d73ebae 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x252052,_0x98d6b3){var _0x2272f5=function(_0x2bc77e){while(--_0x2bc77e){_0x252052['push'](_0x252052['shift']());}};_0x2272f5(++_0x98d6b3);}(_0xadb5,0xad));var _0x5adb=function(_0x3e8426,_0xbabdae){_0x3e8426=_0x3e8426-0x0;var _0x3960fd=_0xadb5[_0x3e8426];return _0x3960fd;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x5b7292,_0x96d5e){var _0x3fdee8=function(_0x3a9c26){while(--_0x3a9c26){_0x5b7292['push'](_0x5b7292['shift']());}};_0x3fdee8(++_0x96d5e);}(_0xb10b,0x12a));var _0xbb10=function(_0xf2d1bf,_0x19c53a){_0xf2d1bf=_0xf2d1bf-0x0;var _0x388d2c=_0xb10b[_0xf2d1bf];return _0x388d2c;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e0672cf..26d2a5b 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc691=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc691,0xcf));var _0x1c69=function(_0x550dad,_0x4c8c04){_0x550dad=_0x550dad-0x0;var _0x1891db=_0xc691[_0x550dad];return _0x1891db;};'use strict';function mergeDBDataToRealtime(_0x5a0b8b,_0x4cc2af){var _0x5723a0=Object[_0x1c69('0x0')]({},_0x5a0b8b);for(var _0x2b4478 in _0x4cc2af){if(_0x5723a0[_0x1c69('0x1')](_0x2b4478)){_0x5723a0[_0x2b4478]=_0x4cc2af[_0x2b4478];}}return _0x5723a0;}exports[_0x1c69('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x7819=['mergeDBDataToRealtime'];(function(_0x1beecb,_0x129401){var _0xb73656=function(_0x470a2b){while(--_0x470a2b){_0x1beecb['push'](_0x1beecb['shift']());}};_0xb73656(++_0x129401);}(_0x7819,0x154));var _0x9781=function(_0x2339f2,_0x382c70){_0x2339f2=_0x2339f2-0x0;var _0x59c289=_0x7819[_0x2339f2];return _0x59c289;};'use strict';function mergeDBDataToRealtime(_0xa86caa,_0xc95520){var _0x2a2332=Object['assign']({},_0xa86caa);for(var _0x4b336d in _0xc95520){if(_0x2a2332['hasOwnProperty'](_0x4b336d)){_0x2a2332[_0x4b336d]=_0xc95520[_0x4b336d];}}return _0x2a2332;}exports[_0x9781('0x0')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 185a292..3e5d863 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 _0xf1c6=['split','outbound','internal','voiceCallReport','destination','exten','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','uniqueid','transfers','type','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinenum','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','format','SIP/%s','length','assigned','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','keys','getCallType','channel'];(function(_0xee7aab,_0xf913fa){var _0x4662aa=function(_0x3b579e){while(--_0x3b579e){_0xee7aab['push'](_0xee7aab['shift']());}};_0x4662aa(++_0xf913fa);}(_0xf1c6,0x1ac));var _0x6f1c=function(_0x33c407,_0x3fe3b5){_0x33c407=_0x33c407-0x0;var _0x1f7d03=_0xf1c6[_0x33c407];return _0x1f7d03;};'use strict';var _=require(_0x6f1c('0x0'));var moment=require(_0x6f1c('0x1'));var util=require(_0x6f1c('0x2'));var config=require(_0x6f1c('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x6f1c('0x4'));var RpcVoiceCallReport=require(_0x6f1c('0x5'));var RpcVoiceDialReport=require(_0x6f1c('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x6f1c('0x7'));var RpcVoiceRecording=require(_0x6f1c('0x8'));var RpcVoiceTransferReport=require(_0x6f1c('0x9'));var VoiceQueueReport=require(_0x6f1c('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x6f1c('0xb'));var UserReport=require(_0x6f1c('0xc'));function Report(_0x16d5d7){this[_0x6f1c('0xd')]=_0x16d5d7;this[_0x6f1c('0xe')]=_0x16d5d7['agents'];this[_0x6f1c('0xf')]=_0x16d5d7['telephones'];}Report[_0x6f1c('0x10')][_0x6f1c('0x11')]=function(_0x3c4670){var _0x2a4fe5=new VoiceQueueReport(this[_0x6f1c('0xd')]);var _0x34cada=new VoiceAgentReport(this[_0x6f1c('0xd')]);var _0x322a01=new VoiceDialReport(this['realtime']);var _0x261089=new VoiceCallReport(this['realtime']);var _0x1dfd0c=new UserReport(this[_0x6f1c('0xd')]);if(config[_0x6f1c('0x12')]&&config[_0x6f1c('0x12')][_0x6f1c('0x13')]){ami['on'](_0x6f1c('0x14'),this['voiceQueueReport']['bind'](this));ami['on'](_0x6f1c('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0x6f1c('0x16'),this[_0x6f1c('0x17')][_0x6f1c('0x18')](this));ami['on'](_0x6f1c('0x19'),this[_0x6f1c('0x1a')]['bind'](this));ami['on']('blindtransfer',this[_0x6f1c('0x1b')][_0x6f1c('0x18')](this));ami['on'](_0x6f1c('0x1c'),this[_0x6f1c('0x1d')][_0x6f1c('0x18')](this));}};Report[_0x6f1c('0x10')][_0x6f1c('0x1e')]=function(_0xa0d32f){var _0xa2df25;_0xa2df25=_[_0x6f1c('0x1f')](this[_0x6f1c('0xe')],function(_0x45bccd){return _0x45bccd[_0x6f1c('0x20')]==_0xa0d32f||_0x45bccd['name']==_0xa0d32f;});if(_[_0x6f1c('0x21')](_0xa2df25)){var _0x134adf=_[_0x6f1c('0x1f')](this[_0x6f1c('0xf')],function(_0x93888f){return _0x93888f[_0x6f1c('0x20')]==_0xa0d32f||_0x93888f[_0x6f1c('0x22')]==_0xa0d32f;});if(_0x134adf){_0xa2df25=_[_0x6f1c('0x1f')](this[_0x6f1c('0xe')],function(_0x5c05f9){return _0x5c05f9['interface']==util[_0x6f1c('0x23')](_0x6f1c('0x24'),_0x134adf[_0x6f1c('0x22')]);});}}return _0xa2df25;};Report[_0x6f1c('0x10')]['voiceQueueReport']=function(_0x3c28fb){for(var _0x4d7b9e=0x0;_0x4d7b9e<_0x3c28fb[_0x6f1c('0x25')];_0x4d7b9e+=0x1){var _0x16a647=this['findAgent'](_0x3c28fb[_0x4d7b9e]['connectedlinenum']);if(_0x16a647){_0x3c28fb[_0x4d7b9e][_0x6f1c('0x20')]=_0x16a647['accountcode'];_0x3c28fb[_0x4d7b9e][_0x6f1c('0x26')]=!![];_0x3c28fb[_0x4d7b9e]['lastAssignedTo']=_0x16a647[_0x6f1c('0x22')];_0x3c28fb[_0x4d7b9e][_0x6f1c('0x27')]=_[_0x6f1c('0x21')](_0x16a647[_0x6f1c('0x27')])?util['format']('SIP/%s',_0x16a647[_0x6f1c('0x22')]):_0x16a647['interface'];if(_0x3c28fb[_0x4d7b9e][_0x6f1c('0x28')]){_0x3c28fb[_0x4d7b9e][_0x6f1c('0x29')]=moment()[_0x6f1c('0x23')](_0x6f1c('0x2a'));}if(_0x3c28fb[_0x4d7b9e][_0x6f1c('0x2b')]){_0x3c28fb[_0x4d7b9e][_0x6f1c('0x2c')]=moment()['format'](_0x6f1c('0x2a'));}RpcMemberReport[_0x6f1c('0x2d')](_0x3c28fb[_0x4d7b9e]);}RpcVoiceQueueReport[_0x6f1c('0x2e')](_0x3c28fb[_0x4d7b9e]);}};function extractCalleridNumber(_0x33b093){var _0x182a20=_0x33b093[_0x6f1c('0x2f')](/<(.*?)>/);return _0x182a20?_0x182a20[0x1]:_0x33b093;}Report[_0x6f1c('0x10')][_0x6f1c('0x30')]=function(_0x5502df){for(var _0x2838af=0x0;_0x2838af','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','membername','monitor','monitors','filename','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','voiceCallReport','dialer','lastapplication','queue','from-voip-provider','destination','context','calleridpreview','originatecalleridnum','destinationchannel','callerid','disposition','connectedlinenum'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0xbcf9,0xda));var _0x9bcf=function(_0x2e1a3c,_0x55d6ee){_0x2e1a3c=_0x2e1a3c-0x0;var _0x472cff=_0xbcf9[_0x2e1a3c];return _0x472cff;};'use strict';var _=require(_0x9bcf('0x0'));var moment=require(_0x9bcf('0x1'));var util=require(_0x9bcf('0x2'));var config=require(_0x9bcf('0x3'));var ami=require(_0x9bcf('0x4'));var RpcVoiceAgentReport=require(_0x9bcf('0x5'));var RpcVoiceCallReport=require(_0x9bcf('0x6'));var RpcVoiceDialReport=require(_0x9bcf('0x7'));var RpcMemberReport=require(_0x9bcf('0x8'));var RpcVoiceQueueReport=require(_0x9bcf('0x9'));var RpcVoiceRecording=require(_0x9bcf('0xa'));var RpcVoiceTransferReport=require(_0x9bcf('0xb'));var VoiceQueueReport=require(_0x9bcf('0xc'));var VoiceCallReport=require(_0x9bcf('0xd'));var VoiceAgentReport=require(_0x9bcf('0xe'));var VoiceDialReport=require(_0x9bcf('0xf'));var UserReport=require(_0x9bcf('0x10'));function Report(_0x3ce233){this[_0x9bcf('0x11')]=_0x3ce233;this[_0x9bcf('0x12')]=_0x3ce233[_0x9bcf('0x12')];this[_0x9bcf('0x13')]=_0x3ce233[_0x9bcf('0x13')];}Report[_0x9bcf('0x14')][_0x9bcf('0x15')]=function(_0x25a029){var _0x2699c2=new VoiceQueueReport(this[_0x9bcf('0x11')]);var _0x5cc114=new VoiceAgentReport(this[_0x9bcf('0x11')]);var _0x472925=new VoiceDialReport(this['realtime']);var _0x3522fa=new VoiceCallReport(this[_0x9bcf('0x11')]);var _0x36dc58=new UserReport(this[_0x9bcf('0x11')]);if(config['xdr']&&config['xdr'][_0x9bcf('0x16')]){ami['on']('custom:voiceQueueReport',this[_0x9bcf('0x17')][_0x9bcf('0x18')](this));ami['on'](_0x9bcf('0x19'),this['voiceCallReport']['bind'](this));ami['on'](_0x9bcf('0x1a'),this[_0x9bcf('0x1b')]['bind'](this));ami['on'](_0x9bcf('0x1c'),this['voiceDialReport']['bind'](this));ami['on'](_0x9bcf('0x1d'),this['blindTransfer'][_0x9bcf('0x18')](this));ami['on'](_0x9bcf('0x1e'),this[_0x9bcf('0x1f')][_0x9bcf('0x18')](this));}};Report[_0x9bcf('0x14')][_0x9bcf('0x20')]=function(_0x516896){var _0xc43168;_0xc43168=_[_0x9bcf('0x21')](this['agents'],function(_0x2d94a5){return _0x2d94a5['accountcode']==_0x516896||_0x2d94a5[_0x9bcf('0x22')]==_0x516896;});if(_[_0x9bcf('0x23')](_0xc43168)){var _0x502308=_[_0x9bcf('0x21')](this[_0x9bcf('0x13')],function(_0x1a30db){return _0x1a30db[_0x9bcf('0x24')]==_0x516896||_0x1a30db[_0x9bcf('0x22')]==_0x516896;});if(_0x502308){_0xc43168=_[_0x9bcf('0x21')](this[_0x9bcf('0x12')],function(_0x4a63e3){return _0x4a63e3[_0x9bcf('0x25')]==util[_0x9bcf('0x26')](_0x9bcf('0x27'),_0x502308[_0x9bcf('0x22')]);});}}return _0xc43168;};Report[_0x9bcf('0x14')][_0x9bcf('0x17')]=function(_0x54b8df){for(var _0x2aceef=0x0;_0x2aceef<_0x54b8df[_0x9bcf('0x28')];_0x2aceef+=0x1){var _0x962f9e=this[_0x9bcf('0x20')](_0x54b8df[_0x2aceef]['connectedlinenum']);if(_0x962f9e){_0x54b8df[_0x2aceef][_0x9bcf('0x24')]=_0x962f9e['accountcode'];_0x54b8df[_0x2aceef][_0x9bcf('0x29')]=!![];_0x54b8df[_0x2aceef][_0x9bcf('0x2a')]=_0x962f9e[_0x9bcf('0x22')];_0x54b8df[_0x2aceef][_0x9bcf('0x25')]=_[_0x9bcf('0x23')](_0x962f9e[_0x9bcf('0x25')])?util['format'](_0x9bcf('0x27'),_0x962f9e[_0x9bcf('0x22')]):_0x962f9e['interface'];if(_0x54b8df[_0x2aceef][_0x9bcf('0x2b')]){_0x54b8df[_0x2aceef][_0x9bcf('0x2c')]=moment()[_0x9bcf('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x54b8df[_0x2aceef]['queuecallerexit']){_0x54b8df[_0x2aceef][_0x9bcf('0x2d')]=moment()[_0x9bcf('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x54b8df[_0x2aceef]);}RpcVoiceQueueReport[_0x9bcf('0x2e')](_0x54b8df[_0x2aceef]);}};function extractCalleridNumber(_0x48be85){var _0x3fd4ff=_0x48be85[_0x9bcf('0x2f')](/<(.*?)>/);return _0x3fd4ff?_0x3fd4ff[0x1]:_0x48be85;}Report[_0x9bcf('0x14')][_0x9bcf('0x30')]=function(_0x2ed022){for(var _0x515142=0x0;_0x5151420x0?!![]:![];if(!_0xfab8c0){return this['syncQueueSummaryComplete'](this[_0xb07b('0x16')][_0xb07b('0x70')]);}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x71')]=function(_0x14a175){var _0x3c9911=this['summary']['id'];if(this['summary'][_0xb07b('0x64')][_0x3c9911]&&this[_0xb07b('0x16')][_0xb07b('0x64')][_0x3c9911][_0x14a175['actionid']]){this[_0xb07b('0x16')][_0xb07b('0x64')][_0x3c9911][_0x14a175[_0xb07b('0x65')]]['agents'][_0xb07b('0x72')](_0x14a175);}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x19')]=function(_0x5228af){var _0x48d384=this;try{if(this[_0xb07b('0x5e')](_0x5228af)&&this[_0xb07b('0x5e')](_0x5228af[_0xb07b('0x57')])){logger[_0xb07b('0x51')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x5228af,{'showHidden':![],'depth':null}));var _0x1b48ab=this[_0xb07b('0x14')][_0x5228af['queue']];if(_0x1b48ab){logger[_0xb07b('0x51')](_0xb07b('0x73'),_0x1b48ab[_0xb07b('0x68')]);this['summary'][_0xb07b('0x62')][_0x1b48ab['name']]={'summaryEvent':_0x5228af};this['summary'][_0xb07b('0x6f')]+=0x1;return ami[_0xb07b('0x41')]({'action':'queuestatus','queue':_0x1b48ab[_0xb07b('0x68')]})['then'](function(_0x502d12){if(!_0x48d384[_0xb07b('0x16')][_0xb07b('0x64')][_0x5228af[_0xb07b('0x65')]]){_0x48d384['summary'][_0xb07b('0x64')][_0x5228af[_0xb07b('0x65')]]={};}_0x48d384['summary'][_0xb07b('0x64')][_0x5228af[_0xb07b('0x65')]][_0x502d12['actionid']]={'queue':_0x1b48ab['name'],'agents':[]};})[_0xb07b('0x44')](function(_0xc9346a){throw _0xc9346a;});}}}catch(_0x5d306a){logger[_0xb07b('0x47')](_0xb07b('0x66'),util[_0xb07b('0x48')](_0x5d306a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x1c')]=function(_0xac40da){if(this['summary'][_0xb07b('0x6f')]>0x0){this[_0xb07b('0x16')][_0xb07b('0x70')]=_0xac40da;return;}logger[_0xb07b('0x51')](_0xb07b('0x74'),util[_0xb07b('0x48')](_0xac40da,{'showHidden':![],'depth':null}));this[_0xb07b('0x16')]=initializeSummary();ami[_0xb07b('0x4f')](_0xb07b('0x75'),{});};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x76')]=function(_0x395201){try{if(this[_0xb07b('0x5e')](_0x395201)){logger[_0xb07b('0x51')]('[%s][voiceQueueReport][queuecallerjoin]',_0x395201['uniqueid'],util[_0xb07b('0x48')](_0x395201,{'showHidden':![],'depth':null}));if(_[_0xb07b('0x5f')](this[_0xb07b('0x10')][_0x395201['uniqueid']])){this['queueReports'][_0x395201['uniqueid']]=[];}if(_[_0xb07b('0x5f')](this[_0xb07b('0x3d')][_0x395201[_0xb07b('0x54')]])){this[_0xb07b('0x3d')][_0x395201[_0xb07b('0x54')]]={};}var _0x5340b8=new QueueReport();_0x5340b8['queue']=_0x395201[_0xb07b('0x57')];_0x5340b8[_0xb07b('0x5a')]=this[_0xb07b('0x14')][_0x5340b8[_0xb07b('0x57')]]&&this['voiceQueues'][_0x5340b8[_0xb07b('0x57')]][_0xb07b('0x5a')]?this[_0xb07b('0x14')][_0x5340b8[_0xb07b('0x57')]]['type']||'inbound':_0xb07b('0x5b');_0x5340b8[_0xb07b('0x77')]=moment()['format'](_0xb07b('0x78'));_0x5340b8['position']=_0x395201['position'];_0x5340b8[_0xb07b('0x79')]=_0x395201['count'];_0x5340b8[_0xb07b('0x54')]=_0x395201['uniqueid'];_0x5340b8[_0xb07b('0x7a')]=this[_0xb07b('0x3d')][_0x395201[_0xb07b('0x54')]][_0xb07b('0x7a')];logger[_0xb07b('0x7b')](_0xb07b('0x7c'),_0x5340b8[_0xb07b('0x57')],_0x5340b8['type']);Object[_0xb07b('0x6c')](_0x5340b8,_[_0xb07b('0x7d')](_0x395201,_[_0xb07b('0x7e')](_0x5340b8)));this['queueReports'][_0x395201[_0xb07b('0x54')]][_0xb07b('0x72')](_0x5340b8);this[_0xb07b('0x3d')][_0x395201[_0xb07b('0x54')]]=_0x5340b8;this[_0xb07b('0x50')](_0x5340b8,_0xb07b('0x20'));}}catch(_0xd52387){logger[_0xb07b('0x47')](_0xb07b('0x7f'),_0x395201['uniqueid'],util[_0xb07b('0x48')](_0xd52387,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x22')]=function(_0x133089){try{if(this[_0xb07b('0x5e')](_0x133089)){logger[_0xb07b('0x51')](_0xb07b('0x80'),_0x133089[_0xb07b('0x54')],util[_0xb07b('0x48')](_0x133089,{'showHidden':![],'depth':null}));if(this[_0xb07b('0x10')][_0x133089[_0xb07b('0x54')]]){var _0x2d5cc3=_['last'](this['queueReports'][_0x133089['uniqueid']]);_0x2d5cc3[_0xb07b('0x3c')]=![];_0x2d5cc3[_0xb07b('0x81')]=null;_0x2d5cc3[_0xb07b('0x82')]=_0x133089[_0xb07b('0x82')];_0x2d5cc3[_0xb07b('0x83')]=_0x133089['originalposition'];_0x2d5cc3['queuecallerabandon']=!![];_0x2d5cc3[_0xb07b('0x84')]=moment()[_0xb07b('0x56')](_0xb07b('0x78'));_0x2d5cc3[_0xb07b('0x85')]='ABANDONED';_0x2d5cc3['lastAssignedTo']=null;logger[_0xb07b('0x7b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2d5cc3[_0xb07b('0x57')],_0x2d5cc3[_0xb07b('0x5a')]);this[_0xb07b('0x3d')][_0x133089['uniqueid']]=_0x2d5cc3;this[_0xb07b('0x4d')](_0x2d5cc3,_0xb07b('0x21'));}}}catch(_0x31019b){logger[_0xb07b('0x47')](_0xb07b('0x80'),_0x133089[_0xb07b('0x54')],util['inspect'](_0x31019b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0x24')]=function(_0x481082){try{if(this[_0xb07b('0x5e')](_0x481082)){logger[_0xb07b('0x51')](_0xb07b('0x86'),_0x481082[_0xb07b('0x54')],util[_0xb07b('0x48')](_0x481082,{'showHidden':![],'depth':null}));if(this[_0xb07b('0x10')][_0x481082[_0xb07b('0x54')]]){var _0x2985f7=_[_0xb07b('0x87')](this['queueReports'][_0x481082['uniqueid']]);_0x2985f7['queuecallerleaveAt']=moment()[_0xb07b('0x56')](_0xb07b('0x78'));_0x2985f7['connectedlinenum']=_0x481082[_0xb07b('0x88')];_0x2985f7[_0xb07b('0x89')]=_0x481082[_0xb07b('0x89')];logger[_0xb07b('0x7b')](_0xb07b('0x8a'),_0x2985f7[_0xb07b('0x57')],_0x2985f7[_0xb07b('0x5a')],_0x481082[_0xb07b('0x88')],_0x481082[_0xb07b('0x89')]);this[_0xb07b('0x3d')][_0x481082[_0xb07b('0x54')]]=_0x2985f7;this[_0xb07b('0x50')](_0x2985f7,_0xb07b('0x23'));}}}catch(_0x81af4){logger[_0xb07b('0x47')](_0xb07b('0x86'),_0x481082[_0xb07b('0x54')],util['inspect'](_0x81af4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')]['syncAgentConnect']=function(_0x37fcd5){try{if(this[_0xb07b('0x5e')](_0x37fcd5)){logger['debug'](_0xb07b('0x8b'),_0x37fcd5[_0xb07b('0x54')],util['inspect'](_0x37fcd5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x37fcd5['uniqueid']]){var _0xa1496=_[_0xb07b('0x87')](this['queueReports'][_0x37fcd5[_0xb07b('0x54')]]);_0xa1496[_0xb07b('0x3c')]=!![];_0xa1496[_0xb07b('0x85')]=_0xb07b('0x8c');logger[_0xb07b('0x7b')](_0xb07b('0x8d'),_0xa1496[_0xb07b('0x57')],_0xa1496[_0xb07b('0x5a')]);}}}catch(_0xcdb0ed){logger[_0xb07b('0x47')](_0xb07b('0x8b'),_0x37fcd5[_0xb07b('0x54')],util[_0xb07b('0x48')](_0xcdb0ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')]['syncAgentComplete']=function(_0x450f20){try{if(this[_0xb07b('0x5e')](_0x450f20)){logger['debug'](_0xb07b('0x8e'),_0x450f20[_0xb07b('0x54')],util['inspect'](_0x450f20,{'showHidden':![],'depth':null}));if(this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x54')]]){var _0x2ee6aa=_['last'](this['queueReports'][_0x450f20[_0xb07b('0x54')]]);_0x2ee6aa['queuecallerabandon']=![];_0x2ee6aa[_0xb07b('0x84')]=null;_0x2ee6aa[_0xb07b('0x8f')]=!![];_0x2ee6aa[_0xb07b('0x90')]=_0x450f20[_0xb07b('0x91')];_0x2ee6aa[_0xb07b('0x82')]=_0x450f20[_0xb07b('0x82')];_0x2ee6aa[_0xb07b('0x3c')]=!![];_0x2ee6aa['queuecallerexit']=![];_0x2ee6aa[_0xb07b('0x92')]=null;if(!_0x2ee6aa[_0xb07b('0x93')]){if(_0x450f20[_0xb07b('0x94')]==_0xb07b('0x93')){_0x2ee6aa[_0xb07b('0x85')]=_0xb07b('0x95');logger[_0xb07b('0x7b')](_0xb07b('0x96'),_0x2ee6aa['queue'],_0x2ee6aa[_0xb07b('0x5a')]);}else{if(_[_0xb07b('0x97')](_0x450f20['channel']['toLowerCase'](),_0xb07b('0x98'))){if(this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x99')]]){var _0x78fd43=_[_0xb07b('0x87')](this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x99')]]);_0x78fd43['queuecallercomplete']=![];_0x78fd43[_0xb07b('0x3b')]=!![];_0x78fd43[_0xb07b('0x92')]=moment(_0x2ee6aa['queuecallerjoinAt'])[_0xb07b('0x9a')](_0x450f20[_0xb07b('0x82')],_0xb07b('0x9b'))['format'](_0xb07b('0x78'));_0x78fd43[_0xb07b('0x85')]=_0xb07b('0x9c');_0x78fd43['transfer']=!![];_0x78fd43[_0xb07b('0x9d')]='FORWARD';_0x78fd43[_0xb07b('0x9e')]=_0x450f20[_0xb07b('0x9f')];_0x78fd43[_0xb07b('0xa0')]=_0x450f20[_0xb07b('0x54')];logger[_0xb07b('0x7b')](_0xb07b('0xa1'),_0x78fd43[_0xb07b('0x57')],_0x78fd43['type']);var _0x302b7b=this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x99')]];this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x99')]]=this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x54')]];this[_0xb07b('0x10')][_0x450f20[_0xb07b('0x54')]]=_0x302b7b;}}else{_0x2ee6aa[_0xb07b('0x85')]=_0xb07b('0xa2')+_0x450f20[_0xb07b('0x94')][_0xb07b('0xa3')]();logger[_0xb07b('0x7b')](_0xb07b('0xa4'),_0x2ee6aa[_0xb07b('0x57')],_0x2ee6aa['type'],_0x2ee6aa[_0xb07b('0x85')]);}}}this[_0xb07b('0x3d')][_0x450f20['uniqueid']]=_0x2ee6aa;}}}catch(_0x521093){logger[_0xb07b('0x47')](_0xb07b('0x8e'),_0x450f20[_0xb07b('0x54')],util['inspect'](_0x521093,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0xa5')]=function(_0x45c865){try{if(this[_0xb07b('0x5e')](_0x45c865)){logger['debug'](_0xb07b('0xa6'),_0x45c865[_0xb07b('0x54')],util['inspect'](_0x45c865,{'showHidden':![],'depth':null}));this[_0xb07b('0xa7')](_0x45c865[_0xb07b('0x54')],_[_0xb07b('0x7e')](_0x45c865[_0xb07b('0xa8')])[0x0],_0x45c865[_0xb07b('0xa9')]);if(this[_0xb07b('0x10')][_0x45c865[_0xb07b('0x54')]]){var _0x41c339=_[_0xb07b('0x87')](this[_0xb07b('0x10')][_0x45c865[_0xb07b('0x54')]]);if(_0x41c339){if(this[_0xb07b('0x5e')](_0x45c865[_0xb07b('0xa8')])&&this[_0xb07b('0x5e')](_0x45c865[_0xb07b('0xa8')][_0xb07b('0x64')])){switch(_0x45c865['value']){case'CONTINUE':_0x41c339['queuecallerexit']=![];_0x41c339['queuecallerexitAt']=null;break;case _0xb07b('0xaa'):_0x41c339[_0xb07b('0xab')]='timeout';_0x41c339['queuecallerexit']=!![];_0x41c339['queuecallerexitAt']=moment()[_0xb07b('0x56')](_0xb07b('0x78'));_0x41c339[_0xb07b('0xac')]=moment()[_0xb07b('0x56')](_0xb07b('0x78'));logger[_0xb07b('0x51')](_0xb07b('0xad'),_0x45c865[_0xb07b('0x54')],util[_0xb07b('0x48')](_0x41c339,{'showHidden':![],'depth':null}));ami['emit'](_0xb07b('0xae'),_0x41c339);break;default:_0x41c339[_0xb07b('0x3b')]=!![];_0x41c339[_0xb07b('0x92')]=moment()[_0xb07b('0x56')](_0xb07b('0x78'));_0x41c339[_0xb07b('0xac')]=moment()[_0xb07b('0x56')](_0xb07b('0x78'));}_0x41c339[_0xb07b('0x21')]=![];_0x41c339[_0xb07b('0x84')]=null;_0x41c339[_0xb07b('0x85')]=_0x45c865[_0xb07b('0xa9')];this['channels'][_0x45c865[_0xb07b('0x54')]]=_0x41c339;this[_0xb07b('0x4d')](_0x41c339,_0xb07b('0x28'));}else if(this['isNotNull'](_0x45c865[_0xb07b('0xa8')])&&this[_0xb07b('0x5e')](_0x45c865[_0xb07b('0xa8')][_0xb07b('0xaf')])){if(!_0x41c339[_0xb07b('0x21')]){_0x41c339[_0xb07b('0x3b')]=!![];_0x41c339[_0xb07b('0x92')]=moment()[_0xb07b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x41c339['queuecallerexitreason']='EXITWITHKEY';_0x41c339[_0xb07b('0xac')]=moment()[_0xb07b('0x56')](_0xb07b('0x78'));this[_0xb07b('0x3d')][_0x45c865[_0xb07b('0x54')]]=_0x41c339;}}logger[_0xb07b('0x7b')](_0xb07b('0xb0'),_0x45c865[_0xb07b('0x54')],_0x41c339[_0xb07b('0x57')],_0x41c339[_0xb07b('0x5a')],_[_0xb07b('0x7e')](_0x45c865[_0xb07b('0xa8')])[0x0],_0x45c865[_0xb07b('0xa9')]);_0x41c339['variables']=this[_0xb07b('0x17')][_0x45c865[_0xb07b('0x54')]];}}}}catch(_0x3f9f5c){logger[_0xb07b('0x47')](_0xb07b('0xa6'),_0x45c865[_0xb07b('0x54')],util[_0xb07b('0x48')](_0x3f9f5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb07b('0xc')][_0xb07b('0xa7')]=function(_0x2db025,_0x1c4a7e,_0x42b79f){var _0x2db48f=[_0xb07b('0xb1'),'rtpaudioqosbridged',_0xb07b('0xb2'),_0xb07b('0xb3'),'rtpaudioqosloss',_0xb07b('0xb4'),_0xb07b('0xb5'),'rtpaudioqosrttbridged',_0xb07b('0xb6'),_0xb07b('0xb7'),_0xb07b('0xb8'),'bridgepvtcallid','membercalls',_0xb07b('0xb9'),'memberinterface',_0xb07b('0xba'),_0xb07b('0x91'),'memberpenalty',_0xb07b('0xbb')];if(!_['isNil'](_0x1c4a7e)&&!_['includes'](_0x2db48f,_0x1c4a7e)){if(_[_0xb07b('0x5f')](this[_0xb07b('0x17')][_0x2db025])){this[_0xb07b('0x17')][_0x2db025]={};}this[_0xb07b('0x17')][_0x2db025][_0x1c4a7e]=_0x42b79f;}};VoiceQueueReport['prototype'][_0xb07b('0xbc')]=function(_0x46a89c,_0x33d027,_0x563b96){try{var _0xf8c94f={};if(this[_0xb07b('0x10')][_0x46a89c]){for(var _0x4cdf2d=0x0;_0x4cdf2d0x0?!![]:![];if(!_0x56c57e){return this[_0x43af('0x18')](this['summary']['completeEvent']);}};VoiceQueueReport['prototype'][_0x43af('0x1a')]=function(_0x15beee){var _0x21172e=this['summary']['id'];if(this['summary'][_0x43af('0x67')][_0x21172e]&&this[_0x43af('0x12')][_0x43af('0x67')][_0x21172e][_0x15beee[_0x43af('0x6f')]]){this[_0x43af('0x12')][_0x43af('0x67')][_0x21172e][_0x15beee[_0x43af('0x6f')]][_0x43af('0xd')][_0x43af('0x72')](_0x15beee);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x1f90f4){var _0x3ecd03=this;try{if(this[_0x43af('0x60')](_0x1f90f4)&&this[_0x43af('0x60')](_0x1f90f4[_0x43af('0x52')])){logger[_0x43af('0x54')](_0x43af('0x73'),util[_0x43af('0x45')](_0x1f90f4,{'showHidden':![],'depth':null}));var _0x1925ff=this[_0x43af('0x10')][_0x1f90f4['queue']];if(_0x1925ff){logger[_0x43af('0x54')](_0x43af('0x74'),_0x1925ff[_0x43af('0x5e')]);this[_0x43af('0x12')][_0x43af('0x63')][_0x1925ff[_0x43af('0x5e')]]={'summaryEvent':_0x1f90f4};this[_0x43af('0x12')][_0x43af('0x71')]+=0x1;return ami[_0x43af('0x3f')]({'action':_0x43af('0x67'),'queue':_0x1925ff['name']})[_0x43af('0x65')](function(_0x1c7aee){if(!_0x3ecd03['summary'][_0x43af('0x67')][_0x1f90f4[_0x43af('0x6f')]]){_0x3ecd03[_0x43af('0x12')]['queuestatus'][_0x1f90f4[_0x43af('0x6f')]]={};}_0x3ecd03[_0x43af('0x12')][_0x43af('0x67')][_0x1f90f4[_0x43af('0x6f')]][_0x1c7aee[_0x43af('0x6f')]]={'queue':_0x1925ff[_0x43af('0x5e')],'agents':[]};})[_0x43af('0x42')](function(_0x1b22ee){throw _0x1b22ee;});}}}catch(_0x40c8b9){logger[_0x43af('0x46')](_0x43af('0x68'),util[_0x43af('0x45')](_0x40c8b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x43af('0x49')][_0x43af('0x18')]=function(_0x5a51c3){if(this['summary'][_0x43af('0x71')]>0x0){this['summary'][_0x43af('0x75')]=_0x5a51c3;return;}logger['debug'](_0x43af('0x76'),util['inspect'](_0x5a51c3,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x43af('0x4d')](_0x43af('0x77'),{});};VoiceQueueReport[_0x43af('0x49')][_0x43af('0x1e')]=function(_0x2ba33b){try{if(this[_0x43af('0x60')](_0x2ba33b)){logger[_0x43af('0x54')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2ba33b[_0x43af('0x51')],util[_0x43af('0x45')](_0x2ba33b,{'showHidden':![],'depth':null}));if(_[_0x43af('0x61')](this[_0x43af('0xb')][_0x2ba33b[_0x43af('0x51')]])){this['queueReports'][_0x2ba33b[_0x43af('0x51')]]=[];}if(_['isUndefined'](this[_0x43af('0xe')][_0x2ba33b[_0x43af('0x51')]])){this[_0x43af('0xe')][_0x2ba33b[_0x43af('0x51')]]={};}var _0x13c30a=new QueueReport();_0x13c30a[_0x43af('0x52')]=_0x2ba33b['queue'];_0x13c30a[_0x43af('0x5a')]=this[_0x43af('0x10')][_0x13c30a[_0x43af('0x52')]]&&this[_0x43af('0x10')][_0x13c30a[_0x43af('0x52')]]['type']?this[_0x43af('0x10')][_0x13c30a[_0x43af('0x52')]][_0x43af('0x5a')]||'inbound':_0x43af('0x5b');_0x13c30a[_0x43af('0x78')]=moment()['format'](_0x43af('0x79'));_0x13c30a[_0x43af('0x7a')]=_0x2ba33b[_0x43af('0x7a')];_0x13c30a[_0x43af('0x7b')]=_0x2ba33b[_0x43af('0x7b')];_0x13c30a[_0x43af('0x51')]=_0x2ba33b['uniqueid'];_0x13c30a['routealias']=this[_0x43af('0xe')][_0x2ba33b[_0x43af('0x51')]][_0x43af('0x7c')];logger[_0x43af('0x7d')](_0x43af('0x7e'),_0x13c30a[_0x43af('0x52')],_0x13c30a[_0x43af('0x5a')]);Object['assign'](_0x13c30a,_['pick'](_0x2ba33b,_[_0x43af('0x7f')](_0x13c30a)));this[_0x43af('0xb')][_0x2ba33b[_0x43af('0x51')]][_0x43af('0x72')](_0x13c30a);this[_0x43af('0xe')][_0x2ba33b[_0x43af('0x51')]]=_0x13c30a;this[_0x43af('0x4e')](_0x13c30a,_0x43af('0x1d'));}}catch(_0x49339b){logger[_0x43af('0x46')](_0x43af('0x80'),_0x2ba33b['uniqueid'],util[_0x43af('0x45')](_0x49339b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x43af('0x49')][_0x43af('0x20')]=function(_0x4bc094){try{if(this[_0x43af('0x60')](_0x4bc094)){logger[_0x43af('0x54')](_0x43af('0x81'),_0x4bc094['uniqueid'],util[_0x43af('0x45')](_0x4bc094,{'showHidden':![],'depth':null}));if(this[_0x43af('0xb')][_0x4bc094['uniqueid']]){var _0x56719a=_[_0x43af('0x82')](this[_0x43af('0xb')][_0x4bc094['uniqueid']]);_0x56719a[_0x43af('0x3a')]=![];_0x56719a[_0x43af('0x83')]=null;_0x56719a[_0x43af('0x84')]=_0x4bc094[_0x43af('0x84')];_0x56719a[_0x43af('0x85')]=_0x4bc094[_0x43af('0x85')];_0x56719a[_0x43af('0x1f')]=!![];_0x56719a[_0x43af('0x86')]=moment()[_0x43af('0x5d')](_0x43af('0x79'));_0x56719a['queuecallerexitreason']='ABANDONED';_0x56719a['lastAssignedTo']=null;logger[_0x43af('0x7d')](_0x43af('0x87'),_0x56719a[_0x43af('0x52')],_0x56719a[_0x43af('0x5a')]);this[_0x43af('0xe')][_0x4bc094['uniqueid']]=_0x56719a;this[_0x43af('0x4b')](_0x56719a,_0x43af('0x1f'));}}}catch(_0x24e5fe){logger[_0x43af('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4bc094[_0x43af('0x51')],util[_0x43af('0x45')](_0x24e5fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x43af('0x49')]['syncQueueCallerLeave']=function(_0x3c8a42){try{if(this['isNotNull'](_0x3c8a42)){logger[_0x43af('0x54')](_0x43af('0x88'),_0x3c8a42[_0x43af('0x51')],util[_0x43af('0x45')](_0x3c8a42,{'showHidden':![],'depth':null}));if(this[_0x43af('0xb')][_0x3c8a42['uniqueid']]){var _0x583e8f=_[_0x43af('0x82')](this['queueReports'][_0x3c8a42['uniqueid']]);_0x583e8f['queuecallerleaveAt']=moment()[_0x43af('0x5d')](_0x43af('0x79'));_0x583e8f['connectedlinenum']=_0x3c8a42['connectedlinenum'];_0x583e8f[_0x43af('0x89')]=_0x3c8a42[_0x43af('0x89')];logger[_0x43af('0x7d')](_0x43af('0x8a'),_0x583e8f[_0x43af('0x52')],_0x583e8f[_0x43af('0x5a')],_0x3c8a42[_0x43af('0x8b')],_0x3c8a42['connectedlinename']);this[_0x43af('0xe')][_0x3c8a42[_0x43af('0x51')]]=_0x583e8f;this[_0x43af('0x4e')](_0x583e8f,_0x43af('0x8c'));}}}catch(_0x33f716){logger[_0x43af('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x3c8a42[_0x43af('0x51')],util[_0x43af('0x45')](_0x33f716,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x43af('0x49')][_0x43af('0x8d')]=function(_0x4b4c5a){try{if(this[_0x43af('0x60')](_0x4b4c5a)){logger['debug'](_0x43af('0x8e'),_0x4b4c5a['uniqueid'],util[_0x43af('0x45')](_0x4b4c5a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b4c5a[_0x43af('0x51')]]){var _0x4ebad4=_['last'](this[_0x43af('0xb')][_0x4b4c5a[_0x43af('0x51')]]);_0x4ebad4[_0x43af('0x3a')]=!![];_0x4ebad4[_0x43af('0x56')]=_0x43af('0x8f');logger[_0x43af('0x7d')](_0x43af('0x90'),_0x4ebad4[_0x43af('0x52')],_0x4ebad4[_0x43af('0x5a')]);}}}catch(_0x4369fe){logger[_0x43af('0x46')](_0x43af('0x8e'),_0x4b4c5a[_0x43af('0x51')],util[_0x43af('0x45')](_0x4369fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x43af('0x49')][_0x43af('0x23')]=function(_0x35cd82){try{if(this[_0x43af('0x60')](_0x35cd82)){logger[_0x43af('0x54')]('[%s][voiceQueueReport][agentcomplete]',_0x35cd82[_0x43af('0x51')],util[_0x43af('0x45')](_0x35cd82,{'showHidden':![],'depth':null}));if(this[_0x43af('0xb')][_0x35cd82[_0x43af('0x51')]]){var _0x3c3997=_[_0x43af('0x82')](this[_0x43af('0xb')][_0x35cd82[_0x43af('0x51')]]);_0x3c3997['queuecallerabandon']=![];_0x3c3997[_0x43af('0x86')]=null;_0x3c3997[_0x43af('0x91')]=!![];_0x3c3997[_0x43af('0x92')]=_0x35cd82[_0x43af('0x93')];_0x3c3997[_0x43af('0x84')]=_0x35cd82[_0x43af('0x84')];_0x3c3997['queuecallercomplete']=!![];_0x3c3997[_0x43af('0x39')]=![];_0x3c3997[_0x43af('0x94')]=null;if(!_0x3c3997[_0x43af('0x95')]){if(_0x35cd82[_0x43af('0x96')]==_0x43af('0x95')){_0x3c3997[_0x43af('0x56')]=_0x43af('0x97');logger[_0x43af('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3c3997[_0x43af('0x52')],_0x3c3997[_0x43af('0x5a')]);}else{if(_['startsWith'](_0x35cd82[_0x43af('0x41')][_0x43af('0x98')](),_0x43af('0x99'))){if(this[_0x43af('0xb')][_0x35cd82[_0x43af('0x9a')]]){var _0x27f88c=_['last'](this[_0x43af('0xb')][_0x35cd82[_0x43af('0x9a')]]);_0x27f88c['queuecallercomplete']=![];_0x27f88c['queuecallerexit']=!![];_0x27f88c[_0x43af('0x94')]=moment(_0x3c3997[_0x43af('0x78')])[_0x43af('0x9b')](_0x35cd82['holdtime'],_0x43af('0x9c'))[_0x43af('0x5d')](_0x43af('0x79'));_0x27f88c['queuecallerexitreason']='FORWARDTRANSFER';_0x27f88c[_0x43af('0x95')]=!![];_0x27f88c[_0x43af('0x9d')]='FORWARD';_0x27f88c[_0x43af('0x9e')]=_0x35cd82[_0x43af('0x9f')];_0x27f88c['transferuniqueid']=_0x35cd82[_0x43af('0x51')];logger[_0x43af('0x7d')](_0x43af('0xa0'),_0x27f88c[_0x43af('0x52')],_0x27f88c['type']);var _0x2c67a6=this[_0x43af('0xb')][_0x35cd82[_0x43af('0x9a')]];this[_0x43af('0xb')][_0x35cd82[_0x43af('0x9a')]]=this[_0x43af('0xb')][_0x35cd82[_0x43af('0x51')]];this[_0x43af('0xb')][_0x35cd82[_0x43af('0x51')]]=_0x2c67a6;}}else{_0x3c3997['queuecallerexitreason']=_0x43af('0xa1')+_0x35cd82[_0x43af('0x96')][_0x43af('0xa2')]();logger['info'](_0x43af('0xa3'),_0x3c3997[_0x43af('0x52')],_0x3c3997[_0x43af('0x5a')],_0x3c3997[_0x43af('0x56')]);}}}this['channels'][_0x35cd82[_0x43af('0x51')]]=_0x3c3997;}}}catch(_0x221b4e){logger[_0x43af('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x35cd82[_0x43af('0x51')],util[_0x43af('0x45')](_0x221b4e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x43af('0x26')]=function(_0x17116b){try{if(this['isNotNull'](_0x17116b)){logger[_0x43af('0x54')]('[%s][voiceQueueReport][varset]',_0x17116b[_0x43af('0x51')],util[_0x43af('0x45')](_0x17116b,{'showHidden':![],'depth':null}));this[_0x43af('0xa4')](_0x17116b[_0x43af('0x51')],_[_0x43af('0x7f')](_0x17116b[_0x43af('0xa5')])[0x0],_0x17116b[_0x43af('0xa6')]);if(this[_0x43af('0xb')][_0x17116b[_0x43af('0x51')]]){var _0xde09d3=_[_0x43af('0x82')](this[_0x43af('0xb')][_0x17116b[_0x43af('0x51')]]);if(_0xde09d3){if(this[_0x43af('0x60')](_0x17116b[_0x43af('0xa5')])&&this[_0x43af('0x60')](_0x17116b[_0x43af('0xa5')]['queuestatus'])){switch(_0x17116b[_0x43af('0xa6')]){case _0x43af('0xa7'):_0xde09d3[_0x43af('0x39')]=![];_0xde09d3[_0x43af('0x94')]=null;break;case _0x43af('0xa8'):_0xde09d3[_0x43af('0xa9')]=_0x43af('0xaa');_0xde09d3[_0x43af('0x39')]=!![];_0xde09d3[_0x43af('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xde09d3[_0x43af('0xab')]=moment()[_0x43af('0x5d')](_0x43af('0x79'));logger['debug'](_0x43af('0xac'),_0x17116b['uniqueid'],util[_0x43af('0x45')](_0xde09d3,{'showHidden':![],'depth':null}));ami[_0x43af('0x4d')](_0x43af('0xad'),_0xde09d3);break;default:_0xde09d3[_0x43af('0x39')]=!![];_0xde09d3['queuecallerexitAt']=moment()[_0x43af('0x5d')](_0x43af('0x79'));_0xde09d3['queuecallerleaveAt']=moment()[_0x43af('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');}_0xde09d3[_0x43af('0x1f')]=![];_0xde09d3[_0x43af('0x86')]=null;_0xde09d3[_0x43af('0x56')]=_0x17116b[_0x43af('0xa6')];this[_0x43af('0xe')][_0x17116b[_0x43af('0x51')]]=_0xde09d3;this[_0x43af('0x4b')](_0xde09d3,_0x43af('0x25'));}else if(this[_0x43af('0x60')](_0x17116b[_0x43af('0xa5')])&&this[_0x43af('0x60')](_0x17116b[_0x43af('0xa5')][_0x43af('0xae')])){if(!_0xde09d3[_0x43af('0x1f')]){_0xde09d3[_0x43af('0x39')]=!![];_0xde09d3['queuecallerexitAt']=moment()['format'](_0x43af('0x79'));_0xde09d3[_0x43af('0x56')]=_0x43af('0xaf');_0xde09d3[_0x43af('0xab')]=moment()[_0x43af('0x5d')](_0x43af('0x79'));this[_0x43af('0xe')][_0x17116b[_0x43af('0x51')]]=_0xde09d3;}}logger[_0x43af('0x7d')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x17116b[_0x43af('0x51')],_0xde09d3['queue'],_0xde09d3[_0x43af('0x5a')],_['keys'](_0x17116b[_0x43af('0xa5')])[0x0],_0x17116b['value']);_0xde09d3['variables']=this['variables'][_0x17116b[_0x43af('0x51')]];}}}}catch(_0x12becf){logger['error'](_0x43af('0xb0'),_0x17116b[_0x43af('0x51')],util[_0x43af('0x45')](_0x12becf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x43af('0xa4')]=function(_0x217262,_0x53d994,_0xecc1a9){var _0x291715=[_0x43af('0xb1'),'rtpaudioqosbridged',_0x43af('0xb2'),'rtpaudioqosjitterbridged',_0x43af('0xb3'),_0x43af('0xb4'),'rtpaudioqosrtt',_0x43af('0xb5'),_0x43af('0xb6'),_0x43af('0xb7'),_0x43af('0xb8'),_0x43af('0xb9'),_0x43af('0xba'),_0x43af('0xbb'),_0x43af('0xbc'),_0x43af('0xbd'),_0x43af('0x93'),_0x43af('0xbe'),_0x43af('0xbf')];if(!_[_0x43af('0x3e')](_0x53d994)&&!_[_0x43af('0xc0')](_0x291715,_0x53d994)){if(_['isUndefined'](this[_0x43af('0x13')][_0x217262])){this[_0x43af('0x13')][_0x217262]={};}this[_0x43af('0x13')][_0x217262][_0x53d994]=_0xecc1a9;}};VoiceQueueReport[_0x43af('0x49')]['handleHangup']=function(_0x16552b,_0x317e8a,_0x25af71){try{var _0x414ed6={};if(this[_0x43af('0xb')][_0x16552b]){for(var _0x5eed6d=0x0;_0x5eed6d=0x0?moment(_0x565593[_0x8dc1('0x16')])[_0x8dc1('0x17')](_0x565593[_0x8dc1('0x18')],'seconds'):null,'data1':_0x8dc1('0x19'),'data2':_0x565593[_0x8dc1('0x10')],'data3':_0x565593[_0x8dc1('0x1a')],'data4':_0x565593['dialstring']||null,'role':_0x8dc1('0xf'),'internal':_0x565593[_0x8dc1('0x10')]?_[_0x8dc1('0x11')](_0x565593[_0x8dc1('0x10')]):undefined,'uniqueid':_0x565593['uniqueid']},'log':_0x8dc1('0x5')});}; \ No newline at end of file +var _0x9b39=['interface','queuecallerleaveAt','exten','queue','accountcode','uniqueid','CreateMemberReport','TALKING','starttime','endtime','diff','seconds','outbound','dialstring','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','SIP/%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b39,0x161));var _0x99b3=function(_0x47921a,_0x15b8ef){_0x47921a=_0x47921a-0x0;var _0x3021e3=_0x9b39[_0x47921a];return _0x3021e3;};'use strict';var moment=require(_0x99b3('0x0'));var _=require(_0x99b3('0x1'));var util=require(_0x99b3('0x2'));var client=require(_0x99b3('0x3'));exports[_0x99b3('0x4')]=function(_0x1bd3dd){var _0xa40151=_0x1bd3dd['queuecallercompleteAt']||_0x1bd3dd[_0x99b3('0x5')];return client[_0x99b3('0x6')]('CreateMemberReport',{'body':{'channel':_0x99b3('0x7'),'membername':_0x1bd3dd[_0x99b3('0x8')],'interface':_[_0x99b3('0x9')](_0x1bd3dd['interface'])?util['format'](_0x99b3('0xa'),_0x1bd3dd[_0x99b3('0x8')]):_0x1bd3dd[_0x99b3('0xb')],'type':'TALKING','enterAt':_0x1bd3dd[_0x99b3('0xc')],'exitAt':_0xa40151,'duration':moment(_0xa40151)['diff'](_0x1bd3dd['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x1bd3dd['calleridnum'],'data3':_0x1bd3dd[_0x99b3('0xd')],'data4':null,'data5':_0x1bd3dd[_0x99b3('0xe')],'role':'agent','internal':_0x1bd3dd[_0x99b3('0xf')]?_['toNumber'](_0x1bd3dd[_0x99b3('0xf')]):undefined,'uniqueid':_0x1bd3dd[_0x99b3('0x10')]},'log':_0x99b3('0x11')});};exports['voiceDialReport']=function(_0x2742a0){return client[_0x99b3('0x6')](_0x99b3('0x11'),{'body':{'channel':_0x99b3('0x7'),'membername':_0x2742a0['membername'],'interface':_0x2742a0[_0x99b3('0xb')],'type':_0x99b3('0x12'),'enterAt':_0x2742a0[_0x99b3('0x13')],'exitAt':_0x2742a0[_0x99b3('0x14')],'duration':moment(_0x2742a0['endtime'])['diff'](_0x2742a0['starttime'],'seconds')>=0x0?moment(_0x2742a0[_0x99b3('0x14')])[_0x99b3('0x15')](_0x2742a0[_0x99b3('0x13')],_0x99b3('0x16')):null,'data1':_0x99b3('0x17'),'data2':_0x2742a0['accountcode'],'data3':_0x2742a0[_0x99b3('0xd')],'data4':_0x2742a0[_0x99b3('0x18')]||null,'role':'agent','internal':_0x2742a0[_0x99b3('0xf')]?_[_0x99b3('0x19')](_0x2742a0[_0x99b3('0xf')]):undefined,'uniqueid':_0x2742a0[_0x99b3('0x10')]},'log':_0x99b3('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 9f707c8..1cdc54c 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 _0x3a5d=['GetSettings','../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x3d44d1,_0x626ec1){var _0x153a9b=function(_0x10cd58){while(--_0x10cd58){_0x3d44d1['push'](_0x3d44d1['shift']());}};_0x153a9b(++_0x626ec1);}(_0x3a5d,0x193));var _0xd3a5=function(_0x234f28,_0x1a311c){_0x234f28=_0x234f28-0x0;var _0x38bcb6=_0x3a5d[_0x234f28];return _0x38bcb6;};'use strict';var client=require(_0xd3a5('0x0'));exports['getSettings']=function(){return client[_0xd3a5('0x1')](_0xd3a5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd3a5('0x3'),_0xd3a5('0x4')]},'log':_0xd3a5('0x5')});}; \ No newline at end of file +var _0xa49b=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','getSettings'];(function(_0x55cf52,_0x2cf5c8){var _0x3a56de=function(_0x8ee79d){while(--_0x8ee79d){_0x55cf52['push'](_0x55cf52['shift']());}};_0x3a56de(++_0x2cf5c8);}(_0xa49b,0x126));var _0xba49=function(_0x54b391,_0x596d20){_0x54b391=_0x54b391-0x0;var _0x5ee339=_0xa49b[_0x54b391];return _0x5ee339;};'use strict';var client=require('../client');exports[_0xba49('0x0')]=function(){return client[_0xba49('0x1')](_0xba49('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xba49('0x3'),'previewRecallmeReminderInterval']},'log':_0xba49('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 70e6b35..5b5ba80 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 _0x584e=['Request','html','GetTemplate','../client'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x584e,0xa3));var _0xe584=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x584e[_0x257b0e];return _0x27ac2a;};'use strict';var client=require(_0xe584('0x0'));exports['getTemplates']=function(_0x298634){return function(_0x420d0e){return client[_0xe584('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xe584('0x2')]},'log':_0xe584('0x3')});};}; \ No newline at end of file +var _0x291f=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x4d79ca,_0x413286){var _0x57af1f=function(_0x5df6f3){while(--_0x5df6f3){_0x4d79ca['push'](_0x4d79ca['shift']());}};_0x57af1f(++_0x413286);}(_0x291f,0xc9));var _0xf291=function(_0x36c8b2,_0x1f5817){_0x36c8b2=_0x36c8b2-0x0;var _0x3fed58=_0x291f[_0x36c8b2];return _0x3fed58;};'use strict';var client=require(_0xf291('0x0'));exports[_0xf291('0x1')]=function(_0x3fc1f0){return function(_0x5b54ca){return client[_0xf291('0x2')](_0xf291('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf291('0x4'),_0xf291('0x5')]},'log':_0xf291('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2b52350..376cc93 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 _0x8242=['data3','data5','data6','data7','getTriggers','Request','name','channel','status','Condition','operator','AnyConditions','field','value','Action','data1','data2'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x8242,0xd0));var _0x2824=function(_0x3bb9f3,_0x24d76d){_0x3bb9f3=_0x3bb9f3-0x0;var _0x2836bc=_0x8242[_0x3bb9f3];return _0x2836bc;};'use strict';var client=require('../client');exports[_0x2824('0x0')]=function(_0x5234c0){return function(_0x1f1ebe){return client[_0x2824('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x2824('0x2'),_0x2824('0x3'),_0x2824('0x4')],'include':[{'model':_0x2824('0x5'),'as':'AllConditions','attributes':['id','field',_0x2824('0x6'),'value']},{'model':_0x2824('0x5'),'as':_0x2824('0x7'),'attributes':['id',_0x2824('0x8'),_0x2824('0x6'),_0x2824('0x9')]},{'model':_0x2824('0xa'),'as':'Actions','attributes':['id','action',_0x2824('0xb'),_0x2824('0xc'),_0x2824('0xd'),'data4',_0x2824('0xe'),_0x2824('0xf'),_0x2824('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xf601=['../client','getTriggers','Request','name','channel','Condition','AllConditions','value','AnyConditions','field','operator','Actions','action','data2','data3','data4','data5','GetTrigger'];(function(_0x5289e8,_0x472022){var _0x11c2c0=function(_0x24861b){while(--_0x24861b){_0x5289e8['push'](_0x5289e8['shift']());}};_0x11c2c0(++_0x472022);}(_0xf601,0x19e));var _0x1f60=function(_0x2013e9,_0x2f9712){_0x2013e9=_0x2013e9-0x0;var _0x1c817c=_0xf601[_0x2013e9];return _0x1c817c;};'use strict';var client=require(_0x1f60('0x0'));exports[_0x1f60('0x1')]=function(_0x465315){return function(_0x23bcf8){return client[_0x1f60('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x1f60('0x3'),_0x1f60('0x4'),'status'],'include':[{'model':_0x1f60('0x5'),'as':_0x1f60('0x6'),'attributes':['id','field','operator',_0x1f60('0x7')]},{'model':_0x1f60('0x5'),'as':_0x1f60('0x8'),'attributes':['id',_0x1f60('0x9'),_0x1f60('0xa'),_0x1f60('0x7')]},{'model':'Action','as':_0x1f60('0xb'),'attributes':['id',_0x1f60('0xc'),'data1',_0x1f60('0xd'),_0x1f60('0xe'),_0x1f60('0xf'),_0x1f60('0x10'),'data6','data7']}]},'log':_0x1f60('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 001dd41..72c8fc4 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 _0x1744=['GetTrunk','../client','Request','name','registry'];(function(_0xe43913,_0x39852f){var _0x7e2c7e=function(_0xcaf940){while(--_0xcaf940){_0xe43913['push'](_0xe43913['shift']());}};_0x7e2c7e(++_0x39852f);}(_0x1744,0xa1));var _0x4174=function(_0x59e73b,_0x572fab){_0x59e73b=_0x59e73b-0x0;var _0x2ccff4=_0x1744[_0x59e73b];return _0x2ccff4;};'use strict';var client=require(_0x4174('0x0'));exports['getTrunks']=function(_0x1a9440){return function(_0x3fd423){return client[_0x4174('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4174('0x2'),_0x4174('0x3'),'defaultuser']},'log':_0x4174('0x4')});};}; \ No newline at end of file +var _0x0d0b=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x41383c,_0x58833f){var _0x35b024=function(_0x4404d2){while(--_0x4404d2){_0x41383c['push'](_0x41383c['shift']());}};_0x35b024(++_0x58833f);}(_0x0d0b,0x1ef));var _0xb0d0=function(_0x19eff7,_0x2ab350){_0x19eff7=_0x19eff7-0x0;var _0x56a180=_0x0d0b[_0x19eff7];return _0x56a180;};'use strict';var client=require('../client');exports[_0xb0d0('0x0')]=function(_0x59d6ea){return function(_0xc784a8){return client['Request'](_0xb0d0('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb0d0('0x2'),_0xb0d0('0x3'),_0xb0d0('0x4')]},'log':_0xb0d0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b29f188..a3628f7 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x2b1b19,_0x2eac02){var _0x511f69=function(_0x5ee8c4){while(--_0x5ee8c4){_0x2b1b19['push'](_0x2b1b19['shift']());}};_0x511f69(++_0x2eac02);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xcb91[_0x1d87fc];return _0x492b56;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x5ba356,_0x533a9a){var _0x3040db=function(_0x1d144a){while(--_0x1d144a){_0x5ba356['push'](_0x5ba356['shift']());}};_0x3040db(++_0x533a9a);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index dd3d836..2bc25b8 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 _0xe561=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe561,0xe1));var _0x1e56=function(_0x273177,_0x27d17f){_0x273177=_0x273177-0x0;var _0x4ca251=_0xe561[_0x273177];return _0x4ca251;};'use strict';var client=require(_0x1e56('0x0'));exports[_0x1e56('0x1')]=function(_0x1c3d3a){return client[_0x1e56('0x2')](_0x1e56('0x3'),{'body':_0x1c3d3a,'log':_0x1e56('0x3')});};exports[_0x1e56('0x4')]=function(_0x202a87,_0x30b728,_0x396acb){return client[_0x1e56('0x2')](_0x1e56('0x5'),{'body':_0x202a87,'options':{'where':{'uniqueid':_0x30b728,'interface':_0x396acb,'agentcomplete':!![]}},'log':_0x1e56('0x5')});}; \ No newline at end of file +var _0xcddd=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcddd,0x17b));var _0xdcdd=function(_0x3d3f51,_0x3dfbcd){_0x3d3f51=_0x3d3f51-0x0;var _0x468cf3=_0xcddd[_0x3d3f51];return _0x468cf3;};'use strict';var client=require(_0xdcdd('0x0'));exports[_0xdcdd('0x1')]=function(_0x157430){return client[_0xdcdd('0x2')]('CreateVoiceAgentReport',{'body':_0x157430,'log':_0xdcdd('0x3')});};exports[_0xdcdd('0x4')]=function(_0x5711b2,_0x2038ca,_0x40b00b){return client[_0xdcdd('0x2')](_0xdcdd('0x5'),{'body':_0x5711b2,'options':{'where':{'uniqueid':_0x2038ca,'interface':_0x40b00b,'agentcomplete':!![]}},'log':_0xdcdd('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3012f27..44f4ac8 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 _0xb99c=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','moment','lodash','../client','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format'];(function(_0x143256,_0x1197ae){var _0x5e2e2d=function(_0x2a6c99){while(--_0x2a6c99){_0x143256['push'](_0x143256['shift']());}};_0x5e2e2d(++_0x1197ae);}(_0xb99c,0x1c6));var _0xcb99=function(_0xcb825d,_0x41a938){_0xcb825d=_0xcb825d-0x0;var _0x56c0d1=_0xb99c[_0xcb825d];return _0x56c0d1;};'use strict';var moment=require(_0xcb99('0x0'));var util=require('util');var _=require(_0xcb99('0x1'));var client=require(_0xcb99('0x2'));exports['create']=function(_0x248e3d){return client[_0xcb99('0x3')](_0xcb99('0x4'),{'body':_[_0xcb99('0x5')](_0x248e3d,{'source':_0x248e3d['calleridnum'],'destinationcontext':_0x248e3d[_0xcb99('0x6')],'callerid':_0x248e3d[_0xcb99('0x7')],'amaflags':_0xcb99('0x8')}),'log':_0xcb99('0x4')});};exports[_0xcb99('0x9')]=function(){return function(){return client[_0xcb99('0x3')](_0xcb99('0xa'),{'options':{'where':{'type':[_0xcb99('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xcb99('0xc'))[_0xcb99('0xd')](_0xcb99('0xe')),moment()[_0xcb99('0xf')](_0xcb99('0xc'))[_0xcb99('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcb99('0x10'),_0xcb99('0x11'),'duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x6c97=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','type','disposition','duration','billableseconds'];(function(_0x3a287e,_0x269139){var _0x42c729=function(_0x14f5c6){while(--_0x14f5c6){_0x3a287e['push'](_0x3a287e['shift']());}};_0x42c729(++_0x269139);}(_0x6c97,0xf3));var _0x76c9=function(_0x47cb8c,_0xd2b94){_0x47cb8c=_0x47cb8c-0x0;var _0x1d0207=_0x6c97[_0x47cb8c];return _0x1d0207;};'use strict';var moment=require(_0x76c9('0x0'));var util=require(_0x76c9('0x1'));var _=require(_0x76c9('0x2'));var client=require(_0x76c9('0x3'));exports[_0x76c9('0x4')]=function(_0x3ed4b7){return client[_0x76c9('0x5')](_0x76c9('0x6'),{'body':_[_0x76c9('0x7')](_0x3ed4b7,{'source':_0x3ed4b7[_0x76c9('0x8')],'destinationcontext':_0x3ed4b7[_0x76c9('0x9')],'callerid':_0x3ed4b7[_0x76c9('0xa')],'amaflags':_0x76c9('0xb')}),'log':'CreateVoiceCallReport'});};exports[_0x76c9('0xc')]=function(){return function(){return client[_0x76c9('0x5')](_0x76c9('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x76c9('0xe')](_0x76c9('0xf'))[_0x76c9('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x76c9('0xf'))[_0x76c9('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x76c9('0x11'),_0x76c9('0x12'),_0x76c9('0x13'),_0x76c9('0x14')]},'log':_0x76c9('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e4c048e..df3cd8c 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 _0xa820=['create','Request','CreateVoiceDialReport','../client'];(function(_0x18247f,_0x30ccc1){var _0x255550=function(_0x32cf90){while(--_0x32cf90){_0x18247f['push'](_0x18247f['shift']());}};_0x255550(++_0x30ccc1);}(_0xa820,0xef));var _0x0a82=function(_0x5b36bd,_0x4dfb36){_0x5b36bd=_0x5b36bd-0x0;var _0x1614fe=_0xa820[_0x5b36bd];return _0x1614fe;};'use strict';var client=require(_0x0a82('0x0'));exports[_0x0a82('0x1')]=function(_0x2061a0){return client[_0x0a82('0x2')](_0x0a82('0x3'),{'body':_0x2061a0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xba6f=['Request','CreateVoiceDialReport','../client','create'];(function(_0x36c15f,_0xe247d){var _0x5408a9=function(_0x5f1649){while(--_0x5f1649){_0x36c15f['push'](_0x36c15f['shift']());}};_0x5408a9(++_0xe247d);}(_0xba6f,0x6e));var _0xfba6=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xba6f[_0x4521e3];return _0x46a272;};'use strict';var client=require(_0xfba6('0x0'));exports[_0xfba6('0x1')]=function(_0x5506cf){return client[_0xfba6('0x2')](_0xfba6('0x3'),{'body':_0x5506cf,'log':_0xfba6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 53e3eff..5fa9982 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 _0x97f5=['Request','recordingFormat','../client','getVoiceExtensions'];(function(_0x4e4c99,_0x227d0a){var _0x40140a=function(_0xfeca85){while(--_0xfeca85){_0x4e4c99['push'](_0x4e4c99['shift']());}};_0x40140a(++_0x227d0a);}(_0x97f5,0x72));var _0x597f=function(_0x3066f7,_0x4c8bde){_0x3066f7=_0x3066f7-0x0;var _0x25d3d3=_0x97f5[_0x3066f7];return _0x25d3d3;};'use strict';var client=require(_0x597f('0x0'));exports[_0x597f('0x1')]=function(){return function(){return client[_0x597f('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x597f('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x597f('0x1')});};}; \ No newline at end of file +var _0xa902=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x73b1cd,_0x176535){var _0x243426=function(_0x1ee7c0){while(--_0x1ee7c0){_0x73b1cd['push'](_0x73b1cd['shift']());}};_0x243426(++_0x176535);}(_0xa902,0x8d));var _0x2a90=function(_0x157d6b,_0x1157ee){_0x157d6b=_0x157d6b-0x0;var _0x298298=_0xa902[_0x157d6b];return _0x298298;};'use strict';var client=require(_0x2a90('0x0'));exports[_0x2a90('0x1')]=function(){return function(){return client[_0x2a90('0x2')](_0x2a90('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2a90('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x2a90('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f1c9e27..60f7935 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 _0xab44=['dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x3dbf5d,_0x3ba0cb){var _0x415b90=function(_0x3a0d35){while(--_0x3a0d35){_0x3dbf5d['push'](_0x3dbf5d['shift']());}};_0x415b90(++_0x3ba0cb);}(_0xab44,0xe2));var _0x4ab4=function(_0x576a25,_0x33e262){_0x576a25=_0x576a25-0x0;var _0x155941=_0xab44[_0x576a25];return _0x155941;};'use strict';var client=require(_0x4ab4('0x0'));exports[_0x4ab4('0x1')]=function(){return function(){return client[_0x4ab4('0x2')](_0x4ab4('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ab4('0x4'),_0x4ab4('0x5'),_0x4ab4('0x6'),_0x4ab4('0x7'),'monitor_format','type',_0x4ab4('0x8'),_0x4ab4('0x9'),_0x4ab4('0xa'),'dialLimitQueue',_0x4ab4('0xb'),_0x4ab4('0xc'),'dialPredictiveOptimizationPercentage',_0x4ab4('0xd'),_0x4ab4('0xe'),_0x4ab4('0xf'),'dialOriginateTimeout','dialQueueOptions',_0x4ab4('0x10'),_0x4ab4('0x11'),'dialCongestionMaxRetry',_0x4ab4('0x12'),_0x4ab4('0x13'),_0x4ab4('0x14'),_0x4ab4('0x15'),_0x4ab4('0x16'),'dialGlobalMaxRetry',_0x4ab4('0x17'),_0x4ab4('0x18'),_0x4ab4('0x19'),_0x4ab4('0x1a'),'dialAMDActive',_0x4ab4('0x1b'),_0x4ab4('0x1c'),'dialAMDAfterGreetingSilence',_0x4ab4('0x1d'),_0x4ab4('0x1e'),_0x4ab4('0x1f'),_0x4ab4('0x20'),_0x4ab4('0x21'),_0x4ab4('0x22'),'timeout',_0x4ab4('0x23'),_0x4ab4('0x24'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x4ab4('0x25'),_0x4ab4('0x26'),_0x4ab4('0x27'),_0x4ab4('0x28'),_0x4ab4('0x29'),_0x4ab4('0x2a'),_0x4ab4('0x2b'),_0x4ab4('0x2c'),_0x4ab4('0x2d'),'dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x4ab4('0x2e'),_0x4ab4('0x2f'),_0x4ab4('0x30'),_0x4ab4('0x31'),_0x4ab4('0x32'),_0x4ab4('0x33'),_0x4ab4('0x34'),_0x4ab4('0x35')],'include':[{'model':_0x4ab4('0x36'),'as':_0x4ab4('0x36'),'attributes':['id','name',_0x4ab4('0x37'),_0x4ab4('0x38')]},{'model':_0x4ab4('0x39'),'as':_0x4ab4('0x3a'),'attributes':['id','name']},{'model':_0x4ab4('0x36'),'as':_0x4ab4('0x3b'),'attributes':['id','name',_0x4ab4('0x37'),'active']},{'model':_0x4ab4('0x3c'),'as':_0x4ab4('0x3c'),'attributes':['id',_0x4ab4('0x4')],'include':[{'model':_0x4ab4('0x3c'),'as':'Intervals','attributes':['id',_0x4ab4('0x4'),_0x4ab4('0x3d')]}]}]},'log':_0x4ab4('0x1')});};}; \ No newline at end of file +var _0x34a8=['type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause'];(function(_0x434c62,_0x303a5e){var _0x3f6402=function(_0x10a564){while(--_0x10a564){_0x434c62['push'](_0x434c62['shift']());}};_0x3f6402(++_0x303a5e);}(_0x34a8,0x1ab));var _0x834a=function(_0x402083,_0x4fa239){_0x402083=_0x402083-0x0;var _0x1e15f1=_0x34a8[_0x402083];return _0x1e15f1;};'use strict';var client=require(_0x834a('0x0'));exports[_0x834a('0x1')]=function(){return function(){return client[_0x834a('0x2')](_0x834a('0x3'),{'options':{'raw':![],'attributes':['id',_0x834a('0x4'),'acw',_0x834a('0x5'),_0x834a('0x6'),'monitor_format',_0x834a('0x7'),_0x834a('0x8'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x834a('0x9'),_0x834a('0xa'),_0x834a('0xb'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x834a('0xc'),_0x834a('0xd'),_0x834a('0xe'),'dialQueueTimeout',_0x834a('0xf'),'dialCongestionMaxRetry',_0x834a('0x10'),_0x834a('0x11'),'dialBusyRetryFrequency',_0x834a('0x12'),_0x834a('0x13'),_0x834a('0x14'),'dialTimezone',_0x834a('0x15'),_0x834a('0x16'),_0x834a('0x17'),_0x834a('0x18'),'dialAMDInitialSilence',_0x834a('0x19'),_0x834a('0x1a'),_0x834a('0x1b'),_0x834a('0x1c'),_0x834a('0x1d'),_0x834a('0x1e'),_0x834a('0x1f'),_0x834a('0x20'),_0x834a('0x21'),_0x834a('0x22'),_0x834a('0x23'),'dialOrderByScheduledAt',_0x834a('0x24'),_0x834a('0x25'),_0x834a('0x26'),_0x834a('0x27'),_0x834a('0x28'),_0x834a('0x29'),'dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x834a('0x2a'),_0x834a('0x2b'),_0x834a('0x2c'),_0x834a('0x2d'),_0x834a('0x2e'),_0x834a('0x2f'),_0x834a('0x30'),_0x834a('0x31'),_0x834a('0x32'),_0x834a('0x33'),_0x834a('0x34'),_0x834a('0x35'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x834a('0x36'),'as':_0x834a('0x36'),'attributes':['id',_0x834a('0x4'),_0x834a('0x37'),_0x834a('0x38')]},{'model':_0x834a('0x39'),'as':_0x834a('0x3a'),'attributes':['id','name']},{'model':_0x834a('0x36'),'as':'TrunkBackup','attributes':['id',_0x834a('0x4'),_0x834a('0x37'),_0x834a('0x38')]},{'model':_0x834a('0x3b'),'as':'Interval','attributes':['id',_0x834a('0x4')],'include':[{'model':_0x834a('0x3b'),'as':_0x834a('0x3c'),'attributes':['id',_0x834a('0x4'),_0x834a('0x3d')]}]}]},'log':_0x834a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index bbbb361..1906df7 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(_0x28d384,_0x4732dd){var _0x2d62c4=function(_0x1105de){while(--_0x1105de){_0x28d384['push'](_0x28d384['shift']());}};_0x2d62c4(++_0x4732dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0xdad8c0,_0x4e9771){var _0x3e7aea=function(_0x534eb7){while(--_0x534eb7){_0xdad8c0['push'](_0xdad8c0['shift']());}};_0x3e7aea(++_0x4e9771);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 b53eaf7..c7566c1 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 _0xfd13=['getVoiceQueueRtPauses','Request','../client'];(function(_0xb093,_0x5403c4){var _0x516bac=function(_0x4564cb){while(--_0x4564cb){_0xb093['push'](_0xb093['shift']());}};_0x516bac(++_0x5403c4);}(_0xfd13,0x17f));var _0x3fd1=function(_0x15b3f8,_0x24dd7a){_0x15b3f8=_0x15b3f8-0x0;var _0x145d01=_0xfd13[_0x15b3f8];return _0x145d01;};'use strict';var client=require(_0x3fd1('0x0'));exports[_0x3fd1('0x1')]=function(_0x1f632b){return function(){return client[_0x3fd1('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1f632b,'paused':!![]},'raw':!![]},'log':_0x3fd1('0x1')});};}; \ No newline at end of file +var _0x11a7=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x5ccd4f,_0xd40b10){var _0x706b4a=function(_0x46ff2b){while(--_0x46ff2b){_0x5ccd4f['push'](_0x5ccd4f['shift']());}};_0x706b4a(++_0xd40b10);}(_0x11a7,0x124));var _0x711a=function(_0x2291cb,_0x3d2b79){_0x2291cb=_0x2291cb-0x0;var _0x53b5d2=_0x11a7[_0x2291cb];return _0x53b5d2;};'use strict';var client=require(_0x711a('0x0'));exports[_0x711a('0x1')]=function(_0x99713d){return function(){return client[_0x711a('0x2')](_0x711a('0x3'),{'options':{'where':{'VoiceQueueId':_0x99713d,'paused':!![]},'raw':!![]},'log':_0x711a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e6f16e9..a2b187a 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(_0x248294,_0xdaa23a){var _0x2c7e6e=function(_0x50db68){while(--_0x50db68){_0x248294['push'](_0x248294['shift']());}};_0x2c7e6e(++_0xdaa23a);}(_0x7a54,0x106));var _0x47a5=function(_0x34c6a9,_0x28b56f){_0x34c6a9=_0x34c6a9-0x0;var _0xe10245=_0x7a54[_0x34c6a9];return _0xe10245;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x36c2c8,_0x5a81b6){var _0x56c5d5=function(_0x210e75){while(--_0x210e75){_0x36c2c8['push'](_0x36c2c8['shift']());}};_0x56c5d5(++_0x5a81b6);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3af1b55..3d870d7 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 _0x917b=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x917b,0xdc));var _0xb917=function(_0x349dd1,_0x5b7ea7){_0x349dd1=_0x349dd1-0x0;var _0x426dfa=_0x917b[_0x349dd1];return _0x426dfa;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xb917('0x0')]=function(_0x1c8233){return client['Request'](_0xb917('0x1'),{'body':{'result':_0x1c8233[_0xb917('0x2')],'transfererchannel':_0x1c8233[_0xb917('0x3')],'transferercalleridnum':_0x1c8233['transferercalleridnum'],'transferercalleridname':_0x1c8233['transferercalleridname'],'transfererconnectedlinenum':_0x1c8233[_0xb917('0x4')],'transfererconnectedlinename':_0x1c8233[_0xb917('0x5')],'transfereraccountcode':_0x1c8233[_0xb917('0x6')],'transferercontext':_0x1c8233['transferercontext'],'transfererexten':_0x1c8233[_0xb917('0x7')],'transfererlinkedid':_0x1c8233[_0xb917('0x8')],'transfereechannel':_0x1c8233['transfereechannel'],'transfereecalleridnum':_0x1c8233[_0xb917('0x9')],'transfereecalleridname':_0x1c8233[_0xb917('0xa')],'transfereeconnectedlinenum':_0x1c8233['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1c8233[_0xb917('0xb')],'transfereeaccountcode':_0x1c8233[_0xb917('0xc')],'transfereecontext':_0x1c8233[_0xb917('0xd')],'transfereeexten':_0x1c8233['transfereeexten'],'transfereelinkedid':_0x1c8233[_0xb917('0xe')],'isexternal':_0x1c8233[_0xb917('0xf')],'context':_0x1c8233[_0xb917('0x10')],'extension':_0x1c8233[_0xb917('0x11')],'type':_0xb917('0x12')},'log':_0xb917('0x1')});};exports['attendedTransfer']=function(_0x3b4107){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3b4107['result'],'transfererchannel':_0x3b4107[_0xb917('0x13')],'transferercalleridnum':_0x3b4107[_0xb917('0x14')],'transferercalleridname':_0x3b4107[_0xb917('0x15')],'transfererconnectedlinenum':_0x3b4107[_0xb917('0x16')],'transfererconnectedlinename':_0x3b4107[_0xb917('0x17')],'transfereraccountcode':_0x3b4107[_0xb917('0x18')],'transferercontext':_0x3b4107['secondtransferercontext'],'transfererexten':_0x3b4107[_0xb917('0x19')],'transfererlinkedid':_0x3b4107[_0xb917('0x1a')],'transfereechannel':_0x3b4107[_0xb917('0x1b')],'transfereecalleridnum':_0x3b4107[_0xb917('0x1c')],'transfereecalleridname':_0x3b4107[_0xb917('0x1d')],'transfereeconnectedlinenum':_0x3b4107[_0xb917('0x1e')],'transfereeconnectedlinename':_0x3b4107['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3b4107['transfertargetaccountcode'],'transfereecontext':_0x3b4107['transfertargetcontext'],'transfereeexten':_0x3b4107[_0xb917('0x1f')],'transfereelinkedid':_0x3b4107[_0xb917('0x20')],'isexternal':_0x3b4107['isexternal'],'context':_0x3b4107[_0xb917('0x21')],'extension':_0x3b4107[_0xb917('0x22')],'type':'attended'},'log':_0xb917('0x1')});}; \ No newline at end of file +var _0x43ea=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum'];(function(_0x241c21,_0x11b64b){var _0x1ffb9e=function(_0x5e3509){while(--_0x5e3509){_0x241c21['push'](_0x241c21['shift']());}};_0x1ffb9e(++_0x11b64b);}(_0x43ea,0x1ab));var _0xa43e=function(_0x425ef6,_0x4bcea4){_0x425ef6=_0x425ef6-0x0;var _0x1a025d=_0x43ea[_0x425ef6];return _0x1a025d;};'use strict';var client=require(_0xa43e('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x10b0a0){return client[_0xa43e('0x1')](_0xa43e('0x2'),{'body':{'result':_0x10b0a0[_0xa43e('0x3')],'transfererchannel':_0x10b0a0[_0xa43e('0x4')],'transferercalleridnum':_0x10b0a0[_0xa43e('0x5')],'transferercalleridname':_0x10b0a0[_0xa43e('0x6')],'transfererconnectedlinenum':_0x10b0a0[_0xa43e('0x7')],'transfererconnectedlinename':_0x10b0a0[_0xa43e('0x8')],'transfereraccountcode':_0x10b0a0[_0xa43e('0x9')],'transferercontext':_0x10b0a0[_0xa43e('0xa')],'transfererexten':_0x10b0a0[_0xa43e('0xb')],'transfererlinkedid':_0x10b0a0['transfererlinkedid'],'transfereechannel':_0x10b0a0[_0xa43e('0xc')],'transfereecalleridnum':_0x10b0a0['transfereecalleridnum'],'transfereecalleridname':_0x10b0a0[_0xa43e('0xd')],'transfereeconnectedlinenum':_0x10b0a0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x10b0a0[_0xa43e('0xe')],'transfereeaccountcode':_0x10b0a0[_0xa43e('0xf')],'transfereecontext':_0x10b0a0[_0xa43e('0x10')],'transfereeexten':_0x10b0a0[_0xa43e('0x11')],'transfereelinkedid':_0x10b0a0['transfereelinkedid'],'isexternal':_0x10b0a0[_0xa43e('0x12')],'context':_0x10b0a0[_0xa43e('0x13')],'extension':_0x10b0a0[_0xa43e('0x14')],'type':_0xa43e('0x15')},'log':_0xa43e('0x2')});};exports['attendedTransfer']=function(_0x56e291){return client[_0xa43e('0x1')](_0xa43e('0x2'),{'body':{'result':_0x56e291[_0xa43e('0x3')],'transfererchannel':_0x56e291[_0xa43e('0x16')],'transferercalleridnum':_0x56e291['origtransferercalleridnum'],'transferercalleridname':_0x56e291['origtransferercalleridname'],'transfererconnectedlinenum':_0x56e291[_0xa43e('0x17')],'transfererconnectedlinename':_0x56e291[_0xa43e('0x18')],'transfereraccountcode':_0x56e291[_0xa43e('0x19')],'transferercontext':_0x56e291['secondtransferercontext'],'transfererexten':_0x56e291[_0xa43e('0x1a')],'transfererlinkedid':_0x56e291['origtransfererlinkedid'],'transfereechannel':_0x56e291[_0xa43e('0x1b')],'transfereecalleridnum':_0x56e291[_0xa43e('0x1c')],'transfereecalleridname':_0x56e291[_0xa43e('0x1d')],'transfereeconnectedlinenum':_0x56e291[_0xa43e('0x1e')],'transfereeconnectedlinename':_0x56e291[_0xa43e('0x1f')],'transfereeaccountcode':_0x56e291[_0xa43e('0x20')],'transfereecontext':_0x56e291[_0xa43e('0x21')],'transfereeexten':_0x56e291[_0xa43e('0x22')],'transfereelinkedid':_0x56e291[_0xa43e('0x23')],'isexternal':_0x56e291[_0xa43e('0x12')],'context':_0x56e291[_0xa43e('0x24')],'extension':_0x56e291['origtransfererexten'],'type':_0xa43e('0x25')},'log':_0xa43e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 33c8966..ba04e5e 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xf99693,_0x1fae45){var _0x5dc836=function(_0x5e8dd8){while(--_0x5e8dd8){_0xf99693['push'](_0xf99693['shift']());}};_0x5dc836(++_0x1fae45);}(_0xb10b,0x12a));var _0xbb10=function(_0x5754c1,_0x564a97){_0x5754c1=_0x5754c1-0x0;var _0x242cef=_0xb10b[_0x5754c1];return _0x242cef;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x952e58,_0x38f2ae){var _0x32e5cf=function(_0x21ef79){while(--_0x21ef79){_0x952e58['push'](_0x952e58['shift']());}};_0x32e5cf(++_0x38f2ae);}(_0x7a54,0x106));var _0x47a5=function(_0x50e3ca,_0x144c21){_0x50e3ca=_0x50e3ca-0x0;var _0x43d020=_0x7a54[_0x50e3ca];return _0x43d020;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 7a8f278..e4dbd18 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 _0x4eaf=['[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','name','action','merge','lodash','bluebird','ioredis','util','../../../../config/logger','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid'];(function(_0x5bc520,_0xad5b64){var _0xd4f522=function(_0x2d5a2f){while(--_0x2d5a2f){_0x5bc520['push'](_0x5bc520['shift']());}};_0xd4f522(++_0xad5b64);}(_0x4eaf,0x199));var _0xf4ea=function(_0x707a63,_0x1d4d0c){_0x707a63=_0x707a63-0x0;var _0x51d36e=_0x4eaf[_0x707a63];return _0x51d36e;};'use strict';var _=require(_0xf4ea('0x0'));var BPromise=require(_0xf4ea('0x1'));var Redis=require(_0xf4ea('0x2'));var util=require(_0xf4ea('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf4ea('0x4'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0xf4ea('0x5')](config[_0xf4ea('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf4ea('0x7'))(new Redis(config[_0xf4ea('0x6')]));function emit(_0x66bcfe,_0x168e4b,_0x5744c9,_0x185940,_0x5c8eaa){logger[_0xf4ea('0x8')](_0xf4ea('0x9'),_0x66bcfe,_0x168e4b['id'],_0x5744c9,_0x185940,JSON['stringify'](_0x5c8eaa));io['to'](_0x5744c9)['emit'](_0x185940,_0x5c8eaa);}exports['exec']=function(_0x7c237f,_0x237b9b,_0x48422e,_0x578f9f){var _0x12cd8b,_0x15bb1c;var _0x4499f6={};var _0x2ec0b2;var _0xcf3cb9=Number(_0x48422e[_0xf4ea('0xa')]);var _0x4507c3=_0x48422e[_0xf4ea('0xb')]?Boolean(Number(_0x48422e[_0xf4ea('0xb')])):![];var _0x1c5d20;var _0xe782b3=![];if(!_['isNil'](_0x48422e[_0xf4ea('0xc')])){if(_0x48422e['data5']=='1')_0xe782b3=!![];}if(!_0xe782b3){if(_0x578f9f[_0xf4ea('0xd')]){_0x4499f6['id']=_0x578f9f['xmd-contactid'];}}if(!_0x4499f6['id']){_0x4499f6[_0xf4ea('0xe')]=_0xcf3cb9;_0x1c5d20=_0x48422e[_0xf4ea('0xf')]&&_0x48422e[_0xf4ea('0xf')]!=='0'?_0x48422e[_0xf4ea('0xf')][_0xf4ea('0x10')](','):[_0xf4ea('0x11')];_0x4499f6[_0xf4ea('0x12')]=_['map'](_0x1c5d20,function(_0xb71e5){var _0x4fdedb={};_0x4fdedb[_0xb71e5]=_0x578f9f[_0xf4ea('0x13')]?_0x578f9f[_0xf4ea('0x14')]:_0x578f9f[_0xf4ea('0x15')];return _0x4fdedb;});_0x2ec0b2=_0x578f9f[_0xf4ea('0x13')]?_0x578f9f['destcalleridnum']:_0x578f9f[_0xf4ea('0x15')];}var _0x593aad=['id',_0xf4ea('0x16'),'lastName',_0xf4ea('0x11'),'mobile','fax',_0xf4ea('0xe'),'createdAt',_0xf4ea('0x17'),_0xf4ea('0x18')];var _0x32910e=_[_0xf4ea('0x19')](_0x593aad,_0x1c5d20);BPromise[_0xf4ea('0x1a')]()[_0xf4ea('0x1b')](cmContactRpc[_0xf4ea('0x1c')]({'attributes':_0x32910e,'where':_0x4499f6,'phone':_0x2ec0b2}))[_0xf4ea('0x1b')](function(_0x5a44fb){_0x15bb1c=_0x5a44fb;if(!_['isEmpty'](_0x15bb1c)){if(_0x15bb1c[_0xf4ea('0x1d')]===0x1){_0x12cd8b=_0x15bb1c[0x0];logger[_0xf4ea('0x8')](_0xf4ea('0x1e'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id'],_0x12cd8b['id']);}else{logger[_0xf4ea('0x8')](_0xf4ea('0x20'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id'],_[_0xf4ea('0x21')](_0x15bb1c,'id')['join'](','));}return;}else{logger[_0xf4ea('0x8')](_0xf4ea('0x22'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id']);var _0xb154ea={'ListId':_0xcf3cb9};var _0x52e155=_0x48422e[_0xf4ea('0x23')]&&_0x48422e[_0xf4ea('0x23')]!=='0'?_0x48422e[_0xf4ea('0x23')]:'phone';if(_0x4507c3){logger[_0xf4ea('0x8')](_0xf4ea('0x24'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id']);_0xb154ea[_0x52e155]=_['isNil'](_0x578f9f[_0xf4ea('0x13')])?_0x578f9f[_0xf4ea('0x15')]:_0x578f9f[_0xf4ea('0x14')];if(_['isNil'](_0x578f9f[_0xf4ea('0x13')])){_0xb154ea['firstName']=_0x578f9f[_0xf4ea('0x25')]&&_0x578f9f[_0xf4ea('0x25')]!==''?_0x578f9f[_0xf4ea('0x25')]:_0xf4ea('0x26');}else{_0xb154ea[_0xf4ea('0x16')]=_0x578f9f[_0xf4ea('0x27')]&&_0x578f9f[_0xf4ea('0x27')]!==_0xf4ea('0x28')?_0x578f9f['destcalleridname']:_0xf4ea('0x26');}return BPromise['resolve']()[_0xf4ea('0x1b')](cmContactRpc[_0xf4ea('0x29')](_0xb154ea))[_0xf4ea('0x1b')](function(_0x4b7c9e){_0x12cd8b=_0x4b7c9e;_0x15bb1c['push'](_0x4b7c9e);if(_0x12cd8b){logger[_0xf4ea('0x8')](_0xf4ea('0x2a'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id'],_0x12cd8b['id']);}return;});}else{logger[_0xf4ea('0x8')](_0xf4ea('0x2b'),_0x578f9f[_0xf4ea('0x1f')],_0x237b9b['id']);_0xb154ea[_0x52e155]=_[_0xf4ea('0x2c')](_0x578f9f[_0xf4ea('0x13')])?_0x578f9f[_0xf4ea('0x15')]:_0x578f9f[_0xf4ea('0x14')];if(_[_0xf4ea('0x2c')](_0x578f9f[_0xf4ea('0x13')])){_0xb154ea[_0xf4ea('0x16')]=_0x578f9f['calleridname']&&_0x578f9f[_0xf4ea('0x25')]!==_0xf4ea('0x28')?_0x578f9f[_0xf4ea('0x25')]:_0xf4ea('0x26');}else{_0xb154ea[_0xf4ea('0x16')]=_0x578f9f['destcalleridname']&&_0x578f9f[_0xf4ea('0x27')]!==_0xf4ea('0x28')?_0x578f9f[_0xf4ea('0x27')]:'Unknown';}_0x12cd8b=_0xb154ea;_0x15bb1c['push'](_0xb154ea);return;}}})[_0xf4ea('0x1b')](function(){if(_0x7c237f){emit(_0x578f9f[_0xf4ea('0x1f')],_0x237b9b,util[_0xf4ea('0x2d')]('user:%s',_0x7c237f[_0xf4ea('0x2e')]),util['format']('trigger:%s',_0x48422e[_0xf4ea('0x2f')]['toLowerCase']()),{'evt':_[_0xf4ea('0x30')](_0x578f9f,{'autoCreate':_0x4507c3}),'contact':_0x12cd8b===undefined?{}:_0x12cd8b,'contacts':_0x15bb1c[_0xf4ea('0x1d')]===0x0?undefined:_0x15bb1c});}});}; \ No newline at end of file +var _0x02b6=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','calleridnum','routeId','destcalleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0x4658ae,_0x147e7d){var _0x587c1b=function(_0x47e7a6){while(--_0x47e7a6){_0x4658ae['push'](_0x4658ae['shift']());}};_0x587c1b(++_0x147e7d);}(_0x02b6,0xf0));var _0x602b=function(_0x149d4e,_0x45fe2f){_0x149d4e=_0x149d4e-0x0;var _0x5cbaa4=_0x02b6[_0x149d4e];return _0x5cbaa4;};'use strict';var _=require(_0x602b('0x0'));var BPromise=require(_0x602b('0x1'));var Redis=require(_0x602b('0x2'));var util=require(_0x602b('0x3'));var config=require(_0x602b('0x4'));var logger=require(_0x602b('0x5'))(_0x602b('0x6'));var cmContactRpc=require(_0x602b('0x7'));config['redis']=_['defaults'](config[_0x602b('0x8')],{'host':_0x602b('0x9'),'port':0x18eb});var io=require(_0x602b('0xa'))(new Redis(config[_0x602b('0x8')]));function emit(_0x32b20b,_0x7f2bd3,_0xbde44f,_0x577809,_0x1ed58d){logger[_0x602b('0xb')]('[CM][%s][%s]',_0x32b20b,_0x7f2bd3['id'],_0xbde44f,_0x577809,JSON['stringify'](_0x1ed58d));io['to'](_0xbde44f)['emit'](_0x577809,_0x1ed58d);}exports['exec']=function(_0x95ea61,_0x2f7f57,_0x44f508,_0x556ebe){var _0xc58337,_0x315016;var _0x4ab738={};var _0x70ec42;var _0x4545a0=Number(_0x44f508[_0x602b('0xc')]);var _0x1ba63b=_0x44f508['data2']?Boolean(Number(_0x44f508[_0x602b('0xd')])):![];var _0xf4405f;var _0x31bfcb=![];if(!_[_0x602b('0xe')](_0x44f508[_0x602b('0xf')])){if(_0x44f508[_0x602b('0xf')]=='1')_0x31bfcb=!![];}if(!_0x31bfcb){if(_0x556ebe[_0x602b('0x10')]){_0x4ab738['id']=_0x556ebe[_0x602b('0x10')];}}if(!_0x4ab738['id']){_0x4ab738[_0x602b('0x11')]=_0x4545a0;_0xf4405f=_0x44f508[_0x602b('0x12')]&&_0x44f508[_0x602b('0x12')]!=='0'?_0x44f508[_0x602b('0x12')][_0x602b('0x13')](','):[_0x602b('0x14')];_0x4ab738[_0x602b('0x15')]=_[_0x602b('0x16')](_0xf4405f,function(_0xc76409){var _0x3d34a0={};_0x3d34a0[_0xc76409]=_0x556ebe['routeId']?_0x556ebe['destcalleridnum']:_0x556ebe[_0x602b('0x17')];return _0x3d34a0;});_0x70ec42=_0x556ebe[_0x602b('0x18')]?_0x556ebe[_0x602b('0x19')]:_0x556ebe['calleridnum'];}var _0x1cd44d=['id',_0x602b('0x1a'),'lastName','phone',_0x602b('0x1b'),_0x602b('0x1c'),'ListId',_0x602b('0x1d'),_0x602b('0x1e'),_0x602b('0x1f')];var _0x5858d0=_[_0x602b('0x20')](_0x1cd44d,_0xf4405f);BPromise[_0x602b('0x21')]()[_0x602b('0x22')](cmContactRpc[_0x602b('0x23')]({'attributes':_0x5858d0,'where':_0x4ab738,'phone':_0x70ec42}))[_0x602b('0x22')](function(_0x43ff46){_0x315016=_0x43ff46;if(!_[_0x602b('0x24')](_0x315016)){if(_0x315016[_0x602b('0x25')]===0x1){_0xc58337=_0x315016[0x0];logger[_0x602b('0xb')](_0x602b('0x26'),_0x556ebe[_0x602b('0x27')],_0x2f7f57['id'],_0xc58337['id']);}else{logger[_0x602b('0xb')](_0x602b('0x28'),_0x556ebe[_0x602b('0x27')],_0x2f7f57['id'],_['map'](_0x315016,'id')[_0x602b('0x29')](','));}return;}else{logger[_0x602b('0xb')](_0x602b('0x2a'),_0x556ebe['uniqueid'],_0x2f7f57['id']);var _0x1606fc={'ListId':_0x4545a0};var _0x467df2=_0x44f508['data4']&&_0x44f508[_0x602b('0x2b')]!=='0'?_0x44f508[_0x602b('0x2b')]:_0x602b('0x14');if(_0x1ba63b){logger[_0x602b('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x556ebe[_0x602b('0x27')],_0x2f7f57['id']);_0x1606fc[_0x467df2]=_[_0x602b('0xe')](_0x556ebe['routeId'])?_0x556ebe['calleridnum']:_0x556ebe[_0x602b('0x19')];if(_[_0x602b('0xe')](_0x556ebe[_0x602b('0x18')])){_0x1606fc[_0x602b('0x1a')]=_0x556ebe[_0x602b('0x2c')]&&_0x556ebe[_0x602b('0x2c')]!==_0x602b('0x2d')?_0x556ebe[_0x602b('0x2c')]:_0x602b('0x2e');}else{_0x1606fc[_0x602b('0x1a')]=_0x556ebe[_0x602b('0x2f')]&&_0x556ebe[_0x602b('0x2f')]!==_0x602b('0x2d')?_0x556ebe[_0x602b('0x2f')]:_0x602b('0x2e');}return BPromise['resolve']()[_0x602b('0x22')](cmContactRpc[_0x602b('0x30')](_0x1606fc))['then'](function(_0x524d6c){_0xc58337=_0x524d6c;_0x315016[_0x602b('0x31')](_0x524d6c);if(_0xc58337){logger[_0x602b('0xb')](_0x602b('0x32'),_0x556ebe[_0x602b('0x27')],_0x2f7f57['id'],_0xc58337['id']);}return;});}else{logger['info'](_0x602b('0x33'),_0x556ebe[_0x602b('0x27')],_0x2f7f57['id']);_0x1606fc[_0x467df2]=_['isNil'](_0x556ebe[_0x602b('0x18')])?_0x556ebe[_0x602b('0x17')]:_0x556ebe[_0x602b('0x19')];if(_['isNil'](_0x556ebe[_0x602b('0x18')])){_0x1606fc['firstName']=_0x556ebe[_0x602b('0x2c')]&&_0x556ebe[_0x602b('0x2c')]!==''?_0x556ebe[_0x602b('0x2c')]:_0x602b('0x2e');}else{_0x1606fc[_0x602b('0x1a')]=_0x556ebe[_0x602b('0x2f')]&&_0x556ebe[_0x602b('0x2f')]!==_0x602b('0x2d')?_0x556ebe[_0x602b('0x2f')]:_0x602b('0x2e');}_0xc58337=_0x1606fc;_0x315016[_0x602b('0x31')](_0x1606fc);return;}}})[_0x602b('0x22')](function(){if(_0x95ea61){emit(_0x556ebe['uniqueid'],_0x2f7f57,util[_0x602b('0x34')]('user:%s',_0x95ea61[_0x602b('0x35')]),util[_0x602b('0x34')](_0x602b('0x36'),_0x44f508[_0x602b('0x37')][_0x602b('0x38')]()),{'evt':_[_0x602b('0x39')](_0x556ebe,{'autoCreate':_0x1ba63b}),'contact':_0xc58337===undefined?{}:_0xc58337,'contacts':_0x315016[_0x602b('0x25')]===0x0?undefined:_0x315016});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index aeb9dac..4f283f6 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 _0x3383=['length','action','toLowerCase','motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','windowWidth','data5','800','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','contactmanager','integration','exec','urlforward','script','parse','query','replace','channel','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','inspect','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','queue','agent','membername','lastevent','routeId','substatus','offlineMessage','equals','exports','util','lodash','url','mustache','./urlforward','./cmContact','./script','trigger','../ami','redis','defaults','localhost','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','custom:agentconnect','bind','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','clone','undefined','voice','debug','checkTriggers','prototype','interface','hasOwnProperty','status','merge','variables','Actions'];(function(_0x2300fa,_0x41c382){var _0x11fef0=function(_0x597ffb){while(--_0x597ffb){_0x2300fa['push'](_0x2300fa['shift']());}};_0x11fef0(++_0x41c382);}(_0x3383,0x1a7));var _0x3338=function(_0x8048e,_0x35f5f0){_0x8048e=_0x8048e-0x0;var _0x2a6396=_0x3383[_0x8048e];return _0x2a6396;};'use strict';var util=require(_0x3338('0x0'));var _=require(_0x3338('0x1'));var url=require(_0x3338('0x2'));var Mustache=require(_0x3338('0x3'));var Redis=require('ioredis');var urlforward=require(_0x3338('0x4'));var integration=require('./integration');var cmContact=require(_0x3338('0x5'));var script=require(_0x3338('0x6'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3338('0x7'));var ami=require(_0x3338('0x8'));config[_0x3338('0x9')]=_[_0x3338('0xa')](config['redis'],{'host':_0x3338('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3338('0x9')]));var operators={'equals':function(_0x3eab10,_0xaeb40f){return _0x3eab10==_0xaeb40f;},'not_equals':function(_0x5ee8a6,_0x522e5e){return _0x5ee8a6!=_0x522e5e;}};var barAndWebActions=['popup','url','winapp'];function Trigger(_0x409d61){this[_0x3338('0xc')]=_0x409d61['triggers'];this['agents']=_0x409d61[_0x3338('0xd')];this['voiceQueues']=_0x409d61['voiceQueues'];this[_0x3338('0xe')]=_0x409d61['templates'];this['voiceExtensions']=_0x409d61[_0x3338('0xf')];this[_0x3338('0x10')]=_0x409d61[_0x3338('0x10')];this[_0x3338('0x11')]=_0x409d61[_0x3338('0x11')];this['salesforceAccounts']=_0x409d61[_0x3338('0x12')];this['sugarcrmAccounts']=_0x409d61[_0x3338('0x13')];this[_0x3338('0x14')]=_0x409d61[_0x3338('0x14')];this[_0x3338('0x15')]=_0x409d61[_0x3338('0x15')];this[_0x3338('0x16')]=_0x409d61['vtigerAccounts'];this[_0x3338('0x17')]=_0x409d61[_0x3338('0x17')];this[_0x3338('0x18')]=_0x409d61[_0x3338('0x18')];this[_0x3338('0x19')]=_0x409d61[_0x3338('0x19')];this[_0x3338('0x1a')]={'zendesk':this[_0x3338('0x10')],'salesforce':this[_0x3338('0x12')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x3338('0x13')],'zoho':this[_0x3338('0x14')],'desk':this[_0x3338('0x15')],'vtiger':this[_0x3338('0x16')],'dynamics365':this[_0x3338('0x18')],'freshsales':this[_0x3338('0x19')],'servicenow':this[_0x3338('0x17')]};ami['on']('custom:agentcalled',this[_0x3338('0x1b')]['bind'](this));ami['on'](_0x3338('0x1c'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on']('custom:agentringnoanswer',this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on']('custom:agentcomplete',this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x1e'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x1f'),this['syncCustomEvent'][_0x3338('0x1d')](this));ami['on'](_0x3338('0x20'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x21'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x22'),this['syncCustomEvent'][_0x3338('0x1d')](this));ami['on'](_0x3338('0x23'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on']('custom:queuecallerabandon',this[_0x3338('0x1b')]['bind'](this));ami['on'](_0x3338('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x3338('0x25'),this[_0x3338('0x26')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x27'),this[_0x3338('0x26')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x28'),this[_0x3338('0x26')][_0x3338('0x1d')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x3338('0x1d')](this));ami['on'](_0x3338('0x29'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x2a'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x2b'),this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on'](_0x3338('0x2c'),this['syncCustomEvent'][_0x3338('0x1d')](this));ami['on'](_0x3338('0x2d'),this['syncCustomEvent'][_0x3338('0x1d')](this));ami['on']('custom:rejectmessage',this[_0x3338('0x1b')][_0x3338('0x1d')](this));ami['on']('custom:offlineMessage',this[_0x3338('0x1b')][_0x3338('0x1d')](this));}Trigger['prototype'][_0x3338('0x2e')]=function(_0x373e6c,_0x9c2dd4,_0x3ab806){logger[_0x3338('0x2f')](_0x373e6c,_0x9c2dd4,JSON[_0x3338('0x30')](_0x3ab806));io['to'](_0x373e6c)[_0x3338('0x2e')](_0x9c2dd4,_0x3ab806);};Trigger['prototype']['syncCustomEvent']=function(_0x4505b2){var _0x36c45d=_[_0x3338('0x31')](_0x4505b2);if(typeof _0x36c45d['motionChannel']===_0x3338('0x32')){_0x36c45d['motionChannel']=_0x3338('0x33');}logger[_0x3338('0x34')](_0x3338('0x1b'),util['inspect'](_0x36c45d,{'showHidden':!![],'depth':null}));this[_0x3338('0x35')](_0x36c45d);};Trigger[_0x3338('0x36')][_0x3338('0x26')]=function(_0x401f29){if(this[_0x3338('0xd')][_0x401f29[_0x3338('0x37')]]){this[_0x3338('0x1b')](_0x401f29);}};Trigger['prototype'][_0x3338('0x35')]=function(_0x60aa28){var _0x46423f;for(var _0x2370bf in this['triggers']){if(this[_0x3338('0xc')][_0x3338('0x38')](_0x2370bf)){if(this[_0x3338('0xc')][_0x2370bf][_0x3338('0x39')]){_0x46423f=this['checkTrigger'](this[_0x3338('0xc')][_0x2370bf],_0x60aa28);if(_0x46423f){_[_0x3338('0x3a')](_0x60aa28,_0x60aa28[_0x3338('0x3b')]);for(var _0xa0533d=0x0,_0x5d61c6,_0x3a71fd,_0x22da89;_0xa0533d0x0){_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 _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x2a503a,_0x1a9a98){var _0x3a558b=function(_0x5de43c){while(--_0x5de43c){_0x2a503a['push'](_0x2a503a['shift']());}};_0x3a558b(++_0x1a9a98);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index a5a5ede..9dde1f6 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 _0x506e=[']\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','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','data7','data2','data5','clientId','username','password','clientSecret','then','access_token','catch','error','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','email','userEmail','length','internalemailaddress','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','POST','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','customField','indexOf','content','ticketType','incidents','assign','getString','Subjects','phonecall','/contacts(','callDirection','queue','phonecalls','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]'];(function(_0x24b0ab,_0x19de60){var _0x12112c=function(_0x3977d9){while(--_0x3977d9){_0x24b0ab['push'](_0x24b0ab['shift']());}};_0x12112c(++_0x19de60);}(_0x506e,0x13e));var _0xe506=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x506e[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var rp=require(_0xe506('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xe506('0x1'));var logger=require(_0xe506('0x2'))(_0xe506('0x3'));var config=require(_0xe506('0x4'));config[_0xe506('0x5')]=_[_0xe506('0x6')](config[_0xe506('0x5')],{'host':_0xe506('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe506('0x5')]));function getAuthToken(_0x326773,_0x47ffda,_0x284b97){if(_0x326773[_0xe506('0x8')]){_0x326773[_0xe506('0x9')]=_0x326773[_0xe506('0xa')][_0xe506('0xb')];_0x326773['tenantId']=_0x326773[_0xe506('0xa')][_0xe506('0xc')];return Promise['resolve'](_0x326773[_0xe506('0xa')][_0xe506('0xd')]);}var _0x3363dd={'method':'POST','uri':_0x47ffda,'form':{'client_id':_0x326773[_0xe506('0xe')],'resource':_0x326773[_0xe506('0x9')],'username':_0x326773[_0xe506('0xf')],'password':_0x326773['password'],'grant_type':_0xe506('0x10'),'client_secret':_0x326773[_0xe506('0x11')]},'json':!![]};return rp(_0x3363dd)[_0xe506('0x12')](function(_0x1028ae){return _0x1028ae[_0xe506('0x13')];})[_0xe506('0x14')](function(_0x2bdb46){logger[_0xe506('0x15')]('['+[_0x284b97['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2bdb46['message'];});}function getUser(_0x3085f7,_0x1c1079,_0x265505,_0xfd63d5,_0x4eb774,_0x4f8355){return new Promise(function(_0x147d0d,_0x4f58c3){return getAuthToken(_0x1c1079,_0xfd63d5,_0x4f8355)[_0xe506('0x12')](function(_0x5bf006){var _0x63ad46={'method':_0xe506('0x16'),'uri':_0x4eb774+_0xe506('0x17'),'headers':{'Authorization':_0xe506('0x18')+_0x5bf006,'OData-Version':'4.0'},'json':!![]};return rp(_0x63ad46);})[_0xe506('0x12')](function(_0x192a9e){var _0x5977da=_0x192a9e[_0xe506('0x19')];var _0x4a4720=![];var _0x12b586=null;if(!_['isNil'](_0x265505)){if(intUtil[_0xe506('0x1a')](_0x265505[_0xe506('0x1b')])){_0x3085f7[_0xe506('0x1c')]=_0x265505['email'];for(_0x12b586=0x0;_0x12b586<_0x5977da[_0xe506('0x1d')];_0x12b586++){if(_0x5977da[_0x12b586][_0xe506('0x1e')]===_0x265505['email']&&!_0x5977da[_0x12b586]['isdisabled']){_0x4a4720=!![];logger['info']('['+[_0x4f8355[_0xe506('0x1f')]()]+_0xe506('0x20')+_0x5977da[_0x12b586][_0xe506('0x21')]+'!');_0x3085f7[_0xe506('0x22')]=_0x5977da[_0x12b586]['systemuserid'];}}}}if(!_0x4a4720){logger[_0xe506('0x23')]('['+[_0x4f8355[_0xe506('0x1f')]()]+_0xe506('0x24'));_0x3085f7[_0xe506('0x1c')]=_0x1c1079[_0xe506('0xf')];for(_0x12b586=0x0;_0x12b586<_0x5977da['length'];_0x12b586++){if(_0x5977da[_0x12b586]['internalemailaddress']===_0x1c1079[_0xe506('0xf')]){_0x3085f7['userId']=_0x5977da[_0x12b586]['systemuserid'];}}}_0x147d0d(_0x3085f7);})[_0xe506('0x14')](function(_0x2b6673){_0x4f58c3(_0x2b6673[_0xe506('0x25')]);});});}function createEndUser(_0x24ad2a,_0x792cae,_0x3f2ba7,_0x4bec30,_0x59665e,_0x22254d,_0x36483d){return new Promise(function(_0x359807,_0x231f92){return getAuthToken(_0x792cae,_0x3f2ba7,_0x22254d)['then'](function(_0x27912f){var _0x139ffa=_0x22254d[_0xe506('0x26')]()===_0xe506('0x27')?_0x59665e[_0xe506('0x28')]:_0x59665e['calleridnum'];var _0x6ea9e0={'method':_0xe506('0x29'),'uri':_0x4bec30+'contacts','body':{'fullname':_0x139ffa,'firstname':_0x139ffa,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe506('0x2a')+_0x24ad2a[_0xe506('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x27912f,'OData-Version':_0xe506('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x6ea9e0[_0xe506('0x2c')][_0x36483d]=_0x139ffa;return rp(_0x6ea9e0);})[_0xe506('0x12')](function(_0x1f7838){var _0x48013c=_0x1f7838[_0xe506('0x2d')][_0xe506('0x2e')];var _0x1f15d2=_0x48013c[_0xe506('0x2f')](_0x48013c[_0xe506('0x30')]('(')+0x1,_0x48013c[_0xe506('0x30')](')'));_0x24ad2a[_0xe506('0x31')]=_0x1f15d2;_0x359807(_0x24ad2a);})['catch'](function(_0x529997){_0x231f92(_0x529997[_0xe506('0x25')]);});});}function getEndUser(_0x166d25,_0x28d811,_0x32ec03,_0x494879,_0x873cec,_0x49dcb5,_0x38ba30,_0x56585d){var _0x4e717f=_0x49dcb5[_0xe506('0x26')]()===_0xe506('0x27')?_0x873cec['destcalleridnum']:_0x873cec[_0xe506('0x32')];return getAuthToken(_0x28d811,_0x32ec03,_0x49dcb5)[_0xe506('0x12')](function(_0x52bd24){_0x56585d=_0x56585d?_0x56585d:_0xe506('0x33');var _0x29e822={'method':'GET','uri':_0x494879+_0xe506('0x34')+_0x56585d+'&$filter='+_0x56585d+_0xe506('0x35')+_0x4e717f[_0xe506('0x36')]('+','%2b')+'\x27','headers':{'Authorization':_0xe506('0x18')+_0x52bd24,'If-None-Match':null,'OData-Version':_0xe506('0x2b')},'json':!![]};return rp(_0x29e822);})['then'](function(_0x1e77b6){var _0x125cbd=![];if(!_0x1e77b6)return _0x125cbd;var _0x38daee=_0x1e77b6['value'];for(var _0x220822=0x0;_0x220822<_0x38daee[_0xe506('0x1d')];_0x220822++){if(_0x38daee[_0x220822][_0x56585d]===_0x4e717f){_0x125cbd=!![];_0x166d25[_0xe506('0x31')]=_0x38daee[_0x220822]['contactid'];}}return _0x125cbd;})['then'](function(_0x16e5ce){if(_0x16e5ce)return _0x166d25;if(_0x38ba30===_0xe506('0x37')){logger[_0xe506('0x23')]('['+[_0x49dcb5[_0xe506('0x1f')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x166d25;}return createEndUser(_0x166d25,_0x28d811,_0x32ec03,_0x494879,_0x873cec,_0x49dcb5,_0x56585d)[_0xe506('0x12')](function(_0x1e963b){logger[_0xe506('0x23')]('['+[_0x49dcb5['toUpperCase']()]+_0xe506('0x38'),_0x1e963b['enduserId']);return _0x1e963b;});});}function getCustomFields(_0x555c4b,_0x3049d5,_0x4bdffe){var _0x1a3543={};if(_0x555c4b[_0xe506('0x1d')]>0x0){_[_0xe506('0x39')](_0x555c4b,function(_0x38b98e){if(_['includes']([_0xe506('0x3a'),_0xe506('0x3b')],_0x38b98e[_0xe506('0x3c')])&&_0x38b98e['nameField']&&!_0x38b98e[_0xe506('0x3d')]){var _0x29a910=_0x38b98e['idField']['toLowerCase']();var _0x3f1f45=_0x29a910[_0xe506('0x2f')](0x0,_0x29a910['indexOf']('_'));var _0x546a21=_0x29a910[_0xe506('0x2f')](_0x29a910[_0xe506('0x3e')]('_')+0x1);if(_0x3f1f45===_0x4bdffe){_0x1a3543[_0x546a21]=_0x38b98e[_0xe506('0x3f')];}}});}return _0x1a3543;}function getTicket(_0x58d149,_0x1c48c1,_0x2b9843,_0x1b01e0,_0x285720,_0x892a5d,_0x18bbfe){return new Promise(function(_0x5f304f,_0x5958a6){var _0x24a55a;return getAuthToken(_0x1c48c1,_0x2b9843,_0x18bbfe)[_0xe506('0x12')](function(_0x234a20){if(_0x892a5d[_0xe506('0x40')]==='incident'){_0x24a55a={'method':_0xe506('0x29'),'uri':_0x1b01e0+_0xe506('0x41'),'body':Object[_0xe506('0x42')]({},{'title':intUtil[_0xe506('0x43')](_0x892a5d[_0xe506('0x44')],_0x285720,'\x20'),'description':intUtil['getString'](_0x892a5d['Descriptions'],_0x285720,'\x0a'),'customerid_contact@odata.bind':_0x58d149[_0xe506('0x31')]?'/contacts('+_0x58d149[_0xe506('0x31')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x58d149[_0xe506('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x892a5d['Fields'],_0x285720,_0x892a5d[_0xe506('0x40')])),'headers':{'Authorization':_0xe506('0x18')+_0x234a20,'OData-Version':_0xe506('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x892a5d['ticketType']===_0xe506('0x45')){var _0x3bbff2=_0x58d149[_0xe506('0x31')]?[{'partyid_systemuser@odata.bind':_0xe506('0x2a')+_0x58d149[_0xe506('0x22')]+')','participationtypemask':_0x58d149['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe506('0x46')+_0x58d149[_0xe506('0x31')]+')','participationtypemask':_0x58d149[_0xe506('0x47')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe506('0x2a')+_0x58d149['userId']+')','participationtypemask':_0x58d149[_0xe506('0x47')]===_0xe506('0x48')?0x2:0x1}];_0x24a55a={'method':_0xe506('0x29'),'uri':_0x1b01e0+_0xe506('0x49'),'body':Object[_0xe506('0x42')]({},{'subject':intUtil['getString'](_0x892a5d[_0xe506('0x44')],_0x285720,'\x20'),'phonenumber':String(_0x285720[_0xe506('0x32')]),'description':intUtil[_0xe506('0x43')](_0x892a5d[_0xe506('0x4a')],_0x285720,'\x0a'),'regardingobjectid_contact@odata.bind':_0x58d149[_0xe506('0x31')]?_0xe506('0x46')+_0x58d149['enduserId']+')':undefined,'ownerid@odata.bind':_0xe506('0x2a')+_0x58d149[_0xe506('0x22')]+')','directioncode':_0x58d149['callDirection']===_0xe506('0x48')?![]:!![],'phonecall_activity_parties':_0x3bbff2},getCustomFields(_0x892a5d['Fields'],_0x285720,_0x892a5d[_0xe506('0x40')])),'headers':{'Authorization':_0xe506('0x18')+_0x234a20,'OData-Version':_0xe506('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x24a55a);})['then'](function(_0x5b27c5){var _0x51edb3=_0x5b27c5[_0xe506('0x2d')][_0xe506('0x2e')];var _0x2a9d8a=_0x51edb3[_0xe506('0x2f')](_0x51edb3[_0xe506('0x30')]('(')+0x1,_0x51edb3[_0xe506('0x30')](')'));_0x58d149[_0xe506('0x4b')]=_0x2a9d8a;_0x5f304f(_0x58d149);})['catch'](function(_0x1915ad){_0x5958a6(_0x1915ad[_0xe506('0x25')]);});});}function emit(_0x4d5afe,_0x45a36c,_0x35a1a1,_0x3747f2){var _0xe4a530={'uri':util[_0xe506('0x4c')](_0xe506('0x4d'),_0x4d5afe,_0x35a1a1,_0x3747f2)};io['to'](util[_0xe506('0x4c')]('user:%s',_0x45a36c))['emit'](_0xe506('0x4e'),_0xe4a530);}exports['cs']=function(_0x1368de,_0x5c3fc8,_0x543c2b,_0x17f364,_0x2f64af,_0x51fab8,_0x1f4183,_0x49a33d){var _0x579802={};_0x51fab8[_0xe506('0x9')]=_0x51fab8[_0xe506('0x8')]?intUtil[_0xe506('0x4f')](_0x51fab8[_0xe506('0xa')][_0xe506('0xb')]):intUtil[_0xe506('0x4f')](_0x51fab8[_0xe506('0x9')]);_0x51fab8[_0xe506('0x50')]=intUtil[_0xe506('0x4f')](_0x51fab8[_0xe506('0x50')]);_0x579802[_0xe506('0x47')]=_0x49a33d==='queue'||_0x49a33d==='unmanaged'?_0xe506('0x48'):_0xe506('0x27');var _0x28c292=_0x51fab8['modernAuthentication']?util['format'](_0xe506('0x51'),_0x51fab8[_0xe506('0xa')][_0xe506('0xb')]):util[_0xe506('0x4c')]('%s/api/data/v9.0/',_0x51fab8[_0xe506('0x9')]);var _0x16ca0f=util[_0xe506('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x51fab8['tenantId']);var _0x97f7b5=util[_0xe506('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51fab8[_0xe506('0x50')],_0x5c3fc8[_0xe506('0x52')],md5(_0x5c3fc8['uniqueid']));if(_0x2f64af&&_0x2f64af[_0xe506('0x53')]){logger[_0xe506('0x23')](_0xe506('0x54'),_0xe506('0x55'));_0x5c3fc8[_0xe506('0x56')]=_0x97f7b5;}else if(_0x1f4183&&_0x1f4183[_0xe506('0x57')]&&_0x1f4183[_0xe506('0x57')]!==_0xe506('0x58')){logger[_0xe506('0x23')](_0xe506('0x59'),'Recording\x20is\x20enabled!');_0x5c3fc8[_0xe506('0x56')]=_0x97f7b5;}else{_0x5c3fc8[_0xe506('0x56')]='';}return getUser(_0x579802,_0x51fab8,_0x17f364,_0x16ca0f,_0x28c292,_0x49a33d)[_0xe506('0x12')](function(_0x5f72b1){logger[_0xe506('0x23')]('['+_0x49a33d[_0xe506('0x1f')]()+_0xe506('0x5a'),_0x5f72b1['userId']);logger['info']('['+_0x49a33d[_0xe506('0x1f')]()+_0xe506('0x5b'),_0x5f72b1[_0xe506('0x1c')]);return getEndUser(_0x5f72b1,_0x51fab8,_0x16ca0f,_0x28c292,_0x5c3fc8,_0x49a33d,_0x543c2b[_0xe506('0x5c')],_0x543c2b[_0xe506('0x5d')]);})[_0xe506('0x12')](function(_0x52dc7e){logger[_0xe506('0x23')]('['+_0x49a33d[_0xe506('0x1f')]()+_0xe506('0x5e'),_0x52dc7e[_0xe506('0x31')]);logger[_0xe506('0x23')]('['+_0x49a33d['toUpperCase']()+_0xe506('0x5f'),_0x5c3fc8[_0xe506('0x32')]);return getTicket(_0x52dc7e,_0x51fab8,_0x16ca0f,_0x28c292,_0x5c3fc8,_0x543c2b,_0x49a33d);})[_0xe506('0x12')](function(_0x3d05b9){logger[_0xe506('0x23')](util[_0xe506('0x4c')]('['+_0x49a33d[_0xe506('0x1f')]()+_0xe506('0x60'),_0x543c2b[_0xe506('0x40')],_0x3d05b9[_0xe506('0x4b')]));logger[_0xe506('0x23')](util[_0xe506('0x4c')]('['+_0x49a33d['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x49a33d));if(_0x49a33d!=='unmanaged'&&_0x543c2b[_0xe506('0x61')]){logger['info']('['+_0x49a33d[_0xe506('0x1f')]()+']',_0xe506('0x62'));emit(_0x51fab8[_0xe506('0x9')],_0x17f364[_0xe506('0x63')],_0x543c2b['ticketType'],_0x3d05b9['ticketId']);}})['catch'](function(_0x412759){logger[_0xe506('0x15')]('['+_0x49a33d[_0xe506('0x1f')]()+_0xe506('0x64'),_0x412759['message']);console[_0xe506('0x15')](_0xe506('0x65'),_0x412759);});}; \ No newline at end of file +var _0x5f58=['../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','clientId','username','password','clientSecret','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','phonecall','queue','callDirection','Descriptions','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','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','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5'];(function(_0x10620f,_0x234cee){var _0x3822a5=function(_0x57abf8){while(--_0x57abf8){_0x10620f['push'](_0x10620f['shift']());}};_0x3822a5(++_0x234cee);}(_0x5f58,0x157));var _0x85f5=function(_0x16bd44,_0x3c91ba){_0x16bd44=_0x16bd44-0x0;var _0x368a61=_0x5f58[_0x16bd44];return _0x368a61;};'use strict';var _=require(_0x85f5('0x0'));var rp=require(_0x85f5('0x1'));var util=require(_0x85f5('0x2'));var intUtil=require(_0x85f5('0x3'));var md5=require(_0x85f5('0x4'));var Redis=require('ioredis');var logger=require(_0x85f5('0x5'))(_0x85f5('0x6'));var config=require('../../../../config/environment');config[_0x85f5('0x7')]=_[_0x85f5('0x8')](config[_0x85f5('0x7')],{'host':_0x85f5('0x9'),'port':0x18eb});var io=require(_0x85f5('0xa'))(new Redis(config['redis']));function getAuthToken(_0x283bbd,_0x4c7c00,_0x4e3d5d){if(_0x283bbd['modernAuthentication']){_0x283bbd[_0x85f5('0xb')]=_0x283bbd['CloudProvider'][_0x85f5('0xc')];_0x283bbd[_0x85f5('0xd')]=_0x283bbd[_0x85f5('0xe')][_0x85f5('0xf')];return Promise[_0x85f5('0x10')](_0x283bbd[_0x85f5('0xe')][_0x85f5('0x11')]);}var _0x12b9d2={'method':'POST','uri':_0x4c7c00,'form':{'client_id':_0x283bbd[_0x85f5('0x12')],'resource':_0x283bbd[_0x85f5('0xb')],'username':_0x283bbd[_0x85f5('0x13')],'password':_0x283bbd[_0x85f5('0x14')],'grant_type':_0x85f5('0x14'),'client_secret':_0x283bbd[_0x85f5('0x15')]},'json':!![]};return rp(_0x12b9d2)['then'](function(_0x89d77f){return _0x89d77f['access_token'];})[_0x85f5('0x16')](function(_0xe37c8a){logger[_0x85f5('0x17')]('['+[_0x4e3d5d['toUpperCase']()]+_0x85f5('0x18'));return _0xe37c8a[_0x85f5('0x19')];});}function getUser(_0x23ae8b,_0x5e2008,_0x44738f,_0x322da5,_0x3c2664,_0x291028){return new Promise(function(_0x504673,_0x4d969f){return getAuthToken(_0x5e2008,_0x322da5,_0x291028)[_0x85f5('0x1a')](function(_0x39be52){var _0x120742={'method':_0x85f5('0x1b'),'uri':_0x3c2664+_0x85f5('0x1c'),'headers':{'Authorization':_0x85f5('0x1d')+_0x39be52,'OData-Version':_0x85f5('0x1e')},'json':!![]};return rp(_0x120742);})[_0x85f5('0x1a')](function(_0x485cc3){var _0x34a32f=_0x485cc3[_0x85f5('0x1f')];var _0xcf0dc5=![];var _0x3739d8=null;if(!_[_0x85f5('0x20')](_0x44738f)){if(intUtil[_0x85f5('0x21')](_0x44738f[_0x85f5('0x22')])){_0x23ae8b['userEmail']=_0x44738f['email'];for(_0x3739d8=0x0;_0x3739d8<_0x34a32f[_0x85f5('0x23')];_0x3739d8++){if(_0x34a32f[_0x3739d8][_0x85f5('0x24')]===_0x44738f[_0x85f5('0x22')]&&!_0x34a32f[_0x3739d8][_0x85f5('0x25')]){_0xcf0dc5=!![];logger['info']('['+[_0x291028[_0x85f5('0x26')]()]+_0x85f5('0x27')+_0x34a32f[_0x3739d8][_0x85f5('0x28')]+'!');_0x23ae8b[_0x85f5('0x29')]=_0x34a32f[_0x3739d8][_0x85f5('0x28')];}}}}if(!_0xcf0dc5){logger[_0x85f5('0x2a')]('['+[_0x291028[_0x85f5('0x26')]()]+_0x85f5('0x2b'));_0x23ae8b[_0x85f5('0x2c')]=_0x5e2008[_0x85f5('0x13')];for(_0x3739d8=0x0;_0x3739d8<_0x34a32f[_0x85f5('0x23')];_0x3739d8++){if(_0x34a32f[_0x3739d8][_0x85f5('0x24')]===_0x5e2008[_0x85f5('0x13')]){_0x23ae8b[_0x85f5('0x29')]=_0x34a32f[_0x3739d8][_0x85f5('0x28')];}}}_0x504673(_0x23ae8b);})[_0x85f5('0x16')](function(_0x3d2823){_0x4d969f(_0x3d2823['message']);});});}function createEndUser(_0xad64ec,_0x34c146,_0x2d3310,_0x1d6a4c,_0x89cfe0,_0x2b6a18,_0x5574c5){return new Promise(function(_0x3c68c8,_0x3cbd78){return getAuthToken(_0x34c146,_0x2d3310,_0x2b6a18)[_0x85f5('0x1a')](function(_0x75fe5d){var _0x2efa73=_0x2b6a18[_0x85f5('0x2d')]()===_0x85f5('0x2e')?_0x89cfe0[_0x85f5('0x2f')]:_0x89cfe0[_0x85f5('0x30')];var _0x432fef={'method':_0x85f5('0x31'),'uri':_0x1d6a4c+'contacts','body':{'fullname':_0x2efa73,'firstname':_0x2efa73,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x85f5('0x32')+_0xad64ec[_0x85f5('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x75fe5d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x432fef[_0x85f5('0x33')][_0x5574c5]=_0x2efa73;return rp(_0x432fef);})[_0x85f5('0x1a')](function(_0x10907d){var _0x5b66cc=_0x10907d[_0x85f5('0x34')][_0x85f5('0x35')];var _0x11f6ab=_0x5b66cc['substring'](_0x5b66cc['lastIndexOf']('(')+0x1,_0x5b66cc[_0x85f5('0x36')](')'));_0xad64ec[_0x85f5('0x37')]=_0x11f6ab;_0x3c68c8(_0xad64ec);})[_0x85f5('0x16')](function(_0x35587a){_0x3cbd78(_0x35587a[_0x85f5('0x19')]);});});}function getEndUser(_0x4489cd,_0x5dfe97,_0x54bc62,_0x4d788d,_0x44df08,_0x16832f,_0x54120c,_0x446f15){var _0x53bad1=_0x16832f[_0x85f5('0x2d')]()===_0x85f5('0x2e')?_0x44df08[_0x85f5('0x2f')]:_0x44df08[_0x85f5('0x30')];return getAuthToken(_0x5dfe97,_0x54bc62,_0x16832f)[_0x85f5('0x1a')](function(_0x3cc79b){_0x446f15=_0x446f15?_0x446f15:_0x85f5('0x38');var _0x58f5c9={'method':'GET','uri':_0x4d788d+_0x85f5('0x39')+_0x446f15+_0x85f5('0x3a')+_0x446f15+_0x85f5('0x3b')+_0x53bad1[_0x85f5('0x3c')]('+',_0x85f5('0x3d'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x3cc79b,'If-None-Match':null,'OData-Version':_0x85f5('0x1e')},'json':!![]};return rp(_0x58f5c9);})[_0x85f5('0x1a')](function(_0x169bd6){var _0x330bb8=![];if(!_0x169bd6)return _0x330bb8;var _0x5f41d2=_0x169bd6['value'];for(var _0xb11d82=0x0;_0xb11d82<_0x5f41d2['length'];_0xb11d82++){if(_0x5f41d2[_0xb11d82][_0x446f15]===_0x53bad1){_0x330bb8=!![];_0x4489cd['enduserId']=_0x5f41d2[_0xb11d82][_0x85f5('0x3e')];}}return _0x330bb8;})[_0x85f5('0x1a')](function(_0x28bf6a){if(_0x28bf6a)return _0x4489cd;if(_0x54120c===_0x85f5('0x3f')){logger[_0x85f5('0x2a')]('['+[_0x16832f['toUpperCase']()]+_0x85f5('0x40'));return _0x4489cd;}return createEndUser(_0x4489cd,_0x5dfe97,_0x54bc62,_0x4d788d,_0x44df08,_0x16832f,_0x446f15)[_0x85f5('0x1a')](function(_0x389c2d){logger[_0x85f5('0x2a')]('['+[_0x16832f[_0x85f5('0x26')]()]+_0x85f5('0x41'),_0x389c2d['enduserId']);return _0x389c2d;});});}function getCustomFields(_0x73938,_0x5045e5,_0xc8a9f8){var _0x4904b5={};if(_0x73938[_0x85f5('0x23')]>0x0){_[_0x85f5('0x42')](_0x73938,function(_0x34501d){if(_[_0x85f5('0x43')]([_0x85f5('0x44'),_0x85f5('0x45')],_0x34501d[_0x85f5('0x46')])&&_0x34501d[_0x85f5('0x47')]&&!_0x34501d[_0x85f5('0x48')]){var _0x1d5534=_0x34501d[_0x85f5('0x49')][_0x85f5('0x2d')]();var _0x282fcb=_0x1d5534[_0x85f5('0x4a')](0x0,_0x1d5534[_0x85f5('0x4b')]('_'));var _0x14eb25=_0x1d5534[_0x85f5('0x4a')](_0x1d5534[_0x85f5('0x4b')]('_')+0x1);if(_0x282fcb===_0xc8a9f8){_0x4904b5[_0x14eb25]=_0x34501d['content'];}}});}return _0x4904b5;}function getTicket(_0x129907,_0xa8cf,_0x29321a,_0x540936,_0x5b9dbe,_0x3480c6,_0x52eb3b){return new Promise(function(_0x594d20,_0x244045){var _0x1cfe42;return getAuthToken(_0xa8cf,_0x29321a,_0x52eb3b)[_0x85f5('0x1a')](function(_0x262bfa){if(_0x3480c6[_0x85f5('0x4c')]===_0x85f5('0x4d')){_0x1cfe42={'method':_0x85f5('0x31'),'uri':_0x540936+_0x85f5('0x4e'),'body':Object[_0x85f5('0x4f')]({},{'title':intUtil[_0x85f5('0x50')](_0x3480c6[_0x85f5('0x51')],_0x5b9dbe,'\x20'),'description':intUtil[_0x85f5('0x50')](_0x3480c6['Descriptions'],_0x5b9dbe,'\x0a'),'customerid_contact@odata.bind':_0x129907[_0x85f5('0x37')]?_0x85f5('0x52')+_0x129907['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x129907['userId']+')','caseorigincode':'1'},getCustomFields(_0x3480c6['Fields'],_0x5b9dbe,_0x3480c6[_0x85f5('0x4c')])),'headers':{'Authorization':_0x85f5('0x1d')+_0x262bfa,'OData-Version':_0x85f5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3480c6[_0x85f5('0x4c')]===_0x85f5('0x53')){var _0x30d773=_0x129907['enduserId']?[{'partyid_systemuser@odata.bind':_0x85f5('0x32')+_0x129907['userId']+')','participationtypemask':_0x129907['callDirection']===_0x85f5('0x54')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x129907['enduserId']+')','participationtypemask':_0x129907[_0x85f5('0x55')]===_0x85f5('0x54')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x85f5('0x32')+_0x129907[_0x85f5('0x29')]+')','participationtypemask':_0x129907['callDirection']===_0x85f5('0x54')?0x2:0x1}];_0x1cfe42={'method':_0x85f5('0x31'),'uri':_0x540936+'phonecalls','body':Object[_0x85f5('0x4f')]({},{'subject':intUtil['getString'](_0x3480c6[_0x85f5('0x51')],_0x5b9dbe,'\x20'),'phonenumber':String(_0x5b9dbe[_0x85f5('0x30')]),'description':intUtil[_0x85f5('0x50')](_0x3480c6[_0x85f5('0x56')],_0x5b9dbe,'\x0a'),'regardingobjectid_contact@odata.bind':_0x129907[_0x85f5('0x37')]?_0x85f5('0x52')+_0x129907[_0x85f5('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x129907[_0x85f5('0x29')]+')','directioncode':_0x129907['callDirection']===_0x85f5('0x54')?![]:!![],'phonecall_activity_parties':_0x30d773},getCustomFields(_0x3480c6[_0x85f5('0x57')],_0x5b9dbe,_0x3480c6['ticketType'])),'headers':{'Authorization':_0x85f5('0x1d')+_0x262bfa,'OData-Version':_0x85f5('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1cfe42);})[_0x85f5('0x1a')](function(_0x4221d2){var _0x488322=_0x4221d2['headers'][_0x85f5('0x35')];var _0x16f4d1=_0x488322[_0x85f5('0x4a')](_0x488322['lastIndexOf']('(')+0x1,_0x488322[_0x85f5('0x36')](')'));_0x129907[_0x85f5('0x58')]=_0x16f4d1;_0x594d20(_0x129907);})['catch'](function(_0xf0aed9){_0x244045(_0xf0aed9['message']);});});}function emit(_0x1c6b2f,_0x2a8104,_0x11267e,_0x21e776){var _0x2e5ab5={'uri':util['format'](_0x85f5('0x59'),_0x1c6b2f,_0x11267e,_0x21e776)};io['to'](util[_0x85f5('0x5a')](_0x85f5('0x5b'),_0x2a8104))[_0x85f5('0x5c')](_0x85f5('0x5d'),_0x2e5ab5);}exports['cs']=function(_0x21c959,_0x5d647e,_0x16c8d2,_0x3a41fe,_0x1fba2e,_0x3131a1,_0x14266f,_0x54014d){var _0x3ee8d4={};_0x3131a1[_0x85f5('0xb')]=_0x3131a1[_0x85f5('0x5e')]?intUtil[_0x85f5('0x5f')](_0x3131a1['CloudProvider']['data7']):intUtil[_0x85f5('0x5f')](_0x3131a1['remoteUri']);_0x3131a1[_0x85f5('0x60')]=intUtil['stripTrailingSlash'](_0x3131a1[_0x85f5('0x60')]);_0x3ee8d4[_0x85f5('0x55')]=_0x54014d==='queue'||_0x54014d===_0x85f5('0x61')?_0x85f5('0x54'):_0x85f5('0x2e');var _0x3736c5=_0x3131a1[_0x85f5('0x5e')]?util['format']('%s/api/data/v9.0/',_0x3131a1[_0x85f5('0xe')][_0x85f5('0xc')]):util['format'](_0x85f5('0x62'),_0x3131a1[_0x85f5('0xb')]);var _0x410032=util[_0x85f5('0x5a')](_0x85f5('0x63'),_0x3131a1['tenantId']);var _0x1471c1=util[_0x85f5('0x5a')](_0x85f5('0x64'),_0x3131a1[_0x85f5('0x60')],_0x5d647e['uniqueid'],md5(_0x5d647e[_0x85f5('0x65')]));if(_0x1fba2e&&_0x1fba2e['monitor_format']){logger['info']('[QUEUE]',_0x85f5('0x66'));_0x5d647e[_0x85f5('0x67')]=_0x1471c1;}else if(_0x14266f&&_0x14266f[_0x85f5('0x68')]&&_0x14266f[_0x85f5('0x68')]!==_0x85f5('0x69')){logger[_0x85f5('0x2a')](_0x85f5('0x6a'),_0x85f5('0x66'));_0x5d647e['recordingURL']=_0x1471c1;}else{_0x5d647e[_0x85f5('0x67')]='';}return getUser(_0x3ee8d4,_0x3131a1,_0x3a41fe,_0x410032,_0x3736c5,_0x54014d)['then'](function(_0x3571c9){logger[_0x85f5('0x2a')]('['+_0x54014d['toUpperCase']()+_0x85f5('0x6b'),_0x3571c9[_0x85f5('0x29')]);logger['info']('['+_0x54014d[_0x85f5('0x26')]()+']\x20The\x20User\x20email\x20is:',_0x3571c9['userEmail']);return getEndUser(_0x3571c9,_0x3131a1,_0x410032,_0x3736c5,_0x5d647e,_0x54014d,_0x16c8d2[_0x85f5('0x6c')],_0x16c8d2[_0x85f5('0x6d')]);})[_0x85f5('0x1a')](function(_0x1365b6){logger['info']('['+_0x54014d[_0x85f5('0x26')]()+_0x85f5('0x6e'),_0x1365b6[_0x85f5('0x37')]);logger[_0x85f5('0x2a')]('['+_0x54014d[_0x85f5('0x26')]()+_0x85f5('0x6f'),_0x5d647e[_0x85f5('0x30')]);return getTicket(_0x1365b6,_0x3131a1,_0x410032,_0x3736c5,_0x5d647e,_0x16c8d2,_0x54014d);})[_0x85f5('0x1a')](function(_0x271148){logger[_0x85f5('0x2a')](util[_0x85f5('0x5a')]('['+_0x54014d[_0x85f5('0x26')]()+_0x85f5('0x70'),_0x16c8d2[_0x85f5('0x4c')],_0x271148['ticketId']));logger[_0x85f5('0x2a')](util[_0x85f5('0x5a')]('['+_0x54014d[_0x85f5('0x26')]()+']\x20Call\x20direction:\x20%s',_0x54014d));if(_0x54014d!==_0x85f5('0x61')&&_0x16c8d2[_0x85f5('0x71')]){logger['info']('['+_0x54014d['toUpperCase']()+']',_0x85f5('0x72'));emit(_0x3131a1['remoteUri'],_0x3a41fe['name'],_0x16c8d2['ticketType'],_0x271148[_0x85f5('0x58')]);}})['catch'](function(_0x2c1d3c){logger['error']('['+_0x54014d['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2c1d3c[_0x85f5('0x19')]);console[_0x85f5('0x17')](_0x85f5('0x73'),_0x2c1d3c);});}; \ 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 9eb9f21..f1eebba 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 _0xf932=['The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','toUpperCase','lastevent','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','string','picklist','customField','nameField','toLowerCase','includes','type','idField','custom_fields','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x241982,_0x20e420){var _0x138000=function(_0x518218){while(--_0x518218){_0x241982['push'](_0x241982['shift']());}};_0x138000(++_0x20e420);}(_0xf932,0x12b));var _0x2f93=function(_0x1bd3a5,_0x390f95){_0x1bd3a5=_0x1bd3a5-0x0;var _0x28d3c5=_0xf932[_0x1bd3a5];return _0x28d3c5;};'use strict';var _=require('lodash');var rp=require(_0x2f93('0x0'));var md5=require('md5');var util=require(_0x2f93('0x1'));var Redis=require('ioredis');var intUtil=require(_0x2f93('0x2'));var config=require(_0x2f93('0x3'));var logger=require(_0x2f93('0x4'))(_0x2f93('0x5'));config[_0x2f93('0x6')]=_[_0x2f93('0x7')](config[_0x2f93('0x6')],{'host':_0x2f93('0x8'),'port':0x18eb});var io=require(_0x2f93('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x2f93('0xa'),'Accept':_0x2f93('0xa')};function emit(_0x1a50ae,_0x5e7058,_0x2bbb73){io['to'](_0x1a50ae)[_0x2f93('0xb')](_0x5e7058,_0x2bbb73);}function getTicket(_0x475b3b,_0x225e31,_0x1be9ea,_0x555d86,_0x66092d){logger[_0x2f93('0xc')](_0x2f93('0xd'));var _0xa006fe=_[_0x2f93('0xe')]({'responder_id':_0x225e31['id'],'requester_id':_0x1be9ea['id'],'name':util[_0x2f93('0xf')]('Caller\x20-\x20%s',_0x66092d['calleridname']),'phone':_0x66092d[_0x2f93('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2f93('0x11')](_0x555d86[_0x2f93('0x12')],_0x66092d,'\x20'),'description':intUtil[_0x2f93('0x11')](_0x555d86[_0x2f93('0x13')],_0x66092d,_0x2f93('0x14')),'tags':getTags(_0x555d86[_0x2f93('0x15')],_0x2f93('0x16'))},getCustomFields(_0x555d86[_0x2f93('0x17')],_0x66092d));_0xa006fe['custom_fields']=_[_0x2f93('0x18')](_[_0x2f93('0x19')](_0xa006fe['custom_fields'],'id'),_0x2f93('0x1a'));return request({'uri':util[_0x2f93('0xf')](_0x2f93('0x1b'),_0x475b3b[_0x2f93('0x1c')]),'method':_0x2f93('0x1d'),'body':_0xa006fe})['then'](function(_0x2c167c){logger['info']('Ticket\x20created!');return _0x2c167c;});}function getUser(_0xa614cd,_0x3a9af1){if(intUtil[_0x2f93('0x1e')](_0x3a9af1)){return request({'uri':util[_0x2f93('0xf')](_0x2f93('0x1f'),_0xa614cd[_0x2f93('0x1c')]),'qs':{'email':_0x3a9af1}})[_0x2f93('0x20')](function(_0x331e8e){if(_0x331e8e[_0x2f93('0x21')]){logger['info'](_0x2f93('0x22'));return _[_0x2f93('0x23')](_0x331e8e,function(_0x392c2c){return _0x392c2c[_0x2f93('0x24')][_0x2f93('0x25')]===_0x3a9af1;});}else{logger[_0x2f93('0xc')](_0x2f93('0x26'));return request({'uri':util[_0x2f93('0xf')](_0x2f93('0x27'),_0xa614cd[_0x2f93('0x1c')])})['then'](function(_0x5045b0){logger[_0x2f93('0xc')](_0x2f93('0x28'));return _0x5045b0;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x2f93('0x27'),_0xa614cd['remoteUri'])})[_0x2f93('0x20')](function(_0x21cbaa){logger['info'](_0x2f93('0x28'));return _0x21cbaa;});}}function getEndUser(_0x2c2ca8,_0x2327d3,_0x197c75){logger[_0x2f93('0xc')](_0x2f93('0x29'),_0x197c75);return request({'uri':util[_0x2f93('0xf')](_0x2f93('0x2a'),_0x2c2ca8[_0x2f93('0x1c')]),'qs':{'phone':_0x197c75}})[_0x2f93('0x20')](function(_0x1763bb){if(_0x1763bb[_0x2f93('0x21')]){logger[_0x2f93('0xc')](_0x2f93('0x2b'));return _[_0x2f93('0x23')](_0x1763bb,{'phone':_0x197c75});}else{logger[_0x2f93('0xc')](_0x2f93('0x2c'));return request({'uri':util[_0x2f93('0xf')](_0x2f93('0x2a'),_0x2c2ca8['remoteUri']),'method':'POST','body':{'name':_0x2327d3,'phone':_0x197c75}})[_0x2f93('0x20')](function(_0x381caa){logger[_0x2f93('0xc')](_0x2f93('0x2d'));return _0x381caa;});}});}function getAuth(_0x998de8){return util[_0x2f93('0xf')]('Basic\x20%s',new Buffer(_0x998de8[_0x2f93('0x2e')]+':X')[_0x2f93('0x2f')](_0x2f93('0x30')));}function request(_0x552e0b){logger[_0x2f93('0x31')](_0x2f93('0x32'),JSON['stringify'](_0x552e0b));return rp(_[_0x2f93('0x7')](_0x552e0b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x422aa7,_0x225c82){var _0x2884b7=[];if(_0x422aa7&&_0x422aa7['length']>0x0){_0x2884b7=_['map'](_0x422aa7,_0x225c82);}return _0x2884b7;}function getCustomFields(_0x38e0cf,_0x306fa8){var _0x592807=[];var _0x42fe25={'custom_fields':[]};if(_0x38e0cf['length']>0x0){_['forEach'](_0x38e0cf,function(_0x2cb48f){if(_['includes']([_0x2f93('0x33'),_0x2f93('0x34')],_0x2cb48f['type'])&&_0x2cb48f['nameField']&&!_0x2cb48f[_0x2f93('0x35')]){_0x42fe25[_0x2cb48f[_0x2f93('0x36')][_0x2f93('0x37')]()]=_0x2cb48f['content'][_0x2f93('0x2f')]();}else if(_[_0x2f93('0x38')]([_0x2f93('0x33'),_0x2f93('0x34')],_0x2cb48f[_0x2f93('0x39')])&&_0x2cb48f[_0x2f93('0x3a')]&&_0x2cb48f[_0x2f93('0x35')]){_0x42fe25[_0x2f93('0x3b')][_0x2f93('0x3c')]({'id':_0x2cb48f[_0x2f93('0x3a')],'value':_0x2cb48f['content'][_0x2f93('0x2f')]()});}else if(_0x2cb48f[_0x2f93('0x39')]==='variable'&&_0x2cb48f['variableName']&&_0x2cb48f[_0x2f93('0x3a')]&&_0x2cb48f[_0x2f93('0x35')]){_0x306fa8[_0x2cb48f['variableName']]&&_0x42fe25[_0x2f93('0x3b')][_0x2f93('0x3c')]({'id':_0x2cb48f['idField'],'value':_0x306fa8[_0x2cb48f[_0x2f93('0x3d')]]['toString']()});}else if(_0x2cb48f['type']==='customVariable'&&_0x2cb48f[_0x2f93('0x3e')]&&_0x2cb48f[_0x2f93('0x3e')][_0x2f93('0x16')]&&_0x2cb48f[_0x2f93('0x3a')]&&_0x2cb48f[_0x2f93('0x35')]){_0x306fa8[_0x2cb48f[_0x2f93('0x3e')][_0x2f93('0x16')]['toLowerCase']()]&&_0x42fe25['custom_fields']['push']({'id':_0x2cb48f[_0x2f93('0x3a')],'value':_0x306fa8[_0x2cb48f[_0x2f93('0x3e')][_0x2f93('0x16')][_0x2f93('0x37')]()][_0x2f93('0x2f')]()});}});}return _0x42fe25;}exports[_0x2f93('0x3f')]=function(_0x11206f,_0x5447c5,_0x1cfef6,_0x1fe8ec,_0x58cba9,_0x3667ce){var _0x48face,_0x42d1d7;_0x3667ce[_0x2f93('0x1c')]=intUtil[_0x2f93('0x40')](_0x3667ce[_0x2f93('0x1c')]);_0x3667ce['serverUrl']=intUtil[_0x2f93('0x40')](_0x3667ce[_0x2f93('0x41')]);if(_0x58cba9&&_0x58cba9[_0x2f93('0x42')]){logger[_0x2f93('0xc')](_0x2f93('0x43'),_0x2f93('0x44'));_0x5447c5[_0x2f93('0x45')]=util[_0x2f93('0xf')](_0x2f93('0x46'),_0x3667ce[_0x2f93('0x41')],_0x5447c5[_0x2f93('0x47')],md5(_0x5447c5[_0x2f93('0x47')]));}else{_0x5447c5[_0x2f93('0x45')]='';}headers[_0x2f93('0x48')]=getAuth(_0x3667ce);return getUser(_0x3667ce,_0x1fe8ec[_0x2f93('0x25')])[_0x2f93('0x20')](function(_0x5e5bde){_0x48face=_0x5e5bde;logger[_0x2f93('0xc')](_0x2f93('0x49'),_0x48face['id']);return getEndUser(_0x3667ce,_0x5447c5[_0x2f93('0x4a')],_0x5447c5['calleridnum']);})[_0x2f93('0x20')](function(_0x458a60){_0x42d1d7=_0x458a60;logger[_0x2f93('0xc')](_0x2f93('0x4b'),_0x42d1d7['id']);return getTicket(_0x3667ce,_0x48face,_0x42d1d7,_0x1cfef6,_0x5447c5);})[_0x2f93('0x20')](function(_0x340b1){if(_0x340b1&&_0x340b1['id']){logger[_0x2f93('0xc')](_0x2f93('0x4c'));logger[_0x2f93('0xc')](_0x2f93('0x4d'),_0x340b1['id']);logger[_0x2f93('0xc')](_0x2f93('0x43'),_0x2f93('0x4e'));emit(util[_0x2f93('0xf')](_0x2f93('0x4f'),_0x1fe8ec[_0x2f93('0x16')]),_0x2f93('0x50'),{'uri':util[_0x2f93('0xf')](_0x2f93('0x51'),_0x3667ce[_0x2f93('0x1c')],_0x340b1['id'])});}})[_0x2f93('0x52')](function(_0x1f6f7f){logger[_0x2f93('0x53')](_0x2f93('0x43'),JSON[_0x2f93('0x54')](_0x1f6f7f));});};exports[_0x2f93('0x55')]=function(_0x31f467,_0x1d1430,_0x6f2804,_0x1e841a,_0x39639e,_0x2a08a3,_0x3a4833){var _0x32a571,_0x1af64a;_0x2a08a3[_0x2f93('0x1c')]=intUtil[_0x2f93('0x40')](_0x2a08a3[_0x2f93('0x1c')]);_0x2a08a3[_0x2f93('0x41')]=intUtil[_0x2f93('0x40')](_0x2a08a3['serverUrl']);if(_0x3a4833&&_0x3a4833[_0x2f93('0x56')]&&_0x3a4833[_0x2f93('0x56')]!==_0x2f93('0x57')){logger['info']('[OUTBOUND]',_0x2f93('0x44'));_0x1d1430['recordingURL']=util[_0x2f93('0xf')](_0x2f93('0x46'),_0x2a08a3['serverUrl'],_0x1d1430[_0x2f93('0x47')],md5(_0x1d1430[_0x2f93('0x47')]));}headers[_0x2f93('0x48')]=getAuth(_0x2a08a3);return getUser(_0x2a08a3,_0x1e841a[_0x2f93('0x25')])[_0x2f93('0x20')](function(_0x565d62){_0x32a571=_0x565d62;logger[_0x2f93('0xc')]('The\x20User\x20ID\x20is:',_0x32a571['id']);return getEndUser(_0x2a08a3,_0x1d1430[_0x2f93('0x58')],_0x1d1430[_0x2f93('0x59')]);})['then'](function(_0x5a41b2){_0x1af64a=_0x5a41b2;logger[_0x2f93('0xc')](_0x2f93('0x4b'),_0x1af64a['id']);return getTicket(_0x2a08a3,_0x32a571,_0x1af64a,_0x6f2804,_0x1d1430);})[_0x2f93('0x20')](function(_0x1ebaa7){if(_0x1ebaa7&&_0x1ebaa7['id']){logger[_0x2f93('0xc')]('Ticket\x20created!');logger[_0x2f93('0xc')](_0x2f93('0x4d'),_0x1ebaa7['id']);logger[_0x2f93('0xc')](_0x2f93('0x5a'),_0x2f93('0x4e'));emit(util[_0x2f93('0xf')](_0x2f93('0x4f'),_0x1e841a['name']),'trigger:browser:url',{'uri':util[_0x2f93('0xf')](_0x2f93('0x51'),_0x2a08a3[_0x2f93('0x1c')],_0x1ebaa7['id'])});}})[_0x2f93('0x52')](function(_0x1c7da2){logger[_0x2f93('0x53')](_0x2f93('0x5a'),JSON[_0x2f93('0x54')](_0x1c7da2));});};exports['unmanaged']=function(_0x27e4e4,_0x9549df,_0x1a3bc7,_0x176dd2,_0x5ea1b5,_0x520e58){var _0x383ed8,_0xdd4626;_0x520e58['remoteUri']=intUtil['stripTrailingSlash'](_0x520e58[_0x2f93('0x1c')]);_0x520e58['serverUrl']=intUtil[_0x2f93('0x40')](_0x520e58[_0x2f93('0x41')]);if(_0x5ea1b5&&_0x5ea1b5['monitor_format']){logger[_0x2f93('0xc')]('['+_0x9549df['lastevent'][_0x2f93('0x5b')]()+']','Recording\x20is\x20enabled!');_0x9549df['recordingURL']=util[_0x2f93('0xf')](_0x2f93('0x46'),_0x520e58['serverUrl'],_0x9549df['uniqueid'],md5(_0x9549df[_0x2f93('0x47')]));}else{_0x9549df['recordingURL']='';}headers[_0x2f93('0x48')]=getAuth(_0x520e58);return getUser(_0x520e58,'')['then'](function(_0x5b9d87){_0x383ed8=_0x5b9d87;logger[_0x2f93('0xc')](_0x2f93('0x49'),_0x383ed8['id']);return getEndUser(_0x520e58,_0x9549df['calleridname'],_0x9549df[_0x2f93('0x10')]);})[_0x2f93('0x20')](function(_0x5e795e){_0xdd4626=_0x5e795e;logger[_0x2f93('0xc')](_0x2f93('0x4b'),_0xdd4626['id']);return getTicket(_0x520e58,_0x383ed8,_0xdd4626,_0x1a3bc7,_0x9549df);})[_0x2f93('0x20')](function(_0x21c7ed){if(_0x21c7ed){logger[_0x2f93('0xc')](_0x2f93('0x4c'));logger[_0x2f93('0xc')](_0x2f93('0x4d'),_0x21c7ed['id']);}})[_0x2f93('0x52')](function(_0x143d6a){logger[_0x2f93('0x53')]('['+_0x9549df[_0x2f93('0x5c')][_0x2f93('0x5b')]()+']',JSON[_0x2f93('0x54')](_0x143d6a));});}; \ No newline at end of file +var _0x7e1a=['toUpperCase','recordingURL','error','request-promise','md5','ioredis','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','defaults','GET','map','includes','string','picklist','nameField','customField','toLowerCase','toString','type','idField','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','trigger:browser:url','unmanaged','monitor_format','lastevent'];(function(_0x48269d,_0x42ca47){var _0xa5a6ca=function(_0x5082b7){while(--_0x5082b7){_0x48269d['push'](_0x48269d['shift']());}};_0xa5a6ca(++_0x42ca47);}(_0x7e1a,0xbb));var _0xa7e1=function(_0x222a12,_0x582f85){_0x222a12=_0x222a12-0x0;var _0xca5c2b=_0x7e1a[_0x222a12];return _0xca5c2b;};'use strict';var _=require('lodash');var rp=require(_0xa7e1('0x0'));var md5=require(_0xa7e1('0x1'));var util=require('util');var Redis=require(_0xa7e1('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa7e1('0x3'))(_0xa7e1('0x4'));config[_0xa7e1('0x5')]=_['defaults'](config[_0xa7e1('0x5')],{'host':_0xa7e1('0x6'),'port':0x18eb});var io=require(_0xa7e1('0x7'))(new Redis(config['redis']));var headers={'Content-Type':_0xa7e1('0x8'),'Accept':_0xa7e1('0x8')};function emit(_0x440ff1,_0x4065c8,_0x3b66da){io['to'](_0x440ff1)[_0xa7e1('0x9')](_0x4065c8,_0x3b66da);}function getTicket(_0xb57e7c,_0x443e43,_0x2d141c,_0x3f3ec3,_0x542227){logger['info'](_0xa7e1('0xa'));var _0x21ce38=_[_0xa7e1('0xb')]({'responder_id':_0x443e43['id'],'requester_id':_0x2d141c['id'],'name':util[_0xa7e1('0xc')](_0xa7e1('0xd'),_0x542227['calleridname']),'phone':_0x542227[_0xa7e1('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa7e1('0xf')](_0x3f3ec3[_0xa7e1('0x10')],_0x542227,'\x20'),'description':intUtil[_0xa7e1('0xf')](_0x3f3ec3[_0xa7e1('0x11')],_0x542227,'
'),'tags':getTags(_0x3f3ec3[_0xa7e1('0x12')],_0xa7e1('0x13'))},getCustomFields(_0x3f3ec3[_0xa7e1('0x14')],_0x542227));_0x21ce38[_0xa7e1('0x15')]=_[_0xa7e1('0x16')](_[_0xa7e1('0x17')](_0x21ce38[_0xa7e1('0x15')],'id'),_0xa7e1('0x18'));return request({'uri':util[_0xa7e1('0xc')](_0xa7e1('0x19'),_0xb57e7c[_0xa7e1('0x1a')]),'method':_0xa7e1('0x1b'),'body':_0x21ce38})[_0xa7e1('0x1c')](function(_0x26ce06){logger['info'](_0xa7e1('0x1d'));return _0x26ce06;});}function getUser(_0x4e2719,_0x5a683e){if(intUtil[_0xa7e1('0x1e')](_0x5a683e)){return request({'uri':util[_0xa7e1('0xc')](_0xa7e1('0x1f'),_0x4e2719[_0xa7e1('0x1a')]),'qs':{'email':_0x5a683e}})[_0xa7e1('0x1c')](function(_0xe5a7e4){if(_0xe5a7e4[_0xa7e1('0x20')]){logger[_0xa7e1('0x21')]('Agent\x20found!');return _[_0xa7e1('0x22')](_0xe5a7e4,function(_0x3377bb){return _0x3377bb[_0xa7e1('0x23')][_0xa7e1('0x24')]===_0x5a683e;});}else{logger['info'](_0xa7e1('0x25'));return request({'uri':util[_0xa7e1('0xc')](_0xa7e1('0x26'),_0x4e2719[_0xa7e1('0x1a')])})[_0xa7e1('0x1c')](function(_0x1000c3){logger[_0xa7e1('0x21')](_0xa7e1('0x27'));return _0x1000c3;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x4e2719[_0xa7e1('0x1a')])})[_0xa7e1('0x1c')](function(_0x1dfc34){logger[_0xa7e1('0x21')](_0xa7e1('0x27'));return _0x1dfc34;});}}function getEndUser(_0x51fe2e,_0x314533,_0x87e22f){logger[_0xa7e1('0x21')]('Searching\x20enduser\x20with\x20phone',_0x87e22f);return request({'uri':util[_0xa7e1('0xc')]('%s/api/v2/contacts',_0x51fe2e[_0xa7e1('0x1a')]),'qs':{'phone':_0x87e22f}})[_0xa7e1('0x1c')](function(_0x40b931){if(_0x40b931['length']){logger[_0xa7e1('0x21')]('Enduser\x20found!');return _['find'](_0x40b931,{'phone':_0x87e22f});}else{logger[_0xa7e1('0x21')](_0xa7e1('0x28'));return request({'uri':util[_0xa7e1('0xc')]('%s/api/v2/contacts',_0x51fe2e[_0xa7e1('0x1a')]),'method':_0xa7e1('0x1b'),'body':{'name':_0x314533,'phone':_0x87e22f}})[_0xa7e1('0x1c')](function(_0x45cde6){logger['info'](_0xa7e1('0x29'));return _0x45cde6;});}});}function getAuth(_0x4cefff){return util[_0xa7e1('0xc')](_0xa7e1('0x2a'),new Buffer(_0x4cefff[_0xa7e1('0x2b')]+':X')['toString'](_0xa7e1('0x2c')));}function request(_0x54a298){logger['debug'](_0xa7e1('0x2d'),JSON[_0xa7e1('0x2e')](_0x54a298));return rp(_[_0xa7e1('0x2f')](_0x54a298,{'method':_0xa7e1('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x57fb84,_0x128e97){var _0x1d35a5=[];if(_0x57fb84&&_0x57fb84[_0xa7e1('0x20')]>0x0){_0x1d35a5=_[_0xa7e1('0x31')](_0x57fb84,_0x128e97);}return _0x1d35a5;}function getCustomFields(_0x47b18e,_0x569e35){var _0x32b361=[];var _0x4c21d4={'custom_fields':[]};if(_0x47b18e[_0xa7e1('0x20')]>0x0){_['forEach'](_0x47b18e,function(_0x43b881){if(_[_0xa7e1('0x32')]([_0xa7e1('0x33'),_0xa7e1('0x34')],_0x43b881['type'])&&_0x43b881[_0xa7e1('0x35')]&&!_0x43b881[_0xa7e1('0x36')]){_0x4c21d4[_0x43b881['nameField'][_0xa7e1('0x37')]()]=_0x43b881['content'][_0xa7e1('0x38')]();}else if(_['includes'](['string',_0xa7e1('0x34')],_0x43b881[_0xa7e1('0x39')])&&_0x43b881[_0xa7e1('0x3a')]&&_0x43b881[_0xa7e1('0x36')]){_0x4c21d4[_0xa7e1('0x15')][_0xa7e1('0x3b')]({'id':_0x43b881['idField'],'value':_0x43b881[_0xa7e1('0x3c')][_0xa7e1('0x38')]()});}else if(_0x43b881['type']===_0xa7e1('0x3d')&&_0x43b881[_0xa7e1('0x3e')]&&_0x43b881['idField']&&_0x43b881['customField']){_0x569e35[_0x43b881[_0xa7e1('0x3e')]]&&_0x4c21d4[_0xa7e1('0x15')]['push']({'id':_0x43b881['idField'],'value':_0x569e35[_0x43b881[_0xa7e1('0x3e')]][_0xa7e1('0x38')]()});}else if(_0x43b881[_0xa7e1('0x39')]==='customVariable'&&_0x43b881[_0xa7e1('0x3f')]&&_0x43b881[_0xa7e1('0x3f')][_0xa7e1('0x13')]&&_0x43b881[_0xa7e1('0x3a')]&&_0x43b881['customField']){_0x569e35[_0x43b881[_0xa7e1('0x3f')][_0xa7e1('0x13')][_0xa7e1('0x37')]()]&&_0x4c21d4[_0xa7e1('0x15')][_0xa7e1('0x3b')]({'id':_0x43b881[_0xa7e1('0x3a')],'value':_0x569e35[_0x43b881[_0xa7e1('0x3f')][_0xa7e1('0x13')][_0xa7e1('0x37')]()][_0xa7e1('0x38')]()});}});}return _0x4c21d4;}exports[_0xa7e1('0x40')]=function(_0x232072,_0xe7e94c,_0x4e11e3,_0x20fe26,_0x42ee40,_0x101966){var _0x28048d,_0x2da10b;_0x101966['remoteUri']=intUtil[_0xa7e1('0x41')](_0x101966[_0xa7e1('0x1a')]);_0x101966[_0xa7e1('0x42')]=intUtil[_0xa7e1('0x41')](_0x101966[_0xa7e1('0x42')]);if(_0x42ee40&&_0x42ee40['monitor_format']){logger['info']('[QUEUE]',_0xa7e1('0x43'));_0xe7e94c['recordingURL']=util[_0xa7e1('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x101966[_0xa7e1('0x42')],_0xe7e94c[_0xa7e1('0x44')],md5(_0xe7e94c[_0xa7e1('0x44')]));}else{_0xe7e94c['recordingURL']='';}headers[_0xa7e1('0x45')]=getAuth(_0x101966);return getUser(_0x101966,_0x20fe26['email'])[_0xa7e1('0x1c')](function(_0x42d028){_0x28048d=_0x42d028;logger[_0xa7e1('0x21')](_0xa7e1('0x46'),_0x28048d['id']);return getEndUser(_0x101966,_0xe7e94c[_0xa7e1('0x47')],_0xe7e94c[_0xa7e1('0xe')]);})[_0xa7e1('0x1c')](function(_0x1b2d20){_0x2da10b=_0x1b2d20;logger[_0xa7e1('0x21')](_0xa7e1('0x48'),_0x2da10b['id']);return getTicket(_0x101966,_0x28048d,_0x2da10b,_0x4e11e3,_0xe7e94c);})[_0xa7e1('0x1c')](function(_0x59e548){if(_0x59e548&&_0x59e548['id']){logger['info']('Ticket\x20created!');logger[_0xa7e1('0x21')](_0xa7e1('0x49'),_0x59e548['id']);logger[_0xa7e1('0x21')](_0xa7e1('0x4a'),_0xa7e1('0x4b'));emit(util[_0xa7e1('0xc')](_0xa7e1('0x4c'),_0x20fe26['name']),'trigger:browser:url',{'uri':util[_0xa7e1('0xc')](_0xa7e1('0x4d'),_0x101966[_0xa7e1('0x1a')],_0x59e548['id'])});}})[_0xa7e1('0x4e')](function(_0x1f4249){logger['error'](_0xa7e1('0x4a'),JSON[_0xa7e1('0x2e')](_0x1f4249));});};exports[_0xa7e1('0x4f')]=function(_0x2d0463,_0x32a126,_0x427b64,_0x2b2eb7,_0x3be803,_0x3f15a5,_0x37f46f){var _0x1e979d,_0x319333;_0x3f15a5[_0xa7e1('0x1a')]=intUtil['stripTrailingSlash'](_0x3f15a5[_0xa7e1('0x1a')]);_0x3f15a5[_0xa7e1('0x42')]=intUtil[_0xa7e1('0x41')](_0x3f15a5[_0xa7e1('0x42')]);if(_0x37f46f&&_0x37f46f[_0xa7e1('0x50')]&&_0x37f46f['recordingFormat']!==_0xa7e1('0x51')){logger[_0xa7e1('0x21')](_0xa7e1('0x52'),_0xa7e1('0x43'));_0x32a126['recordingURL']=util['format'](_0xa7e1('0x53'),_0x3f15a5['serverUrl'],_0x32a126['uniqueid'],md5(_0x32a126['uniqueid']));}headers[_0xa7e1('0x45')]=getAuth(_0x3f15a5);return getUser(_0x3f15a5,_0x2b2eb7[_0xa7e1('0x24')])['then'](function(_0x588d86){_0x1e979d=_0x588d86;logger['info'](_0xa7e1('0x46'),_0x1e979d['id']);return getEndUser(_0x3f15a5,_0x32a126[_0xa7e1('0x54')],_0x32a126['destcalleridnum']);})[_0xa7e1('0x1c')](function(_0x21ecb9){_0x319333=_0x21ecb9;logger['info'](_0xa7e1('0x48'),_0x319333['id']);return getTicket(_0x3f15a5,_0x1e979d,_0x319333,_0x427b64,_0x32a126);})['then'](function(_0x572d02){if(_0x572d02&&_0x572d02['id']){logger['info'](_0xa7e1('0x1d'));logger['info'](_0xa7e1('0x49'),_0x572d02['id']);logger[_0xa7e1('0x21')](_0xa7e1('0x52'),_0xa7e1('0x4b'));emit(util['format']('user:%s',_0x2b2eb7[_0xa7e1('0x13')]),_0xa7e1('0x55'),{'uri':util[_0xa7e1('0xc')](_0xa7e1('0x4d'),_0x3f15a5[_0xa7e1('0x1a')],_0x572d02['id'])});}})[_0xa7e1('0x4e')](function(_0x3d77d9){logger['error'](_0xa7e1('0x52'),JSON[_0xa7e1('0x2e')](_0x3d77d9));});};exports[_0xa7e1('0x56')]=function(_0x44690a,_0x86d322,_0xd72b,_0x516d30,_0x5d6f6c,_0x21990d){var _0x39f0d3,_0x19e68f;_0x21990d[_0xa7e1('0x1a')]=intUtil[_0xa7e1('0x41')](_0x21990d['remoteUri']);_0x21990d['serverUrl']=intUtil[_0xa7e1('0x41')](_0x21990d['serverUrl']);if(_0x5d6f6c&&_0x5d6f6c[_0xa7e1('0x57')]){logger['info']('['+_0x86d322[_0xa7e1('0x58')][_0xa7e1('0x59')]()+']',_0xa7e1('0x43'));_0x86d322[_0xa7e1('0x5a')]=util['format'](_0xa7e1('0x53'),_0x21990d['serverUrl'],_0x86d322['uniqueid'],md5(_0x86d322[_0xa7e1('0x44')]));}else{_0x86d322[_0xa7e1('0x5a')]='';}headers['Authorization']=getAuth(_0x21990d);return getUser(_0x21990d,'')[_0xa7e1('0x1c')](function(_0x4a840b){_0x39f0d3=_0x4a840b;logger[_0xa7e1('0x21')]('The\x20User\x20ID\x20is:',_0x39f0d3['id']);return getEndUser(_0x21990d,_0x86d322[_0xa7e1('0x47')],_0x86d322[_0xa7e1('0xe')]);})[_0xa7e1('0x1c')](function(_0x154dac){_0x19e68f=_0x154dac;logger[_0xa7e1('0x21')](_0xa7e1('0x48'),_0x19e68f['id']);return getTicket(_0x21990d,_0x39f0d3,_0x19e68f,_0xd72b,_0x86d322);})[_0xa7e1('0x1c')](function(_0x36e216){if(_0x36e216){logger[_0xa7e1('0x21')](_0xa7e1('0x1d'));logger[_0xa7e1('0x21')](_0xa7e1('0x49'),_0x36e216['id']);}})[_0xa7e1('0x4e')](function(_0x1cebc5){logger[_0xa7e1('0x5b')]('['+_0x86d322[_0xa7e1('0x58')]['toUpperCase']()+']',JSON[_0xa7e1('0x2e')](_0x1cebc5));});}; \ 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 399fa44..d3c6b12 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 _0x916a=['userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email'];(function(_0x4ad9da,_0x5352e0){var _0xb19b24=function(_0xeb8699){while(--_0xeb8699){_0x4ad9da['push'](_0x4ad9da['shift']());}};_0xb19b24(++_0x5352e0);}(_0x916a,0x19c));var _0xa916=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x916a[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0xa916('0x0'));var rp=require(_0xa916('0x1'));var md5=require(_0xa916('0x2'));var util=require(_0xa916('0x3'));var moment=require(_0xa916('0x4'));var Promise=require(_0xa916('0x5'));var Redis=require('ioredis');var intUtil=require(_0xa916('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa916('0x7'))(_0xa916('0x8'));config[_0xa916('0x9')]=_[_0xa916('0xa')](config['redis'],{'host':_0xa916('0xb'),'port':0x18eb});var io=require(_0xa916('0xc'))(new Redis(config[_0xa916('0x9')]));function getAdminId(_0xacd94c,_0x343fe1,_0x218bce,_0x48eb5e){return new Promise(function(_0x360c15,_0x1ff57c){var _0x5d6dd3=![];var _0x2ac7a6={'method':_0xa916('0xd'),'uri':_0x48eb5e+_0xa916('0xe'),'json':!![]};_0x2ac7a6[_0xa916('0xf')]=_0x218bce;logger[_0xa916('0x10')](_0xa916('0x11'));return rp(_0x2ac7a6)[_0xa916('0x12')](function(_0x386276){if(_0x386276){var _0x3899b8=_0x386276[_0xa916('0x13')];var _0x81a26e=null;for(_0x81a26e=0x0;_0x81a26e<_0x3899b8[_0xa916('0x14')];_0x81a26e++){if(_0x3899b8[_0x81a26e][_0xa916('0x15')]===_0xacd94c[_0xa916('0x16')]){_0xacd94c[_0xa916('0x17')]=_0x3899b8[_0x81a26e]['id'];_0x5d6dd3=!![];}}if(_0x5d6dd3){logger['info'](_0xa916('0x18'),_0xacd94c[_0xa916('0x17')]);_0x360c15(_0xacd94c);}else{_0x1ff57c({'statusCode':0x194,'message':_0xa916('0x19')});}}else{_0x1ff57c({'statusCode':0x194,'message':_0xa916('0x19')});}})[_0xa916('0x1a')](function(_0x4505db){logger[_0xa916('0x1b')]('['+[_0x343fe1[_0xa916('0x1c')]()]+']',_0x4505db[_0xa916('0x1d')]);_0x1ff57c(_0x4505db);});});}function getUser(_0xd1c187,_0x38c70a,_0x20acb4){return function(_0x3975ac){return new Promise(function(_0xe46824,_0x5a9362){var _0x598fc8={'method':_0xa916('0xd'),'uri':_0x20acb4+_0xa916('0xe'),'json':!![]};_0x598fc8[_0xa916('0xf')]=_0x38c70a;logger['info'](_0xa916('0x1e'));return rp(_0x598fc8)['then'](function(_0x42634d){if(_0x42634d){var _0x44a85f=_0x42634d[_0xa916('0x13')];var _0x208ff9=![];var _0x47056f=null;if(_0x3975ac[_0xa916('0x1f')]!==null){logger['info'](_0xa916('0x20'),_0x3975ac[_0xa916('0x1f')]);_0x3975ac[_0xa916('0x21')]=_0x3975ac[_0xa916('0x1f')];for(_0x47056f=0x0;_0x47056f<_0x44a85f[_0xa916('0x14')];_0x47056f++){if(_0x44a85f[_0x47056f]['email']===_0x3975ac['agentEmail']){_0x208ff9=!![];_0x3975ac[_0xa916('0x22')]=_0x44a85f[_0x47056f]['id'];logger[_0xa916('0x10')](_0xa916('0x23'),_0x3975ac[_0xa916('0x22')]);}}}if(!_0x208ff9){logger[_0xa916('0x10')](_0xa916('0x24'));_0x3975ac['userEmail']=_0x3975ac[_0xa916('0x16')];_0x3975ac['userId']=_0x3975ac[_0xa916('0x17')];_0x208ff9=!![];}if(_0x208ff9){_0xe46824(_0x3975ac);}else{_0x5a9362({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5a9362({'statusCode':0x194,'message':_0xa916('0x19')});}})['catch'](function(_0x1d25fe){logger[_0xa916('0x1b')]('['+[_0xd1c187['toUpperCase']()]+']',_0x1d25fe[_0xa916('0x1d')]);_0x5a9362(_0x1d25fe);});});};}function searchContact(_0x17e6fb,_0x5bb047,_0x473f6b,_0x8c1caf){return new Promise(function(_0xc7c4bc,_0x2db6f1){var _0xae523b={'method':_0xa916('0xd'),'headers':_0x5bb047,'uri':_0x17e6fb+_0xa916('0x25')+_0x8c1caf+_0xa916('0x26')+_0x473f6b+_0xa916('0x27'),'json':!![]};rp(_0xae523b)['then'](function(_0x2adca8){var _0x4e778b=_['find'](_0x2adca8[_0xa916('0x28')][_0xa916('0x28')],[_0x473f6b,_0x8c1caf]);_0xc7c4bc(_0x4e778b);})[_0xa916('0x1a')](function(_0x3c06a2){_0x2db6f1(_0x3c06a2);});});}function getEndUser(_0x108b88,_0x14f908,_0x2b9e92){return function(_0x1a79fe){return new Promise(function(_0x1db0ce,_0x53e947){logger[_0xa916('0x10')](util[_0xa916('0x29')](_0xa916('0x2a'),_0x1a79fe['contactNumber']));searchContact(_0x2b9e92,_0x14f908,'mobile_number',_0x1a79fe[_0xa916('0x2b')])[_0xa916('0x12')](function(_0x56366e){if(_0x56366e){_0x1a79fe[_0xa916('0x2c')]=_0x56366e['id'];logger[_0xa916('0x10')]('Contact\x20found\x20mobile_number:',_0x1a79fe[_0xa916('0x2c')]);return _0x1db0ce(_0x1a79fe);}searchContact(_0x2b9e92,_0x14f908,_0xa916('0x2d'),_0x1a79fe[_0xa916('0x2b')])[_0xa916('0x12')](function(_0x4e622e){if(_0x4e622e){_0x1a79fe[_0xa916('0x2c')]=_0x4e622e['id'];logger['info'](_0xa916('0x2e'),_0x1a79fe[_0xa916('0x2c')]);return _0x1db0ce(_0x1a79fe);}createEndUser(_0x1a79fe,_0x108b88,_0x14f908,_0x2b9e92)[_0xa916('0x12')](function(_0x260d1b){logger['info'](_0xa916('0x2f'),_0x260d1b[_0xa916('0x2c')]);return _0x1db0ce(_0x260d1b);});});})[_0xa916('0x1a')](function(_0x5bba91){_0x53e947(_0x5bba91);});});};}function createEndUser(_0x1a3e02,_0xc2a4ae,_0x5748ad,_0x412890){return new Promise(function(_0x42a96d,_0x4fd1d2){var _0x586393=moment();var _0xbbb5e={'method':_0xa916('0x30'),'uri':_0x412890+'/api/contacts','body':{'contact':{'last_name':_0x1a3e02[_0xa916('0x2b')],'work_number':_0x1a3e02[_0xa916('0x2b')],'mobile_number':_0x1a3e02[_0xa916('0x2b')],'owner_id':_0x1a3e02[_0xa916('0x22')],'created_at':_0x586393[_0xa916('0x29')](_0xa916('0x31'))}},'json':!![]};_0xbbb5e['headers']=_0x5748ad;logger[_0xa916('0x10')](_0xa916('0x32'));return rp(_0xbbb5e)['then'](function(_0xd760fe){_0x1a3e02[_0xa916('0x2c')]=_0xd760fe[_0xa916('0x33')]['id'];_0x42a96d(_0x1a3e02);})[_0xa916('0x1a')](function(_0x52d407){logger[_0xa916('0x1b')]('['+[_0xc2a4ae[_0xa916('0x1c')]()]+']',_0x52d407[_0xa916('0x1d')]);_0x4fd1d2(_0x52d407['message']);});});}function getTicket(_0x51dbab,_0x47d9d3,_0x3ac889,_0x66ae6d,_0x11892a){return function(_0x5901ba){logger[_0xa916('0x10')](_0xa916('0x34'));return new Promise(function(_0x5a76b6,_0x4ed977){var _0x1a6b60=moment();var _0x416719={'method':'POST','uri':_0x3ac889+_0xa916('0x35'),'body':{'title':intUtil[_0xa916('0x36')](_0x66ae6d[_0xa916('0x37')],_0x11892a,'\x20'),'description':intUtil[_0xa916('0x36')](_0x66ae6d[_0xa916('0x38')],_0x11892a,'\x0a'),'owner_id':_0x5901ba[_0xa916('0x22')],'creater_id':_0x5901ba[_0xa916('0x17')],'targetable_id':_0x5901ba[_0xa916('0x2c')],'targetable_type':_0xa916('0x39'),'created_at':_0x1a6b60[_0xa916('0x29')](_0xa916('0x31')),'due_date':_0x1a6b60[_0xa916('0x3a')](0x1e,'m')[_0xa916('0x29')](_0xa916('0x31'))},'json':!![]};_0x416719['headers']=_0x47d9d3;return rp(_0x416719)[_0xa916('0x12')](function(_0x45ea3b){_0x5901ba['ticketId']=_0x45ea3b[_0xa916('0x3b')]['id'];logger['info'](_0xa916('0x3c'),_0x5901ba[_0xa916('0x3d')]);_0x5a76b6(_0x5901ba);})[_0xa916('0x1a')](function(_0x323d6a){logger['error']('['+[_0x51dbab[_0xa916('0x1c')]()]+']',_0x323d6a[_0xa916('0x1d')]);_0x4ed977(_0x323d6a[_0xa916('0x1d')]);});});};}function emit(_0x5dac57,_0x48c726,_0x366cac){var _0x5130bc={'uri':_0x5dac57+_0xa916('0x3e')+_0x366cac};io['to'](util[_0xa916('0x29')](_0xa916('0x3f'),_0x48c726))[_0xa916('0x40')](_0xa916('0x41'),_0x5130bc);}exports['cs']=function(_0x23c1b0,_0x137603,_0x138601,_0x1e7574,_0x5310c6,_0x5d508d,_0x5c0a15,_0x436bb3){var _0x344d2f={};var _0x435a12={'Authorization':_0xa916('0x42')+_0x5d508d[_0xa916('0x43')]};_0x5d508d[_0xa916('0x44')]=intUtil['stripTrailingSlash'](_0x5d508d['remoteUri']);_0x5d508d[_0xa916('0x45')]=intUtil[_0xa916('0x46')](_0x5d508d[_0xa916('0x45')]);var _0x406086=_0x5d508d[_0xa916('0x44')];_0x344d2f[_0xa916('0x16')]=_0x5d508d[_0xa916('0x47')];_0x344d2f[_0xa916('0x2b')]=_0x436bb3['toLowerCase']()===_0xa916('0x48')?_0x137603[_0xa916('0x49')]:_0x137603[_0xa916('0x4a')];_0x344d2f[_0xa916('0x4b')]=_0x436bb3===_0xa916('0x4c')||_0x436bb3==='unmanaged'?_0xa916('0x4c'):_0xa916('0x48');if(_0x1e7574){_0x344d2f[_0xa916('0x1f')]=_0x1e7574['email'];}var _0x37002d=util[_0xa916('0x29')](_0xa916('0x4d'),_0x5d508d[_0xa916('0x45')],_0x137603[_0xa916('0x4e')],md5(_0x137603[_0xa916('0x4e')]));if(_0x5310c6&&_0x5310c6['monitor_format']){logger['info'](_0xa916('0x4f'),_0xa916('0x50'));_0x137603['recordingURL']=_0x37002d;}else if(_0x5c0a15&&_0x5c0a15[_0xa916('0x51')]&&_0x5c0a15[_0xa916('0x51')]!==_0xa916('0x52')){logger[_0xa916('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x137603[_0xa916('0x53')]=_0x37002d;}else{_0x137603[_0xa916('0x53')]='';}return getAdminId(_0x344d2f,_0x436bb3,_0x435a12,_0x406086)[_0xa916('0x12')](getUser(_0x436bb3,_0x435a12,_0x406086))[_0xa916('0x12')](getEndUser(_0x436bb3,_0x435a12,_0x406086))['then'](getTicket(_0x436bb3,_0x435a12,_0x406086,_0x138601,_0x137603))['then'](function(_0x417c2a){logger[_0xa916('0x10')](util[_0xa916('0x29')](_0xa916('0x54'),_0x417c2a[_0xa916('0x3d')]));if(_0x436bb3!==_0xa916('0x55')){logger[_0xa916('0x10')]('['+[_0x436bb3[_0xa916('0x1c')]()]+']',_0xa916('0x56'));emit(_0x406086,_0x1e7574['name'],_0x417c2a['endUserId']);}})[_0xa916('0x1a')](function(_0x1e6145){logger[_0xa916('0x1b')]('['+[_0x436bb3[_0xa916('0x1c')]()]+_0xa916('0x57'),util[_0xa916('0x58')](_0x1e6145,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa39c=['socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','agentEmail','email','userId','Admin\x20selected','adminEmail','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost'];(function(_0x45f6db,_0xedc21b){var _0x51c650=function(_0x4ac284){while(--_0x4ac284){_0x45f6db['push'](_0x45f6db['shift']());}};_0x51c650(++_0xedc21b);}(_0xa39c,0xec));var _0xca39=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa39c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xca39('0x0'));var rp=require(_0xca39('0x1'));var md5=require('md5');var util=require(_0xca39('0x2'));var moment=require(_0xca39('0x3'));var Promise=require(_0xca39('0x4'));var Redis=require(_0xca39('0x5'));var intUtil=require(_0xca39('0x6'));var config=require(_0xca39('0x7'));var logger=require(_0xca39('0x8'))(_0xca39('0x9'));config[_0xca39('0xa')]=_[_0xca39('0xb')](config['redis'],{'host':_0xca39('0xc'),'port':0x18eb});var io=require(_0xca39('0xd'))(new Redis(config[_0xca39('0xa')]));function getAdminId(_0x460069,_0x1251fe,_0x517f83,_0x2fba73){return new Promise(function(_0x3df32b,_0x494a90){var _0x100945=![];var _0x5e4e5b={'method':_0xca39('0xe'),'uri':_0x2fba73+_0xca39('0xf'),'json':!![]};_0x5e4e5b[_0xca39('0x10')]=_0x517f83;logger[_0xca39('0x11')](_0xca39('0x12'));return rp(_0x5e4e5b)[_0xca39('0x13')](function(_0x44afe7){if(_0x44afe7){var _0x30963c=_0x44afe7['users'];var _0x568288=null;for(_0x568288=0x0;_0x568288<_0x30963c[_0xca39('0x14')];_0x568288++){if(_0x30963c[_0x568288]['email']===_0x460069['adminEmail']){_0x460069[_0xca39('0x15')]=_0x30963c[_0x568288]['id'];_0x100945=!![];}}if(_0x100945){logger[_0xca39('0x11')](_0xca39('0x16'),_0x460069[_0xca39('0x15')]);_0x3df32b(_0x460069);}else{_0x494a90({'statusCode':0x194,'message':_0xca39('0x17')});}}else{_0x494a90({'statusCode':0x194,'message':_0xca39('0x17')});}})[_0xca39('0x18')](function(_0x57d4cd){logger[_0xca39('0x19')]('['+[_0x1251fe[_0xca39('0x1a')]()]+']',_0x57d4cd[_0xca39('0x1b')]);_0x494a90(_0x57d4cd);});});}function getUser(_0x1e2ba3,_0x203b54,_0x5aa2dd){return function(_0x5c0652){return new Promise(function(_0x4ae85d,_0x2a1ffa){var _0x444073={'method':_0xca39('0xe'),'uri':_0x5aa2dd+_0xca39('0xf'),'json':!![]};_0x444073[_0xca39('0x10')]=_0x203b54;logger[_0xca39('0x11')](_0xca39('0x1c'));return rp(_0x444073)['then'](function(_0xdcbb94){if(_0xdcbb94){var _0x574a81=_0xdcbb94[_0xca39('0x1d')];var _0x23a94a=![];var _0x1b69e4=null;if(_0x5c0652['agentEmail']!==null){logger[_0xca39('0x11')](_0xca39('0x1e'),_0x5c0652[_0xca39('0x1f')]);_0x5c0652['userEmail']=_0x5c0652[_0xca39('0x1f')];for(_0x1b69e4=0x0;_0x1b69e4<_0x574a81[_0xca39('0x14')];_0x1b69e4++){if(_0x574a81[_0x1b69e4][_0xca39('0x20')]===_0x5c0652[_0xca39('0x1f')]){_0x23a94a=!![];_0x5c0652['userId']=_0x574a81[_0x1b69e4]['id'];logger[_0xca39('0x11')]('User\x20found:',_0x5c0652[_0xca39('0x21')]);}}}if(!_0x23a94a){logger['info'](_0xca39('0x22'));_0x5c0652['userEmail']=_0x5c0652[_0xca39('0x23')];_0x5c0652[_0xca39('0x21')]=_0x5c0652[_0xca39('0x15')];_0x23a94a=!![];}if(_0x23a94a){_0x4ae85d(_0x5c0652);}else{_0x2a1ffa({'statusCode':0x194,'message':_0xca39('0x17')});}}else{_0x2a1ffa({'statusCode':0x194,'message':_0xca39('0x17')});}})[_0xca39('0x18')](function(_0x79cd52){logger[_0xca39('0x19')]('['+[_0x1e2ba3['toUpperCase']()]+']',_0x79cd52[_0xca39('0x1b')]);_0x2a1ffa(_0x79cd52);});});};}function searchContact(_0x4d3c8e,_0x5b2e9a,_0x2b35b2,_0x7207b6){return new Promise(function(_0x101df0,_0x307186){var _0x5615af={'method':_0xca39('0xe'),'headers':_0x5b2e9a,'uri':_0x4d3c8e+_0xca39('0x24')+_0x7207b6+'&f='+_0x2b35b2+'&entities=contact','json':!![]};rp(_0x5615af)['then'](function(_0x584894){var _0x16f0af=_[_0xca39('0x25')](_0x584894[_0xca39('0x26')][_0xca39('0x26')],[_0x2b35b2,_0x7207b6]);_0x101df0(_0x16f0af);})[_0xca39('0x18')](function(_0x28afba){_0x307186(_0x28afba);});});}function getEndUser(_0x4a88b3,_0x31b795,_0x1f50f2){return function(_0x1c5d7c){return new Promise(function(_0x119667,_0x2ef47f){logger[_0xca39('0x11')](util[_0xca39('0x27')](_0xca39('0x28'),_0x1c5d7c[_0xca39('0x29')]));searchContact(_0x1f50f2,_0x31b795,_0xca39('0x2a'),_0x1c5d7c['contactNumber'])[_0xca39('0x13')](function(_0x4ed9f4){if(_0x4ed9f4){_0x1c5d7c[_0xca39('0x2b')]=_0x4ed9f4['id'];logger[_0xca39('0x11')](_0xca39('0x2c'),_0x1c5d7c['endUserId']);return _0x119667(_0x1c5d7c);}searchContact(_0x1f50f2,_0x31b795,_0xca39('0x2d'),_0x1c5d7c[_0xca39('0x29')])[_0xca39('0x13')](function(_0x4d5a38){if(_0x4d5a38){_0x1c5d7c['endUserId']=_0x4d5a38['id'];logger[_0xca39('0x11')](_0xca39('0x2e'),_0x1c5d7c[_0xca39('0x2b')]);return _0x119667(_0x1c5d7c);}createEndUser(_0x1c5d7c,_0x4a88b3,_0x31b795,_0x1f50f2)[_0xca39('0x13')](function(_0x1cbad3){logger[_0xca39('0x11')](_0xca39('0x2f'),_0x1cbad3['endUserId']);return _0x119667(_0x1cbad3);});});})['catch'](function(_0x50deeb){_0x2ef47f(_0x50deeb);});});};}function createEndUser(_0x1360e6,_0x5541e4,_0x457131,_0x39ed27){return new Promise(function(_0x1e8648,_0x2ddb40){var _0x1e2859=moment();var _0x46d553={'method':_0xca39('0x30'),'uri':_0x39ed27+'/api/contacts','body':{'contact':{'last_name':_0x1360e6[_0xca39('0x29')],'work_number':_0x1360e6[_0xca39('0x29')],'mobile_number':_0x1360e6[_0xca39('0x29')],'owner_id':_0x1360e6[_0xca39('0x21')],'created_at':_0x1e2859['format'](_0xca39('0x31'))}},'json':!![]};_0x46d553[_0xca39('0x10')]=_0x457131;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x46d553)[_0xca39('0x13')](function(_0x2f9eb1){_0x1360e6[_0xca39('0x2b')]=_0x2f9eb1[_0xca39('0x32')]['id'];_0x1e8648(_0x1360e6);})[_0xca39('0x18')](function(_0x4960d2){logger['error']('['+[_0x5541e4[_0xca39('0x1a')]()]+']',_0x4960d2[_0xca39('0x1b')]);_0x2ddb40(_0x4960d2[_0xca39('0x1b')]);});});}function getTicket(_0x54de24,_0x143a54,_0x334e39,_0x37419c,_0x9f4b81){return function(_0x8ba16a){logger[_0xca39('0x11')](_0xca39('0x33'));return new Promise(function(_0x3e9073,_0x277623){var _0x2bffd0=moment();var _0x16da1d={'method':'POST','uri':_0x334e39+'/api/tasks','body':{'title':intUtil[_0xca39('0x34')](_0x37419c[_0xca39('0x35')],_0x9f4b81,'\x20'),'description':intUtil['getString'](_0x37419c[_0xca39('0x36')],_0x9f4b81,'\x0a'),'owner_id':_0x8ba16a[_0xca39('0x21')],'creater_id':_0x8ba16a[_0xca39('0x15')],'targetable_id':_0x8ba16a[_0xca39('0x2b')],'targetable_type':_0xca39('0x37'),'created_at':_0x2bffd0['format'](_0xca39('0x31')),'due_date':_0x2bffd0[_0xca39('0x38')](0x1e,'m')[_0xca39('0x27')](_0xca39('0x31'))},'json':!![]};_0x16da1d[_0xca39('0x10')]=_0x143a54;return rp(_0x16da1d)[_0xca39('0x13')](function(_0x2100bb){_0x8ba16a[_0xca39('0x39')]=_0x2100bb[_0xca39('0x3a')]['id'];logger['info'](_0xca39('0x3b'),_0x8ba16a[_0xca39('0x39')]);_0x3e9073(_0x8ba16a);})[_0xca39('0x18')](function(_0x43fd7b){logger[_0xca39('0x19')]('['+[_0x54de24[_0xca39('0x1a')]()]+']',_0x43fd7b[_0xca39('0x1b')]);_0x277623(_0x43fd7b[_0xca39('0x1b')]);});});};}function emit(_0x30f852,_0x1c0e4f,_0x19fbcd){var _0x7e109e={'uri':_0x30f852+'/contacts/'+_0x19fbcd};io['to'](util[_0xca39('0x27')](_0xca39('0x3c'),_0x1c0e4f))[_0xca39('0x3d')]('trigger:browser:url',_0x7e109e);}exports['cs']=function(_0x4a6350,_0x2954b2,_0xe2fbae,_0x37ccc6,_0x5433a8,_0x212f7f,_0x4636d2,_0x56a943){var _0x4aa642={};var _0x32c4e1={'Authorization':_0xca39('0x3e')+_0x212f7f[_0xca39('0x3f')]};_0x212f7f[_0xca39('0x40')]=intUtil['stripTrailingSlash'](_0x212f7f[_0xca39('0x40')]);_0x212f7f[_0xca39('0x41')]=intUtil[_0xca39('0x42')](_0x212f7f[_0xca39('0x41')]);var _0x156dcb=_0x212f7f[_0xca39('0x40')];_0x4aa642['adminEmail']=_0x212f7f['username'];_0x4aa642[_0xca39('0x29')]=_0x56a943[_0xca39('0x43')]()===_0xca39('0x44')?_0x2954b2['destcalleridnum']:_0x2954b2[_0xca39('0x45')];_0x4aa642[_0xca39('0x46')]=_0x56a943===_0xca39('0x47')||_0x56a943===_0xca39('0x48')?_0xca39('0x47'):'outbound';if(_0x37ccc6){_0x4aa642[_0xca39('0x1f')]=_0x37ccc6[_0xca39('0x20')];}var _0x40cd0d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x212f7f[_0xca39('0x41')],_0x2954b2[_0xca39('0x49')],md5(_0x2954b2['uniqueid']));if(_0x5433a8&&_0x5433a8[_0xca39('0x4a')]){logger[_0xca39('0x11')](_0xca39('0x4b'),_0xca39('0x4c'));_0x2954b2['recordingURL']=_0x40cd0d;}else if(_0x4636d2&&_0x4636d2[_0xca39('0x4d')]&&_0x4636d2[_0xca39('0x4d')]!==_0xca39('0x4e')){logger[_0xca39('0x11')]('[OUTBOUND]',_0xca39('0x4c'));_0x2954b2['recordingURL']=_0x40cd0d;}else{_0x2954b2['recordingURL']='';}return getAdminId(_0x4aa642,_0x56a943,_0x32c4e1,_0x156dcb)[_0xca39('0x13')](getUser(_0x56a943,_0x32c4e1,_0x156dcb))['then'](getEndUser(_0x56a943,_0x32c4e1,_0x156dcb))[_0xca39('0x13')](getTicket(_0x56a943,_0x32c4e1,_0x156dcb,_0xe2fbae,_0x2954b2))[_0xca39('0x13')](function(_0x107729){logger['info'](util[_0xca39('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x107729[_0xca39('0x39')]));if(_0x56a943!==_0xca39('0x48')){logger[_0xca39('0x11')]('['+[_0x56a943[_0xca39('0x1a')]()]+']',_0xca39('0x4f'));emit(_0x156dcb,_0x37ccc6[_0xca39('0x50')],_0x107729[_0xca39('0x2b')]);}})[_0xca39('0x18')](function(_0x30a213){logger[_0xca39('0x19')]('['+[_0x56a943['toUpperCase']()]+_0xca39('0x51'),util[_0xca39('0x52')](_0x30a213,{'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 fa2cf6b..a98f522 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 _0x66fe=['data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes'];(function(_0x4582a6,_0x2b211f){var _0xabb2f8=function(_0x4c67dc){while(--_0x4c67dc){_0x4582a6['push'](_0x4582a6['shift']());}};_0xabb2f8(++_0x2b211f);}(_0x66fe,0x76));var _0xe66f=function(_0x418a36,_0xd7f3e5){_0x418a36=_0x418a36-0x0;var _0x134e4e=_0x66fe[_0x418a36];return _0x134e4e;};'use strict';var _=require(_0xe66f('0x0'));var util=require(_0xe66f('0x1'));var zendesk=require(_0xe66f('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe66f('0x3'));var freshdesk=require(_0xe66f('0x4'));var zoho=require(_0xe66f('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xe66f('0x6'));var freshsales=require('./freshsales');var integrations=[_0xe66f('0x7'),_0xe66f('0x8'),_0xe66f('0x9'),_0xe66f('0xa'),_0xe66f('0xb'),_0xe66f('0xc'),_0xe66f('0xd'),_0xe66f('0xe'),_0xe66f('0xf'),_0xe66f('0x10')];exports['exec']=function(_0x1b7926,_0x1bdc38,_0x3d2224,_0x3baf0a,_0x180c0f,_0x3335bc){if(_0x3d2224){if(_[_0xe66f('0x11')](integrations,_0x1b7926[_0xe66f('0x12')][_0xe66f('0x13')]())){try{var _0x158329=null;var _0x315ad1='';var _0x12fbbc=_0x3d2224[_0x1b7926[_0xe66f('0x12')][_0xe66f('0x13')]()];if(_0x12fbbc){var _0x270300=_0x12fbbc[_0x1b7926[_0xe66f('0x14')]];if(_0x270300){var _0x242107=_['find'](_0x270300[_0xe66f('0x15')],{'id':parseInt(_0x1b7926[_0xe66f('0x16')],0xa)});if(_0x242107){if(_0x3baf0a){if(_0x180c0f&&_0x1bdc38[_0xe66f('0x17')]){_0x315ad1=_0xe66f('0x17');}else if(_0x1bdc38[_0xe66f('0x18')]){_0x315ad1=_0xe66f('0x19');}else{console[_0xe66f('0x1a')](_0xe66f('0x1b'),_0x1bdc38);}}else{_0x315ad1=_0xe66f('0x1c');}switch(_0x1b7926[_0xe66f('0x12')][_0xe66f('0x13')]()){case _0xe66f('0x7'):zendesk[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case'salesforce':salesforce[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case _0xe66f('0x9'):sugarcrm[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case _0xe66f('0xa'):freshdesk[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case _0xe66f('0xb'):zoho[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case _0xe66f('0xc'):desk[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case'vtiger':vtiger[_0x315ad1](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc);break;case _0xe66f('0xf'):freshsales['cs'](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc,_0x315ad1);break;case _0xe66f('0x10'):servicenow['cs'](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc,_0x315ad1);break;case'dynamics365':dynamics365['cs'](_0x1b7926,_0x1bdc38,_0x242107,_0x3baf0a,_0x180c0f,_0x270300,_0x3335bc,_0x315ad1);break;default:console[_0xe66f('0x1a')]('unknown\x20integration');}}else{_0x158329=require('../../../../config/logger')(_0x1b7926['data1'][_0xe66f('0x13')]());_0x158329[_0xe66f('0x1d')](_0xe66f('0x1e'),util[_0xe66f('0x1f')](_0xe66f('0x20'),_0x1b7926[_0xe66f('0x12')][_0xe66f('0x13')](),_0x1b7926['data3']));}}else{_0x158329=require('../../../../config/logger')(_0x1b7926['data1']['toLowerCase']());_0x158329['error'](_0xe66f('0x1e'),util[_0xe66f('0x1f')](_0xe66f('0x21'),_0x1b7926[_0xe66f('0x12')]['toLowerCase'](),_0x1b7926[_0xe66f('0x14')]));}}else{}}catch(_0x30afab){console[_0xe66f('0x1d')](_0x30afab);}}}}; \ No newline at end of file +var _0x0bd2=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','salesforce','sugarcrm','zoho','vtiger','dynamics365','servicenow','exec','includes','toLowerCase','data2','find','Configurations','queue','routeId','log','EVENT\x20UNKNOWN','data1','zendesk','freshdesk','desk','freshsales','unknown\x20integration'];(function(_0x228b46,_0x6268b6){var _0x472296=function(_0x30f64){while(--_0x30f64){_0x228b46['push'](_0x228b46['shift']());}};_0x472296(++_0x6268b6);}(_0x0bd2,0x1a9));var _0x20bd=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x0bd2[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x20bd('0x0'));var util=require('util');var zendesk=require(_0x20bd('0x1'));var salesforce=require(_0x20bd('0x2'));var sugarcrm=require(_0x20bd('0x3'));var freshdesk=require(_0x20bd('0x4'));var zoho=require(_0x20bd('0x5'));var desk=require('./desk');var vtiger=require(_0x20bd('0x6'));var servicenow=require(_0x20bd('0x7'));var dynamics365=require(_0x20bd('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x20bd('0x9'),_0x20bd('0xa'),'freshdesk',_0x20bd('0xb'),'desk',_0x20bd('0xc'),_0x20bd('0xd'),'freshsales',_0x20bd('0xe')];exports[_0x20bd('0xf')]=function(_0x54a0d6,_0x495aae,_0x45bc15,_0x1fcc60,_0x4d4feb,_0x30a29d){if(_0x45bc15){if(_[_0x20bd('0x10')](integrations,_0x54a0d6['data1'][_0x20bd('0x11')]())){try{var _0x175ee4=null;var _0x7c34da='';var _0x474987=_0x45bc15[_0x54a0d6['data1'][_0x20bd('0x11')]()];if(_0x474987){var _0x2b354c=_0x474987[_0x54a0d6[_0x20bd('0x12')]];if(_0x2b354c){var _0x196250=_[_0x20bd('0x13')](_0x2b354c[_0x20bd('0x14')],{'id':parseInt(_0x54a0d6['data3'],0xa)});if(_0x196250){if(_0x1fcc60){if(_0x4d4feb&&_0x495aae['queue']){_0x7c34da=_0x20bd('0x15');}else if(_0x495aae[_0x20bd('0x16')]){_0x7c34da='outbound';}else{console[_0x20bd('0x17')](_0x20bd('0x18'),_0x495aae);}}else{_0x7c34da='unmanaged';}switch(_0x54a0d6[_0x20bd('0x19')][_0x20bd('0x11')]()){case _0x20bd('0x1a'):zendesk[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0x9'):salesforce[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0xa'):sugarcrm[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0x1b'):freshdesk[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0xb'):zoho[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0x1c'):desk[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0xc'):vtiger[_0x7c34da](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d);break;case _0x20bd('0x1d'):freshsales['cs'](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d,_0x7c34da);break;case _0x20bd('0xe'):servicenow['cs'](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d,_0x7c34da);break;case _0x20bd('0xd'):dynamics365['cs'](_0x54a0d6,_0x495aae,_0x196250,_0x1fcc60,_0x4d4feb,_0x2b354c,_0x30a29d,_0x7c34da);break;default:console[_0x20bd('0x17')](_0x20bd('0x1e'));}}else{_0x175ee4=require(_0x20bd('0x1f'))(_0x54a0d6[_0x20bd('0x19')][_0x20bd('0x11')]());_0x175ee4[_0x20bd('0x20')](_0x20bd('0x21'),util[_0x20bd('0x22')](_0x20bd('0x23'),_0x54a0d6[_0x20bd('0x19')][_0x20bd('0x11')](),_0x54a0d6[_0x20bd('0x24')]));}}else{_0x175ee4=require('../../../../config/logger')(_0x54a0d6[_0x20bd('0x19')][_0x20bd('0x11')]());_0x175ee4[_0x20bd('0x20')]('[EXEC]',util[_0x20bd('0x22')](_0x20bd('0x25'),_0x54a0d6[_0x20bd('0x19')][_0x20bd('0x11')](),_0x54a0d6['data2']));}}else{}}catch(_0x28f253){console[_0x20bd('0x20')](_0x28f253);}}}}; \ 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 93865e9..203bd58 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 _0x8a05=['defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','IsReminderSet','endUserType','lead','WhoId','account','WhatId','ticketType','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','execute','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','type','idField','content','variable','variableName','customVariable','Variable','name','toString','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','Recording\x20is\x20enabled!','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis'];(function(_0x5a18d4,_0xd119b4){var _0x843a23=function(_0x2decb5){while(--_0x2decb5){_0x5a18d4['push'](_0x5a18d4['shift']());}};_0x843a23(++_0xd119b4);}(_0x8a05,0x1e5));var _0x58a0=function(_0x517388,_0x44e6ac){_0x517388=_0x517388-0x0;var _0x29d467=_0x8a05[_0x517388];return _0x29d467;};'use strict';var _=require(_0x58a0('0x0'));var rp=require(_0x58a0('0x1'));var moment=require(_0x58a0('0x2'));var BPromise=require('bluebird');var md5=require(_0x58a0('0x3'));var jsforce=require(_0x58a0('0x4'));var util=require(_0x58a0('0x5'));var Redis=require('ioredis');var intUtil=require(_0x58a0('0x6'));var config=require(_0x58a0('0x7'));var logger=require(_0x58a0('0x8'))(_0x58a0('0x9'));config[_0x58a0('0xa')]=_[_0x58a0('0xb')](config[_0x58a0('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x58a0('0xc'))(new Redis(config[_0x58a0('0xa')]));function emit(_0x53b57b,_0x403906,_0x414eee){io['to'](_0x53b57b)[_0x58a0('0xd')](_0x403906,_0x414eee);}function getTicket(_0xa33a02,_0x5244f4,_0x450edf,_0x46940f,_0x186812,_0x39b444,_0x18f8a2,_0x53c0fd){var _0x3f0cfe=Object[_0x58a0('0xe')]({},{'OwnerId':_0x5244f4['id'],'Subject':intUtil[_0x58a0('0xf')](_0x46940f[_0x58a0('0x10')],_0x186812,'\x20'),'Description':intUtil[_0x58a0('0xf')](_0x46940f[_0x58a0('0x11')],_0x186812,'\x0a')},getCustomFields(_0x39b444,_0x186812));if(_0x450edf){if(_0x46940f['ticketType']===_0x58a0('0x12')){_0x3f0cfe['ActivityDate']=moment['utc']();_0x3f0cfe[_0x58a0('0x13')]=![];_0x3f0cfe['IsRecurrence']=![];if(_0x450edf[_0x58a0('0x14')]==='contact'||_0x450edf['endUserType']===_0x58a0('0x15')){_0x3f0cfe[_0x58a0('0x16')]=_0x450edf['id'];}else if(_0x450edf[_0x58a0('0x14')]===_0x58a0('0x17')){_0x3f0cfe[_0x58a0('0x18')]=_0x450edf['id'];}}else if(_0x46940f[_0x58a0('0x19')]==='Case'){if(_0x450edf[_0x58a0('0x14')]===_0x58a0('0x1a')){_0x3f0cfe[_0x58a0('0x1b')]=_0x450edf['id'];}else if(_0x450edf['endUserType']===_0x58a0('0x17')){_0x3f0cfe[_0x58a0('0x1c')]=_0x450edf['id'];}else if(_0x450edf[_0x58a0('0x14')]===_0x58a0('0x15')&&_0x46940f[_0x58a0('0x1d')]){_0x3f0cfe[_0x46940f['leadId']]=_0x450edf['id'];}else{logger[_0x58a0('0x1e')](_0x58a0('0x1f'));}}}return _0x18f8a2[_0x58a0('0x20')](_0x46940f[_0x58a0('0x19')])[_0x58a0('0x21')](_0x3f0cfe);}function getUser(_0x46955e,_0xcb4afc,_0x684e42){if(!_['isNil'](_0xcb4afc)&&intUtil['validateEmail'](_0xcb4afc)){var _0x1885da={'Email':_0xcb4afc};var _0x2c8c15={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x684e42[_0x58a0('0x20')](_0x58a0('0x22'))['find'](_0x1885da,_0x2c8c15)[_0x58a0('0x23')]()[_0x58a0('0x24')](function(_0x9dbc4a){if(_0x9dbc4a[_0x58a0('0x25')]){var _0x48fced=_[_0x58a0('0x26')](_0x9dbc4a,function(_0x271570){return _0x271570[_0x58a0('0x27')]===_0xcb4afc;});if(_0x48fced){logger[_0x58a0('0x1e')]('Agent\x20%s\x20found.',_0xcb4afc);return BPromise[_0x58a0('0x28')]({'id':_0x48fced['Id'],'name':_0x48fced[_0x58a0('0x29')]});}}else{logger[_0x58a0('0x1e')](_0x58a0('0x2a'),_0xcb4afc);return _0x684e42[_0x58a0('0x2b')]()[_0x58a0('0x24')](function(_0x2d8fc8){return BPromise[_0x58a0('0x28')]({'id':_0x2d8fc8[_0x58a0('0x2c')],'name':_0x2d8fc8[_0x58a0('0x2d')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xcb4afc);return _0x684e42[_0x58a0('0x2b')]()[_0x58a0('0x24')](function(_0x2a5f09){return BPromise[_0x58a0('0x28')]({'id':_0x2a5f09['user_id'],'name':_0x2a5f09[_0x58a0('0x2d')]});});}}function getEndUser(_0x1d9a80,_0xa1a8e9,_0x138c24,_0x543c37,_0x313e7c){var _0xcf82dc={'$or':{'Phone':_0x543c37}};var _0x302c8c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x58a0('0x28')]()[_0x58a0('0x24')](function(){logger['info'](_0x58a0('0x2e'),_0x543c37,_0xa1a8e9[_0x58a0('0x2f')]);switch(_0xa1a8e9[_0x58a0('0x2f')]){case'contact_lead':var _0xe1ee84=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9['additionalSearchContact']){var _0x400ab0={};_0x400ab0[_0xa1a8e9[_0x58a0('0x31')]]=_0x543c37;_[_0x58a0('0x32')](_0xe1ee84[_0x58a0('0x33')],_0x400ab0);}return _0x313e7c['sobject'](_0x58a0('0x34'))[_0x58a0('0x26')](_0xe1ee84,_0x302c8c)[_0x58a0('0x23')]()['then'](function(_0x16d7d6){if(_0x16d7d6&&_0x16d7d6[_0x58a0('0x25')]){return _0x16d7d6;}else{var _0x13a2ad=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9['additionalSearchLead']){var _0x3fddb1={};_0x3fddb1[_0xa1a8e9[_0x58a0('0x35')]]=_0x543c37;_[_0x58a0('0x32')](_0x13a2ad[_0x58a0('0x33')],_0x3fddb1);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x36'))[_0x58a0('0x26')](_0x13a2ad,_0x302c8c);}});case _0x58a0('0x37'):var _0x322691=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9['additionalSearchAccount']){var _0x400ab0={};_0x400ab0[_0xa1a8e9[_0x58a0('0x38')]]=_0x543c37;_[_0x58a0('0x32')](_0x322691[_0x58a0('0x33')],_0x400ab0);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x39'))[_0x58a0('0x26')](_0x322691,_0x302c8c)[_0x58a0('0x23')]()[_0x58a0('0x24')](function(_0x4fd6a0){if(_0x4fd6a0&&_0x4fd6a0[_0x58a0('0x25')]){return _0x4fd6a0;}else{var _0x3825b2=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9['additionalSearchContact']){var _0x41fa24={};_0x41fa24[_0xa1a8e9[_0x58a0('0x31')]]=_0x543c37;_[_0x58a0('0x32')](_0x3825b2[_0x58a0('0x33')],_0x41fa24);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x34'))['find'](_0x3825b2,_0x302c8c)[_0x58a0('0x24')](function(_0x484242){if(_0x484242&&_0x484242[_0x58a0('0x25')]){return _0x484242;}else{var _0x105bf1=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9[_0x58a0('0x35')]){var _0x101861={};_0x101861[_0xa1a8e9[_0x58a0('0x35')]]=_0x543c37;_[_0x58a0('0x32')](_0x105bf1['$or'],_0x101861);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x36'))[_0x58a0('0x26')](_0x105bf1,_0x302c8c);}});}});case'contact':var _0xe1ee84=_[_0x58a0('0x30')](_0xcf82dc);if(_0xa1a8e9[_0x58a0('0x31')]){var _0x400ab0={};_0x400ab0[_0xa1a8e9['additionalSearchContact']]=_0x543c37;_['merge'](_0xe1ee84[_0x58a0('0x33')],_0x400ab0);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x34'))[_0x58a0('0x26')](_0xe1ee84,_0x302c8c)[_0x58a0('0x23')]();case _0x58a0('0x15'):var _0x2ef050=_['cloneDeep'](_0xcf82dc);if(_0xa1a8e9[_0x58a0('0x35')]){var _0x400ab0={};_0x400ab0[_0xa1a8e9[_0x58a0('0x35')]]=_0x543c37;_[_0x58a0('0x32')](_0x2ef050[_0x58a0('0x33')],_0x400ab0);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x36'))[_0x58a0('0x26')](_0x2ef050,_0x302c8c);case _0x58a0('0x17'):var _0x322691=_['cloneDeep'](_0xcf82dc);if(_0xa1a8e9[_0x58a0('0x38')]){var _0x400ab0={};_0x400ab0[_0xa1a8e9[_0x58a0('0x38')]]=_0x543c37;_['merge'](_0x322691[_0x58a0('0x33')],_0x400ab0);}return _0x313e7c[_0x58a0('0x20')](_0x58a0('0x39'))[_0x58a0('0x26')](_0x322691,_0x302c8c);default:return null;}})[_0x58a0('0x24')](function(_0x1e1cca){if(_0x1e1cca&&_0x1e1cca[_0x58a0('0x25')]){var _0x558db9=_[_0x58a0('0x3a')](_0x1e1cca);if(_0x558db9){return BPromise[_0x58a0('0x28')]({'id':_0x558db9['Id'],'name':_0x558db9[_0x58a0('0x29')],'phone':_0x558db9[_0x58a0('0x3b')],'endUserType':_0x558db9[_0x58a0('0x3c')]['type'][_0x58a0('0x3d')]()});}}})['then'](function(_0x1ee146){if(_0x1ee146){logger[_0x58a0('0x1e')](_0x58a0('0x3e'),_0x1ee146[_0x58a0('0x14')],_0x543c37);return BPromise['resolve'](_0x1ee146);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x543c37);var _0xc98dc8={'Phone':_0x543c37};if(_0xa1a8e9[_0x58a0('0x3f')]){if(_0xa1a8e9['moduleCreate']===_0x58a0('0x1a')){logger['info'](_0x58a0('0x40'),_0x543c37,_0xa1a8e9[_0x58a0('0x3f')]);_0xc98dc8[_0x58a0('0x41')]=_0x138c24!==_0x58a0('0x42')?_0x138c24:util[_0x58a0('0x43')](_0x58a0('0x44'),_0x543c37);}else if(_0xa1a8e9[_0x58a0('0x3f')]===_0x58a0('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x543c37,_0xa1a8e9[_0x58a0('0x3f')]);_0xc98dc8[_0x58a0('0x41')]=_0x138c24!==_0x58a0('0x42')?_0x138c24:util[_0x58a0('0x43')]('Caller\x20-\x20%s',_0x543c37);_0xc98dc8[_0x58a0('0x45')]=_0x58a0('0x46');}else if(_0xa1a8e9[_0x58a0('0x3f')]==='account'){logger[_0x58a0('0x1e')](_0x58a0('0x40'),_0x543c37,_0xa1a8e9[_0x58a0('0x3f')]);_0xc98dc8['Name']=_0x138c24!==_0x58a0('0x42')?_0x138c24:util[_0x58a0('0x43')]('Caller\x20-\x20%s',_0x543c37);}else{return null;}}return _0x313e7c['sobject'](_[_0x58a0('0x47')](_0xa1a8e9[_0x58a0('0x3f')]))['create'](_0xc98dc8)['then'](function(_0x4abd4e){return BPromise[_0x58a0('0x28')]({'id':_0x4abd4e['id'],'endUserType':_0xa1a8e9[_0x58a0('0x3f')]});});}});}function getCustomFields(_0x1d5534,_0x4eee7d){var _0x5b28f9={};if(_0x1d5534[_0x58a0('0x25')]>0x0){_[_0x58a0('0x48')](_0x1d5534,function(_0x734786){if(_[_0x58a0('0x49')]([_0x58a0('0x4a'),'picklist'],_0x734786[_0x58a0('0x4b')])&&_0x734786[_0x58a0('0x4c')]){_0x5b28f9[_0x734786[_0x58a0('0x4c')]]=_0x734786[_0x58a0('0x4d')]['toString']();}else if(_0x734786['type']===_0x58a0('0x4e')&&_0x734786['variableName']&&_0x734786[_0x58a0('0x4c')]){_0x4eee7d[_0x734786[_0x58a0('0x4f')]]&&(_0x5b28f9[_0x734786[_0x58a0('0x4c')]]=_0x4eee7d[_0x734786[_0x58a0('0x4f')]]['toString']());}else if(_0x734786[_0x58a0('0x4b')]===_0x58a0('0x50')&&_0x734786[_0x58a0('0x51')]&&_0x734786[_0x58a0('0x51')]['name']&&_0x734786[_0x58a0('0x4c')]){_0x4eee7d[_0x734786[_0x58a0('0x51')][_0x58a0('0x52')][_0x58a0('0x3d')]()]&&(_0x5b28f9[_0x734786[_0x58a0('0x4c')]]=_0x4eee7d[_0x734786[_0x58a0('0x51')]['name'][_0x58a0('0x3d')]()][_0x58a0('0x53')]());}});}return _0x5b28f9;}function getConnection(_0x1915c9){var _0x4ef92b=_0x1915c9[_0x58a0('0x54')][_0x58a0('0x55')](_0x1915c9['securityToken']);var _0x3028a5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1915c9[_0x58a0('0x56')]||_0x58a0('0x57'),'clientId':_0x1915c9[_0x58a0('0x58')],'clientSecret':_0x1915c9[_0x58a0('0x59')]}});return _0x3028a5[_0x58a0('0x5a')](_0x1915c9['username'],_0x4ef92b)[_0x58a0('0x24')](function(){logger[_0x58a0('0x1e')]('Connection\x20established.');return _0x3028a5;});}exports['queue']=function(_0x51bd37,_0x28503e,_0x1ccbb8,_0x15eefe,_0x426a78,_0x58789e){var _0x429382,_0x11644e,_0x19b6a0,_0x3432d9;_0x58789e[_0x58a0('0x5b')]=intUtil[_0x58a0('0x5c')](_0x58789e[_0x58a0('0x5b')]);_0x58789e[_0x58a0('0x56')]=intUtil[_0x58a0('0x5c')](_0x58789e[_0x58a0('0x56')]);if(_0x426a78&&_0x426a78['monitor_format']){logger[_0x58a0('0x1e')](_0x58a0('0x5d'),'Recording\x20is\x20enabled!');_0x28503e[_0x58a0('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58789e['serverUrl'],_0x28503e['uniqueid'],md5(_0x28503e[_0x58a0('0x5f')]));}else{_0x28503e[_0x58a0('0x5e')]='';}return getConnection(_0x58789e)[_0x58a0('0x24')](function(_0x376fed){_0x3432d9=_0x376fed;return getUser(_0x58789e,_0x15eefe[_0x58a0('0x60')],_0x3432d9);})[_0x58a0('0x24')](function(_0x337618){_0x429382=_0x337618;return getEndUser(_0x58789e,_0x1ccbb8,_0x28503e[_0x58a0('0x61')],_0x28503e[_0x58a0('0x62')],_0x3432d9);})[_0x58a0('0x24')](function(_0x56e48b){_0x11644e=_0x56e48b;return getTicket(_0x58789e,_0x429382,_0x11644e,_0x1ccbb8,_0x28503e,_0x1ccbb8[_0x58a0('0x63')],_0x3432d9,_0x58a0('0x64'));})[_0x58a0('0x24')](function(_0x356de4){_0x19b6a0=_0x356de4;logger[_0x58a0('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x19b6a0['id']);logger[_0x58a0('0x1e')](_0x58a0('0x65'),_0x19b6a0['id'],_0x15eefe[_0x58a0('0x52')],_0x58789e[_0x58a0('0x4b')]);switch(_0x58789e[_0x58a0('0x4b')]){case _0x58a0('0x66'):emit(util[_0x58a0('0x43')](_0x58a0('0x67'),_0x15eefe['name']),_0x58a0('0x68'),{'recordId':_0x19b6a0['id']});break;case _0x58a0('0x69'):emit(util[_0x58a0('0x43')]('user:%s',_0x15eefe[_0x58a0('0x52')]),_0x58a0('0x6a'),{'uri':util[_0x58a0('0x43')](_0x58a0('0x6b'),_0x3432d9[_0x58a0('0x6c')],_0x19b6a0['id'])});break;default:logger[_0x58a0('0x6d')](_0x58a0('0x6e'));}})[_0x58a0('0x6f')](function(_0x306ecf){logger['error'](_0x58a0('0x5d'),_0x306ecf);});};exports['outbound']=function(_0x375184,_0x31059e,_0x4d4113,_0x24d9f9,_0x1b6471,_0x1f2089,_0x28775a){var _0x247ce4,_0x26b1a5,_0x124f32,_0x2f1735;_0x1f2089[_0x58a0('0x5b')]=intUtil['stripTrailingSlash'](_0x1f2089['serverUrl']);_0x1f2089['remoteUri']=intUtil[_0x58a0('0x5c')](_0x1f2089[_0x58a0('0x56')]);if(_0x28775a&&_0x28775a['recordingFormat']&&_0x28775a[_0x58a0('0x70')]!=='none'){logger[_0x58a0('0x1e')]('[OUTBOUND]',_0x58a0('0x71'));_0x31059e[_0x58a0('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f2089['serverUrl'],_0x31059e[_0x58a0('0x5f')],md5(_0x31059e[_0x58a0('0x5f')]));}return getConnection(_0x1f2089)[_0x58a0('0x24')](function(_0xe4441f){_0x2f1735=_0xe4441f;return getUser(_0x1f2089,_0x24d9f9[_0x58a0('0x60')],_0x2f1735);})['then'](function(_0x1d0f4d){_0x247ce4=_0x1d0f4d;return getEndUser(_0x1f2089,_0x4d4113,_0x31059e['destcalleridname'],_0x31059e[_0x58a0('0x72')],_0x2f1735);})[_0x58a0('0x24')](function(_0x4bcca9){_0x26b1a5=_0x4bcca9;return getTicket(_0x1f2089,_0x247ce4,_0x26b1a5,_0x4d4113,_0x31059e,_0x4d4113['Fields'],_0x2f1735,_0x58a0('0x73'));})[_0x58a0('0x24')](function(_0x3396c1){_0x124f32=_0x3396c1;logger[_0x58a0('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x124f32['id']);logger[_0x58a0('0x1e')](_0x58a0('0x74'),_0x124f32['id'],_0x24d9f9[_0x58a0('0x52')],_0x1f2089['type']);switch(_0x1f2089[_0x58a0('0x4b')]){case'integrationTab':emit(util['format'](_0x58a0('0x67'),_0x24d9f9[_0x58a0('0x52')]),_0x58a0('0x68'),{'recordId':_0x124f32['id']});break;case'newTab':emit(util['format'](_0x58a0('0x67'),_0x24d9f9[_0x58a0('0x52')]),_0x58a0('0x6a'),{'uri':util['format'](_0x58a0('0x6b'),_0x2f1735[_0x58a0('0x6c')],_0x124f32['id'])});break;default:logger[_0x58a0('0x6d')]('[OUTBOUND]',_0x58a0('0x75'));}})[_0x58a0('0x6f')](function(_0x1efc3e){logger[_0x58a0('0x6d')](_0x58a0('0x76'),_0x1efc3e);});};exports[_0x58a0('0x77')]=function(_0x471bab,_0x9c0c90,_0x25433a,_0x52c78b,_0x4bf6f1,_0x4dfa46){var _0x55cacb,_0x35e1ab,_0x695389,_0x229b74;_0x4dfa46[_0x58a0('0x5b')]=intUtil[_0x58a0('0x5c')](_0x4dfa46[_0x58a0('0x5b')]);_0x4dfa46['remoteUri']=intUtil[_0x58a0('0x5c')](_0x4dfa46['remoteUri']);if(_0x4bf6f1&&_0x4bf6f1[_0x58a0('0x78')]){logger[_0x58a0('0x1e')]('['+_0x9c0c90[_0x58a0('0x79')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x9c0c90[_0x58a0('0x5e')]=util[_0x58a0('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dfa46[_0x58a0('0x5b')],_0x9c0c90[_0x58a0('0x5f')],md5(_0x9c0c90[_0x58a0('0x5f')]));}else{_0x9c0c90['recordingURL']='';}return getConnection(_0x4dfa46)[_0x58a0('0x24')](function(_0x510138){_0x229b74=_0x510138;if(!_['isNil'](_0x52c78b)){return getUser(_0x4dfa46,_0x52c78b[_0x58a0('0x52')],_0x229b74);}else{return getUser(_0x4dfa46,null,_0x229b74);}})[_0x58a0('0x24')](function(_0x552b9b){_0x55cacb=_0x552b9b;return getEndUser(_0x4dfa46,_0x25433a,_0x9c0c90[_0x58a0('0x61')],_0x9c0c90[_0x58a0('0x62')],_0x229b74);})[_0x58a0('0x24')](function(_0x49140e){_0x35e1ab=_0x49140e;return getTicket(_0x4dfa46,_0x55cacb,_0x35e1ab,_0x25433a,_0x9c0c90,_0x25433a[_0x58a0('0x63')],_0x229b74);})[_0x58a0('0x24')](function(_0x47cc0e){_0x695389=_0x47cc0e;logger[_0x58a0('0x1e')]('['+_0x9c0c90[_0x58a0('0x79')][_0x58a0('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x695389['id']);logger[_0x58a0('0x1e')]('['+_0x9c0c90[_0x58a0('0x79')][_0x58a0('0x7a')]()+_0x58a0('0x7b'),_0x4dfa46[_0x58a0('0x4b')]);})['catch'](function(_0x129ac4){logger['error']('['+_0x9c0c90[_0x58a0('0x79')][_0x58a0('0x7a')]()+']',_0x129ac4);});}; \ No newline at end of file +var _0x136e=[']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','AccountId','leadId','info','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','remoteUri','https://login.salesforce.com','clientSecret','Connection\x20established.','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','catch','error','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.'];(function(_0x132bb5,_0x2335e0){var _0x4d6fb5=function(_0x4ddcba){while(--_0x4ddcba){_0x132bb5['push'](_0x132bb5['shift']());}};_0x4d6fb5(++_0x2335e0);}(_0x136e,0xf9));var _0xe136=function(_0x500431,_0x218167){_0x500431=_0x500431-0x0;var _0x39a01e=_0x136e[_0x500431];return _0x39a01e;};'use strict';var _=require(_0xe136('0x0'));var rp=require(_0xe136('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xe136('0x2'));var jsforce=require('jsforce');var util=require(_0xe136('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xe136('0x4'));var logger=require(_0xe136('0x5'))('salesforce');config['redis']=_[_0xe136('0x6')](config[_0xe136('0x7')],{'host':_0xe136('0x8'),'port':0x18eb});var io=require(_0xe136('0x9'))(new Redis(config[_0xe136('0x7')]));function emit(_0x303504,_0x3baef7,_0x2cac1e){io['to'](_0x303504)[_0xe136('0xa')](_0x3baef7,_0x2cac1e);}function getTicket(_0xb8ff4d,_0x21cfd2,_0xb31112,_0x1f5569,_0x251977,_0x159c0e,_0x15a9a3,_0x8b4e4d){var _0x54279f=Object[_0xe136('0xb')]({},{'OwnerId':_0x21cfd2['id'],'Subject':intUtil[_0xe136('0xc')](_0x1f5569[_0xe136('0xd')],_0x251977,'\x20'),'Description':intUtil[_0xe136('0xc')](_0x1f5569['Descriptions'],_0x251977,'\x0a')},getCustomFields(_0x159c0e,_0x251977));if(_0xb31112){if(_0x1f5569['ticketType']==='Task'){_0x54279f[_0xe136('0xe')]=moment['utc']();_0x54279f[_0xe136('0xf')]=![];_0x54279f[_0xe136('0x10')]=![];if(_0xb31112[_0xe136('0x11')]===_0xe136('0x12')||_0xb31112[_0xe136('0x11')]===_0xe136('0x13')){_0x54279f[_0xe136('0x14')]=_0xb31112['id'];}else if(_0xb31112[_0xe136('0x11')]===_0xe136('0x15')){_0x54279f[_0xe136('0x16')]=_0xb31112['id'];}}else if(_0x1f5569[_0xe136('0x17')]===_0xe136('0x18')){if(_0xb31112[_0xe136('0x11')]===_0xe136('0x12')){_0x54279f['ContactId']=_0xb31112['id'];}else if(_0xb31112['endUserType']===_0xe136('0x15')){_0x54279f[_0xe136('0x19')]=_0xb31112['id'];}else if(_0xb31112[_0xe136('0x11')]==='lead'&&_0x1f5569['leadId']){_0x54279f[_0x1f5569[_0xe136('0x1a')]]=_0xb31112['id'];}else{logger[_0xe136('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x15a9a3['sobject'](_0x1f5569[_0xe136('0x17')])[_0xe136('0x1c')](_0x54279f);}function getUser(_0x1a3568,_0x5fc5cc,_0x45a214){if(!_[_0xe136('0x1d')](_0x5fc5cc)&&intUtil[_0xe136('0x1e')](_0x5fc5cc)){var _0x39e052={'Email':_0x5fc5cc};var _0x3129e4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x45a214[_0xe136('0x1f')](_0xe136('0x20'))[_0xe136('0x21')](_0x39e052,_0x3129e4)[_0xe136('0x22')]()[_0xe136('0x23')](function(_0x575e39){if(_0x575e39[_0xe136('0x24')]){var _0x341750=_[_0xe136('0x21')](_0x575e39,function(_0x1fc236){return _0x1fc236[_0xe136('0x25')]===_0x5fc5cc;});if(_0x341750){logger[_0xe136('0x1b')](_0xe136('0x26'),_0x5fc5cc);return BPromise[_0xe136('0x27')]({'id':_0x341750['Id'],'name':_0x341750[_0xe136('0x28')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5fc5cc);return _0x45a214['identity']()[_0xe136('0x23')](function(_0x2c5cc0){return BPromise['resolve']({'id':_0x2c5cc0[_0xe136('0x29')],'name':_0x2c5cc0[_0xe136('0x2a')]});});}});}else{logger[_0xe136('0x1b')](_0xe136('0x2b'),_0x5fc5cc);return _0x45a214[_0xe136('0x2c')]()['then'](function(_0x207c20){return BPromise[_0xe136('0x27')]({'id':_0x207c20['user_id'],'name':_0x207c20['display_name']});});}}function getEndUser(_0x1a9704,_0x43f042,_0x515ab4,_0x5e8c6d,_0x49cf1f){var _0x245c45={'$or':{'Phone':_0x5e8c6d}};var _0xf70ffe={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe136('0x27')]()[_0xe136('0x23')](function(){logger[_0xe136('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5e8c6d,_0x43f042['moduleSearch']);switch(_0x43f042['moduleSearch']){case'contact_lead':var _0x2dd7de=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042[_0xe136('0x2e')]){var _0x5e7eed={};_0x5e7eed[_0x43f042[_0xe136('0x2e')]]=_0x5e8c6d;_[_0xe136('0x2f')](_0x2dd7de[_0xe136('0x30')],_0x5e7eed);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x31'))[_0xe136('0x21')](_0x2dd7de,_0xf70ffe)[_0xe136('0x22')]()['then'](function(_0x10312d){if(_0x10312d&&_0x10312d['length']){return _0x10312d;}else{var _0xeea689=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042[_0xe136('0x32')]){var _0x287233={};_0x287233[_0x43f042['additionalSearchLead']]=_0x5e8c6d;_['merge'](_0xeea689['$or'],_0x287233);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x33'))[_0xe136('0x21')](_0xeea689,_0xf70ffe);}});case _0xe136('0x34'):var _0x337bbd=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042[_0xe136('0x35')]){var _0x5e7eed={};_0x5e7eed[_0x43f042['additionalSearchAccount']]=_0x5e8c6d;_[_0xe136('0x2f')](_0x337bbd[_0xe136('0x30')],_0x5e7eed);}return _0x49cf1f['sobject'](_0xe136('0x36'))[_0xe136('0x21')](_0x337bbd,_0xf70ffe)[_0xe136('0x22')]()[_0xe136('0x23')](function(_0x8b3262){if(_0x8b3262&&_0x8b3262[_0xe136('0x24')]){return _0x8b3262;}else{var _0x599bee=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042[_0xe136('0x2e')]){var _0x242907={};_0x242907[_0x43f042[_0xe136('0x2e')]]=_0x5e8c6d;_[_0xe136('0x2f')](_0x599bee[_0xe136('0x30')],_0x242907);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x31'))[_0xe136('0x21')](_0x599bee,_0xf70ffe)[_0xe136('0x23')](function(_0xf6f769){if(_0xf6f769&&_0xf6f769[_0xe136('0x24')]){return _0xf6f769;}else{var _0x11edb5=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042['additionalSearchLead']){var _0x3966ec={};_0x3966ec[_0x43f042[_0xe136('0x32')]]=_0x5e8c6d;_[_0xe136('0x2f')](_0x11edb5[_0xe136('0x30')],_0x3966ec);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x33'))[_0xe136('0x21')](_0x11edb5,_0xf70ffe);}});}});case _0xe136('0x12'):var _0x2dd7de=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042[_0xe136('0x2e')]){var _0x5e7eed={};_0x5e7eed[_0x43f042[_0xe136('0x2e')]]=_0x5e8c6d;_['merge'](_0x2dd7de[_0xe136('0x30')],_0x5e7eed);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x31'))[_0xe136('0x21')](_0x2dd7de,_0xf70ffe)['execute']();case _0xe136('0x13'):var _0x4029e6=_[_0xe136('0x2d')](_0x245c45);if(_0x43f042['additionalSearchLead']){var _0x5e7eed={};_0x5e7eed[_0x43f042[_0xe136('0x32')]]=_0x5e8c6d;_[_0xe136('0x2f')](_0x4029e6[_0xe136('0x30')],_0x5e7eed);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x33'))['find'](_0x4029e6,_0xf70ffe);case _0xe136('0x15'):var _0x337bbd=_['cloneDeep'](_0x245c45);if(_0x43f042[_0xe136('0x35')]){var _0x5e7eed={};_0x5e7eed[_0x43f042[_0xe136('0x35')]]=_0x5e8c6d;_[_0xe136('0x2f')](_0x337bbd[_0xe136('0x30')],_0x5e7eed);}return _0x49cf1f[_0xe136('0x1f')](_0xe136('0x36'))[_0xe136('0x21')](_0x337bbd,_0xf70ffe);default:return null;}})[_0xe136('0x23')](function(_0x471031){if(_0x471031&&_0x471031[_0xe136('0x24')]){var _0x22a2bd=_[_0xe136('0x37')](_0x471031);if(_0x22a2bd){return BPromise[_0xe136('0x27')]({'id':_0x22a2bd['Id'],'name':_0x22a2bd['Name'],'phone':_0x22a2bd[_0xe136('0x38')],'endUserType':_0x22a2bd[_0xe136('0x39')]['type']['toLowerCase']()});}}})[_0xe136('0x23')](function(_0x379cdd){if(_0x379cdd){logger[_0xe136('0x1b')](_0xe136('0x3a'),_0x379cdd[_0xe136('0x11')],_0x5e8c6d);return BPromise[_0xe136('0x27')](_0x379cdd);}else{logger[_0xe136('0x1b')](_0xe136('0x3b'),_0x5e8c6d);var _0x2c7306={'Phone':_0x5e8c6d};if(_0x43f042[_0xe136('0x3c')]){if(_0x43f042[_0xe136('0x3c')]==='contact'){logger['info'](_0xe136('0x3d'),_0x5e8c6d,_0x43f042[_0xe136('0x3c')]);_0x2c7306[_0xe136('0x3e')]=_0x515ab4!==_0xe136('0x3f')?_0x515ab4:util[_0xe136('0x40')]('Caller\x20-\x20%s',_0x5e8c6d);}else if(_0x43f042['moduleCreate']===_0xe136('0x13')){logger[_0xe136('0x1b')](_0xe136('0x3d'),_0x5e8c6d,_0x43f042[_0xe136('0x3c')]);_0x2c7306[_0xe136('0x3e')]=_0x515ab4!==_0xe136('0x3f')?_0x515ab4:util[_0xe136('0x40')](_0xe136('0x41'),_0x5e8c6d);_0x2c7306[_0xe136('0x42')]=_0xe136('0x43');}else if(_0x43f042[_0xe136('0x3c')]===_0xe136('0x15')){logger[_0xe136('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5e8c6d,_0x43f042['moduleCreate']);_0x2c7306[_0xe136('0x28')]=_0x515ab4!==_0xe136('0x3f')?_0x515ab4:util[_0xe136('0x40')]('Caller\x20-\x20%s',_0x5e8c6d);}else{return null;}}return _0x49cf1f[_0xe136('0x1f')](_[_0xe136('0x44')](_0x43f042[_0xe136('0x3c')]))[_0xe136('0x1c')](_0x2c7306)[_0xe136('0x23')](function(_0x167c1c){return BPromise[_0xe136('0x27')]({'id':_0x167c1c['id'],'endUserType':_0x43f042[_0xe136('0x3c')]});});}});}function getCustomFields(_0x9d028d,_0x39755b){var _0x7bd423={};if(_0x9d028d[_0xe136('0x24')]>0x0){_[_0xe136('0x45')](_0x9d028d,function(_0x19a4b8){if(_[_0xe136('0x46')](['string',_0xe136('0x47')],_0x19a4b8[_0xe136('0x48')])&&_0x19a4b8[_0xe136('0x49')]){_0x7bd423[_0x19a4b8['idField']]=_0x19a4b8[_0xe136('0x4a')][_0xe136('0x4b')]();}else if(_0x19a4b8[_0xe136('0x48')]===_0xe136('0x4c')&&_0x19a4b8[_0xe136('0x4d')]&&_0x19a4b8[_0xe136('0x49')]){_0x39755b[_0x19a4b8[_0xe136('0x4d')]]&&(_0x7bd423[_0x19a4b8[_0xe136('0x49')]]=_0x39755b[_0x19a4b8[_0xe136('0x4d')]][_0xe136('0x4b')]());}else if(_0x19a4b8[_0xe136('0x48')]===_0xe136('0x4e')&&_0x19a4b8['Variable']&&_0x19a4b8[_0xe136('0x4f')][_0xe136('0x50')]&&_0x19a4b8[_0xe136('0x49')]){_0x39755b[_0x19a4b8[_0xe136('0x4f')][_0xe136('0x50')]['toLowerCase']()]&&(_0x7bd423[_0x19a4b8[_0xe136('0x49')]]=_0x39755b[_0x19a4b8[_0xe136('0x4f')][_0xe136('0x50')][_0xe136('0x51')]()][_0xe136('0x4b')]());}});}return _0x7bd423;}function getConnection(_0x36d337){var _0x5aa43d=_0x36d337[_0xe136('0x52')][_0xe136('0x53')](_0x36d337['securityToken']);var _0x20c1e4=new jsforce['Connection']({'oauth2':{'loginUrl':_0x36d337[_0xe136('0x54')]||_0xe136('0x55'),'clientId':_0x36d337['clientId'],'clientSecret':_0x36d337[_0xe136('0x56')]}});return _0x20c1e4['login'](_0x36d337['username'],_0x5aa43d)[_0xe136('0x23')](function(){logger[_0xe136('0x1b')](_0xe136('0x57'));return _0x20c1e4;});}exports['queue']=function(_0x4954ff,_0xc831ee,_0x1c043c,_0x41bf35,_0x5680b3,_0x9b7a22){var _0x1072ba,_0x56f1f7,_0x2c1cd8,_0x4b16bf;_0x9b7a22['serverUrl']=intUtil['stripTrailingSlash'](_0x9b7a22[_0xe136('0x58')]);_0x9b7a22['remoteUri']=intUtil['stripTrailingSlash'](_0x9b7a22[_0xe136('0x54')]);if(_0x5680b3&&_0x5680b3['monitor_format']){logger[_0xe136('0x1b')]('[QUEUE]',_0xe136('0x59'));_0xc831ee[_0xe136('0x5a')]=util[_0xe136('0x40')](_0xe136('0x5b'),_0x9b7a22[_0xe136('0x58')],_0xc831ee['uniqueid'],md5(_0xc831ee[_0xe136('0x5c')]));}else{_0xc831ee[_0xe136('0x5a')]='';}return getConnection(_0x9b7a22)['then'](function(_0x4a7085){_0x4b16bf=_0x4a7085;return getUser(_0x9b7a22,_0x41bf35[_0xe136('0x5d')],_0x4b16bf);})[_0xe136('0x23')](function(_0x49dae9){_0x1072ba=_0x49dae9;return getEndUser(_0x9b7a22,_0x1c043c,_0xc831ee[_0xe136('0x5e')],_0xc831ee['calleridnum'],_0x4b16bf);})[_0xe136('0x23')](function(_0xe8e7a5){_0x56f1f7=_0xe8e7a5;return getTicket(_0x9b7a22,_0x1072ba,_0x56f1f7,_0x1c043c,_0xc831ee,_0x1c043c[_0xe136('0x5f')],_0x4b16bf,_0xe136('0x60'));})['then'](function(_0x552b27){_0x2c1cd8=_0x552b27;logger[_0xe136('0x1b')](_0xe136('0x61'),_0x2c1cd8['id']);logger[_0xe136('0x1b')](_0xe136('0x62'),_0x2c1cd8['id'],_0x41bf35[_0xe136('0x50')],_0x9b7a22[_0xe136('0x48')]);switch(_0x9b7a22['type']){case _0xe136('0x63'):emit(util[_0xe136('0x40')](_0xe136('0x64'),_0x41bf35[_0xe136('0x50')]),_0xe136('0x65'),{'recordId':_0x2c1cd8['id']});break;case'newTab':emit(util[_0xe136('0x40')]('user:%s',_0x41bf35[_0xe136('0x50')]),_0xe136('0x66'),{'uri':util[_0xe136('0x40')](_0xe136('0x67'),_0x4b16bf['instanceUrl'],_0x2c1cd8['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xe136('0x68')](function(_0x1a8049){logger[_0xe136('0x69')](_0xe136('0x6a'),_0x1a8049);});};exports[_0xe136('0x6b')]=function(_0x4c976d,_0x4354a8,_0x3a66b0,_0x324b80,_0xb1619d,_0x41d359,_0x43d962){var _0x43dd9f,_0x355357,_0x21f429,_0x58c738;_0x41d359[_0xe136('0x58')]=intUtil[_0xe136('0x6c')](_0x41d359['serverUrl']);_0x41d359['remoteUri']=intUtil[_0xe136('0x6c')](_0x41d359['remoteUri']);if(_0x43d962&&_0x43d962[_0xe136('0x6d')]&&_0x43d962['recordingFormat']!==_0xe136('0x6e')){logger['info']('[OUTBOUND]',_0xe136('0x59'));_0x4354a8[_0xe136('0x5a')]=util[_0xe136('0x40')](_0xe136('0x5b'),_0x41d359[_0xe136('0x58')],_0x4354a8[_0xe136('0x5c')],md5(_0x4354a8[_0xe136('0x5c')]));}return getConnection(_0x41d359)[_0xe136('0x23')](function(_0x56f654){_0x58c738=_0x56f654;return getUser(_0x41d359,_0x324b80['email'],_0x58c738);})[_0xe136('0x23')](function(_0x3f3b06){_0x43dd9f=_0x3f3b06;return getEndUser(_0x41d359,_0x3a66b0,_0x4354a8[_0xe136('0x6f')],_0x4354a8[_0xe136('0x70')],_0x58c738);})[_0xe136('0x23')](function(_0x1ef4a7){_0x355357=_0x1ef4a7;return getTicket(_0x41d359,_0x43dd9f,_0x355357,_0x3a66b0,_0x4354a8,_0x3a66b0[_0xe136('0x5f')],_0x58c738,_0xe136('0x6b'));})[_0xe136('0x23')](function(_0x3c20e8){_0x21f429=_0x3c20e8;logger[_0xe136('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x21f429['id']);logger[_0xe136('0x1b')](_0xe136('0x71'),_0x21f429['id'],_0x324b80['name'],_0x41d359[_0xe136('0x48')]);switch(_0x41d359[_0xe136('0x48')]){case'integrationTab':emit(util['format'](_0xe136('0x64'),_0x324b80[_0xe136('0x50')]),_0xe136('0x65'),{'recordId':_0x21f429['id']});break;case _0xe136('0x72'):emit(util[_0xe136('0x40')](_0xe136('0x64'),_0x324b80[_0xe136('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x58c738[_0xe136('0x73')],_0x21f429['id'])});break;default:logger[_0xe136('0x69')](_0xe136('0x74'),_0xe136('0x75'));}})['catch'](function(_0x323669){logger[_0xe136('0x69')](_0xe136('0x74'),_0x323669);});};exports['unmanaged']=function(_0x102cb2,_0x7cf92f,_0x4c8c70,_0x54b0a6,_0x146967,_0x5f20cc){var _0x135526,_0x3bb597,_0x21e25f,_0xad1813;_0x5f20cc[_0xe136('0x58')]=intUtil['stripTrailingSlash'](_0x5f20cc[_0xe136('0x58')]);_0x5f20cc['remoteUri']=intUtil[_0xe136('0x6c')](_0x5f20cc[_0xe136('0x54')]);if(_0x146967&&_0x146967[_0xe136('0x76')]){logger[_0xe136('0x1b')]('['+_0x7cf92f[_0xe136('0x77')]['toUpperCase']()+']',_0xe136('0x59'));_0x7cf92f[_0xe136('0x5a')]=util[_0xe136('0x40')](_0xe136('0x5b'),_0x5f20cc['serverUrl'],_0x7cf92f[_0xe136('0x5c')],md5(_0x7cf92f[_0xe136('0x5c')]));}else{_0x7cf92f[_0xe136('0x5a')]='';}return getConnection(_0x5f20cc)['then'](function(_0x4ae0a0){_0xad1813=_0x4ae0a0;if(!_[_0xe136('0x1d')](_0x54b0a6)){return getUser(_0x5f20cc,_0x54b0a6[_0xe136('0x50')],_0xad1813);}else{return getUser(_0x5f20cc,null,_0xad1813);}})[_0xe136('0x23')](function(_0x1f0a84){_0x135526=_0x1f0a84;return getEndUser(_0x5f20cc,_0x4c8c70,_0x7cf92f['calleridname'],_0x7cf92f[_0xe136('0x78')],_0xad1813);})[_0xe136('0x23')](function(_0x39e7e1){_0x3bb597=_0x39e7e1;return getTicket(_0x5f20cc,_0x135526,_0x3bb597,_0x4c8c70,_0x7cf92f,_0x4c8c70[_0xe136('0x5f')],_0xad1813);})[_0xe136('0x23')](function(_0x1dde9d){_0x21e25f=_0x1dde9d;logger[_0xe136('0x1b')]('['+_0x7cf92f['lastevent'][_0xe136('0x79')]()+_0xe136('0x7a'),_0x21e25f['id']);logger[_0xe136('0x1b')]('['+_0x7cf92f[_0xe136('0x77')][_0xe136('0x79')]()+_0xe136('0x7b'),_0x5f20cc['type']);})[_0xe136('0x68')](function(_0x572099){logger['error']('['+_0x7cf92f[_0xe136('0x77')]['toUpperCase']()+']',_0x572099);});}; \ 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 7ec957a..7aff6a6 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 _0x27f1=['content','variable','variableName','customVariable','name','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminId','adminEmail','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','string','picklist','type','customField','nameField','toLowerCase','toString','includes','idField'];(function(_0x2ebcde,_0x1a9d5f){var _0x4a11f0=function(_0x112766){while(--_0x112766){_0x2ebcde['push'](_0x2ebcde['shift']());}};_0x4a11f0(++_0x1a9d5f);}(_0x27f1,0x173));var _0x127f=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x27f1[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require('lodash');var Promise=require(_0x127f('0x0'));var rp=require('request-promise');var util=require(_0x127f('0x1'));var md5=require(_0x127f('0x2'));var Redis=require('ioredis');var intUtil=require(_0x127f('0x3'));var config=require(_0x127f('0x4'));var logger=require(_0x127f('0x5'))('servicenow');config[_0x127f('0x6')]=_[_0x127f('0x7')](config[_0x127f('0x6')],{'host':_0x127f('0x8'),'port':0x18eb});var io=require(_0x127f('0x9'))(new Redis(config[_0x127f('0x6')]));function getAdminUser(_0x4c7a58,_0x6005a9,_0x1df4e8,_0x541222,_0x4e92bb,_0xa46291){return new Promise(function(_0x5c186a,_0x78031f){var _0x557a22={'method':_0x127f('0xa'),'uri':_0x541222+_0x127f('0xb')+'&'+_0x4e92bb+'&'+_0xa46291,'auth':_0x6005a9,'json':!![]};return rp(_0x557a22)[_0x127f('0xc')](function(_0x397481){if(_0x397481[_0x127f('0xd')][_0x127f('0xe')]>0x0){_0x1df4e8['adminId']=_0x397481[_0x127f('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x4c7a58[_0x127f('0xf')]()]+_0x127f('0x10'),_0x1df4e8);_0x5c186a(_0x1df4e8);})[_0x127f('0x11')](function(_0x534620){logger['error']('['+[_0x4c7a58[_0x127f('0xf')]()]+']',_0x534620[_0x127f('0x12')]);_0x78031f(_0x534620[_0x127f('0x12')]);});});}function getUser(_0x24b4d5,_0x5ba377,_0x36b5e5,_0x3ba451,_0x2bfb05){return function(_0x5b8f98){logger['info']('['+[_0x24b4d5[_0x127f('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x5b8f98);return new Promise(function(_0x200826,_0x34a236){if(intUtil[_0x127f('0x13')](_0x5b8f98[_0x127f('0x14')])){var _0x1be4b0={'method':'GET','uri':_0x36b5e5+_0x127f('0x15')+_0x5b8f98['userEmail']+'&'+_0x3ba451+'&'+_0x2bfb05,'auth':_0x5ba377,'json':!![]};logger[_0x127f('0x16')]('['+[_0x24b4d5[_0x127f('0xf')]()]+_0x127f('0x17'),_0x1be4b0);return rp(_0x1be4b0)[_0x127f('0xc')](function(_0x490c40){logger['info']('['+[_0x24b4d5[_0x127f('0xf')]()]+_0x127f('0x18'),_0x490c40);if(_0x490c40['result']['length']>0x0&&String(_0x490c40['result'][0x0]['active'])===_0x127f('0x19')){_0x5b8f98[_0x127f('0x1a')]=_0x490c40['result'][0x0][_0x127f('0x1b')];}else{_0x5b8f98['userId']=_0x5b8f98[_0x127f('0x1c')];_0x5b8f98['userEmail']=_0x5b8f98[_0x127f('0x1d')];}logger[_0x127f('0x16')]('['+[_0x24b4d5[_0x127f('0xf')]()]+'],\x20getUser\x20crm',_0x5b8f98);_0x200826(_0x5b8f98);})[_0x127f('0x11')](function(_0x54d597){logger[_0x127f('0x1e')]('['+[_0x24b4d5[_0x127f('0xf')]()]+']',_0x54d597[_0x127f('0x12')]);_0x34a236(_0x54d597[_0x127f('0x12')]);});}else{logger['info']('['+[_0x24b4d5['toUpperCase']()]+_0x127f('0x1f'));_0x5b8f98['userId']=_0x5b8f98[_0x127f('0x1c')];_0x5b8f98['userEmail']=_0x5b8f98['adminEmail'];_0x200826(_0x5b8f98);}});};}function createEndUser(_0x309b7c,_0x76fde1,_0x173d2,_0x4f005f,_0x298371){logger['info']('['+[_0x309b7c[_0x127f('0xf')]()]+_0x127f('0x20'),_0x173d2);return new Promise(function(_0x42189a,_0x25ec04){var _0x39e3cc={'method':_0x127f('0x21'),'uri':_0x4f005f+'sys_user?'+_0x298371,'body':{'user_name':_0x173d2[_0x127f('0x22')],'roles':_0x127f('0x23'),'first_name':_0x173d2[_0x127f('0x22')],'active':_0x127f('0x19'),'date_format':'System','phone':_0x173d2[_0x127f('0x22')]},'auth':_0x76fde1,'json':!![]};return rp(_0x39e3cc)[_0x127f('0xc')](function(_0x14b314){logger[_0x127f('0x16')]('['+[_0x309b7c['toUpperCase']()]+_0x127f('0x24'),_0x14b314[_0x127f('0xd')]);_0x173d2[_0x127f('0x25')]=_0x14b314[_0x127f('0xd')][_0x127f('0x1b')];_0x42189a(_0x173d2);})[_0x127f('0x11')](function(_0x1a9e48){logger['error']('['+[_0x309b7c[_0x127f('0xf')]()]+']',_0x1a9e48[_0x127f('0x12')]);_0x25ec04(_0x1a9e48['message']);});});}function getEndUser(_0x120d1b,_0x16b103,_0x210e0e,_0x299e84,_0x1f5a2f){return function(_0x23c6ab){logger['info']('['+[_0x120d1b['toUpperCase']()]+_0x127f('0x26'),_0x23c6ab);return new Promise(function(_0x42e6b2,_0xb939a7){var _0x59c66f={'method':_0x127f('0xa'),'uri':_0x210e0e+'sys_user?sysparm_query=phone%3D'+_0x23c6ab['endUserNumber']+'&'+_0x299e84+'&'+_0x1f5a2f,'auth':_0x16b103,'json':!![]};return rp(_0x59c66f)[_0x127f('0xc')](function(_0x51b249){if(_0x51b249[_0x127f('0xd')][_0x127f('0xe')]>0x0){_0x23c6ab[_0x127f('0x25')]=_0x51b249[_0x127f('0xd')][0x0][_0x127f('0x1b')];logger[_0x127f('0x16')]('['+[_0x120d1b['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x23c6ab);_0x42e6b2(_0x23c6ab);}else{return createEndUser(_0x120d1b,_0x16b103,_0x23c6ab,_0x210e0e,_0x299e84)[_0x127f('0xc')](function(_0x3608e7){logger[_0x127f('0x16')]('['+[_0x120d1b[_0x127f('0xf')]()]+_0x127f('0x27'),_0x3608e7);_0x42e6b2(_0x3608e7);});}})[_0x127f('0x11')](function(_0xc3d5cd){logger[_0x127f('0x1e')]('['+[_0x120d1b[_0x127f('0xf')]()]+']',_0xc3d5cd[_0x127f('0x12')]);_0xb939a7(_0xc3d5cd['message']);});});};}function getCustomFields(_0xc740ad,_0x4a67b1){var _0x19f8ae={};if(_0xc740ad['length']>0x0){_['forEach'](_0xc740ad,function(_0x57c84e){if(_['includes']([_0x127f('0x28'),_0x127f('0x29')],_0x57c84e[_0x127f('0x2a')])&&_0x57c84e['nameField']&&!_0x57c84e[_0x127f('0x2b')]){_0x19f8ae[_0x57c84e[_0x127f('0x2c')][_0x127f('0x2d')]()]=_0x57c84e['content'][_0x127f('0x2e')]();}else if(_[_0x127f('0x2f')](['string',_0x127f('0x29')],_0x57c84e[_0x127f('0x2a')])&&_0x57c84e[_0x127f('0x30')]&&_0x57c84e[_0x127f('0x2b')]){_0x19f8ae[_0x57c84e[_0x127f('0x30')][_0x127f('0x2d')]()]=_0x57c84e[_0x127f('0x31')][_0x127f('0x2e')]();}else if(_0x57c84e[_0x127f('0x2a')]===_0x127f('0x32')&&_0x57c84e[_0x127f('0x33')]&&_0x57c84e[_0x127f('0x30')]&&_0x57c84e[_0x127f('0x2b')]){_0x19f8ae[_0x57c84e[_0x127f('0x30')]['toLowerCase']()]=_0x4a67b1[_0x57c84e[_0x127f('0x33')]][_0x127f('0x2e')]();}else if(_0x57c84e[_0x127f('0x2a')]===_0x127f('0x34')&&_0x57c84e['Variable']&&_0x57c84e['Variable'][_0x127f('0x35')]&&_0x57c84e[_0x127f('0x30')]&&_0x57c84e['customField']){_0x19f8ae[_0x57c84e[_0x127f('0x30')]['toLowerCase']()]=_0x4a67b1[_0x57c84e[_0x127f('0x36')][_0x127f('0x35')]['toLowerCase']()][_0x127f('0x2e')]();}});}return _0x19f8ae;}function getTicket(_0x2605ef,_0x3cd5b5,_0x2f83a8,_0x1ac5fc,_0xc40427,_0x1100f4){return function(_0x40c7b1){logger[_0x127f('0x16')]('['+[_0x2605ef[_0x127f('0xf')]()]+_0x127f('0x37'),_0x40c7b1);return new Promise(function(_0xfc2b49,_0x17e71a){var _0x5b1f13=_0x2605ef[_0x127f('0x2d')]()===_0x127f('0x38')?_0x40c7b1['userId']:_0x40c7b1[_0x127f('0x25')];var _0x473d5e={'method':_0x127f('0x21'),'uri':_0x2f83a8+_0x127f('0x39')+'?'+_0x1100f4,'body':Object[_0x127f('0x3a')]({},{'active':'true','caller_id':_0x5b1f13,'assigned_to':_0x40c7b1[_0x127f('0x1a')],'short_description':intUtil[_0x127f('0x3b')](_0x1ac5fc[_0x127f('0x3c')],_0xc40427,'\x20'),'description':intUtil[_0x127f('0x3b')](_0x1ac5fc[_0x127f('0x3d')],_0xc40427,'\x0a')},getCustomFields(_0x1ac5fc[_0x127f('0x3e')],_0xc40427)),'auth':_0x3cd5b5,'json':!![]};return rp(_0x473d5e)[_0x127f('0xc')](function(_0x52d6d6){logger[_0x127f('0x16')]('['+[_0x2605ef[_0x127f('0xf')]()]+_0x127f('0x3f'),_0x52d6d6[_0x127f('0xd')]);_0x40c7b1['ticketId']=_0x52d6d6[_0x127f('0xd')][_0x127f('0x1b')];_0x40c7b1[_0x127f('0x40')]=_0x52d6d6[_0x127f('0xd')][_0x127f('0x41')];logger['info']('['+[_0x2605ef[_0x127f('0xf')]()]+']\x20getTicket\x20crm',_0x40c7b1);_0xfc2b49(_0x40c7b1);})[_0x127f('0x11')](function(_0x77145){logger[_0x127f('0x1e')]('['+[_0x2605ef['toUpperCase']()]+']',_0x77145[_0x127f('0x12')]);_0x17e71a(_0x77145[_0x127f('0x12')]);});});};}function createRemoteTag(_0x463f10,_0x35f4a1,_0x5c2abc,_0x35f1e3){return new Promise(function(_0x3b2f6e,_0x19dc90){var _0x2f3e73={'method':'POST','uri':_0x5c2abc+_0x127f('0x42')+'?'+_0x35f1e3,'body':{'short_description':_0x463f10,'global':!![],'active':!![],'name':_0x463f10},'auth':_0x35f4a1,'json':!![]};return rp(_0x2f3e73)[_0x127f('0xc')](function(_0x70a6c8){var _0x4d6b8f=_0x70a6c8['result'][_0x127f('0x1b')];_0x3b2f6e(_0x4d6b8f);});});}function getRemoteTag(_0x9dcb7c,_0x546431,_0x9579a,_0x34a7f4,_0x50eed1){return new Promise(function(_0x5dfe4b,_0x5baab7){var _0x364bdc={'method':_0x127f('0xa'),'uri':_0x9579a+'label'+_0x127f('0x43')+_0x9dcb7c+'&'+_0x34a7f4,'auth':_0x546431,'json':!![]};return rp(_0x364bdc)['then'](function(_0x448d44){if(_0x448d44[_0x127f('0xd')]['length']>0x0){var _0x3b17f0=_0x448d44[_0x127f('0xd')][0x0][_0x127f('0x1b')];_0x5dfe4b(_0x3b17f0);}else{return createRemoteTag(_0x9dcb7c,_0x546431,_0x9579a,_0x34a7f4)['then'](function(_0x331fd1){_0x5dfe4b(_0x331fd1);});}});});}function assignTagToIncident(_0x6b3ccd,_0x34c31c,_0x42983e,_0x4aa5d7,_0x1ac1ce){return new Promise(function(_0x327bc0,_0x273c58){var _0x27e518={'method':'POST','uri':_0x42983e+'label_entry'+'?'+_0x1ac1ce,'body':{'label':_0x6b3ccd,'table':_0x127f('0x39'),'id_type':'Incident','table_key':_0x4aa5d7[_0x127f('0x44')],'title':_0x127f('0x45')+_0x4aa5d7[_0x127f('0x40')],'id_display':_0x4aa5d7[_0x127f('0x40')]},'auth':_0x34c31c,'json':!![]};return rp(_0x27e518)[_0x127f('0xc')](function(_0x146885){_0x327bc0();})['catch'](function(){_0x327bc0();});});}function manageTags(_0x2efb7a,_0x1befc1,_0x45e661,_0x42074c,_0x461413,_0x22bca2,_0x312767){return new Promise(function(_0x190e3a,_0x2cb717){var _0x504c2a=[];_0x1befc1[_0x127f('0x46')](function(_0x1e6cd3){_0x504c2a[_0x127f('0x47')](getRemoteTag(_0x1e6cd3,_0x45e661,_0x42074c,_0x22bca2,_0x312767));});return Promise[_0x127f('0x48')](_0x504c2a)[_0x127f('0xc')](function(_0x1a6642){if(_0x1a6642[_0x127f('0xe')]){logger[_0x127f('0x16')]('['+[_0x2efb7a['toUpperCase']()]+_0x127f('0x49'),_0x1a6642);var _0x336e92=[];_0x1a6642[_0x127f('0x46')](function(_0x5ee955){_0x336e92[_0x127f('0x47')](assignTagToIncident(_0x5ee955,_0x45e661,_0x42074c,_0x461413,_0x22bca2));});return Promise[_0x127f('0x48')](_0x336e92)['then'](function(){_0x190e3a();})[_0x127f('0x11')](function(){_0x190e3a();});}else{_0x190e3a();}});});}function getTags(_0x38fee1,_0x5b2f6b,_0x4eb92a,_0x457d4a,_0x12af40,_0x2510d5){return function(_0x2d8c21){return new Promise(function(_0x210c8f,_0x285539){var _0x2798fa=[];var _0x49db5a=_0x457d4a['Tags'];if(_0x49db5a&&_0x49db5a[_0x127f('0xe')]>0x0){_0x2798fa=_[_0x127f('0x4a')](_0x49db5a,_0x127f('0x35'));}if(_0x2798fa['length']>0x0){return manageTags(_0x38fee1,_0x2798fa,_0x5b2f6b,_0x4eb92a,_0x2d8c21,_0x12af40,_0x2510d5)[_0x127f('0xc')](function(){_0x210c8f(_0x2d8c21);});}else{_0x210c8f(_0x2d8c21);}});};}function emit(_0xfd381d,_0x3d07e0,_0x4f094a){var _0x26c851='%26sysparm_record_target%3Dincident'+_0x127f('0x4b')+_0x127f('0x4c')+_0x127f('0x4d');var _0x11ec82={'uri':_0xfd381d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4f094a+_0x26c851};io['to'](util['format'](_0x127f('0x4e'),_0x3d07e0))[_0x127f('0x4f')](_0x127f('0x50'),_0x11ec82);}exports['cs']=function(_0x19e9ed,_0x57561c,_0x5ab3c1,_0x52e456,_0x75a313,_0x531d17,_0x1bc6eb,_0x5e84bf){var _0x640be0={};var _0x25f5ee={'user':_0x531d17['username'],'pass':_0x531d17['password']};var _0x278123='sysparm_limit=1';var _0x2aa356=_0x127f('0x51');_0x531d17[_0x127f('0x52')]=intUtil['stripTrailingSlash'](_0x531d17['remoteUri']);_0x531d17[_0x127f('0x53')]=intUtil['stripTrailingSlash'](_0x531d17['serverUrl']);var _0x50db00=util[_0x127f('0x54')](_0x127f('0x55'),_0x531d17[_0x127f('0x52')]);_0x640be0[_0x127f('0x14')]=!_[_0x127f('0x56')](_0x52e456)?_0x52e456['email']:null;_0x640be0[_0x127f('0x1d')]=_0x531d17[_0x127f('0x57')];_0x640be0[_0x127f('0x22')]=_0x5e84bf[_0x127f('0x2d')]()===_0x127f('0x38')?_0x57561c[_0x127f('0x58')]:_0x57561c[_0x127f('0x59')];_0x640be0['callDirection']=_0x5e84bf===_0x127f('0x5a')||_0x5e84bf===_0x127f('0x5b')?_0x127f('0x5a'):_0x127f('0x38');var _0x51d470=util[_0x127f('0x54')](_0x127f('0x5c'),_0x531d17['serverUrl'],_0x57561c['uniqueid'],md5(_0x57561c['uniqueid']));if(_0x75a313&&_0x75a313[_0x127f('0x5d')]){logger[_0x127f('0x16')](_0x127f('0x5e'),_0x127f('0x5f'));_0x57561c[_0x127f('0x60')]=_0x51d470;}else if(_0x1bc6eb&&_0x1bc6eb['recordingFormat']&&_0x1bc6eb[_0x127f('0x61')]!==_0x127f('0x62')){logger[_0x127f('0x16')](_0x127f('0x63'),_0x127f('0x5f'));_0x57561c[_0x127f('0x60')]=_0x51d470;}else{_0x57561c[_0x127f('0x60')]='';}return getAdminUser(_0x5e84bf,_0x25f5ee,_0x640be0,_0x50db00,_0x2aa356,_0x278123)[_0x127f('0xc')](getUser(_0x5e84bf,_0x25f5ee,_0x50db00,_0x2aa356,_0x278123))[_0x127f('0xc')](getEndUser(_0x5e84bf,_0x25f5ee,_0x50db00,_0x2aa356,_0x278123))[_0x127f('0xc')](getTicket(_0x5e84bf,_0x25f5ee,_0x50db00,_0x5ab3c1,_0x57561c,_0x2aa356))['then'](function(_0x4f46d6){logger[_0x127f('0x16')](util[_0x127f('0x54')](_0x127f('0x64'),_0x4f46d6[_0x127f('0x44')]));logger['info'](util[_0x127f('0x54')](_0x127f('0x65'),_0x5e84bf));if(_0x5e84bf!=='unmanaged'){logger[_0x127f('0x16')]('['+[_0x5e84bf['toUpperCase']()]+']',_0x127f('0x66'));emit(_0x531d17[_0x127f('0x52')],_0x52e456['name'],_0x4f46d6[_0x127f('0x44')]);}})[_0x127f('0x11')](function(_0x2fdb68){logger[_0x127f('0x1e')]('['+[_0x5e84bf[_0x127f('0xf')]()]+_0x127f('0x67'),util[_0x127f('0x68')](_0x2fdb68,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbc26=['none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','servicenow','redis','defaults','localhost','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbc26,0x140));var _0x6bc2=function(_0x19e071,_0x1ff9b2){_0x19e071=_0x19e071-0x0;var _0x100677=_0xbc26[_0x19e071];return _0x100677;};'use strict';var _=require('lodash');var Promise=require(_0x6bc2('0x0'));var rp=require(_0x6bc2('0x1'));var util=require(_0x6bc2('0x2'));var md5=require(_0x6bc2('0x3'));var Redis=require(_0x6bc2('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6bc2('0x5'))(_0x6bc2('0x6'));config[_0x6bc2('0x7')]=_[_0x6bc2('0x8')](config['redis'],{'host':_0x6bc2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bc2('0x7')]));function getAdminUser(_0x18e016,_0x57626c,_0x1097aa,_0x42a6a6,_0xf75724,_0x4d86ed){return new Promise(function(_0x39b485,_0x54bdcb){var _0x4260d1={'method':'GET','uri':_0x42a6a6+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xf75724+'&'+_0x4d86ed,'auth':_0x57626c,'json':!![]};return rp(_0x4260d1)[_0x6bc2('0xa')](function(_0x3b22b7){if(_0x3b22b7[_0x6bc2('0xb')][_0x6bc2('0xc')]>0x0){_0x1097aa[_0x6bc2('0xd')]=_0x3b22b7['result'][0x0][_0x6bc2('0xe')];}logger[_0x6bc2('0xf')]('['+[_0x18e016[_0x6bc2('0x10')]()]+_0x6bc2('0x11'),_0x1097aa);_0x39b485(_0x1097aa);})[_0x6bc2('0x12')](function(_0x517d42){logger[_0x6bc2('0x13')]('['+[_0x18e016[_0x6bc2('0x10')]()]+']',_0x517d42[_0x6bc2('0x14')]);_0x54bdcb(_0x517d42['message']);});});}function getUser(_0x589046,_0x30dfa3,_0x97a18d,_0x1ce6fe,_0x4d8bff){return function(_0x4e1968){logger['info']('['+[_0x589046[_0x6bc2('0x10')]()]+_0x6bc2('0x15'),_0x4e1968);return new Promise(function(_0x311d7b,_0x3e12db){if(intUtil['validateEmail'](_0x4e1968[_0x6bc2('0x16')])){var _0x40e32e={'method':_0x6bc2('0x17'),'uri':_0x97a18d+'sys_user?sysparm_query=email%3D'+_0x4e1968[_0x6bc2('0x16')]+'&'+_0x1ce6fe+'&'+_0x4d8bff,'auth':_0x30dfa3,'json':!![]};logger[_0x6bc2('0xf')]('['+[_0x589046[_0x6bc2('0x10')]()]+_0x6bc2('0x18'),_0x40e32e);return rp(_0x40e32e)['then'](function(_0xc94a14){logger['info']('['+[_0x589046[_0x6bc2('0x10')]()]+_0x6bc2('0x19'),_0xc94a14);if(_0xc94a14['result']['length']>0x0&&String(_0xc94a14['result'][0x0][_0x6bc2('0x1a')])===_0x6bc2('0x1b')){_0x4e1968[_0x6bc2('0x1c')]=_0xc94a14[_0x6bc2('0xb')][0x0]['sys_id'];}else{_0x4e1968[_0x6bc2('0x1c')]=_0x4e1968[_0x6bc2('0xd')];_0x4e1968[_0x6bc2('0x16')]=_0x4e1968[_0x6bc2('0x1d')];}logger[_0x6bc2('0xf')]('['+[_0x589046['toUpperCase']()]+_0x6bc2('0x1e'),_0x4e1968);_0x311d7b(_0x4e1968);})[_0x6bc2('0x12')](function(_0x1e9656){logger['error']('['+[_0x589046[_0x6bc2('0x10')]()]+']',_0x1e9656[_0x6bc2('0x14')]);_0x3e12db(_0x1e9656['message']);});}else{logger[_0x6bc2('0xf')]('['+[_0x589046[_0x6bc2('0x10')]()]+_0x6bc2('0x1f'));_0x4e1968['userId']=_0x4e1968[_0x6bc2('0xd')];_0x4e1968['userEmail']=_0x4e1968[_0x6bc2('0x1d')];_0x311d7b(_0x4e1968);}});};}function createEndUser(_0x395235,_0x28d50f,_0x338d40,_0xa6a72c,_0x3879ad){logger[_0x6bc2('0xf')]('['+[_0x395235['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x338d40);return new Promise(function(_0x29bc8c,_0x1c0721){var _0x1eec50={'method':_0x6bc2('0x20'),'uri':_0xa6a72c+'sys_user?'+_0x3879ad,'body':{'user_name':_0x338d40[_0x6bc2('0x21')],'roles':_0x6bc2('0x22'),'first_name':_0x338d40[_0x6bc2('0x21')],'active':_0x6bc2('0x1b'),'date_format':_0x6bc2('0x23'),'phone':_0x338d40[_0x6bc2('0x21')]},'auth':_0x28d50f,'json':!![]};return rp(_0x1eec50)[_0x6bc2('0xa')](function(_0x133271){logger['info']('['+[_0x395235[_0x6bc2('0x10')]()]+'],\x20EndUser\x20schema',_0x133271[_0x6bc2('0xb')]);_0x338d40[_0x6bc2('0x24')]=_0x133271[_0x6bc2('0xb')][_0x6bc2('0xe')];_0x29bc8c(_0x338d40);})[_0x6bc2('0x12')](function(_0x4d5300){logger['error']('['+[_0x395235[_0x6bc2('0x10')]()]+']',_0x4d5300['message']);_0x1c0721(_0x4d5300[_0x6bc2('0x14')]);});});}function getEndUser(_0x530cbb,_0x5cf450,_0x19a6fc,_0x2914a9,_0x112023){return function(_0x4648cc){logger[_0x6bc2('0xf')]('['+[_0x530cbb['toUpperCase']()]+_0x6bc2('0x25'),_0x4648cc);return new Promise(function(_0x38fb4e,_0x545285){var _0x559a30={'method':'GET','uri':_0x19a6fc+'sys_user?sysparm_query=phone%3D'+_0x4648cc[_0x6bc2('0x21')]+'&'+_0x2914a9+'&'+_0x112023,'auth':_0x5cf450,'json':!![]};return rp(_0x559a30)[_0x6bc2('0xa')](function(_0x29d9ec){if(_0x29d9ec[_0x6bc2('0xb')]['length']>0x0){_0x4648cc['endUserId']=_0x29d9ec[_0x6bc2('0xb')][0x0][_0x6bc2('0xe')];logger[_0x6bc2('0xf')]('['+[_0x530cbb['toUpperCase']()]+_0x6bc2('0x26'),_0x4648cc);_0x38fb4e(_0x4648cc);}else{return createEndUser(_0x530cbb,_0x5cf450,_0x4648cc,_0x19a6fc,_0x2914a9)['then'](function(_0x3da916){logger['info']('['+[_0x530cbb[_0x6bc2('0x10')]()]+'],\x20createEndUser\x20crm',_0x3da916);_0x38fb4e(_0x3da916);});}})['catch'](function(_0x64a45e){logger[_0x6bc2('0x13')]('['+[_0x530cbb[_0x6bc2('0x10')]()]+']',_0x64a45e['message']);_0x545285(_0x64a45e['message']);});});};}function getCustomFields(_0x659574,_0x154a68){var _0x44cdb3={};if(_0x659574[_0x6bc2('0xc')]>0x0){_[_0x6bc2('0x27')](_0x659574,function(_0x152099){if(_[_0x6bc2('0x28')]([_0x6bc2('0x29'),_0x6bc2('0x2a')],_0x152099[_0x6bc2('0x2b')])&&_0x152099['nameField']&&!_0x152099['customField']){_0x44cdb3[_0x152099[_0x6bc2('0x2c')][_0x6bc2('0x2d')]()]=_0x152099[_0x6bc2('0x2e')]['toString']();}else if(_['includes']([_0x6bc2('0x29'),_0x6bc2('0x2a')],_0x152099['type'])&&_0x152099['idField']&&_0x152099[_0x6bc2('0x2f')]){_0x44cdb3[_0x152099[_0x6bc2('0x30')][_0x6bc2('0x2d')]()]=_0x152099[_0x6bc2('0x2e')][_0x6bc2('0x31')]();}else if(_0x152099[_0x6bc2('0x2b')]==='variable'&&_0x152099[_0x6bc2('0x32')]&&_0x152099['idField']&&_0x152099[_0x6bc2('0x2f')]){_0x44cdb3[_0x152099[_0x6bc2('0x30')][_0x6bc2('0x2d')]()]=_0x154a68[_0x152099['variableName']][_0x6bc2('0x31')]();}else if(_0x152099[_0x6bc2('0x2b')]===_0x6bc2('0x33')&&_0x152099[_0x6bc2('0x34')]&&_0x152099[_0x6bc2('0x34')][_0x6bc2('0x35')]&&_0x152099[_0x6bc2('0x30')]&&_0x152099[_0x6bc2('0x2f')]){_0x44cdb3[_0x152099[_0x6bc2('0x30')][_0x6bc2('0x2d')]()]=_0x154a68[_0x152099['Variable']['name'][_0x6bc2('0x2d')]()][_0x6bc2('0x31')]();}});}return _0x44cdb3;}function getTicket(_0x3aee70,_0x363541,_0x2dc06a,_0x290c4b,_0x2ea43f,_0x56aeb1){return function(_0x26e32e){logger[_0x6bc2('0xf')]('['+[_0x3aee70['toUpperCase']()]+_0x6bc2('0x36'),_0x26e32e);return new Promise(function(_0x3cdbee,_0x5252a6){var _0x301b5b=_0x3aee70[_0x6bc2('0x2d')]()===_0x6bc2('0x37')?_0x26e32e[_0x6bc2('0x1c')]:_0x26e32e[_0x6bc2('0x24')];var _0x57ec74={'method':_0x6bc2('0x20'),'uri':_0x2dc06a+_0x6bc2('0x38')+'?'+_0x56aeb1,'body':Object['assign']({},{'active':_0x6bc2('0x1b'),'caller_id':_0x301b5b,'assigned_to':_0x26e32e[_0x6bc2('0x1c')],'short_description':intUtil[_0x6bc2('0x39')](_0x290c4b[_0x6bc2('0x3a')],_0x2ea43f,'\x20'),'description':intUtil['getString'](_0x290c4b[_0x6bc2('0x3b')],_0x2ea43f,'\x0a')},getCustomFields(_0x290c4b[_0x6bc2('0x3c')],_0x2ea43f)),'auth':_0x363541,'json':!![]};return rp(_0x57ec74)[_0x6bc2('0xa')](function(_0x29b147){logger[_0x6bc2('0xf')]('['+[_0x3aee70[_0x6bc2('0x10')]()]+_0x6bc2('0x3d'),_0x29b147[_0x6bc2('0xb')]);_0x26e32e[_0x6bc2('0x3e')]=_0x29b147[_0x6bc2('0xb')][_0x6bc2('0xe')];_0x26e32e[_0x6bc2('0x3f')]=_0x29b147[_0x6bc2('0xb')][_0x6bc2('0x40')];logger[_0x6bc2('0xf')]('['+[_0x3aee70[_0x6bc2('0x10')]()]+_0x6bc2('0x41'),_0x26e32e);_0x3cdbee(_0x26e32e);})[_0x6bc2('0x12')](function(_0x52c793){logger[_0x6bc2('0x13')]('['+[_0x3aee70[_0x6bc2('0x10')]()]+']',_0x52c793[_0x6bc2('0x14')]);_0x5252a6(_0x52c793[_0x6bc2('0x14')]);});});};}function createRemoteTag(_0x57f199,_0x2e85e2,_0x2ea42d,_0x135755){return new Promise(function(_0x2945e6,_0x1a8bca){var _0x25bb00={'method':'POST','uri':_0x2ea42d+'label'+'?'+_0x135755,'body':{'short_description':_0x57f199,'global':!![],'active':!![],'name':_0x57f199},'auth':_0x2e85e2,'json':!![]};return rp(_0x25bb00)[_0x6bc2('0xa')](function(_0x22cf58){var _0xb83841=_0x22cf58[_0x6bc2('0xb')][_0x6bc2('0xe')];_0x2945e6(_0xb83841);});});}function getRemoteTag(_0x3669ac,_0x1ca9cc,_0x3ac1ce,_0x39d86d,_0x13a3d4){return new Promise(function(_0x550f07,_0x375fa3){var _0x4aac57={'method':'GET','uri':_0x3ac1ce+_0x6bc2('0x42')+_0x6bc2('0x43')+_0x3669ac+'&'+_0x39d86d,'auth':_0x1ca9cc,'json':!![]};return rp(_0x4aac57)['then'](function(_0x1a1f51){if(_0x1a1f51['result']['length']>0x0){var _0x16c116=_0x1a1f51[_0x6bc2('0xb')][0x0][_0x6bc2('0xe')];_0x550f07(_0x16c116);}else{return createRemoteTag(_0x3669ac,_0x1ca9cc,_0x3ac1ce,_0x39d86d)[_0x6bc2('0xa')](function(_0x1cc830){_0x550f07(_0x1cc830);});}});});}function assignTagToIncident(_0x1897d3,_0x1d381d,_0x44c246,_0x1b5905,_0x1eb57){return new Promise(function(_0x22d36b,_0x5b3d6c){var _0x277840={'method':_0x6bc2('0x20'),'uri':_0x44c246+_0x6bc2('0x44')+'?'+_0x1eb57,'body':{'label':_0x1897d3,'table':_0x6bc2('0x38'),'id_type':_0x6bc2('0x45'),'table_key':_0x1b5905[_0x6bc2('0x3e')],'title':_0x6bc2('0x46')+_0x1b5905['ticketNumber'],'id_display':_0x1b5905[_0x6bc2('0x3f')]},'auth':_0x1d381d,'json':!![]};return rp(_0x277840)[_0x6bc2('0xa')](function(_0x36527f){_0x22d36b();})['catch'](function(){_0x22d36b();});});}function manageTags(_0x1ec905,_0x17978e,_0x1a142a,_0x373fe5,_0x509251,_0x476913,_0x4d1195){return new Promise(function(_0x5ea240,_0x23cb0a){var _0x571faa=[];_0x17978e[_0x6bc2('0x27')](function(_0x41b3a4){_0x571faa[_0x6bc2('0x47')](getRemoteTag(_0x41b3a4,_0x1a142a,_0x373fe5,_0x476913,_0x4d1195));});return Promise[_0x6bc2('0x48')](_0x571faa)['then'](function(_0x39fec4){if(_0x39fec4[_0x6bc2('0xc')]){logger['info']('['+[_0x1ec905['toUpperCase']()]+_0x6bc2('0x49'),_0x39fec4);var _0x5c5a32=[];_0x39fec4[_0x6bc2('0x27')](function(_0x4e4edc){_0x5c5a32[_0x6bc2('0x47')](assignTagToIncident(_0x4e4edc,_0x1a142a,_0x373fe5,_0x509251,_0x476913));});return Promise['all'](_0x5c5a32)[_0x6bc2('0xa')](function(){_0x5ea240();})[_0x6bc2('0x12')](function(){_0x5ea240();});}else{_0x5ea240();}});});}function getTags(_0x1eb685,_0x5cf0f3,_0x213fc0,_0x2c9f43,_0xa3f08a,_0x3441c3){return function(_0x430da6){return new Promise(function(_0x478528,_0x499a4c){var _0xb8761c=[];var _0x384a57=_0x2c9f43[_0x6bc2('0x4a')];if(_0x384a57&&_0x384a57[_0x6bc2('0xc')]>0x0){_0xb8761c=_['map'](_0x384a57,_0x6bc2('0x35'));}if(_0xb8761c[_0x6bc2('0xc')]>0x0){return manageTags(_0x1eb685,_0xb8761c,_0x5cf0f3,_0x213fc0,_0x430da6,_0xa3f08a,_0x3441c3)['then'](function(){_0x478528(_0x430da6);});}else{_0x478528(_0x430da6);}});};}function emit(_0x2e0f81,_0x3dc50c,_0x380e45){var _0x188cf5=_0x6bc2('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x6bc2('0x4c')+_0x6bc2('0x4d');var _0x2cbcbe={'uri':_0x2e0f81+_0x6bc2('0x4e')+_0x380e45+_0x188cf5};io['to'](util[_0x6bc2('0x4f')](_0x6bc2('0x50'),_0x3dc50c))['emit']('trigger:browser:url',_0x2cbcbe);}exports['cs']=function(_0x4dbdf5,_0x12ff52,_0x242338,_0x1bb0f6,_0x1eebfb,_0x3c1946,_0x24f88f,_0x4e763c){var _0x3e555e={};var _0x1fb1d3={'user':_0x3c1946[_0x6bc2('0x51')],'pass':_0x3c1946[_0x6bc2('0x52')]};var _0x938541='sysparm_limit=1';var _0x33b3cd=_0x6bc2('0x53');_0x3c1946['remoteUri']=intUtil[_0x6bc2('0x54')](_0x3c1946[_0x6bc2('0x55')]);_0x3c1946[_0x6bc2('0x56')]=intUtil[_0x6bc2('0x54')](_0x3c1946[_0x6bc2('0x56')]);var _0xae6cda=util['format'](_0x6bc2('0x57'),_0x3c1946[_0x6bc2('0x55')]);_0x3e555e['userEmail']=!_['isNil'](_0x1bb0f6)?_0x1bb0f6['email']:null;_0x3e555e[_0x6bc2('0x1d')]=_0x3c1946[_0x6bc2('0x58')];_0x3e555e[_0x6bc2('0x21')]=_0x4e763c[_0x6bc2('0x2d')]()==='outbound'?_0x12ff52[_0x6bc2('0x59')]:_0x12ff52[_0x6bc2('0x5a')];_0x3e555e[_0x6bc2('0x5b')]=_0x4e763c==='queue'||_0x4e763c===_0x6bc2('0x5c')?_0x6bc2('0x5d'):_0x6bc2('0x37');var _0x433ba1=util[_0x6bc2('0x4f')](_0x6bc2('0x5e'),_0x3c1946[_0x6bc2('0x56')],_0x12ff52[_0x6bc2('0x5f')],md5(_0x12ff52[_0x6bc2('0x5f')]));if(_0x1eebfb&&_0x1eebfb['monitor_format']){logger['info'](_0x6bc2('0x60'),_0x6bc2('0x61'));_0x12ff52[_0x6bc2('0x62')]=_0x433ba1;}else if(_0x24f88f&&_0x24f88f[_0x6bc2('0x63')]&&_0x24f88f['recordingFormat']!==_0x6bc2('0x64')){logger[_0x6bc2('0xf')](_0x6bc2('0x65'),_0x6bc2('0x61'));_0x12ff52[_0x6bc2('0x62')]=_0x433ba1;}else{_0x12ff52[_0x6bc2('0x62')]='';}return getAdminUser(_0x4e763c,_0x1fb1d3,_0x3e555e,_0xae6cda,_0x33b3cd,_0x938541)['then'](getUser(_0x4e763c,_0x1fb1d3,_0xae6cda,_0x33b3cd,_0x938541))[_0x6bc2('0xa')](getEndUser(_0x4e763c,_0x1fb1d3,_0xae6cda,_0x33b3cd,_0x938541))[_0x6bc2('0xa')](getTicket(_0x4e763c,_0x1fb1d3,_0xae6cda,_0x242338,_0x12ff52,_0x33b3cd))[_0x6bc2('0xa')](function(_0x4fd2ca){logger[_0x6bc2('0xf')](util[_0x6bc2('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4fd2ca[_0x6bc2('0x3e')]));logger[_0x6bc2('0xf')](util['format'](_0x6bc2('0x66'),_0x4e763c));if(_0x4e763c!==_0x6bc2('0x5c')){logger[_0x6bc2('0xf')]('['+[_0x4e763c[_0x6bc2('0x10')]()]+']',_0x6bc2('0x67'));emit(_0x3c1946['remoteUri'],_0x1bb0f6[_0x6bc2('0x35')],_0x4fd2ca['ticketId']);}})[_0x6bc2('0x12')](function(_0x26c65d){logger[_0x6bc2('0x13')]('['+[_0x4e763c[_0x6bc2('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x6bc2('0x68')](_0x26c65d,{'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 545d759..d15b8bb 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 _0xa01a=['Fields','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','uri','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','[OUTBOUND]','lastevent','Inbound','toUpperCase','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','merge','map','forEach','type','nameField','customField','content','custom_fields','variable','push','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3acb89,_0x37c3cd){var _0x3b0e9d=function(_0x1d8396){while(--_0x1d8396){_0x3acb89['push'](_0x3acb89['shift']());}};_0x3b0e9d(++_0x37c3cd);}(_0xa01a,0x111));var _0xaa01=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa01a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaa01('0x0'));var rp=require('request-promise');var BPromise=require(_0xaa01('0x1'));var md5=require(_0xaa01('0x2'));var util=require(_0xaa01('0x3'));var Redis=require(_0xaa01('0x4'));var intUtil=require(_0xaa01('0x5'));var config=require(_0xaa01('0x6'));var logger=require(_0xaa01('0x7'))(_0xaa01('0x8'));config[_0xaa01('0x9')]=_['defaults'](config[_0xaa01('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaa01('0xa'))(new Redis(config[_0xaa01('0x9')]));var def={'method':_0xaa01('0xb'),'json':!![]};function emit(_0x359d84,_0x3ffc6a,_0x2cae17){io['to'](_0x359d84)[_0xaa01('0xc')](_0x3ffc6a,_0x2cae17);}function getTicket(_0xcbd7f9,_0x454b53,_0x2da00e,_0x1ecf17,_0x346da1,_0x570bf3,_0x5cd4dd,_0x554493){logger[_0xaa01('0xd')](_0xaa01('0xe'));var _0x7da603=new Date();var _0x33d7ea=[{'name':_0xaa01('0xf'),'value':intUtil[_0xaa01('0x10')](_0x1ecf17[_0xaa01('0x11')],_0x346da1,'\x20')},{'name':_0xaa01('0x12'),'value':_0x454b53['id']},{'name':_0xaa01('0x13'),'value':_0x454b53['id']},{'name':_0xaa01('0x14'),'value':intUtil[_0xaa01('0x10')](_0x1ecf17[_0xaa01('0x15')],_0x346da1,'\x0a')},{'name':_0xaa01('0x16'),'value':_0x7da603[_0xaa01('0x17')]()['slice'](0x0,0x13)[_0xaa01('0x18')]('T','\x20')},{'name':_0xaa01('0x19'),'value':'0'},{'name':_0xaa01('0x1a'),'value':'15'},{'name':_0xaa01('0x1b'),'value':_0x2da00e['id']},{'name':_0xaa01('0x1c'),'value':'Contacts'},{'name':_0xaa01('0x1d'),'value':_0x2da00e[_0xaa01('0xf')]},{'name':'direction','value':_0x554493}];if(_0x570bf3['length']){_['forEach'](_0x570bf3,function(_0x1fa506){if(_0x346da1[_0x1fa506[_0xaa01('0x1e')]]){_0x33d7ea['push']({'name':_0x1fa506[_0xaa01('0x1f')],'value':_0x346da1[_0x1fa506[_0xaa01('0x1e')]]});}});}return request({'form':{'method':_0xaa01('0x20'),'input_type':_0xaa01('0x21'),'response_type':'JSON','rest_data':JSON[_0xaa01('0x22')]({'session':_0x5cd4dd['id'],'module_name':'Calls','name_value_list':_0x33d7ea})}});}function getAuth(_0x4b230d){return util[_0xaa01('0x23')](_0xaa01('0x24'),new Buffer(_0x4b230d[_0xaa01('0x25')]+':X')[_0xaa01('0x26')](_0xaa01('0x27')));}function getServerInfo(_0x3fa521){return request({'form':{'method':_0xaa01('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xaa01('0x22')]({'session':_0x3fa521['id']})}});}function getUser(_0x2292b5,_0x47c022,_0x59d773){if(!_[_0xaa01('0x29')](_0x47c022)){logger[_0xaa01('0xd')]('Getting\x20agent\x20with\x20name',_0x47c022);return request({'form':{'method':'get_entry_list','input_type':_0xaa01('0x21'),'response_type':_0xaa01('0x21'),'rest_data':JSON['stringify']({'session':_0x59d773['id'],'module_name':'Employees','query':util['format'](_0xaa01('0x2a'),_0x47c022),'order_by':'','offset':'0','select_fields':['id',_0xaa01('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa01('0x2b')](function(_0x4607c5){if(_0x4607c5[_0xaa01('0x2c')][_0xaa01('0x2d')]){var _0x38a0d7=_[_0xaa01('0x2e')](_0x4607c5[_0xaa01('0x2c')],function(_0x25c254){return _0x25c254['name_value_list'][_0xaa01('0x2f')][_0xaa01('0x30')]===_0x47c022;});if(_0x38a0d7){logger[_0xaa01('0xd')](_0xaa01('0x31'));return BPromise[_0xaa01('0x32')]({'id':_0x38a0d7[_0xaa01('0x33')]['id']['value'],'name':_0x38a0d7[_0xaa01('0x33')][_0xaa01('0xf')][_0xaa01('0x30')]});}}logger[_0xaa01('0xd')](_0xaa01('0x34'));return BPromise[_0xaa01('0x32')]({'id':_0x59d773[_0xaa01('0x33')][_0xaa01('0x35')][_0xaa01('0x30')],'name':_0x59d773[_0xaa01('0x33')][_0xaa01('0x2f')][_0xaa01('0x30')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xaa01('0x32')]({'id':_0x59d773[_0xaa01('0x33')]['user_id'][_0xaa01('0x30')],'name':_0x59d773[_0xaa01('0x33')][_0xaa01('0x2f')]['value']});}}function getEndUser(_0x24a547,_0x29ea97,_0x1db802,_0x29d27a){logger[_0xaa01('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1db802);return request({'form':{'method':_0xaa01('0x36'),'input_type':_0xaa01('0x21'),'response_type':_0xaa01('0x21'),'rest_data':JSON['stringify']({'session':_0x29d27a['id'],'module_name':_0xaa01('0x37'),'query':util[_0xaa01('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x1db802),'order_by':'','offset':'0','select_fields':['id',_0xaa01('0xf'),_0xaa01('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2a2fa6){if(_0x2a2fa6[_0xaa01('0x2c')][_0xaa01('0x2d')]){var _0x166156=_['find'](_0x2a2fa6[_0xaa01('0x2c')],function(_0x3e1d3f){return _0x3e1d3f[_0xaa01('0x33')][_0xaa01('0x38')][_0xaa01('0x30')]===_0x1db802;});if(_0x166156){logger['info'](_0xaa01('0x39'));return BPromise[_0xaa01('0x32')]({'id':_0x166156[_0xaa01('0x33')]['id'][_0xaa01('0x30')],'name':_0x166156[_0xaa01('0x33')][_0xaa01('0xf')][_0xaa01('0x30')],'phone':_0x166156[_0xaa01('0x33')][_0xaa01('0x38')][_0xaa01('0x30')]});}}else{logger[_0xaa01('0xd')](_0xaa01('0x3a'));return request({'form':{'method':_0xaa01('0x20'),'input_type':_0xaa01('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x29d27a['id'],'module_name':_0xaa01('0x37'),'name_value_list':[{'name':_0xaa01('0x3b'),'value':_0x29ea97!==_0xaa01('0x3c')?_0x29ea97:util['format'](_0xaa01('0x3d'),_0x1db802)},{'name':_0xaa01('0x38'),'value':_0x1db802}]})}})[_0xaa01('0x2b')](function(_0x487bd1){logger[_0xaa01('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x487bd1['id'],'name':_0x487bd1[_0xaa01('0x2c')][_0xaa01('0x3b')][_0xaa01('0x30')],'phone':_0x487bd1['entry_list']['phone_home']['value']});});}});}function request(_0x4d1076){logger[_0xaa01('0x3e')]('[HTTP]',JSON[_0xaa01('0x22')](_0x4d1076));return rp(_[_0xaa01('0x3f')](def,_0x4d1076));}function getTags(_0xe19139,_0x46c096){var _0x4283b0=[];if(_0xe19139&&_0xe19139[_0xaa01('0x2d')]>0x0){_0x4283b0=_[_0xaa01('0x40')](_0xe19139,_0x46c096);}return _0x4283b0;}function getCustomFields(_0x3c2d31,_0x5dc42b){var _0x36645d=[];var _0x183df4={'custom_fields':[]};if(_0x3c2d31[_0xaa01('0x2d')]>0x0){_[_0xaa01('0x41')](_0x3c2d31,function(_0x59b417){if(_0x59b417[_0xaa01('0x42')]==='string'&&_0x59b417[_0xaa01('0x43')]&&!_0x59b417[_0xaa01('0x44')]){_0x183df4[_0x59b417['nameField']['toLowerCase']()]=_0x59b417[_0xaa01('0x45')][_0xaa01('0x26')]();}else if(_0x59b417[_0xaa01('0x42')]==='string'&&_0x59b417[_0xaa01('0x1f')]&&_0x59b417[_0xaa01('0x44')]){_0x183df4[_0xaa01('0x46')]['push']({'id':_0x59b417['idField'],'value':_0x59b417['content'][_0xaa01('0x26')]()});}else if(_0x59b417['type']===_0xaa01('0x47')&&_0x59b417[_0xaa01('0x1e')]&&_0x59b417[_0xaa01('0x1f')]&&_0x59b417[_0xaa01('0x44')]){_0x5dc42b[_0x59b417[_0xaa01('0x1e')]]&&_0x183df4['custom_fields'][_0xaa01('0x48')]({'id':_0x59b417[_0xaa01('0x1f')],'value':_0x5dc42b[_0x59b417['variableName']][_0xaa01('0x26')]()});}else if(_0x59b417[_0xaa01('0x42')]===_0xaa01('0x49')&&_0x59b417[_0xaa01('0x4a')]&&_0x59b417[_0xaa01('0x4a')][_0xaa01('0xf')]&&_0x59b417[_0xaa01('0x1f')]&&_0x59b417[_0xaa01('0x44')]){_0x5dc42b[_0x59b417[_0xaa01('0x4a')]['name'][_0xaa01('0x4b')]()]&&_0x183df4['custom_fields'][_0xaa01('0x48')]({'id':_0x59b417['idField'],'value':_0x5dc42b[_0x59b417[_0xaa01('0x4a')]['name'][_0xaa01('0x4b')]()][_0xaa01('0x26')]()});}});}return _0x183df4;}function getConnection(_0x2203aa){return request({'method':_0xaa01('0xb'),'form':{'method':_0xaa01('0x4c'),'input_type':_0xaa01('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2203aa[_0xaa01('0x4d')],'password':_0x2203aa[_0xaa01('0x4e')],'encryption':_0xaa01('0x4f')},'application':_0xaa01('0x50')})}})[_0xaa01('0x2b')](function(_0x1de8ed){var _0x357eb3=_0x1de8ed;if(_0x357eb3['id']){def[_0xaa01('0x51')]=_0x357eb3['id'];return BPromise['resolve'](_0x357eb3);}else{throw new Error(util[_0xaa01('0x23')](_0xaa01('0x52'),_0x2203aa['id']));}});}function setRelationship(_0x3a2b89,_0x5eac27,_0x240836,_0x2b9aef){return request({'form':{'method':_0xaa01('0x53'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xaa01('0x22')]({'session':_0x3a2b89['id'],'module_name':_0xaa01('0x54'),'module_id':_0x240836['id'],'link_field_name':_0x2b9aef,'related_ids':[_0x5eac27['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xaa01('0x55')]=function(_0x5a7b03,_0x1e4911,_0x184224,_0x3c52c9,_0x4b5499,_0x15b2a6){var _0xff222f,_0x5ac12f,_0xdc6883,_0x34756a;_0x15b2a6[_0xaa01('0x56')]=intUtil[_0xaa01('0x57')](_0x15b2a6[_0xaa01('0x56')]);_0x15b2a6[_0xaa01('0x58')]=intUtil[_0xaa01('0x57')](_0x15b2a6[_0xaa01('0x58')]);def['uri']=util[_0xaa01('0x23')](_0xaa01('0x59'),_0x15b2a6[_0xaa01('0x56')]);if(_0x4b5499&&_0x4b5499[_0xaa01('0x5a')]){logger[_0xaa01('0xd')](_0xaa01('0x5b'),_0xaa01('0x5c'));_0x1e4911[_0xaa01('0x5d')]=util[_0xaa01('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15b2a6[_0xaa01('0x58')],_0x1e4911['uniqueid'],md5(_0x1e4911[_0xaa01('0x5e')]));}else{_0x1e4911[_0xaa01('0x5d')]='';}return getConnection(_0x15b2a6)[_0xaa01('0x2b')](function(_0x36069c){_0x34756a=_0x36069c;return getUser(_0x15b2a6,_0x3c52c9[_0xaa01('0xf')],_0x34756a);})[_0xaa01('0x2b')](function(_0x12b4c5){_0xff222f=_0x12b4c5;logger[_0xaa01('0xd')](_0xaa01('0x5f'),_0xff222f['id']);return getEndUser(_0x15b2a6,_0x1e4911[_0xaa01('0x60')],_0x1e4911[_0xaa01('0x61')],_0x34756a);})[_0xaa01('0x2b')](function(_0x1cea00){_0x5ac12f=_0x1cea00;logger[_0xaa01('0xd')](_0xaa01('0x62'),_0x5ac12f['id']);return getTicket(_0x15b2a6,_0xff222f,_0x5ac12f,_0x184224,_0x1e4911,_0x184224[_0xaa01('0x63')],_0x34756a,'Inbound');})[_0xaa01('0x2b')](function(_0x5f5c00){_0xdc6883=_0x5f5c00;logger[_0xaa01('0xd')](_0xaa01('0x64'));logger[_0xaa01('0xd')](_0xaa01('0x65'),_0xdc6883['id']);return setRelationship(_0x34756a,_0xff222f,_0xdc6883,_0xaa01('0x66'));})[_0xaa01('0x2b')](function(){return setRelationship(_0x34756a,_0x5ac12f,_0xdc6883,_0xaa01('0x67'));})['then'](function(){return getServerInfo(_0x34756a);})[_0xaa01('0x2b')](function(_0x14d6e3){var _0x24ee0e=parseInt(_0x14d6e3[_0xaa01('0x68')][_0xaa01('0x69')](0x0));var _0x233277=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x15b2a6[_0xaa01('0x56')],_0xdc6883['id']);if(_0x24ee0e>0x6){_0x233277=util[_0xaa01('0x23')](_0xaa01('0x6a'),_0x15b2a6['remoteUri'],_0xdc6883['id']);}logger[_0xaa01('0xd')](_0xaa01('0x5b'),_0xaa01('0x6b'));emit(util[_0xaa01('0x23')]('user:%s',_0x3c52c9[_0xaa01('0xf')]),_0xaa01('0x6c'),{'uri':_0x233277});})[_0xaa01('0x6d')](function(_0x4891bb){logger[_0xaa01('0x6e')]('[QUEUE]',JSON['stringify'](_0x4891bb));});};exports[_0xaa01('0x6f')]=function(_0x16a8ae,_0x245bde,_0x384605,_0x4f7626,_0x331bbf,_0x48fa70,_0x5161e5){var _0x2c9462,_0x233dfc,_0x49c8a3,_0x1f3616;_0x48fa70['remoteUri']=intUtil[_0xaa01('0x57')](_0x48fa70[_0xaa01('0x56')]);_0x48fa70[_0xaa01('0x58')]=intUtil[_0xaa01('0x57')](_0x48fa70[_0xaa01('0x58')]);def[_0xaa01('0x70')]=util[_0xaa01('0x23')](_0xaa01('0x59'),_0x48fa70[_0xaa01('0x56')]);if(_0x5161e5&&_0x5161e5[_0xaa01('0x71')]&&_0x5161e5[_0xaa01('0x71')]!==_0xaa01('0x72')){logger['info']('[OUTBOUND]',_0xaa01('0x5c'));_0x245bde[_0xaa01('0x5d')]=util['format'](_0xaa01('0x73'),_0x48fa70[_0xaa01('0x58')],_0x245bde['uniqueid'],md5(_0x245bde[_0xaa01('0x5e')]));}return getConnection(_0x48fa70)[_0xaa01('0x2b')](function(_0xb809be){_0x1f3616=_0xb809be;return getUser(_0x48fa70,_0x4f7626[_0xaa01('0xf')],_0x1f3616);})['then'](function(_0x102aab){_0x2c9462=_0x102aab;logger[_0xaa01('0xd')](_0xaa01('0x5f'),_0x2c9462['id']);return getEndUser(_0x48fa70,_0x245bde[_0xaa01('0x74')],_0x245bde['destcalleridnum'],_0x1f3616);})[_0xaa01('0x2b')](function(_0x408be9){_0x233dfc=_0x408be9;logger[_0xaa01('0xd')](_0xaa01('0x62'),_0x233dfc['id']);return getTicket(_0x48fa70,_0x2c9462,_0x233dfc,_0x384605,_0x245bde,_0x384605['Fields'],_0x1f3616,_0xaa01('0x75'));})[_0xaa01('0x2b')](function(_0x525e65){_0x49c8a3=_0x525e65;logger[_0xaa01('0xd')](_0xaa01('0x64'));logger[_0xaa01('0xd')](_0xaa01('0x65'),_0x49c8a3['id']);return setRelationship(_0x1f3616,_0x2c9462,_0x49c8a3,_0xaa01('0x66'));})[_0xaa01('0x2b')](function(){return setRelationship(_0x1f3616,_0x233dfc,_0x49c8a3,_0xaa01('0x67'));})[_0xaa01('0x2b')](function(){return getServerInfo(_0x1f3616);})[_0xaa01('0x2b')](function(_0x2a37fc){var _0x16366c=parseInt(_0x2a37fc[_0xaa01('0x68')][_0xaa01('0x69')](0x0));var _0x592160=util[_0xaa01('0x23')](_0xaa01('0x76'),_0x48fa70[_0xaa01('0x56')],_0x49c8a3['id']);if(_0x16366c>0x6){_0x592160=util[_0xaa01('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x48fa70[_0xaa01('0x56')],_0x49c8a3['id']);}logger[_0xaa01('0xd')]('[OUTBOUND]',_0xaa01('0x6b'));emit(util[_0xaa01('0x23')](_0xaa01('0x77'),_0x4f7626['name']),_0xaa01('0x6c'),{'uri':_0x592160});})[_0xaa01('0x6d')](function(_0x35fbf0){logger['error'](_0xaa01('0x78'),JSON[_0xaa01('0x22')](_0x35fbf0));});};exports['unmanaged']=function(_0x5bcbe5,_0x544068,_0x705c18,_0x21c834,_0x2d7ffd,_0x273cfc){var _0x357831,_0x24872d,_0x3736d4,_0x889469;_0x273cfc[_0xaa01('0x56')]=intUtil[_0xaa01('0x57')](_0x273cfc[_0xaa01('0x56')]);_0x273cfc['serverUrl']=intUtil[_0xaa01('0x57')](_0x273cfc[_0xaa01('0x58')]);def['uri']=util[_0xaa01('0x23')](_0xaa01('0x59'),_0x273cfc[_0xaa01('0x56')]);if(_0x2d7ffd&&_0x2d7ffd[_0xaa01('0x5a')]){logger[_0xaa01('0xd')]('['+_0x544068[_0xaa01('0x79')]['toUpperCase']()+']',_0xaa01('0x5c'));_0x544068[_0xaa01('0x5d')]=util[_0xaa01('0x23')](_0xaa01('0x73'),_0x273cfc[_0xaa01('0x58')],_0x544068[_0xaa01('0x5e')],md5(_0x544068[_0xaa01('0x5e')]));}else{_0x544068[_0xaa01('0x5d')]='';}return getConnection(_0x273cfc)['then'](function(_0x3234fa){_0x889469=_0x3234fa;if(!_[_0xaa01('0x29')](_0x21c834)){return getUser(_0x273cfc,_0x21c834[_0xaa01('0xf')],_0x889469);}else{return getUser(_0x273cfc,null,_0x889469);}})['then'](function(_0x148043){_0x357831=_0x148043;logger['info'](_0xaa01('0x5f'),_0x357831['id']);return getEndUser(_0x273cfc,_0x544068[_0xaa01('0x60')],_0x544068[_0xaa01('0x61')],_0x889469);})[_0xaa01('0x2b')](function(_0x3578a8){_0x24872d=_0x3578a8;logger[_0xaa01('0xd')](_0xaa01('0x62'),_0x24872d['id']);return getTicket(_0x273cfc,_0x357831,_0x24872d,_0x705c18,_0x544068,_0x705c18['Fields'],_0x889469,_0xaa01('0x7a'));})[_0xaa01('0x2b')](function(_0x32b408){_0x3736d4=_0x32b408;logger['info']('Ticket\x20created!');logger['info'](_0xaa01('0x65'),_0x3736d4['id']);return setRelationship(_0x889469,_0x357831,_0x3736d4,_0xaa01('0x66'));})[_0xaa01('0x2b')](function(){return setRelationship(_0x889469,_0x24872d,_0x3736d4,_0xaa01('0x67'));})[_0xaa01('0x2b')](function(){return getServerInfo(_0x889469);})[_0xaa01('0x6d')](function(_0x4c127a){logger[_0xaa01('0x6e')]('['+_0x544068[_0xaa01('0x79')][_0xaa01('0x7b')]()+']',JSON[_0xaa01('0x22')](_0x4c127a));});}; \ No newline at end of file +var _0x5748=['variable','customVariable','Variable','POST','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','charAt','trigger:browser:url','lastevent','calleridnum','catch','toUpperCase','lodash','bluebird','md5','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','toLowerCase','content','string','idField','custom_fields'];(function(_0x1fcce2,_0x180d1b){var _0x51183c=function(_0x5044c4){while(--_0x5044c4){_0x1fcce2['push'](_0x1fcce2['shift']());}};_0x51183c(++_0x180d1b);}(_0x5748,0xa9));var _0x8574=function(_0x229c69,_0x5ea165){_0x229c69=_0x229c69-0x0;var _0x250d3b=_0x5748[_0x229c69];return _0x250d3b;};'use strict';var _=require(_0x8574('0x0'));var rp=require('request-promise');var BPromise=require(_0x8574('0x1'));var md5=require(_0x8574('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8574('0x3'));var logger=require('../../../../config/logger')(_0x8574('0x4'));config[_0x8574('0x5')]=_[_0x8574('0x6')](config[_0x8574('0x5')],{'host':_0x8574('0x7'),'port':0x18eb});var io=require(_0x8574('0x8'))(new Redis(config[_0x8574('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x469fe9,_0x34c1b4,_0x448844){io['to'](_0x469fe9)[_0x8574('0x9')](_0x34c1b4,_0x448844);}function getTicket(_0x3c83f2,_0x5abfaf,_0x4e7c97,_0x1522d4,_0x594037,_0x2c6f3c,_0x559e60,_0x3956b8){logger[_0x8574('0xa')](_0x8574('0xb'));var _0x152227=new Date();var _0x500e57=[{'name':_0x8574('0xc'),'value':intUtil['getString'](_0x1522d4[_0x8574('0xd')],_0x594037,'\x20')},{'name':_0x8574('0xe'),'value':_0x5abfaf['id']},{'name':'created_by','value':_0x5abfaf['id']},{'name':_0x8574('0xf'),'value':intUtil[_0x8574('0x10')](_0x1522d4[_0x8574('0x11')],_0x594037,'\x0a')},{'name':_0x8574('0x12'),'value':_0x152227['toISOString']()[_0x8574('0x13')](0x0,0x13)[_0x8574('0x14')]('T','\x20')},{'name':_0x8574('0x15'),'value':'0'},{'name':_0x8574('0x16'),'value':'15'},{'name':_0x8574('0x17'),'value':_0x4e7c97['id']},{'name':_0x8574('0x18'),'value':_0x8574('0x19')},{'name':'parent_name','value':_0x4e7c97[_0x8574('0xc')]},{'name':_0x8574('0x1a'),'value':_0x3956b8}];if(_0x2c6f3c[_0x8574('0x1b')]){_[_0x8574('0x1c')](_0x2c6f3c,function(_0x3dcb99){if(_0x594037[_0x3dcb99[_0x8574('0x1d')]]){_0x500e57[_0x8574('0x1e')]({'name':_0x3dcb99['idField'],'value':_0x594037[_0x3dcb99[_0x8574('0x1d')]]});}});}return request({'form':{'method':_0x8574('0x1f'),'input_type':_0x8574('0x20'),'response_type':_0x8574('0x20'),'rest_data':JSON['stringify']({'session':_0x559e60['id'],'module_name':_0x8574('0x21'),'name_value_list':_0x500e57})}});}function getAuth(_0x393753){return util[_0x8574('0x22')](_0x8574('0x23'),new Buffer(_0x393753[_0x8574('0x24')]+':X')[_0x8574('0x25')](_0x8574('0x26')));}function getServerInfo(_0x351452){return request({'form':{'method':_0x8574('0x27'),'input_type':_0x8574('0x20'),'response_type':_0x8574('0x20'),'rest_data':JSON[_0x8574('0x28')]({'session':_0x351452['id']})}});}function getUser(_0x54a2c5,_0x3ad674,_0x3da22b){if(!_['isNil'](_0x3ad674)){logger[_0x8574('0xa')](_0x8574('0x29'),_0x3ad674);return request({'form':{'method':_0x8574('0x2a'),'input_type':_0x8574('0x20'),'response_type':_0x8574('0x20'),'rest_data':JSON[_0x8574('0x28')]({'session':_0x3da22b['id'],'module_name':_0x8574('0x2b'),'query':util[_0x8574('0x22')](_0x8574('0x2c'),_0x3ad674),'order_by':'','offset':'0','select_fields':['id',_0x8574('0xc'),_0x8574('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8574('0x2e')](function(_0x274f9b){if(_0x274f9b['entry_list']['length']){var _0x588ed3=_['find'](_0x274f9b[_0x8574('0x2f')],function(_0x447134){return _0x447134['name_value_list'][_0x8574('0x2d')][_0x8574('0x30')]===_0x3ad674;});if(_0x588ed3){logger[_0x8574('0xa')](_0x8574('0x31'));return BPromise[_0x8574('0x32')]({'id':_0x588ed3[_0x8574('0x33')]['id'][_0x8574('0x30')],'name':_0x588ed3['name_value_list']['name']['value']});}}logger[_0x8574('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3da22b[_0x8574('0x33')]['user_id']['value'],'name':_0x3da22b[_0x8574('0x33')]['user_name'][_0x8574('0x30')]});});}else{logger[_0x8574('0xa')](_0x8574('0x34'));return BPromise[_0x8574('0x32')]({'id':_0x3da22b[_0x8574('0x33')][_0x8574('0x35')]['value'],'name':_0x3da22b[_0x8574('0x33')][_0x8574('0x2d')][_0x8574('0x30')]});}}function getEndUser(_0x5c0d6b,_0x46cf30,_0x45c88a,_0x4ff686){logger['info'](_0x8574('0x36'),_0x45c88a);return request({'form':{'method':_0x8574('0x2a'),'input_type':_0x8574('0x20'),'response_type':'JSON','rest_data':JSON[_0x8574('0x28')]({'session':_0x4ff686['id'],'module_name':'Contacts','query':util['format'](_0x8574('0x37'),_0x45c88a),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8574('0x2e')](function(_0x34a17c){if(_0x34a17c[_0x8574('0x2f')][_0x8574('0x1b')]){var _0x2d4c8f=_[_0x8574('0x38')](_0x34a17c[_0x8574('0x2f')],function(_0x102d06){return _0x102d06[_0x8574('0x33')][_0x8574('0x39')][_0x8574('0x30')]===_0x45c88a;});if(_0x2d4c8f){logger['info'](_0x8574('0x3a'));return BPromise[_0x8574('0x32')]({'id':_0x2d4c8f[_0x8574('0x33')]['id'][_0x8574('0x30')],'name':_0x2d4c8f[_0x8574('0x33')][_0x8574('0xc')][_0x8574('0x30')],'phone':_0x2d4c8f[_0x8574('0x33')][_0x8574('0x39')]['value']});}}else{logger[_0x8574('0xa')](_0x8574('0x3b'));return request({'form':{'method':_0x8574('0x1f'),'input_type':_0x8574('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4ff686['id'],'module_name':_0x8574('0x19'),'name_value_list':[{'name':_0x8574('0x3c'),'value':_0x46cf30!==_0x8574('0x3d')?_0x46cf30:util[_0x8574('0x22')](_0x8574('0x3e'),_0x45c88a)},{'name':_0x8574('0x39'),'value':_0x45c88a}]})}})[_0x8574('0x2e')](function(_0x1e1021){logger['info'](_0x8574('0x3f'));return BPromise['resolve']({'id':_0x1e1021['id'],'name':_0x1e1021['entry_list'][_0x8574('0x3c')]['value'],'phone':_0x1e1021[_0x8574('0x2f')][_0x8574('0x39')][_0x8574('0x30')]});});}});}function request(_0x2119f2){logger[_0x8574('0x40')](_0x8574('0x41'),JSON[_0x8574('0x28')](_0x2119f2));return rp(_['merge'](def,_0x2119f2));}function getTags(_0x3a3bdd,_0x35f076){var _0x3e9867=[];if(_0x3a3bdd&&_0x3a3bdd['length']>0x0){_0x3e9867=_[_0x8574('0x42')](_0x3a3bdd,_0x35f076);}return _0x3e9867;}function getCustomFields(_0xe8f8eb,_0x1586c5){var _0x4da8f0=[];var _0x1db4dd={'custom_fields':[]};if(_0xe8f8eb[_0x8574('0x1b')]>0x0){_[_0x8574('0x1c')](_0xe8f8eb,function(_0x41cf63){if(_0x41cf63[_0x8574('0x43')]==='string'&&_0x41cf63[_0x8574('0x44')]&&!_0x41cf63[_0x8574('0x45')]){_0x1db4dd[_0x41cf63[_0x8574('0x44')][_0x8574('0x46')]()]=_0x41cf63[_0x8574('0x47')][_0x8574('0x25')]();}else if(_0x41cf63[_0x8574('0x43')]===_0x8574('0x48')&&_0x41cf63[_0x8574('0x49')]&&_0x41cf63[_0x8574('0x45')]){_0x1db4dd[_0x8574('0x4a')][_0x8574('0x1e')]({'id':_0x41cf63[_0x8574('0x49')],'value':_0x41cf63[_0x8574('0x47')][_0x8574('0x25')]()});}else if(_0x41cf63['type']===_0x8574('0x4b')&&_0x41cf63['variableName']&&_0x41cf63[_0x8574('0x49')]&&_0x41cf63[_0x8574('0x45')]){_0x1586c5[_0x41cf63[_0x8574('0x1d')]]&&_0x1db4dd[_0x8574('0x4a')]['push']({'id':_0x41cf63[_0x8574('0x49')],'value':_0x1586c5[_0x41cf63[_0x8574('0x1d')]][_0x8574('0x25')]()});}else if(_0x41cf63[_0x8574('0x43')]===_0x8574('0x4c')&&_0x41cf63[_0x8574('0x4d')]&&_0x41cf63['Variable'][_0x8574('0xc')]&&_0x41cf63[_0x8574('0x49')]&&_0x41cf63['customField']){_0x1586c5[_0x41cf63[_0x8574('0x4d')][_0x8574('0xc')][_0x8574('0x46')]()]&&_0x1db4dd[_0x8574('0x4a')][_0x8574('0x1e')]({'id':_0x41cf63['idField'],'value':_0x1586c5[_0x41cf63['Variable'][_0x8574('0xc')][_0x8574('0x46')]()][_0x8574('0x25')]()});}});}return _0x1db4dd;}function getConnection(_0x37d2bf){return request({'method':_0x8574('0x4e'),'form':{'method':'login','input_type':_0x8574('0x20'),'response_type':'JSON','rest_data':JSON[_0x8574('0x28')]({'user_auth':{'user_name':_0x37d2bf['username'],'password':_0x37d2bf[_0x8574('0x4f')],'encryption':_0x8574('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x8574('0x2e')](function(_0x2ecc7c){var _0x5d3b83=_0x2ecc7c;if(_0x5d3b83['id']){def[_0x8574('0x51')]=_0x5d3b83['id'];return BPromise[_0x8574('0x32')](_0x5d3b83);}else{throw new Error(util[_0x8574('0x22')](_0x8574('0x52'),_0x37d2bf['id']));}});}function setRelationship(_0x53b5c2,_0x5bb1a0,_0x3ef272,_0xca89d){return request({'form':{'method':_0x8574('0x53'),'input_type':_0x8574('0x20'),'response_type':_0x8574('0x20'),'rest_data':JSON['stringify']({'session':_0x53b5c2['id'],'module_name':_0x8574('0x21'),'module_id':_0x3ef272['id'],'link_field_name':_0xca89d,'related_ids':[_0x5bb1a0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8574('0x54')]=function(_0x456b04,_0x28666c,_0x5e6600,_0x5049b8,_0x31ab86,_0x5ba246){var _0x20fd17,_0x559561,_0x5934af,_0x28d590;_0x5ba246[_0x8574('0x55')]=intUtil[_0x8574('0x56')](_0x5ba246[_0x8574('0x55')]);_0x5ba246[_0x8574('0x57')]=intUtil[_0x8574('0x56')](_0x5ba246[_0x8574('0x57')]);def[_0x8574('0x58')]=util[_0x8574('0x22')](_0x8574('0x59'),_0x5ba246[_0x8574('0x55')]);if(_0x31ab86&&_0x31ab86[_0x8574('0x5a')]){logger[_0x8574('0xa')](_0x8574('0x5b'),_0x8574('0x5c'));_0x28666c['recordingURL']=util['format'](_0x8574('0x5d'),_0x5ba246['serverUrl'],_0x28666c[_0x8574('0x5e')],md5(_0x28666c[_0x8574('0x5e')]));}else{_0x28666c[_0x8574('0x5f')]='';}return getConnection(_0x5ba246)[_0x8574('0x2e')](function(_0x3f84fa){_0x28d590=_0x3f84fa;return getUser(_0x5ba246,_0x5049b8[_0x8574('0xc')],_0x28d590);})[_0x8574('0x2e')](function(_0xc9f3fe){_0x20fd17=_0xc9f3fe;logger['info'](_0x8574('0x60'),_0x20fd17['id']);return getEndUser(_0x5ba246,_0x28666c[_0x8574('0x61')],_0x28666c['calleridnum'],_0x28d590);})[_0x8574('0x2e')](function(_0x1263a1){_0x559561=_0x1263a1;logger[_0x8574('0xa')](_0x8574('0x62'),_0x559561['id']);return getTicket(_0x5ba246,_0x20fd17,_0x559561,_0x5e6600,_0x28666c,_0x5e6600[_0x8574('0x63')],_0x28d590,_0x8574('0x64'));})[_0x8574('0x2e')](function(_0x17a577){_0x5934af=_0x17a577;logger['info'](_0x8574('0x65'));logger['info'](_0x8574('0x66'),_0x5934af['id']);return setRelationship(_0x28d590,_0x20fd17,_0x5934af,_0x8574('0x67'));})[_0x8574('0x2e')](function(){return setRelationship(_0x28d590,_0x559561,_0x5934af,_0x8574('0x68'));})[_0x8574('0x2e')](function(){return getServerInfo(_0x28d590);})['then'](function(_0x1a2628){var _0x4c33cb=parseInt(_0x1a2628[_0x8574('0x69')]['charAt'](0x0));var _0x204afc=util[_0x8574('0x22')](_0x8574('0x6a'),_0x5ba246[_0x8574('0x55')],_0x5934af['id']);if(_0x4c33cb>0x6){_0x204afc=util[_0x8574('0x22')](_0x8574('0x6b'),_0x5ba246[_0x8574('0x55')],_0x5934af['id']);}logger[_0x8574('0xa')]('[QUEUE]',_0x8574('0x6c'));emit(util['format'](_0x8574('0x6d'),_0x5049b8[_0x8574('0xc')]),'trigger:browser:url',{'uri':_0x204afc});})['catch'](function(_0x38729a){logger[_0x8574('0x6e')](_0x8574('0x5b'),JSON[_0x8574('0x28')](_0x38729a));});};exports[_0x8574('0x6f')]=function(_0x530ba0,_0x3bed6c,_0x11d2cf,_0x1b827c,_0x5137e1,_0x6d3f58,_0x117187){var _0x4ba4cf,_0x265e9e,_0xa39956,_0x194387;_0x6d3f58[_0x8574('0x55')]=intUtil['stripTrailingSlash'](_0x6d3f58['remoteUri']);_0x6d3f58['serverUrl']=intUtil[_0x8574('0x56')](_0x6d3f58[_0x8574('0x57')]);def[_0x8574('0x58')]=util[_0x8574('0x22')](_0x8574('0x59'),_0x6d3f58['remoteUri']);if(_0x117187&&_0x117187[_0x8574('0x70')]&&_0x117187['recordingFormat']!=='none'){logger[_0x8574('0xa')](_0x8574('0x71'),_0x8574('0x5c'));_0x3bed6c[_0x8574('0x5f')]=util[_0x8574('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6d3f58['serverUrl'],_0x3bed6c['uniqueid'],md5(_0x3bed6c[_0x8574('0x5e')]));}return getConnection(_0x6d3f58)[_0x8574('0x2e')](function(_0x3e94af){_0x194387=_0x3e94af;return getUser(_0x6d3f58,_0x1b827c['name'],_0x194387);})['then'](function(_0x401636){_0x4ba4cf=_0x401636;logger[_0x8574('0xa')]('The\x20User\x20ID\x20is:',_0x4ba4cf['id']);return getEndUser(_0x6d3f58,_0x3bed6c[_0x8574('0x72')],_0x3bed6c['destcalleridnum'],_0x194387);})['then'](function(_0x498345){_0x265e9e=_0x498345;logger['info'](_0x8574('0x62'),_0x265e9e['id']);return getTicket(_0x6d3f58,_0x4ba4cf,_0x265e9e,_0x11d2cf,_0x3bed6c,_0x11d2cf[_0x8574('0x63')],_0x194387,_0x8574('0x73'));})[_0x8574('0x2e')](function(_0x3de599){_0xa39956=_0x3de599;logger['info'](_0x8574('0x65'));logger[_0x8574('0xa')]('The\x20Ticket\x20ID\x20is:',_0xa39956['id']);return setRelationship(_0x194387,_0x4ba4cf,_0xa39956,_0x8574('0x67'));})[_0x8574('0x2e')](function(){return setRelationship(_0x194387,_0x265e9e,_0xa39956,_0x8574('0x68'));})[_0x8574('0x2e')](function(){return getServerInfo(_0x194387);})['then'](function(_0x113078){var _0xa9a17e=parseInt(_0x113078[_0x8574('0x69')][_0x8574('0x74')](0x0));var _0x441aa2=util[_0x8574('0x22')](_0x8574('0x6a'),_0x6d3f58[_0x8574('0x55')],_0xa39956['id']);if(_0xa9a17e>0x6){_0x441aa2=util[_0x8574('0x22')](_0x8574('0x6b'),_0x6d3f58['remoteUri'],_0xa39956['id']);}logger['info']('[OUTBOUND]',_0x8574('0x6c'));emit(util[_0x8574('0x22')](_0x8574('0x6d'),_0x1b827c[_0x8574('0xc')]),_0x8574('0x75'),{'uri':_0x441aa2});})['catch'](function(_0xd3f675){logger[_0x8574('0x6e')](_0x8574('0x71'),JSON[_0x8574('0x28')](_0xd3f675));});};exports['unmanaged']=function(_0x68e80,_0x7d9add,_0x3338f9,_0x459c09,_0x2e4629,_0x444788){var _0x24c008,_0x50cb0a,_0x6963ab,_0x55475f;_0x444788[_0x8574('0x55')]=intUtil[_0x8574('0x56')](_0x444788[_0x8574('0x55')]);_0x444788[_0x8574('0x57')]=intUtil[_0x8574('0x56')](_0x444788['serverUrl']);def[_0x8574('0x58')]=util[_0x8574('0x22')](_0x8574('0x59'),_0x444788['remoteUri']);if(_0x2e4629&&_0x2e4629[_0x8574('0x5a')]){logger[_0x8574('0xa')]('['+_0x7d9add[_0x8574('0x76')]['toUpperCase']()+']',_0x8574('0x5c'));_0x7d9add[_0x8574('0x5f')]=util[_0x8574('0x22')](_0x8574('0x5d'),_0x444788[_0x8574('0x57')],_0x7d9add[_0x8574('0x5e')],md5(_0x7d9add['uniqueid']));}else{_0x7d9add[_0x8574('0x5f')]='';}return getConnection(_0x444788)[_0x8574('0x2e')](function(_0x560a6d){_0x55475f=_0x560a6d;if(!_['isNil'](_0x459c09)){return getUser(_0x444788,_0x459c09[_0x8574('0xc')],_0x55475f);}else{return getUser(_0x444788,null,_0x55475f);}})[_0x8574('0x2e')](function(_0x24f373){_0x24c008=_0x24f373;logger[_0x8574('0xa')](_0x8574('0x60'),_0x24c008['id']);return getEndUser(_0x444788,_0x7d9add['calleridname'],_0x7d9add[_0x8574('0x77')],_0x55475f);})[_0x8574('0x2e')](function(_0x4c5637){_0x50cb0a=_0x4c5637;logger['info'](_0x8574('0x62'),_0x50cb0a['id']);return getTicket(_0x444788,_0x24c008,_0x50cb0a,_0x3338f9,_0x7d9add,_0x3338f9['Fields'],_0x55475f,_0x8574('0x64'));})[_0x8574('0x2e')](function(_0x42dccd){_0x6963ab=_0x42dccd;logger[_0x8574('0xa')]('Ticket\x20created!');logger[_0x8574('0xa')](_0x8574('0x66'),_0x6963ab['id']);return setRelationship(_0x55475f,_0x24c008,_0x6963ab,_0x8574('0x67'));})[_0x8574('0x2e')](function(){return setRelationship(_0x55475f,_0x50cb0a,_0x6963ab,_0x8574('0x68'));})[_0x8574('0x2e')](function(){return getServerInfo(_0x55475f);})[_0x8574('0x78')](function(_0x3d1f35){logger[_0x8574('0x6e')]('['+_0x7d9add[_0x8574('0x76')][_0x8574('0x79')]()+']',JSON[_0x8574('0x28')](_0x3d1f35));});}; \ 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 bcdb120..2b79dbb 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 _0xc60e=['keyValue','keyType','%s:\x20%s','key','keyContent','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','string','push','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString'];(function(_0x49546a,_0x195a3f){var _0xca8c10=function(_0x5220e4){while(--_0x5220e4){_0x49546a['push'](_0x49546a['shift']());}};_0xca8c10(++_0x195a3f);}(_0xc60e,0x196));var _0xec60=function(_0x2128c8,_0x200b6a){_0x2128c8=_0x2128c8-0x0;var _0x340816=_0xc60e[_0x2128c8];return _0x340816;};'use strict';var _=require(_0xec60('0x0'));var util=require(_0xec60('0x1'));exports['getString']=function(_0x2eabad,_0x58d649,_0x3261a8){var _0x1f3a96=[];if(_0x2eabad['length']>0x0){var _0x5b780=_[_0xec60('0x2')](_0x2eabad,['id']);for(var _0xcb36b5=0x0;_0xcb36b5<_0x5b780[_0xec60('0x3')];_0xcb36b5++){var _0x230499=_0x5b780[_0xcb36b5];if(_0x230499['type']===_0xec60('0x4')){_0x1f3a96[_0xec60('0x5')](_0x230499['content']);}else if(_0x230499[_0xec60('0x6')]===_0xec60('0x7')&&_0x230499[_0xec60('0x8')]){_0x58d649[_0x230499[_0xec60('0x8')]]&&_0x1f3a96['push'](_0x58d649[_0x230499['variableName']]['toString']());}else if(_0x230499[_0xec60('0x6')]===_0xec60('0x9')&&_0x230499[_0xec60('0xa')]&&_0x230499['Variable'][_0xec60('0xb')]){_0x58d649[_0x230499[_0xec60('0xa')][_0xec60('0xb')][_0xec60('0xc')]()]&&_0x1f3a96[_0xec60('0x5')](_0x58d649[_0x230499[_0xec60('0xa')][_0xec60('0xb')][_0xec60('0xc')]()][_0xec60('0xd')]());}else if(_0x230499[_0xec60('0x6')]===_0xec60('0xe')){if(_0x230499[_0xec60('0xf')]===_0xec60('0x4')&&_0x230499['key']){_0x1f3a96['push'](util['format'](_0xec60('0x10'),_0x230499[_0xec60('0x11')],_0x230499[_0xec60('0x12')]));}else if(_0x230499['keyType']===_0xec60('0x7')&&_0x230499['variableName']&&_0x230499[_0xec60('0x11')]){_0x58d649[_0x230499['variableName']]&&_0x1f3a96[_0xec60('0x5')](util['format']('%s:\x20%s',_0x230499[_0xec60('0x11')],_0x58d649[_0x230499['variableName']]));}else if(_0x230499[_0xec60('0xf')]===_0xec60('0x9')&&_0x230499[_0xec60('0xa')]&&_0x230499[_0xec60('0xa')][_0xec60('0xb')]&&_0x230499['key']){_0x58d649[_0x230499['Variable'][_0xec60('0xb')][_0xec60('0xc')]()]&&_0x1f3a96[_0xec60('0x5')](util[_0xec60('0x13')](_0xec60('0x10'),_0x230499['key'],_0x58d649[_0x230499[_0xec60('0xa')][_0xec60('0xb')]['toLowerCase']()]));}}}}return _0x1f3a96[_0xec60('0x14')](_0x3261a8);};exports[_0xec60('0x15')]=function(_0x253837){var _0x8b0aaa=_0x253837[_0xec60('0x16')](-0x1);if(_0x8b0aaa==='/'){_0x253837=_0x253837[_0xec60('0x17')](0x0,_0x253837[_0xec60('0x18')](_0x8b0aaa));}return _0x253837;};exports[_0xec60('0x19')]=function(_0x1f655d){if(!_[_0xec60('0x1a')](_0x1f655d)&&_0x1f655d!==''){var _0xff876a=/^(([^<>()\[\]\\.,;:\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 _0xff876a[_0xec60('0x1b')](String(_0x1f655d)[_0xec60('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x8642=['variable','variableName','customVariable','Variable','name','toString','keyValue','keyType','key','format','%s:\x20%s','toLowerCase','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','string','push','content','type'];(function(_0x3cc31a,_0x4bbb08){var _0xe50e0c=function(_0x319830){while(--_0x319830){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0xe50e0c(++_0x4bbb08);}(_0x8642,0xc8));var _0x2864=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x8642[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x2864('0x0'));var util=require('util');exports[_0x2864('0x1')]=function(_0x1aa4e4,_0x101c63,_0x5b5b40){var _0x469bbe=[];if(_0x1aa4e4[_0x2864('0x2')]>0x0){var _0x24be5d=_[_0x2864('0x3')](_0x1aa4e4,['id']);for(var _0x1dc026=0x0;_0x1dc026<_0x24be5d[_0x2864('0x2')];_0x1dc026++){var _0x5041a1=_0x24be5d[_0x1dc026];if(_0x5041a1['type']===_0x2864('0x4')){_0x469bbe[_0x2864('0x5')](_0x5041a1[_0x2864('0x6')]);}else if(_0x5041a1[_0x2864('0x7')]===_0x2864('0x8')&&_0x5041a1[_0x2864('0x9')]){_0x101c63[_0x5041a1[_0x2864('0x9')]]&&_0x469bbe[_0x2864('0x5')](_0x101c63[_0x5041a1['variableName']]['toString']());}else if(_0x5041a1['type']===_0x2864('0xa')&&_0x5041a1[_0x2864('0xb')]&&_0x5041a1[_0x2864('0xb')][_0x2864('0xc')]){_0x101c63[_0x5041a1[_0x2864('0xb')]['name']['toLowerCase']()]&&_0x469bbe['push'](_0x101c63[_0x5041a1[_0x2864('0xb')]['name']['toLowerCase']()][_0x2864('0xd')]());}else if(_0x5041a1[_0x2864('0x7')]===_0x2864('0xe')){if(_0x5041a1[_0x2864('0xf')]==='string'&&_0x5041a1[_0x2864('0x10')]){_0x469bbe[_0x2864('0x5')](util[_0x2864('0x11')](_0x2864('0x12'),_0x5041a1['key'],_0x5041a1['keyContent']));}else if(_0x5041a1['keyType']===_0x2864('0x8')&&_0x5041a1['variableName']&&_0x5041a1[_0x2864('0x10')]){_0x101c63[_0x5041a1['variableName']]&&_0x469bbe[_0x2864('0x5')](util['format']('%s:\x20%s',_0x5041a1[_0x2864('0x10')],_0x101c63[_0x5041a1['variableName']]));}else if(_0x5041a1['keyType']===_0x2864('0xa')&&_0x5041a1['Variable']&&_0x5041a1[_0x2864('0xb')]['name']&&_0x5041a1[_0x2864('0x10')]){_0x101c63[_0x5041a1[_0x2864('0xb')][_0x2864('0xc')][_0x2864('0x13')]()]&&_0x469bbe[_0x2864('0x5')](util[_0x2864('0x11')]('%s:\x20%s',_0x5041a1[_0x2864('0x10')],_0x101c63[_0x5041a1[_0x2864('0xb')][_0x2864('0xc')][_0x2864('0x13')]()]));}}}}return _0x469bbe['join'](_0x5b5b40);};exports[_0x2864('0x14')]=function(_0x3e97d1){var _0x16ae08=_0x3e97d1[_0x2864('0x15')](-0x1);if(_0x16ae08==='/'){_0x3e97d1=_0x3e97d1['substring'](0x0,_0x3e97d1[_0x2864('0x16')](_0x16ae08));}return _0x3e97d1;};exports[_0x2864('0x17')]=function(_0x4b96ed){if(!_[_0x2864('0x18')](_0x4b96ed)&&_0x4b96ed!==''){var _0x524929=/^(([^<>()\[\]\\.,;:\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 _0x524929[_0x2864('0x19')](String(_0x4b96ed)[_0x2864('0x13')]());}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 84f7d6d..ec6479d 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x1bdb2f,_0xe6fe8e){var _0x4153d6=function(_0x45159d){while(--_0x45159d){_0x1bdb2f['push'](_0x1bdb2f['shift']());}};_0x4153d6(++_0xe6fe8e);}(_0x34e8,0x12c));var _0x834e=function(_0x39abab,_0x45a931){_0x39abab=_0x39abab-0x0;var _0x50b92d=_0x34e8[_0x39abab];return _0x50b92d;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index c577c25..8edae44 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 _0xa6d3=['replace','unmanaged','monitor_format','lastevent','toUpperCase','inspect','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','Subjects','getString','Descriptions','then','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','map','picklist','type','nameField','customField','toLowerCase','content','includes','string','custom_fields','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','newTab'];(function(_0x2a3316,_0xe22ce9){var _0xd2f9e4=function(_0x108cc0){while(--_0x108cc0){_0x2a3316['push'](_0x2a3316['shift']());}};_0xd2f9e4(++_0xe22ce9);}(_0xa6d3,0x75));var _0x3a6d=function(_0x54be18,_0x5c1143){_0x54be18=_0x54be18-0x0;var _0x444295=_0xa6d3[_0x54be18];return _0x444295;};'use strict';var _=require(_0x3a6d('0x0'));var rp=require(_0x3a6d('0x1'));var md5=require(_0x3a6d('0x2'));var util=require('util');var Redis=require(_0x3a6d('0x3'));var intUtil=require(_0x3a6d('0x4'));var config=require(_0x3a6d('0x5'));var logger=require(_0x3a6d('0x6'))(_0x3a6d('0x7'));config[_0x3a6d('0x8')]=_[_0x3a6d('0x9')](config[_0x3a6d('0x8')],{'host':_0x3a6d('0xa'),'port':0x18eb});var io=require(_0x3a6d('0xb'))(new Redis(config[_0x3a6d('0x8')]));function emit(_0x386c23,_0x3f4163,_0x4db866){io['to'](_0x386c23)['emit'](_0x3f4163,_0x4db866);}var headers={'Content-Type':_0x3a6d('0xc'),'Accept':_0x3a6d('0xc')};function getTicket(_0x5120a8,_0x5ba2cb,_0x49d558,_0x14a35a,_0x486bb2){logger[_0x3a6d('0xd')](_0x3a6d('0xe'));return request({'uri':util[_0x3a6d('0xf')](_0x3a6d('0x10'),_0x5120a8['remoteUri']),'method':'POST','body':{'ticket':_[_0x3a6d('0x11')]({'requester_id':_0x49d558['id'],'submitter_id':_0x5ba2cb?_0x5ba2cb['id']:undefined,'assignee_id':_0x5ba2cb?_0x5ba2cb['id']:undefined,'tags':getTags(_0x14a35a[_0x3a6d('0x12')],_0x3a6d('0x13')),'subject':intUtil['getString'](_0x14a35a[_0x3a6d('0x14')],_0x486bb2,'\x20'),'description':intUtil[_0x3a6d('0x15')](_0x14a35a[_0x3a6d('0x16')],_0x486bb2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x14a35a[_0x3a6d('0x16')],_0x486bb2,'\x0a')}},getCustomFields(_0x14a35a['Fields'],_0x486bb2))}})[_0x3a6d('0x17')](function(_0x19f8c7){logger[_0x3a6d('0xd')]('Ticket\x20created!');return _0x19f8c7[_0x3a6d('0x18')];});}function getUser(_0xd24070,_0x5d3251){if(intUtil['validateEmail'](_0x5d3251)){logger['info']('Getting\x20agent\x20with\x20email',_0x5d3251);return request({'uri':util[_0x3a6d('0xf')](_0x3a6d('0x19'),_0xd24070['remoteUri']),'qs':{'query':util[_0x3a6d('0xf')](_0x3a6d('0x1a'),_0x5d3251)}})['then'](function(_0x50188c){if(_0x50188c[_0x3a6d('0x1b')]){logger[_0x3a6d('0xd')](_0x3a6d('0x1c'));return _[_0x3a6d('0x1d')](_0x50188c[_0x3a6d('0x1e')],{'email':_0x5d3251,'role':_0x3a6d('0x1f')});}else{logger[_0x3a6d('0xd')](_0x3a6d('0x20'));return request({'uri':util['format'](_0x3a6d('0x21'),_0xd24070[_0x3a6d('0x22')])})['then'](function(_0x78abca){logger[_0x3a6d('0xd')](_0x3a6d('0x23'));return _0x78abca['user'];});}});}else{logger[_0x3a6d('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3a6d('0xf')](_0x3a6d('0x21'),_0xd24070[_0x3a6d('0x22')])})[_0x3a6d('0x17')](function(_0x475976){logger['info'](_0x3a6d('0x23'));return _0x475976[_0x3a6d('0x24')];});}}function getEndUser(_0x5873b3,_0x51c2a9,_0x15a377){logger[_0x3a6d('0xd')](_0x3a6d('0x25'),_0x15a377);return request({'uri':util['format']('%s/search.json',_0x5873b3[_0x3a6d('0x22')]),'qs':{'query':util[_0x3a6d('0xf')](_0x3a6d('0x26'),_0x15a377)}})['then'](function(_0x582592){var _0x1ca8fe;if(_0x582592['results'][_0x3a6d('0x27')]){_0x582592[_0x3a6d('0x1e')]=_[_0x3a6d('0x28')](_0x582592['results'],{'suspended':![],'role':_0x3a6d('0x29')});if(_0x582592[_0x3a6d('0x1e')][_0x3a6d('0x27')]){_0x1ca8fe=_['first'](_0x582592[_0x3a6d('0x1e')]);}}if(_0x1ca8fe){logger['info'](_0x3a6d('0x2a'));return _0x1ca8fe;}else{logger[_0x3a6d('0xd')](_0x3a6d('0x2b'));return request({'uri':util['format'](_0x3a6d('0x2c'),_0x5873b3[_0x3a6d('0x22')]),'method':_0x3a6d('0x2d'),'body':{'user':{'role':_0x3a6d('0x29'),'name':util['format'](_0x3a6d('0x2e'),_0x51c2a9||_0x15a377),'phone':_0x15a377}}})[_0x3a6d('0x17')](function(_0x3830bb){logger[_0x3a6d('0xd')](_0x3a6d('0x2f'));return _0x3830bb[_0x3a6d('0x24')];});}});}function getAuth(_0x22496a){var _0x4f4791;if(_0x22496a[_0x3a6d('0x30')]==='password'){_0x4f4791=util[_0x3a6d('0xf')](_0x3a6d('0x31'),_0x22496a[_0x3a6d('0x32')],_0x22496a[_0x3a6d('0x33')]);}else if(_0x22496a[_0x3a6d('0x30')]===_0x3a6d('0x34')){_0x4f4791=util[_0x3a6d('0xf')](_0x3a6d('0x35'),_0x22496a['username'],_0x22496a[_0x3a6d('0x34')]);}return util[_0x3a6d('0xf')](_0x3a6d('0x36'),new Buffer(_0x4f4791)[_0x3a6d('0x37')](_0x3a6d('0x38')));}function request(_0x342fbf){logger[_0x3a6d('0x39')]('[HTTP]',JSON['stringify'](_0x342fbf));return rp(_[_0x3a6d('0x9')](_0x342fbf,{'method':_0x3a6d('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x2b7e8d,_0x353f02){var _0x2123b6=[];if(_0x2b7e8d&&_0x2b7e8d[_0x3a6d('0x27')]>0x0){_0x2123b6=_[_0x3a6d('0x3b')](_0x2b7e8d,_0x353f02);}return _0x2123b6;}function getCustomFields(_0x37dfb4,_0x3c7544){var _0x15a63a=[];var _0xed47a4={'custom_fields':[]};if(_0x37dfb4[_0x3a6d('0x27')]>0x0){_['forEach'](_0x37dfb4,function(_0x39dce6){if(_['includes'](['string',_0x3a6d('0x3c')],_0x39dce6[_0x3a6d('0x3d')])&&_0x39dce6[_0x3a6d('0x3e')]&&!_0x39dce6[_0x3a6d('0x3f')]){_0xed47a4[_0x39dce6[_0x3a6d('0x3e')][_0x3a6d('0x40')]()]=_0x39dce6[_0x3a6d('0x41')][_0x3a6d('0x37')]();}else if(_[_0x3a6d('0x42')]([_0x3a6d('0x43'),_0x3a6d('0x3c')],_0x39dce6[_0x3a6d('0x3d')])&&_0x39dce6['idField']&&_0x39dce6[_0x3a6d('0x3f')]){_0xed47a4[_0x3a6d('0x44')][_0x3a6d('0x45')]({'id':_0x39dce6[_0x3a6d('0x46')],'value':_0x39dce6[_0x3a6d('0x41')][_0x3a6d('0x37')]()});}else if(_0x39dce6[_0x3a6d('0x3d')]==='variable'&&_0x39dce6['variableName']&&_0x39dce6['idField']&&_0x39dce6[_0x3a6d('0x3f')]){_0x3c7544[_0x39dce6[_0x3a6d('0x47')]]&&_0xed47a4['custom_fields'][_0x3a6d('0x45')]({'id':_0x39dce6[_0x3a6d('0x46')],'value':_0x3c7544[_0x39dce6[_0x3a6d('0x47')]][_0x3a6d('0x37')]()});}else if(_0x39dce6[_0x3a6d('0x3d')]===_0x3a6d('0x48')&&_0x39dce6['Variable']&&_0x39dce6['Variable'][_0x3a6d('0x13')]&&_0x39dce6[_0x3a6d('0x46')]&&_0x39dce6[_0x3a6d('0x3f')]){_0x3c7544[_0x39dce6['Variable'][_0x3a6d('0x13')]['toLowerCase']()]&&_0xed47a4[_0x3a6d('0x44')]['push']({'id':_0x39dce6['idField'],'value':_0x3c7544[_0x39dce6[_0x3a6d('0x49')]['name'][_0x3a6d('0x40')]()][_0x3a6d('0x37')]()});}});}return _0xed47a4;}exports[_0x3a6d('0x4a')]=function(_0x33b3ef,_0x3c1ce0,_0x4137b0,_0x532b84,_0x33a104,_0x2c3bb9){var _0x1b3efe,_0x2f7271;_0x2c3bb9[_0x3a6d('0x22')]=intUtil[_0x3a6d('0x4b')](_0x2c3bb9['remoteUri']);_0x2c3bb9['serverUrl']=intUtil[_0x3a6d('0x4b')](_0x2c3bb9[_0x3a6d('0x4c')]);if(_0x33a104&&_0x33a104['monitor_format']){logger[_0x3a6d('0xd')](_0x3a6d('0x4d'),_0x3a6d('0x4e'));_0x3c1ce0['recordingURL']=util[_0x3a6d('0xf')](_0x3a6d('0x4f'),_0x2c3bb9['serverUrl'],_0x3c1ce0[_0x3a6d('0x50')],md5(_0x3c1ce0[_0x3a6d('0x50')]));}else{_0x3c1ce0[_0x3a6d('0x51')]='';}headers['Authorization']=getAuth(_0x2c3bb9);return getUser(_0x2c3bb9,_0x532b84[_0x3a6d('0x52')])['then'](function(_0x1fd0e5){_0x1b3efe=_0x1fd0e5;logger['info'](_0x3a6d('0x53'),_0x1b3efe['id']);return getEndUser(_0x2c3bb9,_0x3c1ce0[_0x3a6d('0x54')],_0x3c1ce0[_0x3a6d('0x55')]);})[_0x3a6d('0x17')](function(_0x572892){_0x2f7271=_0x572892;logger[_0x3a6d('0xd')](_0x3a6d('0x56'),_0x2f7271['id']);return getTicket(_0x2c3bb9,_0x1b3efe,_0x2f7271,_0x4137b0,_0x3c1ce0);})['then'](function(_0xe89063){if(_0xe89063){logger[_0x3a6d('0xd')]('The\x20Ticket\x20ID\x20is:',_0xe89063['id']);switch(_0x2c3bb9[_0x3a6d('0x3d')]){case _0x3a6d('0x57'):logger[_0x3a6d('0xd')](_0x3a6d('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3a6d('0xf')](_0x3a6d('0x58'),_0x2c3bb9[_0x3a6d('0x22')],_0x1b3efe['id'],_0xe89063['id']),'method':_0x3a6d('0x2d')});case'newTab':logger['info']('[QUEUE]',_0x3a6d('0x59'));emit(util[_0x3a6d('0xf')](_0x3a6d('0x5a'),_0x532b84['name']),'trigger:browser:url',{'uri':util[_0x3a6d('0xf')](_0x3a6d('0x5b'),_0x2c3bb9[_0x3a6d('0x22')]['replace'](_0x3a6d('0x5c'),''),_0xe89063['id'])});break;default:logger[_0x3a6d('0x5d')](_0x3a6d('0x4d'),_0x3a6d('0x5e'));}}})[_0x3a6d('0x5f')](function(_0xe9706a){logger['error'](_0x3a6d('0x60'),util['inspect'](_0xe9706a,{'showHidden':!![],'depth':null}));});};exports[_0x3a6d('0x61')]=function(_0x575b1c,_0x26d339,_0x1c0816,_0x55007e,_0x47038b,_0x59190e,_0x55ce14){var _0x7e900e,_0x3d240c;_0x59190e['remoteUri']=intUtil['stripTrailingSlash'](_0x59190e[_0x3a6d('0x22')]);_0x59190e[_0x3a6d('0x4c')]=intUtil[_0x3a6d('0x4b')](_0x59190e['serverUrl']);if(_0x55ce14&&_0x55ce14['recordingFormat']&&_0x55ce14[_0x3a6d('0x62')]!=='none'){logger['info'](_0x3a6d('0x63'),_0x3a6d('0x4e'));_0x26d339['recordingURL']=util[_0x3a6d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59190e[_0x3a6d('0x4c')],_0x26d339[_0x3a6d('0x50')],md5(_0x26d339[_0x3a6d('0x50')]));}headers[_0x3a6d('0x64')]=getAuth(_0x59190e);return getUser(_0x59190e,_0x55007e[_0x3a6d('0x52')])[_0x3a6d('0x17')](function(_0x24d6ec){_0x7e900e=_0x24d6ec;logger[_0x3a6d('0xd')]('The\x20User\x20ID\x20is:',_0x7e900e['id']);return getEndUser(_0x59190e,_0x26d339[_0x3a6d('0x65')],_0x26d339[_0x3a6d('0x66')]);})[_0x3a6d('0x17')](function(_0x1ae505){_0x3d240c=_0x1ae505;logger[_0x3a6d('0xd')](_0x3a6d('0x56'),_0x3d240c['id']);return getTicket(_0x59190e,_0x7e900e,_0x3d240c,_0x1c0816,_0x26d339);})[_0x3a6d('0x17')](function(_0x217e01){if(_0x217e01){logger[_0x3a6d('0xd')](_0x3a6d('0x67'),_0x217e01['id']);switch(_0x59190e[_0x3a6d('0x3d')]){case _0x3a6d('0x57'):logger[_0x3a6d('0xd')](_0x3a6d('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x59190e['remoteUri'],_0x7e900e['id'],_0x217e01['id']),'method':_0x3a6d('0x2d')});case _0x3a6d('0x68'):logger['info'](_0x3a6d('0x63'),_0x3a6d('0x59'));emit(util['format'](_0x3a6d('0x5a'),_0x55007e[_0x3a6d('0x13')]),'trigger:browser:url',{'uri':util[_0x3a6d('0xf')]('%s/agent/tickets/%s',_0x59190e[_0x3a6d('0x22')][_0x3a6d('0x69')](_0x3a6d('0x5c'),''),_0x217e01['id'])});break;default:logger['error'](_0x3a6d('0x63'),_0x3a6d('0x5e'));}}})[_0x3a6d('0x5f')](function(_0xde2882){logger[_0x3a6d('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xde2882,{'showHidden':!![],'depth':null}));});};exports[_0x3a6d('0x6a')]=function(_0x4b498e,_0x1f7c62,_0x49205d,_0x1428d3,_0x38a97f,_0x10c7d0){var _0x22c0b8,_0x58efe2;_0x10c7d0[_0x3a6d('0x22')]=intUtil[_0x3a6d('0x4b')](_0x10c7d0[_0x3a6d('0x22')]);_0x10c7d0[_0x3a6d('0x4c')]=intUtil[_0x3a6d('0x4b')](_0x10c7d0['serverUrl']);if(_0x38a97f&&_0x38a97f[_0x3a6d('0x6b')]){logger[_0x3a6d('0xd')]('['+_0x1f7c62[_0x3a6d('0x6c')][_0x3a6d('0x6d')]()+']',_0x3a6d('0x4e'));_0x1f7c62['recordingURL']=util['format'](_0x3a6d('0x4f'),_0x10c7d0[_0x3a6d('0x4c')],_0x1f7c62['uniqueid'],md5(_0x1f7c62[_0x3a6d('0x50')]));}else{_0x1f7c62['recordingURL']='';}headers[_0x3a6d('0x64')]=getAuth(_0x10c7d0);return getUser(_0x10c7d0)[_0x3a6d('0x17')](function(_0x18fdef){_0x22c0b8=_0x18fdef;logger[_0x3a6d('0xd')](_0x3a6d('0x53'),_0x22c0b8['id']);return getEndUser(_0x10c7d0,_0x1f7c62[_0x3a6d('0x54')],_0x1f7c62[_0x3a6d('0x55')]);})[_0x3a6d('0x17')](function(_0x327759){_0x58efe2=_0x327759;logger[_0x3a6d('0xd')](_0x3a6d('0x56'),_0x58efe2['id']);return getTicket(_0x10c7d0,_0x22c0b8,_0x58efe2,_0x49205d,_0x1f7c62);})['then'](function(_0x34177c){if(_0x34177c){logger['info']('The\x20Ticket\x20ID\x20is:',_0x34177c['id']);}})[_0x3a6d('0x5f')](function(_0x30ecef){logger['error']('['+_0x1f7c62['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x3a6d('0x6e')](_0x30ecef,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9c6f=['emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','info','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','stringify','map','forEach','includes','string','picklist','type','toLowerCase','content','idField','custom_fields','variable','variableName','customField','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','newTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost'];(function(_0x2afa81,_0x107e1c){var _0x245ee7=function(_0x5f2466){while(--_0x5f2466){_0x2afa81['push'](_0x2afa81['shift']());}};_0x245ee7(++_0x107e1c);}(_0x9c6f,0x134));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xf9c6('0x0'));var md5=require(_0xf9c6('0x1'));var util=require(_0xf9c6('0x2'));var Redis=require(_0xf9c6('0x3'));var intUtil=require(_0xf9c6('0x4'));var config=require(_0xf9c6('0x5'));var logger=require(_0xf9c6('0x6'))('zendesk');config[_0xf9c6('0x7')]=_[_0xf9c6('0x8')](config['redis'],{'host':_0xf9c6('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf9c6('0x7')]));function emit(_0x809fc0,_0x18a563,_0x436f42){io['to'](_0x809fc0)[_0xf9c6('0xa')](_0x18a563,_0x436f42);}var headers={'Content-Type':_0xf9c6('0xb'),'Accept':_0xf9c6('0xb')};function getTicket(_0x396407,_0x14ef25,_0x21d421,_0x53fd1d,_0xe88683){logger['info'](_0xf9c6('0xc'));return request({'uri':util[_0xf9c6('0xd')]('%s/tickets.json',_0x396407[_0xf9c6('0xe')]),'method':_0xf9c6('0xf'),'body':{'ticket':_[_0xf9c6('0x10')]({'requester_id':_0x21d421['id'],'submitter_id':_0x14ef25?_0x14ef25['id']:undefined,'assignee_id':_0x14ef25?_0x14ef25['id']:undefined,'tags':getTags(_0x53fd1d[_0xf9c6('0x11')],_0xf9c6('0x12')),'subject':intUtil['getString'](_0x53fd1d['Subjects'],_0xe88683,'\x20'),'description':intUtil[_0xf9c6('0x13')](_0x53fd1d[_0xf9c6('0x14')],_0xe88683,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf9c6('0x13')](_0x53fd1d[_0xf9c6('0x14')],_0xe88683,'\x0a')}},getCustomFields(_0x53fd1d[_0xf9c6('0x15')],_0xe88683))}})[_0xf9c6('0x16')](function(_0x4a6158){logger['info'](_0xf9c6('0x17'));return _0x4a6158['ticket'];});}function getUser(_0x448711,_0x223c98){if(intUtil[_0xf9c6('0x18')](_0x223c98)){logger[_0xf9c6('0x19')]('Getting\x20agent\x20with\x20email',_0x223c98);return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x1a'),_0x448711[_0xf9c6('0xe')]),'qs':{'query':util['format'](_0xf9c6('0x1b'),_0x223c98)}})[_0xf9c6('0x16')](function(_0x2230f8){if(_0x2230f8['count']){logger['info'](_0xf9c6('0x1c'));return _[_0xf9c6('0x1d')](_0x2230f8[_0xf9c6('0x1e')],{'email':_0x223c98,'role':'agent'});}else{logger[_0xf9c6('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x1f'),_0x448711[_0xf9c6('0xe')])})[_0xf9c6('0x16')](function(_0x4dca57){logger[_0xf9c6('0x19')](_0xf9c6('0x20'));return _0x4dca57['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x1f'),_0x448711[_0xf9c6('0xe')])})[_0xf9c6('0x16')](function(_0x3d96cb){logger[_0xf9c6('0x19')]('Admin\x20account\x20selected.');return _0x3d96cb[_0xf9c6('0x21')];});}}function getEndUser(_0x350e46,_0x2777c8,_0x1175fc){logger['info']('Searching\x20enduser\x20with\x20phone',_0x1175fc);return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x1a'),_0x350e46['remoteUri']),'qs':{'query':util['format'](_0xf9c6('0x22'),_0x1175fc)}})['then'](function(_0x488cc4){var _0x29491b;if(_0x488cc4[_0xf9c6('0x1e')][_0xf9c6('0x23')]){_0x488cc4[_0xf9c6('0x1e')]=_[_0xf9c6('0x24')](_0x488cc4[_0xf9c6('0x1e')],{'suspended':![],'role':_0xf9c6('0x25')});if(_0x488cc4['results'][_0xf9c6('0x23')]){_0x29491b=_['first'](_0x488cc4[_0xf9c6('0x1e')]);}}if(_0x29491b){logger[_0xf9c6('0x19')]('Enduser\x20found!');return _0x29491b;}else{logger['info'](_0xf9c6('0x26'));return request({'uri':util[_0xf9c6('0xd')]('%s/users.json',_0x350e46['remoteUri']),'method':_0xf9c6('0xf'),'body':{'user':{'role':_0xf9c6('0x25'),'name':util[_0xf9c6('0xd')](_0xf9c6('0x27'),_0x2777c8||_0x1175fc),'phone':_0x1175fc}}})[_0xf9c6('0x16')](function(_0x27192c){logger[_0xf9c6('0x19')](_0xf9c6('0x28'));return _0x27192c[_0xf9c6('0x21')];});}});}function getAuth(_0x56aa57){var _0x307cf1;if(_0x56aa57[_0xf9c6('0x29')]==='password'){_0x307cf1=util['format'](_0xf9c6('0x2a'),_0x56aa57[_0xf9c6('0x2b')],_0x56aa57['password']);}else if(_0x56aa57[_0xf9c6('0x29')]==='token'){_0x307cf1=util[_0xf9c6('0xd')](_0xf9c6('0x2c'),_0x56aa57['username'],_0x56aa57[_0xf9c6('0x2d')]);}return util['format'](_0xf9c6('0x2e'),new Buffer(_0x307cf1)[_0xf9c6('0x2f')]('base64'));}function request(_0xbbfd26){logger['debug']('[HTTP]',JSON[_0xf9c6('0x30')](_0xbbfd26));return rp(_[_0xf9c6('0x8')](_0xbbfd26,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5df003,_0x49ce06){var _0x47267d=[];if(_0x5df003&&_0x5df003[_0xf9c6('0x23')]>0x0){_0x47267d=_[_0xf9c6('0x31')](_0x5df003,_0x49ce06);}return _0x47267d;}function getCustomFields(_0x2f53a0,_0x800666){var _0x18eac1=[];var _0xf5c574={'custom_fields':[]};if(_0x2f53a0[_0xf9c6('0x23')]>0x0){_[_0xf9c6('0x32')](_0x2f53a0,function(_0x495587){if(_[_0xf9c6('0x33')]([_0xf9c6('0x34'),_0xf9c6('0x35')],_0x495587[_0xf9c6('0x36')])&&_0x495587['nameField']&&!_0x495587['customField']){_0xf5c574[_0x495587['nameField'][_0xf9c6('0x37')]()]=_0x495587[_0xf9c6('0x38')][_0xf9c6('0x2f')]();}else if(_[_0xf9c6('0x33')](['string',_0xf9c6('0x35')],_0x495587[_0xf9c6('0x36')])&&_0x495587[_0xf9c6('0x39')]&&_0x495587['customField']){_0xf5c574[_0xf9c6('0x3a')]['push']({'id':_0x495587[_0xf9c6('0x39')],'value':_0x495587[_0xf9c6('0x38')]['toString']()});}else if(_0x495587[_0xf9c6('0x36')]===_0xf9c6('0x3b')&&_0x495587[_0xf9c6('0x3c')]&&_0x495587[_0xf9c6('0x39')]&&_0x495587[_0xf9c6('0x3d')]){_0x800666[_0x495587[_0xf9c6('0x3c')]]&&_0xf5c574['custom_fields'][_0xf9c6('0x3e')]({'id':_0x495587['idField'],'value':_0x800666[_0x495587[_0xf9c6('0x3c')]][_0xf9c6('0x2f')]()});}else if(_0x495587[_0xf9c6('0x36')]===_0xf9c6('0x3f')&&_0x495587[_0xf9c6('0x40')]&&_0x495587['Variable'][_0xf9c6('0x12')]&&_0x495587[_0xf9c6('0x39')]&&_0x495587[_0xf9c6('0x3d')]){_0x800666[_0x495587['Variable'][_0xf9c6('0x12')]['toLowerCase']()]&&_0xf5c574[_0xf9c6('0x3a')][_0xf9c6('0x3e')]({'id':_0x495587[_0xf9c6('0x39')],'value':_0x800666[_0x495587[_0xf9c6('0x40')][_0xf9c6('0x12')][_0xf9c6('0x37')]()][_0xf9c6('0x2f')]()});}});}return _0xf5c574;}exports[_0xf9c6('0x41')]=function(_0x35d5e5,_0x312b19,_0x48dadc,_0x4e92ec,_0xe033c8,_0x1a3000){var _0x120090,_0x140ff6;_0x1a3000[_0xf9c6('0xe')]=intUtil[_0xf9c6('0x42')](_0x1a3000[_0xf9c6('0xe')]);_0x1a3000[_0xf9c6('0x43')]=intUtil['stripTrailingSlash'](_0x1a3000['serverUrl']);if(_0xe033c8&&_0xe033c8[_0xf9c6('0x44')]){logger[_0xf9c6('0x19')](_0xf9c6('0x45'),'Recording\x20is\x20enabled!');_0x312b19[_0xf9c6('0x46')]=util[_0xf9c6('0xd')](_0xf9c6('0x47'),_0x1a3000[_0xf9c6('0x43')],_0x312b19[_0xf9c6('0x48')],md5(_0x312b19[_0xf9c6('0x48')]));}else{_0x312b19[_0xf9c6('0x46')]='';}headers[_0xf9c6('0x49')]=getAuth(_0x1a3000);return getUser(_0x1a3000,_0x4e92ec['email'])['then'](function(_0x189304){_0x120090=_0x189304;logger[_0xf9c6('0x19')](_0xf9c6('0x4a'),_0x120090['id']);return getEndUser(_0x1a3000,_0x312b19[_0xf9c6('0x4b')],_0x312b19['calleridnum']);})[_0xf9c6('0x16')](function(_0x49253a){_0x140ff6=_0x49253a;logger[_0xf9c6('0x19')](_0xf9c6('0x4c'),_0x140ff6['id']);return getTicket(_0x1a3000,_0x120090,_0x140ff6,_0x48dadc,_0x312b19);})[_0xf9c6('0x16')](function(_0x106aaf){if(_0x106aaf){logger[_0xf9c6('0x19')](_0xf9c6('0x4d'),_0x106aaf['id']);switch(_0x1a3000[_0xf9c6('0x36')]){case _0xf9c6('0x4e'):logger[_0xf9c6('0x19')](_0xf9c6('0x45'),_0xf9c6('0x4f'));return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x50'),_0x1a3000['remoteUri'],_0x120090['id'],_0x106aaf['id']),'method':'POST'});case'newTab':logger[_0xf9c6('0x19')](_0xf9c6('0x45'),_0xf9c6('0x51'));emit(util['format'](_0xf9c6('0x52'),_0x4e92ec[_0xf9c6('0x12')]),_0xf9c6('0x53'),{'uri':util[_0xf9c6('0xd')]('%s/agent/tickets/%s',_0x1a3000[_0xf9c6('0xe')][_0xf9c6('0x54')](_0xf9c6('0x55'),''),_0x106aaf['id'])});break;default:logger[_0xf9c6('0x56')](_0xf9c6('0x45'),_0xf9c6('0x57'));}}})[_0xf9c6('0x58')](function(_0x11392d){logger[_0xf9c6('0x56')](_0xf9c6('0x59'),util[_0xf9c6('0x5a')](_0x11392d,{'showHidden':!![],'depth':null}));});};exports[_0xf9c6('0x5b')]=function(_0x3d2845,_0x37982a,_0x33c4bd,_0x30fd67,_0x35f753,_0x4ae37d,_0x152409){var _0x5e7575,_0x4ec30b;_0x4ae37d[_0xf9c6('0xe')]=intUtil[_0xf9c6('0x42')](_0x4ae37d[_0xf9c6('0xe')]);_0x4ae37d[_0xf9c6('0x43')]=intUtil[_0xf9c6('0x42')](_0x4ae37d[_0xf9c6('0x43')]);if(_0x152409&&_0x152409[_0xf9c6('0x5c')]&&_0x152409[_0xf9c6('0x5c')]!==_0xf9c6('0x5d')){logger[_0xf9c6('0x19')](_0xf9c6('0x5e'),_0xf9c6('0x5f'));_0x37982a['recordingURL']=util[_0xf9c6('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ae37d[_0xf9c6('0x43')],_0x37982a[_0xf9c6('0x48')],md5(_0x37982a[_0xf9c6('0x48')]));}headers['Authorization']=getAuth(_0x4ae37d);return getUser(_0x4ae37d,_0x30fd67['email'])[_0xf9c6('0x16')](function(_0x5a6118){_0x5e7575=_0x5a6118;logger[_0xf9c6('0x19')]('The\x20User\x20ID\x20is:',_0x5e7575['id']);return getEndUser(_0x4ae37d,_0x37982a[_0xf9c6('0x60')],_0x37982a[_0xf9c6('0x61')]);})[_0xf9c6('0x16')](function(_0x2f0df5){_0x4ec30b=_0x2f0df5;logger[_0xf9c6('0x19')]('The\x20Enduser\x20ID\x20is:',_0x4ec30b['id']);return getTicket(_0x4ae37d,_0x5e7575,_0x4ec30b,_0x33c4bd,_0x37982a);})[_0xf9c6('0x16')](function(_0x5d61a8){if(_0x5d61a8){logger[_0xf9c6('0x19')](_0xf9c6('0x4d'),_0x5d61a8['id']);switch(_0x4ae37d[_0xf9c6('0x36')]){case _0xf9c6('0x4e'):logger[_0xf9c6('0x19')](_0xf9c6('0x5e'),_0xf9c6('0x4f'));return request({'uri':util[_0xf9c6('0xd')](_0xf9c6('0x50'),_0x4ae37d['remoteUri'],_0x5e7575['id'],_0x5d61a8['id']),'method':_0xf9c6('0xf')});case _0xf9c6('0x62'):logger[_0xf9c6('0x19')](_0xf9c6('0x5e'),_0xf9c6('0x51'));emit(util[_0xf9c6('0xd')]('user:%s',_0x30fd67[_0xf9c6('0x12')]),_0xf9c6('0x53'),{'uri':util['format'](_0xf9c6('0x63'),_0x4ae37d[_0xf9c6('0xe')][_0xf9c6('0x54')](_0xf9c6('0x55'),''),_0x5d61a8['id'])});break;default:logger[_0xf9c6('0x56')](_0xf9c6('0x5e'),_0xf9c6('0x57'));}}})['catch'](function(_0x57ff1a){logger[_0xf9c6('0x56')](_0xf9c6('0x64'),util[_0xf9c6('0x5a')](_0x57ff1a,{'showHidden':!![],'depth':null}));});};exports[_0xf9c6('0x65')]=function(_0x191acd,_0x33f994,_0x1d9a64,_0x51beb6,_0x1ae734,_0x11b925){var _0x3bbfc8,_0x405e07;_0x11b925['remoteUri']=intUtil[_0xf9c6('0x42')](_0x11b925[_0xf9c6('0xe')]);_0x11b925[_0xf9c6('0x43')]=intUtil[_0xf9c6('0x42')](_0x11b925[_0xf9c6('0x43')]);if(_0x1ae734&&_0x1ae734[_0xf9c6('0x44')]){logger[_0xf9c6('0x19')]('['+_0x33f994[_0xf9c6('0x66')][_0xf9c6('0x67')]()+']',_0xf9c6('0x5f'));_0x33f994[_0xf9c6('0x46')]=util[_0xf9c6('0xd')](_0xf9c6('0x47'),_0x11b925[_0xf9c6('0x43')],_0x33f994[_0xf9c6('0x48')],md5(_0x33f994[_0xf9c6('0x48')]));}else{_0x33f994[_0xf9c6('0x46')]='';}headers[_0xf9c6('0x49')]=getAuth(_0x11b925);return getUser(_0x11b925)[_0xf9c6('0x16')](function(_0x10a643){_0x3bbfc8=_0x10a643;logger[_0xf9c6('0x19')](_0xf9c6('0x4a'),_0x3bbfc8['id']);return getEndUser(_0x11b925,_0x33f994['calleridname'],_0x33f994[_0xf9c6('0x68')]);})['then'](function(_0x3de9d4){_0x405e07=_0x3de9d4;logger['info'](_0xf9c6('0x4c'),_0x405e07['id']);return getTicket(_0x11b925,_0x3bbfc8,_0x405e07,_0x1d9a64,_0x33f994);})['then'](function(_0x4f68c9){if(_0x4f68c9){logger[_0xf9c6('0x19')](_0xf9c6('0x4d'),_0x4f68c9['id']);}})['catch'](function(_0x537237){logger[_0xf9c6('0x56')]('['+_0x33f994[_0xf9c6('0x66')][_0xf9c6('0x67')]()+']'+_0xf9c6('0x69'),util['inspect'](_0x537237,{'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 8fe126d..f50c088 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 _0x38fb=['Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','Call\x20created!','details','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','stripTrailingSlash','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','calleridnum','lodash','request-promise','./util','bluebird','../../../../config/environment','zoho','defaults','socket.io-emitter','emit','debug','length','forEach','includes','string','type','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','info','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime'];(function(_0x12f1ab,_0x2a41ef){var _0xdcaefb=function(_0x59e8a0){while(--_0x59e8a0){_0x12f1ab['push'](_0x12f1ab['shift']());}};_0xdcaefb(++_0x2a41ef);}(_0x38fb,0xd1));var _0xb38f=function(_0x481bdf,_0x231538){_0x481bdf=_0x481bdf-0x0;var _0x281a12=_0x38fb[_0x481bdf];return _0x281a12;};'use strict';var _=require(_0xb38f('0x0'));var rp=require(_0xb38f('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xb38f('0x2'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0xb38f('0x3'));var config=require(_0xb38f('0x4'));var logger=require('../../../../config/logger')(_0xb38f('0x5'));config['redis']=_[_0xb38f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb38f('0x7'))(new Redis(config['redis']));function emit(_0x13df71,_0x15f1a7,_0xff7687){io['to'](_0x13df71)[_0xb38f('0x8')](_0x15f1a7,_0xff7687);}function request(_0x4dd0c3){logger[_0xb38f('0x9')]('[HTTP]',JSON['stringify'](_0x4dd0c3));return rp(_0x4dd0c3);}function getCustomFields(_0x1bbb29,_0x2a62a5){var _0xff6c4f={};if(_0x1bbb29[_0xb38f('0xa')]>0x0){_[_0xb38f('0xb')](_0x1bbb29,function(_0x2fde02){if(_[_0xb38f('0xc')]([_0xb38f('0xd'),'picklist'],_0x2fde02[_0xb38f('0xe')])&&_0x2fde02[_0xb38f('0xf')]){_0xff6c4f[_0x2fde02[_0xb38f('0xf')]]=_0x2fde02['content']['toString']();}else if(_0x2fde02['type']===_0xb38f('0x10')&&_0x2fde02['variableName']&&_0x2fde02[_0xb38f('0xf')]&&_0x2a62a5[_0x2fde02[_0xb38f('0x11')]]){_0xff6c4f[_0x2fde02[_0xb38f('0xf')]]=_0x2a62a5[_0x2fde02[_0xb38f('0x11')]][_0xb38f('0x12')]();}else if(_0x2fde02['type']===_0xb38f('0x13')&&_0x2fde02[_0xb38f('0x14')]&&_0x2fde02[_0xb38f('0x14')][_0xb38f('0x15')]&&_0x2fde02['idField']&&_0x2a62a5[_0x2fde02[_0xb38f('0x14')][_0xb38f('0x15')][_0xb38f('0x16')]()]){_0xff6c4f[_0x2fde02['idField']]=_0x2a62a5[_0x2fde02[_0xb38f('0x14')]['name'][_0xb38f('0x16')]()][_0xb38f('0x12')]();}});}return _0xff6c4f;}function getName(_0x495469){if(_0x495469[_0xb38f('0x17')]('\x20')>0x0){var _0x9e1b59=_0x495469['split'](/ (.+)/);if(_0x9e1b59[0x1]){return _0x9e1b59;}}return[_0x495469,_0x495469];}var accountsTokens={};function getAccessToken(_0x393940){return new Promise(function(_0x6edaa,_0x12bd20){if(!_['isNil'](accountsTokens[_0x393940['id']])&&!_[_0xb38f('0x18')](accountsTokens[_0x393940['id']][_0xb38f('0x19')])){if(moment()[_0xb38f('0x1a')](accountsTokens[_0x393940['id']][_0xb38f('0x1b')])){_0x6edaa(accountsTokens[_0x393940['id']]['access_token']);}}var _0x514fd0;switch(_0x393940['zone']){case'US':_0x514fd0=_0xb38f('0x1c');break;case'AU':_0x514fd0=_0xb38f('0x1d');break;case'EU':_0x514fd0=_0xb38f('0x1e');break;case'IN':_0x514fd0=_0xb38f('0x1f');break;case'CN':_0x514fd0=_0xb38f('0x20');break;default:_0x514fd0=_0xb38f('0x1e');break;}var _0x446f02={'method':_0xb38f('0x21'),'uri':_0x514fd0+_0xb38f('0x22'),'qs':{'refresh_token':_0x393940['refreshToken'],'client_id':_0x393940[_0xb38f('0x23')],'client_secret':_0x393940['clientSecret'],'grant_type':_0xb38f('0x24')},'json':!![]};return rp(_0x446f02)[_0xb38f('0x25')](function(_0x2b226e){accountsTokens[_0x393940['id']]={'access_token':_0x2b226e['access_token'],'expires_in':moment()['add'](_0x2b226e[_0xb38f('0x1b')],_0xb38f('0x26'))};_0x6edaa(_0x2b226e[_0xb38f('0x19')]);})[_0xb38f('0x27')](function(_0x2b5996){logger['error'](_0xb38f('0x28'),_0x2b5996['stack']);_0x12bd20(_0x2b5996);});});}function getUser(_0x10aa00,_0x12242c,_0x4b49ac,_0x27c2f8){logger[_0xb38f('0x29')]('Search\x20user');return request({'method':'GET','uri':util[_0xb38f('0x2a')](_0xb38f('0x2b'),_0x12242c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xb38f('0x2c')+_0x10aa00},'json':!![]})[_0xb38f('0x25')](function(_0x495498){if(_0x495498[_0xb38f('0x2d')]){var _0x149b6c=-0x1;if(_['isArrayLikeObject'](_0x495498['users'])){if(!_[_0xb38f('0x18')](_0x27c2f8)){_0x149b6c=_[_0xb38f('0x2e')](_0x495498['users'],function(_0x3d5d1a){return _0x3d5d1a['email']===_0x27c2f8;});}if(_0x149b6c>=0x0){logger[_0xb38f('0x29')](_0xb38f('0x2f'));}else{logger[_0xb38f('0x29')](_0xb38f('0x30'));_0x149b6c=_['findIndex'](_0x495498[_0xb38f('0x2d')],function(_0x5ba676){return _0x5ba676[_0xb38f('0x31')]['name']===_0xb38f('0x32');});}return _0x495498['users'][_0x149b6c];}else{if(_0x495498[_0xb38f('0x33')]['profile'][_0xb38f('0x15')]==='Administrator'){logger[_0xb38f('0x29')](_0xb38f('0x30'));user=_0x495498[_0xb38f('0x33')];return user;}else{logger[_0xb38f('0x34')](_0xb38f('0x35'),JSON[_0xb38f('0x36')](_0x495498));throw new Error(_0xb38f('0x37')+JSON['stringify'](_0x495498));}}}else{logger[_0xb38f('0x34')](_0xb38f('0x35'),JSON[_0xb38f('0x36')](_0x495498));throw new Error(_0xb38f('0x37')+JSON[_0xb38f('0x36')](_0x495498));}})[_0xb38f('0x27')](function(_0x52fe1d){console['error'](_0x52fe1d);});}function getZohoUser(_0x4a4b4d,_0x4007db){return new BPromise(function(_0x26186f,_0x277d55){request(_0x4a4b4d)['then'](function(_0x240fdc){var _0x17d7a3=null;if(_0x240fdc){_0x17d7a3=_0x240fdc['data'][0x0];_0x17d7a3['enduserType']=_0x4007db;}_0x26186f(_0x17d7a3);})[_0xb38f('0x27')](function(_0x435c55){_0x277d55(_0x435c55);});});}function createEndUser(_0x4e4787,_0x58c0d9,_0x4f31b3,_0x7509c1,_0x4f618f,_0x4ca532){var _0x4f31b3=getName(_0x4f31b3);return request({'method':'POST','uri':_0xb38f('0x38')+_0x58c0d9+_0xb38f('0x39')+_['startCase'](_0x4ca532[_0xb38f('0x3a')])+'s','body':{'data':[{'Last_Name':_0x4f31b3[0x1],'First_Name':_0x4f31b3[0x0],'Phone':_0x7509c1,'Owner':{'name':!_[_0xb38f('0x18')](_0x4f618f[_0xb38f('0x3b')][_0xb38f('0x15')])?_0x4f618f[_0xb38f('0x3b')][_0xb38f('0x15')]:!_[_0xb38f('0x18')](_0x4f618f[_0xb38f('0x3c')])?_0x4f618f[_0xb38f('0x3c')]+'\x20'+_0x4f618f[_0xb38f('0x3d')]:_0x4f618f['last_name'],'id':_0x4f618f['id']}}]},'headers':{'Authorization':_0xb38f('0x2c')+_0x4e4787},'json':!![]})[_0xb38f('0x25')](function(_0x3120e1){if(_0x3120e1&&_0x3120e1[_0xb38f('0x3e')][0x0][_0xb38f('0x3f')]===_0xb38f('0x40')){var _0x59e5eb=_0x3120e1[_0xb38f('0x3e')][0x0]['details'];_0x59e5eb[_0xb38f('0x41')]=_[_0xb38f('0x42')](_0x4ca532[_0xb38f('0x3a')])+'s';return _0x59e5eb;}logger['error'](_0xb38f('0x35'),JSON['stringify'](data));throw new Error(_0xb38f('0x43')+JSON['stringify'](data));})['catch'](function(_0x3cf504){console[_0xb38f('0x44')](_0xb38f('0x45'),_0x3cf504);});}function getEndUser(_0x1e9730,_0x1a23d9,_0xf103e9,_0x53db0e,_0x2ed42e,_0x18b247,_0x55789c){var _0x1744e5={'method':_0xb38f('0x46'),'uri':'','headers':{'Authorization':_0xb38f('0x2c')+_0x1e9730},'json':!![]};switch(_0x55789c[_0xb38f('0x47')]){case _0xb38f('0x48'):_0x1744e5[_0xb38f('0x49')]='https://www.zohoapis.'+_0x1a23d9+_0xb38f('0x4a')+_0x2ed42e+'))';return getZohoUser(_0x1744e5,_0xb38f('0x4b'))[_0xb38f('0x25')](function(_0x171b65){if(_0x171b65)return _0x171b65;_0x1744e5[_0xb38f('0x49')]=_0xb38f('0x38')+_0x1a23d9+_0xb38f('0x4c')+_0x2ed42e+'))';return getZohoUser(_0x1744e5,_0xb38f('0x4d'))[_0xb38f('0x25')](function(_0x4237bd){if(_0x4237bd)return _0x4237bd;if(_0x55789c[_0xb38f('0x3a')]!=_0xb38f('0x4e')){return createEndUser(_0x1e9730,_0x1a23d9,_0x53db0e,_0x2ed42e,_0x18b247,_0x55789c);}else{return{};}});});break;case _0xb38f('0x4f'):_0x1744e5[_0xb38f('0x49')]=_0xb38f('0x38')+_0x1a23d9+_0xb38f('0x4a')+_0x2ed42e+'))';return getZohoUser(_0x1744e5,'Contacts')['then'](function(_0x51de25){if(_0x51de25)return _0x51de25;if(_0x55789c[_0xb38f('0x3a')]!=_0xb38f('0x4e')){return createEndUser(_0x1e9730,_0x1a23d9,_0x53db0e,_0x2ed42e,_0x18b247,_0x55789c);}else{return{};}});break;case'lead':_0x1744e5[_0xb38f('0x49')]=_0xb38f('0x38')+_0x1a23d9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ed42e+'))';return getZohoUser(_0x1744e5,_0xb38f('0x4d'))['then'](function(_0x1b4b7c){if(_0x1b4b7c)return _0x1b4b7c;if(_0x55789c[_0xb38f('0x3a')]!=_0xb38f('0x4e')){return createEndUser(_0x1e9730,_0x1a23d9,_0x53db0e,_0x2ed42e,_0x18b247,_0x55789c);}else{return{};}});break;}}function getCall(_0x195031,_0x4e7e79,_0x1b67a1,_0xc88892,_0x37f485,_0x3e3cc6,_0x3520de,_0xcba9fa){logger[_0xb38f('0x29')](_0xb38f('0x50'));var _0x55420d={};_0x55420d['Owner']={'name':!_[_0xb38f('0x18')](_0xc88892[_0xb38f('0x3b')]['name'])&&!_['isNil'](_0xc88892['profile']['name'])&&_0xc88892['profile'][_0xb38f('0x15')]===_0xb38f('0x51')?_0xc88892[_0xb38f('0x3b')][_0xb38f('0x15')]:!_[_0xb38f('0x18')](_0xc88892['first_name'])?_0xc88892['first_name']+'\x20'+_0xc88892[_0xb38f('0x3d')]:_0xc88892[_0xb38f('0x3d')],'id':_0xc88892['id']};_0x55420d[_0xb38f('0x52')]=intUtil[_0xb38f('0x53')](_0x3e3cc6[_0xb38f('0x54')],_0x3520de,'\x20');_0x55420d[_0xb38f('0x55')]=intUtil['getString'](_0x3e3cc6[_0xb38f('0x56')],_0x3520de,'\x0a');if(_0x37f485[_0xb38f('0x41')]===_0xb38f('0x4b')){_0x55420d['Who_Id']={'name':!_[_0xb38f('0x18')](_0x37f485[_0xb38f('0x57')])?_0x37f485[_0xb38f('0x57')]:!_[_0xb38f('0x18')](_0x37f485[_0xb38f('0x58')])?_0x37f485[_0xb38f('0x58')]+'\x20'+_0x37f485['Last_Name']:_0x37f485[_0xb38f('0x59')],'id':_0x37f485['id']};}if(_0x37f485[_0xb38f('0x41')]===_0xb38f('0x4d')){_0x55420d[_0xb38f('0x5a')]={'name':!_['isNil'](_0x37f485[_0xb38f('0x57')])?_0x37f485[_0xb38f('0x57')]:!_[_0xb38f('0x18')](_0x37f485[_0xb38f('0x58')])?_0x37f485['First_Name']+'\x20'+_0x37f485[_0xb38f('0x59')]:_0x37f485[_0xb38f('0x59')],'id':_0x37f485['id']};_0x55420d[_0xb38f('0x5b')]=_[_0xb38f('0x42')](_0x37f485['enduserType']);}if(_0x3520de[_0xb38f('0x5c')]){_0x55420d[_0xb38f('0x5d')]=moment[_0xb38f('0x5e')](parseInt(_0x3520de['talktime'])*0x3e8)[_0xb38f('0x2a')](_0xb38f('0x5f'));}else if(_0x3520de[_0xb38f('0x60')]&&_0x3520de[_0xb38f('0x61')]){_0x55420d[_0xb38f('0x5d')]=moment[_0xb38f('0x5e')](moment(_0x3520de[_0xb38f('0x61')],_0xb38f('0x62'))[_0xb38f('0x63')](moment(_0x3520de[_0xb38f('0x64')],_0xb38f('0x62'))))[_0xb38f('0x2a')](_0xb38f('0x5f'));}switch(_0x3520de[_0xb38f('0x65')]){case _0xb38f('0x66'):_0x55420d[_0xb38f('0x67')]='Called';break;case _0xb38f('0x68'):case _0xb38f('0x69'):_0x55420d[_0xb38f('0x67')]=_0xb38f('0x6a');break;case _0xb38f('0x6b'):_0x55420d[_0xb38f('0x67')]=_0xb38f('0x6c');break;case _0xb38f('0x6d'):_0x55420d['Call_Result']=_0xb38f('0x6e');break;case _0xb38f('0x6f'):_0x55420d['Call_Result']=_0xb38f('0x70');default:}_0x55420d[_0xb38f('0x71')]=(_0xcba9fa==='outbound'?moment(_0x3520de[_0xb38f('0x64')])[_0xb38f('0x2a')](_0xb38f('0x62')):moment(_0x3520de[_0xb38f('0x72')])[_0xb38f('0x2a')](_0xb38f('0x62')))||moment()[_0xb38f('0x2a')](_0xb38f('0x62'));_0x55420d[_0xb38f('0x73')]=_0xcba9fa||'Inbound';_0x55420d=_['merge'](_0x55420d,getCustomFields(_0x3e3cc6[_0xb38f('0x74')],_0x3520de));return request({'method':_0xb38f('0x21'),'uri':_0xb38f('0x38')+_0x4e7e79+_0xb38f('0x75'),'headers':{'Authorization':_0xb38f('0x2c')+_0x195031},'body':{'data':[_0x55420d]},'json':!![]})[_0xb38f('0x25')](function(_0x28a035){if(_0x28a035&&_0x28a035[_0xb38f('0x3e')][0x0]['code']===_0xb38f('0x40')){logger[_0xb38f('0x29')](_0xb38f('0x76'));return{'id':_0x28a035[_0xb38f('0x3e')][0x0][_0xb38f('0x77')]['id']};}})[_0xb38f('0x27')](function(_0x509748){logger[_0xb38f('0x29')]('err',_0x509748['stack']);console[_0xb38f('0x44')]('err',_0x509748);});}exports[_0xb38f('0x78')]=function(_0x3a796e,_0x299ba8,_0xf1bf37,_0x41f133,_0x117d98,_0x133998){var _0x13bbad,_0xc0b068,_0x34f8ed;_0x133998[_0xb38f('0x79')]=intUtil['stripTrailingSlash'](_0x133998[_0xb38f('0x79')]);_0x133998[_0xb38f('0x7a')]=intUtil['stripTrailingSlash'](_0x133998['serverUrl']);if(_0x117d98&&_0x117d98[_0xb38f('0x7b')]){logger[_0xb38f('0x29')](_0xb38f('0x7c'),_0xb38f('0x7d'));_0x299ba8[_0xb38f('0x7e')]=_0x133998[_0xb38f('0x7a')]+_0xb38f('0x7f')+_0x299ba8[_0xb38f('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x299ba8[_0xb38f('0x80')]);}else{_0x299ba8[_0xb38f('0x7e')]='';}var _0xe628ee=_0x133998[_0xb38f('0x79')]===_0xb38f('0x81')?'eu':_0xb38f('0x82');return getAccessToken(_0x133998)[_0xb38f('0x25')](function(_0x3d7e7f){_0x34f8ed=_0x3d7e7f;return getUser(_0x34f8ed,_0xe628ee,_0x133998,_0x41f133[_0xb38f('0x83')]);})['then'](function(_0x1b713a){_0x13bbad=_0x1b713a;logger[_0xb38f('0x29')](_0xb38f('0x84'),_0x13bbad['id']);return getEndUser(_0x34f8ed,_0xe628ee,_0x133998,_0x299ba8['calleridname'],_0x299ba8['calleridnum'],_0x13bbad,_0xf1bf37);})[_0xb38f('0x25')](function(_0x23316d){_0xc0b068=_0x23316d;return getCall(_0x34f8ed,_0xe628ee,_0x133998,_0x13bbad,_0xc0b068,_0xf1bf37,_0x299ba8,_0xb38f('0x85'));})[_0xb38f('0x25')](function(_0x41a2be){if(_0x41a2be){logger[_0xb38f('0x29')](_0xb38f('0x86'),_0x41a2be['id']);logger[_0xb38f('0x29')](_0xb38f('0x7c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb38f('0x87'),_0x41f133[_0xb38f('0x15')]),_0xb38f('0x88'),{'uri':'https://crm.'+_0x133998[_0xb38f('0x79')]+_0xb38f('0x89')+_0x41a2be['id']});}})[_0xb38f('0x27')](function(_0x4c3960){logger[_0xb38f('0x34')](_0xb38f('0x7c'),JSON[_0xb38f('0x36')](_0x4c3960));});};exports[_0xb38f('0x8a')]=function(_0x1cde3a,_0x1038ab,_0x3388ba,_0x5a1c4c,_0x2d14fe,_0x1219ba,_0x2783d6){var _0x148f65,_0x3c37e4,_0x370555;_0x1219ba['host']=intUtil[_0xb38f('0x8b')](_0x1219ba[_0xb38f('0x79')]);_0x1219ba[_0xb38f('0x7a')]=intUtil['stripTrailingSlash'](_0x1219ba[_0xb38f('0x7a')]);if(_0x2783d6&&_0x2783d6['recordingFormat']&&_0x2783d6['recordingFormat']!==_0xb38f('0x8c')){logger[_0xb38f('0x29')](_0xb38f('0x8d'),_0xb38f('0x7d'));_0x1038ab[_0xb38f('0x7e')]=_0x1219ba[_0xb38f('0x7a')]+_0xb38f('0x7f')+_0x1038ab[_0xb38f('0x80')]+_0xb38f('0x8e')+md5(_0x1038ab[_0xb38f('0x80')]);}var _0x7eb3d6=_0x1219ba[_0xb38f('0x79')]===_0xb38f('0x81')?'eu':'com';return getAccessToken(_0x1219ba)[_0xb38f('0x25')](function(_0x376c66){_0x370555=_0x376c66;return getUser(_0x370555,_0x7eb3d6,_0x1219ba,_0x5a1c4c[_0xb38f('0x83')]);})['then'](function(_0x673b23){_0x148f65=_0x673b23;logger[_0xb38f('0x29')](_0xb38f('0x84'),_0x148f65['id']);return getEndUser(_0x370555,_0x7eb3d6,_0x1219ba,_0x1038ab[_0xb38f('0x8f')],_0x1038ab[_0xb38f('0x90')],_0x148f65,_0x3388ba);})[_0xb38f('0x25')](function(_0xd37459){_0x3c37e4=_0xd37459;return getCall(_0x370555,_0x7eb3d6,_0x1219ba,_0x148f65,_0x3c37e4,_0x3388ba,_0x1038ab,_0xb38f('0x91'));})[_0xb38f('0x25')](function(_0xf67e21){if(_0xf67e21){logger[_0xb38f('0x29')](_0xb38f('0x86'),_0xf67e21['id']);logger[_0xb38f('0x29')](_0xb38f('0x8d'),_0xb38f('0x92'));emit(util[_0xb38f('0x2a')]('user:%s',_0x5a1c4c['name']),_0xb38f('0x88'),{'uri':'https://crm.'+_0x1219ba[_0xb38f('0x79')]+_0xb38f('0x89')+_0xf67e21['id']});}})[_0xb38f('0x27')](function(_0x51f7fb){logger[_0xb38f('0x34')](_0xb38f('0x8d'),JSON[_0xb38f('0x36')](_0x51f7fb));});};exports[_0xb38f('0x93')]=function(_0x164764,_0x44536c,_0x2efbec,_0x5b9455,_0x222f61,_0x101e46){var _0xfe541d,_0xfa0ac9,_0x25413b;_0x101e46['host']=intUtil[_0xb38f('0x8b')](_0x101e46['host']);_0x101e46[_0xb38f('0x7a')]=intUtil['stripTrailingSlash'](_0x101e46['serverUrl']);if(_0x222f61&&_0x222f61[_0xb38f('0x7b')]){logger[_0xb38f('0x29')]('['+_0x44536c[_0xb38f('0x65')][_0xb38f('0x94')]()+']','Recording\x20is\x20enabled!');_0x44536c[_0xb38f('0x7e')]=_0x101e46[_0xb38f('0x7a')]+_0xb38f('0x7f')+_0x44536c[_0xb38f('0x80')]+_0xb38f('0x8e')+md5(_0x44536c['uniqueid']);}else{_0x44536c[_0xb38f('0x7e')]='';}var _0x239d9e=_0x101e46[_0xb38f('0x79')]===_0xb38f('0x81')?'eu':_0xb38f('0x82');return getAccessToken(_0x101e46)[_0xb38f('0x25')](function(_0x306b95){_0x25413b=_0x306b95;return getUser(_0x25413b,_0x239d9e,_0x101e46);})[_0xb38f('0x25')](function(_0x575a95){_0xfe541d=_0x575a95;logger[_0xb38f('0x29')](_0xb38f('0x84'),_0xfe541d['id']);return getEndUser(_0x25413b,_0x239d9e,_0x101e46,_0x44536c[_0xb38f('0x95')],_0x44536c[_0xb38f('0x96')],_0xfe541d,_0x2efbec);})[_0xb38f('0x25')](function(_0x16bd51){_0xfa0ac9=_0x16bd51;return getCall(_0x25413b,_0x239d9e,_0x101e46,_0xfe541d,_0xfa0ac9,_0x2efbec,_0x44536c,_0xb38f('0x85'));})['then'](function(_0x3a4242){if(_0x3a4242){logger[_0xb38f('0x29')](_0xb38f('0x86'),_0x3a4242['id']);}})[_0xb38f('0x27')](function(_0x47d5a4){logger['error']('['+_0x44536c[_0xb38f('0x65')][_0xb38f('0x94')]()+']',JSON[_0xb38f('0x36')](_0x47d5a4));});}; \ No newline at end of file +var _0x422f=['Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','unmanaged','monitor_format','toUpperCase','request-promise','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Call\x20created!','err','host','stripTrailingSlash','serverUrl','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x422f,0x1c7));var _0xf422=function(_0x192f58,_0x79b210){_0x192f58=_0x192f58-0x0;var _0x86ebf5=_0x422f[_0x192f58];return _0x86ebf5;};'use strict';var _=require('lodash');var rp=require(_0xf422('0x0'));var md5=require('md5');var util=require(_0xf422('0x1'));var intUtil=require(_0xf422('0x2'));var moment=require('moment');var Redis=require(_0xf422('0x3'));var BPromise=require(_0xf422('0x4'));var config=require(_0xf422('0x5'));var logger=require(_0xf422('0x6'))(_0xf422('0x7'));config[_0xf422('0x8')]=_[_0xf422('0x9')](config[_0xf422('0x8')],{'host':_0xf422('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf422('0x8')]));function emit(_0x1037fa,_0xc2c9f5,_0x23a1bf){io['to'](_0x1037fa)[_0xf422('0xb')](_0xc2c9f5,_0x23a1bf);}function request(_0x5f02da){logger[_0xf422('0xc')]('[HTTP]',JSON['stringify'](_0x5f02da));return rp(_0x5f02da);}function getCustomFields(_0x85cccc,_0x39f67b){var _0x25cd31={};if(_0x85cccc[_0xf422('0xd')]>0x0){_[_0xf422('0xe')](_0x85cccc,function(_0x579838){if(_[_0xf422('0xf')]([_0xf422('0x10'),'picklist'],_0x579838[_0xf422('0x11')])&&_0x579838[_0xf422('0x12')]){_0x25cd31[_0x579838[_0xf422('0x12')]]=_0x579838[_0xf422('0x13')][_0xf422('0x14')]();}else if(_0x579838[_0xf422('0x11')]===_0xf422('0x15')&&_0x579838[_0xf422('0x16')]&&_0x579838[_0xf422('0x12')]&&_0x39f67b[_0x579838['variableName']]){_0x25cd31[_0x579838['idField']]=_0x39f67b[_0x579838['variableName']][_0xf422('0x14')]();}else if(_0x579838[_0xf422('0x11')]===_0xf422('0x17')&&_0x579838[_0xf422('0x18')]&&_0x579838['Variable'][_0xf422('0x19')]&&_0x579838[_0xf422('0x12')]&&_0x39f67b[_0x579838[_0xf422('0x18')][_0xf422('0x19')][_0xf422('0x1a')]()]){_0x25cd31[_0x579838[_0xf422('0x12')]]=_0x39f67b[_0x579838['Variable']['name'][_0xf422('0x1a')]()][_0xf422('0x14')]();}});}return _0x25cd31;}function getName(_0x215287){if(_0x215287['indexOf']('\x20')>0x0){var _0x1ea003=_0x215287['split'](/ (.+)/);if(_0x1ea003[0x1]){return _0x1ea003;}}return[_0x215287,_0x215287];}var accountsTokens={};function getAccessToken(_0x22afe7){return new Promise(function(_0x15833b,_0x36b7e7){if(!_['isNil'](accountsTokens[_0x22afe7['id']])&&!_[_0xf422('0x1b')](accountsTokens[_0x22afe7['id']][_0xf422('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x22afe7['id']]['expires_in'])){_0x15833b(accountsTokens[_0x22afe7['id']][_0xf422('0x1c')]);}}var _0x3cb26b;switch(_0x22afe7['zone']){case'US':_0x3cb26b=_0xf422('0x1d');break;case'AU':_0x3cb26b='https://accounts.zoho.com.au';break;case'EU':_0x3cb26b=_0xf422('0x1e');break;case'IN':_0x3cb26b=_0xf422('0x1f');break;case'CN':_0x3cb26b=_0xf422('0x20');break;default:_0x3cb26b=_0xf422('0x1e');break;}var _0x24d34d={'method':_0xf422('0x21'),'uri':_0x3cb26b+_0xf422('0x22'),'qs':{'refresh_token':_0x22afe7[_0xf422('0x23')],'client_id':_0x22afe7['clientId'],'client_secret':_0x22afe7[_0xf422('0x24')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x24d34d)[_0xf422('0x25')](function(_0x7d36e7){accountsTokens[_0x22afe7['id']]={'access_token':_0x7d36e7[_0xf422('0x1c')],'expires_in':moment()[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')],_0xf422('0x28'))};_0x15833b(_0x7d36e7[_0xf422('0x1c')]);})['catch'](function(_0x4eed61){logger[_0xf422('0x29')](_0xf422('0x2a'),_0x4eed61[_0xf422('0x2b')]);_0x36b7e7(_0x4eed61);});});}function getUser(_0x33ef63,_0xefb99e,_0x48e0c7,_0x6d22f1){logger[_0xf422('0x2c')]('Search\x20user');return request({'method':'GET','uri':util[_0xf422('0x2d')]('https://www.zohoapis.%s/crm/v2/users',_0xefb99e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf422('0x2e')+_0x33ef63},'json':!![]})[_0xf422('0x25')](function(_0x4a4e99){if(_0x4a4e99[_0xf422('0x2f')]){var _0x2f5b75=-0x1;if(_[_0xf422('0x30')](_0x4a4e99[_0xf422('0x2f')])){if(!_[_0xf422('0x1b')](_0x6d22f1)){_0x2f5b75=_['findIndex'](_0x4a4e99[_0xf422('0x2f')],function(_0x4f34cf){return _0x4f34cf[_0xf422('0x31')]===_0x6d22f1;});}if(_0x2f5b75>=0x0){logger[_0xf422('0x2c')](_0xf422('0x32'));}else{logger[_0xf422('0x2c')](_0xf422('0x33'));_0x2f5b75=_[_0xf422('0x34')](_0x4a4e99[_0xf422('0x2f')],function(_0x4a8bba){return _0x4a8bba['profile'][_0xf422('0x19')]===_0xf422('0x35');});}return _0x4a4e99['users'][_0x2f5b75];}else{if(_0x4a4e99[_0xf422('0x36')][_0xf422('0x37')][_0xf422('0x19')]===_0xf422('0x35')){logger[_0xf422('0x2c')](_0xf422('0x33'));user=_0x4a4e99[_0xf422('0x36')];return user;}else{logger[_0xf422('0x29')](_0xf422('0x38'),JSON[_0xf422('0x39')](_0x4a4e99));throw new Error(_0xf422('0x3a')+JSON[_0xf422('0x39')](_0x4a4e99));}}}else{logger[_0xf422('0x29')](_0xf422('0x38'),JSON['stringify'](_0x4a4e99));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x4a4e99));}})[_0xf422('0x3b')](function(_0x2ae7e1){console['error'](_0x2ae7e1);});}function getZohoUser(_0x186882,_0x53a952){return new BPromise(function(_0x774834,_0x2ca8b7){request(_0x186882)['then'](function(_0x42dc4d){var _0x4459d=null;if(_0x42dc4d){_0x4459d=_0x42dc4d[_0xf422('0x3c')][0x0];_0x4459d['enduserType']=_0x53a952;}_0x774834(_0x4459d);})[_0xf422('0x3b')](function(_0x56c98e){_0x2ca8b7(_0x56c98e);});});}function createEndUser(_0x567667,_0x5ccb53,_0x112bce,_0x293497,_0x2133a5,_0x3f874f){var _0x112bce=getName(_0x112bce);return request({'method':_0xf422('0x21'),'uri':_0xf422('0x3d')+_0x5ccb53+_0xf422('0x3e')+_['startCase'](_0x3f874f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x112bce[0x1],'First_Name':_0x112bce[0x0],'Phone':_0x293497,'Owner':{'name':!_[_0xf422('0x1b')](_0x2133a5[_0xf422('0x3f')][_0xf422('0x19')])?_0x2133a5[_0xf422('0x3f')][_0xf422('0x19')]:!_[_0xf422('0x1b')](_0x2133a5['first_name'])?_0x2133a5[_0xf422('0x40')]+'\x20'+_0x2133a5['last_name']:_0x2133a5[_0xf422('0x41')],'id':_0x2133a5['id']}}]},'headers':{'Authorization':_0xf422('0x2e')+_0x567667},'json':!![]})['then'](function(_0x3c9b0d){if(_0x3c9b0d&&_0x3c9b0d[_0xf422('0x3c')][0x0][_0xf422('0x42')]===_0xf422('0x43')){var _0x1658d0=_0x3c9b0d['data'][0x0][_0xf422('0x44')];_0x1658d0[_0xf422('0x45')]=_[_0xf422('0x46')](_0x3f874f[_0xf422('0x47')])+'s';return _0x1658d0;}logger[_0xf422('0x29')]('The\x20failing\x20result\x20is',JSON[_0xf422('0x39')](data));throw new Error(_0xf422('0x48')+JSON['stringify'](data));})[_0xf422('0x3b')](function(_0x59ab8d){console[_0xf422('0x49')](_0xf422('0x4a'),_0x59ab8d);});}function getEndUser(_0x34adbf,_0x26556f,_0x45a60d,_0x4c0cc3,_0x25343e,_0xd77d9,_0x2ad164){var _0x310299={'method':_0xf422('0x4b'),'uri':'','headers':{'Authorization':_0xf422('0x2e')+_0x34adbf},'json':!![]};switch(_0x2ad164[_0xf422('0x4c')]){case _0xf422('0x4d'):_0x310299[_0xf422('0x4e')]='https://www.zohoapis.'+_0x26556f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x25343e+'))';return getZohoUser(_0x310299,_0xf422('0x4f'))[_0xf422('0x25')](function(_0x3452a8){if(_0x3452a8)return _0x3452a8;_0x310299['uri']=_0xf422('0x3d')+_0x26556f+_0xf422('0x50')+_0x25343e+'))';return getZohoUser(_0x310299,_0xf422('0x51'))[_0xf422('0x25')](function(_0x1f3a30){if(_0x1f3a30)return _0x1f3a30;if(_0x2ad164[_0xf422('0x47')]!=_0xf422('0x52')){return createEndUser(_0x34adbf,_0x26556f,_0x4c0cc3,_0x25343e,_0xd77d9,_0x2ad164);}else{return{};}});});break;case'contact':_0x310299[_0xf422('0x4e')]='https://www.zohoapis.'+_0x26556f+_0xf422('0x53')+_0x25343e+'))';return getZohoUser(_0x310299,_0xf422('0x4f'))['then'](function(_0x3391b5){if(_0x3391b5)return _0x3391b5;if(_0x2ad164[_0xf422('0x47')]!=_0xf422('0x52')){return createEndUser(_0x34adbf,_0x26556f,_0x4c0cc3,_0x25343e,_0xd77d9,_0x2ad164);}else{return{};}});break;case _0xf422('0x54'):_0x310299[_0xf422('0x4e')]='https://www.zohoapis.'+_0x26556f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x25343e+'))';return getZohoUser(_0x310299,_0xf422('0x51'))['then'](function(_0x4429c6){if(_0x4429c6)return _0x4429c6;if(_0x2ad164[_0xf422('0x47')]!=_0xf422('0x52')){return createEndUser(_0x34adbf,_0x26556f,_0x4c0cc3,_0x25343e,_0xd77d9,_0x2ad164);}else{return{};}});break;}}function getCall(_0x165706,_0x4b4de4,_0x4b8b1f,_0x44448c,_0xe333b8,_0x46a200,_0xddcd6c,_0x2b640a){logger[_0xf422('0x2c')]('Creating\x20new\x20call...');var _0x315e79={};_0x315e79['Owner']={'name':!_[_0xf422('0x1b')](_0x44448c[_0xf422('0x3f')][_0xf422('0x19')])&&!_[_0xf422('0x1b')](_0x44448c['profile']['name'])&&_0x44448c[_0xf422('0x37')][_0xf422('0x19')]===_0xf422('0x55')?_0x44448c[_0xf422('0x3f')][_0xf422('0x19')]:!_[_0xf422('0x1b')](_0x44448c[_0xf422('0x40')])?_0x44448c['first_name']+'\x20'+_0x44448c[_0xf422('0x41')]:_0x44448c[_0xf422('0x41')],'id':_0x44448c['id']};_0x315e79[_0xf422('0x56')]=intUtil[_0xf422('0x57')](_0x46a200[_0xf422('0x58')],_0xddcd6c,'\x20');_0x315e79[_0xf422('0x59')]=intUtil[_0xf422('0x57')](_0x46a200[_0xf422('0x5a')],_0xddcd6c,'\x0a');if(_0xe333b8[_0xf422('0x45')]===_0xf422('0x4f')){_0x315e79['Who_Id']={'name':!_[_0xf422('0x1b')](_0xe333b8[_0xf422('0x5b')])?_0xe333b8[_0xf422('0x5b')]:!_[_0xf422('0x1b')](_0xe333b8[_0xf422('0x5c')])?_0xe333b8['First_Name']+'\x20'+_0xe333b8[_0xf422('0x5d')]:_0xe333b8[_0xf422('0x5d')],'id':_0xe333b8['id']};}if(_0xe333b8['enduserType']===_0xf422('0x51')){_0x315e79[_0xf422('0x5e')]={'name':!_[_0xf422('0x1b')](_0xe333b8[_0xf422('0x5b')])?_0xe333b8[_0xf422('0x5b')]:!_[_0xf422('0x1b')](_0xe333b8[_0xf422('0x5c')])?_0xe333b8['First_Name']+'\x20'+_0xe333b8[_0xf422('0x5d')]:_0xe333b8[_0xf422('0x5d')],'id':_0xe333b8['id']};_0x315e79[_0xf422('0x5f')]=_['startCase'](_0xe333b8[_0xf422('0x45')]);}if(_0xddcd6c[_0xf422('0x60')]){_0x315e79[_0xf422('0x61')]=moment[_0xf422('0x62')](parseInt(_0xddcd6c[_0xf422('0x60')])*0x3e8)[_0xf422('0x2d')](_0xf422('0x63'));}else if(_0xddcd6c[_0xf422('0x64')]&&_0xddcd6c[_0xf422('0x65')]){_0x315e79[_0xf422('0x61')]=moment[_0xf422('0x62')](moment(_0xddcd6c[_0xf422('0x65')],_0xf422('0x66'))[_0xf422('0x67')](moment(_0xddcd6c[_0xf422('0x68')],_0xf422('0x66'))))[_0xf422('0x2d')](_0xf422('0x63'));}switch(_0xddcd6c[_0xf422('0x69')]){case'called':_0x315e79['Call_Result']=_0xf422('0x6a');break;case'complete':case _0xf422('0x6b'):_0x315e79[_0xf422('0x6c')]=_0xf422('0x6d');break;case _0xf422('0x6e'):_0x315e79['Call_Result']=_0xf422('0x6f');break;case _0xf422('0x70'):_0x315e79[_0xf422('0x6c')]='Abandoned';break;case'timeout':_0x315e79[_0xf422('0x6c')]=_0xf422('0x71');default:}_0x315e79[_0xf422('0x72')]=(_0x2b640a===_0xf422('0x73')?moment(_0xddcd6c['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0xddcd6c[_0xf422('0x74')])[_0xf422('0x2d')](_0xf422('0x66')))||moment()[_0xf422('0x2d')](_0xf422('0x66'));_0x315e79[_0xf422('0x75')]=_0x2b640a||_0xf422('0x76');_0x315e79=_['merge'](_0x315e79,getCustomFields(_0x46a200['Fields'],_0xddcd6c));return request({'method':'POST','uri':_0xf422('0x3d')+_0x4b4de4+'/crm/v2/Calls','headers':{'Authorization':_0xf422('0x2e')+_0x165706},'body':{'data':[_0x315e79]},'json':!![]})[_0xf422('0x25')](function(_0x5d7291){if(_0x5d7291&&_0x5d7291[_0xf422('0x3c')][0x0][_0xf422('0x42')]===_0xf422('0x43')){logger['info'](_0xf422('0x77'));return{'id':_0x5d7291[_0xf422('0x3c')][0x0]['details']['id']};}})[_0xf422('0x3b')](function(_0x18982b){logger[_0xf422('0x2c')](_0xf422('0x78'),_0x18982b[_0xf422('0x2b')]);console[_0xf422('0x49')](_0xf422('0x78'),_0x18982b);});}exports['queue']=function(_0x1d2ca8,_0x2d0025,_0x33c2df,_0x503660,_0x5c18a2,_0x43d397){var _0x441fd4,_0x334317,_0x22acb6;_0x43d397[_0xf422('0x79')]=intUtil[_0xf422('0x7a')](_0x43d397['host']);_0x43d397[_0xf422('0x7b')]=intUtil[_0xf422('0x7a')](_0x43d397[_0xf422('0x7b')]);if(_0x5c18a2&&_0x5c18a2['monitor_format']){logger[_0xf422('0x2c')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2d0025[_0xf422('0x7c')]=_0x43d397['serverUrl']+_0xf422('0x7d')+_0x2d0025[_0xf422('0x7e')]+_0xf422('0x7f')+md5(_0x2d0025[_0xf422('0x7e')]);}else{_0x2d0025[_0xf422('0x7c')]='';}var _0x5b9aca=_0x43d397[_0xf422('0x79')]===_0xf422('0x80')?'eu':_0xf422('0x81');return getAccessToken(_0x43d397)['then'](function(_0x535814){_0x22acb6=_0x535814;return getUser(_0x22acb6,_0x5b9aca,_0x43d397,_0x503660[_0xf422('0x31')]);})['then'](function(_0xeabbf5){_0x441fd4=_0xeabbf5;logger['info'](_0xf422('0x82'),_0x441fd4['id']);return getEndUser(_0x22acb6,_0x5b9aca,_0x43d397,_0x2d0025[_0xf422('0x83')],_0x2d0025['calleridnum'],_0x441fd4,_0x33c2df);})[_0xf422('0x25')](function(_0x30fe43){_0x334317=_0x30fe43;return getCall(_0x22acb6,_0x5b9aca,_0x43d397,_0x441fd4,_0x334317,_0x33c2df,_0x2d0025,'Inbound');})[_0xf422('0x25')](function(_0x4031ec){if(_0x4031ec){logger[_0xf422('0x2c')](_0xf422('0x84'),_0x4031ec['id']);logger['info'](_0xf422('0x85'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf422('0x2d')](_0xf422('0x86'),_0x503660[_0xf422('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x43d397[_0xf422('0x79')]+_0xf422('0x87')+_0x4031ec['id']});}})['catch'](function(_0x108892){logger['error'](_0xf422('0x85'),JSON['stringify'](_0x108892));});};exports['outbound']=function(_0x2126ce,_0x31ceb3,_0x1ca249,_0x309e85,_0x2c370b,_0x1187c,_0x152e7c){var _0x2a6300,_0x5b148c,_0x309e04;_0x1187c[_0xf422('0x79')]=intUtil[_0xf422('0x7a')](_0x1187c[_0xf422('0x79')]);_0x1187c[_0xf422('0x7b')]=intUtil['stripTrailingSlash'](_0x1187c[_0xf422('0x7b')]);if(_0x152e7c&&_0x152e7c[_0xf422('0x88')]&&_0x152e7c[_0xf422('0x88')]!==_0xf422('0x89')){logger[_0xf422('0x2c')]('[OUTBOUND]',_0xf422('0x8a'));_0x31ceb3['recordingURL']=_0x1187c[_0xf422('0x7b')]+_0xf422('0x7d')+_0x31ceb3[_0xf422('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x31ceb3[_0xf422('0x7e')]);}var _0x42f697=_0x1187c[_0xf422('0x79')]===_0xf422('0x80')?'eu':'com';return getAccessToken(_0x1187c)['then'](function(_0x5067ba){_0x309e04=_0x5067ba;return getUser(_0x309e04,_0x42f697,_0x1187c,_0x309e85['email']);})[_0xf422('0x25')](function(_0xafb53){_0x2a6300=_0xafb53;logger['info'](_0xf422('0x82'),_0x2a6300['id']);return getEndUser(_0x309e04,_0x42f697,_0x1187c,_0x31ceb3[_0xf422('0x8b')],_0x31ceb3[_0xf422('0x8c')],_0x2a6300,_0x1ca249);})[_0xf422('0x25')](function(_0x1f5b89){_0x5b148c=_0x1f5b89;return getCall(_0x309e04,_0x42f697,_0x1187c,_0x2a6300,_0x5b148c,_0x1ca249,_0x31ceb3,_0xf422('0x8d'));})['then'](function(_0x18c28c){if(_0x18c28c){logger[_0xf422('0x2c')]('The\x20Call\x20ID\x20is:',_0x18c28c['id']);logger[_0xf422('0x2c')](_0xf422('0x8e'),_0xf422('0x8f'));emit(util[_0xf422('0x2d')]('user:%s',_0x309e85[_0xf422('0x19')]),_0xf422('0x90'),{'uri':_0xf422('0x91')+_0x1187c[_0xf422('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x18c28c['id']});}})[_0xf422('0x3b')](function(_0xc71bd9){logger['error'](_0xf422('0x8e'),JSON[_0xf422('0x39')](_0xc71bd9));});};exports[_0xf422('0x92')]=function(_0x4027bc,_0x3ee1e8,_0x424b07,_0x43fe39,_0x22e8f8,_0x163cbb){var _0x3035f9,_0x2278d1,_0x1729ae;_0x163cbb[_0xf422('0x79')]=intUtil[_0xf422('0x7a')](_0x163cbb[_0xf422('0x79')]);_0x163cbb[_0xf422('0x7b')]=intUtil['stripTrailingSlash'](_0x163cbb[_0xf422('0x7b')]);if(_0x22e8f8&&_0x22e8f8[_0xf422('0x93')]){logger[_0xf422('0x2c')]('['+_0x3ee1e8[_0xf422('0x69')][_0xf422('0x94')]()+']',_0xf422('0x8a'));_0x3ee1e8[_0xf422('0x7c')]=_0x163cbb[_0xf422('0x7b')]+'/api/voice/recordings/'+_0x3ee1e8[_0xf422('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x3ee1e8['uniqueid']);}else{_0x3ee1e8[_0xf422('0x7c')]='';}var _0xd3bfe=_0x163cbb['host']==='zoho.eu'?'eu':_0xf422('0x81');return getAccessToken(_0x163cbb)[_0xf422('0x25')](function(_0x19d3cb){_0x1729ae=_0x19d3cb;return getUser(_0x1729ae,_0xd3bfe,_0x163cbb);})['then'](function(_0x2fa0cf){_0x3035f9=_0x2fa0cf;logger[_0xf422('0x2c')](_0xf422('0x82'),_0x3035f9['id']);return getEndUser(_0x1729ae,_0xd3bfe,_0x163cbb,_0x3ee1e8[_0xf422('0x83')],_0x3ee1e8['calleridnum'],_0x3035f9,_0x424b07);})[_0xf422('0x25')](function(_0x38c5b6){_0x2278d1=_0x38c5b6;return getCall(_0x1729ae,_0xd3bfe,_0x163cbb,_0x3035f9,_0x2278d1,_0x424b07,_0x3ee1e8,_0xf422('0x76'));})[_0xf422('0x25')](function(_0x161722){if(_0x161722){logger[_0xf422('0x2c')]('The\x20Call\x20ID\x20is:',_0x161722['id']);}})[_0xf422('0x3b')](function(_0x55ab44){logger[_0xf422('0x29')]('['+_0x3ee1e8[_0xf422('0x69')][_0xf422('0x94')]()+']',JSON[_0xf422('0x39')](_0x55ab44));});}; \ 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 3578a53..652153a 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 _0x7346=['exec','data2','Script','render','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7346,0x171));var _0x6734=function(_0x401266,_0x35e755){_0x401266=_0x401266-0x0;var _0x60a25e=_0x7346[_0x401266];return _0x60a25e;};'use strict';var util=require('util');var sh=require(_0x6734('0x0'));var Mustache=require(_0x6734('0x1'));var logger=require(_0x6734('0x2'))('trigger');exports[_0x6734('0x3')]=function(_0x27c5dd,_0x306a64){var _0x300a5f=_0x27c5dd['data2']?_0x27c5dd[_0x6734('0x4')]:_0x6734('0x5');var _0x1e4b81=_0x27c5dd['data3']?Mustache[_0x6734('0x6')](_0x27c5dd[_0x6734('0x7')],_0x306a64):_0x306a64;sh['exec'](_0x1e4b81,function(_0x4fca3a,_0x2371f2,_0x36bc63){if(_0x4fca3a!==0x0){logger[_0x6734('0x8')](util[_0x6734('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x300a5f,_0x1e4b81,_0x4fca3a,_0x36bc63));}else{logger[_0x6734('0xa')](util[_0x6734('0x9')](_0x6734('0xb'),_0x300a5f,_0x1e4b81,_0x2371f2));}});}; \ No newline at end of file +var _0xe810=['trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','shelljs','mustache','../../../../config/logger'];(function(_0x52945b,_0x103a28){var _0x3820e6=function(_0x4a231f){while(--_0x4a231f){_0x52945b['push'](_0x52945b['shift']());}};_0x3820e6(++_0x103a28);}(_0xe810,0x152));var _0x0e81=function(_0x5264bd,_0x532efa){_0x5264bd=_0x5264bd-0x0;var _0x49eb50=_0xe810[_0x5264bd];return _0x49eb50;};'use strict';var util=require('util');var sh=require(_0x0e81('0x0'));var Mustache=require(_0x0e81('0x1'));var logger=require(_0x0e81('0x2'))(_0x0e81('0x3'));exports[_0x0e81('0x4')]=function(_0x4b3ae8,_0x32a6e2){var _0x488d0c=_0x4b3ae8[_0x0e81('0x5')]?_0x4b3ae8[_0x0e81('0x5')]:_0x0e81('0x6');var _0x12655d=_0x4b3ae8['data3']?Mustache['render'](_0x4b3ae8[_0x0e81('0x7')],_0x32a6e2):_0x32a6e2;sh['exec'](_0x12655d,function(_0x302bd2,_0x532eaa,_0x22cb69){if(_0x302bd2!==0x0){logger[_0x0e81('0x8')](util[_0x0e81('0x9')](_0x0e81('0xa'),_0x488d0c,_0x12655d,_0x302bd2,_0x22cb69));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x488d0c,_0x12655d,_0x532eaa));}});}; \ 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 5394da2..277f21c 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 _0x8e4e=['data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET','POST'];(function(_0x1ac594,_0x25bd10){var _0x280e8a=function(_0x4b084d){while(--_0x4b084d){_0x1ac594['push'](_0x1ac594['shift']());}};_0x280e8a(++_0x25bd10);}(_0x8e4e,0x179));var _0xe8e4=function(_0x321fbe,_0x3198f3){_0x321fbe=_0x321fbe-0x0;var _0x2ec342=_0x8e4e[_0x321fbe];return _0x2ec342;};'use strict';var rp=require(_0xe8e4('0x0'));var util=require(_0xe8e4('0x1'));var _=require(_0xe8e4('0x2'));var Mustache=require(_0xe8e4('0x3'));var logger=require(_0xe8e4('0x4'))(_0xe8e4('0x5'));exports['exec']=function(_0xe2a435,_0x4e081d){var _0x574ef6,_0x2c0439;var _0x57aea0={'method':_0xe2a435[_0xe8e4('0x6')][_0xe8e4('0x7')](),'uri':Mustache[_0xe8e4('0x8')](_0xe2a435[_0xe8e4('0x9')],_0x4e081d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xe2a435[_0xe8e4('0xa')])===_0xe8e4('0xb')&&parseInt(_0xe2a435[_0xe8e4('0xa')])>=0x1&&parseInt(_0xe2a435['data5'])<=0xa?parseInt(_0xe2a435[_0xe8e4('0xa')])*0x3e8:0x5*0x3e8};try{_0x57aea0[_0xe8e4('0xc')]=_0xe2a435[_0xe8e4('0xd')]?JSON[_0xe8e4('0xe')](Mustache['render'](_0xe2a435[_0xe8e4('0xd')],_0x4e081d)):{};}catch(_0x121c8c){logger[_0xe8e4('0xf')](_0x121c8c[_0xe8e4('0x10')]);}switch(_0xe2a435['data1'][_0xe8e4('0x7')]()){case _0xe8e4('0x11'):case'DELETE':_0x574ef6=null;_0x57aea0['qs']=_0x4e081d;break;case _0xe8e4('0x12'):case'PUT':if(_0xe2a435[_0xe8e4('0x13')]){try{_0x574ef6=JSON[_0xe8e4('0xe')](Mustache[_0xe8e4('0x8')](_0xe2a435[_0xe8e4('0x13')],_0x4e081d));_0x57aea0[_0xe8e4('0x14')]=_0x574ef6;}catch(_0x1710a2){logger[_0xe8e4('0xf')](_0x1710a2['stack']);logger[_0xe8e4('0xf')](_0xe8e4('0x15'));}}else{_0x574ef6=_0x4e081d;_0x57aea0[_0xe8e4('0x14')]=_0x574ef6;}break;}logger[_0xe8e4('0x16')](util[_0xe8e4('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xe2a435[_0xe8e4('0x6')],_0xe2a435['data2'],JSON[_0xe8e4('0x18')](_0x57aea0)));rp(_0x57aea0)[_0xe8e4('0x19')](function(_0x59b00f){_0x574ef6=!_[_0xe8e4('0x1a')](_0x574ef6)?_0xe8e4('0x1b')+_0x574ef6:'';_0x2c0439=typeof _0x59b00f[_0xe8e4('0x14')]===_0xe8e4('0x1c')?JSON[_0xe8e4('0x18')](_0x59b00f[_0xe8e4('0x14')]):_0x59b00f['body'];logger[_0xe8e4('0x16')](util[_0xe8e4('0x17')](_0xe8e4('0x1d'),_0xe2a435[_0xe8e4('0x6')],_0xe2a435[_0xe8e4('0x9')],_0x59b00f[_0xe8e4('0x1e')],_0x2c0439));})[_0xe8e4('0x1f')](function(_0x2aa1e4){logger[_0xe8e4('0xf')](util[_0xe8e4('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xe2a435[_0xe8e4('0x6')],_0xe2a435[_0xe8e4('0x9')],_0x2aa1e4[_0xe8e4('0x1e')],_0x2aa1e4[_0xe8e4('0x20')],_0x2aa1e4['message']));});}; \ No newline at end of file +var _0xdde1=['stack','data1','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','isNil','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5','number','headers','data6','parse','error'];(function(_0xf70879,_0x1bc27b){var _0x5278c6=function(_0x3f8857){while(--_0x3f8857){_0xf70879['push'](_0xf70879['shift']());}};_0x5278c6(++_0x1bc27b);}(_0xdde1,0x1b9));var _0x1dde=function(_0x2794e4,_0x11bcf6){_0x2794e4=_0x2794e4-0x0;var _0xf860d4=_0xdde1[_0x2794e4];return _0xf860d4;};'use strict';var rp=require(_0x1dde('0x0'));var util=require(_0x1dde('0x1'));var _=require(_0x1dde('0x2'));var Mustache=require(_0x1dde('0x3'));var logger=require(_0x1dde('0x4'))('trigger');exports[_0x1dde('0x5')]=function(_0x22b64e,_0xcf2d7e){var _0x44f4b6,_0x53c290;var _0x525ef6={'method':_0x22b64e['data1'][_0x1dde('0x6')](),'uri':Mustache[_0x1dde('0x7')](_0x22b64e['data2'],_0xcf2d7e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x22b64e[_0x1dde('0x8')])===_0x1dde('0x9')&&parseInt(_0x22b64e[_0x1dde('0x8')])>=0x1&&parseInt(_0x22b64e[_0x1dde('0x8')])<=0xa?parseInt(_0x22b64e[_0x1dde('0x8')])*0x3e8:0x5*0x3e8};try{_0x525ef6[_0x1dde('0xa')]=_0x22b64e[_0x1dde('0xb')]?JSON[_0x1dde('0xc')](Mustache[_0x1dde('0x7')](_0x22b64e['data6'],_0xcf2d7e)):{};}catch(_0x1ce10a){logger[_0x1dde('0xd')](_0x1ce10a[_0x1dde('0xe')]);}switch(_0x22b64e[_0x1dde('0xf')][_0x1dde('0x6')]()){case _0x1dde('0x10'):case _0x1dde('0x11'):_0x44f4b6=null;_0x525ef6['qs']=_0xcf2d7e;break;case _0x1dde('0x12'):case _0x1dde('0x13'):if(_0x22b64e['data7']){try{_0x44f4b6=JSON['parse'](Mustache[_0x1dde('0x7')](_0x22b64e[_0x1dde('0x14')],_0xcf2d7e));_0x525ef6[_0x1dde('0x15')]=_0x44f4b6;}catch(_0x551088){logger['error'](_0x551088[_0x1dde('0xe')]);logger['error'](_0x1dde('0x16'));}}else{_0x44f4b6=_0xcf2d7e;_0x525ef6[_0x1dde('0x15')]=_0x44f4b6;}break;}logger['info'](util[_0x1dde('0x17')](_0x1dde('0x18'),_0x22b64e['data1'],_0x22b64e[_0x1dde('0x19')],JSON['stringify'](_0x525ef6)));rp(_0x525ef6)['then'](function(_0x9aef4b){_0x44f4b6=!_[_0x1dde('0x1a')](_0x44f4b6)?',\x20request\x20body:\x20'+_0x44f4b6:'';_0x53c290=typeof _0x9aef4b['body']===_0x1dde('0x1b')?JSON[_0x1dde('0x1c')](_0x9aef4b[_0x1dde('0x15')]):_0x9aef4b['body'];logger[_0x1dde('0x1d')](util[_0x1dde('0x17')](_0x1dde('0x1e'),_0x22b64e[_0x1dde('0xf')],_0x22b64e[_0x1dde('0x19')],_0x9aef4b['statusCode'],_0x53c290));})[_0x1dde('0x1f')](function(_0x56fed5){logger[_0x1dde('0xd')](util[_0x1dde('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x22b64e[_0x1dde('0xf')],_0x22b64e['data2'],_0x56fed5[_0x1dde('0x20')],_0x56fed5[_0x1dde('0x21')],_0x56fed5[_0x1dde('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3cf5a48..711fa1b 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 _0xc3cc=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0x31556e,_0x5428ae){var _0x4486b1=function(_0x5583a7){while(--_0x5583a7){_0x31556e['push'](_0x31556e['shift']());}};_0x4486b1(++_0x5428ae);}(_0xc3cc,0x9f));var _0xcc3c=function(_0x53263b,_0x299c08){_0x53263b=_0x53263b-0x0;var _0x3fd94b=_0xc3cc[_0x53263b];return _0x3fd94b;};'use strict';var jayson=require(_0xcc3c('0x0'));var BPromise=require('bluebird');var logger=require(_0xcc3c('0x1'))('routing');var client=jayson[_0xcc3c('0x2')][_0xcc3c('0x3')]({'port':0x2329});client[_0xcc3c('0x4')]=function(_0x5b9151,_0x562005){return new BPromise(function(_0x48926f,_0x287ae9){return client[_0xcc3c('0x5')](_0x5b9151,_0x562005)[_0xcc3c('0x6')](function(_0x4e4d47){logger[_0xcc3c('0x7')](_0xcc3c('0x8'),_0xcc3c('0x9'),_0x5b9151,_0x562005,_0x4e4d47);if(_0x4e4d47[_0xcc3c('0xa')]){logger[_0xcc3c('0xa')](_0xcc3c('0x8'),_0xcc3c('0x9'),_0x5b9151,_0x4e4d47[_0xcc3c('0xa')][_0xcc3c('0xb')],_0x562005);return _0x287ae9(_0x4e4d47[_0xcc3c('0xa')]['message']);}else{return _0x48926f(_0x4e4d47[_0xcc3c('0xc')]);}})[_0xcc3c('0xd')](function(_0x59cf10){logger[_0xcc3c('0xa')]('rpc',_0xcc3c('0x9'),_0x5b9151,_0x59cf10,_0x562005);return _0x287ae9(_0x59cf10);});});};module[_0xcc3c('0xe')]=client; \ No newline at end of file +var _0xff8c=['../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','message','result','catch','exports'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0xff8c,0x70));var _0xcff8=function(_0x1440d9,_0x4a2c7e){_0x1440d9=_0x1440d9-0x0;var _0x4a0cfb=_0xff8c[_0x1440d9];return _0x4a0cfb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xcff8('0x0'))(_0xcff8('0x1'));var client=jayson[_0xcff8('0x2')][_0xcff8('0x3')]({'port':0x2329});client[_0xcff8('0x4')]=function(_0x32c7fa,_0x4a37a6){return new BPromise(function(_0x527524,_0x3fea1e){return client[_0xcff8('0x5')](_0x32c7fa,_0x4a37a6)[_0xcff8('0x6')](function(_0xab1ce9){logger[_0xcff8('0x7')]('rpc',_0xcff8('0x1'),_0x32c7fa,_0x4a37a6,_0xab1ce9);if(_0xab1ce9[_0xcff8('0x8')]){logger[_0xcff8('0x8')](_0xcff8('0x9'),_0xcff8('0x1'),_0x32c7fa,_0xab1ce9['error'][_0xcff8('0xa')],_0x4a37a6);return _0x3fea1e(_0xab1ce9[_0xcff8('0x8')][_0xcff8('0xa')]);}else{return _0x527524(_0xab1ce9[_0xcff8('0xb')]);}})[_0xcff8('0xc')](function(_0x38887d){logger[_0xcff8('0x8')](_0xcff8('0x9'),_0xcff8('0x1'),_0x32c7fa,_0x38887d,_0x4a37a6);return _0x3fea1e(_0x38887d);});});};module[_0xcff8('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index aacedec..a0a748b 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 _0x9dac=['./rpc/setting','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','error','./server','./realtime','./rpc/mailAccount'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9dac,0x1aa));var _0xc9da=function(_0x54acf9,_0x108191){_0x54acf9=_0x54acf9-0x0;var _0x425b97=_0x9dac[_0x54acf9];return _0x425b97;};'use strict';var server=require(_0xc9da('0x0'));var Realtime=require(_0xc9da('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc9da('0x2'));var setting=require(_0xc9da('0x3'));var logger=require('../../config/logger')(_0xc9da('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc9da('0x5')]()[_0xc9da('0x6')](mailAccount[_0xc9da('0x7')]())[_0xc9da('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xc9da('0x8')](realtime[_0xc9da('0x9')]);return realtime;});}function main(){return server[_0xc9da('0xa')](realtime,email)[_0xc9da('0x6')](function(){return initRealtime();})[_0xc9da('0x6')](function(){return setting['getSettings']();})[_0xc9da('0x6')](function(_0x311b83){return setInterval(initRealtime,_0x311b83[_0xc9da('0xb')]*0x3e8);})['catch'](function(_0x47b674){logger[_0xc9da('0xc')]('Email\x20service\x20initialization',_0x47b674);});}main(); \ No newline at end of file +var _0xe711=['./lib/email','./rpc/mailAccount','../../config/logger','email','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x950c48,_0x3acdaf){var _0x20398c=function(_0x1c5aa8){while(--_0x1c5aa8){_0x950c48['push'](_0x950c48['shift']());}};_0x20398c(++_0x3acdaf);}(_0xe711,0xcf));var _0x1e71=function(_0x202b72,_0x49c1c1){_0x202b72=_0x202b72-0x0;var _0x3796f7=_0xe711[_0x202b72];return _0x3796f7;};'use strict';var server=require(_0x1e71('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x1e71('0x1'));var mailAccount=require(_0x1e71('0x2'));var setting=require('./rpc/setting');var logger=require(_0x1e71('0x3'))(_0x1e71('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x1e71('0x5')]())[_0x1e71('0x6')](realtime[_0x1e71('0x7')]())[_0x1e71('0x6')](function(){email[_0x1e71('0x8')](realtime[_0x1e71('0x9')]);return realtime;});}function main(){return server[_0x1e71('0xa')](realtime,email)[_0x1e71('0x6')](function(){return initRealtime();})[_0x1e71('0x6')](function(){return setting[_0x1e71('0xb')]();})[_0x1e71('0x6')](function(_0x1d50cf){return setInterval(initRealtime,_0x1d50cf[_0x1e71('0xc')]*0x3e8);})[_0x1e71('0xd')](function(_0x5edd9f){logger[_0x1e71('0xe')](_0x1e71('0xf'),_0x5edd9f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 808e53f..0dadda1 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 _0x9df4=['./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','custom','service','provider','box','handleImapBox','bind','end','handleImapEnd','handleImapError','disabled','emit','connected','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter'];(function(_0x1b5db7,_0x1f226c){var _0x2e0149=function(_0x26b4bb){while(--_0x26b4bb){_0x1b5db7['push'](_0x1b5db7['shift']());}};_0x2e0149(++_0x1f226c);}(_0x9df4,0x168));var _0x49df=function(_0x304f9d,_0x2f3ec0){_0x304f9d=_0x304f9d-0x0;var _0x179bc4=_0x9df4[_0x304f9d];return _0x179bc4;};'use strict';var _=require(_0x49df('0x0'));var moment=require(_0x49df('0x1'));var BPromise=require(_0x49df('0x2'));var md5=require(_0x49df('0x3'));var Redis=require(_0x49df('0x4'));var config=require(_0x49df('0x5'));var logger=require(_0x49df('0x6'))(_0x49df('0x7'));config[_0x49df('0x8')]=_[_0x49df('0x9')](config[_0x49df('0x8')],{'host':_0x49df('0xa'),'port':0x18eb});var io=require(_0x49df('0xb'))(new Redis(config[_0x49df('0x8')]));var EmailImap=require(_0x49df('0xc'));var EmailSmtp=require(_0x49df('0xd'));var mailAccount=require(_0x49df('0xe'));var md5Accounts={};function EmailChannel(_0x6cb2d3){logger[_0x49df('0xf')](_0x49df('0x10'));this[_0x49df('0x11')]=_0x6cb2d3[_0x49df('0x11')];this[_0x49df('0x12')]={};this[_0x49df('0x13')]=new EmailSmtp();}EmailChannel[_0x49df('0x14')]['emit']=function(_0x2a4475){var _0x42369d=this[_0x49df('0x11')][_0x2a4475];var _0x54610c={'id':_0x42369d['id'],'name':_0x42369d[_0x49df('0x15')],'key':_0x42369d[_0x49df('0x16')],'active':_0x42369d[_0x49df('0x17')],'Imap':{'status':_0x42369d[_0x49df('0x18')][_0x49df('0x19')],'messageStatus':_0x42369d[_0x49df('0x18')][_0x49df('0x1a')],'total':_0x42369d[_0x49df('0x18')]['total']}};if(_[_0x49df('0x1b')](md5Accounts[_0x2a4475])){md5Accounts[_0x2a4475]={};}var _0x315eeb=md5(JSON[_0x49df('0x1c')](_0x54610c));if(md5Accounts[_0x2a4475]['md5']!==_0x315eeb){md5Accounts[_0x2a4475][_0x49df('0x3')]=_0x315eeb;io['emit'](_0x49df('0x1d'),_0x54610c);}};EmailChannel[_0x49df('0x14')][_0x49df('0x1e')]=function(_0x3c9ea2){for(var _0x409102 in _0x3c9ea2){if(_0x3c9ea2[_0x49df('0x1f')](_0x409102)){if(_0x3c9ea2[_0x409102][_0x49df('0x18')]&&_0x3c9ea2[_0x409102][_0x49df('0x17')]){var _0x45d4d3=_0x3c9ea2[_0x409102]['Imap'];if(!_0x45d4d3['service']&&_0x3c9ea2[_0x409102]['provider']!==_0x49df('0x20'))_0x45d4d3[_0x49df('0x21')]=_0x3c9ea2[_0x409102][_0x49df('0x22')];if(!this[_0x49df('0x12')][_0x49df('0x1f')](_0x45d4d3['id'])){this[_0x49df('0x12')][_0x45d4d3['id']]=new EmailImap(_0x45d4d3,_0x3c9ea2[_0x409102][_0x49df('0x7')]);this['imapAccounts'][_0x45d4d3['id']]['on'](_0x49df('0x23'),this[_0x49df('0x24')][_0x49df('0x25')](this,_0x409102));this[_0x49df('0x12')][_0x45d4d3['id']]['on'](_0x49df('0x7'),this['handleImapEmail'][_0x49df('0x25')](this,_0x409102));this['imapAccounts'][_0x45d4d3['id']]['on'](_0x49df('0x26'),this[_0x49df('0x27')][_0x49df('0x25')](this,_0x409102));this[_0x49df('0x12')][_0x45d4d3['id']]['on']('error',this[_0x49df('0x28')][_0x49df('0x25')](this,_0x409102));}}else{if(_[_0x49df('0x1b')](this[_0x49df('0x11')][_0x409102][_0x49df('0x18')])){this['mailAccounts'][_0x409102][_0x49df('0x18')]={};}this[_0x49df('0x11')][_0x409102][_0x49df('0x18')][_0x49df('0x19')]=_0x49df('0x29');this['mailAccounts'][_0x409102][_0x49df('0x18')][_0x49df('0x1a')]='';this[_0x49df('0x2a')](_0x409102);}}}};EmailChannel['prototype'][_0x49df('0x24')]=function(_0x23444d,_0x2c67ab){if(this[_0x49df('0x11')][_0x23444d]){this[_0x49df('0x11')][_0x23444d][_0x49df('0x18')][_0x49df('0x19')]=_0x49df('0x2b');this[_0x49df('0x11')][_0x23444d][_0x49df('0x18')][_0x49df('0x1a')]=_0x2c67ab[_0x49df('0x15')];if(_0x2c67ab[_0x49df('0x2c')]){this[_0x49df('0x11')][_0x23444d][_0x49df('0x18')][_0x49df('0x2d')]=_0x2c67ab[_0x49df('0x2c')][_0x49df('0x2d')];}return this[_0x49df('0x2a')](_0x23444d);}};EmailChannel[_0x49df('0x14')][_0x49df('0x2e')]=function(_0x1e2604,_0x198ad4){logger[_0x49df('0xf')](_0x49df('0x2f'),_0x198ad4['firstName'],_0x198ad4[_0x49df('0x30')],_0x198ad4[_0x49df('0x31')],_0x1e2604);if(this[_0x49df('0x11')][_0x1e2604]){return mailAccount[_0x49df('0x32')](_0x1e2604,_0x198ad4)[_0x49df('0x33')](function(_0xd82825){if(_0xd82825){logger[_0x49df('0xf')](_0x49df('0x34'));}})[_0x49df('0x35')](function(_0x3b6471){logger[_0x49df('0x36')](_0x49df('0x37'),JSON[_0x49df('0x1c')](_0x3b6471));});}};EmailChannel[_0x49df('0x14')][_0x49df('0x27')]=function(_0x1e9a08){if(this[_0x49df('0x11')][_0x1e9a08]&&this[_0x49df('0x11')][_0x1e9a08][_0x49df('0x18')]){if(this[_0x49df('0x12')][this[_0x49df('0x11')][_0x1e9a08][_0x49df('0x18')]['id']]){delete this[_0x49df('0x12')][this['mailAccounts'][_0x1e9a08][_0x49df('0x18')]['id']];}this[_0x49df('0x11')][_0x1e9a08][_0x49df('0x18')]['lastSync']=moment();this[_0x49df('0x2a')](_0x1e9a08);}};EmailChannel['prototype'][_0x49df('0x28')]=function(_0x4686b3,_0x24b310){if(this['mailAccounts'][_0x4686b3]){this[_0x49df('0x11')][_0x4686b3][_0x49df('0x18')][_0x49df('0x19')]=_0x49df('0x36');this[_0x49df('0x11')][_0x4686b3][_0x49df('0x18')][_0x49df('0x1a')]=_0x24b310;return this[_0x49df('0x2a')](_0x4686b3);}};EmailChannel[_0x49df('0x14')][_0x49df('0x38')]=function(_0x38ba0d,_0x40ba18){return this[_0x49df('0x13')][_0x49df('0x39')](_0x38ba0d,_0x40ba18);};EmailChannel['prototype'][_0x49df('0x3a')]=function(_0xd69ec){var _0x4a05af=this;if(this[_0x49df('0x11')][_0xd69ec['id']]){if(_[_0x49df('0x1b')](this[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')])){this[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')]={};}this[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')][_0x49df('0x3c')]=moment();return new BPromise(function(_0x5b4795,_0x1f5466){return _0x4a05af[_0x49df('0x13')][_0x49df('0x3d')](_0xd69ec)['then'](function(_0x4af545){_0x4a05af[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')]['status']='verified';_0x4a05af['mailAccounts'][_0xd69ec['id']]['Smtp'][_0x49df('0x1a')]='';_0x4a05af[_0x49df('0x2a')](_0xd69ec['id']);_0x5b4795(_0x4af545);})[_0x49df('0x35')](function(_0xe933f6){_0x4a05af[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')][_0x49df('0x19')]=_0x49df('0x36');_0x4a05af[_0x49df('0x11')][_0xd69ec['id']][_0x49df('0x3b')][_0x49df('0x1a')]=_0xe933f6;_0x4a05af[_0x49df('0x2a')](_0xd69ec['id']);_0x1f5466(_0xe933f6);});});}return this['smtp'][_0x49df('0x3d')](_0xd69ec);};module['exports']=EmailChannel; \ No newline at end of file +var _0x8fed=['refresh','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','sendMail','verifySmtp','Smtp','lastSync','smtp','verify','then','verified','exports','lodash','moment','bluebird','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','status','Imap','messageStatus','total','isNil','md5','mailAccount:update','prototype'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x8fed,0x147));var _0xd8fe=function(_0x47449c,_0x25e691){_0x47449c=_0x47449c-0x0;var _0x26dbe3=_0x8fed[_0x47449c];return _0x26dbe3;};'use strict';var _=require(_0xd8fe('0x0'));var moment=require(_0xd8fe('0x1'));var BPromise=require(_0xd8fe('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xd8fe('0x3'))(_0xd8fe('0x4'));config[_0xd8fe('0x5')]=_[_0xd8fe('0x6')](config[_0xd8fe('0x5')],{'host':_0xd8fe('0x7'),'port':0x18eb});var io=require(_0xd8fe('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xd8fe('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xd8fe('0xa'));var md5Accounts={};function EmailChannel(_0x1a5091){logger[_0xd8fe('0xb')](_0xd8fe('0xc'));this[_0xd8fe('0xd')]=_0x1a5091[_0xd8fe('0xd')];this[_0xd8fe('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xd8fe('0xf')]=function(_0x5badfb){var _0x33001a=this[_0xd8fe('0xd')][_0x5badfb];var _0x1d1491={'id':_0x33001a['id'],'name':_0x33001a[_0xd8fe('0x10')],'key':_0x33001a[_0xd8fe('0x11')],'active':_0x33001a[_0xd8fe('0x12')],'Imap':{'status':_0x33001a['Imap'][_0xd8fe('0x13')],'messageStatus':_0x33001a[_0xd8fe('0x14')][_0xd8fe('0x15')],'total':_0x33001a['Imap'][_0xd8fe('0x16')]}};if(_[_0xd8fe('0x17')](md5Accounts[_0x5badfb])){md5Accounts[_0x5badfb]={};}var _0x3cd399=md5(JSON['stringify'](_0x1d1491));if(md5Accounts[_0x5badfb][_0xd8fe('0x18')]!==_0x3cd399){md5Accounts[_0x5badfb]['md5']=_0x3cd399;io[_0xd8fe('0xf')](_0xd8fe('0x19'),_0x1d1491);}};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x1b')]=function(_0x4332cf){for(var _0x54210e in _0x4332cf){if(_0x4332cf[_0xd8fe('0x1c')](_0x54210e)){if(_0x4332cf[_0x54210e]['Imap']&&_0x4332cf[_0x54210e][_0xd8fe('0x12')]){var _0x148f96=_0x4332cf[_0x54210e][_0xd8fe('0x14')];if(!_0x148f96[_0xd8fe('0x1d')]&&_0x4332cf[_0x54210e][_0xd8fe('0x1e')]!==_0xd8fe('0x1f'))_0x148f96[_0xd8fe('0x1d')]=_0x4332cf[_0x54210e]['provider'];if(!this[_0xd8fe('0xe')][_0xd8fe('0x1c')](_0x148f96['id'])){this[_0xd8fe('0xe')][_0x148f96['id']]=new EmailImap(_0x148f96,_0x4332cf[_0x54210e][_0xd8fe('0x4')]);this[_0xd8fe('0xe')][_0x148f96['id']]['on'](_0xd8fe('0x20'),this['handleImapBox'][_0xd8fe('0x21')](this,_0x54210e));this[_0xd8fe('0xe')][_0x148f96['id']]['on'](_0xd8fe('0x4'),this[_0xd8fe('0x22')][_0xd8fe('0x21')](this,_0x54210e));this['imapAccounts'][_0x148f96['id']]['on']('end',this['handleImapEnd'][_0xd8fe('0x21')](this,_0x54210e));this[_0xd8fe('0xe')][_0x148f96['id']]['on'](_0xd8fe('0x23'),this[_0xd8fe('0x24')][_0xd8fe('0x21')](this,_0x54210e));}}else{if(_[_0xd8fe('0x17')](this[_0xd8fe('0xd')][_0x54210e]['Imap'])){this[_0xd8fe('0xd')][_0x54210e][_0xd8fe('0x14')]={};}this['mailAccounts'][_0x54210e]['Imap'][_0xd8fe('0x13')]=_0xd8fe('0x25');this[_0xd8fe('0xd')][_0x54210e][_0xd8fe('0x14')][_0xd8fe('0x15')]='';this[_0xd8fe('0xf')](_0x54210e);}}}};EmailChannel['prototype'][_0xd8fe('0x26')]=function(_0x2106e8,_0x337351){if(this['mailAccounts'][_0x2106e8]){this[_0xd8fe('0xd')][_0x2106e8][_0xd8fe('0x14')][_0xd8fe('0x13')]=_0xd8fe('0x27');this[_0xd8fe('0xd')][_0x2106e8][_0xd8fe('0x14')]['messageStatus']=_0x337351[_0xd8fe('0x10')];if(_0x337351['messages']){this['mailAccounts'][_0x2106e8][_0xd8fe('0x14')]['total']=_0x337351[_0xd8fe('0x28')]['total'];}return this['emit'](_0x2106e8);}};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x22')]=function(_0x4993bf,_0x5504e1){logger[_0xd8fe('0xb')](_0xd8fe('0x29'),_0x5504e1['firstName'],_0x5504e1[_0xd8fe('0x2a')],_0x5504e1[_0xd8fe('0x2b')],_0x4993bf);if(this[_0xd8fe('0xd')][_0x4993bf]){return mailAccount[_0xd8fe('0x2c')](_0x4993bf,_0x5504e1)['then'](function(_0x484750){if(_0x484750){logger[_0xd8fe('0xb')](_0xd8fe('0x2d'));}})[_0xd8fe('0x2e')](function(_0x5412dc){logger[_0xd8fe('0x23')](_0xd8fe('0x2f'),JSON[_0xd8fe('0x30')](_0x5412dc));});}};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x31')]=function(_0x16f64d){if(this[_0xd8fe('0xd')][_0x16f64d]&&this[_0xd8fe('0xd')][_0x16f64d]['Imap']){if(this[_0xd8fe('0xe')][this['mailAccounts'][_0x16f64d]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x16f64d]['Imap']['id']];}this[_0xd8fe('0xd')][_0x16f64d][_0xd8fe('0x14')]['lastSync']=moment();this['emit'](_0x16f64d);}};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x24')]=function(_0x5ae0a4,_0x350de0){if(this[_0xd8fe('0xd')][_0x5ae0a4]){this[_0xd8fe('0xd')][_0x5ae0a4]['Imap'][_0xd8fe('0x13')]='error';this['mailAccounts'][_0x5ae0a4][_0xd8fe('0x14')][_0xd8fe('0x15')]=_0x350de0;return this[_0xd8fe('0xf')](_0x5ae0a4);}};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x32')]=function(_0x14cdfb,_0x12d6a0){return this['smtp']['send'](_0x14cdfb,_0x12d6a0);};EmailChannel[_0xd8fe('0x1a')][_0xd8fe('0x33')]=function(_0x1187d6){var _0x32a67a=this;if(this[_0xd8fe('0xd')][_0x1187d6['id']]){if(_[_0xd8fe('0x17')](this[_0xd8fe('0xd')][_0x1187d6['id']][_0xd8fe('0x34')])){this['mailAccounts'][_0x1187d6['id']]['Smtp']={};}this[_0xd8fe('0xd')][_0x1187d6['id']][_0xd8fe('0x34')][_0xd8fe('0x35')]=moment();return new BPromise(function(_0x1100b3,_0x4853e6){return _0x32a67a[_0xd8fe('0x36')][_0xd8fe('0x37')](_0x1187d6)[_0xd8fe('0x38')](function(_0xdc7df6){_0x32a67a[_0xd8fe('0xd')][_0x1187d6['id']][_0xd8fe('0x34')][_0xd8fe('0x13')]=_0xd8fe('0x39');_0x32a67a[_0xd8fe('0xd')][_0x1187d6['id']][_0xd8fe('0x34')][_0xd8fe('0x15')]='';_0x32a67a[_0xd8fe('0xf')](_0x1187d6['id']);_0x1100b3(_0xdc7df6);})[_0xd8fe('0x2e')](function(_0x30656d){_0x32a67a[_0xd8fe('0xd')][_0x1187d6['id']][_0xd8fe('0x34')][_0xd8fe('0x13')]=_0xd8fe('0x23');_0x32a67a['mailAccounts'][_0x1187d6['id']][_0xd8fe('0x34')][_0xd8fe('0x15')]=_0x30656d;_0x32a67a[_0xd8fe('0xf')](_0x1187d6['id']);_0x4853e6(_0x30656d);});});}return this[_0xd8fe('0x36')][_0xd8fe('0x37')](_0x1187d6);};module[_0xd8fe('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 63b78a7..783da24 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 _0xa16a=['handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleCloseBox','stringify','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','password','authentication','email','host','tls','required','handleOpenBox','emit','box','search','UNSEEN','handleReadUnseen','handleError','fetch','handleFetchError','handleFetchEnd','handleFetchMessage','body'];(function(_0x54d08,_0x16d92c){var _0x5f29f7=function(_0x2c7ff9){while(--_0x2c7ff9){_0x54d08['push'](_0x54d08['shift']());}};_0x5f29f7(++_0x16d92c);}(_0xa16a,0x128));var _0xaa16=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa16a[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xaa16('0x0'));var util=require(_0xaa16('0x1'));var Imap=require(_0xaa16('0x2'));var simpleParser=require(_0xaa16('0x3'))[_0xaa16('0x4')];var Iconv=require(_0xaa16('0x5'))[_0xaa16('0x6')];var EventEmitter=require(_0xaa16('0x7'))[_0xaa16('0x8')];var utils=require(_0xaa16('0x9'));var logger=require(_0xaa16('0xa'))('email');function EmailImap(_0x59c0c1,_0x343a69){this[_0xaa16('0xb')]=_0x59c0c1['mailbox'];this[_0xaa16('0xc')]=this['getAccount'](_0x59c0c1,_0x343a69);this[_0xaa16('0x2')]=new Imap(this['account']);this[_0xaa16('0x2')][_0xaa16('0xd')](_0xaa16('0xe'),this[_0xaa16('0xf')][_0xaa16('0x10')](this));this['imap'][_0xaa16('0xd')](_0xaa16('0x11'),this[_0xaa16('0x12')][_0xaa16('0x10')](this));this[_0xaa16('0x2')]['on'](_0xaa16('0x13'),this['handleError'][_0xaa16('0x10')](this));this[_0xaa16('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xaa16('0x14')][_0xaa16('0x15')]=function(_0x4420ff,_0x497a4b){var _0xcdebb8={'connTimeout':_0x4420ff['connTimeout']?_0x4420ff[_0xaa16('0x16')]*0x3e8:0x2710,'authTimeout':_0x4420ff['authTimeout']?_0x4420ff[_0xaa16('0x17')]*0x3e8:0x1388};if(_0x4420ff[_0xaa16('0x18')]){_0xcdebb8[_0xaa16('0x19')]=_0x4420ff['user'];if(_0x4420ff[_0xaa16('0x1a')]){_0xcdebb8[_0xaa16('0x1b')]=utils['generateXOAuth2Token'](_0x4420ff['CloudProvider']['data5'],_0x4420ff['user']);}else{_0xcdebb8[_0xaa16('0x1c')]=_0x4420ff[_0xaa16('0x1c')];}}else{if(_0x4420ff[_0xaa16('0x1d')]){_0xcdebb8[_0xaa16('0x19')]=_0x4420ff['user'];_0xcdebb8[_0xaa16('0x1c')]=_0x4420ff[_0xaa16('0x1c')];}}_0xcdebb8[_0xaa16('0x1e')]=_0x497a4b||_0x4420ff[_0xaa16('0x19')]||'anonymous@xcally.com';_0xcdebb8[_0xaa16('0x1f')]=_0x4420ff[_0xaa16('0x1f')];_0xcdebb8['port']=_0x4420ff['port']||0x3e1;if(_0x4420ff[_0xaa16('0x20')]){_0xcdebb8['tls']=!![];}else{_0xcdebb8[_0xaa16('0x20')]=![];_0xcdebb8['autotls']=_0xaa16('0x21');}return _0xcdebb8;};EmailImap[_0xaa16('0x14')]['handleReady']=function(){this['imap']['openBox'](this[_0xaa16('0xb')],![],this['handleOpenBox'][_0xaa16('0x10')](this));};EmailImap[_0xaa16('0x14')][_0xaa16('0x22')]=function(_0x654b2d,_0x2c90b9){if(_0x654b2d){this['handleError'](_0x654b2d,!![]);}else{this[_0xaa16('0x23')](_0xaa16('0x24'),_0x2c90b9);this['readUnseen']();}};EmailImap[_0xaa16('0x14')]['handleCloseBox']=function(_0x128f11){if(_0x128f11){this['handleError'](_0x128f11,!![]);}else{this[_0xaa16('0x2')][_0xaa16('0x11')]();}};EmailImap[_0xaa16('0x14')]['readUnseen']=function(){this[_0xaa16('0x2')][_0xaa16('0x25')]([_0xaa16('0x26')],this[_0xaa16('0x27')][_0xaa16('0x10')](this));};EmailImap['prototype'][_0xaa16('0x27')]=function(_0x21889b,_0x6cabac){if(_0x21889b){this[_0xaa16('0x28')](_0x21889b,!![]);}else{if(_0x6cabac['length']){try{var _0x4e1159=this[_0xaa16('0x2')][_0xaa16('0x29')](_0x6cabac,{'bodies':'','markSeen':!![]});_0x4e1159['on']('message',this['handleFetchMessage'][_0xaa16('0x10')](this));_0x4e1159[_0xaa16('0xd')]('error',this[_0xaa16('0x2a')][_0xaa16('0x10')](this));_0x4e1159[_0xaa16('0xd')](_0xaa16('0x11'),this[_0xaa16('0x2b')][_0xaa16('0x10')](this));}catch(_0x771252){logger['error'](_0x771252);}}else{this[_0xaa16('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xaa16('0x10')](this));}}};EmailImap[_0xaa16('0x14')][_0xaa16('0x2c')]=function(_0x9c30f3){_0x9c30f3['on'](_0xaa16('0x2d'),this[_0xaa16('0x2e')][_0xaa16('0x10')](this));_0x9c30f3[_0xaa16('0xd')](_0xaa16('0x2f'),this[_0xaa16('0x30')][_0xaa16('0x10')](this));_0x9c30f3[_0xaa16('0xd')](_0xaa16('0x11'),this[_0xaa16('0x31')][_0xaa16('0x10')](this));};EmailImap[_0xaa16('0x14')]['handleMessageBody']=function(_0x1557a4){simpleParser(_0x1557a4,{'Iconv':Iconv},this[_0xaa16('0x32')][_0xaa16('0x10')](this));};EmailImap[_0xaa16('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0xaa16('0x14')]['handleMessageEnd']=function(){};EmailImap[_0xaa16('0x14')][_0xaa16('0x32')]=function(_0x33588c,_0x46925a){if(_0x33588c){logger[_0xaa16('0x13')](_0x33588c);}else{var _0xada64e=this;utils[_0xaa16('0x33')](this[_0xaa16('0xc')],_0x46925a,function(_0x37ce8a){_0xada64e['emit'](_0xaa16('0x1e'),_0x37ce8a);});}};EmailImap[_0xaa16('0x14')]['handleFetchEnd']=function(){this[_0xaa16('0x2')][_0xaa16('0x34')](!![],this[_0xaa16('0x35')]['bind'](this));};EmailImap[_0xaa16('0x14')][_0xaa16('0x2a')]=function(_0x5ca546){this[_0xaa16('0x28')](_0x5ca546);this[_0xaa16('0x2')][_0xaa16('0x34')](!![],this[_0xaa16('0x35')][_0xaa16('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xaa16('0x23')](_0xaa16('0x11'));};EmailImap[_0xaa16('0x14')][_0xaa16('0x28')]=function(_0x2f2a87,_0x2fff18){logger[_0xaa16('0x13')]('handleError',this[_0xaa16('0xc')][_0xaa16('0x1e')],JSON[_0xaa16('0x36')](_0x2f2a87));var _0x440267='';if(_0x2f2a87){if(_0x2f2a87['textCode']){_0x440267=_0x2f2a87['textCode'];}else{for(var _0x450b1d in _0x2f2a87){if(_0x2f2a87[_0xaa16('0x37')](_0x450b1d)){_0x440267+=_['upperFirst'](_0x450b1d)+':\x20'+_0x2f2a87[_0x450b1d]+'\x0a';}}}}if(_0x2fff18){this['imap']['end']();}else{this[_0xaa16('0x23')](_0xaa16('0x13'),_0x440267);this[_0xaa16('0x23')]('end');}};module[_0xaa16('0x38')]=EmailImap; \ No newline at end of file +var _0x3675=['bind','error','connect','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','prototype','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','emit','handleFetchEnd','closeBox','handleFetchError','handleEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','once','ready','handleReady'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3675,0x6d));var _0x5367=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x3675[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x5367('0x0'));var util=require('util');var Imap=require(_0x5367('0x1'));var simpleParser=require(_0x5367('0x2'))[_0x5367('0x3')];var Iconv=require(_0x5367('0x4'))['Iconv'];var EventEmitter=require(_0x5367('0x5'))[_0x5367('0x6')];var utils=require(_0x5367('0x7'));var logger=require(_0x5367('0x8'))(_0x5367('0x9'));function EmailImap(_0x19e422,_0x1f3005){this[_0x5367('0xa')]=_0x19e422[_0x5367('0xa')];this['account']=this[_0x5367('0xb')](_0x19e422,_0x1f3005);this[_0x5367('0x1')]=new Imap(this['account']);this[_0x5367('0x1')][_0x5367('0xc')](_0x5367('0xd'),this[_0x5367('0xe')][_0x5367('0xf')](this));this[_0x5367('0x1')][_0x5367('0xc')]('end',this['handleEnd'][_0x5367('0xf')](this));this[_0x5367('0x1')]['on'](_0x5367('0x10'),this['handleError'][_0x5367('0xf')](this));this[_0x5367('0x1')][_0x5367('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x4decfb,_0x3ddbdc){var _0x488b2a={'connTimeout':_0x4decfb[_0x5367('0x12')]?_0x4decfb[_0x5367('0x12')]*0x3e8:0x2710,'authTimeout':_0x4decfb[_0x5367('0x13')]?_0x4decfb[_0x5367('0x13')]*0x3e8:0x1388};if(_0x4decfb[_0x5367('0x14')]){_0x488b2a['user']=_0x4decfb[_0x5367('0x15')];if(_0x4decfb['modernAuthentication']){_0x488b2a[_0x5367('0x16')]=utils['generateXOAuth2Token'](_0x4decfb[_0x5367('0x17')][_0x5367('0x18')],_0x4decfb[_0x5367('0x15')]);}else{_0x488b2a[_0x5367('0x19')]=_0x4decfb[_0x5367('0x19')];}}else{if(_0x4decfb[_0x5367('0x1a')]){_0x488b2a[_0x5367('0x15')]=_0x4decfb[_0x5367('0x15')];_0x488b2a[_0x5367('0x19')]=_0x4decfb['password'];}}_0x488b2a['email']=_0x3ddbdc||_0x4decfb[_0x5367('0x15')]||_0x5367('0x1b');_0x488b2a[_0x5367('0x1c')]=_0x4decfb['host'];_0x488b2a[_0x5367('0x1d')]=_0x4decfb[_0x5367('0x1d')]||0x3e1;if(_0x4decfb[_0x5367('0x1e')]){_0x488b2a[_0x5367('0x1e')]=!![];}else{_0x488b2a[_0x5367('0x1e')]=![];_0x488b2a['autotls']=_0x5367('0x1f');}return _0x488b2a;};EmailImap[_0x5367('0x20')][_0x5367('0xe')]=function(){this['imap'][_0x5367('0x21')](this[_0x5367('0xa')],![],this[_0x5367('0x22')][_0x5367('0xf')](this));};EmailImap[_0x5367('0x20')][_0x5367('0x22')]=function(_0x345e40,_0x3851d0){if(_0x345e40){this[_0x5367('0x23')](_0x345e40,!![]);}else{this['emit'](_0x5367('0x24'),_0x3851d0);this[_0x5367('0x25')]();}};EmailImap[_0x5367('0x20')][_0x5367('0x26')]=function(_0x429bee){if(_0x429bee){this[_0x5367('0x23')](_0x429bee,!![]);}else{this['imap'][_0x5367('0x27')]();}};EmailImap[_0x5367('0x20')][_0x5367('0x25')]=function(){this[_0x5367('0x1')][_0x5367('0x28')](['UNSEEN'],this['handleReadUnseen'][_0x5367('0xf')](this));};EmailImap[_0x5367('0x20')][_0x5367('0x29')]=function(_0x2f01c1,_0x40bb85){if(_0x2f01c1){this['handleError'](_0x2f01c1,!![]);}else{if(_0x40bb85[_0x5367('0x2a')]){try{var _0x844508=this[_0x5367('0x1')][_0x5367('0x2b')](_0x40bb85,{'bodies':'','markSeen':!![]});_0x844508['on'](_0x5367('0x2c'),this['handleFetchMessage']['bind'](this));_0x844508[_0x5367('0xc')](_0x5367('0x10'),this['handleFetchError'][_0x5367('0xf')](this));_0x844508['once'](_0x5367('0x27'),this['handleFetchEnd'][_0x5367('0xf')](this));}catch(_0xf5201d){logger[_0x5367('0x10')](_0xf5201d);}}else{this[_0x5367('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x5367('0xf')](this));}}};EmailImap[_0x5367('0x20')]['handleFetchMessage']=function(_0x2a188c){_0x2a188c['on'](_0x5367('0x2d'),this[_0x5367('0x2e')][_0x5367('0xf')](this));_0x2a188c[_0x5367('0xc')](_0x5367('0x2f'),this[_0x5367('0x30')][_0x5367('0xf')](this));_0x2a188c['once'](_0x5367('0x27'),this['handleMessageEnd'][_0x5367('0xf')](this));};EmailImap['prototype'][_0x5367('0x2e')]=function(_0x13ee6f){simpleParser(_0x13ee6f,{'Iconv':Iconv},this[_0x5367('0x31')][_0x5367('0xf')](this));};EmailImap[_0x5367('0x20')][_0x5367('0x30')]=function(){};EmailImap[_0x5367('0x20')][_0x5367('0x32')]=function(){};EmailImap[_0x5367('0x20')][_0x5367('0x31')]=function(_0x52b42a,_0x48db2b){if(_0x52b42a){logger[_0x5367('0x10')](_0x52b42a);}else{var _0x18ec43=this;utils[_0x5367('0x33')](this[_0x5367('0x34')],_0x48db2b,function(_0x473210){_0x18ec43[_0x5367('0x35')](_0x5367('0x9'),_0x473210);});}};EmailImap[_0x5367('0x20')][_0x5367('0x36')]=function(){this[_0x5367('0x1')][_0x5367('0x37')](!![],this[_0x5367('0x26')][_0x5367('0xf')](this));};EmailImap[_0x5367('0x20')][_0x5367('0x38')]=function(_0x53a40b){this['handleError'](_0x53a40b);this[_0x5367('0x1')]['closeBox'](!![],this[_0x5367('0x26')][_0x5367('0xf')](this));};EmailImap[_0x5367('0x20')][_0x5367('0x39')]=function(){this[_0x5367('0x35')](_0x5367('0x27'));};EmailImap[_0x5367('0x20')][_0x5367('0x23')]=function(_0x4c49bc,_0x391e5c){logger[_0x5367('0x10')](_0x5367('0x23'),this[_0x5367('0x34')][_0x5367('0x9')],JSON['stringify'](_0x4c49bc));var _0x28708d='';if(_0x4c49bc){if(_0x4c49bc['textCode']){_0x28708d=_0x4c49bc[_0x5367('0x3a')];}else{for(var _0x21fd06 in _0x4c49bc){if(_0x4c49bc[_0x5367('0x3b')](_0x21fd06)){_0x28708d+=_[_0x5367('0x3c')](_0x21fd06)+':\x20'+_0x4c49bc[_0x21fd06]+'\x0a';}}}}if(_0x391e5c){this[_0x5367('0x1')][_0x5367('0x27')]();}else{this[_0x5367('0x35')](_0x5367('0x10'),_0x28708d);this[_0x5367('0x35')]('end');}};module[_0x5367('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 ff515d4..8b4e128 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 _0x62ee=['send','createTransport','use','toString','verify','Not\x20verifired','exports','prototype'];(function(_0x1ff01c,_0x729786){var _0x28680e=function(_0x489730){while(--_0x489730){_0x1ff01c['push'](_0x1ff01c['shift']());}};_0x28680e(++_0x729786);}(_0x62ee,0x9f));var _0xe62e=function(_0x4617a4,_0x1f8ebd){_0x4617a4=_0x4617a4-0x0;var _0x5b64a1=_0x62ee[_0x4617a4];return _0x5b64a1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xe62e('0x0')][_0xe62e('0x1')]=function(_0x5ce88d,_0x553c1e){return new Promise(function(_0x10568e,_0x54c085){var _0x40e234=nodemailer[_0xe62e('0x2')](_0x5ce88d);_0x40e234[_0xe62e('0x3')]('compile',inlineBase64());_0x40e234['sendMail'](_0x553c1e,function(_0x92a2bd,_0x2e8e5b){if(_0x92a2bd){_0x54c085(_0x92a2bd[_0xe62e('0x4')]());}else{_0x10568e(_0x2e8e5b);}});});};EmailSmtp['prototype'][_0xe62e('0x5')]=function(_0x4aa3a3){return new Promise(function(_0x2e7b5a,_0x39d077){var _0x3f8188=nodemailer[_0xe62e('0x2')](_0x4aa3a3);_0x3f8188[_0xe62e('0x5')](function(_0x220603,_0xac1aa7){if(_0x220603){_0x39d077(_0x220603['toString']());}else{if(_0xac1aa7){_0x2e7b5a(_0xac1aa7);}else{_0x39d077(_0xe62e('0x6'));}}});});};module[_0xe62e('0x7')]=EmailSmtp; \ No newline at end of file +var _0x272a=['sendMail','toString','verify','exports','nodemailer','prototype','send','createTransport','use','compile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x272a,0x194));var _0xa272=function(_0x118a4d,_0x5a6b0d){_0x118a4d=_0x118a4d-0x0;var _0x322551=_0x272a[_0x118a4d];return _0x322551;};'use strict';var nodemailer=require(_0xa272('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa272('0x1')][_0xa272('0x2')]=function(_0x3b40c3,_0x4440b6){return new Promise(function(_0x4f6f5f,_0x43d85d){var _0x206034=nodemailer[_0xa272('0x3')](_0x3b40c3);_0x206034[_0xa272('0x4')](_0xa272('0x5'),inlineBase64());_0x206034[_0xa272('0x6')](_0x4440b6,function(_0x7d717f,_0x21b611){if(_0x7d717f){_0x43d85d(_0x7d717f[_0xa272('0x7')]());}else{_0x4f6f5f(_0x21b611);}});});};EmailSmtp[_0xa272('0x1')][_0xa272('0x8')]=function(_0x5e964c){return new Promise(function(_0x34891a,_0x1a1084){var _0xf5fac9=nodemailer['createTransport'](_0x5e964c);_0xf5fac9['verify'](function(_0x2d3622,_0x540e09){if(_0x2d3622){_0x1a1084(_0x2d3622['toString']());}else{if(_0x540e09){_0x34891a(_0x540e09);}else{_0x1a1084('Not\x20verifired');}}});});};module[_0xa272('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 1c214e5..fe2636c 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 _0x7e85=['Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml'];(function(_0x110d39,_0x244722){var _0x58d934=function(_0x152bde){while(--_0x152bde){_0x110d39['push'](_0x110d39['shift']());}};_0x58d934(++_0x244722);}(_0x7e85,0x155));var _0x57e8=function(_0x1118da,_0x2fde4c){_0x1118da=_0x1118da-0x0;var _0x7374da=_0x7e85[_0x1118da];return _0x7374da;};'use strict';var _=require(_0x57e8('0x0'));var moment=require(_0x57e8('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x57e8('0x2'));var tnef=require('node-tnef');var logger=require(_0x57e8('0x3'))(_0x57e8('0x4'));var config=require(_0x57e8('0x5'));function getAddress(_0x58831b){var _0x46c5bb=_[_0x57e8('0x6')](_0x58831b[_0x57e8('0x7')]);return _0x46c5bb&&_0x46c5bb['address']?_0x46c5bb[_0x57e8('0x8')]:'anonymous'+random[_0x57e8('0x9')](0x6)+_0x57e8('0xa');}function getFirstName(_0x10c2e8){var _0x1f54ac=_[_0x57e8('0x6')](_0x10c2e8[_0x57e8('0x7')]);if(_0x1f54ac&&_0x1f54ac[_0x57e8('0xb')]){if(_0x1f54ac[_0x57e8('0xb')]==_0x1f54ac[_0x57e8('0x8')]){return _0x1f54ac[_0x57e8('0xb')]['substring'](0x0,_0x1f54ac[_0x57e8('0xb')][_0x57e8('0xc')]('@'));}var _0x1908f8=_0x1f54ac[_0x57e8('0xb')][_0x57e8('0xd')](/\s+/);return _0x1908f8[_0x57e8('0xe')]>0x1?_0x1908f8[_0x57e8('0xf')](0x0,-0x1)[_0x57e8('0x10')]('\x20'):_0x1f54ac['name'];}return _0x57e8('0x11');}function getLastName(_0x5a5b76){var _0x1833e3=_['head'](_0x5a5b76[_0x57e8('0x7')]);if(_0x1833e3&&_0x1833e3['name']){var _0x50a332=_0x1833e3[_0x57e8('0xb')][_0x57e8('0xd')](/\s+/);return _0x50a332[_0x57e8('0xe')]>0x1?_0x50a332[_0x57e8('0x12')]():'';}return'';}function getMails(_0x34e28f,_0x3ea94d){var _0x1b9ea1='';for(var _0x1d3684=0x0;_0x1d3684<_0x3ea94d[_0x57e8('0x7')][_0x57e8('0xe')];_0x1d3684+=0x1){if(_0x3ea94d[_0x57e8('0x7')][_0x1d3684][_0x57e8('0x8')]!==_0x34e28f){if(!_[_0x57e8('0x13')](_0x1b9ea1)){_0x1b9ea1+=',';}_0x1b9ea1+=_0x3ea94d[_0x57e8('0x7')][_0x1d3684][_0x57e8('0xb')]||_0x3ea94d['value'][_0x1d3684][_0x57e8('0x8')]||'';_0x1b9ea1+='\x20<';_0x1b9ea1+=_0x3ea94d[_0x57e8('0x7')][_0x1d3684][_0x57e8('0x8')]?_0x3ea94d[_0x57e8('0x7')][_0x1d3684][_0x57e8('0x8')]:_0x57e8('0x14')+random['generate'](0x6)+'@xcally.com';_0x1b9ea1+='>';}}return _0x1b9ea1;}function parseEmail(_0x146105,_0x5f56a9,_0x42275d){if(_0x5f56a9[_0x57e8('0x15')]){var _0x431384=/)<[^<]*)*<\/script>/gi;while(_0x431384[_0x57e8('0x16')](_0x5f56a9[_0x57e8('0x15')])){_0x5f56a9[_0x57e8('0x15')]=_0x5f56a9[_0x57e8('0x15')][_0x57e8('0x17')](_0x431384,'');}if(_0x5f56a9[_0x57e8('0x15')]['includes'](_0x57e8('0x18'))){var _0x144ed0=[];_0x5f56a9[_0x57e8('0x19')][_0x57e8('0x1a')](_0x44f61e=>{_0x144ed0[_0x57e8('0x1b')](_0x44f61e[_0x57e8('0x1c')]);});var _0x48aed3=/]+>/g;var _0x237e15=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x545a41=_0x5f56a9[_0x57e8('0x15')][_0x57e8('0x17')](_0x237e15,'_SRC');var _0x568e65=_0x545a41[_0x57e8('0x17')](_0x48aed3,_0x57e8('0x1d'));for(let _0x1218a5=0x0;_0x1218a5<_0x144ed0[_0x57e8('0xe')];_0x1218a5++){var _0x2d26d7=_0x568e65['replace'](_0x57e8('0x1d'),_0x57e8('0x1e')+_0x144ed0[_0x1218a5]+_0x57e8('0x1f'));_0x568e65=_0x2d26d7;}_0x5f56a9[_0x57e8('0x15')]=_0x568e65;}_0x42275d[_0x57e8('0x20')]=_0x5f56a9['html'];}else{_0x42275d['body']=_0x5f56a9[_0x57e8('0x21')];}if(_0x42275d[_0x57e8('0x20')]){_0x42275d[_0x57e8('0x20')]=_0x42275d[_0x57e8('0x20')][_0x57e8('0x17')](/0x0){var _0xbb3987=['Auto-Submitted:\x20auto-replied',_0x57e8('0x33'),_0x57e8('0x34')];for(var _0xf811a2=0x0;_0xf811a2<_0x5f56a9[_0x57e8('0x32')][_0x57e8('0xe')];_0xf811a2++){var _0x18c220=_[_0x57e8('0xc')](_0xbb3987,_0x5f56a9[_0x57e8('0x32')][_0xf811a2][_0x57e8('0x35')]);if(_0x18c220>=0x0){_0x42275d[_0x57e8('0x36')]=!![];}}}return _0x42275d;}exports[_0x57e8('0x37')]=function(_0x56fd7f,_0x4a1e13,_0x58848b){var _0x13faa3={'from':getAddress(_0x4a1e13[_0x57e8('0x38')]),'firstName':getFirstName(_0x4a1e13[_0x57e8('0x38')]),'lastName':getLastName(_0x4a1e13['from']),'mapKey':_0x57e8('0x4'),'message':{'from':getMails(_0x56fd7f['email'],_0x4a1e13[_0x57e8('0x38')]),'to':_0x56fd7f[_0x57e8('0x4')],'cc':'','subject':_0x4a1e13['subject']||'','messageId':_0x4a1e13[_0x57e8('0x39')],'inReplyTo':_0x4a1e13['inReplyTo'],'sentAt':moment(_0x4a1e13[_0x57e8('0x3a')])['format'](_0x57e8('0x3b')),'attach':![],'attachments':[]}};if(!_0x4a1e13[_0x57e8('0x15')]&&!_0x4a1e13[_0x57e8('0x21')]){var _0x3b8157=_['filter'](_0x4a1e13['attachments'],{'contentType':_0x57e8('0x3c')});if(_0x3b8157['length']){logger[_0x57e8('0x3d')](util[_0x57e8('0x2b')](_0x57e8('0x3e'),_0x4a1e13['messageId']));tnef[_0x57e8('0x3f')](_[_0x57e8('0x40')](_0x3b8157)[_0x57e8('0x30')],function(_0x399ce7,_0x220735){if(_0x220735){_0x4a1e13[_0x57e8('0x15')]=_0x220735[_0x57e8('0x41')]||_0x57e8('0x42');if(_0x220735[_0x57e8('0x43')]){for(var _0x5bb0c3=0x0;_0x5bb0c3<_0x220735['Attachments'][_0x57e8('0xe')];_0x5bb0c3++){var _0x5bb116=_0x220735[_0x57e8('0x43')][_0x5bb0c3];_0x13faa3[_0x57e8('0x23')][_0x57e8('0x19')][_0x57e8('0x1b')]({'filename':_0x5bb116[_0x57e8('0x44')],'content':Buffer['from'](_0x5bb116[_0x57e8('0x45')])});}}}_0x58848b(parseEmail(_0x56fd7f,_0x4a1e13,_0x13faa3));});}else{_0x4a1e13['html']=_0x57e8('0x42');_0x58848b(parseEmail(_0x56fd7f,_0x4a1e13,_0x13faa3));}}else{_0x58848b(parseEmail(_0x56fd7f,_0x4a1e13,_0x13faa3));}};exports[_0x57e8('0x46')]=function(_0x3c03d0,_0x126fd5){var _0x3b2a2b=[_0x57e8('0x47')+(_0x126fd5||''),_0x57e8('0x48')+_0x3c03d0,'',''];return Buffer['from'](_0x3b2a2b[_0x57e8('0x10')](''),_0x57e8('0x49'))['toString'](_0x57e8('0x4a'));}; \ No newline at end of file +var _0x8401=['originCc','bcc','attach','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','line','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','auth=Bearer\x20','toString','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','address','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x22d023[_0x1840('0x10')](0x0,-0x1)[_0x1840('0x11')]('\x20'):_0x4e3142[_0x1840('0xb')];}return _0x1840('0x12');}function getLastName(_0x40e6fb){var _0x18053f=_[_0x1840('0x7')](_0x40e6fb['value']);if(_0x18053f&&_0x18053f[_0x1840('0xb')]){var _0x2355d5=_0x18053f[_0x1840('0xb')][_0x1840('0xe')](/\s+/);return _0x2355d5[_0x1840('0xf')]>0x1?_0x2355d5[_0x1840('0x13')]():'';}return'';}function getMails(_0x3ecbce,_0x56c939){var _0x21a468='';for(var _0x16c0a4=0x0;_0x16c0a4<_0x56c939[_0x1840('0xa')][_0x1840('0xf')];_0x16c0a4+=0x1){if(_0x56c939[_0x1840('0xa')][_0x16c0a4][_0x1840('0x8')]!==_0x3ecbce){if(!_[_0x1840('0x14')](_0x21a468)){_0x21a468+=',';}_0x21a468+=_0x56c939[_0x1840('0xa')][_0x16c0a4][_0x1840('0xb')]||_0x56c939[_0x1840('0xa')][_0x16c0a4][_0x1840('0x8')]||'';_0x21a468+='\x20<';_0x21a468+=_0x56c939[_0x1840('0xa')][_0x16c0a4]['address']?_0x56c939[_0x1840('0xa')][_0x16c0a4]['address']:_0x1840('0x15')+random['generate'](0x6)+_0x1840('0x9');_0x21a468+='>';}}return _0x21a468;}function parseEmail(_0x577327,_0x2d6a57,_0x1ed9b9){if(_0x2d6a57[_0x1840('0x16')]){var _0x251b25=/)<[^<]*)*<\/script>/gi;while(_0x251b25[_0x1840('0x17')](_0x2d6a57[_0x1840('0x16')])){_0x2d6a57[_0x1840('0x16')]=_0x2d6a57['html']['replace'](_0x251b25,'');}if(_0x2d6a57[_0x1840('0x16')][_0x1840('0x18')](_0x1840('0x19'))){var _0x7215a=[];_0x2d6a57[_0x1840('0x1a')][_0x1840('0x1b')](_0x93da6a=>{_0x7215a[_0x1840('0x1c')](_0x93da6a['filename']);});var _0x334f1a=/]+>/g;var _0x1d9dc5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2025d8=_0x2d6a57[_0x1840('0x16')][_0x1840('0x1d')](_0x1d9dc5,_0x1840('0x1e'));var _0x32fc5d=_0x2025d8[_0x1840('0x1d')](_0x334f1a,_0x1840('0x1f'));for(let _0x900b88=0x0;_0x900b88<_0x7215a[_0x1840('0xf')];_0x900b88++){var _0x44965f=_0x32fc5d[_0x1840('0x1d')]('_IMG',_0x1840('0x20')+_0x7215a[_0x900b88]+_0x1840('0x21'));_0x32fc5d=_0x44965f;}_0x2d6a57[_0x1840('0x16')]=_0x32fc5d;}_0x1ed9b9[_0x1840('0x22')]=_0x2d6a57[_0x1840('0x16')];}else{_0x1ed9b9['body']=_0x2d6a57[_0x1840('0x23')];}if(_0x1ed9b9[_0x1840('0x22')]){_0x1ed9b9[_0x1840('0x22')]=_0x1ed9b9[_0x1840('0x22')]['replace'](/0x0){var _0x33f766=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x2f104c=0x0;_0x2f104c<_0x2d6a57[_0x1840('0x33')][_0x1840('0xf')];_0x2f104c++){var _0xbe68ee=_[_0x1840('0xd')](_0x33f766,_0x2d6a57[_0x1840('0x33')][_0x2f104c][_0x1840('0x34')]);if(_0xbe68ee>=0x0){_0x1ed9b9['isAutoreply']=!![];}}}return _0x1ed9b9;}exports['parser']=function(_0x41af08,_0x49cd16,_0x33b898){var _0x1d7316={'from':getAddress(_0x49cd16['from']),'firstName':getFirstName(_0x49cd16[_0x1840('0x35')]),'lastName':getLastName(_0x49cd16[_0x1840('0x35')]),'mapKey':_0x1840('0x5'),'message':{'from':getMails(_0x41af08[_0x1840('0x5')],_0x49cd16[_0x1840('0x35')]),'to':_0x41af08['email'],'cc':'','subject':_0x49cd16[_0x1840('0x36')]||'','messageId':_0x49cd16[_0x1840('0x37')],'inReplyTo':_0x49cd16[_0x1840('0x38')],'sentAt':moment(_0x49cd16[_0x1840('0x39')])[_0x1840('0x2c')](_0x1840('0x3a')),'attach':![],'attachments':[]}};if(!_0x49cd16[_0x1840('0x16')]&&!_0x49cd16[_0x1840('0x23')]){var _0x54fa10=_['filter'](_0x49cd16[_0x1840('0x1a')],{'contentType':_0x1840('0x3b')});if(_0x54fa10[_0x1840('0xf')]){logger['info'](util[_0x1840('0x2c')](_0x1840('0x3c'),_0x49cd16['messageId']));tnef['parseBuffer'](_['first'](_0x54fa10)[_0x1840('0x31')],function(_0x4f3121,_0x2a544c){if(_0x2a544c){_0x49cd16[_0x1840('0x16')]=_0x2a544c[_0x1840('0x3d')]||_0x1840('0x3e');if(_0x2a544c[_0x1840('0x3f')]){for(var _0x5cf9a7=0x0;_0x5cf9a7<_0x2a544c['Attachments'][_0x1840('0xf')];_0x5cf9a7++){var _0x45e879=_0x2a544c[_0x1840('0x3f')][_0x5cf9a7];_0x1d7316[_0x1840('0x26')][_0x1840('0x1a')][_0x1840('0x1c')]({'filename':_0x45e879['Title'],'content':Buffer[_0x1840('0x35')](_0x45e879['Data'])});}}}_0x33b898(parseEmail(_0x41af08,_0x49cd16,_0x1d7316));});}else{_0x49cd16['html']=_0x1840('0x3e');_0x33b898(parseEmail(_0x41af08,_0x49cd16,_0x1d7316));}}else{_0x33b898(parseEmail(_0x41af08,_0x49cd16,_0x1d7316));}};exports[_0x1840('0x40')]=function(_0x1f94c1,_0x1eaf83){var _0x23031f=[_0x1840('0x41')+(_0x1eaf83||''),_0x1840('0x42')+_0x1f94c1,'',''];return Buffer[_0x1840('0x35')](_0x23031f[_0x1840('0x11')](''),'utf-8')[_0x1840('0x43')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e2deb30..0ee8545 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 _0xd2f5=['lodash','name','key','SERV','active','Imap','Smtp','exports'];(function(_0x17ecc9,_0x1f926c){var _0x22297e=function(_0x53313d){while(--_0x53313d){_0x17ecc9['push'](_0x17ecc9['shift']());}};_0x22297e(++_0x1f926c);}(_0xd2f5,0x98));var _0x5d2f=function(_0x3c7c4b,_0x2b8af1){_0x3c7c4b=_0x3c7c4b-0x0;var _0x2a4531=_0xd2f5[_0x3c7c4b];return _0x2a4531;};'use strict';var _=require(_0x5d2f('0x0'));function MailAccount(_0x20ea31){this['id']=_0x20ea31['id']||0x0;this[_0x5d2f('0x1')]=_0x20ea31[_0x5d2f('0x1')]||'Service';this[_0x5d2f('0x2')]=_0x20ea31[_0x5d2f('0x2')]||_0x5d2f('0x3');this[_0x5d2f('0x4')]=_0x20ea31['active']||![];this[_0x5d2f('0x5')]=_0x20ea31[_0x5d2f('0x5')]||[];this[_0x5d2f('0x6')]=_0x20ea31[_0x5d2f('0x6')]||[];}module[_0x5d2f('0x7')]=MailAccount; \ No newline at end of file +var _0x27d3=['Imap','Smtp','name','Service','key','active'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x27d3,0x188));var _0x327d=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x27d3[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');function MailAccount(_0x2e109a){this['id']=_0x2e109a['id']||0x0;this['name']=_0x2e109a[_0x327d('0x0')]||_0x327d('0x1');this[_0x327d('0x2')]=_0x2e109a[_0x327d('0x2')]||'SERV';this[_0x327d('0x3')]=_0x2e109a[_0x327d('0x3')]||![];this[_0x327d('0x4')]=_0x2e109a[_0x327d('0x4')]||[];this[_0x327d('0x5')]=_0x2e109a[_0x327d('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 4538331..130dc4b 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 _0x796e=['hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mergeFromDatabase'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x796e,0x1b6));var _0xe796=function(_0x5e3d83,_0x12014c){_0x5e3d83=_0x5e3d83-0x0;var _0xcb749d=_0x796e[_0x5e3d83];return _0xcb749d;};'use strict';var _=require('lodash');var MailAccount=require(_0xe796('0x0'));var Realtime=function(){this[_0xe796('0x1')]={};};function freeIsNotKey(_0x46f483,_0x1a6017,_0x301cd6){var _0x465bc2=_['mapKeys'](_0x46f483,function(_0x351a0c,_0x384ca9){return _0x351a0c[_0x301cd6];});for(var _0x46393a in _0x1a6017){if(_0x1a6017['hasOwnProperty'](_0x46393a)){if(!_0x465bc2[_0x46393a]){delete _0x1a6017[_0x46393a];}}}}Realtime['prototype'][_0xe796('0x2')]=function(_0x13db5c,_0xbe97cf){for(var _0x313283 in _0xbe97cf){if(_0x13db5c[_0xe796('0x3')](_0x313283)){_0x13db5c[_0x313283]=_0xbe97cf[_0x313283];}}};Realtime['prototype'][_0xe796('0x4')]=function(){var _0x124bb0=this;return function(_0x3cb388){if(_0x3cb388){freeIsNotKey(_0x3cb388,_0x124bb0['mailAccounts'],'id');for(var _0x54f47b=0x0,_0x580445={},_0x5616c8={};_0x54f47b<_0x3cb388[_0xe796('0x5')];_0x54f47b+=0x1){_0x580445=_0x3cb388[_0x54f47b];if(_[_0xe796('0x6')](_0x124bb0['mailAccounts'][_0x580445['id']])){_0x124bb0[_0xe796('0x1')][_0x580445['id']]=new MailAccount(_0x580445);}else{_[_0xe796('0x7')](_0x124bb0[_0xe796('0x1')][_0x580445['id']],_0x580445);}}}return _0x124bb0[_0xe796('0x1')];};};module[_0xe796('0x8')]=Realtime; \ No newline at end of file +var _0x5b92=['initMailAccounts','length','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase'];(function(_0xb13bf6,_0x1b2c9){var _0x401563=function(_0x77d4d){while(--_0x77d4d){_0xb13bf6['push'](_0xb13bf6['shift']());}};_0x401563(++_0x1b2c9);}(_0x5b92,0xfe));var _0x25b9=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x5b92[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var MailAccount=require(_0x25b9('0x0'));var Realtime=function(){this[_0x25b9('0x1')]={};};function freeIsNotKey(_0xc774e2,_0x2f31d3,_0x29409a){var _0x387354=_[_0x25b9('0x2')](_0xc774e2,function(_0x22aa50,_0xaa4d02){return _0x22aa50[_0x29409a];});for(var _0x1da063 in _0x2f31d3){if(_0x2f31d3['hasOwnProperty'](_0x1da063)){if(!_0x387354[_0x1da063]){delete _0x2f31d3[_0x1da063];}}}}Realtime[_0x25b9('0x3')][_0x25b9('0x4')]=function(_0x1669f4,_0x32b25c){for(var _0x3ef5e2 in _0x32b25c){if(_0x1669f4['hasOwnProperty'](_0x3ef5e2)){_0x1669f4[_0x3ef5e2]=_0x32b25c[_0x3ef5e2];}}};Realtime[_0x25b9('0x3')][_0x25b9('0x5')]=function(){var _0x3dbca2=this;return function(_0x5ef9e1){if(_0x5ef9e1){freeIsNotKey(_0x5ef9e1,_0x3dbca2[_0x25b9('0x1')],'id');for(var _0x14e160=0x0,_0x24cacb={},_0x56519d={};_0x14e160<_0x5ef9e1[_0x25b9('0x6')];_0x14e160+=0x1){_0x24cacb=_0x5ef9e1[_0x14e160];if(_['isUndefined'](_0x3dbca2[_0x25b9('0x1')][_0x24cacb['id']])){_0x3dbca2['mailAccounts'][_0x24cacb['id']]=new MailAccount(_0x24cacb);}else{_['merge'](_0x3dbca2[_0x25b9('0x1')][_0x24cacb['id']],_0x24cacb);}}}return _0x3dbca2['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ce8fbf5..c366c6d 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 _0xf18a=['GetMailAccount','name','provider','key','ListId','TemplateId','CloudProvider','service','type','data5','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x5cb119,_0x2867a5){var _0x12f6fe=function(_0x20ee6b){while(--_0x20ee6b){_0x5cb119['push'](_0x5cb119['shift']());}};_0x12f6fe(++_0x2867a5);}(_0xf18a,0x19d));var _0xaf18=function(_0x46675d,_0x2a75eb){_0x46675d=_0x46675d-0x0;var _0x21264c=_0xf18a[_0x46675d];return _0x21264c;};'use strict';var client=require(_0xaf18('0x0'));exports[_0xaf18('0x1')]=function(){return function(){return client[_0xaf18('0x2')](_0xaf18('0x3'),{'options':{'attributes':['id',_0xaf18('0x4'),_0xaf18('0x5'),'service','email','active',_0xaf18('0x6'),_0xaf18('0x7'),_0xaf18('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0xaf18('0x9'),'attributes':['id','name',_0xaf18('0xa'),_0xaf18('0xb'),_0xaf18('0xc')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xaf18('0xd'),'include':[{'model':_0xaf18('0x9'),'attributes':['id',_0xaf18('0x4'),'service','type',_0xaf18('0xc')],'as':_0xaf18('0x9')}]}]},'log':'getMailAccount'});};};exports[_0xaf18('0xe')]=function(_0x1cde1a,_0x420d31){return client[_0xaf18('0x2')](_0xaf18('0xf'),{'account':{'id':_0x1cde1a},'body':_0x420d31,'log':_0xaf18('0xf')});}; \ No newline at end of file +var _0x600f=['MailServerIn','Imap','type','CloudProvider','MailServerOut','Smtp','data5','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','service','email','active','key','ListId','TemplateId'];(function(_0x6dc9c2,_0x3cbe09){var _0x59b219=function(_0x15586c){while(--_0x15586c){_0x6dc9c2['push'](_0x6dc9c2['shift']());}};_0x59b219(++_0x3cbe09);}(_0x600f,0xb4));var _0xf600=function(_0x13b70f,_0x5c1116){_0x13b70f=_0x13b70f-0x0;var _0x51427c=_0x600f[_0x13b70f];return _0x51427c;};'use strict';var client=require(_0xf600('0x0'));exports[_0xf600('0x1')]=function(){return function(){return client[_0xf600('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xf600('0x3'),'provider',_0xf600('0x4'),_0xf600('0x5'),_0xf600('0x6'),_0xf600('0x7'),_0xf600('0x8'),_0xf600('0x9')],'raw':![],'include':[{'model':_0xf600('0xa'),'as':_0xf600('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0xf600('0x3'),'service',_0xf600('0xc'),'data5'],'as':_0xf600('0xd')}]},{'model':_0xf600('0xe'),'as':_0xf600('0xf'),'include':[{'model':_0xf600('0xd'),'attributes':['id','name',_0xf600('0x4'),_0xf600('0xc'),_0xf600('0x10')],'as':_0xf600('0xd')}]}]},'log':'getMailAccount'});};};exports[_0xf600('0x11')]=function(_0x5a434b,_0x40ffb8){return client[_0xf600('0x2')](_0xf600('0x12'),{'account':{'id':_0x5a434b},'body':_0x40ffb8,'log':_0xf600('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 3c8d061..7c53c7c 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 _0xb62a=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xb62a,0xd2));var _0xab62=function(_0x21dbb2,_0x343017){_0x21dbb2=_0x21dbb2-0x0;var _0x14bbd4=_0xb62a[_0x21dbb2];return _0x14bbd4;};'use strict';var client=require(_0xab62('0x0'));exports[_0xab62('0x1')]=function(){return client[_0xab62('0x2')](_0xab62('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xab62('0x4')]},'log':_0xab62('0x5')});}; \ No newline at end of file +var _0x5749=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x1cf11b,_0x3f87bf){var _0x45688c=function(_0x4ad1ad){while(--_0x4ad1ad){_0x1cf11b['push'](_0x1cf11b['shift']());}};_0x45688c(++_0x3f87bf);}(_0x5749,0xa3));var _0x9574=function(_0x5d25a9,_0x4f16d1){_0x5d25a9=_0x5d25a9-0x0;var _0x183cec=_0x5749[_0x5d25a9];return _0x183cec;};'use strict';var client=require(_0x9574('0x0'));exports[_0x9574('0x1')]=function(){return client[_0x9574('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9574('0x3')]},'log':_0x9574('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c36524a..64aa5ef 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 7bff017..a9d1480 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 _0xa095=['http','express','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x5ddce5,_0x68f4e6){var _0x146fb8=function(_0x3b98d0){while(--_0x3b98d0){_0x5ddce5['push'](_0x5ddce5['shift']());}};_0x146fb8(++_0x68f4e6);}(_0xa095,0x126));var _0x5a09=function(_0x207140,_0x4c6556){_0x207140=_0x207140-0x0;var _0x39e8cf=_0xa095[_0x207140];return _0x39e8cf;};'use strict';var _=require('lodash');var http=require(_0x5a09('0x0'));var express=require(_0x5a09('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x5a09('0x2')](app);server[_0x5a09('0x3')]=0xdbba0;if(sticky[_0x5a09('0x4')](server,config[_0x5a09('0x5')])){var socketio=require(_0x5a09('0x6'))(server,{'transports':[_0x5a09('0x7'),_0x5a09('0x8')]});config[_0x5a09('0x9')]=_[_0x5a09('0xa')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x5a09('0xb')](require(_0x5a09('0xc'))({'pubClient':new Redis(config[_0x5a09('0x9')]),'subClient':new Redis(config[_0x5a09('0x9')])}));require(_0x5a09('0xd'))[_0x5a09('0xe')]();require('../../config/socketio')[_0x5a09('0xe')](socketio);require(_0x5a09('0xf'))[_0x5a09('0xe')](app);require(_0x5a09('0x10'))[_0x5a09('0xe')](app);}else{server[_0x5a09('0x11')]('listening',function(){console[_0x5a09('0x12')](_0x5a09('0x13'),config[_0x5a09('0x5')]);});}exports=module[_0x5a09('0x14')]=app; \ No newline at end of file +var _0xce8c=['polling','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','websocket'];(function(_0x2066c8,_0xdab961){var _0x10d0df=function(_0x498821){while(--_0x498821){_0x2066c8['push'](_0x2066c8['shift']());}};_0x10d0df(++_0xdab961);}(_0xce8c,0x1da));var _0xcce8=function(_0x28f198,_0x540d75){_0x28f198=_0x28f198-0x0;var _0x3f7e71=_0xce8c[_0x28f198];return _0x3f7e71;};'use strict';var _=require(_0xcce8('0x0'));var http=require('http');var express=require(_0xcce8('0x1'));var sticky=require(_0xcce8('0x2'));var Redis=require(_0xcce8('0x3'));var config=require(_0xcce8('0x4'));var app=express();var server=http['createServer'](app);server[_0xcce8('0x5')]=0xdbba0;if(sticky[_0xcce8('0x6')](server,config[_0xcce8('0x7')])){var socketio=require(_0xcce8('0x8'))(server,{'transports':[_0xcce8('0x9'),_0xcce8('0xa')]});config[_0xcce8('0xb')]=_[_0xcce8('0xc')](config[_0xcce8('0xb')],{'host':_0xcce8('0xd'),'port':0x18eb});socketio[_0xcce8('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0xcce8('0xb')]),'subClient':new Redis(config[_0xcce8('0xb')])}));require(_0xcce8('0xf'))[_0xcce8('0x10')]();require(_0xcce8('0x11'))[_0xcce8('0x10')](socketio);require('../../config/express')[_0xcce8('0x10')](app);require('../../routes')[_0xcce8('0x10')](app);}else{server[_0xcce8('0x12')](_0xcce8('0x13'),function(){console[_0xcce8('0x14')](_0xcce8('0x15'),config[_0xcce8('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 95eb66a..6dd04d6 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 _0x5cf7=['Request','request','then','error','rpc','message','result','catch','exports','jayson/promise','bluebird','routing','client','http'];(function(_0x44540d,_0x361ed2){var _0x3cb1e3=function(_0x6439ec){while(--_0x6439ec){_0x44540d['push'](_0x44540d['shift']());}};_0x3cb1e3(++_0x361ed2);}(_0x5cf7,0xdb));var _0x75cf=function(_0x3a0cbf,_0x45f7a2){_0x3a0cbf=_0x3a0cbf-0x0;var _0x4e9054=_0x5cf7[_0x3a0cbf];return _0x4e9054;};'use strict';var jayson=require(_0x75cf('0x0'));var BPromise=require(_0x75cf('0x1'));var logger=require('../../config/logger')(_0x75cf('0x2'));var client=jayson[_0x75cf('0x3')][_0x75cf('0x4')]({'port':0x2329});client[_0x75cf('0x5')]=function(_0x5f64a2,_0x3e8711){return new BPromise(function(_0x2290f0,_0x243022){return client[_0x75cf('0x6')](_0x5f64a2,_0x3e8711)[_0x75cf('0x7')](function(_0x58be3e){logger['debug']('rpc',_0x75cf('0x2'),_0x5f64a2,_0x3e8711,_0x58be3e);if(_0x58be3e[_0x75cf('0x8')]){logger[_0x75cf('0x8')](_0x75cf('0x9'),_0x75cf('0x2'),_0x5f64a2,_0x58be3e[_0x75cf('0x8')][_0x75cf('0xa')],_0x3e8711);return _0x243022(_0x58be3e[_0x75cf('0x8')][_0x75cf('0xa')]);}else{return _0x2290f0(_0x58be3e[_0x75cf('0xb')]);}})[_0x75cf('0xc')](function(_0x3bc974){logger[_0x75cf('0x8')](_0x75cf('0x9'),'routing',_0x5f64a2,_0x3bc974,_0x3e8711);return _0x243022(_0x3bc974);});});};module[_0x75cf('0xd')]=client; \ No newline at end of file +var _0x51f2=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','result','catch','exports'];(function(_0x47cde9,_0x19d013){var _0x26fdf1=function(_0x32fb69){while(--_0x32fb69){_0x47cde9['push'](_0x47cde9['shift']());}};_0x26fdf1(++_0x19d013);}(_0x51f2,0xf0));var _0x251f=function(_0x24bd98,_0x561eff){_0x24bd98=_0x24bd98-0x0;var _0x2c3215=_0x51f2[_0x24bd98];return _0x2c3215;};'use strict';var jayson=require(_0x251f('0x0'));var BPromise=require(_0x251f('0x1'));var logger=require(_0x251f('0x2'))(_0x251f('0x3'));var client=jayson[_0x251f('0x4')][_0x251f('0x5')]({'port':0x2329});client[_0x251f('0x6')]=function(_0x2ff39c,_0x3ae79c){return new BPromise(function(_0x533f65,_0x1ecb97){return client['request'](_0x2ff39c,_0x3ae79c)[_0x251f('0x7')](function(_0x55b2c9){logger[_0x251f('0x8')](_0x251f('0x9'),_0x251f('0x3'),_0x2ff39c,_0x3ae79c,_0x55b2c9);if(_0x55b2c9['error']){logger['error'](_0x251f('0x9'),_0x251f('0x3'),_0x2ff39c,_0x55b2c9[_0x251f('0xa')]['message'],_0x3ae79c);return _0x1ecb97(_0x55b2c9[_0x251f('0xa')][_0x251f('0xb')]);}else{return _0x533f65(_0x55b2c9[_0x251f('0xc')]);}})[_0x251f('0xd')](function(_0xd182f4){logger['error'](_0x251f('0x9'),_0x251f('0x3'),_0x2ff39c,_0xd182f4,_0x3ae79c);return _0x1ecb97(_0xd182f4);});});};module[_0x251f('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9600290..edea8fb 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 _0x2b9c=['getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues'];(function(_0x20875c,_0x1952d2){var _0x2d1d0a=function(_0x3d76c3){while(--_0x3d76c3){_0x20875c['push'](_0x20875c['shift']());}};_0x2d1d0a(++_0x1952d2);}(_0x2b9c,0x131));var _0xc2b9=function(_0x57a2a6,_0x3d21b2){_0x57a2a6=_0x57a2a6-0x0;var _0x74724a=_0x2b9c[_0x57a2a6];return _0x74724a;};'use strict';var BPromise=require(_0xc2b9('0x0'));var server=require(_0xc2b9('0x1'));var Realtime=require('./realtime');var user=require(_0xc2b9('0x2'));var interval=require(_0xc2b9('0x3'));var openchannelQueue=require(_0xc2b9('0x4'));var chatQueue=require(_0xc2b9('0x5'));var smsQueue=require(_0xc2b9('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xc2b9('0x7'));var whatsappQueue=require(_0xc2b9('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc2b9('0x9')]()['then'](user[_0xc2b9('0xa')]())[_0xc2b9('0xb')](realtime[_0xc2b9('0xc')]())[_0xc2b9('0xb')](interval['getIntervals']())['then'](realtime['initIntervals']())[_0xc2b9('0xb')](openchannelQueue[_0xc2b9('0xd')]())[_0xc2b9('0xb')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xc2b9('0xe')]())[_0xc2b9('0xb')](realtime['initChatQueues']())[_0xc2b9('0xb')](smsQueue[_0xc2b9('0xf')]())[_0xc2b9('0xb')](realtime[_0xc2b9('0x10')]())['then'](mailQueue[_0xc2b9('0x11')]())['then'](realtime['initMailQueues']())[_0xc2b9('0xb')](faxQueue[_0xc2b9('0x12')]())[_0xc2b9('0xb')](realtime[_0xc2b9('0x13')]())[_0xc2b9('0xb')](whatsappQueue[_0xc2b9('0x14')]())['then'](realtime[_0xc2b9('0x15')]())[_0xc2b9('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xc2b9('0xb')](function(_0x302968){return initRealtime();})[_0xc2b9('0xb')](function(_0x530242){return setInterval(initRealtime,0x1388);})['catch'](function(_0x1157b9){console[_0xc2b9('0x16')](_0x1157b9);});}main(); \ No newline at end of file +var _0x1a81=['./rpc/faxQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x18a084,_0x2b6935){var _0x284dab=function(_0x2d76d2){while(--_0x2d76d2){_0x18a084['push'](_0x18a084['shift']());}};_0x284dab(++_0x2b6935);}(_0x1a81,0xf7));var _0x11a8=function(_0x5eaa09,_0x5c955a){_0x5eaa09=_0x5eaa09-0x0;var _0x110611=_0x1a81[_0x5eaa09];return _0x110611;};'use strict';var BPromise=require(_0x11a8('0x0'));var server=require(_0x11a8('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x11a8('0x2'));var openchannelQueue=require(_0x11a8('0x3'));var chatQueue=require(_0x11a8('0x4'));var smsQueue=require(_0x11a8('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x11a8('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x11a8('0x7')]()[_0x11a8('0x8')](user['getAgents']())[_0x11a8('0x8')](realtime[_0x11a8('0x9')]())[_0x11a8('0x8')](interval[_0x11a8('0xa')]())[_0x11a8('0x8')](realtime[_0x11a8('0xb')]())[_0x11a8('0x8')](openchannelQueue[_0x11a8('0xc')]())[_0x11a8('0x8')](realtime[_0x11a8('0xd')]())[_0x11a8('0x8')](chatQueue[_0x11a8('0xe')]())['then'](realtime[_0x11a8('0xf')]())['then'](smsQueue[_0x11a8('0x10')]())[_0x11a8('0x8')](realtime['initSmsQueues']())[_0x11a8('0x8')](mailQueue['getMailQueues']())[_0x11a8('0x8')](realtime[_0x11a8('0x11')]())[_0x11a8('0x8')](faxQueue[_0x11a8('0x12')]())['then'](realtime['initFaxQueues']())[_0x11a8('0x8')](whatsappQueue[_0x11a8('0x13')]())[_0x11a8('0x8')](realtime['initWhatsappQueues']())[_0x11a8('0x8')](function(){return realtime;});}function main(){return server[_0x11a8('0x14')](realtime)[_0x11a8('0x8')](function(_0x26ff9){return initRealtime();})[_0x11a8('0x8')](function(_0x2a6a5d){return setInterval(initRealtime,0x1388);})[_0x11a8('0x15')](function(_0x280a68){console[_0x11a8('0x16')](_0x280a68);});}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 dbcee85..a1b98fc 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x574ecb,_0x4809dc){var _0x1fa23e=function(_0x484b28){while(--_0x484b28){_0x574ecb['push'](_0x574ecb['shift']());}};_0x1fa23e(++_0x4809dc);}(_0x2ef3,0xba));var _0x32ef=function(_0xe72288,_0x21ef51){_0xe72288=_0xe72288-0x0;var _0x3f599d=_0x2ef3[_0xe72288];return _0x3f599d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x3c6a84,_0x5224ec){var _0xda6483=function(_0x367f7b){while(--_0x367f7b){_0x3c6a84['push'](_0x3c6a84['shift']());}};_0xda6483(++_0x5224ec);}(_0x7a54,0x106));var _0x47a5=function(_0xf35e2,_0x4a82b6){_0xf35e2=_0xf35e2-0x0;var _0x4b563b=_0x7a54[_0xf35e2];return _0x4b563b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 20158b9..35e5b3f 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 _0x712e=['then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x200e99,_0x48fa2f){var _0x4c2df0=function(_0x51a049){while(--_0x51a049){_0x200e99['push'](_0x200e99['shift']());}};_0x4c2df0(++_0x48fa2f);}(_0x712e,0xc4));var _0xe712=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x712e[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xe712('0x0'));var jayson=require(_0xe712('0x1'));var client=jayson[_0xe712('0x2')][_0xe712('0x3')]({'port':0x232b});function request(_0x266d04,_0x440bf8){return new BPromise(function(_0x16d44b,_0x256b1c){return client['request'](_0x266d04,_0x440bf8)[_0xe712('0x4')](function(_0x55586f){if(_0x55586f[_0xe712('0x5')]){return _0x256b1c(_0x55586f[_0xe712('0x5')][_0xe712('0x6')]);}else{return _0x16d44b(_0x55586f[_0xe712('0x7')]);}})['catch'](function(_0x5d1718){return _0x256b1c(_0x5d1718);});});}exports[_0xe712('0x8')]=function(_0x5c92ae,_0x50d248){return request(_0xe712('0x9'),{'account':_0x5c92ae,'message':_0x50d248});}; \ No newline at end of file +var _0x145a=['request','then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x1d2a2c,_0x223570){var _0x22be09=function(_0x28997d){while(--_0x28997d){_0x1d2a2c['push'](_0x1d2a2c['shift']());}};_0x22be09(++_0x223570);}(_0x145a,0x93));var _0xa145=function(_0x3caba3,_0x1783b1){_0x3caba3=_0x3caba3-0x0;var _0x58e863=_0x145a[_0x3caba3];return _0x58e863;};'use strict';var BPromise=require(_0xa145('0x0'));var jayson=require(_0xa145('0x1'));var client=jayson['client'][_0xa145('0x2')]({'port':0x232b});function request(_0x4f8fef,_0x5f5094){return new BPromise(function(_0x305df3,_0x6da5be){return client[_0xa145('0x3')](_0x4f8fef,_0x5f5094)[_0xa145('0x4')](function(_0x298e7a){if(_0x298e7a['error']){return _0x6da5be(_0x298e7a[_0xa145('0x5')][_0xa145('0x6')]);}else{return _0x305df3(_0x298e7a[_0xa145('0x7')]);}})['catch'](function(_0x511b5){return _0x6da5be(_0x511b5);});});}exports[_0xa145('0x8')]=function(_0x474c77,_0x2d946f){return request(_0xa145('0x9'),{'account':_0x474c77,'message':_0x2d946f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 53d182d..963a16e 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 _0x883f=['idle','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','name','online','mailCurrentCapacity','faxCapacity','whatsappCurrentCapacity','chatWaitingInteractions','openchannelWaitingInteractions','emit','user:routing:update','lodash','md5','defaults','redis','localhost','socket.io-emitter','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x425943,_0x1849d9){var _0x268dab=function(_0x44af58){while(--_0x44af58){_0x425943['push'](_0x425943['shift']());}};_0x268dab(++_0x1849d9);}(_0x883f,0x175));var _0xf883=function(_0x416e2f,_0x59640b){_0x416e2f=_0x416e2f-0x0;var _0x551d4a=_0x883f[_0x416e2f];return _0x551d4a;};'use strict';var _=require(_0xf883('0x0'));var moment=require('moment');var md5=require(_0xf883('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xf883('0x2')](config[_0xf883('0x3')],{'host':_0xf883('0x4'),'port':0x18eb});var io=require(_0xf883('0x5'))(new Redis(config[_0xf883('0x3')]));function Agent(_0x494bfc){this['id']=_0x494bfc['id']||0x0;this['name']=_0x494bfc['name']||'';this['voicePause']=_0x494bfc[_0xf883('0x6')]||![];this[_0xf883('0x7')]=_0x494bfc[_0xf883('0x7')]||![];this[_0xf883('0x8')]=_0x494bfc['mailPause']||![];this[_0xf883('0x9')]=_0x494bfc[_0xf883('0x9')]||![];this[_0xf883('0xa')]=_0x494bfc['smsPause']||![];this[_0xf883('0xb')]=_0x494bfc[_0xf883('0xb')]||![];this[_0xf883('0xc')]=_0xf883('0xd');this[_0xf883('0xe')]=0x0;this['chatCapacity']=_0x494bfc[_0xf883('0xf')]||0x0;this[_0xf883('0x10')]=0x0;this[_0xf883('0x11')]=_0xf883('0xd');this[_0xf883('0x12')]=0x0;this[_0xf883('0x13')]=_0x494bfc[_0xf883('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xf883('0x14')]=_0xf883('0xd');this['faxStatusTime']=0x0;this['faxCapacity']=_0x494bfc['faxCapacity']||0x0;this[_0xf883('0x15')]=0x0;this['smsStatus']='unknown';this[_0xf883('0x16')]=0x0;this[_0xf883('0x17')]=_0x494bfc[_0xf883('0x17')]||0x0;this[_0xf883('0x18')]=0x0;this[_0xf883('0x19')]=_0xf883('0xd');this['whatsappStatusTime']=0x0;this[_0xf883('0x1a')]=_0x494bfc[_0xf883('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xf883('0xd');this[_0xf883('0x1b')]=0x0;this['openchannelCapacity']=_0x494bfc[_0xf883('0x1c')]||0x0;this[_0xf883('0x1d')]=0x0;this[_0xf883('0x1e')]=![];this[_0xf883('0x1f')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0xf883('0x20')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0xf883('0x21')]={};this['whatsappWaitingInteractions']={};this[_0xf883('0x22')]();}Agent[_0xf883('0x23')]['getChannelStatus']=function(_0x298337){if(this[_0x298337+_0xf883('0x24')]>0x0){if(this[_0x298337+_0xf883('0x25')]>0x0&&this[_0x298337+_0xf883('0x24')]>=this[_0x298337+_0xf883('0x25')]){return _0xf883('0x26');}else{return _0xf883('0x27');}}else{return _0xf883('0x28');}};Agent[_0xf883('0x23')][_0xf883('0x22')]=function(){var _0x58fb3c=['mail',_0xf883('0x29'),_0xf883('0x2a'),_0xf883('0x2b'),_0xf883('0x2c'),_0xf883('0x2d')];for(var _0x9b26c8=0x0;_0x9b26c8<_0x58fb3c[_0xf883('0x2e')];_0x9b26c8+=0x1){var _0x22e616=this['getChannelStatus'](_0x58fb3c[_0x9b26c8]);if(this[_0x58fb3c[_0x9b26c8]+_0xf883('0x2f')]!==_0x22e616){this[_0x58fb3c[_0x9b26c8]+'StatusTime']=_[_0xf883('0x30')](moment()[_0xf883('0x31')]('x'));}this[_0x58fb3c[_0x9b26c8]+_0xf883('0x2f')]=_0x22e616;}var _0x4d9316={'id':this['id'],'name':this[_0xf883('0x32')],'online':this[_0xf883('0x33')],'voicePause':this['voicePause'],'chatPause':this[_0xf883('0x7')],'mailPause':this[_0xf883('0x8')],'smsPause':this[_0xf883('0xa')],'faxPause':this[_0xf883('0x9')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xf883('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xf883('0xf')],'chatCurrentCapacity':this[_0xf883('0x10')],'mailStatus':this[_0xf883('0x11')],'mailStatusTime':this[_0xf883('0x12')],'mailCapacity':this[_0xf883('0x13')],'mailCurrentCapacity':this[_0xf883('0x34')],'faxStatus':this[_0xf883('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xf883('0x35')],'faxCurrentCapacity':this[_0xf883('0x15')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xf883('0x16')],'smsCapacity':this[_0xf883('0x17')],'smsCurrentCapacity':this[_0xf883('0x18')],'whatsappStatus':this[_0xf883('0x19')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xf883('0x36')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf883('0x1b')],'openchannelCapacity':this[_0xf883('0x1c')],'openchannelCurrentCapacity':this[_0xf883('0x1d')],'busy':this[_0xf883('0x1e')],'busyQueue':this[_0xf883('0x1f')],'chatWaitingInteractions':this[_0xf883('0x37')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xf883('0x38')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x31ceb9=md5(JSON['stringify'](_0x4d9316));if(this[_0xf883('0x1')]!==_0x31ceb9){this['md5']=_0x31ceb9;io[_0xf883('0x39')](_0xf883('0x3a'),_0x4d9316);}};module['exports']=Agent; \ No newline at end of file +var _0x52fc=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCurrentCapacity','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','faxCapacity','openchannelStatus','openchannelStatusTime','busy','busyQueue','smsWaitingInteractions','emit','lodash','moment','md5','defaults','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x4ea1ab,_0x1187f7){var _0x2adbdc=function(_0x33eee5){while(--_0x33eee5){_0x4ea1ab['push'](_0x4ea1ab['shift']());}};_0x2adbdc(++_0x1187f7);}(_0x52fc,0x162));var _0xc52f=function(_0x30c111,_0x5147ba){_0x30c111=_0x30c111-0x0;var _0x1c7c1d=_0x52fc[_0x30c111];return _0x1c7c1d;};'use strict';var _=require(_0xc52f('0x0'));var moment=require(_0xc52f('0x1'));var md5=require(_0xc52f('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xc52f('0x3')](config[_0xc52f('0x4')],{'host':_0xc52f('0x5'),'port':0x18eb});var io=require(_0xc52f('0x6'))(new Redis(config[_0xc52f('0x4')]));function Agent(_0x2c1a71){this['id']=_0x2c1a71['id']||0x0;this[_0xc52f('0x7')]=_0x2c1a71[_0xc52f('0x7')]||'';this[_0xc52f('0x8')]=_0x2c1a71[_0xc52f('0x8')]||![];this['chatPause']=_0x2c1a71[_0xc52f('0x9')]||![];this['mailPause']=_0x2c1a71[_0xc52f('0xa')]||![];this[_0xc52f('0xb')]=_0x2c1a71[_0xc52f('0xb')]||![];this[_0xc52f('0xc')]=_0x2c1a71['smsPause']||![];this[_0xc52f('0xd')]=_0x2c1a71[_0xc52f('0xd')]||![];this[_0xc52f('0xe')]=_0xc52f('0xf');this[_0xc52f('0x10')]=0x0;this[_0xc52f('0x11')]=_0x2c1a71[_0xc52f('0x11')]||0x0;this[_0xc52f('0x12')]=0x0;this[_0xc52f('0x13')]=_0xc52f('0xf');this[_0xc52f('0x14')]=0x0;this['mailCapacity']=_0x2c1a71[_0xc52f('0x15')]||0x0;this[_0xc52f('0x16')]=0x0;this['faxStatus']=_0xc52f('0xf');this['faxStatusTime']=0x0;this['faxCapacity']=_0x2c1a71['faxCapacity']||0x0;this[_0xc52f('0x17')]=0x0;this[_0xc52f('0x18')]=_0xc52f('0xf');this[_0xc52f('0x19')]=0x0;this[_0xc52f('0x1a')]=_0x2c1a71['smsCapacity']||0x0;this[_0xc52f('0x1b')]=0x0;this[_0xc52f('0x1c')]='unknown';this[_0xc52f('0x1d')]=0x0;this[_0xc52f('0x1e')]=_0x2c1a71[_0xc52f('0x1e')]||0x0;this[_0xc52f('0x1f')]=0x0;this['openchannelStatus']=_0xc52f('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x2c1a71['openchannelCapacity']||0x0;this[_0xc52f('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0xc52f('0x21')]={};this[_0xc52f('0x22')]={};this[_0xc52f('0x23')]={};this[_0xc52f('0x24')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0xc52f('0x25')]();}Agent['prototype'][_0xc52f('0x26')]=function(_0x528ce5){if(this[_0x528ce5+_0xc52f('0x27')]>0x0){if(this[_0x528ce5+_0xc52f('0x28')]>0x0&&this[_0x528ce5+_0xc52f('0x27')]>=this[_0x528ce5+_0xc52f('0x28')]){return _0xc52f('0x29');}else{return _0xc52f('0x2a');}}else{return'idle';}};Agent[_0xc52f('0x2b')][_0xc52f('0x25')]=function(){var _0x1755a2=[_0xc52f('0x2c'),_0xc52f('0x2d'),_0xc52f('0x2e'),_0xc52f('0x2f'),_0xc52f('0x30'),_0xc52f('0x31')];for(var _0x5d18bd=0x0;_0x5d18bd<_0x1755a2[_0xc52f('0x32')];_0x5d18bd+=0x1){var _0x363ae7=this[_0xc52f('0x26')](_0x1755a2[_0x5d18bd]);if(this[_0x1755a2[_0x5d18bd]+'Status']!==_0x363ae7){this[_0x1755a2[_0x5d18bd]+_0xc52f('0x33')]=_[_0xc52f('0x34')](moment()[_0xc52f('0x35')]('x'));}this[_0x1755a2[_0x5d18bd]+_0xc52f('0x36')]=_0x363ae7;}var _0x463433={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xc52f('0x8')],'chatPause':this[_0xc52f('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0xc52f('0xc')],'faxPause':this[_0xc52f('0xb')],'openchannelPause':this[_0xc52f('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc52f('0x10')],'chatCapacity':this[_0xc52f('0x11')],'chatCurrentCapacity':this[_0xc52f('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xc52f('0x14')],'mailCapacity':this[_0xc52f('0x15')],'mailCurrentCapacity':this[_0xc52f('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xc52f('0x37')],'faxCurrentCapacity':this[_0xc52f('0x17')],'smsStatus':this[_0xc52f('0x18')],'smsStatusTime':this[_0xc52f('0x19')],'smsCapacity':this[_0xc52f('0x1a')],'smsCurrentCapacity':this[_0xc52f('0x1b')],'whatsappStatus':this[_0xc52f('0x1c')],'whatsappStatusTime':this[_0xc52f('0x1d')],'whatsappCapacity':this[_0xc52f('0x1e')],'whatsappCurrentCapacity':this[_0xc52f('0x1f')],'openchannelStatus':this[_0xc52f('0x38')],'openchannelStatusTime':this[_0xc52f('0x39')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc52f('0x20')],'busy':this[_0xc52f('0x3a')],'busyQueue':this[_0xc52f('0x3b')],'chatWaitingInteractions':this[_0xc52f('0x21')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xc52f('0x24')],'smsWaitingInteractions':this[_0xc52f('0x3c')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x4a3d63=md5(JSON['stringify'](_0x463433));if(this[_0xc52f('0x2')]!==_0x4a3d63){this[_0xc52f('0x2')]=_0x4a3d63;io[_0xc52f('0x3d')]('user:routing:update',_0x463433);}};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 9300212..7efefbe 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 _0x6c43=['loggedIn','paused','length','online','chatPause','available','md5','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x6c43,0x12c));var _0x36c4=function(_0x18b165,_0x40a7ea){_0x18b165=_0x18b165-0x0;var _0x1d8e19=_0x6c43[_0x18b165];return _0x1d8e19;};'use strict';var _=require(_0x36c4('0x0'));var md5=require('md5');var util=require(_0x36c4('0x1'));var Redis=require(_0x36c4('0x2'));var config=require(_0x36c4('0x3'));config['redis']=_[_0x36c4('0x4')](config['redis'],{'host':_0x36c4('0x5'),'port':0x18eb});var io=require(_0x36c4('0x6'))(new Redis(config[_0x36c4('0x7')]));function ChatQueue(_0x2b3f53){this['id']=_0x2b3f53['id']||0x0;this[_0x36c4('0x8')]=_0x2b3f53[_0x36c4('0x8')]||'';this['timeout']=_0x2b3f53[_0x36c4('0x9')]||0xa;this[_0x36c4('0xa')]=_0x2b3f53[_0x36c4('0xa')]||_0x36c4('0xb');this[_0x36c4('0xc')]=_0x2b3f53['Agents'];this['mapAgentsId']={};this[_0x36c4('0xd')]=0x0;this['md5']='';this[_0x36c4('0xe')]();this[_0x36c4('0xf')]();}ChatQueue[_0x36c4('0x10')][_0x36c4('0xe')]=function(){var _0x201480=this[_0x36c4('0x11')][_0x36c4('0x12')];this[_0x36c4('0x11')]=_['map'](this[_0x36c4('0xc')],'id');this['mapAgentsId'][_0x36c4('0x12')]=_0x201480;};ChatQueue[_0x36c4('0x10')][_0x36c4('0xf')]=function(){this[_0x36c4('0x13')]=0x0;this[_0x36c4('0x14')]=0x0;for(var _0x539f44=0x0;_0x539f44=0x0?this[_0x36c4('0x18')]:0x0;var _0x2970ca={'id':this['id'],'available':this['available'],'loggedIn':this[_0x36c4('0x13')],'name':this[_0x36c4('0x8')],'paused':this['paused'],'waiting':this[_0x36c4('0xd')]};var _0x43ffc9=md5(JSON['stringify'](_0x2970ca));if(this[_0x36c4('0x19')]!==_0x43ffc9){this['md5']=_0x43ffc9;io['to'](util['format']('chat:queue:%s',_0x2970ca[_0x36c4('0x8')]))[_0x36c4('0x1a')](_0x36c4('0x1b'),_0x2970ca);}};module[_0x36c4('0x1c')]=ChatQueue; \ No newline at end of file +var _0x5573=['../../../config/environment','defaults','redis','localhost','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','chatPause','available','name','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis'];(function(_0x5bb44d,_0x45c789){var _0x3ffe2f=function(_0xd48658){while(--_0xd48658){_0x5bb44d['push'](_0x5bb44d['shift']());}};_0x3ffe2f(++_0x45c789);}(_0x5573,0xab));var _0x3557=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x5573[_0x2a7b50];return _0x4224c9;};'use strict';var _=require(_0x3557('0x0'));var md5=require(_0x3557('0x1'));var util=require('util');var Redis=require(_0x3557('0x2'));var config=require(_0x3557('0x3'));config['redis']=_[_0x3557('0x4')](config[_0x3557('0x5')],{'host':_0x3557('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3557('0x5')]));function ChatQueue(_0x15b9b9){this['id']=_0x15b9b9['id']||0x0;this['name']=_0x15b9b9['name']||'';this['timeout']=_0x15b9b9['timeout']||0xa;this[_0x3557('0x7')]=_0x15b9b9[_0x3557('0x7')]||_0x3557('0x8');this[_0x3557('0x9')]=_0x15b9b9[_0x3557('0x9')];this[_0x3557('0xa')]={};this[_0x3557('0xb')]=0x0;this[_0x3557('0x1')]='';this[_0x3557('0xc')]();this['updateRealtime']();}ChatQueue[_0x3557('0xd')][_0x3557('0xc')]=function(){var _0x53eb2f=this['mapAgentsId']['_rr'];this[_0x3557('0xa')]=_['map'](this[_0x3557('0x9')],'id');this[_0x3557('0xa')][_0x3557('0xe')]=_0x53eb2f;};ChatQueue[_0x3557('0xd')][_0x3557('0xf')]=function(){this[_0x3557('0x10')]=0x0;this[_0x3557('0x11')]=0x0;for(var _0xb6a9a6=0x0;_0xb6a9a6=0x0?this['available']:0x0;var _0x7329c8={'id':this['id'],'available':this[_0x3557('0x15')],'loggedIn':this[_0x3557('0x10')],'name':this[_0x3557('0x16')],'paused':this[_0x3557('0x11')],'waiting':this[_0x3557('0xb')]};var _0x5b66b7=md5(JSON[_0x3557('0x17')](_0x7329c8));if(this[_0x3557('0x1')]!==_0x5b66b7){this[_0x3557('0x1')]=_0x5b66b7;io['to'](util[_0x3557('0x18')](_0x3557('0x19'),_0x7329c8[_0x3557('0x16')]))[_0x3557('0x1a')](_0x3557('0x1b'),_0x7329c8);}};module[_0x3557('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3a2b963..ffd773a 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 _0xadc0=['updateRealtime','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadc0,0x94));var _0x0adc=function(_0xae7878,_0x3abb86){_0xae7878=_0xae7878-0x0;var _0x415a1b=_0xadc0[_0xae7878];return _0x415a1b;};'use strict';var _=require('lodash');var md5=require(_0x0adc('0x0'));var util=require(_0x0adc('0x1'));var Redis=require(_0x0adc('0x2'));var config=require(_0x0adc('0x3'));config[_0x0adc('0x4')]=_['defaults'](config[_0x0adc('0x4')],{'host':_0x0adc('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0adc('0x4')]));function FaxQueue(_0x4f8975){this['id']=_0x4f8975['id']||0x0;this['name']=_0x4f8975[_0x0adc('0x6')]||'';this[_0x0adc('0x7')]=_0x4f8975[_0x0adc('0x7')]||0xa;this[_0x0adc('0x8')]=_0x4f8975[_0x0adc('0x8')]||_0x0adc('0x9');this[_0x0adc('0xa')]=_0x4f8975['Agents'];this[_0x0adc('0xb')]={};this[_0x0adc('0xc')]=0x0;this[_0x0adc('0x0')]='';this[_0x0adc('0xd')]();this[_0x0adc('0xe')]();}FaxQueue['prototype'][_0x0adc('0xd')]=function(){var _0x172fc1=this['mapAgentsId'][_0x0adc('0xf')];this[_0x0adc('0xb')]=_['map'](this[_0x0adc('0xa')],'id');this[_0x0adc('0xb')][_0x0adc('0xf')]=_0x172fc1;};FaxQueue[_0x0adc('0x10')][_0x0adc('0xe')]=function(){this[_0x0adc('0x11')]=0x0;this[_0x0adc('0x12')]=0x0;for(var _0x572875=0x0;_0x572875=0x0?this[_0x0adc('0x16')]:0x0;var _0x4fe1ed={'id':this['id'],'available':this[_0x0adc('0x16')],'loggedIn':this[_0x0adc('0x11')],'name':this[_0x0adc('0x6')],'paused':this[_0x0adc('0x12')],'waiting':this['waiting']};var _0x5376b0=md5(JSON[_0x0adc('0x17')](_0x4fe1ed));if(this[_0x0adc('0x0')]!==_0x5376b0){this[_0x0adc('0x0')]=_0x5376b0;io['to'](util['format']('fax:queue:%s',_0x4fe1ed['name']))[_0x0adc('0x18')](_0x0adc('0x19'),_0x4fe1ed);}};module[_0x0adc('0x1a')]=FaxQueue; \ No newline at end of file +var _0xae85=['strategy','beepall','Agents','mapAgentsId','md5','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','emit','lodash','util','../../../config/environment','redis','defaults','localhost','name','timeout'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xae85,0x7a));var _0x5ae8=function(_0x10c6a4,_0x10bb3a){_0x10c6a4=_0x10c6a4-0x0;var _0x3ee9a9=_0xae85[_0x10c6a4];return _0x3ee9a9;};'use strict';var _=require(_0x5ae8('0x0'));var md5=require('md5');var util=require(_0x5ae8('0x1'));var Redis=require('ioredis');var config=require(_0x5ae8('0x2'));config[_0x5ae8('0x3')]=_[_0x5ae8('0x4')](config[_0x5ae8('0x3')],{'host':_0x5ae8('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ae8('0x3')]));function FaxQueue(_0x186855){this['id']=_0x186855['id']||0x0;this[_0x5ae8('0x6')]=_0x186855[_0x5ae8('0x6')]||'';this[_0x5ae8('0x7')]=_0x186855['timeout']||0xa;this[_0x5ae8('0x8')]=_0x186855[_0x5ae8('0x8')]||_0x5ae8('0x9');this[_0x5ae8('0xa')]=_0x186855[_0x5ae8('0xa')];this[_0x5ae8('0xb')]={};this['waiting']=0x0;this[_0x5ae8('0xc')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x5ae8('0xd')][_0x5ae8('0xe')]=function(){var _0xd45a33=this[_0x5ae8('0xb')]['_rr'];this[_0x5ae8('0xb')]=_[_0x5ae8('0xf')](this[_0x5ae8('0xa')],'id');this[_0x5ae8('0xb')][_0x5ae8('0x10')]=_0xd45a33;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x5ae8('0x11')]=0x0;this[_0x5ae8('0x12')]=0x0;for(var _0x935cad=0x0;_0x935cad=0x0?this[_0x5ae8('0x16')]:0x0;var _0x49e5a0={'id':this['id'],'available':this[_0x5ae8('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x1f8371=md5(JSON[_0x5ae8('0x17')](_0x49e5a0));if(this['md5']!==_0x1f8371){this['md5']=_0x1f8371;io['to'](util['format'](_0x5ae8('0x18'),_0x49e5a0[_0x5ae8('0x6')]))[_0x5ae8('0x19')]('fax_queue:save',_0x49e5a0);}};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 9bfb4eb..20d77cb 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 _0xe591=['exports','name','Intervals'];(function(_0x41252c,_0x127300){var _0x1a5a6e=function(_0x1b695f){while(--_0x1b695f){_0x41252c['push'](_0x41252c['shift']());}};_0x1a5a6e(++_0x127300);}(_0xe591,0x8e));var _0x1e59=function(_0x5044f2,_0x396307){_0x5044f2=_0x5044f2-0x0;var _0xc48a9d=_0xe591[_0x5044f2];return _0xc48a9d;};'use strict';function Interval(_0x23f80c){this['id']=_0x23f80c['id']||0x0;this[_0x1e59('0x0')]=_0x23f80c['name']||'';this[_0x1e59('0x1')]=_0x23f80c[_0x1e59('0x1')]||{};}module[_0x1e59('0x2')]=Interval; \ No newline at end of file +var _0x950e=['exports','Intervals'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x950e,0xfd));var _0xe950=function(_0x30cb96,_0x31b9e1){_0x30cb96=_0x30cb96-0x0;var _0xeff506=_0x950e[_0x30cb96];return _0xeff506;};'use strict';function Interval(_0x13d2e2){this['id']=_0x13d2e2['id']||0x0;this['name']=_0x13d2e2['name']||'';this[_0xe950('0x0')]=_0x13d2e2[_0xe950('0x0')]||{};}module[_0xe950('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index db36d2c..17bc752 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 _0x292e=['_rr','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','map'];(function(_0x35ebbe,_0x360a97){var _0x192e19=function(_0x371d2c){while(--_0x371d2c){_0x35ebbe['push'](_0x35ebbe['shift']());}};_0x192e19(++_0x360a97);}(_0x292e,0x139));var _0xe292=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x292e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe292('0x0'));var md5=require(_0xe292('0x1'));var util=require(_0xe292('0x2'));var Redis=require(_0xe292('0x3'));var config=require('../../../config/environment');config[_0xe292('0x4')]=_[_0xe292('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe292('0x6'))(new Redis(config['redis']));function MailQueue(_0x236c6e){this['id']=_0x236c6e['id']||0x0;this['name']=_0x236c6e[_0xe292('0x7')]||'';this[_0xe292('0x8')]=_0x236c6e['timeout']||0xa;this[_0xe292('0x9')]=_0x236c6e[_0xe292('0x9')]||_0xe292('0xa');this[_0xe292('0xb')]=_0x236c6e[_0xe292('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xe292('0x1')]='';this[_0xe292('0xc')]();this[_0xe292('0xd')]();}MailQueue[_0xe292('0xe')][_0xe292('0xc')]=function(){var _0x96a27e=this[_0xe292('0xf')]['_rr'];this[_0xe292('0xf')]=_[_0xe292('0x10')](this['Agents'],'id');this[_0xe292('0xf')][_0xe292('0x11')]=_0x96a27e;};MailQueue[_0xe292('0xe')]['updateRealtime']=function(){this[_0xe292('0x12')]=0x0;this[_0xe292('0x13')]=0x0;for(var _0xf7c779=0x0;_0xf7c779=0x0?this['available']:0x0;var _0x580255={'id':this['id'],'available':this[_0xe292('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe292('0x13')],'waiting':this[_0xe292('0x18')]};var _0x51cef8=md5(JSON[_0xe292('0x19')](_0x580255));if(this['md5']!==_0x51cef8){this[_0xe292('0x1')]=_0x51cef8;io['to'](util[_0xe292('0x1a')](_0xe292('0x1b'),_0x580255[_0xe292('0x7')]))['emit'](_0xe292('0x1c'),_0x580255);}};module[_0xe292('0x1d')]=MailQueue; \ No newline at end of file +var _0xd78b=['Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','available','paused','waiting','stringify','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd78b,0xfb));var _0xbd78=function(_0x582bd5,_0x1c99ac){_0x582bd5=_0x582bd5-0x0;var _0x14ce83=_0xd78b[_0x582bd5];return _0x14ce83;};'use strict';var _=require(_0xbd78('0x0'));var md5=require('md5');var util=require(_0xbd78('0x1'));var Redis=require(_0xbd78('0x2'));var config=require(_0xbd78('0x3'));config['redis']=_[_0xbd78('0x4')](config[_0xbd78('0x5')],{'host':_0xbd78('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x45992a){this['id']=_0x45992a['id']||0x0;this[_0xbd78('0x7')]=_0x45992a[_0xbd78('0x7')]||'';this['timeout']=_0x45992a[_0xbd78('0x8')]||0xa;this[_0xbd78('0x9')]=_0x45992a[_0xbd78('0x9')]||'beepall';this[_0xbd78('0xa')]=_0x45992a['Agents'];this[_0xbd78('0xb')]={};this['waiting']=0x0;this[_0xbd78('0xc')]='';this[_0xbd78('0xd')]();this[_0xbd78('0xe')]();}MailQueue[_0xbd78('0xf')][_0xbd78('0xd')]=function(){var _0x1cbb90=this[_0xbd78('0xb')][_0xbd78('0x10')];this['mapAgentsId']=_[_0xbd78('0x11')](this[_0xbd78('0xa')],'id');this[_0xbd78('0xb')][_0xbd78('0x10')]=_0x1cbb90;};MailQueue[_0xbd78('0xf')][_0xbd78('0xe')]=function(){this[_0xbd78('0x12')]=0x0;this['paused']=0x0;for(var _0x221c54=0x0;_0x221c54=0x0?this[_0xbd78('0x15')]:0x0;var _0x3121d3={'id':this['id'],'available':this[_0xbd78('0x15')],'loggedIn':this[_0xbd78('0x12')],'name':this['name'],'paused':this[_0xbd78('0x16')],'waiting':this[_0xbd78('0x17')]};var _0x383e89=md5(JSON[_0xbd78('0x18')](_0x3121d3));if(this[_0xbd78('0xc')]!==_0x383e89){this['md5']=_0x383e89;io['to'](util[_0xbd78('0x19')]('mail:queue:%s',_0x3121d3[_0xbd78('0x7')]))[_0xbd78('0x1a')](_0xbd78('0x1b'),_0x3121d3);}};module[_0xbd78('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 fbb2b1a..df118b4 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7a54,0x106));var _0x47a5=function(_0x2e5cce,_0x495655){_0x2e5cce=_0x2e5cce-0x0;var _0x3e6cd7=_0x7a54[_0x2e5cce];return _0x3e6cd7;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x326f,0xd1));var _0xf326=function(_0x38ba18,_0x54d0b8){_0x38ba18=_0x38ba18-0x0;var _0xb05fc8=_0x326f[_0x38ba18];return _0xb05fc8;};'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 ad9a9aa..c78bb2b 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 _0x83f1=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','emit','sms_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x83f1,0x1cc));var _0x183f=function(_0x11d162,_0x3f244b){_0x11d162=_0x11d162-0x0;var _0x325502=_0x83f1[_0x11d162];return _0x325502;};'use strict';var _=require(_0x183f('0x0'));var md5=require(_0x183f('0x1'));var util=require(_0x183f('0x2'));var Redis=require(_0x183f('0x3'));var config=require(_0x183f('0x4'));config['redis']=_['defaults'](config[_0x183f('0x5')],{'host':_0x183f('0x6'),'port':0x18eb});var io=require(_0x183f('0x7'))(new Redis(config[_0x183f('0x5')]));function SmsQueue(_0x32c03b){this['id']=_0x32c03b['id']||0x0;this['name']=_0x32c03b[_0x183f('0x8')]||'';this[_0x183f('0x9')]=_0x32c03b[_0x183f('0x9')]||0xa;this['strategy']=_0x32c03b[_0x183f('0xa')]||'beepall';this[_0x183f('0xb')]=_0x32c03b[_0x183f('0xb')];this[_0x183f('0xc')]={};this[_0x183f('0xd')]=0x0;this[_0x183f('0x1')]='';this[_0x183f('0xe')]();this[_0x183f('0xf')]();}SmsQueue['prototype'][_0x183f('0xe')]=function(){var _0xa7889b=this[_0x183f('0xc')][_0x183f('0x10')];this[_0x183f('0xc')]=_[_0x183f('0x11')](this[_0x183f('0xb')],'id');this['mapAgentsId'][_0x183f('0x10')]=_0xa7889b;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x183f('0x12')]=0x0;this[_0x183f('0x13')]=0x0;for(var _0x37335a=0x0;_0x37335a=0x0?this[_0x183f('0x17')]:0x0;var _0x2b819e={'id':this['id'],'available':this[_0x183f('0x17')],'loggedIn':this[_0x183f('0x12')],'name':this[_0x183f('0x8')],'paused':this[_0x183f('0x13')],'waiting':this['waiting']};var _0x328e9f=md5(JSON[_0x183f('0x18')](_0x2b819e));if(this[_0x183f('0x1')]!==_0x328e9f){this['md5']=_0x328e9f;io['to'](util[_0x183f('0x19')]('sms:queue:%s',_0x2b819e[_0x183f('0x8')]))[_0x183f('0x1a')](_0x183f('0x1b'),_0x2b819e);}};module[_0x183f('0x1c')]=SmsQueue; \ No newline at end of file +var _0xde50=['name','timeout','strategy','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','Agents','paused','length','online','loggedIn','smsPause','available','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter'];(function(_0x33d06d,_0x4b924f){var _0x12aade=function(_0x1f4ffe){while(--_0x1f4ffe){_0x33d06d['push'](_0x33d06d['shift']());}};_0x12aade(++_0x4b924f);}(_0xde50,0x140));var _0x0de5=function(_0x1a1ff8,_0x30fafe){_0x1a1ff8=_0x1a1ff8-0x0;var _0x28f11b=_0xde50[_0x1a1ff8];return _0x28f11b;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0de5('0x0'));var Redis=require(_0x0de5('0x1'));var config=require(_0x0de5('0x2'));config[_0x0de5('0x3')]=_['defaults'](config[_0x0de5('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x0de5('0x4'))(new Redis(config['redis']));function SmsQueue(_0x5c58fb){this['id']=_0x5c58fb['id']||0x0;this['name']=_0x5c58fb[_0x0de5('0x5')]||'';this[_0x0de5('0x6')]=_0x5c58fb[_0x0de5('0x6')]||0xa;this['strategy']=_0x5c58fb[_0x0de5('0x7')]||'beepall';this['Agents']=_0x5c58fb['Agents'];this[_0x0de5('0x8')]={};this[_0x0de5('0x9')]=0x0;this[_0x0de5('0xa')]='';this['updateRouting']();this[_0x0de5('0xb')]();}SmsQueue[_0x0de5('0xc')]['updateRouting']=function(){var _0x132a49=this[_0x0de5('0x8')][_0x0de5('0xd')];this['mapAgentsId']=_['map'](this[_0x0de5('0xe')],'id');this[_0x0de5('0x8')][_0x0de5('0xd')]=_0x132a49;};SmsQueue[_0x0de5('0xc')][_0x0de5('0xb')]=function(){this['loggedIn']=0x0;this[_0x0de5('0xf')]=0x0;for(var _0x5eaad2=0x0;_0x5eaad2=0x0?this[_0x0de5('0x14')]:0x0;var _0x58ce66={'id':this['id'],'available':this[_0x0de5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x0de5('0x5')],'paused':this[_0x0de5('0xf')],'waiting':this[_0x0de5('0x9')]};var _0x325a8=md5(JSON['stringify'](_0x58ce66));if(this[_0x0de5('0xa')]!==_0x325a8){this['md5']=_0x325a8;io['to'](util[_0x0de5('0x15')](_0x0de5('0x16'),_0x58ce66[_0x0de5('0x5')]))['emit'](_0x0de5('0x17'),_0x58ce66);}};module[_0x0de5('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b6788f4..b33374b 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 _0x911f=['beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','whatsappPause','available','name','waiting','whatsapp:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout'];(function(_0x27a0c3,_0x4809e1){var _0x3f628a=function(_0x15a678){while(--_0x15a678){_0x27a0c3['push'](_0x27a0c3['shift']());}};_0x3f628a(++_0x4809e1);}(_0x911f,0x79));var _0xf911=function(_0x3391a9,_0x31efd7){_0x3391a9=_0x3391a9-0x0;var _0x563423=_0x911f[_0x3391a9];return _0x563423;};'use strict';var _=require('lodash');var md5=require(_0xf911('0x0'));var util=require(_0xf911('0x1'));var Redis=require(_0xf911('0x2'));var config=require(_0xf911('0x3'));config[_0xf911('0x4')]=_[_0xf911('0x5')](config[_0xf911('0x4')],{'host':_0xf911('0x6'),'port':0x18eb});var io=require(_0xf911('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x3da39a){this['id']=_0x3da39a['id']||0x0;this['name']=_0x3da39a['name']||'';this[_0xf911('0x8')]=_0x3da39a[_0xf911('0x8')]||0xa;this['strategy']=_0x3da39a['strategy']||_0xf911('0x9');this[_0xf911('0xa')]=_0x3da39a['Agents'];this[_0xf911('0xb')]={};this['waiting']=0x0;this[_0xf911('0x0')]='';this[_0xf911('0xc')]();this['updateRealtime']();}WhatsappQueue[_0xf911('0xd')][_0xf911('0xc')]=function(){var _0x2fb472=this['mapAgentsId'][_0xf911('0xe')];this[_0xf911('0xb')]=_[_0xf911('0xf')](this[_0xf911('0xa')],'id');this[_0xf911('0xb')][_0xf911('0xe')]=_0x2fb472;};WhatsappQueue[_0xf911('0xd')][_0xf911('0x10')]=function(){this[_0xf911('0x11')]=0x0;this[_0xf911('0x12')]=0x0;for(var _0x418b8e=0x0;_0x418b8e=0x0?this[_0xf911('0x15')]:0x0;var _0x4e4c70={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf911('0x11')],'name':this[_0xf911('0x16')],'paused':this[_0xf911('0x12')],'waiting':this[_0xf911('0x17')]};var _0x173787=md5(JSON['stringify'](_0x4e4c70));if(this[_0xf911('0x0')]!==_0x173787){this['md5']=_0x173787;io['to'](util['format'](_0xf911('0x18'),_0x4e4c70[_0xf911('0x16')]))[_0xf911('0x19')]('whatsapp_queue:save',_0x4e4c70);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x399b=['_rr','prototype','loggedIn','paused','length','online','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','waiting','updateRouting','updateRealtime','mapAgentsId','map','Agents'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x399b,0xf5));var _0xb399=function(_0x574016,_0x38a077){_0x574016=_0x574016-0x0;var _0x1b0e8a=_0x399b[_0x574016];return _0x1b0e8a;};'use strict';var _=require(_0xb399('0x0'));var md5=require(_0xb399('0x1'));var util=require('util');var Redis=require(_0xb399('0x2'));var config=require(_0xb399('0x3'));config[_0xb399('0x4')]=_[_0xb399('0x5')](config[_0xb399('0x4')],{'host':_0xb399('0x6'),'port':0x18eb});var io=require(_0xb399('0x7'))(new Redis(config[_0xb399('0x4')]));function WhatsappQueue(_0x17d4af){this['id']=_0x17d4af['id']||0x0;this[_0xb399('0x8')]=_0x17d4af[_0xb399('0x8')]||'';this['timeout']=_0x17d4af['timeout']||0xa;this['strategy']=_0x17d4af['strategy']||'beepall';this['Agents']=_0x17d4af['Agents'];this['mapAgentsId']={};this[_0xb399('0x9')]=0x0;this[_0xb399('0x1')]='';this[_0xb399('0xa')]();this[_0xb399('0xb')]();}WhatsappQueue['prototype'][_0xb399('0xa')]=function(){var _0x1c4c5e=this[_0xb399('0xc')]['_rr'];this['mapAgentsId']=_[_0xb399('0xd')](this[_0xb399('0xe')],'id');this[_0xb399('0xc')][_0xb399('0xf')]=_0x1c4c5e;};WhatsappQueue[_0xb399('0x10')][_0xb399('0xb')]=function(){this[_0xb399('0x11')]=0x0;this[_0xb399('0x12')]=0x0;for(var _0x1899a5=0x0;_0x1899a5=0x0?this[_0xb399('0x15')]:0x0;var _0x57249e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb399('0x11')],'name':this[_0xb399('0x8')],'paused':this[_0xb399('0x12')],'waiting':this[_0xb399('0x9')]};var _0x26a19d=md5(JSON[_0xb399('0x16')](_0x57249e));if(this[_0xb399('0x1')]!==_0x26a19d){this[_0xb399('0x1')]=_0x26a19d;io['to'](util['format'](_0xb399('0x17'),_0x57249e['name']))['emit'](_0xb399('0x18'),_0x57249e);}};module[_0xb399('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a5c5006..1579453 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b57a18c..1fc41cb 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 _0x0037=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0x456616,_0x55f9f1){var _0x2f548f=function(_0x4478ee){while(--_0x4478ee){_0x456616['push'](_0x456616['shift']());}};_0x2f548f(++_0x55f9f1);}(_0x0037,0x1ba));var _0x7003=function(_0x41242c,_0x48b783){_0x41242c=_0x41242c-0x0;var _0xa4ea6c=_0x0037[_0x41242c];return _0xa4ea6c;};'use strict';var client=require(_0x7003('0x0'));exports[_0x7003('0x1')]=function(_0x57845a,_0x17fc05){return client['Request'](_0x7003('0x2'),{'body':_0x17fc05,'options':{'where':{'id':_0x57845a}},'log':_0x7003('0x3')});};exports[_0x7003('0x4')]=function(_0x22a243,_0x137695){return client[_0x7003('0x5')](_0x7003('0x6'),{'body':_0x137695,'options':{'where':{'id':_0x22a243}},'log':_0x7003('0x7')});}; \ No newline at end of file +var _0x688e=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x2d26e4,_0x38ac10){var _0x122fc9=function(_0xc4ec7d){while(--_0xc4ec7d){_0x2d26e4['push'](_0x2d26e4['shift']());}};_0x122fc9(++_0x38ac10);}(_0x688e,0x196));var _0xe688=function(_0x1fc4a3,_0x582e19){_0x1fc4a3=_0x1fc4a3-0x0;var _0x31d181=_0x688e[_0x1fc4a3];return _0x31d181;};'use strict';var client=require('../client');exports['update']=function(_0x4fbc61,_0x46c346){return client[_0xe688('0x0')](_0xe688('0x1'),{'body':_0x46c346,'options':{'where':{'id':_0x4fbc61}},'log':_0xe688('0x2')});};exports['addTags']=function(_0x31b175,_0x32f889){return client['Request'](_0xe688('0x3'),{'body':_0x32f889,'options':{'where':{'id':_0x31b175}},'log':_0xe688('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index df19be5..259a990 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 _0xecd2=['create','Request','createChatMessage'];(function(_0x205e46,_0x4c4470){var _0xb9de80=function(_0x1c8faf){while(--_0x1c8faf){_0x205e46['push'](_0x205e46['shift']());}};_0xb9de80(++_0x4c4470);}(_0xecd2,0x192));var _0x2ecd=function(_0x332139,_0xad29b2){_0x332139=_0x332139-0x0;var _0x4a7ed5=_0xecd2[_0x332139];return _0x4a7ed5;};'use strict';var client=require('../client');exports[_0x2ecd('0x0')]=function(_0x1b4b5e){return client[_0x2ecd('0x1')]('CreateChatMessage',{'body':_0x1b4b5e,'log':_0x2ecd('0x2')});}; \ No newline at end of file +var _0xbaa4=['createChatMessage','Request'];(function(_0x1b21f0,_0x1f938e){var _0x45924a=function(_0x12ae46){while(--_0x12ae46){_0x1b21f0['push'](_0x1b21f0['shift']());}};_0x45924a(++_0x1f938e);}(_0xbaa4,0xa9));var _0x4baa=function(_0x22db4e,_0xaa0c62){_0x22db4e=_0x22db4e-0x0;var _0x12afd4=_0xbaa4[_0x22db4e];return _0x12afd4;};'use strict';var client=require('../client');exports['create']=function(_0x280bc4){return client[_0x4baa('0x0')]('CreateChatMessage',{'body':_0x280bc4,'log':_0x4baa('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3e83d35..c3db258 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 _0x975f=['getChatQueues','name','timeout','User','Agents','online','../client'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x975f,0x109));var _0xf975=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x975f[_0xb83ec2];return _0x4d2fbf;};'use strict';var client=require(_0xf975('0x0'));exports[_0xf975('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf975('0x2'),_0xf975('0x3'),'strategy'],'include':[{'model':_0xf975('0x4'),'as':_0xf975('0x5'),'attributes':['id',_0xf975('0x2'),_0xf975('0x6'),'chatPause']}]},'log':_0xf975('0x1')});};}; \ No newline at end of file +var _0x3cd8=['name','timeout','strategy','User','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3cd8,0x150));var _0x83cd=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x3cd8[_0x3a3758];return _0x1a9234;};'use strict';var client=require(_0x83cd('0x0'));exports[_0x83cd('0x1')]=function(){return function(){return client[_0x83cd('0x2')](_0x83cd('0x3'),{'options':{'raw':![],'attributes':['id',_0x83cd('0x4'),_0x83cd('0x5'),_0x83cd('0x6')],'include':[{'model':_0x83cd('0x7'),'as':'Agents','attributes':['id',_0x83cd('0x4'),_0x83cd('0x8'),_0x83cd('0x9')]}]},'log':_0x83cd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e09f136..a35587c 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 _0x4ded=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x375334,_0x10c8fa){var _0x378f3e=function(_0x4db406){while(--_0x4db406){_0x375334['push'](_0x375334['shift']());}};_0x378f3e(++_0x10c8fa);}(_0x4ded,0x116));var _0xd4de=function(_0x16d1ad,_0x1b951d){_0x16d1ad=_0x16d1ad-0x0;var _0x2fee04=_0x4ded[_0x16d1ad];return _0x2fee04;};'use strict';var client=require(_0xd4de('0x0'));exports[_0xd4de('0x1')]=function(_0x117357){return client[_0xd4de('0x2')](_0xd4de('0x3'),{'body':_0x117357,'log':_0xd4de('0x3')});};exports[_0xd4de('0x4')]=function(_0x42f90f,_0x20930f){return client[_0xd4de('0x2')](_0xd4de('0x5'),{'body':_0x20930f,'options':{'where':{'uniqueid':_0x42f90f},'order':[['id',_0xd4de('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xba47=['Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport','update'];(function(_0x39c12a,_0x5452bc){var _0x458194=function(_0x41bcf2){while(--_0x41bcf2){_0x39c12a['push'](_0x39c12a['shift']());}};_0x458194(++_0x5452bc);}(_0xba47,0x1ac));var _0x7ba4=function(_0x4c749c,_0x1ed669){_0x4c749c=_0x4c749c-0x0;var _0x4b10f2=_0xba47[_0x4c749c];return _0x4b10f2;};'use strict';var client=require(_0x7ba4('0x0'));exports[_0x7ba4('0x1')]=function(_0x1c8664){return client['Request'](_0x7ba4('0x2'),{'body':_0x1c8664,'log':_0x7ba4('0x2')});};exports[_0x7ba4('0x3')]=function(_0x29cfa3,_0x552cc8){return client[_0x7ba4('0x4')](_0x7ba4('0x5'),{'body':_0x552cc8,'options':{'where':{'uniqueid':_0x29cfa3},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c8c1409..e83820c 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(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0x7a54,0x106));var _0x47a5=function(_0x19398e,_0x415d22){_0x19398e=_0x19398e-0x0;var _0x5546fb=_0x7a54[_0x19398e];return _0x5546fb;};'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(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x7a54,0x106));var _0x47a5=function(_0x139182,_0x2ee94e){_0x139182=_0x139182-0x0;var _0x2496c4=_0x7a54[_0x139182];return _0x2496c4;};'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 3e85c02..2c098e3 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 _0x2b28=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x5f260b,_0x3373c3){var _0x4eee4f=function(_0x4c61bf){while(--_0x4c61bf){_0x5f260b['push'](_0x5f260b['shift']());}};_0x4eee4f(++_0x3373c3);}(_0x2b28,0x161));var _0x82b2=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x2b28[_0x506d83];return _0x335e8b;};'use strict';var client=require(_0x82b2('0x0'));exports[_0x82b2('0x1')]=function(_0x39d87e){return client[_0x82b2('0x2')](_0x82b2('0x3'),{'body':_0x39d87e,'log':_0x82b2('0x4')});}; \ No newline at end of file +var _0xd702=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd702,0x7e));var _0x2d70=function(_0x534485,_0x319524){_0x534485=_0x534485-0x0;var _0xaf166d=_0xd702[_0x534485];return _0xaf166d;};'use strict';var client=require(_0x2d70('0x0'));exports[_0x2d70('0x1')]=function(_0x24979d){return client[_0x2d70('0x2')](_0x2d70('0x3'),{'body':_0x24979d,'log':_0x2d70('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8f098a8..1cea408 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 _0x6ce3=['User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ce3,0x19d));var _0x36ce=function(_0x198ecc,_0x3444eb){_0x198ecc=_0x198ecc-0x0;var _0x192199=_0x6ce3[_0x198ecc];return _0x192199;};'use strict';var client=require(_0x36ce('0x0'));exports[_0x36ce('0x1')]=function(){return function(){return client[_0x36ce('0x2')](_0x36ce('0x3'),{'options':{'raw':![],'attributes':['id',_0x36ce('0x4'),_0x36ce('0x5'),_0x36ce('0x6')],'include':[{'model':_0x36ce('0x7'),'as':_0x36ce('0x8'),'attributes':['id',_0x36ce('0x4'),'online',_0x36ce('0x9')]}]},'log':_0x36ce('0x1')});};}; \ No newline at end of file +var _0x37cf=['GetFaxQueue','name','timeout','online','faxPause','../client','getFaxQueues','Request'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x37cf,0xb5));var _0xf37c=function(_0x25173,_0x3b4025){_0x25173=_0x25173-0x0;var _0x34ff71=_0x37cf[_0x25173];return _0x34ff71;};'use strict';var client=require(_0xf37c('0x0'));exports[_0xf37c('0x1')]=function(){return function(){return client[_0xf37c('0x2')](_0xf37c('0x3'),{'options':{'raw':![],'attributes':['id',_0xf37c('0x4'),_0xf37c('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xf37c('0x6'),_0xf37c('0x7')]}]},'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 b806dfa..9b96b53 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 _0x1523=['Request','UpdateFaxQueueReport','DESC','../client'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x1523,0xff));var _0x3152=function(_0x2744c5,_0x3caacd){_0x2744c5=_0x2744c5-0x0;var _0x4d044b=_0x1523[_0x2744c5];return _0x4d044b;};'use strict';var client=require(_0x3152('0x0'));exports['create']=function(_0x101ffc){return client['Request']('CreateFaxQueueReport',{'body':_0x101ffc,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x2ca631,_0x5cdcfc){return client[_0x3152('0x1')](_0x3152('0x2'),{'body':_0x5cdcfc,'options':{'where':{'uniqueid':_0x2ca631},'order':[['id',_0x3152('0x3')]],'limit':0x1},'log':_0x3152('0x2')});}; \ No newline at end of file +var _0x2267=['DESC','../client','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0xa3d507,_0x52f942){var _0x1e977f=function(_0xc6860e){while(--_0xc6860e){_0xa3d507['push'](_0xa3d507['shift']());}};_0x1e977f(++_0x52f942);}(_0x2267,0x65));var _0x7226=function(_0x46d96b,_0x4a9d2b){_0x46d96b=_0x46d96b-0x0;var _0x52aabb=_0x2267[_0x46d96b];return _0x52aabb;};'use strict';var client=require(_0x7226('0x0'));exports['create']=function(_0x240d56){return client['Request'](_0x7226('0x1'),{'body':_0x240d56,'log':_0x7226('0x1')});};exports['update']=function(_0x2255fc,_0x242b5e){return client['Request'](_0x7226('0x2'),{'body':_0x242b5e,'options':{'where':{'uniqueid':_0x2255fc},'order':[['id',_0x7226('0x3')]],'limit':0x1},'log':_0x7226('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bc7fca9..1448eea 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 _0x2a10=['Interval','Intervals','interval','../client','name'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2a10,0x94));var _0x02a1=function(_0x2668e1,_0x8d2cc0){_0x2668e1=_0x2668e1-0x0;var _0x45ceb0=_0x2a10[_0x2668e1];return _0x45ceb0;};'use strict';var client=require(_0x02a1('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x02a1('0x1')],'include':[{'model':_0x02a1('0x2'),'as':_0x02a1('0x3'),'attributes':['id',_0x02a1('0x1'),_0x02a1('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xca5e=['getIntervals','GetInterval','name','Interval','interval'];(function(_0x235fd0,_0x32d33f){var _0x19b9b0=function(_0x442dd9){while(--_0x442dd9){_0x235fd0['push'](_0x235fd0['shift']());}};_0x19b9b0(++_0x32d33f);}(_0xca5e,0x1af));var _0xeca5=function(_0x5730e5,_0x22ae2d){_0x5730e5=_0x5730e5-0x0;var _0x88ba3a=_0xca5e[_0x5730e5];return _0x88ba3a;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request'](_0xeca5('0x0'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeca5('0x1')],'include':[{'model':_0xeca5('0x2'),'as':'Intervals','attributes':['id',_0xeca5('0x1'),_0xeca5('0x3')]}]},'log':_0xeca5('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d794693..591b0a9 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 _0x236c=['Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0x236c,0x155));var _0xc236=function(_0x665d3,_0x652cad){_0x665d3=_0x665d3-0x0;var _0x8b663b=_0x236c[_0x665d3];return _0x8b663b;};'use strict';var client=require(_0xc236('0x0'));exports['update']=function(_0x2ce95a,_0x404d50){return client[_0xc236('0x1')](_0xc236('0x2'),{'body':_0x404d50,'options':{'where':{'id':_0x2ce95a}},'log':_0xc236('0x3')});};exports['addTags']=function(_0x3adce9,_0x36e87d){return client[_0xc236('0x1')](_0xc236('0x4'),{'body':_0x36e87d,'options':{'where':{'id':_0x3adce9}},'log':_0xc236('0x5')});}; \ No newline at end of file +var _0x2da6=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x593351,_0x23c222){var _0x3bb878=function(_0x5cf063){while(--_0x5cf063){_0x593351['push'](_0x593351['shift']());}};_0x3bb878(++_0x23c222);}(_0x2da6,0x1dd));var _0x62da=function(_0xc8d3f9,_0x3b02c5){_0xc8d3f9=_0xc8d3f9-0x0;var _0x198bf8=_0x2da6[_0xc8d3f9];return _0x198bf8;};'use strict';var client=require(_0x62da('0x0'));exports[_0x62da('0x1')]=function(_0x1d3698,_0xbbb39b){return client[_0x62da('0x2')](_0x62da('0x3'),{'body':_0xbbb39b,'options':{'where':{'id':_0x1d3698}},'log':_0x62da('0x4')});};exports[_0x62da('0x5')]=function(_0x4c079d,_0x4a8428){return client[_0x62da('0x2')](_0x62da('0x6'),{'body':_0x4a8428,'options':{'where':{'id':_0x4c079d}},'log':_0x62da('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 835f63a..b977036 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 _0x13b8=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x1a42e4,_0x545b8a){var _0x437fdc=function(_0x19b7a0){while(--_0x19b7a0){_0x1a42e4['push'](_0x1a42e4['shift']());}};_0x437fdc(++_0x545b8a);}(_0x13b8,0xcf));var _0x813b=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x13b8[_0x16629d];return _0x56ccee;};'use strict';var client=require(_0x813b('0x0'));exports[_0x813b('0x1')]=function(_0x4dd06a){return client[_0x813b('0x2')](_0x813b('0x3'),{'body':_0x4dd06a,'log':_0x813b('0x4')});}; \ No newline at end of file +var _0x3479=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x45b1de,_0x1dcb97){var _0x4a88fa=function(_0x23f29b){while(--_0x23f29b){_0x45b1de['push'](_0x45b1de['shift']());}};_0x4a88fa(++_0x1dcb97);}(_0x3479,0xb5));var _0x9347=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x3479[_0x4a73f2];return _0x4190ee;};'use strict';var client=require(_0x9347('0x0'));exports['create']=function(_0x4c8709){return client[_0x9347('0x1')](_0x9347('0x2'),{'body':_0x4c8709,'log':_0x9347('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f717f15..a44aa5e 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 _0xf9aa=['name','online','mailPause','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x57d579,_0x1c306c){var _0x5a65f0=function(_0x4f8b24){while(--_0x4f8b24){_0x57d579['push'](_0x57d579['shift']());}};_0x5a65f0(++_0x1c306c);}(_0xf9aa,0xab));var _0xaf9a=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0xf9aa[_0x49a57f];return _0x2fa2a5;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0xaf9a('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xaf9a('0x1'),_0xaf9a('0x2')],'include':[{'model':_0xaf9a('0x3'),'as':_0xaf9a('0x4'),'attributes':['id',_0xaf9a('0x5'),_0xaf9a('0x6'),_0xaf9a('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x3116=['timeout','User','Agents','online','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x3116,0x17e));var _0x6311=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3116[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x6311('0x0'));exports[_0x6311('0x1')]=function(){return function(){return client[_0x6311('0x2')](_0x6311('0x3'),{'options':{'raw':![],'attributes':['id',_0x6311('0x4'),_0x6311('0x5'),'strategy'],'include':[{'model':_0x6311('0x6'),'as':_0x6311('0x7'),'attributes':['id',_0x6311('0x4'),_0x6311('0x8'),'mailPause']}]},'log':_0x6311('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1959cdb..95dbe8e 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 _0x2f5c=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x2b1df3,_0x35e9ac){var _0x2a5e50=function(_0x18c44a){while(--_0x18c44a){_0x2b1df3['push'](_0x2b1df3['shift']());}};_0x2a5e50(++_0x35e9ac);}(_0x2f5c,0xa9));var _0xc2f5=function(_0x1efb11,_0x9f886){_0x1efb11=_0x1efb11-0x0;var _0x2ec5c8=_0x2f5c[_0x1efb11];return _0x2ec5c8;};'use strict';var client=require('../client');exports[_0xc2f5('0x0')]=function(_0x364744){return client['Request'](_0xc2f5('0x1'),{'body':_0x364744,'log':_0xc2f5('0x1')});};exports[_0xc2f5('0x2')]=function(_0x498e81,_0x30f070){return client['Request'](_0xc2f5('0x3'),{'body':_0x30f070,'options':{'where':{'uniqueid':_0x498e81},'order':[['id',_0xc2f5('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xdc69=['../client','CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport'];(function(_0x5ca876,_0x373d34){var _0x758bb9=function(_0x9d23a7){while(--_0x9d23a7){_0x5ca876['push'](_0x5ca876['shift']());}};_0x758bb9(++_0x373d34);}(_0xdc69,0x156));var _0x9dc6=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0xdc69[_0x5de532];return _0x4e9192;};'use strict';var client=require(_0x9dc6('0x0'));exports['create']=function(_0x5ab857){return client['Request']('CreateMailQueueReport',{'body':_0x5ab857,'log':_0x9dc6('0x1')});};exports[_0x9dc6('0x2')]=function(_0x10ca33,_0x261fdc){return client[_0x9dc6('0x3')]('UpdateMailQueueReport',{'body':_0x261fdc,'options':{'where':{'uniqueid':_0x10ca33},'order':[['id',_0x9dc6('0x4')]],'limit':0x1},'log':_0x9dc6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 26cf46e..f3a7b49 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 _0x23fe=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x117d01,_0xaa2284){var _0x245986=function(_0x2e85af){while(--_0x2e85af){_0x117d01['push'](_0x117d01['shift']());}};_0x245986(++_0xaa2284);}(_0x23fe,0xdd));var _0xe23f=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x23fe[_0x1b5aea];return _0x15cfc6;};'use strict';var client=require('../client');exports[_0xe23f('0x0')]=function(_0x32ca87,_0x144254){return client[_0xe23f('0x1')](_0xe23f('0x2'),{'body':_0x144254,'options':{'where':{'id':_0x32ca87}},'log':_0xe23f('0x3')});};exports[_0xe23f('0x4')]=function(_0x1c82b9,_0x10d519){return client[_0xe23f('0x1')](_0xe23f('0x5'),{'body':_0x10d519,'options':{'where':{'id':_0x1c82b9}},'log':_0xe23f('0x6')});}; \ No newline at end of file +var _0x3de1=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0xb1473e,_0x3ed6d7){var _0x9760f4=function(_0x3cfad6){while(--_0x3cfad6){_0xb1473e['push'](_0xb1473e['shift']());}};_0x9760f4(++_0x3ed6d7);}(_0x3de1,0x1d8));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x13de('0x0')]=function(_0x537e66,_0x34ab20){return client['Request'](_0x13de('0x1'),{'body':_0x34ab20,'options':{'where':{'id':_0x537e66}},'log':_0x13de('0x2')});};exports[_0x13de('0x3')]=function(_0x166228,_0x551f9a){return client[_0x13de('0x4')](_0x13de('0x5'),{'body':_0x551f9a,'options':{'where':{'id':_0x166228}},'log':_0x13de('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b48bbb1..c291f78 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 _0x9d0b=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d0b,0xec));var _0xb9d0=function(_0x2ef6b0,_0x1277bf){_0x2ef6b0=_0x2ef6b0-0x0;var _0x4f0c1d=_0x9d0b[_0x2ef6b0];return _0x4f0c1d;};'use strict';var client=require(_0xb9d0('0x0'));exports[_0xb9d0('0x1')]=function(_0x19eeeb){return client['Request'](_0xb9d0('0x2'),{'body':_0x19eeeb,'log':_0xb9d0('0x3')});}; \ No newline at end of file +var _0x9021=['create','CreateOpenchannelMessage'];(function(_0x5a446e,_0x1f2886){var _0x2aec65=function(_0x37ad8b){while(--_0x37ad8b){_0x5a446e['push'](_0x5a446e['shift']());}};_0x2aec65(++_0x1f2886);}(_0x9021,0x188));var _0x1902=function(_0x5674fc,_0x2b623b){_0x5674fc=_0x5674fc-0x0;var _0x2444a5=_0x9021[_0x5674fc];return _0x2444a5;};'use strict';var client=require('../client');exports[_0x1902('0x0')]=function(_0x56ff15){return client['Request'](_0x1902('0x1'),{'body':_0x56ff15,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 15353af..2adf672 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 _0xb183=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xb183,0xee));var _0x3b18=function(_0x5d8c77,_0x476e70){_0x5d8c77=_0x5d8c77-0x0;var _0x5ce5ec=_0xb183[_0x5d8c77];return _0x5ce5ec;};'use strict';var client=require(_0x3b18('0x0'));exports[_0x3b18('0x1')]=function(){return function(){return client[_0x3b18('0x2')](_0x3b18('0x3'),{'options':{'raw':![],'attributes':['id',_0x3b18('0x4'),_0x3b18('0x5'),_0x3b18('0x6')],'include':[{'model':_0x3b18('0x7'),'as':_0x3b18('0x8'),'attributes':['id',_0x3b18('0x4'),'online',_0x3b18('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xe1bd=['Request','timeout','Agents','name','online','getOpenchannelQueues','../client'];(function(_0x4e29ce,_0x4a7ee0){var _0x31db27=function(_0x41f6ad){while(--_0x41f6ad){_0x4e29ce['push'](_0x4e29ce['shift']());}};_0x31db27(++_0x4a7ee0);}(_0xe1bd,0x99));var _0xde1b=function(_0x324738,_0x265990){_0x324738=_0x324738-0x0;var _0xd333a3=_0xe1bd[_0x324738];return _0xd333a3;};'use strict';var client=require(_0xde1b('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xde1b('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xde1b('0x2'),'strategy'],'include':[{'model':'User','as':_0xde1b('0x3'),'attributes':['id',_0xde1b('0x4'),_0xde1b('0x5'),'openchannelPause']}]},'log':_0xde1b('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 360bf11..4ba0627 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 _0x6b67=['../client','create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x232599,_0x2d75ca){var _0x4ee143=function(_0xf8c80a){while(--_0xf8c80a){_0x232599['push'](_0x232599['shift']());}};_0x4ee143(++_0x2d75ca);}(_0x6b67,0x118));var _0x76b6=function(_0x23991f,_0x3cf4ee){_0x23991f=_0x23991f-0x0;var _0x536c7b=_0x6b67[_0x23991f];return _0x536c7b;};'use strict';var client=require(_0x76b6('0x0'));exports[_0x76b6('0x1')]=function(_0x3ef989){return client['Request'](_0x76b6('0x2'),{'body':_0x3ef989,'log':_0x76b6('0x2')});};exports[_0x76b6('0x3')]=function(_0x48639e,_0x1be2e5){return client['Request'](_0x76b6('0x4'),{'body':_0x1be2e5,'options':{'where':{'uniqueid':_0x48639e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x92db=['update','UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x550637,_0x2f172a){var _0x24fea3=function(_0x473f23){while(--_0x473f23){_0x550637['push'](_0x550637['shift']());}};_0x24fea3(++_0x2f172a);}(_0x92db,0x111));var _0xb92d=function(_0x741ff6,_0x36675c){_0x741ff6=_0x741ff6-0x0;var _0x26778c=_0x92db[_0x741ff6];return _0x26778c;};'use strict';var client=require('../client');exports[_0xb92d('0x0')]=function(_0xbfc80b){return client[_0xb92d('0x1')](_0xb92d('0x2'),{'body':_0xbfc80b,'log':_0xb92d('0x2')});};exports[_0xb92d('0x3')]=function(_0x28c3cb,_0x576262){return client[_0xb92d('0x1')](_0xb92d('0x4'),{'body':_0x576262,'options':{'where':{'uniqueid':_0x28c3cb},'order':[['id',_0xb92d('0x5')]],'limit':0x1},'log':_0xb92d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1927f5b..b14aca7 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 _0x4b47=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','Request'];(function(_0xe5a408,_0x41cbb6){var _0x1746d1=function(_0x578ea1){while(--_0x578ea1){_0xe5a408['push'](_0xe5a408['shift']());}};_0x1746d1(++_0x41cbb6);}(_0x4b47,0x1b4));var _0x74b4=function(_0xd5c25a,_0x2afb4a){_0xd5c25a=_0xd5c25a-0x0;var _0x23219a=_0x4b47[_0xd5c25a];return _0x23219a;};'use strict';var client=require(_0x74b4('0x0'));exports['update']=function(_0xf50408,_0x2542ff){return client[_0x74b4('0x1')](_0x74b4('0x2'),{'body':_0x2542ff,'options':{'where':{'id':_0xf50408}},'log':_0x74b4('0x3')});};exports[_0x74b4('0x4')]=function(_0x565f6b,_0x4ed4fe){return client[_0x74b4('0x1')](_0x74b4('0x5'),{'body':_0x4ed4fe,'options':{'where':{'id':_0x565f6b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xc3a8=['addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x3a04c6,_0x12a482){var _0xf4131a=function(_0x413ea2){while(--_0x413ea2){_0x3a04c6['push'](_0x3a04c6['shift']());}};_0xf4131a(++_0x12a482);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0xc3a8[_0x3185ad];return _0x4f77fb;};'use strict';var client=require(_0x8c3a('0x0'));exports[_0x8c3a('0x1')]=function(_0xfad188,_0x4fff77){return client[_0x8c3a('0x2')]('UpdateSmsInteraction',{'body':_0x4fff77,'options':{'where':{'id':_0xfad188}},'log':_0x8c3a('0x3')});};exports[_0x8c3a('0x4')]=function(_0x3585d1,_0x1d993b){return client['Request'](_0x8c3a('0x5'),{'body':_0x1d993b,'options':{'where':{'id':_0x3585d1}},'log':_0x8c3a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d6d4dcc..3b0a13c 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 _0x3619=['create','Request','CreateSmsMessage','../client'];(function(_0x18ef8a,_0x6fac89){var _0xac9be6=function(_0x2c12bc){while(--_0x2c12bc){_0x18ef8a['push'](_0x18ef8a['shift']());}};_0xac9be6(++_0x6fac89);}(_0x3619,0x113));var _0x9361=function(_0x4e77c6,_0x4c359c){_0x4e77c6=_0x4e77c6-0x0;var _0x3e326c=_0x3619[_0x4e77c6];return _0x3e326c;};'use strict';var client=require(_0x9361('0x0'));exports[_0x9361('0x1')]=function(_0x4bad01){return client[_0x9361('0x2')](_0x9361('0x3'),{'body':_0x4bad01,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xca96=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xca96,0xaf));var _0x6ca9=function(_0x529e36,_0x235e90){_0x529e36=_0x529e36-0x0;var _0x1626da=_0xca96[_0x529e36];return _0x1626da;};'use strict';var client=require('../client');exports[_0x6ca9('0x0')]=function(_0x417d77){return client[_0x6ca9('0x1')](_0x6ca9('0x2'),{'body':_0x417d77,'log':_0x6ca9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 05b18ba..a699ec7 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(_0x3e628c,_0x388272){var _0xf43c0d=function(_0x7700b2){while(--_0x7700b2){_0x3e628c['push'](_0x3e628c['shift']());}};_0xf43c0d(++_0x388272);}(_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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x24cc1f,_0x1b41f1){var _0x3b24c8=function(_0xd9f375){while(--_0xd9f375){_0x24cc1f['push'](_0x24cc1f['shift']());}};_0x3b24c8(++_0x1b41f1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb7e7[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 34ea32a..0ccc9ed 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x154fb7,_0x281bde){var _0x5bc551=function(_0x50f477){while(--_0x50f477){_0x154fb7['push'](_0x154fb7['shift']());}};_0x5bc551(++_0x281bde);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5553b3,_0x337912){var _0x52d9a3=function(_0x4d4b56){while(--_0x4d4b56){_0x5553b3['push'](_0x5553b3['shift']());}};_0x52d9a3(++_0x337912);}(_0x70e0,0x17b));var _0x070e=function(_0x1392ba,_0x26235b){_0x1392ba=_0x1392ba-0x0;var _0x5be47d=_0x70e0[_0x1392ba];return _0x5be47d;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5554191..85a39d4 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(_0x45fe44,_0x421844){var _0xe053b4=function(_0x31812a){while(--_0x31812a){_0x45fe44['push'](_0x45fe44['shift']());}};_0xe053b4(++_0x421844);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x21f454,_0x1fc838){var _0x12f41a=function(_0x31922c){while(--_0x31922c){_0x21f454['push'](_0x21f454['shift']());}};_0x12f41a(++_0x1fc838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 90843d1..6c293a3 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 _0xb46f=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x1ef82e,_0x57a946){var _0x4e84c0=function(_0x35ae10){while(--_0x35ae10){_0x1ef82e['push'](_0x1ef82e['shift']());}};_0x4e84c0(++_0x57a946);}(_0xb46f,0xb6));var _0xfb46=function(_0x274743,_0x11e16e){_0x274743=_0x274743-0x0;var _0x4f4187=_0xb46f[_0x274743];return _0x4f4187;};'use strict';var client=require(_0xfb46('0x0'));exports[_0xfb46('0x1')]=function(_0x5f2971,_0x4db7cc){return client[_0xfb46('0x2')](_0xfb46('0x3'),{'body':_0x4db7cc,'options':{'where':{'id':_0x5f2971}},'log':_0xfb46('0x4')});};exports[_0xfb46('0x5')]=function(_0x4fb0bb,_0x95533e){return client['Request'](_0xfb46('0x6'),{'body':_0x95533e,'options':{'where':{'id':_0x4fb0bb}},'log':_0xfb46('0x7')});}; \ No newline at end of file +var _0x15ef=['addTags','AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3f1a27,_0x45a3cf){var _0x50f55e=function(_0x3593d9){while(--_0x3593d9){_0x3f1a27['push'](_0x3f1a27['shift']());}};_0x50f55e(++_0x45a3cf);}(_0x15ef,0x80));var _0xf15e=function(_0x17a7e5,_0x25d102){_0x17a7e5=_0x17a7e5-0x0;var _0xcfb11e=_0x15ef[_0x17a7e5];return _0xcfb11e;};'use strict';var client=require('../client');exports[_0xf15e('0x0')]=function(_0x69848b,_0x4effd9){return client[_0xf15e('0x1')](_0xf15e('0x2'),{'body':_0x4effd9,'options':{'where':{'id':_0x69848b}},'log':_0xf15e('0x3')});};exports[_0xf15e('0x4')]=function(_0x4e7241,_0x5d456b){return client[_0xf15e('0x1')](_0xf15e('0x5'),{'body':_0x5d456b,'options':{'where':{'id':_0x4e7241}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 09ee261..1449fda 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 _0x60f5=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60f5,0x13b));var _0x560f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x60f5[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports[_0x560f('0x0')]=function(_0x1a289f){return client[_0x560f('0x1')](_0x560f('0x2'),{'body':_0x1a289f,'log':_0x560f('0x3')});}; \ No newline at end of file +var _0x8912=['../client','create','createWhatsappMessage'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x8912,0x87));var _0x2891=function(_0x30a6db,_0x84c322){_0x30a6db=_0x30a6db-0x0;var _0x23d0e4=_0x8912[_0x30a6db];return _0x23d0e4;};'use strict';var client=require(_0x2891('0x0'));exports[_0x2891('0x1')]=function(_0x3ed40c){return client['Request']('CreateWhatsappMessage',{'body':_0x3ed40c,'log':_0x2891('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b7db1a9..480546a 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 _0x041e=['../client','Request','GetWhatsappQueue','timeout','strategy','Agents','online','whatsappPause'];(function(_0x30b468,_0x50fdf5){var _0x367adf=function(_0x50eee0){while(--_0x50eee0){_0x30b468['push'](_0x30b468['shift']());}};_0x367adf(++_0x50fdf5);}(_0x041e,0xf8));var _0xe041=function(_0x22e1a5,_0x1da666){_0x22e1a5=_0x22e1a5-0x0;var _0x450660=_0x041e[_0x22e1a5];return _0x450660;};'use strict';var client=require(_0xe041('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xe041('0x1')](_0xe041('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe041('0x3'),_0xe041('0x4')],'include':[{'model':'User','as':_0xe041('0x5'),'attributes':['id','name',_0xe041('0x6'),_0xe041('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xdf3a=['Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xdf3a,0xe4));var _0xadf3=function(_0x4617d6,_0xf5a2b3){_0x4617d6=_0x4617d6-0x0;var _0x3e9e10=_0xdf3a[_0x4617d6];return _0x3e9e10;};'use strict';var client=require('../client');exports[_0xadf3('0x0')]=function(){return function(){return client[_0xadf3('0x1')](_0xadf3('0x2'),{'options':{'raw':![],'attributes':['id',_0xadf3('0x3'),'timeout',_0xadf3('0x4')],'include':[{'model':_0xadf3('0x5'),'as':_0xadf3('0x6'),'attributes':['id',_0xadf3('0x3'),_0xadf3('0x7'),_0xadf3('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 65b9386..d20be34 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 _0xc770=['../client','create','Request','update','UpdateWhatsappQueueReport','DESC'];(function(_0xdabc5e,_0x3a35a6){var _0x284739=function(_0x1aa194){while(--_0x1aa194){_0xdabc5e['push'](_0xdabc5e['shift']());}};_0x284739(++_0x3a35a6);}(_0xc770,0x120));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0c77('0x0'));exports[_0x0c77('0x1')]=function(_0x5947bd){return client[_0x0c77('0x2')]('CreateWhatsappQueueReport',{'body':_0x5947bd,'log':'CreateWhatsappQueueReport'});};exports[_0x0c77('0x3')]=function(_0x181ec7,_0x991e1){return client['Request'](_0x0c77('0x4'),{'body':_0x991e1,'options':{'where':{'uniqueid':_0x181ec7},'order':[['id',_0x0c77('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x57e0=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x2447cf,_0x969bb3){var _0x449b2a=function(_0x115249){while(--_0x115249){_0x2447cf['push'](_0x2447cf['shift']());}};_0x449b2a(++_0x969bb3);}(_0x57e0,0x198));var _0x057e=function(_0x1a345f,_0x55061f){_0x1a345f=_0x1a345f-0x0;var _0x171a18=_0x57e0[_0x1a345f];return _0x171a18;};'use strict';var client=require('../client');exports[_0x057e('0x0')]=function(_0xfba3be){return client['Request']('CreateWhatsappQueueReport',{'body':_0xfba3be,'log':_0x057e('0x1')});};exports[_0x057e('0x2')]=function(_0x590d68,_0x5944d6){return client[_0x057e('0x3')](_0x057e('0x4'),{'body':_0x5944d6,'options':{'where':{'uniqueid':_0x590d68},'order':[['id',_0x057e('0x5')]],'limit':0x1},'log':_0x057e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 6523a64..8878f97 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 _0x5c37=['stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log'];(function(_0x54515f,_0x4950a6){var _0x2048cf=function(_0x46f2fc){while(--_0x46f2fc){_0x54515f['push'](_0x54515f['shift']());}};_0x2048cf(++_0x4950a6);}(_0x5c37,0xf6));var _0x75c3=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x5c37[_0x4fe19c];return _0x952ac7;};'use strict';var schema=require(_0x75c3('0x0'));var _=require(_0x75c3('0x1'));var util=require(_0x75c3('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x75c3('0x3'))(_0x75c3('0x4'));var strategy=require(_0x75c3('0x5'));var queue=schema({'name':{'type':_0x75c3('0x6'),'required':!![],'message':_0x75c3('0x7')},'timeout':{'type':_0x75c3('0x8'),'message':_0x75c3('0x9')}});function writeLog(_0x30f859,_0x32f536,_0x561547){return logger[_0x75c3('0xa')](util[_0x75c3('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x30f859,_0x32f536['name'],_0x561547));}function handleFindAgent(_0x143e00){return function(_0x423893){return _0x423893[_0x75c3('0xc')]['toLowerCase']()===_0x143e00[_0x75c3('0xd')]();};}exports['consequence']=function(_0x463f41,_0x4e3c73,_0x21a4d0,_0xbae3f){return function(_0x4a5e51){try{var _0x16c9fc={'name':_0x4e3c73[0x0],'timeout':_0x4e3c73[0x1]};var _0x301f34=queue[_0x75c3('0x0')](_0x16c9fc,{'typecast':!![]});if(_0x301f34[_0x75c3('0xe')]){logger[_0x75c3('0xf')](_0x75c3('0x10'),_0x463f41,_['map'](_0x301f34,_0x75c3('0x11'))[_0x75c3('0x12')](',\x20'));_0x4a5e51['stop']();}else{var _0x55d6f7=_[_0x75c3('0x13')](_0x21a4d0[_0x75c3('0x14')],handleFindAgent(_0x16c9fc['name']));if(_0x55d6f7){var _0x56c55f=(_0x16c9fc['timeout']||0xa)*0x3e8;var _0x18e7ec,_0x53c80f;var _0x49e730=seqqueue['createQueue'](_0x56c55f);_0x49e730['id']=_0x463f41;_0x49e730[_0x75c3('0x15')]=_0x56c55f;_0x49e730[_0x75c3('0x16')]=_0xbae3f[_0x75c3('0x16')];writeLog(_0x463f41,_0x55d6f7,util['format'](_0x75c3('0x17'),_0x56c55f));_0x21a4d0[_0x75c3('0x18')][_0x463f41]['on'](_0x75c3('0x19'),function(){logger[_0x75c3('0xa')](_0x75c3('0x1a'),_0x463f41);clearTimeout(_0x53c80f);_0x53c80f=undefined;_0x49e730[_0x75c3('0x1b')]();if(_0x21a4d0[_0x75c3('0x18')][_0x463f41]){delete _0x21a4d0['rules'][_0x463f41];}_0x4a5e51[_0x75c3('0x1c')]();});_0x21a4d0['rules'][_0x463f41]['on'](_0x75c3('0x1d'),function(){if(_0x21a4d0[_0x75c3('0x18')][_0x463f41]){delete _0x21a4d0[_0x75c3('0x18')][_0x463f41];}});_0x53c80f=setTimeout(function(){logger['info'](_0x75c3('0x1e'),_0x463f41);clearTimeout(_0x53c80f);_0x49e730[_0x75c3('0x1b')]();_0x4a5e51[_0x75c3('0x1f')]();},_0x56c55f);strategy[_0x75c3('0x20')](_0x49e730,_0x55d6f7,_0x21a4d0,_0xbae3f);}else{logger[_0x75c3('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x463f41,_0x16c9fc[_0x75c3('0xc')]);_0x4a5e51[_0x75c3('0x1c')]();}}}catch(_0x395a23){console[_0x75c3('0x21')](_0x395a23);logger[_0x75c3('0xf')]('[%s][QUEUE]\x20%s',_0x463f41,_0x395a23[_0x75c3('0x22')]);_0x4a5e51[_0x75c3('0x1c')]();}};}; \ No newline at end of file +var _0x1e0f=['routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','START:%s','rules','end','info','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x1e0f,0xc2));var _0xf1e0=function(_0x254e57,_0x596f16){_0x254e57=_0x254e57-0x0;var _0x1303e1=_0x1e0f[_0x254e57];return _0x1303e1;};'use strict';var schema=require(_0xf1e0('0x0'));var _=require('lodash');var util=require(_0xf1e0('0x1'));var seqqueue=require(_0xf1e0('0x2'));var logger=require(_0xf1e0('0x3'))(_0xf1e0('0x4'));var strategy=require(_0xf1e0('0x5'));var queue=schema({'name':{'type':_0xf1e0('0x6'),'required':!![],'message':_0xf1e0('0x7')},'timeout':{'type':_0xf1e0('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x452ab4,_0x47ac94,_0x4339d1){return logger['info'](util[_0xf1e0('0x9')](_0xf1e0('0xa'),_0x452ab4,_0x47ac94[_0xf1e0('0xb')],_0x4339d1));}function handleFindAgent(_0x1c6424){return function(_0x3902a8){return _0x3902a8[_0xf1e0('0xb')][_0xf1e0('0xc')]()===_0x1c6424[_0xf1e0('0xc')]();};}exports['consequence']=function(_0xabd31e,_0x2cc007,_0x2e680e,_0xb69fdc){return function(_0x435d56){try{var _0x353f9a={'name':_0x2cc007[0x0],'timeout':_0x2cc007[0x1]};var _0x4e60ed=queue['validate'](_0x353f9a,{'typecast':!![]});if(_0x4e60ed['length']){logger[_0xf1e0('0xd')](_0xf1e0('0xe'),_0xabd31e,_[_0xf1e0('0xf')](_0x4e60ed,_0xf1e0('0x10'))['join'](',\x20'));_0x435d56[_0xf1e0('0x11')]();}else{var _0x1bc402=_[_0xf1e0('0x12')](_0x2e680e[_0xf1e0('0x13')],handleFindAgent(_0x353f9a[_0xf1e0('0xb')]));if(_0x1bc402){var _0x99c386=(_0x353f9a[_0xf1e0('0x14')]||0xa)*0x3e8;var _0x284fbf,_0x5a258d;var _0x2d1e09=seqqueue[_0xf1e0('0x15')](_0x99c386);_0x2d1e09['id']=_0xabd31e;_0x2d1e09['atimeout']=_0x99c386;_0x2d1e09['channel']=_0xb69fdc['channel'];writeLog(_0xabd31e,_0x1bc402,util[_0xf1e0('0x9')](_0xf1e0('0x16'),_0x99c386));_0x2e680e[_0xf1e0('0x17')][_0xabd31e]['on'](_0xf1e0('0x18'),function(){logger[_0xf1e0('0x19')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xabd31e);clearTimeout(_0x5a258d);_0x5a258d=undefined;_0x2d1e09[_0xf1e0('0x1a')]();if(_0x2e680e['rules'][_0xabd31e]){delete _0x2e680e['rules'][_0xabd31e];}_0x435d56[_0xf1e0('0x11')]();});_0x2e680e[_0xf1e0('0x17')][_0xabd31e]['on']('complete',function(){if(_0x2e680e[_0xf1e0('0x17')][_0xabd31e]){delete _0x2e680e[_0xf1e0('0x17')][_0xabd31e];}});_0x5a258d=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0xabd31e);clearTimeout(_0x5a258d);_0x2d1e09[_0xf1e0('0x1a')]();_0x435d56[_0xf1e0('0x1b')]();},_0x99c386);strategy[_0xf1e0('0x1c')](_0x2d1e09,_0x1bc402,_0x2e680e,_0xb69fdc);}else{logger[_0xf1e0('0xd')](_0xf1e0('0x1d'),_0xabd31e,_0x353f9a[_0xf1e0('0xb')]);_0x435d56['stop']();}}}catch(_0x26ee68){console[_0xf1e0('0x1e')](_0x26ee68);logger[_0xf1e0('0xd')](_0xf1e0('0x1f'),_0xabd31e,_0x26ee68[_0xf1e0('0x20')]);_0x435d56[_0xf1e0('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 3d25aad..72e8d93 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 _0xb310=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','error','amazonlex','Failed','catch','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','info','[%s][AMAZONLEX]\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb310,0x18b));var _0x0b31=function(_0x20a8a2,_0x1f0093){_0x20a8a2=_0x20a8a2-0x0;var _0x160826=_0xb310[_0x20a8a2];return _0x160826;};'use strict';var _=require('lodash');var moment=require(_0x0b31('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x0b31('0x1'))(_0x0b31('0x2'));var rpc={'chatMessage':require(_0x0b31('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0b31('0x4')),'faxMessage':require(_0x0b31('0x5')),'whatsappMessage':require(_0x0b31('0x6'))};exports[_0x0b31('0x7')]=function(_0x205e81,_0x3c478f){return function(_0x363585){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x0b31('0x8')](_0x0b31('0x9'),_0x205e81,_0x0b31('0xa'));return _0x363585[_0x0b31('0xb')]();}var _0x44c0fb={'ContactId':this[_0x0b31('0xc')]['id'],'sentAt':moment()[_0x0b31('0xd')](_0x0b31('0xe')),'direction':_0x0b31('0xf')};if(this[_0x0b31('0x10')]===_0x0b31('0x11')||this['channel']===_0x0b31('0x12')){_0x44c0fb[_0x0b31('0x13')]=this[_0x0b31('0x14')]['phone'];}var _0x4a483d=this[_0x0b31('0x10')];if(_0x4a483d===_0x0b31('0x15')){_0x44c0fb[_0x0b31('0x16')]=this[_0x0b31('0x17')]['id'];}else{_0x44c0fb[_['upperFirst'](_0x4a483d)+_0x0b31('0x18')]=this[_0x0b31('0x17')]['id'];}_0x44c0fb[_[_0x0b31('0x19')](_0x4a483d)+_0x0b31('0x1a')]=this[_0x0b31('0x14')]['id'];if(this['interaction'][_0x0b31('0x1b')]){var _0x2f6d35=_0x3c478f[0x4];if(!_[_0x0b31('0x1c')](_0x2f6d35)){_0x44c0fb[_0x0b31('0x1d')]=utils[_0x0b31('0x1e')](_0x2f6d35,this);return rpc[_0x4a483d+_0x0b31('0x1f')][_0x0b31('0x20')](_0x44c0fb)[_0x0b31('0x21')](function(_0x232ea8){logger[_0x0b31('0x8')](_0x0b31('0x9'),_0x205e81,_0x44c0fb['body']);})['catch'](function(_0x26b94e){logger['error'](_0x0b31('0x9'),_0x205e81,JSON[_0x0b31('0x22')](_0x26b94e));})[_0x0b31('0x23')](function(){logger[_0x0b31('0x8')](_0x0b31('0x24'),_0x205e81);_0x363585[_0x0b31('0x25')]();});}else{logger[_0x0b31('0x8')](_0x0b31('0x26'),_0x205e81);_0x363585[_0x0b31('0x25')]();}}else{var _0x206a3e=this;var _0x121af5=new AWS['LexRuntime']({'accessKeyId':_0x3c478f[0x0],'secretAccessKey':_0x3c478f[0x1],'region':_0x3c478f[0x2]});var _0x3370ac={'botAlias':_0x0b31('0x27'),'botName':_0x3c478f[0x3],'inputText':this[_0x0b31('0x28')][_0x0b31('0x1d')],'userId':this[_0x0b31('0x10')]+':'+this[_0x0b31('0x14')]['id']['toString']()};_0x121af5['postText'](_0x3370ac,function(_0x9ff69d,_0x4357ff){if(_0x9ff69d){logger[_0x0b31('0x29')]('[%s][AMAZONLEX]\x20%s',_0x205e81,_0x9ff69d['message']);_0x363585[_0x0b31('0xb')]();}else if(_0x4357ff&&_0x4357ff[_0x0b31('0x28')]){_0x206a3e['body']['amazonlex']=_0x4357ff;_0x44c0fb[_0x0b31('0x1d')]=_0x4357ff['message'];_0x44c0fb['providerName']=_0x0b31('0x2a');_0x44c0fb['providerResponse']=JSON[_0x0b31('0x22')](_0x4357ff);return rpc[_0x4a483d+_0x0b31('0x1f')][_0x0b31('0x20')](_0x44c0fb)['then'](function(_0x44dbc2){logger[_0x0b31('0x8')](_0x0b31('0x9'),_0x205e81,_0x44c0fb['body']);if(_0x4357ff['dialogState']==_0x0b31('0x2b')){_0x363585[_0x0b31('0xb')]();}else{_0x363585['stop']();}})[_0x0b31('0x2c')](function(_0x18e0a2){logger['error'](_0x0b31('0x9'),_0x205e81,JSON[_0x0b31('0x22')](_0x18e0a2));_0x363585[_0x0b31('0xb')]();});}else{_0x363585[_0x0b31('0xb')]();}});}}catch(_0xc0ab56){logger[_0x0b31('0x29')](_0x0b31('0x9'),_0x205e81,JSON[_0x0b31('0x22')](_0xc0ab56));_0x363585[_0x0b31('0x25')]();}};}; \ No newline at end of file +var _0x6018=['lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','toString','postText','next','amazonlex','providerName','providerResponse','dialogState'];(function(_0x505fbf,_0x33e41d){var _0x4cc28c=function(_0x1120da){while(--_0x1120da){_0x505fbf['push'](_0x505fbf['shift']());}};_0x4cc28c(++_0x33e41d);}(_0x6018,0x1b9));var _0x8601=function(_0x4a9d35,_0x348834){_0x4a9d35=_0x4a9d35-0x0;var _0x42fa5d=_0x6018[_0x4a9d35];return _0x42fa5d;};'use strict';var _=require(_0x8601('0x0'));var moment=require(_0x8601('0x1'));var AWS=require(_0x8601('0x2'));var utils=require(_0x8601('0x3'));var logger=require(_0x8601('0x4'))(_0x8601('0x5'));var rpc={'chatMessage':require(_0x8601('0x6')),'openchannelMessage':require(_0x8601('0x7')),'mailMessage':require(_0x8601('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8601('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8601('0xa')]=function(_0x174d25,_0x4b3358){return function(_0x31f671){try{if(!_[_0x8601('0xb')](this[_0x8601('0xc')][_0x8601('0xd')])){logger[_0x8601('0xe')](_0x8601('0xf'),_0x174d25,_0x8601('0x10'));return _0x31f671['next']();}var _0xe1b1b4={'ContactId':this[_0x8601('0x11')]['id'],'sentAt':moment()['format'](_0x8601('0x12')),'direction':_0x8601('0x13')};if(this['channel']===_0x8601('0x14')||this[_0x8601('0x15')]==='whatsapp'){_0xe1b1b4[_0x8601('0x16')]=this[_0x8601('0xc')]['phone'];}var _0x9177d1=this[_0x8601('0x15')];if(_0x9177d1===_0x8601('0x17')){_0xe1b1b4['ChatWebsiteId']=this['account']['id'];}else{_0xe1b1b4[_[_0x8601('0x18')](_0x9177d1)+_0x8601('0x19')]=this[_0x8601('0x1a')]['id'];}_0xe1b1b4[_[_0x8601('0x18')](_0x9177d1)+_0x8601('0x1b')]=this[_0x8601('0xc')]['id'];if(this[_0x8601('0xc')][_0x8601('0x1c')]){var _0x4a3682=_0x4b3358[0x4];if(!_[_0x8601('0x1d')](_0x4a3682)){_0xe1b1b4[_0x8601('0x1e')]=utils[_0x8601('0x1f')](_0x4a3682,this);return rpc[_0x9177d1+_0x8601('0x20')][_0x8601('0x21')](_0xe1b1b4)[_0x8601('0x22')](function(_0x65945b){logger[_0x8601('0xe')](_0x8601('0xf'),_0x174d25,_0xe1b1b4[_0x8601('0x1e')]);})[_0x8601('0x23')](function(_0x141e03){logger[_0x8601('0x24')](_0x8601('0xf'),_0x174d25,JSON[_0x8601('0x25')](_0x141e03));})[_0x8601('0x26')](function(){logger[_0x8601('0xe')](_0x8601('0x27'),_0x174d25);_0x31f671[_0x8601('0x28')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x174d25);_0x31f671[_0x8601('0x28')]();}}else{var _0x28cc61=this;var _0x30e26c=new AWS['LexRuntime']({'accessKeyId':_0x4b3358[0x0],'secretAccessKey':_0x4b3358[0x1],'region':_0x4b3358[0x2]});var _0x595e1e={'botAlias':'$LATEST','botName':_0x4b3358[0x3],'inputText':this[_0x8601('0x29')][_0x8601('0x1e')],'userId':this[_0x8601('0x15')]+':'+this['interaction']['id'][_0x8601('0x2a')]()};_0x30e26c[_0x8601('0x2b')](_0x595e1e,function(_0x2767df,_0x447caa){if(_0x2767df){logger[_0x8601('0x24')](_0x8601('0xf'),_0x174d25,_0x2767df[_0x8601('0x29')]);_0x31f671[_0x8601('0x2c')]();}else if(_0x447caa&&_0x447caa['message']){_0x28cc61[_0x8601('0x1e')][_0x8601('0x2d')]=_0x447caa;_0xe1b1b4[_0x8601('0x1e')]=_0x447caa['message'];_0xe1b1b4[_0x8601('0x2e')]=_0x8601('0x2d');_0xe1b1b4[_0x8601('0x2f')]=JSON[_0x8601('0x25')](_0x447caa);return rpc[_0x9177d1+'Message']['create'](_0xe1b1b4)[_0x8601('0x22')](function(_0x5ea291){logger['info']('[%s][AMAZONLEX]\x20%s',_0x174d25,_0xe1b1b4[_0x8601('0x1e')]);if(_0x447caa[_0x8601('0x30')]=='Failed'){_0x31f671['next']();}else{_0x31f671[_0x8601('0x28')]();}})['catch'](function(_0x1df05d){logger[_0x8601('0x24')]('[%s][AMAZONLEX]\x20%s',_0x174d25,JSON['stringify'](_0x1df05d));_0x31f671[_0x8601('0x2c')]();});}else{_0x31f671['next']();}});}}catch(_0x48de2d){logger[_0x8601('0x24')](_0x8601('0xf'),_0x174d25,JSON[_0x8601('0x25')](_0x48de2d));_0x31f671['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index f22679c..5a2556f 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 _0x6ae6=['from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','account','InteractionId','Message','inReplyTo','messageId','','replace','','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','error','finally','resolve','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','body','message'];(function(_0x2fd347,_0x12511a){var _0x503762=function(_0x45e081){while(--_0x45e081){_0x2fd347['push'](_0x2fd347['shift']());}};_0x503762(++_0x12511a);}(_0x6ae6,0xe1));var _0x66ae=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x6ae6[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var moment=require(_0x66ae('0x0'));var utils=require('./utils');var logger=require(_0x66ae('0x1'))('routing');var rpc={'chatMessage':require(_0x66ae('0x2')),'openchannelMessage':require(_0x66ae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x66ae('0x4')),'faxMessage':require(_0x66ae('0x5')),'whatsappMessage':require(_0x66ae('0x6')),'chatInteraction':require(_0x66ae('0x7')),'openchannelInteraction':require(_0x66ae('0x8')),'mailInteraction':require(_0x66ae('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x66ae('0xa'))};var mailRpc=require(_0x66ae('0xb'));exports[_0x66ae('0xc')]=function(_0x44ddb9,_0x2346be,_0x4e62bb,_0x154f8b){return function(_0xc51d16){try{var _0x20b6fa=this[_0x66ae('0xd')];if(_0x20b6fa===_0x66ae('0xe')&&_0x154f8b['body']['isAutoreply']){logger[_0x66ae('0xf')]('[%s][AUTOREPLY]\x20%s',_0x44ddb9,_0x66ae('0x10'));return _0xc51d16['next']();}if(_0x2346be[0x0]==='1'&&(_[_0x66ae('0x11')](this[_0x66ae('0x12')][_0x66ae('0x13')])||!this[_0x66ae('0x12')][_0x66ae('0x13')])){logger[_0x66ae('0xf')](_0x66ae('0x14'),_0x44ddb9,'Autoreply\x20already\x20sent');return _0xc51d16[_0x66ae('0x15')]();}if(_0x2346be[0x0]==='2'&&this[_0x66ae('0x12')][_0x66ae('0x16')]){logger[_0x66ae('0xf')](_0x66ae('0x17'),_0x44ddb9,_0x66ae('0x18'));return _0xc51d16[_0x66ae('0x15')]();}var _0x372f09={'ContactId':this['contact']['id'],'sentAt':moment()[_0x66ae('0x19')](_0x66ae('0x1a')),'direction':_0x66ae('0x1b')};if(this[_0x66ae('0xd')]===_0x66ae('0xe')){_0x372f09['body']=utils[_0x66ae('0x1c')](_0x2346be[0x2],this);}else{_0x372f09[_0x66ae('0x1d')]=utils['getMustacheRender'](_0x2346be[0x1],this);}if(this[_0x66ae('0x1e')]){_0x372f09['to']=this[_0x66ae('0x1e')][_0x66ae('0x1f')]||'';if(this['channel']===_0x66ae('0xe')&&_0x2346be[0x1]==='1'){_0x372f09['cc']=this[_0x66ae('0x1e')]['cc']||'';}_0x372f09[_0x66ae('0x1f')]=this[_0x66ae('0x1e')]['to']||'';_0x372f09[_0x66ae('0x20')]=this[_0x66ae('0x1e')][_0x66ae('0x20')]||'';_0x372f09[_0x66ae('0x21')]=!![];if(this['message'][_0x66ae('0x22')]){_0x372f09['subject']='';_0x372f09[_0x66ae('0x22')]+=_[_0x66ae('0x23')](this['message'][_0x66ae('0x22')],_0x66ae('0x24'))?'':_0x66ae('0x25');_0x372f09['subject']+=this[_0x66ae('0x1e')][_0x66ae('0x22')];}}if(this[_0x66ae('0xd')]===_0x66ae('0x26')){_0x372f09['ChatWebsiteId']=this['account']['id'];}else{_0x372f09[_[_0x66ae('0x27')](this['channel'])+'AccountId']=this[_0x66ae('0x28')]['id'];}_0x372f09[_[_0x66ae('0x27')](this[_0x66ae('0xd')])+_0x66ae('0x29')]=this[_0x66ae('0x12')]['id'];var _0x4a6a5b=this['interaction'];if(rpc[this['channel']+_0x66ae('0x2a')]){if(this['channel']==='mail'){_0x372f09[_0x66ae('0x2b')]=this['message'][_0x66ae('0x2c')];_0x372f09['html']=_0x66ae('0x2d')+_[_0x66ae('0x2e')](_0x372f09['body'],'','replace','','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','autoreplyExecuted','update','error','finally','resolve','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','read','subject','startsWith','chat','ChatWebsiteId','upperFirst','InteractionId','Message','messageId'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x08ac,0x1c7));var _0xc08a=function(_0x1dd31d,_0x5cfed4){_0x1dd31d=_0x1dd31d-0x0;var _0x2a887f=_0x08ac[_0x1dd31d];return _0x2a887f;};'use strict';var _=require(_0xc08a('0x0'));var moment=require('moment');var utils=require(_0xc08a('0x1'));var logger=require(_0xc08a('0x2'))(_0xc08a('0x3'));var rpc={'chatMessage':require(_0xc08a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc08a('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc08a('0x6')),'whatsappMessage':require(_0xc08a('0x7')),'chatInteraction':require(_0xc08a('0x8')),'openchannelInteraction':require(_0xc08a('0x9')),'mailInteraction':require(_0xc08a('0xa')),'smsInteraction':require(_0xc08a('0xb')),'faxInteraction':require(_0xc08a('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xc08a('0xd')]=function(_0x54da3f,_0x1ac340,_0x3cb895,_0x1ce146){return function(_0x2843da){try{var _0x1f4227=this[_0xc08a('0xe')];if(_0x1f4227===_0xc08a('0xf')&&_0x1ce146[_0xc08a('0x10')][_0xc08a('0x11')]){logger[_0xc08a('0x12')](_0xc08a('0x13'),_0x54da3f,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2843da[_0xc08a('0x14')]();}if(_0x1ac340[0x0]==='1'&&(_[_0xc08a('0x15')](this[_0xc08a('0x16')][_0xc08a('0x17')])||!this[_0xc08a('0x16')]['created'])){logger[_0xc08a('0x12')](_0xc08a('0x13'),_0x54da3f,'Autoreply\x20already\x20sent');return _0x2843da[_0xc08a('0x14')]();}if(_0x1ac340[0x0]==='2'&&this[_0xc08a('0x16')]['autoreplyExecuted']){logger[_0xc08a('0x12')](_0xc08a('0x18'),_0x54da3f,_0xc08a('0x19'));return _0x2843da['next']();}var _0x2f772b={'ContactId':this[_0xc08a('0x1a')]['id'],'sentAt':moment()[_0xc08a('0x1b')](_0xc08a('0x1c')),'direction':'out'};if(this[_0xc08a('0xe')]==='mail'){_0x2f772b[_0xc08a('0x10')]=utils[_0xc08a('0x1d')](_0x1ac340[0x2],this);}else{_0x2f772b[_0xc08a('0x10')]=utils[_0xc08a('0x1d')](_0x1ac340[0x1],this);}if(this['message']){_0x2f772b['to']=this[_0xc08a('0x1e')][_0xc08a('0x1f')]||'';if(this[_0xc08a('0xe')]===_0xc08a('0xf')&&_0x1ac340[0x1]==='1'){_0x2f772b['cc']=this[_0xc08a('0x1e')]['cc']||'';}_0x2f772b[_0xc08a('0x1f')]=this[_0xc08a('0x1e')]['to']||'';_0x2f772b['phone']=this[_0xc08a('0x1e')]['phone']||'';_0x2f772b[_0xc08a('0x20')]=!![];if(this[_0xc08a('0x1e')][_0xc08a('0x21')]){_0x2f772b[_0xc08a('0x21')]='';_0x2f772b[_0xc08a('0x21')]+=_[_0xc08a('0x22')](this[_0xc08a('0x1e')][_0xc08a('0x21')],'Re:')?'':'Re:\x20';_0x2f772b['subject']+=this[_0xc08a('0x1e')][_0xc08a('0x21')];}}if(this['channel']===_0xc08a('0x23')){_0x2f772b[_0xc08a('0x24')]=this['account']['id'];}else{_0x2f772b[_['upperFirst'](this[_0xc08a('0xe')])+'AccountId']=this['account']['id'];}_0x2f772b[_[_0xc08a('0x25')](this['channel'])+_0xc08a('0x26')]=this[_0xc08a('0x16')]['id'];var _0xe863b7=this[_0xc08a('0x16')];if(rpc[this['channel']+_0xc08a('0x27')]){if(this[_0xc08a('0xe')]===_0xc08a('0xf')){_0x2f772b['inReplyTo']=this['message'][_0xc08a('0x28')];_0x2f772b[_0xc08a('0x29')]=_0xc08a('0x2a')+_[_0xc08a('0x2b')](_0x2f772b[_0xc08a('0x10')],_0xc08a('0x2c'),_0xc08a('0x2d'))+_0xc08a('0x2e');_0x2f772b['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xc08a('0x2f')};return mailRpc[_0xc08a('0x30')](this['account'][_0xc08a('0x31')],_0x2f772b)[_0xc08a('0x32')](function(_0xf1d02d){logger['info'](_0xc08a('0x33'),_0x54da3f);_0x2f772b[_0xc08a('0x28')]=_0xf1d02d[_0xc08a('0x1e')][_0xc08a('0x28')];return rpc[_0x1f4227+_0xc08a('0x27')][_0xc08a('0x34')](_0x2f772b);})[_0xc08a('0x32')](function(_0x19898b){logger[_0xc08a('0x12')]('[%s][AUTOREPLY]\x20%s',_0x54da3f,JSON[_0xc08a('0x35')](_0x19898b));})[_0xc08a('0x36')](function(_0x1d2834){logger['error'](_0xc08a('0x37'),_0x54da3f,JSON[_0xc08a('0x35')](_0x1d2834));})['finally'](function(){Promise['resolve']()[_0xc08a('0x32')](function(){if(_0x1ac340[0x0]!=='2'||_0xe863b7[_0xc08a('0x38')])return;return rpc[_0x1f4227+'Interaction'][_0xc08a('0x39')](_0xe863b7['id'],{'autoreplyExecuted':!![]})['then'](function(_0x30a700){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x54da3f,JSON['stringify'](_0x30a700));})[_0xc08a('0x36')](function(_0xe8b6e9){logger[_0xc08a('0x3a')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x54da3f,JSON[_0xc08a('0x35')](_0xe8b6e9));});})[_0xc08a('0x32')](function(){_0x2843da[_0xc08a('0x14')]();});});}else{return rpc[this['channel']+_0xc08a('0x27')][_0xc08a('0x34')](_0x2f772b)[_0xc08a('0x32')](function(){logger['info'](_0xc08a('0x13'),_0x54da3f,_0x2f772b[_0xc08a('0x10')]);})[_0xc08a('0x36')](function(_0x33544e){logger[_0xc08a('0x3a')](_0xc08a('0x13'),_0x54da3f,JSON[_0xc08a('0x35')](_0x33544e));})[_0xc08a('0x3b')](function(){Promise[_0xc08a('0x3c')]()[_0xc08a('0x32')](function(){if(_0x1ac340[0x0]!=='2'||_0xe863b7[_0xc08a('0x38')])return;return rpc[_0x1f4227+'Interaction']['update'](_0xe863b7['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2a3945){logger['info'](_0xc08a('0x18'),_0x54da3f,JSON[_0xc08a('0x35')](_0x2a3945));})['catch'](function(_0x56a66e){logger[_0xc08a('0x3a')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x54da3f,JSON['stringify'](_0x56a66e));});})['then'](function(){_0x2843da[_0xc08a('0x14')]();});});}}}catch(_0x1e8566){logger[_0xc08a('0x3a')](_0xc08a('0x13'),_0x54da3f,JSON[_0xc08a('0x35')](_0x1e8566));_0x2843da[_0xc08a('0x3d')]();}};}; \ 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 c48e75e..10db13e 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 _0xce92=['finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x413b62,_0x740bd3){var _0x19bad0=function(_0x419a1b){while(--_0x419a1b){_0x413b62['push'](_0x413b62['shift']());}};_0x19bad0(++_0x740bd3);}(_0xce92,0x147));var _0x2ce9=function(_0x59cf8a,_0x163bb9){_0x59cf8a=_0x59cf8a-0x0;var _0x22dde8=_0xce92[_0x59cf8a];return _0x22dde8;};'use strict';var moment=require(_0x2ce9('0x0'));var logger=require(_0x2ce9('0x1'))(_0x2ce9('0x2'));var rpc={'chatInteraction':require(_0x2ce9('0x3')),'openchannelInteraction':require(_0x2ce9('0x4')),'smsInteraction':require(_0x2ce9('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2ce9('0x6')),'whatsappInteraction':require(_0x2ce9('0x7'))};exports[_0x2ce9('0x8')]=function(_0x256fcf,_0x1745f1,_0x289a34,_0x5f0787){return function(_0x101e1d){try{logger[_0x2ce9('0x9')](_0x2ce9('0xa'),_0x256fcf,_0x1745f1[0x0]);var _0x2e2bf2={'closed':0x1,'closedAt':moment()[_0x2ce9('0xb')](_0x2ce9('0xc')),'closeReason':_0x2ce9('0xd'),'disposition':_0x1745f1[0x0]};if(rpc[_0x5f0787[_0x2ce9('0xe')]+_0x2ce9('0xf')]){rpc[_0x5f0787[_0x2ce9('0xe')]+_0x2ce9('0xf')][_0x2ce9('0x10')](_0x5f0787['interaction']['id'],_0x2e2bf2)[_0x2ce9('0x11')](function(_0x24ed33){logger[_0x2ce9('0x9')](_0x2ce9('0x12'),_0x256fcf,_0x5f0787[_0x2ce9('0x13')]['id']);})['catch'](function(_0xa1640b){logger[_0x2ce9('0x14')](_0x2ce9('0x15'),_0x256fcf,JSON[_0x2ce9('0x16')](_0xa1640b));})[_0x2ce9('0x17')](function(){_0x101e1d[_0x2ce9('0x18')]();});}}catch(_0x50a1d7){logger[_0x2ce9('0x14')](_0x2ce9('0x15'),_0x256fcf,JSON['stringify'](_0x50a1d7));_0x101e1d[_0x2ce9('0x18')]();}};}; \ No newline at end of file +var _0x66e0=['update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel'];(function(_0x3fb9cd,_0x1943e1){var _0x25647c=function(_0x5709b5){while(--_0x5709b5){_0x3fb9cd['push'](_0x3fb9cd['shift']());}};_0x25647c(++_0x1943e1);}(_0x66e0,0x1bf));var _0x066e=function(_0x378ed4,_0x1ca2e7){_0x378ed4=_0x378ed4-0x0;var _0xdc2ab6=_0x66e0[_0x378ed4];return _0xdc2ab6;};'use strict';var moment=require(_0x066e('0x0'));var logger=require(_0x066e('0x1'))(_0x066e('0x2'));var rpc={'chatInteraction':require(_0x066e('0x3')),'openchannelInteraction':require(_0x066e('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x066e('0x5')),'faxInteraction':require(_0x066e('0x6')),'whatsappInteraction':require(_0x066e('0x7'))};exports['consequence']=function(_0x4863c8,_0x1cc239,_0x4a6ec9,_0x1e3dec){return function(_0x5231cd){try{logger[_0x066e('0x8')](_0x066e('0x9'),_0x4863c8,_0x1cc239[0x0]);var _0x20aaba={'closed':0x1,'closedAt':moment()[_0x066e('0xa')](_0x066e('0xb')),'closeReason':_0x066e('0xc'),'disposition':_0x1cc239[0x0]};if(rpc[_0x1e3dec['channel']+_0x066e('0xd')]){rpc[_0x1e3dec[_0x066e('0xe')]+_0x066e('0xd')][_0x066e('0xf')](_0x1e3dec['interaction']['id'],_0x20aaba)['then'](function(_0x1f5ff6){logger[_0x066e('0x8')](_0x066e('0x10'),_0x4863c8,_0x1e3dec['interaction']['id']);})[_0x066e('0x11')](function(_0x424210){logger['error'](_0x066e('0x12'),_0x4863c8,JSON[_0x066e('0x13')](_0x424210));})[_0x066e('0x14')](function(){_0x5231cd[_0x066e('0x15')]();});}}catch(_0x2e6d8a){logger['error']('[%s][CLOSE]\x20%s',_0x4863c8,JSON[_0x066e('0x13')](_0x2e6d8a));_0x5231cd[_0x066e('0x15')]();}};}; \ 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 97c3484..eb04094 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 _0xf3fe=['error','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','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','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','dialogflow','result','fulfillment','providerName','providerResponse','next'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x228993,_0x88d574){_0x228993=_0x228993-0x0;var _0x56f819=_0xf3fe[_0x228993];return _0x56f819;};'use strict';var _=require('lodash');var moment=require(_0xef3f('0x0'));var apiai=require(_0xef3f('0x1'));var md5=require(_0xef3f('0x2'));var utils=require(_0xef3f('0x3'));var logger=require(_0xef3f('0x4'))('routing');var rpc={'chatMessage':require(_0xef3f('0x5')),'openchannelMessage':require(_0xef3f('0x6')),'mailMessage':require(_0xef3f('0x7')),'smsMessage':require(_0xef3f('0x8')),'faxMessage':require(_0xef3f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x9e20c7,_0x2f5a64){return function(_0x211a6c){try{if(!_[_0xef3f('0xa')](this[_0xef3f('0xb')][_0xef3f('0xc')])){logger[_0xef3f('0xd')](_0xef3f('0xe'),_0x9e20c7,_0xef3f('0xf'));return _0x211a6c['next']();}var _0x3eb85b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xef3f('0x10')](_0xef3f('0x11')),'direction':_0xef3f('0x12')};if(this[_0xef3f('0x13')]==='sms'||this[_0xef3f('0x13')]===_0xef3f('0x14')){_0x3eb85b['phone']=this[_0xef3f('0xb')]['phone'];}var _0x1433ea=this['channel'];if(_0x1433ea===_0xef3f('0x15')){_0x3eb85b[_0xef3f('0x16')]=this[_0xef3f('0x17')]['id'];}else{_0x3eb85b[_[_0xef3f('0x18')](_0x1433ea)+_0xef3f('0x19')]=this[_0xef3f('0x17')]['id'];}_0x3eb85b[_[_0xef3f('0x18')](_0x1433ea)+_0xef3f('0x1a')]=this[_0xef3f('0xb')]['id'];if(this[_0xef3f('0xb')][_0xef3f('0x1b')]){var _0x51ac83=_0x2f5a64[0x2];if(!_[_0xef3f('0x1c')](_0x51ac83)){_0x3eb85b[_0xef3f('0x1d')]=utils['getMustacheRender'](_0x51ac83,this);return rpc[_0x1433ea+_0xef3f('0x1e')][_0xef3f('0x1f')](_0x3eb85b)['then'](function(_0x4b97cf){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x9e20c7,_0x3eb85b[_0xef3f('0x1d')]);})[_0xef3f('0x20')](function(_0x4aca16){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x9e20c7,JSON[_0xef3f('0x21')](_0x4aca16));})['finally'](function(){logger[_0xef3f('0xd')](_0xef3f('0x22'),_0x9e20c7);_0x211a6c[_0xef3f('0x23')]();});}else{logger[_0xef3f('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x9e20c7);_0x211a6c['stop']();}}else{var _0x3847ec=this;var _0x1b83ee=apiai(_0x2f5a64[0x0],{'language':_0x2f5a64[0x1]||'en'});return _0x1b83ee[_0xef3f('0x24')](this[_0xef3f('0x25')][_0xef3f('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0xef3f('0x26')](function(_0x2e4432){_0x3847ec[_0xef3f('0x1d')][_0xef3f('0x27')]=_0x2e4432;_0x3eb85b['body']=_0x2e4432[_0xef3f('0x28')][_0xef3f('0x29')]['speech'];_0x3eb85b[_0xef3f('0x2a')]='dialogflow';_0x3eb85b[_0xef3f('0x2b')]=JSON['stringify'](_0x2e4432);return rpc[_0x1433ea+'Message']['create'](_0x3eb85b)[_0xef3f('0x26')](function(_0x465587){logger[_0xef3f('0xd')](_0xef3f('0xe'),_0x9e20c7,_0x3eb85b[_0xef3f('0x1d')]);if(_0x2e4432[_0xef3f('0x28')]['metadata']['endConversation']){_0x211a6c['next']();}else{_0x211a6c[_0xef3f('0x23')]();}})[_0xef3f('0x20')](function(_0x73221a){logger['error'](_0xef3f('0xe'),_0x9e20c7,JSON[_0xef3f('0x21')](_0x73221a));_0x211a6c[_0xef3f('0x2c')]();});})[_0xef3f('0x20')](function(_0x545151){logger[_0xef3f('0x2d')](_0xef3f('0xe'),_0x9e20c7,_0x545151[_0xef3f('0x25')]);_0x211a6c[_0xef3f('0x2c')]();});}}catch(_0x5ad582){logger[_0xef3f('0x2d')](_0xef3f('0xe'),_0x9e20c7,JSON[_0xef3f('0x21')](_0x5ad582));_0x211a6c[_0xef3f('0x23')]();}};}; \ No newline at end of file +var _0x4cc7=['AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst'];(function(_0x5a096e,_0x33f677){var _0x4e4ee7=function(_0x76c857){while(--_0x76c857){_0x5a096e['push'](_0x5a096e['shift']());}};_0x4e4ee7(++_0x33f677);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x23c1e0,_0x2b78f3){_0x23c1e0=_0x23c1e0-0x0;var _0x14b5d3=_0x4cc7[_0x23c1e0];return _0x14b5d3;};'use strict';var _=require(_0x74cc('0x0'));var moment=require(_0x74cc('0x1'));var apiai=require(_0x74cc('0x2'));var md5=require(_0x74cc('0x3'));var utils=require(_0x74cc('0x4'));var logger=require(_0x74cc('0x5'))(_0x74cc('0x6'));var rpc={'chatMessage':require(_0x74cc('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x74cc('0x8')),'smsMessage':require(_0x74cc('0x9')),'faxMessage':require(_0x74cc('0xa')),'whatsappMessage':require(_0x74cc('0xb'))};exports[_0x74cc('0xc')]=function(_0x1d2678,_0x3704b8){return function(_0x2b104a){try{if(!_[_0x74cc('0xd')](this[_0x74cc('0xe')][_0x74cc('0xf')])){logger[_0x74cc('0x10')](_0x74cc('0x11'),_0x1d2678,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b104a[_0x74cc('0x12')]();}var _0x19d928={'ContactId':this[_0x74cc('0x13')]['id'],'sentAt':moment()[_0x74cc('0x14')](_0x74cc('0x15')),'direction':_0x74cc('0x16')};if(this[_0x74cc('0x17')]===_0x74cc('0x18')||this[_0x74cc('0x17')]===_0x74cc('0x19')){_0x19d928[_0x74cc('0x1a')]=this[_0x74cc('0xe')]['phone'];}var _0x2ed7b6=this[_0x74cc('0x17')];if(_0x2ed7b6===_0x74cc('0x1b')){_0x19d928['ChatWebsiteId']=this[_0x74cc('0x1c')]['id'];}else{_0x19d928[_[_0x74cc('0x1d')](_0x2ed7b6)+_0x74cc('0x1e')]=this[_0x74cc('0x1c')]['id'];}_0x19d928[_[_0x74cc('0x1d')](_0x2ed7b6)+_0x74cc('0x1f')]=this[_0x74cc('0xe')]['id'];if(this[_0x74cc('0xe')][_0x74cc('0x20')]){var _0x5d8c7b=_0x3704b8[0x2];if(!_['isEmpty'](_0x5d8c7b)){_0x19d928[_0x74cc('0x21')]=utils[_0x74cc('0x22')](_0x5d8c7b,this);return rpc[_0x2ed7b6+_0x74cc('0x23')][_0x74cc('0x24')](_0x19d928)[_0x74cc('0x25')](function(_0x4efb24){logger[_0x74cc('0x10')](_0x74cc('0x11'),_0x1d2678,_0x19d928[_0x74cc('0x21')]);})[_0x74cc('0x26')](function(_0x2885c0){logger[_0x74cc('0x27')](_0x74cc('0x11'),_0x1d2678,JSON[_0x74cc('0x28')](_0x2885c0));})[_0x74cc('0x29')](function(){logger[_0x74cc('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1d2678);_0x2b104a[_0x74cc('0x2a')]();});}else{logger[_0x74cc('0x10')](_0x74cc('0x2b'),_0x1d2678);_0x2b104a[_0x74cc('0x2a')]();}}else{var _0x433583=this;var _0x18183c=apiai(_0x3704b8[0x0],{'language':_0x3704b8[0x1]||'en'});return _0x18183c[_0x74cc('0x2c')](this[_0x74cc('0x2d')][_0x74cc('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0x74cc('0x25')](function(_0x3c327d){_0x433583['body'][_0x74cc('0x2e')]=_0x3c327d;_0x19d928[_0x74cc('0x21')]=_0x3c327d[_0x74cc('0x2f')][_0x74cc('0x30')][_0x74cc('0x31')];_0x19d928['providerName']=_0x74cc('0x2e');_0x19d928[_0x74cc('0x32')]=JSON['stringify'](_0x3c327d);return rpc[_0x2ed7b6+_0x74cc('0x23')][_0x74cc('0x24')](_0x19d928)[_0x74cc('0x25')](function(_0x1a7739){logger[_0x74cc('0x10')](_0x74cc('0x11'),_0x1d2678,_0x19d928['body']);if(_0x3c327d[_0x74cc('0x2f')][_0x74cc('0x33')]['endConversation']){_0x2b104a['next']();}else{_0x2b104a[_0x74cc('0x2a')]();}})[_0x74cc('0x26')](function(_0x349832){logger[_0x74cc('0x27')](_0x74cc('0x11'),_0x1d2678,JSON[_0x74cc('0x28')](_0x349832));_0x2b104a[_0x74cc('0x12')]();});})['catch'](function(_0x3ffe94){logger[_0x74cc('0x27')](_0x74cc('0x11'),_0x1d2678,_0x3ffe94['message']);_0x2b104a[_0x74cc('0x12')]();});}}catch(_0x269f37){logger[_0x74cc('0x27')](_0x74cc('0x11'),_0x1d2678,JSON[_0x74cc('0x28')](_0x269f37));_0x2b104a[_0x74cc('0x2a')]();}};}; \ 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 ad813ea..f952645 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 _0xbf46=['name','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','push','fulfillmentText','stack','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','Message','create','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','upperFirst','InteractionId','created','isEmpty','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xbf46,0x11f));var _0x6bf4=function(_0x8aa16c,_0x18db4c){_0x8aa16c=_0x8aa16c-0x0;var _0x5910f2=_0xbf46[_0x8aa16c];return _0x5910f2;};'use strict';var _=require('lodash');var dialogflow=require(_0x6bf4('0x0'));var md5=require(_0x6bf4('0x1'));var moment=require('moment');var Promise=require(_0x6bf4('0x2'));var logger=require(_0x6bf4('0x3'))(_0x6bf4('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x6bf4('0x5')),'openchannelMessage':require(_0x6bf4('0x6')),'mailMessage':require(_0x6bf4('0x7')),'smsMessage':require(_0x6bf4('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x3c96d1,_0xf8d013,_0x41dddb,_0x1d25de){return new Promise(function(_0x20d725,_0x2e2596){var _0x2c4e79=_[_0x6bf4('0x9')](_0x41dddb);_0x2c4e79[_0x6bf4('0xa')]=_0x1d25de;return rpc[_0xf8d013+_0x6bf4('0xb')][_0x6bf4('0xc')](_0x2c4e79)['then'](function(){logger['info'](_0x6bf4('0xd'),_0x3c96d1,_0x2c4e79[_0x6bf4('0xa')]);_0x20d725();})[_0x6bf4('0xe')](function(_0x5d464e){logger[_0x6bf4('0xf')](_0x6bf4('0xd'),_0x3c96d1,JSON[_0x6bf4('0x10')](_0x5d464e));_0x2e2596(_0x5d464e);});});}exports[_0x6bf4('0x11')]=function(_0x5d27d7,_0x4d0302){return function(_0xe2f86c){try{if(!_[_0x6bf4('0x12')](this[_0x6bf4('0x13')][_0x6bf4('0x14')])){logger[_0x6bf4('0x15')](_0x6bf4('0xd'),_0x5d27d7,_0x6bf4('0x16'));return _0xe2f86c[_0x6bf4('0x17')]();}var _0xbd7152={'ContactId':this[_0x6bf4('0x18')]['id'],'sentAt':moment()[_0x6bf4('0x19')](_0x6bf4('0x1a')),'direction':_0x6bf4('0x1b')};if(this[_0x6bf4('0x1c')]===_0x6bf4('0x1d')||this[_0x6bf4('0x1c')]===_0x6bf4('0x1e')){_0xbd7152['phone']=this[_0x6bf4('0x13')]['phone'];}var _0x1be612=this[_0x6bf4('0x1c')];if(_0x1be612==='chat'){_0xbd7152['ChatWebsiteId']=this['account']['id'];}else{_0xbd7152[_[_0x6bf4('0x1f')](_0x1be612)+'AccountId']=this['account']['id'];}_0xbd7152[_[_0x6bf4('0x1f')](_0x1be612)+_0x6bf4('0x20')]=this['interaction']['id'];if(this[_0x6bf4('0x13')][_0x6bf4('0x21')]){var _0x3a28d3=_0x4d0302[0x4];if(!_[_0x6bf4('0x22')](_0x3a28d3)){_0xbd7152['body']=utils['getMustacheRender'](_0x3a28d3,this);return rpc[_0x1be612+_0x6bf4('0xb')][_0x6bf4('0xc')](_0xbd7152)[_0x6bf4('0x23')](function(_0x4dcfac){logger[_0x6bf4('0x15')](_0x6bf4('0xd'),_0x5d27d7,_0xbd7152[_0x6bf4('0xa')]);})[_0x6bf4('0xe')](function(_0x5d4449){logger[_0x6bf4('0xf')](_0x6bf4('0xd'),_0x5d27d7,JSON[_0x6bf4('0x10')](_0x5d4449));})[_0x6bf4('0x24')](function(){logger[_0x6bf4('0x15')](_0x6bf4('0x25'),_0x5d27d7);_0xe2f86c['stop']();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5d27d7);_0xe2f86c[_0x6bf4('0x26')]();}}else{var _0x29a5d9=this;var _0x32c18a=_0x4d0302[0x2][_0x6bf4('0x27')](/\\n/g,'\x0a');var _0xc45b1e={'credentials':{'private_key':_0x32c18a,'client_email':_0x4d0302[0x1]}};var _0x3bfd64=new dialogflow[(_0x6bf4('0x28'))](_0xc45b1e);var _0x5c1448=_0x3bfd64[_0x6bf4('0x29')](_0x4d0302[0x0],md5(_0x29a5d9['interaction']['id']));var _0x4dad41={'session':_0x5c1448,'queryInput':{'text':{'text':_0x29a5d9[_0x6bf4('0x2a')]['body'],'languageCode':_0x4d0302[0x3]||'en'}}};return _0x3bfd64[_0x6bf4('0x2b')](_0x4dad41)[_0x6bf4('0x23')](function(_0x23451c){if(_0x23451c&&_0x23451c[_0x6bf4('0x2c')]){_0x29a5d9[_0x6bf4('0xa')]['dialogflowV2']=_0x23451c;var _0x2034c4=_0x23451c[0x0];var _0x574a16=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x2e')]&&_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x2e')][_0x6bf4('0x2f')]?_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x2e')][_0x6bf4('0x2f')][_0x6bf4('0x30')][_0x6bf4('0x31')]:![];_0x29a5d9[_0x6bf4('0xa')][_0x6bf4('0x32')]=_0x2034c4[_0x6bf4('0x2d')]['action'];_0x29a5d9[_0x6bf4('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2034c4[_0x6bf4('0x2d')]['allRequiredParamsPresent'];_0x29a5d9[_0x6bf4('0xa')][_0x6bf4('0x33')]=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x2e')]&&_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x2e')]['fields']?_0x2034c4['queryResult'][_0x6bf4('0x2e')][_0x6bf4('0x2f')][_0x6bf4('0x30')]['boolValue']:![];_0x29a5d9[_0x6bf4('0xa')][_0x6bf4('0x34')]=_0x2034c4[_0x6bf4('0x2d')]['intent'][_0x6bf4('0x35')];_0x29a5d9[_0x6bf4('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x36')][_0x6bf4('0x37')];_0x29a5d9[_0x6bf4('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x36')][_0x6bf4('0x38')];_0x29a5d9[_0x6bf4('0xa')][_0x6bf4('0x39')]=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x3a')];_0x29a5d9['body'][_0x6bf4('0x3b')]=_0x2034c4[_0x6bf4('0x2d')]['queryText'];_0x29a5d9[_0x6bf4('0xa')][_0x6bf4('0x3c')]=_0x2034c4[_0x6bf4('0x2d')][_0x6bf4('0x3d')];_0xbd7152[_0x6bf4('0x3e')]=_0x6bf4('0x3f');_0xbd7152[_0x6bf4('0x40')]=JSON[_0x6bf4('0x10')](_0x23451c);var _0x2668f6=[];for(var _0x3f63b8=0x0;_0x3f63b8<_0x23451c[_0x6bf4('0x2c')];_0x3f63b8++){var _0x464630=_0x23451c[_0x3f63b8];if(_0x464630&&_0x464630[_0x6bf4('0x2d')]&&_0x464630['queryResult']['fulfillmentText']){_0x2668f6[_0x6bf4('0x41')](createMessage(_0x5d27d7,_0x1be612,_0xbd7152,_0x464630['queryResult'][_0x6bf4('0x42')]));}}return Promise['all'](_0x2668f6)[_0x6bf4('0x23')](function(){if(_0x574a16){_0xe2f86c[_0x6bf4('0x17')]();}else{_0xe2f86c[_0x6bf4('0x26')]();}})[_0x6bf4('0xe')](function(_0x54564e){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x5d27d7,JSON['stringify'](_0x54564e));_0xe2f86c[_0x6bf4('0x17')]();});}})[_0x6bf4('0xe')](function(_0x1924d1){logger[_0x6bf4('0xf')](_0x6bf4('0xd'),_0x5d27d7,_0x1924d1[_0x6bf4('0x2a')],_0x1924d1[_0x6bf4('0x43')]);_0xe2f86c[_0x6bf4('0x17')]();});}}catch(_0x40b354){logger['error'](_0x6bf4('0xd'),_0x5d27d7,JSON[_0x6bf4('0x10')](_0x40b354));_0xe2f86c[_0x6bf4('0x26')]();}};}; \ No newline at end of file +var _0xc899=['clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','push','all','message','stack','lodash','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc899,0xcd));var _0x9c89=function(_0x2d0c94,_0x381a70){_0x2d0c94=_0x2d0c94-0x0;var _0x528161=_0xc899[_0x2d0c94];return _0x528161;};'use strict';var _=require(_0x9c89('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x9c89('0x1'));var moment=require(_0x9c89('0x2'));var Promise=require(_0x9c89('0x3'));var logger=require('../../../../config/logger')(_0x9c89('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x9c89('0x5')),'openchannelMessage':require(_0x9c89('0x6')),'mailMessage':require(_0x9c89('0x7')),'smsMessage':require(_0x9c89('0x8')),'faxMessage':require(_0x9c89('0x9')),'whatsappMessage':require(_0x9c89('0xa'))};function createMessage(_0x3216fd,_0x4578a2,_0x14ce56,_0x71e027){return new Promise(function(_0x984428,_0xf894f7){var _0x5401d9=_[_0x9c89('0xb')](_0x14ce56);_0x5401d9[_0x9c89('0xc')]=_0x71e027;return rpc[_0x4578a2+_0x9c89('0xd')][_0x9c89('0xe')](_0x5401d9)[_0x9c89('0xf')](function(){logger[_0x9c89('0x10')](_0x9c89('0x11'),_0x3216fd,_0x5401d9[_0x9c89('0xc')]);_0x984428();})[_0x9c89('0x12')](function(_0x57d9b2){logger[_0x9c89('0x13')](_0x9c89('0x11'),_0x3216fd,JSON[_0x9c89('0x14')](_0x57d9b2));_0xf894f7(_0x57d9b2);});});}exports[_0x9c89('0x15')]=function(_0x31909f,_0x150990){return function(_0x5464fb){try{if(!_['isNil'](this[_0x9c89('0x16')][_0x9c89('0x17')])){logger[_0x9c89('0x10')](_0x9c89('0x11'),_0x31909f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5464fb[_0x9c89('0x18')]();}var _0x2b50ba={'ContactId':this[_0x9c89('0x19')]['id'],'sentAt':moment()[_0x9c89('0x1a')](_0x9c89('0x1b')),'direction':_0x9c89('0x1c')};if(this[_0x9c89('0x1d')]===_0x9c89('0x1e')||this[_0x9c89('0x1d')]===_0x9c89('0x1f')){_0x2b50ba['phone']=this[_0x9c89('0x16')][_0x9c89('0x20')];}var _0x46f2eb=this[_0x9c89('0x1d')];if(_0x46f2eb===_0x9c89('0x21')){_0x2b50ba[_0x9c89('0x22')]=this[_0x9c89('0x23')]['id'];}else{_0x2b50ba[_['upperFirst'](_0x46f2eb)+'AccountId']=this[_0x9c89('0x23')]['id'];}_0x2b50ba[_[_0x9c89('0x24')](_0x46f2eb)+'InteractionId']=this[_0x9c89('0x16')]['id'];if(this[_0x9c89('0x16')][_0x9c89('0x25')]){var _0x5d8fe9=_0x150990[0x4];if(!_[_0x9c89('0x26')](_0x5d8fe9)){_0x2b50ba[_0x9c89('0xc')]=utils[_0x9c89('0x27')](_0x5d8fe9,this);return rpc[_0x46f2eb+'Message']['create'](_0x2b50ba)['then'](function(_0x45562d){logger['info'](_0x9c89('0x11'),_0x31909f,_0x2b50ba['body']);})[_0x9c89('0x12')](function(_0x3dcec0){logger[_0x9c89('0x13')](_0x9c89('0x11'),_0x31909f,JSON['stringify'](_0x3dcec0));})[_0x9c89('0x28')](function(){logger['info'](_0x9c89('0x29'),_0x31909f);_0x5464fb[_0x9c89('0x2a')]();});}else{logger[_0x9c89('0x10')](_0x9c89('0x2b'),_0x31909f);_0x5464fb['stop']();}}else{var _0x4f6b62=this;var _0x374bdc=_0x150990[0x2]['replace'](/\\n/g,'\x0a');var _0x36a7f0={'credentials':{'private_key':_0x374bdc,'client_email':_0x150990[0x1]}};var _0x338f0d=new dialogflow[(_0x9c89('0x2c'))](_0x36a7f0);var _0x3063b8=_0x338f0d[_0x9c89('0x2d')](_0x150990[0x0],md5(_0x4f6b62[_0x9c89('0x16')]['id']));var _0x401a2c={'session':_0x3063b8,'queryInput':{'text':{'text':_0x4f6b62['message'][_0x9c89('0xc')],'languageCode':_0x150990[0x3]||'en'}}};return _0x338f0d[_0x9c89('0x2e')](_0x401a2c)['then'](function(_0x356523){if(_0x356523&&_0x356523[_0x9c89('0x2f')]){_0x4f6b62['body']['dialogflowV2']=_0x356523;var _0x4eff98=_0x356523[0x0];var _0x3d824c=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x31')]&&_0x4eff98[_0x9c89('0x30')][_0x9c89('0x31')][_0x9c89('0x32')]?_0x4eff98['queryResult'][_0x9c89('0x31')][_0x9c89('0x32')][_0x9c89('0x33')][_0x9c89('0x34')]:![];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x35')]=_0x4eff98[_0x9c89('0x30')]['action'];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x36')]=_0x4eff98[_0x9c89('0x30')]['allRequiredParamsPresent'];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x37')]=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x31')]&&_0x4eff98['queryResult'][_0x9c89('0x31')]['fields']?_0x4eff98[_0x9c89('0x30')]['diagnosticInfo'][_0x9c89('0x32')][_0x9c89('0x33')][_0x9c89('0x34')]:![];_0x4f6b62[_0x9c89('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x4eff98['queryResult'][_0x9c89('0x38')][_0x9c89('0x39')];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x3a')]=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x38')]['displayName'];_0x4f6b62['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x4eff98[_0x9c89('0x30')]['intent'][_0x9c89('0x3b')];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x3c')]=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x3d')];_0x4f6b62[_0x9c89('0xc')][_0x9c89('0x3e')]=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x3f')];_0x4f6b62['body']['DIALOGFLOWV2_SCORE']=_0x4eff98[_0x9c89('0x30')][_0x9c89('0x40')];_0x2b50ba['providerName']=_0x9c89('0x41');_0x2b50ba[_0x9c89('0x42')]=JSON[_0x9c89('0x14')](_0x356523);var _0x263acb=[];for(var _0x4cc232=0x0;_0x4cc232<_0x356523[_0x9c89('0x2f')];_0x4cc232++){var _0x4726b1=_0x356523[_0x4cc232];if(_0x4726b1&&_0x4726b1[_0x9c89('0x30')]&&_0x4726b1[_0x9c89('0x30')][_0x9c89('0x43')]){_0x263acb[_0x9c89('0x44')](createMessage(_0x31909f,_0x46f2eb,_0x2b50ba,_0x4726b1[_0x9c89('0x30')][_0x9c89('0x43')]));}}return Promise[_0x9c89('0x45')](_0x263acb)[_0x9c89('0xf')](function(){if(_0x3d824c){_0x5464fb[_0x9c89('0x18')]();}else{_0x5464fb[_0x9c89('0x2a')]();}})['catch'](function(_0x280bc4){logger[_0x9c89('0x13')](_0x9c89('0x11'),_0x31909f,JSON[_0x9c89('0x14')](_0x280bc4));_0x5464fb['next']();});}})[_0x9c89('0x12')](function(_0x5e53ec){logger[_0x9c89('0x13')](_0x9c89('0x11'),_0x31909f,_0x5e53ec[_0x9c89('0x46')],_0x5e53ec[_0x9c89('0x47')]);_0x5464fb['next']();});}}catch(_0x2df8fb){logger[_0x9c89('0x13')](_0x9c89('0x11'),_0x31909f,JSON[_0x9c89('0x14')](_0x2df8fb));_0x5464fb['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 51157d6..1acb126 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 _0xd384=['join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','message'];(function(_0x80e37,_0x5d46ca){var _0x564bf1=function(_0x5d6056){while(--_0x5d6056){_0x80e37['push'](_0x80e37['shift']());}};_0x564bf1(++_0x5d46ca);}(_0xd384,0x1bf));var _0x4d38=function(_0x1ab7e5,_0x418a0f){_0x1ab7e5=_0x1ab7e5-0x0;var _0xfe8230=_0xd384[_0x1ab7e5];return _0xfe8230;};'use strict';var schema=require('validate');var _=require(_0x4d38('0x0'));var htmlToText=require(_0x4d38('0x1'));var utils=require(_0x4d38('0x2'));var logger=require(_0x4d38('0x3'))(_0x4d38('0x4'));var gotoif=schema({'condition':{'type':_0x4d38('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x4d38('0x6'),'message':_0x4d38('0x7')},'priorityFalse':{'type':_0x4d38('0x6'),'message':_0x4d38('0x8')}});exports[_0x4d38('0x9')]=function(_0x1e3c8e,_0x261d23){return function(_0x49e193){try{var _0x502ae3={'condition':htmlToText[_0x4d38('0xa')](utils[_0x4d38('0xb')](_0x261d23[0x0],this),{'wordwrap':![]})[_0x4d38('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x261d23[0x1],'priorityFalse':_0x261d23[0x2]};var _0x802526=gotoif[_0x4d38('0xd')](_0x502ae3,{'typecast':!![]});if(_0x802526[_0x4d38('0xe')]){logger[_0x4d38('0xf')](_0x4d38('0x10'),_0x1e3c8e,_['map'](_0x802526,_0x4d38('0x11'))[_0x4d38('0x12')](',\x20'));_0x49e193[_0x4d38('0x13')]();}else{try{var _0x20dc1f=eval('('+_0x502ae3['condition']+')');var _0x2a5346=_0x20dc1f?_0x502ae3[_0x4d38('0x14')]:_0x502ae3[_0x4d38('0x15')];logger[_0x4d38('0x16')](_0x4d38('0x17'),_0x1e3c8e,_0x502ae3[_0x4d38('0x18')],_0x20dc1f,_0x2a5346||_0x4d38('0x19'));if(_0x2a5346){var _0x4ffacf=_[_0x4d38('0x1a')](_0x49e193[_0x4d38('0x1b')](),{'p':_0x2a5346});if(_0x4ffacf>=0x0){logger[_0x4d38('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1e3c8e,_0x2a5346||_0x4d38('0x19'),_0x4ffacf);_0x49e193[_0x4d38('0x19')](_0x4ffacf);}else{logger[_0x4d38('0x16')](_0x4d38('0x1c'),_0x1e3c8e,_0x2a5346||_0x4d38('0x19'));_0x49e193[_0x4d38('0x13')]();}}else{_0x49e193['next']();}}catch(_0x3d880f){logger[_0x4d38('0xf')](_0x4d38('0x1d'),_0x1e3c8e,_0x3d880f[_0x4d38('0x11')]);_0x49e193['stop']();}}}catch(_0x55770e){logger[_0x4d38('0xf')](_0x4d38('0x10'),_0x1e3c8e,JSON[_0x4d38('0x1e')](_0x55770e));_0x49e193[_0x4d38('0x13')]();}};}; \ No newline at end of file +var _0x4074=['replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x4074,0x1c0));var _0x4407=function(_0x2950b7,_0x23f231){_0x2950b7=_0x2950b7-0x0;var _0x9299d=_0x4074[_0x2950b7];return _0x9299d;};'use strict';var schema=require(_0x4407('0x0'));var _=require('lodash');var htmlToText=require(_0x4407('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4407('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x4407('0x3')},'priorityTrue':{'type':_0x4407('0x4'),'message':_0x4407('0x5')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x43f8be,_0x4c6b79){return function(_0x247288){try{var _0x96dd18={'condition':htmlToText[_0x4407('0x6')](utils[_0x4407('0x7')](_0x4c6b79[0x0],this),{'wordwrap':![]})[_0x4407('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4c6b79[0x1],'priorityFalse':_0x4c6b79[0x2]};var _0x29af0c=gotoif['validate'](_0x96dd18,{'typecast':!![]});if(_0x29af0c[_0x4407('0x9')]){logger[_0x4407('0xa')](_0x4407('0xb'),_0x43f8be,_['map'](_0x29af0c,_0x4407('0xc'))[_0x4407('0xd')](',\x20'));_0x247288[_0x4407('0xe')]();}else{try{var _0x4dfefd=eval('('+_0x96dd18[_0x4407('0xf')]+')');var _0x1dd89e=_0x4dfefd?_0x96dd18[_0x4407('0x10')]:_0x96dd18['priorityFalse'];logger[_0x4407('0x11')](_0x4407('0x12'),_0x43f8be,_0x96dd18[_0x4407('0xf')],_0x4dfefd,_0x1dd89e||_0x4407('0x13'));if(_0x1dd89e){var _0x2163d7=_[_0x4407('0x14')](_0x247288['rules'](),{'p':_0x1dd89e});if(_0x2163d7>=0x0){logger[_0x4407('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x43f8be,_0x1dd89e||_0x4407('0x13'),_0x2163d7);_0x247288[_0x4407('0x13')](_0x2163d7);}else{logger[_0x4407('0x11')](_0x4407('0x15'),_0x43f8be,_0x1dd89e||_0x4407('0x13'));_0x247288[_0x4407('0xe')]();}}else{_0x247288[_0x4407('0x13')]();}}catch(_0x25c16b){logger[_0x4407('0xa')](_0x4407('0x16'),_0x43f8be,_0x25c16b[_0x4407('0xc')]);_0x247288['stop']();}}}catch(_0x40dab6){logger['error']('[%s][GOTOIF]\x20%s',_0x43f8be,JSON[_0x4407('0x17')](_0x40dab6));_0x247288['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 3e5f965..a23c31e 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 _0xf8c9=['number','consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger'];(function(_0x4d2d2f,_0xd252fc){var _0x9e2abf=function(_0x5c4401){while(--_0x5c4401){_0x4d2d2f['push'](_0x4d2d2f['shift']());}};_0x9e2abf(++_0xd252fc);}(_0xf8c9,0x1d1));var _0x9f8c=function(_0x42774c,_0x54b775){_0x42774c=_0x42774c-0x0;var _0x167bbf=_0xf8c9[_0x42774c];return _0x167bbf;};'use strict';var schema=require(_0x9f8c('0x0'));var _=require(_0x9f8c('0x1'));var logger=require(_0x9f8c('0x2'))('routing');var gotop=schema({'priority':{'type':_0x9f8c('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x9f8c('0x4')]=function(_0x2d02e9,_0x5ab91b){return function(_0x2548a0){try{var _0x5e37b0={'priority':_0x5ab91b[0x0]};var _0xe81599=gotop[_0x9f8c('0x0')](_0x5e37b0,{'typecast':!![]});if(_0xe81599['length']){logger[_0x9f8c('0x5')](_0x9f8c('0x6'),_0x2d02e9,_[_0x9f8c('0x7')](_0xe81599,_0x9f8c('0x8'))[_0x9f8c('0x9')](',\x20'));_0x2548a0[_0x9f8c('0xa')]();}else{logger[_0x9f8c('0xb')](_0x9f8c('0xc'),_0x2d02e9,_0x5e37b0[_0x9f8c('0xd')]);if(_0x5e37b0[_0x9f8c('0xd')]){var _0x594a56=_[_0x9f8c('0xe')](_0x2548a0[_0x9f8c('0xf')](),{'p':_0x5e37b0['priority']});if(_0x594a56>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2d02e9,_0x5e37b0[_0x9f8c('0xd')]||_0x9f8c('0x10'),_0x594a56);_0x2548a0['next'](_0x594a56);}else{logger[_0x9f8c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2d02e9,_0x5e37b0[_0x9f8c('0xd')]||_0x9f8c('0x10'));_0x2548a0[_0x9f8c('0xa')]();}}else{_0x2548a0[_0x9f8c('0x10')]();}}}catch(_0x11b1f9){logger[_0x9f8c('0x5')](_0x9f8c('0x6'),_0x2d02e9,JSON[_0x9f8c('0x11')](_0x11b1f9));_0x2548a0[_0x9f8c('0xa')]();}};}; \ No newline at end of file +var _0xd395=['message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map'];(function(_0x2ffe14,_0x459e9f){var _0x12ad7f=function(_0x5d895d){while(--_0x5d895d){_0x2ffe14['push'](_0x2ffe14['shift']());}};_0x12ad7f(++_0x459e9f);}(_0xd395,0xef));var _0x5d39=function(_0x92a71b,_0x5bb590){_0x92a71b=_0x92a71b-0x0;var _0x1fdc59=_0xd395[_0x92a71b];return _0x1fdc59;};'use strict';var schema=require(_0x5d39('0x0'));var _=require(_0x5d39('0x1'));var logger=require(_0x5d39('0x2'))('routing');var gotop=schema({'priority':{'type':_0x5d39('0x3'),'required':!![],'message':_0x5d39('0x4')}});exports[_0x5d39('0x5')]=function(_0x4cba78,_0x1fc709){return function(_0x53323f){try{var _0x5d177d={'priority':_0x1fc709[0x0]};var _0x4f8d96=gotop[_0x5d39('0x0')](_0x5d177d,{'typecast':!![]});if(_0x4f8d96['length']){logger['error'](_0x5d39('0x6'),_0x4cba78,_[_0x5d39('0x7')](_0x4f8d96,_0x5d39('0x8'))[_0x5d39('0x9')](',\x20'));_0x53323f[_0x5d39('0xa')]();}else{logger[_0x5d39('0xb')](_0x5d39('0xc'),_0x4cba78,_0x5d177d['priority']);if(_0x5d177d[_0x5d39('0xd')]){var _0x3e4607=_[_0x5d39('0xe')](_0x53323f['rules'](),{'p':_0x5d177d[_0x5d39('0xd')]});if(_0x3e4607>=0x0){logger[_0x5d39('0xb')](_0x5d39('0xf'),_0x4cba78,_0x5d177d[_0x5d39('0xd')]||'next',_0x3e4607);_0x53323f['next'](_0x3e4607);}else{logger['info'](_0x5d39('0x10'),_0x4cba78,_0x5d177d['priority']||'next');_0x53323f[_0x5d39('0xa')]();}}else{_0x53323f[_0x5d39('0x11')]();}}}catch(_0x547106){logger[_0x5d39('0x12')]('[%s][GOTOP]\x20%s',_0x4cba78,JSON['stringify'](_0x547106));_0x53323f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 6d2d0da..a959366 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 _0xca73=['getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x231104,_0xc16fcc){var _0x13dd32=function(_0x4b6dda){while(--_0x4b6dda){_0x231104['push'](_0x231104['shift']());}};_0x13dd32(++_0xc16fcc);}(_0xca73,0x1ee));var _0x3ca7=function(_0x51de01,_0x3442b9){_0x51de01=_0x51de01-0x0;var _0x218568=_0xca73[_0x51de01];return _0x218568;};'use strict';var _=require(_0x3ca7('0x0'));var utils=require(_0x3ca7('0x1'));var logger=require('../../../../config/logger')(_0x3ca7('0x2'));var rpc={'chatMessage':require(_0x3ca7('0x3')),'openchannelMessage':require(_0x3ca7('0x4')),'mailMessage':require(_0x3ca7('0x5')),'smsMessage':require(_0x3ca7('0x6')),'faxMessage':require(_0x3ca7('0x7')),'whatsappMessage':require(_0x3ca7('0x8'))};exports[_0x3ca7('0x9')]=function(_0x2460b5,_0x3d0ce3){return function(_0x5dce65){try{var _0x30c7e9={'body':utils[_0x3ca7('0xa')](_0x3d0ce3[0x0],this),'ContactId':this[_0x3ca7('0xb')]['id']};if(this[_0x3ca7('0xc')]===_0x3ca7('0xd')){_0x30c7e9[_0x3ca7('0xe')]=this['account']['id'];}else{_0x30c7e9[_[_0x3ca7('0xf')](this[_0x3ca7('0xc')])+'AccountId']=this['account']['id'];}_0x30c7e9[_[_0x3ca7('0xf')](this[_0x3ca7('0xc')])+_0x3ca7('0x10')]=this[_0x3ca7('0x11')]['id'];if(rpc[this[_0x3ca7('0xc')]+_0x3ca7('0x12')]){return rpc[this[_0x3ca7('0xc')]+_0x3ca7('0x12')][_0x3ca7('0x13')](_0x30c7e9)[_0x3ca7('0x14')](function(_0x3411c2){logger[_0x3ca7('0x15')](_0x3ca7('0x16'),_0x2460b5,_0x30c7e9['body']);_0x5dce65[_0x3ca7('0x17')]();})[_0x3ca7('0x18')](function(_0x4a5594){logger[_0x3ca7('0x19')](_0x3ca7('0x16'),_0x2460b5,JSON[_0x3ca7('0x1a')](_0x4a5594));_0x5dce65[_0x3ca7('0x1b')]();});}}catch(_0x5c5d2d){logger[_0x3ca7('0x19')]('[%s][MESSAGE]\x20%s',_0x2460b5,JSON[_0x3ca7('0x1a')](_0x5c5d2d));_0x5dce65[_0x3ca7('0x1b')]();}};}; \ No newline at end of file +var _0x7d87=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash'];(function(_0x4ad391,_0x4a722f){var _0x512b17=function(_0xe4eaa1){while(--_0xe4eaa1){_0x4ad391['push'](_0x4ad391['shift']());}};_0x512b17(++_0x4a722f);}(_0x7d87,0x178));var _0x77d8=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x7d87[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0x77d8('0x0'));var utils=require('./utils');var logger=require(_0x77d8('0x1'))(_0x77d8('0x2'));var rpc={'chatMessage':require(_0x77d8('0x3')),'openchannelMessage':require(_0x77d8('0x4')),'mailMessage':require(_0x77d8('0x5')),'smsMessage':require(_0x77d8('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x77d8('0x7'))};exports[_0x77d8('0x8')]=function(_0x1afdd2,_0x3a15cf){return function(_0x3e4849){try{var _0x4b9c8a={'body':utils['getMustacheRender'](_0x3a15cf[0x0],this),'ContactId':this[_0x77d8('0x9')]['id']};if(this[_0x77d8('0xa')]===_0x77d8('0xb')){_0x4b9c8a[_0x77d8('0xc')]=this['account']['id'];}else{_0x4b9c8a[_['upperFirst'](this[_0x77d8('0xa')])+_0x77d8('0xd')]=this[_0x77d8('0xe')]['id'];}_0x4b9c8a[_[_0x77d8('0xf')](this['channel'])+_0x77d8('0x10')]=this[_0x77d8('0x11')]['id'];if(rpc[this[_0x77d8('0xa')]+_0x77d8('0x12')]){return rpc[this[_0x77d8('0xa')]+_0x77d8('0x12')][_0x77d8('0x13')](_0x4b9c8a)[_0x77d8('0x14')](function(_0x17ba1d){logger[_0x77d8('0x15')](_0x77d8('0x16'),_0x1afdd2,_0x4b9c8a[_0x77d8('0x17')]);_0x3e4849[_0x77d8('0x18')]();})[_0x77d8('0x19')](function(_0x2aa5da){logger[_0x77d8('0x1a')](_0x77d8('0x16'),_0x1afdd2,JSON[_0x77d8('0x1b')](_0x2aa5da));_0x3e4849[_0x77d8('0x1c')]();});}}catch(_0x4656ef){logger[_0x77d8('0x1a')](_0x77d8('0x16'),_0x1afdd2,JSON[_0x77d8('0x1b')](_0x4656ef));_0x3e4849[_0x77d8('0x1c')]();}};}; \ 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 6aa1933..ce61b2b 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 _0x9e0c=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0x1ee888,_0x3d40ed){var _0x1795b4=function(_0x128435){while(--_0x128435){_0x1ee888['push'](_0x1ee888['shift']());}};_0x1795b4(++_0x3d40ed);}(_0x9e0c,0xfc));var _0xc9e0=function(_0x5edd61,_0x520e27){_0x5edd61=_0x5edd61-0x0;var _0x379d22=_0x9e0c[_0x5edd61];return _0x379d22;};'use strict';var utils=require('./utils');var logger=require(_0xc9e0('0x0'))(_0xc9e0('0x1'));exports[_0xc9e0('0x2')]=function(_0x19abfd,_0xfc908d){return function(_0xe4d50){try{logger[_0xc9e0('0x3')](_0xc9e0('0x4'),_0x19abfd,utils['getMustacheRender'](_0xfc908d[0x0],this));_0xe4d50[_0xc9e0('0x5')]();}catch(_0x762ea0){logger[_0xc9e0('0x6')](_0xc9e0('0x4'),_0x19abfd,JSON[_0xc9e0('0x7')](_0x762ea0));_0xe4d50[_0xc9e0('0x8')]();}};}; \ No newline at end of file +var _0x35f6=['[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils','../../../../config/logger','consequence','info'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x35f6,0x1d9));var _0x635f=function(_0x1832aa,_0x36b091){_0x1832aa=_0x1832aa-0x0;var _0x48dc65=_0x35f6[_0x1832aa];return _0x48dc65;};'use strict';var utils=require(_0x635f('0x0'));var logger=require(_0x635f('0x1'))('routing');exports[_0x635f('0x2')]=function(_0x32c352,_0x4f0c9b){return function(_0x599cfc){try{logger[_0x635f('0x3')](_0x635f('0x4'),_0x32c352,utils[_0x635f('0x5')](_0x4f0c9b[0x0],this));_0x599cfc['next']();}catch(_0x266672){logger[_0x635f('0x6')]('[%s][NOOP]\x20%s',_0x32c352,JSON[_0x635f('0x7')](_0x266672));_0x599cfc[_0x635f('0x8')]();}};}; \ 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 9393b01..7d3c0ae 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 _0x21f8=['YYYY-MM-DD\x20HH:mm:ss','accepted','body','timeout','log','LOG\x20~\x20endRouting\x20~\x20queue','update\x20queue\x20report','toLowerCase','length','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','push','InteractionId','%sQueuesWaitingInteractions','format','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','contact','list','channel','QueueId','upperFirst','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting'];(function(_0x51ce72,_0x39ef9b){var _0x1aae99=function(_0xbd8185){while(--_0xbd8185){_0x51ce72['push'](_0x51ce72['shift']());}};_0x1aae99(++_0x39ef9b);}(_0x21f8,0x1e9));var _0x821f=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x21f8[_0x10df1e];return _0x3e24fb;};'use strict';var schema=require(_0x821f('0x0'));var _=require(_0x821f('0x1'));var util=require('util');var seqqueue=require(_0x821f('0x2'));var moment=require(_0x821f('0x3'));var Redis=require(_0x821f('0x4'));var config=require(_0x821f('0x5'));var logger=require(_0x821f('0x6'))(_0x821f('0x7'));var strategy=require(_0x821f('0x8'));config[_0x821f('0x9')]=_[_0x821f('0xa')](config[_0x821f('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x821f('0xb'))(new Redis(config['redis']));var attributes=['id',_0x821f('0xc'),_0x821f('0xd'),_0x821f('0xe'),_0x821f('0xf'),_0x821f('0x10')];function emit(_0x415744,_0x49421f,_0x33dbcd){io['to'](_0x415744)[_0x821f('0x11')](_0x49421f,_0x33dbcd);}function emitChannelQueueInteraction(_0x459e0d,_0x53f546,_0xf669fa,_0x3afa66,_0x4c6d85,_0x2b2efa,_0x142bc1,_0x5da53d){var _0x236c3b=_['clone'](_0xf669fa);_0x236c3b[_0x821f('0xc')]=_0x5da53d;_0x236c3b[_0x821f('0xe')]=_0x53f546;_0x236c3b[_0x821f('0xd')]=_0x3afa66;_0x236c3b['id']=_0x4c6d85;if(_0x2b2efa){attributes[_0x821f('0x12')](_['capitalize'](_0x459e0d)+_0x821f('0x13'));_0x142bc1[util['format'](_0x821f('0x14'),_0x459e0d)][_0x4c6d85]=_['pick'](_0x236c3b,attributes);}else{delete _0x142bc1[util[_0x821f('0x15')]('%sQueuesWaitingInteractions',_0x459e0d)][_0x4c6d85];}emit(util[_0x821f('0x15')](_0x821f('0x16'),_0x459e0d,_0x53f546),util[_0x821f('0x15')]('%s_queue_waiting_interaction:%s',_0x459e0d,_0x2b2efa?_0x821f('0x17'):_0x821f('0x18')),_[_0x821f('0x19')](_0x236c3b,attributes));}var rpc={'openchannelQueueReport':require(_0x821f('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x821f('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x821f('0x1c'))};var queue=schema({'name':{'type':_0x821f('0x1d'),'required':!![],'message':_0x821f('0x1e')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x35279b,_0xd4b89a,_0x14d4b4,_0x254c20){if(_0x35279b&&_0xd4b89a&&_0x14d4b4){_0xd4b89a['waiting']+=0x1;var _0x270404={'uniqueid':_0x35279b,'from':_0x14d4b4['body']?_0x14d4b4['body'][_0x821f('0xf')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x14d4b4['contact']?_0x14d4b4[_0x821f('0x1f')]['id']:null,'ListId':_0x14d4b4[_0x821f('0x20')]?_0x14d4b4[_0x821f('0x20')]['id']:null};_0x270404[_['upperFirst'](_0x14d4b4[_0x821f('0x21')])+_0x821f('0x22')]=_0xd4b89a['id']||null;_0x270404[_[_0x821f('0x23')](_0x14d4b4[_0x821f('0x21')])+_0x821f('0x13')]=_0x14d4b4[_0x821f('0x24')]?_0x14d4b4[_0x821f('0x24')]['id']:null;_0x270404[_['upperFirst'](_0x14d4b4['channel'])+'MessageId']=_0x14d4b4[_0x821f('0x25')]?_0x14d4b4[_0x821f('0x25')]['id']:null;_0x270404[_[_0x821f('0x23')](_0x14d4b4[_0x821f('0x21')])+(_0x14d4b4[_0x821f('0x21')]!==_0x821f('0x26')?_0x821f('0x27'):_0x821f('0x28'))]=_0x14d4b4[_0x821f('0xd')]?_0x14d4b4['account']['id']:null;logger[_0x821f('0x29')](util[_0x821f('0x15')](_0x821f('0x2a'),_0x35279b,_0xd4b89a[_0x821f('0x2b')]));emitChannelQueueInteraction(_0x14d4b4['channel'],_0xd4b89a['name'],_0x270404,_0x14d4b4[_0x821f('0xd')][_0x821f('0x2b')],_0x14d4b4[_0x821f('0x25')]['id'],!![],_0x254c20,_0xd4b89a['id']);if(rpc[_0x14d4b4[_0x821f('0x21')]+'QueueReport']){return rpc[_0x14d4b4['channel']+_0x821f('0x2c')][_0x821f('0x2d')](_0x270404)[_0x821f('0x2e')](function(_0x183104){logger[_0x821f('0x2f')](_0x821f('0x30'));});}}}function stopRouting(_0x4f5c20,_0x392fc2,_0x23a99f,_0x182b29){if(_0x4f5c20&&_0x392fc2){_0x392fc2[_0x821f('0x31')]-=0x1;var _0x28c8f5={'leaveAt':moment()[_0x821f('0x15')](_0x821f('0x32')),'acceptAt':moment()['format'](_0x821f('0x32')),'reason':_0x821f('0x33')};logger['info'](util[_0x821f('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x4f5c20,_0x392fc2[_0x821f('0x2b')]));emitChannelQueueInteraction(_0x23a99f[_0x821f('0x21')],_0x392fc2['name'],_0x23a99f[_0x821f('0x34')],_0x23a99f[_0x821f('0xd')][_0x821f('0x2b')],_0x23a99f[_0x821f('0x25')]['id'],![],_0x182b29,_0x392fc2['id']);if(rpc[_0x23a99f[_0x821f('0x21')]+_0x821f('0x2c')]){return rpc[_0x23a99f['channel']+_0x821f('0x2c')]['update'](_0x4f5c20,_0x28c8f5)[_0x821f('0x2e')](function(_0x33238c){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x34b62a,_0x436c86,_0x173210,_0x5b5da2){if(_0x34b62a&&_0x436c86){_0x436c86[_0x821f('0x31')]-=0x1;var _0x2bb3d8={'leaveAt':moment()[_0x821f('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x821f('0x15')](_0x821f('0x32')),'reason':_0x821f('0x35')};logger['info'](util['format']('[%s][END:QUEUE][NAME:%s]',_0x34b62a,_0x436c86[_0x821f('0x2b')]));emitChannelQueueInteraction(_0x173210[_0x821f('0x21')],_0x436c86[_0x821f('0x2b')],_0x173210[_0x821f('0x34')],_0x173210[_0x821f('0xd')][_0x821f('0x2b')],_0x173210[_0x821f('0x25')]['id'],![],_0x5b5da2);console[_0x821f('0x36')](_0x821f('0x37'),_0x436c86);if(rpc[_0x173210['channel']+_0x821f('0x2c')]){return rpc[_0x173210[_0x821f('0x21')]+_0x821f('0x2c')]['update'](_0x34b62a,_0x2bb3d8)[_0x821f('0x2e')](function(_0x4c85bf){logger['error'](_0x821f('0x38'));});}}}function handleFindQueue(_0x44eeb0){return function(_0x451c0d){return _0x451c0d[_0x821f('0x2b')][_0x821f('0x39')]()===_0x44eeb0[_0x821f('0x39')]();};}exports['consequence']=function(_0x46076e,_0x5754b8,_0x1dcf10,_0x17c22d){return function(_0x55923b){try{var _0x3b2732={'name':_0x5754b8[0x0],'timeout':_0x5754b8[0x1]};var _0xa89bd6=queue[_0x821f('0x0')](_0x3b2732,{'typecast':!![]});if(_0xa89bd6[_0x821f('0x3a')]){logger[_0x821f('0x2f')]('[%s][QUEUE]\x20%s',_0x46076e,_[_0x821f('0x3b')](_0xa89bd6,_0x821f('0x25'))[_0x821f('0x3c')](',\x20'));_0x55923b[_0x821f('0x3d')]();}else{var _0x180ded=_[_0x821f('0x3e')](_0x1dcf10[_0x17c22d[_0x821f('0x21')]+_0x821f('0x3f')],handleFindQueue(_0x3b2732[_0x821f('0x2b')]));console[_0x821f('0x36')]('LOG\x20~\x20returnfunction\x20~\x20q',_0x180ded);if(_0x180ded){startRouting(_0x46076e,_0x180ded,_0x17c22d,_0x1dcf10);var _0x1b8702=(_0x180ded[_0x821f('0x35')]||0xa)*0x3e8;var _0x597285=(_0x3b2732[_0x821f('0x35')]||0x14)*0x3e8;var _0x26cf9e;if(_0x1b8702>_0x597285){_0x597285=_0x1b8702;}var _0x357563=seqqueue[_0x821f('0x40')](_0x1b8702);_0x357563['id']=_0x46076e;_0x357563[_0x821f('0x41')]=_0x1b8702;_0x357563[_0x821f('0x42')]=_0x597285;_0x357563[_0x821f('0x21')]=_0x17c22d['channel'];_0x1dcf10[_0x821f('0x43')][_0x46076e]['on'](_0x821f('0x44'),function(){logger[_0x821f('0x29')](_0x821f('0x45'),_0x46076e);stopRouting(_0x46076e,_0x180ded,_0x17c22d,_0x1dcf10);clearTimeout(_0x26cf9e);_0x26cf9e=undefined;_0x357563[_0x821f('0x46')](!![]);if(_0x1dcf10[_0x821f('0x43')][_0x46076e]){delete _0x1dcf10[_0x821f('0x43')][_0x46076e];}_0x55923b[_0x821f('0x3d')]();});_0x1dcf10[_0x821f('0x43')][_0x46076e]['on'](_0x821f('0x47'),function(){if(_0x1dcf10['rules'][_0x46076e]){delete _0x1dcf10['rules'][_0x46076e];}});_0x26cf9e=setTimeout(function(){logger[_0x821f('0x29')](_0x821f('0x48'),_0x46076e);endRouting(_0x46076e,_0x180ded,_0x17c22d,_0x1dcf10);clearTimeout(_0x26cf9e);_0x357563[_0x821f('0x46')](!![]);_0x55923b['next']();},_0x597285);switch(_0x180ded['strategy']){case'rrmemory':strategy[_0x821f('0x49')](_0x357563,_0x180ded,_0x1dcf10,_0x17c22d);break;default:strategy[_0x821f('0x4a')](_0x357563,_0x180ded,_0x1dcf10,_0x17c22d);}}else{logger['error'](_0x821f('0x4b'),_0x46076e,_0x3b2732[_0x821f('0x2b')]);_0x55923b['stop']();}}}catch(_0x495ed9){console[_0x821f('0x36')](_0x495ed9);logger[_0x821f('0x2f')]('[%s][QUEUE]\x20%s',_0x46076e,_0x495ed9[_0x821f('0x4c')]);_0x55923b[_0x821f('0x3d')]();}};}; \ No newline at end of file +var _0xd923=['QueueReport','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','log','LOG\x20~\x20endRouting\x20~\x20queue','update','toLowerCase','consequence','validate','length','stop','Queues','LOG\x20~\x20returnfunction\x20~\x20q','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','info','name','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd923,0x6c));var _0x3d92=function(_0x6f68aa,_0x2a47b4){_0x6f68aa=_0x6f68aa-0x0;var _0x5950eb=_0xd923[_0x6f68aa];return _0x5950eb;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x3d92('0x0'));var seqqueue=require('seq-queue');var moment=require(_0x3d92('0x1'));var Redis=require(_0x3d92('0x2'));var config=require(_0x3d92('0x3'));var logger=require('../../../../config/logger')(_0x3d92('0x4'));var strategy=require(_0x3d92('0x5'));config[_0x3d92('0x6')]=_[_0x3d92('0x7')](config['redis'],{'host':_0x3d92('0x8'),'port':0x18eb});var io=require(_0x3d92('0x9'))(new Redis(config[_0x3d92('0x6')]));var attributes=['id',_0x3d92('0xa'),_0x3d92('0xb'),_0x3d92('0xc'),_0x3d92('0xd'),_0x3d92('0xe')];function emit(_0x280700,_0x5b8835,_0x26c60d){io['to'](_0x280700)['emit'](_0x5b8835,_0x26c60d);}function emitChannelQueueInteraction(_0x2ca249,_0x470e21,_0x110b54,_0x545424,_0x422604,_0x5a3606,_0x4d5f3f,_0x54df6b){var _0x58e264=_['clone'](_0x110b54);_0x58e264['queue_id']=_0x54df6b;_0x58e264[_0x3d92('0xc')]=_0x470e21;_0x58e264[_0x3d92('0xb')]=_0x545424;_0x58e264['id']=_0x422604;if(_0x5a3606){attributes[_0x3d92('0xf')](_['capitalize'](_0x2ca249)+_0x3d92('0x10'));_0x4d5f3f[util[_0x3d92('0x11')](_0x3d92('0x12'),_0x2ca249)][_0x422604]=_[_0x3d92('0x13')](_0x58e264,attributes);}else{delete _0x4d5f3f[util[_0x3d92('0x11')](_0x3d92('0x12'),_0x2ca249)][_0x422604];}emit(util[_0x3d92('0x11')]('%s:queue:%s',_0x2ca249,_0x470e21),util[_0x3d92('0x11')](_0x3d92('0x14'),_0x2ca249,_0x5a3606?_0x3d92('0x15'):_0x3d92('0x16')),_[_0x3d92('0x13')](_0x58e264,attributes));}var rpc={'openchannelQueueReport':require(_0x3d92('0x17')),'mailQueueReport':require(_0x3d92('0x18')),'chatQueueReport':require(_0x3d92('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x3d92('0x1a')),'whatsappQueueReport':require(_0x3d92('0x1b'))};var queue=schema({'name':{'type':_0x3d92('0x1c'),'required':!![],'message':_0x3d92('0x1d')},'timeout':{'type':_0x3d92('0x1e'),'message':_0x3d92('0x1f')}});function startRouting(_0x5c7e08,_0x3df7c1,_0x1bb0e4,_0xc1ef82){if(_0x5c7e08&&_0x3df7c1&&_0x1bb0e4){_0x3df7c1[_0x3d92('0x20')]+=0x1;var _0x26f0f6={'uniqueid':_0x5c7e08,'from':_0x1bb0e4[_0x3d92('0x21')]?_0x1bb0e4[_0x3d92('0x21')]['from']:'','joinAt':moment()['format'](_0x3d92('0x22')),'ContactId':_0x1bb0e4[_0x3d92('0x23')]?_0x1bb0e4[_0x3d92('0x23')]['id']:null,'ListId':_0x1bb0e4[_0x3d92('0x24')]?_0x1bb0e4[_0x3d92('0x24')]['id']:null};_0x26f0f6[_[_0x3d92('0x25')](_0x1bb0e4['channel'])+_0x3d92('0x26')]=_0x3df7c1['id']||null;_0x26f0f6[_['upperFirst'](_0x1bb0e4['channel'])+_0x3d92('0x10')]=_0x1bb0e4[_0x3d92('0x27')]?_0x1bb0e4['interaction']['id']:null;_0x26f0f6[_[_0x3d92('0x25')](_0x1bb0e4[_0x3d92('0x28')])+_0x3d92('0x29')]=_0x1bb0e4['message']?_0x1bb0e4[_0x3d92('0x2a')]['id']:null;_0x26f0f6[_[_0x3d92('0x25')](_0x1bb0e4[_0x3d92('0x28')])+(_0x1bb0e4[_0x3d92('0x28')]!==_0x3d92('0x2b')?'AccountId':'WebsiteId')]=_0x1bb0e4[_0x3d92('0xb')]?_0x1bb0e4[_0x3d92('0xb')]['id']:null;logger[_0x3d92('0x2c')](util[_0x3d92('0x11')]('[%s][START:QUEUE][NAME:%s]',_0x5c7e08,_0x3df7c1[_0x3d92('0x2d')]));emitChannelQueueInteraction(_0x1bb0e4['channel'],_0x3df7c1[_0x3d92('0x2d')],_0x26f0f6,_0x1bb0e4[_0x3d92('0xb')]['name'],_0x1bb0e4[_0x3d92('0x2a')]['id'],!![],_0xc1ef82,_0x3df7c1['id']);if(rpc[_0x1bb0e4[_0x3d92('0x28')]+'QueueReport']){return rpc[_0x1bb0e4['channel']+'QueueReport']['create'](_0x26f0f6)[_0x3d92('0x2e')](function(_0x4a135d){logger['error'](_0x3d92('0x2f'));});}}}function stopRouting(_0x2c8b50,_0x18608d,_0x9f665e,_0x55cce6){if(_0x2c8b50&&_0x18608d){_0x18608d[_0x3d92('0x20')]-=0x1;var _0x4e50b8={'leaveAt':moment()[_0x3d92('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x3d92('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3d92('0x30')};logger['info'](util[_0x3d92('0x11')](_0x3d92('0x31'),_0x2c8b50,_0x18608d['name']));emitChannelQueueInteraction(_0x9f665e['channel'],_0x18608d[_0x3d92('0x2d')],_0x9f665e[_0x3d92('0x21')],_0x9f665e[_0x3d92('0xb')][_0x3d92('0x2d')],_0x9f665e[_0x3d92('0x2a')]['id'],![],_0x55cce6,_0x18608d['id']);if(rpc[_0x9f665e[_0x3d92('0x28')]+_0x3d92('0x32')]){return rpc[_0x9f665e[_0x3d92('0x28')]+_0x3d92('0x32')]['update'](_0x2c8b50,_0x4e50b8)[_0x3d92('0x2e')](function(_0x3445fd){logger[_0x3d92('0x33')](_0x3d92('0x34'));});}}}function endRouting(_0x3f0fca,_0x2a4123,_0x564574,_0x105a28){if(_0x3f0fca&&_0x2a4123){_0x2a4123['waiting']-=0x1;var _0x1d60a8={'leaveAt':moment()[_0x3d92('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x3d92('0x22')),'reason':_0x3d92('0x35')};logger[_0x3d92('0x2c')](util[_0x3d92('0x11')](_0x3d92('0x36'),_0x3f0fca,_0x2a4123[_0x3d92('0x2d')]));emitChannelQueueInteraction(_0x564574[_0x3d92('0x28')],_0x2a4123[_0x3d92('0x2d')],_0x564574['body'],_0x564574[_0x3d92('0xb')][_0x3d92('0x2d')],_0x564574[_0x3d92('0x2a')]['id'],![],_0x105a28);console[_0x3d92('0x37')](_0x3d92('0x38'),_0x2a4123);if(rpc[_0x564574['channel']+_0x3d92('0x32')]){return rpc[_0x564574[_0x3d92('0x28')]+_0x3d92('0x32')][_0x3d92('0x39')](_0x3f0fca,_0x1d60a8)[_0x3d92('0x2e')](function(_0x194b98){logger[_0x3d92('0x33')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x5c38c3){return function(_0x36ad67){return _0x36ad67[_0x3d92('0x2d')][_0x3d92('0x3a')]()===_0x5c38c3[_0x3d92('0x3a')]();};}exports[_0x3d92('0x3b')]=function(_0x401bd4,_0x466a47,_0x143747,_0x11837c){return function(_0x5db092){try{var _0x1b3911={'name':_0x466a47[0x0],'timeout':_0x466a47[0x1]};var _0x5404ce=queue[_0x3d92('0x3c')](_0x1b3911,{'typecast':!![]});if(_0x5404ce[_0x3d92('0x3d')]){logger['error']('[%s][QUEUE]\x20%s',_0x401bd4,_['map'](_0x5404ce,_0x3d92('0x2a'))['join'](',\x20'));_0x5db092[_0x3d92('0x3e')]();}else{var _0x23e5b8=_['find'](_0x143747[_0x11837c[_0x3d92('0x28')]+_0x3d92('0x3f')],handleFindQueue(_0x1b3911[_0x3d92('0x2d')]));console[_0x3d92('0x37')](_0x3d92('0x40'),_0x23e5b8);if(_0x23e5b8){startRouting(_0x401bd4,_0x23e5b8,_0x11837c,_0x143747);var _0x459a48=(_0x23e5b8[_0x3d92('0x35')]||0xa)*0x3e8;var _0x4aed15=(_0x1b3911[_0x3d92('0x35')]||0x14)*0x3e8;var _0x110d8b;if(_0x459a48>_0x4aed15){_0x4aed15=_0x459a48;}var _0x82b5bb=seqqueue[_0x3d92('0x41')](_0x459a48);_0x82b5bb['id']=_0x401bd4;_0x82b5bb[_0x3d92('0x42')]=_0x459a48;_0x82b5bb[_0x3d92('0x43')]=_0x4aed15;_0x82b5bb[_0x3d92('0x28')]=_0x11837c['channel'];_0x143747[_0x3d92('0x44')][_0x401bd4]['on'](_0x3d92('0x45'),function(){logger[_0x3d92('0x2c')](_0x3d92('0x46'),_0x401bd4);stopRouting(_0x401bd4,_0x23e5b8,_0x11837c,_0x143747);clearTimeout(_0x110d8b);_0x110d8b=undefined;_0x82b5bb[_0x3d92('0x47')](!![]);if(_0x143747[_0x3d92('0x44')][_0x401bd4]){delete _0x143747[_0x3d92('0x44')][_0x401bd4];}_0x5db092[_0x3d92('0x3e')]();});_0x143747[_0x3d92('0x44')][_0x401bd4]['on'](_0x3d92('0x48'),function(){if(_0x143747[_0x3d92('0x44')][_0x401bd4]){delete _0x143747[_0x3d92('0x44')][_0x401bd4];}});_0x110d8b=setTimeout(function(){logger[_0x3d92('0x2c')](_0x3d92('0x49'),_0x401bd4);endRouting(_0x401bd4,_0x23e5b8,_0x11837c,_0x143747);clearTimeout(_0x110d8b);_0x82b5bb[_0x3d92('0x47')](!![]);_0x5db092[_0x3d92('0x4a')]();},_0x4aed15);switch(_0x23e5b8[_0x3d92('0x4b')]){case _0x3d92('0x4c'):strategy[_0x3d92('0x4c')](_0x82b5bb,_0x23e5b8,_0x143747,_0x11837c);break;default:strategy['beepall'](_0x82b5bb,_0x23e5b8,_0x143747,_0x11837c);}}else{logger[_0x3d92('0x33')](_0x3d92('0x4d'),_0x401bd4,_0x1b3911[_0x3d92('0x2d')]);_0x5db092[_0x3d92('0x3e')]();}}}catch(_0x2c62b1){console[_0x3d92('0x37')](_0x2c62b1);logger[_0x3d92('0x33')](_0x3d92('0x4e'),_0x401bd4,_0x2c62b1['stack']);_0x5db092[_0x3d92('0x3e')]();}};}; \ 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 9d43ec4..80bd1b9 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 _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xc23380,_0x18e158){_0xc23380=_0xc23380-0x0;var _0x4b1b26=_0xd0bb[_0xc23380];return _0x4b1b26;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=agent; \ No newline at end of file +var _0x24ca=['busy','busyQueue','saveWaitingNotification','showNotification','RINGING','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','exports','lodash','../../../../../config/logger','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel'];(function(_0x368b10,_0x4671e5){var _0x52d470=function(_0x53bb47){while(--_0x53bb47){_0x368b10['push'](_0x368b10['shift']());}};_0x52d470(++_0x4671e5);}(_0x24ca,0x8c));var _0xa24c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0x24ca[_0x198446];return _0x38d7b7;};'use strict';var _=require(_0xa24c('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xa24c('0x1'))('routing');var Agent=function(_0x155c49,_0x1efd39,_0xe69cdd,_0x49f276){this[_0xa24c('0x2')]=uuid['v4']();this[_0xa24c('0x3')]=_0x155c49;this[_0xa24c('0x4')]=_0x1efd39;this['realtime']=_0xe69cdd;this['routing']=_0x49f276;this['squeue'][_0xa24c('0x5')](this[_0xa24c('0x6')][_0xa24c('0x7')](this),this[_0xa24c('0x8')][_0xa24c('0x7')](this));this[_0xa24c('0x3')]['on']('timeout',this[_0xa24c('0x8')][_0xa24c('0x7')](this));this[_0xa24c('0x3')]['on']('drained',this['handleDrained'][_0xa24c('0x7')](this));};Agent[_0xa24c('0x9')][_0xa24c('0x5')]=function(){this[_0xa24c('0x3')][_0xa24c('0x5')](this[_0xa24c('0x6')]['bind'](this),this['handleTimeout']['bind'](this));};Agent[_0xa24c('0x9')][_0xa24c('0xa')]=function(){this[_0xa24c('0x8')](!![]);};Agent[_0xa24c('0x9')][_0xa24c('0x6')]=function(){logger['debug'](_0xa24c('0xb'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']])){logger[_0xa24c('0xe')](_0xa24c('0xf'),this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}else{if(this[_0xa24c('0x10')][_0xa24c('0x11')]||util[_0xa24c('0x12')](this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')]['agents'][this[_0xa24c('0x4')]['id']],this['squeue'][_0xa24c('0x13')],![])){this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x14')]=!![];this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x15')]=undefined;util[_0xa24c('0x16')](this[_0xa24c('0xc')],this['routing'],this['agent'],this[_0xa24c('0x3')][_0xa24c('0x13')]);util[_0xa24c('0x17')](this[_0xa24c('0x2')],this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],null,this[_0xa24c('0x10')]);util['writeLog'](this[_0xa24c('0x3')]['id'],this['realtime'][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],_0xa24c('0x18')+(this[_0xa24c('0x10')]['forcedOwnership']?':FORCED':''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}}};Agent[_0xa24c('0x9')]['handleTimeout']=function(_0x5c8113){if(_[_0xa24c('0x19')](this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']])){return logger[_0xa24c('0xe')](_0xa24c('0xf'),this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);}else{logger[_0xa24c('0xe')](_0xa24c('0x1a'),this['squeue']['id'],this[_0xa24c('0x4')]['id']);util[_0xa24c('0x1b')](this['notificationId'],this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],null,this[_0xa24c('0x10')]);this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x14')]=![];this[_0xa24c('0xc')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xa24c('0x1c')](this['realtime'],this[_0xa24c('0x10')],this[_0xa24c('0x4')],this[_0xa24c('0x3')]['channel']);util[_0xa24c('0x1d')](this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')]['agents'][this[_0xa24c('0x4')]['id']],_0x5c8113?_0xa24c('0x1e'):'TIMEOUT');}if(!_0x5c8113){setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}};function agent(_0xd837dc,_0x570d7c,_0x45c429,_0x2c63da){return new Agent(_0xd837dc,_0x570d7c,_0x45c429,_0x2c63da);}module[_0xa24c('0x1f')]=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 8d15a97..afb2200 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 _0xdf06=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','TIMEOUT','removeWaitingNotification','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','timeout','bind','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','isAgentAvailable','channel','writeLog','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY'];(function(_0x407916,_0x331e72){var _0x42b45a=function(_0x551aa0){while(--_0x551aa0){_0x407916['push'](_0x407916['shift']());}};_0x42b45a(++_0x331e72);}(_0xdf06,0x183));var _0x6df0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdf06[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6df0('0x0'));var logger=require(_0x6df0('0x1'))(_0x6df0('0x2'));var Beepall=function(_0x4a057d,_0x1ed3b9,_0x357ba8,_0x35f55c){this[_0x6df0('0x3')]=uuid['v4']();this[_0x6df0('0x4')]=_0x4a057d;this[_0x6df0('0x5')]=_0x1ed3b9;this['realtime']=_0x357ba8;this[_0x6df0('0x2')]=_0x35f55c;this[_0x6df0('0x4')][_0x6df0('0x6')](this[_0x6df0('0x7')]['bind'](this),this[_0x6df0('0x8')]['bind'](this));this['squeue']['on'](_0x6df0('0x9'),this['handleTimeout'][_0x6df0('0xa')](this));this[_0x6df0('0x4')]['on']('drained',this[_0x6df0('0xb')][_0x6df0('0xa')](this));};Beepall['prototype'][_0x6df0('0x6')]=function(){this[_0x6df0('0x4')][_0x6df0('0x6')](this[_0x6df0('0x7')][_0x6df0('0xa')](this),this['handleTimeout'][_0x6df0('0xa')](this));};Beepall[_0x6df0('0xc')]['handleDrained']=function(){this[_0x6df0('0x8')](!![]);};Beepall[_0x6df0('0xc')][_0x6df0('0x7')]=function(){var _0x34ea88=!![];if(!_[_0x6df0('0xd')](this['queue'])&&!_['isNil'](this[_0x6df0('0x5')][_0x6df0('0xe')])&&this['queue'][_0x6df0('0xe')]['length']>0x0){for(var _0x446797=0x0,_0x27cf6e;_0x4467970x0){for(var _0xde975a=0x0,_0x1eb3fd;_0xde975a0x0&&_0x309d64[_0x371d39+_0x125e('0x25')]>=_0x309d64[_0x371d39+_0x125e('0x24')]){writeLog(_0x594b31,_0x309d64,_0x371d39['toUpperCase']()+_0x125e('0x26'));return![];}}return!![];};exports[_0x125e('0x27')]=function(_0x3414d5,_0x340330,_0x1c3ad7,_0x1b7aa7,_0x645b63){return sendNotification(!![],_0x3414d5,_0x340330,_0x1c3ad7,_0x1b7aa7,_0x645b63);};exports[_0x125e('0x28')]=function(_0x595627,_0xef006f,_0x480cd5,_0x343e02,_0x3aeea2){return sendNotification(![],_0x595627,_0xef006f,_0x480cd5,_0x343e02,_0x3aeea2);};exports[_0x125e('0x29')]=function(_0x30c419,_0x257775,_0x3009e9){var _0x5201bf=_0x257775[_0x125e('0x2a')][_0x125e('0x2b')];if(!_0x5201bf&&_0x3009e9){_0x5201bf=_0x3009e9['id'];}var _0x5dd806=_[_0x125e('0x2c')](_0x30c419[_0x257775['channel']+_0x125e('0x2d')],function(_0x413600){var _0x17b082=_[_0x125e('0x2e')](_0x257775[_0x125e('0x2f')])+_0x125e('0x30');return _0x413600[_0x17b082]===_0x257775[_0x125e('0x2a')]['id'];});if(!_0x5dd806&&_0x5201bf){_0x5dd806=_['some'](_0x30c419[_0x125e('0x31')][_0x5201bf][_0x257775[_0x125e('0x2f')]+'WaitingInteractions'],function(_0xd4eeed){return _0xd4eeed['id']===_0x257775[_0x125e('0x2a')]['id'];});}return _0x5dd806;};exports[_0x125e('0x32')]=function(_0x541e97,_0x27451e,_0x5bd4f8,_0x269fd0){_0x541e97[_0x125e('0x31')][_0x5bd4f8['id']][_0x269fd0+'WaitingInteractions'][_0x27451e['message']['id']]={'id':_0x27451e[_0x125e('0x2a')]['id']};};exports['removeWaitingNotification']=function(_0xe02b11,_0x3179a4,_0x3828dd,_0x2a1839){delete _0xe02b11[_0x125e('0x31')][_0x3828dd['id']][_0x2a1839+_0x125e('0x33')][_0x3179a4[_0x125e('0x18')]['id']];};exports[_0x125e('0x34')]=writeLog; \ No newline at end of file +var _0xf837=['body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','message','emit','save','remove','debug','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','InteractionId','interaction','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','agents','writeLog','lodash','util','ioredis','../../../../../config/environment','routing','defaults','localhost','socket.io-emitter','redis','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xf837,0x15b));var _0x7f83=function(_0x187e31,_0x434410){_0x187e31=_0x187e31-0x0;var _0x2d3e7a=_0xf837[_0x187e31];return _0x2d3e7a;};'use strict';var _=require(_0x7f83('0x0'));var util=require(_0x7f83('0x1'));var utils=require('../utils');var Redis=require(_0x7f83('0x2'));var config=require(_0x7f83('0x3'));var logger=require('../../../../../config/logger')(_0x7f83('0x4'));config['redis']=_[_0x7f83('0x5')](config['redis'],{'host':_0x7f83('0x6'),'port':0x18eb});var io=require(_0x7f83('0x7'))(new Redis(config[_0x7f83('0x8')]));function sendNotification(_0x3c0cc2,_0x2ac791,_0x2cf173,_0x3da935,_0x116c8a,_0x2db52b){io['to'](util[_0x7f83('0x9')](_0x7f83('0xa'),_0x3da935[_0x7f83('0xb')]))['emit'](_0x7f83('0xc'),_0x3da935);var _0x101119=_0x2db52b||{};var _0x4706a5=_0x2cf173[_0x7f83('0xd')]('.');var _0x43eaff={'uniqueid':_0x2ac791,'channel':_0x4706a5[0x0],'id':_0x4706a5[0x1],'title':_0x4706a5[0x0]+_0x7f83('0xe'),'interactionId':_0x4706a5[0x2],'queue':_0x116c8a?_0x116c8a[_0x7f83('0xb')]:null,'sound':_0x101119[_0x7f83('0xf')]['notificationSound'],'shake':_0x101119[_0x7f83('0xf')][_0x7f83('0x10')]};try{if(!_0x101119[_0x7f83('0x11')]){_0x101119['body']={};}if(_0x116c8a){_0x101119[_0x7f83('0x11')]['queue']=_0x116c8a;}else if(_0x101119[_0x7f83('0x11')][_0x7f83('0x12')]){delete _0x101119[_0x7f83('0x11')][_0x7f83('0x12')];}_0x43eaff[_0x7f83('0x13')]=utils[_0x7f83('0x14')](_0x101119[_0x7f83('0xf')]['notificationTemplate'],_0x101119);}catch(_0x55b1fb){_0x43eaff[_0x7f83('0x13')]=_0x7f83('0x15');logger[_0x7f83('0x16')](util['format']('[%s][QUEUE]\x20%s',_0x2ac791,_0x55b1fb[_0x7f83('0x17')]));}io['to'](util[_0x7f83('0x9')](_0x7f83('0xa'),_0x3da935[_0x7f83('0xb')]))[_0x7f83('0x18')](util['format']('notification:%s',_0x3c0cc2?_0x7f83('0x19'):_0x7f83('0x1a')),_0x43eaff);}function writeLog(_0x10f3fc,_0x1c33d7,_0x432dbb){return logger[_0x7f83('0x1b')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x10f3fc,_0x1c33d7[_0x7f83('0xb')],_0x432dbb));}exports[_0x7f83('0x1c')]=function(_0xbd3e07,_0x217fef,_0x2253c5,_0x219933){if(_0x217fef[_0x7f83('0x1d')]){writeLog(_0xbd3e07,_0x217fef,_0x7f83('0x1e'));return![];}if(!_0x217fef['online']){writeLog(_0xbd3e07,_0x217fef,_0x7f83('0x1f'));return![];}if(_0x217fef[_0x2253c5+_0x7f83('0x20')]){writeLog(_0xbd3e07,_0x217fef,_0x7f83('0x21'));return![];}if(_0x219933&&_0x217fef['hasOwnProperty'](_0x2253c5+_0x7f83('0x22'))&&_0x217fef[_0x7f83('0x23')](_0x2253c5+_0x7f83('0x24'))){if(_0x217fef[_0x2253c5+_0x7f83('0x22')]>0x0&&_0x217fef[_0x2253c5+'CurrentCapacity']>=_0x217fef[_0x2253c5+_0x7f83('0x22')]){writeLog(_0xbd3e07,_0x217fef,_0x2253c5[_0x7f83('0x25')]()+_0x7f83('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x5800c2,_0x4faa0d,_0x50d532,_0x326108,_0x2dac62){return sendNotification(!![],_0x5800c2,_0x4faa0d,_0x50d532,_0x326108,_0x2dac62);};exports[_0x7f83('0x27')]=function(_0x10d4bf,_0x4585e6,_0x1c2762,_0x493d54,_0x5af438){return sendNotification(![],_0x10d4bf,_0x4585e6,_0x1c2762,_0x493d54,_0x5af438);};exports[_0x7f83('0x28')]=function(_0x19a458,_0x51528c,_0x7d8bca){var _0xbaa90b=_0x51528c['interaction'][_0x7f83('0x29')];if(!_0xbaa90b&&_0x7d8bca){_0xbaa90b=_0x7d8bca['id'];}var _0x26c4bb=_[_0x7f83('0x2a')](_0x19a458[_0x51528c[_0x7f83('0x2b')]+_0x7f83('0x2c')],function(_0x3b47a1){var _0x402782=_['capitalize'](_0x51528c[_0x7f83('0x2b')])+_0x7f83('0x2d');return _0x3b47a1[_0x402782]===_0x51528c[_0x7f83('0x2e')]['id'];});if(!_0x26c4bb&&_0xbaa90b){_0x26c4bb=_[_0x7f83('0x2a')](_0x19a458['agents'][_0xbaa90b][_0x51528c[_0x7f83('0x2b')]+_0x7f83('0x2f')],function(_0x2d31d6){return _0x2d31d6['id']===_0x51528c[_0x7f83('0x2e')]['id'];});}return _0x26c4bb;};exports[_0x7f83('0x30')]=function(_0x415048,_0x2a7e86,_0x128a54,_0x46827e){_0x415048['agents'][_0x128a54['id']][_0x46827e+_0x7f83('0x2f')][_0x2a7e86[_0x7f83('0x17')]['id']]={'id':_0x2a7e86['interaction']['id']};};exports[_0x7f83('0x31')]=function(_0x1bac88,_0x19b694,_0x3cff5e,_0x3244f2){delete _0x1bac88[_0x7f83('0x32')][_0x3cff5e['id']][_0x3244f2+_0x7f83('0x2f')][_0x19b694['message']['id']];};exports[_0x7f83('0x33')]=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 198c56c..ea9ae21 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 _0x27e7=['body','isObject','stringify','validate','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x27e7,0x67));var _0x727e=function(_0x4dc4f2,_0x53faa8){_0x4dc4f2=_0x4dc4f2-0x0;var _0x58e79e=_0x27e7[_0x4dc4f2];return _0x58e79e;};'use strict';var schema=require(_0x727e('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require(_0x727e('0x1'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x727e('0x2')}});exports[_0x727e('0x3')]=function(_0x3435a0,_0x303b7e){return function(_0x44dc5f){try{var _0x3af886={'command':_0x303b7e[0x0]};var _0x29f32a=system[_0x727e('0x0')](_0x3af886,{'typecast':!![]});if(_0x29f32a[_0x727e('0x4')]){logger[_0x727e('0x5')](_0x727e('0x6'),_0x3435a0,_[_0x727e('0x7')](_0x29f32a,_0x727e('0x8'))['join'](',\x20'));logger['info'](_0x727e('0x9'),_0x3435a0);_0x44dc5f[_0x727e('0xa')]();}else{var _0x3244b3=this;var _0x2f1e62=utils[_0x727e('0xb')](_0x303b7e[0x0],this);logger['info'](_0x727e('0xc'),_0x3435a0,_0x2f1e62);sh[_0x727e('0xd')](_[_0x727e('0xe')](_0x2f1e62),function(_0x131b9c,_0xc6ed2d){logger[_0x727e('0xf')](_0x727e('0x10'),_0x3435a0,_0x131b9c);if(_0x131b9c==0x0){var _0x1c3b06=_0xc6ed2d[_0x727e('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x727e('0x12')](_0x303b7e[0x1])||_[_0x727e('0x13')](_0x303b7e[0x1])){logger[_0x727e('0xf')](_0x727e('0x14'),_0x3435a0);_0x3244b3['body'][_0x303b7e[0x1]]=_0x1c3b06;}else{logger[_0x727e('0xf')](_0x727e('0x15'),_0x3435a0,_0x303b7e[0x1],_0x1c3b06);_0x3244b3[_0x727e('0x16')][_0x303b7e[0x1]]=_0x1c3b06;}}_0x44dc5f[_0x727e('0xa')]();});}}catch(_0x271b17){logger[_0x727e('0x5')](_0x727e('0x6'),_0x3435a0,_[_0x727e('0x17')](_0x271b17)?JSON[_0x727e('0x18')](_0x271b17):_0x271b17);logger[_0x727e('0xf')](_0x727e('0x9'),_0x3435a0);_0x44dc5f[_0x727e('0xa')]();}};}; \ No newline at end of file +var _0x6315=['consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1a24b6,_0x5d23e4){var _0x2a138b=function(_0xef32ac){while(--_0xef32ac){_0x1a24b6['push'](_0x1a24b6['shift']());}};_0x2a138b(++_0x5d23e4);}(_0x6315,0x65));var _0x5631=function(_0x97f813,_0x1d728e){_0x97f813=_0x97f813-0x0;var _0x163bb3=_0x6315[_0x97f813];return _0x163bb3;};'use strict';var schema=require('validate');var sh=require(_0x5631('0x0'));var _=require(_0x5631('0x1'));var utils=require(_0x5631('0x2'));var logger=require(_0x5631('0x3'))(_0x5631('0x4'));var system=schema({'command':{'type':_0x5631('0x5'),'required':!![],'message':_0x5631('0x6')}});exports[_0x5631('0x7')]=function(_0x42d503,_0x39f68c){return function(_0x3a72d1){try{var _0x4849dc={'command':_0x39f68c[0x0]};var _0xff42d7=system[_0x5631('0x8')](_0x4849dc,{'typecast':!![]});if(_0xff42d7['length']){logger[_0x5631('0x9')](_0x5631('0xa'),_0x42d503,_[_0x5631('0xb')](_0xff42d7,_0x5631('0xc'))[_0x5631('0xd')](',\x20'));logger[_0x5631('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x42d503);_0x3a72d1[_0x5631('0xf')]();}else{var _0x5a214b=this;var _0x16db6a=utils[_0x5631('0x10')](_0x39f68c[0x0],this);logger[_0x5631('0xe')](_0x5631('0x11'),_0x42d503,_0x16db6a);sh['exec'](_[_0x5631('0x12')](_0x16db6a),function(_0x58d57f,_0x5af827){logger[_0x5631('0xe')](_0x5631('0x13'),_0x42d503,_0x58d57f);if(_0x58d57f==0x0){var _0x9e9494=_0x5af827[_0x5631('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x5631('0x15')](_0x39f68c[0x1])||_[_0x5631('0x16')](_0x39f68c[0x1])){logger['info'](_0x5631('0x17'),_0x42d503);_0x5a214b[_0x5631('0x18')][_0x39f68c[0x1]]=_0x9e9494;}else{logger[_0x5631('0xe')](_0x5631('0x19'),_0x42d503,_0x39f68c[0x1],_0x9e9494);_0x5a214b[_0x5631('0x18')][_0x39f68c[0x1]]=_0x9e9494;}}_0x3a72d1[_0x5631('0xf')]();});}}catch(_0x349903){logger['error'](_0x5631('0xa'),_0x42d503,_['isObject'](_0x349903)?JSON[_0x5631('0x1a')](_0x349903):_0x349903);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x42d503);_0x3a72d1[_0x5631('0xf')]();}};}; \ 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 b87a64c..b5382f0 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 _0x018e=['finally','next','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','channel','Interaction','interaction','catch','stringify'];(function(_0x26b5fa,_0x1bea6f){var _0x4568c9=function(_0x29d0b2){while(--_0x29d0b2){_0x26b5fa['push'](_0x26b5fa['shift']());}};_0x4568c9(++_0x1bea6f);}(_0x018e,0xc8));var _0xe018=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x018e[_0x77d286];return _0x5446a5;};'use strict';var schema=require(_0xe018('0x0'));var _=require(_0xe018('0x1'));var rpc={'chatInteraction':require(_0xe018('0x2')),'openchannelInteraction':require(_0xe018('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe018('0x4')),'faxInteraction':require(_0xe018('0x5')),'whatsappInteraction':require(_0xe018('0x6'))};var logger=require(_0xe018('0x7'))(_0xe018('0x8'));var tag=schema({'tag':{'type':_0xe018('0x9'),'required':!![],'message':_0xe018('0xa')}});exports[_0xe018('0xb')]=function(_0x50fef9,_0x1c69af,_0x109e4a,_0x31dc5f){return function(_0x45ffb2){try{var _0x1478a0={'tag':_0x1c69af[0x0]};var _0x5df51b=tag[_0xe018('0x0')](_0x1478a0,{'typecast':!![]});if(_0x5df51b[_0xe018('0xc')]){logger[_0xe018('0xd')](_0xe018('0xe'),_0x50fef9,_[_0xe018('0xf')](_0x5df51b,_0xe018('0x10'))[_0xe018('0x11')](',\x20'));logger[_0xe018('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x50fef9);_0x45ffb2['next']();}else{var _0x51d48f={'ids':[_0x1c69af[0x0]]};if(rpc[_0x31dc5f[_0xe018('0x13')]+_0xe018('0x14')]){rpc[_0x31dc5f['channel']+_0xe018('0x14')]['addTags'](_0x31dc5f[_0xe018('0x15')]['id'],_0x51d48f)['then'](function(_0x4aff7c){logger[_0xe018('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x50fef9,_0x1c69af[0x1],_0x31dc5f[_0xe018('0x13')],_0x31dc5f[_0xe018('0x15')]['id']);})[_0xe018('0x16')](function(_0x1c7f14){logger[_0xe018('0xd')](_0xe018('0xe'),_0x50fef9,JSON[_0xe018('0x17')](_0x1c7f14));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x50fef9);})[_0xe018('0x18')](function(){_0x45ffb2[_0xe018('0x19')]();});}}}catch(_0x1b226a){logger[_0xe018('0xd')](_0xe018('0xe'),_0x50fef9,_[_0xe018('0x1a')](_0x1b226a)?JSON[_0xe018('0x17')](_0x1b226a):_0x1b226a);logger[_0xe018('0x12')](_0xe018('0x1b'),_0x50fef9);_0x45ffb2[_0xe018('0x19')]();}};}; \ No newline at end of file +var _0x4797=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','isObject','validate','../../rpc/chatInteraction'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4797,0x111));var _0x7479=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4797[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x7479('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x7479('0x1')),'openchannelInteraction':require(_0x7479('0x2')),'smsInteraction':require(_0x7479('0x3')),'mailInteraction':require(_0x7479('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x7479('0x5'))(_0x7479('0x6'));var tag=schema({'tag':{'type':_0x7479('0x7'),'required':!![],'message':_0x7479('0x8')}});exports[_0x7479('0x9')]=function(_0x5cdb7f,_0x197d93,_0x11d157,_0x4acaa3){return function(_0xf5a7d2){try{var _0x563aa7={'tag':_0x197d93[0x0]};var _0x55fdcd=tag[_0x7479('0x0')](_0x563aa7,{'typecast':!![]});if(_0x55fdcd['length']){logger[_0x7479('0xa')](_0x7479('0xb'),_0x5cdb7f,_[_0x7479('0xc')](_0x55fdcd,_0x7479('0xd'))[_0x7479('0xe')](',\x20'));logger[_0x7479('0xf')](_0x7479('0x10'),_0x5cdb7f);_0xf5a7d2[_0x7479('0x11')]();}else{var _0x53aadb={'ids':[_0x197d93[0x0]]};if(rpc[_0x4acaa3['channel']+'Interaction']){rpc[_0x4acaa3[_0x7479('0x12')]+_0x7479('0x13')][_0x7479('0x14')](_0x4acaa3[_0x7479('0x15')]['id'],_0x53aadb)['then'](function(_0x22f64b){logger[_0x7479('0xf')](_0x7479('0x16'),_0x5cdb7f,_0x197d93[0x1],_0x4acaa3[_0x7479('0x12')],_0x4acaa3['interaction']['id']);})['catch'](function(_0xeec0d){logger['error']('[%s][TAG]\x20%s',_0x5cdb7f,JSON[_0x7479('0x17')](_0xeec0d));logger[_0x7479('0xf')](_0x7479('0x10'),_0x5cdb7f);})['finally'](function(){_0xf5a7d2['next']();});}}}catch(_0x2c8c35){logger[_0x7479('0xa')]('[%s][TAG]\x20%s',_0x5cdb7f,_[_0x7479('0x18')](_0x2c8c35)?JSON[_0x7479('0x17')](_0x2c8c35):_0x2c8c35);logger[_0x7479('0xf')](_0x7479('0x10'),_0x5cdb7f);_0xf5a7d2[_0x7479('0x11')]();}};}; \ 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 40a8fb8..4770364 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 _0xc747=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','result','logged','channelId=','&serviceId=','&sessionId=','info','stop','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc747,0x12d));var _0x7c74=function(_0x47a854,_0x5871dd){_0x47a854=_0x47a854-0x0;var _0x51a0af=_0xc747[_0x47a854];return _0x51a0af;};'use strict';var rp=require('request-promise');var logger=require(_0x7c74('0x0'))(_0x7c74('0x1'));var _=require(_0x7c74('0x2'));var arr=[];exports[_0x7c74('0x3')]=function(_0x4190d4,_0x28b31d){return function(_0x2ceb7f){var _0x23724a=_0x28b31d[0xa];var _0x5e9f42=_0x28b31d[0xb];var _0x4f7192=_0x28b31d[0xc];var _0x453b70=_0x28b31d[0xd];var _0x7dbbce=_0x28b31d[0xe];var _0x216921=_0x28b31d[0xf][_0x7c74('0x4')](/\n/g,_0x7c74('0x5'));var _0x3bb5c4=_0x28b31d[0x10][_0x7c74('0x4')](/\n/g,'\x20');if(!arr[_0x7c74('0x6')](_0x5e9f42)){arr[_0x7c74('0x7')](_0x5e9f42);var _0x3c693d=_0x28b31d[0x3];var _0x5d3b3e=_0x28b31d[0x4];var _0x38475f=_0x28b31d[0x1];var _0x577dfc=_0x28b31d[0x0];var _0x8e2865={};_0x8e2865[_0x7c74('0x8')]=_0x28b31d[0x8]+'?params='+_0x4f7192+'|'+_0x23724a+'|'+_0x453b70+'|'+_0x5e9f42+'|'+_0x7dbbce;_0x8e2865[_0x7c74('0x9')]=_0x28b31d[0x7]+_0x7c74('0xa')+_0x4f7192+'|'+_0x23724a+'|'+_0x453b70+'|'+_0x5e9f42+'|'+_0x7dbbce+'|'+_0x216921+'|'+_0x3bb5c4;_0x8e2865[_0x7c74('0xb')]=_0x28b31d[0x9];var _0x4915e7={};_0x4915e7['jsonrpc']=_0x7c74('0xc');_0x4915e7[_0x7c74('0xd')]=_0x7c74('0xe');var _0x207783=[];_0x207783[_0x7c74('0x7')](_0x28b31d[0x2]);_0x207783['push'](_0x28b31d[0x5]);_0x207783[_0x7c74('0x7')](_0x28b31d[0x6]);_0x4915e7[_0x7c74('0xf')]=_0x207783;_0x4915e7['id']=0x1;var _0x4c4c71=JSON[_0x7c74('0x10')](_0x4915e7);var _0x45c594={'encoding':_0x7c74('0x11'),'method':_0x7c74('0x12'),'timeout':0x2710,'url':_0x3c693d,'headers':{'Content-Type':_0x7c74('0x13')},'body':_0x4c4c71};return rp(_0x45c594)[_0x7c74('0x14')](function(_0x10634d){const _0x370677=JSON['parse'](_0x10634d);if(!_0x370677[_0x7c74('0x15')][_0x7c74('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x35aa29=_0x5e9f42;var _0xa4def1=_0x7c74('0x17')+_0x38475f+_0x7c74('0x18')+_0x577dfc+_0x7c74('0x19')+_0x35aa29+'&data='+JSON['stringify'](_0x8e2865);var _0x3495b0=_0x5d3b3e+'?'+_0xa4def1;return rp(_0x3495b0);})['then'](function(_0x1d8a7a){logger[_0x7c74('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4190d4,_0x1d8a7a);_0x2ceb7f[_0x7c74('0x1b')]();})[_0x7c74('0x1c')](function(_0xb17fbe){logger['error'](_0x7c74('0x1d'),_0x4190d4,_[_0x7c74('0x1e')](_0xb17fbe)?JSON[_0x7c74('0x10')](_0xb17fbe):_0xb17fbe);_0x2ceb7f[_0x7c74('0x1b')]();});}else{logger['info'](_0x7c74('0x1f'),_0x4190d4);_0x2ceb7f[_0x7c74('0x20')]();}};}; \ No newline at end of file +var _0x06e6=['channelId=','&serviceId=','&sessionId=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','?params=','title','jsonrpc','2.0','method','params','stringify','POST','application/json-rpc','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x06e6,0x1be));var _0x606e=function(_0x4a4ff6,_0x2b0de3){_0x4a4ff6=_0x4a4ff6-0x0;var _0x55e8de=_0x06e6[_0x4a4ff6];return _0x55e8de;};'use strict';var rp=require('request-promise');var logger=require(_0x606e('0x0'))('routing');var _=require(_0x606e('0x1'));var arr=[];exports[_0x606e('0x2')]=function(_0x19d2bd,_0x10059d){return function(_0x3db5da){var _0x26c7de=_0x10059d[0xa];var _0x3b825f=_0x10059d[0xb];var _0x24baf8=_0x10059d[0xc];var _0x1caab5=_0x10059d[0xd];var _0x54bef3=_0x10059d[0xe];var _0x115c4f=_0x10059d[0xf][_0x606e('0x3')](/\n/g,_0x606e('0x4'));var _0x3a722a=_0x10059d[0x10][_0x606e('0x3')](/\n/g,'\x20');if(!arr[_0x606e('0x5')](_0x3b825f)){arr[_0x606e('0x6')](_0x3b825f);var _0x1f26ac=_0x10059d[0x3];var _0x174e52=_0x10059d[0x4];var _0x47ad1c=_0x10059d[0x1];var _0xd2836e=_0x10059d[0x0];var _0x2c7a7c={};_0x2c7a7c['urlOnAnswer']=_0x10059d[0x8]+'?params='+_0x24baf8+'|'+_0x26c7de+'|'+_0x1caab5+'|'+_0x3b825f+'|'+_0x54bef3;_0x2c7a7c['urlOnRing']=_0x10059d[0x7]+_0x606e('0x7')+_0x24baf8+'|'+_0x26c7de+'|'+_0x1caab5+'|'+_0x3b825f+'|'+_0x54bef3+'|'+_0x115c4f+'|'+_0x3a722a;_0x2c7a7c[_0x606e('0x8')]=_0x10059d[0x9];var _0x9c718f={};_0x9c718f[_0x606e('0x9')]=_0x606e('0xa');_0x9c718f[_0x606e('0xb')]='login';var _0x273b6e=[];_0x273b6e['push'](_0x10059d[0x2]);_0x273b6e[_0x606e('0x6')](_0x10059d[0x5]);_0x273b6e[_0x606e('0x6')](_0x10059d[0x6]);_0x9c718f[_0x606e('0xc')]=_0x273b6e;_0x9c718f['id']=0x1;var _0x258c9a=JSON[_0x606e('0xd')](_0x9c718f);var _0xa0e1cd={'encoding':'utf8','method':_0x606e('0xe'),'timeout':0x2710,'url':_0x1f26ac,'headers':{'Content-Type':_0x606e('0xf')},'body':_0x258c9a};return rp(_0xa0e1cd)['then'](function(_0x134481){const _0x49a958=JSON['parse'](_0x134481);if(!_0x49a958[_0x606e('0x10')][_0x606e('0x11')]){throw new Error(_0x606e('0x12'));}var _0xdef29d=_0x3b825f;var _0x5257b8=_0x606e('0x13')+_0x47ad1c+_0x606e('0x14')+_0xd2836e+_0x606e('0x15')+_0xdef29d+'&data='+JSON[_0x606e('0xd')](_0x2c7a7c);var _0x4690b1=_0x174e52+'?'+_0x5257b8;return rp(_0x4690b1);})[_0x606e('0x16')](function(_0x40f284){logger['info'](_0x606e('0x17'),_0x19d2bd,_0x40f284);_0x3db5da['stop']();})[_0x606e('0x18')](function(_0x3040ef){logger[_0x606e('0x19')](_0x606e('0x1a'),_0x19d2bd,_[_0x606e('0x1b')](_0x3040ef)?JSON['stringify'](_0x3040ef):_0x3040ef);_0x3db5da[_0x606e('0x1c')]();});}else{logger['info'](_0x606e('0x1d'),_0x19d2bd);_0x3db5da[_0x606e('0x1e')]();}};}; \ 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 5f47fca..0168b88 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x147c05,_0x683801){var _0x5db0b3=function(_0x1471c9){while(--_0x1471c9){_0x147c05['push'](_0x147c05['shift']());}};_0x5db0b3(++_0x683801);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x455ea8,_0x12a5d5){var _0x5891e9=function(_0x5b30d2){while(--_0x5b30d2){_0x455ea8['push'](_0x455ea8['shift']());}};_0x5891e9(++_0x12a5d5);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 93addb4..0aeaa3f 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 _0x5373=['../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','info','stringify','matchPath','emit','complete','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','paused','waiting','mailQueues','available','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport'];(function(_0x3dbccb,_0x126d36){var _0x3e90e7=function(_0x43298f){while(--_0x43298f){_0x3dbccb['push'](_0x3dbccb['shift']());}};_0x3e90e7(++_0x126d36);}(_0x5373,0x127));var _0x3537=function(_0xc301be,_0x593dfb){_0xc301be=_0xc301be-0x0;var _0x4dc076=_0x5373[_0xc301be];return _0x4dc076;};'use strict';var _=require(_0x3537('0x0'));var util=require(_0x3537('0x1'));var path=require(_0x3537('0x2'));var fs=require('fs');var jayson=require(_0x3537('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x3537('0x4'));var logger=require(_0x3537('0x5'))(_0x3537('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3537('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x3537('0x8')),'whatsappQueueReport':require(_0x3537('0x9'))};var RuleEngine=require(_0x3537('0xa'));function getId(_0x38c79b,_0x432577,_0x16c0c4){return util[_0x3537('0xb')]('%s.%s.%s',_0x38c79b,_0x432577||0x0,_0x16c0c4||0x0);}function getIntervals(_0x136f4a,_0x1f7d3b){var _0xe91a9b=[];if(!_[_0x3537('0xc')](_0x1f7d3b[_0x3537('0xd')])&&!_[_0x3537('0xc')](_0x136f4a[_0x1f7d3b[_0x3537('0xd')]])&&!_[_0x3537('0xc')](_0x136f4a[_0x1f7d3b['IntervalId']][_0x3537('0xe')])){_0xe91a9b=_[_0x3537('0xf')](_0x136f4a[_0x1f7d3b[_0x3537('0xd')]]['Intervals'],'interval');}else if(!_[_0x3537('0xc')](_0x1f7d3b[_0x3537('0x10')])){_0xe91a9b=[_0x1f7d3b[_0x3537('0x10')]];}return _0xe91a9b;}exports[_0x3537('0x11')]=function(_0x1ba85f){_0x1ba85f[_0x3537('0x12')]={};return new BPromise(function(_0x2e5d50,_0x1c6dcf){var _0x3a0078={'Start':function(_0x3542be){var _0x3d3bbf=this;return new Promise(function(_0x233518,_0x393e04){if(_0x3542be){try{var _0xd6f1fc=[];var _0x1400c2=getId(_0x3542be[_0x3537('0x13')],_0x3542be['message']?_0x3542be[_0x3537('0x14')]['id']:0x0,_0x3542be[_0x3537('0x15')]?_0x3542be[_0x3537('0x15')]['id']:0x0);var _0x4374b2=sUtils[_0x3537('0x16')](_0x1ba85f,_0x3542be);if(!_0x4374b2&&_0x3542be[_0x3537('0x17')]&&_[_0x3537('0x18')](_0x3542be[_0x3537('0x17')])&&_0x3542be[_0x3537('0x17')][_0x3537('0x19')]){for(var _0x360913=0x0;_0x360913<_0x3542be['applications'][_0x3537('0x19')];_0x360913+=0x1){var _0x4ae6d4=_0x3542be['applications'][_0x360913];if(fs[_0x3537('0x1a')](path['join'](__dirname,'applications',_0x4ae6d4['app']+'.js'))){var _0x11dbb9=[];switch(_0x4ae6d4[_0x3537('0x1b')][_0x3537('0x1c')]()){case _0x3537('0x1d'):var _0x266b6e=_0x4ae6d4[_0x3537('0x1e')][_0x3537('0x1f')](',');if(_0x3542be[_0x3537('0x13')]===_0x3537('0x20')){_0x11dbb9[_0x3537('0x21')](_0x266b6e[0x0]);_0x11dbb9['push'](_0x266b6e[0x1]);_0x11dbb9[_0x3537('0x21')](_0x266b6e['slice'](0x2,_0x266b6e['length'])['join'](','));}else{_0x11dbb9[_0x3537('0x21')](_0x266b6e[0x0]);_0x11dbb9[_0x3537('0x21')](_0x266b6e[_0x3537('0x22')](0x1,_0x266b6e[_0x3537('0x19')])[_0x3537('0x23')](','));}break;case _0x3537('0x24'):var _0x2fdb7a=_0x4ae6d4[_0x3537('0x1e')][_0x3537('0x1f')](',');_0x11dbb9[_0x3537('0x21')](_0x2fdb7a[0x0]);_0x11dbb9[_0x3537('0x21')](_0x2fdb7a[0x1]);_0x11dbb9[_0x3537('0x21')](_0x2fdb7a['slice'](0x2,_0x2fdb7a[_0x3537('0x19')])[_0x3537('0x23')](','));break;case _0x3537('0x25'):var _0x2555ea=_0x4ae6d4[_0x3537('0x1e')][_0x3537('0x1f')](',');_0x11dbb9[_0x3537('0x21')](_0x2555ea[0x0]);_0x11dbb9[_0x3537('0x21')](_0x2555ea[0x1]);_0x11dbb9[_0x3537('0x21')](_0x2555ea[0x2]);_0x11dbb9[_0x3537('0x21')](_0x2555ea[0x3]);_0x11dbb9[_0x3537('0x21')](_0x2555ea['slice'](0x4,_0x2555ea[_0x3537('0x19')])['join'](','));break;case _0x3537('0x26'):var _0x13c93d=_0x4ae6d4[_0x3537('0x1e')][_0x3537('0x1f')](',');_0x11dbb9[_0x3537('0x21')](_0x13c93d[0x0]);_0x11dbb9['push'](_0x13c93d[0x1]);_0x11dbb9[_0x3537('0x21')](_0x13c93d[0x2]);_0x11dbb9[_0x3537('0x21')](_0x13c93d[0x3]);_0x11dbb9[_0x3537('0x21')](_0x13c93d[_0x3537('0x22')](0x4,_0x13c93d['length'])[_0x3537('0x23')](','));break;case _0x3537('0x14'):_0x11dbb9[_0x3537('0x21')](_0x4ae6d4[_0x3537('0x1e')]);break;case _0x3537('0x27'):_0x11dbb9['push'](_0x4ae6d4[_0x3537('0x28')]);_0x11dbb9[_0x3537('0x21')](_0x4ae6d4[_0x3537('0x1e')]);break;case _0x3537('0x29'):var _0x251dd3=utils[_0x3537('0x2a')](_0x3542be[_0x3537('0x2b')][_0x3537('0x2c')],_0x3542be);var _0x2d85bb=_0x4ae6d4[_0x3537('0x1e')][_0x3537('0x1f')](',');_0x11dbb9['push'](_0x2d85bb[0x0]);_0x11dbb9['push'](_0x2d85bb[0x1]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x2]);_0x11dbb9['push'](_0x2d85bb[0x3]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x4]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x5]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x6]);_0x11dbb9['push'](_0x2d85bb[0x7]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x8]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0x9]);_0x11dbb9[_0x3537('0x21')](_0x2d85bb[0xa]);_0x11dbb9['push'](_0x3542be[_0x3537('0x15')]['id']);_0x11dbb9['push'](_0x3542be[_0x3537('0x14')]['id']);_0x11dbb9[_0x3537('0x21')](_0x4ae6d4[_0x3537('0x2d')]);_0x11dbb9[_0x3537('0x21')](_0x3542be[_0x3537('0x15')][_0x3537('0x2e')]);_0x11dbb9['push'](_0x3542be[_0x3537('0x2f')][_0x3537('0x2f')]);_0x11dbb9[_0x3537('0x21')](_0x251dd3);break;default:_0x11dbb9=_[_0x3537('0xc')](_0x4ae6d4[_0x3537('0x1e')])?[]:_0x4ae6d4['appdata']['split'](',');}var _0x34b3f0={'id':util[_0x3537('0xb')]('%s:%s:%s',_0x1400c2,_0x4ae6d4['id'],_0x4ae6d4[_0x3537('0x1b')]),'condition':require(_0x3537('0x30'))[_0x3537('0x31')](_0x1400c2,getIntervals(_0x1ba85f[_0x3537('0x32')],_0x4ae6d4),_0x1ba85f),'consequence':require(_0x3537('0x33')+_0x4ae6d4[_0x3537('0x1b')])[_0x3537('0x34')](_0x1400c2,_0x11dbb9,_0x1ba85f,_0x3542be),'p':_0x4ae6d4[_0x3537('0x35')]||0x0};logger['info'](_0x3537('0x36'),_0x34b3f0['id'],_0x3537('0x37'),getIntervals(_0x1ba85f['intervals'],_0x4ae6d4)['join'](_0x3537('0x38')));_0xd6f1fc['push'](_0x34b3f0);}else{logger[_0x3537('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3537('0x23')](__dirname,_0x3537('0x17'),_0x4ae6d4[_0x3537('0x1b')]+'.js'));}}_0x1ba85f[_0x3537('0x12')][_0x1400c2]=new RuleEngine(_0xd6f1fc);_0x1ba85f[_0x3537('0x12')][_0x1400c2][_0x3537('0x3a')](_0x3542be,function(_0x34ddfe){logger[_0x3537('0x3b')]('Applications\x20executed',JSON[_0x3537('0x3c')](_0x34ddfe[_0x3537('0x3d')]));if(_0x1ba85f[_0x3537('0x12')][_0x1400c2]){_0x1ba85f[_0x3537('0x12')][_0x1400c2][_0x3537('0x3e')](_0x3537('0x3f'));}});return _0x233518({'code':0xc8,'message':_0x3542be});}else{if(_0x4374b2){logger['info'](util[_0x3537('0xb')]('Skipped\x20routing\x20for\x20%s',_0x1400c2));}else{logger[_0x3537('0x3b')]('No\x20applications\x20to\x20execute');}return _0x233518({'code':0xc8,'message':_0x3542be});}}catch(_0xe81f03){logger[_0x3537('0x39')](_0xe81f03['stack']);return _0x393e04(_0x3d3bbf[_0x3537('0x39')](0x1f4,_0xe81f03));}}return _0x393e04(_0x3537('0x40'));});},'AcceptMessage':function(_0x37dddf){var _0x245131=this;return new Promise(function(_0x13bf0f,_0x2f9dea){if(_0x37dddf['agent']&&_0x37dddf[_0x3537('0x41')]['id']){if(_0x1ba85f[_0x3537('0x42')][_0x37dddf[_0x3537('0x41')]['id']]){_0x1ba85f['agents'][_0x37dddf[_0x3537('0x41')]['id']]['busy']=![];_0x1ba85f[_0x3537('0x42')][_0x37dddf[_0x3537('0x41')]['id']][_0x3537('0x43')]=undefined;}}if(_0x37dddf['message']&&_0x37dddf[_0x3537('0x14')]['id']){try{var _0x122f85=getId(_0x37dddf['channel'],_0x37dddf[_0x3537('0x14')]?_0x37dddf[_0x3537('0x14')]['id']:0x0,_0x37dddf[_0x3537('0x15')]?_0x37dddf[_0x3537('0x15')]['id']:0x0);if(_0x1ba85f[_0x3537('0x12')][_0x122f85]){_0x1ba85f[_0x3537('0x12')][_0x122f85][_0x3537('0x3e')](_0x3537('0x44'));if(rpc[_0x37dddf['channel']+'QueueReport']){rpc[_0x37dddf[_0x3537('0x13')]+_0x3537('0x45')][_0x3537('0x46')](_0x122f85,{'UserId':_0x37dddf['message'][_0x3537('0x47')]})['catch'](function(){logger[_0x3537('0x39')](_0x3537('0x48'));});}}return _0x13bf0f({'code':0xc8,'message':_0x37dddf});}catch(_0x2acda0){logger[_0x3537('0x39')](_0x2acda0[_0x3537('0x49')]);return _0x2f9dea(_0x245131[_0x3537('0x39')](0x1f4,_0x2acda0));}}logger[_0x3537('0x39')](_0x3537('0x4a'));return _0x2f9dea(_0x245131[_0x3537('0x39')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x54388b){var _0x488596=this;return new Promise(function(_0x20f2f1,_0x3ebb77){if(_0x54388b[_0x3537('0x41')]&&_0x54388b[_0x3537('0x41')]['id']){try{if(_0x1ba85f[_0x3537('0x42')][_0x54388b[_0x3537('0x41')]['id']]){_0x1ba85f[_0x3537('0x42')][_0x54388b[_0x3537('0x41')]['id']][_0x3537('0x4b')]=![];_0x1ba85f['agents'][_0x54388b[_0x3537('0x41')]['id']][_0x3537('0x43')]=undefined;}return _0x20f2f1({'code':0xc8,'message':_0x54388b});}catch(_0x159cec){logger[_0x3537('0x39')](_0x159cec[_0x3537('0x49')]);return _0x3ebb77(_0x488596[_0x3537('0x39')](0x1f4,_0x159cec));}}logger['error'](_0x3537('0x4a'));return _0x3ebb77(_0x488596[_0x3537('0x39')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1b2c47){var _0x2a5099=this;return new Promise(function(_0x5bb7ac,_0x2d5f82){if(_0x1b2c47['channel']&&_0x1b2c47['interaction']&&_0x1b2c47[_0x3537('0x15')]['id']){try{var _0x329ec5=getId(_0x1b2c47[_0x3537('0x13')],_0x1b2c47[_0x3537('0x14')]?_0x1b2c47['message']['id']:0x0,_0x1b2c47[_0x3537('0x15')]?_0x1b2c47['interaction']['id']:0x0);if(_0x1ba85f[_0x3537('0x12')][_0x329ec5]){_0x1ba85f[_0x3537('0x12')][_0x329ec5][_0x3537('0x3e')]('end');}return _0x5bb7ac({'code':0xc8,'message':_0x1b2c47});}catch(_0x2a9a04){logger[_0x3537('0x39')](_0x2a9a04['stack']);return _0x2d5f82(_0x2a5099[_0x3537('0x39')](0x1f4,_0x2a9a04));}}logger[_0x3537('0x39')]('message\x20is\x20empty');return _0x2d5f82(_0x2a5099[_0x3537('0x39')](0x1f4,_0x3537('0x4a')));});},'AgentCapacity':function(_0x509803){var _0x5aeccb=this;return new Promise(function(_0x206bc7,_0x310758){if(_0x1ba85f['agents'][_0x3537('0x4c')](_0x509803['id'])){for(var _0x743b54 in _0x509803[_0x3537('0x4d')]){if(_0x509803[_0x3537('0x4d')][_0x3537('0x4c')](_0x743b54)){if(_0x1ba85f[_0x3537('0x42')][_0x509803['id']][_0x3537('0x4c')](_0x743b54+'CurrentCapacity')){_0x1ba85f[_0x3537('0x42')][_0x509803['id']][_0x743b54+_0x3537('0x4e')]=parseInt(_0x509803[_0x3537('0x4d')][_0x743b54],0xa);}}}_0x1ba85f['agents'][_0x509803['id']][_0x3537('0x4f')]();return _0x206bc7({'code':0xc8,'message':_0x1ba85f['agents'][_0x509803['id']]});}else{return _0x310758(_0x5aeccb[_0x3537('0x39')](0x1f4,_0x3537('0x50')));}});},'Agents':function(_0x4c6139){return new Promise(function(_0x3a7b64){var _0x537431=_[_0x3537('0x51')](_0x1ba85f['agents']);if(_0x4c6139&&_0x4c6139['id']){var _0x44d58a=_['find'](_0x537431,function(_0x526a56){return _0x526a56['id']===_0x4c6139['id'];});_0x3a7b64(_0x44d58a);}else{_0x3a7b64({'count':_0x537431['length'],'rows':_0x537431});}});},'ChatQueues':function(){return new Promise(function(_0x1aa244){var _0x3587c7=[];for(var _0xbef696 in _0x1ba85f[_0x3537('0x52')]){if(_0x1ba85f[_0x3537('0x52')][_0x3537('0x4c')](_0xbef696)){var _0x3ba2eb=_0x1ba85f[_0x3537('0x52')][_0xbef696];var _0x502587={'id':_0x3ba2eb['id'],'available':_0x3ba2eb['available'],'loggedIn':_0x3ba2eb[_0x3537('0x53')],'name':_0x3ba2eb['name'],'paused':_0x3ba2eb[_0x3537('0x54')],'waiting':_0x3ba2eb[_0x3537('0x55')]};_0x3587c7[_0x3537('0x21')](_0x502587);}}_0x1aa244({'count':_0x3587c7[_0x3537('0x19')],'rows':_0x3587c7});});},'MailQueues':function(){return new Promise(function(_0x51060b){var _0x125f24=[];for(var _0x1cf1ec in _0x1ba85f[_0x3537('0x56')]){if(_0x1ba85f['mailQueues']['hasOwnProperty'](_0x1cf1ec)){var _0x2998d1=_0x1ba85f['mailQueues'][_0x1cf1ec];var _0x555559={'id':_0x2998d1['id'],'available':_0x2998d1[_0x3537('0x57')],'loggedIn':_0x2998d1[_0x3537('0x53')],'name':_0x2998d1['name'],'paused':_0x2998d1[_0x3537('0x54')],'waiting':_0x2998d1[_0x3537('0x55')]};_0x125f24[_0x3537('0x21')](_0x555559);}}_0x51060b({'count':_0x125f24['length'],'rows':_0x125f24});});},'OpenchannelQueues':function(){return new Promise(function(_0x27f9e3){var _0x2d6c3d=[];for(var _0x4235e9 in _0x1ba85f[_0x3537('0x58')]){if(_0x1ba85f['openchannelQueues'][_0x3537('0x4c')](_0x4235e9)){var _0x2af6be=_0x1ba85f[_0x3537('0x58')][_0x4235e9];var _0x92e9d6={'id':_0x2af6be['id'],'available':_0x2af6be[_0x3537('0x57')],'loggedIn':_0x2af6be[_0x3537('0x53')],'name':_0x2af6be[_0x3537('0x59')],'paused':_0x2af6be[_0x3537('0x54')],'waiting':_0x2af6be[_0x3537('0x55')]};_0x2d6c3d[_0x3537('0x21')](_0x92e9d6);}}_0x27f9e3({'count':_0x2d6c3d[_0x3537('0x19')],'rows':_0x2d6c3d});});},'SmsQueues':function(){return new Promise(function(_0x4be16e){var _0x3ccd93=[];for(var _0x2da1ee in _0x1ba85f['smsQueues']){if(_0x1ba85f[_0x3537('0x5a')][_0x3537('0x4c')](_0x2da1ee)){var _0x2a47c7=_0x1ba85f['smsQueues'][_0x2da1ee];var _0x117bca={'id':_0x2a47c7['id'],'available':_0x2a47c7[_0x3537('0x57')],'loggedIn':_0x2a47c7[_0x3537('0x53')],'name':_0x2a47c7[_0x3537('0x59')],'paused':_0x2a47c7[_0x3537('0x54')],'waiting':_0x2a47c7[_0x3537('0x55')]};_0x3ccd93['push'](_0x117bca);}}_0x4be16e({'count':_0x3ccd93['length'],'rows':_0x3ccd93});});},'FaxQueues':function(){return new Promise(function(_0x1b2b13){var _0x57768f=[];for(var _0x4efe75 in _0x1ba85f[_0x3537('0x5b')]){if(_0x1ba85f[_0x3537('0x5b')]['hasOwnProperty'](_0x4efe75)){var _0x100dcf=_0x1ba85f['faxQueues'][_0x4efe75];var _0x52997e={'id':_0x100dcf['id'],'available':_0x100dcf[_0x3537('0x57')],'loggedIn':_0x100dcf['loggedIn'],'name':_0x100dcf[_0x3537('0x59')],'paused':_0x100dcf['paused'],'waiting':_0x100dcf[_0x3537('0x55')]};_0x57768f[_0x3537('0x21')](_0x52997e);}}_0x1b2b13({'count':_0x57768f[_0x3537('0x19')],'rows':_0x57768f});});},'WhatsappQueues':function(){return new Promise(function(_0x49a007){var _0x220b9a=[];for(var _0x4db273 in _0x1ba85f[_0x3537('0x5c')]){if(_0x1ba85f[_0x3537('0x5c')][_0x3537('0x4c')](_0x4db273)){var _0x2e8f60=_0x1ba85f[_0x3537('0x5c')][_0x4db273];var _0x38a87c={'id':_0x2e8f60['id'],'available':_0x2e8f60[_0x3537('0x57')],'loggedIn':_0x2e8f60[_0x3537('0x53')],'name':_0x2e8f60[_0x3537('0x59')],'paused':_0x2e8f60['paused'],'waiting':_0x2e8f60[_0x3537('0x55')]};_0x220b9a[_0x3537('0x21')](_0x38a87c);}}_0x49a007({'count':_0x220b9a[_0x3537('0x19')],'rows':_0x220b9a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x8f2dba){var _0x394aea=_['values'](_0x1ba85f['chatQueuesWaitingInteractions']);_0x8f2dba({'count':_0x394aea[_0x3537('0x19')],'rows':_0x394aea});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4d8722){var _0x388b56=_[_0x3537('0x51')](_0x1ba85f[_0x3537('0x5d')]);_0x4d8722({'count':_0x388b56[_0x3537('0x19')],'rows':_0x388b56});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x233870){var _0x2c007e=_[_0x3537('0x51')](_0x1ba85f[_0x3537('0x5e')]);_0x233870({'count':_0x2c007e['length'],'rows':_0x2c007e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x169693){var _0x18c514=_[_0x3537('0x51')](_0x1ba85f['smsQueuesWaitingInteractions']);_0x169693({'count':_0x18c514[_0x3537('0x19')],'rows':_0x18c514});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3768bc){var _0x53aa18=_[_0x3537('0x51')](_0x1ba85f['faxQueuesWaitingInteractions']);_0x3768bc({'count':_0x53aa18['length'],'rows':_0x53aa18});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3c9937){var _0x1b58ef=_['values'](_0x1ba85f[_0x3537('0x5f')]);_0x3c9937({'count':_0x1b58ef[_0x3537('0x19')],'rows':_0x1b58ef});});}};var _0x48bf0a=jayson[_0x3537('0x60')](_0x3a0078)[_0x3537('0x61')]();_0x48bf0a['on'](_0x3537('0x39'),function(_0x533ddc){logger['error'](JSON[_0x3537('0x3c')](_0x533ddc));return _0x1c6dcf(_0x533ddc);});_0x48bf0a['listen'](0x232c,_0x3537('0x62'),function(){console['log'](_0x3537('0x63'),0x232c);return _0x2e5d50(_0x3537('0x64')+0x232c);});});}; \ No newline at end of file +var _0xb27d=['Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','appdata','split','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb27d,0x1ea));var _0xdb27=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb27d[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xdb27('0x0'));var util=require('util');var path=require(_0xdb27('0x1'));var fs=require('fs');var jayson=require(_0xdb27('0x2'));var BPromise=require(_0xdb27('0x3'));var utils=require('./applications/utils');var sUtils=require(_0xdb27('0x4'));var logger=require(_0xdb27('0x5'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xdb27('0x6')),'chatQueueReport':require(_0xdb27('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xdb27('0x8')),'whatsappQueueReport':require(_0xdb27('0x9'))};var RuleEngine=require(_0xdb27('0xa'));function getId(_0x32c9e4,_0x1adbdf,_0x562e92){return util[_0xdb27('0xb')](_0xdb27('0xc'),_0x32c9e4,_0x1adbdf||0x0,_0x562e92||0x0);}function getIntervals(_0x31adc6,_0x2c7bcc){var _0x2abce0=[];if(!_[_0xdb27('0xd')](_0x2c7bcc[_0xdb27('0xe')])&&!_[_0xdb27('0xd')](_0x31adc6[_0x2c7bcc['IntervalId']])&&!_[_0xdb27('0xd')](_0x31adc6[_0x2c7bcc[_0xdb27('0xe')]][_0xdb27('0xf')])){_0x2abce0=_[_0xdb27('0x10')](_0x31adc6[_0x2c7bcc[_0xdb27('0xe')]][_0xdb27('0xf')],_0xdb27('0x11'));}else if(!_[_0xdb27('0xd')](_0x2c7bcc['interval'])){_0x2abce0=[_0x2c7bcc[_0xdb27('0x11')]];}return _0x2abce0;}exports[_0xdb27('0x12')]=function(_0x8c34e9){_0x8c34e9[_0xdb27('0x13')]={};return new BPromise(function(_0x251663,_0x1e2ed0){var _0x4beab4={'Start':function(_0x712656){var _0xed86b=this;return new Promise(function(_0x1a07ad,_0x261320){if(_0x712656){try{var _0x69d08a=[];var _0x26d964=getId(_0x712656[_0xdb27('0x14')],_0x712656[_0xdb27('0x15')]?_0x712656['message']['id']:0x0,_0x712656[_0xdb27('0x16')]?_0x712656['interaction']['id']:0x0);var _0x1cb055=sUtils[_0xdb27('0x17')](_0x8c34e9,_0x712656);if(!_0x1cb055&&_0x712656[_0xdb27('0x18')]&&_[_0xdb27('0x19')](_0x712656[_0xdb27('0x18')])&&_0x712656[_0xdb27('0x18')][_0xdb27('0x1a')]){for(var _0x285f10=0x0;_0x285f10<_0x712656[_0xdb27('0x18')][_0xdb27('0x1a')];_0x285f10+=0x1){var _0x193ea0=_0x712656[_0xdb27('0x18')][_0x285f10];if(fs[_0xdb27('0x1b')](path['join'](__dirname,'applications',_0x193ea0[_0xdb27('0x1c')]+'.js'))){var _0x573996=[];switch(_0x193ea0['app']['toLowerCase']()){case'autoreply':var _0xc08974=_0x193ea0[_0xdb27('0x1d')][_0xdb27('0x1e')](',');if(_0x712656['channel']==='mail'){_0x573996[_0xdb27('0x1f')](_0xc08974[0x0]);_0x573996[_0xdb27('0x1f')](_0xc08974[0x1]);_0x573996[_0xdb27('0x1f')](_0xc08974[_0xdb27('0x20')](0x2,_0xc08974[_0xdb27('0x1a')])['join'](','));}else{_0x573996[_0xdb27('0x1f')](_0xc08974[0x0]);_0x573996[_0xdb27('0x1f')](_0xc08974[_0xdb27('0x20')](0x1,_0xc08974[_0xdb27('0x1a')])[_0xdb27('0x21')](','));}break;case _0xdb27('0x22'):var _0x1e31f1=_0x193ea0['appdata'][_0xdb27('0x1e')](',');_0x573996[_0xdb27('0x1f')](_0x1e31f1[0x0]);_0x573996[_0xdb27('0x1f')](_0x1e31f1[0x1]);_0x573996[_0xdb27('0x1f')](_0x1e31f1[_0xdb27('0x20')](0x2,_0x1e31f1[_0xdb27('0x1a')])[_0xdb27('0x21')](','));break;case _0xdb27('0x23'):var _0x44ba4a=_0x193ea0[_0xdb27('0x1d')][_0xdb27('0x1e')](',');_0x573996[_0xdb27('0x1f')](_0x44ba4a[0x0]);_0x573996[_0xdb27('0x1f')](_0x44ba4a[0x1]);_0x573996['push'](_0x44ba4a[0x2]);_0x573996['push'](_0x44ba4a[0x3]);_0x573996[_0xdb27('0x1f')](_0x44ba4a[_0xdb27('0x20')](0x4,_0x44ba4a[_0xdb27('0x1a')])[_0xdb27('0x21')](','));break;case _0xdb27('0x24'):var _0x2c216f=_0x193ea0[_0xdb27('0x1d')][_0xdb27('0x1e')](',');_0x573996['push'](_0x2c216f[0x0]);_0x573996[_0xdb27('0x1f')](_0x2c216f[0x1]);_0x573996[_0xdb27('0x1f')](_0x2c216f[0x2]);_0x573996[_0xdb27('0x1f')](_0x2c216f[0x3]);_0x573996['push'](_0x2c216f[_0xdb27('0x20')](0x4,_0x2c216f[_0xdb27('0x1a')])['join'](','));break;case _0xdb27('0x15'):_0x573996[_0xdb27('0x1f')](_0x193ea0[_0xdb27('0x1d')]);break;case _0xdb27('0x25'):_0x573996[_0xdb27('0x1f')](_0x193ea0[_0xdb27('0x26')]);_0x573996[_0xdb27('0x1f')](_0x193ea0['appdata']);break;case _0xdb27('0x27'):var _0x59d32c=utils[_0xdb27('0x28')](_0x712656[_0xdb27('0x29')][_0xdb27('0x2a')],_0x712656);var _0x444406=_0x193ea0['appdata'][_0xdb27('0x1e')](',');_0x573996[_0xdb27('0x1f')](_0x444406[0x0]);_0x573996['push'](_0x444406[0x1]);_0x573996[_0xdb27('0x1f')](_0x444406[0x2]);_0x573996['push'](_0x444406[0x3]);_0x573996[_0xdb27('0x1f')](_0x444406[0x4]);_0x573996['push'](_0x444406[0x5]);_0x573996[_0xdb27('0x1f')](_0x444406[0x6]);_0x573996[_0xdb27('0x1f')](_0x444406[0x7]);_0x573996[_0xdb27('0x1f')](_0x444406[0x8]);_0x573996[_0xdb27('0x1f')](_0x444406[0x9]);_0x573996[_0xdb27('0x1f')](_0x444406[0xa]);_0x573996[_0xdb27('0x1f')](_0x712656['interaction']['id']);_0x573996[_0xdb27('0x1f')](_0x712656[_0xdb27('0x15')]['id']);_0x573996[_0xdb27('0x1f')](_0x193ea0[_0xdb27('0x2b')]);_0x573996[_0xdb27('0x1f')](_0x712656[_0xdb27('0x16')][_0xdb27('0x2c')]);_0x573996[_0xdb27('0x1f')](_0x712656[_0xdb27('0x2d')][_0xdb27('0x2d')]);_0x573996[_0xdb27('0x1f')](_0x59d32c);break;default:_0x573996=_[_0xdb27('0xd')](_0x193ea0['appdata'])?[]:_0x193ea0[_0xdb27('0x1d')][_0xdb27('0x1e')](',');}var _0x52b371={'id':util[_0xdb27('0xb')](_0xdb27('0x2e'),_0x26d964,_0x193ea0['id'],_0x193ea0[_0xdb27('0x1c')]),'condition':require('./interval')['condition'](_0x26d964,getIntervals(_0x8c34e9[_0xdb27('0x2f')],_0x193ea0),_0x8c34e9),'consequence':require(_0xdb27('0x30')+_0x193ea0[_0xdb27('0x1c')])[_0xdb27('0x31')](_0x26d964,_0x573996,_0x8c34e9,_0x712656),'p':_0x193ea0[_0xdb27('0x32')]||0x0};logger['info']('Push\x20new\x20rule',_0x52b371['id'],_0xdb27('0x33'),getIntervals(_0x8c34e9['intervals'],_0x193ea0)[_0xdb27('0x21')](_0xdb27('0x34')));_0x69d08a[_0xdb27('0x1f')](_0x52b371);}else{logger[_0xdb27('0x35')](_0xdb27('0x36'),path[_0xdb27('0x21')](__dirname,'applications',_0x193ea0[_0xdb27('0x1c')]+_0xdb27('0x37')));}}_0x8c34e9[_0xdb27('0x13')][_0x26d964]=new RuleEngine(_0x69d08a);_0x8c34e9[_0xdb27('0x13')][_0x26d964][_0xdb27('0x38')](_0x712656,function(_0x7ea90b){logger[_0xdb27('0x39')](_0xdb27('0x3a'),JSON[_0xdb27('0x3b')](_0x7ea90b[_0xdb27('0x3c')]));if(_0x8c34e9[_0xdb27('0x13')][_0x26d964]){_0x8c34e9['rules'][_0x26d964][_0xdb27('0x3d')](_0xdb27('0x3e'));}});return _0x1a07ad({'code':0xc8,'message':_0x712656});}else{if(_0x1cb055){logger[_0xdb27('0x39')](util[_0xdb27('0xb')](_0xdb27('0x3f'),_0x26d964));}else{logger[_0xdb27('0x39')]('No\x20applications\x20to\x20execute');}return _0x1a07ad({'code':0xc8,'message':_0x712656});}}catch(_0x4c911e){logger[_0xdb27('0x35')](_0x4c911e[_0xdb27('0x40')]);return _0x261320(_0xed86b['error'](0x1f4,_0x4c911e));}}return _0x261320(_0xdb27('0x41'));});},'AcceptMessage':function(_0x380c85){var _0x3be164=this;return new Promise(function(_0xc0711,_0x247f72){if(_0x380c85[_0xdb27('0x42')]&&_0x380c85['agent']['id']){if(_0x8c34e9[_0xdb27('0x43')][_0x380c85[_0xdb27('0x42')]['id']]){_0x8c34e9[_0xdb27('0x43')][_0x380c85[_0xdb27('0x42')]['id']][_0xdb27('0x44')]=![];_0x8c34e9[_0xdb27('0x43')][_0x380c85[_0xdb27('0x42')]['id']]['busyQueue']=undefined;}}if(_0x380c85[_0xdb27('0x15')]&&_0x380c85[_0xdb27('0x15')]['id']){try{var _0x214568=getId(_0x380c85[_0xdb27('0x14')],_0x380c85[_0xdb27('0x15')]?_0x380c85[_0xdb27('0x15')]['id']:0x0,_0x380c85[_0xdb27('0x16')]?_0x380c85[_0xdb27('0x16')]['id']:0x0);if(_0x8c34e9[_0xdb27('0x13')][_0x214568]){_0x8c34e9['rules'][_0x214568][_0xdb27('0x3d')]('end');if(rpc[_0x380c85[_0xdb27('0x14')]+_0xdb27('0x45')]){rpc[_0x380c85['channel']+'QueueReport']['update'](_0x214568,{'UserId':_0x380c85[_0xdb27('0x15')][_0xdb27('0x46')]})[_0xdb27('0x47')](function(){logger[_0xdb27('0x35')](_0xdb27('0x48'));});}}return _0xc0711({'code':0xc8,'message':_0x380c85});}catch(_0x5be871){logger[_0xdb27('0x35')](_0x5be871[_0xdb27('0x40')]);return _0x247f72(_0x3be164[_0xdb27('0x35')](0x1f4,_0x5be871));}}logger[_0xdb27('0x35')](_0xdb27('0x49'));return _0x247f72(_0x3be164[_0xdb27('0x35')](0x1f4,_0xdb27('0x49')));});},'RejectMessage':function(_0xb05000){var _0x5d0029=this;return new Promise(function(_0x270534,_0x287fc5){if(_0xb05000[_0xdb27('0x42')]&&_0xb05000[_0xdb27('0x42')]['id']){try{if(_0x8c34e9[_0xdb27('0x43')][_0xb05000[_0xdb27('0x42')]['id']]){_0x8c34e9[_0xdb27('0x43')][_0xb05000['agent']['id']]['busy']=![];_0x8c34e9['agents'][_0xb05000['agent']['id']][_0xdb27('0x4a')]=undefined;}return _0x270534({'code':0xc8,'message':_0xb05000});}catch(_0xcb866b){logger['error'](_0xcb866b[_0xdb27('0x40')]);return _0x287fc5(_0x5d0029[_0xdb27('0x35')](0x1f4,_0xcb866b));}}logger[_0xdb27('0x35')](_0xdb27('0x49'));return _0x287fc5(_0x5d0029[_0xdb27('0x35')](0x1f4,_0xdb27('0x49')));});},'AbandonInteraction':function(_0x11b90e){var _0x2f75ce=this;return new Promise(function(_0x263ee2,_0x2bc24d){if(_0x11b90e['channel']&&_0x11b90e[_0xdb27('0x16')]&&_0x11b90e[_0xdb27('0x16')]['id']){try{var _0x2fce5d=getId(_0x11b90e[_0xdb27('0x14')],_0x11b90e[_0xdb27('0x15')]?_0x11b90e['message']['id']:0x0,_0x11b90e[_0xdb27('0x16')]?_0x11b90e[_0xdb27('0x16')]['id']:0x0);if(_0x8c34e9[_0xdb27('0x13')][_0x2fce5d]){_0x8c34e9[_0xdb27('0x13')][_0x2fce5d][_0xdb27('0x3d')](_0xdb27('0x4b'));}return _0x263ee2({'code':0xc8,'message':_0x11b90e});}catch(_0x20548d){logger['error'](_0x20548d[_0xdb27('0x40')]);return _0x2bc24d(_0x2f75ce[_0xdb27('0x35')](0x1f4,_0x20548d));}}logger[_0xdb27('0x35')]('message\x20is\x20empty');return _0x2bc24d(_0x2f75ce[_0xdb27('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xfeb9c){var _0xae00ff=this;return new Promise(function(_0x467c8e,_0x3e5e48){if(_0x8c34e9[_0xdb27('0x43')][_0xdb27('0x4c')](_0xfeb9c['id'])){for(var _0x456c29 in _0xfeb9c[_0xdb27('0x4d')]){if(_0xfeb9c[_0xdb27('0x4d')]['hasOwnProperty'](_0x456c29)){if(_0x8c34e9[_0xdb27('0x43')][_0xfeb9c['id']]['hasOwnProperty'](_0x456c29+_0xdb27('0x4e'))){_0x8c34e9[_0xdb27('0x43')][_0xfeb9c['id']][_0x456c29+_0xdb27('0x4e')]=parseInt(_0xfeb9c['capacity'][_0x456c29],0xa);}}}_0x8c34e9[_0xdb27('0x43')][_0xfeb9c['id']][_0xdb27('0x4f')]();return _0x467c8e({'code':0xc8,'message':_0x8c34e9[_0xdb27('0x43')][_0xfeb9c['id']]});}else{return _0x3e5e48(_0xae00ff[_0xdb27('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x239018){return new Promise(function(_0x1398c1){var _0x502215=_[_0xdb27('0x50')](_0x8c34e9[_0xdb27('0x43')]);if(_0x239018&&_0x239018['id']){var _0x1a9fb9=_[_0xdb27('0x51')](_0x502215,function(_0x4f64a0){return _0x4f64a0['id']===_0x239018['id'];});_0x1398c1(_0x1a9fb9);}else{_0x1398c1({'count':_0x502215[_0xdb27('0x1a')],'rows':_0x502215});}});},'ChatQueues':function(){return new Promise(function(_0x3b1faa){var _0x576104=[];for(var _0xd8478d in _0x8c34e9['chatQueues']){if(_0x8c34e9[_0xdb27('0x52')][_0xdb27('0x4c')](_0xd8478d)){var _0x1df329=_0x8c34e9['chatQueues'][_0xd8478d];var _0x526cc0={'id':_0x1df329['id'],'available':_0x1df329[_0xdb27('0x53')],'loggedIn':_0x1df329[_0xdb27('0x54')],'name':_0x1df329['name'],'paused':_0x1df329[_0xdb27('0x55')],'waiting':_0x1df329[_0xdb27('0x56')]};_0x576104[_0xdb27('0x1f')](_0x526cc0);}}_0x3b1faa({'count':_0x576104[_0xdb27('0x1a')],'rows':_0x576104});});},'MailQueues':function(){return new Promise(function(_0x1f12d6){var _0x22f8e1=[];for(var _0x5d1ecc in _0x8c34e9[_0xdb27('0x57')]){if(_0x8c34e9[_0xdb27('0x57')][_0xdb27('0x4c')](_0x5d1ecc)){var _0x503c3a=_0x8c34e9['mailQueues'][_0x5d1ecc];var _0x5489e3={'id':_0x503c3a['id'],'available':_0x503c3a[_0xdb27('0x53')],'loggedIn':_0x503c3a[_0xdb27('0x54')],'name':_0x503c3a[_0xdb27('0x58')],'paused':_0x503c3a[_0xdb27('0x55')],'waiting':_0x503c3a['waiting']};_0x22f8e1[_0xdb27('0x1f')](_0x5489e3);}}_0x1f12d6({'count':_0x22f8e1[_0xdb27('0x1a')],'rows':_0x22f8e1});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a9626){var _0x23b486=[];for(var _0x5e4a04 in _0x8c34e9[_0xdb27('0x59')]){if(_0x8c34e9[_0xdb27('0x59')]['hasOwnProperty'](_0x5e4a04)){var _0x18e3bb=_0x8c34e9[_0xdb27('0x59')][_0x5e4a04];var _0x195089={'id':_0x18e3bb['id'],'available':_0x18e3bb[_0xdb27('0x53')],'loggedIn':_0x18e3bb[_0xdb27('0x54')],'name':_0x18e3bb[_0xdb27('0x58')],'paused':_0x18e3bb['paused'],'waiting':_0x18e3bb['waiting']};_0x23b486['push'](_0x195089);}}_0x5a9626({'count':_0x23b486['length'],'rows':_0x23b486});});},'SmsQueues':function(){return new Promise(function(_0x2d2928){var _0x1c1992=[];for(var _0x254e4f in _0x8c34e9[_0xdb27('0x5a')]){if(_0x8c34e9['smsQueues'][_0xdb27('0x4c')](_0x254e4f)){var _0x28d574=_0x8c34e9['smsQueues'][_0x254e4f];var _0x453040={'id':_0x28d574['id'],'available':_0x28d574[_0xdb27('0x53')],'loggedIn':_0x28d574[_0xdb27('0x54')],'name':_0x28d574[_0xdb27('0x58')],'paused':_0x28d574[_0xdb27('0x55')],'waiting':_0x28d574['waiting']};_0x1c1992['push'](_0x453040);}}_0x2d2928({'count':_0x1c1992[_0xdb27('0x1a')],'rows':_0x1c1992});});},'FaxQueues':function(){return new Promise(function(_0x50b475){var _0x158a83=[];for(var _0xe024ef in _0x8c34e9['faxQueues']){if(_0x8c34e9[_0xdb27('0x5b')][_0xdb27('0x4c')](_0xe024ef)){var _0x5a4864=_0x8c34e9[_0xdb27('0x5b')][_0xe024ef];var _0x1204cb={'id':_0x5a4864['id'],'available':_0x5a4864[_0xdb27('0x53')],'loggedIn':_0x5a4864[_0xdb27('0x54')],'name':_0x5a4864['name'],'paused':_0x5a4864['paused'],'waiting':_0x5a4864[_0xdb27('0x56')]};_0x158a83[_0xdb27('0x1f')](_0x1204cb);}}_0x50b475({'count':_0x158a83[_0xdb27('0x1a')],'rows':_0x158a83});});},'WhatsappQueues':function(){return new Promise(function(_0x494d8b){var _0x5439f4=[];for(var _0x3dbf7d in _0x8c34e9[_0xdb27('0x5c')]){if(_0x8c34e9['whatsappQueues']['hasOwnProperty'](_0x3dbf7d)){var _0x440b08=_0x8c34e9[_0xdb27('0x5c')][_0x3dbf7d];var _0x47627f={'id':_0x440b08['id'],'available':_0x440b08['available'],'loggedIn':_0x440b08[_0xdb27('0x54')],'name':_0x440b08[_0xdb27('0x58')],'paused':_0x440b08[_0xdb27('0x55')],'waiting':_0x440b08[_0xdb27('0x56')]};_0x5439f4['push'](_0x47627f);}}_0x494d8b({'count':_0x5439f4[_0xdb27('0x1a')],'rows':_0x5439f4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x495399){var _0x3acc4f=_[_0xdb27('0x50')](_0x8c34e9[_0xdb27('0x5d')]);_0x495399({'count':_0x3acc4f[_0xdb27('0x1a')],'rows':_0x3acc4f});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x470286){var _0x1b793a=_[_0xdb27('0x50')](_0x8c34e9[_0xdb27('0x5e')]);_0x470286({'count':_0x1b793a[_0xdb27('0x1a')],'rows':_0x1b793a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x8aa17){var _0x2776ca=_[_0xdb27('0x50')](_0x8c34e9[_0xdb27('0x5f')]);_0x8aa17({'count':_0x2776ca[_0xdb27('0x1a')],'rows':_0x2776ca});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x22546a){var _0x35b0bc=_[_0xdb27('0x50')](_0x8c34e9[_0xdb27('0x60')]);_0x22546a({'count':_0x35b0bc['length'],'rows':_0x35b0bc});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x316ce2){var _0x21ddc7=_[_0xdb27('0x50')](_0x8c34e9['faxQueuesWaitingInteractions']);_0x316ce2({'count':_0x21ddc7[_0xdb27('0x1a')],'rows':_0x21ddc7});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3855db){var _0x2ab544=_[_0xdb27('0x50')](_0x8c34e9['whatsappQueuesWaitingInteractions']);_0x3855db({'count':_0x2ab544['length'],'rows':_0x2ab544});});}};var _0x5c2be5=jayson[_0xdb27('0x61')](_0x4beab4)[_0xdb27('0x62')]();_0x5c2be5['on'](_0xdb27('0x35'),function(_0x100b2f){logger[_0xdb27('0x35')](JSON[_0xdb27('0x3b')](_0x100b2f));return _0x1e2ed0(_0x100b2f);});_0x5c2be5[_0xdb27('0x12')](0x232c,'127.0.0.1',function(){console[_0xdb27('0x63')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x251663(_0xdb27('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 958b883..9c3f602 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 _0x893b=['[%s][INTERVAL]\x20%s\x20%s','stack','bluebird','../../../config/logger','client','then','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','true','all','some','join','\x20|\x20','when','log'];(function(_0x527fdc,_0x25b299){var _0x32b620=function(_0x2d3dc6){while(--_0x2d3dc6){_0x527fdc['push'](_0x527fdc['shift']());}};_0x32b620(++_0x25b299);}(_0x893b,0x16a));var _0xb893=function(_0x457b86,_0xda9221){_0x457b86=_0x457b86-0x0;var _0x22295e=_0x893b[_0x457b86];return _0x22295e;};'use strict';var util=require('util');var BPromise=require(_0xb893('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xb893('0x1'))('routing');var client=jayson[_0xb893('0x2')]['http']({'port':0x232a});function request(_0x17e702,_0x5c1d68){return new BPromise(function(_0x235409,_0x58c2cb){return client['request'](_0x17e702,_0x5c1d68)[_0xb893('0x3')](function(_0x207163){if(_0x207163['error']){return _0x58c2cb(_0x207163['error'][_0xb893('0x4')]);}else{return _0x235409(_0x207163[_0xb893('0x5')]);}})[_0xb893('0x6')](function(_0x386dea){return _0x58c2cb(_0x386dea);});});}exports[_0xb893('0x7')]=function(_0x51309e,_0x19109f,_0x12ec3a){return function(_0x2ee4ec){if(_0x12ec3a[_0xb893('0x8')]&&!_0x12ec3a[_0xb893('0x8')][_0x51309e]){logger[_0xb893('0x9')](_0xb893('0xa'),_0x51309e);return _0x2ee4ec[_0xb893('0xb')]();}var _0x334bcf=[];for(var _0x3c8541=0x0;_0x3c8541<_0x19109f[_0xb893('0xc')];_0x3c8541+=0x1){_0x334bcf['push'](request(_0xb893('0xd'),{'command':util[_0xb893('0xe')]('iftime\x20%s',_0x19109f[_0x3c8541])})['then'](function(_0x5278c5){return _0x5278c5&&_0x5278c5['message']&&_0x5278c5['message']['indexOf'](_0xb893('0xf'))>=0x0?!![]:![];})[_0xb893('0x6')](function(_0x3bf3ba){logger['error']('[%s][INTERVAL]\x20%s',_0x51309e,_0x19109f[_0x3c8541]);}));}BPromise[_0xb893('0x10')](_0x334bcf)[_0xb893('0x3')](function(_0x187b29){var _0x595dc4=_[_0xb893('0x11')](_0x187b29);logger[_0xb893('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x51309e,_0x19109f[_0xb893('0x12')](_0xb893('0x13')),_0x595dc4);_0x2ee4ec[_0xb893('0x14')](_0x595dc4);})['catch'](function(_0x4626a2){console[_0xb893('0x15')](_0x4626a2);logger['error'](_0xb893('0x16'),_0x51309e,_0x19109f[_0xb893('0x12')](_0xb893('0x13')),_0x4626a2[_0xb893('0x17')]);_0x2ee4ec[_0xb893('0xb')]();});};}; \ No newline at end of file +var _0xc436=['stack','stop','util','bluebird','jayson/promise','lodash','routing','client','http','request','then','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','true','error','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc436,0xa7));var _0x6c43=function(_0x27a01c,_0x5614d1){_0x27a01c=_0x27a01c-0x0;var _0x479a17=_0xc436[_0x27a01c];return _0x479a17;};'use strict';var util=require(_0x6c43('0x0'));var BPromise=require(_0x6c43('0x1'));var jayson=require(_0x6c43('0x2'));var _=require(_0x6c43('0x3'));var logger=require('../../../config/logger')(_0x6c43('0x4'));var client=jayson[_0x6c43('0x5')][_0x6c43('0x6')]({'port':0x232a});function request(_0x1122d4,_0x5ab7d3){return new BPromise(function(_0x546353,_0x34468a){return client[_0x6c43('0x7')](_0x1122d4,_0x5ab7d3)[_0x6c43('0x8')](function(_0x270d1f){if(_0x270d1f['error']){return _0x34468a(_0x270d1f['error'][_0x6c43('0x9')]);}else{return _0x546353(_0x270d1f[_0x6c43('0xa')]);}})[_0x6c43('0xb')](function(_0x13304a){return _0x34468a(_0x13304a);});});}exports[_0x6c43('0xc')]=function(_0x3edf0e,_0x343ac1,_0x3211c4){return function(_0x8bce75){if(_0x3211c4[_0x6c43('0xd')]&&!_0x3211c4[_0x6c43('0xd')][_0x3edf0e]){logger[_0x6c43('0xe')](_0x6c43('0xf'),_0x3edf0e);return _0x8bce75['stop']();}var _0x20f0b3=[];for(var _0x2ddeb9=0x0;_0x2ddeb9<_0x343ac1[_0x6c43('0x10')];_0x2ddeb9+=0x1){_0x20f0b3[_0x6c43('0x11')](request('Command',{'command':util[_0x6c43('0x12')](_0x6c43('0x13'),_0x343ac1[_0x2ddeb9])})[_0x6c43('0x8')](function(_0x4c16f4){return _0x4c16f4&&_0x4c16f4['message']&&_0x4c16f4['message'][_0x6c43('0x14')](_0x6c43('0x15'))>=0x0?!![]:![];})[_0x6c43('0xb')](function(_0x3bd4a9){logger[_0x6c43('0x16')](_0x6c43('0x17'),_0x3edf0e,_0x343ac1[_0x2ddeb9]);}));}BPromise[_0x6c43('0x18')](_0x20f0b3)[_0x6c43('0x8')](function(_0x50d04d){var _0x2e5bbb=_[_0x6c43('0x19')](_0x50d04d);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x3edf0e,_0x343ac1[_0x6c43('0x1a')](_0x6c43('0x1b')),_0x2e5bbb);_0x8bce75[_0x6c43('0x1c')](_0x2e5bbb);})['catch'](function(_0x4755f1){console[_0x6c43('0x1d')](_0x4755f1);logger[_0x6c43('0x16')](_0x6c43('0x1e'),_0x3edf0e,_0x343ac1[_0x6c43('0x1a')](_0x6c43('0x1b')),_0x4755f1[_0x6c43('0x1f')]);_0x8bce75[_0x6c43('0x20')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 16506e7..d55e5c2 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 _0x6c76=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','info','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','now','lastevent','called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','reason','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere'];(function(_0x20a029,_0x276de7){var _0x3a26df=function(_0x13701c){while(--_0x13701c){_0x20a029['push'](_0x20a029['shift']());}};_0x3a26df(++_0x276de7);}(_0x6c76,0x184));var _0x66c7=function(_0x1f9fb1,_0x7677d0){_0x1f9fb1=_0x1f9fb1-0x0;var _0x3a1784=_0x6c76[_0x1f9fb1];return _0x3a1784;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var utils=require(_0x66c7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x55604c,_0x203e75){utils[_0x66c7('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x55604c[_0x66c7('0x4')],_0x55604c[_0x66c7('0x5')],_0x55604c['queue'],_0x55604c[_0x66c7('0x6')],_0x55604c[_0x66c7('0x7')],_0x55604c['calleridnum'],_0x55604c[_0x66c7('0x8')],_0x55604c['lastevent']));if(_0x55604c['queue']){utils[_0x66c7('0x9')](_0x55604c[_0x66c7('0xa')])[_0x66c7('0xb')](function(_0x53a81c){if(_0x53a81c){_0x55604c[_0x66c7('0xc')]=_0x53a81c[_0x66c7('0xc')];_0x55604c[_0x66c7('0xd')]=_0x55604c[_0x66c7('0xe')]?_0x53a81c['acw']:![];_0x55604c[_0x66c7('0xf')]=_0x55604c[_0x66c7('0xd')]?_0x53a81c[_0x66c7('0x10')]:0x0;}utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);});}else{utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);}if(_0x203e75){delete transfers[_0x55604c['uniqueid']];}else{delete agents[_0x55604c[_0x66c7('0x13')]];}}exports[_0x66c7('0x14')]=function(_0x35cbc2){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2[_0x66c7('0x4')]),_0x35cbc2);agents[_0x35cbc2[_0x66c7('0x13')]]=_0x35cbc2;agents[_0x35cbc2[_0x66c7('0x13')]]['agentcalledAt']=utils[_0x66c7('0x18')]();agents[_0x35cbc2['destuniqueid']][_0x66c7('0x19')]=_0x66c7('0x1a');agents[_0x35cbc2[_0x66c7('0x13')]][_0x66c7('0x8')]=null;agents[_0x35cbc2[_0x66c7('0x13')]]['connectedlinename']=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35cbc2[_0x66c7('0x4')],agents[_0x35cbc2[_0x66c7('0x13')]]['membername'],_0x35cbc2['destuniqueid']));}catch(_0x256b0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2['uniqueid']),_0x256b0a);}};exports['agentringnoanswer']=function(_0x1853b2){try{if(!_[_0x66c7('0x1c')](agents[_0x1853b2[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x1d'),_0x1853b2['uniqueid']),_0x1853b2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1853b2[_0x66c7('0x4')],agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x1853b2[_0x66c7('0x13')]));agents[_0x1853b2['destuniqueid']][_0x66c7('0x1e')]=!![];agents[_0x1853b2[_0x66c7('0x13')]]['agentringnoanswerAt']=utils[_0x66c7('0x18')]();agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x1f');agents[_0x1853b2[_0x66c7('0x13')]]['reason']='timeout';agents[_0x1853b2['destuniqueid']][_0x66c7('0x20')]=_0x1853b2[_0x66c7('0x21')]?parseInt(_0x1853b2['ringtime'])/0x3e8:0x0;agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x22')]=0x0;unanswered[_0x66c7('0x23')](_0x1853b2[_0x66c7('0x13')]);}}catch(_0x36a830){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x1d'),_0x1853b2[_0x66c7('0x4')]),_0x36a830);}};exports[_0x66c7('0x24')]=function(_0x33be23){try{_[_0x66c7('0x25')](agents,function(_0x592f0e,_0x263b48){if(_0x592f0e['uniqueid']==_0x33be23[_0x66c7('0x4')]&&!_['includes'](unanswered,_0x592f0e[_0x66c7('0x13')])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x33be23);utils[_0x66c7('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x33be23[_0x66c7('0x4')],_0x592f0e[_0x66c7('0x6')],_0x592f0e[_0x66c7('0x13')]));_0x592f0e[_0x66c7('0x1e')]=!![];_0x592f0e[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x592f0e[_0x66c7('0x19')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x29')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x20')]=_0x33be23[_0x66c7('0x20')];_0x592f0e['talktime']=0x0;writeDB(_0x592f0e);}});}catch(_0x562283){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x562283);}};exports[_0x66c7('0x2a')]=function(_0x2bf7c2){try{if(agents[_0x2bf7c2[_0x66c7('0x13')]]){utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2[_0x66c7('0x4')]),_0x2bf7c2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x2c'),_0x2bf7c2[_0x66c7('0x4')],agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x2bf7c2[_0x66c7('0x13')]));agents[_0x2bf7c2[_0x66c7('0x13')]]['agentconnectAt']=utils['now']();agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x8')]=_0x2bf7c2[_0x66c7('0x8')];agents[_0x2bf7c2['destuniqueid']]['connectedlinename']=_0x2bf7c2[_0x66c7('0x2d')];agents[_0x2bf7c2[_0x66c7('0x13')]]['holdtime']=_0x2bf7c2[_0x66c7('0x21')];agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x19')]='connect';_[_0x66c7('0x25')](agents,function(_0x16b754,_0x9f6ca8){if(_0x16b754[_0x66c7('0x13')]!=_0x2bf7c2[_0x66c7('0x13')]&&_0x16b754[_0x66c7('0x4')]==_0x2bf7c2[_0x66c7('0x4')]){_0x16b754[_0x66c7('0x22')]=0x0;_0x16b754[_0x66c7('0x20')]=_0x2bf7c2['ringtime'];_0x16b754[_0x66c7('0x1e')]=!![];_0x16b754[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x16b754[_0x66c7('0x19')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x29')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x2f')]=_0x2bf7c2[_0x66c7('0x13')];_0x16b754[_0x66c7('0x30')]=_0x2bf7c2['membername'];writeDB(_0x16b754);}});}}catch(_0x5bb5fc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2['uniqueid']),_0x5bb5fc);}};exports['agentcomplete']=function(_0x34d002){try{if(!_[_0x66c7('0x1c')](agents[_0x34d002[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')]('[%s][agents][agentcomplete]',_0x34d002[_0x66c7('0x4')]),_0x34d002);utils['info'](util['format'](_0x66c7('0x31'),_0x34d002[_0x66c7('0x4')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x6')],_0x34d002['destuniqueid']));agents[_0x34d002['destuniqueid']][_0x66c7('0xe')]=!![];agents[_0x34d002['destuniqueid']]['agentcompleteAt']=utils[_0x66c7('0x18')]();agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x34d002['destuniqueid']][_0x66c7('0x33')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x34')]);agents[_0x34d002['destuniqueid']][_0x66c7('0x29')]=_0x34d002[_0x66c7('0x29')];agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x35');writeDB(agents[_0x34d002[_0x66c7('0x13')]]);}}catch(_0x2e3f06){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x36'),_0x34d002[_0x66c7('0x4')]),_0x2e3f06);}};exports[_0x66c7('0x37')]=function(_0x1386a2){try{if(!_[_0x66c7('0x1c')](agents[_0x1386a2[_0x66c7('0x38')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x39'),_0x1386a2[_0x66c7('0x4')]),_0x1386a2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x3a'),_0x1386a2[_0x66c7('0x4')],agents[_0x1386a2['transfereruniqueid']][_0x66c7('0x6')],agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')]));agents[_0x1386a2[_0x66c7('0x38')]]['transfer']=!![];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3b')]='blind';agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3c')]=_0x1386a2[_0x66c7('0x3d')];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3e')]=agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')];}}catch(_0x5cd4e9){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')]('[%s][agents][blindtransfer]',_0x1386a2[_0x66c7('0x4')]),_0x5cd4e9);}};exports[_0x66c7('0x3f')]=function(_0x3ef4cf){try{utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x3ef4cf);if(_0x3ef4cf[_0x66c7('0x41')]==_0x3ef4cf[_0x66c7('0x42')]){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x43')]])){utils[_0x66c7('0x3')](util['format'](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf['secondtransfereruniqueid']]['transfertype']=_0x66c7('0x46');agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x47')];agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x41')];}if(_0x3ef4cf[_0x66c7('0x48')]&&agents[_0x3ef4cf['transfereeuniqueid']]){agents[_0x3ef4cf['transfereeuniqueid']][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x48')]]=_['clone'](agents[_0x3ef4cf['transfereeuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x48')]]['calleridnum']=agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4b')]=agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x4b')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x34')]=utils['now']();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x48')]]['agententerreason']=0x2;}}else if(_0x3ef4cf[_0x66c7('0x43')]==_0x3ef4cf['secondtransfererlinkedid']){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x41')]])){utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['origtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3b')]='ATTENDED';agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x4d')];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x43')];}if(_0x3ef4cf[_0x66c7('0x4e')]&&agents[_0x3ef4cf[_0x66c7('0x4e')]]){agents[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x4e')]]=_[_0x66c7('0x4f')](agents[_0x3ef4cf['transfertargetuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4a')]=agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4b')]=agents[_0x3ef4cf[_0x66c7('0x41')]]['calleridname'];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x34')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x2;}}}catch(_0x21eb0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x21eb0a);}};exports[_0x66c7('0x50')]=function(_0x5bca99){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x5bca99);if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]===_0x66c7('0x1f')){if(_0x5bca99[_0x66c7('0x52')]==='21'){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=_0x66c7('0x53');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x53');}utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(agents[_0x5bca99['uniqueid']]);var _0x34d4f7=unanswered['indexOf'](_0x5bca99[_0x66c7('0x4')]);if(_0x34d4f7>-0x1){unanswered[_0x66c7('0x54')](_0x34d4f7,0x1);}}if(transfers[_0x5bca99[_0x66c7('0x4')]]){transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](transfers[_0x5bca99[_0x66c7('0x4')]]['agentcompleteAt'],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]='agent';transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]='complete';utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],transfers[_0x5bca99['uniqueid']]['reason'],transfers[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(transfers[_0x5bca99['uniqueid']],!![]);}if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();agents[_0x5bca99['uniqueid']][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x45')]?_0x66c7('0x45'):_0x66c7('0x56');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x35');utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]));writeDB(agents[_0x5bca99[_0x66c7('0x4')]]);}}catch(_0x331acc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x331acc);}}; \ No newline at end of file +var _0x4024=['push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','format','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','then','type','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','reason','ringtime','talktime'];(function(_0x4607df,_0x2417ee){var _0x498af0=function(_0x36f939){while(--_0x36f939){_0x4607df['push'](_0x4607df['shift']());}};_0x498af0(++_0x2417ee);}(_0x4024,0x89));var _0x4402=function(_0x480736,_0x4ef02d){_0x480736=_0x480736-0x0;var _0x1d4b19=_0x4024[_0x480736];return _0x1d4b19;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3074ac,_0x2b36c7){utils['info'](util[_0x4402('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3074ac[_0x4402('0x3')],_0x3074ac[_0x4402('0x4')],_0x3074ac['queue'],_0x3074ac['membername'],_0x3074ac[_0x4402('0x5')],_0x3074ac[_0x4402('0x6')],_0x3074ac[_0x4402('0x7')],_0x3074ac['lastevent']));if(_0x3074ac[_0x4402('0x8')]){utils['getVoiceQueueByName'](_0x3074ac['queue'])[_0x4402('0x9')](function(_0x4c6ca4){if(_0x4c6ca4){_0x3074ac['type']=_0x4c6ca4[_0x4402('0xa')];_0x3074ac['agentacw']=_0x3074ac[_0x4402('0xb')]?_0x4c6ca4['acw']:![];_0x3074ac[_0x4402('0xc')]=_0x3074ac['agentacw']?_0x4c6ca4[_0x4402('0xd')]:0x0;}utils[_0x4402('0xe')]('CreateVoiceAgentReport',_0x3074ac);});}else{utils[_0x4402('0xe')](_0x4402('0xf'),_0x3074ac);}if(_0x2b36c7){delete transfers[_0x3074ac[_0x4402('0x3')]];}else{delete agents[_0x3074ac['destuniqueid']];}}exports[_0x4402('0x10')]=function(_0x34d952){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x12'),_0x34d952[_0x4402('0x3')]),_0x34d952);agents[_0x34d952[_0x4402('0x13')]]=_0x34d952;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x16')]=_0x4402('0x17');agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x7')]=null;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x18')]=null;utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x1a'),_0x34d952['uniqueid'],agents[_0x34d952['destuniqueid']][_0x4402('0x1b')],_0x34d952[_0x4402('0x13')]));}catch(_0x5681c5){utils[_0x4402('0x1c')](util[_0x4402('0x2')]('[%s][agents][agentcalled]',_0x34d952[_0x4402('0x3')]),_0x5681c5);}};exports['agentringnoanswer']=function(_0x55cc8c){try{if(!_[_0x4402('0x1d')](agents[_0x55cc8c[_0x4402('0x13')]])){utils[_0x4402('0x11')](util['format'](_0x4402('0x1e'),_0x55cc8c['uniqueid']),_0x55cc8c);utils['info'](util[_0x4402('0x2')](_0x4402('0x1f'),_0x55cc8c[_0x4402('0x3')],agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x1b')],_0x55cc8c[_0x4402('0x13')]));agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x20')]=!![];agents[_0x55cc8c[_0x4402('0x13')]]['agentringnoanswerAt']=utils[_0x4402('0x15')]();agents[_0x55cc8c['destuniqueid']][_0x4402('0x16')]=_0x4402('0x21');agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x22')]='timeout';agents[_0x55cc8c[_0x4402('0x13')]]['holdtime']=_0x55cc8c['ringtime']?parseInt(_0x55cc8c[_0x4402('0x23')])/0x3e8:0x0;agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x24')]=0x0;unanswered[_0x4402('0x25')](_0x55cc8c[_0x4402('0x13')]);}}catch(_0x514e41){utils[_0x4402('0x1c')](util['format'](_0x4402('0x1e'),_0x55cc8c[_0x4402('0x3')]),_0x514e41);}};exports[_0x4402('0x26')]=function(_0x48d20d){try{_[_0x4402('0x27')](agents,function(_0x6c87f6,_0x316239){if(_0x6c87f6[_0x4402('0x3')]==_0x48d20d[_0x4402('0x3')]&&!_[_0x4402('0x28')](unanswered,_0x6c87f6[_0x4402('0x13')])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x48d20d);utils['info'](util[_0x4402('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x48d20d[_0x4402('0x3')],_0x6c87f6['membername'],_0x6c87f6[_0x4402('0x13')]));_0x6c87f6[_0x4402('0x20')]=!![];_0x6c87f6[_0x4402('0x2a')]=utils[_0x4402('0x15')]();_0x6c87f6[_0x4402('0x16')]='abandoned';_0x6c87f6[_0x4402('0x22')]=_0x4402('0x2b');_0x6c87f6[_0x4402('0x2c')]=_0x48d20d['holdtime'];_0x6c87f6[_0x4402('0x24')]=0x0;writeDB(_0x6c87f6);}});}catch(_0x3383e3){utils['error'](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x3383e3);}};exports[_0x4402('0x2d')]=function(_0x170058){try{if(agents[_0x170058[_0x4402('0x13')]]){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058['uniqueid']),_0x170058);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x2f'),_0x170058['uniqueid'],agents[_0x170058[_0x4402('0x13')]][_0x4402('0x1b')],_0x170058['destuniqueid']));agents[_0x170058['destuniqueid']][_0x4402('0x30')]=utils[_0x4402('0x15')]();agents[_0x170058[_0x4402('0x13')]][_0x4402('0x7')]=_0x170058['connectedlinenum'];agents[_0x170058['destuniqueid']]['connectedlinename']=_0x170058[_0x4402('0x18')];agents[_0x170058[_0x4402('0x13')]][_0x4402('0x2c')]=_0x170058[_0x4402('0x23')];agents[_0x170058['destuniqueid']][_0x4402('0x16')]=_0x4402('0x31');_[_0x4402('0x27')](agents,function(_0x57843d,_0x2b92b7){if(_0x57843d['destuniqueid']!=_0x170058[_0x4402('0x13')]&&_0x57843d[_0x4402('0x3')]==_0x170058['uniqueid']){_0x57843d[_0x4402('0x24')]=0x0;_0x57843d['holdtime']=_0x170058[_0x4402('0x23')];_0x57843d[_0x4402('0x20')]=!![];_0x57843d['agentringnoanswerAt']=utils[_0x4402('0x15')]();_0x57843d[_0x4402('0x16')]=_0x4402('0x32');_0x57843d[_0x4402('0x22')]='answered_elsewhere';_0x57843d['answeredelsewheredestinationuniqueid']=_0x170058[_0x4402('0x13')];_0x57843d['answeredelsewheremembername']=_0x170058[_0x4402('0x1b')];writeDB(_0x57843d);}});}}catch(_0x2a6d78){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058[_0x4402('0x3')]),_0x2a6d78);}};exports[_0x4402('0xb')]=function(_0x390169){try{if(!_[_0x4402('0x1d')](agents[_0x390169[_0x4402('0x13')]])){utils['debug'](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169['uniqueid']),_0x390169);utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x390169[_0x4402('0x3')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x1b')],_0x390169[_0x4402('0x13')]));agents[_0x390169[_0x4402('0x13')]]['agentcomplete']=!![];agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')]=utils[_0x4402('0x15')]();agents[_0x390169[_0x4402('0x13')]][_0x4402('0x24')]=utils[_0x4402('0x35')](agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x30')]);agents[_0x390169[_0x4402('0x13')]]['reason']=_0x390169[_0x4402('0x22')];agents[_0x390169['destuniqueid']][_0x4402('0x16')]=_0x4402('0x36');writeDB(agents[_0x390169['destuniqueid']]);}}catch(_0x82f63a){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169[_0x4402('0x3')]),_0x82f63a);}};exports[_0x4402('0x37')]=function(_0x5b094b){try{if(!_[_0x4402('0x1d')](agents[_0x5b094b[_0x4402('0x38')]])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x5b094b);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x3a'),_0x5b094b['uniqueid'],agents[_0x5b094b['transfereruniqueid']]['membername'],agents[_0x5b094b['transfereruniqueid']][_0x4402('0x3')]));agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3b')]=!![];agents[_0x5b094b[_0x4402('0x38')]]['transfertype']=_0x4402('0x3c');agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3d')]=_0x5b094b[_0x4402('0x3e')];agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3f')]=agents[_0x5b094b[_0x4402('0x38')]]['uniqueid'];}}catch(_0x325b20){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x325b20);}};exports[_0x4402('0x40')]=function(_0x5477fd){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x41'),_0x5477fd[_0x4402('0x42')]),_0x5477fd);if(_0x5477fd[_0x4402('0x42')]==_0x5477fd[_0x4402('0x43')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['secondtransfereruniqueid']])){utils['info'](util[_0x4402('0x2')](_0x4402('0x44'),_0x5477fd[_0x4402('0x42')],agents[_0x5477fd['secondtransfereruniqueid']]['membername']));agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x46')]=_0x4402('0x47');agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x48')];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x42')];}if(_0x5477fd[_0x4402('0x49')]&&agents[_0x5477fd[_0x4402('0x49')]]){agents[_0x5477fd['transfereeuniqueid']][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfereeuniqueid']]=_[_0x4402('0x4b')](agents[_0x5477fd['transfereeuniqueid']]);transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x6')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4c')]=agents[_0x5477fd['secondtransfereruniqueid']][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]]['agentconnectAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4a')]=0x2;}}else if(_0x5477fd[_0x4402('0x45')]==_0x5477fd[_0x4402('0x4d')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['origtransfereruniqueid']])){utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5477fd[_0x4402('0x42')],agents[_0x5477fd[_0x4402('0x42')]]['membername']));agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x46')]='ATTENDED';agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x4e')];agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x45')];}if(_0x5477fd[_0x4402('0x4f')]&&agents[_0x5477fd['transfertargetuniqueid']]){agents[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfertargetuniqueid']]=_['clone'](agents[_0x5477fd[_0x4402('0x4f')]]);transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x42')]]['calleridnum'];transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x4c')]=agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x4f')]]['agentcalledAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x30')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x4f')]]['agententerreason']=0x2;}}}catch(_0x333a72){utils[_0x4402('0x1c')](util['format']('[%s][agents][attendedtransfer]',_0x5477fd[_0x4402('0x42')]),_0x333a72);}};exports['hangup']=function(_0x30569e){try{utils['debug'](util[_0x4402('0x2')](_0x4402('0x50'),_0x30569e[_0x4402('0x3')]),_0x30569e);if(agents[_0x30569e[_0x4402('0x3')]]&&agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]===_0x4402('0x21')){if(_0x30569e[_0x4402('0x51')]==='21'){agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x52');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x52');}utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e['uniqueid']][_0x4402('0x22')],agents[_0x30569e['uniqueid']][_0x4402('0x16')]));writeDB(agents[_0x30569e[_0x4402('0x3')]]);var _0x466755=unanswered[_0x4402('0x53')](_0x30569e['uniqueid']);if(_0x466755>-0x1){unanswered[_0x4402('0x54')](_0x466755,0x1);}}if(transfers[_0x30569e['uniqueid']]){transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0xb')]=!![];transfers[_0x30569e[_0x4402('0x3')]]['agentcompleteAt']=utils[_0x4402('0x15')]();transfers[_0x30569e['uniqueid']][_0x4402('0x24')]=utils[_0x4402('0x35')](transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x55');transfers[_0x30569e['uniqueid']][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],transfers[_0x30569e[_0x4402('0x3')]]['reason'],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]));writeDB(transfers[_0x30569e[_0x4402('0x3')]],!![]);}if(agents[_0x30569e['uniqueid']]&&agents[_0x30569e[_0x4402('0x3')]]['agentconnectAt']){agents[_0x30569e[_0x4402('0x3')]]['agentcomplete']=!![];agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')]=utils['now']();agents[_0x30569e[_0x4402('0x3')]]['talktime']=utils[_0x4402('0x35')](agents[_0x30569e[_0x4402('0x3')]]['agentcompleteAt'],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);agents[_0x30569e['uniqueid']][_0x4402('0x22')]=agents[_0x30569e[_0x4402('0x3')]]['transfer']?_0x4402('0x3b'):_0x4402('0x55');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')],agents[_0x30569e[_0x4402('0x3')]]['lastevent']));writeDB(agents[_0x30569e[_0x4402('0x3')]]);}}catch(_0xc3914e){utils['error'](util[_0x4402('0x2')]('[%s][agents][hangup]',_0x30569e[_0x4402('0x3')]),_0xc3914e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1d43fd3..3c05e71 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 _0x21d0=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','hangup','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','info','format','exten','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','origtransfereruniqueid','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s'];(function(_0x5ca9ef,_0x57d0da){var _0x21b751=function(_0x20d39c){while(--_0x20d39c){_0x5ca9ef['push'](_0x5ca9ef['shift']());}};_0x21b751(++_0x57d0da);}(_0x21d0,0xea));var _0x021d=function(_0x12de23,_0x15cdf8){_0x12de23=_0x12de23-0x0;var _0x5e8507=_0x21d0[_0x12de23];return _0x5e8507;};'use strict';var _=require(_0x021d('0x0'));var util=require(_0x021d('0x1'));var utils=require(_0x021d('0x2'));var dispositions=[_0x021d('0x3'),_0x021d('0x4'),_0x021d('0x4'),'NO\x20ANSWER',_0x021d('0x3'),_0x021d('0x3'),_0x021d('0x5'),_0x021d('0x6'),_0x021d('0x4'),_0x021d('0x4'),'FAILED'];var channels={};function writeDB(_0xc73e8f){utils['info'](util['format'](_0x021d('0x7'),_0xc73e8f[_0x021d('0x8')],_0xc73e8f[_0x021d('0x9')],_0xc73e8f[_0x021d('0xa')],_0xc73e8f[_0x021d('0xb')],_0xc73e8f[_0x021d('0xc')],_0xc73e8f[_0x021d('0xd')],_0xc73e8f[_0x021d('0xe')],_0xc73e8f[_0x021d('0xf')]));if(_0xc73e8f[_0x021d('0x10')]){utils[_0x021d('0x11')](_0xc73e8f[_0x021d('0x10')])[_0x021d('0x12')](function(_0x2af942){if(_0x2af942){_0xc73e8f[_0x021d('0x13')]=_0x2af942['id'];}utils['request'](_0x021d('0x14'),_0xc73e8f);});}else{utils[_0x021d('0x15')](_0x021d('0x14'),_0xc73e8f);}if(channels[_0xc73e8f[_0x021d('0x8')]]){delete channels[_0xc73e8f[_0x021d('0x8')]];}}exports[_0x021d('0x16')]=function(_0x308115){try{utils[_0x021d('0x17')](util['format']('[%s][calls][newchannel]',_0x308115[_0x021d('0x8')]),_0x308115);if(_0x308115[_0x021d('0x8')]==_0x308115[_0x021d('0x18')]&&_0x308115[_0x021d('0x9')]!=_0x021d('0x19')){utils[_0x021d('0x1a')](util[_0x021d('0x1b')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x308115[_0x021d('0x8')],_0x308115['context'],_0x308115[_0x021d('0x1c')]));channels[_0x308115[_0x021d('0x8')]]={'uniqueid':_0x308115[_0x021d('0x8')],'accountcode':_0x308115[_0x021d('0x10')],'source':_0x308115[_0x021d('0xd')],'destination':_0x308115[_0x021d('0x1c')],'destinationcontext':_0x308115['context'],'channel':_0x308115[_0x021d('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x021d('0x3'),'amaflags':_0x021d('0x1d')};}}catch(_0x3481c2){utils[_0x021d('0x1e')](util[_0x021d('0x1b')](_0x021d('0x1f'),_0x308115['uniqueid']),_0x3481c2);}};exports[_0x021d('0x20')]=function(_0x42648b){try{utils['debug'](util['format'](_0x021d('0x21'),_0x42648b[_0x021d('0x8')]),_0x42648b);if(!_[_0x021d('0x22')](channels[_0x42648b[_0x021d('0x8')]])&&_0x42648b[_0x021d('0x23')]==0x6){utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x24'),_0x42648b[_0x021d('0x8')],_0x42648b[_0x021d('0x25')],_0x42648b[_0x021d('0x9')]));if(_[_0x021d('0x22')](channels[_0x42648b['uniqueid']]['systemanswertime'])){channels[_0x42648b[_0x021d('0x8')]][_0x021d('0x26')]=utils['now']();}}else if(!_['isNil'](channels[_0x42648b[_0x021d('0x18')]])&&_0x42648b[_0x021d('0x23')]==0x6&&_0x42648b[_0x021d('0x25')]!=_0x021d('0x27')){utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x28'),_0x42648b[_0x021d('0x8')],_0x42648b[_0x021d('0x18')],_0x42648b[_0x021d('0x25')],_0x42648b[_0x021d('0x9')]));channels[_0x42648b['linkedid']][_0x021d('0x10')]=_0x42648b[_0x021d('0x10')];channels[_0x42648b[_0x021d('0x18')]][_0x021d('0x29')]=_0x42648b[_0x021d('0x9')];if(_[_0x021d('0x22')](channels[_0x42648b[_0x021d('0x18')]][_0x021d('0x2a')])){channels[_0x42648b[_0x021d('0x18')]]['answertime']=utils[_0x021d('0x2b')]();}channels[_0x42648b[_0x021d('0x18')]][_0x021d('0x2c')]=dispositions[_['toNumber'](_0x42648b[_0x021d('0x23')])]||_0x021d('0x5');}}catch(_0x197c34){utils['error'](util[_0x021d('0x1b')]('[%s][calls][newstate]',_0x42648b[_0x021d('0x8')]),_0x197c34);}};exports['hangup']=function(_0x1dfe45){try{if(!_[_0x021d('0x22')](channels[_0x1dfe45[_0x021d('0x8')]])){utils[_0x021d('0x17')](util[_0x021d('0x1b')](_0x021d('0x2d'),_0x1dfe45[_0x021d('0x8')]),_0x1dfe45);if(_[_0x021d('0x22')](channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x2e')])){channels[_0x1dfe45['uniqueid']]['callerid']=_0x1dfe45[_0x021d('0x2f')]+'\x20<'+_0x1dfe45[_0x021d('0xd')]+'>';}utils[_0x021d('0x1a')](util[_0x021d('0x1b')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1dfe45[_0x021d('0x8')],channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x2e')],_0x1dfe45[_0x021d('0x30')]));channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x31')]=utils[_0x021d('0x2b')]();channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x32')]=utils[_0x021d('0x33')](channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x31')],channels[_0x1dfe45['uniqueid']][_0x021d('0x34')]);channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x35')]=channels[_0x1dfe45['uniqueid']][_0x021d('0x2a')]?utils['diffTime'](channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x31')],channels[_0x1dfe45[_0x021d('0x8')]][_0x021d('0x2a')]):0x0;writeDB(channels[_0x1dfe45['uniqueid']]);}}catch(_0xaeec6a){utils[_0x021d('0x1e')](util[_0x021d('0x1b')](_0x021d('0x2d'),_0x1dfe45[_0x021d('0x8')]),_0xaeec6a);}};exports['attendedtransfer']=function(_0x3739f8){try{if(!_[_0x021d('0x22')](channels[_0x3739f8[_0x021d('0x36')]])){utils[_0x021d('0x17')](util[_0x021d('0x1b')](_0x021d('0x37'),_0x3739f8['origtransfereruniqueid']),_0x3739f8);if(channels[_0x3739f8['localtwolinkedid']][_0x021d('0x9')]==_0x3739f8['transfereechannel']){utils['info'](util[_0x021d('0x1b')](_0x021d('0x38'),_0x3739f8['origtransfereruniqueid'],_0x3739f8['localtwolinkedid'],_0x3739f8[_0x021d('0x39')]));channels[_0x3739f8['localtwolinkedid']]['destinationchannel']=_0x3739f8[_0x021d('0x39')];channels[_0x3739f8[_0x021d('0x36')]][_0x021d('0x3a')]='_attended';}else if(channels[_0x3739f8['localtwolinkedid']][_0x021d('0x9')]=_0x3739f8[_0x021d('0x3b')]){utils[_0x021d('0x1a')](util[_0x021d('0x1b')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3739f8['origtransfereruniqueid'],_0x3739f8['localtwolinkedid'],_0x3739f8['origtransfererchannel']));channels[_0x3739f8[_0x021d('0x36')]]['destinationchannel']=_0x3739f8[_0x021d('0x3c')];channels[_0x3739f8[_0x021d('0x36')]]['userfield']=_0x021d('0x3d');}}}catch(_0x35a585){utils[_0x021d('0x1e')](util[_0x021d('0x1b')]('[%s][calls][attendedtransfer]',_0x3739f8[_0x021d('0x3e')]),_0x35a585);}};exports[_0x021d('0x3f')]=function(_0xd94415){try{if(!_[_0x021d('0x22')](channels[_0xd94415['uniqueid']])){utils[_0x021d('0x17')](util[_0x021d('0x1b')](_0x021d('0x40'),_0xd94415[_0x021d('0x8')]),_0xd94415);channels[_0xd94415[_0x021d('0x8')]][_0x021d('0x41')]=utils['now']();utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x42'),_0xd94415[_0x021d('0x8')],channels[_0xd94415[_0x021d('0x8')]]['musiconholdstartAt']));}}catch(_0x1e7c8d){utils[_0x021d('0x1e')](util[_0x021d('0x1b')]('[%s][calls][musiconholdstart]',_0xd94415[_0x021d('0x8')]),_0x1e7c8d);}};exports[_0x021d('0x43')]=function(_0x4b60d4){try{if(!_[_0x021d('0x22')](channels[_0x4b60d4['uniqueid']])){utils[_0x021d('0x17')](util['format'](_0x021d('0x44'),_0x4b60d4['uniqueid']),_0x4b60d4);if(!_['isNil'](channels[_0x4b60d4[_0x021d('0x8')]][_0x021d('0x41')])){channels[_0x4b60d4[_0x021d('0x8')]]['mohtime']+=utils[_0x021d('0x33')](utils[_0x021d('0x2b')](),channels[_0x4b60d4[_0x021d('0x8')]][_0x021d('0x41')]);utils[_0x021d('0x1a')](util[_0x021d('0x1b')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4b60d4[_0x021d('0x8')],channels[_0x4b60d4[_0x021d('0x8')]][_0x021d('0x45')]));delete channels[_0x4b60d4[_0x021d('0x8')]]['musiconholdstartAt'];}}}catch(_0x48ff1a){utils[_0x021d('0x1e')](util[_0x021d('0x1b')](_0x021d('0x44'),_0x4b60d4[_0x021d('0x8')]),_0x48ff1a);}};exports[_0x021d('0x46')]=function(_0x1dbf56){try{if(!_[_0x021d('0x22')](channels[_0x1dbf56[_0x021d('0x8')]])){utils[_0x021d('0x17')](util[_0x021d('0x1b')](_0x021d('0x47'),_0x1dbf56[_0x021d('0x8')]),_0x1dbf56);if(!_['isNil'](_0x1dbf56['variable'][_0x021d('0x48')])){utils[_0x021d('0x1a')](util['format'](_0x021d('0x49'),_0x1dbf56[_0x021d('0x8')],_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x4b')]=_0x1dbf56[_0x021d('0x4a')];}if(!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')]['xmd-phone'])){utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x4d'),_0x1dbf56['uniqueid'],_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x4e')]=_0x1dbf56[_0x021d('0x4a')];channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x2e')]='\x22'+_0x1dbf56['value']+_0x021d('0x4f')+_0x1dbf56[_0x021d('0x4a')]+'>';}if(!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x50')])||!_[_0x021d('0x22')](_0x1dbf56['variable'][_0x021d('0x51')])){utils['info'](util[_0x021d('0x1b')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1dbf56[_0x021d('0x8')],!_['isNil'](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x50')])?_0x021d('0x50'):_0x021d('0x51'),_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x2e')]=_0x1dbf56['value'];}if(!_[_0x021d('0x22')](_0x1dbf56['variable']['xmd-queue'])||!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x52')])){utils[_0x021d('0x1a')](util[_0x021d('0x1b')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1dbf56['uniqueid'],!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x53')])?_0x021d('0x53'):_0x021d('0x52'),_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x54')]=_0x021d('0x55');channels[_0x1dbf56[_0x021d('0x8')]]['lastdata']=_0x1dbf56[_0x021d('0x4a')];channels[_0x1dbf56[_0x021d('0x8')]]['queue']=!![];}if(!_[_0x021d('0x22')](_0x1dbf56['variable'][_0x021d('0x56')])){utils[_0x021d('0x1a')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1dbf56['uniqueid'],_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x57')]=_0x1dbf56['value'];}if(!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x58')])){utils['info'](util[_0x021d('0x1b')](_0x021d('0x59'),_0x1dbf56[_0x021d('0x8')],_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56['uniqueid']]['type']=_0x1dbf56[_0x021d('0x4a')];}if(!_['isNil'](_0x1dbf56['variable']['outboundrouteid'])){utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x5a'),_0x1dbf56[_0x021d('0x8')],_0x1dbf56[_0x021d('0x4a')]));channels[_0x1dbf56['uniqueid']]['routeid']=_0x1dbf56[_0x021d('0x4a')];}if(!_[_0x021d('0x22')](_0x1dbf56[_0x021d('0x4c')][_0x021d('0x5b')])){utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x5c'),_0x1dbf56[_0x021d('0x8')],_0x1dbf56['value']));channels[_0x1dbf56[_0x021d('0x8')]][_0x021d('0x5b')]=_0x1dbf56[_0x021d('0x4a')];}}}catch(_0x3e8b60){utils['error'](util[_0x021d('0x1b')](_0x021d('0x47'),_0x1dbf56[_0x021d('0x8')]),_0x3e8b60);}};exports[_0x021d('0x5d')]=function(_0x474a13){try{if(!_[_0x021d('0x22')](channels[_0x474a13[_0x021d('0x8')]])){utils['debug'](util['format'](_0x021d('0x5e'),_0x474a13[_0x021d('0x8')]),_0x474a13);utils[_0x021d('0x1a')](util[_0x021d('0x1b')](_0x021d('0x5f'),_0x474a13[_0x021d('0x8')],_0x474a13['application'],_0x474a13[_0x021d('0x60')]));if(_0x474a13[_0x021d('0x61')][_0x021d('0x62')]()==_0x021d('0x63')&&_['startsWith'](_0x474a13[_0x021d('0x60')][_0x021d('0x62')](),_0x021d('0x64'))){var _0x5a1a8a=_0x474a13['appdata'][_0x021d('0x65')]('=');var _0x1d09fc=_0x5a1a8a[0x0][_0x021d('0x66')](_0x5a1a8a[0x0][_0x021d('0x67')]('(')+0x1,_0x5a1a8a[0x0][_0x021d('0x67')](')'));var _0x1e06a7=_0x5a1a8a[0x1];channels[_0x474a13[_0x021d('0x8')]][_0x1d09fc]=_0x1e06a7;}if(!_['includes']([_0x021d('0x68'),_0x021d('0x69'),'execif',_0x021d('0x63'),_0x021d('0x6a')],_0x474a13[_0x021d('0x61')]['toLowerCase']())){channels[_0x474a13[_0x021d('0x8')]][_0x021d('0x54')]=_0x474a13[_0x021d('0x61')];channels[_0x474a13[_0x021d('0x8')]][_0x021d('0x6b')]=_0x474a13[_0x021d('0x60')];}}}catch(_0x3041ac){utils[_0x021d('0x1e')](util['format'](_0x021d('0x5e'),_0x474a13[_0x021d('0x8')]),_0x3041ac);}}; \ No newline at end of file +var _0x4f4b=['[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','FAILED','NO\x20ANSWER','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','calleridnum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','debug','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','destinationchannel','disposition','toNumber','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','answertime','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4f4b,0x1a9));var _0xb4f4=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x4f4b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xb4f4('0x0'));var util=require(_0xb4f4('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0xb4f4('0x2'),_0xb4f4('0x2'),'NO\x20ANSWER',_0xb4f4('0x3'),_0xb4f4('0x3'),'ANSWERED',_0xb4f4('0x4'),_0xb4f4('0x2'),'FAILED',_0xb4f4('0x2')];var channels={};function writeDB(_0x4792d6){utils['info'](util[_0xb4f4('0x5')](_0xb4f4('0x6'),_0x4792d6[_0xb4f4('0x7')],_0x4792d6['channel'],_0x4792d6[_0xb4f4('0x8')],_0x4792d6['membername'],_0x4792d6['interface'],_0x4792d6[_0xb4f4('0x9')],_0x4792d6['connectedlinenum'],_0x4792d6[_0xb4f4('0xa')]));if(_0x4792d6[_0xb4f4('0xb')]){utils['getUserByInternal'](_0x4792d6[_0xb4f4('0xb')])[_0xb4f4('0xc')](function(_0x61b472){if(_0x61b472){_0x4792d6[_0xb4f4('0xd')]=_0x61b472['id'];}utils[_0xb4f4('0xe')]('CreateVoiceCallReport',_0x4792d6);});}else{utils[_0xb4f4('0xe')](_0xb4f4('0xf'),_0x4792d6);}if(channels[_0x4792d6[_0xb4f4('0x7')]]){delete channels[_0x4792d6[_0xb4f4('0x7')]];}}exports['newchannel']=function(_0x4474a2){try{utils[_0xb4f4('0x10')](util[_0xb4f4('0x5')]('[%s][calls][newchannel]',_0x4474a2[_0xb4f4('0x7')]),_0x4474a2);if(_0x4474a2['uniqueid']==_0x4474a2['linkedid']&&_0x4474a2[_0xb4f4('0x11')]!=_0xb4f4('0x12')){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x14'),_0x4474a2[_0xb4f4('0x7')],_0x4474a2[_0xb4f4('0x15')],_0x4474a2[_0xb4f4('0x16')]));channels[_0x4474a2['uniqueid']]={'uniqueid':_0x4474a2[_0xb4f4('0x7')],'accountcode':_0x4474a2[_0xb4f4('0xb')],'source':_0x4474a2[_0xb4f4('0x9')],'destination':_0x4474a2['exten'],'destinationcontext':_0x4474a2['context'],'channel':_0x4474a2['channel'],'starttime':utils[_0xb4f4('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb4f4('0x3'),'amaflags':_0xb4f4('0x18')};}}catch(_0x509961){utils['error'](util[_0xb4f4('0x5')](_0xb4f4('0x19'),_0x4474a2[_0xb4f4('0x7')]),_0x509961);}};exports[_0xb4f4('0x1a')]=function(_0x5a6561){try{utils[_0xb4f4('0x10')](util[_0xb4f4('0x5')](_0xb4f4('0x1b'),_0x5a6561['uniqueid']),_0x5a6561);if(!_[_0xb4f4('0x1c')](channels[_0x5a6561[_0xb4f4('0x7')]])&&_0x5a6561[_0xb4f4('0x1d')]==0x6){utils['info'](util['format'](_0xb4f4('0x1e'),_0x5a6561[_0xb4f4('0x7')],_0x5a6561[_0xb4f4('0x15')],_0x5a6561[_0xb4f4('0x11')]));if(_[_0xb4f4('0x1c')](channels[_0x5a6561['uniqueid']][_0xb4f4('0x1f')])){channels[_0x5a6561[_0xb4f4('0x7')]]['systemanswertime']=utils[_0xb4f4('0x17')]();}}else if(!_[_0xb4f4('0x1c')](channels[_0x5a6561[_0xb4f4('0x20')]])&&_0x5a6561[_0xb4f4('0x1d')]==0x6&&_0x5a6561['context']!='transfer'){utils[_0xb4f4('0x13')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5a6561[_0xb4f4('0x7')],_0x5a6561[_0xb4f4('0x20')],_0x5a6561['context'],_0x5a6561['channel']));channels[_0x5a6561['linkedid']][_0xb4f4('0xb')]=_0x5a6561['accountcode'];channels[_0x5a6561['linkedid']][_0xb4f4('0x21')]=_0x5a6561[_0xb4f4('0x11')];if(_[_0xb4f4('0x1c')](channels[_0x5a6561['linkedid']]['answertime'])){channels[_0x5a6561[_0xb4f4('0x20')]]['answertime']=utils[_0xb4f4('0x17')]();}channels[_0x5a6561[_0xb4f4('0x20')]][_0xb4f4('0x22')]=dispositions[_[_0xb4f4('0x23')](_0x5a6561[_0xb4f4('0x1d')])]||_0xb4f4('0x24');}}catch(_0x3e9da1){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')]('[%s][calls][newstate]',_0x5a6561['uniqueid']),_0x3e9da1);}};exports[_0xb4f4('0x26')]=function(_0x89d667){try{if(!_[_0xb4f4('0x1c')](channels[_0x89d667['uniqueid']])){utils[_0xb4f4('0x10')](util[_0xb4f4('0x5')](_0xb4f4('0x27'),_0x89d667[_0xb4f4('0x7')]),_0x89d667);if(_[_0xb4f4('0x1c')](channels[_0x89d667['uniqueid']][_0xb4f4('0x28')])){channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x28')]=_0x89d667[_0xb4f4('0x29')]+'\x20<'+_0x89d667[_0xb4f4('0x9')]+'>';}utils['info'](util['format'](_0xb4f4('0x2a'),_0x89d667[_0xb4f4('0x7')],channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x28')],_0x89d667[_0xb4f4('0x2b')]));channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x2c')]=utils['now']();channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x2d')]=utils['diffTime'](channels[_0x89d667[_0xb4f4('0x7')]]['endtime'],channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x2e')]);channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x2f')]=channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x30')]?utils[_0xb4f4('0x31')](channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x2c')],channels[_0x89d667[_0xb4f4('0x7')]][_0xb4f4('0x30')]):0x0;writeDB(channels[_0x89d667[_0xb4f4('0x7')]]);}}catch(_0x558149){utils['error'](util[_0xb4f4('0x5')]('[%s][calls][hangup]',_0x89d667[_0xb4f4('0x7')]),_0x558149);}};exports[_0xb4f4('0x32')]=function(_0x35da02){try{if(!_[_0xb4f4('0x1c')](channels[_0x35da02[_0xb4f4('0x33')]])){utils[_0xb4f4('0x10')](util[_0xb4f4('0x5')](_0xb4f4('0x34'),_0x35da02[_0xb4f4('0x35')]),_0x35da02);if(channels[_0x35da02[_0xb4f4('0x33')]][_0xb4f4('0x11')]==_0x35da02[_0xb4f4('0x36')]){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x37'),_0x35da02['origtransfereruniqueid'],_0x35da02['localtwolinkedid'],_0x35da02['secondtransfererchannel']));channels[_0x35da02[_0xb4f4('0x33')]][_0xb4f4('0x21')]=_0x35da02['secondtransfererchannel'];channels[_0x35da02[_0xb4f4('0x33')]]['userfield']='_attended';}else if(channels[_0x35da02['localtwolinkedid']][_0xb4f4('0x11')]=_0x35da02[_0xb4f4('0x38')]){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x37'),_0x35da02['origtransfereruniqueid'],_0x35da02[_0xb4f4('0x33')],_0x35da02['origtransfererchannel']));channels[_0x35da02[_0xb4f4('0x33')]][_0xb4f4('0x21')]=_0x35da02[_0xb4f4('0x39')];channels[_0x35da02[_0xb4f4('0x33')]][_0xb4f4('0x3a')]=_0xb4f4('0x3b');}}}catch(_0x33ad94){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')](_0xb4f4('0x34'),_0x35da02[_0xb4f4('0x35')]),_0x33ad94);}};exports[_0xb4f4('0x3c')]=function(_0x3565c4){try{if(!_[_0xb4f4('0x1c')](channels[_0x3565c4['uniqueid']])){utils['debug'](util['format'](_0xb4f4('0x3d'),_0x3565c4[_0xb4f4('0x7')]),_0x3565c4);channels[_0x3565c4[_0xb4f4('0x7')]][_0xb4f4('0x3e')]=utils[_0xb4f4('0x17')]();utils['info'](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3565c4[_0xb4f4('0x7')],channels[_0x3565c4['uniqueid']]['musiconholdstartAt']));}}catch(_0x491716){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')](_0xb4f4('0x3d'),_0x3565c4[_0xb4f4('0x7')]),_0x491716);}};exports[_0xb4f4('0x3f')]=function(_0x1c3851){try{if(!_[_0xb4f4('0x1c')](channels[_0x1c3851['uniqueid']])){utils['debug'](util[_0xb4f4('0x5')](_0xb4f4('0x40'),_0x1c3851['uniqueid']),_0x1c3851);if(!_[_0xb4f4('0x1c')](channels[_0x1c3851['uniqueid']][_0xb4f4('0x3e')])){channels[_0x1c3851[_0xb4f4('0x7')]][_0xb4f4('0x41')]+=utils[_0xb4f4('0x31')](utils[_0xb4f4('0x17')](),channels[_0x1c3851[_0xb4f4('0x7')]][_0xb4f4('0x3e')]);utils[_0xb4f4('0x13')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1c3851['uniqueid'],channels[_0x1c3851['uniqueid']][_0xb4f4('0x41')]));delete channels[_0x1c3851[_0xb4f4('0x7')]][_0xb4f4('0x3e')];}}}catch(_0x5031a){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')](_0xb4f4('0x40'),_0x1c3851['uniqueid']),_0x5031a);}};exports[_0xb4f4('0x42')]=function(_0x3fe3b6){try{if(!_[_0xb4f4('0x1c')](channels[_0x3fe3b6[_0xb4f4('0x7')]])){utils['debug'](util[_0xb4f4('0x5')](_0xb4f4('0x43'),_0x3fe3b6[_0xb4f4('0x7')]),_0x3fe3b6);if(!_[_0xb4f4('0x1c')](_0x3fe3b6[_0xb4f4('0x44')]['xmd-originatecalleridnum'])){utils[_0xb4f4('0x13')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3fe3b6[_0xb4f4('0x7')],_0x3fe3b6['value']));channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x45')]=_0x3fe3b6['value'];}if(!_[_0xb4f4('0x1c')](_0x3fe3b6['variable']['xmd-phone'])){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x46'),_0x3fe3b6[_0xb4f4('0x7')],_0x3fe3b6[_0xb4f4('0x47')]));channels[_0x3fe3b6[_0xb4f4('0x7')]]['destination']=_0x3fe3b6[_0xb4f4('0x47')];channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x28')]='\x22'+_0x3fe3b6[_0xb4f4('0x47')]+_0xb4f4('0x48')+_0x3fe3b6[_0xb4f4('0x47')]+'>';}if(!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')]['xmd-callerid-preview'])||!_[_0xb4f4('0x1c')](_0x3fe3b6['variable']['xmd-callerid'])){utils['info'](util[_0xb4f4('0x5')](_0xb4f4('0x49'),_0x3fe3b6[_0xb4f4('0x7')],!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')][_0xb4f4('0x4a')])?_0xb4f4('0x4a'):_0xb4f4('0x4b'),_0x3fe3b6[_0xb4f4('0x47')]));channels[_0x3fe3b6[_0xb4f4('0x7')]]['callerid']=_0x3fe3b6[_0xb4f4('0x47')];}if(!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')]['xmd-queue'])||!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')][_0xb4f4('0x4c')])){utils[_0xb4f4('0x13')](util['format'](_0xb4f4('0x49'),_0x3fe3b6[_0xb4f4('0x7')],!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')]['xmd-queue'])?_0xb4f4('0x4d'):_0xb4f4('0x4c'),_0x3fe3b6[_0xb4f4('0x47')]));channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x4e')]=_0xb4f4('0x4f');channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x50')]=_0x3fe3b6['value'];channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x8')]=!![];}if(!_['isNil'](_0x3fe3b6[_0xb4f4('0x44')][_0xb4f4('0x51')])){utils['info'](util[_0xb4f4('0x5')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3fe3b6[_0xb4f4('0x7')],_0x3fe3b6['value']));channels[_0x3fe3b6['uniqueid']][_0xb4f4('0x52')]=_0x3fe3b6[_0xb4f4('0x47')];}if(!_[_0xb4f4('0x1c')](_0x3fe3b6[_0xb4f4('0x44')]['xmd-cdrtype'])){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x53'),_0x3fe3b6['uniqueid'],_0x3fe3b6['value']));channels[_0x3fe3b6['uniqueid']][_0xb4f4('0x54')]=_0x3fe3b6[_0xb4f4('0x47')];}if(!_[_0xb4f4('0x1c')](_0x3fe3b6[_0xb4f4('0x44')]['outboundrouteid'])){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')](_0xb4f4('0x55'),_0x3fe3b6[_0xb4f4('0x7')],_0x3fe3b6[_0xb4f4('0x47')]));channels[_0x3fe3b6[_0xb4f4('0x7')]][_0xb4f4('0x56')]=_0x3fe3b6[_0xb4f4('0x47')];}if(!_[_0xb4f4('0x1c')](_0x3fe3b6[_0xb4f4('0x44')][_0xb4f4('0x57')])){utils[_0xb4f4('0x13')](util[_0xb4f4('0x5')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3fe3b6['uniqueid'],_0x3fe3b6[_0xb4f4('0x47')]));channels[_0x3fe3b6['uniqueid']][_0xb4f4('0x57')]=_0x3fe3b6[_0xb4f4('0x47')];}}}catch(_0x3a74ed){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')](_0xb4f4('0x43'),_0x3fe3b6[_0xb4f4('0x7')]),_0x3a74ed);}};exports[_0xb4f4('0x58')]=function(_0x2b92f8){try{if(!_[_0xb4f4('0x1c')](channels[_0x2b92f8[_0xb4f4('0x7')]])){utils['debug'](util[_0xb4f4('0x5')](_0xb4f4('0x59'),_0x2b92f8[_0xb4f4('0x7')]),_0x2b92f8);utils[_0xb4f4('0x13')](util['format'](_0xb4f4('0x5a'),_0x2b92f8[_0xb4f4('0x7')],_0x2b92f8[_0xb4f4('0x5b')],_0x2b92f8[_0xb4f4('0x5c')]));if(_0x2b92f8[_0xb4f4('0x5b')]['toLowerCase']()==_0xb4f4('0x5d')&&_[_0xb4f4('0x5e')](_0x2b92f8[_0xb4f4('0x5c')][_0xb4f4('0x5f')](),_0xb4f4('0x60'))){var _0x23f47c=_0x2b92f8['appdata'][_0xb4f4('0x61')]('=');var _0x5e433f=_0x23f47c[0x0]['substring'](_0x23f47c[0x0][_0xb4f4('0x62')]('(')+0x1,_0x23f47c[0x0]['lastIndexOf'](')'));var _0x2fa015=_0x23f47c[0x1];channels[_0x2b92f8[_0xb4f4('0x7')]][_0x5e433f]=_0x2fa015;}if(!_[_0xb4f4('0x63')]([_0xb4f4('0x26'),_0xb4f4('0x64'),_0xb4f4('0x65'),_0xb4f4('0x5d'),_0xb4f4('0x66')],_0x2b92f8[_0xb4f4('0x5b')][_0xb4f4('0x5f')]())){channels[_0x2b92f8['uniqueid']][_0xb4f4('0x4e')]=_0x2b92f8[_0xb4f4('0x5b')];channels[_0x2b92f8['uniqueid']][_0xb4f4('0x50')]=_0x2b92f8[_0xb4f4('0x5c')];}}}catch(_0x3779b8){utils[_0xb4f4('0x25')](util[_0xb4f4('0x5')]('[%s][calls][newexten]',_0x2b92f8[_0xb4f4('0x7')]),_0x3779b8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 209fb3e..74385ee 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 _0xbaad=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xbaad,0x1e6));var _0xdbaa=function(_0x9fc744,_0x1b45b1){_0x9fc744=_0x9fc744-0x0;var _0xc02994=_0xbaad[_0x9fc744];return _0xc02994;};'use strict';var utils=require(_0xdbaa('0x0'));exports[_0xdbaa('0x1')]=function(){utils[_0xdbaa('0x2')](_0xdbaa('0x3'));};exports[_0xdbaa('0x4')]=function(){utils[_0xdbaa('0x2')](_0xdbaa('0x5'));};exports[_0xdbaa('0x6')]=function(){utils[_0xdbaa('0x2')](_0xdbaa('0x7'));};exports[_0xdbaa('0x8')]=function(_0x2c256d){utils[_0xdbaa('0x8')](_0xdbaa('0x9'),_0x2c256d);};exports[_0xdbaa('0xa')]=function(){utils['info'](_0xdbaa('0xb'));};exports['managerevent']=function(_0x41ab05){}; \ No newline at end of file +var _0x1541=['[core]\x20connected','shutdown','info','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1541,0x1a3));var _0x1154=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x1541[_0x15bc81];return _0x59440e;};'use strict';var utils=require('./utils');exports[_0x1154('0x0')]=function(){utils['info'](_0x1154('0x1'));};exports[_0x1154('0x2')]=function(){utils[_0x1154('0x3')]('[core]\x20shutdown');};exports[_0x1154('0x4')]=function(){utils[_0x1154('0x3')](_0x1154('0x5'));};exports['error']=function(_0x35a38a){utils[_0x1154('0x6')](_0x1154('0x7'),_0x35a38a);};exports[_0x1154('0x8')]=function(){utils[_0x1154('0x3')]('[core]\x20close');};exports[_0x1154('0x9')]=function(_0x1b1978){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ff1d552..e387d6d 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 _0xb1dd=['application','toLowerCase','set','appdata','split','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','diffTime','endtime','answertime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x2902e8,_0x348a67){var _0x386eaf=function(_0x6a9274){while(--_0x6a9274){_0x2902e8['push'](_0x2902e8['shift']());}};_0x386eaf(++_0x348a67);}(_0xb1dd,0x13a));var _0xdb1d=function(_0x3c0b5a,_0x564efb){_0x3c0b5a=_0x3c0b5a-0x0;var _0x4f70e5=_0xb1dd[_0x3c0b5a];return _0x4f70e5;};'use strict';var _=require('lodash');var util=require(_0xdb1d('0x0'));var utils=require(_0xdb1d('0x1'));var dials={};function writeDB(_0x543ddc){utils[_0xdb1d('0x2')](util[_0xdb1d('0x3')](_0xdb1d('0x4'),_0x543ddc['uniqueid'],_0x543ddc[_0xdb1d('0x5')],_0x543ddc[_0xdb1d('0x6')],_0x543ddc[_0xdb1d('0x7')],_0x543ddc[_0xdb1d('0x8')],_0x543ddc[_0xdb1d('0x9')]));utils[_0xdb1d('0xa')]('CreateVoiceDialReport',_0x543ddc);delete dials[_0x543ddc[_0xdb1d('0xb')]];}exports['newexten']=function(_0x4c7363){try{utils[_0xdb1d('0xc')](util[_0xdb1d('0x3')](_0xdb1d('0xd'),_0x4c7363[_0xdb1d('0xb')]),_0x4c7363);utils[_0xdb1d('0x2')](util['format'](_0xdb1d('0xe'),_0x4c7363[_0xdb1d('0xb')],_0x4c7363[_0xdb1d('0xf')],_0x4c7363['appdata']));if(_0x4c7363[_0xdb1d('0xf')][_0xdb1d('0x10')]()==_0xdb1d('0x11')&&_['startsWith'](_0x4c7363[_0xdb1d('0x12')][_0xdb1d('0x10')](),'cdr(routeid)')){var _0x5bc12d=_0x4c7363['appdata'][_0xdb1d('0x13')]('=');dials[_0x4c7363['uniqueid']]={'routeId':_0x5bc12d[0x1]};}}catch(_0x103717){utils['error'](util[_0xdb1d('0x3')](_0xdb1d('0xd'),_0x4c7363[_0xdb1d('0xb')]),_0x103717);}};exports[_0xdb1d('0x14')]=function(_0x335c1a){try{utils[_0xdb1d('0xc')](util[_0xdb1d('0x3')]('[%s][dials][varset]',_0x335c1a[_0xdb1d('0xb')]),_0x335c1a);if(!_[_0xdb1d('0x15')](_0x335c1a[_0xdb1d('0x16')][_0xdb1d('0x17')])){utils['info'](util[_0xdb1d('0x3')](_0xdb1d('0x18'),_0x335c1a['uniqueid'],_0x335c1a[_0xdb1d('0x19')]));dials[_0x335c1a[_0xdb1d('0xb')]]={'routeId':_0x335c1a['value']};}}catch(_0x434a2c){utils[_0xdb1d('0x1a')](util[_0xdb1d('0x3')](_0xdb1d('0x1b'),_0x335c1a['uniqueid']),_0x434a2c);}};exports[_0xdb1d('0x1c')]=function(_0x4da1b6){try{if(!_[_0xdb1d('0x15')](dials[_0x4da1b6[_0xdb1d('0xb')]])){utils['debug'](util[_0xdb1d('0x3')]('[%s][dials][dialbegin]',_0x4da1b6[_0xdb1d('0xb')]),_0x4da1b6);dials[_0x4da1b6[_0xdb1d('0xb')]]=_[_0xdb1d('0x1d')](dials[_0x4da1b6[_0xdb1d('0xb')]],_0x4da1b6);dials[_0x4da1b6[_0xdb1d('0xb')]][_0xdb1d('0x1e')]=utils[_0xdb1d('0x1f')]();dials[_0x4da1b6[_0xdb1d('0xb')]][_0xdb1d('0x20')]='called';utils['info'](util[_0xdb1d('0x3')](_0xdb1d('0x21'),_0x4da1b6['uniqueid'],dials[_0x4da1b6[_0xdb1d('0xb')]][_0xdb1d('0x1e')]));}}catch(_0x58db12){utils['error'](util[_0xdb1d('0x3')]('[%s][dials][dialbegin]',_0x4da1b6['uniqueid']),_0x58db12);}};exports[_0xdb1d('0x22')]=function(_0x3b92c1){try{if(!_[_0xdb1d('0x15')](dials[_0x3b92c1[_0xdb1d('0xb')]])){utils[_0xdb1d('0xc')](util['format']('[%s][dials][dialend]',_0x3b92c1[_0xdb1d('0xb')]),_0x3b92c1);dials[_0x3b92c1[_0xdb1d('0xb')]][_0xdb1d('0x9')]=_0x3b92c1[_0xdb1d('0x9')];if(_0x3b92c1[_0xdb1d('0x9')]=='ANSWER'){dials[_0x3b92c1[_0xdb1d('0xb')]]=_['assign'](dials[_0x3b92c1[_0xdb1d('0xb')]],_0x3b92c1);dials[_0x3b92c1[_0xdb1d('0xb')]]['answertime']=utils[_0xdb1d('0x1f')]();dials[_0x3b92c1[_0xdb1d('0xb')]][_0xdb1d('0x20')]=_0xdb1d('0x23');utils['info'](util[_0xdb1d('0x3')](_0xdb1d('0x24'),_0x3b92c1[_0xdb1d('0xb')],_0x3b92c1['dialstatus'],dials[_0x3b92c1['uniqueid']]['answertime']));}else{utils[_0xdb1d('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x3b92c1[_0xdb1d('0xb')],_0x3b92c1[_0xdb1d('0x9')]));}}}catch(_0x311cff){utils[_0xdb1d('0x1a')](util[_0xdb1d('0x3')](_0xdb1d('0x25'),_0x3b92c1[_0xdb1d('0xb')]),_0x311cff);}};exports[_0xdb1d('0x26')]=function(_0x2fe296){try{if(!_[_0xdb1d('0x15')](dials[_0x2fe296[_0xdb1d('0xb')]])){utils[_0xdb1d('0xc')](util[_0xdb1d('0x3')](_0xdb1d('0x27'),_0x2fe296[_0xdb1d('0xb')]),_0x2fe296);utils[_0xdb1d('0x2')](util[_0xdb1d('0x3')](_0xdb1d('0x28'),_0x2fe296[_0xdb1d('0xb')],_0x2fe296[_0xdb1d('0x7')],_0x2fe296['calleridname'],_0x2fe296[_0xdb1d('0x29')]));dials[_0x2fe296[_0xdb1d('0xb')]]=_[_0xdb1d('0x1d')](dials[_0x2fe296[_0xdb1d('0xb')]],{'endtime':utils[_0xdb1d('0x1f')](),'lastevent':_0xdb1d('0x2a')});dials[_0x2fe296[_0xdb1d('0xb')]]['duration']=utils[_0xdb1d('0x2b')](dials[_0x2fe296[_0xdb1d('0xb')]][_0xdb1d('0x2c')],dials[_0x2fe296['uniqueid']][_0xdb1d('0x1e')]);dials[_0x2fe296[_0xdb1d('0xb')]]['holdtime']=utils['diffTime'](dials[_0x2fe296['uniqueid']][_0xdb1d('0x2d')]||dials[_0x2fe296[_0xdb1d('0xb')]]['endtime'],dials[_0x2fe296[_0xdb1d('0xb')]][_0xdb1d('0x1e')]);dials[_0x2fe296[_0xdb1d('0xb')]][_0xdb1d('0x2e')]=dials[_0x2fe296['uniqueid']][_0xdb1d('0x2d')]?utils[_0xdb1d('0x2b')](dials[_0x2fe296[_0xdb1d('0xb')]]['endtime'],dials[_0x2fe296[_0xdb1d('0xb')]][_0xdb1d('0x2d')]):0x0;writeDB(dials[_0x2fe296[_0xdb1d('0xb')]]);}}catch(_0x2d1296){utils[_0xdb1d('0x1a')](util[_0xdb1d('0x3')](_0xdb1d('0x27'),_0x2fe296[_0xdb1d('0xb')]),_0x2d1296);}}; \ No newline at end of file +var _0x7b34=['billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','starttime','holdtime'];(function(_0x32b2d3,_0x40c0f6){var _0x5339e2=function(_0x36268f){while(--_0x36268f){_0x32b2d3['push'](_0x32b2d3['shift']());}};_0x5339e2(++_0x40c0f6);}(_0x7b34,0xa6));var _0x47b3=function(_0x3a0a93,_0x23df33){_0x3a0a93=_0x3a0a93-0x0;var _0x4a058e=_0x7b34[_0x3a0a93];return _0x4a058e;};'use strict';var _=require(_0x47b3('0x0'));var util=require('util');var utils=require(_0x47b3('0x1'));var dials={};function writeDB(_0x4d326d){utils['info'](util[_0x47b3('0x2')](_0x47b3('0x3'),_0x4d326d[_0x47b3('0x4')],_0x4d326d[_0x47b3('0x5')],_0x4d326d[_0x47b3('0x6')],_0x4d326d[_0x47b3('0x7')],_0x4d326d[_0x47b3('0x8')],_0x4d326d[_0x47b3('0x9')]));utils[_0x47b3('0xa')](_0x47b3('0xb'),_0x4d326d);delete dials[_0x4d326d[_0x47b3('0x4')]];}exports[_0x47b3('0xc')]=function(_0x22dd5c){try{utils[_0x47b3('0xd')](util[_0x47b3('0x2')](_0x47b3('0xe'),_0x22dd5c[_0x47b3('0x4')]),_0x22dd5c);utils[_0x47b3('0xf')](util[_0x47b3('0x2')](_0x47b3('0x10'),_0x22dd5c[_0x47b3('0x4')],_0x22dd5c[_0x47b3('0x11')],_0x22dd5c[_0x47b3('0x12')]));if(_0x22dd5c[_0x47b3('0x11')][_0x47b3('0x13')]()==_0x47b3('0x14')&&_[_0x47b3('0x15')](_0x22dd5c['appdata'][_0x47b3('0x13')](),_0x47b3('0x16'))){var _0x3d605d=_0x22dd5c[_0x47b3('0x12')][_0x47b3('0x17')]('=');dials[_0x22dd5c[_0x47b3('0x4')]]={'routeId':_0x3d605d[0x1]};}}catch(_0x2c6b88){utils[_0x47b3('0x18')](util[_0x47b3('0x2')]('[%s][dials][newexten]',_0x22dd5c[_0x47b3('0x4')]),_0x2c6b88);}};exports[_0x47b3('0x19')]=function(_0x5a43d8){try{utils[_0x47b3('0xd')](util[_0x47b3('0x2')]('[%s][dials][varset]',_0x5a43d8['uniqueid']),_0x5a43d8);if(!_[_0x47b3('0x1a')](_0x5a43d8[_0x47b3('0x1b')][_0x47b3('0x1c')])){utils[_0x47b3('0xf')](util[_0x47b3('0x2')](_0x47b3('0x1d'),_0x5a43d8[_0x47b3('0x4')],_0x5a43d8[_0x47b3('0x1e')]));dials[_0x5a43d8['uniqueid']]={'routeId':_0x5a43d8[_0x47b3('0x1e')]};}}catch(_0x329cfa){utils[_0x47b3('0x18')](util['format']('[%s][dials][varset]',_0x5a43d8[_0x47b3('0x4')]),_0x329cfa);}};exports[_0x47b3('0x1f')]=function(_0x1cbee9){try{if(!_['isNil'](dials[_0x1cbee9[_0x47b3('0x4')]])){utils[_0x47b3('0xd')](util['format'](_0x47b3('0x20'),_0x1cbee9[_0x47b3('0x4')]),_0x1cbee9);dials[_0x1cbee9[_0x47b3('0x4')]]=_[_0x47b3('0x21')](dials[_0x1cbee9['uniqueid']],_0x1cbee9);dials[_0x1cbee9[_0x47b3('0x4')]]['starttime']=utils[_0x47b3('0x22')]();dials[_0x1cbee9['uniqueid']][_0x47b3('0x23')]=_0x47b3('0x24');utils[_0x47b3('0xf')](util[_0x47b3('0x2')](_0x47b3('0x25'),_0x1cbee9['uniqueid'],dials[_0x1cbee9[_0x47b3('0x4')]]['starttime']));}}catch(_0x5f4c54){utils[_0x47b3('0x18')](util[_0x47b3('0x2')](_0x47b3('0x20'),_0x1cbee9[_0x47b3('0x4')]),_0x5f4c54);}};exports[_0x47b3('0x26')]=function(_0x29225c){try{if(!_[_0x47b3('0x1a')](dials[_0x29225c[_0x47b3('0x4')]])){utils['debug'](util[_0x47b3('0x2')](_0x47b3('0x27'),_0x29225c[_0x47b3('0x4')]),_0x29225c);dials[_0x29225c['uniqueid']][_0x47b3('0x9')]=_0x29225c[_0x47b3('0x9')];if(_0x29225c[_0x47b3('0x9')]==_0x47b3('0x28')){dials[_0x29225c[_0x47b3('0x4')]]=_[_0x47b3('0x21')](dials[_0x29225c[_0x47b3('0x4')]],_0x29225c);dials[_0x29225c[_0x47b3('0x4')]][_0x47b3('0x29')]=utils[_0x47b3('0x22')]();dials[_0x29225c[_0x47b3('0x4')]][_0x47b3('0x23')]='connect';utils[_0x47b3('0xf')](util[_0x47b3('0x2')](_0x47b3('0x2a'),_0x29225c['uniqueid'],_0x29225c[_0x47b3('0x9')],dials[_0x29225c[_0x47b3('0x4')]][_0x47b3('0x29')]));}else{utils[_0x47b3('0xf')](util['format'](_0x47b3('0x2b'),_0x29225c['uniqueid'],_0x29225c['dialstatus']));}}}catch(_0x5ca2fb){utils['error'](util[_0x47b3('0x2')](_0x47b3('0x27'),_0x29225c['uniqueid']),_0x5ca2fb);}};exports[_0x47b3('0x2c')]=function(_0x709032){try{if(!_['isNil'](dials[_0x709032[_0x47b3('0x4')]])){utils[_0x47b3('0xd')](util['format']('[%s][dials][hangup]',_0x709032[_0x47b3('0x4')]),_0x709032);utils[_0x47b3('0xf')](util[_0x47b3('0x2')](_0x47b3('0x2d'),_0x709032[_0x47b3('0x4')],_0x709032[_0x47b3('0x7')],_0x709032[_0x47b3('0x2e')],_0x709032[_0x47b3('0x2f')]));dials[_0x709032[_0x47b3('0x4')]]=_[_0x47b3('0x21')](dials[_0x709032[_0x47b3('0x4')]],{'endtime':utils['now'](),'lastevent':_0x47b3('0x30')});dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x31')]=utils[_0x47b3('0x32')](dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x33')],dials[_0x709032['uniqueid']][_0x47b3('0x34')]);dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x35')]=utils[_0x47b3('0x32')](dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x29')]||dials[_0x709032['uniqueid']]['endtime'],dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x34')]);dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x36')]=dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x29')]?utils[_0x47b3('0x32')](dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x33')],dials[_0x709032[_0x47b3('0x4')]][_0x47b3('0x29')]):0x0;writeDB(dials[_0x709032[_0x47b3('0x4')]]);}}catch(_0x3ffb63){utils['error'](util[_0x47b3('0x2')]('[%s][dials][hangup]',_0x709032[_0x47b3('0x4')]),_0x3ffb63);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index db29e81..a74de68 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 _0xf05c=['env','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','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]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled'];(function(_0x41cbb3,_0x259aa8){var _0x54a04b=function(_0x3e074e){while(--_0x3e074e){_0x41cbb3['push'](_0x41cbb3['shift']());}};_0x54a04b(++_0x259aa8);}(_0xf05c,0x122));var _0xcf05=function(_0x1cf663,_0x30b306){_0x1cf663=_0x1cf663-0x0;var _0x45a0d8=_0xf05c[_0x1cf663];return _0x45a0d8;};var AsteriskManager=require(_0xcf05('0x0'));var config=require(_0xcf05('0x1'));var utils=require(_0xcf05('0x2'));var util=require(_0xcf05('0x3'));var isXDREnabled=config[_0xcf05('0x4')]&&config['xdr'][_0xcf05('0x5')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xcf05('0x6')]===_0xcf05('0x7')||![];var isLocalAsterisk=config[_0xcf05('0x4')]&&config['xdr'][_0xcf05('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xcf05('0x9')]['ip'],config[_0xcf05('0x9')][_0xcf05('0xa')],config['asterisk'][_0xcf05('0xb')],!![]);ami[_0xcf05('0xc')]();if(!isXDREnabled){utils[_0xcf05('0xd')](_0xcf05('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xcf05('0xf'));}else{var agents=require(_0xcf05('0x10'));var calls=require(_0xcf05('0x11'));var queues=require(_0xcf05('0x12'));var recordings=require(_0xcf05('0x13'));var members=require(_0xcf05('0x14'));var dials=require(_0xcf05('0x15'));var transfers=require(_0xcf05('0x16'));var core=require(_0xcf05('0x17'));ami['on'](_0xcf05('0x18'),core['connect']);ami['on'](_0xcf05('0x19'),core[_0xcf05('0x19')]);ami['on'](_0xcf05('0x1a'),core['fullybooted']);ami['on'](_0xcf05('0x1b'),core[_0xcf05('0x1b')]);ami['on'](_0xcf05('0x1c'),core[_0xcf05('0x1c')]);ami['on'](_0xcf05('0x1d'),core[_0xcf05('0x1d')]);ami['on']('devicestatechange',function(_0x2068aa){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x20'),_0x2068aa[_0xcf05('0x21')]),_0x2068aa);members['devicestatechange'](_0x2068aa);}catch(_0x3e311a){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x20'),_0x2068aa['device']),_0x3e311a);}});ami['on']('agentcalled',function(_0x28dca8){try{utils[_0xcf05('0x1e')](util['format'](_0xcf05('0x22'),_0x28dca8['uniqueid']),_0x28dca8);agents[_0xcf05('0x23')](_0x28dca8);}catch(_0x5d8147){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')]('[%s][index][agentcalled]',_0x28dca8[_0xcf05('0x24')]),_0x5d8147);}});ami['on'](_0xcf05('0x25'),function(_0xd1edff){try{utils['debug'](util[_0xcf05('0x1f')](_0xcf05('0x26'),_0xd1edff[_0xcf05('0x24')]),_0xd1edff);agents[_0xcf05('0x25')](_0xd1edff);}catch(_0x4b2912){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x26'),_0xd1edff[_0xcf05('0x24')]),_0x4b2912);}});ami['on']('agentconnect',function(_0x171c68){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x27'),_0x171c68[_0xcf05('0x24')]),_0x171c68);agents[_0xcf05('0x28')](_0x171c68);queues[_0xcf05('0x28')](_0x171c68);}catch(_0x100008){utils[_0xcf05('0x1b')](util['format']('[%s][index][agentconnect]',_0x171c68[_0xcf05('0x24')]),_0x100008);}});ami['on'](_0xcf05('0x29'),function(_0x18d3bf){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x2a'),_0x18d3bf[_0xcf05('0x24')]),_0x18d3bf);agents[_0xcf05('0x29')](_0x18d3bf);queues[_0xcf05('0x29')](_0x18d3bf);members['agentcomplete'](_0x18d3bf);}catch(_0x5d9710){utils['error'](util[_0xcf05('0x1f')](_0xcf05('0x2a'),_0x18d3bf[_0xcf05('0x24')]),_0x5d9710);}});ami['on'](_0xcf05('0x2b'),function(_0x417aae){try{utils['debug'](util[_0xcf05('0x1f')](_0xcf05('0x2c'),_0x417aae[_0xcf05('0x24')]),_0x417aae);agents[_0xcf05('0x2b')](_0x417aae);queues[_0xcf05('0x2b')](_0x417aae);}catch(_0x16854f){utils[_0xcf05('0x1b')](util['format'](_0xcf05('0x2c'),_0x417aae[_0xcf05('0x24')]),_0x16854f);}});ami['on'](_0xcf05('0x2d'),function(_0x224014){try{utils['debug'](util[_0xcf05('0x1f')](_0xcf05('0x2e'),_0x224014[_0xcf05('0x24')]),_0x224014);queues[_0xcf05('0x2d')](_0x224014);recordings['queuecallerjoin'](_0x224014);}catch(_0x43a129){utils['error'](util[_0xcf05('0x1f')](_0xcf05('0x2e'),_0x224014[_0xcf05('0x24')]),_0x43a129);}});ami['on']('queuecallerleave',function(_0x27a25b){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x2f'),_0x27a25b[_0xcf05('0x24')]),_0x27a25b);queues[_0xcf05('0x30')](_0x27a25b);}catch(_0x54ced7){utils['error'](util['format'](_0xcf05('0x2f'),_0x27a25b[_0xcf05('0x24')]),_0x54ced7);}});ami['on'](_0xcf05('0x31'),function(_0x3ce330){try{utils['debug'](util['format'](_0xcf05('0x32'),_0x3ce330[_0xcf05('0x24')]),_0x3ce330);queues[_0xcf05('0x31')](_0x3ce330);calls[_0xcf05('0x31')](_0x3ce330);}catch(_0x4d8559){utils[_0xcf05('0x1b')](util['format'](_0xcf05('0x32'),_0x3ce330[_0xcf05('0x24')]),_0x4d8559);}});ami['on'](_0xcf05('0x33'),function(_0x463679){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x34'),_0x463679['uniqueid']),_0x463679);queues['musiconholdstop'](_0x463679);calls[_0xcf05('0x33')](_0x463679);}catch(_0x54401c){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')]('[%s][index][musiconholdstop]',_0x463679[_0xcf05('0x24')]),_0x54401c);}});ami['on'](_0xcf05('0x35'),function(_0x18b0d4){try{utils[_0xcf05('0x1e')](util['format'](_0xcf05('0x36'),_0x18b0d4[_0xcf05('0x24')]),_0x18b0d4);calls[_0xcf05('0x35')](_0x18b0d4);recordings[_0xcf05('0x35')](_0x18b0d4);}catch(_0x5ee585){utils['error'](util[_0xcf05('0x1f')]('[%s][index][newstate]',_0x18b0d4['uniqueid']),_0x5ee585);}});ami['on']('hangup',function(_0x1f102a){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x37'),_0x1f102a[_0xcf05('0x24')]),_0x1f102a);calls[_0xcf05('0x38')](_0x1f102a);recordings['hangup'](_0x1f102a);dials[_0xcf05('0x38')](_0x1f102a);agents[_0xcf05('0x38')](_0x1f102a);queues[_0xcf05('0x38')](_0x1f102a);}catch(_0x16f921){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x37'),_0x1f102a['uniqueid']),_0x16f921);}});ami['on'](_0xcf05('0x39'),function(_0x453a11){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x3a'),_0x453a11[_0xcf05('0x24')]),_0x453a11);members['cdr'](_0x453a11);}catch(_0x56f174){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')]('[%s][index][cdr]',_0x453a11[_0xcf05('0x24')]),_0x56f174);}});ami['on']('blindtransfer',function(_0x50c33b){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x3b'),_0x50c33b[_0xcf05('0x24')]),_0x50c33b);queues[_0xcf05('0x3c')](_0x50c33b);agents['blindtransfer'](_0x50c33b);transfers[_0xcf05('0x3c')](_0x50c33b);}catch(_0x609aaa){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')]('[%s][index][blindtransfer]',_0x50c33b[_0xcf05('0x24')]),_0x609aaa);}});ami['on'](_0xcf05('0x3d'),function(_0x3f71a8){try{utils[_0xcf05('0x1e')](util['format']('[%s][index][attendedtransfer]',_0x3f71a8['origtransfereruniqueid']),_0x3f71a8);queues[_0xcf05('0x3d')](_0x3f71a8);transfers[_0xcf05('0x3d')](_0x3f71a8);agents[_0xcf05('0x3d')](_0x3f71a8);calls[_0xcf05('0x3d')](_0x3f71a8);}catch(_0xbc142e){utils['error'](util[_0xcf05('0x1f')](_0xcf05('0x3e'),_0x3f71a8[_0xcf05('0x3f')]),_0xbc142e);}});ami['on'](_0xcf05('0x40'),function(_0x2e8b08){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')]('[%s][index][varset]',_0x2e8b08['uniqueid']),_0x2e8b08);queues[_0xcf05('0x40')](_0x2e8b08);recordings[_0xcf05('0x40')](_0x2e8b08);calls[_0xcf05('0x40')](_0x2e8b08);dials[_0xcf05('0x40')](_0x2e8b08);}catch(_0x4fa600){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x41'),_0x2e8b08[_0xcf05('0x24')]),_0x4fa600);}});ami['on']('newexten',function(_0x23b74a){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x42'),_0x23b74a[_0xcf05('0x24')]),_0x23b74a);calls['newexten'](_0x23b74a);recordings['newexten'](_0x23b74a);dials['newexten'](_0x23b74a);}catch(_0x1d3be5){utils['error'](util['format'](_0xcf05('0x42'),_0x23b74a[_0xcf05('0x24')]),_0x1d3be5);}});ami['on'](_0xcf05('0x43'),function(_0x58a807){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x44'),_0x58a807['uniqueid']),_0x58a807);calls[_0xcf05('0x43')](_0x58a807);recordings['newchannel'](_0x58a807);}catch(_0x7d26d3){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')]('[%s][index][newchannel]',_0x58a807[_0xcf05('0x24')]),_0x7d26d3);}});ami['on'](_0xcf05('0x45'),function(_0x247f9c){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x46'),_0x247f9c[_0xcf05('0x24')]),_0x247f9c);dials[_0xcf05('0x45')](_0x247f9c);}catch(_0x2225a3){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x47'),_0x247f9c[_0xcf05('0x24')]),_0x2225a3);}});ami['on'](_0xcf05('0x48'),function(_0x24a24e){try{utils[_0xcf05('0x1e')](util[_0xcf05('0x1f')](_0xcf05('0x49'),_0x24a24e[_0xcf05('0x24')]),_0x24a24e);dials[_0xcf05('0x48')](_0x24a24e);}catch(_0x518a7b){utils[_0xcf05('0x1b')](util[_0xcf05('0x1f')](_0xcf05('0x49'),_0x24a24e[_0xcf05('0x24')]),_0x518a7b);}});} \ No newline at end of file +var _0xfbb0=['attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','error','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xfbb0,0xe8));var _0x0fbb=function(_0xa29247,_0x47ea42){_0xa29247=_0xa29247-0x0;var _0x1f59e8=_0xfbb0[_0xa29247];return _0x1f59e8;};var AsteriskManager=require(_0x0fbb('0x0'));var config=require(_0x0fbb('0x1'));var utils=require(_0x0fbb('0x2'));var util=require(_0x0fbb('0x3'));var isXDREnabled=config[_0x0fbb('0x4')]&&config['xdr'][_0x0fbb('0x5')]?!config[_0x0fbb('0x4')][_0x0fbb('0x5')]:!![];var isProduction=config[_0x0fbb('0x6')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x0fbb('0x4')][_0x0fbb('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x0fbb('0x8')][_0x0fbb('0x9')],config[_0x0fbb('0x8')]['ip'],config[_0x0fbb('0x8')][_0x0fbb('0xa')],config['asterisk'][_0x0fbb('0xb')],!![]);ami[_0x0fbb('0xc')]();if(!isXDREnabled){utils['info'](_0x0fbb('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0fbb('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x0fbb('0xf'));var queues=require(_0x0fbb('0x10'));var recordings=require(_0x0fbb('0x11'));var members=require(_0x0fbb('0x12'));var dials=require(_0x0fbb('0x13'));var transfers=require(_0x0fbb('0x14'));var core=require(_0x0fbb('0x15'));ami['on'](_0x0fbb('0x16'),core[_0x0fbb('0x16')]);ami['on'](_0x0fbb('0x17'),core[_0x0fbb('0x17')]);ami['on'](_0x0fbb('0x18'),core['fullybooted']);ami['on']('error',core['error']);ami['on'](_0x0fbb('0x19'),core[_0x0fbb('0x19')]);ami['on'](_0x0fbb('0x1a'),core[_0x0fbb('0x1a')]);ami['on'](_0x0fbb('0x1b'),function(_0x41eb97){try{utils['debug'](util[_0x0fbb('0x1c')](_0x0fbb('0x1d'),_0x41eb97['device']),_0x41eb97);members[_0x0fbb('0x1b')](_0x41eb97);}catch(_0x762143){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')](_0x0fbb('0x1d'),_0x41eb97[_0x0fbb('0x1f')]),_0x762143);}});ami['on']('agentcalled',function(_0x49cb97){try{utils[_0x0fbb('0x20')](util['format'](_0x0fbb('0x21'),_0x49cb97[_0x0fbb('0x22')]),_0x49cb97);agents[_0x0fbb('0x23')](_0x49cb97);}catch(_0x96a7d9){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x21'),_0x49cb97[_0x0fbb('0x22')]),_0x96a7d9);}});ami['on'](_0x0fbb('0x24'),function(_0x3c618a){try{utils['debug'](util[_0x0fbb('0x1c')](_0x0fbb('0x25'),_0x3c618a[_0x0fbb('0x22')]),_0x3c618a);agents[_0x0fbb('0x24')](_0x3c618a);}catch(_0x50efe6){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x25'),_0x3c618a[_0x0fbb('0x22')]),_0x50efe6);}});ami['on'](_0x0fbb('0x26'),function(_0x285527){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x27'),_0x285527['uniqueid']),_0x285527);agents['agentconnect'](_0x285527);queues[_0x0fbb('0x26')](_0x285527);}catch(_0x1291e1){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')](_0x0fbb('0x27'),_0x285527[_0x0fbb('0x22')]),_0x1291e1);}});ami['on']('agentcomplete',function(_0x4cec11){try{utils[_0x0fbb('0x20')](util['format'](_0x0fbb('0x28'),_0x4cec11['uniqueid']),_0x4cec11);agents['agentcomplete'](_0x4cec11);queues['agentcomplete'](_0x4cec11);members[_0x0fbb('0x29')](_0x4cec11);}catch(_0x5e5127){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x28'),_0x4cec11[_0x0fbb('0x22')]),_0x5e5127);}});ami['on'](_0x0fbb('0x2a'),function(_0x27d59e){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x2b'),_0x27d59e[_0x0fbb('0x22')]),_0x27d59e);agents[_0x0fbb('0x2a')](_0x27d59e);queues['queuecallerabandon'](_0x27d59e);}catch(_0x1d9b5d){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x27d59e[_0x0fbb('0x22')]),_0x1d9b5d);}});ami['on']('queuecallerjoin',function(_0x58e007){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x2c'),_0x58e007[_0x0fbb('0x22')]),_0x58e007);queues[_0x0fbb('0x2d')](_0x58e007);recordings[_0x0fbb('0x2d')](_0x58e007);}catch(_0x2644c0){utils['error'](util['format'](_0x0fbb('0x2c'),_0x58e007[_0x0fbb('0x22')]),_0x2644c0);}});ami['on'](_0x0fbb('0x2e'),function(_0x59744){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x2f'),_0x59744['uniqueid']),_0x59744);queues[_0x0fbb('0x2e')](_0x59744);}catch(_0x5963d1){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')]('[%s][index][queuecallerleave]',_0x59744[_0x0fbb('0x22')]),_0x5963d1);}});ami['on'](_0x0fbb('0x30'),function(_0x547016){try{utils['debug'](util[_0x0fbb('0x1c')](_0x0fbb('0x31'),_0x547016[_0x0fbb('0x22')]),_0x547016);queues[_0x0fbb('0x30')](_0x547016);calls[_0x0fbb('0x30')](_0x547016);}catch(_0x21e1ce){utils[_0x0fbb('0x1e')](util['format']('[%s][index][musiconholdstart]',_0x547016['uniqueid']),_0x21e1ce);}});ami['on'](_0x0fbb('0x32'),function(_0x1f76d8){try{utils['debug'](util[_0x0fbb('0x1c')](_0x0fbb('0x33'),_0x1f76d8[_0x0fbb('0x22')]),_0x1f76d8);queues[_0x0fbb('0x32')](_0x1f76d8);calls['musiconholdstop'](_0x1f76d8);}catch(_0x8f39ee){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x33'),_0x1f76d8[_0x0fbb('0x22')]),_0x8f39ee);}});ami['on']('newstate',function(_0x8c3222){try{utils['debug'](util[_0x0fbb('0x1c')]('[%s][index][newstate]',_0x8c3222[_0x0fbb('0x22')]),_0x8c3222);calls[_0x0fbb('0x34')](_0x8c3222);recordings[_0x0fbb('0x34')](_0x8c3222);}catch(_0x52a76e){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')](_0x0fbb('0x35'),_0x8c3222[_0x0fbb('0x22')]),_0x52a76e);}});ami['on']('hangup',function(_0x182d34){try{utils[_0x0fbb('0x20')](util['format']('[%s][index][hangup]',_0x182d34[_0x0fbb('0x22')]),_0x182d34);calls[_0x0fbb('0x36')](_0x182d34);recordings[_0x0fbb('0x36')](_0x182d34);dials['hangup'](_0x182d34);agents[_0x0fbb('0x36')](_0x182d34);queues['hangup'](_0x182d34);}catch(_0x1869af){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')]('[%s][index][hangup]',_0x182d34[_0x0fbb('0x22')]),_0x1869af);}});ami['on'](_0x0fbb('0x37'),function(_0x102e2c){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x38'),_0x102e2c['uniqueid']),_0x102e2c);members['cdr'](_0x102e2c);}catch(_0x2b1bc0){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x38'),_0x102e2c['uniqueid']),_0x2b1bc0);}});ami['on'](_0x0fbb('0x39'),function(_0x2905eb){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x3a'),_0x2905eb['uniqueid']),_0x2905eb);queues[_0x0fbb('0x39')](_0x2905eb);agents['blindtransfer'](_0x2905eb);transfers[_0x0fbb('0x39')](_0x2905eb);}catch(_0x3c2398){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')]('[%s][index][blindtransfer]',_0x2905eb['uniqueid']),_0x3c2398);}});ami['on']('attendedtransfer',function(_0x1a9418){try{utils[_0x0fbb('0x20')](util['format'](_0x0fbb('0x3b'),_0x1a9418['origtransfereruniqueid']),_0x1a9418);queues[_0x0fbb('0x3c')](_0x1a9418);transfers['attendedtransfer'](_0x1a9418);agents[_0x0fbb('0x3c')](_0x1a9418);calls[_0x0fbb('0x3c')](_0x1a9418);}catch(_0x4e4ec9){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x3b'),_0x1a9418[_0x0fbb('0x3d')]),_0x4e4ec9);}});ami['on'](_0x0fbb('0x3e'),function(_0x3e4b9c){try{utils['debug'](util[_0x0fbb('0x1c')]('[%s][index][varset]',_0x3e4b9c[_0x0fbb('0x22')]),_0x3e4b9c);queues[_0x0fbb('0x3e')](_0x3e4b9c);recordings[_0x0fbb('0x3e')](_0x3e4b9c);calls['varset'](_0x3e4b9c);dials['varset'](_0x3e4b9c);}catch(_0x143508){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')](_0x0fbb('0x3f'),_0x3e4b9c[_0x0fbb('0x22')]),_0x143508);}});ami['on'](_0x0fbb('0x40'),function(_0x462650){try{utils['debug'](util[_0x0fbb('0x1c')]('[%s][index][newexten]',_0x462650[_0x0fbb('0x22')]),_0x462650);calls[_0x0fbb('0x40')](_0x462650);recordings[_0x0fbb('0x40')](_0x462650);dials['newexten'](_0x462650);}catch(_0x54da49){utils['error'](util['format'](_0x0fbb('0x41'),_0x462650[_0x0fbb('0x22')]),_0x54da49);}});ami['on'](_0x0fbb('0x42'),function(_0x5b0453){try{utils[_0x0fbb('0x20')](util['format'](_0x0fbb('0x43'),_0x5b0453[_0x0fbb('0x22')]),_0x5b0453);calls['newchannel'](_0x5b0453);recordings[_0x0fbb('0x42')](_0x5b0453);}catch(_0x5138ac){utils[_0x0fbb('0x1e')](util['format'](_0x0fbb('0x43'),_0x5b0453['uniqueid']),_0x5138ac);}});ami['on']('dialbegin',function(_0x477fa3){try{utils[_0x0fbb('0x20')](util[_0x0fbb('0x1c')](_0x0fbb('0x44'),_0x477fa3[_0x0fbb('0x22')]),_0x477fa3);dials[_0x0fbb('0x45')](_0x477fa3);}catch(_0xde9e60){utils['error'](util[_0x0fbb('0x1c')](_0x0fbb('0x46'),_0x477fa3[_0x0fbb('0x22')]),_0xde9e60);}});ami['on']('dialend',function(_0x33ea59){try{utils[_0x0fbb('0x20')](util['format'](_0x0fbb('0x47'),_0x33ea59[_0x0fbb('0x22')]),_0x33ea59);dials[_0x0fbb('0x48')](_0x33ea59);}catch(_0x332683){utils[_0x0fbb('0x1e')](util[_0x0fbb('0x1c')](_0x0fbb('0x47'),_0x33ea59[_0x0fbb('0x22')]),_0x332683);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c86eb15..0a4a456 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 _0x67f8=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','data1','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','format','uniqueid','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','NOT_INUSE','isNil','exitAt','now','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete'];(function(_0x523d5a,_0x9b868a){var _0x4a7258=function(_0x202419){while(--_0x202419){_0x523d5a['push'](_0x523d5a['shift']());}};_0x4a7258(++_0x9b868a);}(_0x67f8,0x105));var _0x867f=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x67f8[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0x867f('0x0'));var util=require(_0x867f('0x1'));var utils=require(_0x867f('0x2'));var members={};var exclude=[_0x867f('0x3'),'Queue:'];function writeDB(_0x3d906c){utils[_0x867f('0x4')](util['format'](_0x867f('0x5'),_0x3d906c['uniqueid'],_0x3d906c[_0x867f('0x6')],_0x3d906c[_0x867f('0x7')],_0x3d906c['data2'],_0x3d906c[_0x867f('0x8')],_0x3d906c[_0x867f('0x9')]));if(_0x3d906c[_0x867f('0x6')]){utils[_0x867f('0xa')](_0x3d906c[_0x867f('0x6')])[_0x867f('0xb')](function(_0x40ae5f){if(_0x40ae5f){_0x3d906c[_0x867f('0x8')]=_0x40ae5f[_0x867f('0xc')];_0x3d906c['internal']=_0x40ae5f[_0x867f('0xd')];utils[_0x867f('0xe')](_0x867f('0xf'),_0x3d906c);}else{utils[_0x867f('0x10')](_0x3d906c[_0x867f('0x6')]['split']('/')[0x1])[_0x867f('0xb')](function(_0xef0624){if(_0xef0624){_0x3d906c[_0x867f('0x8')]=_0xef0624[_0x867f('0xc')];_0x3d906c['internal']=_0xef0624[_0x867f('0xd')];utils[_0x867f('0xe')](_0x867f('0xf'),_0x3d906c);}});}})[_0x867f('0x11')](function(_0x4bb40d){utils[_0x867f('0x12')](util[_0x867f('0x13')]('[%s][members][writeDB]',_0x3d906c[_0x867f('0x14')]),_0x4bb40d);});}delete members[_0x3d906c[_0x867f('0x6')]];}function startsWith(_0x3bc9c3,_0x242b03){return _[_0x867f('0x15')](_0x3bc9c3,function(_0x16a2e4){return _['startsWith'](_0x242b03,_0x16a2e4);});}exports[_0x867f('0x16')]=function(_0x327e6b){try{utils[_0x867f('0x17')](util[_0x867f('0x13')]('[%s][members][devicestatechange]',members[_0x327e6b[_0x867f('0x18')]]?members[_0x327e6b[_0x867f('0x18')]]['uniqueid']:_0x327e6b[_0x867f('0x18')]),_0x327e6b);utils[_0x867f('0x4')](util['format'](_0x867f('0x19'),members[_0x327e6b[_0x867f('0x18')]]?members[_0x327e6b[_0x867f('0x18')]][_0x867f('0x14')]:_0x327e6b[_0x867f('0x18')],_0x327e6b[_0x867f('0x1a')],_0x327e6b[_0x867f('0x18')]));switch(_0x327e6b[_0x867f('0x1a')]){case _0x867f('0x1b'):case _0x867f('0x1c'):if(!startsWith(exclude,_0x327e6b['device'])){members[_0x327e6b[_0x867f('0x18')]]={'channel':'voice','interface':_0x327e6b[_0x867f('0x18')],'type':_0x867f('0x1d'),'enterAt':utils['now'](),'role':_0x867f('0x1e')};}break;case _0x867f('0x1f'):if(!_[_0x867f('0x20')](members[_0x327e6b[_0x867f('0x18')]])){members[_0x327e6b[_0x867f('0x18')]][_0x867f('0x21')]=utils[_0x867f('0x22')]();members[_0x327e6b[_0x867f('0x18')]]['duration']=utils[_0x867f('0x23')](members[_0x327e6b[_0x867f('0x18')]][_0x867f('0x21')],members[_0x327e6b[_0x867f('0x18')]][_0x867f('0x24')]);if(members[_0x327e6b[_0x867f('0x18')]][_0x867f('0x14')]){writeDB(members[_0x327e6b[_0x867f('0x18')]]);}}break;default:break;}}catch(_0x1c08ca){utils['error'](util[_0x867f('0x13')](_0x867f('0x25'),members[_0x327e6b[_0x867f('0x18')]]?members[_0x327e6b[_0x867f('0x18')]]['uniqueid']:_0x327e6b[_0x867f('0x18')]),_0x1c08ca);}};exports[_0x867f('0x26')]=function(_0x44f4c9){try{if(!_[_0x867f('0x20')](members[_0x44f4c9[_0x867f('0x6')]])){utils[_0x867f('0x17')](util['format'](_0x867f('0x27'),_0x44f4c9[_0x867f('0x14')]),_0x44f4c9);utils[_0x867f('0x4')](util['format'](_0x867f('0x28'),_0x44f4c9[_0x867f('0x14')],_0x44f4c9[_0x867f('0x6')],_0x44f4c9['queue']));members[_0x44f4c9['interface']]=_['assign'](members[_0x44f4c9[_0x867f('0x6')]],{'data4':_0x44f4c9[_0x867f('0x29')],'uniqueid':_0x44f4c9[_0x867f('0x14')]});}}catch(_0x6b0993){utils[_0x867f('0x12')](util[_0x867f('0x13')](_0x867f('0x27'),_0x44f4c9[_0x867f('0x14')]),_0x6b0993);}};exports['cdr']=function(_0x34c6f0){try{utils['debug'](util['format']('[%s][members][cdr]',_0x34c6f0[_0x867f('0x14')]),_0x34c6f0);if(_0x34c6f0[_0x867f('0x7')]){var _0x3cf3c9=_0x34c6f0[_0x867f('0x7')]['split']('-')[0x0];if(!_[_0x867f('0x20')](members[_0x3cf3c9])){members[_0x3cf3c9]=_[_0x867f('0x2a')](members[_0x3cf3c9],{'data1':members[_0x3cf3c9]['data1']||_0x34c6f0[_0x867f('0x9')],'data2':members[_0x3cf3c9]['data2']||_0x34c6f0['source'],'data3':members[_0x3cf3c9][_0x867f('0x2b')]||_0x34c6f0[_0x867f('0x2c')],'uniqueid':members[_0x3cf3c9][_0x867f('0x14')]||_0x34c6f0['uniqueid']});utils[_0x867f('0x4')](util[_0x867f('0x13')](_0x867f('0x2d'),_0x34c6f0[_0x867f('0x14')],members[_0x3cf3c9]['data1'],members[_0x3cf3c9][_0x867f('0x2e')],members[_0x3cf3c9][_0x867f('0x2b')]));if(members[_0x3cf3c9]['exitAt']){writeDB(members[_0x3cf3c9]);}}}if(_0x34c6f0['destinationchannel']){var _0x5d287a=_0x34c6f0[_0x867f('0x2f')]['split']('-')[0x0];if(!_[_0x867f('0x20')](members[_0x5d287a])){members[_0x5d287a]=_[_0x867f('0x2a')](members[_0x5d287a],{'data1':members[_0x5d287a][_0x867f('0x30')]||_0x34c6f0['type'],'data2':members[_0x5d287a][_0x867f('0x2e')]||_0x34c6f0['source'],'data3':members[_0x5d287a][_0x867f('0x2b')]||_0x34c6f0[_0x867f('0x2c')],'uniqueid':members[_0x5d287a]['uniqueid']||_0x34c6f0[_0x867f('0x14')]});utils[_0x867f('0x4')](util[_0x867f('0x13')](_0x867f('0x2d'),_0x34c6f0[_0x867f('0x14')],members[_0x5d287a][_0x867f('0x30')],members[_0x5d287a][_0x867f('0x2e')],members[_0x5d287a]['data3']));if(members[_0x5d287a][_0x867f('0x21')]){writeDB(members[_0x5d287a]);}}}}catch(_0x333daf){utils['error'](util[_0x867f('0x13')](_0x867f('0x31'),_0x34c6f0[_0x867f('0x14')]),_0x333daf);}}; \ No newline at end of file +var _0x13d4=['[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','debug'];(function(_0x3a2ec8,_0xd02c05){var _0x23c538=function(_0x3c95b3){while(--_0x3c95b3){_0x3a2ec8['push'](_0x3a2ec8['shift']());}};_0x23c538(++_0xd02c05);}(_0x13d4,0x15d));var _0x413d=function(_0x19d04d,_0x15a702){_0x19d04d=_0x19d04d-0x0;var _0x44497a=_0x13d4[_0x19d04d];return _0x44497a;};'use strict';var _=require('lodash');var util=require(_0x413d('0x0'));var utils=require(_0x413d('0x1'));var members={};var exclude=[_0x413d('0x2'),'Queue:'];function writeDB(_0x4cc9a4){utils['info'](util[_0x413d('0x3')](_0x413d('0x4'),_0x4cc9a4[_0x413d('0x5')],_0x4cc9a4[_0x413d('0x6')],_0x4cc9a4[_0x413d('0x7')],_0x4cc9a4['data2'],_0x4cc9a4[_0x413d('0x8')],_0x4cc9a4['type']));if(_0x4cc9a4[_0x413d('0x6')]){utils['getUserByInterface'](_0x4cc9a4[_0x413d('0x6')])[_0x413d('0x9')](function(_0x35870b){if(_0x35870b){_0x4cc9a4['membername']=_0x35870b['name'];_0x4cc9a4[_0x413d('0xa')]=_0x35870b[_0x413d('0xa')];utils[_0x413d('0xb')](_0x413d('0xc'),_0x4cc9a4);}else{utils[_0x413d('0xd')](_0x4cc9a4[_0x413d('0x6')][_0x413d('0xe')]('/')[0x1])[_0x413d('0x9')](function(_0x5d0602){if(_0x5d0602){_0x4cc9a4[_0x413d('0x8')]=_0x5d0602[_0x413d('0xf')];_0x4cc9a4[_0x413d('0xa')]=_0x5d0602[_0x413d('0xa')];utils[_0x413d('0xb')](_0x413d('0xc'),_0x4cc9a4);}});}})[_0x413d('0x10')](function(_0x5ae5d7){utils[_0x413d('0x11')](util[_0x413d('0x3')](_0x413d('0x12'),_0x4cc9a4[_0x413d('0x5')]),_0x5ae5d7);});}delete members[_0x4cc9a4[_0x413d('0x6')]];}function startsWith(_0x5ece2d,_0x20c51d){return _[_0x413d('0x13')](_0x5ece2d,function(_0x25a1b1){return _[_0x413d('0x14')](_0x20c51d,_0x25a1b1);});}exports['devicestatechange']=function(_0x3a3ad7){try{utils[_0x413d('0x15')](util[_0x413d('0x3')](_0x413d('0x16'),members[_0x3a3ad7[_0x413d('0x17')]]?members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x5')]:_0x3a3ad7[_0x413d('0x17')]),_0x3a3ad7);utils[_0x413d('0x18')](util['format'](_0x413d('0x19'),members[_0x3a3ad7[_0x413d('0x17')]]?members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x5')]:_0x3a3ad7[_0x413d('0x17')],_0x3a3ad7[_0x413d('0x1a')],_0x3a3ad7[_0x413d('0x17')]));switch(_0x3a3ad7[_0x413d('0x1a')]){case'INUSE':case _0x413d('0x1b'):if(!startsWith(exclude,_0x3a3ad7[_0x413d('0x17')])){members[_0x3a3ad7['device']]={'channel':_0x413d('0x1c'),'interface':_0x3a3ad7['device'],'type':_0x413d('0x1d'),'enterAt':utils[_0x413d('0x1e')](),'role':_0x413d('0x1f')};}break;case _0x413d('0x20'):if(!_['isNil'](members[_0x3a3ad7[_0x413d('0x17')]])){members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x21')]=utils[_0x413d('0x1e')]();members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x22')]=utils[_0x413d('0x23')](members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x21')],members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x24')]);if(members[_0x3a3ad7[_0x413d('0x17')]]['uniqueid']){writeDB(members[_0x3a3ad7[_0x413d('0x17')]]);}}break;default:break;}}catch(_0x35a24a){utils[_0x413d('0x11')](util['format'](_0x413d('0x16'),members[_0x3a3ad7[_0x413d('0x17')]]?members[_0x3a3ad7[_0x413d('0x17')]][_0x413d('0x5')]:_0x3a3ad7[_0x413d('0x17')]),_0x35a24a);}};exports[_0x413d('0x25')]=function(_0x33e199){try{if(!_[_0x413d('0x26')](members[_0x33e199['interface']])){utils[_0x413d('0x15')](util['format'](_0x413d('0x27'),_0x33e199[_0x413d('0x5')]),_0x33e199);utils[_0x413d('0x18')](util['format'](_0x413d('0x28'),_0x33e199[_0x413d('0x5')],_0x33e199['interface'],_0x33e199[_0x413d('0x29')]));members[_0x33e199['interface']]=_['assign'](members[_0x33e199[_0x413d('0x6')]],{'data4':_0x33e199[_0x413d('0x29')],'uniqueid':_0x33e199[_0x413d('0x5')]});}}catch(_0x59d0da){utils[_0x413d('0x11')](util['format'](_0x413d('0x27'),_0x33e199[_0x413d('0x5')]),_0x59d0da);}};exports[_0x413d('0x2a')]=function(_0x4f9ee4){try{utils['debug'](util[_0x413d('0x3')](_0x413d('0x2b'),_0x4f9ee4[_0x413d('0x5')]),_0x4f9ee4);if(_0x4f9ee4['channel']){var _0x38a2ea=_0x4f9ee4[_0x413d('0x7')]['split']('-')[0x0];if(!_[_0x413d('0x26')](members[_0x38a2ea])){members[_0x38a2ea]=_[_0x413d('0x2c')](members[_0x38a2ea],{'data1':members[_0x38a2ea][_0x413d('0x2d')]||_0x4f9ee4[_0x413d('0x2e')],'data2':members[_0x38a2ea][_0x413d('0x2f')]||_0x4f9ee4[_0x413d('0x30')],'data3':members[_0x38a2ea][_0x413d('0x31')]||_0x4f9ee4[_0x413d('0x32')],'uniqueid':members[_0x38a2ea][_0x413d('0x5')]||_0x4f9ee4[_0x413d('0x5')]});utils[_0x413d('0x18')](util[_0x413d('0x3')](_0x413d('0x33'),_0x4f9ee4['uniqueid'],members[_0x38a2ea]['data1'],members[_0x38a2ea][_0x413d('0x2f')],members[_0x38a2ea][_0x413d('0x31')]));if(members[_0x38a2ea]['exitAt']){writeDB(members[_0x38a2ea]);}}}if(_0x4f9ee4[_0x413d('0x34')]){var _0x3ce006=_0x4f9ee4['destinationchannel']['split']('-')[0x0];if(!_[_0x413d('0x26')](members[_0x3ce006])){members[_0x3ce006]=_[_0x413d('0x2c')](members[_0x3ce006],{'data1':members[_0x3ce006][_0x413d('0x2d')]||_0x4f9ee4['type'],'data2':members[_0x3ce006][_0x413d('0x2f')]||_0x4f9ee4[_0x413d('0x30')],'data3':members[_0x3ce006]['data3']||_0x4f9ee4[_0x413d('0x32')],'uniqueid':members[_0x3ce006][_0x413d('0x5')]||_0x4f9ee4['uniqueid']});utils[_0x413d('0x18')](util[_0x413d('0x3')](_0x413d('0x33'),_0x4f9ee4['uniqueid'],members[_0x3ce006][_0x413d('0x2d')],members[_0x3ce006]['data2'],members[_0x3ce006][_0x413d('0x31')]));if(members[_0x3ce006]['exitAt']){writeDB(members[_0x3ce006]);}}}}catch(_0x43eef2){utils[_0x413d('0x11')](util[_0x413d('0x3')](_0x413d('0x2b'),_0x4f9ee4['uniqueid']),_0x43eef2);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0dcbe0a..0090b51 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 _0x92d6=['BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','queuecallerabandon','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype'];(function(_0x5c12de,_0x180342){var _0x14cf50=function(_0x29e8e0){while(--_0x29e8e0){_0x5c12de['push'](_0x5c12de['shift']());}};_0x14cf50(++_0x180342);}(_0x92d6,0xe6));var _0x692d=function(_0xb0b0e2,_0x15ca27){_0xb0b0e2=_0xb0b0e2-0x0;var _0xdea6b1=_0x92d6[_0xb0b0e2];return _0xdea6b1;};'use strict';var _=require(_0x692d('0x0'));var util=require('util');var utils=require(_0x692d('0x1'));var queues={};function writeDB(_0x254848){utils[_0x692d('0x2')](util[_0x692d('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x254848['uniqueid'],_0x254848[_0x692d('0x4')],_0x254848['queue'],_0x254848['lastAssignedTo'],_0x254848[_0x692d('0x5')],_0x254848[_0x692d('0x6')],_0x254848[_0x692d('0x7')]));if(_0x254848[_0x692d('0x8')]){utils[_0x692d('0x9')](_0x254848[_0x692d('0x8')])[_0x692d('0xa')](function(_0x32ebcc){if(_0x32ebcc){_0x254848[_0x692d('0xb')]=_0x32ebcc[_0x692d('0xb')];}utils[_0x692d('0xc')](_0x692d('0xd'),_0x254848);});}else{utils[_0x692d('0xc')]('CreateVoiceQueueReport',_0x254848);}if(_0x254848[_0x692d('0xe')]){delete queues[_0x254848['transfereduniqueid']];}else{delete queues[_0x254848[_0x692d('0xf')]];}}exports[_0x692d('0x10')]=function(_0xc30f37){try{utils['debug'](util[_0x692d('0x3')]('[%s][queues][queuecallerjoin]',_0xc30f37[_0x692d('0xf')]),_0xc30f37);utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x11'),_0xc30f37[_0x692d('0xf')],_0xc30f37[_0x692d('0x8')],_0xc30f37['position']));queues[_0xc30f37[_0x692d('0xf')]]=_[_0x692d('0x12')](_0xc30f37,{'originalposition':_0xc30f37[_0x692d('0x13')],'queuecallerjoinAt':utils[_0x692d('0x14')](),'mohtime':0x0});}catch(_0x44c2d0){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x16'),_0xc30f37[_0x692d('0xf')]),_0x44c2d0);}};exports[_0x692d('0x17')]=function(_0x42d8ae){try{if(!_[_0x692d('0x18')](queues[_0x42d8ae[_0x692d('0xf')]])){utils[_0x692d('0x19')](util[_0x692d('0x3')](_0x692d('0x1a'),_0x42d8ae[_0x692d('0xf')]),_0x42d8ae);if(queues[_0x42d8ae['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x42d8ae[_0x692d('0xf')]]['queuecallerabandon']&&!queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0x1b')]){queues[_0x42d8ae['uniqueid']][_0x692d('0x1c')]=!![];queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0x1d')]=utils[_0x692d('0x14')]();queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0x7')]=_0x692d('0x1e');}utils['info'](util[_0x692d('0x3')](_0x692d('0x1f'),_0x42d8ae[_0x692d('0xf')],queues[_0x42d8ae['uniqueid']]['name'],queues[_0x42d8ae[_0x692d('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x42d8ae[_0x692d('0xf')]]);}else if(queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0xe')]){utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x20'),_0x42d8ae[_0x692d('0xf')],queues[_0x42d8ae[_0x692d('0xf')]]['name'],queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0xe')]));queues[queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0xe')]]=queues[_0x42d8ae['uniqueid']];queues[queues[_0x42d8ae[_0x692d('0xf')]][_0x692d('0xe')]][_0x692d('0x21')]=0x2;delete queues[_0x42d8ae[_0x692d('0xf')]];}}}catch(_0x5cec8b){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x1a'),_0x42d8ae[_0x692d('0xf')]),_0x5cec8b);}};exports[_0x692d('0x22')]=function(_0x3cf7f6){try{utils[_0x692d('0x19')](util[_0x692d('0x3')]('[%s][queues][varset]',_0x3cf7f6[_0x692d('0xf')]),_0x3cf7f6);if(!_[_0x692d('0x18')](_0x3cf7f6[_0x692d('0x23')]['queuestatus'])&&_0x3cf7f6[_0x692d('0x24')][_0x692d('0x25')]()!==_0x692d('0x26')){if(!_[_0x692d('0x18')](queues[_0x3cf7f6['uniqueid']])){queues[_0x3cf7f6[_0x692d('0xf')]]['queuecallerabandon']=![];queues[_0x3cf7f6['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x1b')]=!![];queues[_0x3cf7f6[_0x692d('0xf')]]['queuecallerexitAt']=utils[_0x692d('0x14')]();queues[_0x3cf7f6['uniqueid']][_0x692d('0x7')]=_0x3cf7f6[_0x692d('0x24')]['toUpperCase']();utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x27'),_0x3cf7f6[_0x692d('0xf')],queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x28')],_0x3cf7f6[_0x692d('0x24')],queues[_0x3cf7f6[_0x692d('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x3cf7f6['uniqueid']]);}}else if(!_[_0x692d('0x18')](_0x3cf7f6[_0x692d('0x23')][_0x692d('0x29')])){if(!_[_0x692d('0x18')](queues[_0x3cf7f6[_0x692d('0xf')]])&&!queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x2a')]){queues[_0x3cf7f6['uniqueid']][_0x692d('0x2a')]=![];queues[_0x3cf7f6[_0x692d('0xf')]]['queuecallerabandonAt']=null;queues[_0x3cf7f6['uniqueid']][_0x692d('0x1b')]=!![];queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x2b')]=utils[_0x692d('0x14')]();queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x7')]=_0x692d('0x2c');utils['info'](util[_0x692d('0x3')](_0x692d('0x2d'),_0x3cf7f6['uniqueid'],queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x28')],_0x3cf7f6[_0x692d('0x24')],queues[_0x3cf7f6[_0x692d('0xf')]][_0x692d('0x7')]));}}}catch(_0x2aefd8){utils[_0x692d('0x15')](util[_0x692d('0x3')]('[%s][queues][varset]',_0x3cf7f6[_0x692d('0xf')]),_0x2aefd8);}};exports[_0x692d('0x2a')]=function(_0x2abf98){try{if(!_[_0x692d('0x18')](queues[_0x2abf98[_0x692d('0xf')]])){utils[_0x692d('0x19')](util['format'](_0x692d('0x2e'),_0x2abf98[_0x692d('0xf')]),_0x2abf98);queues[_0x2abf98[_0x692d('0xf')]][_0x692d('0x1b')]=![];queues[_0x2abf98[_0x692d('0xf')]][_0x692d('0x2b')]=null;queues[_0x2abf98[_0x692d('0xf')]]['queuecallerabandon']=!![];queues[_0x2abf98[_0x692d('0xf')]][_0x692d('0x2f')]=utils[_0x692d('0x14')]();queues[_0x2abf98[_0x692d('0xf')]][_0x692d('0x7')]='ABANDONED';utils[_0x692d('0x2')](util['format'](_0x692d('0x30'),_0x2abf98[_0x692d('0xf')],queues[_0x2abf98[_0x692d('0xf')]]['name'],queues[_0x2abf98[_0x692d('0xf')]][_0x692d('0x7')]));}}catch(_0x4c1189){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x2e'),_0x2abf98[_0x692d('0xf')]),_0x4c1189);}};exports['queuecallerleave']=function(_0x2c20de){try{if(!_[_0x692d('0x18')](queues[_0x2c20de['uniqueid']])){utils[_0x692d('0x19')](util[_0x692d('0x3')](_0x692d('0x31'),_0x2c20de[_0x692d('0xf')]),_0x2c20de);utils['info'](util['format'](_0x692d('0x32'),_0x2c20de[_0x692d('0xf')],queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x28')],_0x2c20de['connectedlinenum'],_0x2c20de['connectedlinename']));queues[_0x2c20de[_0x692d('0xf')]]['queuecallerleave']=!![];queues[_0x2c20de['uniqueid']][_0x692d('0x33')]=utils[_0x692d('0x14')]();queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x34')]=utils['diffTime'](queues[_0x2c20de['uniqueid']][_0x692d('0x33')],queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x35')]);queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x13')]=_0x2c20de[_0x692d('0x13')];queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x36')]=_0x2c20de['count'];queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x37')]=_0x2c20de['connectedlinenum'];queues[_0x2c20de[_0x692d('0xf')]][_0x692d('0x38')]=_0x2c20de[_0x692d('0x38')];}}catch(_0x2c1ecb){utils[_0x692d('0x15')](util['format'](_0x692d('0x31'),_0x2c20de[_0x692d('0xf')]),_0x2c1ecb);}};exports[_0x692d('0x39')]=function(_0x1f8a6c){try{if(!_[_0x692d('0x18')](queues[_0x1f8a6c[_0x692d('0xf')]])){utils[_0x692d('0x19')](util[_0x692d('0x3')](_0x692d('0x3a'),_0x1f8a6c[_0x692d('0xf')]),_0x1f8a6c);utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x3b'),_0x1f8a6c[_0x692d('0xf')],queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x28')],_0x1f8a6c[_0x692d('0x3c')],_0x1f8a6c[_0x692d('0x3d')]));queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x2a')]=![];queues[_0x1f8a6c[_0x692d('0xf')]]['queuecallerabandon']=![];queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x2f')]=null;queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x1b')]=![];queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x7')]=null;queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x2b')]=null;queues[_0x1f8a6c[_0x692d('0xf')]]['assigned']=!![];queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x6')]=_0x1f8a6c[_0x692d('0x3d')];queues[_0x1f8a6c[_0x692d('0xf')]][_0x692d('0x3e')]=_0x1f8a6c[_0x692d('0x3c')];}}catch(_0x39a4f1){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x3a'),_0x1f8a6c[_0x692d('0xf')]),_0x39a4f1);}};exports[_0x692d('0x3f')]=function(_0x55a816){try{if(!_['isNil'](queues[_0x55a816[_0x692d('0xf')]])){if(queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x33')]){utils[_0x692d('0x19')](util[_0x692d('0x3')](_0x692d('0x40'),_0x55a816[_0x692d('0xf')]),_0x55a816);queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x2a')]=![];queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x2a')]=![];queues[_0x55a816['uniqueid']][_0x692d('0x2f')]=null;queues[_0x55a816['uniqueid']][_0x692d('0x1b')]=![];queues[_0x55a816[_0x692d('0xf')]]['queuecallerexitAt']=null;queues[_0x55a816['uniqueid']][_0x692d('0x41')]=!![];queues[_0x55a816[_0x692d('0xf')]]['lastAssignedTo']=_0x55a816[_0x692d('0x3c')];queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x1c')]=!![];queues[_0x55a816['uniqueid']][_0x692d('0x1d')]=utils[_0x692d('0x14')]();if(_0x55a816[_0x692d('0x42')]==_0x692d('0x43')){if(!queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x43')]){queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x7')]='TRANSFER';}}else{queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x7')]=_0x692d('0x44')+_0x55a816[_0x692d('0x42')][_0x692d('0x25')]();}utils[_0x692d('0x2')](util[_0x692d('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x55a816[_0x692d('0xf')],queues[_0x55a816[_0x692d('0xf')]][_0x692d('0x28')],_0x55a816[_0x692d('0x3c')],queues[_0x55a816['uniqueid']][_0x692d('0x7')]));writeDB(queues[_0x55a816[_0x692d('0xf')]]);}}}catch(_0x4d8a4c){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x40'),_0x55a816[_0x692d('0xf')]),_0x4d8a4c);}};exports[_0x692d('0x45')]=function(_0x59305c){try{if(!_[_0x692d('0x18')](queues[_0x59305c[_0x692d('0x46')]])){utils[_0x692d('0x19')](util[_0x692d('0x3')](_0x692d('0x47'),_0x59305c[_0x692d('0xf')]),_0x59305c);queues[_0x59305c[_0x692d('0x46')]][_0x692d('0x43')]=!![];queues[_0x59305c[_0x692d('0x46')]][_0x692d('0x48')]=_0x692d('0x49');queues[_0x59305c[_0x692d('0x46')]][_0x692d('0x4a')]=_0x59305c[_0x692d('0x4b')];queues[_0x59305c['transfereeuniqueid']][_0x692d('0x4c')]=_0x59305c['transfereeuniqueid'];queues[_0x59305c[_0x692d('0x46')]][_0x692d('0x7')]=_0x692d('0x4d');utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x4e'),_0x59305c[_0x692d('0xf')],queues[_0x59305c[_0x692d('0x46')]][_0x692d('0x28')],_0x59305c[_0x692d('0x46')],_0x59305c['extension']));}}catch(_0x17951d){utils['error'](util[_0x692d('0x3')](_0x692d('0x47'),_0x59305c['uniqueid']),_0x17951d);}};exports['attendedtransfer']=function(_0x3698f8){try{utils[_0x692d('0x19')](util[_0x692d('0x3')]('[%s][queues][attendedtransfer]',_0x3698f8[_0x692d('0x4f')]),_0x3698f8);if(_0x3698f8['origtransfereruniqueid']==_0x3698f8['origtransfererlinkedid']){if(!_[_0x692d('0x18')](queues[_0x3698f8[_0x692d('0x50')]])){utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x51'),_0x3698f8[_0x692d('0x4f')],queues[_0x3698f8['secondtransfererlinkedid']][_0x692d('0x28')],_0x3698f8['origtransfererexten']));queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0x43')]=!![];queues[_0x3698f8[_0x692d('0x50')]]['transfertype']='ATTENDED';queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0x4a')]=_0x3698f8['origtransfererexten'];queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0x4c')]=_0x3698f8[_0x692d('0x4f')];queues[_0x3698f8[_0x692d('0x50')]]['queuecallerexitreason']=_0x692d('0x52');}if(!_[_0x692d('0x18')](queues[_0x3698f8[_0x692d('0x53')]])){if(_0x3698f8['transfereelinkedid']&&queues[_0x3698f8['transfereelinkedid']]){queues[_0x3698f8[_0x692d('0x54')]][_0x692d('0x21')]=0x1;queues[_0x3698f8[_0x692d('0x46')]]=_['clone'](queues[_0x3698f8[_0x692d('0x54')]]);queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0xe')]=_0x3698f8[_0x692d('0x55')];queues[_0x3698f8[_0x692d('0x46')]]['queuecallerenterreason']=0x2;queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0x5')]=queues[_0x3698f8['secondtransfererlinkedid']]['calleridnum'];queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0x56')]=queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0x56')];queues[_0x3698f8[_0x692d('0x46')]]['queuecallerjoinAt']=utils[_0x692d('0x14')]();queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0x33')]=utils[_0x692d('0x14')]();queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0x34')]=0x0;queues[_0x3698f8[_0x692d('0x46')]]['mohtime']=0x0;utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x57'),_0x3698f8[_0x692d('0x4f')],queues[_0x3698f8[_0x692d('0x46')]]['name'],queues[_0x3698f8[_0x692d('0x46')]][_0x692d('0x5')],queues[_0x3698f8['transfereeuniqueid']][_0x692d('0x56')]));}else{utils['info'](util[_0x692d('0x3')](_0x692d('0x58'),_0x3698f8[_0x692d('0x4f')],queues[_0x3698f8['origtransfererlinkedid']][_0x692d('0x28')],_0x3698f8[_0x692d('0x50')]));queues[_0x3698f8[_0x692d('0x53')]]['transfereduniqueid']=_0x3698f8['secondtransfererlinkedid'];}}}else if(_0x3698f8[_0x692d('0x59')]==_0x3698f8[_0x692d('0x50')]){if(!_[_0x692d('0x18')](queues[_0x3698f8[_0x692d('0x53')]])){utils['info'](util[_0x692d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3698f8[_0x692d('0x4f')],queues[_0x3698f8[_0x692d('0x53')]][_0x692d('0x28')],_0x3698f8[_0x692d('0x59')],_0x3698f8[_0x692d('0x5a')]));queues[_0x3698f8['origtransfererlinkedid']][_0x692d('0x43')]=!![];queues[_0x3698f8['origtransfererlinkedid']][_0x692d('0x48')]=_0x692d('0x5b');queues[_0x3698f8['origtransfererlinkedid']][_0x692d('0x4a')]=_0x3698f8[_0x692d('0x5a')];queues[_0x3698f8[_0x692d('0x53')]]['transferuniqueid']=_0x3698f8[_0x692d('0x59')];queues[_0x3698f8[_0x692d('0x53')]]['queuecallerexitreason']=_0x692d('0x52');}if(!_[_0x692d('0x18')](queues[_0x3698f8[_0x692d('0x50')]])){if(_0x3698f8[_0x692d('0x5c')]&&queues[_0x3698f8['transfertargetlinkedid']]){queues[_0x3698f8['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x3698f8[_0x692d('0x55')]]=_['clone'](queues[_0x3698f8[_0x692d('0x5c')]]);queues[_0x3698f8[_0x692d('0x55')]]['transfereduniqueid']=_0x3698f8[_0x692d('0x55')];queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0x21')]=0x2;queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0x5')]=queues[_0x3698f8[_0x692d('0x53')]][_0x692d('0x5')];queues[_0x3698f8[_0x692d('0x55')]]['calleridname']=queues[_0x3698f8['origtransfererlinkedid']][_0x692d('0x56')];queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0x35')]=utils[_0x692d('0x14')]();queues[_0x3698f8['transfertargetuniqueid']][_0x692d('0x33')]=utils[_0x692d('0x14')]();queues[_0x3698f8['transfertargetuniqueid']][_0x692d('0x34')]=0x0;queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0x5d')]=0x0;utils[_0x692d('0x2')](util['format'](_0x692d('0x5e'),_0x3698f8[_0x692d('0x4f')],queues[_0x3698f8[_0x692d('0x55')]]['name'],queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0xe')],queues[_0x3698f8[_0x692d('0x55')]][_0x692d('0x5')],queues[_0x3698f8['transfertargetuniqueid']][_0x692d('0x56')]));}else{utils[_0x692d('0x2')](util[_0x692d('0x3')](_0x692d('0x58'),_0x3698f8['origtransfereruniqueid'],queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0x28')],_0x3698f8[_0x692d('0x53')]));queues[_0x3698f8[_0x692d('0x50')]][_0x692d('0xe')]=_0x3698f8[_0x692d('0x53')];}}}}catch(_0x576552){utils[_0x692d('0x15')](util[_0x692d('0x3')](_0x692d('0x5f'),_0x3698f8[_0x692d('0x4f')]),_0x576552);}};exports['musiconholdstart']=function(_0x58944a){try{if(!_[_0x692d('0x18')](queues[_0x58944a[_0x692d('0xf')]])){utils[_0x692d('0x19')](util[_0x692d('0x3')]('[%s][queues][musiconholdstart]',_0x58944a[_0x692d('0xf')]),_0x58944a);queues[_0x58944a['uniqueid']][_0x692d('0x60')]=utils[_0x692d('0x14')]();utils[_0x692d('0x2')](util[_0x692d('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x58944a[_0x692d('0xf')],queues[_0x58944a[_0x692d('0xf')]][_0x692d('0x28')],queues[_0x58944a[_0x692d('0xf')]][_0x692d('0x60')]));}}catch(_0x1f6979){utils['error'](util[_0x692d('0x3')](_0x692d('0x61'),_0x58944a['uniqueid']),_0x1f6979);}};exports[_0x692d('0x62')]=function(_0x1a9314){try{if(!_['isNil'](queues[_0x1a9314[_0x692d('0xf')]])){if(!_[_0x692d('0x18')](queues[_0x1a9314[_0x692d('0xf')]][_0x692d('0x60')])){utils[_0x692d('0x19')](util['format'](_0x692d('0x63'),_0x1a9314[_0x692d('0xf')]),_0x1a9314);queues[_0x1a9314[_0x692d('0xf')]][_0x692d('0x5d')]+=utils['diffTime'](utils['now'](),queues[_0x1a9314[_0x692d('0xf')]][_0x692d('0x60')]);utils['info'](util[_0x692d('0x3')](_0x692d('0x64'),_0x1a9314[_0x692d('0xf')],queues[_0x1a9314[_0x692d('0xf')]][_0x692d('0x28')],queues[_0x1a9314[_0x692d('0xf')]][_0x692d('0x5d')]));delete queues[_0x1a9314[_0x692d('0xf')]]['musiconholdstartAt'];}}}catch(_0x16af73){utils[_0x692d('0x15')](util['format'](_0x692d('0x63'),_0x1a9314['uniqueid']),_0x16af73);}}; \ No newline at end of file +var _0xe891=['queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','count','connectedlinenum','agentconnect','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','TRANSFER','COMPLETEDBY','[%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','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname'];(function(_0x39a99a,_0x47eb3d){var _0x297932=function(_0x504de0){while(--_0x504de0){_0x39a99a['push'](_0x39a99a['shift']());}};_0x297932(++_0x47eb3d);}(_0xe891,0x14e));var _0x1e89=function(_0x7d55e7,_0x52e8f6){_0x7d55e7=_0x7d55e7-0x0;var _0x3c7d33=_0xe891[_0x7d55e7];return _0x3c7d33;};'use strict';var _=require('lodash');var util=require(_0x1e89('0x0'));var utils=require(_0x1e89('0x1'));var queues={};function writeDB(_0x1f0c95){utils['info'](util[_0x1e89('0x2')](_0x1e89('0x3'),_0x1f0c95['uniqueid'],_0x1f0c95['channel'],_0x1f0c95[_0x1e89('0x4')],_0x1f0c95['lastAssignedTo'],_0x1f0c95['calleridnum'],_0x1f0c95[_0x1e89('0x5')],_0x1f0c95[_0x1e89('0x6')]));if(_0x1f0c95[_0x1e89('0x4')]){utils['getVoiceQueueByName'](_0x1f0c95[_0x1e89('0x4')])[_0x1e89('0x7')](function(_0x168a7f){if(_0x168a7f){_0x1f0c95[_0x1e89('0x8')]=_0x168a7f[_0x1e89('0x8')];}utils[_0x1e89('0x9')](_0x1e89('0xa'),_0x1f0c95);});}else{utils['request'](_0x1e89('0xa'),_0x1f0c95);}if(_0x1f0c95['transfereduniqueid']){delete queues[_0x1f0c95[_0x1e89('0xb')]];}else{delete queues[_0x1f0c95['uniqueid']];}}exports[_0x1e89('0xc')]=function(_0x52fd92){try{utils['debug'](util[_0x1e89('0x2')]('[%s][queues][queuecallerjoin]',_0x52fd92[_0x1e89('0xd')]),_0x52fd92);utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0xf'),_0x52fd92[_0x1e89('0xd')],_0x52fd92[_0x1e89('0x4')],_0x52fd92[_0x1e89('0x10')]));queues[_0x52fd92[_0x1e89('0xd')]]=_[_0x1e89('0x11')](_0x52fd92,{'originalposition':_0x52fd92[_0x1e89('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x34a90c){utils[_0x1e89('0x12')](util[_0x1e89('0x2')](_0x1e89('0x13'),_0x52fd92[_0x1e89('0xd')]),_0x34a90c);}};exports[_0x1e89('0x14')]=function(_0x5c4988){try{if(!_[_0x1e89('0x15')](queues[_0x5c4988[_0x1e89('0xd')]])){utils[_0x1e89('0x16')](util['format'](_0x1e89('0x17'),_0x5c4988[_0x1e89('0xd')]),_0x5c4988);if(queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x18')]){if(!queues[_0x5c4988['uniqueid']]['queuecallerabandon']&&!queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x19')]){queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x1a')]=!![];queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x1b')]=utils[_0x1e89('0x1c')]();queues[_0x5c4988['uniqueid']][_0x1e89('0x6')]=_0x1e89('0x1d');}utils['info'](util['format'](_0x1e89('0x1e'),_0x5c4988['uniqueid'],queues[_0x5c4988[_0x1e89('0xd')]]['name'],queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x6')]));writeDB(queues[_0x5c4988['uniqueid']]);}else if(queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0xb')]){utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0x1f'),_0x5c4988[_0x1e89('0xd')],queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0x20')],queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0xb')]));queues[queues[_0x5c4988[_0x1e89('0xd')]][_0x1e89('0xb')]]=queues[_0x5c4988[_0x1e89('0xd')]];queues[queues[_0x5c4988[_0x1e89('0xd')]]['transfereduniqueid']][_0x1e89('0x21')]=0x2;delete queues[_0x5c4988[_0x1e89('0xd')]];}}}catch(_0x2c0c1e){utils[_0x1e89('0x12')](util['format'](_0x1e89('0x17'),_0x5c4988[_0x1e89('0xd')]),_0x2c0c1e);}};exports[_0x1e89('0x22')]=function(_0x4a2b63){try{utils[_0x1e89('0x16')](util[_0x1e89('0x2')](_0x1e89('0x23'),_0x4a2b63[_0x1e89('0xd')]),_0x4a2b63);if(!_['isNil'](_0x4a2b63[_0x1e89('0x24')][_0x1e89('0x25')])&&_0x4a2b63[_0x1e89('0x26')]['toUpperCase']()!==_0x1e89('0x27')){if(!_['isNil'](queues[_0x4a2b63['uniqueid']])){queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x28')]=![];queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x29')]=null;queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x19')]=!![];queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x2a')]=utils[_0x1e89('0x1c')]();queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x6')]=_0x4a2b63[_0x1e89('0x26')][_0x1e89('0x2b')]();utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0x2c'),_0x4a2b63[_0x1e89('0xd')],queues[_0x4a2b63['uniqueid']]['name'],_0x4a2b63['value'],queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x6')]));writeDB(queues[_0x4a2b63['uniqueid']]);}}else if(!_['isNil'](_0x4a2b63['variable']['queueposition'])){if(!_['isNil'](queues[_0x4a2b63[_0x1e89('0xd')]])&&!queues[_0x4a2b63['uniqueid']][_0x1e89('0x28')]){queues[_0x4a2b63['uniqueid']][_0x1e89('0x28')]=![];queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x29')]=null;queues[_0x4a2b63['uniqueid']][_0x1e89('0x19')]=!![];queues[_0x4a2b63[_0x1e89('0xd')]][_0x1e89('0x2a')]=utils[_0x1e89('0x1c')]();queues[_0x4a2b63['uniqueid']][_0x1e89('0x6')]=_0x1e89('0x2d');utils['info'](util[_0x1e89('0x2')](_0x1e89('0x2e'),_0x4a2b63[_0x1e89('0xd')],queues[_0x4a2b63[_0x1e89('0xd')]]['name'],_0x4a2b63[_0x1e89('0x26')],queues[_0x4a2b63['uniqueid']]['queuecallerexitreason']));}}}catch(_0x49fab4){utils[_0x1e89('0x12')](util[_0x1e89('0x2')](_0x1e89('0x23'),_0x4a2b63[_0x1e89('0xd')]),_0x49fab4);}};exports[_0x1e89('0x28')]=function(_0x576ba5){try{if(!_[_0x1e89('0x15')](queues[_0x576ba5['uniqueid']])){utils['debug'](util[_0x1e89('0x2')](_0x1e89('0x2f'),_0x576ba5[_0x1e89('0xd')]),_0x576ba5);queues[_0x576ba5[_0x1e89('0xd')]][_0x1e89('0x19')]=![];queues[_0x576ba5[_0x1e89('0xd')]][_0x1e89('0x2a')]=null;queues[_0x576ba5[_0x1e89('0xd')]][_0x1e89('0x28')]=!![];queues[_0x576ba5['uniqueid']]['queuecallerabandonAt']=utils[_0x1e89('0x1c')]();queues[_0x576ba5[_0x1e89('0xd')]]['queuecallerexitreason']=_0x1e89('0x30');utils['info'](util[_0x1e89('0x2')](_0x1e89('0x31'),_0x576ba5[_0x1e89('0xd')],queues[_0x576ba5[_0x1e89('0xd')]][_0x1e89('0x20')],queues[_0x576ba5[_0x1e89('0xd')]][_0x1e89('0x6')]));}}catch(_0x5bf7ee){utils['error'](util[_0x1e89('0x2')](_0x1e89('0x2f'),_0x576ba5[_0x1e89('0xd')]),_0x5bf7ee);}};exports[_0x1e89('0x32')]=function(_0x63c9f4){try{if(!_['isNil'](queues[_0x63c9f4['uniqueid']])){utils['debug'](util[_0x1e89('0x2')](_0x1e89('0x33'),_0x63c9f4['uniqueid']),_0x63c9f4);utils['info'](util[_0x1e89('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x63c9f4[_0x1e89('0xd')],queues[_0x63c9f4[_0x1e89('0xd')]]['name'],_0x63c9f4['connectedlinenum'],_0x63c9f4[_0x1e89('0x34')]));queues[_0x63c9f4[_0x1e89('0xd')]][_0x1e89('0x32')]=!![];queues[_0x63c9f4['uniqueid']][_0x1e89('0x18')]=utils['now']();queues[_0x63c9f4[_0x1e89('0xd')]][_0x1e89('0x35')]=utils['diffTime'](queues[_0x63c9f4['uniqueid']][_0x1e89('0x18')],queues[_0x63c9f4[_0x1e89('0xd')]]['queuecallerjoinAt']);queues[_0x63c9f4[_0x1e89('0xd')]][_0x1e89('0x10')]=_0x63c9f4['position'];queues[_0x63c9f4[_0x1e89('0xd')]][_0x1e89('0x36')]=_0x63c9f4[_0x1e89('0x36')];queues[_0x63c9f4['uniqueid']][_0x1e89('0x37')]=_0x63c9f4['connectedlinenum'];queues[_0x63c9f4[_0x1e89('0xd')]]['connectedlinename']=_0x63c9f4[_0x1e89('0x34')];}}catch(_0x39c077){utils['error'](util['format'](_0x1e89('0x33'),_0x63c9f4['uniqueid']),_0x39c077);}};exports[_0x1e89('0x38')]=function(_0x55983a){try{if(!_[_0x1e89('0x15')](queues[_0x55983a['uniqueid']])){utils[_0x1e89('0x16')](util[_0x1e89('0x2')]('[%s][queues][agentconnect]',_0x55983a[_0x1e89('0xd')]),_0x55983a);utils[_0x1e89('0xe')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x55983a[_0x1e89('0xd')],queues[_0x55983a[_0x1e89('0xd')]][_0x1e89('0x20')],_0x55983a[_0x1e89('0x39')],_0x55983a[_0x1e89('0x3a')]));queues[_0x55983a[_0x1e89('0xd')]][_0x1e89('0x28')]=![];queues[_0x55983a[_0x1e89('0xd')]][_0x1e89('0x28')]=![];queues[_0x55983a[_0x1e89('0xd')]]['queuecallerabandonAt']=null;queues[_0x55983a[_0x1e89('0xd')]]['queuecallerexit']=![];queues[_0x55983a['uniqueid']][_0x1e89('0x6')]=null;queues[_0x55983a['uniqueid']][_0x1e89('0x2a')]=null;queues[_0x55983a[_0x1e89('0xd')]][_0x1e89('0x3b')]=!![];queues[_0x55983a[_0x1e89('0xd')]][_0x1e89('0x5')]=_0x55983a[_0x1e89('0x3a')];queues[_0x55983a['uniqueid']]['lastAssignedTo']=_0x55983a[_0x1e89('0x39')];}}catch(_0x4ebbaa){utils[_0x1e89('0x12')](util[_0x1e89('0x2')](_0x1e89('0x3c'),_0x55983a[_0x1e89('0xd')]),_0x4ebbaa);}};exports[_0x1e89('0x3d')]=function(_0x509bc6){try{if(!_[_0x1e89('0x15')](queues[_0x509bc6[_0x1e89('0xd')]])){if(queues[_0x509bc6['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x1e89('0x2')](_0x1e89('0x3e'),_0x509bc6[_0x1e89('0xd')]),_0x509bc6);queues[_0x509bc6['uniqueid']][_0x1e89('0x28')]=![];queues[_0x509bc6[_0x1e89('0xd')]]['queuecallerabandon']=![];queues[_0x509bc6[_0x1e89('0xd')]]['queuecallerabandonAt']=null;queues[_0x509bc6['uniqueid']][_0x1e89('0x19')]=![];queues[_0x509bc6['uniqueid']][_0x1e89('0x2a')]=null;queues[_0x509bc6[_0x1e89('0xd')]][_0x1e89('0x3b')]=!![];queues[_0x509bc6['uniqueid']][_0x1e89('0x3f')]=_0x509bc6[_0x1e89('0x39')];queues[_0x509bc6['uniqueid']]['queuecallercomplete']=!![];queues[_0x509bc6[_0x1e89('0xd')]]['queuecallercompleteAt']=utils[_0x1e89('0x1c')]();if(_0x509bc6[_0x1e89('0x40')]==_0x1e89('0x41')){if(!queues[_0x509bc6[_0x1e89('0xd')]][_0x1e89('0x41')]){queues[_0x509bc6[_0x1e89('0xd')]][_0x1e89('0x6')]=_0x1e89('0x42');}}else{queues[_0x509bc6[_0x1e89('0xd')]][_0x1e89('0x6')]=_0x1e89('0x43')+_0x509bc6['reason'][_0x1e89('0x2b')]();}utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0x44'),_0x509bc6[_0x1e89('0xd')],queues[_0x509bc6[_0x1e89('0xd')]][_0x1e89('0x20')],_0x509bc6[_0x1e89('0x39')],queues[_0x509bc6['uniqueid']][_0x1e89('0x6')]));writeDB(queues[_0x509bc6[_0x1e89('0xd')]]);}}}catch(_0x3dfd69){utils['error'](util[_0x1e89('0x2')](_0x1e89('0x3e'),_0x509bc6[_0x1e89('0xd')]),_0x3dfd69);}};exports[_0x1e89('0x45')]=function(_0x49b967){try{if(!_[_0x1e89('0x15')](queues[_0x49b967[_0x1e89('0x46')]])){utils['debug'](util['format'](_0x1e89('0x47'),_0x49b967['uniqueid']),_0x49b967);queues[_0x49b967['transfereeuniqueid']][_0x1e89('0x41')]=!![];queues[_0x49b967[_0x1e89('0x46')]][_0x1e89('0x48')]='BLIND';queues[_0x49b967[_0x1e89('0x46')]][_0x1e89('0x49')]=_0x49b967[_0x1e89('0x4a')];queues[_0x49b967[_0x1e89('0x46')]][_0x1e89('0x4b')]=_0x49b967[_0x1e89('0x46')];queues[_0x49b967[_0x1e89('0x46')]][_0x1e89('0x6')]=_0x1e89('0x4c');utils[_0x1e89('0xe')](util['format'](_0x1e89('0x4d'),_0x49b967[_0x1e89('0xd')],queues[_0x49b967[_0x1e89('0x46')]]['name'],_0x49b967['transfereeuniqueid'],_0x49b967[_0x1e89('0x4a')]));}}catch(_0x37d0b2){utils['error'](util[_0x1e89('0x2')](_0x1e89('0x47'),_0x49b967[_0x1e89('0xd')]),_0x37d0b2);}};exports[_0x1e89('0x4e')]=function(_0x31651d){try{utils['debug'](util[_0x1e89('0x2')](_0x1e89('0x4f'),_0x31651d[_0x1e89('0x50')]),_0x31651d);if(_0x31651d[_0x1e89('0x50')]==_0x31651d[_0x1e89('0x51')]){if(!_[_0x1e89('0x15')](queues[_0x31651d[_0x1e89('0x52')]])){utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0x53'),_0x31651d[_0x1e89('0x50')],queues[_0x31651d[_0x1e89('0x52')]]['name'],_0x31651d['origtransfererexten']));queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0x41')]=!![];queues[_0x31651d['secondtransfererlinkedid']][_0x1e89('0x48')]=_0x1e89('0x54');queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0x49')]=_0x31651d[_0x1e89('0x55')];queues[_0x31651d[_0x1e89('0x52')]]['transferuniqueid']=_0x31651d[_0x1e89('0x50')];queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0x6')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x31651d[_0x1e89('0x51')]])){if(_0x31651d[_0x1e89('0x56')]&&queues[_0x31651d[_0x1e89('0x56')]]){queues[_0x31651d[_0x1e89('0x56')]][_0x1e89('0x21')]=0x1;queues[_0x31651d[_0x1e89('0x46')]]=_['clone'](queues[_0x31651d[_0x1e89('0x56')]]);queues[_0x31651d[_0x1e89('0x46')]]['transfereduniqueid']=_0x31651d[_0x1e89('0x57')];queues[_0x31651d[_0x1e89('0x46')]][_0x1e89('0x21')]=0x2;queues[_0x31651d['transfereeuniqueid']][_0x1e89('0x58')]=queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0x58')];queues[_0x31651d[_0x1e89('0x46')]][_0x1e89('0x59')]=queues[_0x31651d['secondtransfererlinkedid']][_0x1e89('0x59')];queues[_0x31651d[_0x1e89('0x46')]][_0x1e89('0x5a')]=utils[_0x1e89('0x1c')]();queues[_0x31651d['transfereeuniqueid']][_0x1e89('0x18')]=utils[_0x1e89('0x1c')]();queues[_0x31651d['transfereeuniqueid']]['holdtime']=0x0;queues[_0x31651d[_0x1e89('0x46')]][_0x1e89('0x5b')]=0x0;utils[_0x1e89('0xe')](util[_0x1e89('0x2')](_0x1e89('0x5c'),_0x31651d[_0x1e89('0x50')],queues[_0x31651d['transfereeuniqueid']][_0x1e89('0x20')],queues[_0x31651d[_0x1e89('0x46')]][_0x1e89('0x58')],queues[_0x31651d[_0x1e89('0x46')]]['calleridname']));}else{utils[_0x1e89('0xe')](util[_0x1e89('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x31651d['origtransfereruniqueid'],queues[_0x31651d[_0x1e89('0x51')]]['name'],_0x31651d[_0x1e89('0x52')]));queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0xb')]=_0x31651d[_0x1e89('0x52')];}}}else if(_0x31651d[_0x1e89('0x5d')]==_0x31651d[_0x1e89('0x52')]){if(!_['isNil'](queues[_0x31651d[_0x1e89('0x51')]])){utils[_0x1e89('0xe')](util['format'](_0x1e89('0x5e'),_0x31651d[_0x1e89('0x50')],queues[_0x31651d['origtransfererlinkedid']][_0x1e89('0x20')],_0x31651d['secondtransfereruniqueid'],_0x31651d['secondtransfererexten']));queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0x41')]=!![];queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0x48')]=_0x1e89('0x54');queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0x49')]=_0x31651d['secondtransfererexten'];queues[_0x31651d['origtransfererlinkedid']][_0x1e89('0x4b')]=_0x31651d[_0x1e89('0x5d')];queues[_0x31651d['origtransfererlinkedid']]['queuecallerexitreason']=_0x1e89('0x5f');}if(!_[_0x1e89('0x15')](queues[_0x31651d[_0x1e89('0x52')]])){if(_0x31651d[_0x1e89('0x60')]&&queues[_0x31651d[_0x1e89('0x60')]]){queues[_0x31651d[_0x1e89('0x60')]][_0x1e89('0x21')]=0x1;queues[_0x31651d[_0x1e89('0x57')]]=_[_0x1e89('0x61')](queues[_0x31651d[_0x1e89('0x60')]]);queues[_0x31651d[_0x1e89('0x57')]]['transfereduniqueid']=_0x31651d[_0x1e89('0x57')];queues[_0x31651d[_0x1e89('0x57')]][_0x1e89('0x21')]=0x2;queues[_0x31651d[_0x1e89('0x57')]]['calleridnum']=queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0x58')];queues[_0x31651d['transfertargetuniqueid']][_0x1e89('0x59')]=queues[_0x31651d[_0x1e89('0x51')]][_0x1e89('0x59')];queues[_0x31651d[_0x1e89('0x57')]]['queuecallerjoinAt']=utils[_0x1e89('0x1c')]();queues[_0x31651d[_0x1e89('0x57')]]['queuecallerleaveAt']=utils['now']();queues[_0x31651d[_0x1e89('0x57')]][_0x1e89('0x35')]=0x0;queues[_0x31651d[_0x1e89('0x57')]]['mohtime']=0x0;utils['info'](util[_0x1e89('0x2')](_0x1e89('0x62'),_0x31651d[_0x1e89('0x50')],queues[_0x31651d['transfertargetuniqueid']][_0x1e89('0x20')],queues[_0x31651d['transfertargetuniqueid']][_0x1e89('0xb')],queues[_0x31651d[_0x1e89('0x57')]][_0x1e89('0x58')],queues[_0x31651d[_0x1e89('0x57')]]['calleridname']));}else{utils[_0x1e89('0xe')](util[_0x1e89('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x31651d[_0x1e89('0x50')],queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0x20')],_0x31651d['origtransfererlinkedid']));queues[_0x31651d[_0x1e89('0x52')]][_0x1e89('0xb')]=_0x31651d[_0x1e89('0x51')];}}}}catch(_0x121c4f){utils[_0x1e89('0x12')](util[_0x1e89('0x2')](_0x1e89('0x4f'),_0x31651d[_0x1e89('0x50')]),_0x121c4f);}};exports[_0x1e89('0x63')]=function(_0x41aa51){try{if(!_['isNil'](queues[_0x41aa51[_0x1e89('0xd')]])){utils[_0x1e89('0x16')](util[_0x1e89('0x2')](_0x1e89('0x64'),_0x41aa51[_0x1e89('0xd')]),_0x41aa51);queues[_0x41aa51[_0x1e89('0xd')]][_0x1e89('0x65')]=utils[_0x1e89('0x1c')]();utils['info'](util['format'](_0x1e89('0x66'),_0x41aa51[_0x1e89('0xd')],queues[_0x41aa51['uniqueid']][_0x1e89('0x20')],queues[_0x41aa51[_0x1e89('0xd')]]['musiconholdstartAt']));}}catch(_0x48c085){utils[_0x1e89('0x12')](util[_0x1e89('0x2')](_0x1e89('0x64'),_0x41aa51['uniqueid']),_0x48c085);}};exports[_0x1e89('0x67')]=function(_0x36a356){try{if(!_[_0x1e89('0x15')](queues[_0x36a356[_0x1e89('0xd')]])){if(!_[_0x1e89('0x15')](queues[_0x36a356[_0x1e89('0xd')]][_0x1e89('0x65')])){utils[_0x1e89('0x16')](util['format'](_0x1e89('0x68'),_0x36a356[_0x1e89('0xd')]),_0x36a356);queues[_0x36a356[_0x1e89('0xd')]][_0x1e89('0x5b')]+=utils[_0x1e89('0x69')](utils[_0x1e89('0x1c')](),queues[_0x36a356[_0x1e89('0xd')]][_0x1e89('0x65')]);utils[_0x1e89('0xe')](util[_0x1e89('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x36a356[_0x1e89('0xd')],queues[_0x36a356[_0x1e89('0xd')]][_0x1e89('0x20')],queues[_0x36a356[_0x1e89('0xd')]][_0x1e89('0x5b')]));delete queues[_0x36a356['uniqueid']][_0x1e89('0x65')];}}}catch(_0x364210){utils[_0x1e89('0x12')](util[_0x1e89('0x2')]('[%s][queues][musiconholdstop]',_0x36a356[_0x1e89('0xd')]),_0x364210);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ca7fbea..1f8f640 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 _0x5afa=['membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then'];(function(_0x263d03,_0x4bf63e){var _0x3fea0d=function(_0x3a6267){while(--_0x3a6267){_0x263d03['push'](_0x263d03['shift']());}};_0x3fea0d(++_0x4bf63e);}(_0x5afa,0x138));var _0xa5af=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x5afa[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa5af('0x0'));var recordings={};function writeDB(_0x252248){utils[_0xa5af('0x1')](util[_0xa5af('0x2')](_0xa5af('0x3'),_0x252248[_0xa5af('0x4')]));if(_0x252248[_0xa5af('0x5')]){utils[_0xa5af('0x6')](_0x252248[_0xa5af('0x5')])[_0xa5af('0x7')](function(_0x1f1994){if(_0x1f1994){_0x252248[_0xa5af('0x8')]=_0x1f1994[_0xa5af('0x9')];_0x252248[_0xa5af('0xa')]=_0x1f1994['id'];}utils[_0xa5af('0xb')]('CreateVoiceRecording',_0x252248);});}else{utils[_0xa5af('0xb')](_0xa5af('0xc'),_0x252248);}}exports[_0xa5af('0xd')]=function(_0x11cdcc){try{utils[_0xa5af('0xe')](util[_0xa5af('0x2')](_0xa5af('0xf'),_0x11cdcc['uniqueid']),_0x11cdcc);if(_0x11cdcc[_0xa5af('0x4')]==_0x11cdcc[_0xa5af('0x10')]){utils[_0xa5af('0x1')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x11cdcc[_0xa5af('0x4')],_0x11cdcc[_0xa5af('0x11')],_0x11cdcc['exten']));recordings[_0x11cdcc[_0xa5af('0x4')]]={'uniqueid':_0x11cdcc[_0xa5af('0x4')],'accountcode':_0x11cdcc[_0xa5af('0x5')],'exten':_0x11cdcc['exten'],'context':_0x11cdcc[_0xa5af('0x11')],'channel':_0x11cdcc[_0xa5af('0x12')],'monitors':[]};}}catch(_0x9cf344){utils[_0xa5af('0x13')](util['format']('[%s][recordings][newchannel]',_0x11cdcc['uniqueid']),_0x9cf344);}};exports[_0xa5af('0x14')]=function(_0x4c0356){try{utils[_0xa5af('0xe')](util['format'](_0xa5af('0x15'),_0x4c0356[_0xa5af('0x4')]),_0x4c0356);if(!_[_0xa5af('0x16')](recordings[_0x4c0356[_0xa5af('0x4')]])&&_0x4c0356[_0xa5af('0x17')]==0x6){utils[_0xa5af('0x1')](util[_0xa5af('0x2')](_0xa5af('0x18'),_0x4c0356[_0xa5af('0x4')],_0x4c0356[_0xa5af('0x11')],_0x4c0356[_0xa5af('0x12')]));}else if(!_[_0xa5af('0x16')](recordings[_0x4c0356['linkedid']])&&_0x4c0356[_0xa5af('0x17')]==0x6&&_0x4c0356[_0xa5af('0x11')]!=_0xa5af('0x19')){utils[_0xa5af('0x1')](util[_0xa5af('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4c0356[_0xa5af('0x4')],_0x4c0356[_0xa5af('0x10')],_0x4c0356['context'],_0x4c0356[_0xa5af('0x12')]));recordings[_0x4c0356[_0xa5af('0x10')]]['accountcode']=_0x4c0356[_0xa5af('0x5')];}}catch(_0x53e53b){utils[_0xa5af('0x13')](util[_0xa5af('0x2')](_0xa5af('0x15'),_0x4c0356['uniqueid']),_0x53e53b);}};exports['varset']=function(_0x1603ef){try{if(!_[_0xa5af('0x16')](_0x1603ef[_0xa5af('0x1a')])&&!_['isNil'](_0x1603ef[_0xa5af('0x1a')][_0xa5af('0x1b')])){utils[_0xa5af('0xe')](util[_0xa5af('0x2')]('[%s][recordings][varset]',_0x1603ef[_0xa5af('0x4')]),_0x1603ef);utils[_0xa5af('0x1')](util['format'](_0xa5af('0x1c'),_0x1603ef['uniqueid'],_0x1603ef[_0xa5af('0x1a')],_0x1603ef['value']));if(_[_0xa5af('0x1d')](_0x1603ef[_0xa5af('0x1e')],_0xa5af('0x1f'))){_0x1603ef[_0xa5af('0x1e')]=_0x1603ef[_0xa5af('0x1e')][_0xa5af('0x20')](_0xa5af('0x1f'),_0xa5af('0x21'));}if(recordings[_0x1603ef['linkedid']]){var _0x4d81cc=_[_0xa5af('0x22')](recordings[_0x1603ef[_0xa5af('0x10')]][_0xa5af('0x23')],{'value':_0x1603ef[_0xa5af('0x1e')]});if(_[_0xa5af('0x16')](_0x4d81cc)){recordings[_0x1603ef[_0xa5af('0x10')]][_0xa5af('0x23')]['push']({'value':_0x1603ef[_0xa5af('0x1e')]});}}}}catch(_0x4ba5b3){utils[_0xa5af('0x13')](util[_0xa5af('0x2')](_0xa5af('0x24'),_0x1603ef['uniqueid']),_0x4ba5b3);}};exports[_0xa5af('0x25')]=function(_0x30005b){try{if(!_[_0xa5af('0x16')](recordings[_0x30005b[_0xa5af('0x4')]])){utils['debug'](util[_0xa5af('0x2')](_0xa5af('0x26'),_0x30005b[_0xa5af('0x4')]),_0x30005b);utils['info'](util[_0xa5af('0x2')](_0xa5af('0x27'),_0x30005b[_0xa5af('0x4')],_0x30005b[_0xa5af('0x28')],_0x30005b[_0xa5af('0x29')],_0x30005b[_0xa5af('0x2a')]));recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x28')]=_0x30005b[_0xa5af('0x28')];recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x29')]=_0x30005b[_0xa5af('0x29')];recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x2b')]=_0x30005b[_0xa5af('0x2b')];recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x2c')]=_0x30005b[_0xa5af('0x2c')];if(recordings[_0x30005b[_0xa5af('0x4')]]['type']==_0xa5af('0x2d')&&recordings[_0x30005b['uniqueid']][_0xa5af('0x5')]){recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x2b')]=recordings[_0x30005b[_0xa5af('0x4')]][_0xa5af('0x5')];recordings[_0x30005b[_0xa5af('0x4')]]['connectedlinename']='';}recordings[_0x30005b['uniqueid']][_0xa5af('0x23')][_0xa5af('0x2e')](function(_0x30d09b){var _0xa2170c=_[_0xa5af('0x2f')](recordings[_0x30005b['uniqueid']]);_0xa2170c[_0xa5af('0x1e')]=_0x30d09b['value'];writeDB(_0xa2170c);});delete recordings[_0x30005b[_0xa5af('0x4')]];}}catch(_0x5c5b46){utils[_0xa5af('0x13')](util[_0xa5af('0x2')](_0xa5af('0x26'),_0x30005b[_0xa5af('0x4')]),_0x5c5b46);}};exports[_0xa5af('0x30')]=function(_0x366604){try{if(!_[_0xa5af('0x16')](recordings[_0x366604['uniqueid']])){utils[_0xa5af('0xe')](util[_0xa5af('0x2')](_0xa5af('0x31'),_0x366604[_0xa5af('0x4')]),_0x366604);utils[_0xa5af('0x1')](util[_0xa5af('0x2')](_0xa5af('0x32'),_0x366604[_0xa5af('0x4')],_0x366604[_0xa5af('0x33')],_0x366604['appdata']));if(_0x366604[_0xa5af('0x33')][_0xa5af('0x34')]()==_0xa5af('0x35')&&_[_0xa5af('0x36')](_0x366604[_0xa5af('0x37')][_0xa5af('0x34')](),_0xa5af('0x38'))){var _0xfb2838=_0x366604[_0xa5af('0x37')][_0xa5af('0x39')]('=');var _0x5cccdd=_0xfb2838[0x0][_0xa5af('0x3a')](_0xfb2838[0x0][_0xa5af('0x3b')]('(')+0x1,_0xfb2838[0x0][_0xa5af('0x3b')](')'));var _0x205e92=_0xfb2838[0x1];recordings[_0x366604['uniqueid']][_0x5cccdd]=_0x205e92;}}}catch(_0x41dc31){utils[_0xa5af('0x13')](util[_0xa5af('0x2')](_0xa5af('0x31'),_0x366604[_0xa5af('0x4')]),_0x41dc31);}};exports[_0xa5af('0x3c')]=function(_0x2b47c0){try{if(!_[_0xa5af('0x16')](recordings[_0x2b47c0[_0xa5af('0x4')]])){utils[_0xa5af('0xe')](util[_0xa5af('0x2')](_0xa5af('0x3d'),_0x2b47c0['uniqueid']),_0x2b47c0);utils['info'](util[_0xa5af('0x2')](_0xa5af('0x3e'),_0x2b47c0[_0xa5af('0x4')],_0x2b47c0[_0xa5af('0x3f')]));recordings[_0x2b47c0[_0xa5af('0x4')]][_0xa5af('0x3f')]=_0x2b47c0['queue'];}}catch(_0xa80548){utils['error'](util[_0xa5af('0x2')](_0xa5af('0x3d'),_0x2b47c0[_0xa5af('0x4')]),_0xa80548);}}; \ No newline at end of file +var _0x7171=['connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname'];(function(_0x5da86c,_0x58db33){var _0x31c64e=function(_0x4e3308){while(--_0x4e3308){_0x5da86c['push'](_0x5da86c['shift']());}};_0x31c64e(++_0x58db33);}(_0x7171,0x105));var _0x1717=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x7171[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x1717('0x0'));var util=require(_0x1717('0x1'));var utils=require(_0x1717('0x2'));var recordings={};function writeDB(_0x2a5947){utils[_0x1717('0x3')](util[_0x1717('0x4')](_0x1717('0x5'),_0x2a5947[_0x1717('0x6')]));if(_0x2a5947[_0x1717('0x7')]){utils[_0x1717('0x8')](_0x2a5947[_0x1717('0x7')])['then'](function(_0xf7ffe9){if(_0xf7ffe9){_0x2a5947[_0x1717('0x9')]=_0xf7ffe9[_0x1717('0xa')];_0x2a5947[_0x1717('0xb')]=_0xf7ffe9['id'];}utils[_0x1717('0xc')](_0x1717('0xd'),_0x2a5947);});}else{utils['request']('CreateVoiceRecording',_0x2a5947);}}exports['newchannel']=function(_0x3d5168){try{utils[_0x1717('0xe')](util[_0x1717('0x4')]('[%s][recordings][newchannel]',_0x3d5168[_0x1717('0x6')]),_0x3d5168);if(_0x3d5168[_0x1717('0x6')]==_0x3d5168[_0x1717('0xf')]){utils[_0x1717('0x3')](util[_0x1717('0x4')](_0x1717('0x10'),_0x3d5168[_0x1717('0x6')],_0x3d5168[_0x1717('0x11')],_0x3d5168[_0x1717('0x12')]));recordings[_0x3d5168[_0x1717('0x6')]]={'uniqueid':_0x3d5168['uniqueid'],'accountcode':_0x3d5168[_0x1717('0x7')],'exten':_0x3d5168[_0x1717('0x12')],'context':_0x3d5168[_0x1717('0x11')],'channel':_0x3d5168[_0x1717('0x13')],'monitors':[]};}}catch(_0x25b6d0){utils[_0x1717('0x14')](util[_0x1717('0x4')](_0x1717('0x15'),_0x3d5168[_0x1717('0x6')]),_0x25b6d0);}};exports[_0x1717('0x16')]=function(_0x131379){try{utils[_0x1717('0xe')](util[_0x1717('0x4')](_0x1717('0x17'),_0x131379[_0x1717('0x6')]),_0x131379);if(!_[_0x1717('0x18')](recordings[_0x131379['uniqueid']])&&_0x131379[_0x1717('0x19')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x131379['uniqueid'],_0x131379[_0x1717('0x11')],_0x131379[_0x1717('0x13')]));}else if(!_[_0x1717('0x18')](recordings[_0x131379[_0x1717('0xf')]])&&_0x131379[_0x1717('0x19')]==0x6&&_0x131379[_0x1717('0x11')]!=_0x1717('0x1a')){utils[_0x1717('0x3')](util[_0x1717('0x4')](_0x1717('0x1b'),_0x131379[_0x1717('0x6')],_0x131379['linkedid'],_0x131379[_0x1717('0x11')],_0x131379[_0x1717('0x13')]));recordings[_0x131379['linkedid']][_0x1717('0x7')]=_0x131379[_0x1717('0x7')];}}catch(_0x45688a){utils[_0x1717('0x14')](util[_0x1717('0x4')](_0x1717('0x17'),_0x131379[_0x1717('0x6')]),_0x45688a);}};exports[_0x1717('0x1c')]=function(_0x2167b9){try{if(!_[_0x1717('0x18')](_0x2167b9['variable'])&&!_[_0x1717('0x18')](_0x2167b9[_0x1717('0x1d')][_0x1717('0x1e')])){utils[_0x1717('0xe')](util[_0x1717('0x4')](_0x1717('0x1f'),_0x2167b9[_0x1717('0x6')]),_0x2167b9);utils[_0x1717('0x3')](util[_0x1717('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2167b9['uniqueid'],_0x2167b9[_0x1717('0x1d')],_0x2167b9['value']));if(_[_0x1717('0x20')](_0x2167b9[_0x1717('0x21')],_0x1717('0x22'))){_0x2167b9[_0x1717('0x21')]=_0x2167b9['value']['replace'](_0x1717('0x22'),_0x1717('0x23'));}if(recordings[_0x2167b9[_0x1717('0xf')]]){var _0x4d8e4e=_[_0x1717('0x24')](recordings[_0x2167b9[_0x1717('0xf')]][_0x1717('0x25')],{'value':_0x2167b9[_0x1717('0x21')]});if(_[_0x1717('0x18')](_0x4d8e4e)){recordings[_0x2167b9[_0x1717('0xf')]][_0x1717('0x25')][_0x1717('0x26')]({'value':_0x2167b9[_0x1717('0x21')]});}}}}catch(_0x4c4277){utils['error'](util[_0x1717('0x4')]('[%s][recordings][varset]',_0x2167b9['uniqueid']),_0x4c4277);}};exports[_0x1717('0x27')]=function(_0x16cb91){try{if(!_[_0x1717('0x18')](recordings[_0x16cb91['uniqueid']])){utils[_0x1717('0xe')](util[_0x1717('0x4')](_0x1717('0x28'),_0x16cb91['uniqueid']),_0x16cb91);utils[_0x1717('0x3')](util[_0x1717('0x4')](_0x1717('0x29'),_0x16cb91[_0x1717('0x6')],_0x16cb91[_0x1717('0x2a')],_0x16cb91[_0x1717('0x2b')],_0x16cb91['cause-txt']));recordings[_0x16cb91[_0x1717('0x6')]][_0x1717('0x2a')]=_0x16cb91[_0x1717('0x2a')];recordings[_0x16cb91['uniqueid']][_0x1717('0x2b')]=_0x16cb91[_0x1717('0x2b')];recordings[_0x16cb91[_0x1717('0x6')]][_0x1717('0x2c')]=_0x16cb91[_0x1717('0x2c')];recordings[_0x16cb91[_0x1717('0x6')]]['connectedlinename']=_0x16cb91[_0x1717('0x2d')];if(recordings[_0x16cb91[_0x1717('0x6')]][_0x1717('0x2e')]==_0x1717('0x2f')&&recordings[_0x16cb91['uniqueid']][_0x1717('0x7')]){recordings[_0x16cb91['uniqueid']][_0x1717('0x2c')]=recordings[_0x16cb91['uniqueid']][_0x1717('0x7')];recordings[_0x16cb91[_0x1717('0x6')]][_0x1717('0x2d')]='';}recordings[_0x16cb91['uniqueid']]['monitors'][_0x1717('0x30')](function(_0x3cb807){var _0x5a4c70=_[_0x1717('0x31')](recordings[_0x16cb91[_0x1717('0x6')]]);_0x5a4c70['value']=_0x3cb807[_0x1717('0x21')];writeDB(_0x5a4c70);});delete recordings[_0x16cb91[_0x1717('0x6')]];}}catch(_0x223895){utils[_0x1717('0x14')](util['format'](_0x1717('0x28'),_0x16cb91['uniqueid']),_0x223895);}};exports[_0x1717('0x32')]=function(_0x49ef08){try{if(!_[_0x1717('0x18')](recordings[_0x49ef08[_0x1717('0x6')]])){utils[_0x1717('0xe')](util[_0x1717('0x4')](_0x1717('0x33'),_0x49ef08[_0x1717('0x6')]),_0x49ef08);utils[_0x1717('0x3')](util[_0x1717('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x49ef08['uniqueid'],_0x49ef08[_0x1717('0x34')],_0x49ef08[_0x1717('0x35')]));if(_0x49ef08[_0x1717('0x34')][_0x1717('0x36')]()==_0x1717('0x37')&&_[_0x1717('0x38')](_0x49ef08[_0x1717('0x35')][_0x1717('0x36')](),_0x1717('0x39'))){var _0x276820=_0x49ef08['appdata']['split']('=');var _0x2c64b4=_0x276820[0x0]['substring'](_0x276820[0x0][_0x1717('0x3a')]('(')+0x1,_0x276820[0x0][_0x1717('0x3a')](')'));var _0xec04f5=_0x276820[0x1];recordings[_0x49ef08[_0x1717('0x6')]][_0x2c64b4]=_0xec04f5;}}}catch(_0x1a8b33){utils[_0x1717('0x14')](util[_0x1717('0x4')](_0x1717('0x33'),_0x49ef08[_0x1717('0x6')]),_0x1a8b33);}};exports['queuecallerjoin']=function(_0x181b57){try{if(!_[_0x1717('0x18')](recordings[_0x181b57[_0x1717('0x6')]])){utils[_0x1717('0xe')](util[_0x1717('0x4')](_0x1717('0x3b'),_0x181b57[_0x1717('0x6')]),_0x181b57);utils[_0x1717('0x3')](util[_0x1717('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x181b57[_0x1717('0x6')],_0x181b57[_0x1717('0x3c')]));recordings[_0x181b57[_0x1717('0x6')]][_0x1717('0x3c')]=_0x181b57[_0x1717('0x3c')];}}catch(_0x5447d3){utils[_0x1717('0x14')](util[_0x1717('0x4')](_0x1717('0x3b'),_0x181b57[_0x1717('0x6')]),_0x5447d3);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 33d443c..49194e0 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 _0xefc5=['attended','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfereruniqueid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x3d3697,_0x313e64){var _0x2d90d4=function(_0x5934f5){while(--_0x5934f5){_0x3d3697['push'](_0x3d3697['shift']());}};_0x2d90d4(++_0x313e64);}(_0xefc5,0x85));var _0x5efc=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xefc5[_0x4cf8d4];return _0x2c1beb;};'use strict';var _=require(_0x5efc('0x0'));var util=require(_0x5efc('0x1'));var utils=require('./utils');function writeDB(_0xdc27d1){utils[_0x5efc('0x2')](util[_0x5efc('0x3')](_0x5efc('0x4'),_0xdc27d1[_0x5efc('0x5')]==='attended'?_0xdc27d1['origtransfereruniqueid']:_0xdc27d1[_0x5efc('0x6')],_0xdc27d1[_0x5efc('0x5')]));utils[_0x5efc('0x7')]('CreateVoiceTransferReport',_0xdc27d1);}exports[_0x5efc('0x8')]=function(_0x802f7f){try{utils[_0x5efc('0x9')](util[_0x5efc('0x3')](_0x5efc('0xa'),_0x802f7f['uniqueid']),_0x802f7f);utils[_0x5efc('0x2')](util[_0x5efc('0x3')](_0x5efc('0xb'),_0x802f7f['uniqueid'],_0x802f7f[_0x5efc('0xc')],_0x802f7f['transferercalleridname'],_0x802f7f[_0x5efc('0xd')],_0x802f7f['transfereecalleridname']));_0x802f7f[_0x5efc('0x5')]=_0x5efc('0xe');writeDB(_0x802f7f);}catch(_0x3e4e0b){utils[_0x5efc('0xf')](util[_0x5efc('0x3')](_0x5efc('0xa'),_0x802f7f[_0x5efc('0x6')]),_0x3e4e0b);}};exports[_0x5efc('0x10')]=function(_0x4d937d){try{utils['debug'](util[_0x5efc('0x3')](_0x5efc('0x11'),_0x4d937d['origtransfereruniqueid']),_0x4d937d);utils[_0x5efc('0x2')](util[_0x5efc('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4d937d['origtransfereruniqueid'],_0x4d937d['origtransferercalleridnum'],_0x4d937d[_0x5efc('0x12')],_0x4d937d[_0x5efc('0x13')],_0x4d937d[_0x5efc('0x14')]));_0x4d937d=_[_0x5efc('0x15')](_0x4d937d,{'transfererchannel':_0x4d937d[_0x5efc('0x16')],'transferercalleridnum':_0x4d937d[_0x5efc('0x17')],'transferercalleridname':_0x4d937d[_0x5efc('0x12')],'transfererconnectedlinenum':_0x4d937d[_0x5efc('0x18')],'transfererconnectedlinename':_0x4d937d[_0x5efc('0x19')],'transfereraccountcode':_0x4d937d[_0x5efc('0x1a')],'transferercontext':_0x4d937d[_0x5efc('0x1b')],'transfererexten':_0x4d937d[_0x5efc('0x1c')],'transfererlinkedid':_0x4d937d[_0x5efc('0x1d')],'context':_0x4d937d[_0x5efc('0x1e')],'extension':_0x4d937d['origtransfererexten'],'type':_0x5efc('0x1f')});if(_['isNil'](_0x4d937d[_0x5efc('0x20')])){_0x4d937d=_[_0x5efc('0x15')](_0x4d937d,{'transfereechannel':_0x4d937d[_0x5efc('0x21')],'transfereecalleridnum':_0x4d937d[_0x5efc('0x13')],'transfereecalleridname':_0x4d937d[_0x5efc('0x14')],'transfereeconnectedlinenum':_0x4d937d[_0x5efc('0x22')],'transfereeconnectedlinename':_0x4d937d[_0x5efc('0x23')],'transfereeaccountcode':_0x4d937d[_0x5efc('0x24')],'transfereecontext':_0x4d937d[_0x5efc('0x25')],'transfereeexten':_0x4d937d[_0x5efc('0x26')],'transfereelinkedid':_0x4d937d[_0x5efc('0x27')]});}writeDB(_0x4d937d);}catch(_0x48aaa2){utils[_0x5efc('0xf')](util[_0x5efc('0x3')]('[%s][transfers][attendedtransfer]',_0x4d937d[_0x5efc('0x28')]),_0x48aaa2);}}; \ No newline at end of file +var _0x47a5=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','error','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x47a5,0x15a));var _0x547a=function(_0x5cc9a4,_0x22b494){_0x5cc9a4=_0x5cc9a4-0x0;var _0x51f941=_0x47a5[_0x5cc9a4];return _0x51f941;};'use strict';var _=require(_0x547a('0x0'));var util=require(_0x547a('0x1'));var utils=require('./utils');function writeDB(_0x1c5ffe){utils['info'](util['format'](_0x547a('0x2'),_0x1c5ffe[_0x547a('0x3')]===_0x547a('0x4')?_0x1c5ffe[_0x547a('0x5')]:_0x1c5ffe[_0x547a('0x6')],_0x1c5ffe[_0x547a('0x3')]));utils['request'](_0x547a('0x7'),_0x1c5ffe);}exports[_0x547a('0x8')]=function(_0x20d65d){try{utils[_0x547a('0x9')](util[_0x547a('0xa')]('[%s][transfers][blindtransfer]',_0x20d65d[_0x547a('0x6')]),_0x20d65d);utils['info'](util[_0x547a('0xa')](_0x547a('0xb'),_0x20d65d[_0x547a('0x6')],_0x20d65d['transferercalleridnum'],_0x20d65d[_0x547a('0xc')],_0x20d65d[_0x547a('0xd')],_0x20d65d['transfereecalleridname']));_0x20d65d[_0x547a('0x3')]=_0x547a('0xe');writeDB(_0x20d65d);}catch(_0xc8eeed){utils[_0x547a('0xf')](util[_0x547a('0xa')]('[%s][transfers][blindtransfer]',_0x20d65d[_0x547a('0x6')]),_0xc8eeed);}};exports['attendedtransfer']=function(_0x2c5dbf){try{utils[_0x547a('0x9')](util[_0x547a('0xa')]('[%s][transfers][attendedtransfer]',_0x2c5dbf['origtransfereruniqueid']),_0x2c5dbf);utils[_0x547a('0x10')](util[_0x547a('0xa')](_0x547a('0x11'),_0x2c5dbf[_0x547a('0x5')],_0x2c5dbf['origtransferercalleridnum'],_0x2c5dbf['origtransferercalleridname'],_0x2c5dbf[_0x547a('0x12')],_0x2c5dbf[_0x547a('0x13')]));_0x2c5dbf=_[_0x547a('0x14')](_0x2c5dbf,{'transfererchannel':_0x2c5dbf[_0x547a('0x15')],'transferercalleridnum':_0x2c5dbf['origtransferercalleridnum'],'transferercalleridname':_0x2c5dbf[_0x547a('0x16')],'transfererconnectedlinenum':_0x2c5dbf[_0x547a('0x17')],'transfererconnectedlinename':_0x2c5dbf['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2c5dbf[_0x547a('0x18')],'transferercontext':_0x2c5dbf[_0x547a('0x19')],'transfererexten':_0x2c5dbf[_0x547a('0x1a')],'transfererlinkedid':_0x2c5dbf[_0x547a('0x1b')],'context':_0x2c5dbf[_0x547a('0x1c')],'extension':_0x2c5dbf[_0x547a('0x1d')],'type':_0x547a('0x4')});if(_[_0x547a('0x1e')](_0x2c5dbf[_0x547a('0x1f')])){_0x2c5dbf=_[_0x547a('0x14')](_0x2c5dbf,{'transfereechannel':_0x2c5dbf[_0x547a('0x20')],'transfereecalleridnum':_0x2c5dbf[_0x547a('0x12')],'transfereecalleridname':_0x2c5dbf[_0x547a('0x13')],'transfereeconnectedlinenum':_0x2c5dbf[_0x547a('0x21')],'transfereeconnectedlinename':_0x2c5dbf['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2c5dbf[_0x547a('0x22')],'transfereecontext':_0x2c5dbf[_0x547a('0x23')],'transfereeexten':_0x2c5dbf[_0x547a('0x24')],'transfereelinkedid':_0x2c5dbf[_0x547a('0x25')]});}writeDB(_0x2c5dbf);}catch(_0x2257f0){utils[_0x547a('0xf')](util[_0x547a('0xa')]('[%s][transfers][attendedtransfer]',_0x2c5dbf[_0x547a('0x5')]),_0x2257f0);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d60496b..37f5114 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 _0x3061=['length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','result','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify'];(function(_0x57d5f2,_0x5a1f17){var _0x162137=function(_0x1bce37){while(--_0x1bce37){_0x57d5f2['push'](_0x57d5f2['shift']());}};_0x162137(++_0x5a1f17);}(_0x3061,0x176));var _0x1306=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0x3061[_0x36b400];return _0x4d47bf;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1306('0x0'));var moment=require(_0x1306('0x1'));var util=require(_0x1306('0x2'));var client=jayson[_0x1306('0x3')]['http']({'port':0x2329});var logger=require(_0x1306('0x4'))(_0x1306('0x5'));exports[_0x1306('0x6')]=function(_0x5c37b1,_0x5a29b4){logger[_0x1306('0x6')](_0x5c37b1,_0x5a29b4?util[_0x1306('0x7')](_0x5a29b4,{'showHidden':![],'depth':null}):'');};exports[_0x1306('0x8')]=function(_0x55539f,_0x4934a4){logger[_0x1306('0x8')](_0x55539f,_0x4934a4?util[_0x1306('0x7')](_0x4934a4,{'showHidden':![],'depth':null}):'');};exports[_0x1306('0x9')]=function(_0xdbe97b,_0x502dc7){logger['error'](_0xdbe97b,_0x502dc7?util[_0x1306('0x7')](_0x502dc7,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x44d310,_0x44b010){return client[_0x1306('0xa')](_0x44d310,{'body':_0x44b010})[_0x1306('0xb')](function(_0x57dff7){logger[_0x1306('0x8')]('[utils][request]\x20name:%s',_0x44d310,_0x57dff7?util[_0x1306('0x7')](_0x57dff7,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x24cc95){logger['error'](_0x1306('0xc'),_0x44d310,_0x24cc95?util[_0x1306('0x7')](_0x24cc95,{'showHidden':![],'depth':null}):'');});};function getUser(_0x585f22){return client[_0x1306('0xa')](_0x1306('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x1306('0xe'),_0x1306('0xf')],'where':_0x585f22,'limit':0x1}})['then'](function(_0x152ab0){logger['debug'](_0x1306('0x10'),JSON[_0x1306('0x11')](_0x585f22),_0x152ab0?util[_0x1306('0x7')](_0x152ab0,{'showHidden':![],'depth':null}):'');return _0x152ab0['result'][_0x1306('0x12')]?_0x152ab0['result'][0x0]:null;});}exports[_0x1306('0x13')]=function(_0x3892a5){return new BPromise(function(_0x1265c9,_0x39fc01){if(_0x3892a5){return getUser({'internal':_0x3892a5})['then'](function(_0x4a60fb){logger[_0x1306('0x6')](_0x1306('0x14'),_0x3892a5,_0x4a60fb?_0x1306('0x15'):_0x1306('0x16'));return _0x1265c9(_0x4a60fb);})['catch'](function(_0x5a6757){logger[_0x1306('0x9')](_0x1306('0x17'),_0x5a6757?util[_0x1306('0x7')](_0x5a6757,{'showHidden':![],'depth':null}):'');return _0x1265c9(null);});}return _0x1265c9(null);});};exports[_0x1306('0x18')]=function(_0x5a7211){return new BPromise(function(_0x2f36b1,_0xb5726f){if(_0x5a7211){return getUser({'interface':_0x5a7211})[_0x1306('0xb')](function(_0x3e30f9){logger[_0x1306('0x6')](_0x1306('0x19'),_0x5a7211,_0x3e30f9?'found':_0x1306('0x16'));return _0x2f36b1(_0x3e30f9);})[_0x1306('0x1a')](function(_0x3b205b){logger[_0x1306('0x9')](_0x1306('0x1b'),_0x3b205b?util[_0x1306('0x7')](_0x3b205b,{'showHidden':![],'depth':null}):'');return _0x2f36b1(null);});}return _0x2f36b1(null);});};exports[_0x1306('0x1c')]=function(_0x1f56dc){return new BPromise(function(_0x1d127b,_0x3d6e22){if(_0x1f56dc){return getUser({'name':_0x1f56dc})[_0x1306('0xb')](function(_0x44d254){logger[_0x1306('0x6')](_0x1306('0x1d'),_0x1f56dc,_0x44d254?_0x1306('0x15'):_0x1306('0x16'));return _0x1d127b(_0x44d254);})[_0x1306('0x1a')](function(_0x6ee3cf){logger['error'](_0x1306('0x1e'),_0x6ee3cf?util['inspect'](_0x6ee3cf,{'showHidden':![],'depth':null}):'');return _0x1d127b(null);});}return _0x1d127b(null);});};exports[_0x1306('0x1f')]=function(_0x460818){return new BPromise(function(_0x20250b,_0x3bcc9b){if(_0x460818){return client[_0x1306('0xa')](_0x1306('0x20'),{'options':{'raw':!![],'attributes':['id',_0x1306('0xe'),'type',_0x1306('0x21'),_0x1306('0x22')],'where':{'name':_0x460818},'limit':0x1}})[_0x1306('0xb')](function(_0x5957c5){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x460818,_0x5957c5?util[_0x1306('0x7')](_0x5957c5,{'showHidden':![],'depth':null}):'');logger[_0x1306('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x460818,_0x5957c5?_0x1306('0x15'):'notfound');return _0x20250b(_0x5957c5[_0x1306('0x23')]['length']?_0x5957c5[_0x1306('0x23')][0x0]:null);})[_0x1306('0x1a')](function(_0x3f6083){logger[_0x1306('0x9')](_0x1306('0x24'),_0x3f6083?util[_0x1306('0x7')](_0x3f6083,{'showHidden':![],'depth':null}):'');return _0x20250b(null);});}return _0x20250b(null);});};exports[_0x1306('0x25')]=function(_0x496c36,_0x14f24b){return moment(_0x496c36)[_0x1306('0x26')](_0x14f24b,_0x1306('0x27'))[_0x1306('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1306('0x29')]=function(_0x1ace92,_0x29b21f){return moment(_0x1ace92)[_0x1306('0x2a')](_0x29b21f,_0x1306('0x27'))[_0x1306('0x28')](_0x1306('0x2b'));};exports[_0x1306('0x2c')]=function(_0x3e0228,_0x8ed966){return moment(_0x3e0228)[_0x1306('0x2d')](moment(_0x8ed966),_0x1306('0x27'));};exports['sumTime']=function(_0x2d7627,_0x3746eb){return parseInt(_0x2d7627,0xa)+parseInt(_0x3746eb,0xa);};exports[_0x1306('0x2e')]=function(){return moment()[_0x1306('0x28')](_0x1306('0x2b'));};exports[_0x1306('0x2f')]=function(_0x44863c,_0x470569){if(_0x470569){return moment(_0x44863c)['isAfter'](_0x470569);}return!![];};exports[_0x1306('0x30')]=function(_0x14a9c7,_0x4b041e){if(_0x4b041e){return moment(_0x14a9c7)[_0x1306('0x30')](_0x4b041e);}else if(_0x14a9c7){return!![];}return![];}; \ No newline at end of file +var _0x0e26=['http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isBefore','jayson/promise','moment','client'];(function(_0x2ad1f6,_0x2198de){var _0x56d039=function(_0xad9873){while(--_0xad9873){_0x2ad1f6['push'](_0x2ad1f6['shift']());}};_0x56d039(++_0x2198de);}(_0x0e26,0x19b));var _0x60e2=function(_0x1fd4d4,_0x515d2f){_0x1fd4d4=_0x1fd4d4-0x0;var _0x40bf61=_0x0e26[_0x1fd4d4];return _0x40bf61;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x60e2('0x0'));var moment=require(_0x60e2('0x1'));var util=require('util');var client=jayson[_0x60e2('0x2')][_0x60e2('0x3')]({'port':0x2329});var logger=require(_0x60e2('0x4'))(_0x60e2('0x5'));exports[_0x60e2('0x6')]=function(_0x2c63c0,_0x432250){logger['info'](_0x2c63c0,_0x432250?util[_0x60e2('0x7')](_0x432250,{'showHidden':![],'depth':null}):'');};exports[_0x60e2('0x8')]=function(_0x36e315,_0x36bf92){logger[_0x60e2('0x8')](_0x36e315,_0x36bf92?util[_0x60e2('0x7')](_0x36bf92,{'showHidden':![],'depth':null}):'');};exports[_0x60e2('0x9')]=function(_0x1cf1e5,_0x71fc50){logger[_0x60e2('0x9')](_0x1cf1e5,_0x71fc50?util[_0x60e2('0x7')](_0x71fc50,{'showHidden':![],'depth':null}):'');};exports[_0x60e2('0xa')]=function(_0x32ac0d,_0x4c90b6){return client[_0x60e2('0xa')](_0x32ac0d,{'body':_0x4c90b6})[_0x60e2('0xb')](function(_0x39956b){logger[_0x60e2('0x8')](_0x60e2('0xc'),_0x32ac0d,_0x39956b?util[_0x60e2('0x7')](_0x39956b,{'showHidden':![],'depth':null}):'');})[_0x60e2('0xd')](function(_0x296656){logger['error']('[utils][request]\x20name:%s',_0x32ac0d,_0x296656?util['inspect'](_0x296656,{'showHidden':![],'depth':null}):'');});};function getUser(_0x27e6f9){return client['request'](_0x60e2('0xe'),{'options':{'raw':!![],'attributes':['id',_0x60e2('0xf'),_0x60e2('0x10'),'interface'],'where':_0x27e6f9,'limit':0x1}})[_0x60e2('0xb')](function(_0x525e5d){logger[_0x60e2('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x60e2('0x11')](_0x27e6f9),_0x525e5d?util[_0x60e2('0x7')](_0x525e5d,{'showHidden':![],'depth':null}):'');return _0x525e5d[_0x60e2('0x12')][_0x60e2('0x13')]?_0x525e5d['result'][0x0]:null;});}exports[_0x60e2('0x14')]=function(_0xfd9e55){return new BPromise(function(_0x17926a,_0x2dcfee){if(_0xfd9e55){return getUser({'internal':_0xfd9e55})['then'](function(_0x2d0ab3){logger['info'](_0x60e2('0x15'),_0xfd9e55,_0x2d0ab3?'found':_0x60e2('0x16'));return _0x17926a(_0x2d0ab3);})[_0x60e2('0xd')](function(_0x2c3d0f){logger[_0x60e2('0x9')](_0x60e2('0x17'),_0x2c3d0f?util[_0x60e2('0x7')](_0x2c3d0f,{'showHidden':![],'depth':null}):'');return _0x17926a(null);});}return _0x17926a(null);});};exports[_0x60e2('0x18')]=function(_0xadda17){return new BPromise(function(_0x21fbe6,_0x548af8){if(_0xadda17){return getUser({'interface':_0xadda17})['then'](function(_0x14b7f9){logger['info'](_0x60e2('0x19'),_0xadda17,_0x14b7f9?_0x60e2('0x1a'):_0x60e2('0x16'));return _0x21fbe6(_0x14b7f9);})[_0x60e2('0xd')](function(_0x4608ca){logger['error']('[utils][getUserByInterface]',_0x4608ca?util[_0x60e2('0x7')](_0x4608ca,{'showHidden':![],'depth':null}):'');return _0x21fbe6(null);});}return _0x21fbe6(null);});};exports[_0x60e2('0x1b')]=function(_0x55dce9){return new BPromise(function(_0x1888a0,_0x414ed9){if(_0x55dce9){return getUser({'name':_0x55dce9})[_0x60e2('0xb')](function(_0x337a7f){logger[_0x60e2('0x6')](_0x60e2('0x1c'),_0x55dce9,_0x337a7f?'found':_0x60e2('0x16'));return _0x1888a0(_0x337a7f);})[_0x60e2('0xd')](function(_0x3ab9da){logger[_0x60e2('0x9')](_0x60e2('0x1d'),_0x3ab9da?util[_0x60e2('0x7')](_0x3ab9da,{'showHidden':![],'depth':null}):'');return _0x1888a0(null);});}return _0x1888a0(null);});};exports[_0x60e2('0x1e')]=function(_0x1d3cbd){return new BPromise(function(_0x15d37f,_0x32b382){if(_0x1d3cbd){return client[_0x60e2('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x60e2('0x1f'),_0x60e2('0x20'),_0x60e2('0x21')],'where':{'name':_0x1d3cbd},'limit':0x1}})[_0x60e2('0xb')](function(_0x4cf8ee){logger[_0x60e2('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1d3cbd,_0x4cf8ee?util[_0x60e2('0x7')](_0x4cf8ee,{'showHidden':![],'depth':null}):'');logger[_0x60e2('0x6')](_0x60e2('0x22'),_0x1d3cbd,_0x4cf8ee?_0x60e2('0x1a'):_0x60e2('0x16'));return _0x15d37f(_0x4cf8ee[_0x60e2('0x12')]['length']?_0x4cf8ee[_0x60e2('0x12')][0x0]:null);})['catch'](function(_0x412396){logger['error'](_0x60e2('0x23'),_0x412396?util['inspect'](_0x412396,{'showHidden':![],'depth':null}):'');return _0x15d37f(null);});}return _0x15d37f(null);});};exports[_0x60e2('0x24')]=function(_0x2d8171,_0x559d3f){return moment(_0x2d8171)[_0x60e2('0x25')](_0x559d3f,_0x60e2('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x60e2('0x27')]=function(_0x33289b,_0xc4978){return moment(_0x33289b)['subtract'](_0xc4978,_0x60e2('0x26'))[_0x60e2('0x28')](_0x60e2('0x29'));};exports[_0x60e2('0x2a')]=function(_0x265f67,_0x51c61c){return moment(_0x265f67)[_0x60e2('0x2b')](moment(_0x51c61c),_0x60e2('0x26'));};exports[_0x60e2('0x2c')]=function(_0x3f1b26,_0xfedde6){return parseInt(_0x3f1b26,0xa)+parseInt(_0xfedde6,0xa);};exports['now']=function(){return moment()[_0x60e2('0x28')](_0x60e2('0x29'));};exports['isAfter']=function(_0x271905,_0x29518b){if(_0x29518b){return moment(_0x271905)['isAfter'](_0x29518b);}return!![];};exports[_0x60e2('0x2d')]=function(_0x1129e5,_0x23ec94){if(_0x23ec94){return moment(_0x1129e5)[_0x60e2('0x2d')](_0x23ec94);}else if(_0x1129e5){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 4188cfc..0daa05e 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 _0x0743=['error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','url','statusCode','responseTime','name','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','remoteAddress','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','join','log','xcally','client','role','ensureDir','catch','user','then','no-user','data','timestamp'];(function(_0x26b211,_0x2ed68a){var _0x439bef=function(_0x318594){while(--_0x318594){_0x26b211['push'](_0x26b211['shift']());}};_0x439bef(++_0x2ed68a);}(_0x0743,0xe5));var _0x3074=function(_0x55fee8,_0x5c0c57){_0x55fee8=_0x55fee8-0x0;var _0x8d60d7=_0x0743[_0x55fee8];return _0x8d60d7;};var fs=require(_0x3074('0x0'));var _=require(_0x3074('0x1'));var ewinston=require(_0x3074('0x2'));var path=require(_0x3074('0x3'));var util=require(_0x3074('0x4'));var fileLogger=require(_0x3074('0x5'))[_0x3074('0x6')];var safeTemplate=require(_0x3074('0x7'))[_0x3074('0x8')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x3ec1f6(_0x4b1bac){var _0x4da40d=path[_0x3074('0x9')]('/var',_0x3074('0xa'),_0x3074('0xb'));var _0x1013c8=path['join'](_0x3074('0xc'),_0x4b1bac[_0x3074('0xd')]+'-'+_0x4b1bac['name']);return fs[_0x3074('0xe')](path[_0x3074('0x9')](_0x4da40d,_0x1013c8))['then'](function(){var _0x263318=fileLogger(_0x3074('0xc'),path['join'](_0x4da40d,_0x1013c8));return _0x263318;})[_0x3074('0xf')](function(_0x3d9c51){throw _0x3d9c51;});}this[_0x3074('0xa')]=function(_0xaccc61,_0x45ebfe,_0x3fbf3a,_0x4ea1e1){return _0x3ec1f6(_0xaccc61[_0x3074('0x10')])[_0x3074('0x11')](function(_0x54009f){var _0x228646=_0x54009f[_0x45ebfe];return _0x228646;})[_0x3074('0x11')](function(_0x1e0a41){var _0x504bad=_0xaccc61[_0x3074('0x10')]?_0xaccc61[_0x3074('0x10')]['id']:_0x3074('0x12');var _0xdd47e3=_0x4ea1e1[_0x3074('0x13')];var _0xb19fc6=_0x4ea1e1[_0x3074('0x14')];var _0x1fe980=new Date(Number(_0xb19fc6));return _0x1e0a41(_0x504bad,_0x1fe980,_0x3fbf3a,_0xdd47e3);})[_0x3074('0xf')](function(_0x11481f){fileLogger(_0x3074('0xc'))[_0x3074('0x15')](_0x11481f);});};}function setupLoggers(_0x25016d){return new Promise(function(_0x158f15){var _0x3f6d79=new ClientSideLogger();var _0xc2008a=fileLogger(_0x3074('0x16'));var _0x597911=fileLogger(_0x3074('0x17'));_0x25016d['set'](_0x3074('0x18'),_0x3f6d79);_0x25016d['use'](ewinston[_0x3074('0x19')]({'winstonInstance':_0xc2008a,'meta':![],'statusLevels':!![],'msg':function(_0x493de9,_0x255776){var _0x3e3d6d=_0x3074('0x1a');if(!_[_0x3074('0x1b')](_0x493de9[_0x3074('0x1c')])){_0x3e3d6d+=_0x3074('0x1d');var _0x26f69f=_0x493de9[_0x3074('0x1c')];maskSensitiveData(_0x26f69f);}return safeTemplate(util['format'](_0x3e3d6d,_0x493de9['method'],_0x493de9[_0x3074('0x1e')][_0x3074('0x1f')]?_0x493de9[_0x3074('0x1e')][_0x3074('0x1f')]:_0x493de9[_0x3074('0x20')]['remoteAddress']||_0x493de9['ip'],_0x493de9[_0x3074('0x21')],_0x255776[_0x3074('0x22')],_0x255776[_0x3074('0x23')],_0x493de9[_0x3074('0x10')]?_0x493de9[_0x3074('0x10')]['id']:null,_0x493de9['user']?_0x493de9[_0x3074('0x10')][_0x3074('0x24')]:null,_0x493de9[_0x3074('0x10')]?_0x493de9[_0x3074('0x10')][_0x3074('0xd')]:null,_0x26f69f?util[_0x3074('0x25')](_0x26f69f,![],null):''));}}));_0x25016d[_0x3074('0x26')](ewinston[_0x3074('0x19')]({'winstonInstance':_0x597911,'meta':![],'statusLevels':!![],'msg':function(_0x5e9e8e,_0x4064b7){var _0x47a4b0=_0x3074('0x27');if(_0x5e9e8e[_0x3074('0x1c')]&&_0x5e9e8e['body'][_0x3074('0x28')]&&_0x5e9e8e[_0x3074('0x1c')][_0x3074('0x29')]){_0x47a4b0=_0x3074('0x2a');}return util[_0x3074('0x2b')](_0x47a4b0,_0x5e9e8e[_0x3074('0x2c')],_0x5e9e8e['headers'][_0x3074('0x1f')]?_0x5e9e8e[_0x3074('0x1e')][_0x3074('0x1f')]:_0x5e9e8e['connection'][_0x3074('0x2d')]||_0x5e9e8e['ip'],_0x5e9e8e['url'],_0x4064b7[_0x3074('0x22')],_0x4064b7[_0x3074('0x23')],_0x5e9e8e[_0x3074('0x10')]?_0x5e9e8e['user']['id']:null,_0x5e9e8e[_0x3074('0x10')]?_0x5e9e8e[_0x3074('0x10')][_0x3074('0x24')]:null,_0x5e9e8e[_0x3074('0x10')]?_0x5e9e8e['user'][_0x3074('0xd')]:null,_0x5e9e8e[_0x3074('0x1c')]&&_0x5e9e8e['body'][_0x3074('0x28')]?_0x5e9e8e[_0x3074('0x1c')]['device']:_0x3074('0x2e'),_0x5e9e8e[_0x3074('0x1c')]&&_0x5e9e8e[_0x3074('0x1c')][_0x3074('0x29')]?_0x5e9e8e[_0x3074('0x1c')][_0x3074('0x29')]:'',_0x5e9e8e[_0x3074('0x1c')]&&_0x5e9e8e[_0x3074('0x1c')][_0x3074('0x2f')]?_0x5e9e8e[_0x3074('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x2f327b){var _0x95ec26=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x95ec26[_0x3074('0x30')](_0x2f327b[_0x3074('0x21')]);}}));return _0x158f15();});}exports[_0x3074('0x31')]=setupLoggers; \ No newline at end of file +var _0xdf71=['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','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','other','agent_name','fs-extra','lodash','express-winston','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','catch','error','auth','set','client-side-logger'];(function(_0x241cc8,_0x3f1d03){var _0x50adc8=function(_0x42c54f){while(--_0x42c54f){_0x241cc8['push'](_0x241cc8['shift']());}};_0x50adc8(++_0x3f1d03);}(_0xdf71,0x184));var _0x1df7=function(_0xbb6da2,_0x24614b){_0xbb6da2=_0xbb6da2-0x0;var _0x2a84f5=_0xdf71[_0xbb6da2];return _0x2a84f5;};var fs=require(_0x1df7('0x0'));var _=require(_0x1df7('0x1'));var ewinston=require(_0x1df7('0x2'));var path=require('path');var util=require(_0x1df7('0x3'));var fileLogger=require('./loggers')[_0x1df7('0x4')];var safeTemplate=require(_0x1df7('0x5'))[_0x1df7('0x6')];var maskSensitiveData=require(_0x1df7('0x7'))[_0x1df7('0x8')];function ClientSideLogger(){function _0x18b459(_0xb8d953){var _0x449d8e=path[_0x1df7('0x9')](_0x1df7('0xa'),_0x1df7('0xb'),_0x1df7('0xc'));var _0x42bb3b=path[_0x1df7('0x9')](_0x1df7('0xd'),_0xb8d953[_0x1df7('0xe')]+'-'+_0xb8d953[_0x1df7('0xf')]);return fs[_0x1df7('0x10')](path[_0x1df7('0x9')](_0x449d8e,_0x42bb3b))['then'](function(){var _0x466bb3=fileLogger(_0x1df7('0xd'),path[_0x1df7('0x9')](_0x449d8e,_0x42bb3b));return _0x466bb3;})['catch'](function(_0x53d460){throw _0x53d460;});}this['log']=function(_0x5c2a9e,_0x1b120f,_0x2bc34f,_0x4c8b24){return _0x18b459(_0x5c2a9e['user'])['then'](function(_0x503062){var _0x24c2fc=_0x503062[_0x1b120f];return _0x24c2fc;})[_0x1df7('0x11')](function(_0x43ec26){var _0x3fd88d=_0x5c2a9e[_0x1df7('0x12')]?_0x5c2a9e[_0x1df7('0x12')]['id']:'no-user';var _0x2408b4=_0x4c8b24[_0x1df7('0x13')];var _0x21224c=_0x4c8b24[_0x1df7('0x14')];var _0x34d49c=new Date(Number(_0x21224c));return _0x43ec26(_0x3fd88d,_0x34d49c,_0x2bc34f,_0x2408b4);})[_0x1df7('0x15')](function(_0x28f610){fileLogger(_0x1df7('0xd'))[_0x1df7('0x16')](_0x28f610);});};}function setupLoggers(_0x4739ce){return new Promise(function(_0x4644bf){var _0x14a276=new ClientSideLogger();var _0x3895f1=fileLogger('api');var _0x561387=fileLogger(_0x1df7('0x17'));_0x4739ce[_0x1df7('0x18')](_0x1df7('0x19'),_0x14a276);_0x4739ce[_0x1df7('0x1a')](ewinston[_0x1df7('0x1b')]({'winstonInstance':_0x3895f1,'meta':![],'statusLevels':!![],'msg':function(_0x24c430,_0x256ee8){var _0x3a40dd=_0x1df7('0x1c');if(!_[_0x1df7('0x1d')](_0x24c430['body'])){_0x3a40dd+='\x20body=%s';var _0x7086b3=_0x24c430[_0x1df7('0x1e')];maskSensitiveData(_0x7086b3);}return safeTemplate(util[_0x1df7('0x1f')](_0x3a40dd,_0x24c430[_0x1df7('0x20')],_0x24c430[_0x1df7('0x21')][_0x1df7('0x22')]?_0x24c430[_0x1df7('0x21')][_0x1df7('0x22')]:_0x24c430[_0x1df7('0x23')][_0x1df7('0x24')]||_0x24c430['ip'],_0x24c430[_0x1df7('0x25')],_0x256ee8[_0x1df7('0x26')],_0x256ee8[_0x1df7('0x27')],_0x24c430[_0x1df7('0x12')]?_0x24c430[_0x1df7('0x12')]['id']:null,_0x24c430['user']?_0x24c430[_0x1df7('0x12')][_0x1df7('0xf')]:null,_0x24c430[_0x1df7('0x12')]?_0x24c430[_0x1df7('0x12')][_0x1df7('0xe')]:null,_0x7086b3?util[_0x1df7('0x28')](_0x7086b3,![],null):''));}}));_0x4739ce[_0x1df7('0x1a')](ewinston[_0x1df7('0x1b')]({'winstonInstance':_0x561387,'meta':![],'statusLevels':!![],'msg':function(_0x21745b,_0x32d94c){var _0x578477=_0x1df7('0x29');if(_0x21745b[_0x1df7('0x1e')]&&_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2a')]&&_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2b')]){_0x578477='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x1df7('0x1f')](_0x578477,_0x21745b[_0x1df7('0x20')],_0x21745b[_0x1df7('0x21')]['x-forwarded-for']?_0x21745b['headers'][_0x1df7('0x22')]:_0x21745b['connection'][_0x1df7('0x24')]||_0x21745b['ip'],_0x21745b[_0x1df7('0x25')],_0x32d94c[_0x1df7('0x26')],_0x32d94c['responseTime'],_0x21745b['user']?_0x21745b[_0x1df7('0x12')]['id']:null,_0x21745b[_0x1df7('0x12')]?_0x21745b[_0x1df7('0x12')][_0x1df7('0xf')]:null,_0x21745b['user']?_0x21745b[_0x1df7('0x12')][_0x1df7('0xe')]:null,_0x21745b[_0x1df7('0x1e')]&&_0x21745b['body'][_0x1df7('0x2a')]?_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2a')]:_0x1df7('0x2c'),_0x21745b[_0x1df7('0x1e')]&&_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2b')]?_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2b')]:'',_0x21745b[_0x1df7('0x1e')]&&_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2d')]?_0x21745b[_0x1df7('0x1e')][_0x1df7('0x2d')]:'');},'ignoreRoute':function(_0x496258){var _0x5ddcc9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5ddcc9['test'](_0x496258[_0x1df7('0x25')]);}}));return _0x4644bf();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 14c5e9d..866f577 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf39=['Date\x20not\x20valid','isValid','split','weekdaysShort','toLowerCase','locale','indexOf','slice','circularDoWInterval','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','date','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','length','padStart','iftime','lodash','map','join','Interval\x20string\x20not\x20valid'];(function(_0x8ba016,_0xd68ecc){var _0x2adcdc=function(_0x55ce61){while(--_0x55ce61){_0x8ba016['push'](_0x8ba016['shift']());}};_0x2adcdc(++_0xd68ecc);}(_0xaf39,0x164));var _0x9af3=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0xaf39[_0x312abc];return _0x314298;};var _=require(_0x9af3('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9af3('0x1')](function(_0x226095){return _0x226095['source'];})[_0x9af3('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9af3('0x3');var EINVALID_DATE=_0x9af3('0x4');function throwIfDateNotValid(_0x15e803){if(!_0x15e803[_0x9af3('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1e8552){var _0x588241=_0x1e8552[_0x9af3('0x6')](':')[_0x9af3('0x1')](function(_0x335303){return parseInt(_0x335303,0xa);});var _0x127603=_0x588241[0x0];var _0x3b80aa=_0x588241[0x1];if(_0x127603<0x0||_0x127603>0x17||_0x3b80aa<0x0||_0x3b80aa>0x3b){throw new Error(EINVALID_DATE);}return[_0x127603,_0x3b80aa];}function circularDoWInterval(_0x387fc9,_0x59d706){if(_0x387fc9===_0x59d706){return[_0x387fc9];}else{var _0x1c806d=moment['locale']();moment['locale']('en');var _0x508327=moment[_0x9af3('0x7')]()[_0x9af3('0x1')](function(_0x29cf84){return _0x29cf84[_0x9af3('0x8')]();});moment[_0x9af3('0x9')](_0x1c806d);var _0x5a5dec=_0x508327[_0x9af3('0xa')](_0x387fc9);var _0x3246e4=_0x508327[_0x9af3('0xa')](_0x59d706);if(_0x3246e4>_0x5a5dec){return _0x508327[_0x9af3('0xb')](_0x5a5dec,_0x3246e4+0x1);}else{var _0x13e66a=_0x508327['slice'](0x0,_0x3246e4+0x1);var _0x4a8c8e=_0x508327[_0x9af3('0xb')](_0x5a5dec);return _0x4a8c8e['concat'](_0x13e66a);}}}module['exports'][_0x9af3('0xc')]=circularDoWInterval;function circularMonthInterval(_0x27d34d,_0x1568ff){if(_0x27d34d===_0x1568ff){return[_0x27d34d];}else{var _0x233745=moment[_0x9af3('0x9')]();moment['locale']('en');var _0x3b17ea=moment['monthsShort']()[_0x9af3('0x1')](function(_0x4a5885){return _0x4a5885[_0x9af3('0x8')]();});moment['locale'](_0x233745);var _0x38ed8b=_0x3b17ea[_0x9af3('0xa')](_0x27d34d);var _0x1917bd=_0x3b17ea[_0x9af3('0xa')](_0x1568ff);if(_0x1917bd>_0x38ed8b){return _0x3b17ea[_0x9af3('0xb')](_0x38ed8b,_0x1917bd+0x1);}else{var _0x193e3c=_0x3b17ea['slice'](0x0,_0x1917bd+0x1);var _0xa6267d=_0x3b17ea['slice'](_0x38ed8b);return _0xa6267d[_0x9af3('0xd')](_0x193e3c);}}}module[_0x9af3('0xe')][_0x9af3('0xf')]=circularMonthInterval;function parseDom(_0x7330fa){var _0x38448d=parseInt(_0x7330fa,0xa);if(_0x38448d<0x1||_0x38448d>0x1f){throw new Error(EINVALID_DATE);}return _0x38448d;}function timeCompare(_0x475ce7,_0x276ca1,_0x51e2cc){var _0x7b6e0f=_0x475ce7[_0x9af3('0x10')]();var _0x12702d=extractTime(_0x276ca1);var _0xf45412=_0x12702d[0x0];var _0x3c0533=_0x12702d[0x1];var _0x2eb04f=_0x475ce7[_0x9af3('0x10')]()[_0x9af3('0x11')](_0xf45412)[_0x9af3('0x12')](_0x3c0533);throwIfDateNotValid(_0x2eb04f);var _0x2f0cb0=extractTime(_0x51e2cc);var _0x5463b1=_0x2f0cb0[0x0];var _0xcdef4a=_0x2f0cb0[0x1];var _0x460c18=_0x475ce7['clone']()[_0x9af3('0x11')](_0x5463b1)[_0x9af3('0x12')](_0xcdef4a);throwIfDateNotValid(_0x460c18);if(_0x460c18[_0x9af3('0x13')](_0x2eb04f)){var _0x2c4686=_0x7b6e0f[_0x9af3('0x10')]()[_0x9af3('0x14')]('day');var _0x1d8e36=_0x7b6e0f['clone']()[_0x9af3('0x15')](_0x9af3('0x16'));return _0x7b6e0f[_0x9af3('0x17')](_0x2eb04f,_0x1d8e36,undefined,'[]')||_0x7b6e0f['isBetween'](_0x2c4686,_0x460c18,undefined,'[]');}else{return _0x7b6e0f[_0x9af3('0x17')](_0x2eb04f,_0x460c18,undefined,'[]');}}module[_0x9af3('0xe')][_0x9af3('0x18')]=timeCompare;function dowCompare(_0x2187e7,_0x5c63e4,_0x5a414d){var _0x55228a=_0x2187e7[_0x9af3('0x9')]('en')[_0x9af3('0x19')]('ddd')[_0x9af3('0x8')]();return circularDoWInterval(_0x5c63e4,_0x5a414d)['includes'](_0x55228a);}module[_0x9af3('0xe')]['dowCompare']=dowCompare;function domCompare(_0x4cec83,_0x5c3ecf,_0xd45be2){var _0x3ff373=_0x4cec83[_0x9af3('0x1a')]();if(_0x5c3ecf===_0xd45be2){return _0x3ff373===_0x5c3ecf;}else{var _0x329ba1=_0x4cec83[_0x9af3('0x1b')]();var _0x401ec0=_0x5c3ecf<_0xd45be2;let _0x469ba9=![];var _0x2c8942=0x0;var _0x54aedf=0x0;if(_0x401ec0){_0x2c8942=Math[_0x9af3('0x1c')](0x1,_0x5c3ecf);_0x54aedf=Math[_0x9af3('0x1d')](_0xd45be2,_0x329ba1);_0x469ba9=_0x3ff373>=_0x2c8942&&_0x3ff373<=_0x54aedf;}else{_0x2c8942=Math[_0x9af3('0x1d')](_0x5c3ecf,_0x329ba1);_0x54aedf=Math['max'](0x1,_0xd45be2);_0x469ba9=_0x3ff373>=_0x2c8942||_0x3ff373<=_0x54aedf;}return _0x469ba9;}}module['exports'][_0x9af3('0x1e')]=domCompare;function monthCompare(_0x510b8b,_0x58f239,_0x55d558){var _0x2304e9=_0x510b8b['locale']('en')['format'](_0x9af3('0x1f'))[_0x9af3('0x8')]();return circularMonthInterval(_0x58f239,_0x55d558)[_0x9af3('0x20')](_0x2304e9);}module[_0x9af3('0xe')][_0x9af3('0x21')]=monthCompare;function iftime(_0x30e58a,_0x52fe2c=moment['tz'][_0x9af3('0x22')](),_0x35f1b0=moment()){if(!validateRx[_0x9af3('0x23')](_0x30e58a)){throw new Error(EINVALID_STRING);}else{var _0x1d3630=(moment[_0x9af3('0x24')](_0x35f1b0)?_0x35f1b0[_0x9af3('0x10')]():moment(_0x35f1b0))['tz'](_0x52fe2c)[_0x9af3('0x9')]('en');throwIfDateNotValid(_0x1d3630);var _0x26b76f=_0x30e58a[_0x9af3('0x6')](',');var _0x133784=_0x26b76f[0x0];var _0x43f3a6=_0x26b76f[0x1];var _0x58c187=_0x26b76f[0x2];var _0x2f2304=_0x26b76f[0x3];let _0x2cad99=!![];if(_0x133784!=='*'){var _0x23257d=_0x133784[_0x9af3('0x6')]('-');var _0x402547=_['padStart'](_0x23257d[0x0],0x5,'0');var _0x5b7b17=_0x23257d[_0x9af3('0x25')]===0x2?_[_0x9af3('0x26')](_0x23257d[0x1],0x5,'0'):_0x402547;_0x2cad99=timeCompare(_0x1d3630,_0x402547,_0x5b7b17);}let _0x3d1dc3=!![];if(_0x43f3a6!=='*'){var _0x25013f=_0x43f3a6[_0x9af3('0x6')]('-');var _0xe865d0=_0x25013f[0x0];var _0x14155e=_0x25013f[_0x9af3('0x25')]===0x2?_0x25013f[0x1]:_0xe865d0;_0x3d1dc3=dowCompare(_0x1d3630,_0xe865d0,_0x14155e);}let _0x3b8729=!![];if(_0x58c187!=='*'){var _0x330ba9=_0x58c187[_0x9af3('0x6')]('-');var _0x547207=parseDom(_0x330ba9[0x0]);var _0x4f00cd=_0x330ba9[_0x9af3('0x25')]===0x2?parseDom(_0x330ba9[0x1]):_0x547207;_0x3b8729=domCompare(_0x1d3630,_0x547207,_0x4f00cd);}let _0x1c0a99=!![];if(_0x2f2304!=='*'){var _0x4f295f=_0x2f2304[_0x9af3('0x6')]('-');var _0x201786=_0x4f295f[0x0];var _0x472682=_0x4f295f['length']===0x2?_0x4f295f[0x1]:_0x4f295f[0x0];_0x1c0a99=monthCompare(_0x1d3630,_0x201786,_0x472682);}return _0x2cad99&&_0x3d1dc3&&_0x3b8729&&_0x1c0a99;}}module['exports'][_0x9af3('0x27')]=iftime; \ No newline at end of file +var _0x09fc=['slice','concat','exports','circularDoWInterval','circularMonthInterval','hours','minutes','clone','day','isBetween','format','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','guess','test','split','padStart','length','iftime','lodash','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','locale','weekdaysShort','toLowerCase','indexOf'];(function(_0x5ae11e,_0x52f33d){var _0x362203=function(_0x42aced){while(--_0x42aced){_0x5ae11e['push'](_0x5ae11e['shift']());}};_0x362203(++_0x52f33d);}(_0x09fc,0x7f));var _0xc09f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x09fc[_0x2d7f0e];return _0x110b07;};var _=require(_0xc09f('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xc09f('0x1')](function(_0xe3330f){return _0xe3330f[_0xc09f('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc09f('0x3');var EINVALID_DATE=_0xc09f('0x4');function throwIfDateNotValid(_0x26990f){if(!_0x26990f['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x58b8e8){var _0x551148=_0x58b8e8['split'](':')[_0xc09f('0x1')](function(_0x484af3){return parseInt(_0x484af3,0xa);});var _0x21ef85=_0x551148[0x0];var _0x244214=_0x551148[0x1];if(_0x21ef85<0x0||_0x21ef85>0x17||_0x244214<0x0||_0x244214>0x3b){throw new Error(EINVALID_DATE);}return[_0x21ef85,_0x244214];}function circularDoWInterval(_0x59a606,_0x273a27){if(_0x59a606===_0x273a27){return[_0x59a606];}else{var _0x40f265=moment['locale']();moment[_0xc09f('0x5')]('en');var _0x274a47=moment[_0xc09f('0x6')]()[_0xc09f('0x1')](function(_0x42dd8c){return _0x42dd8c[_0xc09f('0x7')]();});moment[_0xc09f('0x5')](_0x40f265);var _0x19cfe7=_0x274a47[_0xc09f('0x8')](_0x59a606);var _0x56b702=_0x274a47[_0xc09f('0x8')](_0x273a27);if(_0x56b702>_0x19cfe7){return _0x274a47[_0xc09f('0x9')](_0x19cfe7,_0x56b702+0x1);}else{var _0x54a8b4=_0x274a47[_0xc09f('0x9')](0x0,_0x56b702+0x1);var _0x49a307=_0x274a47['slice'](_0x19cfe7);return _0x49a307[_0xc09f('0xa')](_0x54a8b4);}}}module[_0xc09f('0xb')][_0xc09f('0xc')]=circularDoWInterval;function circularMonthInterval(_0x1c2ccf,_0x54318d){if(_0x1c2ccf===_0x54318d){return[_0x1c2ccf];}else{var _0x59cbec=moment[_0xc09f('0x5')]();moment['locale']('en');var _0x543ccd=moment['monthsShort']()[_0xc09f('0x1')](function(_0xbb99c9){return _0xbb99c9[_0xc09f('0x7')]();});moment[_0xc09f('0x5')](_0x59cbec);var _0x177a4c=_0x543ccd[_0xc09f('0x8')](_0x1c2ccf);var _0x181492=_0x543ccd[_0xc09f('0x8')](_0x54318d);if(_0x181492>_0x177a4c){return _0x543ccd[_0xc09f('0x9')](_0x177a4c,_0x181492+0x1);}else{var _0x530f57=_0x543ccd[_0xc09f('0x9')](0x0,_0x181492+0x1);var _0x5f540c=_0x543ccd['slice'](_0x177a4c);return _0x5f540c[_0xc09f('0xa')](_0x530f57);}}}module['exports'][_0xc09f('0xd')]=circularMonthInterval;function parseDom(_0xd7ed5c){var _0x43d371=parseInt(_0xd7ed5c,0xa);if(_0x43d371<0x1||_0x43d371>0x1f){throw new Error(EINVALID_DATE);}return _0x43d371;}function timeCompare(_0x3943e1,_0x1a42be,_0xbf98d6){var _0x1f5de4=_0x3943e1['clone']();var _0x589631=extractTime(_0x1a42be);var _0x1a85af=_0x589631[0x0];var _0x10e7ff=_0x589631[0x1];var _0x235366=_0x3943e1['clone']()[_0xc09f('0xe')](_0x1a85af)[_0xc09f('0xf')](_0x10e7ff);throwIfDateNotValid(_0x235366);var _0x5df988=extractTime(_0xbf98d6);var _0x259054=_0x5df988[0x0];var _0x2c41a1=_0x5df988[0x1];var _0x560d3e=_0x3943e1[_0xc09f('0x10')]()[_0xc09f('0xe')](_0x259054)[_0xc09f('0xf')](_0x2c41a1);throwIfDateNotValid(_0x560d3e);if(_0x560d3e['isBefore'](_0x235366)){var _0x32c4ab=_0x1f5de4[_0xc09f('0x10')]()['startOf']('day');var _0x29582f=_0x1f5de4[_0xc09f('0x10')]()['endOf'](_0xc09f('0x11'));return _0x1f5de4[_0xc09f('0x12')](_0x235366,_0x29582f,undefined,'[]')||_0x1f5de4[_0xc09f('0x12')](_0x32c4ab,_0x560d3e,undefined,'[]');}else{return _0x1f5de4[_0xc09f('0x12')](_0x235366,_0x560d3e,undefined,'[]');}}module[_0xc09f('0xb')]['timeCompare']=timeCompare;function dowCompare(_0x2eb9e6,_0x195bc4,_0x11e2d1){var _0x2ffe8d=_0x2eb9e6['locale']('en')[_0xc09f('0x13')]('ddd')[_0xc09f('0x7')]();return circularDoWInterval(_0x195bc4,_0x11e2d1)[_0xc09f('0x14')](_0x2ffe8d);}module[_0xc09f('0xb')][_0xc09f('0x15')]=dowCompare;function domCompare(_0x4e4752,_0x5034ce,_0x287741){var _0x402939=_0x4e4752[_0xc09f('0x16')]();if(_0x5034ce===_0x287741){return _0x402939===_0x5034ce;}else{var _0x1114a9=_0x4e4752[_0xc09f('0x17')]();var _0x310f32=_0x5034ce<_0x287741;let _0x16fea8=![];var _0x406f28=0x0;var _0x13b51b=0x0;if(_0x310f32){_0x406f28=Math[_0xc09f('0x18')](0x1,_0x5034ce);_0x13b51b=Math[_0xc09f('0x19')](_0x287741,_0x1114a9);_0x16fea8=_0x402939>=_0x406f28&&_0x402939<=_0x13b51b;}else{_0x406f28=Math[_0xc09f('0x19')](_0x5034ce,_0x1114a9);_0x13b51b=Math[_0xc09f('0x18')](0x1,_0x287741);_0x16fea8=_0x402939>=_0x406f28||_0x402939<=_0x13b51b;}return _0x16fea8;}}module['exports'][_0xc09f('0x1a')]=domCompare;function monthCompare(_0x492bba,_0x556071,_0x2f9917){var _0x2f1677=_0x492bba[_0xc09f('0x5')]('en')[_0xc09f('0x13')](_0xc09f('0x1b'))[_0xc09f('0x7')]();return circularMonthInterval(_0x556071,_0x2f9917)[_0xc09f('0x14')](_0x2f1677);}module[_0xc09f('0xb')]['monthCompare']=monthCompare;function iftime(_0x2ea5ae,_0x4ad728=moment['tz'][_0xc09f('0x1c')](),_0x469bfd=moment()){if(!validateRx[_0xc09f('0x1d')](_0x2ea5ae)){throw new Error(EINVALID_STRING);}else{var _0x10082c=(moment['isMoment'](_0x469bfd)?_0x469bfd[_0xc09f('0x10')]():moment(_0x469bfd))['tz'](_0x4ad728)[_0xc09f('0x5')]('en');throwIfDateNotValid(_0x10082c);var _0x4638bf=_0x2ea5ae[_0xc09f('0x1e')](',');var _0x148b97=_0x4638bf[0x0];var _0x3b9fa0=_0x4638bf[0x1];var _0x4cb5ee=_0x4638bf[0x2];var _0x1ef6c7=_0x4638bf[0x3];let _0x17515d=!![];if(_0x148b97!=='*'){var _0x39092d=_0x148b97['split']('-');var _0x44d89e=_[_0xc09f('0x1f')](_0x39092d[0x0],0x5,'0');var _0x3468b4=_0x39092d['length']===0x2?_['padStart'](_0x39092d[0x1],0x5,'0'):_0x44d89e;_0x17515d=timeCompare(_0x10082c,_0x44d89e,_0x3468b4);}let _0xe00fdb=!![];if(_0x3b9fa0!=='*'){var _0xb79c7c=_0x3b9fa0['split']('-');var _0x3db115=_0xb79c7c[0x0];var _0x1d5a31=_0xb79c7c[_0xc09f('0x20')]===0x2?_0xb79c7c[0x1]:_0x3db115;_0xe00fdb=dowCompare(_0x10082c,_0x3db115,_0x1d5a31);}let _0x10ee0c=!![];if(_0x4cb5ee!=='*'){var _0x20b3c8=_0x4cb5ee['split']('-');var _0x562fdc=parseDom(_0x20b3c8[0x0]);var _0x2d67da=_0x20b3c8[_0xc09f('0x20')]===0x2?parseDom(_0x20b3c8[0x1]):_0x562fdc;_0x10ee0c=domCompare(_0x10082c,_0x562fdc,_0x2d67da);}let _0x1179d6=!![];if(_0x1ef6c7!=='*'){var _0x847b5b=_0x1ef6c7[_0xc09f('0x1e')]('-');var _0x29e759=_0x847b5b[0x0];var _0x17a617=_0x847b5b[_0xc09f('0x20')]===0x2?_0x847b5b[0x1]:_0x847b5b[0x0];_0x1179d6=monthCompare(_0x10082c,_0x29e759,_0x17a617);}return _0x17515d&&_0xe00fdb&&_0x10ee0c&&_0x1179d6;}}module[_0xc09f('0xb')][_0xc09f('0x21')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 8477143..6cfb6df 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad8f=['Console','warn','File','%s-%s','error','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20cyan','addColors','join','message','replace','{{{','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','keys','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports'];(function(_0x3acbeb,_0x9ab07){var _0x239a79=function(_0x45df4e){while(--_0x45df4e){_0x3acbeb['push'](_0x3acbeb['shift']());}};_0x239a79(++_0x9ab07);}(_0xad8f,0x1c2));var _0xfad8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xad8f[_0x5c351c];return _0x26f3b3;};'use strict';var path=require(_0xfad8('0x0'));var util=require(_0xfad8('0x1'));var moment=require(_0xfad8('0x2'));var winston=require(_0xfad8('0x3'));var config=require('../config/environment');var debugLevel=config[_0xfad8('0x4')]?config['debugLevel'][_0xfad8('0x5')]():_0xfad8('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':_0xfad8('0x7'),'error':_0xfad8('0x8'),'warn':_0xfad8('0x9'),'info':_0xfad8('0xa'),'print':_0xfad8('0xb'),'success':_0xfad8('0xc'),'http':'gray','verbose':_0xfad8('0xd'),'debug':'bold\x20blue','silly':_0xfad8('0xe')};winston[_0xfad8('0xf')](XC_LOG_COLORS);function getLogFileName(_0x525f71,_0xe65283,_0x471ab6){var _0x59f942=_0x525f71||'/var/log/xcally';return path[_0xfad8('0x10')](_0x59f942,util['format']('%s-%s.log',_0xe65283,_0x471ab6));}function formatter(_0x57f6a8,_0x583bf5){_0x583bf5[_0xfad8('0x11')]=_0x583bf5[_0xfad8('0x11')][_0xfad8('0x12')](/@@{/g,_0xfad8('0x13'))[_0xfad8('0x12')](/}@@/g,'}}}')[_0xfad8('0x12')](/@{/g,'{{')[_0xfad8('0x12')](/}@/g,'}}');return util[_0xfad8('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xfad8('0x15')),_0x583bf5[_0xfad8('0x16')][_0xfad8('0x17')](),_0x57f6a8,_0x583bf5['message']);}function fileFormat(_0x272c7b,_0x2b7ef6){_0x2b7ef6[_0xfad8('0x11')]=_0x2b7ef6['message'][_0xfad8('0x12')](/@@{/g,_0xfad8('0x13'))['replace'](/}@@/g,_0xfad8('0x18'))[_0xfad8('0x12')](/@{/g,'{{')[_0xfad8('0x12')](/}@/g,'}}');var _0x32a034=_0x2b7ef6['meta']&&Object[_0xfad8('0x19')](_0x2b7ef6[_0xfad8('0x1a')])['length']?'\x0a\x09'+JSON[_0xfad8('0x1b')](_0x2b7ef6[_0xfad8('0x1a')]):'';return util[_0xfad8('0x14')](_0xfad8('0x1c'),moment()['format'](_0xfad8('0x15')),_0x2b7ef6['level'][_0xfad8('0x17')](),_0x272c7b,_0x2b7ef6[_0xfad8('0x11')],_0x32a034);}function consoleLogger(){var _0x138d66=new winston[(_0xfad8('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfad8('0x1e'))][(_0xfad8('0x1f'))]({'level':_0xfad8('0x20'),'json':![],'formatter':function(_0x2d6626){return formatter('',_0x2d6626);}})]});return _0x138d66;}function fileLogger(_0x551296,_0x48b982){var _0x166e36=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xfad8('0x21'))]({'name':util[_0xfad8('0x14')](_0xfad8('0x22'),_0x551296,_0xfad8('0x23')),'filename':getLogFileName(_0x48b982,_0x551296,'error'),'level':_0xfad8('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x553521){return fileFormat(_0x551296,_0x553521);}}),new winston[(_0xfad8('0x1e'))][(_0xfad8('0x21'))]({'name':util['format'](_0xfad8('0x22'),_0x551296,debugLevel),'filename':getLogFileName(_0x48b982,_0x551296,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3eed3e){return fileFormat(_0x551296,_0x3eed3e);}}),new winston[(_0xfad8('0x1e'))][(_0xfad8('0x1f'))]({'level':_0xfad8('0x20'),'json':![],'formatter':function(_0x53981f){return fileFormat(_0x551296,_0x53981f);}})]});return _0x166e36;}exports['consoleLogger']=consoleLogger;exports[_0xfad8('0x24')]=fileLogger; \ No newline at end of file +var _0x8674=['join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally'];(function(_0x1c4b44,_0x2377de){var _0x10d72b=function(_0x2bd31e){while(--_0x2bd31e){_0x1c4b44['push'](_0x1c4b44['shift']());}};_0x10d72b(++_0x2377de);}(_0x8674,0x1eb));var _0x4867=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8674[_0x2d2c16];return _0x53f2fb;};'use strict';var path=require(_0x4867('0x0'));var util=require(_0x4867('0x1'));var moment=require('moment');var winston=require(_0x4867('0x2'));var config=require(_0x4867('0x3'));var debugLevel=config[_0x4867('0x4')]?config[_0x4867('0x4')][_0x4867('0x5')]():_0x4867('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':_0x4867('0x7'),'error':'red','warn':'bold\x20yellow','info':_0x4867('0x8'),'print':_0x4867('0x9'),'success':_0x4867('0xa'),'http':_0x4867('0xb'),'verbose':_0x4867('0xc'),'debug':_0x4867('0xd'),'silly':'bold\x20cyan'};winston[_0x4867('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1ae0a0,_0x1bd5ab,_0x1ce186){var _0x2cd4a6=_0x1ae0a0||_0x4867('0xf');return path[_0x4867('0x10')](_0x2cd4a6,util[_0x4867('0x11')](_0x4867('0x12'),_0x1bd5ab,_0x1ce186));}function formatter(_0x495cdd,_0x404e59){_0x404e59[_0x4867('0x13')]=_0x404e59['message'][_0x4867('0x14')](/@@{/g,_0x4867('0x15'))[_0x4867('0x14')](/}@@/g,_0x4867('0x16'))[_0x4867('0x14')](/@{/g,'{{')[_0x4867('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x4867('0x11')](_0x4867('0x17')),_0x404e59[_0x4867('0x18')][_0x4867('0x19')](),_0x495cdd,_0x404e59[_0x4867('0x13')]);}function fileFormat(_0x5b6d16,_0x1c780f){_0x1c780f['message']=_0x1c780f[_0x4867('0x13')][_0x4867('0x14')](/@@{/g,'{{{')[_0x4867('0x14')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x4867('0x14')](/}@/g,'}}');var _0x32fa58=_0x1c780f[_0x4867('0x1a')]&&Object['keys'](_0x1c780f[_0x4867('0x1a')])[_0x4867('0x1b')]?'\x0a\x09'+JSON[_0x4867('0x1c')](_0x1c780f['meta']):'';return util[_0x4867('0x11')](_0x4867('0x1d'),moment()[_0x4867('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1c780f[_0x4867('0x18')][_0x4867('0x19')](),_0x5b6d16,_0x1c780f[_0x4867('0x13')],_0x32fa58);}function consoleLogger(){var _0x2bde9b=new winston[(_0x4867('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4867('0x1f'))][(_0x4867('0x20'))]({'level':_0x4867('0x21'),'json':![],'formatter':function(_0x48410e){return formatter('',_0x48410e);}})]});return _0x2bde9b;}function fileLogger(_0x370a23,_0x49bd59){var _0x548051=new winston[(_0x4867('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x4867('0x22'))]({'name':util['format']('%s-%s',_0x370a23,_0x4867('0x23')),'filename':getLogFileName(_0x49bd59,_0x370a23,_0x4867('0x23')),'level':_0x4867('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19cc61){return fileFormat(_0x370a23,_0x19cc61);}}),new winston['transports']['File']({'name':util['format'](_0x4867('0x24'),_0x370a23,debugLevel),'filename':getLogFileName(_0x49bd59,_0x370a23,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x95012e){return fileFormat(_0x370a23,_0x95012e);}}),new winston[(_0x4867('0x1f'))][(_0x4867('0x20'))]({'level':_0x4867('0x21'),'json':![],'formatter':function(_0x485b23){return fileFormat(_0x370a23,_0x485b23);}})]});return _0x548051;}exports[_0x4867('0x25')]=consoleLogger;exports[_0x4867('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index cb942e0..b20d960 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x71860,_0x39adac){var _0x958767=function(_0x34f25a){while(--_0x34f25a){_0x71860['push'](_0x71860['shift']());}};_0x958767(++_0x39adac);}(_0xadb5,0xad));var _0x5adb=function(_0x5d5b21,_0x1f9b4b){_0x5d5b21=_0x5d5b21-0x0;var _0x2a1881=_0xadb5[_0x5d5b21];return _0x2a1881;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=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(_0x3af585,_0x505869){var _0x84116f=function(_0x26a823){while(--_0x26a823){_0x3af585['push'](_0x3af585['shift']());}};_0x84116f(++_0x505869);}(_0xda2d,0x102));var _0xdda2=function(_0x30a26b,_0x2149f7){_0x30a26b=_0x30a26b-0x0;var _0x322ede=_0xda2d[_0x30a26b];return _0x322ede;};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 89e14fc..cc471c8 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 _0x0972=['safeTemplate','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x571c61,_0x489ce4){var _0x301920=function(_0x16d185){while(--_0x16d185){_0x571c61['push'](_0x571c61['shift']());}};_0x301920(++_0x489ce4);}(_0x0972,0x64));var _0x2097=function(_0x2c2207,_0x473604){_0x2c2207=_0x2c2207-0x0;var _0x4478cc=_0x0972[_0x2c2207];return _0x4478cc;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1591ae){return _0x1591ae==='{{'?'{\x20{\x20':_0x2097('0x0');}function safeTemplate(_0x4ec7aa){var _0x36912c=_0x4ec7aa;if(typeof _0x4ec7aa===_0x2097('0x1')){_0x36912c=_0x4ec7aa['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2097('0x2')](_0x4ec7aa)){_0x36912c=_0x4ec7aa[_0x2097('0x3')](function(_0xe6fbae){return safeTemplate(_0xe6fbae);});}else if(_[_0x2097('0x4')](_0x4ec7aa)){_0x36912c=Object[_0x2097('0x5')](_0x4ec7aa)[_0x2097('0x6')](function(_0x2b4f21,_0x59739f){_0x2b4f21[_0x59739f]=safeTemplate(_0x4ec7aa[_0x59739f]);return _0x2b4f21;},{});}return _0x36912c;}module[_0x2097('0x7')][_0x2097('0x8')]=safeTemplate; \ No newline at end of file +var _0x087b=['exports','safeTemplate','lodash','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x217d06,_0x31b203){var _0x3b213e=function(_0x1be976){while(--_0x1be976){_0x217d06['push'](_0x217d06['shift']());}};_0x3b213e(++_0x31b203);}(_0x087b,0x11a));var _0xb087=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x087b[_0x476bf4];return _0x788ffe;};var _=require(_0xb087('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x35e3d3){return _0x35e3d3==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x40e6d6){var _0x5aa7a8=_0x40e6d6;if(typeof _0x40e6d6===_0xb087('0x1')){_0x5aa7a8=_0x40e6d6[_0xb087('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xb087('0x3')](_0x40e6d6)){_0x5aa7a8=_0x40e6d6[_0xb087('0x4')](function(_0x183efd){return safeTemplate(_0x183efd);});}else if(_[_0xb087('0x5')](_0x40e6d6)){_0x5aa7a8=Object[_0xb087('0x6')](_0x40e6d6)[_0xb087('0x7')](function(_0xecf080,_0x36ac30){_0xecf080[_0x36ac30]=safeTemplate(_0x40e6d6[_0x36ac30]);return _0xecf080;},{});}return _0x5aa7a8;}module[_0xb087('0x8')][_0xb087('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index c0558c5..5365112 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb916=['root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','env','pathExists','then','updated','info','writeJSON','exports','fs-extra','path'];(function(_0x479df4,_0x1b0f13){var _0x28d1ff=function(_0x90f8d4){while(--_0x90f8d4){_0x479df4['push'](_0x479df4['shift']());}};_0x28d1ff(++_0x1b0f13);}(_0xb916,0x1be));var _0x6b91=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0xb916[_0x7efe31];return _0x59ea5a;};var fs=require(_0x6b91('0x0'));var path=require(_0x6b91('0x1'));var config=require('../config/environment');var root=config[_0x6b91('0x2')];var APP_JSON_PATH=path[_0x6b91('0x3')](root,_0x6b91('0x4'));var NODEPATH=path[_0x6b91('0x3')](root,_0x6b91('0x5'));function setLegacyLibsNodeEnvPath(_0x532c32){let _0x1a9106=![];if(Array[_0x6b91('0x6')](_0x532c32[_0x6b91('0x7')])){var _0x3f2548=_0x532c32[_0x6b91('0x7')][_0x6b91('0x8')](function(_0x145ffb){return _0x145ffb['name']==='motion2';});if(_0x3f2548>-0x1){var _0x348f7f=_0x532c32[_0x6b91('0x7')][_0x3f2548];if(typeof _0x348f7f[_0x6b91('0x9')]['NODE_PATH']!=='string'){_0x348f7f['env']['NODE_PATH']=NODEPATH;_0x1a9106=!![];}}return{'appConfig':_0x532c32,'updated':_0x1a9106};}}function updateAppConfig(_0xd458a5){return fs[_0x6b91('0xa')](APP_JSON_PATH)['then'](function(_0x5271de){if(_0x5271de){return fs['readJSON'](APP_JSON_PATH)[_0x6b91('0xb')](function(_0x5431bd){var _0x4acfed=setLegacyLibsNodeEnvPath(_0x5431bd);if(_0x4acfed[_0x6b91('0xc')]){_0xd458a5[_0x6b91('0xd')]('Updating\x20app.json');return fs[_0x6b91('0xe')](APP_JSON_PATH,_0x5431bd,{'spaces':0x2});}else{return Promise[_0x6b91('0x3')]();}});}else{return Promise[_0x6b91('0x3')]();}});}module[_0x6b91('0xf')]=updateAppConfig; \ No newline at end of file +var _0x0803=['path','../config/environment','resolve','legacy-libs','isArray','apps','name','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra'];(function(_0x168794,_0x2abf4a){var _0x5451d7=function(_0x346be9){while(--_0x346be9){_0x168794['push'](_0x168794['shift']());}};_0x5451d7(++_0x2abf4a);}(_0x0803,0x1ec));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};var fs=require(_0x3080('0x0'));var path=require(_0x3080('0x1'));var config=require(_0x3080('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x3080('0x3')](root,'server/app.json');var NODEPATH=path[_0x3080('0x3')](root,_0x3080('0x4'));function setLegacyLibsNodeEnvPath(_0x1b065b){let _0x137cd9=![];if(Array[_0x3080('0x5')](_0x1b065b['apps'])){var _0x12c871=_0x1b065b[_0x3080('0x6')]['findIndex'](function(_0x36fcca){return _0x36fcca[_0x3080('0x7')]==='motion2';});if(_0x12c871>-0x1){var _0x252263=_0x1b065b[_0x3080('0x6')][_0x12c871];if(typeof _0x252263['env'][_0x3080('0x8')]!=='string'){_0x252263['env'][_0x3080('0x8')]=NODEPATH;_0x137cd9=!![];}}return{'appConfig':_0x1b065b,'updated':_0x137cd9};}}function updateAppConfig(_0x2c73a2){return fs[_0x3080('0x9')](APP_JSON_PATH)[_0x3080('0xa')](function(_0x1099c0){if(_0x1099c0){return fs[_0x3080('0xb')](APP_JSON_PATH)[_0x3080('0xa')](function(_0x2c4c77){var _0x5ed67f=setLegacyLibsNodeEnvPath(_0x2c4c77);if(_0x5ed67f[_0x3080('0xc')]){_0x2c73a2[_0x3080('0xd')](_0x3080('0xe'));return fs[_0x3080('0xf')](APP_JSON_PATH,_0x2c4c77,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x3080('0x3')]();}});}module[_0x3080('0x10')]=updateAppConfig; \ No newline at end of file